From 034af8e775a9b79c09198d777b2e8a3e072bf592 Mon Sep 17 00:00:00 2001 From: Fabio Date: Mon, 24 Mar 2025 19:15:22 +0100 Subject: [PATCH] Initial commit --- README.md | 2 + jsconfig.json | 12 + .../svelte-native-jsx.d.ts | 32 + .../svelte-shims-v4.d.ts | 287 + node_modules/@alloc/quick-lru/index.d.ts | 128 + node_modules/@alloc/quick-lru/index.js | 263 + node_modules/@alloc/quick-lru/license | 9 + node_modules/@alloc/quick-lru/package.json | 43 + node_modules/@alloc/quick-lru/readme.md | 139 + node_modules/@isaacs/cliui/LICENSE.txt | 14 + node_modules/@isaacs/cliui/README.md | 143 + node_modules/@isaacs/cliui/build/index.cjs | 317 + node_modules/@isaacs/cliui/build/index.d.cts | 43 + node_modules/@isaacs/cliui/build/lib/index.js | 302 + node_modules/@isaacs/cliui/index.mjs | 14 + node_modules/@isaacs/cliui/package.json | 86 + .../@jridgewell/sourcemap-codec/LICENSE | 21 + .../@jridgewell/sourcemap-codec/README.md | 264 + .../sourcemap-codec/dist/sourcemap-codec.mjs | 424 + .../dist/sourcemap-codec.mjs.map | 1 + .../dist/sourcemap-codec.umd.js | 439 + .../dist/sourcemap-codec.umd.js.map | 1 + .../sourcemap-codec/dist/types/scopes.d.ts | 49 + .../dist/types/sourcemap-codec.d.ts | 8 + .../sourcemap-codec/dist/types/strings.d.ts | 15 + .../sourcemap-codec/dist/types/vlq.d.ts | 6 + .../@jridgewell/sourcemap-codec/package.json | 75 + node_modules/@nodelib/fs.scandir/LICENSE | 21 + node_modules/@nodelib/fs.scandir/README.md | 171 + .../@nodelib/fs.scandir/out/adapters/fs.d.ts | 20 + .../@nodelib/fs.scandir/out/adapters/fs.js | 19 + .../@nodelib/fs.scandir/out/constants.d.ts | 4 + .../@nodelib/fs.scandir/out/constants.js | 17 + .../@nodelib/fs.scandir/out/index.d.ts | 12 + node_modules/@nodelib/fs.scandir/out/index.js | 26 + .../fs.scandir/out/providers/async.d.ts | 7 + .../fs.scandir/out/providers/async.js | 104 + .../fs.scandir/out/providers/common.d.ts | 1 + .../fs.scandir/out/providers/common.js | 13 + .../fs.scandir/out/providers/sync.d.ts | 5 + .../@nodelib/fs.scandir/out/providers/sync.js | 54 + .../@nodelib/fs.scandir/out/settings.d.ts | 20 + .../@nodelib/fs.scandir/out/settings.js | 24 + .../@nodelib/fs.scandir/out/types/index.d.ts | 20 + .../@nodelib/fs.scandir/out/types/index.js | 2 + .../@nodelib/fs.scandir/out/utils/fs.d.ts | 2 + .../@nodelib/fs.scandir/out/utils/fs.js | 19 + .../@nodelib/fs.scandir/out/utils/index.d.ts | 2 + .../@nodelib/fs.scandir/out/utils/index.js | 5 + node_modules/@nodelib/fs.scandir/package.json | 44 + node_modules/@nodelib/fs.stat/LICENSE | 21 + node_modules/@nodelib/fs.stat/README.md | 126 + .../@nodelib/fs.stat/out/adapters/fs.d.ts | 13 + .../@nodelib/fs.stat/out/adapters/fs.js | 17 + node_modules/@nodelib/fs.stat/out/index.d.ts | 12 + node_modules/@nodelib/fs.stat/out/index.js | 26 + .../@nodelib/fs.stat/out/providers/async.d.ts | 4 + .../@nodelib/fs.stat/out/providers/async.js | 36 + .../@nodelib/fs.stat/out/providers/sync.d.ts | 3 + .../@nodelib/fs.stat/out/providers/sync.js | 23 + .../@nodelib/fs.stat/out/settings.d.ts | 16 + node_modules/@nodelib/fs.stat/out/settings.js | 16 + .../@nodelib/fs.stat/out/types/index.d.ts | 4 + .../@nodelib/fs.stat/out/types/index.js | 2 + node_modules/@nodelib/fs.stat/package.json | 37 + node_modules/@nodelib/fs.walk/LICENSE | 21 + node_modules/@nodelib/fs.walk/README.md | 215 + node_modules/@nodelib/fs.walk/out/index.d.ts | 14 + node_modules/@nodelib/fs.walk/out/index.js | 34 + .../@nodelib/fs.walk/out/providers/async.d.ts | 12 + .../@nodelib/fs.walk/out/providers/async.js | 30 + .../@nodelib/fs.walk/out/providers/index.d.ts | 4 + .../@nodelib/fs.walk/out/providers/index.js | 9 + .../fs.walk/out/providers/stream.d.ts | 12 + .../@nodelib/fs.walk/out/providers/stream.js | 34 + .../@nodelib/fs.walk/out/providers/sync.d.ts | 10 + .../@nodelib/fs.walk/out/providers/sync.js | 14 + .../@nodelib/fs.walk/out/readers/async.d.ts | 30 + .../@nodelib/fs.walk/out/readers/async.js | 97 + .../@nodelib/fs.walk/out/readers/common.d.ts | 7 + .../@nodelib/fs.walk/out/readers/common.js | 31 + .../@nodelib/fs.walk/out/readers/reader.d.ts | 6 + .../@nodelib/fs.walk/out/readers/reader.js | 11 + .../@nodelib/fs.walk/out/readers/sync.d.ts | 15 + .../@nodelib/fs.walk/out/readers/sync.js | 59 + .../@nodelib/fs.walk/out/settings.d.ts | 30 + node_modules/@nodelib/fs.walk/out/settings.js | 26 + .../@nodelib/fs.walk/out/types/index.d.ts | 8 + .../@nodelib/fs.walk/out/types/index.js | 2 + node_modules/@nodelib/fs.walk/package.json | 44 + node_modules/@pkgjs/parseargs/.editorconfig | 14 + node_modules/@pkgjs/parseargs/CHANGELOG.md | 147 + node_modules/@pkgjs/parseargs/LICENSE | 201 + node_modules/@pkgjs/parseargs/README.md | 413 + .../parseargs/examples/is-default-value.js | 25 + .../parseargs/examples/limit-long-syntax.js | 35 + .../@pkgjs/parseargs/examples/negate.js | 43 + .../parseargs/examples/no-repeated-options.js | 31 + .../parseargs/examples/ordered-options.mjs | 41 + .../parseargs/examples/simple-hard-coded.js | 26 + node_modules/@pkgjs/parseargs/index.js | 396 + .../@pkgjs/parseargs/internal/errors.js | 47 + .../@pkgjs/parseargs/internal/primordials.js | 393 + .../@pkgjs/parseargs/internal/util.js | 14 + .../@pkgjs/parseargs/internal/validators.js | 89 + node_modules/@pkgjs/parseargs/package.json | 36 + node_modules/@pkgjs/parseargs/utils.js | 198 + node_modules/@polka/url/build.js | 42 + node_modules/@polka/url/build.mjs | 40 + node_modules/@polka/url/index.d.ts | 10 + node_modules/@polka/url/package.json | 30 + node_modules/@polka/url/readme.md | 68 + .../node_modules/picomatch/LICENSE | 21 + .../node_modules/picomatch/README.md | 738 ++ .../node_modules/picomatch/index.js | 17 + .../node_modules/picomatch/lib/constants.js | 179 + .../node_modules/picomatch/lib/parse.js | 1085 +++ .../node_modules/picomatch/lib/picomatch.js | 341 + .../node_modules/picomatch/lib/scan.js | 391 + .../node_modules/picomatch/lib/utils.js | 72 + .../node_modules/picomatch/package.json | 83 + .../node_modules/picomatch/posix.js | 3 + node_modules/@sveltejs/adapter-auto/LICENSE | 7 + node_modules/@sveltejs/adapter-auto/README.md | 11 + .../@sveltejs/adapter-auto/adapters.js | 42 + .../@sveltejs/adapter-auto/index.d.ts | 3 + node_modules/@sveltejs/adapter-auto/index.js | 130 + .../@sveltejs/adapter-auto/package.json | 53 + .../vite-plugin-svelte-inspector/LICENSE | 21 + .../vite-plugin-svelte-inspector/README.md | 26 + .../vite-plugin-svelte-inspector/package.json | 56 + .../vite-plugin-svelte-inspector/src/debug.js | 3 + .../vite-plugin-svelte-inspector/src/index.js | 112 + .../src/options.js | 63 + .../src/public.d.ts | 78 + .../src/runtime/Inspector.svelte | 411 + .../src/runtime/load-inspector.js | 14 + .../vite-plugin-svelte-inspector/src/utils.js | 8 + .../types/index.d.ts | 82 + .../types/index.d.ts.map | 17 + node_modules/@types/cookie/LICENSE | 21 + node_modules/@types/cookie/README.md | 15 + node_modules/@types/cookie/index.d.ts | 154 + node_modules/@types/cookie/package.json | 30 + node_modules/@types/estree/LICENSE | 21 + node_modules/@types/estree/README.md | 15 + node_modules/@types/estree/flow.d.ts | 167 + node_modules/@types/estree/index.d.ts | 684 ++ node_modules/@types/estree/package.json | 26 + .../nft/node_modules/brace-expansion/LICENSE | 21 + .../node_modules/brace-expansion/README.md | 129 + .../nft/node_modules/brace-expansion/index.js | 201 + .../node_modules/brace-expansion/package.json | 47 + .../@vercel/nft/node_modules/glob/LICENSE | 21 + .../@vercel/nft/node_modules/glob/README.md | 378 + .../@vercel/nft/node_modules/glob/common.js | 238 + .../@vercel/nft/node_modules/glob/glob.js | 790 ++ .../nft/node_modules/glob/package.json | 55 + .../@vercel/nft/node_modules/glob/sync.js | 486 + .../nft/node_modules/minimatch/LICENSE | 15 + .../nft/node_modules/minimatch/README.md | 230 + .../nft/node_modules/minimatch/minimatch.js | 947 ++ .../nft/node_modules/minimatch/package.json | 33 + .../nft/node_modules/picomatch/LICENSE | 21 + .../nft/node_modules/picomatch/README.md | 738 ++ .../nft/node_modules/picomatch/index.js | 17 + .../node_modules/picomatch/lib/constants.js | 179 + .../nft/node_modules/picomatch/lib/parse.js | 1085 +++ .../node_modules/picomatch/lib/picomatch.js | 341 + .../nft/node_modules/picomatch/lib/scan.js | 391 + .../nft/node_modules/picomatch/lib/utils.js | 72 + .../nft/node_modules/picomatch/package.json | 83 + .../nft/node_modules/picomatch/posix.js | 3 + node_modules/ansi-styles/index.d.ts | 236 + node_modules/ansi-styles/index.js | 223 + node_modules/ansi-styles/license | 9 + node_modules/ansi-styles/package.json | 54 + node_modules/ansi-styles/readme.md | 173 + node_modules/any-promise/.jshintrc | 4 + node_modules/any-promise/.npmignore | 7 + node_modules/any-promise/LICENSE | 19 + node_modules/any-promise/README.md | 161 + node_modules/any-promise/implementation.d.ts | 3 + node_modules/any-promise/implementation.js | 1 + node_modules/any-promise/index.d.ts | 73 + node_modules/any-promise/index.js | 1 + node_modules/any-promise/loader.js | 78 + node_modules/any-promise/optional.js | 6 + node_modules/any-promise/package.json | 45 + node_modules/any-promise/register-shim.js | 18 + node_modules/any-promise/register.d.ts | 17 + node_modules/any-promise/register.js | 94 + .../any-promise/register/bluebird.d.ts | 1 + node_modules/any-promise/register/bluebird.js | 2 + .../any-promise/register/es6-promise.d.ts | 1 + .../any-promise/register/es6-promise.js | 2 + node_modules/any-promise/register/lie.d.ts | 1 + node_modules/any-promise/register/lie.js | 2 + .../register/native-promise-only.d.ts | 1 + .../register/native-promise-only.js | 2 + node_modules/any-promise/register/pinkie.d.ts | 1 + node_modules/any-promise/register/pinkie.js | 2 + .../any-promise/register/promise.d.ts | 1 + node_modules/any-promise/register/promise.js | 2 + node_modules/any-promise/register/q.d.ts | 1 + node_modules/any-promise/register/q.js | 2 + node_modules/any-promise/register/rsvp.d.ts | 1 + node_modules/any-promise/register/rsvp.js | 2 + node_modules/any-promise/register/vow.d.ts | 1 + node_modules/any-promise/register/vow.js | 2 + node_modules/any-promise/register/when.d.ts | 1 + node_modules/any-promise/register/when.js | 2 + node_modules/anymatch/LICENSE | 15 + node_modules/anymatch/README.md | 87 + node_modules/anymatch/index.d.ts | 20 + node_modules/anymatch/index.js | 104 + node_modules/anymatch/package.json | 48 + node_modules/arg/LICENSE.md | 21 + node_modules/arg/README.md | 317 + node_modules/arg/index.d.ts | 44 + node_modules/arg/index.js | 195 + node_modules/arg/package.json | 28 + node_modules/axobject-query/LICENSE | 201 + node_modules/axobject-query/README.md | 404 + .../axobject-query/lib/AXObjectElementMap.js | 92 + .../axobject-query/lib/AXObjectRoleMap.js | 92 + .../axobject-query/lib/AXObjectsMap.js | 178 + .../axobject-query/lib/elementAXObjectMap.js | 128 + .../lib/etc/objects/AbbrRole.js | 17 + .../lib/etc/objects/AlertDialogRole.js | 17 + .../lib/etc/objects/AlertRole.js | 17 + .../lib/etc/objects/AnnotationRole.js | 12 + .../lib/etc/objects/ApplicationRole.js | 17 + .../lib/etc/objects/ArticleRole.js | 22 + .../lib/etc/objects/AudioRole.js | 17 + .../lib/etc/objects/BannerRole.js | 17 + .../lib/etc/objects/BlockquoteRole.js | 17 + .../lib/etc/objects/BusyIndicatorRole.js | 20 + .../lib/etc/objects/ButtonRole.js | 22 + .../lib/etc/objects/CanvasRole.js | 17 + .../lib/etc/objects/CaptionRole.js | 17 + .../lib/etc/objects/CellRole.js | 27 + .../lib/etc/objects/CheckBoxRole.js | 26 + .../lib/etc/objects/ColorWellRole.js | 21 + .../lib/etc/objects/ColumnHeaderRole.js | 22 + .../lib/etc/objects/ColumnRole.js | 12 + .../lib/etc/objects/ComboBoxRole.js | 22 + .../lib/etc/objects/ComplementaryRole.js | 17 + .../lib/etc/objects/ContentInfoRole.js | 17 + .../lib/etc/objects/DateRole.js | 21 + .../lib/etc/objects/DateTimeRole.js | 21 + .../lib/etc/objects/DefinitionRole.js | 17 + .../etc/objects/DescriptionListDetailRole.js | 17 + .../lib/etc/objects/DescriptionListRole.js | 17 + .../etc/objects/DescriptionListTermRole.js | 17 + .../lib/etc/objects/DetailsRole.js | 17 + .../lib/etc/objects/DialogRole.js | 22 + .../lib/etc/objects/DirectoryRole.js | 22 + .../lib/etc/objects/DisclosureTriangleRole.js | 18 + .../axobject-query/lib/etc/objects/DivRole.js | 17 + .../lib/etc/objects/DocumentRole.js | 17 + .../lib/etc/objects/EmbeddedObjectRole.js | 17 + .../lib/etc/objects/FeedRole.js | 17 + .../lib/etc/objects/FigcaptionRole.js | 17 + .../lib/etc/objects/FigureRole.js | 22 + .../lib/etc/objects/FooterRole.js | 17 + .../lib/etc/objects/FormRole.js | 22 + .../lib/etc/objects/GridRole.js | 17 + .../lib/etc/objects/GroupRole.js | 17 + .../lib/etc/objects/HeadingRole.js | 47 + .../etc/objects/IframePresentationalRole.js | 12 + .../lib/etc/objects/IframeRole.js | 17 + .../lib/etc/objects/IgnoredRole.js | 12 + .../lib/etc/objects/ImageMapLinkRole.js | 12 + .../lib/etc/objects/ImageMapRole.js | 20 + .../lib/etc/objects/ImageRole.js | 22 + .../lib/etc/objects/InlineTextBoxRole.js | 17 + .../lib/etc/objects/InputTimeRole.js | 21 + .../lib/etc/objects/LabelRole.js | 17 + .../lib/etc/objects/LegendRole.js | 17 + .../lib/etc/objects/LineBreakRole.js | 17 + .../lib/etc/objects/LinkRole.js | 25 + .../lib/etc/objects/ListBoxOptionRole.js | 22 + .../lib/etc/objects/ListBoxRole.js | 27 + .../lib/etc/objects/ListItemRole.js | 22 + .../lib/etc/objects/ListMarkerRole.js | 12 + .../lib/etc/objects/ListRole.js | 27 + .../axobject-query/lib/etc/objects/LogRole.js | 17 + .../lib/etc/objects/MainRole.js | 22 + .../lib/etc/objects/MarkRole.js | 17 + .../lib/etc/objects/MarqueeRole.js | 22 + .../lib/etc/objects/MathRole.js | 17 + .../lib/etc/objects/MenuBarRole.js | 17 + .../lib/etc/objects/MenuButtonRole.js | 12 + .../lib/etc/objects/MenuItemCheckBoxRole.js | 17 + .../lib/etc/objects/MenuItemRadioRole.js | 17 + .../lib/etc/objects/MenuItemRole.js | 22 + .../lib/etc/objects/MenuListOptionRole.js | 12 + .../lib/etc/objects/MenuListPopupRole.js | 12 + .../lib/etc/objects/MenuRole.js | 22 + .../lib/etc/objects/MeterRole.js | 17 + .../lib/etc/objects/NavigationRole.js | 22 + .../lib/etc/objects/NoneRole.js | 17 + .../lib/etc/objects/NoteRole.js | 17 + .../lib/etc/objects/OutlineRole.js | 12 + .../lib/etc/objects/ParagraphRole.js | 17 + .../lib/etc/objects/PopUpButtonRole.js | 12 + .../axobject-query/lib/etc/objects/PreRole.js | 17 + .../lib/etc/objects/PresentationalRole.js | 17 + .../lib/etc/objects/ProgressIndicatorRole.js | 22 + .../lib/etc/objects/RadioButtonRole.js | 26 + .../lib/etc/objects/RadioGroupRole.js | 17 + .../lib/etc/objects/RegionRole.js | 17 + .../lib/etc/objects/RootWebAreaRole.js | 12 + .../lib/etc/objects/RowHeaderRole.js | 26 + .../axobject-query/lib/etc/objects/RowRole.js | 22 + .../lib/etc/objects/RubyRole.js | 17 + .../lib/etc/objects/RulerRole.js | 12 + .../lib/etc/objects/SVGRootRole.js | 12 + .../lib/etc/objects/ScrollAreaRole.js | 12 + .../lib/etc/objects/ScrollBarRole.js | 17 + .../lib/etc/objects/SeamlessWebAreaRole.js | 12 + .../lib/etc/objects/SearchBoxRole.js | 26 + .../lib/etc/objects/SearchRole.js | 17 + .../lib/etc/objects/SliderRole.js | 26 + .../lib/etc/objects/SliderThumbRole.js | 12 + .../lib/etc/objects/SpinButtonPartRole.js | 12 + .../lib/etc/objects/SpinButtonRole.js | 26 + .../lib/etc/objects/SplitterRole.js | 17 + .../lib/etc/objects/StaticTextRole.js | 12 + .../lib/etc/objects/StatusRole.js | 17 + .../lib/etc/objects/SwitchRole.js | 26 + .../lib/etc/objects/TabGroupRole.js | 17 + .../lib/etc/objects/TabListRole.js | 17 + .../lib/etc/objects/TabPanelRole.js | 17 + .../axobject-query/lib/etc/objects/TabRole.js | 17 + .../etc/objects/TableHeaderContainerRole.js | 12 + .../lib/etc/objects/TableRole.js | 22 + .../lib/etc/objects/TermRole.js | 17 + .../lib/etc/objects/TextAreaRole.js | 26 + .../lib/etc/objects/TextFieldRole.js | 31 + .../lib/etc/objects/TimeRole.js | 17 + .../lib/etc/objects/TimerRole.js | 17 + .../lib/etc/objects/ToggleButtonRole.js | 19 + .../lib/etc/objects/ToolbarRole.js | 17 + .../lib/etc/objects/TreeGridRole.js | 17 + .../lib/etc/objects/TreeItemRole.js | 17 + .../lib/etc/objects/TreeRole.js | 17 + .../etc/objects/UserInterfaceTooltipRole.js | 17 + .../lib/etc/objects/VideoRole.js | 17 + .../lib/etc/objects/WebAreaRole.js | 12 + .../lib/etc/objects/WindowRole.js | 12 + node_modules/axobject-query/lib/index.js | 19 + .../lib/util/iterationDecorator.js | 17 + .../axobject-query/lib/util/iteratorProxy.js | 33 + node_modules/axobject-query/package.json | 69 + .../balanced-match/.github/FUNDING.yml | 2 + node_modules/balanced-match/LICENSE.md | 21 + node_modules/balanced-match/README.md | 97 + node_modules/balanced-match/index.js | 62 + node_modules/balanced-match/package.json | 48 + .../brace-expansion/.github/FUNDING.yml | 2 + node_modules/brace-expansion/LICENSE | 21 + node_modules/brace-expansion/README.md | 135 + node_modules/brace-expansion/index.js | 203 + node_modules/brace-expansion/package.json | 46 + node_modules/braces/LICENSE | 21 + node_modules/braces/README.md | 586 ++ node_modules/braces/index.js | 170 + node_modules/braces/lib/compile.js | 60 + node_modules/braces/lib/constants.js | 57 + node_modules/braces/lib/expand.js | 113 + node_modules/braces/lib/parse.js | 331 + node_modules/braces/lib/stringify.js | 32 + node_modules/braces/lib/utils.js | 122 + node_modules/braces/package.json | 77 + node_modules/camelcase-css/README.md | 27 + node_modules/camelcase-css/index-es5.js | 24 + node_modules/camelcase-css/index.js | 30 + node_modules/camelcase-css/license | 21 + node_modules/camelcase-css/package.json | 34 + node_modules/color-convert/CHANGELOG.md | 54 + node_modules/color-convert/LICENSE | 21 + node_modules/color-convert/README.md | 68 + node_modules/color-convert/conversions.js | 839 ++ node_modules/color-convert/index.js | 81 + node_modules/color-convert/package.json | 48 + node_modules/color-convert/route.js | 97 + node_modules/color-name/LICENSE | 8 + node_modules/color-name/README.md | 11 + node_modules/color-name/index.js | 152 + node_modules/color-name/package.json | 28 + node_modules/commander/CHANGELOG.md | 436 + node_modules/commander/LICENSE | 22 + node_modules/commander/Readme.md | 713 ++ node_modules/commander/index.js | 1649 ++++ node_modules/commander/package.json | 41 + node_modules/commander/typings/index.d.ts | 311 + node_modules/commondir/LICENSE | 24 + node_modules/commondir/example/dir.js | 3 + node_modules/commondir/index.js | 29 + node_modules/commondir/package.json | 34 + node_modules/commondir/readme.markdown | 48 + node_modules/commondir/test/dirs.js | 55 + node_modules/concat-map/.travis.yml | 4 + node_modules/concat-map/LICENSE | 18 + node_modules/concat-map/README.markdown | 62 + 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/cookie/HISTORY.md | 147 + node_modules/cookie/LICENSE | 24 + node_modules/cookie/README.md | 317 + node_modules/cookie/SECURITY.md | 25 + node_modules/cookie/index.js | 274 + node_modules/cookie/package.json | 44 + node_modules/css-selector-tokenizer/LICENSE | 7 + node_modules/css-selector-tokenizer/README.md | 92 + .../css-selector-tokenizer/lib/index.js | 4 + .../css-selector-tokenizer/lib/parse.js | 239 + .../css-selector-tokenizer/lib/parseValues.js | 167 + .../css-selector-tokenizer/lib/stringify.js | 62 + .../lib/stringifyValues.js | 62 + .../css-selector-tokenizer/lib/uni-regexp.js | 6 + .../css-selector-tokenizer/package.json | 48 + node_modules/cssesc/LICENSE-MIT.txt | 20 + node_modules/cssesc/README.md | 201 + node_modules/cssesc/bin/cssesc | 116 + node_modules/cssesc/cssesc.js | 110 + node_modules/cssesc/man/cssesc.1 | 70 + node_modules/cssesc/package.json | 51 + node_modules/deepmerge/.editorconfig | 7 + node_modules/deepmerge/.eslintcache | 1 + node_modules/deepmerge/changelog.md | 167 + node_modules/deepmerge/dist/cjs.js | 133 + node_modules/deepmerge/dist/umd.js | 139 + node_modules/deepmerge/index.d.ts | 20 + node_modules/deepmerge/index.js | 106 + node_modules/deepmerge/license.txt | 21 + node_modules/deepmerge/package.json | 42 + node_modules/deepmerge/readme.md | 264 + node_modules/deepmerge/rollup.config.js | 22 + node_modules/devalue/LICENSE | 7 + node_modules/devalue/README.md | 226 + node_modules/devalue/index.js | 3 + node_modules/devalue/package.json | 34 + node_modules/devalue/src/base64.js | 110 + node_modules/devalue/src/constants.js | 6 + node_modules/devalue/src/parse.js | 160 + node_modules/devalue/src/stringify.js | 232 + node_modules/devalue/src/types.d.ts | 1 + node_modules/devalue/src/uneval.js | 351 + node_modules/devalue/src/utils.js | 113 + node_modules/devalue/types/index.d.ts | 26 + node_modules/devalue/types/index.d.ts.map | 21 + node_modules/didyoumean/LICENSE | 14 + node_modules/didyoumean/README.md | 134 + node_modules/didyoumean/didYouMean-1.2.1.js | 274 + .../didyoumean/didYouMean-1.2.1.min.js | 17 + node_modules/didyoumean/package.json | 27 + node_modules/dlv/README.md | 76 + node_modules/dlv/dist/dlv.es.js | 2 + node_modules/dlv/dist/dlv.es.js.map | 1 + node_modules/dlv/dist/dlv.js | 2 + node_modules/dlv/dist/dlv.js.map | 1 + node_modules/dlv/dist/dlv.umd.js | 2 + node_modules/dlv/dist/dlv.umd.js.map | 1 + node_modules/dlv/index.js | 7 + node_modules/dlv/package.json | 30 + node_modules/eastasianwidth/README.md | 32 + node_modules/eastasianwidth/eastasianwidth.js | 311 + node_modules/eastasianwidth/package.json | 18 + node_modules/email-addresses/.travis.yml | 25 + node_modules/email-addresses/Changes.md | 77 + node_modules/email-addresses/LICENSE | 19 + node_modules/email-addresses/README.md | 211 + node_modules/email-addresses/bower.json | 29 + .../email-addresses/lib/email-addresses.d.ts | 121 + .../email-addresses/lib/email-addresses.js | 1098 +++ .../lib/email-addresses.min.js | 1 + node_modules/email-addresses/package.json | 30 + .../email-addresses/test/email-addresses.js | 400 + node_modules/email-addresses/test/is_email.js | 87 + node_modules/email-addresses/test/tests.xml | 1253 +++ node_modules/emoji-regex/LICENSE-MIT.txt | 20 + node_modules/emoji-regex/README.md | 137 + node_modules/emoji-regex/RGI_Emoji.d.ts | 5 + node_modules/emoji-regex/RGI_Emoji.js | 6 + .../emoji-regex/es2015/RGI_Emoji.d.ts | 5 + node_modules/emoji-regex/es2015/RGI_Emoji.js | 6 + node_modules/emoji-regex/es2015/index.d.ts | 5 + node_modules/emoji-regex/es2015/index.js | 6 + node_modules/emoji-regex/es2015/text.d.ts | 5 + node_modules/emoji-regex/es2015/text.js | 6 + node_modules/emoji-regex/index.d.ts | 5 + node_modules/emoji-regex/index.js | 6 + node_modules/emoji-regex/package.json | 52 + node_modules/emoji-regex/text.d.ts | 5 + node_modules/emoji-regex/text.js | 6 + node_modules/escape-string-regexp/index.js | 11 + node_modules/escape-string-regexp/license | 21 + .../escape-string-regexp/package.json | 41 + node_modules/escape-string-regexp/readme.md | 27 + node_modules/estree-walker/CHANGELOG.md | 92 + node_modules/estree-walker/LICENSE | 7 + node_modules/estree-walker/README.md | 48 + .../estree-walker/dist/esm/estree-walker.js | 333 + .../estree-walker/dist/esm/package.json | 1 + .../estree-walker/dist/umd/estree-walker.js | 344 + node_modules/estree-walker/package.json | 37 + node_modules/estree-walker/src/async.js | 118 + node_modules/estree-walker/src/index.js | 35 + node_modules/estree-walker/src/package.json | 1 + node_modules/estree-walker/src/sync.js | 118 + node_modules/estree-walker/src/walker.js | 61 + node_modules/estree-walker/types/async.d.ts | 53 + node_modules/estree-walker/types/index.d.ts | 56 + node_modules/estree-walker/types/sync.d.ts | 53 + .../estree-walker/types/tsconfig.tsbuildinfo | 345 + node_modules/estree-walker/types/walker.d.ts | 37 + .../node_modules/glob-parent/CHANGELOG.md | 110 + .../node_modules/glob-parent/LICENSE | 15 + .../node_modules/glob-parent/README.md | 137 + .../node_modules/glob-parent/index.js | 42 + .../node_modules/glob-parent/package.json | 48 + node_modules/fastparse/LICENSE | 7 + node_modules/fastparse/README.md | 118 + node_modules/fastparse/lib/Parser.js | 108 + node_modules/fastparse/package.json | 39 + node_modules/filename-reserved-regex/index.js | 5 + node_modules/filename-reserved-regex/license | 21 + .../filename-reserved-regex/package.json | 36 + .../filename-reserved-regex/readme.md | 49 + node_modules/filenamify/filenamify-path.d.ts | 8 + node_modules/filenamify/filenamify-path.js | 10 + node_modules/filenamify/filenamify.d.ts | 39 + node_modules/filenamify/filenamify.js | 40 + node_modules/filenamify/index.d.ts | 24 + node_modules/filenamify/index.js | 8 + node_modules/filenamify/license | 9 + node_modules/filenamify/package.json | 54 + node_modules/filenamify/readme.md | 74 + node_modules/fill-range/LICENSE | 21 + node_modules/fill-range/README.md | 237 + node_modules/fill-range/index.js | 248 + node_modules/fill-range/package.json | 74 + node_modules/find-cache-dir/index.js | 67 + node_modules/find-cache-dir/license | 9 + node_modules/find-cache-dir/package.json | 44 + node_modules/find-cache-dir/readme.md | 123 + node_modules/find-up/index.d.ts | 137 + node_modules/find-up/index.js | 89 + node_modules/find-up/license | 9 + node_modules/find-up/package.json | 53 + node_modules/find-up/readme.md | 156 + node_modules/fs.realpath/LICENSE | 43 + node_modules/fs.realpath/README.md | 33 + node_modules/fs.realpath/index.js | 66 + node_modules/fs.realpath/old.js | 303 + node_modules/fs.realpath/package.json | 26 + node_modules/function-bind/.eslintrc | 21 + .../function-bind/.github/FUNDING.yml | 12 + .../function-bind/.github/SECURITY.md | 3 + node_modules/function-bind/.nycrc | 13 + node_modules/function-bind/CHANGELOG.md | 136 + node_modules/function-bind/LICENSE | 20 + node_modules/function-bind/README.md | 46 + node_modules/function-bind/implementation.js | 84 + node_modules/function-bind/index.js | 5 + node_modules/function-bind/package.json | 87 + node_modules/function-bind/test/.eslintrc | 9 + node_modules/function-bind/test/index.js | 252 + node_modules/glob-parent/LICENSE | 15 + node_modules/glob-parent/README.md | 134 + node_modules/glob-parent/index.js | 75 + node_modules/glob-parent/package.json | 54 + node_modules/glob/LICENSE | 15 + node_modules/glob/README.md | 399 + node_modules/glob/common.js | 244 + node_modules/glob/glob.js | 790 ++ node_modules/glob/package.json | 55 + node_modules/glob/sync.js | 486 + node_modules/globalyzer/license | 21 + node_modules/globalyzer/package.json | 28 + node_modules/globalyzer/readme.md | 57 + node_modules/globalyzer/src/.DS_Store | Bin 0 -> 6148 bytes node_modules/globalyzer/src/index.js | 96 + node_modules/globrex/index.js | 271 + node_modules/globrex/license | 21 + node_modules/globrex/package.json | 30 + node_modules/globrex/readme.md | 178 + node_modules/graceful-fs/LICENSE | 15 + node_modules/graceful-fs/README.md | 143 + node_modules/graceful-fs/clone.js | 23 + node_modules/graceful-fs/graceful-fs.js | 448 + node_modules/graceful-fs/legacy-streams.js | 118 + node_modules/graceful-fs/package.json | 53 + node_modules/graceful-fs/polyfills.js | 355 + node_modules/hasown/.eslintrc | 5 + node_modules/hasown/.github/FUNDING.yml | 12 + node_modules/hasown/.nycrc | 13 + node_modules/hasown/CHANGELOG.md | 40 + node_modules/hasown/LICENSE | 21 + node_modules/hasown/README.md | 40 + node_modules/hasown/index.d.ts | 3 + node_modules/hasown/index.js | 8 + node_modules/hasown/package.json | 92 + node_modules/hasown/tsconfig.json | 6 + node_modules/import-meta-resolve/index.d.ts | 18 + node_modules/import-meta-resolve/index.js | 47 + .../import-meta-resolve/lib/errors.d.ts | 23 + .../import-meta-resolve/lib/errors.js | 507 + .../import-meta-resolve/lib/get-format.d.ts | 12 + .../import-meta-resolve/lib/get-format.js | 159 + .../lib/package-json-reader.d.ts | 31 + .../lib/package-json-reader.js | 177 + .../import-meta-resolve/lib/resolve.d.ts | 33 + .../import-meta-resolve/lib/resolve.js | 1297 +++ .../import-meta-resolve/lib/utils.d.ts | 5 + node_modules/import-meta-resolve/lib/utils.js | 47 + node_modules/import-meta-resolve/license | 74 + node_modules/import-meta-resolve/package.json | 95 + node_modules/import-meta-resolve/readme.md | 252 + node_modules/inflight/LICENSE | 15 + node_modules/inflight/README.md | 37 + node_modules/inflight/inflight.js | 54 + node_modules/inflight/package.json | 29 + node_modules/inherits/LICENSE | 16 + node_modules/inherits/README.md | 42 + node_modules/inherits/inherits.js | 9 + node_modules/inherits/inherits_browser.js | 27 + node_modules/inherits/package.json | 29 + node_modules/is-binary-path/index.d.ts | 17 + node_modules/is-binary-path/index.js | 7 + node_modules/is-binary-path/license | 9 + node_modules/is-binary-path/package.json | 40 + node_modules/is-binary-path/readme.md | 34 + node_modules/is-extglob/LICENSE | 21 + node_modules/is-extglob/README.md | 107 + node_modules/is-extglob/index.js | 20 + node_modules/is-extglob/package.json | 69 + .../is-fullwidth-code-point/index.d.ts | 17 + node_modules/is-fullwidth-code-point/index.js | 50 + node_modules/is-fullwidth-code-point/license | 9 + .../is-fullwidth-code-point/package.json | 42 + .../is-fullwidth-code-point/readme.md | 39 + node_modules/is-glob/LICENSE | 21 + node_modules/is-glob/README.md | 206 + node_modules/is-glob/index.js | 150 + node_modules/is-glob/package.json | 81 + node_modules/is-number/LICENSE | 21 + node_modules/is-number/README.md | 187 + node_modules/is-number/index.js | 18 + node_modules/is-number/package.json | 82 + node_modules/isexe/.npmignore | 2 + node_modules/isexe/LICENSE | 15 + node_modules/isexe/README.md | 51 + node_modules/isexe/index.js | 57 + node_modules/isexe/mode.js | 41 + node_modules/isexe/package.json | 31 + node_modules/isexe/test/basic.js | 221 + node_modules/isexe/windows.js | 42 + node_modules/jsonfile/CHANGELOG.md | 171 + node_modules/jsonfile/LICENSE | 15 + node_modules/jsonfile/README.md | 230 + node_modules/jsonfile/index.js | 88 + node_modules/jsonfile/package.json | 40 + node_modules/jsonfile/utils.js | 14 + node_modules/kleur/colors.d.ts | 38 + node_modules/kleur/colors.js | 53 + node_modules/kleur/colors.mjs | 53 + node_modules/kleur/index.d.ts | 45 + node_modules/kleur/index.js | 110 + node_modules/kleur/index.mjs | 110 + node_modules/kleur/license | 21 + node_modules/kleur/package.json | 51 + node_modules/kleur/readme.md | 232 + node_modules/lines-and-columns/LICENSE | 21 + node_modules/lines-and-columns/README.md | 33 + .../lines-and-columns/build/index.d.ts | 13 + node_modules/lines-and-columns/build/index.js | 62 + node_modules/lines-and-columns/package.json | 49 + node_modules/locate-character/README.md | 66 + node_modules/locate-character/package.json | 44 + node_modules/locate-character/src/index.js | 72 + node_modules/locate-character/src/types.d.ts | 17 + .../locate-character/types/index.d.ts | 19 + .../locate-character/types/index.d.ts.map | 19 + node_modules/locate-path/index.d.ts | 83 + node_modules/locate-path/index.js | 65 + node_modules/locate-path/license | 9 + node_modules/locate-path/package.json | 45 + node_modules/locate-path/readme.md | 122 + node_modules/make-dir/index.d.ts | 66 + node_modules/make-dir/index.js | 156 + node_modules/make-dir/license | 9 + .../make-dir/node_modules/semver/LICENSE | 15 + .../make-dir/node_modules/semver/README.md | 443 + .../node_modules/semver/bin/semver.js | 174 + .../make-dir/node_modules/semver/package.json | 38 + .../make-dir/node_modules/semver/range.bnf | 16 + .../make-dir/node_modules/semver/semver.js | 1643 ++++ node_modules/make-dir/package.json | 59 + node_modules/make-dir/readme.md | 125 + node_modules/merge2/LICENSE | 21 + node_modules/merge2/README.md | 144 + node_modules/merge2/index.js | 144 + node_modules/merge2/package.json | 43 + node_modules/micromatch/LICENSE | 21 + node_modules/micromatch/README.md | 1024 +++ node_modules/micromatch/index.js | 474 + node_modules/micromatch/package.json | 119 + node_modules/minimatch/LICENSE | 15 + node_modules/minimatch/README.md | 259 + node_modules/minimatch/lib/path.js | 4 + node_modules/minimatch/minimatch.js | 944 ++ node_modules/minimatch/package.json | 35 + node_modules/minipass/LICENSE | 15 + node_modules/minipass/README.md | 825 ++ .../minipass/dist/commonjs/index.d.ts | 549 ++ .../minipass/dist/commonjs/index.d.ts.map | 1 + node_modules/minipass/dist/commonjs/index.js | 1028 +++ .../minipass/dist/commonjs/index.js.map | 1 + .../minipass/dist/commonjs/package.json | 3 + node_modules/minipass/dist/esm/index.d.ts | 549 ++ node_modules/minipass/dist/esm/index.d.ts.map | 1 + node_modules/minipass/dist/esm/index.js | 1018 +++ node_modules/minipass/dist/esm/index.js.map | 1 + node_modules/minipass/dist/esm/package.json | 3 + node_modules/minipass/package.json | 82 + node_modules/mri/index.d.ts | 21 + node_modules/mri/lib/index.js | 119 + node_modules/mri/lib/index.mjs | 119 + node_modules/mri/license.md | 21 + node_modules/mri/package.json | 43 + node_modules/mri/readme.md | 166 + node_modules/mrmime/index.d.ts | 2 + node_modules/mrmime/index.js | 445 + node_modules/mrmime/index.mjs | 444 + node_modules/mrmime/license | 21 + node_modules/mrmime/package.json | 44 + node_modules/mrmime/readme.md | 127 + node_modules/ms/index.js | 162 + node_modules/ms/license.md | 21 + node_modules/ms/package.json | 38 + node_modules/ms/readme.md | 59 + node_modules/mz/HISTORY.md | 66 + node_modules/mz/LICENSE | 22 + node_modules/mz/README.md | 106 + node_modules/mz/child_process.js | 8 + node_modules/mz/crypto.js | 9 + node_modules/mz/dns.js | 16 + node_modules/mz/fs.js | 62 + node_modules/mz/index.js | 8 + node_modules/mz/package.json | 44 + node_modules/mz/readline.js | 64 + node_modules/mz/zlib.js | 13 + node_modules/nanoid/.devcontainer.json | 23 + node_modules/nanoid/LICENSE | 20 + node_modules/nanoid/README.md | 554 ++ node_modules/nanoid/async/index.browser.cjs | 69 + node_modules/nanoid/async/index.browser.js | 69 + node_modules/nanoid/async/index.cjs | 71 + node_modules/nanoid/async/index.d.ts | 56 + node_modules/nanoid/async/index.js | 71 + node_modules/nanoid/async/index.native.js | 57 + node_modules/nanoid/async/package.json | 12 + node_modules/nanoid/bin/nanoid.cjs | 55 + node_modules/nanoid/index.browser.cjs | 72 + node_modules/nanoid/index.browser.js | 72 + node_modules/nanoid/index.cjs | 85 + node_modules/nanoid/index.d.cts | 91 + node_modules/nanoid/index.d.ts | 91 + node_modules/nanoid/index.js | 85 + node_modules/nanoid/nanoid.js | 1 + node_modules/nanoid/non-secure/index.cjs | 34 + node_modules/nanoid/non-secure/index.d.ts | 33 + node_modules/nanoid/non-secure/index.js | 34 + node_modules/nanoid/non-secure/package.json | 6 + node_modules/nanoid/package.json | 88 + node_modules/nanoid/url-alphabet/index.cjs | 7 + node_modules/nanoid/url-alphabet/index.js | 7 + node_modules/nanoid/url-alphabet/package.json | 6 + node_modules/normalize-path/LICENSE | 21 + node_modules/normalize-path/README.md | 127 + node_modules/normalize-path/index.js | 35 + node_modules/normalize-path/package.json | 77 + node_modules/normalize-range/index.js | 54 + node_modules/normalize-range/license | 21 + node_modules/normalize-range/package.json | 46 + node_modules/normalize-range/readme.md | 148 + node_modules/npm/LICENSE | 235 + node_modules/npm/README.md | 63 + node_modules/npm/bin/node-gyp-bin/node-gyp | 6 + .../npm/bin/node-gyp-bin/node-gyp.cmd | 5 + node_modules/npm/bin/npm | 65 + node_modules/npm/bin/npm-cli.js | 2 + node_modules/npm/bin/npm-prefix.js | 30 + node_modules/npm/bin/npm.cmd | 20 + node_modules/npm/bin/npm.ps1 | 32 + node_modules/npm/bin/npx | 65 + node_modules/npm/bin/npx-cli.js | 130 + node_modules/npm/bin/npx.cmd | 20 + node_modules/npm/bin/npx.ps1 | 32 + .../npm/docs/content/commands/npm-access.md | 123 + .../npm/docs/content/commands/npm-adduser.md | 86 + .../npm/docs/content/commands/npm-audit.md | 478 + .../npm/docs/content/commands/npm-bugs.md | 109 + .../npm/docs/content/commands/npm-cache.md | 94 + .../npm/docs/content/commands/npm-ci.md | 318 + .../docs/content/commands/npm-completion.md | 41 + .../npm/docs/content/commands/npm-config.md | 182 + .../npm/docs/content/commands/npm-dedupe.md | 320 + .../docs/content/commands/npm-deprecate.md | 73 + .../npm/docs/content/commands/npm-diff.md | 319 + .../npm/docs/content/commands/npm-dist-tag.md | 154 + .../npm/docs/content/commands/npm-docs.md | 108 + .../npm/docs/content/commands/npm-doctor.md | 123 + .../npm/docs/content/commands/npm-edit.md | 46 + .../npm/docs/content/commands/npm-exec.md | 366 + .../npm/docs/content/commands/npm-explain.md | 105 + .../npm/docs/content/commands/npm-explore.md | 49 + .../docs/content/commands/npm-find-dupes.md | 246 + .../npm/docs/content/commands/npm-fund.md | 145 + .../docs/content/commands/npm-help-search.md | 40 + .../npm/docs/content/commands/npm-help.md | 46 + .../npm/docs/content/commands/npm-init.md | 349 + .../content/commands/npm-install-ci-test.md | 265 + .../docs/content/commands/npm-install-test.md | 372 + .../npm/docs/content/commands/npm-install.md | 806 ++ .../npm/docs/content/commands/npm-link.md | 396 + .../npm/docs/content/commands/npm-login.md | 93 + .../npm/docs/content/commands/npm-logout.md | 75 + .../npm/docs/content/commands/npm-ls.md | 266 + .../npm/docs/content/commands/npm-org.md | 114 + .../npm/docs/content/commands/npm-outdated.md | 178 + .../npm/docs/content/commands/npm-owner.md | 106 + .../npm/docs/content/commands/npm-pack.md | 140 + .../npm/docs/content/commands/npm-ping.md | 46 + .../npm/docs/content/commands/npm-pkg.md | 272 + .../npm/docs/content/commands/npm-prefix.md | 59 + .../npm/docs/content/commands/npm-profile.md | 120 + .../npm/docs/content/commands/npm-prune.md | 197 + .../npm/docs/content/commands/npm-publish.md | 241 + .../npm/docs/content/commands/npm-query.md | 273 + .../npm/docs/content/commands/npm-rebuild.md | 169 + .../npm/docs/content/commands/npm-repo.md | 102 + .../npm/docs/content/commands/npm-restart.md | 70 + .../npm/docs/content/commands/npm-root.md | 51 + .../docs/content/commands/npm-run-script.md | 254 + .../npm/docs/content/commands/npm-sbom.md | 319 + .../npm/docs/content/commands/npm-search.md | 160 + .../docs/content/commands/npm-shrinkwrap.md | 32 + .../npm/docs/content/commands/npm-star.md | 78 + .../npm/docs/content/commands/npm-stars.md | 40 + .../npm/docs/content/commands/npm-start.md | 80 + .../npm/docs/content/commands/npm-stop.md | 73 + .../npm/docs/content/commands/npm-team.md | 155 + .../npm/docs/content/commands/npm-test.md | 70 + .../npm/docs/content/commands/npm-token.md | 112 + .../docs/content/commands/npm-uninstall.md | 159 + .../docs/content/commands/npm-unpublish.md | 136 + .../npm/docs/content/commands/npm-unstar.md | 74 + .../npm/docs/content/commands/npm-update.md | 446 + .../npm/docs/content/commands/npm-version.md | 235 + .../npm/docs/content/commands/npm-view.md | 200 + .../npm/docs/content/commands/npm-whoami.md | 41 + node_modules/npm/docs/content/commands/npm.md | 175 + node_modules/npm/docs/content/commands/npx.md | 168 + .../docs/content/configuring-npm/folders.md | 219 + .../docs/content/configuring-npm/install.md | 78 + .../configuring-npm/npm-shrinkwrap-json.md | 34 + .../npm/docs/content/configuring-npm/npmrc.md | 140 + .../content/configuring-npm/package-json.md | 1250 +++ .../configuring-npm/package-lock-json.md | 237 + .../npm/docs/content/using-npm/config.md | 2020 ++++ .../content/using-npm/dependency-selectors.md | 223 + .../npm/docs/content/using-npm/developers.md | 248 + .../npm/docs/content/using-npm/logging.md | 96 + .../npm/docs/content/using-npm/orgs.md | 93 + .../docs/content/using-npm/package-spec.md | 105 + .../npm/docs/content/using-npm/registry.md | 86 + .../npm/docs/content/using-npm/removal.md | 60 + .../npm/docs/content/using-npm/scope.md | 143 + .../npm/docs/content/using-npm/scripts.md | 363 + .../npm/docs/content/using-npm/workspaces.md | 226 + node_modules/npm/docs/lib/index.js | 189 + .../npm/docs/output/commands/npm-access.html | 270 + .../npm/docs/output/commands/npm-adduser.html | 226 + .../npm/docs/output/commands/npm-audit.html | 517 ++ .../npm/docs/output/commands/npm-bugs.html | 251 + .../npm/docs/output/commands/npm-cache.html | 244 + .../npm/docs/output/commands/npm-ci.html | 406 + .../docs/output/commands/npm-completion.html | 194 + .../npm/docs/output/commands/npm-config.html | 291 + .../npm/docs/output/commands/npm-dedupe.html | 403 + .../docs/output/commands/npm-deprecate.html | 214 + .../npm/docs/output/commands/npm-diff.html | 407 + .../docs/output/commands/npm-dist-tag.html | 289 + .../npm/docs/output/commands/npm-docs.html | 250 + .../npm/docs/output/commands/npm-doctor.html | 262 + .../npm/docs/output/commands/npm-edit.html | 198 + .../npm/docs/output/commands/npm-exec.html | 443 + .../npm/docs/output/commands/npm-explain.html | 250 + .../npm/docs/output/commands/npm-explore.html | 198 + .../docs/output/commands/npm-find-dupes.html | 349 + .../npm/docs/output/commands/npm-fund.html | 275 + .../docs/output/commands/npm-help-search.html | 192 + .../npm/docs/output/commands/npm-help.html | 198 + .../npm/docs/output/commands/npm-init.html | 430 + .../output/commands/npm-install-ci-test.html | 364 + .../output/commands/npm-install-test.html | 441 + .../npm/docs/output/commands/npm-install.html | 803 ++ .../npm/docs/output/commands/npm-link.html | 458 + .../npm/docs/output/commands/npm-login.html | 230 + .../npm/docs/output/commands/npm-logout.html | 217 + .../npm/docs/output/commands/npm-ls.html | 365 + .../npm/docs/output/commands/npm-org.html | 239 + .../docs/output/commands/npm-outdated.html | 313 + .../npm/docs/output/commands/npm-owner.html | 251 + .../npm/docs/output/commands/npm-pack.html | 274 + .../npm/docs/output/commands/npm-ping.html | 197 + .../npm/docs/output/commands/npm-pkg.html | 372 + .../npm/docs/output/commands/npm-prefix.html | 208 + .../npm/docs/output/commands/npm-profile.html | 269 + .../npm/docs/output/commands/npm-prune.html | 313 + .../npm/docs/output/commands/npm-publish.html | 361 + .../npm/docs/output/commands/npm-query.html | 394 + .../npm/docs/output/commands/npm-rebuild.html | 297 + .../npm/docs/output/commands/npm-repo.html | 244 + .../npm/docs/output/commands/npm-restart.html | 219 + .../npm/docs/output/commands/npm-root.html | 203 + .../docs/output/commands/npm-run-script.html | 354 + .../npm/docs/output/commands/npm-sbom.html | 447 + .../npm/docs/output/commands/npm-search.html | 281 + .../docs/output/commands/npm-shrinkwrap.html | 190 + .../npm/docs/output/commands/npm-star.html | 217 + .../npm/docs/output/commands/npm-stars.html | 193 + .../npm/docs/output/commands/npm-start.html | 222 + .../npm/docs/output/commands/npm-stop.html | 217 + .../npm/docs/output/commands/npm-team.html | 280 + .../npm/docs/output/commands/npm-test.html | 215 + .../npm/docs/output/commands/npm-token.html | 256 + .../docs/output/commands/npm-uninstall.html | 286 + .../docs/output/commands/npm-unpublish.html | 275 + .../npm/docs/output/commands/npm-unstar.html | 214 + .../npm/docs/output/commands/npm-update.html | 494 + .../npm/docs/output/commands/npm-version.html | 349 + .../npm/docs/output/commands/npm-view.html | 305 + .../npm/docs/output/commands/npm-whoami.html | 193 + .../npm/docs/output/commands/npm.html | 304 + .../npm/docs/output/commands/npx.html | 293 + .../docs/output/configuring-npm/folders.html | 330 + .../docs/output/configuring-npm/install.html | 225 + .../output/configuring-npm/npm-global.html | 330 + .../docs/output/configuring-npm/npm-json.html | 1121 +++ .../configuring-npm/npm-shrinkwrap-json.html | 192 + .../docs/output/configuring-npm/npmrc.html | 272 + .../output/configuring-npm/package-json.html | 1121 +++ .../configuring-npm/package-lock-json.html | 399 + .../npm/docs/output/using-npm/config.html | 1618 ++++ .../using-npm/dependency-selectors.html | 356 + .../npm/docs/output/using-npm/developers.html | 362 + .../npm/docs/output/using-npm/logging.html | 236 + .../npm/docs/output/using-npm/orgs.html | 244 + .../docs/output/using-npm/package-spec.html | 263 + .../npm/docs/output/using-npm/registry.html | 234 + .../npm/docs/output/using-npm/removal.html | 205 + .../npm/docs/output/using-npm/scope.html | 265 + .../npm/docs/output/using-npm/scripts.html | 485 + .../npm/docs/output/using-npm/workspaces.html | 321 + node_modules/npm/index.js | 5 + node_modules/npm/lib/arborist-cmd.js | 53 + node_modules/npm/lib/base-cmd.js | 215 + node_modules/npm/lib/cli.js | 12 + node_modules/npm/lib/cli/entry.js | 74 + node_modules/npm/lib/cli/exit-handler.js | 174 + node_modules/npm/lib/cli/update-notifier.js | 121 + node_modules/npm/lib/cli/validate-engines.js | 49 + node_modules/npm/lib/commands/access.js | 222 + node_modules/npm/lib/commands/adduser.js | 50 + node_modules/npm/lib/commands/audit.js | 121 + node_modules/npm/lib/commands/bugs.js | 34 + node_modules/npm/lib/commands/cache.js | 218 + node_modules/npm/lib/commands/ci.js | 129 + node_modules/npm/lib/commands/completion.js | 283 + node_modules/npm/lib/commands/config.js | 410 + node_modules/npm/lib/commands/dedupe.js | 51 + node_modules/npm/lib/commands/deprecate.js | 76 + node_modules/npm/lib/commands/diff.js | 291 + node_modules/npm/lib/commands/dist-tag.js | 209 + node_modules/npm/lib/commands/docs.js | 21 + node_modules/npm/lib/commands/doctor.js | 347 + node_modules/npm/lib/commands/edit.js | 64 + node_modules/npm/lib/commands/exec.js | 110 + node_modules/npm/lib/commands/explain.js | 130 + node_modules/npm/lib/commands/explore.js | 74 + node_modules/npm/lib/commands/find-dupes.js | 28 + node_modules/npm/lib/commands/fund.js | 221 + node_modules/npm/lib/commands/get.js | 23 + node_modules/npm/lib/commands/help-search.js | 195 + node_modules/npm/lib/commands/help.js | 117 + node_modules/npm/lib/commands/init.js | 238 + .../npm/lib/commands/install-ci-test.js | 15 + node_modules/npm/lib/commands/install-test.js | 15 + node_modules/npm/lib/commands/install.js | 176 + node_modules/npm/lib/commands/link.js | 189 + node_modules/npm/lib/commands/ll.js | 13 + node_modules/npm/lib/commands/login.js | 50 + node_modules/npm/lib/commands/logout.js | 50 + node_modules/npm/lib/commands/ls.js | 579 ++ node_modules/npm/lib/commands/org.js | 151 + node_modules/npm/lib/commands/outdated.js | 282 + node_modules/npm/lib/commands/owner.js | 233 + node_modules/npm/lib/commands/pack.js | 87 + node_modules/npm/lib/commands/ping.js | 30 + node_modules/npm/lib/commands/pkg.js | 129 + node_modules/npm/lib/commands/prefix.js | 14 + node_modules/npm/lib/commands/profile.js | 390 + node_modules/npm/lib/commands/prune.js | 34 + node_modules/npm/lib/commands/publish.js | 264 + node_modules/npm/lib/commands/query.js | 126 + node_modules/npm/lib/commands/rebuild.js | 84 + node_modules/npm/lib/commands/repo.js | 55 + node_modules/npm/lib/commands/restart.js | 13 + node_modules/npm/lib/commands/root.js | 14 + node_modules/npm/lib/commands/run-script.js | 218 + node_modules/npm/lib/commands/sbom.js | 134 + node_modules/npm/lib/commands/search.js | 70 + node_modules/npm/lib/commands/set.js | 26 + node_modules/npm/lib/commands/shrinkwrap.js | 73 + node_modules/npm/lib/commands/star.js | 72 + node_modules/npm/lib/commands/stars.js | 39 + node_modules/npm/lib/commands/start.js | 13 + node_modules/npm/lib/commands/stop.js | 13 + node_modules/npm/lib/commands/team.js | 155 + node_modules/npm/lib/commands/test.js | 13 + node_modules/npm/lib/commands/token.js | 197 + node_modules/npm/lib/commands/uninstall.js | 56 + node_modules/npm/lib/commands/unpublish.js | 176 + node_modules/npm/lib/commands/unstar.js | 8 + node_modules/npm/lib/commands/update.js | 68 + node_modules/npm/lib/commands/version.js | 151 + node_modules/npm/lib/commands/view.js | 486 + node_modules/npm/lib/commands/whoami.js | 20 + node_modules/npm/lib/lifecycle-cmd.js | 20 + node_modules/npm/lib/npm.js | 475 + node_modules/npm/lib/package-url-cmd.js | 64 + node_modules/npm/lib/utils/audit-error.js | 40 + node_modules/npm/lib/utils/auth.js | 109 + node_modules/npm/lib/utils/cmd-list.js | 177 + node_modules/npm/lib/utils/completion.fish | 40 + node_modules/npm/lib/utils/completion.sh | 70 + node_modules/npm/lib/utils/did-you-mean.js | 34 + node_modules/npm/lib/utils/display.js | 539 ++ node_modules/npm/lib/utils/error-message.js | 447 + node_modules/npm/lib/utils/explain-dep.js | 103 + .../npm/lib/utils/explain-eresolve.js | 71 + node_modules/npm/lib/utils/format-bytes.js | 30 + .../npm/lib/utils/format-search-stream.js | 174 + node_modules/npm/lib/utils/format.js | 50 + node_modules/npm/lib/utils/get-identity.js | 26 + node_modules/npm/lib/utils/get-workspaces.js | 54 + node_modules/npm/lib/utils/installed-deep.js | 45 + .../npm/lib/utils/installed-shallow.js | 19 + node_modules/npm/lib/utils/is-windows.js | 4 + node_modules/npm/lib/utils/log-file.js | 261 + node_modules/npm/lib/utils/npm-usage.js | 74 + node_modules/npm/lib/utils/open-url.js | 98 + node_modules/npm/lib/utils/output-error.js | 29 + node_modules/npm/lib/utils/ping.js | 7 + node_modules/npm/lib/utils/queryable.js | 310 + node_modules/npm/lib/utils/read-user-info.js | 67 + node_modules/npm/lib/utils/reify-finish.js | 33 + node_modules/npm/lib/utils/reify-output.js | 199 + node_modules/npm/lib/utils/sbom-cyclonedx.js | 201 + node_modules/npm/lib/utils/sbom-spdx.js | 182 + node_modules/npm/lib/utils/tar.js | 110 + node_modules/npm/lib/utils/timers.js | 89 + .../npm/lib/utils/update-workspaces.js | 40 + .../npm/lib/utils/validate-lockfile.js | 29 + .../npm/lib/utils/verify-signatures.js | 386 + node_modules/npm/man/man1/npm-access.1 | 115 + node_modules/npm/man/man1/npm-adduser.1 | 91 + node_modules/npm/man/man1/npm-audit.1 | 448 + node_modules/npm/man/man1/npm-bugs.1 | 115 + node_modules/npm/man/man1/npm-cache.1 | 78 + node_modules/npm/man/man1/npm-ci.1 | 289 + node_modules/npm/man/man1/npm-completion.1 | 35 + node_modules/npm/man/man1/npm-config.1 | 187 + node_modules/npm/man/man1/npm-dedupe.1 | 290 + node_modules/npm/man/man1/npm-deprecate.1 | 73 + node_modules/npm/man/man1/npm-diff.1 | 310 + node_modules/npm/man/man1/npm-dist-tag.1 | 144 + node_modules/npm/man/man1/npm-docs.1 | 113 + node_modules/npm/man/man1/npm-doctor.1 | 82 + node_modules/npm/man/man1/npm-edit.1 | 43 + node_modules/npm/man/man1/npm-exec.1 | 350 + node_modules/npm/man/man1/npm-explain.1 | 118 + node_modules/npm/man/man1/npm-explore.1 | 49 + node_modules/npm/man/man1/npm-find-dupes.1 | 225 + node_modules/npm/man/man1/npm-fund.1 | 142 + node_modules/npm/man/man1/npm-help-search.1 | 37 + node_modules/npm/man/man1/npm-help.1 | 47 + node_modules/npm/man/man1/npm-init.1 | 366 + .../npm/man/man1/npm-install-ci-test.1 | 239 + node_modules/npm/man/man1/npm-install-test.1 | 346 + node_modules/npm/man/man1/npm-install.1 | 762 ++ node_modules/npm/man/man1/npm-link.1 | 355 + node_modules/npm/man/man1/npm-login.1 | 95 + node_modules/npm/man/man1/npm-logout.1 | 75 + node_modules/npm/man/man1/npm-ls.1 | 271 + node_modules/npm/man/man1/npm-org.1 | 125 + node_modules/npm/man/man1/npm-outdated.1 | 182 + node_modules/npm/man/man1/npm-owner.1 | 110 + node_modules/npm/man/man1/npm-pack.1 | 142 + node_modules/npm/man/man1/npm-ping.1 | 52 + node_modules/npm/man/man1/npm-pkg.1 | 286 + node_modules/npm/man/man1/npm-prefix.1 | 63 + node_modules/npm/man/man1/npm-profile.1 | 126 + node_modules/npm/man/man1/npm-prune.1 | 184 + node_modules/npm/man/man1/npm-publish.1 | 226 + node_modules/npm/man/man1/npm-query.1 | 281 + node_modules/npm/man/man1/npm-rebuild.1 | 178 + node_modules/npm/man/man1/npm-repo.1 | 103 + node_modules/npm/man/man1/npm-restart.1 | 85 + node_modules/npm/man/man1/npm-root.1 | 56 + node_modules/npm/man/man1/npm-run-script.1 | 234 + node_modules/npm/man/man1/npm-sbom.1 | 314 + node_modules/npm/man/man1/npm-search.1 | 156 + node_modules/npm/man/man1/npm-shrinkwrap.1 | 32 + node_modules/npm/man/man1/npm-star.1 | 76 + node_modules/npm/man/man1/npm-stars.1 | 41 + node_modules/npm/man/man1/npm-start.1 | 79 + node_modules/npm/man/man1/npm-stop.1 | 75 + node_modules/npm/man/man1/npm-team.1 | 148 + node_modules/npm/man/man1/npm-test.1 | 73 + node_modules/npm/man/man1/npm-token.1 | 112 + node_modules/npm/man/man1/npm-uninstall.1 | 159 + node_modules/npm/man/man1/npm-unpublish.1 | 137 + node_modules/npm/man/man1/npm-unstar.1 | 70 + node_modules/npm/man/man1/npm-update.1 | 406 + node_modules/npm/man/man1/npm-version.1 | 229 + node_modules/npm/man/man1/npm-view.1 | 213 + node_modules/npm/man/man1/npm-whoami.1 | 39 + node_modules/npm/man/man1/npm.1 | 131 + node_modules/npm/man/man1/npx.1 | 156 + node_modules/npm/man/man5/folders.5 | 152 + node_modules/npm/man/man5/install.5 | 57 + node_modules/npm/man/man5/npm-global.5 | 152 + node_modules/npm/man/man5/npm-json.5 | 1160 +++ .../npm/man/man5/npm-shrinkwrap-json.5 | 23 + node_modules/npm/man/man5/npmrc.5 | 132 + node_modules/npm/man/man5/package-json.5 | 1160 +++ node_modules/npm/man/man5/package-lock-json.5 | 158 + node_modules/npm/man/man7/config.7 | 2041 +++++ .../npm/man/man7/dependency-selectors.7 | 331 + node_modules/npm/man/man7/developers.7 | 236 + node_modules/npm/man/man7/logging.7 | 108 + node_modules/npm/man/man7/orgs.7 | 145 + node_modules/npm/man/man7/package-spec.7 | 126 + node_modules/npm/man/man7/registry.7 | 51 + node_modules/npm/man/man7/removal.7 | 54 + node_modules/npm/man/man7/scope.7 | 113 + node_modules/npm/man/man7/scripts.7 | 406 + node_modules/npm/man/man7/workspaces.7 | 214 + .../node_modules/@isaacs/cliui/LICENSE.txt | 14 + .../@isaacs/cliui/build/index.cjs | 317 + .../@isaacs/cliui/build/index.d.cts | 43 + .../@isaacs/cliui/build/lib/index.js | 302 + .../npm/node_modules/@isaacs/cliui/index.mjs | 14 + .../cliui/node_modules/ansi-regex/index.js | 10 + .../cliui/node_modules/ansi-regex/license | 9 + .../node_modules/ansi-regex/package.json | 61 + .../node_modules/emoji-regex/LICENSE-MIT.txt | 20 + .../node_modules/emoji-regex/RGI_Emoji.js | 6 + .../emoji-regex/es2015/RGI_Emoji.js | 6 + .../node_modules/emoji-regex/es2015/index.js | 6 + .../node_modules/emoji-regex/es2015/text.js | 6 + .../cliui/node_modules/emoji-regex/index.js | 6 + .../node_modules/emoji-regex/package.json | 52 + .../cliui/node_modules/emoji-regex/text.js | 6 + .../cliui/node_modules/string-width/index.js | 54 + .../cliui/node_modules/string-width/license | 9 + .../node_modules/string-width/package.json | 59 + .../cliui/node_modules/strip-ansi/index.js | 14 + .../cliui/node_modules/strip-ansi/license | 9 + .../node_modules/strip-ansi/package.json | 57 + .../node_modules/@isaacs/cliui/package.json | 86 + .../node_modules/@isaacs/fs-minipass/LICENSE | 15 + .../fs-minipass/dist/commonjs/index.js | 430 + .../fs-minipass/dist/commonjs/package.json | 3 + .../@isaacs/fs-minipass/dist/esm/index.js | 420 + .../@isaacs/fs-minipass/dist/esm/package.json | 3 + .../@isaacs/fs-minipass/package.json | 72 + .../@isaacs/string-locale-compare/LICENSE | 15 + .../@isaacs/string-locale-compare/index.js | 42 + .../string-locale-compare/package.json | 28 + .../node_modules/@npmcli/agent/lib/agents.js | 206 + .../npm/node_modules/@npmcli/agent/lib/dns.js | 53 + .../node_modules/@npmcli/agent/lib/errors.js | 61 + .../node_modules/@npmcli/agent/lib/index.js | 56 + .../node_modules/@npmcli/agent/lib/options.js | 86 + .../node_modules/@npmcli/agent/lib/proxy.js | 88 + .../node_modules/@npmcli/agent/package.json | 60 + .../node_modules/@npmcli/arborist/LICENSE.md | 20 + .../node_modules/@npmcli/arborist/README.md | 349 + .../@npmcli/arborist/bin/actual.js | 19 + .../@npmcli/arborist/bin/audit.js | 51 + .../@npmcli/arborist/bin/funding.js | 38 + .../@npmcli/arborist/bin/ideal.js | 14 + .../@npmcli/arborist/bin/index.js | 112 + .../@npmcli/arborist/bin/lib/logging.js | 77 + .../@npmcli/arborist/bin/lib/options.js | 123 + .../@npmcli/arborist/bin/lib/print-tree.js | 4 + .../@npmcli/arborist/bin/lib/timers.js | 33 + .../@npmcli/arborist/bin/license.js | 48 + .../@npmcli/arborist/bin/prune.js | 48 + .../@npmcli/arborist/bin/reify.js | 48 + .../@npmcli/arborist/bin/shrinkwrap.js | 7 + .../@npmcli/arborist/bin/virtual.js | 14 + .../@npmcli/arborist/lib/add-rm-pkg-deps.js | 143 + .../arborist/lib/arborist/build-ideal-tree.js | 1523 +++ .../@npmcli/arborist/lib/arborist/index.js | 280 + .../arborist/lib/arborist/isolated-reifier.js | 453 + .../arborist/lib/arborist/load-actual.js | 438 + .../arborist/lib/arborist/load-virtual.js | 303 + .../@npmcli/arborist/lib/arborist/rebuild.js | 402 + .../@npmcli/arborist/lib/arborist/reify.js | 1535 ++++ .../@npmcli/arborist/lib/audit-report.js | 345 + .../@npmcli/arborist/lib/calc-dep-flags.js | 126 + .../@npmcli/arborist/lib/can-place-dep.js | 436 + .../arborist/lib/case-insensitive-map.js | 50 + .../arborist/lib/consistent-resolve.js | 45 + .../@npmcli/arborist/lib/debug.js | 32 + .../arborist/lib/deepest-nesting-target.js | 18 + .../@npmcli/arborist/lib/dep-valid.js | 150 + .../node_modules/@npmcli/arborist/lib/diff.js | 306 + .../node_modules/@npmcli/arborist/lib/edge.js | 301 + .../@npmcli/arborist/lib/from-path.js | 30 + .../@npmcli/arborist/lib/gather-dep-set.js | 43 + .../@npmcli/arborist/lib/index.js | 6 + .../@npmcli/arborist/lib/inventory.js | 138 + .../node_modules/@npmcli/arborist/lib/link.js | 126 + .../node_modules/@npmcli/arborist/lib/node.js | 1475 +++ .../@npmcli/arborist/lib/optional-set.js | 38 + .../@npmcli/arborist/lib/override-resolves.js | 11 + .../@npmcli/arborist/lib/override-set.js | 147 + .../@npmcli/arborist/lib/packument-cache.js | 77 + .../@npmcli/arborist/lib/peer-entry-sets.js | 77 + .../@npmcli/arborist/lib/place-dep.js | 569 ++ .../@npmcli/arborist/lib/printable.js | 198 + .../arborist/lib/query-selector-all.js | 945 ++ .../@npmcli/arborist/lib/realpath.js | 95 + .../@npmcli/arborist/lib/relpath.js | 3 + .../@npmcli/arborist/lib/reset-dep-flags.js | 15 + .../@npmcli/arborist/lib/retire-path.js | 19 + .../@npmcli/arborist/lib/shrinkwrap.js | 1181 +++ .../@npmcli/arborist/lib/signal-handling.js | 74 + .../@npmcli/arborist/lib/signals.js | 58 + .../@npmcli/arborist/lib/spec-from-lock.js | 34 + .../@npmcli/arborist/lib/tracker.js | 86 + .../@npmcli/arborist/lib/tree-check.js | 155 + .../@npmcli/arborist/lib/version-from-tgz.js | 47 + .../node_modules/@npmcli/arborist/lib/vuln.js | 214 + .../@npmcli/arborist/lib/yarn-lock.js | 377 + .../@npmcli/arborist/package.json | 99 + .../npm/node_modules/@npmcli/config/LICENSE | 15 + .../npm/node_modules/@npmcli/config/README.md | 257 + .../config/lib/definitions/definition.js | 253 + .../config/lib/definitions/definitions.js | 2282 +++++ .../@npmcli/config/lib/definitions/index.js | 66 + .../@npmcli/config/lib/env-replace.js | 14 + .../node_modules/@npmcli/config/lib/errors.js | 23 + .../node_modules/@npmcli/config/lib/index.js | 931 ++ .../@npmcli/config/lib/nerf-dart.js | 18 + .../@npmcli/config/lib/parse-field.js | 86 + .../@npmcli/config/lib/set-envs.js | 108 + .../@npmcli/config/lib/type-defs.js | 61 + .../@npmcli/config/lib/type-description.js | 21 + .../node_modules/@npmcli/config/lib/umask.js | 35 + .../node_modules/@npmcli/config/package.json | 57 + .../npm/node_modules/@npmcli/fs/LICENSE.md | 20 + .../@npmcli/fs/lib/common/get-options.js | 20 + .../@npmcli/fs/lib/common/node.js | 9 + .../node_modules/@npmcli/fs/lib/cp/LICENSE | 15 + .../node_modules/@npmcli/fs/lib/cp/errors.js | 129 + .../node_modules/@npmcli/fs/lib/cp/index.js | 22 + .../@npmcli/fs/lib/cp/polyfill.js | 428 + .../npm/node_modules/@npmcli/fs/lib/index.js | 13 + .../node_modules/@npmcli/fs/lib/move-file.js | 78 + .../@npmcli/fs/lib/readdir-scoped.js | 20 + .../@npmcli/fs/lib/with-temp-dir.js | 39 + .../npm/node_modules/@npmcli/fs/package.json | 54 + .../npm/node_modules/@npmcli/git/LICENSE | 15 + .../npm/node_modules/@npmcli/git/lib/clone.js | 172 + .../node_modules/@npmcli/git/lib/errors.js | 36 + .../npm/node_modules/@npmcli/git/lib/find.js | 15 + .../npm/node_modules/@npmcli/git/lib/index.js | 9 + .../node_modules/@npmcli/git/lib/is-clean.js | 6 + .../npm/node_modules/@npmcli/git/lib/is.js | 4 + .../@npmcli/git/lib/lines-to-revs.js | 147 + .../@npmcli/git/lib/make-error.js | 33 + .../npm/node_modules/@npmcli/git/lib/opts.js | 57 + .../npm/node_modules/@npmcli/git/lib/revs.js | 28 + .../npm/node_modules/@npmcli/git/lib/spawn.js | 44 + .../npm/node_modules/@npmcli/git/lib/utils.js | 3 + .../npm/node_modules/@npmcli/git/lib/which.js | 18 + .../npm/node_modules/@npmcli/git/package.json | 59 + .../installed-package-contents/LICENSE | 15 + .../installed-package-contents/README.md | 109 + .../installed-package-contents/bin/index.js | 44 + .../installed-package-contents/lib/index.js | 181 + .../installed-package-contents/package.json | 52 + .../@npmcli/map-workspaces/LICENSE.md | 20 + .../@npmcli/map-workspaces/lib/index.js | 226 + .../@npmcli/map-workspaces/package.json | 61 + .../@npmcli/metavuln-calculator/LICENSE | 15 + .../metavuln-calculator/lib/advisory.js | 435 + .../metavuln-calculator/lib/get-dep-spec.js | 15 + .../@npmcli/metavuln-calculator/lib/hash.js | 5 + .../@npmcli/metavuln-calculator/lib/index.js | 128 + .../@npmcli/metavuln-calculator/package.json | 62 + .../@npmcli/name-from-folder/LICENSE | 15 + .../@npmcli/name-from-folder/lib/index.js | 7 + .../@npmcli/name-from-folder/package.json | 45 + .../npm/node_modules/@npmcli/node-gyp/LICENSE | 7 + .../@npmcli/node-gyp/lib/index.js | 14 + .../@npmcli/node-gyp/package.json | 50 + .../node_modules/@npmcli/package-json/LICENSE | 18 + .../@npmcli/package-json/lib/index.js | 283 + .../@npmcli/package-json/lib/normalize.js | 615 ++ .../@npmcli/package-json/lib/read-package.js | 39 + .../@npmcli/package-json/lib/sort.js | 101 + .../package-json/lib/update-dependencies.js | 75 + .../package-json/lib/update-scripts.js | 29 + .../package-json/lib/update-workspaces.js | 26 + .../@npmcli/package-json/package.json | 61 + .../@npmcli/promise-spawn/LICENSE | 15 + .../@npmcli/promise-spawn/lib/escape.js | 68 + .../@npmcli/promise-spawn/lib/index.js | 218 + .../@npmcli/promise-spawn/package.json | 51 + .../npm/node_modules/@npmcli/query/LICENSE | 20 + .../node_modules/@npmcli/query/lib/index.js | 255 + .../node_modules/@npmcli/query/package.json | 64 + .../npm/node_modules/@npmcli/redact/LICENSE | 21 + .../@npmcli/redact/lib/deep-map.js | 78 + .../node_modules/@npmcli/redact/lib/index.js | 44 + .../@npmcli/redact/lib/matchers.js | 81 + .../node_modules/@npmcli/redact/lib/server.js | 34 + .../node_modules/@npmcli/redact/lib/utils.js | 202 + .../node_modules/@npmcli/redact/package.json | 52 + .../node_modules/@npmcli/run-script/LICENSE | 15 + .../run-script/lib/is-server-package.js | 11 + .../@npmcli/run-script/lib/make-spawn-args.js | 40 + .../run-script/lib/node-gyp-bin/node-gyp | 2 + .../run-script/lib/node-gyp-bin/node-gyp.cmd | 1 + .../@npmcli/run-script/lib/package-envs.js | 29 + .../@npmcli/run-script/lib/run-script-pkg.js | 112 + .../@npmcli/run-script/lib/run-script.js | 15 + .../@npmcli/run-script/lib/set-path.js | 45 + .../@npmcli/run-script/lib/signal-manager.js | 50 + .../run-script/lib/validate-options.js | 39 + .../@npmcli/run-script/package.json | 54 + .../npm/node_modules/@pkgjs/parseargs/LICENSE | 201 + .../parseargs/examples/is-default-value.js | 25 + .../parseargs/examples/limit-long-syntax.js | 35 + .../@pkgjs/parseargs/examples/negate.js | 43 + .../parseargs/examples/no-repeated-options.js | 31 + .../parseargs/examples/ordered-options.mjs | 41 + .../parseargs/examples/simple-hard-coded.js | 26 + .../node_modules/@pkgjs/parseargs/index.js | 396 + .../@pkgjs/parseargs/internal/errors.js | 47 + .../@pkgjs/parseargs/internal/primordials.js | 393 + .../@pkgjs/parseargs/internal/util.js | 14 + .../@pkgjs/parseargs/internal/validators.js | 89 + .../@pkgjs/parseargs/package.json | 36 + .../node_modules/@pkgjs/parseargs/utils.js | 198 + .../npm/node_modules/@sigstore/bundle/LICENSE | 202 + .../@sigstore/bundle/dist/build.js | 100 + .../@sigstore/bundle/dist/bundle.js | 24 + .../@sigstore/bundle/dist/error.js | 25 + .../@sigstore/bundle/dist/index.js | 43 + .../@sigstore/bundle/dist/serialized.js | 49 + .../@sigstore/bundle/dist/utility.js | 2 + .../@sigstore/bundle/dist/validate.js | 199 + .../@sigstore/bundle/package.json | 35 + .../npm/node_modules/@sigstore/core/LICENSE | 202 + .../@sigstore/core/dist/asn1/error.js | 24 + .../@sigstore/core/dist/asn1/index.js | 20 + .../@sigstore/core/dist/asn1/length.js | 62 + .../@sigstore/core/dist/asn1/obj.js | 152 + .../@sigstore/core/dist/asn1/parse.js | 124 + .../@sigstore/core/dist/asn1/tag.js | 86 + .../@sigstore/core/dist/crypto.js | 60 + .../node_modules/@sigstore/core/dist/dsse.js | 30 + .../@sigstore/core/dist/encoding.js | 27 + .../node_modules/@sigstore/core/dist/index.js | 56 + .../node_modules/@sigstore/core/dist/json.js | 60 + .../node_modules/@sigstore/core/dist/oid.js | 14 + .../node_modules/@sigstore/core/dist/pem.js | 43 + .../@sigstore/core/dist/rfc3161/error.js | 21 + .../@sigstore/core/dist/rfc3161/index.js | 20 + .../@sigstore/core/dist/rfc3161/timestamp.js | 201 + .../@sigstore/core/dist/rfc3161/tstinfo.js | 61 + .../@sigstore/core/dist/stream.js | 115 + .../@sigstore/core/dist/x509/cert.js | 230 + .../@sigstore/core/dist/x509/ext.js | 145 + .../@sigstore/core/dist/x509/index.js | 23 + .../@sigstore/core/dist/x509/sct.js | 141 + .../node_modules/@sigstore/core/package.json | 31 + .../@sigstore/protobuf-specs/LICENSE | 202 + .../dist/__generated__/envelope.js | 89 + .../dist/__generated__/events.js | 185 + .../google/api/field_behavior.js | 119 + .../dist/__generated__/google/protobuf/any.js | 65 + .../google/protobuf/descriptor.js | 1308 +++ .../google/protobuf/timestamp.js | 24 + .../dist/__generated__/sigstore_bundle.js | 112 + .../dist/__generated__/sigstore_common.js | 588 ++ .../dist/__generated__/sigstore_rekor.js | 167 + .../dist/__generated__/sigstore_trustroot.js | 158 + .../__generated__/sigstore_verification.js | 324 + .../@sigstore/protobuf-specs/dist/index.js | 37 + .../@sigstore/protobuf-specs/package.json | 31 + .../npm/node_modules/@sigstore/sign/LICENSE | 202 + .../@sigstore/sign/dist/bundler/base.js | 50 + .../@sigstore/sign/dist/bundler/bundle.js | 71 + .../@sigstore/sign/dist/bundler/dsse.js | 46 + .../@sigstore/sign/dist/bundler/index.js | 7 + .../@sigstore/sign/dist/bundler/message.js | 30 + .../node_modules/@sigstore/sign/dist/error.js | 39 + .../@sigstore/sign/dist/external/error.js | 26 + .../@sigstore/sign/dist/external/fetch.js | 98 + .../@sigstore/sign/dist/external/fulcio.js | 41 + .../@sigstore/sign/dist/external/rekor.js | 80 + .../@sigstore/sign/dist/external/tsa.js | 38 + .../@sigstore/sign/dist/identity/ci.js | 73 + .../@sigstore/sign/dist/identity/index.js | 20 + .../@sigstore/sign/dist/identity/provider.js | 2 + .../node_modules/@sigstore/sign/dist/index.js | 17 + .../@sigstore/sign/dist/signer/fulcio/ca.js | 59 + .../sign/dist/signer/fulcio/ephemeral.js | 45 + .../sign/dist/signer/fulcio/index.js | 87 + .../@sigstore/sign/dist/signer/index.js | 22 + .../@sigstore/sign/dist/signer/signer.js | 17 + .../@sigstore/sign/dist/types/fetch.js | 2 + .../@sigstore/sign/dist/util/index.js | 49 + .../@sigstore/sign/dist/util/oidc.js | 30 + .../@sigstore/sign/dist/util/ua.js | 32 + .../@sigstore/sign/dist/witness/index.js | 24 + .../sign/dist/witness/tlog/client.js | 61 + .../@sigstore/sign/dist/witness/tlog/entry.js | 140 + .../@sigstore/sign/dist/witness/tlog/index.js | 82 + .../@sigstore/sign/dist/witness/tsa/client.js | 46 + .../@sigstore/sign/dist/witness/tsa/index.js | 44 + .../@sigstore/sign/dist/witness/witness.js | 2 + .../node_modules/@sigstore/sign/package.json | 46 + .../npm/node_modules/@sigstore/tuf/LICENSE | 202 + .../@sigstore/tuf/dist/appdata.js | 43 + .../node_modules/@sigstore/tuf/dist/client.js | 111 + .../node_modules/@sigstore/tuf/dist/error.js | 12 + .../node_modules/@sigstore/tuf/dist/index.js | 56 + .../node_modules/@sigstore/tuf/dist/target.js | 79 + .../node_modules/@sigstore/tuf/package.json | 41 + .../npm/node_modules/@sigstore/tuf/seeds.json | 1 + .../@sigstore/verify/dist/bundle/dsse.js | 43 + .../@sigstore/verify/dist/bundle/index.js | 57 + .../@sigstore/verify/dist/bundle/message.js | 36 + .../@sigstore/verify/dist/error.js | 32 + .../@sigstore/verify/dist/index.js | 28 + .../@sigstore/verify/dist/key/certificate.js | 205 + .../@sigstore/verify/dist/key/index.js | 72 + .../@sigstore/verify/dist/key/sct.js | 78 + .../@sigstore/verify/dist/policy.js | 24 + .../@sigstore/verify/dist/shared.types.js | 2 + .../verify/dist/timestamp/checkpoint.js | 157 + .../@sigstore/verify/dist/timestamp/index.js | 46 + .../@sigstore/verify/dist/timestamp/merkle.js | 104 + .../@sigstore/verify/dist/timestamp/set.js | 60 + .../@sigstore/verify/dist/timestamp/tsa.js | 73 + .../@sigstore/verify/dist/tlog/dsse.js | 57 + .../verify/dist/tlog/hashedrekord.js | 51 + .../@sigstore/verify/dist/tlog/index.js | 47 + .../@sigstore/verify/dist/tlog/intoto.js | 62 + .../@sigstore/verify/dist/trust/filter.js | 23 + .../@sigstore/verify/dist/trust/index.js | 86 + .../verify/dist/trust/trust.types.js | 2 + .../@sigstore/verify/dist/verifier.js | 141 + .../@sigstore/verify/package.json | 36 + .../@tufjs/canonical-json/LICENSE | 21 + .../@tufjs/canonical-json/lib/index.js | 64 + .../@tufjs/canonical-json/package.json | 35 + .../npm/node_modules/@tufjs/models/LICENSE | 21 + .../node_modules/@tufjs/models/dist/base.js | 92 + .../@tufjs/models/dist/delegations.js | 115 + .../node_modules/@tufjs/models/dist/error.js | 27 + .../node_modules/@tufjs/models/dist/file.js | 183 + .../node_modules/@tufjs/models/dist/index.js | 24 + .../node_modules/@tufjs/models/dist/key.js | 85 + .../@tufjs/models/dist/metadata.js | 160 + .../node_modules/@tufjs/models/dist/role.js | 299 + .../node_modules/@tufjs/models/dist/root.js | 116 + .../@tufjs/models/dist/signature.js | 38 + .../@tufjs/models/dist/snapshot.js | 71 + .../@tufjs/models/dist/targets.js | 92 + .../@tufjs/models/dist/timestamp.js | 58 + .../@tufjs/models/dist/utils/guard.js | 32 + .../@tufjs/models/dist/utils/index.js | 28 + .../@tufjs/models/dist/utils/key.js | 142 + .../@tufjs/models/dist/utils/oid.js | 26 + .../@tufjs/models/dist/utils/types.js | 2 + .../@tufjs/models/dist/utils/verify.js | 13 + .../node_modules/@tufjs/models/package.json | 37 + node_modules/npm/node_modules/abbrev/LICENSE | 46 + .../npm/node_modules/abbrev/lib/index.js | 50 + .../npm/node_modules/abbrev/package.json | 45 + .../npm/node_modules/agent-base/LICENSE | 22 + .../node_modules/agent-base/dist/helpers.js | 66 + .../npm/node_modules/agent-base/dist/index.js | 180 + .../npm/node_modules/agent-base/package.json | 46 + .../npm/node_modules/ansi-regex/index.js | 10 + .../npm/node_modules/ansi-regex/license | 9 + .../npm/node_modules/ansi-regex/package.json | 55 + .../npm/node_modules/ansi-styles/index.js | 223 + .../npm/node_modules/ansi-styles/license | 9 + .../npm/node_modules/ansi-styles/package.json | 54 + node_modules/npm/node_modules/aproba/LICENSE | 14 + node_modules/npm/node_modules/aproba/index.js | 105 + .../npm/node_modules/aproba/package.json | 35 + node_modules/npm/node_modules/archy/LICENSE | 18 + .../npm/node_modules/archy/examples/beep.js | 24 + .../node_modules/archy/examples/multi_line.js | 25 + node_modules/npm/node_modules/archy/index.js | 35 + .../npm/node_modules/archy/package.json | 40 + .../npm/node_modules/archy/test/beep.js | 40 + .../npm/node_modules/archy/test/multi_line.js | 45 + .../node_modules/archy/test/non_unicode.js | 40 + .../node_modules/balanced-match/LICENSE.md | 21 + .../npm/node_modules/balanced-match/index.js | 62 + .../node_modules/balanced-match/package.json | 48 + .../npm/node_modules/bin-links/LICENSE | 15 + .../node_modules/bin-links/lib/bin-target.js | 9 + .../node_modules/bin-links/lib/check-bin.js | 74 + .../node_modules/bin-links/lib/check-bins.js | 18 + .../npm/node_modules/bin-links/lib/fix-bin.js | 42 + .../bin-links/lib/get-node-modules.js | 19 + .../node_modules/bin-links/lib/get-paths.js | 42 + .../node_modules/bin-links/lib/get-prefix.js | 3 + .../npm/node_modules/bin-links/lib/index.js | 44 + .../node_modules/bin-links/lib/is-windows.js | 2 + .../node_modules/bin-links/lib/link-bin.js | 9 + .../node_modules/bin-links/lib/link-bins.js | 23 + .../node_modules/bin-links/lib/link-gently.js | 96 + .../node_modules/bin-links/lib/link-mans.js | 53 + .../node_modules/bin-links/lib/man-target.js | 6 + .../node_modules/bin-links/lib/shim-bin.js | 86 + .../npm/node_modules/bin-links/package.json | 61 + .../binary-extensions/binary-extensions.json | 263 + .../node_modules/binary-extensions/index.js | 3 + .../node_modules/binary-extensions/license | 10 + .../binary-extensions/package.json | 45 + .../npm/node_modules/brace-expansion/LICENSE | 21 + .../npm/node_modules/brace-expansion/index.js | 203 + .../node_modules/brace-expansion/package.json | 46 + .../npm/node_modules/cacache/LICENSE.md | 16 + .../node_modules/cacache/lib/content/path.js | 29 + .../node_modules/cacache/lib/content/read.js | 165 + .../node_modules/cacache/lib/content/rm.js | 18 + .../node_modules/cacache/lib/content/write.js | 206 + .../node_modules/cacache/lib/entry-index.js | 336 + .../npm/node_modules/cacache/lib/get.js | 170 + .../npm/node_modules/cacache/lib/index.js | 42 + .../node_modules/cacache/lib/memoization.js | 72 + .../npm/node_modules/cacache/lib/put.js | 80 + .../npm/node_modules/cacache/lib/rm.js | 31 + .../npm/node_modules/cacache/lib/util/glob.js | 7 + .../cacache/lib/util/hash-to-segments.js | 7 + .../npm/node_modules/cacache/lib/util/tmp.js | 26 + .../npm/node_modules/cacache/lib/verify.js | 258 + .../cacache/node_modules/chownr/LICENSE.md | 63 + .../chownr/dist/commonjs/index.js | 93 + .../chownr/dist/commonjs/package.json | 3 + .../node_modules/chownr/dist/esm/index.js | 85 + .../node_modules/chownr/dist/esm/package.json | 3 + .../cacache/node_modules/chownr/package.json | 69 + .../cacache/node_modules/minizlib/LICENSE | 26 + .../minizlib/dist/commonjs/constants.js | 123 + .../minizlib/dist/commonjs/index.js | 352 + .../minizlib/dist/commonjs/package.json | 3 + .../minizlib/dist/esm/constants.js | 117 + .../node_modules/minizlib/dist/esm/index.js | 333 + .../minizlib/dist/esm/package.json | 3 + .../node_modules/minizlib/package.json | 81 + .../cacache/node_modules/mkdirp/LICENSE | 21 + .../node_modules/mkdirp/dist/cjs/package.json | 91 + .../node_modules/mkdirp/dist/cjs/src/bin.d.ts | 3 + .../mkdirp/dist/cjs/src/bin.d.ts.map | 1 + .../node_modules/mkdirp/dist/cjs/src/bin.js | 80 + .../mkdirp/dist/cjs/src/bin.js.map | 1 + .../mkdirp/dist/cjs/src/find-made.d.ts | 4 + .../mkdirp/dist/cjs/src/find-made.d.ts.map | 1 + .../mkdirp/dist/cjs/src/find-made.js | 35 + .../mkdirp/dist/cjs/src/find-made.js.map | 1 + .../mkdirp/dist/cjs/src/index.d.ts | 39 + .../mkdirp/dist/cjs/src/index.d.ts.map | 1 + .../node_modules/mkdirp/dist/cjs/src/index.js | 53 + .../mkdirp/dist/cjs/src/index.js.map | 1 + .../mkdirp/dist/cjs/src/mkdirp-manual.d.ts | 6 + .../dist/cjs/src/mkdirp-manual.d.ts.map | 1 + .../mkdirp/dist/cjs/src/mkdirp-manual.js | 79 + .../mkdirp/dist/cjs/src/mkdirp-manual.js.map | 1 + .../mkdirp/dist/cjs/src/mkdirp-native.d.ts | 6 + .../dist/cjs/src/mkdirp-native.d.ts.map | 1 + .../mkdirp/dist/cjs/src/mkdirp-native.js | 50 + .../mkdirp/dist/cjs/src/mkdirp-native.js.map | 1 + .../mkdirp/dist/cjs/src/opts-arg.d.ts | 42 + .../mkdirp/dist/cjs/src/opts-arg.d.ts.map | 1 + .../mkdirp/dist/cjs/src/opts-arg.js | 38 + .../mkdirp/dist/cjs/src/opts-arg.js.map | 1 + .../mkdirp/dist/cjs/src/path-arg.d.ts | 2 + .../mkdirp/dist/cjs/src/path-arg.d.ts.map | 1 + .../mkdirp/dist/cjs/src/path-arg.js | 28 + .../mkdirp/dist/cjs/src/path-arg.js.map | 1 + .../mkdirp/dist/cjs/src/use-native.d.ts | 6 + .../mkdirp/dist/cjs/src/use-native.d.ts.map | 1 + .../mkdirp/dist/cjs/src/use-native.js | 17 + .../mkdirp/dist/cjs/src/use-native.js.map | 1 + .../mkdirp/dist/mjs/find-made.d.ts | 4 + .../mkdirp/dist/mjs/find-made.d.ts.map | 1 + .../node_modules/mkdirp/dist/mjs/find-made.js | 30 + .../mkdirp/dist/mjs/find-made.js.map | 1 + .../node_modules/mkdirp/dist/mjs/index.d.ts | 39 + .../mkdirp/dist/mjs/index.d.ts.map | 1 + .../node_modules/mkdirp/dist/mjs/index.js | 43 + .../node_modules/mkdirp/dist/mjs/index.js.map | 1 + .../mkdirp/dist/mjs/mkdirp-manual.d.ts | 6 + .../mkdirp/dist/mjs/mkdirp-manual.d.ts.map | 1 + .../mkdirp/dist/mjs/mkdirp-manual.js | 75 + .../mkdirp/dist/mjs/mkdirp-manual.js.map | 1 + .../mkdirp/dist/mjs/mkdirp-native.d.ts | 6 + .../mkdirp/dist/mjs/mkdirp-native.d.ts.map | 1 + .../mkdirp/dist/mjs/mkdirp-native.js | 46 + .../mkdirp/dist/mjs/mkdirp-native.js.map | 1 + .../mkdirp/dist/mjs/opts-arg.d.ts | 42 + .../mkdirp/dist/mjs/opts-arg.d.ts.map | 1 + .../node_modules/mkdirp/dist/mjs/opts-arg.js | 34 + .../mkdirp/dist/mjs/opts-arg.js.map | 1 + .../node_modules/mkdirp/dist/mjs/package.json | 3 + .../mkdirp/dist/mjs/path-arg.d.ts | 2 + .../mkdirp/dist/mjs/path-arg.d.ts.map | 1 + .../node_modules/mkdirp/dist/mjs/path-arg.js | 24 + .../mkdirp/dist/mjs/path-arg.js.map | 1 + .../mkdirp/dist/mjs/use-native.d.ts | 6 + .../mkdirp/dist/mjs/use-native.d.ts.map | 1 + .../mkdirp/dist/mjs/use-native.js | 14 + .../mkdirp/dist/mjs/use-native.js.map | 1 + .../cacache/node_modules/mkdirp/package.json | 91 + .../node_modules/mkdirp/readme.markdown | 281 + .../cacache/node_modules/tar/LICENSE | 15 + .../node_modules/tar/dist/commonjs/create.js | 83 + .../tar/dist/commonjs/cwd-error.js | 18 + .../node_modules/tar/dist/commonjs/extract.js | 78 + .../tar/dist/commonjs/get-write-flag.js | 29 + .../node_modules/tar/dist/commonjs/header.js | 306 + .../node_modules/tar/dist/commonjs/index.js | 54 + .../tar/dist/commonjs/large-numbers.js | 99 + .../node_modules/tar/dist/commonjs/list.js | 136 + .../tar/dist/commonjs/make-command.js | 61 + .../node_modules/tar/dist/commonjs/mkdir.js | 209 + .../tar/dist/commonjs/mode-fix.js | 29 + .../tar/dist/commonjs/normalize-unicode.js | 17 + .../dist/commonjs/normalize-windows-path.js | 12 + .../node_modules/tar/dist/commonjs/options.js | 66 + .../node_modules/tar/dist/commonjs/pack.js | 477 + .../tar/dist/commonjs/package.json | 3 + .../node_modules/tar/dist/commonjs/parse.js | 599 ++ .../tar/dist/commonjs/path-reservations.js | 170 + .../node_modules/tar/dist/commonjs/pax.js | 158 + .../tar/dist/commonjs/read-entry.js | 140 + .../node_modules/tar/dist/commonjs/replace.js | 231 + .../tar/dist/commonjs/strip-absolute-path.js | 29 + .../dist/commonjs/strip-trailing-slashes.js | 18 + .../tar/dist/commonjs/symlink-error.js | 19 + .../node_modules/tar/dist/commonjs/types.js | 50 + .../node_modules/tar/dist/commonjs/unpack.js | 919 ++ .../node_modules/tar/dist/commonjs/update.js | 33 + .../tar/dist/commonjs/warn-method.js | 31 + .../tar/dist/commonjs/winchars.js | 14 + .../tar/dist/commonjs/write-entry.js | 689 ++ .../node_modules/tar/dist/esm/create.js | 77 + .../node_modules/tar/dist/esm/cwd-error.js | 14 + .../node_modules/tar/dist/esm/extract.js | 49 + .../tar/dist/esm/get-write-flag.js | 23 + .../node_modules/tar/dist/esm/header.js | 279 + .../node_modules/tar/dist/esm/index.js | 20 + .../tar/dist/esm/large-numbers.js | 94 + .../cacache/node_modules/tar/dist/esm/list.js | 106 + .../node_modules/tar/dist/esm/make-command.js | 57 + .../node_modules/tar/dist/esm/mkdir.js | 201 + .../node_modules/tar/dist/esm/mode-fix.js | 25 + .../tar/dist/esm/normalize-unicode.js | 13 + .../tar/dist/esm/normalize-windows-path.js | 9 + .../node_modules/tar/dist/esm/options.js | 54 + .../cacache/node_modules/tar/dist/esm/pack.js | 445 + .../node_modules/tar/dist/esm/package.json | 3 + .../node_modules/tar/dist/esm/parse.js | 595 ++ .../tar/dist/esm/path-reservations.js | 166 + .../cacache/node_modules/tar/dist/esm/pax.js | 154 + .../node_modules/tar/dist/esm/read-entry.js | 136 + .../node_modules/tar/dist/esm/replace.js | 225 + .../tar/dist/esm/strip-absolute-path.js | 25 + .../tar/dist/esm/strip-trailing-slashes.js | 14 + .../tar/dist/esm/symlink-error.js | 15 + .../node_modules/tar/dist/esm/types.js | 45 + .../node_modules/tar/dist/esm/unpack.js | 888 ++ .../node_modules/tar/dist/esm/update.js | 30 + .../node_modules/tar/dist/esm/warn-method.js | 27 + .../node_modules/tar/dist/esm/winchars.js | 9 + .../node_modules/tar/dist/esm/write-entry.js | 657 ++ .../cacache/node_modules/tar/package.json | 325 + .../cacache/node_modules/yallist/LICENSE.md | 63 + .../yallist/dist/commonjs/index.js | 384 + .../yallist/dist/commonjs/package.json | 3 + .../node_modules/yallist/dist/esm/index.js | 379 + .../yallist/dist/esm/package.json | 3 + .../cacache/node_modules/yallist/package.json | 68 + .../npm/node_modules/cacache/package.json | 83 + node_modules/npm/node_modules/chalk/license | 9 + .../npm/node_modules/chalk/package.json | 83 + .../npm/node_modules/chalk/source/index.js | 225 + .../node_modules/chalk/source/utilities.js | 33 + .../chalk/source/vendor/ansi-styles/index.js | 223 + .../source/vendor/supports-color/browser.js | 30 + .../source/vendor/supports-color/index.js | 182 + node_modules/npm/node_modules/chownr/LICENSE | 15 + .../npm/node_modules/chownr/chownr.js | 167 + .../npm/node_modules/chownr/package.json | 32 + node_modules/npm/node_modules/ci-info/LICENSE | 21 + .../npm/node_modules/ci-info/index.js | 102 + .../npm/node_modules/ci-info/package.json | 51 + .../npm/node_modules/ci-info/vendors.json | 348 + .../npm/node_modules/cidr-regex/LICENSE | 22 + .../npm/node_modules/cidr-regex/dist/index.js | 15 + .../npm/node_modules/cidr-regex/package.json | 40 + .../npm/node_modules/cli-columns/color.js | 16 + .../npm/node_modules/cli-columns/index.js | 82 + .../npm/node_modules/cli-columns/license | 20 + .../npm/node_modules/cli-columns/package.json | 54 + .../npm/node_modules/cli-columns/test.js | 101 + .../npm/node_modules/cmd-shim/LICENSE | 15 + .../npm/node_modules/cmd-shim/lib/index.js | 247 + .../cmd-shim/lib/to-batch-syntax.js | 49 + .../npm/node_modules/cmd-shim/package.json | 48 + .../npm/node_modules/color-convert/LICENSE | 21 + .../node_modules/color-convert/conversions.js | 839 ++ .../npm/node_modules/color-convert/index.js | 81 + .../node_modules/color-convert/package.json | 48 + .../npm/node_modules/color-convert/route.js | 97 + .../npm/node_modules/color-name/LICENSE | 8 + .../npm/node_modules/color-name/index.js | 152 + .../npm/node_modules/color-name/package.json | 28 + .../node_modules/common-ancestor-path/LICENSE | 15 + .../common-ancestor-path/index.js | 17 + .../common-ancestor-path/package.json | 28 + .../npm/node_modules/cross-spawn/LICENSE | 21 + .../npm/node_modules/cross-spawn/index.js | 39 + .../node_modules/cross-spawn/lib/enoent.js | 59 + .../npm/node_modules/cross-spawn/lib/parse.js | 91 + .../cross-spawn/lib/util/escape.js | 47 + .../cross-spawn/lib/util/readShebang.js | 23 + .../cross-spawn/lib/util/resolveCommand.js | 52 + .../cross-spawn/node_modules/which/LICENSE | 15 + .../cross-spawn/node_modules/which/README.md | 54 + .../node_modules/which/bin/node-which | 52 + .../node_modules/which/package.json | 43 + .../cross-spawn/node_modules/which/which.js | 125 + .../npm/node_modules/cross-spawn/package.json | 73 + .../npm/node_modules/cssesc/LICENSE-MIT.txt | 20 + .../npm/node_modules/cssesc/README.md | 201 + .../npm/node_modules/cssesc/bin/cssesc | 116 + .../npm/node_modules/cssesc/cssesc.js | 110 + .../npm/node_modules/cssesc/man/cssesc.1 | 70 + .../npm/node_modules/cssesc/package.json | 51 + node_modules/npm/node_modules/debug/LICENSE | 20 + .../npm/node_modules/debug/package.json | 65 + .../npm/node_modules/debug/src/browser.js | 272 + .../npm/node_modules/debug/src/common.js | 292 + .../npm/node_modules/debug/src/index.js | 10 + .../npm/node_modules/debug/src/node.js | 263 + .../npm/node_modules/diff/CONTRIBUTING.md | 40 + node_modules/npm/node_modules/diff/LICENSE | 29 + .../npm/node_modules/diff/dist/diff.js | 2106 +++++ .../npm/node_modules/diff/dist/diff.min.js | 37 + .../npm/node_modules/diff/lib/convert/dmp.js | 27 + .../npm/node_modules/diff/lib/convert/xml.js | 35 + .../npm/node_modules/diff/lib/diff/array.js | 39 + .../npm/node_modules/diff/lib/diff/base.js | 304 + .../node_modules/diff/lib/diff/character.js | 33 + .../npm/node_modules/diff/lib/diff/css.js | 36 + .../npm/node_modules/diff/lib/diff/json.js | 143 + .../npm/node_modules/diff/lib/diff/line.js | 121 + .../node_modules/diff/lib/diff/sentence.js | 36 + .../npm/node_modules/diff/lib/diff/word.js | 543 ++ .../npm/node_modules/diff/lib/index.es6.js | 2041 +++++ .../npm/node_modules/diff/lib/index.js | 217 + .../npm/node_modules/diff/lib/index.mjs | 2041 +++++ .../npm/node_modules/diff/lib/patch/apply.js | 393 + .../npm/node_modules/diff/lib/patch/create.js | 369 + .../diff/lib/patch/line-endings.js | 176 + .../npm/node_modules/diff/lib/patch/merge.js | 535 ++ .../npm/node_modules/diff/lib/patch/parse.js | 151 + .../node_modules/diff/lib/patch/reverse.js | 58 + .../npm/node_modules/diff/lib/util/array.js | 27 + .../diff/lib/util/distance-iterator.js | 54 + .../npm/node_modules/diff/lib/util/params.js | 22 + .../npm/node_modules/diff/lib/util/string.js | 131 + .../npm/node_modules/diff/package.json | 88 + .../npm/node_modules/diff/release-notes.md | 361 + node_modules/npm/node_modules/diff/runtime.js | 3 + .../eastasianwidth/eastasianwidth.js | 311 + .../node_modules/eastasianwidth/package.json | 18 + .../node_modules/emoji-regex/LICENSE-MIT.txt | 20 + .../node_modules/emoji-regex/es2015/index.js | 6 + .../node_modules/emoji-regex/es2015/text.js | 6 + .../npm/node_modules/emoji-regex/index.js | 6 + .../npm/node_modules/emoji-regex/package.json | 50 + .../npm/node_modules/emoji-regex/text.js | 6 + .../npm/node_modules/encoding/LICENSE | 16 + .../npm/node_modules/encoding/lib/encoding.js | 83 + .../npm/node_modules/encoding/package.json | 18 + .../npm/node_modules/encoding/test/test.js | 49 + .../npm/node_modules/env-paths/index.js | 74 + .../npm/node_modules/env-paths/license | 9 + .../npm/node_modules/env-paths/package.json | 45 + .../npm/node_modules/err-code/bower.json | 30 + .../npm/node_modules/err-code/index.js | 47 + .../npm/node_modules/err-code/index.umd.js | 51 + .../npm/node_modules/err-code/package.json | 34 + .../npm/node_modules/err-code/test/test.js | 159 + .../node_modules/exponential-backoff/LICENSE | 202 + .../exponential-backoff/dist/backoff.js | 118 + .../dist/delay/always/always.delay.js | 25 + .../dist/delay/delay.base.js | 45 + .../dist/delay/delay.factory.js | 17 + .../dist/delay/delay.interface.js | 3 + .../dist/delay/skip-first/skip-first.delay.js | 82 + .../dist/jitter/full/full.jitter.js | 8 + .../dist/jitter/jitter.factory.js | 15 + .../dist/jitter/no/no.jitter.js | 7 + .../exponential-backoff/dist/options.js | 31 + .../exponential-backoff/package.json | 61 + .../fastest-levenshtein/LICENSE.md | 21 + .../node_modules/fastest-levenshtein/bench.js | 96 + .../fastest-levenshtein/esm/mod.js | 138 + .../node_modules/fastest-levenshtein/mod.js | 142 + .../fastest-levenshtein/package.json | 72 + .../node_modules/fastest-levenshtein/test.js | 55 + .../npm/node_modules/foreground-child/LICENSE | 15 + .../dist/commonjs/all-signals.js | 58 + .../foreground-child/dist/commonjs/index.js | 123 + .../dist/commonjs/package.json | 3 + .../dist/commonjs/proxy-signals.js | 38 + .../dist/commonjs/watchdog.js | 50 + .../foreground-child/dist/esm/all-signals.js | 52 + .../foreground-child/dist/esm/index.js | 115 + .../foreground-child/dist/esm/package.json | 3 + .../dist/esm/proxy-signals.js | 34 + .../foreground-child/dist/esm/watchdog.js | 46 + .../foreground-child/package.json | 111 + .../npm/node_modules/fs-minipass/LICENSE | 15 + .../npm/node_modules/fs-minipass/lib/index.js | 443 + .../npm/node_modules/fs-minipass/package.json | 54 + node_modules/npm/node_modules/glob/LICENSE | 15 + node_modules/npm/node_modules/glob/README.md | 1265 +++ .../node_modules/glob/dist/commonjs/glob.d.ts | 388 + .../glob/dist/commonjs/glob.d.ts.map | 1 + .../node_modules/glob/dist/commonjs/glob.js | 247 + .../glob/dist/commonjs/glob.js.map | 1 + .../glob/dist/commonjs/has-magic.d.ts | 14 + .../glob/dist/commonjs/has-magic.d.ts.map | 1 + .../glob/dist/commonjs/has-magic.js | 27 + .../glob/dist/commonjs/has-magic.js.map | 1 + .../glob/dist/commonjs/ignore.d.ts | 24 + .../glob/dist/commonjs/ignore.d.ts.map | 1 + .../node_modules/glob/dist/commonjs/ignore.js | 119 + .../glob/dist/commonjs/ignore.js.map | 1 + .../glob/dist/commonjs/index.d.ts | 97 + .../glob/dist/commonjs/index.d.ts.map | 1 + .../node_modules/glob/dist/commonjs/index.js | 68 + .../glob/dist/commonjs/index.js.map | 1 + .../glob/dist/commonjs/package.json | 3 + .../glob/dist/commonjs/pattern.d.ts | 76 + .../glob/dist/commonjs/pattern.d.ts.map | 1 + .../glob/dist/commonjs/pattern.js | 219 + .../glob/dist/commonjs/pattern.js.map | 1 + .../glob/dist/commonjs/processor.d.ts | 59 + .../glob/dist/commonjs/processor.d.ts.map | 1 + .../glob/dist/commonjs/processor.js | 301 + .../glob/dist/commonjs/processor.js.map | 1 + .../glob/dist/commonjs/walker.d.ts | 97 + .../glob/dist/commonjs/walker.d.ts.map | 1 + .../node_modules/glob/dist/commonjs/walker.js | 387 + .../glob/dist/commonjs/walker.js.map | 1 + .../npm/node_modules/glob/dist/esm/bin.d.mts | 3 + .../node_modules/glob/dist/esm/bin.d.mts.map | 1 + .../npm/node_modules/glob/dist/esm/bin.mjs | 270 + .../node_modules/glob/dist/esm/bin.mjs.map | 1 + .../npm/node_modules/glob/dist/esm/glob.d.ts | 388 + .../node_modules/glob/dist/esm/glob.d.ts.map | 1 + .../npm/node_modules/glob/dist/esm/glob.js | 243 + .../node_modules/glob/dist/esm/glob.js.map | 1 + .../node_modules/glob/dist/esm/has-magic.d.ts | 14 + .../glob/dist/esm/has-magic.d.ts.map | 1 + .../node_modules/glob/dist/esm/has-magic.js | 23 + .../glob/dist/esm/has-magic.js.map | 1 + .../node_modules/glob/dist/esm/ignore.d.ts | 24 + .../glob/dist/esm/ignore.d.ts.map | 1 + .../npm/node_modules/glob/dist/esm/ignore.js | 115 + .../node_modules/glob/dist/esm/ignore.js.map | 1 + .../npm/node_modules/glob/dist/esm/index.d.ts | 97 + .../node_modules/glob/dist/esm/index.d.ts.map | 1 + .../npm/node_modules/glob/dist/esm/index.js | 55 + .../node_modules/glob/dist/esm/index.js.map | 1 + .../node_modules/glob/dist/esm/package.json | 3 + .../node_modules/glob/dist/esm/pattern.d.ts | 76 + .../glob/dist/esm/pattern.d.ts.map | 1 + .../npm/node_modules/glob/dist/esm/pattern.js | 215 + .../node_modules/glob/dist/esm/pattern.js.map | 1 + .../node_modules/glob/dist/esm/processor.d.ts | 59 + .../glob/dist/esm/processor.d.ts.map | 1 + .../node_modules/glob/dist/esm/processor.js | 294 + .../glob/dist/esm/processor.js.map | 1 + .../node_modules/glob/dist/esm/walker.d.ts | 97 + .../glob/dist/esm/walker.d.ts.map | 1 + .../npm/node_modules/glob/dist/esm/walker.js | 381 + .../node_modules/glob/dist/esm/walker.js.map | 1 + .../npm/node_modules/glob/package.json | 99 + .../npm/node_modules/graceful-fs/LICENSE | 15 + .../npm/node_modules/graceful-fs/clone.js | 23 + .../node_modules/graceful-fs/graceful-fs.js | 448 + .../graceful-fs/legacy-streams.js | 118 + .../npm/node_modules/graceful-fs/package.json | 53 + .../npm/node_modules/graceful-fs/polyfills.js | 355 + .../npm/node_modules/hosted-git-info/LICENSE | 13 + .../hosted-git-info/lib/from-url.js | 122 + .../node_modules/hosted-git-info/lib/hosts.js | 231 + .../node_modules/hosted-git-info/lib/index.js | 179 + .../hosted-git-info/lib/parse-url.js | 78 + .../node_modules/hosted-git-info/package.json | 61 + .../node_modules/http-cache-semantics/LICENSE | 9 + .../http-cache-semantics/index.js | 674 ++ .../http-cache-semantics/package.json | 18 + .../npm/node_modules/http-proxy-agent/LICENSE | 22 + .../http-proxy-agent/dist/index.js | 148 + .../http-proxy-agent/package.json | 47 + .../node_modules/https-proxy-agent/LICENSE | 22 + .../https-proxy-agent/dist/index.js | 180 + .../dist/parse-proxy-response.js | 101 + .../https-proxy-agent/package.json | 50 + .../npm/node_modules/iconv-lite/LICENSE | 21 + .../iconv-lite/encodings/dbcs-codec.js | 597 ++ .../iconv-lite/encodings/dbcs-data.js | 188 + .../iconv-lite/encodings/index.js | 23 + .../iconv-lite/encodings/internal.js | 198 + .../iconv-lite/encodings/sbcs-codec.js | 72 + .../encodings/sbcs-data-generated.js | 451 + .../iconv-lite/encodings/sbcs-data.js | 179 + .../encodings/tables/big5-added.json | 122 + .../iconv-lite/encodings/tables/cp936.json | 264 + .../iconv-lite/encodings/tables/cp949.json | 273 + .../iconv-lite/encodings/tables/cp950.json | 177 + .../iconv-lite/encodings/tables/eucjp.json | 182 + .../encodings/tables/gb18030-ranges.json | 1 + .../encodings/tables/gbk-added.json | 56 + .../iconv-lite/encodings/tables/shiftjis.json | 125 + .../iconv-lite/encodings/utf16.js | 197 + .../iconv-lite/encodings/utf32.js | 319 + .../node_modules/iconv-lite/encodings/utf7.js | 290 + .../iconv-lite/lib/bom-handling.js | 52 + .../npm/node_modules/iconv-lite/lib/index.js | 180 + .../node_modules/iconv-lite/lib/streams.js | 109 + .../npm/node_modules/iconv-lite/package.json | 44 + .../npm/node_modules/ignore-walk/LICENSE | 15 + .../npm/node_modules/ignore-walk/lib/index.js | 310 + .../npm/node_modules/ignore-walk/package.json | 64 + .../node_modules/imurmurhash/imurmurhash.js | 138 + .../imurmurhash/imurmurhash.min.js | 12 + .../npm/node_modules/imurmurhash/package.json | 40 + node_modules/npm/node_modules/ini/LICENSE | 15 + node_modules/npm/node_modules/ini/lib/ini.js | 280 + .../npm/node_modules/ini/package.json | 45 + .../node_modules/init-package-json/LICENSE.md | 18 + .../init-package-json/lib/default-input.js | 268 + .../lib/init-package-json.js | 147 + .../init-package-json/package.json | 67 + .../npm/node_modules/ip-address/LICENSE | 19 + .../ip-address/dist/address-error.js | 14 + .../node_modules/ip-address/dist/common.js | 26 + .../ip-address/dist/ip-address.js | 35 + .../npm/node_modules/ip-address/dist/ipv4.js | 326 + .../npm/node_modules/ip-address/dist/ipv6.js | 998 ++ .../ip-address/dist/v4/constants.js | 8 + .../ip-address/dist/v6/constants.js | 76 + .../ip-address/dist/v6/helpers.js | 48 + .../ip-address/dist/v6/regular-expressions.js | 96 + .../npm/node_modules/ip-address/package.json | 87 + .../npm/node_modules/ip-regex/index.js | 36 + .../npm/node_modules/ip-regex/license | 9 + .../npm/node_modules/ip-regex/package.json | 47 + .../npm/node_modules/is-cidr/dist/index.js | 11 + .../npm/node_modules/is-cidr/package.json | 40 + .../is-fullwidth-code-point/index.js | 50 + .../is-fullwidth-code-point/license | 9 + .../is-fullwidth-code-point/package.json | 42 + node_modules/npm/node_modules/isexe/LICENSE | 15 + node_modules/npm/node_modules/isexe/index.js | 57 + node_modules/npm/node_modules/isexe/mode.js | 41 + .../npm/node_modules/isexe/package.json | 31 + .../npm/node_modules/isexe/test/basic.js | 221 + .../npm/node_modules/isexe/windows.js | 42 + .../npm/node_modules/jackspeak/LICENSE.md | 55 + .../jackspeak/dist/commonjs/index.js | 1010 ++ .../jackspeak/dist/commonjs/package.json | 3 + .../jackspeak/dist/commonjs/parse-args.js | 50 + .../node_modules/jackspeak/dist/esm/index.js | 1000 ++ .../jackspeak/dist/esm/package.json | 3 + .../jackspeak/dist/esm/parse-args.js | 26 + .../npm/node_modules/jackspeak/package.json | 95 + node_modules/npm/node_modules/jsbn/LICENSE | 40 + .../npm/node_modules/jsbn/example.html | 11 + node_modules/npm/node_modules/jsbn/example.js | 5 + node_modules/npm/node_modules/jsbn/index.js | 1361 +++ .../npm/node_modules/jsbn/package.json | 21 + .../npm/node_modules/jsbn/test/es6-import.js | 3 + .../json-parse-even-better-errors/LICENSE.md | 25 + .../lib/index.js | 137 + .../package.json | 50 + .../node_modules/json-stringify-nice/LICENSE | 15 + .../node_modules/json-stringify-nice/index.js | 38 + .../json-stringify-nice/package.json | 40 + .../npm/node_modules/jsonparse/LICENSE | 24 + .../npm/node_modules/jsonparse/bench.js | 26 + .../jsonparse/examples/twitterfeed.js | 30 + .../npm/node_modules/jsonparse/jsonparse.js | 413 + .../npm/node_modules/jsonparse/package.json | 22 + .../jsonparse/samplejson/basic.json | 167 + .../jsonparse/samplejson/basic2.json | 180 + .../node_modules/jsonparse/test/big-token.js | 24 + .../node_modules/jsonparse/test/boundary.js | 110 + .../npm/node_modules/jsonparse/test/offset.js | 67 + .../node_modules/jsonparse/test/primitives.js | 57 + .../node_modules/jsonparse/test/surrogate.js | 26 + .../node_modules/jsonparse/test/unvalid.js | 15 + .../npm/node_modules/jsonparse/test/utf8.js | 38 + .../npm/node_modules/just-diff-apply/LICENSE | 21 + .../node_modules/just-diff-apply/index.cjs | 161 + .../node_modules/just-diff-apply/index.mjs | 158 + .../node_modules/just-diff-apply/package.json | 34 + .../just-diff-apply/rollup.config.js | 3 + .../npm/node_modules/just-diff/LICENSE | 21 + .../npm/node_modules/just-diff/index.cjs | 230 + .../npm/node_modules/just-diff/index.mjs | 227 + .../npm/node_modules/just-diff/package.json | 33 + .../node_modules/just-diff/rollup.config.js | 3 + .../npm/node_modules/libnpmaccess/LICENSE | 13 + .../npm/node_modules/libnpmaccess/README.md | 93 + .../node_modules/libnpmaccess/lib/index.js | 140 + .../node_modules/libnpmaccess/package.json | 53 + .../npm/node_modules/libnpmdiff/LICENSE | 15 + .../npm/node_modules/libnpmdiff/README.md | 96 + .../libnpmdiff/lib/format-diff.js | 118 + .../npm/node_modules/libnpmdiff/lib/index.js | 62 + .../libnpmdiff/lib/should-print-patch.js | 22 + .../node_modules/libnpmdiff/lib/tarball.js | 38 + .../npm/node_modules/libnpmdiff/lib/untar.js | 96 + .../npm/node_modules/libnpmdiff/package.json | 70 + .../npm/node_modules/libnpmexec/LICENSE | 15 + .../npm/node_modules/libnpmexec/README.md | 47 + .../libnpmexec/lib/file-exists.js | 33 + .../libnpmexec/lib/get-bin-from-manifest.js | 22 + .../npm/node_modules/libnpmexec/lib/index.js | 301 + .../node_modules/libnpmexec/lib/is-windows.js | 1 + .../npm/node_modules/libnpmexec/lib/no-tty.js | 1 + .../node_modules/libnpmexec/lib/run-script.js | 61 + .../npm/node_modules/libnpmexec/package.json | 79 + .../npm/node_modules/libnpmfund/LICENSE | 15 + .../npm/node_modules/libnpmfund/README.md | 131 + .../npm/node_modules/libnpmfund/lib/index.js | 210 + .../npm/node_modules/libnpmfund/package.json | 65 + .../npm/node_modules/libnpmorg/LICENSE | 13 + .../npm/node_modules/libnpmorg/README.md | 148 + .../npm/node_modules/libnpmorg/lib/index.js | 64 + .../npm/node_modules/libnpmorg/package.json | 62 + .../npm/node_modules/libnpmpack/LICENSE | 13 + .../npm/node_modules/libnpmpack/README.md | 55 + .../npm/node_modules/libnpmpack/lib/index.js | 62 + .../npm/node_modules/libnpmpack/package.json | 59 + .../npm/node_modules/libnpmpublish/LICENSE | 13 + .../npm/node_modules/libnpmpublish/README.md | 120 + .../node_modules/libnpmpublish/lib/index.js | 4 + .../libnpmpublish/lib/provenance.js | 245 + .../node_modules/libnpmpublish/lib/publish.js | 225 + .../libnpmpublish/lib/unpublish.js | 119 + .../node_modules/libnpmpublish/package.json | 64 + .../npm/node_modules/libnpmsearch/LICENSE | 13 + .../npm/node_modules/libnpmsearch/README.md | 173 + .../node_modules/libnpmsearch/lib/index.js | 71 + .../node_modules/libnpmsearch/package.json | 58 + .../npm/node_modules/libnpmteam/LICENSE | 13 + .../npm/node_modules/libnpmteam/README.md | 188 + .../npm/node_modules/libnpmteam/lib/index.js | 92 + .../npm/node_modules/libnpmteam/package.json | 52 + .../npm/node_modules/libnpmversion/LICENSE | 15 + .../npm/node_modules/libnpmversion/README.md | 163 + .../node_modules/libnpmversion/lib/commit.js | 17 + .../libnpmversion/lib/enforce-clean.js | 32 + .../node_modules/libnpmversion/lib/index.js | 38 + .../libnpmversion/lib/read-json.js | 6 + .../libnpmversion/lib/retrieve-tag.js | 13 + .../npm/node_modules/libnpmversion/lib/tag.js | 30 + .../node_modules/libnpmversion/lib/version.js | 136 + .../libnpmversion/lib/write-json.js | 15 + .../node_modules/libnpmversion/package.json | 55 + .../npm/node_modules/lru-cache/LICENSE | 15 + .../lru-cache/dist/commonjs/index.js | 1546 ++++ .../lru-cache/dist/commonjs/index.min.js | 2 + .../lru-cache/dist/commonjs/package.json | 3 + .../node_modules/lru-cache/dist/esm/index.js | 1542 ++++ .../lru-cache/dist/esm/index.min.js | 2 + .../lru-cache/dist/esm/package.json | 3 + .../npm/node_modules/lru-cache/package.json | 116 + .../node_modules/make-fetch-happen/LICENSE | 16 + .../make-fetch-happen/lib/cache/entry.js | 471 + .../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 + .../make-fetch-happen/lib/fetch.js | 118 + .../make-fetch-happen/lib/index.js | 41 + .../make-fetch-happen/lib/options.js | 59 + .../make-fetch-happen/lib/pipeline.js | 41 + .../make-fetch-happen/lib/remote.js | 132 + .../node_modules/negotiator/HISTORY.md | 114 + .../node_modules/negotiator/LICENSE | 24 + .../node_modules/negotiator/index.js | 83 + .../node_modules/negotiator/lib/charset.js | 169 + .../node_modules/negotiator/lib/encoding.js | 205 + .../node_modules/negotiator/lib/language.js | 179 + .../node_modules/negotiator/lib/mediaType.js | 294 + .../node_modules/negotiator/package.json | 43 + .../make-fetch-happen/package.json | 74 + .../npm/node_modules/minimatch/LICENSE | 15 + .../dist/commonjs/assert-valid-pattern.js | 14 + .../minimatch/dist/commonjs/ast.js | 592 ++ .../dist/commonjs/brace-expressions.js | 152 + .../minimatch/dist/commonjs/escape.js | 22 + .../minimatch/dist/commonjs/index.js | 1017 ++ .../minimatch/dist/commonjs/package.json | 3 + .../minimatch/dist/commonjs/unescape.js | 24 + .../dist/esm/assert-valid-pattern.js | 10 + .../node_modules/minimatch/dist/esm/ast.js | 588 ++ .../minimatch/dist/esm/brace-expressions.js | 148 + .../node_modules/minimatch/dist/esm/escape.js | 18 + .../node_modules/minimatch/dist/esm/index.js | 1001 ++ .../minimatch/dist/esm/package.json | 3 + .../minimatch/dist/esm/unescape.js | 20 + .../npm/node_modules/minimatch/package.json | 82 + .../npm/node_modules/minipass-collect/LICENSE | 15 + .../node_modules/minipass-collect/index.js | 71 + .../minipass-collect/package.json | 30 + .../npm/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 | 377 + .../minipass-fetch/lib/request.js | 282 + .../minipass-fetch/lib/response.js | 90 + .../node_modules/minizlib/LICENSE | 26 + .../minizlib/dist/commonjs/constants.js | 123 + .../minizlib/dist/commonjs/index.js | 352 + .../minizlib/dist/commonjs/package.json | 3 + .../minizlib/dist/esm/constants.js | 117 + .../node_modules/minizlib/dist/esm/index.js | 333 + .../minizlib/dist/esm/package.json | 3 + .../node_modules/minizlib/package.json | 81 + .../node_modules/minipass-fetch/package.json | 70 + .../npm/node_modules/minipass-flush/LICENSE | 15 + .../npm/node_modules/minipass-flush/index.js | 39 + .../node_modules/minipass/LICENSE | 15 + .../node_modules/minipass/index.js | 649 ++ .../node_modules/minipass/package.json | 56 + .../node_modules/minipass-flush/package.json | 39 + .../node_modules/minipass-pipeline/LICENSE | 15 + .../node_modules/minipass-pipeline/index.js | 128 + .../node_modules/minipass/LICENSE | 15 + .../node_modules/minipass/index.js | 649 ++ .../node_modules/minipass/package.json | 56 + .../minipass-pipeline/package.json | 29 + .../npm/node_modules/minipass-sized/LICENSE | 15 + .../npm/node_modules/minipass-sized/index.js | 67 + .../node_modules/minipass/LICENSE | 15 + .../node_modules/minipass/index.js | 649 ++ .../node_modules/minipass/package.json | 56 + .../node_modules/minipass-sized/package.json | 39 + .../node_modules/minipass-sized/test/basic.js | 83 + .../npm/node_modules/minipass/LICENSE | 15 + .../minipass/dist/commonjs/index.js | 1028 +++ .../minipass/dist/commonjs/package.json | 3 + .../node_modules/minipass/dist/esm/index.js | 1018 +++ .../minipass/dist/esm/package.json | 3 + .../npm/node_modules/minipass/package.json | 82 + .../npm/node_modules/minizlib/LICENSE | 26 + .../npm/node_modules/minizlib/constants.js | 115 + .../npm/node_modules/minizlib/index.js | 348 + .../minizlib/node_modules/minipass/LICENSE | 15 + .../minizlib/node_modules/minipass/index.js | 649 ++ .../node_modules/minipass/package.json | 56 + .../npm/node_modules/minizlib/package.json | 42 + node_modules/npm/node_modules/mkdirp/LICENSE | 21 + .../npm/node_modules/mkdirp/bin/cmd.js | 68 + node_modules/npm/node_modules/mkdirp/index.js | 31 + .../npm/node_modules/mkdirp/lib/find-made.js | 29 + .../node_modules/mkdirp/lib/mkdirp-manual.js | 64 + .../node_modules/mkdirp/lib/mkdirp-native.js | 39 + .../npm/node_modules/mkdirp/lib/opts-arg.js | 23 + .../npm/node_modules/mkdirp/lib/path-arg.js | 29 + .../npm/node_modules/mkdirp/lib/use-native.js | 10 + .../npm/node_modules/mkdirp/package.json | 44 + .../npm/node_modules/mkdirp/readme.markdown | 266 + node_modules/npm/node_modules/ms/index.js | 162 + node_modules/npm/node_modules/ms/license.md | 21 + node_modules/npm/node_modules/ms/package.json | 38 + .../npm/node_modules/mute-stream/LICENSE | 15 + .../npm/node_modules/mute-stream/lib/index.js | 142 + .../npm/node_modules/mute-stream/package.json | 54 + .../node-gyp/.release-please-manifest.json | 3 + .../npm/node_modules/node-gyp/CHANGELOG.md | 1003 ++ .../node_modules/node-gyp/CODE_OF_CONDUCT.md | 4 + .../npm/node_modules/node-gyp/CONTRIBUTING.md | 34 + .../npm/node_modules/node-gyp/LICENSE | 24 + .../npm/node_modules/node-gyp/README.md | 273 + .../npm/node_modules/node-gyp/SECURITY.md | 2 + .../npm/node_modules/node-gyp/addon.gypi | 204 + .../npm/node_modules/node-gyp/bin/node-gyp.js | 138 + .../node_modules/node-gyp/eslint.config.js | 3 + .../gyp/.release-please-manifest.json | 3 + .../npm/node_modules/node-gyp/gyp/LICENSE | 28 + .../node-gyp/gyp/data/ninja/build.ninja | 4 + .../node-gyp/gyp/data/win/large-pdb-shim.cc | 12 + .../node-gyp/gyp/docs/GypVsCMake.md | 116 + .../node_modules/node-gyp/gyp/docs/Hacking.md | 46 + .../node-gyp/gyp/docs/InputFormatReference.md | 1080 +++ .../gyp/docs/LanguageSpecification.md | 430 + .../node_modules/node-gyp/gyp/docs/README.md | 27 + .../node_modules/node-gyp/gyp/docs/Testing.md | 450 + .../node-gyp/gyp/docs/UserDocumentation.md | 965 ++ .../npm/node_modules/node-gyp/gyp/gyp | 8 + .../npm/node_modules/node-gyp/gyp/gyp.bat | 5 + .../npm/node_modules/node-gyp/gyp/gyp_main.py | 45 + .../node-gyp/gyp/pylib/gyp/MSVSNew.py | 365 + .../node-gyp/gyp/pylib/gyp/MSVSProject.py | 206 + .../node-gyp/gyp/pylib/gyp/MSVSSettings.py | 1272 +++ .../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 | 692 ++ .../node-gyp/gyp/pylib/gyp/common.py | 711 ++ .../node-gyp/gyp/pylib/gyp/common_test.py | 171 + .../node-gyp/gyp/pylib/gyp/easy_xml.py | 169 + .../node-gyp/gyp/pylib/gyp/easy_xml_test.py | 113 + .../node-gyp/gyp/pylib/gyp/flock_tool.py | 55 + .../gyp/pylib/gyp/generator/__init__.py | 0 .../gyp/pylib/gyp/generator/analyzer.py | 804 ++ .../gyp/pylib/gyp/generator/android.py | 1173 +++ .../node-gyp/gyp/pylib/gyp/generator/cmake.py | 1318 +++ .../gyp/generator/compile_commands_json.py | 127 + .../gyp/generator/dump_dependency_json.py | 103 + .../gyp/pylib/gyp/generator/eclipse.py | 461 + .../node-gyp/gyp/pylib/gyp/generator/gypd.py | 89 + .../node-gyp/gyp/pylib/gyp/generator/gypsh.py | 57 + .../node-gyp/gyp/pylib/gyp/generator/make.py | 2745 ++++++ .../node-gyp/gyp/pylib/gyp/generator/msvs.py | 3976 ++++++++ .../gyp/pylib/gyp/generator/msvs_test.py | 44 + .../node-gyp/gyp/pylib/gyp/generator/ninja.py | 2964 ++++++ .../gyp/pylib/gyp/generator/ninja_test.py | 67 + .../node-gyp/gyp/pylib/gyp/generator/xcode.py | 1391 +++ .../gyp/pylib/gyp/generator/xcode_test.py | 25 + .../node-gyp/gyp/pylib/gyp/input.py | 3115 +++++++ .../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 | 1260 +++ .../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 | 373 + .../node-gyp/gyp/pylib/gyp/xcode_emulation.py | 1938 ++++ .../gyp/pylib/gyp/xcode_emulation_test.py | 53 + .../node-gyp/gyp/pylib/gyp/xcode_ninja.py | 302 + .../node-gyp/gyp/pylib/gyp/xcodeproj_file.py | 3198 +++++++ .../node-gyp/gyp/pylib/gyp/xml_fix.py | 65 + .../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 | 120 + .../node-gyp/gyp/release-please-config.json | 11 + .../npm/node_modules/node-gyp/gyp/test_gyp.py | 261 + .../node-gyp/lib/Find-VisualStudio.cs | 250 + .../npm/node_modules/node-gyp/lib/build.js | 227 + .../npm/node_modules/node-gyp/lib/clean.js | 15 + .../node_modules/node-gyp/lib/configure.js | 328 + .../node-gyp/lib/create-config-gypi.js | 153 + .../npm/node_modules/node-gyp/lib/download.js | 39 + .../node-gyp/lib/find-node-directory.js | 63 + .../node_modules/node-gyp/lib/find-python.js | 310 + .../node-gyp/lib/find-visualstudio.js | 590 ++ .../npm/node_modules/node-gyp/lib/install.js | 415 + .../npm/node_modules/node-gyp/lib/list.js | 26 + .../npm/node_modules/node-gyp/lib/log.js | 168 + .../npm/node_modules/node-gyp/lib/node-gyp.js | 188 + .../node-gyp/lib/process-release.js | 146 + .../npm/node_modules/node-gyp/lib/rebuild.js | 12 + .../npm/node_modules/node-gyp/lib/remove.js | 43 + .../npm/node_modules/node-gyp/lib/util.js | 81 + .../node-gyp/macOS_Catalina_acid_test.sh | 21 + .../node-gyp/node_modules/chownr/LICENSE.md | 63 + .../chownr/dist/commonjs/index.js | 93 + .../chownr/dist/commonjs/package.json | 3 + .../node_modules/chownr/dist/esm/index.js | 85 + .../node_modules/chownr/dist/esm/package.json | 3 + .../node-gyp/node_modules/chownr/package.json | 69 + .../node-gyp/node_modules/minizlib/LICENSE | 26 + .../minizlib/dist/commonjs/constants.js | 123 + .../minizlib/dist/commonjs/index.js | 352 + .../minizlib/dist/commonjs/package.json | 3 + .../minizlib/dist/esm/constants.js | 117 + .../node_modules/minizlib/dist/esm/index.js | 333 + .../minizlib/dist/esm/package.json | 3 + .../node_modules/minizlib/package.json | 81 + .../node-gyp/node_modules/mkdirp/LICENSE | 21 + .../node_modules/mkdirp/dist/cjs/package.json | 91 + .../node_modules/mkdirp/dist/cjs/src/bin.d.ts | 3 + .../mkdirp/dist/cjs/src/bin.d.ts.map | 1 + .../node_modules/mkdirp/dist/cjs/src/bin.js | 80 + .../mkdirp/dist/cjs/src/bin.js.map | 1 + .../mkdirp/dist/cjs/src/find-made.d.ts | 4 + .../mkdirp/dist/cjs/src/find-made.d.ts.map | 1 + .../mkdirp/dist/cjs/src/find-made.js | 35 + .../mkdirp/dist/cjs/src/find-made.js.map | 1 + .../mkdirp/dist/cjs/src/index.d.ts | 39 + .../mkdirp/dist/cjs/src/index.d.ts.map | 1 + .../node_modules/mkdirp/dist/cjs/src/index.js | 53 + .../mkdirp/dist/cjs/src/index.js.map | 1 + .../mkdirp/dist/cjs/src/mkdirp-manual.d.ts | 6 + .../dist/cjs/src/mkdirp-manual.d.ts.map | 1 + .../mkdirp/dist/cjs/src/mkdirp-manual.js | 79 + .../mkdirp/dist/cjs/src/mkdirp-manual.js.map | 1 + .../mkdirp/dist/cjs/src/mkdirp-native.d.ts | 6 + .../dist/cjs/src/mkdirp-native.d.ts.map | 1 + .../mkdirp/dist/cjs/src/mkdirp-native.js | 50 + .../mkdirp/dist/cjs/src/mkdirp-native.js.map | 1 + .../mkdirp/dist/cjs/src/opts-arg.d.ts | 42 + .../mkdirp/dist/cjs/src/opts-arg.d.ts.map | 1 + .../mkdirp/dist/cjs/src/opts-arg.js | 38 + .../mkdirp/dist/cjs/src/opts-arg.js.map | 1 + .../mkdirp/dist/cjs/src/path-arg.d.ts | 2 + .../mkdirp/dist/cjs/src/path-arg.d.ts.map | 1 + .../mkdirp/dist/cjs/src/path-arg.js | 28 + .../mkdirp/dist/cjs/src/path-arg.js.map | 1 + .../mkdirp/dist/cjs/src/use-native.d.ts | 6 + .../mkdirp/dist/cjs/src/use-native.d.ts.map | 1 + .../mkdirp/dist/cjs/src/use-native.js | 17 + .../mkdirp/dist/cjs/src/use-native.js.map | 1 + .../mkdirp/dist/mjs/find-made.d.ts | 4 + .../mkdirp/dist/mjs/find-made.d.ts.map | 1 + .../node_modules/mkdirp/dist/mjs/find-made.js | 30 + .../mkdirp/dist/mjs/find-made.js.map | 1 + .../node_modules/mkdirp/dist/mjs/index.d.ts | 39 + .../mkdirp/dist/mjs/index.d.ts.map | 1 + .../node_modules/mkdirp/dist/mjs/index.js | 43 + .../node_modules/mkdirp/dist/mjs/index.js.map | 1 + .../mkdirp/dist/mjs/mkdirp-manual.d.ts | 6 + .../mkdirp/dist/mjs/mkdirp-manual.d.ts.map | 1 + .../mkdirp/dist/mjs/mkdirp-manual.js | 75 + .../mkdirp/dist/mjs/mkdirp-manual.js.map | 1 + .../mkdirp/dist/mjs/mkdirp-native.d.ts | 6 + .../mkdirp/dist/mjs/mkdirp-native.d.ts.map | 1 + .../mkdirp/dist/mjs/mkdirp-native.js | 46 + .../mkdirp/dist/mjs/mkdirp-native.js.map | 1 + .../mkdirp/dist/mjs/opts-arg.d.ts | 42 + .../mkdirp/dist/mjs/opts-arg.d.ts.map | 1 + .../node_modules/mkdirp/dist/mjs/opts-arg.js | 34 + .../mkdirp/dist/mjs/opts-arg.js.map | 1 + .../node_modules/mkdirp/dist/mjs/package.json | 3 + .../mkdirp/dist/mjs/path-arg.d.ts | 2 + .../mkdirp/dist/mjs/path-arg.d.ts.map | 1 + .../node_modules/mkdirp/dist/mjs/path-arg.js | 24 + .../mkdirp/dist/mjs/path-arg.js.map | 1 + .../mkdirp/dist/mjs/use-native.d.ts | 6 + .../mkdirp/dist/mjs/use-native.d.ts.map | 1 + .../mkdirp/dist/mjs/use-native.js | 14 + .../mkdirp/dist/mjs/use-native.js.map | 1 + .../node-gyp/node_modules/mkdirp/package.json | 91 + .../node_modules/mkdirp/readme.markdown | 281 + .../node-gyp/node_modules/tar/LICENSE | 15 + .../node_modules/tar/dist/commonjs/create.js | 83 + .../tar/dist/commonjs/cwd-error.js | 18 + .../node_modules/tar/dist/commonjs/extract.js | 78 + .../tar/dist/commonjs/get-write-flag.js | 29 + .../node_modules/tar/dist/commonjs/header.js | 306 + .../node_modules/tar/dist/commonjs/index.js | 54 + .../tar/dist/commonjs/large-numbers.js | 99 + .../node_modules/tar/dist/commonjs/list.js | 136 + .../tar/dist/commonjs/make-command.js | 61 + .../node_modules/tar/dist/commonjs/mkdir.js | 209 + .../tar/dist/commonjs/mode-fix.js | 29 + .../tar/dist/commonjs/normalize-unicode.js | 17 + .../dist/commonjs/normalize-windows-path.js | 12 + .../node_modules/tar/dist/commonjs/options.js | 66 + .../node_modules/tar/dist/commonjs/pack.js | 477 + .../tar/dist/commonjs/package.json | 3 + .../node_modules/tar/dist/commonjs/parse.js | 599 ++ .../tar/dist/commonjs/path-reservations.js | 170 + .../node_modules/tar/dist/commonjs/pax.js | 158 + .../tar/dist/commonjs/read-entry.js | 140 + .../node_modules/tar/dist/commonjs/replace.js | 231 + .../tar/dist/commonjs/strip-absolute-path.js | 29 + .../dist/commonjs/strip-trailing-slashes.js | 18 + .../tar/dist/commonjs/symlink-error.js | 19 + .../node_modules/tar/dist/commonjs/types.js | 50 + .../node_modules/tar/dist/commonjs/unpack.js | 919 ++ .../node_modules/tar/dist/commonjs/update.js | 33 + .../tar/dist/commonjs/warn-method.js | 31 + .../tar/dist/commonjs/winchars.js | 14 + .../tar/dist/commonjs/write-entry.js | 689 ++ .../node_modules/tar/dist/esm/create.js | 77 + .../node_modules/tar/dist/esm/cwd-error.js | 14 + .../node_modules/tar/dist/esm/extract.js | 49 + .../tar/dist/esm/get-write-flag.js | 23 + .../node_modules/tar/dist/esm/header.js | 279 + .../node_modules/tar/dist/esm/index.js | 20 + .../tar/dist/esm/large-numbers.js | 94 + .../node_modules/tar/dist/esm/list.js | 106 + .../node_modules/tar/dist/esm/make-command.js | 57 + .../node_modules/tar/dist/esm/mkdir.js | 201 + .../node_modules/tar/dist/esm/mode-fix.js | 25 + .../tar/dist/esm/normalize-unicode.js | 13 + .../tar/dist/esm/normalize-windows-path.js | 9 + .../node_modules/tar/dist/esm/options.js | 54 + .../node_modules/tar/dist/esm/pack.js | 445 + .../node_modules/tar/dist/esm/package.json | 3 + .../node_modules/tar/dist/esm/parse.js | 595 ++ .../tar/dist/esm/path-reservations.js | 166 + .../node-gyp/node_modules/tar/dist/esm/pax.js | 154 + .../node_modules/tar/dist/esm/read-entry.js | 136 + .../node_modules/tar/dist/esm/replace.js | 225 + .../tar/dist/esm/strip-absolute-path.js | 25 + .../tar/dist/esm/strip-trailing-slashes.js | 14 + .../tar/dist/esm/symlink-error.js | 15 + .../node_modules/tar/dist/esm/types.js | 45 + .../node_modules/tar/dist/esm/unpack.js | 888 ++ .../node_modules/tar/dist/esm/update.js | 30 + .../node_modules/tar/dist/esm/warn-method.js | 27 + .../node_modules/tar/dist/esm/winchars.js | 9 + .../node_modules/tar/dist/esm/write-entry.js | 657 ++ .../node-gyp/node_modules/tar/package.json | 325 + .../node-gyp/node_modules/yallist/LICENSE.md | 63 + .../yallist/dist/commonjs/index.js | 384 + .../yallist/dist/commonjs/package.json | 3 + .../node_modules/yallist/dist/esm/index.js | 379 + .../yallist/dist/esm/package.json | 3 + .../node_modules/yallist/package.json | 68 + .../npm/node_modules/node-gyp/package.json | 52 + .../node-gyp/release-please-config.json | 40 + .../node-gyp/src/win_delay_load_hook.cc | 39 + node_modules/npm/node_modules/nopt/LICENSE | 15 + node_modules/npm/node_modules/nopt/README.md | 213 + .../npm/node_modules/nopt/bin/nopt.js | 29 + .../npm/node_modules/nopt/lib/debug.js | 5 + .../npm/node_modules/nopt/lib/nopt-lib.js | 479 + .../npm/node_modules/nopt/lib/nopt.js | 30 + .../npm/node_modules/nopt/lib/type-defs.js | 91 + .../nopt/node_modules/abbrev/LICENSE | 46 + .../nopt/node_modules/abbrev/lib/index.js | 50 + .../nopt/node_modules/abbrev/package.json | 43 + .../npm/node_modules/nopt/package.json | 52 + .../normalize-package-data/LICENSE | 15 + .../lib/extract_description.js | 24 + .../normalize-package-data/lib/fixer.js | 475 + .../lib/make_warning.js | 22 + .../normalize-package-data/lib/normalize.js | 48 + .../normalize-package-data/lib/safe_format.js | 11 + .../normalize-package-data/lib/typos.json | 25 + .../lib/warning_messages.json | 30 + .../normalize-package-data/package.json | 56 + .../npm/node_modules/npm-audit-report/LICENSE | 16 + .../npm-audit-report/lib/colors.js | 22 + .../npm-audit-report/lib/exit-code.js | 14 + .../npm-audit-report/lib/index.js | 41 + .../npm-audit-report/lib/reporters/detail.js | 86 + .../npm-audit-report/lib/reporters/install.js | 75 + .../npm-audit-report/lib/reporters/json.js | 1 + .../npm-audit-report/lib/reporters/quiet.js | 1 + .../npm-audit-report/package.json | 62 + .../npm/node_modules/npm-bundled/LICENSE | 15 + .../npm/node_modules/npm-bundled/lib/index.js | 254 + .../npm/node_modules/npm-bundled/package.json | 49 + .../node_modules/npm-install-checks/LICENSE | 27 + .../npm-install-checks/lib/current-env.js | 91 + .../npm-install-checks/lib/dev-engines.js | 145 + .../npm-install-checks/lib/index.js | 90 + .../npm-install-checks/package.json | 52 + .../npm-normalize-package-bin/LICENSE | 15 + .../npm-normalize-package-bin/lib/index.js | 64 + .../npm-normalize-package-bin/package.json | 45 + .../npm/node_modules/npm-package-arg/LICENSE | 15 + .../node_modules/npm-package-arg/lib/npa.js | 418 + .../node_modules/npm-package-arg/package.json | 61 + .../npm/node_modules/npm-packlist/LICENSE | 15 + .../node_modules/npm-packlist/lib/index.js | 457 + .../node_modules/npm-packlist/package.json | 61 + .../node_modules/npm-pick-manifest/LICENSE.md | 16 + .../npm-pick-manifest/lib/index.js | 224 + .../npm-pick-manifest/package.json | 58 + .../npm/node_modules/npm-profile/LICENSE.md | 20 + .../npm/node_modules/npm-profile/lib/index.js | 278 + .../npm/node_modules/npm-profile/package.json | 52 + .../npm-registry-fetch/LICENSE.md | 20 + .../npm-registry-fetch/lib/auth.js | 181 + .../npm-registry-fetch/lib/check-response.js | 108 + .../npm-registry-fetch/lib/default-opts.js | 19 + .../npm-registry-fetch/lib/errors.js | 80 + .../npm-registry-fetch/lib/index.js | 247 + .../npm-registry-fetch/lib/json-stream.js | 223 + .../node_modules/minizlib/LICENSE | 26 + .../minizlib/dist/commonjs/constants.js | 123 + .../minizlib/dist/commonjs/index.js | 352 + .../minizlib/dist/commonjs/package.json | 3 + .../minizlib/dist/esm/constants.js | 117 + .../node_modules/minizlib/dist/esm/index.js | 333 + .../minizlib/dist/esm/package.json | 3 + .../node_modules/minizlib/package.json | 81 + .../npm-registry-fetch/package.json | 68 + .../node_modules/npm-user-validate/LICENSE | 27 + .../npm-user-validate/lib/index.js | 61 + .../npm-user-validate/package.json | 50 + node_modules/npm/node_modules/p-map/index.js | 281 + node_modules/npm/node_modules/p-map/license | 9 + .../npm/node_modules/p-map/package.json | 57 + .../package-json-from-dist/LICENSE.md | 63 + .../dist/commonjs/index.js | 134 + .../dist/commonjs/package.json | 3 + .../package-json-from-dist/dist/esm/index.js | 129 + .../dist/esm/package.json | 3 + .../package-json-from-dist/package.json | 68 + node_modules/npm/node_modules/pacote/LICENSE | 15 + .../npm/node_modules/pacote/README.md | 283 + .../npm/node_modules/pacote/bin/index.js | 158 + .../npm/node_modules/pacote/lib/dir.js | 105 + .../npm/node_modules/pacote/lib/fetcher.js | 497 + .../npm/node_modules/pacote/lib/file.js | 94 + .../npm/node_modules/pacote/lib/git.js | 317 + .../npm/node_modules/pacote/lib/index.js | 23 + .../npm/node_modules/pacote/lib/registry.js | 369 + .../npm/node_modules/pacote/lib/remote.js | 89 + .../pacote/lib/util/add-git-sha.js | 15 + .../node_modules/pacote/lib/util/cache-dir.js | 15 + .../pacote/lib/util/is-package-bin.js | 25 + .../npm/node_modules/pacote/lib/util/npm.js | 14 + .../node_modules/pacote/lib/util/protected.js | 5 + .../pacote/lib/util/tar-create-options.js | 31 + .../pacote/lib/util/trailing-slashes.js | 10 + .../npm/node_modules/pacote/package.json | 80 + .../parse-conflict-json/LICENSE.md | 20 + .../parse-conflict-json/lib/index.js | 104 + .../parse-conflict-json/package.json | 51 + .../npm/node_modules/path-key/index.js | 16 + .../npm/node_modules/path-key/license | 9 + .../npm/node_modules/path-key/package.json | 39 + .../npm/node_modules/path-scurry/LICENSE.md | 55 + .../path-scurry/dist/commonjs/index.js | 2014 ++++ .../path-scurry/dist/commonjs/package.json | 3 + .../path-scurry/dist/esm/index.js | 1979 ++++ .../path-scurry/dist/esm/package.json | 3 + .../npm/node_modules/path-scurry/package.json | 89 + .../postcss-selector-parser/API.md | 872 ++ .../postcss-selector-parser/LICENSE-MIT | 22 + .../postcss-selector-parser/dist/index.js | 17 + .../postcss-selector-parser/dist/parser.js | 1015 ++ .../postcss-selector-parser/dist/processor.js | 170 + .../dist/selectors/attribute.js | 448 + .../dist/selectors/className.js | 50 + .../dist/selectors/combinator.js | 21 + .../dist/selectors/comment.js | 21 + .../dist/selectors/constructors.js | 65 + .../dist/selectors/container.js | 308 + .../dist/selectors/guards.js | 58 + .../dist/selectors/id.js | 25 + .../dist/selectors/index.js | 21 + .../dist/selectors/namespace.js | 80 + .../dist/selectors/nesting.js | 22 + .../dist/selectors/node.js | 192 + .../dist/selectors/pseudo.js | 26 + .../dist/selectors/root.js | 44 + .../dist/selectors/selector.js | 21 + .../dist/selectors/string.js | 21 + .../dist/selectors/tag.js | 21 + .../dist/selectors/types.js | 28 + .../dist/selectors/universal.js | 22 + .../dist/sortAscending.js | 11 + .../dist/tokenTypes.js | 70 + .../postcss-selector-parser/dist/tokenize.js | 239 + .../dist/util/ensureObject.js | 17 + .../dist/util/getProp.js | 18 + .../dist/util/index.js | 13 + .../dist/util/stripComments.js | 21 + .../dist/util/unesc.js | 76 + .../postcss-selector-parser/package.json | 80 + .../npm/node_modules/proc-log/LICENSE | 15 + .../npm/node_modules/proc-log/lib/index.js | 153 + .../npm/node_modules/proc-log/package.json | 46 + node_modules/npm/node_modules/proggy/LICENSE | 15 + .../npm/node_modules/proggy/lib/client.js | 114 + .../npm/node_modules/proggy/lib/index.js | 15 + .../npm/node_modules/proggy/lib/tracker.js | 68 + .../npm/node_modules/proggy/package.json | 50 + .../promise-all-reject-late/LICENSE | 15 + .../promise-all-reject-late/index.js | 27 + .../promise-all-reject-late/package.json | 22 + .../promise-all-reject-late/test/index.js | 88 + .../node_modules/promise-call-limit/LICENSE | 15 + .../promise-call-limit/dist/commonjs/index.js | 87 + .../dist/commonjs/package.json | 3 + .../promise-call-limit/dist/esm/index.js | 60 + .../promise-call-limit/dist/esm/package.json | 3 + .../promise-call-limit/package.json | 68 + .../npm/node_modules/promise-inflight/LICENSE | 14 + .../node_modules/promise-inflight/inflight.js | 36 + .../promise-inflight/package.json | 24 + .../npm/node_modules/promise-retry/LICENSE | 19 + .../npm/node_modules/promise-retry/index.js | 52 + .../node_modules/promise-retry/package.json | 37 + .../node_modules/promise-retry/test/test.js | 263 + .../npm/node_modules/promzard/LICENSE | 15 + .../npm/node_modules/promzard/lib/index.js | 176 + .../npm/node_modules/promzard/package.json | 50 + .../node_modules/qrcode-terminal/.travis.yml | 3 + .../npm/node_modules/qrcode-terminal/LICENSE | 222 + .../node_modules/qrcode-terminal/README.md | 82 + .../qrcode-terminal/bin/qrcode-terminal.js | 101 + .../qrcode-terminal/example/basic.js | 2 + .../qrcode-terminal/example/basic.png | Bin 0 -> 46426 bytes .../qrcode-terminal/example/callback.js | 4 + .../qrcode-terminal/example/small-qrcode.js | 6 + .../node_modules/qrcode-terminal/lib/main.js | 100 + .../node_modules/qrcode-terminal/package.json | 37 + .../node_modules/qrcode-terminal/test/main.js | 63 + .../vendor/QRCode/QR8bitByte.js | 22 + .../vendor/QRCode/QRBitBuffer.js | 38 + .../vendor/QRCode/QRErrorCorrectLevel.js | 7 + .../vendor/QRCode/QRMaskPattern.js | 10 + .../qrcode-terminal/vendor/QRCode/QRMath.js | 44 + .../qrcode-terminal/vendor/QRCode/QRMode.js | 6 + .../vendor/QRCode/QRPolynomial.js | 66 + .../vendor/QRCode/QRRSBlock.js | 298 + .../qrcode-terminal/vendor/QRCode/QRUtil.js | 272 + .../qrcode-terminal/vendor/QRCode/index.js | 462 + .../npm/node_modules/read-cmd-shim/LICENSE | 14 + .../node_modules/read-cmd-shim/lib/index.js | 75 + .../node_modules/read-cmd-shim/package.json | 48 + .../read-package-json-fast/LICENSE | 15 + .../read-package-json-fast/lib/index.js | 141 + .../read-package-json-fast/package.json | 49 + node_modules/npm/node_modules/read/LICENSE | 15 + .../read/dist/commonjs/package.json | 3 + .../node_modules/read/dist/commonjs/read.js | 94 + .../node_modules/read/dist/esm/package.json | 3 + .../npm/node_modules/read/dist/esm/read.js | 88 + .../npm/node_modules/read/package.json | 88 + node_modules/npm/node_modules/retry/License | 21 + node_modules/npm/node_modules/retry/Makefile | 18 + .../npm/node_modules/retry/equation.gif | Bin 0 -> 1209 bytes .../npm/node_modules/retry/example/dns.js | 31 + .../npm/node_modules/retry/example/stop.js | 40 + node_modules/npm/node_modules/retry/index.js | 1 + .../npm/node_modules/retry/lib/retry.js | 100 + .../node_modules/retry/lib/retry_operation.js | 158 + .../npm/node_modules/retry/package.json | 32 + .../npm/node_modules/retry/test/common.js | 10 + .../retry/test/integration/test-forever.js | 24 + .../test/integration/test-retry-operation.js | 258 + .../retry/test/integration/test-retry-wrap.js | 101 + .../retry/test/integration/test-timeouts.js | 69 + node_modules/npm/node_modules/rimraf/LICENSE | 15 + .../npm/node_modules/rimraf/README.md | 220 + .../rimraf/dist/commonjs/default-tmp.d.ts | 3 + .../rimraf/dist/commonjs/default-tmp.d.ts.map | 1 + .../rimraf/dist/commonjs/default-tmp.js | 61 + .../rimraf/dist/commonjs/default-tmp.js.map | 1 + .../rimraf/dist/commonjs/fix-eperm.d.ts | 3 + .../rimraf/dist/commonjs/fix-eperm.d.ts.map | 1 + .../rimraf/dist/commonjs/fix-eperm.js | 58 + .../rimraf/dist/commonjs/fix-eperm.js.map | 1 + .../node_modules/rimraf/dist/commonjs/fs.d.ts | 17 + .../rimraf/dist/commonjs/fs.d.ts.map | 1 + .../node_modules/rimraf/dist/commonjs/fs.js | 46 + .../rimraf/dist/commonjs/fs.js.map | 1 + .../rimraf/dist/commonjs/ignore-enoent.d.ts | 3 + .../dist/commonjs/ignore-enoent.d.ts.map | 1 + .../rimraf/dist/commonjs/ignore-enoent.js | 21 + .../rimraf/dist/commonjs/ignore-enoent.js.map | 1 + .../rimraf/dist/commonjs/index.d.ts | 50 + .../rimraf/dist/commonjs/index.d.ts.map | 1 + .../rimraf/dist/commonjs/index.js | 78 + .../rimraf/dist/commonjs/index.js.map | 1 + .../rimraf/dist/commonjs/opt-arg.d.ts | 34 + .../rimraf/dist/commonjs/opt-arg.d.ts.map | 1 + .../rimraf/dist/commonjs/opt-arg.js | 53 + .../rimraf/dist/commonjs/opt-arg.js.map | 1 + .../rimraf/dist/commonjs/package.json | 3 + .../rimraf/dist/commonjs/path-arg.d.ts | 4 + .../rimraf/dist/commonjs/path-arg.d.ts.map | 1 + .../rimraf/dist/commonjs/path-arg.js | 52 + .../rimraf/dist/commonjs/path-arg.js.map | 1 + .../rimraf/dist/commonjs/platform.d.ts | 3 + .../rimraf/dist/commonjs/platform.d.ts.map | 1 + .../rimraf/dist/commonjs/platform.js | 4 + .../rimraf/dist/commonjs/platform.js.map | 1 + .../dist/commonjs/readdir-or-error.d.ts | 3 + .../dist/commonjs/readdir-or-error.d.ts.map | 1 + .../rimraf/dist/commonjs/readdir-or-error.js | 19 + .../dist/commonjs/readdir-or-error.js.map | 1 + .../rimraf/dist/commonjs/retry-busy.d.ts | 8 + .../rimraf/dist/commonjs/retry-busy.d.ts.map | 1 + .../rimraf/dist/commonjs/retry-busy.js | 68 + .../rimraf/dist/commonjs/retry-busy.js.map | 1 + .../rimraf/dist/commonjs/rimraf-manual.d.ts | 3 + .../dist/commonjs/rimraf-manual.d.ts.map | 1 + .../rimraf/dist/commonjs/rimraf-manual.js | 12 + .../rimraf/dist/commonjs/rimraf-manual.js.map | 1 + .../dist/commonjs/rimraf-move-remove.d.ts | 4 + .../dist/commonjs/rimraf-move-remove.d.ts.map | 1 + .../dist/commonjs/rimraf-move-remove.js | 192 + .../dist/commonjs/rimraf-move-remove.js.map | 1 + .../rimraf/dist/commonjs/rimraf-native.d.ts | 4 + .../dist/commonjs/rimraf-native.d.ts.map | 1 + .../rimraf/dist/commonjs/rimraf-native.js | 24 + .../rimraf/dist/commonjs/rimraf-native.js.map | 1 + .../rimraf/dist/commonjs/rimraf-posix.d.ts | 4 + .../dist/commonjs/rimraf-posix.d.ts.map | 1 + .../rimraf/dist/commonjs/rimraf-posix.js | 123 + .../rimraf/dist/commonjs/rimraf-posix.js.map | 1 + .../rimraf/dist/commonjs/rimraf-windows.d.ts | 4 + .../dist/commonjs/rimraf-windows.d.ts.map | 1 + .../rimraf/dist/commonjs/rimraf-windows.js | 182 + .../dist/commonjs/rimraf-windows.js.map | 1 + .../rimraf/dist/commonjs/use-native.d.ts | 4 + .../rimraf/dist/commonjs/use-native.d.ts.map | 1 + .../rimraf/dist/commonjs/use-native.js | 22 + .../rimraf/dist/commonjs/use-native.js.map | 1 + .../node_modules/rimraf/dist/esm/bin.d.mts | 8 + .../rimraf/dist/esm/bin.d.mts.map | 1 + .../npm/node_modules/rimraf/dist/esm/bin.mjs | 256 + .../node_modules/rimraf/dist/esm/bin.mjs.map | 1 + .../rimraf/dist/esm/default-tmp.d.ts | 3 + .../rimraf/dist/esm/default-tmp.d.ts.map | 1 + .../rimraf/dist/esm/default-tmp.js | 55 + .../rimraf/dist/esm/default-tmp.js.map | 1 + .../rimraf/dist/esm/fix-eperm.d.ts | 3 + .../rimraf/dist/esm/fix-eperm.d.ts.map | 1 + .../node_modules/rimraf/dist/esm/fix-eperm.js | 53 + .../rimraf/dist/esm/fix-eperm.js.map | 1 + .../npm/node_modules/rimraf/dist/esm/fs.d.ts | 17 + .../node_modules/rimraf/dist/esm/fs.d.ts.map | 1 + .../npm/node_modules/rimraf/dist/esm/fs.js | 31 + .../node_modules/rimraf/dist/esm/fs.js.map | 1 + .../rimraf/dist/esm/ignore-enoent.d.ts | 3 + .../rimraf/dist/esm/ignore-enoent.d.ts.map | 1 + .../rimraf/dist/esm/ignore-enoent.js | 16 + .../rimraf/dist/esm/ignore-enoent.js.map | 1 + .../node_modules/rimraf/dist/esm/index.d.ts | 50 + .../rimraf/dist/esm/index.d.ts.map | 1 + .../npm/node_modules/rimraf/dist/esm/index.js | 70 + .../node_modules/rimraf/dist/esm/index.js.map | 1 + .../node_modules/rimraf/dist/esm/opt-arg.d.ts | 34 + .../rimraf/dist/esm/opt-arg.d.ts.map | 1 + .../node_modules/rimraf/dist/esm/opt-arg.js | 46 + .../rimraf/dist/esm/opt-arg.js.map | 1 + .../node_modules/rimraf/dist/esm/package.json | 3 + .../rimraf/dist/esm/path-arg.d.ts | 4 + .../rimraf/dist/esm/path-arg.d.ts.map | 1 + .../node_modules/rimraf/dist/esm/path-arg.js | 47 + .../rimraf/dist/esm/path-arg.js.map | 1 + .../rimraf/dist/esm/platform.d.ts | 3 + .../rimraf/dist/esm/platform.d.ts.map | 1 + .../node_modules/rimraf/dist/esm/platform.js | 2 + .../rimraf/dist/esm/platform.js.map | 1 + .../rimraf/dist/esm/readdir-or-error.d.ts | 3 + .../rimraf/dist/esm/readdir-or-error.d.ts.map | 1 + .../rimraf/dist/esm/readdir-or-error.js | 14 + .../rimraf/dist/esm/readdir-or-error.js.map | 1 + .../rimraf/dist/esm/retry-busy.d.ts | 8 + .../rimraf/dist/esm/retry-busy.d.ts.map | 1 + .../rimraf/dist/esm/retry-busy.js | 63 + .../rimraf/dist/esm/retry-busy.js.map | 1 + .../rimraf/dist/esm/rimraf-manual.d.ts | 3 + .../rimraf/dist/esm/rimraf-manual.d.ts.map | 1 + .../rimraf/dist/esm/rimraf-manual.js | 6 + .../rimraf/dist/esm/rimraf-manual.js.map | 1 + .../rimraf/dist/esm/rimraf-move-remove.d.ts | 4 + .../dist/esm/rimraf-move-remove.d.ts.map | 1 + .../rimraf/dist/esm/rimraf-move-remove.js | 187 + .../rimraf/dist/esm/rimraf-move-remove.js.map | 1 + .../rimraf/dist/esm/rimraf-native.d.ts | 4 + .../rimraf/dist/esm/rimraf-native.d.ts.map | 1 + .../rimraf/dist/esm/rimraf-native.js | 19 + .../rimraf/dist/esm/rimraf-native.js.map | 1 + .../rimraf/dist/esm/rimraf-posix.d.ts | 4 + .../rimraf/dist/esm/rimraf-posix.d.ts.map | 1 + .../rimraf/dist/esm/rimraf-posix.js | 118 + .../rimraf/dist/esm/rimraf-posix.js.map | 1 + .../rimraf/dist/esm/rimraf-windows.d.ts | 4 + .../rimraf/dist/esm/rimraf-windows.d.ts.map | 1 + .../rimraf/dist/esm/rimraf-windows.js | 177 + .../rimraf/dist/esm/rimraf-windows.js.map | 1 + .../rimraf/dist/esm/use-native.d.ts | 4 + .../rimraf/dist/esm/use-native.d.ts.map | 1 + .../rimraf/dist/esm/use-native.js | 16 + .../rimraf/dist/esm/use-native.js.map | 1 + .../npm/node_modules/rimraf/package.json | 89 + .../npm/node_modules/safer-buffer/LICENSE | 21 + .../safer-buffer/Porting-Buffer.md | 268 + .../node_modules/safer-buffer/dangerous.js | 58 + .../node_modules/safer-buffer/package.json | 34 + .../npm/node_modules/safer-buffer/safer.js | 77 + .../npm/node_modules/safer-buffer/tests.js | 406 + node_modules/npm/node_modules/semver/LICENSE | 15 + .../npm/node_modules/semver/README.md | 654 ++ .../npm/node_modules/semver/bin/semver.js | 188 + .../node_modules/semver/classes/comparator.js | 141 + .../npm/node_modules/semver/classes/index.js | 5 + .../npm/node_modules/semver/classes/range.js | 554 ++ .../npm/node_modules/semver/classes/semver.js | 302 + .../node_modules/semver/functions/clean.js | 6 + .../npm/node_modules/semver/functions/cmp.js | 52 + .../node_modules/semver/functions/coerce.js | 60 + .../semver/functions/compare-build.js | 7 + .../semver/functions/compare-loose.js | 3 + .../node_modules/semver/functions/compare.js | 5 + .../npm/node_modules/semver/functions/diff.js | 65 + .../npm/node_modules/semver/functions/eq.js | 3 + .../npm/node_modules/semver/functions/gt.js | 3 + .../npm/node_modules/semver/functions/gte.js | 3 + .../npm/node_modules/semver/functions/inc.js | 19 + .../npm/node_modules/semver/functions/lt.js | 3 + .../npm/node_modules/semver/functions/lte.js | 3 + .../node_modules/semver/functions/major.js | 3 + .../node_modules/semver/functions/minor.js | 3 + .../npm/node_modules/semver/functions/neq.js | 3 + .../node_modules/semver/functions/parse.js | 16 + .../node_modules/semver/functions/patch.js | 3 + .../semver/functions/prerelease.js | 6 + .../node_modules/semver/functions/rcompare.js | 3 + .../node_modules/semver/functions/rsort.js | 3 + .../semver/functions/satisfies.js | 10 + .../npm/node_modules/semver/functions/sort.js | 3 + .../node_modules/semver/functions/valid.js | 6 + node_modules/npm/node_modules/semver/index.js | 89 + .../node_modules/semver/internal/constants.js | 35 + .../npm/node_modules/semver/internal/debug.js | 9 + .../semver/internal/identifiers.js | 23 + .../node_modules/semver/internal/lrucache.js | 40 + .../semver/internal/parse-options.js | 15 + .../npm/node_modules/semver/internal/re.js | 217 + .../npm/node_modules/semver/package.json | 77 + .../npm/node_modules/semver/preload.js | 2 + .../npm/node_modules/semver/range.bnf | 16 + .../npm/node_modules/semver/ranges/gtr.js | 4 + .../node_modules/semver/ranges/intersects.js | 7 + .../npm/node_modules/semver/ranges/ltr.js | 4 + .../semver/ranges/max-satisfying.js | 25 + .../semver/ranges/min-satisfying.js | 24 + .../node_modules/semver/ranges/min-version.js | 61 + .../npm/node_modules/semver/ranges/outside.js | 80 + .../node_modules/semver/ranges/simplify.js | 47 + .../npm/node_modules/semver/ranges/subset.js | 247 + .../semver/ranges/to-comparators.js | 8 + .../npm/node_modules/semver/ranges/valid.js | 11 + .../npm/node_modules/shebang-command/index.js | 19 + .../npm/node_modules/shebang-command/license | 9 + .../node_modules/shebang-command/package.json | 34 + .../npm/node_modules/shebang-regex/index.js | 2 + .../npm/node_modules/shebang-regex/license | 9 + .../node_modules/shebang-regex/package.json | 35 + .../npm/node_modules/signal-exit/LICENSE.txt | 16 + .../signal-exit/dist/cjs/browser.js | 10 + .../signal-exit/dist/cjs/index.js | 279 + .../signal-exit/dist/cjs/package.json | 3 + .../signal-exit/dist/cjs/signals.js | 42 + .../signal-exit/dist/mjs/browser.js | 4 + .../signal-exit/dist/mjs/index.js | 275 + .../signal-exit/dist/mjs/package.json | 3 + .../signal-exit/dist/mjs/signals.js | 39 + .../npm/node_modules/signal-exit/package.json | 106 + .../npm/node_modules/sigstore/LICENSE | 202 + .../npm/node_modules/sigstore/dist/config.js | 120 + .../npm/node_modules/sigstore/dist/index.js | 34 + .../node_modules/sigstore/dist/sigstore.js | 102 + .../npm/node_modules/sigstore/package.json | 47 + .../npm/node_modules/smart-buffer/LICENSE | 20 + .../smart-buffer/build/smartbuffer.js | 1233 +++ .../node_modules/smart-buffer/build/utils.js | 108 + .../node_modules/smart-buffer/docs/ROADMAP.md | 0 .../node_modules/smart-buffer/package.json | 79 + .../node_modules/socks-proxy-agent/LICENSE | 22 + .../socks-proxy-agent/dist/index.js | 195 + .../socks-proxy-agent/package.json | 142 + node_modules/npm/node_modules/socks/LICENSE | 20 + .../socks/build/client/socksclient.js | 793 ++ .../socks/build/common/constants.js | 108 + .../socks/build/common/helpers.js | 166 + .../socks/build/common/receivebuffer.js | 43 + .../node_modules/socks/build/common/util.js | 25 + .../npm/node_modules/socks/build/index.js | 18 + .../node_modules/socks/docs/examples/index.md | 17 + .../examples/javascript/associateExample.md | 90 + .../docs/examples/javascript/bindExample.md | 83 + .../examples/javascript/connectExample.md | 258 + .../examples/typescript/associateExample.md | 93 + .../docs/examples/typescript/bindExample.md | 86 + .../examples/typescript/connectExample.md | 265 + .../npm/node_modules/socks/docs/index.md | 5 + .../socks/docs/migratingFromV1.md | 86 + .../npm/node_modules/socks/package.json | 58 + .../npm/node_modules/spdx-correct/LICENSE | 202 + .../npm/node_modules/spdx-correct/index.js | 386 + .../spdx-expression-parse/AUTHORS | 4 + .../spdx-expression-parse/LICENSE | 22 + .../spdx-expression-parse/index.js | 8 + .../spdx-expression-parse/package.json | 39 + .../spdx-expression-parse/parse.js | 138 + .../spdx-expression-parse/scan.js | 131 + .../node_modules/spdx-correct/package.json | 32 + .../spdx-exceptions/deprecated.json | 3 + .../node_modules/spdx-exceptions/index.json | 68 + .../node_modules/spdx-exceptions/package.json | 19 + .../spdx-expression-parse/AUTHORS | 4 + .../spdx-expression-parse/LICENSE | 22 + .../spdx-expression-parse/index.js | 8 + .../spdx-expression-parse/package.json | 39 + .../spdx-expression-parse/parse.js | 138 + .../spdx-expression-parse/scan.js | 131 + .../spdx-license-ids/deprecated.json | 28 + .../node_modules/spdx-license-ids/index.json | 636 ++ .../spdx-license-ids/package.json | 39 + .../node_modules/sprintf-js/CONTRIBUTORS.md | 26 + .../npm/node_modules/sprintf-js/LICENSE | 24 + .../sprintf-js/dist/.gitattributes | 4 + .../sprintf-js/dist/angular-sprintf.min.js | 3 + .../sprintf-js/dist/sprintf.min.js | 3 + .../npm/node_modules/sprintf-js/package.json | 35 + .../sprintf-js/src/angular-sprintf.js | 24 + .../node_modules/sprintf-js/src/sprintf.js | 231 + node_modules/npm/node_modules/ssri/LICENSE.md | 16 + .../npm/node_modules/ssri/lib/index.js | 580 ++ .../npm/node_modules/ssri/package.json | 66 + .../node_modules/string-width-cjs/index.js | 47 + .../npm/node_modules/string-width-cjs/license | 9 + .../string-width-cjs/package.json | 56 + .../npm/node_modules/string-width/index.js | 47 + .../npm/node_modules/string-width/license | 9 + .../node_modules/string-width/package.json | 56 + .../npm/node_modules/strip-ansi-cjs/index.js | 4 + .../npm/node_modules/strip-ansi-cjs/license | 9 + .../node_modules/strip-ansi-cjs/package.json | 54 + .../npm/node_modules/strip-ansi/index.js | 4 + .../npm/node_modules/strip-ansi/license | 9 + .../npm/node_modules/strip-ansi/package.json | 54 + .../node_modules/supports-color/browser.js | 30 + .../npm/node_modules/supports-color/index.js | 182 + .../npm/node_modules/supports-color/license | 9 + .../node_modules/supports-color/package.json | 60 + node_modules/npm/node_modules/tar/LICENSE | 15 + node_modules/npm/node_modules/tar/index.js | 18 + .../npm/node_modules/tar/lib/create.js | 111 + .../npm/node_modules/tar/lib/extract.js | 113 + .../node_modules/tar/lib/get-write-flag.js | 20 + .../npm/node_modules/tar/lib/header.js | 304 + .../node_modules/tar/lib/high-level-opt.js | 29 + .../npm/node_modules/tar/lib/large-numbers.js | 104 + node_modules/npm/node_modules/tar/lib/list.js | 139 + .../npm/node_modules/tar/lib/mkdir.js | 229 + .../npm/node_modules/tar/lib/mode-fix.js | 27 + .../node_modules/tar/lib/normalize-unicode.js | 12 + .../tar/lib/normalize-windows-path.js | 8 + node_modules/npm/node_modules/tar/lib/pack.js | 432 + .../npm/node_modules/tar/lib/parse.js | 552 ++ .../node_modules/tar/lib/path-reservations.js | 156 + node_modules/npm/node_modules/tar/lib/pax.js | 150 + .../npm/node_modules/tar/lib/read-entry.js | 107 + .../npm/node_modules/tar/lib/replace.js | 246 + .../tar/lib/strip-absolute-path.js | 24 + .../tar/lib/strip-trailing-slashes.js | 13 + .../npm/node_modules/tar/lib/types.js | 44 + .../npm/node_modules/tar/lib/unpack.js | 923 ++ .../npm/node_modules/tar/lib/update.js | 40 + .../npm/node_modules/tar/lib/warn-mixin.js | 24 + .../npm/node_modules/tar/lib/winchars.js | 23 + .../npm/node_modules/tar/lib/write-entry.js | 546 ++ .../tar/node_modules/fs-minipass/LICENSE | 15 + .../tar/node_modules/fs-minipass/index.js | 422 + .../fs-minipass/node_modules/minipass/LICENSE | 15 + .../node_modules/minipass/index.js | 649 ++ .../node_modules/minipass/package.json | 56 + .../tar/node_modules/fs-minipass/package.json | 39 + .../tar/node_modules/minipass/LICENSE | 15 + .../tar/node_modules/minipass/index.js | 702 ++ .../tar/node_modules/minipass/index.mjs | 702 ++ .../tar/node_modules/minipass/package.json | 76 + .../npm/node_modules/tar/package.json | 70 + .../npm/node_modules/text-table/LICENSE | 18 + .../node_modules/text-table/example/align.js | 8 + .../node_modules/text-table/example/center.js | 8 + .../text-table/example/dotalign.js | 9 + .../text-table/example/doubledot.js | 11 + .../node_modules/text-table/example/table.js | 6 + .../npm/node_modules/text-table/index.js | 86 + .../npm/node_modules/text-table/package.json | 44 + .../npm/node_modules/text-table/test/align.js | 18 + .../text-table/test/ansi-colors.js | 32 + .../node_modules/text-table/test/center.js | 18 + .../node_modules/text-table/test/dotalign.js | 20 + .../node_modules/text-table/test/doubledot.js | 24 + .../npm/node_modules/text-table/test/table.js | 14 + .../tiny-relative-date/LICENSE.md | 21 + .../tiny-relative-date/lib/factory.js | 100 + .../tiny-relative-date/lib/index.js | 18 + .../tiny-relative-date/package.json | 39 + .../tiny-relative-date/src/factory.js | 89 + .../tiny-relative-date/src/index.js | 4 + .../tiny-relative-date/translations/da.js | 31 + .../tiny-relative-date/translations/de.js | 31 + .../translations/en-short.js | 31 + .../tiny-relative-date/translations/en.js | 31 + .../tiny-relative-date/translations/es.js | 31 + .../npm/node_modules/treeverse/LICENSE | 15 + .../npm/node_modules/treeverse/lib/breadth.js | 67 + .../treeverse/lib/depth-descent.js | 88 + .../npm/node_modules/treeverse/lib/depth.js | 76 + .../npm/node_modules/treeverse/lib/index.js | 4 + .../npm/node_modules/treeverse/package.json | 51 + node_modules/npm/node_modules/tuf-js/LICENSE | 21 + .../npm/node_modules/tuf-js/dist/config.js | 15 + .../npm/node_modules/tuf-js/dist/error.js | 48 + .../npm/node_modules/tuf-js/dist/fetcher.js | 84 + .../npm/node_modules/tuf-js/dist/index.js | 9 + .../npm/node_modules/tuf-js/dist/store.js | 208 + .../npm/node_modules/tuf-js/dist/updater.js | 350 + .../node_modules/tuf-js/dist/utils/tmpfile.js | 25 + .../npm/node_modules/tuf-js/dist/utils/url.js | 13 + .../npm/node_modules/tuf-js/package.json | 43 + .../npm/node_modules/unique-filename/LICENSE | 5 + .../node_modules/unique-filename/lib/index.js | 7 + .../node_modules/unique-filename/package.json | 53 + .../npm/node_modules/unique-slug/LICENSE | 15 + .../npm/node_modules/unique-slug/lib/index.js | 11 + .../npm/node_modules/unique-slug/package.json | 49 + .../node_modules/util-deprecate/History.md | 16 + .../npm/node_modules/util-deprecate/LICENSE | 24 + .../node_modules/util-deprecate/browser.js | 67 + .../npm/node_modules/util-deprecate/node.js | 6 + .../node_modules/util-deprecate/package.json | 27 + .../validate-npm-package-license/LICENSE | 202 + .../validate-npm-package-license/index.js | 86 + .../spdx-expression-parse/AUTHORS | 4 + .../spdx-expression-parse/LICENSE | 22 + .../spdx-expression-parse/index.js | 8 + .../spdx-expression-parse/package.json | 39 + .../spdx-expression-parse/parse.js | 138 + .../spdx-expression-parse/scan.js | 131 + .../validate-npm-package-license/package.json | 28 + .../validate-npm-package-name/LICENSE | 6 + .../validate-npm-package-name/lib/index.js | 105 + .../validate-npm-package-name/package.json | 61 + .../npm/node_modules/walk-up-path/LICENSE | 15 + .../walk-up-path/dist/commonjs/index.js | 18 + .../walk-up-path/dist/commonjs/package.json | 3 + .../walk-up-path/dist/esm/index.js | 14 + .../walk-up-path/dist/esm/package.json | 3 + .../node_modules/walk-up-path/package.json | 71 + node_modules/npm/node_modules/which/LICENSE | 15 + node_modules/npm/node_modules/which/README.md | 51 + .../npm/node_modules/which/bin/which.js | 52 + .../npm/node_modules/which/lib/index.js | 111 + .../which/node_modules/isexe/LICENSE | 15 + .../node_modules/isexe/dist/cjs/index.js | 46 + .../node_modules/isexe/dist/cjs/options.js | 3 + .../node_modules/isexe/dist/cjs/package.json | 3 + .../node_modules/isexe/dist/cjs/posix.js | 67 + .../node_modules/isexe/dist/cjs/win32.js | 62 + .../node_modules/isexe/dist/mjs/index.js | 16 + .../node_modules/isexe/dist/mjs/options.js | 2 + .../node_modules/isexe/dist/mjs/package.json | 3 + .../node_modules/isexe/dist/mjs/posix.js | 62 + .../node_modules/isexe/dist/mjs/win32.js | 57 + .../which/node_modules/isexe/package.json | 96 + .../npm/node_modules/which/package.json | 52 + .../npm/node_modules/wrap-ansi-cjs/index.js | 216 + .../npm/node_modules/wrap-ansi-cjs/license | 9 + .../node_modules/ansi-styles/index.js | 163 + .../node_modules/ansi-styles/license | 9 + .../node_modules/ansi-styles/package.json | 56 + .../node_modules/wrap-ansi-cjs/package.json | 62 + .../npm/node_modules/wrap-ansi/index.js | 214 + .../npm/node_modules/wrap-ansi/license | 9 + .../node_modules/ansi-regex/index.js | 10 + .../wrap-ansi/node_modules/ansi-regex/license | 9 + .../node_modules/ansi-regex/package.json | 61 + .../node_modules/emoji-regex/LICENSE-MIT.txt | 20 + .../node_modules/emoji-regex/RGI_Emoji.js | 6 + .../emoji-regex/es2015/RGI_Emoji.js | 6 + .../node_modules/emoji-regex/es2015/index.js | 6 + .../node_modules/emoji-regex/es2015/text.js | 6 + .../node_modules/emoji-regex/index.js | 6 + .../node_modules/emoji-regex/package.json | 52 + .../node_modules/emoji-regex/text.js | 6 + .../node_modules/string-width/index.js | 54 + .../node_modules/string-width/license | 9 + .../node_modules/string-width/package.json | 59 + .../node_modules/strip-ansi/index.js | 14 + .../wrap-ansi/node_modules/strip-ansi/license | 9 + .../node_modules/strip-ansi/package.json | 57 + .../npm/node_modules/wrap-ansi/package.json | 69 + .../node_modules/write-file-atomic/LICENSE.md | 6 + .../write-file-atomic/lib/index.js | 267 + .../write-file-atomic/package.json | 58 + node_modules/npm/node_modules/yallist/LICENSE | 15 + .../npm/node_modules/yallist/iterator.js | 8 + .../npm/node_modules/yallist/package.json | 29 + .../npm/node_modules/yallist/yallist.js | 426 + node_modules/npm/package.json | 260 + node_modules/object-assign/index.js | 90 + node_modules/object-assign/license | 21 + node_modules/object-assign/package.json | 42 + node_modules/object-assign/readme.md | 61 + node_modules/object-hash/LICENSE | 22 + node_modules/object-hash/dist/object_hash.js | 1 + node_modules/object-hash/index.js | 453 + node_modules/object-hash/package.json | 53 + node_modules/object-hash/readme.markdown | 198 + node_modules/once/LICENSE | 15 + node_modules/once/README.md | 79 + node_modules/once/once.js | 42 + node_modules/once/package.json | 33 + node_modules/p-limit/index.d.ts | 38 + node_modules/p-limit/index.js | 57 + node_modules/p-limit/license | 9 + node_modules/p-limit/package.json | 52 + node_modules/p-limit/readme.md | 101 + node_modules/p-locate/index.d.ts | 64 + node_modules/p-locate/index.js | 52 + node_modules/p-locate/license | 9 + node_modules/p-locate/package.json | 53 + node_modules/p-locate/readme.md | 90 + node_modules/p-try/index.d.ts | 39 + node_modules/p-try/index.js | 9 + node_modules/p-try/license | 9 + node_modules/p-try/package.json | 42 + node_modules/p-try/readme.md | 58 + node_modules/path-exists/index.d.ts | 28 + node_modules/path-exists/index.js | 23 + node_modules/path-exists/license | 9 + node_modules/path-exists/package.json | 39 + node_modules/path-exists/readme.md | 52 + 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/path-is-absolute/readme.md | 59 + node_modules/path-key/index.d.ts | 40 + node_modules/path-key/index.js | 16 + node_modules/path-key/license | 9 + node_modules/path-key/package.json | 39 + node_modules/path-key/readme.md | 61 + node_modules/path-parse/LICENSE | 21 + node_modules/path-parse/README.md | 42 + node_modules/path-parse/index.js | 75 + node_modules/path-parse/package.json | 33 + node_modules/path-scurry/LICENSE.md | 55 + node_modules/path-scurry/README.md | 636 ++ .../path-scurry/dist/commonjs/index.d.ts | 1116 +++ .../path-scurry/dist/commonjs/index.d.ts.map | 1 + .../path-scurry/dist/commonjs/index.js | 2014 ++++ .../path-scurry/dist/commonjs/index.js.map | 1 + .../path-scurry/dist/commonjs/package.json | 3 + node_modules/path-scurry/dist/esm/index.d.ts | 1116 +++ .../path-scurry/dist/esm/index.d.ts.map | 1 + node_modules/path-scurry/dist/esm/index.js | 1979 ++++ .../path-scurry/dist/esm/index.js.map | 1 + .../path-scurry/dist/esm/package.json | 3 + node_modules/path-scurry/package.json | 89 + node_modules/picocolors/LICENSE | 15 + node_modules/picocolors/README.md | 21 + node_modules/picocolors/package.json | 25 + node_modules/picocolors/picocolors.browser.js | 4 + node_modules/picocolors/picocolors.d.ts | 5 + node_modules/picocolors/picocolors.js | 75 + node_modules/picocolors/types.d.ts | 51 + node_modules/picomatch/CHANGELOG.md | 136 + node_modules/picomatch/LICENSE | 21 + node_modules/picomatch/README.md | 708 ++ node_modules/picomatch/index.js | 3 + node_modules/picomatch/lib/constants.js | 179 + node_modules/picomatch/lib/parse.js | 1091 +++ node_modules/picomatch/lib/picomatch.js | 342 + node_modules/picomatch/lib/scan.js | 391 + node_modules/picomatch/lib/utils.js | 64 + node_modules/picomatch/package.json | 81 + node_modules/pify/index.js | 68 + node_modules/pify/license | 21 + node_modules/pify/package.json | 48 + node_modules/pify/readme.md | 119 + node_modules/pirates/LICENSE | 21 + node_modules/pirates/README.md | 69 + node_modules/pirates/index.d.ts | 82 + node_modules/pirates/lib/index.js | 139 + node_modules/pirates/package.json | 74 + node_modules/pkg-dir/index.d.ts | 44 + node_modules/pkg-dir/index.js | 17 + node_modules/pkg-dir/license | 9 + node_modules/pkg-dir/package.json | 56 + node_modules/pkg-dir/readme.md | 66 + node_modules/postcss-import/LICENSE | 20 + node_modules/postcss-import/README.md | 244 + node_modules/postcss-import/index.js | 420 + .../postcss-import/lib/assign-layer-names.js | 17 + node_modules/postcss-import/lib/data-url.js | 17 + node_modules/postcss-import/lib/join-layer.js | 9 + node_modules/postcss-import/lib/join-media.js | 28 + .../postcss-import/lib/load-content.js | 12 + .../postcss-import/lib/parse-statements.js | 172 + .../postcss-import/lib/process-content.js | 59 + node_modules/postcss-import/lib/resolve-id.js | 42 + node_modules/postcss-import/package.json | 65 + node_modules/postcss-js/LICENSE | 20 + node_modules/postcss-js/README.md | 22 + node_modules/postcss-js/async.js | 15 + node_modules/postcss-js/index.js | 11 + node_modules/postcss-js/index.mjs | 8 + node_modules/postcss-js/objectifier.js | 85 + node_modules/postcss-js/package.json | 42 + node_modules/postcss-js/parser.js | 104 + node_modules/postcss-js/process-result.js | 11 + node_modules/postcss-js/sync.js | 12 + node_modules/postcss-value-parser/LICENSE | 22 + node_modules/postcss-value-parser/README.md | 263 + .../postcss-value-parser/lib/index.d.ts | 177 + .../postcss-value-parser/lib/index.js | 28 + .../postcss-value-parser/lib/parse.js | 321 + .../postcss-value-parser/lib/stringify.js | 48 + node_modules/postcss-value-parser/lib/unit.js | 120 + node_modules/postcss-value-parser/lib/walk.js | 22 + .../postcss-value-parser/package.json | 58 + node_modules/postcss/LICENSE | 20 + node_modules/postcss/README.md | 28 + node_modules/postcss/lib/at-rule.d.ts | 140 + node_modules/postcss/lib/at-rule.js | 25 + node_modules/postcss/lib/comment.d.ts | 68 + node_modules/postcss/lib/comment.js | 13 + node_modules/postcss/lib/container.d.ts | 483 + node_modules/postcss/lib/container.js | 447 + .../postcss/lib/css-syntax-error.d.ts | 248 + node_modules/postcss/lib/css-syntax-error.js | 133 + node_modules/postcss/lib/declaration.d.ts | 151 + node_modules/postcss/lib/declaration.js | 24 + node_modules/postcss/lib/document.d.ts | 69 + node_modules/postcss/lib/document.js | 33 + node_modules/postcss/lib/fromJSON.d.ts | 9 + node_modules/postcss/lib/fromJSON.js | 54 + node_modules/postcss/lib/input.d.ts | 197 + node_modules/postcss/lib/input.js | 248 + node_modules/postcss/lib/lazy-result.d.ts | 190 + node_modules/postcss/lib/lazy-result.js | 550 ++ node_modules/postcss/lib/list.d.ts | 60 + node_modules/postcss/lib/list.js | 58 + node_modules/postcss/lib/map-generator.js | 368 + node_modules/postcss/lib/no-work-result.d.ts | 46 + node_modules/postcss/lib/no-work-result.js | 138 + node_modules/postcss/lib/node.d.ts | 541 ++ node_modules/postcss/lib/node.js | 425 + node_modules/postcss/lib/parse.d.ts | 9 + node_modules/postcss/lib/parse.js | 42 + node_modules/postcss/lib/parser.js | 609 ++ node_modules/postcss/lib/postcss.d.mts | 69 + node_modules/postcss/lib/postcss.d.ts | 453 + node_modules/postcss/lib/postcss.js | 101 + node_modules/postcss/lib/postcss.mjs | 30 + node_modules/postcss/lib/previous-map.d.ts | 81 + node_modules/postcss/lib/previous-map.js | 144 + node_modules/postcss/lib/processor.d.ts | 115 + node_modules/postcss/lib/processor.js | 67 + node_modules/postcss/lib/result.d.ts | 205 + node_modules/postcss/lib/result.js | 42 + node_modules/postcss/lib/root.d.ts | 87 + node_modules/postcss/lib/root.js | 61 + node_modules/postcss/lib/rule.d.ts | 126 + node_modules/postcss/lib/rule.js | 27 + node_modules/postcss/lib/stringifier.d.ts | 46 + node_modules/postcss/lib/stringifier.js | 353 + node_modules/postcss/lib/stringify.d.ts | 9 + node_modules/postcss/lib/stringify.js | 11 + node_modules/postcss/lib/symbols.js | 5 + .../postcss/lib/terminal-highlight.js | 70 + node_modules/postcss/lib/tokenize.js | 266 + node_modules/postcss/lib/warn-once.js | 13 + node_modules/postcss/lib/warning.d.ts | 147 + node_modules/postcss/lib/warning.js | 37 + node_modules/postcss/package.json | 88 + node_modules/queue-microtask/LICENSE | 20 + node_modules/queue-microtask/README.md | 90 + node_modules/queue-microtask/index.d.ts | 2 + node_modules/queue-microtask/index.js | 9 + node_modules/queue-microtask/package.json | 55 + node_modules/read-cache/LICENSE | 20 + node_modules/read-cache/README.md | 46 + node_modules/read-cache/index.js | 78 + node_modules/read-cache/package.json | 34 + node_modules/resolve-from/index.d.ts | 31 + node_modules/resolve-from/index.js | 47 + node_modules/resolve-from/license | 9 + node_modules/resolve-from/package.json | 36 + node_modules/resolve-from/readme.md | 72 + node_modules/reusify/.coveralls.yml | 1 + node_modules/reusify/.travis.yml | 28 + node_modules/reusify/LICENSE | 22 + node_modules/reusify/README.md | 145 + .../benchmarks/createNoCodeFunction.js | 30 + node_modules/reusify/benchmarks/fib.js | 13 + .../reusify/benchmarks/reuseNoCodeFunction.js | 38 + node_modules/reusify/package.json | 45 + node_modules/reusify/reusify.js | 33 + node_modules/reusify/test.js | 66 + .../rimraf/node_modules/minimatch/LICENSE | 15 + .../rimraf/node_modules/minimatch/README.md | 454 + .../dist/commonjs/assert-valid-pattern.d.ts | 2 + .../commonjs/assert-valid-pattern.d.ts.map | 1 + .../dist/commonjs/assert-valid-pattern.js | 14 + .../dist/commonjs/assert-valid-pattern.js.map | 1 + .../minimatch/dist/commonjs/ast.d.ts | 20 + .../minimatch/dist/commonjs/ast.d.ts.map | 1 + .../minimatch/dist/commonjs/ast.js | 592 ++ .../minimatch/dist/commonjs/ast.js.map | 1 + .../dist/commonjs/brace-expressions.d.ts | 8 + .../dist/commonjs/brace-expressions.d.ts.map | 1 + .../dist/commonjs/brace-expressions.js | 152 + .../dist/commonjs/brace-expressions.js.map | 1 + .../minimatch/dist/commonjs/escape.d.ts | 12 + .../minimatch/dist/commonjs/escape.d.ts.map | 1 + .../minimatch/dist/commonjs/escape.js | 22 + .../minimatch/dist/commonjs/escape.js.map | 1 + .../minimatch/dist/commonjs/index.d.ts | 94 + .../minimatch/dist/commonjs/index.d.ts.map | 1 + .../minimatch/dist/commonjs/index.js | 1017 ++ .../minimatch/dist/commonjs/index.js.map | 1 + .../minimatch/dist/commonjs/package.json | 3 + .../minimatch/dist/commonjs/unescape.d.ts | 17 + .../minimatch/dist/commonjs/unescape.d.ts.map | 1 + .../minimatch/dist/commonjs/unescape.js | 24 + .../minimatch/dist/commonjs/unescape.js.map | 1 + .../dist/esm/assert-valid-pattern.d.ts | 2 + .../dist/esm/assert-valid-pattern.d.ts.map | 1 + .../dist/esm/assert-valid-pattern.js | 10 + .../dist/esm/assert-valid-pattern.js.map | 1 + .../node_modules/minimatch/dist/esm/ast.d.ts | 20 + .../minimatch/dist/esm/ast.d.ts.map | 1 + .../node_modules/minimatch/dist/esm/ast.js | 588 ++ .../minimatch/dist/esm/ast.js.map | 1 + .../minimatch/dist/esm/brace-expressions.d.ts | 8 + .../dist/esm/brace-expressions.d.ts.map | 1 + .../minimatch/dist/esm/brace-expressions.js | 148 + .../dist/esm/brace-expressions.js.map | 1 + .../minimatch/dist/esm/escape.d.ts | 12 + .../minimatch/dist/esm/escape.d.ts.map | 1 + .../node_modules/minimatch/dist/esm/escape.js | 18 + .../minimatch/dist/esm/escape.js.map | 1 + .../minimatch/dist/esm/index.d.ts | 94 + .../minimatch/dist/esm/index.d.ts.map | 1 + .../node_modules/minimatch/dist/esm/index.js | 1001 ++ .../minimatch/dist/esm/index.js.map | 1 + .../minimatch/dist/esm/package.json | 3 + .../minimatch/dist/esm/unescape.d.ts | 17 + .../minimatch/dist/esm/unescape.d.ts.map | 1 + .../minimatch/dist/esm/unescape.js | 20 + .../minimatch/dist/esm/unescape.js.map | 1 + .../node_modules/minimatch/package.json | 82 + node_modules/run-parallel/LICENSE | 20 + node_modules/run-parallel/README.md | 85 + node_modules/run-parallel/index.js | 51 + node_modules/run-parallel/package.json | 58 + node_modules/sade/index.d.ts | 37 + node_modules/sade/lib/index.js | 1 + node_modules/sade/lib/index.mjs | 1 + node_modules/sade/license | 21 + node_modules/sade/package.json | 45 + node_modules/sade/readme.md | 672 ++ node_modules/shebang-command/index.js | 19 + node_modules/shebang-command/license | 9 + node_modules/shebang-command/package.json | 34 + node_modules/shebang-command/readme.md | 34 + node_modules/shebang-regex/index.d.ts | 22 + node_modules/shebang-regex/index.js | 2 + node_modules/shebang-regex/license | 9 + node_modules/shebang-regex/package.json | 35 + node_modules/shebang-regex/readme.md | 33 + node_modules/signal-exit/LICENSE.txt | 16 + node_modules/signal-exit/README.md | 74 + .../signal-exit/dist/cjs/browser.d.ts | 12 + .../signal-exit/dist/cjs/browser.d.ts.map | 1 + node_modules/signal-exit/dist/cjs/browser.js | 10 + .../signal-exit/dist/cjs/browser.js.map | 1 + node_modules/signal-exit/dist/cjs/index.d.ts | 48 + .../signal-exit/dist/cjs/index.d.ts.map | 1 + node_modules/signal-exit/dist/cjs/index.js | 279 + .../signal-exit/dist/cjs/index.js.map | 1 + .../signal-exit/dist/cjs/package.json | 3 + .../signal-exit/dist/cjs/signals.d.ts | 29 + .../signal-exit/dist/cjs/signals.d.ts.map | 1 + node_modules/signal-exit/dist/cjs/signals.js | 42 + .../signal-exit/dist/cjs/signals.js.map | 1 + .../signal-exit/dist/mjs/browser.d.ts | 12 + .../signal-exit/dist/mjs/browser.d.ts.map | 1 + node_modules/signal-exit/dist/mjs/browser.js | 4 + .../signal-exit/dist/mjs/browser.js.map | 1 + node_modules/signal-exit/dist/mjs/index.d.ts | 48 + .../signal-exit/dist/mjs/index.d.ts.map | 1 + node_modules/signal-exit/dist/mjs/index.js | 275 + .../signal-exit/dist/mjs/index.js.map | 1 + .../signal-exit/dist/mjs/package.json | 3 + .../signal-exit/dist/mjs/signals.d.ts | 29 + .../signal-exit/dist/mjs/signals.d.ts.map | 1 + node_modules/signal-exit/dist/mjs/signals.js | 39 + .../signal-exit/dist/mjs/signals.js.map | 1 + node_modules/signal-exit/package.json | 106 + .../simple-icons-font/font/simple-icons.css | 4056 ++++++++ node_modules/sirv/build.js | 194 + node_modules/sirv/build.mjs | 194 + node_modules/sirv/index.d.mts | 29 + node_modules/sirv/index.d.ts | 33 + node_modules/sirv/package.json | 40 + node_modules/sirv/readme.md | 238 + node_modules/slash/index.d.ts | 25 + node_modules/slash/index.js | 11 + node_modules/slash/license | 9 + node_modules/slash/package.json | 35 + node_modules/slash/readme.md | 44 + node_modules/source-map-js/LICENSE | 28 + node_modules/source-map-js/README.md | 765 ++ node_modules/source-map-js/lib/array-set.js | 121 + node_modules/source-map-js/lib/base64-vlq.js | 140 + node_modules/source-map-js/lib/base64.js | 67 + .../source-map-js/lib/binary-search.js | 111 + .../source-map-js/lib/mapping-list.js | 79 + node_modules/source-map-js/lib/quick-sort.js | 132 + .../lib/source-map-consumer.d.ts | 1 + .../source-map-js/lib/source-map-consumer.js | 1188 +++ .../lib/source-map-generator.d.ts | 1 + .../source-map-js/lib/source-map-generator.js | 444 + .../source-map-js/lib/source-node.d.ts | 1 + node_modules/source-map-js/lib/source-node.js | 413 + node_modules/source-map-js/lib/util.js | 594 ++ node_modules/source-map-js/package.json | 71 + node_modules/source-map-js/source-map.d.ts | 104 + node_modules/source-map-js/source-map.js | 8 + node_modules/string-width-cjs/index.d.ts | 29 + node_modules/string-width-cjs/index.js | 47 + node_modules/string-width-cjs/license | 9 + .../node_modules/ansi-regex/index.d.ts | 37 + .../node_modules/ansi-regex/index.js | 10 + .../node_modules/ansi-regex/license | 9 + .../node_modules/ansi-regex/package.json | 55 + .../node_modules/ansi-regex/readme.md | 78 + .../node_modules/emoji-regex/LICENSE-MIT.txt | 20 + .../node_modules/emoji-regex/README.md | 73 + .../node_modules/emoji-regex/es2015/index.js | 6 + .../node_modules/emoji-regex/es2015/text.js | 6 + .../node_modules/emoji-regex/index.d.ts | 23 + .../node_modules/emoji-regex/index.js | 6 + .../node_modules/emoji-regex/package.json | 50 + .../node_modules/emoji-regex/text.js | 6 + .../node_modules/strip-ansi/index.d.ts | 17 + .../node_modules/strip-ansi/index.js | 4 + .../node_modules/strip-ansi/license | 9 + .../node_modules/strip-ansi/package.json | 54 + .../node_modules/strip-ansi/readme.md | 46 + node_modules/string-width-cjs/package.json | 56 + node_modules/string-width-cjs/readme.md | 50 + node_modules/string-width/index.d.ts | 29 + node_modules/string-width/index.js | 54 + node_modules/string-width/license | 9 + node_modules/string-width/package.json | 59 + node_modules/string-width/readme.md | 67 + node_modules/strip-ansi-cjs/index.d.ts | 17 + node_modules/strip-ansi-cjs/index.js | 4 + node_modules/strip-ansi-cjs/license | 9 + .../node_modules/ansi-regex/index.d.ts | 37 + .../node_modules/ansi-regex/index.js | 10 + .../node_modules/ansi-regex/license | 9 + .../node_modules/ansi-regex/package.json | 55 + .../node_modules/ansi-regex/readme.md | 78 + node_modules/strip-ansi-cjs/package.json | 54 + node_modules/strip-ansi-cjs/readme.md | 46 + node_modules/strip-ansi/index.d.ts | 15 + node_modules/strip-ansi/index.js | 14 + node_modules/strip-ansi/license | 9 + node_modules/strip-ansi/package.json | 57 + node_modules/strip-ansi/readme.md | 41 + node_modules/strip-outer/index.js | 11 + node_modules/strip-outer/license | 21 + node_modules/strip-outer/package.json | 44 + node_modules/strip-outer/readme.md | 28 + node_modules/style-value-types/CHANGELOG.md | 219 + node_modules/style-value-types/LICENSE.md | 8 + node_modules/style-value-types/README.md | 64 + .../style-value-types/dist/es/color/hex.mjs | 38 + .../style-value-types/dist/es/color/hsla.mjs | 22 + .../style-value-types/dist/es/color/index.mjs | 28 + .../style-value-types/dist/es/color/rgba.mjs | 21 + .../style-value-types/dist/es/color/utils.mjs | 19 + .../dist/es/complex/filter.mjs | 24 + .../dist/es/complex/index.mjs | 53 + .../style-value-types/dist/es/index.mjs | 8 + .../dist/es/numbers/index.mjs | 11 + .../dist/es/numbers/units.mjs | 15 + .../style-value-types/dist/es/utils.mjs | 10 + .../dist/style-value-types.min.js | 1 + .../style-value-types/dist/valueTypes.cjs.js | 221 + .../style-value-types/dist/valueTypes.js | 227 + .../style-value-types/lib/color/hex.d.ts | 2 + .../style-value-types/lib/color/hex.js | 36 + .../style-value-types/lib/color/hex.js.map | 1 + .../style-value-types/lib/color/hsla.d.ts | 2 + .../style-value-types/lib/color/hsla.js | 20 + .../style-value-types/lib/color/hsla.js.map | 1 + .../style-value-types/lib/color/index.d.ts | 2 + .../style-value-types/lib/color/index.js | 26 + .../style-value-types/lib/color/index.js.map | 1 + .../style-value-types/lib/color/rgba.d.ts | 3 + .../style-value-types/lib/color/rgba.js | 19 + .../style-value-types/lib/color/rgba.js.map | 1 + .../style-value-types/lib/color/utils.d.ts | 6 + .../style-value-types/lib/color/utils.js | 17 + .../style-value-types/lib/color/utils.js.map | 1 + .../style-value-types/lib/complex/filter.d.ts | 6 + .../style-value-types/lib/complex/filter.js | 22 + .../lib/complex/filter.js.map | 1 + .../style-value-types/lib/complex/index.d.ts | 12 + .../style-value-types/lib/complex/index.js | 51 + .../lib/complex/index.js.map | 1 + node_modules/style-value-types/lib/index.d.ts | 9 + node_modules/style-value-types/lib/index.js | 10 + .../style-value-types/lib/index.js.map | 1 + .../style-value-types/lib/numbers/index.d.ts | 4 + .../style-value-types/lib/numbers/index.js | 9 + .../lib/numbers/index.js.map | 1 + .../style-value-types/lib/numbers/units.d.ts | 7 + .../style-value-types/lib/numbers/units.js | 13 + .../lib/numbers/units.js.map | 1 + node_modules/style-value-types/lib/types.d.ts | 25 + node_modules/style-value-types/lib/types.js | 1 + .../style-value-types/lib/types.js.map | 1 + node_modules/style-value-types/lib/utils.d.ts | 6 + node_modules/style-value-types/lib/utils.js | 9 + .../style-value-types/lib/utils.js.map | 1 + node_modules/style-value-types/package.json | 73 + node_modules/sucrase/LICENSE | 21 + node_modules/sucrase/README.md | 295 + node_modules/sucrase/bin/sucrase | 3 + node_modules/sucrase/bin/sucrase-node | 18 + .../sucrase/dist/CJSImportProcessor.js | 456 + node_modules/sucrase/dist/HelperManager.js | 176 + node_modules/sucrase/dist/NameManager.js | 27 + .../sucrase/dist/Options-gen-types.js | 42 + node_modules/sucrase/dist/Options.js | 101 + node_modules/sucrase/dist/TokenProcessor.js | 357 + node_modules/sucrase/dist/cli.js | 317 + node_modules/sucrase/dist/computeSourceMap.js | 89 + .../sucrase/dist/esm/CJSImportProcessor.js | 456 + .../sucrase/dist/esm/HelperManager.js | 176 + node_modules/sucrase/dist/esm/NameManager.js | 27 + .../sucrase/dist/esm/Options-gen-types.js | 42 + node_modules/sucrase/dist/esm/Options.js | 101 + .../sucrase/dist/esm/TokenProcessor.js | 357 + node_modules/sucrase/dist/esm/cli.js | 317 + .../sucrase/dist/esm/computeSourceMap.js | 89 + .../dist/esm/identifyShadowedGlobals.js | 98 + node_modules/sucrase/dist/esm/index.js | 133 + node_modules/sucrase/dist/esm/parser/index.js | 31 + .../sucrase/dist/esm/parser/plugins/flow.js | 1105 +++ .../dist/esm/parser/plugins/jsx/index.js | 367 + .../dist/esm/parser/plugins/jsx/xhtml.js | 256 + .../sucrase/dist/esm/parser/plugins/types.js | 37 + .../dist/esm/parser/plugins/typescript.js | 1632 ++++ .../dist/esm/parser/tokenizer/index.js | 1004 ++ .../dist/esm/parser/tokenizer/keywords.js | 43 + .../dist/esm/parser/tokenizer/readWord.js | 64 + .../dist/esm/parser/tokenizer/readWordTree.js | 671 ++ .../dist/esm/parser/tokenizer/state.js | 106 + .../dist/esm/parser/tokenizer/types.js | 361 + .../sucrase/dist/esm/parser/traverser/base.js | 60 + .../dist/esm/parser/traverser/expression.js | 1022 +++ .../dist/esm/parser/traverser/index.js | 18 + .../sucrase/dist/esm/parser/traverser/lval.js | 159 + .../dist/esm/parser/traverser/statement.js | 1332 +++ .../sucrase/dist/esm/parser/traverser/util.js | 104 + .../sucrase/dist/esm/parser/util/charcodes.js | 115 + .../dist/esm/parser/util/identifier.js | 34 + .../dist/esm/parser/util/whitespace.js | 33 + node_modules/sucrase/dist/esm/register.js | 88 + .../esm/transformers/CJSImportTransformer.js | 916 ++ .../esm/transformers/ESMImportTransformer.js | 415 + .../dist/esm/transformers/FlowTransformer.js | 182 + .../dist/esm/transformers/JSXTransformer.js | 733 ++ .../esm/transformers/JestHoistTransformer.js | 111 + .../NumericSeparatorTransformer.js | 20 + .../OptionalCatchBindingTransformer.js | 19 + .../OptionalChainingNullishTransformer.js | 155 + .../ReactDisplayNameTransformer.js | 160 + .../transformers/ReactHotLoaderTransformer.js | 69 + .../dist/esm/transformers/RootTransformer.js | 462 + .../dist/esm/transformers/Transformer.js | 16 + .../esm/transformers/TypeScriptTransformer.js | 279 + .../dist/esm/util/elideImportEquals.js | 29 + .../sucrase/dist/esm/util/formatTokens.js | 74 + .../sucrase/dist/esm/util/getClassInfo.js | 352 + .../dist/esm/util/getDeclarationInfo.js | 40 + .../dist/esm/util/getIdentifierNames.js | 15 + .../esm/util/getImportExportSpecifierInfo.js | 92 + .../sucrase/dist/esm/util/getJSXPragmaInfo.js | 22 + .../dist/esm/util/getNonTypeIdentifiers.js | 43 + .../dist/esm/util/getTSImportedNames.js | 84 + .../sucrase/dist/esm/util/isAsyncOperation.js | 38 + .../sucrase/dist/esm/util/isExportFrom.js | 18 + .../sucrase/dist/esm/util/isIdentifier.js | 81 + .../esm/util/removeMaybeImportAttributes.js | 22 + .../dist/esm/util/shouldElideDefaultExport.js | 38 + .../sucrase/dist/identifyShadowedGlobals.js | 98 + node_modules/sucrase/dist/index.js | 133 + node_modules/sucrase/dist/parser/index.js | 31 + .../sucrase/dist/parser/plugins/flow.js | 1105 +++ .../sucrase/dist/parser/plugins/jsx/index.js | 367 + .../sucrase/dist/parser/plugins/jsx/xhtml.js | 256 + .../sucrase/dist/parser/plugins/types.js | 37 + .../sucrase/dist/parser/plugins/typescript.js | 1632 ++++ .../sucrase/dist/parser/tokenizer/index.js | 1004 ++ .../sucrase/dist/parser/tokenizer/keywords.js | 43 + .../sucrase/dist/parser/tokenizer/readWord.js | 64 + .../dist/parser/tokenizer/readWordTree.js | 671 ++ .../sucrase/dist/parser/tokenizer/state.js | 106 + .../sucrase/dist/parser/tokenizer/types.js | 361 + .../sucrase/dist/parser/traverser/base.js | 60 + .../dist/parser/traverser/expression.js | 1022 +++ .../sucrase/dist/parser/traverser/index.js | 18 + .../sucrase/dist/parser/traverser/lval.js | 159 + .../dist/parser/traverser/statement.js | 1332 +++ .../sucrase/dist/parser/traverser/util.js | 104 + .../sucrase/dist/parser/util/charcodes.js | 115 + .../sucrase/dist/parser/util/identifier.js | 34 + .../sucrase/dist/parser/util/whitespace.js | 33 + node_modules/sucrase/dist/register.js | 88 + .../dist/transformers/CJSImportTransformer.js | 916 ++ .../dist/transformers/ESMImportTransformer.js | 415 + .../dist/transformers/FlowTransformer.js | 182 + .../dist/transformers/JSXTransformer.js | 733 ++ .../dist/transformers/JestHoistTransformer.js | 111 + .../NumericSeparatorTransformer.js | 20 + .../OptionalCatchBindingTransformer.js | 19 + .../OptionalChainingNullishTransformer.js | 155 + .../ReactDisplayNameTransformer.js | 160 + .../transformers/ReactHotLoaderTransformer.js | 69 + .../dist/transformers/RootTransformer.js | 462 + .../sucrase/dist/transformers/Transformer.js | 16 + .../transformers/TypeScriptTransformer.js | 279 + .../dist/types/CJSImportProcessor.d.ts | 67 + .../sucrase/dist/types/HelperManager.d.ts | 15 + .../sucrase/dist/types/NameManager.d.ts | 7 + .../sucrase/dist/types/Options-gen-types.d.ts | 9 + node_modules/sucrase/dist/types/Options.d.ts | 90 + .../sucrase/dist/types/TokenProcessor.d.ts | 87 + node_modules/sucrase/dist/types/cli.d.ts | 1 + .../sucrase/dist/types/computeSourceMap.d.ts | 17 + .../dist/types/identifyShadowedGlobals.d.ts | 12 + node_modules/sucrase/dist/types/index.d.ts | 26 + .../sucrase/dist/types/parser/index.d.ts | 8 + .../dist/types/parser/plugins/flow.d.ts | 27 + .../dist/types/parser/plugins/jsx/index.d.ts | 2 + .../dist/types/parser/plugins/jsx/xhtml.d.ts | 2 + .../dist/types/parser/plugins/types.d.ts | 5 + .../dist/types/parser/plugins/typescript.d.ts | 49 + .../dist/types/parser/tokenizer/index.d.ts | 93 + .../dist/types/parser/tokenizer/keywords.d.ts | 43 + .../dist/types/parser/tokenizer/readWord.d.ts | 7 + .../types/parser/tokenizer/readWordTree.d.ts | 1 + .../dist/types/parser/tokenizer/state.d.ts | 50 + .../dist/types/parser/tokenizer/types.d.ts | 126 + .../dist/types/parser/traverser/base.d.ts | 16 + .../types/parser/traverser/expression.d.ts | 34 + .../dist/types/parser/traverser/index.d.ts | 2 + .../dist/types/parser/traverser/lval.d.ts | 9 + .../types/parser/traverser/statement.d.ts | 20 + .../dist/types/parser/traverser/util.d.ts | 17 + .../dist/types/parser/util/charcodes.d.ts | 107 + .../dist/types/parser/util/identifier.d.ts | 2 + .../dist/types/parser/util/whitespace.d.ts | 3 + node_modules/sucrase/dist/types/register.d.ts | 14 + .../transformers/CJSImportTransformer.d.ts | 149 + .../transformers/ESMImportTransformer.d.ts | 52 + .../types/transformers/FlowTransformer.d.ts | 79 + .../types/transformers/JSXTransformer.d.ts | 144 + .../transformers/JestHoistTransformer.d.ts | 32 + .../NumericSeparatorTransformer.d.ts | 7 + .../OptionalCatchBindingTransformer.d.ts | 9 + .../OptionalChainingNullishTransformer.d.ts | 36 + .../ReactDisplayNameTransformer.d.ts | 29 + .../ReactHotLoaderTransformer.d.ts | 12 + .../types/transformers/RootTransformer.d.ts | 52 + .../dist/types/transformers/Transformer.d.ts | 6 + .../transformers/TypeScriptTransformer.d.ts | 104 + .../dist/types/util/elideImportEquals.d.ts | 2 + .../sucrase/dist/types/util/formatTokens.d.ts | 2 + .../sucrase/dist/types/util/getClassInfo.d.ts | 34 + .../dist/types/util/getDeclarationInfo.d.ts | 18 + .../dist/types/util/getIdentifierNames.d.ts | 5 + .../util/getImportExportSpecifierInfo.d.ts | 36 + .../dist/types/util/getJSXPragmaInfo.d.ts | 8 + .../types/util/getNonTypeIdentifiers.d.ts | 3 + .../dist/types/util/getTSImportedNames.d.ts | 9 + .../dist/types/util/isAsyncOperation.d.ts | 11 + .../sucrase/dist/types/util/isExportFrom.d.ts | 6 + .../sucrase/dist/types/util/isIdentifier.d.ts | 8 + .../util/removeMaybeImportAttributes.d.ts | 6 + .../types/util/shouldElideDefaultExport.d.ts | 6 + .../sucrase/dist/util/elideImportEquals.js | 29 + .../sucrase/dist/util/formatTokens.js | 74 + .../sucrase/dist/util/getClassInfo.js | 352 + .../sucrase/dist/util/getDeclarationInfo.js | 40 + .../sucrase/dist/util/getIdentifierNames.js | 15 + .../dist/util/getImportExportSpecifierInfo.js | 92 + .../sucrase/dist/util/getJSXPragmaInfo.js | 22 + .../dist/util/getNonTypeIdentifiers.js | 43 + .../sucrase/dist/util/getTSImportedNames.js | 84 + .../sucrase/dist/util/isAsyncOperation.js | 38 + .../sucrase/dist/util/isExportFrom.js | 18 + .../sucrase/dist/util/isIdentifier.js | 81 + .../dist/util/removeMaybeImportAttributes.js | 22 + .../dist/util/shouldElideDefaultExport.js | 38 + .../sucrase/node_modules/minimatch/LICENSE | 15 + .../sucrase/node_modules/minimatch/README.md | 454 + .../dist/commonjs/assert-valid-pattern.d.ts | 2 + .../commonjs/assert-valid-pattern.d.ts.map | 1 + .../dist/commonjs/assert-valid-pattern.js | 14 + .../dist/commonjs/assert-valid-pattern.js.map | 1 + .../minimatch/dist/commonjs/ast.d.ts | 20 + .../minimatch/dist/commonjs/ast.d.ts.map | 1 + .../minimatch/dist/commonjs/ast.js | 592 ++ .../minimatch/dist/commonjs/ast.js.map | 1 + .../dist/commonjs/brace-expressions.d.ts | 8 + .../dist/commonjs/brace-expressions.d.ts.map | 1 + .../dist/commonjs/brace-expressions.js | 152 + .../dist/commonjs/brace-expressions.js.map | 1 + .../minimatch/dist/commonjs/escape.d.ts | 12 + .../minimatch/dist/commonjs/escape.d.ts.map | 1 + .../minimatch/dist/commonjs/escape.js | 22 + .../minimatch/dist/commonjs/escape.js.map | 1 + .../minimatch/dist/commonjs/index.d.ts | 94 + .../minimatch/dist/commonjs/index.d.ts.map | 1 + .../minimatch/dist/commonjs/index.js | 1017 ++ .../minimatch/dist/commonjs/index.js.map | 1 + .../minimatch/dist/commonjs/package.json | 3 + .../minimatch/dist/commonjs/unescape.d.ts | 17 + .../minimatch/dist/commonjs/unescape.d.ts.map | 1 + .../minimatch/dist/commonjs/unescape.js | 24 + .../minimatch/dist/commonjs/unescape.js.map | 1 + .../dist/esm/assert-valid-pattern.d.ts | 2 + .../dist/esm/assert-valid-pattern.d.ts.map | 1 + .../dist/esm/assert-valid-pattern.js | 10 + .../dist/esm/assert-valid-pattern.js.map | 1 + .../node_modules/minimatch/dist/esm/ast.d.ts | 20 + .../minimatch/dist/esm/ast.d.ts.map | 1 + .../node_modules/minimatch/dist/esm/ast.js | 588 ++ .../minimatch/dist/esm/ast.js.map | 1 + .../minimatch/dist/esm/brace-expressions.d.ts | 8 + .../dist/esm/brace-expressions.d.ts.map | 1 + .../minimatch/dist/esm/brace-expressions.js | 148 + .../dist/esm/brace-expressions.js.map | 1 + .../minimatch/dist/esm/escape.d.ts | 12 + .../minimatch/dist/esm/escape.d.ts.map | 1 + .../node_modules/minimatch/dist/esm/escape.js | 18 + .../minimatch/dist/esm/escape.js.map | 1 + .../minimatch/dist/esm/index.d.ts | 94 + .../minimatch/dist/esm/index.d.ts.map | 1 + .../node_modules/minimatch/dist/esm/index.js | 1001 ++ .../minimatch/dist/esm/index.js.map | 1 + .../minimatch/dist/esm/package.json | 3 + .../minimatch/dist/esm/unescape.d.ts | 17 + .../minimatch/dist/esm/unescape.d.ts.map | 1 + .../minimatch/dist/esm/unescape.js | 20 + .../minimatch/dist/esm/unescape.js.map | 1 + .../node_modules/minimatch/package.json | 82 + node_modules/sucrase/package.json | 88 + node_modules/sucrase/register/index.js | 1 + node_modules/sucrase/register/js.js | 1 + node_modules/sucrase/register/jsx.js | 1 + .../register/ts-legacy-module-interop.js | 1 + node_modules/sucrase/register/ts.js | 1 + .../register/tsx-legacy-module-interop.js | 1 + node_modules/sucrase/register/tsx.js | 1 + node_modules/sucrase/ts-node-plugin/index.js | 83 + .../supports-preserve-symlinks-flag/.eslintrc | 14 + .../.github/FUNDING.yml | 12 + .../supports-preserve-symlinks-flag/.nycrc | 9 + .../CHANGELOG.md | 22 + .../supports-preserve-symlinks-flag/LICENSE | 21 + .../supports-preserve-symlinks-flag/README.md | 42 + .../browser.js | 3 + .../supports-preserve-symlinks-flag/index.js | 9 + .../package.json | 70 + .../test/index.js | 29 + node_modules/svelte-inview/README.md | 239 + .../dist/additional-svelte-jsx.d.ts | 39 + node_modules/svelte-inview/dist/index.d.ts | 3 + node_modules/svelte-inview/dist/index.js | 178 + node_modules/svelte-inview/dist/index.mjs | 168 + node_modules/svelte-inview/dist/inview.d.ts | 3 + .../svelte-inview/dist/tests/inview.spec.d.ts | 1 + node_modules/svelte-inview/dist/types.d.ts | 40 + node_modules/svelte-inview/license.md | 21 + node_modules/svelte-inview/package.json | 100 + .../src/additional-svelte-jsx.d.ts | 39 + node_modules/svelte-inview/src/index.d.ts | 3 + node_modules/svelte-inview/src/index.ts | 1 + node_modules/svelte-inview/src/inview.ts | 115 + .../svelte-inview/src/tests/inview.spec.ts | 112 + node_modules/svelte-inview/src/types.ts | 50 + .../svelte-motion/.vscode/settings.json | 2 + node_modules/svelte-motion/LICENSE.md | 21 + node_modules/svelte-motion/README.md | 27 + node_modules/svelte-motion/package.json | 54 + node_modules/svelte-motion/rollup.config.js | 34 + .../src/animation/UseAnimatedState.svelte | 69 + .../src/animation/UseAnimation.svelte | 65 + .../svelte-motion/src/animation/animate.js | 46 + .../src/animation/animation-controls.js | 93 + .../src/animation/use-animated-state.js | 1 + .../src/animation/use-animation.js | 74 + .../animation/utils/default-transitions.js | 60 + .../src/animation/utils/easing.js | 45 + .../src/animation/utils/is-animatable.js | 35 + .../animation/utils/is-animation-controls.js | 10 + .../animation/utils/is-keyframes-target.js | 10 + .../src/animation/utils/transitions.js | 208 + .../AnimatePresence/AnimatePresence.svelte | 171 + .../AnimatePresence/PresenceChild.js | 1 + .../AnimatePresence/PresenceChild.svelte | 76 + .../src/components/AnimatePresence/index.js | 1 + .../AnimatePresence/use-presence.js | 42 + .../AnimateSharedLayout.svelte | 239 + .../components/AnimateSharedLayout/index.js | 1 + .../components/AnimateSharedLayout/types.js | 24 + .../AnimateSharedLayout/utils/batcher.js | 90 + .../AnimateSharedLayout/utils/crossfader.js | 233 + .../AnimateSharedLayout/utils/rotate.js | 41 + .../AnimateSharedLayout/utils/stack.js | 138 + .../components/LazyMotion/LazyMotion.svelte | 78 + .../src/components/LazyMotion/index.js | 2 + .../MotionConfig/MotionConfig.svelte | 56 + .../MotionConfigScaleCorrection.js | 47 + .../src/components/MotionConfig/index.js | 1 + .../src/components/MotionDiv.svelte | 8 + .../svelte-motion/src/context/DOMcontext.js | 21 + .../src/context/LayoutGroupContext.js | 7 + .../svelte-motion/src/context/LazyContext.js | 7 + .../src/context/MotionConfigContext.js | 13 + .../MotionContext/MotionContext.svelte | 19 + .../MotionContextProvider.svelte | 23 + .../UseCreateMotionContext.svelte | 34 + .../src/context/MotionContext/create.js | 1 + .../src/context/MotionContext/index.js | 2 + .../src/context/MotionContext/utils.js | 21 + .../src/context/PresenceContext.js | 8 + .../context/ScaleCorrectionProvider.svelte | 26 + .../src/context/SharedLayoutContext.js | 20 + .../src/events/UseDomEvent.svelte | 63 + .../src/events/UsePointerEvent.svelte | 70 + .../svelte-motion/src/events/event-info.js | 60 + .../svelte-motion/src/events/use-dom-event.js | 3 + .../src/events/use-pointer-event.js | 2 + .../svelte-motion/src/events/utils.js | 19 + .../svelte-motion/src/gestures/PanSession.js | 157 + .../src/gestures/UseFocusGesture.svelte | 25 + .../src/gestures/UseGestures.svelte | 19 + .../src/gestures/UseHoverGesture.svelte | 37 + .../src/gestures/UsePanGesture.svelte | 63 + .../src/gestures/UseTapGesture.svelte | 78 + .../src/gestures/drag/UseDrag.svelte | 53 + .../src/gestures/drag/UseDragControls.svelte | 144 + .../drag/VisualElementDragControls.js | 594 ++ .../src/gestures/drag/use-drag-controls.js | 139 + .../src/gestures/drag/use-drag.js | 1 + .../src/gestures/drag/utils/constraints.js | 140 + .../src/gestures/drag/utils/lock.js | 61 + .../src/gestures/use-focus-gesture.js | 2 + .../src/gestures/use-gestures.js | 2 + .../src/gestures/use-hover-gesture.js | 1 + .../src/gestures/use-pan-gesture.js | 1 + .../src/gestures/use-tap-gesture.js | 1 + .../src/gestures/utils/event-type.js | 18 + .../src/gestures/utils/is-node-or-child.js | 25 + node_modules/svelte-motion/src/index.js | 49 + .../svelte-motion/src/motion/Motion.svelte | 220 + .../svelte-motion/src/motion/MotionSSR.svelte | 238 + .../src/motion/features/AnimationState.svelte | 30 + .../src/motion/features/Exit.svelte | 34 + .../src/motion/features/UseFeatures.svelte | 42 + .../src/motion/features/animations.js | 15 + .../src/motion/features/definitions.js | 42 + .../svelte-motion/src/motion/features/drag.js | 17 + .../src/motion/features/gestures.js | 18 + .../src/motion/features/layout/Animate.js | 1 + .../src/motion/features/layout/Animate.svelte | 319 + .../AnimateLayoutContextProvider.svelte | 16 + .../src/motion/features/layout/Measure.js | 1 + .../src/motion/features/layout/Measure.svelte | 109 + .../layout/MeasureContextProvider.svelte | 28 + .../src/motion/features/layout/index.js | 14 + .../src/motion/features/layout/utils.js | 31 + .../src/motion/features/use-features.js | 7 + .../svelte-motion/src/motion/index.js | 33 + .../src/motion/utils/UseLayoutId.svelte | 16 + .../src/motion/utils/UseVisualElement.svelte | 90 + .../src/motion/utils/UseVisualState.svelte | 106 + .../motion/utils/is-forced-motion-value.js | 15 + .../motion/utils/make-renderless-component.js | 11 + .../src/motion/utils/use-motion-ref.js | 32 + .../src/motion/utils/use-visual-element.js | 1 + .../src/motion/utils/use-visual-state.js | 1 + .../src/motion/utils/valid-prop.js | 74 + .../svelte-motion/src/render/dom/M.svelte | 11 + .../src/render/dom/UseRender.svelte | 45 + .../src/render/dom/create-motion-class.js | 12 + .../src/render/dom/create-visual-element.js | 16 + .../src/render/dom/featureBundle.js | 15 + .../src/render/dom/motion-minimal.js | 15 + .../src/render/dom/motion-proxy.js | 75 + .../svelte-motion/src/render/dom/motion.js | 47 + .../dom/projection/convert-to-relative.js | 33 + .../projection/default-scale-correctors.js | 111 + .../src/render/dom/projection/measure.js | 21 + .../src/render/dom/projection/relative-set.js | 20 + .../render/dom/projection/scale-correction.js | 15 + .../src/render/dom/projection/utils.js | 62 + .../src/render/dom/svg-visual-element.js | 114 + .../src/render/dom/use-render.js | 2 + .../dom/utils/UseInitialMotionProps.svelte | 29 + .../src/render/dom/utils/batch-layout.js | 68 + .../src/render/dom/utils/camel-to-dash.js | 14 + .../src/render/dom/utils/create-config.js | 19 + .../dom/utils/css-variables-conversion.js | 94 + .../src/render/dom/utils/filter-props.js | 48 + .../src/render/dom/utils/is-css-variable.js | 12 + .../src/render/dom/utils/is-svg-component.js | 34 + .../src/render/dom/utils/parse-dom-variant.js | 19 + .../src/render/dom/utils/unit-conversion.js | 249 + .../src/render/dom/utils/use-html-props.js | 2 + .../src/render/dom/utils/use-svg-props.js | 1 + .../render/dom/value-types/animatable-none.js | 18 + .../src/render/dom/value-types/defaults.js | 22 + .../src/render/dom/value-types/dimensions.js | 21 + .../src/render/dom/value-types/find.js | 20 + .../src/render/dom/value-types/get-as-type.js | 14 + .../src/render/dom/value-types/number.js | 76 + .../src/render/dom/value-types/test.js | 10 + .../src/render/dom/value-types/type-auto.js | 14 + .../src/render/dom/value-types/type-int.js | 10 + .../src/render/html/UseHTMLProps.svelte | 38 + .../render/html/UseInitialMotionValues.svelte | 28 + .../src/render/html/UseStyle.svelte | 43 + .../src/render/html/config-motion.js | 13 + .../src/render/html/use-props.js | 2 + .../html/utils/build-projection-transform.js | 43 + .../src/render/html/utils/build-styles.js | 109 + .../src/render/html/utils/build-transform.js | 62 + .../render/html/utils/create-render-state.js | 13 + .../src/render/html/utils/render.js | 16 + .../render/html/utils/scrape-motion-values.js | 19 + .../src/render/html/utils/transform.js | 46 + .../src/render/html/visual-element.js | 119 + .../svelte-motion/src/render/index.js | 698 ++ .../src/render/svg/UseSVGProps.svelte | 36 + .../src/render/svg/config-motion.js | 43 + .../src/render/svg/lowercase-elements.js | 37 + .../svelte-motion/src/render/svg/use-props.js | 1 + .../src/render/svg/utils/build-attrs.js | 46 + .../src/render/svg/utils/camel-case-attrs.js | 29 + .../render/svg/utils/create-render-state.js | 9 + .../src/render/svg/utils/path.js | 42 + .../src/render/svg/utils/render.js | 16 + .../render/svg/utils/scrape-motion-values.js | 19 + .../src/render/svg/utils/transform-origin.js | 23 + .../src/render/svg/visual-element.js | 35 + .../src/render/utils/animation-state.js | 339 + .../src/render/utils/animation.js | 146 + .../src/render/utils/compare-by-depth.js | 9 + .../src/render/utils/flat-tree.js | 31 + .../src/render/utils/is-draggable.js | 10 + .../src/render/utils/lifecycles.js | 51 + .../src/render/utils/motion-values.js | 51 + .../src/render/utils/projection.js | 33 + .../svelte-motion/src/render/utils/setters.js | 120 + .../svelte-motion/src/render/utils/state.js | 26 + .../svelte-motion/src/render/utils/types.js | 15 + .../src/render/utils/variants.js | 63 + .../src/utils/UseUnmountEffect.svelte | 11 + node_modules/svelte-motion/src/utils/array.js | 13 + .../svelte-motion/src/utils/each-axis.js | 10 + .../src/utils/fix-process-env.js | 22 + .../src/utils/geometry/delta-apply.js | 156 + .../src/utils/geometry/delta-calc.js | 80 + .../svelte-motion/src/utils/geometry/index.js | 73 + .../svelte-motion/src/utils/is-browser.js | 7 + .../src/utils/is-numerical-string.js | 10 + .../svelte-motion/src/utils/is-ref-object.js | 10 + node_modules/svelte-motion/src/utils/noop.js | 9 + .../svelte-motion/src/utils/resolve-value.js | 15 + .../src/utils/shallow-compare.js | 18 + .../src/utils/subscription-manager.js | 46 + .../src/utils/time-conversion.js | 13 + .../svelte-motion/src/utils/transform.js | 27 + .../svelte-motion/src/utils/use-constant.js | 9 + .../svelte-motion/src/utils/use-cycle.js | 67 + .../src/utils/use-force-update.js | 1 + .../src/utils/use-isomorphic-effect.js | 1 + .../src/utils/use-reduced-motion.js | 63 + .../src/utils/use-unmount-effect.js | 1 + node_modules/svelte-motion/src/value/index.js | 365 + .../src/value/scroll/use-element-scroll.js | 65 + .../src/value/scroll/use-viewport-scroll.js | 74 + .../svelte-motion/src/value/scroll/utils.js | 53 + .../src/value/use-combine-values.js | 47 + .../src/value/use-motion-template.js | 51 + .../src/value/use-motion-value.js | 2 + .../svelte-motion/src/value/use-spring.js | 77 + .../svelte-motion/src/value/use-transform.js | 59 + .../svelte-motion/src/value/use-velocity.js | 43 + .../src/value/utils/is-motion-value.js | 9 + .../src/value/utils/resolve-motion-value.js | 22 + node_modules/svelte-motion/svelte.config.js | 5 + .../tests/types/components.test-d.ts | 52 + .../tests/types/svelteTypes.d.ts | 40 + node_modules/svelte-motion/tsconfig.json | 111 + .../types/animation/animate.d.ts | 57 + .../types/animation/animation-controls.d.ts | 9 + .../svelte-motion/types/animation/types.d.ts | 83 + .../types/animation/use-animation.d.ts | 37 + .../animation/utils/default-transitions.d.ts | 25 + .../types/animation/utils/easing.d.ts | 7 + .../types/animation/utils/is-animatable.d.ts | 15 + .../utils/is-animation-controls.d.ts | 6 + .../animation/utils/is-keyframes-target.d.ts | 6 + .../types/animation/utils/transitions.d.ts | 33 + .../animation/utils/variant-resolvers.d.ts | 16 + .../AnimatePresence/PresenceChild.d.ts | 16 + .../components/AnimatePresence/index.d.ts | 46 + .../components/AnimatePresence/types.d.ts | 79 + .../AnimatePresence/use-presence.d.ts | 56 + .../components/AnimateSharedLayout/index.d.ts | 12 + .../components/AnimateSharedLayout/types.d.ts | 84 + .../AnimateSharedLayout/utils/batcher.d.ts | 9 + .../AnimateSharedLayout/utils/crossfader.d.ts | 25 + .../AnimateSharedLayout/utils/rotate.d.ts | 6 + .../AnimateSharedLayout/utils/stack.d.ts | 19 + .../types/components/LazyMotion/index.d.ts | 41 + .../types/components/LazyMotion/types.d.ts | 58 + .../types/components/MotionConfig/index.d.ts | 21 + .../types/context/LayoutGroupContext.d.ts | 9 + .../types/context/LazyContext.d.ts | 11 + .../types/context/MotionConfigContext.d.ts | 33 + .../types/context/MotionContext/create.d.ts | 7 + .../types/context/MotionContext/index.d.ts | 13 + .../types/context/MotionContext/utils.d.ts | 7 + .../types/context/PresenceContext.d.ts | 22 + .../types/context/SharedLayoutContext.d.ts | 12 + .../types/events/event-info.d.ts | 9 + .../svelte-motion/types/events/types.d.ts | 14 + .../types/events/use-dom-event.d.ts | 50 + .../types/events/use-pointer-event.d.ts | 8 + .../svelte-motion/types/events/utils.d.ts | 7 + .../types/gestures/PanSession.d.ts | 141 + .../drag/VisualElementDragControls.d.ts | 145 + .../types/gestures/drag/types.d.ts | 307 + .../gestures/drag/use-drag-controls.d.ts | 79 + .../types/gestures/drag/use-drag.d.ts | 11 + .../gestures/drag/utils/constraints.d.ts | 76 + .../types/gestures/drag/utils/lock.d.ts | 8 + .../svelte-motion/types/gestures/types.d.ts | 257 + .../types/gestures/use-focus-gesture.d.ts | 12 + .../types/gestures/use-hover-gesture.d.ts | 6 + .../types/gestures/use-pan-gesture.d.ts | 18 + .../types/gestures/use-tap-gesture.d.ts | 10 + .../types/gestures/utils/event-type.d.ts | 6 + .../gestures/utils/is-node-or-child.d.ts | 12 + node_modules/svelte-motion/types/index.d.ts | 87 + .../types/motion/features/animations.d.ts | 6 + .../types/motion/features/definitions.d.ts | 7 + .../types/motion/features/drag.d.ts | 6 + .../types/motion/features/gestures.d.ts | 6 + .../types/motion/features/layout/Animate.d.ts | 6 + .../types/motion/features/layout/Measure.d.ts | 6 + .../types/motion/features/layout/index.d.ts | 6 + .../types/motion/features/layout/types.d.ts | 71 + .../types/motion/features/layout/utils.d.ts | 16 + .../types/motion/features/types.d.ts | 51 + .../types/motion/features/use-features.d.ts | 11 + .../svelte-motion/types/motion/index.d.ts | 28 + .../svelte-motion/types/motion/types.d.ts | 278 + .../motion/utils/is-forced-motion-value.d.ts | 6 + .../utils/make-renderless-component.d.ts | 6 + .../motion/utils/should-inherit-variant.d.ts | 6 + .../types/motion/utils/use-motion-ref.d.ts | 12 + .../motion/utils/use-visual-element.d.ts | 9 + .../types/motion/utils/use-visual-state.d.ts | 18 + .../types/motion/utils/valid-prop.d.ts | 13 + .../render/dom/create-visual-element.d.ts | 6 + .../types/render/dom/features-animation.d.ts | 9 + .../types/render/dom/features-max.d.ts | 9 + .../types/render/dom/motion-minimal.d.ts | 9 + .../types/render/dom/motion-proxy.d.ts | 34 + .../types/render/dom/motion.d.ts | 54 + .../dom/projection/convert-to-relative.d.ts | 10 + .../projection/default-scale-correctors.d.ts | 37 + .../types/render/dom/projection/measure.d.ts | 15 + .../render/dom/projection/relative-set.d.ts | 6 + .../dom/projection/scale-correction.d.ts | 10 + .../types/render/dom/projection/types.d.ts | 13 + .../types/render/dom/projection/utils.d.ts | 16 + .../svelte-motion/types/render/dom/types.d.ts | 32 + .../types/render/dom/use-render.d.ts | 8 + .../types/render/dom/utils/batch-layout.d.ts | 10 + .../types/render/dom/utils/camel-to-dash.d.ts | 8 + .../types/render/dom/utils/create-config.d.ts | 13 + .../dom/utils/css-variables-conversion.d.ts | 26 + .../types/render/dom/utils/filter-props.d.ts | 6 + .../render/dom/utils/is-css-variable.d.ts | 8 + .../render/dom/utils/is-svg-component.d.ts | 6 + .../render/dom/utils/parse-dom-variant.d.ts | 10 + .../render/dom/utils/unit-conversion.d.ts | 25 + .../dom/value-types/animatable-none.d.ts | 5 + .../render/dom/value-types/defaults.d.ts | 13 + .../render/dom/value-types/dimensions.d.ts | 12 + .../types/render/dom/value-types/find.d.ts | 13 + .../render/dom/value-types/get-as-type.d.ts | 9 + .../types/render/dom/value-types/number.d.ts | 6 + .../types/render/dom/value-types/test.d.ts | 9 + .../render/dom/value-types/type-auto.d.ts | 9 + .../render/dom/value-types/type-int.d.ts | 12 + .../types/render/dom/value-types/types.d.ts | 8 + .../types/render/html/config-motion.d.ts | 7 + .../types/render/html/supported-elements.d.ts | 11 + .../types/render/html/types.d.ts | 65 + .../types/render/html/use-props.d.ts | 12 + .../utils/build-projection-transform.d.ts | 19 + .../types/render/html/utils/build-styles.d.ts | 11 + .../render/html/utils/build-transform.d.ts | 19 + .../html/utils/create-render-state.d.ts | 11 + .../types/render/html/utils/render.d.ts | 6 + .../html/utils/scrape-motion-values.d.ts | 6 + .../types/render/html/utils/transform.d.ts | 19 + .../types/render/html/visual-element.d.ts | 10 + .../svelte-motion/types/render/index.d.ts | 6 + .../types/render/svg/config-motion.d.ts | 7 + .../types/render/svg/lowercase-elements.d.ts | 9 + .../types/render/svg/supported-elements.d.ts | 11 + .../svelte-motion/types/render/svg/types.d.ts | 52 + .../types/render/svg/use-props.d.ts | 11 + .../types/render/svg/utils/build-attrs.d.ts | 14 + .../render/svg/utils/camel-case-attrs.d.ts | 8 + .../render/svg/utils/create-render-state.d.ts | 6 + .../types/render/svg/utils/path.d.ts | 13 + .../types/render/svg/utils/render.d.ts | 6 + .../svg/utils/scrape-motion-values.d.ts | 6 + .../render/svg/utils/transform-origin.d.ts | 10 + .../types/render/svg/visual-element.d.ts | 6 + .../svelte-motion/types/render/types.d.ts | 147 + .../types/render/utils/animation-state.d.ts | 35 + .../types/render/utils/animation.d.ts | 25 + .../types/render/utils/compare-by-depth.d.ts | 9 + .../types/render/utils/flat-tree.d.ts | 12 + .../types/render/utils/is-draggable.d.ts | 6 + .../types/render/utils/lifecycles.d.ts | 120 + .../types/render/utils/motion-values.d.ts | 7 + .../types/render/utils/projection.d.ts | 7 + .../types/render/utils/setters.d.ts | 793 ++ .../types/render/utils/state.d.ts | 88 + .../types/render/utils/types.d.ts | 12 + .../types/render/utils/variants.d.ts | 24 + node_modules/svelte-motion/types/types.d.ts | 1089 +++ .../svelte-motion/types/types/geometry.d.ts | 91 + .../svelte-motion/types/utils/array.d.ts | 6 + .../svelte-motion/types/utils/each-axis.d.ts | 5 + .../types/utils/geometry/delta-apply.d.ts | 69 + .../types/utils/geometry/delta-calc.d.ts | 32 + .../types/utils/geometry/index.d.ts | 28 + .../svelte-motion/types/utils/is-browser.d.ts | 5 + .../types/utils/is-numerical-string.d.ts | 8 + .../types/utils/is-ref-object.d.ts | 6 + .../svelte-motion/types/utils/noop.d.ts | 5 + .../types/utils/resolve-value.d.ts | 7 + .../types/utils/shallow-compare.d.ts | 5 + .../types/utils/subscription-manager.d.ts | 13 + .../types/utils/time-conversion.d.ts | 11 + .../svelte-motion/types/utils/transform.d.ts | 91 + .../types/utils/use-constant.d.ts | 14 + .../svelte-motion/types/utils/use-cycle.d.ts | 36 + .../types/utils/use-force-update.d.ts | 5 + .../types/utils/use-isomorphic-effect.d.ts | 6 + .../types/utils/use-reduced-motion.d.ts | 33 + .../types/utils/use-unmount-effect.d.ts | 5 + .../svelte-motion/types/value/index.d.ts | 270 + .../value/scroll/use-element-scroll.d.ts | 34 + .../value/scroll/use-viewport-scroll.d.ts | 31 + .../types/value/scroll/utils.d.ts | 23 + .../types/value/use-combine-values.d.ts | 7 + .../types/value/use-motion-template.d.ts | 33 + .../types/value/use-motion-value.d.ts | 27 + .../svelte-motion/types/value/use-spring.d.ts | 27 + .../types/value/use-transform.d.ts | 110 + .../types/value/use-velocity.d.ts | 18 + .../types/value/utils/is-motion-value.d.ts | 6 + .../value/utils/resolve-motion-value.d.ts | 14 + node_modules/svelte-motion/vite.config.ts | 18 + node_modules/svelte/LICENSE.md | 7 + node_modules/svelte/README.md | 36 + node_modules/svelte/action.d.ts | 1 + node_modules/svelte/animate.d.ts | 1 + node_modules/svelte/compiler.d.ts | 1 + node_modules/svelte/compiler/index.js | 1 + node_modules/svelte/compiler/package.json | 3 + node_modules/svelte/easing.d.ts | 1 + node_modules/svelte/elements.d.ts | 2061 +++++ node_modules/svelte/index.d.ts | 1 + node_modules/svelte/legacy.d.ts | 1 + node_modules/svelte/motion.d.ts | 1 + node_modules/svelte/package.json | 163 + node_modules/svelte/src/action/public.d.ts | 69 + node_modules/svelte/src/ambient.d.ts | 502 + node_modules/svelte/src/animate/index.js | 58 + node_modules/svelte/src/animate/public.d.ts | 16 + node_modules/svelte/src/compiler/errors.js | 1584 ++++ node_modules/svelte/src/compiler/index.js | 169 + node_modules/svelte/src/compiler/legacy.js | 628 ++ .../svelte/src/compiler/migrate/index.js | 1989 ++++ .../src/compiler/phases/1-parse/acorn.js | 214 + .../src/compiler/phases/1-parse/ambient.d.ts | 3 + .../src/compiler/phases/1-parse/index.js | 313 + .../compiler/phases/1-parse/read/context.js | 144 + .../phases/1-parse/read/expression.js | 62 + .../compiler/phases/1-parse/read/options.js | 261 + .../compiler/phases/1-parse/read/script.js | 90 + .../src/compiler/phases/1-parse/read/style.js | 625 ++ .../phases/1-parse/remove_typescript_nodes.js | 147 + .../compiler/phases/1-parse/state/element.js | 823 ++ .../compiler/phases/1-parse/state/fragment.js | 17 + .../src/compiler/phases/1-parse/state/tag.js | 707 ++ .../src/compiler/phases/1-parse/state/text.js | 23 + .../compiler/phases/1-parse/utils/bracket.js | 176 + .../compiler/phases/1-parse/utils/create.js | 16 + .../compiler/phases/1-parse/utils/entities.js | 2234 +++++ .../phases/1-parse/utils/full_char_code_at.js | 15 + .../phases/1-parse/utils/fuzzymatch.js | 280 + .../src/compiler/phases/1-parse/utils/html.js | 120 + .../phases/2-analyze/css/css-analyze.js | 287 + .../phases/2-analyze/css/css-prune.js | 1056 +++ .../compiler/phases/2-analyze/css/css-warn.js | 47 + .../compiler/phases/2-analyze/css/utils.js | 177 + .../src/compiler/phases/2-analyze/index.js | 891 ++ .../src/compiler/phases/2-analyze/types.d.ts | 41 + .../2-analyze/utils/check_graph_for_cycles.js | 46 + .../visitors/ArrowFunctionExpression.js | 11 + .../visitors/AssignmentExpression.js | 27 + .../phases/2-analyze/visitors/Attribute.js | 246 + .../phases/2-analyze/visitors/AwaitBlock.js | 45 + .../2-analyze/visitors/BindDirective.js | 247 + .../2-analyze/visitors/CallExpression.js | 254 + .../phases/2-analyze/visitors/ClassBody.js | 27 + .../2-analyze/visitors/ClassDeclaration.js | 25 + .../2-analyze/visitors/ClassDirective.js | 13 + .../phases/2-analyze/visitors/Component.js | 20 + .../phases/2-analyze/visitors/ConstTag.js | 34 + .../phases/2-analyze/visitors/DebugTag.js | 15 + .../phases/2-analyze/visitors/EachBlock.js | 42 + .../visitors/ExportDefaultDeclaration.js | 20 + .../visitors/ExportNamedDeclaration.js | 61 + .../2-analyze/visitors/ExportSpecifier.js | 30 + .../2-analyze/visitors/ExpressionStatement.js | 38 + .../2-analyze/visitors/ExpressionTag.js | 26 + .../2-analyze/visitors/FunctionDeclaration.js | 16 + .../2-analyze/visitors/FunctionExpression.js | 11 + .../phases/2-analyze/visitors/HtmlTag.js | 19 + .../phases/2-analyze/visitors/Identifier.js | 125 + .../phases/2-analyze/visitors/IfBlock.js | 21 + .../2-analyze/visitors/ImportDeclaration.js | 31 + .../phases/2-analyze/visitors/KeyBlock.js | 20 + .../2-analyze/visitors/LabeledStatement.js | 95 + .../phases/2-analyze/visitors/LetDirective.js | 24 + .../2-analyze/visitors/MemberExpression.js | 30 + .../2-analyze/visitors/NewExpression.js | 17 + .../phases/2-analyze/visitors/OnDirective.js | 28 + .../2-analyze/visitors/RegularElement.js | 192 + .../phases/2-analyze/visitors/RenderTag.js | 56 + .../phases/2-analyze/visitors/SlotElement.js | 42 + .../phases/2-analyze/visitors/SnippetBlock.js | 113 + .../2-analyze/visitors/SpreadAttribute.js | 13 + .../2-analyze/visitors/SpreadElement.js | 16 + .../2-analyze/visitors/StyleDirective.js | 37 + .../phases/2-analyze/visitors/SvelteBody.js | 22 + .../2-analyze/visitors/SvelteBoundary.js | 27 + .../2-analyze/visitors/SvelteComponent.js | 18 + .../2-analyze/visitors/SvelteDocument.js | 24 + .../2-analyze/visitors/SvelteElement.js | 66 + .../2-analyze/visitors/SvelteFragment.js | 27 + .../phases/2-analyze/visitors/SvelteHead.js | 18 + .../phases/2-analyze/visitors/SvelteSelf.js | 36 + .../phases/2-analyze/visitors/SvelteWindow.js | 24 + .../visitors/TaggedTemplateExpression.js | 23 + .../phases/2-analyze/visitors/Text.js | 20 + .../phases/2-analyze/visitors/TitleElement.js | 21 + .../2-analyze/visitors/TransitionDirective.js | 14 + .../2-analyze/visitors/UpdateExpression.js | 25 + .../phases/2-analyze/visitors/UseDirective.js | 12 + .../2-analyze/visitors/VariableDeclarator.js | 120 + .../phases/2-analyze/visitors/shared/a11y.js | 1181 +++ .../2-analyze/visitors/shared/attribute.js | 123 + .../2-analyze/visitors/shared/component.js | 160 + .../2-analyze/visitors/shared/element.js | 160 + .../2-analyze/visitors/shared/fragment.js | 15 + .../2-analyze/visitors/shared/function.js | 20 + .../2-analyze/visitors/shared/snippets.js | 17 + .../visitors/shared/special-element.js | 16 + .../phases/2-analyze/visitors/shared/utils.js | 284 + .../3-transform/client/transform-client.js | 685 ++ .../phases/3-transform/client/types.d.ts | 111 + .../phases/3-transform/client/utils.js | 314 + .../client/visitors/AnimateDirective.js | 28 + .../visitors/ArrowFunctionExpression.js | 11 + .../client/visitors/AssignmentExpression.js | 204 + .../3-transform/client/visitors/Attribute.js | 14 + .../3-transform/client/visitors/AwaitBlock.js | 67 + .../client/visitors/BinaryExpression.js | 34 + .../client/visitors/BindDirective.js | 260 + .../client/visitors/BlockStatement.js | 32 + .../client/visitors/BreakStatement.js | 20 + .../client/visitors/CallExpression.js | 62 + .../3-transform/client/visitors/ClassBody.js | 236 + .../3-transform/client/visitors/Comment.js | 11 + .../3-transform/client/visitors/Component.js | 32 + .../3-transform/client/visitors/ConstTag.js | 76 + .../3-transform/client/visitors/DebugTag.js | 28 + .../3-transform/client/visitors/EachBlock.js | 350 + .../client/visitors/ExportNamedDeclaration.js | 19 + .../client/visitors/ExpressionStatement.js | 30 + .../3-transform/client/visitors/Fragment.js | 289 + .../client/visitors/FunctionDeclaration.js | 23 + .../client/visitors/FunctionExpression.js | 11 + .../3-transform/client/visitors/HtmlTag.js | 27 + .../3-transform/client/visitors/Identifier.js | 41 + .../3-transform/client/visitors/IfBlock.js | 78 + .../client/visitors/ImportDeclaration.js | 16 + .../3-transform/client/visitors/KeyBlock.js | 19 + .../client/visitors/LabeledStatement.js | 66 + .../client/visitors/LetDirective.js | 54 + .../client/visitors/MemberExpression.js | 19 + .../client/visitors/OnDirective.js | 38 + .../3-transform/client/visitors/Program.js | 141 + .../client/visitors/RegularElement.js | 729 ++ .../3-transform/client/visitors/RenderTag.js | 52 + .../client/visitors/SlotElement.js | 70 + .../client/visitors/SnippetBlock.js | 94 + .../client/visitors/SpreadAttribute.js | 10 + .../3-transform/client/visitors/SvelteBody.js | 11 + .../client/visitors/SvelteBoundary.js | 61 + .../client/visitors/SvelteComponent.js | 12 + .../client/visitors/SvelteDocument.js | 11 + .../client/visitors/SvelteElement.js | 156 + .../client/visitors/SvelteFragment.js | 17 + .../3-transform/client/visitors/SvelteHead.js | 20 + .../3-transform/client/visitors/SvelteSelf.js | 12 + .../client/visitors/SvelteWindow.js | 11 + .../client/visitors/TitleElement.js | 24 + .../client/visitors/TransitionDirective.js | 29 + .../client/visitors/UpdateExpression.js | 57 + .../client/visitors/UseDirective.js | 37 + .../client/visitors/VariableDeclaration.js | 318 + .../client/visitors/shared/component.js | 447 + .../client/visitors/shared/declarations.js | 53 + .../client/visitors/shared/element.js | 216 + .../client/visitors/shared/events.js | 185 + .../client/visitors/shared/fragment.js | 163 + .../client/visitors/shared/function.js | 30 + .../client/visitors/shared/special_element.js | 22 + .../client/visitors/shared/utils.js | 260 + .../compiler/phases/3-transform/css/index.js | 460 + .../src/compiler/phases/3-transform/index.js | 110 + .../3-transform/server/transform-server.js | 405 + .../phases/3-transform/server/types.d.ts | 38 + .../server/visitors/AssignmentExpression.js | 68 + .../3-transform/server/visitors/AwaitBlock.js | 33 + .../server/visitors/CallExpression.js | 41 + .../3-transform/server/visitors/ClassBody.js | 121 + .../3-transform/server/visitors/Component.js | 12 + .../3-transform/server/visitors/ConstTag.js | 16 + .../3-transform/server/visitors/DebugTag.js | 24 + .../3-transform/server/visitors/EachBlock.js | 66 + .../server/visitors/ExpressionStatement.js | 23 + .../3-transform/server/visitors/Fragment.js | 46 + .../3-transform/server/visitors/HtmlTag.js | 13 + .../3-transform/server/visitors/Identifier.js | 19 + .../3-transform/server/visitors/IfBlock.js | 28 + .../3-transform/server/visitors/KeyBlock.js | 16 + .../server/visitors/LabeledStatement.js | 24 + .../server/visitors/MemberExpression.js | 23 + .../server/visitors/PropertyDefinition.js | 36 + .../server/visitors/RegularElement.js | 104 + .../3-transform/server/visitors/RenderTag.js | 35 + .../server/visitors/SlotElement.js | 54 + .../server/visitors/SnippetBlock.js | 25 + .../server/visitors/SpreadAttribute.js | 10 + .../server/visitors/SvelteBoundary.js | 17 + .../server/visitors/SvelteComponent.js | 12 + .../server/visitors/SvelteElement.js | 75 + .../server/visitors/SvelteFragment.js | 11 + .../3-transform/server/visitors/SvelteHead.js | 16 + .../3-transform/server/visitors/SvelteSelf.js | 12 + .../server/visitors/TitleElement.js | 17 + .../server/visitors/UpdateExpression.js | 26 + .../server/visitors/VariableDeclaration.js | 185 + .../server/visitors/shared/component.js | 310 + .../server/visitors/shared/element.js | 456 + .../server/visitors/shared/utils.js | 243 + .../phases/3-transform/shared/assignments.js | 74 + .../compiler/phases/3-transform/types.d.ts | 10 + .../src/compiler/phases/3-transform/utils.js | 471 + .../svelte/src/compiler/phases/bindings.js | 227 + .../svelte/src/compiler/phases/css.js | 14 + .../svelte/src/compiler/phases/nodes.js | 63 + .../svelte/src/compiler/phases/patterns.js | 23 + .../svelte/src/compiler/phases/scope.js | 766 ++ .../svelte/src/compiler/phases/types.d.ts | 114 + .../compiler/preprocess/decode_sourcemap.js | 96 + .../svelte/src/compiler/preprocess/index.js | 368 + .../compiler/preprocess/legacy-public.d.ts | 21 + .../src/compiler/preprocess/private.d.ts | 22 + .../src/compiler/preprocess/public.d.ts | 80 + .../compiler/preprocess/replace_in_code.js | 72 + node_modules/svelte/src/compiler/public.d.ts | 15 + node_modules/svelte/src/compiler/state.js | 107 + .../svelte/src/compiler/types/css.d.ts | 188 + .../svelte/src/compiler/types/index.d.ts | 326 + .../src/compiler/types/legacy-interfaces.d.ts | 6 + .../src/compiler/types/legacy-nodes.d.ts | 274 + .../svelte/src/compiler/types/template.d.ts | 569 ++ .../svelte/src/compiler/utils/assert.js | 9 + node_modules/svelte/src/compiler/utils/ast.js | 584 ++ .../svelte/src/compiler/utils/builders.js | 658 ++ .../src/compiler/utils/compile_diagnostic.js | 107 + .../compiler/utils/extract_svelte_ignore.js | 104 + .../svelte/src/compiler/utils/mapped_code.js | 451 + .../svelte/src/compiler/utils/push_array.js | 13 + .../utils/sanitize_template_string.js | 7 + .../svelte/src/compiler/utils/slot.js | 20 + .../svelte/src/compiler/utils/string.js | 9 + .../svelte/src/compiler/validate-options.js | 335 + node_modules/svelte/src/compiler/warnings.js | 813 ++ node_modules/svelte/src/constants.js | 56 + node_modules/svelte/src/easing/index.js | 286 + node_modules/svelte/src/escaping.js | 26 + node_modules/svelte/src/events/index.js | 1 + node_modules/svelte/src/events/public.d.ts | 57 + .../svelte/src/html-tree-validation.js | 238 + node_modules/svelte/src/index-client.js | 193 + node_modules/svelte/src/index-server.js | 40 + node_modules/svelte/src/index.d.ts | 354 + .../svelte/src/internal/client/constants.js | 27 + .../svelte/src/internal/client/dev/assign.js | 78 + .../src/internal/client/dev/console-log.js | 35 + .../svelte/src/internal/client/dev/css.js | 31 + .../src/internal/client/dev/elements.js | 60 + .../src/internal/client/dev/equality.js | 101 + .../svelte/src/internal/client/dev/hmr.js | 78 + .../svelte/src/internal/client/dev/inspect.js | 36 + .../svelte/src/internal/client/dev/legacy.js | 28 + .../src/internal/client/dev/ownership.js | 264 + .../svelte/src/internal/client/dev/tracing.js | 182 + .../src/internal/client/dom/blocks/await.js | 167 + .../internal/client/dom/blocks/boundary.js | 134 + .../internal/client/dom/blocks/css-props.js | 33 + .../src/internal/client/dom/blocks/each.js | 617 ++ .../src/internal/client/dom/blocks/html.js | 122 + .../src/internal/client/dom/blocks/if.js | 111 + .../src/internal/client/dom/blocks/key.js | 43 + .../src/internal/client/dom/blocks/slot.js | 44 + .../src/internal/client/dom/blocks/snippet.js | 114 + .../client/dom/blocks/svelte-component.js | 43 + .../client/dom/blocks/svelte-element.js | 164 + .../internal/client/dom/blocks/svelte-head.js | 67 + .../svelte/src/internal/client/dom/css.js | 32 + .../internal/client/dom/elements/actions.js | 43 + .../client/dom/elements/attributes.js | 527 ++ .../client/dom/elements/bindings/document.js | 17 + .../client/dom/elements/bindings/input.js | 265 + .../client/dom/elements/bindings/media.js | 214 + .../client/dom/elements/bindings/navigator.js | 11 + .../client/dom/elements/bindings/props.js | 22 + .../client/dom/elements/bindings/select.js | 146 + .../client/dom/elements/bindings/shared.js | 76 + .../client/dom/elements/bindings/size.js | 108 + .../client/dom/elements/bindings/this.js | 61 + .../client/dom/elements/bindings/universal.js | 75 + .../client/dom/elements/bindings/window.js | 66 + .../src/internal/client/dom/elements/class.js | 120 + .../client/dom/elements/custom-element.js | 338 + .../internal/client/dom/elements/events.js | 324 + .../src/internal/client/dom/elements/misc.js | 58 + .../src/internal/client/dom/elements/style.js | 22 + .../client/dom/elements/transitions.js | 446 + .../src/internal/client/dom/hydration.js | 105 + .../client/dom/legacy/event-modifiers.js | 128 + .../internal/client/dom/legacy/lifecycle.js | 81 + .../src/internal/client/dom/legacy/misc.js | 68 + .../src/internal/client/dom/operations.js | 197 + .../src/internal/client/dom/reconciler.js | 6 + .../svelte/src/internal/client/dom/task.js | 63 + .../src/internal/client/dom/template.js | 251 + .../svelte/src/internal/client/errors.js | 338 + .../svelte/src/internal/client/index.js | 174 + .../svelte/src/internal/client/loop.js | 48 + .../svelte/src/internal/client/proxy.js | 345 + .../internal/client/reactivity/deriveds.js | 199 + .../src/internal/client/reactivity/effects.js | 634 ++ .../internal/client/reactivity/equality.js | 30 + .../src/internal/client/reactivity/props.js | 437 + .../src/internal/client/reactivity/sources.js | 271 + .../src/internal/client/reactivity/store.js | 181 + .../src/internal/client/reactivity/types.d.ts | 76 + .../svelte/src/internal/client/render.js | 305 + .../svelte/src/internal/client/runtime.js | 1386 +++ .../svelte/src/internal/client/timing.js | 16 + .../svelte/src/internal/client/types.d.ts | 192 + .../svelte/src/internal/client/validate.js | 106 + .../svelte/src/internal/client/warnings.js | 168 + .../svelte/src/internal/disclose-version.js | 5 + .../svelte/src/internal/flags/index.js | 10 + .../svelte/src/internal/flags/legacy.js | 3 + .../svelte/src/internal/flags/tracing.js | 3 + node_modules/svelte/src/internal/index.js | 5 + .../svelte/src/internal/server/blocks/html.js | 11 + .../src/internal/server/blocks/snippet.js | 22 + .../svelte/src/internal/server/context.js | 96 + .../svelte/src/internal/server/dev.js | 100 + .../svelte/src/internal/server/errors.js | 13 + .../svelte/src/internal/server/hydration.js | 6 + .../svelte/src/internal/server/index.js | 547 ++ .../svelte/src/internal/server/types.d.ts | 30 + .../svelte/src/internal/shared/attributes.js | 42 + .../svelte/src/internal/shared/clone.js | 128 + .../svelte/src/internal/shared/errors.js | 65 + .../svelte/src/internal/shared/types.d.ts | 14 + .../svelte/src/internal/shared/utils.js | 81 + .../svelte/src/internal/shared/validate.js | 37 + .../svelte/src/internal/shared/warnings.js | 36 + node_modules/svelte/src/internal/types.d.ts | 2 + .../svelte/src/legacy/legacy-client.js | 282 + .../svelte/src/legacy/legacy-server.js | 66 + node_modules/svelte/src/motion/index.js | 32 + node_modules/svelte/src/motion/private.d.ts | 44 + node_modules/svelte/src/motion/public.d.ts | 88 + node_modules/svelte/src/motion/spring.js | 349 + node_modules/svelte/src/motion/tweened.js | 291 + node_modules/svelte/src/motion/utils.js | 7 + .../src/reactivity/create-subscriber.js | 81 + node_modules/svelte/src/reactivity/date.js | 79 + .../svelte/src/reactivity/index-client.js | 7 + .../svelte/src/reactivity/index-server.js | 23 + node_modules/svelte/src/reactivity/map.js | 192 + .../svelte/src/reactivity/media-query.js | 37 + .../svelte/src/reactivity/reactive-value.js | 24 + node_modules/svelte/src/reactivity/set.js | 158 + .../src/reactivity/url-search-params.js | 146 + node_modules/svelte/src/reactivity/url.js | 165 + node_modules/svelte/src/reactivity/utils.js | 7 + .../svelte/src/reactivity/window/index.js | 156 + node_modules/svelte/src/server/index.d.ts | 21 + node_modules/svelte/src/server/index.js | 1 + node_modules/svelte/src/store/index-client.js | 148 + node_modules/svelte/src/store/index-server.js | 101 + node_modules/svelte/src/store/private.d.ts | 13 + node_modules/svelte/src/store/public.d.ts | 49 + node_modules/svelte/src/store/shared/index.js | 209 + node_modules/svelte/src/store/utils.js | 36 + node_modules/svelte/src/transition/index.js | 286 + .../svelte/src/transition/public.d.ts | 62 + node_modules/svelte/src/utils.js | 460 + node_modules/svelte/src/version.js | 10 + node_modules/svelte/store.d.ts | 1 + node_modules/svelte/svelte-html.d.ts | 256 + node_modules/svelte/transition.d.ts | 1 + .../svelte/types/compiler/interfaces.d.ts | 1 + .../svelte/types/compiler/preprocess.d.ts | 1 + node_modules/svelte/types/index.d.ts | 3162 +++++++ node_modules/svelte/types/index.d.ts.map | 252 + node_modules/svelte2tsx/LICENSE | 21 + node_modules/svelte2tsx/README.md | 52 + node_modules/svelte2tsx/index.d.ts | 197 + node_modules/svelte2tsx/index.js | 8137 +++++++++++++++++ node_modules/svelte2tsx/index.mjs | 8114 ++++++++++++++++ node_modules/svelte2tsx/package.json | 70 + node_modules/svelte2tsx/svelte-jsx-v4.d.ts | 230 + node_modules/svelte2tsx/svelte-jsx.d.ts | 1492 +++ .../svelte2tsx/svelte-native-jsx.d.ts | 32 + node_modules/svelte2tsx/svelte-shims-v4.d.ts | 287 + node_modules/svelte2tsx/svelte-shims.d.ts | 305 + .../node_modules/glob-parent/CHANGELOG.md | 110 + .../chokidar/node_modules/glob-parent/LICENSE | 15 + .../node_modules/glob-parent/README.md | 137 + .../node_modules/glob-parent/index.js | 42 + .../node_modules/glob-parent/package.json | 48 + .../tailwindcss/node_modules/readdirp/LICENSE | 21 + .../node_modules/readdirp/README.md | 122 + .../node_modules/readdirp/index.d.ts | 43 + .../node_modules/readdirp/index.js | 287 + .../node_modules/readdirp/package.json | 122 + node_modules/thenify-all/History.md | 11 + node_modules/thenify-all/LICENSE | 22 + node_modules/thenify-all/README.md | 66 + node_modules/thenify-all/index.js | 73 + node_modules/thenify-all/package.json | 34 + node_modules/thenify/History.md | 11 + node_modules/thenify/LICENSE | 22 + node_modules/thenify/README.md | 120 + node_modules/thenify/index.js | 77 + node_modules/thenify/package.json | 31 + node_modules/tiny-glob/index.d.ts | 13 + node_modules/tiny-glob/index.js | 83 + node_modules/tiny-glob/license | 21 + node_modules/tiny-glob/package.json | 37 + node_modules/tiny-glob/readme.md | 147 + node_modules/tiny-glob/sync.d.ts | 13 + node_modules/tiny-glob/sync.js | 81 + node_modules/to-regex-range/LICENSE | 21 + node_modules/to-regex-range/README.md | 305 + node_modules/to-regex-range/index.js | 288 + node_modules/to-regex-range/package.json | 88 + node_modules/totalist/dist/index.js | 24 + node_modules/totalist/dist/index.mjs | 22 + node_modules/totalist/index.d.ts | 3 + node_modules/totalist/license | 21 + node_modules/totalist/package.json | 55 + node_modules/totalist/readme.md | 109 + node_modules/totalist/sync/index.d.ts | 3 + node_modules/totalist/sync/index.js | 17 + node_modules/totalist/sync/index.mjs | 15 + node_modules/trim-repeated/index.js | 10 + node_modules/trim-repeated/license | 21 + node_modules/trim-repeated/package.json | 41 + node_modules/trim-repeated/readme.md | 47 + node_modules/ts-interface-checker/LICENSE | 201 + node_modules/ts-interface-checker/README.md | 185 + .../ts-interface-checker/dist/index.d.ts | 124 + .../ts-interface-checker/dist/index.js | 224 + .../ts-interface-checker/dist/types.d.ts | 181 + .../ts-interface-checker/dist/types.js | 566 ++ .../ts-interface-checker/dist/util.d.ts | 55 + .../ts-interface-checker/dist/util.js | 130 + .../ts-interface-checker/package.json | 60 + node_modules/universalify/LICENSE | 20 + node_modules/universalify/README.md | 76 + node_modules/universalify/index.js | 24 + node_modules/universalify/package.json | 34 + node_modules/util-deprecate/History.md | 16 + node_modules/util-deprecate/LICENSE | 24 + node_modules/util-deprecate/README.md | 53 + node_modules/util-deprecate/browser.js | 67 + node_modules/util-deprecate/node.js | 6 + node_modules/util-deprecate/package.json | 27 + node_modules/which/CHANGELOG.md | 166 + node_modules/which/LICENSE | 15 + node_modules/which/README.md | 54 + node_modules/which/bin/node-which | 52 + node_modules/which/package.json | 43 + node_modules/which/which.js | 125 + node_modules/wrap-ansi-cjs/index.js | 216 + node_modules/wrap-ansi-cjs/license | 9 + .../node_modules/ansi-regex/index.d.ts | 37 + .../node_modules/ansi-regex/index.js | 10 + .../node_modules/ansi-regex/license | 9 + .../node_modules/ansi-regex/package.json | 55 + .../node_modules/ansi-regex/readme.md | 78 + .../node_modules/ansi-styles/index.d.ts | 345 + .../node_modules/ansi-styles/index.js | 163 + .../node_modules/ansi-styles/license | 9 + .../node_modules/ansi-styles/package.json | 56 + .../node_modules/ansi-styles/readme.md | 152 + .../node_modules/emoji-regex/LICENSE-MIT.txt | 20 + .../node_modules/emoji-regex/README.md | 73 + .../node_modules/emoji-regex/es2015/index.js | 6 + .../node_modules/emoji-regex/es2015/text.js | 6 + .../node_modules/emoji-regex/index.d.ts | 23 + .../node_modules/emoji-regex/index.js | 6 + .../node_modules/emoji-regex/package.json | 50 + .../node_modules/emoji-regex/text.js | 6 + .../node_modules/string-width/index.d.ts | 29 + .../node_modules/string-width/index.js | 47 + .../node_modules/string-width/license | 9 + .../node_modules/string-width/package.json | 56 + .../node_modules/string-width/readme.md | 50 + .../node_modules/strip-ansi/index.d.ts | 17 + .../node_modules/strip-ansi/index.js | 4 + .../node_modules/strip-ansi/license | 9 + .../node_modules/strip-ansi/package.json | 54 + .../node_modules/strip-ansi/readme.md | 46 + node_modules/wrap-ansi-cjs/package.json | 62 + node_modules/wrap-ansi-cjs/readme.md | 91 + node_modules/wrap-ansi/index.d.ts | 41 + node_modules/wrap-ansi/index.js | 214 + node_modules/wrap-ansi/license | 9 + node_modules/wrap-ansi/package.json | 69 + node_modules/wrap-ansi/readme.md | 91 + node_modules/wrappy/LICENSE | 15 + node_modules/wrappy/README.md | 36 + node_modules/wrappy/package.json | 29 + node_modules/wrappy/wrappy.js | 33 + package-lock.json | 7024 ++++++++++++++ package.json | 52 + postcss.config.js | 6 + src/app.css | 24 + src/app.html | 12 + src/lib/components/BlurFade.svelte | 47 + src/lib/components/MagicCard.svelte | 72 + src/lib/components/contact.svelte | 66 + src/lib/components/hero.svelte | 47 + src/lib/components/navigations.svelte | 37 + src/lib/components/nexo_body_card.svelte | 22 + src/lib/components/nexo_card.svelte | 35 + src/lib/components/nexo_desc.svelte | 71 + src/lib/components/projects.svelte | 27 + src/lib/components/sbau_body_card.svelte | 18 + src/lib/components/sbau_card.svelte | 32 + src/lib/components/skills.svelte | 138 + src/lib/components/skillsMagicCard.svelte | 72 + src/lib/img/CSS_Logo.svg | 101 + src/lib/img/Html_Logo.svg | 2 + src/lib/img/Javascript_Logo.svg | 150 + src/lib/img/Mysql_Logo.svg | 1 + src/lib/img/Python_Logo.svg | 5 + src/lib/img/Svelte_Logo.svg | 20 + src/lib/img/Tailwind_Logo.svg | 1 + src/lib/img/bg.png | Bin 0 -> 151279 bytes src/lib/img/discordpy_logo.png | Bin 0 -> 117578 bytes src/lib/img/mobbg.png | Bin 0 -> 140822 bytes src/lib/img/nexo_mockup.png | Bin 0 -> 337340 bytes src/lib/img/nexo_screenshot.png | Bin 0 -> 115023 bytes src/lib/img/sbau_mockup.png | Bin 0 -> 271145 bytes src/lib/utils.ts | 6 + src/routes/+layout.svelte | 5 + src/routes/+page.svelte | 8 + src/routes/contact/+page.svelte | 9 + src/routes/nexo_project/+page.svelte | 8 + src/routes/projects/+page.svelte | 8 + src/routes/skills/+page.svelte | 7 + static/.nojekyll | 1 + static/favicon.png | Bin 0 -> 17643 bytes svelte.config.js | 10 + tailwind.config.js | 19 + vite.config.js | 6 + 4800 files changed, 578004 insertions(+) create mode 100644 README.md create mode 100644 jsconfig.json create mode 100644 node_modules/.svelte2tsx-language-server-files/svelte-native-jsx.d.ts create mode 100644 node_modules/.svelte2tsx-language-server-files/svelte-shims-v4.d.ts create mode 100644 node_modules/@alloc/quick-lru/index.d.ts create mode 100644 node_modules/@alloc/quick-lru/index.js create mode 100644 node_modules/@alloc/quick-lru/license create mode 100644 node_modules/@alloc/quick-lru/package.json create mode 100644 node_modules/@alloc/quick-lru/readme.md create mode 100644 node_modules/@isaacs/cliui/LICENSE.txt create mode 100644 node_modules/@isaacs/cliui/README.md create mode 100644 node_modules/@isaacs/cliui/build/index.cjs create mode 100644 node_modules/@isaacs/cliui/build/index.d.cts create mode 100644 node_modules/@isaacs/cliui/build/lib/index.js create mode 100644 node_modules/@isaacs/cliui/index.mjs create mode 100644 node_modules/@isaacs/cliui/package.json create mode 100644 node_modules/@jridgewell/sourcemap-codec/LICENSE create mode 100644 node_modules/@jridgewell/sourcemap-codec/README.md create mode 100644 node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs create mode 100644 node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map create mode 100644 node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js create mode 100644 node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map create mode 100644 node_modules/@jridgewell/sourcemap-codec/dist/types/scopes.d.ts create mode 100644 node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts create mode 100644 node_modules/@jridgewell/sourcemap-codec/dist/types/strings.d.ts create mode 100644 node_modules/@jridgewell/sourcemap-codec/dist/types/vlq.d.ts create mode 100644 node_modules/@jridgewell/sourcemap-codec/package.json create mode 100644 node_modules/@nodelib/fs.scandir/LICENSE create mode 100644 node_modules/@nodelib/fs.scandir/README.md create mode 100644 node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/adapters/fs.js create mode 100644 node_modules/@nodelib/fs.scandir/out/constants.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/constants.js create mode 100644 node_modules/@nodelib/fs.scandir/out/index.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/index.js create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/async.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/async.js create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/common.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/common.js create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/sync.js create mode 100644 node_modules/@nodelib/fs.scandir/out/settings.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/settings.js create mode 100644 node_modules/@nodelib/fs.scandir/out/types/index.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/types/index.js create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/fs.js create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/index.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/index.js create mode 100644 node_modules/@nodelib/fs.scandir/package.json create mode 100644 node_modules/@nodelib/fs.stat/LICENSE create mode 100644 node_modules/@nodelib/fs.stat/README.md create mode 100644 node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/adapters/fs.js create mode 100644 node_modules/@nodelib/fs.stat/out/index.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/index.js create mode 100644 node_modules/@nodelib/fs.stat/out/providers/async.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/providers/async.js create mode 100644 node_modules/@nodelib/fs.stat/out/providers/sync.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/providers/sync.js create mode 100644 node_modules/@nodelib/fs.stat/out/settings.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/settings.js create mode 100644 node_modules/@nodelib/fs.stat/out/types/index.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/types/index.js create mode 100644 node_modules/@nodelib/fs.stat/package.json create mode 100644 node_modules/@nodelib/fs.walk/LICENSE create mode 100644 node_modules/@nodelib/fs.walk/README.md create mode 100644 node_modules/@nodelib/fs.walk/out/index.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/index.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/async.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/async.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/index.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/index.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/stream.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/stream.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/sync.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/sync.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/async.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/async.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/common.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/common.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/reader.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/reader.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/sync.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/sync.js create mode 100644 node_modules/@nodelib/fs.walk/out/settings.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/settings.js create mode 100644 node_modules/@nodelib/fs.walk/out/types/index.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/types/index.js create mode 100644 node_modules/@nodelib/fs.walk/package.json create mode 100644 node_modules/@pkgjs/parseargs/.editorconfig create mode 100644 node_modules/@pkgjs/parseargs/CHANGELOG.md create mode 100644 node_modules/@pkgjs/parseargs/LICENSE create mode 100644 node_modules/@pkgjs/parseargs/README.md create mode 100644 node_modules/@pkgjs/parseargs/examples/is-default-value.js create mode 100644 node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js create mode 100644 node_modules/@pkgjs/parseargs/examples/negate.js create mode 100644 node_modules/@pkgjs/parseargs/examples/no-repeated-options.js create mode 100644 node_modules/@pkgjs/parseargs/examples/ordered-options.mjs create mode 100644 node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js create mode 100644 node_modules/@pkgjs/parseargs/index.js create mode 100644 node_modules/@pkgjs/parseargs/internal/errors.js create mode 100644 node_modules/@pkgjs/parseargs/internal/primordials.js create mode 100644 node_modules/@pkgjs/parseargs/internal/util.js create mode 100644 node_modules/@pkgjs/parseargs/internal/validators.js create mode 100644 node_modules/@pkgjs/parseargs/package.json create mode 100644 node_modules/@pkgjs/parseargs/utils.js create mode 100644 node_modules/@polka/url/build.js create mode 100644 node_modules/@polka/url/build.mjs create mode 100644 node_modules/@polka/url/index.d.ts create mode 100644 node_modules/@polka/url/package.json create mode 100644 node_modules/@polka/url/readme.md create mode 100644 node_modules/@rollup/pluginutils/node_modules/picomatch/LICENSE create mode 100644 node_modules/@rollup/pluginutils/node_modules/picomatch/README.md create mode 100644 node_modules/@rollup/pluginutils/node_modules/picomatch/index.js create mode 100644 node_modules/@rollup/pluginutils/node_modules/picomatch/lib/constants.js create mode 100644 node_modules/@rollup/pluginutils/node_modules/picomatch/lib/parse.js create mode 100644 node_modules/@rollup/pluginutils/node_modules/picomatch/lib/picomatch.js create mode 100644 node_modules/@rollup/pluginutils/node_modules/picomatch/lib/scan.js create mode 100644 node_modules/@rollup/pluginutils/node_modules/picomatch/lib/utils.js create mode 100644 node_modules/@rollup/pluginutils/node_modules/picomatch/package.json create mode 100644 node_modules/@rollup/pluginutils/node_modules/picomatch/posix.js create mode 100644 node_modules/@sveltejs/adapter-auto/LICENSE create mode 100644 node_modules/@sveltejs/adapter-auto/README.md create mode 100644 node_modules/@sveltejs/adapter-auto/adapters.js create mode 100644 node_modules/@sveltejs/adapter-auto/index.d.ts create mode 100644 node_modules/@sveltejs/adapter-auto/index.js create mode 100644 node_modules/@sveltejs/adapter-auto/package.json create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/LICENSE create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/README.md create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/package.json create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/src/debug.js create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/src/index.js create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/src/options.js create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/src/public.d.ts create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/Inspector.svelte create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/load-inspector.js create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/src/utils.js create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts create mode 100644 node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts.map create mode 100644 node_modules/@types/cookie/LICENSE create mode 100644 node_modules/@types/cookie/README.md create mode 100644 node_modules/@types/cookie/index.d.ts create mode 100644 node_modules/@types/cookie/package.json create mode 100644 node_modules/@types/estree/LICENSE create mode 100644 node_modules/@types/estree/README.md create mode 100644 node_modules/@types/estree/flow.d.ts create mode 100644 node_modules/@types/estree/index.d.ts create mode 100644 node_modules/@types/estree/package.json create mode 100644 node_modules/@vercel/nft/node_modules/brace-expansion/LICENSE create mode 100644 node_modules/@vercel/nft/node_modules/brace-expansion/README.md create mode 100644 node_modules/@vercel/nft/node_modules/brace-expansion/index.js create mode 100644 node_modules/@vercel/nft/node_modules/brace-expansion/package.json create mode 100644 node_modules/@vercel/nft/node_modules/glob/LICENSE create mode 100644 node_modules/@vercel/nft/node_modules/glob/README.md create mode 100644 node_modules/@vercel/nft/node_modules/glob/common.js create mode 100644 node_modules/@vercel/nft/node_modules/glob/glob.js create mode 100644 node_modules/@vercel/nft/node_modules/glob/package.json create mode 100644 node_modules/@vercel/nft/node_modules/glob/sync.js create mode 100644 node_modules/@vercel/nft/node_modules/minimatch/LICENSE create mode 100644 node_modules/@vercel/nft/node_modules/minimatch/README.md create mode 100644 node_modules/@vercel/nft/node_modules/minimatch/minimatch.js create mode 100644 node_modules/@vercel/nft/node_modules/minimatch/package.json create mode 100644 node_modules/@vercel/nft/node_modules/picomatch/LICENSE create mode 100644 node_modules/@vercel/nft/node_modules/picomatch/README.md create mode 100644 node_modules/@vercel/nft/node_modules/picomatch/index.js create mode 100644 node_modules/@vercel/nft/node_modules/picomatch/lib/constants.js create mode 100644 node_modules/@vercel/nft/node_modules/picomatch/lib/parse.js create mode 100644 node_modules/@vercel/nft/node_modules/picomatch/lib/picomatch.js create mode 100644 node_modules/@vercel/nft/node_modules/picomatch/lib/scan.js create mode 100644 node_modules/@vercel/nft/node_modules/picomatch/lib/utils.js create mode 100644 node_modules/@vercel/nft/node_modules/picomatch/package.json create mode 100644 node_modules/@vercel/nft/node_modules/picomatch/posix.js create mode 100644 node_modules/ansi-styles/index.d.ts create mode 100644 node_modules/ansi-styles/index.js create mode 100644 node_modules/ansi-styles/license create mode 100644 node_modules/ansi-styles/package.json create mode 100644 node_modules/ansi-styles/readme.md create mode 100644 node_modules/any-promise/.jshintrc create mode 100644 node_modules/any-promise/.npmignore create mode 100644 node_modules/any-promise/LICENSE create mode 100644 node_modules/any-promise/README.md create mode 100644 node_modules/any-promise/implementation.d.ts create mode 100644 node_modules/any-promise/implementation.js create mode 100644 node_modules/any-promise/index.d.ts create mode 100644 node_modules/any-promise/index.js create mode 100644 node_modules/any-promise/loader.js create mode 100644 node_modules/any-promise/optional.js create mode 100644 node_modules/any-promise/package.json create mode 100644 node_modules/any-promise/register-shim.js create mode 100644 node_modules/any-promise/register.d.ts create mode 100644 node_modules/any-promise/register.js create mode 100644 node_modules/any-promise/register/bluebird.d.ts create mode 100644 node_modules/any-promise/register/bluebird.js create mode 100644 node_modules/any-promise/register/es6-promise.d.ts create mode 100644 node_modules/any-promise/register/es6-promise.js create mode 100644 node_modules/any-promise/register/lie.d.ts create mode 100644 node_modules/any-promise/register/lie.js create mode 100644 node_modules/any-promise/register/native-promise-only.d.ts create mode 100644 node_modules/any-promise/register/native-promise-only.js create mode 100644 node_modules/any-promise/register/pinkie.d.ts create mode 100644 node_modules/any-promise/register/pinkie.js create mode 100644 node_modules/any-promise/register/promise.d.ts create mode 100644 node_modules/any-promise/register/promise.js create mode 100644 node_modules/any-promise/register/q.d.ts create mode 100644 node_modules/any-promise/register/q.js create mode 100644 node_modules/any-promise/register/rsvp.d.ts create mode 100644 node_modules/any-promise/register/rsvp.js create mode 100644 node_modules/any-promise/register/vow.d.ts create mode 100644 node_modules/any-promise/register/vow.js create mode 100644 node_modules/any-promise/register/when.d.ts create mode 100644 node_modules/any-promise/register/when.js create mode 100644 node_modules/anymatch/LICENSE create mode 100644 node_modules/anymatch/README.md create mode 100644 node_modules/anymatch/index.d.ts create mode 100644 node_modules/anymatch/index.js create mode 100644 node_modules/anymatch/package.json create mode 100644 node_modules/arg/LICENSE.md create mode 100644 node_modules/arg/README.md create mode 100644 node_modules/arg/index.d.ts create mode 100644 node_modules/arg/index.js create mode 100644 node_modules/arg/package.json create mode 100755 node_modules/axobject-query/LICENSE create mode 100644 node_modules/axobject-query/README.md create mode 100644 node_modules/axobject-query/lib/AXObjectElementMap.js create mode 100644 node_modules/axobject-query/lib/AXObjectRoleMap.js create mode 100644 node_modules/axobject-query/lib/AXObjectsMap.js create mode 100644 node_modules/axobject-query/lib/elementAXObjectMap.js create mode 100644 node_modules/axobject-query/lib/etc/objects/AbbrRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/AlertDialogRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/AlertRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/AnnotationRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ApplicationRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ArticleRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/AudioRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/BannerRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/BlockquoteRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/BusyIndicatorRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ButtonRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/CanvasRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/CaptionRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/CellRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/CheckBoxRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ColorWellRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ColumnHeaderRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ColumnRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ComboBoxRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ComplementaryRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ContentInfoRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DateRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DateTimeRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DefinitionRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DescriptionListDetailRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DescriptionListRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DescriptionListTermRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DetailsRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DialogRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DirectoryRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DisclosureTriangleRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DivRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/DocumentRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/EmbeddedObjectRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/FeedRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/FigcaptionRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/FigureRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/FooterRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/FormRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/GridRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/GroupRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/HeadingRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/IframePresentationalRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/IframeRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/IgnoredRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ImageMapLinkRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ImageMapRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ImageRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/InlineTextBoxRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/InputTimeRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/LabelRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/LegendRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/LineBreakRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/LinkRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ListBoxOptionRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ListBoxRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ListItemRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ListMarkerRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ListRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/LogRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MainRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MarkRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MarqueeRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MathRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MenuBarRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MenuButtonRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MenuItemCheckBoxRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MenuItemRadioRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MenuItemRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MenuListOptionRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MenuListPopupRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MenuRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/MeterRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/NavigationRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/NoneRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/NoteRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/OutlineRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ParagraphRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/PopUpButtonRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/PreRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/PresentationalRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ProgressIndicatorRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/RadioButtonRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/RadioGroupRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/RegionRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/RootWebAreaRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/RowHeaderRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/RowRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/RubyRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/RulerRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/SVGRootRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ScrollAreaRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ScrollBarRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/SeamlessWebAreaRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/SearchBoxRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/SearchRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/SliderRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/SliderThumbRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/SpinButtonPartRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/SpinButtonRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/SplitterRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/StaticTextRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/StatusRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/SwitchRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TabGroupRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TabListRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TabPanelRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TabRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TableHeaderContainerRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TableRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TermRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TextAreaRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TextFieldRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TimeRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TimerRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ToggleButtonRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/ToolbarRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TreeGridRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TreeItemRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/TreeRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/UserInterfaceTooltipRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/VideoRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/WebAreaRole.js create mode 100644 node_modules/axobject-query/lib/etc/objects/WindowRole.js create mode 100644 node_modules/axobject-query/lib/index.js create mode 100644 node_modules/axobject-query/lib/util/iterationDecorator.js create mode 100644 node_modules/axobject-query/lib/util/iteratorProxy.js create mode 100644 node_modules/axobject-query/package.json create mode 100644 node_modules/balanced-match/.github/FUNDING.yml create mode 100644 node_modules/balanced-match/LICENSE.md create mode 100644 node_modules/balanced-match/README.md create mode 100644 node_modules/balanced-match/index.js create mode 100644 node_modules/balanced-match/package.json create mode 100644 node_modules/brace-expansion/.github/FUNDING.yml create mode 100644 node_modules/brace-expansion/LICENSE create mode 100644 node_modules/brace-expansion/README.md create mode 100644 node_modules/brace-expansion/index.js create mode 100644 node_modules/brace-expansion/package.json create mode 100644 node_modules/braces/LICENSE create mode 100644 node_modules/braces/README.md create mode 100644 node_modules/braces/index.js create mode 100644 node_modules/braces/lib/compile.js create mode 100644 node_modules/braces/lib/constants.js create mode 100644 node_modules/braces/lib/expand.js create mode 100644 node_modules/braces/lib/parse.js create mode 100644 node_modules/braces/lib/stringify.js create mode 100644 node_modules/braces/lib/utils.js create mode 100644 node_modules/braces/package.json create mode 100644 node_modules/camelcase-css/README.md create mode 100644 node_modules/camelcase-css/index-es5.js create mode 100644 node_modules/camelcase-css/index.js create mode 100644 node_modules/camelcase-css/license create mode 100644 node_modules/camelcase-css/package.json create mode 100644 node_modules/color-convert/CHANGELOG.md create mode 100644 node_modules/color-convert/LICENSE create mode 100644 node_modules/color-convert/README.md create mode 100644 node_modules/color-convert/conversions.js create mode 100644 node_modules/color-convert/index.js create mode 100644 node_modules/color-convert/package.json create mode 100644 node_modules/color-convert/route.js create mode 100644 node_modules/color-name/LICENSE create mode 100644 node_modules/color-name/README.md create mode 100644 node_modules/color-name/index.js create mode 100644 node_modules/color-name/package.json create mode 100644 node_modules/commander/CHANGELOG.md create mode 100644 node_modules/commander/LICENSE create mode 100644 node_modules/commander/Readme.md create mode 100644 node_modules/commander/index.js create mode 100644 node_modules/commander/package.json create mode 100644 node_modules/commander/typings/index.d.ts create mode 100644 node_modules/commondir/LICENSE create mode 100644 node_modules/commondir/example/dir.js create mode 100644 node_modules/commondir/index.js create mode 100644 node_modules/commondir/package.json create mode 100644 node_modules/commondir/readme.markdown create mode 100644 node_modules/commondir/test/dirs.js create mode 100644 node_modules/concat-map/.travis.yml create mode 100644 node_modules/concat-map/LICENSE create mode 100644 node_modules/concat-map/README.markdown create mode 100644 node_modules/concat-map/example/map.js create mode 100644 node_modules/concat-map/index.js create mode 100644 node_modules/concat-map/package.json create mode 100644 node_modules/concat-map/test/map.js create mode 100644 node_modules/cookie/HISTORY.md create mode 100644 node_modules/cookie/LICENSE create mode 100644 node_modules/cookie/README.md create mode 100644 node_modules/cookie/SECURITY.md create mode 100644 node_modules/cookie/index.js create mode 100644 node_modules/cookie/package.json create mode 100644 node_modules/css-selector-tokenizer/LICENSE create mode 100644 node_modules/css-selector-tokenizer/README.md create mode 100644 node_modules/css-selector-tokenizer/lib/index.js create mode 100644 node_modules/css-selector-tokenizer/lib/parse.js create mode 100644 node_modules/css-selector-tokenizer/lib/parseValues.js create mode 100644 node_modules/css-selector-tokenizer/lib/stringify.js create mode 100644 node_modules/css-selector-tokenizer/lib/stringifyValues.js create mode 100644 node_modules/css-selector-tokenizer/lib/uni-regexp.js create mode 100644 node_modules/css-selector-tokenizer/package.json create mode 100644 node_modules/cssesc/LICENSE-MIT.txt create mode 100644 node_modules/cssesc/README.md create mode 100755 node_modules/cssesc/bin/cssesc create mode 100644 node_modules/cssesc/cssesc.js create mode 100644 node_modules/cssesc/man/cssesc.1 create mode 100644 node_modules/cssesc/package.json create mode 100644 node_modules/deepmerge/.editorconfig create mode 100644 node_modules/deepmerge/.eslintcache create mode 100644 node_modules/deepmerge/changelog.md create mode 100644 node_modules/deepmerge/dist/cjs.js create mode 100644 node_modules/deepmerge/dist/umd.js create mode 100644 node_modules/deepmerge/index.d.ts create mode 100644 node_modules/deepmerge/index.js create mode 100644 node_modules/deepmerge/license.txt create mode 100644 node_modules/deepmerge/package.json create mode 100644 node_modules/deepmerge/readme.md create mode 100644 node_modules/deepmerge/rollup.config.js create mode 100644 node_modules/devalue/LICENSE create mode 100644 node_modules/devalue/README.md create mode 100644 node_modules/devalue/index.js create mode 100644 node_modules/devalue/package.json create mode 100644 node_modules/devalue/src/base64.js create mode 100644 node_modules/devalue/src/constants.js create mode 100644 node_modules/devalue/src/parse.js create mode 100644 node_modules/devalue/src/stringify.js create mode 100644 node_modules/devalue/src/types.d.ts create mode 100644 node_modules/devalue/src/uneval.js create mode 100644 node_modules/devalue/src/utils.js create mode 100644 node_modules/devalue/types/index.d.ts create mode 100644 node_modules/devalue/types/index.d.ts.map create mode 100644 node_modules/didyoumean/LICENSE create mode 100644 node_modules/didyoumean/README.md create mode 100644 node_modules/didyoumean/didYouMean-1.2.1.js create mode 100644 node_modules/didyoumean/didYouMean-1.2.1.min.js create mode 100755 node_modules/didyoumean/package.json create mode 100644 node_modules/dlv/README.md create mode 100644 node_modules/dlv/dist/dlv.es.js create mode 100644 node_modules/dlv/dist/dlv.es.js.map create mode 100644 node_modules/dlv/dist/dlv.js create mode 100644 node_modules/dlv/dist/dlv.js.map create mode 100644 node_modules/dlv/dist/dlv.umd.js create mode 100644 node_modules/dlv/dist/dlv.umd.js.map create mode 100644 node_modules/dlv/index.js create mode 100644 node_modules/dlv/package.json create mode 100644 node_modules/eastasianwidth/README.md create mode 100644 node_modules/eastasianwidth/eastasianwidth.js create mode 100644 node_modules/eastasianwidth/package.json create mode 100644 node_modules/email-addresses/.travis.yml create mode 100644 node_modules/email-addresses/Changes.md create mode 100644 node_modules/email-addresses/LICENSE create mode 100644 node_modules/email-addresses/README.md create mode 100644 node_modules/email-addresses/bower.json create mode 100644 node_modules/email-addresses/lib/email-addresses.d.ts create mode 100644 node_modules/email-addresses/lib/email-addresses.js create mode 100644 node_modules/email-addresses/lib/email-addresses.min.js create mode 100644 node_modules/email-addresses/package.json create mode 100644 node_modules/email-addresses/test/email-addresses.js create mode 100644 node_modules/email-addresses/test/is_email.js create mode 100644 node_modules/email-addresses/test/tests.xml create mode 100644 node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/emoji-regex/README.md create mode 100644 node_modules/emoji-regex/RGI_Emoji.d.ts create mode 100644 node_modules/emoji-regex/RGI_Emoji.js create mode 100644 node_modules/emoji-regex/es2015/RGI_Emoji.d.ts create mode 100644 node_modules/emoji-regex/es2015/RGI_Emoji.js create mode 100644 node_modules/emoji-regex/es2015/index.d.ts create mode 100644 node_modules/emoji-regex/es2015/index.js create mode 100644 node_modules/emoji-regex/es2015/text.d.ts create mode 100644 node_modules/emoji-regex/es2015/text.js create mode 100644 node_modules/emoji-regex/index.d.ts create mode 100644 node_modules/emoji-regex/index.js create mode 100644 node_modules/emoji-regex/package.json create mode 100644 node_modules/emoji-regex/text.d.ts create mode 100644 node_modules/emoji-regex/text.js create mode 100644 node_modules/escape-string-regexp/index.js create mode 100644 node_modules/escape-string-regexp/license create mode 100644 node_modules/escape-string-regexp/package.json create mode 100644 node_modules/escape-string-regexp/readme.md create mode 100644 node_modules/estree-walker/CHANGELOG.md create mode 100644 node_modules/estree-walker/LICENSE create mode 100644 node_modules/estree-walker/README.md create mode 100644 node_modules/estree-walker/dist/esm/estree-walker.js create mode 100644 node_modules/estree-walker/dist/esm/package.json create mode 100644 node_modules/estree-walker/dist/umd/estree-walker.js create mode 100644 node_modules/estree-walker/package.json create mode 100644 node_modules/estree-walker/src/async.js create mode 100644 node_modules/estree-walker/src/index.js create mode 100644 node_modules/estree-walker/src/package.json create mode 100644 node_modules/estree-walker/src/sync.js create mode 100644 node_modules/estree-walker/src/walker.js create mode 100644 node_modules/estree-walker/types/async.d.ts create mode 100644 node_modules/estree-walker/types/index.d.ts create mode 100644 node_modules/estree-walker/types/sync.d.ts create mode 100644 node_modules/estree-walker/types/tsconfig.tsbuildinfo create mode 100644 node_modules/estree-walker/types/walker.d.ts create mode 100644 node_modules/fast-glob/node_modules/glob-parent/CHANGELOG.md create mode 100644 node_modules/fast-glob/node_modules/glob-parent/LICENSE create mode 100644 node_modules/fast-glob/node_modules/glob-parent/README.md create mode 100644 node_modules/fast-glob/node_modules/glob-parent/index.js create mode 100644 node_modules/fast-glob/node_modules/glob-parent/package.json create mode 100644 node_modules/fastparse/LICENSE create mode 100644 node_modules/fastparse/README.md create mode 100644 node_modules/fastparse/lib/Parser.js create mode 100644 node_modules/fastparse/package.json create mode 100644 node_modules/filename-reserved-regex/index.js create mode 100644 node_modules/filename-reserved-regex/license create mode 100644 node_modules/filename-reserved-regex/package.json create mode 100644 node_modules/filename-reserved-regex/readme.md create mode 100644 node_modules/filenamify/filenamify-path.d.ts create mode 100644 node_modules/filenamify/filenamify-path.js create mode 100644 node_modules/filenamify/filenamify.d.ts create mode 100644 node_modules/filenamify/filenamify.js create mode 100644 node_modules/filenamify/index.d.ts create mode 100644 node_modules/filenamify/index.js create mode 100644 node_modules/filenamify/license create mode 100644 node_modules/filenamify/package.json create mode 100644 node_modules/filenamify/readme.md create mode 100644 node_modules/fill-range/LICENSE create mode 100644 node_modules/fill-range/README.md create mode 100644 node_modules/fill-range/index.js create mode 100644 node_modules/fill-range/package.json create mode 100644 node_modules/find-cache-dir/index.js create mode 100644 node_modules/find-cache-dir/license create mode 100644 node_modules/find-cache-dir/package.json create mode 100644 node_modules/find-cache-dir/readme.md create mode 100644 node_modules/find-up/index.d.ts create mode 100644 node_modules/find-up/index.js create mode 100644 node_modules/find-up/license create mode 100644 node_modules/find-up/package.json create mode 100644 node_modules/find-up/readme.md create mode 100644 node_modules/fs.realpath/LICENSE create mode 100644 node_modules/fs.realpath/README.md create mode 100644 node_modules/fs.realpath/index.js create mode 100644 node_modules/fs.realpath/old.js create mode 100644 node_modules/fs.realpath/package.json create mode 100644 node_modules/function-bind/.eslintrc create mode 100644 node_modules/function-bind/.github/FUNDING.yml create mode 100644 node_modules/function-bind/.github/SECURITY.md create mode 100644 node_modules/function-bind/.nycrc create mode 100644 node_modules/function-bind/CHANGELOG.md create mode 100644 node_modules/function-bind/LICENSE create mode 100644 node_modules/function-bind/README.md create mode 100644 node_modules/function-bind/implementation.js create mode 100644 node_modules/function-bind/index.js create mode 100644 node_modules/function-bind/package.json create mode 100644 node_modules/function-bind/test/.eslintrc create mode 100644 node_modules/function-bind/test/index.js create mode 100644 node_modules/glob-parent/LICENSE create mode 100644 node_modules/glob-parent/README.md create mode 100644 node_modules/glob-parent/index.js create mode 100644 node_modules/glob-parent/package.json create mode 100644 node_modules/glob/LICENSE create mode 100644 node_modules/glob/README.md create mode 100644 node_modules/glob/common.js create mode 100644 node_modules/glob/glob.js create mode 100644 node_modules/glob/package.json create mode 100644 node_modules/glob/sync.js create mode 100644 node_modules/globalyzer/license create mode 100644 node_modules/globalyzer/package.json create mode 100644 node_modules/globalyzer/readme.md create mode 100644 node_modules/globalyzer/src/.DS_Store create mode 100644 node_modules/globalyzer/src/index.js create mode 100644 node_modules/globrex/index.js create mode 100644 node_modules/globrex/license create mode 100644 node_modules/globrex/package.json create mode 100644 node_modules/globrex/readme.md create mode 100644 node_modules/graceful-fs/LICENSE create mode 100644 node_modules/graceful-fs/README.md create mode 100644 node_modules/graceful-fs/clone.js create mode 100644 node_modules/graceful-fs/graceful-fs.js create mode 100644 node_modules/graceful-fs/legacy-streams.js create mode 100644 node_modules/graceful-fs/package.json create mode 100644 node_modules/graceful-fs/polyfills.js create mode 100644 node_modules/hasown/.eslintrc create mode 100644 node_modules/hasown/.github/FUNDING.yml create mode 100644 node_modules/hasown/.nycrc create mode 100644 node_modules/hasown/CHANGELOG.md create mode 100644 node_modules/hasown/LICENSE create mode 100644 node_modules/hasown/README.md create mode 100644 node_modules/hasown/index.d.ts create mode 100644 node_modules/hasown/index.js create mode 100644 node_modules/hasown/package.json create mode 100644 node_modules/hasown/tsconfig.json create mode 100644 node_modules/import-meta-resolve/index.d.ts create mode 100644 node_modules/import-meta-resolve/index.js create mode 100644 node_modules/import-meta-resolve/lib/errors.d.ts create mode 100644 node_modules/import-meta-resolve/lib/errors.js create mode 100644 node_modules/import-meta-resolve/lib/get-format.d.ts create mode 100644 node_modules/import-meta-resolve/lib/get-format.js create mode 100644 node_modules/import-meta-resolve/lib/package-json-reader.d.ts create mode 100644 node_modules/import-meta-resolve/lib/package-json-reader.js create mode 100644 node_modules/import-meta-resolve/lib/resolve.d.ts create mode 100644 node_modules/import-meta-resolve/lib/resolve.js create mode 100644 node_modules/import-meta-resolve/lib/utils.d.ts create mode 100644 node_modules/import-meta-resolve/lib/utils.js create mode 100644 node_modules/import-meta-resolve/license create mode 100644 node_modules/import-meta-resolve/package.json create mode 100644 node_modules/import-meta-resolve/readme.md create mode 100644 node_modules/inflight/LICENSE create mode 100644 node_modules/inflight/README.md create mode 100644 node_modules/inflight/inflight.js create mode 100644 node_modules/inflight/package.json create mode 100644 node_modules/inherits/LICENSE create mode 100644 node_modules/inherits/README.md create mode 100644 node_modules/inherits/inherits.js create mode 100644 node_modules/inherits/inherits_browser.js create mode 100644 node_modules/inherits/package.json create mode 100644 node_modules/is-binary-path/index.d.ts create mode 100644 node_modules/is-binary-path/index.js create mode 100644 node_modules/is-binary-path/license create mode 100644 node_modules/is-binary-path/package.json create mode 100644 node_modules/is-binary-path/readme.md create mode 100644 node_modules/is-extglob/LICENSE create mode 100644 node_modules/is-extglob/README.md create mode 100644 node_modules/is-extglob/index.js create mode 100644 node_modules/is-extglob/package.json create mode 100644 node_modules/is-fullwidth-code-point/index.d.ts create mode 100644 node_modules/is-fullwidth-code-point/index.js create mode 100644 node_modules/is-fullwidth-code-point/license create mode 100644 node_modules/is-fullwidth-code-point/package.json create mode 100644 node_modules/is-fullwidth-code-point/readme.md create mode 100644 node_modules/is-glob/LICENSE create mode 100644 node_modules/is-glob/README.md create mode 100644 node_modules/is-glob/index.js create mode 100644 node_modules/is-glob/package.json create mode 100644 node_modules/is-number/LICENSE create mode 100644 node_modules/is-number/README.md create mode 100644 node_modules/is-number/index.js create mode 100644 node_modules/is-number/package.json create mode 100644 node_modules/isexe/.npmignore create mode 100644 node_modules/isexe/LICENSE create mode 100644 node_modules/isexe/README.md create mode 100644 node_modules/isexe/index.js create mode 100644 node_modules/isexe/mode.js create mode 100644 node_modules/isexe/package.json create mode 100644 node_modules/isexe/test/basic.js create mode 100644 node_modules/isexe/windows.js create mode 100644 node_modules/jsonfile/CHANGELOG.md create mode 100644 node_modules/jsonfile/LICENSE create mode 100644 node_modules/jsonfile/README.md create mode 100644 node_modules/jsonfile/index.js create mode 100644 node_modules/jsonfile/package.json create mode 100644 node_modules/jsonfile/utils.js create mode 100644 node_modules/kleur/colors.d.ts create mode 100644 node_modules/kleur/colors.js create mode 100644 node_modules/kleur/colors.mjs create mode 100644 node_modules/kleur/index.d.ts create mode 100644 node_modules/kleur/index.js create mode 100644 node_modules/kleur/index.mjs create mode 100644 node_modules/kleur/license create mode 100644 node_modules/kleur/package.json create mode 100644 node_modules/kleur/readme.md create mode 100644 node_modules/lines-and-columns/LICENSE create mode 100644 node_modules/lines-and-columns/README.md create mode 100644 node_modules/lines-and-columns/build/index.d.ts create mode 100644 node_modules/lines-and-columns/build/index.js create mode 100644 node_modules/lines-and-columns/package.json create mode 100644 node_modules/locate-character/README.md create mode 100644 node_modules/locate-character/package.json create mode 100644 node_modules/locate-character/src/index.js create mode 100644 node_modules/locate-character/src/types.d.ts create mode 100644 node_modules/locate-character/types/index.d.ts create mode 100644 node_modules/locate-character/types/index.d.ts.map create mode 100644 node_modules/locate-path/index.d.ts create mode 100644 node_modules/locate-path/index.js create mode 100644 node_modules/locate-path/license create mode 100644 node_modules/locate-path/package.json create mode 100644 node_modules/locate-path/readme.md create mode 100644 node_modules/make-dir/index.d.ts create mode 100644 node_modules/make-dir/index.js create mode 100644 node_modules/make-dir/license create mode 100644 node_modules/make-dir/node_modules/semver/LICENSE create mode 100644 node_modules/make-dir/node_modules/semver/README.md create mode 100755 node_modules/make-dir/node_modules/semver/bin/semver.js create mode 100644 node_modules/make-dir/node_modules/semver/package.json create mode 100644 node_modules/make-dir/node_modules/semver/range.bnf create mode 100644 node_modules/make-dir/node_modules/semver/semver.js create mode 100644 node_modules/make-dir/package.json create mode 100644 node_modules/make-dir/readme.md create mode 100644 node_modules/merge2/LICENSE create mode 100644 node_modules/merge2/README.md create mode 100644 node_modules/merge2/index.js create mode 100644 node_modules/merge2/package.json create mode 100755 node_modules/micromatch/LICENSE create mode 100644 node_modules/micromatch/README.md create mode 100644 node_modules/micromatch/index.js create mode 100644 node_modules/micromatch/package.json create mode 100644 node_modules/minimatch/LICENSE create mode 100644 node_modules/minimatch/README.md create mode 100644 node_modules/minimatch/lib/path.js create mode 100644 node_modules/minimatch/minimatch.js create mode 100644 node_modules/minimatch/package.json create mode 100644 node_modules/minipass/LICENSE create mode 100644 node_modules/minipass/README.md create mode 100644 node_modules/minipass/dist/commonjs/index.d.ts create mode 100644 node_modules/minipass/dist/commonjs/index.d.ts.map create mode 100644 node_modules/minipass/dist/commonjs/index.js create mode 100644 node_modules/minipass/dist/commonjs/index.js.map create mode 100644 node_modules/minipass/dist/commonjs/package.json create mode 100644 node_modules/minipass/dist/esm/index.d.ts create mode 100644 node_modules/minipass/dist/esm/index.d.ts.map create mode 100644 node_modules/minipass/dist/esm/index.js create mode 100644 node_modules/minipass/dist/esm/index.js.map create mode 100644 node_modules/minipass/dist/esm/package.json create mode 100644 node_modules/minipass/package.json create mode 100644 node_modules/mri/index.d.ts create mode 100644 node_modules/mri/lib/index.js create mode 100644 node_modules/mri/lib/index.mjs create mode 100644 node_modules/mri/license.md create mode 100644 node_modules/mri/package.json create mode 100644 node_modules/mri/readme.md create mode 100644 node_modules/mrmime/index.d.ts create mode 100644 node_modules/mrmime/index.js create mode 100644 node_modules/mrmime/index.mjs create mode 100644 node_modules/mrmime/license create mode 100644 node_modules/mrmime/package.json create mode 100644 node_modules/mrmime/readme.md create mode 100644 node_modules/ms/index.js create mode 100644 node_modules/ms/license.md create mode 100644 node_modules/ms/package.json create mode 100644 node_modules/ms/readme.md create mode 100644 node_modules/mz/HISTORY.md create mode 100644 node_modules/mz/LICENSE create mode 100644 node_modules/mz/README.md create mode 100644 node_modules/mz/child_process.js create mode 100644 node_modules/mz/crypto.js create mode 100644 node_modules/mz/dns.js create mode 100644 node_modules/mz/fs.js create mode 100644 node_modules/mz/index.js create mode 100644 node_modules/mz/package.json create mode 100644 node_modules/mz/readline.js create mode 100644 node_modules/mz/zlib.js create mode 100644 node_modules/nanoid/.devcontainer.json create mode 100644 node_modules/nanoid/LICENSE create mode 100644 node_modules/nanoid/README.md create mode 100644 node_modules/nanoid/async/index.browser.cjs create mode 100644 node_modules/nanoid/async/index.browser.js create mode 100644 node_modules/nanoid/async/index.cjs create mode 100644 node_modules/nanoid/async/index.d.ts create mode 100644 node_modules/nanoid/async/index.js create mode 100644 node_modules/nanoid/async/index.native.js create mode 100644 node_modules/nanoid/async/package.json create mode 100755 node_modules/nanoid/bin/nanoid.cjs create mode 100644 node_modules/nanoid/index.browser.cjs create mode 100644 node_modules/nanoid/index.browser.js create mode 100644 node_modules/nanoid/index.cjs create mode 100644 node_modules/nanoid/index.d.cts create mode 100644 node_modules/nanoid/index.d.ts create mode 100644 node_modules/nanoid/index.js create mode 100644 node_modules/nanoid/nanoid.js create mode 100644 node_modules/nanoid/non-secure/index.cjs create mode 100644 node_modules/nanoid/non-secure/index.d.ts create mode 100644 node_modules/nanoid/non-secure/index.js create mode 100644 node_modules/nanoid/non-secure/package.json create mode 100644 node_modules/nanoid/package.json create mode 100644 node_modules/nanoid/url-alphabet/index.cjs create mode 100644 node_modules/nanoid/url-alphabet/index.js create mode 100644 node_modules/nanoid/url-alphabet/package.json create mode 100644 node_modules/normalize-path/LICENSE create mode 100644 node_modules/normalize-path/README.md create mode 100644 node_modules/normalize-path/index.js create mode 100644 node_modules/normalize-path/package.json create mode 100644 node_modules/normalize-range/index.js create mode 100644 node_modules/normalize-range/license create mode 100644 node_modules/normalize-range/package.json create mode 100644 node_modules/normalize-range/readme.md create mode 100644 node_modules/npm/LICENSE create mode 100644 node_modules/npm/README.md create mode 100755 node_modules/npm/bin/node-gyp-bin/node-gyp create mode 100755 node_modules/npm/bin/node-gyp-bin/node-gyp.cmd create mode 100755 node_modules/npm/bin/npm create mode 100755 node_modules/npm/bin/npm-cli.js create mode 100755 node_modules/npm/bin/npm-prefix.js create mode 100755 node_modules/npm/bin/npm.cmd create mode 100644 node_modules/npm/bin/npm.ps1 create mode 100755 node_modules/npm/bin/npx create mode 100755 node_modules/npm/bin/npx-cli.js create mode 100755 node_modules/npm/bin/npx.cmd create mode 100644 node_modules/npm/bin/npx.ps1 create mode 100644 node_modules/npm/docs/content/commands/npm-access.md create mode 100644 node_modules/npm/docs/content/commands/npm-adduser.md create mode 100644 node_modules/npm/docs/content/commands/npm-audit.md create mode 100644 node_modules/npm/docs/content/commands/npm-bugs.md create mode 100644 node_modules/npm/docs/content/commands/npm-cache.md create mode 100644 node_modules/npm/docs/content/commands/npm-ci.md create mode 100644 node_modules/npm/docs/content/commands/npm-completion.md create mode 100644 node_modules/npm/docs/content/commands/npm-config.md create mode 100644 node_modules/npm/docs/content/commands/npm-dedupe.md create mode 100644 node_modules/npm/docs/content/commands/npm-deprecate.md create mode 100644 node_modules/npm/docs/content/commands/npm-diff.md create mode 100644 node_modules/npm/docs/content/commands/npm-dist-tag.md create mode 100644 node_modules/npm/docs/content/commands/npm-docs.md create mode 100644 node_modules/npm/docs/content/commands/npm-doctor.md create mode 100644 node_modules/npm/docs/content/commands/npm-edit.md create mode 100644 node_modules/npm/docs/content/commands/npm-exec.md create mode 100644 node_modules/npm/docs/content/commands/npm-explain.md create mode 100644 node_modules/npm/docs/content/commands/npm-explore.md create mode 100644 node_modules/npm/docs/content/commands/npm-find-dupes.md create mode 100644 node_modules/npm/docs/content/commands/npm-fund.md create mode 100644 node_modules/npm/docs/content/commands/npm-help-search.md create mode 100644 node_modules/npm/docs/content/commands/npm-help.md create mode 100644 node_modules/npm/docs/content/commands/npm-init.md create mode 100644 node_modules/npm/docs/content/commands/npm-install-ci-test.md create mode 100644 node_modules/npm/docs/content/commands/npm-install-test.md create mode 100644 node_modules/npm/docs/content/commands/npm-install.md create mode 100644 node_modules/npm/docs/content/commands/npm-link.md create mode 100644 node_modules/npm/docs/content/commands/npm-login.md create mode 100644 node_modules/npm/docs/content/commands/npm-logout.md create mode 100644 node_modules/npm/docs/content/commands/npm-ls.md create mode 100644 node_modules/npm/docs/content/commands/npm-org.md create mode 100644 node_modules/npm/docs/content/commands/npm-outdated.md create mode 100644 node_modules/npm/docs/content/commands/npm-owner.md create mode 100644 node_modules/npm/docs/content/commands/npm-pack.md create mode 100644 node_modules/npm/docs/content/commands/npm-ping.md create mode 100644 node_modules/npm/docs/content/commands/npm-pkg.md create mode 100644 node_modules/npm/docs/content/commands/npm-prefix.md create mode 100644 node_modules/npm/docs/content/commands/npm-profile.md create mode 100644 node_modules/npm/docs/content/commands/npm-prune.md create mode 100644 node_modules/npm/docs/content/commands/npm-publish.md create mode 100644 node_modules/npm/docs/content/commands/npm-query.md create mode 100644 node_modules/npm/docs/content/commands/npm-rebuild.md create mode 100644 node_modules/npm/docs/content/commands/npm-repo.md create mode 100644 node_modules/npm/docs/content/commands/npm-restart.md create mode 100644 node_modules/npm/docs/content/commands/npm-root.md create mode 100644 node_modules/npm/docs/content/commands/npm-run-script.md create mode 100644 node_modules/npm/docs/content/commands/npm-sbom.md create mode 100644 node_modules/npm/docs/content/commands/npm-search.md create mode 100644 node_modules/npm/docs/content/commands/npm-shrinkwrap.md create mode 100644 node_modules/npm/docs/content/commands/npm-star.md create mode 100644 node_modules/npm/docs/content/commands/npm-stars.md create mode 100644 node_modules/npm/docs/content/commands/npm-start.md create mode 100644 node_modules/npm/docs/content/commands/npm-stop.md create mode 100644 node_modules/npm/docs/content/commands/npm-team.md create mode 100644 node_modules/npm/docs/content/commands/npm-test.md create mode 100644 node_modules/npm/docs/content/commands/npm-token.md create mode 100644 node_modules/npm/docs/content/commands/npm-uninstall.md create mode 100644 node_modules/npm/docs/content/commands/npm-unpublish.md create mode 100644 node_modules/npm/docs/content/commands/npm-unstar.md create mode 100644 node_modules/npm/docs/content/commands/npm-update.md create mode 100644 node_modules/npm/docs/content/commands/npm-version.md create mode 100644 node_modules/npm/docs/content/commands/npm-view.md create mode 100644 node_modules/npm/docs/content/commands/npm-whoami.md create mode 100644 node_modules/npm/docs/content/commands/npm.md create mode 100644 node_modules/npm/docs/content/commands/npx.md create mode 100644 node_modules/npm/docs/content/configuring-npm/folders.md create mode 100644 node_modules/npm/docs/content/configuring-npm/install.md create mode 100644 node_modules/npm/docs/content/configuring-npm/npm-shrinkwrap-json.md create mode 100644 node_modules/npm/docs/content/configuring-npm/npmrc.md create mode 100644 node_modules/npm/docs/content/configuring-npm/package-json.md create mode 100644 node_modules/npm/docs/content/configuring-npm/package-lock-json.md create mode 100644 node_modules/npm/docs/content/using-npm/config.md create mode 100644 node_modules/npm/docs/content/using-npm/dependency-selectors.md create mode 100644 node_modules/npm/docs/content/using-npm/developers.md create mode 100644 node_modules/npm/docs/content/using-npm/logging.md create mode 100644 node_modules/npm/docs/content/using-npm/orgs.md create mode 100644 node_modules/npm/docs/content/using-npm/package-spec.md create mode 100644 node_modules/npm/docs/content/using-npm/registry.md create mode 100644 node_modules/npm/docs/content/using-npm/removal.md create mode 100644 node_modules/npm/docs/content/using-npm/scope.md create mode 100644 node_modules/npm/docs/content/using-npm/scripts.md create mode 100644 node_modules/npm/docs/content/using-npm/workspaces.md create mode 100644 node_modules/npm/docs/lib/index.js create mode 100644 node_modules/npm/docs/output/commands/npm-access.html create mode 100644 node_modules/npm/docs/output/commands/npm-adduser.html create mode 100644 node_modules/npm/docs/output/commands/npm-audit.html create mode 100644 node_modules/npm/docs/output/commands/npm-bugs.html create mode 100644 node_modules/npm/docs/output/commands/npm-cache.html create mode 100644 node_modules/npm/docs/output/commands/npm-ci.html create mode 100644 node_modules/npm/docs/output/commands/npm-completion.html create mode 100644 node_modules/npm/docs/output/commands/npm-config.html create mode 100644 node_modules/npm/docs/output/commands/npm-dedupe.html create mode 100644 node_modules/npm/docs/output/commands/npm-deprecate.html create mode 100644 node_modules/npm/docs/output/commands/npm-diff.html create mode 100644 node_modules/npm/docs/output/commands/npm-dist-tag.html create mode 100644 node_modules/npm/docs/output/commands/npm-docs.html create mode 100644 node_modules/npm/docs/output/commands/npm-doctor.html create mode 100644 node_modules/npm/docs/output/commands/npm-edit.html create mode 100644 node_modules/npm/docs/output/commands/npm-exec.html create mode 100644 node_modules/npm/docs/output/commands/npm-explain.html create mode 100644 node_modules/npm/docs/output/commands/npm-explore.html create mode 100644 node_modules/npm/docs/output/commands/npm-find-dupes.html create mode 100644 node_modules/npm/docs/output/commands/npm-fund.html create mode 100644 node_modules/npm/docs/output/commands/npm-help-search.html create mode 100644 node_modules/npm/docs/output/commands/npm-help.html create mode 100644 node_modules/npm/docs/output/commands/npm-init.html create mode 100644 node_modules/npm/docs/output/commands/npm-install-ci-test.html create mode 100644 node_modules/npm/docs/output/commands/npm-install-test.html create mode 100644 node_modules/npm/docs/output/commands/npm-install.html create mode 100644 node_modules/npm/docs/output/commands/npm-link.html create mode 100644 node_modules/npm/docs/output/commands/npm-login.html create mode 100644 node_modules/npm/docs/output/commands/npm-logout.html create mode 100644 node_modules/npm/docs/output/commands/npm-ls.html create mode 100644 node_modules/npm/docs/output/commands/npm-org.html create mode 100644 node_modules/npm/docs/output/commands/npm-outdated.html create mode 100644 node_modules/npm/docs/output/commands/npm-owner.html create mode 100644 node_modules/npm/docs/output/commands/npm-pack.html create mode 100644 node_modules/npm/docs/output/commands/npm-ping.html create mode 100644 node_modules/npm/docs/output/commands/npm-pkg.html create mode 100644 node_modules/npm/docs/output/commands/npm-prefix.html create mode 100644 node_modules/npm/docs/output/commands/npm-profile.html create mode 100644 node_modules/npm/docs/output/commands/npm-prune.html create mode 100644 node_modules/npm/docs/output/commands/npm-publish.html create mode 100644 node_modules/npm/docs/output/commands/npm-query.html create mode 100644 node_modules/npm/docs/output/commands/npm-rebuild.html create mode 100644 node_modules/npm/docs/output/commands/npm-repo.html create mode 100644 node_modules/npm/docs/output/commands/npm-restart.html create mode 100644 node_modules/npm/docs/output/commands/npm-root.html create mode 100644 node_modules/npm/docs/output/commands/npm-run-script.html create mode 100644 node_modules/npm/docs/output/commands/npm-sbom.html create mode 100644 node_modules/npm/docs/output/commands/npm-search.html create mode 100644 node_modules/npm/docs/output/commands/npm-shrinkwrap.html create mode 100644 node_modules/npm/docs/output/commands/npm-star.html create mode 100644 node_modules/npm/docs/output/commands/npm-stars.html create mode 100644 node_modules/npm/docs/output/commands/npm-start.html create mode 100644 node_modules/npm/docs/output/commands/npm-stop.html create mode 100644 node_modules/npm/docs/output/commands/npm-team.html create mode 100644 node_modules/npm/docs/output/commands/npm-test.html create mode 100644 node_modules/npm/docs/output/commands/npm-token.html create mode 100644 node_modules/npm/docs/output/commands/npm-uninstall.html create mode 100644 node_modules/npm/docs/output/commands/npm-unpublish.html create mode 100644 node_modules/npm/docs/output/commands/npm-unstar.html create mode 100644 node_modules/npm/docs/output/commands/npm-update.html create mode 100644 node_modules/npm/docs/output/commands/npm-version.html create mode 100644 node_modules/npm/docs/output/commands/npm-view.html create mode 100644 node_modules/npm/docs/output/commands/npm-whoami.html create mode 100644 node_modules/npm/docs/output/commands/npm.html create mode 100644 node_modules/npm/docs/output/commands/npx.html create mode 100644 node_modules/npm/docs/output/configuring-npm/folders.html create mode 100644 node_modules/npm/docs/output/configuring-npm/install.html create mode 100644 node_modules/npm/docs/output/configuring-npm/npm-global.html create mode 100644 node_modules/npm/docs/output/configuring-npm/npm-json.html create mode 100644 node_modules/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html create mode 100644 node_modules/npm/docs/output/configuring-npm/npmrc.html create mode 100644 node_modules/npm/docs/output/configuring-npm/package-json.html create mode 100644 node_modules/npm/docs/output/configuring-npm/package-lock-json.html create mode 100644 node_modules/npm/docs/output/using-npm/config.html create mode 100644 node_modules/npm/docs/output/using-npm/dependency-selectors.html create mode 100644 node_modules/npm/docs/output/using-npm/developers.html create mode 100644 node_modules/npm/docs/output/using-npm/logging.html create mode 100644 node_modules/npm/docs/output/using-npm/orgs.html create mode 100644 node_modules/npm/docs/output/using-npm/package-spec.html create mode 100644 node_modules/npm/docs/output/using-npm/registry.html create mode 100644 node_modules/npm/docs/output/using-npm/removal.html create mode 100644 node_modules/npm/docs/output/using-npm/scope.html create mode 100644 node_modules/npm/docs/output/using-npm/scripts.html create mode 100644 node_modules/npm/docs/output/using-npm/workspaces.html create mode 100644 node_modules/npm/index.js create mode 100644 node_modules/npm/lib/arborist-cmd.js create mode 100644 node_modules/npm/lib/base-cmd.js create mode 100644 node_modules/npm/lib/cli.js create mode 100644 node_modules/npm/lib/cli/entry.js create mode 100644 node_modules/npm/lib/cli/exit-handler.js create mode 100644 node_modules/npm/lib/cli/update-notifier.js create mode 100644 node_modules/npm/lib/cli/validate-engines.js create mode 100644 node_modules/npm/lib/commands/access.js create mode 100644 node_modules/npm/lib/commands/adduser.js create mode 100644 node_modules/npm/lib/commands/audit.js create mode 100644 node_modules/npm/lib/commands/bugs.js create mode 100644 node_modules/npm/lib/commands/cache.js create mode 100644 node_modules/npm/lib/commands/ci.js create mode 100644 node_modules/npm/lib/commands/completion.js create mode 100644 node_modules/npm/lib/commands/config.js create mode 100644 node_modules/npm/lib/commands/dedupe.js create mode 100644 node_modules/npm/lib/commands/deprecate.js create mode 100644 node_modules/npm/lib/commands/diff.js create mode 100644 node_modules/npm/lib/commands/dist-tag.js create mode 100644 node_modules/npm/lib/commands/docs.js create mode 100644 node_modules/npm/lib/commands/doctor.js create mode 100644 node_modules/npm/lib/commands/edit.js create mode 100644 node_modules/npm/lib/commands/exec.js create mode 100644 node_modules/npm/lib/commands/explain.js create mode 100644 node_modules/npm/lib/commands/explore.js create mode 100644 node_modules/npm/lib/commands/find-dupes.js create mode 100644 node_modules/npm/lib/commands/fund.js create mode 100644 node_modules/npm/lib/commands/get.js create mode 100644 node_modules/npm/lib/commands/help-search.js create mode 100644 node_modules/npm/lib/commands/help.js create mode 100644 node_modules/npm/lib/commands/init.js create mode 100644 node_modules/npm/lib/commands/install-ci-test.js create mode 100644 node_modules/npm/lib/commands/install-test.js create mode 100644 node_modules/npm/lib/commands/install.js create mode 100644 node_modules/npm/lib/commands/link.js create mode 100644 node_modules/npm/lib/commands/ll.js create mode 100644 node_modules/npm/lib/commands/login.js create mode 100644 node_modules/npm/lib/commands/logout.js create mode 100644 node_modules/npm/lib/commands/ls.js create mode 100644 node_modules/npm/lib/commands/org.js create mode 100644 node_modules/npm/lib/commands/outdated.js create mode 100644 node_modules/npm/lib/commands/owner.js create mode 100644 node_modules/npm/lib/commands/pack.js create mode 100644 node_modules/npm/lib/commands/ping.js create mode 100644 node_modules/npm/lib/commands/pkg.js create mode 100644 node_modules/npm/lib/commands/prefix.js create mode 100644 node_modules/npm/lib/commands/profile.js create mode 100644 node_modules/npm/lib/commands/prune.js create mode 100644 node_modules/npm/lib/commands/publish.js create mode 100644 node_modules/npm/lib/commands/query.js create mode 100644 node_modules/npm/lib/commands/rebuild.js create mode 100644 node_modules/npm/lib/commands/repo.js create mode 100644 node_modules/npm/lib/commands/restart.js create mode 100644 node_modules/npm/lib/commands/root.js create mode 100644 node_modules/npm/lib/commands/run-script.js create mode 100644 node_modules/npm/lib/commands/sbom.js create mode 100644 node_modules/npm/lib/commands/search.js create mode 100644 node_modules/npm/lib/commands/set.js create mode 100644 node_modules/npm/lib/commands/shrinkwrap.js create mode 100644 node_modules/npm/lib/commands/star.js create mode 100644 node_modules/npm/lib/commands/stars.js create mode 100644 node_modules/npm/lib/commands/start.js create mode 100644 node_modules/npm/lib/commands/stop.js create mode 100644 node_modules/npm/lib/commands/team.js create mode 100644 node_modules/npm/lib/commands/test.js create mode 100644 node_modules/npm/lib/commands/token.js create mode 100644 node_modules/npm/lib/commands/uninstall.js create mode 100644 node_modules/npm/lib/commands/unpublish.js create mode 100644 node_modules/npm/lib/commands/unstar.js create mode 100644 node_modules/npm/lib/commands/update.js create mode 100644 node_modules/npm/lib/commands/version.js create mode 100644 node_modules/npm/lib/commands/view.js create mode 100644 node_modules/npm/lib/commands/whoami.js create mode 100644 node_modules/npm/lib/lifecycle-cmd.js create mode 100644 node_modules/npm/lib/npm.js create mode 100644 node_modules/npm/lib/package-url-cmd.js create mode 100644 node_modules/npm/lib/utils/audit-error.js create mode 100644 node_modules/npm/lib/utils/auth.js create mode 100644 node_modules/npm/lib/utils/cmd-list.js create mode 100644 node_modules/npm/lib/utils/completion.fish create mode 100755 node_modules/npm/lib/utils/completion.sh create mode 100644 node_modules/npm/lib/utils/did-you-mean.js create mode 100644 node_modules/npm/lib/utils/display.js create mode 100644 node_modules/npm/lib/utils/error-message.js create mode 100644 node_modules/npm/lib/utils/explain-dep.js create mode 100644 node_modules/npm/lib/utils/explain-eresolve.js create mode 100644 node_modules/npm/lib/utils/format-bytes.js create mode 100644 node_modules/npm/lib/utils/format-search-stream.js create mode 100644 node_modules/npm/lib/utils/format.js create mode 100644 node_modules/npm/lib/utils/get-identity.js create mode 100644 node_modules/npm/lib/utils/get-workspaces.js create mode 100644 node_modules/npm/lib/utils/installed-deep.js create mode 100644 node_modules/npm/lib/utils/installed-shallow.js create mode 100644 node_modules/npm/lib/utils/is-windows.js create mode 100644 node_modules/npm/lib/utils/log-file.js create mode 100644 node_modules/npm/lib/utils/npm-usage.js create mode 100644 node_modules/npm/lib/utils/open-url.js create mode 100644 node_modules/npm/lib/utils/output-error.js create mode 100644 node_modules/npm/lib/utils/ping.js create mode 100644 node_modules/npm/lib/utils/queryable.js create mode 100644 node_modules/npm/lib/utils/read-user-info.js create mode 100644 node_modules/npm/lib/utils/reify-finish.js create mode 100644 node_modules/npm/lib/utils/reify-output.js create mode 100644 node_modules/npm/lib/utils/sbom-cyclonedx.js create mode 100644 node_modules/npm/lib/utils/sbom-spdx.js create mode 100644 node_modules/npm/lib/utils/tar.js create mode 100644 node_modules/npm/lib/utils/timers.js create mode 100644 node_modules/npm/lib/utils/update-workspaces.js create mode 100644 node_modules/npm/lib/utils/validate-lockfile.js create mode 100644 node_modules/npm/lib/utils/verify-signatures.js create mode 100644 node_modules/npm/man/man1/npm-access.1 create mode 100644 node_modules/npm/man/man1/npm-adduser.1 create mode 100644 node_modules/npm/man/man1/npm-audit.1 create mode 100644 node_modules/npm/man/man1/npm-bugs.1 create mode 100644 node_modules/npm/man/man1/npm-cache.1 create mode 100644 node_modules/npm/man/man1/npm-ci.1 create mode 100644 node_modules/npm/man/man1/npm-completion.1 create mode 100644 node_modules/npm/man/man1/npm-config.1 create mode 100644 node_modules/npm/man/man1/npm-dedupe.1 create mode 100644 node_modules/npm/man/man1/npm-deprecate.1 create mode 100644 node_modules/npm/man/man1/npm-diff.1 create mode 100644 node_modules/npm/man/man1/npm-dist-tag.1 create mode 100644 node_modules/npm/man/man1/npm-docs.1 create mode 100644 node_modules/npm/man/man1/npm-doctor.1 create mode 100644 node_modules/npm/man/man1/npm-edit.1 create mode 100644 node_modules/npm/man/man1/npm-exec.1 create mode 100644 node_modules/npm/man/man1/npm-explain.1 create mode 100644 node_modules/npm/man/man1/npm-explore.1 create mode 100644 node_modules/npm/man/man1/npm-find-dupes.1 create mode 100644 node_modules/npm/man/man1/npm-fund.1 create mode 100644 node_modules/npm/man/man1/npm-help-search.1 create mode 100644 node_modules/npm/man/man1/npm-help.1 create mode 100644 node_modules/npm/man/man1/npm-init.1 create mode 100644 node_modules/npm/man/man1/npm-install-ci-test.1 create mode 100644 node_modules/npm/man/man1/npm-install-test.1 create mode 100644 node_modules/npm/man/man1/npm-install.1 create mode 100644 node_modules/npm/man/man1/npm-link.1 create mode 100644 node_modules/npm/man/man1/npm-login.1 create mode 100644 node_modules/npm/man/man1/npm-logout.1 create mode 100644 node_modules/npm/man/man1/npm-ls.1 create mode 100644 node_modules/npm/man/man1/npm-org.1 create mode 100644 node_modules/npm/man/man1/npm-outdated.1 create mode 100644 node_modules/npm/man/man1/npm-owner.1 create mode 100644 node_modules/npm/man/man1/npm-pack.1 create mode 100644 node_modules/npm/man/man1/npm-ping.1 create mode 100644 node_modules/npm/man/man1/npm-pkg.1 create mode 100644 node_modules/npm/man/man1/npm-prefix.1 create mode 100644 node_modules/npm/man/man1/npm-profile.1 create mode 100644 node_modules/npm/man/man1/npm-prune.1 create mode 100644 node_modules/npm/man/man1/npm-publish.1 create mode 100644 node_modules/npm/man/man1/npm-query.1 create mode 100644 node_modules/npm/man/man1/npm-rebuild.1 create mode 100644 node_modules/npm/man/man1/npm-repo.1 create mode 100644 node_modules/npm/man/man1/npm-restart.1 create mode 100644 node_modules/npm/man/man1/npm-root.1 create mode 100644 node_modules/npm/man/man1/npm-run-script.1 create mode 100644 node_modules/npm/man/man1/npm-sbom.1 create mode 100644 node_modules/npm/man/man1/npm-search.1 create mode 100644 node_modules/npm/man/man1/npm-shrinkwrap.1 create mode 100644 node_modules/npm/man/man1/npm-star.1 create mode 100644 node_modules/npm/man/man1/npm-stars.1 create mode 100644 node_modules/npm/man/man1/npm-start.1 create mode 100644 node_modules/npm/man/man1/npm-stop.1 create mode 100644 node_modules/npm/man/man1/npm-team.1 create mode 100644 node_modules/npm/man/man1/npm-test.1 create mode 100644 node_modules/npm/man/man1/npm-token.1 create mode 100644 node_modules/npm/man/man1/npm-uninstall.1 create mode 100644 node_modules/npm/man/man1/npm-unpublish.1 create mode 100644 node_modules/npm/man/man1/npm-unstar.1 create mode 100644 node_modules/npm/man/man1/npm-update.1 create mode 100644 node_modules/npm/man/man1/npm-version.1 create mode 100644 node_modules/npm/man/man1/npm-view.1 create mode 100644 node_modules/npm/man/man1/npm-whoami.1 create mode 100644 node_modules/npm/man/man1/npm.1 create mode 100644 node_modules/npm/man/man1/npx.1 create mode 100644 node_modules/npm/man/man5/folders.5 create mode 100644 node_modules/npm/man/man5/install.5 create mode 100644 node_modules/npm/man/man5/npm-global.5 create mode 100644 node_modules/npm/man/man5/npm-json.5 create mode 100644 node_modules/npm/man/man5/npm-shrinkwrap-json.5 create mode 100644 node_modules/npm/man/man5/npmrc.5 create mode 100644 node_modules/npm/man/man5/package-json.5 create mode 100644 node_modules/npm/man/man5/package-lock-json.5 create mode 100644 node_modules/npm/man/man7/config.7 create mode 100644 node_modules/npm/man/man7/dependency-selectors.7 create mode 100644 node_modules/npm/man/man7/developers.7 create mode 100644 node_modules/npm/man/man7/logging.7 create mode 100644 node_modules/npm/man/man7/orgs.7 create mode 100644 node_modules/npm/man/man7/package-spec.7 create mode 100644 node_modules/npm/man/man7/registry.7 create mode 100644 node_modules/npm/man/man7/removal.7 create mode 100644 node_modules/npm/man/man7/scope.7 create mode 100644 node_modules/npm/man/man7/scripts.7 create mode 100644 node_modules/npm/man/man7/workspaces.7 create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/LICENSE.txt create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/build/index.cjs create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/build/index.d.cts create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/build/lib/index.js create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/index.mjs create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/index.js create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/license create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/package.json create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/RGI_Emoji.js create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/RGI_Emoji.js create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/index.js create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/text.js create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/index.js create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/package.json create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/text.js create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/index.js create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/license create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/package.json create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/index.js create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/license create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/package.json create mode 100644 node_modules/npm/node_modules/@isaacs/cliui/package.json create mode 100644 node_modules/npm/node_modules/@isaacs/fs-minipass/LICENSE create mode 100644 node_modules/npm/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/@isaacs/fs-minipass/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/@isaacs/fs-minipass/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/@isaacs/fs-minipass/package.json create mode 100644 node_modules/npm/node_modules/@isaacs/string-locale-compare/LICENSE create mode 100644 node_modules/npm/node_modules/@isaacs/string-locale-compare/index.js create mode 100644 node_modules/npm/node_modules/@isaacs/string-locale-compare/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/agent/lib/agents.js create mode 100644 node_modules/npm/node_modules/@npmcli/agent/lib/dns.js create mode 100644 node_modules/npm/node_modules/@npmcli/agent/lib/errors.js create mode 100644 node_modules/npm/node_modules/@npmcli/agent/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/agent/lib/options.js create mode 100644 node_modules/npm/node_modules/@npmcli/agent/lib/proxy.js create mode 100644 node_modules/npm/node_modules/@npmcli/agent/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/LICENSE.md create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/README.md create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/actual.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/audit.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/funding.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/ideal.js create mode 100755 node_modules/npm/node_modules/@npmcli/arborist/bin/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/lib/logging.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/lib/options.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/lib/print-tree.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/lib/timers.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/license.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/prune.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/reify.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/shrinkwrap.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/bin/virtual.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/isolated-reifier.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/case-insensitive-map.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/consistent-resolve.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/debug.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/deepest-nesting-target.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/dep-valid.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/diff.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/edge.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/from-path.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/gather-dep-set.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/inventory.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/link.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/node.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/optional-set.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/override-resolves.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/override-set.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/packument-cache.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/peer-entry-sets.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/printable.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/query-selector-all.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/realpath.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/relpath.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/reset-dep-flags.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/retire-path.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/signal-handling.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/signals.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/spec-from-lock.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/tree-check.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/vuln.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js create mode 100644 node_modules/npm/node_modules/@npmcli/arborist/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/config/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/config/README.md create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/definitions/definition.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/definitions/definitions.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/definitions/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/env-replace.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/errors.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/nerf-dart.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/parse-field.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/set-envs.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/type-defs.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/type-description.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/lib/umask.js create mode 100644 node_modules/npm/node_modules/@npmcli/config/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/fs/LICENSE.md create mode 100644 node_modules/npm/node_modules/@npmcli/fs/lib/common/get-options.js create mode 100644 node_modules/npm/node_modules/@npmcli/fs/lib/common/node.js create mode 100644 node_modules/npm/node_modules/@npmcli/fs/lib/cp/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/fs/lib/cp/errors.js create mode 100644 node_modules/npm/node_modules/@npmcli/fs/lib/cp/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/fs/lib/cp/polyfill.js create mode 100644 node_modules/npm/node_modules/@npmcli/fs/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/fs/lib/move-file.js create mode 100644 node_modules/npm/node_modules/@npmcli/fs/lib/readdir-scoped.js create mode 100644 node_modules/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js create mode 100644 node_modules/npm/node_modules/@npmcli/fs/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/git/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/clone.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/errors.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/find.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/is-clean.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/is.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/lines-to-revs.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/make-error.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/opts.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/revs.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/spawn.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/utils.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/lib/which.js create mode 100644 node_modules/npm/node_modules/@npmcli/git/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/installed-package-contents/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/installed-package-contents/README.md create mode 100755 node_modules/npm/node_modules/@npmcli/installed-package-contents/bin/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/installed-package-contents/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/installed-package-contents/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/map-workspaces/LICENSE.md create mode 100644 node_modules/npm/node_modules/@npmcli/map-workspaces/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/map-workspaces/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/metavuln-calculator/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js create mode 100644 node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/get-dep-spec.js create mode 100644 node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/hash.js create mode 100644 node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/metavuln-calculator/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/name-from-folder/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/name-from-folder/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/name-from-folder/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/node-gyp/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/node-gyp/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/node-gyp/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/package-json/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/package-json/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/package-json/lib/normalize.js create mode 100644 node_modules/npm/node_modules/@npmcli/package-json/lib/read-package.js create mode 100644 node_modules/npm/node_modules/@npmcli/package-json/lib/sort.js create mode 100644 node_modules/npm/node_modules/@npmcli/package-json/lib/update-dependencies.js create mode 100644 node_modules/npm/node_modules/@npmcli/package-json/lib/update-scripts.js create mode 100644 node_modules/npm/node_modules/@npmcli/package-json/lib/update-workspaces.js create mode 100644 node_modules/npm/node_modules/@npmcli/package-json/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/promise-spawn/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/promise-spawn/lib/escape.js create mode 100644 node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/promise-spawn/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/query/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/query/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/query/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/redact/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/redact/lib/deep-map.js create mode 100644 node_modules/npm/node_modules/@npmcli/redact/lib/index.js create mode 100644 node_modules/npm/node_modules/@npmcli/redact/lib/matchers.js create mode 100644 node_modules/npm/node_modules/@npmcli/redact/lib/server.js create mode 100644 node_modules/npm/node_modules/@npmcli/redact/lib/utils.js create mode 100644 node_modules/npm/node_modules/@npmcli/redact/package.json create mode 100644 node_modules/npm/node_modules/@npmcli/run-script/LICENSE create mode 100644 node_modules/npm/node_modules/@npmcli/run-script/lib/is-server-package.js create mode 100644 node_modules/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js create mode 100755 node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp create mode 100755 node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd create mode 100644 node_modules/npm/node_modules/@npmcli/run-script/lib/package-envs.js create mode 100644 node_modules/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js create mode 100644 node_modules/npm/node_modules/@npmcli/run-script/lib/run-script.js create mode 100644 node_modules/npm/node_modules/@npmcli/run-script/lib/set-path.js create mode 100644 node_modules/npm/node_modules/@npmcli/run-script/lib/signal-manager.js create mode 100644 node_modules/npm/node_modules/@npmcli/run-script/lib/validate-options.js create mode 100644 node_modules/npm/node_modules/@npmcli/run-script/package.json create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/LICENSE create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/examples/is-default-value.js create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/examples/negate.js create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/index.js create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/internal/errors.js create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/internal/primordials.js create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/internal/util.js create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/internal/validators.js create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/package.json create mode 100644 node_modules/npm/node_modules/@pkgjs/parseargs/utils.js create mode 100644 node_modules/npm/node_modules/@sigstore/bundle/LICENSE create mode 100644 node_modules/npm/node_modules/@sigstore/bundle/dist/build.js create mode 100644 node_modules/npm/node_modules/@sigstore/bundle/dist/bundle.js create mode 100644 node_modules/npm/node_modules/@sigstore/bundle/dist/error.js create mode 100644 node_modules/npm/node_modules/@sigstore/bundle/dist/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/bundle/dist/serialized.js create mode 100644 node_modules/npm/node_modules/@sigstore/bundle/dist/utility.js create mode 100644 node_modules/npm/node_modules/@sigstore/bundle/dist/validate.js create mode 100644 node_modules/npm/node_modules/@sigstore/bundle/package.json create mode 100644 node_modules/npm/node_modules/@sigstore/core/LICENSE create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/asn1/error.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/asn1/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/asn1/length.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/asn1/obj.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/asn1/parse.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/asn1/tag.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/crypto.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/dsse.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/encoding.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/json.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/oid.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/pem.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/error.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/timestamp.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/stream.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/x509/cert.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/x509/ext.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/x509/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/dist/x509/sct.js create mode 100644 node_modules/npm/node_modules/@sigstore/core/package.json create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/LICENSE create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/events.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/api/field_behavior.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/any.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/descriptor.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/protobuf-specs/package.json create mode 100644 node_modules/npm/node_modules/@sigstore/sign/LICENSE create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/bundler/base.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/bundler/bundle.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/bundler/dsse.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/bundler/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/bundler/message.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/error.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/external/error.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/external/fetch.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/external/fulcio.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/external/rekor.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/external/tsa.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/identity/ci.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/identity/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/identity/provider.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ca.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ephemeral.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/signer/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/signer/signer.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/types/fetch.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/util/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/util/oidc.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/util/ua.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/witness/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/client.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/entry.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/witness/tsa/client.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/witness/tsa/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/dist/witness/witness.js create mode 100644 node_modules/npm/node_modules/@sigstore/sign/package.json create mode 100644 node_modules/npm/node_modules/@sigstore/tuf/LICENSE create mode 100644 node_modules/npm/node_modules/@sigstore/tuf/dist/appdata.js create mode 100644 node_modules/npm/node_modules/@sigstore/tuf/dist/client.js create mode 100644 node_modules/npm/node_modules/@sigstore/tuf/dist/error.js create mode 100644 node_modules/npm/node_modules/@sigstore/tuf/dist/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/tuf/dist/target.js create mode 100644 node_modules/npm/node_modules/@sigstore/tuf/package.json create mode 100644 node_modules/npm/node_modules/@sigstore/tuf/seeds.json create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/bundle/dsse.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/bundle/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/bundle/message.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/error.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/key/certificate.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/key/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/key/sct.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/policy.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/shared.types.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/checkpoint.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/merkle.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/set.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/tsa.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/tlog/dsse.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/tlog/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/tlog/intoto.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/trust/filter.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/trust/index.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/trust/trust.types.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/dist/verifier.js create mode 100644 node_modules/npm/node_modules/@sigstore/verify/package.json create mode 100644 node_modules/npm/node_modules/@tufjs/canonical-json/LICENSE create mode 100644 node_modules/npm/node_modules/@tufjs/canonical-json/lib/index.js create mode 100644 node_modules/npm/node_modules/@tufjs/canonical-json/package.json create mode 100644 node_modules/npm/node_modules/@tufjs/models/LICENSE create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/base.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/delegations.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/error.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/file.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/index.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/key.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/metadata.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/role.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/root.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/signature.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/snapshot.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/targets.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/timestamp.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/utils/guard.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/utils/index.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/utils/key.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/utils/oid.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/utils/types.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/dist/utils/verify.js create mode 100644 node_modules/npm/node_modules/@tufjs/models/package.json create mode 100644 node_modules/npm/node_modules/abbrev/LICENSE create mode 100644 node_modules/npm/node_modules/abbrev/lib/index.js create mode 100644 node_modules/npm/node_modules/abbrev/package.json create mode 100644 node_modules/npm/node_modules/agent-base/LICENSE create mode 100644 node_modules/npm/node_modules/agent-base/dist/helpers.js create mode 100644 node_modules/npm/node_modules/agent-base/dist/index.js create mode 100644 node_modules/npm/node_modules/agent-base/package.json create mode 100644 node_modules/npm/node_modules/ansi-regex/index.js create mode 100644 node_modules/npm/node_modules/ansi-regex/license create mode 100644 node_modules/npm/node_modules/ansi-regex/package.json create mode 100644 node_modules/npm/node_modules/ansi-styles/index.js create mode 100644 node_modules/npm/node_modules/ansi-styles/license create mode 100644 node_modules/npm/node_modules/ansi-styles/package.json create mode 100644 node_modules/npm/node_modules/aproba/LICENSE create mode 100644 node_modules/npm/node_modules/aproba/index.js create mode 100644 node_modules/npm/node_modules/aproba/package.json create mode 100644 node_modules/npm/node_modules/archy/LICENSE create mode 100644 node_modules/npm/node_modules/archy/examples/beep.js create mode 100644 node_modules/npm/node_modules/archy/examples/multi_line.js create mode 100644 node_modules/npm/node_modules/archy/index.js create mode 100644 node_modules/npm/node_modules/archy/package.json create mode 100644 node_modules/npm/node_modules/archy/test/beep.js create mode 100644 node_modules/npm/node_modules/archy/test/multi_line.js create mode 100644 node_modules/npm/node_modules/archy/test/non_unicode.js create mode 100644 node_modules/npm/node_modules/balanced-match/LICENSE.md create mode 100644 node_modules/npm/node_modules/balanced-match/index.js create mode 100644 node_modules/npm/node_modules/balanced-match/package.json create mode 100644 node_modules/npm/node_modules/bin-links/LICENSE create mode 100644 node_modules/npm/node_modules/bin-links/lib/bin-target.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/check-bin.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/check-bins.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/fix-bin.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/get-node-modules.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/get-paths.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/get-prefix.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/index.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/is-windows.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/link-bin.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/link-bins.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/link-gently.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/link-mans.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/man-target.js create mode 100644 node_modules/npm/node_modules/bin-links/lib/shim-bin.js create mode 100644 node_modules/npm/node_modules/bin-links/package.json create mode 100644 node_modules/npm/node_modules/binary-extensions/binary-extensions.json create mode 100644 node_modules/npm/node_modules/binary-extensions/index.js create mode 100644 node_modules/npm/node_modules/binary-extensions/license create mode 100644 node_modules/npm/node_modules/binary-extensions/package.json create mode 100644 node_modules/npm/node_modules/brace-expansion/LICENSE create mode 100644 node_modules/npm/node_modules/brace-expansion/index.js create mode 100644 node_modules/npm/node_modules/brace-expansion/package.json create mode 100644 node_modules/npm/node_modules/cacache/LICENSE.md create mode 100644 node_modules/npm/node_modules/cacache/lib/content/path.js create mode 100644 node_modules/npm/node_modules/cacache/lib/content/read.js create mode 100644 node_modules/npm/node_modules/cacache/lib/content/rm.js create mode 100644 node_modules/npm/node_modules/cacache/lib/content/write.js create mode 100644 node_modules/npm/node_modules/cacache/lib/entry-index.js create mode 100644 node_modules/npm/node_modules/cacache/lib/get.js create mode 100644 node_modules/npm/node_modules/cacache/lib/index.js create mode 100644 node_modules/npm/node_modules/cacache/lib/memoization.js create mode 100644 node_modules/npm/node_modules/cacache/lib/put.js create mode 100644 node_modules/npm/node_modules/cacache/lib/rm.js create mode 100644 node_modules/npm/node_modules/cacache/lib/util/glob.js create mode 100644 node_modules/npm/node_modules/cacache/lib/util/hash-to-segments.js create mode 100644 node_modules/npm/node_modules/cacache/lib/util/tmp.js create mode 100644 node_modules/npm/node_modules/cacache/lib/verify.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/chownr/LICENSE.md create mode 100644 node_modules/npm/node_modules/cacache/node_modules/chownr/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/chownr/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/chownr/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/chownr/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/chownr/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/minizlib/LICENSE create mode 100644 node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/constants.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/constants.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/minizlib/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/LICENSE create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.d.ts.map create mode 100755 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.d.ts create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.d.ts.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.js.map create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/mkdirp/readme.markdown create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/LICENSE create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/create.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/cwd-error.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/extract.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/get-write-flag.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/header.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/large-numbers.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/list.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/make-command.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/mkdir.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/mode-fix.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/normalize-unicode.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/normalize-windows-path.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/options.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/pack.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/parse.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/path-reservations.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/pax.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/read-entry.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/replace.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/strip-absolute-path.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/strip-trailing-slashes.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/symlink-error.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/types.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/unpack.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/update.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/warn-method.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/winchars.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/write-entry.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/create.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/cwd-error.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/extract.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/get-write-flag.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/header.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/large-numbers.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/list.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/make-command.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/mkdir.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/mode-fix.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/normalize-unicode.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/normalize-windows-path.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/options.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/pack.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/parse.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/path-reservations.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/pax.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/read-entry.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/replace.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/strip-absolute-path.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/strip-trailing-slashes.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/symlink-error.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/types.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/unpack.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/update.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/warn-method.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/winchars.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/write-entry.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/tar/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/yallist/LICENSE.md create mode 100644 node_modules/npm/node_modules/cacache/node_modules/yallist/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/yallist/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/yallist/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/cacache/node_modules/yallist/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/cacache/node_modules/yallist/package.json create mode 100644 node_modules/npm/node_modules/cacache/package.json create mode 100644 node_modules/npm/node_modules/chalk/license create mode 100644 node_modules/npm/node_modules/chalk/package.json create mode 100644 node_modules/npm/node_modules/chalk/source/index.js create mode 100644 node_modules/npm/node_modules/chalk/source/utilities.js create mode 100644 node_modules/npm/node_modules/chalk/source/vendor/ansi-styles/index.js create mode 100644 node_modules/npm/node_modules/chalk/source/vendor/supports-color/browser.js create mode 100644 node_modules/npm/node_modules/chalk/source/vendor/supports-color/index.js create mode 100644 node_modules/npm/node_modules/chownr/LICENSE create mode 100644 node_modules/npm/node_modules/chownr/chownr.js create mode 100644 node_modules/npm/node_modules/chownr/package.json create mode 100644 node_modules/npm/node_modules/ci-info/LICENSE create mode 100644 node_modules/npm/node_modules/ci-info/index.js create mode 100644 node_modules/npm/node_modules/ci-info/package.json create mode 100644 node_modules/npm/node_modules/ci-info/vendors.json create mode 100644 node_modules/npm/node_modules/cidr-regex/LICENSE create mode 100644 node_modules/npm/node_modules/cidr-regex/dist/index.js create mode 100644 node_modules/npm/node_modules/cidr-regex/package.json create mode 100644 node_modules/npm/node_modules/cli-columns/color.js create mode 100644 node_modules/npm/node_modules/cli-columns/index.js create mode 100644 node_modules/npm/node_modules/cli-columns/license create mode 100644 node_modules/npm/node_modules/cli-columns/package.json create mode 100644 node_modules/npm/node_modules/cli-columns/test.js create mode 100644 node_modules/npm/node_modules/cmd-shim/LICENSE create mode 100644 node_modules/npm/node_modules/cmd-shim/lib/index.js create mode 100644 node_modules/npm/node_modules/cmd-shim/lib/to-batch-syntax.js create mode 100644 node_modules/npm/node_modules/cmd-shim/package.json create mode 100644 node_modules/npm/node_modules/color-convert/LICENSE create mode 100644 node_modules/npm/node_modules/color-convert/conversions.js create mode 100644 node_modules/npm/node_modules/color-convert/index.js create mode 100644 node_modules/npm/node_modules/color-convert/package.json create mode 100644 node_modules/npm/node_modules/color-convert/route.js create mode 100644 node_modules/npm/node_modules/color-name/LICENSE create mode 100644 node_modules/npm/node_modules/color-name/index.js create mode 100644 node_modules/npm/node_modules/color-name/package.json create mode 100644 node_modules/npm/node_modules/common-ancestor-path/LICENSE create mode 100644 node_modules/npm/node_modules/common-ancestor-path/index.js create mode 100644 node_modules/npm/node_modules/common-ancestor-path/package.json create mode 100644 node_modules/npm/node_modules/cross-spawn/LICENSE create mode 100644 node_modules/npm/node_modules/cross-spawn/index.js create mode 100644 node_modules/npm/node_modules/cross-spawn/lib/enoent.js create mode 100644 node_modules/npm/node_modules/cross-spawn/lib/parse.js create mode 100644 node_modules/npm/node_modules/cross-spawn/lib/util/escape.js create mode 100644 node_modules/npm/node_modules/cross-spawn/lib/util/readShebang.js create mode 100644 node_modules/npm/node_modules/cross-spawn/lib/util/resolveCommand.js create mode 100644 node_modules/npm/node_modules/cross-spawn/node_modules/which/LICENSE create mode 100644 node_modules/npm/node_modules/cross-spawn/node_modules/which/README.md create mode 100755 node_modules/npm/node_modules/cross-spawn/node_modules/which/bin/node-which create mode 100644 node_modules/npm/node_modules/cross-spawn/node_modules/which/package.json create mode 100644 node_modules/npm/node_modules/cross-spawn/node_modules/which/which.js create mode 100644 node_modules/npm/node_modules/cross-spawn/package.json create mode 100644 node_modules/npm/node_modules/cssesc/LICENSE-MIT.txt create mode 100644 node_modules/npm/node_modules/cssesc/README.md create mode 100755 node_modules/npm/node_modules/cssesc/bin/cssesc create mode 100644 node_modules/npm/node_modules/cssesc/cssesc.js create mode 100644 node_modules/npm/node_modules/cssesc/man/cssesc.1 create mode 100644 node_modules/npm/node_modules/cssesc/package.json create mode 100644 node_modules/npm/node_modules/debug/LICENSE create mode 100644 node_modules/npm/node_modules/debug/package.json create mode 100644 node_modules/npm/node_modules/debug/src/browser.js create mode 100644 node_modules/npm/node_modules/debug/src/common.js create mode 100644 node_modules/npm/node_modules/debug/src/index.js create mode 100644 node_modules/npm/node_modules/debug/src/node.js create mode 100644 node_modules/npm/node_modules/diff/CONTRIBUTING.md create mode 100644 node_modules/npm/node_modules/diff/LICENSE create mode 100644 node_modules/npm/node_modules/diff/dist/diff.js create mode 100644 node_modules/npm/node_modules/diff/dist/diff.min.js create mode 100644 node_modules/npm/node_modules/diff/lib/convert/dmp.js create mode 100644 node_modules/npm/node_modules/diff/lib/convert/xml.js create mode 100644 node_modules/npm/node_modules/diff/lib/diff/array.js create mode 100644 node_modules/npm/node_modules/diff/lib/diff/base.js create mode 100644 node_modules/npm/node_modules/diff/lib/diff/character.js create mode 100644 node_modules/npm/node_modules/diff/lib/diff/css.js create mode 100644 node_modules/npm/node_modules/diff/lib/diff/json.js create mode 100644 node_modules/npm/node_modules/diff/lib/diff/line.js create mode 100644 node_modules/npm/node_modules/diff/lib/diff/sentence.js create mode 100644 node_modules/npm/node_modules/diff/lib/diff/word.js create mode 100644 node_modules/npm/node_modules/diff/lib/index.es6.js create mode 100644 node_modules/npm/node_modules/diff/lib/index.js create mode 100644 node_modules/npm/node_modules/diff/lib/index.mjs create mode 100644 node_modules/npm/node_modules/diff/lib/patch/apply.js create mode 100644 node_modules/npm/node_modules/diff/lib/patch/create.js create mode 100644 node_modules/npm/node_modules/diff/lib/patch/line-endings.js create mode 100644 node_modules/npm/node_modules/diff/lib/patch/merge.js create mode 100644 node_modules/npm/node_modules/diff/lib/patch/parse.js create mode 100644 node_modules/npm/node_modules/diff/lib/patch/reverse.js create mode 100644 node_modules/npm/node_modules/diff/lib/util/array.js create mode 100644 node_modules/npm/node_modules/diff/lib/util/distance-iterator.js create mode 100644 node_modules/npm/node_modules/diff/lib/util/params.js create mode 100644 node_modules/npm/node_modules/diff/lib/util/string.js create mode 100644 node_modules/npm/node_modules/diff/package.json create mode 100644 node_modules/npm/node_modules/diff/release-notes.md create mode 100644 node_modules/npm/node_modules/diff/runtime.js create mode 100644 node_modules/npm/node_modules/eastasianwidth/eastasianwidth.js create mode 100644 node_modules/npm/node_modules/eastasianwidth/package.json create mode 100644 node_modules/npm/node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/npm/node_modules/emoji-regex/es2015/index.js create mode 100644 node_modules/npm/node_modules/emoji-regex/es2015/text.js create mode 100644 node_modules/npm/node_modules/emoji-regex/index.js create mode 100644 node_modules/npm/node_modules/emoji-regex/package.json create mode 100644 node_modules/npm/node_modules/emoji-regex/text.js create mode 100644 node_modules/npm/node_modules/encoding/LICENSE create mode 100644 node_modules/npm/node_modules/encoding/lib/encoding.js create mode 100644 node_modules/npm/node_modules/encoding/package.json create mode 100644 node_modules/npm/node_modules/encoding/test/test.js create mode 100644 node_modules/npm/node_modules/env-paths/index.js create mode 100644 node_modules/npm/node_modules/env-paths/license create mode 100644 node_modules/npm/node_modules/env-paths/package.json create mode 100644 node_modules/npm/node_modules/err-code/bower.json create mode 100644 node_modules/npm/node_modules/err-code/index.js create mode 100644 node_modules/npm/node_modules/err-code/index.umd.js create mode 100644 node_modules/npm/node_modules/err-code/package.json create mode 100644 node_modules/npm/node_modules/err-code/test/test.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/LICENSE create mode 100644 node_modules/npm/node_modules/exponential-backoff/dist/backoff.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/dist/delay/always/always.delay.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.base.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.factory.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.interface.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/dist/delay/skip-first/skip-first.delay.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/dist/jitter/full/full.jitter.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/dist/jitter/jitter.factory.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/dist/jitter/no/no.jitter.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/dist/options.js create mode 100644 node_modules/npm/node_modules/exponential-backoff/package.json create mode 100644 node_modules/npm/node_modules/fastest-levenshtein/LICENSE.md create mode 100644 node_modules/npm/node_modules/fastest-levenshtein/bench.js create mode 100644 node_modules/npm/node_modules/fastest-levenshtein/esm/mod.js create mode 100644 node_modules/npm/node_modules/fastest-levenshtein/mod.js create mode 100644 node_modules/npm/node_modules/fastest-levenshtein/package.json create mode 100644 node_modules/npm/node_modules/fastest-levenshtein/test.js create mode 100644 node_modules/npm/node_modules/foreground-child/LICENSE create mode 100644 node_modules/npm/node_modules/foreground-child/dist/commonjs/all-signals.js create mode 100644 node_modules/npm/node_modules/foreground-child/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/foreground-child/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/foreground-child/dist/commonjs/proxy-signals.js create mode 100644 node_modules/npm/node_modules/foreground-child/dist/commonjs/watchdog.js create mode 100644 node_modules/npm/node_modules/foreground-child/dist/esm/all-signals.js create mode 100644 node_modules/npm/node_modules/foreground-child/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/foreground-child/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/foreground-child/dist/esm/proxy-signals.js create mode 100644 node_modules/npm/node_modules/foreground-child/dist/esm/watchdog.js create mode 100644 node_modules/npm/node_modules/foreground-child/package.json create mode 100644 node_modules/npm/node_modules/fs-minipass/LICENSE create mode 100644 node_modules/npm/node_modules/fs-minipass/lib/index.js create mode 100644 node_modules/npm/node_modules/fs-minipass/package.json create mode 100644 node_modules/npm/node_modules/glob/LICENSE create mode 100644 node_modules/npm/node_modules/glob/README.md create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/glob.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/glob.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/glob.js create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/glob.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/has-magic.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/has-magic.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/has-magic.js create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/has-magic.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/ignore.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/ignore.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/ignore.js create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/ignore.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/index.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/index.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/index.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/pattern.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/pattern.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/pattern.js create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/pattern.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/processor.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/processor.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/processor.js create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/processor.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/walker.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/walker.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/walker.js create mode 100644 node_modules/npm/node_modules/glob/dist/commonjs/walker.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/bin.d.mts create mode 100644 node_modules/npm/node_modules/glob/dist/esm/bin.d.mts.map create mode 100755 node_modules/npm/node_modules/glob/dist/esm/bin.mjs create mode 100644 node_modules/npm/node_modules/glob/dist/esm/bin.mjs.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/glob.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/esm/glob.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/glob.js create mode 100644 node_modules/npm/node_modules/glob/dist/esm/glob.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/has-magic.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/esm/has-magic.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/has-magic.js create mode 100644 node_modules/npm/node_modules/glob/dist/esm/has-magic.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/ignore.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/esm/ignore.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/ignore.js create mode 100644 node_modules/npm/node_modules/glob/dist/esm/ignore.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/index.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/esm/index.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/glob/dist/esm/index.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/glob/dist/esm/pattern.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/esm/pattern.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/pattern.js create mode 100644 node_modules/npm/node_modules/glob/dist/esm/pattern.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/processor.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/esm/processor.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/processor.js create mode 100644 node_modules/npm/node_modules/glob/dist/esm/processor.js.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/walker.d.ts create mode 100644 node_modules/npm/node_modules/glob/dist/esm/walker.d.ts.map create mode 100644 node_modules/npm/node_modules/glob/dist/esm/walker.js create mode 100644 node_modules/npm/node_modules/glob/dist/esm/walker.js.map create mode 100644 node_modules/npm/node_modules/glob/package.json create mode 100644 node_modules/npm/node_modules/graceful-fs/LICENSE create mode 100644 node_modules/npm/node_modules/graceful-fs/clone.js create mode 100644 node_modules/npm/node_modules/graceful-fs/graceful-fs.js create mode 100644 node_modules/npm/node_modules/graceful-fs/legacy-streams.js create mode 100644 node_modules/npm/node_modules/graceful-fs/package.json create mode 100644 node_modules/npm/node_modules/graceful-fs/polyfills.js create mode 100644 node_modules/npm/node_modules/hosted-git-info/LICENSE create mode 100644 node_modules/npm/node_modules/hosted-git-info/lib/from-url.js create mode 100644 node_modules/npm/node_modules/hosted-git-info/lib/hosts.js create mode 100644 node_modules/npm/node_modules/hosted-git-info/lib/index.js create mode 100644 node_modules/npm/node_modules/hosted-git-info/lib/parse-url.js create mode 100644 node_modules/npm/node_modules/hosted-git-info/package.json create mode 100644 node_modules/npm/node_modules/http-cache-semantics/LICENSE create mode 100644 node_modules/npm/node_modules/http-cache-semantics/index.js create mode 100644 node_modules/npm/node_modules/http-cache-semantics/package.json create mode 100644 node_modules/npm/node_modules/http-proxy-agent/LICENSE create mode 100644 node_modules/npm/node_modules/http-proxy-agent/dist/index.js create mode 100644 node_modules/npm/node_modules/http-proxy-agent/package.json create mode 100644 node_modules/npm/node_modules/https-proxy-agent/LICENSE create mode 100644 node_modules/npm/node_modules/https-proxy-agent/dist/index.js create mode 100644 node_modules/npm/node_modules/https-proxy-agent/dist/parse-proxy-response.js create mode 100644 node_modules/npm/node_modules/https-proxy-agent/package.json create mode 100644 node_modules/npm/node_modules/iconv-lite/LICENSE create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/dbcs-codec.js create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/dbcs-data.js create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/index.js create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/internal.js create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/sbcs-codec.js create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/sbcs-data-generated.js create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/sbcs-data.js create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/tables/big5-added.json create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/tables/cp936.json create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/tables/cp949.json create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/tables/cp950.json create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/tables/eucjp.json create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/tables/gbk-added.json create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/tables/shiftjis.json create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/utf16.js create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/utf32.js create mode 100644 node_modules/npm/node_modules/iconv-lite/encodings/utf7.js create mode 100644 node_modules/npm/node_modules/iconv-lite/lib/bom-handling.js create mode 100644 node_modules/npm/node_modules/iconv-lite/lib/index.js create mode 100644 node_modules/npm/node_modules/iconv-lite/lib/streams.js create mode 100644 node_modules/npm/node_modules/iconv-lite/package.json create mode 100644 node_modules/npm/node_modules/ignore-walk/LICENSE create mode 100644 node_modules/npm/node_modules/ignore-walk/lib/index.js create mode 100644 node_modules/npm/node_modules/ignore-walk/package.json create mode 100644 node_modules/npm/node_modules/imurmurhash/imurmurhash.js create mode 100644 node_modules/npm/node_modules/imurmurhash/imurmurhash.min.js create mode 100644 node_modules/npm/node_modules/imurmurhash/package.json create mode 100644 node_modules/npm/node_modules/ini/LICENSE create mode 100644 node_modules/npm/node_modules/ini/lib/ini.js create mode 100644 node_modules/npm/node_modules/ini/package.json create mode 100644 node_modules/npm/node_modules/init-package-json/LICENSE.md create mode 100644 node_modules/npm/node_modules/init-package-json/lib/default-input.js create mode 100644 node_modules/npm/node_modules/init-package-json/lib/init-package-json.js create mode 100644 node_modules/npm/node_modules/init-package-json/package.json create mode 100644 node_modules/npm/node_modules/ip-address/LICENSE create mode 100644 node_modules/npm/node_modules/ip-address/dist/address-error.js create mode 100644 node_modules/npm/node_modules/ip-address/dist/common.js create mode 100644 node_modules/npm/node_modules/ip-address/dist/ip-address.js create mode 100644 node_modules/npm/node_modules/ip-address/dist/ipv4.js create mode 100644 node_modules/npm/node_modules/ip-address/dist/ipv6.js create mode 100644 node_modules/npm/node_modules/ip-address/dist/v4/constants.js create mode 100644 node_modules/npm/node_modules/ip-address/dist/v6/constants.js create mode 100644 node_modules/npm/node_modules/ip-address/dist/v6/helpers.js create mode 100644 node_modules/npm/node_modules/ip-address/dist/v6/regular-expressions.js create mode 100644 node_modules/npm/node_modules/ip-address/package.json create mode 100644 node_modules/npm/node_modules/ip-regex/index.js create mode 100644 node_modules/npm/node_modules/ip-regex/license create mode 100644 node_modules/npm/node_modules/ip-regex/package.json create mode 100644 node_modules/npm/node_modules/is-cidr/dist/index.js create mode 100644 node_modules/npm/node_modules/is-cidr/package.json create mode 100644 node_modules/npm/node_modules/is-fullwidth-code-point/index.js create mode 100644 node_modules/npm/node_modules/is-fullwidth-code-point/license create mode 100644 node_modules/npm/node_modules/is-fullwidth-code-point/package.json create mode 100644 node_modules/npm/node_modules/isexe/LICENSE create mode 100644 node_modules/npm/node_modules/isexe/index.js create mode 100644 node_modules/npm/node_modules/isexe/mode.js create mode 100644 node_modules/npm/node_modules/isexe/package.json create mode 100644 node_modules/npm/node_modules/isexe/test/basic.js create mode 100644 node_modules/npm/node_modules/isexe/windows.js create mode 100644 node_modules/npm/node_modules/jackspeak/LICENSE.md create mode 100644 node_modules/npm/node_modules/jackspeak/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/jackspeak/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/jackspeak/dist/commonjs/parse-args.js create mode 100644 node_modules/npm/node_modules/jackspeak/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/jackspeak/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/jackspeak/dist/esm/parse-args.js create mode 100644 node_modules/npm/node_modules/jackspeak/package.json create mode 100644 node_modules/npm/node_modules/jsbn/LICENSE create mode 100644 node_modules/npm/node_modules/jsbn/example.html create mode 100644 node_modules/npm/node_modules/jsbn/example.js create mode 100644 node_modules/npm/node_modules/jsbn/index.js create mode 100644 node_modules/npm/node_modules/jsbn/package.json create mode 100644 node_modules/npm/node_modules/jsbn/test/es6-import.js create mode 100644 node_modules/npm/node_modules/json-parse-even-better-errors/LICENSE.md create mode 100644 node_modules/npm/node_modules/json-parse-even-better-errors/lib/index.js create mode 100644 node_modules/npm/node_modules/json-parse-even-better-errors/package.json create mode 100644 node_modules/npm/node_modules/json-stringify-nice/LICENSE create mode 100644 node_modules/npm/node_modules/json-stringify-nice/index.js create mode 100644 node_modules/npm/node_modules/json-stringify-nice/package.json create mode 100644 node_modules/npm/node_modules/jsonparse/LICENSE create mode 100644 node_modules/npm/node_modules/jsonparse/bench.js create mode 100644 node_modules/npm/node_modules/jsonparse/examples/twitterfeed.js create mode 100644 node_modules/npm/node_modules/jsonparse/jsonparse.js create mode 100644 node_modules/npm/node_modules/jsonparse/package.json create mode 100644 node_modules/npm/node_modules/jsonparse/samplejson/basic.json create mode 100644 node_modules/npm/node_modules/jsonparse/samplejson/basic2.json create mode 100644 node_modules/npm/node_modules/jsonparse/test/big-token.js create mode 100644 node_modules/npm/node_modules/jsonparse/test/boundary.js create mode 100644 node_modules/npm/node_modules/jsonparse/test/offset.js create mode 100644 node_modules/npm/node_modules/jsonparse/test/primitives.js create mode 100644 node_modules/npm/node_modules/jsonparse/test/surrogate.js create mode 100644 node_modules/npm/node_modules/jsonparse/test/unvalid.js create mode 100644 node_modules/npm/node_modules/jsonparse/test/utf8.js create mode 100644 node_modules/npm/node_modules/just-diff-apply/LICENSE create mode 100644 node_modules/npm/node_modules/just-diff-apply/index.cjs create mode 100644 node_modules/npm/node_modules/just-diff-apply/index.mjs create mode 100644 node_modules/npm/node_modules/just-diff-apply/package.json create mode 100644 node_modules/npm/node_modules/just-diff-apply/rollup.config.js create mode 100644 node_modules/npm/node_modules/just-diff/LICENSE create mode 100644 node_modules/npm/node_modules/just-diff/index.cjs create mode 100644 node_modules/npm/node_modules/just-diff/index.mjs create mode 100644 node_modules/npm/node_modules/just-diff/package.json create mode 100644 node_modules/npm/node_modules/just-diff/rollup.config.js create mode 100644 node_modules/npm/node_modules/libnpmaccess/LICENSE create mode 100644 node_modules/npm/node_modules/libnpmaccess/README.md create mode 100644 node_modules/npm/node_modules/libnpmaccess/lib/index.js create mode 100644 node_modules/npm/node_modules/libnpmaccess/package.json create mode 100644 node_modules/npm/node_modules/libnpmdiff/LICENSE create mode 100644 node_modules/npm/node_modules/libnpmdiff/README.md create mode 100644 node_modules/npm/node_modules/libnpmdiff/lib/format-diff.js create mode 100644 node_modules/npm/node_modules/libnpmdiff/lib/index.js create mode 100644 node_modules/npm/node_modules/libnpmdiff/lib/should-print-patch.js create mode 100644 node_modules/npm/node_modules/libnpmdiff/lib/tarball.js create mode 100644 node_modules/npm/node_modules/libnpmdiff/lib/untar.js create mode 100644 node_modules/npm/node_modules/libnpmdiff/package.json create mode 100644 node_modules/npm/node_modules/libnpmexec/LICENSE create mode 100644 node_modules/npm/node_modules/libnpmexec/README.md create mode 100644 node_modules/npm/node_modules/libnpmexec/lib/file-exists.js create mode 100644 node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js create mode 100644 node_modules/npm/node_modules/libnpmexec/lib/index.js create mode 100644 node_modules/npm/node_modules/libnpmexec/lib/is-windows.js create mode 100644 node_modules/npm/node_modules/libnpmexec/lib/no-tty.js create mode 100644 node_modules/npm/node_modules/libnpmexec/lib/run-script.js create mode 100644 node_modules/npm/node_modules/libnpmexec/package.json create mode 100644 node_modules/npm/node_modules/libnpmfund/LICENSE create mode 100644 node_modules/npm/node_modules/libnpmfund/README.md create mode 100644 node_modules/npm/node_modules/libnpmfund/lib/index.js create mode 100644 node_modules/npm/node_modules/libnpmfund/package.json create mode 100644 node_modules/npm/node_modules/libnpmorg/LICENSE create mode 100644 node_modules/npm/node_modules/libnpmorg/README.md create mode 100644 node_modules/npm/node_modules/libnpmorg/lib/index.js create mode 100644 node_modules/npm/node_modules/libnpmorg/package.json create mode 100644 node_modules/npm/node_modules/libnpmpack/LICENSE create mode 100644 node_modules/npm/node_modules/libnpmpack/README.md create mode 100644 node_modules/npm/node_modules/libnpmpack/lib/index.js create mode 100644 node_modules/npm/node_modules/libnpmpack/package.json create mode 100644 node_modules/npm/node_modules/libnpmpublish/LICENSE create mode 100644 node_modules/npm/node_modules/libnpmpublish/README.md create mode 100644 node_modules/npm/node_modules/libnpmpublish/lib/index.js create mode 100644 node_modules/npm/node_modules/libnpmpublish/lib/provenance.js create mode 100644 node_modules/npm/node_modules/libnpmpublish/lib/publish.js create mode 100644 node_modules/npm/node_modules/libnpmpublish/lib/unpublish.js create mode 100644 node_modules/npm/node_modules/libnpmpublish/package.json create mode 100644 node_modules/npm/node_modules/libnpmsearch/LICENSE create mode 100644 node_modules/npm/node_modules/libnpmsearch/README.md create mode 100644 node_modules/npm/node_modules/libnpmsearch/lib/index.js create mode 100644 node_modules/npm/node_modules/libnpmsearch/package.json create mode 100644 node_modules/npm/node_modules/libnpmteam/LICENSE create mode 100644 node_modules/npm/node_modules/libnpmteam/README.md create mode 100644 node_modules/npm/node_modules/libnpmteam/lib/index.js create mode 100644 node_modules/npm/node_modules/libnpmteam/package.json create mode 100644 node_modules/npm/node_modules/libnpmversion/LICENSE create mode 100644 node_modules/npm/node_modules/libnpmversion/README.md create mode 100644 node_modules/npm/node_modules/libnpmversion/lib/commit.js create mode 100644 node_modules/npm/node_modules/libnpmversion/lib/enforce-clean.js create mode 100644 node_modules/npm/node_modules/libnpmversion/lib/index.js create mode 100644 node_modules/npm/node_modules/libnpmversion/lib/read-json.js create mode 100644 node_modules/npm/node_modules/libnpmversion/lib/retrieve-tag.js create mode 100644 node_modules/npm/node_modules/libnpmversion/lib/tag.js create mode 100644 node_modules/npm/node_modules/libnpmversion/lib/version.js create mode 100644 node_modules/npm/node_modules/libnpmversion/lib/write-json.js create mode 100644 node_modules/npm/node_modules/libnpmversion/package.json create mode 100644 node_modules/npm/node_modules/lru-cache/LICENSE create mode 100644 node_modules/npm/node_modules/lru-cache/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/lru-cache/dist/commonjs/index.min.js create mode 100644 node_modules/npm/node_modules/lru-cache/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/lru-cache/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/lru-cache/dist/esm/index.min.js create mode 100644 node_modules/npm/node_modules/lru-cache/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/lru-cache/package.json create mode 100644 node_modules/npm/node_modules/make-fetch-happen/LICENSE create mode 100644 node_modules/npm/node_modules/make-fetch-happen/lib/cache/entry.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/lib/cache/errors.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/lib/cache/index.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/lib/cache/key.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/lib/cache/policy.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/lib/fetch.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/lib/index.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/lib/options.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/lib/pipeline.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/lib/remote.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/HISTORY.md create mode 100644 node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/LICENSE create mode 100644 node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/index.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/charset.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/encoding.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/language.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/mediaType.js create mode 100644 node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/package.json create mode 100644 node_modules/npm/node_modules/make-fetch-happen/package.json create mode 100644 node_modules/npm/node_modules/minimatch/LICENSE create mode 100644 node_modules/npm/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/commonjs/ast.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/commonjs/brace-expressions.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/commonjs/escape.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/minimatch/dist/commonjs/unescape.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/esm/assert-valid-pattern.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/esm/ast.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/esm/brace-expressions.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/esm/escape.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/minimatch/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/minimatch/dist/esm/unescape.js create mode 100644 node_modules/npm/node_modules/minimatch/package.json create mode 100644 node_modules/npm/node_modules/minipass-collect/LICENSE create mode 100644 node_modules/npm/node_modules/minipass-collect/index.js create mode 100644 node_modules/npm/node_modules/minipass-collect/package.json create mode 100644 node_modules/npm/node_modules/minipass-fetch/LICENSE create mode 100644 node_modules/npm/node_modules/minipass-fetch/lib/abort-error.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/lib/blob.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/lib/body.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/lib/fetch-error.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/lib/headers.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/lib/index.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/lib/request.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/lib/response.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/LICENSE create mode 100644 node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/constants.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/constants.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/package.json create mode 100644 node_modules/npm/node_modules/minipass-fetch/package.json create mode 100644 node_modules/npm/node_modules/minipass-flush/LICENSE create mode 100644 node_modules/npm/node_modules/minipass-flush/index.js create mode 100644 node_modules/npm/node_modules/minipass-flush/node_modules/minipass/LICENSE create mode 100644 node_modules/npm/node_modules/minipass-flush/node_modules/minipass/index.js create mode 100644 node_modules/npm/node_modules/minipass-flush/node_modules/minipass/package.json create mode 100644 node_modules/npm/node_modules/minipass-flush/package.json create mode 100644 node_modules/npm/node_modules/minipass-pipeline/LICENSE create mode 100644 node_modules/npm/node_modules/minipass-pipeline/index.js create mode 100644 node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass/LICENSE create mode 100644 node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass/index.js create mode 100644 node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass/package.json create mode 100644 node_modules/npm/node_modules/minipass-pipeline/package.json create mode 100644 node_modules/npm/node_modules/minipass-sized/LICENSE create mode 100644 node_modules/npm/node_modules/minipass-sized/index.js create mode 100644 node_modules/npm/node_modules/minipass-sized/node_modules/minipass/LICENSE create mode 100644 node_modules/npm/node_modules/minipass-sized/node_modules/minipass/index.js create mode 100644 node_modules/npm/node_modules/minipass-sized/node_modules/minipass/package.json create mode 100644 node_modules/npm/node_modules/minipass-sized/package.json create mode 100644 node_modules/npm/node_modules/minipass-sized/test/basic.js create mode 100644 node_modules/npm/node_modules/minipass/LICENSE create mode 100644 node_modules/npm/node_modules/minipass/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/minipass/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/minipass/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/minipass/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/minipass/package.json create mode 100644 node_modules/npm/node_modules/minizlib/LICENSE create mode 100644 node_modules/npm/node_modules/minizlib/constants.js create mode 100644 node_modules/npm/node_modules/minizlib/index.js create mode 100644 node_modules/npm/node_modules/minizlib/node_modules/minipass/LICENSE create mode 100644 node_modules/npm/node_modules/minizlib/node_modules/minipass/index.js create mode 100644 node_modules/npm/node_modules/minizlib/node_modules/minipass/package.json create mode 100644 node_modules/npm/node_modules/minizlib/package.json create mode 100644 node_modules/npm/node_modules/mkdirp/LICENSE create mode 100755 node_modules/npm/node_modules/mkdirp/bin/cmd.js create mode 100644 node_modules/npm/node_modules/mkdirp/index.js create mode 100644 node_modules/npm/node_modules/mkdirp/lib/find-made.js create mode 100644 node_modules/npm/node_modules/mkdirp/lib/mkdirp-manual.js create mode 100644 node_modules/npm/node_modules/mkdirp/lib/mkdirp-native.js create mode 100644 node_modules/npm/node_modules/mkdirp/lib/opts-arg.js create mode 100644 node_modules/npm/node_modules/mkdirp/lib/path-arg.js create mode 100644 node_modules/npm/node_modules/mkdirp/lib/use-native.js create mode 100644 node_modules/npm/node_modules/mkdirp/package.json create mode 100644 node_modules/npm/node_modules/mkdirp/readme.markdown create mode 100644 node_modules/npm/node_modules/ms/index.js create mode 100644 node_modules/npm/node_modules/ms/license.md create mode 100644 node_modules/npm/node_modules/ms/package.json create mode 100644 node_modules/npm/node_modules/mute-stream/LICENSE create mode 100644 node_modules/npm/node_modules/mute-stream/lib/index.js create mode 100644 node_modules/npm/node_modules/mute-stream/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/.release-please-manifest.json create mode 100644 node_modules/npm/node_modules/node-gyp/CHANGELOG.md create mode 100644 node_modules/npm/node_modules/node-gyp/CODE_OF_CONDUCT.md create mode 100644 node_modules/npm/node_modules/node-gyp/CONTRIBUTING.md create mode 100644 node_modules/npm/node_modules/node-gyp/LICENSE create mode 100644 node_modules/npm/node_modules/node-gyp/README.md create mode 100644 node_modules/npm/node_modules/node-gyp/SECURITY.md create mode 100644 node_modules/npm/node_modules/node-gyp/addon.gypi create mode 100755 node_modules/npm/node_modules/node-gyp/bin/node-gyp.js create mode 100644 node_modules/npm/node_modules/node-gyp/eslint.config.js create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/.release-please-manifest.json create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/LICENSE create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/data/ninja/build.ninja create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/docs/GypVsCMake.md create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/docs/Hacking.md create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/docs/InputFormatReference.md create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/docs/LanguageSpecification.md create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/docs/README.md create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/docs/Testing.md create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/docs/UserDocumentation.md create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/gyp create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/gyp.bat create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common_test.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/LICENSE create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/__init__.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_parser.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_structures.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/markers.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/metadata.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/py.typed create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/requirements.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/tags.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/utils.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/version.py create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/pyproject.toml create mode 100644 node_modules/npm/node_modules/node-gyp/gyp/release-please-config.json create mode 100755 node_modules/npm/node_modules/node-gyp/gyp/test_gyp.py create mode 100644 node_modules/npm/node_modules/node-gyp/lib/Find-VisualStudio.cs create mode 100644 node_modules/npm/node_modules/node-gyp/lib/build.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/clean.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/configure.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/create-config-gypi.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/download.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/find-node-directory.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/find-python.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/find-visualstudio.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/install.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/list.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/log.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/node-gyp.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/process-release.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/rebuild.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/remove.js create mode 100644 node_modules/npm/node_modules/node-gyp/lib/util.js create mode 100644 node_modules/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/chownr/LICENSE.md create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/chownr/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/minizlib/LICENSE create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/constants.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/constants.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/minizlib/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/LICENSE create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.d.ts.map create mode 100755 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.d.ts create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.d.ts.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.js.map create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/readme.markdown create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/LICENSE create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/create.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/cwd-error.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/extract.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/get-write-flag.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/header.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/large-numbers.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/list.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/make-command.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/mkdir.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/mode-fix.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-unicode.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-windows-path.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/options.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/pack.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/parse.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/path-reservations.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/pax.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/read-entry.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/replace.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-absolute-path.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-trailing-slashes.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/symlink-error.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/types.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/unpack.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/update.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/warn-method.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/winchars.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/write-entry.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/create.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/cwd-error.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/extract.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/get-write-flag.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/header.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/large-numbers.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/list.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/make-command.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/mkdir.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/mode-fix.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-unicode.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-windows-path.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/options.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/pack.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/parse.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/path-reservations.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/pax.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/read-entry.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/replace.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/strip-absolute-path.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/strip-trailing-slashes.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/symlink-error.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/types.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/unpack.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/update.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/warn-method.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/winchars.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/write-entry.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/tar/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/yallist/LICENSE.md create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/node_modules/yallist/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/package.json create mode 100644 node_modules/npm/node_modules/node-gyp/release-please-config.json create mode 100644 node_modules/npm/node_modules/node-gyp/src/win_delay_load_hook.cc create mode 100644 node_modules/npm/node_modules/nopt/LICENSE create mode 100644 node_modules/npm/node_modules/nopt/README.md create mode 100755 node_modules/npm/node_modules/nopt/bin/nopt.js create mode 100644 node_modules/npm/node_modules/nopt/lib/debug.js create mode 100644 node_modules/npm/node_modules/nopt/lib/nopt-lib.js create mode 100644 node_modules/npm/node_modules/nopt/lib/nopt.js create mode 100644 node_modules/npm/node_modules/nopt/lib/type-defs.js create mode 100644 node_modules/npm/node_modules/nopt/node_modules/abbrev/LICENSE create mode 100644 node_modules/npm/node_modules/nopt/node_modules/abbrev/lib/index.js create mode 100644 node_modules/npm/node_modules/nopt/node_modules/abbrev/package.json create mode 100644 node_modules/npm/node_modules/nopt/package.json create mode 100644 node_modules/npm/node_modules/normalize-package-data/LICENSE create mode 100644 node_modules/npm/node_modules/normalize-package-data/lib/extract_description.js create mode 100644 node_modules/npm/node_modules/normalize-package-data/lib/fixer.js create mode 100644 node_modules/npm/node_modules/normalize-package-data/lib/make_warning.js create mode 100644 node_modules/npm/node_modules/normalize-package-data/lib/normalize.js create mode 100644 node_modules/npm/node_modules/normalize-package-data/lib/safe_format.js create mode 100644 node_modules/npm/node_modules/normalize-package-data/lib/typos.json create mode 100644 node_modules/npm/node_modules/normalize-package-data/lib/warning_messages.json create mode 100644 node_modules/npm/node_modules/normalize-package-data/package.json create mode 100644 node_modules/npm/node_modules/npm-audit-report/LICENSE create mode 100644 node_modules/npm/node_modules/npm-audit-report/lib/colors.js create mode 100644 node_modules/npm/node_modules/npm-audit-report/lib/exit-code.js create mode 100644 node_modules/npm/node_modules/npm-audit-report/lib/index.js create mode 100644 node_modules/npm/node_modules/npm-audit-report/lib/reporters/detail.js create mode 100644 node_modules/npm/node_modules/npm-audit-report/lib/reporters/install.js create mode 100644 node_modules/npm/node_modules/npm-audit-report/lib/reporters/json.js create mode 100644 node_modules/npm/node_modules/npm-audit-report/lib/reporters/quiet.js create mode 100644 node_modules/npm/node_modules/npm-audit-report/package.json create mode 100644 node_modules/npm/node_modules/npm-bundled/LICENSE create mode 100644 node_modules/npm/node_modules/npm-bundled/lib/index.js create mode 100644 node_modules/npm/node_modules/npm-bundled/package.json create mode 100644 node_modules/npm/node_modules/npm-install-checks/LICENSE create mode 100644 node_modules/npm/node_modules/npm-install-checks/lib/current-env.js create mode 100644 node_modules/npm/node_modules/npm-install-checks/lib/dev-engines.js create mode 100644 node_modules/npm/node_modules/npm-install-checks/lib/index.js create mode 100644 node_modules/npm/node_modules/npm-install-checks/package.json create mode 100644 node_modules/npm/node_modules/npm-normalize-package-bin/LICENSE create mode 100644 node_modules/npm/node_modules/npm-normalize-package-bin/lib/index.js create mode 100644 node_modules/npm/node_modules/npm-normalize-package-bin/package.json create mode 100644 node_modules/npm/node_modules/npm-package-arg/LICENSE create mode 100644 node_modules/npm/node_modules/npm-package-arg/lib/npa.js create mode 100644 node_modules/npm/node_modules/npm-package-arg/package.json create mode 100644 node_modules/npm/node_modules/npm-packlist/LICENSE create mode 100644 node_modules/npm/node_modules/npm-packlist/lib/index.js create mode 100644 node_modules/npm/node_modules/npm-packlist/package.json create mode 100644 node_modules/npm/node_modules/npm-pick-manifest/LICENSE.md create mode 100644 node_modules/npm/node_modules/npm-pick-manifest/lib/index.js create mode 100644 node_modules/npm/node_modules/npm-pick-manifest/package.json create mode 100644 node_modules/npm/node_modules/npm-profile/LICENSE.md create mode 100644 node_modules/npm/node_modules/npm-profile/lib/index.js create mode 100644 node_modules/npm/node_modules/npm-profile/package.json create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/LICENSE.md create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/lib/auth.js create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/lib/default-opts.js create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/lib/errors.js create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/lib/index.js create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/lib/json-stream.js create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/LICENSE create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/constants.js create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/constants.js create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/package.json create mode 100644 node_modules/npm/node_modules/npm-registry-fetch/package.json create mode 100644 node_modules/npm/node_modules/npm-user-validate/LICENSE create mode 100644 node_modules/npm/node_modules/npm-user-validate/lib/index.js create mode 100644 node_modules/npm/node_modules/npm-user-validate/package.json create mode 100644 node_modules/npm/node_modules/p-map/index.js create mode 100644 node_modules/npm/node_modules/p-map/license create mode 100644 node_modules/npm/node_modules/p-map/package.json create mode 100644 node_modules/npm/node_modules/package-json-from-dist/LICENSE.md create mode 100644 node_modules/npm/node_modules/package-json-from-dist/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/package-json-from-dist/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/package-json-from-dist/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/package-json-from-dist/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/package-json-from-dist/package.json create mode 100644 node_modules/npm/node_modules/pacote/LICENSE create mode 100644 node_modules/npm/node_modules/pacote/README.md create mode 100755 node_modules/npm/node_modules/pacote/bin/index.js create mode 100644 node_modules/npm/node_modules/pacote/lib/dir.js create mode 100644 node_modules/npm/node_modules/pacote/lib/fetcher.js create mode 100644 node_modules/npm/node_modules/pacote/lib/file.js create mode 100644 node_modules/npm/node_modules/pacote/lib/git.js create mode 100644 node_modules/npm/node_modules/pacote/lib/index.js create mode 100644 node_modules/npm/node_modules/pacote/lib/registry.js create mode 100644 node_modules/npm/node_modules/pacote/lib/remote.js create mode 100644 node_modules/npm/node_modules/pacote/lib/util/add-git-sha.js create mode 100644 node_modules/npm/node_modules/pacote/lib/util/cache-dir.js create mode 100644 node_modules/npm/node_modules/pacote/lib/util/is-package-bin.js create mode 100644 node_modules/npm/node_modules/pacote/lib/util/npm.js create mode 100644 node_modules/npm/node_modules/pacote/lib/util/protected.js create mode 100644 node_modules/npm/node_modules/pacote/lib/util/tar-create-options.js create mode 100644 node_modules/npm/node_modules/pacote/lib/util/trailing-slashes.js create mode 100644 node_modules/npm/node_modules/pacote/package.json create mode 100644 node_modules/npm/node_modules/parse-conflict-json/LICENSE.md create mode 100644 node_modules/npm/node_modules/parse-conflict-json/lib/index.js create mode 100644 node_modules/npm/node_modules/parse-conflict-json/package.json create mode 100644 node_modules/npm/node_modules/path-key/index.js create mode 100644 node_modules/npm/node_modules/path-key/license create mode 100644 node_modules/npm/node_modules/path-key/package.json create mode 100644 node_modules/npm/node_modules/path-scurry/LICENSE.md create mode 100644 node_modules/npm/node_modules/path-scurry/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/path-scurry/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/path-scurry/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/path-scurry/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/path-scurry/package.json create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/API.md create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/LICENSE-MIT create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/index.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/parser.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/processor.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/attribute.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/className.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/combinator.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/comment.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/constructors.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/container.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/guards.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/id.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/index.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/namespace.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/nesting.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/node.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/pseudo.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/root.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/selector.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/string.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/tag.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/types.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/universal.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/sortAscending.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/tokenTypes.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/tokenize.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/util/ensureObject.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/util/getProp.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/util/index.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/util/stripComments.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/dist/util/unesc.js create mode 100644 node_modules/npm/node_modules/postcss-selector-parser/package.json create mode 100644 node_modules/npm/node_modules/proc-log/LICENSE create mode 100644 node_modules/npm/node_modules/proc-log/lib/index.js create mode 100644 node_modules/npm/node_modules/proc-log/package.json create mode 100644 node_modules/npm/node_modules/proggy/LICENSE create mode 100644 node_modules/npm/node_modules/proggy/lib/client.js create mode 100644 node_modules/npm/node_modules/proggy/lib/index.js create mode 100644 node_modules/npm/node_modules/proggy/lib/tracker.js create mode 100644 node_modules/npm/node_modules/proggy/package.json create mode 100644 node_modules/npm/node_modules/promise-all-reject-late/LICENSE create mode 100644 node_modules/npm/node_modules/promise-all-reject-late/index.js create mode 100644 node_modules/npm/node_modules/promise-all-reject-late/package.json create mode 100644 node_modules/npm/node_modules/promise-all-reject-late/test/index.js create mode 100644 node_modules/npm/node_modules/promise-call-limit/LICENSE create mode 100644 node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/promise-call-limit/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/promise-call-limit/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/promise-call-limit/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/promise-call-limit/package.json create mode 100644 node_modules/npm/node_modules/promise-inflight/LICENSE create mode 100644 node_modules/npm/node_modules/promise-inflight/inflight.js create mode 100644 node_modules/npm/node_modules/promise-inflight/package.json create mode 100644 node_modules/npm/node_modules/promise-retry/LICENSE create mode 100644 node_modules/npm/node_modules/promise-retry/index.js create mode 100644 node_modules/npm/node_modules/promise-retry/package.json create mode 100644 node_modules/npm/node_modules/promise-retry/test/test.js create mode 100644 node_modules/npm/node_modules/promzard/LICENSE create mode 100644 node_modules/npm/node_modules/promzard/lib/index.js create mode 100644 node_modules/npm/node_modules/promzard/package.json create mode 100644 node_modules/npm/node_modules/qrcode-terminal/.travis.yml create mode 100644 node_modules/npm/node_modules/qrcode-terminal/LICENSE create mode 100644 node_modules/npm/node_modules/qrcode-terminal/README.md create mode 100755 node_modules/npm/node_modules/qrcode-terminal/bin/qrcode-terminal.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/example/basic.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/example/basic.png create mode 100644 node_modules/npm/node_modules/qrcode-terminal/example/callback.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/example/small-qrcode.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/lib/main.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/package.json create mode 100644 node_modules/npm/node_modules/qrcode-terminal/test/main.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMath.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMode.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js create mode 100644 node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/index.js create mode 100644 node_modules/npm/node_modules/read-cmd-shim/LICENSE create mode 100644 node_modules/npm/node_modules/read-cmd-shim/lib/index.js create mode 100644 node_modules/npm/node_modules/read-cmd-shim/package.json create mode 100644 node_modules/npm/node_modules/read-package-json-fast/LICENSE create mode 100644 node_modules/npm/node_modules/read-package-json-fast/lib/index.js create mode 100644 node_modules/npm/node_modules/read-package-json-fast/package.json create mode 100644 node_modules/npm/node_modules/read/LICENSE create mode 100644 node_modules/npm/node_modules/read/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/read/dist/commonjs/read.js create mode 100644 node_modules/npm/node_modules/read/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/read/dist/esm/read.js create mode 100644 node_modules/npm/node_modules/read/package.json create mode 100644 node_modules/npm/node_modules/retry/License create mode 100644 node_modules/npm/node_modules/retry/Makefile create mode 100644 node_modules/npm/node_modules/retry/equation.gif create mode 100644 node_modules/npm/node_modules/retry/example/dns.js create mode 100644 node_modules/npm/node_modules/retry/example/stop.js create mode 100644 node_modules/npm/node_modules/retry/index.js create mode 100644 node_modules/npm/node_modules/retry/lib/retry.js create mode 100644 node_modules/npm/node_modules/retry/lib/retry_operation.js create mode 100644 node_modules/npm/node_modules/retry/package.json create mode 100644 node_modules/npm/node_modules/retry/test/common.js create mode 100644 node_modules/npm/node_modules/retry/test/integration/test-forever.js create mode 100644 node_modules/npm/node_modules/retry/test/integration/test-retry-operation.js create mode 100644 node_modules/npm/node_modules/retry/test/integration/test-retry-wrap.js create mode 100644 node_modules/npm/node_modules/retry/test/integration/test-timeouts.js create mode 100644 node_modules/npm/node_modules/rimraf/LICENSE create mode 100644 node_modules/npm/node_modules/rimraf/README.md create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/default-tmp.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/default-tmp.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/default-tmp.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/default-tmp.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/fix-eperm.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/fix-eperm.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/fix-eperm.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/fix-eperm.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/fs.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/fs.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/fs.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/fs.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/ignore-enoent.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/ignore-enoent.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/ignore-enoent.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/ignore-enoent.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/index.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/index.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/index.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/opt-arg.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/opt-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/opt-arg.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/opt-arg.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/path-arg.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/path-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/path-arg.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/path-arg.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/platform.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/platform.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/platform.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/platform.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/readdir-or-error.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/readdir-or-error.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/readdir-or-error.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/readdir-or-error.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/retry-busy.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/retry-busy.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/retry-busy.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/retry-busy.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-manual.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-manual.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-manual.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-manual.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-move-remove.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-move-remove.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-move-remove.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-move-remove.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-native.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-native.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-native.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-native.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-posix.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-posix.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-posix.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-posix.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-windows.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-windows.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-windows.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/rimraf-windows.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/use-native.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/use-native.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/use-native.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/commonjs/use-native.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/bin.d.mts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/bin.d.mts.map create mode 100755 node_modules/npm/node_modules/rimraf/dist/esm/bin.mjs create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/bin.mjs.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/default-tmp.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/default-tmp.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/default-tmp.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/default-tmp.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/fix-eperm.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/fix-eperm.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/fix-eperm.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/fix-eperm.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/fs.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/fs.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/fs.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/fs.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/ignore-enoent.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/ignore-enoent.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/ignore-enoent.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/ignore-enoent.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/index.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/index.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/index.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/opt-arg.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/opt-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/opt-arg.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/opt-arg.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/path-arg.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/path-arg.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/path-arg.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/path-arg.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/platform.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/platform.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/platform.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/platform.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/readdir-or-error.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/readdir-or-error.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/readdir-or-error.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/readdir-or-error.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/retry-busy.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/retry-busy.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/retry-busy.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/retry-busy.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-manual.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-manual.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-manual.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-manual.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-move-remove.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-move-remove.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-move-remove.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-move-remove.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-native.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-native.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-native.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-native.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-posix.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-posix.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-posix.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-posix.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-windows.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-windows.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-windows.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/rimraf-windows.js.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/use-native.d.ts create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/use-native.d.ts.map create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/use-native.js create mode 100644 node_modules/npm/node_modules/rimraf/dist/esm/use-native.js.map create mode 100644 node_modules/npm/node_modules/rimraf/package.json create mode 100644 node_modules/npm/node_modules/safer-buffer/LICENSE create mode 100644 node_modules/npm/node_modules/safer-buffer/Porting-Buffer.md create mode 100644 node_modules/npm/node_modules/safer-buffer/dangerous.js create mode 100644 node_modules/npm/node_modules/safer-buffer/package.json create mode 100644 node_modules/npm/node_modules/safer-buffer/safer.js create mode 100644 node_modules/npm/node_modules/safer-buffer/tests.js create mode 100644 node_modules/npm/node_modules/semver/LICENSE create mode 100644 node_modules/npm/node_modules/semver/README.md create mode 100755 node_modules/npm/node_modules/semver/bin/semver.js create mode 100644 node_modules/npm/node_modules/semver/classes/comparator.js create mode 100644 node_modules/npm/node_modules/semver/classes/index.js create mode 100644 node_modules/npm/node_modules/semver/classes/range.js create mode 100644 node_modules/npm/node_modules/semver/classes/semver.js create mode 100644 node_modules/npm/node_modules/semver/functions/clean.js create mode 100644 node_modules/npm/node_modules/semver/functions/cmp.js create mode 100644 node_modules/npm/node_modules/semver/functions/coerce.js create mode 100644 node_modules/npm/node_modules/semver/functions/compare-build.js create mode 100644 node_modules/npm/node_modules/semver/functions/compare-loose.js create mode 100644 node_modules/npm/node_modules/semver/functions/compare.js create mode 100644 node_modules/npm/node_modules/semver/functions/diff.js create mode 100644 node_modules/npm/node_modules/semver/functions/eq.js create mode 100644 node_modules/npm/node_modules/semver/functions/gt.js create mode 100644 node_modules/npm/node_modules/semver/functions/gte.js create mode 100644 node_modules/npm/node_modules/semver/functions/inc.js create mode 100644 node_modules/npm/node_modules/semver/functions/lt.js create mode 100644 node_modules/npm/node_modules/semver/functions/lte.js create mode 100644 node_modules/npm/node_modules/semver/functions/major.js create mode 100644 node_modules/npm/node_modules/semver/functions/minor.js create mode 100644 node_modules/npm/node_modules/semver/functions/neq.js create mode 100644 node_modules/npm/node_modules/semver/functions/parse.js create mode 100644 node_modules/npm/node_modules/semver/functions/patch.js create mode 100644 node_modules/npm/node_modules/semver/functions/prerelease.js create mode 100644 node_modules/npm/node_modules/semver/functions/rcompare.js create mode 100644 node_modules/npm/node_modules/semver/functions/rsort.js create mode 100644 node_modules/npm/node_modules/semver/functions/satisfies.js create mode 100644 node_modules/npm/node_modules/semver/functions/sort.js create mode 100644 node_modules/npm/node_modules/semver/functions/valid.js create mode 100644 node_modules/npm/node_modules/semver/index.js create mode 100644 node_modules/npm/node_modules/semver/internal/constants.js create mode 100644 node_modules/npm/node_modules/semver/internal/debug.js create mode 100644 node_modules/npm/node_modules/semver/internal/identifiers.js create mode 100644 node_modules/npm/node_modules/semver/internal/lrucache.js create mode 100644 node_modules/npm/node_modules/semver/internal/parse-options.js create mode 100644 node_modules/npm/node_modules/semver/internal/re.js create mode 100644 node_modules/npm/node_modules/semver/package.json create mode 100644 node_modules/npm/node_modules/semver/preload.js create mode 100644 node_modules/npm/node_modules/semver/range.bnf create mode 100644 node_modules/npm/node_modules/semver/ranges/gtr.js create mode 100644 node_modules/npm/node_modules/semver/ranges/intersects.js create mode 100644 node_modules/npm/node_modules/semver/ranges/ltr.js create mode 100644 node_modules/npm/node_modules/semver/ranges/max-satisfying.js create mode 100644 node_modules/npm/node_modules/semver/ranges/min-satisfying.js create mode 100644 node_modules/npm/node_modules/semver/ranges/min-version.js create mode 100644 node_modules/npm/node_modules/semver/ranges/outside.js create mode 100644 node_modules/npm/node_modules/semver/ranges/simplify.js create mode 100644 node_modules/npm/node_modules/semver/ranges/subset.js create mode 100644 node_modules/npm/node_modules/semver/ranges/to-comparators.js create mode 100644 node_modules/npm/node_modules/semver/ranges/valid.js create mode 100644 node_modules/npm/node_modules/shebang-command/index.js create mode 100644 node_modules/npm/node_modules/shebang-command/license create mode 100644 node_modules/npm/node_modules/shebang-command/package.json create mode 100644 node_modules/npm/node_modules/shebang-regex/index.js create mode 100644 node_modules/npm/node_modules/shebang-regex/license create mode 100644 node_modules/npm/node_modules/shebang-regex/package.json create mode 100644 node_modules/npm/node_modules/signal-exit/LICENSE.txt create mode 100644 node_modules/npm/node_modules/signal-exit/dist/cjs/browser.js create mode 100644 node_modules/npm/node_modules/signal-exit/dist/cjs/index.js create mode 100644 node_modules/npm/node_modules/signal-exit/dist/cjs/package.json create mode 100644 node_modules/npm/node_modules/signal-exit/dist/cjs/signals.js create mode 100644 node_modules/npm/node_modules/signal-exit/dist/mjs/browser.js create mode 100644 node_modules/npm/node_modules/signal-exit/dist/mjs/index.js create mode 100644 node_modules/npm/node_modules/signal-exit/dist/mjs/package.json create mode 100644 node_modules/npm/node_modules/signal-exit/dist/mjs/signals.js create mode 100644 node_modules/npm/node_modules/signal-exit/package.json create mode 100644 node_modules/npm/node_modules/sigstore/LICENSE create mode 100644 node_modules/npm/node_modules/sigstore/dist/config.js create mode 100644 node_modules/npm/node_modules/sigstore/dist/index.js create mode 100644 node_modules/npm/node_modules/sigstore/dist/sigstore.js create mode 100644 node_modules/npm/node_modules/sigstore/package.json create mode 100644 node_modules/npm/node_modules/smart-buffer/LICENSE create mode 100644 node_modules/npm/node_modules/smart-buffer/build/smartbuffer.js create mode 100644 node_modules/npm/node_modules/smart-buffer/build/utils.js create mode 100644 node_modules/npm/node_modules/smart-buffer/docs/ROADMAP.md create mode 100644 node_modules/npm/node_modules/smart-buffer/package.json create mode 100644 node_modules/npm/node_modules/socks-proxy-agent/LICENSE create mode 100644 node_modules/npm/node_modules/socks-proxy-agent/dist/index.js create mode 100644 node_modules/npm/node_modules/socks-proxy-agent/package.json create mode 100644 node_modules/npm/node_modules/socks/LICENSE create mode 100644 node_modules/npm/node_modules/socks/build/client/socksclient.js create mode 100644 node_modules/npm/node_modules/socks/build/common/constants.js create mode 100644 node_modules/npm/node_modules/socks/build/common/helpers.js create mode 100644 node_modules/npm/node_modules/socks/build/common/receivebuffer.js create mode 100644 node_modules/npm/node_modules/socks/build/common/util.js create mode 100644 node_modules/npm/node_modules/socks/build/index.js create mode 100644 node_modules/npm/node_modules/socks/docs/examples/index.md create mode 100644 node_modules/npm/node_modules/socks/docs/examples/javascript/associateExample.md create mode 100644 node_modules/npm/node_modules/socks/docs/examples/javascript/bindExample.md create mode 100644 node_modules/npm/node_modules/socks/docs/examples/javascript/connectExample.md create mode 100644 node_modules/npm/node_modules/socks/docs/examples/typescript/associateExample.md create mode 100644 node_modules/npm/node_modules/socks/docs/examples/typescript/bindExample.md create mode 100644 node_modules/npm/node_modules/socks/docs/examples/typescript/connectExample.md create mode 100644 node_modules/npm/node_modules/socks/docs/index.md create mode 100644 node_modules/npm/node_modules/socks/docs/migratingFromV1.md create mode 100644 node_modules/npm/node_modules/socks/package.json create mode 100644 node_modules/npm/node_modules/spdx-correct/LICENSE create mode 100644 node_modules/npm/node_modules/spdx-correct/index.js create mode 100644 node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/AUTHORS create mode 100644 node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/LICENSE create mode 100644 node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/index.js create mode 100644 node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/package.json create mode 100644 node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/parse.js create mode 100644 node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/scan.js create mode 100644 node_modules/npm/node_modules/spdx-correct/package.json create mode 100644 node_modules/npm/node_modules/spdx-exceptions/deprecated.json create mode 100644 node_modules/npm/node_modules/spdx-exceptions/index.json create mode 100644 node_modules/npm/node_modules/spdx-exceptions/package.json create mode 100644 node_modules/npm/node_modules/spdx-expression-parse/AUTHORS create mode 100644 node_modules/npm/node_modules/spdx-expression-parse/LICENSE create mode 100644 node_modules/npm/node_modules/spdx-expression-parse/index.js create mode 100644 node_modules/npm/node_modules/spdx-expression-parse/package.json create mode 100644 node_modules/npm/node_modules/spdx-expression-parse/parse.js create mode 100644 node_modules/npm/node_modules/spdx-expression-parse/scan.js create mode 100644 node_modules/npm/node_modules/spdx-license-ids/deprecated.json create mode 100644 node_modules/npm/node_modules/spdx-license-ids/index.json create mode 100644 node_modules/npm/node_modules/spdx-license-ids/package.json create mode 100644 node_modules/npm/node_modules/sprintf-js/CONTRIBUTORS.md create mode 100644 node_modules/npm/node_modules/sprintf-js/LICENSE create mode 100644 node_modules/npm/node_modules/sprintf-js/dist/.gitattributes create mode 100644 node_modules/npm/node_modules/sprintf-js/dist/angular-sprintf.min.js create mode 100644 node_modules/npm/node_modules/sprintf-js/dist/sprintf.min.js create mode 100644 node_modules/npm/node_modules/sprintf-js/package.json create mode 100644 node_modules/npm/node_modules/sprintf-js/src/angular-sprintf.js create mode 100644 node_modules/npm/node_modules/sprintf-js/src/sprintf.js create mode 100644 node_modules/npm/node_modules/ssri/LICENSE.md create mode 100644 node_modules/npm/node_modules/ssri/lib/index.js create mode 100644 node_modules/npm/node_modules/ssri/package.json create mode 100644 node_modules/npm/node_modules/string-width-cjs/index.js create mode 100644 node_modules/npm/node_modules/string-width-cjs/license create mode 100644 node_modules/npm/node_modules/string-width-cjs/package.json create mode 100644 node_modules/npm/node_modules/string-width/index.js create mode 100644 node_modules/npm/node_modules/string-width/license create mode 100644 node_modules/npm/node_modules/string-width/package.json create mode 100644 node_modules/npm/node_modules/strip-ansi-cjs/index.js create mode 100644 node_modules/npm/node_modules/strip-ansi-cjs/license create mode 100644 node_modules/npm/node_modules/strip-ansi-cjs/package.json create mode 100644 node_modules/npm/node_modules/strip-ansi/index.js create mode 100644 node_modules/npm/node_modules/strip-ansi/license create mode 100644 node_modules/npm/node_modules/strip-ansi/package.json create mode 100644 node_modules/npm/node_modules/supports-color/browser.js create mode 100644 node_modules/npm/node_modules/supports-color/index.js create mode 100644 node_modules/npm/node_modules/supports-color/license create mode 100644 node_modules/npm/node_modules/supports-color/package.json create mode 100644 node_modules/npm/node_modules/tar/LICENSE create mode 100644 node_modules/npm/node_modules/tar/index.js create mode 100644 node_modules/npm/node_modules/tar/lib/create.js create mode 100644 node_modules/npm/node_modules/tar/lib/extract.js create mode 100644 node_modules/npm/node_modules/tar/lib/get-write-flag.js create mode 100644 node_modules/npm/node_modules/tar/lib/header.js create mode 100644 node_modules/npm/node_modules/tar/lib/high-level-opt.js create mode 100644 node_modules/npm/node_modules/tar/lib/large-numbers.js create mode 100644 node_modules/npm/node_modules/tar/lib/list.js create mode 100644 node_modules/npm/node_modules/tar/lib/mkdir.js create mode 100644 node_modules/npm/node_modules/tar/lib/mode-fix.js create mode 100644 node_modules/npm/node_modules/tar/lib/normalize-unicode.js create mode 100644 node_modules/npm/node_modules/tar/lib/normalize-windows-path.js create mode 100644 node_modules/npm/node_modules/tar/lib/pack.js create mode 100644 node_modules/npm/node_modules/tar/lib/parse.js create mode 100644 node_modules/npm/node_modules/tar/lib/path-reservations.js create mode 100644 node_modules/npm/node_modules/tar/lib/pax.js create mode 100644 node_modules/npm/node_modules/tar/lib/read-entry.js create mode 100644 node_modules/npm/node_modules/tar/lib/replace.js create mode 100644 node_modules/npm/node_modules/tar/lib/strip-absolute-path.js create mode 100644 node_modules/npm/node_modules/tar/lib/strip-trailing-slashes.js create mode 100644 node_modules/npm/node_modules/tar/lib/types.js create mode 100644 node_modules/npm/node_modules/tar/lib/unpack.js create mode 100644 node_modules/npm/node_modules/tar/lib/update.js create mode 100644 node_modules/npm/node_modules/tar/lib/warn-mixin.js create mode 100644 node_modules/npm/node_modules/tar/lib/winchars.js create mode 100644 node_modules/npm/node_modules/tar/lib/write-entry.js create mode 100644 node_modules/npm/node_modules/tar/node_modules/fs-minipass/LICENSE create mode 100644 node_modules/npm/node_modules/tar/node_modules/fs-minipass/index.js create mode 100644 node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/LICENSE create mode 100644 node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/index.js create mode 100644 node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/package.json create mode 100644 node_modules/npm/node_modules/tar/node_modules/fs-minipass/package.json create mode 100644 node_modules/npm/node_modules/tar/node_modules/minipass/LICENSE create mode 100644 node_modules/npm/node_modules/tar/node_modules/minipass/index.js create mode 100644 node_modules/npm/node_modules/tar/node_modules/minipass/index.mjs create mode 100644 node_modules/npm/node_modules/tar/node_modules/minipass/package.json create mode 100644 node_modules/npm/node_modules/tar/package.json create mode 100644 node_modules/npm/node_modules/text-table/LICENSE create mode 100644 node_modules/npm/node_modules/text-table/example/align.js create mode 100644 node_modules/npm/node_modules/text-table/example/center.js create mode 100644 node_modules/npm/node_modules/text-table/example/dotalign.js create mode 100644 node_modules/npm/node_modules/text-table/example/doubledot.js create mode 100644 node_modules/npm/node_modules/text-table/example/table.js create mode 100644 node_modules/npm/node_modules/text-table/index.js create mode 100644 node_modules/npm/node_modules/text-table/package.json create mode 100644 node_modules/npm/node_modules/text-table/test/align.js create mode 100644 node_modules/npm/node_modules/text-table/test/ansi-colors.js create mode 100644 node_modules/npm/node_modules/text-table/test/center.js create mode 100644 node_modules/npm/node_modules/text-table/test/dotalign.js create mode 100644 node_modules/npm/node_modules/text-table/test/doubledot.js create mode 100644 node_modules/npm/node_modules/text-table/test/table.js create mode 100644 node_modules/npm/node_modules/tiny-relative-date/LICENSE.md create mode 100644 node_modules/npm/node_modules/tiny-relative-date/lib/factory.js create mode 100644 node_modules/npm/node_modules/tiny-relative-date/lib/index.js create mode 100644 node_modules/npm/node_modules/tiny-relative-date/package.json create mode 100644 node_modules/npm/node_modules/tiny-relative-date/src/factory.js create mode 100644 node_modules/npm/node_modules/tiny-relative-date/src/index.js create mode 100644 node_modules/npm/node_modules/tiny-relative-date/translations/da.js create mode 100644 node_modules/npm/node_modules/tiny-relative-date/translations/de.js create mode 100644 node_modules/npm/node_modules/tiny-relative-date/translations/en-short.js create mode 100644 node_modules/npm/node_modules/tiny-relative-date/translations/en.js create mode 100644 node_modules/npm/node_modules/tiny-relative-date/translations/es.js create mode 100644 node_modules/npm/node_modules/treeverse/LICENSE create mode 100644 node_modules/npm/node_modules/treeverse/lib/breadth.js create mode 100644 node_modules/npm/node_modules/treeverse/lib/depth-descent.js create mode 100644 node_modules/npm/node_modules/treeverse/lib/depth.js create mode 100644 node_modules/npm/node_modules/treeverse/lib/index.js create mode 100644 node_modules/npm/node_modules/treeverse/package.json create mode 100644 node_modules/npm/node_modules/tuf-js/LICENSE create mode 100644 node_modules/npm/node_modules/tuf-js/dist/config.js create mode 100644 node_modules/npm/node_modules/tuf-js/dist/error.js create mode 100644 node_modules/npm/node_modules/tuf-js/dist/fetcher.js create mode 100644 node_modules/npm/node_modules/tuf-js/dist/index.js create mode 100644 node_modules/npm/node_modules/tuf-js/dist/store.js create mode 100644 node_modules/npm/node_modules/tuf-js/dist/updater.js create mode 100644 node_modules/npm/node_modules/tuf-js/dist/utils/tmpfile.js create mode 100644 node_modules/npm/node_modules/tuf-js/dist/utils/url.js create mode 100644 node_modules/npm/node_modules/tuf-js/package.json create mode 100644 node_modules/npm/node_modules/unique-filename/LICENSE create mode 100644 node_modules/npm/node_modules/unique-filename/lib/index.js create mode 100644 node_modules/npm/node_modules/unique-filename/package.json create mode 100644 node_modules/npm/node_modules/unique-slug/LICENSE create mode 100644 node_modules/npm/node_modules/unique-slug/lib/index.js create mode 100644 node_modules/npm/node_modules/unique-slug/package.json create mode 100644 node_modules/npm/node_modules/util-deprecate/History.md create mode 100644 node_modules/npm/node_modules/util-deprecate/LICENSE create mode 100644 node_modules/npm/node_modules/util-deprecate/browser.js create mode 100644 node_modules/npm/node_modules/util-deprecate/node.js create mode 100644 node_modules/npm/node_modules/util-deprecate/package.json create mode 100644 node_modules/npm/node_modules/validate-npm-package-license/LICENSE create mode 100644 node_modules/npm/node_modules/validate-npm-package-license/index.js create mode 100644 node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/AUTHORS create mode 100644 node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/LICENSE create mode 100644 node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/index.js create mode 100644 node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/package.json create mode 100644 node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/parse.js create mode 100644 node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/scan.js create mode 100644 node_modules/npm/node_modules/validate-npm-package-license/package.json create mode 100644 node_modules/npm/node_modules/validate-npm-package-name/LICENSE create mode 100644 node_modules/npm/node_modules/validate-npm-package-name/lib/index.js create mode 100644 node_modules/npm/node_modules/validate-npm-package-name/package.json create mode 100644 node_modules/npm/node_modules/walk-up-path/LICENSE create mode 100644 node_modules/npm/node_modules/walk-up-path/dist/commonjs/index.js create mode 100644 node_modules/npm/node_modules/walk-up-path/dist/commonjs/package.json create mode 100644 node_modules/npm/node_modules/walk-up-path/dist/esm/index.js create mode 100644 node_modules/npm/node_modules/walk-up-path/dist/esm/package.json create mode 100644 node_modules/npm/node_modules/walk-up-path/package.json create mode 100644 node_modules/npm/node_modules/which/LICENSE create mode 100644 node_modules/npm/node_modules/which/README.md create mode 100755 node_modules/npm/node_modules/which/bin/which.js create mode 100644 node_modules/npm/node_modules/which/lib/index.js create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/LICENSE create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/index.js create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/options.js create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/package.json create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/posix.js create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/win32.js create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/index.js create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/options.js create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/package.json create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/posix.js create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/win32.js create mode 100644 node_modules/npm/node_modules/which/node_modules/isexe/package.json create mode 100644 node_modules/npm/node_modules/which/package.json create mode 100755 node_modules/npm/node_modules/wrap-ansi-cjs/index.js create mode 100644 node_modules/npm/node_modules/wrap-ansi-cjs/license create mode 100644 node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/index.js create mode 100644 node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/license create mode 100644 node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/package.json create mode 100644 node_modules/npm/node_modules/wrap-ansi-cjs/package.json create mode 100755 node_modules/npm/node_modules/wrap-ansi/index.js create mode 100644 node_modules/npm/node_modules/wrap-ansi/license create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex/index.js create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex/license create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex/package.json create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/RGI_Emoji.js create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/RGI_Emoji.js create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/index.js create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/text.js create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/index.js create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/package.json create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/text.js create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/index.js create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/license create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/package.json create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/index.js create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/license create mode 100644 node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/package.json create mode 100644 node_modules/npm/node_modules/wrap-ansi/package.json create mode 100644 node_modules/npm/node_modules/write-file-atomic/LICENSE.md create mode 100644 node_modules/npm/node_modules/write-file-atomic/lib/index.js create mode 100644 node_modules/npm/node_modules/write-file-atomic/package.json create mode 100644 node_modules/npm/node_modules/yallist/LICENSE create mode 100644 node_modules/npm/node_modules/yallist/iterator.js create mode 100644 node_modules/npm/node_modules/yallist/package.json create mode 100644 node_modules/npm/node_modules/yallist/yallist.js create mode 100644 node_modules/npm/package.json create mode 100644 node_modules/object-assign/index.js create mode 100644 node_modules/object-assign/license create mode 100644 node_modules/object-assign/package.json create mode 100644 node_modules/object-assign/readme.md create mode 100644 node_modules/object-hash/LICENSE create mode 100644 node_modules/object-hash/dist/object_hash.js create mode 100644 node_modules/object-hash/index.js create mode 100644 node_modules/object-hash/package.json create mode 100644 node_modules/object-hash/readme.markdown create mode 100644 node_modules/once/LICENSE create mode 100644 node_modules/once/README.md create mode 100644 node_modules/once/once.js create mode 100644 node_modules/once/package.json create mode 100644 node_modules/p-limit/index.d.ts create mode 100644 node_modules/p-limit/index.js create mode 100644 node_modules/p-limit/license create mode 100644 node_modules/p-limit/package.json create mode 100644 node_modules/p-limit/readme.md create mode 100644 node_modules/p-locate/index.d.ts create mode 100644 node_modules/p-locate/index.js create mode 100644 node_modules/p-locate/license create mode 100644 node_modules/p-locate/package.json create mode 100644 node_modules/p-locate/readme.md create mode 100644 node_modules/p-try/index.d.ts create mode 100644 node_modules/p-try/index.js create mode 100644 node_modules/p-try/license create mode 100644 node_modules/p-try/package.json create mode 100644 node_modules/p-try/readme.md create mode 100644 node_modules/path-exists/index.d.ts create mode 100644 node_modules/path-exists/index.js create mode 100644 node_modules/path-exists/license create mode 100644 node_modules/path-exists/package.json create mode 100644 node_modules/path-exists/readme.md create mode 100644 node_modules/path-is-absolute/index.js create mode 100644 node_modules/path-is-absolute/license create mode 100644 node_modules/path-is-absolute/package.json create mode 100644 node_modules/path-is-absolute/readme.md create mode 100644 node_modules/path-key/index.d.ts create mode 100644 node_modules/path-key/index.js create mode 100644 node_modules/path-key/license create mode 100644 node_modules/path-key/package.json create mode 100644 node_modules/path-key/readme.md create mode 100644 node_modules/path-parse/LICENSE create mode 100644 node_modules/path-parse/README.md create mode 100644 node_modules/path-parse/index.js create mode 100644 node_modules/path-parse/package.json create mode 100644 node_modules/path-scurry/LICENSE.md create mode 100644 node_modules/path-scurry/README.md create mode 100644 node_modules/path-scurry/dist/commonjs/index.d.ts create mode 100644 node_modules/path-scurry/dist/commonjs/index.d.ts.map create mode 100644 node_modules/path-scurry/dist/commonjs/index.js create mode 100644 node_modules/path-scurry/dist/commonjs/index.js.map create mode 100644 node_modules/path-scurry/dist/commonjs/package.json create mode 100644 node_modules/path-scurry/dist/esm/index.d.ts create mode 100644 node_modules/path-scurry/dist/esm/index.d.ts.map create mode 100644 node_modules/path-scurry/dist/esm/index.js create mode 100644 node_modules/path-scurry/dist/esm/index.js.map create mode 100644 node_modules/path-scurry/dist/esm/package.json create mode 100644 node_modules/path-scurry/package.json create mode 100644 node_modules/picocolors/LICENSE create mode 100644 node_modules/picocolors/README.md create mode 100644 node_modules/picocolors/package.json create mode 100644 node_modules/picocolors/picocolors.browser.js create mode 100644 node_modules/picocolors/picocolors.d.ts create mode 100644 node_modules/picocolors/picocolors.js create mode 100644 node_modules/picocolors/types.d.ts create mode 100644 node_modules/picomatch/CHANGELOG.md create mode 100644 node_modules/picomatch/LICENSE create mode 100644 node_modules/picomatch/README.md create mode 100644 node_modules/picomatch/index.js create mode 100644 node_modules/picomatch/lib/constants.js create mode 100644 node_modules/picomatch/lib/parse.js create mode 100644 node_modules/picomatch/lib/picomatch.js create mode 100644 node_modules/picomatch/lib/scan.js create mode 100644 node_modules/picomatch/lib/utils.js create mode 100644 node_modules/picomatch/package.json create mode 100644 node_modules/pify/index.js create mode 100644 node_modules/pify/license create mode 100644 node_modules/pify/package.json create mode 100644 node_modules/pify/readme.md create mode 100644 node_modules/pirates/LICENSE create mode 100644 node_modules/pirates/README.md create mode 100644 node_modules/pirates/index.d.ts create mode 100644 node_modules/pirates/lib/index.js create mode 100644 node_modules/pirates/package.json create mode 100644 node_modules/pkg-dir/index.d.ts create mode 100644 node_modules/pkg-dir/index.js create mode 100644 node_modules/pkg-dir/license create mode 100644 node_modules/pkg-dir/package.json create mode 100644 node_modules/pkg-dir/readme.md create mode 100755 node_modules/postcss-import/LICENSE create mode 100644 node_modules/postcss-import/README.md create mode 100755 node_modules/postcss-import/index.js create mode 100644 node_modules/postcss-import/lib/assign-layer-names.js create mode 100644 node_modules/postcss-import/lib/data-url.js create mode 100644 node_modules/postcss-import/lib/join-layer.js create mode 100644 node_modules/postcss-import/lib/join-media.js create mode 100644 node_modules/postcss-import/lib/load-content.js create mode 100644 node_modules/postcss-import/lib/parse-statements.js create mode 100644 node_modules/postcss-import/lib/process-content.js create mode 100644 node_modules/postcss-import/lib/resolve-id.js create mode 100644 node_modules/postcss-import/package.json create mode 100644 node_modules/postcss-js/LICENSE create mode 100644 node_modules/postcss-js/README.md create mode 100644 node_modules/postcss-js/async.js create mode 100644 node_modules/postcss-js/index.js create mode 100644 node_modules/postcss-js/index.mjs create mode 100644 node_modules/postcss-js/objectifier.js create mode 100644 node_modules/postcss-js/package.json create mode 100644 node_modules/postcss-js/parser.js create mode 100644 node_modules/postcss-js/process-result.js create mode 100644 node_modules/postcss-js/sync.js create mode 100644 node_modules/postcss-value-parser/LICENSE create mode 100644 node_modules/postcss-value-parser/README.md create mode 100644 node_modules/postcss-value-parser/lib/index.d.ts create mode 100644 node_modules/postcss-value-parser/lib/index.js create mode 100644 node_modules/postcss-value-parser/lib/parse.js create mode 100644 node_modules/postcss-value-parser/lib/stringify.js create mode 100644 node_modules/postcss-value-parser/lib/unit.js create mode 100644 node_modules/postcss-value-parser/lib/walk.js create mode 100644 node_modules/postcss-value-parser/package.json create mode 100644 node_modules/postcss/LICENSE create mode 100644 node_modules/postcss/README.md create mode 100644 node_modules/postcss/lib/at-rule.d.ts create mode 100644 node_modules/postcss/lib/at-rule.js create mode 100644 node_modules/postcss/lib/comment.d.ts create mode 100644 node_modules/postcss/lib/comment.js create mode 100644 node_modules/postcss/lib/container.d.ts create mode 100644 node_modules/postcss/lib/container.js create mode 100644 node_modules/postcss/lib/css-syntax-error.d.ts create mode 100644 node_modules/postcss/lib/css-syntax-error.js create mode 100644 node_modules/postcss/lib/declaration.d.ts create mode 100644 node_modules/postcss/lib/declaration.js create mode 100644 node_modules/postcss/lib/document.d.ts create mode 100644 node_modules/postcss/lib/document.js create mode 100644 node_modules/postcss/lib/fromJSON.d.ts create mode 100644 node_modules/postcss/lib/fromJSON.js create mode 100644 node_modules/postcss/lib/input.d.ts create mode 100644 node_modules/postcss/lib/input.js create mode 100644 node_modules/postcss/lib/lazy-result.d.ts create mode 100644 node_modules/postcss/lib/lazy-result.js create mode 100644 node_modules/postcss/lib/list.d.ts create mode 100644 node_modules/postcss/lib/list.js create mode 100644 node_modules/postcss/lib/map-generator.js create mode 100644 node_modules/postcss/lib/no-work-result.d.ts create mode 100644 node_modules/postcss/lib/no-work-result.js create mode 100644 node_modules/postcss/lib/node.d.ts create mode 100644 node_modules/postcss/lib/node.js create mode 100644 node_modules/postcss/lib/parse.d.ts create mode 100644 node_modules/postcss/lib/parse.js create mode 100644 node_modules/postcss/lib/parser.js create mode 100644 node_modules/postcss/lib/postcss.d.mts create mode 100644 node_modules/postcss/lib/postcss.d.ts create mode 100644 node_modules/postcss/lib/postcss.js create mode 100644 node_modules/postcss/lib/postcss.mjs create mode 100644 node_modules/postcss/lib/previous-map.d.ts create mode 100644 node_modules/postcss/lib/previous-map.js create mode 100644 node_modules/postcss/lib/processor.d.ts create mode 100644 node_modules/postcss/lib/processor.js create mode 100644 node_modules/postcss/lib/result.d.ts create mode 100644 node_modules/postcss/lib/result.js create mode 100644 node_modules/postcss/lib/root.d.ts create mode 100644 node_modules/postcss/lib/root.js create mode 100644 node_modules/postcss/lib/rule.d.ts create mode 100644 node_modules/postcss/lib/rule.js create mode 100644 node_modules/postcss/lib/stringifier.d.ts create mode 100644 node_modules/postcss/lib/stringifier.js create mode 100644 node_modules/postcss/lib/stringify.d.ts create mode 100644 node_modules/postcss/lib/stringify.js create mode 100644 node_modules/postcss/lib/symbols.js create mode 100644 node_modules/postcss/lib/terminal-highlight.js create mode 100644 node_modules/postcss/lib/tokenize.js create mode 100644 node_modules/postcss/lib/warn-once.js create mode 100644 node_modules/postcss/lib/warning.d.ts create mode 100644 node_modules/postcss/lib/warning.js create mode 100755 node_modules/postcss/package.json create mode 100755 node_modules/queue-microtask/LICENSE create mode 100644 node_modules/queue-microtask/README.md create mode 100644 node_modules/queue-microtask/index.d.ts create mode 100644 node_modules/queue-microtask/index.js create mode 100644 node_modules/queue-microtask/package.json create mode 100644 node_modules/read-cache/LICENSE create mode 100644 node_modules/read-cache/README.md create mode 100644 node_modules/read-cache/index.js create mode 100644 node_modules/read-cache/package.json create mode 100644 node_modules/resolve-from/index.d.ts create mode 100644 node_modules/resolve-from/index.js create mode 100644 node_modules/resolve-from/license create mode 100644 node_modules/resolve-from/package.json create mode 100644 node_modules/resolve-from/readme.md create mode 100644 node_modules/reusify/.coveralls.yml create mode 100644 node_modules/reusify/.travis.yml create mode 100644 node_modules/reusify/LICENSE create mode 100644 node_modules/reusify/README.md create mode 100644 node_modules/reusify/benchmarks/createNoCodeFunction.js create mode 100644 node_modules/reusify/benchmarks/fib.js create mode 100644 node_modules/reusify/benchmarks/reuseNoCodeFunction.js create mode 100644 node_modules/reusify/package.json create mode 100644 node_modules/reusify/reusify.js create mode 100644 node_modules/reusify/test.js create mode 100644 node_modules/rimraf/node_modules/minimatch/LICENSE create mode 100644 node_modules/rimraf/node_modules/minimatch/README.md create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/package.json create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/ast.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/ast.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/ast.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/ast.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/escape.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/escape.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/escape.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/escape.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/index.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/index.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/index.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/index.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/package.json create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.d.ts create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.d.ts.map create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.js create mode 100644 node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.js.map create mode 100644 node_modules/rimraf/node_modules/minimatch/package.json create mode 100644 node_modules/run-parallel/LICENSE create mode 100644 node_modules/run-parallel/README.md create mode 100644 node_modules/run-parallel/index.js create mode 100644 node_modules/run-parallel/package.json create mode 100644 node_modules/sade/index.d.ts create mode 100644 node_modules/sade/lib/index.js create mode 100644 node_modules/sade/lib/index.mjs create mode 100644 node_modules/sade/license create mode 100644 node_modules/sade/package.json create mode 100644 node_modules/sade/readme.md create mode 100644 node_modules/shebang-command/index.js create mode 100644 node_modules/shebang-command/license create mode 100644 node_modules/shebang-command/package.json create mode 100644 node_modules/shebang-command/readme.md create mode 100644 node_modules/shebang-regex/index.d.ts create mode 100644 node_modules/shebang-regex/index.js create mode 100644 node_modules/shebang-regex/license create mode 100644 node_modules/shebang-regex/package.json create mode 100644 node_modules/shebang-regex/readme.md create mode 100644 node_modules/signal-exit/LICENSE.txt create mode 100644 node_modules/signal-exit/README.md create mode 100644 node_modules/signal-exit/dist/cjs/browser.d.ts create mode 100644 node_modules/signal-exit/dist/cjs/browser.d.ts.map create mode 100644 node_modules/signal-exit/dist/cjs/browser.js create mode 100644 node_modules/signal-exit/dist/cjs/browser.js.map create mode 100644 node_modules/signal-exit/dist/cjs/index.d.ts create mode 100644 node_modules/signal-exit/dist/cjs/index.d.ts.map create mode 100644 node_modules/signal-exit/dist/cjs/index.js create mode 100644 node_modules/signal-exit/dist/cjs/index.js.map create mode 100644 node_modules/signal-exit/dist/cjs/package.json create mode 100644 node_modules/signal-exit/dist/cjs/signals.d.ts create mode 100644 node_modules/signal-exit/dist/cjs/signals.d.ts.map create mode 100644 node_modules/signal-exit/dist/cjs/signals.js create mode 100644 node_modules/signal-exit/dist/cjs/signals.js.map create mode 100644 node_modules/signal-exit/dist/mjs/browser.d.ts create mode 100644 node_modules/signal-exit/dist/mjs/browser.d.ts.map create mode 100644 node_modules/signal-exit/dist/mjs/browser.js create mode 100644 node_modules/signal-exit/dist/mjs/browser.js.map create mode 100644 node_modules/signal-exit/dist/mjs/index.d.ts create mode 100644 node_modules/signal-exit/dist/mjs/index.d.ts.map create mode 100644 node_modules/signal-exit/dist/mjs/index.js create mode 100644 node_modules/signal-exit/dist/mjs/index.js.map create mode 100644 node_modules/signal-exit/dist/mjs/package.json create mode 100644 node_modules/signal-exit/dist/mjs/signals.d.ts create mode 100644 node_modules/signal-exit/dist/mjs/signals.d.ts.map create mode 100644 node_modules/signal-exit/dist/mjs/signals.js create mode 100644 node_modules/signal-exit/dist/mjs/signals.js.map create mode 100644 node_modules/signal-exit/package.json create mode 100644 node_modules/simple-icons-font/font/simple-icons.css create mode 100644 node_modules/sirv/build.js create mode 100644 node_modules/sirv/build.mjs create mode 100644 node_modules/sirv/index.d.mts create mode 100644 node_modules/sirv/index.d.ts create mode 100644 node_modules/sirv/package.json create mode 100644 node_modules/sirv/readme.md create mode 100644 node_modules/slash/index.d.ts create mode 100644 node_modules/slash/index.js create mode 100644 node_modules/slash/license create mode 100644 node_modules/slash/package.json create mode 100644 node_modules/slash/readme.md create mode 100644 node_modules/source-map-js/LICENSE create mode 100644 node_modules/source-map-js/README.md create mode 100644 node_modules/source-map-js/lib/array-set.js create mode 100644 node_modules/source-map-js/lib/base64-vlq.js create mode 100644 node_modules/source-map-js/lib/base64.js create mode 100644 node_modules/source-map-js/lib/binary-search.js create mode 100644 node_modules/source-map-js/lib/mapping-list.js create mode 100644 node_modules/source-map-js/lib/quick-sort.js create mode 100644 node_modules/source-map-js/lib/source-map-consumer.d.ts create mode 100644 node_modules/source-map-js/lib/source-map-consumer.js create mode 100644 node_modules/source-map-js/lib/source-map-generator.d.ts create mode 100644 node_modules/source-map-js/lib/source-map-generator.js create mode 100644 node_modules/source-map-js/lib/source-node.d.ts create mode 100644 node_modules/source-map-js/lib/source-node.js create mode 100644 node_modules/source-map-js/lib/util.js create mode 100644 node_modules/source-map-js/package.json create mode 100644 node_modules/source-map-js/source-map.d.ts create mode 100644 node_modules/source-map-js/source-map.js create mode 100644 node_modules/string-width-cjs/index.d.ts create mode 100644 node_modules/string-width-cjs/index.js create mode 100644 node_modules/string-width-cjs/license create mode 100644 node_modules/string-width-cjs/node_modules/ansi-regex/index.d.ts create mode 100644 node_modules/string-width-cjs/node_modules/ansi-regex/index.js create mode 100644 node_modules/string-width-cjs/node_modules/ansi-regex/license create mode 100644 node_modules/string-width-cjs/node_modules/ansi-regex/package.json create mode 100644 node_modules/string-width-cjs/node_modules/ansi-regex/readme.md create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/README.md create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/es2015/index.js create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/es2015/text.js create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/index.d.ts create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/index.js create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/package.json create mode 100644 node_modules/string-width-cjs/node_modules/emoji-regex/text.js create mode 100644 node_modules/string-width-cjs/node_modules/strip-ansi/index.d.ts create mode 100644 node_modules/string-width-cjs/node_modules/strip-ansi/index.js create mode 100644 node_modules/string-width-cjs/node_modules/strip-ansi/license create mode 100644 node_modules/string-width-cjs/node_modules/strip-ansi/package.json create mode 100644 node_modules/string-width-cjs/node_modules/strip-ansi/readme.md create mode 100644 node_modules/string-width-cjs/package.json create mode 100644 node_modules/string-width-cjs/readme.md create mode 100644 node_modules/string-width/index.d.ts create mode 100644 node_modules/string-width/index.js create mode 100644 node_modules/string-width/license create mode 100644 node_modules/string-width/package.json create mode 100644 node_modules/string-width/readme.md create mode 100644 node_modules/strip-ansi-cjs/index.d.ts create mode 100644 node_modules/strip-ansi-cjs/index.js create mode 100644 node_modules/strip-ansi-cjs/license create mode 100644 node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.d.ts create mode 100644 node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.js create mode 100644 node_modules/strip-ansi-cjs/node_modules/ansi-regex/license create mode 100644 node_modules/strip-ansi-cjs/node_modules/ansi-regex/package.json create mode 100644 node_modules/strip-ansi-cjs/node_modules/ansi-regex/readme.md create mode 100644 node_modules/strip-ansi-cjs/package.json create mode 100644 node_modules/strip-ansi-cjs/readme.md create mode 100644 node_modules/strip-ansi/index.d.ts create mode 100644 node_modules/strip-ansi/index.js create mode 100644 node_modules/strip-ansi/license create mode 100644 node_modules/strip-ansi/package.json create mode 100644 node_modules/strip-ansi/readme.md create mode 100644 node_modules/strip-outer/index.js create mode 100644 node_modules/strip-outer/license create mode 100644 node_modules/strip-outer/package.json create mode 100644 node_modules/strip-outer/readme.md create mode 100644 node_modules/style-value-types/CHANGELOG.md create mode 100644 node_modules/style-value-types/LICENSE.md create mode 100644 node_modules/style-value-types/README.md create mode 100644 node_modules/style-value-types/dist/es/color/hex.mjs create mode 100644 node_modules/style-value-types/dist/es/color/hsla.mjs create mode 100644 node_modules/style-value-types/dist/es/color/index.mjs create mode 100644 node_modules/style-value-types/dist/es/color/rgba.mjs create mode 100644 node_modules/style-value-types/dist/es/color/utils.mjs create mode 100644 node_modules/style-value-types/dist/es/complex/filter.mjs create mode 100644 node_modules/style-value-types/dist/es/complex/index.mjs create mode 100644 node_modules/style-value-types/dist/es/index.mjs create mode 100644 node_modules/style-value-types/dist/es/numbers/index.mjs create mode 100644 node_modules/style-value-types/dist/es/numbers/units.mjs create mode 100644 node_modules/style-value-types/dist/es/utils.mjs create mode 100644 node_modules/style-value-types/dist/style-value-types.min.js create mode 100644 node_modules/style-value-types/dist/valueTypes.cjs.js create mode 100644 node_modules/style-value-types/dist/valueTypes.js create mode 100644 node_modules/style-value-types/lib/color/hex.d.ts create mode 100644 node_modules/style-value-types/lib/color/hex.js create mode 100644 node_modules/style-value-types/lib/color/hex.js.map create mode 100644 node_modules/style-value-types/lib/color/hsla.d.ts create mode 100644 node_modules/style-value-types/lib/color/hsla.js create mode 100644 node_modules/style-value-types/lib/color/hsla.js.map create mode 100644 node_modules/style-value-types/lib/color/index.d.ts create mode 100644 node_modules/style-value-types/lib/color/index.js create mode 100644 node_modules/style-value-types/lib/color/index.js.map create mode 100644 node_modules/style-value-types/lib/color/rgba.d.ts create mode 100644 node_modules/style-value-types/lib/color/rgba.js create mode 100644 node_modules/style-value-types/lib/color/rgba.js.map create mode 100644 node_modules/style-value-types/lib/color/utils.d.ts create mode 100644 node_modules/style-value-types/lib/color/utils.js create mode 100644 node_modules/style-value-types/lib/color/utils.js.map create mode 100644 node_modules/style-value-types/lib/complex/filter.d.ts create mode 100644 node_modules/style-value-types/lib/complex/filter.js create mode 100644 node_modules/style-value-types/lib/complex/filter.js.map create mode 100644 node_modules/style-value-types/lib/complex/index.d.ts create mode 100644 node_modules/style-value-types/lib/complex/index.js create mode 100644 node_modules/style-value-types/lib/complex/index.js.map create mode 100644 node_modules/style-value-types/lib/index.d.ts create mode 100644 node_modules/style-value-types/lib/index.js create mode 100644 node_modules/style-value-types/lib/index.js.map create mode 100644 node_modules/style-value-types/lib/numbers/index.d.ts create mode 100644 node_modules/style-value-types/lib/numbers/index.js create mode 100644 node_modules/style-value-types/lib/numbers/index.js.map create mode 100644 node_modules/style-value-types/lib/numbers/units.d.ts create mode 100644 node_modules/style-value-types/lib/numbers/units.js create mode 100644 node_modules/style-value-types/lib/numbers/units.js.map create mode 100644 node_modules/style-value-types/lib/types.d.ts create mode 100644 node_modules/style-value-types/lib/types.js create mode 100644 node_modules/style-value-types/lib/types.js.map create mode 100644 node_modules/style-value-types/lib/utils.d.ts create mode 100644 node_modules/style-value-types/lib/utils.js create mode 100644 node_modules/style-value-types/lib/utils.js.map create mode 100644 node_modules/style-value-types/package.json create mode 100644 node_modules/sucrase/LICENSE create mode 100644 node_modules/sucrase/README.md create mode 100755 node_modules/sucrase/bin/sucrase create mode 100755 node_modules/sucrase/bin/sucrase-node create mode 100644 node_modules/sucrase/dist/CJSImportProcessor.js create mode 100644 node_modules/sucrase/dist/HelperManager.js create mode 100644 node_modules/sucrase/dist/NameManager.js create mode 100644 node_modules/sucrase/dist/Options-gen-types.js create mode 100644 node_modules/sucrase/dist/Options.js create mode 100644 node_modules/sucrase/dist/TokenProcessor.js create mode 100644 node_modules/sucrase/dist/cli.js create mode 100644 node_modules/sucrase/dist/computeSourceMap.js create mode 100644 node_modules/sucrase/dist/esm/CJSImportProcessor.js create mode 100644 node_modules/sucrase/dist/esm/HelperManager.js create mode 100644 node_modules/sucrase/dist/esm/NameManager.js create mode 100644 node_modules/sucrase/dist/esm/Options-gen-types.js create mode 100644 node_modules/sucrase/dist/esm/Options.js create mode 100644 node_modules/sucrase/dist/esm/TokenProcessor.js create mode 100644 node_modules/sucrase/dist/esm/cli.js create mode 100644 node_modules/sucrase/dist/esm/computeSourceMap.js create mode 100644 node_modules/sucrase/dist/esm/identifyShadowedGlobals.js create mode 100644 node_modules/sucrase/dist/esm/index.js create mode 100644 node_modules/sucrase/dist/esm/parser/index.js create mode 100644 node_modules/sucrase/dist/esm/parser/plugins/flow.js create mode 100644 node_modules/sucrase/dist/esm/parser/plugins/jsx/index.js create mode 100644 node_modules/sucrase/dist/esm/parser/plugins/jsx/xhtml.js create mode 100644 node_modules/sucrase/dist/esm/parser/plugins/types.js create mode 100644 node_modules/sucrase/dist/esm/parser/plugins/typescript.js create mode 100644 node_modules/sucrase/dist/esm/parser/tokenizer/index.js create mode 100644 node_modules/sucrase/dist/esm/parser/tokenizer/keywords.js create mode 100644 node_modules/sucrase/dist/esm/parser/tokenizer/readWord.js create mode 100644 node_modules/sucrase/dist/esm/parser/tokenizer/readWordTree.js create mode 100644 node_modules/sucrase/dist/esm/parser/tokenizer/state.js create mode 100644 node_modules/sucrase/dist/esm/parser/tokenizer/types.js create mode 100644 node_modules/sucrase/dist/esm/parser/traverser/base.js create mode 100644 node_modules/sucrase/dist/esm/parser/traverser/expression.js create mode 100644 node_modules/sucrase/dist/esm/parser/traverser/index.js create mode 100644 node_modules/sucrase/dist/esm/parser/traverser/lval.js create mode 100644 node_modules/sucrase/dist/esm/parser/traverser/statement.js create mode 100644 node_modules/sucrase/dist/esm/parser/traverser/util.js create mode 100644 node_modules/sucrase/dist/esm/parser/util/charcodes.js create mode 100644 node_modules/sucrase/dist/esm/parser/util/identifier.js create mode 100644 node_modules/sucrase/dist/esm/parser/util/whitespace.js create mode 100644 node_modules/sucrase/dist/esm/register.js create mode 100644 node_modules/sucrase/dist/esm/transformers/CJSImportTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/ESMImportTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/FlowTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/JSXTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/JestHoistTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/NumericSeparatorTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/OptionalCatchBindingTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/OptionalChainingNullishTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/ReactDisplayNameTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/ReactHotLoaderTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/RootTransformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/Transformer.js create mode 100644 node_modules/sucrase/dist/esm/transformers/TypeScriptTransformer.js create mode 100644 node_modules/sucrase/dist/esm/util/elideImportEquals.js create mode 100644 node_modules/sucrase/dist/esm/util/formatTokens.js create mode 100644 node_modules/sucrase/dist/esm/util/getClassInfo.js create mode 100644 node_modules/sucrase/dist/esm/util/getDeclarationInfo.js create mode 100644 node_modules/sucrase/dist/esm/util/getIdentifierNames.js create mode 100644 node_modules/sucrase/dist/esm/util/getImportExportSpecifierInfo.js create mode 100644 node_modules/sucrase/dist/esm/util/getJSXPragmaInfo.js create mode 100644 node_modules/sucrase/dist/esm/util/getNonTypeIdentifiers.js create mode 100644 node_modules/sucrase/dist/esm/util/getTSImportedNames.js create mode 100644 node_modules/sucrase/dist/esm/util/isAsyncOperation.js create mode 100644 node_modules/sucrase/dist/esm/util/isExportFrom.js create mode 100644 node_modules/sucrase/dist/esm/util/isIdentifier.js create mode 100644 node_modules/sucrase/dist/esm/util/removeMaybeImportAttributes.js create mode 100644 node_modules/sucrase/dist/esm/util/shouldElideDefaultExport.js create mode 100644 node_modules/sucrase/dist/identifyShadowedGlobals.js create mode 100644 node_modules/sucrase/dist/index.js create mode 100644 node_modules/sucrase/dist/parser/index.js create mode 100644 node_modules/sucrase/dist/parser/plugins/flow.js create mode 100644 node_modules/sucrase/dist/parser/plugins/jsx/index.js create mode 100644 node_modules/sucrase/dist/parser/plugins/jsx/xhtml.js create mode 100644 node_modules/sucrase/dist/parser/plugins/types.js create mode 100644 node_modules/sucrase/dist/parser/plugins/typescript.js create mode 100644 node_modules/sucrase/dist/parser/tokenizer/index.js create mode 100644 node_modules/sucrase/dist/parser/tokenizer/keywords.js create mode 100644 node_modules/sucrase/dist/parser/tokenizer/readWord.js create mode 100644 node_modules/sucrase/dist/parser/tokenizer/readWordTree.js create mode 100644 node_modules/sucrase/dist/parser/tokenizer/state.js create mode 100644 node_modules/sucrase/dist/parser/tokenizer/types.js create mode 100644 node_modules/sucrase/dist/parser/traverser/base.js create mode 100644 node_modules/sucrase/dist/parser/traverser/expression.js create mode 100644 node_modules/sucrase/dist/parser/traverser/index.js create mode 100644 node_modules/sucrase/dist/parser/traverser/lval.js create mode 100644 node_modules/sucrase/dist/parser/traverser/statement.js create mode 100644 node_modules/sucrase/dist/parser/traverser/util.js create mode 100644 node_modules/sucrase/dist/parser/util/charcodes.js create mode 100644 node_modules/sucrase/dist/parser/util/identifier.js create mode 100644 node_modules/sucrase/dist/parser/util/whitespace.js create mode 100644 node_modules/sucrase/dist/register.js create mode 100644 node_modules/sucrase/dist/transformers/CJSImportTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/ESMImportTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/FlowTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/JSXTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/JestHoistTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/NumericSeparatorTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/OptionalCatchBindingTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/OptionalChainingNullishTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/ReactDisplayNameTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/ReactHotLoaderTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/RootTransformer.js create mode 100644 node_modules/sucrase/dist/transformers/Transformer.js create mode 100644 node_modules/sucrase/dist/transformers/TypeScriptTransformer.js create mode 100644 node_modules/sucrase/dist/types/CJSImportProcessor.d.ts create mode 100644 node_modules/sucrase/dist/types/HelperManager.d.ts create mode 100644 node_modules/sucrase/dist/types/NameManager.d.ts create mode 100644 node_modules/sucrase/dist/types/Options-gen-types.d.ts create mode 100644 node_modules/sucrase/dist/types/Options.d.ts create mode 100644 node_modules/sucrase/dist/types/TokenProcessor.d.ts create mode 100644 node_modules/sucrase/dist/types/cli.d.ts create mode 100644 node_modules/sucrase/dist/types/computeSourceMap.d.ts create mode 100644 node_modules/sucrase/dist/types/identifyShadowedGlobals.d.ts create mode 100644 node_modules/sucrase/dist/types/index.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/index.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/plugins/flow.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/plugins/jsx/index.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/plugins/jsx/xhtml.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/plugins/types.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/plugins/typescript.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/tokenizer/index.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/tokenizer/keywords.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/tokenizer/readWord.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/tokenizer/readWordTree.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/tokenizer/state.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/tokenizer/types.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/traverser/base.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/traverser/expression.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/traverser/index.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/traverser/lval.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/traverser/statement.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/traverser/util.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/util/charcodes.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/util/identifier.d.ts create mode 100644 node_modules/sucrase/dist/types/parser/util/whitespace.d.ts create mode 100644 node_modules/sucrase/dist/types/register.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/CJSImportTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/ESMImportTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/FlowTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/JSXTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/JestHoistTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/NumericSeparatorTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/OptionalCatchBindingTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/OptionalChainingNullishTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/ReactDisplayNameTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/ReactHotLoaderTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/RootTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/Transformer.d.ts create mode 100644 node_modules/sucrase/dist/types/transformers/TypeScriptTransformer.d.ts create mode 100644 node_modules/sucrase/dist/types/util/elideImportEquals.d.ts create mode 100644 node_modules/sucrase/dist/types/util/formatTokens.d.ts create mode 100644 node_modules/sucrase/dist/types/util/getClassInfo.d.ts create mode 100644 node_modules/sucrase/dist/types/util/getDeclarationInfo.d.ts create mode 100644 node_modules/sucrase/dist/types/util/getIdentifierNames.d.ts create mode 100644 node_modules/sucrase/dist/types/util/getImportExportSpecifierInfo.d.ts create mode 100644 node_modules/sucrase/dist/types/util/getJSXPragmaInfo.d.ts create mode 100644 node_modules/sucrase/dist/types/util/getNonTypeIdentifiers.d.ts create mode 100644 node_modules/sucrase/dist/types/util/getTSImportedNames.d.ts create mode 100644 node_modules/sucrase/dist/types/util/isAsyncOperation.d.ts create mode 100644 node_modules/sucrase/dist/types/util/isExportFrom.d.ts create mode 100644 node_modules/sucrase/dist/types/util/isIdentifier.d.ts create mode 100644 node_modules/sucrase/dist/types/util/removeMaybeImportAttributes.d.ts create mode 100644 node_modules/sucrase/dist/types/util/shouldElideDefaultExport.d.ts create mode 100644 node_modules/sucrase/dist/util/elideImportEquals.js create mode 100644 node_modules/sucrase/dist/util/formatTokens.js create mode 100644 node_modules/sucrase/dist/util/getClassInfo.js create mode 100644 node_modules/sucrase/dist/util/getDeclarationInfo.js create mode 100644 node_modules/sucrase/dist/util/getIdentifierNames.js create mode 100644 node_modules/sucrase/dist/util/getImportExportSpecifierInfo.js create mode 100644 node_modules/sucrase/dist/util/getJSXPragmaInfo.js create mode 100644 node_modules/sucrase/dist/util/getNonTypeIdentifiers.js create mode 100644 node_modules/sucrase/dist/util/getTSImportedNames.js create mode 100644 node_modules/sucrase/dist/util/isAsyncOperation.js create mode 100644 node_modules/sucrase/dist/util/isExportFrom.js create mode 100644 node_modules/sucrase/dist/util/isIdentifier.js create mode 100644 node_modules/sucrase/dist/util/removeMaybeImportAttributes.js create mode 100644 node_modules/sucrase/dist/util/shouldElideDefaultExport.js create mode 100644 node_modules/sucrase/node_modules/minimatch/LICENSE create mode 100644 node_modules/sucrase/node_modules/minimatch/README.md create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/package.json create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/ast.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/ast.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/ast.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/ast.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/escape.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/escape.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/escape.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/escape.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/index.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/index.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/index.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/index.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/package.json create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.d.ts create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.d.ts.map create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.js create mode 100644 node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.js.map create mode 100644 node_modules/sucrase/node_modules/minimatch/package.json create mode 100644 node_modules/sucrase/package.json create mode 100644 node_modules/sucrase/register/index.js create mode 100644 node_modules/sucrase/register/js.js create mode 100644 node_modules/sucrase/register/jsx.js create mode 100644 node_modules/sucrase/register/ts-legacy-module-interop.js create mode 100644 node_modules/sucrase/register/ts.js create mode 100644 node_modules/sucrase/register/tsx-legacy-module-interop.js create mode 100644 node_modules/sucrase/register/tsx.js create mode 100644 node_modules/sucrase/ts-node-plugin/index.js create mode 100644 node_modules/supports-preserve-symlinks-flag/.eslintrc create mode 100644 node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml create mode 100644 node_modules/supports-preserve-symlinks-flag/.nycrc create mode 100644 node_modules/supports-preserve-symlinks-flag/CHANGELOG.md create mode 100644 node_modules/supports-preserve-symlinks-flag/LICENSE create mode 100644 node_modules/supports-preserve-symlinks-flag/README.md create mode 100644 node_modules/supports-preserve-symlinks-flag/browser.js create mode 100644 node_modules/supports-preserve-symlinks-flag/index.js create mode 100644 node_modules/supports-preserve-symlinks-flag/package.json create mode 100644 node_modules/supports-preserve-symlinks-flag/test/index.js create mode 100644 node_modules/svelte-inview/README.md create mode 100644 node_modules/svelte-inview/dist/additional-svelte-jsx.d.ts create mode 100644 node_modules/svelte-inview/dist/index.d.ts create mode 100644 node_modules/svelte-inview/dist/index.js create mode 100644 node_modules/svelte-inview/dist/index.mjs create mode 100644 node_modules/svelte-inview/dist/inview.d.ts create mode 100644 node_modules/svelte-inview/dist/tests/inview.spec.d.ts create mode 100644 node_modules/svelte-inview/dist/types.d.ts create mode 100644 node_modules/svelte-inview/license.md create mode 100644 node_modules/svelte-inview/package.json create mode 100644 node_modules/svelte-inview/src/additional-svelte-jsx.d.ts create mode 100644 node_modules/svelte-inview/src/index.d.ts create mode 100644 node_modules/svelte-inview/src/index.ts create mode 100644 node_modules/svelte-inview/src/inview.ts create mode 100644 node_modules/svelte-inview/src/tests/inview.spec.ts create mode 100644 node_modules/svelte-inview/src/types.ts create mode 100644 node_modules/svelte-motion/.vscode/settings.json create mode 100644 node_modules/svelte-motion/LICENSE.md create mode 100644 node_modules/svelte-motion/README.md create mode 100644 node_modules/svelte-motion/package.json create mode 100644 node_modules/svelte-motion/rollup.config.js create mode 100644 node_modules/svelte-motion/src/animation/UseAnimatedState.svelte create mode 100644 node_modules/svelte-motion/src/animation/UseAnimation.svelte create mode 100644 node_modules/svelte-motion/src/animation/animate.js create mode 100644 node_modules/svelte-motion/src/animation/animation-controls.js create mode 100644 node_modules/svelte-motion/src/animation/use-animated-state.js create mode 100644 node_modules/svelte-motion/src/animation/use-animation.js create mode 100644 node_modules/svelte-motion/src/animation/utils/default-transitions.js create mode 100644 node_modules/svelte-motion/src/animation/utils/easing.js create mode 100644 node_modules/svelte-motion/src/animation/utils/is-animatable.js create mode 100644 node_modules/svelte-motion/src/animation/utils/is-animation-controls.js create mode 100644 node_modules/svelte-motion/src/animation/utils/is-keyframes-target.js create mode 100644 node_modules/svelte-motion/src/animation/utils/transitions.js create mode 100644 node_modules/svelte-motion/src/components/AnimatePresence/AnimatePresence.svelte create mode 100644 node_modules/svelte-motion/src/components/AnimatePresence/PresenceChild.js create mode 100644 node_modules/svelte-motion/src/components/AnimatePresence/PresenceChild.svelte create mode 100644 node_modules/svelte-motion/src/components/AnimatePresence/index.js create mode 100644 node_modules/svelte-motion/src/components/AnimatePresence/use-presence.js create mode 100644 node_modules/svelte-motion/src/components/AnimateSharedLayout/AnimateSharedLayout.svelte create mode 100644 node_modules/svelte-motion/src/components/AnimateSharedLayout/index.js create mode 100644 node_modules/svelte-motion/src/components/AnimateSharedLayout/types.js create mode 100644 node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/batcher.js create mode 100644 node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/crossfader.js create mode 100644 node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/rotate.js create mode 100644 node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/stack.js create mode 100644 node_modules/svelte-motion/src/components/LazyMotion/LazyMotion.svelte create mode 100644 node_modules/svelte-motion/src/components/LazyMotion/index.js create mode 100644 node_modules/svelte-motion/src/components/MotionConfig/MotionConfig.svelte create mode 100644 node_modules/svelte-motion/src/components/MotionConfig/MotionConfigScaleCorrection.js create mode 100644 node_modules/svelte-motion/src/components/MotionConfig/index.js create mode 100644 node_modules/svelte-motion/src/components/MotionDiv.svelte create mode 100644 node_modules/svelte-motion/src/context/DOMcontext.js create mode 100644 node_modules/svelte-motion/src/context/LayoutGroupContext.js create mode 100644 node_modules/svelte-motion/src/context/LazyContext.js create mode 100644 node_modules/svelte-motion/src/context/MotionConfigContext.js create mode 100644 node_modules/svelte-motion/src/context/MotionContext/MotionContext.svelte create mode 100644 node_modules/svelte-motion/src/context/MotionContext/MotionContextProvider.svelte create mode 100644 node_modules/svelte-motion/src/context/MotionContext/UseCreateMotionContext.svelte create mode 100644 node_modules/svelte-motion/src/context/MotionContext/create.js create mode 100644 node_modules/svelte-motion/src/context/MotionContext/index.js create mode 100644 node_modules/svelte-motion/src/context/MotionContext/utils.js create mode 100644 node_modules/svelte-motion/src/context/PresenceContext.js create mode 100644 node_modules/svelte-motion/src/context/ScaleCorrectionProvider.svelte create mode 100644 node_modules/svelte-motion/src/context/SharedLayoutContext.js create mode 100644 node_modules/svelte-motion/src/events/UseDomEvent.svelte create mode 100644 node_modules/svelte-motion/src/events/UsePointerEvent.svelte create mode 100644 node_modules/svelte-motion/src/events/event-info.js create mode 100644 node_modules/svelte-motion/src/events/use-dom-event.js create mode 100644 node_modules/svelte-motion/src/events/use-pointer-event.js create mode 100644 node_modules/svelte-motion/src/events/utils.js create mode 100644 node_modules/svelte-motion/src/gestures/PanSession.js create mode 100644 node_modules/svelte-motion/src/gestures/UseFocusGesture.svelte create mode 100644 node_modules/svelte-motion/src/gestures/UseGestures.svelte create mode 100644 node_modules/svelte-motion/src/gestures/UseHoverGesture.svelte create mode 100644 node_modules/svelte-motion/src/gestures/UsePanGesture.svelte create mode 100644 node_modules/svelte-motion/src/gestures/UseTapGesture.svelte create mode 100644 node_modules/svelte-motion/src/gestures/drag/UseDrag.svelte create mode 100644 node_modules/svelte-motion/src/gestures/drag/UseDragControls.svelte create mode 100644 node_modules/svelte-motion/src/gestures/drag/VisualElementDragControls.js create mode 100644 node_modules/svelte-motion/src/gestures/drag/use-drag-controls.js create mode 100644 node_modules/svelte-motion/src/gestures/drag/use-drag.js create mode 100644 node_modules/svelte-motion/src/gestures/drag/utils/constraints.js create mode 100644 node_modules/svelte-motion/src/gestures/drag/utils/lock.js create mode 100644 node_modules/svelte-motion/src/gestures/use-focus-gesture.js create mode 100644 node_modules/svelte-motion/src/gestures/use-gestures.js create mode 100644 node_modules/svelte-motion/src/gestures/use-hover-gesture.js create mode 100644 node_modules/svelte-motion/src/gestures/use-pan-gesture.js create mode 100644 node_modules/svelte-motion/src/gestures/use-tap-gesture.js create mode 100644 node_modules/svelte-motion/src/gestures/utils/event-type.js create mode 100644 node_modules/svelte-motion/src/gestures/utils/is-node-or-child.js create mode 100644 node_modules/svelte-motion/src/index.js create mode 100644 node_modules/svelte-motion/src/motion/Motion.svelte create mode 100644 node_modules/svelte-motion/src/motion/MotionSSR.svelte create mode 100644 node_modules/svelte-motion/src/motion/features/AnimationState.svelte create mode 100644 node_modules/svelte-motion/src/motion/features/Exit.svelte create mode 100644 node_modules/svelte-motion/src/motion/features/UseFeatures.svelte create mode 100644 node_modules/svelte-motion/src/motion/features/animations.js create mode 100644 node_modules/svelte-motion/src/motion/features/definitions.js create mode 100644 node_modules/svelte-motion/src/motion/features/drag.js create mode 100644 node_modules/svelte-motion/src/motion/features/gestures.js create mode 100644 node_modules/svelte-motion/src/motion/features/layout/Animate.js create mode 100644 node_modules/svelte-motion/src/motion/features/layout/Animate.svelte create mode 100644 node_modules/svelte-motion/src/motion/features/layout/AnimateLayoutContextProvider.svelte create mode 100644 node_modules/svelte-motion/src/motion/features/layout/Measure.js create mode 100644 node_modules/svelte-motion/src/motion/features/layout/Measure.svelte create mode 100644 node_modules/svelte-motion/src/motion/features/layout/MeasureContextProvider.svelte create mode 100644 node_modules/svelte-motion/src/motion/features/layout/index.js create mode 100644 node_modules/svelte-motion/src/motion/features/layout/utils.js create mode 100644 node_modules/svelte-motion/src/motion/features/use-features.js create mode 100644 node_modules/svelte-motion/src/motion/index.js create mode 100644 node_modules/svelte-motion/src/motion/utils/UseLayoutId.svelte create mode 100644 node_modules/svelte-motion/src/motion/utils/UseVisualElement.svelte create mode 100644 node_modules/svelte-motion/src/motion/utils/UseVisualState.svelte create mode 100644 node_modules/svelte-motion/src/motion/utils/is-forced-motion-value.js create mode 100644 node_modules/svelte-motion/src/motion/utils/make-renderless-component.js create mode 100644 node_modules/svelte-motion/src/motion/utils/use-motion-ref.js create mode 100644 node_modules/svelte-motion/src/motion/utils/use-visual-element.js create mode 100644 node_modules/svelte-motion/src/motion/utils/use-visual-state.js create mode 100644 node_modules/svelte-motion/src/motion/utils/valid-prop.js create mode 100644 node_modules/svelte-motion/src/render/dom/M.svelte create mode 100644 node_modules/svelte-motion/src/render/dom/UseRender.svelte create mode 100644 node_modules/svelte-motion/src/render/dom/create-motion-class.js create mode 100644 node_modules/svelte-motion/src/render/dom/create-visual-element.js create mode 100644 node_modules/svelte-motion/src/render/dom/featureBundle.js create mode 100644 node_modules/svelte-motion/src/render/dom/motion-minimal.js create mode 100644 node_modules/svelte-motion/src/render/dom/motion-proxy.js create mode 100644 node_modules/svelte-motion/src/render/dom/motion.js create mode 100644 node_modules/svelte-motion/src/render/dom/projection/convert-to-relative.js create mode 100644 node_modules/svelte-motion/src/render/dom/projection/default-scale-correctors.js create mode 100644 node_modules/svelte-motion/src/render/dom/projection/measure.js create mode 100644 node_modules/svelte-motion/src/render/dom/projection/relative-set.js create mode 100644 node_modules/svelte-motion/src/render/dom/projection/scale-correction.js create mode 100644 node_modules/svelte-motion/src/render/dom/projection/utils.js create mode 100644 node_modules/svelte-motion/src/render/dom/svg-visual-element.js create mode 100644 node_modules/svelte-motion/src/render/dom/use-render.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/UseInitialMotionProps.svelte create mode 100644 node_modules/svelte-motion/src/render/dom/utils/batch-layout.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/camel-to-dash.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/create-config.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/css-variables-conversion.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/filter-props.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/is-css-variable.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/is-svg-component.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/parse-dom-variant.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/unit-conversion.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/use-html-props.js create mode 100644 node_modules/svelte-motion/src/render/dom/utils/use-svg-props.js create mode 100644 node_modules/svelte-motion/src/render/dom/value-types/animatable-none.js create mode 100644 node_modules/svelte-motion/src/render/dom/value-types/defaults.js create mode 100644 node_modules/svelte-motion/src/render/dom/value-types/dimensions.js create mode 100644 node_modules/svelte-motion/src/render/dom/value-types/find.js create mode 100644 node_modules/svelte-motion/src/render/dom/value-types/get-as-type.js create mode 100644 node_modules/svelte-motion/src/render/dom/value-types/number.js create mode 100644 node_modules/svelte-motion/src/render/dom/value-types/test.js create mode 100644 node_modules/svelte-motion/src/render/dom/value-types/type-auto.js create mode 100644 node_modules/svelte-motion/src/render/dom/value-types/type-int.js create mode 100644 node_modules/svelte-motion/src/render/html/UseHTMLProps.svelte create mode 100644 node_modules/svelte-motion/src/render/html/UseInitialMotionValues.svelte create mode 100644 node_modules/svelte-motion/src/render/html/UseStyle.svelte create mode 100644 node_modules/svelte-motion/src/render/html/config-motion.js create mode 100644 node_modules/svelte-motion/src/render/html/use-props.js create mode 100644 node_modules/svelte-motion/src/render/html/utils/build-projection-transform.js create mode 100644 node_modules/svelte-motion/src/render/html/utils/build-styles.js create mode 100644 node_modules/svelte-motion/src/render/html/utils/build-transform.js create mode 100644 node_modules/svelte-motion/src/render/html/utils/create-render-state.js create mode 100644 node_modules/svelte-motion/src/render/html/utils/render.js create mode 100644 node_modules/svelte-motion/src/render/html/utils/scrape-motion-values.js create mode 100644 node_modules/svelte-motion/src/render/html/utils/transform.js create mode 100644 node_modules/svelte-motion/src/render/html/visual-element.js create mode 100644 node_modules/svelte-motion/src/render/index.js create mode 100644 node_modules/svelte-motion/src/render/svg/UseSVGProps.svelte create mode 100644 node_modules/svelte-motion/src/render/svg/config-motion.js create mode 100644 node_modules/svelte-motion/src/render/svg/lowercase-elements.js create mode 100644 node_modules/svelte-motion/src/render/svg/use-props.js create mode 100644 node_modules/svelte-motion/src/render/svg/utils/build-attrs.js create mode 100644 node_modules/svelte-motion/src/render/svg/utils/camel-case-attrs.js create mode 100644 node_modules/svelte-motion/src/render/svg/utils/create-render-state.js create mode 100644 node_modules/svelte-motion/src/render/svg/utils/path.js create mode 100644 node_modules/svelte-motion/src/render/svg/utils/render.js create mode 100644 node_modules/svelte-motion/src/render/svg/utils/scrape-motion-values.js create mode 100644 node_modules/svelte-motion/src/render/svg/utils/transform-origin.js create mode 100644 node_modules/svelte-motion/src/render/svg/visual-element.js create mode 100644 node_modules/svelte-motion/src/render/utils/animation-state.js create mode 100644 node_modules/svelte-motion/src/render/utils/animation.js create mode 100644 node_modules/svelte-motion/src/render/utils/compare-by-depth.js create mode 100644 node_modules/svelte-motion/src/render/utils/flat-tree.js create mode 100644 node_modules/svelte-motion/src/render/utils/is-draggable.js create mode 100644 node_modules/svelte-motion/src/render/utils/lifecycles.js create mode 100644 node_modules/svelte-motion/src/render/utils/motion-values.js create mode 100644 node_modules/svelte-motion/src/render/utils/projection.js create mode 100644 node_modules/svelte-motion/src/render/utils/setters.js create mode 100644 node_modules/svelte-motion/src/render/utils/state.js create mode 100644 node_modules/svelte-motion/src/render/utils/types.js create mode 100644 node_modules/svelte-motion/src/render/utils/variants.js create mode 100644 node_modules/svelte-motion/src/utils/UseUnmountEffect.svelte create mode 100644 node_modules/svelte-motion/src/utils/array.js create mode 100644 node_modules/svelte-motion/src/utils/each-axis.js create mode 100644 node_modules/svelte-motion/src/utils/fix-process-env.js create mode 100644 node_modules/svelte-motion/src/utils/geometry/delta-apply.js create mode 100644 node_modules/svelte-motion/src/utils/geometry/delta-calc.js create mode 100644 node_modules/svelte-motion/src/utils/geometry/index.js create mode 100644 node_modules/svelte-motion/src/utils/is-browser.js create mode 100644 node_modules/svelte-motion/src/utils/is-numerical-string.js create mode 100644 node_modules/svelte-motion/src/utils/is-ref-object.js create mode 100644 node_modules/svelte-motion/src/utils/noop.js create mode 100644 node_modules/svelte-motion/src/utils/resolve-value.js create mode 100644 node_modules/svelte-motion/src/utils/shallow-compare.js create mode 100644 node_modules/svelte-motion/src/utils/subscription-manager.js create mode 100644 node_modules/svelte-motion/src/utils/time-conversion.js create mode 100644 node_modules/svelte-motion/src/utils/transform.js create mode 100644 node_modules/svelte-motion/src/utils/use-constant.js create mode 100644 node_modules/svelte-motion/src/utils/use-cycle.js create mode 100644 node_modules/svelte-motion/src/utils/use-force-update.js create mode 100644 node_modules/svelte-motion/src/utils/use-isomorphic-effect.js create mode 100644 node_modules/svelte-motion/src/utils/use-reduced-motion.js create mode 100644 node_modules/svelte-motion/src/utils/use-unmount-effect.js create mode 100644 node_modules/svelte-motion/src/value/index.js create mode 100644 node_modules/svelte-motion/src/value/scroll/use-element-scroll.js create mode 100644 node_modules/svelte-motion/src/value/scroll/use-viewport-scroll.js create mode 100644 node_modules/svelte-motion/src/value/scroll/utils.js create mode 100644 node_modules/svelte-motion/src/value/use-combine-values.js create mode 100644 node_modules/svelte-motion/src/value/use-motion-template.js create mode 100644 node_modules/svelte-motion/src/value/use-motion-value.js create mode 100644 node_modules/svelte-motion/src/value/use-spring.js create mode 100644 node_modules/svelte-motion/src/value/use-transform.js create mode 100644 node_modules/svelte-motion/src/value/use-velocity.js create mode 100644 node_modules/svelte-motion/src/value/utils/is-motion-value.js create mode 100644 node_modules/svelte-motion/src/value/utils/resolve-motion-value.js create mode 100644 node_modules/svelte-motion/svelte.config.js create mode 100644 node_modules/svelte-motion/tests/types/components.test-d.ts create mode 100644 node_modules/svelte-motion/tests/types/svelteTypes.d.ts create mode 100644 node_modules/svelte-motion/tsconfig.json create mode 100644 node_modules/svelte-motion/types/animation/animate.d.ts create mode 100644 node_modules/svelte-motion/types/animation/animation-controls.d.ts create mode 100644 node_modules/svelte-motion/types/animation/types.d.ts create mode 100644 node_modules/svelte-motion/types/animation/use-animation.d.ts create mode 100644 node_modules/svelte-motion/types/animation/utils/default-transitions.d.ts create mode 100644 node_modules/svelte-motion/types/animation/utils/easing.d.ts create mode 100644 node_modules/svelte-motion/types/animation/utils/is-animatable.d.ts create mode 100644 node_modules/svelte-motion/types/animation/utils/is-animation-controls.d.ts create mode 100644 node_modules/svelte-motion/types/animation/utils/is-keyframes-target.d.ts create mode 100644 node_modules/svelte-motion/types/animation/utils/transitions.d.ts create mode 100644 node_modules/svelte-motion/types/animation/utils/variant-resolvers.d.ts create mode 100644 node_modules/svelte-motion/types/components/AnimatePresence/PresenceChild.d.ts create mode 100644 node_modules/svelte-motion/types/components/AnimatePresence/index.d.ts create mode 100644 node_modules/svelte-motion/types/components/AnimatePresence/types.d.ts create mode 100644 node_modules/svelte-motion/types/components/AnimatePresence/use-presence.d.ts create mode 100644 node_modules/svelte-motion/types/components/AnimateSharedLayout/index.d.ts create mode 100644 node_modules/svelte-motion/types/components/AnimateSharedLayout/types.d.ts create mode 100644 node_modules/svelte-motion/types/components/AnimateSharedLayout/utils/batcher.d.ts create mode 100644 node_modules/svelte-motion/types/components/AnimateSharedLayout/utils/crossfader.d.ts create mode 100644 node_modules/svelte-motion/types/components/AnimateSharedLayout/utils/rotate.d.ts create mode 100644 node_modules/svelte-motion/types/components/AnimateSharedLayout/utils/stack.d.ts create mode 100644 node_modules/svelte-motion/types/components/LazyMotion/index.d.ts create mode 100644 node_modules/svelte-motion/types/components/LazyMotion/types.d.ts create mode 100644 node_modules/svelte-motion/types/components/MotionConfig/index.d.ts create mode 100644 node_modules/svelte-motion/types/context/LayoutGroupContext.d.ts create mode 100644 node_modules/svelte-motion/types/context/LazyContext.d.ts create mode 100644 node_modules/svelte-motion/types/context/MotionConfigContext.d.ts create mode 100644 node_modules/svelte-motion/types/context/MotionContext/create.d.ts create mode 100644 node_modules/svelte-motion/types/context/MotionContext/index.d.ts create mode 100644 node_modules/svelte-motion/types/context/MotionContext/utils.d.ts create mode 100644 node_modules/svelte-motion/types/context/PresenceContext.d.ts create mode 100644 node_modules/svelte-motion/types/context/SharedLayoutContext.d.ts create mode 100644 node_modules/svelte-motion/types/events/event-info.d.ts create mode 100644 node_modules/svelte-motion/types/events/types.d.ts create mode 100644 node_modules/svelte-motion/types/events/use-dom-event.d.ts create mode 100644 node_modules/svelte-motion/types/events/use-pointer-event.d.ts create mode 100644 node_modules/svelte-motion/types/events/utils.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/PanSession.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/drag/VisualElementDragControls.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/drag/types.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/drag/use-drag-controls.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/drag/use-drag.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/drag/utils/constraints.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/drag/utils/lock.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/types.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/use-focus-gesture.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/use-hover-gesture.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/use-pan-gesture.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/use-tap-gesture.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/utils/event-type.d.ts create mode 100644 node_modules/svelte-motion/types/gestures/utils/is-node-or-child.d.ts create mode 100644 node_modules/svelte-motion/types/index.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/animations.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/definitions.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/drag.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/gestures.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/layout/Animate.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/layout/Measure.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/layout/index.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/layout/types.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/layout/utils.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/types.d.ts create mode 100644 node_modules/svelte-motion/types/motion/features/use-features.d.ts create mode 100644 node_modules/svelte-motion/types/motion/index.d.ts create mode 100644 node_modules/svelte-motion/types/motion/types.d.ts create mode 100644 node_modules/svelte-motion/types/motion/utils/is-forced-motion-value.d.ts create mode 100644 node_modules/svelte-motion/types/motion/utils/make-renderless-component.d.ts create mode 100644 node_modules/svelte-motion/types/motion/utils/should-inherit-variant.d.ts create mode 100644 node_modules/svelte-motion/types/motion/utils/use-motion-ref.d.ts create mode 100644 node_modules/svelte-motion/types/motion/utils/use-visual-element.d.ts create mode 100644 node_modules/svelte-motion/types/motion/utils/use-visual-state.d.ts create mode 100644 node_modules/svelte-motion/types/motion/utils/valid-prop.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/create-visual-element.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/features-animation.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/features-max.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/motion-minimal.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/motion-proxy.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/motion.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/projection/convert-to-relative.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/projection/default-scale-correctors.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/projection/measure.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/projection/relative-set.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/projection/scale-correction.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/projection/types.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/projection/utils.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/types.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/use-render.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/utils/batch-layout.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/utils/camel-to-dash.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/utils/create-config.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/utils/css-variables-conversion.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/utils/filter-props.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/utils/is-css-variable.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/utils/is-svg-component.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/utils/parse-dom-variant.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/utils/unit-conversion.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/value-types/animatable-none.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/value-types/defaults.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/value-types/dimensions.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/value-types/find.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/value-types/get-as-type.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/value-types/number.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/value-types/test.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/value-types/type-auto.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/value-types/type-int.d.ts create mode 100644 node_modules/svelte-motion/types/render/dom/value-types/types.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/config-motion.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/supported-elements.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/types.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/use-props.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/utils/build-projection-transform.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/utils/build-styles.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/utils/build-transform.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/utils/create-render-state.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/utils/render.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/utils/scrape-motion-values.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/utils/transform.d.ts create mode 100644 node_modules/svelte-motion/types/render/html/visual-element.d.ts create mode 100644 node_modules/svelte-motion/types/render/index.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/config-motion.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/lowercase-elements.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/supported-elements.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/types.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/use-props.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/utils/build-attrs.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/utils/camel-case-attrs.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/utils/create-render-state.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/utils/path.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/utils/render.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/utils/scrape-motion-values.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/utils/transform-origin.d.ts create mode 100644 node_modules/svelte-motion/types/render/svg/visual-element.d.ts create mode 100644 node_modules/svelte-motion/types/render/types.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/animation-state.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/animation.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/compare-by-depth.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/flat-tree.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/is-draggable.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/lifecycles.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/motion-values.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/projection.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/setters.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/state.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/types.d.ts create mode 100644 node_modules/svelte-motion/types/render/utils/variants.d.ts create mode 100644 node_modules/svelte-motion/types/types.d.ts create mode 100644 node_modules/svelte-motion/types/types/geometry.d.ts create mode 100644 node_modules/svelte-motion/types/utils/array.d.ts create mode 100644 node_modules/svelte-motion/types/utils/each-axis.d.ts create mode 100644 node_modules/svelte-motion/types/utils/geometry/delta-apply.d.ts create mode 100644 node_modules/svelte-motion/types/utils/geometry/delta-calc.d.ts create mode 100644 node_modules/svelte-motion/types/utils/geometry/index.d.ts create mode 100644 node_modules/svelte-motion/types/utils/is-browser.d.ts create mode 100644 node_modules/svelte-motion/types/utils/is-numerical-string.d.ts create mode 100644 node_modules/svelte-motion/types/utils/is-ref-object.d.ts create mode 100644 node_modules/svelte-motion/types/utils/noop.d.ts create mode 100644 node_modules/svelte-motion/types/utils/resolve-value.d.ts create mode 100644 node_modules/svelte-motion/types/utils/shallow-compare.d.ts create mode 100644 node_modules/svelte-motion/types/utils/subscription-manager.d.ts create mode 100644 node_modules/svelte-motion/types/utils/time-conversion.d.ts create mode 100644 node_modules/svelte-motion/types/utils/transform.d.ts create mode 100644 node_modules/svelte-motion/types/utils/use-constant.d.ts create mode 100644 node_modules/svelte-motion/types/utils/use-cycle.d.ts create mode 100644 node_modules/svelte-motion/types/utils/use-force-update.d.ts create mode 100644 node_modules/svelte-motion/types/utils/use-isomorphic-effect.d.ts create mode 100644 node_modules/svelte-motion/types/utils/use-reduced-motion.d.ts create mode 100644 node_modules/svelte-motion/types/utils/use-unmount-effect.d.ts create mode 100644 node_modules/svelte-motion/types/value/index.d.ts create mode 100644 node_modules/svelte-motion/types/value/scroll/use-element-scroll.d.ts create mode 100644 node_modules/svelte-motion/types/value/scroll/use-viewport-scroll.d.ts create mode 100644 node_modules/svelte-motion/types/value/scroll/utils.d.ts create mode 100644 node_modules/svelte-motion/types/value/use-combine-values.d.ts create mode 100644 node_modules/svelte-motion/types/value/use-motion-template.d.ts create mode 100644 node_modules/svelte-motion/types/value/use-motion-value.d.ts create mode 100644 node_modules/svelte-motion/types/value/use-spring.d.ts create mode 100644 node_modules/svelte-motion/types/value/use-transform.d.ts create mode 100644 node_modules/svelte-motion/types/value/use-velocity.d.ts create mode 100644 node_modules/svelte-motion/types/value/utils/is-motion-value.d.ts create mode 100644 node_modules/svelte-motion/types/value/utils/resolve-motion-value.d.ts create mode 100644 node_modules/svelte-motion/vite.config.ts create mode 100644 node_modules/svelte/LICENSE.md create mode 100644 node_modules/svelte/README.md create mode 100644 node_modules/svelte/action.d.ts create mode 100644 node_modules/svelte/animate.d.ts create mode 100644 node_modules/svelte/compiler.d.ts create mode 100644 node_modules/svelte/compiler/index.js create mode 100644 node_modules/svelte/compiler/package.json create mode 100644 node_modules/svelte/easing.d.ts create mode 100644 node_modules/svelte/elements.d.ts create mode 100644 node_modules/svelte/index.d.ts create mode 100644 node_modules/svelte/legacy.d.ts create mode 100644 node_modules/svelte/motion.d.ts create mode 100644 node_modules/svelte/package.json create mode 100644 node_modules/svelte/src/action/public.d.ts create mode 100644 node_modules/svelte/src/ambient.d.ts create mode 100644 node_modules/svelte/src/animate/index.js create mode 100644 node_modules/svelte/src/animate/public.d.ts create mode 100644 node_modules/svelte/src/compiler/errors.js create mode 100644 node_modules/svelte/src/compiler/index.js create mode 100644 node_modules/svelte/src/compiler/legacy.js create mode 100644 node_modules/svelte/src/compiler/migrate/index.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/acorn.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/ambient.d.ts create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/index.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/read/context.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/read/expression.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/read/options.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/read/script.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/read/style.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/remove_typescript_nodes.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/state/element.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/state/fragment.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/state/tag.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/state/text.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/utils/bracket.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/utils/create.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/utils/entities.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/utils/full_char_code_at.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/utils/fuzzymatch.js create mode 100644 node_modules/svelte/src/compiler/phases/1-parse/utils/html.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/css/css-analyze.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/css/css-prune.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/css/css-warn.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/css/utils.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/index.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/types.d.ts create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/utils/check_graph_for_cycles.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ArrowFunctionExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/AssignmentExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/Attribute.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/AwaitBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/BindDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ClassBody.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ClassDeclaration.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ClassDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/Component.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ConstTag.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/DebugTag.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/EachBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ExportDefaultDeclaration.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ExportNamedDeclaration.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ExportSpecifier.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ExpressionStatement.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ExpressionTag.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/FunctionDeclaration.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/FunctionExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/HtmlTag.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/Identifier.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/IfBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/ImportDeclaration.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/KeyBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/LabeledStatement.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/LetDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/MemberExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/NewExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/OnDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/RegularElement.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/RenderTag.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SlotElement.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SnippetBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SpreadAttribute.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SpreadElement.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/StyleDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SvelteBody.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SvelteBoundary.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SvelteComponent.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SvelteDocument.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SvelteElement.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SvelteFragment.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SvelteHead.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SvelteSelf.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/SvelteWindow.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/TaggedTemplateExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/Text.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/TitleElement.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/TransitionDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/UpdateExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/UseDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/VariableDeclarator.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/shared/attribute.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/shared/component.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/shared/element.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/shared/fragment.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/shared/function.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/shared/snippets.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/shared/special-element.js create mode 100644 node_modules/svelte/src/compiler/phases/2-analyze/visitors/shared/utils.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/transform-client.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/types.d.ts create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/utils.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/AnimateDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/ArrowFunctionExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/AssignmentExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/Attribute.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/AwaitBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/BinaryExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/BindDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/BlockStatement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/BreakStatement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/CallExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/ClassBody.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/Comment.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/Component.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/ConstTag.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/DebugTag.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/EachBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/ExportNamedDeclaration.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/ExpressionStatement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/Fragment.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/FunctionDeclaration.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/FunctionExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/HtmlTag.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/Identifier.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/IfBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/ImportDeclaration.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/KeyBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/LabeledStatement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/LetDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/MemberExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/OnDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/Program.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/RenderTag.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SlotElement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SnippetBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SpreadAttribute.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SvelteBody.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SvelteBoundary.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SvelteComponent.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SvelteDocument.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SvelteElement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SvelteFragment.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SvelteHead.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SvelteSelf.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/SvelteWindow.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/TitleElement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/TransitionDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/UpdateExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/UseDirective.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/VariableDeclaration.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/shared/component.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/shared/declarations.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/shared/element.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/shared/events.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/shared/fragment.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/shared/function.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/shared/special_element.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/css/index.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/index.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/transform-server.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/types.d.ts create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/AssignmentExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/AwaitBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/CallExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/ClassBody.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/Component.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/ConstTag.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/DebugTag.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/EachBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/ExpressionStatement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/Fragment.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/HtmlTag.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/Identifier.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/IfBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/KeyBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/LabeledStatement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/MemberExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/PropertyDefinition.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/RegularElement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/RenderTag.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/SlotElement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/SnippetBlock.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/SpreadAttribute.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/SvelteBoundary.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/SvelteComponent.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/SvelteElement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/SvelteFragment.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/SvelteHead.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/SvelteSelf.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/TitleElement.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/UpdateExpression.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/VariableDeclaration.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/shared/component.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/shared/element.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/server/visitors/shared/utils.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/shared/assignments.js create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/types.d.ts create mode 100644 node_modules/svelte/src/compiler/phases/3-transform/utils.js create mode 100644 node_modules/svelte/src/compiler/phases/bindings.js create mode 100644 node_modules/svelte/src/compiler/phases/css.js create mode 100644 node_modules/svelte/src/compiler/phases/nodes.js create mode 100644 node_modules/svelte/src/compiler/phases/patterns.js create mode 100644 node_modules/svelte/src/compiler/phases/scope.js create mode 100644 node_modules/svelte/src/compiler/phases/types.d.ts create mode 100644 node_modules/svelte/src/compiler/preprocess/decode_sourcemap.js create mode 100644 node_modules/svelte/src/compiler/preprocess/index.js create mode 100644 node_modules/svelte/src/compiler/preprocess/legacy-public.d.ts create mode 100644 node_modules/svelte/src/compiler/preprocess/private.d.ts create mode 100644 node_modules/svelte/src/compiler/preprocess/public.d.ts create mode 100644 node_modules/svelte/src/compiler/preprocess/replace_in_code.js create mode 100644 node_modules/svelte/src/compiler/public.d.ts create mode 100644 node_modules/svelte/src/compiler/state.js create mode 100644 node_modules/svelte/src/compiler/types/css.d.ts create mode 100644 node_modules/svelte/src/compiler/types/index.d.ts create mode 100644 node_modules/svelte/src/compiler/types/legacy-interfaces.d.ts create mode 100644 node_modules/svelte/src/compiler/types/legacy-nodes.d.ts create mode 100644 node_modules/svelte/src/compiler/types/template.d.ts create mode 100644 node_modules/svelte/src/compiler/utils/assert.js create mode 100644 node_modules/svelte/src/compiler/utils/ast.js create mode 100644 node_modules/svelte/src/compiler/utils/builders.js create mode 100644 node_modules/svelte/src/compiler/utils/compile_diagnostic.js create mode 100644 node_modules/svelte/src/compiler/utils/extract_svelte_ignore.js create mode 100644 node_modules/svelte/src/compiler/utils/mapped_code.js create mode 100644 node_modules/svelte/src/compiler/utils/push_array.js create mode 100644 node_modules/svelte/src/compiler/utils/sanitize_template_string.js create mode 100644 node_modules/svelte/src/compiler/utils/slot.js create mode 100644 node_modules/svelte/src/compiler/utils/string.js create mode 100644 node_modules/svelte/src/compiler/validate-options.js create mode 100644 node_modules/svelte/src/compiler/warnings.js create mode 100644 node_modules/svelte/src/constants.js create mode 100644 node_modules/svelte/src/easing/index.js create mode 100644 node_modules/svelte/src/escaping.js create mode 100644 node_modules/svelte/src/events/index.js create mode 100644 node_modules/svelte/src/events/public.d.ts create mode 100644 node_modules/svelte/src/html-tree-validation.js create mode 100644 node_modules/svelte/src/index-client.js create mode 100644 node_modules/svelte/src/index-server.js create mode 100644 node_modules/svelte/src/index.d.ts create mode 100644 node_modules/svelte/src/internal/client/constants.js create mode 100644 node_modules/svelte/src/internal/client/dev/assign.js create mode 100644 node_modules/svelte/src/internal/client/dev/console-log.js create mode 100644 node_modules/svelte/src/internal/client/dev/css.js create mode 100644 node_modules/svelte/src/internal/client/dev/elements.js create mode 100644 node_modules/svelte/src/internal/client/dev/equality.js create mode 100644 node_modules/svelte/src/internal/client/dev/hmr.js create mode 100644 node_modules/svelte/src/internal/client/dev/inspect.js create mode 100644 node_modules/svelte/src/internal/client/dev/legacy.js create mode 100644 node_modules/svelte/src/internal/client/dev/ownership.js create mode 100644 node_modules/svelte/src/internal/client/dev/tracing.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/await.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/boundary.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/css-props.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/each.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/html.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/if.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/key.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/slot.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/snippet.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/svelte-component.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/svelte-element.js create mode 100644 node_modules/svelte/src/internal/client/dom/blocks/svelte-head.js create mode 100644 node_modules/svelte/src/internal/client/dom/css.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/actions.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/attributes.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/document.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/input.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/media.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/navigator.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/props.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/select.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/size.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/this.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/universal.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/bindings/window.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/class.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/custom-element.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/events.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/misc.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/style.js create mode 100644 node_modules/svelte/src/internal/client/dom/elements/transitions.js create mode 100644 node_modules/svelte/src/internal/client/dom/hydration.js create mode 100644 node_modules/svelte/src/internal/client/dom/legacy/event-modifiers.js create mode 100644 node_modules/svelte/src/internal/client/dom/legacy/lifecycle.js create mode 100644 node_modules/svelte/src/internal/client/dom/legacy/misc.js create mode 100644 node_modules/svelte/src/internal/client/dom/operations.js create mode 100644 node_modules/svelte/src/internal/client/dom/reconciler.js create mode 100644 node_modules/svelte/src/internal/client/dom/task.js create mode 100644 node_modules/svelte/src/internal/client/dom/template.js create mode 100644 node_modules/svelte/src/internal/client/errors.js create mode 100644 node_modules/svelte/src/internal/client/index.js create mode 100644 node_modules/svelte/src/internal/client/loop.js create mode 100644 node_modules/svelte/src/internal/client/proxy.js create mode 100644 node_modules/svelte/src/internal/client/reactivity/deriveds.js create mode 100644 node_modules/svelte/src/internal/client/reactivity/effects.js create mode 100644 node_modules/svelte/src/internal/client/reactivity/equality.js create mode 100644 node_modules/svelte/src/internal/client/reactivity/props.js create mode 100644 node_modules/svelte/src/internal/client/reactivity/sources.js create mode 100644 node_modules/svelte/src/internal/client/reactivity/store.js create mode 100644 node_modules/svelte/src/internal/client/reactivity/types.d.ts create mode 100644 node_modules/svelte/src/internal/client/render.js create mode 100644 node_modules/svelte/src/internal/client/runtime.js create mode 100644 node_modules/svelte/src/internal/client/timing.js create mode 100644 node_modules/svelte/src/internal/client/types.d.ts create mode 100644 node_modules/svelte/src/internal/client/validate.js create mode 100644 node_modules/svelte/src/internal/client/warnings.js create mode 100644 node_modules/svelte/src/internal/disclose-version.js create mode 100644 node_modules/svelte/src/internal/flags/index.js create mode 100644 node_modules/svelte/src/internal/flags/legacy.js create mode 100644 node_modules/svelte/src/internal/flags/tracing.js create mode 100644 node_modules/svelte/src/internal/index.js create mode 100644 node_modules/svelte/src/internal/server/blocks/html.js create mode 100644 node_modules/svelte/src/internal/server/blocks/snippet.js create mode 100644 node_modules/svelte/src/internal/server/context.js create mode 100644 node_modules/svelte/src/internal/server/dev.js create mode 100644 node_modules/svelte/src/internal/server/errors.js create mode 100644 node_modules/svelte/src/internal/server/hydration.js create mode 100644 node_modules/svelte/src/internal/server/index.js create mode 100644 node_modules/svelte/src/internal/server/types.d.ts create mode 100644 node_modules/svelte/src/internal/shared/attributes.js create mode 100644 node_modules/svelte/src/internal/shared/clone.js create mode 100644 node_modules/svelte/src/internal/shared/errors.js create mode 100644 node_modules/svelte/src/internal/shared/types.d.ts create mode 100644 node_modules/svelte/src/internal/shared/utils.js create mode 100644 node_modules/svelte/src/internal/shared/validate.js create mode 100644 node_modules/svelte/src/internal/shared/warnings.js create mode 100644 node_modules/svelte/src/internal/types.d.ts create mode 100644 node_modules/svelte/src/legacy/legacy-client.js create mode 100644 node_modules/svelte/src/legacy/legacy-server.js create mode 100644 node_modules/svelte/src/motion/index.js create mode 100644 node_modules/svelte/src/motion/private.d.ts create mode 100644 node_modules/svelte/src/motion/public.d.ts create mode 100644 node_modules/svelte/src/motion/spring.js create mode 100644 node_modules/svelte/src/motion/tweened.js create mode 100644 node_modules/svelte/src/motion/utils.js create mode 100644 node_modules/svelte/src/reactivity/create-subscriber.js create mode 100644 node_modules/svelte/src/reactivity/date.js create mode 100644 node_modules/svelte/src/reactivity/index-client.js create mode 100644 node_modules/svelte/src/reactivity/index-server.js create mode 100644 node_modules/svelte/src/reactivity/map.js create mode 100644 node_modules/svelte/src/reactivity/media-query.js create mode 100644 node_modules/svelte/src/reactivity/reactive-value.js create mode 100644 node_modules/svelte/src/reactivity/set.js create mode 100644 node_modules/svelte/src/reactivity/url-search-params.js create mode 100644 node_modules/svelte/src/reactivity/url.js create mode 100644 node_modules/svelte/src/reactivity/utils.js create mode 100644 node_modules/svelte/src/reactivity/window/index.js create mode 100644 node_modules/svelte/src/server/index.d.ts create mode 100644 node_modules/svelte/src/server/index.js create mode 100644 node_modules/svelte/src/store/index-client.js create mode 100644 node_modules/svelte/src/store/index-server.js create mode 100644 node_modules/svelte/src/store/private.d.ts create mode 100644 node_modules/svelte/src/store/public.d.ts create mode 100644 node_modules/svelte/src/store/shared/index.js create mode 100644 node_modules/svelte/src/store/utils.js create mode 100644 node_modules/svelte/src/transition/index.js create mode 100644 node_modules/svelte/src/transition/public.d.ts create mode 100644 node_modules/svelte/src/utils.js create mode 100644 node_modules/svelte/src/version.js create mode 100644 node_modules/svelte/store.d.ts create mode 100644 node_modules/svelte/svelte-html.d.ts create mode 100644 node_modules/svelte/transition.d.ts create mode 100644 node_modules/svelte/types/compiler/interfaces.d.ts create mode 100644 node_modules/svelte/types/compiler/preprocess.d.ts create mode 100644 node_modules/svelte/types/index.d.ts create mode 100644 node_modules/svelte/types/index.d.ts.map create mode 100644 node_modules/svelte2tsx/LICENSE create mode 100644 node_modules/svelte2tsx/README.md create mode 100644 node_modules/svelte2tsx/index.d.ts create mode 100644 node_modules/svelte2tsx/index.js create mode 100644 node_modules/svelte2tsx/index.mjs create mode 100644 node_modules/svelte2tsx/package.json create mode 100644 node_modules/svelte2tsx/svelte-jsx-v4.d.ts create mode 100644 node_modules/svelte2tsx/svelte-jsx.d.ts create mode 100644 node_modules/svelte2tsx/svelte-native-jsx.d.ts create mode 100644 node_modules/svelte2tsx/svelte-shims-v4.d.ts create mode 100644 node_modules/svelte2tsx/svelte-shims.d.ts create mode 100644 node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/CHANGELOG.md create mode 100644 node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/LICENSE create mode 100644 node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/README.md create mode 100644 node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/index.js create mode 100644 node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/package.json create mode 100644 node_modules/tailwindcss/node_modules/readdirp/LICENSE create mode 100644 node_modules/tailwindcss/node_modules/readdirp/README.md create mode 100644 node_modules/tailwindcss/node_modules/readdirp/index.d.ts create mode 100644 node_modules/tailwindcss/node_modules/readdirp/index.js create mode 100644 node_modules/tailwindcss/node_modules/readdirp/package.json create mode 100644 node_modules/thenify-all/History.md create mode 100644 node_modules/thenify-all/LICENSE create mode 100644 node_modules/thenify-all/README.md create mode 100644 node_modules/thenify-all/index.js create mode 100644 node_modules/thenify-all/package.json create mode 100644 node_modules/thenify/History.md create mode 100644 node_modules/thenify/LICENSE create mode 100644 node_modules/thenify/README.md create mode 100644 node_modules/thenify/index.js create mode 100644 node_modules/thenify/package.json create mode 100644 node_modules/tiny-glob/index.d.ts create mode 100644 node_modules/tiny-glob/index.js create mode 100644 node_modules/tiny-glob/license create mode 100644 node_modules/tiny-glob/package.json create mode 100644 node_modules/tiny-glob/readme.md create mode 100644 node_modules/tiny-glob/sync.d.ts create mode 100644 node_modules/tiny-glob/sync.js create mode 100644 node_modules/to-regex-range/LICENSE create mode 100644 node_modules/to-regex-range/README.md create mode 100644 node_modules/to-regex-range/index.js create mode 100644 node_modules/to-regex-range/package.json create mode 100644 node_modules/totalist/dist/index.js create mode 100644 node_modules/totalist/dist/index.mjs create mode 100644 node_modules/totalist/index.d.ts create mode 100644 node_modules/totalist/license create mode 100644 node_modules/totalist/package.json create mode 100644 node_modules/totalist/readme.md create mode 100644 node_modules/totalist/sync/index.d.ts create mode 100644 node_modules/totalist/sync/index.js create mode 100644 node_modules/totalist/sync/index.mjs create mode 100644 node_modules/trim-repeated/index.js create mode 100644 node_modules/trim-repeated/license create mode 100644 node_modules/trim-repeated/package.json create mode 100644 node_modules/trim-repeated/readme.md create mode 100644 node_modules/ts-interface-checker/LICENSE create mode 100644 node_modules/ts-interface-checker/README.md create mode 100644 node_modules/ts-interface-checker/dist/index.d.ts create mode 100644 node_modules/ts-interface-checker/dist/index.js create mode 100644 node_modules/ts-interface-checker/dist/types.d.ts create mode 100644 node_modules/ts-interface-checker/dist/types.js create mode 100644 node_modules/ts-interface-checker/dist/util.d.ts create mode 100644 node_modules/ts-interface-checker/dist/util.js create mode 100644 node_modules/ts-interface-checker/package.json create mode 100644 node_modules/universalify/LICENSE create mode 100644 node_modules/universalify/README.md create mode 100644 node_modules/universalify/index.js create mode 100644 node_modules/universalify/package.json create mode 100644 node_modules/util-deprecate/History.md create mode 100644 node_modules/util-deprecate/LICENSE create mode 100644 node_modules/util-deprecate/README.md create mode 100644 node_modules/util-deprecate/browser.js create mode 100644 node_modules/util-deprecate/node.js create mode 100644 node_modules/util-deprecate/package.json create mode 100644 node_modules/which/CHANGELOG.md create mode 100644 node_modules/which/LICENSE create mode 100644 node_modules/which/README.md create mode 100755 node_modules/which/bin/node-which create mode 100644 node_modules/which/package.json create mode 100644 node_modules/which/which.js create mode 100755 node_modules/wrap-ansi-cjs/index.js create mode 100644 node_modules/wrap-ansi-cjs/license create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/index.d.ts create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/license create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/package.json create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-regex/readme.md create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/index.d.ts create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/license create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/package.json create mode 100644 node_modules/wrap-ansi-cjs/node_modules/ansi-styles/readme.md create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/LICENSE-MIT.txt create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/README.md create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/es2015/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/es2015/text.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/index.d.ts create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/package.json create mode 100644 node_modules/wrap-ansi-cjs/node_modules/emoji-regex/text.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/string-width/index.d.ts create mode 100644 node_modules/wrap-ansi-cjs/node_modules/string-width/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/string-width/license create mode 100644 node_modules/wrap-ansi-cjs/node_modules/string-width/package.json create mode 100644 node_modules/wrap-ansi-cjs/node_modules/string-width/readme.md create mode 100644 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/index.d.ts create mode 100644 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/index.js create mode 100644 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/license create mode 100644 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/package.json create mode 100644 node_modules/wrap-ansi-cjs/node_modules/strip-ansi/readme.md create mode 100644 node_modules/wrap-ansi-cjs/package.json create mode 100644 node_modules/wrap-ansi-cjs/readme.md create mode 100644 node_modules/wrap-ansi/index.d.ts create mode 100755 node_modules/wrap-ansi/index.js create mode 100644 node_modules/wrap-ansi/license create mode 100644 node_modules/wrap-ansi/package.json create mode 100644 node_modules/wrap-ansi/readme.md create mode 100644 node_modules/wrappy/LICENSE create mode 100644 node_modules/wrappy/README.md create mode 100644 node_modules/wrappy/package.json create mode 100644 node_modules/wrappy/wrappy.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 postcss.config.js create mode 100644 src/app.css create mode 100644 src/app.html create mode 100644 src/lib/components/BlurFade.svelte create mode 100644 src/lib/components/MagicCard.svelte create mode 100644 src/lib/components/contact.svelte create mode 100644 src/lib/components/hero.svelte create mode 100644 src/lib/components/navigations.svelte create mode 100644 src/lib/components/nexo_body_card.svelte create mode 100644 src/lib/components/nexo_card.svelte create mode 100644 src/lib/components/nexo_desc.svelte create mode 100644 src/lib/components/projects.svelte create mode 100644 src/lib/components/sbau_body_card.svelte create mode 100644 src/lib/components/sbau_card.svelte create mode 100644 src/lib/components/skills.svelte create mode 100644 src/lib/components/skillsMagicCard.svelte create mode 100644 src/lib/img/CSS_Logo.svg create mode 100644 src/lib/img/Html_Logo.svg create mode 100644 src/lib/img/Javascript_Logo.svg create mode 100644 src/lib/img/Mysql_Logo.svg create mode 100644 src/lib/img/Python_Logo.svg create mode 100644 src/lib/img/Svelte_Logo.svg create mode 100644 src/lib/img/Tailwind_Logo.svg create mode 100644 src/lib/img/bg.png create mode 100644 src/lib/img/discordpy_logo.png create mode 100644 src/lib/img/mobbg.png create mode 100644 src/lib/img/nexo_mockup.png create mode 100644 src/lib/img/nexo_screenshot.png create mode 100644 src/lib/img/sbau_mockup.png create mode 100644 src/lib/utils.ts create mode 100644 src/routes/+layout.svelte create mode 100644 src/routes/+page.svelte create mode 100644 src/routes/contact/+page.svelte create mode 100644 src/routes/nexo_project/+page.svelte create mode 100644 src/routes/projects/+page.svelte create mode 100644 src/routes/skills/+page.svelte create mode 100644 static/.nojekyll create mode 100644 static/favicon.png create mode 100644 svelte.config.js create mode 100644 tailwind.config.js create mode 100644 vite.config.js diff --git a/README.md b/README.md new file mode 100644 index 00000000..c3eaf08c --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +My portfolio website. +f1rq.ovh \ No newline at end of file diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 00000000..1394d6cd --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "./.svelte-kit/tsconfig.json", + "compilerOptions": { + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": true, + "module": "NodeNext", + "moduleResolution": "NodeNext" + } +} diff --git a/node_modules/.svelte2tsx-language-server-files/svelte-native-jsx.d.ts b/node_modules/.svelte2tsx-language-server-files/svelte-native-jsx.d.ts new file mode 100644 index 00000000..0c08d71c --- /dev/null +++ b/node_modules/.svelte2tsx-language-server-files/svelte-native-jsx.d.ts @@ -0,0 +1,32 @@ +declare namespace svelteNative.JSX { + + // Every namespace eligible for use needs to implement the following two functions + function mapElementTag( + tag: string + ): any; + + function createElement( + element: Key | undefined | null, attrs: Elements[Key] + ): any; + function createElement( + element: Key | undefined | null, attrEnhancers: T, attrs: Elements[Key] & T + ): any; + + + /* svelte specific */ + interface ElementClass { + $$prop_def: any; + } + + interface ElementAttributesProperty { + $$prop_def: any; // specify the property name to use + } + + // Add empty IntrinsicAttributes to prevent fallback to the one in the JSX namespace + interface IntrinsicAttributes { + } + + interface IntrinsicElements { + [name: string]: { [name: string]: any }; + } +} \ No newline at end of file diff --git a/node_modules/.svelte2tsx-language-server-files/svelte-shims-v4.d.ts b/node_modules/.svelte2tsx-language-server-files/svelte-shims-v4.d.ts new file mode 100644 index 00000000..fcaf92f6 --- /dev/null +++ b/node_modules/.svelte2tsx-language-server-files/svelte-shims-v4.d.ts @@ -0,0 +1,287 @@ +// Whenever a ambient declaration changes, its number should be increased +// This way, we avoid the situation where multiple ambient versions of svelte2tsx +// are loaded and their declarations conflict each other +// See https://github.com/sveltejs/language-tools/issues/1059 for an example bug that stems from it +// If you change anything in this file, think about whether or not it should be backported to svelte-shims.d.ts + +type AConstructorTypeOf = new (...args: U) => T; + +/** @internal PRIVATE API, DO NOT USE */ +type SvelteActionReturnType = { + update?: (args: any) => void, + destroy?: () => void +} | void + +/** @internal PRIVATE API, DO NOT USE */ +type SvelteTransitionConfig = { + delay?: number, + duration?: number, + easing?: (t: number) => number, + css?: (t: number, u: number) => string, + tick?: (t: number, u: number) => void +} + +/** @internal PRIVATE API, DO NOT USE */ +type SvelteTransitionReturnType = SvelteTransitionConfig | (() => SvelteTransitionConfig) + +/** @internal PRIVATE API, DO NOT USE */ +type SvelteAnimationReturnType = { + delay?: number, + duration?: number, + easing?: (t: number) => number, + css?: (t: number, u: number) => string, + tick?: (t: number, u: number) => void +} + +/** @internal PRIVATE API, DO NOT USE */ +type SvelteWithOptionalProps = Omit & Partial>; +/** @internal PRIVATE API, DO NOT USE */ +type SvelteAllProps = { [index: string]: any } +/** @internal PRIVATE API, DO NOT USE */ +type SveltePropsAnyFallback = {[K in keyof Props]: Props[K] extends never ? never : Props[K] extends undefined ? any : Props[K]} +/** @internal PRIVATE API, DO NOT USE */ +type SvelteSlotsAnyFallback = {[K in keyof Slots]: {[S in keyof Slots[K]]: Slots[K][S] extends undefined ? any : Slots[K][S]}} +/** @internal PRIVATE API, DO NOT USE */ +type SvelteRestProps = { [index: string]: any } +/** @internal PRIVATE API, DO NOT USE */ +type SvelteSlots = { [index: string]: any } +/** @internal PRIVATE API, DO NOT USE */ +type SvelteStore = { subscribe: (run: (value: T) => any, invalidate?: any) => any } + +// Forces TypeScript to look into the type which results in a better representation of it +// which helps for error messages and is necessary for d.ts file transformation so that +// no ambient type references are left in the output +/** @internal PRIVATE API, DO NOT USE */ +type Expand = T extends infer O ? { [K in keyof O]: O[K] } : never; + +/** @internal PRIVATE API, DO NOT USE */ +type KeysMatching = {[K in keyof Obj]-?: Obj[K] extends V ? K : never}[keyof Obj] +/** @internal PRIVATE API, DO NOT USE */ +declare type __sveltets_2_CustomEvents = {[K in KeysMatching]: T[K] extends CustomEvent ? T[K]['detail']: T[K]} + +declare function __sveltets_2_ensureRightProps(props: Props): {}; +declare function __sveltets_2_instanceOf(type: AConstructorTypeOf): T; +declare function __sveltets_2_allPropsType(): SvelteAllProps +declare function __sveltets_2_restPropsType(): SvelteRestProps +declare function __sveltets_2_slotsType(slots: Slots): Record; + +// Overload of the following two functions is necessary. +// An empty array of optionalProps makes OptionalProps type any, which means we lose the prop typing. +// optionalProps need to be first or its type cannot be infered correctly. + +declare function __sveltets_2_partial( + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Expand>, events: Events, slots: Expand>, exports?: Exports, bindings?: Bindings } +declare function __sveltets_2_partial( + optionalProps: OptionalProps[], + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Expand, OptionalProps>>, events: Events, slots: Expand>, exports?: Exports, bindings?: Bindings } + +declare function __sveltets_2_partial_with_any( + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Expand & SvelteAllProps>, events: Events, slots: Expand>, exports?: Exports, bindings?: Bindings } +declare function __sveltets_2_partial_with_any( + optionalProps: OptionalProps[], + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Expand, OptionalProps> & SvelteAllProps>, events: Events, slots: Expand>, exports?: Exports, bindings?: Bindings } + + +declare function __sveltets_2_with_any( + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Expand, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } + +declare function __sveltets_2_with_any_event( + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Props, events: Events & {[evt: string]: CustomEvent;}, slots: Slots, exports?: Exports, bindings?: Bindings } + +declare function __sveltets_2_store_get(store: SvelteStore): T +declare function __sveltets_2_store_get | undefined | null>(store: Store): Store extends SvelteStore ? T : Store; +declare function __sveltets_2_any(dummy: any): any; +declare function __sveltets_2_invalidate(getValue: () => T): T + +declare function __sveltets_2_mapWindowEvent( + event: K +): HTMLBodyElementEventMap[K]; +declare function __sveltets_2_mapBodyEvent( + event: K +): WindowEventMap[K]; +declare function __sveltets_2_mapElementEvent( + event: K +): HTMLElementEventMap[K]; + +declare function __sveltets_2_bubbleEventDef( + events: Events, eventKey: K +): Events[K]; +declare function __sveltets_2_bubbleEventDef( + events: any, eventKey: string +): any; + +declare const __sveltets_2_customEvent: CustomEvent; +declare function __sveltets_2_toEventTypings(): {[Key in keyof Typings]: CustomEvent}; + +declare function __sveltets_2_unionType(t1: T1, t2: T2): T1 | T2; +declare function __sveltets_2_unionType(t1: T1, t2: T2, t3: T3): T1 | T2 | T3; +declare function __sveltets_2_unionType(t1: T1, t2: T2, t3: T3, t4: T4): T1 | T2 | T3 | T4; +declare function __sveltets_2_unionType(...types: any[]): any; + +declare function __sveltets_2_createSvelte2TsxComponent( + render: {props: Props, events: Events, slots: Slots } +): typeof import("svelte").SvelteComponent; + +declare function __sveltets_2_unwrapArr(arr: ArrayLike): T +declare function __sveltets_2_unwrapPromiseLike(promise: PromiseLike | T): T + +// v2 +declare function __sveltets_2_createCreateSlot>>(): (slotName: SlotName, attrs: Slots[SlotName]) => Record; +declare function __sveltets_2_createComponentAny(props: Record): import("svelte").SvelteComponent; + +declare function __sveltets_2_any(...dummy: any[]): any; +declare function __sveltets_2_empty(...dummy: any[]): {}; +declare function __sveltets_2_union(t1:T1,t2?:T2,t3?:T3,t4?:T4,t5?:T5,t6?:T6,t7?:T7,t8?:T8,t9?:T9,t10?:T10): T1 & T2 & T3 & T4 & T5 & T6 & T7 & T8 & T9 & T10; +declare function __sveltets_2_nonNullable(type: T): NonNullable; + +declare function __sveltets_2_cssProp(prop: Record): {}; + +// @ts-ignore Svelte v3/v4 don't have this +declare function __sveltets_2_ensureSnippet(val: ReturnType | undefined | null): any; + +/** @internal PRIVATE API, DO NOT USE */ +type __sveltets_2_SvelteAnimationReturnType = { + delay?: number, + duration?: number, + easing?: (t: number) => number, + css?: (t: number, u: number) => string, + tick?: (t: number, u: number) => void +} +declare var __sveltets_2_AnimationMove: { from: DOMRect, to: DOMRect } +declare function __sveltets_2_ensureAnimation(animationCall: __sveltets_2_SvelteAnimationReturnType): {}; + +/** @internal PRIVATE API, DO NOT USE */ +type __sveltets_2_SvelteActionReturnType = { + update?: (args: any) => void, + destroy?: () => void, + $$_attributes?: Record, +} | void +declare function __sveltets_2_ensureAction(actionCall: T): T extends {$$_attributes?: any} ? T['$$_attributes'] : {}; + +/** @internal PRIVATE API, DO NOT USE */ +type __sveltets_2_SvelteTransitionConfig = { + delay?: number, + duration?: number, + easing?: (t: number) => number, + css?: (t: number, u: number) => string, + tick?: (t: number, u: number) => void +} +/** @internal PRIVATE API, DO NOT USE */ +type __sveltets_2_SvelteTransitionReturnType = __sveltets_2_SvelteTransitionConfig | (() => __sveltets_2_SvelteTransitionConfig) +declare function __sveltets_2_ensureTransition(transitionCall: __sveltets_2_SvelteTransitionReturnType): {}; + +// Includes undefined and null for all types as all usages also allow these +declare function __sveltets_2_ensureType(type: AConstructorTypeOf, el: T | undefined | null): {}; +declare function __sveltets_2_ensureType(type1: AConstructorTypeOf, type2: AConstructorTypeOf, el: T1 | T2 | undefined | null): {}; + +// The following is necessary because there are two clashing errors that can't be solved at the same time +// when using Svelte2TsxComponent, more precisely the event typings in +// __sveltets_2_ensureComponent _SvelteComponent>(type: T): T; +// If we type it as "any", we have an error when using sth like {a: CustomEvent} +// If we type it as "{}", we have an error when using sth like {[evt: string]: CustomEvent} +// If we type it as "unknown", we get all kinds of follow up errors which we want to avoid +// Therefore introduce two more base classes just for this case. +/** + * Ambient type only used for intellisense, DO NOT USE IN YOUR PROJECT + */ +declare type ATypedSvelteComponent = { + /** + * @internal This is for type checking capabilities only + * and does not exist at runtime. Don't use this property. + */ + $$prop_def: any; + /** + * @internal This is for type checking capabilities only + * and does not exist at runtime. Don't use this property. + */ + $$events_def: any; + /** + * @internal This is for type checking capabilities only + * and does not exist at runtime. Don't use this property. + */ + $$slot_def: any; + + $on(event: string, handler: any): () => void; +} +/** + * Ambient type only used for intellisense, DO NOT USE IN YOUR PROJECT. + * + * If you're looking for the type of a Svelte Component, use `SvelteComponent` and `ComponentType` instead: + * + * ```ts + * import type { ComponentType, SvelteComponent } from "svelte"; + * let myComponentConstructor: ComponentType = ..; + * ``` + */ +declare type ConstructorOfATypedSvelteComponent = new (args: {target: any, props?: any}) => ATypedSvelteComponent +// Usage note: Cannot properly transform generic function components to class components due to TypeScript limitations +declare function __sveltets_2_ensureComponent< + T extends + | ConstructorOfATypedSvelteComponent + | (typeof import('svelte') extends { mount: any } + ? // @ts-ignore svelte.Component doesn't exist in Svelte 4 + import('svelte').Component + : never) + | null + | undefined +>( + type: T +): NonNullable< + T extends ConstructorOfATypedSvelteComponent + ? T + : typeof import('svelte') extends { mount: any } + ? // @ts-ignore svelte.Component doesn't exist in Svelte 4 + T extends import('svelte').Component< + infer Props extends Record, + infer Exports extends Record, + infer Bindings extends string + > + ? new ( + options: import('svelte').ComponentConstructorOptions + ) => import('svelte').SvelteComponent & + Exports & { $$bindings: Bindings } + : never + : never +>; + +declare function __sveltets_2_ensureArray | Iterable>(array: T): T extends ArrayLike ? U[] : T extends Iterable ? Iterable : any[]; + +type __sveltets_2_PropsWithChildren = Props & + (Slots extends { default: any } + // This is unfortunate because it means "accepts no props" turns into "accepts any prop" + // but the alternative is non-fixable type errors because of the way TypeScript index + // signatures work (they will always take precedence and make an impossible-to-satisfy children type). + ? Props extends Record + ? any + : { children?: any } + : {}); +declare function __sveltets_2_runes_constructor(render: {props: Props }): import("svelte").ComponentConstructorOptions; + +declare function __sveltets_2_get_set_binding(get: (() => T) | null | undefined, set: (t: T) => void): T; + +declare function __sveltets_$$bindings(...bindings: Bindings): Bindings[number]; + +declare function __sveltets_2_fn_component< + Props extends Record, Exports extends Record, Bindings extends string + // @ts-ignore Svelte 5 only +>(klass: {props: Props, exports?: Exports, bindings?: Bindings }): import('svelte').Component; + +interface __sveltets_2_IsomorphicComponent = any, Events extends Record = any, Slots extends Record = any, Exports = {}, Bindings = string> { + new (options: import('svelte').ComponentConstructorOptions): import('svelte').SvelteComponent & { $$bindings?: Bindings } & Exports; + (internal: unknown, props: Props extends Record ? {$$events?: Events, $$slots?: Slots} : Props & {$$events?: Events, $$slots?: Slots}): Exports & { $set?: any, $on?: any }; + z_$$bindings?: Bindings; +} + +declare function __sveltets_2_isomorphic_component< + Props extends Record, Events extends Record, Slots extends Record, Exports extends Record, Bindings extends string +>(klass: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }): __sveltets_2_IsomorphicComponent; + +declare function __sveltets_2_isomorphic_component_slots< + Props extends Record, Events extends Record, Slots extends Record, Exports extends Record, Bindings extends string +>(klass: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }): __sveltets_2_IsomorphicComponent<__sveltets_2_PropsWithChildren, Events, Slots, Exports, Bindings>; diff --git a/node_modules/@alloc/quick-lru/index.d.ts b/node_modules/@alloc/quick-lru/index.d.ts new file mode 100644 index 00000000..eb819bad --- /dev/null +++ b/node_modules/@alloc/quick-lru/index.d.ts @@ -0,0 +1,128 @@ +declare namespace QuickLRU { + interface Options { + /** + The maximum number of milliseconds an item should remain in the cache. + + @default Infinity + + By default, `maxAge` will be `Infinity`, which means that items will never expire. + Lazy expiration upon the next write or read call. + + Individual expiration of an item can be specified by the `set(key, value, maxAge)` method. + */ + readonly maxAge?: number; + + /** + The maximum number of items before evicting the least recently used items. + */ + readonly maxSize: number; + + /** + Called right before an item is evicted from the cache. + + Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`). + */ + onEviction?: (key: KeyType, value: ValueType) => void; + } +} + +declare class QuickLRU + implements Iterable<[KeyType, ValueType]> { + /** + The stored item count. + */ + readonly size: number; + + /** + Simple ["Least Recently Used" (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29). + + The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop. + + @example + ``` + import QuickLRU = require('quick-lru'); + + const lru = new QuickLRU({maxSize: 1000}); + + lru.set('🦄', '🌈'); + + lru.has('🦄'); + //=> true + + lru.get('🦄'); + //=> '🌈' + ``` + */ + constructor(options: QuickLRU.Options); + + [Symbol.iterator](): IterableIterator<[KeyType, ValueType]>; + + /** + Set an item. Returns the instance. + + Individual expiration of an item can be specified with the `maxAge` option. If not specified, the global `maxAge` value will be used in case it is specified in the constructor, otherwise the item will never expire. + + @returns The list instance. + */ + set(key: KeyType, value: ValueType, options?: {maxAge?: number}): this; + + /** + Get an item. + + @returns The stored item or `undefined`. + */ + get(key: KeyType): ValueType | undefined; + + /** + Check if an item exists. + */ + has(key: KeyType): boolean; + + /** + Get an item without marking it as recently used. + + @returns The stored item or `undefined`. + */ + peek(key: KeyType): ValueType | undefined; + + /** + Delete an item. + + @returns `true` if the item is removed or `false` if the item doesn't exist. + */ + delete(key: KeyType): boolean; + + /** + Delete all items. + */ + clear(): void; + + /** + Update the `maxSize` in-place, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee. + + Useful for on-the-fly tuning of cache sizes in live systems. + */ + resize(maxSize: number): void; + + /** + Iterable for all the keys. + */ + keys(): IterableIterator; + + /** + Iterable for all the values. + */ + values(): IterableIterator; + + /** + Iterable for all entries, starting with the oldest (ascending in recency). + */ + entriesAscending(): IterableIterator<[KeyType, ValueType]>; + + /** + Iterable for all entries, starting with the newest (descending in recency). + */ + entriesDescending(): IterableIterator<[KeyType, ValueType]>; +} + +export = QuickLRU; diff --git a/node_modules/@alloc/quick-lru/index.js b/node_modules/@alloc/quick-lru/index.js new file mode 100644 index 00000000..7eeced23 --- /dev/null +++ b/node_modules/@alloc/quick-lru/index.js @@ -0,0 +1,263 @@ +'use strict'; + +class QuickLRU { + constructor(options = {}) { + if (!(options.maxSize && options.maxSize > 0)) { + throw new TypeError('`maxSize` must be a number greater than 0'); + } + + if (typeof options.maxAge === 'number' && options.maxAge === 0) { + throw new TypeError('`maxAge` must be a number greater than 0'); + } + + this.maxSize = options.maxSize; + this.maxAge = options.maxAge || Infinity; + this.onEviction = options.onEviction; + this.cache = new Map(); + this.oldCache = new Map(); + this._size = 0; + } + + _emitEvictions(cache) { + if (typeof this.onEviction !== 'function') { + return; + } + + for (const [key, item] of cache) { + this.onEviction(key, item.value); + } + } + + _deleteIfExpired(key, item) { + if (typeof item.expiry === 'number' && item.expiry <= Date.now()) { + if (typeof this.onEviction === 'function') { + this.onEviction(key, item.value); + } + + return this.delete(key); + } + + return false; + } + + _getOrDeleteIfExpired(key, item) { + const deleted = this._deleteIfExpired(key, item); + if (deleted === false) { + return item.value; + } + } + + _getItemValue(key, item) { + return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value; + } + + _peek(key, cache) { + const item = cache.get(key); + + return this._getItemValue(key, item); + } + + _set(key, value) { + this.cache.set(key, value); + this._size++; + + if (this._size >= this.maxSize) { + this._size = 0; + this._emitEvictions(this.oldCache); + this.oldCache = this.cache; + this.cache = new Map(); + } + } + + _moveToRecent(key, item) { + this.oldCache.delete(key); + this._set(key, item); + } + + * _entriesAscending() { + for (const item of this.oldCache) { + const [key, value] = item; + if (!this.cache.has(key)) { + const deleted = this._deleteIfExpired(key, value); + if (deleted === false) { + yield item; + } + } + } + + for (const item of this.cache) { + const [key, value] = item; + const deleted = this._deleteIfExpired(key, value); + if (deleted === false) { + yield item; + } + } + } + + get(key) { + if (this.cache.has(key)) { + const item = this.cache.get(key); + + return this._getItemValue(key, item); + } + + if (this.oldCache.has(key)) { + const item = this.oldCache.get(key); + if (this._deleteIfExpired(key, item) === false) { + this._moveToRecent(key, item); + return item.value; + } + } + } + + set(key, value, {maxAge = this.maxAge === Infinity ? undefined : Date.now() + this.maxAge} = {}) { + if (this.cache.has(key)) { + this.cache.set(key, { + value, + maxAge + }); + } else { + this._set(key, {value, expiry: maxAge}); + } + } + + has(key) { + if (this.cache.has(key)) { + return !this._deleteIfExpired(key, this.cache.get(key)); + } + + if (this.oldCache.has(key)) { + return !this._deleteIfExpired(key, this.oldCache.get(key)); + } + + return false; + } + + peek(key) { + if (this.cache.has(key)) { + return this._peek(key, this.cache); + } + + if (this.oldCache.has(key)) { + return this._peek(key, this.oldCache); + } + } + + delete(key) { + const deleted = this.cache.delete(key); + if (deleted) { + this._size--; + } + + return this.oldCache.delete(key) || deleted; + } + + clear() { + this.cache.clear(); + this.oldCache.clear(); + this._size = 0; + } + + resize(newSize) { + if (!(newSize && newSize > 0)) { + throw new TypeError('`maxSize` must be a number greater than 0'); + } + + const items = [...this._entriesAscending()]; + const removeCount = items.length - newSize; + if (removeCount < 0) { + this.cache = new Map(items); + this.oldCache = new Map(); + this._size = items.length; + } else { + if (removeCount > 0) { + this._emitEvictions(items.slice(0, removeCount)); + } + + this.oldCache = new Map(items.slice(removeCount)); + this.cache = new Map(); + this._size = 0; + } + + this.maxSize = newSize; + } + + * keys() { + for (const [key] of this) { + yield key; + } + } + + * values() { + for (const [, value] of this) { + yield value; + } + } + + * [Symbol.iterator]() { + for (const item of this.cache) { + const [key, value] = item; + const deleted = this._deleteIfExpired(key, value); + if (deleted === false) { + yield [key, value.value]; + } + } + + for (const item of this.oldCache) { + const [key, value] = item; + if (!this.cache.has(key)) { + const deleted = this._deleteIfExpired(key, value); + if (deleted === false) { + yield [key, value.value]; + } + } + } + } + + * entriesDescending() { + let items = [...this.cache]; + for (let i = items.length - 1; i >= 0; --i) { + const item = items[i]; + const [key, value] = item; + const deleted = this._deleteIfExpired(key, value); + if (deleted === false) { + yield [key, value.value]; + } + } + + items = [...this.oldCache]; + for (let i = items.length - 1; i >= 0; --i) { + const item = items[i]; + const [key, value] = item; + if (!this.cache.has(key)) { + const deleted = this._deleteIfExpired(key, value); + if (deleted === false) { + yield [key, value.value]; + } + } + } + } + + * entriesAscending() { + for (const [key, value] of this._entriesAscending()) { + yield [key, value.value]; + } + } + + get size() { + if (!this._size) { + return this.oldCache.size; + } + + let oldCacheSize = 0; + for (const key of this.oldCache.keys()) { + if (!this.cache.has(key)) { + oldCacheSize++; + } + } + + return Math.min(this._size + oldCacheSize, this.maxSize); + } +} + +module.exports = QuickLRU; diff --git a/node_modules/@alloc/quick-lru/license b/node_modules/@alloc/quick-lru/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/@alloc/quick-lru/license @@ -0,0 +1,9 @@ +MIT License + +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/@alloc/quick-lru/package.json b/node_modules/@alloc/quick-lru/package.json new file mode 100644 index 00000000..21f10726 --- /dev/null +++ b/node_modules/@alloc/quick-lru/package.json @@ -0,0 +1,43 @@ +{ + "name": "@alloc/quick-lru", + "version": "5.2.0", + "description": "Simple “Least Recently Used” (LRU) cache", + "license": "MIT", + "repository": "sindresorhus/quick-lru", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=10" + }, + "scripts": { + "test": "xo && nyc ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "lru", + "quick", + "cache", + "caching", + "least", + "recently", + "used", + "fast", + "map", + "hash", + "buffer" + ], + "devDependencies": { + "ava": "^2.0.0", + "coveralls": "^3.0.3", + "nyc": "^15.0.0", + "tsd": "^0.11.0", + "xo": "^0.26.0" + } +} diff --git a/node_modules/@alloc/quick-lru/readme.md b/node_modules/@alloc/quick-lru/readme.md new file mode 100644 index 00000000..7187ba59 --- /dev/null +++ b/node_modules/@alloc/quick-lru/readme.md @@ -0,0 +1,139 @@ +# quick-lru [![Build Status](https://travis-ci.org/sindresorhus/quick-lru.svg?branch=master)](https://travis-ci.org/sindresorhus/quick-lru) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/quick-lru/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/quick-lru?branch=master) + +> Simple [“Least Recently Used” (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29) + +Useful when you need to cache something and limit memory usage. + +Inspired by the [`hashlru` algorithm](https://github.com/dominictarr/hashlru#algorithm), but instead uses [`Map`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map) to support keys of any type, not just strings, and values can be `undefined`. + +## Install + +``` +$ npm install quick-lru +``` + +## Usage + +```js +const QuickLRU = require('quick-lru'); + +const lru = new QuickLRU({maxSize: 1000}); + +lru.set('🦄', '🌈'); + +lru.has('🦄'); +//=> true + +lru.get('🦄'); +//=> '🌈' +``` + +## API + +### new QuickLRU(options?) + +Returns a new instance. + +### options + +Type: `object` + +#### maxSize + +*Required*\ +Type: `number` + +The maximum number of items before evicting the least recently used items. + +#### maxAge + +Type: `number`\ +Default: `Infinity` + +The maximum number of milliseconds an item should remain in cache. +By default maxAge will be Infinity, which means that items will never expire. + +Lazy expiration happens upon the next `write` or `read` call. + +Individual expiration of an item can be specified by the `set(key, value, options)` method. + +#### onEviction + +*Optional*\ +Type: `(key, value) => void` + +Called right before an item is evicted from the cache. + +Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`). + +### Instance + +The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop. + +Both `key` and `value` can be of any type. + +#### .set(key, value, options?) + +Set an item. Returns the instance. + +Individual expiration of an item can be specified with the `maxAge` option. If not specified, the global `maxAge` value will be used in case it is specified on the constructor, otherwise the item will never expire. + +#### .get(key) + +Get an item. + +#### .has(key) + +Check if an item exists. + +#### .peek(key) + +Get an item without marking it as recently used. + +#### .delete(key) + +Delete an item. + +Returns `true` if the item is removed or `false` if the item doesn't exist. + +#### .clear() + +Delete all items. + +#### .resize(maxSize) + +Update the `maxSize`, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee. + +Useful for on-the-fly tuning of cache sizes in live systems. + +#### .keys() + +Iterable for all the keys. + +#### .values() + +Iterable for all the values. + +#### .entriesAscending() + +Iterable for all entries, starting with the oldest (ascending in recency). + +#### .entriesDescending() + +Iterable for all entries, starting with the newest (descending in recency). + +#### .size + +The stored item count. + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/@isaacs/cliui/LICENSE.txt b/node_modules/@isaacs/cliui/LICENSE.txt new file mode 100644 index 00000000..c7e27478 --- /dev/null +++ b/node_modules/@isaacs/cliui/LICENSE.txt @@ -0,0 +1,14 @@ +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/@isaacs/cliui/README.md b/node_modules/@isaacs/cliui/README.md new file mode 100644 index 00000000..48806426 --- /dev/null +++ b/node_modules/@isaacs/cliui/README.md @@ -0,0 +1,143 @@ +# @isaacs/cliui + +Temporary fork of [cliui](http://npm.im/cliui). + +![ci](https://github.com/yargs/cliui/workflows/ci/badge.svg) +[![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui) +[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) +![nycrc config on GitHub](https://img.shields.io/nycrc/yargs/cliui) + +easily create complex multi-column command-line-interfaces. + +## Example + +```js +const ui = require('cliui')() + +ui.div('Usage: $0 [command] [options]') + +ui.div({ + text: 'Options:', + padding: [2, 0, 1, 0] +}) + +ui.div( + { + text: "-f, --file", + width: 20, + padding: [0, 4, 0, 4] + }, + { + text: "the file to load." + + chalk.green("(if this description is long it wraps).") + , + width: 20 + }, + { + text: chalk.red("[required]"), + align: 'right' + } +) + +console.log(ui.toString()) +``` + +## Deno/ESM Support + +As of `v7` `cliui` supports [Deno](https://github.com/denoland/deno) and +[ESM](https://nodejs.org/api/esm.html#esm_ecmascript_modules): + +```typescript +import cliui from "https://deno.land/x/cliui/deno.ts"; + +const ui = cliui({}) + +ui.div('Usage: $0 [command] [options]') + +ui.div({ + text: 'Options:', + padding: [2, 0, 1, 0] +}) + +ui.div({ + text: "-f, --file", + width: 20, + padding: [0, 4, 0, 4] +}) + +console.log(ui.toString()) +``` + + + +## Layout DSL + +cliui exposes a simple layout DSL: + +If you create a single `ui.div`, passing a string rather than an +object: + +* `\n`: characters will be interpreted as new rows. +* `\t`: characters will be interpreted as new columns. +* `\s`: characters will be interpreted as padding. + +**as an example...** + +```js +var ui = require('./')({ + width: 60 +}) + +ui.div( + 'Usage: node ./bin/foo.js\n' + + ' \t provide a regex\n' + + ' \t provide a glob\t [required]' +) + +console.log(ui.toString()) +``` + +**will output:** + +```shell +Usage: node ./bin/foo.js + provide a regex + provide a glob [required] +``` + +## Methods + +```js +cliui = require('cliui') +``` + +### cliui({width: integer}) + +Specify the maximum width of the UI being generated. +If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`. + +### cliui({wrap: boolean}) + +Enable or disable the wrapping of text in a column. + +### cliui.div(column, column, column) + +Create a row with any number of columns, a column +can either be a string, or an object with the following +options: + +* **text:** some text to place in the column. +* **width:** the width of a column. +* **align:** alignment, `right` or `center`. +* **padding:** `[top, right, bottom, left]`. +* **border:** should a border be placed around the div? + +### cliui.span(column, column, column) + +Similar to `div`, except the next row will be appended without +a new line being created. + +### cliui.resetOutput() + +Resets the UI elements of the current cliui instance, maintaining the values +set for `width` and `wrap`. diff --git a/node_modules/@isaacs/cliui/build/index.cjs b/node_modules/@isaacs/cliui/build/index.cjs new file mode 100644 index 00000000..aca2b850 --- /dev/null +++ b/node_modules/@isaacs/cliui/build/index.cjs @@ -0,0 +1,317 @@ +'use strict'; + +const align = { + right: alignRight, + center: alignCenter +}; +const top = 0; +const right = 1; +const bottom = 2; +const left = 3; +class UI { + constructor(opts) { + var _a; + this.width = opts.width; + /* c8 ignore start */ + this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true; + /* c8 ignore stop */ + this.rows = []; + } + span(...args) { + const cols = this.div(...args); + cols.span = true; + } + resetOutput() { + this.rows = []; + } + div(...args) { + if (args.length === 0) { + this.div(''); + } + if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') { + return this.applyLayoutDSL(args[0]); + } + const cols = args.map(arg => { + if (typeof arg === 'string') { + return this.colFromString(arg); + } + return arg; + }); + this.rows.push(cols); + return cols; + } + shouldApplyLayoutDSL(...args) { + return args.length === 1 && typeof args[0] === 'string' && + /[\t\n]/.test(args[0]); + } + applyLayoutDSL(str) { + const rows = str.split('\n').map(row => row.split('\t')); + let leftColumnWidth = 0; + // simple heuristic for layout, make sure the + // second column lines up along the left-hand. + // don't allow the first column to take up more + // than 50% of the screen. + rows.forEach(columns => { + if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) { + leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0])); + } + }); + // generate a table: + // replacing ' ' with padding calculations. + // using the algorithmically generated width. + rows.forEach(columns => { + this.div(...columns.map((r, i) => { + return { + text: r.trim(), + padding: this.measurePadding(r), + width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined + }; + })); + }); + return this.rows[this.rows.length - 1]; + } + colFromString(text) { + return { + text, + padding: this.measurePadding(text) + }; + } + measurePadding(str) { + // measure padding without ansi escape codes + const noAnsi = mixin.stripAnsi(str); + return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]; + } + toString() { + const lines = []; + this.rows.forEach(row => { + this.rowToString(row, lines); + }); + // don't display any lines with the + // hidden flag set. + return lines + .filter(line => !line.hidden) + .map(line => line.text) + .join('\n'); + } + rowToString(row, lines) { + this.rasterize(row).forEach((rrow, r) => { + let str = ''; + rrow.forEach((col, c) => { + const { width } = row[c]; // the width with padding. + const wrapWidth = this.negatePadding(row[c]); // the width without padding. + let ts = col; // temporary string used during alignment/padding. + if (wrapWidth > mixin.stringWidth(col)) { + ts += ' '.repeat(wrapWidth - mixin.stringWidth(col)); + } + // align the string within its column. + if (row[c].align && row[c].align !== 'left' && this.wrap) { + const fn = align[row[c].align]; + ts = fn(ts, wrapWidth); + if (mixin.stringWidth(ts) < wrapWidth) { + /* c8 ignore start */ + const w = width || 0; + /* c8 ignore stop */ + ts += ' '.repeat(w - mixin.stringWidth(ts) - 1); + } + } + // apply border and padding to string. + const padding = row[c].padding || [0, 0, 0, 0]; + if (padding[left]) { + str += ' '.repeat(padding[left]); + } + str += addBorder(row[c], ts, '| '); + str += ts; + str += addBorder(row[c], ts, ' |'); + if (padding[right]) { + str += ' '.repeat(padding[right]); + } + // if prior row is span, try to render the + // current row on the prior line. + if (r === 0 && lines.length > 0) { + str = this.renderInline(str, lines[lines.length - 1]); + } + }); + // remove trailing whitespace. + lines.push({ + text: str.replace(/ +$/, ''), + span: row.span + }); + }); + return lines; + } + // if the full 'source' can render in + // the target line, do so. + renderInline(source, previousLine) { + const match = source.match(/^ */); + /* c8 ignore start */ + const leadingWhitespace = match ? match[0].length : 0; + /* c8 ignore stop */ + const target = previousLine.text; + const targetTextWidth = mixin.stringWidth(target.trimEnd()); + if (!previousLine.span) { + return source; + } + // if we're not applying wrapping logic, + // just always append to the span. + if (!this.wrap) { + previousLine.hidden = true; + return target + source; + } + if (leadingWhitespace < targetTextWidth) { + return source; + } + previousLine.hidden = true; + return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart(); + } + rasterize(row) { + const rrows = []; + const widths = this.columnWidths(row); + let wrapped; + // word wrap all columns, and create + // a data-structure that is easy to rasterize. + row.forEach((col, c) => { + // leave room for left and right padding. + col.width = widths[c]; + if (this.wrap) { + wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n'); + } + else { + wrapped = col.text.split('\n'); + } + if (col.border) { + wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.'); + wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'"); + } + // add top and bottom padding. + if (col.padding) { + wrapped.unshift(...new Array(col.padding[top] || 0).fill('')); + wrapped.push(...new Array(col.padding[bottom] || 0).fill('')); + } + wrapped.forEach((str, r) => { + if (!rrows[r]) { + rrows.push([]); + } + const rrow = rrows[r]; + for (let i = 0; i < c; i++) { + if (rrow[i] === undefined) { + rrow.push(''); + } + } + rrow.push(str); + }); + }); + return rrows; + } + negatePadding(col) { + /* c8 ignore start */ + let wrapWidth = col.width || 0; + /* c8 ignore stop */ + if (col.padding) { + wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0); + } + if (col.border) { + wrapWidth -= 4; + } + return wrapWidth; + } + columnWidths(row) { + if (!this.wrap) { + return row.map(col => { + return col.width || mixin.stringWidth(col.text); + }); + } + let unset = row.length; + let remainingWidth = this.width; + // column widths can be set in config. + const widths = row.map(col => { + if (col.width) { + unset--; + remainingWidth -= col.width; + return col.width; + } + return undefined; + }); + // any unset widths should be calculated. + /* c8 ignore start */ + const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0; + /* c8 ignore stop */ + return widths.map((w, i) => { + if (w === undefined) { + return Math.max(unsetWidth, _minWidth(row[i])); + } + return w; + }); + } +} +function addBorder(col, ts, style) { + if (col.border) { + if (/[.']-+[.']/.test(ts)) { + return ''; + } + if (ts.trim().length !== 0) { + return style; + } + return ' '; + } + return ''; +} +// calculates the minimum width of +// a column, based on padding preferences. +function _minWidth(col) { + const padding = col.padding || []; + const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0); + if (col.border) { + return minWidth + 4; + } + return minWidth; +} +function getWindowWidth() { + /* c8 ignore start */ + if (typeof process === 'object' && process.stdout && process.stdout.columns) { + return process.stdout.columns; + } + return 80; +} +/* c8 ignore stop */ +function alignRight(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + if (strWidth < width) { + return ' '.repeat(width - strWidth) + str; + } + return str; +} +function alignCenter(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + /* c8 ignore start */ + if (strWidth >= width) { + return str; + } + /* c8 ignore stop */ + return ' '.repeat((width - strWidth) >> 1) + str; +} +let mixin; +function cliui(opts, _mixin) { + mixin = _mixin; + return new UI({ + /* c8 ignore start */ + width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(), + wrap: opts === null || opts === void 0 ? void 0 : opts.wrap + /* c8 ignore stop */ + }); +} + +// Bootstrap cliui with CommonJS dependencies: +const stringWidth = require('string-width-cjs'); +const stripAnsi = require('strip-ansi-cjs'); +const wrap = require('wrap-ansi-cjs'); +function ui(opts) { + return cliui(opts, { + stringWidth, + stripAnsi, + wrap + }); +} + +module.exports = ui; diff --git a/node_modules/@isaacs/cliui/build/index.d.cts b/node_modules/@isaacs/cliui/build/index.d.cts new file mode 100644 index 00000000..4567f945 --- /dev/null +++ b/node_modules/@isaacs/cliui/build/index.d.cts @@ -0,0 +1,43 @@ +interface UIOptions { + width: number; + wrap?: boolean; + rows?: string[]; +} +interface Column { + text: string; + width?: number; + align?: "right" | "left" | "center"; + padding: number[]; + border?: boolean; +} +interface ColumnArray extends Array { + span: boolean; +} +interface Line { + hidden?: boolean; + text: string; + span?: boolean; +} +declare class UI { + width: number; + wrap: boolean; + rows: ColumnArray[]; + constructor(opts: UIOptions); + span(...args: ColumnArray): void; + resetOutput(): void; + div(...args: (Column | string)[]): ColumnArray; + private shouldApplyLayoutDSL; + private applyLayoutDSL; + private colFromString; + private measurePadding; + toString(): string; + rowToString(row: ColumnArray, lines: Line[]): Line[]; + // if the full 'source' can render in + // the target line, do so. + private renderInline; + private rasterize; + private negatePadding; + private columnWidths; +} +declare function ui(opts: UIOptions): UI; +export { ui as default }; diff --git a/node_modules/@isaacs/cliui/build/lib/index.js b/node_modules/@isaacs/cliui/build/lib/index.js new file mode 100644 index 00000000..587b5ecd --- /dev/null +++ b/node_modules/@isaacs/cliui/build/lib/index.js @@ -0,0 +1,302 @@ +'use strict'; +const align = { + right: alignRight, + center: alignCenter +}; +const top = 0; +const right = 1; +const bottom = 2; +const left = 3; +export class UI { + constructor(opts) { + var _a; + this.width = opts.width; + /* c8 ignore start */ + this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true; + /* c8 ignore stop */ + this.rows = []; + } + span(...args) { + const cols = this.div(...args); + cols.span = true; + } + resetOutput() { + this.rows = []; + } + div(...args) { + if (args.length === 0) { + this.div(''); + } + if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') { + return this.applyLayoutDSL(args[0]); + } + const cols = args.map(arg => { + if (typeof arg === 'string') { + return this.colFromString(arg); + } + return arg; + }); + this.rows.push(cols); + return cols; + } + shouldApplyLayoutDSL(...args) { + return args.length === 1 && typeof args[0] === 'string' && + /[\t\n]/.test(args[0]); + } + applyLayoutDSL(str) { + const rows = str.split('\n').map(row => row.split('\t')); + let leftColumnWidth = 0; + // simple heuristic for layout, make sure the + // second column lines up along the left-hand. + // don't allow the first column to take up more + // than 50% of the screen. + rows.forEach(columns => { + if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) { + leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0])); + } + }); + // generate a table: + // replacing ' ' with padding calculations. + // using the algorithmically generated width. + rows.forEach(columns => { + this.div(...columns.map((r, i) => { + return { + text: r.trim(), + padding: this.measurePadding(r), + width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined + }; + })); + }); + return this.rows[this.rows.length - 1]; + } + colFromString(text) { + return { + text, + padding: this.measurePadding(text) + }; + } + measurePadding(str) { + // measure padding without ansi escape codes + const noAnsi = mixin.stripAnsi(str); + return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]; + } + toString() { + const lines = []; + this.rows.forEach(row => { + this.rowToString(row, lines); + }); + // don't display any lines with the + // hidden flag set. + return lines + .filter(line => !line.hidden) + .map(line => line.text) + .join('\n'); + } + rowToString(row, lines) { + this.rasterize(row).forEach((rrow, r) => { + let str = ''; + rrow.forEach((col, c) => { + const { width } = row[c]; // the width with padding. + const wrapWidth = this.negatePadding(row[c]); // the width without padding. + let ts = col; // temporary string used during alignment/padding. + if (wrapWidth > mixin.stringWidth(col)) { + ts += ' '.repeat(wrapWidth - mixin.stringWidth(col)); + } + // align the string within its column. + if (row[c].align && row[c].align !== 'left' && this.wrap) { + const fn = align[row[c].align]; + ts = fn(ts, wrapWidth); + if (mixin.stringWidth(ts) < wrapWidth) { + /* c8 ignore start */ + const w = width || 0; + /* c8 ignore stop */ + ts += ' '.repeat(w - mixin.stringWidth(ts) - 1); + } + } + // apply border and padding to string. + const padding = row[c].padding || [0, 0, 0, 0]; + if (padding[left]) { + str += ' '.repeat(padding[left]); + } + str += addBorder(row[c], ts, '| '); + str += ts; + str += addBorder(row[c], ts, ' |'); + if (padding[right]) { + str += ' '.repeat(padding[right]); + } + // if prior row is span, try to render the + // current row on the prior line. + if (r === 0 && lines.length > 0) { + str = this.renderInline(str, lines[lines.length - 1]); + } + }); + // remove trailing whitespace. + lines.push({ + text: str.replace(/ +$/, ''), + span: row.span + }); + }); + return lines; + } + // if the full 'source' can render in + // the target line, do so. + renderInline(source, previousLine) { + const match = source.match(/^ */); + /* c8 ignore start */ + const leadingWhitespace = match ? match[0].length : 0; + /* c8 ignore stop */ + const target = previousLine.text; + const targetTextWidth = mixin.stringWidth(target.trimEnd()); + if (!previousLine.span) { + return source; + } + // if we're not applying wrapping logic, + // just always append to the span. + if (!this.wrap) { + previousLine.hidden = true; + return target + source; + } + if (leadingWhitespace < targetTextWidth) { + return source; + } + previousLine.hidden = true; + return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart(); + } + rasterize(row) { + const rrows = []; + const widths = this.columnWidths(row); + let wrapped; + // word wrap all columns, and create + // a data-structure that is easy to rasterize. + row.forEach((col, c) => { + // leave room for left and right padding. + col.width = widths[c]; + if (this.wrap) { + wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n'); + } + else { + wrapped = col.text.split('\n'); + } + if (col.border) { + wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.'); + wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'"); + } + // add top and bottom padding. + if (col.padding) { + wrapped.unshift(...new Array(col.padding[top] || 0).fill('')); + wrapped.push(...new Array(col.padding[bottom] || 0).fill('')); + } + wrapped.forEach((str, r) => { + if (!rrows[r]) { + rrows.push([]); + } + const rrow = rrows[r]; + for (let i = 0; i < c; i++) { + if (rrow[i] === undefined) { + rrow.push(''); + } + } + rrow.push(str); + }); + }); + return rrows; + } + negatePadding(col) { + /* c8 ignore start */ + let wrapWidth = col.width || 0; + /* c8 ignore stop */ + if (col.padding) { + wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0); + } + if (col.border) { + wrapWidth -= 4; + } + return wrapWidth; + } + columnWidths(row) { + if (!this.wrap) { + return row.map(col => { + return col.width || mixin.stringWidth(col.text); + }); + } + let unset = row.length; + let remainingWidth = this.width; + // column widths can be set in config. + const widths = row.map(col => { + if (col.width) { + unset--; + remainingWidth -= col.width; + return col.width; + } + return undefined; + }); + // any unset widths should be calculated. + /* c8 ignore start */ + const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0; + /* c8 ignore stop */ + return widths.map((w, i) => { + if (w === undefined) { + return Math.max(unsetWidth, _minWidth(row[i])); + } + return w; + }); + } +} +function addBorder(col, ts, style) { + if (col.border) { + if (/[.']-+[.']/.test(ts)) { + return ''; + } + if (ts.trim().length !== 0) { + return style; + } + return ' '; + } + return ''; +} +// calculates the minimum width of +// a column, based on padding preferences. +function _minWidth(col) { + const padding = col.padding || []; + const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0); + if (col.border) { + return minWidth + 4; + } + return minWidth; +} +function getWindowWidth() { + /* c8 ignore start */ + if (typeof process === 'object' && process.stdout && process.stdout.columns) { + return process.stdout.columns; + } + return 80; +} +/* c8 ignore stop */ +function alignRight(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + if (strWidth < width) { + return ' '.repeat(width - strWidth) + str; + } + return str; +} +function alignCenter(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + /* c8 ignore start */ + if (strWidth >= width) { + return str; + } + /* c8 ignore stop */ + return ' '.repeat((width - strWidth) >> 1) + str; +} +let mixin; +export function cliui(opts, _mixin) { + mixin = _mixin; + return new UI({ + /* c8 ignore start */ + width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(), + wrap: opts === null || opts === void 0 ? void 0 : opts.wrap + /* c8 ignore stop */ + }); +} diff --git a/node_modules/@isaacs/cliui/index.mjs b/node_modules/@isaacs/cliui/index.mjs new file mode 100644 index 00000000..5177519a --- /dev/null +++ b/node_modules/@isaacs/cliui/index.mjs @@ -0,0 +1,14 @@ +// Bootstrap cliui with ESM dependencies: +import { cliui } from './build/lib/index.js' + +import stringWidth from 'string-width' +import stripAnsi from 'strip-ansi' +import wrap from 'wrap-ansi' + +export default function ui (opts) { + return cliui(opts, { + stringWidth, + stripAnsi, + wrap + }) +} diff --git a/node_modules/@isaacs/cliui/package.json b/node_modules/@isaacs/cliui/package.json new file mode 100644 index 00000000..7a952532 --- /dev/null +++ b/node_modules/@isaacs/cliui/package.json @@ -0,0 +1,86 @@ +{ + "name": "@isaacs/cliui", + "version": "8.0.2", + "description": "easily create complex multi-column command-line-interfaces", + "main": "build/index.cjs", + "exports": { + ".": [ + { + "import": "./index.mjs", + "require": "./build/index.cjs" + }, + "./build/index.cjs" + ] + }, + "type": "module", + "module": "./index.mjs", + "scripts": { + "check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'", + "fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'", + "pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs", + "test": "c8 mocha ./test/*.cjs", + "test:esm": "c8 mocha ./test/**/*.mjs", + "postest": "check", + "coverage": "c8 report --check-coverage", + "precompile": "rimraf build", + "compile": "tsc", + "postcompile": "npm run build:cjs", + "build:cjs": "rollup -c", + "prepare": "npm run compile" + }, + "repository": "yargs/cliui", + "standard": { + "ignore": [ + "**/example/**" + ], + "globals": [ + "it" + ] + }, + "keywords": [ + "cli", + "command-line", + "layout", + "design", + "console", + "wrap", + "table" + ], + "author": "Ben Coe ", + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "devDependencies": { + "@types/node": "^14.0.27", + "@typescript-eslint/eslint-plugin": "^4.0.0", + "@typescript-eslint/parser": "^4.0.0", + "c8": "^7.3.0", + "chai": "^4.2.0", + "chalk": "^4.1.0", + "cross-env": "^7.0.2", + "eslint": "^7.6.0", + "eslint-plugin-import": "^2.22.0", + "eslint-plugin-node": "^11.1.0", + "gts": "^3.0.0", + "mocha": "^10.0.0", + "rimraf": "^3.0.2", + "rollup": "^2.23.1", + "rollup-plugin-ts": "^3.0.2", + "standardx": "^7.0.0", + "typescript": "^4.0.0" + }, + "files": [ + "build", + "index.mjs", + "!*.d.ts" + ], + "engines": { + "node": ">=12" + } +} diff --git a/node_modules/@jridgewell/sourcemap-codec/LICENSE b/node_modules/@jridgewell/sourcemap-codec/LICENSE new file mode 100644 index 00000000..a331065a --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2015 Rich Harris + +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/@jridgewell/sourcemap-codec/README.md b/node_modules/@jridgewell/sourcemap-codec/README.md new file mode 100644 index 00000000..b3e0708b --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/README.md @@ -0,0 +1,264 @@ +# @jridgewell/sourcemap-codec + +Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit). + + +## Why? + +Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap. + +This package makes the process slightly easier. + + +## Installation + +```bash +npm install @jridgewell/sourcemap-codec +``` + + +## Usage + +```js +import { encode, decode } from '@jridgewell/sourcemap-codec'; + +var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); + +assert.deepEqual( decoded, [ + // the first line (of the generated code) has no mappings, + // as shown by the starting semi-colon (which separates lines) + [], + + // the second line contains four (comma-separated) segments + [ + // segments are encoded as you'd expect: + // [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ] + + // i.e. the first segment begins at column 2, and maps back to the second column + // of the second line (both zero-based) of the 0th source, and uses the 0th + // name in the `map.names` array + [ 2, 0, 2, 2, 0 ], + + // the remaining segments are 4-length rather than 5-length, + // because they don't map a name + [ 4, 0, 2, 4 ], + [ 6, 0, 2, 5 ], + [ 7, 0, 2, 7 ] + ], + + // the final line contains two segments + [ + [ 2, 1, 10, 19 ], + [ 12, 1, 11, 20 ] + ] +]); + +var encoded = encode( decoded ); +assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); +``` + +## Benchmarks + +``` +node v20.10.0 + +amp.js.map - 45120 segments + +Decode Memory Usage: +local code 5815135 bytes +@jridgewell/sourcemap-codec 1.4.15 5868160 bytes +sourcemap-codec 5492584 bytes +source-map-0.6.1 13569984 bytes +source-map-0.8.0 6390584 bytes +chrome dev tools 8011136 bytes +Smallest memory usage is sourcemap-codec + +Decode speed: +decode: local code x 492 ops/sec ±1.22% (90 runs sampled) +decode: @jridgewell/sourcemap-codec 1.4.15 x 499 ops/sec ±1.16% (89 runs sampled) +decode: sourcemap-codec x 376 ops/sec ±1.66% (89 runs sampled) +decode: source-map-0.6.1 x 34.99 ops/sec ±0.94% (48 runs sampled) +decode: source-map-0.8.0 x 351 ops/sec ±0.07% (95 runs sampled) +chrome dev tools x 165 ops/sec ±0.91% (86 runs sampled) +Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 + +Encode Memory Usage: +local code 444248 bytes +@jridgewell/sourcemap-codec 1.4.15 623024 bytes +sourcemap-codec 8696280 bytes +source-map-0.6.1 8745176 bytes +source-map-0.8.0 8736624 bytes +Smallest memory usage is local code + +Encode speed: +encode: local code x 796 ops/sec ±0.11% (97 runs sampled) +encode: @jridgewell/sourcemap-codec 1.4.15 x 795 ops/sec ±0.25% (98 runs sampled) +encode: sourcemap-codec x 231 ops/sec ±0.83% (86 runs sampled) +encode: source-map-0.6.1 x 166 ops/sec ±0.57% (86 runs sampled) +encode: source-map-0.8.0 x 203 ops/sec ±0.45% (88 runs sampled) +Fastest is encode: local code,encode: @jridgewell/sourcemap-codec 1.4.15 + + +*** + + +babel.min.js.map - 347793 segments + +Decode Memory Usage: +local code 35424960 bytes +@jridgewell/sourcemap-codec 1.4.15 35424696 bytes +sourcemap-codec 36033464 bytes +source-map-0.6.1 62253704 bytes +source-map-0.8.0 43843920 bytes +chrome dev tools 45111400 bytes +Smallest memory usage is @jridgewell/sourcemap-codec 1.4.15 + +Decode speed: +decode: local code x 38.18 ops/sec ±5.44% (52 runs sampled) +decode: @jridgewell/sourcemap-codec 1.4.15 x 38.36 ops/sec ±5.02% (52 runs sampled) +decode: sourcemap-codec x 34.05 ops/sec ±4.45% (47 runs sampled) +decode: source-map-0.6.1 x 4.31 ops/sec ±2.76% (15 runs sampled) +decode: source-map-0.8.0 x 55.60 ops/sec ±0.13% (73 runs sampled) +chrome dev tools x 16.94 ops/sec ±3.78% (46 runs sampled) +Fastest is decode: source-map-0.8.0 + +Encode Memory Usage: +local code 2606016 bytes +@jridgewell/sourcemap-codec 1.4.15 2626440 bytes +sourcemap-codec 21152576 bytes +source-map-0.6.1 25023928 bytes +source-map-0.8.0 25256448 bytes +Smallest memory usage is local code + +Encode speed: +encode: local code x 127 ops/sec ±0.18% (83 runs sampled) +encode: @jridgewell/sourcemap-codec 1.4.15 x 128 ops/sec ±0.26% (83 runs sampled) +encode: sourcemap-codec x 29.31 ops/sec ±2.55% (53 runs sampled) +encode: source-map-0.6.1 x 18.85 ops/sec ±3.19% (36 runs sampled) +encode: source-map-0.8.0 x 19.34 ops/sec ±1.97% (36 runs sampled) +Fastest is encode: @jridgewell/sourcemap-codec 1.4.15 + + +*** + + +preact.js.map - 1992 segments + +Decode Memory Usage: +local code 261696 bytes +@jridgewell/sourcemap-codec 1.4.15 244296 bytes +sourcemap-codec 302816 bytes +source-map-0.6.1 939176 bytes +source-map-0.8.0 336 bytes +chrome dev tools 587368 bytes +Smallest memory usage is source-map-0.8.0 + +Decode speed: +decode: local code x 17,782 ops/sec ±0.32% (97 runs sampled) +decode: @jridgewell/sourcemap-codec 1.4.15 x 17,863 ops/sec ±0.40% (100 runs sampled) +decode: sourcemap-codec x 12,453 ops/sec ±0.27% (101 runs sampled) +decode: source-map-0.6.1 x 1,288 ops/sec ±1.05% (96 runs sampled) +decode: source-map-0.8.0 x 9,289 ops/sec ±0.27% (101 runs sampled) +chrome dev tools x 4,769 ops/sec ±0.18% (100 runs sampled) +Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 + +Encode Memory Usage: +local code 262944 bytes +@jridgewell/sourcemap-codec 1.4.15 25544 bytes +sourcemap-codec 323048 bytes +source-map-0.6.1 507808 bytes +source-map-0.8.0 507480 bytes +Smallest memory usage is @jridgewell/sourcemap-codec 1.4.15 + +Encode speed: +encode: local code x 24,207 ops/sec ±0.79% (95 runs sampled) +encode: @jridgewell/sourcemap-codec 1.4.15 x 24,288 ops/sec ±0.48% (96 runs sampled) +encode: sourcemap-codec x 6,761 ops/sec ±0.21% (100 runs sampled) +encode: source-map-0.6.1 x 5,374 ops/sec ±0.17% (99 runs sampled) +encode: source-map-0.8.0 x 5,633 ops/sec ±0.32% (99 runs sampled) +Fastest is encode: @jridgewell/sourcemap-codec 1.4.15,encode: local code + + +*** + + +react.js.map - 5726 segments + +Decode Memory Usage: +local code 678816 bytes +@jridgewell/sourcemap-codec 1.4.15 678816 bytes +sourcemap-codec 816400 bytes +source-map-0.6.1 2288864 bytes +source-map-0.8.0 721360 bytes +chrome dev tools 1012512 bytes +Smallest memory usage is local code + +Decode speed: +decode: local code x 6,178 ops/sec ±0.19% (98 runs sampled) +decode: @jridgewell/sourcemap-codec 1.4.15 x 6,261 ops/sec ±0.22% (100 runs sampled) +decode: sourcemap-codec x 4,472 ops/sec ±0.90% (99 runs sampled) +decode: source-map-0.6.1 x 449 ops/sec ±0.31% (95 runs sampled) +decode: source-map-0.8.0 x 3,219 ops/sec ±0.13% (100 runs sampled) +chrome dev tools x 1,743 ops/sec ±0.20% (99 runs sampled) +Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 + +Encode Memory Usage: +local code 140960 bytes +@jridgewell/sourcemap-codec 1.4.15 159808 bytes +sourcemap-codec 969304 bytes +source-map-0.6.1 930520 bytes +source-map-0.8.0 930248 bytes +Smallest memory usage is local code + +Encode speed: +encode: local code x 8,013 ops/sec ±0.19% (100 runs sampled) +encode: @jridgewell/sourcemap-codec 1.4.15 x 7,989 ops/sec ±0.20% (101 runs sampled) +encode: sourcemap-codec x 2,472 ops/sec ±0.21% (99 runs sampled) +encode: source-map-0.6.1 x 2,200 ops/sec ±0.17% (99 runs sampled) +encode: source-map-0.8.0 x 2,220 ops/sec ±0.37% (99 runs sampled) +Fastest is encode: local code + + +*** + + +vscode.map - 2141001 segments + +Decode Memory Usage: +local code 198955264 bytes +@jridgewell/sourcemap-codec 1.4.15 199175352 bytes +sourcemap-codec 199102688 bytes +source-map-0.6.1 386323432 bytes +source-map-0.8.0 244116432 bytes +chrome dev tools 293734280 bytes +Smallest memory usage is local code + +Decode speed: +decode: local code x 3.90 ops/sec ±22.21% (15 runs sampled) +decode: @jridgewell/sourcemap-codec 1.4.15 x 3.95 ops/sec ±23.53% (15 runs sampled) +decode: sourcemap-codec x 3.82 ops/sec ±17.94% (14 runs sampled) +decode: source-map-0.6.1 x 0.61 ops/sec ±7.81% (6 runs sampled) +decode: source-map-0.8.0 x 9.54 ops/sec ±0.28% (28 runs sampled) +chrome dev tools x 2.18 ops/sec ±10.58% (10 runs sampled) +Fastest is decode: source-map-0.8.0 + +Encode Memory Usage: +local code 13509880 bytes +@jridgewell/sourcemap-codec 1.4.15 13537648 bytes +sourcemap-codec 32540104 bytes +source-map-0.6.1 127531040 bytes +source-map-0.8.0 127535312 bytes +Smallest memory usage is local code + +Encode speed: +encode: local code x 20.10 ops/sec ±0.19% (38 runs sampled) +encode: @jridgewell/sourcemap-codec 1.4.15 x 20.26 ops/sec ±0.32% (38 runs sampled) +encode: sourcemap-codec x 5.44 ops/sec ±1.64% (18 runs sampled) +encode: source-map-0.6.1 x 2.30 ops/sec ±4.79% (10 runs sampled) +encode: source-map-0.8.0 x 2.46 ops/sec ±6.53% (10 runs sampled) +Fastest is encode: @jridgewell/sourcemap-codec 1.4.15 +``` + +# License + +MIT diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs new file mode 100644 index 00000000..60e17b3d --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs @@ -0,0 +1,424 @@ +const comma = ','.charCodeAt(0); +const semicolon = ';'.charCodeAt(0); +const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; +const intToChar = new Uint8Array(64); // 64 possible chars. +const charToInt = new Uint8Array(128); // z is 122 in ASCII +for (let i = 0; i < chars.length; i++) { + const c = chars.charCodeAt(i); + intToChar[i] = c; + charToInt[c] = i; +} +function decodeInteger(reader, relative) { + let value = 0; + let shift = 0; + let integer = 0; + do { + const c = reader.next(); + integer = charToInt[c]; + value |= (integer & 31) << shift; + shift += 5; + } while (integer & 32); + const shouldNegate = value & 1; + value >>>= 1; + if (shouldNegate) { + value = -0x80000000 | -value; + } + return relative + value; +} +function encodeInteger(builder, num, relative) { + let delta = num - relative; + delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; + do { + let clamped = delta & 0b011111; + delta >>>= 5; + if (delta > 0) + clamped |= 0b100000; + builder.write(intToChar[clamped]); + } while (delta > 0); + return num; +} +function hasMoreVlq(reader, max) { + if (reader.pos >= max) + return false; + return reader.peek() !== comma; +} + +const bufLength = 1024 * 16; +// Provide a fallback for older environments. +const td = typeof TextDecoder !== 'undefined' + ? /* #__PURE__ */ new TextDecoder() + : typeof Buffer !== 'undefined' + ? { + decode(buf) { + const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); + return out.toString(); + }, + } + : { + decode(buf) { + let out = ''; + for (let i = 0; i < buf.length; i++) { + out += String.fromCharCode(buf[i]); + } + return out; + }, + }; +class StringWriter { + constructor() { + this.pos = 0; + this.out = ''; + this.buffer = new Uint8Array(bufLength); + } + write(v) { + const { buffer } = this; + buffer[this.pos++] = v; + if (this.pos === bufLength) { + this.out += td.decode(buffer); + this.pos = 0; + } + } + flush() { + const { buffer, out, pos } = this; + return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; + } +} +class StringReader { + constructor(buffer) { + this.pos = 0; + this.buffer = buffer; + } + next() { + return this.buffer.charCodeAt(this.pos++); + } + peek() { + return this.buffer.charCodeAt(this.pos); + } + indexOf(char) { + const { buffer, pos } = this; + const idx = buffer.indexOf(char, pos); + return idx === -1 ? buffer.length : idx; + } +} + +const EMPTY = []; +function decodeOriginalScopes(input) { + const { length } = input; + const reader = new StringReader(input); + const scopes = []; + const stack = []; + let line = 0; + for (; reader.pos < length; reader.pos++) { + line = decodeInteger(reader, line); + const column = decodeInteger(reader, 0); + if (!hasMoreVlq(reader, length)) { + const last = stack.pop(); + last[2] = line; + last[3] = column; + continue; + } + const kind = decodeInteger(reader, 0); + const fields = decodeInteger(reader, 0); + const hasName = fields & 0b0001; + const scope = (hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]); + let vars = EMPTY; + if (hasMoreVlq(reader, length)) { + vars = []; + do { + const varsIndex = decodeInteger(reader, 0); + vars.push(varsIndex); + } while (hasMoreVlq(reader, length)); + } + scope.vars = vars; + scopes.push(scope); + stack.push(scope); + } + return scopes; +} +function encodeOriginalScopes(scopes) { + const writer = new StringWriter(); + for (let i = 0; i < scopes.length;) { + i = _encodeOriginalScopes(scopes, i, writer, [0]); + } + return writer.flush(); +} +function _encodeOriginalScopes(scopes, index, writer, state) { + const scope = scopes[index]; + const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; + if (index > 0) + writer.write(comma); + state[0] = encodeInteger(writer, startLine, state[0]); + encodeInteger(writer, startColumn, 0); + encodeInteger(writer, kind, 0); + const fields = scope.length === 6 ? 0b0001 : 0; + encodeInteger(writer, fields, 0); + if (scope.length === 6) + encodeInteger(writer, scope[5], 0); + for (const v of vars) { + encodeInteger(writer, v, 0); + } + for (index++; index < scopes.length;) { + const next = scopes[index]; + const { 0: l, 1: c } = next; + if (l > endLine || (l === endLine && c >= endColumn)) { + break; + } + index = _encodeOriginalScopes(scopes, index, writer, state); + } + writer.write(comma); + state[0] = encodeInteger(writer, endLine, state[0]); + encodeInteger(writer, endColumn, 0); + return index; +} +function decodeGeneratedRanges(input) { + const { length } = input; + const reader = new StringReader(input); + const ranges = []; + const stack = []; + let genLine = 0; + let definitionSourcesIndex = 0; + let definitionScopeIndex = 0; + let callsiteSourcesIndex = 0; + let callsiteLine = 0; + let callsiteColumn = 0; + let bindingLine = 0; + let bindingColumn = 0; + do { + const semi = reader.indexOf(';'); + let genColumn = 0; + for (; reader.pos < semi; reader.pos++) { + genColumn = decodeInteger(reader, genColumn); + if (!hasMoreVlq(reader, semi)) { + const last = stack.pop(); + last[2] = genLine; + last[3] = genColumn; + continue; + } + const fields = decodeInteger(reader, 0); + const hasDefinition = fields & 0b0001; + const hasCallsite = fields & 0b0010; + const hasScope = fields & 0b0100; + let callsite = null; + let bindings = EMPTY; + let range; + if (hasDefinition) { + const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); + definitionScopeIndex = decodeInteger(reader, definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0); + definitionSourcesIndex = defSourcesIndex; + range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex]; + } + else { + range = [genLine, genColumn, 0, 0]; + } + range.isScope = !!hasScope; + if (hasCallsite) { + const prevCsi = callsiteSourcesIndex; + const prevLine = callsiteLine; + callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); + const sameSource = prevCsi === callsiteSourcesIndex; + callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); + callsiteColumn = decodeInteger(reader, sameSource && prevLine === callsiteLine ? callsiteColumn : 0); + callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; + } + range.callsite = callsite; + if (hasMoreVlq(reader, semi)) { + bindings = []; + do { + bindingLine = genLine; + bindingColumn = genColumn; + const expressionsCount = decodeInteger(reader, 0); + let expressionRanges; + if (expressionsCount < -1) { + expressionRanges = [[decodeInteger(reader, 0)]]; + for (let i = -1; i > expressionsCount; i--) { + const prevBl = bindingLine; + bindingLine = decodeInteger(reader, bindingLine); + bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); + const expression = decodeInteger(reader, 0); + expressionRanges.push([expression, bindingLine, bindingColumn]); + } + } + else { + expressionRanges = [[expressionsCount]]; + } + bindings.push(expressionRanges); + } while (hasMoreVlq(reader, semi)); + } + range.bindings = bindings; + ranges.push(range); + stack.push(range); + } + genLine++; + reader.pos = semi + 1; + } while (reader.pos < length); + return ranges; +} +function encodeGeneratedRanges(ranges) { + if (ranges.length === 0) + return ''; + const writer = new StringWriter(); + for (let i = 0; i < ranges.length;) { + i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); + } + return writer.flush(); +} +function _encodeGeneratedRanges(ranges, index, writer, state) { + const range = ranges[index]; + const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, isScope, callsite, bindings, } = range; + if (state[0] < startLine) { + catchupLine(writer, state[0], startLine); + state[0] = startLine; + state[1] = 0; + } + else if (index > 0) { + writer.write(comma); + } + state[1] = encodeInteger(writer, range[1], state[1]); + const fields = (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0); + encodeInteger(writer, fields, 0); + if (range.length === 6) { + const { 4: sourcesIndex, 5: scopesIndex } = range; + if (sourcesIndex !== state[2]) { + state[3] = 0; + } + state[2] = encodeInteger(writer, sourcesIndex, state[2]); + state[3] = encodeInteger(writer, scopesIndex, state[3]); + } + if (callsite) { + const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite; + if (sourcesIndex !== state[4]) { + state[5] = 0; + state[6] = 0; + } + else if (callLine !== state[5]) { + state[6] = 0; + } + state[4] = encodeInteger(writer, sourcesIndex, state[4]); + state[5] = encodeInteger(writer, callLine, state[5]); + state[6] = encodeInteger(writer, callColumn, state[6]); + } + if (bindings) { + for (const binding of bindings) { + if (binding.length > 1) + encodeInteger(writer, -binding.length, 0); + const expression = binding[0][0]; + encodeInteger(writer, expression, 0); + let bindingStartLine = startLine; + let bindingStartColumn = startColumn; + for (let i = 1; i < binding.length; i++) { + const expRange = binding[i]; + bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine); + bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn); + encodeInteger(writer, expRange[0], 0); + } + } + } + for (index++; index < ranges.length;) { + const next = ranges[index]; + const { 0: l, 1: c } = next; + if (l > endLine || (l === endLine && c >= endColumn)) { + break; + } + index = _encodeGeneratedRanges(ranges, index, writer, state); + } + if (state[0] < endLine) { + catchupLine(writer, state[0], endLine); + state[0] = endLine; + state[1] = 0; + } + else { + writer.write(comma); + } + state[1] = encodeInteger(writer, endColumn, state[1]); + return index; +} +function catchupLine(writer, lastLine, line) { + do { + writer.write(semicolon); + } while (++lastLine < line); +} + +function decode(mappings) { + const { length } = mappings; + const reader = new StringReader(mappings); + const decoded = []; + let genColumn = 0; + let sourcesIndex = 0; + let sourceLine = 0; + let sourceColumn = 0; + let namesIndex = 0; + do { + const semi = reader.indexOf(';'); + const line = []; + let sorted = true; + let lastCol = 0; + genColumn = 0; + while (reader.pos < semi) { + let seg; + genColumn = decodeInteger(reader, genColumn); + if (genColumn < lastCol) + sorted = false; + lastCol = genColumn; + if (hasMoreVlq(reader, semi)) { + sourcesIndex = decodeInteger(reader, sourcesIndex); + sourceLine = decodeInteger(reader, sourceLine); + sourceColumn = decodeInteger(reader, sourceColumn); + if (hasMoreVlq(reader, semi)) { + namesIndex = decodeInteger(reader, namesIndex); + seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; + } + else { + seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; + } + } + else { + seg = [genColumn]; + } + line.push(seg); + reader.pos++; + } + if (!sorted) + sort(line); + decoded.push(line); + reader.pos = semi + 1; + } while (reader.pos <= length); + return decoded; +} +function sort(line) { + line.sort(sortComparator); +} +function sortComparator(a, b) { + return a[0] - b[0]; +} +function encode(decoded) { + const writer = new StringWriter(); + let sourcesIndex = 0; + let sourceLine = 0; + let sourceColumn = 0; + let namesIndex = 0; + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + if (i > 0) + writer.write(semicolon); + if (line.length === 0) + continue; + let genColumn = 0; + for (let j = 0; j < line.length; j++) { + const segment = line[j]; + if (j > 0) + writer.write(comma); + genColumn = encodeInteger(writer, segment[0], genColumn); + if (segment.length === 1) + continue; + sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); + sourceLine = encodeInteger(writer, segment[2], sourceLine); + sourceColumn = encodeInteger(writer, segment[3], sourceColumn); + if (segment.length === 4) + continue; + namesIndex = encodeInteger(writer, segment[4], namesIndex); + } + } + return writer.flush(); +} + +export { decode, decodeGeneratedRanges, decodeOriginalScopes, encode, encodeGeneratedRanges, encodeOriginalScopes }; +//# sourceMappingURL=sourcemap-codec.mjs.map diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map new file mode 100644 index 00000000..73882288 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"sourcemap-codec.mjs","sources":["../src/vlq.ts","../src/strings.ts","../src/scopes.ts","../src/sourcemap-codec.ts"],"sourcesContent":["import type { StringReader, StringWriter } from './strings';\n\nexport const comma = ','.charCodeAt(0);\nexport const semicolon = ';'.charCodeAt(0);\n\nconst chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst intToChar = new Uint8Array(64); // 64 possible chars.\nconst charToInt = new Uint8Array(128); // z is 122 in ASCII\n\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\n\nexport function decodeInteger(reader: StringReader, relative: number): number {\n let value = 0;\n let shift = 0;\n let integer = 0;\n\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n\n const shouldNegate = value & 1;\n value >>>= 1;\n\n if (shouldNegate) {\n value = -0x80000000 | -value;\n }\n\n return relative + value;\n}\n\nexport function encodeInteger(builder: StringWriter, num: number, relative: number): number {\n let delta = num - relative;\n\n delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;\n do {\n let clamped = delta & 0b011111;\n delta >>>= 5;\n if (delta > 0) clamped |= 0b100000;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n\n return num;\n}\n\nexport function hasMoreVlq(reader: StringReader, max: number) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n","const bufLength = 1024 * 16;\n\n// Provide a fallback for older environments.\nconst td =\n typeof TextDecoder !== 'undefined'\n ? /* #__PURE__ */ new TextDecoder()\n : typeof Buffer !== 'undefined'\n ? {\n decode(buf: Uint8Array): string {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n },\n }\n : {\n decode(buf: Uint8Array): string {\n let out = '';\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n },\n };\n\nexport class StringWriter {\n pos = 0;\n private out = '';\n private buffer = new Uint8Array(bufLength);\n\n write(v: number): void {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n\n flush(): string {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n}\n\nexport class StringReader {\n pos = 0;\n private declare buffer: string;\n\n constructor(buffer: string) {\n this.buffer = buffer;\n }\n\n next(): number {\n return this.buffer.charCodeAt(this.pos++);\n }\n\n peek(): number {\n return this.buffer.charCodeAt(this.pos);\n }\n\n indexOf(char: string): number {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n}\n","import { StringReader, StringWriter } from './strings';\nimport { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';\n\nconst EMPTY: any[] = [];\n\ntype Line = number;\ntype Column = number;\ntype Kind = number;\ntype Name = number;\ntype Var = number;\ntype SourcesIndex = number;\ntype ScopesIndex = number;\n\ntype Mix = (A & O) | (B & O);\n\nexport type OriginalScope = Mix<\n [Line, Column, Line, Column, Kind],\n [Line, Column, Line, Column, Kind, Name],\n { vars: Var[] }\n>;\n\nexport type GeneratedRange = Mix<\n [Line, Column, Line, Column],\n [Line, Column, Line, Column, SourcesIndex, ScopesIndex],\n {\n callsite: CallSite | null;\n bindings: Binding[];\n isScope: boolean;\n }\n>;\nexport type CallSite = [SourcesIndex, Line, Column];\ntype Binding = BindingExpressionRange[];\nexport type BindingExpressionRange = [Name] | [Name, Line, Column];\n\nexport function decodeOriginalScopes(input: string): OriginalScope[] {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes: OriginalScope[] = [];\n const stack: OriginalScope[] = [];\n let line = 0;\n\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop()!;\n last[2] = line;\n last[3] = column;\n continue;\n }\n\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 0b0001;\n\n const scope: OriginalScope = (\n hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]\n ) as OriginalScope;\n\n let vars: Var[] = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n\n scopes.push(scope);\n stack.push(scope);\n }\n\n return scopes;\n}\n\nexport function encodeOriginalScopes(scopes: OriginalScope[]): string {\n const writer = new StringWriter();\n\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n\n return writer.flush();\n}\n\nfunction _encodeOriginalScopes(\n scopes: OriginalScope[],\n index: number,\n writer: StringWriter,\n state: [\n number, // GenColumn\n ],\n): number {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n\n if (index > 0) writer.write(comma);\n\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n\n const fields = scope.length === 6 ? 0b0001 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || (l === endLine && c >= endColumn)) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n\n return index;\n}\n\nexport function decodeGeneratedRanges(input: string): GeneratedRange[] {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges: GeneratedRange[] = [];\n const stack: GeneratedRange[] = [];\n\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n\n do {\n const semi = reader.indexOf(';');\n let genColumn = 0;\n\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop()!;\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 0b0001;\n const hasCallsite = fields & 0b0010;\n const hasScope = fields & 0b0100;\n\n let callsite: CallSite | null = null;\n let bindings: Binding[] = EMPTY;\n let range: GeneratedRange;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0,\n );\n\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex] as GeneratedRange;\n } else {\n range = [genLine, genColumn, 0, 0] as GeneratedRange;\n }\n\n range.isScope = !!hasScope;\n\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0,\n );\n\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges: BindingExpressionRange[];\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n\n ranges.push(range);\n stack.push(range);\n }\n\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n\n return ranges;\n}\n\nexport function encodeGeneratedRanges(ranges: GeneratedRange[]): string {\n if (ranges.length === 0) return '';\n\n const writer = new StringWriter();\n\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n\n return writer.flush();\n}\n\nfunction _encodeGeneratedRanges(\n ranges: GeneratedRange[],\n index: number,\n writer: StringWriter,\n state: [\n number, // GenLine\n number, // GenColumn\n number, // DefSourcesIndex\n number, // DefScopesIndex\n number, // CallSourcesIndex\n number, // CallLine\n number, // CallColumn\n ],\n): number {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings,\n } = range;\n\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n\n state[1] = encodeInteger(writer, range[1], state[1]);\n\n const fields =\n (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0);\n encodeInteger(writer, fields, 0);\n\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite!;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1]!, bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2]!, bindingStartColumn);\n encodeInteger(writer, expRange[0]!, 0);\n }\n }\n }\n\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || (l === endLine && c >= endColumn)) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n\n return index;\n}\n\nfunction catchupLine(writer: StringWriter, lastLine: number, line: number) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n","import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';\nimport { StringWriter, StringReader } from './strings';\n\nexport {\n decodeOriginalScopes,\n encodeOriginalScopes,\n decodeGeneratedRanges,\n encodeGeneratedRanges,\n} from './scopes';\nexport type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes';\n\nexport type SourceMapSegment =\n | [number]\n | [number, number, number, number]\n | [number, number, number, number, number];\nexport type SourceMapLine = SourceMapSegment[];\nexport type SourceMapMappings = SourceMapLine[];\n\nexport function decode(mappings: string): SourceMapMappings {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded: SourceMapMappings = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n\n do {\n const semi = reader.indexOf(';');\n const line: SourceMapLine = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n\n while (reader.pos < semi) {\n let seg: SourceMapSegment;\n\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n\n line.push(seg);\n reader.pos++;\n }\n\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n\n return decoded;\n}\n\nfunction sort(line: SourceMapSegment[]) {\n line.sort(sortComparator);\n}\n\nfunction sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {\n return a[0] - b[0];\n}\n\nexport function encode(decoded: SourceMapMappings): string;\nexport function encode(decoded: Readonly): string;\nexport function encode(decoded: Readonly): string {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n\n let genColumn = 0;\n\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n\n genColumn = encodeInteger(writer, segment[0], genColumn);\n\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n\n return writer.flush();\n}\n"],"names":[],"mappings":"AAEO,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAChC,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE3C,MAAM,KAAK,GAAG,kEAAkE,CAAC;AACjF,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACrC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACrC,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9B,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACjB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAClB;SAEe,aAAa,CAAC,MAAoB,EAAE,QAAgB;IAClE,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,GAAG;QACD,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QACxB,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QACvB,KAAK,IAAI,CAAC,OAAO,GAAG,EAAE,KAAK,KAAK,CAAC;QACjC,KAAK,IAAI,CAAC,CAAC;KACZ,QAAQ,OAAO,GAAG,EAAE,EAAE;IAEvB,MAAM,YAAY,GAAG,KAAK,GAAG,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,CAAC;IAEb,IAAI,YAAY,EAAE;QAChB,KAAK,GAAG,CAAC,U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OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YACnC,YAAY,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;YAC/D,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;YAC3D,YAAY,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;YAE/D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YACnC,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;SAC5D;KACF;IAED,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;AACxB;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js new file mode 100644 index 00000000..93caf176 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js @@ -0,0 +1,439 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {})); +})(this, (function (exports) { 'use strict'; + + const comma = ','.charCodeAt(0); + const semicolon = ';'.charCodeAt(0); + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + const intToChar = new Uint8Array(64); // 64 possible chars. + const charToInt = new Uint8Array(128); // z is 122 in ASCII + for (let i = 0; i < chars.length; i++) { + const c = chars.charCodeAt(i); + intToChar[i] = c; + charToInt[c] = i; + } + function decodeInteger(reader, relative) { + let value = 0; + let shift = 0; + let integer = 0; + do { + const c = reader.next(); + integer = charToInt[c]; + value |= (integer & 31) << shift; + shift += 5; + } while (integer & 32); + const shouldNegate = value & 1; + value >>>= 1; + if (shouldNegate) { + value = -0x80000000 | -value; + } + return relative + value; + } + function encodeInteger(builder, num, relative) { + let delta = num - relative; + delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; + do { + let clamped = delta & 0b011111; + delta >>>= 5; + if (delta > 0) + clamped |= 0b100000; + builder.write(intToChar[clamped]); + } while (delta > 0); + return num; + } + function hasMoreVlq(reader, max) { + if (reader.pos >= max) + return false; + return reader.peek() !== comma; + } + + const bufLength = 1024 * 16; + // Provide a fallback for older environments. + const td = typeof TextDecoder !== 'undefined' + ? /* #__PURE__ */ new TextDecoder() + : typeof Buffer !== 'undefined' + ? { + decode(buf) { + const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); + return out.toString(); + }, + } + : { + decode(buf) { + let out = ''; + for (let i = 0; i < buf.length; i++) { + out += String.fromCharCode(buf[i]); + } + return out; + }, + }; + class StringWriter { + constructor() { + this.pos = 0; + this.out = ''; + this.buffer = new Uint8Array(bufLength); + } + write(v) { + const { buffer } = this; + buffer[this.pos++] = v; + if (this.pos === bufLength) { + this.out += td.decode(buffer); + this.pos = 0; + } + } + flush() { + const { buffer, out, pos } = this; + return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; + } + } + class StringReader { + constructor(buffer) { + this.pos = 0; + this.buffer = buffer; + } + next() { + return this.buffer.charCodeAt(this.pos++); + } + peek() { + return this.buffer.charCodeAt(this.pos); + } + indexOf(char) { + const { buffer, pos } = this; + const idx = buffer.indexOf(char, pos); + return idx === -1 ? buffer.length : idx; + } + } + + const EMPTY = []; + function decodeOriginalScopes(input) { + const { length } = input; + const reader = new StringReader(input); + const scopes = []; + const stack = []; + let line = 0; + for (; reader.pos < length; reader.pos++) { + line = decodeInteger(reader, line); + const column = decodeInteger(reader, 0); + if (!hasMoreVlq(reader, length)) { + const last = stack.pop(); + last[2] = line; + last[3] = column; + continue; + } + const kind = decodeInteger(reader, 0); + const fields = decodeInteger(reader, 0); + const hasName = fields & 0b0001; + const scope = (hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]); + let vars = EMPTY; + if (hasMoreVlq(reader, length)) { + vars = []; + do { + const varsIndex = decodeInteger(reader, 0); + vars.push(varsIndex); + } while (hasMoreVlq(reader, length)); + } + scope.vars = vars; + scopes.push(scope); + stack.push(scope); + } + return scopes; + } + function encodeOriginalScopes(scopes) { + const writer = new StringWriter(); + for (let i = 0; i < scopes.length;) { + i = _encodeOriginalScopes(scopes, i, writer, [0]); + } + return writer.flush(); + } + function _encodeOriginalScopes(scopes, index, writer, state) { + const scope = scopes[index]; + const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; + if (index > 0) + writer.write(comma); + state[0] = encodeInteger(writer, startLine, state[0]); + encodeInteger(writer, startColumn, 0); + encodeInteger(writer, kind, 0); + const fields = scope.length === 6 ? 0b0001 : 0; + encodeInteger(writer, fields, 0); + if (scope.length === 6) + encodeInteger(writer, scope[5], 0); + for (const v of vars) { + encodeInteger(writer, v, 0); + } + for (index++; index < scopes.length;) { + const next = scopes[index]; + const { 0: l, 1: c } = next; + if (l > endLine || (l === endLine && c >= endColumn)) { + break; + } + index = _encodeOriginalScopes(scopes, index, writer, state); + } + writer.write(comma); + state[0] = encodeInteger(writer, endLine, state[0]); + encodeInteger(writer, endColumn, 0); + return index; + } + function decodeGeneratedRanges(input) { + const { length } = input; + const reader = new StringReader(input); + const ranges = []; + const stack = []; + let genLine = 0; + let definitionSourcesIndex = 0; + let definitionScopeIndex = 0; + let callsiteSourcesIndex = 0; + let callsiteLine = 0; + let callsiteColumn = 0; + let bindingLine = 0; + let bindingColumn = 0; + do { + const semi = reader.indexOf(';'); + let genColumn = 0; + for (; reader.pos < semi; reader.pos++) { + genColumn = decodeInteger(reader, genColumn); + if (!hasMoreVlq(reader, semi)) { + const last = stack.pop(); + last[2] = genLine; + last[3] = genColumn; + continue; + } + const fields = decodeInteger(reader, 0); + const hasDefinition = fields & 0b0001; + const hasCallsite = fields & 0b0010; + const hasScope = fields & 0b0100; + let callsite = null; + let bindings = EMPTY; + let range; + if (hasDefinition) { + const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); + definitionScopeIndex = decodeInteger(reader, definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0); + definitionSourcesIndex = defSourcesIndex; + range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex]; + } + else { + range = [genLine, genColumn, 0, 0]; + } + range.isScope = !!hasScope; + if (hasCallsite) { + const prevCsi = callsiteSourcesIndex; + const prevLine = callsiteLine; + callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); + const sameSource = prevCsi === callsiteSourcesIndex; + callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); + callsiteColumn = decodeInteger(reader, sameSource && prevLine === callsiteLine ? callsiteColumn : 0); + callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; + } + range.callsite = callsite; + if (hasMoreVlq(reader, semi)) { + bindings = []; + do { + bindingLine = genLine; + bindingColumn = genColumn; + const expressionsCount = decodeInteger(reader, 0); + let expressionRanges; + if (expressionsCount < -1) { + expressionRanges = [[decodeInteger(reader, 0)]]; + for (let i = -1; i > expressionsCount; i--) { + const prevBl = bindingLine; + bindingLine = decodeInteger(reader, bindingLine); + bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); + const expression = decodeInteger(reader, 0); + expressionRanges.push([expression, bindingLine, bindingColumn]); + } + } + else { + expressionRanges = [[expressionsCount]]; + } + bindings.push(expressionRanges); + } while (hasMoreVlq(reader, semi)); + } + range.bindings = bindings; + ranges.push(range); + stack.push(range); + } + genLine++; + reader.pos = semi + 1; + } while (reader.pos < length); + return ranges; + } + function encodeGeneratedRanges(ranges) { + if (ranges.length === 0) + return ''; + const writer = new StringWriter(); + for (let i = 0; i < ranges.length;) { + i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); + } + return writer.flush(); + } + function _encodeGeneratedRanges(ranges, index, writer, state) { + const range = ranges[index]; + const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, isScope, callsite, bindings, } = range; + if (state[0] < startLine) { + catchupLine(writer, state[0], startLine); + state[0] = startLine; + state[1] = 0; + } + else if (index > 0) { + writer.write(comma); + } + state[1] = encodeInteger(writer, range[1], state[1]); + const fields = (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0); + encodeInteger(writer, fields, 0); + if (range.length === 6) { + const { 4: sourcesIndex, 5: scopesIndex } = range; + if (sourcesIndex !== state[2]) { + state[3] = 0; + } + state[2] = encodeInteger(writer, sourcesIndex, state[2]); + state[3] = encodeInteger(writer, scopesIndex, state[3]); + } + if (callsite) { + const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite; + if (sourcesIndex !== state[4]) { + state[5] = 0; + state[6] = 0; + } + else if (callLine !== state[5]) { + state[6] = 0; + } + state[4] = encodeInteger(writer, sourcesIndex, state[4]); + state[5] = encodeInteger(writer, callLine, state[5]); + state[6] = encodeInteger(writer, callColumn, state[6]); + } + if (bindings) { + for (const binding of bindings) { + if (binding.length > 1) + encodeInteger(writer, -binding.length, 0); + const expression = binding[0][0]; + encodeInteger(writer, expression, 0); + let bindingStartLine = startLine; + let bindingStartColumn = startColumn; + for (let i = 1; i < binding.length; i++) { + const expRange = binding[i]; + bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine); + bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn); + encodeInteger(writer, expRange[0], 0); + } + } + } + for (index++; index < ranges.length;) { + const next = ranges[index]; + const { 0: l, 1: c } = next; + if (l > endLine || (l === endLine && c >= endColumn)) { + break; + } + index = _encodeGeneratedRanges(ranges, index, writer, state); + } + if (state[0] < endLine) { + catchupLine(writer, state[0], endLine); + state[0] = endLine; + state[1] = 0; + } + else { + writer.write(comma); + } + state[1] = encodeInteger(writer, endColumn, state[1]); + return index; + } + function catchupLine(writer, lastLine, line) { + do { + writer.write(semicolon); + } while (++lastLine < line); + } + + function decode(mappings) { + const { length } = mappings; + const reader = new StringReader(mappings); + const decoded = []; + let genColumn = 0; + let sourcesIndex = 0; + let sourceLine = 0; + let sourceColumn = 0; + let namesIndex = 0; + do { + const semi = reader.indexOf(';'); + const line = []; + let sorted = true; + let lastCol = 0; + genColumn = 0; + while (reader.pos < semi) { + let seg; + genColumn = decodeInteger(reader, genColumn); + if (genColumn < lastCol) + sorted = false; + lastCol = genColumn; + if (hasMoreVlq(reader, semi)) { + sourcesIndex = decodeInteger(reader, sourcesIndex); + sourceLine = decodeInteger(reader, sourceLine); + sourceColumn = decodeInteger(reader, sourceColumn); + if (hasMoreVlq(reader, semi)) { + namesIndex = decodeInteger(reader, namesIndex); + seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; + } + else { + seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; + } + } + else { + seg = [genColumn]; + } + line.push(seg); + reader.pos++; + } + if (!sorted) + sort(line); + decoded.push(line); + reader.pos = semi + 1; + } while (reader.pos <= length); + return decoded; + } + function sort(line) { + line.sort(sortComparator); + } + function sortComparator(a, b) { + return a[0] - b[0]; + } + function encode(decoded) { + const writer = new StringWriter(); + let sourcesIndex = 0; + let sourceLine = 0; + let sourceColumn = 0; + let namesIndex = 0; + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + if (i > 0) + writer.write(semicolon); + if (line.length === 0) + continue; + let genColumn = 0; + for (let j = 0; j < line.length; j++) { + const segment = line[j]; + if (j > 0) + writer.write(comma); + genColumn = encodeInteger(writer, segment[0], genColumn); + if (segment.length === 1) + continue; + sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); + sourceLine = encodeInteger(writer, segment[2], sourceLine); + sourceColumn = encodeInteger(writer, segment[3], sourceColumn); + if (segment.length === 4) + continue; + namesIndex = encodeInteger(writer, segment[4], namesIndex); + } + } + return writer.flush(); + } + + exports.decode = decode; + exports.decodeGeneratedRanges = decodeGeneratedRanges; + exports.decodeOriginalScopes = decodeOriginalScopes; + exports.encode = encode; + exports.encodeGeneratedRanges = encodeGeneratedRanges; + exports.encodeOriginalScopes = encodeOriginalScopes; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=sourcemap-codec.umd.js.map diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map new file mode 100644 index 00000000..65b36746 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sourcemap-codec.umd.js","sources":["../src/vlq.ts","../src/strings.ts","../src/scopes.ts","../src/sourcemap-codec.ts"],"sourcesContent":["import type { StringReader, StringWriter } from './strings';\n\nexport const comma = ','.charCodeAt(0);\nexport const semicolon = ';'.charCodeAt(0);\n\nconst chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst intToChar = new Uint8Array(64); // 64 possible chars.\nconst charToInt = new Uint8Array(128); // z is 122 in ASCII\n\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\n\nexport function decodeInteger(reader: StringReader, relative: number): number {\n let value = 0;\n let shift = 0;\n let integer = 0;\n\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n\n const shouldNegate = value & 1;\n value >>>= 1;\n\n if (shouldNegate) {\n value = -0x80000000 | -value;\n }\n\n return relative + value;\n}\n\nexport function encodeInteger(builder: StringWriter, num: number, relative: number): number {\n let delta = num - relative;\n\n delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;\n do {\n let clamped = delta & 0b011111;\n delta >>>= 5;\n if (delta > 0) clamped |= 0b100000;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n\n return num;\n}\n\nexport function hasMoreVlq(reader: StringReader, max: number) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n","const bufLength = 1024 * 16;\n\n// Provide a fallback for older environments.\nconst td =\n typeof TextDecoder !== 'undefined'\n ? /* #__PURE__ */ new TextDecoder()\n : typeof Buffer !== 'undefined'\n ? {\n decode(buf: Uint8Array): string {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n },\n }\n : {\n decode(buf: Uint8Array): string {\n let out = '';\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n },\n };\n\nexport class StringWriter {\n pos = 0;\n private out = '';\n private buffer = new Uint8Array(bufLength);\n\n write(v: number): void {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n\n flush(): string {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n}\n\nexport class StringReader {\n pos = 0;\n private declare buffer: string;\n\n constructor(buffer: string) {\n this.buffer = buffer;\n }\n\n next(): number {\n return this.buffer.charCodeAt(this.pos++);\n }\n\n peek(): number {\n return this.buffer.charCodeAt(this.pos);\n }\n\n indexOf(char: string): number {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n}\n","import { StringReader, StringWriter } from './strings';\nimport { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';\n\nconst EMPTY: any[] = [];\n\ntype Line = number;\ntype Column = number;\ntype Kind = number;\ntype Name = number;\ntype Var = number;\ntype SourcesIndex = number;\ntype ScopesIndex = number;\n\ntype Mix = (A & O) | (B & O);\n\nexport type OriginalScope = Mix<\n [Line, Column, Line, Column, Kind],\n [Line, Column, Line, Column, Kind, Name],\n { vars: Var[] }\n>;\n\nexport type GeneratedRange = Mix<\n [Line, Column, Line, Column],\n [Line, Column, Line, Column, SourcesIndex, ScopesIndex],\n {\n callsite: CallSite | null;\n bindings: Binding[];\n isScope: boolean;\n }\n>;\nexport type CallSite = [SourcesIndex, Line, Column];\ntype Binding = BindingExpressionRange[];\nexport type BindingExpressionRange = [Name] | [Name, Line, Column];\n\nexport function decodeOriginalScopes(input: string): OriginalScope[] {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes: OriginalScope[] = [];\n const stack: OriginalScope[] = [];\n let line = 0;\n\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop()!;\n last[2] = line;\n last[3] = column;\n continue;\n }\n\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 0b0001;\n\n const scope: OriginalScope = (\n hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]\n ) as OriginalScope;\n\n let vars: Var[] = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n\n scopes.push(scope);\n stack.push(scope);\n }\n\n return scopes;\n}\n\nexport function encodeOriginalScopes(scopes: OriginalScope[]): string {\n const writer = new StringWriter();\n\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n\n return writer.flush();\n}\n\nfunction _encodeOriginalScopes(\n scopes: OriginalScope[],\n index: number,\n writer: StringWriter,\n state: [\n number, // GenColumn\n ],\n): number {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n\n if (index > 0) writer.write(comma);\n\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n\n const fields = scope.length === 6 ? 0b0001 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || (l === endLine && c >= endColumn)) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n\n return index;\n}\n\nexport function decodeGeneratedRanges(input: string): GeneratedRange[] {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges: GeneratedRange[] = [];\n const stack: GeneratedRange[] = [];\n\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n\n do {\n const semi = reader.indexOf(';');\n let genColumn = 0;\n\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop()!;\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 0b0001;\n const hasCallsite = fields & 0b0010;\n const hasScope = fields & 0b0100;\n\n let callsite: CallSite | null = null;\n let bindings: Binding[] = EMPTY;\n let range: GeneratedRange;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0,\n );\n\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex] as GeneratedRange;\n } else {\n range = [genLine, genColumn, 0, 0] as GeneratedRange;\n }\n\n range.isScope = !!hasScope;\n\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0,\n );\n\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges: BindingExpressionRange[];\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n\n ranges.push(range);\n stack.push(range);\n }\n\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n\n return ranges;\n}\n\nexport function encodeGeneratedRanges(ranges: GeneratedRange[]): string {\n if (ranges.length === 0) return '';\n\n const writer = new StringWriter();\n\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n\n return writer.flush();\n}\n\nfunction _encodeGeneratedRanges(\n ranges: GeneratedRange[],\n index: number,\n writer: StringWriter,\n state: [\n number, // GenLine\n number, // GenColumn\n number, // DefSourcesIndex\n number, // DefScopesIndex\n number, // CallSourcesIndex\n number, // CallLine\n number, // CallColumn\n ],\n): number {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings,\n } = range;\n\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n\n state[1] = encodeInteger(writer, range[1], state[1]);\n\n const fields =\n (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0);\n encodeInteger(writer, fields, 0);\n\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite!;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1]!, bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2]!, bindingStartColumn);\n encodeInteger(writer, expRange[0]!, 0);\n }\n }\n }\n\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || (l === endLine && c >= endColumn)) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n\n return index;\n}\n\nfunction catchupLine(writer: StringWriter, lastLine: number, line: number) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n","import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';\nimport { StringWriter, StringReader } from './strings';\n\nexport {\n decodeOriginalScopes,\n encodeOriginalScopes,\n decodeGeneratedRanges,\n encodeGeneratedRanges,\n} from './scopes';\nexport type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes';\n\nexport type SourceMapSegment =\n | [number]\n | [number, number, number, number]\n | [number, number, number, number, number];\nexport type SourceMapLine = SourceMapSegment[];\nexport type SourceMapMappings = SourceMapLine[];\n\nexport function decode(mappings: string): SourceMapMappings {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded: SourceMapMappings = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n\n do {\n const semi = reader.indexOf(';');\n const line: SourceMapLine = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n\n while (reader.pos < semi) {\n let seg: SourceMapSegment;\n\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n\n line.push(seg);\n reader.pos++;\n }\n\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n\n return decoded;\n}\n\nfunction sort(line: SourceMapSegment[]) {\n line.sort(sortComparator);\n}\n\nfunction sortComparator(a: SourceMapSegment, b: SourceMapSegment): number {\n return a[0] - b[0];\n}\n\nexport function encode(decoded: SourceMapMappings): string;\nexport function encode(decoded: Readonly): string;\nexport function encode(decoded: Readonly): string {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n\n let genColumn = 0;\n\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n\n genColumn = encodeInteger(writer, segment[0], genColumn);\n\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n\n return writer.flush();\n}\n"],"names":[],"mappings":";;;;;;IAEO,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE3C,MAAM,KAAK,GAAG,kEAAkE,CAAC;IACjF,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjB,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KAClB;aAEe,aAAa,CAAC,MAAoB,EAAE,QAAgB;QAClE,IAAI,KAAK,GA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,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,CAAC,GAAG,CAAC;gBAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACnC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YAEhC,IAAI,SAAS,GAAG,CAAC,CAAC;YAElB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBACxB,IAAI,CAAC,GAAG,CAAC;oBAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAE/B,SAAS,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;gBAEzD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;oBAAE,SAAS;gBACnC,YAAY,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;gBAC/D,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;gBAC3D,YAAY,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;gBAE/D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;oBAAE,SAAS;gBACnC,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;aAC5D;SACF;QAED,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;IACxB;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/types/scopes.d.ts b/node_modules/@jridgewell/sourcemap-codec/dist/types/scopes.d.ts new file mode 100644 index 00000000..d156fabd --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/types/scopes.d.ts @@ -0,0 +1,49 @@ +declare type Line = number; +declare type Column = number; +declare type Kind = number; +declare type Name = number; +declare type Var = number; +declare type SourcesIndex = number; +declare type ScopesIndex = number; +declare type Mix = (A & O) | (B & O); +export declare type OriginalScope = Mix<[ + Line, + Column, + Line, + Column, + Kind +], [ + Line, + Column, + Line, + Column, + Kind, + Name +], { + vars: Var[]; +}>; +export declare type GeneratedRange = Mix<[ + Line, + Column, + Line, + Column +], [ + Line, + Column, + Line, + Column, + SourcesIndex, + ScopesIndex +], { + callsite: CallSite | null; + bindings: Binding[]; + isScope: boolean; +}>; +export declare type CallSite = [SourcesIndex, Line, Column]; +declare type Binding = BindingExpressionRange[]; +export declare type BindingExpressionRange = [Name] | [Name, Line, Column]; +export declare function decodeOriginalScopes(input: string): OriginalScope[]; +export declare function encodeOriginalScopes(scopes: OriginalScope[]): string; +export declare function decodeGeneratedRanges(input: string): GeneratedRange[]; +export declare function encodeGeneratedRanges(ranges: GeneratedRange[]): string; +export {}; diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts b/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts new file mode 100644 index 00000000..336e658f --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts @@ -0,0 +1,8 @@ +export { decodeOriginalScopes, encodeOriginalScopes, decodeGeneratedRanges, encodeGeneratedRanges, } from './scopes'; +export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes'; +export declare type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number]; +export declare type SourceMapLine = SourceMapSegment[]; +export declare type SourceMapMappings = SourceMapLine[]; +export declare function decode(mappings: string): SourceMapMappings; +export declare function encode(decoded: SourceMapMappings): string; +export declare function encode(decoded: Readonly): string; diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/types/strings.d.ts b/node_modules/@jridgewell/sourcemap-codec/dist/types/strings.d.ts new file mode 100644 index 00000000..78bd88eb --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/types/strings.d.ts @@ -0,0 +1,15 @@ +export declare class StringWriter { + pos: number; + private out; + private buffer; + write(v: number): void; + flush(): string; +} +export declare class StringReader { + pos: number; + private buffer; + constructor(buffer: string); + next(): number; + peek(): number; + indexOf(char: string): number; +} diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/types/vlq.d.ts b/node_modules/@jridgewell/sourcemap-codec/dist/types/vlq.d.ts new file mode 100644 index 00000000..450ee572 --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/dist/types/vlq.d.ts @@ -0,0 +1,6 @@ +import type { StringReader, StringWriter } from './strings'; +export declare const comma: number; +export declare const semicolon: number; +export declare function decodeInteger(reader: StringReader, relative: number): number; +export declare function encodeInteger(builder: StringWriter, num: number, relative: number): number; +export declare function hasMoreVlq(reader: StringReader, max: number): boolean; diff --git a/node_modules/@jridgewell/sourcemap-codec/package.json b/node_modules/@jridgewell/sourcemap-codec/package.json new file mode 100644 index 00000000..7168efca --- /dev/null +++ b/node_modules/@jridgewell/sourcemap-codec/package.json @@ -0,0 +1,75 @@ +{ + "name": "@jridgewell/sourcemap-codec", + "version": "1.5.0", + "description": "Encode/decode sourcemap mappings", + "keywords": [ + "sourcemap", + "vlq" + ], + "main": "dist/sourcemap-codec.umd.js", + "module": "dist/sourcemap-codec.mjs", + "types": "dist/types/sourcemap-codec.d.ts", + "files": [ + "dist" + ], + "exports": { + ".": [ + { + "types": "./dist/types/sourcemap-codec.d.ts", + "browser": "./dist/sourcemap-codec.umd.js", + "require": "./dist/sourcemap-codec.umd.js", + "import": "./dist/sourcemap-codec.mjs" + }, + "./dist/sourcemap-codec.umd.js" + ], + "./package.json": "./package.json" + }, + "scripts": { + "benchmark": "run-s build:rollup benchmark:*", + "benchmark:install": "cd benchmark && npm install", + "benchmark:only": "node --expose-gc benchmark/index.js", + "build": "run-s -n build:*", + "build:rollup": "rollup -c rollup.config.js", + "build:ts": "tsc --project tsconfig.build.json", + "lint": "run-s -n lint:*", + "lint:prettier": "npm run test:lint:prettier -- --write", + "lint:ts": "npm run test:lint:ts -- --fix", + "prebuild": "rm -rf dist", + "prepublishOnly": "npm run preversion", + "preversion": "run-s test build", + "test": "run-s -n test:lint test:only", + "test:debug": "mocha --inspect-brk", + "test:lint": "run-s -n test:lint:*", + "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", + "test:lint:ts": "eslint '{src,test}/**/*.ts'", + "test:only": "mocha", + "test:coverage": "c8 mocha", + "test:watch": "mocha --watch" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/jridgewell/sourcemap-codec.git" + }, + "author": "Rich Harris", + "license": "MIT", + "devDependencies": { + "@rollup/plugin-typescript": "8.3.0", + "@types/mocha": "10.0.6", + "@types/node": "17.0.15", + "@typescript-eslint/eslint-plugin": "5.10.0", + "@typescript-eslint/parser": "5.10.0", + "benchmark": "2.1.4", + "c8": "7.11.2", + "eslint": "8.7.0", + "eslint-config-prettier": "8.3.0", + "mocha": "9.2.0", + "npm-run-all": "4.1.5", + "prettier": "2.5.1", + "rollup": "2.64.0", + "source-map": "0.6.1", + "source-map-js": "1.0.2", + "sourcemap-codec": "1.4.8", + "tsx": "4.7.1", + "typescript": "4.5.4" + } +} diff --git a/node_modules/@nodelib/fs.scandir/LICENSE b/node_modules/@nodelib/fs.scandir/LICENSE new file mode 100644 index 00000000..65a99946 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Denis Malinochkin + +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/@nodelib/fs.scandir/README.md b/node_modules/@nodelib/fs.scandir/README.md new file mode 100644 index 00000000..e0b218b9 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/README.md @@ -0,0 +1,171 @@ +# @nodelib/fs.scandir + +> List files and directories inside the specified directory. + +## :bulb: Highlights + +The package is aimed at obtaining information about entries in the directory. + +* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional). +* :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode). +* :link: Can safely work with broken symbolic links. + +## Install + +```console +npm install @nodelib/fs.scandir +``` + +## Usage + +```ts +import * as fsScandir from '@nodelib/fs.scandir'; + +fsScandir.scandir('path', (error, stats) => { /* … */ }); +``` + +## API + +### .scandir(path, [optionsOrSettings], callback) + +Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style. + +```ts +fsScandir.scandir('path', (error, entries) => { /* … */ }); +fsScandir.scandir('path', {}, (error, entries) => { /* … */ }); +fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ }); +``` + +### .scandirSync(path, [optionsOrSettings]) + +Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path. + +```ts +const entries = fsScandir.scandirSync('path'); +const entries = fsScandir.scandirSync('path', {}); +const entries = fsScandir.scandirSync(('path', new fsScandir.Settings()); +``` + +#### path + +* Required: `true` +* Type: `string | Buffer | URL` + +A path to a file. If a URL is provided, it must use the `file:` protocol. + +#### optionsOrSettings + +* Required: `false` +* Type: `Options | Settings` +* Default: An instance of `Settings` class + +An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class. + +> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. + +### Settings([options]) + +A class of full settings of the package. + +```ts +const settings = new fsScandir.Settings({ followSymbolicLinks: false }); + +const entries = fsScandir.scandirSync('path', settings); +``` + +## Entry + +* `name` — The name of the entry (`unknown.txt`). +* `path` — The path of the entry relative to call directory (`root/unknown.txt`). +* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class. +* `stats` (optional) — An instance of `fs.Stats` class. + +For example, the `scandir` call for `tools` directory with one directory inside: + +```ts +{ + dirent: Dirent { name: 'typedoc', /* … */ }, + name: 'typedoc', + path: 'tools/typedoc' +} +``` + +## Options + +### stats + +* Type: `boolean` +* Default: `false` + +Adds an instance of `fs.Stats` class to the [`Entry`](#entry). + +> :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO?? + +### followSymbolicLinks + +* Type: `boolean` +* Default: `false` + +Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`. + +### `throwErrorOnBrokenSymbolicLink` + +* Type: `boolean` +* Default: `true` + +Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`. + +### `pathSegmentSeparator` + +* Type: `string` +* Default: `path.sep` + +By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead. + +### `fs` + +* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) +* Default: A default FS methods + +By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. + +```ts +interface FileSystemAdapter { + lstat?: typeof fs.lstat; + stat?: typeof fs.stat; + lstatSync?: typeof fs.lstatSync; + statSync?: typeof fs.statSync; + readdir?: typeof fs.readdir; + readdirSync?: typeof fs.readdirSync; +} + +const settings = new fsScandir.Settings({ + fs: { lstat: fakeLstat } +}); +``` + +## `old` and `modern` mode + +This package has two modes that are used depending on the environment and parameters of use. + +### old + +* Node.js below `10.10` or when the `stats` option is enabled + +When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links). + +### modern + +* Node.js 10.10+ and the `stats` option is disabled + +In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present. + +This mode makes fewer calls to the file system. It's faster. + +## Changelog + +See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. + +## License + +This software is released under the terms of the MIT license. diff --git a/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts b/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts new file mode 100644 index 00000000..827f1db0 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts @@ -0,0 +1,20 @@ +import type * as fsStat from '@nodelib/fs.stat'; +import type { Dirent, ErrnoException } from '../types'; +export interface ReaddirAsynchronousMethod { + (filepath: string, options: { + withFileTypes: true; + }, callback: (error: ErrnoException | null, files: Dirent[]) => void): void; + (filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void; +} +export interface ReaddirSynchronousMethod { + (filepath: string, options: { + withFileTypes: true; + }): Dirent[]; + (filepath: string): string[]; +} +export declare type FileSystemAdapter = fsStat.FileSystemAdapter & { + readdir: ReaddirAsynchronousMethod; + readdirSync: ReaddirSynchronousMethod; +}; +export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; +export declare function createFileSystemAdapter(fsMethods?: Partial): FileSystemAdapter; diff --git a/node_modules/@nodelib/fs.scandir/out/adapters/fs.js b/node_modules/@nodelib/fs.scandir/out/adapters/fs.js new file mode 100644 index 00000000..f0fe0220 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/adapters/fs.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; +const fs = require("fs"); +exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; +function createFileSystemAdapter(fsMethods) { + if (fsMethods === undefined) { + return exports.FILE_SYSTEM_ADAPTER; + } + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); +} +exports.createFileSystemAdapter = createFileSystemAdapter; diff --git a/node_modules/@nodelib/fs.scandir/out/constants.d.ts b/node_modules/@nodelib/fs.scandir/out/constants.d.ts new file mode 100644 index 00000000..33f17497 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/constants.d.ts @@ -0,0 +1,4 @@ +/** + * IS `true` for Node.js 10.10 and greater. + */ +export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean; diff --git a/node_modules/@nodelib/fs.scandir/out/constants.js b/node_modules/@nodelib/fs.scandir/out/constants.js new file mode 100644 index 00000000..7e3d4411 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/constants.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; +const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); +if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) { + throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`); +} +const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); +const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); +const SUPPORTED_MAJOR_VERSION = 10; +const SUPPORTED_MINOR_VERSION = 10; +const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; +const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; +/** + * IS `true` for Node.js 10.10 and greater. + */ +exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; diff --git a/node_modules/@nodelib/fs.scandir/out/index.d.ts b/node_modules/@nodelib/fs.scandir/out/index.d.ts new file mode 100644 index 00000000..b9da83ed --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/index.d.ts @@ -0,0 +1,12 @@ +import type { FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from './adapters/fs'; +import * as async from './providers/async'; +import Settings, { Options } from './settings'; +import type { Dirent, Entry } from './types'; +declare type AsyncCallback = async.AsyncCallback; +declare function scandir(path: string, callback: AsyncCallback): void; +declare function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; +declare namespace scandir { + function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise; +} +declare function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[]; +export { scandir, scandirSync, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod, Options }; diff --git a/node_modules/@nodelib/fs.scandir/out/index.js b/node_modules/@nodelib/fs.scandir/out/index.js new file mode 100644 index 00000000..99c70d3d --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/index.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Settings = exports.scandirSync = exports.scandir = void 0; +const async = require("./providers/async"); +const sync = require("./providers/sync"); +const settings_1 = require("./settings"); +exports.Settings = settings_1.default; +function scandir(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + async.read(path, getSettings(), optionsOrSettingsOrCallback); + return; + } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); +} +exports.scandir = scandir; +function scandirSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); +} +exports.scandirSync = scandirSync; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); +} diff --git a/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts new file mode 100644 index 00000000..5829676d --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts @@ -0,0 +1,7 @@ +/// +import type Settings from '../settings'; +import type { Entry } from '../types'; +export declare type AsyncCallback = (error: NodeJS.ErrnoException, entries: Entry[]) => void; +export declare function read(directory: string, settings: Settings, callback: AsyncCallback): void; +export declare function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void; +export declare function readdir(directory: string, settings: Settings, callback: AsyncCallback): void; diff --git a/node_modules/@nodelib/fs.scandir/out/providers/async.js b/node_modules/@nodelib/fs.scandir/out/providers/async.js new file mode 100644 index 00000000..e8e2f0a9 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/async.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; +const fsStat = require("@nodelib/fs.stat"); +const rpl = require("run-parallel"); +const constants_1 = require("../constants"); +const utils = require("../utils"); +const common = require("./common"); +function read(directory, settings, callback) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + readdirWithFileTypes(directory, settings, callback); + return; + } + readdir(directory, settings, callback); +} +exports.read = read; +function readdirWithFileTypes(directory, settings, callback) { + settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { + if (readdirError !== null) { + callFailureCallback(callback, readdirError); + return; + } + const entries = dirents.map((dirent) => ({ + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + })); + if (!settings.followSymbolicLinks) { + callSuccessCallback(callback, entries); + return; + } + const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); + rpl(tasks, (rplError, rplEntries) => { + if (rplError !== null) { + callFailureCallback(callback, rplError); + return; + } + callSuccessCallback(callback, rplEntries); + }); + }); +} +exports.readdirWithFileTypes = readdirWithFileTypes; +function makeRplTaskEntry(entry, settings) { + return (done) => { + if (!entry.dirent.isSymbolicLink()) { + done(null, entry); + return; + } + settings.fs.stat(entry.path, (statError, stats) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + done(statError); + return; + } + done(null, entry); + return; + } + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + done(null, entry); + }); + }; +} +function readdir(directory, settings, callback) { + settings.fs.readdir(directory, (readdirError, names) => { + if (readdirError !== null) { + callFailureCallback(callback, readdirError); + return; + } + const tasks = names.map((name) => { + const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); + return (done) => { + fsStat.stat(path, settings.fsStatSettings, (error, stats) => { + if (error !== null) { + done(error); + return; + } + const entry = { + name, + path, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + done(null, entry); + }); + }; + }); + rpl(tasks, (rplError, entries) => { + if (rplError !== null) { + callFailureCallback(callback, rplError); + return; + } + callSuccessCallback(callback, entries); + }); + }); +} +exports.readdir = readdir; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, result) { + callback(null, result); +} diff --git a/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts new file mode 100644 index 00000000..2b4d08b5 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts @@ -0,0 +1 @@ +export declare function joinPathSegments(a: string, b: string, separator: string): string; diff --git a/node_modules/@nodelib/fs.scandir/out/providers/common.js b/node_modules/@nodelib/fs.scandir/out/providers/common.js new file mode 100644 index 00000000..8724cb59 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/common.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.joinPathSegments = void 0; +function joinPathSegments(a, b, separator) { + /** + * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + */ + if (a.endsWith(separator)) { + return a + b; + } + return a + separator + b; +} +exports.joinPathSegments = joinPathSegments; diff --git a/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts new file mode 100644 index 00000000..e05c8f07 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts @@ -0,0 +1,5 @@ +import type Settings from '../settings'; +import type { Entry } from '../types'; +export declare function read(directory: string, settings: Settings): Entry[]; +export declare function readdirWithFileTypes(directory: string, settings: Settings): Entry[]; +export declare function readdir(directory: string, settings: Settings): Entry[]; diff --git a/node_modules/@nodelib/fs.scandir/out/providers/sync.js b/node_modules/@nodelib/fs.scandir/out/providers/sync.js new file mode 100644 index 00000000..146db343 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/sync.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; +const fsStat = require("@nodelib/fs.stat"); +const constants_1 = require("../constants"); +const utils = require("../utils"); +const common = require("./common"); +function read(directory, settings) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings); + } + return readdir(directory, settings); +} +exports.read = read; +function readdirWithFileTypes(directory, settings) { + const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); + return dirents.map((dirent) => { + const entry = { + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + }; + if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { + try { + const stats = settings.fs.statSync(entry.path); + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + } + catch (error) { + if (settings.throwErrorOnBrokenSymbolicLink) { + throw error; + } + } + } + return entry; + }); +} +exports.readdirWithFileTypes = readdirWithFileTypes; +function readdir(directory, settings) { + const names = settings.fs.readdirSync(directory); + return names.map((name) => { + const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); + const stats = fsStat.statSync(entryPath, settings.fsStatSettings); + const entry = { + name, + path: entryPath, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + return entry; + }); +} +exports.readdir = readdir; diff --git a/node_modules/@nodelib/fs.scandir/out/settings.d.ts b/node_modules/@nodelib/fs.scandir/out/settings.d.ts new file mode 100644 index 00000000..a0db1155 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/settings.d.ts @@ -0,0 +1,20 @@ +import * as fsStat from '@nodelib/fs.stat'; +import * as fs from './adapters/fs'; +export interface Options { + followSymbolicLinks?: boolean; + fs?: Partial; + pathSegmentSeparator?: string; + stats?: boolean; + throwErrorOnBrokenSymbolicLink?: boolean; +} +export default class Settings { + private readonly _options; + readonly followSymbolicLinks: boolean; + readonly fs: fs.FileSystemAdapter; + readonly pathSegmentSeparator: string; + readonly stats: boolean; + readonly throwErrorOnBrokenSymbolicLink: boolean; + readonly fsStatSettings: fsStat.Settings; + constructor(_options?: Options); + private _getValue; +} diff --git a/node_modules/@nodelib/fs.scandir/out/settings.js b/node_modules/@nodelib/fs.scandir/out/settings.js new file mode 100644 index 00000000..15a3e8cd --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/settings.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const fsStat = require("@nodelib/fs.stat"); +const fs = require("./adapters/fs"); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.stats = this._getValue(this._options.stats, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + this.fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this.followSymbolicLinks, + fs: this.fs, + throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } +} +exports.default = Settings; diff --git a/node_modules/@nodelib/fs.scandir/out/types/index.d.ts b/node_modules/@nodelib/fs.scandir/out/types/index.d.ts new file mode 100644 index 00000000..f326c5e5 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/types/index.d.ts @@ -0,0 +1,20 @@ +/// +import type * as fs from 'fs'; +export interface Entry { + dirent: Dirent; + name: string; + path: string; + stats?: Stats; +} +export declare type Stats = fs.Stats; +export declare type ErrnoException = NodeJS.ErrnoException; +export interface Dirent { + isBlockDevice: () => boolean; + isCharacterDevice: () => boolean; + isDirectory: () => boolean; + isFIFO: () => boolean; + isFile: () => boolean; + isSocket: () => boolean; + isSymbolicLink: () => boolean; + name: string; +} diff --git a/node_modules/@nodelib/fs.scandir/out/types/index.js b/node_modules/@nodelib/fs.scandir/out/types/index.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/types/index.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts b/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts new file mode 100644 index 00000000..bb863f15 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts @@ -0,0 +1,2 @@ +import type { Dirent, Stats } from '../types'; +export declare function createDirentFromStats(name: string, stats: Stats): Dirent; diff --git a/node_modules/@nodelib/fs.scandir/out/utils/fs.js b/node_modules/@nodelib/fs.scandir/out/utils/fs.js new file mode 100644 index 00000000..ace7c74d --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/fs.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDirentFromStats = void 0; +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; diff --git a/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts b/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts new file mode 100644 index 00000000..1b41954e --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts @@ -0,0 +1,2 @@ +import * as fs from './fs'; +export { fs }; diff --git a/node_modules/@nodelib/fs.scandir/out/utils/index.js b/node_modules/@nodelib/fs.scandir/out/utils/index.js new file mode 100644 index 00000000..f5de129f --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = void 0; +const fs = require("./fs"); +exports.fs = fs; diff --git a/node_modules/@nodelib/fs.scandir/package.json b/node_modules/@nodelib/fs.scandir/package.json new file mode 100644 index 00000000..d3a89241 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/package.json @@ -0,0 +1,44 @@ +{ + "name": "@nodelib/fs.scandir", + "version": "2.1.5", + "description": "List files and directories inside the specified directory", + "license": "MIT", + "repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir", + "keywords": [ + "NodeLib", + "fs", + "FileSystem", + "file system", + "scandir", + "readdir", + "dirent" + ], + "engines": { + "node": ">= 8" + }, + "files": [ + "out/**", + "!out/**/*.map", + "!out/**/*.spec.*" + ], + "main": "out/index.js", + "typings": "out/index.d.ts", + "scripts": { + "clean": "rimraf {tsconfig.tsbuildinfo,out}", + "lint": "eslint \"src/**/*.ts\" --cache", + "compile": "tsc -b .", + "compile:watch": "tsc -p . --watch --sourceMap", + "test": "mocha \"out/**/*.spec.js\" -s 0", + "build": "npm run clean && npm run compile && npm run lint && npm test", + "watch": "npm run clean && npm run compile:watch" + }, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "devDependencies": { + "@nodelib/fs.macchiato": "1.0.4", + "@types/run-parallel": "^1.1.0" + }, + "gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562" +} diff --git a/node_modules/@nodelib/fs.stat/LICENSE b/node_modules/@nodelib/fs.stat/LICENSE new file mode 100644 index 00000000..65a99946 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Denis Malinochkin + +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/@nodelib/fs.stat/README.md b/node_modules/@nodelib/fs.stat/README.md new file mode 100644 index 00000000..686f0471 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/README.md @@ -0,0 +1,126 @@ +# @nodelib/fs.stat + +> Get the status of a file with some features. + +## :bulb: Highlights + +Wrapper around standard method `fs.lstat` and `fs.stat` with some features. + +* :beginner: Normally follows symbolic link. +* :gear: Can safely work with broken symbolic link. + +## Install + +```console +npm install @nodelib/fs.stat +``` + +## Usage + +```ts +import * as fsStat from '@nodelib/fs.stat'; + +fsStat.stat('path', (error, stats) => { /* … */ }); +``` + +## API + +### .stat(path, [optionsOrSettings], callback) + +Returns an instance of `fs.Stats` class for provided path with standard callback-style. + +```ts +fsStat.stat('path', (error, stats) => { /* … */ }); +fsStat.stat('path', {}, (error, stats) => { /* … */ }); +fsStat.stat('path', new fsStat.Settings(), (error, stats) => { /* … */ }); +``` + +### .statSync(path, [optionsOrSettings]) + +Returns an instance of `fs.Stats` class for provided path. + +```ts +const stats = fsStat.stat('path'); +const stats = fsStat.stat('path', {}); +const stats = fsStat.stat('path', new fsStat.Settings()); +``` + +#### path + +* Required: `true` +* Type: `string | Buffer | URL` + +A path to a file. If a URL is provided, it must use the `file:` protocol. + +#### optionsOrSettings + +* Required: `false` +* Type: `Options | Settings` +* Default: An instance of `Settings` class + +An [`Options`](#options) object or an instance of [`Settings`](#settings) class. + +> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. + +### Settings([options]) + +A class of full settings of the package. + +```ts +const settings = new fsStat.Settings({ followSymbolicLink: false }); + +const stats = fsStat.stat('path', settings); +``` + +## Options + +### `followSymbolicLink` + +* Type: `boolean` +* Default: `true` + +Follow symbolic link or not. Call `fs.stat` on symbolic link if `true`. + +### `markSymbolicLink` + +* Type: `boolean` +* Default: `false` + +Mark symbolic link by setting the return value of `isSymbolicLink` function to always `true` (even after `fs.stat`). + +> :book: Can be used if you want to know what is hidden behind a symbolic link, but still continue to know that it is a symbolic link. + +### `throwErrorOnBrokenSymbolicLink` + +* Type: `boolean` +* Default: `true` + +Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. + +### `fs` + +* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) +* Default: A default FS methods + +By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. + +```ts +interface FileSystemAdapter { + lstat?: typeof fs.lstat; + stat?: typeof fs.stat; + lstatSync?: typeof fs.lstatSync; + statSync?: typeof fs.statSync; +} + +const settings = new fsStat.Settings({ + fs: { lstat: fakeLstat } +}); +``` + +## Changelog + +See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. + +## License + +This software is released under the terms of the MIT license. diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts b/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts new file mode 100644 index 00000000..3af759c9 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts @@ -0,0 +1,13 @@ +/// +import * as fs from 'fs'; +import type { ErrnoException } from '../types'; +export declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void; +export declare type StatSynchronousMethod = (path: string) => fs.Stats; +export interface FileSystemAdapter { + lstat: StatAsynchronousMethod; + stat: StatAsynchronousMethod; + lstatSync: StatSynchronousMethod; + statSync: StatSynchronousMethod; +} +export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; +export declare function createFileSystemAdapter(fsMethods?: Partial): FileSystemAdapter; diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.js b/node_modules/@nodelib/fs.stat/out/adapters/fs.js new file mode 100644 index 00000000..8dc08c8c --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/adapters/fs.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; +const fs = require("fs"); +exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync +}; +function createFileSystemAdapter(fsMethods) { + if (fsMethods === undefined) { + return exports.FILE_SYSTEM_ADAPTER; + } + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); +} +exports.createFileSystemAdapter = createFileSystemAdapter; diff --git a/node_modules/@nodelib/fs.stat/out/index.d.ts b/node_modules/@nodelib/fs.stat/out/index.d.ts new file mode 100644 index 00000000..f95db995 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/index.d.ts @@ -0,0 +1,12 @@ +import type { FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod } from './adapters/fs'; +import * as async from './providers/async'; +import Settings, { Options } from './settings'; +import type { Stats } from './types'; +declare type AsyncCallback = async.AsyncCallback; +declare function stat(path: string, callback: AsyncCallback): void; +declare function stat(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; +declare namespace stat { + function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise; +} +declare function statSync(path: string, optionsOrSettings?: Options | Settings): Stats; +export { Settings, stat, statSync, AsyncCallback, FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod, Options, Stats }; diff --git a/node_modules/@nodelib/fs.stat/out/index.js b/node_modules/@nodelib/fs.stat/out/index.js new file mode 100644 index 00000000..b23f7510 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/index.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.statSync = exports.stat = exports.Settings = void 0; +const async = require("./providers/async"); +const sync = require("./providers/sync"); +const settings_1 = require("./settings"); +exports.Settings = settings_1.default; +function stat(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + async.read(path, getSettings(), optionsOrSettingsOrCallback); + return; + } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); +} +exports.stat = stat; +function statSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); +} +exports.statSync = statSync; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); +} diff --git a/node_modules/@nodelib/fs.stat/out/providers/async.d.ts b/node_modules/@nodelib/fs.stat/out/providers/async.d.ts new file mode 100644 index 00000000..85423ce1 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/async.d.ts @@ -0,0 +1,4 @@ +import type Settings from '../settings'; +import type { ErrnoException, Stats } from '../types'; +export declare type AsyncCallback = (error: ErrnoException, stats: Stats) => void; +export declare function read(path: string, settings: Settings, callback: AsyncCallback): void; diff --git a/node_modules/@nodelib/fs.stat/out/providers/async.js b/node_modules/@nodelib/fs.stat/out/providers/async.js new file mode 100644 index 00000000..983ff0e6 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/async.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.read = void 0; +function read(path, settings, callback) { + settings.fs.lstat(path, (lstatError, lstat) => { + if (lstatError !== null) { + callFailureCallback(callback, lstatError); + return; + } + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + callSuccessCallback(callback, lstat); + return; + } + settings.fs.stat(path, (statError, stat) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + callFailureCallback(callback, statError); + return; + } + callSuccessCallback(callback, lstat); + return; + } + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + callSuccessCallback(callback, stat); + }); + }); +} +exports.read = read; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, result) { + callback(null, result); +} diff --git a/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts b/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts new file mode 100644 index 00000000..428c3d79 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts @@ -0,0 +1,3 @@ +import type Settings from '../settings'; +import type { Stats } from '../types'; +export declare function read(path: string, settings: Settings): Stats; diff --git a/node_modules/@nodelib/fs.stat/out/providers/sync.js b/node_modules/@nodelib/fs.stat/out/providers/sync.js new file mode 100644 index 00000000..1521c361 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/sync.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.read = void 0; +function read(path, settings) { + const lstat = settings.fs.lstatSync(path); + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + return lstat; + } + try { + const stat = settings.fs.statSync(path); + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + return stat; + } + catch (error) { + if (!settings.throwErrorOnBrokenSymbolicLink) { + return lstat; + } + throw error; + } +} +exports.read = read; diff --git a/node_modules/@nodelib/fs.stat/out/settings.d.ts b/node_modules/@nodelib/fs.stat/out/settings.d.ts new file mode 100644 index 00000000..f4b3d444 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/settings.d.ts @@ -0,0 +1,16 @@ +import * as fs from './adapters/fs'; +export interface Options { + followSymbolicLink?: boolean; + fs?: Partial; + markSymbolicLink?: boolean; + throwErrorOnBrokenSymbolicLink?: boolean; +} +export default class Settings { + private readonly _options; + readonly followSymbolicLink: boolean; + readonly fs: fs.FileSystemAdapter; + readonly markSymbolicLink: boolean; + readonly throwErrorOnBrokenSymbolicLink: boolean; + constructor(_options?: Options); + private _getValue; +} diff --git a/node_modules/@nodelib/fs.stat/out/settings.js b/node_modules/@nodelib/fs.stat/out/settings.js new file mode 100644 index 00000000..111ec09c --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/settings.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const fs = require("./adapters/fs"); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } +} +exports.default = Settings; diff --git a/node_modules/@nodelib/fs.stat/out/types/index.d.ts b/node_modules/@nodelib/fs.stat/out/types/index.d.ts new file mode 100644 index 00000000..74c08ed2 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/types/index.d.ts @@ -0,0 +1,4 @@ +/// +import type * as fs from 'fs'; +export declare type Stats = fs.Stats; +export declare type ErrnoException = NodeJS.ErrnoException; diff --git a/node_modules/@nodelib/fs.stat/out/types/index.js b/node_modules/@nodelib/fs.stat/out/types/index.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/types/index.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/@nodelib/fs.stat/package.json b/node_modules/@nodelib/fs.stat/package.json new file mode 100644 index 00000000..f2540c28 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/package.json @@ -0,0 +1,37 @@ +{ + "name": "@nodelib/fs.stat", + "version": "2.0.5", + "description": "Get the status of a file with some features", + "license": "MIT", + "repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat", + "keywords": [ + "NodeLib", + "fs", + "FileSystem", + "file system", + "stat" + ], + "engines": { + "node": ">= 8" + }, + "files": [ + "out/**", + "!out/**/*.map", + "!out/**/*.spec.*" + ], + "main": "out/index.js", + "typings": "out/index.d.ts", + "scripts": { + "clean": "rimraf {tsconfig.tsbuildinfo,out}", + "lint": "eslint \"src/**/*.ts\" --cache", + "compile": "tsc -b .", + "compile:watch": "tsc -p . --watch --sourceMap", + "test": "mocha \"out/**/*.spec.js\" -s 0", + "build": "npm run clean && npm run compile && npm run lint && npm test", + "watch": "npm run clean && npm run compile:watch" + }, + "devDependencies": { + "@nodelib/fs.macchiato": "1.0.4" + }, + "gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562" +} diff --git a/node_modules/@nodelib/fs.walk/LICENSE b/node_modules/@nodelib/fs.walk/LICENSE new file mode 100644 index 00000000..65a99946 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Denis Malinochkin + +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/@nodelib/fs.walk/README.md b/node_modules/@nodelib/fs.walk/README.md new file mode 100644 index 00000000..6ccc08db --- /dev/null +++ b/node_modules/@nodelib/fs.walk/README.md @@ -0,0 +1,215 @@ +# @nodelib/fs.walk + +> A library for efficiently walking a directory recursively. + +## :bulb: Highlights + +* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional). +* :rocket: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type for performance reasons. See [`old` and `modern` mode](https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode). +* :gear: Built-in directories/files and error filtering system. +* :link: Can safely work with broken symbolic links. + +## Install + +```console +npm install @nodelib/fs.walk +``` + +## Usage + +```ts +import * as fsWalk from '@nodelib/fs.walk'; + +fsWalk.walk('path', (error, entries) => { /* … */ }); +``` + +## API + +### .walk(path, [optionsOrSettings], callback) + +Reads the directory recursively and asynchronously. Requires a callback function. + +> :book: If you want to use the Promise API, use `util.promisify`. + +```ts +fsWalk.walk('path', (error, entries) => { /* … */ }); +fsWalk.walk('path', {}, (error, entries) => { /* … */ }); +fsWalk.walk('path', new fsWalk.Settings(), (error, entries) => { /* … */ }); +``` + +### .walkStream(path, [optionsOrSettings]) + +Reads the directory recursively and asynchronously. [Readable Stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_readable_streams) is used as a provider. + +```ts +const stream = fsWalk.walkStream('path'); +const stream = fsWalk.walkStream('path', {}); +const stream = fsWalk.walkStream('path', new fsWalk.Settings()); +``` + +### .walkSync(path, [optionsOrSettings]) + +Reads the directory recursively and synchronously. Returns an array of entries. + +```ts +const entries = fsWalk.walkSync('path'); +const entries = fsWalk.walkSync('path', {}); +const entries = fsWalk.walkSync('path', new fsWalk.Settings()); +``` + +#### path + +* Required: `true` +* Type: `string | Buffer | URL` + +A path to a file. If a URL is provided, it must use the `file:` protocol. + +#### optionsOrSettings + +* Required: `false` +* Type: `Options | Settings` +* Default: An instance of `Settings` class + +An [`Options`](#options) object or an instance of [`Settings`](#settings) class. + +> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. + +### Settings([options]) + +A class of full settings of the package. + +```ts +const settings = new fsWalk.Settings({ followSymbolicLinks: true }); + +const entries = fsWalk.walkSync('path', settings); +``` + +## Entry + +* `name` — The name of the entry (`unknown.txt`). +* `path` — The path of the entry relative to call directory (`root/unknown.txt`). +* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. +* [`stats`] — An instance of `fs.Stats` class. + +## Options + +### basePath + +* Type: `string` +* Default: `undefined` + +By default, all paths are built relative to the root path. You can use this option to set custom root path. + +In the example below we read the files from the `root` directory, but in the results the root path will be `custom`. + +```ts +fsWalk.walkSync('root'); // → ['root/file.txt'] +fsWalk.walkSync('root', { basePath: 'custom' }); // → ['custom/file.txt'] +``` + +### concurrency + +* Type: `number` +* Default: `Infinity` + +The maximum number of concurrent calls to `fs.readdir`. + +> :book: The higher the number, the higher performance and the load on the File System. If you want to read in quiet mode, set the value to `4 * os.cpus().length` (4 is default size of [thread pool work scheduling](http://docs.libuv.org/en/v1.x/threadpool.html#thread-pool-work-scheduling)). + +### deepFilter + +* Type: [`DeepFilterFunction`](./src/settings.ts) +* Default: `undefined` + +A function that indicates whether the directory will be read deep or not. + +```ts +// Skip all directories that starts with `node_modules` +const filter: DeepFilterFunction = (entry) => !entry.path.startsWith('node_modules'); +``` + +### entryFilter + +* Type: [`EntryFilterFunction`](./src/settings.ts) +* Default: `undefined` + +A function that indicates whether the entry will be included to results or not. + +```ts +// Exclude all `.js` files from results +const filter: EntryFilterFunction = (entry) => !entry.name.endsWith('.js'); +``` + +### errorFilter + +* Type: [`ErrorFilterFunction`](./src/settings.ts) +* Default: `undefined` + +A function that allows you to skip errors that occur when reading directories. + +For example, you can skip `ENOENT` errors if required: + +```ts +// Skip all ENOENT errors +const filter: ErrorFilterFunction = (error) => error.code == 'ENOENT'; +``` + +### stats + +* Type: `boolean` +* Default: `false` + +Adds an instance of `fs.Stats` class to the [`Entry`](#entry). + +> :book: Always use `fs.readdir` with additional `fs.lstat/fs.stat` calls to determine the entry type. + +### followSymbolicLinks + +* Type: `boolean` +* Default: `false` + +Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`. + +### `throwErrorOnBrokenSymbolicLink` + +* Type: `boolean` +* Default: `true` + +Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. + +### `pathSegmentSeparator` + +* Type: `string` +* Default: `path.sep` + +By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead. + +### `fs` + +* Type: `FileSystemAdapter` +* Default: A default FS methods + +By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. + +```ts +interface FileSystemAdapter { + lstat: typeof fs.lstat; + stat: typeof fs.stat; + lstatSync: typeof fs.lstatSync; + statSync: typeof fs.statSync; + readdir: typeof fs.readdir; + readdirSync: typeof fs.readdirSync; +} + +const settings = new fsWalk.Settings({ + fs: { lstat: fakeLstat } +}); +``` + +## Changelog + +See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. + +## License + +This software is released under the terms of the MIT license. diff --git a/node_modules/@nodelib/fs.walk/out/index.d.ts b/node_modules/@nodelib/fs.walk/out/index.d.ts new file mode 100644 index 00000000..8864c7bf --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/index.d.ts @@ -0,0 +1,14 @@ +/// +import type { Readable } from 'stream'; +import type { Dirent, FileSystemAdapter } from '@nodelib/fs.scandir'; +import { AsyncCallback } from './providers/async'; +import Settings, { DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction, Options } from './settings'; +import type { Entry } from './types'; +declare function walk(directory: string, callback: AsyncCallback): void; +declare function walk(directory: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; +declare namespace walk { + function __promisify__(directory: string, optionsOrSettings?: Options | Settings): Promise; +} +declare function walkSync(directory: string, optionsOrSettings?: Options | Settings): Entry[]; +declare function walkStream(directory: string, optionsOrSettings?: Options | Settings): Readable; +export { walk, walkSync, walkStream, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, Options, DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction }; diff --git a/node_modules/@nodelib/fs.walk/out/index.js b/node_modules/@nodelib/fs.walk/out/index.js new file mode 100644 index 00000000..15207874 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/index.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0; +const async_1 = require("./providers/async"); +const stream_1 = require("./providers/stream"); +const sync_1 = require("./providers/sync"); +const settings_1 = require("./settings"); +exports.Settings = settings_1.default; +function walk(directory, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); + return; + } + new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); +} +exports.walk = walk; +function walkSync(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new sync_1.default(directory, settings); + return provider.read(); +} +exports.walkSync = walkSync; +function walkStream(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new stream_1.default(directory, settings); + return provider.read(); +} +exports.walkStream = walkStream; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); +} diff --git a/node_modules/@nodelib/fs.walk/out/providers/async.d.ts b/node_modules/@nodelib/fs.walk/out/providers/async.d.ts new file mode 100644 index 00000000..0f6717d7 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/async.d.ts @@ -0,0 +1,12 @@ +import AsyncReader from '../readers/async'; +import type Settings from '../settings'; +import type { Entry, Errno } from '../types'; +export declare type AsyncCallback = (error: Errno, entries: Entry[]) => void; +export default class AsyncProvider { + private readonly _root; + private readonly _settings; + protected readonly _reader: AsyncReader; + private readonly _storage; + constructor(_root: string, _settings: Settings); + read(callback: AsyncCallback): void; +} diff --git a/node_modules/@nodelib/fs.walk/out/providers/async.js b/node_modules/@nodelib/fs.walk/out/providers/async.js new file mode 100644 index 00000000..51d3be51 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/async.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const async_1 = require("../readers/async"); +class AsyncProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async_1.default(this._root, this._settings); + this._storage = []; + } + read(callback) { + this._reader.onError((error) => { + callFailureCallback(callback, error); + }); + this._reader.onEntry((entry) => { + this._storage.push(entry); + }); + this._reader.onEnd(() => { + callSuccessCallback(callback, this._storage); + }); + this._reader.read(); + } +} +exports.default = AsyncProvider; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, entries) { + callback(null, entries); +} diff --git a/node_modules/@nodelib/fs.walk/out/providers/index.d.ts b/node_modules/@nodelib/fs.walk/out/providers/index.d.ts new file mode 100644 index 00000000..874f60c5 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/index.d.ts @@ -0,0 +1,4 @@ +import AsyncProvider from './async'; +import StreamProvider from './stream'; +import SyncProvider from './sync'; +export { AsyncProvider, StreamProvider, SyncProvider }; diff --git a/node_modules/@nodelib/fs.walk/out/providers/index.js b/node_modules/@nodelib/fs.walk/out/providers/index.js new file mode 100644 index 00000000..4c2529ce --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/index.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SyncProvider = exports.StreamProvider = exports.AsyncProvider = void 0; +const async_1 = require("./async"); +exports.AsyncProvider = async_1.default; +const stream_1 = require("./stream"); +exports.StreamProvider = stream_1.default; +const sync_1 = require("./sync"); +exports.SyncProvider = sync_1.default; diff --git a/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts b/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts new file mode 100644 index 00000000..294185f8 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts @@ -0,0 +1,12 @@ +/// +import { Readable } from 'stream'; +import AsyncReader from '../readers/async'; +import type Settings from '../settings'; +export default class StreamProvider { + private readonly _root; + private readonly _settings; + protected readonly _reader: AsyncReader; + protected readonly _stream: Readable; + constructor(_root: string, _settings: Settings); + read(): Readable; +} diff --git a/node_modules/@nodelib/fs.walk/out/providers/stream.js b/node_modules/@nodelib/fs.walk/out/providers/stream.js new file mode 100644 index 00000000..51298b0f --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/stream.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = require("stream"); +const async_1 = require("../readers/async"); +class StreamProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async_1.default(this._root, this._settings); + this._stream = new stream_1.Readable({ + objectMode: true, + read: () => { }, + destroy: () => { + if (!this._reader.isDestroyed) { + this._reader.destroy(); + } + } + }); + } + read() { + this._reader.onError((error) => { + this._stream.emit('error', error); + }); + this._reader.onEntry((entry) => { + this._stream.push(entry); + }); + this._reader.onEnd(() => { + this._stream.push(null); + }); + this._reader.read(); + return this._stream; + } +} +exports.default = StreamProvider; diff --git a/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts b/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts new file mode 100644 index 00000000..551c42e4 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts @@ -0,0 +1,10 @@ +import SyncReader from '../readers/sync'; +import type Settings from '../settings'; +import type { Entry } from '../types'; +export default class SyncProvider { + private readonly _root; + private readonly _settings; + protected readonly _reader: SyncReader; + constructor(_root: string, _settings: Settings); + read(): Entry[]; +} diff --git a/node_modules/@nodelib/fs.walk/out/providers/sync.js b/node_modules/@nodelib/fs.walk/out/providers/sync.js new file mode 100644 index 00000000..faab6ca2 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/sync.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sync_1 = require("../readers/sync"); +class SyncProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new sync_1.default(this._root, this._settings); + } + read() { + return this._reader.read(); + } +} +exports.default = SyncProvider; diff --git a/node_modules/@nodelib/fs.walk/out/readers/async.d.ts b/node_modules/@nodelib/fs.walk/out/readers/async.d.ts new file mode 100644 index 00000000..9acf4e6c --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/async.d.ts @@ -0,0 +1,30 @@ +/// +import { EventEmitter } from 'events'; +import * as fsScandir from '@nodelib/fs.scandir'; +import type Settings from '../settings'; +import type { Entry, Errno } from '../types'; +import Reader from './reader'; +declare type EntryEventCallback = (entry: Entry) => void; +declare type ErrorEventCallback = (error: Errno) => void; +declare type EndEventCallback = () => void; +export default class AsyncReader extends Reader { + protected readonly _settings: Settings; + protected readonly _scandir: typeof fsScandir.scandir; + protected readonly _emitter: EventEmitter; + private readonly _queue; + private _isFatalError; + private _isDestroyed; + constructor(_root: string, _settings: Settings); + read(): EventEmitter; + get isDestroyed(): boolean; + destroy(): void; + onEntry(callback: EntryEventCallback): void; + onError(callback: ErrorEventCallback): void; + onEnd(callback: EndEventCallback): void; + private _pushToQueue; + private _worker; + private _handleError; + private _handleEntry; + private _emitEntry; +} +export {}; diff --git a/node_modules/@nodelib/fs.walk/out/readers/async.js b/node_modules/@nodelib/fs.walk/out/readers/async.js new file mode 100644 index 00000000..ebe8dd57 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/async.js @@ -0,0 +1,97 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events_1 = require("events"); +const fsScandir = require("@nodelib/fs.scandir"); +const fastq = require("fastq"); +const common = require("./common"); +const reader_1 = require("./reader"); +class AsyncReader extends reader_1.default { + constructor(_root, _settings) { + super(_root, _settings); + this._settings = _settings; + this._scandir = fsScandir.scandir; + this._emitter = new events_1.EventEmitter(); + this._queue = fastq(this._worker.bind(this), this._settings.concurrency); + this._isFatalError = false; + this._isDestroyed = false; + this._queue.drain = () => { + if (!this._isFatalError) { + this._emitter.emit('end'); + } + }; + } + read() { + this._isFatalError = false; + this._isDestroyed = false; + setImmediate(() => { + this._pushToQueue(this._root, this._settings.basePath); + }); + return this._emitter; + } + get isDestroyed() { + return this._isDestroyed; + } + destroy() { + if (this._isDestroyed) { + throw new Error('The reader is already destroyed'); + } + this._isDestroyed = true; + this._queue.killAndDrain(); + } + onEntry(callback) { + this._emitter.on('entry', callback); + } + onError(callback) { + this._emitter.once('error', callback); + } + onEnd(callback) { + this._emitter.once('end', callback); + } + _pushToQueue(directory, base) { + const queueItem = { directory, base }; + this._queue.push(queueItem, (error) => { + if (error !== null) { + this._handleError(error); + } + }); + } + _worker(item, done) { + this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { + if (error !== null) { + done(error, undefined); + return; + } + for (const entry of entries) { + this._handleEntry(entry, item.base); + } + done(null, undefined); + }); + } + _handleError(error) { + if (this._isDestroyed || !common.isFatalError(this._settings, error)) { + return; + } + this._isFatalError = true; + this._isDestroyed = true; + this._emitter.emit('error', error); + } + _handleEntry(entry, base) { + if (this._isDestroyed || this._isFatalError) { + return; + } + const fullpath = entry.path; + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._emitEntry(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); + } + } + _emitEntry(entry) { + this._emitter.emit('entry', entry); + } +} +exports.default = AsyncReader; diff --git a/node_modules/@nodelib/fs.walk/out/readers/common.d.ts b/node_modules/@nodelib/fs.walk/out/readers/common.d.ts new file mode 100644 index 00000000..5985f97c --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/common.d.ts @@ -0,0 +1,7 @@ +import type { FilterFunction } from '../settings'; +import type Settings from '../settings'; +import type { Errno } from '../types'; +export declare function isFatalError(settings: Settings, error: Errno): boolean; +export declare function isAppliedFilter(filter: FilterFunction | null, value: T): boolean; +export declare function replacePathSegmentSeparator(filepath: string, separator: string): string; +export declare function joinPathSegments(a: string, b: string, separator: string): string; diff --git a/node_modules/@nodelib/fs.walk/out/readers/common.js b/node_modules/@nodelib/fs.walk/out/readers/common.js new file mode 100644 index 00000000..a93572f4 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/common.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; +function isFatalError(settings, error) { + if (settings.errorFilter === null) { + return true; + } + return !settings.errorFilter(error); +} +exports.isFatalError = isFatalError; +function isAppliedFilter(filter, value) { + return filter === null || filter(value); +} +exports.isAppliedFilter = isAppliedFilter; +function replacePathSegmentSeparator(filepath, separator) { + return filepath.split(/[/\\]/).join(separator); +} +exports.replacePathSegmentSeparator = replacePathSegmentSeparator; +function joinPathSegments(a, b, separator) { + if (a === '') { + return b; + } + /** + * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + */ + if (a.endsWith(separator)) { + return a + b; + } + return a + separator + b; +} +exports.joinPathSegments = joinPathSegments; diff --git a/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts b/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts new file mode 100644 index 00000000..e1f383b2 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts @@ -0,0 +1,6 @@ +import type Settings from '../settings'; +export default class Reader { + protected readonly _root: string; + protected readonly _settings: Settings; + constructor(_root: string, _settings: Settings); +} diff --git a/node_modules/@nodelib/fs.walk/out/readers/reader.js b/node_modules/@nodelib/fs.walk/out/readers/reader.js new file mode 100644 index 00000000..782f07cb --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/reader.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const common = require("./common"); +class Reader { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); + } +} +exports.default = Reader; diff --git a/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts b/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts new file mode 100644 index 00000000..af410335 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts @@ -0,0 +1,15 @@ +import * as fsScandir from '@nodelib/fs.scandir'; +import type { Entry } from '../types'; +import Reader from './reader'; +export default class SyncReader extends Reader { + protected readonly _scandir: typeof fsScandir.scandirSync; + private readonly _storage; + private readonly _queue; + read(): Entry[]; + private _pushToQueue; + private _handleQueue; + private _handleDirectory; + private _handleError; + private _handleEntry; + private _pushToStorage; +} diff --git a/node_modules/@nodelib/fs.walk/out/readers/sync.js b/node_modules/@nodelib/fs.walk/out/readers/sync.js new file mode 100644 index 00000000..9a8d5a6f --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/sync.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const fsScandir = require("@nodelib/fs.scandir"); +const common = require("./common"); +const reader_1 = require("./reader"); +class SyncReader extends reader_1.default { + constructor() { + super(...arguments); + this._scandir = fsScandir.scandirSync; + this._storage = []; + this._queue = new Set(); + } + read() { + this._pushToQueue(this._root, this._settings.basePath); + this._handleQueue(); + return this._storage; + } + _pushToQueue(directory, base) { + this._queue.add({ directory, base }); + } + _handleQueue() { + for (const item of this._queue.values()) { + this._handleDirectory(item.directory, item.base); + } + } + _handleDirectory(directory, base) { + try { + const entries = this._scandir(directory, this._settings.fsScandirSettings); + for (const entry of entries) { + this._handleEntry(entry, base); + } + } + catch (error) { + this._handleError(error); + } + } + _handleError(error) { + if (!common.isFatalError(this._settings, error)) { + return; + } + throw error; + } + _handleEntry(entry, base) { + const fullpath = entry.path; + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._pushToStorage(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); + } + } + _pushToStorage(entry) { + this._storage.push(entry); + } +} +exports.default = SyncReader; diff --git a/node_modules/@nodelib/fs.walk/out/settings.d.ts b/node_modules/@nodelib/fs.walk/out/settings.d.ts new file mode 100644 index 00000000..d1c4b45f --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/settings.d.ts @@ -0,0 +1,30 @@ +import * as fsScandir from '@nodelib/fs.scandir'; +import type { Entry, Errno } from './types'; +export declare type FilterFunction = (value: T) => boolean; +export declare type DeepFilterFunction = FilterFunction; +export declare type EntryFilterFunction = FilterFunction; +export declare type ErrorFilterFunction = FilterFunction; +export interface Options { + basePath?: string; + concurrency?: number; + deepFilter?: DeepFilterFunction; + entryFilter?: EntryFilterFunction; + errorFilter?: ErrorFilterFunction; + followSymbolicLinks?: boolean; + fs?: Partial; + pathSegmentSeparator?: string; + stats?: boolean; + throwErrorOnBrokenSymbolicLink?: boolean; +} +export default class Settings { + private readonly _options; + readonly basePath?: string; + readonly concurrency: number; + readonly deepFilter: DeepFilterFunction | null; + readonly entryFilter: EntryFilterFunction | null; + readonly errorFilter: ErrorFilterFunction | null; + readonly pathSegmentSeparator: string; + readonly fsScandirSettings: fsScandir.Settings; + constructor(_options?: Options); + private _getValue; +} diff --git a/node_modules/@nodelib/fs.walk/out/settings.js b/node_modules/@nodelib/fs.walk/out/settings.js new file mode 100644 index 00000000..d7a85c81 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/settings.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const fsScandir = require("@nodelib/fs.scandir"); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.basePath = this._getValue(this._options.basePath, undefined); + this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY); + this.deepFilter = this._getValue(this._options.deepFilter, null); + this.entryFilter = this._getValue(this._options.entryFilter, null); + this.errorFilter = this._getValue(this._options.errorFilter, null); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.fsScandirSettings = new fsScandir.Settings({ + followSymbolicLinks: this._options.followSymbolicLinks, + fs: this._options.fs, + pathSegmentSeparator: this._options.pathSegmentSeparator, + stats: this._options.stats, + throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } +} +exports.default = Settings; diff --git a/node_modules/@nodelib/fs.walk/out/types/index.d.ts b/node_modules/@nodelib/fs.walk/out/types/index.d.ts new file mode 100644 index 00000000..6ee9bd3f --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/types/index.d.ts @@ -0,0 +1,8 @@ +/// +import type * as scandir from '@nodelib/fs.scandir'; +export declare type Entry = scandir.Entry; +export declare type Errno = NodeJS.ErrnoException; +export interface QueueItem { + directory: string; + base?: string; +} diff --git a/node_modules/@nodelib/fs.walk/out/types/index.js b/node_modules/@nodelib/fs.walk/out/types/index.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/types/index.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/@nodelib/fs.walk/package.json b/node_modules/@nodelib/fs.walk/package.json new file mode 100644 index 00000000..86bfce48 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/package.json @@ -0,0 +1,44 @@ +{ + "name": "@nodelib/fs.walk", + "version": "1.2.8", + "description": "A library for efficiently walking a directory recursively", + "license": "MIT", + "repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.walk", + "keywords": [ + "NodeLib", + "fs", + "FileSystem", + "file system", + "walk", + "scanner", + "crawler" + ], + "engines": { + "node": ">= 8" + }, + "files": [ + "out/**", + "!out/**/*.map", + "!out/**/*.spec.*", + "!out/**/tests/**" + ], + "main": "out/index.js", + "typings": "out/index.d.ts", + "scripts": { + "clean": "rimraf {tsconfig.tsbuildinfo,out}", + "lint": "eslint \"src/**/*.ts\" --cache", + "compile": "tsc -b .", + "compile:watch": "tsc -p . --watch --sourceMap", + "test": "mocha \"out/**/*.spec.js\" -s 0", + "build": "npm run clean && npm run compile && npm run lint && npm test", + "watch": "npm run clean && npm run compile:watch" + }, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "devDependencies": { + "@nodelib/fs.macchiato": "1.0.4" + }, + "gitHead": "1e5bad48565da2b06b8600e744324ea240bf49d8" +} diff --git a/node_modules/@pkgjs/parseargs/.editorconfig b/node_modules/@pkgjs/parseargs/.editorconfig new file mode 100644 index 00000000..b1401639 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/.editorconfig @@ -0,0 +1,14 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Copied from Node.js to ease compatibility in PR. +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +quote_type = single diff --git a/node_modules/@pkgjs/parseargs/CHANGELOG.md b/node_modules/@pkgjs/parseargs/CHANGELOG.md new file mode 100644 index 00000000..2adc7d32 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/CHANGELOG.md @@ -0,0 +1,147 @@ +# Changelog + +## [0.11.0](https://github.com/pkgjs/parseargs/compare/v0.10.0...v0.11.0) (2022-10-08) + + +### Features + +* add `default` option parameter ([#142](https://github.com/pkgjs/parseargs/issues/142)) ([cd20847](https://github.com/pkgjs/parseargs/commit/cd20847a00b2f556aa9c085ac83b942c60868ec1)) + +## [0.10.0](https://github.com/pkgjs/parseargs/compare/v0.9.1...v0.10.0) (2022-07-21) + + +### Features + +* add parsed meta-data to returned properties ([#129](https://github.com/pkgjs/parseargs/issues/129)) ([91bfb4d](https://github.com/pkgjs/parseargs/commit/91bfb4d3f7b6937efab1b27c91c45d1205f1497e)) + +## [0.9.1](https://github.com/pkgjs/parseargs/compare/v0.9.0...v0.9.1) (2022-06-20) + + +### Bug Fixes + +* **runtime:** support node 14+ ([#135](https://github.com/pkgjs/parseargs/issues/135)) ([6a1c5a6](https://github.com/pkgjs/parseargs/commit/6a1c5a6f7cadf2f035e004027e2742e3c4ce554b)) + +## [0.9.0](https://github.com/pkgjs/parseargs/compare/v0.8.0...v0.9.0) (2022-05-23) + + +### ⚠ BREAKING CHANGES + +* drop handling of electron arguments (#121) + +### Code Refactoring + +* drop handling of electron arguments ([#121](https://github.com/pkgjs/parseargs/issues/121)) ([a2ffd53](https://github.com/pkgjs/parseargs/commit/a2ffd537c244a062371522b955acb45a404fc9f2)) + +## [0.8.0](https://github.com/pkgjs/parseargs/compare/v0.7.1...v0.8.0) (2022-05-16) + + +### ⚠ BREAKING CHANGES + +* switch type:string option arguments to greedy, but with error for suspect cases in strict mode (#88) +* positionals now opt-in when strict:true (#116) +* create result.values with null prototype (#111) + +### Features + +* create result.values with null prototype ([#111](https://github.com/pkgjs/parseargs/issues/111)) ([9d539c3](https://github.com/pkgjs/parseargs/commit/9d539c3d57f269c160e74e0656ad4fa84ff92ec2)) +* positionals now opt-in when strict:true ([#116](https://github.com/pkgjs/parseargs/issues/116)) ([3643338](https://github.com/pkgjs/parseargs/commit/364333826b746e8a7dc5505b4b22fd19ac51df3b)) +* switch type:string option arguments to greedy, but with error for suspect cases in strict mode ([#88](https://github.com/pkgjs/parseargs/issues/88)) ([c2b5e72](https://github.com/pkgjs/parseargs/commit/c2b5e72161991dfdc535909f1327cc9b970fe7e8)) + +### [0.7.1](https://github.com/pkgjs/parseargs/compare/v0.7.0...v0.7.1) (2022-04-15) + + +### Bug Fixes + +* resist pollution ([#106](https://github.com/pkgjs/parseargs/issues/106)) ([ecf2dec](https://github.com/pkgjs/parseargs/commit/ecf2dece0a9f2a76d789384d5d71c68ffe64022a)) + +## [0.7.0](https://github.com/pkgjs/parseargs/compare/v0.6.0...v0.7.0) (2022-04-13) + + +### Features + +* Add strict mode to parser ([#74](https://github.com/pkgjs/parseargs/issues/74)) ([8267d02](https://github.com/pkgjs/parseargs/commit/8267d02083a87b8b8a71fcce08348d1e031ea91c)) + +## [0.6.0](https://github.com/pkgjs/parseargs/compare/v0.5.0...v0.6.0) (2022-04-11) + + +### ⚠ BREAKING CHANGES + +* rework results to remove redundant `flags` property and store value true for boolean options (#83) +* switch to existing ERR_INVALID_ARG_VALUE (#97) + +### Code Refactoring + +* rework results to remove redundant `flags` property and store value true for boolean options ([#83](https://github.com/pkgjs/parseargs/issues/83)) ([be153db](https://github.com/pkgjs/parseargs/commit/be153dbed1d488cb7b6e27df92f601ba7337713d)) +* switch to existing ERR_INVALID_ARG_VALUE ([#97](https://github.com/pkgjs/parseargs/issues/97)) ([084a23f](https://github.com/pkgjs/parseargs/commit/084a23f9fde2da030b159edb1c2385f24579ce40)) + +## [0.5.0](https://github.com/pkgjs/parseargs/compare/v0.4.0...v0.5.0) (2022-04-10) + + +### ⚠ BREAKING CHANGES + +* Require type to be specified for each supplied option (#95) + +### Features + +* Require type to be specified for each supplied option ([#95](https://github.com/pkgjs/parseargs/issues/95)) ([02cd018](https://github.com/pkgjs/parseargs/commit/02cd01885b8aaa59f2db8308f2d4479e64340068)) + +## [0.4.0](https://github.com/pkgjs/parseargs/compare/v0.3.0...v0.4.0) (2022-03-12) + + +### ⚠ BREAKING CHANGES + +* parsing, revisit short option groups, add support for combined short and value (#75) +* restructure configuration to take options bag (#63) + +### Code Refactoring + +* parsing, revisit short option groups, add support for combined short and value ([#75](https://github.com/pkgjs/parseargs/issues/75)) ([a92600f](https://github.com/pkgjs/parseargs/commit/a92600fa6c214508ab1e016fa55879a314f541af)) +* restructure configuration to take options bag ([#63](https://github.com/pkgjs/parseargs/issues/63)) ([b412095](https://github.com/pkgjs/parseargs/commit/b4120957d90e809ee8b607b06e747d3e6a6b213e)) + +## [0.3.0](https://github.com/pkgjs/parseargs/compare/v0.2.0...v0.3.0) (2022-02-06) + + +### Features + +* **parser:** support short-option groups ([#59](https://github.com/pkgjs/parseargs/issues/59)) ([882067b](https://github.com/pkgjs/parseargs/commit/882067bc2d7cbc6b796f8e5a079a99bc99d4e6ba)) + +## [0.2.0](https://github.com/pkgjs/parseargs/compare/v0.1.1...v0.2.0) (2022-02-05) + + +### Features + +* basic support for shorts ([#50](https://github.com/pkgjs/parseargs/issues/50)) ([a2f36d7](https://github.com/pkgjs/parseargs/commit/a2f36d7da4145af1c92f76806b7fe2baf6beeceb)) + + +### Bug Fixes + +* always store value for a=b ([#43](https://github.com/pkgjs/parseargs/issues/43)) ([a85e8dc](https://github.com/pkgjs/parseargs/commit/a85e8dc06379fd2696ee195cc625de8fac6aee42)) +* support single dash as positional ([#49](https://github.com/pkgjs/parseargs/issues/49)) ([d795bf8](https://github.com/pkgjs/parseargs/commit/d795bf877d068fd67aec381f30b30b63f97109ad)) + +### [0.1.1](https://github.com/pkgjs/parseargs/compare/v0.1.0...v0.1.1) (2022-01-25) + + +### Bug Fixes + +* only use arrays in results for multiples ([#42](https://github.com/pkgjs/parseargs/issues/42)) ([c357584](https://github.com/pkgjs/parseargs/commit/c357584847912506319ed34a0840080116f4fd65)) + +## 0.1.0 (2022-01-22) + + +### Features + +* expand scenarios covered by default arguments for environments ([#20](https://github.com/pkgjs/parseargs/issues/20)) ([582ada7](https://github.com/pkgjs/parseargs/commit/582ada7be0eca3a73d6e0bd016e7ace43449fa4c)) +* update readme and include contributing guidelines ([8edd6fc](https://github.com/pkgjs/parseargs/commit/8edd6fc863cd705f6fac732724159ebe8065a2b0)) + + +### Bug Fixes + +* do not strip excess leading dashes on long option names ([#21](https://github.com/pkgjs/parseargs/issues/21)) ([f848590](https://github.com/pkgjs/parseargs/commit/f848590ebf3249ed5979ff47e003fa6e1a8ec5c0)) +* name & readme ([3f057c1](https://github.com/pkgjs/parseargs/commit/3f057c1b158a1bdbe878c64b57460c58e56e465f)) +* package.json values ([9bac300](https://github.com/pkgjs/parseargs/commit/9bac300e00cd76c77076bf9e75e44f8929512da9)) +* update readme name ([957d8d9](https://github.com/pkgjs/parseargs/commit/957d8d96e1dcb48297c0a14345d44c0123b2883e)) + + +### Build System + +* first release as minor ([421c6e2](https://github.com/pkgjs/parseargs/commit/421c6e2569a8668ad14fac5a5af5be60479a7571)) diff --git a/node_modules/@pkgjs/parseargs/LICENSE b/node_modules/@pkgjs/parseargs/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/node_modules/@pkgjs/parseargs/LICENSE @@ -0,0 +1,201 @@ + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/node_modules/@pkgjs/parseargs/README.md b/node_modules/@pkgjs/parseargs/README.md new file mode 100644 index 00000000..0a041927 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/README.md @@ -0,0 +1,413 @@ + +# parseArgs + +[![Coverage][coverage-image]][coverage-url] + +Polyfill of `util.parseArgs()` + +## `util.parseArgs([config])` + + + +> Stability: 1 - Experimental + +* `config` {Object} Used to provide arguments for parsing and to configure + the parser. `config` supports the following properties: + * `args` {string\[]} array of argument strings. **Default:** `process.argv` + with `execPath` and `filename` removed. + * `options` {Object} Used to describe arguments known to the parser. + Keys of `options` are the long names of options and values are an + {Object} accepting the following properties: + * `type` {string} Type of argument, which must be either `boolean` or `string`. + * `multiple` {boolean} Whether this option can be provided multiple + times. If `true`, all values will be collected in an array. If + `false`, values for the option are last-wins. **Default:** `false`. + * `short` {string} A single character alias for the option. + * `default` {string | boolean | string\[] | boolean\[]} The default option + value when it is not set by args. It must be of the same type as the + the `type` property. When `multiple` is `true`, it must be an array. + * `strict` {boolean} Should an error be thrown when unknown arguments + are encountered, or when arguments are passed that do not match the + `type` configured in `options`. + **Default:** `true`. + * `allowPositionals` {boolean} Whether this command accepts positional + arguments. + **Default:** `false` if `strict` is `true`, otherwise `true`. + * `tokens` {boolean} Return the parsed tokens. This is useful for extending + the built-in behavior, from adding additional checks through to reprocessing + the tokens in different ways. + **Default:** `false`. + +* Returns: {Object} The parsed command line arguments: + * `values` {Object} A mapping of parsed option names with their {string} + or {boolean} values. + * `positionals` {string\[]} Positional arguments. + * `tokens` {Object\[] | undefined} See [parseArgs tokens](#parseargs-tokens) + section. Only returned if `config` includes `tokens: true`. + +Provides a higher level API for command-line argument parsing than interacting +with `process.argv` directly. Takes a specification for the expected arguments +and returns a structured object with the parsed options and positionals. + +```mjs +import { parseArgs } from 'node:util'; +const args = ['-f', '--bar', 'b']; +const options = { + foo: { + type: 'boolean', + short: 'f' + }, + bar: { + type: 'string' + } +}; +const { + values, + positionals +} = parseArgs({ args, options }); +console.log(values, positionals); +// Prints: [Object: null prototype] { foo: true, bar: 'b' } [] +``` + +```cjs +const { parseArgs } = require('node:util'); +const args = ['-f', '--bar', 'b']; +const options = { + foo: { + type: 'boolean', + short: 'f' + }, + bar: { + type: 'string' + } +}; +const { + values, + positionals +} = parseArgs({ args, options }); +console.log(values, positionals); +// Prints: [Object: null prototype] { foo: true, bar: 'b' } [] +``` + +`util.parseArgs` is experimental and behavior may change. Join the +conversation in [pkgjs/parseargs][] to contribute to the design. + +### `parseArgs` `tokens` + +Detailed parse information is available for adding custom behaviours by +specifying `tokens: true` in the configuration. +The returned tokens have properties describing: + +* all tokens + * `kind` {string} One of 'option', 'positional', or 'option-terminator'. + * `index` {number} Index of element in `args` containing token. So the + source argument for a token is `args[token.index]`. +* option tokens + * `name` {string} Long name of option. + * `rawName` {string} How option used in args, like `-f` of `--foo`. + * `value` {string | undefined} Option value specified in args. + Undefined for boolean options. + * `inlineValue` {boolean | undefined} Whether option value specified inline, + like `--foo=bar`. +* positional tokens + * `value` {string} The value of the positional argument in args (i.e. `args[index]`). +* option-terminator token + +The returned tokens are in the order encountered in the input args. Options +that appear more than once in args produce a token for each use. Short option +groups like `-xy` expand to a token for each option. So `-xxx` produces +three tokens. + +For example to use the returned tokens to add support for a negated option +like `--no-color`, the tokens can be reprocessed to change the value stored +for the negated option. + +```mjs +import { parseArgs } from 'node:util'; + +const options = { + 'color': { type: 'boolean' }, + 'no-color': { type: 'boolean' }, + 'logfile': { type: 'string' }, + 'no-logfile': { type: 'boolean' }, +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +// Reprocess the option tokens and overwrite the returned values. +tokens + .filter((token) => token.kind === 'option') + .forEach((token) => { + if (token.name.startsWith('no-')) { + // Store foo:false for --no-foo + const positiveName = token.name.slice(3); + values[positiveName] = false; + delete values[token.name]; + } else { + // Resave value so last one wins if both --foo and --no-foo. + values[token.name] = token.value ?? true; + } + }); + +const color = values.color; +const logfile = values.logfile ?? 'default.log'; + +console.log({ logfile, color }); +``` + +```cjs +const { parseArgs } = require('node:util'); + +const options = { + 'color': { type: 'boolean' }, + 'no-color': { type: 'boolean' }, + 'logfile': { type: 'string' }, + 'no-logfile': { type: 'boolean' }, +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +// Reprocess the option tokens and overwrite the returned values. +tokens + .filter((token) => token.kind === 'option') + .forEach((token) => { + if (token.name.startsWith('no-')) { + // Store foo:false for --no-foo + const positiveName = token.name.slice(3); + values[positiveName] = false; + delete values[token.name]; + } else { + // Resave value so last one wins if both --foo and --no-foo. + values[token.name] = token.value ?? true; + } + }); + +const color = values.color; +const logfile = values.logfile ?? 'default.log'; + +console.log({ logfile, color }); +``` + +Example usage showing negated options, and when an option is used +multiple ways then last one wins. + +```console +$ node negate.js +{ logfile: 'default.log', color: undefined } +$ node negate.js --no-logfile --no-color +{ logfile: false, color: false } +$ node negate.js --logfile=test.log --color +{ logfile: 'test.log', color: true } +$ node negate.js --no-logfile --logfile=test.log --color --no-color +{ logfile: 'test.log', color: false } +``` + +----- + + +## Table of Contents +- [`util.parseArgs([config])`](#utilparseargsconfig) +- [Scope](#scope) +- [Version Matchups](#version-matchups) +- [🚀 Getting Started](#-getting-started) +- [🙌 Contributing](#-contributing) +- [💡 `process.mainArgs` Proposal](#-processmainargs-proposal) + - [Implementation:](#implementation) +- [📃 Examples](#-examples) +- [F.A.Qs](#faqs) +- [Links & Resources](#links--resources) + +----- + +## Scope + +It is already possible to build great arg parsing modules on top of what Node.js provides; the prickly API is abstracted away by these modules. Thus, process.parseArgs() is not necessarily intended for library authors; it is intended for developers of simple CLI tools, ad-hoc scripts, deployed Node.js applications, and learning materials. + +It is exceedingly difficult to provide an API which would both be friendly to these Node.js users while being extensible enough for libraries to build upon. We chose to prioritize these use cases because these are currently not well-served by Node.js' API. + +---- + +## Version Matchups + +| Node.js | @pkgjs/parseArgs | +| -- | -- | +| [v18.3.0](https://nodejs.org/docs/latest-v18.x/api/util.html#utilparseargsconfig) | [v0.9.1](https://github.com/pkgjs/parseargs/tree/v0.9.1#utilparseargsconfig) | +| [v16.17.0](https://nodejs.org/dist/latest-v16.x/docs/api/util.html#utilparseargsconfig), [v18.7.0](https://nodejs.org/docs/latest-v18.x/api/util.html#utilparseargsconfig) | [0.10.0](https://github.com/pkgjs/parseargs/tree/v0.10.0#utilparseargsconfig) | + +---- + +## 🚀 Getting Started + +1. **Install dependencies.** + + ```bash + npm install + ``` + +2. **Open the index.js file and start editing!** + +3. **Test your code by calling parseArgs through our test file** + + ```bash + npm test + ``` + +---- + +## 🙌 Contributing + +Any person who wants to contribute to the initiative is welcome! Please first read the [Contributing Guide](CONTRIBUTING.md) + +Additionally, reading the [`Examples w/ Output`](#-examples-w-output) section of this document will be the best way to familiarize yourself with the target expected behavior for parseArgs() once it is fully implemented. + +This package was implemented using [tape](https://www.npmjs.com/package/tape) as its test harness. + +---- + +## 💡 `process.mainArgs` Proposal + +> Note: This can be moved forward independently of the `util.parseArgs()` proposal/work. + +### Implementation: + +```javascript +process.mainArgs = process.argv.slice(process._exec ? 1 : 2) +``` + +---- + +## 📃 Examples + +```js +const { parseArgs } = require('@pkgjs/parseargs'); +``` + +```js +const { parseArgs } = require('@pkgjs/parseargs'); +// specify the options that may be used +const options = { + foo: { type: 'string'}, + bar: { type: 'boolean' }, +}; +const args = ['--foo=a', '--bar']; +const { values, positionals } = parseArgs({ args, options }); +// values = { foo: 'a', bar: true } +// positionals = [] +``` + +```js +const { parseArgs } = require('@pkgjs/parseargs'); +// type:string & multiple +const options = { + foo: { + type: 'string', + multiple: true, + }, +}; +const args = ['--foo=a', '--foo', 'b']; +const { values, positionals } = parseArgs({ args, options }); +// values = { foo: [ 'a', 'b' ] } +// positionals = [] +``` + +```js +const { parseArgs } = require('@pkgjs/parseargs'); +// shorts +const options = { + foo: { + short: 'f', + type: 'boolean' + }, +}; +const args = ['-f', 'b']; +const { values, positionals } = parseArgs({ args, options, allowPositionals: true }); +// values = { foo: true } +// positionals = ['b'] +``` + +```js +const { parseArgs } = require('@pkgjs/parseargs'); +// unconfigured +const options = {}; +const args = ['-f', '--foo=a', '--bar', 'b']; +const { values, positionals } = parseArgs({ strict: false, args, options, allowPositionals: true }); +// values = { f: true, foo: 'a', bar: true } +// positionals = ['b'] +``` + +---- + +## F.A.Qs + +- Is `cmd --foo=bar baz` the same as `cmd baz --foo=bar`? + - yes +- Does the parser execute a function? + - no +- Does the parser execute one of several functions, depending on input? + - no +- Can subcommands take options that are distinct from the main command? + - no +- Does it output generated help when no options match? + - no +- Does it generated short usage? Like: `usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]` + - no (no usage/help at all) +- Does the user provide the long usage text? For each option? For the whole command? + - no +- Do subcommands (if implemented) have their own usage output? + - no +- Does usage print if the user runs `cmd --help`? + - no +- Does it set `process.exitCode`? + - no +- Does usage print to stderr or stdout? + - N/A +- Does it check types? (Say, specify that an option is a boolean, number, etc.) + - no +- Can an option have more than one type? (string or false, for example) + - no +- Can the user define a type? (Say, `type: path` to call `path.resolve()` on the argument.) + - no +- Does a `--foo=0o22` mean 0, 22, 18, or "0o22"? + - `"0o22"` +- Does it coerce types? + - no +- Does `--no-foo` coerce to `--foo=false`? For all options? Only boolean options? + - no, it sets `{values:{'no-foo': true}}` +- Is `--foo` the same as `--foo=true`? Only for known booleans? Only at the end? + - no, they are not the same. There is no special handling of `true` as a value so it is just another string. +- Does it read environment variables? Ie, is `FOO=1 cmd` the same as `cmd --foo=1`? + - no +- Do unknown arguments raise an error? Are they parsed? Are they treated as positional arguments? + - no, they are parsed, not treated as positionals +- Does `--` signal the end of options? + - yes +- Is `--` included as a positional? + - no +- Is `program -- foo` the same as `program foo`? + - yes, both store `{positionals:['foo']}` +- Does the API specify whether a `--` was present/relevant? + - no +- Is `-bar` the same as `--bar`? + - no, `-bar` is a short option or options, with expansion logic that follows the + [Utility Syntax Guidelines in POSIX.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html). `-bar` expands to `-b`, `-a`, `-r`. +- Is `---foo` the same as `--foo`? + - no + - the first is a long option named `'-foo'` + - the second is a long option named `'foo'` +- Is `-` a positional? ie, `bash some-test.sh | tap -` + - yes + +## Links & Resources + +* [Initial Tooling Issue](https://github.com/nodejs/tooling/issues/19) +* [Initial Proposal](https://github.com/nodejs/node/pull/35015) +* [parseArgs Proposal](https://github.com/nodejs/node/pull/42675) + +[coverage-image]: https://img.shields.io/nycrc/pkgjs/parseargs +[coverage-url]: https://github.com/pkgjs/parseargs/blob/main/.nycrc +[pkgjs/parseargs]: https://github.com/pkgjs/parseargs diff --git a/node_modules/@pkgjs/parseargs/examples/is-default-value.js b/node_modules/@pkgjs/parseargs/examples/is-default-value.js new file mode 100644 index 00000000..0a67972b --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/is-default-value.js @@ -0,0 +1,25 @@ +'use strict'; + +// This example shows how to understand if a default value is used or not. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + file: { short: 'f', type: 'string', default: 'FOO' }, +}; + +const { values, tokens } = parseArgs({ options, tokens: true }); + +const isFileDefault = !tokens.some((token) => token.kind === 'option' && + token.name === 'file' +); + +console.log(values); +console.log(`Is the file option [${values.file}] the default value? ${isFileDefault}`); + +// Try the following: +// node is-default-value.js +// node is-default-value.js -f FILE +// node is-default-value.js --file FILE diff --git a/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js b/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js new file mode 100644 index 00000000..943e643e --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js @@ -0,0 +1,35 @@ +'use strict'; + +// This is an example of using tokens to add a custom behaviour. +// +// Require the use of `=` for long options and values by blocking +// the use of space separated values. +// So allow `--foo=bar`, and not allow `--foo bar`. +// +// Note: this is not a common behaviour, most CLIs allow both forms. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + file: { short: 'f', type: 'string' }, + log: { type: 'string' }, +}; + +const { values, tokens } = parseArgs({ options, tokens: true }); + +const badToken = tokens.find((token) => token.kind === 'option' && + token.value != null && + token.rawName.startsWith('--') && + !token.inlineValue +); +if (badToken) { + throw new Error(`Option value for '${badToken.rawName}' must be inline, like '${badToken.rawName}=VALUE'`); +} + +console.log(values); + +// Try the following: +// node limit-long-syntax.js -f FILE --log=LOG +// node limit-long-syntax.js --file FILE diff --git a/node_modules/@pkgjs/parseargs/examples/negate.js b/node_modules/@pkgjs/parseargs/examples/negate.js new file mode 100644 index 00000000..b6634690 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/negate.js @@ -0,0 +1,43 @@ +'use strict'; + +// This example is used in the documentation. + +// How might I add my own support for --no-foo? + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + 'color': { type: 'boolean' }, + 'no-color': { type: 'boolean' }, + 'logfile': { type: 'string' }, + 'no-logfile': { type: 'boolean' }, +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +// Reprocess the option tokens and overwrite the returned values. +tokens + .filter((token) => token.kind === 'option') + .forEach((token) => { + if (token.name.startsWith('no-')) { + // Store foo:false for --no-foo + const positiveName = token.name.slice(3); + values[positiveName] = false; + delete values[token.name]; + } else { + // Resave value so last one wins if both --foo and --no-foo. + values[token.name] = token.value ?? true; + } + }); + +const color = values.color; +const logfile = values.logfile ?? 'default.log'; + +console.log({ logfile, color }); + +// Try the following: +// node negate.js +// node negate.js --no-logfile --no-color +// negate.js --logfile=test.log --color +// node negate.js --no-logfile --logfile=test.log --color --no-color diff --git a/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js b/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js new file mode 100644 index 00000000..0c324688 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js @@ -0,0 +1,31 @@ +'use strict'; + +// This is an example of using tokens to add a custom behaviour. +// +// Throw an error if an option is used more than once. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + ding: { type: 'boolean', short: 'd' }, + beep: { type: 'boolean', short: 'b' } +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +const seenBefore = new Set(); +tokens.forEach((token) => { + if (token.kind !== 'option') return; + if (seenBefore.has(token.name)) { + throw new Error(`option '${token.name}' used multiple times`); + } + seenBefore.add(token.name); +}); + +console.log(values); + +// Try the following: +// node no-repeated-options --ding --beep +// node no-repeated-options --beep -b +// node no-repeated-options -ddd diff --git a/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs b/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs new file mode 100644 index 00000000..8ab7367b --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs @@ -0,0 +1,41 @@ +// This is an example of using tokens to add a custom behaviour. +// +// This adds a option order check so that --some-unstable-option +// may only be used after --enable-experimental-options +// +// Note: this is not a common behaviour, the order of different options +// does not usually matter. + +import { parseArgs } from '../index.js'; + +function findTokenIndex(tokens, target) { + return tokens.findIndex((token) => token.kind === 'option' && + token.name === target + ); +} + +const experimentalName = 'enable-experimental-options'; +const unstableName = 'some-unstable-option'; + +const options = { + [experimentalName]: { type: 'boolean' }, + [unstableName]: { type: 'boolean' }, +}; + +const { values, tokens } = parseArgs({ options, tokens: true }); + +const experimentalIndex = findTokenIndex(tokens, experimentalName); +const unstableIndex = findTokenIndex(tokens, unstableName); +if (unstableIndex !== -1 && + ((experimentalIndex === -1) || (unstableIndex < experimentalIndex))) { + throw new Error(`'--${experimentalName}' must be specified before '--${unstableName}'`); +} + +console.log(values); + +/* eslint-disable max-len */ +// Try the following: +// node ordered-options.mjs +// node ordered-options.mjs --some-unstable-option +// node ordered-options.mjs --some-unstable-option --enable-experimental-options +// node ordered-options.mjs --enable-experimental-options --some-unstable-option diff --git a/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js b/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js new file mode 100644 index 00000000..eff04c2a --- /dev/null +++ b/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js @@ -0,0 +1,26 @@ +'use strict'; + +// This example is used in the documentation. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const args = ['-f', '--bar', 'b']; +const options = { + foo: { + type: 'boolean', + short: 'f' + }, + bar: { + type: 'string' + } +}; +const { + values, + positionals +} = parseArgs({ args, options }); +console.log(values, positionals); + +// Try the following: +// node simple-hard-coded.js diff --git a/node_modules/@pkgjs/parseargs/index.js b/node_modules/@pkgjs/parseargs/index.js new file mode 100644 index 00000000..b1004c7b --- /dev/null +++ b/node_modules/@pkgjs/parseargs/index.js @@ -0,0 +1,396 @@ +'use strict'; + +const { + ArrayPrototypeForEach, + ArrayPrototypeIncludes, + ArrayPrototypeMap, + ArrayPrototypePush, + ArrayPrototypePushApply, + ArrayPrototypeShift, + ArrayPrototypeSlice, + ArrayPrototypeUnshiftApply, + ObjectEntries, + ObjectPrototypeHasOwnProperty: ObjectHasOwn, + StringPrototypeCharAt, + StringPrototypeIndexOf, + StringPrototypeSlice, + StringPrototypeStartsWith, +} = require('./internal/primordials'); + +const { + validateArray, + validateBoolean, + validateBooleanArray, + validateObject, + validateString, + validateStringArray, + validateUnion, +} = require('./internal/validators'); + +const { + kEmptyObject, +} = require('./internal/util'); + +const { + findLongOptionForShort, + isLoneLongOption, + isLoneShortOption, + isLongOptionAndValue, + isOptionValue, + isOptionLikeValue, + isShortOptionAndValue, + isShortOptionGroup, + useDefaultValueOption, + objectGetOwn, + optionsGetOwn, +} = require('./utils'); + +const { + codes: { + ERR_INVALID_ARG_VALUE, + ERR_PARSE_ARGS_INVALID_OPTION_VALUE, + ERR_PARSE_ARGS_UNKNOWN_OPTION, + ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL, + }, +} = require('./internal/errors'); + +function getMainArgs() { + // Work out where to slice process.argv for user supplied arguments. + + // Check node options for scenarios where user CLI args follow executable. + const execArgv = process.execArgv; + if (ArrayPrototypeIncludes(execArgv, '-e') || + ArrayPrototypeIncludes(execArgv, '--eval') || + ArrayPrototypeIncludes(execArgv, '-p') || + ArrayPrototypeIncludes(execArgv, '--print')) { + return ArrayPrototypeSlice(process.argv, 1); + } + + // Normally first two arguments are executable and script, then CLI arguments + return ArrayPrototypeSlice(process.argv, 2); +} + +/** + * In strict mode, throw for possible usage errors like --foo --bar + * + * @param {object} token - from tokens as available from parseArgs + */ +function checkOptionLikeValue(token) { + if (!token.inlineValue && isOptionLikeValue(token.value)) { + // Only show short example if user used short option. + const example = StringPrototypeStartsWith(token.rawName, '--') ? + `'${token.rawName}=-XYZ'` : + `'--${token.name}=-XYZ' or '${token.rawName}-XYZ'`; + const errorMessage = `Option '${token.rawName}' argument is ambiguous. +Did you forget to specify the option argument for '${token.rawName}'? +To specify an option argument starting with a dash use ${example}.`; + throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(errorMessage); + } +} + +/** + * In strict mode, throw for usage errors. + * + * @param {object} config - from config passed to parseArgs + * @param {object} token - from tokens as available from parseArgs + */ +function checkOptionUsage(config, token) { + if (!ObjectHasOwn(config.options, token.name)) { + throw new ERR_PARSE_ARGS_UNKNOWN_OPTION( + token.rawName, config.allowPositionals); + } + + const short = optionsGetOwn(config.options, token.name, 'short'); + const shortAndLong = `${short ? `-${short}, ` : ''}--${token.name}`; + const type = optionsGetOwn(config.options, token.name, 'type'); + if (type === 'string' && typeof token.value !== 'string') { + throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(`Option '${shortAndLong} ' argument missing`); + } + // (Idiomatic test for undefined||null, expecting undefined.) + if (type === 'boolean' && token.value != null) { + throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(`Option '${shortAndLong}' does not take an argument`); + } +} + + +/** + * Store the option value in `values`. + * + * @param {string} longOption - long option name e.g. 'foo' + * @param {string|undefined} optionValue - value from user args + * @param {object} options - option configs, from parseArgs({ options }) + * @param {object} values - option values returned in `values` by parseArgs + */ +function storeOption(longOption, optionValue, options, values) { + if (longOption === '__proto__') { + return; // No. Just no. + } + + // We store based on the option value rather than option type, + // preserving the users intent for author to deal with. + const newValue = optionValue ?? true; + if (optionsGetOwn(options, longOption, 'multiple')) { + // Always store value in array, including for boolean. + // values[longOption] starts out not present, + // first value is added as new array [newValue], + // subsequent values are pushed to existing array. + // (note: values has null prototype, so simpler usage) + if (values[longOption]) { + ArrayPrototypePush(values[longOption], newValue); + } else { + values[longOption] = [newValue]; + } + } else { + values[longOption] = newValue; + } +} + +/** + * Store the default option value in `values`. + * + * @param {string} longOption - long option name e.g. 'foo' + * @param {string + * | boolean + * | string[] + * | boolean[]} optionValue - default value from option config + * @param {object} values - option values returned in `values` by parseArgs + */ +function storeDefaultOption(longOption, optionValue, values) { + if (longOption === '__proto__') { + return; // No. Just no. + } + + values[longOption] = optionValue; +} + +/** + * Process args and turn into identified tokens: + * - option (along with value, if any) + * - positional + * - option-terminator + * + * @param {string[]} args - from parseArgs({ args }) or mainArgs + * @param {object} options - option configs, from parseArgs({ options }) + */ +function argsToTokens(args, options) { + const tokens = []; + let index = -1; + let groupCount = 0; + + const remainingArgs = ArrayPrototypeSlice(args); + while (remainingArgs.length > 0) { + const arg = ArrayPrototypeShift(remainingArgs); + const nextArg = remainingArgs[0]; + if (groupCount > 0) + groupCount--; + else + index++; + + // Check if `arg` is an options terminator. + // Guideline 10 in https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html + if (arg === '--') { + // Everything after a bare '--' is considered a positional argument. + ArrayPrototypePush(tokens, { kind: 'option-terminator', index }); + ArrayPrototypePushApply( + tokens, ArrayPrototypeMap(remainingArgs, (arg) => { + return { kind: 'positional', index: ++index, value: arg }; + }) + ); + break; // Finished processing args, leave while loop. + } + + if (isLoneShortOption(arg)) { + // e.g. '-f' + const shortOption = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(shortOption, options); + let value; + let inlineValue; + if (optionsGetOwn(options, longOption, 'type') === 'string' && + isOptionValue(nextArg)) { + // e.g. '-f', 'bar' + value = ArrayPrototypeShift(remainingArgs); + inlineValue = false; + } + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: arg, + index, value, inlineValue }); + if (value != null) ++index; + continue; + } + + if (isShortOptionGroup(arg, options)) { + // Expand -fXzy to -f -X -z -y + const expanded = []; + for (let index = 1; index < arg.length; index++) { + const shortOption = StringPrototypeCharAt(arg, index); + const longOption = findLongOptionForShort(shortOption, options); + if (optionsGetOwn(options, longOption, 'type') !== 'string' || + index === arg.length - 1) { + // Boolean option, or last short in group. Well formed. + ArrayPrototypePush(expanded, `-${shortOption}`); + } else { + // String option in middle. Yuck. + // Expand -abfFILE to -a -b -fFILE + ArrayPrototypePush(expanded, `-${StringPrototypeSlice(arg, index)}`); + break; // finished short group + } + } + ArrayPrototypeUnshiftApply(remainingArgs, expanded); + groupCount = expanded.length; + continue; + } + + if (isShortOptionAndValue(arg, options)) { + // e.g. -fFILE + const shortOption = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(shortOption, options); + const value = StringPrototypeSlice(arg, 2); + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: `-${shortOption}`, + index, value, inlineValue: true }); + continue; + } + + if (isLoneLongOption(arg)) { + // e.g. '--foo' + const longOption = StringPrototypeSlice(arg, 2); + let value; + let inlineValue; + if (optionsGetOwn(options, longOption, 'type') === 'string' && + isOptionValue(nextArg)) { + // e.g. '--foo', 'bar' + value = ArrayPrototypeShift(remainingArgs); + inlineValue = false; + } + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: arg, + index, value, inlineValue }); + if (value != null) ++index; + continue; + } + + if (isLongOptionAndValue(arg)) { + // e.g. --foo=bar + const equalIndex = StringPrototypeIndexOf(arg, '='); + const longOption = StringPrototypeSlice(arg, 2, equalIndex); + const value = StringPrototypeSlice(arg, equalIndex + 1); + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: `--${longOption}`, + index, value, inlineValue: true }); + continue; + } + + ArrayPrototypePush(tokens, { kind: 'positional', index, value: arg }); + } + + return tokens; +} + +const parseArgs = (config = kEmptyObject) => { + const args = objectGetOwn(config, 'args') ?? getMainArgs(); + const strict = objectGetOwn(config, 'strict') ?? true; + const allowPositionals = objectGetOwn(config, 'allowPositionals') ?? !strict; + const returnTokens = objectGetOwn(config, 'tokens') ?? false; + const options = objectGetOwn(config, 'options') ?? { __proto__: null }; + // Bundle these up for passing to strict-mode checks. + const parseConfig = { args, strict, options, allowPositionals }; + + // Validate input configuration. + validateArray(args, 'args'); + validateBoolean(strict, 'strict'); + validateBoolean(allowPositionals, 'allowPositionals'); + validateBoolean(returnTokens, 'tokens'); + validateObject(options, 'options'); + ArrayPrototypeForEach( + ObjectEntries(options), + ({ 0: longOption, 1: optionConfig }) => { + validateObject(optionConfig, `options.${longOption}`); + + // type is required + const optionType = objectGetOwn(optionConfig, 'type'); + validateUnion(optionType, `options.${longOption}.type`, ['string', 'boolean']); + + if (ObjectHasOwn(optionConfig, 'short')) { + const shortOption = optionConfig.short; + validateString(shortOption, `options.${longOption}.short`); + if (shortOption.length !== 1) { + throw new ERR_INVALID_ARG_VALUE( + `options.${longOption}.short`, + shortOption, + 'must be a single character' + ); + } + } + + const multipleOption = objectGetOwn(optionConfig, 'multiple'); + if (ObjectHasOwn(optionConfig, 'multiple')) { + validateBoolean(multipleOption, `options.${longOption}.multiple`); + } + + const defaultValue = objectGetOwn(optionConfig, 'default'); + if (defaultValue !== undefined) { + let validator; + switch (optionType) { + case 'string': + validator = multipleOption ? validateStringArray : validateString; + break; + + case 'boolean': + validator = multipleOption ? validateBooleanArray : validateBoolean; + break; + } + validator(defaultValue, `options.${longOption}.default`); + } + } + ); + + // Phase 1: identify tokens + const tokens = argsToTokens(args, options); + + // Phase 2: process tokens into parsed option values and positionals + const result = { + values: { __proto__: null }, + positionals: [], + }; + if (returnTokens) { + result.tokens = tokens; + } + ArrayPrototypeForEach(tokens, (token) => { + if (token.kind === 'option') { + if (strict) { + checkOptionUsage(parseConfig, token); + checkOptionLikeValue(token); + } + storeOption(token.name, token.value, options, result.values); + } else if (token.kind === 'positional') { + if (!allowPositionals) { + throw new ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL(token.value); + } + ArrayPrototypePush(result.positionals, token.value); + } + }); + + // Phase 3: fill in default values for missing args + ArrayPrototypeForEach(ObjectEntries(options), ({ 0: longOption, + 1: optionConfig }) => { + const mustSetDefault = useDefaultValueOption(longOption, + optionConfig, + result.values); + if (mustSetDefault) { + storeDefaultOption(longOption, + objectGetOwn(optionConfig, 'default'), + result.values); + } + }); + + + return result; +}; + +module.exports = { + parseArgs, +}; diff --git a/node_modules/@pkgjs/parseargs/internal/errors.js b/node_modules/@pkgjs/parseargs/internal/errors.js new file mode 100644 index 00000000..e1b237b5 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/internal/errors.js @@ -0,0 +1,47 @@ +'use strict'; + +class ERR_INVALID_ARG_TYPE extends TypeError { + constructor(name, expected, actual) { + super(`${name} must be ${expected} got ${actual}`); + this.code = 'ERR_INVALID_ARG_TYPE'; + } +} + +class ERR_INVALID_ARG_VALUE extends TypeError { + constructor(arg1, arg2, expected) { + super(`The property ${arg1} ${expected}. Received '${arg2}'`); + this.code = 'ERR_INVALID_ARG_VALUE'; + } +} + +class ERR_PARSE_ARGS_INVALID_OPTION_VALUE extends Error { + constructor(message) { + super(message); + this.code = 'ERR_PARSE_ARGS_INVALID_OPTION_VALUE'; + } +} + +class ERR_PARSE_ARGS_UNKNOWN_OPTION extends Error { + constructor(option, allowPositionals) { + const suggestDashDash = allowPositionals ? `. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- ${JSON.stringify(option)}` : ''; + super(`Unknown option '${option}'${suggestDashDash}`); + this.code = 'ERR_PARSE_ARGS_UNKNOWN_OPTION'; + } +} + +class ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL extends Error { + constructor(positional) { + super(`Unexpected argument '${positional}'. This command does not take positional arguments`); + this.code = 'ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL'; + } +} + +module.exports = { + codes: { + ERR_INVALID_ARG_TYPE, + ERR_INVALID_ARG_VALUE, + ERR_PARSE_ARGS_INVALID_OPTION_VALUE, + ERR_PARSE_ARGS_UNKNOWN_OPTION, + ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL, + } +}; diff --git a/node_modules/@pkgjs/parseargs/internal/primordials.js b/node_modules/@pkgjs/parseargs/internal/primordials.js new file mode 100644 index 00000000..63e23ab1 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/internal/primordials.js @@ -0,0 +1,393 @@ +/* +This file is copied from https://github.com/nodejs/node/blob/v14.19.3/lib/internal/per_context/primordials.js +under the following license: + +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. +*/ + +'use strict'; + +/* eslint-disable node-core/prefer-primordials */ + +// This file subclasses and stores the JS builtins that come from the VM +// so that Node.js's builtin modules do not need to later look these up from +// the global proxy, which can be mutated by users. + +// Use of primordials have sometimes a dramatic impact on performance, please +// benchmark all changes made in performance-sensitive areas of the codebase. +// See: https://github.com/nodejs/node/pull/38248 + +const primordials = {}; + +const { + defineProperty: ReflectDefineProperty, + getOwnPropertyDescriptor: ReflectGetOwnPropertyDescriptor, + ownKeys: ReflectOwnKeys, +} = Reflect; + +// `uncurryThis` is equivalent to `func => Function.prototype.call.bind(func)`. +// It is using `bind.bind(call)` to avoid using `Function.prototype.bind` +// and `Function.prototype.call` after it may have been mutated by users. +const { apply, bind, call } = Function.prototype; +const uncurryThis = bind.bind(call); +primordials.uncurryThis = uncurryThis; + +// `applyBind` is equivalent to `func => Function.prototype.apply.bind(func)`. +// It is using `bind.bind(apply)` to avoid using `Function.prototype.bind` +// and `Function.prototype.apply` after it may have been mutated by users. +const applyBind = bind.bind(apply); +primordials.applyBind = applyBind; + +// Methods that accept a variable number of arguments, and thus it's useful to +// also create `${prefix}${key}Apply`, which uses `Function.prototype.apply`, +// instead of `Function.prototype.call`, and thus doesn't require iterator +// destructuring. +const varargsMethods = [ + // 'ArrayPrototypeConcat' is omitted, because it performs the spread + // on its own for arrays and array-likes with a truthy + // @@isConcatSpreadable symbol property. + 'ArrayOf', + 'ArrayPrototypePush', + 'ArrayPrototypeUnshift', + // 'FunctionPrototypeCall' is omitted, since there's 'ReflectApply' + // and 'FunctionPrototypeApply'. + 'MathHypot', + 'MathMax', + 'MathMin', + 'StringPrototypeConcat', + 'TypedArrayOf', +]; + +function getNewKey(key) { + return typeof key === 'symbol' ? + `Symbol${key.description[7].toUpperCase()}${key.description.slice(8)}` : + `${key[0].toUpperCase()}${key.slice(1)}`; +} + +function copyAccessor(dest, prefix, key, { enumerable, get, set }) { + ReflectDefineProperty(dest, `${prefix}Get${key}`, { + value: uncurryThis(get), + enumerable + }); + if (set !== undefined) { + ReflectDefineProperty(dest, `${prefix}Set${key}`, { + value: uncurryThis(set), + enumerable + }); + } +} + +function copyPropsRenamed(src, dest, prefix) { + for (const key of ReflectOwnKeys(src)) { + const newKey = getNewKey(key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); + if ('get' in desc) { + copyAccessor(dest, prefix, newKey, desc); + } else { + const name = `${prefix}${newKey}`; + ReflectDefineProperty(dest, name, desc); + if (varargsMethods.includes(name)) { + ReflectDefineProperty(dest, `${name}Apply`, { + // `src` is bound as the `this` so that the static `this` points + // to the object it was defined on, + // e.g.: `ArrayOfApply` gets a `this` of `Array`: + value: applyBind(desc.value, src), + }); + } + } + } +} + +function copyPropsRenamedBound(src, dest, prefix) { + for (const key of ReflectOwnKeys(src)) { + const newKey = getNewKey(key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); + if ('get' in desc) { + copyAccessor(dest, prefix, newKey, desc); + } else { + const { value } = desc; + if (typeof value === 'function') { + desc.value = value.bind(src); + } + + const name = `${prefix}${newKey}`; + ReflectDefineProperty(dest, name, desc); + if (varargsMethods.includes(name)) { + ReflectDefineProperty(dest, `${name}Apply`, { + value: applyBind(value, src), + }); + } + } + } +} + +function copyPrototype(src, dest, prefix) { + for (const key of ReflectOwnKeys(src)) { + const newKey = getNewKey(key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); + if ('get' in desc) { + copyAccessor(dest, prefix, newKey, desc); + } else { + const { value } = desc; + if (typeof value === 'function') { + desc.value = uncurryThis(value); + } + + const name = `${prefix}${newKey}`; + ReflectDefineProperty(dest, name, desc); + if (varargsMethods.includes(name)) { + ReflectDefineProperty(dest, `${name}Apply`, { + value: applyBind(value), + }); + } + } + } +} + +// Create copies of configurable value properties of the global object +[ + 'Proxy', + 'globalThis', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + primordials[name] = globalThis[name]; +}); + +// Create copies of URI handling functions +[ + decodeURI, + decodeURIComponent, + encodeURI, + encodeURIComponent, +].forEach((fn) => { + primordials[fn.name] = fn; +}); + +// Create copies of the namespace objects +[ + 'JSON', + 'Math', + 'Proxy', + 'Reflect', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + copyPropsRenamed(global[name], primordials, name); +}); + +// Create copies of intrinsic objects +[ + 'Array', + 'ArrayBuffer', + 'BigInt', + 'BigInt64Array', + 'BigUint64Array', + 'Boolean', + 'DataView', + 'Date', + 'Error', + 'EvalError', + 'Float32Array', + 'Float64Array', + 'Function', + 'Int16Array', + 'Int32Array', + 'Int8Array', + 'Map', + 'Number', + 'Object', + 'RangeError', + 'ReferenceError', + 'RegExp', + 'Set', + 'String', + 'Symbol', + 'SyntaxError', + 'TypeError', + 'URIError', + 'Uint16Array', + 'Uint32Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'WeakMap', + 'WeakSet', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + const original = global[name]; + primordials[name] = original; + copyPropsRenamed(original, primordials, name); + copyPrototype(original.prototype, primordials, `${name}Prototype`); +}); + +// Create copies of intrinsic objects that require a valid `this` to call +// static methods. +// Refs: https://www.ecma-international.org/ecma-262/#sec-promise.all +[ + 'Promise', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + const original = global[name]; + primordials[name] = original; + copyPropsRenamedBound(original, primordials, name); + copyPrototype(original.prototype, primordials, `${name}Prototype`); +}); + +// Create copies of abstract intrinsic objects that are not directly exposed +// on the global object. +// Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object +[ + { name: 'TypedArray', original: Reflect.getPrototypeOf(Uint8Array) }, + { name: 'ArrayIterator', original: { + prototype: Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()), + } }, + { name: 'StringIterator', original: { + prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()), + } }, +].forEach(({ name, original }) => { + primordials[name] = original; + // The static %TypedArray% methods require a valid `this`, but can't be bound, + // as they need a subclass constructor as the receiver: + copyPrototype(original, primordials, name); + copyPrototype(original.prototype, primordials, `${name}Prototype`); +}); + +/* eslint-enable node-core/prefer-primordials */ + +const { + ArrayPrototypeForEach, + FunctionPrototypeCall, + Map, + ObjectFreeze, + ObjectSetPrototypeOf, + Set, + SymbolIterator, + WeakMap, + WeakSet, +} = primordials; + +// Because these functions are used by `makeSafe`, which is exposed +// on the `primordials` object, it's important to use const references +// to the primordials that they use: +const createSafeIterator = (factory, next) => { + class SafeIterator { + constructor(iterable) { + this._iterator = factory(iterable); + } + next() { + return next(this._iterator); + } + [SymbolIterator]() { + return this; + } + } + ObjectSetPrototypeOf(SafeIterator.prototype, null); + ObjectFreeze(SafeIterator.prototype); + ObjectFreeze(SafeIterator); + return SafeIterator; +}; + +primordials.SafeArrayIterator = createSafeIterator( + primordials.ArrayPrototypeSymbolIterator, + primordials.ArrayIteratorPrototypeNext +); +primordials.SafeStringIterator = createSafeIterator( + primordials.StringPrototypeSymbolIterator, + primordials.StringIteratorPrototypeNext +); + +const copyProps = (src, dest) => { + ArrayPrototypeForEach(ReflectOwnKeys(src), (key) => { + if (!ReflectGetOwnPropertyDescriptor(dest, key)) { + ReflectDefineProperty( + dest, + key, + ReflectGetOwnPropertyDescriptor(src, key)); + } + }); +}; + +const makeSafe = (unsafe, safe) => { + if (SymbolIterator in unsafe.prototype) { + const dummy = new unsafe(); + let next; // We can reuse the same `next` method. + + ArrayPrototypeForEach(ReflectOwnKeys(unsafe.prototype), (key) => { + if (!ReflectGetOwnPropertyDescriptor(safe.prototype, key)) { + const desc = ReflectGetOwnPropertyDescriptor(unsafe.prototype, key); + if ( + typeof desc.value === 'function' && + desc.value.length === 0 && + SymbolIterator in (FunctionPrototypeCall(desc.value, dummy) ?? {}) + ) { + const createIterator = uncurryThis(desc.value); + next = next ?? uncurryThis(createIterator(dummy).next); + const SafeIterator = createSafeIterator(createIterator, next); + desc.value = function() { + return new SafeIterator(this); + }; + } + ReflectDefineProperty(safe.prototype, key, desc); + } + }); + } else { + copyProps(unsafe.prototype, safe.prototype); + } + copyProps(unsafe, safe); + + ObjectSetPrototypeOf(safe.prototype, null); + ObjectFreeze(safe.prototype); + ObjectFreeze(safe); + return safe; +}; +primordials.makeSafe = makeSafe; + +// Subclass the constructors because we need to use their prototype +// methods later. +// Defining the `constructor` is necessary here to avoid the default +// constructor which uses the user-mutable `%ArrayIteratorPrototype%.next`. +primordials.SafeMap = makeSafe( + Map, + class SafeMap extends Map { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeWeakMap = makeSafe( + WeakMap, + class SafeWeakMap extends WeakMap { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeSet = makeSafe( + Set, + class SafeSet extends Set { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeWeakSet = makeSafe( + WeakSet, + class SafeWeakSet extends WeakSet { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); + +ObjectSetPrototypeOf(primordials, null); +ObjectFreeze(primordials); + +module.exports = primordials; diff --git a/node_modules/@pkgjs/parseargs/internal/util.js b/node_modules/@pkgjs/parseargs/internal/util.js new file mode 100644 index 00000000..b9b8fe5b --- /dev/null +++ b/node_modules/@pkgjs/parseargs/internal/util.js @@ -0,0 +1,14 @@ +'use strict'; + +// This is a placeholder for util.js in node.js land. + +const { + ObjectCreate, + ObjectFreeze, +} = require('./primordials'); + +const kEmptyObject = ObjectFreeze(ObjectCreate(null)); + +module.exports = { + kEmptyObject, +}; diff --git a/node_modules/@pkgjs/parseargs/internal/validators.js b/node_modules/@pkgjs/parseargs/internal/validators.js new file mode 100644 index 00000000..b5ac4fb5 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/internal/validators.js @@ -0,0 +1,89 @@ +'use strict'; + +// This file is a proxy of the original file located at: +// https://github.com/nodejs/node/blob/main/lib/internal/validators.js +// Every addition or modification to this file must be evaluated +// during the PR review. + +const { + ArrayIsArray, + ArrayPrototypeIncludes, + ArrayPrototypeJoin, +} = require('./primordials'); + +const { + codes: { + ERR_INVALID_ARG_TYPE + } +} = require('./errors'); + +function validateString(value, name) { + if (typeof value !== 'string') { + throw new ERR_INVALID_ARG_TYPE(name, 'String', value); + } +} + +function validateUnion(value, name, union) { + if (!ArrayPrototypeIncludes(union, value)) { + throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value); + } +} + +function validateBoolean(value, name) { + if (typeof value !== 'boolean') { + throw new ERR_INVALID_ARG_TYPE(name, 'Boolean', value); + } +} + +function validateArray(value, name) { + if (!ArrayIsArray(value)) { + throw new ERR_INVALID_ARG_TYPE(name, 'Array', value); + } +} + +function validateStringArray(value, name) { + validateArray(value, name); + for (let i = 0; i < value.length; i++) { + validateString(value[i], `${name}[${i}]`); + } +} + +function validateBooleanArray(value, name) { + validateArray(value, name); + for (let i = 0; i < value.length; i++) { + validateBoolean(value[i], `${name}[${i}]`); + } +} + +/** + * @param {unknown} value + * @param {string} name + * @param {{ + * allowArray?: boolean, + * allowFunction?: boolean, + * nullable?: boolean + * }} [options] + */ +function validateObject(value, name, options) { + const useDefaultOptions = options == null; + const allowArray = useDefaultOptions ? false : options.allowArray; + const allowFunction = useDefaultOptions ? false : options.allowFunction; + const nullable = useDefaultOptions ? false : options.nullable; + if ((!nullable && value === null) || + (!allowArray && ArrayIsArray(value)) || + (typeof value !== 'object' && ( + !allowFunction || typeof value !== 'function' + ))) { + throw new ERR_INVALID_ARG_TYPE(name, 'Object', value); + } +} + +module.exports = { + validateArray, + validateObject, + validateString, + validateStringArray, + validateUnion, + validateBoolean, + validateBooleanArray, +}; diff --git a/node_modules/@pkgjs/parseargs/package.json b/node_modules/@pkgjs/parseargs/package.json new file mode 100644 index 00000000..0bcc05c0 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/package.json @@ -0,0 +1,36 @@ +{ + "name": "@pkgjs/parseargs", + "version": "0.11.0", + "description": "Polyfill of future proposal for `util.parseArgs()`", + "engines": { + "node": ">=14" + }, + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "scripts": { + "coverage": "c8 --check-coverage tape 'test/*.js'", + "test": "c8 tape 'test/*.js'", + "posttest": "eslint .", + "fix": "npm run posttest -- --fix" + }, + "repository": { + "type": "git", + "url": "git@github.com:pkgjs/parseargs.git" + }, + "keywords": [], + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/pkgjs/parseargs/issues" + }, + "homepage": "https://github.com/pkgjs/parseargs#readme", + "devDependencies": { + "c8": "^7.10.0", + "eslint": "^8.2.0", + "eslint-plugin-node-core": "iansu/eslint-plugin-node-core", + "tape": "^5.2.2" + } +} diff --git a/node_modules/@pkgjs/parseargs/utils.js b/node_modules/@pkgjs/parseargs/utils.js new file mode 100644 index 00000000..d7f420a2 --- /dev/null +++ b/node_modules/@pkgjs/parseargs/utils.js @@ -0,0 +1,198 @@ +'use strict'; + +const { + ArrayPrototypeFind, + ObjectEntries, + ObjectPrototypeHasOwnProperty: ObjectHasOwn, + StringPrototypeCharAt, + StringPrototypeIncludes, + StringPrototypeStartsWith, +} = require('./internal/primordials'); + +const { + validateObject, +} = require('./internal/validators'); + +// These are internal utilities to make the parsing logic easier to read, and +// add lots of detail for the curious. They are in a separate file to allow +// unit testing, although that is not essential (this could be rolled into +// main file and just tested implicitly via API). +// +// These routines are for internal use, not for export to client. + +/** + * Return the named property, but only if it is an own property. + */ +function objectGetOwn(obj, prop) { + if (ObjectHasOwn(obj, prop)) + return obj[prop]; +} + +/** + * Return the named options property, but only if it is an own property. + */ +function optionsGetOwn(options, longOption, prop) { + if (ObjectHasOwn(options, longOption)) + return objectGetOwn(options[longOption], prop); +} + +/** + * Determines if the argument may be used as an option value. + * @example + * isOptionValue('V') // returns true + * isOptionValue('-v') // returns true (greedy) + * isOptionValue('--foo') // returns true (greedy) + * isOptionValue(undefined) // returns false + */ +function isOptionValue(value) { + if (value == null) return false; + + // Open Group Utility Conventions are that an option-argument + // is the argument after the option, and may start with a dash. + return true; // greedy! +} + +/** + * Detect whether there is possible confusion and user may have omitted + * the option argument, like `--port --verbose` when `port` of type:string. + * In strict mode we throw errors if value is option-like. + */ +function isOptionLikeValue(value) { + if (value == null) return false; + + return value.length > 1 && StringPrototypeCharAt(value, 0) === '-'; +} + +/** + * Determines if `arg` is just a short option. + * @example '-f' + */ +function isLoneShortOption(arg) { + return arg.length === 2 && + StringPrototypeCharAt(arg, 0) === '-' && + StringPrototypeCharAt(arg, 1) !== '-'; +} + +/** + * Determines if `arg` is a lone long option. + * @example + * isLoneLongOption('a') // returns false + * isLoneLongOption('-a') // returns false + * isLoneLongOption('--foo') // returns true + * isLoneLongOption('--foo=bar') // returns false + */ +function isLoneLongOption(arg) { + return arg.length > 2 && + StringPrototypeStartsWith(arg, '--') && + !StringPrototypeIncludes(arg, '=', 3); +} + +/** + * Determines if `arg` is a long option and value in the same argument. + * @example + * isLongOptionAndValue('--foo') // returns false + * isLongOptionAndValue('--foo=bar') // returns true + */ +function isLongOptionAndValue(arg) { + return arg.length > 2 && + StringPrototypeStartsWith(arg, '--') && + StringPrototypeIncludes(arg, '=', 3); +} + +/** + * Determines if `arg` is a short option group. + * + * See Guideline 5 of the [Open Group Utility Conventions](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html). + * One or more options without option-arguments, followed by at most one + * option that takes an option-argument, should be accepted when grouped + * behind one '-' delimiter. + * @example + * isShortOptionGroup('-a', {}) // returns false + * isShortOptionGroup('-ab', {}) // returns true + * // -fb is an option and a value, not a short option group + * isShortOptionGroup('-fb', { + * options: { f: { type: 'string' } } + * }) // returns false + * isShortOptionGroup('-bf', { + * options: { f: { type: 'string' } } + * }) // returns true + * // -bfb is an edge case, return true and caller sorts it out + * isShortOptionGroup('-bfb', { + * options: { f: { type: 'string' } } + * }) // returns true + */ +function isShortOptionGroup(arg, options) { + if (arg.length <= 2) return false; + if (StringPrototypeCharAt(arg, 0) !== '-') return false; + if (StringPrototypeCharAt(arg, 1) === '-') return false; + + const firstShort = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(firstShort, options); + return optionsGetOwn(options, longOption, 'type') !== 'string'; +} + +/** + * Determine if arg is a short string option followed by its value. + * @example + * isShortOptionAndValue('-a', {}); // returns false + * isShortOptionAndValue('-ab', {}); // returns false + * isShortOptionAndValue('-fFILE', { + * options: { foo: { short: 'f', type: 'string' }} + * }) // returns true + */ +function isShortOptionAndValue(arg, options) { + validateObject(options, 'options'); + + if (arg.length <= 2) return false; + if (StringPrototypeCharAt(arg, 0) !== '-') return false; + if (StringPrototypeCharAt(arg, 1) === '-') return false; + + const shortOption = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(shortOption, options); + return optionsGetOwn(options, longOption, 'type') === 'string'; +} + +/** + * Find the long option associated with a short option. Looks for a configured + * `short` and returns the short option itself if a long option is not found. + * @example + * findLongOptionForShort('a', {}) // returns 'a' + * findLongOptionForShort('b', { + * options: { bar: { short: 'b' } } + * }) // returns 'bar' + */ +function findLongOptionForShort(shortOption, options) { + validateObject(options, 'options'); + const longOptionEntry = ArrayPrototypeFind( + ObjectEntries(options), + ({ 1: optionConfig }) => objectGetOwn(optionConfig, 'short') === shortOption + ); + return longOptionEntry?.[0] ?? shortOption; +} + +/** + * Check if the given option includes a default value + * and that option has not been set by the input args. + * + * @param {string} longOption - long option name e.g. 'foo' + * @param {object} optionConfig - the option configuration properties + * @param {object} values - option values returned in `values` by parseArgs + */ +function useDefaultValueOption(longOption, optionConfig, values) { + return objectGetOwn(optionConfig, 'default') !== undefined && + values[longOption] === undefined; +} + +module.exports = { + findLongOptionForShort, + isLoneLongOption, + isLoneShortOption, + isLongOptionAndValue, + isOptionValue, + isOptionLikeValue, + isShortOptionAndValue, + isShortOptionGroup, + useDefaultValueOption, + objectGetOwn, + optionsGetOwn, +}; diff --git a/node_modules/@polka/url/build.js b/node_modules/@polka/url/build.js new file mode 100644 index 00000000..33dfc56c --- /dev/null +++ b/node_modules/@polka/url/build.js @@ -0,0 +1,42 @@ +const qs = require('querystring'); + +/** + * @typedef ParsedURL + * @type {import('.').ParsedURL} + */ + +/** + * @typedef Request + * @property {string} url + * @property {ParsedURL} _parsedUrl + */ + +/** + * @param {Request} req + * @returns {ParsedURL|void} + */ +function parse(req) { + let raw = req.url; + if (raw == null) return; + + let prev = req._parsedUrl; + if (prev && prev.raw === raw) return prev; + + let pathname=raw, search='', query; + + if (raw.length > 1) { + let idx = raw.indexOf('?', 1); + + if (idx !== -1) { + search = raw.substring(idx); + pathname = raw.substring(0, idx); + if (search.length > 1) { + query = qs.parse(search.substring(1)); + } + } + } + + return req._parsedUrl = { pathname, search, query, raw }; +} + +exports.parse = parse; \ No newline at end of file diff --git a/node_modules/@polka/url/build.mjs b/node_modules/@polka/url/build.mjs new file mode 100644 index 00000000..ff908482 --- /dev/null +++ b/node_modules/@polka/url/build.mjs @@ -0,0 +1,40 @@ +import * as qs from 'node:querystring'; + +/** + * @typedef ParsedURL + * @type {import('.').ParsedURL} + */ + +/** + * @typedef Request + * @property {string} url + * @property {ParsedURL} _parsedUrl + */ + +/** + * @param {Request} req + * @returns {ParsedURL|void} + */ +export function parse(req) { + let raw = req.url; + if (raw == null) return; + + let prev = req._parsedUrl; + if (prev && prev.raw === raw) return prev; + + let pathname=raw, search='', query; + + if (raw.length > 1) { + let idx = raw.indexOf('?', 1); + + if (idx !== -1) { + search = raw.substring(idx); + pathname = raw.substring(0, idx); + if (search.length > 1) { + query = qs.parse(search.substring(1)); + } + } + } + + return req._parsedUrl = { pathname, search, query, raw }; +} diff --git a/node_modules/@polka/url/index.d.ts b/node_modules/@polka/url/index.d.ts new file mode 100644 index 00000000..9b27c042 --- /dev/null +++ b/node_modules/@polka/url/index.d.ts @@ -0,0 +1,10 @@ +import type { IncomingMessage } from 'http'; + +export interface ParsedURL { + pathname: string; + search: string; + query: Record | void; + raw: string; +} + +export function parse(req: IncomingMessage): ParsedURL; diff --git a/node_modules/@polka/url/package.json b/node_modules/@polka/url/package.json new file mode 100644 index 00000000..159aefec --- /dev/null +++ b/node_modules/@polka/url/package.json @@ -0,0 +1,30 @@ +{ + "version": "1.0.0-next.28", + "name": "@polka/url", + "repository": "lukeed/polka", + "description": "Super fast, memoized `req.url` parser", + "module": "build.mjs", + "types": "index.d.ts", + "main": "build.js", + "license": "MIT", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./build.mjs", + "require": "./build.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "build.*", + "index.d.*" + ], + "author": { + "name": "Luke Edwards", + "email": "luke@lukeed.com", + "url": "https://lukeed.com" + }, + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/node_modules/@polka/url/readme.md b/node_modules/@polka/url/readme.md new file mode 100644 index 00000000..e47645ce --- /dev/null +++ b/node_modules/@polka/url/readme.md @@ -0,0 +1,68 @@ +# @polka/url [![npm](https://badgen.now.sh/npm/v/@polka/url)](https://npmjs.org/package/@polka/url) [![licenses](https://licenses.dev/b/npm/%40polka%2Furl)](https://licenses.dev/npm/%40polka%2Furl) + +> Super fast, memoized `req.url` parser; _not_ limited to [Polka][polka]! + +Parses the `url` from a [`IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) request. The returned object will always only contain the following keys: `search`, `query`, `pathname`, and `raw`. + +> **Note:** This library does not process `protocol`, `hostname`, `port`, etc.
This is because the incoming `req.url` value only begins with the path information. + +Parsed requests will be mutated with a `_parsedUrl` key, containing the returned output. This is used for future memoization, avoiding the need to fully parse the same `url` value multiple times. + +## Install + +``` +$ npm install --save @polka/url +``` + +## Usage + +```js +const parse = require('@polka/url'); + +let req = { + url: '/foo/bar?fizz=buzz' +}; +let output = parse(req); +//=> { +//=> pathname: '/foo/bar', +//=> raw: '/foo/bar?fizz=buzz', +//=> search: '?fizz=buzz', +//=> query: { +//=> fizz: 'buzz' +//=> }, +//=> } + +// Attaches result for future memoization +assert.deepEqual(output, req._parsedUrl); //=> true +``` + +## API + +### url(req) +Returns: `Object` or `undefined` + +> **Important:** The `req` must have a `url` key, otherwise `undefined` will be returned.
If no input is provided at all, a `TypeError` will be thrown. + +#### req +Type: `IncomingMessage` or `{ url: string }` + +The incoming HTTP request (`req`) or a plain `Object` with a `url` key. + +> **Note:** In Node.js servers, the [`req.url`](https://nodejs.org/api/http.html#http_message_url) begins with a pathname & does not include a `hash`. + + +## Benchmarks + +Check out the [`bench`](/bench) directory for in-depth benchmark results and comparisons. + + +## Support + +Any issues or questions can be sent to the [Polka][polka] repository.
However, please specify that your inquiry is about `@polka/url` specifically. + + +## License + +MIT © [Luke Edwards](https://lukeed.com) + +[polka]: https://github.com/lukeed/polka diff --git a/node_modules/@rollup/pluginutils/node_modules/picomatch/LICENSE b/node_modules/@rollup/pluginutils/node_modules/picomatch/LICENSE new file mode 100644 index 00000000..3608dca2 --- /dev/null +++ b/node_modules/@rollup/pluginutils/node_modules/picomatch/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017-present, Jon Schlinkert. + +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/@rollup/pluginutils/node_modules/picomatch/README.md b/node_modules/@rollup/pluginutils/node_modules/picomatch/README.md new file mode 100644 index 00000000..5062654b --- /dev/null +++ b/node_modules/@rollup/pluginutils/node_modules/picomatch/README.md @@ -0,0 +1,738 @@ +

Picomatch

+ +

+ +version + + +test status + + +coverage status + + +downloads + +

+ +
+
+ +

+Blazing fast and accurate glob matcher written in JavaScript.
+No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. +

+ +
+
+ +## Why picomatch? + +* **Lightweight** - No dependencies +* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. +* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) +* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) +* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. +* **Well tested** - Thousands of unit tests + +See the [library comparison](#library-comparisons) to other libraries. + +
+
+ +## Table of Contents + +
Click to expand + +- [Install](#install) +- [Usage](#usage) +- [API](#api) + * [picomatch](#picomatch) + * [.test](#test) + * [.matchBase](#matchbase) + * [.isMatch](#ismatch) + * [.parse](#parse) + * [.scan](#scan) + * [.compileRe](#compilere) + * [.makeRe](#makere) + * [.toRegex](#toregex) +- [Options](#options) + * [Picomatch options](#picomatch-options) + * [Scan Options](#scan-options) + * [Options Examples](#options-examples) +- [Globbing features](#globbing-features) + * [Basic globbing](#basic-globbing) + * [Advanced globbing](#advanced-globbing) + * [Braces](#braces) + * [Matching special characters as literals](#matching-special-characters-as-literals) +- [Library Comparisons](#library-comparisons) +- [Benchmarks](#benchmarks) +- [Philosophies](#philosophies) +- [About](#about) + * [Author](#author) + * [License](#license) + +_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ + +
+ +
+
+ +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +npm install --save picomatch +``` + +
+ +## Usage + +The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. + +```js +const pm = require('picomatch'); +const isMatch = pm('*.js'); + +console.log(isMatch('abcd')); //=> false +console.log(isMatch('a.js')); //=> true +console.log(isMatch('a.md')); //=> false +console.log(isMatch('a/b.js')); //=> false +``` + +
+ +## API + +### [picomatch](lib/picomatch.js#L31) + +Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. + +**Params** + +* `globs` **{String|Array}**: One or more glob patterns. +* `options` **{Object=}** +* `returns` **{Function=}**: Returns a matcher function. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch(glob[, options]); + +const isMatch = picomatch('*.!(*a)'); +console.log(isMatch('a.a')); //=> false +console.log(isMatch('a.b')); //=> true +``` + +**Example without node.js** + +For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection. + +```js +const picomatch = require('picomatch/posix'); +// the same API, defaulting to posix paths +const isMatch = picomatch('a/*'); +console.log(isMatch('a\\b')); //=> false +console.log(isMatch('a/b')); //=> true + +// you can still configure the matcher function to accept windows paths +const isMatch = picomatch('a/*', { options: windows }); +console.log(isMatch('a\\b')); //=> true +console.log(isMatch('a/b')); //=> true +``` + +### [.test](lib/picomatch.js#L116) + +Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. + +**Params** + +* `input` **{String}**: String to test. +* `regex` **{RegExp}** +* `returns` **{Object}**: Returns an object with matching info. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.test(input, regex[, options]); + +console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); +// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } +``` + +### [.matchBase](lib/picomatch.js#L160) + +Match the basename of a filepath. + +**Params** + +* `input` **{String}**: String to test. +* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). +* `returns` **{Boolean}** + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.matchBase(input, glob[, options]); +console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true +``` + +### [.isMatch](lib/picomatch.js#L182) + +Returns true if **any** of the given glob `patterns` match the specified `string`. + +**Params** + +* **{String|Array}**: str The string to test. +* **{String|Array}**: patterns One or more glob patterns to use for matching. +* **{Object}**: See available [options](#options). +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.isMatch(string, patterns[, options]); + +console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true +console.log(picomatch.isMatch('a.a', 'b.*')); //=> false +``` + +### [.parse](lib/picomatch.js#L198) + +Parse a glob pattern to create the source string for a regular expression. + +**Params** + +* `pattern` **{String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. + +**Example** + +```js +const picomatch = require('picomatch'); +const result = picomatch.parse(pattern[, options]); +``` + +### [.scan](lib/picomatch.js#L230) + +Scan a glob pattern to separate the pattern into segments. + +**Params** + +* `input` **{String}**: Glob pattern to scan. +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.scan(input[, options]); + +const result = picomatch.scan('!./foo/*.js'); +console.log(result); +{ prefix: '!./', + input: '!./foo/*.js', + start: 3, + base: 'foo', + glob: '*.js', + isBrace: false, + isBracket: false, + isGlob: true, + isExtglob: false, + isGlobstar: false, + negated: true } +``` + +### [.compileRe](lib/picomatch.js#L244) + +Compile a regular expression from the `state` object returned by the +[parse()](#parse) method. + +**Params** + +* `state` **{Object}** +* `options` **{Object}** +* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. +* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. +* `returns` **{RegExp}** + +### [.makeRe](lib/picomatch.js#L285) + +Create a regular expression from a parsed glob pattern. + +**Params** + +* `state` **{String}**: The object returned from the `.parse` method. +* `options` **{Object}** +* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. +* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. +* `returns` **{RegExp}**: Returns a regex created from the given pattern. + +**Example** + +```js +const picomatch = require('picomatch'); +const state = picomatch.parse('*.js'); +// picomatch.compileRe(state[, options]); + +console.log(picomatch.compileRe(state)); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +### [.toRegex](lib/picomatch.js#L320) + +Create a regular expression from the given regex source string. + +**Params** + +* `source` **{String}**: Regular expression source string. +* `options` **{Object}** +* `returns` **{RegExp}** + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.toRegex(source[, options]); + +const { output } = picomatch.parse('*.js'); +console.log(picomatch.toRegex(output)); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +
+ +## Options + +### Picomatch options + +The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | +| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | +| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | +| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | +| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | +| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | +| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | +| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | +| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | +| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | +| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | +| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | +| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | +| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | +| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | +| `matchBase` | `boolean` | `false` | Alias for `basename` | +| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | +| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | +| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | +| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | +| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | +| `noext` | `boolean` | `false` | Alias for `noextglob` | +| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | +| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | +| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | +| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | +| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | +| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | +| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | +| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | +| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | +| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | +| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | +| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | +| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | +| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | +| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | +| `windows` | `boolean` | `false` | Also accept backslashes as the path separator. | + +### Scan Options + +In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | +| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | + +**Example** + +```js +const picomatch = require('picomatch'); +const result = picomatch.scan('!./foo/*.js', { tokens: true }); +console.log(result); +// { +// prefix: '!./', +// input: '!./foo/*.js', +// start: 3, +// base: 'foo', +// glob: '*.js', +// isBrace: false, +// isBracket: false, +// isGlob: true, +// isExtglob: false, +// isGlobstar: false, +// negated: true, +// maxDepth: 2, +// tokens: [ +// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, +// { value: 'foo', depth: 1, isGlob: false }, +// { value: '*.js', depth: 1, isGlob: true } +// ], +// slashes: [ 2, 6 ], +// parts: [ 'foo', '*.js' ] +// } +``` + +
+ +### Options Examples + +#### options.expandRange + +**Type**: `function` + +**Default**: `undefined` + +Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. + +**Example** + +The following example shows how to create a glob that matches a folder + +```js +const fill = require('fill-range'); +const regex = pm.makeRe('foo/{01..25}/bar', { + expandRange(a, b) { + return `(${fill(a, b, { toRegex: true })})`; + } +}); + +console.log(regex); +//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ + +console.log(regex.test('foo/00/bar')) // false +console.log(regex.test('foo/01/bar')) // true +console.log(regex.test('foo/10/bar')) // true +console.log(regex.test('foo/22/bar')) // true +console.log(regex.test('foo/25/bar')) // true +console.log(regex.test('foo/26/bar')) // false +``` + +#### options.format + +**Type**: `function` + +**Default**: `undefined` + +Custom function for formatting strings before they're matched. + +**Example** + +```js +// strip leading './' from strings +const format = str => str.replace(/^\.\//, ''); +const isMatch = picomatch('foo/*.js', { format }); +console.log(isMatch('./foo/bar.js')); //=> true +``` + +#### options.onMatch + +```js +const onMatch = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onMatch }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +#### options.onIgnore + +```js +const onIgnore = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +#### options.onResult + +```js +const onResult = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onResult, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +
+
+ +## Globbing features + +* [Basic globbing](#basic-globbing) (Wildcard matching) +* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) + +### Basic globbing + +| **Character** | **Description** | +| --- | --- | +| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | +| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` with the `windows` option) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | +| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | +| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | + +#### Matching behavior vs. Bash + +Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: + +* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. +* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. + +
+ +### Advanced globbing + +* [extglobs](#extglobs) +* [POSIX brackets](#posix-brackets) +* [Braces](#brace-expansion) + +#### Extglobs + +| **Pattern** | **Description** | +| --- | --- | +| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | +| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | +| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | +| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | +| `!(pattern)` | Match _anything but_ `pattern` | + +**Examples** + +```js +const pm = require('picomatch'); + +// *(pattern) matches ZERO or more of "pattern" +console.log(pm.isMatch('a', 'a*(z)')); // true +console.log(pm.isMatch('az', 'a*(z)')); // true +console.log(pm.isMatch('azzz', 'a*(z)')); // true + +// +(pattern) matches ONE or more of "pattern" +console.log(pm.isMatch('a', 'a+(z)')); // false +console.log(pm.isMatch('az', 'a+(z)')); // true +console.log(pm.isMatch('azzz', 'a+(z)')); // true + +// supports multiple extglobs +console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false + +// supports nested extglobs +console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true +``` + +#### POSIX brackets + +POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. + +**Enable POSIX bracket support** + +```js +console.log(pm.makeRe('[[:word:]]+', { posix: true })); +//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ +``` + +**Supported POSIX classes** + +The following named POSIX bracket expressions are supported: + +* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` +* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. +* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. +* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. +* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. +* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. +* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. +* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. +* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. +* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. +* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. +* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. +* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. +* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. + +See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. + +### Braces + +Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. + +### Matching special characters as literals + +If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: + +**Special Characters** + +Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. + +To match any of the following characters as literals: `$^*+?()[] + +Examples: + +```js +console.log(pm.makeRe('foo/bar \\(1\\)')); +console.log(pm.makeRe('foo/bar \\(1\\)')); +``` + +
+
+ +## Library Comparisons + +The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). + +| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | +| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | +| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | +| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | +| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | +| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | +| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | +| File system operations | - | - | - | - | - | - | - | + +
+
+ +## Benchmarks + +Performance comparison of picomatch and minimatch. + +_(Pay special attention to the last three benchmarks. Minimatch freezes on long ranges.)_ + +``` +# .makeRe star (*) + picomatch x 4,449,159 ops/sec ±0.24% (97 runs sampled) + minimatch x 632,772 ops/sec ±0.14% (98 runs sampled) + +# .makeRe star; dot=true (*) + picomatch x 3,500,079 ops/sec ±0.26% (99 runs sampled) + minimatch x 564,916 ops/sec ±0.23% (96 runs sampled) + +# .makeRe globstar (**) + picomatch x 3,261,000 ops/sec ±0.27% (98 runs sampled) + minimatch x 1,664,766 ops/sec ±0.20% (100 runs sampled) + +# .makeRe globstars (**/**/**) + picomatch x 3,284,469 ops/sec ±0.18% (97 runs sampled) + minimatch x 1,435,880 ops/sec ±0.34% (95 runs sampled) + +# .makeRe with leading star (*.txt) + picomatch x 3,100,197 ops/sec ±0.35% (99 runs sampled) + minimatch x 428,347 ops/sec ±0.42% (94 runs sampled) + +# .makeRe - basic braces ({a,b,c}*.txt) + picomatch x 443,578 ops/sec ±1.33% (89 runs sampled) + minimatch x 107,143 ops/sec ±0.35% (94 runs sampled) + +# .makeRe - short ranges ({a..z}*.txt) + picomatch x 415,484 ops/sec ±0.76% (96 runs sampled) + minimatch x 14,299 ops/sec ±0.26% (96 runs sampled) + +# .makeRe - medium ranges ({1..100000}*.txt) + picomatch x 395,020 ops/sec ±0.87% (89 runs sampled) + minimatch x 2 ops/sec ±4.59% (10 runs sampled) + +# .makeRe - long ranges ({1..10000000}*.txt) + picomatch x 400,036 ops/sec ±0.83% (90 runs sampled) + minimatch (FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory) +``` + +
+
+ +## Philosophies + +The goal of this library is to be blazing fast, without compromising on accuracy. + +**Accuracy** + +The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. + +Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. + +**Performance** + +Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. + +
+
+ +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). diff --git a/node_modules/@rollup/pluginutils/node_modules/picomatch/index.js b/node_modules/@rollup/pluginutils/node_modules/picomatch/index.js new file mode 100644 index 00000000..a753b1d9 --- /dev/null +++ b/node_modules/@rollup/pluginutils/node_modules/picomatch/index.js @@ -0,0 +1,17 @@ +'use strict'; + +const pico = require('./lib/picomatch'); +const utils = require('./lib/utils'); + +function picomatch(glob, options, returnState = false) { + // default to os.platform() + if (options && (options.windows === null || options.windows === undefined)) { + // don't mutate the original options object + options = { ...options, windows: utils.isWindows() }; + } + + return pico(glob, options, returnState); +} + +Object.assign(picomatch, pico); +module.exports = picomatch; diff --git a/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/constants.js b/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/constants.js new file mode 100644 index 00000000..27b3e20f --- /dev/null +++ b/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/constants.js @@ -0,0 +1,179 @@ +'use strict'; + +const WIN_SLASH = '\\\\/'; +const WIN_NO_SLASH = `[^${WIN_SLASH}]`; + +/** + * Posix glob regex + */ + +const DOT_LITERAL = '\\.'; +const PLUS_LITERAL = '\\+'; +const QMARK_LITERAL = '\\?'; +const SLASH_LITERAL = '\\/'; +const ONE_CHAR = '(?=.)'; +const QMARK = '[^/]'; +const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; +const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; +const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; +const NO_DOT = `(?!${DOT_LITERAL})`; +const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; +const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; +const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; +const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; +const STAR = `${QMARK}*?`; +const SEP = '/'; + +const POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR, + SEP +}; + +/** + * Windows glob regex + */ + +const WINDOWS_CHARS = { + ...POSIX_CHARS, + + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)`, + SEP: '\\' +}; + +/** + * POSIX Bracket Regex + */ + +const POSIX_REGEX_SOURCE = { + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\x00-\\x7F', + blank: ' \\t', + cntrl: '\\x00-\\x1F\\x7F', + digit: '0-9', + graph: '\\x21-\\x7E', + lower: 'a-z', + print: '\\x20-\\x7E ', + punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', + space: ' \\t\\r\\n\\v\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' +}; + +module.exports = { + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, + + // regular expressions + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, + + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + '***': '*', + '**/**': '**', + '**/**/**': '**' + }, + + // Digits + CHAR_0: 48, /* 0 */ + CHAR_9: 57, /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 65, /* A */ + CHAR_LOWERCASE_A: 97, /* a */ + CHAR_UPPERCASE_Z: 90, /* Z */ + CHAR_LOWERCASE_Z: 122, /* z */ + + CHAR_LEFT_PARENTHESES: 40, /* ( */ + CHAR_RIGHT_PARENTHESES: 41, /* ) */ + + CHAR_ASTERISK: 42, /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, /* & */ + CHAR_AT: 64, /* @ */ + CHAR_BACKWARD_SLASH: 92, /* \ */ + CHAR_CARRIAGE_RETURN: 13, /* \r */ + CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ + CHAR_COLON: 58, /* : */ + CHAR_COMMA: 44, /* , */ + CHAR_DOT: 46, /* . */ + CHAR_DOUBLE_QUOTE: 34, /* " */ + CHAR_EQUAL: 61, /* = */ + CHAR_EXCLAMATION_MARK: 33, /* ! */ + CHAR_FORM_FEED: 12, /* \f */ + CHAR_FORWARD_SLASH: 47, /* / */ + CHAR_GRAVE_ACCENT: 96, /* ` */ + CHAR_HASH: 35, /* # */ + CHAR_HYPHEN_MINUS: 45, /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ + CHAR_LEFT_CURLY_BRACE: 123, /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ + CHAR_LINE_FEED: 10, /* \n */ + CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ + CHAR_PERCENT: 37, /* % */ + CHAR_PLUS: 43, /* + */ + CHAR_QUESTION_MARK: 63, /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ + CHAR_SEMICOLON: 59, /* ; */ + CHAR_SINGLE_QUOTE: 39, /* ' */ + CHAR_SPACE: 32, /* */ + CHAR_TAB: 9, /* \t */ + CHAR_UNDERSCORE: 95, /* _ */ + CHAR_VERTICAL_LINE: 124, /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ + + /** + * Create EXTGLOB_CHARS + */ + + extglobChars(chars) { + return { + '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, + '?': { type: 'qmark', open: '(?:', close: ')?' }, + '+': { type: 'plus', open: '(?:', close: ')+' }, + '*': { type: 'star', open: '(?:', close: ')*' }, + '@': { type: 'at', open: '(?:', close: ')' } + }; + }, + + /** + * Create GLOB_CHARS + */ + + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; + } +}; diff --git a/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/parse.js b/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/parse.js new file mode 100644 index 00000000..8fd8ff49 --- /dev/null +++ b/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/parse.js @@ -0,0 +1,1085 @@ +'use strict'; + +const constants = require('./constants'); +const utils = require('./utils'); + +/** + * Constants + */ + +const { + MAX_LENGTH, + POSIX_REGEX_SOURCE, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS +} = constants; + +/** + * Helpers + */ + +const expandRange = (args, options) => { + if (typeof options.expandRange === 'function') { + return options.expandRange(...args, options); + } + + args.sort(); + const value = `[${args.join('-')}]`; + + try { + /* eslint-disable-next-line no-new */ + new RegExp(value); + } catch (ex) { + return args.map(v => utils.escapeRegex(v)).join('..'); + } + + return value; +}; + +/** + * Create the message for a syntax error + */ + +const syntaxError = (type, char) => { + return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; +}; + +/** + * Parse the given input string. + * @param {String} input + * @param {Object} options + * @return {Object} + */ + +const parse = (input, options) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + input = REPLACEMENTS[input] || input; + + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + + let len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + const bos = { type: 'bos', value: '', output: opts.prepend || '' }; + const tokens = [bos]; + + const capture = opts.capture ? '' : '?:'; + + // create constants based on platform, for windows or posix + const PLATFORM_CHARS = constants.globChars(opts.windows); + const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); + + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + + const globstar = opts => { + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const nodot = opts.dot ? '' : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + // minimatch options support + if (typeof opts.noext === 'boolean') { + opts.noextglob = opts.noext; + } + + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: '', + output: '', + prefix: '', + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + + input = utils.removePrefix(input, state); + len = input.length; + + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + + /** + * Tokenizing helpers + */ + + const eos = () => state.index === len - 1; + const peek = state.peek = (n = 1) => input[state.index + n]; + const advance = state.advance = () => input[++state.index] || ''; + const remaining = () => input.slice(state.index + 1); + const consume = (value = '', num = 0) => { + state.consumed += value; + state.index += num; + }; + + const append = token => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + + const negate = () => { + let count = 1; + + while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { + advance(); + state.start++; + count++; + } + + if (count % 2 === 0) { + return false; + } + + state.negated = true; + state.start++; + return true; + }; + + const increment = type => { + state[type]++; + stack.push(type); + }; + + const decrement = type => { + state[type]--; + stack.pop(); + }; + + /** + * Push tokens onto the tokens array. This helper speeds up + * tokenizing by 1) helping us avoid backtracking as much as possible, + * and 2) helping us avoid creating extra tokens when consecutive + * characters are plain text. This improves performance and simplifies + * lookbehinds. + */ + + const push = tok => { + if (prev.type === 'globstar') { + const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); + const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); + + if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = 'star'; + prev.value = '*'; + prev.output = star; + state.output += prev.output; + } + } + + if (extglobs.length && tok.type !== 'paren') { + extglobs[extglobs.length - 1].inner += tok.value; + } + + if (tok.value || tok.output) append(tok); + if (prev && prev.type === 'text' && tok.type === 'text') { + prev.output = (prev.output || prev.value) + tok.value; + prev.value += tok.value; + return; + } + + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + + const extglobOpen = (type, value) => { + const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; + + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + const output = (opts.capture ? '(' : '') + token.open; + + increment('parens'); + push({ type, value, output: state.output ? '' : ONE_CHAR }); + push({ type: 'paren', extglob: true, value: advance(), output }); + extglobs.push(token); + }; + + const extglobClose = token => { + let output = token.close + (opts.capture ? ')' : ''); + let rest; + + if (token.type === 'negate') { + let extglobStar = star; + + if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { + extglobStar = globstar(opts); + } + + if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { + output = token.close = `)$))${extglobStar}`; + } + + if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { + // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. + // In this case, we need to parse the string and use it in the output of the original pattern. + // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. + // + // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. + const expression = parse(rest, { ...options, fastpaths: false }).output; + + output = token.close = `)${expression})${extglobStar})`; + } + + if (token.prev.type === 'bos') { + state.negatedExtglob = true; + } + } + + push({ type: 'paren', extglob: true, value, output }); + decrement('parens'); + }; + + /** + * Fast paths + */ + + if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { + let backslashes = false; + + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { + if (first === '\\') { + backslashes = true; + return m; + } + + if (first === '?') { + if (esc) { + return esc + first + (rest ? QMARK.repeat(rest.length) : ''); + } + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); + } + return QMARK.repeat(chars.length); + } + + if (first === '.') { + return DOT_LITERAL.repeat(chars.length); + } + + if (first === '*') { + if (esc) { + return esc + first + (rest ? star : ''); + } + return star; + } + return esc ? m : `\\${m}`; + }); + + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\/g, ''); + } else { + output = output.replace(/\\+/g, m => { + return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); + }); + } + } + + if (output === input && opts.contains === true) { + state.output = input; + return state; + } + + state.output = utils.wrapOutput(output, state, options); + return state; + } + + /** + * Tokenize input until we reach end-of-string + */ + + while (!eos()) { + value = advance(); + + if (value === '\u0000') { + continue; + } + + /** + * Escaped characters + */ + + if (value === '\\') { + const next = peek(); + + if (next === '/' && opts.bash !== true) { + continue; + } + + if (next === '.' || next === ';') { + continue; + } + + if (!next) { + value += '\\'; + push({ type: 'text', value }); + continue; + } + + // collapse slashes to reduce potential for exploits + const match = /^\\+/.exec(remaining()); + let slashes = 0; + + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + if (slashes % 2 !== 0) { + value += '\\'; + } + } + + if (opts.unescape === true) { + value = advance(); + } else { + value += advance(); + } + + if (state.brackets === 0) { + push({ type: 'text', value }); + continue; + } + } + + /** + * If we're inside a regex character class, continue + * until we reach the closing bracket. + */ + + if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { + if (opts.posix !== false && value === ':') { + const inner = prev.value.slice(1); + if (inner.includes('[')) { + prev.posix = true; + + if (inner.includes(':')) { + const idx = prev.value.lastIndexOf('['); + const pre = prev.value.slice(0, idx); + const rest = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE[rest]; + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + continue; + } + } + } + } + + if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { + value = `\\${value}`; + } + + if (value === ']' && (prev.value === '[' || prev.value === '[^')) { + value = `\\${value}`; + } + + if (opts.posix === true && value === '!' && prev.value === '[') { + value = '^'; + } + + prev.value += value; + append({ value }); + continue; + } + + /** + * If we're inside a quoted string, continue + * until we reach the closing double quote. + */ + + if (state.quotes === 1 && value !== '"') { + value = utils.escapeRegex(value); + prev.value += value; + append({ value }); + continue; + } + + /** + * Double quotes + */ + + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + if (opts.keepQuotes === true) { + push({ type: 'text', value }); + } + continue; + } + + /** + * Parentheses + */ + + if (value === '(') { + increment('parens'); + push({ type: 'paren', value }); + continue; + } + + if (value === ')') { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '(')); + } + + const extglob = extglobs[extglobs.length - 1]; + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; + } + + push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); + decrement('parens'); + continue; + } + + /** + * Square brackets + */ + + if (value === '[') { + if (opts.nobracket === true || !remaining().includes(']')) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('closing', ']')); + } + + value = `\\${value}`; + } else { + increment('brackets'); + } + + push({ type: 'bracket', value }); + continue; + } + + if (value === ']') { + if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '[')); + } + + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + decrement('brackets'); + + const prevValue = prev.value.slice(1); + if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { + value = `/${value}`; + } + + prev.value += value; + append({ value }); + + // when literal brackets are explicitly disabled + // assume we should match with a regex character class + if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { + continue; + } + + const escaped = utils.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); + + // when literal brackets are explicitly enabled + // assume we should escape the brackets to match literal characters + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } + + // when the user specifies nothing, try to match both + prev.value = `(${capture}${escaped}|${prev.value})`; + state.output += prev.value; + continue; + } + + /** + * Braces + */ + + if (value === '{' && opts.nobrace !== true) { + increment('braces'); + + const open = { + type: 'brace', + value, + output: '(', + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + + braces.push(open); + push(open); + continue; + } + + if (value === '}') { + const brace = braces[braces.length - 1]; + + if (opts.nobrace === true || !brace) { + push({ type: 'text', value, output: value }); + continue; + } + + let output = ')'; + + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + + for (let i = arr.length - 1; i >= 0; i--) { + tokens.pop(); + if (arr[i].type === 'brace') { + break; + } + if (arr[i].type !== 'dots') { + range.unshift(arr[i].value); + } + } + + output = expandRange(range, opts); + state.backtrack = true; + } + + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = '\\{'; + value = output = '\\}'; + state.output = out; + for (const t of toks) { + state.output += (t.output || t.value); + } + } + + push({ type: 'brace', value, output }); + decrement('braces'); + braces.pop(); + continue; + } + + /** + * Pipes + */ + + if (value === '|') { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + push({ type: 'text', value }); + continue; + } + + /** + * Commas + */ + + if (value === ',') { + let output = value; + + const brace = braces[braces.length - 1]; + if (brace && stack[stack.length - 1] === 'braces') { + brace.comma = true; + output = '|'; + } + + push({ type: 'comma', value, output }); + continue; + } + + /** + * Slashes + */ + + if (value === '/') { + // if the beginning of the glob is "./", advance the start + // to the current index, and don't add the "./" characters + // to the state. This greatly simplifies lookbehinds when + // checking for BOS characters like "!" and "." (not "./") + if (prev.type === 'dot' && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ''; + state.output = ''; + tokens.pop(); + prev = bos; // reset "prev" to the first token + continue; + } + + push({ type: 'slash', value, output: SLASH_LITERAL }); + continue; + } + + /** + * Dots + */ + + if (value === '.') { + if (state.braces > 0 && prev.type === 'dot') { + if (prev.value === '.') prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = 'dots'; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + + if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { + push({ type: 'text', value, output: DOT_LITERAL }); + continue; + } + + push({ type: 'dot', value, output: DOT_LITERAL }); + continue; + } + + /** + * Question marks + */ + + if (value === '?') { + const isGroup = prev && prev.value === '('; + if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('qmark', value); + continue; + } + + if (prev && prev.type === 'paren') { + const next = peek(); + let output = value; + + if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { + output = `\\${value}`; + } + + push({ type: 'text', value, output }); + continue; + } + + if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { + push({ type: 'qmark', value, output: QMARK_NO_DOT }); + continue; + } + + push({ type: 'qmark', value, output: QMARK }); + continue; + } + + /** + * Exclamation + */ + + if (value === '!') { + if (opts.noextglob !== true && peek() === '(') { + if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { + extglobOpen('negate', value); + continue; + } + } + + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; + } + } + + /** + * Plus + */ + + if (value === '+') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('plus', value); + continue; + } + + if ((prev && prev.value === '(') || opts.regex === false) { + push({ type: 'plus', value, output: PLUS_LITERAL }); + continue; + } + + if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { + push({ type: 'plus', value }); + continue; + } + + push({ type: 'plus', value: PLUS_LITERAL }); + continue; + } + + /** + * Plain text + */ + + if (value === '@') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + push({ type: 'at', extglob: true, value, output: '' }); + continue; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Plain text + */ + + if (value !== '*') { + if (value === '$' || value === '^') { + value = `\\${value}`; + } + + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + if (match) { + value += match[0]; + state.index += match[0].length; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Stars + */ + + if (prev && (prev.type === 'globstar' || prev.star === true)) { + prev.type = 'star'; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; + } + + let rest = remaining(); + if (opts.noextglob !== true && /^\([^?]/.test(rest)) { + extglobOpen('star', value); + continue; + } + + if (prev.type === 'star') { + if (opts.noglobstar === true) { + consume(value); + continue; + } + + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === 'slash' || prior.type === 'bos'; + const afterStar = before && (before.type === 'star' || before.type === 'globstar'); + + if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { + push({ type: 'star', value, output: '' }); + continue; + } + + const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); + const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); + if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { + push({ type: 'star', value, output: '' }); + continue; + } + + // strip consecutive `/**/` + while (rest.slice(0, 3) === '/**') { + const after = input[state.index + 4]; + if (after && after !== '/') { + break; + } + rest = rest.slice(3); + consume('/**', 3); + } + + if (prior.type === 'bos' && eos()) { + prev.type = 'globstar'; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { + const end = rest[1] !== void 0 ? '|$' : ''; + + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; + prev.value += value; + + state.output += prior.output + prev.output; + state.globstar = true; + + consume(value + advance()); + + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + if (prior.type === 'bos' && rest[0] === '/') { + prev.type = 'globstar'; + prev.value += value; + prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + // remove single star from output + state.output = state.output.slice(0, -prev.output.length); + + // reset previous token to globstar + prev.type = 'globstar'; + prev.output = globstar(opts); + prev.value += value; + + // reset output with globstar + state.output += prev.output; + state.globstar = true; + consume(value); + continue; + } + + const token = { type: 'star', value, output: star }; + + if (opts.bash === true) { + token.output = '.*?'; + if (prev.type === 'bos' || prev.type === 'slash') { + token.output = nodot + token.output; + } + push(token); + continue; + } + + if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { + token.output = value; + push(token); + continue; + } + + if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { + if (prev.type === 'dot') { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + + } else { + state.output += nodot; + prev.output += nodot; + } + + if (peek() !== '*') { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } + } + + push(token); + } + + while (state.brackets > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); + state.output = utils.escapeLast(state.output, '['); + decrement('brackets'); + } + + while (state.parens > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); + state.output = utils.escapeLast(state.output, '('); + decrement('parens'); + } + + while (state.braces > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); + state.output = utils.escapeLast(state.output, '{'); + decrement('braces'); + } + + if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { + push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); + } + + // rebuild the output if we had to backtrack at any point + if (state.backtrack === true) { + state.output = ''; + + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; + + if (token.suffix) { + state.output += token.suffix; + } + } + } + + return state; +}; + +/** + * Fast paths for creating regular expressions for common glob patterns. + * This can significantly speed up processing and has very little downside + * impact when none of the fast paths match. + */ + +parse.fastpaths = (input, options) => { + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + const len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + input = REPLACEMENTS[input] || input; + + // create constants based on platform, for windows or posix + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants.globChars(opts.windows); + + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? '' : '?:'; + const state = { negated: false, prefix: '' }; + let star = opts.bash === true ? '.*?' : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + const globstar = opts => { + if (opts.noglobstar === true) return star; + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const create = str => { + switch (str) { + case '*': + return `${nodot}${ONE_CHAR}${star}`; + + case '.*': + return `${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*.*': + return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*/*': + return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; + + case '**': + return nodot + globstar(opts); + + case '**/*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; + + case '**/*.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '**/.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; + + default: { + const match = /^(.*?)\.(\w+)$/.exec(str); + if (!match) return; + + const source = create(match[1]); + if (!source) return; + + return source + DOT_LITERAL + match[2]; + } + } + }; + + const output = utils.removePrefix(input, state); + let source = create(output); + + if (source && opts.strictSlashes !== true) { + source += `${SLASH_LITERAL}?`; + } + + return source; +}; + +module.exports = parse; diff --git a/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/picomatch.js b/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/picomatch.js new file mode 100644 index 00000000..d0ebd9f1 --- /dev/null +++ b/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/picomatch.js @@ -0,0 +1,341 @@ +'use strict'; + +const scan = require('./scan'); +const parse = require('./parse'); +const utils = require('./utils'); +const constants = require('./constants'); +const isObject = val => val && typeof val === 'object' && !Array.isArray(val); + +/** + * Creates a matcher function from one or more glob patterns. The + * returned function takes a string to match as its first argument, + * and returns true if the string is a match. The returned matcher + * function also takes a boolean as the second argument that, when true, + * returns an object with additional information. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch(glob[, options]); + * + * const isMatch = picomatch('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @name picomatch + * @param {String|Array} `globs` One or more glob patterns. + * @param {Object=} `options` + * @return {Function=} Returns a matcher function. + * @api public + */ + +const picomatch = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map(input => picomatch(input, options, returnState)); + const arrayMatcher = str => { + for (const isMatch of fns) { + const state = isMatch(str); + if (state) return state; + } + return false; + }; + return arrayMatcher; + } + + const isState = isObject(glob) && glob.tokens && glob.input; + + if (glob === '' || (typeof glob !== 'string' && !isState)) { + throw new TypeError('Expected pattern to be a non-empty string'); + } + + const opts = options || {}; + const posix = opts.windows; + const regex = isState + ? picomatch.compileRe(glob, options) + : picomatch.makeRe(glob, options, false, true); + + const state = regex.state; + delete regex.state; + + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; + isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + } + + const matcher = (input, returnObject = false) => { + const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); + const result = { glob, state, regex, posix, input, output, match, isMatch }; + + if (typeof opts.onResult === 'function') { + opts.onResult(result); + } + + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + + if (isIgnored(input)) { + if (typeof opts.onIgnore === 'function') { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; + } + + if (typeof opts.onMatch === 'function') { + opts.onMatch(result); + } + return returnObject ? result : true; + }; + + if (returnState) { + matcher.state = state; + } + + return matcher; +}; + +/** + * Test `input` with the given `regex`. This is used by the main + * `picomatch()` function to test the input string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.test(input, regex[, options]); + * + * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); + * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } + * ``` + * @param {String} `input` String to test. + * @param {RegExp} `regex` + * @return {Object} Returns an object with matching info. + * @api public + */ + +picomatch.test = (input, regex, options, { glob, posix } = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected input to be a string'); + } + + if (input === '') { + return { isMatch: false, output: '' }; + } + + const opts = options || {}; + const format = opts.format || (posix ? utils.toPosixSlashes : null); + let match = input === glob; + let output = (match && format) ? format(input) : input; + + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } + + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } + + return { isMatch: Boolean(match), match, output }; +}; + +/** + * Match the basename of a filepath. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.matchBase(input, glob[, options]); + * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true + * ``` + * @param {String} `input` String to test. + * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). + * @return {Boolean} + * @api public + */ + +picomatch.matchBase = (input, glob, options) => { + const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); + return regex.test(utils.basename(input)); +}; + +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.isMatch(string, patterns[, options]); + * + * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String|Array} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const picomatch = require('picomatch'); + * const result = picomatch.parse(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as a regex source string. + * @api public + */ + +picomatch.parse = (pattern, options) => { + if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); + return parse(pattern, { ...options, fastpaths: false }); +}; + +/** + * Scan a glob pattern to separate the pattern into segments. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.scan(input[, options]); + * + * const result = picomatch.scan('!./foo/*.js'); + * console.log(result); + * { prefix: '!./', + * input: '!./foo/*.js', + * start: 3, + * base: 'foo', + * glob: '*.js', + * isBrace: false, + * isBracket: false, + * isGlob: true, + * isExtglob: false, + * isGlobstar: false, + * negated: true } + * ``` + * @param {String} `input` Glob pattern to scan. + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ + +picomatch.scan = (input, options) => scan(input, options); + +/** + * Compile a regular expression from the `state` object returned by the + * [parse()](#parse) method. + * + * @param {Object} `state` + * @param {Object} `options` + * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. + * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. + * @return {RegExp} + * @api public + */ + +picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return state.output; + } + + const opts = options || {}; + const prepend = opts.contains ? '' : '^'; + const append = opts.contains ? '' : '$'; + + let source = `${prepend}(?:${state.output})${append}`; + if (state && state.negated === true) { + source = `^(?!${source}).*$`; + } + + const regex = picomatch.toRegex(source, options); + if (returnState === true) { + regex.state = state; + } + + return regex; +}; + +/** + * Create a regular expression from a parsed glob pattern. + * + * ```js + * const picomatch = require('picomatch'); + * const state = picomatch.parse('*.js'); + * // picomatch.compileRe(state[, options]); + * + * console.log(picomatch.compileRe(state)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `state` The object returned from the `.parse` method. + * @param {Object} `options` + * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. + * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { + if (!input || typeof input !== 'string') { + throw new TypeError('Expected a non-empty string'); + } + + let parsed = { negated: false, fastpaths: true }; + + if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { + parsed.output = parse.fastpaths(input, options); + } + + if (!parsed.output) { + parsed = parse(input, options); + } + + return picomatch.compileRe(parsed, options, returnOutput, returnState); +}; + +/** + * Create a regular expression from the given regex source string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.toRegex(source[, options]); + * + * const { output } = picomatch.parse('*.js'); + * console.log(picomatch.toRegex(output)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `source` Regular expression source string. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +picomatch.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); + } catch (err) { + if (options && options.debug === true) throw err; + return /$^/; + } +}; + +/** + * Picomatch constants. + * @return {Object} + */ + +picomatch.constants = constants; + +/** + * Expose "picomatch" + */ + +module.exports = picomatch; diff --git a/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/scan.js b/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/scan.js new file mode 100644 index 00000000..e59cd7a1 --- /dev/null +++ b/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/scan.js @@ -0,0 +1,391 @@ +'use strict'; + +const utils = require('./utils'); +const { + CHAR_ASTERISK, /* * */ + CHAR_AT, /* @ */ + CHAR_BACKWARD_SLASH, /* \ */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_EXCLAMATION_MARK, /* ! */ + CHAR_FORWARD_SLASH, /* / */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_PLUS, /* + */ + CHAR_QUESTION_MARK, /* ? */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_RIGHT_SQUARE_BRACKET /* ] */ +} = require('./constants'); + +const isPathSeparator = code => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; +}; + +const depth = token => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; + } +}; + +/** + * Quickly scans a glob pattern and returns an object with a handful of + * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), + * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not + * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). + * + * ```js + * const pm = require('picomatch'); + * console.log(pm.scan('foo/bar/*.js')); + * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {Object} Returns an object with tokens and regex source string. + * @api public + */ + +const scan = (input, options) => { + const opts = options || {}; + + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let negatedExtglob = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = { value: '', depth: 0, isGlob: false }; + + const eos = () => index >= length; + const peek = () => str.charCodeAt(index + 1); + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + + while (index < length) { + code = advance(); + let next; + + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + + if (code === CHAR_LEFT_CURLY_BRACE) { + braceEscaped = true; + } + continue; + } + + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { + braces++; + + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (code === CHAR_LEFT_CURLY_BRACE) { + braces++; + continue; + } + + if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (braceEscaped !== true && code === CHAR_COMMA) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_RIGHT_CURLY_BRACE) { + braces--; + + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = { value: '', depth: 0, isGlob: false }; + + if (finished === true) continue; + if (prev === CHAR_DOT && index === (start + 1)) { + start += 2; + continue; + } + + lastIndex = index + 1; + continue; + } + + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS + || code === CHAR_AT + || code === CHAR_ASTERISK + || code === CHAR_QUESTION_MARK + || code === CHAR_EXCLAMATION_MARK; + + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + if (code === CHAR_EXCLAMATION_MARK && index === start) { + negatedExtglob = true; + } + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES) { + isGlob = token.isGlob = true; + finished = true; + break; + } + } + continue; + } + break; + } + } + + if (code === CHAR_ASTERISK) { + if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_LEFT_SQUARE_BRACKET) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + break; + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_LEFT_PARENTHESES) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES) { + finished = true; + break; + } + } + continue; + } + break; + } + + if (isGlob === true) { + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + } + + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } + + let base = str; + let prefix = ''; + let glob = ''; + + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } + + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob = str.slice(lastIndex); + } else if (isGlob === true) { + base = ''; + glob = str; + } else { + base = str; + } + + if (base && base !== '' && base !== '/' && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } + + if (opts.unescape === true) { + if (glob) glob = utils.removeBackslashes(glob); + + if (base && backslashes === true) { + base = utils.removeBackslashes(base); + } + } + + const state = { + prefix, + input, + start, + base, + glob, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated, + negatedExtglob + }; + + if (opts.tokens === true) { + state.maxDepth = 0; + if (!isPathSeparator(code)) { + tokens.push(token); + } + state.tokens = tokens; + } + + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + + for (let idx = 0; idx < slashes.length; idx++) { + const n = prevIndex ? prevIndex + 1 : start; + const i = slashes[idx]; + const value = input.slice(n, i); + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; + } + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; + } + if (idx !== 0 || value !== '') { + parts.push(value); + } + prevIndex = i; + } + + if (prevIndex && prevIndex + 1 < input.length) { + const value = input.slice(prevIndex + 1); + parts.push(value); + + if (opts.tokens) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + } + + state.slashes = slashes; + state.parts = parts; + } + + return state; +}; + +module.exports = scan; diff --git a/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/utils.js b/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/utils.js new file mode 100644 index 00000000..9c97cae2 --- /dev/null +++ b/node_modules/@rollup/pluginutils/node_modules/picomatch/lib/utils.js @@ -0,0 +1,72 @@ +/*global navigator*/ +'use strict'; + +const { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL +} = require('./constants'); + +exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); +exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); +exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); +exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); +exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); + +exports.isWindows = () => { + if (typeof navigator !== 'undefined' && navigator.platform) { + const platform = navigator.platform.toLowerCase(); + return platform === 'win32' || platform === 'windows'; + } + + if (typeof process !== 'undefined' && process.platform) { + return process.platform === 'win32'; + } + + return false; +}; + +exports.removeBackslashes = str => { + return str.replace(REGEX_REMOVE_BACKSLASH, match => { + return match === '\\' ? '' : match; + }); +}; + +exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) return input; + if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; +}; + +exports.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith('./')) { + output = output.slice(2); + state.prefix = './'; + } + return output; +}; + +exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? '' : '^'; + const append = options.contains ? '' : '$'; + + let output = `${prepend}(?:${input})${append}`; + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; + } + return output; +}; + +exports.basename = (path, { windows } = {}) => { + const segs = path.split(windows ? /[\\/]/ : '/'); + const last = segs[segs.length - 1]; + + if (last === '') { + return segs[segs.length - 2]; + } + + return last; +}; diff --git a/node_modules/@rollup/pluginutils/node_modules/picomatch/package.json b/node_modules/@rollup/pluginutils/node_modules/picomatch/package.json new file mode 100644 index 00000000..703a83dc --- /dev/null +++ b/node_modules/@rollup/pluginutils/node_modules/picomatch/package.json @@ -0,0 +1,83 @@ +{ + "name": "picomatch", + "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", + "version": "4.0.2", + "homepage": "https://github.com/micromatch/picomatch", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "funding": "https://github.com/sponsors/jonschlinkert", + "repository": "micromatch/picomatch", + "bugs": { + "url": "https://github.com/micromatch/picomatch/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "posix.js", + "lib" + ], + "sideEffects": false, + "main": "index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", + "mocha": "mocha --reporter dot", + "test": "npm run lint && npm run mocha", + "test:ci": "npm run test:cover", + "test:cover": "nyc npm run mocha" + }, + "devDependencies": { + "eslint": "^8.57.0", + "fill-range": "^7.0.1", + "gulp-format-md": "^2.0.0", + "mocha": "^10.4.0", + "nyc": "^15.1.0", + "time-require": "github:jonschlinkert/time-require" + }, + "keywords": [ + "glob", + "match", + "picomatch" + ], + "nyc": { + "reporter": [ + "html", + "lcov", + "text-summary" + ] + }, + "verb": { + "toc": { + "render": true, + "method": "preWrite", + "maxdepth": 3 + }, + "layout": "empty", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "braces", + "micromatch" + ] + }, + "reflinks": [ + "braces", + "expand-brackets", + "extglob", + "fill-range", + "micromatch", + "minimatch", + "nanomatch", + "picomatch" + ] + } +} diff --git a/node_modules/@rollup/pluginutils/node_modules/picomatch/posix.js b/node_modules/@rollup/pluginutils/node_modules/picomatch/posix.js new file mode 100644 index 00000000..d2f2bc59 --- /dev/null +++ b/node_modules/@rollup/pluginutils/node_modules/picomatch/posix.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/picomatch'); diff --git a/node_modules/@sveltejs/adapter-auto/LICENSE b/node_modules/@sveltejs/adapter-auto/LICENSE new file mode 100644 index 00000000..22efd0c0 --- /dev/null +++ b/node_modules/@sveltejs/adapter-auto/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/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. \ No newline at end of file diff --git a/node_modules/@sveltejs/adapter-auto/README.md b/node_modules/@sveltejs/adapter-auto/README.md new file mode 100644 index 00000000..ed963353 --- /dev/null +++ b/node_modules/@sveltejs/adapter-auto/README.md @@ -0,0 +1,11 @@ +# adapter-auto + +Automatically chooses the SvelteKit adapter for your current environment, if possible. + +## Docs + +[Docs](https://svelte.dev/docs/kit/adapter-auto) + +## Changelog + +[The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/main/packages/adapter-auto/CHANGELOG.md). diff --git a/node_modules/@sveltejs/adapter-auto/adapters.js b/node_modules/@sveltejs/adapter-auto/adapters.js new file mode 100644 index 00000000..edf9e343 --- /dev/null +++ b/node_modules/@sveltejs/adapter-auto/adapters.js @@ -0,0 +1,42 @@ +import process from 'node:process'; + +// List of adapters to check for. `version` is used to pin the installed adapter version and should point +// to the latest version of the adapter that is compatible with adapter-auto's current peerDependency version of SvelteKit. +export const adapters = [ + { + name: 'Vercel', + test: () => !!process.env.VERCEL, + module: '@sveltejs/adapter-vercel', + version: '4' + }, + { + name: 'Cloudflare Pages', + test: () => !!process.env.CF_PAGES, + module: '@sveltejs/adapter-cloudflare', + version: '3' + }, + { + name: 'Netlify', + test: () => !!process.env.NETLIFY, + module: '@sveltejs/adapter-netlify', + version: '3' + }, + { + name: 'Azure Static Web Apps', + test: () => process.env.GITHUB_ACTION_REPOSITORY === 'Azure/static-web-apps-deploy', + module: 'svelte-adapter-azure-swa', + version: '0.20' + }, + { + name: 'AWS via SST', + test: () => !!process.env.SST, + module: 'svelte-kit-sst', + version: '2' + }, + { + name: 'Google Cloud Run', + test: () => !!process.env.GCP_BUILDPACKS, + module: '@sveltejs/adapter-node', + version: '5' + } +]; diff --git a/node_modules/@sveltejs/adapter-auto/index.d.ts b/node_modules/@sveltejs/adapter-auto/index.d.ts new file mode 100644 index 00000000..90af12a0 --- /dev/null +++ b/node_modules/@sveltejs/adapter-auto/index.d.ts @@ -0,0 +1,3 @@ +import { Adapter } from '@sveltejs/kit'; + +export default function plugin(): Adapter; diff --git a/node_modules/@sveltejs/adapter-auto/index.js b/node_modules/@sveltejs/adapter-auto/index.js new file mode 100644 index 00000000..c83ba624 --- /dev/null +++ b/node_modules/@sveltejs/adapter-auto/index.js @@ -0,0 +1,130 @@ +import { execSync } from 'node:child_process'; +import { pathToFileURL } from 'node:url'; +import { resolve } from 'import-meta-resolve'; +import { adapters } from './adapters.js'; +import { dirname, join } from 'node:path'; +import { existsSync } from 'node:fs'; +import process from 'node:process'; + +/** @type {Record string>} */ +const commands = { + npm: (name, version) => `npm install -D ${name}@${version}`, + pnpm: (name, version) => `pnpm add -D ${name}@${version}`, + yarn: (name, version) => `yarn add -D ${name}@${version}`, + bun: (name, version) => `bun add -D ${name}@${version}` +}; + +function detect_lockfile() { + let dir = process.cwd(); + + do { + if (existsSync(join(dir, 'pnpm-lock.yaml'))) return 'pnpm'; + if (existsSync(join(dir, 'yarn.lock'))) return 'yarn'; + if (existsSync(join(dir, 'package-lock.json'))) return 'npm'; + if (existsSync(join(dir, 'bun.lockb')) || existsSync(join(dir, 'bun.lock'))) return 'bun'; + } while (dir !== (dir = dirname(dir))); + + return 'npm'; +} + +function detect_package_manager() { + const manager = detect_lockfile(); + + try { + execSync(`${manager} --version`); + return manager; + } catch { + return 'npm'; + } +} + +/** @param {string} name */ +function import_from_cwd(name) { + const cwd = pathToFileURL(process.cwd()).href; + const url = resolve(name, cwd + '/x.js'); + + return import(url); +} + +/** @typedef {import('@sveltejs/kit').Adapter} Adapter */ + +/** + * @returns {Promise} The corresponding adapter for the current environment if found otherwise undefined + */ +async function get_adapter() { + const match = adapters.find((candidate) => candidate.test()); + + if (!match) return; + + /** @type {{ default: () => Adapter }} */ + let module; + + try { + module = await import_from_cwd(match.module); + } catch (error) { + if ( + error.code === 'ERR_MODULE_NOT_FOUND' && + error.message.startsWith(`Cannot find package '${match.module}'`) + ) { + const package_manager = detect_package_manager(); + const command = commands[package_manager](match.module, match.version); + + try { + console.log(`Installing ${match.module}...`); + + execSync(command, { + stdio: 'inherit', + env: { + ...process.env, + NODE_ENV: undefined + } + }); + + module = await import_from_cwd(match.module); + + console.log(`Successfully installed ${match.module}.`); + console.warn( + `\nIf you plan on staying on this deployment platform, consider replacing @sveltejs/adapter-auto with ${match.module}. This will give you faster and more robust installs, and more control over deployment configuration.\n` + ); + } catch (e) { + throw new Error( + `Could not install ${match.module}. Please install it yourself by adding it to your package.json's devDependencies and try building your project again.`, + { cause: e } + ); + } + } else { + throw error; + } + } + + const adapter = module.default(); + + return { + ...adapter, + adapt: (builder) => { + builder.log.info(`Detected environment: ${match.name}. Using ${match.module}`); + return adapter.adapt(builder); + } + }; +} + +/** @type {() => Adapter} */ +export default () => ({ + name: '@sveltejs/adapter-auto', + adapt: async (builder) => { + const adapter = await get_adapter(); + + if (adapter) return adapter.adapt(builder); + + builder.log.warn( + 'Could not detect a supported production environment. See https://svelte.dev/docs/kit/adapters to learn how to configure your app to run on the platform of your choosing' + ); + }, + supports: { + read: () => { + throw new Error( + "The read function imported from $app/server only works in certain environments. Since you're using @sveltejs/adapter-auto, SvelteKit cannot determine whether it will work when your app is deployed. Please replace it with an adapter tailored to your target environment." + ); + } + } +}); diff --git a/node_modules/@sveltejs/adapter-auto/package.json b/node_modules/@sveltejs/adapter-auto/package.json new file mode 100644 index 00000000..aa111074 --- /dev/null +++ b/node_modules/@sveltejs/adapter-auto/package.json @@ -0,0 +1,53 @@ +{ + "name": "@sveltejs/adapter-auto", + "version": "3.3.1", + "description": "Automatically chooses the SvelteKit adapter for your current environment, if possible.", + "keywords": [ + "adapter", + "automatically", + "deploy", + "hosting", + "platform", + "svelte", + "sveltekit" + ], + "repository": { + "type": "git", + "url": "https://github.com/sveltejs/kit", + "directory": "packages/adapter-auto" + }, + "license": "MIT", + "homepage": "https://svelte.dev", + "type": "module", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.js" + }, + "./package.json": "./package.json" + }, + "types": "index.d.ts", + "files": [ + "files", + "index.js", + "index.d.ts", + "adapters.js" + ], + "devDependencies": { + "@sveltejs/vite-plugin-svelte": "^3.0.1", + "@types/node": "^18.19.48", + "typescript": "^5.3.3", + "@sveltejs/kit": "^2.7.3" + }, + "dependencies": { + "import-meta-resolve": "^4.1.0" + }, + "peerDependencies": { + "@sveltejs/kit": "^2.0.0" + }, + "scripts": { + "lint": "prettier --check .", + "format": "pnpm lint --write", + "check": "tsc" + } +} \ No newline at end of file diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/LICENSE b/node_modules/@sveltejs/vite-plugin-svelte-inspector/LICENSE new file mode 100644 index 00000000..c1a5d8f0 --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 [these people](https://github.com/sveltejs/vite-plugin-svelte/graphs/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/@sveltejs/vite-plugin-svelte-inspector/README.md b/node_modules/@sveltejs/vite-plugin-svelte-inspector/README.md new file mode 100644 index 00000000..bbdf50c8 --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/README.md @@ -0,0 +1,26 @@ +# @sveltejs/vite-plugin-svelte-inspector + +A [Svelte](https://svelte.dev) inspector plugin for [Vite](https://vitejs.dev). + +## Usage + +```js +// vite.config.js +import { defineConfig } from 'vite'; +import { svelte } from '@sveltejs/vite-plugin-svelte'; +import { svelteInspector } from '@sveltejs/vite-plugin-svelte-inspector'; + +export default defineConfig({ + plugins: [ + // the svelte plugin is required to work + svelte(), + svelteInspector({ + /* plugin options */ + }) + ] +}); +``` + +## License + +[MIT](./LICENSE) diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/package.json b/node_modules/@sveltejs/vite-plugin-svelte-inspector/package.json new file mode 100644 index 00000000..45510877 --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/package.json @@ -0,0 +1,56 @@ +{ + "name": "@sveltejs/vite-plugin-svelte-inspector", + "version": "3.0.1", + "license": "MIT", + "author": "dominikg", + "files": [ + "src", + "types" + ], + "type": "module", + "types": "types/index.d.ts", + "exports": { + ".": { + "import": { + "types": "./types/index.d.ts", + "default": "./src/index.js" + } + } + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/sveltejs/vite-plugin-svelte.git", + "directory": "packages/vite-plugin-svelte-inspector" + }, + "keywords": [ + "vite-plugin", + "vite plugin", + "vite", + "svelte" + ], + "bugs": { + "url": "https://github.com/sveltejs/vite-plugin-svelte/issues" + }, + "homepage": "https://github.com/sveltejs/vite-plugin-svelte#readme", + "dependencies": { + "debug": "^4.3.7" + }, + "peerDependencies": { + "@sveltejs/vite-plugin-svelte": "^4.0.0-next.0||^4.0.0", + "svelte": "^5.0.0-next.96 || ^5.0.0", + "vite": "^5.0.0" + }, + "devDependencies": { + "@types/debug": "^4.1.12", + "svelte": "^5.0.3", + "vite": "^5.4.9" + }, + "scripts": { + "check:publint": "publint --strict", + "check:types": "tsc --noEmit", + "generate:types": "dts-buddy -m \"@sveltejs/vite-plugin-svelte-inspector:src/public.d.ts\"" + } +} \ No newline at end of file diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/debug.js b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/debug.js new file mode 100644 index 00000000..0575a83f --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/debug.js @@ -0,0 +1,3 @@ +import _debug from 'debug'; + +export const debug = _debug('vite-plugin-svelte-inspector'); diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/index.js b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/index.js new file mode 100644 index 00000000..3b697832 --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/index.js @@ -0,0 +1,112 @@ +import { normalizePath } from 'vite'; +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { debug } from './debug.js'; +import { defaultInspectorOptions, parseEnvironmentOptions } from './options.js'; +import { cleanUrl } from './utils.js'; + +function getInspectorPath() { + const pluginPath = normalizePath(path.dirname(fileURLToPath(import.meta.url))); + return pluginPath.replace( + /\/vite-plugin-svelte-inspector\/src$/, + '/vite-plugin-svelte-inspector/src/runtime/' + ); +} + +/** + * @param {Partial} [options] + * @returns {import('vite').Plugin} + */ +export function svelteInspector(options) { + const inspectorPath = getInspectorPath(); + debug(`svelte inspector path: ${inspectorPath}`); + + /** @type {import('vite').ResolvedConfig} */ + let viteConfig; + /** @type {import('./public.d.ts').Options} */ + let inspectorOptions; + let disabled = false; + + return { + name: 'vite-plugin-svelte-inspector', + apply: 'serve', + enforce: 'pre', + + configResolved(config) { + viteConfig = config; + const environmentOptions = parseEnvironmentOptions(config); + if (environmentOptions === false) { + debug('environment options set to false, inspector disabled'); + disabled = true; + return; + } + + // Handle config from svelte.config.js through vite-plugin-svelte + const vps = config.plugins.find((p) => p.name === 'vite-plugin-svelte'); + const configFileOptions = vps?.api?.options?.inspector; + + // vite-plugin-svelte can only pass options through it's `api` instead of `options`. + // that means this plugin could be created but should be disabled, so we check this case here. + if (vps && !options && !configFileOptions && !environmentOptions) { + debug("vite-plugin-svelte didn't pass options, inspector disabled"); + disabled = true; + return; + } + + if (environmentOptions === true) { + inspectorOptions = defaultInspectorOptions; + } else { + inspectorOptions = { + ...defaultInspectorOptions, + ...configFileOptions, + ...options, + ...(environmentOptions || {}) + }; + } + + inspectorOptions.__internal = { + base: config.base?.replace(/\/$/, '') || '' + }; + }, + + async resolveId(importee, _, options) { + if (options?.ssr || disabled) { + return; + } + if (importee.startsWith('virtual:svelte-inspector-options')) { + return importee; + } else if (importee.startsWith('virtual:svelte-inspector-path:')) { + return importee.replace('virtual:svelte-inspector-path:', inspectorPath); + } + }, + + async load(id, options) { + if (options?.ssr || disabled) { + return; + } + if (id === 'virtual:svelte-inspector-options') { + return `export default ${JSON.stringify(inspectorOptions ?? {})}`; + } else if (id.startsWith(inspectorPath)) { + // read file ourselves to avoid getting shut out by vites fs.allow check + const file = cleanUrl(id); + if (fs.existsSync(id)) { + return await fs.promises.readFile(file, 'utf-8'); + } else { + viteConfig.logger.error( + `[vite-plugin-svelte-inspector] failed to find svelte-inspector: ${id}` + ); + } + } + }, + + transform(code, id, options) { + if (options?.ssr || disabled) { + return; + } + if (id.includes('vite/dist/client/client.mjs')) { + return { code: `${code}\nimport('virtual:svelte-inspector-path:load-inspector.js')` }; + } + } + }; +} diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/options.js b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/options.js new file mode 100644 index 00000000..15a24564 --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/options.js @@ -0,0 +1,63 @@ +import process from 'node:process'; +import { loadEnv } from 'vite'; +import { debug } from './debug.js'; + +/** @type {import('./public.d.ts').Options} */ +export const defaultInspectorOptions = { + toggleKeyCombo: 'alt-x', + navKeys: { parent: 'ArrowUp', child: 'ArrowDown', next: 'ArrowRight', prev: 'ArrowLeft' }, + escapeKeys: ['Backspace', 'Escape'], + openKey: 'Enter', + holdMode: true, + showToggleButton: 'active', + toggleButtonPos: 'top-right', + customStyles: true +}; + +/** + * @param {import('vite').ResolvedConfig} config + * @returns {Partial | boolean | void} + */ +export function parseEnvironmentOptions(config) { + const env = loadEnv(config.mode, config.envDir ?? process.cwd(), 'SVELTE_INSPECTOR'); + const options = env?.SVELTE_INSPECTOR_OPTIONS; + const toggle = env?.SVELTE_INSPECTOR_TOGGLE; + if (options) { + try { + const parsed = JSON.parse(options); + const parsedType = typeof parsed; + if (parsedType === 'boolean') { + return parsed; + } else if (parsedType === 'object') { + if (Array.isArray(parsed)) { + throw new Error('invalid type, expected object map but got array'); + } + const parsedKeys = Object.keys(parsed); + const defaultKeys = Object.keys(defaultInspectorOptions); + const unknownKeys = parsedKeys.filter((k) => !defaultKeys.includes(k)); + if (unknownKeys.length) { + config.logger.warn( + `[vite-plugin-svelte-inspector] ignoring unknown options in environment SVELTE_INSPECTOR_OPTIONS: ${unknownKeys.join( + ', ' + )}` + ); + for (const key of unknownKeys) { + delete parsed[key]; + } + } + debug('loaded environment config', parsed); + return parsed; + } + } catch (e) { + config.logger.error( + `[vite-plugin-svelte-inspector] failed to parse inspector options from environment SVELTE_INSPECTOR_OPTIONS="${options}"\n${e}` + ); + } + } else if (toggle) { + const keyConfig = { + toggleKeyCombo: toggle + }; + debug('loaded environment config', keyConfig); + return keyConfig; + } +} diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/public.d.ts b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/public.d.ts new file mode 100644 index 00000000..6849623b --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/public.d.ts @@ -0,0 +1,78 @@ +export interface Options { + /** + * define a key combo to toggle inspector, + * @default 'meta-shift' on mac, 'control-shift' on other os + * + * any number of modifiers `control` `shift` `alt` `meta` followed by zero or one regular key, separated by - + * examples: control-shift, control-o, control-alt-s meta-x control-meta + * Some keys have native behavior (e.g. alt-s opens history menu on firefox). + * To avoid conflicts or accidentally typing into inputs, modifier only combinations are recommended. + */ + toggleKeyCombo?: string; + + /** + * define keys to select elements with via keyboard + * @default {parent: 'ArrowUp', child: 'ArrowDown', next: 'ArrowRight', prev: 'ArrowLeft' } + * + * improves accessibility and also helps when you want to select elements that do not have a hoverable surface area + * due to tight wrapping + * + * A note for users of screen-readers: + * If you are using arrow keys to navigate the page itself, change the navKeys to avoid conflicts. + * e.g. navKeys: {parent: 'w', prev: 'a', child: 's', next: 'd'} + * + * + * parent: select closest parent + * child: select first child (or grandchild) + * next: next sibling (or parent if no next sibling exists) + * prev: previous sibling (or parent if no prev sibling exists) + */ + navKeys?: { parent: string; child: string; next: string; prev: string }; + + /** + * define key to open the editor for the currently selected dom node + * + * @default 'Enter' + */ + openKey?: string; + + /** + * define keys to close the inspector + * @default ['Backspace', 'Escape'] + */ + escapeKeys?: string[]; + + /** + * inspector is automatically disabled when releasing toggleKeyCombo after holding it for a longpress + * @default true + */ + holdMode?: boolean; + + /** + * when to show the toggle button + * @default 'active' + */ + showToggleButton?: 'always' | 'active' | 'never'; + + /** + * where to display the toggle button + * @default top-right + */ + toggleButtonPos?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; + + /** + * inject custom styles when inspector is active + */ + customStyles?: boolean; + + /** + * internal options that are automatically set, not to be set or used by users + * @internal + */ + __internal?: { + // vite base url + base: string; + }; +} +// eslint-disable-next-line n/no-missing-import +export * from './index.js'; diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/Inspector.svelte b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/Inspector.svelte new file mode 100644 index 00000000..9a03c49c --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/Inspector.svelte @@ -0,0 +1,411 @@ + + + + +{#if show_toggle} + +{/if} +{#if enabled && active_el && file_loc} + {@const loc = active_el.__svelte_meta.loc} +
+ <{active_el.tagName.toLowerCase()}> {file_loc} +
+
+ {active_el.tagName.toLowerCase()} in file {loc.file} on line {loc.line} column {loc.column} +
+{/if} + + diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/load-inspector.js b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/load-inspector.js new file mode 100644 index 00000000..5662f9fa --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/load-inspector.js @@ -0,0 +1,14 @@ +// eslint-disable-next-line n/no-missing-import +import Inspector from 'virtual:svelte-inspector-path:Inspector.svelte'; +import { mount } from 'svelte'; +function create_inspector_host() { + const id = 'svelte-inspector-host'; + if (document.getElementById(id) != null) { + throw new Error('svelte-inspector-host element already exists'); + } + const el = document.createElement('div'); + el.setAttribute('id', id); + document.documentElement.appendChild(el); + return el; +} +mount(Inspector, { target: create_inspector_host() }); diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/utils.js b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/utils.js new file mode 100644 index 00000000..bcb43f9f --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/utils.js @@ -0,0 +1,8 @@ +const postfixRE = /[?#].*$/s; + +/** + * @param {string} url + */ +export function cleanUrl(url) { + return url.replace(postfixRE, ''); +} diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts b/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts new file mode 100644 index 00000000..3c88a1e4 --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts @@ -0,0 +1,82 @@ +declare module '@sveltejs/vite-plugin-svelte-inspector' { + export interface Options { + /** + * define a key combo to toggle inspector, + * @default 'meta-shift' on mac, 'control-shift' on other os + * + * any number of modifiers `control` `shift` `alt` `meta` followed by zero or one regular key, separated by - + * examples: control-shift, control-o, control-alt-s meta-x control-meta + * Some keys have native behavior (e.g. alt-s opens history menu on firefox). + * To avoid conflicts or accidentally typing into inputs, modifier only combinations are recommended. + */ + toggleKeyCombo?: string; + + /** + * define keys to select elements with via keyboard + * @default {parent: 'ArrowUp', child: 'ArrowDown', next: 'ArrowRight', prev: 'ArrowLeft' } + * + * improves accessibility and also helps when you want to select elements that do not have a hoverable surface area + * due to tight wrapping + * + * A note for users of screen-readers: + * If you are using arrow keys to navigate the page itself, change the navKeys to avoid conflicts. + * e.g. navKeys: {parent: 'w', prev: 'a', child: 's', next: 'd'} + * + * + * parent: select closest parent + * child: select first child (or grandchild) + * next: next sibling (or parent if no next sibling exists) + * prev: previous sibling (or parent if no prev sibling exists) + */ + navKeys?: { parent: string; child: string; next: string; prev: string }; + + /** + * define key to open the editor for the currently selected dom node + * + * @default 'Enter' + */ + openKey?: string; + + /** + * define keys to close the inspector + * @default ['Backspace', 'Escape'] + */ + escapeKeys?: string[]; + + /** + * inspector is automatically disabled when releasing toggleKeyCombo after holding it for a longpress + * @default true + */ + holdMode?: boolean; + + /** + * when to show the toggle button + * @default 'active' + */ + showToggleButton?: 'always' | 'active' | 'never'; + + /** + * where to display the toggle button + * @default top-right + */ + toggleButtonPos?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; + + /** + * inject custom styles when inspector is active + */ + customStyles?: boolean; + + /** + * internal options that are automatically set, not to be set or used by users + * */ + __internal?: { + // vite base url + base: string; + }; + } + export function svelteInspector(options?: Partial | undefined): import("vite").Plugin; + + export {}; +} + +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts.map b/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts.map new file mode 100644 index 00000000..08ac0458 --- /dev/null +++ b/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts.map @@ -0,0 +1,17 @@ +{ + "version": 3, + "file": "index.d.ts", + "names": [ + "Options", + "svelteInspector" + ], + "sources": [ + "../src/public.d.ts", + "../src/index.js" + ], + "sourcesContent": [ + null, + null + ], + "mappings": ";kBAAiBA,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCoBRC,eAAeA" +} \ No newline at end of file diff --git a/node_modules/@types/cookie/LICENSE b/node_modules/@types/cookie/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/cookie/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + 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/@types/cookie/README.md b/node_modules/@types/cookie/README.md new file mode 100644 index 00000000..d2811ae8 --- /dev/null +++ b/node_modules/@types/cookie/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/cookie` + +# Summary +This package contains type definitions for cookie (https://github.com/jshttp/cookie). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie. + +### Additional Details + * Last updated: Sun, 26 Nov 2023 22:07:01 GMT + * Dependencies: none + +# Credits +These definitions were written by [Pine Mizune](https://github.com/pine), and [Piotr Błażejewicz](https://github.com/peterblazejewicz). diff --git a/node_modules/@types/cookie/index.d.ts b/node_modules/@types/cookie/index.d.ts new file mode 100644 index 00000000..4800c73c --- /dev/null +++ b/node_modules/@types/cookie/index.d.ts @@ -0,0 +1,154 @@ +/** + * Basic HTTP cookie parser and serializer for HTTP servers. + */ + +/** + * Additional serialization options + */ +export interface CookieSerializeOptions { + /** + * Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.3|Domain Set-Cookie attribute}. By default, no + * domain is set, and most clients will consider the cookie to apply to only + * the current domain. + */ + domain?: string | undefined; + + /** + * Specifies a function that will be used to encode a cookie's value. Since + * value of a cookie has a limited character set (and must be a simple + * string), this function can be used to encode a value into a string suited + * for a cookie's value. + * + * The default function is the global `encodeURIComponent`, which will + * encode a JavaScript string into UTF-8 byte sequences and then URL-encode + * any that fall outside of the cookie range. + */ + encode?(value: string): string; + + /** + * Specifies the `Date` object to be the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.1|`Expires` `Set-Cookie` attribute}. By default, + * no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete + * it on a condition like exiting a web browser application. + * + * *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification} + * states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is + * possible not all clients by obey this, so if both are set, they should + * point to the same date and time. + */ + expires?: Date | undefined; + /** + * Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.6|`HttpOnly` `Set-Cookie` attribute}. + * When truthy, the `HttpOnly` attribute is set, otherwise it is not. By + * default, the `HttpOnly` attribute is not set. + * + * *Note* be careful when setting this to true, as compliant clients will + * not allow client-side JavaScript to see the cookie in `document.cookie`. + */ + httpOnly?: boolean | undefined; + /** + * Specifies the number (in seconds) to be the value for the `Max-Age` + * `Set-Cookie` attribute. The given number will be converted to an integer + * by rounding down. By default, no maximum age is set. + * + * *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification} + * states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is + * possible not all clients by obey this, so if both are set, they should + * point to the same date and time. + */ + maxAge?: number | undefined; + /** + * Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies) + * attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the + * `Partitioned` attribute is not set. + * + * **note** This is an attribute that has not yet been fully standardized, and may change in the future. + * This also means many clients may ignore this attribute until they understand it. + * + * More information about can be found in [the proposal](https://github.com/privacycg/CHIPS) + */ + partitioned?: boolean | undefined; + /** + * Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.4|`Path` `Set-Cookie` attribute}. + * By default, the path is considered the "default path". + */ + path?: string | undefined; + /** + * Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1]. + * + * - `'low'` will set the `Priority` attribute to `Low`. + * - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. + * - `'high'` will set the `Priority` attribute to `High`. + * + * More information about the different priority levels can be found in + * [the specification][rfc-west-cookie-priority-00-4.1]. + * + * **note** This is an attribute that has not yet been fully standardized, and may change in the future. + * This also means many clients may ignore this attribute until they understand it. + */ + priority?: "low" | "medium" | "high" | undefined; + /** + * Specifies the boolean or string to be the value for the {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|`SameSite` `Set-Cookie` attribute}. + * + * - `true` will set the `SameSite` attribute to `Strict` for strict same + * site enforcement. + * - `false` will not set the `SameSite` attribute. + * - `'lax'` will set the `SameSite` attribute to Lax for lax same site + * enforcement. + * - `'strict'` will set the `SameSite` attribute to Strict for strict same + * site enforcement. + * - `'none'` will set the SameSite attribute to None for an explicit + * cross-site cookie. + * + * More information about the different enforcement levels can be found in {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|the specification}. + * + * *note* This is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it. + */ + sameSite?: true | false | "lax" | "strict" | "none" | undefined; + /** + * Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.5|`Secure` `Set-Cookie` attribute}. When truthy, the + * `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. + * + * *Note* be careful when setting this to `true`, as compliant clients will + * not send the cookie back to the server in the future if the browser does + * not have an HTTPS connection. + */ + secure?: boolean | undefined; +} + +/** + * Additional parsing options + */ +export interface CookieParseOptions { + /** + * Specifies a function that will be used to decode a cookie's value. Since + * the value of a cookie has a limited character set (and must be a simple + * string), this function can be used to decode a previously-encoded cookie + * value into a JavaScript string or other object. + * + * The default function is the global `decodeURIComponent`, which will decode + * any URL-encoded sequences into their byte representations. + * + * *Note* if an error is thrown from this function, the original, non-decoded + * cookie value will be returned as the cookie's value. + */ + decode?(value: string): string; +} + +/** + * Parse an HTTP Cookie header string and returning an object of all cookie + * name-value pairs. + * + * @param str the string representing a `Cookie` header value + * @param [options] object containing parsing options + */ +export function parse(str: string, options?: CookieParseOptions): Record; + +/** + * Serialize a cookie name-value pair into a `Set-Cookie` header string. + * + * @param name the name for the cookie + * @param value value to set the cookie to + * @param [options] object containing serialization options + * @throws {TypeError} when `maxAge` options is invalid + */ +export function serialize(name: string, value: string, options?: CookieSerializeOptions): string; diff --git a/node_modules/@types/cookie/package.json b/node_modules/@types/cookie/package.json new file mode 100644 index 00000000..683b1e51 --- /dev/null +++ b/node_modules/@types/cookie/package.json @@ -0,0 +1,30 @@ +{ + "name": "@types/cookie", + "version": "0.6.0", + "description": "TypeScript definitions for cookie", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie", + "license": "MIT", + "contributors": [ + { + "name": "Pine Mizune", + "githubUsername": "pine", + "url": "https://github.com/pine" + }, + { + "name": "Piotr Błażejewicz", + "githubUsername": "peterblazejewicz", + "url": "https://github.com/peterblazejewicz" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/cookie" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "0fbdf9c886fb40c8dc7677b8b7d0f9e02ac5235e163d90244a4fb9004736a575", + "typeScriptVersion": "4.5" +} \ No newline at end of file diff --git a/node_modules/@types/estree/LICENSE b/node_modules/@types/estree/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/estree/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + 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/@types/estree/README.md b/node_modules/@types/estree/README.md new file mode 100644 index 00000000..5a6f4c85 --- /dev/null +++ b/node_modules/@types/estree/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/estree` + +# Summary +This package contains type definitions for estree (https://github.com/estree/estree). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree. + +### Additional Details + * Last updated: Wed, 18 Sep 2024 09:37:00 GMT + * Dependencies: none + +# Credits +These definitions were written by [RReverser](https://github.com/RReverser). diff --git a/node_modules/@types/estree/flow.d.ts b/node_modules/@types/estree/flow.d.ts new file mode 100644 index 00000000..9d001a92 --- /dev/null +++ b/node_modules/@types/estree/flow.d.ts @@ -0,0 +1,167 @@ +declare namespace ESTree { + interface FlowTypeAnnotation extends Node {} + + interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {} + + interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {} + + interface FlowDeclaration extends Declaration {} + + interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface ArrayTypeAnnotation extends FlowTypeAnnotation { + elementType: FlowTypeAnnotation; + } + + interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface ClassImplements extends Node { + id: Identifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface ClassProperty { + key: Expression; + value?: Expression | null; + typeAnnotation?: TypeAnnotation | null; + computed: boolean; + static: boolean; + } + + interface DeclareClass extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + body: ObjectTypeAnnotation; + extends: InterfaceExtends[]; + } + + interface DeclareFunction extends FlowDeclaration { + id: Identifier; + } + + interface DeclareModule extends FlowDeclaration { + id: Literal | Identifier; + body: BlockStatement; + } + + interface DeclareVariable extends FlowDeclaration { + id: Identifier; + } + + interface FunctionTypeAnnotation extends FlowTypeAnnotation { + params: FunctionTypeParam[]; + returnType: FlowTypeAnnotation; + rest?: FunctionTypeParam | null; + typeParameters?: TypeParameterDeclaration | null; + } + + interface FunctionTypeParam { + name: Identifier; + typeAnnotation: FlowTypeAnnotation; + optional: boolean; + } + + interface GenericTypeAnnotation extends FlowTypeAnnotation { + id: Identifier | QualifiedTypeIdentifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface InterfaceExtends extends Node { + id: Identifier | QualifiedTypeIdentifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface InterfaceDeclaration extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + extends: InterfaceExtends[]; + body: ObjectTypeAnnotation; + } + + interface IntersectionTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface NullableTypeAnnotation extends FlowTypeAnnotation { + typeAnnotation: TypeAnnotation; + } + + interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface StringTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface TupleTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface TypeofTypeAnnotation extends FlowTypeAnnotation { + argument: FlowTypeAnnotation; + } + + interface TypeAlias extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + right: FlowTypeAnnotation; + } + + interface TypeAnnotation extends Node { + typeAnnotation: FlowTypeAnnotation; + } + + interface TypeCastExpression extends Expression { + expression: Expression; + typeAnnotation: TypeAnnotation; + } + + interface TypeParameterDeclaration extends Node { + params: Identifier[]; + } + + interface TypeParameterInstantiation extends Node { + params: FlowTypeAnnotation[]; + } + + interface ObjectTypeAnnotation extends FlowTypeAnnotation { + properties: ObjectTypeProperty[]; + indexers: ObjectTypeIndexer[]; + callProperties: ObjectTypeCallProperty[]; + } + + interface ObjectTypeCallProperty extends Node { + value: FunctionTypeAnnotation; + static: boolean; + } + + interface ObjectTypeIndexer extends Node { + id: Identifier; + key: FlowTypeAnnotation; + value: FlowTypeAnnotation; + static: boolean; + } + + interface ObjectTypeProperty extends Node { + key: Expression; + value: FlowTypeAnnotation; + optional: boolean; + static: boolean; + } + + interface QualifiedTypeIdentifier extends Node { + qualification: Identifier | QualifiedTypeIdentifier; + id: Identifier; + } + + interface UnionTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {} +} diff --git a/node_modules/@types/estree/index.d.ts b/node_modules/@types/estree/index.d.ts new file mode 100644 index 00000000..81a351f9 --- /dev/null +++ b/node_modules/@types/estree/index.d.ts @@ -0,0 +1,684 @@ +// This definition file follows a somewhat unusual format. ESTree allows +// runtime type checks based on the `type` parameter. In order to explain this +// to typescript we want to use discriminated union types: +// https://github.com/Microsoft/TypeScript/pull/9163 +// +// For ESTree this is a bit tricky because the high level interfaces like +// Node or Function are pulling double duty. We want to pass common fields down +// to the interfaces that extend them (like Identifier or +// ArrowFunctionExpression), but you can't extend a type union or enforce +// common fields on them. So we've split the high level interfaces into two +// types, a base type which passes down inherited fields, and a type union of +// all types which extend the base type. Only the type union is exported, and +// the union is how other types refer to the collection of inheriting types. +// +// This makes the definitions file here somewhat more difficult to maintain, +// but it has the notable advantage of making ESTree much easier to use as +// an end user. + +export interface BaseNodeWithoutComments { + // Every leaf interface that extends BaseNode must specify a type property. + // The type property should be a string literal. For example, Identifier + // has: `type: "Identifier"` + type: string; + loc?: SourceLocation | null | undefined; + range?: [number, number] | undefined; +} + +export interface BaseNode extends BaseNodeWithoutComments { + leadingComments?: Comment[] | undefined; + trailingComments?: Comment[] | undefined; +} + +export interface NodeMap { + AssignmentProperty: AssignmentProperty; + CatchClause: CatchClause; + Class: Class; + ClassBody: ClassBody; + Expression: Expression; + Function: Function; + Identifier: Identifier; + Literal: Literal; + MethodDefinition: MethodDefinition; + ModuleDeclaration: ModuleDeclaration; + ModuleSpecifier: ModuleSpecifier; + Pattern: Pattern; + PrivateIdentifier: PrivateIdentifier; + Program: Program; + Property: Property; + PropertyDefinition: PropertyDefinition; + SpreadElement: SpreadElement; + Statement: Statement; + Super: Super; + SwitchCase: SwitchCase; + TemplateElement: TemplateElement; + VariableDeclarator: VariableDeclarator; +} + +export type Node = NodeMap[keyof NodeMap]; + +export interface Comment extends BaseNodeWithoutComments { + type: "Line" | "Block"; + value: string; +} + +export interface SourceLocation { + source?: string | null | undefined; + start: Position; + end: Position; +} + +export interface Position { + /** >= 1 */ + line: number; + /** >= 0 */ + column: number; +} + +export interface Program extends BaseNode { + type: "Program"; + sourceType: "script" | "module"; + body: Array; + comments?: Comment[] | undefined; +} + +export interface Directive extends BaseNode { + type: "ExpressionStatement"; + expression: Literal; + directive: string; +} + +export interface BaseFunction extends BaseNode { + params: Pattern[]; + generator?: boolean | undefined; + async?: boolean | undefined; + // The body is either BlockStatement or Expression because arrow functions + // can have a body that's either. FunctionDeclarations and + // FunctionExpressions have only BlockStatement bodies. + body: BlockStatement | Expression; +} + +export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression; + +export type Statement = + | ExpressionStatement + | BlockStatement + | StaticBlock + | EmptyStatement + | DebuggerStatement + | WithStatement + | ReturnStatement + | LabeledStatement + | BreakStatement + | ContinueStatement + | IfStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | WhileStatement + | DoWhileStatement + | ForStatement + | ForInStatement + | ForOfStatement + | Declaration; + +export interface BaseStatement extends BaseNode {} + +export interface EmptyStatement extends BaseStatement { + type: "EmptyStatement"; +} + +export interface BlockStatement extends BaseStatement { + type: "BlockStatement"; + body: Statement[]; + innerComments?: Comment[] | undefined; +} + +export interface StaticBlock extends Omit { + type: "StaticBlock"; +} + +export interface ExpressionStatement extends BaseStatement { + type: "ExpressionStatement"; + expression: Expression; +} + +export interface IfStatement extends BaseStatement { + type: "IfStatement"; + test: Expression; + consequent: Statement; + alternate?: Statement | null | undefined; +} + +export interface LabeledStatement extends BaseStatement { + type: "LabeledStatement"; + label: Identifier; + body: Statement; +} + +export interface BreakStatement extends BaseStatement { + type: "BreakStatement"; + label?: Identifier | null | undefined; +} + +export interface ContinueStatement extends BaseStatement { + type: "ContinueStatement"; + label?: Identifier | null | undefined; +} + +export interface WithStatement extends BaseStatement { + type: "WithStatement"; + object: Expression; + body: Statement; +} + +export interface SwitchStatement extends BaseStatement { + type: "SwitchStatement"; + discriminant: Expression; + cases: SwitchCase[]; +} + +export interface ReturnStatement extends BaseStatement { + type: "ReturnStatement"; + argument?: Expression | null | undefined; +} + +export interface ThrowStatement extends BaseStatement { + type: "ThrowStatement"; + argument: Expression; +} + +export interface TryStatement extends BaseStatement { + type: "TryStatement"; + block: BlockStatement; + handler?: CatchClause | null | undefined; + finalizer?: BlockStatement | null | undefined; +} + +export interface WhileStatement extends BaseStatement { + type: "WhileStatement"; + test: Expression; + body: Statement; +} + +export interface DoWhileStatement extends BaseStatement { + type: "DoWhileStatement"; + body: Statement; + test: Expression; +} + +export interface ForStatement extends BaseStatement { + type: "ForStatement"; + init?: VariableDeclaration | Expression | null | undefined; + test?: Expression | null | undefined; + update?: Expression | null | undefined; + body: Statement; +} + +export interface BaseForXStatement extends BaseStatement { + left: VariableDeclaration | Pattern; + right: Expression; + body: Statement; +} + +export interface ForInStatement extends BaseForXStatement { + type: "ForInStatement"; +} + +export interface DebuggerStatement extends BaseStatement { + type: "DebuggerStatement"; +} + +export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration; + +export interface BaseDeclaration extends BaseStatement {} + +export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration { + type: "FunctionDeclaration"; + /** It is null when a function declaration is a part of the `export default function` statement */ + id: Identifier | null; + body: BlockStatement; +} + +export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration { + id: Identifier; +} + +export interface VariableDeclaration extends BaseDeclaration { + type: "VariableDeclaration"; + declarations: VariableDeclarator[]; + kind: "var" | "let" | "const"; +} + +export interface VariableDeclarator extends BaseNode { + type: "VariableDeclarator"; + id: Pattern; + init?: Expression | null | undefined; +} + +export interface ExpressionMap { + ArrayExpression: ArrayExpression; + ArrowFunctionExpression: ArrowFunctionExpression; + AssignmentExpression: AssignmentExpression; + AwaitExpression: AwaitExpression; + BinaryExpression: BinaryExpression; + CallExpression: CallExpression; + ChainExpression: ChainExpression; + ClassExpression: ClassExpression; + ConditionalExpression: ConditionalExpression; + FunctionExpression: FunctionExpression; + Identifier: Identifier; + ImportExpression: ImportExpression; + Literal: Literal; + LogicalExpression: LogicalExpression; + MemberExpression: MemberExpression; + MetaProperty: MetaProperty; + NewExpression: NewExpression; + ObjectExpression: ObjectExpression; + SequenceExpression: SequenceExpression; + TaggedTemplateExpression: TaggedTemplateExpression; + TemplateLiteral: TemplateLiteral; + ThisExpression: ThisExpression; + UnaryExpression: UnaryExpression; + UpdateExpression: UpdateExpression; + YieldExpression: YieldExpression; +} + +export type Expression = ExpressionMap[keyof ExpressionMap]; + +export interface BaseExpression extends BaseNode {} + +export type ChainElement = SimpleCallExpression | MemberExpression; + +export interface ChainExpression extends BaseExpression { + type: "ChainExpression"; + expression: ChainElement; +} + +export interface ThisExpression extends BaseExpression { + type: "ThisExpression"; +} + +export interface ArrayExpression extends BaseExpression { + type: "ArrayExpression"; + elements: Array; +} + +export interface ObjectExpression extends BaseExpression { + type: "ObjectExpression"; + properties: Array; +} + +export interface PrivateIdentifier extends BaseNode { + type: "PrivateIdentifier"; + name: string; +} + +export interface Property extends BaseNode { + type: "Property"; + key: Expression | PrivateIdentifier; + value: Expression | Pattern; // Could be an AssignmentProperty + kind: "init" | "get" | "set"; + method: boolean; + shorthand: boolean; + computed: boolean; +} + +export interface PropertyDefinition extends BaseNode { + type: "PropertyDefinition"; + key: Expression | PrivateIdentifier; + value?: Expression | null | undefined; + computed: boolean; + static: boolean; +} + +export interface FunctionExpression extends BaseFunction, BaseExpression { + id?: Identifier | null | undefined; + type: "FunctionExpression"; + body: BlockStatement; +} + +export interface SequenceExpression extends BaseExpression { + type: "SequenceExpression"; + expressions: Expression[]; +} + +export interface UnaryExpression extends BaseExpression { + type: "UnaryExpression"; + operator: UnaryOperator; + prefix: true; + argument: Expression; +} + +export interface BinaryExpression extends BaseExpression { + type: "BinaryExpression"; + operator: BinaryOperator; + left: Expression | PrivateIdentifier; + right: Expression; +} + +export interface AssignmentExpression extends BaseExpression { + type: "AssignmentExpression"; + operator: AssignmentOperator; + left: Pattern | MemberExpression; + right: Expression; +} + +export interface UpdateExpression extends BaseExpression { + type: "UpdateExpression"; + operator: UpdateOperator; + argument: Expression; + prefix: boolean; +} + +export interface LogicalExpression extends BaseExpression { + type: "LogicalExpression"; + operator: LogicalOperator; + left: Expression; + right: Expression; +} + +export interface ConditionalExpression extends BaseExpression { + type: "ConditionalExpression"; + test: Expression; + alternate: Expression; + consequent: Expression; +} + +export interface BaseCallExpression extends BaseExpression { + callee: Expression | Super; + arguments: Array; +} +export type CallExpression = SimpleCallExpression | NewExpression; + +export interface SimpleCallExpression extends BaseCallExpression { + type: "CallExpression"; + optional: boolean; +} + +export interface NewExpression extends BaseCallExpression { + type: "NewExpression"; +} + +export interface MemberExpression extends BaseExpression, BasePattern { + type: "MemberExpression"; + object: Expression | Super; + property: Expression | PrivateIdentifier; + computed: boolean; + optional: boolean; +} + +export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression; + +export interface BasePattern extends BaseNode {} + +export interface SwitchCase extends BaseNode { + type: "SwitchCase"; + test?: Expression | null | undefined; + consequent: Statement[]; +} + +export interface CatchClause extends BaseNode { + type: "CatchClause"; + param: Pattern | null; + body: BlockStatement; +} + +export interface Identifier extends BaseNode, BaseExpression, BasePattern { + type: "Identifier"; + name: string; +} + +export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral; + +export interface SimpleLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value: string | boolean | number | null; + raw?: string | undefined; +} + +export interface RegExpLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value?: RegExp | null | undefined; + regex: { + pattern: string; + flags: string; + }; + raw?: string | undefined; +} + +export interface BigIntLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value?: bigint | null | undefined; + bigint: string; + raw?: string | undefined; +} + +export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; + +export type BinaryOperator = + | "==" + | "!=" + | "===" + | "!==" + | "<" + | "<=" + | ">" + | ">=" + | "<<" + | ">>" + | ">>>" + | "+" + | "-" + | "*" + | "/" + | "%" + | "**" + | "|" + | "^" + | "&" + | "in" + | "instanceof"; + +export type LogicalOperator = "||" | "&&" | "??"; + +export type AssignmentOperator = + | "=" + | "+=" + | "-=" + | "*=" + | "/=" + | "%=" + | "**=" + | "<<=" + | ">>=" + | ">>>=" + | "|=" + | "^=" + | "&=" + | "||=" + | "&&=" + | "??="; + +export type UpdateOperator = "++" | "--"; + +export interface ForOfStatement extends BaseForXStatement { + type: "ForOfStatement"; + await: boolean; +} + +export interface Super extends BaseNode { + type: "Super"; +} + +export interface SpreadElement extends BaseNode { + type: "SpreadElement"; + argument: Expression; +} + +export interface ArrowFunctionExpression extends BaseExpression, BaseFunction { + type: "ArrowFunctionExpression"; + expression: boolean; + body: BlockStatement | Expression; +} + +export interface YieldExpression extends BaseExpression { + type: "YieldExpression"; + argument?: Expression | null | undefined; + delegate: boolean; +} + +export interface TemplateLiteral extends BaseExpression { + type: "TemplateLiteral"; + quasis: TemplateElement[]; + expressions: Expression[]; +} + +export interface TaggedTemplateExpression extends BaseExpression { + type: "TaggedTemplateExpression"; + tag: Expression; + quasi: TemplateLiteral; +} + +export interface TemplateElement extends BaseNode { + type: "TemplateElement"; + tail: boolean; + value: { + /** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */ + cooked?: string | null | undefined; + raw: string; + }; +} + +export interface AssignmentProperty extends Property { + value: Pattern; + kind: "init"; + method: boolean; // false +} + +export interface ObjectPattern extends BasePattern { + type: "ObjectPattern"; + properties: Array; +} + +export interface ArrayPattern extends BasePattern { + type: "ArrayPattern"; + elements: Array; +} + +export interface RestElement extends BasePattern { + type: "RestElement"; + argument: Pattern; +} + +export interface AssignmentPattern extends BasePattern { + type: "AssignmentPattern"; + left: Pattern; + right: Expression; +} + +export type Class = ClassDeclaration | ClassExpression; +export interface BaseClass extends BaseNode { + superClass?: Expression | null | undefined; + body: ClassBody; +} + +export interface ClassBody extends BaseNode { + type: "ClassBody"; + body: Array; +} + +export interface MethodDefinition extends BaseNode { + type: "MethodDefinition"; + key: Expression | PrivateIdentifier; + value: FunctionExpression; + kind: "constructor" | "method" | "get" | "set"; + computed: boolean; + static: boolean; +} + +export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration { + type: "ClassDeclaration"; + /** It is null when a class declaration is a part of the `export default class` statement */ + id: Identifier | null; +} + +export interface ClassDeclaration extends MaybeNamedClassDeclaration { + id: Identifier; +} + +export interface ClassExpression extends BaseClass, BaseExpression { + type: "ClassExpression"; + id?: Identifier | null | undefined; +} + +export interface MetaProperty extends BaseExpression { + type: "MetaProperty"; + meta: Identifier; + property: Identifier; +} + +export type ModuleDeclaration = + | ImportDeclaration + | ExportNamedDeclaration + | ExportDefaultDeclaration + | ExportAllDeclaration; +export interface BaseModuleDeclaration extends BaseNode {} + +export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier; +export interface BaseModuleSpecifier extends BaseNode { + local: Identifier; +} + +export interface ImportDeclaration extends BaseModuleDeclaration { + type: "ImportDeclaration"; + specifiers: Array; + source: Literal; +} + +export interface ImportSpecifier extends BaseModuleSpecifier { + type: "ImportSpecifier"; + imported: Identifier | Literal; +} + +export interface ImportExpression extends BaseExpression { + type: "ImportExpression"; + source: Expression; +} + +export interface ImportDefaultSpecifier extends BaseModuleSpecifier { + type: "ImportDefaultSpecifier"; +} + +export interface ImportNamespaceSpecifier extends BaseModuleSpecifier { + type: "ImportNamespaceSpecifier"; +} + +export interface ExportNamedDeclaration extends BaseModuleDeclaration { + type: "ExportNamedDeclaration"; + declaration?: Declaration | null | undefined; + specifiers: ExportSpecifier[]; + source?: Literal | null | undefined; +} + +export interface ExportSpecifier extends Omit { + type: "ExportSpecifier"; + local: Identifier | Literal; + exported: Identifier | Literal; +} + +export interface ExportDefaultDeclaration extends BaseModuleDeclaration { + type: "ExportDefaultDeclaration"; + declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression; +} + +export interface ExportAllDeclaration extends BaseModuleDeclaration { + type: "ExportAllDeclaration"; + exported: Identifier | Literal | null; + source: Literal; +} + +export interface AwaitExpression extends BaseExpression { + type: "AwaitExpression"; + argument: Expression; +} diff --git a/node_modules/@types/estree/package.json b/node_modules/@types/estree/package.json new file mode 100644 index 00000000..f4107619 --- /dev/null +++ b/node_modules/@types/estree/package.json @@ -0,0 +1,26 @@ +{ + "name": "@types/estree", + "version": "1.0.6", + "description": "TypeScript definitions for estree", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree", + "license": "MIT", + "contributors": [ + { + "name": "RReverser", + "githubUsername": "RReverser", + "url": "https://github.com/RReverser" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/estree" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "0310b41994a6f8d7530af6c53d47d8b227f32925e43718507fdb1178e05006b1", + "typeScriptVersion": "4.8", + "nonNpm": true +} \ No newline at end of file diff --git a/node_modules/@vercel/nft/node_modules/brace-expansion/LICENSE b/node_modules/@vercel/nft/node_modules/brace-expansion/LICENSE new file mode 100644 index 00000000..de322667 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +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/@vercel/nft/node_modules/brace-expansion/README.md b/node_modules/@vercel/nft/node_modules/brace-expansion/README.md new file mode 100644 index 00000000..6b4e0e16 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/brace-expansion/README.md @@ -0,0 +1,129 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/@vercel/nft/node_modules/brace-expansion/index.js b/node_modules/@vercel/nft/node_modules/brace-expansion/index.js new file mode 100644 index 00000000..0478be81 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/brace-expansion/index.js @@ -0,0 +1,201 @@ +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/@vercel/nft/node_modules/brace-expansion/package.json b/node_modules/@vercel/nft/node_modules/brace-expansion/package.json new file mode 100644 index 00000000..a18faa8f --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/brace-expansion/package.json @@ -0,0 +1,47 @@ +{ + "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/@vercel/nft/node_modules/glob/LICENSE b/node_modules/@vercel/nft/node_modules/glob/LICENSE new file mode 100644 index 00000000..42ca266d --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/glob/LICENSE @@ -0,0 +1,21 @@ +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/@vercel/nft/node_modules/glob/README.md b/node_modules/@vercel/nft/node_modules/glob/README.md new file mode 100644 index 00000000..83f0c83a --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/glob/README.md @@ -0,0 +1,378 @@ +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master) + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![a fun cartoon logo made of glob characters](logo/glob.png) + +## Usage + +Install with npm + +``` +npm i glob +``` + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* `cb` `{Function}` + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* return: `{Array}` filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` `{String}` pattern to search for +* `options` `{Object}` +* `cb` `{Function}` Called when an error occurs, or matches are found + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'FILE'` - Path exists, and is not a directory + * `'DIR'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the specific + thing that matched. It is not deduplicated or resolved to a realpath. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` 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 all js files in all directories. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of glob patterns to exclude matches. + Note: `ignore` patterns are *always* in `dot:true` mode, regardless + of any other settings. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `absolute` Set to true to always receive absolute paths for matched + files. Unlike `realpath`, this also affects the values returned in + the `match` event. +* `fs` File-system object with Node's `fs` API. By default, the built-in + `fs` module will be used. Set to a volume provided by a library like + `memfs` to avoid using the "real" file-system. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +Previously, this module let you mark a pattern as a "comment" if it +started with a `#` character, or a "negated" pattern if it started +with a `!` character. + +These options were deprecated in version 5, and removed in version 6. + +To specify things that should not match, use the `ignore` option. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Glob Logo +Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo). + +The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/). + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` + +![](oh-my-glob.gif) diff --git a/node_modules/@vercel/nft/node_modules/glob/common.js b/node_modules/@vercel/nft/node_modules/glob/common.js new file mode 100644 index 00000000..424c46e1 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/glob/common.js @@ -0,0 +1,238 @@ +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/@vercel/nft/node_modules/glob/glob.js b/node_modules/@vercel/nft/node_modules/glob/glob.js new file mode 100644 index 00000000..37a4d7e6 --- /dev/null +++ b/node_modules/@vercel/nft/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-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/@vercel/nft/node_modules/glob/package.json b/node_modules/@vercel/nft/node_modules/glob/package.json new file mode 100644 index 00000000..5940b649 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/glob/package.json @@ -0,0 +1,55 @@ +{ + "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/@vercel/nft/node_modules/glob/sync.js b/node_modules/@vercel/nft/node_modules/glob/sync.js new file mode 100644 index 00000000..2c4f4801 --- /dev/null +++ b/node_modules/@vercel/nft/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-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/@vercel/nft/node_modules/minimatch/LICENSE b/node_modules/@vercel/nft/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +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/@vercel/nft/node_modules/minimatch/README.md b/node_modules/@vercel/nft/node_modules/minimatch/README.md new file mode 100644 index 00000000..33ede1d6 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/minimatch/README.md @@ -0,0 +1,230 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://travis-ci.org/isaacs/minimatch.svg?branch=master)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + +### partial + +Compare a partial path to a pattern. As long as the parts of the path that +are present are not contradicted by the pattern, it will be treated as a +match. This is useful in applications where you're walking through a +folder structure, and don't yet have the full path, but want to ensure that +you do not walk down paths that can never be a match. + +For example, + +```js +minimatch('/a/b', '/a/*/c/d', { partial: true }) // true, might be /a/b/c/d +minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d +minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a +``` + +### allowWindowsEscape + +Windows path separator `\` is by default converted to `/`, which +prohibits the usage of `\` as a escape character. This flag skips that +behavior and allows using the escape character. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/node_modules/@vercel/nft/node_modules/minimatch/minimatch.js b/node_modules/@vercel/nft/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000..fda45ade --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/minimatch/minimatch.js @@ -0,0 +1,947 @@ +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/@vercel/nft/node_modules/minimatch/package.json b/node_modules/@vercel/nft/node_modules/minimatch/package.json new file mode 100644 index 00000000..566efdfe --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/minimatch/package.json @@ -0,0 +1,33 @@ +{ + "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/@vercel/nft/node_modules/picomatch/LICENSE b/node_modules/@vercel/nft/node_modules/picomatch/LICENSE new file mode 100644 index 00000000..3608dca2 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/picomatch/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017-present, Jon Schlinkert. + +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/@vercel/nft/node_modules/picomatch/README.md b/node_modules/@vercel/nft/node_modules/picomatch/README.md new file mode 100644 index 00000000..5062654b --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/picomatch/README.md @@ -0,0 +1,738 @@ +

Picomatch

+ +

+ +version + + +test status + + +coverage status + + +downloads + +

+ +
+
+ +

+Blazing fast and accurate glob matcher written in JavaScript.
+No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. +

+ +
+
+ +## Why picomatch? + +* **Lightweight** - No dependencies +* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. +* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) +* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) +* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. +* **Well tested** - Thousands of unit tests + +See the [library comparison](#library-comparisons) to other libraries. + +
+
+ +## Table of Contents + +
Click to expand + +- [Install](#install) +- [Usage](#usage) +- [API](#api) + * [picomatch](#picomatch) + * [.test](#test) + * [.matchBase](#matchbase) + * [.isMatch](#ismatch) + * [.parse](#parse) + * [.scan](#scan) + * [.compileRe](#compilere) + * [.makeRe](#makere) + * [.toRegex](#toregex) +- [Options](#options) + * [Picomatch options](#picomatch-options) + * [Scan Options](#scan-options) + * [Options Examples](#options-examples) +- [Globbing features](#globbing-features) + * [Basic globbing](#basic-globbing) + * [Advanced globbing](#advanced-globbing) + * [Braces](#braces) + * [Matching special characters as literals](#matching-special-characters-as-literals) +- [Library Comparisons](#library-comparisons) +- [Benchmarks](#benchmarks) +- [Philosophies](#philosophies) +- [About](#about) + * [Author](#author) + * [License](#license) + +_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ + +
+ +
+
+ +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +npm install --save picomatch +``` + +
+ +## Usage + +The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. + +```js +const pm = require('picomatch'); +const isMatch = pm('*.js'); + +console.log(isMatch('abcd')); //=> false +console.log(isMatch('a.js')); //=> true +console.log(isMatch('a.md')); //=> false +console.log(isMatch('a/b.js')); //=> false +``` + +
+ +## API + +### [picomatch](lib/picomatch.js#L31) + +Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. + +**Params** + +* `globs` **{String|Array}**: One or more glob patterns. +* `options` **{Object=}** +* `returns` **{Function=}**: Returns a matcher function. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch(glob[, options]); + +const isMatch = picomatch('*.!(*a)'); +console.log(isMatch('a.a')); //=> false +console.log(isMatch('a.b')); //=> true +``` + +**Example without node.js** + +For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection. + +```js +const picomatch = require('picomatch/posix'); +// the same API, defaulting to posix paths +const isMatch = picomatch('a/*'); +console.log(isMatch('a\\b')); //=> false +console.log(isMatch('a/b')); //=> true + +// you can still configure the matcher function to accept windows paths +const isMatch = picomatch('a/*', { options: windows }); +console.log(isMatch('a\\b')); //=> true +console.log(isMatch('a/b')); //=> true +``` + +### [.test](lib/picomatch.js#L116) + +Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. + +**Params** + +* `input` **{String}**: String to test. +* `regex` **{RegExp}** +* `returns` **{Object}**: Returns an object with matching info. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.test(input, regex[, options]); + +console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); +// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } +``` + +### [.matchBase](lib/picomatch.js#L160) + +Match the basename of a filepath. + +**Params** + +* `input` **{String}**: String to test. +* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). +* `returns` **{Boolean}** + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.matchBase(input, glob[, options]); +console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true +``` + +### [.isMatch](lib/picomatch.js#L182) + +Returns true if **any** of the given glob `patterns` match the specified `string`. + +**Params** + +* **{String|Array}**: str The string to test. +* **{String|Array}**: patterns One or more glob patterns to use for matching. +* **{Object}**: See available [options](#options). +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.isMatch(string, patterns[, options]); + +console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true +console.log(picomatch.isMatch('a.a', 'b.*')); //=> false +``` + +### [.parse](lib/picomatch.js#L198) + +Parse a glob pattern to create the source string for a regular expression. + +**Params** + +* `pattern` **{String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. + +**Example** + +```js +const picomatch = require('picomatch'); +const result = picomatch.parse(pattern[, options]); +``` + +### [.scan](lib/picomatch.js#L230) + +Scan a glob pattern to separate the pattern into segments. + +**Params** + +* `input` **{String}**: Glob pattern to scan. +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.scan(input[, options]); + +const result = picomatch.scan('!./foo/*.js'); +console.log(result); +{ prefix: '!./', + input: '!./foo/*.js', + start: 3, + base: 'foo', + glob: '*.js', + isBrace: false, + isBracket: false, + isGlob: true, + isExtglob: false, + isGlobstar: false, + negated: true } +``` + +### [.compileRe](lib/picomatch.js#L244) + +Compile a regular expression from the `state` object returned by the +[parse()](#parse) method. + +**Params** + +* `state` **{Object}** +* `options` **{Object}** +* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. +* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. +* `returns` **{RegExp}** + +### [.makeRe](lib/picomatch.js#L285) + +Create a regular expression from a parsed glob pattern. + +**Params** + +* `state` **{String}**: The object returned from the `.parse` method. +* `options` **{Object}** +* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. +* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. +* `returns` **{RegExp}**: Returns a regex created from the given pattern. + +**Example** + +```js +const picomatch = require('picomatch'); +const state = picomatch.parse('*.js'); +// picomatch.compileRe(state[, options]); + +console.log(picomatch.compileRe(state)); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +### [.toRegex](lib/picomatch.js#L320) + +Create a regular expression from the given regex source string. + +**Params** + +* `source` **{String}**: Regular expression source string. +* `options` **{Object}** +* `returns` **{RegExp}** + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.toRegex(source[, options]); + +const { output } = picomatch.parse('*.js'); +console.log(picomatch.toRegex(output)); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +
+ +## Options + +### Picomatch options + +The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | +| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | +| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | +| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | +| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | +| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | +| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | +| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | +| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | +| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | +| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | +| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | +| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | +| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | +| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | +| `matchBase` | `boolean` | `false` | Alias for `basename` | +| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | +| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | +| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | +| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | +| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | +| `noext` | `boolean` | `false` | Alias for `noextglob` | +| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | +| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | +| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | +| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | +| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | +| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | +| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | +| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | +| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | +| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | +| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | +| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | +| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | +| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | +| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | +| `windows` | `boolean` | `false` | Also accept backslashes as the path separator. | + +### Scan Options + +In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | +| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | + +**Example** + +```js +const picomatch = require('picomatch'); +const result = picomatch.scan('!./foo/*.js', { tokens: true }); +console.log(result); +// { +// prefix: '!./', +// input: '!./foo/*.js', +// start: 3, +// base: 'foo', +// glob: '*.js', +// isBrace: false, +// isBracket: false, +// isGlob: true, +// isExtglob: false, +// isGlobstar: false, +// negated: true, +// maxDepth: 2, +// tokens: [ +// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, +// { value: 'foo', depth: 1, isGlob: false }, +// { value: '*.js', depth: 1, isGlob: true } +// ], +// slashes: [ 2, 6 ], +// parts: [ 'foo', '*.js' ] +// } +``` + +
+ +### Options Examples + +#### options.expandRange + +**Type**: `function` + +**Default**: `undefined` + +Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. + +**Example** + +The following example shows how to create a glob that matches a folder + +```js +const fill = require('fill-range'); +const regex = pm.makeRe('foo/{01..25}/bar', { + expandRange(a, b) { + return `(${fill(a, b, { toRegex: true })})`; + } +}); + +console.log(regex); +//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ + +console.log(regex.test('foo/00/bar')) // false +console.log(regex.test('foo/01/bar')) // true +console.log(regex.test('foo/10/bar')) // true +console.log(regex.test('foo/22/bar')) // true +console.log(regex.test('foo/25/bar')) // true +console.log(regex.test('foo/26/bar')) // false +``` + +#### options.format + +**Type**: `function` + +**Default**: `undefined` + +Custom function for formatting strings before they're matched. + +**Example** + +```js +// strip leading './' from strings +const format = str => str.replace(/^\.\//, ''); +const isMatch = picomatch('foo/*.js', { format }); +console.log(isMatch('./foo/bar.js')); //=> true +``` + +#### options.onMatch + +```js +const onMatch = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onMatch }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +#### options.onIgnore + +```js +const onIgnore = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +#### options.onResult + +```js +const onResult = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onResult, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +
+
+ +## Globbing features + +* [Basic globbing](#basic-globbing) (Wildcard matching) +* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) + +### Basic globbing + +| **Character** | **Description** | +| --- | --- | +| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | +| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` with the `windows` option) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | +| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | +| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | + +#### Matching behavior vs. Bash + +Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: + +* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. +* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. + +
+ +### Advanced globbing + +* [extglobs](#extglobs) +* [POSIX brackets](#posix-brackets) +* [Braces](#brace-expansion) + +#### Extglobs + +| **Pattern** | **Description** | +| --- | --- | +| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | +| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | +| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | +| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | +| `!(pattern)` | Match _anything but_ `pattern` | + +**Examples** + +```js +const pm = require('picomatch'); + +// *(pattern) matches ZERO or more of "pattern" +console.log(pm.isMatch('a', 'a*(z)')); // true +console.log(pm.isMatch('az', 'a*(z)')); // true +console.log(pm.isMatch('azzz', 'a*(z)')); // true + +// +(pattern) matches ONE or more of "pattern" +console.log(pm.isMatch('a', 'a+(z)')); // false +console.log(pm.isMatch('az', 'a+(z)')); // true +console.log(pm.isMatch('azzz', 'a+(z)')); // true + +// supports multiple extglobs +console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false + +// supports nested extglobs +console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true +``` + +#### POSIX brackets + +POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. + +**Enable POSIX bracket support** + +```js +console.log(pm.makeRe('[[:word:]]+', { posix: true })); +//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ +``` + +**Supported POSIX classes** + +The following named POSIX bracket expressions are supported: + +* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` +* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. +* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. +* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. +* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. +* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. +* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. +* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. +* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. +* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. +* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. +* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. +* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. +* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. + +See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. + +### Braces + +Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. + +### Matching special characters as literals + +If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: + +**Special Characters** + +Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. + +To match any of the following characters as literals: `$^*+?()[] + +Examples: + +```js +console.log(pm.makeRe('foo/bar \\(1\\)')); +console.log(pm.makeRe('foo/bar \\(1\\)')); +``` + +
+
+ +## Library Comparisons + +The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). + +| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | +| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | +| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | +| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | +| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | +| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | +| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | +| File system operations | - | - | - | - | - | - | - | + +
+
+ +## Benchmarks + +Performance comparison of picomatch and minimatch. + +_(Pay special attention to the last three benchmarks. Minimatch freezes on long ranges.)_ + +``` +# .makeRe star (*) + picomatch x 4,449,159 ops/sec ±0.24% (97 runs sampled) + minimatch x 632,772 ops/sec ±0.14% (98 runs sampled) + +# .makeRe star; dot=true (*) + picomatch x 3,500,079 ops/sec ±0.26% (99 runs sampled) + minimatch x 564,916 ops/sec ±0.23% (96 runs sampled) + +# .makeRe globstar (**) + picomatch x 3,261,000 ops/sec ±0.27% (98 runs sampled) + minimatch x 1,664,766 ops/sec ±0.20% (100 runs sampled) + +# .makeRe globstars (**/**/**) + picomatch x 3,284,469 ops/sec ±0.18% (97 runs sampled) + minimatch x 1,435,880 ops/sec ±0.34% (95 runs sampled) + +# .makeRe with leading star (*.txt) + picomatch x 3,100,197 ops/sec ±0.35% (99 runs sampled) + minimatch x 428,347 ops/sec ±0.42% (94 runs sampled) + +# .makeRe - basic braces ({a,b,c}*.txt) + picomatch x 443,578 ops/sec ±1.33% (89 runs sampled) + minimatch x 107,143 ops/sec ±0.35% (94 runs sampled) + +# .makeRe - short ranges ({a..z}*.txt) + picomatch x 415,484 ops/sec ±0.76% (96 runs sampled) + minimatch x 14,299 ops/sec ±0.26% (96 runs sampled) + +# .makeRe - medium ranges ({1..100000}*.txt) + picomatch x 395,020 ops/sec ±0.87% (89 runs sampled) + minimatch x 2 ops/sec ±4.59% (10 runs sampled) + +# .makeRe - long ranges ({1..10000000}*.txt) + picomatch x 400,036 ops/sec ±0.83% (90 runs sampled) + minimatch (FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory) +``` + +
+
+ +## Philosophies + +The goal of this library is to be blazing fast, without compromising on accuracy. + +**Accuracy** + +The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. + +Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. + +**Performance** + +Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. + +
+
+ +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). diff --git a/node_modules/@vercel/nft/node_modules/picomatch/index.js b/node_modules/@vercel/nft/node_modules/picomatch/index.js new file mode 100644 index 00000000..a753b1d9 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/picomatch/index.js @@ -0,0 +1,17 @@ +'use strict'; + +const pico = require('./lib/picomatch'); +const utils = require('./lib/utils'); + +function picomatch(glob, options, returnState = false) { + // default to os.platform() + if (options && (options.windows === null || options.windows === undefined)) { + // don't mutate the original options object + options = { ...options, windows: utils.isWindows() }; + } + + return pico(glob, options, returnState); +} + +Object.assign(picomatch, pico); +module.exports = picomatch; diff --git a/node_modules/@vercel/nft/node_modules/picomatch/lib/constants.js b/node_modules/@vercel/nft/node_modules/picomatch/lib/constants.js new file mode 100644 index 00000000..27b3e20f --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/picomatch/lib/constants.js @@ -0,0 +1,179 @@ +'use strict'; + +const WIN_SLASH = '\\\\/'; +const WIN_NO_SLASH = `[^${WIN_SLASH}]`; + +/** + * Posix glob regex + */ + +const DOT_LITERAL = '\\.'; +const PLUS_LITERAL = '\\+'; +const QMARK_LITERAL = '\\?'; +const SLASH_LITERAL = '\\/'; +const ONE_CHAR = '(?=.)'; +const QMARK = '[^/]'; +const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; +const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; +const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; +const NO_DOT = `(?!${DOT_LITERAL})`; +const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; +const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; +const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; +const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; +const STAR = `${QMARK}*?`; +const SEP = '/'; + +const POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR, + SEP +}; + +/** + * Windows glob regex + */ + +const WINDOWS_CHARS = { + ...POSIX_CHARS, + + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)`, + SEP: '\\' +}; + +/** + * POSIX Bracket Regex + */ + +const POSIX_REGEX_SOURCE = { + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\x00-\\x7F', + blank: ' \\t', + cntrl: '\\x00-\\x1F\\x7F', + digit: '0-9', + graph: '\\x21-\\x7E', + lower: 'a-z', + print: '\\x20-\\x7E ', + punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', + space: ' \\t\\r\\n\\v\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' +}; + +module.exports = { + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, + + // regular expressions + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, + + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + '***': '*', + '**/**': '**', + '**/**/**': '**' + }, + + // Digits + CHAR_0: 48, /* 0 */ + CHAR_9: 57, /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 65, /* A */ + CHAR_LOWERCASE_A: 97, /* a */ + CHAR_UPPERCASE_Z: 90, /* Z */ + CHAR_LOWERCASE_Z: 122, /* z */ + + CHAR_LEFT_PARENTHESES: 40, /* ( */ + CHAR_RIGHT_PARENTHESES: 41, /* ) */ + + CHAR_ASTERISK: 42, /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, /* & */ + CHAR_AT: 64, /* @ */ + CHAR_BACKWARD_SLASH: 92, /* \ */ + CHAR_CARRIAGE_RETURN: 13, /* \r */ + CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ + CHAR_COLON: 58, /* : */ + CHAR_COMMA: 44, /* , */ + CHAR_DOT: 46, /* . */ + CHAR_DOUBLE_QUOTE: 34, /* " */ + CHAR_EQUAL: 61, /* = */ + CHAR_EXCLAMATION_MARK: 33, /* ! */ + CHAR_FORM_FEED: 12, /* \f */ + CHAR_FORWARD_SLASH: 47, /* / */ + CHAR_GRAVE_ACCENT: 96, /* ` */ + CHAR_HASH: 35, /* # */ + CHAR_HYPHEN_MINUS: 45, /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ + CHAR_LEFT_CURLY_BRACE: 123, /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ + CHAR_LINE_FEED: 10, /* \n */ + CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ + CHAR_PERCENT: 37, /* % */ + CHAR_PLUS: 43, /* + */ + CHAR_QUESTION_MARK: 63, /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ + CHAR_SEMICOLON: 59, /* ; */ + CHAR_SINGLE_QUOTE: 39, /* ' */ + CHAR_SPACE: 32, /* */ + CHAR_TAB: 9, /* \t */ + CHAR_UNDERSCORE: 95, /* _ */ + CHAR_VERTICAL_LINE: 124, /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ + + /** + * Create EXTGLOB_CHARS + */ + + extglobChars(chars) { + return { + '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, + '?': { type: 'qmark', open: '(?:', close: ')?' }, + '+': { type: 'plus', open: '(?:', close: ')+' }, + '*': { type: 'star', open: '(?:', close: ')*' }, + '@': { type: 'at', open: '(?:', close: ')' } + }; + }, + + /** + * Create GLOB_CHARS + */ + + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; + } +}; diff --git a/node_modules/@vercel/nft/node_modules/picomatch/lib/parse.js b/node_modules/@vercel/nft/node_modules/picomatch/lib/parse.js new file mode 100644 index 00000000..8fd8ff49 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/picomatch/lib/parse.js @@ -0,0 +1,1085 @@ +'use strict'; + +const constants = require('./constants'); +const utils = require('./utils'); + +/** + * Constants + */ + +const { + MAX_LENGTH, + POSIX_REGEX_SOURCE, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS +} = constants; + +/** + * Helpers + */ + +const expandRange = (args, options) => { + if (typeof options.expandRange === 'function') { + return options.expandRange(...args, options); + } + + args.sort(); + const value = `[${args.join('-')}]`; + + try { + /* eslint-disable-next-line no-new */ + new RegExp(value); + } catch (ex) { + return args.map(v => utils.escapeRegex(v)).join('..'); + } + + return value; +}; + +/** + * Create the message for a syntax error + */ + +const syntaxError = (type, char) => { + return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; +}; + +/** + * Parse the given input string. + * @param {String} input + * @param {Object} options + * @return {Object} + */ + +const parse = (input, options) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + input = REPLACEMENTS[input] || input; + + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + + let len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + const bos = { type: 'bos', value: '', output: opts.prepend || '' }; + const tokens = [bos]; + + const capture = opts.capture ? '' : '?:'; + + // create constants based on platform, for windows or posix + const PLATFORM_CHARS = constants.globChars(opts.windows); + const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); + + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + + const globstar = opts => { + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const nodot = opts.dot ? '' : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + // minimatch options support + if (typeof opts.noext === 'boolean') { + opts.noextglob = opts.noext; + } + + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: '', + output: '', + prefix: '', + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + + input = utils.removePrefix(input, state); + len = input.length; + + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + + /** + * Tokenizing helpers + */ + + const eos = () => state.index === len - 1; + const peek = state.peek = (n = 1) => input[state.index + n]; + const advance = state.advance = () => input[++state.index] || ''; + const remaining = () => input.slice(state.index + 1); + const consume = (value = '', num = 0) => { + state.consumed += value; + state.index += num; + }; + + const append = token => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + + const negate = () => { + let count = 1; + + while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { + advance(); + state.start++; + count++; + } + + if (count % 2 === 0) { + return false; + } + + state.negated = true; + state.start++; + return true; + }; + + const increment = type => { + state[type]++; + stack.push(type); + }; + + const decrement = type => { + state[type]--; + stack.pop(); + }; + + /** + * Push tokens onto the tokens array. This helper speeds up + * tokenizing by 1) helping us avoid backtracking as much as possible, + * and 2) helping us avoid creating extra tokens when consecutive + * characters are plain text. This improves performance and simplifies + * lookbehinds. + */ + + const push = tok => { + if (prev.type === 'globstar') { + const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); + const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); + + if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = 'star'; + prev.value = '*'; + prev.output = star; + state.output += prev.output; + } + } + + if (extglobs.length && tok.type !== 'paren') { + extglobs[extglobs.length - 1].inner += tok.value; + } + + if (tok.value || tok.output) append(tok); + if (prev && prev.type === 'text' && tok.type === 'text') { + prev.output = (prev.output || prev.value) + tok.value; + prev.value += tok.value; + return; + } + + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + + const extglobOpen = (type, value) => { + const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; + + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + const output = (opts.capture ? '(' : '') + token.open; + + increment('parens'); + push({ type, value, output: state.output ? '' : ONE_CHAR }); + push({ type: 'paren', extglob: true, value: advance(), output }); + extglobs.push(token); + }; + + const extglobClose = token => { + let output = token.close + (opts.capture ? ')' : ''); + let rest; + + if (token.type === 'negate') { + let extglobStar = star; + + if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { + extglobStar = globstar(opts); + } + + if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { + output = token.close = `)$))${extglobStar}`; + } + + if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { + // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. + // In this case, we need to parse the string and use it in the output of the original pattern. + // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. + // + // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. + const expression = parse(rest, { ...options, fastpaths: false }).output; + + output = token.close = `)${expression})${extglobStar})`; + } + + if (token.prev.type === 'bos') { + state.negatedExtglob = true; + } + } + + push({ type: 'paren', extglob: true, value, output }); + decrement('parens'); + }; + + /** + * Fast paths + */ + + if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { + let backslashes = false; + + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { + if (first === '\\') { + backslashes = true; + return m; + } + + if (first === '?') { + if (esc) { + return esc + first + (rest ? QMARK.repeat(rest.length) : ''); + } + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); + } + return QMARK.repeat(chars.length); + } + + if (first === '.') { + return DOT_LITERAL.repeat(chars.length); + } + + if (first === '*') { + if (esc) { + return esc + first + (rest ? star : ''); + } + return star; + } + return esc ? m : `\\${m}`; + }); + + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\/g, ''); + } else { + output = output.replace(/\\+/g, m => { + return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); + }); + } + } + + if (output === input && opts.contains === true) { + state.output = input; + return state; + } + + state.output = utils.wrapOutput(output, state, options); + return state; + } + + /** + * Tokenize input until we reach end-of-string + */ + + while (!eos()) { + value = advance(); + + if (value === '\u0000') { + continue; + } + + /** + * Escaped characters + */ + + if (value === '\\') { + const next = peek(); + + if (next === '/' && opts.bash !== true) { + continue; + } + + if (next === '.' || next === ';') { + continue; + } + + if (!next) { + value += '\\'; + push({ type: 'text', value }); + continue; + } + + // collapse slashes to reduce potential for exploits + const match = /^\\+/.exec(remaining()); + let slashes = 0; + + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + if (slashes % 2 !== 0) { + value += '\\'; + } + } + + if (opts.unescape === true) { + value = advance(); + } else { + value += advance(); + } + + if (state.brackets === 0) { + push({ type: 'text', value }); + continue; + } + } + + /** + * If we're inside a regex character class, continue + * until we reach the closing bracket. + */ + + if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { + if (opts.posix !== false && value === ':') { + const inner = prev.value.slice(1); + if (inner.includes('[')) { + prev.posix = true; + + if (inner.includes(':')) { + const idx = prev.value.lastIndexOf('['); + const pre = prev.value.slice(0, idx); + const rest = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE[rest]; + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + continue; + } + } + } + } + + if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { + value = `\\${value}`; + } + + if (value === ']' && (prev.value === '[' || prev.value === '[^')) { + value = `\\${value}`; + } + + if (opts.posix === true && value === '!' && prev.value === '[') { + value = '^'; + } + + prev.value += value; + append({ value }); + continue; + } + + /** + * If we're inside a quoted string, continue + * until we reach the closing double quote. + */ + + if (state.quotes === 1 && value !== '"') { + value = utils.escapeRegex(value); + prev.value += value; + append({ value }); + continue; + } + + /** + * Double quotes + */ + + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + if (opts.keepQuotes === true) { + push({ type: 'text', value }); + } + continue; + } + + /** + * Parentheses + */ + + if (value === '(') { + increment('parens'); + push({ type: 'paren', value }); + continue; + } + + if (value === ')') { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '(')); + } + + const extglob = extglobs[extglobs.length - 1]; + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; + } + + push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); + decrement('parens'); + continue; + } + + /** + * Square brackets + */ + + if (value === '[') { + if (opts.nobracket === true || !remaining().includes(']')) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('closing', ']')); + } + + value = `\\${value}`; + } else { + increment('brackets'); + } + + push({ type: 'bracket', value }); + continue; + } + + if (value === ']') { + if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '[')); + } + + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + decrement('brackets'); + + const prevValue = prev.value.slice(1); + if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { + value = `/${value}`; + } + + prev.value += value; + append({ value }); + + // when literal brackets are explicitly disabled + // assume we should match with a regex character class + if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { + continue; + } + + const escaped = utils.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); + + // when literal brackets are explicitly enabled + // assume we should escape the brackets to match literal characters + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } + + // when the user specifies nothing, try to match both + prev.value = `(${capture}${escaped}|${prev.value})`; + state.output += prev.value; + continue; + } + + /** + * Braces + */ + + if (value === '{' && opts.nobrace !== true) { + increment('braces'); + + const open = { + type: 'brace', + value, + output: '(', + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + + braces.push(open); + push(open); + continue; + } + + if (value === '}') { + const brace = braces[braces.length - 1]; + + if (opts.nobrace === true || !brace) { + push({ type: 'text', value, output: value }); + continue; + } + + let output = ')'; + + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + + for (let i = arr.length - 1; i >= 0; i--) { + tokens.pop(); + if (arr[i].type === 'brace') { + break; + } + if (arr[i].type !== 'dots') { + range.unshift(arr[i].value); + } + } + + output = expandRange(range, opts); + state.backtrack = true; + } + + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = '\\{'; + value = output = '\\}'; + state.output = out; + for (const t of toks) { + state.output += (t.output || t.value); + } + } + + push({ type: 'brace', value, output }); + decrement('braces'); + braces.pop(); + continue; + } + + /** + * Pipes + */ + + if (value === '|') { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + push({ type: 'text', value }); + continue; + } + + /** + * Commas + */ + + if (value === ',') { + let output = value; + + const brace = braces[braces.length - 1]; + if (brace && stack[stack.length - 1] === 'braces') { + brace.comma = true; + output = '|'; + } + + push({ type: 'comma', value, output }); + continue; + } + + /** + * Slashes + */ + + if (value === '/') { + // if the beginning of the glob is "./", advance the start + // to the current index, and don't add the "./" characters + // to the state. This greatly simplifies lookbehinds when + // checking for BOS characters like "!" and "." (not "./") + if (prev.type === 'dot' && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ''; + state.output = ''; + tokens.pop(); + prev = bos; // reset "prev" to the first token + continue; + } + + push({ type: 'slash', value, output: SLASH_LITERAL }); + continue; + } + + /** + * Dots + */ + + if (value === '.') { + if (state.braces > 0 && prev.type === 'dot') { + if (prev.value === '.') prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = 'dots'; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + + if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { + push({ type: 'text', value, output: DOT_LITERAL }); + continue; + } + + push({ type: 'dot', value, output: DOT_LITERAL }); + continue; + } + + /** + * Question marks + */ + + if (value === '?') { + const isGroup = prev && prev.value === '('; + if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('qmark', value); + continue; + } + + if (prev && prev.type === 'paren') { + const next = peek(); + let output = value; + + if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { + output = `\\${value}`; + } + + push({ type: 'text', value, output }); + continue; + } + + if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { + push({ type: 'qmark', value, output: QMARK_NO_DOT }); + continue; + } + + push({ type: 'qmark', value, output: QMARK }); + continue; + } + + /** + * Exclamation + */ + + if (value === '!') { + if (opts.noextglob !== true && peek() === '(') { + if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { + extglobOpen('negate', value); + continue; + } + } + + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; + } + } + + /** + * Plus + */ + + if (value === '+') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('plus', value); + continue; + } + + if ((prev && prev.value === '(') || opts.regex === false) { + push({ type: 'plus', value, output: PLUS_LITERAL }); + continue; + } + + if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { + push({ type: 'plus', value }); + continue; + } + + push({ type: 'plus', value: PLUS_LITERAL }); + continue; + } + + /** + * Plain text + */ + + if (value === '@') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + push({ type: 'at', extglob: true, value, output: '' }); + continue; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Plain text + */ + + if (value !== '*') { + if (value === '$' || value === '^') { + value = `\\${value}`; + } + + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + if (match) { + value += match[0]; + state.index += match[0].length; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Stars + */ + + if (prev && (prev.type === 'globstar' || prev.star === true)) { + prev.type = 'star'; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; + } + + let rest = remaining(); + if (opts.noextglob !== true && /^\([^?]/.test(rest)) { + extglobOpen('star', value); + continue; + } + + if (prev.type === 'star') { + if (opts.noglobstar === true) { + consume(value); + continue; + } + + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === 'slash' || prior.type === 'bos'; + const afterStar = before && (before.type === 'star' || before.type === 'globstar'); + + if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { + push({ type: 'star', value, output: '' }); + continue; + } + + const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); + const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); + if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { + push({ type: 'star', value, output: '' }); + continue; + } + + // strip consecutive `/**/` + while (rest.slice(0, 3) === '/**') { + const after = input[state.index + 4]; + if (after && after !== '/') { + break; + } + rest = rest.slice(3); + consume('/**', 3); + } + + if (prior.type === 'bos' && eos()) { + prev.type = 'globstar'; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { + const end = rest[1] !== void 0 ? '|$' : ''; + + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; + prev.value += value; + + state.output += prior.output + prev.output; + state.globstar = true; + + consume(value + advance()); + + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + if (prior.type === 'bos' && rest[0] === '/') { + prev.type = 'globstar'; + prev.value += value; + prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + // remove single star from output + state.output = state.output.slice(0, -prev.output.length); + + // reset previous token to globstar + prev.type = 'globstar'; + prev.output = globstar(opts); + prev.value += value; + + // reset output with globstar + state.output += prev.output; + state.globstar = true; + consume(value); + continue; + } + + const token = { type: 'star', value, output: star }; + + if (opts.bash === true) { + token.output = '.*?'; + if (prev.type === 'bos' || prev.type === 'slash') { + token.output = nodot + token.output; + } + push(token); + continue; + } + + if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { + token.output = value; + push(token); + continue; + } + + if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { + if (prev.type === 'dot') { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + + } else { + state.output += nodot; + prev.output += nodot; + } + + if (peek() !== '*') { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } + } + + push(token); + } + + while (state.brackets > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); + state.output = utils.escapeLast(state.output, '['); + decrement('brackets'); + } + + while (state.parens > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); + state.output = utils.escapeLast(state.output, '('); + decrement('parens'); + } + + while (state.braces > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); + state.output = utils.escapeLast(state.output, '{'); + decrement('braces'); + } + + if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { + push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); + } + + // rebuild the output if we had to backtrack at any point + if (state.backtrack === true) { + state.output = ''; + + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; + + if (token.suffix) { + state.output += token.suffix; + } + } + } + + return state; +}; + +/** + * Fast paths for creating regular expressions for common glob patterns. + * This can significantly speed up processing and has very little downside + * impact when none of the fast paths match. + */ + +parse.fastpaths = (input, options) => { + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + const len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + input = REPLACEMENTS[input] || input; + + // create constants based on platform, for windows or posix + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants.globChars(opts.windows); + + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? '' : '?:'; + const state = { negated: false, prefix: '' }; + let star = opts.bash === true ? '.*?' : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + const globstar = opts => { + if (opts.noglobstar === true) return star; + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const create = str => { + switch (str) { + case '*': + return `${nodot}${ONE_CHAR}${star}`; + + case '.*': + return `${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*.*': + return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*/*': + return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; + + case '**': + return nodot + globstar(opts); + + case '**/*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; + + case '**/*.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '**/.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; + + default: { + const match = /^(.*?)\.(\w+)$/.exec(str); + if (!match) return; + + const source = create(match[1]); + if (!source) return; + + return source + DOT_LITERAL + match[2]; + } + } + }; + + const output = utils.removePrefix(input, state); + let source = create(output); + + if (source && opts.strictSlashes !== true) { + source += `${SLASH_LITERAL}?`; + } + + return source; +}; + +module.exports = parse; diff --git a/node_modules/@vercel/nft/node_modules/picomatch/lib/picomatch.js b/node_modules/@vercel/nft/node_modules/picomatch/lib/picomatch.js new file mode 100644 index 00000000..d0ebd9f1 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/picomatch/lib/picomatch.js @@ -0,0 +1,341 @@ +'use strict'; + +const scan = require('./scan'); +const parse = require('./parse'); +const utils = require('./utils'); +const constants = require('./constants'); +const isObject = val => val && typeof val === 'object' && !Array.isArray(val); + +/** + * Creates a matcher function from one or more glob patterns. The + * returned function takes a string to match as its first argument, + * and returns true if the string is a match. The returned matcher + * function also takes a boolean as the second argument that, when true, + * returns an object with additional information. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch(glob[, options]); + * + * const isMatch = picomatch('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @name picomatch + * @param {String|Array} `globs` One or more glob patterns. + * @param {Object=} `options` + * @return {Function=} Returns a matcher function. + * @api public + */ + +const picomatch = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map(input => picomatch(input, options, returnState)); + const arrayMatcher = str => { + for (const isMatch of fns) { + const state = isMatch(str); + if (state) return state; + } + return false; + }; + return arrayMatcher; + } + + const isState = isObject(glob) && glob.tokens && glob.input; + + if (glob === '' || (typeof glob !== 'string' && !isState)) { + throw new TypeError('Expected pattern to be a non-empty string'); + } + + const opts = options || {}; + const posix = opts.windows; + const regex = isState + ? picomatch.compileRe(glob, options) + : picomatch.makeRe(glob, options, false, true); + + const state = regex.state; + delete regex.state; + + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; + isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + } + + const matcher = (input, returnObject = false) => { + const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); + const result = { glob, state, regex, posix, input, output, match, isMatch }; + + if (typeof opts.onResult === 'function') { + opts.onResult(result); + } + + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + + if (isIgnored(input)) { + if (typeof opts.onIgnore === 'function') { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; + } + + if (typeof opts.onMatch === 'function') { + opts.onMatch(result); + } + return returnObject ? result : true; + }; + + if (returnState) { + matcher.state = state; + } + + return matcher; +}; + +/** + * Test `input` with the given `regex`. This is used by the main + * `picomatch()` function to test the input string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.test(input, regex[, options]); + * + * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); + * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } + * ``` + * @param {String} `input` String to test. + * @param {RegExp} `regex` + * @return {Object} Returns an object with matching info. + * @api public + */ + +picomatch.test = (input, regex, options, { glob, posix } = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected input to be a string'); + } + + if (input === '') { + return { isMatch: false, output: '' }; + } + + const opts = options || {}; + const format = opts.format || (posix ? utils.toPosixSlashes : null); + let match = input === glob; + let output = (match && format) ? format(input) : input; + + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } + + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } + + return { isMatch: Boolean(match), match, output }; +}; + +/** + * Match the basename of a filepath. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.matchBase(input, glob[, options]); + * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true + * ``` + * @param {String} `input` String to test. + * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). + * @return {Boolean} + * @api public + */ + +picomatch.matchBase = (input, glob, options) => { + const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); + return regex.test(utils.basename(input)); +}; + +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.isMatch(string, patterns[, options]); + * + * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String|Array} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const picomatch = require('picomatch'); + * const result = picomatch.parse(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as a regex source string. + * @api public + */ + +picomatch.parse = (pattern, options) => { + if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); + return parse(pattern, { ...options, fastpaths: false }); +}; + +/** + * Scan a glob pattern to separate the pattern into segments. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.scan(input[, options]); + * + * const result = picomatch.scan('!./foo/*.js'); + * console.log(result); + * { prefix: '!./', + * input: '!./foo/*.js', + * start: 3, + * base: 'foo', + * glob: '*.js', + * isBrace: false, + * isBracket: false, + * isGlob: true, + * isExtglob: false, + * isGlobstar: false, + * negated: true } + * ``` + * @param {String} `input` Glob pattern to scan. + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ + +picomatch.scan = (input, options) => scan(input, options); + +/** + * Compile a regular expression from the `state` object returned by the + * [parse()](#parse) method. + * + * @param {Object} `state` + * @param {Object} `options` + * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. + * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. + * @return {RegExp} + * @api public + */ + +picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return state.output; + } + + const opts = options || {}; + const prepend = opts.contains ? '' : '^'; + const append = opts.contains ? '' : '$'; + + let source = `${prepend}(?:${state.output})${append}`; + if (state && state.negated === true) { + source = `^(?!${source}).*$`; + } + + const regex = picomatch.toRegex(source, options); + if (returnState === true) { + regex.state = state; + } + + return regex; +}; + +/** + * Create a regular expression from a parsed glob pattern. + * + * ```js + * const picomatch = require('picomatch'); + * const state = picomatch.parse('*.js'); + * // picomatch.compileRe(state[, options]); + * + * console.log(picomatch.compileRe(state)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `state` The object returned from the `.parse` method. + * @param {Object} `options` + * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. + * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { + if (!input || typeof input !== 'string') { + throw new TypeError('Expected a non-empty string'); + } + + let parsed = { negated: false, fastpaths: true }; + + if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { + parsed.output = parse.fastpaths(input, options); + } + + if (!parsed.output) { + parsed = parse(input, options); + } + + return picomatch.compileRe(parsed, options, returnOutput, returnState); +}; + +/** + * Create a regular expression from the given regex source string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.toRegex(source[, options]); + * + * const { output } = picomatch.parse('*.js'); + * console.log(picomatch.toRegex(output)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `source` Regular expression source string. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +picomatch.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); + } catch (err) { + if (options && options.debug === true) throw err; + return /$^/; + } +}; + +/** + * Picomatch constants. + * @return {Object} + */ + +picomatch.constants = constants; + +/** + * Expose "picomatch" + */ + +module.exports = picomatch; diff --git a/node_modules/@vercel/nft/node_modules/picomatch/lib/scan.js b/node_modules/@vercel/nft/node_modules/picomatch/lib/scan.js new file mode 100644 index 00000000..e59cd7a1 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/picomatch/lib/scan.js @@ -0,0 +1,391 @@ +'use strict'; + +const utils = require('./utils'); +const { + CHAR_ASTERISK, /* * */ + CHAR_AT, /* @ */ + CHAR_BACKWARD_SLASH, /* \ */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_EXCLAMATION_MARK, /* ! */ + CHAR_FORWARD_SLASH, /* / */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_PLUS, /* + */ + CHAR_QUESTION_MARK, /* ? */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_RIGHT_SQUARE_BRACKET /* ] */ +} = require('./constants'); + +const isPathSeparator = code => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; +}; + +const depth = token => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; + } +}; + +/** + * Quickly scans a glob pattern and returns an object with a handful of + * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), + * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not + * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). + * + * ```js + * const pm = require('picomatch'); + * console.log(pm.scan('foo/bar/*.js')); + * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {Object} Returns an object with tokens and regex source string. + * @api public + */ + +const scan = (input, options) => { + const opts = options || {}; + + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let negatedExtglob = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = { value: '', depth: 0, isGlob: false }; + + const eos = () => index >= length; + const peek = () => str.charCodeAt(index + 1); + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + + while (index < length) { + code = advance(); + let next; + + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + + if (code === CHAR_LEFT_CURLY_BRACE) { + braceEscaped = true; + } + continue; + } + + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { + braces++; + + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (code === CHAR_LEFT_CURLY_BRACE) { + braces++; + continue; + } + + if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (braceEscaped !== true && code === CHAR_COMMA) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_RIGHT_CURLY_BRACE) { + braces--; + + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = { value: '', depth: 0, isGlob: false }; + + if (finished === true) continue; + if (prev === CHAR_DOT && index === (start + 1)) { + start += 2; + continue; + } + + lastIndex = index + 1; + continue; + } + + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS + || code === CHAR_AT + || code === CHAR_ASTERISK + || code === CHAR_QUESTION_MARK + || code === CHAR_EXCLAMATION_MARK; + + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + if (code === CHAR_EXCLAMATION_MARK && index === start) { + negatedExtglob = true; + } + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES) { + isGlob = token.isGlob = true; + finished = true; + break; + } + } + continue; + } + break; + } + } + + if (code === CHAR_ASTERISK) { + if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_LEFT_SQUARE_BRACKET) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + break; + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_LEFT_PARENTHESES) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES) { + finished = true; + break; + } + } + continue; + } + break; + } + + if (isGlob === true) { + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + } + + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } + + let base = str; + let prefix = ''; + let glob = ''; + + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } + + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob = str.slice(lastIndex); + } else if (isGlob === true) { + base = ''; + glob = str; + } else { + base = str; + } + + if (base && base !== '' && base !== '/' && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } + + if (opts.unescape === true) { + if (glob) glob = utils.removeBackslashes(glob); + + if (base && backslashes === true) { + base = utils.removeBackslashes(base); + } + } + + const state = { + prefix, + input, + start, + base, + glob, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated, + negatedExtglob + }; + + if (opts.tokens === true) { + state.maxDepth = 0; + if (!isPathSeparator(code)) { + tokens.push(token); + } + state.tokens = tokens; + } + + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + + for (let idx = 0; idx < slashes.length; idx++) { + const n = prevIndex ? prevIndex + 1 : start; + const i = slashes[idx]; + const value = input.slice(n, i); + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; + } + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; + } + if (idx !== 0 || value !== '') { + parts.push(value); + } + prevIndex = i; + } + + if (prevIndex && prevIndex + 1 < input.length) { + const value = input.slice(prevIndex + 1); + parts.push(value); + + if (opts.tokens) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + } + + state.slashes = slashes; + state.parts = parts; + } + + return state; +}; + +module.exports = scan; diff --git a/node_modules/@vercel/nft/node_modules/picomatch/lib/utils.js b/node_modules/@vercel/nft/node_modules/picomatch/lib/utils.js new file mode 100644 index 00000000..9c97cae2 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/picomatch/lib/utils.js @@ -0,0 +1,72 @@ +/*global navigator*/ +'use strict'; + +const { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL +} = require('./constants'); + +exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); +exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); +exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); +exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); +exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); + +exports.isWindows = () => { + if (typeof navigator !== 'undefined' && navigator.platform) { + const platform = navigator.platform.toLowerCase(); + return platform === 'win32' || platform === 'windows'; + } + + if (typeof process !== 'undefined' && process.platform) { + return process.platform === 'win32'; + } + + return false; +}; + +exports.removeBackslashes = str => { + return str.replace(REGEX_REMOVE_BACKSLASH, match => { + return match === '\\' ? '' : match; + }); +}; + +exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) return input; + if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; +}; + +exports.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith('./')) { + output = output.slice(2); + state.prefix = './'; + } + return output; +}; + +exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? '' : '^'; + const append = options.contains ? '' : '$'; + + let output = `${prepend}(?:${input})${append}`; + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; + } + return output; +}; + +exports.basename = (path, { windows } = {}) => { + const segs = path.split(windows ? /[\\/]/ : '/'); + const last = segs[segs.length - 1]; + + if (last === '') { + return segs[segs.length - 2]; + } + + return last; +}; diff --git a/node_modules/@vercel/nft/node_modules/picomatch/package.json b/node_modules/@vercel/nft/node_modules/picomatch/package.json new file mode 100644 index 00000000..703a83dc --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/picomatch/package.json @@ -0,0 +1,83 @@ +{ + "name": "picomatch", + "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", + "version": "4.0.2", + "homepage": "https://github.com/micromatch/picomatch", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "funding": "https://github.com/sponsors/jonschlinkert", + "repository": "micromatch/picomatch", + "bugs": { + "url": "https://github.com/micromatch/picomatch/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "posix.js", + "lib" + ], + "sideEffects": false, + "main": "index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", + "mocha": "mocha --reporter dot", + "test": "npm run lint && npm run mocha", + "test:ci": "npm run test:cover", + "test:cover": "nyc npm run mocha" + }, + "devDependencies": { + "eslint": "^8.57.0", + "fill-range": "^7.0.1", + "gulp-format-md": "^2.0.0", + "mocha": "^10.4.0", + "nyc": "^15.1.0", + "time-require": "github:jonschlinkert/time-require" + }, + "keywords": [ + "glob", + "match", + "picomatch" + ], + "nyc": { + "reporter": [ + "html", + "lcov", + "text-summary" + ] + }, + "verb": { + "toc": { + "render": true, + "method": "preWrite", + "maxdepth": 3 + }, + "layout": "empty", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "braces", + "micromatch" + ] + }, + "reflinks": [ + "braces", + "expand-brackets", + "extglob", + "fill-range", + "micromatch", + "minimatch", + "nanomatch", + "picomatch" + ] + } +} diff --git a/node_modules/@vercel/nft/node_modules/picomatch/posix.js b/node_modules/@vercel/nft/node_modules/picomatch/posix.js new file mode 100644 index 00000000..d2f2bc59 --- /dev/null +++ b/node_modules/@vercel/nft/node_modules/picomatch/posix.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/picomatch'); diff --git a/node_modules/ansi-styles/index.d.ts b/node_modules/ansi-styles/index.d.ts new file mode 100644 index 00000000..58f133ab --- /dev/null +++ b/node_modules/ansi-styles/index.d.ts @@ -0,0 +1,236 @@ +export interface CSPair { // eslint-disable-line @typescript-eslint/naming-convention + /** + The ANSI terminal control sequence for starting this style. + */ + readonly open: string; + + /** + The ANSI terminal control sequence for ending this style. + */ + readonly close: string; +} + +export interface ColorBase { + /** + The ANSI terminal control sequence for ending this color. + */ + readonly close: string; + + ansi(code: number): string; + + ansi256(code: number): string; + + ansi16m(red: number, green: number, blue: number): string; +} + +export interface Modifier { + /** + Resets the current color chain. + */ + readonly reset: CSPair; + + /** + Make text bold. + */ + readonly bold: CSPair; + + /** + Emitting only a small amount of light. + */ + readonly dim: CSPair; + + /** + Make text italic. (Not widely supported) + */ + readonly italic: CSPair; + + /** + Make text underline. (Not widely supported) + */ + readonly underline: CSPair; + + /** + Make text overline. + + Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash. + */ + readonly overline: CSPair; + + /** + Inverse background and foreground colors. + */ + readonly inverse: CSPair; + + /** + Prints the text, but makes it invisible. + */ + readonly hidden: CSPair; + + /** + Puts a horizontal line through the center of the text. (Not widely supported) + */ + readonly strikethrough: CSPair; +} + +export interface ForegroundColor { + readonly black: CSPair; + readonly red: CSPair; + readonly green: CSPair; + readonly yellow: CSPair; + readonly blue: CSPair; + readonly cyan: CSPair; + readonly magenta: CSPair; + readonly white: CSPair; + + /** + Alias for `blackBright`. + */ + readonly gray: CSPair; + + /** + Alias for `blackBright`. + */ + readonly grey: CSPair; + + readonly blackBright: CSPair; + readonly redBright: CSPair; + readonly greenBright: CSPair; + readonly yellowBright: CSPair; + readonly blueBright: CSPair; + readonly cyanBright: CSPair; + readonly magentaBright: CSPair; + readonly whiteBright: CSPair; +} + +export interface BackgroundColor { + readonly bgBlack: CSPair; + readonly bgRed: CSPair; + readonly bgGreen: CSPair; + readonly bgYellow: CSPair; + readonly bgBlue: CSPair; + readonly bgCyan: CSPair; + readonly bgMagenta: CSPair; + readonly bgWhite: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGray: CSPair; + + /** + Alias for `bgBlackBright`. + */ + readonly bgGrey: CSPair; + + readonly bgBlackBright: CSPair; + readonly bgRedBright: CSPair; + readonly bgGreenBright: CSPair; + readonly bgYellowBright: CSPair; + readonly bgBlueBright: CSPair; + readonly bgCyanBright: CSPair; + readonly bgMagentaBright: CSPair; + readonly bgWhiteBright: CSPair; +} + +export interface ConvertColor { + /** + Convert from the RGB color space to the ANSI 256 color space. + + @param red - (`0...255`) + @param green - (`0...255`) + @param blue - (`0...255`) + */ + rgbToAnsi256(red: number, green: number, blue: number): number; + + /** + Convert from the RGB HEX color space to the RGB color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToRgb(hex: string): [red: number, green: number, blue: number]; + + /** + Convert from the RGB HEX color space to the ANSI 256 color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToAnsi256(hex: string): number; + + /** + Convert from the ANSI 256 color space to the ANSI 16 color space. + + @param code - A number representing the ANSI 256 color. + */ + ansi256ToAnsi(code: number): number; + + /** + Convert from the RGB color space to the ANSI 16 color space. + + @param red - (`0...255`) + @param green - (`0...255`) + @param blue - (`0...255`) + */ + rgbToAnsi(red: number, green: number, blue: number): number; + + /** + Convert from the RGB HEX color space to the ANSI 16 color space. + + @param hex - A hexadecimal string containing RGB data. + */ + hexToAnsi(hex: string): number; +} + +/** +Basic modifier names. +*/ +export type ModifierName = keyof Modifier; + +/** +Basic foreground color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ForegroundColorName = keyof ForegroundColor; + +/** +Basic background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type BackgroundColorName = keyof BackgroundColor; + +/** +Basic color names. The combination of foreground and background color names. + +[More colors here.](https://github.com/chalk/chalk/blob/main/readme.md#256-and-truecolor-color-support) +*/ +export type ColorName = ForegroundColorName | BackgroundColorName; + +/** +Basic modifier names. +*/ +export const modifierNames: readonly ModifierName[]; + +/** +Basic foreground color names. +*/ +export const foregroundColorNames: readonly ForegroundColorName[]; + +/** +Basic background color names. +*/ +export const backgroundColorNames: readonly BackgroundColorName[]; + +/* +Basic color names. The combination of foreground and background color names. +*/ +export const colorNames: readonly ColorName[]; + +declare const ansiStyles: { + readonly modifier: Modifier; + readonly color: ColorBase & ForegroundColor; + readonly bgColor: ColorBase & BackgroundColor; + readonly codes: ReadonlyMap; +} & ForegroundColor & BackgroundColor & Modifier & ConvertColor; + +export default ansiStyles; diff --git a/node_modules/ansi-styles/index.js b/node_modules/ansi-styles/index.js new file mode 100644 index 00000000..d7bede44 --- /dev/null +++ b/node_modules/ansi-styles/index.js @@ -0,0 +1,223 @@ +const ANSI_BACKGROUND_OFFSET = 10; + +const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`; + +const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`; + +const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`; + +const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + gray: [90, 39], // Alias of `blackBright` + grey: [90, 39], // Alias of `blackBright` + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39], + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgGray: [100, 49], // Alias of `bgBlackBright` + bgGrey: [100, 49], // Alias of `bgBlackBright` + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49], + }, +}; + +export const modifierNames = Object.keys(styles.modifier); +export const foregroundColorNames = Object.keys(styles.color); +export const backgroundColorNames = Object.keys(styles.bgColor); +export const colorNames = [...foregroundColorNames, ...backgroundColorNames]; + +function assembleStyles() { + const codes = new Map(); + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m`, + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false, + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false, + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi = wrapAnsi16(); + styles.color.ansi256 = wrapAnsi256(); + styles.color.ansi16m = wrapAnsi16m(); + styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); + + // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js + Object.defineProperties(styles, { + rgbToAnsi256: { + value: (red, green, blue) => { + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (red === green && green === blue) { + if (red < 8) { + return 16; + } + + if (red > 248) { + return 231; + } + + return Math.round(((red - 8) / 247) * 24) + 232; + } + + return 16 + + (36 * Math.round(red / 255 * 5)) + + (6 * Math.round(green / 255 * 5)) + + Math.round(blue / 255 * 5); + }, + enumerable: false, + }, + hexToRgb: { + value: hex => { + const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); + if (!matches) { + return [0, 0, 0]; + } + + let [colorString] = matches; + + if (colorString.length === 3) { + colorString = [...colorString].map(character => character + character).join(''); + } + + const integer = Number.parseInt(colorString, 16); + + return [ + /* eslint-disable no-bitwise */ + (integer >> 16) & 0xFF, + (integer >> 8) & 0xFF, + integer & 0xFF, + /* eslint-enable no-bitwise */ + ]; + }, + enumerable: false, + }, + hexToAnsi256: { + value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)), + enumerable: false, + }, + ansi256ToAnsi: { + value: code => { + if (code < 8) { + return 30 + code; + } + + if (code < 16) { + return 90 + (code - 8); + } + + let red; + let green; + let blue; + + if (code >= 232) { + red = (((code - 232) * 10) + 8) / 255; + green = red; + blue = red; + } else { + code -= 16; + + const remainder = code % 36; + + red = Math.floor(code / 36) / 5; + green = Math.floor(remainder / 6) / 5; + blue = (remainder % 6) / 5; + } + + const value = Math.max(red, green, blue) * 2; + + if (value === 0) { + return 30; + } + + // eslint-disable-next-line no-bitwise + let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red)); + + if (value === 2) { + result += 60; + } + + return result; + }, + enumerable: false, + }, + rgbToAnsi: { + value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), + enumerable: false, + }, + hexToAnsi: { + value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), + enumerable: false, + }, + }); + + return styles; +} + +const ansiStyles = assembleStyles(); + +export default ansiStyles; diff --git a/node_modules/ansi-styles/license b/node_modules/ansi-styles/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/ansi-styles/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/ansi-styles/package.json b/node_modules/ansi-styles/package.json new file mode 100644 index 00000000..6cd3ca5b --- /dev/null +++ b/node_modules/ansi-styles/package.json @@ -0,0 +1,54 @@ +{ + "name": "ansi-styles", + "version": "6.2.1", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": "chalk/ansi-styles", + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd", + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "ava": "^3.15.0", + "svg-term-cli": "^2.1.1", + "tsd": "^0.19.0", + "xo": "^0.47.0" + } +} diff --git a/node_modules/ansi-styles/readme.md b/node_modules/ansi-styles/readme.md new file mode 100644 index 00000000..6d04183f --- /dev/null +++ b/node_modules/ansi-styles/readme.md @@ -0,0 +1,173 @@ +# ansi-styles + +> [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings. + +![](screenshot.png) + +## Install + +```sh +npm install ansi-styles +``` + +## Usage + +```js +import styles from 'ansi-styles'; + +console.log(`${styles.green.open}Hello world!${styles.green.close}`); + + +// Color conversion between 256/truecolor +// NOTE: When converting from truecolor to 256 colors, the original color +// may be degraded to fit the new color palette. This means terminals +// that do not support 16 million colors will best-match the +// original color. +console.log(`${styles.color.ansi(styles.rgbToAnsi(199, 20, 250))}Hello World${styles.color.close}`) +console.log(`${styles.color.ansi256(styles.rgbToAnsi256(199, 20, 250))}Hello World${styles.color.close}`) +console.log(`${styles.color.ansi16m(...styles.hexToRgb('#abcdef'))}Hello World${styles.color.close}`) +``` + +## API + +### `open` and `close` + +Each style has an `open` and `close` property. + +### `modifierNames`, `foregroundColorNames`, `backgroundColorNames`, and `colorNames` + +All supported style strings are exposed as an array of strings for convenience. `colorNames` is the combination of `foregroundColorNames` and `backgroundColorNames`. + +This can be useful if you need to validate input: + +```js +import {modifierNames, foregroundColorNames} from 'ansi-styles'; + +console.log(modifierNames.includes('bold')); +//=> true + +console.log(foregroundColorNames.includes('pink')); +//=> false +``` + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(Not widely supported)* +- `underline` +- `overline` *Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash.* +- `inverse` +- `hidden` +- `strikethrough` *(Not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `blackBright` (alias: `gray`, `grey`) +- `redBright` +- `greenBright` +- `yellowBright` +- `blueBright` +- `magentaBright` +- `cyanBright` +- `whiteBright` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` +- `bgBlackBright` (alias: `bgGray`, `bgGrey`) +- `bgRedBright` +- `bgGreenBright` +- `bgYellowBright` +- `bgBlueBright` +- `bgMagentaBright` +- `bgCyanBright` +- `bgWhiteBright` + +## Advanced usage + +By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `styles.modifier` +- `styles.color` +- `styles.bgColor` + +###### Example + +```js +import styles from 'ansi-styles'; + +console.log(styles.color.green.open); +``` + +Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `styles.codes`, which returns a `Map` with the open codes as keys and close codes as values. + +###### Example + +```js +import styles from 'ansi-styles'; + +console.log(styles.codes.get(36)); +//=> 39 +``` + +## 16 / 256 / 16 million (TrueColor) support + +`ansi-styles` allows converting between various color formats and ANSI escapes, with support for 16, 256 and [16 million colors](https://gist.github.com/XVilka/8346728). + +The following color spaces are supported: + +- `rgb` +- `hex` +- `ansi256` +- `ansi` + +To use these, call the associated conversion function with the intended output, for example: + +```js +import styles from 'ansi-styles'; + +styles.color.ansi(styles.rgbToAnsi(100, 200, 15)); // RGB to 16 color ansi foreground code +styles.bgColor.ansi(styles.hexToAnsi('#C0FFEE')); // HEX to 16 color ansi foreground code + +styles.color.ansi256(styles.rgbToAnsi256(100, 200, 15)); // RGB to 256 color ansi foreground code +styles.bgColor.ansi256(styles.hexToAnsi256('#C0FFEE')); // HEX to 256 color ansi foreground code + +styles.color.ansi16m(100, 200, 15); // RGB to 16 million color foreground code +styles.bgColor.ansi16m(...styles.hexToRgb('#C0FFEE')); // Hex (RGB) to 16 million color foreground code +``` + +## Related + +- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + +## For enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of `ansi-styles` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/any-promise/.jshintrc b/node_modules/any-promise/.jshintrc new file mode 100644 index 00000000..979105e9 --- /dev/null +++ b/node_modules/any-promise/.jshintrc @@ -0,0 +1,4 @@ +{ + "node":true, + "strict":true +} diff --git a/node_modules/any-promise/.npmignore b/node_modules/any-promise/.npmignore new file mode 100644 index 00000000..1354abc0 --- /dev/null +++ b/node_modules/any-promise/.npmignore @@ -0,0 +1,7 @@ +.git* +test/ +test-browser/ +build/ +.travis.yml +*.swp +Makefile diff --git a/node_modules/any-promise/LICENSE b/node_modules/any-promise/LICENSE new file mode 100644 index 00000000..9187fe5d --- /dev/null +++ b/node_modules/any-promise/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2014-2016 Kevin Beaty + +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/any-promise/README.md b/node_modules/any-promise/README.md new file mode 100644 index 00000000..174bea4a --- /dev/null +++ b/node_modules/any-promise/README.md @@ -0,0 +1,161 @@ +## Any Promise + +[![Build Status](https://secure.travis-ci.org/kevinbeaty/any-promise.svg)](http://travis-ci.org/kevinbeaty/any-promise) + +Let your library support any ES 2015 (ES6) compatible `Promise` and leave the choice to application authors. The application can *optionally* register its preferred `Promise` implementation and it will be exported when requiring `any-promise` from library code. + +If no preference is registered, defaults to the global `Promise` for newer Node.js versions. The browser version defaults to the window `Promise`, so polyfill or register as necessary. + +### Usage with global Promise: + +Assuming the global `Promise` is the desired implementation: + +```bash +# Install any libraries depending on any-promise +$ npm install mz +``` + +The installed libraries will use global Promise by default. + +```js +// in library +var Promise = require('any-promise') // the global Promise + +function promiseReturningFunction(){ + return new Promise(function(resolve, reject){...}) +} +``` + +### Usage with registration: + +Assuming `bluebird` is the desired Promise implementation: + +```bash +# Install preferred promise library +$ npm install bluebird +# Install any-promise to allow registration +$ npm install any-promise +# Install any libraries you would like to use depending on any-promise +$ npm install mz +``` + +Register your preference in the application entry point before any other `require` of packages that load `any-promise`: + +```javascript +// top of application index.js or other entry point +require('any-promise/register/bluebird') + +// -or- Equivalent to above, but allows customization of Promise library +require('any-promise/register')('bluebird', {Promise: require('bluebird')}) +``` + +Now that the implementation is registered, you can use any package depending on `any-promise`: + + +```javascript +var fsp = require('mz/fs') // mz/fs will use registered bluebird promises +var Promise = require('any-promise') // the registered bluebird promise +``` + +It is safe to call `register` multiple times, but it must always be with the same implementation. + +Again, registration is *optional*. It should only be called by the application user if overriding the global `Promise` implementation is desired. + +### Optional Application Registration + +As an application author, you can *optionally* register a preferred `Promise` implementation on application startup (before any call to `require('any-promise')`: + +You must register your preference before any call to `require('any-promise')` (by you or required packages), and only one implementation can be registered. Typically, this registration would occur at the top of the application entry point. + + +#### Registration shortcuts + +If you are using a known `Promise` implementation, you can register your preference with a shortcut: + + +```js +require('any-promise/register/bluebird') +// -or- +import 'any-promise/register/q'; +``` + +Shortcut registration is the preferred registration method as it works in the browser and Node.js. It is also convenient for using with `import` and many test runners, that offer a `--require` flag: + +``` +$ ava --require=any-promise/register/bluebird test.js +``` + +Current known implementations include `bluebird`, `q`, `when`, `rsvp`, `es6-promise`, `promise`, `native-promise-only`, `pinkie`, `vow` and `lie`. If you are not using a known implementation, you can use another registration method described below. + + +#### Basic Registration + +As an alternative to registration shortcuts, you can call the `register` function with the preferred `Promise` implementation. The benefit of this approach is that a `Promise` library can be required by name without being a known implementation. This approach does NOT work in the browser. To use `any-promise` in the browser use either registration shortcuts or specify the `Promise` constructor using advanced registration (see below). + +```javascript +require('any-promise/register')('when') +// -or- require('any-promise/register')('any other ES6 compatible library (known or otherwise)') +``` + +This registration method will try to detect the `Promise` constructor from requiring the specified implementation. If you would like to specify your own constructor, see advanced registration. + + +#### Advanced Registration + +To use the browser version, you should either install a polyfill or explicitly register the `Promise` constructor: + +```javascript +require('any-promise/register')('bluebird', {Promise: require('bluebird')}) +``` + +This could also be used for registering a custom `Promise` implementation or subclass. + +Your preference will be registered globally, allowing a single registration even if multiple versions of `any-promise` are installed in the NPM dependency tree or are using multiple bundled JavaScript files in the browser. You can bypass this global registration in options: + + +```javascript +require('../register')('es6-promise', {Promise: require('es6-promise').Promise, global: false}) +``` + +### Library Usage + +To use any `Promise` constructor, simply require it: + +```javascript +var Promise = require('any-promise'); + +return Promise + .all([xf, f, init, coll]) + .then(fn); + + +return new Promise(function(resolve, reject){ + try { + resolve(item); + } catch(e){ + reject(e); + } +}); + +``` + +Except noted below, libraries using `any-promise` should only use [documented](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) functions as there is no guarantee which implementation will be chosen by the application author. Libraries should never call `register`, only the application user should call if desired. + + +#### Advanced Library Usage + +If your library needs to branch code based on the registered implementation, you can retrieve it using `var impl = require('any-promise/implementation')`, where `impl` will be the package name (`"bluebird"`, `"when"`, etc.) if registered, `"global.Promise"` if using the global version on Node.js, or `"window.Promise"` if using the browser version. You should always include a default case, as there is no guarantee what package may be registered. + + +### Support for old Node.js versions + +Node.js versions prior to `v0.12` may have contained buggy versions of the global `Promise`. For this reason, the global `Promise` is not loaded automatically for these old versions. If using `any-promise` in Node.js versions versions `<= v0.12`, the user should register a desired implementation. + +If an implementation is not registered, `any-promise` will attempt to discover an installed `Promise` implementation. If no implementation can be found, an error will be thrown on `require('any-promise')`. While the auto-discovery usually avoids errors, it is non-deterministic. It is recommended that the user always register a preferred implementation for older Node.js versions. + +This auto-discovery is only available for Node.jS versions prior to `v0.12`. Any newer versions will always default to the global `Promise` implementation. + +### Related + +- [any-observable](https://github.com/sindresorhus/any-observable) - `any-promise` for Observables. + diff --git a/node_modules/any-promise/implementation.d.ts b/node_modules/any-promise/implementation.d.ts new file mode 100644 index 00000000..c331a56a --- /dev/null +++ b/node_modules/any-promise/implementation.d.ts @@ -0,0 +1,3 @@ +declare var implementation: string; + +export = implementation; diff --git a/node_modules/any-promise/implementation.js b/node_modules/any-promise/implementation.js new file mode 100644 index 00000000..a45ae94d --- /dev/null +++ b/node_modules/any-promise/implementation.js @@ -0,0 +1 @@ +module.exports = require('./register')().implementation diff --git a/node_modules/any-promise/index.d.ts b/node_modules/any-promise/index.d.ts new file mode 100644 index 00000000..9f646c5d --- /dev/null +++ b/node_modules/any-promise/index.d.ts @@ -0,0 +1,73 @@ +declare class Promise implements Promise.Thenable { + /** + * If you call resolve in the body of the callback passed to the constructor, + * your promise is fulfilled with result object passed to resolve. + * If you call reject your promise is rejected with the object passed to resolve. + * For consistency and debugging (eg stack traces), obj should be an instanceof Error. + * Any errors thrown in the constructor callback will be implicitly passed to reject(). + */ + constructor (callback: (resolve : (value?: R | Promise.Thenable) => void, reject: (error?: any) => void) => void); + + /** + * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. + * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. + * Both callbacks have a single parameter , the fulfillment value or rejection reason. + * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. + * If an error is thrown in the callback, the returned promise rejects with that error. + * + * @param onFulfilled called when/if "promise" resolves + * @param onRejected called when/if "promise" rejects + */ + then (onFulfilled?: (value: R) => U | Promise.Thenable, onRejected?: (error: any) => U | Promise.Thenable): Promise; + then (onFulfilled?: (value: R) => U | Promise.Thenable, onRejected?: (error: any) => void): Promise; + + /** + * Sugar for promise.then(undefined, onRejected) + * + * @param onRejected called when/if "promise" rejects + */ + catch (onRejected?: (error: any) => U | Promise.Thenable): Promise; + + /** + * Make a new promise from the thenable. + * A thenable is promise-like in as far as it has a "then" method. + */ + static resolve (): Promise; + static resolve (value: R | Promise.Thenable): Promise; + + /** + * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error + */ + static reject (error: any): Promise; + + /** + * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. + * the array passed to all can be a mixture of promise-like objects and other objects. + * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. + */ + static all (values: [T1 | Promise.Thenable, T2 | Promise.Thenable, T3 | Promise.Thenable, T4 | Promise.Thenable , T5 | Promise.Thenable, T6 | Promise.Thenable, T7 | Promise.Thenable, T8 | Promise.Thenable, T9 | Promise.Thenable, T10 | Promise.Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + static all (values: [T1 | Promise.Thenable, T2 | Promise.Thenable, T3 | Promise.Thenable, T4 | Promise.Thenable , T5 | Promise.Thenable, T6 | Promise.Thenable, T7 | Promise.Thenable, T8 | Promise.Thenable, T9 | Promise.Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + static all (values: [T1 | Promise.Thenable, T2 | Promise.Thenable, T3 | Promise.Thenable, T4 | Promise.Thenable , T5 | Promise.Thenable, T6 | Promise.Thenable, T7 | Promise.Thenable, T8 | Promise.Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + static all (values: [T1 | Promise.Thenable, T2 | Promise.Thenable, T3 | Promise.Thenable, T4 | Promise.Thenable , T5 | Promise.Thenable, T6 | Promise.Thenable, T7 | Promise.Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + static all (values: [T1 | Promise.Thenable, T2 | Promise.Thenable, T3 | Promise.Thenable, T4 | Promise.Thenable , T5 | Promise.Thenable, T6 | Promise.Thenable]): Promise<[T1, T2, T3, T4, T5, T6]>; + static all (values: [T1 | Promise.Thenable, T2 | Promise.Thenable, T3 | Promise.Thenable, T4 | Promise.Thenable , T5 | Promise.Thenable]): Promise<[T1, T2, T3, T4, T5]>; + static all (values: [T1 | Promise.Thenable, T2 | Promise.Thenable, T3 | Promise.Thenable, T4 | Promise.Thenable ]): Promise<[T1, T2, T3, T4]>; + static all (values: [T1 | Promise.Thenable, T2 | Promise.Thenable, T3 | Promise.Thenable]): Promise<[T1, T2, T3]>; + static all (values: [T1 | Promise.Thenable, T2 | Promise.Thenable]): Promise<[T1, T2]>; + static all (values: [T1 | Promise.Thenable]): Promise<[T1]>; + static all (values: Array>): Promise; + + /** + * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. + */ + static race (promises: (R | Promise.Thenable)[]): Promise; +} + +declare namespace Promise { + export interface Thenable { + then (onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; + then (onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; + } +} + +export = Promise; diff --git a/node_modules/any-promise/index.js b/node_modules/any-promise/index.js new file mode 100644 index 00000000..74b85483 --- /dev/null +++ b/node_modules/any-promise/index.js @@ -0,0 +1 @@ +module.exports = require('./register')().Promise diff --git a/node_modules/any-promise/loader.js b/node_modules/any-promise/loader.js new file mode 100644 index 00000000..e1649142 --- /dev/null +++ b/node_modules/any-promise/loader.js @@ -0,0 +1,78 @@ +"use strict" + // global key for user preferred registration +var REGISTRATION_KEY = '@@any-promise/REGISTRATION', + // Prior registration (preferred or detected) + registered = null + +/** + * Registers the given implementation. An implementation must + * be registered prior to any call to `require("any-promise")`, + * typically on application load. + * + * If called with no arguments, will return registration in + * following priority: + * + * For Node.js: + * + * 1. Previous registration + * 2. global.Promise if node.js version >= 0.12 + * 3. Auto detected promise based on first sucessful require of + * known promise libraries. Note this is a last resort, as the + * loaded library is non-deterministic. node.js >= 0.12 will + * always use global.Promise over this priority list. + * 4. Throws error. + * + * For Browser: + * + * 1. Previous registration + * 2. window.Promise + * 3. Throws error. + * + * Options: + * + * Promise: Desired Promise constructor + * global: Boolean - Should the registration be cached in a global variable to + * allow cross dependency/bundle registration? (default true) + */ +module.exports = function(root, loadImplementation){ + return function register(implementation, opts){ + implementation = implementation || null + opts = opts || {} + // global registration unless explicitly {global: false} in options (default true) + var registerGlobal = opts.global !== false; + + // load any previous global registration + if(registered === null && registerGlobal){ + registered = root[REGISTRATION_KEY] || null + } + + if(registered !== null + && implementation !== null + && registered.implementation !== implementation){ + // Throw error if attempting to redefine implementation + throw new Error('any-promise already defined as "'+registered.implementation+ + '". You can only register an implementation before the first '+ + ' call to require("any-promise") and an implementation cannot be changed') + } + + if(registered === null){ + // use provided implementation + if(implementation !== null && typeof opts.Promise !== 'undefined'){ + registered = { + Promise: opts.Promise, + implementation: implementation + } + } else { + // require implementation if implementation is specified but not provided + registered = loadImplementation(implementation) + } + + if(registerGlobal){ + // register preference globally in case multiple installations + root[REGISTRATION_KEY] = registered + } + } + + return registered + } +} diff --git a/node_modules/any-promise/optional.js b/node_modules/any-promise/optional.js new file mode 100644 index 00000000..f3889420 --- /dev/null +++ b/node_modules/any-promise/optional.js @@ -0,0 +1,6 @@ +"use strict"; +try { + module.exports = require('./register')().Promise || null +} catch(e) { + module.exports = null +} diff --git a/node_modules/any-promise/package.json b/node_modules/any-promise/package.json new file mode 100644 index 00000000..5baf14cf --- /dev/null +++ b/node_modules/any-promise/package.json @@ -0,0 +1,45 @@ +{ + "name": "any-promise", + "version": "1.3.0", + "description": "Resolve any installed ES6 compatible promise", + "main": "index.js", + "typings": "index.d.ts", + "browser": { + "./register.js": "./register-shim.js" + }, + "scripts": { + "test": "ava" + }, + "repository": { + "type": "git", + "url": "https://github.com/kevinbeaty/any-promise" + }, + "keywords": [ + "promise", + "es6" + ], + "author": "Kevin Beaty", + "license": "MIT", + "bugs": { + "url": "https://github.com/kevinbeaty/any-promise/issues" + }, + "homepage": "http://github.com/kevinbeaty/any-promise", + "dependencies": {}, + "devDependencies": { + "ava": "^0.14.0", + "bluebird": "^3.0.0", + "es6-promise": "^3.0.0", + "is-promise": "^2.0.0", + "lie": "^3.0.0", + "mocha": "^2.0.0", + "native-promise-only": "^0.8.0", + "phantomjs-prebuilt": "^2.0.0", + "pinkie": "^2.0.0", + "promise": "^7.0.0", + "q": "^1.0.0", + "rsvp": "^3.0.0", + "vow": "^0.4.0", + "when": "^3.0.0", + "zuul": "^3.0.0" + } +} diff --git a/node_modules/any-promise/register-shim.js b/node_modules/any-promise/register-shim.js new file mode 100644 index 00000000..9049405c --- /dev/null +++ b/node_modules/any-promise/register-shim.js @@ -0,0 +1,18 @@ +"use strict"; +module.exports = require('./loader')(window, loadImplementation) + +/** + * Browser specific loadImplementation. Always uses `window.Promise` + * + * To register a custom implementation, must register with `Promise` option. + */ +function loadImplementation(){ + if(typeof window.Promise === 'undefined'){ + throw new Error("any-promise browser requires a polyfill or explicit registration"+ + " e.g: require('any-promise/register/bluebird')") + } + return { + Promise: window.Promise, + implementation: 'window.Promise' + } +} diff --git a/node_modules/any-promise/register.d.ts b/node_modules/any-promise/register.d.ts new file mode 100644 index 00000000..97f2fc05 --- /dev/null +++ b/node_modules/any-promise/register.d.ts @@ -0,0 +1,17 @@ +import Promise = require('./index'); + +declare function register (module?: string, options?: register.Options): register.Register; + +declare namespace register { + export interface Register { + Promise: typeof Promise; + implementation: string; + } + + export interface Options { + Promise?: typeof Promise; + global?: boolean + } +} + +export = register; diff --git a/node_modules/any-promise/register.js b/node_modules/any-promise/register.js new file mode 100644 index 00000000..255c6e2f --- /dev/null +++ b/node_modules/any-promise/register.js @@ -0,0 +1,94 @@ +"use strict" +module.exports = require('./loader')(global, loadImplementation); + +/** + * Node.js version of loadImplementation. + * + * Requires the given implementation and returns the registration + * containing {Promise, implementation} + * + * If implementation is undefined or global.Promise, loads it + * Otherwise uses require + */ +function loadImplementation(implementation){ + var impl = null + + if(shouldPreferGlobalPromise(implementation)){ + // if no implementation or env specified use global.Promise + impl = { + Promise: global.Promise, + implementation: 'global.Promise' + } + } else if(implementation){ + // if implementation specified, require it + var lib = require(implementation) + impl = { + Promise: lib.Promise || lib, + implementation: implementation + } + } else { + // try to auto detect implementation. This is non-deterministic + // and should prefer other branches, but this is our last chance + // to load something without throwing error + impl = tryAutoDetect() + } + + if(impl === null){ + throw new Error('Cannot find any-promise implementation nor'+ + ' global.Promise. You must install polyfill or call'+ + ' require("any-promise/register") with your preferred'+ + ' implementation, e.g. require("any-promise/register/bluebird")'+ + ' on application load prior to any require("any-promise").') + } + + return impl +} + +/** + * Determines if the global.Promise should be preferred if an implementation + * has not been registered. + */ +function shouldPreferGlobalPromise(implementation){ + if(implementation){ + return implementation === 'global.Promise' + } else if(typeof global.Promise !== 'undefined'){ + // Load global promise if implementation not specified + // Versions < 0.11 did not have global Promise + // Do not use for version < 0.12 as version 0.11 contained buggy versions + var version = (/v(\d+)\.(\d+)\.(\d+)/).exec(process.version) + return !(version && +version[1] == 0 && +version[2] < 12) + } + + // do not have global.Promise or another implementation was specified + return false +} + +/** + * Look for common libs as last resort there is no guarantee that + * this will return a desired implementation or even be deterministic. + * The priority is also nearly arbitrary. We are only doing this + * for older versions of Node.js <0.12 that do not have a reasonable + * global.Promise implementation and we the user has not registered + * the preference. This preserves the behavior of any-promise <= 0.1 + * and may be deprecated or removed in the future + */ +function tryAutoDetect(){ + var libs = [ + "es6-promise", + "promise", + "native-promise-only", + "bluebird", + "rsvp", + "when", + "q", + "pinkie", + "lie", + "vow"] + var i = 0, len = libs.length + for(; i < len; i++){ + try { + return loadImplementation(libs[i]) + } catch(e){} + } + return null +} diff --git a/node_modules/any-promise/register/bluebird.d.ts b/node_modules/any-promise/register/bluebird.d.ts new file mode 100644 index 00000000..336ce12b --- /dev/null +++ b/node_modules/any-promise/register/bluebird.d.ts @@ -0,0 +1 @@ +export {} diff --git a/node_modules/any-promise/register/bluebird.js b/node_modules/any-promise/register/bluebird.js new file mode 100644 index 00000000..de0f87eb --- /dev/null +++ b/node_modules/any-promise/register/bluebird.js @@ -0,0 +1,2 @@ +'use strict'; +require('../register')('bluebird', {Promise: require('bluebird')}) diff --git a/node_modules/any-promise/register/es6-promise.d.ts b/node_modules/any-promise/register/es6-promise.d.ts new file mode 100644 index 00000000..336ce12b --- /dev/null +++ b/node_modules/any-promise/register/es6-promise.d.ts @@ -0,0 +1 @@ +export {} diff --git a/node_modules/any-promise/register/es6-promise.js b/node_modules/any-promise/register/es6-promise.js new file mode 100644 index 00000000..59bd55b7 --- /dev/null +++ b/node_modules/any-promise/register/es6-promise.js @@ -0,0 +1,2 @@ +'use strict'; +require('../register')('es6-promise', {Promise: require('es6-promise').Promise}) diff --git a/node_modules/any-promise/register/lie.d.ts b/node_modules/any-promise/register/lie.d.ts new file mode 100644 index 00000000..336ce12b --- /dev/null +++ b/node_modules/any-promise/register/lie.d.ts @@ -0,0 +1 @@ +export {} diff --git a/node_modules/any-promise/register/lie.js b/node_modules/any-promise/register/lie.js new file mode 100644 index 00000000..7d305ca4 --- /dev/null +++ b/node_modules/any-promise/register/lie.js @@ -0,0 +1,2 @@ +'use strict'; +require('../register')('lie', {Promise: require('lie')}) diff --git a/node_modules/any-promise/register/native-promise-only.d.ts b/node_modules/any-promise/register/native-promise-only.d.ts new file mode 100644 index 00000000..336ce12b --- /dev/null +++ b/node_modules/any-promise/register/native-promise-only.d.ts @@ -0,0 +1 @@ +export {} diff --git a/node_modules/any-promise/register/native-promise-only.js b/node_modules/any-promise/register/native-promise-only.js new file mode 100644 index 00000000..70a5a5e1 --- /dev/null +++ b/node_modules/any-promise/register/native-promise-only.js @@ -0,0 +1,2 @@ +'use strict'; +require('../register')('native-promise-only', {Promise: require('native-promise-only')}) diff --git a/node_modules/any-promise/register/pinkie.d.ts b/node_modules/any-promise/register/pinkie.d.ts new file mode 100644 index 00000000..336ce12b --- /dev/null +++ b/node_modules/any-promise/register/pinkie.d.ts @@ -0,0 +1 @@ +export {} diff --git a/node_modules/any-promise/register/pinkie.js b/node_modules/any-promise/register/pinkie.js new file mode 100644 index 00000000..caaf98a5 --- /dev/null +++ b/node_modules/any-promise/register/pinkie.js @@ -0,0 +1,2 @@ +'use strict'; +require('../register')('pinkie', {Promise: require('pinkie')}) diff --git a/node_modules/any-promise/register/promise.d.ts b/node_modules/any-promise/register/promise.d.ts new file mode 100644 index 00000000..336ce12b --- /dev/null +++ b/node_modules/any-promise/register/promise.d.ts @@ -0,0 +1 @@ +export {} diff --git a/node_modules/any-promise/register/promise.js b/node_modules/any-promise/register/promise.js new file mode 100644 index 00000000..746620d4 --- /dev/null +++ b/node_modules/any-promise/register/promise.js @@ -0,0 +1,2 @@ +'use strict'; +require('../register')('promise', {Promise: require('promise')}) diff --git a/node_modules/any-promise/register/q.d.ts b/node_modules/any-promise/register/q.d.ts new file mode 100644 index 00000000..336ce12b --- /dev/null +++ b/node_modules/any-promise/register/q.d.ts @@ -0,0 +1 @@ +export {} diff --git a/node_modules/any-promise/register/q.js b/node_modules/any-promise/register/q.js new file mode 100644 index 00000000..0fc633a9 --- /dev/null +++ b/node_modules/any-promise/register/q.js @@ -0,0 +1,2 @@ +'use strict'; +require('../register')('q', {Promise: require('q').Promise}) diff --git a/node_modules/any-promise/register/rsvp.d.ts b/node_modules/any-promise/register/rsvp.d.ts new file mode 100644 index 00000000..336ce12b --- /dev/null +++ b/node_modules/any-promise/register/rsvp.d.ts @@ -0,0 +1 @@ +export {} diff --git a/node_modules/any-promise/register/rsvp.js b/node_modules/any-promise/register/rsvp.js new file mode 100644 index 00000000..02b13180 --- /dev/null +++ b/node_modules/any-promise/register/rsvp.js @@ -0,0 +1,2 @@ +'use strict'; +require('../register')('rsvp', {Promise: require('rsvp').Promise}) diff --git a/node_modules/any-promise/register/vow.d.ts b/node_modules/any-promise/register/vow.d.ts new file mode 100644 index 00000000..336ce12b --- /dev/null +++ b/node_modules/any-promise/register/vow.d.ts @@ -0,0 +1 @@ +export {} diff --git a/node_modules/any-promise/register/vow.js b/node_modules/any-promise/register/vow.js new file mode 100644 index 00000000..5b6868c4 --- /dev/null +++ b/node_modules/any-promise/register/vow.js @@ -0,0 +1,2 @@ +'use strict'; +require('../register')('vow', {Promise: require('vow').Promise}) diff --git a/node_modules/any-promise/register/when.d.ts b/node_modules/any-promise/register/when.d.ts new file mode 100644 index 00000000..336ce12b --- /dev/null +++ b/node_modules/any-promise/register/when.d.ts @@ -0,0 +1 @@ +export {} diff --git a/node_modules/any-promise/register/when.js b/node_modules/any-promise/register/when.js new file mode 100644 index 00000000..d91c13d3 --- /dev/null +++ b/node_modules/any-promise/register/when.js @@ -0,0 +1,2 @@ +'use strict'; +require('../register')('when', {Promise: require('when').Promise}) diff --git a/node_modules/anymatch/LICENSE b/node_modules/anymatch/LICENSE new file mode 100644 index 00000000..491766ca --- /dev/null +++ b/node_modules/anymatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com) + +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/anymatch/README.md b/node_modules/anymatch/README.md new file mode 100644 index 00000000..1dd67f53 --- /dev/null +++ b/node_modules/anymatch/README.md @@ -0,0 +1,87 @@ +anymatch [![Build Status](https://travis-ci.org/micromatch/anymatch.svg?branch=master)](https://travis-ci.org/micromatch/anymatch) [![Coverage Status](https://img.shields.io/coveralls/micromatch/anymatch.svg?branch=master)](https://coveralls.io/r/micromatch/anymatch?branch=master) +====== +Javascript module to match a string against a regular expression, glob, string, +or function that takes the string as an argument and returns a truthy or falsy +value. The matcher can also be an array of any or all of these. Useful for +allowing a very flexible user-defined config to define things like file paths. + +__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__ + + +Usage +----- +```sh +npm install anymatch +``` + +#### anymatch(matchers, testString, [returnIndex], [options]) +* __matchers__: (_Array|String|RegExp|Function_) +String to be directly matched, string with glob patterns, regular expression +test, function that takes the testString as an argument and returns a truthy +value if it should be matched, or an array of any number and mix of these types. +* __testString__: (_String|Array_) The string to test against the matchers. If +passed as an array, the first element of the array will be used as the +`testString` for non-function matchers, while the entire array will be applied +as the arguments for function matchers. +* __options__: (_Object_ [optional]_) Any of the [picomatch](https://github.com/micromatch/picomatch#options) options. + * __returnIndex__: (_Boolean [optional]_) If true, return the array index of +the first matcher that that testString matched, or -1 if no match, instead of a +boolean result. + +```js +const anymatch = require('anymatch'); + +const matchers = [ 'path/to/file.js', 'path/anyjs/**/*.js', /foo.js$/, string => string.includes('bar') && string.length > 10 ] ; + +anymatch(matchers, 'path/to/file.js'); // true +anymatch(matchers, 'path/anyjs/baz.js'); // true +anymatch(matchers, 'path/to/foo.js'); // true +anymatch(matchers, 'path/to/bar.js'); // true +anymatch(matchers, 'bar.js'); // false + +// returnIndex = true +anymatch(matchers, 'foo.js', {returnIndex: true}); // 2 +anymatch(matchers, 'path/anyjs/foo.js', {returnIndex: true}); // 1 + +// any picomatc + +// using globs to match directories and their children +anymatch('node_modules', 'node_modules'); // true +anymatch('node_modules', 'node_modules/somelib/index.js'); // false +anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true +anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false +anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true + +const matcher = anymatch(matchers); +['foo.js', 'bar.js'].filter(matcher); // [ 'foo.js' ] +anymatch master* ❯ + +``` + +#### anymatch(matchers) +You can also pass in only your matcher(s) to get a curried function that has +already been bound to the provided matching criteria. This can be used as an +`Array#filter` callback. + +```js +var matcher = anymatch(matchers); + +matcher('path/to/file.js'); // true +matcher('path/anyjs/baz.js', true); // 1 + +['foo.js', 'bar.js'].filter(matcher); // ['foo.js'] +``` + +Changelog +---------- +[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases) + +- **v3.0:** Removed `startIndex` and `endIndex` arguments. Node 8.x-only. +- **v2.0:** [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information). +- **v1.2:** anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch) +for glob pattern matching. Issues with glob pattern matching should be +reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues). + +License +------- +[ISC](https://raw.github.com/micromatch/anymatch/master/LICENSE) diff --git a/node_modules/anymatch/index.d.ts b/node_modules/anymatch/index.d.ts new file mode 100644 index 00000000..3ef7eaad --- /dev/null +++ b/node_modules/anymatch/index.d.ts @@ -0,0 +1,20 @@ +type AnymatchFn = (testString: string) => boolean; +type AnymatchPattern = string|RegExp|AnymatchFn; +type AnymatchMatcher = AnymatchPattern|AnymatchPattern[] +type AnymatchTester = { + (testString: string|any[], returnIndex: true): number; + (testString: string|any[]): boolean; +} + +type PicomatchOptions = {dot: boolean}; + +declare const anymatch: { + (matchers: AnymatchMatcher): AnymatchTester; + (matchers: AnymatchMatcher, testString: null, returnIndex: true | PicomatchOptions): AnymatchTester; + (matchers: AnymatchMatcher, testString: string|any[], returnIndex: true | PicomatchOptions): number; + (matchers: AnymatchMatcher, testString: string|any[]): boolean; +} + +export {AnymatchMatcher as Matcher} +export {AnymatchTester as Tester} +export default anymatch diff --git a/node_modules/anymatch/index.js b/node_modules/anymatch/index.js new file mode 100644 index 00000000..8eb73e9c --- /dev/null +++ b/node_modules/anymatch/index.js @@ -0,0 +1,104 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { value: true }); + +const picomatch = require('picomatch'); +const normalizePath = require('normalize-path'); + +/** + * @typedef {(testString: string) => boolean} AnymatchFn + * @typedef {string|RegExp|AnymatchFn} AnymatchPattern + * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher + */ +const BANG = '!'; +const DEFAULT_OPTIONS = {returnIndex: false}; +const arrify = (item) => Array.isArray(item) ? item : [item]; + +/** + * @param {AnymatchPattern} matcher + * @param {object} options + * @returns {AnymatchFn} + */ +const createPattern = (matcher, options) => { + if (typeof matcher === 'function') { + return matcher; + } + if (typeof matcher === 'string') { + const glob = picomatch(matcher, options); + return (string) => matcher === string || glob(string); + } + if (matcher instanceof RegExp) { + return (string) => matcher.test(string); + } + return (string) => false; +}; + +/** + * @param {Array} patterns + * @param {Array} negPatterns + * @param {String|Array} args + * @param {Boolean} returnIndex + * @returns {boolean|number} + */ +const matchPatterns = (patterns, negPatterns, args, returnIndex) => { + const isList = Array.isArray(args); + const _path = isList ? args[0] : args; + if (!isList && typeof _path !== 'string') { + throw new TypeError('anymatch: second argument must be a string: got ' + + Object.prototype.toString.call(_path)) + } + const path = normalizePath(_path, false); + + for (let index = 0; index < negPatterns.length; index++) { + const nglob = negPatterns[index]; + if (nglob(path)) { + return returnIndex ? -1 : false; + } + } + + const applied = isList && [path].concat(args.slice(1)); + for (let index = 0; index < patterns.length; index++) { + const pattern = patterns[index]; + if (isList ? pattern(...applied) : pattern(path)) { + return returnIndex ? index : true; + } + } + + return returnIndex ? -1 : false; +}; + +/** + * @param {AnymatchMatcher} matchers + * @param {Array|string} testString + * @param {object} options + * @returns {boolean|number|Function} + */ +const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => { + if (matchers == null) { + throw new TypeError('anymatch: specify first argument'); + } + const opts = typeof options === 'boolean' ? {returnIndex: options} : options; + const returnIndex = opts.returnIndex || false; + + // Early cache for matchers. + const mtchers = arrify(matchers); + const negatedGlobs = mtchers + .filter(item => typeof item === 'string' && item.charAt(0) === BANG) + .map(item => item.slice(1)) + .map(item => picomatch(item, opts)); + const patterns = mtchers + .filter(item => typeof item !== 'string' || (typeof item === 'string' && item.charAt(0) !== BANG)) + .map(matcher => createPattern(matcher, opts)); + + if (testString == null) { + return (testString, ri = false) => { + const returnIndex = typeof ri === 'boolean' ? ri : false; + return matchPatterns(patterns, negatedGlobs, testString, returnIndex); + } + } + + return matchPatterns(patterns, negatedGlobs, testString, returnIndex); +}; + +anymatch.default = anymatch; +module.exports = anymatch; diff --git a/node_modules/anymatch/package.json b/node_modules/anymatch/package.json new file mode 100644 index 00000000..2cb2307e --- /dev/null +++ b/node_modules/anymatch/package.json @@ -0,0 +1,48 @@ +{ + "name": "anymatch", + "version": "3.1.3", + "description": "Matches strings against configurable strings, globs, regular expressions, and/or functions", + "files": [ + "index.js", + "index.d.ts" + ], + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "author": { + "name": "Elan Shanker", + "url": "https://github.com/es128" + }, + "license": "ISC", + "homepage": "https://github.com/micromatch/anymatch", + "repository": { + "type": "git", + "url": "https://github.com/micromatch/anymatch" + }, + "keywords": [ + "match", + "any", + "string", + "file", + "fs", + "list", + "glob", + "regex", + "regexp", + "regular", + "expression", + "function" + ], + "scripts": { + "test": "nyc mocha", + "mocha": "mocha" + }, + "devDependencies": { + "mocha": "^6.1.3", + "nyc": "^14.0.0" + }, + "engines": { + "node": ">= 8" + } +} diff --git a/node_modules/arg/LICENSE.md b/node_modules/arg/LICENSE.md new file mode 100644 index 00000000..b708f872 --- /dev/null +++ b/node_modules/arg/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Vercel, 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/arg/README.md b/node_modules/arg/README.md new file mode 100644 index 00000000..6501df59 --- /dev/null +++ b/node_modules/arg/README.md @@ -0,0 +1,317 @@ +# Arg + +`arg` is an unopinionated, no-frills CLI argument parser. + +## Installation + +```bash +npm install arg +``` + +## Usage + +`arg()` takes either 1 or 2 arguments: + +1. Command line specification object (see below) +2. Parse options (_Optional_, defaults to `{permissive: false, argv: process.argv.slice(2), stopAtPositional: false}`) + +It returns an object with any values present on the command-line (missing options are thus +missing from the resulting object). Arg performs no validation/requirement checking - we +leave that up to the application. + +All parameters that aren't consumed by options (commonly referred to as "extra" parameters) +are added to `result._`, which is _always_ an array (even if no extra parameters are passed, +in which case an empty array is returned). + +```javascript +const arg = require('arg'); + +// `options` is an optional parameter +const args = arg( + spec, + (options = { permissive: false, argv: process.argv.slice(2) }) +); +``` + +For example: + +```console +$ node ./hello.js --verbose -vvv --port=1234 -n 'My name' foo bar --tag qux --tag=qix -- --foobar +``` + +```javascript +// hello.js +const arg = require('arg'); + +const args = arg({ + // Types + '--help': Boolean, + '--version': Boolean, + '--verbose': arg.COUNT, // Counts the number of times --verbose is passed + '--port': Number, // --port or --port= + '--name': String, // --name or --name= + '--tag': [String], // --tag or --tag= + + // Aliases + '-v': '--verbose', + '-n': '--name', // -n ; result is stored in --name + '--label': '--name' // --label or --label=; + // result is stored in --name +}); + +console.log(args); +/* +{ + _: ["foo", "bar", "--foobar"], + '--port': 1234, + '--verbose': 4, + '--name': "My name", + '--tag': ["qux", "qix"] +} +*/ +``` + +The values for each key=>value pair is either a type (function or [function]) or a string (indicating an alias). + +- In the case of a function, the string value of the argument's value is passed to it, + and the return value is used as the ultimate value. + +- In the case of an array, the only element _must_ be a type function. Array types indicate + that the argument may be passed multiple times, and as such the resulting value in the returned + object is an array with all of the values that were passed using the specified flag. + +- In the case of a string, an alias is established. If a flag is passed that matches the _key_, + then the _value_ is substituted in its place. + +Type functions are passed three arguments: + +1. The parameter value (always a string) +2. The parameter name (e.g. `--label`) +3. The previous value for the destination (useful for reduce-like operations or for supporting `-v` multiple times, etc.) + +This means the built-in `String`, `Number`, and `Boolean` type constructors "just work" as type functions. + +Note that `Boolean` and `[Boolean]` have special treatment - an option argument is _not_ consumed or passed, but instead `true` is +returned. These options are called "flags". + +For custom handlers that wish to behave as flags, you may pass the function through `arg.flag()`: + +```javascript +const arg = require('arg'); + +const argv = [ + '--foo', + 'bar', + '-ff', + 'baz', + '--foo', + '--foo', + 'qux', + '-fff', + 'qix' +]; + +function myHandler(value, argName, previousValue) { + /* `value` is always `true` */ + return 'na ' + (previousValue || 'batman!'); +} + +const args = arg( + { + '--foo': arg.flag(myHandler), + '-f': '--foo' + }, + { + argv + } +); + +console.log(args); +/* +{ + _: ['bar', 'baz', 'qux', 'qix'], + '--foo': 'na na na na na na na na batman!' +} +*/ +``` + +As well, `arg` supplies a helper argument handler called `arg.COUNT`, which equivalent to a `[Boolean]` argument's `.length` +property - effectively counting the number of times the boolean flag, denoted by the key, is passed on the command line.. +For example, this is how you could implement `ssh`'s multiple levels of verbosity (`-vvvv` being the most verbose). + +```javascript +const arg = require('arg'); + +const argv = ['-AAAA', '-BBBB']; + +const args = arg( + { + '-A': arg.COUNT, + '-B': [Boolean] + }, + { + argv + } +); + +console.log(args); +/* +{ + _: [], + '-A': 4, + '-B': [true, true, true, true] +} +*/ +``` + +### Options + +If a second parameter is specified and is an object, it specifies parsing options to modify the behavior of `arg()`. + +#### `argv` + +If you have already sliced or generated a number of raw arguments to be parsed (as opposed to letting `arg` +slice them from `process.argv`) you may specify them in the `argv` option. + +For example: + +```javascript +const args = arg( + { + '--foo': String + }, + { + argv: ['hello', '--foo', 'world'] + } +); +``` + +results in: + +```javascript +const args = { + _: ['hello'], + '--foo': 'world' +}; +``` + +#### `permissive` + +When `permissive` set to `true`, `arg` will push any unknown arguments +onto the "extra" argument array (`result._`) instead of throwing an error about +an unknown flag. + +For example: + +```javascript +const arg = require('arg'); + +const argv = [ + '--foo', + 'hello', + '--qux', + 'qix', + '--bar', + '12345', + 'hello again' +]; + +const args = arg( + { + '--foo': String, + '--bar': Number + }, + { + argv, + permissive: true + } +); +``` + +results in: + +```javascript +const args = { + _: ['--qux', 'qix', 'hello again'], + '--foo': 'hello', + '--bar': 12345 +}; +``` + +#### `stopAtPositional` + +When `stopAtPositional` is set to `true`, `arg` will halt parsing at the first +positional argument. + +For example: + +```javascript +const arg = require('arg'); + +const argv = ['--foo', 'hello', '--bar']; + +const args = arg( + { + '--foo': Boolean, + '--bar': Boolean + }, + { + argv, + stopAtPositional: true + } +); +``` + +results in: + +```javascript +const args = { + _: ['hello', '--bar'], + '--foo': true +}; +``` + +### Errors + +Some errors that `arg` throws provide a `.code` property in order to aid in recovering from user error, or to +differentiate between user error and developer error (bug). + +##### ARG_UNKNOWN_OPTION + +If an unknown option (not defined in the spec object) is passed, an error with code `ARG_UNKNOWN_OPTION` will be thrown: + +```js +// cli.js +try { + require('arg')({ '--hi': String }); +} catch (err) { + if (err.code === 'ARG_UNKNOWN_OPTION') { + console.log(err.message); + } else { + throw err; + } +} +``` + +```shell +node cli.js --extraneous true +Unknown or unexpected option: --extraneous +``` + +# FAQ + +A few questions and answers that have been asked before: + +### How do I require an argument with `arg`? + +Do the assertion yourself, such as: + +```javascript +const args = arg({ '--name': String }); + +if (!args['--name']) throw new Error('missing required argument: --name'); +``` + +# License + +Released under the [MIT License](LICENSE.md). diff --git a/node_modules/arg/index.d.ts b/node_modules/arg/index.d.ts new file mode 100644 index 00000000..44f9f354 --- /dev/null +++ b/node_modules/arg/index.d.ts @@ -0,0 +1,44 @@ +declare function arg( + spec: T, + options?: arg.Options +): arg.Result; + +declare namespace arg { + export const flagSymbol: unique symbol; + + export function flag(fn: T): T & { [arg.flagSymbol]: true }; + + export const COUNT: Handler & { [arg.flagSymbol]: true }; + + export type Handler = ( + value: string, + name: string, + previousValue?: T + ) => T; + + export class ArgError extends Error { + constructor(message: string, code: string); + + code: string; + } + + export interface Spec { + [key: string]: string | Handler | [Handler]; + } + + export type Result = { _: string[] } & { + [K in keyof T]?: T[K] extends Handler + ? ReturnType + : T[K] extends [Handler] + ? Array> + : never; + }; + + export interface Options { + argv?: string[]; + permissive?: boolean; + stopAtPositional?: boolean; + } +} + +export = arg; diff --git a/node_modules/arg/index.js b/node_modules/arg/index.js new file mode 100644 index 00000000..3f60f4ca --- /dev/null +++ b/node_modules/arg/index.js @@ -0,0 +1,195 @@ +const flagSymbol = Symbol('arg flag'); + +class ArgError extends Error { + constructor(msg, code) { + super(msg); + this.name = 'ArgError'; + this.code = code; + + Object.setPrototypeOf(this, ArgError.prototype); + } +} + +function arg( + opts, + { + argv = process.argv.slice(2), + permissive = false, + stopAtPositional = false + } = {} +) { + if (!opts) { + throw new ArgError( + 'argument specification object is required', + 'ARG_CONFIG_NO_SPEC' + ); + } + + const result = { _: [] }; + + const aliases = {}; + const handlers = {}; + + for (const key of Object.keys(opts)) { + if (!key) { + throw new ArgError( + 'argument key cannot be an empty string', + 'ARG_CONFIG_EMPTY_KEY' + ); + } + + if (key[0] !== '-') { + throw new ArgError( + `argument key must start with '-' but found: '${key}'`, + 'ARG_CONFIG_NONOPT_KEY' + ); + } + + if (key.length === 1) { + throw new ArgError( + `argument key must have a name; singular '-' keys are not allowed: ${key}`, + 'ARG_CONFIG_NONAME_KEY' + ); + } + + if (typeof opts[key] === 'string') { + aliases[key] = opts[key]; + continue; + } + + let type = opts[key]; + let isFlag = false; + + if ( + Array.isArray(type) && + type.length === 1 && + typeof type[0] === 'function' + ) { + const [fn] = type; + type = (value, name, prev = []) => { + prev.push(fn(value, name, prev[prev.length - 1])); + return prev; + }; + isFlag = fn === Boolean || fn[flagSymbol] === true; + } else if (typeof type === 'function') { + isFlag = type === Boolean || type[flagSymbol] === true; + } else { + throw new ArgError( + `type missing or not a function or valid array type: ${key}`, + 'ARG_CONFIG_VAD_TYPE' + ); + } + + if (key[1] !== '-' && key.length > 2) { + throw new ArgError( + `short argument keys (with a single hyphen) must have only one character: ${key}`, + 'ARG_CONFIG_SHORTOPT_TOOLONG' + ); + } + + handlers[key] = [type, isFlag]; + } + + for (let i = 0, len = argv.length; i < len; i++) { + const wholeArg = argv[i]; + + if (stopAtPositional && result._.length > 0) { + result._ = result._.concat(argv.slice(i)); + break; + } + + if (wholeArg === '--') { + result._ = result._.concat(argv.slice(i + 1)); + break; + } + + if (wholeArg.length > 1 && wholeArg[0] === '-') { + /* eslint-disable operator-linebreak */ + const separatedArguments = + wholeArg[1] === '-' || wholeArg.length === 2 + ? [wholeArg] + : wholeArg + .slice(1) + .split('') + .map((a) => `-${a}`); + /* eslint-enable operator-linebreak */ + + for (let j = 0; j < separatedArguments.length; j++) { + const arg = separatedArguments[j]; + const [originalArgName, argStr] = + arg[1] === '-' ? arg.split(/=(.*)/, 2) : [arg, undefined]; + + let argName = originalArgName; + while (argName in aliases) { + argName = aliases[argName]; + } + + if (!(argName in handlers)) { + if (permissive) { + result._.push(arg); + continue; + } else { + throw new ArgError( + `unknown or unexpected option: ${originalArgName}`, + 'ARG_UNKNOWN_OPTION' + ); + } + } + + const [type, isFlag] = handlers[argName]; + + if (!isFlag && j + 1 < separatedArguments.length) { + throw new ArgError( + `option requires argument (but was followed by another short argument): ${originalArgName}`, + 'ARG_MISSING_REQUIRED_SHORTARG' + ); + } + + if (isFlag) { + result[argName] = type(true, argName, result[argName]); + } else if (argStr === undefined) { + if ( + argv.length < i + 2 || + (argv[i + 1].length > 1 && + argv[i + 1][0] === '-' && + !( + argv[i + 1].match(/^-?\d*(\.(?=\d))?\d*$/) && + (type === Number || + // eslint-disable-next-line no-undef + (typeof BigInt !== 'undefined' && type === BigInt)) + )) + ) { + const extended = + originalArgName === argName ? '' : ` (alias for ${argName})`; + throw new ArgError( + `option requires argument: ${originalArgName}${extended}`, + 'ARG_MISSING_REQUIRED_LONGARG' + ); + } + + result[argName] = type(argv[i + 1], argName, result[argName]); + ++i; + } else { + result[argName] = type(argStr, argName, result[argName]); + } + } + } else { + result._.push(wholeArg); + } + } + + return result; +} + +arg.flag = (fn) => { + fn[flagSymbol] = true; + return fn; +}; + +// Utility types +arg.COUNT = arg.flag((v, name, existingCount) => (existingCount || 0) + 1); + +// Expose error class +arg.ArgError = ArgError; + +module.exports = arg; diff --git a/node_modules/arg/package.json b/node_modules/arg/package.json new file mode 100644 index 00000000..47368d76 --- /dev/null +++ b/node_modules/arg/package.json @@ -0,0 +1,28 @@ +{ + "name": "arg", + "version": "5.0.2", + "description": "Unopinionated, no-frills CLI argument parser", + "main": "index.js", + "types": "index.d.ts", + "repository": "vercel/arg", + "author": "Josh Junon ", + "license": "MIT", + "files": [ + "index.js", + "index.d.ts" + ], + "scripts": { + "test": "WARN_EXIT=1 jest --coverage -w 2" + }, + "devDependencies": { + "chai": "^4.1.1", + "jest": "^27.0.6", + "prettier": "^2.3.2" + }, + "prettier": { + "arrowParens": "always", + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none" + } +} diff --git a/node_modules/axobject-query/LICENSE b/node_modules/axobject-query/LICENSE new file mode 100755 index 00000000..3a8ae7c3 --- /dev/null +++ b/node_modules/axobject-query/LICENSE @@ -0,0 +1,201 @@ +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 + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "{}" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + +Copyright 2020 A11yance + +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. diff --git a/node_modules/axobject-query/README.md b/node_modules/axobject-query/README.md new file mode 100644 index 00000000..d55238cd --- /dev/null +++ b/node_modules/axobject-query/README.md @@ -0,0 +1,404 @@ +# AXObject Query + +![CI](https://github.com/A11yance/axobject-query/workflows/CI/badge.svg) + +Approximate model of the [Chrome AXObject](https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/accessibility/AXObject.h). + +The project attempts to map the AXObject concepts to the [WAI-ARIA 1.1 Roles Model](https://www.w3.org/TR/wai-aria-1.1/#roles) so that a complete representation of the semantic HTML layer, as it is exposed assistive technology, can be obtained. + +CDN URL: + +## Utilities + +### AXObjects + +```javascript +import { AXObjects } from 'axobject-query'; +``` + +#### Interface + +These methods are available on each export from the module. The typing here in the documentation is pseudo-typed. Each export will have its own specific types for each method signature. + +```javascript +{| + entries: () => Array<$Item>, + get: (key: $Key) => ?$Value, + has: (key: $Key) => boolean, + keys: () => Array<$Key>, + values: () => Array<$Value>, +|}; +``` + +### Concepts in the project + +AXObjects are mapped to their HTML and ARIA concepts in the `relatedConcepts` field. + +The `type` field is a loose association of an AXObject to the `window`, `structure` and `widget` abstract roles in ARIA. The `generic` value is given to `DivRole`; it does not exist in ARIA. Divs are special in HTML in the way that they are used as generic containers. Span might have also been associated with a generic type except that there is no `SpanRole` AXObject. + +```javascript +[ + [ 'AbbrRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'AlertDialogRole', { relatedConcepts: [ [Object] ], type: 'window' } ], + [ 'AlertRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'AnnotationRole', { relatedConcepts: [], type: 'structure' } ], + [ 'ApplicationRole', { relatedConcepts: [ [Object] ], type: 'window' } ], + [ 'ArticleRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'AudioRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'BannerRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'BlockquoteRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'BusyIndicatorRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'ButtonRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'CanvasRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'CaptionRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'CellRole', { relatedConcepts: [ [Object], [Object], [Object] ], type: 'widget' } ], + [ 'CheckBoxRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'ColorWellRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'ColumnHeaderRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'ColumnRole', { relatedConcepts: [], type: 'structure' } ], + [ 'ComboBoxRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'ComplementaryRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'ContentInfoRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'DateRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'DateTimeRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'DefinitionRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'DescriptionListDetailRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'DescriptionListRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'DescriptionListTermRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'DetailsRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'DialogRole', { relatedConcepts: [ [Object], [Object] ], type: 'window' } ], + [ 'DirectoryRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'DisclosureTriangleRole', { relatedConcepts: [], type: 'widget' } ], + [ 'DivRole', { relatedConcepts: [ [Object] ], type: 'generic' } ], + [ 'DocumentRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'EmbeddedObjectRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'FeedRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'FigcaptionRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'FigureRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'FooterRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'FormRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'GridRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'GroupRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'HeadingRole', { relatedConcepts: [ [Object], [Object], [Object], [Object], [Object], [Object], [Object] ], type: 'structure' } ], + [ 'IframePresentationalRole', { relatedConcepts: [], type: 'window' } ], + [ 'IframeRole', { relatedConcepts: [ [Object] ], type: 'window' } ], + [ 'IgnoredRole', { relatedConcepts: [], type: 'structure' } ], + [ 'ImageMapLinkRole', { relatedConcepts: [], type: 'widget' } ], + [ 'ImageMapRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'ImageRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'InlineTextBoxRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'InputTimeRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'LabelRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'LegendRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'LineBreakRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'LinkRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'ListBoxOptionRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'ListBoxRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'ListItemRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'ListMarkerRole', { relatedConcepts: [], type: 'structure' } ], + [ 'ListRole', { relatedConcepts: [ [Object], [Object], [Object] ], type: 'structure' } ], + [ 'LogRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'MainRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'MarkRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'MarqueeRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'MathRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'MenuBarRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'MenuButtonRole', { relatedConcepts: [], type: 'widget' } ], + [ 'MenuItemRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'MenuItemCheckBoxRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'MenuItemRadioRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'MenuListOptionRole', { relatedConcepts: [], type: 'widget' } ], + [ 'MenuListPopupRole', { relatedConcepts: [], type: 'widget' } ], + [ 'MenuRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'MeterRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'NavigationRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'NoneRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'NoteRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'OutlineRole', { relatedConcepts: [], type: 'structure' } ], + [ 'ParagraphRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'PopUpButtonRole', { relatedConcepts: [], type: 'widget' } ], + [ 'PreRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'PresentationalRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'ProgressIndicatorRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'RadioButtonRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'RadioGroupRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'RegionRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'RootWebAreaRole', { relatedConcepts: [], type: 'structure' } ], + [ 'RowHeaderRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'RowRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'RubyRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'RulerRole', { relatedConcepts: [], type: 'structure' } ], + [ 'ScrollAreaRole', { relatedConcepts: [], type: 'structure' } ], + [ 'ScrollBarRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'SeamlessWebAreaRole', { relatedConcepts: [], type: 'structure' } ], + [ 'SearchRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'SearchBoxRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'SliderRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'SliderThumbRole', { relatedConcepts: [], type: 'structure' } ], + [ 'SpinButtonRole', { relatedConcepts: [ [Object], [Object] ], type: 'widget' } ], + [ 'SpinButtonPartRole', { relatedConcepts: [], type: 'structure' } ], + [ 'SplitterRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'StaticTextRole', { relatedConcepts: [], type: 'structure' } ], + [ 'StatusRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'SVGRootRole', { relatedConcepts: [], type: 'structure' } ], + [ 'SwitchRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'TabGroupRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'TabRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'TableHeaderContainerRole', { relatedConcepts: [], type: 'structure' } ], + [ 'TableRole', { relatedConcepts: [ [Object], [Object] ], type: 'structure' } ], + [ 'TabListRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'TabPanelRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'TermRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'TextFieldRole', { relatedConcepts: [ [Object], [Object], [Object] ], type: 'widget' } ], + [ 'TimeRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'TimerRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'ToggleButtonRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'ToolbarRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'TreeRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'TreeGridRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'TreeItemRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'UserInterfaceTooltipRole', { relatedConcepts: [ [Object] ], type: 'structure' } ], + [ 'VideoRole', { relatedConcepts: [ [Object] ], type: 'widget' } ], + [ 'WebAreaRole', { relatedConcepts: [], type: 'structure' } ], + [ 'WindowRole', { relatedConcepts: [], type: 'window' } ], +] +``` + +### AXObject to Element + +```javascript +import { AXObjectElements } from 'axobject-query'; +``` + +AXObjects are mapped to their related HTML concepts, which may require attributes (in the case of inputs) to obtain the correct association. + +```javascript +[ + [ 'AbbrRole', [ { name: 'abbr' } ] ], + [ 'ArticleRole', [ { name: 'article' } ] ], + [ 'AudioRole', [ { name: 'audio' } ] ], + [ 'BlockquoteRole', [ { name: 'blockquote' } ] ], + [ 'ButtonRole', [ { name: 'button' } ] ], + [ 'CanvasRole', [ { name: 'canvas' } ] ], + [ 'CaptionRole', [ { name: 'caption' } ] ], + [ 'CellRole', [ { name: 'td' } ] ], + [ 'CheckBoxRole', [ { name: 'input', attributes: [Object] } ] ], + [ 'ColorWellRole', [ { name: 'input', attributes: [Object] } ] ], + [ 'ColumnHeaderRole', [ { name: 'th' } ] ], + [ 'DateRole', [ { name: 'input', attributes: [Object] } ] ], + [ 'DateTimeRole', [ { name: 'input', attributes: [Object] } ] ], + [ 'DefinitionRole', [ { name: 'dfn' } ] ], + [ 'DescriptionListDetailRole', [ { name: 'dd' } ] ], + [ 'DescriptionListRole', [ { name: 'dl' } ] ], + [ 'DescriptionListTermRole', [ { name: 'dt' } ] ], + [ 'DetailsRole', [ { name: 'details' } ] ], + [ 'DialogRole', [ { name: 'dialog' } ] ], + [ 'DirectoryRole', [ { name: 'dir' } ] ], + [ 'DivRole', [ { name: 'div' } ] ], + [ 'EmbeddedObjectRole', [ { name: 'embed' } ] ], + [ 'FigcaptionRole', [ { name: 'figcaption' } ] ], + [ 'FigureRole', [ { name: 'figure' } ] ], + [ 'FooterRole', [ { name: 'footer' } ] ], + [ 'FormRole', [ { name: 'form' } ] ], + [ 'HeadingRole', [ { name: 'h1' }, { name: 'h2' }, { name: 'h3' }, { name: 'h4' }, { name: 'h5' }, { name: 'h6' } ] ], + [ 'IframeRole', [ { name: 'iframe' } ] ], + [ 'ImageMapRole', [ { name: 'img', attributes: [Object] } ] ], + [ 'ImageRole', [ { name: 'img' } ] ], + [ 'InlineTextBoxRole', [ { name: 'input' } ] ], + [ 'InputTimeRole', [ { name: 'input', attributes: [Object] } ] ], + [ 'LabelRole', [ { name: 'label' } ] ], + [ 'LegendRole', [ { name: 'legend' } ] ], + [ 'LineBreakRole', [ { name: 'br' } ] ], + [ 'LinkRole', [ { name: 'a', attributes: [Object] } ] ], + [ 'ListBoxOptionRole', [ { name: 'option' } ] ], + [ 'ListItemRole', [ { name: 'li' } ] ], + [ 'ListRole', [ { name: 'ul' }, { name: 'ol' } ] ], + [ 'MainRole', [ { name: 'main' } ] ], + [ 'MarkRole', [ { name: 'mark' } ] ], + [ 'MarqueeRole', [ { name: 'marquee' } ] ], + [ 'MenuItemRole', [ { name: 'menuitem' } ] ], + [ 'MenuRole', [ { name: 'menu' } ] ], + [ 'MeterRole', [ { name: 'meter' } ] ], + [ 'NavigationRole', [ { name: 'nav' } ] ], + [ 'ParagraphRole', [ { name: 'p' } ] ], + [ 'PreRole', [ { name: 'pre' } ] ], + [ 'ProgressIndicatorRole', [ { name: 'progress' } ] ], + [ 'RadioButtonRole', [ { name: 'input', attributes: [Object] } ] ], + [ 'RowHeaderRole', [ { name: 'th', attributes: [Object] } ] ], + [ 'RowRole', [ { name: 'tr' } ] ], + [ 'RubyRole', [ { name: 'ruby' } ] ], + [ 'SearchBoxRole', [ { name: 'input', attributes: [Object] } ] ], + [ 'SliderRole', [ { name: 'input', attributes: [Object] } ] ], + [ 'SpinButtonRole', [ { name: 'input', attributes: [Object] } ] ], + [ 'TableRole', [ { name: 'table' } ] ], + [ 'TextFieldRole', [ { name: 'input' }, { name: 'input', attributes: [Object] } ] ], + [ 'TimeRole', [ { name: 'time' } ] ], + [ 'VideoRole', [ { name: 'video' ] ], +] +``` + +### AXObject to Role + +```javascript +import { AXObjectRoles } from 'axobject-query'; +``` + +AXObjects are mapped to their related ARIA concepts.. + +```javascript +[ + [ 'AlertDialogRole', [ { name: 'alertdialog' } ] ], + [ 'AlertRole', [ { name: 'alert' } ] ], + [ 'ApplicationRole', [ { name: 'application' } ] ], + [ 'ArticleRole', [ { name: 'article' } ] ], + [ 'BannerRole', [ { name: 'banner' } ] ], + [ 'BusyIndicatorRole', [ { attributes: [Object] } ] ], + [ 'ButtonRole', [ { name: 'button' } ] ], + [ 'CellRole', [ { name: 'cell' }, { name: 'gridcell' } ] ], + [ 'CheckBoxRole', [ { name: 'checkbox' } ] ], + [ 'ColumnHeaderRole', [ { name: 'columnheader' } ] ], + [ 'ComboBoxRole', [ { name: 'combobox' } ] ], + [ 'ComplementaryRole', [ { name: 'complementary' } ] ], + [ 'ContentInfoRole', [ { name: 'structureinfo' } ] ], + [ 'DialogRole', [ { name: 'dialog' } ] ], + [ 'DirectoryRole', [ { name: 'directory' } ] ], + [ 'DocumentRole', [ { name: 'document' } ] ], + [ 'FeedRole', [ { name: 'feed' } ] ], + [ 'FigureRole', [ { name: 'figure' } ] ], + [ 'FormRole', [ { name: 'form' } ] ], + [ 'GridRole', [ { name: 'grid' } ] ], + [ 'GroupRole', [ { name: 'group' } ] ], + [ 'HeadingRole', [ { name: 'heading' } ] ], + [ 'ImageRole', [ { name: 'img' } ] ], + [ 'LinkRole', [ { name: 'link' } ] ], + [ 'ListBoxOptionRole', [ { name: 'option' } ] ], + [ 'ListBoxRole', [ { name: 'listbox' } ] ], + [ 'ListItemRole', [ { name: 'listitem' } ] ], + [ 'ListRole', [ { name: 'list' } ] ], + [ 'LogRole', [ { name: 'log' } ] ], + [ 'MainRole', [ { name: 'main' } ] ], + [ 'MarqueeRole', [ { name: 'marquee' } ] ], + [ 'MathRole', [ { name: 'math' } ] ], + [ 'MenuBarRole', [ { name: 'menubar' } ] ], + [ 'MenuItemRole', [ { name: 'menuitem' } ] ], + [ 'MenuItemCheckBoxRole', [ { name: 'menuitemcheckbox' } ] ], + [ 'MenuItemRadioRole', [ { name: 'menuitemradio' } ] ], + [ 'MenuRole', [ { name: 'menu' } ] ], + [ 'NavigationRole', [ { name: 'navigation' } ] ], + [ 'NoneRole', [ { name: 'none' } ] ], + [ 'NoteRole', [ { name: 'note' } ] ], + [ 'PresentationalRole', [ { name: 'presentation' } ] ], + [ 'ProgressIndicatorRole', [ { name: 'progressbar' } ] ], + [ 'RadioButtonRole', [ { name: 'radio' } ] ], + [ 'RadioGroupRole', [ { name: 'radiogroup' } ] ], + [ 'RegionRole', [ { name: 'region' } ] ], + [ 'RowHeaderRole', [ { name: 'rowheader' } ] ], + [ 'RowRole', [ { name: 'row' } ] ], + [ 'ScrollBarRole', [ { name: 'scrollbar' } ] ], + [ 'SearchRole', [ { name: 'search' } ] ], + [ 'SearchBoxRole', [ { name: 'searchbox' } ] ], + [ 'SliderRole', [ { name: 'slider' } ] ], + [ 'SpinButtonRole', [ { name: 'spinbutton' } ] ], + [ 'SplitterRole', [ { name: 'separator' } ] ], + [ 'StatusRole', [ { name: 'status' } ] ], + [ 'SwitchRole', [ { name: 'switch' } ] ], + [ 'TabGroupRole', [ { name: 'tablist' } ] ], + [ 'TabRole', [ { name: 'tab' } ] ], + [ 'TableRole', [ { name: 'table' } ] ], + [ 'TabListRole', [ { name: 'tablist' } ] ], + [ 'TabPanelRole', [ { name: 'tabpanel' } ] ], + [ 'TermRole', [ { name: 'term' } ] ], + [ 'TextFieldRole', [ { name: 'textbox' } ] ], + [ 'TimerRole', [ { name: 'timer' } ] ], + [ 'ToggleButtonRole', [ { attributes: [Object] } ] ], + [ 'ToolbarRole', [ { name: 'toolbar' } ] ], + [ 'TreeRole', [ { name: 'tree' } ] ], + [ 'TreeGridRole', [ { name: 'treegrid' } ] ], + [ 'TreeItemRole', [ { name: 'treeitem' } ] ], + [ 'UserInterfaceTooltipRole', [ { name: 'tooltip' } ] ], +] +``` + +### Element to AXObject + +```javascript +import { elementAXObjects } from 'axobject-query'; +``` + +HTML elements are mapped to their related AXConcepts concepts. + +```javascript +[ + [ { name: 'abbr' }, [ 'AbbrRole' ] ], + [ { name: 'article' }, [ 'ArticleRole' ] ], + [ { name: 'audio' }, [ 'AudioRole' ] ], + [ { name: 'blockquote' }, [ 'BlockquoteRole' ] ], + [ { name: 'button' }, [ 'ButtonRole' ] ], + [ { name: 'canvas' }, [ 'CanvasRole' ] ], + [ { name: 'caption' }, [ 'CaptionRole' ] ], + [ { name: 'td' }, [ 'CellRole' ] ], + [ { name: 'input', attributes: [ [Object] ] }, [ 'CheckBoxRole' ] ], + [ { name: 'input', attributes: [ [Object] ] }, [ 'ColorWellRole' ] ], + [ { name: 'th' }, [ 'ColumnHeaderRole' ] ], + [ { name: 'input', attributes: [ [Object] ] }, [ 'DateRole' ] ], + [ { name: 'input', attributes: [ [Object] ] }, [ 'DateTimeRole' ] ], + [ { name: 'dfn' }, [ 'DefinitionRole' ] ], + [ { name: 'dd' }, [ 'DescriptionListDetailRole' ] ], + [ { name: 'dl' }, [ 'DescriptionListRole' ] ], + [ { name: 'dt' }, [ 'DescriptionListTermRole' ] ], + [ { name: 'details' }, [ 'DetailsRole' ] ], + [ { name: 'dialog' }, [ 'DialogRole' ] ], + [ { name: 'dir' }, [ 'DirectoryRole' ] ], + [ { name: 'div' }, [ 'DivRole' ] ], + [ { name: 'embed' }, [ 'EmbeddedObjectRole' ] ], + [ { name: 'figcaption' }, [ 'FigcaptionRole' ] ], + [ { name: 'figure' }, [ 'FigureRole' ] ], + [ { name: 'footer' }, [ 'FooterRole' ] ], + [ { name: 'form' }, [ 'FormRole' ] ], + [ { name: 'h1' }, [ 'HeadingRole' ] ], + [ { name: 'h2' }, [ 'HeadingRole' ] ], + [ { name: 'h3' }, [ 'HeadingRole' ] ], + [ { name: 'h4' }, [ 'HeadingRole' ] ], + [ { name: 'h5' }, [ 'HeadingRole' ] ], + [ { name: 'h6' }, [ 'HeadingRole' ] ], + [ { name: 'iframe' }, [ 'IframeRole' ] ], + [ { name: 'img', attributes: [ [Object] ] }, [ 'ImageMapRole' ] ], + [ { name: 'img' }, [ 'ImageRole' ] ], + [ { name: 'input' }, [ 'InlineTextBoxRole', 'TextFieldRole' ] ], + [ { name: 'input', attributes: [ [Object] ] }, [ 'InputTimeRole' ] ], + [ { name: 'label' }, [ 'LabelRole' ] ], + [ { name: 'legend' }, [ 'LegendRole' ] ], + [ { name: 'br' }, [ 'LineBreakRole' ] ], + [ { name: 'a', attributes: [ [Object] ] }, [ 'LinkRole' ] ], + [ { name: 'option' }, [ 'ListBoxOptionRole' ] ], + [ { name: 'li' }, [ 'ListItemRole' ] ], + [ { name: 'ul' }, [ 'ListRole' ] ], + [ { name: 'ol' }, [ 'ListRole' ] ], + [ { name: 'main' }, [ 'MainRole' ] ], + [ { name: 'mark' }, [ 'MarkRole' ] ], + [ { name: 'marquee' }, [ 'MarqueeRole' ] ], + [ { name: 'menuitem' }, [ 'MenuItemRole' ] ], + [ { name: 'menu' }, [ 'MenuRole' ] ], + [ { name: 'meter' }, [ 'MeterRole' ] ], + [ { name: 'nav' }, [ 'NavigationRole' ] ], + [ { name: 'p' }, [ 'ParagraphRole' ] ], + [ { name: 'pre' }, [ 'PreRole' ] ], + [ { name: 'progress' }, [ 'ProgressIndicatorRole' ] ], + [ { name: 'input', attributes: [ [Object] ] }, [ 'RadioButtonRole' ] ], + [ { name: 'th', attributes: [ [Object] ] }, [ 'RowHeaderRole' ] ], + [ { name: 'tr' }, [ 'RowRole' ] ], + [ { name: 'ruby' }, [ 'RubyRole' ] ], + [ { name: 'input', attributes: [ [Object] ] }, [ 'SearchBoxRole' ] ], + [ { name: 'input', attributes: [ [Object] ] }, [ 'SliderRole' ] ], + [ { name: 'input', attributes: [ [Object] ] }, [ 'SpinButtonRole' ] ], + [ { name: 'table' }, [ 'TableRole' ] ], + [ { name: 'input' }, [ 'InlineTextBoxRole', 'TextFieldRole' ] ], + [ { name: 'input', attributes: [ [Object] ] }, [ 'TextFieldRole' ] ], + [ { name: 'time' }, [ 'TimeRole' ] ], + [ { name: 'video' }, [ 'VideoRole' ] ], +] +``` + +## License + +Copyright (c) 2021 A11yance diff --git a/node_modules/axobject-query/lib/AXObjectElementMap.js b/node_modules/axobject-query/lib/AXObjectElementMap.js new file mode 100644 index 00000000..03398654 --- /dev/null +++ b/node_modules/axobject-query/lib/AXObjectElementMap.js @@ -0,0 +1,92 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _iterationDecorator = _interopRequireDefault(require("./util/iterationDecorator")); +var _AXObjectsMap = _interopRequireDefault(require("./AXObjectsMap")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +var AXObjectElements = []; +var _iterator = _createForOfIteratorHelper(_AXObjectsMap.default.entries()), + _step; +try { + var _loop = function _loop() { + var _step$value = _slicedToArray(_step.value, 2), + name = _step$value[0], + def = _step$value[1]; + var relatedConcepts = def.relatedConcepts; + if (Array.isArray(relatedConcepts)) { + relatedConcepts.forEach(function (relation) { + if (relation.module === 'HTML') { + var concept = relation.concept; + if (concept) { + var index = AXObjectElements.findIndex(function (_ref5) { + var _ref6 = _slicedToArray(_ref5, 1), + key = _ref6[0]; + return key === name; + }); + if (index === -1) { + AXObjectElements.push([name, []]); + index = AXObjectElements.length - 1; + } + AXObjectElements[index][1].push(concept); + } + } + }); + } + }; + for (_iterator.s(); !(_step = _iterator.n()).done;) { + _loop(); + } +} catch (err) { + _iterator.e(err); +} finally { + _iterator.f(); +} +var AXObjectElementMap = { + entries: function entries() { + return AXObjectElements; + }, + forEach: function forEach(fn) { + var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + for (var _i = 0, _AXObjectElements = AXObjectElements; _i < _AXObjectElements.length; _i++) { + var _AXObjectElements$_i = _slicedToArray(_AXObjectElements[_i], 2), + key = _AXObjectElements$_i[0], + values = _AXObjectElements$_i[1]; + fn.call(thisArg, values, key, AXObjectElements); + } + }, + get: function get(key) { + var item = AXObjectElements.find(function (tuple) { + return tuple[0] === key ? true : false; + }); + return item && item[1]; + }, + has: function has(key) { + return !!AXObjectElementMap.get(key); + }, + keys: function keys() { + return AXObjectElements.map(function (_ref) { + var _ref2 = _slicedToArray(_ref, 1), + key = _ref2[0]; + return key; + }); + }, + values: function values() { + return AXObjectElements.map(function (_ref3) { + var _ref4 = _slicedToArray(_ref3, 2), + values = _ref4[1]; + return values; + }); + } +}; +var _default = (0, _iterationDecorator.default)(AXObjectElementMap, AXObjectElementMap.entries()); +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/AXObjectRoleMap.js b/node_modules/axobject-query/lib/AXObjectRoleMap.js new file mode 100644 index 00000000..24484bf0 --- /dev/null +++ b/node_modules/axobject-query/lib/AXObjectRoleMap.js @@ -0,0 +1,92 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _iterationDecorator = _interopRequireDefault(require("./util/iterationDecorator")); +var _AXObjectsMap = _interopRequireDefault(require("./AXObjectsMap")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +var AXObjectRoleElements = []; +var _iterator = _createForOfIteratorHelper(_AXObjectsMap.default.entries()), + _step; +try { + var _loop = function _loop() { + var _step$value = _slicedToArray(_step.value, 2), + name = _step$value[0], + def = _step$value[1]; + var relatedConcepts = def.relatedConcepts; + if (Array.isArray(relatedConcepts)) { + relatedConcepts.forEach(function (relation) { + if (relation.module === 'ARIA') { + var concept = relation.concept; + if (concept) { + var index = AXObjectRoleElements.findIndex(function (_ref5) { + var _ref6 = _slicedToArray(_ref5, 1), + key = _ref6[0]; + return key === name; + }); + if (index === -1) { + AXObjectRoleElements.push([name, []]); + index = AXObjectRoleElements.length - 1; + } + AXObjectRoleElements[index][1].push(concept); + } + } + }); + } + }; + for (_iterator.s(); !(_step = _iterator.n()).done;) { + _loop(); + } +} catch (err) { + _iterator.e(err); +} finally { + _iterator.f(); +} +var AXObjectRoleMap = { + entries: function entries() { + return AXObjectRoleElements; + }, + forEach: function forEach(fn) { + var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + for (var _i = 0, _AXObjectRoleElements = AXObjectRoleElements; _i < _AXObjectRoleElements.length; _i++) { + var _AXObjectRoleElements2 = _slicedToArray(_AXObjectRoleElements[_i], 2), + key = _AXObjectRoleElements2[0], + values = _AXObjectRoleElements2[1]; + fn.call(thisArg, values, key, AXObjectRoleElements); + } + }, + get: function get(key) { + var item = AXObjectRoleElements.find(function (tuple) { + return tuple[0] === key ? true : false; + }); + return item && item[1]; + }, + has: function has(key) { + return !!AXObjectRoleMap.get(key); + }, + keys: function keys() { + return AXObjectRoleElements.map(function (_ref) { + var _ref2 = _slicedToArray(_ref, 1), + key = _ref2[0]; + return key; + }); + }, + values: function values() { + return AXObjectRoleElements.map(function (_ref3) { + var _ref4 = _slicedToArray(_ref3, 2), + values = _ref4[1]; + return values; + }); + } +}; +var _default = (0, _iterationDecorator.default)(AXObjectRoleMap, AXObjectRoleMap.entries()); +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/AXObjectsMap.js b/node_modules/axobject-query/lib/AXObjectsMap.js new file mode 100644 index 00000000..ded7435c --- /dev/null +++ b/node_modules/axobject-query/lib/AXObjectsMap.js @@ -0,0 +1,178 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _iterationDecorator = _interopRequireDefault(require("./util/iterationDecorator")); +var _AbbrRole = _interopRequireDefault(require("./etc/objects/AbbrRole")); +var _AlertDialogRole = _interopRequireDefault(require("./etc/objects/AlertDialogRole")); +var _AlertRole = _interopRequireDefault(require("./etc/objects/AlertRole")); +var _AnnotationRole = _interopRequireDefault(require("./etc/objects/AnnotationRole")); +var _ApplicationRole = _interopRequireDefault(require("./etc/objects/ApplicationRole")); +var _ArticleRole = _interopRequireDefault(require("./etc/objects/ArticleRole")); +var _AudioRole = _interopRequireDefault(require("./etc/objects/AudioRole")); +var _BannerRole = _interopRequireDefault(require("./etc/objects/BannerRole")); +var _BlockquoteRole = _interopRequireDefault(require("./etc/objects/BlockquoteRole")); +var _BusyIndicatorRole = _interopRequireDefault(require("./etc/objects/BusyIndicatorRole")); +var _ButtonRole = _interopRequireDefault(require("./etc/objects/ButtonRole")); +var _CanvasRole = _interopRequireDefault(require("./etc/objects/CanvasRole")); +var _CaptionRole = _interopRequireDefault(require("./etc/objects/CaptionRole")); +var _CellRole = _interopRequireDefault(require("./etc/objects/CellRole")); +var _CheckBoxRole = _interopRequireDefault(require("./etc/objects/CheckBoxRole")); +var _ColorWellRole = _interopRequireDefault(require("./etc/objects/ColorWellRole")); +var _ColumnHeaderRole = _interopRequireDefault(require("./etc/objects/ColumnHeaderRole")); +var _ColumnRole = _interopRequireDefault(require("./etc/objects/ColumnRole")); +var _ComboBoxRole = _interopRequireDefault(require("./etc/objects/ComboBoxRole")); +var _ComplementaryRole = _interopRequireDefault(require("./etc/objects/ComplementaryRole")); +var _ContentInfoRole = _interopRequireDefault(require("./etc/objects/ContentInfoRole")); +var _DateRole = _interopRequireDefault(require("./etc/objects/DateRole")); +var _DateTimeRole = _interopRequireDefault(require("./etc/objects/DateTimeRole")); +var _DefinitionRole = _interopRequireDefault(require("./etc/objects/DefinitionRole")); +var _DescriptionListDetailRole = _interopRequireDefault(require("./etc/objects/DescriptionListDetailRole")); +var _DescriptionListRole = _interopRequireDefault(require("./etc/objects/DescriptionListRole")); +var _DescriptionListTermRole = _interopRequireDefault(require("./etc/objects/DescriptionListTermRole")); +var _DetailsRole = _interopRequireDefault(require("./etc/objects/DetailsRole")); +var _DialogRole = _interopRequireDefault(require("./etc/objects/DialogRole")); +var _DirectoryRole = _interopRequireDefault(require("./etc/objects/DirectoryRole")); +var _DisclosureTriangleRole = _interopRequireDefault(require("./etc/objects/DisclosureTriangleRole")); +var _DivRole = _interopRequireDefault(require("./etc/objects/DivRole")); +var _DocumentRole = _interopRequireDefault(require("./etc/objects/DocumentRole")); +var _EmbeddedObjectRole = _interopRequireDefault(require("./etc/objects/EmbeddedObjectRole")); +var _FeedRole = _interopRequireDefault(require("./etc/objects/FeedRole")); +var _FigcaptionRole = _interopRequireDefault(require("./etc/objects/FigcaptionRole")); +var _FigureRole = _interopRequireDefault(require("./etc/objects/FigureRole")); +var _FooterRole = _interopRequireDefault(require("./etc/objects/FooterRole")); +var _FormRole = _interopRequireDefault(require("./etc/objects/FormRole")); +var _GridRole = _interopRequireDefault(require("./etc/objects/GridRole")); +var _GroupRole = _interopRequireDefault(require("./etc/objects/GroupRole")); +var _HeadingRole = _interopRequireDefault(require("./etc/objects/HeadingRole")); +var _IframePresentationalRole = _interopRequireDefault(require("./etc/objects/IframePresentationalRole")); +var _IframeRole = _interopRequireDefault(require("./etc/objects/IframeRole")); +var _IgnoredRole = _interopRequireDefault(require("./etc/objects/IgnoredRole")); +var _ImageMapLinkRole = _interopRequireDefault(require("./etc/objects/ImageMapLinkRole")); +var _ImageMapRole = _interopRequireDefault(require("./etc/objects/ImageMapRole")); +var _ImageRole = _interopRequireDefault(require("./etc/objects/ImageRole")); +var _InlineTextBoxRole = _interopRequireDefault(require("./etc/objects/InlineTextBoxRole")); +var _InputTimeRole = _interopRequireDefault(require("./etc/objects/InputTimeRole")); +var _LabelRole = _interopRequireDefault(require("./etc/objects/LabelRole")); +var _LegendRole = _interopRequireDefault(require("./etc/objects/LegendRole")); +var _LineBreakRole = _interopRequireDefault(require("./etc/objects/LineBreakRole")); +var _LinkRole = _interopRequireDefault(require("./etc/objects/LinkRole")); +var _ListBoxOptionRole = _interopRequireDefault(require("./etc/objects/ListBoxOptionRole")); +var _ListBoxRole = _interopRequireDefault(require("./etc/objects/ListBoxRole")); +var _ListItemRole = _interopRequireDefault(require("./etc/objects/ListItemRole")); +var _ListMarkerRole = _interopRequireDefault(require("./etc/objects/ListMarkerRole")); +var _ListRole = _interopRequireDefault(require("./etc/objects/ListRole")); +var _LogRole = _interopRequireDefault(require("./etc/objects/LogRole")); +var _MainRole = _interopRequireDefault(require("./etc/objects/MainRole")); +var _MarkRole = _interopRequireDefault(require("./etc/objects/MarkRole")); +var _MarqueeRole = _interopRequireDefault(require("./etc/objects/MarqueeRole")); +var _MathRole = _interopRequireDefault(require("./etc/objects/MathRole")); +var _MenuBarRole = _interopRequireDefault(require("./etc/objects/MenuBarRole")); +var _MenuButtonRole = _interopRequireDefault(require("./etc/objects/MenuButtonRole")); +var _MenuItemRole = _interopRequireDefault(require("./etc/objects/MenuItemRole")); +var _MenuItemCheckBoxRole = _interopRequireDefault(require("./etc/objects/MenuItemCheckBoxRole")); +var _MenuItemRadioRole = _interopRequireDefault(require("./etc/objects/MenuItemRadioRole")); +var _MenuListOptionRole = _interopRequireDefault(require("./etc/objects/MenuListOptionRole")); +var _MenuListPopupRole = _interopRequireDefault(require("./etc/objects/MenuListPopupRole")); +var _MenuRole = _interopRequireDefault(require("./etc/objects/MenuRole")); +var _MeterRole = _interopRequireDefault(require("./etc/objects/MeterRole")); +var _NavigationRole = _interopRequireDefault(require("./etc/objects/NavigationRole")); +var _NoneRole = _interopRequireDefault(require("./etc/objects/NoneRole")); +var _NoteRole = _interopRequireDefault(require("./etc/objects/NoteRole")); +var _OutlineRole = _interopRequireDefault(require("./etc/objects/OutlineRole")); +var _ParagraphRole = _interopRequireDefault(require("./etc/objects/ParagraphRole")); +var _PopUpButtonRole = _interopRequireDefault(require("./etc/objects/PopUpButtonRole")); +var _PreRole = _interopRequireDefault(require("./etc/objects/PreRole")); +var _PresentationalRole = _interopRequireDefault(require("./etc/objects/PresentationalRole")); +var _ProgressIndicatorRole = _interopRequireDefault(require("./etc/objects/ProgressIndicatorRole")); +var _RadioButtonRole = _interopRequireDefault(require("./etc/objects/RadioButtonRole")); +var _RadioGroupRole = _interopRequireDefault(require("./etc/objects/RadioGroupRole")); +var _RegionRole = _interopRequireDefault(require("./etc/objects/RegionRole")); +var _RootWebAreaRole = _interopRequireDefault(require("./etc/objects/RootWebAreaRole")); +var _RowHeaderRole = _interopRequireDefault(require("./etc/objects/RowHeaderRole")); +var _RowRole = _interopRequireDefault(require("./etc/objects/RowRole")); +var _RubyRole = _interopRequireDefault(require("./etc/objects/RubyRole")); +var _RulerRole = _interopRequireDefault(require("./etc/objects/RulerRole")); +var _ScrollAreaRole = _interopRequireDefault(require("./etc/objects/ScrollAreaRole")); +var _ScrollBarRole = _interopRequireDefault(require("./etc/objects/ScrollBarRole")); +var _SeamlessWebAreaRole = _interopRequireDefault(require("./etc/objects/SeamlessWebAreaRole")); +var _SearchRole = _interopRequireDefault(require("./etc/objects/SearchRole")); +var _SearchBoxRole = _interopRequireDefault(require("./etc/objects/SearchBoxRole")); +var _SliderRole = _interopRequireDefault(require("./etc/objects/SliderRole")); +var _SliderThumbRole = _interopRequireDefault(require("./etc/objects/SliderThumbRole")); +var _SpinButtonRole = _interopRequireDefault(require("./etc/objects/SpinButtonRole")); +var _SpinButtonPartRole = _interopRequireDefault(require("./etc/objects/SpinButtonPartRole")); +var _SplitterRole = _interopRequireDefault(require("./etc/objects/SplitterRole")); +var _StaticTextRole = _interopRequireDefault(require("./etc/objects/StaticTextRole")); +var _StatusRole = _interopRequireDefault(require("./etc/objects/StatusRole")); +var _SVGRootRole = _interopRequireDefault(require("./etc/objects/SVGRootRole")); +var _SwitchRole = _interopRequireDefault(require("./etc/objects/SwitchRole")); +var _TabGroupRole = _interopRequireDefault(require("./etc/objects/TabGroupRole")); +var _TabRole = _interopRequireDefault(require("./etc/objects/TabRole")); +var _TableHeaderContainerRole = _interopRequireDefault(require("./etc/objects/TableHeaderContainerRole")); +var _TableRole = _interopRequireDefault(require("./etc/objects/TableRole")); +var _TabListRole = _interopRequireDefault(require("./etc/objects/TabListRole")); +var _TabPanelRole = _interopRequireDefault(require("./etc/objects/TabPanelRole")); +var _TermRole = _interopRequireDefault(require("./etc/objects/TermRole")); +var _TextAreaRole = _interopRequireDefault(require("./etc/objects/TextAreaRole")); +var _TextFieldRole = _interopRequireDefault(require("./etc/objects/TextFieldRole")); +var _TimeRole = _interopRequireDefault(require("./etc/objects/TimeRole")); +var _TimerRole = _interopRequireDefault(require("./etc/objects/TimerRole")); +var _ToggleButtonRole = _interopRequireDefault(require("./etc/objects/ToggleButtonRole")); +var _ToolbarRole = _interopRequireDefault(require("./etc/objects/ToolbarRole")); +var _TreeRole = _interopRequireDefault(require("./etc/objects/TreeRole")); +var _TreeGridRole = _interopRequireDefault(require("./etc/objects/TreeGridRole")); +var _TreeItemRole = _interopRequireDefault(require("./etc/objects/TreeItemRole")); +var _UserInterfaceTooltipRole = _interopRequireDefault(require("./etc/objects/UserInterfaceTooltipRole")); +var _VideoRole = _interopRequireDefault(require("./etc/objects/VideoRole")); +var _WebAreaRole = _interopRequireDefault(require("./etc/objects/WebAreaRole")); +var _WindowRole = _interopRequireDefault(require("./etc/objects/WindowRole")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +var AXObjects = [['AbbrRole', _AbbrRole.default], ['AlertDialogRole', _AlertDialogRole.default], ['AlertRole', _AlertRole.default], ['AnnotationRole', _AnnotationRole.default], ['ApplicationRole', _ApplicationRole.default], ['ArticleRole', _ArticleRole.default], ['AudioRole', _AudioRole.default], ['BannerRole', _BannerRole.default], ['BlockquoteRole', _BlockquoteRole.default], ['BusyIndicatorRole', _BusyIndicatorRole.default], ['ButtonRole', _ButtonRole.default], ['CanvasRole', _CanvasRole.default], ['CaptionRole', _CaptionRole.default], ['CellRole', _CellRole.default], ['CheckBoxRole', _CheckBoxRole.default], ['ColorWellRole', _ColorWellRole.default], ['ColumnHeaderRole', _ColumnHeaderRole.default], ['ColumnRole', _ColumnRole.default], ['ComboBoxRole', _ComboBoxRole.default], ['ComplementaryRole', _ComplementaryRole.default], ['ContentInfoRole', _ContentInfoRole.default], ['DateRole', _DateRole.default], ['DateTimeRole', _DateTimeRole.default], ['DefinitionRole', _DefinitionRole.default], ['DescriptionListDetailRole', _DescriptionListDetailRole.default], ['DescriptionListRole', _DescriptionListRole.default], ['DescriptionListTermRole', _DescriptionListTermRole.default], ['DetailsRole', _DetailsRole.default], ['DialogRole', _DialogRole.default], ['DirectoryRole', _DirectoryRole.default], ['DisclosureTriangleRole', _DisclosureTriangleRole.default], ['DivRole', _DivRole.default], ['DocumentRole', _DocumentRole.default], ['EmbeddedObjectRole', _EmbeddedObjectRole.default], ['FeedRole', _FeedRole.default], ['FigcaptionRole', _FigcaptionRole.default], ['FigureRole', _FigureRole.default], ['FooterRole', _FooterRole.default], ['FormRole', _FormRole.default], ['GridRole', _GridRole.default], ['GroupRole', _GroupRole.default], ['HeadingRole', _HeadingRole.default], ['IframePresentationalRole', _IframePresentationalRole.default], ['IframeRole', _IframeRole.default], ['IgnoredRole', _IgnoredRole.default], ['ImageMapLinkRole', _ImageMapLinkRole.default], ['ImageMapRole', _ImageMapRole.default], ['ImageRole', _ImageRole.default], ['InlineTextBoxRole', _InlineTextBoxRole.default], ['InputTimeRole', _InputTimeRole.default], ['LabelRole', _LabelRole.default], ['LegendRole', _LegendRole.default], ['LineBreakRole', _LineBreakRole.default], ['LinkRole', _LinkRole.default], ['ListBoxOptionRole', _ListBoxOptionRole.default], ['ListBoxRole', _ListBoxRole.default], ['ListItemRole', _ListItemRole.default], ['ListMarkerRole', _ListMarkerRole.default], ['ListRole', _ListRole.default], ['LogRole', _LogRole.default], ['MainRole', _MainRole.default], ['MarkRole', _MarkRole.default], ['MarqueeRole', _MarqueeRole.default], ['MathRole', _MathRole.default], ['MenuBarRole', _MenuBarRole.default], ['MenuButtonRole', _MenuButtonRole.default], ['MenuItemRole', _MenuItemRole.default], ['MenuItemCheckBoxRole', _MenuItemCheckBoxRole.default], ['MenuItemRadioRole', _MenuItemRadioRole.default], ['MenuListOptionRole', _MenuListOptionRole.default], ['MenuListPopupRole', _MenuListPopupRole.default], ['MenuRole', _MenuRole.default], ['MeterRole', _MeterRole.default], ['NavigationRole', _NavigationRole.default], ['NoneRole', _NoneRole.default], ['NoteRole', _NoteRole.default], ['OutlineRole', _OutlineRole.default], ['ParagraphRole', _ParagraphRole.default], ['PopUpButtonRole', _PopUpButtonRole.default], ['PreRole', _PreRole.default], ['PresentationalRole', _PresentationalRole.default], ['ProgressIndicatorRole', _ProgressIndicatorRole.default], ['RadioButtonRole', _RadioButtonRole.default], ['RadioGroupRole', _RadioGroupRole.default], ['RegionRole', _RegionRole.default], ['RootWebAreaRole', _RootWebAreaRole.default], ['RowHeaderRole', _RowHeaderRole.default], ['RowRole', _RowRole.default], ['RubyRole', _RubyRole.default], ['RulerRole', _RulerRole.default], ['ScrollAreaRole', _ScrollAreaRole.default], ['ScrollBarRole', _ScrollBarRole.default], ['SeamlessWebAreaRole', _SeamlessWebAreaRole.default], ['SearchRole', _SearchRole.default], ['SearchBoxRole', _SearchBoxRole.default], ['SliderRole', _SliderRole.default], ['SliderThumbRole', _SliderThumbRole.default], ['SpinButtonRole', _SpinButtonRole.default], ['SpinButtonPartRole', _SpinButtonPartRole.default], ['SplitterRole', _SplitterRole.default], ['StaticTextRole', _StaticTextRole.default], ['StatusRole', _StatusRole.default], ['SVGRootRole', _SVGRootRole.default], ['SwitchRole', _SwitchRole.default], ['TabGroupRole', _TabGroupRole.default], ['TabRole', _TabRole.default], ['TableHeaderContainerRole', _TableHeaderContainerRole.default], ['TableRole', _TableRole.default], ['TabListRole', _TabListRole.default], ['TabPanelRole', _TabPanelRole.default], ['TermRole', _TermRole.default], ['TextAreaRole', _TextAreaRole.default], ['TextFieldRole', _TextFieldRole.default], ['TimeRole', _TimeRole.default], ['TimerRole', _TimerRole.default], ['ToggleButtonRole', _ToggleButtonRole.default], ['ToolbarRole', _ToolbarRole.default], ['TreeRole', _TreeRole.default], ['TreeGridRole', _TreeGridRole.default], ['TreeItemRole', _TreeItemRole.default], ['UserInterfaceTooltipRole', _UserInterfaceTooltipRole.default], ['VideoRole', _VideoRole.default], ['WebAreaRole', _WebAreaRole.default], ['WindowRole', _WindowRole.default]]; +var AXObjectsMap = { + entries: function entries() { + return AXObjects; + }, + forEach: function forEach(fn) { + var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + for (var _i = 0, _AXObjects = AXObjects; _i < _AXObjects.length; _i++) { + var _AXObjects$_i = _slicedToArray(_AXObjects[_i], 2), + key = _AXObjects$_i[0], + values = _AXObjects$_i[1]; + fn.call(thisArg, values, key, AXObjects); + } + }, + get: function get(key) { + var item = AXObjects.find(function (tuple) { + return tuple[0] === key ? true : false; + }); + return item && item[1]; + }, + has: function has(key) { + return !!AXObjectsMap.get(key); + }, + keys: function keys() { + return AXObjects.map(function (_ref) { + var _ref2 = _slicedToArray(_ref, 1), + key = _ref2[0]; + return key; + }); + }, + values: function values() { + return AXObjects.map(function (_ref3) { + var _ref4 = _slicedToArray(_ref3, 2), + values = _ref4[1]; + return values; + }); + } +}; +var _default = (0, _iterationDecorator.default)(AXObjectsMap, AXObjectsMap.entries()); +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/elementAXObjectMap.js b/node_modules/axobject-query/lib/elementAXObjectMap.js new file mode 100644 index 00000000..0395f3ac --- /dev/null +++ b/node_modules/axobject-query/lib/elementAXObjectMap.js @@ -0,0 +1,128 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var _AXObjectsMap = _interopRequireDefault(require("./AXObjectsMap")); +var _iterationDecorator = _interopRequireDefault(require("./util/iterationDecorator")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +var elementAXObjects = []; +var _iterator = _createForOfIteratorHelper(_AXObjectsMap.default.entries()), + _step; +try { + var _loop = function _loop() { + var _step$value = _slicedToArray(_step.value, 2), + name = _step$value[0], + def = _step$value[1]; + var relatedConcepts = def.relatedConcepts; + if (Array.isArray(relatedConcepts)) { + relatedConcepts.forEach(function (relation) { + if (relation.module === 'HTML') { + var concept = relation.concept; + if (concept != null) { + var conceptStr = JSON.stringify(concept); + var axObjects; + var index = 0; + for (; index < elementAXObjects.length; index++) { + var key = elementAXObjects[index][0]; + if (JSON.stringify(key) === conceptStr) { + axObjects = elementAXObjects[index][1]; + break; + } + } + if (!Array.isArray(axObjects)) { + axObjects = []; + } + var loc = axObjects.findIndex(function (item) { + return item === name; + }); + if (loc === -1) { + axObjects.push(name); + } + if (index < elementAXObjects.length) { + elementAXObjects.splice(index, 1, [concept, axObjects]); + } else { + elementAXObjects.push([concept, axObjects]); + } + } + } + }); + } + }; + for (_iterator.s(); !(_step = _iterator.n()).done;) { + _loop(); + } +} catch (err) { + _iterator.e(err); +} finally { + _iterator.f(); +} +function deepAxObjectModelRelationshipConceptAttributeCheck(a, b) { + if (a === undefined && b !== undefined) { + return false; + } + if (a !== undefined && b === undefined) { + return false; + } + if (a !== undefined && b !== undefined) { + if (a.length != b.length) { + return false; + } + + // dequal checks position equality + // https://github.com/lukeed/dequal/blob/5ecd990c4c055c4658c64b4bdfc170f219604eea/src/index.js#L17-L22 + for (var i = 0; i < a.length; i++) { + if (b[i].name !== a[i].name || b[i].value !== a[i].value) { + return false; + } + } + } + return true; +} +var elementAXObjectMap = { + entries: function entries() { + return elementAXObjects; + }, + forEach: function forEach(fn) { + var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + for (var _i = 0, _elementAXObjects = elementAXObjects; _i < _elementAXObjects.length; _i++) { + var _elementAXObjects$_i = _slicedToArray(_elementAXObjects[_i], 2), + key = _elementAXObjects$_i[0], + values = _elementAXObjects$_i[1]; + fn.call(thisArg, values, key, elementAXObjects); + } + }, + get: function get(key) { + var item = elementAXObjects.find(function (tuple) { + return key.name === tuple[0].name && deepAxObjectModelRelationshipConceptAttributeCheck(key.attributes, tuple[0].attributes); + }); + return item && item[1]; + }, + has: function has(key) { + return !!elementAXObjectMap.get(key); + }, + keys: function keys() { + return elementAXObjects.map(function (_ref) { + var _ref2 = _slicedToArray(_ref, 1), + key = _ref2[0]; + return key; + }); + }, + values: function values() { + return elementAXObjects.map(function (_ref3) { + var _ref4 = _slicedToArray(_ref3, 2), + values = _ref4[1]; + return values; + }); + } +}; +var _default = (0, _iterationDecorator.default)(elementAXObjectMap, elementAXObjectMap.entries()); +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/AbbrRole.js b/node_modules/axobject-query/lib/etc/objects/AbbrRole.js new file mode 100644 index 00000000..7355ec93 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/AbbrRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var AbbrRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'abbr' + } + }], + type: 'structure' +}; +var _default = AbbrRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/AlertDialogRole.js b/node_modules/axobject-query/lib/etc/objects/AlertDialogRole.js new file mode 100644 index 00000000..0c637cd1 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/AlertDialogRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var AlertDialogRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'alertdialog' + } + }], + type: 'window' +}; +var _default = AlertDialogRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/AlertRole.js b/node_modules/axobject-query/lib/etc/objects/AlertRole.js new file mode 100644 index 00000000..0fa3dc20 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/AlertRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var AlertRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'alert' + } + }], + type: 'structure' +}; +var _default = AlertRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/AnnotationRole.js b/node_modules/axobject-query/lib/etc/objects/AnnotationRole.js new file mode 100644 index 00000000..f7a1aec8 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/AnnotationRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var AnnotationRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = AnnotationRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ApplicationRole.js b/node_modules/axobject-query/lib/etc/objects/ApplicationRole.js new file mode 100644 index 00000000..aa28ef5e --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ApplicationRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ApplicationRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'application' + } + }], + type: 'window' +}; +var _default = ApplicationRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ArticleRole.js b/node_modules/axobject-query/lib/etc/objects/ArticleRole.js new file mode 100644 index 00000000..3ff677c4 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ArticleRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ArticleRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'article' + } + }, { + module: 'HTML', + concept: { + name: 'article' + } + }], + type: 'structure' +}; +var _default = ArticleRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/AudioRole.js b/node_modules/axobject-query/lib/etc/objects/AudioRole.js new file mode 100644 index 00000000..0ce461fd --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/AudioRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var AudioRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'audio' + } + }], + type: 'widget' +}; +var _default = AudioRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/BannerRole.js b/node_modules/axobject-query/lib/etc/objects/BannerRole.js new file mode 100644 index 00000000..01b5e7d5 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/BannerRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var BannerRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'banner' + } + }], + type: 'structure' +}; +var _default = BannerRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/BlockquoteRole.js b/node_modules/axobject-query/lib/etc/objects/BlockquoteRole.js new file mode 100644 index 00000000..764cb24a --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/BlockquoteRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var BlockquoteRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'blockquote' + } + }], + type: 'structure' +}; +var _default = BlockquoteRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/BusyIndicatorRole.js b/node_modules/axobject-query/lib/etc/objects/BusyIndicatorRole.js new file mode 100644 index 00000000..8b3192bd --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/BusyIndicatorRole.js @@ -0,0 +1,20 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var BusyIndicatorRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + attributes: [{ + name: 'aria-busy', + value: 'true' + }] + } + }], + type: 'widget' +}; +var _default = BusyIndicatorRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ButtonRole.js b/node_modules/axobject-query/lib/etc/objects/ButtonRole.js new file mode 100644 index 00000000..08612977 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ButtonRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ButtonRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'button' + } + }, { + module: 'HTML', + concept: { + name: 'button' + } + }], + type: 'widget' +}; +var _default = ButtonRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/CanvasRole.js b/node_modules/axobject-query/lib/etc/objects/CanvasRole.js new file mode 100644 index 00000000..1f45ef77 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/CanvasRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var CanvasRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'canvas' + } + }], + type: 'widget' +}; +var _default = CanvasRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/CaptionRole.js b/node_modules/axobject-query/lib/etc/objects/CaptionRole.js new file mode 100644 index 00000000..b84f644e --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/CaptionRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var CaptionRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'caption' + } + }], + type: 'structure' +}; +var _default = CaptionRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/CellRole.js b/node_modules/axobject-query/lib/etc/objects/CellRole.js new file mode 100644 index 00000000..d468a16d --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/CellRole.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var CellRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'cell' + } + }, { + module: 'ARIA', + concept: { + name: 'gridcell' + } + }, { + module: 'HTML', + concept: { + name: 'td' + } + }], + type: 'widget' +}; +var _default = CellRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/CheckBoxRole.js b/node_modules/axobject-query/lib/etc/objects/CheckBoxRole.js new file mode 100644 index 00000000..3c6105ef --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/CheckBoxRole.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var CheckBoxRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'checkbox' + } + }, { + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'checkbox' + }] + } + }], + type: 'widget' +}; +var _default = CheckBoxRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ColorWellRole.js b/node_modules/axobject-query/lib/etc/objects/ColorWellRole.js new file mode 100644 index 00000000..6b0b527c --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ColorWellRole.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ColorWellRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'color' + }] + } + }], + type: 'widget' +}; +var _default = ColorWellRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ColumnHeaderRole.js b/node_modules/axobject-query/lib/etc/objects/ColumnHeaderRole.js new file mode 100644 index 00000000..1e2a3f82 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ColumnHeaderRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ColumnHeaderRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'columnheader' + } + }, { + module: 'HTML', + concept: { + name: 'th' + } + }], + type: 'widget' +}; +var _default = ColumnHeaderRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ColumnRole.js b/node_modules/axobject-query/lib/etc/objects/ColumnRole.js new file mode 100644 index 00000000..71a0f58e --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ColumnRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ColumnRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = ColumnRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ComboBoxRole.js b/node_modules/axobject-query/lib/etc/objects/ComboBoxRole.js new file mode 100644 index 00000000..4015d32c --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ComboBoxRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ComboBoxRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'combobox' + } + }, { + module: 'HTML', + concept: { + name: 'select' + } + }], + type: 'widget' +}; +var _default = ComboBoxRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ComplementaryRole.js b/node_modules/axobject-query/lib/etc/objects/ComplementaryRole.js new file mode 100644 index 00000000..2aa217fd --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ComplementaryRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ComplementaryRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'complementary' + } + }], + type: 'structure' +}; +var _default = ComplementaryRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ContentInfoRole.js b/node_modules/axobject-query/lib/etc/objects/ContentInfoRole.js new file mode 100644 index 00000000..3dced93b --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ContentInfoRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ContentInfoRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'structureinfo' + } + }], + type: 'structure' +}; +var _default = ContentInfoRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DateRole.js b/node_modules/axobject-query/lib/etc/objects/DateRole.js new file mode 100644 index 00000000..c449da75 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DateRole.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DateRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'date' + }] + } + }], + type: 'widget' +}; +var _default = DateRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DateTimeRole.js b/node_modules/axobject-query/lib/etc/objects/DateTimeRole.js new file mode 100644 index 00000000..3afaffc6 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DateTimeRole.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DateTimeRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'datetime' + }] + } + }], + type: 'widget' +}; +var _default = DateTimeRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DefinitionRole.js b/node_modules/axobject-query/lib/etc/objects/DefinitionRole.js new file mode 100644 index 00000000..52a9bf0e --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DefinitionRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DefinitionRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'dfn' + } + }], + type: 'structure' +}; +var _default = DefinitionRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DescriptionListDetailRole.js b/node_modules/axobject-query/lib/etc/objects/DescriptionListDetailRole.js new file mode 100644 index 00000000..cf43038f --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DescriptionListDetailRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DescriptionListDetailRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'dd' + } + }], + type: 'structure' +}; +var _default = DescriptionListDetailRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DescriptionListRole.js b/node_modules/axobject-query/lib/etc/objects/DescriptionListRole.js new file mode 100644 index 00000000..fed39dfb --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DescriptionListRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DescriptionListRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'dl' + } + }], + type: 'structure' +}; +var _default = DescriptionListRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DescriptionListTermRole.js b/node_modules/axobject-query/lib/etc/objects/DescriptionListTermRole.js new file mode 100644 index 00000000..1c92dd79 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DescriptionListTermRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DescriptionListTermRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'dt' + } + }], + type: 'structure' +}; +var _default = DescriptionListTermRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DetailsRole.js b/node_modules/axobject-query/lib/etc/objects/DetailsRole.js new file mode 100644 index 00000000..ca7d7dcb --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DetailsRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DetailsRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'details' + } + }], + type: 'structure' +}; +var _default = DetailsRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DialogRole.js b/node_modules/axobject-query/lib/etc/objects/DialogRole.js new file mode 100644 index 00000000..a465e130 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DialogRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DialogRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'dialog' + } + }, { + module: 'HTML', + concept: { + name: 'dialog' + } + }], + type: 'window' +}; +var _default = DialogRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DirectoryRole.js b/node_modules/axobject-query/lib/etc/objects/DirectoryRole.js new file mode 100644 index 00000000..fd76b9e6 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DirectoryRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DirectoryRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'directory' + } + }, { + module: 'HTML', + concept: { + name: 'dir' + } + }], + type: 'structure' +}; +var _default = DirectoryRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DisclosureTriangleRole.js b/node_modules/axobject-query/lib/etc/objects/DisclosureTriangleRole.js new file mode 100644 index 00000000..a372ef53 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DisclosureTriangleRole.js @@ -0,0 +1,18 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DisclosureTriangleRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + constraints: ['scoped to a details element'], + name: 'summary' + } + }], + type: 'widget' +}; +var _default = DisclosureTriangleRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DivRole.js b/node_modules/axobject-query/lib/etc/objects/DivRole.js new file mode 100644 index 00000000..3f02b45c --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DivRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DivRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'div' + } + }], + type: 'generic' +}; +var _default = DivRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/DocumentRole.js b/node_modules/axobject-query/lib/etc/objects/DocumentRole.js new file mode 100644 index 00000000..3835f302 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/DocumentRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var DocumentRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'document' + } + }], + type: 'structure' +}; +var _default = DocumentRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/EmbeddedObjectRole.js b/node_modules/axobject-query/lib/etc/objects/EmbeddedObjectRole.js new file mode 100644 index 00000000..25b2c183 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/EmbeddedObjectRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var EmbeddedObjectRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'embed' + } + }], + type: 'widget' +}; +var _default = EmbeddedObjectRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/FeedRole.js b/node_modules/axobject-query/lib/etc/objects/FeedRole.js new file mode 100644 index 00000000..90d236f1 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/FeedRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var FeedRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'feed' + } + }], + type: 'structure' +}; +var _default = FeedRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/FigcaptionRole.js b/node_modules/axobject-query/lib/etc/objects/FigcaptionRole.js new file mode 100644 index 00000000..b5e1916d --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/FigcaptionRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var FigcaptionRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'figcaption' + } + }], + type: 'structure' +}; +var _default = FigcaptionRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/FigureRole.js b/node_modules/axobject-query/lib/etc/objects/FigureRole.js new file mode 100644 index 00000000..ed3d0824 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/FigureRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var FigureRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'figure' + } + }, { + module: 'HTML', + concept: { + name: 'figure' + } + }], + type: 'structure' +}; +var _default = FigureRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/FooterRole.js b/node_modules/axobject-query/lib/etc/objects/FooterRole.js new file mode 100644 index 00000000..bdedf3fe --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/FooterRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var FooterRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'footer' + } + }], + type: 'structure' +}; +var _default = FooterRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/FormRole.js b/node_modules/axobject-query/lib/etc/objects/FormRole.js new file mode 100644 index 00000000..254e084b --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/FormRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var FormRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'form' + } + }, { + module: 'HTML', + concept: { + name: 'form' + } + }], + type: 'structure' +}; +var _default = FormRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/GridRole.js b/node_modules/axobject-query/lib/etc/objects/GridRole.js new file mode 100644 index 00000000..7fc7ee7d --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/GridRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var GridRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'grid' + } + }], + type: 'widget' +}; +var _default = GridRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/GroupRole.js b/node_modules/axobject-query/lib/etc/objects/GroupRole.js new file mode 100644 index 00000000..da338cda --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/GroupRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var GroupRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'group' + } + }], + type: 'structure' +}; +var _default = GroupRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/HeadingRole.js b/node_modules/axobject-query/lib/etc/objects/HeadingRole.js new file mode 100644 index 00000000..8adaa7dc --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/HeadingRole.js @@ -0,0 +1,47 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var HeadingRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'heading' + } + }, { + module: 'HTML', + concept: { + name: 'h1' + } + }, { + module: 'HTML', + concept: { + name: 'h2' + } + }, { + module: 'HTML', + concept: { + name: 'h3' + } + }, { + module: 'HTML', + concept: { + name: 'h4' + } + }, { + module: 'HTML', + concept: { + name: 'h5' + } + }, { + module: 'HTML', + concept: { + name: 'h6' + } + }], + type: 'structure' +}; +var _default = HeadingRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/IframePresentationalRole.js b/node_modules/axobject-query/lib/etc/objects/IframePresentationalRole.js new file mode 100644 index 00000000..af05c497 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/IframePresentationalRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var IframePresentationalRole = { + relatedConcepts: [], + type: 'window' +}; +var _default = IframePresentationalRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/IframeRole.js b/node_modules/axobject-query/lib/etc/objects/IframeRole.js new file mode 100644 index 00000000..4ed26157 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/IframeRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var IframeRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'iframe' + } + }], + type: 'window' +}; +var _default = IframeRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/IgnoredRole.js b/node_modules/axobject-query/lib/etc/objects/IgnoredRole.js new file mode 100644 index 00000000..88a7e58c --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/IgnoredRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var IgnoredRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = IgnoredRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ImageMapLinkRole.js b/node_modules/axobject-query/lib/etc/objects/ImageMapLinkRole.js new file mode 100644 index 00000000..def2001c --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ImageMapLinkRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ImageMapLinkRole = { + relatedConcepts: [], + type: 'widget' +}; +var _default = ImageMapLinkRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ImageMapRole.js b/node_modules/axobject-query/lib/etc/objects/ImageMapRole.js new file mode 100644 index 00000000..d6c1cc2e --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ImageMapRole.js @@ -0,0 +1,20 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ImageMapRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'img', + attributes: [{ + name: 'usemap' + }] + } + }], + type: 'structure' +}; +var _default = ImageMapRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ImageRole.js b/node_modules/axobject-query/lib/etc/objects/ImageRole.js new file mode 100644 index 00000000..e2532943 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ImageRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ImageRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'img' + } + }, { + module: 'HTML', + concept: { + name: 'img' + } + }], + type: 'structure' +}; +var _default = ImageRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/InlineTextBoxRole.js b/node_modules/axobject-query/lib/etc/objects/InlineTextBoxRole.js new file mode 100644 index 00000000..bcb9b1f8 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/InlineTextBoxRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var InlineTextBoxRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'input' + } + }], + type: 'widget' +}; +var _default = InlineTextBoxRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/InputTimeRole.js b/node_modules/axobject-query/lib/etc/objects/InputTimeRole.js new file mode 100644 index 00000000..d973a19e --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/InputTimeRole.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var InputTimeRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'time' + }] + } + }], + type: 'widget' +}; +var _default = InputTimeRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/LabelRole.js b/node_modules/axobject-query/lib/etc/objects/LabelRole.js new file mode 100644 index 00000000..d89b350b --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/LabelRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var LabelRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'label' + } + }], + type: 'structure' +}; +var _default = LabelRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/LegendRole.js b/node_modules/axobject-query/lib/etc/objects/LegendRole.js new file mode 100644 index 00000000..233c8bf4 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/LegendRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var LegendRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'legend' + } + }], + type: 'structure' +}; +var _default = LegendRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/LineBreakRole.js b/node_modules/axobject-query/lib/etc/objects/LineBreakRole.js new file mode 100644 index 00000000..5fcc7fc7 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/LineBreakRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var LineBreakRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'br' + } + }], + type: 'structure' +}; +var _default = LineBreakRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/LinkRole.js b/node_modules/axobject-query/lib/etc/objects/LinkRole.js new file mode 100644 index 00000000..f79c9f31 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/LinkRole.js @@ -0,0 +1,25 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var LinkRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'link' + } + }, { + module: 'HTML', + concept: { + name: 'a', + attributes: [{ + name: 'href' + }] + } + }], + type: 'widget' +}; +var _default = LinkRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ListBoxOptionRole.js b/node_modules/axobject-query/lib/etc/objects/ListBoxOptionRole.js new file mode 100644 index 00000000..7b4bb82f --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ListBoxOptionRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ListBoxOptionRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'option' + } + }, { + module: 'HTML', + concept: { + name: 'option' + } + }], + type: 'widget' +}; +var _default = ListBoxOptionRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ListBoxRole.js b/node_modules/axobject-query/lib/etc/objects/ListBoxRole.js new file mode 100644 index 00000000..a6b24203 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ListBoxRole.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ListBoxRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'listbox' + } + }, { + module: 'HTML', + concept: { + name: 'datalist' + } + }, { + module: 'HTML', + concept: { + name: 'select' + } + }], + type: 'widget' +}; +var _default = ListBoxRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ListItemRole.js b/node_modules/axobject-query/lib/etc/objects/ListItemRole.js new file mode 100644 index 00000000..c707a480 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ListItemRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ListItemRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'listitem' + } + }, { + module: 'HTML', + concept: { + name: 'li' + } + }], + type: 'structure' +}; +var _default = ListItemRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ListMarkerRole.js b/node_modules/axobject-query/lib/etc/objects/ListMarkerRole.js new file mode 100644 index 00000000..0dc79354 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ListMarkerRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ListMarkerRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = ListMarkerRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ListRole.js b/node_modules/axobject-query/lib/etc/objects/ListRole.js new file mode 100644 index 00000000..279ddef5 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ListRole.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ListRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'list' + } + }, { + module: 'HTML', + concept: { + name: 'ul' + } + }, { + module: 'HTML', + concept: { + name: 'ol' + } + }], + type: 'structure' +}; +var _default = ListRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/LogRole.js b/node_modules/axobject-query/lib/etc/objects/LogRole.js new file mode 100644 index 00000000..8c4e4008 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/LogRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var LogRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'log' + } + }], + type: 'structure' +}; +var _default = LogRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MainRole.js b/node_modules/axobject-query/lib/etc/objects/MainRole.js new file mode 100644 index 00000000..93fa4ec3 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MainRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MainRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'main' + } + }, { + module: 'HTML', + concept: { + name: 'main' + } + }], + type: 'structure' +}; +var _default = MainRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MarkRole.js b/node_modules/axobject-query/lib/etc/objects/MarkRole.js new file mode 100644 index 00000000..cf427864 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MarkRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MarkRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'mark' + } + }], + type: 'structure' +}; +var _default = MarkRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MarqueeRole.js b/node_modules/axobject-query/lib/etc/objects/MarqueeRole.js new file mode 100644 index 00000000..d436eb45 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MarqueeRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MarqueeRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'marquee' + } + }, { + module: 'HTML', + concept: { + name: 'marquee' + } + }], + type: 'structure' +}; +var _default = MarqueeRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MathRole.js b/node_modules/axobject-query/lib/etc/objects/MathRole.js new file mode 100644 index 00000000..df7c27fa --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MathRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MathRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'math' + } + }], + type: 'structure' +}; +var _default = MathRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MenuBarRole.js b/node_modules/axobject-query/lib/etc/objects/MenuBarRole.js new file mode 100644 index 00000000..5e304f5c --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MenuBarRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MenuBarRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'menubar' + } + }], + type: 'structure' +}; +var _default = MenuBarRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MenuButtonRole.js b/node_modules/axobject-query/lib/etc/objects/MenuButtonRole.js new file mode 100644 index 00000000..8213d1be --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MenuButtonRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MenuButtonRole = { + relatedConcepts: [], + type: 'widget' +}; +var _default = MenuButtonRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MenuItemCheckBoxRole.js b/node_modules/axobject-query/lib/etc/objects/MenuItemCheckBoxRole.js new file mode 100644 index 00000000..77396a44 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MenuItemCheckBoxRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MenuItemCheckBoxRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'menuitemcheckbox' + } + }], + type: 'widget' +}; +var _default = MenuItemCheckBoxRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MenuItemRadioRole.js b/node_modules/axobject-query/lib/etc/objects/MenuItemRadioRole.js new file mode 100644 index 00000000..bbc3a2a1 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MenuItemRadioRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MenuItemRadioRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'menuitemradio' + } + }], + type: 'widget' +}; +var _default = MenuItemRadioRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MenuItemRole.js b/node_modules/axobject-query/lib/etc/objects/MenuItemRole.js new file mode 100644 index 00000000..e41996c6 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MenuItemRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MenuItemRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'menuitem' + } + }, { + module: 'HTML', + concept: { + name: 'menuitem' + } + }], + type: 'widget' +}; +var _default = MenuItemRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MenuListOptionRole.js b/node_modules/axobject-query/lib/etc/objects/MenuListOptionRole.js new file mode 100644 index 00000000..ffb2bba2 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MenuListOptionRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MenuListOptionRole = { + relatedConcepts: [], + type: 'widget' +}; +var _default = MenuListOptionRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MenuListPopupRole.js b/node_modules/axobject-query/lib/etc/objects/MenuListPopupRole.js new file mode 100644 index 00000000..96b10c5d --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MenuListPopupRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MenuListPopupRole = { + relatedConcepts: [], + type: 'widget' +}; +var _default = MenuListPopupRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MenuRole.js b/node_modules/axobject-query/lib/etc/objects/MenuRole.js new file mode 100644 index 00000000..0642e3fb --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MenuRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MenuRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'menu' + } + }, { + module: 'HTML', + concept: { + name: 'menu' + } + }], + type: 'structure' +}; +var _default = MenuRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/MeterRole.js b/node_modules/axobject-query/lib/etc/objects/MeterRole.js new file mode 100644 index 00000000..790338f6 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/MeterRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var MeterRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'meter' + } + }], + type: 'structure' +}; +var _default = MeterRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/NavigationRole.js b/node_modules/axobject-query/lib/etc/objects/NavigationRole.js new file mode 100644 index 00000000..64ee0a26 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/NavigationRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var NavigationRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'navigation' + } + }, { + module: 'HTML', + concept: { + name: 'nav' + } + }], + type: 'structure' +}; +var _default = NavigationRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/NoneRole.js b/node_modules/axobject-query/lib/etc/objects/NoneRole.js new file mode 100644 index 00000000..eda994c3 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/NoneRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var NoneRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'none' + } + }], + type: 'structure' +}; +var _default = NoneRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/NoteRole.js b/node_modules/axobject-query/lib/etc/objects/NoteRole.js new file mode 100644 index 00000000..8461d88e --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/NoteRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var NoteRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'note' + } + }], + type: 'structure' +}; +var _default = NoteRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/OutlineRole.js b/node_modules/axobject-query/lib/etc/objects/OutlineRole.js new file mode 100644 index 00000000..854b0633 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/OutlineRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var OutlineRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = OutlineRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ParagraphRole.js b/node_modules/axobject-query/lib/etc/objects/ParagraphRole.js new file mode 100644 index 00000000..61a3c47d --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ParagraphRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ParagraphRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'p' + } + }], + type: 'structure' +}; +var _default = ParagraphRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/PopUpButtonRole.js b/node_modules/axobject-query/lib/etc/objects/PopUpButtonRole.js new file mode 100644 index 00000000..5c977264 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/PopUpButtonRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var PopUpButtonRole = { + relatedConcepts: [], + type: 'widget' +}; +var _default = PopUpButtonRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/PreRole.js b/node_modules/axobject-query/lib/etc/objects/PreRole.js new file mode 100644 index 00000000..ab4e2570 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/PreRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var PreRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'pre' + } + }], + type: 'structure' +}; +var _default = PreRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/PresentationalRole.js b/node_modules/axobject-query/lib/etc/objects/PresentationalRole.js new file mode 100644 index 00000000..6f96d6cf --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/PresentationalRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var PresentationalRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'presentation' + } + }], + type: 'structure' +}; +var _default = PresentationalRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ProgressIndicatorRole.js b/node_modules/axobject-query/lib/etc/objects/ProgressIndicatorRole.js new file mode 100644 index 00000000..876ff208 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ProgressIndicatorRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ProgressIndicatorRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'progressbar' + } + }, { + module: 'HTML', + concept: { + name: 'progress' + } + }], + type: 'structure' +}; +var _default = ProgressIndicatorRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/RadioButtonRole.js b/node_modules/axobject-query/lib/etc/objects/RadioButtonRole.js new file mode 100644 index 00000000..ebbd9653 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/RadioButtonRole.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var RadioButtonRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'radio' + } + }, { + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'radio' + }] + } + }], + type: 'widget' +}; +var _default = RadioButtonRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/RadioGroupRole.js b/node_modules/axobject-query/lib/etc/objects/RadioGroupRole.js new file mode 100644 index 00000000..e090743c --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/RadioGroupRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var RadioGroupRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'radiogroup' + } + }], + type: 'structure' +}; +var _default = RadioGroupRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/RegionRole.js b/node_modules/axobject-query/lib/etc/objects/RegionRole.js new file mode 100644 index 00000000..ea724a53 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/RegionRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var RegionRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'region' + } + }], + type: 'structure' +}; +var _default = RegionRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/RootWebAreaRole.js b/node_modules/axobject-query/lib/etc/objects/RootWebAreaRole.js new file mode 100644 index 00000000..d7a2b195 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/RootWebAreaRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var RootWebAreaRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = RootWebAreaRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/RowHeaderRole.js b/node_modules/axobject-query/lib/etc/objects/RowHeaderRole.js new file mode 100644 index 00000000..fe650ae0 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/RowHeaderRole.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var RowHeaderRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'rowheader' + } + }, { + module: 'HTML', + concept: { + name: 'th', + attributes: [{ + name: 'scope', + value: 'row' + }] + } + }], + type: 'widget' +}; +var _default = RowHeaderRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/RowRole.js b/node_modules/axobject-query/lib/etc/objects/RowRole.js new file mode 100644 index 00000000..1f46cef1 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/RowRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var RowRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'row' + } + }, { + module: 'HTML', + concept: { + name: 'tr' + } + }], + type: 'structure' +}; +var _default = RowRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/RubyRole.js b/node_modules/axobject-query/lib/etc/objects/RubyRole.js new file mode 100644 index 00000000..447b03f9 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/RubyRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var RubyRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'ruby' + } + }], + type: 'structure' +}; +var _default = RubyRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/RulerRole.js b/node_modules/axobject-query/lib/etc/objects/RulerRole.js new file mode 100644 index 00000000..707b5a2e --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/RulerRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var RulerRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = RulerRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/SVGRootRole.js b/node_modules/axobject-query/lib/etc/objects/SVGRootRole.js new file mode 100644 index 00000000..835f03cf --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/SVGRootRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var SVGRootRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = SVGRootRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ScrollAreaRole.js b/node_modules/axobject-query/lib/etc/objects/ScrollAreaRole.js new file mode 100644 index 00000000..096042f6 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ScrollAreaRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ScrollAreaRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = ScrollAreaRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ScrollBarRole.js b/node_modules/axobject-query/lib/etc/objects/ScrollBarRole.js new file mode 100644 index 00000000..f47cedc5 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ScrollBarRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ScrollBarRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'scrollbar' + } + }], + type: 'widget' +}; +var _default = ScrollBarRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/SeamlessWebAreaRole.js b/node_modules/axobject-query/lib/etc/objects/SeamlessWebAreaRole.js new file mode 100644 index 00000000..8307cae9 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/SeamlessWebAreaRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var SeamlessWebAreaRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = SeamlessWebAreaRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/SearchBoxRole.js b/node_modules/axobject-query/lib/etc/objects/SearchBoxRole.js new file mode 100644 index 00000000..c2756b17 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/SearchBoxRole.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var SearchBoxRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'searchbox' + } + }, { + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'search' + }] + } + }], + type: 'widget' +}; +var _default = SearchBoxRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/SearchRole.js b/node_modules/axobject-query/lib/etc/objects/SearchRole.js new file mode 100644 index 00000000..e480ade3 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/SearchRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var SearchRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'search' + } + }], + type: 'structure' +}; +var _default = SearchRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/SliderRole.js b/node_modules/axobject-query/lib/etc/objects/SliderRole.js new file mode 100644 index 00000000..cbc46cac --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/SliderRole.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var SliderRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'slider' + } + }, { + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'range' + }] + } + }], + type: 'widget' +}; +var _default = SliderRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/SliderThumbRole.js b/node_modules/axobject-query/lib/etc/objects/SliderThumbRole.js new file mode 100644 index 00000000..feb2e4ed --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/SliderThumbRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var SliderThumbRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = SliderThumbRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/SpinButtonPartRole.js b/node_modules/axobject-query/lib/etc/objects/SpinButtonPartRole.js new file mode 100644 index 00000000..dc5f9503 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/SpinButtonPartRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var SpinButtonPartRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = SpinButtonPartRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/SpinButtonRole.js b/node_modules/axobject-query/lib/etc/objects/SpinButtonRole.js new file mode 100644 index 00000000..ce964305 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/SpinButtonRole.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var SpinButtonRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'spinbutton' + } + }, { + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'number' + }] + } + }], + type: 'widget' +}; +var _default = SpinButtonRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/SplitterRole.js b/node_modules/axobject-query/lib/etc/objects/SplitterRole.js new file mode 100644 index 00000000..1fe8a68e --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/SplitterRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var SplitterRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'separator' + } + }], + type: 'widget' +}; +var _default = SplitterRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/StaticTextRole.js b/node_modules/axobject-query/lib/etc/objects/StaticTextRole.js new file mode 100644 index 00000000..a7ed55bd --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/StaticTextRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var StaticTextRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = StaticTextRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/StatusRole.js b/node_modules/axobject-query/lib/etc/objects/StatusRole.js new file mode 100644 index 00000000..3ec2e8d5 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/StatusRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var StatusRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'status' + } + }], + type: 'structure' +}; +var _default = StatusRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/SwitchRole.js b/node_modules/axobject-query/lib/etc/objects/SwitchRole.js new file mode 100644 index 00000000..7d8aabde --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/SwitchRole.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var SwitchRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'switch' + } + }, { + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'checkbox' + }] + } + }], + type: 'widget' +}; +var _default = SwitchRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TabGroupRole.js b/node_modules/axobject-query/lib/etc/objects/TabGroupRole.js new file mode 100644 index 00000000..b45e4f85 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TabGroupRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TabGroupRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'tablist' + } + }], + type: 'structure' +}; +var _default = TabGroupRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TabListRole.js b/node_modules/axobject-query/lib/etc/objects/TabListRole.js new file mode 100644 index 00000000..c1eddcb3 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TabListRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TabListRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'tablist' + } + }], + type: 'structure' +}; +var _default = TabListRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TabPanelRole.js b/node_modules/axobject-query/lib/etc/objects/TabPanelRole.js new file mode 100644 index 00000000..c5a31d64 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TabPanelRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TabPanelRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'tabpanel' + } + }], + type: 'structure' +}; +var _default = TabPanelRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TabRole.js b/node_modules/axobject-query/lib/etc/objects/TabRole.js new file mode 100644 index 00000000..e89cf4a3 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TabRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TabRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'tab' + } + }], + type: 'widget' +}; +var _default = TabRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TableHeaderContainerRole.js b/node_modules/axobject-query/lib/etc/objects/TableHeaderContainerRole.js new file mode 100644 index 00000000..45edbdb9 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TableHeaderContainerRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TableHeaderContainerRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = TableHeaderContainerRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TableRole.js b/node_modules/axobject-query/lib/etc/objects/TableRole.js new file mode 100644 index 00000000..182ad695 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TableRole.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TableRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'table' + } + }, { + module: 'HTML', + concept: { + name: 'table' + } + }], + type: 'structure' +}; +var _default = TableRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TermRole.js b/node_modules/axobject-query/lib/etc/objects/TermRole.js new file mode 100644 index 00000000..a857af5a --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TermRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TermRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'term' + } + }], + type: 'structure' +}; +var _default = TermRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TextAreaRole.js b/node_modules/axobject-query/lib/etc/objects/TextAreaRole.js new file mode 100644 index 00000000..715ff2b0 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TextAreaRole.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TextAreaRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + attributes: [{ + name: 'aria-multiline', + value: 'true' + }], + name: 'textbox' + } + }, { + module: 'HTML', + concept: { + name: 'textarea' + } + }], + type: 'widget' +}; +var _default = TextAreaRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TextFieldRole.js b/node_modules/axobject-query/lib/etc/objects/TextFieldRole.js new file mode 100644 index 00000000..f3c8f91a --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TextFieldRole.js @@ -0,0 +1,31 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TextFieldRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'textbox' + } + }, { + module: 'HTML', + concept: { + name: 'input' + } + }, { + module: 'HTML', + concept: { + name: 'input', + attributes: [{ + name: 'type', + value: 'text' + }] + } + }], + type: 'widget' +}; +var _default = TextFieldRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TimeRole.js b/node_modules/axobject-query/lib/etc/objects/TimeRole.js new file mode 100644 index 00000000..d57bf0b6 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TimeRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TimeRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'time' + } + }], + type: 'structure' +}; +var _default = TimeRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TimerRole.js b/node_modules/axobject-query/lib/etc/objects/TimerRole.js new file mode 100644 index 00000000..25c74d05 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TimerRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TimerRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'timer' + } + }], + type: 'structure' +}; +var _default = TimerRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ToggleButtonRole.js b/node_modules/axobject-query/lib/etc/objects/ToggleButtonRole.js new file mode 100644 index 00000000..09fab857 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ToggleButtonRole.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ToggleButtonRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + attributes: [{ + name: 'aria-pressed' + }] + } + }], + type: 'widget' +}; +var _default = ToggleButtonRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/ToolbarRole.js b/node_modules/axobject-query/lib/etc/objects/ToolbarRole.js new file mode 100644 index 00000000..446a2372 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/ToolbarRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var ToolbarRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'toolbar' + } + }], + type: 'structure' +}; +var _default = ToolbarRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TreeGridRole.js b/node_modules/axobject-query/lib/etc/objects/TreeGridRole.js new file mode 100644 index 00000000..9cda71b8 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TreeGridRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TreeGridRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'treegrid' + } + }], + type: 'widget' +}; +var _default = TreeGridRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TreeItemRole.js b/node_modules/axobject-query/lib/etc/objects/TreeItemRole.js new file mode 100644 index 00000000..646c126b --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TreeItemRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TreeItemRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'treeitem' + } + }], + type: 'widget' +}; +var _default = TreeItemRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/TreeRole.js b/node_modules/axobject-query/lib/etc/objects/TreeRole.js new file mode 100644 index 00000000..082fb425 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/TreeRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var TreeRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'tree' + } + }], + type: 'widget' +}; +var _default = TreeRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/UserInterfaceTooltipRole.js b/node_modules/axobject-query/lib/etc/objects/UserInterfaceTooltipRole.js new file mode 100644 index 00000000..891f2ef1 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/UserInterfaceTooltipRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var UserInterfaceTooltipRole = { + relatedConcepts: [{ + module: 'ARIA', + concept: { + name: 'tooltip' + } + }], + type: 'structure' +}; +var _default = UserInterfaceTooltipRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/VideoRole.js b/node_modules/axobject-query/lib/etc/objects/VideoRole.js new file mode 100644 index 00000000..f1755f02 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/VideoRole.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var VideoRole = { + relatedConcepts: [{ + module: 'HTML', + concept: { + name: 'video' + } + }], + type: 'widget' +}; +var _default = VideoRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/WebAreaRole.js b/node_modules/axobject-query/lib/etc/objects/WebAreaRole.js new file mode 100644 index 00000000..b1c72507 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/WebAreaRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var WebAreaRole = { + relatedConcepts: [], + type: 'structure' +}; +var _default = WebAreaRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/etc/objects/WindowRole.js b/node_modules/axobject-query/lib/etc/objects/WindowRole.js new file mode 100644 index 00000000..0a8d5bd3 --- /dev/null +++ b/node_modules/axobject-query/lib/etc/objects/WindowRole.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +var WindowRole = { + relatedConcepts: [], + type: 'window' +}; +var _default = WindowRole; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/index.js b/node_modules/axobject-query/lib/index.js new file mode 100644 index 00000000..614a2301 --- /dev/null +++ b/node_modules/axobject-query/lib/index.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.elementAXObjects = exports.AXObjects = exports.AXObjectRoles = exports.AXObjectElements = void 0; +var _AXObjectElementMap = _interopRequireDefault(require("./AXObjectElementMap")); +var _AXObjectRoleMap = _interopRequireDefault(require("./AXObjectRoleMap")); +var _AXObjectsMap = _interopRequireDefault(require("./AXObjectsMap")); +var _elementAXObjectMap = _interopRequireDefault(require("./elementAXObjectMap")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var AXObjectElements = _AXObjectElementMap.default; +exports.AXObjectElements = AXObjectElements; +var AXObjectRoles = _AXObjectRoleMap.default; +exports.AXObjectRoles = AXObjectRoles; +var AXObjects = _AXObjectsMap.default; +exports.AXObjects = AXObjects; +var elementAXObjects = _elementAXObjectMap.default; +exports.elementAXObjects = elementAXObjects; \ No newline at end of file diff --git a/node_modules/axobject-query/lib/util/iterationDecorator.js b/node_modules/axobject-query/lib/util/iterationDecorator.js new file mode 100644 index 00000000..50b1102b --- /dev/null +++ b/node_modules/axobject-query/lib/util/iterationDecorator.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = iterationDecorator; +var _iteratorProxy = _interopRequireDefault(require("./iteratorProxy")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } +function iterationDecorator(collection, entries) { + if (typeof Symbol === 'function' && _typeof(Symbol.iterator) === 'symbol') { + Object.defineProperty(collection, Symbol.iterator, { + value: _iteratorProxy.default.bind(entries) + }); + } + return collection; +} \ No newline at end of file diff --git a/node_modules/axobject-query/lib/util/iteratorProxy.js b/node_modules/axobject-query/lib/util/iteratorProxy.js new file mode 100644 index 00000000..2624303e --- /dev/null +++ b/node_modules/axobject-query/lib/util/iteratorProxy.js @@ -0,0 +1,33 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +// eslint-disable-next-line no-unused-vars +function iteratorProxy() { + var values = this; + var index = 0; + var iter = { + '@@iterator': function iterator() { + return iter; + }, + next: function next() { + if (index < values.length) { + var value = values[index]; + index = index + 1; + return { + done: false, + value: value + }; + } else { + return { + done: true + }; + } + } + }; + return iter; +} +var _default = iteratorProxy; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/axobject-query/package.json b/node_modules/axobject-query/package.json new file mode 100644 index 00000000..2a2c64a3 --- /dev/null +++ b/node_modules/axobject-query/package.json @@ -0,0 +1,69 @@ +{ + "name": "axobject-query", + "version": "4.1.0", + "description": "Programmatic access to information about the AXObject Model", + "main": "lib/index.js", + "files": [ + "lib" + ], + "scripts": { + "build": "rimraf lib && babel src --out-dir lib", + "flow": "flow", + "lint": "eslint --ext=js,mjs .", + "lint:fix": "npm run lint -- --fix", + "prepublishOnly": "npm run build", + "pretest": "npm run lint:fix && npm run flow", + "test": "npm run tests-only", + "build:tests": "npm run build && rimraf __tests-built__ && BABEL_ENV=test babel __tests__ --out-dir __tests-built__", + "tests-built": "nyc tape '__tests-built__/**/*.js'", + "tests-only": "nyc tape -r @babel/register '__tests__/**/*.js'", + "prepack": "npm run build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/A11yance/axobject-query.git" + }, + "keywords": [ + "accessibility" + ], + "author": "Jesse Beach ", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/A11yance/axobject-query/issues" + }, + "homepage": "https://github.com/A11yance/axobject-query#readme", + "devDependencies": { + "@babel/cli": "^7.19.3", + "@babel/core": "^7.19.6", + "@babel/eslint-parser": "^7.19.1", + "@babel/plugin-transform-react-jsx": "^7.24.7", + "@babel/preset-env": "^7.19.4", + "@babel/preset-flow": "^7.18.6", + "@babel/register": "^7.24.6", + "babel-plugin-module-resolver": "^5.0.2", + "deep-equal-json": "^1.0.0", + "encoding": "^0.1.13", + "eslint": "^8.26.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-flowtype": "^8.0.3", + "eslint-plugin-import": "^2.26.0", + "expect": "^29.2.1", + "flow-bin": "^0.190.1", + "flow-typed": "^3.8.0", + "mock-property": "^1.0.3", + "nyc": "^10.3.2", + "object-inspect": "^1.13.2", + "object.values": "^1.2.0", + "rimraf": "^3.0.2", + "tape": "^5.8.1" + }, + "browserslist": [ + ">0.2%", + "not dead", + "not op_mini all", + "ie 11" + ], + "engines": { + "node": ">= 0.4" + } +} diff --git a/node_modules/balanced-match/.github/FUNDING.yml b/node_modules/balanced-match/.github/FUNDING.yml new file mode 100644 index 00000000..cea8b16e --- /dev/null +++ b/node_modules/balanced-match/.github/FUNDING.yml @@ -0,0 +1,2 @@ +tidelift: "npm/balanced-match" +patreon: juliangruber diff --git a/node_modules/balanced-match/LICENSE.md b/node_modules/balanced-match/LICENSE.md new file mode 100644 index 00000000..2cdc8e41 --- /dev/null +++ b/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/balanced-match/README.md b/node_modules/balanced-match/README.md new file mode 100644 index 00000000..d2a48b6b --- /dev/null +++ b/node_modules/balanced-match/README.md @@ -0,0 +1,97 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ , ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/balanced-match/index.js b/node_modules/balanced-match/index.js new file mode 100644 index 00000000..c67a6460 --- /dev/null +++ b/node_modules/balanced-match/index.js @@ -0,0 +1,62 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/node_modules/balanced-match/package.json b/node_modules/balanced-match/package.json new file mode 100644 index 00000000..ce6073e0 --- /dev/null +++ b/node_modules/balanced-match/package.json @@ -0,0 +1,48 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "1.0.2", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "tape test/test.js", + "bench": "matcha test/bench.js" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "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/brace-expansion/.github/FUNDING.yml b/node_modules/brace-expansion/.github/FUNDING.yml new file mode 100644 index 00000000..79d1eafc --- /dev/null +++ b/node_modules/brace-expansion/.github/FUNDING.yml @@ -0,0 +1,2 @@ +tidelift: "npm/brace-expansion" +patreon: juliangruber diff --git a/node_modules/brace-expansion/LICENSE b/node_modules/brace-expansion/LICENSE new file mode 100644 index 00000000..de322667 --- /dev/null +++ b/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +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/brace-expansion/README.md b/node_modules/brace-expansion/README.md new file mode 100644 index 00000000..e55c583d --- /dev/null +++ b/node_modules/brace-expansion/README.md @@ -0,0 +1,135 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/brace-expansion/index.js b/node_modules/brace-expansion/index.js new file mode 100644 index 00000000..4af9ddee --- /dev/null +++ b/node_modules/brace-expansion/index.js @@ -0,0 +1,203 @@ +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/brace-expansion/package.json b/node_modules/brace-expansion/package.json new file mode 100644 index 00000000..7097d41e --- /dev/null +++ b/node_modules/brace-expansion/package.json @@ -0,0 +1,46 @@ +{ + "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/braces/LICENSE b/node_modules/braces/LICENSE new file mode 100644 index 00000000..9af4a67d --- /dev/null +++ b/node_modules/braces/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-present, Jon Schlinkert. + +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/braces/README.md b/node_modules/braces/README.md new file mode 100644 index 00000000..f59dd604 --- /dev/null +++ b/node_modules/braces/README.md @@ -0,0 +1,586 @@ +# braces [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces) + +> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save braces +``` + +## v3.0.0 Released!! + +See the [changelog](CHANGELOG.md) for details. + +## Why use braces? + +Brace patterns make globs more powerful by adding the ability to match specific ranges and sequences of characters. + +- **Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests) +- **[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity. +- **Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up. +- **Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written). +- **Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)). +- [Supports lists](#lists) - (aka "sets") `a/{b,c}/d` => `['a/b/d', 'a/c/d']` +- [Supports sequences](#sequences) - (aka "ranges") `{01..03}` => `['01', '02', '03']` +- [Supports steps](#steps) - (aka "increments") `{2..10..2}` => `['2', '4', '6', '8', '10']` +- [Supports escaping](#escaping) - To prevent evaluation of special characters. + +## Usage + +The main export is a function that takes one or more brace `patterns` and `options`. + +```js +const braces = require('braces'); +// braces(patterns[, options]); + +console.log(braces(['{01..05}', '{a..e}'])); +//=> ['(0[1-5])', '([a-e])'] + +console.log(braces(['{01..05}', '{a..e}'], { expand: true })); +//=> ['01', '02', '03', '04', '05', 'a', 'b', 'c', 'd', 'e'] +``` + +### Brace Expansion vs. Compilation + +By default, brace patterns are compiled into strings that are optimized for creating regular expressions and matching. + +**Compiled** + +```js +console.log(braces('a/{x,y,z}/b')); +//=> ['a/(x|y|z)/b'] +console.log(braces(['a/{01..20}/b', 'a/{1..5}/b'])); +//=> [ 'a/(0[1-9]|1[0-9]|20)/b', 'a/([1-5])/b' ] +``` + +**Expanded** + +Enable brace expansion by setting the `expand` option to true, or by using [braces.expand()](#expand) (returns an array similar to what you'd expect from Bash, or `echo {1..5}`, or [minimatch](https://github.com/isaacs/minimatch)): + +```js +console.log(braces('a/{x,y,z}/b', { expand: true })); +//=> ['a/x/b', 'a/y/b', 'a/z/b'] + +console.log(braces.expand('{01..10}')); +//=> ['01','02','03','04','05','06','07','08','09','10'] +``` + +### Lists + +Expand lists (like Bash "sets"): + +```js +console.log(braces('a/{foo,bar,baz}/*.js')); +//=> ['a/(foo|bar|baz)/*.js'] + +console.log(braces.expand('a/{foo,bar,baz}/*.js')); +//=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js'] +``` + +### Sequences + +Expand ranges of characters (like Bash "sequences"): + +```js +console.log(braces.expand('{1..3}')); // ['1', '2', '3'] +console.log(braces.expand('a/{1..3}/b')); // ['a/1/b', 'a/2/b', 'a/3/b'] +console.log(braces('{a..c}', { expand: true })); // ['a', 'b', 'c'] +console.log(braces('foo/{a..c}', { expand: true })); // ['foo/a', 'foo/b', 'foo/c'] + +// supports zero-padded ranges +console.log(braces('a/{01..03}/b')); //=> ['a/(0[1-3])/b'] +console.log(braces('a/{001..300}/b')); //=> ['a/(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)/b'] +``` + +See [fill-range](https://github.com/jonschlinkert/fill-range) for all available range-expansion options. + +### Steppped ranges + +Steps, or increments, may be used with ranges: + +```js +console.log(braces.expand('{2..10..2}')); +//=> ['2', '4', '6', '8', '10'] + +console.log(braces('{2..10..2}')); +//=> ['(2|4|6|8|10)'] +``` + +When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion. + +### Nesting + +Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved. + +**"Expanded" braces** + +```js +console.log(braces.expand('a{b,c,/{x,y}}/e')); +//=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e'] + +console.log(braces.expand('a/{x,{1..5},y}/c')); +//=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c'] +``` + +**"Optimized" braces** + +```js +console.log(braces('a{b,c,/{x,y}}/e')); +//=> ['a(b|c|/(x|y))/e'] + +console.log(braces('a/{x,{1..5},y}/c')); +//=> ['a/(x|([1-5])|y)/c'] +``` + +### Escaping + +**Escaping braces** + +A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_: + +```js +console.log(braces.expand('a\\{d,c,b}e')); +//=> ['a{d,c,b}e'] + +console.log(braces.expand('a{d,c,b\\}e')); +//=> ['a{d,c,b}e'] +``` + +**Escaping commas** + +Commas inside braces may also be escaped: + +```js +console.log(braces.expand('a{b\\,c}d')); +//=> ['a{b,c}d'] + +console.log(braces.expand('a{d\\,c,b}e')); +//=> ['ad,ce', 'abe'] +``` + +**Single items** + +Following bash conventions, a brace pattern is also not expanded when it contains a single character: + +```js +console.log(braces.expand('a{b}c')); +//=> ['a{b}c'] +``` + +## Options + +### options.maxLength + +**Type**: `Number` + +**Default**: `10,000` + +**Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera. + +```js +console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error +``` + +### options.expand + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Generate an "expanded" brace pattern (alternatively you can use the `braces.expand()` method, which does the same thing). + +```js +console.log(braces('a/{b,c}/d', { expand: true })); +//=> [ 'a/b/d', 'a/c/d' ] +``` + +### options.nodupes + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Remove duplicates from the returned array. + +### options.rangeLimit + +**Type**: `Number` + +**Default**: `1000` + +**Description**: To prevent malicious patterns from being passed by users, an error is thrown when `braces.expand()` is used or `options.expand` is true and the generated range will exceed the `rangeLimit`. + +You can customize `options.rangeLimit` or set it to `Inifinity` to disable this altogether. + +**Examples** + +```js +// pattern exceeds the "rangeLimit", so it's optimized automatically +console.log(braces.expand('{1..1000}')); +//=> ['([1-9]|[1-9][0-9]{1,2}|1000)'] + +// pattern does not exceed "rangeLimit", so it's NOT optimized +console.log(braces.expand('{1..100}')); +//=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100'] +``` + +### options.transform + +**Type**: `Function` + +**Default**: `undefined` + +**Description**: Customize range expansion. + +**Example: Transforming non-numeric values** + +```js +const alpha = braces.expand('x/{a..e}/y', { + transform(value, index) { + // When non-numeric values are passed, "value" is a character code. + return 'foo/' + String.fromCharCode(value) + '-' + index; + }, +}); +console.log(alpha); +//=> [ 'x/foo/a-0/y', 'x/foo/b-1/y', 'x/foo/c-2/y', 'x/foo/d-3/y', 'x/foo/e-4/y' ] +``` + +**Example: Transforming numeric values** + +```js +const numeric = braces.expand('{1..5}', { + transform(value) { + // when numeric values are passed, "value" is a number + return 'foo/' + value * 2; + }, +}); +console.log(numeric); +//=> [ 'foo/2', 'foo/4', 'foo/6', 'foo/8', 'foo/10' ] +``` + +### options.quantifiers + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times. + +Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists) + +The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists. + +**Examples** + +```js +const braces = require('braces'); +console.log(braces('a/b{1,3}/{x,y,z}')); +//=> [ 'a/b(1|3)/(x|y|z)' ] +console.log(braces('a/b{1,3}/{x,y,z}', { quantifiers: true })); +//=> [ 'a/b{1,3}/(x|y|z)' ] +console.log(braces('a/b{1,3}/{x,y,z}', { quantifiers: true, expand: true })); +//=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ] +``` + +### options.keepEscaping + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Do not strip backslashes that were used for escaping from the result. + +## What is "brace expansion"? + +Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs). + +In addition to "expansion", braces are also used for matching. In other words: + +- [brace expansion](#brace-expansion) is for generating new lists +- [brace matching](#brace-matching) is for filtering existing lists + +
+More about brace expansion (click to expand) + +There are two main types of brace expansion: + +1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}` +2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges". + +Here are some example brace patterns to illustrate how they work: + +**Sets** + +``` +{a,b,c} => a b c +{a,b,c}{1,2} => a1 a2 b1 b2 c1 c2 +``` + +**Sequences** + +``` +{1..9} => 1 2 3 4 5 6 7 8 9 +{4..-4} => 4 3 2 1 0 -1 -2 -3 -4 +{1..20..3} => 1 4 7 10 13 16 19 +{a..j} => a b c d e f g h i j +{j..a} => j i h g f e d c b a +{a..z..3} => a d g j m p s v y +``` + +**Combination** + +Sets and sequences can be mixed together or used along with any other strings. + +``` +{a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3 +foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar +``` + +The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases. + +## Brace matching + +In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching. + +For example, the pattern `foo/{1..3}/bar` would match any of following strings: + +``` +foo/1/bar +foo/2/bar +foo/3/bar +``` + +But not: + +``` +baz/1/qux +baz/2/qux +baz/3/qux +``` + +Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings: + +``` +foo/1/bar +foo/2/bar +foo/3/bar +baz/1/qux +baz/2/qux +baz/3/qux +``` + +## Brace matching pitfalls + +Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of. + +### tldr + +**"brace bombs"** + +- brace expansion can eat up a huge amount of processing resources +- as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially +- users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!) + +For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section. + +### The solution + +Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries. + +### Geometric complexity + +At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`. + +For example, the following sets demonstrate quadratic (`O(n^2)`) complexity: + +``` +{1,2}{3,4} => (2X2) => 13 14 23 24 +{1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246 +``` + +But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity: + +``` +{1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248 + 249 257 258 259 267 268 269 347 348 349 357 + 358 359 367 368 369 +``` + +Now, imagine how this complexity grows given that each element is a n-tuple: + +``` +{1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB) +{1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB) +``` + +Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control. + +**More information** + +Interested in learning more about brace expansion? + +- [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion) +- [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion) +- [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) + +
+ +## Performance + +Braces is not only screaming fast, it's also more accurate the other brace expansion libraries. + +### Better algorithms + +Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_. + +Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently. + +**The proof is in the numbers** + +Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively. + +| **Pattern** | **braces** | **[minimatch][]** | +| --------------------------- | ------------------- | ---------------------------- | +| `{1..9007199254740991}`[^1] | `298 B` (5ms 459μs) | N/A (freezes) | +| `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) | +| `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) | +| `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) | +| `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) | +| `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) | +| `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) | +| `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) | +| `{1..100000000}` | `33 B` (733μs) | N/A (freezes) | +| `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) | +| `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) | +| `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) | +| `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) | +| `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) | +| `{1..100}` | `22 B` (345μs) | `291 B` (196μs) | +| `{1..10}` | `10 B` (533μs) | `20 B` (37μs) | +| `{1..3}` | `7 B` (190μs) | `5 B` (27μs) | + +### Faster algorithms + +When you need expansion, braces is still much faster. + +_(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_ + +| **Pattern** | **braces** | **[minimatch][]** | +| --------------- | --------------------------- | ---------------------------- | +| `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) | +| `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) | +| `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) | +| `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) | +| `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) | +| `{1..100}` | `291 B` (424μs) | `291 B` (211μs) | +| `{1..10}` | `20 B` (487μs) | `20 B` (72μs) | +| `{1..3}` | `5 B` (166μs) | `5 B` (27μs) | + +If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js). + +## Benchmarks + +### Running benchmarks + +Install dev dependencies: + +```bash +npm i -d && npm benchmark +``` + +### Latest results + +Braces is more accurate, without sacrificing performance. + +```bash +● expand - range (expanded) + braces x 53,167 ops/sec ±0.12% (102 runs sampled) + minimatch x 11,378 ops/sec ±0.10% (102 runs sampled) +● expand - range (optimized for regex) + braces x 373,442 ops/sec ±0.04% (100 runs sampled) + minimatch x 3,262 ops/sec ±0.18% (100 runs sampled) +● expand - nested ranges (expanded) + braces x 33,921 ops/sec ±0.09% (99 runs sampled) + minimatch x 10,855 ops/sec ±0.28% (100 runs sampled) +● expand - nested ranges (optimized for regex) + braces x 287,479 ops/sec ±0.52% (98 runs sampled) + minimatch x 3,219 ops/sec ±0.28% (101 runs sampled) +● expand - set (expanded) + braces x 238,243 ops/sec ±0.19% (97 runs sampled) + minimatch x 538,268 ops/sec ±0.31% (96 runs sampled) +● expand - set (optimized for regex) + braces x 321,844 ops/sec ±0.10% (97 runs sampled) + minimatch x 140,600 ops/sec ±0.15% (100 runs sampled) +● expand - nested sets (expanded) + braces x 165,371 ops/sec ±0.42% (96 runs sampled) + minimatch x 337,720 ops/sec ±0.28% (100 runs sampled) +● expand - nested sets (optimized for regex) + braces x 242,948 ops/sec ±0.12% (99 runs sampled) + minimatch x 87,403 ops/sec ±0.79% (96 runs sampled) +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Contributors + +| **Commits** | **Contributor** | +| ----------- | ------------------------------------------------------------- | +| 197 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [doowb](https://github.com/doowb) | +| 1 | [es128](https://github.com/es128) | +| 1 | [eush77](https://github.com/eush77) | +| 1 | [hemanth](https://github.com/hemanth) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Author + +**Jon Schlinkert** + +- [GitHub Profile](https://github.com/jonschlinkert) +- [Twitter Profile](https://twitter.com/jonschlinkert) +- [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +--- + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._ diff --git a/node_modules/braces/index.js b/node_modules/braces/index.js new file mode 100644 index 00000000..d222c13b --- /dev/null +++ b/node_modules/braces/index.js @@ -0,0 +1,170 @@ +'use strict'; + +const stringify = require('./lib/stringify'); +const compile = require('./lib/compile'); +const expand = require('./lib/expand'); +const parse = require('./lib/parse'); + +/** + * Expand the given pattern or create a regex-compatible string. + * + * ```js + * const braces = require('braces'); + * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] + * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ + +const braces = (input, options = {}) => { + let output = []; + + if (Array.isArray(input)) { + for (const pattern of input) { + const result = braces.create(pattern, options); + if (Array.isArray(result)) { + output.push(...result); + } else { + output.push(result); + } + } + } else { + output = [].concat(braces.create(input, options)); + } + + if (options && options.expand === true && options.nodupes === true) { + output = [...new Set(output)]; + } + return output; +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * // braces.parse(pattern, [, options]); + * const ast = braces.parse('a/{b,c}/d'); + * console.log(ast); + * ``` + * @param {String} pattern Brace pattern to parse + * @param {Object} options + * @return {Object} Returns an AST + * @api public + */ + +braces.parse = (input, options = {}) => parse(input, options); + +/** + * Creates a braces string from an AST, or an AST node. + * + * ```js + * const braces = require('braces'); + * let ast = braces.parse('foo/{a,b}/bar'); + * console.log(stringify(ast.nodes[2])); //=> '{a,b}' + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.stringify = (input, options = {}) => { + if (typeof input === 'string') { + return stringify(braces.parse(input, options), options); + } + return stringify(input, options); +}; + +/** + * Compiles a brace pattern into a regex-compatible, optimized string. + * This method is called by the main [braces](#braces) function by default. + * + * ```js + * const braces = require('braces'); + * console.log(braces.compile('a/{b,c}/d')); + * //=> ['a/(b|c)/d'] + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.compile = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } + return compile(input, options); +}; + +/** + * Expands a brace pattern into an array. This method is called by the + * main [braces](#braces) function when `options.expand` is true. Before + * using this method it's recommended that you read the [performance notes](#performance)) + * and advantages of using [.compile](#compile) instead. + * + * ```js + * const braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/b/d', 'a/c/d']; + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.expand = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } + + let result = expand(input, options); + + // filter out empty strings if specified + if (options.noempty === true) { + result = result.filter(Boolean); + } + + // filter out duplicates if specified + if (options.nodupes === true) { + result = [...new Set(result)]; + } + + return result; +}; + +/** + * Processes a brace pattern and returns either an expanded array + * (if `options.expand` is true), a highly optimized regex-compatible string. + * This method is called by the main [braces](#braces) function. + * + * ```js + * const braces = require('braces'); + * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) + * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.create = (input, options = {}) => { + if (input === '' || input.length < 3) { + return [input]; + } + + return options.expand !== true + ? braces.compile(input, options) + : braces.expand(input, options); +}; + +/** + * Expose "braces" + */ + +module.exports = braces; diff --git a/node_modules/braces/lib/compile.js b/node_modules/braces/lib/compile.js new file mode 100644 index 00000000..dce69beb --- /dev/null +++ b/node_modules/braces/lib/compile.js @@ -0,0 +1,60 @@ +'use strict'; + +const fill = require('fill-range'); +const utils = require('./utils'); + +const compile = (ast, options = {}) => { + const walk = (node, parent = {}) => { + const invalidBlock = utils.isInvalidBrace(parent); + const invalidNode = node.invalid === true && options.escapeInvalid === true; + const invalid = invalidBlock === true || invalidNode === true; + const prefix = options.escapeInvalid === true ? '\\' : ''; + let output = ''; + + if (node.isOpen === true) { + return prefix + node.value; + } + + if (node.isClose === true) { + console.log('node.isClose', prefix, node.value); + return prefix + node.value; + } + + if (node.type === 'open') { + return invalid ? prefix + node.value : '('; + } + + if (node.type === 'close') { + return invalid ? prefix + node.value : ')'; + } + + if (node.type === 'comma') { + return node.prev.type === 'comma' ? '' : invalid ? node.value : '|'; + } + + if (node.value) { + return node.value; + } + + if (node.nodes && node.ranges > 0) { + const args = utils.reduce(node.nodes); + const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true }); + + if (range.length !== 0) { + return args.length > 1 && range.length > 1 ? `(${range})` : range; + } + } + + if (node.nodes) { + for (const child of node.nodes) { + output += walk(child, node); + } + } + + return output; + }; + + return walk(ast); +}; + +module.exports = compile; diff --git a/node_modules/braces/lib/constants.js b/node_modules/braces/lib/constants.js new file mode 100644 index 00000000..2bb3b884 --- /dev/null +++ b/node_modules/braces/lib/constants.js @@ -0,0 +1,57 @@ +'use strict'; + +module.exports = { + MAX_LENGTH: 10000, + + // Digits + CHAR_0: '0', /* 0 */ + CHAR_9: '9', /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 'A', /* A */ + CHAR_LOWERCASE_A: 'a', /* a */ + CHAR_UPPERCASE_Z: 'Z', /* Z */ + CHAR_LOWERCASE_Z: 'z', /* z */ + + CHAR_LEFT_PARENTHESES: '(', /* ( */ + CHAR_RIGHT_PARENTHESES: ')', /* ) */ + + CHAR_ASTERISK: '*', /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: '&', /* & */ + CHAR_AT: '@', /* @ */ + CHAR_BACKSLASH: '\\', /* \ */ + CHAR_BACKTICK: '`', /* ` */ + CHAR_CARRIAGE_RETURN: '\r', /* \r */ + CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ + CHAR_COLON: ':', /* : */ + CHAR_COMMA: ',', /* , */ + CHAR_DOLLAR: '$', /* . */ + CHAR_DOT: '.', /* . */ + CHAR_DOUBLE_QUOTE: '"', /* " */ + CHAR_EQUAL: '=', /* = */ + CHAR_EXCLAMATION_MARK: '!', /* ! */ + CHAR_FORM_FEED: '\f', /* \f */ + CHAR_FORWARD_SLASH: '/', /* / */ + CHAR_HASH: '#', /* # */ + CHAR_HYPHEN_MINUS: '-', /* - */ + CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ + CHAR_LEFT_CURLY_BRACE: '{', /* { */ + CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ + CHAR_LINE_FEED: '\n', /* \n */ + CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ + CHAR_PERCENT: '%', /* % */ + CHAR_PLUS: '+', /* + */ + CHAR_QUESTION_MARK: '?', /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ + CHAR_RIGHT_CURLY_BRACE: '}', /* } */ + CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ + CHAR_SEMICOLON: ';', /* ; */ + CHAR_SINGLE_QUOTE: '\'', /* ' */ + CHAR_SPACE: ' ', /* */ + CHAR_TAB: '\t', /* \t */ + CHAR_UNDERSCORE: '_', /* _ */ + CHAR_VERTICAL_LINE: '|', /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ +}; diff --git a/node_modules/braces/lib/expand.js b/node_modules/braces/lib/expand.js new file mode 100644 index 00000000..35b2c41d --- /dev/null +++ b/node_modules/braces/lib/expand.js @@ -0,0 +1,113 @@ +'use strict'; + +const fill = require('fill-range'); +const stringify = require('./stringify'); +const utils = require('./utils'); + +const append = (queue = '', stash = '', enclose = false) => { + const result = []; + + queue = [].concat(queue); + stash = [].concat(stash); + + if (!stash.length) return queue; + if (!queue.length) { + return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; + } + + for (const item of queue) { + if (Array.isArray(item)) { + for (const value of item) { + result.push(append(value, stash, enclose)); + } + } else { + for (let ele of stash) { + if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; + result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele); + } + } + } + return utils.flatten(result); +}; + +const expand = (ast, options = {}) => { + const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit; + + const walk = (node, parent = {}) => { + node.queue = []; + + let p = parent; + let q = parent.queue; + + while (p.type !== 'brace' && p.type !== 'root' && p.parent) { + p = p.parent; + q = p.queue; + } + + if (node.invalid || node.dollar) { + q.push(append(q.pop(), stringify(node, options))); + return; + } + + if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { + q.push(append(q.pop(), ['{}'])); + return; + } + + if (node.nodes && node.ranges > 0) { + const args = utils.reduce(node.nodes); + + if (utils.exceedsLimit(...args, options.step, rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } + + let range = fill(...args, options); + if (range.length === 0) { + range = stringify(node, options); + } + + q.push(append(q.pop(), range)); + node.nodes = []; + return; + } + + const enclose = utils.encloseBrace(node); + let queue = node.queue; + let block = node; + + while (block.type !== 'brace' && block.type !== 'root' && block.parent) { + block = block.parent; + queue = block.queue; + } + + for (let i = 0; i < node.nodes.length; i++) { + const child = node.nodes[i]; + + if (child.type === 'comma' && node.type === 'brace') { + if (i === 1) queue.push(''); + queue.push(''); + continue; + } + + if (child.type === 'close') { + q.push(append(q.pop(), queue, enclose)); + continue; + } + + if (child.value && child.type !== 'open') { + queue.push(append(queue.pop(), child.value)); + continue; + } + + if (child.nodes) { + walk(child, node); + } + } + + return queue; + }; + + return utils.flatten(walk(ast)); +}; + +module.exports = expand; diff --git a/node_modules/braces/lib/parse.js b/node_modules/braces/lib/parse.js new file mode 100644 index 00000000..3a6988e6 --- /dev/null +++ b/node_modules/braces/lib/parse.js @@ -0,0 +1,331 @@ +'use strict'; + +const stringify = require('./stringify'); + +/** + * Constants + */ + +const { + MAX_LENGTH, + CHAR_BACKSLASH, /* \ */ + CHAR_BACKTICK, /* ` */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_RIGHT_SQUARE_BRACKET, /* ] */ + CHAR_DOUBLE_QUOTE, /* " */ + CHAR_SINGLE_QUOTE, /* ' */ + CHAR_NO_BREAK_SPACE, + CHAR_ZERO_WIDTH_NOBREAK_SPACE +} = require('./constants'); + +/** + * parse + */ + +const parse = (input, options = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + const opts = options || {}; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + if (input.length > max) { + throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); + } + + const ast = { type: 'root', input, nodes: [] }; + const stack = [ast]; + let block = ast; + let prev = ast; + let brackets = 0; + const length = input.length; + let index = 0; + let depth = 0; + let value; + + /** + * Helpers + */ + + const advance = () => input[index++]; + const push = node => { + if (node.type === 'text' && prev.type === 'dot') { + prev.type = 'text'; + } + + if (prev && prev.type === 'text' && node.type === 'text') { + prev.value += node.value; + return; + } + + block.nodes.push(node); + node.parent = block; + node.prev = prev; + prev = node; + return node; + }; + + push({ type: 'bos' }); + + while (index < length) { + block = stack[stack.length - 1]; + value = advance(); + + /** + * Invalid chars + */ + + if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { + continue; + } + + /** + * Escaped chars + */ + + if (value === CHAR_BACKSLASH) { + push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); + continue; + } + + /** + * Right square bracket (literal): ']' + */ + + if (value === CHAR_RIGHT_SQUARE_BRACKET) { + push({ type: 'text', value: '\\' + value }); + continue; + } + + /** + * Left square bracket: '[' + */ + + if (value === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + + let next; + + while (index < length && (next = advance())) { + value += next; + + if (next === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + continue; + } + + if (next === CHAR_BACKSLASH) { + value += advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + brackets--; + + if (brackets === 0) { + break; + } + } + } + + push({ type: 'text', value }); + continue; + } + + /** + * Parentheses + */ + + if (value === CHAR_LEFT_PARENTHESES) { + block = push({ type: 'paren', nodes: [] }); + stack.push(block); + push({ type: 'text', value }); + continue; + } + + if (value === CHAR_RIGHT_PARENTHESES) { + if (block.type !== 'paren') { + push({ type: 'text', value }); + continue; + } + block = stack.pop(); + push({ type: 'text', value }); + block = stack[stack.length - 1]; + continue; + } + + /** + * Quotes: '|"|` + */ + + if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { + const open = value; + let next; + + if (options.keepQuotes !== true) { + value = ''; + } + + while (index < length && (next = advance())) { + if (next === CHAR_BACKSLASH) { + value += next + advance(); + continue; + } + + if (next === open) { + if (options.keepQuotes === true) value += next; + break; + } + + value += next; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Left curly brace: '{' + */ + + if (value === CHAR_LEFT_CURLY_BRACE) { + depth++; + + const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; + const brace = { + type: 'brace', + open: true, + close: false, + dollar, + depth, + commas: 0, + ranges: 0, + nodes: [] + }; + + block = push(brace); + stack.push(block); + push({ type: 'open', value }); + continue; + } + + /** + * Right curly brace: '}' + */ + + if (value === CHAR_RIGHT_CURLY_BRACE) { + if (block.type !== 'brace') { + push({ type: 'text', value }); + continue; + } + + const type = 'close'; + block = stack.pop(); + block.close = true; + + push({ type, value }); + depth--; + + block = stack[stack.length - 1]; + continue; + } + + /** + * Comma: ',' + */ + + if (value === CHAR_COMMA && depth > 0) { + if (block.ranges > 0) { + block.ranges = 0; + const open = block.nodes.shift(); + block.nodes = [open, { type: 'text', value: stringify(block) }]; + } + + push({ type: 'comma', value }); + block.commas++; + continue; + } + + /** + * Dot: '.' + */ + + if (value === CHAR_DOT && depth > 0 && block.commas === 0) { + const siblings = block.nodes; + + if (depth === 0 || siblings.length === 0) { + push({ type: 'text', value }); + continue; + } + + if (prev.type === 'dot') { + block.range = []; + prev.value += value; + prev.type = 'range'; + + if (block.nodes.length !== 3 && block.nodes.length !== 5) { + block.invalid = true; + block.ranges = 0; + prev.type = 'text'; + continue; + } + + block.ranges++; + block.args = []; + continue; + } + + if (prev.type === 'range') { + siblings.pop(); + + const before = siblings[siblings.length - 1]; + before.value += prev.value + value; + prev = before; + block.ranges--; + continue; + } + + push({ type: 'dot', value }); + continue; + } + + /** + * Text + */ + + push({ type: 'text', value }); + } + + // Mark imbalanced braces and brackets as invalid + do { + block = stack.pop(); + + if (block.type !== 'root') { + block.nodes.forEach(node => { + if (!node.nodes) { + if (node.type === 'open') node.isOpen = true; + if (node.type === 'close') node.isClose = true; + if (!node.nodes) node.type = 'text'; + node.invalid = true; + } + }); + + // get the location of the block on parent.nodes (block's siblings) + const parent = stack[stack.length - 1]; + const index = parent.nodes.indexOf(block); + // replace the (invalid) block with it's nodes + parent.nodes.splice(index, 1, ...block.nodes); + } + } while (stack.length > 0); + + push({ type: 'eos' }); + return ast; +}; + +module.exports = parse; diff --git a/node_modules/braces/lib/stringify.js b/node_modules/braces/lib/stringify.js new file mode 100644 index 00000000..8bcf872c --- /dev/null +++ b/node_modules/braces/lib/stringify.js @@ -0,0 +1,32 @@ +'use strict'; + +const utils = require('./utils'); + +module.exports = (ast, options = {}) => { + const stringify = (node, parent = {}) => { + const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); + const invalidNode = node.invalid === true && options.escapeInvalid === true; + let output = ''; + + if (node.value) { + if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { + return '\\' + node.value; + } + return node.value; + } + + if (node.value) { + return node.value; + } + + if (node.nodes) { + for (const child of node.nodes) { + output += stringify(child); + } + } + return output; + }; + + return stringify(ast); +}; + diff --git a/node_modules/braces/lib/utils.js b/node_modules/braces/lib/utils.js new file mode 100644 index 00000000..d19311fe --- /dev/null +++ b/node_modules/braces/lib/utils.js @@ -0,0 +1,122 @@ +'use strict'; + +exports.isInteger = num => { + if (typeof num === 'number') { + return Number.isInteger(num); + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isInteger(Number(num)); + } + return false; +}; + +/** + * Find a node of the given type + */ + +exports.find = (node, type) => node.nodes.find(node => node.type === type); + +/** + * Find a node of the given type + */ + +exports.exceedsLimit = (min, max, step = 1, limit) => { + if (limit === false) return false; + if (!exports.isInteger(min) || !exports.isInteger(max)) return false; + return ((Number(max) - Number(min)) / Number(step)) >= limit; +}; + +/** + * Escape the given node with '\\' before node.value + */ + +exports.escapeNode = (block, n = 0, type) => { + const node = block.nodes[n]; + if (!node) return; + + if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { + if (node.escaped !== true) { + node.value = '\\' + node.value; + node.escaped = true; + } + } +}; + +/** + * Returns true if the given brace node should be enclosed in literal braces + */ + +exports.encloseBrace = node => { + if (node.type !== 'brace') return false; + if ((node.commas >> 0 + node.ranges >> 0) === 0) { + node.invalid = true; + return true; + } + return false; +}; + +/** + * Returns true if a brace node is invalid. + */ + +exports.isInvalidBrace = block => { + if (block.type !== 'brace') return false; + if (block.invalid === true || block.dollar) return true; + if ((block.commas >> 0 + block.ranges >> 0) === 0) { + block.invalid = true; + return true; + } + if (block.open !== true || block.close !== true) { + block.invalid = true; + return true; + } + return false; +}; + +/** + * Returns true if a node is an open or close node + */ + +exports.isOpenOrClose = node => { + if (node.type === 'open' || node.type === 'close') { + return true; + } + return node.open === true || node.close === true; +}; + +/** + * Reduce an array of text nodes. + */ + +exports.reduce = nodes => nodes.reduce((acc, node) => { + if (node.type === 'text') acc.push(node.value); + if (node.type === 'range') node.type = 'text'; + return acc; +}, []); + +/** + * Flatten an array + */ + +exports.flatten = (...args) => { + const result = []; + + const flat = arr => { + for (let i = 0; i < arr.length; i++) { + const ele = arr[i]; + + if (Array.isArray(ele)) { + flat(ele); + continue; + } + + if (ele !== undefined) { + result.push(ele); + } + } + return result; + }; + + flat(args); + return result; +}; diff --git a/node_modules/braces/package.json b/node_modules/braces/package.json new file mode 100644 index 00000000..c3c056e4 --- /dev/null +++ b/node_modules/braces/package.json @@ -0,0 +1,77 @@ +{ + "name": "braces", + "description": "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.", + "version": "3.0.3", + "homepage": "https://github.com/micromatch/braces", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Brian Woodward (https://twitter.com/doowb)", + "Elan Shanker (https://github.com/es128)", + "Eugene Sharygin (https://github.com/eush77)", + "hemanth.hm (http://h3manth.com)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)" + ], + "repository": "micromatch/braces", + "bugs": { + "url": "https://github.com/micromatch/braces/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "lib" + ], + "main": "index.js", + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "mocha", + "benchmark": "node benchmark" + }, + "dependencies": { + "fill-range": "^7.1.1" + }, + "devDependencies": { + "ansi-colors": "^3.2.4", + "bash-path": "^2.0.1", + "gulp-format-md": "^2.0.0", + "mocha": "^6.1.1" + }, + "keywords": [ + "alpha", + "alphabetical", + "bash", + "brace", + "braces", + "expand", + "expansion", + "filepath", + "fill", + "fs", + "glob", + "globbing", + "letter", + "match", + "matches", + "matching", + "number", + "numerical", + "path", + "range", + "ranges", + "sh" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "lint": { + "reflinks": true + }, + "plugins": [ + "gulp-format-md" + ] + } +} diff --git a/node_modules/camelcase-css/README.md b/node_modules/camelcase-css/README.md new file mode 100644 index 00000000..caaa817f --- /dev/null +++ b/node_modules/camelcase-css/README.md @@ -0,0 +1,27 @@ +# camelcase-css [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] + +> Convert a kebab-cased CSS property into a camelCased DOM property. + + +## Installation +[Node.js](http://nodejs.org/) `>= 6` is required. Type this at the command line: +```shell +npm install camelcase-css +``` + + +## Usage +```js +const camelCaseCSS = require('camelcase-css'); + +camelCaseCSS('-webkit-border-radius'); //-> WebkitBorderRadius +camelCaseCSS('-moz-border-radius'); //-> MozBorderRadius +camelCaseCSS('-ms-border-radius'); //-> msBorderRadius +camelCaseCSS('border-radius'); //-> borderRadius +``` + + +[npm-image]: https://img.shields.io/npm/v/camelcase-css.svg +[npm-url]: https://npmjs.org/package/camelcase-css +[travis-image]: https://img.shields.io/travis/stevenvachon/camelcase-css.svg +[travis-url]: https://travis-ci.org/stevenvachon/camelcase-css diff --git a/node_modules/camelcase-css/index-es5.js b/node_modules/camelcase-css/index-es5.js new file mode 100644 index 00000000..48ef0781 --- /dev/null +++ b/node_modules/camelcase-css/index-es5.js @@ -0,0 +1,24 @@ +"use strict"; + +var pattern = /-(\w|$)/g; + +var callback = function callback(dashChar, char) { + return char.toUpperCase(); +}; + +var camelCaseCSS = function camelCaseCSS(property) { + property = property.toLowerCase(); + + // NOTE :: IE8's "styleFloat" is intentionally not supported + if (property === "float") { + return "cssFloat"; + } + // Microsoft vendor-prefixes are uniquely cased + else if (property.charCodeAt(0) === 45&& property.charCodeAt(1) === 109&& property.charCodeAt(2) === 115&& property.charCodeAt(3) === 45) { + return property.substr(1).replace(pattern, callback); + } else { + return property.replace(pattern, callback); + } +}; + +module.exports = camelCaseCSS; diff --git a/node_modules/camelcase-css/index.js b/node_modules/camelcase-css/index.js new file mode 100644 index 00000000..c9d1f1b6 --- /dev/null +++ b/node_modules/camelcase-css/index.js @@ -0,0 +1,30 @@ +"use strict"; +const pattern = /-(\w|$)/g; + +const callback = (dashChar, char) => char.toUpperCase(); + + + +const camelCaseCSS = property => +{ + property = property.toLowerCase(); + + // NOTE :: IE8's "styleFloat" is intentionally not supported + if (property === "float") + { + return "cssFloat"; + } + // Microsoft vendor-prefixes are uniquely cased + else if (property.startsWith("-ms-")) + { + return property.substr(1).replace(pattern, callback); + } + else + { + return property.replace(pattern, callback); + } +}; + + + +module.exports = camelCaseCSS; diff --git a/node_modules/camelcase-css/license b/node_modules/camelcase-css/license new file mode 100644 index 00000000..b760007a --- /dev/null +++ b/node_modules/camelcase-css/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Steven Vachon (svachon.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/camelcase-css/package.json b/node_modules/camelcase-css/package.json new file mode 100644 index 00000000..61dc51a8 --- /dev/null +++ b/node_modules/camelcase-css/package.json @@ -0,0 +1,34 @@ +{ + "name": "camelcase-css", + "description": "Convert a kebab-cased CSS property into a camelCased DOM property.", + "version": "2.0.1", + "license": "MIT", + "author": "Steven Vachon (https://www.svachon.com/)", + "repository": "stevenvachon/camelcase-css", + "browser": "index-es5.js", + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-core": "^6.26.3", + "babel-plugin-optimize-starts-with": "^1.0.1", + "babel-preset-env": "^1.7.0", + "chai": "^4.1.2", + "mocha": "^5.2.0" + }, + "engines": { + "node": ">= 6" + }, + "scripts": { + "pretest": "babel index.js --out-file=index-es5.js --presets=env --plugins=optimize-starts-with", + "test": "mocha test.js --check-leaks --bail" + }, + "files": [ + "index.js", + "index-es5.js" + ], + "keywords": [ + "camelcase", + "case", + "css", + "dom" + ] +} diff --git a/node_modules/color-convert/CHANGELOG.md b/node_modules/color-convert/CHANGELOG.md new file mode 100644 index 00000000..0a7bce4f --- /dev/null +++ b/node_modules/color-convert/CHANGELOG.md @@ -0,0 +1,54 @@ +# 1.0.0 - 2016-01-07 + +- Removed: unused speed test +- Added: Automatic routing between previously unsupported conversions +([#27](https://github.com/Qix-/color-convert/pull/27)) +- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions +([#27](https://github.com/Qix-/color-convert/pull/27)) +- Removed: `convert()` class +([#27](https://github.com/Qix-/color-convert/pull/27)) +- Changed: all functions to lookup dictionary +([#27](https://github.com/Qix-/color-convert/pull/27)) +- Changed: `ansi` to `ansi256` +([#27](https://github.com/Qix-/color-convert/pull/27)) +- Fixed: argument grouping for functions requiring only one argument +([#27](https://github.com/Qix-/color-convert/pull/27)) + +# 0.6.0 - 2015-07-23 + +- Added: methods to handle +[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors: + - rgb2ansi16 + - rgb2ansi + - hsl2ansi16 + - hsl2ansi + - hsv2ansi16 + - hsv2ansi + - hwb2ansi16 + - hwb2ansi + - cmyk2ansi16 + - cmyk2ansi + - keyword2ansi16 + - keyword2ansi + - ansi162rgb + - ansi162hsl + - ansi162hsv + - ansi162hwb + - ansi162cmyk + - ansi162keyword + - ansi2rgb + - ansi2hsl + - ansi2hsv + - ansi2hwb + - ansi2cmyk + - ansi2keyword +([#18](https://github.com/harthur/color-convert/pull/18)) + +# 0.5.3 - 2015-06-02 + +- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]` +([#15](https://github.com/harthur/color-convert/issues/15)) + +--- + +Check out commit logs for older releases diff --git a/node_modules/color-convert/LICENSE b/node_modules/color-convert/LICENSE new file mode 100644 index 00000000..5b4c386f --- /dev/null +++ b/node_modules/color-convert/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2011-2016 Heather Arthur + +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/color-convert/README.md b/node_modules/color-convert/README.md new file mode 100644 index 00000000..d4b08fc3 --- /dev/null +++ b/node_modules/color-convert/README.md @@ -0,0 +1,68 @@ +# color-convert + +[![Build Status](https://travis-ci.org/Qix-/color-convert.svg?branch=master)](https://travis-ci.org/Qix-/color-convert) + +Color-convert is a color conversion library for JavaScript and node. +It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest): + +```js +var convert = require('color-convert'); + +convert.rgb.hsl(140, 200, 100); // [96, 48, 59] +convert.keyword.rgb('blue'); // [0, 0, 255] + +var rgbChannels = convert.rgb.channels; // 3 +var cmykChannels = convert.cmyk.channels; // 4 +var ansiChannels = convert.ansi16.channels; // 1 +``` + +# Install + +```console +$ npm install color-convert +``` + +# API + +Simply get the property of the _from_ and _to_ conversion that you're looking for. + +All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function. + +All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha). + +```js +var convert = require('color-convert'); + +// Hex to LAB +convert.hex.lab('DEADBF'); // [ 76, 21, -2 ] +convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ] + +// RGB to CMYK +convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ] +convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ] +``` + +### Arrays +All functions that accept multiple arguments also support passing an array. + +Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.) + +```js +var convert = require('color-convert'); + +convert.rgb.hex(123, 45, 67); // '7B2D43' +convert.rgb.hex([123, 45, 67]); // '7B2D43' +``` + +## Routing + +Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex). + +Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js). + +# Contribute + +If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request. + +# License +Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE). diff --git a/node_modules/color-convert/conversions.js b/node_modules/color-convert/conversions.js new file mode 100644 index 00000000..2657f265 --- /dev/null +++ b/node_modules/color-convert/conversions.js @@ -0,0 +1,839 @@ +/* MIT license */ +/* eslint-disable no-mixed-operators */ +const cssKeywords = require('color-name'); + +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) + +const reverseKeywords = {}; +for (const key of Object.keys(cssKeywords)) { + reverseKeywords[cssKeywords[key]] = key; +} + +const convert = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} +}; + +module.exports = convert; + +// Hide .channels and .labels properties +for (const model of Object.keys(convert)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } + + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } + + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } + + const {channels, labels} = convert[model]; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); +} + +convert.rgb.hsl = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const delta = max - min; + let h; + let s; + + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } + + h = Math.min(h * 60, 360); + + if (h < 0) { + h += 360; + } + + const l = (min + max) / 2; + + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } + + return [h, s * 100, l * 100]; +}; + +convert.rgb.hsv = function (rgb) { + let rdif; + let gdif; + let bdif; + let h; + let s; + + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const v = Math.max(r, g, b); + const diff = v - Math.min(r, g, b); + const diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; + + if (diff === 0) { + h = 0; + s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } + + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } + + return [ + h * 360, + s * 100, + v * 100 + ]; +}; + +convert.rgb.hwb = function (rgb) { + const r = rgb[0]; + const g = rgb[1]; + let b = rgb[2]; + const h = convert.rgb.hsl(rgb)[0]; + const w = 1 / 255 * Math.min(r, Math.min(g, b)); + + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); + + return [h, w * 100, b * 100]; +}; + +convert.rgb.cmyk = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + + const k = Math.min(1 - r, 1 - g, 1 - b); + const c = (1 - r - k) / (1 - k) || 0; + const m = (1 - g - k) / (1 - k) || 0; + const y = (1 - b - k) / (1 - k) || 0; + + return [c * 100, m * 100, y * 100, k * 100]; +}; + +function comparativeDistance(x, y) { + /* + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + */ + return ( + ((x[0] - y[0]) ** 2) + + ((x[1] - y[1]) ** 2) + + ((x[2] - y[2]) ** 2) + ); +} + +convert.rgb.keyword = function (rgb) { + const reversed = reverseKeywords[rgb]; + if (reversed) { + return reversed; + } + + let currentClosestDistance = Infinity; + let currentClosestKeyword; + + for (const keyword of Object.keys(cssKeywords)) { + const value = cssKeywords[keyword]; + + // Compute comparative distance + const distance = comparativeDistance(rgb, value); + + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + + return currentClosestKeyword; +}; + +convert.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; +}; + +convert.rgb.xyz = function (rgb) { + let r = rgb[0] / 255; + let g = rgb[1] / 255; + let b = rgb[2] / 255; + + // Assume sRGB + r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); + g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); + b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); + + const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + + return [x * 100, y * 100, z * 100]; +}; + +convert.rgb.lab = function (rgb) { + const xyz = convert.rgb.xyz(rgb); + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + return [l, a, b]; +}; + +convert.hsl.rgb = function (hsl) { + const h = hsl[0] / 360; + const s = hsl[1] / 100; + const l = hsl[2] / 100; + let t2; + let t3; + let val; + + if (s === 0) { + val = l * 255; + return [val, val, val]; + } + + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } + + const t1 = 2 * l - t2; + + const rgb = [0, 0, 0]; + for (let i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; + } + + if (t3 > 1) { + t3--; + } + + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } + + rgb[i] = val * 255; + } + + return rgb; +}; + +convert.hsl.hsv = function (hsl) { + const h = hsl[0]; + let s = hsl[1] / 100; + let l = hsl[2] / 100; + let smin = s; + const lmin = Math.max(l, 0.01); + + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + const v = (l + s) / 2; + const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); + + return [h, sv * 100, v * 100]; +}; + +convert.hsv.rgb = function (hsv) { + const h = hsv[0] / 60; + const s = hsv[1] / 100; + let v = hsv[2] / 100; + const hi = Math.floor(h) % 6; + + const f = h - Math.floor(h); + const p = 255 * v * (1 - s); + const q = 255 * v * (1 - (s * f)); + const t = 255 * v * (1 - (s * (1 - f))); + v *= 255; + + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +}; + +convert.hsv.hsl = function (hsv) { + const h = hsv[0]; + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const vmin = Math.max(v, 0.01); + let sl; + let l; + + l = (2 - s) * v; + const lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; + + return [h, sl * 100, l * 100]; +}; + +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert.hwb.rgb = function (hwb) { + const h = hwb[0] / 360; + let wh = hwb[1] / 100; + let bl = hwb[2] / 100; + const ratio = wh + bl; + let f; + + // Wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } + + const i = Math.floor(6 * h); + const v = 1 - bl; + f = 6 * h - i; + + if ((i & 0x01) !== 0) { + f = 1 - f; + } + + const n = wh + f * (v - wh); // Linear interpolation + + let r; + let g; + let b; + /* eslint-disable max-statements-per-line,no-multi-spaces */ + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } + /* eslint-enable max-statements-per-line,no-multi-spaces */ + + return [r * 255, g * 255, b * 255]; +}; + +convert.cmyk.rgb = function (cmyk) { + const c = cmyk[0] / 100; + const m = cmyk[1] / 100; + const y = cmyk[2] / 100; + const k = cmyk[3] / 100; + + const r = 1 - Math.min(1, c * (1 - k) + k); + const g = 1 - Math.min(1, m * (1 - k) + k); + const b = 1 - Math.min(1, y * (1 - k) + k); + + return [r * 255, g * 255, b * 255]; +}; + +convert.xyz.rgb = function (xyz) { + const x = xyz[0] / 100; + const y = xyz[1] / 100; + const z = xyz[2] / 100; + let r; + let g; + let b; + + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); + + // Assume sRGB + r = r > 0.0031308 + ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) + : r * 12.92; + + g = g > 0.0031308 + ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) + : g * 12.92; + + b = b > 0.0031308 + ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) + : b * 12.92; + + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + + return [r * 255, g * 255, b * 255]; +}; + +convert.xyz.lab = function (xyz) { + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + return [l, a, b]; +}; + +convert.lab.xyz = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let x; + let y; + let z; + + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; + + const y2 = y ** 3; + const x2 = x ** 3; + const z2 = z ** 3; + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; + + x *= 95.047; + y *= 100; + z *= 108.883; + + return [x, y, z]; +}; + +convert.lab.lch = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let h; + + const hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; + + if (h < 0) { + h += 360; + } + + const c = Math.sqrt(a * a + b * b); + + return [l, c, h]; +}; + +convert.lch.lab = function (lch) { + const l = lch[0]; + const c = lch[1]; + const h = lch[2]; + + const hr = h / 360 * 2 * Math.PI; + const a = c * Math.cos(hr); + const b = c * Math.sin(hr); + + return [l, a, b]; +}; + +convert.rgb.ansi16 = function (args, saturation = null) { + const [r, g, b] = args; + let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization + + value = Math.round(value / 50); + + if (value === 0) { + return 30; + } + + let ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); + + if (value === 2) { + ansi += 60; + } + + return ansi; +}; + +convert.hsv.ansi16 = function (args) { + // Optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); +}; + +convert.rgb.ansi256 = function (args) { + const r = args[0]; + const g = args[1]; + const b = args[2]; + + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } + + if (r > 248) { + return 231; + } + + return Math.round(((r - 8) / 247) * 24) + 232; + } + + const ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); + + return ansi; +}; + +convert.ansi16.rgb = function (args) { + let color = args % 10; + + // Handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } + + color = color / 10.5 * 255; + + return [color, color, color]; + } + + const mult = (~~(args > 50) + 1) * 0.5; + const r = ((color & 1) * mult) * 255; + const g = (((color >> 1) & 1) * mult) * 255; + const b = (((color >> 2) & 1) * mult) * 255; + + return [r, g, b]; +}; + +convert.ansi256.rgb = function (args) { + // Handle greyscale + if (args >= 232) { + const c = (args - 232) * 10 + 8; + return [c, c, c]; + } + + args -= 16; + + let rem; + const r = Math.floor(args / 36) / 5 * 255; + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; + const b = (rem % 6) / 5 * 255; + + return [r, g, b]; +}; + +convert.rgb.hex = function (args) { + const integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); + + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert.hex.rgb = function (args) { + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } + + let colorString = match[0]; + + if (match[0].length === 3) { + colorString = colorString.split('').map(char => { + return char + char; + }).join(''); + } + + const integer = parseInt(colorString, 16); + const r = (integer >> 16) & 0xFF; + const g = (integer >> 8) & 0xFF; + const b = integer & 0xFF; + + return [r, g, b]; +}; + +convert.rgb.hcg = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const max = Math.max(Math.max(r, g), b); + const min = Math.min(Math.min(r, g), b); + const chroma = (max - min); + let grayscale; + let hue; + + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } + + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma; + } + + hue /= 6; + hue %= 1; + + return [hue * 360, chroma * 100, grayscale * 100]; +}; + +convert.hsl.hcg = function (hsl) { + const s = hsl[1] / 100; + const l = hsl[2] / 100; + + const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); + + let f = 0; + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } + + return [hsl[0], c * 100, f * 100]; +}; + +convert.hsv.hcg = function (hsv) { + const s = hsv[1] / 100; + const v = hsv[2] / 100; + + const c = s * v; + let f = 0; + + if (c < 1.0) { + f = (v - c) / (1 - c); + } + + return [hsv[0], c * 100, f * 100]; +}; + +convert.hcg.rgb = function (hcg) { + const h = hcg[0] / 360; + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } + + const pure = [0, 0, 0]; + const hi = (h % 1) * 6; + const v = hi % 1; + const w = 1 - v; + let mg = 0; + + /* eslint-disable max-statements-per-line */ + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; + } + /* eslint-enable max-statements-per-line */ + + mg = (1.0 - c) * g; + + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; +}; + +convert.hcg.hsv = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + const v = c + g * (1.0 - c); + let f = 0; + + if (v > 0.0) { + f = c / v; + } + + return [hcg[0], f * 100, v * 100]; +}; + +convert.hcg.hsl = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + const l = g * (1.0 - c) + 0.5 * c; + let s = 0; + + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } + + return [hcg[0], s * 100, l * 100]; +}; + +convert.hcg.hwb = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; + +convert.hwb.hcg = function (hwb) { + const w = hwb[1] / 100; + const b = hwb[2] / 100; + const v = 1 - b; + const c = v - w; + let g = 0; + + if (c < 1) { + g = (v - c) / (1 - c); + } + + return [hwb[0], c * 100, g * 100]; +}; + +convert.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +}; + +convert.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; + +convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; + +convert.gray.hsl = function (args) { + return [0, 0, args[0]]; +}; + +convert.gray.hsv = convert.gray.hsl; + +convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; + +convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; + +convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; +}; + +convert.gray.hex = function (gray) { + const val = Math.round(gray[0] / 100 * 255) & 0xFF; + const integer = (val << 16) + (val << 8) + val; + + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert.rgb.gray = function (rgb) { + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; diff --git a/node_modules/color-convert/index.js b/node_modules/color-convert/index.js new file mode 100644 index 00000000..b648e573 --- /dev/null +++ b/node_modules/color-convert/index.js @@ -0,0 +1,81 @@ +const conversions = require('./conversions'); +const route = require('./route'); + +const convert = {}; + +const models = Object.keys(conversions); + +function wrapRaw(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + return fn(args); + }; + + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +function wrapRounded(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + const result = fn(args); + + // We're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (let len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } + + return result; + }; + + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +models.forEach(fromModel => { + convert[fromModel] = {}; + + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); + + const routes = route(fromModel); + const routeModels = Object.keys(routes); + + routeModels.forEach(toModel => { + const fn = routes[toModel]; + + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); +}); + +module.exports = convert; diff --git a/node_modules/color-convert/package.json b/node_modules/color-convert/package.json new file mode 100644 index 00000000..6e48000c --- /dev/null +++ b/node_modules/color-convert/package.json @@ -0,0 +1,48 @@ +{ + "name": "color-convert", + "description": "Plain color conversion functions", + "version": "2.0.1", + "author": "Heather Arthur ", + "license": "MIT", + "repository": "Qix-/color-convert", + "scripts": { + "pretest": "xo", + "test": "node test/basic.js" + }, + "engines": { + "node": ">=7.0.0" + }, + "keywords": [ + "color", + "colour", + "convert", + "converter", + "conversion", + "rgb", + "hsl", + "hsv", + "hwb", + "cmyk", + "ansi", + "ansi16" + ], + "files": [ + "index.js", + "conversions.js", + "route.js" + ], + "xo": { + "rules": { + "default-case": 0, + "no-inline-comments": 0, + "operator-linebreak": 0 + } + }, + "devDependencies": { + "chalk": "^2.4.2", + "xo": "^0.24.0" + }, + "dependencies": { + "color-name": "~1.1.4" + } +} diff --git a/node_modules/color-convert/route.js b/node_modules/color-convert/route.js new file mode 100644 index 00000000..1a08521b --- /dev/null +++ b/node_modules/color-convert/route.js @@ -0,0 +1,97 @@ +const conversions = require('./conversions'); + +/* + This function routes a model to all other models. + + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). + + conversions that are not possible simply are not included. +*/ + +function buildGraph() { + const graph = {}; + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + const models = Object.keys(conversions); + + for (let len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } + + return graph; +} + +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS(fromModel) { + const graph = buildGraph(); + const queue = [fromModel]; // Unshift -> queue -> pop + + graph[fromModel].distance = 0; + + while (queue.length) { + const current = queue.pop(); + const adjacents = Object.keys(conversions[current]); + + for (let len = adjacents.length, i = 0; i < len; i++) { + const adjacent = adjacents[i]; + const node = graph[adjacent]; + + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } + + return graph; +} + +function link(from, to) { + return function (args) { + return to(from(args)); + }; +} + +function wrapConversion(toModel, graph) { + const path = [graph[toModel].parent, toModel]; + let fn = conversions[graph[toModel].parent][toModel]; + + let cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } + + fn.conversion = path; + return fn; +} + +module.exports = function (fromModel) { + const graph = deriveBFS(fromModel); + const conversion = {}; + + const models = Object.keys(graph); + for (let len = models.length, i = 0; i < len; i++) { + const toModel = models[i]; + const node = graph[toModel]; + + if (node.parent === null) { + // No possible conversion, or this node is the source model. + continue; + } + + conversion[toModel] = wrapConversion(toModel, graph); + } + + return conversion; +}; + diff --git a/node_modules/color-name/LICENSE b/node_modules/color-name/LICENSE new file mode 100644 index 00000000..c6b10012 --- /dev/null +++ b/node_modules/color-name/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2015 Dmitry Ivanov + +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. \ No newline at end of file diff --git a/node_modules/color-name/README.md b/node_modules/color-name/README.md new file mode 100644 index 00000000..932b9791 --- /dev/null +++ b/node_modules/color-name/README.md @@ -0,0 +1,11 @@ +A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors. + +[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/) + + +```js +var colors = require('color-name'); +colors.red //[255,0,0] +``` + +
diff --git a/node_modules/color-name/index.js b/node_modules/color-name/index.js new file mode 100644 index 00000000..b7c198a6 --- /dev/null +++ b/node_modules/color-name/index.js @@ -0,0 +1,152 @@ +'use strict' + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; diff --git a/node_modules/color-name/package.json b/node_modules/color-name/package.json new file mode 100644 index 00000000..782dd828 --- /dev/null +++ b/node_modules/color-name/package.json @@ -0,0 +1,28 @@ +{ + "name": "color-name", + "version": "1.1.4", + "description": "A list of color names and its values", + "main": "index.js", + "files": [ + "index.js" + ], + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:colorjs/color-name.git" + }, + "keywords": [ + "color-name", + "color", + "color-keyword", + "keyword" + ], + "author": "DY ", + "license": "MIT", + "bugs": { + "url": "https://github.com/colorjs/color-name/issues" + }, + "homepage": "https://github.com/colorjs/color-name" +} diff --git a/node_modules/commander/CHANGELOG.md b/node_modules/commander/CHANGELOG.md new file mode 100644 index 00000000..f00cb2b5 --- /dev/null +++ b/node_modules/commander/CHANGELOG.md @@ -0,0 +1,436 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). (Format adopted after v3.0.0.) + + + +## [4.1.1] (2020-02-02) + +### Fixed + +* TypeScript definition for `.action()` should include Promise for async ([#1157]) + +## [4.1.0] (2020-01-06) + +### Added + +* two routines to change how option values are handled, and eliminate name clashes with command properties ([#933] [#1102]) + * see storeOptionsAsProperties and passCommandToAction in README +* `.parseAsync` to use instead of `.parse` if supply async action handlers ([#806] [#1118]) + +### Fixed + +* Remove trailing blanks from wrapped help text ([#1096]) + +### Changed + +* update dependencies +* extend security coverage for Commander 2.x to 2020-02-03 +* improvements to README +* improvements to TypeScript definition documentation +* move old versions out of main CHANGELOG +* removed explicit use of `ts-node` in tests + +## [4.0.1] (2019-11-12) + +### Fixed + +* display help when requested, even if there are missing required options ([#1091]) + +## [4.0.0] (2019-11-02) + +### Added + +* automatically wrap and indent help descriptions for options and commands ([#1051]) +* `.exitOverride()` allows override of calls to `process.exit` for additional error handling and to keep program running ([#1040]) +* support for declaring required options with `.requiredOptions()` ([#1071]) +* GitHub Actions support ([#1027]) +* translation links in README + +### Changed + +* dev: switch tests from Sinon+Should to Jest with major rewrite of tests ([#1035]) +* call default subcommand even when there are unknown options ([#1047]) +* *Breaking* Commander is only officially supported on Node 8 and above, and requires Node 6 ([#1053]) + +### Fixed + +* *Breaking* keep command object out of program.args when action handler called ([#1048]) + * also, action handler now passed array of unknown arguments +* complain about unknown options when program argument supplied and action handler ([#1049]) + * this changes parameters to `command:*` event to include unknown arguments +* removed deprecated `customFds` option from call to `child_process.spawn` ([#1052]) +* rework TypeScript declarations to bring all types into imported namespace ([#1081]) + +### Migration Tips + +#### Testing for no arguments + +If you were previously using code like: + +```js +if (!program.args.length) ... +``` + +a partial replacement is: + +```js +if (program.rawArgs.length < 3) ... +``` + +## [4.0.0-1] Prerelease (2019-10-08) + +(Released in 4.0.0) + +## [4.0.0-0] Prerelease (2019-10-01) + +(Released in 4.0.0) + +## [2.20.1] (2019-09-29) + +### Fixed + +* Improve tracking of executable subcommands. + +### Changed + +* update development dependencies + +## [3.0.2] (2019-09-27) + +### Fixed + +* Improve tracking of executable subcommands. + +### Changed + +* update development dependencies + +## [3.0.1] (2019-08-30) + +### Added + +* .name and .usage to README ([#1010]) +* Table of Contents to README ([#1010]) +* TypeScript definition for `executableFile` in CommandOptions ([#1028]) + +### Changed + +* consistently use `const` rather than `var` in README ([#1026]) + +### Fixed + +* help for sub commands with custom executableFile ([#1018]) + +## [3.0.0] / 2019-08-08 + +* Add option to specify executable file name ([#999]) + * e.g. `.command('clone', 'clone description', { executableFile: 'myClone' })` +* Change docs for `.command` to contrast action handler vs git-style executable. ([#938] [#990]) +* **Breaking** Change TypeScript to use overloaded function for `.command`. ([#938] [#990]) +* Change to use straight quotes around strings in error messages (like 'this' instead of `this') ([#915]) +* Add TypeScript "reference types" for node ([#974]) +* Add support for hyphen as an option argument in subcommands ([#697]) +* Add support for a short option flag and its value to be concatenated for action handler subcommands ([#599]) + * e.g. `-p 80` can also be supplied as `-p80` +* Add executable arguments to spawn in win32, for git-style executables ([#611]) + * e.g. `node --harmony myCommand.js clone` +* Add parent command as prefix of subcommand in help ([#980]) +* Add optional custom description to `.version` ([#963]) + * e.g. `program.version('0.0.1', '-v, --vers', 'output the current version')` +* Add `.helpOption(flags, description)` routine to customise help flags and description ([#963]) + * e.g. `.helpOption('-e, --HELP', 'read more information')` +* Fix behavior of --no-* options ([#795]) + * can now define both `--foo` and `--no-foo` + * **Breaking** custom event listeners: `--no-foo` on cli now emits `option:no-foo` (previously `option:foo`) + * **Breaking** default value: defining `--no-foo` after defining `--foo` leaves the default value unchanged (previously set it to false) + * allow boolean default value, such as from environment ([#987]) +* Increment inspector port for spawned subcommands ([#991]) + * e.g. `node --inspect myCommand.js clone` + +### Migration Tips + +The custom event for a negated option like `--no-foo` is `option:no-foo` (previously `option:foo`). + +```js +program + .option('--no-foo') + .on('option:no-foo', () => { + console.log('removing foo'); + }); +``` + +When using TypeScript, adding a command does not allow an explicit `undefined` for an unwanted executable description (e.g +for a command with an action handler). + +```js +program + .command('action1', undefined, { noHelp: true }) // No longer valid + .command('action2', { noHelp: true }) // Correct +``` + +## 3.0.0-0 Prerelease / 2019-07-28 + +(Released as 3.0.0) + +## 2.20.0 / 2019-04-02 + +* fix: resolve symbolic links completely when hunting for subcommands (#935) +* Update index.d.ts (#930) +* Update Readme.md (#924) +* Remove --save option as it isn't required anymore (#918) +* Add link to the license file (#900) +* Added example of receiving args from options (#858) +* Added missing semicolon (#882) +* Add extension to .eslintrc (#876) + +## 2.19.0 / 2018-10-02 + +* Removed newline after Options and Commands headers (#864) +* Bugfix - Error output (#862) +* Fix to change default value to string (#856) + +## 2.18.0 / 2018-09-07 + +* Standardize help output (#853) +* chmod 644 travis.yml (#851) +* add support for execute typescript subcommand via ts-node (#849) + +## 2.17.1 / 2018-08-07 + +* Fix bug in command emit (#844) + +## 2.17.0 / 2018-08-03 + +* fixed newline output after help information (#833) +* Fix to emit the action even without command (#778) +* npm update (#823) + +## 2.16.0 / 2018-06-29 + +* Remove Makefile and `test/run` (#821) +* Make 'npm test' run on Windows (#820) +* Add badge to display install size (#807) +* chore: cache node_modules (#814) +* chore: remove Node.js 4 (EOL), add Node.js 10 (#813) +* fixed typo in readme (#812) +* Fix types (#804) +* Update eslint to resolve vulnerabilities in lodash (#799) +* updated readme with custom event listeners. (#791) +* fix tests (#794) + +## 2.15.0 / 2018-03-07 + +* Update downloads badge to point to graph of downloads over time instead of duplicating link to npm +* Arguments description + +## 2.14.1 / 2018-02-07 + +* Fix typing of help function + +## 2.14.0 / 2018-02-05 + +* only register the option:version event once +* Fixes issue #727: Passing empty string for option on command is set to undefined +* enable eqeqeq rule +* resolves #754 add linter configuration to project +* resolves #560 respect custom name for version option +* document how to override the version flag +* document using options per command + +## 2.13.0 / 2018-01-09 + +* Do not print default for --no- +* remove trailing spaces in command help +* Update CI's Node.js to LTS and latest version +* typedefs: Command and Option types added to commander namespace + +## 2.12.2 / 2017-11-28 + +* fix: typings are not shipped + +## 2.12.1 / 2017-11-23 + +* Move @types/node to dev dependency + +## 2.12.0 / 2017-11-22 + +* add attributeName() method to Option objects +* Documentation updated for options with --no prefix +* typings: `outputHelp` takes a string as the first parameter +* typings: use overloads +* feat(typings): update to match js api +* Print default value in option help +* Fix translation error +* Fail when using same command and alias (#491) +* feat(typings): add help callback +* fix bug when description is add after command with options (#662) +* Format js code +* Rename History.md to CHANGELOG.md (#668) +* feat(typings): add typings to support TypeScript (#646) +* use current node + +## 2.11.0 / 2017-07-03 + +* Fix help section order and padding (#652) +* feature: support for signals to subcommands (#632) +* Fixed #37, --help should not display first (#447) +* Fix translation errors. (#570) +* Add package-lock.json +* Remove engines +* Upgrade package version +* Prefix events to prevent conflicts between commands and options (#494) +* Removing dependency on graceful-readlink +* Support setting name in #name function and make it chainable +* Add .vscode directory to .gitignore (Visual Studio Code metadata) +* Updated link to ruby commander in readme files + +## 2.10.0 / 2017-06-19 + +* Update .travis.yml. drop support for older node.js versions. +* Fix require arguments in README.md +* On SemVer you do not start from 0.0.1 +* Add missing semi colon in readme +* Add save param to npm install +* node v6 travis test +* Update Readme_zh-CN.md +* Allow literal '--' to be passed-through as an argument +* Test subcommand alias help +* link build badge to master branch +* Support the alias of Git style sub-command +* added keyword commander for better search result on npm +* Fix Sub-Subcommands +* test node.js stable +* Fixes TypeError when a command has an option called `--description` +* Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets. +* Add chinese Readme file + +## 2.9.0 / 2015-10-13 + +* Add option `isDefault` to set default subcommand #415 @Qix- +* Add callback to allow filtering or post-processing of help text #434 @djulien +* Fix `undefined` text in help information close #414 #416 @zhiyelee + +## 2.8.1 / 2015-04-22 + +* Back out `support multiline description` Close #396 #397 + +## 2.8.0 / 2015-04-07 + +* Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee +* Fix bug in Git-style sub-commands #372 @zhiyelee +* Allow commands to be hidden from help #383 @tonylukasavage +* When git-style sub-commands are in use, yet none are called, display help #382 @claylo +* Add ability to specify arguments syntax for top-level command #258 @rrthomas +* Support multiline descriptions #208 @zxqfox + +## 2.7.1 / 2015-03-11 + +* Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367. + +## 2.7.0 / 2015-03-09 + +* Fix git-style bug when installed globally. Close #335 #349 @zhiyelee +* Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage +* Add support for camelCase on `opts()`. Close #353 @nkzawa +* Add node.js 0.12 and io.js to travis.yml +* Allow RegEx options. #337 @palanik +* Fixes exit code when sub-command failing. Close #260 #332 @pirelenito +* git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee + +## 2.6.0 / 2014-12-30 + +* added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee +* Add application description to the help msg. Close #112 @dalssoft + +## 2.5.1 / 2014-12-15 + +* fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee + +## 2.5.0 / 2014-10-24 + +* add support for variadic arguments. Closes #277 @whitlockjc + +## 2.4.0 / 2014-10-17 + +* fixed a bug on executing the coercion function of subcommands option. Closes #270 +* added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage +* added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage +* fixed a bug on subcommand name. Closes #248 @jonathandelgado +* fixed function normalize doesn’t honor option terminator. Closes #216 @abbr + +## 2.3.0 / 2014-07-16 + +* add command alias'. Closes PR #210 +* fix: Typos. Closes #99 +* fix: Unused fs module. Closes #217 + +## 2.2.0 / 2014-03-29 + +* add passing of previous option value +* fix: support subcommands on windows. Closes #142 +* Now the defaultValue passed as the second argument of the coercion function. + +## 2.1.0 / 2013-11-21 + +* add: allow cflag style option params, unit test, fixes #174 + +## 2.0.0 / 2013-07-18 + +* remove input methods (.prompt, .confirm, etc) + +## Older versions + +* [1.x](./changelogs/CHANGELOG-1.md) +* [0.x](./changelogs/CHANGELOG-0.md) + +[#599]: https://github.com/tj/commander.js/issues/599 +[#611]: https://github.com/tj/commander.js/issues/611 +[#697]: https://github.com/tj/commander.js/issues/697 +[#795]: https://github.com/tj/commander.js/issues/795 +[#806]: https://github.com/tj/commander.js/issues/806 +[#915]: https://github.com/tj/commander.js/issues/915 +[#938]: https://github.com/tj/commander.js/issues/938 +[#963]: https://github.com/tj/commander.js/issues/963 +[#974]: https://github.com/tj/commander.js/issues/974 +[#980]: https://github.com/tj/commander.js/issues/980 +[#987]: https://github.com/tj/commander.js/issues/987 +[#990]: https://github.com/tj/commander.js/issues/990 +[#991]: https://github.com/tj/commander.js/issues/991 +[#993]: https://github.com/tj/commander.js/issues/993 +[#999]: https://github.com/tj/commander.js/issues/999 +[#1010]: https://github.com/tj/commander.js/pull/1010 +[#1018]: https://github.com/tj/commander.js/pull/1018 +[#1026]: https://github.com/tj/commander.js/pull/1026 +[#1027]: https://github.com/tj/commander.js/pull/1027 +[#1028]: https://github.com/tj/commander.js/pull/1028 +[#1035]: https://github.com/tj/commander.js/pull/1035 +[#1040]: https://github.com/tj/commander.js/pull/1040 +[#1047]: https://github.com/tj/commander.js/pull/1047 +[#1048]: https://github.com/tj/commander.js/pull/1048 +[#1049]: https://github.com/tj/commander.js/pull/1049 +[#1051]: https://github.com/tj/commander.js/pull/1051 +[#1052]: https://github.com/tj/commander.js/pull/1052 +[#1053]: https://github.com/tj/commander.js/pull/1053 +[#1071]: https://github.com/tj/commander.js/pull/1071 +[#1081]: https://github.com/tj/commander.js/pull/1081 +[#1091]: https://github.com/tj/commander.js/pull/1091 +[#1096]: https://github.com/tj/commander.js/pull/1096 +[#1102]: https://github.com/tj/commander.js/pull/1102 +[#1118]: https://github.com/tj/commander.js/pull/1118 +[#1157]: https://github.com/tj/commander.js/pull/1157 + +[Unreleased]: https://github.com/tj/commander.js/compare/master...develop +[4.1.1]: https://github.com/tj/commander.js/compare/v4.0.0..v4.1.1 +[4.1.0]: https://github.com/tj/commander.js/compare/v4.0.1..v4.1.0 +[4.0.1]: https://github.com/tj/commander.js/compare/v4.0.0..v4.0.1 +[4.0.0]: https://github.com/tj/commander.js/compare/v3.0.2..v4.0.0 +[4.0.0-1]: https://github.com/tj/commander.js/compare/v4.0.0-0..v4.0.0-1 +[4.0.0-0]: https://github.com/tj/commander.js/compare/v3.0.2...v4.0.0-0 +[3.0.2]: https://github.com/tj/commander.js/compare/v3.0.1...v3.0.2 +[3.0.1]: https://github.com/tj/commander.js/compare/v3.0.0...v3.0.1 +[3.0.0]: https://github.com/tj/commander.js/compare/v2.20.1...v3.0.0 +[2.20.1]: https://github.com/tj/commander.js/compare/v2.20.0...v2.20.1 diff --git a/node_modules/commander/LICENSE b/node_modules/commander/LICENSE new file mode 100644 index 00000000..10f997ab --- /dev/null +++ b/node_modules/commander/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2011 TJ Holowaychuk + +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/commander/Readme.md b/node_modules/commander/Readme.md new file mode 100644 index 00000000..aa4f42b5 --- /dev/null +++ b/node_modules/commander/Readme.md @@ -0,0 +1,713 @@ +# Commander.js + +[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js) +[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander) +[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true) +[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander) + +The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander). + +Read this in other languages: English | [简体中文](./Readme_zh-CN.md) + +- [Commander.js](#commanderjs) + - [Installation](#installation) + - [Declaring program variable](#declaring-program-variable) + - [Options](#options) + - [Common option types, boolean and value](#common-option-types-boolean-and-value) + - [Default option value](#default-option-value) + - [Other option types, negatable boolean and flag|value](#other-option-types-negatable-boolean-and-flagvalue) + - [Custom option processing](#custom-option-processing) + - [Required option](#required-option) + - [Version option](#version-option) + - [Commands](#commands) + - [Specify the argument syntax](#specify-the-argument-syntax) + - [Action handler (sub)commands](#action-handler-subcommands) + - [Git-style executable (sub)commands](#git-style-executable-subcommands) + - [Automated --help](#automated---help) + - [Custom help](#custom-help) + - [.usage and .name](#usage-and-name) + - [.outputHelp(cb)](#outputhelpcb) + - [.helpOption(flags, description)](#helpoptionflags-description) + - [.help(cb)](#helpcb) + - [Custom event listeners](#custom-event-listeners) + - [Bits and pieces](#bits-and-pieces) + - [Avoiding option name clashes](#avoiding-option-name-clashes) + - [TypeScript](#typescript) + - [Node options such as --harmony](#node-options-such-as---harmony) + - [Node debugging](#node-debugging) + - [Override exit handling](#override-exit-handling) + - [Examples](#examples) + - [License](#license) + - [Support](#support) + - [Commander for enterprise](#commander-for-enterprise) + +## Installation + +```bash +npm install commander +``` + +## Declaring _program_ variable + +Commander exports a global object which is convenient for quick programs. +This is used in the examples in this README for brevity. + +```js +const program = require('commander'); +program.version('0.0.1'); +``` + +For larger programs which may use commander in multiple ways, including unit testing, it is better to create a local Command object to use. + + ```js + const commander = require('commander'); + const program = new commander.Command(); + program.version('0.0.1'); + ``` + +## Options + +Options are defined with the `.option()` method, also serving as documentation for the options. Each option can have a short flag (single character) and a long name, separated by a comma or space. + +The options can be accessed as properties on the Command object. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. Multiple short flags may be combined as a single arg, for example `-abc` is equivalent to `-a -b -c`. + +See also optional new behaviour to [avoid name clashes](#avoiding-option-name-clashes). + +### Common option types, boolean and value + +The two most used option types are a boolean flag, and an option which takes a value (declared using angle brackets). Both are `undefined` unless specified on command line. + +```js +const program = require('commander'); + +program + .option('-d, --debug', 'output extra debugging') + .option('-s, --small', 'small pizza size') + .option('-p, --pizza-type ', 'flavour of pizza'); + +program.parse(process.argv); + +if (program.debug) console.log(program.opts()); +console.log('pizza details:'); +if (program.small) console.log('- small pizza size'); +if (program.pizzaType) console.log(`- ${program.pizzaType}`); +``` + +```bash +$ pizza-options -d +{ debug: true, small: undefined, pizzaType: undefined } +pizza details: +$ pizza-options -p +error: option '-p, --pizza-type ' argument missing +$ pizza-options -ds -p vegetarian +{ debug: true, small: true, pizzaType: 'vegetarian' } +pizza details: +- small pizza size +- vegetarian +$ pizza-options --pizza-type=cheese +pizza details: +- cheese +``` + +`program.parse(arguments)` processes the arguments, leaving any args not consumed by the options as the `program.args` array. + +### Default option value + +You can specify a default value for an option which takes a value. + +```js +const program = require('commander'); + +program + .option('-c, --cheese ', 'add the specified type of cheese', 'blue'); + +program.parse(process.argv); + +console.log(`cheese: ${program.cheese}`); +``` + +```bash +$ pizza-options +cheese: blue +$ pizza-options --cheese stilton +cheese: stilton +``` + +### Other option types, negatable boolean and flag|value + +You can specify a boolean option long name with a leading `no-` to set the option value to false when used. +Defined alone this also makes the option true by default. + +If you define `--foo` first, adding `--no-foo` does not change the default value from what it would +otherwise be. You can specify a default boolean value for a boolean flag and it can be overridden on command line. + +```js +const program = require('commander'); + +program + .option('--no-sauce', 'Remove sauce') + .option('--cheese ', 'cheese flavour', 'mozzarella') + .option('--no-cheese', 'plain with no cheese') + .parse(process.argv); + +const sauceStr = program.sauce ? 'sauce' : 'no sauce'; +const cheeseStr = (program.cheese === false) ? 'no cheese' : `${program.cheese} cheese`; +console.log(`You ordered a pizza with ${sauceStr} and ${cheeseStr}`); +``` + +```bash +$ pizza-options +You ordered a pizza with sauce and mozzarella cheese +$ pizza-options --sauce +error: unknown option '--sauce' +$ pizza-options --cheese=blue +You ordered a pizza with sauce and blue cheese +$ pizza-options --no-sauce --no-cheese +You ordered a pizza with no sauce and no cheese +``` + +You can specify an option which functions as a flag but may also take a value (declared using square brackets). + +```js +const program = require('commander'); + +program + .option('-c, --cheese [type]', 'Add cheese with optional type'); + +program.parse(process.argv); + +if (program.cheese === undefined) console.log('no cheese'); +else if (program.cheese === true) console.log('add cheese'); +else console.log(`add cheese type ${program.cheese}`); +``` + +```bash +$ pizza-options +no cheese +$ pizza-options --cheese +add cheese +$ pizza-options --cheese mozzarella +add cheese type mozzarella +``` + +### Custom option processing + +You may specify a function to do custom processing of option values. The callback function receives two parameters, the user specified value and the +previous value for the option. It returns the new value for the option. + +This allows you to coerce the option value to the desired type, or accumulate values, or do entirely custom processing. + +You can optionally specify the default/starting value for the option after the function. + +```js +const program = require('commander'); + +function myParseInt(value, dummyPrevious) { + // parseInt takes a string and an optional radix + return parseInt(value); +} + +function increaseVerbosity(dummyValue, previous) { + return previous + 1; +} + +function collect(value, previous) { + return previous.concat([value]); +} + +function commaSeparatedList(value, dummyPrevious) { + return value.split(','); +} + +program + .option('-f, --float ', 'float argument', parseFloat) + .option('-i, --integer ', 'integer argument', myParseInt) + .option('-v, --verbose', 'verbosity that can be increased', increaseVerbosity, 0) + .option('-c, --collect ', 'repeatable value', collect, []) + .option('-l, --list ', 'comma separated list', commaSeparatedList) +; + +program.parse(process.argv); + +if (program.float !== undefined) console.log(`float: ${program.float}`); +if (program.integer !== undefined) console.log(`integer: ${program.integer}`); +if (program.verbose > 0) console.log(`verbosity: ${program.verbose}`); +if (program.collect.length > 0) console.log(program.collect); +if (program.list !== undefined) console.log(program.list); +``` + +```bash +$ custom -f 1e2 +float: 100 +$ custom --integer 2 +integer: 2 +$ custom -v -v -v +verbose: 3 +$ custom -c a -c b -c c +[ 'a', 'b', 'c' ] +$ custom --list x,y,z +[ 'x', 'y', 'z' ] +``` + +### Required option + +You may specify a required (mandatory) option using `.requiredOption`. The option must be specified on the command line, or by having a default value. The method is otherwise the same as `.option` in format, taking flags and description, and optional default value or custom processing. + +```js +const program = require('commander'); + +program + .requiredOption('-c, --cheese ', 'pizza must have cheese'); + +program.parse(process.argv); +``` + +``` +$ pizza +error: required option '-c, --cheese ' not specified +``` + +### Version option + +The optional `version` method adds handling for displaying the command version. The default option flags are `-V` and `--version`, and when present the command prints the version number and exits. + +```js +program.version('0.0.1'); +``` + +```bash +$ ./examples/pizza -V +0.0.1 +``` + +You may change the flags and description by passing additional parameters to the `version` method, using +the same syntax for flags as the `option` method. The version flags can be named anything, but a long name is required. + +```js +program.version('0.0.1', '-v, --vers', 'output the current version'); +``` + +## Commands + +You can specify (sub)commands for your top-level command using `.command`. There are two ways these can be implemented: using an action handler attached to the command, or as a separate executable file (described in more detail later). In the first parameter to `.command` you specify the command name and any command arguments. The arguments may be `` or `[optional]`, and the last argument may also be `variadic...`. + +For example: + +```js +// Command implemented using action handler (description is supplied separately to `.command`) +// Returns new command for configuring. +program + .command('clone [destination]') + .description('clone a repository into a newly created directory') + .action((source, destination) => { + console.log('clone command called'); + }); + +// Command implemented using separate executable file (description is second parameter to `.command`) +// Returns top-level command for adding more commands. +program + .command('start ', 'start named service') + .command('stop [service]', 'stop named service, or all if no name supplied'); +``` + +### Specify the argument syntax + +You use `.arguments` to specify the arguments for the top-level command, and for subcommands they are included in the `.command` call. Angled brackets (e.g. ``) indicate required input. Square brackets (e.g. `[optional]`) indicate optional input. + +```js +const program = require('commander'); + +program + .version('0.1.0') + .arguments(' [env]') + .action(function (cmd, env) { + cmdValue = cmd; + envValue = env; + }); + +program.parse(process.argv); + +if (typeof cmdValue === 'undefined') { + console.error('no command given!'); + process.exit(1); +} +console.log('command:', cmdValue); +console.log('environment:', envValue || "no environment given"); +``` + + The last argument of a command can be variadic, and only the last argument. To make an argument variadic you + append `...` to the argument name. For example: + +```js +const program = require('commander'); + +program + .version('0.1.0') + .command('rmdir [otherDirs...]') + .action(function (dir, otherDirs) { + console.log('rmdir %s', dir); + if (otherDirs) { + otherDirs.forEach(function (oDir) { + console.log('rmdir %s', oDir); + }); + } + }); + +program.parse(process.argv); +``` + +The variadic argument is passed to the action handler as an array. (And this also applies to `program.args`.) + +### Action handler (sub)commands + +You can add options to a command that uses an action handler. +The action handler gets passed a parameter for each argument you declared, and one additional argument which is the +command object itself. This command argument has the values for the command-specific options added as properties. + +```js +const program = require('commander'); + +program + .command('rm ') + .option('-r, --recursive', 'Remove recursively') + .action(function (dir, cmdObj) { + console.log('remove ' + dir + (cmdObj.recursive ? ' recursively' : '')) + }) + +program.parse(process.argv) +``` + +You may supply an `async` action handler, in which case you call `.parseAsync` rather than `.parse`. + +```js +async function run() { /* code goes here */ } + +async function main() { + program + .command('run') + .action(run); + await program.parseAsync(process.argv); +} +``` + +A command's options on the command line are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated. + +Configuration options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the command from the generated help output. + +### Git-style executable (sub)commands + +When `.command()` is invoked with a description argument, this tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools. +Commander will search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-subcommand`, like `pm-install`, `pm-search`. +You can specify a custom name with the `executableFile` configuration option. + +You handle the options for an executable (sub)command in the executable, and don't declare them at the top-level. + +```js +// file: ./examples/pm +const program = require('commander'); + +program + .version('0.1.0') + .command('install [name]', 'install one or more packages') + .command('search [query]', 'search with optional query') + .command('update', 'update installed packages', {executableFile: 'myUpdateSubCommand'}) + .command('list', 'list packages installed', {isDefault: true}) + .parse(process.argv); +``` + +Configuration options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the command from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified. +Specifying a name with `executableFile` will override the default constructed name. + +If the program is designed to be installed globally, make sure the executables have proper modes, like `755`. + +## Automated --help + + The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: + +```bash +$ ./examples/pizza --help +Usage: pizza [options] + +An application for pizzas ordering + +Options: + -V, --version output the version number + -p, --peppers Add peppers + -P, --pineapple Add pineapple + -b, --bbq Add bbq sauce + -c, --cheese Add the specified type of cheese (default: "marble") + -C, --no-cheese You do not want any cheese + -h, --help output usage information +``` + +### Custom help + + You can display arbitrary `-h, --help` information + by listening for "--help". Commander will automatically + exit once you are done so that the remainder of your program + does not execute causing undesired behaviors, for example + in the following executable "stuff" will not output when + `--help` is used. + +```js +#!/usr/bin/env node + +const program = require('commander'); + +program + .version('0.1.0') + .option('-f, --foo', 'enable some foo') + .option('-b, --bar', 'enable some bar') + .option('-B, --baz', 'enable some baz'); + +// must be before .parse() since +// node's emit() is immediate + +program.on('--help', function(){ + console.log('') + console.log('Examples:'); + console.log(' $ custom-help --help'); + console.log(' $ custom-help -h'); +}); + +program.parse(process.argv); + +console.log('stuff'); +``` + +Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run: + +```Text +Usage: custom-help [options] + +Options: + -h, --help output usage information + -V, --version output the version number + -f, --foo enable some foo + -b, --bar enable some bar + -B, --baz enable some baz + +Examples: + $ custom-help --help + $ custom-help -h +``` + +### .usage and .name + +These allow you to customise the usage description in the first line of the help. The name is otherwise +deduced from the (full) program arguments. Given: + +```js +program + .name("my-command") + .usage("[global options] command") +``` + +The help will start with: + +```Text +Usage: my-command [global options] command +``` + +### .outputHelp(cb) + +Output help information without exiting. +Optional callback cb allows post-processing of help text before it is displayed. + +If you want to display help by default (e.g. if no command was provided), you can use something like: + +```js +const program = require('commander'); +const colors = require('colors'); + +program + .version('0.1.0') + .command('getstream [url]', 'get stream URL') + .parse(process.argv); + +if (!process.argv.slice(2).length) { + program.outputHelp(make_red); +} + +function make_red(txt) { + return colors.red(txt); //display the help text in red on the console +} +``` + +### .helpOption(flags, description) + + Override the default help flags and description. + +```js +program + .helpOption('-e, --HELP', 'read more information'); +``` + +### .help(cb) + + Output help information and exit immediately. + Optional callback cb allows post-processing of help text before it is displayed. + +## Custom event listeners + + You can execute custom actions by listening to command and option events. + +```js +program.on('option:verbose', function () { + process.env.VERBOSE = this.verbose; +}); + +// error on unknown commands +program.on('command:*', function () { + console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' ')); + process.exit(1); +}); +``` + +## Bits and pieces + +### Avoiding option name clashes + +The original and default behaviour is that the option values are stored +as properties on the program, and the action handler is passed a +command object with the options values stored as properties. +This is very convenient to code, but the downside is possible clashes with +existing properties of Command. + +There are two new routines to change the behaviour, and the default behaviour may change in the future: + +- `storeOptionsAsProperties`: whether to store option values as properties on command object, or store separately (specify false) and access using `.opts()` +- `passCommandToAction`: whether to pass command to action handler, +or just the options (specify false) + +```js +// file: ./examples/storeOptionsAsProperties.action.js +program + .storeOptionsAsProperties(false) + .passCommandToAction(false); + +program + .name('my-program-name') + .option('-n,--name '); + +program + .command('show') + .option('-a,--action ') + .action((options) => { + console.log(options.action); + }); + +program.parse(process.argv); + +const programOptions = program.opts(); +console.log(programOptions.name); +``` + +### TypeScript + +The Commander package includes its TypeScript Definition file, but also requires the node types which you need to install yourself. e.g. + +```bash +npm install commander +npm install --save-dev @types/node +``` + +If you use `ts-node` and git-style sub-commands written as `.ts` files, you need to call your program through node to get the sub-commands called correctly. e.g. + +```bash +node -r ts-node/register pm.ts +``` + +### Node options such as `--harmony` + +You can enable `--harmony` option in two ways: + +- Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. (Note Windows does not support this pattern.) +- Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process. + +### Node debugging + +If you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) git-style executable (sub)commands using `node --inspect` et al, +the inspector port is incremented by 1 for the spawned subcommand. + +### Override exit handling + +By default Commander calls `process.exit` when it detects errors, or after displaying the help or version. You can override +this behaviour and optionally supply a callback. The default override throws a `CommanderError`. + +The override callback is passed a `CommanderError` with properties `exitCode` number, `code` string, and `message`. The default override behaviour is to throw the error, except for async handling of executable subcommand completion which carries on. The normal display of error messages or version or help +is not affected by the override which is called after the display. + +``` js +program.exitOverride(); + +try { + program.parse(process.argv); +} catch (err) { + // custom processing... +} +``` + +## Examples + +```js +const program = require('commander'); + +program + .version('0.1.0') + .option('-C, --chdir ', 'change the working directory') + .option('-c, --config ', 'set config path. defaults to ./deploy.conf') + .option('-T, --no-tests', 'ignore test hook'); + +program + .command('setup [env]') + .description('run setup commands for all envs') + .option("-s, --setup_mode [mode]", "Which setup mode to use") + .action(function(env, options){ + const mode = options.setup_mode || "normal"; + env = env || 'all'; + console.log('setup for %s env(s) with %s mode', env, mode); + }); + +program + .command('exec ') + .alias('ex') + .description('execute the given remote cmd') + .option("-e, --exec_mode ", "Which exec mode to use") + .action(function(cmd, options){ + console.log('exec "%s" using %s mode', cmd, options.exec_mode); + }).on('--help', function() { + console.log(''); + console.log('Examples:'); + console.log(''); + console.log(' $ deploy exec sequential'); + console.log(' $ deploy exec async'); + }); + +program + .command('*') + .action(function(env){ + console.log('deploying "%s"', env); + }); + +program.parse(process.argv); +``` + +More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory. + +## License + +[MIT](https://github.com/tj/commander.js/blob/master/LICENSE) + +## Support + +Commander 4.x is supported on Node 8 and above, and is likely to work with Node 6 but not tested. +(For versions of Node below Node 6, use Commander 3.x or 2.x.) + +The main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub. + +### Commander for enterprise + +Available as part of the Tidelift Subscription + +The maintainers of Commander and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/commander/index.js b/node_modules/commander/index.js new file mode 100644 index 00000000..37d20cc5 --- /dev/null +++ b/node_modules/commander/index.js @@ -0,0 +1,1649 @@ +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter; +var spawn = require('child_process').spawn; +var path = require('path'); +var dirname = path.dirname; +var basename = path.basename; +var fs = require('fs'); + +/** + * Inherit `Command` from `EventEmitter.prototype`. + */ + +require('util').inherits(Command, EventEmitter); + +/** + * Expose the root command. + */ + +exports = module.exports = new Command(); + +/** + * Expose `Command`. + */ + +exports.Command = Command; + +/** + * Expose `Option`. + */ + +exports.Option = Option; + +/** + * Initialize a new `Option` with the given `flags` and `description`. + * + * @param {String} flags + * @param {String} description + * @api public + */ + +function Option(flags, description) { + this.flags = flags; + this.required = flags.indexOf('<') >= 0; // A value must be supplied when the option is specified. + this.optional = flags.indexOf('[') >= 0; // A value is optional when the option is specified. + this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line. + this.negate = flags.indexOf('-no-') !== -1; + flags = flags.split(/[ ,|]+/); + if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); + this.long = flags.shift(); + this.description = description || ''; +} + +/** + * Return option name. + * + * @return {String} + * @api private + */ + +Option.prototype.name = function() { + return this.long.replace(/^--/, ''); +}; + +/** + * Return option name, in a camelcase format that can be used + * as a object attribute key. + * + * @return {String} + * @api private + */ + +Option.prototype.attributeName = function() { + return camelcase(this.name().replace(/^no-/, '')); +}; + +/** + * Check if `arg` matches the short or long flag. + * + * @param {String} arg + * @return {Boolean} + * @api private + */ + +Option.prototype.is = function(arg) { + return this.short === arg || this.long === arg; +}; + +/** + * CommanderError class + * @class + */ +class CommanderError extends Error { + /** + * Constructs the CommanderError class + * @param {Number} exitCode suggested exit code which could be used with process.exit + * @param {String} code an id string representing the error + * @param {String} message human-readable description of the error + * @constructor + */ + constructor(exitCode, code, message) { + super(message); + // properly capture stack trace in Node.js + Error.captureStackTrace(this, this.constructor); + this.name = this.constructor.name; + this.code = code; + this.exitCode = exitCode; + } +} + +exports.CommanderError = CommanderError; + +/** + * Initialize a new `Command`. + * + * @param {String} [name] + * @api public + */ + +function Command(name) { + this.commands = []; + this.options = []; + this._execs = new Set(); + this._allowUnknownOption = false; + this._args = []; + this._name = name || ''; + this._optionValues = {}; + this._storeOptionsAsProperties = true; // backwards compatible by default + this._passCommandToAction = true; // backwards compatible by default + this._actionResults = []; + + this._helpFlags = '-h, --help'; + this._helpDescription = 'output usage information'; + this._helpShortFlag = '-h'; + this._helpLongFlag = '--help'; +} + +/** + * Define a command. + * + * There are two styles of command: pay attention to where to put the description. + * + * Examples: + * + * // Command implemented using action handler (description is supplied separately to `.command`) + * program + * .command('clone [destination]') + * .description('clone a repository into a newly created directory') + * .action((source, destination) => { + * console.log('clone command called'); + * }); + * + * // Command implemented using separate executable file (description is second parameter to `.command`) + * program + * .command('start ', 'start named service') + * .command('stop [service]', 'stop named service, or all if no name supplied'); + * + * @param {string} nameAndArgs - command name and arguments, args are `` or `[optional]` and last may also be `variadic...` + * @param {Object|string} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) + * @param {Object} [execOpts] - configuration options (for executable) + * @return {Command} returns new command for action handler, or top-level command for executable command + * @api public + */ + +Command.prototype.command = function(nameAndArgs, actionOptsOrExecDesc, execOpts) { + var desc = actionOptsOrExecDesc; + var opts = execOpts; + if (typeof desc === 'object' && desc !== null) { + opts = desc; + desc = null; + } + opts = opts || {}; + var args = nameAndArgs.split(/ +/); + var cmd = new Command(args.shift()); + + if (desc) { + cmd.description(desc); + this.executables = true; + this._execs.add(cmd._name); + if (opts.isDefault) this.defaultExecutable = cmd._name; + } + cmd._noHelp = !!opts.noHelp; + cmd._helpFlags = this._helpFlags; + cmd._helpDescription = this._helpDescription; + cmd._helpShortFlag = this._helpShortFlag; + cmd._helpLongFlag = this._helpLongFlag; + cmd._exitCallback = this._exitCallback; + cmd._storeOptionsAsProperties = this._storeOptionsAsProperties; + cmd._passCommandToAction = this._passCommandToAction; + + cmd._executableFile = opts.executableFile; // Custom name for executable file + this.commands.push(cmd); + cmd.parseExpectedArgs(args); + cmd.parent = this; + + if (desc) return this; + return cmd; +}; + +/** + * Define argument syntax for the top-level command. + * + * @api public + */ + +Command.prototype.arguments = function(desc) { + return this.parseExpectedArgs(desc.split(/ +/)); +}; + +/** + * Add an implicit `help [cmd]` subcommand + * which invokes `--help` for the given command. + * + * @api private + */ + +Command.prototype.addImplicitHelpCommand = function() { + this.command('help [cmd]', 'display help for [cmd]'); +}; + +/** + * Parse expected `args`. + * + * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. + * + * @param {Array} args + * @return {Command} for chaining + * @api public + */ + +Command.prototype.parseExpectedArgs = function(args) { + if (!args.length) return; + var self = this; + args.forEach(function(arg) { + var argDetails = { + required: false, + name: '', + variadic: false + }; + + switch (arg[0]) { + case '<': + argDetails.required = true; + argDetails.name = arg.slice(1, -1); + break; + case '[': + argDetails.name = arg.slice(1, -1); + break; + } + + if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') { + argDetails.variadic = true; + argDetails.name = argDetails.name.slice(0, -3); + } + if (argDetails.name) { + self._args.push(argDetails); + } + }); + return this; +}; + +/** + * Register callback to use as replacement for calling process.exit. + * + * @param {Function} [fn] optional callback which will be passed a CommanderError, defaults to throwing + * @return {Command} for chaining + * @api public + */ + +Command.prototype.exitOverride = function(fn) { + if (fn) { + this._exitCallback = fn; + } else { + this._exitCallback = function(err) { + if (err.code !== 'commander.executeSubCommandAsync') { + throw err; + } else { + // Async callback from spawn events, not useful to throw. + } + }; + } + return this; +}; + +/** + * Call process.exit, and _exitCallback if defined. + * + * @param {Number} exitCode exit code for using with process.exit + * @param {String} code an id string representing the error + * @param {String} message human-readable description of the error + * @return never + * @api private + */ + +Command.prototype._exit = function(exitCode, code, message) { + if (this._exitCallback) { + this._exitCallback(new CommanderError(exitCode, code, message)); + // Expecting this line is not reached. + } + process.exit(exitCode); +}; + +/** + * Register callback `fn` for the command. + * + * Examples: + * + * program + * .command('help') + * .description('display verbose help') + * .action(function() { + * // output help here + * }); + * + * @param {Function} fn + * @return {Command} for chaining + * @api public + */ + +Command.prototype.action = function(fn) { + var self = this; + var listener = function(args, unknown) { + // Parse any so-far unknown options + args = args || []; + unknown = unknown || []; + + var parsed = self.parseOptions(unknown); + + // Output help if necessary + outputHelpIfRequested(self, parsed.unknown); + self._checkForMissingMandatoryOptions(); + + // If there are still any unknown options, then we simply + // die, unless someone asked for help, in which case we give it + // to them, and then we die. + if (parsed.unknown.length > 0) { + self.unknownOption(parsed.unknown[0]); + } + + // Leftover arguments need to be pushed back. Fixes issue #56 + if (parsed.args.length) args = parsed.args.concat(args); + + self._args.forEach(function(arg, i) { + if (arg.required && args[i] == null) { + self.missingArgument(arg.name); + } else if (arg.variadic) { + if (i !== self._args.length - 1) { + self.variadicArgNotLast(arg.name); + } + + args[i] = args.splice(i); + } + }); + + // The .action callback takes an extra parameter which is the command itself. + var expectedArgsCount = self._args.length; + var actionArgs = args.slice(0, expectedArgsCount); + if (self._passCommandToAction) { + actionArgs[expectedArgsCount] = self; + } else { + actionArgs[expectedArgsCount] = self.opts(); + } + // Add the extra arguments so available too. + if (args.length > expectedArgsCount) { + actionArgs.push(args.slice(expectedArgsCount)); + } + + const actionResult = fn.apply(self, actionArgs); + // Remember result in case it is async. Assume parseAsync getting called on root. + let rootCommand = self; + while (rootCommand.parent) { + rootCommand = rootCommand.parent; + } + rootCommand._actionResults.push(actionResult); + }; + var parent = this.parent || this; + var name = parent === this ? '*' : this._name; + parent.on('command:' + name, listener); + if (this._alias) parent.on('command:' + this._alias, listener); + return this; +}; + +/** + * Internal implementation shared by .option() and .requiredOption() + * + * @param {Object} config + * @param {String} flags + * @param {String} description + * @param {Function|*} [fn] - custom option processing function or default vaue + * @param {*} [defaultValue] + * @return {Command} for chaining + * @api private + */ + +Command.prototype._optionEx = function(config, flags, description, fn, defaultValue) { + var self = this, + option = new Option(flags, description), + oname = option.name(), + name = option.attributeName(); + option.mandatory = !!config.mandatory; + + // default as 3rd arg + if (typeof fn !== 'function') { + if (fn instanceof RegExp) { + // This is a bit simplistic (especially no error messages), and probably better handled by caller using custom option processing. + // No longer documented in README, but still present for backwards compatibility. + var regex = fn; + fn = function(val, def) { + var m = regex.exec(val); + return m ? m[0] : def; + }; + } else { + defaultValue = fn; + fn = null; + } + } + + // preassign default value for --no-*, [optional], , or plain flag if boolean value + if (option.negate || option.optional || option.required || typeof defaultValue === 'boolean') { + // when --no-foo we make sure default is true, unless a --foo option is already defined + if (option.negate) { + const positiveLongFlag = option.long.replace(/^--no-/, '--'); + defaultValue = self.optionFor(positiveLongFlag) ? self._getOptionValue(name) : true; + } + // preassign only if we have a default + if (defaultValue !== undefined) { + self._setOptionValue(name, defaultValue); + option.defaultValue = defaultValue; + } + } + + // register the option + this.options.push(option); + + // when it's passed assign the value + // and conditionally invoke the callback + this.on('option:' + oname, function(val) { + // coercion + if (val !== null && fn) { + val = fn(val, self._getOptionValue(name) === undefined ? defaultValue : self._getOptionValue(name)); + } + + // unassigned or boolean value + if (typeof self._getOptionValue(name) === 'boolean' || typeof self._getOptionValue(name) === 'undefined') { + // if no value, negate false, and we have a default, then use it! + if (val == null) { + self._setOptionValue(name, option.negate + ? false + : defaultValue || true); + } else { + self._setOptionValue(name, val); + } + } else if (val !== null) { + // reassign + self._setOptionValue(name, option.negate ? false : val); + } + }); + + return this; +}; + +/** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string should contain both the short and long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * Examples: + * + * // simple boolean defaulting to undefined + * program.option('-p, --pepper', 'add pepper'); + * + * program.pepper + * // => undefined + * + * --pepper + * program.pepper + * // => true + * + * // simple boolean defaulting to true (unless non-negated option is also defined) + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => false + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @param {String} flags + * @param {String} description + * @param {Function|*} [fn] - custom option processing function or default vaue + * @param {*} [defaultValue] + * @return {Command} for chaining + * @api public + */ + +Command.prototype.option = function(flags, description, fn, defaultValue) { + return this._optionEx({}, flags, description, fn, defaultValue); +}; + +/* + * Add a required option which must have a value after parsing. This usually means + * the option must be specified on the command line. (Otherwise the same as .option().) + * + * The `flags` string should contain both the short and long flags, separated by comma, a pipe or space. + * + * @param {String} flags + * @param {String} description + * @param {Function|*} [fn] - custom option processing function or default vaue + * @param {*} [defaultValue] + * @return {Command} for chaining + * @api public + */ + +Command.prototype.requiredOption = function(flags, description, fn, defaultValue) { + return this._optionEx({ mandatory: true }, flags, description, fn, defaultValue); +}; + +/** + * Allow unknown options on the command line. + * + * @param {Boolean} arg if `true` or omitted, no error will be thrown + * for unknown options. + * @api public + */ +Command.prototype.allowUnknownOption = function(arg) { + this._allowUnknownOption = arguments.length === 0 || arg; + return this; +}; + +/** + * Whether to store option values as properties on command object, + * or store separately (specify false). In both cases the option values can be accessed using .opts(). + * + * @param {boolean} value + * @return {Command} Command for chaining + * @api public + */ + +Command.prototype.storeOptionsAsProperties = function(value) { + this._storeOptionsAsProperties = (value === undefined) || value; + if (this.options.length) { + // This is for programmer, not end user. + console.error('Commander usage error: call storeOptionsAsProperties before adding options'); + } + return this; +}; + +/** + * Whether to pass command to action handler, + * or just the options (specify false). + * + * @param {boolean} value + * @return {Command} Command for chaining + * @api public + */ + +Command.prototype.passCommandToAction = function(value) { + this._passCommandToAction = (value === undefined) || value; + return this; +}; + +/** + * Store option value + * + * @param {String} key + * @param {Object} value + * @api private + */ + +Command.prototype._setOptionValue = function(key, value) { + if (this._storeOptionsAsProperties) { + this[key] = value; + } else { + this._optionValues[key] = value; + } +}; + +/** + * Retrieve option value + * + * @param {String} key + * @return {Object} value + * @api private + */ + +Command.prototype._getOptionValue = function(key) { + if (this._storeOptionsAsProperties) { + return this[key]; + } + return this._optionValues[key]; +}; + +/** + * Parse `argv`, setting options and invoking commands when defined. + * + * @param {Array} argv + * @return {Command} for chaining + * @api public + */ + +Command.prototype.parse = function(argv) { + // implicit help + if (this.executables) this.addImplicitHelpCommand(); + + // store raw args + this.rawArgs = argv; + + // guess name + this._name = this._name || basename(argv[1], '.js'); + + // github-style sub-commands with no sub-command + if (this.executables && argv.length < 3 && !this.defaultExecutable) { + // this user needs help + argv.push(this._helpLongFlag); + } + + // process argv + var normalized = this.normalize(argv.slice(2)); + var parsed = this.parseOptions(normalized); + var args = this.args = parsed.args; + + var result = this.parseArgs(this.args, parsed.unknown); + + if (args[0] === 'help' && args.length === 1) this.help(); + + // Note for future: we could return early if we found an action handler in parseArgs, as none of following code needed? + + // --help + if (args[0] === 'help') { + args[0] = args[1]; + args[1] = this._helpLongFlag; + } else { + // If calling through to executable subcommand we could check for help flags before failing, + // but a somewhat unlikely case since program options not passed to executable subcommands. + // Wait for reports to see if check needed and what usage pattern is. + this._checkForMissingMandatoryOptions(); + } + + // executable sub-commands + // (Debugging note for future: args[0] is not right if an action has been called) + var name = result.args[0]; + var subCommand = null; + + // Look for subcommand + if (name) { + subCommand = this.commands.find(function(command) { + return command._name === name; + }); + } + + // Look for alias + if (!subCommand && name) { + subCommand = this.commands.find(function(command) { + return command.alias() === name; + }); + if (subCommand) { + name = subCommand._name; + args[0] = name; + } + } + + // Look for default subcommand + if (!subCommand && this.defaultExecutable) { + name = this.defaultExecutable; + args.unshift(name); + subCommand = this.commands.find(function(command) { + return command._name === name; + }); + } + + if (this._execs.has(name)) { + return this.executeSubCommand(argv, args, parsed.unknown, subCommand ? subCommand._executableFile : undefined); + } + + return result; +}; + +/** + * Parse `argv`, setting options and invoking commands when defined. + * + * Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise. + * + * @param {Array} argv + * @return {Promise} + * @api public + */ +Command.prototype.parseAsync = function(argv) { + this.parse(argv); + return Promise.all(this._actionResults); +}; + +/** + * Execute a sub-command executable. + * + * @param {Array} argv + * @param {Array} args + * @param {Array} unknown + * @param {String} executableFile + * @api private + */ + +Command.prototype.executeSubCommand = function(argv, args, unknown, executableFile) { + args = args.concat(unknown); + + if (!args.length) this.help(); + + var isExplicitJS = false; // Whether to use node to launch "executable" + + // executable + var pm = argv[1]; + // name of the subcommand, like `pm-install` + var bin = basename(pm, path.extname(pm)) + '-' + args[0]; + if (executableFile != null) { + bin = executableFile; + // Check for same extensions as we scan for below so get consistent launch behaviour. + var executableExt = path.extname(executableFile); + isExplicitJS = executableExt === '.js' || executableExt === '.ts' || executableExt === '.mjs'; + } + + // In case of globally installed, get the base dir where executable + // subcommand file should be located at + var baseDir; + + var resolvedLink = fs.realpathSync(pm); + + baseDir = dirname(resolvedLink); + + // prefer local `./` to bin in the $PATH + var localBin = path.join(baseDir, bin); + + // whether bin file is a js script with explicit `.js` or `.ts` extension + if (exists(localBin + '.js')) { + bin = localBin + '.js'; + isExplicitJS = true; + } else if (exists(localBin + '.ts')) { + bin = localBin + '.ts'; + isExplicitJS = true; + } else if (exists(localBin + '.mjs')) { + bin = localBin + '.mjs'; + isExplicitJS = true; + } else if (exists(localBin)) { + bin = localBin; + } + + args = args.slice(1); + + var proc; + if (process.platform !== 'win32') { + if (isExplicitJS) { + args.unshift(bin); + // add executable arguments to spawn + args = incrementNodeInspectorPort(process.execArgv).concat(args); + + proc = spawn(process.argv[0], args, { stdio: 'inherit' }); + } else { + proc = spawn(bin, args, { stdio: 'inherit' }); + } + } else { + args.unshift(bin); + // add executable arguments to spawn + args = incrementNodeInspectorPort(process.execArgv).concat(args); + proc = spawn(process.execPath, args, { stdio: 'inherit' }); + } + + var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP']; + signals.forEach(function(signal) { + process.on(signal, function() { + if (proc.killed === false && proc.exitCode === null) { + proc.kill(signal); + } + }); + }); + + // By default terminate process when spawned process terminates. + // Suppressing the exit if exitCallback defined is a bit messy and of limited use, but does allow process to stay running! + const exitCallback = this._exitCallback; + if (!exitCallback) { + proc.on('close', process.exit.bind(process)); + } else { + proc.on('close', () => { + exitCallback(new CommanderError(process.exitCode || 0, 'commander.executeSubCommandAsync', '(close)')); + }); + } + proc.on('error', function(err) { + if (err.code === 'ENOENT') { + console.error('error: %s(1) does not exist, try --help', bin); + } else if (err.code === 'EACCES') { + console.error('error: %s(1) not executable. try chmod or run with root', bin); + } + if (!exitCallback) { + process.exit(1); + } else { + const wrappedError = new CommanderError(1, 'commander.executeSubCommandAsync', '(error)'); + wrappedError.nestedError = err; + exitCallback(wrappedError); + } + }); + + // Store the reference to the child process + this.runningCommand = proc; +}; + +/** + * Normalize `args`, splitting joined short flags. For example + * the arg "-abc" is equivalent to "-a -b -c". + * This also normalizes equal sign and splits "--abc=def" into "--abc def". + * + * @param {Array} args + * @return {Array} + * @api private + */ + +Command.prototype.normalize = function(args) { + var ret = [], + arg, + lastOpt, + index, + short, + opt; + + for (var i = 0, len = args.length; i < len; ++i) { + arg = args[i]; + if (i > 0) { + lastOpt = this.optionFor(args[i - 1]); + } + + if (arg === '--') { + // Honor option terminator + ret = ret.concat(args.slice(i)); + break; + } else if (lastOpt && lastOpt.required) { + ret.push(arg); + } else if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') { + short = arg.slice(0, 2); + opt = this.optionFor(short); + if (opt && (opt.required || opt.optional)) { + ret.push(short); + ret.push(arg.slice(2)); + } else { + arg.slice(1).split('').forEach(function(c) { + ret.push('-' + c); + }); + } + } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) { + ret.push(arg.slice(0, index), arg.slice(index + 1)); + } else { + ret.push(arg); + } + } + + return ret; +}; + +/** + * Parse command `args`. + * + * When listener(s) are available those + * callbacks are invoked, otherwise the "*" + * event is emitted and those actions are invoked. + * + * @param {Array} args + * @return {Command} for chaining + * @api private + */ + +Command.prototype.parseArgs = function(args, unknown) { + var name; + + if (args.length) { + name = args[0]; + if (this.listeners('command:' + name).length) { + this.emit('command:' + args.shift(), args, unknown); + } else { + this.emit('command:*', args, unknown); + } + } else { + outputHelpIfRequested(this, unknown); + + // If there were no args and we have unknown options, + // then they are extraneous and we need to error. + if (unknown.length > 0 && !this.defaultExecutable) { + this.unknownOption(unknown[0]); + } + if (this.commands.length === 0 && + this._args.filter(function(a) { return a.required; }).length === 0) { + this.emit('command:*'); + } + } + + return this; +}; + +/** + * Return an option matching `arg` if any. + * + * @param {String} arg + * @return {Option} + * @api private + */ + +Command.prototype.optionFor = function(arg) { + for (var i = 0, len = this.options.length; i < len; ++i) { + if (this.options[i].is(arg)) { + return this.options[i]; + } + } +}; + +/** + * Display an error message if a mandatory option does not have a value. + * + * @api private + */ + +Command.prototype._checkForMissingMandatoryOptions = function() { + // Walk up hierarchy so can call from action handler after checking for displaying help. + for (var cmd = this; cmd; cmd = cmd.parent) { + cmd.options.forEach((anOption) => { + if (anOption.mandatory && (cmd._getOptionValue(anOption.attributeName()) === undefined)) { + cmd.missingMandatoryOptionValue(anOption); + } + }); + } +}; + +/** + * Parse options from `argv` returning `argv` + * void of these options. + * + * @param {Array} argv + * @return {{args: Array, unknown: Array}} + * @api public + */ + +Command.prototype.parseOptions = function(argv) { + var args = [], + len = argv.length, + literal, + option, + arg; + + var unknownOptions = []; + + // parse options + for (var i = 0; i < len; ++i) { + arg = argv[i]; + + // literal args after -- + if (literal) { + args.push(arg); + continue; + } + + if (arg === '--') { + literal = true; + continue; + } + + // find matching Option + option = this.optionFor(arg); + + // option is defined + if (option) { + // requires arg + if (option.required) { + arg = argv[++i]; + if (arg == null) return this.optionMissingArgument(option); + this.emit('option:' + option.name(), arg); + // optional arg + } else if (option.optional) { + arg = argv[i + 1]; + if (arg == null || (arg[0] === '-' && arg !== '-')) { + arg = null; + } else { + ++i; + } + this.emit('option:' + option.name(), arg); + // flag + } else { + this.emit('option:' + option.name()); + } + continue; + } + + // looks like an option + if (arg.length > 1 && arg[0] === '-') { + unknownOptions.push(arg); + + // If the next argument looks like it might be + // an argument for this option, we pass it on. + // If it isn't, then it'll simply be ignored + if ((i + 1) < argv.length && (argv[i + 1][0] !== '-' || argv[i + 1] === '-')) { + unknownOptions.push(argv[++i]); + } + continue; + } + + // arg + args.push(arg); + } + + return { args: args, unknown: unknownOptions }; +}; + +/** + * Return an object containing options as key-value pairs + * + * @return {Object} + * @api public + */ +Command.prototype.opts = function() { + if (this._storeOptionsAsProperties) { + // Preserve original behaviour so backwards compatible when still using properties + var result = {}, + len = this.options.length; + + for (var i = 0; i < len; i++) { + var key = this.options[i].attributeName(); + result[key] = key === this._versionOptionName ? this._version : this[key]; + } + return result; + } + + return this._optionValues; +}; + +/** + * Argument `name` is missing. + * + * @param {String} name + * @api private + */ + +Command.prototype.missingArgument = function(name) { + const message = `error: missing required argument '${name}'`; + console.error(message); + this._exit(1, 'commander.missingArgument', message); +}; + +/** + * `Option` is missing an argument, but received `flag` or nothing. + * + * @param {Option} option + * @param {String} [flag] + * @api private + */ + +Command.prototype.optionMissingArgument = function(option, flag) { + let message; + if (flag) { + message = `error: option '${option.flags}' argument missing, got '${flag}'`; + } else { + message = `error: option '${option.flags}' argument missing`; + } + console.error(message); + this._exit(1, 'commander.optionMissingArgument', message); +}; + +/** + * `Option` does not have a value, and is a mandatory option. + * + * @param {Option} option + * @api private + */ + +Command.prototype.missingMandatoryOptionValue = function(option) { + const message = `error: required option '${option.flags}' not specified`; + console.error(message); + this._exit(1, 'commander.missingMandatoryOptionValue', message); +}; + +/** + * Unknown option `flag`. + * + * @param {String} flag + * @api private + */ + +Command.prototype.unknownOption = function(flag) { + if (this._allowUnknownOption) return; + const message = `error: unknown option '${flag}'`; + console.error(message); + this._exit(1, 'commander.unknownOption', message); +}; + +/** + * Variadic argument with `name` is not the last argument as required. + * + * @param {String} name + * @api private + */ + +Command.prototype.variadicArgNotLast = function(name) { + const message = `error: variadic arguments must be last '${name}'`; + console.error(message); + this._exit(1, 'commander.variadicArgNotLast', message); +}; + +/** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * You can optionally supply the flags and description to override the defaults. + * + * @param {String} str + * @param {String} [flags] + * @param {String} [description] + * @return {Command} for chaining + * @api public + */ + +Command.prototype.version = function(str, flags, description) { + if (arguments.length === 0) return this._version; + this._version = str; + flags = flags || '-V, --version'; + description = description || 'output the version number'; + var versionOption = new Option(flags, description); + this._versionOptionName = versionOption.long.substr(2) || 'version'; + this.options.push(versionOption); + var self = this; + this.on('option:' + this._versionOptionName, function() { + process.stdout.write(str + '\n'); + self._exit(0, 'commander.version', str); + }); + return this; +}; + +/** + * Set the description to `str`. + * + * @param {String} str + * @param {Object} [argsDescription] + * @return {String|Command} + * @api public + */ + +Command.prototype.description = function(str, argsDescription) { + if (arguments.length === 0) return this._description; + this._description = str; + this._argsDescription = argsDescription; + return this; +}; + +/** + * Set an alias for the command + * + * @param {String} alias + * @return {String|Command} + * @api public + */ + +Command.prototype.alias = function(alias) { + var command = this; + if (this.commands.length !== 0) { + command = this.commands[this.commands.length - 1]; + } + + if (arguments.length === 0) return command._alias; + + if (alias === command._name) throw new Error('Command alias can\'t be the same as its name'); + + command._alias = alias; + return this; +}; + +/** + * Set / get the command usage `str`. + * + * @param {String} [str] + * @return {String|Command} + * @api public + */ + +Command.prototype.usage = function(str) { + var args = this._args.map(function(arg) { + return humanReadableArgName(arg); + }); + + var usage = '[options]' + + (this.commands.length ? ' [command]' : '') + + (this._args.length ? ' ' + args.join(' ') : ''); + + if (arguments.length === 0) return this._usage || usage; + this._usage = str; + + return this; +}; + +/** + * Get or set the name of the command + * + * @param {String} [str] + * @return {String|Command} + * @api public + */ + +Command.prototype.name = function(str) { + if (arguments.length === 0) return this._name; + this._name = str; + return this; +}; + +/** + * Return prepared commands. + * + * @return {Array} + * @api private + */ + +Command.prototype.prepareCommands = function() { + return this.commands.filter(function(cmd) { + return !cmd._noHelp; + }).map(function(cmd) { + var args = cmd._args.map(function(arg) { + return humanReadableArgName(arg); + }).join(' '); + + return [ + cmd._name + + (cmd._alias ? '|' + cmd._alias : '') + + (cmd.options.length ? ' [options]' : '') + + (args ? ' ' + args : ''), + cmd._description + ]; + }); +}; + +/** + * Return the largest command length. + * + * @return {Number} + * @api private + */ + +Command.prototype.largestCommandLength = function() { + var commands = this.prepareCommands(); + return commands.reduce(function(max, command) { + return Math.max(max, command[0].length); + }, 0); +}; + +/** + * Return the largest option length. + * + * @return {Number} + * @api private + */ + +Command.prototype.largestOptionLength = function() { + var options = [].slice.call(this.options); + options.push({ + flags: this._helpFlags + }); + + return options.reduce(function(max, option) { + return Math.max(max, option.flags.length); + }, 0); +}; + +/** + * Return the largest arg length. + * + * @return {Number} + * @api private + */ + +Command.prototype.largestArgLength = function() { + return this._args.reduce(function(max, arg) { + return Math.max(max, arg.name.length); + }, 0); +}; + +/** + * Return the pad width. + * + * @return {Number} + * @api private + */ + +Command.prototype.padWidth = function() { + var width = this.largestOptionLength(); + if (this._argsDescription && this._args.length) { + if (this.largestArgLength() > width) { + width = this.largestArgLength(); + } + } + + if (this.commands && this.commands.length) { + if (this.largestCommandLength() > width) { + width = this.largestCommandLength(); + } + } + + return width; +}; + +/** + * Return help for options. + * + * @return {String} + * @api private + */ + +Command.prototype.optionHelp = function() { + var width = this.padWidth(); + + var columns = process.stdout.columns || 80; + var descriptionWidth = columns - width - 4; + + // Append the help information + return this.options.map(function(option) { + const fullDesc = option.description + + ((!option.negate && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : ''); + return pad(option.flags, width) + ' ' + optionalWrap(fullDesc, descriptionWidth, width + 2); + }).concat([pad(this._helpFlags, width) + ' ' + optionalWrap(this._helpDescription, descriptionWidth, width + 2)]) + .join('\n'); +}; + +/** + * Return command help documentation. + * + * @return {String} + * @api private + */ + +Command.prototype.commandHelp = function() { + if (!this.commands.length) return ''; + + var commands = this.prepareCommands(); + var width = this.padWidth(); + + var columns = process.stdout.columns || 80; + var descriptionWidth = columns - width - 4; + + return [ + 'Commands:', + commands.map(function(cmd) { + var desc = cmd[1] ? ' ' + cmd[1] : ''; + return (desc ? pad(cmd[0], width) : cmd[0]) + optionalWrap(desc, descriptionWidth, width + 2); + }).join('\n').replace(/^/gm, ' '), + '' + ].join('\n'); +}; + +/** + * Return program help documentation. + * + * @return {String} + * @api private + */ + +Command.prototype.helpInformation = function() { + var desc = []; + if (this._description) { + desc = [ + this._description, + '' + ]; + + var argsDescription = this._argsDescription; + if (argsDescription && this._args.length) { + var width = this.padWidth(); + var columns = process.stdout.columns || 80; + var descriptionWidth = columns - width - 5; + desc.push('Arguments:'); + desc.push(''); + this._args.forEach(function(arg) { + desc.push(' ' + pad(arg.name, width) + ' ' + wrap(argsDescription[arg.name], descriptionWidth, width + 4)); + }); + desc.push(''); + } + } + + var cmdName = this._name; + if (this._alias) { + cmdName = cmdName + '|' + this._alias; + } + var parentCmdNames = ''; + for (var parentCmd = this.parent; parentCmd; parentCmd = parentCmd.parent) { + parentCmdNames = parentCmd.name() + ' ' + parentCmdNames; + } + var usage = [ + 'Usage: ' + parentCmdNames + cmdName + ' ' + this.usage(), + '' + ]; + + var cmds = []; + var commandHelp = this.commandHelp(); + if (commandHelp) cmds = [commandHelp]; + + var options = [ + 'Options:', + '' + this.optionHelp().replace(/^/gm, ' '), + '' + ]; + + return usage + .concat(desc) + .concat(options) + .concat(cmds) + .join('\n'); +}; + +/** + * Output help information for this command. + * + * When listener(s) are available for the helpLongFlag + * those callbacks are invoked. + * + * @api public + */ + +Command.prototype.outputHelp = function(cb) { + if (!cb) { + cb = function(passthru) { + return passthru; + }; + } + const cbOutput = cb(this.helpInformation()); + if (typeof cbOutput !== 'string' && !Buffer.isBuffer(cbOutput)) { + throw new Error('outputHelp callback must return a string or a Buffer'); + } + process.stdout.write(cbOutput); + this.emit(this._helpLongFlag); +}; + +/** + * You can pass in flags and a description to override the help + * flags and help description for your command. + * + * @param {String} [flags] + * @param {String} [description] + * @return {Command} + * @api public + */ + +Command.prototype.helpOption = function(flags, description) { + this._helpFlags = flags || this._helpFlags; + this._helpDescription = description || this._helpDescription; + + var splitFlags = this._helpFlags.split(/[ ,|]+/); + + if (splitFlags.length > 1) this._helpShortFlag = splitFlags.shift(); + + this._helpLongFlag = splitFlags.shift(); + + return this; +}; + +/** + * Output help information and exit. + * + * @param {Function} [cb] + * @api public + */ + +Command.prototype.help = function(cb) { + this.outputHelp(cb); + // exitCode: preserving original behaviour which was calling process.exit() + // message: do not have all displayed text available so only passing placeholder. + this._exit(process.exitCode || 0, 'commander.help', '(outputHelp)'); +}; + +/** + * Camel-case the given `flag` + * + * @param {String} flag + * @return {String} + * @api private + */ + +function camelcase(flag) { + return flag.split('-').reduce(function(str, word) { + return str + word[0].toUpperCase() + word.slice(1); + }); +} + +/** + * Pad `str` to `width`. + * + * @param {String} str + * @param {Number} width + * @return {String} + * @api private + */ + +function pad(str, width) { + var len = Math.max(0, width - str.length); + return str + Array(len + 1).join(' '); +} + +/** + * Wraps the given string with line breaks at the specified width while breaking + * words and indenting every but the first line on the left. + * + * @param {String} str + * @param {Number} width + * @param {Number} indent + * @return {String} + * @api private + */ +function wrap(str, width, indent) { + var regex = new RegExp('.{1,' + (width - 1) + '}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)', 'g'); + var lines = str.match(regex) || []; + return lines.map(function(line, i) { + if (line.slice(-1) === '\n') { + line = line.slice(0, line.length - 1); + } + return ((i > 0 && indent) ? Array(indent + 1).join(' ') : '') + line.trimRight(); + }).join('\n'); +} + +/** + * Optionally wrap the given str to a max width of width characters per line + * while indenting with indent spaces. Do not wrap if insufficient width or + * string is manually formatted. + * + * @param {String} str + * @param {Number} width + * @param {Number} indent + * @return {String} + * @api private + */ +function optionalWrap(str, width, indent) { + // Detect manually wrapped and indented strings by searching for line breaks + // followed by multiple spaces/tabs. + if (str.match(/[\n]\s+/)) return str; + // Do not wrap to narrow columns (or can end up with a word per line). + const minWidth = 40; + if (width < minWidth) return str; + + return wrap(str, width, indent); +} + +/** + * Output help information if help flags specified + * + * @param {Command} cmd - command to output help for + * @param {Array} options - array of options to search for -h or --help + * @api private + */ + +function outputHelpIfRequested(cmd, options) { + options = options || []; + + for (var i = 0; i < options.length; i++) { + if (options[i] === cmd._helpLongFlag || options[i] === cmd._helpShortFlag) { + cmd.outputHelp(); + // (Do not have all displayed text available so only passing placeholder.) + cmd._exit(0, 'commander.helpDisplayed', '(outputHelp)'); + } + } +} + +/** + * Takes an argument and returns its human readable equivalent for help usage. + * + * @param {Object} arg + * @return {String} + * @api private + */ + +function humanReadableArgName(arg) { + var nameOutput = arg.name + (arg.variadic === true ? '...' : ''); + + return arg.required + ? '<' + nameOutput + '>' + : '[' + nameOutput + ']'; +} + +// for versions before node v0.8 when there weren't `fs.existsSync` +function exists(file) { + try { + if (fs.statSync(file).isFile()) { + return true; + } + } catch (e) { + return false; + } +} + +/** + * Scan arguments and increment port number for inspect calls (to avoid conflicts when spawning new command). + * + * @param {string[]} args - array of arguments from node.execArgv + * @returns {string[]} + * @api private + */ + +function incrementNodeInspectorPort(args) { + // Testing for these options: + // --inspect[=[host:]port] + // --inspect-brk[=[host:]port] + // --inspect-port=[host:]port + return args.map((arg) => { + var result = arg; + if (arg.indexOf('--inspect') === 0) { + var debugOption; + var debugHost = '127.0.0.1'; + var debugPort = '9229'; + var match; + if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) { + // e.g. --inspect + debugOption = match[1]; + } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) { + debugOption = match[1]; + if (/^\d+$/.test(match[3])) { + // e.g. --inspect=1234 + debugPort = match[3]; + } else { + // e.g. --inspect=localhost + debugHost = match[3]; + } + } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) { + // e.g. --inspect=localhost:1234 + debugOption = match[1]; + debugHost = match[3]; + debugPort = match[4]; + } + + if (debugOption && debugPort !== '0') { + result = `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`; + } + } + return result; + }); +} diff --git a/node_modules/commander/package.json b/node_modules/commander/package.json new file mode 100644 index 00000000..e4781e5b --- /dev/null +++ b/node_modules/commander/package.json @@ -0,0 +1,41 @@ +{ + "name": "commander", + "version": "4.1.1", + "description": "the complete solution for node.js command-line programs", + "keywords": [ + "commander", + "command", + "option", + "parser" + ], + "author": "TJ Holowaychuk ", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/tj/commander.js.git" + }, + "scripts": { + "lint": "eslint index.js \"tests/**/*.js\"", + "test": "jest && npm run test-typings", + "test-typings": "tsc -p tsconfig.json" + }, + "main": "index", + "files": [ + "index.js", + "typings/index.d.ts" + ], + "dependencies": {}, + "devDependencies": { + "@types/jest": "^24.0.23", + "@types/node": "^12.12.11", + "eslint": "^6.7.0", + "eslint-plugin-jest": "^22.21.0", + "jest": "^24.8.0", + "standard": "^14.3.1", + "typescript": "^3.7.2" + }, + "typings": "typings/index.d.ts", + "engines": { + "node": ">= 6" + } +} diff --git a/node_modules/commander/typings/index.d.ts b/node_modules/commander/typings/index.d.ts new file mode 100644 index 00000000..082a3a3c --- /dev/null +++ b/node_modules/commander/typings/index.d.ts @@ -0,0 +1,311 @@ +// Type definitions for commander +// Original definitions by: Alan Agius , Marcelo Dezem , vvakame , Jules Randolph + +/// + +declare namespace commander { + + interface CommanderError extends Error { + code: string; + exitCode: number; + message: string; + nestedError?: string; + } + type CommanderErrorConstructor = { new (exitCode: number, code: string, message: string): CommanderError }; + + interface Option { + flags: string; + required: boolean; // A value must be supplied when the option is specified. + optional: boolean; // A value is optional when the option is specified. + mandatory: boolean; // The option must have a value after parsing, which usually means it must be specified on command line. + bool: boolean; + short?: string; + long: string; + description: string; + } + type OptionConstructor = { new (flags: string, description?: string): Option }; + + interface Command extends NodeJS.EventEmitter { + [key: string]: any; // options as properties + + args: string[]; + + /** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * You can optionally supply the flags and description to override the defaults. + */ + version(str: string, flags?: string, description?: string): Command; + + /** + * Define a command, implemented using an action handler. + * + * @remarks + * The command description is supplied using `.description`, not as a parameter to `.command`. + * + * @example + * ```ts + * program + * .command('clone [destination]') + * .description('clone a repository into a newly created directory') + * .action((source, destination) => { + * console.log('clone command called'); + * }); + * ``` + * + * @param nameAndArgs - command name and arguments, args are `` or `[optional]` and last may also be `variadic...` + * @param opts - configuration options + * @returns new command + */ + command(nameAndArgs: string, opts?: CommandOptions): Command; + /** + * Define a command, implemented in a separate executable file. + * + * @remarks + * The command description is supplied as the second parameter to `.command`. + * + * @example + * ```ts + * program + * .command('start ', 'start named service') + * .command('stop [service]', 'stop named serice, or all if no name supplied'); + * ``` + * + * @param nameAndArgs - command name and arguments, args are `` or `[optional]` and last may also be `variadic...` + * @param description - description of executable command + * @param opts - configuration options + * @returns top level command for chaining more command definitions + */ + command(nameAndArgs: string, description: string, opts?: commander.CommandOptions): Command; + + /** + * Define argument syntax for the top-level command. + * + * @returns Command for chaining + */ + arguments(desc: string): Command; + + /** + * Parse expected `args`. + * + * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. + * + * @returns Command for chaining + */ + parseExpectedArgs(args: string[]): Command; + + /** + * Register callback to use as replacement for calling process.exit. + */ + exitOverride(callback?: (err: CommanderError) => never|void): Command; + + /** + * Register callback `fn` for the command. + * + * @example + * program + * .command('help') + * .description('display verbose help') + * .action(function() { + * // output help here + * }); + * + * @returns Command for chaining + */ + action(fn: (...args: any[]) => void | Promise): Command; + + /** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string should contain both the short and long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * @example + * // simple boolean defaulting to false + * program.option('-p, --pepper', 'add pepper'); + * + * --pepper + * program.pepper + * // => Boolean + * + * // simple boolean defaulting to true + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => false + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @returns Command for chaining + */ + option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command; + option(flags: string, description?: string, defaultValue?: any): Command; + + /** + * Define a required option, which must have a value after parsing. This usually means + * the option must be specified on the command line. (Otherwise the same as .option().) + * + * The `flags` string should contain both the short and long flags, separated by comma, a pipe or space. + */ + requiredOption(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command; + requiredOption(flags: string, description?: string, defaultValue?: any): Command; + + + /** + * Whether to store option values as properties on command object, + * or store separately (specify false). In both cases the option values can be accessed using .opts(). + * + * @return Command for chaining + */ + storeOptionsAsProperties(value?: boolean): Command; + + /** + * Whether to pass command to action handler, + * or just the options (specify false). + * + * @return Command for chaining + */ + passCommandToAction(value?: boolean): Command; + + /** + * Allow unknown options on the command line. + * + * @param [arg] if `true` or omitted, no error will be thrown for unknown options. + * @returns Command for chaining + */ + allowUnknownOption(arg?: boolean): Command; + + /** + * Parse `argv`, setting options and invoking commands when defined. + * + * @returns Command for chaining + */ + parse(argv: string[]): Command; + + /** + * Parse `argv`, setting options and invoking commands when defined. + * + * Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise. + * + * @returns Promise + */ + parseAsync(argv: string[]): Promise; + + /** + * Parse options from `argv` returning `argv` void of these options. + */ + parseOptions(argv: string[]): commander.ParseOptionsResult; + + /** + * Return an object containing options as key-value pairs + */ + opts(): { [key: string]: any }; + + /** + * Set the description. + * + * @returns Command for chaining + */ + description(str: string, argsDescription?: {[argName: string]: string}): Command; + /** + * Get the description. + */ + description(): string; + + /** + * Set an alias for the command. + * + * @returns Command for chaining + */ + alias(alias: string): Command; + /** + * Get alias for the command. + */ + alias(): string; + + /** + * Set the command usage. + * + * @returns Command for chaining + */ + usage(str: string): Command; + /** + * Get the command usage. + */ + usage(): string; + + /** + * Set the name of the command. + * + * @returns Command for chaining + */ + name(str: string): Command; + /** + * Get the name of the command. + */ + name(): string; + + /** + * Output help information for this command. + * + * When listener(s) are available for the helpLongFlag + * those callbacks are invoked. + */ + outputHelp(cb?: (str: string) => string): void; + + /** + * You can pass in flags and a description to override the help + * flags and help description for your command. + */ + helpOption(flags?: string, description?: string): Command; + + /** + * Output help information and exit. + */ + help(cb?: (str: string) => string): never; + } + type CommandConstructor = { new (name?: string): Command }; + + + interface CommandOptions { + noHelp?: boolean; + isDefault?: boolean; + executableFile?: string; + } + + interface ParseOptionsResult { + args: string[]; + unknown: string[]; + } + + interface CommanderStatic extends Command { + Command: CommandConstructor; + Option: OptionConstructor; + CommanderError:CommanderErrorConstructor; + } + +} + +declare const commander: commander.CommanderStatic; +export = commander; diff --git a/node_modules/commondir/LICENSE b/node_modules/commondir/LICENSE new file mode 100644 index 00000000..3d59c733 --- /dev/null +++ b/node_modules/commondir/LICENSE @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2013 James Halliday (mail@substack.net) + +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. \ No newline at end of file diff --git a/node_modules/commondir/example/dir.js b/node_modules/commondir/example/dir.js new file mode 100644 index 00000000..e86a3464 --- /dev/null +++ b/node_modules/commondir/example/dir.js @@ -0,0 +1,3 @@ +var commondir = require('../'); +var dir = commondir(process.argv.slice(2)); +console.log(dir); diff --git a/node_modules/commondir/index.js b/node_modules/commondir/index.js new file mode 100644 index 00000000..fa77d045 --- /dev/null +++ b/node_modules/commondir/index.js @@ -0,0 +1,29 @@ +var path = require('path'); + +module.exports = function (basedir, relfiles) { + if (relfiles) { + var files = relfiles.map(function (r) { + return path.resolve(basedir, r); + }); + } + else { + var files = basedir; + } + + var res = files.slice(1).reduce(function (ps, file) { + if (!file.match(/^([A-Za-z]:)?\/|\\/)) { + throw new Error('relative path without a basedir'); + } + + var xs = file.split(/\/+|\\+/); + for ( + var i = 0; + ps[i] === xs[i] && i < Math.min(ps.length, xs.length); + i++ + ); + return ps.slice(0, i); + }, files[0].split(/\/+|\\+/)); + + // Windows correctly handles paths with forward-slashes + return res.length > 1 ? res.join('/') : '/' +}; diff --git a/node_modules/commondir/package.json b/node_modules/commondir/package.json new file mode 100644 index 00000000..7320d956 --- /dev/null +++ b/node_modules/commondir/package.json @@ -0,0 +1,34 @@ +{ + "name": "commondir", + "version": "1.0.1", + "description": "compute the closest common parent for file paths", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "tape": "^3.5.0" + }, + "scripts": { + "test": "tape test/*.js" + }, + "repository": { + "type": "git", + "url": "http://github.com/substack/node-commondir.git" + }, + "keywords": [ + "common", + "path", + "directory", + "file", + "parent", + "root" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT", + "engine": { + "node": ">=0.4" + } +} diff --git a/node_modules/commondir/readme.markdown b/node_modules/commondir/readme.markdown new file mode 100644 index 00000000..6c20607f --- /dev/null +++ b/node_modules/commondir/readme.markdown @@ -0,0 +1,48 @@ +# commondir + +compute the closest common parent directory among an array of directories + +# example + +``` js +var commondir = require('commondir'); +var dir = commondir(process.argv.slice(2)) +console.log(dir); +``` + +output: + +``` +$ node dir.js /x/y/z /x/y /x/y/w/q +/x/y +$ node ../baz ../../foo/quux ./bizzy +/foo +``` + +# methods + +``` js +var commondir = require('commondir'); +``` + +## commondir(absolutePaths) + +Compute the closest common parent directory for an array `absolutePaths`. + +## commondir(basedir, relativePaths) + +Compute the closest common parent directory for an array `relativePaths` which +will be resolved for each `dir` in `relativePaths` according to: +`path.resolve(basedir, dir)`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install commondir +``` + +# license + +MIT diff --git a/node_modules/commondir/test/dirs.js b/node_modules/commondir/test/dirs.js new file mode 100644 index 00000000..7e55c9bb --- /dev/null +++ b/node_modules/commondir/test/dirs.js @@ -0,0 +1,55 @@ +var test = require('tape'); +var commondir = require('../'); + +test('common', function (t) { + t.equal( + commondir([ '/foo', '//foo/bar', '/foo//bar/baz' ]), + '/foo' + ); + t.equal( + commondir([ '/a/b/c', '/a/b', '/a/b/c/d/e' ]), + '/a/b' + ); + t.equal( + commondir([ '/x/y/z/w', '/xy/z', '/x/y/z' ]), + '/' + ); + t.equal( + commondir([ 'X:\\foo', 'X:\\\\foo\\bar', 'X://foo/bar/baz' ]), + 'X:/foo' + ); + t.equal( + commondir([ 'X:\\a\\b\\c', 'X:\\a\\b', 'X:\\a\\b\\c\\d\\e' ]), + 'X:/a/b' + ); + t.equal( + commondir([ 'X:\\x\\y\\z\\w', '\\\\xy\\z', '\\x\\y\\z' ]), + '/' + ); + t.throws(function () { + commondir([ '/x/y/z/w', 'qrs', '/x/y/z' ]); + }); + t.end(); +}); + +test('base', function (t) { + t.equal( + commondir('/foo/bar', [ 'baz', './quux', '../bar/bazzy' ]), + '/foo/bar' + ); + t.equal( + commondir('/a/b', [ 'c', '../b/.', '../../a/b/e' ]), + '/a/b' + ); + t.equal( + commondir('/a/b/c', [ '..', '../d', '../../a/z/e' ]), + '/a' + ); + t.equal( + commondir('/foo/bar', [ 'baz', '.\\quux', '..\\bar\\bazzy' ]), + '/foo/bar' + ); + // Tests including X:\ basedirs must wait until path.resolve supports + // Windows-style paths, starting in Node.js v0.5.X + t.end(); +}); diff --git a/node_modules/concat-map/.travis.yml b/node_modules/concat-map/.travis.yml new file mode 100644 index 00000000..f1d0f13c --- /dev/null +++ b/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/concat-map/LICENSE b/node_modules/concat-map/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +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/README.markdown b/node_modules/concat-map/README.markdown new file mode 100644 index 00000000..408f70a1 --- /dev/null +++ b/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +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); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/node_modules/concat-map/example/map.js b/node_modules/concat-map/example/map.js new file mode 100644 index 00000000..33656217 --- /dev/null +++ b/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +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 new file mode 100644 index 00000000..b29a7812 --- /dev/null +++ b/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +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 new file mode 100644 index 00000000..d3640e6b --- /dev/null +++ b/node_modules/concat-map/package.json @@ -0,0 +1,43 @@ +{ + "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 new file mode 100644 index 00000000..fdbd7022 --- /dev/null +++ b/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +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/cookie/HISTORY.md b/node_modules/cookie/HISTORY.md new file mode 100644 index 00000000..41ae4b01 --- /dev/null +++ b/node_modules/cookie/HISTORY.md @@ -0,0 +1,147 @@ +0.6.0 / 2023-11-06 +================== + + * Add `partitioned` option + +0.5.0 / 2022-04-11 +================== + + * Add `priority` option + * Fix `expires` option to reject invalid dates + * perf: improve default decode speed + * perf: remove slow string split in parse + +0.4.2 / 2022-02-02 +================== + + * perf: read value only when assigning in parse + * perf: remove unnecessary regexp in parse + +0.4.1 / 2020-04-21 +================== + + * Fix `maxAge` option to reject invalid values + +0.4.0 / 2019-05-15 +================== + + * Add `SameSite=None` support + +0.3.1 / 2016-05-26 +================== + + * Fix `sameSite: true` to work with draft-7 clients + - `true` now sends `SameSite=Strict` instead of `SameSite` + +0.3.0 / 2016-05-26 +================== + + * Add `sameSite` option + - Replaces `firstPartyOnly` option, never implemented by browsers + * Improve error message when `encode` is not a function + * Improve error message when `expires` is not a `Date` + +0.2.4 / 2016-05-20 +================== + + * perf: enable strict mode + * perf: use for loop in parse + * perf: use string concatenation for serialization + +0.2.3 / 2015-10-25 +================== + + * Fix cookie `Max-Age` to never be a floating point number + +0.2.2 / 2015-09-17 +================== + + * Fix regression when setting empty cookie value + - Ease the new restriction, which is just basic header-level validation + * Fix typo in invalid value errors + +0.2.1 / 2015-09-17 +================== + + * Throw on invalid values provided to `serialize` + - Ensures the resulting string is a valid HTTP header value + +0.2.0 / 2015-08-13 +================== + + * Add `firstPartyOnly` option + * Throw better error for invalid argument to parse + * perf: hoist regular expression + +0.1.5 / 2015-09-17 +================== + + * Fix regression when setting empty cookie value + - Ease the new restriction, which is just basic header-level validation + * Fix typo in invalid value errors + +0.1.4 / 2015-09-17 +================== + + * Throw better error for invalid argument to parse + * Throw on invalid values provided to `serialize` + - Ensures the resulting string is a valid HTTP header value + +0.1.3 / 2015-05-19 +================== + + * Reduce the scope of try-catch deopt + * Remove argument reassignments + +0.1.2 / 2014-04-16 +================== + + * Remove unnecessary files from npm package + +0.1.1 / 2014-02-23 +================== + + * Fix bad parse when cookie value contained a comma + * Fix support for `maxAge` of `0` + +0.1.0 / 2013-05-01 +================== + + * Add `decode` option + * Add `encode` option + +0.0.6 / 2013-04-08 +================== + + * Ignore cookie parts missing `=` + +0.0.5 / 2012-10-29 +================== + + * Return raw cookie value if value unescape errors + +0.0.4 / 2012-06-21 +================== + + * Use encode/decodeURIComponent for cookie encoding/decoding + - Improve server/client interoperability + +0.0.3 / 2012-06-06 +================== + + * Only escape special characters per the cookie RFC + +0.0.2 / 2012-06-01 +================== + + * Fix `maxAge` option to not throw error + +0.0.1 / 2012-05-28 +================== + + * Add more tests + +0.0.0 / 2012-05-28 +================== + + * Initial release diff --git a/node_modules/cookie/LICENSE b/node_modules/cookie/LICENSE new file mode 100644 index 00000000..058b6b4e --- /dev/null +++ b/node_modules/cookie/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012-2014 Roman Shtylman +Copyright (c) 2015 Douglas Christopher Wilson + +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/cookie/README.md b/node_modules/cookie/README.md new file mode 100644 index 00000000..71fdac11 --- /dev/null +++ b/node_modules/cookie/README.md @@ -0,0 +1,317 @@ +# cookie + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +Basic HTTP cookie parser and serializer for HTTP servers. + +## Installation + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install cookie +``` + +## API + +```js +var cookie = require('cookie'); +``` + +### cookie.parse(str, options) + +Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs. +The `str` argument is the string representing a `Cookie` header value and `options` is an +optional object containing additional parsing options. + +```js +var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2'); +// { foo: 'bar', equation: 'E=mc^2' } +``` + +#### Options + +`cookie.parse` accepts these properties in the options object. + +##### decode + +Specifies a function that will be used to decode a cookie's value. Since the value of a cookie +has a limited character set (and must be a simple string), this function can be used to decode +a previously-encoded cookie value into a JavaScript string or other object. + +The default function is the global `decodeURIComponent`, which will decode any URL-encoded +sequences into their byte representations. + +**note** if an error is thrown from this function, the original, non-decoded cookie value will +be returned as the cookie's value. + +### cookie.serialize(name, value, options) + +Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the +name for the cookie, the `value` argument is the value to set the cookie to, and the `options` +argument is an optional object containing additional serialization options. + +```js +var setCookie = cookie.serialize('foo', 'bar'); +// foo=bar +``` + +#### Options + +`cookie.serialize` accepts these properties in the options object. + +##### domain + +Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6265-5.2.3]. By default, no +domain is set, and most clients will consider the cookie to apply to only the current domain. + +##### encode + +Specifies a function that will be used to encode a cookie's value. Since value of a cookie +has a limited character set (and must be a simple string), this function can be used to encode +a value into a string suited for a cookie's value. + +The default function is the global `encodeURIComponent`, which will encode a JavaScript string +into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range. + +##### expires + +Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6265-5.2.1]. +By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and +will delete it on a condition like exiting a web browser application. + +**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### httpOnly + +Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6265-5.2.6]. When truthy, +the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not allow client-side +JavaScript to see the cookie in `document.cookie`. + +##### maxAge + +Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6265-5.2.2]. +The given number will be converted to an integer by rounding down. By default, no maximum age is set. + +**note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +##### partitioned + +Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies) +attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the +`Partitioned` attribute is not set. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +More information about can be found in [the proposal](https://github.com/privacycg/CHIPS). + +##### path + +Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path +is considered the ["default path"][rfc-6265-5.1.4]. + +##### priority + +Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1]. + + - `'low'` will set the `Priority` attribute to `Low`. + - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. + - `'high'` will set the `Priority` attribute to `High`. + +More information about the different priority levels can be found in +[the specification][rfc-west-cookie-priority-00-4.1]. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +##### sameSite + +Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][rfc-6265bis-09-5.4.7]. + + - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + - `false` will not set the `SameSite` attribute. + - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. + - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie. + - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + +More information about the different enforcement levels can be found in +[the specification][rfc-6265bis-09-5.4.7]. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +##### secure + +Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6265-5.2.5]. When truthy, +the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. + +**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to +the server in the future if the browser does not have an HTTPS connection. + +## Example + +The following example uses this module in conjunction with the Node.js core HTTP server +to prompt a user for their name and display it back on future visits. + +```js +var cookie = require('cookie'); +var escapeHtml = require('escape-html'); +var http = require('http'); +var url = require('url'); + +function onRequest(req, res) { + // Parse the query string + var query = url.parse(req.url, true, true).query; + + if (query && query.name) { + // Set a new cookie with the name + res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), { + httpOnly: true, + maxAge: 60 * 60 * 24 * 7 // 1 week + })); + + // Redirect back after setting cookie + res.statusCode = 302; + res.setHeader('Location', req.headers.referer || '/'); + res.end(); + return; + } + + // Parse the cookies on the request + var cookies = cookie.parse(req.headers.cookie || ''); + + // Get the visitor name set in the cookie + var name = cookies.name; + + res.setHeader('Content-Type', 'text/html; charset=UTF-8'); + + if (name) { + res.write('

Welcome back, ' + escapeHtml(name) + '!

'); + } else { + res.write('

Hello, new visitor!

'); + } + + res.write('
'); + res.write(' '); + res.end('
'); +} + +http.createServer(onRequest).listen(3000); +``` + +## Testing + +```sh +$ npm test +``` + +## Benchmark + +``` +$ npm run bench + +> cookie@0.5.0 bench +> node benchmark/index.js + + node@18.18.2 + acorn@8.10.0 + ada@2.6.0 + ares@1.19.1 + brotli@1.0.9 + cldr@43.1 + icu@73.2 + llhttp@6.0.11 + modules@108 + napi@9 + nghttp2@1.57.0 + nghttp3@0.7.0 + ngtcp2@0.8.1 + openssl@3.0.10+quic + simdutf@3.2.14 + tz@2023c + undici@5.26.3 + unicode@15.0 + uv@1.44.2 + uvwasi@0.0.18 + v8@10.2.154.26-node.26 + zlib@1.2.13.1-motley + +> node benchmark/parse-top.js + + cookie.parse - top sites + + 14 tests completed. + + parse accounts.google.com x 2,588,913 ops/sec ±0.74% (186 runs sampled) + parse apple.com x 2,370,002 ops/sec ±0.69% (186 runs sampled) + parse cloudflare.com x 2,213,102 ops/sec ±0.88% (188 runs sampled) + parse docs.google.com x 2,194,157 ops/sec ±1.03% (184 runs sampled) + parse drive.google.com x 2,265,084 ops/sec ±0.79% (187 runs sampled) + parse en.wikipedia.org x 457,099 ops/sec ±0.81% (186 runs sampled) + parse linkedin.com x 504,407 ops/sec ±0.89% (186 runs sampled) + parse maps.google.com x 1,230,959 ops/sec ±0.98% (186 runs sampled) + parse microsoft.com x 926,294 ops/sec ±0.88% (184 runs sampled) + parse play.google.com x 2,311,338 ops/sec ±0.83% (185 runs sampled) + parse support.google.com x 1,508,850 ops/sec ±0.86% (186 runs sampled) + parse www.google.com x 1,022,582 ops/sec ±1.32% (182 runs sampled) + parse youtu.be x 332,136 ops/sec ±1.02% (185 runs sampled) + parse youtube.com x 323,833 ops/sec ±0.77% (183 runs sampled) + +> node benchmark/parse.js + + cookie.parse - generic + + 6 tests completed. + + simple x 3,214,032 ops/sec ±1.61% (183 runs sampled) + decode x 587,237 ops/sec ±1.16% (187 runs sampled) + unquote x 2,954,618 ops/sec ±1.35% (183 runs sampled) + duplicates x 857,008 ops/sec ±0.89% (187 runs sampled) + 10 cookies x 292,133 ops/sec ±0.89% (187 runs sampled) + 100 cookies x 22,610 ops/sec ±0.68% (187 runs sampled) +``` + +## References + +- [RFC 6265: HTTP State Management Mechanism][rfc-6265] +- [Same-site Cookies][rfc-6265bis-09-5.4.7] + +[rfc-cutler-httpbis-partitioned-cookies]: https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/ +[rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1 +[rfc-6265bis-09-5.4.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7 +[rfc-6265]: https://tools.ietf.org/html/rfc6265 +[rfc-6265-5.1.4]: https://tools.ietf.org/html/rfc6265#section-5.1.4 +[rfc-6265-5.2.1]: https://tools.ietf.org/html/rfc6265#section-5.2.1 +[rfc-6265-5.2.2]: https://tools.ietf.org/html/rfc6265#section-5.2.2 +[rfc-6265-5.2.3]: https://tools.ietf.org/html/rfc6265#section-5.2.3 +[rfc-6265-5.2.4]: https://tools.ietf.org/html/rfc6265#section-5.2.4 +[rfc-6265-5.2.5]: https://tools.ietf.org/html/rfc6265#section-5.2.5 +[rfc-6265-5.2.6]: https://tools.ietf.org/html/rfc6265#section-5.2.6 +[rfc-6265-5.3]: https://tools.ietf.org/html/rfc6265#section-5.3 + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/cookie/master?label=ci +[ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master +[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master +[node-image]: https://badgen.net/npm/node/cookie +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/cookie +[npm-url]: https://npmjs.org/package/cookie +[npm-version-image]: https://badgen.net/npm/v/cookie diff --git a/node_modules/cookie/SECURITY.md b/node_modules/cookie/SECURITY.md new file mode 100644 index 00000000..fd4a6c53 --- /dev/null +++ b/node_modules/cookie/SECURITY.md @@ -0,0 +1,25 @@ +# Security Policies and Procedures + +## Reporting a Bug + +The `cookie` team and community take all security bugs seriously. Thank +you for improving the security of the project. We appreciate your efforts and +responsible disclosure and will make every effort to acknowledge your +contributions. + +Report security bugs by emailing the current owner(s) of `cookie`. This +information can be found in the npm registry using the command +`npm owner ls cookie`. +If unsure or unable to get the information from the above, open an issue +in the [project issue tracker](https://github.com/jshttp/cookie/issues) +asking for the current contact information. + +To ensure the timely response to your report, please ensure that the entirety +of the report is contained within the email body and not solely behind a web +link or an attachment. + +At least one owner will acknowledge your email within 48 hours, and will send a +more detailed response within 48 hours indicating the next steps in handling +your report. After the initial reply to your report, the owners will +endeavor to keep you informed of the progress towards a fix and full +announcement, and may ask for additional information or guidance. diff --git a/node_modules/cookie/index.js b/node_modules/cookie/index.js new file mode 100644 index 00000000..03d4c386 --- /dev/null +++ b/node_modules/cookie/index.js @@ -0,0 +1,274 @@ +/*! + * cookie + * Copyright(c) 2012-2014 Roman Shtylman + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +exports.parse = parse; +exports.serialize = serialize; + +/** + * Module variables. + * @private + */ + +var __toString = Object.prototype.toString + +/** + * RegExp to match field-content in RFC 7230 sec 3.2 + * + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + * obs-text = %x80-FF + */ + +var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/; + +/** + * Parse a cookie header. + * + * Parse the given cookie header string into an object + * The object has the various cookies as keys(names) => values + * + * @param {string} str + * @param {object} [options] + * @return {object} + * @public + */ + +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + + var obj = {} + var opt = options || {}; + var dec = opt.decode || decode; + + var index = 0 + while (index < str.length) { + var eqIdx = str.indexOf('=', index) + + // no more cookie pairs + if (eqIdx === -1) { + break + } + + var endIdx = str.indexOf(';', index) + + if (endIdx === -1) { + endIdx = str.length + } else if (endIdx < eqIdx) { + // backtrack on prior semicolon + index = str.lastIndexOf(';', eqIdx - 1) + 1 + continue + } + + var key = str.slice(index, eqIdx).trim() + + // only assign once + if (undefined === obj[key]) { + var val = str.slice(eqIdx + 1, endIdx).trim() + + // quoted values + if (val.charCodeAt(0) === 0x22) { + val = val.slice(1, -1) + } + + obj[key] = tryDecode(val, dec); + } + + index = endIdx + 1 + } + + return obj; +} + +/** + * Serialize data into a cookie header. + * + * Serialize the a name value pair into a cookie string suitable for + * http headers. An optional options object specified cookie parameters. + * + * serialize('foo', 'bar', { httpOnly: true }) + * => "foo=bar; httpOnly" + * + * @param {string} name + * @param {string} val + * @param {object} [options] + * @return {string} + * @public + */ + +function serialize(name, val, options) { + var opt = options || {}; + var enc = opt.encode || encode; + + if (typeof enc !== 'function') { + throw new TypeError('option encode is invalid'); + } + + if (!fieldContentRegExp.test(name)) { + throw new TypeError('argument name is invalid'); + } + + var value = enc(val); + + if (value && !fieldContentRegExp.test(value)) { + throw new TypeError('argument val is invalid'); + } + + var str = name + '=' + value; + + if (null != opt.maxAge) { + var maxAge = opt.maxAge - 0; + + if (isNaN(maxAge) || !isFinite(maxAge)) { + throw new TypeError('option maxAge is invalid') + } + + str += '; Max-Age=' + Math.floor(maxAge); + } + + if (opt.domain) { + if (!fieldContentRegExp.test(opt.domain)) { + throw new TypeError('option domain is invalid'); + } + + str += '; Domain=' + opt.domain; + } + + if (opt.path) { + if (!fieldContentRegExp.test(opt.path)) { + throw new TypeError('option path is invalid'); + } + + str += '; Path=' + opt.path; + } + + if (opt.expires) { + var expires = opt.expires + + if (!isDate(expires) || isNaN(expires.valueOf())) { + throw new TypeError('option expires is invalid'); + } + + str += '; Expires=' + expires.toUTCString() + } + + if (opt.httpOnly) { + str += '; HttpOnly'; + } + + if (opt.secure) { + str += '; Secure'; + } + + if (opt.partitioned) { + str += '; Partitioned' + } + + if (opt.priority) { + var priority = typeof opt.priority === 'string' + ? opt.priority.toLowerCase() + : opt.priority + + switch (priority) { + case 'low': + str += '; Priority=Low' + break + case 'medium': + str += '; Priority=Medium' + break + case 'high': + str += '; Priority=High' + break + default: + throw new TypeError('option priority is invalid') + } + } + + if (opt.sameSite) { + var sameSite = typeof opt.sameSite === 'string' + ? opt.sameSite.toLowerCase() : opt.sameSite; + + switch (sameSite) { + case true: + str += '; SameSite=Strict'; + break; + case 'lax': + str += '; SameSite=Lax'; + break; + case 'strict': + str += '; SameSite=Strict'; + break; + case 'none': + str += '; SameSite=None'; + break; + default: + throw new TypeError('option sameSite is invalid'); + } + } + + return str; +} + +/** + * URL-decode string value. Optimized to skip native call when no %. + * + * @param {string} str + * @returns {string} + */ + +function decode (str) { + return str.indexOf('%') !== -1 + ? decodeURIComponent(str) + : str +} + +/** + * URL-encode value. + * + * @param {string} val + * @returns {string} + */ + +function encode (val) { + return encodeURIComponent(val) +} + +/** + * Determine if value is a Date. + * + * @param {*} val + * @private + */ + +function isDate (val) { + return __toString.call(val) === '[object Date]' || + val instanceof Date +} + +/** + * Try decoding a string using a decoding function. + * + * @param {string} str + * @param {function} decode + * @private + */ + +function tryDecode(str, decode) { + try { + return decode(str); + } catch (e) { + return str; + } +} diff --git a/node_modules/cookie/package.json b/node_modules/cookie/package.json new file mode 100644 index 00000000..0c3f0063 --- /dev/null +++ b/node_modules/cookie/package.json @@ -0,0 +1,44 @@ +{ + "name": "cookie", + "description": "HTTP server cookie parsing and serialization", + "version": "0.6.0", + "author": "Roman Shtylman ", + "contributors": [ + "Douglas Christopher Wilson " + ], + "license": "MIT", + "keywords": [ + "cookie", + "cookies" + ], + "repository": "jshttp/cookie", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.4", + "eslint": "8.53.0", + "eslint-plugin-markdown": "3.0.1", + "mocha": "10.2.0", + "nyc": "15.1.0", + "safe-buffer": "5.2.1", + "top-sites": "1.1.194" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "SECURITY.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "update-bench": "node scripts/update-benchmark.js", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/node_modules/css-selector-tokenizer/LICENSE b/node_modules/css-selector-tokenizer/LICENSE new file mode 100644 index 00000000..abdebcdd --- /dev/null +++ b/node_modules/css-selector-tokenizer/LICENSE @@ -0,0 +1,7 @@ +Copyright 2015 Tobias Koppers + +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/css-selector-tokenizer/README.md b/node_modules/css-selector-tokenizer/README.md new file mode 100644 index 00000000..91976c9c --- /dev/null +++ b/node_modules/css-selector-tokenizer/README.md @@ -0,0 +1,92 @@ +# CSS Modules: css-selector-tokenizer +[![Build Status](https://travis-ci.org/css-modules/css-selector-tokenizer.svg?branch=master)](https://travis-ci.org/css-modules/css-selector-tokenizer) +[![coveralls.io](https://coveralls.io/repos/css-modules/css-selector-tokenizer/badge.svg?branch=master)](https://coveralls.io/r/css-modules/css-selector-tokenizer?branch=master) +[![codecov.io](https://codecov.io/github/css-modules/css-selector-tokenizer/coverage.svg?branch=master)](https://codecov.io/github/css-modules/css-selector-tokenizer?branch=master) + +Parses and stringifies CSS selectors. + +``` js +import Tokenizer from "css-selector-tokenizer"; + +let input = "a#content.active > div::first-line [data-content], a:not(:visited)"; + +Tokenizer.parse(input); // === expected +let expected = { + type: "selectors", + nodes: [ + { + type: "selector", + nodes: [ + { type: "element", name: "a" }, + { type: "id", name: "content" }, + { type: "class", name: "active" }, + { type: "operator", operator: ">", before: " ", after: " " }, + { type: "element", name: "div" }, + { type: "pseudo-element", name: "first-line" }, + { type: "spacing", value: " " }, + { type: "attribute", content: "data-content" }, + ] + }, + { + type: "selector", + nodes: [ + { type: "element", name: "a" }, + { type: "nested-pseudo-class", name: "not", nodes: [ + { + type: "selector", + nodes: [ + { type: "pseudo-class", name: "visited" } + ] + } + ] } + ], + before: " " + } + ] +} + +Tokenizer.stringify(expected) // === input + +// * => { type: "universal" } +// foo|element = { type: "element", name: "element", namespace: "foo" } +// *|* = { type: "universal", namespace: "*" } +// :has(h1, h2) => { type: "nested-pseudo-class", name: "has", nodes: [ +// { +// type: "selector", +// nodes: [ +// { type: "element", name: "h1" } +// ] +// }, +// { +// type: "selector", +// nodes: [ +// { type: "element", name: "h2" } +// ], +// before: " " +// } +// ] } +``` + +## Building + +``` +npm install +npm test +``` + +## Development + +- `npm test -- -w` will watch `lib` and `test` for changes and retest + +## License + +MIT + +## With thanks + +- Mark Dalgleish +- Glen Maddern +- Guy Bedford + +--- +Tobias Koppers, 2015. diff --git a/node_modules/css-selector-tokenizer/lib/index.js b/node_modules/css-selector-tokenizer/lib/index.js new file mode 100644 index 00000000..c1caeb8f --- /dev/null +++ b/node_modules/css-selector-tokenizer/lib/index.js @@ -0,0 +1,4 @@ +exports.parse = require("./parse"); +exports.stringify = require("./stringify"); +exports.parseValues = require("./parseValues"); +exports.stringifyValues = require("./stringifyValues"); diff --git a/node_modules/css-selector-tokenizer/lib/parse.js b/node_modules/css-selector-tokenizer/lib/parse.js new file mode 100644 index 00000000..2c3a855f --- /dev/null +++ b/node_modules/css-selector-tokenizer/lib/parse.js @@ -0,0 +1,239 @@ +"use strict"; + +var Parser = require("fastparse"); +var uniRegexp = require("./uni-regexp"); + +function unescape(str) { + return str.replace(/\\(.)/g, "$1"); +} + +function commentMatch(match, content) { + this.selector.nodes.push({ + type: "comment", + content: content + }); +} + +function typeMatch(type) { + return function(match, name) { + this.selector.nodes.push({ + type: type, + name: unescape(name) + }); + }; +} + +function pseudoClassStartMatch(match, name) { + var newToken = { + type: "pseudo-class", + name: unescape(name), + content: "" + }; + this.selector.nodes.push(newToken); + this.token = newToken; + this.brackets = 1; + return "inBrackets"; +} + +function nestedPseudoClassStartMatch(match, name, after) { + var newSelector = { + type: "selector", + nodes: [] + }; + var newToken = { + type: "nested-pseudo-class", + name: unescape(name), + nodes: [newSelector] + }; + if(after) { + newSelector.before = after; + } + this.selector.nodes.push(newToken); + this.stack.push(this.root); + this.root = newToken; + this.selector = newSelector; +} + +function nestedEnd(match, before) { + if(this.stack.length > 0) { + if(before) { + this.selector.after = before; + } + this.root = this.stack.pop(); + this.selector = this.root.nodes[this.root.nodes.length - 1]; + } else { + this.selector.nodes.push({ + type: "invalid", + value: match + }); + } +} + +function operatorMatch(match, before, operator, after) { + var token = { + type: "operator", + operator: operator + }; + if(before) { + token.before = before; + } + if(after) { + token.after = after; + } + this.selector.nodes.push(token); +} + +function spacingMatch(match) { + this.selector.nodes.push({ + type: "spacing", + value: match + }); +} + +function elementMatch(match, namespace, name) { + var newToken = { + type: "element", + name: unescape(name) + }; + + if(namespace) { + newToken.namespace = unescape(namespace.substr(0, namespace.length - 1)); + } + this.selector.nodes.push(newToken); +} + +function universalMatch(match, namespace) { + var newToken = { + type: "universal" + }; + if(namespace) { + newToken.namespace = unescape(namespace.substr(0, namespace.length - 1)); + } + this.selector.nodes.push(newToken); +} + +function attributeMatch(match, content) { + this.selector.nodes.push({ + type: "attribute", + content: content + }); +} + +function invalidMatch(match) { + this.selector.nodes.push({ + type: "invalid", + value: match + }); +} + +function irrelevantSpacingStartMatch(match) { + this.selector.before = match; +} + +function irrelevantSpacingEndMatch(match) { + this.selector.after = match; +} + +function nextSelectorMatch(match, before, after) { + var newSelector = { + type: "selector", + nodes: [] + }; + if(before) { + this.selector.after = before; + } + if(after) { + newSelector.before = after; + } + this.root.nodes.push(newSelector); + this.selector = newSelector; +} + +function addToCurrent(match) { + this.token.content += match; +} + +function bracketStart(match) { + this.token.content += match; + this.brackets++; +} + +function bracketEnd(match) { + if(--this.brackets === 0) { + return "selector"; + } + this.token.content += match; +} + +function getSelectors() { + // The assignment here is split to preserve the property enumeration order. + var selectors = { + "/\\*([\\s\\S]*?)\\*/": commentMatch + }; + // https://www.w3.org/TR/CSS21/syndata.html#characters + // 4.1.3: identifiers (...) can contain only the characters [a-zA-Z0-9] and + // ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_) + // + // 10ffff is the maximum allowed in current Unicode + selectors[uniRegexp.typeMatchClass] = typeMatch("class"); + selectors[uniRegexp.typeMatchId] = typeMatch("id"); + var selectorsSecondHalf = { + ":(not|any|-\\w+?-any|matches|is|where|has|local|global)\\((\\s*)": nestedPseudoClassStartMatch, + ":((?:\\\\.|[A-Za-z_\\-0-9])+)\\(": pseudoClassStartMatch, + ":((?:\\\\.|[A-Za-z_\\-0-9])+)": typeMatch("pseudo-class"), + "::((?:\\\\.|[A-Za-z_\\-0-9])+)": typeMatch("pseudo-element"), + "(\\*\\|)((?:\\\\.|[A-Za-z_\\-0-9])+)": elementMatch, + "(\\*\\|)\\*": universalMatch, + "((?:\\\\.|[A-Za-z_\\-0-9])*\\|)?\\*": universalMatch, + "((?:\\\\.|[A-Za-z_\\-0-9])*\\|)?((?:\\\\.|[A-Za-z_\\-])(?:\\\\.|[A-Za-z_\\-0-9])*)": elementMatch, + "\\[([^\\]]+)\\]": attributeMatch, + "(\\s*)\\)": nestedEnd, + "(\\s*)((?:\\|\\|)|(?:>>)|[>+~])(\\s*)": operatorMatch, + "(\\s*),(\\s*)": nextSelectorMatch, + "\\s+$": irrelevantSpacingEndMatch, + "^\\s+": irrelevantSpacingStartMatch, + "\\s+": spacingMatch, + ".": invalidMatch + }; + var selector; + for (selector in selectorsSecondHalf) { + if (Object.prototype.hasOwnProperty.call(selectorsSecondHalf, selector)) { + selectors[selector] = selectorsSecondHalf[selector]; + } + } + return selectors; +} + +var parser = new Parser({ + selector: getSelectors(), + inBrackets: { + "/\\*[\\s\\S]*?\\*/": addToCurrent, + "\"([^\\\\\"]|\\\\.)*\"": addToCurrent, + "'([^\\\\']|\\\\.)*'": addToCurrent, + "[^()'\"/]+": addToCurrent, + "\\(": bracketStart, + "\\)": bracketEnd, + ".": addToCurrent + } +}); + +function parse(str) { + var selectorNode = { + type: "selector", + nodes: [] + }; + var rootNode = { + type: "selectors", + nodes: [ + selectorNode + ] + }; + parser.parse("selector", str, { + stack: [], + root: rootNode, + selector: selectorNode + }); + return rootNode; +} + +module.exports = parse; diff --git a/node_modules/css-selector-tokenizer/lib/parseValues.js b/node_modules/css-selector-tokenizer/lib/parseValues.js new file mode 100644 index 00000000..690c093b --- /dev/null +++ b/node_modules/css-selector-tokenizer/lib/parseValues.js @@ -0,0 +1,167 @@ +"use strict"; + +var Parser = require("fastparse"); + +function commentMatch(match, content) { + this.value.nodes.push({ + type: "comment", + content: content + }); +} + +function spacingMatch(match) { + var item = this.value.nodes[this.value.nodes.length - 1]; + item.after = (item.after || "") + match; +} + +function initialSpacingMatch(match) { + this.value.before = match; +} + +function endSpacingMatch(match) { + this.value.after = match; +} + +function unescapeString(content) { + return content.replace(/\\(?:([a-fA-F0-9]{1,6})|(.))/g, function(all, unicode, otherCharacter) { + if (otherCharacter) { + return otherCharacter; + } + + var C = parseInt(unicode, 16); + if(C < 0x10000) { + return String.fromCharCode(C); + } else { + return String.fromCharCode(Math.floor((C - 0x10000) / 0x400) + 0xD800) + + String.fromCharCode((C - 0x10000) % 0x400 + 0xDC00); + } + }); +} + +function stringMatch(match, content) { + var value = unescapeString(content); + this.value.nodes.push({ + type: "string", + value: value, + stringType: match[0] + }); +} + +function commaMatch(match, spacing) { + var newValue = { + type: "value", + nodes: [] + }; + if(spacing) { + newValue.before = spacing; + } + this.root.nodes.push(newValue); + this.value = newValue; +} + +function itemMatch(match) { + this.value.nodes.push({ + type: "item", + name: match + }); +} + +function nestedItemMatch(match, name, spacing) { + this.stack.push(this.root); + this.root = { + type: "nested-item", + name: name, + nodes: [ + { type: "value", nodes: [] } + ] + }; + if(spacing) { + this.root.nodes[0].before = spacing; + } + this.value.nodes.push(this.root); + this.value = this.root.nodes[0]; +} + +function nestedItemEndMatch(match, spacing, remaining) { + if(this.stack.length === 0) { + if(spacing) { + var item = this.value.nodes[this.value.nodes.length - 1]; + item.after = (item.after || "") + spacing; + } + this.value.nodes.push({ + type: "invalid", + value: remaining + }); + } else { + if(spacing) { + this.value.after = spacing; + } + this.root = this.stack.pop(); + this.value = this.root.nodes[this.root.nodes.length - 1]; + } +} + +function urlMatch(match, innerSpacingBefore, content, innerSpacingAfter) { + var item = { + type: "url" + }; + if(innerSpacingBefore) { + item.innerSpacingBefore = innerSpacingBefore; + } + if(innerSpacingAfter) { + item.innerSpacingAfter = innerSpacingAfter; + } + switch(content[0]) { + case "\"": + item.stringType = "\""; + item.url = unescapeString(content.substr(1, content.length - 2)); + break; + case "'": + item.stringType = "'"; + item.url = unescapeString(content.substr(1, content.length - 2)); + break; + default: + item.url = unescapeString(content); + break; + } + this.value.nodes.push(item); +} + +var parser = new Parser({ + decl: { + "^\\s+": initialSpacingMatch, + "/\\*([\\s\\S]*?)\\*/": commentMatch, + "\"((?:[^\\\\\"]|\\\\.)*)\"": stringMatch, + "'((?:[^\\\\']|\\\\.)*)'": stringMatch, + "url\\((\\s*)(\"(?:[^\\\\\"]|\\\\.)*\")(\\s*)\\)": urlMatch, + "url\\((\\s*)('(?:[^\\\\']|\\\\.)*')(\\s*)\\)": urlMatch, + "url\\((\\s*)((?:[^\\\\)'\"]|\\\\.)*)(\\s*)\\)": urlMatch, + "([\\w-]+)\\((\\s*)": nestedItemMatch, + "(\\s*)(\\))": nestedItemEndMatch, + ",(\\s*)": commaMatch, + "\\s+$": endSpacingMatch, + "\\s+": spacingMatch, + "[^\\s,)]+": itemMatch + } +}); + +function parseValues(str) { + var valueNode = { + type: "value", + nodes: [] + }; + var rootNode = { + type: "values", + nodes: [ + valueNode + ] + }; + parser.parse("decl", str, { + stack: [], + root: rootNode, + value: valueNode + }); + return rootNode; +} + +module.exports = parseValues; diff --git a/node_modules/css-selector-tokenizer/lib/stringify.js b/node_modules/css-selector-tokenizer/lib/stringify.js new file mode 100644 index 00000000..bb63ee87 --- /dev/null +++ b/node_modules/css-selector-tokenizer/lib/stringify.js @@ -0,0 +1,62 @@ +"use strict"; + +var uniRegexp = require("./uni-regexp"); +var identifierEscapeRegexp = new RegExp(uniRegexp.identifierEscapeRegexp, "g"); + +function escape(str, identifier) { + if(str === "*") { + return "*"; + } + if (identifier) { + return str.replace(identifierEscapeRegexp, "\\$1"); + } else { + return str.replace(/(^[^A-Za-z_\\-]|^--|[^A-Za-z_0-9\\-])/g, "\\$1"); + } +} + +function stringifyWithoutBeforeAfter(tree) { + switch(tree.type) { + case "selectors": + return tree.nodes.map(stringify).join(","); + case "selector": + return tree.nodes.map(stringify).join(""); + case "element": + return (typeof tree.namespace === "string" ? escape(tree.namespace) + "|" : "") + escape(tree.name); + case "class": + return "." + escape(tree.name, true); + case "id": + return "#" + escape(tree.name, true); + case "attribute": + return "[" + tree.content + "]"; + case "spacing": + return tree.value; + case "pseudo-class": + return ":" + escape(tree.name) + (typeof tree.content === "string" ? "(" + tree.content + ")" : ""); + case "nested-pseudo-class": + return ":" + escape(tree.name) + "(" + tree.nodes.map(stringify).join(",") + ")"; + case "pseudo-element": + return "::" + escape(tree.name); + case "universal": + return (typeof tree.namespace === "string" ? escape(tree.namespace) + "|" : "") + "*"; + case "operator": + return tree.operator; + case "comment": + return "/*" + tree.content + "*/"; + case "invalid": + return tree.value; + } +} + + +function stringify(tree) { + var str = stringifyWithoutBeforeAfter(tree); + if(tree.before) { + str = tree.before + str; + } + if(tree.after) { + str = str + tree.after; + } + return str; +} + +module.exports = stringify; diff --git a/node_modules/css-selector-tokenizer/lib/stringifyValues.js b/node_modules/css-selector-tokenizer/lib/stringifyValues.js new file mode 100644 index 00000000..a61d8d52 --- /dev/null +++ b/node_modules/css-selector-tokenizer/lib/stringifyValues.js @@ -0,0 +1,62 @@ +"use strict"; + +var cssesc = require("cssesc"); + +var stringify; + +function escape(str, stringType) { + return cssesc(str, { + quotes: stringType === "\"" ? "double" : "single" + }); +} + +function stringifyWithoutBeforeAfter(tree) { + switch(tree.type) { + case "values": + return tree.nodes.map(stringify).join(","); + case "value": + return tree.nodes.map(stringify).join(""); + case "item": + return tree.name; + case "nested-item": + return tree.name + "(" + tree.nodes.map(stringify).join(",") + ")"; + case "invalid": + return tree.value; + case "comment": + return "/*" + tree.content + "*/"; + case "string": + switch(tree.stringType) { + case "'": + return "'" + escape(tree.value, "'") + "'"; + case "\"": + return "\"" + escape(tree.value, "\"") + "\""; + } + /* istanbul ignore next */ + throw new Error("Invalid stringType"); + case "url": + var start = "url(" + (tree.innerSpacingBefore || ""); + var end = (tree.innerSpacingAfter || "") + ")"; + switch(tree.stringType) { + case "'": + return start + "'" + tree.url.replace(/(\\)/g, "\\$1").replace(/'/g, "\\'") + "'" + end; + case "\"": + return start + "\"" + tree.url.replace(/(\\)/g, "\\$1").replace(/"/g, "\\\"") + "\"" + end; + default: + return start + tree.url.replace(/("|'|\)|\\)/g, "\\$1") + end; + } + } +} + + +stringify = function stringify(tree) { + var str = stringifyWithoutBeforeAfter(tree); + if(tree.before) { + str = tree.before + str; + } + if(tree.after) { + str = str + tree.after; + } + return str; +}; + +module.exports = stringify; diff --git a/node_modules/css-selector-tokenizer/lib/uni-regexp.js b/node_modules/css-selector-tokenizer/lib/uni-regexp.js new file mode 100644 index 00000000..a60623d5 --- /dev/null +++ b/node_modules/css-selector-tokenizer/lib/uni-regexp.js @@ -0,0 +1,6 @@ +/* AUTO GENERATED */ +module.exports = { + "typeMatchClass": "\\.((?:\\\\(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])|(?:[\\x2DA-Z_a-z\\xA0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]))(?:\\\\(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])|(?:[\\x2D0-9A-Z_a-z\\xA0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]))*)", + "typeMatchId": "#((?:\\\\(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])|(?:[\\x2DA-Z_a-z\\xA0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]))(?:\\\\(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])|(?:[\\x2D0-9A-Z_a-z\\xA0-\\uD7FF\\uE000-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]))*)", + "identifierEscapeRegexp": "(^[\\0-,\\.-@\\[-\\^`\\{-\\x9F]|^\\x2D\\x2D|[\\0-,\\.\\/:-@\\[-\\^`\\{-\\x9F])" +} diff --git a/node_modules/css-selector-tokenizer/package.json b/node_modules/css-selector-tokenizer/package.json new file mode 100644 index 00000000..0634278c --- /dev/null +++ b/node_modules/css-selector-tokenizer/package.json @@ -0,0 +1,48 @@ +{ + "name": "css-selector-tokenizer", + "version": "0.8.0", + "description": "Parses and stringifies CSS selectors", + "main": "lib/index.js", + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "test": "mocha", + "cover": "nyc npm test", + "build-regexpu": "node scripts/build-regexpu.js", + "report:coveralls": "nyc report --reporter=text-lcov | coveralls", + "report:codecov": "nyc report --reporter=text-lcov | codecov --pipe", + "publish-patch": "npm test && npm version patch && git push && git push --tags && npm publish" + }, + "repository": { + "type": "git", + "url": "https://github.com/css-modules/css-selector-tokenizer.git" + }, + "keywords": [ + "css-modules", + "selectors" + ], + "files": [ + "lib" + ], + "author": "Tobias Koppers @sokra", + "license": "MIT", + "bugs": { + "url": "https://github.com/css-modules/css-selector-tokenizer/issues" + }, + "homepage": "https://github.com/css-modules/css-selector-tokenizer", + "dependencies": { + "cssesc": "^3.0.0", + "fastparse": "^1.1.2" + }, + "devDependencies": { + "codecov": "^3.6.5", + "coveralls": "^3.0.9", + "eslint": "^6.8.0", + "mocha": "^7.1.0", + "nyc": "^15.0.0", + "regexpu-core": "^4.6.0" + }, + "directories": { + "test": "test" + } +} diff --git a/node_modules/cssesc/LICENSE-MIT.txt b/node_modules/cssesc/LICENSE-MIT.txt new file mode 100644 index 00000000..a41e0a7e --- /dev/null +++ b/node_modules/cssesc/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +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/cssesc/README.md b/node_modules/cssesc/README.md new file mode 100644 index 00000000..58fb8fe0 --- /dev/null +++ b/node_modules/cssesc/README.md @@ -0,0 +1,201 @@ +# cssesc [![Build status](https://travis-ci.org/mathiasbynens/cssesc.svg?branch=master)](https://travis-ci.org/mathiasbynens/cssesc) [![Code coverage status](https://img.shields.io/codecov/c/github/mathiasbynens/cssesc.svg)](https://codecov.io/gh/mathiasbynens/cssesc) + +A JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output. + +This is a JavaScript library for [escaping text for use in CSS strings or identifiers](https://mathiasbynens.be/notes/css-escapes) while generating the shortest possible valid ASCII-only output. [Here’s an online demo.](https://mothereff.in/css-escapes) + +[A polyfill for the CSSOM `CSS.escape()` method is available in a separate repository.](https://mths.be/cssescape) (In comparison, _cssesc_ is much more powerful.) + +Feel free to fork if you see possible improvements! + +## Installation + +Via [npm](https://www.npmjs.com/): + +```bash +npm install cssesc +``` + +In a browser: + +```html + +``` + +In [Node.js](https://nodejs.org/): + +```js +const cssesc = require('cssesc'); +``` + +In Ruby using [the `ruby-cssesc` wrapper gem](https://github.com/borodean/ruby-cssesc): + +```bash +gem install ruby-cssesc +``` + +```ruby +require 'ruby-cssesc' +CSSEsc.escape('I ♥ Ruby', is_identifier: true) +``` + +In Sass using [`sassy-escape`](https://github.com/borodean/sassy-escape): + +```bash +gem install sassy-escape +``` + +```scss +body { + content: escape('I ♥ Sass', $is-identifier: true); +} +``` + +## API + +### `cssesc(value, options)` + +This function takes a value and returns an escaped version of the value where any characters that are not printable ASCII symbols are escaped using the shortest possible (but valid) [escape sequences for use in CSS strings or identifiers](https://mathiasbynens.be/notes/css-escapes). + +```js +cssesc('Ich ♥ Bücher'); +// → 'Ich \\2665 B\\FC cher' + +cssesc('foo 𝌆 bar'); +// → 'foo \\1D306 bar' +``` + +By default, `cssesc` returns a string that can be used as part of a CSS string. If the target is a CSS identifier rather than a CSS string, use the `isIdentifier: true` setting (see below). + +The optional `options` argument accepts an object with the following options: + +#### `isIdentifier` + +The default value for the `isIdentifier` option is `false`. This means that the input text will be escaped for use in a CSS string literal. If you want to use the result as a CSS identifier instead (in a selector, for example), set this option to `true`. + +```js +cssesc('123a2b'); +// → '123a2b' + +cssesc('123a2b', { + 'isIdentifier': true +}); +// → '\\31 23a2b' +``` + +#### `quotes` + +The default value for the `quotes` option is `'single'`. This means that any occurences of `'` in the input text will be escaped as `\'`, so that the output can be used in a CSS string literal wrapped in single quotes. + +```js +cssesc('Lorem ipsum "dolor" sit \'amet\' etc.'); +// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.' +// → "Lorem ipsum \"dolor\" sit \\'amet\\' etc." + +cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { + 'quotes': 'single' +}); +// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.' +// → "Lorem ipsum \"dolor\" sit \\'amet\\' etc." +``` + +If you want to use the output as part of a CSS string literal wrapped in double quotes, set the `quotes` option to `'double'`. + +```js +cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { + 'quotes': 'double' +}); +// → 'Lorem ipsum \\"dolor\\" sit \'amet\' etc.' +// → "Lorem ipsum \\\"dolor\\\" sit 'amet' etc." +``` + +#### `wrap` + +The `wrap` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output will be a valid CSS string literal wrapped in quotes. The type of quotes can be specified through the `quotes` setting. + +```js +cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { + 'quotes': 'single', + 'wrap': true +}); +// → '\'Lorem ipsum "dolor" sit \\\'amet\\\' etc.\'' +// → "\'Lorem ipsum \"dolor\" sit \\\'amet\\\' etc.\'" + +cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { + 'quotes': 'double', + 'wrap': true +}); +// → '"Lorem ipsum \\"dolor\\" sit \'amet\' etc."' +// → "\"Lorem ipsum \\\"dolor\\\" sit \'amet\' etc.\"" +``` + +#### `escapeEverything` + +The `escapeEverything` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, all the symbols in the output will be escaped, even printable ASCII symbols. + +```js +cssesc('lolwat"foo\'bar', { + 'escapeEverything': true +}); +// → '\\6C\\6F\\6C\\77\\61\\74\\"\\66\\6F\\6F\\\'\\62\\61\\72' +// → "\\6C\\6F\\6C\\77\\61\\74\\\"\\66\\6F\\6F\\'\\62\\61\\72" +``` + +#### Overriding the default options globally + +The global default settings can be overridden by modifying the `css.options` object. This saves you from passing in an `options` object for every call to `encode` if you want to use the non-default setting. + +```js +// Read the global default setting for `escapeEverything`: +cssesc.options.escapeEverything; +// → `false` by default + +// Override the global default setting for `escapeEverything`: +cssesc.options.escapeEverything = true; + +// Using the global default setting for `escapeEverything`, which is now `true`: +cssesc('foo © bar ≠ baz 𝌆 qux'); +// → '\\66\\6F\\6F\\ \\A9\\ \\62\\61\\72\\ \\2260\\ \\62\\61\\7A\\ \\1D306\\ \\71\\75\\78' +``` + +### `cssesc.version` + +A string representing the semantic version number. + +### Using the `cssesc` binary + +To use the `cssesc` binary in your shell, simply install cssesc globally using npm: + +```bash +npm install -g cssesc +``` + +After that you will be able to escape text for use in CSS strings or identifiers from the command line: + +```bash +$ cssesc 'föo ♥ bår 𝌆 baz' +f\F6o \2665 b\E5r \1D306 baz +``` + +If the output needs to be a CSS identifier rather than part of a string literal, use the `-i`/`--identifier` option: + +```bash +$ cssesc --identifier 'föo ♥ bår 𝌆 baz' +f\F6o\ \2665\ b\E5r\ \1D306\ baz +``` + +See `cssesc --help` for the full list of options. + +## Support + +This library supports the Node.js and browser versions mentioned in [`.babelrc`](https://github.com/mathiasbynens/cssesc/blob/master/.babelrc). For a version that supports a wider variety of legacy browsers and environments out-of-the-box, [see v0.1.0](https://github.com/mathiasbynens/cssesc/releases/tag/v0.1.0). + +## Author + +| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](https://mathiasbynens.be/) | + +## License + +This library is available under the [MIT](https://mths.be/mit) license. diff --git a/node_modules/cssesc/bin/cssesc b/node_modules/cssesc/bin/cssesc new file mode 100755 index 00000000..188c034f --- /dev/null +++ b/node_modules/cssesc/bin/cssesc @@ -0,0 +1,116 @@ +#!/usr/bin/env node +const fs = require('fs'); +const cssesc = require('../cssesc.js'); +const strings = process.argv.splice(2); +const stdin = process.stdin; +const options = {}; +const log = console.log; + +const main = function() { + const option = strings[0]; + + if (/^(?:-h|--help|undefined)$/.test(option)) { + log( + 'cssesc v%s - https://mths.be/cssesc', + cssesc.version + ); + log([ + '\nUsage:\n', + '\tcssesc [string]', + '\tcssesc [-i | --identifier] [string]', + '\tcssesc [-s | --single-quotes] [string]', + '\tcssesc [-d | --double-quotes] [string]', + '\tcssesc [-w | --wrap] [string]', + '\tcssesc [-e | --escape-everything] [string]', + '\tcssesc [-v | --version]', + '\tcssesc [-h | --help]', + '\nExamples:\n', + '\tcssesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', + '\tcssesc --identifier \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', + '\tcssesc --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', + '\tcssesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', + '\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | cssesc' + ].join('\n')); + return process.exit(1); + } + + if (/^(?:-v|--version)$/.test(option)) { + log('v%s', cssesc.version); + return process.exit(1); + } + + strings.forEach(function(string) { + // Process options + if (/^(?:-i|--identifier)$/.test(string)) { + options.isIdentifier = true; + return; + } + if (/^(?:-s|--single-quotes)$/.test(string)) { + options.quotes = 'single'; + return; + } + if (/^(?:-d|--double-quotes)$/.test(string)) { + options.quotes = 'double'; + return; + } + if (/^(?:-w|--wrap)$/.test(string)) { + options.wrap = true; + return; + } + if (/^(?:-e|--escape-everything)$/.test(string)) { + options.escapeEverything = true; + return; + } + + // Process string(s) + let result; + try { + result = cssesc(string, options); + log(result); + } catch (exception) { + log(exception.message + '\n'); + log('Error: failed to escape.'); + log('If you think this is a bug in cssesc, please report it:'); + log('https://github.com/mathiasbynens/cssesc/issues/new'); + log( + '\nStack trace using cssesc@%s:\n', + cssesc.version + ); + log(exception.stack); + return process.exit(1); + } + }); + // Return with exit status 0 outside of the `forEach` loop, in case + // multiple strings were passed in. + return process.exit(0); + +}; + +if (stdin.isTTY) { + // handle shell arguments + main(); +} else { + let timeout; + // Either the script is called from within a non-TTY context, or `stdin` + // content is being piped in. + if (!process.stdout.isTTY) { + // The script was called from a non-TTY context. This is a rather uncommon + // use case we don’t actively support. However, we don’t want the script + // to wait forever in such cases, so… + timeout = setTimeout(function() { + // …if no piped data arrived after a whole minute, handle shell + // arguments instead. + main(); + }, 60000); + } + let data = ''; + stdin.on('data', function(chunk) { + clearTimeout(timeout); + data += chunk; + }); + stdin.on('end', function() { + strings.push(data.trim()); + main(); + }); + stdin.resume(); +} diff --git a/node_modules/cssesc/cssesc.js b/node_modules/cssesc/cssesc.js new file mode 100644 index 00000000..1c0928e4 --- /dev/null +++ b/node_modules/cssesc/cssesc.js @@ -0,0 +1,110 @@ +/*! https://mths.be/cssesc v3.0.0 by @mathias */ +'use strict'; + +var object = {}; +var hasOwnProperty = object.hasOwnProperty; +var merge = function merge(options, defaults) { + if (!options) { + return defaults; + } + var result = {}; + for (var key in defaults) { + // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since + // only recognized option names are used. + result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key]; + } + return result; +}; + +var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/; +var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/; +var regexAlwaysEscape = /['"\\]/; +var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g; + +// https://mathiasbynens.be/notes/css-escapes#css +var cssesc = function cssesc(string, options) { + options = merge(options, cssesc.options); + if (options.quotes != 'single' && options.quotes != 'double') { + options.quotes = 'single'; + } + var quote = options.quotes == 'double' ? '"' : '\''; + var isIdentifier = options.isIdentifier; + + var firstChar = string.charAt(0); + var output = ''; + var counter = 0; + var length = string.length; + while (counter < length) { + var character = string.charAt(counter++); + var codePoint = character.charCodeAt(); + var value = void 0; + // If it’s not a printable ASCII character… + if (codePoint < 0x20 || codePoint > 0x7E) { + if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) { + // It’s a high surrogate, and there is a next character. + var extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { + // next character is low surrogate + codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000; + } else { + // It’s an unmatched surrogate; only append this code unit, in case + // the next code unit is the high surrogate of a surrogate pair. + counter--; + } + } + value = '\\' + codePoint.toString(16).toUpperCase() + ' '; + } else { + if (options.escapeEverything) { + if (regexAnySingleEscape.test(character)) { + value = '\\' + character; + } else { + value = '\\' + codePoint.toString(16).toUpperCase() + ' '; + } + } else if (/[\t\n\f\r\x0B]/.test(character)) { + value = '\\' + codePoint.toString(16).toUpperCase() + ' '; + } else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) { + value = '\\' + character; + } else { + value = character; + } + } + output += value; + } + + if (isIdentifier) { + if (/^-[-\d]/.test(output)) { + output = '\\-' + output.slice(1); + } else if (/\d/.test(firstChar)) { + output = '\\3' + firstChar + ' ' + output.slice(1); + } + } + + // Remove spaces after `\HEX` escapes that are not followed by a hex digit, + // since they’re redundant. Note that this is only possible if the escape + // sequence isn’t preceded by an odd number of backslashes. + output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) { + if ($1 && $1.length % 2) { + // It’s not safe to remove the space, so don’t. + return $0; + } + // Strip the space. + return ($1 || '') + $2; + }); + + if (!isIdentifier && options.wrap) { + return quote + output + quote; + } + return output; +}; + +// Expose default options (so they can be overridden globally). +cssesc.options = { + 'escapeEverything': false, + 'isIdentifier': false, + 'quotes': 'single', + 'wrap': false +}; + +cssesc.version = '3.0.0'; + +module.exports = cssesc; diff --git a/node_modules/cssesc/man/cssesc.1 b/node_modules/cssesc/man/cssesc.1 new file mode 100644 index 00000000..eee4996d --- /dev/null +++ b/node_modules/cssesc/man/cssesc.1 @@ -0,0 +1,70 @@ +.Dd August 9, 2013 +.Dt cssesc 1 +.Sh NAME +.Nm cssesc +.Nd escape text for use in CSS string literals or identifiers +.Sh SYNOPSIS +.Nm +.Op Fl i | -identifier Ar string +.br +.Op Fl s | -single-quotes Ar string +.br +.Op Fl d | -double-quotes Ar string +.br +.Op Fl w | -wrap Ar string +.br +.Op Fl e | -escape-everything Ar string +.br +.Op Fl v | -version +.br +.Op Fl h | -help +.Sh DESCRIPTION +.Nm +escapes strings for use in CSS string literals or identifiers while generating the shortest possible valid ASCII-only output. +.Sh OPTIONS +.Bl -ohang -offset +.It Sy "-s, --single-quotes" +Escape any occurences of ' in the input string as \\', so that the output can be used in a CSS string literal wrapped in single quotes. +.It Sy "-d, --double-quotes" +Escape any occurences of " in the input string as \\", so that the output can be used in a CSS string literal wrapped in double quotes. +.It Sy "-w, --wrap" +Make sure the output is a valid CSS string literal wrapped in quotes. The type of quotes can be specified using the +.Ar -s | --single-quotes +or +.Ar -d | --double-quotes +settings. +.It Sy "-e, --escape-everything" +Escape all the symbols in the output, even printable ASCII symbols. +.It Sy "-v, --version" +Print cssesc's version. +.It Sy "-h, --help" +Show the help screen. +.El +.Sh EXIT STATUS +The +.Nm cssesc +utility exits with one of the following values: +.Pp +.Bl -tag -width flag -compact +.It Li 0 +.Nm +successfully escaped the given text and printed the result. +.It Li 1 +.Nm +wasn't instructed to escape anything (for example, the +.Ar --help +flag was set); or, an error occurred. +.El +.Sh EXAMPLES +.Bl -ohang -offset +.It Sy "cssesc 'foo bar baz'" +Print an escaped version of the given text. +.It Sy echo\ 'foo bar baz'\ |\ cssesc +Print an escaped version of the text that gets piped in. +.El +.Sh BUGS +cssesc's bug tracker is located at . +.Sh AUTHOR +Mathias Bynens +.Sh WWW + diff --git a/node_modules/cssesc/package.json b/node_modules/cssesc/package.json new file mode 100644 index 00000000..076c84dc --- /dev/null +++ b/node_modules/cssesc/package.json @@ -0,0 +1,51 @@ +{ + "name": "cssesc", + "version": "3.0.0", + "description": "A JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output.", + "homepage": "https://mths.be/cssesc", + "engines": { + "node": ">=4" + }, + "main": "cssesc.js", + "bin": "bin/cssesc", + "man": "man/cssesc.1", + "keywords": [ + "css", + "escape", + "identifier", + "string", + "tool" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "repository": { + "type": "git", + "url": "https://github.com/mathiasbynens/cssesc.git" + }, + "bugs": "https://github.com/mathiasbynens/cssesc/issues", + "files": [ + "LICENSE-MIT.txt", + "cssesc.js", + "bin/", + "man/" + ], + "scripts": { + "build": "grunt template && babel cssesc.js -o cssesc.js", + "test": "mocha tests", + "cover": "istanbul cover --report html node_modules/.bin/_mocha tests -- -u exports -R spec" + }, + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-preset-env": "^1.6.1", + "codecov": "^1.0.1", + "grunt": "^1.0.1", + "grunt-template": "^1.0.0", + "istanbul": "^0.4.4", + "mocha": "^2.5.3", + "regenerate": "^1.2.1", + "requirejs": "^2.1.16" + } +} diff --git a/node_modules/deepmerge/.editorconfig b/node_modules/deepmerge/.editorconfig new file mode 100644 index 00000000..6244e1b7 --- /dev/null +++ b/node_modules/deepmerge/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +indent_style = tab +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/node_modules/deepmerge/.eslintcache b/node_modules/deepmerge/.eslintcache new file mode 100644 index 00000000..c1321eb4 --- /dev/null +++ b/node_modules/deepmerge/.eslintcache @@ -0,0 +1 @@ +[{"/Users/joshduff/code/deepmerge/test/custom-is-mergeable-object.js":"1"},{"size":1990,"mtime":1679007485753,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"ktjd5k","/Users/joshduff/code/deepmerge/test/custom-is-mergeable-object.js",[],[]] \ No newline at end of file diff --git a/node_modules/deepmerge/changelog.md b/node_modules/deepmerge/changelog.md new file mode 100644 index 00000000..082e0dd3 --- /dev/null +++ b/node_modules/deepmerge/changelog.md @@ -0,0 +1,167 @@ +# [4.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.1) + +- Fix type definition for arrayMerge options. [#239](https://github.com/TehShrike/deepmerge/pull/239) + +# [4.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.0) + +- Avoid thrown errors if the target doesn't have `propertyIsEnumerable`. [#252](https://github.com/TehShrike/deepmerge/pull/252) + +# [4.2.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.2) + +- `isMergeableObject` is now only called if there are two values that could be merged. [a34dd4d2](https://github.com/TehShrike/deepmerge/commit/a34dd4d25bf5e250653540a2022bc832c7b00a19) + +# [4.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.1) + +- Fix: falsey values can now be merged. [#170](https://github.com/TehShrike/deepmerge/issues/170) + +# [4.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.0) + +- Properties are now only overwritten if they exist on the target object and are enumerable. [#164](https://github.com/TehShrike/deepmerge/pull/164) + +Technically this could probably be a patch release since "which properties get overwritten" wasn't documented and accidentally overwriting a built-in function or some function up the property chain would almost certainly be undesirable, but it feels like a gray area, so here we are with a feature version bump. + +# [4.1.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.2) + +- Rolled back #167 since `Object.assign` breaks ES5 support. [55067352](https://github.com/TehShrike/deepmerge/commit/55067352a92c65a6c44a5165f3387720aae1e192) + +# [4.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.1) + +- The `options` argument is no longer mutated [#167](https://github.com/TehShrike/deepmerge/pull/167) + +# [4.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.0) + +- `cloneUnlessOtherwiseSpecified` is now exposed to the `arrayMerge` function [#165](https://github.com/TehShrike/deepmerge/pull/165) + +# [4.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.0.0) + +- The `main` entry point in `package.json` is now a CommonJS module instead of a UMD module [#155](https://github.com/TehShrike/deepmerge/pull/155) + +# [3.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.3.0) + +- Enumerable Symbol properties are now copied [#151](https://github.com/TehShrike/deepmerge/pull/151) + +# [3.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.1) + +- bumping dev dependency versions to try to shut up bogus security warnings from Github/npm [#149](https://github.com/TehShrike/deepmerge/pull/149) + +# [3.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.0) + +- feature: added the [`customMerge`](https://github.com/TehShrike/deepmerge#custommerge) option [#133](https://github.com/TehShrike/deepmerge/pull/133) + +# [3.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.1.0) + +- typescript typing: make the `all` function generic [#129](https://github.com/TehShrike/deepmerge/pull/129) + +# [3.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.0.0) + +- drop ES module build [#123](https://github.com/TehShrike/deepmerge/issues/123) + +# [2.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.1) + +- bug: typescript export type was wrong [#121](https://github.com/TehShrike/deepmerge/pull/121) + +# [2.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.0) + +- feature: added TypeScript typings [#119](https://github.com/TehShrike/deepmerge/pull/119) + +# [2.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.1) + +- documentation: Rename "methods" to "api", note ESM syntax [#103](https://github.com/TehShrike/deepmerge/pull/103) +- documentation: Fix grammar [#107](https://github.com/TehShrike/deepmerge/pull/107) +- documentation: Restructure headers for clarity + some wording tweaks [108](https://github.com/TehShrike/deepmerge/pull/108) + [109](https://github.com/TehShrike/deepmerge/pull/109) + + +# [2.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.0) + +- feature: Support a custom `isMergeableObject` function [#96](https://github.com/TehShrike/deepmerge/pull/96) +- documentation: note a Webpack bug that some users might need to work around [#100](https://github.com/TehShrike/deepmerge/pull/100) + +# [2.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.1) + +- documentation: fix the old array merge algorithm in the readme. [#84](https://github.com/TehShrike/deepmerge/pull/84) + +# [2.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.0) + +- breaking: the array merge algorithm has changed from a complicated thing to `target.concat(source).map(element => cloneUnlessOtherwiseSpecified(element, optionsArgument))` +- breaking: The `clone` option now defaults to `true` +- feature: `merge.all` now accepts an array of any size, even 0 or 1 elements + +See [pull request 77](https://github.com/TehShrike/deepmerge/pull/77). + +# [1.5.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.2) + +- fix: no longer attempts to merge React elements [#76](https://github.com/TehShrike/deepmerge/issues/76) + +# [1.5.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.1) + +- bower support: officially dropping bower support. If you use bower, please depend on the [unpkg distribution](https://unpkg.com/deepmerge/dist/umd.js). See [#63](https://github.com/TehShrike/deepmerge/issues/63) + +# [1.5.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.0) + +- bug fix: merging objects into arrays was allowed, and doesn't make any sense. [#65](https://github.com/TehShrike/deepmerge/issues/65) published as a feature release instead of a patch because it is a decent behavior change. + +# [1.4.4](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.4) + +- bower support: updated `main` in bower.json + +# [1.4.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.3) + +- bower support: inline is-mergeable-object in a new CommonJS build, so that people using both bower and CommonJS can bundle the library [0b34e6](https://github.com/TehShrike/deepmerge/commit/0b34e6e95f989f2fc8091d25f0d291c08f3d2d24) + +# [1.4.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.2) + +- performance: bump is-mergeable-object dependency version for a slight performance improvement [5906c7](https://github.com/TehShrike/deepmerge/commit/5906c765d691d48e83d76efbb0d4b9ca150dc12c) + +# [1.4.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.1) + +- documentation: fix unpkg link [acc45b](https://github.com/TehShrike/deepmerge/commit/acc45be85519c1df906a72ecb24764b622d18d47) + +# [1.4.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.0) + +- api: instead of only exporting a UMD module, expose a UMD module with `pkg.main`, a CJS module with `pkg.browser`, and an ES module with `pkg.module` [#62](https://github.com/TehShrike/deepmerge/pull/62) + +# [1.3.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.2) + +- documentation: note the minified/gzipped file sizes [56](https://github.com/TehShrike/deepmerge/pull/56) +- documentation: make data structures more readable in merge example: pull request [57](https://github.com/TehShrike/deepmerge/pull/57) + +# [1.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.1) + +- documentation: clarify and test some array merging documentation: pull request [51](https://github.com/TehShrike/deepmerge/pull/51) + +# [1.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.0) + +- feature: `merge.all`, a merge function that merges any number of objects: pull request [50](https://github.com/TehShrike/deepmerge/pull/50) + +# [1.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.2.0) + +- fix: an error that would be thrown when an array would be merged onto a truthy non-array value: pull request [46](https://github.com/TehShrike/deepmerge/pull/46) +- feature: the ability to clone: Issue [28](https://github.com/TehShrike/deepmerge/issues/28), pull requests [44](https://github.com/TehShrike/deepmerge/pull/44) and [48](https://github.com/TehShrike/deepmerge/pull/48) +- maintenance: added tests + travis to `.npmignore`: pull request [47](https://github.com/TehShrike/deepmerge/pull/47) + +# [1.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.1) + +- fix an issue where an error was thrown when merging an array onto a non-array: [Pull request 46](https://github.com/TehShrike/deepmerge/pull/46) + +# [1.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.0) + +- allow consumers to specify their own array merging algorithm: [Pull request 37](https://github.com/TehShrike/deepmerge/pull/37) + +# [1.0.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.3) + +- adding bower.json back: [Issue 38](https://github.com/TehShrike/deepmerge/pull/38) +- updating keywords and Github links in package.json [bc3898e](https://github.com/TehShrike/deepmerge/commit/bc3898e587a56f74591328f40f656b0152c1d5eb) + +# [1.0.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.2) + +- Updating the readme: dropping bower, testing that the example works: [7102fc](https://github.com/TehShrike/deepmerge/commit/7102fcc4ddec11e2d33205866f9f18df14e5aeb5) + +# [1.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.1) + +- `null`, dates, and regular expressions are now properly merged in arrays: [Issue 18](https://github.com/TehShrike/deepmerge/pull/18), plus commit: [ef1c6b](https://github.com/TehShrike/deepmerge/commit/ef1c6bac8350ba12a24966f0bc7da02560827586) + +# 1.0.0 + +- Should only be a patch change, because this module is READY. [Issue 15](https://github.com/TehShrike/deepmerge/issues/15) +- Regular expressions are now treated like primitive values when merging: [Issue 30](https://github.com/TehShrike/deepmerge/pull/30) +- Dates are now treated like primitives when merging: [Issue 31](https://github.com/TehShrike/deepmerge/issues/31) diff --git a/node_modules/deepmerge/dist/cjs.js b/node_modules/deepmerge/dist/cjs.js new file mode 100644 index 00000000..7c36cbdd --- /dev/null +++ b/node_modules/deepmerge/dist/cjs.js @@ -0,0 +1,133 @@ +'use strict'; + +var isMergeableObject = function isMergeableObject(value) { + return isNonNullObject(value) + && !isSpecial(value) +}; + +function isNonNullObject(value) { + return !!value && typeof value === 'object' +} + +function isSpecial(value) { + var stringValue = Object.prototype.toString.call(value); + + return stringValue === '[object RegExp]' + || stringValue === '[object Date]' + || isReactElement(value) +} + +// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 +var canUseSymbol = typeof Symbol === 'function' && Symbol.for; +var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; + +function isReactElement(value) { + return value.$$typeof === REACT_ELEMENT_TYPE +} + +function emptyTarget(val) { + return Array.isArray(val) ? [] : {} +} + +function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone !== false && options.isMergeableObject(value)) + ? deepmerge(emptyTarget(value), value, options) + : value +} + +function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options) + }) +} + +function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + var customMerge = options.customMerge(key); + return typeof customMerge === 'function' ? customMerge : deepmerge +} + +function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter(function(symbol) { + return Object.propertyIsEnumerable.call(target, symbol) + }) + : [] +} + +function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +} + +function propertyIsOnObject(object, property) { + try { + return property in object + } catch(_) { + return false + } +} + +// Protects from prototype poisoning and unexpected merging up the prototype chain. +function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. +} + +function mergeObject(target, source, options) { + var destination = {}; + if (options.isMergeableObject(target)) { + getKeys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); + }); + } + getKeys(source).forEach(function(key) { + if (propertyIsUnsafe(target, key)) { + return + } + + if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { + destination[key] = getMergeFunction(key, options)(target[key], source[key], options); + } else { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); + } + }); + return destination +} + +function deepmerge(target, source, options) { + options = options || {}; + options.arrayMerge = options.arrayMerge || defaultArrayMerge; + options.isMergeableObject = options.isMergeableObject || isMergeableObject; + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; + + var sourceIsArray = Array.isArray(source); + var targetIsArray = Array.isArray(target); + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } else { + return mergeObject(target, source, options) + } +} + +deepmerge.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') + } + + return array.reduce(function(prev, next) { + return deepmerge(prev, next, options) + }, {}) +}; + +var deepmerge_1 = deepmerge; + +module.exports = deepmerge_1; diff --git a/node_modules/deepmerge/dist/umd.js b/node_modules/deepmerge/dist/umd.js new file mode 100644 index 00000000..4071e7c5 --- /dev/null +++ b/node_modules/deepmerge/dist/umd.js @@ -0,0 +1,139 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.deepmerge = factory()); +}(this, function () { 'use strict'; + + var isMergeableObject = function isMergeableObject(value) { + return isNonNullObject(value) + && !isSpecial(value) + }; + + function isNonNullObject(value) { + return !!value && typeof value === 'object' + } + + function isSpecial(value) { + var stringValue = Object.prototype.toString.call(value); + + return stringValue === '[object RegExp]' + || stringValue === '[object Date]' + || isReactElement(value) + } + + // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 + var canUseSymbol = typeof Symbol === 'function' && Symbol.for; + var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; + + function isReactElement(value) { + return value.$$typeof === REACT_ELEMENT_TYPE + } + + function emptyTarget(val) { + return Array.isArray(val) ? [] : {} + } + + function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone !== false && options.isMergeableObject(value)) + ? deepmerge(emptyTarget(value), value, options) + : value + } + + function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options) + }) + } + + function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + var customMerge = options.customMerge(key); + return typeof customMerge === 'function' ? customMerge : deepmerge + } + + function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter(function(symbol) { + return Object.propertyIsEnumerable.call(target, symbol) + }) + : [] + } + + function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) + } + + function propertyIsOnObject(object, property) { + try { + return property in object + } catch(_) { + return false + } + } + + // Protects from prototype poisoning and unexpected merging up the prototype chain. + function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. + } + + function mergeObject(target, source, options) { + var destination = {}; + if (options.isMergeableObject(target)) { + getKeys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); + }); + } + getKeys(source).forEach(function(key) { + if (propertyIsUnsafe(target, key)) { + return + } + + if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { + destination[key] = getMergeFunction(key, options)(target[key], source[key], options); + } else { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); + } + }); + return destination + } + + function deepmerge(target, source, options) { + options = options || {}; + options.arrayMerge = options.arrayMerge || defaultArrayMerge; + options.isMergeableObject = options.isMergeableObject || isMergeableObject; + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; + + var sourceIsArray = Array.isArray(source); + var targetIsArray = Array.isArray(target); + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } else { + return mergeObject(target, source, options) + } + } + + deepmerge.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') + } + + return array.reduce(function(prev, next) { + return deepmerge(prev, next, options) + }, {}) + }; + + var deepmerge_1 = deepmerge; + + return deepmerge_1; + +})); diff --git a/node_modules/deepmerge/index.d.ts b/node_modules/deepmerge/index.d.ts new file mode 100644 index 00000000..46784de5 --- /dev/null +++ b/node_modules/deepmerge/index.d.ts @@ -0,0 +1,20 @@ +declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T; +declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T1 & T2; + +declare namespace deepmerge { + export interface Options { + arrayMerge?(target: any[], source: any[], options?: ArrayMergeOptions): any[]; + clone?: boolean; + customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined; + isMergeableObject?(value: object): boolean; + } + export interface ArrayMergeOptions { + isMergeableObject(value: object): boolean; + cloneUnlessOtherwiseSpecified(value: object, options?: Options): object; + } + + export function all (objects: object[], options?: Options): object; + export function all (objects: Partial[], options?: Options): T; +} + +export = deepmerge; diff --git a/node_modules/deepmerge/index.js b/node_modules/deepmerge/index.js new file mode 100644 index 00000000..77968aed --- /dev/null +++ b/node_modules/deepmerge/index.js @@ -0,0 +1,106 @@ +var defaultIsMergeableObject = require('is-mergeable-object') + +function emptyTarget(val) { + return Array.isArray(val) ? [] : {} +} + +function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone !== false && options.isMergeableObject(value)) + ? deepmerge(emptyTarget(value), value, options) + : value +} + +function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options) + }) +} + +function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + var customMerge = options.customMerge(key) + return typeof customMerge === 'function' ? customMerge : deepmerge +} + +function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter(function(symbol) { + return Object.propertyIsEnumerable.call(target, symbol) + }) + : [] +} + +function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +} + +function propertyIsOnObject(object, property) { + try { + return property in object + } catch(_) { + return false + } +} + +// Protects from prototype poisoning and unexpected merging up the prototype chain. +function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. +} + +function mergeObject(target, source, options) { + var destination = {} + if (options.isMergeableObject(target)) { + getKeys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options) + }) + } + getKeys(source).forEach(function(key) { + if (propertyIsUnsafe(target, key)) { + return + } + + if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { + destination[key] = getMergeFunction(key, options)(target[key], source[key], options) + } else { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options) + } + }) + return destination +} + +function deepmerge(target, source, options) { + options = options || {} + options.arrayMerge = options.arrayMerge || defaultArrayMerge + options.isMergeableObject = options.isMergeableObject || defaultIsMergeableObject + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified + + var sourceIsArray = Array.isArray(source) + var targetIsArray = Array.isArray(target) + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } else { + return mergeObject(target, source, options) + } +} + +deepmerge.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') + } + + return array.reduce(function(prev, next) { + return deepmerge(prev, next, options) + }, {}) +} + +module.exports = deepmerge diff --git a/node_modules/deepmerge/license.txt b/node_modules/deepmerge/license.txt new file mode 100644 index 00000000..50030787 --- /dev/null +++ b/node_modules/deepmerge/license.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2012 James Halliday, Josh Duff, and other 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/deepmerge/package.json b/node_modules/deepmerge/package.json new file mode 100644 index 00000000..2b7b1be8 --- /dev/null +++ b/node_modules/deepmerge/package.json @@ -0,0 +1,42 @@ +{ + "name": "deepmerge", + "description": "A library for deep (recursive) merging of Javascript objects", + "keywords": [ + "merge", + "deep", + "extend", + "copy", + "clone", + "recursive" + ], + "version": "4.3.1", + "homepage": "https://github.com/TehShrike/deepmerge", + "repository": { + "type": "git", + "url": "git://github.com/TehShrike/deepmerge.git" + }, + "main": "dist/cjs.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "build": "rollup -c", + "test": "npm run build && tape test/*.js && jsmd readme.md && npm run test:typescript", + "test:typescript": "tsc --noEmit test/typescript.ts && ts-node test/typescript.ts", + "size": "npm run build && uglifyjs --compress --mangle -- ./dist/umd.js | gzip -c | wc -c" + }, + "devDependencies": { + "@types/node": "^8.10.54", + "is-mergeable-object": "1.1.0", + "is-plain-object": "^5.0.0", + "jsmd": "^1.0.2", + "rollup": "^1.23.1", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-node-resolve": "^5.2.0", + "tape": "^4.11.0", + "ts-node": "7.0.1", + "typescript": "=2.2.2", + "uglify-js": "^3.6.1" + }, + "license": "MIT" +} diff --git a/node_modules/deepmerge/readme.md b/node_modules/deepmerge/readme.md new file mode 100644 index 00000000..79e4e303 --- /dev/null +++ b/node_modules/deepmerge/readme.md @@ -0,0 +1,264 @@ +# deepmerge + +Merges the enumerable properties of two or more objects deeply. + +> UMD bundle is 723B minified+gzipped + +## Getting Started + +### Example Usage + + +```js +const x = { + foo: { bar: 3 }, + array: [{ + does: 'work', + too: [ 1, 2, 3 ] + }] +} + +const y = { + foo: { baz: 4 }, + quux: 5, + array: [{ + does: 'work', + too: [ 4, 5, 6 ] + }, { + really: 'yes' + }] +} + +const output = { + foo: { + bar: 3, + baz: 4 + }, + array: [{ + does: 'work', + too: [ 1, 2, 3 ] + }, { + does: 'work', + too: [ 4, 5, 6 ] + }, { + really: 'yes' + }], + quux: 5 +} + +merge(x, y) // => output +``` + + +### Installation + +With [npm](http://npmjs.org) do: + +```sh +npm install deepmerge +``` + +deepmerge can be used directly in the browser without the use of package managers/bundlers as well: [UMD version from unpkg.com](https://unpkg.com/deepmerge/dist/umd.js). + + +### Include + +deepmerge exposes a CommonJS entry point: + +``` +const merge = require('deepmerge') +``` + +The ESM entry point was dropped due to a [Webpack bug](https://github.com/webpack/webpack/issues/6584). + +# API + + +## `merge(x, y, [options])` + +Merge two objects `x` and `y` deeply, returning a new merged object with the +elements from both `x` and `y`. + +If an element at the same key is present for both `x` and `y`, the value from +`y` will appear in the result. + +Merging creates a new object, so that neither `x` or `y` is modified. + +**Note:** By default, arrays are merged by concatenating them. + +## `merge.all(arrayOfObjects, [options])` + +Merges any number of objects into a single result object. + +```js +const foobar = { foo: { bar: 3 } } +const foobaz = { foo: { baz: 4 } } +const bar = { bar: 'yay!' } + +merge.all([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' } +``` + + +## Options + +### `arrayMerge` + +There are multiple ways to merge two arrays, below are a few examples but you can also create your own custom function. + +Your `arrayMerge` function will be called with three arguments: a `target` array, the `source` array, and an `options` object with these properties: + +- `isMergeableObject(value)` +- `cloneUnlessOtherwiseSpecified(value, options)` + +#### `arrayMerge` example: overwrite target array + +Overwrites the existing array values completely rather than concatenating them: + +```js +const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray + +merge( + [1, 2, 3], + [3, 2, 1], + { arrayMerge: overwriteMerge } +) // => [3, 2, 1] +``` + +#### `arrayMerge` example: combine arrays + +Combines objects at the same index in the two arrays. + +This was the default array merging algorithm pre-version-2.0.0. + +```js +const combineMerge = (target, source, options) => { + const destination = target.slice() + + source.forEach((item, index) => { + if (typeof destination[index] === 'undefined') { + destination[index] = options.cloneUnlessOtherwiseSpecified(item, options) + } else if (options.isMergeableObject(item)) { + destination[index] = merge(target[index], item, options) + } else if (target.indexOf(item) === -1) { + destination.push(item) + } + }) + return destination +} + +merge( + [{ a: true }], + [{ b: true }, 'ah yup'], + { arrayMerge: combineMerge } +) // => [{ a: true, b: true }, 'ah yup'] +``` + +### `isMergeableObject` + +By default, deepmerge clones every property from almost every kind of object. + +You may not want this, if your objects are of special types, and you want to copy the whole object instead of just copying its properties. + +You can accomplish this by passing in a function for the `isMergeableObject` option. + +If you only want to clone properties of plain objects, and ignore all "special" kinds of instantiated objects, you probably want to drop in [`is-plain-object`](https://github.com/jonschlinkert/is-plain-object). + +```js +const { isPlainObject } = require('is-plain-object') + +function SuperSpecial() { + this.special = 'oh yeah man totally' +} + +const instantiatedSpecialObject = new SuperSpecial() + +const target = { + someProperty: { + cool: 'oh for sure' + } +} + +const source = { + someProperty: instantiatedSpecialObject +} + +const defaultOutput = merge(target, source) + +defaultOutput.someProperty.cool // => 'oh for sure' +defaultOutput.someProperty.special // => 'oh yeah man totally' +defaultOutput.someProperty instanceof SuperSpecial // => false + +const customMergeOutput = merge(target, source, { + isMergeableObject: isPlainObject +}) + +customMergeOutput.someProperty.cool // => undefined +customMergeOutput.someProperty.special // => 'oh yeah man totally' +customMergeOutput.someProperty instanceof SuperSpecial // => true +``` + +### `customMerge` + +Specifies a function which can be used to override the default merge behavior for a property, based on the property name. + +The `customMerge` function will be passed the key for each property, and should return the function which should be used to merge the values for that property. + +It may also return undefined, in which case the default merge behaviour will be used. + +```js +const alex = { + name: { + first: 'Alex', + last: 'Alexson' + }, + pets: ['Cat', 'Parrot'] +} + +const tony = { + name: { + first: 'Tony', + last: 'Tonison' + }, + pets: ['Dog'] +} + +const mergeNames = (nameA, nameB) => `${nameA.first} and ${nameB.first}` + +const options = { + customMerge: (key) => { + if (key === 'name') { + return mergeNames + } + } +} + +const result = merge(alex, tony, options) + +result.name // => 'Alex and Tony' +result.pets // => ['Cat', 'Parrot', 'Dog'] +``` + + +### `clone` + +*Deprecated.* + +Defaults to `true`. + +If `clone` is `false` then child objects will be copied directly instead of being cloned. This was the default behavior before version 2.x. + + +# Testing + +With [npm](http://npmjs.org) do: + +```sh +npm test +``` + + +# License + +MIT diff --git a/node_modules/deepmerge/rollup.config.js b/node_modules/deepmerge/rollup.config.js new file mode 100644 index 00000000..8323ab27 --- /dev/null +++ b/node_modules/deepmerge/rollup.config.js @@ -0,0 +1,22 @@ +import resolve from 'rollup-plugin-node-resolve' +import commonjs from 'rollup-plugin-commonjs' +import pkg from './package.json' + +export default { + input: `index.js`, + plugins: [ + commonjs(), + resolve(), + ], + output: [ + { + file: pkg.main, + format: `cjs` + }, + { + name: 'deepmerge', + file: 'dist/umd.js', + format: `umd` + }, + ], +} diff --git a/node_modules/devalue/LICENSE b/node_modules/devalue/LICENSE new file mode 100644 index 00000000..c4e49f8d --- /dev/null +++ b/node_modules/devalue/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2018-19 [these people](https://github.com/rich-harris/devalue/graphs/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/devalue/README.md b/node_modules/devalue/README.md new file mode 100644 index 00000000..55599c0d --- /dev/null +++ b/node_modules/devalue/README.md @@ -0,0 +1,226 @@ +# devalue + +Like `JSON.stringify`, but handles + +- cyclical references (`obj.self = obj`) +- repeated references (`[value, value]`) +- `undefined`, `Infinity`, `NaN`, `-0` +- regular expressions +- dates +- `Map` and `Set` +- `BigInt` +- `ArrayBuffer` and Typed Arrays +- custom types via replacers, reducers and revivers + +Try it out [here](https://svelte.dev/repl/138d70def7a748ce9eda736ef1c71239?version=3.49.0). + +## Goals: + +- Performance +- Security (see [XSS mitigation](#xss-mitigation)) +- Compact output + +## Non-goals: + +- Human-readable output +- Stringifying functions + +## Usage + +There are two ways to use `devalue`: + +### `uneval` + +This function takes a JavaScript value and returns the JavaScript code to create an equivalent value — sort of like `eval` in reverse: + +```js +import * as devalue from 'devalue'; + +let obj = { message: 'hello' }; +devalue.uneval(obj); // '{message:"hello"}' + +obj.self = obj; +devalue.uneval(obj); // '(function(a){a.message="hello";a.self=a;return a}({}))' +``` + +Use `uneval` when you want the most compact possible output and don't want to include any code for parsing the serialized value. + +### `stringify` and `parse` + +These two functions are analogous to `JSON.stringify` and `JSON.parse`: + +```js +import * as devalue from 'devalue'; + +let obj = { message: 'hello' }; + +let stringified = devalue.stringify(obj); // '[{"message":1},"hello"]' +devalue.parse(stringified); // { message: 'hello' } + +obj.self = obj; + +stringified = devalue.stringify(obj); // '[{"message":1,"self":0},"hello"]' +devalue.parse(stringified); // { message: 'hello', self: [Circular] } +``` + +Use `stringify` and `parse` when evaluating JavaScript isn't an option. + +### `unflatten` + +In the case where devalued data is one part of a larger JSON string, `unflatten` allows you to revive just the bit you need: + +```js +import * as devalue from 'devalue'; + +const json = `{ + "type": "data", + "data": ${devalue.stringify(data)} +}`; + +const data = devalue.unflatten(JSON.parse(json).data); +``` + +## Custom types + +You can serialize and deserialize custom types by passing a second argument to `stringify` containing an object of types and their _reducers_, and a second argument to `parse` or `unflatten` containing an object of types and their _revivers_: + +```js +class Vector { + constructor(x, y) { + this.x = x; + this.y = y; + } + + magnitude() { + return Math.sqrt(this.x * this.x + this.y * this.y); + } +} + +const stringified = devalue.stringify(new Vector(30, 40), { + Vector: (value) => value instanceof Vector && [value.x, value.y] +}); + +console.log(stringified); // [["Vector",1],[2,3],30,40] + +const vector = devalue.parse(stringified, { + Vector: ([x, y]) => new Vector(x, y) +}); + +console.log(vector.magnitude()); // 50 +``` + +If a function passed to `stringify` returns a truthy value, it's treated as a match. + +You can also use custom types with `uneval` by specifying a custom replacer: + +```js +devalue.uneval(vector, (value, uneval) => { + if (value instanceof Vector) { + return `new Vector(${value.x},${value.y})`; + } +}); // `new Vector(30,40)` +``` + +Note that any variables referenced in the resulting JavaScript (like `Vector` in the example above) must be in scope when it runs. + +## Error handling + +If `uneval` or `stringify` encounters a function or a non-POJO that isn't handled by a custom replacer/reducer, it will throw an error. You can find where in the input data the offending value lives by inspecting `error.path`: + +```js +try { + const map = new Map(); + map.set('key', function invalid() {}); + + uneval({ + object: { + array: [map] + } + }); +} catch (e) { + console.log(e.path); // '.object.array[0].get("key")' +} +``` + +## XSS mitigation + +Say you're server-rendering a page and want to serialize some state, which could include user input. `JSON.stringify` doesn't protect against XSS attacks: + +```js +const state = { + userinput: ``; +``` + +Which would result in this: + +```html + + +``` + +Using `uneval` or `stringify`, we're protected against that attack: + +```js +const template = ` +`; +``` + +```html + +``` + +This, along with the fact that `uneval` and `stringify` bail on functions and non-POJOs, stops attackers from executing arbitrary code. Strings generated by `uneval` can be safely deserialized with `eval` or `new Function`: + +```js +const value = (0, eval)('(' + str + ')'); +``` + +## Other security considerations + +While `uneval` prevents the XSS vulnerability shown above, meaning you can use it to send data from server to client, **you should not send user data from client to server** using the same method. Since it has to be evaluated, an attacker that successfully submitted data that bypassed `uneval` would have access to your system. + +When using `eval`, ensure that you call it _indirectly_ so that the evaluated code doesn't have access to the surrounding scope: + +```js +{ + const sensitiveData = 'Setec Astronomy'; + eval('sendToEvilServer(sensitiveData)'); // pwned :( + (0, eval)('sendToEvilServer(sensitiveData)'); // nice try, evildoer! +} +``` + +Using `new Function(code)` is akin to using indirect eval. + +## See also + +- [lave](https://github.com/jed/lave) by Jed Schmidt +- [arson](https://github.com/benjamn/arson) by Ben Newman. The `stringify`/`parse` approach in `devalue` was inspired by `arson` +- [oson](https://github.com/KnorpelSenf/oson) by Steffen Trog +- [tosource](https://github.com/marcello3d/node-tosource) by Marcello Bastéa-Forte +- [serialize-javascript](https://github.com/yahoo/serialize-javascript) by Eric Ferraiuolo +- [jsesc](https://github.com/mathiasbynens/jsesc) by Mathias Bynens +- [superjson](https://github.com/blitz-js/superjson) by Blitz +- [next-json](https://github.com/iccicci/next-json) by Daniele Ricci + +## License + +[MIT](LICENSE) diff --git a/node_modules/devalue/index.js b/node_modules/devalue/index.js new file mode 100644 index 00000000..2bdd7615 --- /dev/null +++ b/node_modules/devalue/index.js @@ -0,0 +1,3 @@ +export { uneval } from './src/uneval.js'; +export { parse, unflatten } from './src/parse.js'; +export { stringify } from './src/stringify.js'; diff --git a/node_modules/devalue/package.json b/node_modules/devalue/package.json new file mode 100644 index 00000000..b82b55a8 --- /dev/null +++ b/node_modules/devalue/package.json @@ -0,0 +1,34 @@ +{ + "name": "devalue", + "description": "Gets the job done when JSON.stringify can't", + "version": "5.1.1", + "repository": "Rich-Harris/devalue", + "sideEffects": false, + "exports": { + ".": { + "types": "./types/index.d.ts", + "import": "./index.js", + "default": "./index.js" + } + }, + "files": [ + "index.js", + "src", + "types" + ], + "types": "./types/index.d.ts", + "devDependencies": { + "dts-buddy": "^0.0.4", + "publint": "^0.1.7", + "typescript": "^3.1.3", + "uvu": "^0.5.6" + }, + "scripts": { + "build": "dts-buddy", + "test": "uvu test", + "prepublishOnly": "npm test && npm run build && publint" + }, + "license": "MIT", + "type": "module", + "packageManager": "pnpm@8.5.1" +} diff --git a/node_modules/devalue/src/base64.js b/node_modules/devalue/src/base64.js new file mode 100644 index 00000000..23bd6b62 --- /dev/null +++ b/node_modules/devalue/src/base64.js @@ -0,0 +1,110 @@ +/** + * Base64 Encodes an arraybuffer + * @param {ArrayBuffer} arraybuffer + * @returns {string} + */ +export function encode64(arraybuffer) { + const dv = new DataView(arraybuffer); + let binaryString = ""; + + for (let i = 0; i < arraybuffer.byteLength; i++) { + binaryString += String.fromCharCode(dv.getUint8(i)); + } + + return binaryToAscii(binaryString); +} + +/** + * Decodes a base64 string into an arraybuffer + * @param {string} string + * @returns {ArrayBuffer} + */ +export function decode64(string) { + const binaryString = asciiToBinary(string); + const arraybuffer = new ArrayBuffer(binaryString.length); + const dv = new DataView(arraybuffer); + + for (let i = 0; i < arraybuffer.byteLength; i++) { + dv.setUint8(i, binaryString.charCodeAt(i)); + } + + return arraybuffer; +} + +const KEY_STRING = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +/** + * Substitute for atob since it's deprecated in node. + * Does not do any input validation. + * + * @see https://github.com/jsdom/abab/blob/master/lib/atob.js + * + * @param {string} data + * @returns {string} + */ +function asciiToBinary(data) { + if (data.length % 4 === 0) { + data = data.replace(/==?$/, ""); + } + + let output = ""; + let buffer = 0; + let accumulatedBits = 0; + + for (let i = 0; i < data.length; i++) { + buffer <<= 6; + buffer |= KEY_STRING.indexOf(data[i]); + accumulatedBits += 6; + if (accumulatedBits === 24) { + output += String.fromCharCode((buffer & 0xff0000) >> 16); + output += String.fromCharCode((buffer & 0xff00) >> 8); + output += String.fromCharCode(buffer & 0xff); + buffer = accumulatedBits = 0; + } + } + if (accumulatedBits === 12) { + buffer >>= 4; + output += String.fromCharCode(buffer); + } else if (accumulatedBits === 18) { + buffer >>= 2; + output += String.fromCharCode((buffer & 0xff00) >> 8); + output += String.fromCharCode(buffer & 0xff); + } + return output; +} + +/** + * Substitute for btoa since it's deprecated in node. + * Does not do any input validation. + * + * @see https://github.com/jsdom/abab/blob/master/lib/btoa.js + * + * @param {string} str + * @returns {string} + */ +function binaryToAscii(str) { + let out = ""; + for (let i = 0; i < str.length; i += 3) { + /** @type {[number, number, number, number]} */ + const groupsOfSix = [undefined, undefined, undefined, undefined]; + groupsOfSix[0] = str.charCodeAt(i) >> 2; + groupsOfSix[1] = (str.charCodeAt(i) & 0x03) << 4; + if (str.length > i + 1) { + groupsOfSix[1] |= str.charCodeAt(i + 1) >> 4; + groupsOfSix[2] = (str.charCodeAt(i + 1) & 0x0f) << 2; + } + if (str.length > i + 2) { + groupsOfSix[2] |= str.charCodeAt(i + 2) >> 6; + groupsOfSix[3] = str.charCodeAt(i + 2) & 0x3f; + } + for (let j = 0; j < groupsOfSix.length; j++) { + if (typeof groupsOfSix[j] === "undefined") { + out += "="; + } else { + out += KEY_STRING[groupsOfSix[j]]; + } + } + } + return out; +} diff --git a/node_modules/devalue/src/constants.js b/node_modules/devalue/src/constants.js new file mode 100644 index 00000000..ea9fda29 --- /dev/null +++ b/node_modules/devalue/src/constants.js @@ -0,0 +1,6 @@ +export const UNDEFINED = -1; +export const HOLE = -2; +export const NAN = -3; +export const POSITIVE_INFINITY = -4; +export const NEGATIVE_INFINITY = -5; +export const NEGATIVE_ZERO = -6; diff --git a/node_modules/devalue/src/parse.js b/node_modules/devalue/src/parse.js new file mode 100644 index 00000000..f0fe2c1f --- /dev/null +++ b/node_modules/devalue/src/parse.js @@ -0,0 +1,160 @@ +import { decode64 } from './base64.js'; +import { + HOLE, + NAN, + NEGATIVE_INFINITY, + NEGATIVE_ZERO, + POSITIVE_INFINITY, + UNDEFINED +} from './constants.js'; + +/** + * Revive a value serialized with `devalue.stringify` + * @param {string} serialized + * @param {Record any>} [revivers] + */ +export function parse(serialized, revivers) { + return unflatten(JSON.parse(serialized), revivers); +} + +/** + * Revive a value flattened with `devalue.stringify` + * @param {number | any[]} parsed + * @param {Record any>} [revivers] + */ +export function unflatten(parsed, revivers) { + if (typeof parsed === 'number') return hydrate(parsed, true); + + if (!Array.isArray(parsed) || parsed.length === 0) { + throw new Error('Invalid input'); + } + + const values = /** @type {any[]} */ (parsed); + + const hydrated = Array(values.length); + + /** + * @param {number} index + * @returns {any} + */ + function hydrate(index, standalone = false) { + if (index === UNDEFINED) return undefined; + if (index === NAN) return NaN; + if (index === POSITIVE_INFINITY) return Infinity; + if (index === NEGATIVE_INFINITY) return -Infinity; + if (index === NEGATIVE_ZERO) return -0; + + if (standalone) throw new Error(`Invalid input`); + + if (index in hydrated) return hydrated[index]; + + const value = values[index]; + + if (!value || typeof value !== 'object') { + hydrated[index] = value; + } else if (Array.isArray(value)) { + if (typeof value[0] === 'string') { + const type = value[0]; + + const reviver = revivers?.[type]; + if (reviver) { + return (hydrated[index] = reviver(hydrate(value[1]))); + } + + switch (type) { + case 'Date': + hydrated[index] = new Date(value[1]); + break; + + case 'Set': + const set = new Set(); + hydrated[index] = set; + for (let i = 1; i < value.length; i += 1) { + set.add(hydrate(value[i])); + } + break; + + case 'Map': + const map = new Map(); + hydrated[index] = map; + for (let i = 1; i < value.length; i += 2) { + map.set(hydrate(value[i]), hydrate(value[i + 1])); + } + break; + + case 'RegExp': + hydrated[index] = new RegExp(value[1], value[2]); + break; + + case 'Object': + hydrated[index] = Object(value[1]); + break; + + case 'BigInt': + hydrated[index] = BigInt(value[1]); + break; + + case 'null': + const obj = Object.create(null); + hydrated[index] = obj; + for (let i = 1; i < value.length; i += 2) { + obj[value[i]] = hydrate(value[i + 1]); + } + break; + + case "Int8Array": + case "Uint8Array": + case "Uint8ClampedArray": + case "Int16Array": + case "Uint16Array": + case "Int32Array": + case "Uint32Array": + case "Float32Array": + case "Float64Array": + case "BigInt64Array": + case "BigUint64Array": { + const TypedArrayConstructor = globalThis[type]; + const base64 = value[1]; + const arraybuffer = decode64(base64); + const typedArray = new TypedArrayConstructor(arraybuffer); + hydrated[index] = typedArray; + break; + } + + case "ArrayBuffer": { + const base64 = value[1]; + const arraybuffer = decode64(base64); + hydrated[index] = arraybuffer; + break; + } + + default: + throw new Error(`Unknown type ${type}`); + } + } else { + const array = new Array(value.length); + hydrated[index] = array; + + for (let i = 0; i < value.length; i += 1) { + const n = value[i]; + if (n === HOLE) continue; + + array[i] = hydrate(n); + } + } + } else { + /** @type {Record} */ + const object = {}; + hydrated[index] = object; + + for (const key in value) { + const n = value[key]; + object[key] = hydrate(n); + } + } + + return hydrated[index]; + } + + return hydrate(0); +} diff --git a/node_modules/devalue/src/stringify.js b/node_modules/devalue/src/stringify.js new file mode 100644 index 00000000..df291fdf --- /dev/null +++ b/node_modules/devalue/src/stringify.js @@ -0,0 +1,232 @@ +import { + DevalueError, + enumerable_symbols, + get_type, + is_plain_object, + is_primitive, + stringify_key, + stringify_string +} from './utils.js'; +import { + HOLE, + NAN, + NEGATIVE_INFINITY, + NEGATIVE_ZERO, + POSITIVE_INFINITY, + UNDEFINED +} from './constants.js'; +import { encode64 } from './base64.js'; + +/** + * Turn a value into a JSON string that can be parsed with `devalue.parse` + * @param {any} value + * @param {Record any>} [reducers] + */ +export function stringify(value, reducers) { + /** @type {any[]} */ + const stringified = []; + + /** @type {Map} */ + const indexes = new Map(); + + /** @type {Array<{ key: string, fn: (value: any) => any }>} */ + const custom = []; + if (reducers) { + for (const key of Object.getOwnPropertyNames(reducers)) { + custom.push({ key, fn: reducers[key] }); + } + } + + /** @type {string[]} */ + const keys = []; + + let p = 0; + + /** @param {any} thing */ + function flatten(thing) { + if (typeof thing === 'function') { + throw new DevalueError(`Cannot stringify a function`, keys); + } + + if (indexes.has(thing)) return indexes.get(thing); + + if (thing === undefined) return UNDEFINED; + if (Number.isNaN(thing)) return NAN; + if (thing === Infinity) return POSITIVE_INFINITY; + if (thing === -Infinity) return NEGATIVE_INFINITY; + if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO; + + const index = p++; + indexes.set(thing, index); + + for (const { key, fn } of custom) { + const value = fn(thing); + if (value) { + stringified[index] = `["${key}",${flatten(value)}]`; + return index; + } + } + + let str = ''; + + if (is_primitive(thing)) { + str = stringify_primitive(thing); + } else { + const type = get_type(thing); + + switch (type) { + case 'Number': + case 'String': + case 'Boolean': + str = `["Object",${stringify_primitive(thing)}]`; + break; + + case 'BigInt': + str = `["BigInt",${thing}]`; + break; + + case 'Date': + const valid = !isNaN(thing.getDate()); + str = `["Date","${valid ? thing.toISOString() : ''}"]`; + break; + + case 'RegExp': + const { source, flags } = thing; + str = flags + ? `["RegExp",${stringify_string(source)},"${flags}"]` + : `["RegExp",${stringify_string(source)}]`; + break; + + case 'Array': + str = '['; + + for (let i = 0; i < thing.length; i += 1) { + if (i > 0) str += ','; + + if (i in thing) { + keys.push(`[${i}]`); + str += flatten(thing[i]); + keys.pop(); + } else { + str += HOLE; + } + } + + str += ']'; + + break; + + case 'Set': + str = '["Set"'; + + for (const value of thing) { + str += `,${flatten(value)}`; + } + + str += ']'; + break; + + case 'Map': + str = '["Map"'; + + for (const [key, value] of thing) { + keys.push( + `.get(${is_primitive(key) ? stringify_primitive(key) : '...'})` + ); + str += `,${flatten(key)},${flatten(value)}`; + keys.pop(); + } + + str += ']'; + break; + + case "Int8Array": + case "Uint8Array": + case "Uint8ClampedArray": + case "Int16Array": + case "Uint16Array": + case "Int32Array": + case "Uint32Array": + case "Float32Array": + case "Float64Array": + case "BigInt64Array": + case "BigUint64Array": { + /** @type {import("./types.js").TypedArray} */ + const typedArray = thing; + const base64 = encode64(typedArray.buffer); + str = '["' + type + '","' + base64 + '"]'; + break; + } + + case "ArrayBuffer": { + /** @type {ArrayBuffer} */ + const arraybuffer = thing; + const base64 = encode64(arraybuffer); + + str = `["ArrayBuffer","${base64}"]`; + break; + } + + default: + if (!is_plain_object(thing)) { + throw new DevalueError( + `Cannot stringify arbitrary non-POJOs`, + keys + ); + } + + if (enumerable_symbols(thing).length > 0) { + throw new DevalueError( + `Cannot stringify POJOs with symbolic keys`, + keys + ); + } + + if (Object.getPrototypeOf(thing) === null) { + str = '["null"'; + for (const key in thing) { + keys.push(stringify_key(key)); + str += `,${stringify_string(key)},${flatten(thing[key])}`; + keys.pop(); + } + str += ']'; + } else { + str = '{'; + let started = false; + for (const key in thing) { + if (started) str += ','; + started = true; + keys.push(stringify_key(key)); + str += `${stringify_string(key)}:${flatten(thing[key])}`; + keys.pop(); + } + str += '}'; + } + } + } + + stringified[index] = str; + return index; + } + + const index = flatten(value); + + // special case — value is represented as a negative index + if (index < 0) return `${index}`; + + return `[${stringified.join(',')}]`; +} + +/** + * @param {any} thing + * @returns {string} + */ +function stringify_primitive(thing) { + const type = typeof thing; + if (type === 'string') return stringify_string(thing); + if (thing instanceof String) return stringify_string(thing.toString()); + if (thing === void 0) return UNDEFINED.toString(); + if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString(); + if (type === 'bigint') return `["BigInt","${thing}"]`; + return String(thing); +} diff --git a/node_modules/devalue/src/types.d.ts b/node_modules/devalue/src/types.d.ts new file mode 100644 index 00000000..5a2019f2 --- /dev/null +++ b/node_modules/devalue/src/types.d.ts @@ -0,0 +1 @@ +export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; \ No newline at end of file diff --git a/node_modules/devalue/src/uneval.js b/node_modules/devalue/src/uneval.js new file mode 100644 index 00000000..ce3ef34a --- /dev/null +++ b/node_modules/devalue/src/uneval.js @@ -0,0 +1,351 @@ +import { + DevalueError, + enumerable_symbols, + escaped, + get_type, + is_plain_object, + is_primitive, + stringify_key, + stringify_string +} from './utils.js'; + +const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$'; +const unsafe_chars = /[<\b\f\n\r\t\0\u2028\u2029]/g; +const reserved = + /^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/; + +/** + * Turn a value into the JavaScript that creates an equivalent value + * @param {any} value + * @param {(value: any) => string | void} [replacer] + */ +export function uneval(value, replacer) { + const counts = new Map(); + + /** @type {string[]} */ + const keys = []; + + const custom = new Map(); + + /** @param {any} thing */ + function walk(thing) { + if (typeof thing === 'function') { + throw new DevalueError(`Cannot stringify a function`, keys); + } + + if (!is_primitive(thing)) { + if (counts.has(thing)) { + counts.set(thing, counts.get(thing) + 1); + return; + } + + counts.set(thing, 1); + + if (replacer) { + const str = replacer(thing); + + if (typeof str === 'string') { + custom.set(thing, str); + return; + } + } + + const type = get_type(thing); + + switch (type) { + case 'Number': + case 'BigInt': + case 'String': + case 'Boolean': + case 'Date': + case 'RegExp': + return; + + case 'Array': + /** @type {any[]} */ (thing).forEach((value, i) => { + keys.push(`[${i}]`); + walk(value); + keys.pop(); + }); + break; + + case 'Set': + Array.from(thing).forEach(walk); + break; + + case 'Map': + for (const [key, value] of thing) { + keys.push( + `.get(${is_primitive(key) ? stringify_primitive(key) : '...'})` + ); + walk(value); + keys.pop(); + } + break; + + case "Int8Array": + case "Uint8Array": + case "Uint8ClampedArray": + case "Int16Array": + case "Uint16Array": + case "Int32Array": + case "Uint32Array": + case "Float32Array": + case "Float64Array": + case "BigInt64Array": + case "BigUint64Array": + return; + + case "ArrayBuffer": + return; + + default: + if (!is_plain_object(thing)) { + throw new DevalueError( + `Cannot stringify arbitrary non-POJOs`, + keys + ); + } + + if (enumerable_symbols(thing).length > 0) { + throw new DevalueError( + `Cannot stringify POJOs with symbolic keys`, + keys + ); + } + + for (const key in thing) { + keys.push(stringify_key(key)); + walk(thing[key]); + keys.pop(); + } + } + } + } + + walk(value); + + const names = new Map(); + + Array.from(counts) + .filter((entry) => entry[1] > 1) + .sort((a, b) => b[1] - a[1]) + .forEach((entry, i) => { + names.set(entry[0], get_name(i)); + }); + + /** + * @param {any} thing + * @returns {string} + */ + function stringify(thing) { + if (names.has(thing)) { + return names.get(thing); + } + + if (is_primitive(thing)) { + return stringify_primitive(thing); + } + + if (custom.has(thing)) { + return custom.get(thing); + } + + const type = get_type(thing); + + switch (type) { + case 'Number': + case 'String': + case 'Boolean': + return `Object(${stringify(thing.valueOf())})`; + + case 'RegExp': + return `new RegExp(${stringify_string(thing.source)}, "${ + thing.flags + }")`; + + case 'Date': + return `new Date(${thing.getTime()})`; + + case 'Array': + const members = /** @type {any[]} */ (thing).map((v, i) => + i in thing ? stringify(v) : '' + ); + const tail = thing.length === 0 || thing.length - 1 in thing ? '' : ','; + return `[${members.join(',')}${tail}]`; + + case 'Set': + case 'Map': + return `new ${type}([${Array.from(thing).map(stringify).join(',')}])`; + + case "Int8Array": + case "Uint8Array": + case "Uint8ClampedArray": + case "Int16Array": + case "Uint16Array": + case "Int32Array": + case "Uint32Array": + case "Float32Array": + case "Float64Array": + case "BigInt64Array": + case "BigUint64Array": { + /** @type {import("./types.js").TypedArray} */ + const typedArray = thing; + return `new ${type}([${typedArray.toString()}])`; + } + + case "ArrayBuffer": { + const ui8 = new Uint8Array(thing); + return `new Uint8Array([${ui8.toString()}]).buffer`; + } + + default: + const obj = `{${Object.keys(thing) + .map((key) => `${safe_key(key)}:${stringify(thing[key])}`) + .join(',')}}`; + const proto = Object.getPrototypeOf(thing); + if (proto === null) { + return Object.keys(thing).length > 0 + ? `Object.assign(Object.create(null),${obj})` + : `Object.create(null)`; + } + + return obj; + } + } + + const str = stringify(value); + + if (names.size) { + /** @type {string[]} */ + const params = []; + + /** @type {string[]} */ + const statements = []; + + /** @type {string[]} */ + const values = []; + + names.forEach((name, thing) => { + params.push(name); + + if (custom.has(thing)) { + values.push(/** @type {string} */ (custom.get(thing))); + return; + } + + if (is_primitive(thing)) { + values.push(stringify_primitive(thing)); + return; + } + + const type = get_type(thing); + + switch (type) { + case 'Number': + case 'String': + case 'Boolean': + values.push(`Object(${stringify(thing.valueOf())})`); + break; + + case 'RegExp': + values.push(thing.toString()); + break; + + case 'Date': + values.push(`new Date(${thing.getTime()})`); + break; + + case 'Array': + values.push(`Array(${thing.length})`); + /** @type {any[]} */ (thing).forEach((v, i) => { + statements.push(`${name}[${i}]=${stringify(v)}`); + }); + break; + + case 'Set': + values.push(`new Set`); + statements.push( + `${name}.${Array.from(thing) + .map((v) => `add(${stringify(v)})`) + .join('.')}` + ); + break; + + case 'Map': + values.push(`new Map`); + statements.push( + `${name}.${Array.from(thing) + .map(([k, v]) => `set(${stringify(k)}, ${stringify(v)})`) + .join('.')}` + ); + break; + + default: + values.push( + Object.getPrototypeOf(thing) === null ? 'Object.create(null)' : '{}' + ); + Object.keys(thing).forEach((key) => { + statements.push( + `${name}${safe_prop(key)}=${stringify(thing[key])}` + ); + }); + } + }); + + statements.push(`return ${str}`); + + return `(function(${params.join(',')}){${statements.join( + ';' + )}}(${values.join(',')}))`; + } else { + return str; + } +} + +/** @param {number} num */ +function get_name(num) { + let name = ''; + + do { + name = chars[num % chars.length] + name; + num = ~~(num / chars.length) - 1; + } while (num >= 0); + + return reserved.test(name) ? `${name}0` : name; +} + +/** @param {string} c */ +function escape_unsafe_char(c) { + return escaped[c] || c; +} + +/** @param {string} str */ +function escape_unsafe_chars(str) { + return str.replace(unsafe_chars, escape_unsafe_char); +} + +/** @param {string} key */ +function safe_key(key) { + return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) + ? key + : escape_unsafe_chars(JSON.stringify(key)); +} + +/** @param {string} key */ +function safe_prop(key) { + return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) + ? `.${key}` + : `[${escape_unsafe_chars(JSON.stringify(key))}]`; +} + +/** @param {any} thing */ +function stringify_primitive(thing) { + if (typeof thing === 'string') return stringify_string(thing); + if (thing === void 0) return 'void 0'; + if (thing === 0 && 1 / thing < 0) return '-0'; + const str = String(thing); + if (typeof thing === 'number') return str.replace(/^(-)?0\./, '$1.'); + if (typeof thing === 'bigint') return thing + 'n'; + return str; +} diff --git a/node_modules/devalue/src/utils.js b/node_modules/devalue/src/utils.js new file mode 100644 index 00000000..9dc9e512 --- /dev/null +++ b/node_modules/devalue/src/utils.js @@ -0,0 +1,113 @@ +/** @type {Record} */ +export const escaped = { + '<': '\\u003C', + '\\': '\\\\', + '\b': '\\b', + '\f': '\\f', + '\n': '\\n', + '\r': '\\r', + '\t': '\\t', + '\u2028': '\\u2028', + '\u2029': '\\u2029' +}; + +export class DevalueError extends Error { + /** + * @param {string} message + * @param {string[]} keys + */ + constructor(message, keys) { + super(message); + this.name = 'DevalueError'; + this.path = keys.join(''); + } +} + +/** @param {any} thing */ +export function is_primitive(thing) { + return Object(thing) !== thing; +} + +const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames( + Object.prototype +) + .sort() + .join('\0'); + +/** @param {any} thing */ +export function is_plain_object(thing) { + const proto = Object.getPrototypeOf(thing); + + return ( + proto === Object.prototype || + proto === null || + Object.getOwnPropertyNames(proto).sort().join('\0') === object_proto_names + ); +} + +/** @param {any} thing */ +export function get_type(thing) { + return Object.prototype.toString.call(thing).slice(8, -1); +} + +/** @param {string} char */ +function get_escaped_char(char) { + switch (char) { + case '"': + return '\\"'; + case '<': + return '\\u003C'; + case '\\': + return '\\\\'; + case '\n': + return '\\n'; + case '\r': + return '\\r'; + case '\t': + return '\\t'; + case '\b': + return '\\b'; + case '\f': + return '\\f'; + case '\u2028': + return '\\u2028'; + case '\u2029': + return '\\u2029'; + default: + return char < ' ' + ? `\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}` + : ''; + } +} + +/** @param {string} str */ +export function stringify_string(str) { + let result = ''; + let last_pos = 0; + const len = str.length; + + for (let i = 0; i < len; i += 1) { + const char = str[i]; + const replacement = get_escaped_char(char); + if (replacement) { + result += str.slice(last_pos, i) + replacement; + last_pos = i + 1; + } + } + + return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`; +} + +/** @param {Record} object */ +export function enumerable_symbols(object) { + return Object.getOwnPropertySymbols(object).filter( + (symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable + ); +} + +const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/; + +/** @param {string} key */ +export function stringify_key(key) { + return is_identifier.test(key) ? '.' + key : '[' + JSON.stringify(key) + ']'; +} diff --git a/node_modules/devalue/types/index.d.ts b/node_modules/devalue/types/index.d.ts new file mode 100644 index 00000000..86982052 --- /dev/null +++ b/node_modules/devalue/types/index.d.ts @@ -0,0 +1,26 @@ +declare module 'devalue' { + + /** + * Turn a value into the JavaScript that creates an equivalent value + * + */ + export function uneval(value: any, replacer?: (value: any) => string | void): string; + /** + * Turn a value into a JSON string that can be parsed with `devalue.parse` + * + */ + export function stringify(value: any, reducers?: Record any>): string; + /** + * Revive a value serialized with `devalue.stringify` + * + */ + export function parse(serialized: string, revivers?: Record any>): any; + /** + * Revive a value flattened with `devalue.stringify` + * + */ + export function unflatten(parsed: number | any[], revivers?: Record any>): any; +} + + +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/devalue/types/index.d.ts.map b/node_modules/devalue/types/index.d.ts.map new file mode 100644 index 00000000..8af843f6 --- /dev/null +++ b/node_modules/devalue/types/index.d.ts.map @@ -0,0 +1,21 @@ +{ + "version": 3, + "file": "index.d.ts", + "names": [ + "uneval", + "stringify", + "parse", + "unflatten" + ], + "sources": [ + "../src/uneval.js", + "../src/stringify.js", + "../src/parse.js" + ], + "sourcesContent": [ + null, + null, + null + ], + "mappings": ";;;;;;iBAqBgBA,MAAMA;;;;;iBCGNC,SAASA;;;;;iBCTTC,KAAKA;;;;;iBASLC,SAASA" +} \ No newline at end of file diff --git a/node_modules/didyoumean/LICENSE b/node_modules/didyoumean/LICENSE new file mode 100644 index 00000000..32c23dba --- /dev/null +++ b/node_modules/didyoumean/LICENSE @@ -0,0 +1,14 @@ +## License + +didYouMean.js copyright (c) 2013 Dave Porter. + +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 +[here](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. diff --git a/node_modules/didyoumean/README.md b/node_modules/didyoumean/README.md new file mode 100644 index 00000000..cd16698d --- /dev/null +++ b/node_modules/didyoumean/README.md @@ -0,0 +1,134 @@ +didYouMean.js - A simple JavaScript matching engine +=================================================== + +[Available on GitHub](https://github.com/dcporter/didyoumean.js). + +A super-simple, highly optimized JS library for matching human-quality input to a list of potential +matches. You can use it to suggest a misspelled command-line utility option to a user, or to offer +links to nearby valid URLs on your 404 page. (The examples below are taken from a personal project, +my [HTML5 business card](http://dcporter.aws.af.cm/me), which uses didYouMean.js to suggest correct +URLs from misspelled ones, such as [dcporter.aws.af.cm/me/instagarm](http://dcporter.aws.af.cm/me/instagarm).) +Uses the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance). + +didYouMean.js works in the browser as well as in node.js. To install it for use in node: + +``` +npm install didyoumean +``` + + +Examples +-------- + +Matching against a list of strings: +``` +var input = 'insargrm' +var list = ['facebook', 'twitter', 'instagram', 'linkedin']; +console.log(didYouMean(input, list)); +> 'instagram' +// The method matches 'insargrm' to 'instagram'. + +input = 'google plus'; +console.log(didYouMean(input, list)); +> null +// The method was unable to find 'google plus' in the list of options. +``` + +Matching against a list of objects: +``` +var input = 'insargrm'; +var list = [ { id: 'facebook' }, { id: 'twitter' }, { id: 'instagram' }, { id: 'linkedin' } ]; +var key = 'id'; +console.log(didYouMean(input, list, key)); +> 'instagram' +// The method returns the matching value. + +didYouMean.returnWinningObject = true; +console.log(didYouMean(input, list, key)); +> { id: 'instagram' } +// The method returns the matching object. +``` + + +didYouMean(str, list, [key]) +---------------------------- + +- str: The string input to match. +- list: An array of strings or objects to match against. +- key (OPTIONAL): If your list array contains objects, you must specify the key which contains the string + to match against. + +Returns: the closest matching string, or null if no strings exceed the threshold. + + +Options +------- + +Options are set on the didYouMean function object. You may change them at any time. + +### threshold + + By default, the method will only return strings whose edit distance is less than 40% (0.4x) of their length. + For example, if a ten-letter string is five edits away from its nearest match, the method will return null. + + You can control this by setting the "threshold" value on the didYouMean function. For example, to set the + edit distance threshold to 50% of the input string's length: + + ``` + didYouMean.threshold = 0.5; + ``` + + To return the nearest match no matter the threshold, set this value to null. + +### thresholdAbsolute + + This option behaves the same as threshold, but instead takes an integer number of edit steps. For example, + if thresholdAbsolute is set to 20 (the default), then the method will only return strings whose edit distance + is less than 20. Both options apply. + +### caseSensitive + + By default, the method will perform case-insensitive comparisons. If you wish to force case sensitivity, set + the "caseSensitive" value to true: + + ``` + didYouMean.caseSensitive = true; + ``` + +### nullResultValue + + By default, the method will return null if there is no sufficiently close match. You can change this value here. + +### returnWinningObject + + By default, the method will return the winning string value (if any). If your list contains objects rather + than strings, you may set returnWinningObject to true. + + ``` + didYouMean.returnWinningObject = true; + ``` + + This option has no effect on lists of strings. + +### returnFirstMatch + + By default, the method will search all values and return the closest match. If you're simply looking for a "good- + enough" match, you can set your thresholds appropriately and set returnFirstMatch to true to substantially speed + things up. + + +License +------- + +didYouMean copyright (c) 2013-2014 Dave Porter. + +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 +[here](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. diff --git a/node_modules/didyoumean/didYouMean-1.2.1.js b/node_modules/didyoumean/didYouMean-1.2.1.js new file mode 100644 index 00000000..febb30e8 --- /dev/null +++ b/node_modules/didyoumean/didYouMean-1.2.1.js @@ -0,0 +1,274 @@ +/* + +didYouMean.js - A simple JavaScript matching engine +=================================================== + +[Available on GitHub](https://github.com/dcporter/didyoumean.js). + +A super-simple, highly optimized JS library for matching human-quality input to a list of potential +matches. You can use it to suggest a misspelled command-line utility option to a user, or to offer +links to nearby valid URLs on your 404 page. (The examples below are taken from a personal project, +my [HTML5 business card](http://dcporter.aws.af.cm/me), which uses didYouMean.js to suggest correct +URLs from misspelled ones, such as [dcporter.aws.af.cm/me/instagarm](http://dcporter.aws.af.cm/me/instagarm).) +Uses the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance). + +didYouMean.js works in the browser as well as in node.js. To install it for use in node: + +``` +npm install didyoumean +``` + + +Examples +-------- + +Matching against a list of strings: +``` +var input = 'insargrm' +var list = ['facebook', 'twitter', 'instagram', 'linkedin']; +console.log(didYouMean(input, list)); +> 'instagram' +// The method matches 'insargrm' to 'instagram'. + +input = 'google plus'; +console.log(didYouMean(input, list)); +> null +// The method was unable to find 'google plus' in the list of options. +``` + +Matching against a list of objects: +``` +var input = 'insargrm'; +var list = [ { id: 'facebook' }, { id: 'twitter' }, { id: 'instagram' }, { id: 'linkedin' } ]; +var key = 'id'; +console.log(didYouMean(input, list, key)); +> 'instagram' +// The method returns the matching value. + +didYouMean.returnWinningObject = true; +console.log(didYouMean(input, list, key)); +> { id: 'instagram' } +// The method returns the matching object. +``` + + +didYouMean(str, list, [key]) +---------------------------- + +- str: The string input to match. +- list: An array of strings or objects to match against. +- key (OPTIONAL): If your list array contains objects, you must specify the key which contains the string + to match against. + +Returns: the closest matching string, or null if no strings exceed the threshold. + + +Options +------- + +Options are set on the didYouMean function object. You may change them at any time. + +### threshold + + By default, the method will only return strings whose edit distance is less than 40% (0.4x) of their length. + For example, if a ten-letter string is five edits away from its nearest match, the method will return null. + + You can control this by setting the "threshold" value on the didYouMean function. For example, to set the + edit distance threshold to 50% of the input string's length: + + ``` + didYouMean.threshold = 0.5; + ``` + + To return the nearest match no matter the threshold, set this value to null. + +### thresholdAbsolute + + This option behaves the same as threshold, but instead takes an integer number of edit steps. For example, + if thresholdAbsolute is set to 20 (the default), then the method will only return strings whose edit distance + is less than 20. Both options apply. + +### caseSensitive + + By default, the method will perform case-insensitive comparisons. If you wish to force case sensitivity, set + the "caseSensitive" value to true: + + ``` + didYouMean.caseSensitive = true; + ``` + +### nullResultValue + + By default, the method will return null if there is no sufficiently close match. You can change this value here. + +### returnWinningObject + + By default, the method will return the winning string value (if any). If your list contains objects rather + than strings, you may set returnWinningObject to true. + + ``` + didYouMean.returnWinningObject = true; + ``` + + This option has no effect on lists of strings. + +### returnFirstMatch + + By default, the method will search all values and return the closest match. If you're simply looking for a "good- + enough" match, you can set your thresholds appropriately and set returnFirstMatch to true to substantially speed + things up. + + +License +------- + +didYouMean copyright (c) 2013-2014 Dave Porter. + +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 +[here](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. + +*/ +(function() { + "use strict"; + + // The didYouMean method. + function didYouMean(str, list, key) { + if (!str) return null; + + // If we're running a case-insensitive search, smallify str. + if (!didYouMean.caseSensitive) { str = str.toLowerCase(); } + + // Calculate the initial value (the threshold) if present. + var thresholdRelative = didYouMean.threshold === null ? null : didYouMean.threshold * str.length, + thresholdAbsolute = didYouMean.thresholdAbsolute, + winningVal; + if (thresholdRelative !== null && thresholdAbsolute !== null) winningVal = Math.min(thresholdRelative, thresholdAbsolute); + else if (thresholdRelative !== null) winningVal = thresholdRelative; + else if (thresholdAbsolute !== null) winningVal = thresholdAbsolute; + else winningVal = null; + + // Get the edit distance to each option. If the closest one is less than 40% (by default) of str's length, + // then return it. + var winner, candidate, testCandidate, val, + i, len = list.length; + for (i = 0; i < len; i++) { + // Get item. + candidate = list[i]; + // If there's a key, get the candidate value out of the object. + if (key) { candidate = candidate[key]; } + // Gatekeep. + if (!candidate) { continue; } + // If we're running a case-insensitive search, smallify the candidate. + if (!didYouMean.caseSensitive) { testCandidate = candidate.toLowerCase(); } + else { testCandidate = candidate; } + // Get and compare edit distance. + val = getEditDistance(str, testCandidate, winningVal); + // If this value is smaller than our current winning value, OR if we have no winning val yet (i.e. the + // threshold option is set to null, meaning the caller wants a match back no matter how bad it is), then + // this is our new winner. + if (winningVal === null || val < winningVal) { + winningVal = val; + // Set the winner to either the value or its object, depending on the returnWinningObject option. + if (key && didYouMean.returnWinningObject) winner = list[i]; + else winner = candidate; + // If we're returning the first match, return it now. + if (didYouMean.returnFirstMatch) return winner; + } + } + + // If we have a winner, return it. + return winner || didYouMean.nullResultValue; + } + + // Set default options. + didYouMean.threshold = 0.4; + didYouMean.thresholdAbsolute = 20; + didYouMean.caseSensitive = false; + didYouMean.nullResultValue = null; + didYouMean.returnWinningObject = null; + didYouMean.returnFirstMatch = false; + + // Expose. + // In node... + if (typeof module !== 'undefined' && module.exports) { + module.exports = didYouMean; + } + // Otherwise... + else { + window.didYouMean = didYouMean; + } + + var MAX_INT = Math.pow(2,32) - 1; // We could probably go higher than this, but for practical reasons let's not. + function getEditDistance(a, b, max) { + // Handle null or undefined max. + max = max || max === 0 ? max : MAX_INT; + + var lena = a.length; + var lenb = b.length; + + // Fast path - no A or B. + if (lena === 0) return Math.min(max + 1, lenb); + if (lenb === 0) return Math.min(max + 1, lena); + + // Fast path - length diff larger than max. + if (Math.abs(lena - lenb) > max) return max + 1; + + // Slow path. + var matrix = [], + i, j, colMin, minJ, maxJ; + + // Set up the first row ([0, 1, 2, 3, etc]). + for (i = 0; i <= lenb; i++) { matrix[i] = [i]; } + + // Set up the first column (same). + for (j = 0; j <= lena; j++) { matrix[0][j] = j; } + + // Loop over the rest of the columns. + for (i = 1; i <= lenb; i++) { + colMin = MAX_INT; + minJ = 1; + if (i > max) minJ = i - max; + maxJ = lenb + 1; + if (maxJ > max + i) maxJ = max + i; + // Loop over the rest of the rows. + for (j = 1; j <= lena; j++) { + // If j is out of bounds, just put a large value in the slot. + if (j < minJ || j > maxJ) { + matrix[i][j] = max + 1; + } + + // Otherwise do the normal Levenshtein thing. + else { + // If the characters are the same, there's no change in edit distance. + if (b.charAt(i - 1) === a.charAt(j - 1)) { + matrix[i][j] = matrix[i - 1][j - 1]; + } + // Otherwise, see if we're substituting, inserting or deleting. + else { + matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // Substitute + Math.min(matrix[i][j - 1] + 1, // Insert + matrix[i - 1][j] + 1)); // Delete + } + } + + // Either way, update colMin. + if (matrix[i][j] < colMin) colMin = matrix[i][j]; + } + + // If this column's minimum is greater than the allowed maximum, there's no point + // in going on with life. + if (colMin > max) return max + 1; + } + // If we made it this far without running into the max, then return the final matrix value. + return matrix[lenb][lena]; + } + +})(); diff --git a/node_modules/didyoumean/didYouMean-1.2.1.min.js b/node_modules/didyoumean/didYouMean-1.2.1.min.js new file mode 100644 index 00000000..c41abd8e --- /dev/null +++ b/node_modules/didyoumean/didYouMean-1.2.1.min.js @@ -0,0 +1,17 @@ +/* + didYouMean.js copyright (c) 2013-2014 Dave Porter. + + [Available on GitHub](https://github.com/dcporter/didyoumean.js). + + 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 + [here](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. +*/ +(function(){"use strict";function e(t,r,i){if(!t)return null;if(!e.caseSensitive){t=t.toLowerCase()}var s=e.threshold===null?null:e.threshold*t.length,o=e.thresholdAbsolute,u;if(s!==null&&o!==null)u=Math.min(s,o);else if(s!==null)u=s;else if(o!==null)u=o;else u=null;var a,f,l,c,h,p=r.length;for(h=0;hr)return r+1;var o=[],u,a,f,l,c;for(u=0;u<=s;u++){o[u]=[u]}for(a=0;a<=i;a++){o[0][a]=a}for(u=1;u<=s;u++){f=t;l=1;if(u>r)l=u-r;c=s+1;if(c>r+u)c=r+u;for(a=1;a<=i;a++){if(ac){o[u][a]=r+1}else{if(n.charAt(u-1)===e.charAt(a-1)){o[u][a]=o[u-1][a-1]}else{o[u][a]=Math.min(o[u-1][a-1]+1,Math.min(o[u][a-1]+1,o[u-1][a]+1))}}if(o[u][a]r)return r+1}return o[s][i]}e.threshold=.4;e.thresholdAbsolute=20;e.caseSensitive=false;e.nullResultValue=null;e.returnWinningObject=null;e.returnFirstMatch=false;if(typeof module!=="undefined"&&module.exports){module.exports=e}else{window.didYouMean=e}var t=Math.pow(2,32)-1})(); \ No newline at end of file diff --git a/node_modules/didyoumean/package.json b/node_modules/didyoumean/package.json new file mode 100755 index 00000000..1301d038 --- /dev/null +++ b/node_modules/didyoumean/package.json @@ -0,0 +1,27 @@ +{ + "name": "didyoumean", + "version": "1.2.2", + "description": "Match human-quality input to potential matches by edit distance.", + "homepage": "https://github.com/dcporter/didyoumean.js", + "author": { + "name": "Dave Porter", + "email": "dcporter@gmail.com", + "url": "http://dcporter.net/" + }, + "keywords": [ + "didyoumean", + "mean", + "edit", + "distance", + "levenshtein" + ], + "main": "./didYouMean-1.2.1.js", + "repository": { + "type": "git", + "url": "https://github.com/dcporter/didyoumean.js.git" + }, + "bugs": { + "url": "https://github.com/dcporter/didyoumean.js/issues" + }, + "license": "Apache-2.0" +} diff --git a/node_modules/dlv/README.md b/node_modules/dlv/README.md new file mode 100644 index 00000000..6a8429d3 --- /dev/null +++ b/node_modules/dlv/README.md @@ -0,0 +1,76 @@ +# `dlv(obj, keypath)` [![NPM](https://img.shields.io/npm/v/dlv.svg)](https://npmjs.com/package/dlv) [![Build](https://travis-ci.org/developit/dlv.svg?branch=master)](https://travis-ci.org/developit/dlv) + +> Safely get a dot-notated path within a nested object, with ability to return a default if the full key path does not exist or the value is undefined + + +### Why? + +Smallest possible implementation: only **130 bytes.** + +You could write this yourself, but then you'd have to write [tests]. + +Supports ES Modules, CommonJS and globals. + + +### Installation + +`npm install --save dlv` + + +### Usage + +`delve(object, keypath, [default])` + +```js +import delve from 'dlv'; + +let obj = { + a: { + b: { + c: 1, + d: undefined, + e: null + } + } +}; + +//use string dot notation for keys +delve(obj, 'a.b.c') === 1; + +//or use an array key +delve(obj, ['a', 'b', 'c']) === 1; + +delve(obj, 'a.b') === obj.a.b; + +//returns undefined if the full key path does not exist and no default is specified +delve(obj, 'a.b.f') === undefined; + +//optional third parameter for default if the full key in path is missing +delve(obj, 'a.b.f', 'foo') === 'foo'; + +//or if the key exists but the value is undefined +delve(obj, 'a.b.d', 'foo') === 'foo'; + +//Non-truthy defined values are still returned if they exist at the full keypath +delve(obj, 'a.b.e', 'foo') === null; + +//undefined obj or key returns undefined, unless a default is supplied +delve(undefined, 'a.b.c') === undefined; +delve(undefined, 'a.b.c', 'foo') === 'foo'; +delve(obj, undefined, 'foo') === 'foo'; +``` + + +### Setter Counterparts + +- [dset](https://github.com/lukeed/dset) by [@lukeed](https://github.com/lukeed) is the spiritual "set" counterpart of `dlv` and very fast. +- [bury](https://github.com/kalmbach/bury) by [@kalmbach](https://github.com/kalmbach) does the opposite of `dlv` and is implemented in a very similar manner. + + +### License + +[MIT](https://oss.ninja/mit/developit/) + + +[preact]: https://github.com/developit/preact +[tests]: https://github.com/developit/dlv/blob/master/test.js diff --git a/node_modules/dlv/dist/dlv.es.js b/node_modules/dlv/dist/dlv.es.js new file mode 100644 index 00000000..06b981b9 --- /dev/null +++ b/node_modules/dlv/dist/dlv.es.js @@ -0,0 +1,2 @@ +export default function(t,e,l,n,r){for(e=e.split?e.split("."):e,n=0;n (http://jasonformat.com)", + "repository": "developit/dlv", + "license": "MIT", + "devDependencies": { + "microbundle": "^0.11.0" + } +} diff --git a/node_modules/eastasianwidth/README.md b/node_modules/eastasianwidth/README.md new file mode 100644 index 00000000..a8b71ee5 --- /dev/null +++ b/node_modules/eastasianwidth/README.md @@ -0,0 +1,32 @@ +# East Asian Width + +Get [East Asian Width](http://www.unicode.org/reports/tr11/) from a character. + +'F'(Fullwidth), 'H'(Halfwidth), 'W'(Wide), 'Na'(Narrow), 'A'(Ambiguous) or 'N'(Natural). + +Original Code is [東アジアの文字幅 (East Asian Width) の判定 - 中途](http://d.hatena.ne.jp/takenspc/20111126#1322252878). + +## Install + + $ npm install eastasianwidth + +## Usage + + var eaw = require('eastasianwidth'); + console.log(eaw.eastAsianWidth('₩')) // 'F' + console.log(eaw.eastAsianWidth('。')) // 'H' + console.log(eaw.eastAsianWidth('뀀')) // 'W' + console.log(eaw.eastAsianWidth('a')) // 'Na' + console.log(eaw.eastAsianWidth('①')) // 'A' + console.log(eaw.eastAsianWidth('ف')) // 'N' + + console.log(eaw.characterLength('₩')) // 2 + console.log(eaw.characterLength('。')) // 1 + console.log(eaw.characterLength('뀀')) // 2 + console.log(eaw.characterLength('a')) // 1 + console.log(eaw.characterLength('①')) // 2 + console.log(eaw.characterLength('ف')) // 1 + + console.log(eaw.length('あいうえお')) // 10 + console.log(eaw.length('abcdefg')) // 7 + console.log(eaw.length('¢₩。ᅵㄅ뀀¢⟭a⊙①بف')) // 19 diff --git a/node_modules/eastasianwidth/eastasianwidth.js b/node_modules/eastasianwidth/eastasianwidth.js new file mode 100644 index 00000000..7d0aa0f6 --- /dev/null +++ b/node_modules/eastasianwidth/eastasianwidth.js @@ -0,0 +1,311 @@ +var eaw = {}; + +if ('undefined' == typeof module) { + window.eastasianwidth = eaw; +} else { + module.exports = eaw; +} + +eaw.eastAsianWidth = function(character) { + var x = character.charCodeAt(0); + var y = (character.length == 2) ? character.charCodeAt(1) : 0; + var codePoint = x; + if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) { + x &= 0x3FF; + y &= 0x3FF; + codePoint = (x << 10) | y; + codePoint += 0x10000; + } + + if ((0x3000 == codePoint) || + (0xFF01 <= codePoint && codePoint <= 0xFF60) || + (0xFFE0 <= codePoint && codePoint <= 0xFFE6)) { + return 'F'; + } + if ((0x20A9 == codePoint) || + (0xFF61 <= codePoint && codePoint <= 0xFFBE) || + (0xFFC2 <= codePoint && codePoint <= 0xFFC7) || + (0xFFCA <= codePoint && codePoint <= 0xFFCF) || + (0xFFD2 <= codePoint && codePoint <= 0xFFD7) || + (0xFFDA <= codePoint && codePoint <= 0xFFDC) || + (0xFFE8 <= codePoint && codePoint <= 0xFFEE)) { + return 'H'; + } + if ((0x1100 <= codePoint && codePoint <= 0x115F) || + (0x11A3 <= codePoint && codePoint <= 0x11A7) || + (0x11FA <= codePoint && codePoint <= 0x11FF) || + (0x2329 <= codePoint && codePoint <= 0x232A) || + (0x2E80 <= codePoint && codePoint <= 0x2E99) || + (0x2E9B <= codePoint && codePoint <= 0x2EF3) || + (0x2F00 <= codePoint && codePoint <= 0x2FD5) || + (0x2FF0 <= codePoint && codePoint <= 0x2FFB) || + (0x3001 <= codePoint && codePoint <= 0x303E) || + (0x3041 <= codePoint && codePoint <= 0x3096) || + (0x3099 <= codePoint && codePoint <= 0x30FF) || + (0x3105 <= codePoint && codePoint <= 0x312D) || + (0x3131 <= codePoint && codePoint <= 0x318E) || + (0x3190 <= codePoint && codePoint <= 0x31BA) || + (0x31C0 <= codePoint && codePoint <= 0x31E3) || + (0x31F0 <= codePoint && codePoint <= 0x321E) || + (0x3220 <= codePoint && codePoint <= 0x3247) || + (0x3250 <= codePoint && codePoint <= 0x32FE) || + (0x3300 <= codePoint && codePoint <= 0x4DBF) || + (0x4E00 <= codePoint && codePoint <= 0xA48C) || + (0xA490 <= codePoint && codePoint <= 0xA4C6) || + (0xA960 <= codePoint && codePoint <= 0xA97C) || + (0xAC00 <= codePoint && codePoint <= 0xD7A3) || + (0xD7B0 <= codePoint && codePoint <= 0xD7C6) || + (0xD7CB <= codePoint && codePoint <= 0xD7FB) || + (0xF900 <= codePoint && codePoint <= 0xFAFF) || + (0xFE10 <= codePoint && codePoint <= 0xFE19) || + (0xFE30 <= codePoint && codePoint <= 0xFE52) || + (0xFE54 <= codePoint && codePoint <= 0xFE66) || + (0xFE68 <= codePoint && codePoint <= 0xFE6B) || + (0x1B000 <= codePoint && codePoint <= 0x1B001) || + (0x1F200 <= codePoint && codePoint <= 0x1F202) || + (0x1F210 <= codePoint && codePoint <= 0x1F23A) || + (0x1F240 <= codePoint && codePoint <= 0x1F248) || + (0x1F250 <= codePoint && codePoint <= 0x1F251) || + (0x20000 <= codePoint && codePoint <= 0x2F73F) || + (0x2B740 <= codePoint && codePoint <= 0x2FFFD) || + (0x30000 <= codePoint && codePoint <= 0x3FFFD)) { + return 'W'; + } + if ((0x0020 <= codePoint && codePoint <= 0x007E) || + (0x00A2 <= codePoint && codePoint <= 0x00A3) || + (0x00A5 <= codePoint && codePoint <= 0x00A6) || + (0x00AC == codePoint) || + (0x00AF == codePoint) || + (0x27E6 <= codePoint && codePoint <= 0x27ED) || + (0x2985 <= codePoint && codePoint <= 0x2986)) { + return 'Na'; + } + if ((0x00A1 == codePoint) || + (0x00A4 == codePoint) || + (0x00A7 <= codePoint && codePoint <= 0x00A8) || + (0x00AA == codePoint) || + (0x00AD <= codePoint && codePoint <= 0x00AE) || + (0x00B0 <= codePoint && codePoint <= 0x00B4) || + (0x00B6 <= codePoint && codePoint <= 0x00BA) || + (0x00BC <= codePoint && codePoint <= 0x00BF) || + (0x00C6 == codePoint) || + (0x00D0 == codePoint) || + (0x00D7 <= codePoint && codePoint <= 0x00D8) || + (0x00DE <= codePoint && codePoint <= 0x00E1) || + (0x00E6 == codePoint) || + (0x00E8 <= codePoint && codePoint <= 0x00EA) || + (0x00EC <= codePoint && codePoint <= 0x00ED) || + (0x00F0 == codePoint) || + (0x00F2 <= codePoint && codePoint <= 0x00F3) || + (0x00F7 <= codePoint && codePoint <= 0x00FA) || + (0x00FC == codePoint) || + (0x00FE == codePoint) || + (0x0101 == codePoint) || + (0x0111 == codePoint) || + (0x0113 == codePoint) || + (0x011B == codePoint) || + (0x0126 <= codePoint && codePoint <= 0x0127) || + (0x012B == codePoint) || + (0x0131 <= codePoint && codePoint <= 0x0133) || + (0x0138 == codePoint) || + (0x013F <= codePoint && codePoint <= 0x0142) || + (0x0144 == codePoint) || + (0x0148 <= codePoint && codePoint <= 0x014B) || + (0x014D == codePoint) || + (0x0152 <= codePoint && codePoint <= 0x0153) || + (0x0166 <= codePoint && codePoint <= 0x0167) || + (0x016B == codePoint) || + (0x01CE == codePoint) || + (0x01D0 == codePoint) || + (0x01D2 == codePoint) || + (0x01D4 == codePoint) || + (0x01D6 == codePoint) || + (0x01D8 == codePoint) || + (0x01DA == codePoint) || + (0x01DC == codePoint) || + (0x0251 == codePoint) || + (0x0261 == codePoint) || + (0x02C4 == codePoint) || + (0x02C7 == codePoint) || + (0x02C9 <= codePoint && codePoint <= 0x02CB) || + (0x02CD == codePoint) || + (0x02D0 == codePoint) || + (0x02D8 <= codePoint && codePoint <= 0x02DB) || + (0x02DD == codePoint) || + (0x02DF == codePoint) || + (0x0300 <= codePoint && codePoint <= 0x036F) || + (0x0391 <= codePoint && codePoint <= 0x03A1) || + (0x03A3 <= codePoint && codePoint <= 0x03A9) || + (0x03B1 <= codePoint && codePoint <= 0x03C1) || + (0x03C3 <= codePoint && codePoint <= 0x03C9) || + (0x0401 == codePoint) || + (0x0410 <= codePoint && codePoint <= 0x044F) || + (0x0451 == codePoint) || + (0x2010 == codePoint) || + (0x2013 <= codePoint && codePoint <= 0x2016) || + (0x2018 <= codePoint && codePoint <= 0x2019) || + (0x201C <= codePoint && codePoint <= 0x201D) || + (0x2020 <= codePoint && codePoint <= 0x2022) || + (0x2024 <= codePoint && codePoint <= 0x2027) || + (0x2030 == codePoint) || + (0x2032 <= codePoint && codePoint <= 0x2033) || + (0x2035 == codePoint) || + (0x203B == codePoint) || + (0x203E == codePoint) || + (0x2074 == codePoint) || + (0x207F == codePoint) || + (0x2081 <= codePoint && codePoint <= 0x2084) || + (0x20AC == codePoint) || + (0x2103 == codePoint) || + (0x2105 == codePoint) || + (0x2109 == codePoint) || + (0x2113 == codePoint) || + (0x2116 == codePoint) || + (0x2121 <= codePoint && codePoint <= 0x2122) || + (0x2126 == codePoint) || + (0x212B == codePoint) || + (0x2153 <= codePoint && codePoint <= 0x2154) || + (0x215B <= codePoint && codePoint <= 0x215E) || + (0x2160 <= codePoint && codePoint <= 0x216B) || + (0x2170 <= codePoint && codePoint <= 0x2179) || + (0x2189 == codePoint) || + (0x2190 <= codePoint && codePoint <= 0x2199) || + (0x21B8 <= codePoint && codePoint <= 0x21B9) || + (0x21D2 == codePoint) || + (0x21D4 == codePoint) || + (0x21E7 == codePoint) || + (0x2200 == codePoint) || + (0x2202 <= codePoint && codePoint <= 0x2203) || + (0x2207 <= codePoint && codePoint <= 0x2208) || + (0x220B == codePoint) || + (0x220F == codePoint) || + (0x2211 == codePoint) || + (0x2215 == codePoint) || + (0x221A == codePoint) || + (0x221D <= codePoint && codePoint <= 0x2220) || + (0x2223 == codePoint) || + (0x2225 == codePoint) || + (0x2227 <= codePoint && codePoint <= 0x222C) || + (0x222E == codePoint) || + (0x2234 <= codePoint && codePoint <= 0x2237) || + (0x223C <= codePoint && codePoint <= 0x223D) || + (0x2248 == codePoint) || + (0x224C == codePoint) || + (0x2252 == codePoint) || + (0x2260 <= codePoint && codePoint <= 0x2261) || + (0x2264 <= codePoint && codePoint <= 0x2267) || + (0x226A <= codePoint && codePoint <= 0x226B) || + (0x226E <= codePoint && codePoint <= 0x226F) || + (0x2282 <= codePoint && codePoint <= 0x2283) || + (0x2286 <= codePoint && codePoint <= 0x2287) || + (0x2295 == codePoint) || + (0x2299 == codePoint) || + (0x22A5 == codePoint) || + (0x22BF == codePoint) || + (0x2312 == codePoint) || + (0x2460 <= codePoint && codePoint <= 0x24E9) || + (0x24EB <= codePoint && codePoint <= 0x254B) || + (0x2550 <= codePoint && codePoint <= 0x2573) || + (0x2580 <= codePoint && codePoint <= 0x258F) || + (0x2592 <= codePoint && codePoint <= 0x2595) || + (0x25A0 <= codePoint && codePoint <= 0x25A1) || + (0x25A3 <= codePoint && codePoint <= 0x25A9) || + (0x25B2 <= codePoint && codePoint <= 0x25B3) || + (0x25B6 <= codePoint && codePoint <= 0x25B7) || + (0x25BC <= codePoint && codePoint <= 0x25BD) || + (0x25C0 <= codePoint && codePoint <= 0x25C1) || + (0x25C6 <= codePoint && codePoint <= 0x25C8) || + (0x25CB == codePoint) || + (0x25CE <= codePoint && codePoint <= 0x25D1) || + (0x25E2 <= codePoint && codePoint <= 0x25E5) || + (0x25EF == codePoint) || + (0x2605 <= codePoint && codePoint <= 0x2606) || + (0x2609 == codePoint) || + (0x260E <= codePoint && codePoint <= 0x260F) || + (0x2614 <= codePoint && codePoint <= 0x2615) || + (0x261C == codePoint) || + (0x261E == codePoint) || + (0x2640 == codePoint) || + (0x2642 == codePoint) || + (0x2660 <= codePoint && codePoint <= 0x2661) || + (0x2663 <= codePoint && codePoint <= 0x2665) || + (0x2667 <= codePoint && codePoint <= 0x266A) || + (0x266C <= codePoint && codePoint <= 0x266D) || + (0x266F == codePoint) || + (0x269E <= codePoint && codePoint <= 0x269F) || + (0x26BE <= codePoint && codePoint <= 0x26BF) || + (0x26C4 <= codePoint && codePoint <= 0x26CD) || + (0x26CF <= codePoint && codePoint <= 0x26E1) || + (0x26E3 == codePoint) || + (0x26E8 <= codePoint && codePoint <= 0x26FF) || + (0x273D == codePoint) || + (0x2757 == codePoint) || + (0x2776 <= codePoint && codePoint <= 0x277F) || + (0x2B55 <= codePoint && codePoint <= 0x2B59) || + (0x3248 <= codePoint && codePoint <= 0x324F) || + (0xE000 <= codePoint && codePoint <= 0xF8FF) || + (0xFE00 <= codePoint && codePoint <= 0xFE0F) || + (0xFFFD == codePoint) || + (0x1F100 <= codePoint && codePoint <= 0x1F10A) || + (0x1F110 <= codePoint && codePoint <= 0x1F12D) || + (0x1F130 <= codePoint && codePoint <= 0x1F169) || + (0x1F170 <= codePoint && codePoint <= 0x1F19A) || + (0xE0100 <= codePoint && codePoint <= 0xE01EF) || + (0xF0000 <= codePoint && codePoint <= 0xFFFFD) || + (0x100000 <= codePoint && codePoint <= 0x10FFFD)) { + return 'A'; + } + + return 'N'; +}; + +eaw.characterLength = function(character) { + var code = this.eastAsianWidth(character); + if (code == 'F' || code == 'W' || code == 'A') { + return 2; + } else { + return 1; + } +}; + +// Split a string considering surrogate-pairs. +function stringToArray(string) { + return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || []; +} + +eaw.length = function(string) { + var characters = stringToArray(string); + var len = 0; + for (var i = 0; i < characters.length; i++) { + len = len + this.characterLength(characters[i]); + } + return len; +}; + +eaw.slice = function(text, start, end) { + textLen = eaw.length(text) + start = start ? start : 0; + end = end ? end : 1; + if (start < 0) { + start = textLen + start; + } + if (end < 0) { + end = textLen + end; + } + var result = ''; + var eawLen = 0; + var chars = stringToArray(text); + for (var i = 0; i < chars.length; i++) { + var char = chars[i]; + var charLen = eaw.length(char); + if (eawLen >= start - (charLen == 2 ? 1 : 0)) { + if (eawLen + charLen <= end) { + result += char; + } else { + break; + } + } + eawLen += charLen; + } + return result; +}; diff --git a/node_modules/eastasianwidth/package.json b/node_modules/eastasianwidth/package.json new file mode 100644 index 00000000..cb7ac6ab --- /dev/null +++ b/node_modules/eastasianwidth/package.json @@ -0,0 +1,18 @@ +{ + "name": "eastasianwidth", + "version": "0.2.0", + "description": "Get East Asian Width from a character.", + "main": "eastasianwidth.js", + "files": [ + "eastasianwidth.js" + ], + "scripts": { + "test": "mocha" + }, + "repository": "git://github.com/komagata/eastasianwidth.git", + "author": "Masaki Komagata", + "license": "MIT", + "devDependencies": { + "mocha": "~1.9.0" + } +} diff --git a/node_modules/email-addresses/.travis.yml b/node_modules/email-addresses/.travis.yml new file mode 100644 index 00000000..40f80484 --- /dev/null +++ b/node_modules/email-addresses/.travis.yml @@ -0,0 +1,25 @@ +language: node_js + +env: + - CXX=g++-4.8 + +node_js: + - 12 + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 + +before_install: + - $CXX --version + - npm install node-gyp -g + +before_script: + +script: + - npm test + +sudo: false diff --git a/node_modules/email-addresses/Changes.md b/node_modules/email-addresses/Changes.md new file mode 100644 index 00000000..6b96d751 --- /dev/null +++ b/node_modules/email-addresses/Changes.md @@ -0,0 +1,77 @@ + +## 2021-08-17 - 5.0.0 + +Note: Again there is a major version bump because of changes to the typescript definitions. If you are not a typescript user, this is more like a minor version bump. + +- Added "addressListSeperator" option (#57) +- Typescript: improvements to the type definitions (#58, #59) + +## 2021-01-11 - 4.0.0 + +Note: Again there is a major version bump because of changes to the typescript definitions. Some of the typescript changes are really bug fixes, noting where null is a possible value. If you are not a typescript user, this is more like a minor version bump. + +- Added "commaInDisplayName" option (#54) +- Typescript: improvements to the type definitions (#44, #45, #47) + +## 2019-10-24 - 3.1.0 +- Added "atInDisplayName" option (#46) +- Added "comments" field to result mailbox (#46) + +## 2018-11-09 - 3.0.3 +- No changes + +## 2018-09-21 - 3.0.2 +- Fixed npe with rejectTLD option (#33) + +## 2017-06-21 - 3.0.0 + +Note: There is a major version bump because of two things: changes to the typescript definition and changes to the results returned for "group" addresses. + +- Full typescript definition (#30, a12b003) +- Fixed typescript "typings" field in package.json (#32) +- Proper results for groups (#31). Previously a "group" "address" would show its results as a single address, but it is now returned as a list. See the typescript definition for full return type. +- Support for parsing RFC6854 originator fields (#31). This adds new functions: parseFrom, parseSender, parseReplyTo. It also adds a new option "startAt". See source for possible values of "startAt". + +## 2016-04-30 - + +- minified version + +## 2015-12-28 - 2.0.2 + +- Improves type definition #18 +- Adds TypeScript definition file and declares in package.json #17 +- remove inaccurate comment on obs-FWS +- add bower.json + + +## 2014-11-02 - 2.0.1 + +- properly parse unquoted names with periods (version 2.0.1) + + +## 2014-10-14 - 2.0.0 + +- add rejectTLD option, off by default +- add proper unicode support (rfc 6532) +- improve 'semantic interpretation' of names + + +## 2014-09-08 - 1.1.2 + +- document the return values more +- for 'address', 'local', and 'domain' convenience methods return semantic content +- update readme to show results from current code +- fix invalid reference to address node introduced in 51836f1 +- support loading in the browser #4 + + +# 2014-01-10 - 1.1.1 + +- return name and other fields with whitespace collapsed properly (closes #2) +- readme: add "why use this" and "installation" +- readme: link to @dominicsayers #1 + + +## 2013-09-10 - 1.1.0 + +- Initial commit diff --git a/node_modules/email-addresses/LICENSE b/node_modules/email-addresses/LICENSE new file mode 100644 index 00000000..f3792087 --- /dev/null +++ b/node_modules/email-addresses/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013 Fog Creek Software + +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/email-addresses/README.md b/node_modules/email-addresses/README.md new file mode 100644 index 00000000..e8f89c7a --- /dev/null +++ b/node_modules/email-addresses/README.md @@ -0,0 +1,211 @@ +email-addresses.js +================== + +An RFC 5322 email address parser. + +v 5.0.0 + +What? +----- +Want to see if something could be an email address? Want to grab the display name or just the address out of a string? Put your regexes down and use this parser! + +This library does not validate email addresses - we can't really do that without sending an email. However, it attempts to parse addresses using the (fairly liberal) grammar specified in RFC 5322. You can use this to check if user input looks like an email address. + +Note carefully though - this parser supports all features of RFC 5322, which means that `"Bob Example" ` +is a valid email address. If you just want to validate the `bob@example.com` part, that is RFC 5321, for which you want +to use something like node-address-rfc2821. + +Why use this? +------------- +Use this library because you can be sure it really respects the RFC: + - The functions in the recursive decent parser match up with the productions in the RFC + - The productions from the RFC are written above each function for easy verification + - Tests include all of the test cases from the [is_email](https://github.com/dominicsayers/isemail) project, which are extensive + +Installation +------------ +npm install email-addresses + +Example +------- + +``` +$ node +> addrs = require("email-addresses") +{ [Function: parse5322] + parseOneAddress: [Function: parseOneAddressSimple], + parseAddressList: [Function: parseAddressListSimple] } +> addrs.parseOneAddress('"Jack Bowman" ') +{ parts: + { name: [Object], + address: [Object], + local: [Object], + domain: [Object] }, + name: 'Jack Bowman', + address: 'jack@fogcreek.com', + local: 'jack', + domain: 'fogcreek.com' } +> addrs.parseAddressList('jack@fogcreek.com, Bob ') +[ { parts: + { name: null, + address: [Object], + local: [Object], + domain: [Object] }, + name: null, + address: 'jack@fogcreek.com', + local: 'jack', + domain: 'fogcreek.com' }, + { parts: + { name: [Object], + address: [Object], + local: [Object], + domain: [Object] }, + name: 'Bob', + address: 'bob@example.com', + local: 'bob', + domain: 'example.com' } ] +> addrs("jack@fogcreek.com") +{ ast: + { name: 'address-list', + tokens: 'jack@fogcreek.com', + semantic: 'jack@fogcreek.com', + children: [ [Object] ] }, + addresses: + [ { node: [Object], + parts: [Object], + name: null, + address: 'jack@fogcreek.com', + local: 'jack', + domain: 'fogcreek.com' } ] } +> addrs("bogus") +null +``` + +API +--- + +`obj = addrs(opts)` +=================== + +Call the module directly as a function to get access to the AST. Returns null for a failed parse (an invalid +address). + +Options: + +* `string` - An email address to parse. Parses as `address-list`, a list of email addresses separated by commas. +* `object` with the following keys: + * `input` - An email address to parse. Required. + * `rfc6532` - Enable rfc6532 support (unicode in email addresses). Default: `false`. + * `partial` - Allow a failed parse to return the AST it managed to produce so far. Default: `false`. + * `simple` - Return just the address or addresses parsed. Default: `false`. + * `strict` - Turn off features of RFC 5322 marked "Obsolete". Default: `false`. + * `rejectTLD` - Require at least one `.` in domain names. Default: `false`. + * `startAt` - Start the parser at one of `address`, `address-list`, `angle-addr`, `from`, `group`, `mailbox`, `mailbox-list`, `reply-to`, `sender`. Default: `address-list`. + * `atInDisplayName` - Allow the `@` character in the display name of the email address. Default: `false`. + * `commaInDisplayName` - Allow the `,` character in the display name of the email address. Default: `false`. + * `addressListSeparator` - Specifies the character separating the list of email addresses. Default: `,`. + +Returns an object with the following properties: + +* `ast` - the full AST of the parse. +* `addresses` - array of addresses found. Each has the following properties: + * `parts` - components of the AST that make up the address. + * `type` - The type of the node, e.g. `mailbox`, `address`, `group`. + * `name` - The extracted name from the email. e.g. parsing `"Bob" ` will give `Bob` for the `name`. + * `address` - The full email address. e.g. parsing the above will give `bob@example.com` for the `address`. + * `local` - The local part. e.g. parsing the above will give `bob` for `local`. + * `domain` - The domain part. e.g. parsing the above will give `example.com` for `domain`. + +Note if `simple` is set, the return will be an array of addresses rather than the object above. + +Note that addresses can contain a `group` address, which in contrast to the `address` objects +will simply contain two properties: a `name` and `addresses` which is an array of the addresses in +the group. You can identify groups because they will have a `type` of `group`. A group looks +something like this: `Managing Partners:ben@example.com,carol@example.com;` + +`obj = addrs.parseOneAddress(opts)` +=================================== + +Parse a single email address. + +Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`. + +Returns a single address object as described above. If you set `simple: false` the returned object +includes a `node` object that contains the AST for the address. + +`obj = addrs.parseAddressList(opts)` +==================================== + +Parse a list of email addresses separated by comma. + +Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`. + +Returns a list of address objects as described above. If you set `simple: false` each address will +include a `node` object that contains the AST for the address. + +`obj = addrs.parseFrom(opts)` +============================= + +Parse an email header "From:" address (specified as mailbox-list or address-list). + +Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`. + +Returns a list of address objects as described above. If you set `simple: false` each address will +include a `node` object that contains the AST for the address. + +`obj = addrs.parseSender(opts)` +=============================== + +Parse an email header "Sender:" address (specified as mailbox or address). + +Operates similarly to `addrs(opts)`, with the exception that `rfc6532` and `simple` default to `true`. + +Returns a single address object as described above. If you set `simple: false` the returned object +includes a `node` object that contains the AST for the address. + +`obj = addrs.parseReplyTo(opts)` +================================ + +Parse an email header "Reply-To:" address (specified as address-list). + +Operates identically to `addrs.parseAddressList(opts)`. + +Usage +----- +If you want to simply check whether an address or address list parses, you'll want to call the following functions and check whether the results are null or not: ```parseOneAddress``` for a single address and ```parseAddressList``` for multiple addresses. + +If you want to examine the parsed address, for example to extract a name or address, you have some options. The object returned by ```parseOneAddress``` has four helper values on it: ```name```, ```address```, ```local```, and ```domain```. See the example above to understand is actually returned. (These are equivalent to ```parts.name.semantic```, ```parts.address.semantic```, etc.) These values try to be smart about collapsing whitespace, quotations, and excluding RFC 5322 comments. If you desire, you can also obtain the raw parsed tokens or semantic tokens for those fields. The ```parts``` value is an object referencing nodes in the AST generated. Nodes in the AST have two values of interest here, ```tokens``` and ```semantic```. + +``` +> a = addrs.parseOneAddress('Jack Bowman ') +> a.parts.name.tokens +'Jack Bowman ' +> a.name +'Jack Bowman' +> a.parts.name.semantic +'Jack Bowman ' +> a.parts.address.tokens +'jack@fogcreek.com ' +> a.address +'jack@fogcreek.com' +> a.parts.address.semantic +'jack@fogcreek.com' +``` + +If you need to, you can inspect the AST directly. The entire AST is returned when calling the module's function. + +References +---------- + - http://tools.ietf.org/html/rfc5322 + - https://tools.ietf.org/html/rfc6532 + - https://tools.ietf.org/html/rfc6854 + - http://code.google.com/p/isemail/ + +Props +----- +Many thanks to [Dominic Sayers](https://github.com/dominicsayers) and his documentation and tests +for the [is_email](https://github.com/dominicsayers/isemail) function which helped greatly in writing this parser. + +License +------- +Licensed under the MIT License. See the LICENSE file. diff --git a/node_modules/email-addresses/bower.json b/node_modules/email-addresses/bower.json new file mode 100644 index 00000000..9eaad2e9 --- /dev/null +++ b/node_modules/email-addresses/bower.json @@ -0,0 +1,29 @@ +{ + "name": "email-addresses", + "version": "5.0.0", + "homepage": "https://github.com/jackbearheart/email-addresses", + "authors": [ + "Jack Bearheart " + ], + "description": "An email address parser based on rfc5322", + "main": "./lib/email-addresses.js", + "moduleType": [ + "globals", + "node" + ], + "keywords": [ + "email", + "address", + "parser", + "rfc5322", + "5322" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/node_modules/email-addresses/lib/email-addresses.d.ts b/node_modules/email-addresses/lib/email-addresses.d.ts new file mode 100644 index 00000000..902beade --- /dev/null +++ b/node_modules/email-addresses/lib/email-addresses.d.ts @@ -0,0 +1,121 @@ +declare module emailAddresses { + function parseOneAddress(input: string | Options): ParsedMailbox | ParsedGroup | null; + function parseAddressList(input: string | Options): (ParsedMailbox | ParsedGroup)[] | null; + function parseFrom(input: string | Options): (ParsedMailbox | ParsedGroup)[] | null; + function parseSender(input: string | Options): ParsedMailbox | ParsedGroup | null; + function parseReplyTo(input: string | Options): (ParsedMailbox | ParsedGroup)[] | null; + + interface ParsedMailbox { + node?: ASTNode; + parts: { + name: ASTNode | null; + address: ASTNode; + local: ASTNode; + domain: ASTNode; + comments: ASTNode[]; + }; + type: "mailbox"; + name: string | null; + address: string; + local: string; + domain: string; + } + + interface ParsedGroup { + node?: ASTNode; + parts: { + name: ASTNode; + }; + type: "group"; + name: string; + addresses: ParsedMailbox[]; + } + + interface ASTNode { + name: string; + tokens: string; + semantic: string; + children: ASTNode[]; + } + + type StartProductions = + "address" + | "address-list" + | "angle-addr" + | "from" + | "group" + | "mailbox" + | "mailbox-list" + | "reply-to" + | "sender"; + + interface Options { + input: string; + oneResult?: boolean; + partial?: boolean; + rejectTLD?: boolean; + rfc6532?: boolean; + simple?: boolean; + startAt?: StartProductions; + strict?: boolean; + atInDisplayName?: boolean; + commaInDisplayName?: boolean; + addressListSeparator?: string; + } + + interface ParsedResult { + ast: ASTNode; + addresses: (ParsedMailbox | ParsedGroup)[]; + } +} + +declare function emailAddresses(opts: emailAddresses.Options): emailAddresses.ParsedResult | null; + +declare module "email-addresses" { + export = emailAddresses; +} + +/* Example usage: + +// Run this file with: +// tsc test.ts && NODE_PATH="../emailaddresses/lib" node test.js +/// +import emailAddresses = require('email-addresses'); + +function isParsedMailbox(mailboxOrGroup: emailAddresses.ParsedMailbox | emailAddresses.ParsedGroup): mailboxOrGroup is emailAddresses.ParsedMailbox { + return mailboxOrGroup.type === 'mailbox'; +} + +var testEmail : string = "TestName (a comment) "; +console.log(testEmail); + +var parsed = emailAddresses.parseOneAddress(testEmail); +console.log(parsed); + +var a : string = parsed.parts.name.children[0].name; +console.log(a); + +if (isParsedMailbox(parsed)) { + var comment : string = parsed.parts.comments[0].tokens; + console.log(comment); +} else { + console.error('error, should be a ParsedMailbox'); +} + +// + +var emailList : string = "TestName , TestName2 "; +console.log(emailList); + +var parsedList = emailAddresses.parseAddressList(emailList); +console.log(parsedList); + +var b : string = parsedList[1].parts.name.children[0].semantic; +console.log(b); + +// + +var parsedByModuleFxn = emailAddresses({ input: emailList, rfc6532: true }); +console.log(parsedByModuleFxn.addresses[0].name); + +*/ diff --git a/node_modules/email-addresses/lib/email-addresses.js b/node_modules/email-addresses/lib/email-addresses.js new file mode 100644 index 00000000..b0602d3d --- /dev/null +++ b/node_modules/email-addresses/lib/email-addresses.js @@ -0,0 +1,1098 @@ + +// email-addresses.js - RFC 5322 email address parser +// v 5.0.0 +// +// http://tools.ietf.org/html/rfc5322 +// +// This library does not validate email addresses. +// emailAddresses attempts to parse addresses using the (fairly liberal) +// grammar specified in RFC 5322. +// +// email-addresses returns { +// ast: , +// addresses: [{ +// node: , +// name: , +// address: , +// local: , +// domain: +// }, ...] +// } +// +// emailAddresses.parseOneAddress and emailAddresses.parseAddressList +// work as you might expect. Try it out. +// +// Many thanks to Dominic Sayers and his documentation on the is_email function, +// http://code.google.com/p/isemail/ , which helped greatly in writing this parser. + +(function (global) { +"use strict"; + +function parse5322(opts) { + + // tokenizing functions + + function inStr() { return pos < len; } + function curTok() { return parseString[pos]; } + function getPos() { return pos; } + function setPos(i) { pos = i; } + function nextTok() { pos += 1; } + function initialize() { + pos = 0; + len = parseString.length; + } + + // parser helper functions + + function o(name, value) { + return { + name: name, + tokens: value || "", + semantic: value || "", + children: [] + }; + } + + function wrap(name, ast) { + var n; + if (ast === null) { return null; } + n = o(name); + n.tokens = ast.tokens; + n.semantic = ast.semantic; + n.children.push(ast); + return n; + } + + function add(parent, child) { + if (child !== null) { + parent.tokens += child.tokens; + parent.semantic += child.semantic; + } + parent.children.push(child); + return parent; + } + + function compareToken(fxnCompare) { + var tok; + if (!inStr()) { return null; } + tok = curTok(); + if (fxnCompare(tok)) { + nextTok(); + return o('token', tok); + } + return null; + } + + function noop() { + return null; + } + + function literal(lit) { + return function literalFunc() { + return wrap('literal', compareToken(function (tok) { + return tok === lit; + })); + }; + } + + function and() { + var args = arguments; + return function andFunc() { + var i, s, result, start; + start = getPos(); + s = o('and'); + for (i = 0; i < args.length; i += 1) { + result = args[i](); + if (result === null) { + setPos(start); + return null; + } + add(s, result); + } + return s; + }; + } + + function or() { + var args = arguments; + return function orFunc() { + var i, result, start; + start = getPos(); + for (i = 0; i < args.length; i += 1) { + result = args[i](); + if (result !== null) { + return result; + } + setPos(start); + } + return null; + }; + } + + function opt(prod) { + return function optFunc() { + var result, start; + start = getPos(); + result = prod(); + if (result !== null) { + return result; + } + else { + setPos(start); + return o('opt'); + } + }; + } + + function invis(prod) { + return function invisFunc() { + var result = prod(); + if (result !== null) { + result.semantic = ""; + } + return result; + }; + } + + function colwsp(prod) { + return function collapseSemanticWhitespace() { + var result = prod(); + if (result !== null && result.semantic.length > 0) { + result.semantic = " "; + } + return result; + }; + } + + function star(prod, minimum) { + return function starFunc() { + var s, result, count, start, min; + start = getPos(); + s = o('star'); + count = 0; + min = minimum === undefined ? 0 : minimum; + while ((result = prod()) !== null) { + count = count + 1; + add(s, result); + } + if (count >= min) { + return s; + } + else { + setPos(start); + return null; + } + }; + } + + // One expects names to get normalized like this: + // " First Last " -> "First Last" + // "First Last" -> "First Last" + // "First Last" -> "First Last" + function collapseWhitespace(s) { + return s.replace(/([ \t]|\r\n)+/g, ' ').replace(/^\s*/, '').replace(/\s*$/, ''); + } + + // UTF-8 pseudo-production (RFC 6532) + // RFC 6532 extends RFC 5322 productions to include UTF-8 + // using the following productions: + // UTF8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4 + // UTF8-2 = + // UTF8-3 = + // UTF8-4 = + // + // For reference, the extended RFC 5322 productions are: + // VCHAR =/ UTF8-non-ascii + // ctext =/ UTF8-non-ascii + // atext =/ UTF8-non-ascii + // qtext =/ UTF8-non-ascii + // dtext =/ UTF8-non-ascii + function isUTF8NonAscii(tok) { + // In JavaScript, we just deal directly with Unicode code points, + // so we aren't checking individual bytes for UTF-8 encoding. + // Just check that the character is non-ascii. + return tok.charCodeAt(0) >= 128; + } + + + // common productions (RFC 5234) + // http://tools.ietf.org/html/rfc5234 + // B.1. Core Rules + + // CR = %x0D + // ; carriage return + function cr() { return wrap('cr', literal('\r')()); } + + // CRLF = CR LF + // ; Internet standard newline + function crlf() { return wrap('crlf', and(cr, lf)()); } + + // DQUOTE = %x22 + // ; " (Double Quote) + function dquote() { return wrap('dquote', literal('"')()); } + + // HTAB = %x09 + // ; horizontal tab + function htab() { return wrap('htab', literal('\t')()); } + + // LF = %x0A + // ; linefeed + function lf() { return wrap('lf', literal('\n')()); } + + // SP = %x20 + function sp() { return wrap('sp', literal(' ')()); } + + // VCHAR = %x21-7E + // ; visible (printing) characters + function vchar() { + return wrap('vchar', compareToken(function vcharFunc(tok) { + var code = tok.charCodeAt(0); + var accept = (0x21 <= code && code <= 0x7E); + if (opts.rfc6532) { + accept = accept || isUTF8NonAscii(tok); + } + return accept; + })); + } + + // WSP = SP / HTAB + // ; white space + function wsp() { return wrap('wsp', or(sp, htab)()); } + + + // email productions (RFC 5322) + // http://tools.ietf.org/html/rfc5322 + // 3.2.1. Quoted characters + + // quoted-pair = ("\" (VCHAR / WSP)) / obs-qp + function quotedPair() { + var qp = wrap('quoted-pair', + or( + and(literal('\\'), or(vchar, wsp)), + obsQP + )()); + if (qp === null) { return null; } + // a quoted pair will be two characters, and the "\" character + // should be semantically "invisible" (RFC 5322 3.2.1) + qp.semantic = qp.semantic[1]; + return qp; + } + + // 3.2.2. Folding White Space and Comments + + // FWS = ([*WSP CRLF] 1*WSP) / obs-FWS + function fws() { + return wrap('fws', or( + obsFws, + and( + opt(and( + star(wsp), + invis(crlf) + )), + star(wsp, 1) + ) + )()); + } + + // ctext = %d33-39 / ; Printable US-ASCII + // %d42-91 / ; characters not including + // %d93-126 / ; "(", ")", or "\" + // obs-ctext + function ctext() { + return wrap('ctext', or( + function ctextFunc1() { + return compareToken(function ctextFunc2(tok) { + var code = tok.charCodeAt(0); + var accept = + (33 <= code && code <= 39) || + (42 <= code && code <= 91) || + (93 <= code && code <= 126); + if (opts.rfc6532) { + accept = accept || isUTF8NonAscii(tok); + } + return accept; + }); + }, + obsCtext + )()); + } + + // ccontent = ctext / quoted-pair / comment + function ccontent() { + return wrap('ccontent', or(ctext, quotedPair, comment)()); + } + + // comment = "(" *([FWS] ccontent) [FWS] ")" + function comment() { + return wrap('comment', and( + literal('('), + star(and(opt(fws), ccontent)), + opt(fws), + literal(')') + )()); + } + + // CFWS = (1*([FWS] comment) [FWS]) / FWS + function cfws() { + return wrap('cfws', or( + and( + star( + and(opt(fws), comment), + 1 + ), + opt(fws) + ), + fws + )()); + } + + // 3.2.3. Atom + + //atext = ALPHA / DIGIT / ; Printable US-ASCII + // "!" / "#" / ; characters not including + // "$" / "%" / ; specials. Used for atoms. + // "&" / "'" / + // "*" / "+" / + // "-" / "/" / + // "=" / "?" / + // "^" / "_" / + // "`" / "{" / + // "|" / "}" / + // "~" + function atext() { + return wrap('atext', compareToken(function atextFunc(tok) { + var accept = + ('a' <= tok && tok <= 'z') || + ('A' <= tok && tok <= 'Z') || + ('0' <= tok && tok <= '9') || + (['!', '#', '$', '%', '&', '\'', '*', '+', '-', '/', + '=', '?', '^', '_', '`', '{', '|', '}', '~'].indexOf(tok) >= 0); + if (opts.rfc6532) { + accept = accept || isUTF8NonAscii(tok); + } + return accept; + })); + } + + // atom = [CFWS] 1*atext [CFWS] + function atom() { + return wrap('atom', and(colwsp(opt(cfws)), star(atext, 1), colwsp(opt(cfws)))()); + } + + // dot-atom-text = 1*atext *("." 1*atext) + function dotAtomText() { + var s, maybeText; + s = wrap('dot-atom-text', star(atext, 1)()); + if (s === null) { return s; } + maybeText = star(and(literal('.'), star(atext, 1)))(); + if (maybeText !== null) { + add(s, maybeText); + } + return s; + } + + // dot-atom = [CFWS] dot-atom-text [CFWS] + function dotAtom() { + return wrap('dot-atom', and(invis(opt(cfws)), dotAtomText, invis(opt(cfws)))()); + } + + // 3.2.4. Quoted Strings + + // qtext = %d33 / ; Printable US-ASCII + // %d35-91 / ; characters not including + // %d93-126 / ; "\" or the quote character + // obs-qtext + function qtext() { + return wrap('qtext', or( + function qtextFunc1() { + return compareToken(function qtextFunc2(tok) { + var code = tok.charCodeAt(0); + var accept = + (33 === code) || + (35 <= code && code <= 91) || + (93 <= code && code <= 126); + if (opts.rfc6532) { + accept = accept || isUTF8NonAscii(tok); + } + return accept; + }); + }, + obsQtext + )()); + } + + // qcontent = qtext / quoted-pair + function qcontent() { + return wrap('qcontent', or(qtext, quotedPair)()); + } + + // quoted-string = [CFWS] + // DQUOTE *([FWS] qcontent) [FWS] DQUOTE + // [CFWS] + function quotedString() { + return wrap('quoted-string', and( + invis(opt(cfws)), + invis(dquote), star(and(opt(colwsp(fws)), qcontent)), opt(invis(fws)), invis(dquote), + invis(opt(cfws)) + )()); + } + + // 3.2.5 Miscellaneous Tokens + + // word = atom / quoted-string + function word() { + return wrap('word', or(atom, quotedString)()); + } + + // phrase = 1*word / obs-phrase + function phrase() { + return wrap('phrase', or(obsPhrase, star(word, 1))()); + } + + // 3.4. Address Specification + // address = mailbox / group + function address() { + return wrap('address', or(mailbox, group)()); + } + + // mailbox = name-addr / addr-spec + function mailbox() { + return wrap('mailbox', or(nameAddr, addrSpec)()); + } + + // name-addr = [display-name] angle-addr + function nameAddr() { + return wrap('name-addr', and(opt(displayName), angleAddr)()); + } + + // angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / + // obs-angle-addr + function angleAddr() { + return wrap('angle-addr', or( + and( + invis(opt(cfws)), + literal('<'), + addrSpec, + literal('>'), + invis(opt(cfws)) + ), + obsAngleAddr + )()); + } + + // group = display-name ":" [group-list] ";" [CFWS] + function group() { + return wrap('group', and( + displayName, + literal(':'), + opt(groupList), + literal(';'), + invis(opt(cfws)) + )()); + } + + // display-name = phrase + function displayName() { + return wrap('display-name', function phraseFixedSemantic() { + var result = phrase(); + if (result !== null) { + result.semantic = collapseWhitespace(result.semantic); + } + return result; + }()); + } + + // mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list + function mailboxList() { + return wrap('mailbox-list', or( + and( + mailbox, + star(and(literal(','), mailbox)) + ), + obsMboxList + )()); + } + + // address-list = (address *("," address)) / obs-addr-list + function addressList() { + return wrap('address-list', or( + and( + address, + star(and(literal(opts.addressListSeparator), address)) + ), + obsAddrList + )()); + } + + // group-list = mailbox-list / CFWS / obs-group-list + function groupList() { + return wrap('group-list', or( + mailboxList, + invis(cfws), + obsGroupList + )()); + } + + // 3.4.1 Addr-Spec Specification + + // local-part = dot-atom / quoted-string / obs-local-part + function localPart() { + // note: quoted-string, dotAtom are proper subsets of obs-local-part + // so we really just have to look for obsLocalPart, if we don't care about the exact parse tree + return wrap('local-part', or(obsLocalPart, dotAtom, quotedString)()); + } + + // dtext = %d33-90 / ; Printable US-ASCII + // %d94-126 / ; characters not including + // obs-dtext ; "[", "]", or "\" + function dtext() { + return wrap('dtext', or( + function dtextFunc1() { + return compareToken(function dtextFunc2(tok) { + var code = tok.charCodeAt(0); + var accept = + (33 <= code && code <= 90) || + (94 <= code && code <= 126); + if (opts.rfc6532) { + accept = accept || isUTF8NonAscii(tok); + } + return accept; + }); + }, + obsDtext + )() + ); + } + + // domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS] + function domainLiteral() { + return wrap('domain-literal', and( + invis(opt(cfws)), + literal('['), + star(and(opt(fws), dtext)), + opt(fws), + literal(']'), + invis(opt(cfws)) + )()); + } + + // domain = dot-atom / domain-literal / obs-domain + function domain() { + return wrap('domain', function domainCheckTLD() { + var result = or(obsDomain, dotAtom, domainLiteral)(); + if (opts.rejectTLD) { + if (result && result.semantic && result.semantic.indexOf('.') < 0) { + return null; + } + } + // strip all whitespace from domains + if (result) { + result.semantic = result.semantic.replace(/\s+/g, ''); + } + return result; + }()); + } + + // addr-spec = local-part "@" domain + function addrSpec() { + return wrap('addr-spec', and( + localPart, literal('@'), domain + )()); + } + + // 3.6.2 Originator Fields + // Below we only parse the field body, not the name of the field + // like "From:", "Sender:", or "Reply-To:". Other libraries that + // parse email headers can parse those and defer to these productions + // for the "RFC 5322" part. + + // RFC 6854 2.1. Replacement of RFC 5322, Section 3.6.2. Originator Fields + // from = "From:" (mailbox-list / address-list) CRLF + function fromSpec() { + return wrap('from', or( + mailboxList, + addressList + )()); + } + + // RFC 6854 2.1. Replacement of RFC 5322, Section 3.6.2. Originator Fields + // sender = "Sender:" (mailbox / address) CRLF + function senderSpec() { + return wrap('sender', or( + mailbox, + address + )()); + } + + // RFC 6854 2.1. Replacement of RFC 5322, Section 3.6.2. Originator Fields + // reply-to = "Reply-To:" address-list CRLF + function replyToSpec() { + return wrap('reply-to', addressList()); + } + + // 4.1. Miscellaneous Obsolete Tokens + + // obs-NO-WS-CTL = %d1-8 / ; US-ASCII control + // %d11 / ; characters that do not + // %d12 / ; include the carriage + // %d14-31 / ; return, line feed, and + // %d127 ; white space characters + function obsNoWsCtl() { + return opts.strict ? null : wrap('obs-NO-WS-CTL', compareToken(function (tok) { + var code = tok.charCodeAt(0); + return ((1 <= code && code <= 8) || + (11 === code || 12 === code) || + (14 <= code && code <= 31) || + (127 === code)); + })); + } + + // obs-ctext = obs-NO-WS-CTL + function obsCtext() { return opts.strict ? null : wrap('obs-ctext', obsNoWsCtl()); } + + // obs-qtext = obs-NO-WS-CTL + function obsQtext() { return opts.strict ? null : wrap('obs-qtext', obsNoWsCtl()); } + + // obs-qp = "\" (%d0 / obs-NO-WS-CTL / LF / CR) + function obsQP() { + return opts.strict ? null : wrap('obs-qp', and( + literal('\\'), + or(literal('\0'), obsNoWsCtl, lf, cr) + )()); + } + + // obs-phrase = word *(word / "." / CFWS) + function obsPhrase() { + return opts.strict + ? null + : wrap('obs-phrase', and( + word, + star(or( + word, + literal('.'), + opts.atInDisplayName ? literal('@') : noop, + opts.commaInDisplayName ? literal(',') : noop, + colwsp(cfws))) + )()); + } + + // 4.2. Obsolete Folding White Space + + // NOTE: read the errata http://www.rfc-editor.org/errata_search.php?rfc=5322&eid=1908 + // obs-FWS = 1*([CRLF] WSP) + function obsFws() { + return opts.strict ? null : wrap('obs-FWS', star( + and(invis(opt(crlf)), wsp), + 1 + )()); + } + + // 4.4. Obsolete Addressing + + // obs-angle-addr = [CFWS] "<" obs-route addr-spec ">" [CFWS] + function obsAngleAddr() { + return opts.strict ? null : wrap('obs-angle-addr', and( + invis(opt(cfws)), + literal('<'), + obsRoute, + addrSpec, + literal('>'), + invis(opt(cfws)) + )()); + } + + // obs-route = obs-domain-list ":" + function obsRoute() { + return opts.strict ? null : wrap('obs-route', and( + obsDomainList, + literal(':') + )()); + } + + // obs-domain-list = *(CFWS / ",") "@" domain + // *("," [CFWS] ["@" domain]) + function obsDomainList() { + return opts.strict ? null : wrap('obs-domain-list', and( + star(or(invis(cfws), literal(','))), + literal('@'), + domain, + star(and( + literal(','), + invis(opt(cfws)), + opt(and(literal('@'), domain)) + )) + )()); + } + + // obs-mbox-list = *([CFWS] ",") mailbox *("," [mailbox / CFWS]) + function obsMboxList() { + return opts.strict ? null : wrap('obs-mbox-list', and( + star(and( + invis(opt(cfws)), + literal(',') + )), + mailbox, + star(and( + literal(','), + opt(and( + mailbox, + invis(cfws) + )) + )) + )()); + } + + // obs-addr-list = *([CFWS] ",") address *("," [address / CFWS]) + function obsAddrList() { + return opts.strict ? null : wrap('obs-addr-list', and( + star(and( + invis(opt(cfws)), + literal(',') + )), + address, + star(and( + literal(','), + opt(and( + address, + invis(cfws) + )) + )) + )()); + } + + // obs-group-list = 1*([CFWS] ",") [CFWS] + function obsGroupList() { + return opts.strict ? null : wrap('obs-group-list', and( + star(and( + invis(opt(cfws)), + literal(',') + ), 1), + invis(opt(cfws)) + )()); + } + + // obs-local-part = word *("." word) + function obsLocalPart() { + return opts.strict ? null : wrap('obs-local-part', and(word, star(and(literal('.'), word)))()); + } + + // obs-domain = atom *("." atom) + function obsDomain() { + return opts.strict ? null : wrap('obs-domain', and(atom, star(and(literal('.'), atom)))()); + } + + // obs-dtext = obs-NO-WS-CTL / quoted-pair + function obsDtext() { + return opts.strict ? null : wrap('obs-dtext', or(obsNoWsCtl, quotedPair)()); + } + + ///////////////////////////////////////////////////// + + // ast analysis + + function findNode(name, root) { + var i, stack, node; + if (root === null || root === undefined) { return null; } + stack = [root]; + while (stack.length > 0) { + node = stack.pop(); + if (node.name === name) { + return node; + } + for (i = node.children.length - 1; i >= 0; i -= 1) { + stack.push(node.children[i]); + } + } + return null; + } + + function findAllNodes(name, root) { + var i, stack, node, result; + if (root === null || root === undefined) { return null; } + stack = [root]; + result = []; + while (stack.length > 0) { + node = stack.pop(); + if (node.name === name) { + result.push(node); + } + for (i = node.children.length - 1; i >= 0; i -= 1) { + stack.push(node.children[i]); + } + } + return result; + } + + function findAllNodesNoChildren(names, root) { + var i, stack, node, result, namesLookup; + if (root === null || root === undefined) { return null; } + stack = [root]; + result = []; + namesLookup = {}; + for (i = 0; i < names.length; i += 1) { + namesLookup[names[i]] = true; + } + + while (stack.length > 0) { + node = stack.pop(); + if (node.name in namesLookup) { + result.push(node); + // don't look at children (hence findAllNodesNoChildren) + } else { + for (i = node.children.length - 1; i >= 0; i -= 1) { + stack.push(node.children[i]); + } + } + } + return result; + } + + function giveResult(ast) { + var addresses, groupsAndMailboxes, i, groupOrMailbox, result; + if (ast === null) { + return null; + } + addresses = []; + + // An address is a 'group' (i.e. a list of mailboxes) or a 'mailbox'. + groupsAndMailboxes = findAllNodesNoChildren(['group', 'mailbox'], ast); + for (i = 0; i < groupsAndMailboxes.length; i += 1) { + groupOrMailbox = groupsAndMailboxes[i]; + if (groupOrMailbox.name === 'group') { + addresses.push(giveResultGroup(groupOrMailbox)); + } else if (groupOrMailbox.name === 'mailbox') { + addresses.push(giveResultMailbox(groupOrMailbox)); + } + } + + result = { + ast: ast, + addresses: addresses, + }; + if (opts.simple) { + result = simplifyResult(result); + } + if (opts.oneResult) { + return oneResult(result); + } + if (opts.simple) { + return result && result.addresses; + } else { + return result; + } + } + + function giveResultGroup(group) { + var i; + var groupName = findNode('display-name', group); + var groupResultMailboxes = []; + var mailboxes = findAllNodesNoChildren(['mailbox'], group); + for (i = 0; i < mailboxes.length; i += 1) { + groupResultMailboxes.push(giveResultMailbox(mailboxes[i])); + } + return { + node: group, + parts: { + name: groupName, + }, + type: group.name, // 'group' + name: grabSemantic(groupName), + addresses: groupResultMailboxes, + }; + } + + function giveResultMailbox(mailbox) { + var name = findNode('display-name', mailbox); + var aspec = findNode('addr-spec', mailbox); + var cfws = findAllNodes('cfws', mailbox); + var comments = findAllNodesNoChildren(['comment'], mailbox); + + + var local = findNode('local-part', aspec); + var domain = findNode('domain', aspec); + return { + node: mailbox, + parts: { + name: name, + address: aspec, + local: local, + domain: domain, + comments: cfws + }, + type: mailbox.name, // 'mailbox' + name: grabSemantic(name), + address: grabSemantic(aspec), + local: grabSemantic(local), + domain: grabSemantic(domain), + comments: concatComments(comments), + groupName: grabSemantic(mailbox.groupName), + }; + } + + function grabSemantic(n) { + return n !== null && n !== undefined ? n.semantic : null; + } + + function simplifyResult(result) { + var i; + if (result && result.addresses) { + for (i = 0; i < result.addresses.length; i += 1) { + delete result.addresses[i].node; + } + } + return result; + } + + function concatComments(comments) { + var result = ''; + if (comments) { + for (var i = 0; i < comments.length; i += 1) { + result += grabSemantic(comments[i]); + } + } + return result; + } + + function oneResult(result) { + if (!result) { return null; } + if (!opts.partial && result.addresses.length > 1) { return null; } + return result.addresses && result.addresses[0]; + } + + ///////////////////////////////////////////////////// + + var parseString, pos, len, parsed, startProduction; + + opts = handleOpts(opts, {}); + if (opts === null) { return null; } + + parseString = opts.input; + + startProduction = { + 'address': address, + 'address-list': addressList, + 'angle-addr': angleAddr, + 'from': fromSpec, + 'group': group, + 'mailbox': mailbox, + 'mailbox-list': mailboxList, + 'reply-to': replyToSpec, + 'sender': senderSpec, + }[opts.startAt] || addressList; + + if (!opts.strict) { + initialize(); + opts.strict = true; + parsed = startProduction(parseString); + if (opts.partial || !inStr()) { + return giveResult(parsed); + } + opts.strict = false; + } + + initialize(); + parsed = startProduction(parseString); + if (!opts.partial && inStr()) { return null; } + return giveResult(parsed); +} + +function parseOneAddressSimple(opts) { + return parse5322(handleOpts(opts, { + oneResult: true, + rfc6532: true, + simple: true, + startAt: 'address-list', + })); +} + +function parseAddressListSimple(opts) { + return parse5322(handleOpts(opts, { + rfc6532: true, + simple: true, + startAt: 'address-list', + })); +} + +function parseFromSimple(opts) { + return parse5322(handleOpts(opts, { + rfc6532: true, + simple: true, + startAt: 'from', + })); +} + +function parseSenderSimple(opts) { + return parse5322(handleOpts(opts, { + oneResult: true, + rfc6532: true, + simple: true, + startAt: 'sender', + })); +} + +function parseReplyToSimple(opts) { + return parse5322(handleOpts(opts, { + rfc6532: true, + simple: true, + startAt: 'reply-to', + })); +} + +function handleOpts(opts, defs) { + function isString(str) { + return Object.prototype.toString.call(str) === '[object String]'; + } + + function isObject(o) { + return o === Object(o); + } + + function isNullUndef(o) { + return o === null || o === undefined; + } + + var defaults, o; + + if (isString(opts)) { + opts = { input: opts }; + } else if (!isObject(opts)) { + return null; + } + + if (!isString(opts.input)) { return null; } + if (!defs) { return null; } + + defaults = { + oneResult: false, + partial: false, + rejectTLD: false, + rfc6532: false, + simple: false, + startAt: 'address-list', + strict: false, + atInDisplayName: false, + commaInDisplayName: false, + addressListSeparator: ',', + }; + + for (o in defaults) { + if (isNullUndef(opts[o])) { + opts[o] = !isNullUndef(defs[o]) ? defs[o] : defaults[o]; + } + } + return opts; +} + +parse5322.parseOneAddress = parseOneAddressSimple; +parse5322.parseAddressList = parseAddressListSimple; +parse5322.parseFrom = parseFromSimple; +parse5322.parseSender = parseSenderSimple; +parse5322.parseReplyTo = parseReplyToSimple; + +if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { + module.exports = parse5322; +} else { + global.emailAddresses = parse5322; +} + +}(this)); diff --git a/node_modules/email-addresses/lib/email-addresses.min.js b/node_modules/email-addresses/lib/email-addresses.min.js new file mode 100644 index 00000000..7d534fcf --- /dev/null +++ b/node_modules/email-addresses/lib/email-addresses.min.js @@ -0,0 +1 @@ +(function(global){"use strict";function parse5322(opts){function inStr(){return pos0){result.semantic=" "}return result}}function star(prod,minimum){return function starFunc(){var s,result,count,start,min;start=getPos();s=o("star");count=0;min=minimum===undefined?0:minimum;while((result=prod())!==null){count=count+1;add(s,result)}if(count>=min){return s}else{setPos(start);return null}}}function collapseWhitespace(s){return s.replace(/([ \t]|\r\n)+/g," ").replace(/^\s*/,"").replace(/\s*$/,"")}function isUTF8NonAscii(tok){return tok.charCodeAt(0)>=128}function cr(){return wrap("cr",literal("\r")())}function crlf(){return wrap("crlf",and(cr,lf)())}function dquote(){return wrap("dquote",literal('"')())}function htab(){return wrap("htab",literal("\t")())}function lf(){return wrap("lf",literal("\n")())}function sp(){return wrap("sp",literal(" ")())}function vchar(){return wrap("vchar",compareToken(function vcharFunc(tok){var code=tok.charCodeAt(0);var accept=33<=code&&code<=126;if(opts.rfc6532){accept=accept||isUTF8NonAscii(tok)}return accept}))}function wsp(){return wrap("wsp",or(sp,htab)())}function quotedPair(){var qp=wrap("quoted-pair",or(and(literal("\\"),or(vchar,wsp)),obsQP)());if(qp===null){return null}qp.semantic=qp.semantic[1];return qp}function fws(){return wrap("fws",or(obsFws,and(opt(and(star(wsp),invis(crlf))),star(wsp,1)))())}function ctext(){return wrap("ctext",or(function ctextFunc1(){return compareToken(function ctextFunc2(tok){var code=tok.charCodeAt(0);var accept=33<=code&&code<=39||42<=code&&code<=91||93<=code&&code<=126;if(opts.rfc6532){accept=accept||isUTF8NonAscii(tok)}return accept})},obsCtext)())}function ccontent(){return wrap("ccontent",or(ctext,quotedPair,comment)())}function comment(){return wrap("comment",and(literal("("),star(and(opt(fws),ccontent)),opt(fws),literal(")"))())}function cfws(){return wrap("cfws",or(and(star(and(opt(fws),comment),1),opt(fws)),fws)())}function atext(){return wrap("atext",compareToken(function atextFunc(tok){var accept="a"<=tok&&tok<="z"||"A"<=tok&&tok<="Z"||"0"<=tok&&tok<="9"||["!","#","$","%","&","'","*","+","-","/","=","?","^","_","`","{","|","}","~"].indexOf(tok)>=0;if(opts.rfc6532){accept=accept||isUTF8NonAscii(tok)}return accept}))}function atom(){return wrap("atom",and(colwsp(opt(cfws)),star(atext,1),colwsp(opt(cfws)))())}function dotAtomText(){var s,maybeText;s=wrap("dot-atom-text",star(atext,1)());if(s===null){return s}maybeText=star(and(literal("."),star(atext,1)))();if(maybeText!==null){add(s,maybeText)}return s}function dotAtom(){return wrap("dot-atom",and(invis(opt(cfws)),dotAtomText,invis(opt(cfws)))())}function qtext(){return wrap("qtext",or(function qtextFunc1(){return compareToken(function qtextFunc2(tok){var code=tok.charCodeAt(0);var accept=33===code||35<=code&&code<=91||93<=code&&code<=126;if(opts.rfc6532){accept=accept||isUTF8NonAscii(tok)}return accept})},obsQtext)())}function qcontent(){return wrap("qcontent",or(qtext,quotedPair)())}function quotedString(){return wrap("quoted-string",and(invis(opt(cfws)),invis(dquote),star(and(opt(colwsp(fws)),qcontent)),opt(invis(fws)),invis(dquote),invis(opt(cfws)))())}function word(){return wrap("word",or(atom,quotedString)())}function phrase(){return wrap("phrase",or(obsPhrase,star(word,1))())}function address(){return wrap("address",or(mailbox,group)())}function mailbox(){return wrap("mailbox",or(nameAddr,addrSpec)())}function nameAddr(){return wrap("name-addr",and(opt(displayName),angleAddr)())}function angleAddr(){return wrap("angle-addr",or(and(invis(opt(cfws)),literal("<"),addrSpec,literal(">"),invis(opt(cfws))),obsAngleAddr)())}function group(){return wrap("group",and(displayName,literal(":"),opt(groupList),literal(";"),invis(opt(cfws)))())}function displayName(){return wrap("display-name",function phraseFixedSemantic(){var result=phrase();if(result!==null){result.semantic=collapseWhitespace(result.semantic)}return result}())}function mailboxList(){return wrap("mailbox-list",or(and(mailbox,star(and(literal(","),mailbox))),obsMboxList)())}function addressList(){return wrap("address-list",or(and(address,star(and(literal(opts.addressListSeparator),address))),obsAddrList)())}function groupList(){return wrap("group-list",or(mailboxList,invis(cfws),obsGroupList)())}function localPart(){return wrap("local-part",or(obsLocalPart,dotAtom,quotedString)())}function dtext(){return wrap("dtext",or(function dtextFunc1(){return compareToken(function dtextFunc2(tok){var code=tok.charCodeAt(0);var accept=33<=code&&code<=90||94<=code&&code<=126;if(opts.rfc6532){accept=accept||isUTF8NonAscii(tok)}return accept})},obsDtext)())}function domainLiteral(){return wrap("domain-literal",and(invis(opt(cfws)),literal("["),star(and(opt(fws),dtext)),opt(fws),literal("]"),invis(opt(cfws)))())}function domain(){return wrap("domain",function domainCheckTLD(){var result=or(obsDomain,dotAtom,domainLiteral)();if(opts.rejectTLD){if(result&&result.semantic&&result.semantic.indexOf(".")<0){return null}}if(result){result.semantic=result.semantic.replace(/\s+/g,"")}return result}())}function addrSpec(){return wrap("addr-spec",and(localPart,literal("@"),domain)())}function fromSpec(){return wrap("from",or(mailboxList,addressList)())}function senderSpec(){return wrap("sender",or(mailbox,address)())}function replyToSpec(){return wrap("reply-to",addressList())}function obsNoWsCtl(){return opts.strict?null:wrap("obs-NO-WS-CTL",compareToken(function(tok){var code=tok.charCodeAt(0);return 1<=code&&code<=8||(11===code||12===code)||14<=code&&code<=31||127===code}))}function obsCtext(){return opts.strict?null:wrap("obs-ctext",obsNoWsCtl())}function obsQtext(){return opts.strict?null:wrap("obs-qtext",obsNoWsCtl())}function obsQP(){return opts.strict?null:wrap("obs-qp",and(literal("\\"),or(literal("\0"),obsNoWsCtl,lf,cr))())}function obsPhrase(){return opts.strict?null:wrap("obs-phrase",and(word,star(or(word,literal("."),opts.atInDisplayName?literal("@"):noop,opts.commaInDisplayName?literal(","):noop,colwsp(cfws))))())}function obsFws(){return opts.strict?null:wrap("obs-FWS",star(and(invis(opt(crlf)),wsp),1)())}function obsAngleAddr(){return opts.strict?null:wrap("obs-angle-addr",and(invis(opt(cfws)),literal("<"),obsRoute,addrSpec,literal(">"),invis(opt(cfws)))())}function obsRoute(){return opts.strict?null:wrap("obs-route",and(obsDomainList,literal(":"))())}function obsDomainList(){return opts.strict?null:wrap("obs-domain-list",and(star(or(invis(cfws),literal(","))),literal("@"),domain,star(and(literal(","),invis(opt(cfws)),opt(and(literal("@"),domain)))))())}function obsMboxList(){return opts.strict?null:wrap("obs-mbox-list",and(star(and(invis(opt(cfws)),literal(","))),mailbox,star(and(literal(","),opt(and(mailbox,invis(cfws))))))())}function obsAddrList(){return opts.strict?null:wrap("obs-addr-list",and(star(and(invis(opt(cfws)),literal(","))),address,star(and(literal(","),opt(and(address,invis(cfws))))))())}function obsGroupList(){return opts.strict?null:wrap("obs-group-list",and(star(and(invis(opt(cfws)),literal(",")),1),invis(opt(cfws)))())}function obsLocalPart(){return opts.strict?null:wrap("obs-local-part",and(word,star(and(literal("."),word)))())}function obsDomain(){return opts.strict?null:wrap("obs-domain",and(atom,star(and(literal("."),atom)))())}function obsDtext(){return opts.strict?null:wrap("obs-dtext",or(obsNoWsCtl,quotedPair)())}function findNode(name,root){var i,stack,node;if(root===null||root===undefined){return null}stack=[root];while(stack.length>0){node=stack.pop();if(node.name===name){return node}for(i=node.children.length-1;i>=0;i-=1){stack.push(node.children[i])}}return null}function findAllNodes(name,root){var i,stack,node,result;if(root===null||root===undefined){return null}stack=[root];result=[];while(stack.length>0){node=stack.pop();if(node.name===name){result.push(node)}for(i=node.children.length-1;i>=0;i-=1){stack.push(node.children[i])}}return result}function findAllNodesNoChildren(names,root){var i,stack,node,result,namesLookup;if(root===null||root===undefined){return null}stack=[root];result=[];namesLookup={};for(i=0;i0){node=stack.pop();if(node.name in namesLookup){result.push(node)}else{for(i=node.children.length-1;i>=0;i-=1){stack.push(node.children[i])}}}return result}function giveResult(ast){var addresses,groupsAndMailboxes,i,groupOrMailbox,result;if(ast===null){return null}addresses=[];groupsAndMailboxes=findAllNodesNoChildren(["group","mailbox"],ast);for(i=0;i1){return null}return result.addresses&&result.addresses[0]}var parseString,pos,len,parsed,startProduction;opts=handleOpts(opts,{});if(opts===null){return null}parseString=opts.input;startProduction={address:address,"address-list":addressList,"angle-addr":angleAddr,from:fromSpec,group:group,mailbox:mailbox,"mailbox-list":mailboxList,"reply-to":replyToSpec,sender:senderSpec}[opts.startAt]||addressList;if(!opts.strict){initialize();opts.strict=true;parsed=startProduction(parseString);if(opts.partial||!inStr()){return giveResult(parsed)}opts.strict=false}initialize();parsed=startProduction(parseString);if(!opts.partial&&inStr()){return null}return giveResult(parsed)}function parseOneAddressSimple(opts){return parse5322(handleOpts(opts,{oneResult:true,rfc6532:true,simple:true,startAt:"address-list"}))}function parseAddressListSimple(opts){return parse5322(handleOpts(opts,{rfc6532:true,simple:true,startAt:"address-list"}))}function parseFromSimple(opts){return parse5322(handleOpts(opts,{rfc6532:true,simple:true,startAt:"from"}))}function parseSenderSimple(opts){return parse5322(handleOpts(opts,{oneResult:true,rfc6532:true,simple:true,startAt:"sender"}))}function parseReplyToSimple(opts){return parse5322(handleOpts(opts,{rfc6532:true,simple:true,startAt:"reply-to"}))}function handleOpts(opts,defs){function isString(str){return Object.prototype.toString.call(str)==="[object String]"}function isObject(o){return o===Object(o)}function isNullUndef(o){return o===null||o===undefined}var defaults,o;if(isString(opts)){opts={input:opts}}else if(!isObject(opts)){return null}if(!isString(opts.input)){return null}if(!defs){return null}defaults={oneResult:false,partial:false,rejectTLD:false,rfc6532:false,simple:false,startAt:"address-list",strict:false,atInDisplayName:false,commaInDisplayName:false,addressListSeparator:","};for(o in defaults){if(isNullUndef(opts[o])){opts[o]=!isNullUndef(defs[o])?defs[o]:defaults[o]}}return opts}parse5322.parseOneAddress=parseOneAddressSimple;parse5322.parseAddressList=parseAddressListSimple;parse5322.parseFrom=parseFromSimple;parse5322.parseSender=parseSenderSimple;parse5322.parseReplyTo=parseReplyToSimple;if(typeof module!=="undefined"&&typeof module.exports!=="undefined"){module.exports=parse5322}else{global.emailAddresses=parse5322}})(this); diff --git a/node_modules/email-addresses/package.json b/node_modules/email-addresses/package.json new file mode 100644 index 00000000..5fb3e2a6 --- /dev/null +++ b/node_modules/email-addresses/package.json @@ -0,0 +1,30 @@ +{ + "version": "5.0.0", + "name": "email-addresses", + "description": "An email address parser based on rfc5322", + "keywords": [ + "email address", + "parser", + "rfc5322", + "5322" + ], + "homepage": "https://github.com/jackbearheart/email-addresses", + "author": "Jack Bearheart ", + "repository": { + "type": "git", + "url": "https://github.com/jackbearheart/email-addresses.git" + }, + "directories": { + "lib": "./lib" + }, + "main": "./lib/email-addresses.js", + "devDependencies": { + "libxmljs": "~0.19.7", + "tap": "^14.8.2" + }, + "scripts": { + "test": "tap ./test" + }, + "license": "MIT", + "typings": "./lib/email-addresses.d.ts" +} diff --git a/node_modules/email-addresses/test/email-addresses.js b/node_modules/email-addresses/test/email-addresses.js new file mode 100644 index 00000000..6846be7a --- /dev/null +++ b/node_modules/email-addresses/test/email-addresses.js @@ -0,0 +1,400 @@ + +var test = require("tap").test; + +var addrs = require("../lib/email-addresses"); + + +test("simple one address function", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + result = fxn("ABC < a@b.c>") || {}; + t.notOk(result.node, "has no ast information"); + t.equal(result.address, "a@b.c", "full address, semantic only"); + t.equal(result.name, "ABC", "display name"); + t.equal(result.local, "a", "local part"); + t.equal(result.domain, "b.c", "domain"); + + t.equal(fxn("bogus"), null, "bogus address > null"); + t.equal(fxn("a@b.c, d@e.f"), null, "address list > null"); + + result = fxn("\"Françoise Lefèvre\"@example.com"); + t.ok(result, "RFC 6532 (Unicode support) is enabled by default"); + t.equal(result.parts.local.semantic, "Françoise Lefèvre"); + + result = fxn("First Last "); + t.equal(result.name, "First Last", + "whitespace is not removed from display names without quotes"); + + result = fxn(" First Last "); + t.equal(result.name, "First Last", + "whitespace in names is collapsed"); + + t.end(); +}); + +test("address with @ in the name", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + result = fxn({input: "ABC@abc (comment) < a@b.c>", atInDisplayName: true }) || {}; + t.equal(result.name, "ABC@abc", "display name"); + t.end(); +}); + +test("address with comma in the display name", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + result = fxn({input: "ABC, abc (comment) ", commaInDisplayName: true }) || {}; + t.equal(result.name, "ABC, abc", "display name"); + + result = fxn({input: "ABC, abc (comment) ", commaInDisplayName: false }) || {}; + t.equal(result.name, undefined); + t.end(); +}); + +test("address with comments", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + result = fxn("ABC (comment) < a@b.c>" ) || {}; + t.equal(result.name, "ABC", "display name"); + t.equal(result.comments, '(comment)'); + t.end(); +}); + +test("simple address list function", function (t) { + var fxn, result; + fxn = addrs.parseAddressList; + + result = fxn("\"A B C\" < a@b.c>, d@e") || [{}, {}]; + t.notOk(result[0].node, "has no ast information"); + t.equal(result[0].address, "a@b.c", "full address, semantic only"); + t.equal(result[0].name, "A B C", "display name"); + t.equal(result[0].local, "a", "local part"); + t.equal(result[0].domain, "b.c", "domain"); + + t.notOk(result[1].node, "has no ast information"); + t.equal(result[1].address, "d@e", "second address"); + t.equal(result[1].name, null, "second display name"); + t.equal(result[1].local, "d", "second local part"); + t.equal(result[1].domain, "e", "second domain"); + + t.equal(fxn("bogus"), null, "bogus address > null"); + t.equal(fxn("a@b.c").length, 1, "single address > ok"); + + result = fxn("\"Françoise Lefèvre\"@example.com"); + t.ok(result, "RFC 6532 (Unicode support) is enabled by default"); + + t.end(); +}); + +test("simple address list function with user-specified list separator", function (t) { + var fxn, result; + fxn = addrs.parseAddressList; + + result = fxn({ input: "\"A B C\" < a@b.c>; d@e", addressListSeparator: ";" }) || [{}, {}]; + t.notOk(result[0].node, "has no ast information"); + t.equal(result[0].address, "a@b.c", "full address, semantic only"); + t.equal(result[0].name, "A B C", "display name"); + t.equal(result[0].local, "a", "local part"); + t.equal(result[0].domain, "b.c", "domain"); + + t.notOk(result[1].node, "has no ast information"); + t.equal(result[1].address, "d@e", "second address"); + t.equal(result[1].name, null, "second display name"); + t.equal(result[1].local, "d", "second local part"); + t.equal(result[1].domain, "e", "second domain"); + + t.end(); +}); + +test("rfc5322 parser", function (t) { + var fxn, result; + fxn = addrs; + + result = fxn("\"A B C\" < a@b.c>, d@e") || {}; + t.ok(result.ast, "has an ast"); + t.ok(result.addresses.length, "has the addresses"); + + result = result.addresses; + t.ok(result[0].node, "has link to node in ast"); + t.equal(result[0].address, "a@b.c", "full address, semantic only"); + t.equal(result[0].name, "A B C", "display name"); + t.equal(result[0].local, "a", "local part"); + t.equal(result[0].domain, "b.c", "domain"); + + t.ok(result[1].node, "has link to node in ast"); + t.equal(result[1].address, "d@e", "second address"); + t.equal(result[1].name, null, "second display name"); + t.equal(result[1].local, "d", "second local part"); + t.equal(result[1].domain, "e", "second domain"); + + t.equal(fxn("bogus"), null, "bogus address > null"); + t.equal(fxn("a@b bogus"), null, "not all input is an email list > null"); + + result = fxn({ input: "a@b bogus", partial: true }); + t.ok(result, "can obtain partial results if at beginning of string"); + + result = fxn("\"Françoise Lefèvre\"@example.com"); + t.notOk(result, "extended ascii characters are invalid according to RFC 5322"); + + result = fxn({ input: "\"Françoise Lefèvre\"@example.com", rfc6532: true }); + t.ok(result, "but extended ascii is allowed starting with RFC 6532"); + + t.end(); +}); + +test("display-name semantic interpretation", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + function check(s, comment, expected) { + t.equal(fxn(s).name, expected || "First Last", comment); + } + + check( + "First", + "single basic name is ok", + "First"); + + check( + "First Last", + "no extra whitespace is ok"); + + check( + " First Last ", + "single whitespace at beginning and end is removed"); + + check( + "First Last", + "whitespace in the middle is collapsed"); + + check( + " First Last ", + "extra whitespace everywhere is collapsed"); + + check( + " First Middle Last ", + "extra whitespace everywhere is collapsed, with more than 2 names", + "First Middle Last"); + + check( + "\tFirst \t Last\t", + "extra whitespace everywhere is collapsed with a mix of tabs and spaces"); + + check( + "\"First Last\"", + "surrounding quotes are not semantic"); + + check( + " \t \"First Last\" ", + "surrounding quotes are not semantic and whitespace is collapsed"); + + check( + " \t \"First \\\"The\t\tNickname\\\" Last\" ", + "surrounding quotes are not semantic, but inner quotes are, and whitespace is collapsed", + "First \"The Nickname\" Last"); + + t.end(); +}); + +test("address semantic interpretation", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + function check(s, comment, expected) { + t.equal(fxn(s).address, expected || "foo@bar.com", comment); + } + + check( + "foo@bar.com", + "plain address is ok"); + + check( + " foo@bar.com ", + "plain address with whitespace at beginning and end"); + + check( + "foo @bar.com", + "plain address with whitespace left of @ sign"); + + check( + "foo@ bar.com", + "plain address with whitespace right of @ sign"); + + // Technically, we should also be able to handle removing CFWS in + // a dot-atom (or more importantly, obs-domain), but I don't think anyone cares. + + check( + "\t foo\t\t@ \t bar.com \t ", + "plain address with whitespace everywhere"); + + check( + "Bob <\t foo\t\t@ \t bar.com \t >", + "angle-addr with whitespace everywhere"); + + check( + "\"foo\"@bar.com", + "plain address with quoted-string local-part"); + + check( + "\"foo baz\"@bar.com", + "plain address with quoted-string local-part including spaces" + + " (Note: This is a confusing situation for 'semantic' local-parts, and" + + " in this case we don't return a valid address. Don't use this. Just" + + " take the raw tokens used for the address if you always want it to be equivalent.)", + "foo baz@bar.com"); + + t.end(); +}); + +test("unicode support", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + result = fxn("\"Françoise Lefèvre\"@example.com"); + t.ok(result, "extended ascii characters are allowed"); + + result = fxn("杨孝宇 "); + t.ok(result, "unicode support includes chinese characters (display-name, no quoted string)"); + + result = fxn("\"杨孝宇\" "); + t.ok(result, "unicode support includes chinese characters (display-name, quoted-string)"); + + t.end(); +}); + +test("rejectTLD option", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + result = fxn({ input: "foo@bar.com", rejectTLD: false }); + t.ok(result, "a simple address is ok (rejectTLD false)"); + + result = fxn({ input: "foo@bar.com", rejectTLD: true }); + t.ok(result, "a simple address is ok (rejectTLD true)"); + + result = fxn({ input: "\"Foo Bar\" ", rejectTLD: false }); + t.ok(result, "a more complicated address is ok (rejectTLD false)"); + + result = fxn({ input: "\"Foo Bar\" ", rejectTLD: true }); + t.ok(result, "a more complicated address is ok (rejectTLD true)"); + + result = fxn({ input: "foo@bar", rejectTLD: false }); + t.ok(result, "an address with a TLD for its domain is allowed by rfc 5322"); + + result = fxn({ input: "foo@bar", rejectTLD: true }); + t.notOk(result, "an address with a TLD for its domain is rejected when the option is set"); + + result = fxn({ input: "\"Foo Bar\" ", rejectTLD: false }); + t.ok(result, "a more complicated address with a TLD for its domain is allowed by rfc 5322"); + + result = fxn({ input: "\"Foo Bar\" ", rejectTLD: true }); + t.notOk(result, "a more complicated address with a TLD for its domain is rejected when the option is set"); + + result = fxn({ input: "jack@", rejectTLD: true }); + t.notOk(result, "no domain is ok with rejectTLD set"); + + t.end(); +}); + +test("dots in unquoted display-names", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + result = fxn("H.P. Lovecraft "); + t.ok(result, "dots in the middle of an unquoted display-name with spaces (obs-phrase production)"); + + result = fxn("Hmm Yes Info. "); + t.ok(result, "dots to end an unquoted display-name (obs-phrase production)"); + + result = fxn("bar.net "); + t.ok(result, "dots in the middle of an unquoted display-name without spaces (obs-phrase production)"); + + result = fxn({ input: "H.P. Lovecraft ", strict: true }); + t.notOk(result, "dots without using 'obsolete' productions"); + + result = fxn({ input: "Hmm Yes Info. ", strict: true }); + t.notOk(result, "dots without using 'obsolete' productions"); + + result = fxn({ input: "bar.net ", strict: true }); + t.notOk(result, "dots without using 'obsolete' productions"); + + t.end(); +}); + +test("rfc6854 - from", function (t) { + var fxn, result; + fxn = addrs.parseFrom; + + result = fxn("Managing Partners:ben@example.com,carol@example.com;"); + t.ok(result, "Parse group for From:"); + t.equal(result[0].name, "Managing Partners", "Extract group name"); + t.equal(result[0].addresses.length, 2, "Extract group addresses"); + t.equal(result[0].addresses[0].address, "ben@example.com", "Group address 1"); + t.equal(result[0].addresses[1].address, "carol@example.com", "Group address 1") + + result = fxn("Managing Partners:ben@example.com,carol@example.com;, \"Foo\" "); + t.ok(result, "Group and mailbox"); + t.equal(result[0].name, "Managing Partners", "Extract group name"); + t.equal(result[1].name, "Foo", "Second address name"); + t.equal(result[1].local, "foo", "Second address local"); + t.equal(result[1].domain, "example.com", "Second address domain"); + + t.end(); +}); + +test("rfc6854 - sender", function (t) { + var fxn, result; + fxn = addrs.parseSender; + + result = fxn("Managing Partners:ben@example.com,carol@example.com;"); + t.ok(result, "Parse group for Sender:"); + t.equal(result.length, undefined, "Result is not an array"); + t.equal(result.name, "Managing Partners", "Result has name"); + t.equal(result.local, undefined, "Result has no local part"); + t.equal(result.addresses.length, 2, "Result has two addresses"); + t.equal(result.addresses[0].address, "ben@example.com", "Result first address match"); + t.equal(result.addresses[1].address, "carol@example.com", "Result first address match"); + + t.end(); +}); + +test("rfc6854 - reply-to", function (t) { + var fxn, result; + fxn = addrs.parseReplyTo; + + result = fxn("Managing Partners:ben@example.com,carol@example.com;"); + t.ok(result, "Parse group for Reply-To:"); + t.equal(result[0].name, "Managing Partners", "Extract group name"); + t.equal(result[0].addresses.length, 2, "Extract group addresses"); + t.equal(result[0].addresses[0].address, "ben@example.com", "Group address 1"); + t.equal(result[0].addresses[1].address, "carol@example.com", "Group address 1") + + result = fxn("Managing Partners:ben@example.com,carol@example.com;, \"Foo\" "); + t.ok(result, "Group and mailbox"); + t.equal(result[0].name, "Managing Partners", "Extract group name"); + t.equal(result[1].name, "Foo", "Second address name"); + t.equal(result[1].local, "foo", "Second address local"); + t.equal(result[1].domain, "example.com", "Second address domain"); + + result = fxn("Managing Partners:ben@example.com,carol@example.com;, \"Foo\" , Group2:alice@example.com;"); + t.ok(result, "Group, mailbox, group"); + t.equal(result[0].name, "Managing Partners", "First: group name"); + t.equal(result[0].addresses[0].address, "ben@example.com"); + t.equal(result[0].addresses[1].address, "carol@example.com"); + t.equal(result[1].name, "Foo", "Second: address name"); + t.equal(result[2].name, "Group2", "Third: group name"); + + t.end(); +}); + +test("whitespace in domain", function (t) { + var fxn, result; + fxn = addrs.parseOneAddress; + + result = fxn('":sysmail"@ Some-Group. Some-Org'); + t.ok(result, "spaces in domain parses ok"); + t.equal(result.domain, "Some-Group.Some-Org", "domain parsing strips whitespace"); + + t.end(); +}) diff --git a/node_modules/email-addresses/test/is_email.js b/node_modules/email-addresses/test/is_email.js new file mode 100644 index 00000000..8cd422ff --- /dev/null +++ b/node_modules/email-addresses/test/is_email.js @@ -0,0 +1,87 @@ +var fs = require("fs"), + libxmljs = require("libxmljs"), + test = require("tap").test; + +var addrs = require("../lib/email-addresses"); + +var TESTS_FILE = "tests.xml", + TESTS_FILE_ENCODING = "utf8"; + +var ISEMAIL_ERR = "ISEMAIL_ERR", + ISEMAIL_ERR_DOMAINHYPHENSTART = "ISEMAIL_ERR_DOMAINHYPHENSTART", + ISEMAIL_ERR_DOMAINHYPHENEND = "ISEMAIL_ERR_DOMAINHYPHENEND"; + + +function isEmailTest(t, data) { + var nodes = getNodes(data, "//test"); + nodes.forEach(function (node) { + var id = getAttr(node, "id"), + address = getChildValue(node, "address"), + diagnosis = getChildValue(node, "diagnosis"); + + var result = addrs(convertAddress(address)), + ast = null; + if (result !== null) { + ast = result.addresses[0].node; + } + + var isValid = ast !== null, + expectedToBeValid = shouldParse(diagnosis); + + t.equal(isValid, expectedToBeValid, + "[test " + id + "] address: " + address + ", expects: " + expectedToBeValid); + }); + t.end(); +} + +function shouldParse(diagnosis) { + var isOk = !startsWith(diagnosis, ISEMAIL_ERR) || + // is_email considers address with a domain beginning + // or ending with "-" to be incorrect because they are not + // valid domains, but we are only concerned with rfc5322. + // From rfc5322's perspective, this is OK. + diagnosis === ISEMAIL_ERR_DOMAINHYPHENSTART || + diagnosis === ISEMAIL_ERR_DOMAINHYPHENEND; + return isOk; +} + +// the is_email tests encode control characters +// in the U+2400 block for display purposes +function convertAddress(s) { + var chars = []; + for (var i = 0; i < s.length; i += 1) { + var code = s.charCodeAt(i); + if (code >= 0x2400) { + code -= 0x2400; + } + chars.push(String.fromCharCode(code)); + } + return chars.join(''); +} + +function getChildValue(parent, nodeName) { + return parent.find(nodeName)[0].text(); +} + +function getAttr(node, attrName) { + return node.attr(attrName).value(); +} + +function getNodes(xml, xpath) { + var doc = libxmljs.parseXml(xml); + return doc.find(xpath); +} + +function startsWith(s, t) { + return s.substring(0, t.length) === t; +} + +test("isemail tests", function (t) { + fs.readFile(TESTS_FILE, TESTS_FILE_ENCODING, function (err, data) { + if (err) { + t.end(); + return console.error(err); + } + isEmailTest(t, data); + }); +}); diff --git a/node_modules/email-addresses/test/tests.xml b/node_modules/email-addresses/test/tests.xml new file mode 100644 index 00000000..72dde833 --- /dev/null +++ b/node_modules/email-addresses/test/tests.xml @@ -0,0 +1,1253 @@ + + + + + +

New test set

+

This test set is designed to replace and extend the coverage of the original set but with fewer tests.

+

Thanks to Michael Rushton (michael@squiloople.com) for starting this work and contributing tests 1-100

+
+ +
+ ISEMAIL_ERR + ISEMAIL_ERR_NODOMAIN + Michael Rushton + http://squiloople.com/tag/email/ + + +
test
+ ISEMAIL_ERR + ISEMAIL_ERR_NODOMAIN + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
@
+ ISEMAIL_ERR + ISEMAIL_ERR_NOLOCALPART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@
+ ISEMAIL_ERR + ISEMAIL_ERR_NODOMAIN + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@io
+ io. currently has an MX-record (Feb 2011). Some DNS setups seem to find it, some don't. If you don't see the MX for io. then try setting your DNS server to 8.8.8.8 (the Google DNS server) + ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
@io
+ io. currently has an MX-record (Feb 2011) + ISEMAIL_ERR + ISEMAIL_ERR_NOLOCALPART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_NOLOCALPART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@nominet.org.uk
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@about.museum
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
a@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@e.com
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.a
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test.test@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
.test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_DOT_START + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test.@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_DOT_END + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test..iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_CONSECUTIVEDOTS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test_exa-mple.com
+ ISEMAIL_ERR + ISEMAIL_ERR_NODOMAIN + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
!#$%&`*+/=?^`{|}~@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test\@test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
123@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@123.com
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.123
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_TLDNUMERIC + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@255.255.255.255
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_TLDNUMERIC + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@iana.org
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklmn@iana.org
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_LOCAL_TOOLONG + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.com
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm.com
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_LABEL_TOOLONG + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@mason-dixon.com
+ ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@-iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_DOMAINHYPHENSTART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana-.com
+ ISEMAIL_ERR + ISEMAIL_ERR_DOMAINHYPHENEND + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@c--n.com
+ c--n.com currently has an MX-record (May 2011) + ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.co-uk
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@.iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_DOT_START + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.org.
+ ISEMAIL_ERR + ISEMAIL_ERR_DOT_END + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana..com
+ ISEMAIL_ERR + ISEMAIL_ERR_CONSECUTIVEDOTS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
a@a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi
+ ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_TOOLONG + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
a@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg.hij
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_TOOLONG + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
a@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg.hijk
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAIN_TOOLONG + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test"@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
""@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"""@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"\a"@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"\""@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"\"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDQUOTEDSTR + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"\\"@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDQUOTEDSTR + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test"test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_ATEXT_AFTER_QS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test"text"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test""test"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test"."test"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_LOCALPART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test\ test"@iana.org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_QUOTEDSTRING + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test".test@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_LOCALPART + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test␀"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_QTEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"test\␀"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QP + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghj"@iana.org
+ Quotes are still part of the length restriction + ISEMAIL_RFC5322 + ISEMAIL_RFC5322_LOCAL_TOOLONG + Dominic Sayers + http://isemail.info +
+ +
"abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefg\h"@iana.org
+ Quoted pair is still part of the length restriction + ISEMAIL_RFC5322 + ISEMAIL_RFC5322_LOCAL_TOOLONG + Dominic Sayers + http://isemail.info +
+ +
test@[255.255.255.255]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@a[255.255.255.255]
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[255.255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[255.255.255.256]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[1111:2222:3333:4444:5555:6666:7777:8888]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:7777]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_GRPCOUNT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_GRPCOUNT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:888G]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_BADCHAR + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666::8888]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_IPV6DEPRECATED + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555::8888]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666::7777:8888]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_MAXGRPS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6::3333:4444:5555:6666:7777:8888]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_COLONSTRT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:::3333:4444:5555:6666:7777:8888]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111::4444:5555::8888]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_2X2XCOLON + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:::]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_GRPCOUNT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:255.255.255.255]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666:7777:255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_GRPCOUNT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444::255.255.255.255]
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_ADDRESSLITERAL + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:5555:6666::255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_MAXGRPS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6:1111:2222:3333:4444:::255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_2X2XCOLON + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@[IPv6::255.255.255.255]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_COLONSTRT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test @iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CFWS_NEAR_AT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@ iana .com
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CFWS_NEAR_AT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test . test@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_FWS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
␍␊ test@iana.org
+ FWS + ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
␍␊ ␍␊ test@iana.org
+ FWS with one line composed entirely of WSP -- only allowed as obsolete FWS (someone might allow only non-obsolete FWS) + ISEMAIL_DEPREC + ISEMAIL_DEPREC_FWS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
(comment)test@iana.org
+ ISEMAIL_CFWS + ISEMAIL_CFWS_COMMENT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
((comment)test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDCOMMENT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
(comment(comment))test@iana.org
+ ISEMAIL_CFWS + ISEMAIL_CFWS_COMMENT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@(comment)iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CFWS_NEAR_AT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test(comment)test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_ATEXT_AFTER_CFWS + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@(comment)[255.255.255.255]
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CFWS_NEAR_AT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
(comment)abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghiklm@iana.org
+ ISEMAIL_CFWS + ISEMAIL_CFWS_COMMENT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@(comment)abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghikl.com
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CFWS_NEAR_AT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
(comment)test@abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghik.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghik.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstuvwxyzabcdefghijk.abcdefghijklmnopqrstu
+ ISEMAIL_CFWS + ISEMAIL_CFWS_COMMENT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@iana.org␊
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
test@xn--hxajbheg2az3al.xn--jxalpdlp
+ A valid IDN from ICANN's IDN TLD evaluation gateway + ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
xn--test@iana.org
+ RFC 3490: "unless the + email standards are revised to invite the use of IDNA for local + parts, a domain label that holds the local part of an email address + SHOULD NOT begin with the ACE prefix, and even if it does, it is to + be interpreted literally as a local part that happens to begin with + the ACE prefix" + ISEMAIL_VALID_CATEGORY + ISEMAIL_VALID + Dominic Sayers + http://isemail.info +
+ +
test@iana.org-
+ ISEMAIL_ERR + ISEMAIL_ERR_DOMAINHYPHENEND + Dominic Sayers + http://isemail.info +
+ +
"test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDQUOTEDSTR + Dominic Sayers + http://isemail.info +
+ +
(test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDCOMMENT + Dominic Sayers + http://isemail.info +
+ +
test@(iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDCOMMENT + Dominic Sayers + http://isemail.info +
+ +
test@[1.2.3.4
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDDOMLIT + Dominic Sayers + http://isemail.info +
+ +
"test\"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDQUOTEDSTR + Dominic Sayers + http://isemail.info +
+ +
(comment\)test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDCOMMENT + Dominic Sayers + http://isemail.info +
+ +
test@iana.org(comment\)
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDCOMMENT + Dominic Sayers + http://isemail.info +
+ +
test@iana.org(comment\
+ ISEMAIL_ERR + ISEMAIL_ERR_BACKSLASHEND + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-domain-literal]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322]-domain-literal]
+ ISEMAIL_ERR + ISEMAIL_ERR_ATEXT_AFTER_DOMLIT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-[domain-literal]
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_DTEXT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-\␇-domain-literal]
+ obs-dtext and obs-qp + ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMLIT_OBSDTEXT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-\␉-domain-literal]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMLIT_OBSDTEXT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-\]-domain-literal]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMLIT_OBSDTEXT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-domain-literal\]
+ ISEMAIL_ERR + ISEMAIL_ERR_UNCLOSEDDOMLIT + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-domain-literal\
+ ISEMAIL_ERR + ISEMAIL_ERR_BACKSLASHEND + Dominic Sayers + http://isemail.info +
+ +
test@[RFC 5322 domain literal]
+ Spaces are FWS in a domain literal + ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Dominic Sayers + http://isemail.info +
+ +
test@[RFC-5322-domain-literal] (comment)
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAINLITERAL + Dominic Sayers + http://isemail.info +
+ +
@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Dominic Sayers + http://isemail.info +
+ +
test@.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Dominic Sayers + http://isemail.info +
+ +
""@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QTEXT + Dominic Sayers + http://isemail.info +
+ +
"\"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QP + Dominic Sayers + http://isemail.info +
+ +
()test@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CTEXT + Dominic Sayers + http://isemail.info +
+ +
test@iana.org␍
+ No LF after the CR + ISEMAIL_ERR + ISEMAIL_ERR_CR_NO_LF + Dominic Sayers + http://isemail.info +
+ +
␍test@iana.org
+ No LF after the CR + ISEMAIL_ERR + ISEMAIL_ERR_CR_NO_LF + Dominic Sayers + http://isemail.info +
+ +
"␍test"@iana.org
+ No LF after the CR + ISEMAIL_ERR + ISEMAIL_ERR_CR_NO_LF + Dominic Sayers + http://isemail.info +
+ +
(␍)test@iana.org
+ No LF after the CR + ISEMAIL_ERR + ISEMAIL_ERR_CR_NO_LF + Dominic Sayers + http://isemail.info +
+ +
test@iana.org(␍)
+ No LF after the CR + ISEMAIL_ERR + ISEMAIL_ERR_CR_NO_LF + Dominic Sayers + http://isemail.info +
+ +
␊test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Michael Rushton + http://squiloople.com/tag/email/ +
+ +
"␊"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_QTEXT + Dominic Sayers + http://isemail.info +
+ +
"\␊"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QP + Dominic Sayers + http://isemail.info +
+ +
(␊)test@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_CTEXT + Dominic Sayers + http://isemail.info +
+ +
␇@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Dominic Sayers + http://isemail.info +
+ +
test@␇.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_ATEXT + Dominic Sayers + http://isemail.info +
+ +
"␇"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QTEXT + Dominic Sayers + http://isemail.info +
+ +
"\␇"@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_QP + Dominic Sayers + http://isemail.info +
+ +
(␇)test@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_CTEXT + Dominic Sayers + http://isemail.info +
+ +
␍␊test@iana.org
+ Not FWS because no actual white space + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
␍␊ ␍␊test@iana.org
+ Not obs-FWS because there must be white space on each "fold" + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
␍␊test@iana.org
+ Not FWS because no white space after the fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
␍␊ test@iana.org
+ FWS + ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Dominic Sayers + http://isemail.info +
+ +
␍␊ ␍␊test@iana.org
+ Not FWS because no white space after the second fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
␍␊␍␊test@iana.org
+ Not FWS because no white space after either fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_X2 + Dominic Sayers + http://isemail.info +
+ +
␍␊␍␊ test@iana.org
+ Not FWS because no white space after the first fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_X2 + Dominic Sayers + http://isemail.info +
+ +
test@iana.org␍␊
+ FWS + ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Dominic Sayers + http://isemail.info +
+ +
test@iana.org␍␊ ␍␊
+ FWS with one line composed entirely of WSP -- only allowed as obsolete FWS (someone might allow only non-obsolete FWS) + ISEMAIL_DEPREC + ISEMAIL_DEPREC_FWS + Dominic Sayers + http://isemail.info +
+ +
test@iana.org␍␊
+ Not FWS because no actual white space + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
test@iana.org␍␊ ␍␊
+ Not obs-FWS because there must be white space on each "fold" + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
test@iana.org ␍␊
+ Not FWS because no white space after the fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
test@iana.org ␍␊
+ FWS + ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Dominic Sayers + http://isemail.info +
+ +
test@iana.org ␍␊ ␍␊
+ Not FWS because no white space after the second fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_END + Dominic Sayers + http://isemail.info +
+ +
test@iana.org ␍␊␍␊
+ Not FWS because no white space after either fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_X2 + Dominic Sayers + http://isemail.info +
+ +
test@iana.org ␍␊␍␊
+ Not FWS because no white space after the first fold + ISEMAIL_ERR + ISEMAIL_ERR_FWS_CRLF_X2 + Dominic Sayers + http://isemail.info +
+ +
test@iana.org
+ ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Dominic Sayers + http://isemail.info +
+ +
test@iana.org
+ ISEMAIL_CFWS + ISEMAIL_CFWS_FWS + Dominic Sayers + http://isemail.info +
+ +
test@[IPv6:1::2:]
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_IPV6_COLONEND + Dominic Sayers + http://isemail.info +
+ +
"test\©"@iana.org
+ ISEMAIL_ERR + ISEMAIL_ERR_EXPECTING_QPAIR + Dominic Sayers + http://isemail.info +
+ +
test@iana/icann.org
+ ISEMAIL_RFC5322 + ISEMAIL_RFC5322_DOMAIN + Dominic Sayers + http://isemail.info +
+ +
test.(comment)test@iana.org
+ ISEMAIL_DEPREC + ISEMAIL_DEPREC_COMMENT + Dominic Sayers + http://isemail.info +
+ +
test@org
+ ISEMAIL_RFC5321 + ISEMAIL_RFC5321_TLD + Dominic Sayers + http://isemail.info +
+ +
test@test.com
+ test.com has an A-record but not an MX-record + ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_MX_RECORD + Dominic Sayers + http://isemail.info +
+ +
test@nic.no
+ nic.no currently has no MX-records or A-records (Feb 2011). If you are seeing an A-record for nic.io then try setting your DNS server to 8.8.8.8 (the Google DNS server) - your DNS server may be faking an A-record (OpenDNS does this, for instance). + ISEMAIL_DNSWARN + ISEMAIL_DNSWARN_NO_RECORD + Dominic Sayers + http://isemail.info +
+ diff --git a/node_modules/emoji-regex/LICENSE-MIT.txt b/node_modules/emoji-regex/LICENSE-MIT.txt new file mode 100644 index 00000000..a41e0a7e --- /dev/null +++ b/node_modules/emoji-regex/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +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/emoji-regex/README.md b/node_modules/emoji-regex/README.md new file mode 100644 index 00000000..6d630827 --- /dev/null +++ b/node_modules/emoji-regex/README.md @@ -0,0 +1,137 @@ +# emoji-regex [![Build status](https://travis-ci.org/mathiasbynens/emoji-regex.svg?branch=main)](https://travis-ci.org/mathiasbynens/emoji-regex) + +_emoji-regex_ offers a regular expression to match all emoji symbols and sequences (including textual representations of emoji) as per the Unicode Standard. + +This repository contains a script that generates this regular expression based on [Unicode data](https://github.com/node-unicode/node-unicode-data). Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard. + +## Installation + +Via [npm](https://www.npmjs.com/): + +```bash +npm install emoji-regex +``` + +In [Node.js](https://nodejs.org/): + +```js +const emojiRegex = require('emoji-regex/RGI_Emoji.js'); +// Note: because the regular expression has the global flag set, this module +// exports a function that returns the regex rather than exporting the regular +// expression itself, to make it impossible to (accidentally) mutate the +// original regular expression. + +const text = ` +\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation) +\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji +\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base) +\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier +`; + +const regex = emojiRegex(); +let match; +while (match = regex.exec(text)) { + const emoji = match[0]; + console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`); +} +``` + +Console output: + +``` +Matched sequence ⌚ — code points: 1 +Matched sequence ⌚ — code points: 1 +Matched sequence ↔️ — code points: 2 +Matched sequence ↔️ — code points: 2 +Matched sequence 👩 — code points: 1 +Matched sequence 👩 — code points: 1 +Matched sequence 👩🏿 — code points: 2 +Matched sequence 👩🏿 — code points: 2 +``` + +## Regular expression flavors + +The package comes with three distinct regular expressions: + +```js +// This is the recommended regular expression to use. It matches all +// emoji recommended for general interchange, as defined via the +// `RGI_Emoji` property in the Unicode Standard. +// https://unicode.org/reports/tr51/#def_rgi_set +// When in doubt, use this! +const emojiRegexRGI = require('emoji-regex/RGI_Emoji.js'); + +// This is the old regular expression, prior to `RGI_Emoji` being +// standardized. In addition to all `RGI_Emoji` sequences, it matches +// some emoji you probably don’t want to match (such as emoji component +// symbols that are not meant to be used separately). +const emojiRegex = require('emoji-regex/index.js'); + +// This regular expression matches even more emoji than the previous +// one, including emoji that render as text instead of icons (i.e. +// emoji that are not `Emoji_Presentation` symbols and that aren’t +// forced to render as emoji by a variation selector). +const emojiRegexText = require('emoji-regex/text.js'); +``` + +Additionally, in environments which support ES2015 Unicode escapes, you may `require` ES2015-style versions of the regexes: + +```js +const emojiRegexRGI = require('emoji-regex/es2015/RGI_Emoji.js'); +const emojiRegex = require('emoji-regex/es2015/index.js'); +const emojiRegexText = require('emoji-regex/es2015/text.js'); +``` + +## For maintainers + +### How to update emoji-regex after new Unicode Standard releases + +1. Update the Unicode data dependency in `package.json` by running the following commands: + + ```sh + # Example: updating from Unicode v12 to Unicode v13. + npm uninstall @unicode/unicode-12.0.0 + npm install @unicode/unicode-13.0.0 --save-dev + ```` + +1. Generate the new output: + + ```sh + npm run build + ``` + +1. Verify that tests still pass: + + ```sh + npm test + ``` + +1. Send a pull request with the changes, and get it reviewed & merged. + +1. On the `main` branch, bump the emoji-regex version number in `package.json`: + + ```sh + npm version patch -m 'Release v%s' + ``` + + Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/). + + Note that this produces a Git commit + tag. + +1. Push the release commit and tag: + + ```sh + git push + ``` + + Our CI then automatically publishes the new release to npm. + +## Author + +| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](https://mathiasbynens.be/) | + +## License + +_emoji-regex_ is available under the [MIT](https://mths.be/mit) license. diff --git a/node_modules/emoji-regex/RGI_Emoji.d.ts b/node_modules/emoji-regex/RGI_Emoji.d.ts new file mode 100644 index 00000000..89a651fb --- /dev/null +++ b/node_modules/emoji-regex/RGI_Emoji.d.ts @@ -0,0 +1,5 @@ +declare module 'emoji-regex/RGI_Emoji' { + function emojiRegex(): RegExp; + + export = emojiRegex; +} diff --git a/node_modules/emoji-regex/RGI_Emoji.js b/node_modules/emoji-regex/RGI_Emoji.js new file mode 100644 index 00000000..3fbe9241 --- /dev/null +++ b/node_modules/emoji-regex/RGI_Emoji.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\u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F73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uD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uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]/g; +}; diff --git a/node_modules/emoji-regex/es2015/RGI_Emoji.d.ts b/node_modules/emoji-regex/es2015/RGI_Emoji.d.ts new file mode 100644 index 00000000..bf0f154b --- /dev/null +++ b/node_modules/emoji-regex/es2015/RGI_Emoji.d.ts @@ -0,0 +1,5 @@ +declare module 'emoji-regex/es2015/RGI_Emoji' { + function emojiRegex(): RegExp; + + export = emojiRegex; +} diff --git a/node_modules/emoji-regex/es2015/RGI_Emoji.js b/node_modules/emoji-regex/es2015/RGI_Emoji.js new file mode 100644 index 00000000..ecf32f17 --- /dev/null +++ b/node_modules/emoji-regex/es2015/RGI_Emoji.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074}|\u{E0065}\u{E006E}\u{E0067})\u{E007F}|(?:\u{1F9D1}\u{1F3FF}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FE}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FD}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FB}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FC}-\u{1F3FF}]|\u{1F468}(?:\u{1F3FB}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]))?|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC})?|(?:\u{1F469}(?:\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}]))|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]\u200D\u{1F91D}\u200D\u{1F9D1})[\u{1F3FB}-\u{1F3FF}]|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F469}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F9D1}(?:\u200D(?:\u{1F91D}\u200D\u{1F9D1}|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F9D1}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F636}\u200D\u{1F32B}|\u{1F3F3}\uFE0F\u200D\u26A7|\u{1F43B}\u200D\u2744|(?:[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u{1F3F4}\u200D\u2620|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F202}\u{1F237}\u{1F321}\u{1F324}-\u{1F32C}\u{1F336}\u{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1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270C\u270D\u{1F574}\u{1F590}][\uFE0F\u{1F3FB}-\u{1F3FF}]|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F408}\u{1F415}\u{1F43B}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F62E}\u{1F635}\u{1F636}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F384}\u{1F386}-\u{1F393}\u{1F3A0}-\u{1F3C1}\u{1F3C5}\u{1F3C6}\u{1F3C8}\u{1F3C9}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F8}-\u{1F407}\u{1F409}-\u{1F414}\u{1F416}-\u{1F43A}\u{1F43C}-\u{1F43E}\u{1F440}\u{1F444}\u{1F445}\u{1F451}-\u{1F465}\u{1F46A}\u{1F479}-\u{1F47B}\u{1F47D}-\u{1F480}\u{1F484}\u{1F488}-\u{1F48E}\u{1F490}\u{1F492}-\u{1F4A9}\u{1F4AB}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F5A4}\u{1F5FB}-\u{1F62D}\u{1F62F}-\u{1F634}\u{1F637}-\u{1F644}\u{1F648}-\u{1F64A}\u{1F680}-\u{1F6A2}\u{1F6A4}-\u{1F6B3}\u{1F6B7}-\u{1F6BF}\u{1F6C1}-\u{1F6C5}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90D}\u{1F90E}\u{1F910}-\u{1F917}\u{1F91D}\u{1F920}-\u{1F925}\u{1F927}-\u{1F92F}\u{1F93A}\u{1F93F}-\u{1F945}\u{1F947}-\u{1F976}\u{1F978}\u{1F97A}-\u{1F9B4}\u{1F9B7}\u{1F9BA}\u{1F9BC}-\u{1F9CB}\u{1F9D0}\u{1F9E0}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]/gu; +}; diff --git a/node_modules/emoji-regex/es2015/index.d.ts b/node_modules/emoji-regex/es2015/index.d.ts new file mode 100644 index 00000000..823dfa65 --- /dev/null +++ b/node_modules/emoji-regex/es2015/index.d.ts @@ -0,0 +1,5 @@ +declare module 'emoji-regex/es2015' { + function emojiRegex(): RegExp; + + export = emojiRegex; +} diff --git a/node_modules/emoji-regex/es2015/index.js b/node_modules/emoji-regex/es2015/index.js new file mode 100644 index 00000000..1a4fc8d0 --- /dev/null +++ b/node_modules/emoji-regex/es2015/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074}|\u{E0065}\u{E006E}\u{E0067})\u{E007F}|(?:\u{1F9D1}\u{1F3FF}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FE}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FD}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FB}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FC}-\u{1F3FF}]|\u{1F468}(?:\u{1F3FB}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]))?|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC})?|(?:\u{1F469}(?:\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}]))|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]\u200D\u{1F91D}\u200D\u{1F9D1})[\u{1F3FB}-\u{1F3FF}]|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F469}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}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F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F9D1}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F636}\u200D\u{1F32B}|\u{1F3F3}\uFE0F\u200D\u26A7|\u{1F43B}\u200D\u2744|(?:[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u{1F3F4}\u200D\u2620|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F202}\u{1F237}\u{1F321}\u{1F324}-\u{1F32C}\u{1F336}\u{1F37D}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}\u{1F39F}\u{1F3CD}\u{1F3CE}\u{1F3D4}-\u{1F3DF}\u{1F3F5}\u{1F3F7}\u{1F43F}\u{1F4FD}\u{1F549}\u{1F54A}\u{1F56F}\u{1F570}\u{1F573}\u{1F576}-\u{1F579}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}\u{1F6CB}\u{1F6CD}-\u{1F6CF}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6F0}\u{1F6F3}])\uFE0F|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F469}\u200D\u{1F467}|\u{1F469}\u200D\u{1F466}|\u{1F635}\u200D\u{1F4AB}|\u{1F62E}\u200D\u{1F4A8}|\u{1F415}\u200D\u{1F9BA}|\u{1F9D1}(?:\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|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|\u2764\uFE0F|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]|\u{1F3F4}|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270C\u270D\u{1F574}\u{1F590}][\uFE0F\u{1F3FB}-\u{1F3FF}]|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F408}\u{1F415}\u{1F43B}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F62E}\u{1F635}\u{1F636}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F384}\u{1F386}-\u{1F393}\u{1F3A0}-\u{1F3C1}\u{1F3C5}\u{1F3C6}\u{1F3C8}\u{1F3C9}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F8}-\u{1F407}\u{1F409}-\u{1F414}\u{1F416}-\u{1F43A}\u{1F43C}-\u{1F43E}\u{1F440}\u{1F444}\u{1F445}\u{1F451}-\u{1F465}\u{1F46A}\u{1F479}-\u{1F47B}\u{1F47D}-\u{1F480}\u{1F484}\u{1F488}-\u{1F48E}\u{1F490}\u{1F492}-\u{1F4A9}\u{1F4AB}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F5A4}\u{1F5FB}-\u{1F62D}\u{1F62F}-\u{1F634}\u{1F637}-\u{1F644}\u{1F648}-\u{1F64A}\u{1F680}-\u{1F6A2}\u{1F6A4}-\u{1F6B3}\u{1F6B7}-\u{1F6BF}\u{1F6C1}-\u{1F6C5}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90D}\u{1F90E}\u{1F910}-\u{1F917}\u{1F91D}\u{1F920}-\u{1F925}\u{1F927}-\u{1F92F}\u{1F93A}\u{1F93F}-\u{1F945}\u{1F947}-\u{1F976}\u{1F978}\u{1F97A}-\u{1F9B4}\u{1F9B7}\u{1F9BA}\u{1F9BC}-\u{1F9CB}\u{1F9D0}\u{1F9E0}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90C}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F978}\u{1F97A}-\u{1F9CB}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90C}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F978}\u{1F97A}-\u{1F9CB}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]\uFE0F|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; +}; diff --git a/node_modules/emoji-regex/es2015/text.d.ts b/node_modules/emoji-regex/es2015/text.d.ts new file mode 100644 index 00000000..ccc2f9ad --- /dev/null +++ b/node_modules/emoji-regex/es2015/text.d.ts @@ -0,0 +1,5 @@ +declare module 'emoji-regex/es2015/text' { + function emojiRegex(): RegExp; + + export = emojiRegex; +} diff --git a/node_modules/emoji-regex/es2015/text.js b/node_modules/emoji-regex/es2015/text.js new file mode 100644 index 00000000..8e9f9857 --- /dev/null +++ b/node_modules/emoji-regex/es2015/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074}|\u{E0065}\u{E006E}\u{E0067})\u{E007F}|(?:\u{1F9D1}\u{1F3FF}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FE}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FD}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FB}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FC}-\u{1F3FF}]|\u{1F468}(?:\u{1F3FB}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]))?|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC})?|(?:\u{1F469}(?:\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}]))|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]\u200D\u{1F91D}\u200D\u{1F9D1})[\u{1F3FB}-\u{1F3FF}]|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F469}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3E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\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F9D1}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F636}\u200D\u{1F32B}|\u{1F3F3}\uFE0F\u200D\u26A7|\u{1F43B}\u200D\u2744|(?:[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u{1F3F4}\u200D\u2620|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F202}\u{1F237}\u{1F321}\u{1F324}-\u{1F32C}\u{1F336}\u{1F37D}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}\u{1F39F}\u{1F3CD}\u{1F3CE}\u{1F3D4}-\u{1F3DF}\u{1F3F5}\u{1F3F7}\u{1F43F}\u{1F4FD}\u{1F549}\u{1F54A}\u{1F56F}\u{1F570}\u{1F573}\u{1F576}-\u{1F579}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}\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1F1E7}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EF}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1F1E6}[\u{1F1E8}-\u{1F1EC}\u{1F1EE}\u{1F1F1}\u{1F1F2}\u{1F1F4}\u{1F1F6}-\u{1F1FA}\u{1F1FC}\u{1F1FD}\u{1F1FF}]|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]|\u{1F3F4}|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270C\u270D\u{1F574}\u{1F590}][\uFE0F\u{1F3FB}-\u{1F3FF}]|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F408}\u{1F415}\u{1F43B}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F62E}\u{1F635}\u{1F636}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F384}\u{1F386}-\u{1F393}\u{1F3A0}-\u{1F3C1}\u{1F3C5}\u{1F3C6}\u{1F3C8}\u{1F3C9}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F8}-\u{1F407}\u{1F409}-\u{1F414}\u{1F416}-\u{1F43A}\u{1F43C}-\u{1F43E}\u{1F440}\u{1F444}\u{1F445}\u{1F451}-\u{1F465}\u{1F46A}\u{1F479}-\u{1F47B}\u{1F47D}-\u{1F480}\u{1F484}\u{1F488}-\u{1F48E}\u{1F490}\u{1F492}-\u{1F4A9}\u{1F4AB}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F5A4}\u{1F5FB}-\u{1F62D}\u{1F62F}-\u{1F634}\u{1F637}-\u{1F644}\u{1F648}-\u{1F64A}\u{1F680}-\u{1F6A2}\u{1F6A4}-\u{1F6B3}\u{1F6B7}-\u{1F6BF}\u{1F6C1}-\u{1F6C5}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90D}\u{1F90E}\u{1F910}-\u{1F917}\u{1F91D}\u{1F920}-\u{1F925}\u{1F927}-\u{1F92F}\u{1F93A}\u{1F93F}-\u{1F945}\u{1F947}-\u{1F976}\u{1F978}\u{1F97A}-\u{1F9B4}\u{1F9B7}\u{1F9BA}\u{1F9BC}-\u{1F9CB}\u{1F9D0}\u{1F9E0}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90C}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F978}\u{1F97A}-\u{1F9CB}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]\uFE0F?/gu; +}; diff --git a/node_modules/emoji-regex/index.d.ts b/node_modules/emoji-regex/index.d.ts new file mode 100644 index 00000000..8f235c9a --- /dev/null +++ b/node_modules/emoji-regex/index.d.ts @@ -0,0 +1,5 @@ +declare module 'emoji-regex' { + function emojiRegex(): RegExp; + + export = emojiRegex; +} diff --git a/node_modules/emoji-regex/index.js b/node_modules/emoji-regex/index.js new file mode 100644 index 00000000..c0490d4c --- /dev/null +++ b/node_modules/emoji-regex/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\u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83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\u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[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; +}; diff --git a/node_modules/emoji-regex/package.json b/node_modules/emoji-regex/package.json new file mode 100644 index 00000000..eac892a1 --- /dev/null +++ b/node_modules/emoji-regex/package.json @@ -0,0 +1,52 @@ +{ + "name": "emoji-regex", + "version": "9.2.2", + "description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.", + "homepage": "https://mths.be/emoji-regex", + "main": "index.js", + "types": "index.d.ts", + "keywords": [ + "unicode", + "regex", + "regexp", + "regular expressions", + "code points", + "symbols", + "characters", + "emoji" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "repository": { + "type": "git", + "url": "https://github.com/mathiasbynens/emoji-regex.git" + }, + "bugs": "https://github.com/mathiasbynens/emoji-regex/issues", + "files": [ + "LICENSE-MIT.txt", + "index.js", + "index.d.ts", + "RGI_Emoji.js", + "RGI_Emoji.d.ts", + "text.js", + "text.d.ts", + "es2015" + ], + "scripts": { + "build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src es2015_types -D -d ./es2015; node script/inject-sequences.js", + "test": "mocha", + "test:watch": "npm run test -- --watch" + }, + "devDependencies": { + "@babel/cli": "^7.4.4", + "@babel/core": "^7.4.4", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/preset-env": "^7.4.4", + "@unicode/unicode-13.0.0": "^1.0.3", + "mocha": "^6.1.4", + "regexgen": "^1.3.0" + } +} diff --git a/node_modules/emoji-regex/text.d.ts b/node_modules/emoji-regex/text.d.ts new file mode 100644 index 00000000..c3a01254 --- /dev/null +++ b/node_modules/emoji-regex/text.d.ts @@ -0,0 +1,5 @@ +declare module 'emoji-regex/text' { + function emojiRegex(): RegExp; + + export = emojiRegex; +} diff --git a/node_modules/emoji-regex/text.js b/node_modules/emoji-regex/text.js new file mode 100644 index 00000000..9bc63ce7 --- /dev/null +++ b/node_modules/emoji-regex/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD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DD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uD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D7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F?/g; +}; diff --git a/node_modules/escape-string-regexp/index.js b/node_modules/escape-string-regexp/index.js new file mode 100644 index 00000000..7834bf9b --- /dev/null +++ b/node_modules/escape-string-regexp/index.js @@ -0,0 +1,11 @@ +'use strict'; + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; + +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(matchOperatorsRe, '\\$&'); +}; diff --git a/node_modules/escape-string-regexp/license b/node_modules/escape-string-regexp/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/escape-string-regexp/license @@ -0,0 +1,21 @@ +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/escape-string-regexp/package.json b/node_modules/escape-string-regexp/package.json new file mode 100644 index 00000000..f307df34 --- /dev/null +++ b/node_modules/escape-string-regexp/package.json @@ -0,0 +1,41 @@ +{ + "name": "escape-string-regexp", + "version": "1.0.5", + "description": "Escape RegExp special characters", + "license": "MIT", + "repository": "sindresorhus/escape-string-regexp", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + "Sindre Sorhus (sindresorhus.com)", + "Joshua Boy Nicolai Appelman (jbna.nl)" + ], + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "escape", + "regex", + "regexp", + "re", + "regular", + "expression", + "string", + "str", + "special", + "characters" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/escape-string-regexp/readme.md b/node_modules/escape-string-regexp/readme.md new file mode 100644 index 00000000..87ac82d5 --- /dev/null +++ b/node_modules/escape-string-regexp/readme.md @@ -0,0 +1,27 @@ +# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp) + +> Escape RegExp special characters + + +## Install + +``` +$ npm install --save escape-string-regexp +``` + + +## Usage + +```js +const escapeStringRegexp = require('escape-string-regexp'); + +const escapedString = escapeStringRegexp('how much $ for a unicorn?'); +//=> 'how much \$ for a unicorn\?' + +new RegExp(escapedString); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/estree-walker/CHANGELOG.md b/node_modules/estree-walker/CHANGELOG.md new file mode 100644 index 00000000..20e8c7ea --- /dev/null +++ b/node_modules/estree-walker/CHANGELOG.md @@ -0,0 +1,92 @@ +# changelog + +## 2.0.2 + +* Internal tidying up (change test runner, convert to JS) + +## 2.0.1 + +* Robustify `this.remove()`, pass current index to walker functions ([#18](https://github.com/Rich-Harris/estree-walker/pull/18)) + +## 2.0.0 + +* Add an `asyncWalk` export ([#20](https://github.com/Rich-Harris/estree-walker/pull/20)) +* Internal rewrite + +## 1.0.1 + +* Relax node type to `BaseNode` ([#17](https://github.com/Rich-Harris/estree-walker/pull/17)) + +## 1.0.0 + +* Don't cache child keys + +## 0.9.0 + +* Add `this.remove()` method + +## 0.8.1 + +* Fix pkg.files + +## 0.8.0 + +* Adopt `estree` types + +## 0.7.0 + +* Add a `this.replace(node)` method + +## 0.6.1 + +* Only traverse nodes that exist and have a type ([#9](https://github.com/Rich-Harris/estree-walker/pull/9)) +* Only cache keys for nodes with a type ([#8](https://github.com/Rich-Harris/estree-walker/pull/8)) + +## 0.6.0 + +* Fix walker context type +* Update deps, remove unncessary Bublé transformation + +## 0.5.2 + +* Add types to package + +## 0.5.1 + +* Prevent context corruption when `walk()` is called during a walk + +## 0.5.0 + +* Export `childKeys`, for manually fixing in case of malformed ASTs + +## 0.4.0 + +* Add TypeScript typings ([#3](https://github.com/Rich-Harris/estree-walker/pull/3)) + +## 0.3.1 + +* Include `pkg.repository` ([#2](https://github.com/Rich-Harris/estree-walker/pull/2)) + +## 0.3.0 + +* More predictable ordering + +## 0.2.1 + +* Keep `context` shape + +## 0.2.0 + +* Add ES6 build + +## 0.1.3 + +* npm snafu + +## 0.1.2 + +* Pass current prop and index to `enter`/`leave` callbacks + +## 0.1.1 + +* First release diff --git a/node_modules/estree-walker/LICENSE b/node_modules/estree-walker/LICENSE new file mode 100644 index 00000000..63b62098 --- /dev/null +++ b/node_modules/estree-walker/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2015-20 [these people](https://github.com/Rich-Harris/estree-walker/graphs/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. \ No newline at end of file diff --git a/node_modules/estree-walker/README.md b/node_modules/estree-walker/README.md new file mode 100644 index 00000000..d877af36 --- /dev/null +++ b/node_modules/estree-walker/README.md @@ -0,0 +1,48 @@ +# estree-walker + +Simple utility for walking an [ESTree](https://github.com/estree/estree)-compliant AST, such as one generated by [acorn](https://github.com/marijnh/acorn). + + +## Installation + +```bash +npm i estree-walker +``` + + +## Usage + +```js +var walk = require( 'estree-walker' ).walk; +var acorn = require( 'acorn' ); + +ast = acorn.parse( sourceCode, options ); // https://github.com/acornjs/acorn + +walk( ast, { + enter: function ( node, parent, prop, index ) { + // some code happens + }, + leave: function ( node, parent, prop, index ) { + // some code happens + } +}); +``` + +Inside the `enter` function, calling `this.skip()` will prevent the node's children being walked, or the `leave` function (which is optional) being called. + +Call `this.replace(new_node)` in either `enter` or `leave` to replace the current node with a new one. + +Call `this.remove()` in either `enter` or `leave` to remove the current node. + +## Why not use estraverse? + +The ESTree spec is evolving to accommodate ES6/7. I've had a couple of experiences where [estraverse](https://github.com/estools/estraverse) was unable to handle an AST generated by recent versions of acorn, because it hard-codes visitor keys. + +estree-walker, by contrast, simply enumerates a node's properties to find child nodes (and child lists of nodes), and is therefore resistant to spec changes. It's also much smaller. (The performance, if you're wondering, is basically identical.) + +None of which should be taken as criticism of estraverse, which has more features and has been battle-tested in many more situations, and for which I'm very grateful. + + +## License + +MIT diff --git a/node_modules/estree-walker/dist/esm/estree-walker.js b/node_modules/estree-walker/dist/esm/estree-walker.js new file mode 100644 index 00000000..a0beeeb4 --- /dev/null +++ b/node_modules/estree-walker/dist/esm/estree-walker.js @@ -0,0 +1,333 @@ +// @ts-check +/** @typedef { import('estree').BaseNode} BaseNode */ + +/** @typedef {{ + skip: () => void; + remove: () => void; + replace: (node: BaseNode) => void; +}} WalkerContext */ + +class WalkerBase { + constructor() { + /** @type {boolean} */ + this.should_skip = false; + + /** @type {boolean} */ + this.should_remove = false; + + /** @type {BaseNode | null} */ + this.replacement = null; + + /** @type {WalkerContext} */ + this.context = { + skip: () => (this.should_skip = true), + remove: () => (this.should_remove = true), + replace: (node) => (this.replacement = node) + }; + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + * @param {BaseNode} node + */ + replace(parent, prop, index, node) { + if (parent) { + if (index !== null) { + parent[prop][index] = node; + } else { + parent[prop] = node; + } + } + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + */ + remove(parent, prop, index) { + if (parent) { + if (index !== null) { + parent[prop].splice(index, 1); + } else { + delete parent[prop]; + } + } + } +} + +// @ts-check + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker.js').WalkerContext} WalkerContext */ + +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => void} SyncHandler */ + +class SyncWalker extends WalkerBase { + /** + * + * @param {SyncHandler} enter + * @param {SyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {SyncHandler} */ + this.enter = enter; + + /** @type {SyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {BaseNode} + */ + visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!this.visit(value[i], node, key, i)) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } +} + +// @ts-check + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker').WalkerContext} WalkerContext */ + +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => Promise} AsyncHandler */ + +class AsyncWalker extends WalkerBase { + /** + * + * @param {AsyncHandler} enter + * @param {AsyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {AsyncHandler} */ + this.enter = enter; + + /** @type {AsyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {Promise} + */ + async visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + await this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!(await this.visit(value[i], node, key, i))) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + await this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + await this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } +} + +// @ts-check + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./sync.js').SyncHandler} SyncHandler */ +/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */ + +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: SyncHandler + * leave?: SyncHandler + * }} walker + * @returns {BaseNode} + */ +function walk(ast, { enter, leave }) { + const instance = new SyncWalker(enter, leave); + return instance.visit(ast, null); +} + +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: AsyncHandler + * leave?: AsyncHandler + * }} walker + * @returns {Promise} + */ +async function asyncWalk(ast, { enter, leave }) { + const instance = new AsyncWalker(enter, leave); + return await instance.visit(ast, null); +} + +export { asyncWalk, walk }; diff --git a/node_modules/estree-walker/dist/esm/package.json b/node_modules/estree-walker/dist/esm/package.json new file mode 100644 index 00000000..7c34deb5 --- /dev/null +++ b/node_modules/estree-walker/dist/esm/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/node_modules/estree-walker/dist/umd/estree-walker.js b/node_modules/estree-walker/dist/umd/estree-walker.js new file mode 100644 index 00000000..46fed0f9 --- /dev/null +++ b/node_modules/estree-walker/dist/umd/estree-walker.js @@ -0,0 +1,344 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.estreeWalker = {})); +}(this, (function (exports) { 'use strict'; + + // @ts-check + /** @typedef { import('estree').BaseNode} BaseNode */ + + /** @typedef {{ + skip: () => void; + remove: () => void; + replace: (node: BaseNode) => void; + }} WalkerContext */ + + class WalkerBase { + constructor() { + /** @type {boolean} */ + this.should_skip = false; + + /** @type {boolean} */ + this.should_remove = false; + + /** @type {BaseNode | null} */ + this.replacement = null; + + /** @type {WalkerContext} */ + this.context = { + skip: () => (this.should_skip = true), + remove: () => (this.should_remove = true), + replace: (node) => (this.replacement = node) + }; + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + * @param {BaseNode} node + */ + replace(parent, prop, index, node) { + if (parent) { + if (index !== null) { + parent[prop][index] = node; + } else { + parent[prop] = node; + } + } + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + */ + remove(parent, prop, index) { + if (parent) { + if (index !== null) { + parent[prop].splice(index, 1); + } else { + delete parent[prop]; + } + } + } + } + + // @ts-check + + /** @typedef { import('estree').BaseNode} BaseNode */ + /** @typedef { import('./walker.js').WalkerContext} WalkerContext */ + + /** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => void} SyncHandler */ + + class SyncWalker extends WalkerBase { + /** + * + * @param {SyncHandler} enter + * @param {SyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {SyncHandler} */ + this.enter = enter; + + /** @type {SyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {BaseNode} + */ + visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!this.visit(value[i], node, key, i)) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } + } + + // @ts-check + + /** @typedef { import('estree').BaseNode} BaseNode */ + /** @typedef { import('./walker').WalkerContext} WalkerContext */ + + /** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => Promise} AsyncHandler */ + + class AsyncWalker extends WalkerBase { + /** + * + * @param {AsyncHandler} enter + * @param {AsyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {AsyncHandler} */ + this.enter = enter; + + /** @type {AsyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {Promise} + */ + async visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + await this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!(await this.visit(value[i], node, key, i))) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + await this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + await this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } + } + + // @ts-check + + /** @typedef { import('estree').BaseNode} BaseNode */ + /** @typedef { import('./sync.js').SyncHandler} SyncHandler */ + /** @typedef { import('./async.js').AsyncHandler} AsyncHandler */ + + /** + * + * @param {BaseNode} ast + * @param {{ + * enter?: SyncHandler + * leave?: SyncHandler + * }} walker + * @returns {BaseNode} + */ + function walk(ast, { enter, leave }) { + const instance = new SyncWalker(enter, leave); + return instance.visit(ast, null); + } + + /** + * + * @param {BaseNode} ast + * @param {{ + * enter?: AsyncHandler + * leave?: AsyncHandler + * }} walker + * @returns {Promise} + */ + async function asyncWalk(ast, { enter, leave }) { + const instance = new AsyncWalker(enter, leave); + return await instance.visit(ast, null); + } + + exports.asyncWalk = asyncWalk; + exports.walk = walk; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/node_modules/estree-walker/package.json b/node_modules/estree-walker/package.json new file mode 100644 index 00000000..f646eb54 --- /dev/null +++ b/node_modules/estree-walker/package.json @@ -0,0 +1,37 @@ +{ + "name": "estree-walker", + "description": "Traverse an ESTree-compliant AST", + "version": "2.0.2", + "private": false, + "author": "Rich Harris", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/Rich-Harris/estree-walker" + }, + "type": "commonjs", + "main": "./dist/umd/estree-walker.js", + "module": "./dist/esm/estree-walker.js", + "exports": { + "require": "./dist/umd/estree-walker.js", + "import": "./dist/esm/estree-walker.js" + }, + "types": "types/index.d.ts", + "scripts": { + "prepublishOnly": "npm run build && npm test", + "build": "tsc && rollup -c", + "test": "uvu test" + }, + "devDependencies": { + "@types/estree": "0.0.42", + "rollup": "^2.10.9", + "typescript": "^3.7.5", + "uvu": "^0.5.1" + }, + "files": [ + "src", + "dist", + "types", + "README.md" + ] +} diff --git a/node_modules/estree-walker/src/async.js b/node_modules/estree-walker/src/async.js new file mode 100644 index 00000000..54276b51 --- /dev/null +++ b/node_modules/estree-walker/src/async.js @@ -0,0 +1,118 @@ +// @ts-check +import { WalkerBase } from './walker.js'; + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker').WalkerContext} WalkerContext */ + +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => Promise} AsyncHandler */ + +export class AsyncWalker extends WalkerBase { + /** + * + * @param {AsyncHandler} enter + * @param {AsyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {AsyncHandler} */ + this.enter = enter; + + /** @type {AsyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {Promise} + */ + async visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + await this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!(await this.visit(value[i], node, key, i))) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + await this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + await this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } +} diff --git a/node_modules/estree-walker/src/index.js b/node_modules/estree-walker/src/index.js new file mode 100644 index 00000000..dcf4c720 --- /dev/null +++ b/node_modules/estree-walker/src/index.js @@ -0,0 +1,35 @@ +// @ts-check +import { SyncWalker } from './sync.js'; +import { AsyncWalker } from './async.js'; + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./sync.js').SyncHandler} SyncHandler */ +/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */ + +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: SyncHandler + * leave?: SyncHandler + * }} walker + * @returns {BaseNode} + */ +export function walk(ast, { enter, leave }) { + const instance = new SyncWalker(enter, leave); + return instance.visit(ast, null); +} + +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: AsyncHandler + * leave?: AsyncHandler + * }} walker + * @returns {Promise} + */ +export async function asyncWalk(ast, { enter, leave }) { + const instance = new AsyncWalker(enter, leave); + return await instance.visit(ast, null); +} diff --git a/node_modules/estree-walker/src/package.json b/node_modules/estree-walker/src/package.json new file mode 100644 index 00000000..1632c2c4 --- /dev/null +++ b/node_modules/estree-walker/src/package.json @@ -0,0 +1 @@ +{"type": "module"} \ No newline at end of file diff --git a/node_modules/estree-walker/src/sync.js b/node_modules/estree-walker/src/sync.js new file mode 100644 index 00000000..b3cea40a --- /dev/null +++ b/node_modules/estree-walker/src/sync.js @@ -0,0 +1,118 @@ +// @ts-check +import { WalkerBase } from './walker.js'; + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker.js').WalkerContext} WalkerContext */ + +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => void} SyncHandler */ + +export class SyncWalker extends WalkerBase { + /** + * + * @param {SyncHandler} enter + * @param {SyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {SyncHandler} */ + this.enter = enter; + + /** @type {SyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {BaseNode} + */ + visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!this.visit(value[i], node, key, i)) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } +} diff --git a/node_modules/estree-walker/src/walker.js b/node_modules/estree-walker/src/walker.js new file mode 100644 index 00000000..3555d88a --- /dev/null +++ b/node_modules/estree-walker/src/walker.js @@ -0,0 +1,61 @@ +// @ts-check +/** @typedef { import('estree').BaseNode} BaseNode */ + +/** @typedef {{ + skip: () => void; + remove: () => void; + replace: (node: BaseNode) => void; +}} WalkerContext */ + +export class WalkerBase { + constructor() { + /** @type {boolean} */ + this.should_skip = false; + + /** @type {boolean} */ + this.should_remove = false; + + /** @type {BaseNode | null} */ + this.replacement = null; + + /** @type {WalkerContext} */ + this.context = { + skip: () => (this.should_skip = true), + remove: () => (this.should_remove = true), + replace: (node) => (this.replacement = node) + }; + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + * @param {BaseNode} node + */ + replace(parent, prop, index, node) { + if (parent) { + if (index !== null) { + parent[prop][index] = node; + } else { + parent[prop] = node; + } + } + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + */ + remove(parent, prop, index) { + if (parent) { + if (index !== null) { + parent[prop].splice(index, 1); + } else { + delete parent[prop]; + } + } + } +} diff --git a/node_modules/estree-walker/types/async.d.ts b/node_modules/estree-walker/types/async.d.ts new file mode 100644 index 00000000..c85bfdc5 --- /dev/null +++ b/node_modules/estree-walker/types/async.d.ts @@ -0,0 +1,53 @@ +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker').WalkerContext} WalkerContext */ +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => Promise} AsyncHandler */ +export class AsyncWalker extends WalkerBase { + /** + * + * @param {AsyncHandler} enter + * @param {AsyncHandler} leave + */ + constructor(enter: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise, leave: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise); + /** @type {AsyncHandler} */ + enter: AsyncHandler; + /** @type {AsyncHandler} */ + leave: AsyncHandler; + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {Promise} + */ + visit(node: import("estree").BaseNode, parent: import("estree").BaseNode, prop?: string, index?: number): Promise; + should_skip: any; + should_remove: any; + replacement: any; +} +export type BaseNode = import("estree").BaseNode; +export type WalkerContext = { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}; +export type AsyncHandler = (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise; +import { WalkerBase } from "./walker.js"; diff --git a/node_modules/estree-walker/types/index.d.ts b/node_modules/estree-walker/types/index.d.ts new file mode 100644 index 00000000..dfc3277d --- /dev/null +++ b/node_modules/estree-walker/types/index.d.ts @@ -0,0 +1,56 @@ +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./sync.js').SyncHandler} SyncHandler */ +/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */ +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: SyncHandler + * leave?: SyncHandler + * }} walker + * @returns {BaseNode} + */ +export function walk(ast: import("estree").BaseNode, { enter, leave }: { + enter?: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void; + leave?: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void; +}): import("estree").BaseNode; +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: AsyncHandler + * leave?: AsyncHandler + * }} walker + * @returns {Promise} + */ +export function asyncWalk(ast: import("estree").BaseNode, { enter, leave }: { + enter?: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise; + leave?: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise; +}): Promise; +export type BaseNode = import("estree").BaseNode; +export type SyncHandler = (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void; +export type AsyncHandler = (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise; diff --git a/node_modules/estree-walker/types/sync.d.ts b/node_modules/estree-walker/types/sync.d.ts new file mode 100644 index 00000000..e9e4cc1e --- /dev/null +++ b/node_modules/estree-walker/types/sync.d.ts @@ -0,0 +1,53 @@ +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker.js').WalkerContext} WalkerContext */ +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => void} SyncHandler */ +export class SyncWalker extends WalkerBase { + /** + * + * @param {SyncHandler} enter + * @param {SyncHandler} leave + */ + constructor(enter: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void, leave: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void); + /** @type {SyncHandler} */ + enter: SyncHandler; + /** @type {SyncHandler} */ + leave: SyncHandler; + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {BaseNode} + */ + visit(node: import("estree").BaseNode, parent: import("estree").BaseNode, prop?: string, index?: number): import("estree").BaseNode; + should_skip: any; + should_remove: any; + replacement: any; +} +export type BaseNode = import("estree").BaseNode; +export type WalkerContext = { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}; +export type SyncHandler = (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void; +import { WalkerBase } from "./walker.js"; diff --git a/node_modules/estree-walker/types/tsconfig.tsbuildinfo b/node_modules/estree-walker/types/tsconfig.tsbuildinfo new file mode 100644 index 00000000..799022fa --- /dev/null +++ b/node_modules/estree-walker/types/tsconfig.tsbuildinfo @@ -0,0 +1,345 @@ +{ + "program": { + "fileInfos": { + "../node_modules/typescript/lib/lib.es5.d.ts": { + "version": "fc43680ad3a1a4ec8c7b8d908af1ec9ddff87845346de5f02c735c9171fa98ea", + "signature": "fc43680ad3a1a4ec8c7b8d908af1ec9ddff87845346de5f02c735c9171fa98ea" + }, + "../node_modules/typescript/lib/lib.es2015.d.ts": { + "version": "7994d44005046d1413ea31d046577cdda33b8b2470f30281fd9c8b3c99fe2d96", + "signature": "7994d44005046d1413ea31d046577cdda33b8b2470f30281fd9c8b3c99fe2d96" + }, + "../node_modules/typescript/lib/lib.es2016.d.ts": { + "version": "5f217838d25704474d9ef93774f04164889169ca31475fe423a9de6758f058d1", + "signature": "5f217838d25704474d9ef93774f04164889169ca31475fe423a9de6758f058d1" + }, + "../node_modules/typescript/lib/lib.es2017.d.ts": { + "version": "459097c7bdd88fc5731367e56591e4f465f2c9de81a35427a7bd473165c34743", + "signature": "459097c7bdd88fc5731367e56591e4f465f2c9de81a35427a7bd473165c34743" + }, + "../node_modules/typescript/lib/lib.dom.d.ts": { + "version": "d93de5e8a7275cb9d47481410e13b3b1debb997e216490954b5d106e37e086de", + "signature": "d93de5e8a7275cb9d47481410e13b3b1debb997e216490954b5d106e37e086de" + }, + "../node_modules/typescript/lib/lib.dom.iterable.d.ts": { + "version": "8329c3401aa8708426c7760f14219170f69a2cb77e4519758cec6f5027270faf", + "signature": "8329c3401aa8708426c7760f14219170f69a2cb77e4519758cec6f5027270faf" + }, + "../node_modules/typescript/lib/lib.webworker.importscripts.d.ts": { + "version": "fe4e59403e34c7ff747abe4ff6abbc7718229556d7c1a5b93473fb53156c913b", + "signature": "fe4e59403e34c7ff747abe4ff6abbc7718229556d7c1a5b93473fb53156c913b" + }, + "../node_modules/typescript/lib/lib.scripthost.d.ts": { + "version": "b9faa17292f17d2ad75e34fac77dd63a6403af1dba02d39cd0cbb9ffdf3de8b9", + "signature": "b9faa17292f17d2ad75e34fac77dd63a6403af1dba02d39cd0cbb9ffdf3de8b9" + }, + "../node_modules/typescript/lib/lib.es2015.core.d.ts": { + "version": "734ddc145e147fbcd55f07d034f50ccff1086f5a880107665ec326fb368876f6", + "signature": "734ddc145e147fbcd55f07d034f50ccff1086f5a880107665ec326fb368876f6" + }, + "../node_modules/typescript/lib/lib.es2015.collection.d.ts": { + "version": "4a0862a21f4700de873db3b916f70e41570e2f558da77d2087c9490f5a0615d8", + "signature": "4a0862a21f4700de873db3b916f70e41570e2f558da77d2087c9490f5a0615d8" + }, + "../node_modules/typescript/lib/lib.es2015.generator.d.ts": { + "version": "765e0e9c9d74cf4d031ca8b0bdb269a853e7d81eda6354c8510218d03db12122", + "signature": "765e0e9c9d74cf4d031ca8b0bdb269a853e7d81eda6354c8510218d03db12122" + }, + "../node_modules/typescript/lib/lib.es2015.iterable.d.ts": { + "version": "285958e7699f1babd76d595830207f18d719662a0c30fac7baca7df7162a9210", + "signature": "285958e7699f1babd76d595830207f18d719662a0c30fac7baca7df7162a9210" + }, + "../node_modules/typescript/lib/lib.es2015.promise.d.ts": { + "version": "d4deaafbb18680e3143e8b471acd650ed6f72a408a33137f0a0dd104fbe7f8ca", + "signature": "d4deaafbb18680e3143e8b471acd650ed6f72a408a33137f0a0dd104fbe7f8ca" + }, + "../node_modules/typescript/lib/lib.es2015.proxy.d.ts": { + "version": "5e72f949a89717db444e3bd9433468890068bb21a5638d8ab15a1359e05e54fe", + "signature": "5e72f949a89717db444e3bd9433468890068bb21a5638d8ab15a1359e05e54fe" + }, + "../node_modules/typescript/lib/lib.es2015.reflect.d.ts": { + "version": "f5b242136ae9bfb1cc99a5971cccc44e99947ae6b5ef6fd8aa54b5ade553b976", + "signature": "f5b242136ae9bfb1cc99a5971cccc44e99947ae6b5ef6fd8aa54b5ade553b976" + }, + "../node_modules/typescript/lib/lib.es2015.symbol.d.ts": { + "version": "9ae2860252d6b5f16e2026d8a2c2069db7b2a3295e98b6031d01337b96437230", + "signature": "9ae2860252d6b5f16e2026d8a2c2069db7b2a3295e98b6031d01337b96437230" + }, + "../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts": { + "version": "3e0a459888f32b42138d5a39f706ff2d55d500ab1031e0988b5568b0f67c2303", + "signature": "3e0a459888f32b42138d5a39f706ff2d55d500ab1031e0988b5568b0f67c2303" + }, + "../node_modules/typescript/lib/lib.es2016.array.include.d.ts": { + "version": "3f96f1e570aedbd97bf818c246727151e873125d0512e4ae904330286c721bc0", + "signature": "3f96f1e570aedbd97bf818c246727151e873125d0512e4ae904330286c721bc0" + }, + "../node_modules/typescript/lib/lib.es2017.object.d.ts": { + "version": "c2d60b2e558d44384e4704b00e6b3d154334721a911f094d3133c35f0917b408", + "signature": "c2d60b2e558d44384e4704b00e6b3d154334721a911f094d3133c35f0917b408" + }, + "../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts": { + "version": "b8667586a618c5cf64523d4e500ae39e781428abfb28f3de441fc66b56144b6f", + "signature": "b8667586a618c5cf64523d4e500ae39e781428abfb28f3de441fc66b56144b6f" + }, + "../node_modules/typescript/lib/lib.es2017.string.d.ts": { + "version": "21df2e0059f14dcb4c3a0e125859f6b6ff01332ee24b0065a741d121250bc71c", + "signature": "21df2e0059f14dcb4c3a0e125859f6b6ff01332ee24b0065a741d121250bc71c" + }, + "../node_modules/typescript/lib/lib.es2017.intl.d.ts": { + "version": "c1759cb171c7619af0d2234f2f8fb2a871ee88e956e2ed91bb61778e41f272c6", + "signature": "c1759cb171c7619af0d2234f2f8fb2a871ee88e956e2ed91bb61778e41f272c6" + }, + "../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts": { + "version": "28569d59e07d4378cb3d54979c4c60f9f06305c9bb6999ffe6cab758957adc46", + "signature": "28569d59e07d4378cb3d54979c4c60f9f06305c9bb6999ffe6cab758957adc46" + }, + "../node_modules/typescript/lib/lib.es2017.full.d.ts": { + "version": "873c09f1c309389742d98b7b67419a8e0a5fa6f10ce59fd5149ecd31a2818594", + "signature": "873c09f1c309389742d98b7b67419a8e0a5fa6f10ce59fd5149ecd31a2818594" + }, + "../node_modules/@types/estree/index.d.ts": { + "version": "c2efad8a2f2d7fb931ff15c7959fb45340e74684cd665ddf0cbf9b3977be1644", + "signature": "c2efad8a2f2d7fb931ff15c7959fb45340e74684cd665ddf0cbf9b3977be1644" + }, + "../src/walker.js": { + "version": "4cc9d0e334d83a4cebeeac502de37a1aeeb953f6d4145a886d9eecea1f2142a7", + "signature": "075872468ccc19c83b03fd717fc9305b5f8ec09592210cf60279cb13eca2bd70" + }, + "../src/async.js": { + "version": "904efd145090ac40c3c98f29cc928332898a62ab642dd5921db2ae249bfe014a", + "signature": "da428f781d6dc6dfd4f4afd0dd5f25a780897dc8b57e5b30462491b7d08f32c0" + }, + "../src/sync.js": { + "version": "85bb22b85042f0a3717d8fac2fc8f62af16894652be34d1e08eb3e63785535f5", + "signature": "5b131a727db18c956611a5e33d08217df96d0f2e0f26d98b804d1ec2407e59ae" + }, + "../src/index.js": { + "version": "99128f4c6cb79cb1e3abf3f2ba96faedd2b820aab4fd7f743aab0b8d710a73af", + "signature": "c52be5c79280bfcfcf359c084c6f2f70f405b0ad14dde96b6703dbc5ef2261f5" + } + }, + "options": { + "allowJs": true, + "target": 4, + "module": 99, + "types": [ + "estree" + ], + "declaration": true, + "declarationDir": "./", + "emitDeclarationOnly": true, + "outDir": "./", + "newLine": 1, + "noImplicitAny": true, + "noImplicitThis": true, + "incremental": true, + "configFilePath": "../tsconfig.json" + }, + "referencedMap": { + "../src/walker.js": [ + "../node_modules/@types/estree/index.d.ts" + ], + "../src/async.js": [ + "../src/walker.js", + "../node_modules/@types/estree/index.d.ts" + ], + "../src/sync.js": [ + "../src/walker.js", + "../node_modules/@types/estree/index.d.ts" + ], + "../src/index.js": [ + "../src/sync.js", + "../src/async.js", + "../node_modules/@types/estree/index.d.ts" + ] + }, + "exportedModulesMap": { + "../src/walker.js": [ + "../node_modules/@types/estree/index.d.ts" + ], + "../src/async.js": [ + "../node_modules/@types/estree/index.d.ts" + ], + "../src/sync.js": [ + "../node_modules/@types/estree/index.d.ts" + ], + "../src/index.js": [ + "../node_modules/@types/estree/index.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../node_modules/typescript/lib/lib.es5.d.ts", + "../node_modules/typescript/lib/lib.es2015.d.ts", + "../node_modules/typescript/lib/lib.es2016.d.ts", + "../node_modules/typescript/lib/lib.es2017.d.ts", + "../node_modules/typescript/lib/lib.dom.d.ts", + "../node_modules/typescript/lib/lib.dom.iterable.d.ts", + "../node_modules/typescript/lib/lib.webworker.importscripts.d.ts", + "../node_modules/typescript/lib/lib.scripthost.d.ts", + "../node_modules/typescript/lib/lib.es2015.core.d.ts", + "../node_modules/typescript/lib/lib.es2015.collection.d.ts", + "../node_modules/typescript/lib/lib.es2015.generator.d.ts", + "../node_modules/typescript/lib/lib.es2015.iterable.d.ts", + "../node_modules/typescript/lib/lib.es2015.promise.d.ts", + "../node_modules/typescript/lib/lib.es2015.proxy.d.ts", + "../node_modules/typescript/lib/lib.es2015.reflect.d.ts", + "../node_modules/typescript/lib/lib.es2015.symbol.d.ts", + "../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts", + "../node_modules/typescript/lib/lib.es2016.array.include.d.ts", + "../node_modules/typescript/lib/lib.es2017.object.d.ts", + "../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts", + "../node_modules/typescript/lib/lib.es2017.string.d.ts", + "../node_modules/typescript/lib/lib.es2017.intl.d.ts", + "../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts", + "../node_modules/typescript/lib/lib.es2017.full.d.ts", + "../node_modules/@types/estree/index.d.ts", + "../src/walker.js", + [ + "../src/async.js", + [ + { + "file": "../src/async.js", + "start": 864, + "length": 12, + "messageText": "'_should_skip' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 907, + "length": 14, + "messageText": "'_should_remove' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 954, + "length": 12, + "messageText": "'_replacement' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 991, + "length": 24, + "messageText": "'should_skip' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 1021, + "length": 26, + "messageText": "'should_remove' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 1053, + "length": 23, + "messageText": "'replacement' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 1643, + "length": 9, + "code": 7053, + "category": 1, + "messageText": { + "messageText": "Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'BaseNode'.", + "category": 1, + "code": 7053, + "next": [ + { + "messageText": "No index signature with a parameter of type 'string' was found on type 'BaseNode'.", + "category": 1, + "code": 7054 + } + ] + } + } + ] + ], + [ + "../src/sync.js", + [ + { + "file": "../src/sync.js", + "start": 837, + "length": 12, + "messageText": "'_should_skip' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 880, + "length": 14, + "messageText": "'_should_remove' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 927, + "length": 12, + "messageText": "'_replacement' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 964, + "length": 24, + "messageText": "'should_skip' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 994, + "length": 26, + "messageText": "'should_remove' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 1026, + "length": 23, + "messageText": "'replacement' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 1610, + "length": 9, + "code": 7053, + "category": 1, + "messageText": { + "messageText": "Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'BaseNode'.", + "category": 1, + "code": 7053, + "next": [ + { + "messageText": "No index signature with a parameter of type 'string' was found on type 'BaseNode'.", + "category": 1, + "code": 7054 + } + ] + } + } + ] + ], + "../src/index.js" + ] + }, + "version": "3.7.5" +} \ No newline at end of file diff --git a/node_modules/estree-walker/types/walker.d.ts b/node_modules/estree-walker/types/walker.d.ts new file mode 100644 index 00000000..49d84416 --- /dev/null +++ b/node_modules/estree-walker/types/walker.d.ts @@ -0,0 +1,37 @@ +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef {{ + skip: () => void; + remove: () => void; + replace: (node: BaseNode) => void; +}} WalkerContext */ +export class WalkerBase { + /** @type {boolean} */ + should_skip: boolean; + /** @type {boolean} */ + should_remove: boolean; + /** @type {BaseNode | null} */ + replacement: BaseNode | null; + /** @type {WalkerContext} */ + context: WalkerContext; + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + * @param {BaseNode} node + */ + replace(parent: any, prop: string, index: number, node: import("estree").BaseNode): void; + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + */ + remove(parent: any, prop: string, index: number): void; +} +export type BaseNode = import("estree").BaseNode; +export type WalkerContext = { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}; diff --git a/node_modules/fast-glob/node_modules/glob-parent/CHANGELOG.md b/node_modules/fast-glob/node_modules/glob-parent/CHANGELOG.md new file mode 100644 index 00000000..fb9de961 --- /dev/null +++ b/node_modules/fast-glob/node_modules/glob-parent/CHANGELOG.md @@ -0,0 +1,110 @@ +### [5.1.2](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) (2021-03-06) + + +### Bug Fixes + +* eliminate ReDoS ([#36](https://github.com/gulpjs/glob-parent/issues/36)) ([f923116](https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366)) + +### [5.1.1](https://github.com/gulpjs/glob-parent/compare/v5.1.0...v5.1.1) (2021-01-27) + + +### Bug Fixes + +* unescape exclamation mark ([#26](https://github.com/gulpjs/glob-parent/issues/26)) ([a98874f](https://github.com/gulpjs/glob-parent/commit/a98874f1a59e407f4fb1beb0db4efa8392da60bb)) + +## [5.1.0](https://github.com/gulpjs/glob-parent/compare/v5.0.0...v5.1.0) (2021-01-27) + + +### Features + +* add `flipBackslashes` option to disable auto conversion of slashes (closes [#24](https://github.com/gulpjs/glob-parent/issues/24)) ([#25](https://github.com/gulpjs/glob-parent/issues/25)) ([eecf91d](https://github.com/gulpjs/glob-parent/commit/eecf91d5e3834ed78aee39c4eaaae654d76b87b3)) + +## [5.0.0](https://github.com/gulpjs/glob-parent/compare/v4.0.0...v5.0.0) (2021-01-27) + + +### ⚠ BREAKING CHANGES + +* Drop support for node <6 & bump dependencies + +### Miscellaneous Chores + +* Drop support for node <6 & bump dependencies ([896c0c0](https://github.com/gulpjs/glob-parent/commit/896c0c00b4e7362f60b96e7fc295ae929245255a)) + +## [4.0.0](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v4.0.0) (2021-01-27) + + +### ⚠ BREAKING CHANGES + +* question marks are valid path characters on Windows so avoid flagging as a glob when alone +* Update is-glob dependency + +### Features + +* hoist regexps and strings for performance gains ([4a80667](https://github.com/gulpjs/glob-parent/commit/4a80667c69355c76a572a5892b0f133c8e1f457e)) +* question marks are valid path characters on Windows so avoid flagging as a glob when alone ([2a551dd](https://github.com/gulpjs/glob-parent/commit/2a551dd0dc3235e78bf3c94843d4107072d17841)) +* Update is-glob dependency ([e41fcd8](https://github.com/gulpjs/glob-parent/commit/e41fcd895d1f7bc617dba45c9d935a7949b9c281)) + +## [3.1.0](https://github.com/gulpjs/glob-parent/compare/v3.0.1...v3.1.0) (2021-01-27) + + +### Features + +* allow basic win32 backslash use ([272afa5](https://github.com/gulpjs/glob-parent/commit/272afa5fd070fc0f796386a5993d4ee4a846988b)) +* handle extglobs (parentheses) containing separators ([7db1bdb](https://github.com/gulpjs/glob-parent/commit/7db1bdb0756e55fd14619e8ce31aa31b17b117fd)) +* new approach to braces/brackets handling ([8269bd8](https://github.com/gulpjs/glob-parent/commit/8269bd89290d99fac9395a354fb56fdcdb80f0be)) +* pre-process braces/brackets sections ([9ef8a87](https://github.com/gulpjs/glob-parent/commit/9ef8a87f66b1a43d0591e7a8e4fc5a18415ee388)) +* preserve escaped brace/bracket at end of string ([8cfb0ba](https://github.com/gulpjs/glob-parent/commit/8cfb0ba84202d51571340dcbaf61b79d16a26c76)) + + +### Bug Fixes + +* trailing escaped square brackets ([99ec9fe](https://github.com/gulpjs/glob-parent/commit/99ec9fecc60ee488ded20a94dd4f18b4f55c4ccf)) + +### [3.0.1](https://github.com/gulpjs/glob-parent/compare/v3.0.0...v3.0.1) (2021-01-27) + + +### Features + +* use path-dirname ponyfill ([cdbea5f](https://github.com/gulpjs/glob-parent/commit/cdbea5f32a58a54e001a75ddd7c0fccd4776aacc)) + + +### Bug Fixes + +* unescape glob-escaped dirnames on output ([598c533](https://github.com/gulpjs/glob-parent/commit/598c533bdf49c1428bc063aa9b8db40c5a86b030)) + +## [3.0.0](https://github.com/gulpjs/glob-parent/compare/v2.0.0...v3.0.0) (2021-01-27) + + +### ⚠ BREAKING CHANGES + +* update is-glob dependency + +### Features + +* update is-glob dependency ([5c5f8ef](https://github.com/gulpjs/glob-parent/commit/5c5f8efcee362a8e7638cf8220666acd8784f6bd)) + +## [2.0.0](https://github.com/gulpjs/glob-parent/compare/v1.3.0...v2.0.0) (2021-01-27) + + +### Features + +* move up to dirname regardless of glob characters ([f97fb83](https://github.com/gulpjs/glob-parent/commit/f97fb83be2e0a9fc8d3b760e789d2ecadd6aa0c2)) + +## [1.3.0](https://github.com/gulpjs/glob-parent/compare/v1.2.0...v1.3.0) (2021-01-27) + +## [1.2.0](https://github.com/gulpjs/glob-parent/compare/v1.1.0...v1.2.0) (2021-01-27) + + +### Reverts + +* feat: make regex test strings smaller ([dc80fa9](https://github.com/gulpjs/glob-parent/commit/dc80fa9658dca20549cfeba44bbd37d5246fcce0)) + +## [1.1.0](https://github.com/gulpjs/glob-parent/compare/v1.0.0...v1.1.0) (2021-01-27) + + +### Features + +* make regex test strings smaller ([cd83220](https://github.com/gulpjs/glob-parent/commit/cd832208638f45169f986d80fcf66e401f35d233)) + +## 1.0.0 (2021-01-27) + diff --git a/node_modules/fast-glob/node_modules/glob-parent/LICENSE b/node_modules/fast-glob/node_modules/glob-parent/LICENSE new file mode 100644 index 00000000..63222d7a --- /dev/null +++ b/node_modules/fast-glob/node_modules/glob-parent/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2015, 2019 Elan Shanker + +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/fast-glob/node_modules/glob-parent/README.md b/node_modules/fast-glob/node_modules/glob-parent/README.md new file mode 100644 index 00000000..36a27938 --- /dev/null +++ b/node_modules/fast-glob/node_modules/glob-parent/README.md @@ -0,0 +1,137 @@ +

+ + + +

+ +# glob-parent + +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] + +Extract the non-magic parent path from a glob string. + +## Usage + +```js +var globParent = require('glob-parent'); + +globParent('path/to/*.js'); // 'path/to' +globParent('/root/path/to/*.js'); // '/root/path/to' +globParent('/*.js'); // '/' +globParent('*.js'); // '.' +globParent('**/*.js'); // '.' +globParent('path/{to,from}'); // 'path' +globParent('path/!(to|from)'); // 'path' +globParent('path/?(to|from)'); // 'path' +globParent('path/+(to|from)'); // 'path' +globParent('path/*(to|from)'); // 'path' +globParent('path/@(to|from)'); // 'path' +globParent('path/**/*'); // 'path' + +// if provided a non-glob path, returns the nearest dir +globParent('path/foo/bar.js'); // 'path/foo' +globParent('path/foo/'); // 'path/foo' +globParent('path/foo'); // 'path' (see issue #3 for details) +``` + +## API + +### `globParent(maybeGlobString, [options])` + +Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below. + +#### options + +```js +{ + // Disables the automatic conversion of slashes for Windows + flipBackslashes: true +} +``` + +## Escaping + +The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: + +- `?` (question mark) unless used as a path segment alone +- `*` (asterisk) +- `|` (pipe) +- `(` (opening parenthesis) +- `)` (closing parenthesis) +- `{` (opening curly brace) +- `}` (closing curly brace) +- `[` (opening bracket) +- `]` (closing bracket) + +**Example** + +```js +globParent('foo/[bar]/') // 'foo' +globParent('foo/\\[bar]/') // 'foo/[bar]' +``` + +## Limitations + +### Braces & Brackets +This library attempts a quick and imperfect method of determining which path +parts have glob magic without fully parsing/lexing the pattern. There are some +advanced use cases that can trip it up, such as nested braces where the outer +pair is escaped and the inner one contains a path separator. If you find +yourself in the unlikely circumstance of being affected by this or need to +ensure higher-fidelity glob handling in your library, it is recommended that you +pre-process your input with [expand-braces] and/or [expand-brackets]. + +### Windows +Backslashes are not valid path separators for globs. If a path with backslashes +is provided anyway, for simple cases, glob-parent will replace the path +separator for you and return the non-glob parent path (now with +forward-slashes, which are still valid as Windows path separators). + +This cannot be used in conjunction with escape characters. + +```js +// BAD +globParent('C:\\Program Files \\(x86\\)\\*.ext') // 'C:/Program Files /(x86/)' + +// GOOD +globParent('C:/Program Files\\(x86\\)/*.ext') // 'C:/Program Files (x86)' +``` + +If you are using escape characters for a pattern without path parts (i.e. +relative to `cwd`), prefix with `./` to avoid confusing glob-parent. + +```js +// BAD +globParent('foo \\[bar]') // 'foo ' +globParent('foo \\[bar]*') // 'foo ' + +// GOOD +globParent('./foo \\[bar]') // 'foo [bar]' +globParent('./foo \\[bar]*') // '.' +``` + +## License + +ISC + +[expand-braces]: https://github.com/jonschlinkert/expand-braces +[expand-brackets]: https://github.com/jonschlinkert/expand-brackets + +[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg +[npm-url]: https://www.npmjs.com/package/glob-parent +[npm-image]: https://img.shields.io/npm/v/glob-parent.svg + +[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=2&branchName=master +[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/glob-parent?branchName=master + +[travis-url]: https://travis-ci.org/gulpjs/glob-parent +[travis-image]: https://img.shields.io/travis/gulpjs/glob-parent.svg?label=travis-ci + +[appveyor-url]: https://ci.appveyor.com/project/gulpjs/glob-parent +[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/glob-parent.svg?label=appveyor + +[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent +[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg + +[gitter-url]: https://gitter.im/gulpjs/gulp +[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/node_modules/fast-glob/node_modules/glob-parent/index.js b/node_modules/fast-glob/node_modules/glob-parent/index.js new file mode 100644 index 00000000..09e257ea --- /dev/null +++ b/node_modules/fast-glob/node_modules/glob-parent/index.js @@ -0,0 +1,42 @@ +'use strict'; + +var isGlob = require('is-glob'); +var pathPosixDirname = require('path').posix.dirname; +var isWin32 = require('os').platform() === 'win32'; + +var slash = '/'; +var backslash = /\\/g; +var enclosure = /[\{\[].*[\}\]]$/; +var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; +var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; + +/** + * @param {string} str + * @param {Object} opts + * @param {boolean} [opts.flipBackslashes=true] + * @returns {string} + */ +module.exports = function globParent(str, opts) { + var options = Object.assign({ flipBackslashes: true }, opts); + + // flip windows path separators + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + str = str.replace(backslash, slash); + } + + // special case for strings ending in enclosure containing path separator + if (enclosure.test(str)) { + str += slash; + } + + // preserves full path in case of trailing path separator + str += 'a'; + + // remove path parts that are globby + do { + str = pathPosixDirname(str); + } while (isGlob(str) || globby.test(str)); + + // remove escape chars and return result + return str.replace(escaped, '$1'); +}; diff --git a/node_modules/fast-glob/node_modules/glob-parent/package.json b/node_modules/fast-glob/node_modules/glob-parent/package.json new file mode 100644 index 00000000..125c971c --- /dev/null +++ b/node_modules/fast-glob/node_modules/glob-parent/package.json @@ -0,0 +1,48 @@ +{ + "name": "glob-parent", + "version": "5.1.2", + "description": "Extract the non-magic parent path from a glob string.", + "author": "Gulp Team (https://gulpjs.com/)", + "contributors": [ + "Elan Shanker (https://github.com/es128)", + "Blaine Bublitz " + ], + "repository": "gulpjs/glob-parent", + "license": "ISC", + "engines": { + "node": ">= 6" + }, + "main": "index.js", + "files": [ + "LICENSE", + "index.js" + ], + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "test": "nyc mocha --async-only", + "azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit", + "coveralls": "nyc report --reporter=text-lcov | coveralls" + }, + "dependencies": { + "is-glob": "^4.0.1" + }, + "devDependencies": { + "coveralls": "^3.0.11", + "eslint": "^2.13.1", + "eslint-config-gulp": "^3.0.1", + "expect": "^1.20.2", + "mocha": "^6.0.2", + "nyc": "^13.3.0" + }, + "keywords": [ + "glob", + "parent", + "strip", + "path", + "dirname", + "directory", + "base", + "wildcard" + ] +} diff --git a/node_modules/fastparse/LICENSE b/node_modules/fastparse/LICENSE new file mode 100644 index 00000000..481b17d3 --- /dev/null +++ b/node_modules/fastparse/LICENSE @@ -0,0 +1,7 @@ +Copyright 2018 Tobias Koppers + +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/fastparse/README.md b/node_modules/fastparse/README.md new file mode 100644 index 00000000..ee33c3ba --- /dev/null +++ b/node_modules/fastparse/README.md @@ -0,0 +1,118 @@ +# fastparse + +A very simple and stupid parser, based on a statemachine and regular expressions. + +It's not intended for complex languages. It's intended to easily write a simple parser for a simple language. + + + +## Usage + +Pass a description of statemachine to the constructor. The description must be in this form: + +``` javascript +new Parser(description) + +description is { + // The key is the name of the state + // The value is an object containing possible transitions + "state-name": { + // The key is a regular expression + // If the regular expression matches the transition is executed + // The value can be "true", a other state name or a function + + "a": true, + // true will make the parser stay in the current state + + "b": "other-state-name", + // a string will make the parser transit to a new state + + "[cde]": function(match, index, matchLength) { + // "match" will be the matched string + // "index" will be the position in the complete string + // "matchLength" will be "match.length" + + // "this" will be the "context" passed to the "parse" method" + + // A new state name (string) can be returned + return "other-state-name"; + }, + + "([0-9]+)(\\.[0-9]+)?": function(match, first, second, index, matchLength) { + // groups can be used in the regular expression + // they will match to arguments "first", "second" + }, + + // the parser stops when it cannot match the string anymore + + // order of keys is the order in which regular expressions are matched + // if the javascript runtime preserves the order of keys in an object + // (this is not standardized, but it's a de-facto standard) + } +} +``` + +The statemachine is compiled down to a single regular expression per state. So basically the parsing work is delegated to the (native) regular expression logic of the javascript runtime. + + +``` javascript +Parser.prototype.parse(initialState: String, parsedString: String, context: Object) +``` + +`initialState`: state where the parser starts to parse. + +`parsedString`: the string which should be parsed. + +`context`: an object which can be used to save state and results. Available as `this` in transition functions. + +returns `context` + + + + +## Example + +``` javascript +var Parser = require("fastparse"); + +// A simple parser that extracts @licence ... from comments in a JS file +var parser = new Parser({ + // The "source" state + "source": { + // matches comment start + "/\\*": "comment", + "//": "linecomment", + + // this would be necessary for a complex language like JS + // but omitted here for simplicity + // "\"": "string1", + // "\'": "string2", + // "\/": "regexp" + + }, + // The "comment" state + "comment": { + "\\*/": "source", + "@licen[cs]e\\s((?:[^*\n]|\\*+[^*/\n])*)": function(match, licenseText) { + this.licences.push(licenseText.trim()); + } + }, + // The "linecomment" state + "linecomment": { + "\n": "source", + "@licen[cs]e\\s(.*)": function(match, licenseText) { + this.licences.push(licenseText.trim()); + } + } +}); + +var licences = parser.parse("source", sourceCode, { licences: [] }).licences; + +console.log(licences); +``` + + + +## License + +MIT (http://www.opensource.org/licenses/mit-license.php) diff --git a/node_modules/fastparse/lib/Parser.js b/node_modules/fastparse/lib/Parser.js new file mode 100644 index 00000000..7f47c58f --- /dev/null +++ b/node_modules/fastparse/lib/Parser.js @@ -0,0 +1,108 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +function ignoreFunction() {} + +function createReturningFunction(value) { + return function() { + return value; + }; +} + +function Parser(states) { + this.states = this.compileStates(states); +} + +Parser.prototype.compileStates = function(states) { + var result = {}; + Object.keys(states).forEach(function(name) { + result[name] = this.compileState(states[name], states); + }, this); + return result; +}; + +Parser.prototype.compileState = function(state, states) { + var regExps = []; + function iterator(str, value) { + regExps.push({ + groups: Parser.getGroupCount(str), + regExp: str, + value: value + }); + } + function processState(statePart) { + if(Array.isArray(statePart)) { + statePart.forEach(processState); + } else if(typeof statePart === "object") { + Object.keys(statePart).forEach(function(key) { + iterator(key, statePart[key]); + }); + } else if(typeof statePart === "string") { + processState(states[statePart]); + } else { + throw new Error("Unexpected 'state' format"); + } + } + processState(state); + var total = regExps.map(function(r) { + return "(" + r.regExp + ")"; + }).join("|"); + var actions = []; + var pos = 1; + regExps.forEach(function(r) { + var fn; + if(typeof r.value === "function") { + fn = r.value; + } else if(typeof r.value === "string") { + fn = createReturningFunction(r.value); + } else { + fn = ignoreFunction; + } + actions.push({ + name: r.regExp, + fn: fn, + pos: pos, + pos2: pos + r.groups + 1 + }); + pos += r.groups + 1; + }); + return { + regExp: new RegExp(total, "g"), + actions: actions + }; +}; + +Parser.getGroupCount = function(regExpStr) { + return new RegExp("(" + regExpStr + ")|^$").exec("").length - 2; +}; + +Parser.prototype.parse = function(initialState, string, context) { + context = context || {}; + var currentState = initialState; + var currentIndex = 0; + for(;;) { + var state = this.states[currentState]; + var regExp = state.regExp; + regExp.lastIndex = currentIndex; + var match = regExp.exec(string); + if(!match) return context; + var actions = state.actions; + currentIndex = state.regExp.lastIndex; + for(var i = 0; i < actions.length; i++) { + var action = actions[i]; + if(match[action.pos]) { + var ret = action.fn.apply(context, Array.prototype.slice.call(match, action.pos, action.pos2).concat([state.regExp.lastIndex - match[0].length, match[0].length])); + if(ret) { + if(!(ret in this.states)) + throw new Error("State '" + ret + "' doesn't exist"); + currentState = ret; + } + break; + } + } + } +}; + +module.exports = Parser; diff --git a/node_modules/fastparse/package.json b/node_modules/fastparse/package.json new file mode 100644 index 00000000..9682e979 --- /dev/null +++ b/node_modules/fastparse/package.json @@ -0,0 +1,39 @@ +{ + "name": "fastparse", + "version": "1.1.2", + "description": "A very simple and stupid parser, based on a statemachine and regular expressions.", + "main": "lib/Parser.js", + "scripts": { + "pretest": "npm run lint", + "test": "mocha", + "travis": "npm run cover -- --report lcovonly", + "lint": "eslint lib", + "precover": "npm run lint", + "cover": "istanbul cover node_modules/mocha/bin/_mocha", + "publish-patch": "mocha && npm version patch && git push && git push --tags && npm publish" + }, + "repository": { + "type": "git", + "url": "https://github.com/webpack/fastparse.git" + }, + "keywords": [ + "parser", + "regexp" + ], + "files": [ + "lib" + ], + "author": "Tobias Koppers @sokra", + "license": "MIT", + "bugs": { + "url": "https://github.com/webpack/fastparse/issues" + }, + "homepage": "https://github.com/webpack/fastparse", + "devDependencies": { + "coveralls": "^2.11.2", + "eslint": "^0.21.2", + "istanbul": "^0.3.14", + "mocha": "^2.2.5", + "should": "^6.0.3" + } +} diff --git a/node_modules/filename-reserved-regex/index.js b/node_modules/filename-reserved-regex/index.js new file mode 100644 index 00000000..174f46f0 --- /dev/null +++ b/node_modules/filename-reserved-regex/index.js @@ -0,0 +1,5 @@ +'use strict'; +/* eslint-disable no-control-regex */ +// TODO: remove parens when Node.js 6 is targeted. Node.js 4 barfs at it. +module.exports = () => (/[<>:"\/\\|?*\x00-\x1F]/g); +module.exports.windowsNames = () => (/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i); diff --git a/node_modules/filename-reserved-regex/license b/node_modules/filename-reserved-regex/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/filename-reserved-regex/license @@ -0,0 +1,21 @@ +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/filename-reserved-regex/package.json b/node_modules/filename-reserved-regex/package.json new file mode 100644 index 00000000..37074a0b --- /dev/null +++ b/node_modules/filename-reserved-regex/package.json @@ -0,0 +1,36 @@ +{ + "name": "filename-reserved-regex", + "version": "2.0.0", + "description": "Regular expression for matching reserved filename characters", + "license": "MIT", + "repository": "sindresorhus/filename-reserved-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "re", + "regex", + "regexp", + "filename", + "reserved", + "illegal" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/filename-reserved-regex/readme.md b/node_modules/filename-reserved-regex/readme.md new file mode 100644 index 00000000..91641b5e --- /dev/null +++ b/node_modules/filename-reserved-regex/readme.md @@ -0,0 +1,49 @@ +# filename-reserved-regex [![Build Status](https://travis-ci.org/sindresorhus/filename-reserved-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/filename-reserved-regex) + +> Regular expression for matching reserved filename characters + +On Unix-like systems `/` is reserved and [`<>:"/\|?*`](http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29#naming_conventions) as well as non-printable characters `\x00-\x1F` on Windows. + + +## Install + +``` +$ npm install --save filename-reserved-regex +``` + + +## Usage + +```js +const filenameReservedRegex = require('filename-reserved-regex'); + +filenameReservedRegex().test('foo/bar'); +//=> true + +filenameReservedRegex().test('foo-bar'); +//=> false + +'foo/bar'.replace(filenameReservedRegex(), '!'); +//=> 'foo!bar' + +filenameReservedRegex.windowsNames().test('aux'); +//=> true +``` + +## API + +### filenameReservedRegex() + +Returns a regex that matches all invalid characters. + +### filenameReservedRegex.windowsNames() + +Returns a exact-match case-insensitive regex that matches invalid Windows +filenames. These include `CON`, `PRN`, `AUX`, `NUL`, `COM1`, `COM2`, `COM3`, `COM4`, `COM5`, +`COM6`, `COM7`, `COM8`, `COM9`, `LPT1`, `LPT2`, `LPT3`, `LPT4`, `LPT5`, `LPT6`, `LPT7`, `LPT8` +and `LPT9`. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/filenamify/filenamify-path.d.ts b/node_modules/filenamify/filenamify-path.d.ts new file mode 100644 index 00000000..23466028 --- /dev/null +++ b/node_modules/filenamify/filenamify-path.d.ts @@ -0,0 +1,8 @@ +import filenamify = require('./filenamify'); + +/** +Convert the filename in a path a valid filename and return the augmented path. +*/ +declare const filenamifyPath: (path: string, options?: filenamify.Options) => string; + +export = filenamifyPath; diff --git a/node_modules/filenamify/filenamify-path.js b/node_modules/filenamify/filenamify-path.js new file mode 100644 index 00000000..359c1193 --- /dev/null +++ b/node_modules/filenamify/filenamify-path.js @@ -0,0 +1,10 @@ +'use strict'; +const path = require('path'); +const filenamify = require('./filenamify'); + +const filenamifyPath = (filePath, options) => { + filePath = path.resolve(filePath); + return path.join(path.dirname(filePath), filenamify(path.basename(filePath), options)); +}; + +module.exports = filenamifyPath; diff --git a/node_modules/filenamify/filenamify.d.ts b/node_modules/filenamify/filenamify.d.ts new file mode 100644 index 00000000..cc17d11d --- /dev/null +++ b/node_modules/filenamify/filenamify.d.ts @@ -0,0 +1,39 @@ +declare namespace filenamify { + interface Options { + /** + String to use as replacement for reserved filename characters. + + Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*` + + @default '!' + */ + readonly replacement?: string; + + /** + Truncate the filename to the given length. + + Systems generally allow up to 255 characters, but we default to 100 for usability reasons. + + @default 100 + */ + readonly maxLength?: number; + } +} + +/** +Convert a string to a valid filename. + +@example +``` +import filenamify = require('filenamify'); + +filenamify(''); +//=> 'foo!bar' + +filenamify('foo:"bar"', {replacement: '🐴'}); +//=> 'foo🐴bar' +``` +*/ +declare const filenamify: (string: string, options?: filenamify.Options) => string; + +export = filenamify; diff --git a/node_modules/filenamify/filenamify.js b/node_modules/filenamify/filenamify.js new file mode 100644 index 00000000..a548430a --- /dev/null +++ b/node_modules/filenamify/filenamify.js @@ -0,0 +1,40 @@ +'use strict'; +const trimRepeated = require('trim-repeated'); +const filenameReservedRegex = require('filename-reserved-regex'); +const stripOuter = require('strip-outer'); + +// Doesn't make sense to have longer filenames +const MAX_FILENAME_LENGTH = 100; + +const reControlChars = /[\u0000-\u001f\u0080-\u009f]/g; // eslint-disable-line no-control-regex +const reRelativePath = /^\.+/; +const reTrailingPeriods = /\.+$/; + +const filenamify = (string, options = {}) => { + if (typeof string !== 'string') { + throw new TypeError('Expected a string'); + } + + const replacement = options.replacement === undefined ? '!' : options.replacement; + + if (filenameReservedRegex().test(replacement) && reControlChars.test(replacement)) { + throw new Error('Replacement string cannot contain reserved filename characters'); + } + + string = string.replace(filenameReservedRegex(), replacement); + string = string.replace(reControlChars, replacement); + string = string.replace(reRelativePath, replacement); + string = string.replace(reTrailingPeriods, ''); + + if (replacement.length > 0) { + string = trimRepeated(string, replacement); + string = string.length > 1 ? stripOuter(string, replacement) : string; + } + + string = filenameReservedRegex.windowsNames().test(string) ? string + replacement : string; + string = string.slice(0, typeof options.maxLength === 'number' ? options.maxLength : MAX_FILENAME_LENGTH); + + return string; +}; + +module.exports = filenamify; diff --git a/node_modules/filenamify/index.d.ts b/node_modules/filenamify/index.d.ts new file mode 100644 index 00000000..4aea46f2 --- /dev/null +++ b/node_modules/filenamify/index.d.ts @@ -0,0 +1,24 @@ +import filenamify = require('./filenamify'); +import filenamifyPath = require('./filenamify-path'); + +declare const filenamifyCombined: { + /** + Convert a string to a valid filename. + + @example + ``` + import filenamify = require('filenamify'); + + filenamify(''); + //=> 'foo!bar' + + filenamify('foo:"bar"', {replacement: '🐴'}); + //=> 'foo🐴bar' + ``` + */ + (string: string, options?: filenamify.Options): string; + + path: typeof filenamifyPath; +}; + +export = filenamifyCombined; diff --git a/node_modules/filenamify/index.js b/node_modules/filenamify/index.js new file mode 100644 index 00000000..260bbd1c --- /dev/null +++ b/node_modules/filenamify/index.js @@ -0,0 +1,8 @@ +'use strict'; +const filenamify = require('./filenamify'); +const filenamifyPath = require('./filenamify-path'); + +const filenamifyCombined = filenamify; +filenamifyCombined.path = filenamifyPath; + +module.exports = filenamify; diff --git a/node_modules/filenamify/license b/node_modules/filenamify/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/filenamify/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/filenamify/package.json b/node_modules/filenamify/package.json new file mode 100644 index 00000000..9b22083e --- /dev/null +++ b/node_modules/filenamify/package.json @@ -0,0 +1,54 @@ +{ + "name": "filenamify", + "version": "4.3.0", + "description": "Convert a string to a valid safe filename", + "license": "MIT", + "repository": "sindresorhus/filenamify", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "filenamify-path.d.ts", + "filenamify-path.js", + "filenamify.d.ts", + "filenamify.js", + "index.d.ts", + "index.js" + ], + "exports": { + ".": "./index.js", + "./browser": "./filenamify.js" + }, + "keywords": [ + "filename", + "safe", + "sanitize", + "file", + "name", + "string", + "path", + "filepath", + "convert", + "valid", + "dirname" + ], + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.1", + "trim-repeated": "^1.0.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" + } +} diff --git a/node_modules/filenamify/readme.md b/node_modules/filenamify/readme.md new file mode 100644 index 00000000..3b0d747b --- /dev/null +++ b/node_modules/filenamify/readme.md @@ -0,0 +1,74 @@ +# filenamify + +> Convert a string to a valid safe filename + +On Unix-like systems, `/` is reserved. On Windows, [`<>:"/\|?*`](http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29#naming_conventions) along with trailing periods are reserved. + +## Install + +``` +$ npm install filenamify +``` + +## Usage + +```js +const filenamify = require('filenamify'); + +filenamify(''); +//=> 'foo!bar' + +filenamify('foo:"bar"', {replacement: '🐴'}); +//=> 'foo🐴bar' +``` + +## API + +### filenamify(string, options?) + +Convert a string to a valid filename. + +### filenamify.path(path, options?) + +Convert the filename in a path a valid filename and return the augmented path. + +#### options + +Type: `object` + +##### replacement + +Type: `string`\ +Default: `'!'` + +String to use as replacement for reserved filename characters. + +Cannot contain: `<` `>` `:` `"` `/` `\` `|` `?` `*` + +##### maxLength + +Type: `number`\ +Default: `100` + +Truncate the filename to the given length. + +Systems generally allow up to 255 characters, but we default to 100 for usability reasons. + +## Browser-only import + +You can also import `filenamify/browser`, which only imports `filenamify` and not `filenamify.path`, which relies on `path` being available or polyfilled. Importing `filenamify` this way is therefore useful when it is shipped using `webpack` or similar tools, and if `filenamify.path` is not needed. + +```js +const filenamify = require('filenamify/browser'); + +filenamify(''); +//=> 'foo!bar' +``` + +## Related + +- [filenamify-cli](https://github.com/sindresorhus/filenamify-cli) - CLI for this module +- [filenamify-url](https://github.com/sindresorhus/filenamify-url) - Convert a URL to a valid filename +- [valid-filename](https://github.com/sindresorhus/valid-filename) - Check if a string is a valid filename +- [unused-filename](https://github.com/sindresorhus/unused-filename) - Get a unused filename by appending a number if it exists +- [slugify](https://github.com/sindresorhus/slugify) - Slugify a string diff --git a/node_modules/fill-range/LICENSE b/node_modules/fill-range/LICENSE new file mode 100644 index 00000000..9af4a67d --- /dev/null +++ b/node_modules/fill-range/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-present, Jon Schlinkert. + +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/fill-range/README.md b/node_modules/fill-range/README.md new file mode 100644 index 00000000..8d756fe9 --- /dev/null +++ b/node_modules/fill-range/README.md @@ -0,0 +1,237 @@ +# fill-range [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/fill-range.svg?style=flat)](https://www.npmjs.com/package/fill-range) [![NPM monthly downloads](https://img.shields.io/npm/dm/fill-range.svg?style=flat)](https://npmjs.org/package/fill-range) [![NPM total downloads](https://img.shields.io/npm/dt/fill-range.svg?style=flat)](https://npmjs.org/package/fill-range) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/fill-range.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/fill-range) + +> Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex` + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save fill-range +``` + +## Usage + +Expands numbers and letters, optionally using a `step` as the last argument. _(Numbers may be defined as JavaScript numbers or strings)_. + +```js +const fill = require('fill-range'); +// fill(from, to[, step, options]); + +console.log(fill('1', '10')); //=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] +console.log(fill('1', '10', { toRegex: true })); //=> [1-9]|10 +``` + +**Params** + +* `from`: **{String|Number}** the number or letter to start with +* `to`: **{String|Number}** the number or letter to end with +* `step`: **{String|Number|Object|Function}** Optionally pass a [step](#optionsstep) to use. +* `options`: **{Object|Function}**: See all available [options](#options) + +## Examples + +By default, an array of values is returned. + +**Alphabetical ranges** + +```js +console.log(fill('a', 'e')); //=> ['a', 'b', 'c', 'd', 'e'] +console.log(fill('A', 'E')); //=> [ 'A', 'B', 'C', 'D', 'E' ] +``` + +**Numerical ranges** + +Numbers can be defined as actual numbers or strings. + +```js +console.log(fill(1, 5)); //=> [ 1, 2, 3, 4, 5 ] +console.log(fill('1', '5')); //=> [ 1, 2, 3, 4, 5 ] +``` + +**Negative ranges** + +Numbers can be defined as actual numbers or strings. + +```js +console.log(fill('-5', '-1')); //=> [ '-5', '-4', '-3', '-2', '-1' ] +console.log(fill('-5', '5')); //=> [ '-5', '-4', '-3', '-2', '-1', '0', '1', '2', '3', '4', '5' ] +``` + +**Steps (increments)** + +```js +// numerical ranges with increments +console.log(fill('0', '25', 4)); //=> [ '0', '4', '8', '12', '16', '20', '24' ] +console.log(fill('0', '25', 5)); //=> [ '0', '5', '10', '15', '20', '25' ] +console.log(fill('0', '25', 6)); //=> [ '0', '6', '12', '18', '24' ] + +// alphabetical ranges with increments +console.log(fill('a', 'z', 4)); //=> [ 'a', 'e', 'i', 'm', 'q', 'u', 'y' ] +console.log(fill('a', 'z', 5)); //=> [ 'a', 'f', 'k', 'p', 'u', 'z' ] +console.log(fill('a', 'z', 6)); //=> [ 'a', 'g', 'm', 's', 'y' ] +``` + +## Options + +### options.step + +**Type**: `number` (formatted as a string or number) + +**Default**: `undefined` + +**Description**: The increment to use for the range. Can be used with letters or numbers. + +**Example(s)** + +```js +// numbers +console.log(fill('1', '10', 2)); //=> [ '1', '3', '5', '7', '9' ] +console.log(fill('1', '10', 3)); //=> [ '1', '4', '7', '10' ] +console.log(fill('1', '10', 4)); //=> [ '1', '5', '9' ] + +// letters +console.log(fill('a', 'z', 5)); //=> [ 'a', 'f', 'k', 'p', 'u', 'z' ] +console.log(fill('a', 'z', 7)); //=> [ 'a', 'h', 'o', 'v' ] +console.log(fill('a', 'z', 9)); //=> [ 'a', 'j', 's' ] +``` + +### options.strictRanges + +**Type**: `boolean` + +**Default**: `false` + +**Description**: By default, `null` is returned when an invalid range is passed. Enable this option to throw a `RangeError` on invalid ranges. + +**Example(s)** + +The following are all invalid: + +```js +fill('1.1', '2'); // decimals not supported in ranges +fill('a', '2'); // incompatible range values +fill(1, 10, 'foo'); // invalid "step" argument +``` + +### options.stringify + +**Type**: `boolean` + +**Default**: `undefined` + +**Description**: Cast all returned values to strings. By default, integers are returned as numbers. + +**Example(s)** + +```js +console.log(fill(1, 5)); //=> [ 1, 2, 3, 4, 5 ] +console.log(fill(1, 5, { stringify: true })); //=> [ '1', '2', '3', '4', '5' ] +``` + +### options.toRegex + +**Type**: `boolean` + +**Default**: `undefined` + +**Description**: Create a regex-compatible source string, instead of expanding values to an array. + +**Example(s)** + +```js +// alphabetical range +console.log(fill('a', 'e', { toRegex: true })); //=> '[a-e]' +// alphabetical with step +console.log(fill('a', 'z', 3, { toRegex: true })); //=> 'a|d|g|j|m|p|s|v|y' +// numerical range +console.log(fill('1', '100', { toRegex: true })); //=> '[1-9]|[1-9][0-9]|100' +// numerical range with zero padding +console.log(fill('000001', '100000', { toRegex: true })); +//=> '0{5}[1-9]|0{4}[1-9][0-9]|0{3}[1-9][0-9]{2}|0{2}[1-9][0-9]{3}|0[1-9][0-9]{4}|100000' +``` + +### options.transform + +**Type**: `function` + +**Default**: `undefined` + +**Description**: Customize each value in the returned array (or [string](#optionstoRegex)). _(you can also pass this function as the last argument to `fill()`)_. + +**Example(s)** + +```js +// add zero padding +console.log(fill(1, 5, value => String(value).padStart(4, '0'))); +//=> ['0001', '0002', '0003', '0004', '0005'] +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 116 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [paulmillr](https://github.com/paulmillr) | +| 2 | [realityking](https://github.com/realityking) | +| 2 | [bluelovers](https://github.com/bluelovers) | +| 1 | [edorivai](https://github.com/edorivai) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +Please consider supporting me on Patreon, or [start your own Patreon page](https://patreon.com/invite/bxpbvm)! + + + + + +### License + +Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._ \ No newline at end of file diff --git a/node_modules/fill-range/index.js b/node_modules/fill-range/index.js new file mode 100644 index 00000000..ddb212ee --- /dev/null +++ b/node_modules/fill-range/index.js @@ -0,0 +1,248 @@ +/*! + * fill-range + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +const util = require('util'); +const toRegexRange = require('to-regex-range'); + +const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); + +const transform = toNumber => { + return value => toNumber === true ? Number(value) : String(value); +}; + +const isValidValue = value => { + return typeof value === 'number' || (typeof value === 'string' && value !== ''); +}; + +const isNumber = num => Number.isInteger(+num); + +const zeros = input => { + let value = `${input}`; + let index = -1; + if (value[0] === '-') value = value.slice(1); + if (value === '0') return false; + while (value[++index] === '0'); + return index > 0; +}; + +const stringify = (start, end, options) => { + if (typeof start === 'string' || typeof end === 'string') { + return true; + } + return options.stringify === true; +}; + +const pad = (input, maxLength, toNumber) => { + if (maxLength > 0) { + let dash = input[0] === '-' ? '-' : ''; + if (dash) input = input.slice(1); + input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0')); + } + if (toNumber === false) { + return String(input); + } + return input; +}; + +const toMaxLen = (input, maxLength) => { + let negative = input[0] === '-' ? '-' : ''; + if (negative) { + input = input.slice(1); + maxLength--; + } + while (input.length < maxLength) input = '0' + input; + return negative ? ('-' + input) : input; +}; + +const toSequence = (parts, options, maxLen) => { + parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + + let prefix = options.capture ? '' : '?:'; + let positives = ''; + let negatives = ''; + let result; + + if (parts.positives.length) { + positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|'); + } + + if (parts.negatives.length) { + negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`; + } + + if (positives && negatives) { + result = `${positives}|${negatives}`; + } else { + result = positives || negatives; + } + + if (options.wrap) { + return `(${prefix}${result})`; + } + + return result; +}; + +const toRange = (a, b, isNumbers, options) => { + if (isNumbers) { + return toRegexRange(a, b, { wrap: false, ...options }); + } + + let start = String.fromCharCode(a); + if (a === b) return start; + + let stop = String.fromCharCode(b); + return `[${start}-${stop}]`; +}; + +const toRegex = (start, end, options) => { + if (Array.isArray(start)) { + let wrap = options.wrap === true; + let prefix = options.capture ? '' : '?:'; + return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); + } + return toRegexRange(start, end, options); +}; + +const rangeError = (...args) => { + return new RangeError('Invalid range arguments: ' + util.inspect(...args)); +}; + +const invalidRange = (start, end, options) => { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; +}; + +const invalidStep = (step, options) => { + if (options.strictRanges === true) { + throw new TypeError(`Expected step "${step}" to be a number`); + } + return []; +}; + +const fillNumbers = (start, end, step = 1, options = {}) => { + let a = Number(start); + let b = Number(end); + + if (!Number.isInteger(a) || !Number.isInteger(b)) { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; + } + + // fix negative zero + if (a === 0) a = 0; + if (b === 0) b = 0; + + let descending = a > b; + let startString = String(start); + let endString = String(end); + let stepString = String(step); + step = Math.max(Math.abs(step), 1); + + let padded = zeros(startString) || zeros(endString) || zeros(stepString); + let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; + let toNumber = padded === false && stringify(start, end, options) === false; + let format = options.transform || transform(toNumber); + + if (options.toRegex && step === 1) { + return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); + } + + let parts = { negatives: [], positives: [] }; + let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + if (options.toRegex === true && step > 1) { + push(a); + } else { + range.push(pad(format(a, index), maxLen, toNumber)); + } + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return step > 1 + ? toSequence(parts, options, maxLen) + : toRegex(range, null, { wrap: false, ...options }); + } + + return range; +}; + +const fillLetters = (start, end, step = 1, options = {}) => { + if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) { + return invalidRange(start, end, options); + } + + let format = options.transform || (val => String.fromCharCode(val)); + let a = `${start}`.charCodeAt(0); + let b = `${end}`.charCodeAt(0); + + let descending = a > b; + let min = Math.min(a, b); + let max = Math.max(a, b); + + if (options.toRegex && step === 1) { + return toRange(min, max, false, options); + } + + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + range.push(format(a, index)); + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return toRegex(range, null, { wrap: false, options }); + } + + return range; +}; + +const fill = (start, end, step, options = {}) => { + if (end == null && isValidValue(start)) { + return [start]; + } + + if (!isValidValue(start) || !isValidValue(end)) { + return invalidRange(start, end, options); + } + + if (typeof step === 'function') { + return fill(start, end, 1, { transform: step }); + } + + if (isObject(step)) { + return fill(start, end, 0, step); + } + + let opts = { ...options }; + if (opts.capture === true) opts.wrap = true; + step = step || opts.step || 1; + + if (!isNumber(step)) { + if (step != null && !isObject(step)) return invalidStep(step, opts); + return fill(start, end, 1, step); + } + + if (isNumber(start) && isNumber(end)) { + return fillNumbers(start, end, step, opts); + } + + return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); +}; + +module.exports = fill; diff --git a/node_modules/fill-range/package.json b/node_modules/fill-range/package.json new file mode 100644 index 00000000..582357fb --- /dev/null +++ b/node_modules/fill-range/package.json @@ -0,0 +1,74 @@ +{ + "name": "fill-range", + "description": "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`", + "version": "7.1.1", + "homepage": "https://github.com/jonschlinkert/fill-range", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Edo Rivai (edo.rivai.nl)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Paul Miller (paulmillr.com)", + "Rouven Weßling (www.rouvenwessling.de)", + "(https://github.com/wtgtybhertgeghgtwtg)" + ], + "repository": "jonschlinkert/fill-range", + "bugs": { + "url": "https://github.com/jonschlinkert/fill-range/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=8" + }, + "scripts": { + "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", + "mocha": "mocha --reporter dot", + "test": "npm run lint && npm run mocha", + "test:ci": "npm run test:cover", + "test:cover": "nyc npm run mocha" + }, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "devDependencies": { + "gulp-format-md": "^2.0.0", + "mocha": "^6.1.1", + "nyc": "^15.1.0" + }, + "keywords": [ + "alpha", + "alphabetical", + "array", + "bash", + "brace", + "expand", + "expansion", + "fill", + "glob", + "match", + "matches", + "matching", + "number", + "numerical", + "range", + "ranges", + "regex", + "sh" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/node_modules/find-cache-dir/index.js b/node_modules/find-cache-dir/index.js new file mode 100644 index 00000000..47865908 --- /dev/null +++ b/node_modules/find-cache-dir/index.js @@ -0,0 +1,67 @@ +'use strict'; +const path = require('path'); +const fs = require('fs'); +const commonDir = require('commondir'); +const pkgDir = require('pkg-dir'); +const makeDir = require('make-dir'); + +const {env, cwd} = process; + +const isWritable = path => { + try { + fs.accessSync(path, fs.constants.W_OK); + return true; + } catch (_) { + return false; + } +}; + +function useDirectory(directory, options) { + if (options.create) { + makeDir.sync(directory); + } + + if (options.thunk) { + return (...arguments_) => path.join(directory, ...arguments_); + } + + return directory; +} + +function getNodeModuleDirectory(directory) { + const nodeModules = path.join(directory, 'node_modules'); + + if ( + !isWritable(nodeModules) && + (fs.existsSync(nodeModules) || !isWritable(path.join(directory))) + ) { + return; + } + + return nodeModules; +} + +module.exports = (options = {}) => { + if (env.CACHE_DIR && !['true', 'false', '1', '0'].includes(env.CACHE_DIR)) { + return useDirectory(path.join(env.CACHE_DIR, options.name), options); + } + + let {cwd: directory = cwd()} = options; + + if (options.files) { + directory = commonDir(directory, options.files); + } + + directory = pkgDir.sync(directory); + + if (!directory) { + return; + } + + const nodeModules = getNodeModuleDirectory(directory); + if (!nodeModules) { + return undefined; + } + + return useDirectory(path.join(directory, 'node_modules', '.cache', options.name), options); +}; diff --git a/node_modules/find-cache-dir/license b/node_modules/find-cache-dir/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/find-cache-dir/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/find-cache-dir/package.json b/node_modules/find-cache-dir/package.json new file mode 100644 index 00000000..4ca187a8 --- /dev/null +++ b/node_modules/find-cache-dir/package.json @@ -0,0 +1,44 @@ +{ + "name": "find-cache-dir", + "version": "3.3.2", + "description": "Finds the common standard cache directory", + "license": "MIT", + "repository": "avajs/find-cache-dir", + "funding": "https://github.com/avajs/find-cache-dir?sponsor=1", + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && nyc ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "cache", + "directory", + "dir", + "caching", + "find", + "search" + ], + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "devDependencies": { + "ava": "^2.4.0", + "coveralls": "^3.0.9", + "del": "^4.0.0", + "nyc": "^15.0.0", + "tempy": "^0.4.0", + "xo": "^0.25.3" + }, + "nyc": { + "reporter": [ + "lcov", + "text" + ] + } +} diff --git a/node_modules/find-cache-dir/readme.md b/node_modules/find-cache-dir/readme.md new file mode 100644 index 00000000..3bc03a81 --- /dev/null +++ b/node_modules/find-cache-dir/readme.md @@ -0,0 +1,123 @@ +# find-cache-dir [![Coverage Status](https://codecov.io/gh/avajs/find-cache-dir/branch/master/graph/badge.svg)](https://codecov.io/gh/avajs/find-cache-dir/branch/master) + +> Finds the common standard cache directory + +The [`nyc`](https://github.com/istanbuljs/nyc) and [`AVA`](https://ava.li) projects decided to standardize on a common directory structure for storing cache information: + +```sh +# nyc +./node_modules/.cache/nyc + +# ava +./node_modules/.cache/ava + +# your-module +./node_modules/.cache/your-module +``` + +This module makes it easy to correctly locate the cache directory according to this shared spec. If this pattern becomes ubiquitous, clearing the cache for multiple dependencies becomes easy and consistent: + +``` +rm -rf ./node_modules/.cache +``` + +If you decide to adopt this pattern, please file a PR adding your name to the list of adopters below. + +## Install + +``` +$ npm install find-cache-dir +``` + +## Usage + +```js +const findCacheDir = require('find-cache-dir'); + +findCacheDir({name: 'unicorns'}); +//=> '/user/path/node-modules/.cache/unicorns' +``` + +## API + +### findCacheDir(options?) + +Finds the cache directory using the supplied options. The algorithm checks for the `CACHE_DIR` environmental variable and uses it if it is not set to `true`, `false`, `1` or `0`. If one is not found, it tries to find a `package.json` file, searching every parent directory of the `cwd` specified (or implied from other options). It returns a `string` containing the absolute path to the cache directory, or `undefined` if `package.json` was never found or if the `node_modules` directory is unwritable. + +#### options + +Type: `object` + +##### name + +*Required*\ +Type: `string` + +Should be the same as your project name in `package.json`. + +##### files + +Type: `string[] | string` + +An array of files that will be searched for a common parent directory. This common parent directory will be used in lieu of the `cwd` option below. + +##### cwd + +Type: `string`\ +Default `process.cwd()` + +Directory to start searching for a `package.json` from. + +##### create + +Type: `boolean`\ +Default `false` + +If `true`, the directory will be created synchronously before returning. + +##### thunk + +Type: `boolean`\ +Default `false` + +If `true`, this modifies the return type to be a function that is a thunk for `path.join(theFoundCacheDirectory)`. + +```js +const thunk = findCacheDir({name: 'foo', thunk: true}); + +thunk(); +//=> '/some/path/node_modules/.cache/foo' + +thunk('bar.js') +//=> '/some/path/node_modules/.cache/foo/bar.js' + +thunk('baz', 'quz.js') +//=> '/some/path/node_modules/.cache/foo/baz/quz.js' +``` + +This is helpful for actually putting actual files in the cache! + +## Tips + +- To test modules using `find-cache-dir`, set the `CACHE_DIR` environment variable to temporarily override the directory that is resolved. + +## Adopters + +- [`ava`](https://avajs.dev) +- [`nyc`](https://github.com/istanbuljs/nyc) +- [`storybook`](https://github.com/storybookjs/storybook) +- [`babel-loader`](https://github.com/babel/babel-loader) +- [`eslint-loader`](https://github.com/MoOx/eslint-loader) +- [More…](https://www.npmjs.com/browse/depended/find-cache-dir) + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/find-up/index.d.ts b/node_modules/find-up/index.d.ts new file mode 100644 index 00000000..41e3192a --- /dev/null +++ b/node_modules/find-up/index.d.ts @@ -0,0 +1,137 @@ +import {Options as LocatePathOptions} from 'locate-path'; + +declare const stop: unique symbol; + +declare namespace findUp { + interface Options extends LocatePathOptions {} + + type StopSymbol = typeof stop; + + type Match = string | StopSymbol | undefined; +} + +declare const findUp: { + /** + Find a file or directory by walking up parent directories. + + @param name - Name of the file or directory to find. Can be multiple. + @returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found. + + @example + ``` + // / + // └── Users + // └── sindresorhus + // ├── unicorn.png + // └── foo + // └── bar + // ├── baz + // └── example.js + + // example.js + import findUp = require('find-up'); + + (async () => { + console.log(await findUp('unicorn.png')); + //=> '/Users/sindresorhus/unicorn.png' + + console.log(await findUp(['rainbow.png', 'unicorn.png'])); + //=> '/Users/sindresorhus/unicorn.png' + })(); + ``` + */ + (name: string | string[], options?: findUp.Options): Promise; + + /** + Find a file or directory by walking up parent directories. + + @param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search. + @returns The first path found or `undefined` if none could be found. + + @example + ``` + import path = require('path'); + import findUp = require('find-up'); + + (async () => { + console.log(await findUp(async directory => { + const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; + }, {type: 'directory'})); + //=> '/Users/sindresorhus' + })(); + ``` + */ + (matcher: (directory: string) => (findUp.Match | Promise), options?: findUp.Options): Promise; + + sync: { + /** + Synchronously find a file or directory by walking up parent directories. + + @param name - Name of the file or directory to find. Can be multiple. + @returns The first path found (by respecting the order of `name`s) or `undefined` if none could be found. + */ + (name: string | string[], options?: findUp.Options): string | undefined; + + /** + Synchronously find a file or directory by walking up parent directories. + + @param matcher - Called for each directory in the search. Return a path or `findUp.stop` to stop the search. + @returns The first path found or `undefined` if none could be found. + + @example + ``` + import path = require('path'); + import findUp = require('find-up'); + + console.log(findUp.sync(directory => { + const hasUnicorns = findUp.sync.exists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; + }, {type: 'directory'})); + //=> '/Users/sindresorhus' + ``` + */ + (matcher: (directory: string) => findUp.Match, options?: findUp.Options): string | undefined; + + /** + Synchronously check if a path exists. + + @param path - Path to the file or directory. + @returns Whether the path exists. + + @example + ``` + import findUp = require('find-up'); + + console.log(findUp.sync.exists('/Users/sindresorhus/unicorn.png')); + //=> true + ``` + */ + exists(path: string): boolean; + } + + /** + Check if a path exists. + + @param path - Path to a file or directory. + @returns Whether the path exists. + + @example + ``` + import findUp = require('find-up'); + + (async () => { + console.log(await findUp.exists('/Users/sindresorhus/unicorn.png')); + //=> true + })(); + ``` + */ + exists(path: string): Promise; + + /** + Return this in a `matcher` function to stop the search and force `findUp` to immediately return `undefined`. + */ + readonly stop: findUp.StopSymbol; +}; + +export = findUp; diff --git a/node_modules/find-up/index.js b/node_modules/find-up/index.js new file mode 100644 index 00000000..ce564e5d --- /dev/null +++ b/node_modules/find-up/index.js @@ -0,0 +1,89 @@ +'use strict'; +const path = require('path'); +const locatePath = require('locate-path'); +const pathExists = require('path-exists'); + +const stop = Symbol('findUp.stop'); + +module.exports = async (name, options = {}) => { + let directory = path.resolve(options.cwd || ''); + const {root} = path.parse(directory); + const paths = [].concat(name); + + const runMatcher = async locateOptions => { + if (typeof name !== 'function') { + return locatePath(paths, locateOptions); + } + + const foundPath = await name(locateOptions.cwd); + if (typeof foundPath === 'string') { + return locatePath([foundPath], locateOptions); + } + + return foundPath; + }; + + // eslint-disable-next-line no-constant-condition + while (true) { + // eslint-disable-next-line no-await-in-loop + const foundPath = await runMatcher({...options, cwd: directory}); + + if (foundPath === stop) { + return; + } + + if (foundPath) { + return path.resolve(directory, foundPath); + } + + if (directory === root) { + return; + } + + directory = path.dirname(directory); + } +}; + +module.exports.sync = (name, options = {}) => { + let directory = path.resolve(options.cwd || ''); + const {root} = path.parse(directory); + const paths = [].concat(name); + + const runMatcher = locateOptions => { + if (typeof name !== 'function') { + return locatePath.sync(paths, locateOptions); + } + + const foundPath = name(locateOptions.cwd); + if (typeof foundPath === 'string') { + return locatePath.sync([foundPath], locateOptions); + } + + return foundPath; + }; + + // eslint-disable-next-line no-constant-condition + while (true) { + const foundPath = runMatcher({...options, cwd: directory}); + + if (foundPath === stop) { + return; + } + + if (foundPath) { + return path.resolve(directory, foundPath); + } + + if (directory === root) { + return; + } + + directory = path.dirname(directory); + } +}; + +module.exports.exists = pathExists; + +module.exports.sync.exists = pathExists.sync; + +module.exports.stop = stop; diff --git a/node_modules/find-up/license b/node_modules/find-up/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/find-up/license @@ -0,0 +1,9 @@ +MIT License + +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/find-up/package.json b/node_modules/find-up/package.json new file mode 100644 index 00000000..cd50281e --- /dev/null +++ b/node_modules/find-up/package.json @@ -0,0 +1,53 @@ +{ + "name": "find-up", + "version": "4.1.0", + "description": "Find a file or directory by walking up parent directories", + "license": "MIT", + "repository": "sindresorhus/find-up", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "package", + "resolve", + "parent", + "parents", + "folder", + "directory", + "walk", + "walking", + "path" + ], + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "devDependencies": { + "ava": "^2.1.0", + "is-path-inside": "^2.1.0", + "tempy": "^0.3.0", + "tsd": "^0.7.3", + "xo": "^0.24.0" + } +} diff --git a/node_modules/find-up/readme.md b/node_modules/find-up/readme.md new file mode 100644 index 00000000..d6a21e52 --- /dev/null +++ b/node_modules/find-up/readme.md @@ -0,0 +1,156 @@ +# find-up [![Build Status](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) + +> Find a file or directory by walking up parent directories + + +## Install + +``` +$ npm install find-up +``` + + +## Usage + +``` +/ +└── Users + └── sindresorhus + ├── unicorn.png + └── foo + └── bar + ├── baz + └── example.js +``` + +`example.js` + +```js +const path = require('path'); +const findUp = require('find-up'); + +(async () => { + console.log(await findUp('unicorn.png')); + //=> '/Users/sindresorhus/unicorn.png' + + console.log(await findUp(['rainbow.png', 'unicorn.png'])); + //=> '/Users/sindresorhus/unicorn.png' + + console.log(await findUp(async directory => { + const hasUnicorns = await findUp.exists(path.join(directory, 'unicorn.png')); + return hasUnicorns && directory; + }, {type: 'directory'})); + //=> '/Users/sindresorhus' +})(); +``` + + +## API + +### findUp(name, options?) +### findUp(matcher, options?) + +Returns a `Promise` for either the path or `undefined` if it couldn't be found. + +### findUp([...name], options?) + +Returns a `Promise` for either the first path found (by respecting the order of the array) or `undefined` if none could be found. + +### findUp.sync(name, options?) +### findUp.sync(matcher, options?) + +Returns a path or `undefined` if it couldn't be found. + +### findUp.sync([...name], options?) + +Returns the first path found (by respecting the order of the array) or `undefined` if none could be found. + +#### name + +Type: `string` + +Name of the file or directory to find. + +#### matcher + +Type: `Function` + +A function that will be called with each directory until it returns a `string` with the path, which stops the search, or the root directory has been reached and nothing was found. Useful if you want to match files with certain patterns, set of permissions, or other advanced use-cases. + +When using async mode, the `matcher` may optionally be an async or promise-returning function that returns the path. + +#### options + +Type: `object` + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Directory to start from. + +##### type + +Type: `string`
+Default: `'file'`
+Values: `'file'` `'directory'` + +The type of paths that can match. + +##### allowSymlinks + +Type: `boolean`
+Default: `true` + +Allow symbolic links to match if they point to the chosen path type. + +### findUp.exists(path) + +Returns a `Promise` of whether the path exists. + +### findUp.sync.exists(path) + +Returns a `boolean` of whether the path exists. + +#### path + +Type: `string` + +Path to a file or directory. + +### findUp.stop + +A [`Symbol`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that can be returned by a `matcher` function to stop the search and cause `findUp` to immediately return `undefined`. Useful as a performance optimization in case the current working directory is deeply nested in the filesystem. + +```js +const path = require('path'); +const findUp = require('find-up'); + +(async () => { + await findUp(directory => { + return path.basename(directory) === 'work' ? findUp.stop : 'logo.png'; + }); +})(); +``` + + +## Related + +- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package +- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path + + +--- + +
+ + Get professional support for 'find-up' with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/fs.realpath/LICENSE b/node_modules/fs.realpath/LICENSE new file mode 100644 index 00000000..5bd884c2 --- /dev/null +++ b/node_modules/fs.realpath/LICENSE @@ -0,0 +1,43 @@ +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/README.md b/node_modules/fs.realpath/README.md new file mode 100644 index 00000000..a42ceac6 --- /dev/null +++ b/node_modules/fs.realpath/README.md @@ -0,0 +1,33 @@ +# fs.realpath + +A backwards-compatible fs.realpath for Node v6 and above + +In Node v6, the JavaScript implementation of fs.realpath was replaced +with a faster (but less resilient) native implementation. That raises +new and platform-specific errors and cannot handle long or excessively +symlink-looping paths. + +This module handles those cases by detecting the new errors and +falling back to the JavaScript implementation. On versions of Node +prior to v6, it has no effect. + +## USAGE + +```js +var rp = require('fs.realpath') + +// async version +rp.realpath(someLongAndLoopingPath, function (er, real) { + // the ELOOP was handled, but it was a bit slower +}) + +// sync version +var real = rp.realpathSync(someLongAndLoopingPath) + +// monkeypatch at your own risk! +// This replaces the fs.realpath/fs.realpathSync builtins +rp.monkeypatch() + +// un-do the monkeypatching +rp.unmonkeypatch() +``` diff --git a/node_modules/fs.realpath/index.js b/node_modules/fs.realpath/index.js new file mode 100644 index 00000000..b09c7c7e --- /dev/null +++ b/node_modules/fs.realpath/index.js @@ -0,0 +1,66 @@ +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 new file mode 100644 index 00000000..b40305e7 --- /dev/null +++ b/node_modules/fs.realpath/old.js @@ -0,0 +1,303 @@ +// 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 new file mode 100644 index 00000000..3edc57d2 --- /dev/null +++ b/node_modules/fs.realpath/package.json @@ -0,0 +1,26 @@ +{ + "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/function-bind/.eslintrc b/node_modules/function-bind/.eslintrc new file mode 100644 index 00000000..71a054fd --- /dev/null +++ b/node_modules/function-bind/.eslintrc @@ -0,0 +1,21 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "indent": [2, 4], + "no-new-func": [1], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": 0, + "strict": [0] + }, + }, + ], +} diff --git a/node_modules/function-bind/.github/FUNDING.yml b/node_modules/function-bind/.github/FUNDING.yml new file mode 100644 index 00000000..74482195 --- /dev/null +++ b/node_modules/function-bind/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/function-bind +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/function-bind/.github/SECURITY.md b/node_modules/function-bind/.github/SECURITY.md new file mode 100644 index 00000000..82e4285a --- /dev/null +++ b/node_modules/function-bind/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. diff --git a/node_modules/function-bind/.nycrc b/node_modules/function-bind/.nycrc new file mode 100644 index 00000000..1826526e --- /dev/null +++ b/node_modules/function-bind/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/function-bind/CHANGELOG.md b/node_modules/function-bind/CHANGELOG.md new file mode 100644 index 00000000..f9e6cc07 --- /dev/null +++ b/node_modules/function-bind/CHANGELOG.md @@ -0,0 +1,136 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.2](https://github.com/ljharb/function-bind/compare/v1.1.1...v1.1.2) - 2023-10-12 + +### Merged + +- Point to the correct file [`#16`](https://github.com/ljharb/function-bind/pull/16) + +### Commits + +- [Tests] migrate tests to Github Actions [`4f8b57c`](https://github.com/ljharb/function-bind/commit/4f8b57c02f2011fe9ae353d5e74e8745f0988af8) +- [Tests] remove `jscs` [`90eb2ed`](https://github.com/ljharb/function-bind/commit/90eb2edbeefd5b76cd6c3a482ea3454db169b31f) +- [meta] update `.gitignore` [`53fcdc3`](https://github.com/ljharb/function-bind/commit/53fcdc371cd66634d6e9b71c836a50f437e89fed) +- [Tests] up to `node` `v11.10`, `v10.15`, `v9.11`, `v8.15`, `v6.16`, `v4.9`; use `nvm install-latest-npm`; run audit script in tests [`1fe8f6e`](https://github.com/ljharb/function-bind/commit/1fe8f6e9aed0dfa8d8b3cdbd00c7f5ea0cd2b36e) +- [meta] add `auto-changelog` [`1921fcb`](https://github.com/ljharb/function-bind/commit/1921fcb5b416b63ffc4acad051b6aad5722f777d) +- [Robustness] remove runtime dependency on all builtins except `.apply` [`f743e61`](https://github.com/ljharb/function-bind/commit/f743e61aa6bb2360358c04d4884c9db853d118b7) +- Docs: enable badges; update wording [`503cb12`](https://github.com/ljharb/function-bind/commit/503cb12d998b5f91822776c73332c7adcd6355dd) +- [readme] update badges [`290c5db`](https://github.com/ljharb/function-bind/commit/290c5dbbbda7264efaeb886552a374b869a4bb48) +- [Tests] switch to nyc for coverage [`ea360ba`](https://github.com/ljharb/function-bind/commit/ea360ba907fc2601ed18d01a3827fa2d3533cdf8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`cae5e9e`](https://github.com/ljharb/function-bind/commit/cae5e9e07a5578dc6df26c03ee22851ce05b943c) +- [meta] add `funding` field; create FUNDING.yml [`c9f4274`](https://github.com/ljharb/function-bind/commit/c9f4274aa80ea3aae9657a3938fdba41a3b04ca6) +- [Tests] fix eslint errors from #15 [`f69aaa2`](https://github.com/ljharb/function-bind/commit/f69aaa2beb2fdab4415bfb885760a699d0b9c964) +- [actions] fix permissions [`99a0cd9`](https://github.com/ljharb/function-bind/commit/99a0cd9f3b5bac223a0d572f081834cd73314be7) +- [meta] use `npmignore` to autogenerate an npmignore file [`f03b524`](https://github.com/ljharb/function-bind/commit/f03b524ca91f75a109a5d062f029122c86ecd1ae) +- [Dev Deps] update `@ljharb/eslint‑config`, `eslint`, `tape` [`7af9300`](https://github.com/ljharb/function-bind/commit/7af930023ae2ce7645489532821e4fbbcd7a2280) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`64a9127`](https://github.com/ljharb/function-bind/commit/64a9127ab0bd331b93d6572eaf6e9971967fc08c) +- [Tests] use `aud` instead of `npm audit` [`e75069c`](https://github.com/ljharb/function-bind/commit/e75069c50010a8fcce2a9ce2324934c35fdb4386) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`d03555c`](https://github.com/ljharb/function-bind/commit/d03555ca59dea3b71ce710045e4303b9e2619e28) +- [meta] add `safe-publish-latest` [`9c8f809`](https://github.com/ljharb/function-bind/commit/9c8f8092aed027d7e80c94f517aa892385b64f09) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`baf6893`](https://github.com/ljharb/function-bind/commit/baf6893e27f5b59abe88bc1995e6f6ed1e527397) +- [meta] create SECURITY.md [`4db1779`](https://github.com/ljharb/function-bind/commit/4db17799f1f28ae294cb95e0081ca2b591c3911b) +- [Tests] add `npm run audit` [`c8b38ec`](https://github.com/ljharb/function-bind/commit/c8b38ec40ed3f85dabdee40ed4148f1748375bc2) +- Revert "Point to the correct file" [`05cdf0f`](https://github.com/ljharb/function-bind/commit/05cdf0fa205c6a3c5ba40bbedd1dfa9874f915c9) + +## [v1.1.1](https://github.com/ljharb/function-bind/compare/v1.1.0...v1.1.1) - 2017-08-28 + +### Commits + +- [Tests] up to `node` `v8`; newer npm breaks on older node; fix scripts [`817f7d2`](https://github.com/ljharb/function-bind/commit/817f7d28470fdbff8ef608d4d565dd4d1430bc5e) +- [Dev Deps] update `eslint`, `jscs`, `tape`, `@ljharb/eslint-config` [`854288b`](https://github.com/ljharb/function-bind/commit/854288b1b6f5c555f89aceb9eff1152510262084) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`83e639f`](https://github.com/ljharb/function-bind/commit/83e639ff74e6cd6921285bccec22c1bcf72311bd) +- Only apps should have lockfiles [`5ed97f5`](https://github.com/ljharb/function-bind/commit/5ed97f51235c17774e0832e122abda0f3229c908) +- Use a SPDX-compliant “license” field. [`5feefea`](https://github.com/ljharb/function-bind/commit/5feefea0dc0193993e83e5df01ded424403a5381) + +## [v1.1.0](https://github.com/ljharb/function-bind/compare/v1.0.2...v1.1.0) - 2016-02-14 + +### Commits + +- Update `eslint`, `tape`; use my personal shared `eslint` config [`9c9062a`](https://github.com/ljharb/function-bind/commit/9c9062abbe9dd70b59ea2c3a3c3a81f29b457097) +- Add `npm run eslint` [`dd96c56`](https://github.com/ljharb/function-bind/commit/dd96c56720034a3c1ffee10b8a59a6f7c53e24ad) +- [New] return the native `bind` when available. [`82186e0`](https://github.com/ljharb/function-bind/commit/82186e03d73e580f95ff167e03f3582bed90ed72) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`a3dd767`](https://github.com/ljharb/function-bind/commit/a3dd76720c795cb7f4586b0544efabf8aa107b8b) +- Update `eslint` [`3dae2f7`](https://github.com/ljharb/function-bind/commit/3dae2f7423de30a2d20313ddb1edc19660142fe9) +- Update `tape`, `covert`, `jscs` [`a181eee`](https://github.com/ljharb/function-bind/commit/a181eee0cfa24eb229c6e843a971f36e060a2f6a) +- [Tests] up to `node` `v5.6`, `v4.3` [`964929a`](https://github.com/ljharb/function-bind/commit/964929a6a4ddb36fb128de2bcc20af5e4f22e1ed) +- Test up to `io.js` `v2.1` [`2be7310`](https://github.com/ljharb/function-bind/commit/2be7310f2f74886a7124ca925be411117d41d5ea) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`45f3d68`](https://github.com/ljharb/function-bind/commit/45f3d6865c6ca93726abcef54febe009087af101) +- [Dev Deps] update `tape`, `jscs` [`6e1340d`](https://github.com/ljharb/function-bind/commit/6e1340d94642deaecad3e717825db641af4f8b1f) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`d9bad2b`](https://github.com/ljharb/function-bind/commit/d9bad2b778b1b3a6dd2876087b88b3acf319f8cc) +- Update `eslint` [`935590c`](https://github.com/ljharb/function-bind/commit/935590caa024ab356102e4858e8fc315b2ccc446) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`8c9a1ef`](https://github.com/ljharb/function-bind/commit/8c9a1efd848e5167887aa8501857a0940a480c57) +- Test on `io.js` `v2.2` [`9a3a38c`](https://github.com/ljharb/function-bind/commit/9a3a38c92013aed6e108666e7bd40969b84ac86e) +- Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`69afc26`](https://github.com/ljharb/function-bind/commit/69afc2617405b147dd2a8d8ae73ca9e9283f18b4) +- [Dev Deps] Update `tape`, `eslint` [`36c1be0`](https://github.com/ljharb/function-bind/commit/36c1be0ab12b45fe5df6b0fdb01a5d5137fd0115) +- Update `tape`, `jscs` [`98d8303`](https://github.com/ljharb/function-bind/commit/98d8303cd5ca1c6b8f985469f86b0d44d7d45f6e) +- Update `jscs` [`9633a4e`](https://github.com/ljharb/function-bind/commit/9633a4e9fbf82051c240855166e468ba8ba0846f) +- Update `tape`, `jscs` [`c80ef0f`](https://github.com/ljharb/function-bind/commit/c80ef0f46efc9791e76fa50de4414092ac147831) +- Test up to `io.js` `v3.0` [`7e2c853`](https://github.com/ljharb/function-bind/commit/7e2c8537d52ab9cf5a655755561d8917684c0df4) +- Test on `io.js` `v2.4` [`5a199a2`](https://github.com/ljharb/function-bind/commit/5a199a27ba46795ba5eaf0845d07d4b8232895c9) +- Test on `io.js` `v2.3` [`a511b88`](https://github.com/ljharb/function-bind/commit/a511b8896de0bddf3b56862daa416c701f4d0453) +- Fixing a typo from 822b4e1938db02dc9584aa434fd3a45cb20caf43 [`732d6b6`](https://github.com/ljharb/function-bind/commit/732d6b63a9b33b45230e630dbcac7a10855d3266) +- Update `jscs` [`da52a48`](https://github.com/ljharb/function-bind/commit/da52a4886c06d6490f46ae30b15e4163ba08905d) +- Lock covert to v1.0.0. [`d6150fd`](https://github.com/ljharb/function-bind/commit/d6150fda1e6f486718ebdeff823333d9e48e7430) + +## [v1.0.2](https://github.com/ljharb/function-bind/compare/v1.0.1...v1.0.2) - 2014-10-04 + +## [v1.0.1](https://github.com/ljharb/function-bind/compare/v1.0.0...v1.0.1) - 2014-10-03 + +### Merged + +- make CI build faster [`#3`](https://github.com/ljharb/function-bind/pull/3) + +### Commits + +- Using my standard jscs.json [`d8ee94c`](https://github.com/ljharb/function-bind/commit/d8ee94c993eff0a84cf5744fe6a29627f5cffa1a) +- Adding `npm run lint` [`7571ab7`](https://github.com/ljharb/function-bind/commit/7571ab7dfdbd99b25a1dbb2d232622bd6f4f9c10) +- Using consistent indentation [`e91a1b1`](https://github.com/ljharb/function-bind/commit/e91a1b13a61e99ec1e530e299b55508f74218a95) +- Updating jscs [`7e17892`](https://github.com/ljharb/function-bind/commit/7e1789284bc629bc9c1547a61c9b227bbd8c7a65) +- Using consistent quotes [`c50b57f`](https://github.com/ljharb/function-bind/commit/c50b57fcd1c5ec38320979c837006069ebe02b77) +- Adding keywords [`cb94631`](https://github.com/ljharb/function-bind/commit/cb946314eed35f21186a25fb42fc118772f9ee00) +- Directly export a function expression instead of using a declaration, and relying on hoisting. [`5a33c5f`](https://github.com/ljharb/function-bind/commit/5a33c5f45642de180e0d207110bf7d1843ceb87c) +- Naming npm URL and badge in README; use SVG [`2aef8fc`](https://github.com/ljharb/function-bind/commit/2aef8fcb79d54e63a58ae557c4e60949e05d5e16) +- Naming deps URLs in README [`04228d7`](https://github.com/ljharb/function-bind/commit/04228d766670ee45ca24e98345c1f6a7621065b5) +- Naming travis-ci URLs in README; using SVG [`62c810c`](https://github.com/ljharb/function-bind/commit/62c810c2f54ced956cd4d4ab7b793055addfe36e) +- Make sure functions are invoked correctly (also passing coverage tests) [`2b289b4`](https://github.com/ljharb/function-bind/commit/2b289b4dfbf037ffcfa4dc95eb540f6165e9e43a) +- Removing the strict mode pragmas; they make tests fail. [`1aa701d`](https://github.com/ljharb/function-bind/commit/1aa701d199ddc3782476e8f7eef82679be97b845) +- Adding myself as a contributor [`85fd57b`](https://github.com/ljharb/function-bind/commit/85fd57b0860e5a7af42de9a287f3f265fc6d72fc) +- Adding strict mode pragmas [`915b08e`](https://github.com/ljharb/function-bind/commit/915b08e084c86a722eafe7245e21db74aa21ca4c) +- Adding devDeps URLs to README [`4ccc731`](https://github.com/ljharb/function-bind/commit/4ccc73112c1769859e4ca3076caf4086b3cba2cd) +- Fixing the description. [`a7a472c`](https://github.com/ljharb/function-bind/commit/a7a472cf649af515c635cf560fc478fbe48999c8) +- Using a function expression instead of a function declaration. [`b5d3e4e`](https://github.com/ljharb/function-bind/commit/b5d3e4ea6aaffc63888953eeb1fbc7ff45f1fa14) +- Updating tape [`f086be6`](https://github.com/ljharb/function-bind/commit/f086be6029fb56dde61a258c1340600fa174d1e0) +- Updating jscs [`5f9bdb3`](https://github.com/ljharb/function-bind/commit/5f9bdb375ab13ba48f30852aab94029520c54d71) +- Updating jscs [`9b409ba`](https://github.com/ljharb/function-bind/commit/9b409ba6118e23395a4e5d83ef39152aab9d3bfc) +- Run coverage as part of tests. [`8e1b6d4`](https://github.com/ljharb/function-bind/commit/8e1b6d459f047d1bd4fee814e01247c984c80bd0) +- Run linter as part of tests [`c1ca83f`](https://github.com/ljharb/function-bind/commit/c1ca83f832df94587d09e621beba682fabfaa987) +- Updating covert [`701e837`](https://github.com/ljharb/function-bind/commit/701e83774b57b4d3ef631e1948143f43a72f4bb9) + +## [v1.0.0](https://github.com/ljharb/function-bind/compare/v0.2.0...v1.0.0) - 2014-08-09 + +### Commits + +- Make sure old and unstable nodes don't fail Travis [`27adca3`](https://github.com/ljharb/function-bind/commit/27adca34a4ab6ad67b6dfde43942a1b103ce4d75) +- Fixing an issue when the bound function is called as a constructor in ES3. [`e20122d`](https://github.com/ljharb/function-bind/commit/e20122d267d92ce553859b280cbbea5d27c07731) +- Adding `npm run coverage` [`a2e29c4`](https://github.com/ljharb/function-bind/commit/a2e29c4ecaef9e2f6cd1603e868c139073375502) +- Updating tape [`b741168`](https://github.com/ljharb/function-bind/commit/b741168b12b235b1717ff696087645526b69213c) +- Upgrading tape [`63631a0`](https://github.com/ljharb/function-bind/commit/63631a04c7fbe97cc2fa61829cc27246d6986f74) +- Updating tape [`363cb46`](https://github.com/ljharb/function-bind/commit/363cb46dafb23cb3e347729a22f9448051d78464) + +## v0.2.0 - 2014-03-23 + +### Commits + +- Updating test coverage to match es5-shim. [`aa94d44`](https://github.com/ljharb/function-bind/commit/aa94d44b8f9d7f69f10e060db7709aa7a694e5d4) +- initial [`942ee07`](https://github.com/ljharb/function-bind/commit/942ee07e94e542d91798137bc4b80b926137e066) +- Setting the bound function's length properly. [`079f46a`](https://github.com/ljharb/function-bind/commit/079f46a2d3515b7c0b308c2c13fceb641f97ca25) +- Ensuring that some older browsers will throw when given a regex. [`36ac55b`](https://github.com/ljharb/function-bind/commit/36ac55b87f460d4330253c92870aa26fbfe8227f) +- Removing npm scripts that don't have dependencies [`9d2be60`](https://github.com/ljharb/function-bind/commit/9d2be600002cb8bc8606f8f3585ad3e05868c750) +- Updating tape [`297a4ac`](https://github.com/ljharb/function-bind/commit/297a4acc5464db381940aafb194d1c88f4e678f3) +- Skipping length tests for now. [`d9891ea`](https://github.com/ljharb/function-bind/commit/d9891ea4d2aaffa69f408339cdd61ff740f70565) +- don't take my tea [`dccd930`](https://github.com/ljharb/function-bind/commit/dccd930bfd60ea10cb178d28c97550c3bc8c1e07) diff --git a/node_modules/function-bind/LICENSE b/node_modules/function-bind/LICENSE new file mode 100644 index 00000000..62d6d237 --- /dev/null +++ b/node_modules/function-bind/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013 Raynos. + +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/function-bind/README.md b/node_modules/function-bind/README.md new file mode 100644 index 00000000..814c20b5 --- /dev/null +++ b/node_modules/function-bind/README.md @@ -0,0 +1,46 @@ +# function-bind [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] + +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Implementation of function.prototype.bind + +Old versions of phantomjs, Internet Explorer < 9, and node < 0.6 don't support `Function.prototype.bind`. + +## Example + +```js +Function.prototype.bind = require("function-bind") +``` + +## Installation + +`npm install function-bind` + +## Contributors + + - Raynos + +## MIT Licenced + +[package-url]: https://npmjs.org/package/function-bind +[npm-version-svg]: https://versionbadg.es/Raynos/function-bind.svg +[deps-svg]: https://david-dm.org/Raynos/function-bind.svg +[deps-url]: https://david-dm.org/Raynos/function-bind +[dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg +[dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/function-bind.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/function-bind.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/function-bind.svg +[downloads-url]: https://npm-stat.com/charts.html?package=function-bind +[codecov-image]: https://codecov.io/gh/Raynos/function-bind/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/Raynos/function-bind/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/Raynos/function-bind +[actions-url]: https://github.com/Raynos/function-bind/actions diff --git a/node_modules/function-bind/implementation.js b/node_modules/function-bind/implementation.js new file mode 100644 index 00000000..fd4384cc --- /dev/null +++ b/node_modules/function-bind/implementation.js @@ -0,0 +1,84 @@ +'use strict'; + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var toStr = Object.prototype.toString; +var max = Math.max; +var funcType = '[object Function]'; + +var concatty = function concatty(a, b) { + var arr = []; + + for (var i = 0; i < a.length; i += 1) { + arr[i] = a[i]; + } + for (var j = 0; j < b.length; j += 1) { + arr[j + a.length] = b[j]; + } + + return arr; +}; + +var slicy = function slicy(arrLike, offset) { + var arr = []; + for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { + arr[j] = arrLike[i]; + } + return arr; +}; + +var joiny = function (arr, joiner) { + var str = ''; + for (var i = 0; i < arr.length; i += 1) { + str += arr[i]; + if (i + 1 < arr.length) { + str += joiner; + } + } + return str; +}; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.apply(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slicy(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + concatty(args, arguments) + ); + if (Object(result) === result) { + return result; + } + return this; + } + return target.apply( + that, + concatty(args, arguments) + ); + + }; + + var boundLength = max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs[i] = '$' + i; + } + + bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; diff --git a/node_modules/function-bind/index.js b/node_modules/function-bind/index.js new file mode 100644 index 00000000..3bb6b960 --- /dev/null +++ b/node_modules/function-bind/index.js @@ -0,0 +1,5 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; diff --git a/node_modules/function-bind/package.json b/node_modules/function-bind/package.json new file mode 100644 index 00000000..61859638 --- /dev/null +++ b/node_modules/function-bind/package.json @@ -0,0 +1,87 @@ +{ + "name": "function-bind", + "version": "1.1.2", + "description": "Implementation of Function.prototype.bind", + "keywords": [ + "function", + "bind", + "shim", + "es5" + ], + "author": "Raynos ", + "repository": { + "type": "git", + "url": "https://github.com/Raynos/function-bind.git" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "main": "index", + "homepage": "https://github.com/Raynos/function-bind", + "contributors": [ + { + "name": "Raynos" + }, + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "bugs": { + "url": "https://github.com/Raynos/function-bind/issues", + "email": "raynos2@gmail.com" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.3", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.1" + }, + "license": "MIT", + "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepack": "npmignore --auto --commentLines=autogenerated", + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "lint": "eslint --ext=js,mjs .", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "ie/8..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..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" + ] + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/function-bind/test/.eslintrc b/node_modules/function-bind/test/.eslintrc new file mode 100644 index 00000000..8a56d5b7 --- /dev/null +++ b/node_modules/function-bind/test/.eslintrc @@ -0,0 +1,9 @@ +{ + "rules": { + "array-bracket-newline": 0, + "array-element-newline": 0, + "max-statements-per-line": [2, { "max": 2 }], + "no-invalid-this": 0, + "no-magic-numbers": 0, + } +} diff --git a/node_modules/function-bind/test/index.js b/node_modules/function-bind/test/index.js new file mode 100644 index 00000000..2edecce2 --- /dev/null +++ b/node_modules/function-bind/test/index.js @@ -0,0 +1,252 @@ +// jscs:disable requireUseStrict + +var test = require('tape'); + +var functionBind = require('../implementation'); +var getCurrentContext = function () { return this; }; + +test('functionBind is a function', function (t) { + t.equal(typeof functionBind, 'function'); + t.end(); +}); + +test('non-functions', function (t) { + var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g]; + t.plan(nonFunctions.length); + for (var i = 0; i < nonFunctions.length; ++i) { + try { functionBind.call(nonFunctions[i]); } catch (ex) { + t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i])); + } + } + t.end(); +}); + +test('without a context', function (t) { + t.test('binds properly', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }) + }; + namespace.func(1, 2, 3); + st.deepEqual(args, [1, 2, 3]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('binds properly, and still supplies bound arguments', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, undefined, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.deepEqual(args, [1, 2, 3, 4, 5, 6]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('returns properly', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('called as a constructor', function (st) { + var thunkify = function (value) { + return function () { return value; }; + }; + st.test('returns object value', function (sst) { + var expectedReturnValue = [1, 2, 3]; + var Constructor = functionBind.call(thunkify(expectedReturnValue), null); + var result = new Constructor(); + sst.equal(result, expectedReturnValue); + sst.end(); + }); + + st.test('does not return primitive value', function (sst) { + var Constructor = functionBind.call(thunkify(42), null); + var result = new Constructor(); + sst.notEqual(result, 42); + sst.end(); + }); + + st.test('object from bound constructor is instance of original and bound constructor', function (sst) { + var A = function (x) { + this.name = x || 'A'; + }; + var B = functionBind.call(A, null, 'B'); + + var result = new B(); + sst.ok(result instanceof B, 'result is instance of bound constructor'); + sst.ok(result instanceof A, 'result is instance of original constructor'); + sst.end(); + }); + + st.end(); + }); + + t.end(); +}); + +test('with a context', function (t) { + t.test('with no bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext) + }; + namespace.func(1, 2, 3); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3], 'supplies passed arguments'); + st.end(); + }); + + t.test('with bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments'); + st.end(); + }); + + t.test('returns properly', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('passes the correct arguments when called as a constructor', function (st) { + var expected = { name: 'Correct' }; + var namespace = { + Func: functionBind.call(function (arg) { + return arg; + }, { name: 'Incorrect' }) + }; + var returned = new namespace.Func(expected); + st.equal(returned, expected, 'returns the right arg when called as a constructor'); + st.end(); + }); + + t.test('has the new instance\'s context when called as a constructor', function (st) { + var actualContext; + var expectedContext = { foo: 'bar' }; + var namespace = { + Func: functionBind.call(function () { + actualContext = this; + }, expectedContext) + }; + var result = new namespace.Func(); + st.equal(result instanceof namespace.Func, true); + st.notEqual(actualContext, expectedContext); + st.end(); + }); + + t.end(); +}); + +test('bound function length', function (t) { + t.test('sets a correct length without thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); +}); diff --git a/node_modules/glob-parent/LICENSE b/node_modules/glob-parent/LICENSE new file mode 100644 index 00000000..d701b083 --- /dev/null +++ b/node_modules/glob-parent/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2015, 2019 Elan Shanker, 2021 Blaine Bublitz , Eric Schoffstall and other 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/glob-parent/README.md b/node_modules/glob-parent/README.md new file mode 100644 index 00000000..6ae18a1a --- /dev/null +++ b/node_modules/glob-parent/README.md @@ -0,0 +1,134 @@ +

+ + + +

+ +# glob-parent + +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] + +Extract the non-magic parent path from a glob string. + +## Usage + +```js +var globParent = require('glob-parent'); + +globParent('path/to/*.js'); // 'path/to' +globParent('/root/path/to/*.js'); // '/root/path/to' +globParent('/*.js'); // '/' +globParent('*.js'); // '.' +globParent('**/*.js'); // '.' +globParent('path/{to,from}'); // 'path' +globParent('path/!(to|from)'); // 'path' +globParent('path/?(to|from)'); // 'path' +globParent('path/+(to|from)'); // 'path' +globParent('path/*(to|from)'); // 'path' +globParent('path/@(to|from)'); // 'path' +globParent('path/**/*'); // 'path' + +// if provided a non-glob path, returns the nearest dir +globParent('path/foo/bar.js'); // 'path/foo' +globParent('path/foo/'); // 'path/foo' +globParent('path/foo'); // 'path' (see issue #3 for details) +``` + +## API + +### `globParent(maybeGlobString, [options])` + +Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below. + +#### options + +```js +{ + // Disables the automatic conversion of slashes for Windows + flipBackslashes: true; +} +``` + +## Escaping + +The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: + +- `?` (question mark) unless used as a path segment alone +- `*` (asterisk) +- `|` (pipe) +- `(` (opening parenthesis) +- `)` (closing parenthesis) +- `{` (opening curly brace) +- `}` (closing curly brace) +- `[` (opening bracket) +- `]` (closing bracket) + +**Example** + +```js +globParent('foo/[bar]/'); // 'foo' +globParent('foo/\\[bar]/'); // 'foo/[bar]' +``` + +## Limitations + +### Braces & Brackets + +This library attempts a quick and imperfect method of determining which path +parts have glob magic without fully parsing/lexing the pattern. There are some +advanced use cases that can trip it up, such as nested braces where the outer +pair is escaped and the inner one contains a path separator. If you find +yourself in the unlikely circumstance of being affected by this or need to +ensure higher-fidelity glob handling in your library, it is recommended that you +pre-process your input with [expand-braces] and/or [expand-brackets]. + +### Windows + +Backslashes are not valid path separators for globs. If a path with backslashes +is provided anyway, for simple cases, glob-parent will replace the path +separator for you and return the non-glob parent path (now with +forward-slashes, which are still valid as Windows path separators). + +This cannot be used in conjunction with escape characters. + +```js +// BAD +globParent('C:\\Program Files \\(x86\\)\\*.ext'); // 'C:/Program Files /(x86/)' + +// GOOD +globParent('C:/Program Files\\(x86\\)/*.ext'); // 'C:/Program Files (x86)' +``` + +If you are using escape characters for a pattern without path parts (i.e. +relative to `cwd`), prefix with `./` to avoid confusing glob-parent. + +```js +// BAD +globParent('foo \\[bar]'); // 'foo ' +globParent('foo \\[bar]*'); // 'foo ' + +// GOOD +globParent('./foo \\[bar]'); // 'foo [bar]' +globParent('./foo \\[bar]*'); // '.' +``` + +## License + +ISC + + +[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg?style=flat-square +[npm-url]: https://www.npmjs.com/package/glob-parent +[npm-image]: https://img.shields.io/npm/v/glob-parent.svg?style=flat-square + +[ci-url]: https://github.com/gulpjs/glob-parent/actions?query=workflow:dev +[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/glob-parent/dev?style=flat-square + +[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent +[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg?style=flat-square + + + +[expand-braces]: https://github.com/jonschlinkert/expand-braces +[expand-brackets]: https://github.com/jonschlinkert/expand-brackets + diff --git a/node_modules/glob-parent/index.js b/node_modules/glob-parent/index.js new file mode 100644 index 00000000..09dde64b --- /dev/null +++ b/node_modules/glob-parent/index.js @@ -0,0 +1,75 @@ +'use strict'; + +var isGlob = require('is-glob'); +var pathPosixDirname = require('path').posix.dirname; +var isWin32 = require('os').platform() === 'win32'; + +var slash = '/'; +var backslash = /\\/g; +var escaped = /\\([!*?|[\](){}])/g; + +/** + * @param {string} str + * @param {Object} opts + * @param {boolean} [opts.flipBackslashes=true] + */ +module.exports = function globParent(str, opts) { + var options = Object.assign({ flipBackslashes: true }, opts); + + // flip windows path separators + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + str = str.replace(backslash, slash); + } + + // special case for strings ending in enclosure containing path separator + if (isEnclosure(str)) { + str += slash; + } + + // preserves full path in case of trailing path separator + str += 'a'; + + // remove path parts that are globby + do { + str = pathPosixDirname(str); + } while (isGlobby(str)); + + // remove escape chars and return result + return str.replace(escaped, '$1'); +}; + +function isEnclosure(str) { + var lastChar = str.slice(-1); + + var enclosureStart; + switch (lastChar) { + case '}': + enclosureStart = '{'; + break; + case ']': + enclosureStart = '['; + break; + default: + return false; + } + + var foundIndex = str.indexOf(enclosureStart); + if (foundIndex < 0) { + return false; + } + + return str.slice(foundIndex + 1, -1).includes(slash); +} + +function isGlobby(str) { + if (/\([^()]+$/.test(str)) { + return true; + } + if (str[0] === '{' || str[0] === '[') { + return true; + } + if (/[^\\][{[]/.test(str)) { + return true; + } + return isGlob(str); +} diff --git a/node_modules/glob-parent/package.json b/node_modules/glob-parent/package.json new file mode 100644 index 00000000..baeab421 --- /dev/null +++ b/node_modules/glob-parent/package.json @@ -0,0 +1,54 @@ +{ + "name": "glob-parent", + "version": "6.0.2", + "description": "Extract the non-magic parent path from a glob string.", + "author": "Gulp Team (https://gulpjs.com/)", + "contributors": [ + "Elan Shanker (https://github.com/es128)", + "Blaine Bublitz " + ], + "repository": "gulpjs/glob-parent", + "license": "ISC", + "engines": { + "node": ">=10.13.0" + }, + "main": "index.js", + "files": [ + "LICENSE", + "index.js" + ], + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "test": "nyc mocha --async-only" + }, + "dependencies": { + "is-glob": "^4.0.3" + }, + "devDependencies": { + "eslint": "^7.0.0", + "eslint-config-gulp": "^5.0.0", + "expect": "^26.0.1", + "mocha": "^7.1.2", + "nyc": "^15.0.1" + }, + "nyc": { + "reporter": [ + "lcov", + "text-summary" + ] + }, + "prettier": { + "singleQuote": true + }, + "keywords": [ + "glob", + "parent", + "strip", + "path", + "dirname", + "directory", + "base", + "wildcard" + ] +} diff --git a/node_modules/glob/LICENSE b/node_modules/glob/LICENSE new file mode 100644 index 00000000..39e8fe16 --- /dev/null +++ b/node_modules/glob/LICENSE @@ -0,0 +1,15 @@ +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/glob/README.md b/node_modules/glob/README.md new file mode 100644 index 00000000..62939110 --- /dev/null +++ b/node_modules/glob/README.md @@ -0,0 +1,399 @@ +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master) + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![a fun cartoon logo made of glob characters](logo/glob.png) + +## Usage + +Install with npm + +``` +npm i glob +``` + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* `cb` `{Function}` + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* return: `{Array}` filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` `{String}` pattern to search for +* `options` `{Object}` +* `cb` `{Function}` Called when an error occurs, or matches are found + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'FILE'` - Path exists, and is not a directory + * `'DIR'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the specific + thing that matched. It is not deduplicated or resolved to a realpath. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. This option is always coerced to use + forward-slashes as a path separator, because it is not tested + as a glob pattern, so there is no need to escape anything. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) This option is + always coerced to use forward-slashes as a path separator, + because it is not tested as a glob pattern, so there is no need + to escape anything. +* `windowsPathsNoEscape` Use `\\` as a path separator _only_, and + _never_ as an escape character. If set, all `\\` characters + are replaced with `/` in the pattern. Note that this makes it + **impossible** to match against paths containing literal glob + pattern characters, but allows matching with patterns constructed + using `path.join()` and `path.resolve()` on Windows platforms, + mimicking the (buggy!) behavior of Glob v7 and before on + Windows. Please use with caution, and be mindful of [the caveat + below about Windows paths](#windows). (For legacy reasons, + this is also set if `allowWindowsEscape` is set to the exact + value `false`.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` 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 all js files in all directories. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of glob patterns to exclude matches. + Note: `ignore` patterns are *always* in `dot:true` mode, regardless + of any other settings. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `absolute` Set to true to always receive absolute paths for matched + files. Unlike `realpath`, this also affects the values returned in + the `match` event. +* `fs` File-system object with Node's `fs` API. By default, the built-in + `fs` module will be used. Set to a volume provided by a library like + `memfs` to avoid using the "real" file-system. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +Previously, this module let you mark a pattern as a "comment" if it +started with a `#` character, or a "negated" pattern if it started +with a `!` character. + +These options were deprecated in version 5, and removed in version 6. + +To specify things that should not match, use the `ignore` option. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +To automatically coerce all `\` characters to `/` in pattern +strings, **thus making it impossible to escape literal glob +characters**, you may set the `windowsPathsNoEscape` option to +`true`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Glob Logo +Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo). + +The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/). + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` + +![](oh-my-glob.gif) diff --git a/node_modules/glob/common.js b/node_modules/glob/common.js new file mode 100644 index 00000000..61a4452f --- /dev/null +++ b/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/glob/glob.js b/node_modules/glob/glob.js new file mode 100644 index 00000000..2112a957 --- /dev/null +++ b/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/glob/package.json b/node_modules/glob/package.json new file mode 100644 index 00000000..ca0fd916 --- /dev/null +++ b/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/glob/sync.js b/node_modules/glob/sync.js new file mode 100644 index 00000000..af4600dd --- /dev/null +++ b/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/globalyzer/license b/node_modules/globalyzer/license new file mode 100644 index 00000000..13dc83c1 --- /dev/null +++ b/node_modules/globalyzer/license @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Terkel Gjervig Nielsen + +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/globalyzer/package.json b/node_modules/globalyzer/package.json new file mode 100644 index 00000000..5646072b --- /dev/null +++ b/node_modules/globalyzer/package.json @@ -0,0 +1,28 @@ +{ + "name": "globalyzer", + "version": "0.1.0", + "description": "Detects and extract the glob part of a string", + "main": "src/index.js", + "repository": { + "type": "git", + "url": "https://github.com/terkelg/globalyzer" + }, + "files": [ + "src" + ], + "keywords": [ + "glob", + "analyzer", + "base", + "detect" + ], + "scripts": { + "test": "tape test/*.js | tap-spec" + }, + "author": "Terkel Gjervig", + "license": "MIT", + "devDependencies": { + "tap-spec": "^4.1.1", + "tape": "^4.9.0" + } +} diff --git a/node_modules/globalyzer/readme.md b/node_modules/globalyzer/readme.md new file mode 100644 index 00000000..ec72b112 --- /dev/null +++ b/node_modules/globalyzer/readme.md @@ -0,0 +1,57 @@ +# globalyzer + +> Detect and extract the glob part of a string + +Utility to detect if a string contains a glob and then split it in a glob and none-glob part. + +## Install + +``` +npm install globalyzer --save +``` + +## Usage + +```js +const globalyzer = require('globalyzer'); + +globalyzer('foo/bar/.git/'); +// => { base: 'foo/bar/.git/', glob: '', isGlob: false } + +globalyzer('foo/bar/**/baz'); +// => { base: 'foo/bar', glob: '**/baz', isGlob: true } +``` + + +## API + +### globalyzer(glob, options) + +Type: `function`
+Returns: `{ base, glob, isGlob }` + +Returns an object with the (non-glob) base path and the actual pattern. + +#### options.strict + +Type: `Boolean`
+Default: `true` + +Be strict about what's a glob and what's not + + +#### glob + +Type: `String` + +Glob string to analyze. + + +## Credit + +This is a fork of [is-glob](https://github.com/micromatch/is-glob) and [glob-base](https://github.com/micromatch/glob-base) + + +## License + +MIT © [Terkel Gjervig](https://terkel.com) diff --git a/node_modules/globalyzer/src/.DS_Store b/node_modules/globalyzer/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 1 && // multiple "*"'s + (prevChar === '/' || prevChar === undefined) && // from the start of the segment + (nextChar === '/' || nextChar === undefined); // to the end of the segment + if (isGlobstar) { + // it's a globstar, so match zero or more path segments + add(GLOBSTAR, {only:'regex'}); + add(GLOBSTAR_SEGMENT, {only:'path', last:true, split:true}); + i++; // move over the "/" + } else { + // it's not a globstar, so only match one path segment + add(WILDCARD, {only:'regex'}); + add(WILDCARD_SEGMENT, {only:'path'}); + } + } + continue; + } + + add(c); + } + + + // When regexp 'g' flag is specified don't + // constrain the regular expression with ^ & $ + if (!flags.includes('g')) { + regex = `^${regex}$`; + segment = `^${segment}$`; + if (filepath) path.regex = `^${path.regex}$`; + } + + const result = {regex: new RegExp(regex, flags)}; + + // Push the last segment + if (filepath) { + path.segments.push(new RegExp(segment, flags)); + path.regex = new RegExp(path.regex, flags); + path.globstar = new RegExp(!flags.includes('g') ? `^${GLOBSTAR_SEGMENT}$` : GLOBSTAR_SEGMENT, flags); + result.path = path; + } + + return result; +} + +module.exports = globrex; diff --git a/node_modules/globrex/license b/node_modules/globrex/license new file mode 100644 index 00000000..13dc83c1 --- /dev/null +++ b/node_modules/globrex/license @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Terkel Gjervig Nielsen + +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/globrex/package.json b/node_modules/globrex/package.json new file mode 100644 index 00000000..06add71c --- /dev/null +++ b/node_modules/globrex/package.json @@ -0,0 +1,30 @@ +{ + "name": "globrex", + "version": "0.1.2", + "description": "Glob to regular expression with support for extended globs", + "main": "index.js", + "author": "Terkel Gjervig", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/terkelg/globrex" + }, + "files": [ + "index.js" + ], + "keywords": [ + "glob", + "regex", + "regexp", + "parser", + "glob2regx", + "compiler" + ], + "scripts": { + "test": "tape test/*.js | tap-spec" + }, + "devDependencies": { + "tap-spec": "^4.1.1", + "tape": "^4.8.0" + } +} diff --git a/node_modules/globrex/readme.md b/node_modules/globrex/readme.md new file mode 100644 index 00000000..6482579a --- /dev/null +++ b/node_modules/globrex/readme.md @@ -0,0 +1,178 @@ +
+ globrex +
+ +

globrex

+ + + +
Simple but powerful glob to regular expression compiler.
+ +
+ + +## Install + +``` +npm install globrex --save +``` + + +## Core Features + +- 💪 **extended globbing:** transform advance `ExtGlob` features +- 📦 **simple**: no dependencies +- 🛣️ **paths**: split paths into multiple `RegExp` segments + + +## Usage + +```js +const globrex = require('globrex'); + +const result = globrex('p*uck') +// => { regex: /^p.*uck$/, string: '^p.*uck$', segments: [ /^p.*uck$/ ] } + +result.regex.test('pluck'); // true +``` + + +## API + +### globrex(glob, options) + +Type: `function`
+Returns: `Object` + +Transform globs intp regular expressions. +Returns object with the following properties: + + +#### regex + +Type: `RegExp` + +JavaScript `RegExp` instance. + +> **Note**: Read more about how to use [RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) on MDN. + + +#### path + +This property only exists if the option `filepath` is true. + +> **Note:** `filepath` is `false` by default + +#### path.segments + +Type: `Array` + +Array of `RegExp` instances seperated by `/`. +This can be usable when working with file paths or urls. + +Example array could be: +```js +[ /^foo$/, /^bar$/, /^([^\/]*)$/, '^baz\\.(md|js|txt)$' ] +``` + + +#### path.regex + +Type: `RegExp` + +JavaScript `RegExp` instance build for testign against paths. +The regex have different path seperators depending on host OS. + + +### glob + +Type: `String` + +Glob string to transform. + + +### options.extended + +Type: `Boolean`
+Default: `false` + +Enable all advanced features from `extglob`. + +Matching so called "extended" globs pattern like single character matching, matching ranges of characters, group matching, etc. + +> **Note**: Interprets `[a-d]` as `[abcd]`. To match a literal `-`, include it as first or last character. + + +### options.globstar + +Type: `Boolean`
+Default: `false` + +When globstar is `false` globs like `'/foo/*'` are transformed to the following +`'^\/foo\/.*$'` which will match any string beginning with `'/foo/'`. + +When the globstar option is `true`, the same `'/foo/*'` glob is transformed to +`'^\/foo\/[^/]*$'` which will match any string beginning with `'/foo/'` that **does not have** a `'/'` to the right of it. `'/foo/*'` will match: `'/foo/bar'`, `'/foo/bar.txt'` but not `'/foo/bar/baz'` or `'/foo/bar/baz.txt'`. + +> **Note**: When globstar is `true`, `'/foo/**'` is equivelant to `'/foo/*'` when globstar is `false`. + + +### options.strict + +Type: `Boolean`
+Default: `false` + +Be forgiving about mutiple slashes, like `///` and make everything after the first `/` optional. This is how bash glob works. + + +### options.flags + +Type: `String`
+Default: `''` + +RegExp flags (e.g. `'i'` ) to pass to the RegExp constructor. + + +### options.filepath + +Type: `Boolean`
+Default: `false` + +Parse input strings as it was a file path for special path related features. This feature only makes sense if the input is a POSIX path like `/foo/bar/hello.js` or URLs. + +When `true` the returned object will have an additional `path` object. + +- `segment`: Array containing a `RegExp` object for each path segment. +- `regex`: OS specific file path `RegExp`. Path seperator used is based on the operating system. +- `globstar`: Regex string used to test for globstars. + +> **Note: Please only use forward-slashes in file path glob expressions** +> Though windows uses either `/` or `\` as its path separator, only `/` +> characters are used by this glob implementation. You must use +> forward-slashes **only** in glob expressions. Back-slashes will always +> be interpreted as escape characters, not path separators. + + +## References + +Learn more about advanced globbing here +- [mywiki.wooledge.org/glob](http://mywiki.wooledge.org/glob) +- [linuxjournal](http://www.linuxjournal.com/content/bash-extended-globbing) + + +## License + +MIT © [Terkel Gjervig](https://terkel.com) diff --git a/node_modules/graceful-fs/LICENSE b/node_modules/graceful-fs/LICENSE new file mode 100644 index 00000000..e906a25a --- /dev/null +++ b/node_modules/graceful-fs/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, 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/graceful-fs/README.md b/node_modules/graceful-fs/README.md new file mode 100644 index 00000000..82d6e4da --- /dev/null +++ b/node_modules/graceful-fs/README.md @@ -0,0 +1,143 @@ +# graceful-fs + +graceful-fs functions as a drop-in replacement for the fs module, +making various improvements. + +The improvements are meant to normalize behavior across different +platforms and environments, and to make filesystem access more +resilient to errors. + +## Improvements over [fs module](https://nodejs.org/api/fs.html) + +* Queues up `open` and `readdir` calls, and retries them once + something closes if there is an EMFILE error from too many file + descriptors. +* fixes `lchmod` for Node versions prior to 0.6.2. +* implements `fs.lutimes` if possible. Otherwise it becomes a noop. +* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or + `lchown` if the user isn't root. +* makes `lchmod` and `lchown` become noops, if not available. +* retries reading a file if `read` results in EAGAIN error. + +On Windows, it retries renaming a file for up to one second if `EACCESS` +or `EPERM` error occurs, likely because antivirus software has locked +the directory. + +## USAGE + +```javascript +// use just like fs +var fs = require('graceful-fs') + +// now go and do stuff with it... +fs.readFile('some-file-or-whatever', (err, data) => { + // Do stuff here. +}) +``` + +## Sync methods + +This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync +methods. If you use sync methods which open file descriptors then you are +responsible for dealing with any errors. + +This is a known limitation, not a bug. + +## Global Patching + +If you want to patch the global fs module (or any other fs-like +module) you can do this: + +```javascript +// Make sure to read the caveat below. +var realFs = require('fs') +var gracefulFs = require('graceful-fs') +gracefulFs.gracefulify(realFs) +``` + +This should only ever be done at the top-level application layer, in +order to delay on EMFILE errors from any fs-using dependencies. You +should **not** do this in a library, because it can cause unexpected +delays in other parts of the program. + +## Changes + +This module is fairly stable at this point, and used by a lot of +things. That being said, because it implements a subtle behavior +change in a core part of the node API, even modest changes can be +extremely breaking, and the versioning is thus biased towards +bumping the major when in doubt. + +The main change between major versions has been switching between +providing a fully-patched `fs` module vs monkey-patching the node core +builtin, and the approach by which a non-monkey-patched `fs` was +created. + +The goal is to trade `EMFILE` errors for slower fs operations. So, if +you try to open a zillion files, rather than crashing, `open` +operations will be queued up and wait for something else to `close`. + +There are advantages to each approach. Monkey-patching the fs means +that no `EMFILE` errors can possibly occur anywhere in your +application, because everything is using the same core `fs` module, +which is patched. However, it can also obviously cause undesirable +side-effects, especially if the module is loaded multiple times. + +Implementing a separate-but-identical patched `fs` module is more +surgical (and doesn't run the risk of patching multiple times), but +also imposes the challenge of keeping in sync with the core module. + +The current approach loads the `fs` module, and then creates a +lookalike object that has all the same methods, except a few that are +patched. It is safe to use in all versions of Node from 0.8 through +7.0. + +### v4 + +* Do not monkey-patch the fs module. This module may now be used as a + drop-in dep, and users can opt into monkey-patching the fs builtin + if their app requires it. + +### v3 + +* Monkey-patch fs, because the eval approach no longer works on recent + node. +* fixed possible type-error throw if rename fails on windows +* verify that we *never* get EMFILE errors +* Ignore ENOSYS from chmod/chown +* clarify that graceful-fs must be used as a drop-in + +### v2.1.0 + +* Use eval rather than monkey-patching fs. +* readdir: Always sort the results +* win32: requeue a file if error has an OK status + +### v2.0 + +* A return to monkey patching +* wrap process.cwd + +### v1.1 + +* wrap readFile +* Wrap fs.writeFile. +* readdir protection +* Don't clobber the fs builtin +* Handle fs.read EAGAIN errors by trying again +* Expose the curOpen counter +* No-op lchown/lchmod if not implemented +* fs.rename patch only for win32 +* Patch fs.rename to handle AV software on Windows +* Close #4 Chown should not fail on einval or eperm if non-root +* Fix isaacs/fstream#1 Only wrap fs one time +* Fix #3 Start at 1024 max files, then back off on EMFILE +* lutimes that doens't blow up on Linux +* A full on-rewrite using a queue instead of just swallowing the EMFILE error +* Wrap Read/Write streams as well + +### 1.0 + +* Update engines for node 0.6 +* Be lstat-graceful on Windows +* first diff --git a/node_modules/graceful-fs/clone.js b/node_modules/graceful-fs/clone.js new file mode 100644 index 00000000..dff3cc8c --- /dev/null +++ b/node_modules/graceful-fs/clone.js @@ -0,0 +1,23 @@ +'use strict' + +module.exports = clone + +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ +} + +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj + + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) } + else + var copy = Object.create(null) + + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) + + return copy +} diff --git a/node_modules/graceful-fs/graceful-fs.js b/node_modules/graceful-fs/graceful-fs.js new file mode 100644 index 00000000..8d5b89e4 --- /dev/null +++ b/node_modules/graceful-fs/graceful-fs.js @@ -0,0 +1,448 @@ +var fs = require('fs') +var polyfills = require('./polyfills.js') +var legacy = require('./legacy-streams.js') +var clone = require('./clone.js') + +var util = require('util') + +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol + +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' +} + +function noop () {} + +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} + +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } + +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) + + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + resetQueue() + } + + if (typeof cb === 'function') + cb.apply(this, arguments) + }) + } + + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) + + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) + resetQueue() + } + + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) + + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(fs[gracefulQueue]) + require('assert').equal(fs[gracefulQueue].length, 0) + }) + } +} + +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} + +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; +} + +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch + + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readFile(path, options, cb) + + function go$readFile (path, options, cb, startTime) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$writeFile(path, data, options, cb) + + function go$writeFile (path, data, options, cb, startTime) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$appendFile(path, data, options, cb) + + function go$appendFile (path, data, options, cb, startTime) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.copyFile = copyFile + function copyFile (src, dest, flags, cb) { + if (typeof flags === 'function') { + cb = flags + flags = 0 + } + return go$copyFile(src, dest, flags, cb) + + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$readdir = fs.readdir + fs.readdir = readdir + var noReaddirOptionVersions = /^v[0-5]\./ + function readdir (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + var go$readdir = noReaddirOptionVersions.test(process.version) + ? function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, fs$readdirCallback( + path, options, cb, startTime + )) + } + : function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, fs$readdirCallback( + path, options, cb, startTime + )) + } + + return go$readdir(path, options, cb) + + function fs$readdirCallback (path, options, cb, startTime) { + return function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([ + go$readdir, + [path, options, cb], + err, + startTime || Date.now(), + Date.now() + ]) + else { + if (files && files.sort) + files.sort() + + if (typeof cb === 'function') + cb.call(this, err, files) + } + } + } + } + + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } + + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } + + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } + + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) + + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) + + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } + + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() + + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } + + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } + + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } + + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } + + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } + + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null + + return go$open(path, flags, mode, cb) + + function go$open (path, flags, mode, cb, startTime) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + return fs +} + +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + fs[gracefulQueue].push(elem) + retry() +} + +// keep track of the timeout between retry() calls +var retryTimer + +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime + } + } + // call retry to make sure we're actively processing the queue + retry() +} + +function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined + + if (fs[gracefulQueue].length === 0) + return + + var elem = fs[gracefulQueue].shift() + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] + + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) + } + } + + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) + } +} diff --git a/node_modules/graceful-fs/legacy-streams.js b/node_modules/graceful-fs/legacy-streams.js new file mode 100644 index 00000000..d617b50f --- /dev/null +++ b/node_modules/graceful-fs/legacy-streams.js @@ -0,0 +1,118 @@ +var Stream = require('stream').Stream + +module.exports = legacy + +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } + + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + + Stream.call(this); + + var self = this; + + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.encoding) this.setEncoding(this.encoding); + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; + } + + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } + + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } + + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + + Stream.call(this); + + this.path = path; + this.fd = null; + this.writable = true; + + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } + + this.pos = this.start; + } + + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } + } +} diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json new file mode 100644 index 00000000..87babf02 --- /dev/null +++ b/node_modules/graceful-fs/package.json @@ -0,0 +1,53 @@ +{ + "name": "graceful-fs", + "description": "A drop-in replacement for fs, making various improvements.", + "version": "4.2.11", + "repository": { + "type": "git", + "url": "https://github.com/isaacs/node-graceful-fs" + }, + "main": "graceful-fs.js", + "directories": { + "test": "test" + }, + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags", + "test": "nyc --silent node test.js | tap -c -", + "posttest": "nyc report" + }, + "keywords": [ + "fs", + "module", + "reading", + "retry", + "retries", + "queue", + "error", + "errors", + "handling", + "EMFILE", + "EAGAIN", + "EINVAL", + "EPERM", + "EACCESS" + ], + "license": "ISC", + "devDependencies": { + "import-fresh": "^2.0.0", + "mkdirp": "^0.5.0", + "rimraf": "^2.2.8", + "tap": "^16.3.4" + }, + "files": [ + "fs.js", + "graceful-fs.js", + "legacy-streams.js", + "polyfills.js", + "clone.js" + ], + "tap": { + "reporter": "classic" + } +} diff --git a/node_modules/graceful-fs/polyfills.js b/node_modules/graceful-fs/polyfills.js new file mode 100644 index 00000000..453f1a9e --- /dev/null +++ b/node_modules/graceful-fs/polyfills.js @@ -0,0 +1,355 @@ +var constants = require('constants') + +var origCwd = process.cwd +var cwd = null + +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} + +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) +} + +module.exports = patch + +function patch (fs) { + // (re-)implement some things that are known busted or missing. + + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } + + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. + + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) + + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) + + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) + + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) + + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) + + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + + // if lchmod/lchown do not exist, then make them no-ops + if (fs.chmod && !fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (fs.chown && !fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } + + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = typeof fs.rename !== 'function' ? fs.rename + : (function (fs$rename) { + function rename (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) + return rename + })(fs.rename) + } + + // if read() returns EAGAIN, then just try it again. + fs.read = typeof fs.read !== 'function' ? fs.read + : (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + + // This ensures `util.promisify` works as it does for native `fs.read`. + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) + return read + })(fs.read) + + fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync + : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) + + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } + + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + + } else if (fs.futimes) { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } + + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } + + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + return stats; + } + } + + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true + + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false + } +} diff --git a/node_modules/hasown/.eslintrc b/node_modules/hasown/.eslintrc new file mode 100644 index 00000000..3b5d9e90 --- /dev/null +++ b/node_modules/hasown/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/node_modules/hasown/.github/FUNDING.yml b/node_modules/hasown/.github/FUNDING.yml new file mode 100644 index 00000000..d68c8b71 --- /dev/null +++ b/node_modules/hasown/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/hasown +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/node_modules/hasown/.nycrc b/node_modules/hasown/.nycrc new file mode 100644 index 00000000..1826526e --- /dev/null +++ b/node_modules/hasown/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/node_modules/hasown/CHANGELOG.md b/node_modules/hasown/CHANGELOG.md new file mode 100644 index 00000000..2b0a980f --- /dev/null +++ b/node_modules/hasown/CHANGELOG.md @@ -0,0 +1,40 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v2.0.2](https://github.com/inspect-js/hasOwn/compare/v2.0.1...v2.0.2) - 2024-03-10 + +### Commits + +- [types] use shared config [`68e9d4d`](https://github.com/inspect-js/hasOwn/commit/68e9d4dab6facb4f05f02c6baea94a3f2a4e44b2) +- [actions] remove redundant finisher; use reusable workflow [`241a68e`](https://github.com/inspect-js/hasOwn/commit/241a68e13ea1fe52bec5ba7f74144befc31fae7b) +- [Tests] increase coverage [`4125c0d`](https://github.com/inspect-js/hasOwn/commit/4125c0d6121db56ae30e38346dfb0c000b04f0a7) +- [Tests] skip `npm ls` in old node due to TS [`01b9282`](https://github.com/inspect-js/hasOwn/commit/01b92822f9971dea031eafdd14767df41d61c202) +- [types] improve predicate type [`d340f85`](https://github.com/inspect-js/hasOwn/commit/d340f85ce02e286ef61096cbbb6697081d40a12b) +- [Dev Deps] update `tape` [`70089fc`](https://github.com/inspect-js/hasOwn/commit/70089fcf544e64acc024cbe60f5a9b00acad86de) +- [Tests] use `@arethetypeswrong/cli` [`50b272c`](https://github.com/inspect-js/hasOwn/commit/50b272c829f40d053a3dd91c9796e0ac0b2af084) + +## [v2.0.1](https://github.com/inspect-js/hasOwn/compare/v2.0.0...v2.0.1) - 2024-02-10 + +### Commits + +- [types] use a handwritten d.ts file; fix exported type [`012b989`](https://github.com/inspect-js/hasOwn/commit/012b9898ccf91dc441e2ebf594ff70270a5fda58) +- [Dev Deps] update `@types/function-bind`, `@types/mock-property`, `@types/tape`, `aud`, `mock-property`, `npmignore`, `tape`, `typescript` [`977a56f`](https://github.com/inspect-js/hasOwn/commit/977a56f51a1f8b20566f3c471612137894644025) +- [meta] add `sideEffects` flag [`3a60b7b`](https://github.com/inspect-js/hasOwn/commit/3a60b7bf42fccd8c605e5f145a6fcc83b13cb46f) + +## [v2.0.0](https://github.com/inspect-js/hasOwn/compare/v1.0.1...v2.0.0) - 2023-10-19 + +### Commits + +- revamped implementation, tests, readme [`72bf8b3`](https://github.com/inspect-js/hasOwn/commit/72bf8b338e77a638f0a290c63ffaed18339c36b4) +- [meta] revamp package.json [`079775f`](https://github.com/inspect-js/hasOwn/commit/079775fb1ec72c1c6334069593617a0be3847458) +- Only apps should have lockfiles [`6640e23`](https://github.com/inspect-js/hasOwn/commit/6640e233d1bb8b65260880f90787637db157d215) + +## v1.0.1 - 2023-10-10 + +### Commits + +- Initial commit [`8dbfde6`](https://github.com/inspect-js/hasOwn/commit/8dbfde6e8fb0ebb076fab38d138f2984eb340a62) diff --git a/node_modules/hasown/LICENSE b/node_modules/hasown/LICENSE new file mode 100644 index 00000000..03149290 --- /dev/null +++ b/node_modules/hasown/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Jordan Harband and 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/hasown/README.md b/node_modules/hasown/README.md new file mode 100644 index 00000000..f759b8a8 --- /dev/null +++ b/node_modules/hasown/README.md @@ -0,0 +1,40 @@ +# hasown [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +A robust, ES3 compatible, "has own property" predicate. + +## Example + +```js +const assert = require('assert'); +const hasOwn = require('hasown'); + +assert.equal(hasOwn({}, 'toString'), false); +assert.equal(hasOwn([], 'length'), true); +assert.equal(hasOwn({ a: 42 }, 'a'), true); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/hasown +[npm-version-svg]: https://versionbadg.es/inspect-js/hasown.svg +[deps-svg]: https://david-dm.org/inspect-js/hasOwn.svg +[deps-url]: https://david-dm.org/inspect-js/hasOwn +[dev-deps-svg]: https://david-dm.org/inspect-js/hasOwn/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/hasOwn#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/hasown.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/hasown.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/hasown.svg +[downloads-url]: https://npm-stat.com/charts.html?package=hasown +[codecov-image]: https://codecov.io/gh/inspect-js/hasOwn/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/hasOwn/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/hasOwn +[actions-url]: https://github.com/inspect-js/hasOwn/actions diff --git a/node_modules/hasown/index.d.ts b/node_modules/hasown/index.d.ts new file mode 100644 index 00000000..aafdf3b2 --- /dev/null +++ b/node_modules/hasown/index.d.ts @@ -0,0 +1,3 @@ +declare function hasOwn(o: O, p: K): o is O & Record; + +export = hasOwn; diff --git a/node_modules/hasown/index.js b/node_modules/hasown/index.js new file mode 100644 index 00000000..34e60591 --- /dev/null +++ b/node_modules/hasown/index.js @@ -0,0 +1,8 @@ +'use strict'; + +var call = Function.prototype.call; +var $hasOwn = Object.prototype.hasOwnProperty; +var bind = require('function-bind'); + +/** @type {import('.')} */ +module.exports = bind.call(call, $hasOwn); diff --git a/node_modules/hasown/package.json b/node_modules/hasown/package.json new file mode 100644 index 00000000..8502e13d --- /dev/null +++ b/node_modules/hasown/package.json @@ -0,0 +1,92 @@ +{ + "name": "hasown", + "version": "2.0.2", + "description": "A robust, ES3 compatible, \"has own property\" predicate.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "index.d.ts", + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tsc": "tsc -p .", + "posttsc": "attw -P", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/hasOwn.git" + }, + "keywords": [ + "has", + "hasOwnProperty", + "hasOwn", + "has-own", + "own", + "has", + "property", + "in", + "javascript", + "ecmascript" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/hasOwn/issues" + }, + "homepage": "https://github.com/inspect-js/hasOwn#readme", + "dependencies": { + "function-bind": "^1.1.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.15.1", + "@ljharb/eslint-config": "^21.1.0", + "@ljharb/tsconfig": "^0.2.0", + "@types/function-bind": "^1.1.10", + "@types/mock-property": "^1.0.2", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "mock-property": "^1.0.3", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "test" + ] + } +} diff --git a/node_modules/hasown/tsconfig.json b/node_modules/hasown/tsconfig.json new file mode 100644 index 00000000..0930c565 --- /dev/null +++ b/node_modules/hasown/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@ljharb/tsconfig", + "exclude": [ + "coverage", + ], +} diff --git a/node_modules/import-meta-resolve/index.d.ts b/node_modules/import-meta-resolve/index.d.ts new file mode 100644 index 00000000..aae852c9 --- /dev/null +++ b/node_modules/import-meta-resolve/index.d.ts @@ -0,0 +1,18 @@ +/** + * Match `import.meta.resolve` except that `parent` is required (you can pass + * `import.meta.url`). + * + * @param {string} specifier + * The module specifier to resolve relative to parent + * (`/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`, + * etc). + * @param {string} parent + * The absolute parent module URL to resolve from. + * You must pass `import.meta.url` or something else. + * @returns {string} + * Returns a string to a full `file:`, `data:`, or `node:` URL + * to the found thing. + */ +export function resolve(specifier: string, parent: string): string; +export { moduleResolve } from "./lib/resolve.js"; +export type ErrnoException = import('./lib/errors.js').ErrnoException; diff --git a/node_modules/import-meta-resolve/index.js b/node_modules/import-meta-resolve/index.js new file mode 100644 index 00000000..afec4eb0 --- /dev/null +++ b/node_modules/import-meta-resolve/index.js @@ -0,0 +1,47 @@ +/** + * @typedef {import('./lib/errors.js').ErrnoException} ErrnoException + */ + +import {defaultResolve} from './lib/resolve.js' + +export {moduleResolve} from './lib/resolve.js' + +/** + * Match `import.meta.resolve` except that `parent` is required (you can pass + * `import.meta.url`). + * + * @param {string} specifier + * The module specifier to resolve relative to parent + * (`/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`, + * etc). + * @param {string} parent + * The absolute parent module URL to resolve from. + * You must pass `import.meta.url` or something else. + * @returns {string} + * Returns a string to a full `file:`, `data:`, or `node:` URL + * to the found thing. + */ +export function resolve(specifier, parent) { + if (!parent) { + throw new Error( + 'Please pass `parent`: `import-meta-resolve` cannot ponyfill that' + ) + } + + try { + return defaultResolve(specifier, {parentURL: parent}).url + } catch (error) { + // See: + const exception = /** @type {ErrnoException} */ (error) + + if ( + (exception.code === 'ERR_UNSUPPORTED_DIR_IMPORT' || + exception.code === 'ERR_MODULE_NOT_FOUND') && + typeof exception.url === 'string' + ) { + return exception.url + } + + throw error + } +} diff --git a/node_modules/import-meta-resolve/lib/errors.d.ts b/node_modules/import-meta-resolve/lib/errors.d.ts new file mode 100644 index 00000000..d7942190 --- /dev/null +++ b/node_modules/import-meta-resolve/lib/errors.d.ts @@ -0,0 +1,23 @@ +export namespace codes { + let ERR_INVALID_ARG_TYPE: new (...parameters: any[]) => Error; + let ERR_INVALID_MODULE_SPECIFIER: new (...parameters: any[]) => Error; + let ERR_INVALID_PACKAGE_CONFIG: new (...parameters: any[]) => Error; + let ERR_INVALID_PACKAGE_TARGET: new (...parameters: any[]) => Error; + let ERR_MODULE_NOT_FOUND: new (...parameters: any[]) => Error; + let ERR_NETWORK_IMPORT_DISALLOWED: new (...parameters: any[]) => Error; + let ERR_PACKAGE_IMPORT_NOT_DEFINED: new (...parameters: any[]) => Error; + let ERR_PACKAGE_PATH_NOT_EXPORTED: new (...parameters: any[]) => Error; + let ERR_UNSUPPORTED_DIR_IMPORT: new (...parameters: any[]) => Error; + let ERR_UNSUPPORTED_RESOLVE_REQUEST: new (...parameters: any[]) => Error; + let ERR_UNKNOWN_FILE_EXTENSION: new (...parameters: any[]) => Error; + let ERR_INVALID_ARG_VALUE: new (...parameters: any[]) => Error; +} +export type ErrnoExceptionFields = { + errnode?: number | undefined; + code?: string | undefined; + path?: string | undefined; + syscall?: string | undefined; + url?: string | undefined; +}; +export type ErrnoException = Error & ErrnoExceptionFields; +export type MessageFunction = (...parameters: Array) => string; diff --git a/node_modules/import-meta-resolve/lib/errors.js b/node_modules/import-meta-resolve/lib/errors.js new file mode 100644 index 00000000..41ed75c6 --- /dev/null +++ b/node_modules/import-meta-resolve/lib/errors.js @@ -0,0 +1,507 @@ +/** + * @typedef ErrnoExceptionFields + * @property {number | undefined} [errnode] + * @property {string | undefined} [code] + * @property {string | undefined} [path] + * @property {string | undefined} [syscall] + * @property {string | undefined} [url] + * + * @typedef {Error & ErrnoExceptionFields} ErrnoException + */ + +/** + * @typedef {(...parameters: Array) => string} MessageFunction + */ + +// Manually “tree shaken” from: +// +// Last checked on: Nov 2, 2023. +import v8 from 'node:v8' +import assert from 'node:assert' +// Needed for types. +// eslint-disable-next-line no-unused-vars +import {URL} from 'node:url' +import {format, inspect} from 'node:util' + +const own = {}.hasOwnProperty + +const classRegExp = /^([A-Z][a-z\d]*)+$/ +// Sorted by a rough estimate on most frequently used entries. +const kTypes = new Set([ + 'string', + 'function', + 'number', + 'object', + // Accept 'Function' and 'Object' as alternative to the lower cased version. + 'Function', + 'Object', + 'boolean', + 'bigint', + 'symbol' +]) + +export const codes = {} + +/** + * Create a list string in the form like 'A and B' or 'A, B, ..., and Z'. + * We cannot use Intl.ListFormat because it's not available in + * --without-intl builds. + * + * @param {Array} array + * An array of strings. + * @param {string} [type] + * The list type to be inserted before the last element. + * @returns {string} + */ +function formatList(array, type = 'and') { + return array.length < 3 + ? array.join(` ${type} `) + : `${array.slice(0, -1).join(', ')}, ${type} ${array[array.length - 1]}` +} + +/** @type {Map} */ +const messages = new Map() +const nodeInternalPrefix = '__node_internal_' +/** @type {number} */ +let userStackTraceLimit + +codes.ERR_INVALID_ARG_TYPE = createError( + 'ERR_INVALID_ARG_TYPE', + /** + * @param {string} name + * @param {Array | string} expected + * @param {unknown} actual + */ + (name, expected, actual) => { + assert(typeof name === 'string', "'name' must be a string") + if (!Array.isArray(expected)) { + expected = [expected] + } + + let message = 'The ' + if (name.endsWith(' argument')) { + // For cases like 'first argument' + message += `${name} ` + } else { + const type = name.includes('.') ? 'property' : 'argument' + message += `"${name}" ${type} ` + } + + message += 'must be ' + + /** @type {Array} */ + const types = [] + /** @type {Array} */ + const instances = [] + /** @type {Array} */ + const other = [] + + for (const value of expected) { + assert( + typeof value === 'string', + 'All expected entries have to be of type string' + ) + + if (kTypes.has(value)) { + types.push(value.toLowerCase()) + } else if (classRegExp.exec(value) === null) { + assert( + value !== 'object', + 'The value "object" should be written as "Object"' + ) + other.push(value) + } else { + instances.push(value) + } + } + + // Special handle `object` in case other instances are allowed to outline + // the differences between each other. + if (instances.length > 0) { + const pos = types.indexOf('object') + if (pos !== -1) { + types.slice(pos, 1) + instances.push('Object') + } + } + + if (types.length > 0) { + message += `${types.length > 1 ? 'one of type' : 'of type'} ${formatList( + types, + 'or' + )}` + if (instances.length > 0 || other.length > 0) message += ' or ' + } + + if (instances.length > 0) { + message += `an instance of ${formatList(instances, 'or')}` + if (other.length > 0) message += ' or ' + } + + if (other.length > 0) { + if (other.length > 1) { + message += `one of ${formatList(other, 'or')}` + } else { + if (other[0].toLowerCase() !== other[0]) message += 'an ' + message += `${other[0]}` + } + } + + message += `. Received ${determineSpecificType(actual)}` + + return message + }, + TypeError +) + +codes.ERR_INVALID_MODULE_SPECIFIER = createError( + 'ERR_INVALID_MODULE_SPECIFIER', + /** + * @param {string} request + * @param {string} reason + * @param {string} [base] + */ + (request, reason, base = undefined) => { + return `Invalid module "${request}" ${reason}${ + base ? ` imported from ${base}` : '' + }` + }, + TypeError +) + +codes.ERR_INVALID_PACKAGE_CONFIG = createError( + 'ERR_INVALID_PACKAGE_CONFIG', + /** + * @param {string} path + * @param {string} [base] + * @param {string} [message] + */ + (path, base, message) => { + return `Invalid package config ${path}${ + base ? ` while importing ${base}` : '' + }${message ? `. ${message}` : ''}` + }, + Error +) + +codes.ERR_INVALID_PACKAGE_TARGET = createError( + 'ERR_INVALID_PACKAGE_TARGET', + /** + * @param {string} packagePath + * @param {string} key + * @param {unknown} target + * @param {boolean} [isImport=false] + * @param {string} [base] + */ + (packagePath, key, target, isImport = false, base = undefined) => { + const relatedError = + typeof target === 'string' && + !isImport && + target.length > 0 && + !target.startsWith('./') + if (key === '.') { + assert(isImport === false) + return ( + `Invalid "exports" main target ${JSON.stringify(target)} defined ` + + `in the package config ${packagePath}package.json${ + base ? ` imported from ${base}` : '' + }${relatedError ? '; targets must start with "./"' : ''}` + ) + } + + return `Invalid "${ + isImport ? 'imports' : 'exports' + }" target ${JSON.stringify( + target + )} defined for '${key}' in the package config ${packagePath}package.json${ + base ? ` imported from ${base}` : '' + }${relatedError ? '; targets must start with "./"' : ''}` + }, + Error +) + +codes.ERR_MODULE_NOT_FOUND = createError( + 'ERR_MODULE_NOT_FOUND', + /** + * @param {string} path + * @param {string} base + * @param {boolean} [exactUrl] + */ + (path, base, exactUrl = false) => { + return `Cannot find ${ + exactUrl ? 'module' : 'package' + } '${path}' imported from ${base}` + }, + Error +) + +codes.ERR_NETWORK_IMPORT_DISALLOWED = createError( + 'ERR_NETWORK_IMPORT_DISALLOWED', + "import of '%s' by %s is not supported: %s", + Error +) + +codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError( + 'ERR_PACKAGE_IMPORT_NOT_DEFINED', + /** + * @param {string} specifier + * @param {string} packagePath + * @param {string} base + */ + (specifier, packagePath, base) => { + return `Package import specifier "${specifier}" is not defined${ + packagePath ? ` in package ${packagePath}package.json` : '' + } imported from ${base}` + }, + TypeError +) + +codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError( + 'ERR_PACKAGE_PATH_NOT_EXPORTED', + /** + * @param {string} packagePath + * @param {string} subpath + * @param {string} [base] + */ + (packagePath, subpath, base = undefined) => { + if (subpath === '.') + return `No "exports" main defined in ${packagePath}package.json${ + base ? ` imported from ${base}` : '' + }` + return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${ + base ? ` imported from ${base}` : '' + }` + }, + Error +) + +codes.ERR_UNSUPPORTED_DIR_IMPORT = createError( + 'ERR_UNSUPPORTED_DIR_IMPORT', + "Directory import '%s' is not supported " + + 'resolving ES modules imported from %s', + Error +) + +codes.ERR_UNSUPPORTED_RESOLVE_REQUEST = createError( + 'ERR_UNSUPPORTED_RESOLVE_REQUEST', + 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.', + TypeError +) + +codes.ERR_UNKNOWN_FILE_EXTENSION = createError( + 'ERR_UNKNOWN_FILE_EXTENSION', + /** + * @param {string} extension + * @param {string} path + */ + (extension, path) => { + return `Unknown file extension "${extension}" for ${path}` + }, + TypeError +) + +codes.ERR_INVALID_ARG_VALUE = createError( + 'ERR_INVALID_ARG_VALUE', + /** + * @param {string} name + * @param {unknown} value + * @param {string} [reason='is invalid'] + */ + (name, value, reason = 'is invalid') => { + let inspected = inspect(value) + + if (inspected.length > 128) { + inspected = `${inspected.slice(0, 128)}...` + } + + const type = name.includes('.') ? 'property' : 'argument' + + return `The ${type} '${name}' ${reason}. Received ${inspected}` + }, + TypeError + // Note: extra classes have been shaken out. + // , RangeError +) + +/** + * Utility function for registering the error codes. Only used here. Exported + * *only* to allow for testing. + * @param {string} sym + * @param {MessageFunction | string} value + * @param {ErrorConstructor} constructor + * @returns {new (...parameters: Array) => Error} + */ +function createError(sym, value, constructor) { + // Special case for SystemError that formats the error message differently + // The SystemErrors only have SystemError as their base classes. + messages.set(sym, value) + + return makeNodeErrorWithCode(constructor, sym) +} + +/** + * @param {ErrorConstructor} Base + * @param {string} key + * @returns {ErrorConstructor} + */ +function makeNodeErrorWithCode(Base, key) { + // @ts-expect-error It’s a Node error. + return NodeError + /** + * @param {Array} parameters + */ + function NodeError(...parameters) { + const limit = Error.stackTraceLimit + if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0 + const error = new Base() + // Reset the limit and setting the name property. + if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit + const message = getMessage(key, parameters, error) + Object.defineProperties(error, { + // Note: no need to implement `kIsNodeError` symbol, would be hard, + // probably. + message: { + value: message, + enumerable: false, + writable: true, + configurable: true + }, + toString: { + /** @this {Error} */ + value() { + return `${this.name} [${key}]: ${this.message}` + }, + enumerable: false, + writable: true, + configurable: true + } + }) + + captureLargerStackTrace(error) + // @ts-expect-error It’s a Node error. + error.code = key + return error + } +} + +/** + * @returns {boolean} + */ +function isErrorStackTraceLimitWritable() { + // Do no touch Error.stackTraceLimit as V8 would attempt to install + // it again during deserialization. + try { + if (v8.startupSnapshot.isBuildingSnapshot()) { + return false + } + } catch {} + + const desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit') + if (desc === undefined) { + return Object.isExtensible(Error) + } + + return own.call(desc, 'writable') && desc.writable !== undefined + ? desc.writable + : desc.set !== undefined +} + +/** + * This function removes unnecessary frames from Node.js core errors. + * @template {(...parameters: unknown[]) => unknown} T + * @param {T} wrappedFunction + * @returns {T} + */ +function hideStackFrames(wrappedFunction) { + // We rename the functions that will be hidden to cut off the stacktrace + // at the outermost one + const hidden = nodeInternalPrefix + wrappedFunction.name + Object.defineProperty(wrappedFunction, 'name', {value: hidden}) + return wrappedFunction +} + +const captureLargerStackTrace = hideStackFrames( + /** + * @param {Error} error + * @returns {Error} + */ + // @ts-expect-error: fine + function (error) { + const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable() + if (stackTraceLimitIsWritable) { + userStackTraceLimit = Error.stackTraceLimit + Error.stackTraceLimit = Number.POSITIVE_INFINITY + } + + Error.captureStackTrace(error) + + // Reset the limit + if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit + + return error + } +) + +/** + * @param {string} key + * @param {Array} parameters + * @param {Error} self + * @returns {string} + */ +function getMessage(key, parameters, self) { + const message = messages.get(key) + assert(message !== undefined, 'expected `message` to be found') + + if (typeof message === 'function') { + assert( + message.length <= parameters.length, // Default options do not count. + `Code: ${key}; The provided arguments length (${parameters.length}) does not ` + + `match the required ones (${message.length}).` + ) + return Reflect.apply(message, self, parameters) + } + + const regex = /%[dfijoOs]/g + let expectedLength = 0 + while (regex.exec(message) !== null) expectedLength++ + assert( + expectedLength === parameters.length, + `Code: ${key}; The provided arguments length (${parameters.length}) does not ` + + `match the required ones (${expectedLength}).` + ) + if (parameters.length === 0) return message + + parameters.unshift(message) + return Reflect.apply(format, null, parameters) +} + +/** + * Determine the specific type of a value for type-mismatch errors. + * @param {unknown} value + * @returns {string} + */ +function determineSpecificType(value) { + if (value === null || value === undefined) { + return String(value) + } + + if (typeof value === 'function' && value.name) { + return `function ${value.name}` + } + + if (typeof value === 'object') { + if (value.constructor && value.constructor.name) { + return `an instance of ${value.constructor.name}` + } + + return `${inspect(value, {depth: -1})}` + } + + let inspected = inspect(value, {colors: false}) + + if (inspected.length > 28) { + inspected = `${inspected.slice(0, 25)}...` + } + + return `type ${typeof value} (${inspected})` +} diff --git a/node_modules/import-meta-resolve/lib/get-format.d.ts b/node_modules/import-meta-resolve/lib/get-format.d.ts new file mode 100644 index 00000000..e1524ce3 --- /dev/null +++ b/node_modules/import-meta-resolve/lib/get-format.d.ts @@ -0,0 +1,12 @@ +/** + * @param {URL} url + * @param {{parentURL: string}} context + * @returns {string | null} + */ +export function defaultGetFormatWithoutErrors(url: URL, context: { + parentURL: string; +}): string | null; +export type ProtocolHandler = (parsed: URL, context: { + parentURL: string; + source?: Buffer; +}, ignoreErrors: boolean) => string | null | void; diff --git a/node_modules/import-meta-resolve/lib/get-format.js b/node_modules/import-meta-resolve/lib/get-format.js new file mode 100644 index 00000000..f81edcaf --- /dev/null +++ b/node_modules/import-meta-resolve/lib/get-format.js @@ -0,0 +1,159 @@ +// Manually “tree shaken” from: +// +// Last checked on: Apr 29, 2023. + +import {fileURLToPath} from 'node:url' +import {getPackageType} from './package-json-reader.js' +import {codes} from './errors.js' + +const {ERR_UNKNOWN_FILE_EXTENSION} = codes + +const hasOwnProperty = {}.hasOwnProperty + +/** @type {Record} */ +const extensionFormatMap = { + // @ts-expect-error: hush. + __proto__: null, + '.cjs': 'commonjs', + '.js': 'module', + '.json': 'json', + '.mjs': 'module' +} + +/** + * @param {string | null} mime + * @returns {string | null} + */ +function mimeToFormat(mime) { + if ( + mime && + /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime) + ) + return 'module' + if (mime === 'application/json') return 'json' + return null +} + +/** + * @callback ProtocolHandler + * @param {URL} parsed + * @param {{parentURL: string, source?: Buffer}} context + * @param {boolean} ignoreErrors + * @returns {string | null | void} + */ + +/** + * @type {Record} + */ +const protocolHandlers = { + // @ts-expect-error: hush. + __proto__: null, + 'data:': getDataProtocolModuleFormat, + 'file:': getFileProtocolModuleFormat, + 'http:': getHttpProtocolModuleFormat, + 'https:': getHttpProtocolModuleFormat, + 'node:'() { + return 'builtin' + } +} + +/** + * @param {URL} parsed + */ +function getDataProtocolModuleFormat(parsed) { + const {1: mime} = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec( + parsed.pathname + ) || [null, null, null] + return mimeToFormat(mime) +} + +/** + * Returns the file extension from a URL. + * + * Should give similar result to + * `require('node:path').extname(require('node:url').fileURLToPath(url))` + * when used with a `file:` URL. + * + * @param {URL} url + * @returns {string} + */ +function extname(url) { + const pathname = url.pathname + let index = pathname.length + + while (index--) { + const code = pathname.codePointAt(index) + + if (code === 47 /* `/` */) { + return '' + } + + if (code === 46 /* `.` */) { + return pathname.codePointAt(index - 1) === 47 /* `/` */ + ? '' + : pathname.slice(index) + } + } + + return '' +} + +/** + * @type {ProtocolHandler} + */ +function getFileProtocolModuleFormat(url, _context, ignoreErrors) { + const value = extname(url) + + if (value === '.js') { + const packageType = getPackageType(url) + + if (packageType !== 'none') { + return packageType + } + + return 'commonjs' + } + + if (value === '') { + const packageType = getPackageType(url) + + // Legacy behavior + if (packageType === 'none' || packageType === 'commonjs') { + return 'commonjs' + } + + // Note: we don’t implement WASM, so we don’t need + // `getFormatOfExtensionlessFile` from `formats`. + return 'module' + } + + const format = extensionFormatMap[value] + if (format) return format + + // Explicit undefined return indicates load hook should rerun format check + if (ignoreErrors) { + return undefined + } + + const filepath = fileURLToPath(url) + throw new ERR_UNKNOWN_FILE_EXTENSION(value, filepath) +} + +function getHttpProtocolModuleFormat() { + // To do: HTTPS imports. +} + +/** + * @param {URL} url + * @param {{parentURL: string}} context + * @returns {string | null} + */ +export function defaultGetFormatWithoutErrors(url, context) { + const protocol = url.protocol + + if (!hasOwnProperty.call(protocolHandlers, protocol)) { + return null + } + + return protocolHandlers[protocol](url, context, true) || null +} diff --git a/node_modules/import-meta-resolve/lib/package-json-reader.d.ts b/node_modules/import-meta-resolve/lib/package-json-reader.d.ts new file mode 100644 index 00000000..1d64f4cb --- /dev/null +++ b/node_modules/import-meta-resolve/lib/package-json-reader.d.ts @@ -0,0 +1,31 @@ +/** + * @param {string} jsonPath + * @param {{specifier: URL | string, base?: URL}} options + * @returns {PackageConfig} + */ +export function read(jsonPath: string, { base, specifier }: { + specifier: URL | string; + base?: URL; +}): PackageConfig; +/** + * @param {URL | string} resolved + * @returns {PackageConfig} + */ +export function getPackageScopeConfig(resolved: URL | string): PackageConfig; +/** + * Returns the package type for a given URL. + * @param {URL} url - The URL to get the package type for. + * @returns {PackageType} + */ +export function getPackageType(url: URL): PackageType; +export type ErrnoException = import('./errors.js').ErrnoException; +export type PackageType = 'commonjs' | 'module' | 'none'; +export type PackageConfig = { + pjsonPath: string; + exists: boolean; + main?: string | undefined; + name?: string | undefined; + type: PackageType; + exports?: Record | undefined; + imports?: Record | undefined; +}; diff --git a/node_modules/import-meta-resolve/lib/package-json-reader.js b/node_modules/import-meta-resolve/lib/package-json-reader.js new file mode 100644 index 00000000..b30aff1d --- /dev/null +++ b/node_modules/import-meta-resolve/lib/package-json-reader.js @@ -0,0 +1,177 @@ +// Manually “tree shaken” from: +// +// Last checked on: Apr 29, 2023. +// Removed the native dependency. +// Also: no need to cache, we do that in resolve already. + +/** + * @typedef {import('./errors.js').ErrnoException} ErrnoException + * + * @typedef {'commonjs' | 'module' | 'none'} PackageType + * + * @typedef PackageConfig + * @property {string} pjsonPath + * @property {boolean} exists + * @property {string | undefined} [main] + * @property {string | undefined} [name] + * @property {PackageType} type + * @property {Record | undefined} [exports] + * @property {Record | undefined} [imports] + */ + +import fs from 'node:fs' +import path from 'node:path' +import {fileURLToPath} from 'node:url' +import {codes} from './errors.js' + +const hasOwnProperty = {}.hasOwnProperty + +const {ERR_INVALID_PACKAGE_CONFIG} = codes + +/** @type {Map} */ +const cache = new Map() + +/** + * @param {string} jsonPath + * @param {{specifier: URL | string, base?: URL}} options + * @returns {PackageConfig} + */ +export function read(jsonPath, {base, specifier}) { + const existing = cache.get(jsonPath) + + if (existing) { + return existing + } + + /** @type {string | undefined} */ + let string + + try { + string = fs.readFileSync(path.toNamespacedPath(jsonPath), 'utf8') + } catch (error) { + const exception = /** @type {ErrnoException} */ (error) + + if (exception.code !== 'ENOENT') { + throw exception + } + } + + /** @type {PackageConfig} */ + const result = { + exists: false, + pjsonPath: jsonPath, + main: undefined, + name: undefined, + type: 'none', // Ignore unknown types for forwards compatibility + exports: undefined, + imports: undefined + } + + if (string !== undefined) { + /** @type {Record} */ + let parsed + + try { + parsed = JSON.parse(string) + } catch (error_) { + const cause = /** @type {ErrnoException} */ (error_) + const error = new ERR_INVALID_PACKAGE_CONFIG( + jsonPath, + (base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier), + cause.message + ) + error.cause = cause + throw error + } + + result.exists = true + + if ( + hasOwnProperty.call(parsed, 'name') && + typeof parsed.name === 'string' + ) { + result.name = parsed.name + } + + if ( + hasOwnProperty.call(parsed, 'main') && + typeof parsed.main === 'string' + ) { + result.main = parsed.main + } + + if (hasOwnProperty.call(parsed, 'exports')) { + // @ts-expect-error: assume valid. + result.exports = parsed.exports + } + + if (hasOwnProperty.call(parsed, 'imports')) { + // @ts-expect-error: assume valid. + result.imports = parsed.imports + } + + // Ignore unknown types for forwards compatibility + if ( + hasOwnProperty.call(parsed, 'type') && + (parsed.type === 'commonjs' || parsed.type === 'module') + ) { + result.type = parsed.type + } + } + + cache.set(jsonPath, result) + + return result +} + +/** + * @param {URL | string} resolved + * @returns {PackageConfig} + */ +export function getPackageScopeConfig(resolved) { + // Note: in Node, this is now a native module. + let packageJSONUrl = new URL('package.json', resolved) + + while (true) { + const packageJSONPath = packageJSONUrl.pathname + if (packageJSONPath.endsWith('node_modules/package.json')) { + break + } + + const packageConfig = read(fileURLToPath(packageJSONUrl), { + specifier: resolved + }) + + if (packageConfig.exists) { + return packageConfig + } + + const lastPackageJSONUrl = packageJSONUrl + packageJSONUrl = new URL('../package.json', packageJSONUrl) + + // Terminates at root where ../package.json equals ../../package.json + // (can't just check "/package.json" for Windows support). + if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) { + break + } + } + + const packageJSONPath = fileURLToPath(packageJSONUrl) + // ^^ Note: in Node, this is now a native module. + + return { + pjsonPath: packageJSONPath, + exists: false, + type: 'none' + } +} + +/** + * Returns the package type for a given URL. + * @param {URL} url - The URL to get the package type for. + * @returns {PackageType} + */ +export function getPackageType(url) { + // To do @anonrig: Write a C++ function that returns only "type". + return getPackageScopeConfig(url).type +} diff --git a/node_modules/import-meta-resolve/lib/resolve.d.ts b/node_modules/import-meta-resolve/lib/resolve.d.ts new file mode 100644 index 00000000..1e82725c --- /dev/null +++ b/node_modules/import-meta-resolve/lib/resolve.d.ts @@ -0,0 +1,33 @@ +/// +/** + * The “Resolver Algorithm Specification” as detailed in the Node docs (which is + * sync and slightly lower-level than `resolve`). + * + * @param {string} specifier + * `/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`, etc. + * @param {URL} base + * Full URL (to a file) that `specifier` is resolved relative from. + * @param {Set} [conditions] + * Conditions. + * @param {boolean} [preserveSymlinks] + * Keep symlinks instead of resolving them. + * @returns {URL} + * A URL object to the found thing. + */ +export function moduleResolve(specifier: string, base: URL, conditions?: Set | undefined, preserveSymlinks?: boolean | undefined): URL; +/** + * @param {string} specifier + * @param {{parentURL?: string, conditions?: Array}} context + * @returns {{url: string, format?: string | null}} + */ +export function defaultResolve(specifier: string, context?: { + parentURL?: string; + conditions?: Array; +}): { + url: string; + format?: string | null; +}; +export type Stats = import('node:fs').Stats; +export type ErrnoException = import('./errors.js').ErrnoException; +export type PackageConfig = import('./package-json-reader.js').PackageConfig; +import { URL } from 'node:url'; diff --git a/node_modules/import-meta-resolve/lib/resolve.js b/node_modules/import-meta-resolve/lib/resolve.js new file mode 100644 index 00000000..ab9e757c --- /dev/null +++ b/node_modules/import-meta-resolve/lib/resolve.js @@ -0,0 +1,1297 @@ +// Manually “tree shaken” from: +// +// Last checked on: Apr 29, 2023. + +/** + * @typedef {import('node:fs').Stats} Stats + * @typedef {import('./errors.js').ErrnoException} ErrnoException + * @typedef {import('./package-json-reader.js').PackageConfig} PackageConfig + */ + +import assert from 'node:assert' +import {statSync, realpathSync} from 'node:fs' +import process from 'node:process' +import {URL, fileURLToPath, pathToFileURL} from 'node:url' +import path from 'node:path' +import {builtinModules} from 'node:module' +import {defaultGetFormatWithoutErrors} from './get-format.js' +import {codes} from './errors.js' +import {getPackageScopeConfig, read} from './package-json-reader.js' +import {getConditionsSet} from './utils.js' + +const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace] + +const { + ERR_NETWORK_IMPORT_DISALLOWED, + ERR_INVALID_MODULE_SPECIFIER, + ERR_INVALID_PACKAGE_CONFIG, + ERR_INVALID_PACKAGE_TARGET, + ERR_MODULE_NOT_FOUND, + ERR_PACKAGE_IMPORT_NOT_DEFINED, + ERR_PACKAGE_PATH_NOT_EXPORTED, + ERR_UNSUPPORTED_DIR_IMPORT, + ERR_UNSUPPORTED_RESOLVE_REQUEST +} = codes + +const own = {}.hasOwnProperty + +const invalidSegmentRegEx = + /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i +const deprecatedInvalidSegmentRegEx = + /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i +const invalidPackageNameRegEx = /^\.|%|\\/ +const patternRegEx = /\*/g +const encodedSeparatorRegEx = /%2f|%5c/i +/** @type {Set} */ +const emittedPackageWarnings = new Set() + +const doubleSlashRegEx = /[/\\]{2}/ + +/** + * + * @param {string} target + * @param {string} request + * @param {string} match + * @param {URL} packageJsonUrl + * @param {boolean} internal + * @param {URL} base + * @param {boolean} isTarget + */ +function emitInvalidSegmentDeprecation( + target, + request, + match, + packageJsonUrl, + internal, + base, + isTarget +) { + // @ts-expect-error: apparently it does exist, TS. + if (process.noDeprecation) { + return + } + + const pjsonPath = fileURLToPath(packageJsonUrl) + const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null + process.emitWarning( + `Use of deprecated ${ + double ? 'double slash' : 'leading or trailing slash matching' + } resolving "${target}" for module ` + + `request "${request}" ${ + request === match ? '' : `matched to "${match}" ` + }in the "${ + internal ? 'imports' : 'exports' + }" field module resolution of the package at ${pjsonPath}${ + base ? ` imported from ${fileURLToPath(base)}` : '' + }.`, + 'DeprecationWarning', + 'DEP0166' + ) +} + +/** + * @param {URL} url + * @param {URL} packageJsonUrl + * @param {URL} base + * @param {string} [main] + * @returns {void} + */ +function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) { + // @ts-expect-error: apparently it does exist, TS. + if (process.noDeprecation) { + return + } + + const format = defaultGetFormatWithoutErrors(url, {parentURL: base.href}) + if (format !== 'module') return + const urlPath = fileURLToPath(url.href) + const packagePath = fileURLToPath(new URL('.', packageJsonUrl)) + const basePath = fileURLToPath(base) + if (!main) { + process.emitWarning( + `No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice( + packagePath.length + )}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`, + 'DeprecationWarning', + 'DEP0151' + ) + } else if (path.resolve(packagePath, main) !== urlPath) { + process.emitWarning( + `Package ${packagePath} has a "main" field set to "${main}", ` + + `excluding the full filename and extension to the resolved file at "${urlPath.slice( + packagePath.length + )}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is ` + + 'deprecated for ES modules.', + 'DeprecationWarning', + 'DEP0151' + ) + } +} + +/** + * @param {string} path + * @returns {Stats | undefined} + */ +function tryStatSync(path) { + // Note: from Node 15 onwards we can use `throwIfNoEntry: false` instead. + try { + return statSync(path) + } catch { + // Note: in Node code this returns `new Stats`, + // but in Node 22 that’s marked as a deprecated internal API. + // Which, well, we kinda are, but still to prevent that warning, + // just yield `undefined`. + } +} + +/** + * Legacy CommonJS main resolution: + * 1. let M = pkg_url + (json main field) + * 2. TRY(M, M.js, M.json, M.node) + * 3. TRY(M/index.js, M/index.json, M/index.node) + * 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node) + * 5. NOT_FOUND + * + * @param {URL} url + * @returns {boolean} + */ +function fileExists(url) { + const stats = statSync(url, {throwIfNoEntry: false}) + const isFile = stats ? stats.isFile() : undefined + return isFile === null || isFile === undefined ? false : isFile +} + +/** + * @param {URL} packageJsonUrl + * @param {PackageConfig} packageConfig + * @param {URL} base + * @returns {URL} + */ +function legacyMainResolve(packageJsonUrl, packageConfig, base) { + /** @type {URL | undefined} */ + let guess + if (packageConfig.main !== undefined) { + guess = new URL(packageConfig.main, packageJsonUrl) + // Note: fs check redundances will be handled by Descriptor cache here. + if (fileExists(guess)) return guess + + const tries = [ + `./${packageConfig.main}.js`, + `./${packageConfig.main}.json`, + `./${packageConfig.main}.node`, + `./${packageConfig.main}/index.js`, + `./${packageConfig.main}/index.json`, + `./${packageConfig.main}/index.node` + ] + let i = -1 + + while (++i < tries.length) { + guess = new URL(tries[i], packageJsonUrl) + if (fileExists(guess)) break + guess = undefined + } + + if (guess) { + emitLegacyIndexDeprecation( + guess, + packageJsonUrl, + base, + packageConfig.main + ) + return guess + } + // Fallthrough. + } + + const tries = ['./index.js', './index.json', './index.node'] + let i = -1 + + while (++i < tries.length) { + guess = new URL(tries[i], packageJsonUrl) + if (fileExists(guess)) break + guess = undefined + } + + if (guess) { + emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main) + return guess + } + + // Not found. + throw new ERR_MODULE_NOT_FOUND( + fileURLToPath(new URL('.', packageJsonUrl)), + fileURLToPath(base) + ) +} + +/** + * @param {URL} resolved + * @param {URL} base + * @param {boolean} [preserveSymlinks] + * @returns {URL} + */ +function finalizeResolution(resolved, base, preserveSymlinks) { + if (encodedSeparatorRegEx.exec(resolved.pathname) !== null) { + throw new ERR_INVALID_MODULE_SPECIFIER( + resolved.pathname, + 'must not include encoded "/" or "\\" characters', + fileURLToPath(base) + ) + } + + /** @type {string} */ + let filePath + + try { + filePath = fileURLToPath(resolved) + } catch (error) { + const cause = /** @type {ErrnoException} */ (error) + Object.defineProperty(cause, 'input', {value: String(resolved)}) + Object.defineProperty(cause, 'module', {value: String(base)}) + throw cause + } + + const stats = tryStatSync( + filePath.endsWith('/') ? filePath.slice(-1) : filePath + ) + + if (stats && stats.isDirectory()) { + const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath(base)) + // @ts-expect-error Add this for `import.meta.resolve`. + error.url = String(resolved) + throw error + } + + if (!stats || !stats.isFile()) { + const error = new ERR_MODULE_NOT_FOUND( + filePath || resolved.pathname, + base && fileURLToPath(base), + true + ) + // @ts-expect-error Add this for `import.meta.resolve`. + error.url = String(resolved) + throw error + } + + if (!preserveSymlinks) { + const real = realpathSync(filePath) + const {search, hash} = resolved + resolved = pathToFileURL(real + (filePath.endsWith(path.sep) ? '/' : '')) + resolved.search = search + resolved.hash = hash + } + + return resolved +} + +/** + * @param {string} specifier + * @param {URL | undefined} packageJsonUrl + * @param {URL} base + * @returns {Error} + */ +function importNotDefined(specifier, packageJsonUrl, base) { + return new ERR_PACKAGE_IMPORT_NOT_DEFINED( + specifier, + packageJsonUrl && fileURLToPath(new URL('.', packageJsonUrl)), + fileURLToPath(base) + ) +} + +/** + * @param {string} subpath + * @param {URL} packageJsonUrl + * @param {URL} base + * @returns {Error} + */ +function exportsNotFound(subpath, packageJsonUrl, base) { + return new ERR_PACKAGE_PATH_NOT_EXPORTED( + fileURLToPath(new URL('.', packageJsonUrl)), + subpath, + base && fileURLToPath(base) + ) +} + +/** + * @param {string} request + * @param {string} match + * @param {URL} packageJsonUrl + * @param {boolean} internal + * @param {URL} [base] + * @returns {never} + */ +function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) { + const reason = `request is not a valid match in pattern "${match}" for the "${ + internal ? 'imports' : 'exports' + }" resolution of ${fileURLToPath(packageJsonUrl)}` + throw new ERR_INVALID_MODULE_SPECIFIER( + request, + reason, + base && fileURLToPath(base) + ) +} + +/** + * @param {string} subpath + * @param {unknown} target + * @param {URL} packageJsonUrl + * @param {boolean} internal + * @param {URL} [base] + * @returns {Error} + */ +function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) { + target = + typeof target === 'object' && target !== null + ? JSON.stringify(target, null, '') + : `${target}` + + return new ERR_INVALID_PACKAGE_TARGET( + fileURLToPath(new URL('.', packageJsonUrl)), + subpath, + target, + internal, + base && fileURLToPath(base) + ) +} + +/** + * @param {string} target + * @param {string} subpath + * @param {string} match + * @param {URL} packageJsonUrl + * @param {URL} base + * @param {boolean} pattern + * @param {boolean} internal + * @param {boolean} isPathMap + * @param {Set | undefined} conditions + * @returns {URL} + */ +function resolvePackageTargetString( + target, + subpath, + match, + packageJsonUrl, + base, + pattern, + internal, + isPathMap, + conditions +) { + if (subpath !== '' && !pattern && target[target.length - 1] !== '/') + throw invalidPackageTarget(match, target, packageJsonUrl, internal, base) + + if (!target.startsWith('./')) { + if (internal && !target.startsWith('../') && !target.startsWith('/')) { + let isURL = false + + try { + new URL(target) + isURL = true + } catch { + // Continue regardless of error. + } + + if (!isURL) { + const exportTarget = pattern + ? RegExpPrototypeSymbolReplace.call( + patternRegEx, + target, + () => subpath + ) + : target + subpath + + return packageResolve(exportTarget, packageJsonUrl, conditions) + } + } + + throw invalidPackageTarget(match, target, packageJsonUrl, internal, base) + } + + if (invalidSegmentRegEx.exec(target.slice(2)) !== null) { + if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) { + if (!isPathMap) { + const request = pattern + ? match.replace('*', () => subpath) + : match + subpath + const resolvedTarget = pattern + ? RegExpPrototypeSymbolReplace.call( + patternRegEx, + target, + () => subpath + ) + : target + emitInvalidSegmentDeprecation( + resolvedTarget, + request, + match, + packageJsonUrl, + internal, + base, + true + ) + } + } else { + throw invalidPackageTarget(match, target, packageJsonUrl, internal, base) + } + } + + const resolved = new URL(target, packageJsonUrl) + const resolvedPath = resolved.pathname + const packagePath = new URL('.', packageJsonUrl).pathname + + if (!resolvedPath.startsWith(packagePath)) + throw invalidPackageTarget(match, target, packageJsonUrl, internal, base) + + if (subpath === '') return resolved + + if (invalidSegmentRegEx.exec(subpath) !== null) { + const request = pattern + ? match.replace('*', () => subpath) + : match + subpath + if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) { + if (!isPathMap) { + const resolvedTarget = pattern + ? RegExpPrototypeSymbolReplace.call( + patternRegEx, + target, + () => subpath + ) + : target + emitInvalidSegmentDeprecation( + resolvedTarget, + request, + match, + packageJsonUrl, + internal, + base, + false + ) + } + } else { + throwInvalidSubpath(request, match, packageJsonUrl, internal, base) + } + } + + if (pattern) { + return new URL( + RegExpPrototypeSymbolReplace.call( + patternRegEx, + resolved.href, + () => subpath + ) + ) + } + + return new URL(subpath, resolved) +} + +/** + * @param {string} key + * @returns {boolean} + */ +function isArrayIndex(key) { + const keyNumber = Number(key) + if (`${keyNumber}` !== key) return false + return keyNumber >= 0 && keyNumber < 0xff_ff_ff_ff +} + +/** + * @param {URL} packageJsonUrl + * @param {unknown} target + * @param {string} subpath + * @param {string} packageSubpath + * @param {URL} base + * @param {boolean} pattern + * @param {boolean} internal + * @param {boolean} isPathMap + * @param {Set | undefined} conditions + * @returns {URL | null} + */ +function resolvePackageTarget( + packageJsonUrl, + target, + subpath, + packageSubpath, + base, + pattern, + internal, + isPathMap, + conditions +) { + if (typeof target === 'string') { + return resolvePackageTargetString( + target, + subpath, + packageSubpath, + packageJsonUrl, + base, + pattern, + internal, + isPathMap, + conditions + ) + } + + if (Array.isArray(target)) { + /** @type {Array} */ + const targetList = target + if (targetList.length === 0) return null + + /** @type {ErrnoException | null | undefined} */ + let lastException + let i = -1 + + while (++i < targetList.length) { + const targetItem = targetList[i] + /** @type {URL | null} */ + let resolveResult + try { + resolveResult = resolvePackageTarget( + packageJsonUrl, + targetItem, + subpath, + packageSubpath, + base, + pattern, + internal, + isPathMap, + conditions + ) + } catch (error) { + const exception = /** @type {ErrnoException} */ (error) + lastException = exception + if (exception.code === 'ERR_INVALID_PACKAGE_TARGET') continue + throw error + } + + if (resolveResult === undefined) continue + + if (resolveResult === null) { + lastException = null + continue + } + + return resolveResult + } + + if (lastException === undefined || lastException === null) { + return null + } + + throw lastException + } + + if (typeof target === 'object' && target !== null) { + const keys = Object.getOwnPropertyNames(target) + let i = -1 + + while (++i < keys.length) { + const key = keys[i] + if (isArrayIndex(key)) { + throw new ERR_INVALID_PACKAGE_CONFIG( + fileURLToPath(packageJsonUrl), + base, + '"exports" cannot contain numeric property keys.' + ) + } + } + + i = -1 + + while (++i < keys.length) { + const key = keys[i] + if (key === 'default' || (conditions && conditions.has(key))) { + // @ts-expect-error: indexable. + const conditionalTarget = /** @type {unknown} */ (target[key]) + const resolveResult = resolvePackageTarget( + packageJsonUrl, + conditionalTarget, + subpath, + packageSubpath, + base, + pattern, + internal, + isPathMap, + conditions + ) + if (resolveResult === undefined) continue + return resolveResult + } + } + + return null + } + + if (target === null) { + return null + } + + throw invalidPackageTarget( + packageSubpath, + target, + packageJsonUrl, + internal, + base + ) +} + +/** + * @param {unknown} exports + * @param {URL} packageJsonUrl + * @param {URL} base + * @returns {boolean} + */ +function isConditionalExportsMainSugar(exports, packageJsonUrl, base) { + if (typeof exports === 'string' || Array.isArray(exports)) return true + if (typeof exports !== 'object' || exports === null) return false + + const keys = Object.getOwnPropertyNames(exports) + let isConditionalSugar = false + let i = 0 + let keyIndex = -1 + while (++keyIndex < keys.length) { + const key = keys[keyIndex] + const currentIsConditionalSugar = key === '' || key[0] !== '.' + if (i++ === 0) { + isConditionalSugar = currentIsConditionalSugar + } else if (isConditionalSugar !== currentIsConditionalSugar) { + throw new ERR_INVALID_PACKAGE_CONFIG( + fileURLToPath(packageJsonUrl), + base, + '"exports" cannot contain some keys starting with \'.\' and some not.' + + ' The exports object must either be an object of package subpath keys' + + ' or an object of main entry condition name keys only.' + ) + } + } + + return isConditionalSugar +} + +/** + * @param {string} match + * @param {URL} pjsonUrl + * @param {URL} base + */ +function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) { + // @ts-expect-error: apparently it does exist, TS. + if (process.noDeprecation) { + return + } + + const pjsonPath = fileURLToPath(pjsonUrl) + if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return + emittedPackageWarnings.add(pjsonPath + '|' + match) + process.emitWarning( + `Use of deprecated trailing slash pattern mapping "${match}" in the ` + + `"exports" field module resolution of the package at ${pjsonPath}${ + base ? ` imported from ${fileURLToPath(base)}` : '' + }. Mapping specifiers ending in "/" is no longer supported.`, + 'DeprecationWarning', + 'DEP0155' + ) +} + +/** + * @param {URL} packageJsonUrl + * @param {string} packageSubpath + * @param {Record} packageConfig + * @param {URL} base + * @param {Set | undefined} conditions + * @returns {URL} + */ +function packageExportsResolve( + packageJsonUrl, + packageSubpath, + packageConfig, + base, + conditions +) { + let exports = packageConfig.exports + + if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) { + exports = {'.': exports} + } + + if ( + own.call(exports, packageSubpath) && + !packageSubpath.includes('*') && + !packageSubpath.endsWith('/') + ) { + // @ts-expect-error: indexable. + const target = exports[packageSubpath] + const resolveResult = resolvePackageTarget( + packageJsonUrl, + target, + '', + packageSubpath, + base, + false, + false, + false, + conditions + ) + if (resolveResult === null || resolveResult === undefined) { + throw exportsNotFound(packageSubpath, packageJsonUrl, base) + } + + return resolveResult + } + + let bestMatch = '' + let bestMatchSubpath = '' + const keys = Object.getOwnPropertyNames(exports) + let i = -1 + + while (++i < keys.length) { + const key = keys[i] + const patternIndex = key.indexOf('*') + + if ( + patternIndex !== -1 && + packageSubpath.startsWith(key.slice(0, patternIndex)) + ) { + // When this reaches EOL, this can throw at the top of the whole function: + // + // if (StringPrototypeEndsWith(packageSubpath, '/')) + // throwInvalidSubpath(packageSubpath) + // + // To match "imports" and the spec. + if (packageSubpath.endsWith('/')) { + emitTrailingSlashPatternDeprecation( + packageSubpath, + packageJsonUrl, + base + ) + } + + const patternTrailer = key.slice(patternIndex + 1) + + if ( + packageSubpath.length >= key.length && + packageSubpath.endsWith(patternTrailer) && + patternKeyCompare(bestMatch, key) === 1 && + key.lastIndexOf('*') === patternIndex + ) { + bestMatch = key + bestMatchSubpath = packageSubpath.slice( + patternIndex, + packageSubpath.length - patternTrailer.length + ) + } + } + } + + if (bestMatch) { + // @ts-expect-error: indexable. + const target = /** @type {unknown} */ (exports[bestMatch]) + const resolveResult = resolvePackageTarget( + packageJsonUrl, + target, + bestMatchSubpath, + bestMatch, + base, + true, + false, + packageSubpath.endsWith('/'), + conditions + ) + + if (resolveResult === null || resolveResult === undefined) { + throw exportsNotFound(packageSubpath, packageJsonUrl, base) + } + + return resolveResult + } + + throw exportsNotFound(packageSubpath, packageJsonUrl, base) +} + +/** + * @param {string} a + * @param {string} b + */ +function patternKeyCompare(a, b) { + const aPatternIndex = a.indexOf('*') + const bPatternIndex = b.indexOf('*') + const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1 + const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1 + if (baseLengthA > baseLengthB) return -1 + if (baseLengthB > baseLengthA) return 1 + if (aPatternIndex === -1) return 1 + if (bPatternIndex === -1) return -1 + if (a.length > b.length) return -1 + if (b.length > a.length) return 1 + return 0 +} + +/** + * @param {string} name + * @param {URL} base + * @param {Set} [conditions] + * @returns {URL} + */ +function packageImportsResolve(name, base, conditions) { + if (name === '#' || name.startsWith('#/') || name.endsWith('/')) { + const reason = 'is not a valid internal imports specifier name' + throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base)) + } + + /** @type {URL | undefined} */ + let packageJsonUrl + + const packageConfig = getPackageScopeConfig(base) + + if (packageConfig.exists) { + packageJsonUrl = pathToFileURL(packageConfig.pjsonPath) + const imports = packageConfig.imports + if (imports) { + if (own.call(imports, name) && !name.includes('*')) { + const resolveResult = resolvePackageTarget( + packageJsonUrl, + imports[name], + '', + name, + base, + false, + true, + false, + conditions + ) + if (resolveResult !== null && resolveResult !== undefined) { + return resolveResult + } + } else { + let bestMatch = '' + let bestMatchSubpath = '' + const keys = Object.getOwnPropertyNames(imports) + let i = -1 + + while (++i < keys.length) { + const key = keys[i] + const patternIndex = key.indexOf('*') + + if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) { + const patternTrailer = key.slice(patternIndex + 1) + if ( + name.length >= key.length && + name.endsWith(patternTrailer) && + patternKeyCompare(bestMatch, key) === 1 && + key.lastIndexOf('*') === patternIndex + ) { + bestMatch = key + bestMatchSubpath = name.slice( + patternIndex, + name.length - patternTrailer.length + ) + } + } + } + + if (bestMatch) { + const target = imports[bestMatch] + const resolveResult = resolvePackageTarget( + packageJsonUrl, + target, + bestMatchSubpath, + bestMatch, + base, + true, + true, + false, + conditions + ) + + if (resolveResult !== null && resolveResult !== undefined) { + return resolveResult + } + } + } + } + } + + throw importNotDefined(name, packageJsonUrl, base) +} + +/** + * @param {string} specifier + * @param {URL} base + */ +function parsePackageName(specifier, base) { + let separatorIndex = specifier.indexOf('/') + let validPackageName = true + let isScoped = false + if (specifier[0] === '@') { + isScoped = true + if (separatorIndex === -1 || specifier.length === 0) { + validPackageName = false + } else { + separatorIndex = specifier.indexOf('/', separatorIndex + 1) + } + } + + const packageName = + separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex) + + // Package name cannot have leading . and cannot have percent-encoding or + // \\ separators. + if (invalidPackageNameRegEx.exec(packageName) !== null) { + validPackageName = false + } + + if (!validPackageName) { + throw new ERR_INVALID_MODULE_SPECIFIER( + specifier, + 'is not a valid package name', + fileURLToPath(base) + ) + } + + const packageSubpath = + '.' + (separatorIndex === -1 ? '' : specifier.slice(separatorIndex)) + + return {packageName, packageSubpath, isScoped} +} + +/** + * @param {string} specifier + * @param {URL} base + * @param {Set | undefined} conditions + * @returns {URL} + */ +function packageResolve(specifier, base, conditions) { + if (builtinModules.includes(specifier)) { + return new URL('node:' + specifier) + } + + const {packageName, packageSubpath, isScoped} = parsePackageName( + specifier, + base + ) + + // ResolveSelf + const packageConfig = getPackageScopeConfig(base) + + // Can’t test. + /* c8 ignore next 16 */ + if (packageConfig.exists) { + const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath) + if ( + packageConfig.name === packageName && + packageConfig.exports !== undefined && + packageConfig.exports !== null + ) { + return packageExportsResolve( + packageJsonUrl, + packageSubpath, + packageConfig, + base, + conditions + ) + } + } + + let packageJsonUrl = new URL( + './node_modules/' + packageName + '/package.json', + base + ) + let packageJsonPath = fileURLToPath(packageJsonUrl) + /** @type {string} */ + let lastPath + do { + const stat = tryStatSync(packageJsonPath.slice(0, -13)) + if (!stat || !stat.isDirectory()) { + lastPath = packageJsonPath + packageJsonUrl = new URL( + (isScoped ? '../../../../node_modules/' : '../../../node_modules/') + + packageName + + '/package.json', + packageJsonUrl + ) + packageJsonPath = fileURLToPath(packageJsonUrl) + continue + } + + // Package match. + const packageConfig = read(packageJsonPath, {base, specifier}) + if (packageConfig.exports !== undefined && packageConfig.exports !== null) { + return packageExportsResolve( + packageJsonUrl, + packageSubpath, + packageConfig, + base, + conditions + ) + } + + if (packageSubpath === '.') { + return legacyMainResolve(packageJsonUrl, packageConfig, base) + } + + return new URL(packageSubpath, packageJsonUrl) + // Cross-platform root check. + } while (packageJsonPath.length !== lastPath.length) + + throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), false) +} + +/** + * @param {string} specifier + * @returns {boolean} + */ +function isRelativeSpecifier(specifier) { + if (specifier[0] === '.') { + if (specifier.length === 1 || specifier[1] === '/') return true + if ( + specifier[1] === '.' && + (specifier.length === 2 || specifier[2] === '/') + ) { + return true + } + } + + return false +} + +/** + * @param {string} specifier + * @returns {boolean} + */ +function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { + if (specifier === '') return false + if (specifier[0] === '/') return true + return isRelativeSpecifier(specifier) +} + +/** + * The “Resolver Algorithm Specification” as detailed in the Node docs (which is + * sync and slightly lower-level than `resolve`). + * + * @param {string} specifier + * `/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`, etc. + * @param {URL} base + * Full URL (to a file) that `specifier` is resolved relative from. + * @param {Set} [conditions] + * Conditions. + * @param {boolean} [preserveSymlinks] + * Keep symlinks instead of resolving them. + * @returns {URL} + * A URL object to the found thing. + */ +export function moduleResolve(specifier, base, conditions, preserveSymlinks) { + // Note: The Node code supports `base` as a string (in this internal API) too, + // we don’t. + const protocol = base.protocol + const isData = protocol === 'data:' + const isRemote = isData || protocol === 'http:' || protocol === 'https:' + // Order swapped from spec for minor perf gain. + // Ok since relative URLs cannot parse as URLs. + /** @type {URL | undefined} */ + let resolved + + if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { + try { + resolved = new URL(specifier, base) + } catch (error_) { + const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base) + error.cause = error_ + throw error + } + } else if (protocol === 'file:' && specifier[0] === '#') { + resolved = packageImportsResolve(specifier, base, conditions) + } else { + try { + resolved = new URL(specifier) + } catch (error_) { + // Note: actual code uses `canBeRequiredWithoutScheme`. + if (isRemote && !builtinModules.includes(specifier)) { + const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base) + error.cause = error_ + throw error + } + + resolved = packageResolve(specifier, base, conditions) + } + } + + assert(resolved !== undefined, 'expected to be defined') + + if (resolved.protocol !== 'file:') { + return resolved + } + + return finalizeResolution(resolved, base, preserveSymlinks) +} + +/** + * @param {string} specifier + * @param {URL | undefined} parsed + * @param {URL | undefined} parsedParentURL + */ +function checkIfDisallowedImport(specifier, parsed, parsedParentURL) { + if (parsedParentURL) { + // Avoid accessing the `protocol` property due to the lazy getters. + const parentProtocol = parsedParentURL.protocol + + if (parentProtocol === 'http:' || parentProtocol === 'https:') { + if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { + // Avoid accessing the `protocol` property due to the lazy getters. + const parsedProtocol = parsed?.protocol + + // `data:` and `blob:` disallowed due to allowing file: access via + // indirection + if ( + parsedProtocol && + parsedProtocol !== 'https:' && + parsedProtocol !== 'http:' + ) { + throw new ERR_NETWORK_IMPORT_DISALLOWED( + specifier, + parsedParentURL, + 'remote imports cannot import from a local location.' + ) + } + + return {url: parsed?.href || ''} + } + + if (builtinModules.includes(specifier)) { + throw new ERR_NETWORK_IMPORT_DISALLOWED( + specifier, + parsedParentURL, + 'remote imports cannot import from a local location.' + ) + } + + throw new ERR_NETWORK_IMPORT_DISALLOWED( + specifier, + parsedParentURL, + 'only relative and absolute specifiers are supported.' + ) + } + } +} + +// Note: this is from: +// +/** + * Checks if a value has the shape of a WHATWG URL object. + * + * Using a symbol or instanceof would not be able to recognize URL objects + * coming from other implementations (e.g. in Electron), so instead we are + * checking some well known properties for a lack of a better test. + * + * We use `href` and `protocol` as they are the only properties that are + * easy to retrieve and calculate due to the lazy nature of the getters. + * + * @template {unknown} Value + * @param {Value} self + * @returns {Value is URL} + */ +function isURL(self) { + return Boolean( + self && + typeof self === 'object' && + 'href' in self && + typeof self.href === 'string' && + 'protocol' in self && + typeof self.protocol === 'string' && + self.href && + self.protocol + ) +} + +/** + * Validate user-input in `context` supplied by a custom loader. + * + * @param {unknown} parentURL + * @returns {asserts parentURL is URL | string | undefined} + */ +function throwIfInvalidParentURL(parentURL) { + if (parentURL === undefined) { + return // Main entry point, so no parent + } + + if (typeof parentURL !== 'string' && !isURL(parentURL)) { + throw new codes.ERR_INVALID_ARG_TYPE( + 'parentURL', + ['string', 'URL'], + parentURL + ) + } +} + +/** + * @param {string} specifier + * @param {{parentURL?: string, conditions?: Array}} context + * @returns {{url: string, format?: string | null}} + */ +export function defaultResolve(specifier, context = {}) { + const {parentURL} = context + assert(parentURL !== undefined, 'expected `parentURL` to be defined') + throwIfInvalidParentURL(parentURL) + + /** @type {URL | undefined} */ + let parsedParentURL + if (parentURL) { + try { + parsedParentURL = new URL(parentURL) + } catch { + // Ignore exception + } + } + + /** @type {URL | undefined} */ + let parsed + /** @type {string | undefined} */ + let protocol + + try { + parsed = shouldBeTreatedAsRelativeOrAbsolutePath(specifier) + ? new URL(specifier, parsedParentURL) + : new URL(specifier) + + // Avoid accessing the `protocol` property due to the lazy getters. + protocol = parsed.protocol + + if (protocol === 'data:') { + return {url: parsed.href, format: null} + } + } catch { + // Ignore exception + } + + // There are multiple deep branches that can either throw or return; instead + // of duplicating that deeply nested logic for the possible returns, DRY and + // check for a return. This seems the least gnarly. + const maybeReturn = checkIfDisallowedImport( + specifier, + parsed, + parsedParentURL + ) + + if (maybeReturn) return maybeReturn + + // This must come after checkIfDisallowedImport + if (protocol === undefined && parsed) { + protocol = parsed.protocol + } + + if (protocol === 'node:') { + return {url: specifier} + } + + // This must come after checkIfDisallowedImport + if (parsed && parsed.protocol === 'node:') return {url: specifier} + + const conditions = getConditionsSet(context.conditions) + + const url = moduleResolve(specifier, new URL(parentURL), conditions, false) + + return { + // Do NOT cast `url` to a string: that will work even when there are real + // problems, silencing them + url: url.href, + format: defaultGetFormatWithoutErrors(url, {parentURL}) + } +} diff --git a/node_modules/import-meta-resolve/lib/utils.d.ts b/node_modules/import-meta-resolve/lib/utils.d.ts new file mode 100644 index 00000000..d274df33 --- /dev/null +++ b/node_modules/import-meta-resolve/lib/utils.d.ts @@ -0,0 +1,5 @@ +/** + * @param {Array} [conditions] + * @returns {Set} + */ +export function getConditionsSet(conditions?: string[] | undefined): Set; diff --git a/node_modules/import-meta-resolve/lib/utils.js b/node_modules/import-meta-resolve/lib/utils.js new file mode 100644 index 00000000..3281c9e6 --- /dev/null +++ b/node_modules/import-meta-resolve/lib/utils.js @@ -0,0 +1,47 @@ +// Manually “tree shaken” from: +// +// Last checked on: Apr 29, 2023. + +import {codes} from './errors.js' + +const {ERR_INVALID_ARG_VALUE} = codes + +// In Node itself these values are populated from CLI arguments, before any +// user code runs. +// Here we just define the defaults. +const DEFAULT_CONDITIONS = Object.freeze(['node', 'import']) +const DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS) + +/** + * Returns the default conditions for ES module loading. + */ +function getDefaultConditions() { + return DEFAULT_CONDITIONS +} + +/** + * Returns the default conditions for ES module loading, as a Set. + */ +function getDefaultConditionsSet() { + return DEFAULT_CONDITIONS_SET +} + +/** + * @param {Array} [conditions] + * @returns {Set} + */ +export function getConditionsSet(conditions) { + if (conditions !== undefined && conditions !== getDefaultConditions()) { + if (!Array.isArray(conditions)) { + throw new ERR_INVALID_ARG_VALUE( + 'conditions', + conditions, + 'expected an array' + ) + } + + return new Set(conditions) + } + + return getDefaultConditionsSet() +} diff --git a/node_modules/import-meta-resolve/license b/node_modules/import-meta-resolve/license new file mode 100644 index 00000000..1eb656ff --- /dev/null +++ b/node_modules/import-meta-resolve/license @@ -0,0 +1,74 @@ +(The MIT License) + +Copyright (c) 2021 Titus Wormer + +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 is a derivative work based on: +. +Which is licensed: + +""" +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/import-meta-resolve/package.json b/node_modules/import-meta-resolve/package.json new file mode 100644 index 00000000..e7364d51 --- /dev/null +++ b/node_modules/import-meta-resolve/package.json @@ -0,0 +1,95 @@ +{ + "name": "import-meta-resolve", + "version": "4.1.0", + "description": "Resolve things like Node.js — ponyfill for `import.meta.resolve`", + "license": "MIT", + "keywords": [ + "resolve", + "node", + "esm", + "module" + ], + "repository": "wooorm/import-meta-resolve", + "bugs": "https://github.com/wooorm/import-meta-resolve/issues", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "main": "index.js", + "types": "index.d.ts", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "devDependencies": { + "@types/node": "^20.0.0", + "@types/semver": "^7.0.0", + "c8": "^9.0.0", + "f-ck": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "semver": "^7.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run generate && npm run build && npm run format", + "generate": "node --conditions development script.js", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api": "node --experimental-import-meta-resolve test/baseline.js && node --experimental-import-meta-resolve test/baseline-async.js && node test/index.js", + "test-coverage": "c8 --check-coverage --branches 75 --functions 75 --lines 75 --statements 75 --reporter lcov npm run test-api", + "test": "npm run generate && npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": false, + "trailingComma": "none" + }, + "xo": { + "prettier": true, + "rules": { + "complexity": "off", + "max-depth": "off", + "max-params": "off", + "no-constant-condition": "off", + "no-new": "off", + "prefer-arrow-callback": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-string-replace-all": "off" + }, + "ignore": [ + "test/node_modules/" + ] + }, + "remarkConfig": { + "plugins": [ + "preset-wooorm", + [ + "remark-lint-maximum-heading-length", + false + ] + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true, + "ignoreFiles": [ + "lib/errors.d.ts" + ] + } +} diff --git a/node_modules/import-meta-resolve/readme.md b/node_modules/import-meta-resolve/readme.md new file mode 100644 index 00000000..14536c02 --- /dev/null +++ b/node_modules/import-meta-resolve/readme.md @@ -0,0 +1,252 @@ +# import-meta-resolve + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] + +Resolve things like Node.js. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this?](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`resolve(specifier, parent)`](#resolvespecifier-parent) + * [`moduleResolve(specifier, parent, conditions, preserveSymlinks)`](#moduleresolvespecifier-parent-conditions-preservesymlinks) + * [`ErrnoException`](#errnoexception) +* [Algorithm](#algorithm) +* [Differences to Node](#differences-to-node) +* [Types](#types) +* [Compatibility](#compatibility) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package is a ponyfill for [`import.meta.resolve`][native-resolve]. +It supports everything you need to resolve files just like modern Node does: +import maps, export maps, loading CJS and ESM projects, all of that! + +## When to use this? + +As of Node.js 20.0, `import.meta.resolve` is still behind an experimental flag. +This package can be used to do what it does in Node 16–20. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install import-meta-resolve +``` + +## Use + +```js +import {resolve} from 'import-meta-resolve' + +// A file: +console.log(resolve('./index.js', import.meta.url)) +//=> file:///Users/tilde/Projects/oss/import-meta-resolve/index.js + +// A CJS package: +console.log(resolve('builtins', import.meta.url)) +//=> file:///Users/tilde/Projects/oss/import-meta-resolve/node_modules/builtins/index.js + +// A scoped CJS package: +console.log(resolve('@eslint/eslintrc', import.meta.url)) +//=> file:///Users/tilde/Projects/oss/import-meta-resolve/node_modules/@eslint/eslintrc/lib/index.js + +// A package with an export map: +console.log(resolve('micromark/lib/parse', import.meta.url)) +//=> file:///Users/tilde/Projects/oss/import-meta-resolve/node_modules/micromark/lib/parse.js + +// A node builtin: +console.log(resolve('fs', import.meta.url)) +//=> node:fs +``` + +## API + +This package exports the identifiers [`moduleResolve`][moduleresolve] and +[`resolve`][resolve]. +There is no default export. + +### `resolve(specifier, parent)` + +Match `import.meta.resolve` except that `parent` is required (you can pass +`import.meta.url`). + +###### Parameters + +* `specifier` (`string`) + — the module specifier to resolve relative to parent + (`/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`, etc) +* `parent` (`string`, example: `import.meta.url`) + — the absolute parent module URL to resolve from; you must pass + `import.meta.url` or something else + +###### Returns + +Full `file:`, `data:`, or `node:` URL (`string`) to the found thing + +###### Throws + +Throws an [`ErrnoException`][errnoexception]. + +### `moduleResolve(specifier, parent, conditions, preserveSymlinks)` + +The [“Resolver Algorithm Specification”][algo] as detailed in the Node docs +(which is slightly lower-level than `resolve`). + +###### Parameters + +* `specifier` (`string`) + — `/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`, etc +* `parent` (`URL`, example: `import.meta.url`) + — full URL (to a file) that `specifier` is resolved relative from +* `conditions` (`Set`, default: `new Set(['node', 'import'])`) + — conditions +* `preserveSymlinks` (`boolean`, default: `false`) + — keep symlinks instead of resolving them + +###### Returns + +A URL object (`URL`) to the found thing. + +###### Throws + +Throws an [`ErrnoException`][errnoexception]. + +### `ErrnoException` + +One of many different errors that occur when resolving (TypeScript type). + +###### Type + +```ts +type ErrnoExceptionFields = Error & { + errnode?: number | undefined + code?: string | undefined + path?: string | undefined + syscall?: string | undefined + url?: string | undefined +} +``` + +The `code` field on errors is one of the following strings: + +* `'ERR_INVALID_MODULE_SPECIFIER'` + — when `specifier` is invalid (example: `'#'`) +* `'ERR_INVALID_PACKAGE_CONFIG'` + — when a `package.json` is invalid (example: invalid JSON) +* `'ERR_INVALID_PACKAGE_TARGET'` + — when a `package.json` `exports` or `imports` is invalid (example: when it + does not start with `'./'`) +* `'ERR_MODULE_NOT_FOUND'` + — when `specifier` cannot be found in `parent` (example: `'some-missing-package'`) +* `'ERR_NETWORK_IMPORT_DISALLOWED'` + — thrown when trying to resolve a local file or builtin from a remote file + (`node:fs` relative to `'https://example.com'`) +* `'ERR_PACKAGE_IMPORT_NOT_DEFINED'` + — when a local import is not defined in an import map (example: `'#local'` + when not defined) +* `'ERR_PACKAGE_PATH_NOT_EXPORTED'` + — when an export is not defined in an export map (example: `'tape/index.js'`, + which is not in its export map) +* `'ERR_UNSUPPORTED_DIR_IMPORT'` + — when attempting to import a directory (example: `'./lib/'`) +* `'ERR_UNKNOWN_FILE_EXTENSION'` + — when somehow reading a file that has an unexpected extensions (`'./readme.md'`) +* `'ERR_INVALID_ARG_VALUE'` + — when `conditions` is incorrect + +## Algorithm + +The algorithm for `resolve` matches how Node handles `import.meta.resolve`, with +a couple of differences. + +The algorithm for `moduleResolve` matches the [Resolver Algorithm +Specification][algo] as detailed in the Node docs (which is sync and slightly +lower-level than `resolve`). + +## Differences to Node + +* `parent` defaulting to `import.meta.url` cannot be ponyfilled: you have to + explicitly pass it +* no support for loaders (that would mean implementing all of loaders) +* no support for CLI flags: + `--conditions`, + `--experimental-default-type`, + `--experimental-json-modules`, + `--experimental-network-imports`, + `--experimental-policy`, + `--experimental-wasm-modules`, + `--input-type`, + `--no-addons`, + `--preserve-symlinks`, nor + `--preserve-symlinks-main` + work +* no support for `WATCH_REPORT_DEPENDENCIES` env variable +* no attempt is made to add a suggestion based on how things used to work in + CJS before to not-found errors +* prototypal methods are not guarded: Node protects for example `String#slice` + or so from being tampered with, whereas this doesn’t + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`ErrnoException`][errnoexception]. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 16 and later. + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + +## License + +[MIT][license] © [Titus Wormer][author] and Node.js contributors + + + +[build-badge]: https://github.com/wooorm/import-meta-resolve/workflows/main/badge.svg + +[build]: https://github.com/wooorm/import-meta-resolve/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/import-meta-resolve.svg + +[coverage]: https://codecov.io/github/wooorm/import-meta-resolve + +[downloads-badge]: https://img.shields.io/npm/dm/import-meta-resolve.svg + +[downloads]: https://www.npmjs.com/package/import-meta-resolve + +[npm]: https://docs.npmjs.com/cli/install + +[license]: license + +[author]: https://wooorm.com + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + +[algo]: https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_resolver_algorithm + +[native-resolve]: https://nodejs.org/api/esm.html#esm_import_meta_resolve_specifier_parent + +[resolve]: #resolvespecifier-parent + +[moduleresolve]: #moduleResolvespecifier-parent-conditions-preserveSymlinks + +[errnoexception]: #errnoexception diff --git a/node_modules/inflight/LICENSE b/node_modules/inflight/LICENSE new file mode 100644 index 00000000..05eeeb88 --- /dev/null +++ b/node_modules/inflight/LICENSE @@ -0,0 +1,15 @@ +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/README.md b/node_modules/inflight/README.md new file mode 100644 index 00000000..6dc89291 --- /dev/null +++ b/node_modules/inflight/README.md @@ -0,0 +1,37 @@ +# inflight + +Add callbacks to requests in flight to avoid async duplication + +## USAGE + +```javascript +var inflight = require('inflight') + +// some request that does some stuff +function req(key, callback) { + // key is any random string. like a url or filename or whatever. + // + // will return either a falsey value, indicating that the + // request for this key is already in flight, or a new callback + // which when called will call all callbacks passed to inflightk + // with the same key + callback = inflight(key, callback) + + // If we got a falsey value back, then there's already a req going + if (!callback) return + + // this is where you'd fetch the url or whatever + // callback is also once()-ified, so it can safely be assigned + // to multiple events etc. First call wins. + setTimeout(function() { + callback(null, key) + }, 100) +} + +// only assigns a single setTimeout +// when it dings, all cbs get called +req('foo', cb1) +req('foo', cb2) +req('foo', cb3) +req('foo', cb4) +``` diff --git a/node_modules/inflight/inflight.js b/node_modules/inflight/inflight.js new file mode 100644 index 00000000..48202b3c --- /dev/null +++ b/node_modules/inflight/inflight.js @@ -0,0 +1,54 @@ +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 new file mode 100644 index 00000000..6084d350 --- /dev/null +++ b/node_modules/inflight/package.json @@ -0,0 +1,29 @@ +{ + "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 new file mode 100644 index 00000000..dea3013d --- /dev/null +++ b/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +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/README.md b/node_modules/inherits/README.md new file mode 100644 index 00000000..b1c56658 --- /dev/null +++ b/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/node_modules/inherits/inherits.js b/node_modules/inherits/inherits.js new file mode 100644 index 00000000..f71f2d93 --- /dev/null +++ b/node_modules/inherits/inherits.js @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..86bbb3dc --- /dev/null +++ b/node_modules/inherits/inherits_browser.js @@ -0,0 +1,27 @@ +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 new file mode 100644 index 00000000..37b4366b --- /dev/null +++ b/node_modules/inherits/package.json @@ -0,0 +1,29 @@ +{ + "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/is-binary-path/index.d.ts b/node_modules/is-binary-path/index.d.ts new file mode 100644 index 00000000..19dcd432 --- /dev/null +++ b/node_modules/is-binary-path/index.d.ts @@ -0,0 +1,17 @@ +/** +Check if a file path is a binary file. + +@example +``` +import isBinaryPath = require('is-binary-path'); + +isBinaryPath('source/unicorn.png'); +//=> true + +isBinaryPath('source/unicorn.txt'); +//=> false +``` +*/ +declare function isBinaryPath(filePath: string): boolean; + +export = isBinaryPath; diff --git a/node_modules/is-binary-path/index.js b/node_modules/is-binary-path/index.js new file mode 100644 index 00000000..ef7548c8 --- /dev/null +++ b/node_modules/is-binary-path/index.js @@ -0,0 +1,7 @@ +'use strict'; +const path = require('path'); +const binaryExtensions = require('binary-extensions'); + +const extensions = new Set(binaryExtensions); + +module.exports = filePath => extensions.has(path.extname(filePath).slice(1).toLowerCase()); diff --git a/node_modules/is-binary-path/license b/node_modules/is-binary-path/license new file mode 100644 index 00000000..401b1c73 --- /dev/null +++ b/node_modules/is-binary-path/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2019 Sindre Sorhus (https://sindresorhus.com), Paul Miller (https://paulmillr.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/is-binary-path/package.json b/node_modules/is-binary-path/package.json new file mode 100644 index 00000000..a8d005ae --- /dev/null +++ b/node_modules/is-binary-path/package.json @@ -0,0 +1,40 @@ +{ + "name": "is-binary-path", + "version": "2.1.0", + "description": "Check if a file path is a binary file", + "license": "MIT", + "repository": "sindresorhus/is-binary-path", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "binary", + "extensions", + "extension", + "file", + "path", + "check", + "detect", + "is" + ], + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/is-binary-path/readme.md b/node_modules/is-binary-path/readme.md new file mode 100644 index 00000000..b4ab0251 --- /dev/null +++ b/node_modules/is-binary-path/readme.md @@ -0,0 +1,34 @@ +# is-binary-path [![Build Status](https://travis-ci.org/sindresorhus/is-binary-path.svg?branch=master)](https://travis-ci.org/sindresorhus/is-binary-path) + +> Check if a file path is a binary file + + +## Install + +``` +$ npm install is-binary-path +``` + + +## Usage + +```js +const isBinaryPath = require('is-binary-path'); + +isBinaryPath('source/unicorn.png'); +//=> true + +isBinaryPath('source/unicorn.txt'); +//=> false +``` + + +## Related + +- [binary-extensions](https://github.com/sindresorhus/binary-extensions) - List of binary file extensions +- [is-text-path](https://github.com/sindresorhus/is-text-path) - Check if a filepath is a text file + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com), [Paul Miller](https://paulmillr.com) diff --git a/node_modules/is-extglob/LICENSE b/node_modules/is-extglob/LICENSE new file mode 100644 index 00000000..842218cf --- /dev/null +++ b/node_modules/is-extglob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, Jon Schlinkert + +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/is-extglob/README.md b/node_modules/is-extglob/README.md new file mode 100644 index 00000000..0416af5c --- /dev/null +++ b/node_modules/is-extglob/README.md @@ -0,0 +1,107 @@ +# is-extglob [![NPM version](https://img.shields.io/npm/v/is-extglob.svg?style=flat)](https://www.npmjs.com/package/is-extglob) [![NPM downloads](https://img.shields.io/npm/dm/is-extglob.svg?style=flat)](https://npmjs.org/package/is-extglob) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-extglob.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-extglob) + +> Returns true if a string has an extglob. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-extglob +``` + +## Usage + +```js +var isExtglob = require('is-extglob'); +``` + +**True** + +```js +isExtglob('?(abc)'); +isExtglob('@(abc)'); +isExtglob('!(abc)'); +isExtglob('*(abc)'); +isExtglob('+(abc)'); +``` + +**False** + +Escaped extglobs: + +```js +isExtglob('\\?(abc)'); +isExtglob('\\@(abc)'); +isExtglob('\\!(abc)'); +isExtglob('\\*(abc)'); +isExtglob('\\+(abc)'); +``` + +Everything else... + +```js +isExtglob('foo.js'); +isExtglob('!foo.js'); +isExtglob('*.js'); +isExtglob('**/abc.js'); +isExtglob('abc/*.js'); +isExtglob('abc/(aaa|bbb).js'); +isExtglob('abc/[a-z].js'); +isExtglob('abc/{a,b}.js'); +isExtglob('abc/?.js'); +isExtglob('abc.js'); +isExtglob('abc/def/ghi.js'); +``` + +## History + +**v2.0** + +Adds support for escaping. Escaped exglobs no longer return true. + +## About + +### Related projects + +* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.") +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ + +To generate the readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install -g verb verb-generate-readme && verb +``` + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +### License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/is-extglob/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._ \ No newline at end of file diff --git a/node_modules/is-extglob/index.js b/node_modules/is-extglob/index.js new file mode 100644 index 00000000..c1d986fc --- /dev/null +++ b/node_modules/is-extglob/index.js @@ -0,0 +1,20 @@ +/*! + * is-extglob + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + +module.exports = function isExtglob(str) { + if (typeof str !== 'string' || str === '') { + return false; + } + + var match; + while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { + if (match[2]) return true; + str = str.slice(match.index + match[0].length); + } + + return false; +}; diff --git a/node_modules/is-extglob/package.json b/node_modules/is-extglob/package.json new file mode 100644 index 00000000..7a908369 --- /dev/null +++ b/node_modules/is-extglob/package.json @@ -0,0 +1,69 @@ +{ + "name": "is-extglob", + "description": "Returns true if a string has an extglob.", + "version": "2.1.1", + "homepage": "https://github.com/jonschlinkert/is-extglob", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/is-extglob", + "bugs": { + "url": "https://github.com/jonschlinkert/is-extglob/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "keywords": [ + "bash", + "braces", + "check", + "exec", + "expression", + "extglob", + "glob", + "globbing", + "globstar", + "is", + "match", + "matches", + "pattern", + "regex", + "regular", + "string", + "test" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "has-glob", + "is-glob", + "micromatch" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/node_modules/is-fullwidth-code-point/index.d.ts b/node_modules/is-fullwidth-code-point/index.d.ts new file mode 100644 index 00000000..729d2020 --- /dev/null +++ b/node_modules/is-fullwidth-code-point/index.d.ts @@ -0,0 +1,17 @@ +/** +Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms). + +@param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. + +@example +``` +import isFullwidthCodePoint from 'is-fullwidth-code-point'; + +isFullwidthCodePoint('谢'.codePointAt(0)); +//=> true + +isFullwidthCodePoint('a'.codePointAt(0)); +//=> false +``` +*/ +export default function isFullwidthCodePoint(codePoint: number): boolean; diff --git a/node_modules/is-fullwidth-code-point/index.js b/node_modules/is-fullwidth-code-point/index.js new file mode 100644 index 00000000..671f97f7 --- /dev/null +++ b/node_modules/is-fullwidth-code-point/index.js @@ -0,0 +1,50 @@ +/* eslint-disable yoda */ +'use strict'; + +const isFullwidthCodePoint = codePoint => { + if (Number.isNaN(codePoint)) { + return false; + } + + // Code points are derived from: + // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt + if ( + codePoint >= 0x1100 && ( + codePoint <= 0x115F || // Hangul Jamo + codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET + codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + (0x3250 <= codePoint && codePoint <= 0x4DBF) || + // CJK Unified Ideographs .. Yi Radicals + (0x4E00 <= codePoint && codePoint <= 0xA4C6) || + // Hangul Jamo Extended-A + (0xA960 <= codePoint && codePoint <= 0xA97C) || + // Hangul Syllables + (0xAC00 <= codePoint && codePoint <= 0xD7A3) || + // CJK Compatibility Ideographs + (0xF900 <= codePoint && codePoint <= 0xFAFF) || + // Vertical Forms + (0xFE10 <= codePoint && codePoint <= 0xFE19) || + // CJK Compatibility Forms .. Small Form Variants + (0xFE30 <= codePoint && codePoint <= 0xFE6B) || + // Halfwidth and Fullwidth Forms + (0xFF01 <= codePoint && codePoint <= 0xFF60) || + (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || + // Kana Supplement + (0x1B000 <= codePoint && codePoint <= 0x1B001) || + // Enclosed Ideographic Supplement + (0x1F200 <= codePoint && codePoint <= 0x1F251) || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + (0x20000 <= codePoint && codePoint <= 0x3FFFD) + ) + ) { + return true; + } + + return false; +}; + +module.exports = isFullwidthCodePoint; +module.exports.default = isFullwidthCodePoint; diff --git a/node_modules/is-fullwidth-code-point/license b/node_modules/is-fullwidth-code-point/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/is-fullwidth-code-point/license @@ -0,0 +1,9 @@ +MIT License + +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/is-fullwidth-code-point/package.json b/node_modules/is-fullwidth-code-point/package.json new file mode 100644 index 00000000..2137e888 --- /dev/null +++ b/node_modules/is-fullwidth-code-point/package.json @@ -0,0 +1,42 @@ +{ + "name": "is-fullwidth-code-point", + "version": "3.0.0", + "description": "Check if the character represented by a given Unicode code point is fullwidth", + "license": "MIT", + "repository": "sindresorhus/is-fullwidth-code-point", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd-check" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "fullwidth", + "full-width", + "full", + "width", + "unicode", + "character", + "string", + "codepoint", + "code", + "point", + "is", + "detect", + "check" + ], + "devDependencies": { + "ava": "^1.3.1", + "tsd-check": "^0.5.0", + "xo": "^0.24.0" + } +} diff --git a/node_modules/is-fullwidth-code-point/readme.md b/node_modules/is-fullwidth-code-point/readme.md new file mode 100644 index 00000000..4236bba9 --- /dev/null +++ b/node_modules/is-fullwidth-code-point/readme.md @@ -0,0 +1,39 @@ +# is-fullwidth-code-point [![Build Status](https://travis-ci.org/sindresorhus/is-fullwidth-code-point.svg?branch=master)](https://travis-ci.org/sindresorhus/is-fullwidth-code-point) + +> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) + + +## Install + +``` +$ npm install is-fullwidth-code-point +``` + + +## Usage + +```js +const isFullwidthCodePoint = require('is-fullwidth-code-point'); + +isFullwidthCodePoint('谢'.codePointAt(0)); +//=> true + +isFullwidthCodePoint('a'.codePointAt(0)); +//=> false +``` + + +## API + +### isFullwidthCodePoint(codePoint) + +#### codePoint + +Type: `number` + +The [code point](https://en.wikipedia.org/wiki/Code_point) of a character. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/is-glob/LICENSE b/node_modules/is-glob/LICENSE new file mode 100644 index 00000000..3f2eca18 --- /dev/null +++ b/node_modules/is-glob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert. + +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/is-glob/README.md b/node_modules/is-glob/README.md new file mode 100644 index 00000000..740724b2 --- /dev/null +++ b/node_modules/is-glob/README.md @@ -0,0 +1,206 @@ +# is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![NPM total downloads](https://img.shields.io/npm/dt/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Build Status](https://img.shields.io/github/workflow/status/micromatch/is-glob/dev)](https://github.com/micromatch/is-glob/actions) + +> Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-glob +``` + +You might also be interested in [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob). + +## Usage + +```js +var isGlob = require('is-glob'); +``` + +### Default behavior + +**True** + +Patterns that have glob characters or regex patterns will return `true`: + +```js +isGlob('!foo.js'); +isGlob('*.js'); +isGlob('**/abc.js'); +isGlob('abc/*.js'); +isGlob('abc/(aaa|bbb).js'); +isGlob('abc/[a-z].js'); +isGlob('abc/{a,b}.js'); +//=> true +``` + +Extglobs + +```js +isGlob('abc/@(a).js'); +isGlob('abc/!(a).js'); +isGlob('abc/+(a).js'); +isGlob('abc/*(a).js'); +isGlob('abc/?(a).js'); +//=> true +``` + +**False** + +Escaped globs or extglobs return `false`: + +```js +isGlob('abc/\\@(a).js'); +isGlob('abc/\\!(a).js'); +isGlob('abc/\\+(a).js'); +isGlob('abc/\\*(a).js'); +isGlob('abc/\\?(a).js'); +isGlob('\\!foo.js'); +isGlob('\\*.js'); +isGlob('\\*\\*/abc.js'); +isGlob('abc/\\*.js'); +isGlob('abc/\\(aaa|bbb).js'); +isGlob('abc/\\[a-z].js'); +isGlob('abc/\\{a,b}.js'); +//=> false +``` + +Patterns that do not have glob patterns return `false`: + +```js +isGlob('abc.js'); +isGlob('abc/def/ghi.js'); +isGlob('foo.js'); +isGlob('abc/@.js'); +isGlob('abc/+.js'); +isGlob('abc/?.js'); +isGlob(); +isGlob(null); +//=> false +``` + +Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)): + +```js +isGlob(['**/*.js']); +isGlob(['foo.js']); +//=> false +``` + +### Option strict + +When `options.strict === false` the behavior is less strict in determining if a pattern is a glob. Meaning that +some patterns that would return `false` may return `true`. This is done so that matching libraries like [micromatch](https://github.com/micromatch/micromatch) have a chance at determining if the pattern is a glob or not. + +**True** + +Patterns that have glob characters or regex patterns will return `true`: + +```js +isGlob('!foo.js', {strict: false}); +isGlob('*.js', {strict: false}); +isGlob('**/abc.js', {strict: false}); +isGlob('abc/*.js', {strict: false}); +isGlob('abc/(aaa|bbb).js', {strict: false}); +isGlob('abc/[a-z].js', {strict: false}); +isGlob('abc/{a,b}.js', {strict: false}); +//=> true +``` + +Extglobs + +```js +isGlob('abc/@(a).js', {strict: false}); +isGlob('abc/!(a).js', {strict: false}); +isGlob('abc/+(a).js', {strict: false}); +isGlob('abc/*(a).js', {strict: false}); +isGlob('abc/?(a).js', {strict: false}); +//=> true +``` + +**False** + +Escaped globs or extglobs return `false`: + +```js +isGlob('\\!foo.js', {strict: false}); +isGlob('\\*.js', {strict: false}); +isGlob('\\*\\*/abc.js', {strict: false}); +isGlob('abc/\\*.js', {strict: false}); +isGlob('abc/\\(aaa|bbb).js', {strict: false}); +isGlob('abc/\\[a-z].js', {strict: false}); +isGlob('abc/\\{a,b}.js', {strict: false}); +//=> false +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit") +* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base "Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks") +* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.") +* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 47 | [jonschlinkert](https://github.com/jonschlinkert) | +| 5 | [doowb](https://github.com/doowb) | +| 1 | [phated](https://github.com/phated) | +| 1 | [danhper](https://github.com/danhper) | +| 1 | [paulmillr](https://github.com/paulmillr) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on March 27, 2019._ \ No newline at end of file diff --git a/node_modules/is-glob/index.js b/node_modules/is-glob/index.js new file mode 100644 index 00000000..620f563e --- /dev/null +++ b/node_modules/is-glob/index.js @@ -0,0 +1,150 @@ +/*! + * is-glob + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +var isExtglob = require('is-extglob'); +var chars = { '{': '}', '(': ')', '[': ']'}; +var strictCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + var pipeIndex = -2; + var closeSquareIndex = -2; + var closeCurlyIndex = -2; + var closeParenIndex = -2; + var backSlashIndex = -2; + while (index < str.length) { + if (str[index] === '*') { + return true; + } + + if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) { + return true; + } + + if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') { + if (closeSquareIndex < index) { + closeSquareIndex = str.indexOf(']', index); + } + if (closeSquareIndex > index) { + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + } + } + + if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') { + closeCurlyIndex = str.indexOf('}', index); + if (closeCurlyIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { + return true; + } + } + } + + if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') { + closeParenIndex = str.indexOf(')', index); + if (closeParenIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + + if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') { + if (pipeIndex < index) { + pipeIndex = str.indexOf('|', index); + } + if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') { + closeParenIndex = str.indexOf(')', pipeIndex); + if (closeParenIndex > pipeIndex) { + backSlashIndex = str.indexOf('\\', pipeIndex); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; + +var relaxedCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + while (index < str.length) { + if (/[*?{}()[\]]/.test(str[index])) { + return true; + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; + +module.exports = function isGlob(str, options) { + if (typeof str !== 'string' || str === '') { + return false; + } + + if (isExtglob(str)) { + return true; + } + + var check = strictCheck; + + // optionally relax check + if (options && options.strict === false) { + check = relaxedCheck; + } + + return check(str); +}; diff --git a/node_modules/is-glob/package.json b/node_modules/is-glob/package.json new file mode 100644 index 00000000..858af037 --- /dev/null +++ b/node_modules/is-glob/package.json @@ -0,0 +1,81 @@ +{ + "name": "is-glob", + "description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.", + "version": "4.0.3", + "homepage": "https://github.com/micromatch/is-glob", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Brian Woodward (https://twitter.com/doowb)", + "Daniel Perez (https://tuvistavie.com)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)" + ], + "repository": "micromatch/is-glob", + "bugs": { + "url": "https://github.com/micromatch/is-glob/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha && node benchmark.js" + }, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "devDependencies": { + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "keywords": [ + "bash", + "braces", + "check", + "exec", + "expression", + "extglob", + "glob", + "globbing", + "globstar", + "is", + "match", + "matches", + "pattern", + "regex", + "regular", + "string", + "test" + ], + "verb": { + "layout": "default", + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "assemble", + "base", + "update", + "verb" + ] + }, + "reflinks": [ + "assemble", + "bach", + "base", + "composer", + "gulp", + "has-glob", + "is-valid-glob", + "micromatch", + "npm", + "scaffold", + "verb", + "vinyl" + ] + } +} diff --git a/node_modules/is-number/LICENSE b/node_modules/is-number/LICENSE new file mode 100644 index 00000000..9af4a67d --- /dev/null +++ b/node_modules/is-number/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-present, Jon Schlinkert. + +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/is-number/README.md b/node_modules/is-number/README.md new file mode 100644 index 00000000..eb8149e8 --- /dev/null +++ b/node_modules/is-number/README.md @@ -0,0 +1,187 @@ +# is-number [![NPM version](https://img.shields.io/npm/v/is-number.svg?style=flat)](https://www.npmjs.com/package/is-number) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![NPM total downloads](https://img.shields.io/npm/dt/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-number.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-number) + +> Returns true if the value is a finite number. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-number +``` + +## Why is this needed? + +In JavaScript, it's not always as straightforward as it should be to reliably check if a value is a number. It's common for devs to use `+`, `-`, or `Number()` to cast a string value to a number (for example, when values are returned from user input, regex matches, parsers, etc). But there are many non-intuitive edge cases that yield unexpected results: + +```js +console.log(+[]); //=> 0 +console.log(+''); //=> 0 +console.log(+' '); //=> 0 +console.log(typeof NaN); //=> 'number' +``` + +This library offers a performant way to smooth out edge cases like these. + +## Usage + +```js +const isNumber = require('is-number'); +``` + +See the [tests](./test.js) for more examples. + +### true + +```js +isNumber(5e3); // true +isNumber(0xff); // true +isNumber(-1.1); // true +isNumber(0); // true +isNumber(1); // true +isNumber(1.1); // true +isNumber(10); // true +isNumber(10.10); // true +isNumber(100); // true +isNumber('-1.1'); // true +isNumber('0'); // true +isNumber('012'); // true +isNumber('0xff'); // true +isNumber('1'); // true +isNumber('1.1'); // true +isNumber('10'); // true +isNumber('10.10'); // true +isNumber('100'); // true +isNumber('5e3'); // true +isNumber(parseInt('012')); // true +isNumber(parseFloat('012')); // true +``` + +### False + +Everything else is false, as you would expect: + +```js +isNumber(Infinity); // false +isNumber(NaN); // false +isNumber(null); // false +isNumber(undefined); // false +isNumber(''); // false +isNumber(' '); // false +isNumber('foo'); // false +isNumber([1]); // false +isNumber([]); // false +isNumber(function () {}); // false +isNumber({}); // false +``` + +## Release history + +### 7.0.0 + +* Refactor. Now uses `.isFinite` if it exists. +* Performance is about the same as v6.0 when the value is a string or number. But it's now 3x-4x faster when the value is not a string or number. + +### 6.0.0 + +* Optimizations, thanks to @benaadams. + +### 5.0.0 + +**Breaking changes** + +* removed support for `instanceof Number` and `instanceof String` + +## Benchmarks + +As with all benchmarks, take these with a grain of salt. See the [benchmarks](./benchmark/index.js) for more detail. + +``` +# all +v7.0 x 413,222 ops/sec ±2.02% (86 runs sampled) +v6.0 x 111,061 ops/sec ±1.29% (85 runs sampled) +parseFloat x 317,596 ops/sec ±1.36% (86 runs sampled) +fastest is 'v7.0' + +# string +v7.0 x 3,054,496 ops/sec ±1.05% (89 runs sampled) +v6.0 x 2,957,781 ops/sec ±0.98% (88 runs sampled) +parseFloat x 3,071,060 ops/sec ±1.13% (88 runs sampled) +fastest is 'parseFloat,v7.0' + +# number +v7.0 x 3,146,895 ops/sec ±0.89% (89 runs sampled) +v6.0 x 3,214,038 ops/sec ±1.07% (89 runs sampled) +parseFloat x 3,077,588 ops/sec ±1.07% (87 runs sampled) +fastest is 'v6.0' +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 49 | [jonschlinkert](https://github.com/jonschlinkert) | +| 5 | [charlike-old](https://github.com/charlike-old) | +| 1 | [benaadams](https://github.com/benaadams) | +| 1 | [realityking](https://github.com/realityking) | + +### Author + +**Jon Schlinkert** + +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 15, 2018._ \ No newline at end of file diff --git a/node_modules/is-number/index.js b/node_modules/is-number/index.js new file mode 100644 index 00000000..27f19b75 --- /dev/null +++ b/node_modules/is-number/index.js @@ -0,0 +1,18 @@ +/*! + * is-number + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function(num) { + if (typeof num === 'number') { + return num - num === 0; + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); + } + return false; +}; diff --git a/node_modules/is-number/package.json b/node_modules/is-number/package.json new file mode 100644 index 00000000..37150726 --- /dev/null +++ b/node_modules/is-number/package.json @@ -0,0 +1,82 @@ +{ + "name": "is-number", + "description": "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.", + "version": "7.0.0", + "homepage": "https://github.com/jonschlinkert/is-number", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Olsten Larck (https://i.am.charlike.online)", + "Rouven Weßling (www.rouvenwessling.de)" + ], + "repository": "jonschlinkert/is-number", + "bugs": { + "url": "https://github.com/jonschlinkert/is-number/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.12.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "ansi": "^0.3.1", + "benchmark": "^2.1.4", + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "keywords": [ + "cast", + "check", + "coerce", + "coercion", + "finite", + "integer", + "is", + "isnan", + "is-nan", + "is-num", + "is-number", + "isnumber", + "isfinite", + "istype", + "kind", + "math", + "nan", + "num", + "number", + "numeric", + "parseFloat", + "parseInt", + "test", + "type", + "typeof", + "value" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "related": { + "list": [ + "is-plain-object", + "is-primitive", + "isobject", + "kind-of" + ] + }, + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/node_modules/isexe/.npmignore b/node_modules/isexe/.npmignore new file mode 100644 index 00000000..c1cb757a --- /dev/null +++ b/node_modules/isexe/.npmignore @@ -0,0 +1,2 @@ +.nyc_output/ +coverage/ diff --git a/node_modules/isexe/LICENSE b/node_modules/isexe/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/isexe/LICENSE @@ -0,0 +1,15 @@ +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/isexe/README.md b/node_modules/isexe/README.md new file mode 100644 index 00000000..35769e84 --- /dev/null +++ b/node_modules/isexe/README.md @@ -0,0 +1,51 @@ +# isexe + +Minimal module to check if a file is executable, and a normal file. + +Uses `fs.stat` and tests against the `PATHEXT` environment variable on +Windows. + +## USAGE + +```javascript +var isexe = require('isexe') +isexe('some-file-name', function (err, isExe) { + if (err) { + console.error('probably file does not exist or something', err) + } else if (isExe) { + console.error('this thing can be run') + } else { + console.error('cannot be run') + } +}) + +// same thing but synchronous, throws errors +var isExe = isexe.sync('some-file-name') + +// treat errors as just "not executable" +isexe('maybe-missing-file', { ignoreErrors: true }, callback) +var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true }) +``` + +## API + +### `isexe(path, [options], [callback])` + +Check if the path is executable. If no callback provided, and a +global `Promise` object is available, then a Promise will be returned. + +Will raise whatever errors may be raised by `fs.stat`, unless +`options.ignoreErrors` is set to true. + +### `isexe.sync(path, [options])` + +Same as `isexe` but returns the value and throws any errors raised. + +### Options + +* `ignoreErrors` Treat all errors as "no, this is not executable", but + don't raise them. +* `uid` Number to use as the user id +* `gid` Number to use as the group id +* `pathExt` List of path extensions to use instead of `PATHEXT` + environment variable on Windows. diff --git a/node_modules/isexe/index.js b/node_modules/isexe/index.js new file mode 100644 index 00000000..553fb32b --- /dev/null +++ b/node_modules/isexe/index.js @@ -0,0 +1,57 @@ +var fs = require('fs') +var core +if (process.platform === 'win32' || global.TESTING_WINDOWS) { + core = require('./windows.js') +} else { + core = require('./mode.js') +} + +module.exports = isexe +isexe.sync = sync + +function isexe (path, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } + + if (!cb) { + if (typeof Promise !== 'function') { + throw new TypeError('callback not provided') + } + + return new Promise(function (resolve, reject) { + isexe(path, options || {}, function (er, is) { + if (er) { + reject(er) + } else { + resolve(is) + } + }) + }) + } + + core(path, options || {}, function (er, is) { + // ignore EACCES because that just means we aren't allowed to run it + if (er) { + if (er.code === 'EACCES' || options && options.ignoreErrors) { + er = null + is = false + } + } + cb(er, is) + }) +} + +function sync (path, options) { + // my kingdom for a filtered catch + try { + return core.sync(path, options || {}) + } catch (er) { + if (options && options.ignoreErrors || er.code === 'EACCES') { + return false + } else { + throw er + } + } +} diff --git a/node_modules/isexe/mode.js b/node_modules/isexe/mode.js new file mode 100644 index 00000000..1995ea4a --- /dev/null +++ b/node_modules/isexe/mode.js @@ -0,0 +1,41 @@ +module.exports = isexe +isexe.sync = sync + +var fs = require('fs') + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), options) +} + +function checkStat (stat, options) { + return stat.isFile() && checkMode(stat, options) +} + +function checkMode (stat, options) { + var mod = stat.mode + var uid = stat.uid + var gid = stat.gid + + var myUid = options.uid !== undefined ? + options.uid : process.getuid && process.getuid() + var myGid = options.gid !== undefined ? + options.gid : process.getgid && process.getgid() + + var u = parseInt('100', 8) + var g = parseInt('010', 8) + var o = parseInt('001', 8) + var ug = u | g + + var ret = (mod & o) || + (mod & g) && gid === myGid || + (mod & u) && uid === myUid || + (mod & ug) && myUid === 0 + + return ret +} diff --git a/node_modules/isexe/package.json b/node_modules/isexe/package.json new file mode 100644 index 00000000..e4526894 --- /dev/null +++ b/node_modules/isexe/package.json @@ -0,0 +1,31 @@ +{ + "name": "isexe", + "version": "2.0.0", + "description": "Minimal module to check if a file is executable.", + "main": "index.js", + "directories": { + "test": "test" + }, + "devDependencies": { + "mkdirp": "^0.5.1", + "rimraf": "^2.5.0", + "tap": "^10.3.0" + }, + "scripts": { + "test": "tap test/*.js --100", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/isexe.git" + }, + "keywords": [], + "bugs": { + "url": "https://github.com/isaacs/isexe/issues" + }, + "homepage": "https://github.com/isaacs/isexe#readme" +} diff --git a/node_modules/isexe/test/basic.js b/node_modules/isexe/test/basic.js new file mode 100644 index 00000000..d926df64 --- /dev/null +++ b/node_modules/isexe/test/basic.js @@ -0,0 +1,221 @@ +var t = require('tap') +var fs = require('fs') +var path = require('path') +var fixture = path.resolve(__dirname, 'fixtures') +var meow = fixture + '/meow.cat' +var mine = fixture + '/mine.cat' +var ours = fixture + '/ours.cat' +var fail = fixture + '/fail.false' +var noent = fixture + '/enoent.exe' +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') + +var isWindows = process.platform === 'win32' +var hasAccess = typeof fs.access === 'function' +var winSkip = isWindows && 'windows' +var accessSkip = !hasAccess && 'no fs.access function' +var hasPromise = typeof Promise === 'function' +var promiseSkip = !hasPromise && 'no global Promise' + +function reset () { + delete require.cache[require.resolve('../')] + return require('../') +} + +t.test('setup fixtures', function (t) { + rimraf.sync(fixture) + mkdirp.sync(fixture) + fs.writeFileSync(meow, '#!/usr/bin/env cat\nmeow\n') + fs.chmodSync(meow, parseInt('0755', 8)) + fs.writeFileSync(fail, '#!/usr/bin/env false\n') + fs.chmodSync(fail, parseInt('0644', 8)) + fs.writeFileSync(mine, '#!/usr/bin/env cat\nmine\n') + fs.chmodSync(mine, parseInt('0744', 8)) + fs.writeFileSync(ours, '#!/usr/bin/env cat\nours\n') + fs.chmodSync(ours, parseInt('0754', 8)) + t.end() +}) + +t.test('promise', { skip: promiseSkip }, function (t) { + var isexe = reset() + t.test('meow async', function (t) { + isexe(meow).then(function (is) { + t.ok(is) + t.end() + }) + }) + t.test('fail async', function (t) { + isexe(fail).then(function (is) { + t.notOk(is) + t.end() + }) + }) + t.test('noent async', function (t) { + isexe(noent).catch(function (er) { + t.ok(er) + t.end() + }) + }) + t.test('noent ignore async', function (t) { + isexe(noent, { ignoreErrors: true }).then(function (is) { + t.notOk(is) + t.end() + }) + }) + t.end() +}) + +t.test('no promise', function (t) { + global.Promise = null + var isexe = reset() + t.throws('try to meow a promise', function () { + isexe(meow) + }) + t.end() +}) + +t.test('access', { skip: accessSkip || winSkip }, function (t) { + runTest(t) +}) + +t.test('mode', { skip: winSkip }, function (t) { + delete fs.access + delete fs.accessSync + var isexe = reset() + t.ok(isexe.sync(ours, { uid: 0, gid: 0 })) + t.ok(isexe.sync(mine, { uid: 0, gid: 0 })) + runTest(t) +}) + +t.test('windows', function (t) { + global.TESTING_WINDOWS = true + var pathExt = '.EXE;.CAT;.CMD;.COM' + t.test('pathExt option', function (t) { + runTest(t, { pathExt: '.EXE;.CAT;.CMD;.COM' }) + }) + t.test('pathExt env', function (t) { + process.env.PATHEXT = pathExt + runTest(t) + }) + t.test('no pathExt', function (t) { + // with a pathExt of '', any filename is fine. + // so the "fail" one would still pass. + runTest(t, { pathExt: '', skipFail: true }) + }) + t.test('pathext with empty entry', function (t) { + // with a pathExt of '', any filename is fine. + // so the "fail" one would still pass. + runTest(t, { pathExt: ';' + pathExt, skipFail: true }) + }) + t.end() +}) + +t.test('cleanup', function (t) { + rimraf.sync(fixture) + t.end() +}) + +function runTest (t, options) { + var isexe = reset() + + var optionsIgnore = Object.create(options || {}) + optionsIgnore.ignoreErrors = true + + if (!options || !options.skipFail) { + t.notOk(isexe.sync(fail, options)) + } + t.notOk(isexe.sync(noent, optionsIgnore)) + if (!options) { + t.ok(isexe.sync(meow)) + } else { + t.ok(isexe.sync(meow, options)) + } + + t.ok(isexe.sync(mine, options)) + t.ok(isexe.sync(ours, options)) + t.throws(function () { + isexe.sync(noent, options) + }) + + t.test('meow async', function (t) { + if (!options) { + isexe(meow, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + } else { + isexe(meow, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + } + }) + + t.test('mine async', function (t) { + isexe(mine, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + }) + + t.test('ours async', function (t) { + isexe(ours, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + }) + + if (!options || !options.skipFail) { + t.test('fail async', function (t) { + isexe(fail, options, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + } + + t.test('noent async', function (t) { + isexe(noent, options, function (er, is) { + t.ok(er) + t.notOk(is) + t.end() + }) + }) + + t.test('noent ignore async', function (t) { + isexe(noent, optionsIgnore, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + + t.test('directory is not executable', function (t) { + isexe(__dirname, options, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + + t.end() +} diff --git a/node_modules/isexe/windows.js b/node_modules/isexe/windows.js new file mode 100644 index 00000000..34996734 --- /dev/null +++ b/node_modules/isexe/windows.js @@ -0,0 +1,42 @@ +module.exports = isexe +isexe.sync = sync + +var fs = require('fs') + +function checkPathExt (path, options) { + var pathext = options.pathExt !== undefined ? + options.pathExt : process.env.PATHEXT + + if (!pathext) { + return true + } + + pathext = pathext.split(';') + if (pathext.indexOf('') !== -1) { + return true + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase() + if (p && path.substr(-p.length).toLowerCase() === p) { + return true + } + } + return false +} + +function checkStat (stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false + } + return checkPathExt(path, options) +} + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, path, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), path, options) +} diff --git a/node_modules/jsonfile/CHANGELOG.md b/node_modules/jsonfile/CHANGELOG.md new file mode 100644 index 00000000..d772e438 --- /dev/null +++ b/node_modules/jsonfile/CHANGELOG.md @@ -0,0 +1,171 @@ +6.1.0 / 2020-10-31 +------------------ + +- Add `finalEOL` option to disable writing final EOL ([#115](https://github.com/jprichardson/node-jsonfile/issues/115), [#137](https://github.com/jprichardson/node-jsonfile/pull/137)) +- Update dependency ([#138](https://github.com/jprichardson/node-jsonfile/pull/138)) + +6.0.1 / 2020-03-07 +------------------ + +- Update dependency ([#130](https://github.com/jprichardson/node-jsonfile/pull/130)) +- Fix code style ([#129](https://github.com/jprichardson/node-jsonfile/pull/129)) + +6.0.0 / 2020-02-24 +------------------ + +- **BREAKING:** Drop support for Node 6 & 8 ([#128](https://github.com/jprichardson/node-jsonfile/pull/128)) +- **BREAKING:** Do not allow passing `null` as options to `readFile()` or `writeFile()` ([#128](https://github.com/jprichardson/node-jsonfile/pull/128)) +- Refactor internals ([#128](https://github.com/jprichardson/node-jsonfile/pull/128)) + +5.0.0 / 2018-09-08 +------------------ + +- **BREAKING:** Drop Node 4 support +- **BREAKING:** If no callback is passed to an asynchronous method, a promise is now returned ([#109](https://github.com/jprichardson/node-jsonfile/pull/109)) +- Cleanup docs + +4.0.0 / 2017-07-12 +------------------ + +- **BREAKING:** Remove global `spaces` option. +- **BREAKING:** Drop support for Node 0.10, 0.12, and io.js. +- Remove undocumented `passParsingErrors` option. +- Added `EOL` override option to `writeFile` when using `spaces`. [#89] + +3.0.1 / 2017-07-05 +------------------ + +- Fixed bug in `writeFile` when there was a serialization error & no callback was passed. In previous versions, an empty file would be written; now no file is written. + +3.0.0 / 2017-04-25 +------------------ + +- Changed behavior of `throws` option for `readFileSync`; now does not throw filesystem errors when `throws` is `false` + +2.4.0 / 2016-09-15 +------------------ +### Changed +- added optional support for `graceful-fs` [#62] + +2.3.1 / 2016-05-13 +------------------ +- fix to support BOM. [#45][#45] + +2.3.0 / 2016-04-16 +------------------ +- add `throws` to `readFile()`. See [#39][#39] +- add support for any arbitrary `fs` module. Useful with [mock-fs](https://www.npmjs.com/package/mock-fs) + +2.2.3 / 2015-10-14 +------------------ +- include file name in parse error. See: https://github.com/jprichardson/node-jsonfile/pull/34 + +2.2.2 / 2015-09-16 +------------------ +- split out tests into separate files +- fixed `throws` when set to `true` in `readFileSync()`. See: https://github.com/jprichardson/node-jsonfile/pull/33 + +2.2.1 / 2015-06-25 +------------------ +- fixed regression when passing in string as encoding for options in `writeFile()` and `writeFileSync()`. See: https://github.com/jprichardson/node-jsonfile/issues/28 + +2.2.0 / 2015-06-25 +------------------ +- added `options.spaces` to `writeFile()` and `writeFileSync()` + +2.1.2 / 2015-06-22 +------------------ +- fixed if passed `readFileSync(file, 'utf8')`. See: https://github.com/jprichardson/node-jsonfile/issues/25 + +2.1.1 / 2015-06-19 +------------------ +- fixed regressions if `null` is passed for options. See: https://github.com/jprichardson/node-jsonfile/issues/24 + +2.1.0 / 2015-06-19 +------------------ +- cleanup: JavaScript Standard Style, rename files, dropped terst for assert +- methods now support JSON revivers/replacers + +2.0.1 / 2015-05-24 +------------------ +- update license attribute https://github.com/jprichardson/node-jsonfile/pull/21 + +2.0.0 / 2014-07-28 +------------------ +* added `\n` to end of file on write. [#14](https://github.com/jprichardson/node-jsonfile/pull/14) +* added `options.throws` to `readFileSync()` +* dropped support for Node v0.8 + +1.2.0 / 2014-06-29 +------------------ +* removed semicolons +* bugfix: passed `options` to `fs.readFile` and `fs.readFileSync`. This technically changes behavior, but +changes it according to docs. [#12][#12] + +1.1.1 / 2013-11-11 +------------------ +* fixed catching of callback bug (ffissore / #5) + +1.1.0 / 2013-10-11 +------------------ +* added `options` param to methods, (seanodell / #4) + +1.0.1 / 2013-09-05 +------------------ +* removed `homepage` field from package.json to remove NPM warning + +1.0.0 / 2013-06-28 +------------------ +* added `.npmignore`, #1 +* changed spacing default from `4` to `2` to follow Node conventions + +0.0.1 / 2012-09-10 +------------------ +* Initial release. + +[#89]: https://github.com/jprichardson/node-jsonfile/pull/89 +[#45]: https://github.com/jprichardson/node-jsonfile/issues/45 "Reading of UTF8-encoded (w/ BOM) files fails" +[#44]: https://github.com/jprichardson/node-jsonfile/issues/44 "Extra characters in written file" +[#43]: https://github.com/jprichardson/node-jsonfile/issues/43 "Prettyfy json when written to file" +[#42]: https://github.com/jprichardson/node-jsonfile/pull/42 "Moved fs.readFileSync within the try/catch" +[#41]: https://github.com/jprichardson/node-jsonfile/issues/41 "Linux: Hidden file not working" +[#40]: https://github.com/jprichardson/node-jsonfile/issues/40 "autocreate folder doesn't work from Path-value" +[#39]: https://github.com/jprichardson/node-jsonfile/pull/39 "Add `throws` option for readFile (async)" +[#38]: https://github.com/jprichardson/node-jsonfile/pull/38 "Update README.md writeFile[Sync] signature" +[#37]: https://github.com/jprichardson/node-jsonfile/pull/37 "support append file" +[#36]: https://github.com/jprichardson/node-jsonfile/pull/36 "Add typescript definition file." +[#35]: https://github.com/jprichardson/node-jsonfile/pull/35 "Add typescript definition file." +[#34]: https://github.com/jprichardson/node-jsonfile/pull/34 "readFile JSON parse error includes filename" +[#33]: https://github.com/jprichardson/node-jsonfile/pull/33 "fix throw->throws typo in readFileSync()" +[#32]: https://github.com/jprichardson/node-jsonfile/issues/32 "readFile & readFileSync can possible have strip-comments as an option?" +[#31]: https://github.com/jprichardson/node-jsonfile/pull/31 "[Modify] Support string include is unicode escape string" +[#30]: https://github.com/jprichardson/node-jsonfile/issues/30 "How to use Jsonfile package in Meteor.js App?" +[#29]: https://github.com/jprichardson/node-jsonfile/issues/29 "writefile callback if no error?" +[#28]: https://github.com/jprichardson/node-jsonfile/issues/28 "writeFile options argument broken " +[#27]: https://github.com/jprichardson/node-jsonfile/pull/27 "Use svg instead of png to get better image quality" +[#26]: https://github.com/jprichardson/node-jsonfile/issues/26 "Breaking change to fs-extra" +[#25]: https://github.com/jprichardson/node-jsonfile/issues/25 "support string encoding param for read methods" +[#24]: https://github.com/jprichardson/node-jsonfile/issues/24 "readFile: Passing in null options with a callback throws an error" +[#23]: https://github.com/jprichardson/node-jsonfile/pull/23 "Add appendFile and appendFileSync" +[#22]: https://github.com/jprichardson/node-jsonfile/issues/22 "Default value for spaces in readme.md is outdated" +[#21]: https://github.com/jprichardson/node-jsonfile/pull/21 "Update license attribute" +[#20]: https://github.com/jprichardson/node-jsonfile/issues/20 "Add simple caching functionallity" +[#19]: https://github.com/jprichardson/node-jsonfile/pull/19 "Add appendFileSync method" +[#18]: https://github.com/jprichardson/node-jsonfile/issues/18 "Add updateFile and updateFileSync methods" +[#17]: https://github.com/jprichardson/node-jsonfile/issues/17 "seem read & write sync has sequentially problem" +[#16]: https://github.com/jprichardson/node-jsonfile/pull/16 "export spaces defaulted to null" +[#15]: https://github.com/jprichardson/node-jsonfile/issues/15 "`jsonfile.spaces` should default to `null`" +[#14]: https://github.com/jprichardson/node-jsonfile/pull/14 "Add EOL at EOF" +[#13]: https://github.com/jprichardson/node-jsonfile/issues/13 "Add a final newline" +[#12]: https://github.com/jprichardson/node-jsonfile/issues/12 "readFile doesn't accept options" +[#11]: https://github.com/jprichardson/node-jsonfile/pull/11 "Added try,catch to readFileSync" +[#10]: https://github.com/jprichardson/node-jsonfile/issues/10 "No output or error from writeFile" +[#9]: https://github.com/jprichardson/node-jsonfile/pull/9 "Change 'js' to 'jf' in example." +[#8]: https://github.com/jprichardson/node-jsonfile/pull/8 "Updated forgotten module.exports to me." +[#7]: https://github.com/jprichardson/node-jsonfile/pull/7 "Add file name in error message" +[#6]: https://github.com/jprichardson/node-jsonfile/pull/6 "Use graceful-fs when possible" +[#5]: https://github.com/jprichardson/node-jsonfile/pull/5 "Jsonfile doesn't behave nicely when used inside a test suite." +[#4]: https://github.com/jprichardson/node-jsonfile/pull/4 "Added options parameter to writeFile and writeFileSync" +[#3]: https://github.com/jprichardson/node-jsonfile/issues/3 "test2" +[#2]: https://github.com/jprichardson/node-jsonfile/issues/2 "homepage field must be a string url. Deleted." +[#1]: https://github.com/jprichardson/node-jsonfile/pull/1 "adding an `.npmignore` file" diff --git a/node_modules/jsonfile/LICENSE b/node_modules/jsonfile/LICENSE new file mode 100644 index 00000000..cb7e807b --- /dev/null +++ b/node_modules/jsonfile/LICENSE @@ -0,0 +1,15 @@ +(The MIT License) + +Copyright (c) 2012-2015, 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/jsonfile/README.md b/node_modules/jsonfile/README.md new file mode 100644 index 00000000..910cde00 --- /dev/null +++ b/node_modules/jsonfile/README.md @@ -0,0 +1,230 @@ +Node.js - jsonfile +================ + +Easily read/write JSON files in Node.js. _Note: this module cannot be used in the browser._ + +[![npm Package](https://img.shields.io/npm/v/jsonfile.svg?style=flat-square)](https://www.npmjs.org/package/jsonfile) +[![build status](https://secure.travis-ci.org/jprichardson/node-jsonfile.svg)](http://travis-ci.org/jprichardson/node-jsonfile) +[![windows Build status](https://img.shields.io/appveyor/ci/jprichardson/node-jsonfile/master.svg?label=windows%20build)](https://ci.appveyor.com/project/jprichardson/node-jsonfile/branch/master) + +Standard JavaScript + +Why? +---- + +Writing `JSON.stringify()` and then `fs.writeFile()` and `JSON.parse()` with `fs.readFile()` enclosed in `try/catch` blocks became annoying. + + + +Installation +------------ + + npm install --save jsonfile + + + +API +--- + +* [`readFile(filename, [options], callback)`](#readfilefilename-options-callback) +* [`readFileSync(filename, [options])`](#readfilesyncfilename-options) +* [`writeFile(filename, obj, [options], callback)`](#writefilefilename-obj-options-callback) +* [`writeFileSync(filename, obj, [options])`](#writefilesyncfilename-obj-options) + +---- + +### readFile(filename, [options], callback) + +`options` (`object`, default `undefined`): Pass in any [`fs.readFile`](https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback) options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). + - `throws` (`boolean`, default: `true`). If `JSON.parse` throws an error, pass this error to the callback. + If `false`, returns `null` for the object. + + +```js +const jsonfile = require('jsonfile') +const file = '/tmp/data.json' +jsonfile.readFile(file, function (err, obj) { + if (err) console.error(err) + console.dir(obj) +}) +``` + +You can also use this method with promises. The `readFile` method will return a promise if you do not pass a callback function. + +```js +const jsonfile = require('jsonfile') +const file = '/tmp/data.json' +jsonfile.readFile(file) + .then(obj => console.dir(obj)) + .catch(error => console.error(error)) +``` + +---- + +### readFileSync(filename, [options]) + +`options` (`object`, default `undefined`): Pass in any [`fs.readFileSync`](https://nodejs.org/api/fs.html#fs_fs_readfilesync_path_options) options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). +- `throws` (`boolean`, default: `true`). If an error is encountered reading or parsing the file, throw the error. If `false`, returns `null` for the object. + +```js +const jsonfile = require('jsonfile') +const file = '/tmp/data.json' + +console.dir(jsonfile.readFileSync(file)) +``` + +---- + +### writeFile(filename, obj, [options], callback) + +`options`: Pass in any [`fs.writeFile`](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback) options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`, or override `EOL` string or set `finalEOL` flag as `false` to not save the file with `EOL` at the end. + + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, function (err) { + if (err) console.error(err) +}) +``` +Or use with promises as follows: + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj) + .then(res => { + console.log('Write complete') + }) + .catch(error => console.error(error)) +``` + + +**formatting with spaces:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { spaces: 2 }, function (err) { + if (err) console.error(err) +}) +``` + +**overriding EOL:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { spaces: 2, EOL: '\r\n' }, function (err) { + if (err) console.error(err) +}) +``` + + +**disabling the EOL at the end of file:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { spaces: 2, finalEOL: false }, function (err) { + if (err) console.log(err) +}) +``` + +**appending to an existing JSON file:** + +You can use `fs.writeFile` option `{ flag: 'a' }` to achieve this. + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/mayAlreadyExistedData.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { flag: 'a' }, function (err) { + if (err) console.error(err) +}) +``` + +---- + +### writeFileSync(filename, obj, [options]) + +`options`: Pass in any [`fs.writeFileSync`](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options) options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`, or override `EOL` string or set `finalEOL` flag as `false` to not save the file with `EOL` at the end. + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj) +``` + +**formatting with spaces:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { spaces: 2 }) +``` + +**overriding EOL:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { spaces: 2, EOL: '\r\n' }) +``` + +**disabling the EOL at the end of file:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { spaces: 2, finalEOL: false }) +``` + +**appending to an existing JSON file:** + +You can use `fs.writeFileSync` option `{ flag: 'a' }` to achieve this. + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/mayAlreadyExistedData.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { flag: 'a' }) +``` + +License +------- + +(MIT License) + +Copyright 2012-2016, JP Richardson diff --git a/node_modules/jsonfile/index.js b/node_modules/jsonfile/index.js new file mode 100644 index 00000000..0582868f --- /dev/null +++ b/node_modules/jsonfile/index.js @@ -0,0 +1,88 @@ +let _fs +try { + _fs = require('graceful-fs') +} catch (_) { + _fs = require('fs') +} +const universalify = require('universalify') +const { stringify, stripBom } = require('./utils') + +async function _readFile (file, options = {}) { + if (typeof options === 'string') { + options = { encoding: options } + } + + const fs = options.fs || _fs + + const shouldThrow = 'throws' in options ? options.throws : true + + let data = await universalify.fromCallback(fs.readFile)(file, options) + + data = stripBom(data) + + let obj + try { + obj = JSON.parse(data, options ? options.reviver : null) + } catch (err) { + if (shouldThrow) { + err.message = `${file}: ${err.message}` + throw err + } else { + return null + } + } + + return obj +} + +const readFile = universalify.fromPromise(_readFile) + +function readFileSync (file, options = {}) { + if (typeof options === 'string') { + options = { encoding: options } + } + + const fs = options.fs || _fs + + const shouldThrow = 'throws' in options ? options.throws : true + + try { + let content = fs.readFileSync(file, options) + content = stripBom(content) + return JSON.parse(content, options.reviver) + } catch (err) { + if (shouldThrow) { + err.message = `${file}: ${err.message}` + throw err + } else { + return null + } + } +} + +async function _writeFile (file, obj, options = {}) { + const fs = options.fs || _fs + + const str = stringify(obj, options) + + await universalify.fromCallback(fs.writeFile)(file, str, options) +} + +const writeFile = universalify.fromPromise(_writeFile) + +function writeFileSync (file, obj, options = {}) { + const fs = options.fs || _fs + + const str = stringify(obj, options) + // not sure if fs.writeFileSync returns anything, but just in case + return fs.writeFileSync(file, str, options) +} + +const jsonfile = { + readFile, + readFileSync, + writeFile, + writeFileSync +} + +module.exports = jsonfile diff --git a/node_modules/jsonfile/package.json b/node_modules/jsonfile/package.json new file mode 100644 index 00000000..4d01eb1d --- /dev/null +++ b/node_modules/jsonfile/package.json @@ -0,0 +1,40 @@ +{ + "name": "jsonfile", + "version": "6.1.0", + "description": "Easily read/write JSON files.", + "repository": { + "type": "git", + "url": "git@github.com:jprichardson/node-jsonfile.git" + }, + "keywords": [ + "read", + "write", + "file", + "json", + "fs", + "fs-extra" + ], + "author": "JP Richardson ", + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + }, + "devDependencies": { + "mocha": "^8.2.0", + "rimraf": "^2.4.0", + "standard": "^16.0.1" + }, + "main": "index.js", + "files": [ + "index.js", + "utils.js" + ], + "scripts": { + "lint": "standard", + "test": "npm run lint && npm run unit", + "unit": "mocha" + } +} diff --git a/node_modules/jsonfile/utils.js b/node_modules/jsonfile/utils.js new file mode 100644 index 00000000..b5ff48e5 --- /dev/null +++ b/node_modules/jsonfile/utils.js @@ -0,0 +1,14 @@ +function stringify (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) { + const EOF = finalEOL ? EOL : '' + const str = JSON.stringify(obj, replacer, spaces) + + return str.replace(/\n/g, EOL) + EOF +} + +function stripBom (content) { + // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified + if (Buffer.isBuffer(content)) content = content.toString('utf8') + return content.replace(/^\uFEFF/, '') +} + +module.exports = { stringify, stripBom } diff --git a/node_modules/kleur/colors.d.ts b/node_modules/kleur/colors.d.ts new file mode 100644 index 00000000..cab25c66 --- /dev/null +++ b/node_modules/kleur/colors.d.ts @@ -0,0 +1,38 @@ +declare function print(input: string | boolean | number): string; +declare function print(input: undefined | void): undefined; +declare function print(input: null): null; +type Colorize = typeof print; + +export declare const $: { enabled: boolean }; + +// Colors +export declare const black: Colorize; +export declare const red: Colorize; +export declare const green: Colorize; +export declare const yellow: Colorize; +export declare const blue: Colorize; +export declare const magenta: Colorize; +export declare const cyan: Colorize; +export declare const white: Colorize; +export declare const gray: Colorize; +export declare const grey: Colorize; + +// Backgrounds +export declare const bgBlack: Colorize; +export declare const bgRed: Colorize; +export declare const bgGreen: Colorize; +export declare const bgYellow: Colorize; +export declare const bgBlue: Colorize; +export declare const bgMagenta: Colorize; +export declare const bgCyan: Colorize; +export declare const bgWhite: Colorize; + +// Modifiers +export declare const reset: Colorize; +export declare const bold: Colorize; +export declare const dim: Colorize; +export declare const italic: Colorize; +export declare const underline: Colorize; +export declare const inverse: Colorize; +export declare const hidden: Colorize; +export declare const strikethrough: Colorize; diff --git a/node_modules/kleur/colors.js b/node_modules/kleur/colors.js new file mode 100644 index 00000000..89fb012d --- /dev/null +++ b/node_modules/kleur/colors.js @@ -0,0 +1,53 @@ +let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true; +if (typeof process !== 'undefined') { + ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {}); + isTTY = process.stdout && process.stdout.isTTY; +} + +const $ = exports.$ = { + enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && ( + FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY + ) +} + +function init(x, y) { + let rgx = new RegExp(`\\x1b\\[${y}m`, 'g'); + let open = `\x1b[${x}m`, close = `\x1b[${y}m`; + + return function (txt) { + if (!$.enabled || txt == null) return txt; + return open + (!!~(''+txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close; + }; +} + +// modifiers +exports.reset = init(0, 0); +exports.bold = init(1, 22); +exports.dim = init(2, 22); +exports.italic = init(3, 23); +exports.underline = init(4, 24); +exports.inverse = init(7, 27); +exports.hidden = init(8, 28); +exports.strikethrough = init(9, 29); + +// colors +exports.black = init(30, 39); +exports.red = init(31, 39); +exports.green = init(32, 39); +exports.yellow = init(33, 39); +exports.blue = init(34, 39); +exports.magenta = init(35, 39); +exports.cyan = init(36, 39); +exports.white = init(37, 39); +exports.gray = init(90, 39); +exports.grey = init(90, 39); + +// background colors +exports.bgBlack = init(40, 49); +exports.bgRed = init(41, 49); +exports.bgGreen = init(42, 49); +exports.bgYellow = init(43, 49); +exports.bgBlue = init(44, 49); +exports.bgMagenta = init(45, 49); +exports.bgCyan = init(46, 49); +exports.bgWhite = init(47, 49); diff --git a/node_modules/kleur/colors.mjs b/node_modules/kleur/colors.mjs new file mode 100644 index 00000000..e9feb83e --- /dev/null +++ b/node_modules/kleur/colors.mjs @@ -0,0 +1,53 @@ +let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true; +if (typeof process !== 'undefined') { + ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {}); + isTTY = process.stdout && process.stdout.isTTY; +} + +export const $ = { + enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && ( + FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY + ) +} + +function init(x, y) { + let rgx = new RegExp(`\\x1b\\[${y}m`, 'g'); + let open = `\x1b[${x}m`, close = `\x1b[${y}m`; + + return function (txt) { + if (!$.enabled || txt == null) return txt; + return open + (!!~(''+txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close; + }; +} + +// modifiers +export const reset = init(0, 0); +export const bold = init(1, 22); +export const dim = init(2, 22); +export const italic = init(3, 23); +export const underline = init(4, 24); +export const inverse = init(7, 27); +export const hidden = init(8, 28); +export const strikethrough = init(9, 29); + +// colors +export const black = init(30, 39); +export const red = init(31, 39); +export const green = init(32, 39); +export const yellow = init(33, 39); +export const blue = init(34, 39); +export const magenta = init(35, 39); +export const cyan = init(36, 39); +export const white = init(37, 39); +export const gray = init(90, 39); +export const grey = init(90, 39); + +// background colors +export const bgBlack = init(40, 49); +export const bgRed = init(41, 49); +export const bgGreen = init(42, 49); +export const bgYellow = init(43, 49); +export const bgBlue = init(44, 49); +export const bgMagenta = init(45, 49); +export const bgCyan = init(46, 49); +export const bgWhite = init(47, 49); diff --git a/node_modules/kleur/index.d.ts b/node_modules/kleur/index.d.ts new file mode 100644 index 00000000..fdc26ca9 --- /dev/null +++ b/node_modules/kleur/index.d.ts @@ -0,0 +1,45 @@ +// Originally by: Rogier Schouten +// Adapted by: Madhav Varshney +declare namespace kleur { + interface Color { + (x: string | number): string; + (): Kleur; + } + + interface Kleur { + // Colors + black: Color; + red: Color; + green: Color; + yellow: Color; + blue: Color; + magenta: Color; + cyan: Color; + white: Color; + gray: Color; + grey: Color; + + // Backgrounds + bgBlack: Color; + bgRed: Color; + bgGreen: Color; + bgYellow: Color; + bgBlue: Color; + bgMagenta: Color; + bgCyan: Color; + bgWhite: Color; + + // Modifiers + reset: Color; + bold: Color; + dim: Color; + italic: Color; + underline: Color; + inverse: Color; + hidden: Color; + strikethrough: Color; + } +} + +declare let kleur: kleur.Kleur & { enabled: boolean }; +export = kleur; diff --git a/node_modules/kleur/index.js b/node_modules/kleur/index.js new file mode 100644 index 00000000..5800b981 --- /dev/null +++ b/node_modules/kleur/index.js @@ -0,0 +1,110 @@ +'use strict'; + +let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true; +if (typeof process !== 'undefined') { + ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {}); + isTTY = process.stdout && process.stdout.isTTY; +} + +const $ = { + enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && ( + FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY + ), + + // modifiers + reset: init(0, 0), + bold: init(1, 22), + dim: init(2, 22), + italic: init(3, 23), + underline: init(4, 24), + inverse: init(7, 27), + hidden: init(8, 28), + strikethrough: init(9, 29), + + // colors + black: init(30, 39), + red: init(31, 39), + green: init(32, 39), + yellow: init(33, 39), + blue: init(34, 39), + magenta: init(35, 39), + cyan: init(36, 39), + white: init(37, 39), + gray: init(90, 39), + grey: init(90, 39), + + // background colors + bgBlack: init(40, 49), + bgRed: init(41, 49), + bgGreen: init(42, 49), + bgYellow: init(43, 49), + bgBlue: init(44, 49), + bgMagenta: init(45, 49), + bgCyan: init(46, 49), + bgWhite: init(47, 49) +}; + +function run(arr, str) { + let i=0, tmp, beg='', end=''; + for (; i < arr.length; i++) { + tmp = arr[i]; + beg += tmp.open; + end += tmp.close; + if (!!~str.indexOf(tmp.close)) { + str = str.replace(tmp.rgx, tmp.close + tmp.open); + } + } + return beg + str + end; +} + +function chain(has, keys) { + let ctx = { has, keys }; + + ctx.reset = $.reset.bind(ctx); + ctx.bold = $.bold.bind(ctx); + ctx.dim = $.dim.bind(ctx); + ctx.italic = $.italic.bind(ctx); + ctx.underline = $.underline.bind(ctx); + ctx.inverse = $.inverse.bind(ctx); + ctx.hidden = $.hidden.bind(ctx); + ctx.strikethrough = $.strikethrough.bind(ctx); + + ctx.black = $.black.bind(ctx); + ctx.red = $.red.bind(ctx); + ctx.green = $.green.bind(ctx); + ctx.yellow = $.yellow.bind(ctx); + ctx.blue = $.blue.bind(ctx); + ctx.magenta = $.magenta.bind(ctx); + ctx.cyan = $.cyan.bind(ctx); + ctx.white = $.white.bind(ctx); + ctx.gray = $.gray.bind(ctx); + ctx.grey = $.grey.bind(ctx); + + ctx.bgBlack = $.bgBlack.bind(ctx); + ctx.bgRed = $.bgRed.bind(ctx); + ctx.bgGreen = $.bgGreen.bind(ctx); + ctx.bgYellow = $.bgYellow.bind(ctx); + ctx.bgBlue = $.bgBlue.bind(ctx); + ctx.bgMagenta = $.bgMagenta.bind(ctx); + ctx.bgCyan = $.bgCyan.bind(ctx); + ctx.bgWhite = $.bgWhite.bind(ctx); + + return ctx; +} + +function init(open, close) { + let blk = { + open: `\x1b[${open}m`, + close: `\x1b[${close}m`, + rgx: new RegExp(`\\x1b\\[${close}m`, 'g') + }; + return function (txt) { + if (this !== void 0 && this.has !== void 0) { + !!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk)); + return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+''; + } + return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+''; + }; +} + +module.exports = $; diff --git a/node_modules/kleur/index.mjs b/node_modules/kleur/index.mjs new file mode 100644 index 00000000..96dadad2 --- /dev/null +++ b/node_modules/kleur/index.mjs @@ -0,0 +1,110 @@ +'use strict'; + +let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true; +if (typeof process !== 'undefined') { + ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {}); + isTTY = process.stdout && process.stdout.isTTY; +} + +const $ = { + enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && ( + FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY + ), + + // modifiers + reset: init(0, 0), + bold: init(1, 22), + dim: init(2, 22), + italic: init(3, 23), + underline: init(4, 24), + inverse: init(7, 27), + hidden: init(8, 28), + strikethrough: init(9, 29), + + // colors + black: init(30, 39), + red: init(31, 39), + green: init(32, 39), + yellow: init(33, 39), + blue: init(34, 39), + magenta: init(35, 39), + cyan: init(36, 39), + white: init(37, 39), + gray: init(90, 39), + grey: init(90, 39), + + // background colors + bgBlack: init(40, 49), + bgRed: init(41, 49), + bgGreen: init(42, 49), + bgYellow: init(43, 49), + bgBlue: init(44, 49), + bgMagenta: init(45, 49), + bgCyan: init(46, 49), + bgWhite: init(47, 49) +}; + +function run(arr, str) { + let i=0, tmp, beg='', end=''; + for (; i < arr.length; i++) { + tmp = arr[i]; + beg += tmp.open; + end += tmp.close; + if (!!~str.indexOf(tmp.close)) { + str = str.replace(tmp.rgx, tmp.close + tmp.open); + } + } + return beg + str + end; +} + +function chain(has, keys) { + let ctx = { has, keys }; + + ctx.reset = $.reset.bind(ctx); + ctx.bold = $.bold.bind(ctx); + ctx.dim = $.dim.bind(ctx); + ctx.italic = $.italic.bind(ctx); + ctx.underline = $.underline.bind(ctx); + ctx.inverse = $.inverse.bind(ctx); + ctx.hidden = $.hidden.bind(ctx); + ctx.strikethrough = $.strikethrough.bind(ctx); + + ctx.black = $.black.bind(ctx); + ctx.red = $.red.bind(ctx); + ctx.green = $.green.bind(ctx); + ctx.yellow = $.yellow.bind(ctx); + ctx.blue = $.blue.bind(ctx); + ctx.magenta = $.magenta.bind(ctx); + ctx.cyan = $.cyan.bind(ctx); + ctx.white = $.white.bind(ctx); + ctx.gray = $.gray.bind(ctx); + ctx.grey = $.grey.bind(ctx); + + ctx.bgBlack = $.bgBlack.bind(ctx); + ctx.bgRed = $.bgRed.bind(ctx); + ctx.bgGreen = $.bgGreen.bind(ctx); + ctx.bgYellow = $.bgYellow.bind(ctx); + ctx.bgBlue = $.bgBlue.bind(ctx); + ctx.bgMagenta = $.bgMagenta.bind(ctx); + ctx.bgCyan = $.bgCyan.bind(ctx); + ctx.bgWhite = $.bgWhite.bind(ctx); + + return ctx; +} + +function init(open, close) { + let blk = { + open: `\x1b[${open}m`, + close: `\x1b[${close}m`, + rgx: new RegExp(`\\x1b\\[${close}m`, 'g') + }; + return function (txt) { + if (this !== void 0 && this.has !== void 0) { + !!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk)); + return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+''; + } + return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+''; + }; +} + +export default $; diff --git a/node_modules/kleur/license b/node_modules/kleur/license new file mode 100644 index 00000000..a3f96f82 --- /dev/null +++ b/node_modules/kleur/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Luke Edwards (lukeed.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/kleur/package.json b/node_modules/kleur/package.json new file mode 100644 index 00000000..5007c057 --- /dev/null +++ b/node_modules/kleur/package.json @@ -0,0 +1,51 @@ +{ + "name": "kleur", + "version": "4.1.5", + "repository": "lukeed/kleur", + "description": "The fastest Node.js library for formatting terminal text with ANSI colors~!", + "module": "index.mjs", + "types": "index.d.ts", + "main": "index.js", + "license": "MIT", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "require": "./index.js" + }, + "./colors": { + "types": "./colors.d.ts", + "import": "./colors.mjs", + "require": "./colors.js" + } + }, + "files": [ + "*.d.ts", + "colors.*", + "index.*" + ], + "author": { + "name": "Luke Edwards", + "email": "luke.edwards05@gmail.com", + "url": "https://lukeed.com" + }, + "scripts": { + "build": "node build", + "test": "uvu -r esm -i utils -i xyz" + }, + "engines": { + "node": ">=6" + }, + "keywords": [ + "ansi", + "cli", + "color", + "colors", + "console", + "terminal" + ], + "devDependencies": { + "esm": "3.2.25", + "uvu": "0.3.3" + } +} diff --git a/node_modules/kleur/readme.md b/node_modules/kleur/readme.md new file mode 100644 index 00000000..de7f5aa0 --- /dev/null +++ b/node_modules/kleur/readme.md @@ -0,0 +1,232 @@ +
+ kleur +
+ + + +
The fastest Node.js library for formatting terminal text with ANSI colors~!
+ +## Features + +* No dependencies +* Super [lightweight](#load-time) & [performant](#performance) +* Supports [nested](#nested-methods) & [chained](#chained-methods) colors +* No `String.prototype` modifications +* Conditional [color support](#conditional-support) +* [Fully treeshakable](#individual-colors) +* Familiar [API](#api) + +--- + +As of `v3.0` the Chalk-style syntax (magical getter) is no longer used.
Please visit [History](#history) for migration paths supporting that syntax. + +--- + + +## Install + +``` +$ npm install --save kleur +``` + + +## Usage + +```js +import kleur from 'kleur'; + +// basic usage +kleur.red('red text'); + +// chained methods +kleur.blue().bold().underline('howdy partner'); + +// nested methods +kleur.bold(`${ white().bgRed('[ERROR]') } ${ kleur.red().italic('Something happened')}`); +``` + +### Chained Methods + +```js +const { bold, green } = require('kleur'); + +console.log(bold().red('this is a bold red message')); +console.log(bold().italic('this is a bold italicized message')); +console.log(bold().yellow().bgRed().italic('this is a bold yellow italicized message')); +console.log(green().bold().underline('this is a bold green underlined message')); +``` + + + +### Nested Methods + +```js +const { yellow, red, cyan } = require('kleur'); + +console.log(yellow(`foo ${red().bold('red')} bar ${cyan('cyan')} baz`)); +console.log(yellow('foo ' + red().bold('red') + ' bar ' + cyan('cyan') + ' baz')); +``` + + + + +### Conditional Support + +Toggle color support as needed; `kleur` includes simple auto-detection which may not cover all cases. + +> **Note:** Both `kleur` and `kleur/colors` share the same detection logic. + +```js +import kleur from 'kleur'; + +// manually disable +kleur.enabled = false; + +// or use another library to detect support +kleur.enabled = require('color-support').level > 0; + +console.log(kleur.red('I will only be colored red if the terminal supports colors')); +``` + +> **Important:**
Colors will be disabled automatically in non [TTY contexts](https://nodejs.org/api/process.html#process_a_note_on_process_i_o). For example, spawning another process or piping output into another process will disable colorization automatically. To force colors in your piped output, you may do so with the `FORCE_COLOR=1` environment variable: + +```sh +$ node app.js #=> COLORS +$ node app.js > log.txt #=> NO COLORS +$ FORCE_COLOR=1 node app.js > log.txt #=> COLORS +$ FORCE_COLOR=0 node app.js > log.txt #=> NO COLORS +``` + +## API + +Any `kleur` method returns a `String` when invoked with input; otherwise chaining is expected. + +> It's up to the developer to pass the output to destinations like `console.log`, `process.stdout.write`, etc. + +The methods below are grouped by type for legibility purposes only. They each can be [chained](#chained-methods) or [nested](#nested-methods) with one another. + +***Colors:*** +> black — red — green — yellow — blue — magenta — cyan — white — gray — grey + +***Backgrounds:*** +> bgBlack — bgRed — bgGreen — bgYellow — bgBlue — bgMagenta — bgCyan — bgWhite + +***Modifiers:*** +> reset — bold — dim — italic* — underline — inverse — hidden — strikethrough* + +* Not widely supported + + +## Individual Colors + +When you only need a few colors, it doesn't make sense to import _all_ of `kleur` because, as small as it is, `kleur` is not treeshakeable, and so most of its code will be doing nothing. In order to fix this, you can import from the `kleur/colors` submodule which _fully_ supports tree-shaking. + +The caveat with this approach is that color functions **are not** chainable~!
Each function receives and colorizes its input. You may combine colors, backgrounds, and modifiers by nesting function calls within other functions. + +```js +// or: import * as kleur from 'kleur/colors'; +import { red, underline, bgWhite } from 'kleur/colors'; + +red('red text'); +//~> kleur.red('red text'); + +underline(red('red underlined text')); +//~> kleur.underline().red('red underlined text'); + +bgWhite(underline(red('red underlined text w/ white background'))); +//~> kleur.bgWhite().underline().red('red underlined text w/ white background'); +``` + +> **Note:** All the same [colors, backgrounds, and modifiers](#api) are available. + +***Conditional Support*** + +The `kleur/colors` submodule also allows you to toggle color support, as needed.
+It includes the same initial assumptions as `kleur`, in an attempt to have colors enabled by default. + +Unlike `kleur`, this setting exists as `kleur.$.enabled` instead of `kleur.enabled`: + +```js +import * as kleur from 'kleur/colors'; +// or: import { $, red } from 'kleur/colors'; + +// manually disabled +kleur.$.enabled = false; + +// or use another library to detect support +kleur.$.enabled = require('color-support').level > 0; + +console.log(red('I will only be colored red if the terminal supports colors')); +``` + + +## Benchmarks + +> Using Node v10.13.0 + +### Load time + +``` +chalk :: 5.303ms +kleur :: 0.488ms +kleur/colors :: 0.369ms +ansi-colors :: 1.504ms +``` + +### Performance + +``` +# All Colors + ansi-colors x 177,625 ops/sec ±1.47% (92 runs sampled) + chalk x 611,907 ops/sec ±0.20% (92 runs sampled) + kleur x 742,509 ops/sec ±1.47% (93 runs sampled) + kleur/colors x 881,742 ops/sec ±0.19% (98 runs sampled) + +# Stacked colors + ansi-colors x 23,331 ops/sec ±1.81% (94 runs sampled) + chalk x 337,178 ops/sec ±0.20% (98 runs sampled) + kleur x 78,299 ops/sec ±1.01% (97 runs sampled) + kleur/colors x 104,431 ops/sec ±0.22% (97 runs sampled) + +# Nested colors + ansi-colors x 67,181 ops/sec ±1.15% (92 runs sampled) + chalk x 116,361 ops/sec ±0.63% (94 runs sampled) + kleur x 139,514 ops/sec ±0.76% (95 runs sampled) + kleur/colors x 145,716 ops/sec ±0.97% (97 runs sampled) +``` + + +## History + +This project originally forked [`ansi-colors`](https://github.com/doowb/ansi-colors). + +Beginning with `kleur@3.0`, the Chalk-style syntax (magical getter) has been replaced with function calls per key: + +```js +// Old: +c.red.bold.underline('old'); + +// New: +c.red().bold().underline('new'); +``` +> As I work more with Rust, the newer syntax feels so much better & more natural! + +If you prefer the old syntax, you may migrate to `ansi-colors` or newer `chalk` releases.
Versions below `kleur@3.0` have been officially deprecated. + + +## License + +MIT © [Luke Edwards](https://lukeed.com) diff --git a/node_modules/lines-and-columns/LICENSE b/node_modules/lines-and-columns/LICENSE new file mode 100644 index 00000000..12978ece --- /dev/null +++ b/node_modules/lines-and-columns/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Brian Donovan + +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/lines-and-columns/README.md b/node_modules/lines-and-columns/README.md new file mode 100644 index 00000000..fa902237 --- /dev/null +++ b/node_modules/lines-and-columns/README.md @@ -0,0 +1,33 @@ +# lines-and-columns + +Maps lines and columns to character offsets and back. This is useful for parsers +and other text processors that deal in character ranges but process text with +meaningful lines and columns. + +## Install + +``` +$ npm install [--save] lines-and-columns +``` + +## Usage + +```js +import { LinesAndColumns } from 'lines-and-columns' + +const lines = new LinesAndColumns( + `table { + border: 0 +}` +) + +lines.locationForIndex(9) +// { line: 1, column: 1 } + +lines.indexForLocation({ line: 1, column: 2 }) +// 10 +``` + +## License + +MIT diff --git a/node_modules/lines-and-columns/build/index.d.ts b/node_modules/lines-and-columns/build/index.d.ts new file mode 100644 index 00000000..459bc1fb --- /dev/null +++ b/node_modules/lines-and-columns/build/index.d.ts @@ -0,0 +1,13 @@ +export declare type SourceLocation = { + line: number; + column: number; +}; +export declare class LinesAndColumns { + private string; + private offsets; + constructor(string: string); + locationForIndex(index: number): SourceLocation | null; + indexForLocation(location: SourceLocation): number | null; + private lengthOfLine; +} +export default LinesAndColumns; diff --git a/node_modules/lines-and-columns/build/index.js b/node_modules/lines-and-columns/build/index.js new file mode 100644 index 00000000..5117cadc --- /dev/null +++ b/node_modules/lines-and-columns/build/index.js @@ -0,0 +1,62 @@ +"use strict"; +exports.__esModule = true; +exports.LinesAndColumns = void 0; +var LF = '\n'; +var CR = '\r'; +var LinesAndColumns = /** @class */ (function () { + function LinesAndColumns(string) { + this.string = string; + var offsets = [0]; + for (var offset = 0; offset < string.length;) { + switch (string[offset]) { + case LF: + offset += LF.length; + offsets.push(offset); + break; + case CR: + offset += CR.length; + if (string[offset] === LF) { + offset += LF.length; + } + offsets.push(offset); + break; + default: + offset++; + break; + } + } + this.offsets = offsets; + } + LinesAndColumns.prototype.locationForIndex = function (index) { + if (index < 0 || index > this.string.length) { + return null; + } + var line = 0; + var offsets = this.offsets; + while (offsets[line + 1] <= index) { + line++; + } + var column = index - offsets[line]; + return { line: line, column: column }; + }; + LinesAndColumns.prototype.indexForLocation = function (location) { + var line = location.line, column = location.column; + if (line < 0 || line >= this.offsets.length) { + return null; + } + if (column < 0 || column > this.lengthOfLine(line)) { + return null; + } + return this.offsets[line] + column; + }; + LinesAndColumns.prototype.lengthOfLine = function (line) { + var offset = this.offsets[line]; + var nextOffset = line === this.offsets.length - 1 + ? this.string.length + : this.offsets[line + 1]; + return nextOffset - offset; + }; + return LinesAndColumns; +}()); +exports.LinesAndColumns = LinesAndColumns; +exports["default"] = LinesAndColumns; diff --git a/node_modules/lines-and-columns/package.json b/node_modules/lines-and-columns/package.json new file mode 100644 index 00000000..a12eb6bf --- /dev/null +++ b/node_modules/lines-and-columns/package.json @@ -0,0 +1,49 @@ +{ + "name": "lines-and-columns", + "version": "1.2.4", + "description": "Maps lines and columns to character offsets and back.", + "keywords": [ + "lines", + "columns", + "parser" + ], + "homepage": "https://github.com/eventualbuddha/lines-and-columns#readme", + "bugs": { + "url": "https://github.com/eventualbuddha/lines-and-columns/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/eventualbuddha/lines-and-columns.git" + }, + "license": "MIT", + "author": "Brian Donovan ", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "files": [ + "build" + ], + "scripts": { + "build:watch": "tsc --build tsconfig.build.json --watch", + "lint": "eslint .", + "lint:fix": "eslint . --fix", + "test": "is-ci test:coverage test:watch", + "test:coverage": "jest --coverage", + "test:watch": "jest --watch" + }, + "devDependencies": { + "@types/jest": "^27.0.3", + "@types/node": "^16.11.9", + "@typescript-eslint/eslint-plugin": "^5.4.0", + "@typescript-eslint/parser": "^5.4.0", + "esbuild": "^0.13.15", + "esbuild-runner": "^2.2.1", + "eslint": "^8.2.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-prettier": "^4.0.0", + "is-ci-cli": "^2.2.0", + "jest": "^27.3.1", + "prettier": "^2.4.1", + "semantic-release": "^18.0.0", + "typescript": "^4.5.2" + } +} diff --git a/node_modules/locate-character/README.md b/node_modules/locate-character/README.md new file mode 100644 index 00000000..8e37bd0d --- /dev/null +++ b/node_modules/locate-character/README.md @@ -0,0 +1,66 @@ +# locate-character + +Get the line and column number of a particular character in a string. + +## Installation + +`npm install locate-character`, or get it from [unpkg.com/locate-character](https://unpkg.com/locate-character). + +## Usage + +To search for a particular character, using the index or a search string, use `locate`: + +```js +import { locate } from 'locate-character'; + +const sample = ` +A flea and a fly in a flue +Were imprisoned, so what could they do? +Said the fly, "let us flee!" +"Let us fly!" said the flea. +So they flew through a flaw in the flue. +`.trim(); + +// Using a character index +const index = sample.indexOf('fly'); +locate(sample, index); +// -> { line: 0, column: 13, character: 13 } + +// Using the string itself +locate(sample, 'fly'); +// -> { line: 0, column: 13, character: 13 } + +// Using the string with a start index +locate(sample, 'fly', { startIndex: 14 }); +// -> { line: 2, column: 9, character: 76 } +``` + +If you will be searching the same string repeatedly, it's much faster if you use `getLocator`: + +```js +import { getLocator } from 'locate-character'; + +const locate = getLocator(sample); + +let location = locate(13); +// -> { line: 0, column: 13, character: 13 } + +location = locate('fly', { startIndex: location.character + 1 }); +// -> { line: 2, column: 9, character: 76 } + +location = locate('fly', { startIndex: location.character + 1 }); +// -> { line: 3, column: 8, character: 104 } +``` + +In some situations (for example, dealing with sourcemaps), you need one-based line numbers: + +```js +getLocator(sample, { offsetLine: 1 }); +locate(sample, { offsetLine: 1 }); +``` + +There's also an `offsetColumn` option which is less useful in real-world situations. + +## License + +MIT diff --git a/node_modules/locate-character/package.json b/node_modules/locate-character/package.json new file mode 100644 index 00000000..9357ebd4 --- /dev/null +++ b/node_modules/locate-character/package.json @@ -0,0 +1,44 @@ +{ + "name": "locate-character", + "version": "3.0.0", + "description": "Get the line and column number of a specific character in a string", + "type": "module", + "types": "./types/index.d.ts", + "exports": { + "types": "./types/index.d.ts", + "import": "./src/index.js" + }, + "scripts": { + "test": "node test/test.js", + "build": "dts-buddy", + "prepublishOnly": "npm test && npm run build" + }, + "files": [ + "src", + "types", + "README.md" + ], + "repository": { + "type": "git", + "url": "git+https://gitlab.com/Rich-Harris/locate-character.git" + }, + "keywords": [ + "string", + "character", + "locate", + "line", + "column", + "location" + ], + "author": "Rich Harris", + "license": "MIT", + "bugs": { + "url": "https://gitlab.com/Rich-Harris/locate-character/issues" + }, + "homepage": "https://gitlab.com/Rich-Harris/locate-character#README", + "devDependencies": { + "dts-buddy": "^0.1.6", + "typescript": "^5.1.3" + }, + "packageManager": "pnpm@8.6.2" +} \ No newline at end of file diff --git a/node_modules/locate-character/src/index.js b/node_modules/locate-character/src/index.js new file mode 100644 index 00000000..23068218 --- /dev/null +++ b/node_modules/locate-character/src/index.js @@ -0,0 +1,72 @@ +/** @typedef {import('./types').Location} Location */ + +/** + * @param {import('./types').Range} range + * @param {number} index + */ +function rangeContains(range, index) { + return range.start <= index && index < range.end; +} + +/** + * @param {string} source + * @param {import('./types').Options} [options] + */ +export function getLocator(source, options = {}) { + const { offsetLine = 0, offsetColumn = 0 } = options; + + let start = 0; + const ranges = source.split('\n').map((line, i) => { + const end = start + line.length + 1; + + /** @type {import('./types').Range} */ + const range = { start, end, line: i }; + + start = end; + return range; + }); + + let i = 0; + + /** + * @param {string | number} search + * @param {number} [index] + * @returns {Location | undefined} + */ + function locator(search, index) { + if (typeof search === 'string') { + search = source.indexOf(search, index ?? 0); + } + + if (search === -1) return undefined; + + let range = ranges[i]; + + const d = search >= range.end ? 1 : -1; + + while (range) { + if (rangeContains(range, search)) { + return { + line: offsetLine + range.line, + column: offsetColumn + search - range.start, + character: search + }; + } + + i += d; + range = ranges[i]; + } + } + + return locator; +} + +/** + * @param {string} source + * @param {string | number} search + * @param {import('./types').Options} [options] + * @returns {Location | undefined} + */ +export function locate(source, search, options) { + return getLocator(source, options)(search, options && options.startIndex); +} diff --git a/node_modules/locate-character/src/types.d.ts b/node_modules/locate-character/src/types.d.ts new file mode 100644 index 00000000..71bf2dd4 --- /dev/null +++ b/node_modules/locate-character/src/types.d.ts @@ -0,0 +1,17 @@ +export interface Options { + offsetLine?: number; + offsetColumn?: number; + startIndex?: number; +} + +export interface Range { + start: number; + end: number; + line: number; +} + +export interface Location { + line: number; + column: number; + character: number; +} diff --git a/node_modules/locate-character/types/index.d.ts b/node_modules/locate-character/types/index.d.ts new file mode 100644 index 00000000..4709ab56 --- /dev/null +++ b/node_modules/locate-character/types/index.d.ts @@ -0,0 +1,19 @@ +declare module 'locate-character' { + export function getLocator(source: string, options?: Options | undefined): (search: string | number, index?: number | undefined) => Location | undefined; + + export function locate(source: string, search: string | number, options?: Options | undefined): Location | undefined; + export type Location = Location_1; + interface Options { + offsetLine?: number; + offsetColumn?: number; + startIndex?: number; + } + + interface Location_1 { + line: number; + column: number; + character: number; + } +} + +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/locate-character/types/index.d.ts.map b/node_modules/locate-character/types/index.d.ts.map new file mode 100644 index 00000000..9376a6f2 --- /dev/null +++ b/node_modules/locate-character/types/index.d.ts.map @@ -0,0 +1,19 @@ +{ + "version": 3, + "file": "index.d.ts", + "names": [ + "getLocator", + "locate", + "Location", + "Options" + ], + "sources": [ + "../src/index.js", + "../src/types.d.ts" + ], + "sourcesContent": [ + null, + null + ], + "mappings": ";iBAcgBA,UAAUA;;iBAuDVC,MAAMA;aCzDLC,QAAQA;WAZRC,OAAOA" +} \ No newline at end of file diff --git a/node_modules/locate-path/index.d.ts b/node_modules/locate-path/index.d.ts new file mode 100644 index 00000000..fbde526c --- /dev/null +++ b/node_modules/locate-path/index.d.ts @@ -0,0 +1,83 @@ +declare namespace locatePath { + interface Options { + /** + Current working directory. + + @default process.cwd() + */ + readonly cwd?: string; + + /** + Type of path to match. + + @default 'file' + */ + readonly type?: 'file' | 'directory'; + + /** + Allow symbolic links to match if they point to the requested path type. + + @default true + */ + readonly allowSymlinks?: boolean; + } + + interface AsyncOptions extends Options { + /** + Number of concurrently pending promises. Minimum: `1`. + + @default Infinity + */ + readonly concurrency?: number; + + /** + Preserve `paths` order when searching. + + Disable this to improve performance if you don't care about the order. + + @default true + */ + readonly preserveOrder?: boolean; + } +} + +declare const locatePath: { + /** + Get the first path that exists on disk of multiple paths. + + @param paths - Paths to check. + @returns The first path that exists or `undefined` if none exists. + + @example + ``` + import locatePath = require('locate-path'); + + const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' + ]; + + (async () => { + console(await locatePath(files)); + //=> 'rainbow' + })(); + ``` + */ + (paths: Iterable, options?: locatePath.AsyncOptions): Promise< + string | undefined + >; + + /** + Synchronously get the first path that exists on disk of multiple paths. + + @param paths - Paths to check. + @returns The first path that exists or `undefined` if none exists. + */ + sync( + paths: Iterable, + options?: locatePath.Options + ): string | undefined; +}; + +export = locatePath; diff --git a/node_modules/locate-path/index.js b/node_modules/locate-path/index.js new file mode 100644 index 00000000..4604bbf4 --- /dev/null +++ b/node_modules/locate-path/index.js @@ -0,0 +1,65 @@ +'use strict'; +const path = require('path'); +const fs = require('fs'); +const {promisify} = require('util'); +const pLocate = require('p-locate'); + +const fsStat = promisify(fs.stat); +const fsLStat = promisify(fs.lstat); + +const typeMappings = { + directory: 'isDirectory', + file: 'isFile' +}; + +function checkType({type}) { + if (type in typeMappings) { + return; + } + + throw new Error(`Invalid type specified: ${type}`); +} + +const matchType = (type, stat) => type === undefined || stat[typeMappings[type]](); + +module.exports = async (paths, options) => { + options = { + cwd: process.cwd(), + type: 'file', + allowSymlinks: true, + ...options + }; + checkType(options); + const statFn = options.allowSymlinks ? fsStat : fsLStat; + + return pLocate(paths, async path_ => { + try { + const stat = await statFn(path.resolve(options.cwd, path_)); + return matchType(options.type, stat); + } catch (_) { + return false; + } + }, options); +}; + +module.exports.sync = (paths, options) => { + options = { + cwd: process.cwd(), + allowSymlinks: true, + type: 'file', + ...options + }; + checkType(options); + const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync; + + for (const path_ of paths) { + try { + const stat = statFn(path.resolve(options.cwd, path_)); + + if (matchType(options.type, stat)) { + return path_; + } + } catch (_) { + } + } +}; diff --git a/node_modules/locate-path/license b/node_modules/locate-path/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/locate-path/license @@ -0,0 +1,9 @@ +MIT License + +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/locate-path/package.json b/node_modules/locate-path/package.json new file mode 100644 index 00000000..063b2902 --- /dev/null +++ b/node_modules/locate-path/package.json @@ -0,0 +1,45 @@ +{ + "name": "locate-path", + "version": "5.0.0", + "description": "Get the first path that exists on disk of multiple paths", + "license": "MIT", + "repository": "sindresorhus/locate-path", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "locate", + "path", + "paths", + "file", + "files", + "exists", + "find", + "finder", + "search", + "searcher", + "array", + "iterable", + "iterator" + ], + "dependencies": { + "p-locate": "^4.1.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/locate-path/readme.md b/node_modules/locate-path/readme.md new file mode 100644 index 00000000..2184c6f3 --- /dev/null +++ b/node_modules/locate-path/readme.md @@ -0,0 +1,122 @@ +# locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path) + +> Get the first path that exists on disk of multiple paths + + +## Install + +``` +$ npm install locate-path +``` + + +## Usage + +Here we find the first file that exists on disk, in array order. + +```js +const locatePath = require('locate-path'); + +const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' +]; + +(async () => { + console(await locatePath(files)); + //=> 'rainbow' +})(); +``` + + +## API + +### locatePath(paths, [options]) + +Returns a `Promise` for the first path that exists or `undefined` if none exists. + +#### paths + +Type: `Iterable` + +Paths to check. + +#### options + +Type: `Object` + +##### concurrency + +Type: `number`
+Default: `Infinity`
+Minimum: `1` + +Number of concurrently pending promises. + +##### preserveOrder + +Type: `boolean`
+Default: `true` + +Preserve `paths` order when searching. + +Disable this to improve performance if you don't care about the order. + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Current working directory. + +##### type + +Type: `string`
+Default: `file`
+Values: `file` `directory` + +The type of paths that can match. + +##### allowSymlinks + +Type: `boolean`
+Default: `true` + +Allow symbolic links to match if they point to the chosen path type. + +### locatePath.sync(paths, [options]) + +Returns the first path that exists or `undefined` if none exists. + +#### paths + +Type: `Iterable` + +Paths to check. + +#### options + +Type: `Object` + +##### cwd + +Same as above. + +##### type + +Same as above. + +##### allowSymlinks + +Same as above. + + +## Related + +- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/make-dir/index.d.ts b/node_modules/make-dir/index.d.ts new file mode 100644 index 00000000..3a782512 --- /dev/null +++ b/node_modules/make-dir/index.d.ts @@ -0,0 +1,66 @@ +/// +import * as fs from 'fs'; + +declare namespace makeDir { + interface Options { + /** + Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/). + + @default 0o777 + */ + readonly mode?: number; + + /** + Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). + + Using a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function. + + @default require('fs') + */ + readonly fs?: typeof fs; + } +} + +declare const makeDir: { + /** + Make a directory and its parents if needed - Think `mkdir -p`. + + @param path - Directory to create. + @returns The path to the created directory. + + @example + ``` + import makeDir = require('make-dir'); + + (async () => { + const path = await makeDir('unicorn/rainbow/cake'); + + console.log(path); + //=> '/Users/sindresorhus/fun/unicorn/rainbow/cake' + + // Multiple directories: + const paths = await Promise.all([ + makeDir('unicorn/rainbow'), + makeDir('foo/bar') + ]); + + console.log(paths); + // [ + // '/Users/sindresorhus/fun/unicorn/rainbow', + // '/Users/sindresorhus/fun/foo/bar' + // ] + })(); + ``` + */ + (path: string, options?: makeDir.Options): Promise; + + /** + Synchronously make a directory and its parents if needed - Think `mkdir -p`. + + @param path - Directory to create. + @returns The path to the created directory. + */ + sync(path: string, options?: makeDir.Options): string; +}; + +export = makeDir; diff --git a/node_modules/make-dir/index.js b/node_modules/make-dir/index.js new file mode 100644 index 00000000..75889d84 --- /dev/null +++ b/node_modules/make-dir/index.js @@ -0,0 +1,156 @@ +'use strict'; +const fs = require('fs'); +const path = require('path'); +const {promisify} = require('util'); +const semver = require('semver'); + +const useNativeRecursiveOption = semver.satisfies(process.version, '>=10.12.0'); + +// https://github.com/nodejs/node/issues/8987 +// https://github.com/libuv/libuv/pull/1088 +const checkPath = pth => { + if (process.platform === 'win32') { + const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, '')); + + if (pathHasInvalidWinCharacters) { + const error = new Error(`Path contains invalid characters: ${pth}`); + error.code = 'EINVAL'; + throw error; + } + } +}; + +const processOptions = options => { + // https://github.com/sindresorhus/make-dir/issues/18 + const defaults = { + mode: 0o777, + fs + }; + + return { + ...defaults, + ...options + }; +}; + +const permissionError = pth => { + // This replicates the exception of `fs.mkdir` with native the + // `recusive` option when run on an invalid drive under Windows. + const error = new Error(`operation not permitted, mkdir '${pth}'`); + error.code = 'EPERM'; + error.errno = -4048; + error.path = pth; + error.syscall = 'mkdir'; + return error; +}; + +const makeDir = async (input, options) => { + checkPath(input); + options = processOptions(options); + + const mkdir = promisify(options.fs.mkdir); + const stat = promisify(options.fs.stat); + + if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) { + const pth = path.resolve(input); + + await mkdir(pth, { + mode: options.mode, + recursive: true + }); + + return pth; + } + + const make = async pth => { + try { + await mkdir(pth, options.mode); + + return pth; + } catch (error) { + if (error.code === 'EPERM') { + throw error; + } + + if (error.code === 'ENOENT') { + if (path.dirname(pth) === pth) { + throw permissionError(pth); + } + + if (error.message.includes('null bytes')) { + throw error; + } + + await make(path.dirname(pth)); + + return make(pth); + } + + try { + const stats = await stat(pth); + if (!stats.isDirectory()) { + throw new Error('The path is not a directory'); + } + } catch (_) { + throw error; + } + + return pth; + } + }; + + return make(path.resolve(input)); +}; + +module.exports = makeDir; + +module.exports.sync = (input, options) => { + checkPath(input); + options = processOptions(options); + + if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) { + const pth = path.resolve(input); + + fs.mkdirSync(pth, { + mode: options.mode, + recursive: true + }); + + return pth; + } + + const make = pth => { + try { + options.fs.mkdirSync(pth, options.mode); + } catch (error) { + if (error.code === 'EPERM') { + throw error; + } + + if (error.code === 'ENOENT') { + if (path.dirname(pth) === pth) { + throw permissionError(pth); + } + + if (error.message.includes('null bytes')) { + throw error; + } + + make(path.dirname(pth)); + return make(pth); + } + + try { + if (!options.fs.statSync(pth).isDirectory()) { + throw new Error('The path is not a directory'); + } + } catch (_) { + throw error; + } + } + + return pth; + }; + + return make(path.resolve(input)); +}; diff --git a/node_modules/make-dir/license b/node_modules/make-dir/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/make-dir/license @@ -0,0 +1,9 @@ +MIT License + +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/make-dir/node_modules/semver/LICENSE b/node_modules/make-dir/node_modules/semver/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +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/make-dir/node_modules/semver/README.md b/node_modules/make-dir/node_modules/semver/README.md new file mode 100644 index 00000000..2293a14f --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/README.md @@ -0,0 +1,443 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` which specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional, but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. The +version `3.4.5` *would* satisfy the range, because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose for this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range matching +semantics. + +Second, a user who has opted into using a prerelease version has +clearly indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for the purpose of range +matching) by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any version satisfies) +* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero element in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0` +* `^0.2.3` := `>=0.2.3 <0.3.0` +* `^0.0.3` := `>=0.0.3 <0.0.4` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0` +* `^0.0.x` := `>=0.0.0 <0.1.0` +* `^0.0` := `>=0.0.0 <0.1.0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0` +* `^0.x` := `>=0.0.0 <1.0.0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose` Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease` Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release)`: Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, the `prerelease` will work the + same as `prepatch`. It increments the patch version, then makes a + prerelease. If the input version is already a prerelease it simply + increments it. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the exact same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions + are equal. Sorts in ascending order if passed to `Array.sort()`. + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `diff(v1, v2)`: Returns difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can possibly match + the given range. +* `gtr(version, range)`: Return `true` if version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the ranges comparators intersect + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so the version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version, options)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string, and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). + +If the `options.rtl` flag is set, then `coerce` will return the right-most +coercible tuple that does not share an ending index with a longer coercible +tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not +`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of +any other overlapping SemVer tuple. + +### Clean + +* `clean(version)`: Clean a string to be a valid semver if possible + +This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges. + +ex. +* `s.clean(' = v 2.1.5foo')`: `null` +* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean(' = v 2.1.5-foo')`: `null` +* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean('=v2.1.5')`: `'2.1.5'` +* `s.clean(' =v2.1.5')`: `2.1.5` +* `s.clean(' 2.1.5 ')`: `'2.1.5'` +* `s.clean('~1.0.0')`: `null` diff --git a/node_modules/make-dir/node_modules/semver/bin/semver.js b/node_modules/make-dir/node_modules/semver/bin/semver.js new file mode 100755 index 00000000..666034a7 --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/bin/semver.js @@ -0,0 +1,174 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +var argv = process.argv.slice(2) + +var versions = [] + +var range = [] + +var inc = null + +var version = require('../package.json').version + +var loose = false + +var includePrerelease = false + +var coerce = false + +var rtl = false + +var identifier + +var semver = require('../semver') + +var reverse = false + +var options = {} + +main() + +function main () { + if (!argv.length) return help() + while (argv.length) { + var a = argv.shift() + var indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + a = a.slice(0, indexOfEqualSign) + argv.unshift(a.slice(indexOfEqualSign + 1)) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-c': case '--coerce': + coerce = true + break + case '--rtl': + rtl = true + break + case '--ltr': + rtl = false + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } + + versions = versions.map(function (v) { + return coerce ? (semver.coerce(v, options) || { version: v }).version : v + }).filter(function (v) { + return semver.valid(v) + }) + if (!versions.length) return fail() + if (inc && (versions.length !== 1 || range.length)) { return failInc() } + + for (var i = 0, l = range.length; i < l; i++) { + versions = versions.filter(function (v) { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) return fail() + } + return success(versions) +} + +function failInc () { + console.error('--inc can only be used on a single version with no range') + fail() +} + +function fail () { process.exit(1) } + +function success () { + var compare = reverse ? 'rcompare' : 'compare' + versions.sort(function (a, b) { + return semver[compare](a, b, options) + }).map(function (v) { + return semver.clean(v, options) + }).map(function (v) { + return inc ? semver.inc(v, inc, options, identifier) : v + }).forEach(function (v, i, _) { console.log(v) }) +} + +function help () { + console.log(['SemVer ' + version, + '', + 'A JavaScript implementation of the https://semver.org/ specification', + 'Copyright Isaac Z. Schlueter', + '', + 'Usage: semver [options] [ [...]]', + 'Prints valid versions sorted by SemVer precedence', + '', + 'Options:', + '-r --range ', + ' Print versions that match the specified range.', + '', + '-i --increment []', + ' Increment a version by the specified level. Level can', + ' be one of: major, minor, patch, premajor, preminor,', + " prepatch, or prerelease. Default level is 'patch'.", + ' Only one version may be specified.', + '', + '--preid ', + ' Identifier to be used to prefix premajor, preminor,', + ' prepatch or prerelease version increments.', + '', + '-l --loose', + ' Interpret versions and ranges loosely', + '', + '-p --include-prerelease', + ' Always include prerelease versions in range matching', + '', + '-c --coerce', + ' Coerce a string into SemVer if possible', + ' (does not imply --loose)', + '', + '--rtl', + ' Coerce version strings right to left', + '', + '--ltr', + ' Coerce version strings left to right (default)', + '', + 'Program exits successfully if any valid version satisfies', + 'all supplied ranges, and prints all satisfying versions.', + '', + 'If no satisfying versions are found, then exits failure.', + '', + 'Versions are printed in ascending order, so supplying', + 'multiple versions to the utility will just sort them.' + ].join('\n')) +} diff --git a/node_modules/make-dir/node_modules/semver/package.json b/node_modules/make-dir/node_modules/semver/package.json new file mode 100644 index 00000000..6b970a62 --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/package.json @@ -0,0 +1,38 @@ +{ + "name": "semver", + "version": "6.3.1", + "description": "The semantic version parser used by npm.", + "main": "semver.js", + "scripts": { + "test": "tap test/ --100 --timeout=30", + "lint": "echo linting disabled", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "snap": "tap test/ --100 --timeout=30", + "posttest": "npm run lint" + }, + "devDependencies": { + "@npmcli/template-oss": "4.17.0", + "tap": "^12.7.0" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "./bin/semver.js" + }, + "files": [ + "bin", + "range.bnf", + "semver.js" + ], + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "content": "./scripts/template-oss", + "version": "4.17.0" + } +} diff --git a/node_modules/make-dir/node_modules/semver/range.bnf b/node_modules/make-dir/node_modules/semver/range.bnf new file mode 100644 index 00000000..d4c6ae0d --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/node_modules/make-dir/node_modules/semver/semver.js b/node_modules/make-dir/node_modules/semver/semver.js new file mode 100644 index 00000000..39319c13 --- /dev/null +++ b/node_modules/make-dir/node_modules/semver/semver.js @@ -0,0 +1,1643 @@ +exports = module.exports = SemVer + +var debug +/* istanbul ignore next */ +if (typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift('SEMVER') + console.log.apply(console, args) + } +} else { + debug = function () {} +} + +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0' + +var MAX_LENGTH = 256 +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +var MAX_SAFE_COMPONENT_LENGTH = 16 + +var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +// The actual regexps go on exports.re +var re = exports.re = [] +var safeRe = exports.safeRe = [] +var src = exports.src = [] +var t = exports.tokens = {} +var R = 0 + +function tok (n) { + t[n] = R++ +} + +var LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +var safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +function makeSafeRe (value) { + for (var i = 0; i < safeRegexReplacements.length; i++) { + var token = safeRegexReplacements[i][0] + var max = safeRegexReplacements[i][1] + value = value + .split(token + '*').join(token + '{0,' + max + '}') + .split(token + '+').join(token + '{1,' + max + '}') + } + return value +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +tok('NUMERICIDENTIFIER') +src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' +tok('NUMERICIDENTIFIERLOOSE') +src[t.NUMERICIDENTIFIERLOOSE] = '\\d+' + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +tok('NONNUMERICIDENTIFIER') +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' + +// ## Main Version +// Three dot-separated numeric identifiers. + +tok('MAINVERSION') +src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIER] + ')' + +tok('MAINVERSIONLOOSE') +src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')' + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +tok('PRERELEASEIDENTIFIER') +src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + + '|' + src[t.NONNUMERICIDENTIFIER] + ')' + +tok('PRERELEASEIDENTIFIERLOOSE') +src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + + '|' + src[t.NONNUMERICIDENTIFIER] + ')' + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +tok('PRERELEASE') +src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))' + +tok('PRERELEASELOOSE') +src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))' + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +tok('BUILDIDENTIFIER') +src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +tok('BUILD') +src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))' + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +tok('FULL') +tok('FULLPLAIN') +src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + + src[t.PRERELEASE] + '?' + + src[t.BUILD] + '?' + +src[t.FULL] = '^' + src[t.FULLPLAIN] + '$' + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +tok('LOOSEPLAIN') +src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + + src[t.PRERELEASELOOSE] + '?' + + src[t.BUILD] + '?' + +tok('LOOSE') +src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$' + +tok('GTLT') +src[t.GTLT] = '((?:<|>)?=?)' + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +tok('XRANGEIDENTIFIERLOOSE') +src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' +tok('XRANGEIDENTIFIER') +src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*' + +tok('XRANGEPLAIN') +src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + + '(?:' + src[t.PRERELEASE] + ')?' + + src[t.BUILD] + '?' + + ')?)?' + +tok('XRANGEPLAINLOOSE') +src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[t.PRERELEASELOOSE] + ')?' + + src[t.BUILD] + '?' + + ')?)?' + +tok('XRANGE') +src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$' +tok('XRANGELOOSE') +src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$' + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +tok('COERCE') +src[t.COERCE] = '(^|[^\\d])' + + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + + '(?:$|[^\\d])' +tok('COERCERTL') +re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') +safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g') + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +tok('LONETILDE') +src[t.LONETILDE] = '(?:~>?)' + +tok('TILDETRIM') +src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' +re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') +safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g') +var tildeTrimReplace = '$1~' + +tok('TILDE') +src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$' +tok('TILDELOOSE') +src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$' + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +tok('LONECARET') +src[t.LONECARET] = '(?:\\^)' + +tok('CARETTRIM') +src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' +re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') +safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g') +var caretTrimReplace = '$1^' + +tok('CARET') +src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$' +tok('CARETLOOSE') +src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$' + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +tok('COMPARATORLOOSE') +src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$' +tok('COMPARATOR') +src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$' + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +tok('COMPARATORTRIM') +src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')' + +// this one has to use the /g flag +re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') +safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g') +var comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +tok('HYPHENRANGE') +src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[t.XRANGEPLAIN] + ')' + + '\\s*$' + +tok('HYPHENRANGELOOSE') +src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[t.XRANGEPLAINLOOSE] + ')' + + '\\s*$' + +// Star ranges basically just allow anything at all. +tok('STAR') +src[t.STAR] = '(<|>)?=?\\s*\\*' + +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]) + if (!re[i]) { + re[i] = new RegExp(src[i]) + + // Replace all greedy whitespace to prevent regex dos issues. These regex are + // used internally via the safeRe object since all inputs in this library get + // normalized first to trim and collapse all extra whitespace. The original + // regexes are exported for userland consumption and lower level usage. A + // future breaking change could export the safer regex only with a note that + // all input should have extra whitespace removed. + safeRe[i] = new RegExp(makeSafeRe(src[i])) + } +} + +exports.parse = parse +function parse (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +exports.valid = valid +function valid (version, options) { + var v = parse(version, options) + return v ? v.version : null +} + +exports.clean = clean +function clean (version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} + +exports.SemVer = SemVer + +function SemVer (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + } + + if (!(this instanceof SemVer)) { + return new SemVer(version, options) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + + var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]) + + if (!m) { + throw new TypeError('Invalid Version: ' + version) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() +} + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.') + } + return this.version +} + +SemVer.prototype.toString = function () { + return this.version +} + +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return this.compareMain(other) || this.comparePre(other) +} + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) +} + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + var i = 0 + do { + var a = this.prerelease[i] + var b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +SemVer.prototype.compareBuild = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + var i = 0 + do { + var a = this.build[i] + var b = other.build[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) +} + +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + var i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break + + default: + throw new Error('invalid increment argument: ' + release) + } + this.format() + this.raw = this.version + return this +} + +exports.inc = inc +function inc (version, release, loose, identifier) { + if (typeof (loose) === 'string') { + identifier = loose + loose = undefined + } + + try { + return new SemVer(version, loose).inc(release, identifier).version + } catch (er) { + return null + } +} + +exports.diff = diff +function diff (version1, version2) { + if (eq(version1, version2)) { + return null + } else { + var v1 = parse(version1) + var v2 = parse(version2) + var prefix = '' + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre' + var defaultResult = 'prerelease' + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} + +exports.compareIdentifiers = compareIdentifiers + +var numeric = /^[0-9]+$/ +function compareIdentifiers (a, b) { + var anum = numeric.test(a) + var bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +exports.rcompareIdentifiers = rcompareIdentifiers +function rcompareIdentifiers (a, b) { + return compareIdentifiers(b, a) +} + +exports.major = major +function major (a, loose) { + return new SemVer(a, loose).major +} + +exports.minor = minor +function minor (a, loose) { + return new SemVer(a, loose).minor +} + +exports.patch = patch +function patch (a, loose) { + return new SemVer(a, loose).patch +} + +exports.compare = compare +function compare (a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)) +} + +exports.compareLoose = compareLoose +function compareLoose (a, b) { + return compare(a, b, true) +} + +exports.compareBuild = compareBuild +function compareBuild (a, b, loose) { + var versionA = new SemVer(a, loose) + var versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} + +exports.rcompare = rcompare +function rcompare (a, b, loose) { + return compare(b, a, loose) +} + +exports.sort = sort +function sort (list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(a, b, loose) + }) +} + +exports.rsort = rsort +function rsort (list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(b, a, loose) + }) +} + +exports.gt = gt +function gt (a, b, loose) { + return compare(a, b, loose) > 0 +} + +exports.lt = lt +function lt (a, b, loose) { + return compare(a, b, loose) < 0 +} + +exports.eq = eq +function eq (a, b, loose) { + return compare(a, b, loose) === 0 +} + +exports.neq = neq +function neq (a, b, loose) { + return compare(a, b, loose) !== 0 +} + +exports.gte = gte +function gte (a, b, loose) { + return compare(a, b, loose) >= 0 +} + +exports.lte = lte +function lte (a, b, loose) { + return compare(a, b, loose) <= 0 +} + +exports.cmp = cmp +function cmp (a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError('Invalid operator: ' + op) + } +} + +exports.Comparator = Comparator +function Comparator (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + if (!(this instanceof Comparator)) { + return new Comparator(comp, options) + } + + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) +} + +var ANY = {} +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] + var m = comp.match(r) + + if (!m) { + throw new TypeError('Invalid comparator: ' + comp) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } +} + +Comparator.prototype.toString = function () { + return this.value +} + +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) +} + +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + var rangeTmp + + if (this.operator === '') { + if (this.value === '') { + return true + } + rangeTmp = new Range(comp.value, options) + return satisfies(this.value, rangeTmp, options) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + rangeTmp = new Range(this.value, options) + return satisfies(comp.semver, rangeTmp, options) + } + + var sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + var sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + var sameSemVer = this.semver.version === comp.semver.version + var differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + var oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + ((this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<')) + var oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + ((this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>')) + + return sameDirectionIncreasing || sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || oppositeDirectionsGreaterThan +} + +exports.Range = Range +function Range (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + return new Range(range.value, options) + } + + if (!(this instanceof Range)) { + return new Range(range, options) + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range + .trim() + .split(/\s+/) + .join(' ') + + // First, split based on boolean or || + this.set = this.raw.split('||').map(function (range) { + return this.parseRange(range.trim()) + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length + }) + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + this.raw) + } + + this.format() +} + +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim() + }).join('||').trim() + return this.range +} + +Range.prototype.toString = function () { + return this.range +} + +Range.prototype.parseRange = function (range) { + var loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, safeRe[t.COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options) + }, this).join(' ').split(/\s+/) + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe) + }) + } + set = set.map(function (comp) { + return new Comparator(comp, this.options) + }, this) + + return set +} + +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some(function (thisComparators) { + return ( + isSatisfiable(thisComparators, options) && + range.set.some(function (rangeComparators) { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every(function (thisComparator) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) +} + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +function isSatisfiable (comparators, options) { + var result = true + var remainingComparators = comparators.slice() + var testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every(function (otherComparator) { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators +function toComparators (range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value + }).join(' ').trim().split(' ') + }) +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator (comp, options) { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +function isX (id) { + return !id || id.toLowerCase() === 'x' || id === '*' +} + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options) + }).join(' ') +} + +function replaceTilde (comp, options) { + var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE] + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else if (pr) { + debug('replaceTilde pr', pr) + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets (comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options) + }).join(' ') +} + +function replaceCaret (comp, options) { + debug('caret', comp, options) + var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET] + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr) + var ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + + ' <' + (+M + 1) + '.0.0' + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1) + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0' + } + } else { + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0' + } + } + + debug('caret return', ret) + return ret + }) +} + +function replaceXRanges (comp, options) { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options) + }).join(' ') +} + +function replaceXRange (comp, options) { + comp = comp.trim() + var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE] + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + var xM = isX(M) + var xm = xM || isX(m) + var xp = xm || isX(p) + var anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + ret = gtlt + M + '.' + m + '.' + p + pr + } else if (xm) { + ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr + } else if (xp) { + ret = '>=' + M + '.' + m + '.0' + pr + + ' <' + M + '.' + (+m + 1) + '.0' + pr + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars (comp, options) { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(safeRe[t.STAR], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = '>=' + fM + '.0.0' + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0' + } else { + from = '>=' + from + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0' + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0' + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr + } else { + to = '<=' + to + } + + return (from + ' ' + to).trim() +} + +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false +} + +function testSet (set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} + +exports.satisfies = satisfies +function satisfies (version, range, options) { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} + +exports.maxSatisfying = maxSatisfying +function maxSatisfying (versions, range, options) { + var max = null + var maxSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} + +exports.minSatisfying = minSatisfying +function minSatisfying (versions, range, options) { + var min = null + var minSV = null + try { + var rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} + +exports.minVersion = minVersion +function minVersion (range, loose) { + range = new Range(range, loose) + + var minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error('Unexpected operation: ' + comparator.operator) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} + +exports.validRange = validRange +function validRange (range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} + +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr +function ltr (version, range, options) { + return outside(version, range, '<', options) +} + +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr +function gtr (version, range, options) { + return outside(version, range, '>', options) +} + +exports.outside = outside +function outside (version, range, hilo, options) { + version = new SemVer(version, options) + range = new Range(range, options) + + var gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i] + + var high = null + var low = null + + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +exports.prerelease = prerelease +function prerelease (version, options) { + var parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} + +exports.intersects = intersects +function intersects (r1, r2, options) { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} + +exports.coerce = coerce +function coerce (version, options) { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + var match = null + if (!options.rtl) { + match = version.match(safeRe[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + var next + while ((next = safeRe[t.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + safeRe[t.COERCERTL].lastIndex = -1 + } + + if (match === null) { + return null + } + + return parse(match[2] + + '.' + (match[3] || '0') + + '.' + (match[4] || '0'), options) +} diff --git a/node_modules/make-dir/package.json b/node_modules/make-dir/package.json new file mode 100644 index 00000000..98403ea5 --- /dev/null +++ b/node_modules/make-dir/package.json @@ -0,0 +1,59 @@ +{ + "name": "make-dir", + "version": "3.1.0", + "description": "Make a directory and its parents if needed - Think `mkdir -p`", + "license": "MIT", + "repository": "sindresorhus/make-dir", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && nyc ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "mkdir", + "mkdirp", + "make", + "directories", + "dir", + "dirs", + "folders", + "directory", + "folder", + "path", + "parent", + "parents", + "intermediate", + "recursively", + "recursive", + "create", + "fs", + "filesystem", + "file-system" + ], + "dependencies": { + "semver": "^6.0.0" + }, + "devDependencies": { + "@types/graceful-fs": "^4.1.3", + "@types/node": "^13.7.1", + "ava": "^1.4.0", + "codecov": "^3.2.0", + "graceful-fs": "^4.1.15", + "nyc": "^15.0.0", + "path-type": "^4.0.0", + "tempy": "^0.2.1", + "tsd": "^0.11.0", + "xo": "^0.25.4" + } +} diff --git a/node_modules/make-dir/readme.md b/node_modules/make-dir/readme.md new file mode 100644 index 00000000..a10a1a42 --- /dev/null +++ b/node_modules/make-dir/readme.md @@ -0,0 +1,125 @@ +# make-dir [![Build Status](https://travis-ci.org/sindresorhus/make-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/make-dir) [![codecov](https://codecov.io/gh/sindresorhus/make-dir/branch/master/graph/badge.svg)](https://codecov.io/gh/sindresorhus/make-dir) + +> Make a directory and its parents if needed - Think `mkdir -p` + +## Advantages over [`mkdirp`](https://github.com/substack/node-mkdirp) + +- Promise API *(Async/await ready!)* +- Fixes many `mkdirp` issues: [#96](https://github.com/substack/node-mkdirp/pull/96) [#70](https://github.com/substack/node-mkdirp/issues/70) [#66](https://github.com/substack/node-mkdirp/issues/66) +- 100% test coverage +- CI-tested on macOS, Linux, and Windows +- Actively maintained +- Doesn't bundle a CLI +- Uses the native `fs.mkdir/mkdirSync` [`recursive` option](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_mkdir_path_options_callback) in Node.js >=10.12.0 unless [overridden](#fs) + +## Install + +``` +$ npm install make-dir +``` + +## Usage + +``` +$ pwd +/Users/sindresorhus/fun +$ tree +. +``` + +```js +const makeDir = require('make-dir'); + +(async () => { + const path = await makeDir('unicorn/rainbow/cake'); + + console.log(path); + //=> '/Users/sindresorhus/fun/unicorn/rainbow/cake' +})(); +``` + +``` +$ tree +. +└── unicorn + └── rainbow + └── cake +``` + +Multiple directories: + +```js +const makeDir = require('make-dir'); + +(async () => { + const paths = await Promise.all([ + makeDir('unicorn/rainbow'), + makeDir('foo/bar') + ]); + + console.log(paths); + /* + [ + '/Users/sindresorhus/fun/unicorn/rainbow', + '/Users/sindresorhus/fun/foo/bar' + ] + */ +})(); +``` + +## API + +### makeDir(path, options?) + +Returns a `Promise` for the path to the created directory. + +### makeDir.sync(path, options?) + +Returns the path to the created directory. + +#### path + +Type: `string` + +Directory to create. + +#### options + +Type: `object` + +##### mode + +Type: `integer`\ +Default: `0o777` + +Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/). + +##### fs + +Type: `object`\ +Default: `require('fs')` + +Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). + +Using a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function. + +## Related + +- [make-dir-cli](https://github.com/sindresorhus/make-dir-cli) - CLI for this module +- [del](https://github.com/sindresorhus/del) - Delete files and directories +- [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching +- [cpy](https://github.com/sindresorhus/cpy) - Copy files +- [cpy-cli](https://github.com/sindresorhus/cpy-cli) - Copy files on the command-line +- [move-file](https://github.com/sindresorhus/move-file) - Move a file + +--- + +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/merge2/LICENSE b/node_modules/merge2/LICENSE new file mode 100644 index 00000000..31dd9c72 --- /dev/null +++ b/node_modules/merge2/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2020 Teambition + +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/merge2/README.md b/node_modules/merge2/README.md new file mode 100644 index 00000000..27f8eb99 --- /dev/null +++ b/node_modules/merge2/README.md @@ -0,0 +1,144 @@ +# merge2 + +Merge multiple streams into one stream in sequence or parallel. + +[![NPM version][npm-image]][npm-url] +[![Build Status][travis-image]][travis-url] +[![Downloads][downloads-image]][downloads-url] + +## Install + +Install with [npm](https://npmjs.org/package/merge2) + +```sh +npm install merge2 +``` + +## Usage + +```js +const gulp = require('gulp') +const merge2 = require('merge2') +const concat = require('gulp-concat') +const minifyHtml = require('gulp-minify-html') +const ngtemplate = require('gulp-ngtemplate') + +gulp.task('app-js', function () { + return merge2( + gulp.src('static/src/tpl/*.html') + .pipe(minifyHtml({empty: true})) + .pipe(ngtemplate({ + module: 'genTemplates', + standalone: true + }) + ), gulp.src([ + 'static/src/js/app.js', + 'static/src/js/locale_zh-cn.js', + 'static/src/js/router.js', + 'static/src/js/tools.js', + 'static/src/js/services.js', + 'static/src/js/filters.js', + 'static/src/js/directives.js', + 'static/src/js/controllers.js' + ]) + ) + .pipe(concat('app.js')) + .pipe(gulp.dest('static/dist/js/')) +}) +``` + +```js +const stream = merge2([stream1, stream2], stream3, {end: false}) +//... +stream.add(stream4, stream5) +//.. +stream.end() +``` + +```js +// equal to merge2([stream1, stream2], stream3) +const stream = merge2() +stream.add([stream1, stream2]) +stream.add(stream3) +``` + +```js +// merge order: +// 1. merge `stream1`; +// 2. merge `stream2` and `stream3` in parallel after `stream1` merged; +// 3. merge 'stream4' after `stream2` and `stream3` merged; +const stream = merge2(stream1, [stream2, stream3], stream4) + +// merge order: +// 1. merge `stream5` and `stream6` in parallel after `stream4` merged; +// 2. merge 'stream7' after `stream5` and `stream6` merged; +stream.add([stream5, stream6], stream7) +``` + +```js +// nest merge +// equal to merge2(stream1, stream2, stream6, stream3, [stream4, stream5]); +const streamA = merge2(stream1, stream2) +const streamB = merge2(stream3, [stream4, stream5]) +const stream = merge2(streamA, streamB) +streamA.add(stream6) +``` + +## API + +```js +const merge2 = require('merge2') +``` + +### merge2() + +### merge2(options) + +### merge2(stream1, stream2, ..., streamN) + +### merge2(stream1, stream2, ..., streamN, options) + +### merge2(stream1, [stream2, stream3, ...], streamN, options) + +return a duplex stream (mergedStream). streams in array will be merged in parallel. + +### mergedStream.add(stream) + +### mergedStream.add(stream1, [stream2, stream3, ...], ...) + +return the mergedStream. + +### mergedStream.on('queueDrain', function() {}) + +It will emit 'queueDrain' when all streams merged. If you set `end === false` in options, this event give you a notice that should add more streams to merge or end the mergedStream. + +#### stream + +*option* +Type: `Readable` or `Duplex` or `Transform` stream. + +#### options + +*option* +Type: `Object`. + +* **end** - `Boolean` - if `end === false` then mergedStream will not be auto ended, you should end by yourself. **Default:** `undefined` + +* **pipeError** - `Boolean` - if `pipeError === true` then mergedStream will emit `error` event from source streams. **Default:** `undefined` + +* **objectMode** - `Boolean` . **Default:** `true` + +`objectMode` and other options(`highWaterMark`, `defaultEncoding` ...) is same as Node.js `Stream`. + +## License + +MIT © [Teambition](https://www.teambition.com) + +[npm-url]: https://npmjs.org/package/merge2 +[npm-image]: http://img.shields.io/npm/v/merge2.svg + +[travis-url]: https://travis-ci.org/teambition/merge2 +[travis-image]: http://img.shields.io/travis/teambition/merge2.svg + +[downloads-url]: https://npmjs.org/package/merge2 +[downloads-image]: http://img.shields.io/npm/dm/merge2.svg?style=flat-square diff --git a/node_modules/merge2/index.js b/node_modules/merge2/index.js new file mode 100644 index 00000000..78a61edf --- /dev/null +++ b/node_modules/merge2/index.js @@ -0,0 +1,144 @@ +'use strict' +/* + * merge2 + * https://github.com/teambition/merge2 + * + * Copyright (c) 2014-2020 Teambition + * Licensed under the MIT license. + */ +const Stream = require('stream') +const PassThrough = Stream.PassThrough +const slice = Array.prototype.slice + +module.exports = merge2 + +function merge2 () { + const streamsQueue = [] + const args = slice.call(arguments) + let merging = false + let options = args[args.length - 1] + + if (options && !Array.isArray(options) && options.pipe == null) { + args.pop() + } else { + options = {} + } + + const doEnd = options.end !== false + const doPipeError = options.pipeError === true + if (options.objectMode == null) { + options.objectMode = true + } + if (options.highWaterMark == null) { + options.highWaterMark = 64 * 1024 + } + const mergedStream = PassThrough(options) + + function addStream () { + for (let i = 0, len = arguments.length; i < len; i++) { + streamsQueue.push(pauseStreams(arguments[i], options)) + } + mergeStream() + return this + } + + function mergeStream () { + if (merging) { + return + } + merging = true + + let streams = streamsQueue.shift() + if (!streams) { + process.nextTick(endStream) + return + } + if (!Array.isArray(streams)) { + streams = [streams] + } + + let pipesCount = streams.length + 1 + + function next () { + if (--pipesCount > 0) { + return + } + merging = false + mergeStream() + } + + function pipe (stream) { + function onend () { + stream.removeListener('merge2UnpipeEnd', onend) + stream.removeListener('end', onend) + if (doPipeError) { + stream.removeListener('error', onerror) + } + next() + } + function onerror (err) { + mergedStream.emit('error', err) + } + // skip ended stream + if (stream._readableState.endEmitted) { + return next() + } + + stream.on('merge2UnpipeEnd', onend) + stream.on('end', onend) + + if (doPipeError) { + stream.on('error', onerror) + } + + stream.pipe(mergedStream, { end: false }) + // compatible for old stream + stream.resume() + } + + for (let i = 0; i < streams.length; i++) { + pipe(streams[i]) + } + + next() + } + + function endStream () { + merging = false + // emit 'queueDrain' when all streams merged. + mergedStream.emit('queueDrain') + if (doEnd) { + mergedStream.end() + } + } + + mergedStream.setMaxListeners(0) + mergedStream.add = addStream + mergedStream.on('unpipe', function (stream) { + stream.emit('merge2UnpipeEnd') + }) + + if (args.length) { + addStream.apply(null, args) + } + return mergedStream +} + +// check and pause streams for pipe. +function pauseStreams (streams, options) { + if (!Array.isArray(streams)) { + // Backwards-compat with old-style streams + if (!streams._readableState && streams.pipe) { + streams = streams.pipe(PassThrough(options)) + } + if (!streams._readableState || !streams.pause || !streams.pipe) { + throw new Error('Only readable stream can be merged.') + } + streams.pause() + } else { + for (let i = 0, len = streams.length; i < len; i++) { + streams[i] = pauseStreams(streams[i], options) + } + } + return streams +} diff --git a/node_modules/merge2/package.json b/node_modules/merge2/package.json new file mode 100644 index 00000000..7777307f --- /dev/null +++ b/node_modules/merge2/package.json @@ -0,0 +1,43 @@ +{ + "name": "merge2", + "description": "Merge multiple streams into one stream in sequence or parallel.", + "authors": [ + "Yan Qing " + ], + "license": "MIT", + "version": "1.4.1", + "main": "./index.js", + "repository": { + "type": "git", + "url": "git@github.com:teambition/merge2.git" + }, + "homepage": "https://github.com/teambition/merge2", + "keywords": [ + "merge2", + "multiple", + "sequence", + "parallel", + "merge", + "stream", + "merge stream", + "sync" + ], + "engines": { + "node": ">= 8" + }, + "dependencies": {}, + "devDependencies": { + "standard": "^14.3.4", + "through2": "^3.0.1", + "thunks": "^4.9.6", + "tman": "^1.10.0", + "to-through": "^2.0.0" + }, + "scripts": { + "test": "standard && tman" + }, + "files": [ + "README.md", + "index.js" + ] +} diff --git a/node_modules/micromatch/LICENSE b/node_modules/micromatch/LICENSE new file mode 100755 index 00000000..9af4a67d --- /dev/null +++ b/node_modules/micromatch/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-present, Jon Schlinkert. + +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/micromatch/README.md b/node_modules/micromatch/README.md new file mode 100644 index 00000000..d72a059a --- /dev/null +++ b/node_modules/micromatch/README.md @@ -0,0 +1,1024 @@ +# micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM monthly downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![NPM total downloads](https://img.shields.io/npm/dt/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Tests](https://github.com/micromatch/micromatch/actions/workflows/test.yml/badge.svg)](https://github.com/micromatch/micromatch/actions/workflows/test.yml) + +> Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Table of Contents + +
+Details + + * [Install](#install) +- [Sponsors](#sponsors) + * [Gold Sponsors](#gold-sponsors) + * [Quickstart](#quickstart) + * [Why use micromatch?](#why-use-micromatch) + + [Matching features](#matching-features) + * [Switching to micromatch](#switching-to-micromatch) + + [From minimatch](#from-minimatch) + + [From multimatch](#from-multimatch) + * [API](#api) + * [Options](#options) + * [Options Examples](#options-examples) + + [options.basename](#optionsbasename) + + [options.bash](#optionsbash) + + [options.expandRange](#optionsexpandrange) + + [options.format](#optionsformat) + + [options.ignore](#optionsignore) + + [options.matchBase](#optionsmatchbase) + + [options.noextglob](#optionsnoextglob) + + [options.nonegate](#optionsnonegate) + + [options.noglobstar](#optionsnoglobstar) + + [options.nonull](#optionsnonull) + + [options.nullglob](#optionsnullglob) + + [options.onIgnore](#optionsonignore) + + [options.onMatch](#optionsonmatch) + + [options.onResult](#optionsonresult) + + [options.posixSlashes](#optionsposixslashes) + + [options.unescape](#optionsunescape) + * [Extended globbing](#extended-globbing) + + [Extglobs](#extglobs) + + [Braces](#braces) + + [Regex character classes](#regex-character-classes) + + [Regex groups](#regex-groups) + + [POSIX bracket expressions](#posix-bracket-expressions) + * [Notes](#notes) + + [Bash 4.3 parity](#bash-43-parity) + + [Backslashes](#backslashes) + * [Benchmarks](#benchmarks) + + [Running benchmarks](#running-benchmarks) + + [Latest results](#latest-results) + * [Contributing](#contributing) + * [About](#about) + +
+ +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save micromatch +``` + +
+ +# Sponsors + +[Become a Sponsor](https://github.com/sponsors/jonschlinkert) to add your logo to this README, or any of [my other projects](https://github.com/jonschlinkert?tab=repositories&q=&type=&language=&sort=stargazers) + +
+ +## Quickstart + +```js +const micromatch = require('micromatch'); +// micromatch(list, patterns[, options]); +``` + +The [main export](#micromatch) takes a list of strings and one or more glob patterns: + +```js +console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['f*', 'b*'])) //=> ['foo', 'bar', 'baz'] +console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['*', '!b*'])) //=> ['foo', 'qux'] +``` + +Use [.isMatch()](#ismatch) to for boolean matching: + +```js +console.log(micromatch.isMatch('foo', 'f*')) //=> true +console.log(micromatch.isMatch('foo', ['b*', 'f*'])) //=> true +``` + +[Switching](#switching-to-micromatch) from minimatch and multimatch is easy! + +
+ +## Why use micromatch? + +> micromatch is a [replacement](#switching-to-micromatch) for minimatch and multimatch + +* Supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch) +* More complete support for the Bash 4.3 specification than minimatch and multimatch. Micromatch passes _all of the spec tests_ from bash, including some that bash still fails. +* **Fast & Performant** - Loads in about 5ms and performs [fast matches](#benchmarks). +* **Glob matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories +* **[Advanced globbing](#extended-globbing)** - Supports [extglobs](#extglobs), [braces](#braces-1), and [POSIX brackets](#posix-bracket-expressions), and support for escaping special characters with `\` or quotes. +* **Accurate** - Covers more scenarios [than minimatch](https://github.com/yarnpkg/yarn/pull/3339) +* **Well tested** - More than 5,000 [test assertions](./test) +* **Windows support** - More reliable windows support than minimatch and multimatch. +* **[Safe](https://github.com/micromatch/braces#braces-is-safe)** - Micromatch is not subject to DoS with brace patterns like minimatch and multimatch. + +### Matching features + +* Support for multiple glob patterns (no need for wrappers like multimatch) +* Wildcards (`**`, `*.js`) +* Negation (`'!a/*.js'`, `'*!(b).js'`) +* [extglobs](#extglobs) (`+(x|y)`, `!(a|b)`) +* [POSIX character classes](#posix-bracket-expressions) (`[[:alpha:][:digit:]]`) +* [brace expansion](https://github.com/micromatch/braces) (`foo/{1..5}.md`, `bar/{a,b,c}.js`) +* regex character classes (`foo-[1-5].js`) +* regex logical "or" (`foo/(abc|xyz).js`) + +You can mix and match these features to create whatever patterns you need! + +## Switching to micromatch + +_(There is one notable difference between micromatch and minimatch in regards to how backslashes are handled. See [the notes about backslashes](#backslashes) for more information.)_ + +### From minimatch + +Use [micromatch.isMatch()](#ismatch) instead of `minimatch()`: + +```js +console.log(micromatch.isMatch('foo', 'b*')); //=> false +``` + +Use [micromatch.match()](#match) instead of `minimatch.match()`: + +```js +console.log(micromatch.match(['foo', 'bar'], 'b*')); //=> 'bar' +``` + +### From multimatch + +Same signature: + +```js +console.log(micromatch(['foo', 'bar', 'baz'], ['f*', '*z'])); //=> ['foo', 'baz'] +``` + +## API + +**Params** + +* `list` **{String|Array}**: List of strings to match. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) +* `returns` **{Array}**: Returns an array of matches + +**Example** + +```js +const mm = require('micromatch'); +// mm(list, patterns[, options]); + +console.log(mm(['a.js', 'a.txt'], ['*.js'])); +//=> [ 'a.js' ] +``` + +### [.matcher](index.js#L109) + +Returns a matcher function from the given glob `pattern` and `options`. The returned function takes a string to match as its only argument and returns true if the string is a match. + +**Params** + +* `pattern` **{String}**: Glob pattern +* `options` **{Object}** +* `returns` **{Function}**: Returns a matcher function. + +**Example** + +```js +const mm = require('micromatch'); +// mm.matcher(pattern[, options]); + +const isMatch = mm.matcher('*.!(*a)'); +console.log(isMatch('a.a')); //=> false +console.log(isMatch('a.b')); //=> true +``` + +### [.isMatch](index.js#L128) + +Returns true if **any** of the given glob `patterns` match the specified `string`. + +**Params** + +* `str` **{String}**: The string to test. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `[options]` **{Object}**: See available [options](#options). +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +const mm = require('micromatch'); +// mm.isMatch(string, patterns[, options]); + +console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true +console.log(mm.isMatch('a.a', 'b.*')); //=> false +``` + +### [.not](index.js#L153) + +Returns a list of strings that _**do not match any**_ of the given `patterns`. + +**Params** + +* `list` **{Array}**: Array of strings to match. +* `patterns` **{String|Array}**: One or more glob pattern to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Array}**: Returns an array of strings that **do not match** the given patterns. + +**Example** + +```js +const mm = require('micromatch'); +// mm.not(list, patterns[, options]); + +console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); +//=> ['b.b', 'c.c'] +``` + +### [.contains](index.js#L193) + +Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string. + +**Params** + +* `str` **{String}**: The string to match. +* `patterns` **{String|Array}**: Glob pattern to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any of the patterns matches any part of `str`. + +**Example** + +```js +var mm = require('micromatch'); +// mm.contains(string, pattern[, options]); + +console.log(mm.contains('aa/bb/cc', '*b')); +//=> true +console.log(mm.contains('aa/bb/cc', '*d')); +//=> false +``` + +### [.matchKeys](index.js#L235) + +Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys. If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead. + +**Params** + +* `object` **{Object}**: The object with keys to filter. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Object}**: Returns an object with only keys that match the given patterns. + +**Example** + +```js +const mm = require('micromatch'); +// mm.matchKeys(object, patterns[, options]); + +const obj = { aa: 'a', ab: 'b', ac: 'c' }; +console.log(mm.matchKeys(obj, '*b')); +//=> { ab: 'b' } +``` + +### [.some](index.js#L264) + +Returns true if some of the strings in the given `list` match any of the given glob `patterns`. + +**Params** + +* `list` **{String|Array}**: The string or array of strings to test. Returns as soon as the first match is found. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any `patterns` matches any of the strings in `list` + +**Example** + +```js +const mm = require('micromatch'); +// mm.some(list, patterns[, options]); + +console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); +// true +console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); +// false +``` + +### [.every](index.js#L300) + +Returns true if every string in the given `list` matches any of the given glob `patterns`. + +**Params** + +* `list` **{String|Array}**: The string or array of strings to test. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if all `patterns` matches all of the strings in `list` + +**Example** + +```js +const mm = require('micromatch'); +// mm.every(list, patterns[, options]); + +console.log(mm.every('foo.js', ['foo.js'])); +// true +console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); +// true +console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); +// false +console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); +// false +``` + +### [.all](index.js#L339) + +Returns true if **all** of the given `patterns` match the specified string. + +**Params** + +* `str` **{String|Array}**: The string to test. +* `patterns` **{String|Array}**: One or more glob patterns to use for matching. +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +const mm = require('micromatch'); +// mm.all(string, patterns[, options]); + +console.log(mm.all('foo.js', ['foo.js'])); +// true + +console.log(mm.all('foo.js', ['*.js', '!foo.js'])); +// false + +console.log(mm.all('foo.js', ['*.js', 'foo.js'])); +// true + +console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); +// true +``` + +### [.capture](index.js#L366) + +Returns an array of matches captured by `pattern` in `string, or`null` if the pattern did not match. + +**Params** + +* `glob` **{String}**: Glob pattern to use for matching. +* `input` **{String}**: String to match +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Array|null}**: Returns an array of captures if the input matches the glob pattern, otherwise `null`. + +**Example** + +```js +const mm = require('micromatch'); +// mm.capture(pattern, string[, options]); + +console.log(mm.capture('test/*.js', 'test/foo.js')); +//=> ['foo'] +console.log(mm.capture('test/*.js', 'foo/bar.css')); +//=> null +``` + +### [.makeRe](index.js#L392) + +Create a regular expression from the given glob `pattern`. + +**Params** + +* `pattern` **{String}**: A glob pattern to convert to regex. +* `options` **{Object}** +* `returns` **{RegExp}**: Returns a regex created from the given pattern. + +**Example** + +```js +const mm = require('micromatch'); +// mm.makeRe(pattern[, options]); + +console.log(mm.makeRe('*.js')); +//=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ +``` + +### [.scan](index.js#L408) + +Scan a glob pattern to separate the pattern into segments. Used by the [split](#split) method. + +**Params** + +* `pattern` **{String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with + +**Example** + +```js +const mm = require('micromatch'); +const state = mm.scan(pattern[, options]); +``` + +### [.parse](index.js#L424) + +Parse a glob pattern to create the source string for a regular expression. + +**Params** + +* `glob` **{String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with useful properties and output to be used as regex source string. + +**Example** + +```js +const mm = require('micromatch'); +const state = mm.parse(pattern[, options]); +``` + +### [.braces](index.js#L451) + +Process the given brace `pattern`. + +**Params** + +* `pattern` **{String}**: String with brace pattern to process. +* `options` **{Object}**: Any [options](#options) to change how expansion is performed. See the [braces](https://github.com/micromatch/braces) library for all available options. +* `returns` **{Array}** + +**Example** + +```js +const { braces } = require('micromatch'); +console.log(braces('foo/{a,b,c}/bar')); +//=> [ 'foo/(a|b|c)/bar' ] + +console.log(braces('foo/{a,b,c}/bar', { expand: true })); +//=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ] +``` + +## Options + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | +| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | +| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | +| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | +| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | +| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | +| `dot` | `boolean` | `false` | Match dotfiles. Otherwise dotfiles are ignored unless a `.` is explicitly defined in the pattern. | +| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. This option is overridden by the `expandBrace` option. | +| `failglob` | `boolean` | `false` | Similar to the `failglob` behavior in Bash, throws an error when no matches are found. Based on the bash option of the same name. | +| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | +| `flags` | `boolean` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | +| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | +| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | +| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | +| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | +| `lookbehinds` | `boolean` | `true` | Support regex positive and negative lookbehinds. Note that you must be using Node 8.1.10 or higher to enable regex lookbehinds. | +| `matchBase` | `boolean` | `false` | Alias for `basename` | +| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | +| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | +| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | +| `nocase` | `boolean` | `false` | Perform case-insensitive matching. Equivalent to the regex `i` flag. Note that this option is ignored when the `flags` option is defined. | +| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | +| `noext` | `boolean` | `false` | Alias for `noextglob` | +| `noextglob` | `boolean` | `false` | Disable support for matching with [extglobs](#extglobs) (like `+(a\|b)`) | +| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | +| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | +| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | +| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | +| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | +| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | +| `posix` | `boolean` | `false` | Support [POSIX character classes](#posix-bracket-expressions) ("posix brackets"). | +| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | +| `prepend` | `string` | `undefined` | String to prepend to the generated regex used for matching. | +| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | +| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | +| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | +| `unescape` | `boolean` | `undefined` | Remove preceding backslashes from escaped glob characters before creating the regular expression to perform matches. | +| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatitibility. | + +## Options Examples + +### options.basename + +Allow glob patterns without slashes to match a file path based on its basename. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `matchBase`. + +**Type**: `Boolean` + +**Default**: `false` + +**Example** + +```js +micromatch(['a/b.js', 'a/c.md'], '*.js'); +//=> [] + +micromatch(['a/b.js', 'a/c.md'], '*.js', { basename: true }); +//=> ['a/b.js'] +``` + +### options.bash + +Enabled by default, this option enforces bash-like behavior with stars immediately following a bracket expression. Bash bracket expressions are similar to regex character classes, but unlike regex, a star following a bracket expression **does not repeat the bracketed characters**. Instead, the star is treated the same as any other star. + +**Type**: `Boolean` + +**Default**: `true` + +**Example** + +```js +const files = ['abc', 'ajz']; +console.log(micromatch(files, '[a-c]*')); +//=> ['abc', 'ajz'] + +console.log(micromatch(files, '[a-c]*', { bash: false })); +``` + +### options.expandRange + +**Type**: `function` + +**Default**: `undefined` + +Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. + +**Example** + +The following example shows how to create a glob that matches a numeric folder name between `01` and `25`, with leading zeros. + +```js +const fill = require('fill-range'); +const regex = micromatch.makeRe('foo/{01..25}/bar', { + expandRange(a, b) { + return `(${fill(a, b, { toRegex: true })})`; + } +}); + +console.log(regex) +//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ + +console.log(regex.test('foo/00/bar')) // false +console.log(regex.test('foo/01/bar')) // true +console.log(regex.test('foo/10/bar')) // true +console.log(regex.test('foo/22/bar')) // true +console.log(regex.test('foo/25/bar')) // true +console.log(regex.test('foo/26/bar')) // false +``` + +### options.format + +**Type**: `function` + +**Default**: `undefined` + +Custom function for formatting strings before they're matched. + +**Example** + +```js +// strip leading './' from strings +const format = str => str.replace(/^\.\//, ''); +const isMatch = picomatch('foo/*.js', { format }); +console.log(isMatch('./foo/bar.js')) //=> true +``` + +### options.ignore + +String or array of glob patterns to match files to ignore. + +**Type**: `String|Array` + +**Default**: `undefined` + +```js +const isMatch = micromatch.matcher('*', { ignore: 'f*' }); +console.log(isMatch('foo')) //=> false +console.log(isMatch('bar')) //=> true +console.log(isMatch('baz')) //=> true +``` + +### options.matchBase + +Alias for [options.basename](#options-basename). + +### options.noextglob + +Disable extglob support, so that [extglobs](#extglobs) are regarded as literal characters. + +**Type**: `Boolean` + +**Default**: `undefined` + +**Examples** + +```js +console.log(micromatch(['a/z', 'a/b', 'a/!(z)'], 'a/!(z)')); +//=> ['a/b', 'a/!(z)'] + +console.log(micromatch(['a/z', 'a/b', 'a/!(z)'], 'a/!(z)', { noextglob: true })); +//=> ['a/!(z)'] (matches only as literal characters) +``` + +### options.nonegate + +Disallow negation (`!`) patterns, and treat leading `!` as a literal character to match. + +**Type**: `Boolean` + +**Default**: `undefined` + +### options.noglobstar + +Disable matching with globstars (`**`). + +**Type**: `Boolean` + +**Default**: `undefined` + +```js +micromatch(['a/b', 'a/b/c', 'a/b/c/d'], 'a/**'); +//=> ['a/b', 'a/b/c', 'a/b/c/d'] + +micromatch(['a/b', 'a/b/c', 'a/b/c/d'], 'a/**', {noglobstar: true}); +//=> ['a/b'] +``` + +### options.nonull + +Alias for [options.nullglob](#options-nullglob). + +### options.nullglob + +If `true`, when no matches are found the actual (arrayified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch) option `nonull`. + +**Type**: `Boolean` + +**Default**: `undefined` + +### options.onIgnore + +```js +const onIgnore = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); + // { glob: '*', regex: /^(?:(?!\.)(?=.)[^\/]*?\/?)$/, input: 'foo', output: 'foo' } +}; + +const isMatch = micromatch.matcher('*', { onIgnore, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +### options.onMatch + +```js +const onMatch = ({ glob, regex, input, output }) => { + console.log({ input, output }); + // { input: 'some\\path', output: 'some/path' } + // { input: 'some\\path', output: 'some/path' } + // { input: 'some\\path', output: 'some/path' } +}; + +const isMatch = micromatch.matcher('**', { onMatch, posixSlashes: true }); +isMatch('some\\path'); +isMatch('some\\path'); +isMatch('some\\path'); +``` + +### options.onResult + +```js +const onResult = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = micromatch('*', { onResult, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +### options.posixSlashes + +Convert path separators on returned files to posix/unix-style forward slashes. Aliased as `unixify` for backwards compatibility. + +**Type**: `Boolean` + +**Default**: `true` on windows, `false` everywhere else. + +**Example** + +```js +console.log(micromatch.match(['a\\b\\c'], 'a/**')); +//=> ['a/b/c'] + +console.log(micromatch.match(['a\\b\\c'], { posixSlashes: false })); +//=> ['a\\b\\c'] +``` + +### options.unescape + +Remove backslashes from escaped glob characters before creating the regular expression to perform matches. + +**Type**: `Boolean` + +**Default**: `undefined` + +**Example** + +In this example we want to match a literal `*`: + +```js +console.log(micromatch.match(['abc', 'a\\*c'], 'a\\*c')); +//=> ['a\\*c'] + +console.log(micromatch.match(['abc', 'a\\*c'], 'a\\*c', { unescape: true })); +//=> ['a*c'] +``` + +
+
+ +## Extended globbing + +Micromatch supports the following extended globbing features. + +### Extglobs + +Extended globbing, as described by the bash man page: + +| **pattern** | **regex equivalent** | **description** | +| --- | --- | --- | +| `?(pattern)` | `(pattern)?` | Matches zero or one occurrence of the given patterns | +| `*(pattern)` | `(pattern)*` | Matches zero or more occurrences of the given patterns | +| `+(pattern)` | `(pattern)+` | Matches one or more occurrences of the given patterns | +| `@(pattern)` | `(pattern)` * | Matches one of the given patterns | +| `!(pattern)` | N/A (equivalent regex is much more complicated) | Matches anything except one of the given patterns | + +* Note that `@` isn't a regex character. + +### Braces + +Brace patterns can be used to match specific ranges or sets of characters. + +**Example** + +The pattern `{f,b}*/{1..3}/{b,q}*` would match any of following strings: + +``` +foo/1/bar +foo/2/bar +foo/3/bar +baz/1/qux +baz/2/qux +baz/3/qux +``` + +Visit [braces](https://github.com/micromatch/braces) to see the full range of features and options related to brace expansion, or to create brace matching or expansion related issues. + +### Regex character classes + +Given the list: `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`: + +* `[ac].js`: matches both `a` and `c`, returning `['a.js', 'c.js']` +* `[b-d].js`: matches from `b` to `d`, returning `['b.js', 'c.js', 'd.js']` +* `a/[A-Z].js`: matches and uppercase letter, returning `['a/E.md']` + +Learn about [regex character classes](http://www.regular-expressions.info/charclass.html). + +### Regex groups + +Given `['a.js', 'b.js', 'c.js', 'd.js', 'E.js']`: + +* `(a|c).js`: would match either `a` or `c`, returning `['a.js', 'c.js']` +* `(b|d).js`: would match either `b` or `d`, returning `['b.js', 'd.js']` +* `(b|[A-Z]).js`: would match either `b` or an uppercase letter, returning `['b.js', 'E.js']` + +As with regex, parens can be nested, so patterns like `((a|b)|c)/b` will work. Although brace expansion might be friendlier to use, depending on preference. + +### POSIX bracket expressions + +POSIX brackets are intended to be more user-friendly than regex character classes. This of course is in the eye of the beholder. + +**Example** + +```js +console.log(micromatch.isMatch('a1', '[[:alpha:][:digit:]]')) //=> true +console.log(micromatch.isMatch('a1', '[[:alpha:][:alpha:]]')) //=> false +``` + +*** + +## Notes + +### Bash 4.3 parity + +Whenever possible matching behavior is based on behavior Bash 4.3, which is mostly consistent with minimatch. + +However, it's suprising how many edge cases and rabbit holes there are with glob matching, and since there is no real glob specification, and micromatch is more accurate than both Bash and minimatch, there are cases where best-guesses were made for behavior. In a few cases where Bash had no answers, we used wildmatch (used by git) as a fallback. + +### Backslashes + +There is an important, notable difference between minimatch and micromatch _in regards to how backslashes are handled_ in glob patterns. + +* Micromatch exclusively and explicitly reserves backslashes for escaping characters in a glob pattern, even on windows, which is consistent with bash behavior. _More importantly, unescaping globs can result in unsafe regular expressions_. +* Minimatch converts all backslashes to forward slashes, which means you can't use backslashes to escape any characters in your glob patterns. + +We made this decision for micromatch for a couple of reasons: + +* Consistency with bash conventions. +* Glob patterns are not filepaths. They are a type of [regular language](https://en.wikipedia.org/wiki/Regular_language) that is converted to a JavaScript regular expression. Thus, when forward slashes are defined in a glob pattern, the resulting regular expression will match windows or POSIX path separators just fine. + +**A note about joining paths to globs** + +Note that when you pass something like `path.join('foo', '*')` to micromatch, you are creating a filepath and expecting it to still work as a glob pattern. This causes problems on windows, since the `path.sep` is `\\`. + +In other words, since `\\` is reserved as an escape character in globs, on windows `path.join('foo', '*')` would result in `foo\\*`, which tells micromatch to match `*` as a literal character. This is the same behavior as bash. + +To solve this, you might be inspired to do something like `'foo\\*'.replace(/\\/g, '/')`, but this causes another, potentially much more serious, problem. + +## Benchmarks + +### Running benchmarks + +Install dependencies for running benchmarks: + +```sh +$ cd bench && npm install +``` + +Run the benchmarks: + +```sh +$ npm run bench +``` + +### Latest results + +As of August 23, 2024 (longer bars are better): + +```sh +# .makeRe star + micromatch x 2,232,802 ops/sec ±2.34% (89 runs sampled)) + minimatch x 781,018 ops/sec ±6.74% (92 runs sampled)) + +# .makeRe star; dot=true + micromatch x 1,863,453 ops/sec ±0.74% (93 runs sampled) + minimatch x 723,105 ops/sec ±0.75% (93 runs sampled) + +# .makeRe globstar + micromatch x 1,624,179 ops/sec ±2.22% (91 runs sampled) + minimatch x 1,117,230 ops/sec ±2.78% (86 runs sampled)) + +# .makeRe globstars + micromatch x 1,658,642 ops/sec ±0.86% (92 runs sampled) + minimatch x 741,224 ops/sec ±1.24% (89 runs sampled)) + +# .makeRe with leading star + micromatch x 1,525,014 ops/sec ±1.63% (90 runs sampled) + minimatch x 561,074 ops/sec ±3.07% (89 runs sampled) + +# .makeRe - braces + micromatch x 172,478 ops/sec ±2.37% (78 runs sampled) + minimatch x 96,087 ops/sec ±2.34% (88 runs sampled))) + +# .makeRe braces - range (expanded) + micromatch x 26,973 ops/sec ±0.84% (89 runs sampled) + minimatch x 3,023 ops/sec ±0.99% (90 runs sampled)) + +# .makeRe braces - range (compiled) + micromatch x 152,892 ops/sec ±1.67% (83 runs sampled) + minimatch x 992 ops/sec ±3.50% (89 runs sampled)d)) + +# .makeRe braces - nested ranges (expanded) + micromatch x 15,816 ops/sec ±13.05% (80 runs sampled) + minimatch x 2,953 ops/sec ±1.64% (91 runs sampled) + +# .makeRe braces - nested ranges (compiled) + micromatch x 110,881 ops/sec ±1.85% (82 runs sampled) + minimatch x 1,008 ops/sec ±1.51% (91 runs sampled) + +# .makeRe braces - set (compiled) + micromatch x 134,930 ops/sec ±3.54% (63 runs sampled)) + minimatch x 43,242 ops/sec ±0.60% (93 runs sampled) + +# .makeRe braces - nested sets (compiled) + micromatch x 94,455 ops/sec ±1.74% (69 runs sampled)) + minimatch x 27,720 ops/sec ±1.84% (93 runs sampled)) +``` + +## Contributing + +All contributions are welcome! Please read [the contributing guide](.github/contributing.md) to get started. + +**Bug reports** + +Please create an issue if you encounter a bug or matching behavior that doesn't seem correct. If you find a matching-related issue, please: + +* [research existing issues first](../../issues) (open and closed) +* visit the [GNU Bash documentation](https://www.gnu.org/software/bash/manual/) to see how Bash deals with the pattern +* visit the [minimatch](https://github.com/isaacs/minimatch) documentation to cross-check expected behavior in node.js +* if all else fails, since there is no real specification for globs we will probably need to discuss expected behavior and decide how to resolve it. which means any detail you can provide to help with this discussion would be greatly appreciated. + +**Platform issues** + +It's important to us that micromatch work consistently on all platforms. If you encounter any platform-specific matching or path related issues, please let us know (pull requests are also greatly appreciated). + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [braces](https://www.npmjs.com/package/braces): Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support… [more](https://github.com/micromatch/braces) | [homepage](https://github.com/micromatch/braces "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.") +* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/micromatch/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.") +* [extglob](https://www.npmjs.com/package/extglob): Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob… [more](https://github.com/micromatch/extglob) | [homepage](https://github.com/micromatch/extglob "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.") +* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`") +* [nanomatch](https://www.npmjs.com/package/nanomatch): Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… [more](https://github.com/micromatch/nanomatch) | [homepage](https://github.com/micromatch/nanomatch "Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces)") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 523 | [jonschlinkert](https://github.com/jonschlinkert) | +| 12 | [es128](https://github.com/es128) | +| 9 | [danez](https://github.com/danez) | +| 8 | [doowb](https://github.com/doowb) | +| 6 | [paulmillr](https://github.com/paulmillr) | +| 5 | [mrmlnc](https://github.com/mrmlnc) | +| 3 | [DrPizza](https://github.com/DrPizza) | +| 2 | [Tvrqvoise](https://github.com/Tvrqvoise) | +| 2 | [antonyk](https://github.com/antonyk) | +| 2 | [MartinKolarik](https://github.com/MartinKolarik) | +| 2 | [Glazy](https://github.com/Glazy) | +| 2 | [mceIdo](https://github.com/mceIdo) | +| 2 | [TrySound](https://github.com/TrySound) | +| 1 | [yvele](https://github.com/yvele) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | +| 1 | [simlu](https://github.com/simlu) | +| 1 | [curbengh](https://github.com/curbengh) | +| 1 | [fidian](https://github.com/fidian) | +| 1 | [tomByrer](https://github.com/tomByrer) | +| 1 | [ZoomerTedJackson](https://github.com/ZoomerTedJackson) | +| 1 | [styfle](https://github.com/styfle) | +| 1 | [sebdeckers](https://github.com/sebdeckers) | +| 1 | [muescha](https://github.com/muescha) | +| 1 | [juszczykjakub](https://github.com/juszczykjakub) | +| 1 | [joyceerhl](https://github.com/joyceerhl) | +| 1 | [donatj](https://github.com/donatj) | +| 1 | [frangio](https://github.com/frangio) | +| 1 | [UltCombo](https://github.com/UltCombo) | +| 1 | [DianeLooney](https://github.com/DianeLooney) | +| 1 | [devongovett](https://github.com/devongovett) | +| 1 | [Cslove](https://github.com/Cslove) | +| 1 | [amilajack](https://github.com/amilajack) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2024, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on August 23, 2024._ \ No newline at end of file diff --git a/node_modules/micromatch/index.js b/node_modules/micromatch/index.js new file mode 100644 index 00000000..cb9d9ef3 --- /dev/null +++ b/node_modules/micromatch/index.js @@ -0,0 +1,474 @@ +'use strict'; + +const util = require('util'); +const braces = require('braces'); +const picomatch = require('picomatch'); +const utils = require('picomatch/lib/utils'); + +const isEmptyString = v => v === '' || v === './'; +const hasBraces = v => { + const index = v.indexOf('{'); + return index > -1 && v.indexOf('}', index) > -1; +}; + +/** + * Returns an array of strings that match one or more glob patterns. + * + * ```js + * const mm = require('micromatch'); + * // mm(list, patterns[, options]); + * + * console.log(mm(['a.js', 'a.txt'], ['*.js'])); + * //=> [ 'a.js' ] + * ``` + * @param {String|Array} `list` List of strings to match. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) + * @return {Array} Returns an array of matches + * @summary false + * @api public + */ + +const micromatch = (list, patterns, options) => { + patterns = [].concat(patterns); + list = [].concat(list); + + let omit = new Set(); + let keep = new Set(); + let items = new Set(); + let negatives = 0; + + let onResult = state => { + items.add(state.output); + if (options && options.onResult) { + options.onResult(state); + } + }; + + for (let i = 0; i < patterns.length; i++) { + let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true); + let negated = isMatch.state.negated || isMatch.state.negatedExtglob; + if (negated) negatives++; + + for (let item of list) { + let matched = isMatch(item, true); + + let match = negated ? !matched.isMatch : matched.isMatch; + if (!match) continue; + + if (negated) { + omit.add(matched.output); + } else { + omit.delete(matched.output); + keep.add(matched.output); + } + } + } + + let result = negatives === patterns.length ? [...items] : [...keep]; + let matches = result.filter(item => !omit.has(item)); + + if (options && matches.length === 0) { + if (options.failglob === true) { + throw new Error(`No matches found for "${patterns.join(', ')}"`); + } + + if (options.nonull === true || options.nullglob === true) { + return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns; + } + } + + return matches; +}; + +/** + * Backwards compatibility + */ + +micromatch.match = micromatch; + +/** + * Returns a matcher function from the given glob `pattern` and `options`. + * The returned function takes a string to match as its only argument and returns + * true if the string is a match. + * + * ```js + * const mm = require('micromatch'); + * // mm.matcher(pattern[, options]); + * + * const isMatch = mm.matcher('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @param {String} `pattern` Glob pattern + * @param {Object} `options` + * @return {Function} Returns a matcher function. + * @api public + */ + +micromatch.matcher = (pattern, options) => picomatch(pattern, options); + +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const mm = require('micromatch'); + * // mm.isMatch(string, patterns[, options]); + * + * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(mm.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `[options]` See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + +/** + * Backwards compatibility + */ + +micromatch.any = micromatch.isMatch; + +/** + * Returns a list of strings that _**do not match any**_ of the given `patterns`. + * + * ```js + * const mm = require('micromatch'); + * // mm.not(list, patterns[, options]); + * + * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); + * //=> ['b.b', 'c.c'] + * ``` + * @param {Array} `list` Array of strings to match. + * @param {String|Array} `patterns` One or more glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of strings that **do not match** the given patterns. + * @api public + */ + +micromatch.not = (list, patterns, options = {}) => { + patterns = [].concat(patterns).map(String); + let result = new Set(); + let items = []; + + let onResult = state => { + if (options.onResult) options.onResult(state); + items.push(state.output); + }; + + let matches = new Set(micromatch(list, patterns, { ...options, onResult })); + + for (let item of items) { + if (!matches.has(item)) { + result.add(item); + } + } + return [...result]; +}; + +/** + * Returns true if the given `string` contains the given pattern. Similar + * to [.isMatch](#isMatch) but the pattern can match any part of the string. + * + * ```js + * var mm = require('micromatch'); + * // mm.contains(string, pattern[, options]); + * + * console.log(mm.contains('aa/bb/cc', '*b')); + * //=> true + * console.log(mm.contains('aa/bb/cc', '*d')); + * //=> false + * ``` + * @param {String} `str` The string to match. + * @param {String|Array} `patterns` Glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any of the patterns matches any part of `str`. + * @api public + */ + +micromatch.contains = (str, pattern, options) => { + if (typeof str !== 'string') { + throw new TypeError(`Expected a string: "${util.inspect(str)}"`); + } + + if (Array.isArray(pattern)) { + return pattern.some(p => micromatch.contains(str, p, options)); + } + + if (typeof pattern === 'string') { + if (isEmptyString(str) || isEmptyString(pattern)) { + return false; + } + + if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) { + return true; + } + } + + return micromatch.isMatch(str, pattern, { ...options, contains: true }); +}; + +/** + * Filter the keys of the given object with the given `glob` pattern + * and `options`. Does not attempt to match nested keys. If you need this feature, + * use [glob-object][] instead. + * + * ```js + * const mm = require('micromatch'); + * // mm.matchKeys(object, patterns[, options]); + * + * const obj = { aa: 'a', ab: 'b', ac: 'c' }; + * console.log(mm.matchKeys(obj, '*b')); + * //=> { ab: 'b' } + * ``` + * @param {Object} `object` The object with keys to filter. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Object} Returns an object with only keys that match the given patterns. + * @api public + */ + +micromatch.matchKeys = (obj, patterns, options) => { + if (!utils.isObject(obj)) { + throw new TypeError('Expected the first argument to be an object'); + } + let keys = micromatch(Object.keys(obj), patterns, options); + let res = {}; + for (let key of keys) res[key] = obj[key]; + return res; +}; + +/** + * Returns true if some of the strings in the given `list` match any of the given glob `patterns`. + * + * ```js + * const mm = require('micromatch'); + * // mm.some(list, patterns[, options]); + * + * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // true + * console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any `patterns` matches any of the strings in `list` + * @api public + */ + +micromatch.some = (list, patterns, options) => { + let items = [].concat(list); + + for (let pattern of [].concat(patterns)) { + let isMatch = picomatch(String(pattern), options); + if (items.some(item => isMatch(item))) { + return true; + } + } + return false; +}; + +/** + * Returns true if every string in the given `list` matches + * any of the given glob `patterns`. + * + * ```js + * const mm = require('micromatch'); + * // mm.every(list, patterns[, options]); + * + * console.log(mm.every('foo.js', ['foo.js'])); + * // true + * console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); + * // true + * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); + * // false + * console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); + * // false + * ``` + * @param {String|Array} `list` The string or array of strings to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if all `patterns` matches all of the strings in `list` + * @api public + */ + +micromatch.every = (list, patterns, options) => { + let items = [].concat(list); + + for (let pattern of [].concat(patterns)) { + let isMatch = picomatch(String(pattern), options); + if (!items.every(item => isMatch(item))) { + return false; + } + } + return true; +}; + +/** + * Returns true if **all** of the given `patterns` match + * the specified string. + * + * ```js + * const mm = require('micromatch'); + * // mm.all(string, patterns[, options]); + * + * console.log(mm.all('foo.js', ['foo.js'])); + * // true + * + * console.log(mm.all('foo.js', ['*.js', '!foo.js'])); + * // false + * + * console.log(mm.all('foo.js', ['*.js', 'foo.js'])); + * // true + * + * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); + * // true + * ``` + * @param {String|Array} `str` The string to test. + * @param {String|Array} `patterns` One or more glob patterns to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +micromatch.all = (str, patterns, options) => { + if (typeof str !== 'string') { + throw new TypeError(`Expected a string: "${util.inspect(str)}"`); + } + + return [].concat(patterns).every(p => picomatch(p, options)(str)); +}; + +/** + * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match. + * + * ```js + * const mm = require('micromatch'); + * // mm.capture(pattern, string[, options]); + * + * console.log(mm.capture('test/*.js', 'test/foo.js')); + * //=> ['foo'] + * console.log(mm.capture('test/*.js', 'foo/bar.css')); + * //=> null + * ``` + * @param {String} `glob` Glob pattern to use for matching. + * @param {String} `input` String to match + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`. + * @api public + */ + +micromatch.capture = (glob, input, options) => { + let posix = utils.isWindows(options); + let regex = picomatch.makeRe(String(glob), { ...options, capture: true }); + let match = regex.exec(posix ? utils.toPosixSlashes(input) : input); + + if (match) { + return match.slice(1).map(v => v === void 0 ? '' : v); + } +}; + +/** + * Create a regular expression from the given glob `pattern`. + * + * ```js + * const mm = require('micromatch'); + * // mm.makeRe(pattern[, options]); + * + * console.log(mm.makeRe('*.js')); + * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ + * ``` + * @param {String} `pattern` A glob pattern to convert to regex. + * @param {Object} `options` + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +micromatch.makeRe = (...args) => picomatch.makeRe(...args); + +/** + * Scan a glob pattern to separate the pattern into segments. Used + * by the [split](#split) method. + * + * ```js + * const mm = require('micromatch'); + * const state = mm.scan(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ + +micromatch.scan = (...args) => picomatch.scan(...args); + +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const mm = require('micromatch'); + * const state = mm.parse(pattern[, options]); + * ``` + * @param {String} `glob` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as regex source string. + * @api public + */ + +micromatch.parse = (patterns, options) => { + let res = []; + for (let pattern of [].concat(patterns || [])) { + for (let str of braces(String(pattern), options)) { + res.push(picomatch.parse(str, options)); + } + } + return res; +}; + +/** + * Process the given brace `pattern`. + * + * ```js + * const { braces } = require('micromatch'); + * console.log(braces('foo/{a,b,c}/bar')); + * //=> [ 'foo/(a|b|c)/bar' ] + * + * console.log(braces('foo/{a,b,c}/bar', { expand: true })); + * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ] + * ``` + * @param {String} `pattern` String with brace pattern to process. + * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options. + * @return {Array} + * @api public + */ + +micromatch.braces = (pattern, options) => { + if (typeof pattern !== 'string') throw new TypeError('Expected a string'); + if ((options && options.nobrace === true) || !hasBraces(pattern)) { + return [pattern]; + } + return braces(pattern, options); +}; + +/** + * Expand braces + */ + +micromatch.braceExpand = (pattern, options) => { + if (typeof pattern !== 'string') throw new TypeError('Expected a string'); + return micromatch.braces(pattern, { ...options, expand: true }); +}; + +/** + * Expose micromatch + */ + +// exposed for tests +micromatch.hasBraces = hasBraces; +module.exports = micromatch; diff --git a/node_modules/micromatch/package.json b/node_modules/micromatch/package.json new file mode 100644 index 00000000..d5558bb9 --- /dev/null +++ b/node_modules/micromatch/package.json @@ -0,0 +1,119 @@ +{ + "name": "micromatch", + "description": "Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.", + "version": "4.0.8", + "homepage": "https://github.com/micromatch/micromatch", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "(https://github.com/DianeLooney)", + "Amila Welihinda (amilajack.com)", + "Bogdan Chadkin (https://github.com/TrySound)", + "Brian Woodward (https://twitter.com/doowb)", + "Devon Govett (http://badassjs.com)", + "Elan Shanker (https://github.com/es128)", + "Fabrício Matté (https://ultcombo.js.org)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Martin Kolárik (https://kolarik.sk)", + "Olsten Larck (https://i.am.charlike.online)", + "Paul Miller (paulmillr.com)", + "Tom Byrer (https://github.com/tomByrer)", + "Tyler Akins (http://rumkin.com)", + "Peter Bright (https://github.com/drpizza)", + "Kuba Juszczyk (https://github.com/ku8ar)" + ], + "repository": "micromatch/micromatch", + "bugs": { + "url": "https://github.com/micromatch/micromatch/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=8.6" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "devDependencies": { + "fill-range": "^7.0.1", + "gulp-format-md": "^2.0.0", + "minimatch": "^5.0.1", + "mocha": "^9.2.2", + "time-require": "github:jonschlinkert/time-require" + }, + "keywords": [ + "bash", + "bracket", + "character-class", + "expand", + "expansion", + "expression", + "extglob", + "extglobs", + "file", + "files", + "filter", + "find", + "glob", + "globbing", + "globs", + "globstar", + "lookahead", + "lookaround", + "lookbehind", + "match", + "matcher", + "matches", + "matching", + "micromatch", + "minimatch", + "multimatch", + "negate", + "negation", + "path", + "pattern", + "patterns", + "posix", + "regex", + "regexp", + "regular", + "shell", + "star", + "wildcard" + ], + "verb": { + "toc": "collapsible", + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "braces", + "expand-brackets", + "extglob", + "fill-range", + "nanomatch" + ] + }, + "reflinks": [ + "extglob", + "fill-range", + "glob-object", + "minimatch", + "multimatch" + ] + } +} diff --git a/node_modules/minimatch/LICENSE b/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..1493534e --- /dev/null +++ b/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +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/minimatch/README.md b/node_modules/minimatch/README.md new file mode 100644 index 00000000..a5bdefaa --- /dev/null +++ b/node_modules/minimatch/README.md @@ -0,0 +1,259 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://travis-ci.org/isaacs/minimatch.svg?branch=master)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes in patterns +will always be interpreted as escape characters, not path separators. + +Note that `\` or `/` _will_ be interpreted as path separators in paths on +Windows, and will match against `/` in glob expressions. + +So just always use `/` in patterns. + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true}) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + +### partial + +Compare a partial path to a pattern. As long as the parts of the path that +are present are not contradicted by the pattern, it will be treated as a +match. This is useful in applications where you're walking through a +folder structure, and don't yet have the full path, but want to ensure that +you do not walk down paths that can never be a match. + +For example, + +```js +minimatch('/a/b', '/a/*/c/d', { partial: true }) // true, might be /a/b/c/d +minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d +minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a +``` + +### windowsPathsNoEscape + +Use `\\` as a path separator _only_, and _never_ as an escape +character. If set, all `\\` characters are replaced with `/` in +the pattern. Note that this makes it **impossible** to match +against paths containing literal glob pattern characters, but +allows matching with patterns constructed using `path.join()` and +`path.resolve()` on Windows platforms, mimicking the (buggy!) +behavior of earlier versions on Windows. Please use with +caution, and be mindful of [the caveat about Windows +paths](#windows). + +For legacy reasons, this is also set if +`options.allowWindowsEscape` is set to the exact value `false`. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +Note that `fnmatch(3)` in libc is an extremely naive string comparison +matcher, which does not do anything special for slashes. This library is +designed to be used in glob searching and file walkers, and so it does do +special things with `/`. Thus, `foo*` will not match `foo/bar` in this +library, even though it would in `fnmatch(3)`. diff --git a/node_modules/minimatch/lib/path.js b/node_modules/minimatch/lib/path.js new file mode 100644 index 00000000..ffe453d9 --- /dev/null +++ b/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/minimatch/minimatch.js b/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000..6c8bfc35 --- /dev/null +++ b/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/minimatch/package.json b/node_modules/minimatch/package.json new file mode 100644 index 00000000..c8809dbb --- /dev/null +++ b/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/minipass/LICENSE b/node_modules/minipass/LICENSE new file mode 100644 index 00000000..97f8e32e --- /dev/null +++ b/node_modules/minipass/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2017-2023 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/minipass/README.md b/node_modules/minipass/README.md new file mode 100644 index 00000000..11263305 --- /dev/null +++ b/node_modules/minipass/README.md @@ -0,0 +1,825 @@ +# minipass + +A _very_ minimal implementation of a [PassThrough +stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough) + +[It's very +fast](https://docs.google.com/spreadsheets/d/1K_HR5oh3r80b8WVMWCPPjfuWXUgfkmhlX7FGI6JJ8tY/edit?usp=sharing) +for objects, strings, and buffers. + +Supports `pipe()`ing (including multi-`pipe()` and backpressure +transmission), buffering data until either a `data` event handler +or `pipe()` is added (so you don't lose the first chunk), and +most other cases where PassThrough is a good idea. + +There is a `read()` method, but it's much more efficient to +consume data from this stream via `'data'` events or by calling +`pipe()` into some other stream. Calling `read()` requires the +buffer to be flattened in some cases, which requires copying +memory. + +If you set `objectMode: true` in the options, then whatever is +written will be emitted. Otherwise, it'll do a minimal amount of +Buffer copying to ensure proper Streams semantics when `read(n)` +is called. + +`objectMode` can only be set at instantiation. Attempting to +write something other than a String or Buffer without having set +`objectMode` in the options will throw an error. + +This is not a `through` or `through2` stream. It doesn't +transform the data, it just passes it right through. If you want +to transform the data, extend the class, and override the +`write()` method. Once you're done transforming the data however +you want, call `super.write()` with the transform output. + +For some examples of streams that extend Minipass in various +ways, check out: + +- [minizlib](http://npm.im/minizlib) +- [fs-minipass](http://npm.im/fs-minipass) +- [tar](http://npm.im/tar) +- [minipass-collect](http://npm.im/minipass-collect) +- [minipass-flush](http://npm.im/minipass-flush) +- [minipass-pipeline](http://npm.im/minipass-pipeline) +- [tap](http://npm.im/tap) +- [tap-parser](http://npm.im/tap-parser) +- [treport](http://npm.im/treport) +- [minipass-fetch](http://npm.im/minipass-fetch) +- [pacote](http://npm.im/pacote) +- [make-fetch-happen](http://npm.im/make-fetch-happen) +- [cacache](http://npm.im/cacache) +- [ssri](http://npm.im/ssri) +- [npm-registry-fetch](http://npm.im/npm-registry-fetch) +- [minipass-json-stream](http://npm.im/minipass-json-stream) +- [minipass-sized](http://npm.im/minipass-sized) + +## Usage in TypeScript + +The `Minipass` class takes three type template definitions: + +- `RType` the type being read, which defaults to `Buffer`. If + `RType` is `string`, then the constructor _must_ get an options + object specifying either an `encoding` or `objectMode: true`. + If it's anything other than `string` or `Buffer`, then it + _must_ get an options object specifying `objectMode: true`. +- `WType` the type being written. If `RType` is `Buffer` or + `string`, then this defaults to `ContiguousData` (Buffer, + string, ArrayBuffer, or ArrayBufferView). Otherwise, it + defaults to `RType`. +- `Events` type mapping event names to the arguments emitted + with that event, which extends `Minipass.Events`. + +To declare types for custom events in subclasses, extend the +third parameter with your own event signatures. For example: + +```js +import { Minipass } from 'minipass' + +// a NDJSON stream that emits 'jsonError' when it can't stringify +export interface Events extends Minipass.Events { + jsonError: [e: Error] +} + +export class NDJSONStream extends Minipass { + constructor() { + super({ objectMode: true }) + } + + // data is type `any` because that's WType + write(data, encoding, cb) { + try { + const json = JSON.stringify(data) + return super.write(json + '\n', encoding, cb) + } catch (er) { + if (!er instanceof Error) { + er = Object.assign(new Error('json stringify failed'), { + cause: er, + }) + } + // trying to emit with something OTHER than an error will + // fail, because we declared the event arguments type. + this.emit('jsonError', er) + } + } +} + +const s = new NDJSONStream() +s.on('jsonError', e => { + // here, TS knows that e is an Error +}) +``` + +Emitting/handling events that aren't declared in this way is +fine, but the arguments will be typed as `unknown`. + +## Differences from Node.js Streams + +There are several things that make Minipass streams different +from (and in some ways superior to) Node.js core streams. + +Please read these caveats if you are familiar with node-core +streams and intend to use Minipass streams in your programs. + +You can avoid most of these differences entirely (for a very +small performance penalty) by setting `{async: true}` in the +constructor options. + +### Timing + +Minipass streams are designed to support synchronous use-cases. +Thus, data is emitted as soon as it is available, always. It is +buffered until read, but no longer. Another way to look at it is +that Minipass streams are exactly as synchronous as the logic +that writes into them. + +This can be surprising if your code relies on +`PassThrough.write()` always providing data on the next tick +rather than the current one, or being able to call `resume()` and +not have the entire buffer disappear immediately. + +However, without this synchronicity guarantee, there would be no +way for Minipass to achieve the speeds it does, or support the +synchronous use cases that it does. Simply put, waiting takes +time. + +This non-deferring approach makes Minipass streams much easier to +reason about, especially in the context of Promises and other +flow-control mechanisms. + +Example: + +```js +// hybrid module, either works +import { Minipass } from 'minipass' +// or: +const { Minipass } = require('minipass') + +const stream = new Minipass() +stream.on('data', () => console.log('data event')) +console.log('before write') +stream.write('hello') +console.log('after write') +// output: +// before write +// data event +// after write +``` + +### Exception: Async Opt-In + +If you wish to have a Minipass stream with behavior that more +closely mimics Node.js core streams, you can set the stream in +async mode either by setting `async: true` in the constructor +options, or by setting `stream.async = true` later on. + +```js +// hybrid module, either works +import { Minipass } from 'minipass' +// or: +const { Minipass } = require('minipass') + +const asyncStream = new Minipass({ async: true }) +asyncStream.on('data', () => console.log('data event')) +console.log('before write') +asyncStream.write('hello') +console.log('after write') +// output: +// before write +// after write +// data event <-- this is deferred until the next tick +``` + +Switching _out_ of async mode is unsafe, as it could cause data +corruption, and so is not enabled. Example: + +```js +import { Minipass } from 'minipass' +const stream = new Minipass({ encoding: 'utf8' }) +stream.on('data', chunk => console.log(chunk)) +stream.async = true +console.log('before writes') +stream.write('hello') +setStreamSyncAgainSomehow(stream) // <-- this doesn't actually exist! +stream.write('world') +console.log('after writes') +// hypothetical output would be: +// before writes +// world +// after writes +// hello +// NOT GOOD! +``` + +To avoid this problem, once set into async mode, any attempt to +make the stream sync again will be ignored. + +```js +const { Minipass } = require('minipass') +const stream = new Minipass({ encoding: 'utf8' }) +stream.on('data', chunk => console.log(chunk)) +stream.async = true +console.log('before writes') +stream.write('hello') +stream.async = false // <-- no-op, stream already async +stream.write('world') +console.log('after writes') +// actual output: +// before writes +// after writes +// hello +// world +``` + +### No High/Low Water Marks + +Node.js core streams will optimistically fill up a buffer, +returning `true` on all writes until the limit is hit, even if +the data has nowhere to go. Then, they will not attempt to draw +more data in until the buffer size dips below a minimum value. + +Minipass streams are much simpler. The `write()` method will +return `true` if the data has somewhere to go (which is to say, +given the timing guarantees, that the data is already there by +the time `write()` returns). + +If the data has nowhere to go, then `write()` returns false, and +the data sits in a buffer, to be drained out immediately as soon +as anyone consumes it. + +Since nothing is ever buffered unnecessarily, there is much less +copying data, and less bookkeeping about buffer capacity levels. + +### Hazards of Buffering (or: Why Minipass Is So Fast) + +Since data written to a Minipass stream is immediately written +all the way through the pipeline, and `write()` always returns +true/false based on whether the data was fully flushed, +backpressure is communicated immediately to the upstream caller. +This minimizes buffering. + +Consider this case: + +```js +const { PassThrough } = require('stream') +const p1 = new PassThrough({ highWaterMark: 1024 }) +const p2 = new PassThrough({ highWaterMark: 1024 }) +const p3 = new PassThrough({ highWaterMark: 1024 }) +const p4 = new PassThrough({ highWaterMark: 1024 }) + +p1.pipe(p2).pipe(p3).pipe(p4) +p4.on('data', () => console.log('made it through')) + +// this returns false and buffers, then writes to p2 on next tick (1) +// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2) +// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3) +// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain' +// on next tick (4) +// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and +// 'drain' on next tick (5) +// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6) +// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next +// tick (7) + +p1.write(Buffer.alloc(2048)) // returns false +``` + +Along the way, the data was buffered and deferred at each stage, +and multiple event deferrals happened, for an unblocked pipeline +where it was perfectly safe to write all the way through! + +Furthermore, setting a `highWaterMark` of `1024` might lead +someone reading the code to think an advisory maximum of 1KiB is +being set for the pipeline. However, the actual advisory +buffering level is the _sum_ of `highWaterMark` values, since +each one has its own bucket. + +Consider the Minipass case: + +```js +const m1 = new Minipass() +const m2 = new Minipass() +const m3 = new Minipass() +const m4 = new Minipass() + +m1.pipe(m2).pipe(m3).pipe(m4) +m4.on('data', () => console.log('made it through')) + +// m1 is flowing, so it writes the data to m2 immediately +// m2 is flowing, so it writes the data to m3 immediately +// m3 is flowing, so it writes the data to m4 immediately +// m4 is flowing, so it fires the 'data' event immediately, returns true +// m4's write returned true, so m3 is still flowing, returns true +// m3's write returned true, so m2 is still flowing, returns true +// m2's write returned true, so m1 is still flowing, returns true +// No event deferrals or buffering along the way! + +m1.write(Buffer.alloc(2048)) // returns true +``` + +It is extremely unlikely that you _don't_ want to buffer any data +written, or _ever_ buffer data that can be flushed all the way +through. Neither node-core streams nor Minipass ever fail to +buffer written data, but node-core streams do a lot of +unnecessary buffering and pausing. + +As always, the faster implementation is the one that does less +stuff and waits less time to do it. + +### Immediately emit `end` for empty streams (when not paused) + +If a stream is not paused, and `end()` is called before writing +any data into it, then it will emit `end` immediately. + +If you have logic that occurs on the `end` event which you don't +want to potentially happen immediately (for example, closing file +descriptors, moving on to the next entry in an archive parse +stream, etc.) then be sure to call `stream.pause()` on creation, +and then `stream.resume()` once you are ready to respond to the +`end` event. + +However, this is _usually_ not a problem because: + +### Emit `end` When Asked + +One hazard of immediately emitting `'end'` is that you may not +yet have had a chance to add a listener. In order to avoid this +hazard, Minipass streams safely re-emit the `'end'` event if a +new listener is added after `'end'` has been emitted. + +Ie, if you do `stream.on('end', someFunction)`, and the stream +has already emitted `end`, then it will call the handler right +away. (You can think of this somewhat like attaching a new +`.then(fn)` to a previously-resolved Promise.) + +To prevent calling handlers multiple times who would not expect +multiple ends to occur, all listeners are removed from the +`'end'` event whenever it is emitted. + +### Emit `error` When Asked + +The most recent error object passed to the `'error'` event is +stored on the stream. If a new `'error'` event handler is added, +and an error was previously emitted, then the event handler will +be called immediately (or on `process.nextTick` in the case of +async streams). + +This makes it much more difficult to end up trying to interact +with a broken stream, if the error handler is added after an +error was previously emitted. + +### Impact of "immediate flow" on Tee-streams + +A "tee stream" is a stream piping to multiple destinations: + +```js +const tee = new Minipass() +t.pipe(dest1) +t.pipe(dest2) +t.write('foo') // goes to both destinations +``` + +Since Minipass streams _immediately_ process any pending data +through the pipeline when a new pipe destination is added, this +can have surprising effects, especially when a stream comes in +from some other function and may or may not have data in its +buffer. + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.pipe(dest1) // 'foo' chunk flows to dest1 immediately, and is gone +src.pipe(dest2) // gets nothing! +``` + +One solution is to create a dedicated tee-stream junction that +pipes to both locations, and then pipe to _that_ instead. + +```js +// Safe example: tee to both places +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.pipe(dest1) +tee.pipe(dest2) +src.pipe(tee) // tee gets 'foo', pipes to both locations +``` + +The same caveat applies to `on('data')` event listeners. The +first one added will _immediately_ receive all of the data, +leaving nothing for the second: + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.on('data', handler1) // receives 'foo' right away +src.on('data', handler2) // nothing to see here! +``` + +Using a dedicated tee-stream can be used in this case as well: + +```js +// Safe example: tee to both data handlers +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.on('data', handler1) +tee.on('data', handler2) +src.pipe(tee) +``` + +All of the hazards in this section are avoided by setting `{ +async: true }` in the Minipass constructor, or by setting +`stream.async = true` afterwards. Note that this does add some +overhead, so should only be done in cases where you are willing +to lose a bit of performance in order to avoid having to refactor +program logic. + +## USAGE + +It's a stream! Use it like a stream and it'll most likely do what +you want. + +```js +import { Minipass } from 'minipass' +const mp = new Minipass(options) // options is optional +mp.write('foo') +mp.pipe(someOtherStream) +mp.end('bar') +``` + +### OPTIONS + +- `encoding` How would you like the data coming _out_ of the + stream to be encoded? Accepts any values that can be passed to + `Buffer.toString()`. +- `objectMode` Emit data exactly as it comes in. This will be + flipped on by default if you write() something other than a + string or Buffer at any point. Setting `objectMode: true` will + prevent setting any encoding value. +- `async` Defaults to `false`. Set to `true` to defer data + emission until next tick. This reduces performance slightly, + but makes Minipass streams use timing behavior closer to Node + core streams. See [Timing](#timing) for more details. +- `signal` An `AbortSignal` that will cause the stream to unhook + itself from everything and become as inert as possible. Note + that providing a `signal` parameter will make `'error'` events + no longer throw if they are unhandled, but they will still be + emitted to handlers if any are attached. + +### API + +Implements the user-facing portions of Node.js's `Readable` and +`Writable` streams. + +### Methods + +- `write(chunk, [encoding], [callback])` - Put data in. (Note + that, in the base Minipass class, the same data will come out.) + Returns `false` if the stream will buffer the next write, or + true if it's still in "flowing" mode. +- `end([chunk, [encoding]], [callback])` - Signal that you have + no more data to write. This will queue an `end` event to be + fired when all the data has been consumed. +- `pause()` - No more data for a while, please. This also + prevents `end` from being emitted for empty streams until the + stream is resumed. +- `resume()` - Resume the stream. If there's data in the buffer, + it is all discarded. Any buffered events are immediately + emitted. +- `pipe(dest)` - Send all output to the stream provided. When + data is emitted, it is immediately written to any and all pipe + destinations. (Or written on next tick in `async` mode.) +- `unpipe(dest)` - Stop piping to the destination stream. This is + immediate, meaning that any asynchronously queued data will + _not_ make it to the destination when running in `async` mode. + - `options.end` - Boolean, end the destination stream when the + source stream ends. Default `true`. + - `options.proxyErrors` - Boolean, proxy `error` events from + the source stream to the destination stream. Note that errors + are _not_ proxied after the pipeline terminates, either due + to the source emitting `'end'` or manually unpiping with + `src.unpipe(dest)`. Default `false`. +- `on(ev, fn)`, `emit(ev, fn)` - Minipass streams are + EventEmitters. Some events are given special treatment, + however. (See below under "events".) +- `promise()` - Returns a Promise that resolves when the stream + emits `end`, or rejects if the stream emits `error`. +- `collect()` - Return a Promise that resolves on `end` with an + array containing each chunk of data that was emitted, or + rejects if the stream emits `error`. Note that this consumes + the stream data. +- `concat()` - Same as `collect()`, but concatenates the data + into a single Buffer object. Will reject the returned promise + if the stream is in objectMode, or if it goes into objectMode + by the end of the data. +- `read(n)` - Consume `n` bytes of data out of the buffer. If `n` + is not provided, then consume all of it. If `n` bytes are not + available, then it returns null. **Note** consuming streams in + this way is less efficient, and can lead to unnecessary Buffer + copying. +- `destroy([er])` - Destroy the stream. If an error is provided, + then an `'error'` event is emitted. If the stream has a + `close()` method, and has not emitted a `'close'` event yet, + then `stream.close()` will be called. Any Promises returned by + `.promise()`, `.collect()` or `.concat()` will be rejected. + After being destroyed, writing to the stream will emit an + error. No more data will be emitted if the stream is destroyed, + even if it was previously buffered. + +### Properties + +- `bufferLength` Read-only. Total number of bytes buffered, or in + the case of objectMode, the total number of objects. +- `encoding` Read-only. The encoding that has been set. +- `flowing` Read-only. Boolean indicating whether a chunk written + to the stream will be immediately emitted. +- `emittedEnd` Read-only. Boolean indicating whether the end-ish + events (ie, `end`, `prefinish`, `finish`) have been emitted. + Note that listening on any end-ish event will immediateyl + re-emit it if it has already been emitted. +- `writable` Whether the stream is writable. Default `true`. Set + to `false` when `end()` +- `readable` Whether the stream is readable. Default `true`. +- `pipes` An array of Pipe objects referencing streams that this + stream is piping into. +- `destroyed` A getter that indicates whether the stream was + destroyed. +- `paused` True if the stream has been explicitly paused, + otherwise false. +- `objectMode` Indicates whether the stream is in `objectMode`. +- `aborted` Readonly property set when the `AbortSignal` + dispatches an `abort` event. + +### Events + +- `data` Emitted when there's data to read. Argument is the data + to read. This is never emitted while not flowing. If a listener + is attached, that will resume the stream. +- `end` Emitted when there's no more data to read. This will be + emitted immediately for empty streams when `end()` is called. + If a listener is attached, and `end` was already emitted, then + it will be emitted again. All listeners are removed when `end` + is emitted. +- `prefinish` An end-ish event that follows the same logic as + `end` and is emitted in the same conditions where `end` is + emitted. Emitted after `'end'`. +- `finish` An end-ish event that follows the same logic as `end` + and is emitted in the same conditions where `end` is emitted. + Emitted after `'prefinish'`. +- `close` An indication that an underlying resource has been + released. Minipass does not emit this event, but will defer it + until after `end` has been emitted, since it throws off some + stream libraries otherwise. +- `drain` Emitted when the internal buffer empties, and it is + again suitable to `write()` into the stream. +- `readable` Emitted when data is buffered and ready to be read + by a consumer. +- `resume` Emitted when stream changes state from buffering to + flowing mode. (Ie, when `resume` is called, `pipe` is called, + or a `data` event listener is added.) + +### Static Methods + +- `Minipass.isStream(stream)` Returns `true` if the argument is a + stream, and false otherwise. To be considered a stream, the + object must be either an instance of Minipass, or an + EventEmitter that has either a `pipe()` method, or both + `write()` and `end()` methods. (Pretty much any stream in + node-land will return `true` for this.) + +## EXAMPLES + +Here are some examples of things you can do with Minipass +streams. + +### simple "are you done yet" promise + +```js +mp.promise().then( + () => { + // stream is finished + }, + er => { + // stream emitted an error + } +) +``` + +### collecting + +```js +mp.collect().then(all => { + // all is an array of all the data emitted + // encoding is supported in this case, so + // so the result will be a collection of strings if + // an encoding is specified, or buffers/objects if not. + // + // In an async function, you may do + // const data = await stream.collect() +}) +``` + +### collecting into a single blob + +This is a bit slower because it concatenates the data into one +chunk for you, but if you're going to do it yourself anyway, it's +convenient this way: + +```js +mp.concat().then(onebigchunk => { + // onebigchunk is a string if the stream + // had an encoding set, or a buffer otherwise. +}) +``` + +### iteration + +You can iterate over streams synchronously or asynchronously in +platforms that support it. + +Synchronous iteration will end when the currently available data +is consumed, even if the `end` event has not been reached. In +string and buffer mode, the data is concatenated, so unless +multiple writes are occurring in the same tick as the `read()`, +sync iteration loops will generally only have a single iteration. + +To consume chunks in this way exactly as they have been written, +with no flattening, create the stream with the `{ objectMode: +true }` option. + +```js +const mp = new Minipass({ objectMode: true }) +mp.write('a') +mp.write('b') +for (let letter of mp) { + console.log(letter) // a, b +} +mp.write('c') +mp.write('d') +for (let letter of mp) { + console.log(letter) // c, d +} +mp.write('e') +mp.end() +for (let letter of mp) { + console.log(letter) // e +} +for (let letter of mp) { + console.log(letter) // nothing +} +``` + +Asynchronous iteration will continue until the end event is reached, +consuming all of the data. + +```js +const mp = new Minipass({ encoding: 'utf8' }) + +// some source of some data +let i = 5 +const inter = setInterval(() => { + if (i-- > 0) mp.write(Buffer.from('foo\n', 'utf8')) + else { + mp.end() + clearInterval(inter) + } +}, 100) + +// consume the data with asynchronous iteration +async function consume() { + for await (let chunk of mp) { + console.log(chunk) + } + return 'ok' +} + +consume().then(res => console.log(res)) +// logs `foo\n` 5 times, and then `ok` +``` + +### subclass that `console.log()`s everything written into it + +```js +class Logger extends Minipass { + write(chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end(chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } +} + +someSource.pipe(new Logger()).pipe(someDest) +``` + +### same thing, but using an inline anonymous class + +```js +// js classes are fun +someSource + .pipe( + new (class extends Minipass { + emit(ev, ...data) { + // let's also log events, because debugging some weird thing + console.log('EMIT', ev) + return super.emit(ev, ...data) + } + write(chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end(chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } + })() + ) + .pipe(someDest) +``` + +### subclass that defers 'end' for some reason + +```js +class SlowEnd extends Minipass { + emit(ev, ...args) { + if (ev === 'end') { + console.log('going to end, hold on a sec') + setTimeout(() => { + console.log('ok, ready to end now') + super.emit('end', ...args) + }, 100) + return true + } else { + return super.emit(ev, ...args) + } + } +} +``` + +### transform that creates newline-delimited JSON + +```js +class NDJSONEncode extends Minipass { + write(obj, cb) { + try { + // JSON.stringify can throw, emit an error on that + return super.write(JSON.stringify(obj) + '\n', 'utf8', cb) + } catch (er) { + this.emit('error', er) + } + } + end(obj, cb) { + if (typeof obj === 'function') { + cb = obj + obj = undefined + } + if (obj !== undefined) { + this.write(obj) + } + return super.end(cb) + } +} +``` + +### transform that parses newline-delimited JSON + +```js +class NDJSONDecode extends Minipass { + constructor(options) { + // always be in object mode, as far as Minipass is concerned + super({ objectMode: true }) + this._jsonBuffer = '' + } + write(chunk, encoding, cb) { + if ( + typeof chunk === 'string' && + typeof encoding === 'string' && + encoding !== 'utf8' + ) { + chunk = Buffer.from(chunk, encoding).toString() + } else if (Buffer.isBuffer(chunk)) { + chunk = chunk.toString() + } + if (typeof encoding === 'function') { + cb = encoding + } + const jsonData = (this._jsonBuffer + chunk).split('\n') + this._jsonBuffer = jsonData.pop() + for (let i = 0; i < jsonData.length; i++) { + try { + // JSON.parse can throw, emit an error on that + super.write(JSON.parse(jsonData[i])) + } catch (er) { + this.emit('error', er) + continue + } + } + if (cb) cb() + } +} +``` diff --git a/node_modules/minipass/dist/commonjs/index.d.ts b/node_modules/minipass/dist/commonjs/index.d.ts new file mode 100644 index 00000000..031e61a8 --- /dev/null +++ b/node_modules/minipass/dist/commonjs/index.d.ts @@ -0,0 +1,549 @@ +/// +/// +/// +/// +import { EventEmitter } from 'node:events'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Same as StringDecoder, but exposing the `lastNeed` flag on the type + */ +type SD = StringDecoder & { + lastNeed: boolean; +}; +export type { SD, Pipe, PipeProxyErrors }; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export declare const isStream: (s: any) => s is NodeJS.WriteStream | NodeJS.ReadStream | Minipass | (NodeJS.ReadStream & { + fd: number; +}) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; +}) | (NodeJS.WriteStream & { + fd: number; +}) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; +}); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export declare const isReadable: (s: any) => s is Minipass.Readable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export declare const isWritable: (s: any) => s is Minipass.Readable; +declare const EOF: unique symbol; +declare const MAYBE_EMIT_END: unique symbol; +declare const EMITTED_END: unique symbol; +declare const EMITTING_END: unique symbol; +declare const EMITTED_ERROR: unique symbol; +declare const CLOSED: unique symbol; +declare const READ: unique symbol; +declare const FLUSH: unique symbol; +declare const FLUSHCHUNK: unique symbol; +declare const ENCODING: unique symbol; +declare const DECODER: unique symbol; +declare const FLOWING: unique symbol; +declare const PAUSED: unique symbol; +declare const RESUME: unique symbol; +declare const BUFFER: unique symbol; +declare const PIPES: unique symbol; +declare const BUFFERLENGTH: unique symbol; +declare const BUFFERPUSH: unique symbol; +declare const BUFFERSHIFT: unique symbol; +declare const OBJECTMODE: unique symbol; +declare const DESTROYED: unique symbol; +declare const ERROR: unique symbol; +declare const EMITDATA: unique symbol; +declare const EMITEND: unique symbol; +declare const EMITEND2: unique symbol; +declare const ASYNC: unique symbol; +declare const ABORT: unique symbol; +declare const ABORTED: unique symbol; +declare const SIGNAL: unique symbol; +declare const DATALISTENERS: unique symbol; +declare const DISCARDED: unique symbol; +/** + * Options that may be passed to stream.pipe() + */ +export interface PipeOptions { + /** + * end the destination stream when the source stream ends + */ + end?: boolean; + /** + * proxy errors from the source stream to the destination stream + */ + proxyErrors?: boolean; +} +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +declare class Pipe { + src: Minipass; + dest: Minipass; + opts: PipeOptions; + ondrain: () => any; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); + unpipe(): void; + proxyErrors(_er: any): void; + end(): void; +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +declare class PipeProxyErrors extends Pipe { + unpipe(): void; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); +} +export declare namespace Minipass { + /** + * Encoding used to create a stream that outputs strings rather than + * Buffer objects. + */ + export type Encoding = BufferEncoding | 'buffer' | null; + /** + * Any stream that Minipass can pipe into + */ + export type Writable = Minipass | NodeJS.WriteStream | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); + /** + * Any stream that can be read from + */ + export type Readable = Minipass | NodeJS.ReadStream | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }); + /** + * Utility type that can be iterated sync or async + */ + export type DualIterable = Iterable & AsyncIterable; + type EventArguments = Record; + /** + * The listing of events that a Minipass class can emit. + * Extend this when extending the Minipass class, and pass as + * the third template argument. The key is the name of the event, + * and the value is the argument list. + * + * Any undeclared events will still be allowed, but the handler will get + * arguments as `unknown[]`. + */ + export interface Events extends EventArguments { + readable: []; + data: [chunk: RType]; + error: [er: unknown]; + abort: [reason: unknown]; + drain: []; + resume: []; + end: []; + finish: []; + prefinish: []; + close: []; + [DESTROYED]: [er?: unknown]; + [ERROR]: [er: unknown]; + } + /** + * String or buffer-like data that can be joined and sliced + */ + export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string; + export type BufferOrString = Buffer | string; + /** + * Options passed to the Minipass constructor. + */ + export type SharedOptions = { + /** + * Defer all data emission and other events until the end of the + * current tick, similar to Node core streams + */ + async?: boolean; + /** + * A signal which will abort the stream + */ + signal?: AbortSignal; + /** + * Output string encoding. Set to `null` or `'buffer'` (or omit) to + * emit Buffer objects rather than strings. + * + * Conflicts with `objectMode` + */ + encoding?: BufferEncoding | null | 'buffer'; + /** + * Output data exactly as it was written, supporting non-buffer/string + * data (such as arbitrary objects, falsey values, etc.) + * + * Conflicts with `encoding` + */ + objectMode?: boolean; + }; + /** + * Options for a string encoded output + */ + export type EncodingOptions = SharedOptions & { + encoding: BufferEncoding; + objectMode?: false; + }; + /** + * Options for contiguous data buffer output + */ + export type BufferOptions = SharedOptions & { + encoding?: null | 'buffer'; + objectMode?: false; + }; + /** + * Options for objectMode arbitrary output + */ + export type ObjectModeOptions = SharedOptions & { + objectMode: true; + encoding?: null; + }; + /** + * Utility type to determine allowed options based on read type + */ + export type Options = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions); + export {}; +} +/** + * 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 declare class Minipass = Minipass.Events> extends EventEmitter implements Minipass.DualIterable { + [FLOWING]: boolean; + [PAUSED]: boolean; + [PIPES]: Pipe[]; + [BUFFER]: RType[]; + [OBJECTMODE]: boolean; + [ENCODING]: BufferEncoding | null; + [ASYNC]: boolean; + [DECODER]: SD | null; + [EOF]: boolean; + [EMITTED_END]: boolean; + [EMITTING_END]: boolean; + [CLOSED]: boolean; + [EMITTED_ERROR]: unknown; + [BUFFERLENGTH]: number; + [DESTROYED]: boolean; + [SIGNAL]?: AbortSignal; + [ABORTED]: boolean; + [DATALISTENERS]: number; + [DISCARDED]: boolean; + /** + * true if the stream can be written + */ + writable: boolean; + /** + * true if the stream can be read + */ + readable: boolean; + /** + * 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: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options] : [Minipass.Options])); + /** + * 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(): number; + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding(): BufferEncoding | null; + /** + * @deprecated - This is a read only property + */ + set encoding(_enc: BufferEncoding | null); + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc: Minipass.Encoding): void; + /** + * True if this is an objectMode stream + */ + get objectMode(): boolean; + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om: boolean); + /** + * true if this is an async stream + */ + get ['async'](): boolean; + /** + * 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: boolean); + [ABORT](): void; + /** + * True if the stream has been aborted. + */ + get aborted(): boolean; + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_: boolean); + /** + * Write data into the stream + * + * If the chunk written is a string, and encoding is not specified, then + * `utf8` will be assumed. If the stream encoding matches the encoding of + * a written string, and the state of the string decoder allows it, then + * the string will be passed through to either the output or the internal + * buffer without any processing. Otherwise, it will be turned into a + * Buffer object for processing into the desired encoding. + * + * If provided, `cb` function is called immediately before return for + * sync streams, or on next tick for async streams, because for this + * base class, a chunk is considered "processed" once it is accepted + * and either emitted or buffered. That is, the callback does not indicate + * that the chunk has been eventually emitted, though of course child + * classes can override this function to do whatever processing is required + * and call `super.write(...)` only once processing is completed. + */ + write(chunk: WType, cb?: () => void): boolean; + write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean; + /** + * 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?: number | null): RType | null; + [READ](n: number | null, chunk: RType): RType; + /** + * End the stream, optionally providing a final write. + * + * See {@link Minipass#write} for argument descriptions + */ + end(cb?: () => void): this; + end(chunk: WType, cb?: () => void): this; + end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this; + [RESUME](): void; + /** + * 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(): void; + /** + * Pause the stream + */ + pause(): void; + /** + * true if the stream has been forcibly destroyed + */ + get destroyed(): boolean; + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing(): boolean; + /** + * true if the stream is currently in a paused state + */ + get paused(): boolean; + [BUFFERPUSH](chunk: RType): void; + [BUFFERSHIFT](): RType; + [FLUSH](noDrain?: boolean): void; + [FLUSHCHUNK](chunk: RType): boolean; + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest: W, opts?: PipeOptions): W; + /** + * 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: W): void; + /** + * Alias for {@link Minipass#on} + */ + addListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * 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: Event, handler: (...args: Events[Event]) => any): this; + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * 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: Event, handler: (...args: Events[Event]) => any): this; + /** + * 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?: Event): this; + /** + * true if the 'end' event has been emitted + */ + get emittedEnd(): boolean; + [MAYBE_EMIT_END](): void; + /** + * 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: Event, ...args: Events[Event]): boolean; + [EMITDATA](data: RType): boolean; + [EMITEND](): boolean; + [EMITEND2](): boolean; + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + collect(): Promise; + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + concat(): Promise; + /** + * Return a void Promise that resolves once the stream ends. + */ + promise(): Promise; + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator](): Generator; + /** + * 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?: unknown): this; + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream(): (s: any) => s is NodeJS.WriteStream | NodeJS.ReadStream | Minipass | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }) | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/minipass/dist/commonjs/index.d.ts.map b/node_modules/minipass/dist/commonjs/index.d.ts.map new file mode 100644 index 00000000..cac7e00a --- /dev/null +++ b/node_modules/minipass/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;A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AI,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC;IA6D3D;;;;;OAKG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC;IAkCjD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO;IA0BpB;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;;;;;;;;;;;OAElB;CACF"} \ No newline at end of file diff --git a/node_modules/minipass/dist/commonjs/index.js b/node_modules/minipass/dist/commonjs/index.js new file mode 100644 index 00000000..068c095b --- /dev/null +++ b/node_modules/minipass/dist/commonjs/index.js @@ -0,0 +1,1028 @@ +"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 node_events_1 = require("node:events"); +const node_stream_1 = __importDefault(require("node:stream")); +const node_string_decoder_1 = require("node: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 node_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 node_events_1.EventEmitter && + typeof s.pipe === 'function' && + // node core Writable streams have a pipe() method, but it throws + s.pipe !== node_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 node_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 node_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 node_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/minipass/dist/commonjs/index.js.map b/node_modules/minipass/dist/commonjs/index.js.map new file mode 100644 index 00000000..9f3ef4b7 --- /dev/null +++ b/node_modules/minipass/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC;QACE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;KACb,CAAA;AACP,6CAA0C;AAC1C,8DAAgC;AAChC,6DAAmD;AASnD;;;GAGG;AACI,MAAM,QAAQ,GAAG,CACtB,CAAM,EACsC,EAAE,CAC9C,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,YAAY,QAAQ;QACpB,CAAC,YAAY,qBAAM;QACnB,IAAA,kBAAU,EAAC,CAAC,CAAC;QACb,IAAA,kBAAU,EAAC,CAAC,CAAC,CAAC,CAAA;AARL,QAAA,QAAQ,YAQH;AAElB;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,0BAAY;IACzB,OAAQ,CAAuB,CAAC,IAAI,KAAK,UAAU;IACnD,iEAAiE;IAChE,CAAuB,CAAC,IAAI,KAAK,qBAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAA;AANrD,QAAA,UAAU,cAM2C;AAElE;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,0BAAY;IACzB,OAAQ,CAAuB,CAAC,KAAK,KAAK,UAAU;IACpD,OAAQ,CAAuB,CAAC,GAAG,KAAK,UAA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;QAEzB,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;QACjB,OAAO,gBAAQ,CAAA;IACjB,CAAC;CACF;AAn/BD,4BAm/BC","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = er => dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/minipass/dist/commonjs/package.json b/node_modules/minipass/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/minipass/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/minipass/dist/esm/index.d.ts b/node_modules/minipass/dist/esm/index.d.ts new file mode 100644 index 00000000..6dbfbcf9 --- /dev/null +++ b/node_modules/minipass/dist/esm/index.d.ts @@ -0,0 +1,549 @@ +/// +/// +/// +/// +import { EventEmitter } from 'node:events'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Same as StringDecoder, but exposing the `lastNeed` flag on the type + */ +type SD = StringDecoder & { + lastNeed: boolean; +}; +export type { SD, Pipe, PipeProxyErrors }; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export declare const isStream: (s: any) => s is NodeJS.WriteStream | NodeJS.ReadStream | Minipass | (NodeJS.ReadStream & { + fd: number; +}) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; +}) | (NodeJS.WriteStream & { + fd: number; +}) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; +}); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export declare const isReadable: (s: any) => s is Minipass.Readable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export declare const isWritable: (s: any) => s is Minipass.Readable; +declare const EOF: unique symbol; +declare const MAYBE_EMIT_END: unique symbol; +declare const EMITTED_END: unique symbol; +declare const EMITTING_END: unique symbol; +declare const EMITTED_ERROR: unique symbol; +declare const CLOSED: unique symbol; +declare const READ: unique symbol; +declare const FLUSH: unique symbol; +declare const FLUSHCHUNK: unique symbol; +declare const ENCODING: unique symbol; +declare const DECODER: unique symbol; +declare const FLOWING: unique symbol; +declare const PAUSED: unique symbol; +declare const RESUME: unique symbol; +declare const BUFFER: unique symbol; +declare const PIPES: unique symbol; +declare const BUFFERLENGTH: unique symbol; +declare const BUFFERPUSH: unique symbol; +declare const BUFFERSHIFT: unique symbol; +declare const OBJECTMODE: unique symbol; +declare const DESTROYED: unique symbol; +declare const ERROR: unique symbol; +declare const EMITDATA: unique symbol; +declare const EMITEND: unique symbol; +declare const EMITEND2: unique symbol; +declare const ASYNC: unique symbol; +declare const ABORT: unique symbol; +declare const ABORTED: unique symbol; +declare const SIGNAL: unique symbol; +declare const DATALISTENERS: unique symbol; +declare const DISCARDED: unique symbol; +/** + * Options that may be passed to stream.pipe() + */ +export interface PipeOptions { + /** + * end the destination stream when the source stream ends + */ + end?: boolean; + /** + * proxy errors from the source stream to the destination stream + */ + proxyErrors?: boolean; +} +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +declare class Pipe { + src: Minipass; + dest: Minipass; + opts: PipeOptions; + ondrain: () => any; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); + unpipe(): void; + proxyErrors(_er: any): void; + end(): void; +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +declare class PipeProxyErrors extends Pipe { + unpipe(): void; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); +} +export declare namespace Minipass { + /** + * Encoding used to create a stream that outputs strings rather than + * Buffer objects. + */ + export type Encoding = BufferEncoding | 'buffer' | null; + /** + * Any stream that Minipass can pipe into + */ + export type Writable = Minipass | NodeJS.WriteStream | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); + /** + * Any stream that can be read from + */ + export type Readable = Minipass | NodeJS.ReadStream | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }); + /** + * Utility type that can be iterated sync or async + */ + export type DualIterable = Iterable & AsyncIterable; + type EventArguments = Record; + /** + * The listing of events that a Minipass class can emit. + * Extend this when extending the Minipass class, and pass as + * the third template argument. The key is the name of the event, + * and the value is the argument list. + * + * Any undeclared events will still be allowed, but the handler will get + * arguments as `unknown[]`. + */ + export interface Events extends EventArguments { + readable: []; + data: [chunk: RType]; + error: [er: unknown]; + abort: [reason: unknown]; + drain: []; + resume: []; + end: []; + finish: []; + prefinish: []; + close: []; + [DESTROYED]: [er?: unknown]; + [ERROR]: [er: unknown]; + } + /** + * String or buffer-like data that can be joined and sliced + */ + export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string; + export type BufferOrString = Buffer | string; + /** + * Options passed to the Minipass constructor. + */ + export type SharedOptions = { + /** + * Defer all data emission and other events until the end of the + * current tick, similar to Node core streams + */ + async?: boolean; + /** + * A signal which will abort the stream + */ + signal?: AbortSignal; + /** + * Output string encoding. Set to `null` or `'buffer'` (or omit) to + * emit Buffer objects rather than strings. + * + * Conflicts with `objectMode` + */ + encoding?: BufferEncoding | null | 'buffer'; + /** + * Output data exactly as it was written, supporting non-buffer/string + * data (such as arbitrary objects, falsey values, etc.) + * + * Conflicts with `encoding` + */ + objectMode?: boolean; + }; + /** + * Options for a string encoded output + */ + export type EncodingOptions = SharedOptions & { + encoding: BufferEncoding; + objectMode?: false; + }; + /** + * Options for contiguous data buffer output + */ + export type BufferOptions = SharedOptions & { + encoding?: null | 'buffer'; + objectMode?: false; + }; + /** + * Options for objectMode arbitrary output + */ + export type ObjectModeOptions = SharedOptions & { + objectMode: true; + encoding?: null; + }; + /** + * Utility type to determine allowed options based on read type + */ + export type Options = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions); + export {}; +} +/** + * 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 declare class Minipass = Minipass.Events> extends EventEmitter implements Minipass.DualIterable { + [FLOWING]: boolean; + [PAUSED]: boolean; + [PIPES]: Pipe[]; + [BUFFER]: RType[]; + [OBJECTMODE]: boolean; + [ENCODING]: BufferEncoding | null; + [ASYNC]: boolean; + [DECODER]: SD | null; + [EOF]: boolean; + [EMITTED_END]: boolean; + [EMITTING_END]: boolean; + [CLOSED]: boolean; + [EMITTED_ERROR]: unknown; + [BUFFERLENGTH]: number; + [DESTROYED]: boolean; + [SIGNAL]?: AbortSignal; + [ABORTED]: boolean; + [DATALISTENERS]: number; + [DISCARDED]: boolean; + /** + * true if the stream can be written + */ + writable: boolean; + /** + * true if the stream can be read + */ + readable: boolean; + /** + * 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: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options] : [Minipass.Options])); + /** + * 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(): number; + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding(): BufferEncoding | null; + /** + * @deprecated - This is a read only property + */ + set encoding(_enc: BufferEncoding | null); + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc: Minipass.Encoding): void; + /** + * True if this is an objectMode stream + */ + get objectMode(): boolean; + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om: boolean); + /** + * true if this is an async stream + */ + get ['async'](): boolean; + /** + * 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: boolean); + [ABORT](): void; + /** + * True if the stream has been aborted. + */ + get aborted(): boolean; + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_: boolean); + /** + * Write data into the stream + * + * If the chunk written is a string, and encoding is not specified, then + * `utf8` will be assumed. If the stream encoding matches the encoding of + * a written string, and the state of the string decoder allows it, then + * the string will be passed through to either the output or the internal + * buffer without any processing. Otherwise, it will be turned into a + * Buffer object for processing into the desired encoding. + * + * If provided, `cb` function is called immediately before return for + * sync streams, or on next tick for async streams, because for this + * base class, a chunk is considered "processed" once it is accepted + * and either emitted or buffered. That is, the callback does not indicate + * that the chunk has been eventually emitted, though of course child + * classes can override this function to do whatever processing is required + * and call `super.write(...)` only once processing is completed. + */ + write(chunk: WType, cb?: () => void): boolean; + write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean; + /** + * 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?: number | null): RType | null; + [READ](n: number | null, chunk: RType): RType; + /** + * End the stream, optionally providing a final write. + * + * See {@link Minipass#write} for argument descriptions + */ + end(cb?: () => void): this; + end(chunk: WType, cb?: () => void): this; + end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this; + [RESUME](): void; + /** + * 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(): void; + /** + * Pause the stream + */ + pause(): void; + /** + * true if the stream has been forcibly destroyed + */ + get destroyed(): boolean; + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing(): boolean; + /** + * true if the stream is currently in a paused state + */ + get paused(): boolean; + [BUFFERPUSH](chunk: RType): void; + [BUFFERSHIFT](): RType; + [FLUSH](noDrain?: boolean): void; + [FLUSHCHUNK](chunk: RType): boolean; + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest: W, opts?: PipeOptions): W; + /** + * 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: W): void; + /** + * Alias for {@link Minipass#on} + */ + addListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * 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: Event, handler: (...args: Events[Event]) => any): this; + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * 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: Event, handler: (...args: Events[Event]) => any): this; + /** + * 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?: Event): this; + /** + * true if the 'end' event has been emitted + */ + get emittedEnd(): boolean; + [MAYBE_EMIT_END](): void; + /** + * 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: Event, ...args: Events[Event]): boolean; + [EMITDATA](data: RType): boolean; + [EMITEND](): boolean; + [EMITEND2](): boolean; + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + collect(): Promise; + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + concat(): Promise; + /** + * Return a void Promise that resolves once the stream ends. + */ + promise(): Promise; + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator](): Generator; + /** + * 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?: unknown): this; + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream(): (s: any) => s is NodeJS.WriteStream | NodeJS.ReadStream | Minipass | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }) | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/minipass/dist/esm/index.d.ts.map b/node_modules/minipass/dist/esm/index.d.ts.map new file mode 100644 index 00000000..cac7e00a --- /dev/null +++ b/node_modules/minipass/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;GAEG;AACH,KAAK,EAAE,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAA;AAE/C,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,QAAQ,MAChB,GAAG;QAoLyB,MAAM;;aAEtB,GAAG;cACF,GAAG;sBACK,GAAG,EAAE,GAAG,GA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;;;;;;;;;;;OAElB;CACF"} \ No newline at end of file diff --git a/node_modules/minipass/dist/esm/index.js b/node_modules/minipass/dist/esm/index.js new file mode 100644 index 00000000..b5fa4513 --- /dev/null +++ b/node_modules/minipass/dist/esm/index.js @@ -0,0 +1,1018 @@ +const proc = typeof process === 'object' && process + ? process + : { + stdout: null, + stderr: null, + }; +import { EventEmitter } from 'node:events'; +import Stream from 'node:stream'; +import { StringDecoder } from 'node: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/minipass/dist/esm/index.js.map b/node_modules/minipass/dist/esm/index.js.map new file mode 100644 index 00000000..741425ae --- /dev/null +++ b/node_modules/minipass/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC;QACE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;KACb,CAAA;AACP,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AASnD;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,CAAM,EACsC,EAAE,CAC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AAC;YACpB,IAAI,EAAE;gBAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;;gBACzB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACzB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QAEtB,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QAEtB,MAAM,EAAE,GAAG,IAEV,CAAA;QACD,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,EAAE,CAAC,KAAK,EAAE,CAAA;QAE/D,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC9B,qDAAqD;;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEzB,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;QACjB,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = er => dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/minipass/dist/esm/package.json b/node_modules/minipass/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/minipass/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/minipass/package.json b/node_modules/minipass/package.json new file mode 100644 index 00000000..771969b0 --- /dev/null +++ b/node_modules/minipass/package.json @@ -0,0 +1,82 @@ +{ + "name": "minipass", + "version": "7.1.2", + "description": "minimal implementation of a PassThrough stream", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "tshy": { + "selfLink": false, + "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", + "tap": "^19.0.0", + "through2": "^2.0.3", + "tshy": "^1.14.0", + "typedoc": "^0.25.1" + }, + "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": { + "typecheck": true, + "include": [ + "test/*.ts" + ] + } +} diff --git a/node_modules/mri/index.d.ts b/node_modules/mri/index.d.ts new file mode 100644 index 00000000..a46e43df --- /dev/null +++ b/node_modules/mri/index.d.ts @@ -0,0 +1,21 @@ +type Dict = Record; +type Arrayable = T | T[]; +type Default = Dict; + +declare function mri(args?: string[], options?: mri.Options): mri.Argv; + +declare namespace mri { + export interface Options { + boolean?: Arrayable; + string?: Arrayable; + alias?: Dict>; + default?: Dict; + unknown?(flag: string): void; + } + + export type Argv = T & { + _: string[]; + } +} + +export = mri; diff --git a/node_modules/mri/lib/index.js b/node_modules/mri/lib/index.js new file mode 100644 index 00000000..f17f13a8 --- /dev/null +++ b/node_modules/mri/lib/index.js @@ -0,0 +1,119 @@ +function toArr(any) { + return any == null ? [] : Array.isArray(any) ? any : [any]; +} + +function toVal(out, key, val, opts) { + var x, old=out[key], nxt=( + !!~opts.string.indexOf(key) ? (val == null || val === true ? '' : String(val)) + : typeof val === 'boolean' ? val + : !!~opts.boolean.indexOf(key) ? (val === 'false' ? false : val === 'true' || (out._.push((x = +val,x * 0 === 0) ? x : val),!!val)) + : (x = +val,x * 0 === 0) ? x : val + ); + out[key] = old == null ? nxt : (Array.isArray(old) ? old.concat(nxt) : [old, nxt]); +} + +module.exports = function (args, opts) { + args = args || []; + opts = opts || {}; + + var k, arr, arg, name, val, out={ _:[] }; + var i=0, j=0, idx=0, len=args.length; + + const alibi = opts.alias !== void 0; + const strict = opts.unknown !== void 0; + const defaults = opts.default !== void 0; + + opts.alias = opts.alias || {}; + opts.string = toArr(opts.string); + opts.boolean = toArr(opts.boolean); + + if (alibi) { + for (k in opts.alias) { + arr = opts.alias[k] = toArr(opts.alias[k]); + for (i=0; i < arr.length; i++) { + (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1); + } + } + } + + for (i=opts.boolean.length; i-- > 0;) { + arr = opts.alias[opts.boolean[i]] || []; + for (j=arr.length; j-- > 0;) opts.boolean.push(arr[j]); + } + + for (i=opts.string.length; i-- > 0;) { + arr = opts.alias[opts.string[i]] || []; + for (j=arr.length; j-- > 0;) opts.string.push(arr[j]); + } + + if (defaults) { + for (k in opts.default) { + name = typeof opts.default[k]; + arr = opts.alias[k] = opts.alias[k] || []; + if (opts[name] !== void 0) { + opts[name].push(k); + for (i=0; i < arr.length; i++) { + opts[name].push(arr[i]); + } + } + } + } + + const keys = strict ? Object.keys(opts.alias) : []; + + for (i=0; i < len; i++) { + arg = args[i]; + + if (arg === '--') { + out._ = out._.concat(args.slice(++i)); + break; + } + + for (j=0; j < arg.length; j++) { + if (arg.charCodeAt(j) !== 45) break; // "-" + } + + if (j === 0) { + out._.push(arg); + } else if (arg.substring(j, j + 3) === 'no-') { + name = arg.substring(j + 3); + if (strict && !~keys.indexOf(name)) { + return opts.unknown(arg); + } + out[name] = false; + } else { + for (idx=j+1; idx < arg.length; idx++) { + if (arg.charCodeAt(idx) === 61) break; // "=" + } + + name = arg.substring(j, idx); + val = arg.substring(++idx) || (i+1 === len || (''+args[i+1]).charCodeAt(0) === 45 || args[++i]); + arr = (j === 2 ? [name] : name); + + for (idx=0; idx < arr.length; idx++) { + name = arr[idx]; + if (strict && !~keys.indexOf(name)) return opts.unknown('-'.repeat(j) + name); + toVal(out, name, (idx + 1 < arr.length) || val, opts); + } + } + } + + if (defaults) { + for (k in opts.default) { + if (out[k] === void 0) { + out[k] = opts.default[k]; + } + } + } + + if (alibi) { + for (k in out) { + arr = opts.alias[k] || []; + while (arr.length > 0) { + out[arr.shift()] = out[k]; + } + } + } + + return out; +} diff --git a/node_modules/mri/lib/index.mjs b/node_modules/mri/lib/index.mjs new file mode 100644 index 00000000..1a233e5b --- /dev/null +++ b/node_modules/mri/lib/index.mjs @@ -0,0 +1,119 @@ +function toArr(any) { + return any == null ? [] : Array.isArray(any) ? any : [any]; +} + +function toVal(out, key, val, opts) { + var x, old=out[key], nxt=( + !!~opts.string.indexOf(key) ? (val == null || val === true ? '' : String(val)) + : typeof val === 'boolean' ? val + : !!~opts.boolean.indexOf(key) ? (val === 'false' ? false : val === 'true' || (out._.push((x = +val,x * 0 === 0) ? x : val),!!val)) + : (x = +val,x * 0 === 0) ? x : val + ); + out[key] = old == null ? nxt : (Array.isArray(old) ? old.concat(nxt) : [old, nxt]); +} + +export default function (args, opts) { + args = args || []; + opts = opts || {}; + + var k, arr, arg, name, val, out={ _:[] }; + var i=0, j=0, idx=0, len=args.length; + + const alibi = opts.alias !== void 0; + const strict = opts.unknown !== void 0; + const defaults = opts.default !== void 0; + + opts.alias = opts.alias || {}; + opts.string = toArr(opts.string); + opts.boolean = toArr(opts.boolean); + + if (alibi) { + for (k in opts.alias) { + arr = opts.alias[k] = toArr(opts.alias[k]); + for (i=0; i < arr.length; i++) { + (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1); + } + } + } + + for (i=opts.boolean.length; i-- > 0;) { + arr = opts.alias[opts.boolean[i]] || []; + for (j=arr.length; j-- > 0;) opts.boolean.push(arr[j]); + } + + for (i=opts.string.length; i-- > 0;) { + arr = opts.alias[opts.string[i]] || []; + for (j=arr.length; j-- > 0;) opts.string.push(arr[j]); + } + + if (defaults) { + for (k in opts.default) { + name = typeof opts.default[k]; + arr = opts.alias[k] = opts.alias[k] || []; + if (opts[name] !== void 0) { + opts[name].push(k); + for (i=0; i < arr.length; i++) { + opts[name].push(arr[i]); + } + } + } + } + + const keys = strict ? Object.keys(opts.alias) : []; + + for (i=0; i < len; i++) { + arg = args[i]; + + if (arg === '--') { + out._ = out._.concat(args.slice(++i)); + break; + } + + for (j=0; j < arg.length; j++) { + if (arg.charCodeAt(j) !== 45) break; // "-" + } + + if (j === 0) { + out._.push(arg); + } else if (arg.substring(j, j + 3) === 'no-') { + name = arg.substring(j + 3); + if (strict && !~keys.indexOf(name)) { + return opts.unknown(arg); + } + out[name] = false; + } else { + for (idx=j+1; idx < arg.length; idx++) { + if (arg.charCodeAt(idx) === 61) break; // "=" + } + + name = arg.substring(j, idx); + val = arg.substring(++idx) || (i+1 === len || (''+args[i+1]).charCodeAt(0) === 45 || args[++i]); + arr = (j === 2 ? [name] : name); + + for (idx=0; idx < arr.length; idx++) { + name = arr[idx]; + if (strict && !~keys.indexOf(name)) return opts.unknown('-'.repeat(j) + name); + toVal(out, name, (idx + 1 < arr.length) || val, opts); + } + } + } + + if (defaults) { + for (k in opts.default) { + if (out[k] === void 0) { + out[k] = opts.default[k]; + } + } + } + + if (alibi) { + for (k in out) { + arr = opts.alias[k] || []; + while (arr.length > 0) { + out[arr.shift()] = out[k]; + } + } + } + + return out; +} diff --git a/node_modules/mri/license.md b/node_modules/mri/license.md new file mode 100644 index 00000000..a3f96f82 --- /dev/null +++ b/node_modules/mri/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Luke Edwards (lukeed.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/mri/package.json b/node_modules/mri/package.json new file mode 100644 index 00000000..5a224b26 --- /dev/null +++ b/node_modules/mri/package.json @@ -0,0 +1,43 @@ +{ + "name": "mri", + "version": "1.2.0", + "description": "Quickly scan for CLI flags and arguments", + "repository": "lukeed/mri", + "module": "lib/index.mjs", + "main": "lib/index.js", + "types": "index.d.ts", + "license": "MIT", + "files": [ + "*.d.ts", + "lib" + ], + "author": { + "name": "Luke Edwards", + "email": "luke.edwards05@gmail.com", + "url": "https://lukeed.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "build": "bundt", + "bench": "node bench", + "pretest": "npm run build", + "test": "tape test/*.js | tap-spec" + }, + "keywords": [ + "argv", + "arguments", + "cli", + "minimist", + "options", + "optimist", + "parser", + "args" + ], + "devDependencies": { + "bundt": "1.0.2", + "tap-spec": "4.1.2", + "tape": "4.13.3" + } +} diff --git a/node_modules/mri/readme.md b/node_modules/mri/readme.md new file mode 100644 index 00000000..9067e80e --- /dev/null +++ b/node_modules/mri/readme.md @@ -0,0 +1,166 @@ +# mri [![CI](https://github.com/lukeed/mri/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/lukeed/mri/actions) + +> Quickly scan for CLI flags and arguments + +This is a [fast](#benchmarks) and lightweight alternative to [`minimist`](https://github.com/substack/minimist) and [`yargs-parser`](https://github.com/yargs/yargs-parser). + +It only exists because I find that I usually don't need most of what `minimist` and `yargs-parser` have to offer. However, `mri` is similar _enough_ that it might function as a "drop-in replacement" for you, too! + +See [Comparisons](#comparisons) for more info. + +## Install + +```sh +$ npm install --save mri +``` + +## Usage + +```sh +$ demo-cli --foo --bar=baz -mtv -- hello world +``` + +```js +const mri = require('mri'); + +const argv = process.argv.slice(2); + +mri(argv); +//=> { _: ['hello', 'world'], foo:true, bar:'baz', m:true, t:true, v:true } + +mri(argv, { boolean:['bar'] }); +//=> { _: ['baz', 'hello', 'world'], foo:true, bar:true, m:true, t:true, v:true } + +mri(argv, { + alias: { + b: 'bar', + foo: ['f', 'fuz'] + } +}); +//=> { _: ['hello', 'world'], foo:true, f:true, fuz:true, b:'baz', bar:'baz', m:true, t:true, v:true } +``` + +## API + +### mri(args, options) +Return: `Object` + +#### args +Type: `Array`
+Default: `[]` + +An array of arguments to parse. For CLI usage, send `process.argv.slice(2)`. See [`process.argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) for info. + +#### options.alias +Type: `Object`
+Default: `{}` + +An object of keys whose values are `String`s or `Array` of aliases. These will be added to the parsed output with matching values. + +#### options.boolean +Type: `Array|String`
+Default: `[]` + +A single key (or array of keys) that should be parsed as `Boolean`s. + +#### options.default +Type: `Object`
+Default: `{}` + +An `key:value` object of defaults. If a default is provided for a key, its type (`typeof`) will be used to cast parsed arguments. + +```js +mri(['--foo', 'bar']); +//=> { _:[], foo:'bar' } + +mri(['--foo', 'bar'], { + default: { foo:true, baz:'hello', bat:42 } +}); +//=> { _:['bar'], foo:true, baz:'hello', bat:42 } +``` + +> **Note:** Because `--foo` has a default of `true`, its output is cast to a Boolean. This means that `foo=true`, making `'bar'` an extra argument (`_` key). + +#### options.string +Type: `Array|String`
+Default: `[]` + +A single key (or array of keys) that should be parsed as `String`s. + +#### options.unknown +Type: `Function`
+Default: `undefined` + +Callback that is run when a parsed flag has not been defined as a known key or alias. Its only parameter is the unknown flag itself; eg `--foobar` or `-f`. + +Once an unknown flag is encountered, parsing will terminate, regardless of your return value. + +> **Note:** `mri` _only_ checks for unknown flags if `options.unknown` **and** `options.alias` are populated. Otherwise, everything will be accepted. + + +## Comparisons + +#### minimist + +- `mri` is 5x faster (see [benchmarks](#benchmarks)) +- Numerical values are cast as `Number`s when possible + - A key (and its aliases) will always honor `opts.boolean` or `opts.string` +- Short flag groups are treated as `Boolean`s by default: + ```js + minimist(['-abc', 'hello']); + //=> { _:[], a:'', b:'', c:'hello' } + + mri(['-abc', 'hello']); + //=> { _:[], a:true, b:true, c:'hello' } + ``` +- The `opts.unknown` behaves differently: + - Unlike `minimist`, `mri` will not continue continue parsing after encountering an unknown flag +- Missing `options`: + - `opts.stopEarly` + - `opts['--']` +- Ignores newlines (`\n`) within args (see [test](https://github.com/substack/minimist/blob/master/test/parse.js#L69-L80)) +- Ignores slashBreaks within args (see [test](https://github.com/substack/minimist/blob/master/test/parse.js#L147-L157)) +- Ignores dot-nested flags (see [test](https://github.com/substack/minimist/blob/master/test/parse.js#L180-L197)) + +#### yargs-parser + +- `mri` is 40x faster (see [benchmarks](#benchmarks)) +- Numerical values are cast as `Number`s when possible + - A key (and its aliases) will always honor `opts.boolean` or `opts.string` +- Missing `options`: + - `opts.array` + - `opts.config` + - `opts.coerce` + - `opts.count` + - `opts.envPrefix` + - `opts.narg` + - `opts.normalize` + - `opts.configuration` + - `opts.number` + - `opts['--']` +- Missing [`parser.detailed()`](https://github.com/yargs/yargs-parser#requireyargs-parserdetailedargs-opts) method +- No [additional configuration](https://github.com/yargs/yargs-parser#configuration) object +- Added [`options.unknown`](#optionsunknown) feature + + +## Benchmarks + +> Running Node.js v10.13.0 + +``` +Load Times: + nopt 3.179ms + yargs-parser 2.137ms + minimist 0.746ms + mri 0.517ms + +Benchmark: + minimist x 328,747 ops/sec ±1.09% (89 runs sampled) + mri x 1,622,801 ops/sec ±0.94% (92 runs sampled) + nopt x 888,223 ops/sec ±0.22% (92 runs sampled) + yargs-parser x 30,538 ops/sec ±0.81% (91 runs sampled) +``` + +## License + +MIT © [Luke Edwards](https://lukeed.com) diff --git a/node_modules/mrmime/index.d.ts b/node_modules/mrmime/index.d.ts new file mode 100644 index 00000000..1d9268fe --- /dev/null +++ b/node_modules/mrmime/index.d.ts @@ -0,0 +1,2 @@ +export const mimes: Record; +export function lookup(extension: string): string | undefined; diff --git a/node_modules/mrmime/index.js b/node_modules/mrmime/index.js new file mode 100644 index 00000000..197a33bd --- /dev/null +++ b/node_modules/mrmime/index.js @@ -0,0 +1,445 @@ +const mimes = { + "3g2": "video/3gpp2", + "3gp": "video/3gpp", + "3gpp": "video/3gpp", + "3mf": "model/3mf", + "aac": "audio/aac", + "ac": "application/pkix-attr-cert", + "adp": "audio/adpcm", + "adts": "audio/aac", + "ai": "application/postscript", + "aml": "application/automationml-aml+xml", + "amlx": "application/automationml-amlx+zip", + "amr": "audio/amr", + "apng": "image/apng", + "appcache": "text/cache-manifest", + "appinstaller": "application/appinstaller", + "appx": "application/appx", + "appxbundle": "application/appxbundle", + "asc": "application/pgp-keys", + "atom": "application/atom+xml", + "atomcat": "application/atomcat+xml", + "atomdeleted": "application/atomdeleted+xml", + "atomsvc": "application/atomsvc+xml", + "au": "audio/basic", + "avci": "image/avci", + "avcs": "image/avcs", + "avif": "image/avif", + "aw": "application/applixware", + "bdoc": "application/bdoc", + "bin": "application/octet-stream", + "bmp": "image/bmp", + "bpk": "application/octet-stream", + "btf": "image/prs.btif", + "btif": "image/prs.btif", + "buffer": "application/octet-stream", + "ccxml": "application/ccxml+xml", + "cdfx": "application/cdfx+xml", + "cdmia": "application/cdmi-capability", + "cdmic": "application/cdmi-container", + "cdmid": "application/cdmi-domain", + "cdmio": "application/cdmi-object", + "cdmiq": "application/cdmi-queue", + "cer": "application/pkix-cert", + "cgm": "image/cgm", + "cjs": "application/node", + "class": "application/java-vm", + "coffee": "text/coffeescript", + "conf": "text/plain", + "cpl": "application/cpl+xml", + "cpt": "application/mac-compactpro", + "crl": "application/pkix-crl", + "css": "text/css", + "csv": "text/csv", + "cu": "application/cu-seeme", + "cwl": "application/cwl", + "cww": "application/prs.cww", + "davmount": "application/davmount+xml", + "dbk": "application/docbook+xml", + "deb": "application/octet-stream", + "def": "text/plain", + "deploy": "application/octet-stream", + "dib": "image/bmp", + "disposition-notification": "message/disposition-notification", + "dist": "application/octet-stream", + "distz": "application/octet-stream", + "dll": "application/octet-stream", + "dmg": "application/octet-stream", + "dms": "application/octet-stream", + "doc": "application/msword", + "dot": "application/msword", + "dpx": "image/dpx", + "drle": "image/dicom-rle", + "dsc": "text/prs.lines.tag", + "dssc": "application/dssc+der", + "dtd": "application/xml-dtd", + "dump": "application/octet-stream", + "dwd": "application/atsc-dwd+xml", + "ear": "application/java-archive", + "ecma": "application/ecmascript", + "elc": "application/octet-stream", + "emf": "image/emf", + "eml": "message/rfc822", + "emma": "application/emma+xml", + "emotionml": "application/emotionml+xml", + "eps": "application/postscript", + "epub": "application/epub+zip", + "exe": "application/octet-stream", + "exi": "application/exi", + "exp": "application/express", + "exr": "image/aces", + "ez": "application/andrew-inset", + "fdf": "application/fdf", + "fdt": "application/fdt+xml", + "fits": "image/fits", + "g3": "image/g3fax", + "gbr": "application/rpki-ghostbusters", + "geojson": "application/geo+json", + "gif": "image/gif", + "glb": "model/gltf-binary", + "gltf": "model/gltf+json", + "gml": "application/gml+xml", + "gpx": "application/gpx+xml", + "gram": "application/srgs", + "grxml": "application/srgs+xml", + "gxf": "application/gxf", + "gz": "application/gzip", + "h261": "video/h261", + "h263": "video/h263", + "h264": "video/h264", + "heic": "image/heic", + "heics": "image/heic-sequence", + "heif": "image/heif", + "heifs": "image/heif-sequence", + "hej2": "image/hej2k", + "held": "application/atsc-held+xml", + "hjson": "application/hjson", + "hlp": "application/winhlp", + "hqx": "application/mac-binhex40", + "hsj2": "image/hsj2", + "htm": "text/html", + "html": "text/html", + "ics": "text/calendar", + "ief": "image/ief", + "ifb": "text/calendar", + "iges": "model/iges", + "igs": "model/iges", + "img": "application/octet-stream", + "in": "text/plain", + "ini": "text/plain", + "ink": "application/inkml+xml", + "inkml": "application/inkml+xml", + "ipfix": "application/ipfix", + "iso": "application/octet-stream", + "its": "application/its+xml", + "jade": "text/jade", + "jar": "application/java-archive", + "jhc": "image/jphc", + "jls": "image/jls", + "jp2": "image/jp2", + "jpe": "image/jpeg", + "jpeg": "image/jpeg", + "jpf": "image/jpx", + "jpg": "image/jpeg", + "jpg2": "image/jp2", + "jpgm": "image/jpm", + "jpgv": "video/jpeg", + "jph": "image/jph", + "jpm": "image/jpm", + "jpx": "image/jpx", + "js": "text/javascript", + "json": "application/json", + "json5": "application/json5", + "jsonld": "application/ld+json", + "jsonml": "application/jsonml+json", + "jsx": "text/jsx", + "jt": "model/jt", + "jxr": "image/jxr", + "jxra": "image/jxra", + "jxrs": "image/jxrs", + "jxs": "image/jxs", + "jxsc": "image/jxsc", + "jxsi": "image/jxsi", + "jxss": "image/jxss", + "kar": "audio/midi", + "ktx": "image/ktx", + "ktx2": "image/ktx2", + "less": "text/less", + "lgr": "application/lgr+xml", + "list": "text/plain", + "litcoffee": "text/coffeescript", + "log": "text/plain", + "lostxml": "application/lost+xml", + "lrf": "application/octet-stream", + "m1v": "video/mpeg", + "m21": "application/mp21", + "m2a": "audio/mpeg", + "m2v": "video/mpeg", + "m3a": "audio/mpeg", + "m4a": "audio/mp4", + "m4p": "application/mp4", + "m4s": "video/iso.segment", + "ma": "application/mathematica", + "mads": "application/mads+xml", + "maei": "application/mmt-aei+xml", + "man": "text/troff", + "manifest": "text/cache-manifest", + "map": "application/json", + "mar": "application/octet-stream", + "markdown": "text/markdown", + "mathml": "application/mathml+xml", + "mb": "application/mathematica", + "mbox": "application/mbox", + "md": "text/markdown", + "mdx": "text/mdx", + "me": "text/troff", + "mesh": "model/mesh", + "meta4": "application/metalink4+xml", + "metalink": "application/metalink+xml", + "mets": "application/mets+xml", + "mft": "application/rpki-manifest", + "mid": "audio/midi", + "midi": "audio/midi", + "mime": "message/rfc822", + "mj2": "video/mj2", + "mjp2": "video/mj2", + "mjs": "text/javascript", + "mml": "text/mathml", + "mods": "application/mods+xml", + "mov": "video/quicktime", + "mp2": "audio/mpeg", + "mp21": "application/mp21", + "mp2a": "audio/mpeg", + "mp3": "audio/mpeg", + "mp4": "video/mp4", + "mp4a": "audio/mp4", + "mp4s": "application/mp4", + "mp4v": "video/mp4", + "mpd": "application/dash+xml", + "mpe": "video/mpeg", + "mpeg": "video/mpeg", + "mpf": "application/media-policy-dataset+xml", + "mpg": "video/mpeg", + "mpg4": "video/mp4", + "mpga": "audio/mpeg", + "mpp": "application/dash-patch+xml", + "mrc": "application/marc", + "mrcx": "application/marcxml+xml", + "ms": "text/troff", + "mscml": "application/mediaservercontrol+xml", + "msh": "model/mesh", + "msi": "application/octet-stream", + "msix": "application/msix", + "msixbundle": "application/msixbundle", + "msm": "application/octet-stream", + "msp": "application/octet-stream", + "mtl": "model/mtl", + "musd": "application/mmt-usd+xml", + "mxf": "application/mxf", + "mxmf": "audio/mobile-xmf", + "mxml": "application/xv+xml", + "n3": "text/n3", + "nb": "application/mathematica", + "nq": "application/n-quads", + "nt": "application/n-triples", + "obj": "model/obj", + "oda": "application/oda", + "oga": "audio/ogg", + "ogg": "audio/ogg", + "ogv": "video/ogg", + "ogx": "application/ogg", + "omdoc": "application/omdoc+xml", + "onepkg": "application/onenote", + "onetmp": "application/onenote", + "onetoc": "application/onenote", + "onetoc2": "application/onenote", + "opf": "application/oebps-package+xml", + "opus": "audio/ogg", + "otf": "font/otf", + "owl": "application/rdf+xml", + "oxps": "application/oxps", + "p10": "application/pkcs10", + "p7c": "application/pkcs7-mime", + "p7m": "application/pkcs7-mime", + "p7s": "application/pkcs7-signature", + "p8": "application/pkcs8", + "pdf": "application/pdf", + "pfr": "application/font-tdpfr", + "pgp": "application/pgp-encrypted", + "pkg": "application/octet-stream", + "pki": "application/pkixcmp", + "pkipath": "application/pkix-pkipath", + "pls": "application/pls+xml", + "png": "image/png", + "prc": "model/prc", + "prf": "application/pics-rules", + "provx": "application/provenance+xml", + "ps": "application/postscript", + "pskcxml": "application/pskc+xml", + "pti": "image/prs.pti", + "qt": "video/quicktime", + "raml": "application/raml+yaml", + "rapd": "application/route-apd+xml", + "rdf": "application/rdf+xml", + "relo": "application/p2p-overlay+xml", + "rif": "application/reginfo+xml", + "rl": "application/resource-lists+xml", + "rld": "application/resource-lists-diff+xml", + "rmi": "audio/midi", + "rnc": "application/relax-ng-compact-syntax", + "rng": "application/xml", + "roa": "application/rpki-roa", + "roff": "text/troff", + "rq": "application/sparql-query", + "rs": "application/rls-services+xml", + "rsat": "application/atsc-rsat+xml", + "rsd": "application/rsd+xml", + "rsheet": "application/urc-ressheet+xml", + "rss": "application/rss+xml", + "rtf": "text/rtf", + "rtx": "text/richtext", + "rusd": "application/route-usd+xml", + "s3m": "audio/s3m", + "sbml": "application/sbml+xml", + "scq": "application/scvp-cv-request", + "scs": "application/scvp-cv-response", + "sdp": "application/sdp", + "senmlx": "application/senml+xml", + "sensmlx": "application/sensml+xml", + "ser": "application/java-serialized-object", + "setpay": "application/set-payment-initiation", + "setreg": "application/set-registration-initiation", + "sgi": "image/sgi", + "sgm": "text/sgml", + "sgml": "text/sgml", + "shex": "text/shex", + "shf": "application/shf+xml", + "shtml": "text/html", + "sieve": "application/sieve", + "sig": "application/pgp-signature", + "sil": "audio/silk", + "silo": "model/mesh", + "siv": "application/sieve", + "slim": "text/slim", + "slm": "text/slim", + "sls": "application/route-s-tsid+xml", + "smi": "application/smil+xml", + "smil": "application/smil+xml", + "snd": "audio/basic", + "so": "application/octet-stream", + "spdx": "text/spdx", + "spp": "application/scvp-vp-response", + "spq": "application/scvp-vp-request", + "spx": "audio/ogg", + "sql": "application/sql", + "sru": "application/sru+xml", + "srx": "application/sparql-results+xml", + "ssdl": "application/ssdl+xml", + "ssml": "application/ssml+xml", + "stk": "application/hyperstudio", + "stl": "model/stl", + "stpx": "model/step+xml", + "stpxz": "model/step-xml+zip", + "stpz": "model/step+zip", + "styl": "text/stylus", + "stylus": "text/stylus", + "svg": "image/svg+xml", + "svgz": "image/svg+xml", + "swidtag": "application/swid+xml", + "t": "text/troff", + "t38": "image/t38", + "td": "application/urc-targetdesc+xml", + "tei": "application/tei+xml", + "teicorpus": "application/tei+xml", + "text": "text/plain", + "tfi": "application/thraud+xml", + "tfx": "image/tiff-fx", + "tif": "image/tiff", + "tiff": "image/tiff", + "toml": "application/toml", + "tr": "text/troff", + "trig": "application/trig", + "ts": "video/mp2t", + "tsd": "application/timestamped-data", + "tsv": "text/tab-separated-values", + "ttc": "font/collection", + "ttf": "font/ttf", + "ttl": "text/turtle", + "ttml": "application/ttml+xml", + "txt": "text/plain", + "u3d": "model/u3d", + "u8dsn": "message/global-delivery-status", + "u8hdr": "message/global-headers", + "u8mdn": "message/global-disposition-notification", + "u8msg": "message/global", + "ubj": "application/ubjson", + "uri": "text/uri-list", + "uris": "text/uri-list", + "urls": "text/uri-list", + "vcard": "text/vcard", + "vrml": "model/vrml", + "vtt": "text/vtt", + "vxml": "application/voicexml+xml", + "war": "application/java-archive", + "wasm": "application/wasm", + "wav": "audio/wav", + "weba": "audio/webm", + "webm": "video/webm", + "webmanifest": "application/manifest+json", + "webp": "image/webp", + "wgsl": "text/wgsl", + "wgt": "application/widget", + "wif": "application/watcherinfo+xml", + "wmf": "image/wmf", + "woff": "font/woff", + "woff2": "font/woff2", + "wrl": "model/vrml", + "wsdl": "application/wsdl+xml", + "wspolicy": "application/wspolicy+xml", + "x3d": "model/x3d+xml", + "x3db": "model/x3d+fastinfoset", + "x3dbz": "model/x3d+binary", + "x3dv": "model/x3d-vrml", + "x3dvz": "model/x3d+vrml", + "x3dz": "model/x3d+xml", + "xaml": "application/xaml+xml", + "xav": "application/xcap-att+xml", + "xca": "application/xcap-caps+xml", + "xcs": "application/calendar+xml", + "xdf": "application/xcap-diff+xml", + "xdssc": "application/dssc+xml", + "xel": "application/xcap-el+xml", + "xenc": "application/xenc+xml", + "xer": "application/patch-ops-error+xml", + "xfdf": "application/xfdf", + "xht": "application/xhtml+xml", + "xhtml": "application/xhtml+xml", + "xhvml": "application/xv+xml", + "xlf": "application/xliff+xml", + "xm": "audio/xm", + "xml": "text/xml", + "xns": "application/xcap-ns+xml", + "xop": "application/xop+xml", + "xpl": "application/xproc+xml", + "xsd": "application/xml", + "xsf": "application/prs.xsf+xml", + "xsl": "application/xml", + "xslt": "application/xml", + "xspf": "application/xspf+xml", + "xvm": "application/xv+xml", + "xvml": "application/xv+xml", + "yaml": "text/yaml", + "yang": "application/yang", + "yin": "application/yin+xml", + "yml": "text/yaml", + "zip": "application/zip" +}; + +function lookup(extn) { + let tmp = ('' + extn).trim().toLowerCase(); + let idx = tmp.lastIndexOf('.'); + return mimes[!~idx ? tmp : tmp.substring(++idx)]; +} + +exports.mimes = mimes; +exports.lookup = lookup; diff --git a/node_modules/mrmime/index.mjs b/node_modules/mrmime/index.mjs new file mode 100644 index 00000000..5c42c4f0 --- /dev/null +++ b/node_modules/mrmime/index.mjs @@ -0,0 +1,444 @@ +const mimes = { + "3g2": "video/3gpp2", + "3gp": "video/3gpp", + "3gpp": "video/3gpp", + "3mf": "model/3mf", + "aac": "audio/aac", + "ac": "application/pkix-attr-cert", + "adp": "audio/adpcm", + "adts": "audio/aac", + "ai": "application/postscript", + "aml": "application/automationml-aml+xml", + "amlx": "application/automationml-amlx+zip", + "amr": "audio/amr", + "apng": "image/apng", + "appcache": "text/cache-manifest", + "appinstaller": "application/appinstaller", + "appx": "application/appx", + "appxbundle": "application/appxbundle", + "asc": "application/pgp-keys", + "atom": "application/atom+xml", + "atomcat": "application/atomcat+xml", + "atomdeleted": "application/atomdeleted+xml", + "atomsvc": "application/atomsvc+xml", + "au": "audio/basic", + "avci": "image/avci", + "avcs": "image/avcs", + "avif": "image/avif", + "aw": "application/applixware", + "bdoc": "application/bdoc", + "bin": "application/octet-stream", + "bmp": "image/bmp", + "bpk": "application/octet-stream", + "btf": "image/prs.btif", + "btif": "image/prs.btif", + "buffer": "application/octet-stream", + "ccxml": "application/ccxml+xml", + "cdfx": "application/cdfx+xml", + "cdmia": "application/cdmi-capability", + "cdmic": "application/cdmi-container", + "cdmid": "application/cdmi-domain", + "cdmio": "application/cdmi-object", + "cdmiq": "application/cdmi-queue", + "cer": "application/pkix-cert", + "cgm": "image/cgm", + "cjs": "application/node", + "class": "application/java-vm", + "coffee": "text/coffeescript", + "conf": "text/plain", + "cpl": "application/cpl+xml", + "cpt": "application/mac-compactpro", + "crl": "application/pkix-crl", + "css": "text/css", + "csv": "text/csv", + "cu": "application/cu-seeme", + "cwl": "application/cwl", + "cww": "application/prs.cww", + "davmount": "application/davmount+xml", + "dbk": "application/docbook+xml", + "deb": "application/octet-stream", + "def": "text/plain", + "deploy": "application/octet-stream", + "dib": "image/bmp", + "disposition-notification": "message/disposition-notification", + "dist": "application/octet-stream", + "distz": "application/octet-stream", + "dll": "application/octet-stream", + "dmg": "application/octet-stream", + "dms": "application/octet-stream", + "doc": "application/msword", + "dot": "application/msword", + "dpx": "image/dpx", + "drle": "image/dicom-rle", + "dsc": "text/prs.lines.tag", + "dssc": "application/dssc+der", + "dtd": "application/xml-dtd", + "dump": "application/octet-stream", + "dwd": "application/atsc-dwd+xml", + "ear": "application/java-archive", + "ecma": "application/ecmascript", + "elc": "application/octet-stream", + "emf": "image/emf", + "eml": "message/rfc822", + "emma": "application/emma+xml", + "emotionml": "application/emotionml+xml", + "eps": "application/postscript", + "epub": "application/epub+zip", + "exe": "application/octet-stream", + "exi": "application/exi", + "exp": "application/express", + "exr": "image/aces", + "ez": "application/andrew-inset", + "fdf": "application/fdf", + "fdt": "application/fdt+xml", + "fits": "image/fits", + "g3": "image/g3fax", + "gbr": "application/rpki-ghostbusters", + "geojson": "application/geo+json", + "gif": "image/gif", + "glb": "model/gltf-binary", + "gltf": "model/gltf+json", + "gml": "application/gml+xml", + "gpx": "application/gpx+xml", + "gram": "application/srgs", + "grxml": "application/srgs+xml", + "gxf": "application/gxf", + "gz": "application/gzip", + "h261": "video/h261", + "h263": "video/h263", + "h264": "video/h264", + "heic": "image/heic", + "heics": "image/heic-sequence", + "heif": "image/heif", + "heifs": "image/heif-sequence", + "hej2": "image/hej2k", + "held": "application/atsc-held+xml", + "hjson": "application/hjson", + "hlp": "application/winhlp", + "hqx": "application/mac-binhex40", + "hsj2": "image/hsj2", + "htm": "text/html", + "html": "text/html", + "ics": "text/calendar", + "ief": "image/ief", + "ifb": "text/calendar", + "iges": "model/iges", + "igs": "model/iges", + "img": "application/octet-stream", + "in": "text/plain", + "ini": "text/plain", + "ink": "application/inkml+xml", + "inkml": "application/inkml+xml", + "ipfix": "application/ipfix", + "iso": "application/octet-stream", + "its": "application/its+xml", + "jade": "text/jade", + "jar": "application/java-archive", + "jhc": "image/jphc", + "jls": "image/jls", + "jp2": "image/jp2", + "jpe": "image/jpeg", + "jpeg": "image/jpeg", + "jpf": "image/jpx", + "jpg": "image/jpeg", + "jpg2": "image/jp2", + "jpgm": "image/jpm", + "jpgv": "video/jpeg", + "jph": "image/jph", + "jpm": "image/jpm", + "jpx": "image/jpx", + "js": "text/javascript", + "json": "application/json", + "json5": "application/json5", + "jsonld": "application/ld+json", + "jsonml": "application/jsonml+json", + "jsx": "text/jsx", + "jt": "model/jt", + "jxr": "image/jxr", + "jxra": "image/jxra", + "jxrs": "image/jxrs", + "jxs": "image/jxs", + "jxsc": "image/jxsc", + "jxsi": "image/jxsi", + "jxss": "image/jxss", + "kar": "audio/midi", + "ktx": "image/ktx", + "ktx2": "image/ktx2", + "less": "text/less", + "lgr": "application/lgr+xml", + "list": "text/plain", + "litcoffee": "text/coffeescript", + "log": "text/plain", + "lostxml": "application/lost+xml", + "lrf": "application/octet-stream", + "m1v": "video/mpeg", + "m21": "application/mp21", + "m2a": "audio/mpeg", + "m2v": "video/mpeg", + "m3a": "audio/mpeg", + "m4a": "audio/mp4", + "m4p": "application/mp4", + "m4s": "video/iso.segment", + "ma": "application/mathematica", + "mads": "application/mads+xml", + "maei": "application/mmt-aei+xml", + "man": "text/troff", + "manifest": "text/cache-manifest", + "map": "application/json", + "mar": "application/octet-stream", + "markdown": "text/markdown", + "mathml": "application/mathml+xml", + "mb": "application/mathematica", + "mbox": "application/mbox", + "md": "text/markdown", + "mdx": "text/mdx", + "me": "text/troff", + "mesh": "model/mesh", + "meta4": "application/metalink4+xml", + "metalink": "application/metalink+xml", + "mets": "application/mets+xml", + "mft": "application/rpki-manifest", + "mid": "audio/midi", + "midi": "audio/midi", + "mime": "message/rfc822", + "mj2": "video/mj2", + "mjp2": "video/mj2", + "mjs": "text/javascript", + "mml": "text/mathml", + "mods": "application/mods+xml", + "mov": "video/quicktime", + "mp2": "audio/mpeg", + "mp21": "application/mp21", + "mp2a": "audio/mpeg", + "mp3": "audio/mpeg", + "mp4": "video/mp4", + "mp4a": "audio/mp4", + "mp4s": "application/mp4", + "mp4v": "video/mp4", + "mpd": "application/dash+xml", + "mpe": "video/mpeg", + "mpeg": "video/mpeg", + "mpf": "application/media-policy-dataset+xml", + "mpg": "video/mpeg", + "mpg4": "video/mp4", + "mpga": "audio/mpeg", + "mpp": "application/dash-patch+xml", + "mrc": "application/marc", + "mrcx": "application/marcxml+xml", + "ms": "text/troff", + "mscml": "application/mediaservercontrol+xml", + "msh": "model/mesh", + "msi": "application/octet-stream", + "msix": "application/msix", + "msixbundle": "application/msixbundle", + "msm": "application/octet-stream", + "msp": "application/octet-stream", + "mtl": "model/mtl", + "musd": "application/mmt-usd+xml", + "mxf": "application/mxf", + "mxmf": "audio/mobile-xmf", + "mxml": "application/xv+xml", + "n3": "text/n3", + "nb": "application/mathematica", + "nq": "application/n-quads", + "nt": "application/n-triples", + "obj": "model/obj", + "oda": "application/oda", + "oga": "audio/ogg", + "ogg": "audio/ogg", + "ogv": "video/ogg", + "ogx": "application/ogg", + "omdoc": "application/omdoc+xml", + "onepkg": "application/onenote", + "onetmp": "application/onenote", + "onetoc": "application/onenote", + "onetoc2": "application/onenote", + "opf": "application/oebps-package+xml", + "opus": "audio/ogg", + "otf": "font/otf", + "owl": "application/rdf+xml", + "oxps": "application/oxps", + "p10": "application/pkcs10", + "p7c": "application/pkcs7-mime", + "p7m": "application/pkcs7-mime", + "p7s": "application/pkcs7-signature", + "p8": "application/pkcs8", + "pdf": "application/pdf", + "pfr": "application/font-tdpfr", + "pgp": "application/pgp-encrypted", + "pkg": "application/octet-stream", + "pki": "application/pkixcmp", + "pkipath": "application/pkix-pkipath", + "pls": "application/pls+xml", + "png": "image/png", + "prc": "model/prc", + "prf": "application/pics-rules", + "provx": "application/provenance+xml", + "ps": "application/postscript", + "pskcxml": "application/pskc+xml", + "pti": "image/prs.pti", + "qt": "video/quicktime", + "raml": "application/raml+yaml", + "rapd": "application/route-apd+xml", + "rdf": "application/rdf+xml", + "relo": "application/p2p-overlay+xml", + "rif": "application/reginfo+xml", + "rl": "application/resource-lists+xml", + "rld": "application/resource-lists-diff+xml", + "rmi": "audio/midi", + "rnc": "application/relax-ng-compact-syntax", + "rng": "application/xml", + "roa": "application/rpki-roa", + "roff": "text/troff", + "rq": "application/sparql-query", + "rs": "application/rls-services+xml", + "rsat": "application/atsc-rsat+xml", + "rsd": "application/rsd+xml", + "rsheet": "application/urc-ressheet+xml", + "rss": "application/rss+xml", + "rtf": "text/rtf", + "rtx": "text/richtext", + "rusd": "application/route-usd+xml", + "s3m": "audio/s3m", + "sbml": "application/sbml+xml", + "scq": "application/scvp-cv-request", + "scs": "application/scvp-cv-response", + "sdp": "application/sdp", + "senmlx": "application/senml+xml", + "sensmlx": "application/sensml+xml", + "ser": "application/java-serialized-object", + "setpay": "application/set-payment-initiation", + "setreg": "application/set-registration-initiation", + "sgi": "image/sgi", + "sgm": "text/sgml", + "sgml": "text/sgml", + "shex": "text/shex", + "shf": "application/shf+xml", + "shtml": "text/html", + "sieve": "application/sieve", + "sig": "application/pgp-signature", + "sil": "audio/silk", + "silo": "model/mesh", + "siv": "application/sieve", + "slim": "text/slim", + "slm": "text/slim", + "sls": "application/route-s-tsid+xml", + "smi": "application/smil+xml", + "smil": "application/smil+xml", + "snd": "audio/basic", + "so": "application/octet-stream", + "spdx": "text/spdx", + "spp": "application/scvp-vp-response", + "spq": "application/scvp-vp-request", + "spx": "audio/ogg", + "sql": "application/sql", + "sru": "application/sru+xml", + "srx": "application/sparql-results+xml", + "ssdl": "application/ssdl+xml", + "ssml": "application/ssml+xml", + "stk": "application/hyperstudio", + "stl": "model/stl", + "stpx": "model/step+xml", + "stpxz": "model/step-xml+zip", + "stpz": "model/step+zip", + "styl": "text/stylus", + "stylus": "text/stylus", + "svg": "image/svg+xml", + "svgz": "image/svg+xml", + "swidtag": "application/swid+xml", + "t": "text/troff", + "t38": "image/t38", + "td": "application/urc-targetdesc+xml", + "tei": "application/tei+xml", + "teicorpus": "application/tei+xml", + "text": "text/plain", + "tfi": "application/thraud+xml", + "tfx": "image/tiff-fx", + "tif": "image/tiff", + "tiff": "image/tiff", + "toml": "application/toml", + "tr": "text/troff", + "trig": "application/trig", + "ts": "video/mp2t", + "tsd": "application/timestamped-data", + "tsv": "text/tab-separated-values", + "ttc": "font/collection", + "ttf": "font/ttf", + "ttl": "text/turtle", + "ttml": "application/ttml+xml", + "txt": "text/plain", + "u3d": "model/u3d", + "u8dsn": "message/global-delivery-status", + "u8hdr": "message/global-headers", + "u8mdn": "message/global-disposition-notification", + "u8msg": "message/global", + "ubj": "application/ubjson", + "uri": "text/uri-list", + "uris": "text/uri-list", + "urls": "text/uri-list", + "vcard": "text/vcard", + "vrml": "model/vrml", + "vtt": "text/vtt", + "vxml": "application/voicexml+xml", + "war": "application/java-archive", + "wasm": "application/wasm", + "wav": "audio/wav", + "weba": "audio/webm", + "webm": "video/webm", + "webmanifest": "application/manifest+json", + "webp": "image/webp", + "wgsl": "text/wgsl", + "wgt": "application/widget", + "wif": "application/watcherinfo+xml", + "wmf": "image/wmf", + "woff": "font/woff", + "woff2": "font/woff2", + "wrl": "model/vrml", + "wsdl": "application/wsdl+xml", + "wspolicy": "application/wspolicy+xml", + "x3d": "model/x3d+xml", + "x3db": "model/x3d+fastinfoset", + "x3dbz": "model/x3d+binary", + "x3dv": "model/x3d-vrml", + "x3dvz": "model/x3d+vrml", + "x3dz": "model/x3d+xml", + "xaml": "application/xaml+xml", + "xav": "application/xcap-att+xml", + "xca": "application/xcap-caps+xml", + "xcs": "application/calendar+xml", + "xdf": "application/xcap-diff+xml", + "xdssc": "application/dssc+xml", + "xel": "application/xcap-el+xml", + "xenc": "application/xenc+xml", + "xer": "application/patch-ops-error+xml", + "xfdf": "application/xfdf", + "xht": "application/xhtml+xml", + "xhtml": "application/xhtml+xml", + "xhvml": "application/xv+xml", + "xlf": "application/xliff+xml", + "xm": "audio/xm", + "xml": "text/xml", + "xns": "application/xcap-ns+xml", + "xop": "application/xop+xml", + "xpl": "application/xproc+xml", + "xsd": "application/xml", + "xsf": "application/prs.xsf+xml", + "xsl": "application/xml", + "xslt": "application/xml", + "xspf": "application/xspf+xml", + "xvm": "application/xv+xml", + "xvml": "application/xv+xml", + "yaml": "text/yaml", + "yang": "application/yang", + "yin": "application/yin+xml", + "yml": "text/yaml", + "zip": "application/zip" +}; + +function lookup(extn) { + let tmp = ('' + extn).trim().toLowerCase(); + let idx = tmp.lastIndexOf('.'); + return mimes[!~idx ? tmp : tmp.substring(++idx)]; +} + +export { mimes, lookup }; diff --git a/node_modules/mrmime/license b/node_modules/mrmime/license new file mode 100644 index 00000000..d46889ae --- /dev/null +++ b/node_modules/mrmime/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Luke Edwards (https://lukeed.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/mrmime/package.json b/node_modules/mrmime/package.json new file mode 100644 index 00000000..6ec2d233 --- /dev/null +++ b/node_modules/mrmime/package.json @@ -0,0 +1,44 @@ +{ + "name": "mrmime", + "version": "2.0.0", + "repository": "lukeed/mrmime", + "description": "A tiny (2.8kB) and fast utility for getting a MIME type from an extension or filename", + "module": "index.mjs", + "types": "index.d.ts", + "main": "index.js", + "license": "MIT", + "author": { + "name": "Luke Edwards", + "email": "luke.edwards05@gmail.com", + "url": "https://lukeed.com" + }, + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "require": "./index.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "index.d.ts", + "index.mjs", + "index.js" + ], + "engines": { + "node": ">=10" + }, + "scripts": { + "build": "tsm bin/index.ts", + "test": "uvu -r tsm test" + }, + "keywords": [ + "mime", + "extension", + "mimetype" + ], + "devDependencies": { + "tsm": "2.3.0", + "uvu": "0.5.2" + } +} diff --git a/node_modules/mrmime/readme.md b/node_modules/mrmime/readme.md new file mode 100644 index 00000000..3c3ab1b7 --- /dev/null +++ b/node_modules/mrmime/readme.md @@ -0,0 +1,127 @@ +
+ mrmime +
+ + + +
+ A tiny (2.8kB) and fast utility for getting a MIME type from an extension or filename +
+ + +## Features + +* Lightweight – 2.8kB gzip
+ _Only includes standard mime types; all experimental and vendor-specific mimetypes removed._ + +* [Performant](#benchmarks)
+ _All lookups are O(1) with minimal processing._ + +* Comprehensive Dictionary
+ _Generated from [`mime-db`](https://github.com/jshttp/mime-db), which aggregates the IANA, NGINX, and Apache datasets._ + +* Customizable
+ _Exposes the `mimes` dictionary for easy additions or overrides._ + +* Supports Native ESM and [Deno](https://deno.land/x/mrmime)
+ _Ships with CommonJS and ESM support!_ + + +## Install + +``` +$ npm install --save mrmime +``` + + +## Usage + +```js +import { lookup, mimes } from 'mrmime'; + +// Get a MIME type +// --- +lookup('txt'); //=> "text/plain" +lookup('.txt'); //=> "text/plain" +lookup('a.txt'); //=> "text/plain" + +// Unknown extension +// --- +lookup('.xyz'); //=> undefined + +// Add extension to dictionary +// --- +mimes['xyz'] = 'hello/world'; +lookup('xyz'); //=> "hello/world" +``` + + +## API + +### lookup(input) +Returns: `string` or `undefined` + +#### input +Type: `string` + +The extension or filename to lookup. + +> **Important:** +> * Any `input` value is cast to string, lowercased, and trimmed. +> * If a filename or filepath is provided, only the extension will be used. + + +## Benchmarks + +> Running on Node v16.8.0 + +``` +Load times: + mrmime 0.963ms + mime/lite 3.281ms + mime 6.751ms + +Benchmark :: plain ("ext") + mime x 598,849 ops/sec ±0.28% (94 runs sampled) + mime/lite x 536,643 ops/sec ±0.11% (97 runs sampled) + mrmime x 835,885 ops/sec ±0.20% (97 runs sampled) + +Benchmark :: leading (".ext") + mime x 368,656 ops/sec ±0.19% (99 runs sampled) + mime/lite x 368,318 ops/sec ±0.13% (97 runs sampled) + mrmime x 533,643 ops/sec ±0.10% (96 runs sampled) + +Benchmark :: filename ("file.ext") + mime x 326,907 ops/sec ±0.17% (95 runs sampled) + mime/lite x 327,479 ops/sec ±0.12% (98 runs sampled) + mrmime x 512,823 ops/sec ±0.12% (99 runs sampled) +``` + + +## Credits + +Of course, a thank-you to [`mime`](https://github.com/broofa/mime) serving the community all these years & for being a all-encompassing MIME type library. I've only ever needed lookup/`getType` functionality – and now ESM support – so `mrmime` can only ever support 1/3 of what `mime` offers, at best. + +This would not be possible without the team behind [`mime-db`](https://github.com/jshttp/mime-db), who have painstakingly maintained an amazing database for 7+ years. + +Artwork created by [mintinol](https://www.deviantart.com/mintinol), which I found [here](https://www.deviantart.com/mintinol/art/Mr-Mime-373927920). + +Finally, thanks to [Tim Branyen](https://github.com/tbranyen) for donating the package name :) + + +## License + +MIT © [Luke Edwards](https://lukeed.com) diff --git a/node_modules/ms/index.js b/node_modules/ms/index.js new file mode 100644 index 00000000..ea734fb7 --- /dev/null +++ b/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function (val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/ms/license.md b/node_modules/ms/license.md new file mode 100644 index 00000000..fa5d39b6 --- /dev/null +++ b/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Vercel, 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/ms/package.json b/node_modules/ms/package.json new file mode 100644 index 00000000..49971890 --- /dev/null +++ b/node_modules/ms/package.json @@ -0,0 +1,38 @@ +{ + "name": "ms", + "version": "2.1.3", + "description": "Tiny millisecond conversion utility", + "repository": "vercel/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.18.2", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1", + "prettier": "2.0.5" + } +} diff --git a/node_modules/ms/readme.md b/node_modules/ms/readme.md new file mode 100644 index 00000000..0fc1abb3 --- /dev/null +++ b/node_modules/ms/readme.md @@ -0,0 +1,59 @@ +# ms + +![CI](https://github.com/vercel/ms/workflows/CI/badge.svg) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/node_modules/mz/HISTORY.md b/node_modules/mz/HISTORY.md new file mode 100644 index 00000000..6ebee21d --- /dev/null +++ b/node_modules/mz/HISTORY.md @@ -0,0 +1,66 @@ + +2.7.0 / 2017-09-13 +================== + + * feat: support fs.copyFile (#58) + +2.6.0 / 2016-11-22 +================== + + * Added fdatasync to fs api (#46) + +2.5.0 / 2016-11-04 +================== + + * feat: support fs.mkdtemp + +2.4.0 / 2016-03-23 +================== + + * add `fs.truncate()` [#34](https://github.com/normalize/mz/pull/34) + +2.3.1 / 2016-02-01 +================== + + * update `any-promise@v1` + +2.3.0 / 2016-01-30 +================== + + * feat(package): switch to `any-promise` to support more promise engines + +2.2.0 / 2016-01-24 +================== + + * feat(package): add index.js to files + +2.1.0 / 2015-10-15 +================== + + * support for readline library + +2.0.0 / 2015-05-24 +================== + + * support callbacks as well + +1.2.0 / 2014-12-16 +================== + + * refactor promisification to `thenify` and `thenify-all` + +1.1.0 / 2014-11-14 +================== + + * use `graceful-fs` if available + +1.0.1 / 2014-08-18 +================== + + * don't use `bluebird.promisify()` - unnecessarily wraps runtime errors, causing issues + +1.0.0 / 2014-06-18 +================== + + * use `bluebird` by default if found + * support node 0.8 diff --git a/node_modules/mz/LICENSE b/node_modules/mz/LICENSE new file mode 100644 index 00000000..1835f3d9 --- /dev/null +++ b/node_modules/mz/LICENSE @@ -0,0 +1,22 @@ + +The MIT License (MIT) + +Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and 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/mz/README.md b/node_modules/mz/README.md new file mode 100644 index 00000000..50d6557c --- /dev/null +++ b/node_modules/mz/README.md @@ -0,0 +1,106 @@ + +# MZ - Modernize node.js + +[![NPM version][npm-image]][npm-url] +[![Build status][travis-image]][travis-url] +[![Test coverage][coveralls-image]][coveralls-url] +[![Dependency Status][david-image]][david-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +Modernize node.js to current ECMAScript specifications! +node.js will not update their API to ES6+ [for a while](https://github.com/joyent/node/issues/7549). +This library is a wrapper for various aspects of node.js' API. + +## Installation and Usage + +Set `mz` as a dependency and install it. + +```bash +npm i mz +``` + +Then prefix the relevant `require()`s with `mz/`: + +```js +var fs = require('mz/fs') + +fs.exists(__filename).then(function (exists) { + if (exists) // do something +}) +``` + +With ES2017, this will allow you to use async functions cleanly with node's core API: + +```js +const fs = require('mz/fs') + + +async function doSomething () { + if (await fs.exists(__filename)) // do something +} +``` + +## Promisification + +Many node methods are converted into promises. +Any properties that are deprecated or aren't asynchronous will simply be proxied. +The modules wrapped are: + +- `child_process` +- `crypto` +- `dns` +- `fs` (uses `graceful-fs` if available) +- `readline` +- `zlib` + +```js +var exec = require('mz/child_process').exec + +exec('node --version').then(function (stdout) { + console.log(stdout) +}) +``` + +## Promise Engine + +`mz` uses [`any-promise`](https://github.com/kevinbeaty/any-promise). + +## FAQ + +### Can I use this in production? + +Yes, Node 4.x ships with stable promises support. For older engines, +you should probably install your own promise implementation and register it with +`require('any-promise/register')('bluebird')`. + +### Will this make my app faster? + +Nope, probably slower actually. + +### Can I add more features? + +Sure. +Open an issue. + +Currently, the plans are to eventually support: + +- New APIs in node.js that are not available in older versions of node +- ECMAScript7 Streams + +[bluebird]: https://github.com/petkaantonov/bluebird + +[npm-image]: https://img.shields.io/npm/v/mz.svg?style=flat-square +[npm-url]: https://npmjs.org/package/mz +[github-tag]: http://img.shields.io/github/tag/normalize/mz.svg?style=flat-square +[github-url]: https://github.com/normalize/mz/tags +[travis-image]: https://img.shields.io/travis/normalize/mz.svg?style=flat-square +[travis-url]: https://travis-ci.org/normalize/mz +[coveralls-image]: https://img.shields.io/coveralls/normalize/mz.svg?style=flat-square +[coveralls-url]: https://coveralls.io/r/normalize/mz?branch=master +[david-image]: http://img.shields.io/david/normalize/mz.svg?style=flat-square +[david-url]: https://david-dm.org/normalize/mz +[license-image]: http://img.shields.io/npm/l/mz.svg?style=flat-square +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/mz.svg?style=flat-square +[downloads-url]: https://npmjs.org/package/mz diff --git a/node_modules/mz/child_process.js b/node_modules/mz/child_process.js new file mode 100644 index 00000000..06d5d9e3 --- /dev/null +++ b/node_modules/mz/child_process.js @@ -0,0 +1,8 @@ + +require('thenify-all').withCallback( + require('child_process'), + exports, [ + 'exec', + 'execFile', + ] +) diff --git a/node_modules/mz/crypto.js b/node_modules/mz/crypto.js new file mode 100644 index 00000000..d8cff57f --- /dev/null +++ b/node_modules/mz/crypto.js @@ -0,0 +1,9 @@ + +require('thenify-all').withCallback( + require('crypto'), + exports, [ + 'pbkdf2', + 'pseudoRandomBytes', + 'randomBytes' + ] +) diff --git a/node_modules/mz/dns.js b/node_modules/mz/dns.js new file mode 100644 index 00000000..c1035822 --- /dev/null +++ b/node_modules/mz/dns.js @@ -0,0 +1,16 @@ + +require('thenify-all').withCallback( + require('dns'), + exports, [ + 'lookup', + 'resolve', + 'resolve4', + 'resolve6', + 'resolveCname', + 'resolveMx', + 'resolveNs', + 'resolveSrv', + 'resolveTxt', + 'reverse' + ] +) diff --git a/node_modules/mz/fs.js b/node_modules/mz/fs.js new file mode 100644 index 00000000..1cfd2d77 --- /dev/null +++ b/node_modules/mz/fs.js @@ -0,0 +1,62 @@ + +var Promise = require('any-promise') +var fs +try { + fs = require('graceful-fs') +} catch(err) { + fs = require('fs') +} + +var api = [ + 'appendFile', + 'chmod', + 'chown', + 'close', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'lchown', + 'link', + 'lstat', + 'mkdir', + 'open', + 'read', + 'readFile', + 'readdir', + 'readlink', + 'realpath', + 'rename', + 'rmdir', + 'stat', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'write', + 'writeFile' +] + +typeof fs.access === 'function' && api.push('access') +typeof fs.copyFile === 'function' && api.push('copyFile') +typeof fs.mkdtemp === 'function' && api.push('mkdtemp') + +require('thenify-all').withCallback(fs, exports, api) + +exports.exists = function (filename, callback) { + // callback + if (typeof callback === 'function') { + return fs.stat(filename, function (err) { + callback(null, !err); + }) + } + // or promise + return new Promise(function (resolve) { + fs.stat(filename, function (err) { + resolve(!err) + }) + }) +} diff --git a/node_modules/mz/index.js b/node_modules/mz/index.js new file mode 100644 index 00000000..cef508dc --- /dev/null +++ b/node_modules/mz/index.js @@ -0,0 +1,8 @@ +module.exports = { + fs: require('./fs'), + dns: require('./dns'), + zlib: require('./zlib'), + crypto: require('./crypto'), + readline: require('./readline'), + child_process: require('./child_process') +} diff --git a/node_modules/mz/package.json b/node_modules/mz/package.json new file mode 100644 index 00000000..de8d542c --- /dev/null +++ b/node_modules/mz/package.json @@ -0,0 +1,44 @@ +{ + "name": "mz", + "description": "modernize node.js to current ECMAScript standards", + "version": "2.7.0", + "author": { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com", + "twitter": "https://twitter.com/jongleberry" + }, + "license": "MIT", + "repository": "normalize/mz", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + }, + "devDependencies": { + "istanbul": "^0.4.0", + "bluebird": "^3.0.0", + "mocha": "^3.0.0" + }, + "scripts": { + "test": "mocha --reporter spec", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot" + }, + "keywords": [ + "promisify", + "promise", + "thenify", + "then", + "es6" + ], + "files": [ + "index.js", + "child_process.js", + "crypto.js", + "dns.js", + "fs.js", + "readline.js", + "zlib.js" + ] +} diff --git a/node_modules/mz/readline.js b/node_modules/mz/readline.js new file mode 100644 index 00000000..eb70c46f --- /dev/null +++ b/node_modules/mz/readline.js @@ -0,0 +1,64 @@ +var readline = require('readline') +var Promise = require('any-promise') +var objectAssign = require('object-assign') +var Interface = readline.Interface + +function wrapCompleter (completer) { + if (completer.length === 2) return completer + + return function (line, cb) { + var result = completer(line) + + if (typeof result.then !== 'function') { + return cb(null, result) + } + + result.catch(cb).then(function (result) { + process.nextTick(function () { cb(null, result) }) + }) + } +} + +function InterfaceAsPromised (input, output, completer, terminal) { + if (arguments.length === 1) { + var options = input + + if (typeof options.completer === 'function') { + options = objectAssign({}, options, { + completer: wrapCompleter(options.completer) + }) + } + + Interface.call(this, options) + } else { + if (typeof completer === 'function') { + completer = wrapCompleter(completer) + } + + Interface.call(this, input, output, completer, terminal) + } +} + +InterfaceAsPromised.prototype = Object.create(Interface.prototype) + +InterfaceAsPromised.prototype.question = function (question, callback) { + if (typeof callback === 'function') { + return Interface.prototype.question.call(this, question, callback) + } + + var self = this + return new Promise(function (resolve) { + Interface.prototype.question.call(self, question, resolve) + }) +} + +objectAssign(exports, readline, { + Interface: InterfaceAsPromised, + createInterface: function (input, output, completer, terminal) { + if (arguments.length === 1) { + return new InterfaceAsPromised(input) + } + + return new InterfaceAsPromised(input, output, completer, terminal) + } +}) diff --git a/node_modules/mz/zlib.js b/node_modules/mz/zlib.js new file mode 100644 index 00000000..a05c26a6 --- /dev/null +++ b/node_modules/mz/zlib.js @@ -0,0 +1,13 @@ + +require('thenify-all').withCallback( + require('zlib'), + exports, [ + 'deflate', + 'deflateRaw', + 'gzip', + 'gunzip', + 'inflate', + 'inflateRaw', + 'unzip', + ] +) diff --git a/node_modules/nanoid/.devcontainer.json b/node_modules/nanoid/.devcontainer.json new file mode 100644 index 00000000..7fd5ba1c --- /dev/null +++ b/node_modules/nanoid/.devcontainer.json @@ -0,0 +1,23 @@ +{ + "image": "localhost/ai-opensource:latest", + "forwardPorts": [], + "mounts": [ + { + "source": "pnpm-store", + "target": "/home/ai/.local/share/pnpm/store", + "type": "volume" + }, + { + "source": "shell-history", + "target": "/home/ai/.local/share/history/", + "type": "volume" + } + ], + "workspaceMount": "", + "runArgs": [ + "--userns=keep-id:uid=1000,gid=1000", + "--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:Z", + "--network=host", + "--ulimit=host" + ] +} diff --git a/node_modules/nanoid/LICENSE b/node_modules/nanoid/LICENSE new file mode 100644 index 00000000..37f56aa4 --- /dev/null +++ b/node_modules/nanoid/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2017 Andrey Sitnik + +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/nanoid/README.md b/node_modules/nanoid/README.md new file mode 100644 index 00000000..f4c8c135 --- /dev/null +++ b/node_modules/nanoid/README.md @@ -0,0 +1,554 @@ +# Nano ID + +Nano ID logo by Anton Lovchikov + +**English** | [Русский](./README.ru.md) | [简体中文](./README.zh-CN.md) | [Bahasa Indonesia](./README.id-ID.md) + +A tiny, secure, URL-friendly, unique string ID generator for JavaScript. + +> “An amazing level of senseless perfectionism, +> which is simply impossible not to respect.” + +* **Small.** 130 bytes (minified and gzipped). No dependencies. + [Size Limit] controls the size. +* **Fast.** It is 2 times faster than UUID. +* **Safe.** It uses hardware random generator. Can be used in clusters. +* **Short IDs.** It uses a larger alphabet than UUID (`A-Za-z0-9_-`). + So ID size was reduced from 36 to 21 symbols. +* **Portable.** Nano ID was ported + to [20 programming languages](#other-programming-languages). + +```js +import { nanoid } from 'nanoid' +model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT" +``` + +Supports modern browsers, IE [with Babel], Node.js and React Native. + +[online tool]: https://gitpod.io/#https://github.com/ai/nanoid/ +[with Babel]: https://developer.epages.com/blog/coding/how-to-transpile-node-modules-with-babel-and-webpack-in-a-monorepo/ +[Size Limit]: https://github.com/ai/size-limit + + + Sponsored by Evil Martians + + +## Table of Contents + +* [Comparison with UUID](#comparison-with-uuid) +* [Benchmark](#benchmark) +* [Security](#security) +* [API](#api) + * [Blocking](#blocking) + * [Async](#async) + * [Non-Secure](#non-secure) + * [Custom Alphabet or Size](#custom-alphabet-or-size) + * [Custom Random Bytes Generator](#custom-random-bytes-generator) +* [Usage](#usage) + * [IE](#ie) + * [React](#react) + * [React Native](#react-native) + * [Rollup](#rollup) + * [PouchDB and CouchDB](#pouchdb-and-couchdb) + * [Mongoose](#mongoose) + * [Web Workers](#web-workers) + * [CLI](#cli) + * [Other Programming Languages](#other-programming-languages) +* [Tools](#tools) + + +## Comparison with UUID + +Nano ID is quite comparable to UUID v4 (random-based). +It has a similar number of random bits in the ID +(126 in Nano ID and 122 in UUID), so it has a similar collision probability: + +> For there to be a one in a billion chance of duplication, +> 103 trillion version 4 IDs must be generated. + +There are three main differences between Nano ID and UUID v4: + +1. Nano ID uses a bigger alphabet, so a similar number of random bits + are packed in just 21 symbols instead of 36. +2. Nano ID code is **4 times less** than `uuid/v4` package: + 130 bytes instead of 483. +3. Because of memory allocation tricks, Nano ID is **2 times** faster than UUID. + + +## Benchmark + +```rust +$ node ./test/benchmark.js +crypto.randomUUID 25,603,857 ops/sec +@napi-rs/uuid 9,973,819 ops/sec +uid/secure 8,234,798 ops/sec +@lukeed/uuid 7,464,706 ops/sec +nanoid 5,616,592 ops/sec +customAlphabet 3,115,207 ops/sec +uuid v4 1,535,753 ops/sec +secure-random-string 388,226 ops/sec +uid-safe.sync 363,489 ops/sec +cuid 187,343 ops/sec +shortid 45,758 ops/sec + +Async: +nanoid/async 96,094 ops/sec +async customAlphabet 97,184 ops/sec +async secure-random-string 92,794 ops/sec +uid-safe 90,684 ops/sec + +Non-secure: +uid 67,376,692 ops/sec +nanoid/non-secure 2,849,639 ops/sec +rndm 2,674,806 ops/sec +``` + +Test configuration: ThinkPad X1 Carbon Gen 9, Fedora 34, Node.js 16.10. + + +## Security + +*See a good article about random generators theory: +[Secure random values (in Node.js)]* + +* **Unpredictability.** Instead of using the unsafe `Math.random()`, Nano ID + uses the `crypto` module in Node.js and the Web Crypto API in browsers. + These modules use unpredictable hardware random generator. +* **Uniformity.** `random % alphabet` is a popular mistake to make when coding + an ID generator. The distribution will not be even; there will be a lower + chance for some symbols to appear compared to others. So, it will reduce + the number of tries when brute-forcing. Nano ID uses a [better algorithm] + and is tested for uniformity. + + Nano ID uniformity + +* **Well-documented:** all Nano ID hacks are documented. See comments + in [the source]. +* **Vulnerabilities:** to report a security vulnerability, please use + the [Tidelift security contact](https://tidelift.com/security). + Tidelift will coordinate the fix and disclosure. + +[Secure random values (in Node.js)]: https://gist.github.com/joepie91/7105003c3b26e65efcea63f3db82dfba +[better algorithm]: https://github.com/ai/nanoid/blob/main/index.js +[the source]: https://github.com/ai/nanoid/blob/main/index.js + + +## Install + +```bash +npm install --save nanoid +``` + +For quick hacks, you can load Nano ID from CDN. Though, it is not recommended +to be used in production because of the lower loading performance. + +```js +import { nanoid } from 'https://cdn.jsdelivr.net/npm/nanoid/nanoid.js' +``` + +Nano ID provides ES modules. You do not need to do anything to use Nano ID +as ESM in webpack, Rollup, Parcel, or Node.js. + +```js +import { nanoid } from 'nanoid' +``` + +In Node.js you can use CommonJS import: + +```js +const { nanoid } = require('nanoid') +``` + + +## API + +Nano ID has 3 APIs: normal (blocking), asynchronous, and non-secure. + +By default, Nano ID uses URL-friendly symbols (`A-Za-z0-9_-`) and returns an ID +with 21 characters (to have a collision probability similar to UUID v4). + + +### Blocking + +The safe and easiest way to use Nano ID. + +In rare cases could block CPU from other work while noise collection +for hardware random generator. + +```js +import { nanoid } from 'nanoid' +model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT" +``` + +If you want to reduce the ID size (and increase collisions probability), +you can pass the size as an argument. + +```js +nanoid(10) //=> "IRFa-VaY2b" +``` + +Don’t forget to check the safety of your ID size +in our [ID collision probability] calculator. + +You can also use a [custom alphabet](#custom-alphabet-or-size) +or a [random generator](#custom-random-bytes-generator). + +[ID collision probability]: https://zelark.github.io/nano-id-cc/ + + +### Async + +To generate hardware random bytes, CPU collects electromagnetic noise. +For most cases, entropy will be already collected. + +In the synchronous API during the noise collection, the CPU is busy and +cannot do anything useful (for instance, process another HTTP request). + +Using the asynchronous API of Nano ID, another code can run during +the entropy collection. + +```js +import { nanoid } from 'nanoid/async' + +async function createUser () { + user.id = await nanoid() +} +``` + +Read more about entropy collection in [`crypto.randomBytes`] docs. + +Unfortunately, you will lose Web Crypto API advantages in a browser +if you use the asynchronous API. So, currently, in the browser, you are limited +with either security (`nanoid`), asynchronous behavior (`nanoid/async`), +or non-secure behavior (`nanoid/non-secure`) that will be explained +in the next part of the documentation. + +[`crypto.randomBytes`]: https://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback + + +### Non-Secure + +By default, Nano ID uses hardware random bytes generation for security +and low collision probability. If you are not so concerned with security, +you can use the faster non-secure generator. + +```js +import { nanoid } from 'nanoid/non-secure' +const id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqLJ" +``` + + +### Custom Alphabet or Size + +`customAlphabet` allows you to create `nanoid` with your own alphabet +and ID size. + +```js +import { customAlphabet } from 'nanoid' +const nanoid = customAlphabet('1234567890abcdef', 10) +model.id = nanoid() //=> "4f90d13a42" +``` + +```js +import { customAlphabet } from 'nanoid/async' +const nanoid = customAlphabet('1234567890abcdef', 10) +async function createUser () { + user.id = await nanoid() +} +``` + +```js +import { customAlphabet } from 'nanoid/non-secure' +const nanoid = customAlphabet('1234567890abcdef', 10) +user.id = nanoid() +``` + +Check the safety of your custom alphabet and ID size in our +[ID collision probability] calculator. For more alphabets, check out the options +in [`nanoid-dictionary`]. + +Alphabet must contain 256 symbols or less. +Otherwise, the security of the internal generator algorithm is not guaranteed. + +In addition to setting a default size, you can change the ID size when calling +the function: + +```js +import { customAlphabet } from 'nanoid' +const nanoid = customAlphabet('1234567890abcdef', 10) +model.id = nanoid(5) //=> "f01a2" +``` + +[ID collision probability]: https://alex7kom.github.io/nano-nanoid-cc/ +[`nanoid-dictionary`]: https://github.com/CyberAP/nanoid-dictionary + + +### Custom Random Bytes Generator + +`customRandom` allows you to create a `nanoid` and replace alphabet +and the default random bytes generator. + +In this example, a seed-based generator is used: + +```js +import { customRandom } from 'nanoid' + +const rng = seedrandom(seed) +const nanoid = customRandom('abcdef', 10, size => { + return (new Uint8Array(size)).map(() => 256 * rng()) +}) + +nanoid() //=> "fbaefaadeb" +``` + +`random` callback must accept the array size and return an array +with random numbers. + +If you want to use the same URL-friendly symbols with `customRandom`, +you can get the default alphabet using the `urlAlphabet`. + +```js +const { customRandom, urlAlphabet } = require('nanoid') +const nanoid = customRandom(urlAlphabet, 10, random) +``` + +Asynchronous and non-secure APIs are not available for `customRandom`. + +Note, that between Nano ID versions we may change random generator +call sequence. If you are using seed-based generators, we do not guarantee +the same result. + + +## Usage + +### IE + +If you support IE, you need to [transpile `node_modules`] by Babel +and add `crypto` alias. Moreover, `UInt8Array` in IE actually +is not an array and to cope with it, you have to convert it to an array +manually: + +```js +// polyfills.js +if (!window.crypto && window.msCrypto) { + window.crypto = window.msCrypto + + const getRandomValuesDef = window.crypto.getRandomValues + + window.crypto.getRandomValues = function (array) { + const values = getRandomValuesDef.call(window.crypto, array) + const result = [] + + for (let i = 0; i < array.length; i++) { + result[i] = values[i]; + } + + return result + }; +} +``` + +```js +import './polyfills.js' +import { nanoid } from 'nanoid' +``` + +[transpile `node_modules`]: https://developer.epages.com/blog/coding/how-to-transpile-node-modules-with-babel-and-webpack-in-a-monorepo/ + + +### React + +There’s no correct way to use Nano ID for React `key` prop +since it should be consistent among renders. + +```jsx +function Todos({todos}) { + return ( +
    + {todos.map(todo => ( +
  • /* DON’T DO IT */ + {todo.text} +
  • + ))} +
+ ) +} +``` + +You should rather try to reach for stable ID inside your list item. + +```jsx +const todoItems = todos.map((todo) => +
  • + {todo.text} +
  • +) +``` + +In case you don’t have stable IDs you'd rather use index as `key` +instead of `nanoid()`: + +```jsx +const todoItems = todos.map((text, index) => +
  • /* Still not recommended but preferred over nanoid(). + Only do this if items have no stable IDs. */ + {text} +
  • +) +``` + + +### React Native + +React Native does not have built-in random generator. The following polyfill +works for plain React Native and Expo starting with `39.x`. + +1. Check [`react-native-get-random-values`] docs and install it. +2. Import it before Nano ID. + +```js +import 'react-native-get-random-values' +import { nanoid } from 'nanoid' +``` + +[`react-native-get-random-values`]: https://github.com/LinusU/react-native-get-random-values + + +### Rollup + +For Rollup you will need [`@rollup/plugin-node-resolve`] to bundle browser version +of this library.: + +```js + plugins: [ + nodeResolve({ + browser: true + }) + ] +``` + +[`@rollup/plugin-node-resolve`]: https://github.com/rollup/plugins/tree/master/packages/node-resolve + + +### PouchDB and CouchDB + +In PouchDB and CouchDB, IDs can’t start with an underscore `_`. +A prefix is required to prevent this issue, as Nano ID might use a `_` +at the start of the ID by default. + +Override the default ID with the following option: + +```js +db.put({ + _id: 'id' + nanoid(), + … +}) +``` + + +### Mongoose + +```js +const mySchema = new Schema({ + _id: { + type: String, + default: () => nanoid() + } +}) +``` + + +### Web Workers + +Web Workers do not have access to a secure random generator. + +Security is important in IDs when IDs should be unpredictable. +For instance, in "access by URL" link generation. +If you do not need unpredictable IDs, but you need to use Web Workers, +you can use the non‑secure ID generator. + +```js +import { nanoid } from 'nanoid/non-secure' +nanoid() //=> "Uakgb_J5m9g-0JDMbcJqLJ" +``` + +Note: non-secure IDs are more prone to collision attacks. + + +### CLI + +You can get unique ID in terminal by calling `npx nanoid`. You need only +Node.js in the system. You do not need Nano ID to be installed anywhere. + +```sh +$ npx nanoid +npx: installed 1 in 0.63s +LZfXLFzPPR4NNrgjlWDxn +``` + +Size of generated ID can be specified with `--size` (or `-s`) option: + +```sh +$ npx nanoid --size 10 +L3til0JS4z +``` + +Custom alphabet can be specified with `--alphabet` (or `-a`) option +(note that in this case `--size` is required): + +```sh +$ npx nanoid --alphabet abc --size 15 +bccbcabaabaccab +``` + +### Other Programming Languages + +Nano ID was ported to many languages. You can use these ports to have +the same ID generator on the client and server side. + +* [C#](https://github.com/codeyu/nanoid-net) +* [C++](https://github.com/mcmikecreations/nanoid_cpp) +* [Clojure and ClojureScript](https://github.com/zelark/nano-id) +* [ColdFusion/CFML](https://github.com/JamoCA/cfml-nanoid) +* [Crystal](https://github.com/mamantoha/nanoid.cr) +* [Dart & Flutter](https://github.com/pd4d10/nanoid-dart) +* [Deno](https://github.com/ianfabs/nanoid) +* [Go](https://github.com/matoous/go-nanoid) +* [Elixir](https://github.com/railsmechanic/nanoid) +* [Haskell](https://github.com/MichelBoucey/NanoID) +* [Janet](https://sr.ht/~statianzo/janet-nanoid/) +* [Java](https://github.com/aventrix/jnanoid) +* [Nim](https://github.com/icyphox/nanoid.nim) +* [OCaml](https://github.com/routineco/ocaml-nanoid) +* [Perl](https://github.com/tkzwtks/Nanoid-perl) +* [PHP](https://github.com/hidehalo/nanoid-php) +* [Python](https://github.com/puyuan/py-nanoid) + with [dictionaries](https://pypi.org/project/nanoid-dictionary) +* [Postgres Extension](https://github.com/spa5k/uids-postgres) +* [R](https://github.com/hrbrmstr/nanoid) (with dictionaries) +* [Ruby](https://github.com/radeno/nanoid.rb) +* [Rust](https://github.com/nikolay-govorov/nanoid) +* [Swift](https://github.com/antiflasher/NanoID) +* [Unison](https://share.unison-lang.org/latest/namespaces/hojberg/nanoid) +* [V](https://github.com/invipal/nanoid) +* [Zig](https://github.com/SasLuca/zig-nanoid) + +For other environments, [CLI] is available to generate IDs from a command line. + +[CLI]: #cli + + +## Tools + +* [ID size calculator] shows collision probability when adjusting + the ID alphabet or size. +* [`nanoid-dictionary`] with popular alphabets to use with [`customAlphabet`]. +* [`nanoid-good`] to be sure that your ID doesn’t contain any obscene words. + +[`nanoid-dictionary`]: https://github.com/CyberAP/nanoid-dictionary +[ID size calculator]: https://zelark.github.io/nano-id-cc/ +[`customAlphabet`]: #custom-alphabet-or-size +[`nanoid-good`]: https://github.com/y-gagar1n/nanoid-good diff --git a/node_modules/nanoid/async/index.browser.cjs b/node_modules/nanoid/async/index.browser.cjs new file mode 100644 index 00000000..80d18716 --- /dev/null +++ b/node_modules/nanoid/async/index.browser.cjs @@ -0,0 +1,69 @@ +let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes)) + +let customAlphabet = (alphabet, defaultSize = 21) => { + // First, a bitmask is necessary to generate the ID. The bitmask makes bytes + // values closer to the alphabet size. The bitmask calculates the closest + // `2^31 - 1` number, which exceeds the alphabet size. + // For example, the bitmask for the alphabet size 30 is 31 (00011111). + // `Math.clz32` is not used, because it is not available in browsers. + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + // Though, the bitmask solution is not perfect since the bytes exceeding + // the alphabet size are refused. Therefore, to reliably generate the ID, + // the random bytes redundancy has to be satisfied. + + // Note: every hardware random generator call is performance expensive, + // because the system call for entropy collection takes a lot of time. + // So, to avoid additional system calls, extra bytes are requested in advance. + + // Next, a step determines how many random bytes to generate. + // The number of random bytes gets decided upon the ID size, mask, + // alphabet size, and magic number 1.6 (using 1.6 peaks at performance + // according to benchmarks). + + // `-~f => Math.ceil(f)` if f is a float + // `-~i => i + 1` if i is an integer + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + + return async (size = defaultSize) => { + let id = '' + while (true) { + let bytes = crypto.getRandomValues(new Uint8Array(step)) + // A compact alternative for `for (var i = 0; i < step; i++)`. + let i = step | 0 + while (i--) { + // Adding `|| ''` refuses a random byte that exceeds the alphabet size. + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let nanoid = async (size = 21) => { + let id = '' + let bytes = crypto.getRandomValues(new Uint8Array((size |= 0))) + + // A compact alternative for `for (var i = 0; i < step; i++)`. + while (size--) { + // It is incorrect to use bytes exceeding the alphabet size. + // The following mask reduces the random byte in the 0-255 value + // range to the 0-63 value range. Therefore, adding hacks, such + // as empty string fallback or magic numbers, is unneccessary because + // the bitmask trims bytes down to the alphabet size. + let byte = bytes[size] & 63 + if (byte < 36) { + // `0-9a-z` + id += byte.toString(36) + } else if (byte < 62) { + // `A-Z` + id += (byte - 26).toString(36).toUpperCase() + } else if (byte < 63) { + id += '_' + } else { + id += '-' + } + } + return id +} + +module.exports = { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.browser.js b/node_modules/nanoid/async/index.browser.js new file mode 100644 index 00000000..aeffb3f6 --- /dev/null +++ b/node_modules/nanoid/async/index.browser.js @@ -0,0 +1,69 @@ +let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes)) + +let customAlphabet = (alphabet, defaultSize = 21) => { + // First, a bitmask is necessary to generate the ID. The bitmask makes bytes + // values closer to the alphabet size. The bitmask calculates the closest + // `2^31 - 1` number, which exceeds the alphabet size. + // For example, the bitmask for the alphabet size 30 is 31 (00011111). + // `Math.clz32` is not used, because it is not available in browsers. + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + // Though, the bitmask solution is not perfect since the bytes exceeding + // the alphabet size are refused. Therefore, to reliably generate the ID, + // the random bytes redundancy has to be satisfied. + + // Note: every hardware random generator call is performance expensive, + // because the system call for entropy collection takes a lot of time. + // So, to avoid additional system calls, extra bytes are requested in advance. + + // Next, a step determines how many random bytes to generate. + // The number of random bytes gets decided upon the ID size, mask, + // alphabet size, and magic number 1.6 (using 1.6 peaks at performance + // according to benchmarks). + + // `-~f => Math.ceil(f)` if f is a float + // `-~i => i + 1` if i is an integer + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + + return async (size = defaultSize) => { + let id = '' + while (true) { + let bytes = crypto.getRandomValues(new Uint8Array(step)) + // A compact alternative for `for (var i = 0; i < step; i++)`. + let i = step | 0 + while (i--) { + // Adding `|| ''` refuses a random byte that exceeds the alphabet size. + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let nanoid = async (size = 21) => { + let id = '' + let bytes = crypto.getRandomValues(new Uint8Array((size |= 0))) + + // A compact alternative for `for (var i = 0; i < step; i++)`. + while (size--) { + // It is incorrect to use bytes exceeding the alphabet size. + // The following mask reduces the random byte in the 0-255 value + // range to the 0-63 value range. Therefore, adding hacks, such + // as empty string fallback or magic numbers, is unneccessary because + // the bitmask trims bytes down to the alphabet size. + let byte = bytes[size] & 63 + if (byte < 36) { + // `0-9a-z` + id += byte.toString(36) + } else if (byte < 62) { + // `A-Z` + id += (byte - 26).toString(36).toUpperCase() + } else if (byte < 63) { + id += '_' + } else { + id += '-' + } + } + return id +} + +export { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.cjs b/node_modules/nanoid/async/index.cjs new file mode 100644 index 00000000..f1b0ad02 --- /dev/null +++ b/node_modules/nanoid/async/index.cjs @@ -0,0 +1,71 @@ +let crypto = require('crypto') + +let { urlAlphabet } = require('../url-alphabet/index.cjs') + +// `crypto.randomFill()` is a little faster than `crypto.randomBytes()`, +// because it is possible to use in combination with `Buffer.allocUnsafe()`. +let random = bytes => + new Promise((resolve, reject) => { + // `Buffer.allocUnsafe()` is faster because it doesn’t flush the memory. + // Memory flushing is unnecessary since the buffer allocation itself resets + // the memory with the new bytes. + crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => { + if (err) { + reject(err) + } else { + resolve(buf) + } + }) + }) + +let customAlphabet = (alphabet, defaultSize = 21) => { + // First, a bitmask is necessary to generate the ID. The bitmask makes bytes + // values closer to the alphabet size. The bitmask calculates the closest + // `2^31 - 1` number, which exceeds the alphabet size. + // For example, the bitmask for the alphabet size 30 is 31 (00011111). + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + // Though, the bitmask solution is not perfect since the bytes exceeding + // the alphabet size are refused. Therefore, to reliably generate the ID, + // the random bytes redundancy has to be satisfied. + + // Note: every hardware random generator call is performance expensive, + // because the system call for entropy collection takes a lot of time. + // So, to avoid additional system calls, extra bytes are requested in advance. + + // Next, a step determines how many random bytes to generate. + // The number of random bytes gets decided upon the ID size, mask, + // alphabet size, and magic number 1.6 (using 1.6 peaks at performance + // according to benchmarks). + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + + let tick = (id, size = defaultSize) => + random(step).then(bytes => { + // A compact alternative for `for (var i = 0; i < step; i++)`. + let i = step + while (i--) { + // Adding `|| ''` refuses a random byte that exceeds the alphabet size. + id += alphabet[bytes[i] & mask] || '' + if (id.length >= size) return id + } + return tick(id, size) + }) + + return size => tick('', size) +} + +let nanoid = (size = 21) => + random((size |= 0)).then(bytes => { + let id = '' + // A compact alternative for `for (var i = 0; i < step; i++)`. + while (size--) { + // It is incorrect to use bytes exceeding the alphabet size. + // The following mask reduces the random byte in the 0-255 value + // range to the 0-63 value range. Therefore, adding hacks, such + // as empty string fallback or magic numbers, is unneccessary because + // the bitmask trims bytes down to the alphabet size. + id += urlAlphabet[bytes[size] & 63] + } + return id + }) + +module.exports = { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.d.ts b/node_modules/nanoid/async/index.d.ts new file mode 100644 index 00000000..9e919658 --- /dev/null +++ b/node_modules/nanoid/async/index.d.ts @@ -0,0 +1,56 @@ +/** + * Generate secure URL-friendly unique ID. The non-blocking version. + * + * By default, the ID will have 21 symbols to have a collision probability + * similar to UUID v4. + * + * ```js + * import { nanoid } from 'nanoid/async' + * nanoid().then(id => { + * model.id = id + * }) + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A promise with a random string. + */ +export function nanoid(size?: number): Promise + +/** + * A low-level function. + * Generate secure unique ID with custom alphabet. The non-blocking version. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A function that returns a promise with a random string. + * + * ```js + * import { customAlphabet } from 'nanoid/async' + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * nanoid().then(id => { + * model.id = id //=> "8ё56а" + * }) + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => Promise + +/** + * Generate an array of random bytes collected from hardware noise. + * + * ```js + * import { random } from 'nanoid/async' + * random(5).then(bytes => { + * bytes //=> [10, 67, 212, 67, 89] + * }) + * ``` + * + * @param bytes Size of the array. + * @returns A promise with a random bytes array. + */ +export function random(bytes: number): Promise diff --git a/node_modules/nanoid/async/index.js b/node_modules/nanoid/async/index.js new file mode 100644 index 00000000..7f2eae91 --- /dev/null +++ b/node_modules/nanoid/async/index.js @@ -0,0 +1,71 @@ +import crypto from 'crypto' + +import { urlAlphabet } from '../url-alphabet/index.js' + +// `crypto.randomFill()` is a little faster than `crypto.randomBytes()`, +// because it is possible to use in combination with `Buffer.allocUnsafe()`. +let random = bytes => + new Promise((resolve, reject) => { + // `Buffer.allocUnsafe()` is faster because it doesn’t flush the memory. + // Memory flushing is unnecessary since the buffer allocation itself resets + // the memory with the new bytes. + crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => { + if (err) { + reject(err) + } else { + resolve(buf) + } + }) + }) + +let customAlphabet = (alphabet, defaultSize = 21) => { + // First, a bitmask is necessary to generate the ID. The bitmask makes bytes + // values closer to the alphabet size. The bitmask calculates the closest + // `2^31 - 1` number, which exceeds the alphabet size. + // For example, the bitmask for the alphabet size 30 is 31 (00011111). + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + // Though, the bitmask solution is not perfect since the bytes exceeding + // the alphabet size are refused. Therefore, to reliably generate the ID, + // the random bytes redundancy has to be satisfied. + + // Note: every hardware random generator call is performance expensive, + // because the system call for entropy collection takes a lot of time. + // So, to avoid additional system calls, extra bytes are requested in advance. + + // Next, a step determines how many random bytes to generate. + // The number of random bytes gets decided upon the ID size, mask, + // alphabet size, and magic number 1.6 (using 1.6 peaks at performance + // according to benchmarks). + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + + let tick = (id, size = defaultSize) => + random(step).then(bytes => { + // A compact alternative for `for (var i = 0; i < step; i++)`. + let i = step + while (i--) { + // Adding `|| ''` refuses a random byte that exceeds the alphabet size. + id += alphabet[bytes[i] & mask] || '' + if (id.length >= size) return id + } + return tick(id, size) + }) + + return size => tick('', size) +} + +let nanoid = (size = 21) => + random((size |= 0)).then(bytes => { + let id = '' + // A compact alternative for `for (var i = 0; i < step; i++)`. + while (size--) { + // It is incorrect to use bytes exceeding the alphabet size. + // The following mask reduces the random byte in the 0-255 value + // range to the 0-63 value range. Therefore, adding hacks, such + // as empty string fallback or magic numbers, is unneccessary because + // the bitmask trims bytes down to the alphabet size. + id += urlAlphabet[bytes[size] & 63] + } + return id + }) + +export { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.native.js b/node_modules/nanoid/async/index.native.js new file mode 100644 index 00000000..a765de9a --- /dev/null +++ b/node_modules/nanoid/async/index.native.js @@ -0,0 +1,57 @@ +import { getRandomBytesAsync } from 'expo-random' + +import { urlAlphabet } from '../url-alphabet/index.js' + +let random = getRandomBytesAsync + +let customAlphabet = (alphabet, defaultSize = 21) => { + // First, a bitmask is necessary to generate the ID. The bitmask makes bytes + // values closer to the alphabet size. The bitmask calculates the closest + // `2^31 - 1` number, which exceeds the alphabet size. + // For example, the bitmask for the alphabet size 30 is 31 (00011111). + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + // Though, the bitmask solution is not perfect since the bytes exceeding + // the alphabet size are refused. Therefore, to reliably generate the ID, + // the random bytes redundancy has to be satisfied. + + // Note: every hardware random generator call is performance expensive, + // because the system call for entropy collection takes a lot of time. + // So, to avoid additional system calls, extra bytes are requested in advance. + + // Next, a step determines how many random bytes to generate. + // The number of random bytes gets decided upon the ID size, mask, + // alphabet size, and magic number 1.6 (using 1.6 peaks at performance + // according to benchmarks). + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + + let tick = (id, size = defaultSize) => + random(step).then(bytes => { + // A compact alternative for `for (var i = 0; i < step; i++)`. + let i = step + while (i--) { + // Adding `|| ''` refuses a random byte that exceeds the alphabet size. + id += alphabet[bytes[i] & mask] || '' + if (id.length >= size) return id + } + return tick(id, size) + }) + + return size => tick('', size) +} + +let nanoid = (size = 21) => + random((size |= 0)).then(bytes => { + let id = '' + // A compact alternative for `for (var i = 0; i < step; i++)`. + while (size--) { + // It is incorrect to use bytes exceeding the alphabet size. + // The following mask reduces the random byte in the 0-255 value + // range to the 0-63 value range. Therefore, adding hacks, such + // as empty string fallback or magic numbers, is unneccessary because + // the bitmask trims bytes down to the alphabet size. + id += urlAlphabet[bytes[size] & 63] + } + return id + }) + +export { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/package.json b/node_modules/nanoid/async/package.json new file mode 100644 index 00000000..578cdb4c --- /dev/null +++ b/node_modules/nanoid/async/package.json @@ -0,0 +1,12 @@ +{ + "type": "module", + "main": "index.cjs", + "module": "index.js", + "react-native": { + "./index.js": "./index.native.js" + }, + "browser": { + "./index.js": "./index.browser.js", + "./index.cjs": "./index.browser.cjs" + } +} \ No newline at end of file diff --git a/node_modules/nanoid/bin/nanoid.cjs b/node_modules/nanoid/bin/nanoid.cjs new file mode 100755 index 00000000..c76db0fa --- /dev/null +++ b/node_modules/nanoid/bin/nanoid.cjs @@ -0,0 +1,55 @@ +#!/usr/bin/env node + +let { nanoid, customAlphabet } = require('..') + +function print(msg) { + process.stdout.write(msg + '\n') +} + +function error(msg) { + process.stderr.write(msg + '\n') + process.exit(1) +} + +if (process.argv.includes('--help') || process.argv.includes('-h')) { + print(` + Usage + $ nanoid [options] + + Options + -s, --size Generated ID size + -a, --alphabet Alphabet to use + -h, --help Show this help + + Examples + $ nanoid --s 15 + S9sBF77U6sDB8Yg + + $ nanoid --size 10 --alphabet abc + bcabababca`) + process.exit() +} + +let alphabet, size +for (let i = 2; i < process.argv.length; i++) { + let arg = process.argv[i] + if (arg === '--size' || arg === '-s') { + size = Number(process.argv[i + 1]) + i += 1 + if (Number.isNaN(size) || size <= 0) { + error('Size must be positive integer') + } + } else if (arg === '--alphabet' || arg === '-a') { + alphabet = process.argv[i + 1] + i += 1 + } else { + error('Unknown argument ' + arg) + } +} + +if (alphabet) { + let customNanoid = customAlphabet(alphabet, size) + print(customNanoid()) +} else { + print(nanoid(size)) +} diff --git a/node_modules/nanoid/index.browser.cjs b/node_modules/nanoid/index.browser.cjs new file mode 100644 index 00000000..d21a91fc --- /dev/null +++ b/node_modules/nanoid/index.browser.cjs @@ -0,0 +1,72 @@ +// This file replaces `index.js` in bundlers like webpack or Rollup, +// according to `browser` config in `package.json`. + +let { urlAlphabet } = require('./url-alphabet/index.cjs') + +let random = bytes => crypto.getRandomValues(new Uint8Array(bytes)) + +let customRandom = (alphabet, defaultSize, getRandom) => { + // First, a bitmask is necessary to generate the ID. The bitmask makes bytes + // values closer to the alphabet size. The bitmask calculates the closest + // `2^31 - 1` number, which exceeds the alphabet size. + // For example, the bitmask for the alphabet size 30 is 31 (00011111). + // `Math.clz32` is not used, because it is not available in browsers. + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + // Though, the bitmask solution is not perfect since the bytes exceeding + // the alphabet size are refused. Therefore, to reliably generate the ID, + // the random bytes redundancy has to be satisfied. + + // Note: every hardware random generator call is performance expensive, + // because the system call for entropy collection takes a lot of time. + // So, to avoid additional system calls, extra bytes are requested in advance. + + // Next, a step determines how many random bytes to generate. + // The number of random bytes gets decided upon the ID size, mask, + // alphabet size, and magic number 1.6 (using 1.6 peaks at performance + // according to benchmarks). + + // `-~f => Math.ceil(f)` if f is a float + // `-~i => i + 1` if i is an integer + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + + return (size = defaultSize) => { + let id = '' + while (true) { + let bytes = getRandom(step) + // A compact alternative for `for (var i = 0; i < step; i++)`. + let j = step | 0 + while (j--) { + // Adding `|| ''` refuses a random byte that exceeds the alphabet size. + id += alphabet[bytes[j] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) + +let nanoid = (size = 21) => + crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => { + // It is incorrect to use bytes exceeding the alphabet size. + // The following mask reduces the random byte in the 0-255 value + // range to the 0-63 value range. Therefore, adding hacks, such + // as empty string fallback or magic numbers, is unneccessary because + // the bitmask trims bytes down to the alphabet size. + byte &= 63 + if (byte < 36) { + // `0-9a-z` + id += byte.toString(36) + } else if (byte < 62) { + // `A-Z` + id += (byte - 26).toString(36).toUpperCase() + } else if (byte > 62) { + id += '-' + } else { + id += '_' + } + return id + }, '') + +module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/index.browser.js b/node_modules/nanoid/index.browser.js new file mode 100644 index 00000000..732e5045 --- /dev/null +++ b/node_modules/nanoid/index.browser.js @@ -0,0 +1,72 @@ +// This file replaces `index.js` in bundlers like webpack or Rollup, +// according to `browser` config in `package.json`. + +import { urlAlphabet } from './url-alphabet/index.js' + +let random = bytes => crypto.getRandomValues(new Uint8Array(bytes)) + +let customRandom = (alphabet, defaultSize, getRandom) => { + // First, a bitmask is necessary to generate the ID. The bitmask makes bytes + // values closer to the alphabet size. The bitmask calculates the closest + // `2^31 - 1` number, which exceeds the alphabet size. + // For example, the bitmask for the alphabet size 30 is 31 (00011111). + // `Math.clz32` is not used, because it is not available in browsers. + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + // Though, the bitmask solution is not perfect since the bytes exceeding + // the alphabet size are refused. Therefore, to reliably generate the ID, + // the random bytes redundancy has to be satisfied. + + // Note: every hardware random generator call is performance expensive, + // because the system call for entropy collection takes a lot of time. + // So, to avoid additional system calls, extra bytes are requested in advance. + + // Next, a step determines how many random bytes to generate. + // The number of random bytes gets decided upon the ID size, mask, + // alphabet size, and magic number 1.6 (using 1.6 peaks at performance + // according to benchmarks). + + // `-~f => Math.ceil(f)` if f is a float + // `-~i => i + 1` if i is an integer + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + + return (size = defaultSize) => { + let id = '' + while (true) { + let bytes = getRandom(step) + // A compact alternative for `for (var i = 0; i < step; i++)`. + let j = step | 0 + while (j--) { + // Adding `|| ''` refuses a random byte that exceeds the alphabet size. + id += alphabet[bytes[j] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) + +let nanoid = (size = 21) => + crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => { + // It is incorrect to use bytes exceeding the alphabet size. + // The following mask reduces the random byte in the 0-255 value + // range to the 0-63 value range. Therefore, adding hacks, such + // as empty string fallback or magic numbers, is unneccessary because + // the bitmask trims bytes down to the alphabet size. + byte &= 63 + if (byte < 36) { + // `0-9a-z` + id += byte.toString(36) + } else if (byte < 62) { + // `A-Z` + id += (byte - 26).toString(36).toUpperCase() + } else if (byte > 62) { + id += '-' + } else { + id += '_' + } + return id + }, '') + +export { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/index.cjs b/node_modules/nanoid/index.cjs new file mode 100644 index 00000000..c20e3744 --- /dev/null +++ b/node_modules/nanoid/index.cjs @@ -0,0 +1,85 @@ +let crypto = require('crypto') + +let { urlAlphabet } = require('./url-alphabet/index.cjs') + +// It is best to make fewer, larger requests to the crypto module to +// avoid system call overhead. So, random numbers are generated in a +// pool. The pool is a Buffer that is larger than the initial random +// request size by this multiplier. The pool is enlarged if subsequent +// requests exceed the maximum buffer size. +const POOL_SIZE_MULTIPLIER = 128 +let pool, poolOffset + +let fillPool = bytes => { + if (!pool || pool.length < bytes) { + pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER) + crypto.randomFillSync(pool) + poolOffset = 0 + } else if (poolOffset + bytes > pool.length) { + crypto.randomFillSync(pool) + poolOffset = 0 + } + poolOffset += bytes +} + +let random = bytes => { + // `|=` convert `bytes` to number to prevent `valueOf` abusing and pool pollution + fillPool((bytes |= 0)) + return pool.subarray(poolOffset - bytes, poolOffset) +} + +let customRandom = (alphabet, defaultSize, getRandom) => { + // First, a bitmask is necessary to generate the ID. The bitmask makes bytes + // values closer to the alphabet size. The bitmask calculates the closest + // `2^31 - 1` number, which exceeds the alphabet size. + // For example, the bitmask for the alphabet size 30 is 31 (00011111). + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + // Though, the bitmask solution is not perfect since the bytes exceeding + // the alphabet size are refused. Therefore, to reliably generate the ID, + // the random bytes redundancy has to be satisfied. + + // Note: every hardware random generator call is performance expensive, + // because the system call for entropy collection takes a lot of time. + // So, to avoid additional system calls, extra bytes are requested in advance. + + // Next, a step determines how many random bytes to generate. + // The number of random bytes gets decided upon the ID size, mask, + // alphabet size, and magic number 1.6 (using 1.6 peaks at performance + // according to benchmarks). + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + + return (size = defaultSize) => { + let id = '' + while (true) { + let bytes = getRandom(step) + // A compact alternative for `for (let i = 0; i < step; i++)`. + let i = step + while (i--) { + // Adding `|| ''` refuses a random byte that exceeds the alphabet size. + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) + +let nanoid = (size = 21) => { + // `|=` convert `size` to number to prevent `valueOf` abusing and pool pollution + fillPool((size |= 0)) + let id = '' + // We are reading directly from the random pool to avoid creating new array + for (let i = poolOffset - size; i < poolOffset; i++) { + // It is incorrect to use bytes exceeding the alphabet size. + // The following mask reduces the random byte in the 0-255 value + // range to the 0-63 value range. Therefore, adding hacks, such + // as empty string fallback or magic numbers, is unneccessary because + // the bitmask trims bytes down to the alphabet size. + id += urlAlphabet[pool[i] & 63] + } + return id +} + +module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/index.d.cts b/node_modules/nanoid/index.d.cts new file mode 100644 index 00000000..3e111a39 --- /dev/null +++ b/node_modules/nanoid/index.d.cts @@ -0,0 +1,91 @@ +/** + * Generate secure URL-friendly unique ID. + * + * By default, the ID will have 21 symbols to have a collision probability + * similar to UUID v4. + * + * ```js + * import { nanoid } from 'nanoid' + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A random string. + */ +export function nanoid(size?: number): string + +/** + * Generate secure unique ID with custom alphabet. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A random string generator. + * + * ```js + * const { customAlphabet } = require('nanoid') + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * nanoid() //=> "8ё56а" + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => string + +/** + * Generate unique ID with custom random generator and alphabet. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * ```js + * import { customRandom } from 'nanoid/format' + * + * const nanoid = customRandom('abcdef', 5, size => { + * const random = [] + * for (let i = 0; i < size; i++) { + * random.push(randomByte()) + * } + * return random + * }) + * + * nanoid() //=> "fbaef" + * ``` + * + * @param alphabet Alphabet used to generate a random string. + * @param size Size of the random string. + * @param random A random bytes generator. + * @returns A random string generator. + */ +export function customRandom( + alphabet: string, + size: number, + random: (bytes: number) => Uint8Array +): () => string + +/** + * URL safe symbols. + * + * ```js + * import { urlAlphabet } from 'nanoid' + * const nanoid = customAlphabet(urlAlphabet, 10) + * nanoid() //=> "Uakgb_J5m9" + * ``` + */ +export const urlAlphabet: string + +/** + * Generate an array of random bytes collected from hardware noise. + * + * ```js + * import { customRandom, random } from 'nanoid' + * const nanoid = customRandom("abcdef", 5, random) + * ``` + * + * @param bytes Size of the array. + * @returns An array of random bytes. + */ +export function random(bytes: number): Uint8Array diff --git a/node_modules/nanoid/index.d.ts b/node_modules/nanoid/index.d.ts new file mode 100644 index 00000000..3e111a39 --- /dev/null +++ b/node_modules/nanoid/index.d.ts @@ -0,0 +1,91 @@ +/** + * Generate secure URL-friendly unique ID. + * + * By default, the ID will have 21 symbols to have a collision probability + * similar to UUID v4. + * + * ```js + * import { nanoid } from 'nanoid' + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A random string. + */ +export function nanoid(size?: number): string + +/** + * Generate secure unique ID with custom alphabet. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A random string generator. + * + * ```js + * const { customAlphabet } = require('nanoid') + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * nanoid() //=> "8ё56а" + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => string + +/** + * Generate unique ID with custom random generator and alphabet. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * ```js + * import { customRandom } from 'nanoid/format' + * + * const nanoid = customRandom('abcdef', 5, size => { + * const random = [] + * for (let i = 0; i < size; i++) { + * random.push(randomByte()) + * } + * return random + * }) + * + * nanoid() //=> "fbaef" + * ``` + * + * @param alphabet Alphabet used to generate a random string. + * @param size Size of the random string. + * @param random A random bytes generator. + * @returns A random string generator. + */ +export function customRandom( + alphabet: string, + size: number, + random: (bytes: number) => Uint8Array +): () => string + +/** + * URL safe symbols. + * + * ```js + * import { urlAlphabet } from 'nanoid' + * const nanoid = customAlphabet(urlAlphabet, 10) + * nanoid() //=> "Uakgb_J5m9" + * ``` + */ +export const urlAlphabet: string + +/** + * Generate an array of random bytes collected from hardware noise. + * + * ```js + * import { customRandom, random } from 'nanoid' + * const nanoid = customRandom("abcdef", 5, random) + * ``` + * + * @param bytes Size of the array. + * @returns An array of random bytes. + */ +export function random(bytes: number): Uint8Array diff --git a/node_modules/nanoid/index.js b/node_modules/nanoid/index.js new file mode 100644 index 00000000..5203a4ca --- /dev/null +++ b/node_modules/nanoid/index.js @@ -0,0 +1,85 @@ +import crypto from 'crypto' + +import { urlAlphabet } from './url-alphabet/index.js' + +// It is best to make fewer, larger requests to the crypto module to +// avoid system call overhead. So, random numbers are generated in a +// pool. The pool is a Buffer that is larger than the initial random +// request size by this multiplier. The pool is enlarged if subsequent +// requests exceed the maximum buffer size. +const POOL_SIZE_MULTIPLIER = 128 +let pool, poolOffset + +let fillPool = bytes => { + if (!pool || pool.length < bytes) { + pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER) + crypto.randomFillSync(pool) + poolOffset = 0 + } else if (poolOffset + bytes > pool.length) { + crypto.randomFillSync(pool) + poolOffset = 0 + } + poolOffset += bytes +} + +let random = bytes => { + // `|=` convert `bytes` to number to prevent `valueOf` abusing and pool pollution + fillPool((bytes |= 0)) + return pool.subarray(poolOffset - bytes, poolOffset) +} + +let customRandom = (alphabet, defaultSize, getRandom) => { + // First, a bitmask is necessary to generate the ID. The bitmask makes bytes + // values closer to the alphabet size. The bitmask calculates the closest + // `2^31 - 1` number, which exceeds the alphabet size. + // For example, the bitmask for the alphabet size 30 is 31 (00011111). + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + // Though, the bitmask solution is not perfect since the bytes exceeding + // the alphabet size are refused. Therefore, to reliably generate the ID, + // the random bytes redundancy has to be satisfied. + + // Note: every hardware random generator call is performance expensive, + // because the system call for entropy collection takes a lot of time. + // So, to avoid additional system calls, extra bytes are requested in advance. + + // Next, a step determines how many random bytes to generate. + // The number of random bytes gets decided upon the ID size, mask, + // alphabet size, and magic number 1.6 (using 1.6 peaks at performance + // according to benchmarks). + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + + return (size = defaultSize) => { + let id = '' + while (true) { + let bytes = getRandom(step) + // A compact alternative for `for (let i = 0; i < step; i++)`. + let i = step + while (i--) { + // Adding `|| ''` refuses a random byte that exceeds the alphabet size. + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) + +let nanoid = (size = 21) => { + // `|=` convert `size` to number to prevent `valueOf` abusing and pool pollution + fillPool((size |= 0)) + let id = '' + // We are reading directly from the random pool to avoid creating new array + for (let i = poolOffset - size; i < poolOffset; i++) { + // It is incorrect to use bytes exceeding the alphabet size. + // The following mask reduces the random byte in the 0-255 value + // range to the 0-63 value range. Therefore, adding hacks, such + // as empty string fallback or magic numbers, is unneccessary because + // the bitmask trims bytes down to the alphabet size. + id += urlAlphabet[pool[i] & 63] + } + return id +} + +export { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/nanoid.js b/node_modules/nanoid/nanoid.js new file mode 100644 index 00000000..ec242ead --- /dev/null +++ b/node_modules/nanoid/nanoid.js @@ -0,0 +1 @@ +export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),""); \ No newline at end of file diff --git a/node_modules/nanoid/non-secure/index.cjs b/node_modules/nanoid/non-secure/index.cjs new file mode 100644 index 00000000..d51fcb6c --- /dev/null +++ b/node_modules/nanoid/non-secure/index.cjs @@ -0,0 +1,34 @@ +// This alphabet uses `A-Za-z0-9_-` symbols. +// The order of characters is optimized for better gzip and brotli compression. +// References to the same file (works both for gzip and brotli): +// `'use`, `andom`, and `rict'` +// References to the brotli default dictionary: +// `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf` +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' + +let customAlphabet = (alphabet, defaultSize = 21) => { + return (size = defaultSize) => { + let id = '' + // A compact alternative for `for (var i = 0; i < step; i++)`. + let i = size | 0 + while (i--) { + // `| 0` is more compact and faster than `Math.floor()`. + id += alphabet[(Math.random() * alphabet.length) | 0] + } + return id + } +} + +let nanoid = (size = 21) => { + let id = '' + // A compact alternative for `for (var i = 0; i < step; i++)`. + let i = size | 0 + while (i--) { + // `| 0` is more compact and faster than `Math.floor()`. + id += urlAlphabet[(Math.random() * 64) | 0] + } + return id +} + +module.exports = { nanoid, customAlphabet } diff --git a/node_modules/nanoid/non-secure/index.d.ts b/node_modules/nanoid/non-secure/index.d.ts new file mode 100644 index 00000000..4965322d --- /dev/null +++ b/node_modules/nanoid/non-secure/index.d.ts @@ -0,0 +1,33 @@ +/** + * Generate URL-friendly unique ID. This method uses the non-secure + * predictable random generator with bigger collision probability. + * + * ```js + * import { nanoid } from 'nanoid/non-secure' + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A random string. + */ +export function nanoid(size?: number): string + +/** + * Generate a unique ID based on a custom alphabet. + * This method uses the non-secure predictable random generator + * with bigger collision probability. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A random string generator. + * + * ```js + * import { customAlphabet } from 'nanoid/non-secure' + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * model.id = //=> "8ё56а" + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => string diff --git a/node_modules/nanoid/non-secure/index.js b/node_modules/nanoid/non-secure/index.js new file mode 100644 index 00000000..fcb3e25c --- /dev/null +++ b/node_modules/nanoid/non-secure/index.js @@ -0,0 +1,34 @@ +// This alphabet uses `A-Za-z0-9_-` symbols. +// The order of characters is optimized for better gzip and brotli compression. +// References to the same file (works both for gzip and brotli): +// `'use`, `andom`, and `rict'` +// References to the brotli default dictionary: +// `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf` +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' + +let customAlphabet = (alphabet, defaultSize = 21) => { + return (size = defaultSize) => { + let id = '' + // A compact alternative for `for (var i = 0; i < step; i++)`. + let i = size | 0 + while (i--) { + // `| 0` is more compact and faster than `Math.floor()`. + id += alphabet[(Math.random() * alphabet.length) | 0] + } + return id + } +} + +let nanoid = (size = 21) => { + let id = '' + // A compact alternative for `for (var i = 0; i < step; i++)`. + let i = size | 0 + while (i--) { + // `| 0` is more compact and faster than `Math.floor()`. + id += urlAlphabet[(Math.random() * 64) | 0] + } + return id +} + +export { nanoid, customAlphabet } diff --git a/node_modules/nanoid/non-secure/package.json b/node_modules/nanoid/non-secure/package.json new file mode 100644 index 00000000..9930d6ad --- /dev/null +++ b/node_modules/nanoid/non-secure/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "main": "index.cjs", + "module": "index.js", + "react-native": "index.js" +} \ No newline at end of file diff --git a/node_modules/nanoid/package.json b/node_modules/nanoid/package.json new file mode 100644 index 00000000..b238dca3 --- /dev/null +++ b/node_modules/nanoid/package.json @@ -0,0 +1,88 @@ +{ + "name": "nanoid", + "version": "3.3.8", + "description": "A tiny (116 bytes), secure URL-friendly unique string ID generator", + "keywords": [ + "uuid", + "random", + "id", + "url" + ], + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "author": "Andrey Sitnik ", + "license": "MIT", + "repository": "ai/nanoid", + "browser": { + "./index.js": "./index.browser.js", + "./async/index.js": "./async/index.browser.js", + "./async/index.cjs": "./async/index.browser.cjs", + "./index.cjs": "./index.browser.cjs" + }, + "react-native": "index.js", + "bin": "./bin/nanoid.cjs", + "sideEffects": false, + "types": "./index.d.ts", + "type": "module", + "main": "index.cjs", + "module": "index.js", + "exports": { + ".": { + "browser": "./index.browser.js", + "require": { + "types": "./index.d.cts", + "default": "./index.cjs" + }, + "import": { + "types": "./index.d.ts", + "default": "./index.js" + }, + "default": "./index.js" + }, + "./package.json": "./package.json", + "./async/package.json": "./async/package.json", + "./async": { + "browser": "./async/index.browser.js", + "require": { + "types": "./index.d.cts", + "default": "./async/index.cjs" + }, + "import": { + "types": "./index.d.ts", + "default": "./async/index.js" + }, + "default": "./async/index.js" + }, + "./non-secure/package.json": "./non-secure/package.json", + "./non-secure": { + "require": { + "types": "./index.d.cts", + "default": "./non-secure/index.cjs" + }, + "import": { + "types": "./index.d.ts", + "default": "./non-secure/index.js" + }, + "default": "./non-secure/index.js" + }, + "./url-alphabet/package.json": "./url-alphabet/package.json", + "./url-alphabet": { + "require": { + "types": "./index.d.cts", + "default": "./url-alphabet/index.cjs" + }, + "import": { + "types": "./index.d.ts", + "default": "./url-alphabet/index.js" + }, + "default": "./url-alphabet/index.js" + } + } +} \ No newline at end of file diff --git a/node_modules/nanoid/url-alphabet/index.cjs b/node_modules/nanoid/url-alphabet/index.cjs new file mode 100644 index 00000000..a332f0bf --- /dev/null +++ b/node_modules/nanoid/url-alphabet/index.cjs @@ -0,0 +1,7 @@ +// This alphabet uses `A-Za-z0-9_-` symbols. +// The order of characters is optimized for better gzip and brotli compression. +// Same as in non-secure/index.js +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' + +module.exports = { urlAlphabet } diff --git a/node_modules/nanoid/url-alphabet/index.js b/node_modules/nanoid/url-alphabet/index.js new file mode 100644 index 00000000..27efec8c --- /dev/null +++ b/node_modules/nanoid/url-alphabet/index.js @@ -0,0 +1,7 @@ +// This alphabet uses `A-Za-z0-9_-` symbols. +// The order of characters is optimized for better gzip and brotli compression. +// Same as in non-secure/index.js +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' + +export { urlAlphabet } diff --git a/node_modules/nanoid/url-alphabet/package.json b/node_modules/nanoid/url-alphabet/package.json new file mode 100644 index 00000000..9930d6ad --- /dev/null +++ b/node_modules/nanoid/url-alphabet/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "main": "index.cjs", + "module": "index.js", + "react-native": "index.js" +} \ No newline at end of file diff --git a/node_modules/normalize-path/LICENSE b/node_modules/normalize-path/LICENSE new file mode 100644 index 00000000..d32ab442 --- /dev/null +++ b/node_modules/normalize-path/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2018, Jon Schlinkert. + +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/normalize-path/README.md b/node_modules/normalize-path/README.md new file mode 100644 index 00000000..726d4d68 --- /dev/null +++ b/node_modules/normalize-path/README.md @@ -0,0 +1,127 @@ +# normalize-path [![NPM version](https://img.shields.io/npm/v/normalize-path.svg?style=flat)](https://www.npmjs.com/package/normalize-path) [![NPM monthly downloads](https://img.shields.io/npm/dm/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![NPM total downloads](https://img.shields.io/npm/dt/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/normalize-path.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/normalize-path) + +> Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save normalize-path +``` + +## Usage + +```js +const normalize = require('normalize-path'); + +console.log(normalize('\\foo\\bar\\baz\\')); +//=> '/foo/bar/baz' +``` + +**win32 namespaces** + +```js +console.log(normalize('\\\\?\\UNC\\Server01\\user\\docs\\Letter.txt')); +//=> '//?/UNC/Server01/user/docs/Letter.txt' + +console.log(normalize('\\\\.\\CdRomX')); +//=> '//./CdRomX' +``` + +**Consecutive slashes** + +Condenses multiple consecutive forward slashes (except for leading slashes in win32 namespaces) to a single slash. + +```js +console.log(normalize('.//foo//bar///////baz/')); +//=> './foo/bar/baz' +``` + +### Trailing slashes + +By default trailing slashes are removed. Pass `false` as the last argument to disable this behavior and _**keep** trailing slashes_: + +```js +console.log(normalize('foo\\bar\\baz\\', false)); //=> 'foo/bar/baz/' +console.log(normalize('./foo/bar/baz/', false)); //=> './foo/bar/baz/' +``` + +## Release history + +### v3.0 + +No breaking changes in this release. + +* a check was added to ensure that [win32 namespaces](https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces) are handled properly by win32 `path.parse()` after a path has been normalized by this library. +* a minor optimization was made to simplify how the trailing separator was handled + +## About + +
    +Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
    + +
    +Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
    + +
    +Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
    + +### Related projects + +Other useful path-related libraries: + +* [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path "Return true if a file path contains the given path.") +* [is-absolute](https://www.npmjs.com/package/is-absolute): Returns true if a file path is absolute. Does not rely on the path module… [more](https://github.com/jonschlinkert/is-absolute) | [homepage](https://github.com/jonschlinkert/is-absolute "Returns true if a file path is absolute. Does not rely on the path module and can be used as a polyfill for node.js native `path.isAbolute`.") +* [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative "Returns `true` if the path appears to be relative.") +* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Pollyfill for node.js `path.parse`, parses a filepath into an object. | [homepage](https://github.com/jonschlinkert/parse-filepath "Pollyfill for node.js `path.parse`, parses a filepath into an object.") +* [path-ends-with](https://www.npmjs.com/package/path-ends-with): Return `true` if a file path ends with the given string/suffix. | [homepage](https://github.com/jonschlinkert/path-ends-with "Return `true` if a file path ends with the given string/suffix.") +* [unixify](https://www.npmjs.com/package/unixify): Convert Windows file paths to unix paths. | [homepage](https://github.com/jonschlinkert/unixify "Convert Windows file paths to unix paths.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 35 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [phated](https://github.com/phated) | + +### Author + +**Jon Schlinkert** + +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 19, 2018._ \ No newline at end of file diff --git a/node_modules/normalize-path/index.js b/node_modules/normalize-path/index.js new file mode 100644 index 00000000..6fac553a --- /dev/null +++ b/node_modules/normalize-path/index.js @@ -0,0 +1,35 @@ +/*! + * normalize-path + * + * Copyright (c) 2014-2018, Jon Schlinkert. + * Released under the MIT License. + */ + +module.exports = function(path, stripTrailing) { + if (typeof path !== 'string') { + throw new TypeError('expected path to be a string'); + } + + if (path === '\\' || path === '/') return '/'; + + var len = path.length; + if (len <= 1) return path; + + // ensure that win32 namespaces has two leading slashes, so that the path is + // handled properly by the win32 version of path.parse() after being normalized + // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces + var prefix = ''; + if (len > 4 && path[3] === '\\') { + var ch = path[2]; + if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') { + path = path.slice(2); + prefix = '//'; + } + } + + var segs = path.split(/[/\\]+/); + if (stripTrailing !== false && segs[segs.length - 1] === '') { + segs.pop(); + } + return prefix + segs.join('/'); +}; diff --git a/node_modules/normalize-path/package.json b/node_modules/normalize-path/package.json new file mode 100644 index 00000000..ad61098a --- /dev/null +++ b/node_modules/normalize-path/package.json @@ -0,0 +1,77 @@ +{ + "name": "normalize-path", + "description": "Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled.", + "version": "3.0.0", + "homepage": "https://github.com/jonschlinkert/normalize-path", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Blaine Bublitz (https://twitter.com/BlaineBublitz)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)" + ], + "repository": "jonschlinkert/normalize-path", + "bugs": { + "url": "https://github.com/jonschlinkert/normalize-path/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "gulp-format-md": "^1.0.0", + "minimist": "^1.2.0", + "mocha": "^3.5.3" + }, + "keywords": [ + "absolute", + "backslash", + "delimiter", + "file", + "file-path", + "filepath", + "fix", + "forward", + "fp", + "fs", + "normalize", + "path", + "relative", + "separator", + "slash", + "slashes", + "trailing", + "unix", + "urix" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "description": "Other useful path-related libraries:", + "list": [ + "contains-path", + "is-absolute", + "is-relative", + "parse-filepath", + "path-ends-with", + "path-ends-with", + "unixify" + ] + }, + "lint": { + "reflinks": true + } + } +} diff --git a/node_modules/normalize-range/index.js b/node_modules/normalize-range/index.js new file mode 100644 index 00000000..d5a2ea80 --- /dev/null +++ b/node_modules/normalize-range/index.js @@ -0,0 +1,54 @@ +'use strict'; +module.exports = { + wrap: wrapRange, + limit: limitRange, + validate: validateRange, + test: testRange, + curry: curry, + name: name +}; + +function wrapRange(min, max, value) { + var maxLessMin = max - min; + return ((value - min) % maxLessMin + maxLessMin) % maxLessMin + min; +} + +function limitRange(min, max, value) { + return Math.max(min, Math.min(max, value)); +} + +function validateRange(min, max, value, minExclusive, maxExclusive) { + if (!testRange(min, max, value, minExclusive, maxExclusive)) { + throw new Error(value + ' is outside of range [' + min + ',' + max + ')'); + } + return value; +} + +function testRange(min, max, value, minExclusive, maxExclusive) { + return !( + value < min || + value > max || + (maxExclusive && (value === max)) || + (minExclusive && (value === min)) + ); +} + +function name(min, max, minExcl, maxExcl) { + return (minExcl ? '(' : '[') + min + ',' + max + (maxExcl ? ')' : ']'); +} + +function curry(min, max, minExclusive, maxExclusive) { + var boundNameFn = name.bind(null, min, max, minExclusive, maxExclusive); + return { + wrap: wrapRange.bind(null, min, max), + limit: limitRange.bind(null, min, max), + validate: function(value) { + return validateRange(min, max, value, minExclusive, maxExclusive); + }, + test: function(value) { + return testRange(min, max, value, minExclusive, maxExclusive); + }, + toString: boundNameFn, + name: boundNameFn + }; +} diff --git a/node_modules/normalize-range/license b/node_modules/normalize-range/license new file mode 100644 index 00000000..ad5d021e --- /dev/null +++ b/node_modules/normalize-range/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) James Talmage (github.com/jamestalmage) + +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/normalize-range/package.json b/node_modules/normalize-range/package.json new file mode 100644 index 00000000..b98035ae --- /dev/null +++ b/node_modules/normalize-range/package.json @@ -0,0 +1,46 @@ +{ + "name": "normalize-range", + "version": "0.1.2", + "description": "Utility for normalizing a numeric range, with a wrapping function useful for polar coordinates", + "license": "MIT", + "repository": "jamestalmage/normalize-range", + "author": { + "name": "James Talmage", + "email": "james@talmage.io", + "url": "github.com/jamestalmage" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "npm run cover && npm run lint && npm run style", + "cover": "istanbul cover ./node_modules/.bin/_mocha", + "lint": "jshint --reporter=node_modules/jshint-stylish *.js test/*.js", + "debug": "mocha", + "watch": "mocha -w", + "style": "jscs *.js ./**/*.js && jscs ./test/** --config=./test/.jscsrc" + }, + "files": [ + "index.js" + ], + "keywords": [ + "range", + "normalize", + "utility", + "angle", + "degrees", + "polar" + ], + "dependencies": {}, + "devDependencies": { + "almost-equal": "^1.0.0", + "codeclimate-test-reporter": "^0.1.0", + "coveralls": "^2.11.2", + "istanbul": "^0.3.17", + "jscs": "^2.1.1", + "jshint": "^2.8.0", + "jshint-stylish": "^2.0.1", + "mocha": "^2.2.5", + "stringify-pi": "0.0.3" + } +} diff --git a/node_modules/normalize-range/readme.md b/node_modules/normalize-range/readme.md new file mode 100644 index 00000000..29d84cd2 --- /dev/null +++ b/node_modules/normalize-range/readme.md @@ -0,0 +1,148 @@ +# normalize-range + +Utility for normalizing a numeric range, with a wrapping function useful for polar coordinates. + +[![Build Status](https://travis-ci.org/jamestalmage/normalize-range.svg?branch=master)](https://travis-ci.org/jamestalmage/normalize-range) +[![Coverage Status](https://coveralls.io/repos/jamestalmage/normalize-range/badge.svg?branch=master&service=github)](https://coveralls.io/github/jamestalmage/normalize-range?branch=master) +[![Code Climate](https://codeclimate.com/github/jamestalmage/normalize-range/badges/gpa.svg)](https://codeclimate.com/github/jamestalmage/normalize-range) +[![Dependency Status](https://david-dm.org/jamestalmage/normalize-range.svg)](https://david-dm.org/jamestalmage/normalize-range) +[![devDependency Status](https://david-dm.org/jamestalmage/normalize-range/dev-status.svg)](https://david-dm.org/jamestalmage/normalize-range#info=devDependencies) + +[![NPM](https://nodei.co/npm/normalize-range.png)](https://nodei.co/npm/normalize-range/) + +## Usage + +```js +var nr = require('normalize-range'); + +nr.wrap(0, 360, 400); +//=> 40 + +nr.wrap(0, 360, -90); +//=> 270 + +nr.limit(0, 100, 500); +//=> 100 + +nr.limit(0, 100, -20); +//=> 0 + +// There is a convenient currying function +var wrapAngle = nr.curry(0, 360).wrap; +var limitTo10 = nr.curry(0, 10).limit; + +wrapAngle(-30); +//=> 330 +``` +## API + +### wrap(min, max, value) + +Normalizes a values that "wraps around". For example, in a polar coordinate system, 270˚ can also be +represented as -90˚. +For wrapping purposes we assume `max` is functionally equivalent to `min`, and that `wrap(max + 1) === wrap(min + 1)`. +Wrap always assumes that `min` is *inclusive*, and `max` is *exclusive*. +In other words, if `value === max` the function will wrap it, and return `min`, but `min` will not be wrapped. + +```js +nr.wrap(0, 360, 0) === 0; +nr.wrap(0, 360, 360) === 0; +nr.wrap(0, 360, 361) === 1; +nr.wrap(0, 360, -1) === 359; +``` + +You are not restricted to whole numbers, and ranges can be negative. + +```js +var π = Math.PI; +var radianRange = nr.curry(-π, π); + +redianRange.wrap(0) === 0; +nr.wrap(π) === -π; +nr.wrap(4 * π / 3) === -2 * π / 3; +``` + +### limit(min, max, value) + +Normalize the value by bringing it within the range. +If `value` is greater than `max`, `max` will be returned. +If `value` is less than `min`, `min` will be returned. +Otherwise, `value` is returned unaltered. +Both ends of this range are *inclusive*. + +### test(min, max, value, [minExclusive], [maxExclusive]) + +Returns `true` if `value` is within the range, `false` otherwise. +It defaults to `inclusive` on both ends of the range, but that can be +changed by setting `minExclusive` and/or `maxExclusive` to a truthy value. + +### validate(min, max, value, [minExclusive], [maxExclusive]) + +Returns `value` or throws an error if `value` is outside the specified range. + +### name(min, max, value, [minExclusive], [maxExclusive]) + +Returns a string representing this range in +[range notation](https://en.wikipedia.org/wiki/Interval_(mathematics)#Classification_of_intervals). + +### curry(min, max, [minExclusive], [maxExclusive]) + +Convenience method for currying all method arguments except `value`. + +```js +var angle = require('normalize-range').curry(-180, 180, false, true); + +angle.wrap(270) +//=> -90 + +angle.limit(200) +//=> 180 + +angle.test(0) +//=> true + +angle.validate(300) +//=> throws an Error + +angle.toString() // or angle.name() +//=> "[-180,180)" +``` + +#### min + +*Required* +Type: `number` + +The minimum value (inclusive) of the range. + +#### max + +*Required* +Type: `number` + +The maximum value (exclusive) of the range. + +#### value + +*Required* +Type: `number` + +The value to be normalized. + +#### returns + +Type: `number` + +The normalized value. + +## Building and Releasing + +- `npm test`: tests, linting, coverage and style checks. +- `npm run watch`: autotest mode for active development. +- `npm run debug`: run tests without coverage (istanbul can obscure line #'s) + +Release via `cut-release` tool. + +## License + +MIT © [James Talmage](http://github.com/jamestalmage) diff --git a/node_modules/npm/LICENSE b/node_modules/npm/LICENSE new file mode 100644 index 00000000..0b6c2287 --- /dev/null +++ b/node_modules/npm/LICENSE @@ -0,0 +1,235 @@ +The npm application +Copyright (c) npm, Inc. and Contributors +Licensed on the terms of The Artistic License 2.0 + +Node package dependencies of the npm application +Copyright (c) their respective copyright owners +Licensed on their respective license terms + +The npm public registry at https://registry.npmjs.org +and the npm website at https://www.npmjs.com +Operated by npm, Inc. +Use governed by terms published on https://www.npmjs.com + +"Node.js" +Trademark Joyent, Inc., https://joyent.com +Neither npm nor npm, Inc. are affiliated with Joyent, Inc. + +The Node.js application +Project of Node Foundation, https://nodejs.org + +The npm Logo +Copyright (c) Mathias Pettersson and Brian Hammond + +"Gubblebum Blocky" typeface +Copyright (c) Tjarda Koster, https://jelloween.deviantart.com +Used with permission + + +-------- + + +The Artistic License 2.0 + +Copyright (c) 2000-2006, The Perl Foundation. + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +This license establishes the terms under which a given free software +Package may be copied, modified, distributed, and/or redistributed. +The intent is that the Copyright Holder maintains some artistic +control over the development of that Package while still keeping the +Package available as open source and free software. + +You are always permitted to make arrangements wholly outside of this +license directly with the Copyright Holder of a given Package. If the +terms of this license do not permit the full use that you propose to +make of the Package, you should contact the Copyright Holder and seek +a different licensing arrangement. + +Definitions + + "Copyright Holder" means the individual(s) or organization(s) + named in the copyright notice for the entire Package. + + "Contributor" means any party that has contributed code or other + material to the Package, in accordance with the Copyright Holder's + procedures. + + "You" and "your" means any person who would like to copy, + distribute, or modify the Package. + + "Package" means the collection of files distributed by the + Copyright Holder, and derivatives of that collection and/or of + those files. A given Package may consist of either the Standard + Version, or a Modified Version. + + "Distribute" means providing a copy of the Package or making it + accessible to anyone else, or in the case of a company or + organization, to others outside of your company or organization. + + "Distributor Fee" means any fee that you charge for Distributing + this Package or providing support for this Package to another + party. It does not mean licensing fees. + + "Standard Version" refers to the Package if it has not been + modified, or has been modified only in ways explicitly requested + by the Copyright Holder. + + "Modified Version" means the Package, if it has been changed, and + such changes were not explicitly requested by the Copyright + Holder. + + "Original License" means this Artistic License as Distributed with + the Standard Version of the Package, in its current version or as + it may be modified by The Perl Foundation in the future. + + "Source" form means the source code, documentation source, and + configuration files for the Package. + + "Compiled" form means the compiled bytecode, object code, binary, + or any other form resulting from mechanical transformation or + translation of the Source form. + + +Permission for Use and Modification Without Distribution + +(1) You are permitted to use the Standard Version and create and use +Modified Versions for any purpose without restriction, provided that +you do not Distribute the Modified Version. + + +Permissions for Redistribution of the Standard Version + +(2) You may Distribute verbatim copies of the Source form of the +Standard Version of this Package in any medium without restriction, +either gratis or for a Distributor Fee, provided that you duplicate +all of the original copyright notices and associated disclaimers. At +your discretion, such verbatim copies may or may not include a +Compiled form of the Package. + +(3) You may apply any bug fixes, portability changes, and other +modifications made available from the Copyright Holder. The resulting +Package will still be considered the Standard Version, and as such +will be subject to the Original License. + + +Distribution of Modified Versions of the Package as Source + +(4) You may Distribute your Modified Version as Source (either gratis +or for a Distributor Fee, and with or without a Compiled form of the +Modified Version) provided that you clearly document how it differs +from the Standard Version, including, but not limited to, documenting +any non-standard features, executables, or modules, and provided that +you do at least ONE of the following: + + (a) make the Modified Version available to the Copyright Holder + of the Standard Version, under the Original License, so that the + Copyright Holder may include your modifications in the Standard + Version. + + (b) ensure that installation of your Modified Version does not + prevent the user installing or running the Standard Version. In + addition, the Modified Version must bear a name that is different + from the name of the Standard Version. + + (c) allow anyone who receives a copy of the Modified Version to + make the Source form of the Modified Version available to others + under + + (i) the Original License or + + (ii) a license that permits the licensee to freely copy, + modify and redistribute the Modified Version using the same + licensing terms that apply to the copy that the licensee + received, and requires that the Source form of the Modified + Version, and of any works derived from it, be made freely + available in that license fees are prohibited but Distributor + Fees are allowed. + + +Distribution of Compiled Forms of the Standard Version +or Modified Versions without the Source + +(5) You may Distribute Compiled forms of the Standard Version without +the Source, provided that you include complete instructions on how to +get the Source of the Standard Version. Such instructions must be +valid at the time of your distribution. If these instructions, at any +time while you are carrying out such distribution, become invalid, you +must provide new instructions on demand or cease further distribution. +If you provide valid instructions or cease distribution within thirty +days after you become aware that the instructions are invalid, then +you do not forfeit any of your rights under this license. + +(6) You may Distribute a Modified Version in Compiled form without +the Source, provided that you comply with Section 4 with respect to +the Source of the Modified Version. + + +Aggregating or Linking the Package + +(7) You may aggregate the Package (either the Standard Version or +Modified Version) with other packages and Distribute the resulting +aggregation provided that you do not charge a licensing fee for the +Package. Distributor Fees are permitted, and licensing fees for other +components in the aggregation are permitted. The terms of this license +apply to the use and Distribution of the Standard or Modified Versions +as included in the aggregation. + +(8) You are permitted to link Modified and Standard Versions with +other works, to embed the Package in a larger work of your own, or to +build stand-alone binary or bytecode versions of applications that +include the Package, and Distribute the result without restriction, +provided the result does not expose a direct interface to the Package. + + +Items That are Not Considered Part of a Modified Version + +(9) Works (including, but not limited to, modules and scripts) that +merely extend or make use of the Package, do not, by themselves, cause +the Package to be a Modified Version. In addition, such works are not +considered parts of the Package itself, and are not subject to the +terms of this license. + + +General Provisions + +(10) Any use, modification, and distribution of the Standard or +Modified Versions is governed by this Artistic License. By using, +modifying or distributing the Package, you accept this license. Do not +use, modify, or distribute the Package, if you do not accept this +license. + +(11) If your Modified Version has been derived from a Modified +Version made by someone other than you, you are nevertheless required +to ensure that your Modified Version complies with the requirements of +this license. + +(12) This license does not grant you the right to use any trademark, +service mark, tradename, or logo of the Copyright Holder. + +(13) This license includes the non-exclusive, worldwide, +free-of-charge patent license to make, have made, use, offer to sell, +sell, import and otherwise transfer the Package with respect to any +patent claims licensable by the Copyright Holder that are necessarily +infringed by the Package. If you institute patent litigation +(including a cross-claim or counterclaim) against any party alleging +that the Package constitutes direct or contributory patent +infringement, then this Artistic License to you shall terminate on the +date that such litigation is filed. + +(14) Disclaimer of Warranty: +THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS +IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR +NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL +LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +-------- diff --git a/node_modules/npm/README.md b/node_modules/npm/README.md new file mode 100644 index 00000000..3dc35a38 --- /dev/null +++ b/node_modules/npm/README.md @@ -0,0 +1,63 @@ +# npm - a JavaScript package manager + +[![npm version](https://img.shields.io/npm/v/npm.svg)](https://npm.im/npm) +[![license](https://img.shields.io/npm/l/npm.svg)](https://npm.im/npm) +[![CI - cli](https://github.com/npm/cli/actions/workflows/ci.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci.yml) +[![Benchmark Suite](https://github.com/npm/cli/actions/workflows/benchmark.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/benchmark.yml) + +### Requirements + +One of the following versions of [Node.js](https://nodejs.org/en/download/) must be installed to run **`npm`**: + +* `18.x.x` >= `18.17.0` +* `20.5.0` or higher + +### Installation + +**`npm`** comes bundled with [**`node`**](https://nodejs.org/), & most third-party distributions, by default. Officially supported downloads/distributions can be found at: [nodejs.org/en/download](https://nodejs.org/en/download) + +#### Direct Download + +You can download & install **`npm`** directly from [**npmjs**.com](https://npmjs.com/) using our custom `install.sh` script: + +```bash +curl -qL https://www.npmjs.com/install.sh | sh +``` + +#### Node Version Managers + +If you're looking to manage multiple versions of **`Node.js`** &/or **`npm`**, consider using a [node version manager](https://github.com/search?q=node+version+manager+archived%3Afalse&type=repositories&ref=advsearch) + +### Usage + +```bash +npm +``` + +### Links & Resources + +* [**Documentation**](https://docs.npmjs.com/) - Official docs & how-tos for all things **npm** + * Note: you can also search docs locally with `npm help-search ` +* [**Bug Tracker**](https://github.com/npm/cli/issues) - Search or submit bugs against the CLI +* [**Roadmap**](https://github.com/orgs/github/projects/4247/views/1?filterQuery=npm) - Track & follow along with our public roadmap +* [**Community Feedback and Discussions**](https://github.com/orgs/community/discussions/categories/npm) - Contribute ideas & discussion around the npm registry, website & CLI +* [**RFCs**](https://github.com/npm/rfcs) - Contribute ideas & specifications for the API/design of the npm CLI +* [**Service Status**](https://status.npmjs.org/) - Monitor the current status & see incident reports for the website & registry +* [**Project Status**](https://npm.github.io/statusboard/) - See the health of all our maintained OSS projects in one view +* [**Events Calendar**](https://calendar.google.com/calendar/u/0/embed?src=npmjs.com_oonluqt8oftrt0vmgrfbg6q6go@group.calendar.google.com) - Keep track of our Open RFC calls, releases, meetups, conferences & more +* [**Support**](https://www.npmjs.com/support) - Experiencing problems with the **npm** [website](https://npmjs.com) or [registry](https://registry.npmjs.org)? File a ticket [here](https://www.npmjs.com/support) + +### Acknowledgments + +* `npm` is configured to use the **npm Public Registry** at [https://registry.npmjs.org](https://registry.npmjs.org) by default; Usage of this registry is subject to **Terms of Use** available at [https://npmjs.com/policies/terms](https://npmjs.com/policies/terms) +* You can configure `npm` to use any other compatible registry you prefer. You can read more about configuring third-party registries [here](https://docs.npmjs.com/cli/v7/using-npm/registry) + +### FAQ on Branding + +#### Is it "npm" or "NPM" or "Npm"? + +**`npm`** should never be capitalized unless it is being displayed in a location that is customarily all-capitals (ex. titles on `man` pages). + +#### Is "npm" an acronym for "Node Package Manager"? + +Contrary to popular belief, **`npm`** **is not** in fact an acronym for "Node Package Manager"; It is a recursive bacronymic abbreviation for **"npm is not an acronym"** (if the project was named "ninaa", then it would be an acronym). The precursor to **`npm`** was actually a bash utility named **"pm"**, which was the shortform name of **"pkgmakeinst"** - a bash function that installed various things on various platforms. If **`npm`** were to ever have been considered an acronym, it would be as "node pm" or, potentially "new pm". diff --git a/node_modules/npm/bin/node-gyp-bin/node-gyp b/node_modules/npm/bin/node-gyp-bin/node-gyp new file mode 100755 index 00000000..70efb6f3 --- /dev/null +++ b/node_modules/npm/bin/node-gyp-bin/node-gyp @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +if [ "x$npm_config_node_gyp" = "x" ]; then + node "`dirname "$0"`/../../node_modules/node-gyp/bin/node-gyp.js" "$@" +else + "$npm_config_node_gyp" "$@" +fi diff --git a/node_modules/npm/bin/node-gyp-bin/node-gyp.cmd b/node_modules/npm/bin/node-gyp-bin/node-gyp.cmd new file mode 100755 index 00000000..6816e5bf --- /dev/null +++ b/node_modules/npm/bin/node-gyp-bin/node-gyp.cmd @@ -0,0 +1,5 @@ +if not defined npm_config_node_gyp ( + node "%~dp0\..\..\node_modules\node-gyp\bin\node-gyp.js" %* +) else ( + node "%npm_config_node_gyp%" %* +) diff --git a/node_modules/npm/bin/npm b/node_modules/npm/bin/npm new file mode 100755 index 00000000..027dc9d1 --- /dev/null +++ b/node_modules/npm/bin/npm @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +# This is used by the Node.js installer, which expects the cygwin/mingw +# shell script to already be present in the npm dependency folder. + +(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix + +basedir=`dirname "$0"` + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ `uname` = 'Linux' ] && type wslpath &>/dev/null ; then + IS_WSL="true" +fi + +function no_node_dir { + # if this didn't work, then everything else below will fail + echo "Could not determine Node.js install directory" >&2 + exit 1 +} + +NODE_EXE="$basedir/node.exe" +if ! [ -x "$NODE_EXE" ]; then + NODE_EXE="$basedir/node" +fi +if ! [ -x "$NODE_EXE" ]; then + NODE_EXE=node +fi + +# this path is passed to node.exe, so it needs to match whatever +# kind of paths Node.js thinks it's using, typically win32 paths. +CLI_BASEDIR="$("$NODE_EXE" -p 'require("path").dirname(process.execPath)' 2> /dev/null)" +if [ $? -ne 0 ]; then + # this fails under WSL 1 so add an additional message. we also suppress stderr above + # because the actual error raised is not helpful. in WSL 1 node.exe cannot handle + # output redirection properly. See https://github.com/microsoft/WSL/issues/2370 + if [ "$IS_WSL" == "true" ]; then + echo "WSL 1 is not supported. Please upgrade to WSL 2 or above." >&2 + fi + no_node_dir +fi +NPM_PREFIX_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-prefix.js" +NPM_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-cli.js" +NPM_PREFIX=`"$NODE_EXE" "$NPM_PREFIX_JS"` +if [ $? -ne 0 ]; then + no_node_dir +fi +NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js" + +# a path that will fail -f test on any posix bash +NPM_WSL_PATH="/.." + +# WSL can run Windows binaries, so we have to give it the win32 path +# however, WSL bash tests against posix paths, so we need to construct that +# to know if npm is installed globally. +if [ "$IS_WSL" == "true" ]; then + NPM_WSL_PATH=`wslpath "$NPM_PREFIX_NPM_CLI_JS"` +fi +if [ -f "$NPM_PREFIX_NPM_CLI_JS" ] || [ -f "$NPM_WSL_PATH" ]; then + NPM_CLI_JS="$NPM_PREFIX_NPM_CLI_JS" +fi + +"$NODE_EXE" "$NPM_CLI_JS" "$@" diff --git a/node_modules/npm/bin/npm-cli.js b/node_modules/npm/bin/npm-cli.js new file mode 100755 index 00000000..577abe03 --- /dev/null +++ b/node_modules/npm/bin/npm-cli.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('../lib/cli.js')(process) diff --git a/node_modules/npm/bin/npm-prefix.js b/node_modules/npm/bin/npm-prefix.js new file mode 100755 index 00000000..b0b0ace6 --- /dev/null +++ b/node_modules/npm/bin/npm-prefix.js @@ -0,0 +1,30 @@ +#!/usr/bin/env node +// This is a single-use bin to help windows discover the proper prefix for npm +// without having to load all of npm first +// It does not accept argv params + +const path = require('node:path') +const Config = require('@npmcli/config') +const { definitions, flatten, shorthands } = require('@npmcli/config/lib/definitions') +const config = new Config({ + npmPath: path.dirname(__dirname), + // argv is explicitly not looked at since prefix is not something that can be changed via argv + argv: [], + definitions, + flatten, + shorthands, + excludeNpmCwd: false, +}) + +async function main () { + try { + await config.load() + // eslint-disable-next-line no-console + console.log(config.globalPrefix) + } catch (err) { + // eslint-disable-next-line no-console + console.error(err) + process.exit(1) + } +} +main() diff --git a/node_modules/npm/bin/npm.cmd b/node_modules/npm/bin/npm.cmd new file mode 100755 index 00000000..1a02e83a --- /dev/null +++ b/node_modules/npm/bin/npm.cmd @@ -0,0 +1,20 @@ +:: Created by npm, please don't edit manually. +@ECHO OFF + +SETLOCAL + +SET "NODE_EXE=%~dp0\node.exe" +IF NOT EXIST "%NODE_EXE%" ( + SET "NODE_EXE=node" +) + +SET "NPM_PREFIX_JS=%~dp0\node_modules\npm\bin\npm-prefix.js" +SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js" +FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_PREFIX_JS%"') DO ( + SET "NPM_PREFIX_NPM_CLI_JS=%%F\node_modules\npm\bin\npm-cli.js" +) +IF EXIST "%NPM_PREFIX_NPM_CLI_JS%" ( + SET "NPM_CLI_JS=%NPM_PREFIX_NPM_CLI_JS%" +) + +"%NODE_EXE%" "%NPM_CLI_JS%" %* diff --git a/node_modules/npm/bin/npm.ps1 b/node_modules/npm/bin/npm.ps1 new file mode 100644 index 00000000..04a1fd47 --- /dev/null +++ b/node_modules/npm/bin/npm.ps1 @@ -0,0 +1,32 @@ +#!/usr/bin/env pwsh + +$NODE_EXE="$PSScriptRoot/node.exe" +if (-not (Test-Path $NODE_EXE)) { + $NODE_EXE="$PSScriptRoot/node" +} +if (-not (Test-Path $NODE_EXE)) { + $NODE_EXE="node" +} + +$NPM_PREFIX_JS="$PSScriptRoot/node_modules/npm/bin/npm-prefix.js" +$NPM_CLI_JS="$PSScriptRoot/node_modules/npm/bin/npm-cli.js" +$NPM_PREFIX=(& $NODE_EXE $NPM_PREFIX_JS) + +if ($LASTEXITCODE -ne 0) { + Write-Host "Could not determine Node.js install directory" + exit 1 +} + +$NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js" +if (Test-Path $NPM_PREFIX_NPM_CLI_JS) { + $NPM_CLI_JS=$NPM_PREFIX_NPM_CLI_JS +} + +# Support pipeline input +if ($MyInvocation.ExpectingInput) { + $input | & $NODE_EXE $NPM_CLI_JS $args +} else { + & $NODE_EXE $NPM_CLI_JS $args +} + +exit $LASTEXITCODE diff --git a/node_modules/npm/bin/npx b/node_modules/npm/bin/npx new file mode 100755 index 00000000..b8619ee9 --- /dev/null +++ b/node_modules/npm/bin/npx @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +# This is used by the Node.js installer, which expects the cygwin/mingw +# shell script to already be present in the npm dependency folder. + +(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix + +basedir=`dirname "$0"` + +case `uname` in + *CYGWIN*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ `uname` = 'Linux' ] && type wslpath &>/dev/null ; then + IS_WSL="true" +fi + +function no_node_dir { + # if this didn't work, then everything else below will fail + echo "Could not determine Node.js install directory" >&2 + exit 1 +} + +NODE_EXE="$basedir/node.exe" +if ! [ -x "$NODE_EXE" ]; then + NODE_EXE="$basedir/node" +fi +if ! [ -x "$NODE_EXE" ]; then + NODE_EXE=node +fi + +# this path is passed to node.exe, so it needs to match whatever +# kind of paths Node.js thinks it's using, typically win32 paths. +CLI_BASEDIR="$("$NODE_EXE" -p 'require("path").dirname(process.execPath)' 2> /dev/null)" +if [ $? -ne 0 ]; then + # this fails under WSL 1 so add an additional message. we also suppress stderr above + # because the actual error raised is not helpful. in WSL 1 node.exe cannot handle + # output redirection properly. See https://github.com/microsoft/WSL/issues/2370 + if [ "$IS_WSL" == "true" ]; then + echo "WSL 1 is not supported. Please upgrade to WSL 2 or above." >&2 + fi + no_node_dir +fi +NPM_PREFIX_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-prefix.js" +NPX_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npx-cli.js" +NPM_PREFIX=`"$NODE_EXE" "$NPM_PREFIX_JS"` +if [ $? -ne 0 ]; then + no_node_dir +fi +NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js" + +# a path that will fail -f test on any posix bash +NPX_WSL_PATH="/.." + +# WSL can run Windows binaries, so we have to give it the win32 path +# however, WSL bash tests against posix paths, so we need to construct that +# to know if npm is installed globally. +if [ "$IS_WSL" == "true" ]; then + NPX_WSL_PATH=`wslpath "$NPM_PREFIX_NPX_CLI_JS"` +fi +if [ -f "$NPM_PREFIX_NPX_CLI_JS" ] || [ -f "$NPX_WSL_PATH" ]; then + NPX_CLI_JS="$NPM_PREFIX_NPX_CLI_JS" +fi + +"$NODE_EXE" "$NPX_CLI_JS" "$@" diff --git a/node_modules/npm/bin/npx-cli.js b/node_modules/npm/bin/npx-cli.js new file mode 100755 index 00000000..e2e1b879 --- /dev/null +++ b/node_modules/npm/bin/npx-cli.js @@ -0,0 +1,130 @@ +#!/usr/bin/env node + +const cli = require('../lib/cli.js') + +// run the resulting command as `npm exec ...args` +process.argv[1] = require.resolve('./npm-cli.js') +process.argv.splice(2, 0, 'exec') + +// TODO: remove the affordances for removed items in npm v9 +const removedSwitches = new Set([ + 'always-spawn', + 'ignore-existing', + 'shell-auto-fallback', +]) + +const removedOpts = new Set([ + 'npm', + 'node-arg', + 'n', +]) + +const removed = new Set([ + ...removedSwitches, + ...removedOpts, +]) + +const { definitions, shorthands } = require('@npmcli/config/lib/definitions') +const npmSwitches = Object.entries(definitions) + .filter(([, { type }]) => type === Boolean || + (Array.isArray(type) && type.includes(Boolean))) + .map(([key]) => key) + +// things that don't take a value +const switches = new Set([ + ...removedSwitches, + ...npmSwitches, + 'no-install', + 'quiet', + 'q', + 'version', + 'v', + 'help', + 'h', +]) + +// things that do take a value +const opts = new Set([ + ...removedOpts, + 'package', + 'p', + 'cache', + 'userconfig', + 'call', + 'c', + 'shell', + 'npm', + 'node-arg', + 'n', +]) + +// break out of loop when we find a positional argument or -- +// If we find a positional arg, we shove -- in front of it, and +// let the normal npm cli handle the rest. +let i +let sawRemovedFlags = false +for (i = 3; i < process.argv.length; i++) { + const arg = process.argv[i] + if (arg === '--') { + break + } else if (/^-/.test(arg)) { + const [key, ...v] = arg.replace(/^-+/, '').split('=') + + switch (key) { + case 'p': + process.argv[i] = ['--package', ...v].join('=') + break + + case 'shell': + process.argv[i] = ['--script-shell', ...v].join('=') + break + + case 'no-install': + process.argv[i] = '--yes=false' + break + + default: + // resolve shorthands and run again + if (shorthands[key] && !removed.has(key)) { + const a = [...shorthands[key]] + if (v.length) { + a.push(v.join('=')) + } + process.argv.splice(i, 1, ...a) + i-- + continue + } + break + } + + if (removed.has(key)) { + // eslint-disable-next-line no-console + console.error(`npx: the --${key} argument has been removed.`) + sawRemovedFlags = true + process.argv.splice(i, 1) + i-- + } + + if (v.length === 0 && !switches.has(key) && + (opts.has(key) || !/^-/.test(process.argv[i + 1]))) { + // value will be next argument, skip over it. + if (removed.has(key)) { + // also remove the value for the cut key. + process.argv.splice(i + 1, 1) + } else { + i++ + } + } + } else { + // found a positional arg, put -- in front of it, and we're done + process.argv.splice(i, 0, '--') + break + } +} + +if (sawRemovedFlags) { + // eslint-disable-next-line no-console + console.error('See `npm help exec` for more information') +} + +cli(process) diff --git a/node_modules/npm/bin/npx.cmd b/node_modules/npm/bin/npx.cmd new file mode 100755 index 00000000..0f02d2dc --- /dev/null +++ b/node_modules/npm/bin/npx.cmd @@ -0,0 +1,20 @@ +:: Created by npm, please don't edit manually. +@ECHO OFF + +SETLOCAL + +SET "NODE_EXE=%~dp0\node.exe" +IF NOT EXIST "%NODE_EXE%" ( + SET "NODE_EXE=node" +) + +SET "NPM_PREFIX_JS=%~dp0\node_modules\npm\bin\npm-prefix.js" +SET "NPX_CLI_JS=%~dp0\node_modules\npm\bin\npx-cli.js" +FOR /F "delims=" %%F IN ('CALL "%NODE_EXE%" "%NPM_PREFIX_JS%"') DO ( + SET "NPM_PREFIX_NPX_CLI_JS=%%F\node_modules\npm\bin\npx-cli.js" +) +IF EXIST "%NPM_PREFIX_NPX_CLI_JS%" ( + SET "NPX_CLI_JS=%NPM_PREFIX_NPX_CLI_JS%" +) + +"%NODE_EXE%" "%NPX_CLI_JS%" %* diff --git a/node_modules/npm/bin/npx.ps1 b/node_modules/npm/bin/npx.ps1 new file mode 100644 index 00000000..28dae51b --- /dev/null +++ b/node_modules/npm/bin/npx.ps1 @@ -0,0 +1,32 @@ +#!/usr/bin/env pwsh + +$NODE_EXE="$PSScriptRoot/node.exe" +if (-not (Test-Path $NODE_EXE)) { + $NODE_EXE="$PSScriptRoot/node" +} +if (-not (Test-Path $NODE_EXE)) { + $NODE_EXE="node" +} + +$NPM_PREFIX_JS="$PSScriptRoot/node_modules/npm/bin/npm-prefix.js" +$NPX_CLI_JS="$PSScriptRoot/node_modules/npm/bin/npx-cli.js" +$NPM_PREFIX=(& $NODE_EXE $NPM_PREFIX_JS) + +if ($LASTEXITCODE -ne 0) { + Write-Host "Could not determine Node.js install directory" + exit 1 +} + +$NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js" +if (Test-Path $NPM_PREFIX_NPX_CLI_JS) { + $NPX_CLI_JS=$NPM_PREFIX_NPX_CLI_JS +} + +# Support pipeline input +if ($MyInvocation.ExpectingInput) { + $input | & $NODE_EXE $NPX_CLI_JS $args +} else { + & $NODE_EXE $NPX_CLI_JS $args +} + +exit $LASTEXITCODE diff --git a/node_modules/npm/docs/content/commands/npm-access.md b/node_modules/npm/docs/content/commands/npm-access.md new file mode 100644 index 00000000..e08030de --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-access.md @@ -0,0 +1,123 @@ +--- +title: npm-access +section: 1 +description: Set access level on published packages +--- + +### Synopsis + +```bash +npm access list packages [||] [] +npm access list collaborators [ []] +npm access get status [] +npm access set status=public|private [] +npm access set mfa=none|publish|automation [] +npm access grant [] +npm access revoke [] +``` + +Note: This command is unaware of workspaces. + +### Description + +Used to set access controls on private packages. + +For all of the subcommands, `npm access` will perform actions on the packages +in the current working directory if no package name is passed to the +subcommand. + +* public / restricted (deprecated): + Set a package to be either publicly accessible or restricted. + +* grant / revoke (deprecated): + Add or remove the ability of users and teams to have read-only or read-write + access to a package. + +* 2fa-required / 2fa-not-required (deprecated): + Configure whether a package requires that anyone publishing it have two-factor + authentication enabled on their account. + +* ls-packages (deprecated): + Show all of the packages a user or a team is able to access, along with the + access level, except for read-only public packages (it won't print the whole + registry listing) + +* ls-collaborators (deprecated): + Show all of the access privileges for a package. Will only show permissions + for packages to which you have at least read access. If `` is passed in, + the list is filtered only to teams _that_ user happens to belong to. + +* edit (not implemented) + +### Details + +`npm access` always operates directly on the current registry, configurable +from the command line using `--registry=`. + +Unscoped packages are *always public*. + +Scoped packages *default to restricted*, but you can either publish them as +public using `npm publish --access=public`, or set their access as public using +`npm access public` after the initial publish. + +You must have privileges to set the access of a package: + +* You are an owner of an unscoped or scoped package. +* You are a member of the team that owns a scope. +* You have been given read-write privileges for a package, either as a member + of a team or directly as an owner. + +If you have two-factor authentication enabled then you'll be prompted to provide a second factor, or may use the `--otp=...` option to specify it on +the command line. + +If your account is not paid, then attempts to publish scoped packages will +fail with an HTTP 402 status code (logically enough), unless you use +`--access=public`. + +Management of teams and team memberships is done with the `npm team` command. + +### Configuration + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +### See Also + +* [`libnpmaccess`](https://npm.im/libnpmaccess) +* [npm team](/commands/npm-team) +* [npm publish](/commands/npm-publish) +* [npm config](/commands/npm-config) +* [npm registry](/using-npm/registry) diff --git a/node_modules/npm/docs/content/commands/npm-adduser.md b/node_modules/npm/docs/content/commands/npm-adduser.md new file mode 100644 index 00000000..e19b3e3a --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-adduser.md @@ -0,0 +1,86 @@ +--- +title: npm-adduser +section: 1 +description: Add a registry user account +--- + +### Synopsis + +```bash +npm adduser + +alias: add-user +``` + +Note: This command is unaware of workspaces. + +### Description + +Create a new user in the specified registry, and save the credentials to +the `.npmrc` file. If no registry is specified, the default registry +will be used (see [`registry`](/using-npm/registry)). + +When using `legacy` for your `auth-type`, the username, password, and +email are read in from prompts. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `scope` + +* Default: the scope of the current project, if any, or "" +* Type: String + +Associate an operation with a scope for a scoped registry. + +Useful when logging in to or out of a private registry: + +``` +# log in, linking the scope to the custom registry +npm login --scope=@mycorp --registry=https://registry.mycorp.com + +# log out, removing the link and the auth token +npm logout --scope=@mycorp +``` + +This will cause `@mycorp` to be mapped to the registry for future +installation of packages specified according to the pattern +`@mycorp/package`. + +This will also cause `npm init` to create a scoped package. + +``` +# accept all defaults, and create a package named "@foo/whatever", +# instead of just named "whatever" +npm init --scope=@foo --yes +``` + + + +#### `auth-type` + +* Default: "web" +* Type: "legacy" or "web" + +What authentication strategy to use with `login`. Note that if an `otp` +config is given, this value will always be set to `legacy`. + + + +### See Also + +* [npm registry](/using-npm/registry) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm owner](/commands/npm-owner) +* [npm whoami](/commands/npm-whoami) +* [npm token](/commands/npm-token) +* [npm profile](/commands/npm-profile) diff --git a/node_modules/npm/docs/content/commands/npm-audit.md b/node_modules/npm/docs/content/commands/npm-audit.md new file mode 100644 index 00000000..a7e0db74 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-audit.md @@ -0,0 +1,478 @@ +--- +title: npm-audit +section: 1 +description: Run a security audit +--- + +### Synopsis + +```bash +npm audit [fix|signatures] +``` + +### Description + +The audit command submits a description of the dependencies configured in +your project to your default registry and asks for a report of known +vulnerabilities. If any vulnerabilities are found, then the impact and +appropriate remediation will be calculated. If the `fix` argument is +provided, then remediations will be applied to the package tree. + +The command will exit with a 0 exit code if no vulnerabilities were found. + +Note that some vulnerabilities cannot be fixed automatically and will +require manual intervention or review. Also note that since `npm audit +fix` runs a full-fledged `npm install` under the hood, all configs that +apply to the installer will also apply to `npm install` -- so things like +`npm audit fix --package-lock-only` will work as expected. + +By default, the audit command will exit with a non-zero code if any +vulnerability is found. It may be useful in CI environments to include the +`--audit-level` parameter to specify the minimum vulnerability level that +will cause the command to fail. This option does not filter the report +output, it simply changes the command's failure threshold. + +### Package lock + +By default npm requires a package-lock or shrinkwrap in order to run the +audit. You can bypass the package lock with `--no-package-lock` but be +aware the results may be different with every run, since npm will +re-build the dependency tree each time. + +### Audit Signatures + +To ensure the integrity of packages you download from the public npm registry, or any registry that supports signatures, you can verify the registry signatures of downloaded packages using the npm CLI. + +Registry signatures can be verified using the following `audit` command: + +```bash +$ npm audit signatures +``` + +The `audit signatures` command will also verify the provenance attestations of +downloaded packages. Because provenance attestations are such a new feature, +security features may be added to (or changed in) the attestation format over +time. To ensure that you're always able to verify attestation signatures check +that you're running the latest version of the npm CLI. Please note this often +means updating npm beyond the version that ships with Node.js. + +The npm CLI supports registry signatures and signing keys provided by any registry if the following conventions are followed: + +1. Signatures are provided in the package's `packument` in each published version within the `dist` object: + +```json +"dist":{ + "..omitted..": "..omitted..", + "signatures": [{ + "keyid": "SHA256:{{SHA256_PUBLIC_KEY}}", + "sig": "a312b9c3cb4a1b693e8ebac5ee1ca9cc01f2661c14391917dcb111517f72370809..." + }] +} +``` + +See this [example](https://registry.npmjs.org/light-cycle/1.4.3) of a signed package from the public npm registry. + +The `sig` is generated using the following template: `${package.name}@${package.version}:${package.dist.integrity}` and the `keyid` has to match one of the public signing keys below. + +2. Public signing keys are provided at `registry-host.tld/-/npm/v1/keys` in the following format: + +``` +{ + "keys": [{ + "expires": null, + "keyid": "SHA256:{{SHA256_PUBLIC_KEY}}", + "keytype": "ecdsa-sha2-nistp256", + "scheme": "ecdsa-sha2-nistp256", + "key": "{{B64_PUBLIC_KEY}}" + }] +} +``` + +Keys response: + +- `expires`: null or a simplified extended [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDTHH:mm:ss.sssZ` +- `keydid`: sha256 fingerprint of the public key +- `keytype`: only `ecdsa-sha2-nistp256` is currently supported by the npm CLI +- `scheme`: only `ecdsa-sha2-nistp256` is currently supported by the npm CLI +- `key`: base64 encoded public key + +See this [example key's response from the public npm registry](https://registry.npmjs.org/-/npm/v1/keys). + +### Audit Endpoints + +There are two audit endpoints that npm may use to fetch vulnerability +information: the `Bulk Advisory` endpoint and the `Quick Audit` endpoint. + +#### Bulk Advisory Endpoint + +As of version 7, npm uses the much faster `Bulk Advisory` endpoint to +optimize the speed of calculating audit results. + +npm will generate a JSON payload with the name and list of versions of each +package in the tree, and POST it to the default configured registry at +the path `/-/npm/v1/security/advisories/bulk`. + +Any packages in the tree that do not have a `version` field in their +package.json file will be ignored. If any `--omit` options are specified +(either via the [`--omit` config](/using-npm/config#omit), or one of the +shorthands such as `--production`, `--only=dev`, and so on), then packages will +be omitted from the submitted payload as appropriate. + +If the registry responds with an error, or with an invalid response, then +npm will attempt to load advisory data from the `Quick Audit` endpoint. + +The expected result will contain a set of advisory objects for each +dependency that matches the advisory range. Each advisory object contains +a `name`, `url`, `id`, `severity`, `vulnerable_versions`, and `title`. + +npm then uses these advisory objects to calculate vulnerabilities and +meta-vulnerabilities of the dependencies within the tree. + +#### Quick Audit Endpoint + +If the `Bulk Advisory` endpoint returns an error, or invalid data, npm will +attempt to load advisory data from the `Quick Audit` endpoint, which is +considerably slower in most cases. + +The full package tree as found in `package-lock.json` is submitted, along +with the following pieces of additional metadata: + +* `npm_version` +* `node_version` +* `platform` +* `arch` +* `node_env` + +All packages in the tree are submitted to the Quick Audit endpoint. +Omitted dependency types are skipped when generating the report. + +#### Scrubbing + +Out of an abundance of caution, npm versions 5 and 6 would "scrub" any +packages from the submitted report if their name contained a `/` character, +so as to avoid leaking the names of potentially private packages or git +URLs. + +However, in practice, this resulted in audits often failing to properly +detect meta-vulnerabilities, because the tree would appear to be invalid +due to missing dependencies, and prevented the detection of vulnerabilities +in package trees that used git dependencies or private modules. + +This scrubbing has been removed from npm as of version 7. + +#### Calculating Meta-Vulnerabilities and Remediations + +npm uses the +[`@npmcli/metavuln-calculator`](http://npm.im/@npmcli/metavuln-calculator) +module to turn a set of security advisories into a set of "vulnerability" +objects. A "meta-vulnerability" is a dependency that is vulnerable by +virtue of dependence on vulnerable versions of a vulnerable package. + +For example, if the package `foo` is vulnerable in the range `>=1.0.2 +<2.0.0`, and the package `bar` depends on `foo@^1.1.0`, then that version +of `bar` can only be installed by installing a vulnerable version of `foo`. +In this case, `bar` is a "metavulnerability". + +Once metavulnerabilities for a given package are calculated, they are +cached in the `~/.npm` folder and only re-evaluated if the advisory range +changes, or a new version of the package is published (in which case, the +new version is checked for metavulnerable status as well). + +If the chain of metavulnerabilities extends all the way to the root +project, and it cannot be updated without changing its dependency ranges, +then `npm audit fix` will require the `--force` option to apply the +remediation. If remediations do not require changes to the dependency +ranges, then all vulnerable packages will be updated to a version that does +not have an advisory or metavulnerability posted against it. + +### Exit Code + +The `npm audit` command will exit with a 0 exit code if no vulnerabilities +were found. The `npm audit fix` command will exit with 0 exit code if no +vulnerabilities are found _or_ if the remediation is able to successfully +fix all vulnerabilities. + +If vulnerabilities were found the exit code will depend on the +[`audit-level` config](/using-npm/config#audit-level). + +### Examples + +Scan your project for vulnerabilities and automatically install any compatible +updates to vulnerable dependencies: + +```bash +$ npm audit fix +``` + +Run `audit fix` without modifying `node_modules`, but still updating the +pkglock: + +```bash +$ npm audit fix --package-lock-only +``` + +Skip updating `devDependencies`: + +```bash +$ npm audit fix --only=prod +``` + +Have `audit fix` install SemVer-major updates to toplevel dependencies, not +just SemVer-compatible ones: + +```bash +$ npm audit fix --force +``` + +Do a dry run to get an idea of what `audit fix` will do, and _also_ output +install information in JSON format: + +```bash +$ npm audit fix --dry-run --json +``` + +Scan your project for vulnerabilities and just show the details, without +fixing anything: + +```bash +$ npm audit +``` + +Get the detailed audit report in JSON format: + +```bash +$ npm audit --json +``` + +Fail an audit only if the results include a vulnerability with a level of moderate or higher: + +```bash +$ npm audit --audit-level=moderate +``` + +### Configuration + +#### `audit-level` + +* Default: null +* Type: null, "info", "low", "moderate", "high", "critical", or "none" + +The minimum level of vulnerability for `npm audit` to exit with a non-zero +exit code. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `force` + +* Default: false +* Type: Boolean + +Removes various protections against unfortunate side effects, common +mistakes, unnecessary performance degradation, and malicious input. + +* Allow clobbering non-npm files in global installs. +* Allow the `npm version` command to work on an unclean git repository. +* Allow deleting the cache folder with `npm cache clean`. +* Allow installing packages that have an `engines` declaration requiring a + different version of npm. +* Allow installing packages that have an `engines` declaration requiring a + different version of `node`, even if `--engine-strict` is enabled. +* Allow `npm audit fix` to install modules outside your stated dependency + range (including SemVer-major changes). +* Allow unpublishing all versions of a published package. +* Allow conflicting peerDependencies to be installed in the root project. +* Implicitly set `--yes` during `npm init`. +* Allow clobbering existing values in `npm pkg` +* Allow unpublishing of entire packages (not just a single version). + +If you don't have a clear idea of what you want to do, it is strongly +recommended that you do not use this option! + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `package-lock-only` + +* Default: false +* Type: Boolean + +If set to true, the current operation will only use the `package-lock.json`, +ignoring `node_modules`. + +For `update` this means only the `package-lock.json` will be updated, +instead of checking `node_modules` and downloading dependencies. + +For `list` this means the output will be based on the tree described by the +`package-lock.json`, rather than the contents of `node_modules`. + + + +#### `package-lock` + +* Default: true +* Type: Boolean + +If set to false, then ignore `package-lock.json` files when installing. This +will also prevent _writing_ `package-lock.json` if `save` is true. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `foreground-scripts` + +* Default: `false` unless when using `npm pack` or `npm publish` where it + defaults to `true` +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [npm install](/commands/npm-install) +* [config](/using-npm/config) diff --git a/node_modules/npm/docs/content/commands/npm-bugs.md b/node_modules/npm/docs/content/commands/npm-bugs.md new file mode 100644 index 00000000..4fb660a3 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-bugs.md @@ -0,0 +1,109 @@ +--- +title: npm-bugs +section: 1 +description: Report bugs for a package in a web browser +--- + +### Synopsis + +```bash +npm bugs [ [ ...]] + +alias: issues +``` + +### Description + +This command tries to guess at the likely location of a package's bug +tracker URL or the `mailto` URL of the support email, and then tries to +open it using the [`--browser` config](/using-npm/config#browser) param. If no +package name is provided, it will search for a `package.json` in the current +folder and use the `name` property. + +### Configuration + +#### `browser` + +* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"` +* Type: null, Boolean, or String + +The browser that is called by npm commands to open websites. + +Set to `false` to suppress browser behavior and instead print urls to +terminal. + +Set to `true` to use default system URL opener. + + + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +### See Also + +* [npm docs](/commands/npm-docs) +* [npm view](/commands/npm-view) +* [npm publish](/commands/npm-publish) +* [npm registry](/using-npm/registry) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [package.json](/configuring-npm/package-json) diff --git a/node_modules/npm/docs/content/commands/npm-cache.md b/node_modules/npm/docs/content/commands/npm-cache.md new file mode 100644 index 00000000..1697be92 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-cache.md @@ -0,0 +1,94 @@ +--- +title: npm-cache +section: 1 +description: Manipulates packages cache +--- + +### Synopsis + +```bash +npm cache add +npm cache clean [] +npm cache ls [@] +npm cache verify +``` + +Note: This command is unaware of workspaces. + +### Description + +Used to add, list, or clean the npm cache folder. + +* add: + Add the specified packages to the local cache. This command is primarily + intended to be used internally by npm, but it can provide a way to + add data to the local installation cache explicitly. + +* clean: + Delete all data out of the cache folder. Note that this is typically + unnecessary, as npm's cache is self-healing and resistant to data + corruption issues. + +* verify: + Verify the contents of the cache folder, garbage collecting any unneeded + data, and verifying the integrity of the cache index and all cached data. + +### Details + +npm stores cache data in an opaque directory within the configured `cache`, +named `_cacache`. This directory is a +[`cacache`](http://npm.im/cacache)-based content-addressable cache that +stores all http request data as well as other package-related data. This +directory is primarily accessed through `pacote`, the library responsible +for all package fetching as of npm@5. + +All data that passes through the cache is fully verified for integrity on +both insertion and extraction. Cache corruption will either trigger an +error, or signal to `pacote` that the data must be refetched, which it will +do automatically. For this reason, it should never be necessary to clear +the cache for any reason other than reclaiming disk space, thus why `clean` +now requires `--force` to run. + +There is currently no method exposed through npm to inspect or directly +manage the contents of this cache. In order to access it, `cacache` must be +used directly. + +npm will not remove data by itself: the cache will grow as new packages are +installed. + +### A note about the cache's design + +The npm cache is strictly a cache: it should not be relied upon as a +persistent and reliable data store for package data. npm makes no guarantee +that a previously-cached piece of data will be available later, and will +automatically delete corrupted contents. The primary guarantee that the +cache makes is that, if it does return data, that data will be exactly the +data that was inserted. + +To run an offline verification of existing cache contents, use `npm cache +verify`. + +### Configuration + +#### `cache` + +* Default: Windows: `%LocalAppData%\npm-cache`, Posix: `~/.npm` +* Type: Path + +The location of npm's cache directory. + + + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm folders](/configuring-npm/folders) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm install](/commands/npm-install) +* [npm publish](/commands/npm-publish) +* [npm pack](/commands/npm-pack) +* https://npm.im/cacache +* https://npm.im/pacote +* https://npm.im/@npmcli/arborist +* https://npm.im/make-fetch-happen diff --git a/node_modules/npm/docs/content/commands/npm-ci.md b/node_modules/npm/docs/content/commands/npm-ci.md new file mode 100644 index 00000000..d74922ff --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-ci.md @@ -0,0 +1,318 @@ +--- +title: npm-ci +section: 1 +description: Clean install a project +--- + +### Synopsis + +```bash +npm ci + +aliases: clean-install, ic, install-clean, isntall-clean +``` + +### Description + +This command is similar to [`npm install`](/commands/npm-install), except +it's meant to be used in automated environments such as test platforms, +continuous integration, and deployment -- or any situation where you want +to make sure you're doing a clean install of your dependencies. + +The main differences between using `npm install` and `npm ci` are: + +* The project **must** have an existing `package-lock.json` or + `npm-shrinkwrap.json`. +* If dependencies in the package lock do not match those in `package.json`, + `npm ci` will exit with an error, instead of updating the package lock. +* `npm ci` can only install entire projects at a time: individual + dependencies cannot be added with this command. +* If a `node_modules` is already present, it will be automatically removed + before `npm ci` begins its install. +* It will never write to `package.json` or any of the package-locks: + installs are essentially frozen. + +NOTE: If you create your `package-lock.json` file by running `npm install` +with flags that can affect the shape of your dependency tree, such as +`--legacy-peer-deps` or `--install-links`, you _must_ provide the same +flags to `npm ci` or you are likely to encounter errors. An easy way to do +this is to run, for example, +`npm config set legacy-peer-deps=true --location=project` and commit the +`.npmrc` file to your repo. + +### Example + +Make sure you have a package-lock and an up-to-date install: + +```bash +$ cd ./my/npm/project +$ npm install +added 154 packages in 10s +$ ls | grep package-lock +``` + +Run `npm ci` in that project + +```bash +$ npm ci +added 154 packages in 5s +``` + +Configure Travis CI to build using `npm ci` instead of `npm install`: + +```bash +# .travis.yml +install: +- npm ci +# keep the npm cache around to speed up installs +cache: + directories: + - "$HOME/.npm" +``` + +### Configuration + +#### `install-strategy` + +* Default: "hoisted" +* Type: "hoisted", "nested", "shallow", or "linked" + +Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted. + + + +#### `legacy-bundling` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=nested` + +Instead of hoisting package installs in `node_modules`, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets `--install-strategy=nested`. + + + +#### `global-style` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=shallow` + +Only install direct dependencies in the top level `node_modules`, but hoist +on deeper dependencies. Sets `--install-strategy=shallow`. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `strict-peer-deps` + +* Default: false +* Type: Boolean + +If set to `true`, and `--legacy-peer-deps` is not set, then _any_ +conflicting `peerDependencies` will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships. + +By default, conflicting `peerDependencies` deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's `peerDependencies` object. + +When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If `--strict-peer-deps` is set, then +this warning is treated as a failure. + + + +#### `foreground-scripts` + +* Default: `false` unless when using `npm pack` or `npm publish` where it + defaults to `true` +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + + + +#### `bin-links` + +* Default: true +* Type: Boolean + +Tells npm to create symlinks (or `.cmd` shims on Windows) for package +executables. + +Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems. + + + +#### `fund` + +* Default: true +* Type: Boolean + +When "true" displays the message at the end of each `npm install` +acknowledging the number of dependencies looking for funding. See [`npm +fund`](/commands/npm-fund) for details. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [npm install](/commands/npm-install) +* [package-lock.json](/configuring-npm/package-lock-json) diff --git a/node_modules/npm/docs/content/commands/npm-completion.md b/node_modules/npm/docs/content/commands/npm-completion.md new file mode 100644 index 00000000..8cbc7130 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-completion.md @@ -0,0 +1,41 @@ +--- +title: npm-completion +section: 1 +description: Tab Completion for npm +--- + +### Synopsis + +```bash +npm completion +``` + +Note: This command is unaware of workspaces. + +### Description + +Enables tab-completion in all npm commands. + +The synopsis above +loads the completions into your current shell. Adding it to +your ~/.bashrc or ~/.zshrc will make the completions available +everywhere: + +```bash +npm completion >> ~/.bashrc +npm completion >> ~/.zshrc +``` + +You may of course also pipe the output of `npm completion` to a file +such as `/usr/local/etc/bash_completion.d/npm` or +`/etc/bash_completion.d/npm` if you have a system that will read +that file for you. + +When `COMP_CWORD`, `COMP_LINE`, and `COMP_POINT` are defined in the +environment, `npm completion` acts in "plumbing mode", and outputs +completions based on the arguments. + +### See Also + +* [npm developers](/using-npm/developers) +* [npm](/commands/npm) diff --git a/node_modules/npm/docs/content/commands/npm-config.md b/node_modules/npm/docs/content/commands/npm-config.md new file mode 100644 index 00000000..603161b0 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-config.md @@ -0,0 +1,182 @@ +--- +title: npm-config +section: 1 +description: Manage the npm configuration files +--- + +### Synopsis + +```bash +npm config set = [= ...] +npm config get [ [ ...]] +npm config delete [ ...] +npm config list [--json] +npm config edit +npm config fix + +alias: c +``` + +Note: This command is unaware of workspaces. + +### Description + +npm gets its config settings from the command line, environment +variables, `npmrc` files, and in some cases, the `package.json` file. + +See [npmrc](/configuring-npm/npmrc) for more information about the npmrc +files. + +See [config](/using-npm/config) for a more thorough explanation of the +mechanisms involved, and a full list of config options available. + +The `npm config` command can be used to update and edit the contents +of the user and global npmrc files. + +### Sub-commands + +Config supports the following sub-commands: + +#### set + +```bash +npm config set key=value [key=value...] +npm set key=value [key=value...] +``` + +Sets each of the config keys to the value provided. Modifies the user configuration +file unless [`location`](/commands/npm-config#location) is passed. + +If value is omitted, the key will be removed from your config file entirely. + +Note: for backwards compatibility, `npm config set key value` is supported +as an alias for `npm config set key=value`. + +#### get + +```bash +npm config get [key ...] +npm get [key ...] +``` + +Echo the config value(s) to stdout. + +If multiple keys are provided, then the values will be prefixed with the +key names. + +If no keys are provided, then this command behaves the same as `npm config +list`. + +#### list + +```bash +npm config list +``` + +Show all the config settings. Use `-l` to also show defaults. Use `--json` +to show the settings in json format. + +#### delete + +```bash +npm config delete key [key ...] +``` + +Deletes the specified keys from all configuration files. + +#### edit + +```bash +npm config edit +``` + +Opens the config file in an editor. Use the `--global` flag to edit the +global config. + +#### fix + +```bash +npm config fix +``` + +Attempts to repair invalid configuration items. Usually this means +attaching authentication config (i.e. `_auth`, `_authToken`) to the +configured `registry`. + +### Configuration + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `editor` + +* Default: The EDITOR or VISUAL environment variables, or + '%SYSTEMROOT%\notepad.exe' on Windows, or 'vi' on Unix systems +* Type: String + +The command to run for `npm edit` and `npm config edit`. + + + +#### `location` + +* Default: "user" unless `--global` is passed, which will also set this value + to "global" +* Type: "global", "user", or "project" + +When passed to `npm config` this refers to which config file to use. + +When set to "global" mode, packages are installed into the `prefix` folder +instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `long` + +* Default: false +* Type: Boolean + +Show extended information in `ls`, `search`, and `help-search`. + + + +### See Also + +* [npm folders](/configuring-npm/folders) +* [npm config](/commands/npm-config) +* [package.json](/configuring-npm/package-json) +* [npmrc](/configuring-npm/npmrc) +* [npm](/commands/npm) diff --git a/node_modules/npm/docs/content/commands/npm-dedupe.md b/node_modules/npm/docs/content/commands/npm-dedupe.md new file mode 100644 index 00000000..1e8a4bc5 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-dedupe.md @@ -0,0 +1,320 @@ +--- +title: npm-dedupe +section: 1 +description: Reduce duplication in the package tree +--- + +### Synopsis + +```bash +npm dedupe + +alias: ddp +``` + +### Description + +Searches the local package tree and attempts to simplify the overall +structure by moving dependencies further up the tree, where they can +be more effectively shared by multiple dependent packages. + +For example, consider this dependency graph: + +``` +a ++-- b <-- depends on c@1.0.x +| `-- c@1.0.3 +`-- d <-- depends on c@~1.0.9 + `-- c@1.0.10 +``` + +In this case, `npm dedupe` will transform the tree to: + +```bash +a ++-- b ++-- d +`-- c@1.0.10 +``` + +Because of the hierarchical nature of node's module lookup, b and d +will both get their dependency met by the single c package at the root +level of the tree. + +In some cases, you may have a dependency graph like this: + +``` +a ++-- b <-- depends on c@1.0.x ++-- c@1.0.3 +`-- d <-- depends on c@1.x + `-- c@1.9.9 +``` + +During the installation process, the `c@1.0.3` dependency for `b` was +placed in the root of the tree. Though `d`'s dependency on `c@1.x` could +have been satisfied by `c@1.0.3`, the newer `c@1.9.0` dependency was used, +because npm favors updates by default, even when doing so causes +duplication. + +Running `npm dedupe` will cause npm to note the duplication and +re-evaluate, deleting the nested `c` module, because the one in the root is +sufficient. + +To prefer deduplication over novelty during the installation process, run +`npm install --prefer-dedupe` or `npm config set prefer-dedupe true`. + +Arguments are ignored. Dedupe always acts on the entire tree. + +Note that this operation transforms the dependency tree, but will never +result in new modules being installed. + +Using `npm find-dupes` will run the command in `--dry-run` mode. + +Note: `npm dedupe` will never update the semver values of direct +dependencies in your project `package.json`, if you want to update +values in `package.json` you can run: `npm update --save` instead. + +### Configuration + +#### `install-strategy` + +* Default: "hoisted" +* Type: "hoisted", "nested", "shallow", or "linked" + +Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted. + + + +#### `legacy-bundling` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=nested` + +Instead of hoisting package installs in `node_modules`, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets `--install-strategy=nested`. + + + +#### `global-style` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=shallow` + +Only install direct dependencies in the top level `node_modules`, but hoist +on deeper dependencies. Sets `--install-strategy=shallow`. + + + +#### `strict-peer-deps` + +* Default: false +* Type: Boolean + +If set to `true`, and `--legacy-peer-deps` is not set, then _any_ +conflicting `peerDependencies` will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships. + +By default, conflicting `peerDependencies` deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's `peerDependencies` object. + +When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If `--strict-peer-deps` is set, then +this warning is treated as a failure. + + + +#### `package-lock` + +* Default: true +* Type: Boolean + +If set to false, then ignore `package-lock.json` files when installing. This +will also prevent _writing_ `package-lock.json` if `save` is true. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + + + +#### `bin-links` + +* Default: true +* Type: Boolean + +Tells npm to create symlinks (or `.cmd` shims on Windows) for package +executables. + +Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems. + + + +#### `fund` + +* Default: true +* Type: Boolean + +When "true" displays the message at the end of each `npm install` +acknowledging the number of dependencies looking for funding. See [`npm +fund`](/commands/npm-fund) for details. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [npm find-dupes](/commands/npm-find-dupes) +* [npm ls](/commands/npm-ls) +* [npm update](/commands/npm-update) +* [npm install](/commands/npm-install) diff --git a/node_modules/npm/docs/content/commands/npm-deprecate.md b/node_modules/npm/docs/content/commands/npm-deprecate.md new file mode 100644 index 00000000..706ecf31 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-deprecate.md @@ -0,0 +1,73 @@ +--- +title: npm-deprecate +section: 1 +description: Deprecate a version of a package +--- + +### Synopsis + +```bash +npm deprecate +``` + +Note: This command is unaware of workspaces. + +### Description + +This command will update the npm registry entry for a package, providing a +deprecation warning to all who attempt to install it. + +It works on [version ranges](https://semver.npmjs.com/) as well as specific +versions, so you can do something like this: + +```bash +npm deprecate my-thing@"< 0.2.3" "critical bug fixed in v0.2.3" +``` + +SemVer ranges passed to this command are interpreted such that they *do* +include prerelease versions. For example: + +```bash +npm deprecate my-thing@1.x "1.x is no longer supported" +``` + +In this case, a version `my-thing@1.0.0-beta.0` will also be deprecated. + +You must be the package owner to deprecate something. See the `owner` and +`adduser` help topics. + +To un-deprecate a package, specify an empty string (`""`) for the `message` +argument. Note that you must use double quotes with no space between them to +format an empty string. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm publish](/commands/npm-publish) +* [npm registry](/using-npm/registry) +* [npm owner](/commands/npm-owner) +* [npm adduser](/commands/npm-adduser) diff --git a/node_modules/npm/docs/content/commands/npm-diff.md b/node_modules/npm/docs/content/commands/npm-diff.md new file mode 100644 index 00000000..52484109 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-diff.md @@ -0,0 +1,319 @@ +--- +title: npm-diff +section: 1 +description: The registry diff command +--- + +### Synopsis + +```bash +npm diff [...] +``` + +### Description + +Similar to its `git diff` counterpart, this command will print diff patches +of files for packages published to the npm registry. + +* `npm diff --diff= --diff=` + + Compares two package versions using their registry specifiers, e.g: + `npm diff --diff=pkg@1.0.0 --diff=pkg@^2.0.0`. It's also possible to + compare across forks of any package, + e.g: `npm diff --diff=pkg@1.0.0 --diff=pkg-fork@1.0.0`. + + Any valid spec can be used, so that it's also possible to compare + directories or git repositories, + e.g: `npm diff --diff=pkg@latest --diff=./packages/pkg` + + Here's an example comparing two different versions of a package named + `abbrev` from the registry: + + ```bash + npm diff --diff=abbrev@1.1.0 --diff=abbrev@1.1.1 + ``` + + On success, output looks like: + + ```bash + diff --git a/package.json b/package.json + index v1.1.0..v1.1.1 100644 + --- a/package.json + +++ b/package.json + @@ -1,6 +1,6 @@ + { + "name": "abbrev", + - "version": "1.1.0", + + "version": "1.1.1", + "description": "Like ruby's abbrev module, but in js", + "author": "Isaac Z. Schlueter ", + "main": "abbrev.js", + ``` + + Given the flexible nature of npm specs, you can also target local + directories or git repos just like when using `npm install`: + + ```bash + npm diff --diff=https://github.com/npm/libnpmdiff --diff=./local-path + ``` + + In the example above we can compare the contents from the package installed + from the git repo at `github.com/npm/libnpmdiff` with the contents of the + `./local-path` that contains a valid package, such as a modified copy of + the original. + +* `npm diff` (in a package directory, no arguments): + + If the package is published to the registry, `npm diff` will fetch the + tarball version tagged as `latest` (this value can be configured using the + `tag` option) and proceed to compare the contents of files present in that + tarball, with the current files in your local file system. + + This workflow provides a handy way for package authors to see what + package-tracked files have been changed in comparison with the latest + published version of that package. + +* `npm diff --diff=` (in a package directory): + + When using a single package name (with no version or tag specifier) as an + argument, `npm diff` will work in a similar way to + [`npm-outdated`](npm-outdated) and reach for the registry to figure out + what current published version of the package named `` + will satisfy its dependent declared semver-range. Once that specific + version is known `npm diff` will print diff patches comparing the + current version of `` found in the local file system with + that specific version returned by the registry. + + Given a package named `abbrev` that is currently installed: + + ```bash + npm diff --diff=abbrev + ``` + + That will request from the registry its most up to date version and + will print a diff output comparing the currently installed version to this + newer one if the version numbers are not the same. + +* `npm diff --diff=` (in a package directory): + + Similar to using only a single package name, it's also possible to declare + a full registry specifier version if you wish to compare the local version + of an installed package with the specific version/tag/semver-range provided + in ``. + + An example: assuming `pkg@1.0.0` is installed in the current `node_modules` + folder, running: + + ```bash + npm diff --diff=pkg@2.0.0 + ``` + + It will effectively be an alias to + `npm diff --diff=pkg@1.0.0 --diff=pkg@2.0.0`. + +* `npm diff --diff= [--diff=]` (in a package directory): + + Using `npm diff` along with semver-valid version numbers is a shorthand + to compare different versions of the current package. + + It needs to be run from a package directory, such that for a package named + `pkg` running `npm diff --diff=1.0.0 --diff=1.0.1` is the same as running + `npm diff --diff=pkg@1.0.0 --diff=pkg@1.0.1`. + + If only a single argument `` is provided, then the current local + file system is going to be compared against that version. + + Here's an example comparing two specific versions (published to the + configured registry) of the current project directory: + + ```bash + npm diff --diff=1.0.0 --diff=1.1.0 + ``` + +Note that tag names are not valid `--diff` argument values, if you wish to +compare to a published tag, you must use the `pkg@tagname` syntax. + +#### Filtering files + +It's possible to also specify positional arguments using file names or globs +pattern matching in order to limit the result of diff patches to only a subset +of files for a given package, e.g: + + ```bash + npm diff --diff=pkg@2 ./lib/ CHANGELOG.md + ``` + +In the example above the diff output is only going to print contents of files +located within the folder `./lib/` and changed lines of code within the +`CHANGELOG.md` file. + +### Configuration + +#### `diff` + +* Default: +* Type: String (can be set multiple times) + +Define arguments to compare in `npm diff`. + + + +#### `diff-name-only` + +* Default: false +* Type: Boolean + +Prints only filenames when using `npm diff`. + + + +#### `diff-unified` + +* Default: 3 +* Type: Number + +The number of lines of context to print in `npm diff`. + + + +#### `diff-ignore-all-space` + +* Default: false +* Type: Boolean + +Ignore whitespace when comparing lines in `npm diff`. + + + +#### `diff-no-prefix` + +* Default: false +* Type: Boolean + +Do not show any source or destination prefix in `npm diff` output. + +Note: this causes `npm diff` to ignore the `--diff-src-prefix` and +`--diff-dst-prefix` configs. + + + +#### `diff-src-prefix` + +* Default: "a/" +* Type: String + +Source prefix to be used in `npm diff` output. + + + +#### `diff-dst-prefix` + +* Default: "b/" +* Type: String + +Destination prefix to be used in `npm diff` output. + + + +#### `diff-text` + +* Default: false +* Type: Boolean + +Treat all files as text in `npm diff`. + + + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `tag` + +* Default: "latest" +* Type: String + +If you ask npm to install a package and don't tell it a specific version, +then it will install the specified tag. + +It is the tag added to the package@version specified in the `npm dist-tag +add` command, if no explicit tag is given. + +When used by the `npm diff` command, this is the tag used to fetch the +tarball that will be compared with the local files by default. + +If used in the `npm publish` command, this is the tag that will be added to +the package submitted to the registry. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. +## See Also + +* [npm outdated](/commands/npm-outdated) +* [npm install](/commands/npm-install) +* [npm config](/commands/npm-config) +* [npm registry](/using-npm/registry) diff --git a/node_modules/npm/docs/content/commands/npm-dist-tag.md b/node_modules/npm/docs/content/commands/npm-dist-tag.md new file mode 100644 index 00000000..609da16b --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-dist-tag.md @@ -0,0 +1,154 @@ +--- +title: npm-dist-tag +section: 1 +description: Modify package distribution tags +--- + +### Synopsis + +```bash +npm dist-tag add [] +npm dist-tag rm +npm dist-tag ls [] + +alias: dist-tags +``` + +### Description + +Add, remove, and enumerate distribution tags on a package: + +* add: Tags the specified version of the package with the specified tag, + or the [`--tag` config](/using-npm/config#tag) if not specified. If you have + two-factor authentication on auth-and-writes then you’ll need to include a + one-time password on the command line with + `--otp `, or go through a second factor flow based on your `authtype`. + +* rm: Clear a tag that is no longer in use from the package. If you have + two-factor authentication on auth-and-writes then you’ll need to include + a one-time password on the command line with `--otp `, + or go through a second factor flow based on your `authtype` + +* ls: Show all of the dist-tags for a package, defaulting to the package in + the current prefix. This is the default action if none is specified. + +A tag can be used when installing packages as a reference to a version instead +of using a specific version number: + +```bash +npm install @ +``` + +When installing dependencies, a preferred tagged version may be specified: + +```bash +npm install --tag +``` + +(This also applies to any other commands that resolve and install +dependencies, such as `npm dedupe`, `npm update`, and `npm audit fix`.) + +Publishing a package sets the `latest` tag to the published version unless the +`--tag` option is used. For example, `npm publish --tag=beta`. + +By default, `npm install ` (without any `@` or `@` +specifier) installs the `latest` tag. + +### Purpose + +Tags can be used to provide an alias instead of version numbers. + +For example, a project might choose to have multiple streams of development +and use a different tag for each stream, e.g., `stable`, `beta`, `dev`, +`canary`. + +By default, the `latest` tag is used by npm to identify the current version +of a package, and `npm install ` (without any `@` or `@` +specifier) installs the `latest` tag. Typically, projects only use the +`latest` tag for stable release versions, and use other tags for unstable +versions such as prereleases. + +The `next` tag is used by some projects to identify the upcoming version. + +Other than `latest`, no tag has any special significance to npm itself. + +### Caveats + +This command used to be known as `npm tag`, which only created new tags, +and so had a different syntax. + +Tags must share a namespace with version numbers, because they are +specified in the same slot: `npm install @` vs +`npm install @`. + +Tags that can be interpreted as valid semver ranges will be rejected. For +example, `v1.4` cannot be used as a tag, because it is interpreted by +semver as `>=1.4.0 <1.5.0`. See . + +The simplest way to avoid semver problems with tags is to use tags that do +not begin with a number or the letter `v`. + +### Configuration + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm publish](/commands/npm-publish) +* [npm install](/commands/npm-install) +* [npm dedupe](/commands/npm-dedupe) +* [npm registry](/using-npm/registry) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) diff --git a/node_modules/npm/docs/content/commands/npm-docs.md b/node_modules/npm/docs/content/commands/npm-docs.md new file mode 100644 index 00000000..582fc55e --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-docs.md @@ -0,0 +1,108 @@ +--- +title: npm-docs +section: 1 +description: Open documentation for a package in a web browser +--- + +### Synopsis + +```bash +npm docs [ [ ...]] + +alias: home +``` + +### Description + +This command tries to guess at the likely location of a package's +documentation URL, and then tries to open it using the +[`--browser` config](/using-npm/config#browser) param. You can pass multiple +package names at once. If no package name is provided, it will search for a +`package.json` in the current folder and use the `name` property. + +### Configuration + +#### `browser` + +* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"` +* Type: null, Boolean, or String + +The browser that is called by npm commands to open websites. + +Set to `false` to suppress browser behavior and instead print urls to +terminal. + +Set to `true` to use default system URL opener. + + + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +### See Also + +* [npm view](/commands/npm-view) +* [npm publish](/commands/npm-publish) +* [npm registry](/using-npm/registry) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [package.json](/configuring-npm/package-json) diff --git a/node_modules/npm/docs/content/commands/npm-doctor.md b/node_modules/npm/docs/content/commands/npm-doctor.md new file mode 100644 index 00000000..a96036a7 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-doctor.md @@ -0,0 +1,123 @@ +--- +title: npm-doctor +section: 1 +description: Check the health of your npm environment +--- + +### Synopsis + +```bash +npm doctor [connection] [registry] [versions] [environment] [permissions] [cache] +``` + +Note: This command is unaware of workspaces. + +### Description + +`npm doctor` runs a set of checks to ensure that your npm installation has +what it needs to manage your JavaScript packages. npm is mostly a +standalone tool, but it does have some basic requirements that must be met: + ++ Node.js and git must be executable by npm. ++ The primary npm registry, `registry.npmjs.com`, or another service that + uses the registry API, is available. ++ The directories that npm uses, `node_modules` (both locally and + globally), exist and can be written by the current user. ++ The npm cache exists, and the package tarballs within it aren't corrupt. + +Without all of these working properly, npm may not work properly. Many +issues are often attributable to things that are outside npm's code base, +so `npm doctor` confirms that the npm installation is in a good state. + +Also, in addition to this, there are also very many issue reports due to +using old versions of npm. Since npm is constantly improving, running +`npm@latest` is better than an old version. + +`npm doctor` verifies the following items in your environment, and if +there are any recommended changes, it will display them. By default npm +runs all of these checks. You can limit what checks are ran by +specifying them as extra arguments. + +#### `Connecting to the registry` + +By default, npm installs from the primary npm registry, +`registry.npmjs.org`. `npm doctor` hits a special connection testing +endpoint within the registry. This can also be checked with `npm ping`. +If this check fails, you may be using a proxy that needs to be +configured, or may need to talk to your IT staff to get access over +HTTPS to `registry.npmjs.org`. + +This check is done against whichever registry you've configured (you can +see what that is by running `npm config get registry`), and if you're using +a private registry that doesn't support the `/whoami` endpoint supported by +the primary registry, this check may fail. + +#### `Checking npm version` + +While Node.js may come bundled with a particular version of npm, it's the +policy of the CLI team that we recommend all users run `npm@latest` if they +can. As the CLI is maintained by a small team of contributors, there are +only resources for a single line of development, so npm's own long-term +support releases typically only receive critical security and regression +fixes. The team believes that the latest tested version of npm is almost +always likely to be the most functional and defect-free version of npm. + +#### `Checking node version` + +For most users, in most circumstances, the best version of Node will be the +latest long-term support (LTS) release. Those of you who want access to new +ECMAscript features or bleeding-edge changes to Node's standard library may +be running a newer version, and some may be required to run an older +version of Node because of enterprise change control policies. That's OK! +But in general, the npm team recommends that most users run Node.js LTS. + +#### `Checking configured npm registry` + +You may be installing from private package registries for your project or +company. That's great! Others may be following tutorials or StackOverflow +questions in an effort to troubleshoot problems you may be having. +Sometimes, this may entail changing the registry you're pointing at. This +part of `npm doctor` just lets you, and maybe whoever's helping you with +support, know that you're not using the default registry. + +#### `Checking for git executable in PATH` + +While it's documented in the README, it may not be obvious that npm needs +Git installed to do many of the things that it does. Also, in some cases +– especially on Windows – you may have Git set up in such a way that it's +not accessible via your `PATH` so that npm can find it. This check ensures +that Git is available. + +#### Permissions checks + +* Your cache must be readable and writable by the user running npm. +* Global package binaries must be writable by the user running npm. +* Your local `node_modules` path, if you're running `npm doctor` with a + project directory, must be readable and writable by the user running npm. + +#### Validate the checksums of cached packages + +When an npm package is published, the publishing process generates a +checksum that npm uses at install time to verify that the package didn't +get corrupted in transit. `npm doctor` uses these checksums to validate the +package tarballs in your local cache (you can see where that cache is +located with `npm config get cache`). In the event that there are corrupt +packages in your cache, you should probably run `npm cache clean -f` and +reset the cache. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +### See Also + +* [npm bugs](/commands/npm-bugs) +* [npm help](/commands/npm-help) +* [npm ping](/commands/npm-ping) diff --git a/node_modules/npm/docs/content/commands/npm-edit.md b/node_modules/npm/docs/content/commands/npm-edit.md new file mode 100644 index 00000000..a26df11b --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-edit.md @@ -0,0 +1,46 @@ +--- +title: npm-edit +section: 1 +description: Edit an installed package +--- + +### Synopsis + +```bash +npm edit [/...] +``` + +Note: This command is unaware of workspaces. + +### Description + +Selects a dependency in the current project and opens the package folder in +the default editor (or whatever you've configured as the npm `editor` +config -- see [`npm-config`](npm-config).) + +After it has been edited, the package is rebuilt so as to pick up any +changes in compiled packages. + +For instance, you can do `npm install connect` to install connect +into your package, and then `npm edit connect` to make a few +changes to your locally installed copy. + +### Configuration + +#### `editor` + +* Default: The EDITOR or VISUAL environment variables, or + '%SYSTEMROOT%\notepad.exe' on Windows, or 'vi' on Unix systems +* Type: String + +The command to run for `npm edit` and `npm config edit`. + + + +### See Also + +* [npm folders](/configuring-npm/folders) +* [npm explore](/commands/npm-explore) +* [npm install](/commands/npm-install) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) diff --git a/node_modules/npm/docs/content/commands/npm-exec.md b/node_modules/npm/docs/content/commands/npm-exec.md new file mode 100644 index 00000000..fa8d80cf --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-exec.md @@ -0,0 +1,366 @@ +--- +title: npm-exec +section: 1 +description: Run a command from a local or remote npm package +--- + +### Synopsis + +```bash +npm exec -- [@] [args...] +npm exec --package=[@] -- [args...] +npm exec -c ' [args...]' +npm exec --package=foo -c ' [args...]' + +alias: x +``` + +### Description + +This command allows you to run an arbitrary command from an npm package +(either one installed locally, or fetched remotely), in a similar context +as running it via `npm run`. + +Run without positional arguments or `--call`, this allows you to +interactively run commands in the same sort of shell environment that +`package.json` scripts are run. Interactive mode is not supported in CI +environments when standard input is a TTY, to prevent hangs. + +Whatever packages are specified by the `--package` option will be +provided in the `PATH` of the executed command, along with any locally +installed package executables. The `--package` option may be +specified multiple times, to execute the supplied command in an environment +where all specified packages are available. + +If any requested packages are not present in the local project +dependencies, then a prompt is printed, which can be suppressed by +providing either `--yes` or `--no`. When standard input is not a TTY or a +CI environment is detected, `--yes` is assumed. The requested packages are +installed to a folder in the npm cache, which is added to the `PATH` +environment variable in the executed process. + +Package names provided without a specifier will be matched with whatever +version exists in the local project. Package names with a specifier will +only be considered a match if they have the exact same name and version as +the local dependency. + +If no `-c` or `--call` option is provided, then the positional arguments +are used to generate the command string. If no `--package` options +are provided, then npm will attempt to determine the executable name from +the package specifier provided as the first positional argument according +to the following heuristic: + +- If the package has a single entry in its `bin` field in `package.json`, + or if all entries are aliases of the same command, then that command + will be used. +- If the package has multiple `bin` entries, and one of them matches the + unscoped portion of the `name` field, then that command will be used. +- If this does not result in exactly one option (either because there are + no bin entries, or none of them match the `name` of the package), then + `npm exec` exits with an error. + +To run a binary _other than_ the named binary, specify one or more +`--package` options, which will prevent npm from inferring the package from +the first command argument. + +### `npx` vs `npm exec` + +When run via the `npx` binary, all flags and options *must* be set prior to +any positional arguments. When run via `npm exec`, a double-hyphen `--` +flag can be used to suppress npm's parsing of switches and options that +should be sent to the executed command. + +For example: + +``` +$ npx foo@latest bar --package=@npmcli/foo +``` + +In this case, npm will resolve the `foo` package name, and run the +following command: + +``` +$ foo bar --package=@npmcli/foo +``` + +Since the `--package` option comes _after_ the positional arguments, it is +treated as an argument to the executed command. + +In contrast, due to npm's argument parsing logic, running this command is +different: + +``` +$ npm exec foo@latest bar --package=@npmcli/foo +``` + +In this case, npm will parse the `--package` option first, resolving the +`@npmcli/foo` package. Then, it will execute the following command in that +context: + +``` +$ foo@latest bar +``` + +The double-hyphen character is recommended to explicitly tell npm to stop +parsing command line options and switches. The following command would +thus be equivalent to the `npx` command above: + +``` +$ npm exec -- foo@latest bar --package=@npmcli/foo +``` + +### Configuration + +#### `package` + +* Default: +* Type: String (can be set multiple times) + +The package or packages to install for [`npm exec`](/commands/npm-exec) + + + +#### `call` + +* Default: "" +* Type: String + +Optional companion option for `npm exec`, `npx` that allows for specifying a +custom command to be run along with the installed packages. + +```bash +npm exec --package yo --package generator-node --call "yo node" +``` + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +### Examples + +Run the version of `tap` in the local dependencies, with the provided +arguments: + +``` +$ npm exec -- tap --bail test/foo.js +$ npx tap --bail test/foo.js +``` + +Run a command _other than_ the command whose name matches the package name +by specifying a `--package` option: + +``` +$ npm exec --package=foo -- bar --bar-argument +# ~ or ~ +$ npx --package=foo bar --bar-argument +``` + +Run an arbitrary shell script, in the context of the current project: + +``` +$ npm x -c 'eslint && say "hooray, lint passed"' +$ npx -c 'eslint && say "hooray, lint passed"' +``` + +### Workspaces support + +You may use the [`workspace`](/using-npm/config#workspace) or +[`workspaces`](/using-npm/config#workspaces) configs in order to run an +arbitrary command from an npm package (either one installed locally, or fetched +remotely) in the context of the specified workspaces. +If no positional argument or `--call` option is provided, it will open an +interactive subshell in the context of each of these configured workspaces one +at a time. + +Given a project with configured workspaces, e.g: + +``` +. ++-- package.json +`-- packages + +-- a + | `-- package.json + +-- b + | `-- package.json + `-- c + `-- package.json +``` + +Assuming the workspace configuration is properly set up at the root level +`package.json` file. e.g: + +``` +{ + "workspaces": [ "./packages/*" ] +} +``` + +You can execute an arbitrary command from a package in the context of each of +the configured workspaces when using the +[`workspaces` config options](/using-npm/config#workspace), in this example +we're using **eslint** to lint any js file found within each workspace folder: + +``` +npm exec --ws -- eslint ./*.js +``` + +#### Filtering workspaces + +It's also possible to execute a command in a single workspace using the +`workspace` config along with a name or directory path: + +``` +npm exec --workspace=a -- eslint ./*.js +``` + +The `workspace` config can also be specified multiple times in order to run a +specific script in the context of multiple workspaces. When defining values for +the `workspace` config in the command line, it also possible to use `-w` as a +shorthand, e.g: + +``` +npm exec -w a -w b -- eslint ./*.js +``` + +This last command will run the `eslint` command in both `./packages/a` and +`./packages/b` folders. + +### Compatibility with Older npx Versions + +The `npx` binary was rewritten in npm v7.0.0, and the standalone `npx` +package deprecated at that time. `npx` uses the `npm exec` +command instead of a separate argument parser and install process, with +some affordances to maintain backwards compatibility with the arguments it +accepted in previous versions. + +This resulted in some shifts in its functionality: + +- Any `npm` config value may be provided. +- To prevent security and user-experience problems from mistyping package + names, `npx` prompts before installing anything. Suppress this + prompt with the `-y` or `--yes` option. +- The `--no-install` option is deprecated, and will be converted to `--no`. +- Shell fallback functionality is removed, as it is not advisable. +- The `-p` argument is a shorthand for `--parseable` in npm, but shorthand + for `--package` in npx. This is maintained, but only for the `npx` + executable. +- The `--ignore-existing` option is removed. Locally installed bins are + always present in the executed process `PATH`. +- The `--npm` option is removed. `npx` will always use the `npm` it ships + with. +- The `--node-arg` and `-n` options are removed. +- The `--always-spawn` option is redundant, and thus removed. +- The `--shell` option is replaced with `--script-shell`, but maintained + in the `npx` executable for backwards compatibility. + +### A note on caching + +The npm cli utilizes its internal package cache when using the package +name specified. You can use the following to change how and when the +cli uses this cache. See [`npm cache`](/commands/npm-cache) for more on +how the cache works. + +#### prefer-online + +Forces staleness checks for packages, making the cli look for updates +immediately even if the package is already in the cache. + +#### prefer-offline + +Bypasses staleness checks for packages. Missing data will still be +requested from the server. To force full offline mode, use `offline`. + +#### offline + +Forces full offline mode. Any packages not locally cached will result in +an error. + +#### workspace + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result to selecting all of the + nested workspaces) + +This value is not exported to the environment for child processes. + +#### workspaces + +* Alias: `--ws` +* Type: Boolean +* Default: `false` + +Run scripts in the context of all configured workspaces for the current +project. + +### See Also + +* [npm run-script](/commands/npm-run-script) +* [npm scripts](/using-npm/scripts) +* [npm test](/commands/npm-test) +* [npm start](/commands/npm-start) +* [npm restart](/commands/npm-restart) +* [npm stop](/commands/npm-stop) +* [npm config](/commands/npm-config) +* [npm workspaces](/using-npm/workspaces) +* [npx](/commands/npx) diff --git a/node_modules/npm/docs/content/commands/npm-explain.md b/node_modules/npm/docs/content/commands/npm-explain.md new file mode 100644 index 00000000..b0f0ebcb --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-explain.md @@ -0,0 +1,105 @@ +--- +title: npm-explain +section: 1 +description: Explain installed packages +--- + +### Synopsis + +```bash +npm explain + +alias: why +``` + +### Description + +This command will print the chain of dependencies causing a given package +to be installed in the current project. + +If one or more package specs are provided, then only packages matching +one of the specifiers will have their relationships explained. + +The package spec can also refer to a folder within `./node_modules` + +For example, running `npm explain glob` within npm's source tree will show: + +```bash +glob@7.1.6 +node_modules/glob + glob@"^7.1.4" from the root project + +glob@7.1.1 dev +node_modules/tacks/node_modules/glob + glob@"^7.0.5" from rimraf@2.6.2 + node_modules/tacks/node_modules/rimraf + rimraf@"^2.6.2" from tacks@1.3.0 + node_modules/tacks + dev tacks@"^1.3.0" from the root project +``` + +To explain just the package residing at a specific folder, pass that as the +argument to the command. This can be useful when trying to figure out +exactly why a given dependency is being duplicated to satisfy conflicting +version requirements within the project. + +```bash +$ npm explain node_modules/nyc/node_modules/find-up +find-up@3.0.0 dev +node_modules/nyc/node_modules/find-up + find-up@"^3.0.0" from nyc@14.1.1 + node_modules/nyc + nyc@"^14.1.1" from tap@14.10.8 + node_modules/tap + dev tap@"^14.10.8" from the root project +``` + +### Configuration +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm folders](/configuring-npm/folders) +* [npm ls](/commands/npm-ls) +* [npm install](/commands/npm-install) +* [npm link](/commands/npm-link) +* [npm prune](/commands/npm-prune) +* [npm outdated](/commands/npm-outdated) +* [npm update](/commands/npm-update) diff --git a/node_modules/npm/docs/content/commands/npm-explore.md b/node_modules/npm/docs/content/commands/npm-explore.md new file mode 100644 index 00000000..e25e760d --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-explore.md @@ -0,0 +1,49 @@ +--- +title: npm-explore +section: 1 +description: Browse an installed package +--- + +### Synopsis + +```bash +npm explore [ -- ] +``` + +Note: This command is unaware of workspaces. + +### Description + +Spawn a subshell in the directory of the installed package specified. + +If a command is specified, then it is run in the subshell, which then +immediately terminates. + +This is particularly handy in the case of git submodules in the +`node_modules` folder: + +```bash +npm explore some-dependency -- git pull origin master +``` + +Note that the package is *not* automatically rebuilt afterwards, so be +sure to use `npm rebuild ` if you make any changes. + +### Configuration + +#### `shell` + +* Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on + Windows +* Type: String + +The shell to run for the `npm explore` command. + + + +### See Also + +* [npm folders](/configuring-npm/folders) +* [npm edit](/commands/npm-edit) +* [npm rebuild](/commands/npm-rebuild) +* [npm install](/commands/npm-install) diff --git a/node_modules/npm/docs/content/commands/npm-find-dupes.md b/node_modules/npm/docs/content/commands/npm-find-dupes.md new file mode 100644 index 00000000..67107604 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-find-dupes.md @@ -0,0 +1,246 @@ +--- +title: npm-find-dupes +section: 1 +description: Find duplication in the package tree +--- + +### Synopsis + +```bash +npm find-dupes +``` + +### Description + +Runs `npm dedupe` in `--dry-run` mode, making npm only output the +duplications, without actually changing the package tree. + +### Configuration + +#### `install-strategy` + +* Default: "hoisted" +* Type: "hoisted", "nested", "shallow", or "linked" + +Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted. + + + +#### `legacy-bundling` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=nested` + +Instead of hoisting package installs in `node_modules`, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets `--install-strategy=nested`. + + + +#### `global-style` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=shallow` + +Only install direct dependencies in the top level `node_modules`, but hoist +on deeper dependencies. Sets `--install-strategy=shallow`. + + + +#### `strict-peer-deps` + +* Default: false +* Type: Boolean + +If set to `true`, and `--legacy-peer-deps` is not set, then _any_ +conflicting `peerDependencies` will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships. + +By default, conflicting `peerDependencies` deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's `peerDependencies` object. + +When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If `--strict-peer-deps` is set, then +this warning is treated as a failure. + + + +#### `package-lock` + +* Default: true +* Type: Boolean + +If set to false, then ignore `package-lock.json` files when installing. This +will also prevent _writing_ `package-lock.json` if `save` is true. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + + + +#### `bin-links` + +* Default: true +* Type: Boolean + +Tells npm to create symlinks (or `.cmd` shims on Windows) for package +executables. + +Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems. + + + +#### `fund` + +* Default: true +* Type: Boolean + +When "true" displays the message at the end of each `npm install` +acknowledging the number of dependencies looking for funding. See [`npm +fund`](/commands/npm-fund) for details. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [npm dedupe](/commands/npm-dedupe) +* [npm ls](/commands/npm-ls) +* [npm update](/commands/npm-update) +* [npm install](/commands/npm-install) + diff --git a/node_modules/npm/docs/content/commands/npm-fund.md b/node_modules/npm/docs/content/commands/npm-fund.md new file mode 100644 index 00000000..cd12e1b4 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-fund.md @@ -0,0 +1,145 @@ +--- +title: npm-fund +section: 1 +description: Retrieve funding information +--- + +### Synopsis + +```bash +npm fund [] +``` + +### Description + +This command retrieves information on how to fund the dependencies of a +given project. If no package name is provided, it will list all +dependencies that are looking for funding in a tree structure, listing +the type of funding and the url to visit. If a package name is provided +then it tries to open its funding url using the +[`--browser` config](/using-npm/config#browser) param; if there are multiple +funding sources for the package, the user will be instructed to pass the +`--which` option to disambiguate. + +The list will avoid duplicated entries and will stack all packages that +share the same url as a single entry. Thus, the list does not have the +same shape of the output from `npm ls`. + +#### Example + +### Workspaces support + +It's possible to filter the results to only include a single workspace +and its dependencies using the +[`workspace` config](/using-npm/config#workspace) option. + +#### Example: + +Here's an example running `npm fund` in a project with a configured +workspace `a`: + +```bash +$ npm fund +test-workspaces-fund@1.0.0 ++-- https://example.com/a +| | `-- a@1.0.0 +| `-- https://example.com/maintainer +| `-- foo@1.0.0 ++-- https://example.com/npmcli-funding +| `-- @npmcli/test-funding +`-- https://example.com/org + `-- bar@2.0.0 +``` + +And here is an example of the expected result when filtering only by a +specific workspace `a` in the same project: + +```bash +$ npm fund -w a +test-workspaces-fund@1.0.0 +`-- https://example.com/a + | `-- a@1.0.0 + `-- https://example.com/maintainer + `-- foo@2.0.0 +``` + +### Configuration + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `browser` + +* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"` +* Type: null, Boolean, or String + +The browser that is called by npm commands to open websites. + +Set to `false` to suppress browser behavior and instead print urls to +terminal. + +Set to `true` to use default system URL opener. + + + +#### `unicode` + +* Default: false on windows, true on mac/unix systems with a unicode locale, + as defined by the `LC_ALL`, `LC_CTYPE`, or `LANG` environment variables. +* Type: Boolean + +When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters instead of unicode glyphs. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `which` + +* Default: null +* Type: null or Number + +If there are multiple funding sources, which 1-indexed source URL to open. + + + +## See Also + +* [package spec](/using-npm/package-spec) +* [npm install](/commands/npm-install) +* [npm docs](/commands/npm-docs) +* [npm ls](/commands/npm-ls) +* [npm config](/commands/npm-config) +* [npm workspaces](/using-npm/workspaces) diff --git a/node_modules/npm/docs/content/commands/npm-help-search.md b/node_modules/npm/docs/content/commands/npm-help-search.md new file mode 100644 index 00000000..5bc4602e --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-help-search.md @@ -0,0 +1,40 @@ +--- +title: npm-help-search +section: 1 +description: Search npm help documentation +--- + +### Synopsis + +```bash +npm help-search +``` + +Note: This command is unaware of workspaces. + +### Description + +This command will search the npm markdown documentation files for the terms +provided, and then list the results, sorted by relevance. + +If only one result is found, then it will show that help topic. + +If the argument to `npm help` is not a known help topic, then it will call +`help-search`. It is rarely if ever necessary to call this command +directly. + +### Configuration + +#### `long` + +* Default: false +* Type: Boolean + +Show extended information in `ls`, `search`, and `help-search`. + + + +### See Also + +* [npm](/commands/npm) +* [npm help](/commands/npm-help) diff --git a/node_modules/npm/docs/content/commands/npm-help.md b/node_modules/npm/docs/content/commands/npm-help.md new file mode 100644 index 00000000..bc2c8762 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-help.md @@ -0,0 +1,46 @@ +--- +title: npm-help +section: 1 +description: Get help on npm +--- + +### Synopsis + +```bash +npm help [] + +alias: hlep +``` + +Note: This command is unaware of workspaces. + +### Description + +If supplied a topic, then show the appropriate documentation page. + +If the topic does not exist, or if multiple terms are provided, then npm +will run the `help-search` command to find a match. Note that, if +`help-search` finds a single subject, then it will run `help` on that +topic, so unique matches are equivalent to specifying a topic name. + +### Configuration + +#### `viewer` + +* Default: "man" on Posix, "browser" on Windows +* Type: String + +The program to use to view help content. + +Set to `"browser"` to view html help content in the default web browser. + + + +### See Also + +* [npm](/commands/npm) +* [npm folders](/configuring-npm/folders) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [package.json](/configuring-npm/package-json) +* [npm help-search](/commands/npm-help-search) diff --git a/node_modules/npm/docs/content/commands/npm-init.md b/node_modules/npm/docs/content/commands/npm-init.md new file mode 100644 index 00000000..870f8467 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-init.md @@ -0,0 +1,349 @@ +--- +title: npm-init +section: 1 +description: Create a package.json file +--- + +### Synopsis + +```bash +npm init (same as `npx create-`) +npm init <@scope> (same as `npx <@scope>/create`) + +aliases: create, innit +``` + +### Description + +`npm init ` can be used to set up a new or existing npm +package. + +`initializer` in this case is an npm package named `create-`, +which will be installed by [`npm-exec`](/commands/npm-exec), and then have its +main bin executed -- presumably creating or updating `package.json` and +running any other initialization-related operations. + +The init command is transformed to a corresponding `npm exec` operation as +follows: + +* `npm init foo` -> `npm exec create-foo` +* `npm init @usr/foo` -> `npm exec @usr/create-foo` +* `npm init @usr` -> `npm exec @usr/create` +* `npm init @usr@2.0.0` -> `npm exec @usr/create@2.0.0` +* `npm init @usr/foo@2.0.0` -> `npm exec @usr/create-foo@2.0.0` + +If the initializer is omitted (by just calling `npm init`), init will fall +back to legacy init behavior. It will ask you a bunch of questions, and +then write a package.json for you. It will attempt to make reasonable +guesses based on existing fields, dependencies, and options selected. It is +strictly additive, so it will keep any fields and values that were already +set. You can also use `-y`/`--yes` to skip the questionnaire altogether. If +you pass `--scope`, it will create a scoped package. + +*Note:* if a user already has the `create-` package +globally installed, that will be what `npm init` uses. If you want npm +to use the latest version, or another specific version you must specify +it: + +* `npm init foo@latest` # fetches and runs the latest `create-foo` from + the registry +* `npm init foo@1.2.3` # runs `create-foo@1.2.3` specifically + +#### Forwarding additional options + +Any additional options will be passed directly to the command, so `npm init +foo -- --hello` will map to `npm exec -- create-foo --hello`. + +To better illustrate how options are forwarded, here's a more evolved +example showing options passed to both the **npm cli** and a create package, +both following commands are equivalent: + +- `npm init foo -y --registry= -- --hello -a` +- `npm exec -y --registry= -- create-foo --hello -a` + +### Examples + +Create a new React-based project using +[`create-react-app`](https://npm.im/create-react-app): + +```bash +$ npm init react-app ./my-react-app +``` + +Create a new `esm`-compatible package using +[`create-esm`](https://npm.im/create-esm): + +```bash +$ mkdir my-esm-lib && cd my-esm-lib +$ npm init esm --yes +``` + +Generate a plain old package.json using legacy init: + +```bash +$ mkdir my-npm-pkg && cd my-npm-pkg +$ git init +$ npm init +``` + +Generate it without having it ask any questions: + +```bash +$ npm init -y +``` + +### Workspaces support + +It's possible to create a new workspace within your project by using the +`workspace` config option. When using `npm init -w ` the cli will +create the folders and boilerplate expected while also adding a reference +to your project `package.json` `"workspaces": []` property in order to make +sure that new generated **workspace** is properly set up as such. + +Given a project with no workspaces, e.g: + +``` +. ++-- package.json +``` + +You may generate a new workspace using the legacy init: + +```bash +$ npm init -w packages/a +``` + +That will generate a new folder and `package.json` file, while also updating +your top-level `package.json` to add the reference to this new workspace: + +``` +. ++-- package.json +`-- packages + `-- a + `-- package.json +``` + +The workspaces init also supports the `npm init -w ` +syntax, following the same set of rules explained earlier in the initial +**Description** section of this page. Similar to the previous example of +creating a new React-based project using +[`create-react-app`](https://npm.im/create-react-app), the following syntax +will make sure to create the new react app as a nested **workspace** within your +project and configure your `package.json` to recognize it as such: + +```bash +npm init -w packages/my-react-app react-app . +``` + +This will make sure to generate your react app as expected, one important +consideration to have in mind is that `npm exec` is going to be run in the +context of the newly created folder for that workspace, and that's the reason +why in this example the initializer uses the initializer name followed with a +dot to represent the current directory in that context, e.g: `react-app .`: + +``` +. ++-- package.json +`-- packages + +-- a + | `-- package.json + `-- my-react-app + +-- README + +-- package.json + `-- ... +``` + +### Configuration + +#### `init-author-name` + +* Default: "" +* Type: String + +The value `npm init` should use by default for the package author's name. + + + +#### `init-author-url` + +* Default: "" +* Type: "" or URL + +The value `npm init` should use by default for the package author's +homepage. + + + +#### `init-license` + +* Default: "ISC" +* Type: String + +The value `npm init` should use by default for the package license. + + + +#### `init-module` + +* Default: "~/.npm-init.js" +* Type: Path + +A module that will be loaded by the `npm init` command. See the +documentation for the +[init-package-json](https://github.com/npm/init-package-json) module for +more information, or [npm init](/commands/npm-init). + + + +#### `init-version` + +* Default: "1.0.0" +* Type: SemVer string + +The value that `npm init` should use by default for the package version +number, if not already set in package.json. + + + +#### `yes` + +* Default: null +* Type: null or Boolean + +Automatically answer "yes" to any prompts that npm might print on the +command line. + + + +#### `force` + +* Default: false +* Type: Boolean + +Removes various protections against unfortunate side effects, common +mistakes, unnecessary performance degradation, and malicious input. + +* Allow clobbering non-npm files in global installs. +* Allow the `npm version` command to work on an unclean git repository. +* Allow deleting the cache folder with `npm cache clean`. +* Allow installing packages that have an `engines` declaration requiring a + different version of npm. +* Allow installing packages that have an `engines` declaration requiring a + different version of `node`, even if `--engine-strict` is enabled. +* Allow `npm audit fix` to install modules outside your stated dependency + range (including SemVer-major changes). +* Allow unpublishing all versions of a published package. +* Allow conflicting peerDependencies to be installed in the root project. +* Implicitly set `--yes` during `npm init`. +* Allow clobbering existing values in `npm pkg` +* Allow unpublishing of entire packages (not just a single version). + +If you don't have a clear idea of what you want to do, it is strongly +recommended that you do not use this option! + + + +#### `scope` + +* Default: the scope of the current project, if any, or "" +* Type: String + +Associate an operation with a scope for a scoped registry. + +Useful when logging in to or out of a private registry: + +``` +# log in, linking the scope to the custom registry +npm login --scope=@mycorp --registry=https://registry.mycorp.com + +# log out, removing the link and the auth token +npm logout --scope=@mycorp +``` + +This will cause `@mycorp` to be mapped to the registry for future +installation of packages specified according to the pattern +`@mycorp/package`. + +This will also cause `npm init` to create a scoped package. + +``` +# accept all defaults, and create a package named "@foo/whatever", +# instead of just named "whatever" +npm init --scope=@foo --yes +``` + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `workspaces-update` + +* Default: true +* Type: Boolean + +If set to true, the npm cli will run an update after operations that may +possibly change the workspaces installed to the `node_modules` folder. + + + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +### See Also + +* [package spec](/using-npm/package-spec) +* [init-package-json module](http://npm.im/init-package-json) +* [package.json](/configuring-npm/package-json) +* [npm version](/commands/npm-version) +* [npm scope](/using-npm/scope) +* [npm exec](/commands/npm-exec) +* [npm workspaces](/using-npm/workspaces) diff --git a/node_modules/npm/docs/content/commands/npm-install-ci-test.md b/node_modules/npm/docs/content/commands/npm-install-ci-test.md new file mode 100644 index 00000000..1519ffa8 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-install-ci-test.md @@ -0,0 +1,265 @@ +--- +title: npm-install-ci-test +section: 1 +description: Install a project with a clean slate and run tests +--- + +### Synopsis + +```bash +npm install-ci-test + +aliases: cit, clean-install-test, sit +``` + +### Description + +This command runs `npm ci` followed immediately by `npm test`. + +### Configuration + +#### `install-strategy` + +* Default: "hoisted" +* Type: "hoisted", "nested", "shallow", or "linked" + +Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted. + + + +#### `legacy-bundling` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=nested` + +Instead of hoisting package installs in `node_modules`, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets `--install-strategy=nested`. + + + +#### `global-style` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=shallow` + +Only install direct dependencies in the top level `node_modules`, but hoist +on deeper dependencies. Sets `--install-strategy=shallow`. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `strict-peer-deps` + +* Default: false +* Type: Boolean + +If set to `true`, and `--legacy-peer-deps` is not set, then _any_ +conflicting `peerDependencies` will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships. + +By default, conflicting `peerDependencies` deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's `peerDependencies` object. + +When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If `--strict-peer-deps` is set, then +this warning is treated as a failure. + + + +#### `foreground-scripts` + +* Default: `false` unless when using `npm pack` or `npm publish` where it + defaults to `true` +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + + + +#### `bin-links` + +* Default: true +* Type: Boolean + +Tells npm to create symlinks (or `.cmd` shims on Windows) for package +executables. + +Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems. + + + +#### `fund` + +* Default: true +* Type: Boolean + +When "true" displays the message at the end of each `npm install` +acknowledging the number of dependencies looking for funding. See [`npm +fund`](/commands/npm-fund) for details. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [npm install-test](/commands/npm-install-test) +* [npm ci](/commands/npm-ci) +* [npm test](/commands/npm-test) diff --git a/node_modules/npm/docs/content/commands/npm-install-test.md b/node_modules/npm/docs/content/commands/npm-install-test.md new file mode 100644 index 00000000..3d97af00 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-install-test.md @@ -0,0 +1,372 @@ +--- +title: npm-install-test +section: 1 +description: Install package(s) and run tests +--- + +### Synopsis + +```bash +npm install-test [ ...] + +alias: it +``` + +### Description + +This command runs an `npm install` followed immediately by an `npm test`. It +takes exactly the same arguments as `npm install`. + +### Configuration + +#### `save` + +* Default: `true` unless when using `npm update` where it defaults to `false` +* Type: Boolean + +Save installed packages to a `package.json` file as dependencies. + +When used with the `npm rm` command, removes the dependency from +`package.json`. + +Will also prevent writing to `package-lock.json` if set to `false`. + + + +#### `save-exact` + +* Default: false +* Type: Boolean + +Dependencies saved to package.json will be configured with an exact version +rather than using npm's default semver range operator. + + + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `install-strategy` + +* Default: "hoisted" +* Type: "hoisted", "nested", "shallow", or "linked" + +Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted. + + + +#### `legacy-bundling` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=nested` + +Instead of hoisting package installs in `node_modules`, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets `--install-strategy=nested`. + + + +#### `global-style` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=shallow` + +Only install direct dependencies in the top level `node_modules`, but hoist +on deeper dependencies. Sets `--install-strategy=shallow`. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `strict-peer-deps` + +* Default: false +* Type: Boolean + +If set to `true`, and `--legacy-peer-deps` is not set, then _any_ +conflicting `peerDependencies` will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships. + +By default, conflicting `peerDependencies` deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's `peerDependencies` object. + +When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If `--strict-peer-deps` is set, then +this warning is treated as a failure. + + + +#### `prefer-dedupe` + +* Default: false +* Type: Boolean + +Prefer to deduplicate packages if possible, rather than choosing a newer +version of a dependency. + + + +#### `package-lock` + +* Default: true +* Type: Boolean + +If set to false, then ignore `package-lock.json` files when installing. This +will also prevent _writing_ `package-lock.json` if `save` is true. + + + +#### `package-lock-only` + +* Default: false +* Type: Boolean + +If set to true, the current operation will only use the `package-lock.json`, +ignoring `node_modules`. + +For `update` this means only the `package-lock.json` will be updated, +instead of checking `node_modules` and downloading dependencies. + +For `list` this means the output will be based on the tree described by the +`package-lock.json`, rather than the contents of `node_modules`. + + + +#### `foreground-scripts` + +* Default: `false` unless when using `npm pack` or `npm publish` where it + defaults to `true` +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + + + +#### `bin-links` + +* Default: true +* Type: Boolean + +Tells npm to create symlinks (or `.cmd` shims on Windows) for package +executables. + +Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems. + + + +#### `fund` + +* Default: true +* Type: Boolean + +When "true" displays the message at the end of each `npm install` +acknowledging the number of dependencies looking for funding. See [`npm +fund`](/commands/npm-fund) for details. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `cpu` + +* Default: null +* Type: null or String + +Override CPU architecture of native modules to install. Acceptable values +are same as `cpu` field of package.json, which comes from `process.arch`. + + + +#### `os` + +* Default: null +* Type: null or String + +Override OS of native modules to install. Acceptable values are same as `os` +field of package.json, which comes from `process.platform`. + + + +#### `libc` + +* Default: null +* Type: null or String + +Override libc of native modules to install. Acceptable values are same as +`libc` field of package.json + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [npm install](/commands/npm-install) +* [npm install-ci-test](/commands/npm-install-ci-test) +* [npm test](/commands/npm-test) diff --git a/node_modules/npm/docs/content/commands/npm-install.md b/node_modules/npm/docs/content/commands/npm-install.md new file mode 100644 index 00000000..42ca7462 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-install.md @@ -0,0 +1,806 @@ +--- +title: npm-install +section: 1 +description: Install a package +--- + +### Synopsis + +```bash +npm install [ ...] + +aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall +``` + +### Description + +This command installs a package and any packages that it depends on. If the +package has a package-lock, or an npm shrinkwrap file, or a yarn lock file, +the installation of dependencies will be driven by that, respecting the +following order of precedence: + +* `npm-shrinkwrap.json` +* `package-lock.json` +* `yarn.lock` + +See [package-lock.json](/configuring-npm/package-lock-json) and +[`npm shrinkwrap`](/commands/npm-shrinkwrap). + +A `package` is: + +* a) a folder containing a program described by a + [`package.json`](/configuring-npm/package-json) file +* b) a gzipped tarball containing (a) +* c) a url that resolves to (b) +* d) a `@` that is published on the registry (see + [`registry`](/using-npm/registry)) with (c) +* e) a `@` (see [`npm dist-tag`](/commands/npm-dist-tag)) that + points to (d) +* f) a `` that has a "latest" tag satisfying (e) +* g) a `` that resolves to (a) + +Even if you never publish your package, you can still get a lot of benefits +of using npm if you just want to write a node program (a), and perhaps if +you also want to be able to easily install it elsewhere after packing it up +into a tarball (b). + + +* `npm install` (in a package directory, no arguments): + + Install the dependencies to the local `node_modules` folder. + + In global mode (ie, with `-g` or `--global` appended to the command), + it installs the current package context (ie, the current working + directory) as a global package. + + By default, `npm install` will install all modules listed as + dependencies in [`package.json`](/configuring-npm/package-json). + + With the `--production` flag (or when the `NODE_ENV` environment + variable is set to `production`), npm will not install modules listed + in `devDependencies`. To install all modules listed in both + `dependencies` and `devDependencies` when `NODE_ENV` environment + variable is set to `production`, you can use `--production=false`. + + > NOTE: The `--production` flag has no particular meaning when adding a + dependency to a project. + +* `npm install `: + + If `` sits inside the root of your project, its dependencies will be installed and may + be hoisted to the top-level `node_modules` as they would for other + types of dependencies. If `` sits outside the root of your project, + *npm will not install the package dependencies* in the directory ``, + but it will create a symlink to ``. + + > NOTE: If you want to install the content of a directory like a package from the registry instead of creating a link, you would need to use the `--install-links` option. + + Example: + + ```bash + npm install ../../other-package --install-links + npm install ./sub-package + ``` + +* `npm install `: + + Install a package that is sitting on the filesystem. Note: if you just + want to link a dev directory into your npm root, you can do this more + easily by using [`npm link`](/commands/npm-link). + + Tarball requirements: + * The filename *must* use `.tar`, `.tar.gz`, or `.tgz` as the + extension. + * The package contents should reside in a subfolder inside the tarball + (usually it is called `package/`). npm strips one directory layer + when installing the package (an equivalent of `tar x + --strip-components=1` is run). + * The package must contain a `package.json` file with `name` and + `version` properties. + + Example: + + ```bash + npm install ./package.tgz + ``` + +* `npm install `: + + Fetch the tarball url, and then install it. In order to distinguish between + this and other options, the argument must start with "http://" or "https://" + + Example: + + ```bash + npm install https://github.com/indexzero/forever/tarball/v0.5.6 + ``` + +* `npm install [<@scope>/]`: + + Do a `@` install, where `` is the "tag" config. (See + [`config`](/using-npm/config#tag). The config's default value is `latest`.) + + In most cases, this will install the version of the modules tagged as + `latest` on the npm registry. + + Example: + + ```bash + npm install sax + ``` + + `npm install` saves any specified packages into `dependencies` by default. + Additionally, you can control where and how they get saved with some + additional flags: + + * `-P, --save-prod`: Package will appear in your `dependencies`. This + is the default unless `-D` or `-O` are present. + + * `-D, --save-dev`: Package will appear in your `devDependencies`. + + * `--save-peer`: Package will appear in your `peerDependencies`. + + * `-O, --save-optional`: Package will appear in your + `optionalDependencies`. + + * `--no-save`: Prevents saving to `dependencies`. + + When using any of the above options to save dependencies to your + package.json, there are two additional, optional flags: + + * `-E, --save-exact`: Saved dependencies will be configured with an + exact version rather than using npm's default semver range operator. + + * `-B, --save-bundle`: Saved dependencies will also be added to your + `bundleDependencies` list. + + Further, if you have an `npm-shrinkwrap.json` or `package-lock.json` + then it will be updated as well. + + `` is optional. The package will be downloaded from the registry + associated with the specified scope. If no registry is associated with + the given scope the default registry is assumed. See + [`scope`](/using-npm/scope). + + Note: if you do not include the @-symbol on your scope name, npm will + interpret this as a GitHub repository instead, see below. Scopes names + must also be followed by a slash. + + Examples: + + ```bash + npm install sax + npm install githubname/reponame + npm install @myorg/privatepackage + npm install node-tap --save-dev + npm install dtrace-provider --save-optional + npm install readable-stream --save-exact + npm install ansi-regex --save-bundle + ``` + +* `npm install @npm:`: + + Install a package under a custom alias. Allows multiple versions of + a same-name package side-by-side, more convenient import names for + packages with otherwise long ones, and using git forks replacements + or forked npm packages as replacements. Aliasing works only on your + project and does not rename packages in transitive dependencies. + Aliases should follow the naming conventions stated in + [`validate-npm-package-name`](https://www.npmjs.com/package/validate-npm-package-name#naming-rules). + + Examples: + + ```bash + npm install my-react@npm:react + npm install jquery2@npm:jquery@2 + npm install jquery3@npm:jquery@3 + npm install npa@npm:npm-package-arg + ``` + +* `npm install [<@scope>/]@`: + + Install the version of the package that is referenced by the specified tag. + If the tag does not exist in the registry data for that package, then this + will fail. + + Example: + + ```bash + npm install sax@latest + npm install @myorg/mypackage@latest + ``` + +* `npm install [<@scope>/]@`: + + Install the specified version of the package. This will fail if the + version has not been published to the registry. + + Example: + + ```bash + npm install sax@0.1.1 + npm install @myorg/privatepackage@1.5.0 + ``` + +* `npm install [<@scope>/]@`: + + Install a version of the package matching the specified version range. + This will follow the same rules for resolving dependencies described in + [`package.json`](/configuring-npm/package-json). + + Note that most version ranges must be put in quotes so that your shell + will treat it as a single argument. + + Example: + + ```bash + npm install sax@">=0.1.0 <0.2.0" + npm install @myorg/privatepackage@"16 - 17" + ``` + +* `npm install `: + + Installs the package from the hosted git provider, cloning it with + `git`. For a full git remote url, only that URL will be attempted. + + ```bash + ://[[:]@][:][:][/][# | #semver:] + ``` + + `` is one of `git`, `git+ssh`, `git+http`, `git+https`, or + `git+file`. + + If `#` is provided, it will be used to clone exactly that + commit. If the commit-ish has the format `#semver:`, `` + can be any valid semver range or exact version, and npm will look for + any tags or refs matching that range in the remote repository, much as + it would for a registry dependency. If neither `#` or + `#semver:` is specified, then the default branch of the + repository is used. + + If the repository makes use of submodules, those submodules will be + cloned as well. + + If the package being installed contains a `prepare` script, its + `dependencies` and `devDependencies` will be installed, and the prepare + script will be run, before the package is packaged and installed. + + The following git environment variables are recognized by npm and will + be added to the environment when running git: + + * `GIT_ASKPASS` + * `GIT_EXEC_PATH` + * `GIT_PROXY_COMMAND` + * `GIT_SSH` + * `GIT_SSH_COMMAND` + * `GIT_SSL_CAINFO` + * `GIT_SSL_NO_VERIFY` + + See the git man page for details. + + Examples: + + ```bash + npm install git+ssh://git@github.com:npm/cli.git#v1.0.27 + npm install git+ssh://git@github.com:npm/cli#pull/273 + npm install git+ssh://git@github.com:npm/cli#semver:^5.0 + npm install git+https://isaacs@github.com/npm/cli.git + npm install git://github.com/npm/cli.git#v1.0.27 + GIT_SSH_COMMAND='ssh -i ~/.ssh/custom_ident' npm install git+ssh://git@github.com:npm/cli.git + ``` + +* `npm install /[#]`: +* `npm install github:/[#]`: + + Install the package at `https://github.com/githubname/githubrepo` by + attempting to clone it using `git`. + + If `#` is provided, it will be used to clone exactly that + commit. If the commit-ish has the format `#semver:`, `` + can be any valid semver range or exact version, and npm will look for + any tags or refs matching that range in the remote repository, much as + it would for a registry dependency. If neither `#` or + `#semver:` is specified, then the default branch is used. + + As with regular git dependencies, `dependencies` and `devDependencies` + will be installed if the package has a `prepare` script before the + package is done installing. + + Examples: + + ```bash + npm install mygithubuser/myproject + npm install github:mygithubuser/myproject + ``` + +* `npm install gist:[/][#|#semver:]`: + + Install the package at `https://gist.github.com/gistID` by attempting to + clone it using `git`. The GitHub username associated with the gist is + optional and will not be saved in `package.json`. + + As with regular git dependencies, `dependencies` and `devDependencies` will + be installed if the package has a `prepare` script before the package is + done installing. + + Example: + + ```bash + npm install gist:101a11beef + ``` + +* `npm install bitbucket:/[#]`: + + Install the package at `https://bitbucket.org/bitbucketname/bitbucketrepo` + by attempting to clone it using `git`. + + If `#` is provided, it will be used to clone exactly that + commit. If the commit-ish has the format `#semver:`, `` can + be any valid semver range or exact version, and npm will look for any tags + or refs matching that range in the remote repository, much as it would for a + registry dependency. If neither `#` or `#semver:` is + specified, then `master` is used. + + As with regular git dependencies, `dependencies` and `devDependencies` will + be installed if the package has a `prepare` script before the package is + done installing. + + Example: + + ```bash + npm install bitbucket:mybitbucketuser/myproject + ``` + +* `npm install gitlab:/[#]`: + + Install the package at `https://gitlab.com/gitlabname/gitlabrepo` + by attempting to clone it using `git`. + + If `#` is provided, it will be used to clone exactly that + commit. If the commit-ish has the format `#semver:`, `` can + be any valid semver range or exact version, and npm will look for any tags + or refs matching that range in the remote repository, much as it would for a + registry dependency. If neither `#` or `#semver:` is + specified, then `master` is used. + + As with regular git dependencies, `dependencies` and `devDependencies` will + be installed if the package has a `prepare` script before the package is + done installing. + + Example: + + ```bash + npm install gitlab:mygitlabuser/myproject + npm install gitlab:myusr/myproj#semver:^5.0 + ``` + +You may combine multiple arguments and even multiple types of arguments. +For example: + +```bash +npm install sax@">=0.1.0 <0.2.0" bench supervisor +``` + +The `--tag` argument will apply to all of the specified install targets. If +a tag with the given name exists, the tagged version is preferred over +newer versions. + +The `--dry-run` argument will report in the usual way what the install +would have done without actually installing anything. + +The `--package-lock-only` argument will only update the +`package-lock.json`, instead of checking `node_modules` and downloading +dependencies. + +The `-f` or `--force` argument will force npm to fetch remote resources +even if a local copy exists on disk. + +```bash +npm install sax --force +``` + +### Configuration + +See the [`config`](/using-npm/config) help doc. Many of the configuration +params have some effect on installation, since that's most of what npm +does. + +These are some of the most common options related to installation. + +#### `save` + +* Default: `true` unless when using `npm update` where it defaults to `false` +* Type: Boolean + +Save installed packages to a `package.json` file as dependencies. + +When used with the `npm rm` command, removes the dependency from +`package.json`. + +Will also prevent writing to `package-lock.json` if set to `false`. + + + +#### `save-exact` + +* Default: false +* Type: Boolean + +Dependencies saved to package.json will be configured with an exact version +rather than using npm's default semver range operator. + + + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `install-strategy` + +* Default: "hoisted" +* Type: "hoisted", "nested", "shallow", or "linked" + +Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted. + + + +#### `legacy-bundling` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=nested` + +Instead of hoisting package installs in `node_modules`, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets `--install-strategy=nested`. + + + +#### `global-style` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=shallow` + +Only install direct dependencies in the top level `node_modules`, but hoist +on deeper dependencies. Sets `--install-strategy=shallow`. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `strict-peer-deps` + +* Default: false +* Type: Boolean + +If set to `true`, and `--legacy-peer-deps` is not set, then _any_ +conflicting `peerDependencies` will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships. + +By default, conflicting `peerDependencies` deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's `peerDependencies` object. + +When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If `--strict-peer-deps` is set, then +this warning is treated as a failure. + + + +#### `prefer-dedupe` + +* Default: false +* Type: Boolean + +Prefer to deduplicate packages if possible, rather than choosing a newer +version of a dependency. + + + +#### `package-lock` + +* Default: true +* Type: Boolean + +If set to false, then ignore `package-lock.json` files when installing. This +will also prevent _writing_ `package-lock.json` if `save` is true. + + + +#### `package-lock-only` + +* Default: false +* Type: Boolean + +If set to true, the current operation will only use the `package-lock.json`, +ignoring `node_modules`. + +For `update` this means only the `package-lock.json` will be updated, +instead of checking `node_modules` and downloading dependencies. + +For `list` this means the output will be based on the tree described by the +`package-lock.json`, rather than the contents of `node_modules`. + + + +#### `foreground-scripts` + +* Default: `false` unless when using `npm pack` or `npm publish` where it + defaults to `true` +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + + + +#### `bin-links` + +* Default: true +* Type: Boolean + +Tells npm to create symlinks (or `.cmd` shims on Windows) for package +executables. + +Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems. + + + +#### `fund` + +* Default: true +* Type: Boolean + +When "true" displays the message at the end of each `npm install` +acknowledging the number of dependencies looking for funding. See [`npm +fund`](/commands/npm-fund) for details. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `cpu` + +* Default: null +* Type: null or String + +Override CPU architecture of native modules to install. Acceptable values +are same as `cpu` field of package.json, which comes from `process.arch`. + + + +#### `os` + +* Default: null +* Type: null or String + +Override OS of native modules to install. Acceptable values are same as `os` +field of package.json, which comes from `process.platform`. + + + +#### `libc` + +* Default: null +* Type: null or String + +Override libc of native modules to install. Acceptable values are same as +`libc` field of package.json + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### Algorithm + +Given a `package{dep}` structure: `A{B,C}, B{C}, C{D}`, +the npm install algorithm produces: + +```bash +A ++-- B ++-- C ++-- D +``` + +That is, the dependency from B to C is satisfied by the fact that A already +caused C to be installed at a higher level. D is still installed at the top +level because nothing conflicts with it. + +For `A{B,C}, B{C,D@1}, C{D@2}`, this algorithm produces: + +```bash +A ++-- B ++-- C + `-- D@2 ++-- D@1 +``` + +Because B's D@1 will be installed in the top-level, C now has to install +D@2 privately for itself. This algorithm is deterministic, but different +trees may be produced if two dependencies are requested for installation in +a different order. + +See [folders](/configuring-npm/folders) for a more detailed description of +the specific folder structures that npm creates. + +### See Also + +* [npm folders](/configuring-npm/folders) +* [npm update](/commands/npm-update) +* [npm audit](/commands/npm-audit) +* [npm fund](/commands/npm-fund) +* [npm link](/commands/npm-link) +* [npm rebuild](/commands/npm-rebuild) +* [npm scripts](/using-npm/scripts) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm registry](/using-npm/registry) +* [npm dist-tag](/commands/npm-dist-tag) +* [npm uninstall](/commands/npm-uninstall) +* [npm shrinkwrap](/commands/npm-shrinkwrap) +* [package.json](/configuring-npm/package-json) +* [workspaces](/using-npm/workspaces) diff --git a/node_modules/npm/docs/content/commands/npm-link.md b/node_modules/npm/docs/content/commands/npm-link.md new file mode 100644 index 00000000..34b893e4 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-link.md @@ -0,0 +1,396 @@ +--- +title: npm-link +section: 1 +description: Symlink a package folder +--- + +### Synopsis + +```bash +npm link [] + +alias: ln +``` + +### Description + +This is handy for installing your own stuff, so that you can work on it and +test iteratively without having to continually rebuild. + +Package linking is a two-step process. + +First, `npm link` in a package folder with no arguments will create a +symlink in the global folder `{prefix}/lib/node_modules/` that +links to the package where the `npm link` command was executed. It will +also link any bins in the package to `{prefix}/bin/{name}`. Note that +`npm link` uses the global prefix (see `npm prefix -g` for its value). + +Next, in some other location, `npm link package-name` will create a +symbolic link from globally-installed `package-name` to `node_modules/` of +the current folder. + +Note that `package-name` is taken from `package.json`, _not_ from the +directory name. + +The package name can be optionally prefixed with a scope. See +[`scope`](/using-npm/scope). The scope must be preceded by an @-symbol and +followed by a slash. + +When creating tarballs for `npm publish`, the linked packages are +"snapshotted" to their current state by resolving the symbolic links, if +they are included in `bundleDependencies`. + +For example: + +```bash +cd ~/projects/node-redis # go into the package directory +npm link # creates global link +cd ~/projects/node-bloggy # go into some other package directory. +npm link redis # link-install the package +``` + +Now, any changes to `~/projects/node-redis` will be reflected in +`~/projects/node-bloggy/node_modules/node-redis/`. Note that the link +should be to the package name, not the directory name for that package. + +You may also shortcut the two steps in one. For example, to do the +above use-case in a shorter way: + +```bash +cd ~/projects/node-bloggy # go into the dir of your main project +npm link ../node-redis # link the dir of your dependency +``` + +The second line is the equivalent of doing: + +```bash +(cd ../node-redis; npm link) +npm link redis +``` + +That is, it first creates a global link, and then links the global +installation target into your project's `node_modules` folder. + +Note that in this case, you are referring to the directory name, +`node-redis`, rather than the package name `redis`. + +If your linked package is scoped (see [`scope`](/using-npm/scope)) your +link command must include that scope, e.g. + +```bash +npm link @myorg/privatepackage +``` + +### Caveat + +Note that package dependencies linked in this way are _not_ saved to +`package.json` by default, on the assumption that the intention is to have +a link stand in for a regular non-link dependency. Otherwise, for example, +if you depend on `redis@^3.0.1`, and ran `npm link redis`, it would replace +the `^3.0.1` dependency with `file:../path/to/node-redis`, which you +probably don't want! Additionally, other users or developers on your +project would run into issues if they do not have their folders set up +exactly the same as yours. + +If you are adding a _new_ dependency as a link, you should add it to the +relevant metadata by running `npm install --package-lock-only`. + +If you _want_ to save the `file:` reference in your `package.json` and +`package-lock.json` files, you can use `npm link --save` to do so. + +### Workspace Usage + +`npm link --workspace ` will link the relevant package as a +dependency of the specified workspace(s). Note that It may actually be +linked into the parent project's `node_modules` folder, if there are no +conflicting dependencies. + +`npm link --workspace ` will create a global link to the specified +workspace(s). + +### Configuration + +#### `save` + +* Default: `true` unless when using `npm update` where it defaults to `false` +* Type: Boolean + +Save installed packages to a `package.json` file as dependencies. + +When used with the `npm rm` command, removes the dependency from +`package.json`. + +Will also prevent writing to `package-lock.json` if set to `false`. + + + +#### `save-exact` + +* Default: false +* Type: Boolean + +Dependencies saved to package.json will be configured with an exact version +rather than using npm's default semver range operator. + + + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `install-strategy` + +* Default: "hoisted" +* Type: "hoisted", "nested", "shallow", or "linked" + +Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted. + + + +#### `legacy-bundling` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=nested` + +Instead of hoisting package installs in `node_modules`, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets `--install-strategy=nested`. + + + +#### `global-style` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=shallow` + +Only install direct dependencies in the top level `node_modules`, but hoist +on deeper dependencies. Sets `--install-strategy=shallow`. + + + +#### `strict-peer-deps` + +* Default: false +* Type: Boolean + +If set to `true`, and `--legacy-peer-deps` is not set, then _any_ +conflicting `peerDependencies` will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships. + +By default, conflicting `peerDependencies` deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's `peerDependencies` object. + +When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If `--strict-peer-deps` is set, then +this warning is treated as a failure. + + + +#### `package-lock` + +* Default: true +* Type: Boolean + +If set to false, then ignore `package-lock.json` files when installing. This +will also prevent _writing_ `package-lock.json` if `save` is true. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + + + +#### `bin-links` + +* Default: true +* Type: Boolean + +Tells npm to create symlinks (or `.cmd` shims on Windows) for package +executables. + +Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems. + + + +#### `fund` + +* Default: true +* Type: Boolean + +When "true" displays the message at the end of each `npm install` +acknowledging the number of dependencies looking for funding. See [`npm +fund`](/commands/npm-fund) for details. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm developers](/using-npm/developers) +* [package.json](/configuring-npm/package-json) +* [npm install](/commands/npm-install) +* [npm folders](/configuring-npm/folders) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) diff --git a/node_modules/npm/docs/content/commands/npm-login.md b/node_modules/npm/docs/content/commands/npm-login.md new file mode 100644 index 00000000..531dc71a --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-login.md @@ -0,0 +1,93 @@ +--- +title: npm-login +section: 1 +description: Login to a registry user account +--- + +### Synopsis + +```bash +npm login +``` + +Note: This command is unaware of workspaces. + +### Description + +Verify a user in the specified registry, and save the credentials to the +`.npmrc` file. If no registry is specified, the default registry will be +used (see [`config`](/using-npm/config)). + +When using `legacy` for your `auth-type`, the username and password, are +read in from prompts. + +To reset your password, go to + +To change your email address, go to + +You may use this command multiple times with the same user account to +authorize on a new machine. When authenticating on a new machine, +the username, password and email address must all match with +your existing record. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `scope` + +* Default: the scope of the current project, if any, or "" +* Type: String + +Associate an operation with a scope for a scoped registry. + +Useful when logging in to or out of a private registry: + +``` +# log in, linking the scope to the custom registry +npm login --scope=@mycorp --registry=https://registry.mycorp.com + +# log out, removing the link and the auth token +npm logout --scope=@mycorp +``` + +This will cause `@mycorp` to be mapped to the registry for future +installation of packages specified according to the pattern +`@mycorp/package`. + +This will also cause `npm init` to create a scoped package. + +``` +# accept all defaults, and create a package named "@foo/whatever", +# instead of just named "whatever" +npm init --scope=@foo --yes +``` + + + +#### `auth-type` + +* Default: "web" +* Type: "legacy" or "web" + +What authentication strategy to use with `login`. Note that if an `otp` +config is given, this value will always be set to `legacy`. + + + +### See Also + +* [npm registry](/using-npm/registry) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm owner](/commands/npm-owner) +* [npm whoami](/commands/npm-whoami) +* [npm token](/commands/npm-token) +* [npm profile](/commands/npm-profile) diff --git a/node_modules/npm/docs/content/commands/npm-logout.md b/node_modules/npm/docs/content/commands/npm-logout.md new file mode 100644 index 00000000..2d5aa3e5 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-logout.md @@ -0,0 +1,75 @@ +--- +title: npm-logout +section: 1 +description: Log out of the registry +--- + +### Synopsis + +```bash +npm logout +``` + +Note: This command is unaware of workspaces. + +### Description + +When logged into a registry that supports token-based authentication, tell +the server to end this token's session. This will invalidate the token +everywhere you're using it, not just for the current environment. + +When logged into a legacy registry that uses username and password +authentication, this will clear the credentials in your user configuration. +In this case, it will _only_ affect the current environment. + +If `--scope` is provided, this will find the credentials for the registry +connected to that scope, if set. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `scope` + +* Default: the scope of the current project, if any, or "" +* Type: String + +Associate an operation with a scope for a scoped registry. + +Useful when logging in to or out of a private registry: + +``` +# log in, linking the scope to the custom registry +npm login --scope=@mycorp --registry=https://registry.mycorp.com + +# log out, removing the link and the auth token +npm logout --scope=@mycorp +``` + +This will cause `@mycorp` to be mapped to the registry for future +installation of packages specified according to the pattern +`@mycorp/package`. + +This will also cause `npm init` to create a scoped package. + +``` +# accept all defaults, and create a package named "@foo/whatever", +# instead of just named "whatever" +npm init --scope=@foo --yes +``` + + + +### See Also + +* [npm adduser](/commands/npm-adduser) +* [npm registry](/using-npm/registry) +* [npm config](/commands/npm-config) +* [npm whoami](/commands/npm-whoami) diff --git a/node_modules/npm/docs/content/commands/npm-ls.md b/node_modules/npm/docs/content/commands/npm-ls.md new file mode 100644 index 00000000..1169da1f --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-ls.md @@ -0,0 +1,266 @@ +--- +title: npm-ls +section: 1 +description: List installed packages +--- + +### Synopsis + +```bash +npm ls + +alias: list +``` + +### Description + +This command will print to stdout all the versions of packages that are +installed, as well as their dependencies when `--all` is specified, in a +tree structure. + +Note: to get a "bottoms up" view of why a given package is included in the +tree at all, use [`npm explain`](/commands/npm-explain). + +Positional arguments are `name@version-range` identifiers, which will limit +the results to only the paths to the packages named. Note that nested +packages will *also* show the paths to the specified packages. For +example, running `npm ls promzard` in npm's source tree will show: + +```bash +npm@11.0.0 /path/to/npm +└─┬ init-package-json@0.0.4 + └── promzard@0.1.5 +``` + +It will print out extraneous, missing, and invalid packages. + +If a project specifies git urls for dependencies these are shown +in parentheses after the `name@version` to make it easier for users to +recognize potential forks of a project. + +The tree shown is the logical dependency tree, based on package +dependencies, not the physical layout of your `node_modules` folder. + +When run as `ll` or `la`, it shows extended information by default. + +### Configuration + +#### `all` + +* Default: false +* Type: Boolean + +When running `npm outdated` and `npm ls`, setting `--all` will show all +outdated or installed packages, rather than only those directly depended +upon by the current project. + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `long` + +* Default: false +* Type: Boolean + +Show extended information in `ls`, `search`, and `help-search`. + + + +#### `parseable` + +* Default: false +* Type: Boolean + +Output parseable results from commands that write to standard output. For +`npm search`, this will be tab-separated table format. + + + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `depth` + +* Default: `Infinity` if `--all` is set, otherwise `1` +* Type: null or Number + +The depth to go when recursing packages for `npm ls`. + +If not set, `npm ls` will show only the immediate dependencies of the root +project. If `--all` is set, then npm will show all dependencies by default. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `link` + +* Default: false +* Type: Boolean + +Used with `npm ls`, limiting output to only those packages that are linked. + + + +#### `package-lock-only` + +* Default: false +* Type: Boolean + +If set to true, the current operation will only use the `package-lock.json`, +ignoring `node_modules`. + +For `update` this means only the `package-lock.json` will be updated, +instead of checking `node_modules` and downloading dependencies. + +For `list` this means the output will be based on the tree described by the +`package-lock.json`, rather than the contents of `node_modules`. + + + +#### `unicode` + +* Default: false on windows, true on mac/unix systems with a unicode locale, + as defined by the `LC_ALL`, `LC_CTYPE`, or `LANG` environment variables. +* Type: Boolean + +When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters instead of unicode glyphs. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm explain](/commands/npm-explain) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm folders](/configuring-npm/folders) +* [npm explain](/commands/npm-explain) +* [npm install](/commands/npm-install) +* [npm link](/commands/npm-link) +* [npm prune](/commands/npm-prune) +* [npm outdated](/commands/npm-outdated) +* [npm update](/commands/npm-update) diff --git a/node_modules/npm/docs/content/commands/npm-org.md b/node_modules/npm/docs/content/commands/npm-org.md new file mode 100644 index 00000000..f0652473 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-org.md @@ -0,0 +1,114 @@ +--- +title: npm-org +section: 1 +description: Manage orgs +--- + +### Synopsis + +```bash +npm org set orgname username [developer | admin | owner] +npm org rm orgname username +npm org ls orgname [] + +alias: ogr +``` + +Note: This command is unaware of workspaces. + +### Example + +Add a new developer to an org: + +```bash +$ npm org set my-org @mx-smith +``` + +Add a new admin to an org (or change a developer to an admin): + +```bash +$ npm org set my-org @mx-santos admin +``` + +Remove a user from an org: + +```bash +$ npm org rm my-org mx-santos +``` + +List all users in an org: + +```bash +$ npm org ls my-org +``` + +List all users in JSON format: + +```bash +$ npm org ls my-org --json +``` + +See what role a user has in an org: + +```bash +$ npm org ls my-org @mx-santos +``` + +### Description + +You can use the `npm org` commands to manage and view users of an +organization. It supports adding and removing users, changing their roles, +listing them, and finding specific ones and their roles. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `parseable` + +* Default: false +* Type: Boolean + +Output parseable results from commands that write to standard output. For +`npm search`, this will be tab-separated table format. + + + +### See Also + +* [using orgs](/using-npm/orgs) +* [Documentation on npm Orgs](https://docs.npmjs.com/orgs/) diff --git a/node_modules/npm/docs/content/commands/npm-outdated.md b/node_modules/npm/docs/content/commands/npm-outdated.md new file mode 100644 index 00000000..b1a1c626 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-outdated.md @@ -0,0 +1,178 @@ +--- +title: npm-outdated +section: 1 +description: Check for outdated packages +--- + +### Synopsis + +```bash +npm outdated [ ...] +``` + +### Description + +This command will check the registry to see if any (or, specific) installed +packages are currently outdated. + +By default, only the direct dependencies of the root project and direct +dependencies of your configured *workspaces* are shown. +Use `--all` to find all outdated meta-dependencies as well. + +In the output: + +* `wanted` is the maximum version of the package that satisfies the semver + range specified in `package.json`. If there's no available semver range + (i.e. you're running `npm outdated --global`, or the package isn't + included in `package.json`), then `wanted` shows the currently-installed + version. +* `latest` is the version of the package tagged as latest in the registry. + Running `npm publish` with no special configuration will publish the + package with a dist-tag of `latest`. This may or may not be the maximum + version of the package, or the most-recently published version of the + package, depending on how the package's developer manages the latest + [dist-tag](/commands/npm-dist-tag). +* `location` is where in the physical tree the package is located. +* `depended by` shows which package depends on the displayed dependency +* `package type` (when using `--long` / `-l`) tells you whether this + package is a `dependency` or a dev/peer/optional dependency. Packages not + included in `package.json` are always marked `dependencies`. +* `homepage` (when using `--long` / `-l`) is the `homepage` value contained + in the package's packument +* Red means there's a newer version matching your semver requirements, so + you should update now. +* Yellow indicates that there's a newer version _above_ your semver + requirements (usually new major, or new 0.x minor) so proceed with + caution. + +### An example + +```bash +$ npm outdated +Package Current Wanted Latest Location Depended by +glob 5.0.15 5.0.15 6.0.1 node_modules/glob dependent-package-name +nothingness 0.0.3 git git node_modules/nothingness dependent-package-name +npm 3.5.1 3.5.2 3.5.1 node_modules/npm dependent-package-name +local-dev 0.0.3 linked linked local-dev dependent-package-name +once 1.3.2 1.3.3 1.3.3 node_modules/once dependent-package-name +``` + +With these `dependencies`: +```json +{ + "glob": "^5.0.15", + "nothingness": "github:othiym23/nothingness#master", + "npm": "^3.5.1", + "once": "^1.3.1" +} +``` + +A few things to note: + +* `glob` requires `^5`, which prevents npm from installing `glob@6`, which + is outside the semver range. +* Git dependencies will always be reinstalled, because of how they're + specified. The installed committish might satisfy the dependency + specifier (if it's something immutable, like a commit SHA), or it might + not, so `npm outdated` and `npm update` have to fetch Git repos to check. + This is why currently doing a reinstall of a Git dependency always forces + a new clone and install. +* `npm@3.5.2` is marked as "wanted", but "latest" is `npm@3.5.1` because + npm uses dist-tags to manage its `latest` and `next` release channels. + `npm update` will install the _newest_ version, but `npm install npm` + (with no semver range) will install whatever's tagged as `latest`. +* `once` is just plain out of date. Reinstalling `node_modules` from + scratch or running `npm update` will bring it up to spec. + +### Configuration + +#### `all` + +* Default: false +* Type: Boolean + +When running `npm outdated` and `npm ls`, setting `--all` will show all +outdated or installed packages, rather than only those directly depended +upon by the current project. + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `long` + +* Default: false +* Type: Boolean + +Show extended information in `ls`, `search`, and `help-search`. + + + +#### `parseable` + +* Default: false +* Type: Boolean + +Output parseable results from commands that write to standard output. For +`npm search`, this will be tab-separated table format. + + + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm update](/commands/npm-update) +* [npm dist-tag](/commands/npm-dist-tag) +* [npm registry](/using-npm/registry) +* [npm folders](/configuring-npm/folders) +* [npm workspaces](/using-npm/workspaces) diff --git a/node_modules/npm/docs/content/commands/npm-owner.md b/node_modules/npm/docs/content/commands/npm-owner.md new file mode 100644 index 00000000..cd172adc --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-owner.md @@ -0,0 +1,106 @@ +--- +title: npm-owner +section: 1 +description: Manage package owners +--- + +### Synopsis + +```bash +npm owner add +npm owner rm +npm owner ls + +alias: author +``` + +### Description + +Manage ownership of published packages. + +* ls: List all the users who have access to modify a package and push new + versions. Handy when you need to know who to bug for help. +* add: Add a new user as a maintainer of a package. This user is enabled + to modify metadata, publish new versions, and add other owners. +* rm: Remove a user from the package owner list. This immediately revokes + their privileges. + +Note that there is only one level of access. Either you can modify a package, +or you can't. Future versions may contain more fine-grained access levels, but +that is not implemented at this time. + +If you have two-factor authentication enabled with `auth-and-writes` (see +[`npm-profile`](/commands/npm-profile)) then you'll need to go through a second factor +flow when changing ownership or include an otp on the command line with `--otp`. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm profile](/commands/npm-profile) +* [npm publish](/commands/npm-publish) +* [npm registry](/using-npm/registry) +* [npm adduser](/commands/npm-adduser) diff --git a/node_modules/npm/docs/content/commands/npm-pack.md b/node_modules/npm/docs/content/commands/npm-pack.md new file mode 100644 index 00000000..2d3e3453 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-pack.md @@ -0,0 +1,140 @@ +--- +title: npm-pack +section: 1 +description: Create a tarball from a package +--- + +### Synopsis + +```bash +npm pack +``` + +### Configuration + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `pack-destination` + +* Default: "." +* Type: String + +Directory in which `npm pack` will save tarballs. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +### Description + +For anything that's installable (that is, a package folder, tarball, +tarball url, git url, name@tag, name@version, name, or scoped name), this +command will fetch it to the cache, copy the tarball to the current working +directory as `-.tgz`, and then write the filenames out to +stdout. + +If the same package is specified multiple times, then the file will be +overwritten the second time. + +If no arguments are supplied, then npm packs the current package folder. + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm-packlist package](http://npm.im/npm-packlist) +* [npm cache](/commands/npm-cache) +* [npm publish](/commands/npm-publish) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) diff --git a/node_modules/npm/docs/content/commands/npm-ping.md b/node_modules/npm/docs/content/commands/npm-ping.md new file mode 100644 index 00000000..cc3326f7 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-ping.md @@ -0,0 +1,46 @@ +--- +title: npm-ping +section: 1 +description: Ping npm registry +--- + +### Synopsis + +```bash +npm ping +``` + +Note: This command is unaware of workspaces. + +### Description + +Ping the configured or given npm registry and verify authentication. +If it works it will output something like: + +```bash +npm notice PING https://registry.npmjs.org/ +npm notice PONG 255ms +``` +otherwise you will get an error: +```bash +npm notice PING http://foo.com/ +npm ERR! code E404 +npm ERR! 404 Not Found - GET http://www.foo.com/-/ping?write=true +``` + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +### See Also + +* [npm doctor](/commands/npm-doctor) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) diff --git a/node_modules/npm/docs/content/commands/npm-pkg.md b/node_modules/npm/docs/content/commands/npm-pkg.md new file mode 100644 index 00000000..f668c562 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-pkg.md @@ -0,0 +1,272 @@ +--- +title: npm-pkg +section: 1 +description: Manages your package.json +--- + +### Synopsis + +```bash +npm pkg set = [= ...] +npm pkg get [ [ ...]] +npm pkg delete [ ...] +npm pkg set [[].= ...] +npm pkg set [[].= ...] +npm pkg fix +``` + +### Description + +A command that automates the management of `package.json` files. +`npm pkg` provide 3 different sub commands that allow you to modify or retrieve +values for given object keys in your `package.json`. + +The syntax to retrieve and set fields is a dot separated representation of +the nested object properties to be found within your `package.json`, it's the +same notation used in [`npm view`](/commands/npm-view) to retrieve information +from the registry manifest, below you can find more examples on how to use it. + +Returned values are always in **json** format. + +* `npm pkg get ` + + Retrieves a value `key`, defined in your `package.json` file. + + For example, in order to retrieve the name of the current package, you + can run: + + ```bash + npm pkg get name + ``` + + It's also possible to retrieve multiple values at once: + + ```bash + npm pkg get name version + ``` + + You can view child fields by separating them with a period. To retrieve + the value of a test `script` value, you would run the following command: + + ```bash + npm pkg get scripts.test + ``` + + For fields that are arrays, requesting a non-numeric field will return + all of the values from the objects in the list. For example, to get all + the contributor emails for a package, you would run: + + ```bash + npm pkg get contributors.email + ``` + + You may also use numeric indices in square braces to specifically select + an item in an array field. To just get the email address of the first + contributor in the list, you can run: + + ```bash + npm pkg get contributors[0].email + ``` + + For complex fields you can also name a property in square brackets + to specifically select a child field. This is especially helpful + with the exports object: + + ```bash + npm pkg get "exports[.].require" + ``` + +* `npm pkg set =` + + Sets a `value` in your `package.json` based on the `field` value. When + saving to your `package.json` file the same set of rules used during + `npm install` and other cli commands that touches the `package.json` file + are used, making sure to respect the existing indentation and possibly + applying some validation prior to saving values to the file. + + The same syntax used to retrieve values from your package can also be used + to define new properties or overriding existing ones, below are some + examples of how the dot separated syntax can be used to edit your + `package.json` file. + + Defining a new bin named `mynewcommand` in your `package.json` that points + to a file `cli.js`: + + ```bash + npm pkg set bin.mynewcommand=cli.js + ``` + + Setting multiple fields at once is also possible: + + ```bash + npm pkg set description='Awesome package' engines.node='>=10' + ``` + + It's also possible to add to array values, for example to add a new + contributor entry: + + ```bash + npm pkg set contributors[0].name='Foo' contributors[0].email='foo@bar.ca' + ``` + + You may also append items to the end of an array using the special + empty bracket notation: + + ```bash + npm pkg set contributors[].name='Foo' contributors[].name='Bar' + ``` + + It's also possible to parse values as json prior to saving them to your + `package.json` file, for example in order to set a `"private": true` + property: + + ```bash + npm pkg set private=true --json + ``` + + It also enables saving values as numbers: + + ```bash + npm pkg set tap.timeout=60 --json + ``` + +* `npm pkg delete ` + + Deletes a `key` from your `package.json` + + The same syntax used to set values from your package can also be used + to remove existing ones. For example, in order to remove a script named + build: + + ```bash + npm pkg delete scripts.build + ``` + +* `npm pkg fix` + + Auto corrects common errors in your `package.json`. npm already + does this during `publish`, which leads to subtle (mostly harmless) + differences between the contents of your `package.json` file and the + manifest that npm uses during installation. + +### Workspaces support + +You can set/get/delete items across your configured workspaces by using the +[`workspace`](/using-npm/config#workspace) or +[`workspaces`](/using-npm/config#workspaces) config options. + +For example, setting a `funding` value across all configured workspaces +of a project: + +```bash +npm pkg set funding=https://example.com --ws +``` + +When using `npm pkg get` to retrieve info from your configured workspaces, the +returned result will be in a json format in which top level keys are the +names of each workspace, the values of these keys will be the result values +returned from each of the configured workspaces, e.g: + +``` +npm pkg get name version --ws +{ + "a": { + "name": "a", + "version": "1.0.0" + }, + "b": { + "name": "b", + "version": "1.0.0" + } +} +``` + +### Configuration + +#### `force` + +* Default: false +* Type: Boolean + +Removes various protections against unfortunate side effects, common +mistakes, unnecessary performance degradation, and malicious input. + +* Allow clobbering non-npm files in global installs. +* Allow the `npm version` command to work on an unclean git repository. +* Allow deleting the cache folder with `npm cache clean`. +* Allow installing packages that have an `engines` declaration requiring a + different version of npm. +* Allow installing packages that have an `engines` declaration requiring a + different version of `node`, even if `--engine-strict` is enabled. +* Allow `npm audit fix` to install modules outside your stated dependency + range (including SemVer-major changes). +* Allow unpublishing all versions of a published package. +* Allow conflicting peerDependencies to be installed in the root project. +* Implicitly set `--yes` during `npm init`. +* Allow clobbering existing values in `npm pkg` +* Allow unpublishing of entire packages (not just a single version). + +If you don't have a clear idea of what you want to do, it is strongly +recommended that you do not use this option! + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. +## See Also + +* [npm install](/commands/npm-install) +* [npm init](/commands/npm-init) +* [npm config](/commands/npm-config) +* [workspaces](/using-npm/workspaces) diff --git a/node_modules/npm/docs/content/commands/npm-prefix.md b/node_modules/npm/docs/content/commands/npm-prefix.md new file mode 100644 index 00000000..ad584643 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-prefix.md @@ -0,0 +1,59 @@ +--- +title: npm-prefix +section: 1 +description: Display prefix +--- + +### Synopsis + +```bash +npm prefix +``` + +Note: This command is unaware of workspaces. + +### Description + +Print the local prefix to standard output. This is the closest parent directory +to contain a `package.json` file or `node_modules` directory, unless `-g` is +also specified. + +If `-g` is specified, this will be the value of the global prefix. See +[`npm config`](/commands/npm-config) for more detail. + +### Example + +```bash +npm prefix +/usr/local/projects/foo +``` + +```bash +npm prefix -g +/usr/local +``` + +### Configuration + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +### See Also + +* [npm root](/commands/npm-root) +* [npm folders](/configuring-npm/folders) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) diff --git a/node_modules/npm/docs/content/commands/npm-profile.md b/node_modules/npm/docs/content/commands/npm-profile.md new file mode 100644 index 00000000..2468d6c8 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-profile.md @@ -0,0 +1,120 @@ +--- +title: npm-profile +section: 1 +description: Change settings on your registry profile +--- + +### Synopsis + +```bash +npm profile enable-2fa [auth-only|auth-and-writes] +npm profile disable-2fa +npm profile get [] +npm profile set +``` + +Note: This command is unaware of workspaces. + +### Description + +Change your profile information on the registry. Note that this command +depends on the registry implementation, so third-party registries may not +support this interface. + +* `npm profile get []`: Display all of the properties of your + profile, or one or more specific properties. It looks like: + +``` +name: example +email: e@example.com (verified) +two-factor auth: auth-and-writes +fullname: Example User +homepage: +freenode: +twitter: +github: +created: 2015-02-26T01:38:35.892Z +updated: 2017-10-02T21:29:45.922Z +``` + +* `npm profile set `: Set the value of a profile + property. You can set the following properties this way: email, fullname, + homepage, freenode, twitter, github + +* `npm profile set password`: Change your password. This is interactive, + you'll be prompted for your current password and a new password. You'll + also be prompted for an OTP if you have two-factor authentication + enabled. + +* `npm profile enable-2fa [auth-and-writes|auth-only]`: Enables two-factor + authentication. Defaults to `auth-and-writes` mode. Modes are: + * `auth-only`: Require an OTP when logging in or making changes to your + account's authentication. The OTP will be required on both the website + and the command line. + * `auth-and-writes`: Requires an OTP at all the times `auth-only` does, + and also requires one when publishing a module, setting the `latest` + dist-tag, or changing access via `npm access` and `npm owner`. + +* `npm profile disable-2fa`: Disables two-factor authentication. + +### Details + +Some of these commands may not be available on non npmjs.com registries. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `parseable` + +* Default: false +* Type: Boolean + +Output parseable results from commands that write to standard output. For +`npm search`, this will be tab-separated table format. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +### See Also + +* [npm adduser](/commands/npm-adduser) +* [npm registry](/using-npm/registry) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm owner](/commands/npm-owner) +* [npm whoami](/commands/npm-whoami) +* [npm token](/commands/npm-token) diff --git a/node_modules/npm/docs/content/commands/npm-prune.md b/node_modules/npm/docs/content/commands/npm-prune.md new file mode 100644 index 00000000..3a5894cb --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-prune.md @@ -0,0 +1,197 @@ +--- +title: npm-prune +section: 1 +description: Remove extraneous packages +--- + +### Synopsis + +```bash +npm prune [[<@scope>/]...] +``` + +### Description + +This command removes "extraneous" packages. If a package name is provided, +then only packages matching one of the supplied names are removed. + +Extraneous packages are those present in the `node_modules` folder that are +not listed as any package's dependency list. + +If the `--omit=dev` flag is specified or the `NODE_ENV` environment +variable is set to `production`, this command will remove the packages +specified in your `devDependencies`. + +If the `--dry-run` flag is used then no changes will actually be made. + +If the `--json` flag is used, then the changes `npm prune` made (or would +have made with `--dry-run`) are printed as a JSON object. + +In normal operation, extraneous modules are pruned automatically, so you'll +only need this command with the `--production` flag. However, in the real +world, operation is not always "normal". When crashes or mistakes happen, +this command can help clean up any resulting garbage. + +### Configuration + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `foreground-scripts` + +* Default: `false` unless when using `npm pack` or `npm publish` where it + defaults to `true` +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [npm uninstall](/commands/npm-uninstall) +* [npm folders](/configuring-npm/folders) +* [npm ls](/commands/npm-ls) diff --git a/node_modules/npm/docs/content/commands/npm-publish.md b/node_modules/npm/docs/content/commands/npm-publish.md new file mode 100644 index 00000000..266038c3 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-publish.md @@ -0,0 +1,241 @@ +--- +title: npm-publish +section: 1 +description: Publish a package +--- + +### Synopsis + +```bash +npm publish +``` + +### Description + +Publishes a package to the registry so that it can be installed by name. + +By default npm will publish to the public registry. This can be +overridden by specifying a different default registry or using a +[`scope`](/using-npm/scope) in the name, combined with a +scope-configured registry (see +[`package.json`](/configuring-npm/package-json)). + + +A `package` is interpreted the same way as other commands (like +`npm install`) and can be: + +* a) a folder containing a program described by a + [`package.json`](/configuring-npm/package-json) file +* b) a gzipped tarball containing (a) +* c) a url that resolves to (b) +* d) a `@` that is published on the registry (see + [`registry`](/using-npm/registry)) with (c) +* e) a `@` (see [`npm dist-tag`](/commands/npm-dist-tag)) that + points to (d) +* f) a `` that has a "latest" tag satisfying (e) +* g) a `` that resolves to (a) + +The publish will fail if the package name and version combination already +exists in the specified registry. + +Once a package is published with a given name and version, that specific +name and version combination can never be used again, even if it is removed +with [`npm unpublish`](/commands/npm-unpublish). + +As of `npm@5`, both a sha1sum and an integrity field with a sha512sum of the +tarball will be submitted to the registry during publication. Subsequent +installs will use the strongest supported algorithm to verify downloads. + +Similar to `--dry-run` see [`npm pack`](/commands/npm-pack), which figures +out the files to be included and packs them into a tarball to be uploaded +to the registry. + +### Files included in package + +To see what will be included in your package, run `npm pack --dry-run`. All +files are included by default, with the following exceptions: + +- Certain files that are relevant to package installation and distribution + are always included. For example, `package.json`, `README.md`, + `LICENSE`, and so on. + +- If there is a "files" list in + [`package.json`](/configuring-npm/package-json), then only the files + specified will be included. (If directories are specified, then they + will be walked recursively and their contents included, subject to the + same ignore rules.) + +- If there is a `.gitignore` or `.npmignore` file, then ignored files in + that and all child directories will be excluded from the package. If + _both_ files exist, then the `.gitignore` is ignored, and only the + `.npmignore` is used. + + `.npmignore` files follow the [same pattern + rules](https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring) + as `.gitignore` files + +- If the file matches certain patterns, then it will _never_ be included, + unless explicitly added to the `"files"` list in `package.json`, or + un-ignored with a `!` rule in a `.npmignore` or `.gitignore` file. + +- Symbolic links are never included in npm packages. + + +See [`developers`](/using-npm/developers) for full details on what's +included in the published package, as well as details on how the package is +built. + +See [`package.json`](/configuring-npm/package-json) for more info on +what can and can't be ignored. + +### Configuration + +#### `tag` + +* Default: "latest" +* Type: String + +If you ask npm to install a package and don't tell it a specific version, +then it will install the specified tag. + +It is the tag added to the package@version specified in the `npm dist-tag +add` command, if no explicit tag is given. + +When used by the `npm diff` command, this is the tag used to fetch the +tarball that will be compared with the local files by default. + +If used in the `npm publish` command, this is the tag that will be added to +the package submitted to the registry. + + + +#### `access` + +* Default: 'public' for new packages, existing packages it will not change the + current level +* Type: null, "restricted", or "public" + +If you do not want your scoped package to be publicly viewable (and +installable) set `--access=restricted`. + +Unscoped packages can not be set to `restricted`. + +Note: This defaults to not changing the current access level for existing +packages. Specifying a value of `restricted` or `public` during publish will +change the access for an existing package the same way that `npm access set +status` would. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `provenance` + +* Default: false +* Type: Boolean + +When publishing from a supported cloud CI/CD system, the package will be +publicly linked to where it was built and published from. + +This config can not be used with: `provenance-file` + +#### `provenance-file` + +* Default: null +* Type: Path + +When publishing, the provenance bundle at the given path will be used. + +This config can not be used with: `provenance` + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm-packlist package](http://npm.im/npm-packlist) +* [npm registry](/using-npm/registry) +* [npm scope](/using-npm/scope) +* [npm adduser](/commands/npm-adduser) +* [npm owner](/commands/npm-owner) +* [npm deprecate](/commands/npm-deprecate) +* [npm dist-tag](/commands/npm-dist-tag) +* [npm pack](/commands/npm-pack) +* [npm profile](/commands/npm-profile) diff --git a/node_modules/npm/docs/content/commands/npm-query.md b/node_modules/npm/docs/content/commands/npm-query.md new file mode 100644 index 00000000..7d60a477 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-query.md @@ -0,0 +1,273 @@ +--- +title: npm-query +section: 1 +description: Dependency selector query +--- + +### Synopsis + +```bash +npm query +``` + +### Description + +The `npm query` command allows for usage of css selectors in order to retrieve +an array of dependency objects. + +### Piping npm query to other commands + +```bash +# find all dependencies with postinstall scripts & uninstall them +npm query ":attr(scripts, [postinstall])" | jq 'map(.name)|join("\n")' -r | xargs -I {} npm uninstall {} + +# find all git dependencies & explain who requires them +npm query ":type(git)" | jq 'map(.name)' | xargs -I {} npm why {} +``` + +### Extended Use Cases & Queries + +```stylus +// all deps +* + +// all direct deps +:root > * + +// direct production deps +:root > .prod + +// direct development deps +:root > .dev + +// any peer dep of a direct deps +:root > * > .peer + +// any workspace dep +.workspace + +// all workspaces that depend on another workspace +.workspace > .workspace + +// all workspaces that have peer deps +.workspace:has(.peer) + +// any dep named "lodash" +// equivalent to [name="lodash"] +#lodash + +// any deps named "lodash" & within semver range ^"1.2.3" +#lodash@^1.2.3 +// equivalent to... +[name="lodash"]:semver(^1.2.3) + +// get the hoisted node for a given semver range +#lodash@^1.2.3:not(:deduped) + +// querying deps with a specific version +#lodash@2.1.5 +// equivalent to... +[name="lodash"][version="2.1.5"] + +// has any deps +:has(*) + +// deps with no other deps (ie. "leaf" nodes) +:empty + +// manually querying git dependencies +[repository^=github:], +[repository^=git:], +[repository^=https://github.com], +[repository^=http://github.com], +[repository^=https://github.com], +[repository^=+git:...] + +// querying for all git dependencies +:type(git) + +// get production dependencies that aren't also dev deps +.prod:not(.dev) + +// get dependencies with specific licenses +[license=MIT], [license=ISC] + +// find all packages that have @ruyadorno as a contributor +:attr(contributors, [email=ruyadorno@github.com]) +``` + +### Example Response Output + +- an array of dependency objects is returned which can contain multiple copies of the same package which may or may not have been linked or deduped + +```json +[ + { + "name": "", + "version": "", + "description": "", + "homepage": "", + "bugs": {}, + "author": {}, + "license": {}, + "funding": {}, + "files": [], + "main": "", + "browser": "", + "bin": {}, + "man": [], + "directories": {}, + "repository": {}, + "scripts": {}, + "config": {}, + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "bundledDependencies": {}, + "peerDependencies": {}, + "peerDependenciesMeta": {}, + "engines": {}, + "os": [], + "cpu": [], + "workspaces": {}, + "keywords": [], + ... + }, + ... +``` + +### Expecting a certain number of results + +One common use of `npm query` is to make sure there is only one version of +a certain dependency in your tree. This is especially common for +ecosystems like that rely on `typescript` where having state split +across two different but identically-named packages causes bugs. You +can use the `--expect-results` or `--expect-result-count` in your setup +to ensure that npm will exit with an exit code if your tree doesn't look +like you want it to. + + +```sh +$ npm query '#react' --expect-result-count=1 +``` + +Perhaps you want to quickly check if there are any production +dependencies that could be updated: + +```sh +$ npm query ':root>:outdated(in-range).prod' --no-expect-results +``` + +### Package lock only mode + +If package-lock-only is enabled, only the information in the package lock (or shrinkwrap) is loaded. This means that information from the package.json files of your dependencies will not be included in the result set (e.g. description, homepage, engines). + +### Configuration + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `package-lock-only` + +* Default: false +* Type: Boolean + +If set to true, the current operation will only use the `package-lock.json`, +ignoring `node_modules`. + +For `update` this means only the `package-lock.json` will be updated, +instead of checking `node_modules` and downloading dependencies. + +For `list` this means the output will be based on the tree described by the +`package-lock.json`, rather than the contents of `node_modules`. + + + +#### `expect-results` + +* Default: null +* Type: null or Boolean + +Tells npm whether or not to expect results from the command. Can be either +true (expect some results) or false (expect no results). + +This config can not be used with: `expect-result-count` + +#### `expect-result-count` + +* Default: null +* Type: null or Number + +Tells to expect a specific number of results from the command. + +This config can not be used with: `expect-results` +## See Also + +* [dependency selectors](/using-npm/dependency-selectors) + diff --git a/node_modules/npm/docs/content/commands/npm-rebuild.md b/node_modules/npm/docs/content/commands/npm-rebuild.md new file mode 100644 index 00000000..d22a7a5f --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-rebuild.md @@ -0,0 +1,169 @@ +--- +title: npm-rebuild +section: 1 +description: Rebuild a package +--- + +### Synopsis + +```bash +npm rebuild [] ...] + +alias: rb +``` + +### Description + +This command does the following: + +1. Execute lifecycle scripts (`preinstall`, `install`, `postinstall`, `prepare`) +2. Links bins depending on whether bin links are enabled + +This command is particularly useful in scenarios including but not limited to: + +1. Installing a new version of **node.js**, where you need to recompile all your C++ add-ons with the updated binary. +2. Installing with `--ignore-scripts` and `--no-bin-links`, to explicitly choose which packages to build and/or link bins. + +If one or more package specs are provided, then only packages with a name and version matching one of the specifiers will be rebuilt. + +Usually, you should not need to run `npm rebuild` as it is already done for you as part of npm install (unless you suppressed these steps with `--ignore-scripts` or `--no-bin-links`). + +If there is a `binding.gyp` file in the root of your package, then npm will use a default install hook: + +``` +"scripts": { + "install": "node-gyp rebuild" +} +``` + +This default behavior is suppressed if the `package.json` has its own `install` or `preinstall` scripts. It is also suppressed if the package specifies `"gypfile": false` + +### Configuration + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `bin-links` + +* Default: true +* Type: Boolean + +Tells npm to create symlinks (or `.cmd` shims on Windows) for package +executables. + +Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems. + + + +#### `foreground-scripts` + +* Default: `false` unless when using `npm pack` or `npm publish` where it + defaults to `true` +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm install](/commands/npm-install) diff --git a/node_modules/npm/docs/content/commands/npm-repo.md b/node_modules/npm/docs/content/commands/npm-repo.md new file mode 100644 index 00000000..005f4ac8 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-repo.md @@ -0,0 +1,102 @@ +--- +title: npm-repo +section: 1 +description: Open package repository page in the browser +--- + +### Synopsis + +```bash +npm repo [ [ ...]] +``` + +### Description + +This command tries to guess at the likely location of a package's +repository URL, and then tries to open it using the +[`--browser` config](/using-npm/config#browser) param. If no package name is +provided, it will search for a `package.json` in the current folder and use the +`repository` property. + +### Configuration + +#### `browser` + +* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"` +* Type: null, Boolean, or String + +The browser that is called by npm commands to open websites. + +Set to `false` to suppress browser behavior and instead print urls to +terminal. + +Set to `true` to use default system URL opener. + + + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +### See Also + +* [npm docs](/commands/npm-docs) +* [npm config](/commands/npm-config) diff --git a/node_modules/npm/docs/content/commands/npm-restart.md b/node_modules/npm/docs/content/commands/npm-restart.md new file mode 100644 index 00000000..545315c7 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-restart.md @@ -0,0 +1,70 @@ +--- +title: npm-restart +section: 1 +description: Restart a package +--- + +### Synopsis + +```bash +npm restart [-- ] +``` + +### Description + +This restarts a project. It is equivalent to running `npm run-script +restart`. + +If the current project has a `"restart"` script specified in +`package.json`, then the following scripts will be run: + +1. prerestart +2. restart +3. postrestart + +If it does _not_ have a `"restart"` script specified, but it does have +`stop` and/or `start` scripts, then the following scripts will be run: + +1. prerestart +2. prestop +3. stop +4. poststop +6. prestart +7. start +8. poststart +9. postrestart + +### Configuration + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `script-shell` + +* Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +* Type: null or String + +The shell to use for scripts run with the `npm exec`, `npm run` and `npm +init ` commands. + + + +### See Also + +* [npm run-script](/commands/npm-run-script) +* [npm scripts](/using-npm/scripts) +* [npm test](/commands/npm-test) +* [npm start](/commands/npm-start) +* [npm stop](/commands/npm-stop) +* [npm restart](/commands/npm-restart) diff --git a/node_modules/npm/docs/content/commands/npm-root.md b/node_modules/npm/docs/content/commands/npm-root.md new file mode 100644 index 00000000..75d70c2a --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-root.md @@ -0,0 +1,51 @@ +--- +title: npm-root +section: 1 +description: Display npm root +--- + +### Synopsis + +```bash +npm root +``` + +Note: This command is unaware of workspaces. + +### Description + +Print the effective `node_modules` folder to standard out. + +Useful for using npm in shell scripts that do things with the +`node_modules` folder. For example: + +```bash +#!/bin/bash +global_node_modules="$(npm root --global)" +echo "Global packages installed in: ${global_node_modules}" +``` + +### Configuration + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +### See Also + +* [npm prefix](/commands/npm-prefix) +* [npm folders](/configuring-npm/folders) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) diff --git a/node_modules/npm/docs/content/commands/npm-run-script.md b/node_modules/npm/docs/content/commands/npm-run-script.md new file mode 100644 index 00000000..56fcdb70 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-run-script.md @@ -0,0 +1,254 @@ +--- +title: npm-run-script +section: 1 +description: Run arbitrary package scripts +--- + +### Synopsis + +```bash +npm run-script [-- ] + +aliases: run, rum, urn +``` + +### Description + +This runs an arbitrary command from a package's `"scripts"` object. If no +`"command"` is provided, it will list the available scripts. + +`run[-script]` is used by the test, start, restart, and stop commands, but +can be called directly, as well. When the scripts in the package are +printed out, they're separated into lifecycle (test, start, restart) and +directly-run scripts. + +Any positional arguments are passed to the specified script. Use `--` to +pass `-`-prefixed flags and options which would otherwise be parsed by npm. + +For example: + +```bash +npm run test -- --grep="pattern" +``` + +The arguments will only be passed to the script specified after `npm run` +and not to any `pre` or `post` script. + +The `env` script is a special built-in command that can be used to list +environment variables that will be available to the script at runtime. If an +"env" command is defined in your package, it will take precedence over the +built-in. + +In addition to the shell's pre-existing `PATH`, `npm run` adds +`node_modules/.bin` to the `PATH` provided to scripts. Any binaries +provided by locally-installed dependencies can be used without the +`node_modules/.bin` prefix. For example, if there is a `devDependency` on +`tap` in your package, you should write: + +```bash +"scripts": {"test": "tap test/*.js"} +``` + +instead of + +```bash +"scripts": {"test": "node_modules/.bin/tap test/*.js"} +``` + +The actual shell your script is run within is platform dependent. By default, +on Unix-like systems it is the `/bin/sh` command, on Windows it is +`cmd.exe`. +The actual shell referred to by `/bin/sh` also depends on the system. +You can customize the shell with the +[`script-shell` config](/using-npm/config#script-shell). + +Scripts are run from the root of the package folder, regardless of what the +current working directory is when `npm run` is called. If you want your +script to use different behavior based on what subdirectory you're in, you +can use the `INIT_CWD` environment variable, which holds the full path you +were in when you ran `npm run`. + +`npm run` sets the `NODE` environment variable to the `node` executable +with which `npm` is executed. + +If you try to run a script without having a `node_modules` directory and it +fails, you will be given a warning to run `npm install`, just in case you've +forgotten. + +### Workspaces support + +You may use the [`workspace`](/using-npm/config#workspace) or +[`workspaces`](/using-npm/config#workspaces) configs in order to run an +arbitrary command from a package's `"scripts"` object in the context of the +specified workspaces. If no `"command"` is provided, it will list the available +scripts for each of these configured workspaces. + +Given a project with configured workspaces, e.g: + +``` +. ++-- package.json +`-- packages + +-- a + | `-- package.json + +-- b + | `-- package.json + `-- c + `-- package.json +``` + +Assuming the workspace configuration is properly set up at the root level +`package.json` file. e.g: + +``` +{ + "workspaces": [ "./packages/*" ] +} +``` + +And that each of the configured workspaces has a configured `test` script, +we can run tests in all of them using the +[`workspaces` config](/using-npm/config#workspaces): + +``` +npm test --workspaces +``` + +#### Filtering workspaces + +It's also possible to run a script in a single workspace using the `workspace` +config along with a name or directory path: + +``` +npm test --workspace=a +``` + +The `workspace` config can also be specified multiple times in order to run a +specific script in the context of multiple workspaces. When defining values for +the `workspace` config in the command line, it also possible to use `-w` as a +shorthand, e.g: + +``` +npm test -w a -w b +``` + +This last command will run `test` in both `./packages/a` and `./packages/b` +packages. + +### Configuration + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `if-present` + +* Default: false +* Type: Boolean + +If true, npm will not exit with an error code when `run-script` is invoked +for a script that isn't defined in the `scripts` section of `package.json`. +This option can be used when it's desirable to optionally run a script when +it's present and fail if the script fails. This is useful, for example, when +running scripts that may only apply for some builds in an otherwise generic +CI setup. + +This value is not exported to the environment for child processes. + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `foreground-scripts` + +* Default: `false` unless when using `npm pack` or `npm publish` where it + defaults to `true` +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + +#### `script-shell` + +* Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +* Type: null or String + +The shell to use for scripts run with the `npm exec`, `npm run` and `npm +init ` commands. + + + +### See Also + +* [npm scripts](/using-npm/scripts) +* [npm test](/commands/npm-test) +* [npm start](/commands/npm-start) +* [npm restart](/commands/npm-restart) +* [npm stop](/commands/npm-stop) +* [npm config](/commands/npm-config) +* [npm workspaces](/using-npm/workspaces) diff --git a/node_modules/npm/docs/content/commands/npm-sbom.md b/node_modules/npm/docs/content/commands/npm-sbom.md new file mode 100644 index 00000000..ecfc2e3e --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-sbom.md @@ -0,0 +1,319 @@ +--- +title: npm-sbom +section: 1 +description: Generate a Software Bill of Materials (SBOM) +--- + +### Synopsis + +```bash +npm sbom +``` + +### Description + +The `npm sbom` command generates a Software Bill of Materials (SBOM) listing the +dependencies for the current project. SBOMs can be generated in either +[SPDX](https://spdx.dev/) or [CycloneDX](https://cyclonedx.org/) format. + +### Example CycloneDX SBOM + +```json +{ + "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.5", + "serialNumber": "urn:uuid:09f55116-97e1-49cf-b3b8-44d0207e7730", + "version": 1, + "metadata": { + "timestamp": "2023-09-01T00:00:00.001Z", + "lifecycles": [ + { + "phase": "build" + } + ], + "tools": [ + { + "vendor": "npm", + "name": "cli", + "version": "10.1.0" + } + ], + "component": { + "bom-ref": "simple@1.0.0", + "type": "library", + "name": "simple", + "version": "1.0.0", + "scope": "required", + "author": "John Doe", + "description": "simple react app", + "purl": "pkg:npm/simple@1.0.0", + "properties": [ + { + "name": "cdx:npm:package:path", + "value": "" + } + ], + "externalReferences": [], + "licenses": [ + { + "license": { + "id": "MIT" + } + } + ] + } + }, + "components": [ + { + "bom-ref": "lodash@4.17.21", + "type": "library", + "name": "lodash", + "version": "4.17.21", + "scope": "required", + "author": "John-David Dalton", + "description": "Lodash modular utilities.", + "purl": "pkg:npm/lodash@4.17.21", + "properties": [ + { + "name": "cdx:npm:package:path", + "value": "node_modules/lodash" + } + ], + "externalReferences": [ + { + "type": "distribution", + "url": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" + }, + { + "type": "vcs", + "url": "git+https://github.com/lodash/lodash.git" + }, + { + "type": "website", + "url": "https://lodash.com/" + }, + { + "type": "issue-tracker", + "url": "https://github.com/lodash/lodash/issues" + } + ], + "hashes": [ + { + "alg": "SHA-512", + "content": "bf690311ee7b95e713ba568322e3533f2dd1cb880b189e99d4edef13592b81764daec43e2c54c61d5c558dc5cfb35ecb85b65519e74026ff17675b6f8f916f4a" + } + ], + "licenses": [ + { + "license": { + "id": "MIT" + } + } + ] + } + ], + "dependencies": [ + { + "ref": "simple@1.0.0", + "dependsOn": [ + "lodash@4.17.21" + ] + }, + { + "ref": "lodash@4.17.21", + "dependsOn": [] + } + ] +} +``` + +### Example SPDX SBOM + +```json +{ + "spdxVersion": "SPDX-2.3", + "dataLicense": "CC0-1.0", + "SPDXID": "SPDXRef-DOCUMENT", + "name": "simple@1.0.0", + "documentNamespace": "http://spdx.org/spdxdocs/simple-1.0.0-bf81090e-8bbc-459d-bec9-abeb794e096a", + "creationInfo": { + "created": "2023-09-01T00:00:00.001Z", + "creators": [ + "Tool: npm/cli-10.1.0" + ] + }, + "documentDescribes": [ + "SPDXRef-Package-simple-1.0.0" + ], + "packages": [ + { + "name": "simple", + "SPDXID": "SPDXRef-Package-simple-1.0.0", + "versionInfo": "1.0.0", + "packageFileName": "", + "description": "simple react app", + "primaryPackagePurpose": "LIBRARY", + "downloadLocation": "NOASSERTION", + "filesAnalyzed": false, + "homepage": "NOASSERTION", + "licenseDeclared": "MIT", + "externalRefs": [ + { + "referenceCategory": "PACKAGE-MANAGER", + "referenceType": "purl", + "referenceLocator": "pkg:npm/simple@1.0.0" + } + ] + }, + { + "name": "lodash", + "SPDXID": "SPDXRef-Package-lodash-4.17.21", + "versionInfo": "4.17.21", + "packageFileName": "node_modules/lodash", + "description": "Lodash modular utilities.", + "downloadLocation": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "filesAnalyzed": false, + "homepage": "https://lodash.com/", + "licenseDeclared": "MIT", + "externalRefs": [ + { + "referenceCategory": "PACKAGE-MANAGER", + "referenceType": "purl", + "referenceLocator": "pkg:npm/lodash@4.17.21" + } + ], + "checksums": [ + { + "algorithm": "SHA512", + "checksumValue": "bf690311ee7b95e713ba568322e3533f2dd1cb880b189e99d4edef13592b81764daec43e2c54c61d5c558dc5cfb35ecb85b65519e74026ff17675b6f8f916f4a" + } + ] + } + ], + "relationships": [ + { + "spdxElementId": "SPDXRef-DOCUMENT", + "relatedSpdxElement": "SPDXRef-Package-simple-1.0.0", + "relationshipType": "DESCRIBES" + }, + { + "spdxElementId": "SPDXRef-Package-simple-1.0.0", + "relatedSpdxElement": "SPDXRef-Package-lodash-4.17.21", + "relationshipType": "DEPENDS_ON" + } + ] +} +``` + +### Package lock only mode + +If package-lock-only is enabled, only the information in the package +lock (or shrinkwrap) is loaded. This means that information from the +package.json files of your dependencies will not be included in the +result set (e.g. description, homepage, engines). + +### Configuration + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `package-lock-only` + +* Default: false +* Type: Boolean + +If set to true, the current operation will only use the `package-lock.json`, +ignoring `node_modules`. + +For `update` this means only the `package-lock.json` will be updated, +instead of checking `node_modules` and downloading dependencies. + +For `list` this means the output will be based on the tree described by the +`package-lock.json`, rather than the contents of `node_modules`. + + + +#### `sbom-format` + +* Default: null +* Type: "cyclonedx" or "spdx" + +SBOM format to use when generating SBOMs. + + + +#### `sbom-type` + +* Default: "library" +* Type: "library", "application", or "framework" + +The type of package described by the generated SBOM. For SPDX, this is the +value for the `primaryPackagePurpose` field. For CycloneDX, this is the +value for the `type` field. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. +## See Also + +* [package spec](/using-npm/package-spec) +* [dependency selectors](/using-npm/dependency-selectors) +* [package.json](/configuring-npm/package-json) +* [workspaces](/using-npm/workspaces) + diff --git a/node_modules/npm/docs/content/commands/npm-search.md b/node_modules/npm/docs/content/commands/npm-search.md new file mode 100644 index 00000000..4e4bbf58 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-search.md @@ -0,0 +1,160 @@ +--- +title: npm-search +section: 1 +description: Search for packages +--- + +### Synopsis + +```bash +npm search [ ...] + +aliases: find, s, se +``` + +Note: This command is unaware of workspaces. + +### Description + +Search the registry for packages matching the search terms. `npm search` +performs a linear, incremental, lexically-ordered search through package +metadata for all files in the registry. If your terminal has color +support, it will further highlight the matches in the results. This can +be disabled with the config item `color` + +Additionally, using the `--searchopts` and `--searchexclude` options +paired with more search terms will include and exclude further patterns. +The main difference between `--searchopts` and the standard search terms +is that the former does not highlight results in the output and you can +use them more fine-grained filtering. Additionally, you can add both of +these to your config to change default search filtering behavior. + +Search also allows targeting of maintainers in search results, by prefixing +their npm username with `=`. + +If a term starts with `/`, then it's interpreted as a regular expression +and supports standard JavaScript RegExp syntax. In this case search will +ignore a trailing `/` . (Note you must escape or quote many regular +expression characters in most shells.) + +### Configuration + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `color` + +* Default: true unless the NO_COLOR environ is set to something other than '0' +* Type: "always" or Boolean + +If false, never shows colors. If `"always"` then always shows colors. If +true, then only prints color codes for tty file descriptors. + + + +#### `parseable` + +* Default: false +* Type: Boolean + +Output parseable results from commands that write to standard output. For +`npm search`, this will be tab-separated table format. + + + +#### `description` + +* Default: true +* Type: Boolean + +Show the description in `npm search` + + + +#### `searchlimit` + +* Default: 20 +* Type: Number + +Number of items to limit search results to. Will not apply at all to legacy +searches. + + + +#### `searchopts` + +* Default: "" +* Type: String + +Space-separated options that are always passed to search. + + + +#### `searchexclude` + +* Default: "" +* Type: String + +Space-separated options that limit the results from search. + + + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `prefer-online` + +* Default: false +* Type: Boolean + +If true, staleness checks for cached data will be forced, making the CLI +look for updates immediately even for fresh package data. + + + +#### `prefer-offline` + +* Default: false +* Type: Boolean + +If true, staleness checks for cached data will be bypassed, but missing data +will be requested from the server. To force full offline mode, use +`--offline`. + + + +#### `offline` + +* Default: false +* Type: Boolean + +Force offline mode: no network requests will be done during install. To +allow the CLI to fill in missing cache data, see `--prefer-offline`. + + + +### See Also + +* [npm registry](/using-npm/registry) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm view](/commands/npm-view) +* [npm cache](/commands/npm-cache) +* https://npm.im/npm-registry-fetch diff --git a/node_modules/npm/docs/content/commands/npm-shrinkwrap.md b/node_modules/npm/docs/content/commands/npm-shrinkwrap.md new file mode 100644 index 00000000..67862294 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-shrinkwrap.md @@ -0,0 +1,32 @@ +--- +title: npm-shrinkwrap +section: 1 +description: Lock down dependency versions for publication +--- + +### Synopsis + +```bash +npm shrinkwrap +``` + +Note: This command is unaware of workspaces. + +### Description + +This command repurposes `package-lock.json` into a publishable +`npm-shrinkwrap.json` or simply creates a new one. The file created and +updated by this command will then take precedence over any other existing +or future `package-lock.json` files. For a detailed explanation of the +design and purpose of package locks in npm, see +[package-lock-json](/configuring-npm/package-lock-json). + +### See Also + +* [npm install](/commands/npm-install) +* [npm run-script](/commands/npm-run-script) +* [npm scripts](/using-npm/scripts) +* [package.json](/configuring-npm/package-json) +* [package-lock.json](/configuring-npm/package-lock-json) +* [npm-shrinkwrap.json](/configuring-npm/npm-shrinkwrap-json) +* [npm ls](/commands/npm-ls) diff --git a/node_modules/npm/docs/content/commands/npm-star.md b/node_modules/npm/docs/content/commands/npm-star.md new file mode 100644 index 00000000..59e1fbec --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-star.md @@ -0,0 +1,78 @@ +--- +title: npm-star +section: 1 +description: Mark your favorite packages +--- + +### Synopsis + +```bash +npm star [...] +``` + +Note: This command is unaware of workspaces. + +### Description + +"Starring" a package means that you have some interest in it. It's +a vaguely positive way to show that you care. + +It's a boolean thing. Starring repeatedly has no additional effect. + +### More + +There's also these extra commands to help you manage your favorite packages: + +#### Unstar + +You can also "unstar" a package using [`npm unstar`](/commands/npm-unstar) + +"Unstarring" is the same thing, but in reverse. + +#### Listing stars + +You can see all your starred packages using [`npm stars`](/commands/npm-stars) + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `unicode` + +* Default: false on windows, true on mac/unix systems with a unicode locale, + as defined by the `LC_ALL`, `LC_CTYPE`, or `LANG` environment variables. +* Type: Boolean + +When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters instead of unicode glyphs. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm unstar](/commands/npm-unstar) +* [npm stars](/commands/npm-stars) +* [npm view](/commands/npm-view) +* [npm whoami](/commands/npm-whoami) +* [npm adduser](/commands/npm-adduser) diff --git a/node_modules/npm/docs/content/commands/npm-stars.md b/node_modules/npm/docs/content/commands/npm-stars.md new file mode 100644 index 00000000..642ccfa1 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-stars.md @@ -0,0 +1,40 @@ +--- +title: npm-stars +section: 1 +description: View packages marked as favorites +--- + +### Synopsis + +```bash +npm stars [] +``` + +Note: This command is unaware of workspaces. + +### Description + +If you have starred a lot of neat things and want to find them again +quickly this command lets you do just that. + +You may also want to see your friend's favorite packages, in this case +you will most certainly enjoy this command. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +### See Also + +* [npm star](/commands/npm-star) +* [npm unstar](/commands/npm-unstar) +* [npm view](/commands/npm-view) +* [npm whoami](/commands/npm-whoami) +* [npm adduser](/commands/npm-adduser) diff --git a/node_modules/npm/docs/content/commands/npm-start.md b/node_modules/npm/docs/content/commands/npm-start.md new file mode 100644 index 00000000..cf9392c6 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-start.md @@ -0,0 +1,80 @@ +--- +title: npm-start +section: 1 +description: Start a package +--- + +### Synopsis + +```bash +npm start [-- ] +``` + +### Description + +This runs a predefined command specified in the `"start"` property of +a package's `"scripts"` object. + +If the `"scripts"` object does not define a `"start"` property, npm +will run `node server.js`. + +Note that this is different from the default node behavior of running +the file specified in a package's `"main"` attribute when evoking with +`node .` + +As of [`npm@2.0.0`](https://blog.npmjs.org/post/98131109725/npm-2-0-0), you can +use custom arguments when executing scripts. Refer to [`npm run-script`](/commands/npm-run-script) for more details. + +### Example + +```json +{ + "scripts": { + "start": "node foo.js" + } +} +``` + +```bash +npm start + +> npm@x.x.x start +> node foo.js + +(foo.js output would be here) + +``` + +### Configuration + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `script-shell` + +* Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +* Type: null or String + +The shell to use for scripts run with the `npm exec`, `npm run` and `npm +init ` commands. + + + +### See Also + +* [npm run-script](/commands/npm-run-script) +* [npm scripts](/using-npm/scripts) +* [npm test](/commands/npm-test) +* [npm restart](/commands/npm-restart) +* [npm stop](/commands/npm-stop) diff --git a/node_modules/npm/docs/content/commands/npm-stop.md b/node_modules/npm/docs/content/commands/npm-stop.md new file mode 100644 index 00000000..6075b436 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-stop.md @@ -0,0 +1,73 @@ +--- +title: npm-stop +section: 1 +description: Stop a package +--- + +### Synopsis + +```bash +npm stop [-- ] +``` + +### Description + +This runs a predefined command specified in the "stop" property of a +package's "scripts" object. + +Unlike with [npm start](/commands/npm-start), there is no default script +that will run if the `"stop"` property is not defined. + +### Example + +```json +{ + "scripts": { + "stop": "node bar.js" + } +} +``` + +```bash +npm stop + +> npm@x.x.x stop +> node bar.js + +(bar.js output would be here) + +``` + +### Configuration + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `script-shell` + +* Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +* Type: null or String + +The shell to use for scripts run with the `npm exec`, `npm run` and `npm +init ` commands. + + + +### See Also + +* [npm run-script](/commands/npm-run-script) +* [npm scripts](/using-npm/scripts) +* [npm test](/commands/npm-test) +* [npm start](/commands/npm-start) +* [npm restart](/commands/npm-restart) diff --git a/node_modules/npm/docs/content/commands/npm-team.md b/node_modules/npm/docs/content/commands/npm-team.md new file mode 100644 index 00000000..7895df7c --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-team.md @@ -0,0 +1,155 @@ +--- +title: npm-team +section: 1 +description: Manage organization teams and team memberships +--- + +### Synopsis + +```bash +npm team create [--otp ] +npm team destroy [--otp ] +npm team add [--otp ] +npm team rm [--otp ] +npm team ls | +``` + +Note: This command is unaware of workspaces. + +### Description + +Used to manage teams in organizations, and change team memberships. Does not +handle permissions for packages. + +Teams must always be fully qualified with the organization/scope they belong to +when operating on them, separated by a colon (`:`). That is, if you have a +`newteam` team in an `org` organization, you must always refer to that team +as `@org:newteam` in these commands. + +If you have two-factor authentication enabled in `auth-and-writes` mode, then +you can provide a code from your authenticator with `[--otp ]`. +If you don't include this then you will be taken through a second factor flow based +on your `authtype`. + +* create / destroy: + Create a new team, or destroy an existing one. Note: You cannot remove the + `developers` team, [learn more.](https://docs.npmjs.com/about-developers-team) + + Here's how to create a new team `newteam` under the `org` org: + + ```bash + npm team create @org:newteam + ``` + + You should see a confirming message such as: `+@org:newteam` once the new + team has been created. + +* add: + Add a user to an existing team. + + Adding a new user `username` to a team named `newteam` under the `org` org: + + ```bash + npm team add @org:newteam username + ``` + + On success, you should see a message: `username added to @org:newteam` + +* rm: + Using `npm team rm` you can also remove users from a team they belong to. + + Here's an example removing user `username` from `newteam` team + in `org` organization: + + ```bash + npm team rm @org:newteam username + ``` + + Once the user is removed a confirmation message is displayed: + `username removed from @org:newteam` + +* ls: + If performed on an organization name, will return a list of existing teams + under that organization. If performed on a team, it will instead return a list + of all users belonging to that particular team. + + Here's an example of how to list all teams from an org named `org`: + + ```bash + npm team ls @org + ``` + + Example listing all members of a team named `newteam`: + + ```bash + npm team ls @org:newteam + ``` + +### Details + +`npm team` always operates directly on the current registry, configurable from +the command line using `--registry=`. + +You must be a *team admin* to create teams and manage team membership, under +the given organization. Listing teams and team memberships may be done by +any member of the organization. + +Organization creation and management of team admins and *organization* members +is done through the website, not the npm CLI. + +To use teams to manage permissions on packages belonging to your organization, +use the `npm access` command to grant or revoke the appropriate permissions. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +#### `parseable` + +* Default: false +* Type: Boolean + +Output parseable results from commands that write to standard output. For +`npm search`, this will be tab-separated table format. + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +### See Also + +* [npm access](/commands/npm-access) +* [npm config](/commands/npm-config) +* [npm registry](/using-npm/registry) diff --git a/node_modules/npm/docs/content/commands/npm-test.md b/node_modules/npm/docs/content/commands/npm-test.md new file mode 100644 index 00000000..72a7822b --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-test.md @@ -0,0 +1,70 @@ +--- +title: npm-test +section: 1 +description: Test a package +--- + +### Synopsis + +```bash +npm test [-- ] + +aliases: tst, t +``` + +### Description + +This runs a predefined command specified in the `"test"` property of +a package's `"scripts"` object. + +### Example + +```json +{ + "scripts": { + "test": "node test.js" + } +} +``` + +```bash +npm test +> npm@x.x.x test +> node test.js + +(test.js output would be here) +``` + +### Configuration + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `script-shell` + +* Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +* Type: null or String + +The shell to use for scripts run with the `npm exec`, `npm run` and `npm +init ` commands. + + + +### See Also + +* [npm run-script](/commands/npm-run-script) +* [npm scripts](/using-npm/scripts) +* [npm start](/commands/npm-start) +* [npm restart](/commands/npm-restart) +* [npm stop](/commands/npm-stop) diff --git a/node_modules/npm/docs/content/commands/npm-token.md b/node_modules/npm/docs/content/commands/npm-token.md new file mode 100644 index 00000000..771da7d9 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-token.md @@ -0,0 +1,112 @@ +--- +title: npm-token +section: 1 +description: Manage your authentication tokens +--- + +### Synopsis + +```bash +npm token list +npm token revoke +npm token create [--read-only] [--cidr=list] +``` + +Note: This command is unaware of workspaces. + +### Description + +This lets you list, create and revoke authentication tokens. + +* `npm token list`: + Shows a table of all active authentication tokens. You can request + this as JSON with `--json` or tab-separated values with `--parseable`. + +``` +Read only token npm_1f… with id 7f3134 created 2017-10-21 + +Publish token npm_af… with id c03241 created 2017-10-02 +with IP Whitelist: 192.168.0.1/24 + +Publish token npm_… with id e0cf92 created 2017-10-02 + +``` + +* `npm token create [--read-only] [--cidr=]`: + Create a new authentication token. It can be `--read-only`, or accept + a list of + [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + ranges with which to limit use of this token. This will prompt you for + your password, and, if you have two-factor authentication enabled, an + otp. + + Currently, the cli can not generate automation tokens. Please refer to + the [docs + website](https://docs.npmjs.com/creating-and-viewing-access-tokens) + for more information on generating automation tokens. + +``` +Created publish token a73c9572-f1b9-8983-983d-ba3ac3cc913d +``` + +* `npm token revoke `: + Immediately removes an authentication token from the registry. You + will no longer be able to use it. This can accept both complete + tokens (such as those you get back from `npm token create`, and those + found in your `.npmrc`), and ids as seen in the parseable or json + output of `npm token list`. This will NOT accept the truncated token + found in the normal `npm token list` output. + +### Configuration + +#### `read-only` + +* Default: false +* Type: Boolean + +This is used to mark a token as unable to publish when configuring limited +access tokens with the `npm token create` command. + + + +#### `cidr` + +* Default: null +* Type: null or String (can be set multiple times) + +This is a list of CIDR address to be used when configuring limited access +tokens with the `npm token create` command. + + + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +### See Also + +* [npm adduser](/commands/npm-adduser) +* [npm registry](/using-npm/registry) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm owner](/commands/npm-owner) +* [npm whoami](/commands/npm-whoami) +* [npm profile](/commands/npm-profile) diff --git a/node_modules/npm/docs/content/commands/npm-uninstall.md b/node_modules/npm/docs/content/commands/npm-uninstall.md new file mode 100644 index 00000000..de90df9c --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-uninstall.md @@ -0,0 +1,159 @@ +--- +title: npm-uninstall +section: 1 +description: Remove a package +--- + +### Synopsis + +```bash +npm uninstall [<@scope>/]... + +aliases: unlink, remove, rm, r, un +``` + +### Description + +This uninstalls a package, completely removing everything npm installed +on its behalf. + +It also removes the package from the `dependencies`, `devDependencies`, +`optionalDependencies`, and `peerDependencies` objects in your +`package.json`. + +Further, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm +will update those files as well. + +`--no-save` will tell npm not to remove the package from your +`package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files. + +`--save` or `-S` will tell npm to remove the package from your +`package.json`, `npm-shrinkwrap.json`, and `package-lock.json` files. +This is the default, but you may need to use this if you have for +instance `save=false` in your `npmrc` file + +In global mode (ie, with `-g` or `--global` appended to the command), +it uninstalls the current package context as a global package. +`--no-save` is ignored in this case. + +Scope is optional and follows the usual rules for [`scope`](/using-npm/scope). + +### Examples + +```bash +npm uninstall sax +``` + +`sax` will no longer be in your `package.json`, `npm-shrinkwrap.json`, or +`package-lock.json` files. + +```bash +npm uninstall lodash --no-save +``` + +`lodash` will not be removed from your `package.json`, +`npm-shrinkwrap.json`, or `package-lock.json` files. + +### Configuration + +#### `save` + +* Default: `true` unless when using `npm update` where it defaults to `false` +* Type: Boolean + +Save installed packages to a `package.json` file as dependencies. + +When used with the `npm rm` command, removes the dependency from +`package.json`. + +Will also prevent writing to `package-lock.json` if set to `false`. + + + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [npm prune](/commands/npm-prune) +* [npm install](/commands/npm-install) +* [npm folders](/configuring-npm/folders) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) diff --git a/node_modules/npm/docs/content/commands/npm-unpublish.md b/node_modules/npm/docs/content/commands/npm-unpublish.md new file mode 100644 index 00000000..2421e102 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-unpublish.md @@ -0,0 +1,136 @@ +--- +title: npm-unpublish +section: 1 +description: Remove a package from the registry +--- + +### Synopsis + +```bash +npm unpublish [] +``` + +To learn more about how the npm registry treats unpublish, see our +[unpublish policies](https://docs.npmjs.com/policies/unpublish). + +### Warning + +Consider using the [`deprecate`](/commands/npm-deprecate) command instead, +if your intent is to encourage users to upgrade, or if you no longer +want to maintain a package. + +### Description + +This removes a package version from the registry, deleting its entry and +removing the tarball. + +The npm registry will return an error if you are not [logged +in](/commands/npm-adduser). + +If you do not specify a package name at all, the name and version to be +unpublished will be pulled from the project in the current directory. + +If you specify a package name but do not specify a version or if you +remove all of a package's versions then the registry will remove the +root package entry entirely. + +Even if you unpublish a package version, that specific name and version +combination can never be reused. In order to publish the package again, +you must use a new version number. If you unpublish the entire package, +you may not publish any new versions of that package until 24 hours have +passed. + +### Configuration + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `force` + +* Default: false +* Type: Boolean + +Removes various protections against unfortunate side effects, common +mistakes, unnecessary performance degradation, and malicious input. + +* Allow clobbering non-npm files in global installs. +* Allow the `npm version` command to work on an unclean git repository. +* Allow deleting the cache folder with `npm cache clean`. +* Allow installing packages that have an `engines` declaration requiring a + different version of npm. +* Allow installing packages that have an `engines` declaration requiring a + different version of `node`, even if `--engine-strict` is enabled. +* Allow `npm audit fix` to install modules outside your stated dependency + range (including SemVer-major changes). +* Allow unpublishing all versions of a published package. +* Allow conflicting peerDependencies to be installed in the root project. +* Implicitly set `--yes` during `npm init`. +* Allow clobbering existing values in `npm pkg` +* Allow unpublishing of entire packages (not just a single version). + +If you don't have a clear idea of what you want to do, it is strongly +recommended that you do not use this option! + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm deprecate](/commands/npm-deprecate) +* [npm publish](/commands/npm-publish) +* [npm registry](/using-npm/registry) +* [npm adduser](/commands/npm-adduser) +* [npm owner](/commands/npm-owner) +* [npm login](/commands/npm-adduser) diff --git a/node_modules/npm/docs/content/commands/npm-unstar.md b/node_modules/npm/docs/content/commands/npm-unstar.md new file mode 100644 index 00000000..92ae740b --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-unstar.md @@ -0,0 +1,74 @@ +--- +title: npm-unstar +section: 1 +description: Remove an item from your favorite packages +--- + +### Synopsis + +```bash +npm unstar [...] +``` + +Note: This command is unaware of workspaces. + +### Description + +"Unstarring" a package is the opposite of [`npm star`](/commands/npm-star), +it removes an item from your list of favorite packages. + +### More + +There's also these extra commands to help you manage your favorite packages: + +#### Star + +You can "star" a package using [`npm star`](/commands/npm-star) + +#### Listing stars + +You can see all your starred packages using [`npm stars`](/commands/npm-stars) + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `unicode` + +* Default: false on windows, true on mac/unix systems with a unicode locale, + as defined by the `LC_ALL`, `LC_CTYPE`, or `LANG` environment variables. +* Type: Boolean + +When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters instead of unicode glyphs. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +### See Also + +* [npm star](/commands/npm-star) +* [npm stars](/commands/npm-stars) +* [npm view](/commands/npm-view) +* [npm whoami](/commands/npm-whoami) +* [npm adduser](/commands/npm-adduser) + diff --git a/node_modules/npm/docs/content/commands/npm-update.md b/node_modules/npm/docs/content/commands/npm-update.md new file mode 100644 index 00000000..25272f8f --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-update.md @@ -0,0 +1,446 @@ +--- +title: npm-update +section: 1 +description: Update packages +--- + +### Synopsis + +```bash +npm update [...] + +aliases: up, upgrade, udpate +``` + +### Description + +This command will update all the packages listed to the latest version +(specified by the [`tag` config](/using-npm/config#tag)), respecting the semver +constraints of both your package and its dependencies (if they also require the +same package). + +It will also install missing packages. + +If the `-g` flag is specified, this command will update globally installed +packages. + +If no package name is specified, all packages in the specified location (global +or local) will be updated. + +Note that by default `npm update` will not update the semver values of direct +dependencies in your project `package.json`. If you want to also update +values in `package.json` you can run: `npm update --save` (or add the +`save=true` option to a [configuration file](/configuring-npm/npmrc) +to make that the default behavior). + +### Example + +For the examples below, assume that the current package is `app` and it depends +on dependencies, `dep1` (`dep2`, .. etc.). The published versions of `dep1` +are: + +```json +{ + "dist-tags": { "latest": "1.2.2" }, + "versions": [ + "1.2.2", + "1.2.1", + "1.2.0", + "1.1.2", + "1.1.1", + "1.0.0", + "0.4.1", + "0.4.0", + "0.2.0" + ] +} +``` + +#### Caret Dependencies + +If `app`'s `package.json` contains: + +```json +"dependencies": { + "dep1": "^1.1.1" +} +``` + +Then `npm update` will install `dep1@1.2.2`, because `1.2.2` is `latest` and +`1.2.2` satisfies `^1.1.1`. + +#### Tilde Dependencies + +However, if `app`'s `package.json` contains: + +```json +"dependencies": { + "dep1": "~1.1.1" +} +``` + +In this case, running `npm update` will install `dep1@1.1.2`. Even though the +`latest` tag points to `1.2.2`, this version does not satisfy `~1.1.1`, which is +equivalent to `>=1.1.1 <1.2.0`. So the highest-sorting version that satisfies +`~1.1.1` is used, which is `1.1.2`. + +#### Caret Dependencies below 1.0.0 + +Suppose `app` has a caret dependency on a version below `1.0.0`, for example: + +```json +"dependencies": { + "dep1": "^0.2.0" +} +``` + +`npm update` will install `dep1@0.2.0`. + +If the dependence were on `^0.4.0`: + +```json +"dependencies": { + "dep1": "^0.4.0" +} +``` + +Then `npm update` will install `dep1@0.4.1`, because that is the highest-sorting +version that satisfies `^0.4.0` (`>= 0.4.0 <0.5.0`) + + +#### Subdependencies + +Suppose your app now also has a dependency on `dep2` + +```json +{ + "name": "my-app", + "dependencies": { + "dep1": "^1.0.0", + "dep2": "1.0.0" + } +} +``` + +and `dep2` itself depends on this limited range of `dep1` + +```json +{ +"name": "dep2", + "dependencies": { + "dep1": "~1.1.1" + } +} +``` + +Then `npm update` will install `dep1@1.1.2` because that is the highest +version that `dep2` allows. npm will prioritize having a single version +of `dep1` in your tree rather than two when that single version can +satisfy the semver requirements of multiple dependencies in your tree. +In this case if you really did need your package to use a newer version +you would need to use `npm install`. + + +#### Updating Globally-Installed Packages + +`npm update -g` will apply the `update` action to each globally installed +package that is `outdated` -- that is, has a version that is different from +`wanted`. + +Note: Globally installed packages are treated as if they are installed with a +caret semver range specified. So if you require to update to `latest` you may +need to run `npm install -g [...]` + +NOTE: If a package has been upgraded to a version newer than `latest`, it will +be _downgraded_. + +### Configuration + +#### `save` + +* Default: `true` unless when using `npm update` where it defaults to `false` +* Type: Boolean + +Save installed packages to a `package.json` file as dependencies. + +When used with the `npm rm` command, removes the dependency from +`package.json`. + +Will also prevent writing to `package-lock.json` if set to `false`. + + + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `install-strategy` + +* Default: "hoisted" +* Type: "hoisted", "nested", "shallow", or "linked" + +Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted. + + + +#### `legacy-bundling` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=nested` + +Instead of hoisting package installs in `node_modules`, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets `--install-strategy=nested`. + + + +#### `global-style` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=shallow` + +Only install direct dependencies in the top level `node_modules`, but hoist +on deeper dependencies. Sets `--install-strategy=shallow`. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `strict-peer-deps` + +* Default: false +* Type: Boolean + +If set to `true`, and `--legacy-peer-deps` is not set, then _any_ +conflicting `peerDependencies` will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships. + +By default, conflicting `peerDependencies` deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's `peerDependencies` object. + +When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If `--strict-peer-deps` is set, then +this warning is treated as a failure. + + + +#### `package-lock` + +* Default: true +* Type: Boolean + +If set to false, then ignore `package-lock.json` files when installing. This +will also prevent _writing_ `package-lock.json` if `save` is true. + + + +#### `foreground-scripts` + +* Default: `false` unless when using `npm pack` or `npm publish` where it + defaults to `true` +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + + + +#### `bin-links` + +* Default: true +* Type: Boolean + +Tells npm to create symlinks (or `.cmd` shims on Windows) for package +executables. + +Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems. + + + +#### `fund` + +* Default: true +* Type: Boolean + +When "true" displays the message at the end of each `npm install` +acknowledging the number of dependencies looking for funding. See [`npm +fund`](/commands/npm-fund) for details. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +### See Also + +* [npm install](/commands/npm-install) +* [npm outdated](/commands/npm-outdated) +* [npm shrinkwrap](/commands/npm-shrinkwrap) +* [npm registry](/using-npm/registry) +* [npm folders](/configuring-npm/folders) +* [npm ls](/commands/npm-ls) diff --git a/node_modules/npm/docs/content/commands/npm-version.md b/node_modules/npm/docs/content/commands/npm-version.md new file mode 100644 index 00000000..bc31b4a1 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-version.md @@ -0,0 +1,235 @@ +--- +title: npm-version +section: 1 +description: Bump a package version +--- + +### Synopsis + +```bash +npm version [ | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git] + +alias: verison +``` + +### Configuration + +#### `allow-same-version` + +* Default: false +* Type: Boolean + +Prevents throwing an error when `npm version` is used to set the new version +to the same value as the current version. + + + +#### `commit-hooks` + +* Default: true +* Type: Boolean + +Run git commit hooks when using the `npm version` command. + + + +#### `git-tag-version` + +* Default: true +* Type: Boolean + +Tag the commit when using the `npm version` command. Setting this to false +results in no commit being made at all. + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `preid` + +* Default: "" +* Type: String + +The "prerelease identifier" to use as a prefix for the "prerelease" part of +a semver. Like the `rc` in `1.2.0-rc.8`. + + + +#### `sign-git-tag` + +* Default: false +* Type: Boolean + +If set to true, then the `npm version` command will tag the version using +`-s` to add a signature. + +Note that git requires you to have set up GPG keys in your git configs for +this to work properly. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `workspaces-update` + +* Default: true +* Type: Boolean + +If set to true, the npm cli will run an update after operations that may +possibly change the workspaces installed to the `node_modules` folder. + + + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +### Description + +Run this in a package directory to bump the version and write the new data +back to `package.json`, `package-lock.json`, and, if present, +`npm-shrinkwrap.json`. + +The `newversion` argument should be a valid semver string, a valid second +argument to [semver.inc](https://github.com/npm/node-semver#functions) (one +of `patch`, `minor`, `major`, `prepatch`, `preminor`, `premajor`, +`prerelease`), or `from-git`. In the second case, the existing version will +be incremented by 1 in the specified field. `from-git` will try to read +the latest git tag, and use that as the new npm version. + +If run in a git repo, it will also create a version commit and tag. This +behavior is controlled by `git-tag-version` (see below), and can be +disabled on the command line by running `npm --no-git-tag-version version`. +It will fail if the working directory is not clean, unless the `-f` or +`--force` flag is set. + +If supplied with `-m` or [`--message` config](/using-npm/config#message) option, +npm will use it as a commit message when creating a version commit. If the +`message` config contains `%s` then that will be replaced with the resulting +version number. For example: + +```bash +npm version patch -m "Upgrade to %s for reasons" +``` + +If the [`sign-git-tag` config](/using-npm/config#sign-git-tag) is set, then the +tag will be signed using the `-s` flag to git. Note that you must have a default +GPG key set up in your git config for this to work properly. For example: + +```bash +$ npm config set sign-git-tag true +$ npm version patch + +You need a passphrase to unlock the secret key for +user: "isaacs (http://blog.izs.me/) " +2048-bit RSA key, ID 6C481CF6, created 2010-08-31 + +Enter passphrase: +``` + +If `preversion`, `version`, or `postversion` are in the `scripts` property +of the package.json, they will be executed as part of running `npm +version`. + +The exact order of execution is as follows: + +1. Check to make sure the git working directory is clean before we get + started. Your scripts may add files to the commit in future steps. + This step is skipped if the `--force` flag is set. +2. Run the `preversion` script. These scripts have access to the old + `version` in package.json. A typical use would be running your full + test suite before deploying. Any files you want added to the commit + should be explicitly added using `git add`. +3. Bump `version` in `package.json` as requested (`patch`, `minor`, + `major`, etc). +4. Run the `version` script. These scripts have access to the new `version` + in package.json (so they can incorporate it into file headers in + generated files for example). Again, scripts should explicitly add + generated files to the commit using `git add`. +5. Commit and tag. +6. Run the `postversion` script. Use it to clean up the file system or + automatically push the commit and/or tag. + +Take the following example: + +```json +{ + "scripts": { + "preversion": "npm test", + "version": "npm run build && git add -A dist", + "postversion": "git push && git push --tags && rm -rf build/temp" + } +} +``` + +This runs all your tests and proceeds only if they pass. Then runs your +`build` script, and adds everything in the `dist` directory to the commit. +After the commit, it pushes the new commit and tag up to the server, and +deletes the `build/temp` directory. + +### See Also + +* [npm init](/commands/npm-init) +* [npm run-script](/commands/npm-run-script) +* [npm scripts](/using-npm/scripts) +* [package.json](/configuring-npm/package-json) +* [config](/using-npm/config) diff --git a/node_modules/npm/docs/content/commands/npm-view.md b/node_modules/npm/docs/content/commands/npm-view.md new file mode 100644 index 00000000..63bfe413 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-view.md @@ -0,0 +1,200 @@ +--- +title: npm-view +section: 1 +description: View registry info +--- + +### Synopsis + +```bash +npm view [] [[.subfield]...] + +aliases: info, show, v +``` + +### Description + +This command shows data about a package and prints it to stdout. + +As an example, to view information about the `connect` package from the registry, you would run: + +```bash +npm view connect +``` + +The default version is `"latest"` if unspecified. + +Field names can be specified after the package descriptor. +For example, to show the dependencies of the `ronn` package at version +`0.3.5`, you could do the following: + +```bash +npm view ronn@0.3.5 dependencies +``` + +By default, `npm view` shows data about the current project context (by looking for a `package.json`). +To show field data for the current project use a file path (i.e. `.`): + +```bash +npm view . dependencies +``` + +You can view child fields by separating them with a period. +To view the git repository URL for the latest version of `npm`, you would run the following command: + +```bash +npm view npm repository.url +``` + +This makes it easy to view information about a dependency with a bit of +shell scripting. For example, to view all the data about the version of +`opts` that `ronn` depends on, you could write the following: + +```bash +npm view opts@$(npm view ronn dependencies.opts) +``` + +For fields that are arrays, requesting a non-numeric field will return +all of the values from the objects in the list. For example, to get all +the contributor email addresses for the `express` package, you would run: + +```bash +npm view express contributors.email +``` + +You may also use numeric indices in square braces to specifically select +an item in an array field. To just get the email address of the first +contributor in the list, you can run: + +```bash +npm view express contributors[0].email +``` + +If the field value you are querying for is a property of an object, you should run: + +```bash +npm view express time'[4.8.0]' +``` + +Multiple fields may be specified, and will be printed one after another. +For example, to get all the contributor names and email addresses, you +can do this: + +```bash +npm view express contributors.name contributors.email +``` + +"Person" fields are shown as a string if they would be shown as an +object. So, for example, this will show the list of `npm` contributors in +the shortened string format. (See [`package.json`](/configuring-npm/package-json) for more on this.) + +```bash +npm view npm contributors +``` + +If a version range is provided, then data will be printed for every +matching version of the package. This will show which version of `jsdom` +was required by each matching version of `yui3`: + +```bash +npm view yui3@'>0.5.4' dependencies.jsdom +``` + +To show the `connect` package version history, you can do +this: + +```bash +npm view connect versions +``` + +### Configuration + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +### Output + +If only a single string field for a single version is output, then it +will not be colorized or quoted, to enable piping the output to +another command. If the field is an object, it will be output as a JavaScript object literal. + +If the `--json` flag is given, the outputted fields will be JSON. + +If the version range matches multiple versions then each printed value +will be prefixed with the version it applies to. + +If multiple fields are requested, then each of them is prefixed with +the field name. + +### See Also + +* [package spec](/using-npm/package-spec) +* [npm search](/commands/npm-search) +* [npm registry](/using-npm/registry) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm docs](/commands/npm-docs) diff --git a/node_modules/npm/docs/content/commands/npm-whoami.md b/node_modules/npm/docs/content/commands/npm-whoami.md new file mode 100644 index 00000000..a1458f02 --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm-whoami.md @@ -0,0 +1,41 @@ +--- +title: npm-whoami +section: 1 +description: Display npm username +--- + +### Synopsis + +```bash +npm whoami +``` + +Note: This command is unaware of workspaces. + +### Description + +Display the npm username of the currently logged-in user. + +If logged into a registry that provides token-based authentication, then +connect to the `/-/whoami` registry endpoint to find the username +associated with the token, and print to standard output. + +If logged into a registry that uses Basic Auth, then simply print the +`username` portion of the authentication string. + +### Configuration + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +### See Also + +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm adduser](/commands/npm-adduser) diff --git a/node_modules/npm/docs/content/commands/npm.md b/node_modules/npm/docs/content/commands/npm.md new file mode 100644 index 00000000..36398a3c --- /dev/null +++ b/node_modules/npm/docs/content/commands/npm.md @@ -0,0 +1,175 @@ +--- +title: npm +section: 1 +description: javascript package manager +--- + +### Synopsis + +```bash +npm +``` + +Note: This command is unaware of workspaces. + +### Version + +11.0.0 + +### Description + +npm is the package manager for the Node JavaScript platform. It puts +modules in place so that node can find them, and manages dependency +conflicts intelligently. + +It is extremely configurable to support a variety of use cases. Most +commonly, you use it to publish, discover, install, and develop node +programs. + +Run `npm help` to get a list of available commands. + +### Important + +npm comes preconfigured to use npm's public registry at +https://registry.npmjs.org by default. Use of the npm public registry is +subject to terms of use available at +https://docs.npmjs.com/policies/terms. + +You can configure npm to use any compatible registry you like, and even +run your own registry. Use of someone else's registry is governed by +their terms of use. + +### Introduction + +You probably got npm because you want to install stuff. + +The very first thing you will most likely want to run in any node +program is `npm install` to install its dependencies. + +You can also run `npm install blerg` to install the latest version of +"blerg". Check out [`npm install`](/commands/npm-install) for more +info. It can do a lot of stuff. + +Use the `npm search` command to show everything that's available in the +public registry. Use `npm ls` to show everything you've installed. + +### Dependencies + +If a package lists a dependency using a git URL, npm will install that +dependency using the [`git`](https://github.com/git-guides/install-git) +command and will generate an error if it is not installed. + +If one of the packages npm tries to install is a native node module and +requires compiling of C++ Code, npm will use +[node-gyp](https://github.com/nodejs/node-gyp) for that task. +For a Unix system, [node-gyp](https://github.com/nodejs/node-gyp) +needs Python, make and a buildchain like GCC. On Windows, +Python and Microsoft Visual Studio C++ are needed. For more information +visit [the node-gyp repository](https://github.com/nodejs/node-gyp) and +the [node-gyp Wiki](https://github.com/nodejs/node-gyp/wiki). + +### Directories + +See [`folders`](/configuring-npm/folders) to learn about where npm puts +stuff. + +In particular, npm has two modes of operation: + +* local mode: + npm installs packages into the current project directory, which + defaults to the current working directory. Packages install to + `./node_modules`, and bins to `./node_modules/.bin`. +* global mode: + npm installs packages into the install prefix at + `$npm_config_prefix/lib/node_modules` and bins to + `$npm_config_prefix/bin`. + +Local mode is the default. Use `-g` or `--global` on any command to +run in global mode instead. + +### Developer Usage + +If you're using npm to develop and publish your code, check out the +following help topics: + +* json: + Make a package.json file. See + [`package.json`](/configuring-npm/package-json). +* link: + Links your current working code into Node's path, so that you don't + have to reinstall every time you make a change. Use [`npm + link`](/commands/npm-link) to do this. +* install: + It's a good idea to install things if you don't need the symbolic + link. Especially, installing other peoples code from the registry is + done via [`npm install`](/commands/npm-install) +* adduser: + Create an account or log in. When you do this, npm will store + credentials in the user config file. +* publish: + Use the [`npm publish`](/commands/npm-publish) command to upload your + code to the registry. + +#### Configuration + +npm is extremely configurable. It reads its configuration options from +5 places. + +* Command line switches: + Set a config with `--key val`. All keys take a value, even if they + are booleans (the config parser doesn't know what the options are at + the time of parsing). If you do not provide a value (`--key`) then + the option is set to boolean `true`. +* Environment Variables: + Set any config by prefixing the name in an environment variable with + `npm_config_`. For example, `export npm_config_key=val`. +* User Configs: + The file at `$HOME/.npmrc` is an ini-formatted list of configs. If + present, it is parsed. If the `userconfig` option is set in the cli + or env, that file will be used instead. +* Global Configs: + The file found at `./etc/npmrc` (relative to the global prefix will be + parsed if it is found. See [`npm prefix`](/commands/npm-prefix) for + more info on the global prefix. If the `globalconfig` option is set + in the cli, env, or user config, then that file is parsed instead. +* Defaults: + npm's default configuration options are defined in + `lib/utils/config/definitions.js`. These must not be changed. + +See [`config`](/using-npm/config) for much much more information. + +### Contributions + +Patches welcome! + +If you would like to help, but don't know what to work on, read the +[contributing +guidelines](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md) and +check the issues list. + +### Bugs + +When you find issues, please report them: + + +Please be sure to follow the template and bug reporting guidelines. + +### Feature Requests + +Discuss new feature ideas on our discussion forum: + +* + +Or suggest formal RFC proposals: + +* + +### See Also + +* [npm help](/commands/npm-help) +* [package.json](/configuring-npm/package-json) +* [npmrc](/configuring-npm/npmrc) +* [npm config](/commands/npm-config) +* [npm install](/commands/npm-install) +* [npm prefix](/commands/npm-prefix) +* [npm publish](/commands/npm-publish) diff --git a/node_modules/npm/docs/content/commands/npx.md b/node_modules/npm/docs/content/commands/npx.md new file mode 100644 index 00000000..de0d75ba --- /dev/null +++ b/node_modules/npm/docs/content/commands/npx.md @@ -0,0 +1,168 @@ +--- +title: npx +section: 1 +description: Run a command from a local or remote npm package +--- + +### Synopsis + +```bash +npx -- [@] [args...] +npx --package=[@] -- [args...] +npx -c ' [args...]' +npx --package=foo -c ' [args...]' +``` + +### Description + +This command allows you to run an arbitrary command from an npm package +(either one installed locally, or fetched remotely), in a similar context +as running it via `npm run`. + +Whatever packages are specified by the `--package` option will be +provided in the `PATH` of the executed command, along with any locally +installed package executables. The `--package` option may be +specified multiple times, to execute the supplied command in an environment +where all specified packages are available. + +If any requested packages are not present in the local project +dependencies, then they are installed to a folder in the npm cache, which +is added to the `PATH` environment variable in the executed process. A +prompt is printed (which can be suppressed by providing either `--yes` or +`--no`). + +Package names provided without a specifier will be matched with whatever +version exists in the local project. Package names with a specifier will +only be considered a match if they have the exact same name and version as +the local dependency. + +If no `-c` or `--call` option is provided, then the positional arguments +are used to generate the command string. If no `--package` options +are provided, then npm will attempt to determine the executable name from +the package specifier provided as the first positional argument according +to the following heuristic: + +- If the package has a single entry in its `bin` field in `package.json`, + or if all entries are aliases of the same command, then that command + will be used. +- If the package has multiple `bin` entries, and one of them matches the + unscoped portion of the `name` field, then that command will be used. +- If this does not result in exactly one option (either because there are + no bin entries, or none of them match the `name` of the package), then + `npm exec` exits with an error. + +To run a binary _other than_ the named binary, specify one or more +`--package` options, which will prevent npm from inferring the package from +the first command argument. + +### `npx` vs `npm exec` + +When run via the `npx` binary, all flags and options *must* be set prior to +any positional arguments. When run via `npm exec`, a double-hyphen `--` +flag can be used to suppress npm's parsing of switches and options that +should be sent to the executed command. + +For example: + +``` +$ npx foo@latest bar --package=@npmcli/foo +``` + +In this case, npm will resolve the `foo` package name, and run the +following command: + +``` +$ foo bar --package=@npmcli/foo +``` + +Since the `--package` option comes _after_ the positional arguments, it is +treated as an argument to the executed command. + +In contrast, due to npm's argument parsing logic, running this command is +different: + +``` +$ npm exec foo@latest bar --package=@npmcli/foo +``` + +In this case, npm will parse the `--package` option first, resolving the +`@npmcli/foo` package. Then, it will execute the following command in that +context: + +``` +$ foo@latest bar +``` + +The double-hyphen character is recommended to explicitly tell npm to stop +parsing command line options and switches. The following command would +thus be equivalent to the `npx` command above: + +``` +$ npm exec -- foo@latest bar --package=@npmcli/foo +``` + +### Examples + +Run the version of `tap` in the local dependencies, with the provided +arguments: + +``` +$ npm exec -- tap --bail test/foo.js +$ npx tap --bail test/foo.js +``` + +Run a command _other than_ the command whose name matches the package name +by specifying a `--package` option: + +``` +$ npm exec --package=foo -- bar --bar-argument +# ~ or ~ +$ npx --package=foo bar --bar-argument +``` + +Run an arbitrary shell script, in the context of the current project: + +``` +$ npm x -c 'eslint && say "hooray, lint passed"' +$ npx -c 'eslint && say "hooray, lint passed"' +``` + +### Compatibility with Older npx Versions + +The `npx` binary was rewritten in npm v7.0.0, and the standalone `npx` +package deprecated at that time. `npx` uses the `npm exec` +command instead of a separate argument parser and install process, with +some affordances to maintain backwards compatibility with the arguments it +accepted in previous versions. + +This resulted in some shifts in its functionality: + +- Any `npm` config value may be provided. +- To prevent security and user-experience problems from mistyping package + names, `npx` prompts before installing anything. Suppress this + prompt with the `-y` or `--yes` option. +- The `--no-install` option is deprecated, and will be converted to `--no`. +- Shell fallback functionality is removed, as it is not advisable. +- The `-p` argument is a shorthand for `--parseable` in npm, but shorthand + for `--package` in npx. This is maintained, but only for the `npx` + executable. +- The `--ignore-existing` option is removed. Locally installed bins are + always present in the executed process `PATH`. +- The `--npm` option is removed. `npx` will always use the `npm` it ships + with. +- The `--node-arg` and `-n` options have been removed. Use [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#node_optionsoptions) instead: e.g., + `NODE_OPTIONS="--trace-warnings --trace-exit" npx foo --random=true` +- The `--always-spawn` option is redundant, and thus removed. +- The `--shell` option is replaced with `--script-shell`, but maintained + in the `npx` executable for backwards compatibility. + +### See Also + +* [npm run-script](/commands/npm-run-script) +* [npm scripts](/using-npm/scripts) +* [npm test](/commands/npm-test) +* [npm start](/commands/npm-start) +* [npm restart](/commands/npm-restart) +* [npm stop](/commands/npm-stop) +* [npm config](/commands/npm-config) +* [npm exec](/commands/npm-exec) diff --git a/node_modules/npm/docs/content/configuring-npm/folders.md b/node_modules/npm/docs/content/configuring-npm/folders.md new file mode 100644 index 00000000..5fb4ca25 --- /dev/null +++ b/node_modules/npm/docs/content/configuring-npm/folders.md @@ -0,0 +1,219 @@ +--- +title: folders +section: 5 +description: Folder Structures Used by npm +--- + +### Description + +npm puts various things on your computer. That's its job. + +This document will tell you what it puts where. + +#### tl;dr + +* Local install (default): puts stuff in `./node_modules` of the current + package root. +* Global install (with `-g`): puts stuff in /usr/local or wherever node + is installed. +* Install it **locally** if you're going to `require()` it. +* Install it **globally** if you're going to run it on the command line. +* If you need both, then install it in both places, or use `npm link`. + +#### prefix Configuration + +The [`prefix` config](/using-npm/config#prefix) defaults to the location where +node is installed. On most systems, this is `/usr/local`. On Windows, it's +`%AppData%\npm`. On Unix systems, it's one level up, since node is typically +installed at `{prefix}/bin/node` rather than `{prefix}/node.exe`. + +When the `global` flag is set, npm installs things into this prefix. +When it is not set, it uses the root of the current package, or the +current working directory if not in a package already. + +#### Node Modules + +Packages are dropped into the `node_modules` folder under the `prefix`. +When installing locally, this means that you can +`require("packagename")` to load its main module, or +`require("packagename/lib/path/to/sub/module")` to load other modules. + +Global installs on Unix systems go to `{prefix}/lib/node_modules`. +Global installs on Windows go to `{prefix}/node_modules` (that is, no +`lib` folder.) + +Scoped packages are installed the same way, except they are grouped together +in a sub-folder of the relevant `node_modules` folder with the name of that +scope prefix by the @ symbol, e.g. `npm install @myorg/package` would place +the package in `{prefix}/node_modules/@myorg/package`. See +[`scope`](/using-npm/scope) for more details. + +If you wish to `require()` a package, then install it locally. + +#### Executables + +When in global mode, executables are linked into `{prefix}/bin` on Unix, +or directly into `{prefix}` on Windows. Ensure that path is in your +terminal's `PATH` environment to run them. + +When in local mode, executables are linked into +`./node_modules/.bin` so that they can be made available to scripts run +through npm. (For example, so that a test runner will be in the path +when you run `npm test`.) + +#### Man Pages + +When in global mode, man pages are linked into `{prefix}/share/man`. + +When in local mode, man pages are not installed. + +Man pages are not installed on Windows systems. + +#### Cache + +See [`npm cache`](/commands/npm-cache). Cache files are stored in `~/.npm` on Posix, or +`%LocalAppData%/npm-cache` on Windows. + +This is controlled by the [`cache` config](/using-npm/config#cache) param. + +#### Temp Files + +Temporary files are stored by default in the folder specified by the +[`tmp` config](/using-npm/config#tmp), which defaults to the TMPDIR, TMP, or +TEMP environment variables, or `/tmp` on Unix and `c:\windows\temp` on Windows. + +Temp files are given a unique folder under this root for each run of the +program, and are deleted upon successful exit. + +### More Information + +When installing locally, npm first tries to find an appropriate +`prefix` folder. This is so that `npm install foo@1.2.3` will install +to the sensible root of your package, even if you happen to have `cd`ed +into some other folder. + +Starting at the $PWD, npm will walk up the folder tree checking for a +folder that contains either a `package.json` file, or a `node_modules` +folder. If such a thing is found, then that is treated as the effective +"current directory" for the purpose of running npm commands. (This +behavior is inspired by and similar to git's .git-folder seeking +logic when running git commands in a working dir.) + +If no package root is found, then the current folder is used. + +When you run `npm install foo@1.2.3`, then the package is loaded into +the cache, and then unpacked into `./node_modules/foo`. Then, any of +foo's dependencies are similarly unpacked into +`./node_modules/foo/node_modules/...`. + +Any bin files are symlinked to `./node_modules/.bin/`, so that they may +be found by npm scripts when necessary. + +#### Global Installation + +If the [`global` config](/using-npm/config#global) is set to true, then npm will +install packages "globally". + +For global installation, packages are installed roughly the same way, +but using the folders described above. + +#### Cycles, Conflicts, and Folder Parsimony + +Cycles are handled using the property of node's module system that it +walks up the directories looking for `node_modules` folders. So, at every +stage, if a package is already installed in an ancestor `node_modules` +folder, then it is not installed at the current location. + +Consider the case above, where `foo -> bar -> baz`. Imagine if, in +addition to that, baz depended on bar, so you'd have: +`foo -> bar -> baz -> bar -> baz ...`. However, since the folder +structure is: `foo/node_modules/bar/node_modules/baz`, there's no need to +put another copy of bar into `.../baz/node_modules`, since when baz calls +`require("bar")`, it will get the copy that is installed in +`foo/node_modules/bar`. + +This shortcut is only used if the exact same +version would be installed in multiple nested `node_modules` folders. It +is still possible to have `a/node_modules/b/node_modules/a` if the two +"a" packages are different versions. However, without repeating the +exact same package multiple times, an infinite regress will always be +prevented. + +Another optimization can be made by installing dependencies at the +highest level possible, below the localized "target" folder (hoisting). +Since version 3, npm hoists dependencies by default. + +#### Example + +Consider this dependency graph: + +```bash +foo ++-- blerg@1.2.5 ++-- bar@1.2.3 +| +-- blerg@1.x (latest=1.3.7) +| +-- baz@2.x +| | `-- quux@3.x +| | `-- bar@1.2.3 (cycle) +| `-- asdf@* +`-- baz@1.2.3 + `-- quux@3.x + `-- bar +``` + +In this case, we might expect a folder structure like this +(with all dependencies hoisted to the highest level possible): + +```bash +foo ++-- node_modules + +-- blerg (1.2.5) <---[A] + +-- bar (1.2.3) <---[B] + | +-- node_modules + | +-- baz (2.0.2) <---[C] + +-- asdf (2.3.4) + +-- baz (1.2.3) <---[D] + +-- quux (3.2.0) <---[E] +``` + +Since foo depends directly on `bar@1.2.3` and `baz@1.2.3`, those are +installed in foo's `node_modules` folder. + +Even though the latest copy of blerg is 1.3.7, foo has a specific +dependency on version 1.2.5. So, that gets installed at [A]. Since the +parent installation of blerg satisfies bar's dependency on `blerg@1.x`, +it does not install another copy under [B]. + +Bar [B] also has dependencies on baz and asdf. Because it depends on `baz@2.x`, it cannot +re-use the `baz@1.2.3` installed in the parent `node_modules` folder [D], +and must install its own copy [C]. In order to minimize duplication, npm hoists +dependencies to the top level by default, so asdf is installed under [A]. + +Underneath bar, the `baz -> quux -> bar` dependency creates a cycle. +However, because bar is already in quux's ancestry [B], it does not +unpack another copy of bar into that folder. Likewise, quux's [E] +folder tree is empty, because its dependency on bar is satisfied +by the parent folder copy installed at [B]. + +For a graphical breakdown of what is installed where, use `npm ls`. + +#### Publishing + +Upon publishing, npm will look in the `node_modules` folder. If any of +the items there are not in the `bundleDependencies` array, then they will +not be included in the package tarball. + +This allows a package maintainer to install all of their dependencies +(and dev dependencies) locally, but only re-publish those items that +cannot be found elsewhere. See [`package.json`](/configuring-npm/package-json) for more information. + +### See also + +* [package.json](/configuring-npm/package-json) +* [npm install](/commands/npm-install) +* [npm pack](/commands/npm-pack) +* [npm cache](/commands/npm-cache) +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [config](/using-npm/config) +* [npm publish](/commands/npm-publish) diff --git a/node_modules/npm/docs/content/configuring-npm/install.md b/node_modules/npm/docs/content/configuring-npm/install.md new file mode 100644 index 00000000..d9c1d326 --- /dev/null +++ b/node_modules/npm/docs/content/configuring-npm/install.md @@ -0,0 +1,78 @@ +--- +title: install +section: 5 +description: Download and install node and npm +--- + +### Description + +To publish and install packages to and from the public npm registry, you +must install Node.js and the npm command line interface using either a Node +version manager or a Node installer. **We strongly recommend using a Node +version manager to install Node.js and npm.** We do not recommend using a +Node installer, since the Node installation process installs npm in a +directory with local permissions and can cause permissions errors when you +run npm packages globally. + +### Overview + +- [Checking your version of npm and + Node.js](#checking-your-version-of-npm-and-nodejs) +- [Using a Node version manager to install Node.js and + npm](#using-a-node-version-manager-to-install-nodejs-and-npm) +- [Using a Node installer to install Node.js and + npm](#using-a-node-installer-to-install-nodejs-and-npm) + +### Checking your version of npm and Node.js + +To see if you already have Node.js and npm installed and check the +installed version, run the following commands: + +``` +node -v +npm -v +``` + +### Using a Node version manager to install Node.js and npm + +Node version managers allow you to install and switch between multiple +versions of Node.js and npm on your system so you can test your +applications on multiple versions of npm to ensure they work for users on +different versions. You can +[search for them on GitHub](https://github.com/search?q=node+version+manager+archived%3Afalse&type=repositories&ref=advsearch). + +### Using a Node installer to install Node.js and npm + +If you are unable to use a Node version manager, you can use a Node +installer to install both Node.js and npm on your system. + +* [Node.js installer](https://nodejs.org/en/download/) +* [NodeSource installer](https://github.com/nodesource/distributions). If + you use Linux, we recommend that you use a NodeSource installer. + +#### OS X or Windows Node installers + +If you're using OS X or Windows, use one of the installers from the +[Node.js download page](https://nodejs.org/en/download/). Be sure to +install the version labeled **LTS**. Other versions have not yet been +tested with npm. + +#### Linux or other operating systems Node installers + +If you're using Linux or another operating system, use one of the following +installers: + +- [NodeSource installer](https://github.com/nodesource/distributions) + (recommended) +- One of the installers on the [Node.js download + page](https://nodejs.org/en/download/) + +Or see [this page](https://nodejs.org/en/download/package-manager/) to +install npm for Linux in the way many Linux developers prefer. + +#### Less-common operating systems + +For more information on installing Node.js on a variety of operating +systems, see [this page][pkg-mgr]. + +[pkg-mgr]: https://nodejs.org/en/download/package-manager/ diff --git a/node_modules/npm/docs/content/configuring-npm/npm-shrinkwrap-json.md b/node_modules/npm/docs/content/configuring-npm/npm-shrinkwrap-json.md new file mode 100644 index 00000000..ab0a2410 --- /dev/null +++ b/node_modules/npm/docs/content/configuring-npm/npm-shrinkwrap-json.md @@ -0,0 +1,34 @@ +--- +title: npm-shrinkwrap.json +section: 5 +description: A publishable lockfile +--- + +### Description + +`npm-shrinkwrap.json` is a file created by [`npm +shrinkwrap`](/commands/npm-shrinkwrap). It is identical to +`package-lock.json`, with one major caveat: Unlike `package-lock.json`, +`npm-shrinkwrap.json` may be included when publishing a package. + +The recommended use-case for `npm-shrinkwrap.json` is applications deployed +through the publishing process on the registry: for example, daemons and +command-line tools intended as global installs or `devDependencies`. It's +strongly discouraged for library authors to publish this file, since that +would prevent end users from having control over transitive dependency +updates. + +If both `package-lock.json` and `npm-shrinkwrap.json` are present in a +package root, `npm-shrinkwrap.json` will be preferred over the +`package-lock.json` file. + +For full details and description of the `npm-shrinkwrap.json` file format, +refer to the manual page for +[package-lock.json](/configuring-npm/package-lock-json). + +### See also + +* [npm shrinkwrap](/commands/npm-shrinkwrap) +* [package-lock.json](/configuring-npm/package-lock-json) +* [package.json](/configuring-npm/package-json) +* [npm install](/commands/npm-install) diff --git a/node_modules/npm/docs/content/configuring-npm/npmrc.md b/node_modules/npm/docs/content/configuring-npm/npmrc.md new file mode 100644 index 00000000..cd31ae88 --- /dev/null +++ b/node_modules/npm/docs/content/configuring-npm/npmrc.md @@ -0,0 +1,140 @@ +--- +title: npmrc +section: 5 +description: The npm config files +--- + +### Description + +npm gets its config settings from the command line, environment variables, +and `npmrc` files. + +The `npm config` command can be used to update and edit the contents of the +user and global npmrc files. + +For a list of available configuration options, see +[config](/using-npm/config). + +### Files + +The four relevant files are: + +* per-project config file (`/path/to/my/project/.npmrc`) +* per-user config file (`~/.npmrc`) +* global config file (`$PREFIX/etc/npmrc`) +* npm builtin config file (`/path/to/npm/npmrc`) + +All npm config files are an ini-formatted list of `key = value` parameters. +Environment variables can be replaced using `${VARIABLE_NAME}`. For +example: + +```bash +cache = ${HOME}/.npm-packages +``` + +Each of these files is loaded, and config options are resolved in priority +order. For example, a setting in the userconfig file would override the +setting in the globalconfig file. + +Array values are specified by adding "[]" after the key name. For example: + +```bash +key[] = "first value" +key[] = "second value" +``` + +#### Comments + +Lines in `.npmrc` files are interpreted as comments when they begin with a +`;` or `#` character. `.npmrc` files are parsed by +[npm/ini](https://github.com/npm/ini), which specifies this comment syntax. + +For example: + +```bash +# last modified: 01 Jan 2016 +; Set a new registry for a scoped package +@myscope:registry=https://mycustomregistry.example.org +``` + +#### Per-project config file + +When working locally in a project, a `.npmrc` file in the root of the +project (ie, a sibling of `node_modules` and `package.json`) will set +config values specific to this project. + +Note that this only applies to the root of the project that you're running +npm in. It has no effect when your module is published. For example, you +can't publish a module that forces itself to install globally, or in a +different location. + +Additionally, this file is not read in global mode, such as when running +`npm install -g`. + +#### Per-user config file + +`$HOME/.npmrc` (or the `userconfig` param, if set in the environment or on +the command line) + +#### Global config file + +`$PREFIX/etc/npmrc` (or the `globalconfig` param, if set above): This file +is an ini-file formatted list of `key = value` parameters. Environment +variables can be replaced as above. + +#### Built-in config file + +`path/to/npm/itself/npmrc` + +This is an unchangeable "builtin" configuration file that npm keeps +consistent across updates. Set fields in here using the `./configure` +script that comes with npm. This is primarily for distribution maintainers +to override default configs in a standard and consistent manner. + +### Auth related configuration + +The settings `_auth`, `_authToken`, `username` and `_password` must all be +scoped to a specific registry. This ensures that `npm` will never send +credentials to the wrong host. + +The full list is: + - `_auth` (base64 authentication string) + - `_authToken` (authentication token) + - `username` + - `_password` + - `email` + - `cafile` (path to certificate authority file) + - `keyfile` (path to key file) + +In order to scope these values, they must be prefixed by a URI fragment. +If the credential is meant for any request to a registry on a single host, +the scope may look like `//registry.npmjs.org/:`. If it must be scoped to a +specific path on the host that path may also be provided, such as +`//my-custom-registry.org/unique/path:`. + +``` +; bad config +_authToken=MYTOKEN + +; good config +@myorg:registry=https://somewhere-else.com/myorg +@another:registry=https://somewhere-else.com/another +//registry.npmjs.org/:_authToken=MYTOKEN + +; would apply to both @myorg and @another +//somewhere-else.com/:_authToken=MYTOKEN + +; would apply only to @myorg +//somewhere-else.com/myorg/:_authToken=MYTOKEN1 + +; would apply only to @another +//somewhere-else.com/another/:_authToken=MYTOKEN2 +``` + +### See also + +* [npm folders](/configuring-npm/folders) +* [npm config](/commands/npm-config) +* [config](/using-npm/config) +* [package.json](/configuring-npm/package-json) +* [npm](/commands/npm) diff --git a/node_modules/npm/docs/content/configuring-npm/package-json.md b/node_modules/npm/docs/content/configuring-npm/package-json.md new file mode 100644 index 00000000..e09d50f0 --- /dev/null +++ b/node_modules/npm/docs/content/configuring-npm/package-json.md @@ -0,0 +1,1250 @@ +--- +title: package.json +section: 5 +description: Specifics of npm's package.json handling +--- + +### Description + +This document is all you need to know about what's required in your +package.json file. It must be actual JSON, not just a JavaScript object +literal. + +A lot of the behavior described in this document is affected by the config +settings described in [`config`](/using-npm/config). + +### name + +If you plan to publish your package, the *most* important things in your +package.json are the name and version fields as they will be required. The +name and version together form an identifier that is assumed to be +completely unique. Changes to the package should come along with changes +to the version. If you don't plan to publish your package, the name and +version fields are optional. + +The name is what your thing is called. + +Some rules: + +* The name must be less than or equal to 214 characters. This includes the + scope for scoped packages. +* The names of scoped packages can begin with a dot or an underscore. This + is not permitted without a scope. +* New packages must not have uppercase letters in the name. +* The name ends up being part of a URL, an argument on the command line, + and a folder name. Therefore, the name can't contain any non-URL-safe + characters. + +Some tips: + +* Don't use the same name as a core Node module. +* Don't put "js" or "node" in the name. It's assumed that it's js, since + you're writing a package.json file, and you can specify the engine using + the "[engines](#engines)" field. (See below.) +* The name will probably be passed as an argument to require(), so it + should be something short, but also reasonably descriptive. +* You may want to check the npm registry to see if there's something by + that name already, before you get too attached to it. + + +A name can be optionally prefixed by a scope, e.g. `@myorg/mypackage`. See +[`scope`](/using-npm/scope) for more detail. + +### version + +If you plan to publish your package, the *most* important things in your +package.json are the name and version fields as they will be required. The +name and version together form an identifier that is assumed to be +completely unique. Changes to the package should come along with changes +to the version. If you don't plan to publish your package, the name and +version fields are optional. + +Version must be parseable by +[node-semver](https://github.com/npm/node-semver), which is bundled with +npm as a dependency. (`npm install semver` to use it yourself.) + +### description + +Put a description in it. It's a string. This helps people discover your +package, as it's listed in `npm search`. + +### keywords + +Put keywords in it. It's an array of strings. This helps people discover +your package as it's listed in `npm search`. + +### homepage + +The URL to the project homepage. + +Example: + +```json +"homepage": "https://github.com/owner/project#readme" +``` + +### bugs + +The URL to your project's issue tracker and / or the email address to which +issues should be reported. These are helpful for people who encounter +issues with your package. + +It should look like this: + +```json +{ + "bugs": { + "url": "https://github.com/owner/project/issues", + "email": "project@hostname.com" + } +} +``` + +You can specify either one or both values. If you want to provide only a +URL, you can specify the value for "bugs" as a simple string instead of an +object. + +If a URL is provided, it will be used by the `npm bugs` command. + +### license + +You should specify a license for your package so that people know how they +are permitted to use it, and any restrictions you're placing on it. + +If you're using a common license such as BSD-2-Clause or MIT, add a current +SPDX license identifier for the license you're using, like this: + +```json +{ + "license" : "BSD-3-Clause" +} +``` + +You can check [the full list of SPDX license +IDs](https://spdx.org/licenses/). Ideally you should pick one that is +[OSI](https://opensource.org/licenses/) approved. + +If your package is licensed under multiple common licenses, use an [SPDX +license expression syntax version 2.0 +string](https://spdx.dev/specifications/), like this: + +```json +{ + "license" : "(ISC OR GPL-3.0)" +} +``` +If you are using a license that hasn't been assigned an SPDX identifier, or if +you are using a custom license, use a string value like this one: + +```json +{ + "license" : "SEE LICENSE IN " +} +``` +Then include a file named `` at the top level of the package. + +Some old packages used license objects or a "licenses" property containing +an array of license objects: + +```json +// Not valid metadata +{ + "license" : { + "type" : "ISC", + "url" : "https://opensource.org/licenses/ISC" + } +} + +// Not valid metadata +{ + "licenses" : [ + { + "type": "MIT", + "url": "https://www.opensource.org/licenses/mit-license.php" + }, + { + "type": "Apache-2.0", + "url": "https://opensource.org/licenses/apache2.0.php" + } + ] +} +``` + +Those styles are now deprecated. Instead, use SPDX expressions, like this: + +```json +{ + "license": "ISC" +} +``` + +```json +{ + "license": "(MIT OR Apache-2.0)" +} +``` + +Finally, if you do not wish to grant others the right to use a private or +unpublished package under any terms: + +```json +{ + "license": "UNLICENSED" +} +``` + +Consider also setting `"private": true` to prevent accidental publication. + +### people fields: author, contributors + +The "author" is one person. "contributors" is an array of people. A +"person" is an object with a "name" field and optionally "url" and "email", +like this: + +```json +{ + "name" : "Barney Rubble", + "email" : "b@rubble.com", + "url" : "http://barnyrubble.tumblr.com/" +} +``` + +Or you can shorten that all into a single string, and npm will parse it for +you: + +```json +{ + "author": "Barney Rubble (http://barnyrubble.tumblr.com/)" +} +``` + +Both email and url are optional either way. + +npm also sets a top-level "maintainers" field with your npm user info. + +### funding + +You can specify an object containing a URL that provides up-to-date +information about ways to help fund development of your package, a +string URL, or an array of objects and string URLs: + +```json +{ + "funding": { + "type" : "individual", + "url" : "http://example.com/donate" + } +} +``` + +```json +{ + "funding": { + "type" : "patreon", + "url" : "https://www.patreon.com/my-account" + } +} +``` + +```json +{ + "funding": "http://example.com/donate" +} +``` + +```json +{ + "funding": [ + { + "type" : "individual", + "url" : "http://example.com/donate" + }, + "http://example.com/donateAlso", + { + "type" : "patreon", + "url" : "https://www.patreon.com/my-account" + } + ] +} +``` + +Users can use the `npm fund` subcommand to list the `funding` URLs of all +dependencies of their project, direct and indirect. A shortcut to visit +each funding URL is also available when providing the project name such as: +`npm fund ` (when there are multiple URLs, the first one will +be visited) + +### files + +The optional `files` field is an array of file patterns that describes the +entries to be included when your package is installed as a dependency. File +patterns follow a similar syntax to `.gitignore`, but reversed: including a +file, directory, or glob pattern (`*`, `**/*`, and such) will make it so +that file is included in the tarball when it's packed. Omitting the field +will make it default to `["*"]`, which means it will include all files. + +Some special files and directories are also included or excluded regardless +of whether they exist in the `files` array (see below). + +You can also provide a `.npmignore` file in the root of your package or in +subdirectories, which will keep files from being included. At the root of +your package it will not override the "files" field, but in subdirectories +it will. The `.npmignore` file works just like a `.gitignore`. If there is +a `.gitignore` file, and `.npmignore` is missing, `.gitignore`'s contents +will be used instead. + +Certain files are always included, regardless of settings: + +* `package.json` +* `README` +* `LICENSE` / `LICENCE` +* The file in the "main" field +* The file(s) in the "bin" field + +`README` & `LICENSE` can have any case and extension. + +Some files are always ignored by default: + +* `*.orig` +* `.*.swp` +* `.DS_Store` +* `._*` +* `.git` +* `.hg` +* `.lock-wscript` +* `.npmrc` +* `.svn` +* `.wafpickle-N` +* `CVS` +* `config.gypi` +* `node_modules` +* `npm-debug.log` +* `package-lock.json` (use + [`npm-shrinkwrap.json`](/configuring-npm/npm-shrinkwrap-json) + if you wish it to be published) +* `pnpm-lock.yaml` +* `yarn.lock` +* `bun.lockb` + +Most of these ignored files can be included specifically if included in +the `files` globs. Exceptions to this are: + +* `.git` +* `.npmrc` +* `node_modules` +* `package-lock.json` +* `pnpm-lock.yaml` +* `yarn.lock` +* `bun.lockb` + +These can not be included. + +### exports + +The "exports" provides a modern alternative to "main" allowing multiple entry points to be defined, conditional entry resolution support between environments, and preventing any other entry points besides those defined in "exports". This encapsulation allows module authors to clearly define the public interface for their package. For more details see the [node.js documentation on package entry points](https://nodejs.org/api/packages.html#package-entry-points) + +### main + +The main field is a module ID that is the primary entry point to your +program. That is, if your package is named `foo`, and a user installs it, +and then does `require("foo")`, then your main module's exports object will +be returned. + +This should be a module relative to the root of your package folder. + +For most modules, it makes the most sense to have a main script and often +not much else. + +If `main` is not set, it defaults to `index.js` in the package's root folder. + +### browser + +If your module is meant to be used client-side the browser field should be +used instead of the main field. This is helpful to hint users that it might +rely on primitives that aren't available in Node.js modules. (e.g. +`window`) + +### bin + +A lot of packages have one or more executable files that they'd like to +install into the PATH. npm makes this pretty easy (in fact, it uses this +feature to install the "npm" executable.) + +To use this, supply a `bin` field in your package.json which is a map of +command name to local file name. When this package is installed globally, +that file will be either linked inside the global bins directory or +a cmd (Windows Command File) will be created which executes the specified +file in the `bin` field, so it is available to run by `name` or `name.cmd` (on +Windows PowerShell). When this package is installed as a dependency in another +package, the file will be linked where it will be available to that package +either directly by `npm exec` or by name in other scripts when invoking them +via `npm run-script`. + + +For example, myapp could have this: + +```json +{ + "bin": { + "myapp": "bin/cli.js" + } +} +``` + +So, when you install myapp, in case of unix-like OS it'll create a symlink +from the `cli.js` script to `/usr/local/bin/myapp` and in case of windows it +will create a cmd file usually at `C:\Users\{Username}\AppData\Roaming\npm\myapp.cmd` +which runs the `cli.js` script. + +If you have a single executable, and its name should be the name of the +package, then you can just supply it as a string. For example: + +```json +{ + "name": "my-program", + "version": "1.2.5", + "bin": "path/to/program" +} +``` + +would be the same as this: + +```json +{ + "name": "my-program", + "version": "1.2.5", + "bin": { + "my-program": "path/to/program" + } +} +``` + +Please make sure that your file(s) referenced in `bin` starts with +`#!/usr/bin/env node`, otherwise the scripts are started without the node +executable! + +Note that you can also set the executable files using [directories.bin](#directoriesbin). + +See [folders](/configuring-npm/folders#executables) for more info on +executables. + +### man + +Specify either a single file or an array of filenames to put in place for +the `man` program to find. + +If only a single file is provided, then it's installed such that it is the +result from `man `, regardless of its actual filename. For +example: + +```json +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": "./man/doc.1" +} +``` + +would link the `./man/doc.1` file in such that it is the target for `man +foo` + +If the filename doesn't start with the package name, then it's prefixed. +So, this: + +```json +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": [ + "./man/foo.1", + "./man/bar.1" + ] +} +``` + +will create files to do `man foo` and `man foo-bar`. + +Man files must end with a number, and optionally a `.gz` suffix if they are +compressed. The number dictates which man section the file is installed +into. + +```json +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": [ + "./man/foo.1", + "./man/foo.2" + ] +} +``` + +will create entries for `man foo` and `man 2 foo` + +### directories + +The CommonJS [Packages](http://wiki.commonjs.org/wiki/Packages/1.0) spec +details a few ways that you can indicate the structure of your package +using a `directories` object. If you look at [npm's +package.json](https://registry.npmjs.org/npm/latest), you'll see that it +has directories for doc, lib, and man. + +In the future, this information may be used in other creative ways. + +#### directories.bin + +If you specify a `bin` directory in `directories.bin`, all the files in +that folder will be added. + +Because of the way the `bin` directive works, specifying both a `bin` path +and setting `directories.bin` is an error. If you want to specify +individual files, use `bin`, and for all the files in an existing `bin` +directory, use `directories.bin`. + +#### directories.man + +A folder that is full of man pages. Sugar to generate a "man" array by +walking the folder. + +### repository + +Specify the place where your code lives. This is helpful for people who +want to contribute. If the git repo is on GitHub, then the `npm repo` +command will be able to find you. + +Do it like this: + +```json +{ + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git" + } +} +``` + +The URL should be a publicly available (perhaps read-only) URL that can be +handed directly to a VCS program without any modification. It should not +be a URL to an html project page that you put in your browser. It's for +computers. + +For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the +same shortcut syntax you use for `npm install`: + +```json +{ + "repository": "npm/npm", + + "repository": "github:user/repo", + + "repository": "gist:11081aaa281", + + "repository": "bitbucket:user/repo", + + "repository": "gitlab:user/repo" +} +``` + +If the `package.json` for your package is not in the root directory (for +example if it is part of a monorepo), you can specify the directory in +which it lives: + +```json +{ + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmpublish" + } +} +``` + +### scripts + +The "scripts" property is a dictionary containing script commands that are +run at various times in the lifecycle of your package. The key is the +lifecycle event, and the value is the command to run at that point. + +See [`scripts`](/using-npm/scripts) to find out more about writing package +scripts. + +### config + +A "config" object can be used to set configuration parameters used in +package scripts that persist across upgrades. For instance, if a package +had the following: + +```json +{ + "name": "foo", + "config": { + "port": "8080" + } +} +``` + +It could also have a "start" command that referenced the +`npm_package_config_port` environment variable. + +### dependencies + +Dependencies are specified in a simple object that maps a package name to a +version range. The version range is a string which has one or more +space-separated descriptors. Dependencies can also be identified with a +tarball or git URL. + +**Please do not put test harnesses or transpilers or other "development" +time tools in your `dependencies` object.** See `devDependencies`, below. + +See [semver](https://github.com/npm/node-semver#versions) for more details about specifying version ranges. + +* `version` Must match `version` exactly +* `>version` Must be greater than `version` +* `>=version` etc +* `=version1 <=version2`. +* `range1 || range2` Passes if either range1 or range2 are satisfied. +* `git...` See 'Git URLs as Dependencies' below +* `user/repo` See 'GitHub URLs' below +* `tag` A specific version tagged and published as `tag` See [`npm + dist-tag`](/commands/npm-dist-tag) +* `path/path/path` See [Local Paths](#local-paths) below +* `npm:@scope/pkg@version` Custom alias for a pacakge See [`package-spec`](/using-npm/package-spec#aliases) + +For example, these are all valid: + +```json +{ + "dependencies": { + "foo": "1.0.0 - 2.9999.9999", + "bar": ">=1.0.2 <2.1.2", + "baz": ">1.0.2 <=2.3.4", + "boo": "2.0.1", + "qux": "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0", + "asd": "http://asdf.com/asdf.tar.gz", + "til": "~1.2", + "elf": "~1.2.3", + "two": "2.x", + "thr": "3.3.x", + "lat": "latest", + "dyl": "file:../dyl", + "kpg": "npm:pkg@1.0.0" + } +} +``` + +#### URLs as Dependencies + +You may specify a tarball URL in place of a version range. + +This tarball will be downloaded and installed locally to your package at +install time. + +#### Git URLs as Dependencies + +Git URLs are of the form: + +```bash +://[[:]@][:][:][/][# | #semver:] +``` + +`` is one of `git`, `git+ssh`, `git+http`, `git+https`, or +`git+file`. + +If `#` is provided, it will be used to clone exactly that +commit. If the commit-ish has the format `#semver:`, `` can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for +a registry dependency. If neither `#` or `#semver:` is +specified, then the default branch is used. + +Examples: + +```bash +git+ssh://git@github.com:npm/cli.git#v1.0.27 +git+ssh://git@github.com:npm/cli#semver:^5.0 +git+https://isaacs@github.com/npm/cli.git +git://github.com/npm/cli.git#v1.0.27 +``` + +When installing from a `git` repository, the presence of certain fields in the +`package.json` will cause npm to believe it needs to perform a build. To do so +your repository will be cloned into a temporary directory, all of its deps +installed, relevant scripts run, and the resulting directory packed and +installed. + +This flow will occur if your git dependency uses `workspaces`, or if any of the +following scripts are present: + +* `build` +* `prepare` +* `prepack` +* `preinstall` +* `install` +* `postinstall` + +If your git repository includes pre-built artifacts, you will likely want to +make sure that none of the above scripts are defined, or your dependency +will be rebuilt for every installation. + +#### GitHub URLs + +As of version 1.1.65, you can refer to GitHub URLs as just "foo": +"user/foo-project". Just as with git URLs, a `commit-ish` suffix can be +included. For example: + +```json +{ + "name": "foo", + "version": "0.0.0", + "dependencies": { + "express": "expressjs/express", + "mocha": "mochajs/mocha#4727d357ea", + "module": "user/repo#feature\/branch" + } +} +``` + +#### Local Paths + +As of version 2.0.0 you can provide a path to a local directory that +contains a package. Local paths can be saved using `npm install -S` or `npm +install --save`, using any of these forms: + +```bash +../foo/bar +~/foo/bar +./foo/bar +/foo/bar +``` + +in which case they will be normalized to a relative path and added to your +`package.json`. For example: + +```json +{ + "name": "baz", + "dependencies": { + "bar": "file:../foo/bar" + } +} +``` + +This feature is helpful for local offline development and creating tests +that require npm installing where you don't want to hit an external server, +but should not be used when publishing your package to the public registry. + +*note*: Packages linked by local path will not have their own +dependencies installed when `npm install` is ran in this case. You must +run `npm install` from inside the local path itself. + +### devDependencies + +If someone is planning on downloading and using your module in their +program, then they probably don't want or need to download and build the +external test or documentation framework that you use. + +In this case, it's best to map these additional items in a +`devDependencies` object. + +These things will be installed when doing `npm link` or `npm install` from +the root of a package, and can be managed like any other npm configuration +param. See [`config`](/using-npm/config) for more on the topic. + +For build steps that are not platform-specific, such as compiling +CoffeeScript or other languages to JavaScript, use the `prepare` script to +do this, and make the required package a devDependency. + +For example: + +```json +{ + "name": "ethopia-waza", + "description": "a delightfully fruity coffee varietal", + "version": "1.2.3", + "devDependencies": { + "coffee-script": "~1.6.3" + }, + "scripts": { + "prepare": "coffee -o lib/ -c src/waza.coffee" + }, + "main": "lib/waza.js" +} +``` + +The `prepare` script will be run before publishing, so that users can +consume the functionality without requiring them to compile it themselves. +In dev mode (ie, locally running `npm install`), it'll run this script as +well, so that you can test it easily. + +### peerDependencies + +In some cases, you want to express the compatibility of your package with a +host tool or library, while not necessarily doing a `require` of this host. +This is usually referred to as a *plugin*. Notably, your module may be +exposing a specific interface, expected and specified by the host +documentation. + +For example: + +```json +{ + "name": "tea-latte", + "version": "1.3.5", + "peerDependencies": { + "tea": "2.x" + } +} +``` + +This ensures your package `tea-latte` can be installed *along* with the +second major version of the host package `tea` only. `npm install +tea-latte` could possibly yield the following dependency graph: + +```bash +├── tea-latte@1.3.5 +└── tea@2.2.0 +``` + +In npm versions 3 through 6, `peerDependencies` were not automatically +installed, and would raise a warning if an invalid version of the peer +dependency was found in the tree. As of npm v7, peerDependencies _are_ +installed by default. + +Trying to install another plugin with a conflicting requirement may cause +an error if the tree cannot be resolved correctly. For this reason, make +sure your plugin requirement is as broad as possible, and not to lock it +down to specific patch versions. + +Assuming the host complies with [semver](https://semver.org/), only changes +in the host package's major version will break your plugin. Thus, if you've +worked with every 1.x version of the host package, use `"^1.0"` or `"1.x"` +to express this. If you depend on features introduced in 1.5.2, use +`"^1.5.2"`. + +### peerDependenciesMeta + +The `peerDependenciesMeta` field serves to provide npm more information on how +your peer dependencies are to be used. Specifically, it allows peer +dependencies to be marked as optional. Npm will not automatically install +optional peer dependencies. This allows you to +integrate and interact with a variety of host packages without requiring +all of them to be installed. + +For example: + +```json +{ + "name": "tea-latte", + "version": "1.3.5", + "peerDependencies": { + "tea": "2.x", + "soy-milk": "1.2" + }, + "peerDependenciesMeta": { + "soy-milk": { + "optional": true + } + } +} +``` + +### bundleDependencies + +This defines an array of package names that will be bundled when publishing +the package. + +In cases where you need to preserve npm packages locally or have them +available through a single file download, you can bundle the packages in a +tarball file by specifying the package names in the `bundleDependencies` +array and executing `npm pack`. + +For example: + +If we define a package.json like this: + +```json +{ + "name": "awesome-web-framework", + "version": "1.0.0", + "bundleDependencies": [ + "renderized", + "super-streams" + ] +} +``` + +we can obtain `awesome-web-framework-1.0.0.tgz` file by running `npm pack`. +This file contains the dependencies `renderized` and `super-streams` which +can be installed in a new project by executing `npm install +awesome-web-framework-1.0.0.tgz`. Note that the package names do not +include any versions, as that information is specified in `dependencies`. + +If this is spelled `"bundledDependencies"`, then that is also honored. + +Alternatively, `"bundleDependencies"` can be defined as a boolean value. A +value of `true` will bundle all dependencies, a value of `false` will bundle +none. + +### optionalDependencies + +If a dependency can be used, but you would like npm to proceed if it cannot +be found or fails to install, then you may put it in the +`optionalDependencies` object. This is a map of package name to version or +URL, just like the `dependencies` object. The difference is that build +failures do not cause installation to fail. Running `npm install +--omit=optional` will prevent these dependencies from being installed. + +It is still your program's responsibility to handle the lack of the +dependency. For example, something like this: + +```js +try { + var foo = require('foo') + var fooVersion = require('foo/package.json').version +} catch (er) { + foo = null +} +if ( notGoodFooVersion(fooVersion) ) { + foo = null +} + +// .. then later in your program .. + +if (foo) { + foo.doFooThings() +} +``` + +Entries in `optionalDependencies` will override entries of the same name in +`dependencies`, so it's usually best to only put in one place. + +### overrides + +If you need to make specific changes to dependencies of your dependencies, for +example replacing the version of a dependency with a known security issue, +replacing an existing dependency with a fork, or making sure that the same +version of a package is used everywhere, then you may add an override. + +Overrides provide a way to replace a package in your dependency tree with +another version, or another package entirely. These changes can be scoped as +specific or as vague as desired. + +Overrides are only considered in the root `package.json` file for a project. +Overrides in installed dependencies (including +[workspaces](/using-npm/workspaces)) are not considered in dependency tree +resolution. Published packages may dictate their resolutions by pinning +dependencies or using an +[`npm-shrinkwrap.json`](/configuring-npm/npm-shrinkwrap-json) file. + +To make sure the package `foo` is always installed as version `1.0.0` no matter +what version your dependencies rely on: + +```json +{ + "overrides": { + "foo": "1.0.0" + } +} +``` + +The above is a short hand notation, the full object form can be used to allow +overriding a package itself as well as a child of the package. This will cause +`foo` to always be `1.0.0` while also making `bar` at any depth beyond `foo` +also `1.0.0`: + +```json +{ + "overrides": { + "foo": { + ".": "1.0.0", + "bar": "1.0.0" + } + } +} +``` + +To only override `foo` to be `1.0.0` when it's a child (or grandchild, or great +grandchild, etc) of the package `bar`: + +```json +{ + "overrides": { + "bar": { + "foo": "1.0.0" + } + } +} +``` + +Keys can be nested to any arbitrary length. To override `foo` only when it's a +child of `bar` and only when `bar` is a child of `baz`: + +```json +{ + "overrides": { + "baz": { + "bar": { + "foo": "1.0.0" + } + } + } +} +``` + +The key of an override can also include a version, or range of versions. +To override `foo` to `1.0.0`, but only when it's a child of `bar@2.0.0`: + +```json +{ + "overrides": { + "bar@2.0.0": { + "foo": "1.0.0" + } + } +} +``` + +You may not set an override for a package that you directly depend on unless +both the dependency and the override itself share the exact same spec. To make +this limitation easier to deal with, overrides may also be defined as a +reference to a spec for a direct dependency by prefixing the name of the +package you wish the version to match with a `$`. + +```json +{ + "dependencies": { + "foo": "^1.0.0" + }, + "overrides": { + // BAD, will throw an EOVERRIDE error + // "foo": "^2.0.0" + // GOOD, specs match so override is allowed + // "foo": "^1.0.0" + // BEST, the override is defined as a reference to the dependency + "foo": "$foo", + // the referenced package does not need to match the overridden one + "bar": "$foo" + } +} +``` + +### engines + +You can specify the version of node that your stuff works on: + +```json +{ + "engines": { + "node": ">=0.10.3 <15" + } +} +``` + +And, like with dependencies, if you don't specify the version (or if you +specify "\*" as the version), then any version of node will do. + +You can also use the "engines" field to specify which versions of npm are +capable of properly installing your program. For example: + +```json +{ + "engines": { + "npm": "~1.0.20" + } +} +``` + +Unless the user has set the +[`engine-strict` config](/using-npm/config#engine-strict) flag, this field is +advisory only and will only produce warnings when your package is installed as a +dependency. + +### os + +You can specify which operating systems your +module will run on: + +```json +{ + "os": [ + "darwin", + "linux" + ] +} +``` + +You can also block instead of allowing operating systems, just prepend the +blocked os with a '!': + +```json +{ + "os": [ + "!win32" + ] +} +``` + +The host operating system is determined by `process.platform` + +It is allowed to both block and allow an item, although there isn't any +good reason to do this. + +### cpu + +If your code only runs on certain cpu architectures, +you can specify which ones. + +```json +{ + "cpu": [ + "x64", + "ia32" + ] +} +``` + +Like the `os` option, you can also block architectures: + +```json +{ + "cpu": [ + "!arm", + "!mips" + ] +} +``` + +The host architecture is determined by `process.arch` + +### libc + +If your code only runs or builds in certain versions of libc, you can +specify which ones. This field only applies if `os` is `linux`. + +```json +{ + "os": "linux", + "libc": "glibc" +} +``` + +### devEngines + +The `devEngines` field aids engineers working on a codebase to all be using the same tooling. + +You can specify a `devEngines` property in your `package.json` which will run before `install`, `ci`, and `run` commands. + +> Note: `engines` and `devEngines` differ in object shape. They also function very differently. `engines` is designed to alert the user when a dependency uses a differening npm or node version that the project it's being used in, whereas `devEngines` is used to alert people interacting with the source code of a project. + +The supported keys under the `devEngines` property are `cpu`, `os`, `libc`, `runtime`, and `packageManager`. Each property can be an object or an array of objects. Objects must contain `name`, and optionally can specify `version`, and `onFail`. `onFail` can be `warn`, `error`, or `ignore`, and if left undefined is of the same value as `error`. `npm` will assume that you're running with `node`. +Here's an example of a project that will fail if the environment is not `node` and `npm`. If you set `runtime.name` or `packageManager.name` to any other string, it will fail within the npm CLI. + +```json +{ + "devEngines": { + "runtime": { + "name": "node", + "onFail": "error" + }, + "packageManager": { + "name": "npm", + "onFail": "error" + } + } +} +``` + +### private + +If you set `"private": true` in your package.json, then npm will refuse to +publish it. + +This is a way to prevent accidental publication of private repositories. +If you would like to ensure that a given package is only ever published to +a specific registry (for example, an internal registry), then use the +`publishConfig` dictionary described below to override the `registry` +config param at publish-time. + +### publishConfig + +This is a set of config values that will be used at publish-time. It's +especially handy if you want to set the tag, registry or access, so that +you can ensure that a given package is not tagged with "latest", published +to the global public registry or that a scoped module is private by +default. + +See [`config`](/using-npm/config) to see the list of config options that +can be overridden. + +### workspaces + +The optional `workspaces` field is an array of file patterns that describes +locations within the local file system that the install client should look +up to find each [workspace](/using-npm/workspaces) that needs to be +symlinked to the top level `node_modules` folder. + +It can describe either the direct paths of the folders to be used as +workspaces or it can define globs that will resolve to these same folders. + +In the following example, all folders located inside the folder +`./packages` will be treated as workspaces as long as they have valid +`package.json` files inside them: + +```json +{ + "name": "workspace-example", + "workspaces": [ + "./packages/*" + ] +} +``` + +See [`workspaces`](/using-npm/workspaces) for more examples. + +### DEFAULT VALUES + +npm will default some values based on package contents. + +* `"scripts": {"start": "node server.js"}` + + If there is a `server.js` file in the root of your package, then npm will + default the `start` command to `node server.js`. + +* `"scripts":{"install": "node-gyp rebuild"}` + + If there is a `binding.gyp` file in the root of your package and you have + not defined an `install` or `preinstall` script, npm will default the + `install` command to compile using node-gyp. + +* `"contributors": [...]` + + If there is an `AUTHORS` file in the root of your package, npm will treat + each line as a `Name (url)` format, where email and url are + optional. Lines which start with a `#` or are blank, will be ignored. + +### SEE ALSO + +* [semver](https://github.com/npm/node-semver#versions) +* [workspaces](/using-npm/workspaces) +* [npm init](/commands/npm-init) +* [npm version](/commands/npm-version) +* [npm config](/commands/npm-config) +* [npm help](/commands/npm-help) +* [npm install](/commands/npm-install) +* [npm publish](/commands/npm-publish) +* [npm uninstall](/commands/npm-uninstall) diff --git a/node_modules/npm/docs/content/configuring-npm/package-lock-json.md b/node_modules/npm/docs/content/configuring-npm/package-lock-json.md new file mode 100644 index 00000000..f3b01217 --- /dev/null +++ b/node_modules/npm/docs/content/configuring-npm/package-lock-json.md @@ -0,0 +1,237 @@ +--- +title: package-lock.json +section: 5 +description: A manifestation of the manifest +--- + +### Description + +`package-lock.json` is automatically generated for any operations where npm +modifies either the `node_modules` tree, or `package.json`. It describes the +exact tree that was generated, such that subsequent installs are able to +generate identical trees, regardless of intermediate dependency updates. + +This file is intended to be committed into source repositories, and serves +various purposes: + +* Describe a single representation of a dependency tree such that + teammates, deployments, and continuous integration are guaranteed to + install exactly the same dependencies. + +* Provide a facility for users to "time-travel" to previous states of + `node_modules` without having to commit the directory itself. + +* Facilitate greater visibility of tree changes through readable source + control diffs. + +* Optimize the installation process by allowing npm to skip repeated + metadata resolutions for previously-installed packages. + +* As of npm v7, lockfiles include enough information to gain a complete + picture of the package tree, reducing the need to read `package.json` + files, and allowing for significant performance improvements. + +When `npm` creates or updates `package-lock.json`, it will infer line endings and indentation from `package.json` so that the formatting of both files matches. + +### `package-lock.json` vs `npm-shrinkwrap.json` + +Both of these files have the same format, and perform similar functions in +the root of a project. + +The difference is that `package-lock.json` cannot be published, and it will +be ignored if found in any place other than the root project. + +In contrast, [npm-shrinkwrap.json](/configuring-npm/npm-shrinkwrap-json) allows +publication, and defines the dependency tree from the point encountered. +This is not recommended unless deploying a CLI tool or otherwise using the +publication process for producing production packages. + +If both `package-lock.json` and `npm-shrinkwrap.json` are present in the +root of a project, `npm-shrinkwrap.json` will take precedence and +`package-lock.json` will be ignored. + +### Hidden Lockfiles + +In order to avoid processing the `node_modules` folder repeatedly, npm as +of v7 uses a "hidden" lockfile present in +`node_modules/.package-lock.json`. This contains information about the +tree, and is used in lieu of reading the entire `node_modules` hierarchy +provided that the following conditions are met: + +- All package folders it references exist in the `node_modules` hierarchy. +- No package folders exist in the `node_modules` hierarchy that are not + listed in the lockfile. +- The modified time of the file is at least as recent as all of the package + folders it references. + +That is, the hidden lockfile will only be relevant if it was created as +part of the most recent update to the package tree. If another CLI mutates +the tree in any way, this will be detected, and the hidden lockfile will be +ignored. + +Note that it _is_ possible to manually change the _contents_ of a package +in such a way that the modified time of the package folder is unaffected. +For example, if you add a file to `node_modules/foo/lib/bar.js`, then the +modified time on `node_modules/foo` will not reflect this change. If you +are manually editing files in `node_modules`, it is generally best to +delete the file at `node_modules/.package-lock.json`. + +As the hidden lockfile is ignored by older npm versions, it does not +contain the backwards compatibility affordances present in "normal" +lockfiles. That is, it is `lockfileVersion: 3`, rather than +`lockfileVersion: 2`. + +### Handling Old Lockfiles + +When npm detects a lockfile from npm v6 or before during the package +installation process, it is automatically updated to fetch missing +information from either the `node_modules` tree or (in the case of empty +`node_modules` trees or very old lockfile formats) the npm registry. + +### File Format + +#### `name` + +The name of the package this is a package-lock for. This will match what's +in `package.json`. + +#### `version` + +The version of the package this is a package-lock for. This will match +what's in `package.json`. + +#### `lockfileVersion` + +An integer version, starting at `1` with the version number of this +document whose semantics were used when generating this +`package-lock.json`. + +Note that the file format changed significantly in npm v7 to track +information that would have otherwise required looking in `node_modules` or +the npm registry. Lockfiles generated by npm v7 will contain +`lockfileVersion: 2`. + +* No version provided: an "ancient" shrinkwrap file from a version of npm + prior to npm v5. +* `1`: The lockfile version used by npm v5 and v6. +* `2`: The lockfile version used by npm v7 and v8. Backwards compatible to v1 + lockfiles. +* `3`: The lockfile version used by npm v9 and above. Backwards compatible to npm v7. + +npm will always attempt to get whatever data it can out of a lockfile, even +if it is not a version that it was designed to support. + +#### `packages` + +This is an object that maps package locations to an object containing the +information about that package. + +The root project is typically listed with a key of `""`, and all other +packages are listed with their relative paths from the root project folder. + +Package descriptors have the following fields: + +* version: The version found in `package.json` + +* resolved: The place where the package was actually resolved from. In + the case of packages fetched from the registry, this will be a url to a + tarball. In the case of git dependencies, this will be the full git url + with commit sha. In the case of link dependencies, this will be the + location of the link target. `registry.npmjs.org` is a magic value meaning + "the currently configured registry". + +* integrity: A `sha512` or `sha1` [Standard Subresource + Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) + string for the artifact that was unpacked in this location. + +* link: A flag to indicate that this is a symbolic link. If this is + present, no other fields are specified, since the link target will also + be included in the lockfile. + +* dev, optional, devOptional: If the package is strictly part of the + `devDependencies` tree, then `dev` will be true. If it is strictly part + of the `optionalDependencies` tree, then `optional` will be set. If it + is both a `dev` dependency _and_ an `optional` dependency of a non-dev + dependency, then `devOptional` will be set. (An `optional` dependency of + a `dev` dependency will have both `dev` and `optional` set.) + +* inBundle: A flag to indicate that the package is a bundled dependency. + +* hasInstallScript: A flag to indicate that the package has a `preinstall`, + `install`, or `postinstall` script. + +* hasShrinkwrap: A flag to indicate that the package has an + `npm-shrinkwrap.json` file. + +* bin, license, engines, dependencies, optionalDependencies: fields from + `package.json` + +#### dependencies + +Legacy data for supporting versions of npm that use `lockfileVersion: 1`. +This is a mapping of package names to dependency objects. Because the +object structure is strictly hierarchical, symbolic link dependencies are +somewhat challenging to represent in some cases. + +npm v7 ignores this section entirely if a `packages` section is present, +but does keep it up to date in order to support switching between npm v6 +and npm v7. + +Dependency objects have the following fields: + +* version: a specifier that varies depending on the nature of the package, + and is usable in fetching a new copy of it. + + * bundled dependencies: Regardless of source, this is a version number + that is purely for informational purposes. + * registry sources: This is a version number. (eg, `1.2.3`) + * git sources: This is a git specifier with resolved committish. (eg, + `git+https://example.com/foo/bar#115311855adb0789a0466714ed48a1499ffea97e`) + * http tarball sources: This is the URL of the tarball. (eg, + `https://example.com/example-1.3.0.tgz`) + * local tarball sources: This is the file URL of the tarball. (eg + `file:///opt/storage/example-1.3.0.tgz`) + * local link sources: This is the file URL of the link. (eg + `file:libs/our-module`) + +* integrity: A `sha512` or `sha1` [Standard Subresource + Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) + string for the artifact that was unpacked in this location. For git + dependencies, this is the commit sha. + +* resolved: For registry sources this is path of the tarball relative to + the registry URL. If the tarball URL isn't on the same server as the + registry URL then this is a complete URL. `registry.npmjs.org` is a magic + value meaning "the currently configured registry". + +* bundled: If true, this is the bundled dependency and will be installed + by the parent module. When installing, this module will be extracted + from the parent module during the extract phase, not installed as a + separate dependency. + +* dev: If true then this dependency is either a development dependency ONLY + of the top level module or a transitive dependency of one. This is false + for dependencies that are both a development dependency of the top level + and a transitive dependency of a non-development dependency of the top + level. + +* optional: If true then this dependency is either an optional dependency + ONLY of the top level module or a transitive dependency of one. This is + false for dependencies that are both an optional dependency of the top + level and a transitive dependency of a non-optional dependency of the top + level. + +* requires: This is a mapping of module name to version. This is a list of + everything this module requires, regardless of where it will be + installed. The version should match via normal matching rules a + dependency either in our `dependencies` or in a level higher than us. + +* dependencies: The dependencies of this dependency, exactly as at the top + level. + +### See also + +* [npm shrinkwrap](/commands/npm-shrinkwrap) +* [npm-shrinkwrap.json](/configuring-npm/npm-shrinkwrap-json) +* [package.json](/configuring-npm/package-json) +* [npm install](/commands/npm-install) diff --git a/node_modules/npm/docs/content/using-npm/config.md b/node_modules/npm/docs/content/using-npm/config.md new file mode 100644 index 00000000..8da0c958 --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/config.md @@ -0,0 +1,2020 @@ +--- +title: config +section: 7 +description: More than you probably want to know about npm configuration +--- + +### Description + +This article details npm configuration in general. To learn about the `config` command, +see [`npm config`](/commands/npm-config). + +npm gets its configuration values from the following sources, sorted by priority: + +#### Command Line Flags + +Putting `--foo bar` on the command line sets the `foo` configuration +parameter to `"bar"`. A `--` argument tells the cli parser to stop +reading flags. Using `--flag` without specifying any value will set +the value to `true`. + +Example: `--flag1 --flag2` will set both configuration parameters +to `true`, while `--flag1 --flag2 bar` will set `flag1` to `true`, +and `flag2` to `bar`. Finally, `--flag1 --flag2 -- bar` will set +both configuration parameters to `true`, and the `bar` is taken +as a command argument. + +#### Environment Variables + +Any environment variables that start with `npm_config_` will be +interpreted as a configuration parameter. For example, putting +`npm_config_foo=bar` in your environment will set the `foo` +configuration parameter to `bar`. Any environment configurations that +are not given a value will be given the value of `true`. Config +values are case-insensitive, so `NPM_CONFIG_FOO=bar` will work the +same. However, please note that inside [`scripts`](/using-npm/scripts) +npm will set its own environment variables and Node will prefer +those lowercase versions over any uppercase ones that you might set. +For details see [this issue](https://github.com/npm/npm/issues/14528). + +Notice that you need to use underscores instead of dashes, so `--allow-same-version` +would become `npm_config_allow_same_version=true`. + +#### npmrc Files + +The four relevant files are: + +* per-project configuration file (`/path/to/my/project/.npmrc`) +* per-user configuration file (defaults to `$HOME/.npmrc`; configurable via CLI + option `--userconfig` or environment variable `$NPM_CONFIG_USERCONFIG`) +* global configuration file (defaults to `$PREFIX/etc/npmrc`; configurable via + CLI option `--globalconfig` or environment variable `$NPM_CONFIG_GLOBALCONFIG`) +* npm's built-in configuration file (`/path/to/npm/npmrc`) + +See [npmrc](/configuring-npm/npmrc) for more details. + +#### Default Configs + +Run `npm config ls -l` to see a set of configuration parameters that are +internal to npm, and are defaults if nothing else is specified. + +### Shorthands and Other CLI Niceties + +The following shorthands are parsed on the command-line: + +* `-a`: `--all` +* `--enjoy-by`: `--before` +* `-c`: `--call` +* `--desc`: `--description` +* `-f`: `--force` +* `-g`: `--global` +* `--iwr`: `--include-workspace-root` +* `-L`: `--location` +* `-d`: `--loglevel info` +* `-s`: `--loglevel silent` +* `--silent`: `--loglevel silent` +* `--ddd`: `--loglevel silly` +* `--dd`: `--loglevel verbose` +* `--verbose`: `--loglevel verbose` +* `-q`: `--loglevel warn` +* `--quiet`: `--loglevel warn` +* `-l`: `--long` +* `-m`: `--message` +* `--local`: `--no-global` +* `-n`: `--no-yes` +* `--no`: `--no-yes` +* `-p`: `--parseable` +* `--porcelain`: `--parseable` +* `-C`: `--prefix` +* `--readonly`: `--read-only` +* `--reg`: `--registry` +* `-S`: `--save` +* `-B`: `--save-bundle` +* `-D`: `--save-dev` +* `-E`: `--save-exact` +* `-O`: `--save-optional` +* `-P`: `--save-prod` +* `-?`: `--usage` +* `-h`: `--usage` +* `-H`: `--usage` +* `--help`: `--usage` +* `-v`: `--version` +* `-w`: `--workspace` +* `--ws`: `--workspaces` +* `-y`: `--yes` + +If the specified configuration param resolves unambiguously to a known +configuration parameter, then it is expanded to that configuration +parameter. For example: + +```bash +npm ls --par +# same as: +npm ls --parseable +``` + +If multiple single-character shorthands are strung together, and the +resulting combination is unambiguously not some other configuration +param, then it is expanded to its various component pieces. For +example: + +```bash +npm ls -gpld +# same as: +npm ls --global --parseable --long --loglevel info +``` + +### Config Settings + +#### `_auth` + +* Default: null +* Type: null or String + +A basic-auth string to use when authenticating against the npm registry. +This will ONLY be used to authenticate against the npm registry. For other +registries you will need to scope it like "//other-registry.tld/:_auth" + +Warning: This should generally not be set via a command-line option. It is +safer to use a registry-provided authentication bearer token stored in the +~/.npmrc file by running `npm login`. + + + +#### `access` + +* Default: 'public' for new packages, existing packages it will not change the + current level +* Type: null, "restricted", or "public" + +If you do not want your scoped package to be publicly viewable (and +installable) set `--access=restricted`. + +Unscoped packages can not be set to `restricted`. + +Note: This defaults to not changing the current access level for existing +packages. Specifying a value of `restricted` or `public` during publish will +change the access for an existing package the same way that `npm access set +status` would. + + + +#### `all` + +* Default: false +* Type: Boolean + +When running `npm outdated` and `npm ls`, setting `--all` will show all +outdated or installed packages, rather than only those directly depended +upon by the current project. + + + +#### `allow-same-version` + +* Default: false +* Type: Boolean + +Prevents throwing an error when `npm version` is used to set the new version +to the same value as the current version. + + + +#### `audit` + +* Default: true +* Type: Boolean + +When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for [`npm audit`](/commands/npm-audit) for details on what is +submitted. + + + +#### `audit-level` + +* Default: null +* Type: null, "info", "low", "moderate", "high", "critical", or "none" + +The minimum level of vulnerability for `npm audit` to exit with a non-zero +exit code. + + + +#### `auth-type` + +* Default: "web" +* Type: "legacy" or "web" + +What authentication strategy to use with `login`. Note that if an `otp` +config is given, this value will always be set to `legacy`. + + + +#### `before` + +* Default: null +* Type: null or Date + +If passed to `npm install`, will rebuild the npm tree such that only +versions that were available **on or before** the `--before` time get +installed. If there's no versions available for the current set of direct +dependencies, the command will error. + +If the requested version is a `dist-tag` and the given tag does not pass the +`--before` filter, the most recent version less than or equal to that tag +will be used. For example, `foo@latest` might install `foo@1.2` even though +`latest` is `2.0`. + + + +#### `bin-links` + +* Default: true +* Type: Boolean + +Tells npm to create symlinks (or `.cmd` shims on Windows) for package +executables. + +Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems. + + + +#### `browser` + +* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"` +* Type: null, Boolean, or String + +The browser that is called by npm commands to open websites. + +Set to `false` to suppress browser behavior and instead print urls to +terminal. + +Set to `true` to use default system URL opener. + + + +#### `ca` + +* Default: null +* Type: null or String (can be set multiple times) + +The Certificate Authority signing certificate that is trusted for SSL +connections to the registry. Values should be in PEM format (Windows calls +it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string +"\n". For example: + +```ini +ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----" +``` + +Set to `null` to only allow "known" registrars, or to a specific CA cert to +trust only that specific signing authority. + +Multiple CAs can be trusted by specifying an array of certificates: + +```ini +ca[]="..." +ca[]="..." +``` + +See also the `strict-ssl` config. + + + +#### `cache` + +* Default: Windows: `%LocalAppData%\npm-cache`, Posix: `~/.npm` +* Type: Path + +The location of npm's cache directory. + + + +#### `cafile` + +* Default: null +* Type: Path + +A path to a file containing one or multiple Certificate Authority signing +certificates. Similar to the `ca` setting, but allows for multiple CA's, as +well as for the CA information to be stored in a file on disk. + + + +#### `call` + +* Default: "" +* Type: String + +Optional companion option for `npm exec`, `npx` that allows for specifying a +custom command to be run along with the installed packages. + +```bash +npm exec --package yo --package generator-node --call "yo node" +``` + + + +#### `cidr` + +* Default: null +* Type: null or String (can be set multiple times) + +This is a list of CIDR address to be used when configuring limited access +tokens with the `npm token create` command. + + + +#### `color` + +* Default: true unless the NO_COLOR environ is set to something other than '0' +* Type: "always" or Boolean + +If false, never shows colors. If `"always"` then always shows colors. If +true, then only prints color codes for tty file descriptors. + + + +#### `commit-hooks` + +* Default: true +* Type: Boolean + +Run git commit hooks when using the `npm version` command. + + + +#### `cpu` + +* Default: null +* Type: null or String + +Override CPU architecture of native modules to install. Acceptable values +are same as `cpu` field of package.json, which comes from `process.arch`. + + + +#### `depth` + +* Default: `Infinity` if `--all` is set, otherwise `1` +* Type: null or Number + +The depth to go when recursing packages for `npm ls`. + +If not set, `npm ls` will show only the immediate dependencies of the root +project. If `--all` is set, then npm will show all dependencies by default. + + + +#### `description` + +* Default: true +* Type: Boolean + +Show the description in `npm search` + + + +#### `diff` + +* Default: +* Type: String (can be set multiple times) + +Define arguments to compare in `npm diff`. + + + +#### `diff-dst-prefix` + +* Default: "b/" +* Type: String + +Destination prefix to be used in `npm diff` output. + + + +#### `diff-ignore-all-space` + +* Default: false +* Type: Boolean + +Ignore whitespace when comparing lines in `npm diff`. + + + +#### `diff-name-only` + +* Default: false +* Type: Boolean + +Prints only filenames when using `npm diff`. + + + +#### `diff-no-prefix` + +* Default: false +* Type: Boolean + +Do not show any source or destination prefix in `npm diff` output. + +Note: this causes `npm diff` to ignore the `--diff-src-prefix` and +`--diff-dst-prefix` configs. + + + +#### `diff-src-prefix` + +* Default: "a/" +* Type: String + +Source prefix to be used in `npm diff` output. + + + +#### `diff-text` + +* Default: false +* Type: Boolean + +Treat all files as text in `npm diff`. + + + +#### `diff-unified` + +* Default: 3 +* Type: Number + +The number of lines of context to print in `npm diff`. + + + +#### `dry-run` + +* Default: false +* Type: Boolean + +Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, `install`, `update`, +`dedupe`, `uninstall`, as well as `pack` and `publish`. + +Note: This is NOT honored by other network related commands, eg `dist-tags`, +`owner`, etc. + + + +#### `editor` + +* Default: The EDITOR or VISUAL environment variables, or + '%SYSTEMROOT%\notepad.exe' on Windows, or 'vi' on Unix systems +* Type: String + +The command to run for `npm edit` and `npm config edit`. + + + +#### `engine-strict` + +* Default: false +* Type: Boolean + +If set to true, then npm will stubbornly refuse to install (or even consider +installing) any package that claims to not be compatible with the current +Node.js version. + +This can be overridden by setting the `--force` flag. + + + +#### `expect-result-count` + +* Default: null +* Type: null or Number + +Tells to expect a specific number of results from the command. + +This config can not be used with: `expect-results` + +#### `expect-results` + +* Default: null +* Type: null or Boolean + +Tells npm whether or not to expect results from the command. Can be either +true (expect some results) or false (expect no results). + +This config can not be used with: `expect-result-count` + +#### `fetch-retries` + +* Default: 2 +* Type: Number + +The "retries" config for the `retry` module to use when fetching packages +from the registry. + +npm will retry idempotent read requests to the registry in the case of +network failures or 5xx HTTP errors. + + + +#### `fetch-retry-factor` + +* Default: 10 +* Type: Number + +The "factor" config for the `retry` module to use when fetching packages. + + + +#### `fetch-retry-maxtimeout` + +* Default: 60000 (1 minute) +* Type: Number + +The "maxTimeout" config for the `retry` module to use when fetching +packages. + + + +#### `fetch-retry-mintimeout` + +* Default: 10000 (10 seconds) +* Type: Number + +The "minTimeout" config for the `retry` module to use when fetching +packages. + + + +#### `fetch-timeout` + +* Default: 300000 (5 minutes) +* Type: Number + +The maximum amount of time to wait for HTTP requests to complete. + + + +#### `force` + +* Default: false +* Type: Boolean + +Removes various protections against unfortunate side effects, common +mistakes, unnecessary performance degradation, and malicious input. + +* Allow clobbering non-npm files in global installs. +* Allow the `npm version` command to work on an unclean git repository. +* Allow deleting the cache folder with `npm cache clean`. +* Allow installing packages that have an `engines` declaration requiring a + different version of npm. +* Allow installing packages that have an `engines` declaration requiring a + different version of `node`, even if `--engine-strict` is enabled. +* Allow `npm audit fix` to install modules outside your stated dependency + range (including SemVer-major changes). +* Allow unpublishing all versions of a published package. +* Allow conflicting peerDependencies to be installed in the root project. +* Implicitly set `--yes` during `npm init`. +* Allow clobbering existing values in `npm pkg` +* Allow unpublishing of entire packages (not just a single version). + +If you don't have a clear idea of what you want to do, it is strongly +recommended that you do not use this option! + + + +#### `foreground-scripts` + +* Default: `false` unless when using `npm pack` or `npm publish` where it + defaults to `true` +* Type: Boolean + +Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process. + +Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging. + + + +#### `format-package-lock` + +* Default: true +* Type: Boolean + +Format `package-lock.json` or `npm-shrinkwrap.json` as a human readable +file. + + + +#### `fund` + +* Default: true +* Type: Boolean + +When "true" displays the message at the end of each `npm install` +acknowledging the number of dependencies looking for funding. See [`npm +fund`](/commands/npm-fund) for details. + + + +#### `git` + +* Default: "git" +* Type: String + +The command to use for git commands. If git is installed on the computer, +but is not in the `PATH`, then set this to the full path to the git binary. + + + +#### `git-tag-version` + +* Default: true +* Type: Boolean + +Tag the commit when using the `npm version` command. Setting this to false +results in no commit being made at all. + + + +#### `global` + +* Default: false +* Type: Boolean + +Operates in "global" mode, so that packages are installed into the `prefix` +folder instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `globalconfig` + +* Default: The global --prefix setting plus 'etc/npmrc'. For example, + '/usr/local/etc/npmrc' +* Type: Path + +The config file to read for global config options. + + + +#### `heading` + +* Default: "npm" +* Type: String + +The string that starts all the debugging log output. + + + +#### `https-proxy` + +* Default: null +* Type: null or URL + +A proxy to use for outgoing https requests. If the `HTTPS_PROXY` or +`https_proxy` or `HTTP_PROXY` or `http_proxy` environment variables are set, +proxy settings will be honored by the underlying `make-fetch-happen` +library. + + + +#### `if-present` + +* Default: false +* Type: Boolean + +If true, npm will not exit with an error code when `run-script` is invoked +for a script that isn't defined in the `scripts` section of `package.json`. +This option can be used when it's desirable to optionally run a script when +it's present and fail if the script fails. This is useful, for example, when +running scripts that may only apply for some builds in an otherwise generic +CI setup. + +This value is not exported to the environment for child processes. + +#### `ignore-scripts` + +* Default: false +* Type: Boolean + +If true, npm does not run scripts specified in package.json files. + +Note that commands explicitly intended to run a particular script, such as +`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` +will still run their intended script if `ignore-scripts` is set, but they +will *not* run any pre- or post-scripts. + + + +#### `include` + +* Default: +* Type: "prod", "dev", "optional", or "peer" (can be set multiple times) + +Option that allows for defining which types of dependencies to install. + +This is the inverse of `--omit=`. + +Dependency types specified in `--include` will not be omitted, regardless of +the order in which omit/include are specified on the command-line. + + + +#### `include-staged` + +* Default: false +* Type: Boolean + +Allow installing "staged" published packages, as defined by [npm RFC PR +#92](https://github.com/npm/rfcs/pull/92). + +This is experimental, and not implemented by the npm public registry. + + + +#### `include-workspace-root` + +* Default: false +* Type: Boolean + +Include the workspace root when workspaces are enabled for a command. + +When false, specifying individual workspaces via the `workspace` config, or +all workspaces via the `workspaces` flag, will cause npm to operate only on +the specified workspaces, and not on the root project. + +This value is not exported to the environment for child processes. + +#### `init-author-email` + +* Default: "" +* Type: String + +The value `npm init` should use by default for the package author's email. + + + +#### `init-author-name` + +* Default: "" +* Type: String + +The value `npm init` should use by default for the package author's name. + + + +#### `init-author-url` + +* Default: "" +* Type: "" or URL + +The value `npm init` should use by default for the package author's +homepage. + + + +#### `init-license` + +* Default: "ISC" +* Type: String + +The value `npm init` should use by default for the package license. + + + +#### `init-module` + +* Default: "~/.npm-init.js" +* Type: Path + +A module that will be loaded by the `npm init` command. See the +documentation for the +[init-package-json](https://github.com/npm/init-package-json) module for +more information, or [npm init](/commands/npm-init). + + + +#### `init-version` + +* Default: "1.0.0" +* Type: SemVer string + +The value that `npm init` should use by default for the package version +number, if not already set in package.json. + + + +#### `install-links` + +* Default: false +* Type: Boolean + +When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces. + + + +#### `install-strategy` + +* Default: "hoisted" +* Type: "hoisted", "nested", "shallow", or "linked" + +Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted. + + + +#### `json` + +* Default: false +* Type: Boolean + +Whether or not to output JSON data, rather than the normal output. + +* In `npm pkg set` it enables parsing set values with JSON.parse() before + saving them to your `package.json`. + +Not supported by all npm commands. + + + +#### `legacy-peer-deps` + +* Default: false +* Type: Boolean + +Causes npm to completely ignore `peerDependencies` when building a package +tree, as in npm versions 3 through 6. + +If a package cannot be installed because of overly strict `peerDependencies` +that collide, it provides a way to move forward resolving the situation. + +This differs from `--omit=peer`, in that `--omit=peer` will avoid unpacking +`peerDependencies` on disk, but will still design a tree such that +`peerDependencies` _could_ be unpacked in a correct place. + +Use of `legacy-peer-deps` is not recommended, as it will not enforce the +`peerDependencies` contract that meta-dependencies may rely on. + + + +#### `libc` + +* Default: null +* Type: null or String + +Override libc of native modules to install. Acceptable values are same as +`libc` field of package.json + + + +#### `link` + +* Default: false +* Type: Boolean + +Used with `npm ls`, limiting output to only those packages that are linked. + + + +#### `local-address` + +* Default: null +* Type: IP Address + +The IP address of the local interface to use when making connections to the +npm registry. Must be IPv4 in versions of Node prior to 0.12. + + + +#### `location` + +* Default: "user" unless `--global` is passed, which will also set this value + to "global" +* Type: "global", "user", or "project" + +When passed to `npm config` this refers to which config file to use. + +When set to "global" mode, packages are installed into the `prefix` folder +instead of the current working directory. See +[folders](/configuring-npm/folders) for more on the differences in behavior. + +* packages are installed into the `{prefix}/lib/node_modules` folder, instead + of the current working directory. +* bin files are linked to `{prefix}/bin` +* man pages are linked to `{prefix}/share/man` + + + +#### `lockfile-version` + +* Default: Version 3 if no lockfile, auto-converting v1 lockfiles to v3, + otherwise maintain current lockfile version. +* Type: null, 1, 2, 3, "1", "2", or "3" + +Set the lockfile format version to be used in package-lock.json and +npm-shrinkwrap-json files. Possible options are: + +1: The lockfile version used by npm versions 5 and 6. Lacks some data that +is used during the install, resulting in slower and possibly less +deterministic installs. Prevents lockfile churn when interoperating with +older npm versions. + +2: The default lockfile version used by npm version 7 and 8. Includes both +the version 1 lockfile data and version 3 lockfile data, for maximum +determinism and interoperability, at the expense of more bytes on disk. + +3: Only the new lockfile information introduced in npm version 7. Smaller on +disk than lockfile version 2, but not interoperable with older npm versions. +Ideal if all users are on npm version 7 and higher. + + + +#### `loglevel` + +* Default: "notice" +* Type: "silent", "error", "warn", "notice", "http", "info", "verbose", or + "silly" + +What level of logs to report. All logs are written to a debug log, with the +path to that file printed if the execution of a command fails. + +Any logs of a higher level than the setting are shown. The default is +"notice". + +See also the `foreground-scripts` config. + + + +#### `logs-dir` + +* Default: A directory named `_logs` inside the cache +* Type: null or Path + +The location of npm's log directory. See [`npm logging`](/using-npm/logging) +for more information. + + + +#### `logs-max` + +* Default: 10 +* Type: Number + +The maximum number of log files to store. + +If set to 0, no log files will be written for the current run. + + + +#### `long` + +* Default: false +* Type: Boolean + +Show extended information in `ls`, `search`, and `help-search`. + + + +#### `maxsockets` + +* Default: 15 +* Type: Number + +The maximum number of connections to use per origin (protocol/host/port +combination). + + + +#### `message` + +* Default: "%s" +* Type: String + +Commit message which is used by `npm version` when creating version commit. + +Any "%s" in the message will be replaced with the version number. + + + +#### `node-options` + +* Default: null +* Type: null or String + +Options to pass through to Node.js via the `NODE_OPTIONS` environment +variable. This does not impact how npm itself is executed but it does impact +how lifecycle scripts are called. + + + +#### `noproxy` + +* Default: The value of the NO_PROXY environment variable +* Type: String (can be set multiple times) + +Domain extensions that should bypass any proxies. + +Also accepts a comma-delimited string. + + + +#### `offline` + +* Default: false +* Type: Boolean + +Force offline mode: no network requests will be done during install. To +allow the CLI to fill in missing cache data, see `--prefer-offline`. + + + +#### `omit` + +* Default: 'dev' if the `NODE_ENV` environment variable is set to + 'production', otherwise empty. +* Type: "dev", "optional", or "peer" (can be set multiple times) + +Dependency types to omit from the installation tree on disk. + +Note that these dependencies _are_ still resolved and added to the +`package-lock.json` or `npm-shrinkwrap.json` file. They are just not +physically installed on disk. + +If a package type appears in both the `--include` and `--omit` lists, then +it will be included. + +If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment +variable will be set to `'production'` for all lifecycle scripts. + + + +#### `omit-lockfile-registry-resolved` + +* Default: false +* Type: Boolean + +This option causes npm to create lock files without a `resolved` key for +registry dependencies. Subsequent installs will need to resolve tarball +endpoints with the configured registry, likely resulting in a longer install +time. + + + +#### `os` + +* Default: null +* Type: null or String + +Override OS of native modules to install. Acceptable values are same as `os` +field of package.json, which comes from `process.platform`. + + + +#### `otp` + +* Default: null +* Type: null or String + +This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with `npm access`. + +If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one. + + + +#### `pack-destination` + +* Default: "." +* Type: String + +Directory in which `npm pack` will save tarballs. + + + +#### `package` + +* Default: +* Type: String (can be set multiple times) + +The package or packages to install for [`npm exec`](/commands/npm-exec) + + + +#### `package-lock` + +* Default: true +* Type: Boolean + +If set to false, then ignore `package-lock.json` files when installing. This +will also prevent _writing_ `package-lock.json` if `save` is true. + + + +#### `package-lock-only` + +* Default: false +* Type: Boolean + +If set to true, the current operation will only use the `package-lock.json`, +ignoring `node_modules`. + +For `update` this means only the `package-lock.json` will be updated, +instead of checking `node_modules` and downloading dependencies. + +For `list` this means the output will be based on the tree described by the +`package-lock.json`, rather than the contents of `node_modules`. + + + +#### `parseable` + +* Default: false +* Type: Boolean + +Output parseable results from commands that write to standard output. For +`npm search`, this will be tab-separated table format. + + + +#### `prefer-dedupe` + +* Default: false +* Type: Boolean + +Prefer to deduplicate packages if possible, rather than choosing a newer +version of a dependency. + + + +#### `prefer-offline` + +* Default: false +* Type: Boolean + +If true, staleness checks for cached data will be bypassed, but missing data +will be requested from the server. To force full offline mode, use +`--offline`. + + + +#### `prefer-online` + +* Default: false +* Type: Boolean + +If true, staleness checks for cached data will be forced, making the CLI +look for updates immediately even for fresh package data. + + + +#### `prefix` + +* Default: In global mode, the folder where the node executable is installed. + Otherwise, the nearest parent folder containing either a package.json file + or a node_modules folder. +* Type: Path + +The location to install global items. If set on the command line, then it +forces non-global commands to run in the specified folder. + + + +#### `preid` + +* Default: "" +* Type: String + +The "prerelease identifier" to use as a prefix for the "prerelease" part of +a semver. Like the `rc` in `1.2.0-rc.8`. + + + +#### `progress` + +* Default: `true` unless running in a known CI system +* Type: Boolean + +When set to `true`, npm will display a progress bar during time intensive +operations, if `process.stderr` and `process.stdout` are a TTY. + +Set to `false` to suppress the progress bar. + + + +#### `provenance` + +* Default: false +* Type: Boolean + +When publishing from a supported cloud CI/CD system, the package will be +publicly linked to where it was built and published from. + +This config can not be used with: `provenance-file` + +#### `provenance-file` + +* Default: null +* Type: Path + +When publishing, the provenance bundle at the given path will be used. + +This config can not be used with: `provenance` + +#### `proxy` + +* Default: null +* Type: null, false, or URL + +A proxy to use for outgoing http requests. If the `HTTP_PROXY` or +`http_proxy` environment variables are set, proxy settings will be honored +by the underlying `request` library. + + + +#### `read-only` + +* Default: false +* Type: Boolean + +This is used to mark a token as unable to publish when configuring limited +access tokens with the `npm token create` command. + + + +#### `rebuild-bundle` + +* Default: true +* Type: Boolean + +Rebuild bundled dependencies after installation. + + + +#### `registry` + +* Default: "https://registry.npmjs.org/" +* Type: URL + +The base URL of the npm registry. + + + +#### `replace-registry-host` + +* Default: "npmjs" +* Type: "npmjs", "never", "always", or String + +Defines behavior for replacing the registry host in a lockfile with the +configured registry. + +The default behavior is to replace package dist URLs from the default +registry (https://registry.npmjs.org) to the configured registry. If set to +"never", then use the registry value. If set to "always", then replace the +registry host with the configured host every time. + +You may also specify a bare hostname (e.g., "registry.npmjs.org"). + + + +#### `save` + +* Default: `true` unless when using `npm update` where it defaults to `false` +* Type: Boolean + +Save installed packages to a `package.json` file as dependencies. + +When used with the `npm rm` command, removes the dependency from +`package.json`. + +Will also prevent writing to `package-lock.json` if set to `false`. + + + +#### `save-bundle` + +* Default: false +* Type: Boolean + +If a package would be saved at install time by the use of `--save`, +`--save-dev`, or `--save-optional`, then also put it in the +`bundleDependencies` list. + +Ignored if `--save-peer` is set, since peerDependencies cannot be bundled. + + + +#### `save-dev` + +* Default: false +* Type: Boolean + +Save installed packages to a package.json file as `devDependencies`. + + + +#### `save-exact` + +* Default: false +* Type: Boolean + +Dependencies saved to package.json will be configured with an exact version +rather than using npm's default semver range operator. + + + +#### `save-optional` + +* Default: false +* Type: Boolean + +Save installed packages to a package.json file as `optionalDependencies`. + + + +#### `save-peer` + +* Default: false +* Type: Boolean + +Save installed packages to a package.json file as `peerDependencies` + + + +#### `save-prefix` + +* Default: "^" +* Type: String + +Configure how versions of packages installed to a package.json file via +`--save` or `--save-dev` get prefixed. + +For example if a package has version `1.2.3`, by default its version is set +to `^1.2.3` which allows minor upgrades for that package, but after `npm +config set save-prefix='~'` it would be set to `~1.2.3` which only allows +patch upgrades. + + + +#### `save-prod` + +* Default: false +* Type: Boolean + +Save installed packages into `dependencies` specifically. This is useful if +a package already exists in `devDependencies` or `optionalDependencies`, but +you want to move it to be a non-optional production dependency. + +This is the default behavior if `--save` is true, and neither `--save-dev` +or `--save-optional` are true. + + + +#### `sbom-format` + +* Default: null +* Type: "cyclonedx" or "spdx" + +SBOM format to use when generating SBOMs. + + + +#### `sbom-type` + +* Default: "library" +* Type: "library", "application", or "framework" + +The type of package described by the generated SBOM. For SPDX, this is the +value for the `primaryPackagePurpose` field. For CycloneDX, this is the +value for the `type` field. + + + +#### `scope` + +* Default: the scope of the current project, if any, or "" +* Type: String + +Associate an operation with a scope for a scoped registry. + +Useful when logging in to or out of a private registry: + +``` +# log in, linking the scope to the custom registry +npm login --scope=@mycorp --registry=https://registry.mycorp.com + +# log out, removing the link and the auth token +npm logout --scope=@mycorp +``` + +This will cause `@mycorp` to be mapped to the registry for future +installation of packages specified according to the pattern +`@mycorp/package`. + +This will also cause `npm init` to create a scoped package. + +``` +# accept all defaults, and create a package named "@foo/whatever", +# instead of just named "whatever" +npm init --scope=@foo --yes +``` + + + +#### `script-shell` + +* Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +* Type: null or String + +The shell to use for scripts run with the `npm exec`, `npm run` and `npm +init ` commands. + + + +#### `searchexclude` + +* Default: "" +* Type: String + +Space-separated options that limit the results from search. + + + +#### `searchlimit` + +* Default: 20 +* Type: Number + +Number of items to limit search results to. Will not apply at all to legacy +searches. + + + +#### `searchopts` + +* Default: "" +* Type: String + +Space-separated options that are always passed to search. + + + +#### `searchstaleness` + +* Default: 900 +* Type: Number + +The age of the cache, in seconds, before another registry request is made if +using legacy search endpoint. + + + +#### `shell` + +* Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on + Windows +* Type: String + +The shell to run for the `npm explore` command. + + + +#### `sign-git-commit` + +* Default: false +* Type: Boolean + +If set to true, then the `npm version` command will commit the new package +version using `-S` to add a signature. + +Note that git requires you to have set up GPG keys in your git configs for +this to work properly. + + + +#### `sign-git-tag` + +* Default: false +* Type: Boolean + +If set to true, then the `npm version` command will tag the version using +`-s` to add a signature. + +Note that git requires you to have set up GPG keys in your git configs for +this to work properly. + + + +#### `strict-peer-deps` + +* Default: false +* Type: Boolean + +If set to `true`, and `--legacy-peer-deps` is not set, then _any_ +conflicting `peerDependencies` will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships. + +By default, conflicting `peerDependencies` deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's `peerDependencies` object. + +When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If `--strict-peer-deps` is set, then +this warning is treated as a failure. + + + +#### `strict-ssl` + +* Default: true +* Type: Boolean + +Whether or not to do SSL key validation when making requests to the registry +via https. + +See also the `ca` config. + + + +#### `tag` + +* Default: "latest" +* Type: String + +If you ask npm to install a package and don't tell it a specific version, +then it will install the specified tag. + +It is the tag added to the package@version specified in the `npm dist-tag +add` command, if no explicit tag is given. + +When used by the `npm diff` command, this is the tag used to fetch the +tarball that will be compared with the local files by default. + +If used in the `npm publish` command, this is the tag that will be added to +the package submitted to the registry. + + + +#### `tag-version-prefix` + +* Default: "v" +* Type: String + +If set, alters the prefix used when tagging a new version when performing a +version increment using `npm version`. To remove the prefix altogether, set +it to the empty string: `""`. + +Because other tools may rely on the convention that npm version tags look +like `v1.0.0`, _only use this property if it is absolutely necessary_. In +particular, use care when overriding this setting for public packages. + + + +#### `timing` + +* Default: false +* Type: Boolean + +If true, writes timing information to a process specific json file in the +cache or `logs-dir`. The file name ends with `-timing.json`. + +You can quickly view it with this [json](https://npm.im/json) command line: +`cat ~/.npm/_logs/*-timing.json | npm exec -- json -g`. + +Timing information will also be reported in the terminal. To suppress this +while still writing the timing file, use `--silent`. + + + +#### `umask` + +* Default: 0 +* Type: Octal numeric string in range 0000..0777 (0..511) + +The "umask" value to use when setting the file creation mode on files and +folders. + +Folders and executables are given a mode which is `0o777` masked against +this value. Other files are given a mode which is `0o666` masked against +this value. + +Note that the underlying system will _also_ apply its own umask value to +files and folders that are created, and npm does not circumvent this, but +rather adds the `--umask` config to it. + +Thus, the effective default umask value on most POSIX systems is 0o22, +meaning that folders and executables are created with a mode of 0o755 and +other files are created with a mode of 0o644. + + + +#### `unicode` + +* Default: false on windows, true on mac/unix systems with a unicode locale, + as defined by the `LC_ALL`, `LC_CTYPE`, or `LANG` environment variables. +* Type: Boolean + +When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters instead of unicode glyphs. + + + +#### `update-notifier` + +* Default: true +* Type: Boolean + +Set to false to suppress the update notification when using an older version +of npm than the latest. + + + +#### `usage` + +* Default: false +* Type: Boolean + +Show short usage output about the command specified. + + + +#### `user-agent` + +* Default: "npm/{npm-version} node/{node-version} {platform} {arch} + workspaces/{workspaces} {ci}" +* Type: String + +Sets the User-Agent request header. The following fields are replaced with +their actual counterparts: + +* `{npm-version}` - The npm version in use +* `{node-version}` - The Node.js version in use +* `{platform}` - The value of `process.platform` +* `{arch}` - The value of `process.arch` +* `{workspaces}` - Set to `true` if the `workspaces` or `workspace` options + are set. +* `{ci}` - The value of the `ci-name` config, if set, prefixed with `ci/`, or + an empty string if `ci-name` is empty. + + + +#### `userconfig` + +* Default: "~/.npmrc" +* Type: Path + +The location of user-level configuration settings. + +This may be overridden by the `npm_config_userconfig` environment variable +or the `--userconfig` command line option, but may _not_ be overridden by +settings in the `globalconfig` file. + + + +#### `version` + +* Default: false +* Type: Boolean + +If true, output the npm version and exit successfully. + +Only relevant when specified explicitly on the command line. + + + +#### `versions` + +* Default: false +* Type: Boolean + +If true, output the npm version as well as node's `process.versions` map and +the version in the current working directory's `package.json` file if one +exists, and exit successfully. + +Only relevant when specified explicitly on the command line. + + + +#### `viewer` + +* Default: "man" on Posix, "browser" on Windows +* Type: String + +The program to use to view help content. + +Set to `"browser"` to view html help content in the default web browser. + + + +#### `which` + +* Default: null +* Type: null or Number + +If there are multiple funding sources, which 1-indexed source URL to open. + + + +#### `workspace` + +* Default: +* Type: String (can be set multiple times) + +Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option. + +Valid values for the `workspace` config are either: + +* Workspace names +* Path to a workspace directory +* Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + +When set for the `npm init` command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project. + +This value is not exported to the environment for child processes. + +#### `workspaces` + +* Default: null +* Type: null or Boolean + +Set to true to run the command in the context of **all** configured +workspaces. + +Explicitly setting this to false will cause commands like `install` to +ignore workspaces altogether. When not set explicitly: + +- Commands that operate on the `node_modules` tree (install, update, etc.) +will link workspaces into the `node_modules` folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +_unless_ one or more workspaces are specified in the `workspace` config. + +This value is not exported to the environment for child processes. + +#### `workspaces-update` + +* Default: true +* Type: Boolean + +If set to true, the npm cli will run an update after operations that may +possibly change the workspaces installed to the `node_modules` folder. + + + +#### `yes` + +* Default: null +* Type: null or Boolean + +Automatically answer "yes" to any prompts that npm might print on the +command line. + + + +#### `also` + +* Default: null +* Type: null, "dev", or "development" +* DEPRECATED: Please use --include=dev instead. + +When set to `dev` or `development`, this is an alias for `--include=dev`. + + + +#### `cache-max` + +* Default: Infinity +* Type: Number +* DEPRECATED: This option has been deprecated in favor of `--prefer-online` + +`--cache-max=0` is an alias for `--prefer-online` + + + +#### `cache-min` + +* Default: 0 +* Type: Number +* DEPRECATED: This option has been deprecated in favor of `--prefer-offline`. + +`--cache-min=9999 (or bigger)` is an alias for `--prefer-offline`. + + + +#### `cert` + +* Default: null +* Type: null or String +* DEPRECATED: `key` and `cert` are no longer used for most registry + operations. Use registry scoped `keyfile` and `cafile` instead. Example: + //other-registry.tld/:keyfile=/path/to/key.pem + //other-registry.tld/:cafile=/path/to/cert.crt + +A client certificate to pass when accessing the registry. Values should be +in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with +newlines replaced by the string "\n". For example: + +```ini +cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----" +``` + +It is _not_ the path to a certificate file, though you can set a +registry-scoped "cafile" path like +"//other-registry.tld/:cafile=/path/to/cert.pem". + + + +#### `dev` + +* Default: false +* Type: Boolean +* DEPRECATED: Please use --include=dev instead. + +Alias for `--include=dev`. + + + +#### `global-style` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=shallow` + +Only install direct dependencies in the top level `node_modules`, but hoist +on deeper dependencies. Sets `--install-strategy=shallow`. + + + +#### `init.author.email` + +* Default: "" +* Type: String +* DEPRECATED: Use `--init-author-email` instead. + +Alias for `--init-author-email` + + + +#### `init.author.name` + +* Default: "" +* Type: String +* DEPRECATED: Use `--init-author-name` instead. + +Alias for `--init-author-name` + + + +#### `init.author.url` + +* Default: "" +* Type: "" or URL +* DEPRECATED: Use `--init-author-url` instead. + +Alias for `--init-author-url` + + + +#### `init.license` + +* Default: "ISC" +* Type: String +* DEPRECATED: Use `--init-license` instead. + +Alias for `--init-license` + + + +#### `init.module` + +* Default: "~/.npm-init.js" +* Type: Path +* DEPRECATED: Use `--init-module` instead. + +Alias for `--init-module` + + + +#### `init.version` + +* Default: "1.0.0" +* Type: SemVer string +* DEPRECATED: Use `--init-version` instead. + +Alias for `--init-version` + + + +#### `key` + +* Default: null +* Type: null or String +* DEPRECATED: `key` and `cert` are no longer used for most registry + operations. Use registry scoped `keyfile` and `cafile` instead. Example: + //other-registry.tld/:keyfile=/path/to/key.pem + //other-registry.tld/:cafile=/path/to/cert.crt + +A client key to pass when accessing the registry. Values should be in PEM +format with newlines replaced by the string "\n". For example: + +```ini +key="-----BEGIN PRIVATE KEY-----\nXXXX\nXXXX\n-----END PRIVATE KEY-----" +``` + +It is _not_ the path to a key file, though you can set a registry-scoped +"keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem". + + + +#### `legacy-bundling` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + `--install-strategy=nested` + +Instead of hoisting package installs in `node_modules`, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets `--install-strategy=nested`. + + + +#### `only` + +* Default: null +* Type: null, "prod", or "production" +* DEPRECATED: Use `--omit=dev` to omit dev dependencies from the install. + +When set to `prod` or `production`, this is an alias for `--omit=dev`. + + + +#### `optional` + +* Default: null +* Type: null or Boolean +* DEPRECATED: Use `--omit=optional` to exclude optional dependencies, or + `--include=optional` to include them. + +Default value does install optional deps unless otherwise omitted. + +Alias for --include=optional or --omit=optional + + + +#### `production` + +* Default: null +* Type: null or Boolean +* DEPRECATED: Use `--omit=dev` instead. + +Alias for `--omit=dev` + + + +#### `shrinkwrap` + +* Default: true +* Type: Boolean +* DEPRECATED: Use the --package-lock setting instead. + +Alias for --package-lock + + + +### See also + +* [npm config](/commands/npm-config) +* [npmrc](/configuring-npm/npmrc) +* [npm scripts](/using-npm/scripts) +* [npm folders](/configuring-npm/folders) +* [npm](/commands/npm) diff --git a/node_modules/npm/docs/content/using-npm/dependency-selectors.md b/node_modules/npm/docs/content/using-npm/dependency-selectors.md new file mode 100644 index 00000000..5f7e27ad --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/dependency-selectors.md @@ -0,0 +1,223 @@ +--- +title: Dependency Selector Syntax & Querying +section: 7 +description: Dependency Selector Syntax & Querying +--- + +### Description + +The [`npm query`](/commands/npm-query) command exposes a new dependency selector syntax (informed by & respecting many aspects of the [CSS Selectors 4 Spec](https://dev.w3.org/csswg/selectors4/#relational)) which: + +- Standardizes the shape of, & querying of, dependency graphs with a robust object model, metadata & selector syntax +- Leverages existing, known language syntax & operators from CSS to make disparate package information broadly accessible +- Unlocks the ability to answer complex, multi-faceted questions about dependencies, their relationships & associative metadata +- Consolidates redundant logic of similar query commands in `npm` (ex. `npm fund`, `npm ls`, `npm outdated`, `npm audit` ...) + +### Dependency Selector Syntax + +#### Overview: + +- there is no "type" or "tag" selectors (ex. `div, h1, a`) as a dependency/target is the only type of `Node` that can be queried +- the term "dependencies" is in reference to any `Node` found in a `tree` returned by `Arborist` + +#### Combinators + +- `>` direct descendant/child +- ` ` any descendant/child +- `~` sibling + +#### Selectors + +- `*` universal selector +- `#` dependency selector (equivalent to `[name="..."]`) +- `#@` (equivalent to `[name=]:semver()`) +- `,` selector list delimiter +- `.` dependency type selector +- `:` pseudo selector + +#### Dependency Type Selectors + +- `.prod` dependency found in the `dependencies` section of `package.json`, or is a child of said dependency +- `.dev` dependency found in the `devDependencies` section of `package.json`, or is a child of said dependency +- `.optional` dependency found in the `optionalDependencies` section of `package.json`, or has `"optional": true` set in its entry in the `peerDependenciesMeta` section of `package.json`, or a child of said dependency +- `.peer` dependency found in the `peerDependencies` section of `package.json` +- `.workspace` dependency found in the [`workspaces`](https://docs.npmjs.com/cli/v8/using-npm/workspaces) section of `package.json` +- `.bundled` dependency found in the `bundleDependencies` section of `package.json`, or is a child of said dependency + +#### Pseudo Selectors +- [`:not()`](https://developer.mozilla.org/en-US/docs/Web/CSS/:not) +- [`:has()`](https://developer.mozilla.org/en-US/docs/Web/CSS/:has) +- [`:is()`](https://developer.mozilla.org/en-US/docs/Web/CSS/:is) +- [`:root`](https://developer.mozilla.org/en-US/docs/Web/CSS/:root) matches the root node/dependency +- [`:scope`](https://developer.mozilla.org/en-US/docs/Web/CSS/:scope) matches node/dependency it was queried against +- [`:empty`](https://developer.mozilla.org/en-US/docs/Web/CSS/:empty) when a dependency has no dependencies +- [`:private`](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#private) when a dependency is private +- `:link` when a dependency is linked (for instance, workspaces or packages manually [`linked`](https://docs.npmjs.com/cli/v8/commands/npm-link) +- `:deduped` when a dependency has been deduped (note that this does *not* always mean the dependency has been hoisted to the root of node_modules) +- `:overridden` when a dependency has been overridden +- `:extraneous` when a dependency exists but is not defined as a dependency of any node +- `:invalid` when a dependency version is out of its ancestors specified range +- `:missing` when a dependency is not found on disk +- `:semver(, [selector], [function])` match a valid [`node-semver`](https://github.com/npm/node-semver) version or range to a selector +- `:path()` [glob](https://www.npmjs.com/package/glob) matching based on dependencies path relative to the project +- `:type()` [based on currently recognized types](https://github.com/npm/npm-package-arg#result-object) +- `:outdated()` when a dependency is outdated +- `:vuln()` when a dependency has a known vulnerability + +##### `:semver(, [selector], [function])` + +The `:semver()` pseudo selector allows comparing fields from each node's `package.json` using [semver](https://github.com/npm/node-semver#readme) methods. It accepts up to 3 parameters, all but the first of which are optional. + +- `spec` a semver version or range +- `selector` an attribute selector for each node (default `[version]`) +- `function` a semver method to apply, one of: `satisfies`, `intersects`, `subset`, `gt`, `gte`, `gtr`, `lt`, `lte`, `ltr`, `eq`, `neq` or the special function `infer` (default `infer`) + +When the special `infer` function is used the `spec` and the actual value from the node are compared. If both are versions, according to `semver.valid()`, `eq` is used. If both values are ranges, according to `!semver.valid()`, `intersects` is used. If the values are mixed types `satisfies` is used. + +Some examples: + +- `:semver(^1.0.0)` returns every node that has a `version` satisfied by the provided range `^1.0.0` +- `:semver(16.0.0, :attr(engines, [node]))` returns every node which has an `engines.node` property satisfying the version `16.0.0` +- `:semver(1.0.0, [version], lt)` every node with a `version` less than `1.0.0` + +##### `:outdated()` + +The `:outdated` pseudo selector retrieves data from the registry and returns information about which of your dependencies are outdated. The type parameter may be one of the following: + +- `any` (default) a version exists that is greater than the current one +- `in-range` a version exists that is greater than the current one, and satisfies at least one if its parent's dependencies +- `out-of-range` a version exists that is greater than the current one, does not satisfy at least one of its parent's dependencies +- `major` a version exists that is a semver major greater than the current one +- `minor` a version exists that is a semver minor greater than the current one +- `patch` a version exists that is a semver patch greater than the current one + +In addition to the filtering performed by the pseudo selector, some extra data is added to the resulting objects. The following data can be found under the `queryContext` property of each node. + +- `versions` an array of every available version of the given node +- `outdated.inRange` an array of objects, each with a `from` and `versions`, where `from` is the on-disk location of the node that depends on the current node and `versions` is an array of all available versions that satisfies that dependency. This is only populated if `:outdated(in-range)` is used. +- `outdated.outOfRange` an array of objects, identical in shape to `inRange`, but where the `versions` array is every available version that does not satisfy the dependency. This is only populated if `:outdated(out-of-range)` is used. + +Some examples: + +- `:root > :outdated(major)` returns every direct dependency that has a new semver major release +- `.prod:outdated(in-range)` returns production dependencies that have a new release that satisfies at least one of its parent's dependencies + +##### `:vuln` + +The `:vuln` pseudo selector retrieves data from the registry and returns information about which if your dependencies has a known vulnerability. Only dependencies whose current version matches a vulnerability will be returned. For example if you have `semver@7.6.0` in your tree, a vulnerability for `semver` which affects versions `<=6.3.1` will not match. + +You can also filter results by certain attributes in advisories. Currently that includes `severity` and `cwe`. Note that severity filtering is done per severity, it does not include severities "higher" or "lower" than the one specified. + +In addition to the filtering performed by the pseudo selector, info about each relevant advisory will be added to the `queryContext` attribute of each node under the `advisories` attribute. + +Some examples: + +- `:root > .prod:vuln` returns direct production dependencies with any known vulnerability +- `:vuln([severity=high])` returns only dependencies with a vulnerability with a `high` severity. +- `:vuln([severity=high],[severity=moderate])` returns only dependencies with a vulnerability with a `high` or `moderate` severity. +- `:vuln([cwe=1333])` returns only dependencies with a vulnerability that includes CWE-1333 (ReDoS) + +#### [Attribute Selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) + +The attribute selector evaluates the key/value pairs in `package.json` if they are `String`s. + +- `[]` attribute selector (ie. existence of attribute) +- `[attribute=value]` attribute value is equivalent... +- `[attribute~=value]` attribute value contains word... +- `[attribute*=value]` attribute value contains string... +- `[attribute|=value]` attribute value is equal to or starts with... +- `[attribute^=value]` attribute value starts with... +- `[attribute$=value]` attribute value ends with... + +#### `Array` & `Object` Attribute Selectors + +The generic `:attr()` pseudo selector standardizes a pattern which can be used for attribute selection of `Object`s, `Array`s or `Arrays` of `Object`s accessible via `Arborist`'s `Node.package` metadata. This allows for iterative attribute selection beyond top-level `String` evaluation. The last argument passed to `:attr()` must be an `attribute` selector or a nested `:attr()`. See examples below: + +#### `Objects` + +```css +/* return dependencies that have a `scripts.test` containing `"tap"` */ +*:attr(scripts, [test~=tap]) +``` + +#### Nested `Objects` + +Nested objects are expressed as sequential arguments to `:attr()`. + +```css +/* return dependencies that have a testling config for opera browsers */ +*:attr(testling, browsers, [~=opera]) +``` + +#### `Arrays` + +`Array`s specifically uses a special/reserved `.` character in place of a typical attribute name. `Arrays` also support exact `value` matching when a `String` is passed to the selector. + +##### Example of an `Array` Attribute Selection: +```css +/* removes the distinction between properties & arrays */ +/* ie. we'd have to check the property & iterate to match selection */ +*:attr([keywords^=react]) +*:attr(contributors, :attr([name~=Jordan])) +``` + +##### Example of an `Array` matching directly to a value: +```css +/* return dependencies that have the exact keyword "react" */ +/* this is equivalent to `*:keywords([value="react"])` */ +*:attr([keywords=react]) +``` + +##### Example of an `Array` of `Object`s: +```css +/* returns */ +*:attr(contributors, [email=ruyadorno@github.com]) +``` + +### Groups + +Dependency groups are defined by the package relationships to their ancestors (ie. the dependency types that are defined in `package.json`). This approach is user-centric as the ecosystem has been taught to think about dependencies in these groups first-and-foremost. Dependencies are allowed to be included in multiple groups (ex. a `prod` dependency may also be a `dev` dependency (in that it's also required by another `dev` dependency) & may also be `bundled` - a selector for that type of dependency would look like: `*.prod.dev.bundled`). + +- `.prod` +- `.dev` +- `.optional` +- `.peer` +- `.bundled` +- `.workspace` + +Please note that currently `workspace` deps are always `prod` dependencies. Additionally the `.root` dependency is also considered a `prod` dependency. + +### Programmatic Usage + +- `Arborist`'s `Node` Class has a `.querySelectorAll()` method + - this method will return a filtered, flattened dependency Arborist `Node` list based on a valid query selector + +```js +const Arborist = require('@npmcli/arborist') +const arb = new Arborist({}) +``` + +```js +// root-level +arb.loadActual().then(async (tree) => { + // query all production dependencies + const results = await tree.querySelectorAll('.prod') + console.log(results) +}) +``` + +```js +// iterative +arb.loadActual().then(async (tree) => { + // query for the deduped version of react + const results = await tree.querySelectorAll('#react:not(:deduped)') + // query the deduped react for git deps + const deps = await results[0].querySelectorAll(':type(git)') + console.log(deps) +}) +``` + +## See Also + +* [npm query](/commands/npm-query) +* [@npmcli/arborist](https://npm.im/@npmcli/arborist) diff --git a/node_modules/npm/docs/content/using-npm/developers.md b/node_modules/npm/docs/content/using-npm/developers.md new file mode 100644 index 00000000..b97ca038 --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/developers.md @@ -0,0 +1,248 @@ +--- +title: developers +section: 7 +description: Developer Guide +--- + +### Description + +So, you've decided to use npm to develop (and maybe publish/deploy) +your project. + +Fantastic! + +There are a few things that you need to do above the simple steps +that your users will do to install your program. + +### About These Documents + +These are man pages. If you install npm, you should be able to +then do `man npm-thing` to get the documentation on a particular +topic, or `npm help thing` to see the same information. + +### What is a Package + +A package is: + +* a) a folder containing a program described by a package.json file +* b) a gzipped tarball containing (a) +* c) a url that resolves to (b) +* d) a `@` that is published on the registry with (c) +* e) a `@` that points to (d) +* f) a `` that has a "latest" tag satisfying (e) +* g) a `git` url that, when cloned, results in (a). + +Even if you never publish your package, you can still get a lot of +benefits of using npm if you just want to write a node program (a), and +perhaps if you also want to be able to easily install it elsewhere +after packing it up into a tarball (b). + +Git urls can be of the form: + +```bash +git://github.com/user/project.git#commit-ish +git+ssh://user@hostname:project.git#commit-ish +git+http://user@hostname/project/blah.git#commit-ish +git+https://user@hostname/project/blah.git#commit-ish +``` + +The `commit-ish` can be any tag, sha, or branch which can be supplied as +an argument to `git checkout`. The default is whatever the repository uses +as its default branch. + +### The package.json File + +You need to have a `package.json` file in the root of your project to do +much of anything with npm. That is basically the whole interface. + +See [`package.json`](/configuring-npm/package-json) for details about what +goes in that file. At the very least, you need: + +* name: This should be a string that identifies your project. Please do + not use the name to specify that it runs on node, or is in JavaScript. + You can use the "engines" field to explicitly state the versions of node + (or whatever else) that your program requires, and it's pretty well + assumed that it's JavaScript. + + It does not necessarily need to match your github repository name. + + So, `node-foo` and `bar-js` are bad names. `foo` or `bar` are better. + +* version: A semver-compatible version. + +* engines: Specify the versions of node (or whatever else) that your + program runs on. The node API changes a lot, and there may be bugs or + new functionality that you depend on. Be explicit. + +* author: Take some credit. + +* scripts: If you have a special compilation or installation script, then + you should put it in the `scripts` object. You should definitely have at + least a basic smoke-test command as the "scripts.test" field. See + [scripts](/using-npm/scripts). + +* main: If you have a single module that serves as the entry point to your + program (like what the "foo" package gives you at require("foo")), then + you need to specify that in the "main" field. + +* directories: This is an object mapping names to folders. The best ones + to include are "lib" and "doc", but if you use "man" to specify a folder + full of man pages, they'll get installed just like these ones. + +You can use `npm init` in the root of your package in order to get you +started with a pretty basic package.json file. See [`npm +init`](/commands/npm-init) for more info. + +### Keeping files *out* of your Package + +Use a `.npmignore` file to keep stuff out of your package. If there's no +`.npmignore` file, but there *is* a `.gitignore` file, then npm will ignore +the stuff matched by the `.gitignore` file. If you *want* to include +something that is excluded by your `.gitignore` file, you can create an +empty `.npmignore` file to override it. Like `git`, `npm` looks for +`.npmignore` and `.gitignore` files in all subdirectories of your package, +not only the root directory. + +`.npmignore` files follow the [same pattern +rules](https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring) +as `.gitignore` files: + +* Blank lines or lines starting with `#` are ignored. +* Standard glob patterns work. +* You can end patterns with a forward slash `/` to specify a directory. +* You can negate a pattern by starting it with an exclamation point `!`. + +By default, some paths and files are ignored, so there's no +need to add them to `.npmignore` explicitly. Some examples are: + +* `.*.swp` +* `._*` +* `.DS_Store` +* `.git` +* `.gitignore` +* `.hg` +* `.npmignore` +* `.npmrc` +* `.lock-wscript` +* `.svn` +* `.wafpickle-*` +* `config.gypi` +* `CVS` +* `npm-debug.log` + +Additionally, everything in `node_modules` is ignored, except for +bundled dependencies. npm automatically handles this for you, so don't +bother adding `node_modules` to `.npmignore`. + +The following paths and files are never ignored, so adding them to +`.npmignore` is pointless: + +* `package.json` +* `README` (and its variants) +* `CHANGELOG` (and its variants) +* `LICENSE` / `LICENCE` + +If, given the structure of your project, you find `.npmignore` to be a +maintenance headache, you might instead try populating the `files` +property of `package.json`, which is an array of file or directory names +that should be included in your package. Sometimes manually picking +which items to allow is easier to manage than building a block list. + +See [`package.json`](/configuring-npm/package-json) for more info on +what can and can't be ignored. + +#### Testing whether your `.npmignore` or `files` config works + +If you want to double check that your package will include only the files +you intend it to when published, you can run the `npm pack` command locally +which will generate a tarball in the working directory, the same way it +does for publishing. + +### Link Packages + +`npm link` is designed to install a development package and see the +changes in real time without having to keep re-installing it. (You do +need to either re-link or `npm rebuild -g` to update compiled packages, +of course.) + +More info at [`npm link`](/commands/npm-link). + +### Before Publishing: Make Sure Your Package Installs and Works + +**This is important.** + +If you can not install it locally, you'll have +problems trying to publish it. Or, worse yet, you'll be able to +publish it, but you'll be publishing a broken or pointless package. +So don't do that. + +In the root of your package, do this: + +```bash +npm install . -g +``` + +That'll show you that it's working. If you'd rather just create a symlink +package that points to your working directory, then do this: + +```bash +npm link +``` + +Use `npm ls -g` to see if it's there. + +To test a local install, go into some other folder, and then do: + +```bash +cd ../some-other-folder +npm install ../my-package +``` + +to install it locally into the node_modules folder in that other place. + +Then go into the node-repl, and try using require("my-thing") to +bring in your module's main module. + +### Create a User Account + +Create a user with the adduser command. It works like this: + +```bash +npm adduser +``` + +and then follow the prompts. + +This is documented better in [npm adduser](/commands/npm-adduser). + +### Publish your Package + +This part's easy. In the root of your folder, do this: + +```bash +npm publish +``` + +You can give publish a url to a tarball, or a filename of a tarball, +or a path to a folder. + +Note that pretty much **everything in that folder will be exposed** +by default. So, if you have secret stuff in there, use a +`.npmignore` file to list out the globs to ignore, or publish +from a fresh checkout. + +### Brag about it + +Send emails, write blogs, blab in IRC. + +Tell the world how easy it is to install your program! + +### See also + +* [npm](/commands/npm) +* [npm init](/commands/npm-init) +* [package.json](/configuring-npm/package-json) +* [npm scripts](/using-npm/scripts) +* [npm publish](/commands/npm-publish) +* [npm adduser](/commands/npm-adduser) +* [npm registry](/using-npm/registry) diff --git a/node_modules/npm/docs/content/using-npm/logging.md b/node_modules/npm/docs/content/using-npm/logging.md new file mode 100644 index 00000000..4470d5d1 --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/logging.md @@ -0,0 +1,96 @@ +--- +title: Logging +section: 7 +description: Why, What & How We Log +--- + +### Description + +The `npm` CLI has various mechanisms for showing different levels of information back to end-users for certain commands, configurations & environments. + +### Setting Log File Location + +All logs are written to a debug log, with the path to that file printed if the execution of a command fails. + +The default location of the logs directory is a directory named `_logs` inside the npm cache. This can be changed with the `logs-dir` config option. + +For example, if you wanted to write all your logs to the current working directory, you could run: `npm install --logs-dir=.`. This is especially helpful in debugging a specific `npm` issue as you can run +a command multiple times with different config values and then diff all the log files. + +Log files will be removed from the `logs-dir` when the number of log files exceeds `logs-max`, with the oldest logs being deleted first. + +To turn off logs completely set `--logs-max=0`. + +### Setting Log Levels + +#### `loglevel` + +`loglevel` is a global argument/config that can be set to determine the type of information to be displayed. + +The default value of `loglevel` is `"notice"` but there are several levels/types of logs available, including: + +- `"silent"` +- `"error"` +- `"warn"` +- `"notice"` +- `"http"` +- `"info"` +- `"verbose"` +- `"silly"` + +All logs pertaining to a level proceeding the current setting will be shown. + +##### Aliases + +The log levels listed above have various corresponding aliases, including: + +- `-d`: `--loglevel info` +- `--dd`: `--loglevel verbose` +- `--verbose`: `--loglevel verbose` +- `--ddd`: `--loglevel silly` +- `-q`: `--loglevel warn` +- `--quiet`: `--loglevel warn` +- `-s`: `--loglevel silent` +- `--silent`: `--loglevel silent` + +#### `foreground-scripts` + +The `npm` CLI began hiding the output of lifecycle scripts for `npm install` as of `v7`. Notably, this means you will not see logs/output from packages that may be using "install scripts" to display information back to you or from your own project's scripts defined in `package.json`. If you'd like to change this behavior & log this output you can set `foreground-scripts` to `true`. + +### Timing Information + +The [`--timing` config](/using-npm/config#timing) can be set which does a few +things: + +1. Always shows the full path to the debug log regardless of command exit status +1. Write timing information to a process specific timing file in the cache or `logs-dir` +1. Output timing information to the terminal + +This file contains a `timers` object where the keys are an identifier for the +portion of the process being timed and the value is the number of milliseconds it took to complete. + +Sometimes it is helpful to get timing information without outputting anything to the terminal. For +example, the performance might be affected by writing to the terminal. In this case you can use +`--timing --silent` which will still write the timing file, but not output anything to the terminal +while running. + +### Registry Response Headers + +#### `npm-notice` + +The `npm` CLI reads from & logs any `npm-notice` headers that are returned from the configured registry. This mechanism can be used by third-party registries to provide useful information when network-dependent requests occur. + +This header is not cached, and will not be logged if the request is served from the cache. + +### Logs and Sensitive Information + +The `npm` CLI makes a best effort to redact the following from terminal output and log files: + +- Passwords inside basic auth URLs +- npm tokens + +However, this behavior should not be relied on to keep all possible sensitive information redacted. If you are concerned about secrets in your log file or terminal output, you can use `--loglevel=silent` and `--logs-max=0` to ensure no logs are written to your terminal or filesystem. + +### See also + +* [config](/using-npm/config) diff --git a/node_modules/npm/docs/content/using-npm/orgs.md b/node_modules/npm/docs/content/using-npm/orgs.md new file mode 100644 index 00000000..5fe9ac6d --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/orgs.md @@ -0,0 +1,93 @@ +--- +title: orgs +section: 7 +description: Working with Teams & Orgs +--- + +### Description + +There are three levels of org users: + +1. Super admin, controls billing & adding people to the org. +2. Team admin, manages team membership & package access. +3. Developer, works on packages they are given access to. + +The super admin is the only person who can add users to the org because it impacts the monthly bill. The super admin will use the website to manage membership. Every org has a `developers` team that all users are automatically added to. + +The team admin is the person who manages team creation, team membership, and package access for teams. The team admin grants package access to teams, not individuals. + +The developer will be able to access packages based on the teams they are on. Access is either read-write or read-only. + +There are two main commands: + +1. `npm team` see [npm team](/commands/npm-team) for more details +2. `npm access` see [npm access](/commands/npm-access) for more details + +### Team Admins create teams + +* Check who you’ve added to your org: + +```bash +npm team ls :developers +``` + +* Each org is automatically given a `developers` team, so you can see the whole list of team members in your org. This team automatically gets read-write access to all packages, but you can change that with the `access` command. + +* Create a new team: + +```bash +npm team create +``` + +* Add members to that team: + +```bash +npm team add +``` + +### Publish a package and adjust package access + +* In package directory, run + +```bash +npm init --scope= +``` +to scope it for your org & publish as usual + +* Grant access: + +```bash +npm access grant [] +``` + +* Revoke access: + +```bash +npm access revoke [] +``` + +### Monitor your package access + +* See what org packages a team member can access: + +```bash +npm access ls-packages +``` + +* See packages available to a specific team: + +```bash +npm access ls-packages +``` + +* Check which teams are collaborating on a package: + +```bash +npm access ls-collaborators +``` + +### See also + +* [npm team](/commands/npm-team) +* [npm access](/commands/npm-access) +* [npm scope](/using-npm/scope) diff --git a/node_modules/npm/docs/content/using-npm/package-spec.md b/node_modules/npm/docs/content/using-npm/package-spec.md new file mode 100644 index 00000000..f7844d14 --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/package-spec.md @@ -0,0 +1,105 @@ +--- +title: package-spec +section: 7 +description: Package name specifier +--- + +### Description + +Commands like `npm install` and the dependency sections in the +`package.json` use a package name specifier. This can be many different +things that all refer to a "package". Examples include a package name, +git url, tarball, or local directory. These will generally be referred +to as `` in the help output for the npm commands that use +this package name specifier. + +### Package name + +* `[<@scope>/]` +* `[<@scope>/]@` +* `[<@scope>/]@` +* `[<@scope>/]@` + +Refers to a package by name, with or without a scope, and optionally +tag, version, or version range. This is typically used in combination +with the [registry](/using-npm/config#registry) config to refer to a +package in a registry. + +Examples: +* `npm` +* `@npmcli/arborist` +* `@npmcli/arborist@latest` +* `npm@6.13.1` +* `npm@^4.0.0` + +### Aliases + +* `@npm:` + +Primarily used by commands like `npm install` and in the dependency +sections in the `package.json`, this refers to a package by an alias. +The `` is the name of the package as it is reified in the +`node_modules` folder, and the `` refers to a package name as +found in the configured registry. + +See `Package name` above for more info on referring to a package by +name, and [registry](/using-npm/config#registry) for configuring which +registry is used when referring to a package by name. + +Examples: +* `semver:@npm:@npmcli/semver-with-patch` +* `semver:@npm:semver@7.2.2` +* `semver:@npm:semver@legacy` + +### Folders + +* `` + +This refers to a package on the local filesystem. Specifically this is +a folder with a `package.json` file in it. This *should* always be +prefixed with a `/` or `./` (or your OS equivalent) to reduce confusion. +npm currently will parse a string with more than one `/` in it as a +folder, but this is legacy behavior that may be removed in a future +version. + +Examples: + +* `./my-package` +* `/opt/npm/my-package` + +### Tarballs + +* `` +* `` + +Examples: + +* `./my-package.tgz` +* `https://registry.npmjs.org/semver/-/semver-1.0.0.tgz` + +Refers to a package in a tarball format, either on the local filesystem +or remotely via url. This is the format that packages exist in when +uploaded to a registry. + +### git urls + +* `` +* `/` + +Refers to a package in a git repo. This can be a full git url, git +shorthand, or a username/package on GitHub. You can specify a +git tag, branch, or other git ref by appending `#ref`. + +Examples: + +* `https://github.com/npm/cli.git` +* `git@github.com:npm/cli.git` +* `git+ssh://git@github.com/npm/cli#v6.0.0` +* `github:npm/cli#HEAD` +* `npm/cli#c12ea07` + +### See also + +* [npm-package-arg](https://npm.im/npm-package-arg) +* [scope](/using-npm/scope) +* [config](/using-npm/config) diff --git a/node_modules/npm/docs/content/using-npm/registry.md b/node_modules/npm/docs/content/using-npm/registry.md new file mode 100644 index 00000000..035ede5b --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/registry.md @@ -0,0 +1,86 @@ +--- +title: registry +section: 7 +description: The JavaScript Package Registry +--- + +### Description + +To resolve packages by name and version, npm talks to a registry website +that implements the CommonJS Package Registry specification for reading +package info. + +npm is configured to use the **npm public registry** at + by default. Use of the npm public registry is +subject to terms of use available at . + +You can configure npm to use any compatible registry you like, and even run +your own registry. Use of someone else's registry may be governed by their +terms of use. + +npm's package registry implementation supports several +write APIs as well, to allow for publishing packages and managing user +account information. + +The npm public registry is powered by a CouchDB database, +of which there is a public mirror at . + +The registry URL used is determined by the scope of the package (see +[`scope`](/using-npm/scope). If no scope is specified, the default registry is +used, which is supplied by the [`registry` config](/using-npm/config#registry) +parameter. See [`npm config`](/commands/npm-config), +[`npmrc`](/configuring-npm/npmrc), and [`config`](/using-npm/config) for more on +managing npm's configuration. +Authentication configuration such as auth tokens and certificates are configured +specifically scoped to an individual registry. See +[Auth Related Configuration](/configuring-npm/npmrc#auth-related-configuration) + +When the default registry is used in a package-lock or shrinkwrap it has the +special meaning of "the currently configured registry". If you create a lock +file while using the default registry you can switch to another registry and +npm will install packages from the new registry, but if you create a lock +file while using a custom registry packages will be installed from that +registry even after you change to another registry. + +### Does npm send any information about me back to the registry? + +Yes. + +When making requests of the registry npm adds two headers with information +about your environment: + +* `Npm-Scope` – If your project is scoped, this header will contain its + scope. In the future npm hopes to build registry features that use this + information to allow you to customize your experience for your + organization. +* `Npm-In-CI` – Set to "true" if npm believes this install is running in a + continuous integration environment, "false" otherwise. This is detected by + looking for the following environment variables: `CI`, `TDDIUM`, + `JENKINS_URL`, `bamboo.buildKey`. If you'd like to learn more you may find + the [original PR](https://github.com/npm/npm-registry-client/pull/129) + interesting. + This is used to gather better metrics on how npm is used by humans, versus + build farms. + +The npm registry does not try to correlate the information in these headers +with any authenticated accounts that may be used in the same requests. + +### How can I prevent my package from being published in the official registry? + +Set `"private": true` in your `package.json` to prevent it from being +published at all, or +`"publishConfig":{"registry":"http://my-internal-registry.local"}` +to force it to be published only to your internal/private registry. + +See [`package.json`](/configuring-npm/package-json) for more info on what goes in the package.json file. + +### Where can I find my (and others') published packages? + + + +### See also + +* [npm config](/commands/npm-config) +* [config](/using-npm/config) +* [npmrc](/configuring-npm/npmrc) +* [npm developers](/using-npm/developers) diff --git a/node_modules/npm/docs/content/using-npm/removal.md b/node_modules/npm/docs/content/using-npm/removal.md new file mode 100644 index 00000000..3b94a7d1 --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/removal.md @@ -0,0 +1,60 @@ +--- +title: removal +section: 7 +description: Cleaning the Slate +--- + +### Synopsis + +So sad to see you go. + +```bash +sudo npm uninstall npm -g +``` + +Or, if that fails, please proceed to more severe uninstalling methods. + +### More Severe Uninstalling + +Usually, the above instructions are sufficient. That will remove +npm, but leave behind anything you've installed. + +If that doesn't work, or if you require more drastic measures, +continue reading. + +Note that this is only necessary for globally-installed packages. Local +installs are completely contained within a project's `node_modules` +folder. Delete that folder, and everything is gone unless a package's +install script is particularly ill-behaved. + +This assumes that you installed node and npm in the default place. If +you configured node with a different `--prefix`, or installed npm with a +different prefix setting, then adjust the paths accordingly, replacing +`/usr/local` with your install prefix. + +To remove everything npm-related manually: + +```bash +rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm* +``` + +If you installed things *with* npm, then your best bet is to uninstall +them with npm first, and then install them again once you have a +proper install. This can help find any symlinks that are lying +around: + +```bash +ls -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm +``` + +Prior to version 0.3, npm used shim files for executables and node +modules. To track those down, you can do the following: + +```bash +find /usr/local/{lib/node,bin} -exec grep -l npm \{\} \; ; +``` + +### See also + +* [npm uninstall](/commands/npm-uninstall) +* [npm prune](/commands/npm-prune) diff --git a/node_modules/npm/docs/content/using-npm/scope.md b/node_modules/npm/docs/content/using-npm/scope.md new file mode 100644 index 00000000..b43fa2e9 --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/scope.md @@ -0,0 +1,143 @@ +--- +title: scope +section: 7 +description: Scoped packages +--- + +### Description + +All npm packages have a name. Some package names also have a scope. A scope +follows the usual rules for package names (URL-safe characters, no leading dots +or underscores). When used in package names, scopes are preceded by an `@` symbol +and followed by a slash, e.g. + +```bash +@somescope/somepackagename +``` + +Scopes are a way of grouping related packages together, and also affect a few +things about the way npm treats the package. + +Each npm user/organization has their own scope, and only you can add packages +in your scope. This means you don't have to worry about someone taking your +package name ahead of you. Thus it is also a good way to signal official packages +for organizations. + +Scoped packages can be published and installed as of `npm@2` and are supported +by the primary npm registry. Unscoped packages can depend on scoped packages and +vice versa. The npm client is backwards-compatible with unscoped registries, +so it can be used to work with scoped and unscoped registries at the same time. + +### Installing scoped packages + +Scoped packages are installed to a sub-folder of the regular installation +folder, e.g. if your other packages are installed in `node_modules/packagename`, +scoped modules will be installed in `node_modules/@myorg/packagename`. The scope +folder (`@myorg`) is simply the name of the scope preceded by an `@` symbol, and can +contain any number of scoped packages. + +A scoped package is installed by referencing it by name, preceded by an +`@` symbol, in `npm install`: + +```bash +npm install @myorg/mypackage +``` + +Or in `package.json`: + +```json +"dependencies": { + "@myorg/mypackage": "^1.3.0" +} +``` + +Note that if the `@` symbol is omitted, in either case, npm will instead attempt to +install from GitHub; see [`npm install`](/commands/npm-install). + +### Requiring scoped packages + +Because scoped packages are installed into a scope folder, you have to +include the name of the scope when requiring them in your code, e.g. + +```javascript +require('@myorg/mypackage') +``` + +There is nothing special about the way Node treats scope folders. This +simply requires the `mypackage` module in the folder named `@myorg`. + +### Publishing scoped packages + +Scoped packages can be published from the CLI as of `npm@2` and can be +published to any registry that supports them, including the primary npm +registry. + +(As of 2015-04-19, and with npm 2.0 or better, the primary npm registry +**does** support scoped packages.) + +If you wish, you may associate a scope with a registry; see below. + +#### Publishing public scoped packages to the primary npm registry + +Publishing to a scope, you have two options: + +- Publishing to your user scope (example: `@username/module`) +- Publishing to an organization scope (example: `@org/module`) + +If publishing a public module to an organization scope, you must +first either create an organization with the name of the scope +that you'd like to publish to or be added to an existing organization +with the appropriate permissions. For example, if you'd like to +publish to `@org`, you would need to create the `org` organization +on npmjs.com prior to trying to publish. + +Scoped packages are not public by default. You will need to specify +`--access public` with the initial `npm publish` command. This will publish +the package and set access to `public` as if you had run `npm access public` +after publishing. You do not need to do this when publishing new versions of +an existing scoped package. + +#### Publishing private scoped packages to the npm registry + +To publish a private scoped package to the npm registry, you must have +an [npm Private Modules](https://docs.npmjs.com/private-modules/intro) +account. + +You can then publish the module with `npm publish` or `npm publish +--access restricted`, and it will be present in the npm registry, with +restricted access. You can then change the access permissions, if +desired, with `npm access` or on the npmjs.com website. + +### Associating a scope with a registry + +Scopes can be associated with a separate registry. This allows you to +seamlessly use a mix of packages from the primary npm registry and one or more +private registries, such as [GitHub Packages](https://github.com/features/packages) or the open source [Verdaccio](https://verdaccio.org) +project. + +You can associate a scope with a registry at login, e.g. + +```bash +npm login --registry=http://reg.example.com --scope=@myco +``` + +Scopes have a many-to-one relationship with registries: one registry can +host multiple scopes, but a scope only ever points to one registry. + +You can also associate a scope with a registry using `npm config`: + +```bash +npm config set @myco:registry=http://reg.example.com +``` + +Once a scope is associated with a registry, any `npm install` for a package +with that scope will request packages from that registry instead. Any +`npm publish` for a package name that contains the scope will be published to +that registry instead. + +### See also + +* [npm install](/commands/npm-install) +* [npm publish](/commands/npm-publish) +* [npm access](/commands/npm-access) +* [npm registry](/using-npm/registry) diff --git a/node_modules/npm/docs/content/using-npm/scripts.md b/node_modules/npm/docs/content/using-npm/scripts.md new file mode 100644 index 00000000..75f8929b --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/scripts.md @@ -0,0 +1,363 @@ +--- +title: scripts +section: 7 +description: How npm handles the "scripts" field +--- + +### Description + +The `"scripts"` property of your `package.json` file supports a number +of built-in scripts and their preset life cycle events as well as +arbitrary scripts. These all can be executed by running +`npm run-script ` or `npm run ` for short. *Pre* and *post* +commands with matching names will be run for those as well (e.g. `premyscript`, +`myscript`, `postmyscript`). Scripts from dependencies can be run with +`npm explore -- npm run `. + +### Pre & Post Scripts + +To create "pre" or "post" scripts for any scripts defined in the +`"scripts"` section of the `package.json`, simply create another script +*with a matching name* and add "pre" or "post" to the beginning of them. + +```json +{ + "scripts": { + "precompress": "{{ executes BEFORE the `compress` script }}", + "compress": "{{ run command to compress files }}", + "postcompress": "{{ executes AFTER `compress` script }}" + } +} +``` + +In this example `npm run compress` would execute these scripts as +described. + +### Life Cycle Scripts + +There are some special life cycle scripts that happen only in certain +situations. These scripts happen in addition to the `pre`, `post`, and +`` scripts. + +* `prepare`, `prepublish`, `prepublishOnly`, `prepack`, `postpack`, `dependencies` + +**prepare** (since `npm@4.0.0`) +* Runs BEFORE the package is packed, i.e. during `npm publish` + and `npm pack` +* Runs on local `npm install` without any arguments +* Runs AFTER `prepublish`, but BEFORE `prepublishOnly` + +* NOTE: If a package being installed through git contains a `prepare` + script, its `dependencies` and `devDependencies` will be installed, and + the prepare script will be run, before the package is packaged and + installed. + +* As of `npm@7` these scripts run in the background. + To see the output, run with: `--foreground-scripts`. + +**prepublish** (DEPRECATED) +* Does not run during `npm publish`, but does run during `npm ci` + and `npm install`. See below for more info. + +**prepublishOnly** +* Runs BEFORE the package is prepared and packed, ONLY on `npm publish`. + +**prepack** +* Runs BEFORE a tarball is packed (on "`npm pack`", "`npm publish`", and when installing a git dependency). +* NOTE: "`npm run pack`" is NOT the same as "`npm pack`". "`npm run pack`" is an arbitrary user defined script name, where as, "`npm pack`" is a CLI defined command. + +**postpack** +* Runs AFTER the tarball has been generated but before it is moved to its final destination (if at all, publish does not save the tarball locally) + +**dependencies** +* Runs AFTER any operations that modify the `node_modules` directory IF changes occurred. +* Does NOT run in global mode + +#### Prepare and Prepublish + +**Deprecation Note: prepublish** + +Since `npm@1.1.71`, the npm CLI has run the `prepublish` script for both `npm publish` and `npm install`, because it's a convenient way to prepare a package for use (some common use cases are described in the section below). It has also turned out to be, in practice, [very confusing](https://github.com/npm/npm/issues/10074). As of `npm@4.0.0`, a new event has been introduced, `prepare`, that preserves this existing behavior. A _new_ event, `prepublishOnly` has been added as a transitional strategy to allow users to avoid the confusing behavior of existing npm versions and only run on `npm publish` (for instance, running the tests one last time to ensure they're in good shape). + +See for a much lengthier justification, with further reading, for this change. + +**Use Cases** + +If you need to perform operations on your package before it is used, in a way that is not dependent on the operating system or architecture of the target system, use a `prepublish` script. This includes tasks such as: + +* Compiling CoffeeScript source code into JavaScript. +* Creating minified versions of JavaScript source code. +* Fetching remote resources that your package will use. + +The advantage of doing these things at `prepublish` time is that they can be done once, in a single place, thus reducing complexity and variability. Additionally, this means that: + +* You can depend on `coffee-script` as a `devDependency`, and thus + your users don't need to have it installed. +* You don't need to include minifiers in your package, reducing + the size for your users. +* You don't need to rely on your users having `curl` or `wget` or + other system tools on the target machines. + +#### Dependencies + +The `dependencies` script is run any time an `npm` command causes changes to the `node_modules` directory. It is run AFTER the changes have been applied and the `package.json` and `package-lock.json` files have been updated. + +### Life Cycle Operation Order + +#### [`npm cache add`](/commands/npm-cache) + +* `prepare` + +#### [`npm ci`](/commands/npm-ci) + +* `preinstall` +* `install` +* `postinstall` +* `prepublish` +* `preprepare` +* `prepare` +* `postprepare` + + These all run after the actual installation of modules into + `node_modules`, in order, with no internal actions happening in between + +#### [`npm diff`](/commands/npm-diff) + +* `prepare` + +#### [`npm install`](/commands/npm-install) + +These also run when you run `npm install -g ` + +* `preinstall` +* `install` +* `postinstall` +* `prepublish` +* `preprepare` +* `prepare` +* `postprepare` + +If there is a `binding.gyp` file in the root of your package and you +haven't defined your own `install` or `preinstall` scripts, npm will +default the `install` command to compile using node-gyp via `node-gyp +rebuild` + +These are run from the scripts of `` + +#### [`npm pack`](/commands/npm-pack) + +* `prepack` +* `prepare` +* `postpack` + +#### [`npm publish`](/commands/npm-publish) + +* `prepublishOnly` +* `prepack` +* `prepare` +* `postpack` +* `publish` +* `postpublish` + +#### [`npm rebuild`](/commands/npm-rebuild) + +* `preinstall` +* `install` +* `postinstall` +* `prepare` + +`prepare` is only run if the current directory is a symlink (e.g. with +linked packages) + +#### [`npm restart`](/commands/npm-restart) + +If there is a `restart` script defined, these events are run, otherwise +`stop` and `start` are both run if present, including their `pre` and +`post` iterations) + +* `prerestart` +* `restart` +* `postrestart` + +#### [`npm run `](/commands/npm-run-script) + +* `pre` +* `` +* `post` + +#### [`npm start`](/commands/npm-start) + +* `prestart` +* `start` +* `poststart` + +If there is a `server.js` file in the root of your package, then npm +will default the `start` command to `node server.js`. `prestart` and +`poststart` will still run in this case. + +#### [`npm stop`](/commands/npm-stop) + +* `prestop` +* `stop` +* `poststop` + +#### [`npm test`](/commands/npm-test) + +* `pretest` +* `test` +* `posttest` + +#### [`npm version`](/commands/npm-version) + +* `preversion` +* `version` +* `postversion` + +#### A Note on a lack of [`npm uninstall`](/commands/npm-uninstall) scripts + +While npm v6 had `uninstall` lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there's no clear way to currently give the script enough context to be useful. + +Reasons for a package removal include: + +* a user directly uninstalled this package +* a user uninstalled a dependant package and so this dependency is being uninstalled +* a user uninstalled a dependant package but another package also depends on this version +* this version has been merged as a duplicate with another version +* etc. + +Due to the lack of necessary context, `uninstall` lifecycle scripts are not implemented and will not function. + +### User + +When npm is run as root, scripts are always run with the effective uid +and gid of the working directory owner. + +### Environment + +Package scripts run in an environment where many pieces of information +are made available regarding the setup of npm and the current state of +the process. + +#### path + +If you depend on modules that define executable scripts, like test +suites, then those executables will be added to the `PATH` for +executing the scripts. So, if your package.json has this: + +```json +{ + "name" : "foo", + "dependencies" : { + "bar" : "0.1.x" + }, + "scripts": { + "start" : "bar ./test" + } +} +``` + +then you could run `npm start` to execute the `bar` script, which is +exported into the `node_modules/.bin` directory on `npm install`. + +#### package.json vars + +The package.json fields are tacked onto the `npm_package_` prefix. So, +for instance, if you had `{"name":"foo", "version":"1.2.5"}` in your +package.json file, then your package scripts would have the +`npm_package_name` environment variable set to "foo", and the +`npm_package_version` set to "1.2.5". You can access these variables +in your code with `process.env.npm_package_name` and +`process.env.npm_package_version`, and so on for other fields. + +See [`package.json`](/configuring-npm/package-json) for more on package configs. + +#### current lifecycle event + +Lastly, the `npm_lifecycle_event` environment variable is set to +whichever stage of the cycle is being executed. So, you could have a +single script used for different parts of the process which switches +based on what's currently happening. + +Objects are flattened following this format, so if you had +`{"scripts":{"install":"foo.js"}}` in your package.json, then you'd +see this in the script: + +```bash +process.env.npm_package_scripts_install === "foo.js" +``` + +### Examples + +For example, if your package.json contains this: + +```json +{ + "scripts" : { + "install" : "scripts/install.js", + "postinstall" : "scripts/install.js" + } +} +``` + +then `scripts/install.js` will be called for the install and post-install +stages of the lifecycle. Since `scripts/install.js` is running for two +different phases, it would be wise in this case to look at the +`npm_lifecycle_event` environment variable. + +If you want to run a make command, you can do so. This works just +fine: + +```json +{ + "scripts" : { + "preinstall" : "./configure", + "install" : "make && make install", + "test" : "make test" + } +} +``` + +### Exiting + +Scripts are run by passing the line as a script argument to `sh`. + +If the script exits with a code other than 0, then this will abort the +process. + +Note that these script files don't have to be Node.js or even +JavaScript programs. They just have to be some kind of executable +file. + +### Best Practices + +* Don't exit with a non-zero error code unless you *really* mean it. + If the failure is minor or only will prevent some optional features, then + it's better to just print a warning and exit successfully. +* Try not to use scripts to do what npm can do for you. Read through + [`package.json`](/configuring-npm/package-json) to see all the things that you can specify and enable + by simply describing your package appropriately. In general, this + will lead to a more robust and consistent state. +* Inspect the env to determine where to put things. For instance, if + the `npm_config_binroot` environment variable is set to `/home/user/bin`, then + don't try to install executables into `/usr/local/bin`. The user + probably set it up that way for a reason. +* Don't prefix your script commands with "sudo". If root permissions + are required for some reason, then it'll fail with that error, and + the user will sudo the npm command in question. +* Don't use `install`. Use a `.gyp` file for compilation, and `prepare` + for anything else. You should almost never have to explicitly set a + preinstall or install script. If you are doing this, please consider if + there is another option. The only valid use of `install` or `preinstall` + scripts is for compilation which must be done on the target architecture. +* Scripts are run from the root of the package folder, regardless of what the + current working directory is when `npm` is invoked. If you want your + script to use different behavior based on what subdirectory you're in, you + can use the `INIT_CWD` environment variable, which holds the full path you + were in when you ran `npm run`. + +### See Also + +* [npm run-script](/commands/npm-run-script) +* [package.json](/configuring-npm/package-json) +* [npm developers](/using-npm/developers) +* [npm install](/commands/npm-install) diff --git a/node_modules/npm/docs/content/using-npm/workspaces.md b/node_modules/npm/docs/content/using-npm/workspaces.md new file mode 100644 index 00000000..cb545c0b --- /dev/null +++ b/node_modules/npm/docs/content/using-npm/workspaces.md @@ -0,0 +1,226 @@ +--- +title: workspaces +section: 7 +description: Working with workspaces +--- + +### Description + +**Workspaces** is a generic term that refers to the set of features in the +npm cli that provides support for managing multiple packages from your local +file system from within a singular top-level, root package. + +This set of features makes up for a much more streamlined workflow handling +linked packages from the local file system. It automates the linking process +as part of `npm install` and removes the need to manually use `npm link` in +order to add references to packages that should be symlinked into the current +`node_modules` folder. + +We also refer to these packages being auto-symlinked during `npm install` as a +single **workspace**, meaning it's a nested package within the current local +file system that is explicitly defined in the [`package.json`](/configuring-npm/package-json#workspaces) +`workspaces` configuration. + +### Defining workspaces + +Workspaces are usually defined via the `workspaces` property of the +[`package.json`](/configuring-npm/package-json#workspaces) file, e.g: + +```json +{ + "name": "my-workspaces-powered-project", + "workspaces": [ + "packages/a" + ] +} +``` + +Given the above `package.json` example living at a current working +directory `.` that contains a folder named `packages/a` that itself contains +a `package.json` inside it, defining a Node.js package, e.g: + +``` +. ++-- package.json +`-- packages + +-- a + | `-- package.json +``` + +The expected result once running `npm install` in this current working +directory `.` is that the folder `packages/a` will get symlinked to the +`node_modules` folder of the current working dir. + +Below is a post `npm install` example, given that same previous example +structure of files and folders: + +``` +. ++-- node_modules +| `-- a -> ../packages/a ++-- package-lock.json ++-- package.json +`-- packages + +-- a + | `-- package.json +``` + +### Getting started with workspaces + +You may automate the required steps to define a new workspace using +[npm init](/commands/npm-init). For example in a project that already has a +`package.json` defined you can run: + +``` +npm init -w ./packages/a +``` + +This command will create the missing folders and a new `package.json` +file (if needed) while also making sure to properly configure the +`"workspaces"` property of your root project `package.json`. + +### Adding dependencies to a workspace + +It's possible to directly add/remove/update dependencies of your workspaces +using the [`workspace` config](/using-npm/config#workspace). + +For example, assuming the following structure: + +``` +. ++-- package.json +`-- packages + +-- a + | `-- package.json + `-- b + `-- package.json +``` + +If you want to add a dependency named `abbrev` from the registry as a +dependency of your workspace **a**, you may use the workspace config to tell +the npm installer that package should be added as a dependency of the provided +workspace: + +``` +npm install abbrev -w a +``` + +Note: other installing commands such as `uninstall`, `ci`, etc will also +respect the provided `workspace` configuration. + +### Using workspaces + +Given the [specifics of how Node.js handles module resolution](https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_all_together) it's possible to consume any defined workspace +by its declared `package.json` `name`. Continuing from the example defined +above, let's also create a Node.js script that will require the workspace `a` +example module, e.g: + +``` +// ./packages/a/index.js +module.exports = 'a' + +// ./lib/index.js +const moduleA = require('a') +console.log(moduleA) // -> a +``` + +When running it with: + +`node lib/index.js` + +This demonstrates how the nature of `node_modules` resolution allows for +**workspaces** to enable a portable workflow for requiring each **workspace** +in such a way that is also easy to [publish](/commands/npm-publish) these +nested workspaces to be consumed elsewhere. + +### Running commands in the context of workspaces + +You can use the `workspace` configuration option to run commands in the context +of a configured workspace. +Additionally, if your current directory is in a workspace, the `workspace` +configuration is implicitly set, and `prefix` is set to the root workspace. + +Following is a quick example on how to use the `npm run` command in the context +of nested workspaces. For a project containing multiple workspaces, e.g: + +``` +. ++-- package.json +`-- packages + +-- a + | `-- package.json + `-- b + `-- package.json +``` + +By running a command using the `workspace` option, it's possible to run the +given command in the context of that specific workspace. e.g: + +``` +npm run test --workspace=a +``` + +You could also run the command within the workspace. + +``` +cd packages/a && npm run test +``` + +Either will run the `test` script defined within the +`./packages/a/package.json` file. + +Please note that you can also specify this argument multiple times in the +command-line in order to target multiple workspaces, e.g: + +``` +npm run test --workspace=a --workspace=b +``` + +Or run the command for each workspace within the 'packages' folder: +``` +npm run test --workspace=packages +``` + +It's also possible to use the `workspaces` (plural) configuration option to +enable the same behavior but running that command in the context of **all** +configured workspaces. e.g: + +``` +npm run test --workspaces +``` + +Will run the `test` script in both `./packages/a` and `./packages/b`. + +Commands will be run in each workspace in the order they appear in your `package.json` + +``` +{ + "workspaces": [ "packages/a", "packages/b" ] +} +``` + +Order of run is different with: + +``` +{ + "workspaces": [ "packages/b", "packages/a" ] +} +``` + +### Ignoring missing scripts + +It is not required for all of the workspaces to implement scripts run with the `npm run` command. + +By running the command with the `--if-present` flag, npm will ignore workspaces missing target script. + +``` +npm run test --workspaces --if-present +``` + +### See also + +* [npm install](/commands/npm-install) +* [npm publish](/commands/npm-publish) +* [npm run-script](/commands/npm-run-script) +* [config](/using-npm/config) + diff --git a/node_modules/npm/docs/lib/index.js b/node_modules/npm/docs/lib/index.js new file mode 100644 index 00000000..b88d20cc --- /dev/null +++ b/node_modules/npm/docs/lib/index.js @@ -0,0 +1,189 @@ +const localeCompare = require('@isaacs/string-locale-compare')('en') +const { join, basename, resolve } = require('path') +const transformHTML = require('./transform-html.js') +const { version } = require('../../lib/npm.js') +const { aliases } = require('../../lib/utils/cmd-list') +const { shorthands, definitions } = require('@npmcli/config/lib/definitions') + +const DOC_EXT = '.md' + +const TAGS = { + CONFIG: '', + USAGE: '', + SHORTHANDS: '', +} + +const assertPlaceholder = (src, path, placeholder) => { + if (!src.includes(placeholder)) { + throw new Error( + `Cannot replace ${placeholder} in ${path} due to missing placeholder` + ) + } + return placeholder +} + +const getCommandByDoc = (docFile, docExt) => { + // Grab the command name from the *.md filename + // NOTE: We cannot use the name property command file because in the case of + // `npx` the file being used is `lib/commands/exec.js` + const name = basename(docFile, docExt).replace('npm-', '') + + if (name === 'npm') { + return { + name, + params: null, + usage: 'npm', + } + } + + // special case for `npx`: + // `npx` is not technically a command in and of itself, + // so it just needs the usage of npm exex + const srcName = name === 'npx' ? 'exec' : name + const { params, usage = [''], workspaces } = require(`../../lib/commands/${srcName}`) + const usagePrefix = name === 'npx' ? 'npx' : `npm ${name}` + if (params) { + for (const param of params) { + if (definitions[param].exclusive) { + for (const e of definitions[param].exclusive) { + if (!params.includes(e)) { + params.splice(params.indexOf(param) + 1, 0, e) + } + } + } + } + } + + return { + name, + workspaces, + params: name === 'npx' ? null : params, + usage: usage.map(u => `${usagePrefix} ${u}`.trim()).join('\n'), + } +} + +const replaceVersion = (src) => src.replace(/@VERSION@/g, version) + +const replaceUsage = (src, { path }) => { + const replacer = assertPlaceholder(src, path, TAGS.USAGE) + const { usage, name, workspaces } = getCommandByDoc(path, DOC_EXT) + + const synopsis = ['```bash', usage] + + const cmdAliases = Object.keys(aliases).reduce((p, c) => { + if (aliases[c] === name) { + p.push(c) + } + return p + }, []) + + if (cmdAliases.length === 1) { + synopsis.push('', `alias: ${cmdAliases[0]}`) + } else if (cmdAliases.length > 1) { + synopsis.push('', `aliases: ${cmdAliases.join(', ')}`) + } + + synopsis.push('```') + + if (!workspaces) { + synopsis.push('', 'Note: This command is unaware of workspaces.') + } + + return src.replace(replacer, synopsis.join('\n')) +} + +const replaceParams = (src, { path }) => { + const { params } = getCommandByDoc(path, DOC_EXT) + const replacer = params && assertPlaceholder(src, path, TAGS.CONFIG) + + if (!params) { + return src + } + + const paramsConfig = params.map((n) => definitions[n].describe()) + + return src.replace(replacer, paramsConfig.join('\n\n')) +} + +const replaceConfig = (src, { path }) => { + const replacer = assertPlaceholder(src, path, TAGS.CONFIG) + + // sort not-deprecated ones to the top + /* istanbul ignore next - typically already sorted in the definitions file, + * but this is here so that our help doc will stay consistent if we decide + * to move them around. */ + const sort = ([keya, { deprecated: depa }], [keyb, { deprecated: depb }]) => { + return depa && !depb ? 1 + : !depa && depb ? -1 + : localeCompare(keya, keyb) + } + + const allConfig = Object.entries(definitions).sort(sort) + .map(([, def]) => def.describe()) + .join('\n\n') + + return src.replace(replacer, allConfig) +} + +const replaceShorthands = (src, { path }) => { + const replacer = assertPlaceholder(src, path, TAGS.SHORTHANDS) + + const sh = Object.entries(shorthands) + .sort(([shorta, expansiona], [shortb, expansionb]) => + // sort by what they're short FOR + localeCompare(expansiona.join(' '), expansionb.join(' ')) || localeCompare(shorta, shortb) + ) + .map(([short, expansion]) => { + // XXX: this is incorrect. we have multicharacter flags like `-iwr` that + // can only be set with a single dash + const dash = short.length === 1 ? '-' : '--' + return `* \`${dash}${short}\`: \`${expansion.join(' ')}\`` + }) + + return src.replace(replacer, sh.join('\n')) +} + +const replaceHelpLinks = (src) => { + // replaces markdown links with equivalent-ish npm help commands + return src.replace( + /\[`?([\w\s-]+)`?\]\(\/(?:commands|configuring-npm|using-npm)\/(?:[\w\s-]+)\)/g, + (_, p1) => { + const term = p1.replace(/npm\s/g, '').replace(/\s+/g, ' ').trim() + const help = `npm help ${term.includes(' ') ? `"${term}"` : term}` + return help + } + ) +} + +const transformMan = (src, { data, unified, remarkParse, remarkMan }) => unified() + .use(remarkParse) + .use(remarkMan, { version: `NPM@${version}` }) + .processSync(`# ${data.title}(${data.section}) - ${data.description}\n\n${src}`) + .toString() + +const manPath = (name, { data }) => join(`man${data.section}`, `${name}.${data.section}`) + +const transformMd = (src, { frontmatter }) => ['---', frontmatter, '---', '', src].join('\n') + +module.exports = { + DOC_EXT, + TAGS, + paths: { + content: resolve(__dirname, 'content'), + nav: resolve(__dirname, 'content', 'nav.yml'), + template: resolve(__dirname, 'template.html'), + man: resolve(__dirname, '..', '..', 'man'), + html: resolve(__dirname, '..', 'output'), + md: resolve(__dirname, '..', 'content'), + }, + usage: replaceUsage, + params: replaceParams, + config: replaceConfig, + shorthands: replaceShorthands, + version: replaceVersion, + helpLinks: replaceHelpLinks, + man: transformMan, + manPath: manPath, + md: transformMd, + html: transformHTML, +} diff --git a/node_modules/npm/docs/output/commands/npm-access.html b/node_modules/npm/docs/output/commands/npm-access.html new file mode 100644 index 00000000..705489bb --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-access.html @@ -0,0 +1,270 @@ + + +npm-access + + + + + +
    +
    +

    + npm-access + @11.0.0 +

    +Set access level on published packages +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm access list packages [<user>|<scope>|<scope:team>] [<package>]
    +npm access list collaborators [<package> [<user>]]
    +npm access get status [<package>]
    +npm access set status=public|private [<package>]
    +npm access set mfa=none|publish|automation [<package>]
    +npm access grant <read-only|read-write> <scope:team> [<package>]
    +npm access revoke <scope:team> [<package>]
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Used to set access controls on private packages.

    +

    For all of the subcommands, npm access will perform actions on the packages +in the current working directory if no package name is passed to the +subcommand.

    +
      +
    • +

      public / restricted (deprecated): +Set a package to be either publicly accessible or restricted.

      +
    • +
    • +

      grant / revoke (deprecated): +Add or remove the ability of users and teams to have read-only or read-write +access to a package.

      +
    • +
    • +

      2fa-required / 2fa-not-required (deprecated): +Configure whether a package requires that anyone publishing it have two-factor +authentication enabled on their account.

      +
    • +
    • +

      ls-packages (deprecated): +Show all of the packages a user or a team is able to access, along with the +access level, except for read-only public packages (it won't print the whole +registry listing)

      +
    • +
    • +

      ls-collaborators (deprecated): +Show all of the access privileges for a package. Will only show permissions +for packages to which you have at least read access. If <user> is passed in, +the list is filtered only to teams that user happens to belong to.

      +
    • +
    • +

      edit (not implemented)

      +
    • +
    +

    Details

    +

    npm access always operates directly on the current registry, configurable +from the command line using --registry=<registry url>.

    +

    Unscoped packages are always public.

    +

    Scoped packages default to restricted, but you can either publish them as +public using npm publish --access=public, or set their access as public using +npm access public after the initial publish.

    +

    You must have privileges to set the access of a package:

    +
      +
    • You are an owner of an unscoped or scoped package.
    • +
    • You are a member of the team that owns a scope.
    • +
    • You have been given read-write privileges for a package, either as a member +of a team or directly as an owner.
    • +
    +

    If you have two-factor authentication enabled then you'll be prompted to provide a second factor, or may use the --otp=... option to specify it on +the command line.

    +

    If your account is not paid, then attempts to publish scoped packages will +fail with an HTTP 402 status code (logically enough), unless you use +--access=public.

    +

    Management of teams and team memberships is done with the npm team command.

    +

    Configuration

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    registry

    + +

    The base URL of the npm registry.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-adduser.html b/node_modules/npm/docs/output/commands/npm-adduser.html new file mode 100644 index 00000000..c71dd30b --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-adduser.html @@ -0,0 +1,226 @@ + + +npm-adduser + + + + + +
    +
    +

    + npm-adduser + @11.0.0 +

    +Add a registry user account +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm adduser
    +
    +alias: add-user
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Create a new user in the specified registry, and save the credentials to +the .npmrc file. If no registry is specified, the default registry +will be used (see registry).

    +

    When using legacy for your auth-type, the username, password, and +email are read in from prompts.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    scope

    +
      +
    • Default: the scope of the current project, if any, or ""
    • +
    • Type: String
    • +
    +

    Associate an operation with a scope for a scoped registry.

    +

    Useful when logging in to or out of a private registry:

    +
    # log in, linking the scope to the custom registry
    +npm login --scope=@mycorp --registry=https://registry.mycorp.com
    +
    +# log out, removing the link and the auth token
    +npm logout --scope=@mycorp
    +
    +

    This will cause @mycorp to be mapped to the registry for future +installation of packages specified according to the pattern +@mycorp/package.

    +

    This will also cause npm init to create a scoped package.

    +
    # accept all defaults, and create a package named "@foo/whatever",
    +# instead of just named "whatever"
    +npm init --scope=@foo --yes
    +
    +

    auth-type

    +
      +
    • Default: "web"
    • +
    • Type: "legacy" or "web"
    • +
    +

    What authentication strategy to use with login. Note that if an otp +config is given, this value will always be set to legacy.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-audit.html b/node_modules/npm/docs/output/commands/npm-audit.html new file mode 100644 index 00000000..15c2d512 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-audit.html @@ -0,0 +1,517 @@ + + +npm-audit + + + + + +
    +
    +

    + npm-audit + @11.0.0 +

    +Run a security audit +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm audit [fix|signatures]
    +
    +

    Description

    +

    The audit command submits a description of the dependencies configured in +your project to your default registry and asks for a report of known +vulnerabilities. If any vulnerabilities are found, then the impact and +appropriate remediation will be calculated. If the fix argument is +provided, then remediations will be applied to the package tree.

    +

    The command will exit with a 0 exit code if no vulnerabilities were found.

    +

    Note that some vulnerabilities cannot be fixed automatically and will +require manual intervention or review. Also note that since npm audit fix runs a full-fledged npm install under the hood, all configs that +apply to the installer will also apply to npm install -- so things like +npm audit fix --package-lock-only will work as expected.

    +

    By default, the audit command will exit with a non-zero code if any +vulnerability is found. It may be useful in CI environments to include the +--audit-level parameter to specify the minimum vulnerability level that +will cause the command to fail. This option does not filter the report +output, it simply changes the command's failure threshold.

    +

    Package lock

    +

    By default npm requires a package-lock or shrinkwrap in order to run the +audit. You can bypass the package lock with --no-package-lock but be +aware the results may be different with every run, since npm will +re-build the dependency tree each time.

    +

    Audit Signatures

    +

    To ensure the integrity of packages you download from the public npm registry, or any registry that supports signatures, you can verify the registry signatures of downloaded packages using the npm CLI.

    +

    Registry signatures can be verified using the following audit command:

    +
    $ npm audit signatures
    +
    +

    The audit signatures command will also verify the provenance attestations of +downloaded packages. Because provenance attestations are such a new feature, +security features may be added to (or changed in) the attestation format over +time. To ensure that you're always able to verify attestation signatures check +that you're running the latest version of the npm CLI. Please note this often +means updating npm beyond the version that ships with Node.js.

    +

    The npm CLI supports registry signatures and signing keys provided by any registry if the following conventions are followed:

    +
      +
    1. Signatures are provided in the package's packument in each published version within the dist object:
    2. +
    +
    "dist":{
    +  "..omitted..": "..omitted..",
    +  "signatures": [{
    +    "keyid": "SHA256:{{SHA256_PUBLIC_KEY}}",
    +    "sig": "a312b9c3cb4a1b693e8ebac5ee1ca9cc01f2661c14391917dcb111517f72370809..."
    +  }]
    +}
    +
    +

    See this example of a signed package from the public npm registry.

    +

    The sig is generated using the following template: ${package.name}@${package.version}:${package.dist.integrity} and the keyid has to match one of the public signing keys below.

    +
      +
    1. Public signing keys are provided at registry-host.tld/-/npm/v1/keys in the following format:
    2. +
    +
    {
    +  "keys": [{
    +    "expires": null,
    +    "keyid": "SHA256:{{SHA256_PUBLIC_KEY}}",
    +    "keytype": "ecdsa-sha2-nistp256",
    +    "scheme": "ecdsa-sha2-nistp256",
    +    "key": "{{B64_PUBLIC_KEY}}"
    +  }]
    +}
    +
    +

    Keys response:

    +
      +
    • expires: null or a simplified extended ISO 8601 format: YYYY-MM-DDTHH:mm:ss.sssZ
    • +
    • keydid: sha256 fingerprint of the public key
    • +
    • keytype: only ecdsa-sha2-nistp256 is currently supported by the npm CLI
    • +
    • scheme: only ecdsa-sha2-nistp256 is currently supported by the npm CLI
    • +
    • key: base64 encoded public key
    • +
    +

    See this example key's response from the public npm registry.

    +

    Audit Endpoints

    +

    There are two audit endpoints that npm may use to fetch vulnerability +information: the Bulk Advisory endpoint and the Quick Audit endpoint.

    +

    Bulk Advisory Endpoint

    +

    As of version 7, npm uses the much faster Bulk Advisory endpoint to +optimize the speed of calculating audit results.

    +

    npm will generate a JSON payload with the name and list of versions of each +package in the tree, and POST it to the default configured registry at +the path /-/npm/v1/security/advisories/bulk.

    +

    Any packages in the tree that do not have a version field in their +package.json file will be ignored. If any --omit options are specified +(either via the --omit config, or one of the +shorthands such as --production, --only=dev, and so on), then packages will +be omitted from the submitted payload as appropriate.

    +

    If the registry responds with an error, or with an invalid response, then +npm will attempt to load advisory data from the Quick Audit endpoint.

    +

    The expected result will contain a set of advisory objects for each +dependency that matches the advisory range. Each advisory object contains +a name, url, id, severity, vulnerable_versions, and title.

    +

    npm then uses these advisory objects to calculate vulnerabilities and +meta-vulnerabilities of the dependencies within the tree.

    +

    Quick Audit Endpoint

    +

    If the Bulk Advisory endpoint returns an error, or invalid data, npm will +attempt to load advisory data from the Quick Audit endpoint, which is +considerably slower in most cases.

    +

    The full package tree as found in package-lock.json is submitted, along +with the following pieces of additional metadata:

    +
      +
    • npm_version
    • +
    • node_version
    • +
    • platform
    • +
    • arch
    • +
    • node_env
    • +
    +

    All packages in the tree are submitted to the Quick Audit endpoint. +Omitted dependency types are skipped when generating the report.

    +

    Scrubbing

    +

    Out of an abundance of caution, npm versions 5 and 6 would "scrub" any +packages from the submitted report if their name contained a / character, +so as to avoid leaking the names of potentially private packages or git +URLs.

    +

    However, in practice, this resulted in audits often failing to properly +detect meta-vulnerabilities, because the tree would appear to be invalid +due to missing dependencies, and prevented the detection of vulnerabilities +in package trees that used git dependencies or private modules.

    +

    This scrubbing has been removed from npm as of version 7.

    +

    Calculating Meta-Vulnerabilities and Remediations

    +

    npm uses the +@npmcli/metavuln-calculator +module to turn a set of security advisories into a set of "vulnerability" +objects. A "meta-vulnerability" is a dependency that is vulnerable by +virtue of dependence on vulnerable versions of a vulnerable package.

    +

    For example, if the package foo is vulnerable in the range >=1.0.2 <2.0.0, and the package bar depends on foo@^1.1.0, then that version +of bar can only be installed by installing a vulnerable version of foo. +In this case, bar is a "metavulnerability".

    +

    Once metavulnerabilities for a given package are calculated, they are +cached in the ~/.npm folder and only re-evaluated if the advisory range +changes, or a new version of the package is published (in which case, the +new version is checked for metavulnerable status as well).

    +

    If the chain of metavulnerabilities extends all the way to the root +project, and it cannot be updated without changing its dependency ranges, +then npm audit fix will require the --force option to apply the +remediation. If remediations do not require changes to the dependency +ranges, then all vulnerable packages will be updated to a version that does +not have an advisory or metavulnerability posted against it.

    +

    Exit Code

    +

    The npm audit command will exit with a 0 exit code if no vulnerabilities +were found. The npm audit fix command will exit with 0 exit code if no +vulnerabilities are found or if the remediation is able to successfully +fix all vulnerabilities.

    +

    If vulnerabilities were found the exit code will depend on the +audit-level config.

    +

    Examples

    +

    Scan your project for vulnerabilities and automatically install any compatible +updates to vulnerable dependencies:

    +
    $ npm audit fix
    +
    +

    Run audit fix without modifying node_modules, but still updating the +pkglock:

    +
    $ npm audit fix --package-lock-only
    +
    +

    Skip updating devDependencies:

    +
    $ npm audit fix --only=prod
    +
    +

    Have audit fix install SemVer-major updates to toplevel dependencies, not +just SemVer-compatible ones:

    +
    $ npm audit fix --force
    +
    +

    Do a dry run to get an idea of what audit fix will do, and also output +install information in JSON format:

    +
    $ npm audit fix --dry-run --json
    +
    +

    Scan your project for vulnerabilities and just show the details, without +fixing anything:

    +
    $ npm audit
    +
    +

    Get the detailed audit report in JSON format:

    +
    $ npm audit --json
    +
    +

    Fail an audit only if the results include a vulnerability with a level of moderate or higher:

    +
    $ npm audit --audit-level=moderate
    +
    +

    Configuration

    +

    audit-level

    +
      +
    • Default: null
    • +
    • Type: null, "info", "low", "moderate", "high", "critical", or "none"
    • +
    +

    The minimum level of vulnerability for npm audit to exit with a non-zero +exit code.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    force

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Removes various protections against unfortunate side effects, common +mistakes, unnecessary performance degradation, and malicious input.

    +
      +
    • Allow clobbering non-npm files in global installs.
    • +
    • Allow the npm version command to work on an unclean git repository.
    • +
    • Allow deleting the cache folder with npm cache clean.
    • +
    • Allow installing packages that have an engines declaration requiring a +different version of npm.
    • +
    • Allow installing packages that have an engines declaration requiring a +different version of node, even if --engine-strict is enabled.
    • +
    • Allow npm audit fix to install modules outside your stated dependency +range (including SemVer-major changes).
    • +
    • Allow unpublishing all versions of a published package.
    • +
    • Allow conflicting peerDependencies to be installed in the root project.
    • +
    • Implicitly set --yes during npm init.
    • +
    • Allow clobbering existing values in npm pkg
    • +
    • Allow unpublishing of entire packages (not just a single version).
    • +
    +

    If you don't have a clear idea of what you want to do, it is strongly +recommended that you do not use this option!

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    package-lock-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, the current operation will only use the package-lock.json, +ignoring node_modules.

    +

    For update this means only the package-lock.json will be updated, +instead of checking node_modules and downloading dependencies.

    +

    For list this means the output will be based on the tree described by the +package-lock.json, rather than the contents of node_modules.

    +

    package-lock

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to false, then ignore package-lock.json files when installing. This +will also prevent writing package-lock.json if save is true.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    foreground-scripts

    +
      +
    • Default: false unless when using npm pack or npm publish where it +defaults to true
    • +
    • Type: Boolean
    • +
    +

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-bugs.html b/node_modules/npm/docs/output/commands/npm-bugs.html new file mode 100644 index 00000000..6afee019 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-bugs.html @@ -0,0 +1,251 @@ + + +npm-bugs + + + + + +
    +
    +

    + npm-bugs + @11.0.0 +

    +Report bugs for a package in a web browser +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm bugs [<pkgname> [<pkgname> ...]]
    +
    +alias: issues
    +
    +

    Description

    +

    This command tries to guess at the likely location of a package's bug +tracker URL or the mailto URL of the support email, and then tries to +open it using the --browser config param. If no +package name is provided, it will search for a package.json in the current +folder and use the name property.

    +

    Configuration

    +

    browser

    +
      +
    • Default: OS X: "open", Windows: "start", Others: "xdg-open"
    • +
    • Type: null, Boolean, or String
    • +
    +

    The browser that is called by npm commands to open websites.

    +

    Set to false to suppress browser behavior and instead print urls to +terminal.

    +

    Set to true to use default system URL opener.

    +

    registry

    + +

    The base URL of the npm registry.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-cache.html b/node_modules/npm/docs/output/commands/npm-cache.html new file mode 100644 index 00000000..dc0e1d77 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-cache.html @@ -0,0 +1,244 @@ + + +npm-cache + + + + + +
    +
    +

    + npm-cache + @11.0.0 +

    +Manipulates packages cache +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm cache add <package-spec>
    +npm cache clean [<key>]
    +npm cache ls [<name>@<version>]
    +npm cache verify
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Used to add, list, or clean the npm cache folder.

    +
      +
    • +

      add: +Add the specified packages to the local cache. This command is primarily +intended to be used internally by npm, but it can provide a way to +add data to the local installation cache explicitly.

      +
    • +
    • +

      clean: +Delete all data out of the cache folder. Note that this is typically +unnecessary, as npm's cache is self-healing and resistant to data +corruption issues.

      +
    • +
    • +

      verify: +Verify the contents of the cache folder, garbage collecting any unneeded +data, and verifying the integrity of the cache index and all cached data.

      +
    • +
    +

    Details

    +

    npm stores cache data in an opaque directory within the configured cache, +named _cacache. This directory is a +cacache-based content-addressable cache that +stores all http request data as well as other package-related data. This +directory is primarily accessed through pacote, the library responsible +for all package fetching as of npm@5.

    +

    All data that passes through the cache is fully verified for integrity on +both insertion and extraction. Cache corruption will either trigger an +error, or signal to pacote that the data must be refetched, which it will +do automatically. For this reason, it should never be necessary to clear +the cache for any reason other than reclaiming disk space, thus why clean +now requires --force to run.

    +

    There is currently no method exposed through npm to inspect or directly +manage the contents of this cache. In order to access it, cacache must be +used directly.

    +

    npm will not remove data by itself: the cache will grow as new packages are +installed.

    +

    A note about the cache's design

    +

    The npm cache is strictly a cache: it should not be relied upon as a +persistent and reliable data store for package data. npm makes no guarantee +that a previously-cached piece of data will be available later, and will +automatically delete corrupted contents. The primary guarantee that the +cache makes is that, if it does return data, that data will be exactly the +data that was inserted.

    +

    To run an offline verification of existing cache contents, use npm cache verify.

    +

    Configuration

    +

    cache

    +
      +
    • Default: Windows: %LocalAppData%\npm-cache, Posix: ~/.npm
    • +
    • Type: Path
    • +
    +

    The location of npm's cache directory.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-ci.html b/node_modules/npm/docs/output/commands/npm-ci.html new file mode 100644 index 00000000..da9bef01 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-ci.html @@ -0,0 +1,406 @@ + + +npm-ci + + + + + +
    +
    +

    + npm-ci + @11.0.0 +

    +Clean install a project +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm ci
    +
    +aliases: clean-install, ic, install-clean, isntall-clean
    +
    +

    Description

    +

    This command is similar to npm install, except +it's meant to be used in automated environments such as test platforms, +continuous integration, and deployment -- or any situation where you want +to make sure you're doing a clean install of your dependencies.

    +

    The main differences between using npm install and npm ci are:

    +
      +
    • The project must have an existing package-lock.json or +npm-shrinkwrap.json.
    • +
    • If dependencies in the package lock do not match those in package.json, +npm ci will exit with an error, instead of updating the package lock.
    • +
    • npm ci can only install entire projects at a time: individual +dependencies cannot be added with this command.
    • +
    • If a node_modules is already present, it will be automatically removed +before npm ci begins its install.
    • +
    • It will never write to package.json or any of the package-locks: +installs are essentially frozen.
    • +
    +

    NOTE: If you create your package-lock.json file by running npm install +with flags that can affect the shape of your dependency tree, such as +--legacy-peer-deps or --install-links, you must provide the same +flags to npm ci or you are likely to encounter errors. An easy way to do +this is to run, for example, +npm config set legacy-peer-deps=true --location=project and commit the +.npmrc file to your repo.

    +

    Example

    +

    Make sure you have a package-lock and an up-to-date install:

    +
    $ cd ./my/npm/project
    +$ npm install
    +added 154 packages in 10s
    +$ ls | grep package-lock
    +
    +

    Run npm ci in that project

    +
    $ npm ci
    +added 154 packages in 5s
    +
    +

    Configure Travis CI to build using npm ci instead of npm install:

    +
    # .travis.yml
    +install:
    +- npm ci
    +# keep the npm cache around to speed up installs
    +cache:
    +  directories:
    +  - "$HOME/.npm"
    +
    +

    Configuration

    +

    install-strategy

    +
      +
    • Default: "hoisted"
    • +
    • Type: "hoisted", "nested", "shallow", or "linked"
    • +
    +

    Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted.

    +

    legacy-bundling

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=nested
    • +
    +

    Instead of hoisting package installs in node_modules, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets --install-strategy=nested.

    +

    global-style

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=shallow
    • +
    +

    Only install direct dependencies in the top level node_modules, but hoist +on deeper dependencies. Sets --install-strategy=shallow.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    strict-peer-deps

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, and --legacy-peer-deps is not set, then any +conflicting peerDependencies will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships.

    +

    By default, conflicting peerDependencies deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's peerDependencies object.

    +

    When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If --strict-peer-deps is set, then +this warning is treated as a failure.

    +

    foreground-scripts

    +
      +
    • Default: false unless when using npm pack or npm publish where it +defaults to true
    • +
    • Type: Boolean
    • +
    +

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    audit

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for npm audit for details on what is +submitted.

    + +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tells npm to create symlinks (or .cmd shims on Windows) for package +executables.

    +

    Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems.

    +

    fund

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" displays the message at the end of each npm install +acknowledging the number of dependencies looking for funding. See npm fund for details.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-completion.html b/node_modules/npm/docs/output/commands/npm-completion.html new file mode 100644 index 00000000..687fd873 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-completion.html @@ -0,0 +1,194 @@ + + +npm-completion + + + + + +
    +
    +

    + npm-completion + @11.0.0 +

    +Tab Completion for npm +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm completion
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Enables tab-completion in all npm commands.

    +

    The synopsis above +loads the completions into your current shell. Adding it to +your ~/.bashrc or ~/.zshrc will make the completions available +everywhere:

    +
    npm completion >> ~/.bashrc
    +npm completion >> ~/.zshrc
    +
    +

    You may of course also pipe the output of npm completion to a file +such as /usr/local/etc/bash_completion.d/npm or +/etc/bash_completion.d/npm if you have a system that will read +that file for you.

    +

    When COMP_CWORD, COMP_LINE, and COMP_POINT are defined in the +environment, npm completion acts in "plumbing mode", and outputs +completions based on the arguments.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-config.html b/node_modules/npm/docs/output/commands/npm-config.html new file mode 100644 index 00000000..6db882f8 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-config.html @@ -0,0 +1,291 @@ + + +npm-config + + + + + +
    +
    +

    + npm-config + @11.0.0 +

    +Manage the npm configuration files +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm config set <key>=<value> [<key>=<value> ...]
    +npm config get [<key> [<key> ...]]
    +npm config delete <key> [<key> ...]
    +npm config list [--json]
    +npm config edit
    +npm config fix
    +
    +alias: c
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    npm gets its config settings from the command line, environment +variables, npmrc files, and in some cases, the package.json file.

    +

    See npmrc for more information about the npmrc +files.

    +

    See config for a more thorough explanation of the +mechanisms involved, and a full list of config options available.

    +

    The npm config command can be used to update and edit the contents +of the user and global npmrc files.

    +

    Sub-commands

    +

    Config supports the following sub-commands:

    +

    set

    +
    npm config set key=value [key=value...]
    +npm set key=value [key=value...]
    +
    +

    Sets each of the config keys to the value provided. Modifies the user configuration +file unless location is passed.

    +

    If value is omitted, the key will be removed from your config file entirely.

    +

    Note: for backwards compatibility, npm config set key value is supported +as an alias for npm config set key=value.

    +

    get

    +
    npm config get [key ...]
    +npm get [key ...]
    +
    +

    Echo the config value(s) to stdout.

    +

    If multiple keys are provided, then the values will be prefixed with the +key names.

    +

    If no keys are provided, then this command behaves the same as npm config list.

    +

    list

    +
    npm config list
    +
    +

    Show all the config settings. Use -l to also show defaults. Use --json +to show the settings in json format.

    +

    delete

    +
    npm config delete key [key ...]
    +
    +

    Deletes the specified keys from all configuration files.

    +

    edit

    +
    npm config edit
    +
    +

    Opens the config file in an editor. Use the --global flag to edit the +global config.

    +

    fix

    +
    npm config fix
    +
    +

    Attempts to repair invalid configuration items. Usually this means +attaching authentication config (i.e. _auth, _authToken) to the +configured registry.

    +

    Configuration

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    editor

    +
      +
    • Default: The EDITOR or VISUAL environment variables, or +'%SYSTEMROOT%\notepad.exe' on Windows, or 'vi' on Unix systems
    • +
    • Type: String
    • +
    +

    The command to run for npm edit and npm config edit.

    +

    location

    +
      +
    • Default: "user" unless --global is passed, which will also set this value +to "global"
    • +
    • Type: "global", "user", or "project"
    • +
    +

    When passed to npm config this refers to which config file to use.

    +

    When set to "global" mode, packages are installed into the prefix folder +instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    long

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Show extended information in ls, search, and help-search.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-dedupe.html b/node_modules/npm/docs/output/commands/npm-dedupe.html new file mode 100644 index 00000000..598f7ff9 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-dedupe.html @@ -0,0 +1,403 @@ + + +npm-dedupe + + + + + +
    +
    +

    + npm-dedupe + @11.0.0 +

    +Reduce duplication in the package tree +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm dedupe
    +
    +alias: ddp
    +
    +

    Description

    +

    Searches the local package tree and attempts to simplify the overall +structure by moving dependencies further up the tree, where they can +be more effectively shared by multiple dependent packages.

    +

    For example, consider this dependency graph:

    +
    a
    ++-- b <-- depends on c@1.0.x
    +|   `-- c@1.0.3
    +`-- d <-- depends on c@~1.0.9
    +    `-- c@1.0.10
    +
    +

    In this case, npm dedupe will transform the tree to:

    +
    a
    ++-- b
    ++-- d
    +`-- c@1.0.10
    +
    +

    Because of the hierarchical nature of node's module lookup, b and d +will both get their dependency met by the single c package at the root +level of the tree.

    +

    In some cases, you may have a dependency graph like this:

    +
    a
    ++-- b <-- depends on c@1.0.x
    ++-- c@1.0.3
    +`-- d <-- depends on c@1.x
    +    `-- c@1.9.9
    +
    +

    During the installation process, the c@1.0.3 dependency for b was +placed in the root of the tree. Though d's dependency on c@1.x could +have been satisfied by c@1.0.3, the newer c@1.9.0 dependency was used, +because npm favors updates by default, even when doing so causes +duplication.

    +

    Running npm dedupe will cause npm to note the duplication and +re-evaluate, deleting the nested c module, because the one in the root is +sufficient.

    +

    To prefer deduplication over novelty during the installation process, run +npm install --prefer-dedupe or npm config set prefer-dedupe true.

    +

    Arguments are ignored. Dedupe always acts on the entire tree.

    +

    Note that this operation transforms the dependency tree, but will never +result in new modules being installed.

    +

    Using npm find-dupes will run the command in --dry-run mode.

    +

    Note: npm dedupe will never update the semver values of direct +dependencies in your project package.json, if you want to update +values in package.json you can run: npm update --save instead.

    +

    Configuration

    +

    install-strategy

    +
      +
    • Default: "hoisted"
    • +
    • Type: "hoisted", "nested", "shallow", or "linked"
    • +
    +

    Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted.

    +

    legacy-bundling

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=nested
    • +
    +

    Instead of hoisting package installs in node_modules, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets --install-strategy=nested.

    +

    global-style

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=shallow
    • +
    +

    Only install direct dependencies in the top level node_modules, but hoist +on deeper dependencies. Sets --install-strategy=shallow.

    +

    strict-peer-deps

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, and --legacy-peer-deps is not set, then any +conflicting peerDependencies will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships.

    +

    By default, conflicting peerDependencies deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's peerDependencies object.

    +

    When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If --strict-peer-deps is set, then +this warning is treated as a failure.

    +

    package-lock

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to false, then ignore package-lock.json files when installing. This +will also prevent writing package-lock.json if save is true.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    audit

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for npm audit for details on what is +submitted.

    + +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tells npm to create symlinks (or .cmd shims on Windows) for package +executables.

    +

    Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems.

    +

    fund

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" displays the message at the end of each npm install +acknowledging the number of dependencies looking for funding. See npm fund for details.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-deprecate.html b/node_modules/npm/docs/output/commands/npm-deprecate.html new file mode 100644 index 00000000..88e4c468 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-deprecate.html @@ -0,0 +1,214 @@ + + +npm-deprecate + + + + + +
    +
    +

    + npm-deprecate + @11.0.0 +

    +Deprecate a version of a package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm deprecate <package-spec> <message>
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    This command will update the npm registry entry for a package, providing a +deprecation warning to all who attempt to install it.

    +

    It works on version ranges as well as specific +versions, so you can do something like this:

    +
    npm deprecate my-thing@"< 0.2.3" "critical bug fixed in v0.2.3"
    +
    +

    SemVer ranges passed to this command are interpreted such that they do +include prerelease versions. For example:

    +
    npm deprecate my-thing@1.x "1.x is no longer supported"
    +
    +

    In this case, a version my-thing@1.0.0-beta.0 will also be deprecated.

    +

    You must be the package owner to deprecate something. See the owner and +adduser help topics.

    +

    To un-deprecate a package, specify an empty string ("") for the message +argument. Note that you must use double quotes with no space between them to +format an empty string.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-diff.html b/node_modules/npm/docs/output/commands/npm-diff.html new file mode 100644 index 00000000..d682aff9 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-diff.html @@ -0,0 +1,407 @@ + + +npm-diff + + + + + +
    +
    +

    + npm-diff + @11.0.0 +

    +The registry diff command +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm diff [...<paths>]
    +
    +

    Description

    +

    Similar to its git diff counterpart, this command will print diff patches +of files for packages published to the npm registry.

    +
      +
    • +

      npm diff --diff=<spec-a> --diff=<spec-b>

      +

      Compares two package versions using their registry specifiers, e.g: +npm diff --diff=pkg@1.0.0 --diff=pkg@^2.0.0. It's also possible to +compare across forks of any package, +e.g: npm diff --diff=pkg@1.0.0 --diff=pkg-fork@1.0.0.

      +

      Any valid spec can be used, so that it's also possible to compare +directories or git repositories, +e.g: npm diff --diff=pkg@latest --diff=./packages/pkg

      +

      Here's an example comparing two different versions of a package named +abbrev from the registry:

      +
      npm diff --diff=abbrev@1.1.0 --diff=abbrev@1.1.1
      +
      +

      On success, output looks like:

      +
      diff --git a/package.json b/package.json
      +index v1.1.0..v1.1.1 100644
      +--- a/package.json
      ++++ b/package.json
      +@@ -1,6 +1,6 @@
      + {
      +   "name": "abbrev",
      +-  "version": "1.1.0",
      ++  "version": "1.1.1",
      +   "description": "Like ruby's abbrev module, but in js",
      +   "author": "Isaac Z. Schlueter <i@izs.me>",
      +   "main": "abbrev.js",
      +
      +

      Given the flexible nature of npm specs, you can also target local +directories or git repos just like when using npm install:

      +
      npm diff --diff=https://github.com/npm/libnpmdiff --diff=./local-path
      +
      +

      In the example above we can compare the contents from the package installed +from the git repo at github.com/npm/libnpmdiff with the contents of the +./local-path that contains a valid package, such as a modified copy of +the original.

      +
    • +
    • +

      npm diff (in a package directory, no arguments):

      +

      If the package is published to the registry, npm diff will fetch the +tarball version tagged as latest (this value can be configured using the +tag option) and proceed to compare the contents of files present in that +tarball, with the current files in your local file system.

      +

      This workflow provides a handy way for package authors to see what +package-tracked files have been changed in comparison with the latest +published version of that package.

      +
    • +
    • +

      npm diff --diff=<pkg-name> (in a package directory):

      +

      When using a single package name (with no version or tag specifier) as an +argument, npm diff will work in a similar way to +npm-outdated and reach for the registry to figure out +what current published version of the package named <pkg-name> +will satisfy its dependent declared semver-range. Once that specific +version is known npm diff will print diff patches comparing the +current version of <pkg-name> found in the local file system with +that specific version returned by the registry.

      +

      Given a package named abbrev that is currently installed:

      +
      npm diff --diff=abbrev
      +
      +

      That will request from the registry its most up to date version and +will print a diff output comparing the currently installed version to this +newer one if the version numbers are not the same.

      +
    • +
    • +

      npm diff --diff=<spec-a> (in a package directory):

      +

      Similar to using only a single package name, it's also possible to declare +a full registry specifier version if you wish to compare the local version +of an installed package with the specific version/tag/semver-range provided +in <spec-a>.

      +

      An example: assuming pkg@1.0.0 is installed in the current node_modules +folder, running:

      +
      npm diff --diff=pkg@2.0.0
      +
      +

      It will effectively be an alias to +npm diff --diff=pkg@1.0.0 --diff=pkg@2.0.0.

      +
    • +
    • +

      npm diff --diff=<semver-a> [--diff=<semver-b>] (in a package directory):

      +

      Using npm diff along with semver-valid version numbers is a shorthand +to compare different versions of the current package.

      +

      It needs to be run from a package directory, such that for a package named +pkg running npm diff --diff=1.0.0 --diff=1.0.1 is the same as running +npm diff --diff=pkg@1.0.0 --diff=pkg@1.0.1.

      +

      If only a single argument <version-a> is provided, then the current local +file system is going to be compared against that version.

      +

      Here's an example comparing two specific versions (published to the +configured registry) of the current project directory:

      +
      npm diff --diff=1.0.0 --diff=1.1.0
      +
      +
    • +
    +

    Note that tag names are not valid --diff argument values, if you wish to +compare to a published tag, you must use the pkg@tagname syntax.

    +

    Filtering files

    +

    It's possible to also specify positional arguments using file names or globs +pattern matching in order to limit the result of diff patches to only a subset +of files for a given package, e.g:

    +
    npm diff --diff=pkg@2 ./lib/ CHANGELOG.md
    +
    +

    In the example above the diff output is only going to print contents of files +located within the folder ./lib/ and changed lines of code within the +CHANGELOG.md file.

    +

    Configuration

    +

    diff

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Define arguments to compare in npm diff.

    +

    diff-name-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Prints only filenames when using npm diff.

    +

    diff-unified

    +
      +
    • Default: 3
    • +
    • Type: Number
    • +
    +

    The number of lines of context to print in npm diff.

    +

    diff-ignore-all-space

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Ignore whitespace when comparing lines in npm diff.

    +

    diff-no-prefix

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Do not show any source or destination prefix in npm diff output.

    +

    Note: this causes npm diff to ignore the --diff-src-prefix and +--diff-dst-prefix configs.

    +

    diff-src-prefix

    +
      +
    • Default: "a/"
    • +
    • Type: String
    • +
    +

    Source prefix to be used in npm diff output.

    +

    diff-dst-prefix

    +
      +
    • Default: "b/"
    • +
    • Type: String
    • +
    +

    Destination prefix to be used in npm diff output.

    +

    diff-text

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Treat all files as text in npm diff.

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    tag

    +
      +
    • Default: "latest"
    • +
    • Type: String
    • +
    +

    If you ask npm to install a package and don't tell it a specific version, +then it will install the specified tag.

    +

    It is the tag added to the package@version specified in the npm dist-tag add command, if no explicit tag is given.

    +

    When used by the npm diff command, this is the tag used to fetch the +tarball that will be compared with the local files by default.

    +

    If used in the npm publish command, this is the tag that will be added to +the package submitted to the registry.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-dist-tag.html b/node_modules/npm/docs/output/commands/npm-dist-tag.html new file mode 100644 index 00000000..34698aa4 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-dist-tag.html @@ -0,0 +1,289 @@ + + +npm-dist-tag + + + + + +
    +
    +

    + npm-dist-tag + @11.0.0 +

    +Modify package distribution tags +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm dist-tag add <package-spec (with version)> [<tag>]
    +npm dist-tag rm <package-spec> <tag>
    +npm dist-tag ls [<package-spec>]
    +
    +alias: dist-tags
    +
    +

    Description

    +

    Add, remove, and enumerate distribution tags on a package:

    +
      +
    • +

      add: Tags the specified version of the package with the specified tag, +or the --tag config if not specified. If you have +two-factor authentication on auth-and-writes then you’ll need to include a +one-time password on the command line with +--otp <one-time password>, or go through a second factor flow based on your authtype.

      +
    • +
    • +

      rm: Clear a tag that is no longer in use from the package. If you have +two-factor authentication on auth-and-writes then you’ll need to include +a one-time password on the command line with --otp <one-time password>, +or go through a second factor flow based on your authtype

      +
    • +
    • +

      ls: Show all of the dist-tags for a package, defaulting to the package in +the current prefix. This is the default action if none is specified.

      +
    • +
    +

    A tag can be used when installing packages as a reference to a version instead +of using a specific version number:

    +
    npm install <name>@<tag>
    +
    +

    When installing dependencies, a preferred tagged version may be specified:

    +
    npm install --tag <tag>
    +
    +

    (This also applies to any other commands that resolve and install +dependencies, such as npm dedupe, npm update, and npm audit fix.)

    +

    Publishing a package sets the latest tag to the published version unless the +--tag option is used. For example, npm publish --tag=beta.

    +

    By default, npm install <pkg> (without any @<version> or @<tag> +specifier) installs the latest tag.

    +

    Purpose

    +

    Tags can be used to provide an alias instead of version numbers.

    +

    For example, a project might choose to have multiple streams of development +and use a different tag for each stream, e.g., stable, beta, dev, +canary.

    +

    By default, the latest tag is used by npm to identify the current version +of a package, and npm install <pkg> (without any @<version> or @<tag> +specifier) installs the latest tag. Typically, projects only use the +latest tag for stable release versions, and use other tags for unstable +versions such as prereleases.

    +

    The next tag is used by some projects to identify the upcoming version.

    +

    Other than latest, no tag has any special significance to npm itself.

    +

    Caveats

    +

    This command used to be known as npm tag, which only created new tags, +and so had a different syntax.

    +

    Tags must share a namespace with version numbers, because they are +specified in the same slot: npm install <pkg>@<version> vs +npm install <pkg>@<tag>.

    +

    Tags that can be interpreted as valid semver ranges will be rejected. For +example, v1.4 cannot be used as a tag, because it is interpreted by +semver as >=1.4.0 <1.5.0. See https://github.com/npm/npm/issues/6082.

    +

    The simplest way to avoid semver problems with tags is to use tags that do +not begin with a number or the letter v.

    +

    Configuration

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-docs.html b/node_modules/npm/docs/output/commands/npm-docs.html new file mode 100644 index 00000000..cf0980dd --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-docs.html @@ -0,0 +1,250 @@ + + +npm-docs + + + + + +
    +
    +

    + npm-docs + @11.0.0 +

    +Open documentation for a package in a web browser +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm docs [<pkgname> [<pkgname> ...]]
    +
    +alias: home
    +
    +

    Description

    +

    This command tries to guess at the likely location of a package's +documentation URL, and then tries to open it using the +--browser config param. You can pass multiple +package names at once. If no package name is provided, it will search for a +package.json in the current folder and use the name property.

    +

    Configuration

    +

    browser

    +
      +
    • Default: OS X: "open", Windows: "start", Others: "xdg-open"
    • +
    • Type: null, Boolean, or String
    • +
    +

    The browser that is called by npm commands to open websites.

    +

    Set to false to suppress browser behavior and instead print urls to +terminal.

    +

    Set to true to use default system URL opener.

    +

    registry

    + +

    The base URL of the npm registry.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-doctor.html b/node_modules/npm/docs/output/commands/npm-doctor.html new file mode 100644 index 00000000..c662329e --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-doctor.html @@ -0,0 +1,262 @@ + + +npm-doctor + + + + + +
    +
    +

    + npm-doctor + @11.0.0 +

    +Check the health of your npm environment +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm doctor [connection] [registry] [versions] [environment] [permissions] [cache]
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    npm doctor runs a set of checks to ensure that your npm installation has +what it needs to manage your JavaScript packages. npm is mostly a +standalone tool, but it does have some basic requirements that must be met:

    +
      +
    • Node.js and git must be executable by npm.
    • +
    • The primary npm registry, registry.npmjs.com, or another service that +uses the registry API, is available.
    • +
    • The directories that npm uses, node_modules (both locally and +globally), exist and can be written by the current user.
    • +
    • The npm cache exists, and the package tarballs within it aren't corrupt.
    • +
    +

    Without all of these working properly, npm may not work properly. Many +issues are often attributable to things that are outside npm's code base, +so npm doctor confirms that the npm installation is in a good state.

    +

    Also, in addition to this, there are also very many issue reports due to +using old versions of npm. Since npm is constantly improving, running +npm@latest is better than an old version.

    +

    npm doctor verifies the following items in your environment, and if +there are any recommended changes, it will display them. By default npm +runs all of these checks. You can limit what checks are ran by +specifying them as extra arguments.

    +

    Connecting to the registry

    +

    By default, npm installs from the primary npm registry, +registry.npmjs.org. npm doctor hits a special connection testing +endpoint within the registry. This can also be checked with npm ping. +If this check fails, you may be using a proxy that needs to be +configured, or may need to talk to your IT staff to get access over +HTTPS to registry.npmjs.org.

    +

    This check is done against whichever registry you've configured (you can +see what that is by running npm config get registry), and if you're using +a private registry that doesn't support the /whoami endpoint supported by +the primary registry, this check may fail.

    +

    Checking npm version

    +

    While Node.js may come bundled with a particular version of npm, it's the +policy of the CLI team that we recommend all users run npm@latest if they +can. As the CLI is maintained by a small team of contributors, there are +only resources for a single line of development, so npm's own long-term +support releases typically only receive critical security and regression +fixes. The team believes that the latest tested version of npm is almost +always likely to be the most functional and defect-free version of npm.

    +

    Checking node version

    +

    For most users, in most circumstances, the best version of Node will be the +latest long-term support (LTS) release. Those of you who want access to new +ECMAscript features or bleeding-edge changes to Node's standard library may +be running a newer version, and some may be required to run an older +version of Node because of enterprise change control policies. That's OK! +But in general, the npm team recommends that most users run Node.js LTS.

    +

    Checking configured npm registry

    +

    You may be installing from private package registries for your project or +company. That's great! Others may be following tutorials or StackOverflow +questions in an effort to troubleshoot problems you may be having. +Sometimes, this may entail changing the registry you're pointing at. This +part of npm doctor just lets you, and maybe whoever's helping you with +support, know that you're not using the default registry.

    +

    Checking for git executable in PATH

    +

    While it's documented in the README, it may not be obvious that npm needs +Git installed to do many of the things that it does. Also, in some cases +– especially on Windows – you may have Git set up in such a way that it's +not accessible via your PATH so that npm can find it. This check ensures +that Git is available.

    +

    Permissions checks

    +
      +
    • Your cache must be readable and writable by the user running npm.
    • +
    • Global package binaries must be writable by the user running npm.
    • +
    • Your local node_modules path, if you're running npm doctor with a +project directory, must be readable and writable by the user running npm.
    • +
    +

    Validate the checksums of cached packages

    +

    When an npm package is published, the publishing process generates a +checksum that npm uses at install time to verify that the package didn't +get corrupted in transit. npm doctor uses these checksums to validate the +package tarballs in your local cache (you can see where that cache is +located with npm config get cache). In the event that there are corrupt +packages in your cache, you should probably run npm cache clean -f and +reset the cache.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-edit.html b/node_modules/npm/docs/output/commands/npm-edit.html new file mode 100644 index 00000000..bea9f573 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-edit.html @@ -0,0 +1,198 @@ + + +npm-edit + + + + + +
    +
    +

    + npm-edit + @11.0.0 +

    +Edit an installed package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm edit <pkg>[/<subpkg>...]
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Selects a dependency in the current project and opens the package folder in +the default editor (or whatever you've configured as the npm editor +config -- see npm-config.)

    +

    After it has been edited, the package is rebuilt so as to pick up any +changes in compiled packages.

    +

    For instance, you can do npm install connect to install connect +into your package, and then npm edit connect to make a few +changes to your locally installed copy.

    +

    Configuration

    +

    editor

    +
      +
    • Default: The EDITOR or VISUAL environment variables, or +'%SYSTEMROOT%\notepad.exe' on Windows, or 'vi' on Unix systems
    • +
    • Type: String
    • +
    +

    The command to run for npm edit and npm config edit.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-exec.html b/node_modules/npm/docs/output/commands/npm-exec.html new file mode 100644 index 00000000..3a60bfbe --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-exec.html @@ -0,0 +1,443 @@ + + +npm-exec + + + + + +
    +
    +

    + npm-exec + @11.0.0 +

    +Run a command from a local or remote npm package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm exec -- <pkg>[@<version>] [args...]
    +npm exec --package=<pkg>[@<version>] -- <cmd> [args...]
    +npm exec -c '<cmd> [args...]'
    +npm exec --package=foo -c '<cmd> [args...]'
    +
    +alias: x
    +
    +

    Description

    +

    This command allows you to run an arbitrary command from an npm package +(either one installed locally, or fetched remotely), in a similar context +as running it via npm run.

    +

    Run without positional arguments or --call, this allows you to +interactively run commands in the same sort of shell environment that +package.json scripts are run. Interactive mode is not supported in CI +environments when standard input is a TTY, to prevent hangs.

    +

    Whatever packages are specified by the --package option will be +provided in the PATH of the executed command, along with any locally +installed package executables. The --package option may be +specified multiple times, to execute the supplied command in an environment +where all specified packages are available.

    +

    If any requested packages are not present in the local project +dependencies, then a prompt is printed, which can be suppressed by +providing either --yes or --no. When standard input is not a TTY or a +CI environment is detected, --yes is assumed. The requested packages are +installed to a folder in the npm cache, which is added to the PATH +environment variable in the executed process.

    +

    Package names provided without a specifier will be matched with whatever +version exists in the local project. Package names with a specifier will +only be considered a match if they have the exact same name and version as +the local dependency.

    +

    If no -c or --call option is provided, then the positional arguments +are used to generate the command string. If no --package options +are provided, then npm will attempt to determine the executable name from +the package specifier provided as the first positional argument according +to the following heuristic:

    +
      +
    • If the package has a single entry in its bin field in package.json, +or if all entries are aliases of the same command, then that command +will be used.
    • +
    • If the package has multiple bin entries, and one of them matches the +unscoped portion of the name field, then that command will be used.
    • +
    • If this does not result in exactly one option (either because there are +no bin entries, or none of them match the name of the package), then +npm exec exits with an error.
    • +
    +

    To run a binary other than the named binary, specify one or more +--package options, which will prevent npm from inferring the package from +the first command argument.

    +

    npx vs npm exec

    +

    When run via the npx binary, all flags and options must be set prior to +any positional arguments. When run via npm exec, a double-hyphen -- +flag can be used to suppress npm's parsing of switches and options that +should be sent to the executed command.

    +

    For example:

    +
    $ npx foo@latest bar --package=@npmcli/foo
    +
    +

    In this case, npm will resolve the foo package name, and run the +following command:

    +
    $ foo bar --package=@npmcli/foo
    +
    +

    Since the --package option comes after the positional arguments, it is +treated as an argument to the executed command.

    +

    In contrast, due to npm's argument parsing logic, running this command is +different:

    +
    $ npm exec foo@latest bar --package=@npmcli/foo
    +
    +

    In this case, npm will parse the --package option first, resolving the +@npmcli/foo package. Then, it will execute the following command in that +context:

    +
    $ foo@latest bar
    +
    +

    The double-hyphen character is recommended to explicitly tell npm to stop +parsing command line options and switches. The following command would +thus be equivalent to the npx command above:

    +
    $ npm exec -- foo@latest bar --package=@npmcli/foo
    +
    +

    Configuration

    +

    package

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    The package or packages to install for npm exec

    +

    call

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    Optional companion option for npm exec, npx that allows for specifying a +custom command to be run along with the installed packages.

    +
    npm exec --package yo --package generator-node --call "yo node"
    +
    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    Examples

    +

    Run the version of tap in the local dependencies, with the provided +arguments:

    +
    $ npm exec -- tap --bail test/foo.js
    +$ npx tap --bail test/foo.js
    +
    +

    Run a command other than the command whose name matches the package name +by specifying a --package option:

    +
    $ npm exec --package=foo -- bar --bar-argument
    +# ~ or ~
    +$ npx --package=foo bar --bar-argument
    +
    +

    Run an arbitrary shell script, in the context of the current project:

    +
    $ npm x -c 'eslint && say "hooray, lint passed"'
    +$ npx -c 'eslint && say "hooray, lint passed"'
    +
    +

    Workspaces support

    +

    You may use the workspace or +workspaces configs in order to run an +arbitrary command from an npm package (either one installed locally, or fetched +remotely) in the context of the specified workspaces. +If no positional argument or --call option is provided, it will open an +interactive subshell in the context of each of these configured workspaces one +at a time.

    +

    Given a project with configured workspaces, e.g:

    +
    .
    ++-- package.json
    +`-- packages
    +   +-- a
    +   |   `-- package.json
    +   +-- b
    +   |   `-- package.json
    +   `-- c
    +       `-- package.json
    +
    +

    Assuming the workspace configuration is properly set up at the root level +package.json file. e.g:

    +
    {
    +    "workspaces": [ "./packages/*" ]
    +}
    +
    +

    You can execute an arbitrary command from a package in the context of each of +the configured workspaces when using the +workspaces config options, in this example +we're using eslint to lint any js file found within each workspace folder:

    +
    npm exec --ws -- eslint ./*.js
    +
    +

    Filtering workspaces

    +

    It's also possible to execute a command in a single workspace using the +workspace config along with a name or directory path:

    +
    npm exec --workspace=a -- eslint ./*.js
    +
    +

    The workspace config can also be specified multiple times in order to run a +specific script in the context of multiple workspaces. When defining values for +the workspace config in the command line, it also possible to use -w as a +shorthand, e.g:

    +
    npm exec -w a -w b -- eslint ./*.js
    +
    +

    This last command will run the eslint command in both ./packages/a and +./packages/b folders.

    +

    Compatibility with Older npx Versions

    +

    The npx binary was rewritten in npm v7.0.0, and the standalone npx +package deprecated at that time. npx uses the npm exec +command instead of a separate argument parser and install process, with +some affordances to maintain backwards compatibility with the arguments it +accepted in previous versions.

    +

    This resulted in some shifts in its functionality:

    +
      +
    • Any npm config value may be provided.
    • +
    • To prevent security and user-experience problems from mistyping package +names, npx prompts before installing anything. Suppress this +prompt with the -y or --yes option.
    • +
    • The --no-install option is deprecated, and will be converted to --no.
    • +
    • Shell fallback functionality is removed, as it is not advisable.
    • +
    • The -p argument is a shorthand for --parseable in npm, but shorthand +for --package in npx. This is maintained, but only for the npx +executable.
    • +
    • The --ignore-existing option is removed. Locally installed bins are +always present in the executed process PATH.
    • +
    • The --npm option is removed. npx will always use the npm it ships +with.
    • +
    • The --node-arg and -n options are removed.
    • +
    • The --always-spawn option is redundant, and thus removed.
    • +
    • The --shell option is replaced with --script-shell, but maintained +in the npx executable for backwards compatibility.
    • +
    +

    A note on caching

    +

    The npm cli utilizes its internal package cache when using the package +name specified. You can use the following to change how and when the +cli uses this cache. See npm cache for more on +how the cache works.

    +

    prefer-online

    +

    Forces staleness checks for packages, making the cli look for updates +immediately even if the package is already in the cache.

    +

    prefer-offline

    +

    Bypasses staleness checks for packages. Missing data will still be +requested from the server. To force full offline mode, use offline.

    +

    offline

    +

    Forces full offline mode. Any packages not locally cached will result in +an error.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result to selecting all of the +nested workspaces)
    • +
    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Alias: --ws
    • +
    • Type: Boolean
    • +
    • Default: false
    • +
    +

    Run scripts in the context of all configured workspaces for the current +project.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-explain.html b/node_modules/npm/docs/output/commands/npm-explain.html new file mode 100644 index 00000000..f9a4cfd4 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-explain.html @@ -0,0 +1,250 @@ + + +npm-explain + + + + + +
    +
    +

    + npm-explain + @11.0.0 +

    +Explain installed packages +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm explain <package-spec>
    +
    +alias: why
    +
    +

    Description

    +

    This command will print the chain of dependencies causing a given package +to be installed in the current project.

    +

    If one or more package specs are provided, then only packages matching +one of the specifiers will have their relationships explained.

    +

    The package spec can also refer to a folder within ./node_modules

    +

    For example, running npm explain glob within npm's source tree will show:

    +
    glob@7.1.6
    +node_modules/glob
    +  glob@"^7.1.4" from the root project
    +
    +glob@7.1.1 dev
    +node_modules/tacks/node_modules/glob
    +  glob@"^7.0.5" from rimraf@2.6.2
    +  node_modules/tacks/node_modules/rimraf
    +    rimraf@"^2.6.2" from tacks@1.3.0
    +    node_modules/tacks
    +      dev tacks@"^1.3.0" from the root project
    +
    +

    To explain just the package residing at a specific folder, pass that as the +argument to the command. This can be useful when trying to figure out +exactly why a given dependency is being duplicated to satisfy conflicting +version requirements within the project.

    +
    $ npm explain node_modules/nyc/node_modules/find-up
    +find-up@3.0.0 dev
    +node_modules/nyc/node_modules/find-up
    +  find-up@"^3.0.0" from nyc@14.1.1
    +  node_modules/nyc
    +    nyc@"^14.1.1" from tap@14.10.8
    +    node_modules/tap
    +      dev tap@"^14.10.8" from the root project
    +
    +

    Configuration

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-explore.html b/node_modules/npm/docs/output/commands/npm-explore.html new file mode 100644 index 00000000..63c33e34 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-explore.html @@ -0,0 +1,198 @@ + + +npm-explore + + + + + +
    +
    +

    + npm-explore + @11.0.0 +

    +Browse an installed package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm explore <pkg> [ -- <command>]
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Spawn a subshell in the directory of the installed package specified.

    +

    If a command is specified, then it is run in the subshell, which then +immediately terminates.

    +

    This is particularly handy in the case of git submodules in the +node_modules folder:

    +
    npm explore some-dependency -- git pull origin master
    +
    +

    Note that the package is not automatically rebuilt afterwards, so be +sure to use npm rebuild <pkg> if you make any changes.

    +

    Configuration

    +

    shell

    +
      +
    • Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on +Windows
    • +
    • Type: String
    • +
    +

    The shell to run for the npm explore command.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-find-dupes.html b/node_modules/npm/docs/output/commands/npm-find-dupes.html new file mode 100644 index 00000000..88833715 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-find-dupes.html @@ -0,0 +1,349 @@ + + +npm-find-dupes + + + + + +
    +
    +

    + npm-find-dupes + @11.0.0 +

    +Find duplication in the package tree +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm find-dupes
    +
    +

    Description

    +

    Runs npm dedupe in --dry-run mode, making npm only output the +duplications, without actually changing the package tree.

    +

    Configuration

    +

    install-strategy

    +
      +
    • Default: "hoisted"
    • +
    • Type: "hoisted", "nested", "shallow", or "linked"
    • +
    +

    Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted.

    +

    legacy-bundling

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=nested
    • +
    +

    Instead of hoisting package installs in node_modules, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets --install-strategy=nested.

    +

    global-style

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=shallow
    • +
    +

    Only install direct dependencies in the top level node_modules, but hoist +on deeper dependencies. Sets --install-strategy=shallow.

    +

    strict-peer-deps

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, and --legacy-peer-deps is not set, then any +conflicting peerDependencies will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships.

    +

    By default, conflicting peerDependencies deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's peerDependencies object.

    +

    When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If --strict-peer-deps is set, then +this warning is treated as a failure.

    +

    package-lock

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to false, then ignore package-lock.json files when installing. This +will also prevent writing package-lock.json if save is true.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    audit

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for npm audit for details on what is +submitted.

    + +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tells npm to create symlinks (or .cmd shims on Windows) for package +executables.

    +

    Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems.

    +

    fund

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" displays the message at the end of each npm install +acknowledging the number of dependencies looking for funding. See npm fund for details.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-fund.html b/node_modules/npm/docs/output/commands/npm-fund.html new file mode 100644 index 00000000..56eff2d4 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-fund.html @@ -0,0 +1,275 @@ + + +npm-fund + + + + + +
    +
    +

    + npm-fund + @11.0.0 +

    +Retrieve funding information +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm fund [<package-spec>]
    +
    +

    Description

    +

    This command retrieves information on how to fund the dependencies of a +given project. If no package name is provided, it will list all +dependencies that are looking for funding in a tree structure, listing +the type of funding and the url to visit. If a package name is provided +then it tries to open its funding url using the +--browser config param; if there are multiple +funding sources for the package, the user will be instructed to pass the +--which option to disambiguate.

    +

    The list will avoid duplicated entries and will stack all packages that +share the same url as a single entry. Thus, the list does not have the +same shape of the output from npm ls.

    +

    Example

    +

    Workspaces support

    +

    It's possible to filter the results to only include a single workspace +and its dependencies using the +workspace config option.

    +

    Example:

    +

    Here's an example running npm fund in a project with a configured +workspace a:

    +
    $ npm fund
    +test-workspaces-fund@1.0.0
    ++-- https://example.com/a
    +| | `-- a@1.0.0
    +| `-- https://example.com/maintainer
    +|     `-- foo@1.0.0
    ++-- https://example.com/npmcli-funding
    +|   `-- @npmcli/test-funding
    +`-- https://example.com/org
    +    `-- bar@2.0.0
    +
    +

    And here is an example of the expected result when filtering only by a +specific workspace a in the same project:

    +
    $ npm fund -w a
    +test-workspaces-fund@1.0.0
    +`-- https://example.com/a
    +  | `-- a@1.0.0
    +  `-- https://example.com/maintainer
    +      `-- foo@2.0.0
    +
    +

    Configuration

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    browser

    +
      +
    • Default: OS X: "open", Windows: "start", Others: "xdg-open"
    • +
    • Type: null, Boolean, or String
    • +
    +

    The browser that is called by npm commands to open websites.

    +

    Set to false to suppress browser behavior and instead print urls to +terminal.

    +

    Set to true to use default system URL opener.

    +

    unicode

    +
      +
    • Default: false on windows, true on mac/unix systems with a unicode locale, +as defined by the LC_ALL, LC_CTYPE, or LANG environment variables.
    • +
    • Type: Boolean
    • +
    +

    When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters instead of unicode glyphs.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    which

    +
      +
    • Default: null
    • +
    • Type: null or Number
    • +
    +

    If there are multiple funding sources, which 1-indexed source URL to open.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-help-search.html b/node_modules/npm/docs/output/commands/npm-help-search.html new file mode 100644 index 00000000..cc62294b --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-help-search.html @@ -0,0 +1,192 @@ + + +npm-help-search + + + + + +
    +
    +

    + npm-help-search + @11.0.0 +

    +Search npm help documentation +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm help-search <text>
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    This command will search the npm markdown documentation files for the terms +provided, and then list the results, sorted by relevance.

    +

    If only one result is found, then it will show that help topic.

    +

    If the argument to npm help is not a known help topic, then it will call +help-search. It is rarely if ever necessary to call this command +directly.

    +

    Configuration

    +

    long

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Show extended information in ls, search, and help-search.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-help.html b/node_modules/npm/docs/output/commands/npm-help.html new file mode 100644 index 00000000..f7f60850 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-help.html @@ -0,0 +1,198 @@ + + +npm-help + + + + + +
    +
    +

    + npm-help + @11.0.0 +

    +Get help on npm +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm help <term> [<terms..>]
    +
    +alias: hlep
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    If supplied a topic, then show the appropriate documentation page.

    +

    If the topic does not exist, or if multiple terms are provided, then npm +will run the help-search command to find a match. Note that, if +help-search finds a single subject, then it will run help on that +topic, so unique matches are equivalent to specifying a topic name.

    +

    Configuration

    +

    viewer

    +
      +
    • Default: "man" on Posix, "browser" on Windows
    • +
    • Type: String
    • +
    +

    The program to use to view help content.

    +

    Set to "browser" to view html help content in the default web browser.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-init.html b/node_modules/npm/docs/output/commands/npm-init.html new file mode 100644 index 00000000..0a95b514 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-init.html @@ -0,0 +1,430 @@ + + +npm-init + + + + + +
    +
    +

    + npm-init + @11.0.0 +

    +Create a package.json file +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm init <package-spec> (same as `npx create-<package-spec>`)
    +npm init <@scope> (same as `npx <@scope>/create`)
    +
    +aliases: create, innit
    +
    +

    Description

    +

    npm init <initializer> can be used to set up a new or existing npm +package.

    +

    initializer in this case is an npm package named create-<initializer>, +which will be installed by npm-exec, and then have its +main bin executed -- presumably creating or updating package.json and +running any other initialization-related operations.

    +

    The init command is transformed to a corresponding npm exec operation as +follows:

    +
      +
    • npm init foo -> npm exec create-foo
    • +
    • npm init @usr/foo -> npm exec @usr/create-foo
    • +
    • npm init @usr -> npm exec @usr/create
    • +
    • npm init @usr@2.0.0 -> npm exec @usr/create@2.0.0
    • +
    • npm init @usr/foo@2.0.0 -> npm exec @usr/create-foo@2.0.0
    • +
    +

    If the initializer is omitted (by just calling npm init), init will fall +back to legacy init behavior. It will ask you a bunch of questions, and +then write a package.json for you. It will attempt to make reasonable +guesses based on existing fields, dependencies, and options selected. It is +strictly additive, so it will keep any fields and values that were already +set. You can also use -y/--yes to skip the questionnaire altogether. If +you pass --scope, it will create a scoped package.

    +

    Note: if a user already has the create-<initializer> package +globally installed, that will be what npm init uses. If you want npm +to use the latest version, or another specific version you must specify +it:

    +
      +
    • npm init foo@latest # fetches and runs the latest create-foo from +the registry
    • +
    • npm init foo@1.2.3 # runs create-foo@1.2.3 specifically
    • +
    +

    Forwarding additional options

    +

    Any additional options will be passed directly to the command, so npm init foo -- --hello will map to npm exec -- create-foo --hello.

    +

    To better illustrate how options are forwarded, here's a more evolved +example showing options passed to both the npm cli and a create package, +both following commands are equivalent:

    +
      +
    • npm init foo -y --registry=<url> -- --hello -a
    • +
    • npm exec -y --registry=<url> -- create-foo --hello -a
    • +
    +

    Examples

    +

    Create a new React-based project using +create-react-app:

    +
    $ npm init react-app ./my-react-app
    +
    +

    Create a new esm-compatible package using +create-esm:

    +
    $ mkdir my-esm-lib && cd my-esm-lib
    +$ npm init esm --yes
    +
    +

    Generate a plain old package.json using legacy init:

    +
    $ mkdir my-npm-pkg && cd my-npm-pkg
    +$ git init
    +$ npm init
    +
    +

    Generate it without having it ask any questions:

    +
    $ npm init -y
    +
    +

    Workspaces support

    +

    It's possible to create a new workspace within your project by using the +workspace config option. When using npm init -w <dir> the cli will +create the folders and boilerplate expected while also adding a reference +to your project package.json "workspaces": [] property in order to make +sure that new generated workspace is properly set up as such.

    +

    Given a project with no workspaces, e.g:

    +
    .
    ++-- package.json
    +
    +

    You may generate a new workspace using the legacy init:

    +
    $ npm init -w packages/a
    +
    +

    That will generate a new folder and package.json file, while also updating +your top-level package.json to add the reference to this new workspace:

    +
    .
    ++-- package.json
    +`-- packages
    +   `-- a
    +       `-- package.json
    +
    +

    The workspaces init also supports the npm init <initializer> -w <dir> +syntax, following the same set of rules explained earlier in the initial +Description section of this page. Similar to the previous example of +creating a new React-based project using +create-react-app, the following syntax +will make sure to create the new react app as a nested workspace within your +project and configure your package.json to recognize it as such:

    +
    npm init -w packages/my-react-app react-app .
    +
    +

    This will make sure to generate your react app as expected, one important +consideration to have in mind is that npm exec is going to be run in the +context of the newly created folder for that workspace, and that's the reason +why in this example the initializer uses the initializer name followed with a +dot to represent the current directory in that context, e.g: react-app .:

    +
    .
    ++-- package.json
    +`-- packages
    +   +-- a
    +   |   `-- package.json
    +   `-- my-react-app
    +       +-- README
    +       +-- package.json
    +       `-- ...
    +
    +

    Configuration

    +

    init-author-name

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    The value npm init should use by default for the package author's name.

    +

    init-author-url

    +
      +
    • Default: ""
    • +
    • Type: "" or URL
    • +
    +

    The value npm init should use by default for the package author's +homepage.

    +

    init-license

    +
      +
    • Default: "ISC"
    • +
    • Type: String
    • +
    +

    The value npm init should use by default for the package license.

    +

    init-module

    +
      +
    • Default: "~/.npm-init.js"
    • +
    • Type: Path
    • +
    +

    A module that will be loaded by the npm init command. See the +documentation for the +init-package-json module for +more information, or npm init.

    +

    init-version

    +
      +
    • Default: "1.0.0"
    • +
    • Type: SemVer string
    • +
    +

    The value that npm init should use by default for the package version +number, if not already set in package.json.

    +

    yes

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Automatically answer "yes" to any prompts that npm might print on the +command line.

    +

    force

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Removes various protections against unfortunate side effects, common +mistakes, unnecessary performance degradation, and malicious input.

    +
      +
    • Allow clobbering non-npm files in global installs.
    • +
    • Allow the npm version command to work on an unclean git repository.
    • +
    • Allow deleting the cache folder with npm cache clean.
    • +
    • Allow installing packages that have an engines declaration requiring a +different version of npm.
    • +
    • Allow installing packages that have an engines declaration requiring a +different version of node, even if --engine-strict is enabled.
    • +
    • Allow npm audit fix to install modules outside your stated dependency +range (including SemVer-major changes).
    • +
    • Allow unpublishing all versions of a published package.
    • +
    • Allow conflicting peerDependencies to be installed in the root project.
    • +
    • Implicitly set --yes during npm init.
    • +
    • Allow clobbering existing values in npm pkg
    • +
    • Allow unpublishing of entire packages (not just a single version).
    • +
    +

    If you don't have a clear idea of what you want to do, it is strongly +recommended that you do not use this option!

    +

    scope

    +
      +
    • Default: the scope of the current project, if any, or ""
    • +
    • Type: String
    • +
    +

    Associate an operation with a scope for a scoped registry.

    +

    Useful when logging in to or out of a private registry:

    +
    # log in, linking the scope to the custom registry
    +npm login --scope=@mycorp --registry=https://registry.mycorp.com
    +
    +# log out, removing the link and the auth token
    +npm logout --scope=@mycorp
    +
    +

    This will cause @mycorp to be mapped to the registry for future +installation of packages specified according to the pattern +@mycorp/package.

    +

    This will also cause npm init to create a scoped package.

    +
    # accept all defaults, and create a package named "@foo/whatever",
    +# instead of just named "whatever"
    +npm init --scope=@foo --yes
    +
    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    workspaces-update

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to true, the npm cli will run an update after operations that may +possibly change the workspaces installed to the node_modules folder.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-install-ci-test.html b/node_modules/npm/docs/output/commands/npm-install-ci-test.html new file mode 100644 index 00000000..1ac7a465 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-install-ci-test.html @@ -0,0 +1,364 @@ + + +npm-install-ci-test + + + + + +
    +
    +

    + npm-install-ci-test + @11.0.0 +

    +Install a project with a clean slate and run tests +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm install-ci-test
    +
    +aliases: cit, clean-install-test, sit
    +
    +

    Description

    +

    This command runs npm ci followed immediately by npm test.

    +

    Configuration

    +

    install-strategy

    +
      +
    • Default: "hoisted"
    • +
    • Type: "hoisted", "nested", "shallow", or "linked"
    • +
    +

    Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted.

    +

    legacy-bundling

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=nested
    • +
    +

    Instead of hoisting package installs in node_modules, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets --install-strategy=nested.

    +

    global-style

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=shallow
    • +
    +

    Only install direct dependencies in the top level node_modules, but hoist +on deeper dependencies. Sets --install-strategy=shallow.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    strict-peer-deps

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, and --legacy-peer-deps is not set, then any +conflicting peerDependencies will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships.

    +

    By default, conflicting peerDependencies deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's peerDependencies object.

    +

    When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If --strict-peer-deps is set, then +this warning is treated as a failure.

    +

    foreground-scripts

    +
      +
    • Default: false unless when using npm pack or npm publish where it +defaults to true
    • +
    • Type: Boolean
    • +
    +

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    audit

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for npm audit for details on what is +submitted.

    + +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tells npm to create symlinks (or .cmd shims on Windows) for package +executables.

    +

    Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems.

    +

    fund

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" displays the message at the end of each npm install +acknowledging the number of dependencies looking for funding. See npm fund for details.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-install-test.html b/node_modules/npm/docs/output/commands/npm-install-test.html new file mode 100644 index 00000000..e9c0ec8a --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-install-test.html @@ -0,0 +1,441 @@ + + +npm-install-test + + + + + +
    +
    +

    + npm-install-test + @11.0.0 +

    +Install package(s) and run tests +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm install-test [<package-spec> ...]
    +
    +alias: it
    +
    +

    Description

    +

    This command runs an npm install followed immediately by an npm test. It +takes exactly the same arguments as npm install.

    +

    Configuration

    +

    save

    +
      +
    • Default: true unless when using npm update where it defaults to false
    • +
    • Type: Boolean
    • +
    +

    Save installed packages to a package.json file as dependencies.

    +

    When used with the npm rm command, removes the dependency from +package.json.

    +

    Will also prevent writing to package-lock.json if set to false.

    +

    save-exact

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Dependencies saved to package.json will be configured with an exact version +rather than using npm's default semver range operator.

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    install-strategy

    +
      +
    • Default: "hoisted"
    • +
    • Type: "hoisted", "nested", "shallow", or "linked"
    • +
    +

    Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted.

    +

    legacy-bundling

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=nested
    • +
    +

    Instead of hoisting package installs in node_modules, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets --install-strategy=nested.

    +

    global-style

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=shallow
    • +
    +

    Only install direct dependencies in the top level node_modules, but hoist +on deeper dependencies. Sets --install-strategy=shallow.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    strict-peer-deps

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, and --legacy-peer-deps is not set, then any +conflicting peerDependencies will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships.

    +

    By default, conflicting peerDependencies deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's peerDependencies object.

    +

    When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If --strict-peer-deps is set, then +this warning is treated as a failure.

    +

    prefer-dedupe

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Prefer to deduplicate packages if possible, rather than choosing a newer +version of a dependency.

    +

    package-lock

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to false, then ignore package-lock.json files when installing. This +will also prevent writing package-lock.json if save is true.

    +

    package-lock-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, the current operation will only use the package-lock.json, +ignoring node_modules.

    +

    For update this means only the package-lock.json will be updated, +instead of checking node_modules and downloading dependencies.

    +

    For list this means the output will be based on the tree described by the +package-lock.json, rather than the contents of node_modules.

    +

    foreground-scripts

    +
      +
    • Default: false unless when using npm pack or npm publish where it +defaults to true
    • +
    • Type: Boolean
    • +
    +

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    audit

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for npm audit for details on what is +submitted.

    + +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tells npm to create symlinks (or .cmd shims on Windows) for package +executables.

    +

    Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems.

    +

    fund

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" displays the message at the end of each npm install +acknowledging the number of dependencies looking for funding. See npm fund for details.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    cpu

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    Override CPU architecture of native modules to install. Acceptable values +are same as cpu field of package.json, which comes from process.arch.

    +

    os

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    Override OS of native modules to install. Acceptable values are same as os +field of package.json, which comes from process.platform.

    +

    libc

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    Override libc of native modules to install. Acceptable values are same as +libc field of package.json

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-install.html b/node_modules/npm/docs/output/commands/npm-install.html new file mode 100644 index 00000000..466171e4 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-install.html @@ -0,0 +1,803 @@ + + +npm-install + + + + + +
    +
    +

    + npm-install + @11.0.0 +

    +Install a package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm install [<package-spec> ...]
    +
    +aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
    +
    +

    Description

    +

    This command installs a package and any packages that it depends on. If the +package has a package-lock, or an npm shrinkwrap file, or a yarn lock file, +the installation of dependencies will be driven by that, respecting the +following order of precedence:

    +
      +
    • npm-shrinkwrap.json
    • +
    • package-lock.json
    • +
    • yarn.lock
    • +
    +

    See package-lock.json and +npm shrinkwrap.

    +

    A package is:

    +
      +
    • a) a folder containing a program described by a +package.json file
    • +
    • b) a gzipped tarball containing (a)
    • +
    • c) a url that resolves to (b)
    • +
    • d) a <name>@<version> that is published on the registry (see +registry) with (c)
    • +
    • e) a <name>@<tag> (see npm dist-tag) that +points to (d)
    • +
    • f) a <name> that has a "latest" tag satisfying (e)
    • +
    • g) a <git remote url> that resolves to (a)
    • +
    +

    Even if you never publish your package, you can still get a lot of benefits +of using npm if you just want to write a node program (a), and perhaps if +you also want to be able to easily install it elsewhere after packing it up +into a tarball (b).

    +
      +
    • +

      npm install (in a package directory, no arguments):

      +

      Install the dependencies to the local node_modules folder.

      +

      In global mode (ie, with -g or --global appended to the command), +it installs the current package context (ie, the current working +directory) as a global package.

      +

      By default, npm install will install all modules listed as +dependencies in package.json.

      +

      With the --production flag (or when the NODE_ENV environment +variable is set to production), npm will not install modules listed +in devDependencies. To install all modules listed in both +dependencies and devDependencies when NODE_ENV environment +variable is set to production, you can use --production=false.

      +
      +

      NOTE: The --production flag has no particular meaning when adding a +dependency to a project.

      +
      +
    • +
    • +

      npm install <folder>:

      +

      If <folder> sits inside the root of your project, its dependencies will be installed and may +be hoisted to the top-level node_modules as they would for other +types of dependencies. If <folder> sits outside the root of your project, +npm will not install the package dependencies in the directory <folder>, +but it will create a symlink to <folder>.

      +
      +

      NOTE: If you want to install the content of a directory like a package from the registry instead of creating a link, you would need to use the --install-links option.

      +
      +

      Example:

      +
      npm install ../../other-package --install-links
      +npm install ./sub-package
      +
      +
    • +
    • +

      npm install <tarball file>:

      +

      Install a package that is sitting on the filesystem. Note: if you just +want to link a dev directory into your npm root, you can do this more +easily by using npm link.

      +

      Tarball requirements:

      +
        +
      • The filename must use .tar, .tar.gz, or .tgz as the +extension.
      • +
      • The package contents should reside in a subfolder inside the tarball +(usually it is called package/). npm strips one directory layer +when installing the package (an equivalent of tar x --strip-components=1 is run).
      • +
      • The package must contain a package.json file with name and +version properties.
      • +
      +

      Example:

      +
      npm install ./package.tgz
      +
      +
    • +
    • +

      npm install <tarball url>:

      +

      Fetch the tarball url, and then install it. In order to distinguish between +this and other options, the argument must start with "http://" or "https://"

      +

      Example:

      +
      npm install https://github.com/indexzero/forever/tarball/v0.5.6
      +
      +
    • +
    • +

      npm install [<@scope>/]<name>:

      +

      Do a <name>@<tag> install, where <tag> is the "tag" config. (See +config. The config's default value is latest.)

      +

      In most cases, this will install the version of the modules tagged as +latest on the npm registry.

      +

      Example:

      +
      npm install sax
      +
      +

      npm install saves any specified packages into dependencies by default. +Additionally, you can control where and how they get saved with some +additional flags:

      +
        +
      • +

        -P, --save-prod: Package will appear in your dependencies. This +is the default unless -D or -O are present.

        +
      • +
      • +

        -D, --save-dev: Package will appear in your devDependencies.

        +
      • +
      • +

        --save-peer: Package will appear in your peerDependencies.

        +
      • +
      • +

        -O, --save-optional: Package will appear in your +optionalDependencies.

        +
      • +
      • +

        --no-save: Prevents saving to dependencies.

        +
      • +
      +

      When using any of the above options to save dependencies to your +package.json, there are two additional, optional flags:

      +
        +
      • +

        -E, --save-exact: Saved dependencies will be configured with an +exact version rather than using npm's default semver range operator.

        +
      • +
      • +

        -B, --save-bundle: Saved dependencies will also be added to your +bundleDependencies list.

        +
      • +
      +

      Further, if you have an npm-shrinkwrap.json or package-lock.json +then it will be updated as well.

      +

      <scope> is optional. The package will be downloaded from the registry +associated with the specified scope. If no registry is associated with +the given scope the default registry is assumed. See +scope.

      +

      Note: if you do not include the @-symbol on your scope name, npm will +interpret this as a GitHub repository instead, see below. Scopes names +must also be followed by a slash.

      +

      Examples:

      +
      npm install sax
      +npm install githubname/reponame
      +npm install @myorg/privatepackage
      +npm install node-tap --save-dev
      +npm install dtrace-provider --save-optional
      +npm install readable-stream --save-exact
      +npm install ansi-regex --save-bundle
      +
      +
    • +
    • +

      npm install <alias>@npm:<name>:

      +

      Install a package under a custom alias. Allows multiple versions of +a same-name package side-by-side, more convenient import names for +packages with otherwise long ones, and using git forks replacements +or forked npm packages as replacements. Aliasing works only on your +project and does not rename packages in transitive dependencies. +Aliases should follow the naming conventions stated in +validate-npm-package-name.

      +

      Examples:

      +
      npm install my-react@npm:react
      +npm install jquery2@npm:jquery@2
      +npm install jquery3@npm:jquery@3
      +npm install npa@npm:npm-package-arg
      +
      +
    • +
    • +

      npm install [<@scope>/]<name>@<tag>:

      +

      Install the version of the package that is referenced by the specified tag. +If the tag does not exist in the registry data for that package, then this +will fail.

      +

      Example:

      +
      npm install sax@latest
      +npm install @myorg/mypackage@latest
      +
      +
    • +
    • +

      npm install [<@scope>/]<name>@<version>:

      +

      Install the specified version of the package. This will fail if the +version has not been published to the registry.

      +

      Example:

      +
      npm install sax@0.1.1
      +npm install @myorg/privatepackage@1.5.0
      +
      +
    • +
    • +

      npm install [<@scope>/]<name>@<version range>:

      +

      Install a version of the package matching the specified version range. +This will follow the same rules for resolving dependencies described in +package.json.

      +

      Note that most version ranges must be put in quotes so that your shell +will treat it as a single argument.

      +

      Example:

      +
      npm install sax@">=0.1.0 <0.2.0"
      +npm install @myorg/privatepackage@"16 - 17"
      +
      +
    • +
    • +

      npm install <git remote url>:

      +

      Installs the package from the hosted git provider, cloning it with +git. For a full git remote url, only that URL will be attempted.

      +
      <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]
      +
      +

      <protocol> is one of git, git+ssh, git+http, git+https, or +git+file.

      +

      If #<commit-ish> is provided, it will be used to clone exactly that +commit. If the commit-ish has the format #semver:<semver>, <semver> +can be any valid semver range or exact version, and npm will look for +any tags or refs matching that range in the remote repository, much as +it would for a registry dependency. If neither #<commit-ish> or +#semver:<semver> is specified, then the default branch of the +repository is used.

      +

      If the repository makes use of submodules, those submodules will be +cloned as well.

      +

      If the package being installed contains a prepare script, its +dependencies and devDependencies will be installed, and the prepare +script will be run, before the package is packaged and installed.

      +

      The following git environment variables are recognized by npm and will +be added to the environment when running git:

      +
        +
      • GIT_ASKPASS
      • +
      • GIT_EXEC_PATH
      • +
      • GIT_PROXY_COMMAND
      • +
      • GIT_SSH
      • +
      • GIT_SSH_COMMAND
      • +
      • GIT_SSL_CAINFO
      • +
      • GIT_SSL_NO_VERIFY
      • +
      +

      See the git man page for details.

      +

      Examples:

      +
      npm install git+ssh://git@github.com:npm/cli.git#v1.0.27
      +npm install git+ssh://git@github.com:npm/cli#pull/273
      +npm install git+ssh://git@github.com:npm/cli#semver:^5.0
      +npm install git+https://isaacs@github.com/npm/cli.git
      +npm install git://github.com/npm/cli.git#v1.0.27
      +GIT_SSH_COMMAND='ssh -i ~/.ssh/custom_ident' npm install git+ssh://git@github.com:npm/cli.git
      +
      +
    • +
    • +

      npm install <githubname>/<githubrepo>[#<commit-ish>]:

      +
    • +
    • +

      npm install github:<githubname>/<githubrepo>[#<commit-ish>]:

      +

      Install the package at https://github.com/githubname/githubrepo by +attempting to clone it using git.

      +

      If #<commit-ish> is provided, it will be used to clone exactly that +commit. If the commit-ish has the format #semver:<semver>, <semver> +can be any valid semver range or exact version, and npm will look for +any tags or refs matching that range in the remote repository, much as +it would for a registry dependency. If neither #<commit-ish> or +#semver:<semver> is specified, then the default branch is used.

      +

      As with regular git dependencies, dependencies and devDependencies +will be installed if the package has a prepare script before the +package is done installing.

      +

      Examples:

      +
      npm install mygithubuser/myproject
      +npm install github:mygithubuser/myproject
      +
      +
    • +
    • +

      npm install gist:[<githubname>/]<gistID>[#<commit-ish>|#semver:<semver>]:

      +

      Install the package at https://gist.github.com/gistID by attempting to +clone it using git. The GitHub username associated with the gist is +optional and will not be saved in package.json.

      +

      As with regular git dependencies, dependencies and devDependencies will +be installed if the package has a prepare script before the package is +done installing.

      +

      Example:

      +
      npm install gist:101a11beef
      +
      +
    • +
    • +

      npm install bitbucket:<bitbucketname>/<bitbucketrepo>[#<commit-ish>]:

      +

      Install the package at https://bitbucket.org/bitbucketname/bitbucketrepo +by attempting to clone it using git.

      +

      If #<commit-ish> is provided, it will be used to clone exactly that +commit. If the commit-ish has the format #semver:<semver>, <semver> can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for a +registry dependency. If neither #<commit-ish> or #semver:<semver> is +specified, then master is used.

      +

      As with regular git dependencies, dependencies and devDependencies will +be installed if the package has a prepare script before the package is +done installing.

      +

      Example:

      +
      npm install bitbucket:mybitbucketuser/myproject
      +
      +
    • +
    • +

      npm install gitlab:<gitlabname>/<gitlabrepo>[#<commit-ish>]:

      +

      Install the package at https://gitlab.com/gitlabname/gitlabrepo +by attempting to clone it using git.

      +

      If #<commit-ish> is provided, it will be used to clone exactly that +commit. If the commit-ish has the format #semver:<semver>, <semver> can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for a +registry dependency. If neither #<commit-ish> or #semver:<semver> is +specified, then master is used.

      +

      As with regular git dependencies, dependencies and devDependencies will +be installed if the package has a prepare script before the package is +done installing.

      +

      Example:

      +
      npm install gitlab:mygitlabuser/myproject
      +npm install gitlab:myusr/myproj#semver:^5.0
      +
      +
    • +
    +

    You may combine multiple arguments and even multiple types of arguments. +For example:

    +
    npm install sax@">=0.1.0 <0.2.0" bench supervisor
    +
    +

    The --tag argument will apply to all of the specified install targets. If +a tag with the given name exists, the tagged version is preferred over +newer versions.

    +

    The --dry-run argument will report in the usual way what the install +would have done without actually installing anything.

    +

    The --package-lock-only argument will only update the +package-lock.json, instead of checking node_modules and downloading +dependencies.

    +

    The -f or --force argument will force npm to fetch remote resources +even if a local copy exists on disk.

    +
    npm install sax --force
    +
    +

    Configuration

    +

    See the config help doc. Many of the configuration +params have some effect on installation, since that's most of what npm +does.

    +

    These are some of the most common options related to installation.

    +

    save

    +
      +
    • Default: true unless when using npm update where it defaults to false
    • +
    • Type: Boolean
    • +
    +

    Save installed packages to a package.json file as dependencies.

    +

    When used with the npm rm command, removes the dependency from +package.json.

    +

    Will also prevent writing to package-lock.json if set to false.

    +

    save-exact

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Dependencies saved to package.json will be configured with an exact version +rather than using npm's default semver range operator.

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    install-strategy

    +
      +
    • Default: "hoisted"
    • +
    • Type: "hoisted", "nested", "shallow", or "linked"
    • +
    +

    Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted.

    +

    legacy-bundling

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=nested
    • +
    +

    Instead of hoisting package installs in node_modules, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets --install-strategy=nested.

    +

    global-style

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=shallow
    • +
    +

    Only install direct dependencies in the top level node_modules, but hoist +on deeper dependencies. Sets --install-strategy=shallow.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    strict-peer-deps

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, and --legacy-peer-deps is not set, then any +conflicting peerDependencies will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships.

    +

    By default, conflicting peerDependencies deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's peerDependencies object.

    +

    When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If --strict-peer-deps is set, then +this warning is treated as a failure.

    +

    prefer-dedupe

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Prefer to deduplicate packages if possible, rather than choosing a newer +version of a dependency.

    +

    package-lock

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to false, then ignore package-lock.json files when installing. This +will also prevent writing package-lock.json if save is true.

    +

    package-lock-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, the current operation will only use the package-lock.json, +ignoring node_modules.

    +

    For update this means only the package-lock.json will be updated, +instead of checking node_modules and downloading dependencies.

    +

    For list this means the output will be based on the tree described by the +package-lock.json, rather than the contents of node_modules.

    +

    foreground-scripts

    +
      +
    • Default: false unless when using npm pack or npm publish where it +defaults to true
    • +
    • Type: Boolean
    • +
    +

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    audit

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for npm audit for details on what is +submitted.

    + +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tells npm to create symlinks (or .cmd shims on Windows) for package +executables.

    +

    Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems.

    +

    fund

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" displays the message at the end of each npm install +acknowledging the number of dependencies looking for funding. See npm fund for details.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    cpu

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    Override CPU architecture of native modules to install. Acceptable values +are same as cpu field of package.json, which comes from process.arch.

    +

    os

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    Override OS of native modules to install. Acceptable values are same as os +field of package.json, which comes from process.platform.

    +

    libc

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    Override libc of native modules to install. Acceptable values are same as +libc field of package.json

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    Algorithm

    +

    Given a package{dep} structure: A{B,C}, B{C}, C{D}, +the npm install algorithm produces:

    +
    A
    ++-- B
    ++-- C
    ++-- D
    +
    +

    That is, the dependency from B to C is satisfied by the fact that A already +caused C to be installed at a higher level. D is still installed at the top +level because nothing conflicts with it.

    +

    For A{B,C}, B{C,D@1}, C{D@2}, this algorithm produces:

    +
    A
    ++-- B
    ++-- C
    +   `-- D@2
    ++-- D@1
    +
    +

    Because B's D@1 will be installed in the top-level, C now has to install +D@2 privately for itself. This algorithm is deterministic, but different +trees may be produced if two dependencies are requested for installation in +a different order.

    +

    See folders for a more detailed description of +the specific folder structures that npm creates.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-link.html b/node_modules/npm/docs/output/commands/npm-link.html new file mode 100644 index 00000000..76b8ed6c --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-link.html @@ -0,0 +1,458 @@ + + +npm-link + + + + + +
    +
    +

    + npm-link + @11.0.0 +

    +Symlink a package folder +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm link [<package-spec>]
    +
    +alias: ln
    +
    +

    Description

    +

    This is handy for installing your own stuff, so that you can work on it and +test iteratively without having to continually rebuild.

    +

    Package linking is a two-step process.

    +

    First, npm link in a package folder with no arguments will create a +symlink in the global folder {prefix}/lib/node_modules/<package> that +links to the package where the npm link command was executed. It will +also link any bins in the package to {prefix}/bin/{name}. Note that +npm link uses the global prefix (see npm prefix -g for its value).

    +

    Next, in some other location, npm link package-name will create a +symbolic link from globally-installed package-name to node_modules/ of +the current folder.

    +

    Note that package-name is taken from package.json, not from the +directory name.

    +

    The package name can be optionally prefixed with a scope. See +scope. The scope must be preceded by an @-symbol and +followed by a slash.

    +

    When creating tarballs for npm publish, the linked packages are +"snapshotted" to their current state by resolving the symbolic links, if +they are included in bundleDependencies.

    +

    For example:

    +
    cd ~/projects/node-redis    # go into the package directory
    +npm link                    # creates global link
    +cd ~/projects/node-bloggy   # go into some other package directory.
    +npm link redis              # link-install the package
    +
    +

    Now, any changes to ~/projects/node-redis will be reflected in +~/projects/node-bloggy/node_modules/node-redis/. Note that the link +should be to the package name, not the directory name for that package.

    +

    You may also shortcut the two steps in one. For example, to do the +above use-case in a shorter way:

    +
    cd ~/projects/node-bloggy  # go into the dir of your main project
    +npm link ../node-redis     # link the dir of your dependency
    +
    +

    The second line is the equivalent of doing:

    +
    (cd ../node-redis; npm link)
    +npm link redis
    +
    +

    That is, it first creates a global link, and then links the global +installation target into your project's node_modules folder.

    +

    Note that in this case, you are referring to the directory name, +node-redis, rather than the package name redis.

    +

    If your linked package is scoped (see scope) your +link command must include that scope, e.g.

    +
    npm link @myorg/privatepackage
    +
    +

    Caveat

    +

    Note that package dependencies linked in this way are not saved to +package.json by default, on the assumption that the intention is to have +a link stand in for a regular non-link dependency. Otherwise, for example, +if you depend on redis@^3.0.1, and ran npm link redis, it would replace +the ^3.0.1 dependency with file:../path/to/node-redis, which you +probably don't want! Additionally, other users or developers on your +project would run into issues if they do not have their folders set up +exactly the same as yours.

    +

    If you are adding a new dependency as a link, you should add it to the +relevant metadata by running npm install <dep> --package-lock-only.

    +

    If you want to save the file: reference in your package.json and +package-lock.json files, you can use npm link <dep> --save to do so.

    +

    Workspace Usage

    +

    npm link <pkg> --workspace <name> will link the relevant package as a +dependency of the specified workspace(s). Note that It may actually be +linked into the parent project's node_modules folder, if there are no +conflicting dependencies.

    +

    npm link --workspace <name> will create a global link to the specified +workspace(s).

    +

    Configuration

    +

    save

    +
      +
    • Default: true unless when using npm update where it defaults to false
    • +
    • Type: Boolean
    • +
    +

    Save installed packages to a package.json file as dependencies.

    +

    When used with the npm rm command, removes the dependency from +package.json.

    +

    Will also prevent writing to package-lock.json if set to false.

    +

    save-exact

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Dependencies saved to package.json will be configured with an exact version +rather than using npm's default semver range operator.

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    install-strategy

    +
      +
    • Default: "hoisted"
    • +
    • Type: "hoisted", "nested", "shallow", or "linked"
    • +
    +

    Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted.

    +

    legacy-bundling

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=nested
    • +
    +

    Instead of hoisting package installs in node_modules, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets --install-strategy=nested.

    +

    global-style

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=shallow
    • +
    +

    Only install direct dependencies in the top level node_modules, but hoist +on deeper dependencies. Sets --install-strategy=shallow.

    +

    strict-peer-deps

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, and --legacy-peer-deps is not set, then any +conflicting peerDependencies will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships.

    +

    By default, conflicting peerDependencies deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's peerDependencies object.

    +

    When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If --strict-peer-deps is set, then +this warning is treated as a failure.

    +

    package-lock

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to false, then ignore package-lock.json files when installing. This +will also prevent writing package-lock.json if save is true.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    audit

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for npm audit for details on what is +submitted.

    + +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tells npm to create symlinks (or .cmd shims on Windows) for package +executables.

    +

    Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems.

    +

    fund

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" displays the message at the end of each npm install +acknowledging the number of dependencies looking for funding. See npm fund for details.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-login.html b/node_modules/npm/docs/output/commands/npm-login.html new file mode 100644 index 00000000..6d7c32a6 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-login.html @@ -0,0 +1,230 @@ + + +npm-login + + + + + +
    +
    +

    + npm-login + @11.0.0 +

    +Login to a registry user account +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm login
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Verify a user in the specified registry, and save the credentials to the +.npmrc file. If no registry is specified, the default registry will be +used (see config).

    +

    When using legacy for your auth-type, the username and password, are +read in from prompts.

    +

    To reset your password, go to https://www.npmjs.com/forgot

    +

    To change your email address, go to https://www.npmjs.com/email-edit

    +

    You may use this command multiple times with the same user account to +authorize on a new machine. When authenticating on a new machine, +the username, password and email address must all match with +your existing record.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    scope

    +
      +
    • Default: the scope of the current project, if any, or ""
    • +
    • Type: String
    • +
    +

    Associate an operation with a scope for a scoped registry.

    +

    Useful when logging in to or out of a private registry:

    +
    # log in, linking the scope to the custom registry
    +npm login --scope=@mycorp --registry=https://registry.mycorp.com
    +
    +# log out, removing the link and the auth token
    +npm logout --scope=@mycorp
    +
    +

    This will cause @mycorp to be mapped to the registry for future +installation of packages specified according to the pattern +@mycorp/package.

    +

    This will also cause npm init to create a scoped package.

    +
    # accept all defaults, and create a package named "@foo/whatever",
    +# instead of just named "whatever"
    +npm init --scope=@foo --yes
    +
    +

    auth-type

    +
      +
    • Default: "web"
    • +
    • Type: "legacy" or "web"
    • +
    +

    What authentication strategy to use with login. Note that if an otp +config is given, this value will always be set to legacy.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-logout.html b/node_modules/npm/docs/output/commands/npm-logout.html new file mode 100644 index 00000000..83087030 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-logout.html @@ -0,0 +1,217 @@ + + +npm-logout + + + + + +
    +
    +

    + npm-logout + @11.0.0 +

    +Log out of the registry +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm logout
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    When logged into a registry that supports token-based authentication, tell +the server to end this token's session. This will invalidate the token +everywhere you're using it, not just for the current environment.

    +

    When logged into a legacy registry that uses username and password +authentication, this will clear the credentials in your user configuration. +In this case, it will only affect the current environment.

    +

    If --scope is provided, this will find the credentials for the registry +connected to that scope, if set.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    scope

    +
      +
    • Default: the scope of the current project, if any, or ""
    • +
    • Type: String
    • +
    +

    Associate an operation with a scope for a scoped registry.

    +

    Useful when logging in to or out of a private registry:

    +
    # log in, linking the scope to the custom registry
    +npm login --scope=@mycorp --registry=https://registry.mycorp.com
    +
    +# log out, removing the link and the auth token
    +npm logout --scope=@mycorp
    +
    +

    This will cause @mycorp to be mapped to the registry for future +installation of packages specified according to the pattern +@mycorp/package.

    +

    This will also cause npm init to create a scoped package.

    +
    # accept all defaults, and create a package named "@foo/whatever",
    +# instead of just named "whatever"
    +npm init --scope=@foo --yes
    +
    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-ls.html b/node_modules/npm/docs/output/commands/npm-ls.html new file mode 100644 index 00000000..2f60ef08 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-ls.html @@ -0,0 +1,365 @@ + + +npm-ls + + + + + +
    +
    +

    + npm-ls + @11.0.0 +

    +List installed packages +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm ls <package-spec>
    +
    +alias: list
    +
    +

    Description

    +

    This command will print to stdout all the versions of packages that are +installed, as well as their dependencies when --all is specified, in a +tree structure.

    +

    Note: to get a "bottoms up" view of why a given package is included in the +tree at all, use npm explain.

    +

    Positional arguments are name@version-range identifiers, which will limit +the results to only the paths to the packages named. Note that nested +packages will also show the paths to the specified packages. For +example, running npm ls promzard in npm's source tree will show:

    +
    npm@11.0.0 /path/to/npm
    +└─┬ init-package-json@0.0.4
    +  └── promzard@0.1.5
    +
    +

    It will print out extraneous, missing, and invalid packages.

    +

    If a project specifies git urls for dependencies these are shown +in parentheses after the name@version to make it easier for users to +recognize potential forks of a project.

    +

    The tree shown is the logical dependency tree, based on package +dependencies, not the physical layout of your node_modules folder.

    +

    When run as ll or la, it shows extended information by default.

    +

    Configuration

    +

    all

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When running npm outdated and npm ls, setting --all will show all +outdated or installed packages, rather than only those directly depended +upon by the current project.

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    long

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Show extended information in ls, search, and help-search.

    +

    parseable

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Output parseable results from commands that write to standard output. For +npm search, this will be tab-separated table format.

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    depth

    +
      +
    • Default: Infinity if --all is set, otherwise 1
    • +
    • Type: null or Number
    • +
    +

    The depth to go when recursing packages for npm ls.

    +

    If not set, npm ls will show only the immediate dependencies of the root +project. If --all is set, then npm will show all dependencies by default.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Used with npm ls, limiting output to only those packages that are linked.

    +

    package-lock-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, the current operation will only use the package-lock.json, +ignoring node_modules.

    +

    For update this means only the package-lock.json will be updated, +instead of checking node_modules and downloading dependencies.

    +

    For list this means the output will be based on the tree described by the +package-lock.json, rather than the contents of node_modules.

    +

    unicode

    +
      +
    • Default: false on windows, true on mac/unix systems with a unicode locale, +as defined by the LC_ALL, LC_CTYPE, or LANG environment variables.
    • +
    • Type: Boolean
    • +
    +

    When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters instead of unicode glyphs.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-org.html b/node_modules/npm/docs/output/commands/npm-org.html new file mode 100644 index 00000000..ccc310ef --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-org.html @@ -0,0 +1,239 @@ + + +npm-org + + + + + +
    +
    +

    + npm-org + @11.0.0 +

    +Manage orgs +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm org set orgname username [developer | admin | owner]
    +npm org rm orgname username
    +npm org ls orgname [<username>]
    +
    +alias: ogr
    +
    +

    Note: This command is unaware of workspaces.

    +

    Example

    +

    Add a new developer to an org:

    +
    $ npm org set my-org @mx-smith
    +
    +

    Add a new admin to an org (or change a developer to an admin):

    +
    $ npm org set my-org @mx-santos admin
    +
    +

    Remove a user from an org:

    +
    $ npm org rm my-org mx-santos
    +
    +

    List all users in an org:

    +
    $ npm org ls my-org
    +
    +

    List all users in JSON format:

    +
    $ npm org ls my-org --json
    +
    +

    See what role a user has in an org:

    +
    $ npm org ls my-org @mx-santos
    +
    +

    Description

    +

    You can use the npm org commands to manage and view users of an +organization. It supports adding and removing users, changing their roles, +listing them, and finding specific ones and their roles.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    parseable

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Output parseable results from commands that write to standard output. For +npm search, this will be tab-separated table format.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-outdated.html b/node_modules/npm/docs/output/commands/npm-outdated.html new file mode 100644 index 00000000..1875a6f2 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-outdated.html @@ -0,0 +1,313 @@ + + +npm-outdated + + + + + +
    +
    +

    + npm-outdated + @11.0.0 +

    +Check for outdated packages +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm outdated [<package-spec> ...]
    +
    +

    Description

    +

    This command will check the registry to see if any (or, specific) installed +packages are currently outdated.

    +

    By default, only the direct dependencies of the root project and direct +dependencies of your configured workspaces are shown. +Use --all to find all outdated meta-dependencies as well.

    +

    In the output:

    +
      +
    • wanted is the maximum version of the package that satisfies the semver +range specified in package.json. If there's no available semver range +(i.e. you're running npm outdated --global, or the package isn't +included in package.json), then wanted shows the currently-installed +version.
    • +
    • latest is the version of the package tagged as latest in the registry. +Running npm publish with no special configuration will publish the +package with a dist-tag of latest. This may or may not be the maximum +version of the package, or the most-recently published version of the +package, depending on how the package's developer manages the latest +dist-tag.
    • +
    • location is where in the physical tree the package is located.
    • +
    • depended by shows which package depends on the displayed dependency
    • +
    • package type (when using --long / -l) tells you whether this +package is a dependency or a dev/peer/optional dependency. Packages not +included in package.json are always marked dependencies.
    • +
    • homepage (when using --long / -l) is the homepage value contained +in the package's packument
    • +
    • Red means there's a newer version matching your semver requirements, so +you should update now.
    • +
    • Yellow indicates that there's a newer version above your semver +requirements (usually new major, or new 0.x minor) so proceed with +caution.
    • +
    +

    An example

    +
    $ npm outdated
    +Package      Current   Wanted   Latest  Location                  Depended by
    +glob          5.0.15   5.0.15    6.0.1  node_modules/glob         dependent-package-name
    +nothingness    0.0.3      git      git  node_modules/nothingness  dependent-package-name
    +npm            3.5.1    3.5.2    3.5.1  node_modules/npm          dependent-package-name
    +local-dev      0.0.3   linked   linked  local-dev                 dependent-package-name
    +once           1.3.2    1.3.3    1.3.3  node_modules/once         dependent-package-name
    +
    +

    With these dependencies:

    +
    {
    +  "glob": "^5.0.15",
    +  "nothingness": "github:othiym23/nothingness#master",
    +  "npm": "^3.5.1",
    +  "once": "^1.3.1"
    +}
    +
    +

    A few things to note:

    +
      +
    • glob requires ^5, which prevents npm from installing glob@6, which +is outside the semver range.
    • +
    • Git dependencies will always be reinstalled, because of how they're +specified. The installed committish might satisfy the dependency +specifier (if it's something immutable, like a commit SHA), or it might +not, so npm outdated and npm update have to fetch Git repos to check. +This is why currently doing a reinstall of a Git dependency always forces +a new clone and install.
    • +
    • npm@3.5.2 is marked as "wanted", but "latest" is npm@3.5.1 because +npm uses dist-tags to manage its latest and next release channels. +npm update will install the newest version, but npm install npm +(with no semver range) will install whatever's tagged as latest.
    • +
    • once is just plain out of date. Reinstalling node_modules from +scratch or running npm update will bring it up to spec.
    • +
    +

    Configuration

    +

    all

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When running npm outdated and npm ls, setting --all will show all +outdated or installed packages, rather than only those directly depended +upon by the current project.

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    long

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Show extended information in ls, search, and help-search.

    +

    parseable

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Output parseable results from commands that write to standard output. For +npm search, this will be tab-separated table format.

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-owner.html b/node_modules/npm/docs/output/commands/npm-owner.html new file mode 100644 index 00000000..5bf13801 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-owner.html @@ -0,0 +1,251 @@ + + +npm-owner + + + + + +
    +
    +

    + npm-owner + @11.0.0 +

    +Manage package owners +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm owner add <user> <package-spec>
    +npm owner rm <user> <package-spec>
    +npm owner ls <package-spec>
    +
    +alias: author
    +
    +

    Description

    +

    Manage ownership of published packages.

    +
      +
    • ls: List all the users who have access to modify a package and push new +versions. Handy when you need to know who to bug for help.
    • +
    • add: Add a new user as a maintainer of a package. This user is enabled +to modify metadata, publish new versions, and add other owners.
    • +
    • rm: Remove a user from the package owner list. This immediately revokes +their privileges.
    • +
    +

    Note that there is only one level of access. Either you can modify a package, +or you can't. Future versions may contain more fine-grained access levels, but +that is not implemented at this time.

    +

    If you have two-factor authentication enabled with auth-and-writes (see +npm-profile) then you'll need to go through a second factor +flow when changing ownership or include an otp on the command line with --otp.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-pack.html b/node_modules/npm/docs/output/commands/npm-pack.html new file mode 100644 index 00000000..acc909f4 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-pack.html @@ -0,0 +1,274 @@ + + +npm-pack + + + + + +
    +
    +

    + npm-pack + @11.0.0 +

    +Create a tarball from a package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm pack <package-spec>
    +
    +

    Configuration

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    pack-destination

    +
      +
    • Default: "."
    • +
    • Type: String
    • +
    +

    Directory in which npm pack will save tarballs.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    Description

    +

    For anything that's installable (that is, a package folder, tarball, +tarball url, git url, name@tag, name@version, name, or scoped name), this +command will fetch it to the cache, copy the tarball to the current working +directory as <name>-<version>.tgz, and then write the filenames out to +stdout.

    +

    If the same package is specified multiple times, then the file will be +overwritten the second time.

    +

    If no arguments are supplied, then npm packs the current package folder.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-ping.html b/node_modules/npm/docs/output/commands/npm-ping.html new file mode 100644 index 00000000..ca4f2cab --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-ping.html @@ -0,0 +1,197 @@ + + +npm-ping + + + + + +
    +
    +

    + npm-ping + @11.0.0 +

    +Ping npm registry +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm ping
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Ping the configured or given npm registry and verify authentication. +If it works it will output something like:

    +
    npm notice PING https://registry.npmjs.org/
    +npm notice PONG 255ms
    +
    +

    otherwise you will get an error:

    +
    npm notice PING http://foo.com/
    +npm ERR! code E404
    +npm ERR! 404 Not Found - GET http://www.foo.com/-/ping?write=true
    +
    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-pkg.html b/node_modules/npm/docs/output/commands/npm-pkg.html new file mode 100644 index 00000000..6ff0880e --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-pkg.html @@ -0,0 +1,372 @@ + + +npm-pkg + + + + + +
    +
    +

    + npm-pkg + @11.0.0 +

    +Manages your package.json +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm pkg set <key>=<value> [<key>=<value> ...]
    +npm pkg get [<key> [<key> ...]]
    +npm pkg delete <key> [<key> ...]
    +npm pkg set [<array>[<index>].<key>=<value> ...]
    +npm pkg set [<array>[].<key>=<value> ...]
    +npm pkg fix
    +
    +

    Description

    +

    A command that automates the management of package.json files. +npm pkg provide 3 different sub commands that allow you to modify or retrieve +values for given object keys in your package.json.

    +

    The syntax to retrieve and set fields is a dot separated representation of +the nested object properties to be found within your package.json, it's the +same notation used in npm view to retrieve information +from the registry manifest, below you can find more examples on how to use it.

    +

    Returned values are always in json format.

    +
      +
    • +

      npm pkg get <field>

      +

      Retrieves a value key, defined in your package.json file.

      +

      For example, in order to retrieve the name of the current package, you +can run:

      +
      npm pkg get name
      +
      +

      It's also possible to retrieve multiple values at once:

      +
      npm pkg get name version
      +
      +

      You can view child fields by separating them with a period. To retrieve +the value of a test script value, you would run the following command:

      +
      npm pkg get scripts.test
      +
      +

      For fields that are arrays, requesting a non-numeric field will return +all of the values from the objects in the list. For example, to get all +the contributor emails for a package, you would run:

      +
      npm pkg get contributors.email
      +
      +

      You may also use numeric indices in square braces to specifically select +an item in an array field. To just get the email address of the first +contributor in the list, you can run:

      +
      npm pkg get contributors[0].email
      +
      +

      For complex fields you can also name a property in square brackets +to specifically select a child field. This is especially helpful +with the exports object:

      +
      npm pkg get "exports[.].require"
      +
      +
    • +
    • +

      npm pkg set <field>=<value>

      +

      Sets a value in your package.json based on the field value. When +saving to your package.json file the same set of rules used during +npm install and other cli commands that touches the package.json file +are used, making sure to respect the existing indentation and possibly +applying some validation prior to saving values to the file.

      +

      The same syntax used to retrieve values from your package can also be used +to define new properties or overriding existing ones, below are some +examples of how the dot separated syntax can be used to edit your +package.json file.

      +

      Defining a new bin named mynewcommand in your package.json that points +to a file cli.js:

      +
      npm pkg set bin.mynewcommand=cli.js
      +
      +

      Setting multiple fields at once is also possible:

      +
      npm pkg set description='Awesome package' engines.node='>=10'
      +
      +

      It's also possible to add to array values, for example to add a new +contributor entry:

      +
      npm pkg set contributors[0].name='Foo' contributors[0].email='foo@bar.ca'
      +
      +

      You may also append items to the end of an array using the special +empty bracket notation:

      +
      npm pkg set contributors[].name='Foo' contributors[].name='Bar'
      +
      +

      It's also possible to parse values as json prior to saving them to your +package.json file, for example in order to set a "private": true +property:

      +
      npm pkg set private=true --json
      +
      +

      It also enables saving values as numbers:

      +
      npm pkg set tap.timeout=60 --json
      +
      +
    • +
    • +

      npm pkg delete <key>

      +

      Deletes a key from your package.json

      +

      The same syntax used to set values from your package can also be used +to remove existing ones. For example, in order to remove a script named +build:

      +
      npm pkg delete scripts.build
      +
      +
    • +
    • +

      npm pkg fix

      +

      Auto corrects common errors in your package.json. npm already +does this during publish, which leads to subtle (mostly harmless) +differences between the contents of your package.json file and the +manifest that npm uses during installation.

      +
    • +
    +

    Workspaces support

    +

    You can set/get/delete items across your configured workspaces by using the +workspace or +workspaces config options.

    +

    For example, setting a funding value across all configured workspaces +of a project:

    +
    npm pkg set funding=https://example.com --ws
    +
    +

    When using npm pkg get to retrieve info from your configured workspaces, the +returned result will be in a json format in which top level keys are the +names of each workspace, the values of these keys will be the result values +returned from each of the configured workspaces, e.g:

    +
    npm pkg get name version --ws
    +{
    +  "a": {
    +    "name": "a",
    +    "version": "1.0.0"
    +  },
    +  "b": {
    +    "name": "b",
    +    "version": "1.0.0"
    +  }
    +}
    +
    +

    Configuration

    +

    force

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Removes various protections against unfortunate side effects, common +mistakes, unnecessary performance degradation, and malicious input.

    +
      +
    • Allow clobbering non-npm files in global installs.
    • +
    • Allow the npm version command to work on an unclean git repository.
    • +
    • Allow deleting the cache folder with npm cache clean.
    • +
    • Allow installing packages that have an engines declaration requiring a +different version of npm.
    • +
    • Allow installing packages that have an engines declaration requiring a +different version of node, even if --engine-strict is enabled.
    • +
    • Allow npm audit fix to install modules outside your stated dependency +range (including SemVer-major changes).
    • +
    • Allow unpublishing all versions of a published package.
    • +
    • Allow conflicting peerDependencies to be installed in the root project.
    • +
    • Implicitly set --yes during npm init.
    • +
    • Allow clobbering existing values in npm pkg
    • +
    • Allow unpublishing of entire packages (not just a single version).
    • +
    +

    If you don't have a clear idea of what you want to do, it is strongly +recommended that you do not use this option!

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-prefix.html b/node_modules/npm/docs/output/commands/npm-prefix.html new file mode 100644 index 00000000..c7210866 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-prefix.html @@ -0,0 +1,208 @@ + + +npm-prefix + + + + + +
    +
    +

    + npm-prefix + @11.0.0 +

    +Display prefix +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm prefix
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Print the local prefix to standard output. This is the closest parent directory +to contain a package.json file or node_modules directory, unless -g is +also specified.

    +

    If -g is specified, this will be the value of the global prefix. See +npm config for more detail.

    +

    Example

    +
    npm prefix
    +/usr/local/projects/foo
    +
    +
    npm prefix -g
    +/usr/local
    +
    +

    Configuration

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-profile.html b/node_modules/npm/docs/output/commands/npm-profile.html new file mode 100644 index 00000000..86705775 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-profile.html @@ -0,0 +1,269 @@ + + +npm-profile + + + + + +
    +
    +

    + npm-profile + @11.0.0 +

    +Change settings on your registry profile +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm profile enable-2fa [auth-only|auth-and-writes]
    +npm profile disable-2fa
    +npm profile get [<key>]
    +npm profile set <key> <value>
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Change your profile information on the registry. Note that this command +depends on the registry implementation, so third-party registries may not +support this interface.

    +
      +
    • npm profile get [<property>]: Display all of the properties of your +profile, or one or more specific properties. It looks like:
    • +
    +
    name: example
    +email: e@example.com (verified)
    +two-factor auth: auth-and-writes
    +fullname: Example User
    +homepage:
    +freenode:
    +twitter:
    +github:
    +created: 2015-02-26T01:38:35.892Z
    +updated: 2017-10-02T21:29:45.922Z
    +
    +
      +
    • +

      npm profile set <property> <value>: Set the value of a profile +property. You can set the following properties this way: email, fullname, +homepage, freenode, twitter, github

      +
    • +
    • +

      npm profile set password: Change your password. This is interactive, +you'll be prompted for your current password and a new password. You'll +also be prompted for an OTP if you have two-factor authentication +enabled.

      +
    • +
    • +

      npm profile enable-2fa [auth-and-writes|auth-only]: Enables two-factor +authentication. Defaults to auth-and-writes mode. Modes are:

      +
        +
      • auth-only: Require an OTP when logging in or making changes to your +account's authentication. The OTP will be required on both the website +and the command line.
      • +
      • auth-and-writes: Requires an OTP at all the times auth-only does, +and also requires one when publishing a module, setting the latest +dist-tag, or changing access via npm access and npm owner.
      • +
      +
    • +
    • +

      npm profile disable-2fa: Disables two-factor authentication.

      +
    • +
    +

    Details

    +

    Some of these commands may not be available on non npmjs.com registries.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    parseable

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Output parseable results from commands that write to standard output. For +npm search, this will be tab-separated table format.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-prune.html b/node_modules/npm/docs/output/commands/npm-prune.html new file mode 100644 index 00000000..da263ef7 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-prune.html @@ -0,0 +1,313 @@ + + +npm-prune + + + + + +
    +
    +

    + npm-prune + @11.0.0 +

    +Remove extraneous packages +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm prune [[<@scope>/]<pkg>...]
    +
    +

    Description

    +

    This command removes "extraneous" packages. If a package name is provided, +then only packages matching one of the supplied names are removed.

    +

    Extraneous packages are those present in the node_modules folder that are +not listed as any package's dependency list.

    +

    If the --omit=dev flag is specified or the NODE_ENV environment +variable is set to production, this command will remove the packages +specified in your devDependencies.

    +

    If the --dry-run flag is used then no changes will actually be made.

    +

    If the --json flag is used, then the changes npm prune made (or would +have made with --dry-run) are printed as a JSON object.

    +

    In normal operation, extraneous modules are pruned automatically, so you'll +only need this command with the --production flag. However, in the real +world, operation is not always "normal". When crashes or mistakes happen, +this command can help clean up any resulting garbage.

    +

    Configuration

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    foreground-scripts

    +
      +
    • Default: false unless when using npm pack or npm publish where it +defaults to true
    • +
    • Type: Boolean
    • +
    +

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-publish.html b/node_modules/npm/docs/output/commands/npm-publish.html new file mode 100644 index 00000000..55b32480 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-publish.html @@ -0,0 +1,361 @@ + + +npm-publish + + + + + +
    +
    +

    + npm-publish + @11.0.0 +

    +Publish a package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm publish <package-spec>
    +
    +

    Description

    +

    Publishes a package to the registry so that it can be installed by name.

    +

    By default npm will publish to the public registry. This can be +overridden by specifying a different default registry or using a +scope in the name, combined with a +scope-configured registry (see +package.json).

    +

    A package is interpreted the same way as other commands (like +npm install) and can be:

    +
      +
    • a) a folder containing a program described by a +package.json file
    • +
    • b) a gzipped tarball containing (a)
    • +
    • c) a url that resolves to (b)
    • +
    • d) a <name>@<version> that is published on the registry (see +registry) with (c)
    • +
    • e) a <name>@<tag> (see npm dist-tag) that +points to (d)
    • +
    • f) a <name> that has a "latest" tag satisfying (e)
    • +
    • g) a <git remote url> that resolves to (a)
    • +
    +

    The publish will fail if the package name and version combination already +exists in the specified registry.

    +

    Once a package is published with a given name and version, that specific +name and version combination can never be used again, even if it is removed +with npm unpublish.

    +

    As of npm@5, both a sha1sum and an integrity field with a sha512sum of the +tarball will be submitted to the registry during publication. Subsequent +installs will use the strongest supported algorithm to verify downloads.

    +

    Similar to --dry-run see npm pack, which figures +out the files to be included and packs them into a tarball to be uploaded +to the registry.

    +

    Files included in package

    +

    To see what will be included in your package, run npm pack --dry-run. All +files are included by default, with the following exceptions:

    +
      +
    • +

      Certain files that are relevant to package installation and distribution +are always included. For example, package.json, README.md, +LICENSE, and so on.

      +
    • +
    • +

      If there is a "files" list in +package.json, then only the files +specified will be included. (If directories are specified, then they +will be walked recursively and their contents included, subject to the +same ignore rules.)

      +
    • +
    • +

      If there is a .gitignore or .npmignore file, then ignored files in +that and all child directories will be excluded from the package. If +both files exist, then the .gitignore is ignored, and only the +.npmignore is used.

      +

      .npmignore files follow the same pattern +rules +as .gitignore files

      +
    • +
    • +

      If the file matches certain patterns, then it will never be included, +unless explicitly added to the "files" list in package.json, or +un-ignored with a ! rule in a .npmignore or .gitignore file.

      +
    • +
    • +

      Symbolic links are never included in npm packages.

      +
    • +
    +

    See developers for full details on what's +included in the published package, as well as details on how the package is +built.

    +

    See package.json for more info on +what can and can't be ignored.

    +

    Configuration

    +

    tag

    +
      +
    • Default: "latest"
    • +
    • Type: String
    • +
    +

    If you ask npm to install a package and don't tell it a specific version, +then it will install the specified tag.

    +

    It is the tag added to the package@version specified in the npm dist-tag add command, if no explicit tag is given.

    +

    When used by the npm diff command, this is the tag used to fetch the +tarball that will be compared with the local files by default.

    +

    If used in the npm publish command, this is the tag that will be added to +the package submitted to the registry.

    +

    access

    +
      +
    • Default: 'public' for new packages, existing packages it will not change the +current level
    • +
    • Type: null, "restricted", or "public"
    • +
    +

    If you do not want your scoped package to be publicly viewable (and +installable) set --access=restricted.

    +

    Unscoped packages can not be set to restricted.

    +

    Note: This defaults to not changing the current access level for existing +packages. Specifying a value of restricted or public during publish will +change the access for an existing package the same way that npm access set status would.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    provenance

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When publishing from a supported cloud CI/CD system, the package will be +publicly linked to where it was built and published from.

    +

    This config can not be used with: provenance-file

    +

    provenance-file

    +
      +
    • Default: null
    • +
    • Type: Path
    • +
    +

    When publishing, the provenance bundle at the given path will be used.

    +

    This config can not be used with: provenance

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-query.html b/node_modules/npm/docs/output/commands/npm-query.html new file mode 100644 index 00000000..7c9819a5 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-query.html @@ -0,0 +1,394 @@ + + +npm-query + + + + + +
    +
    +

    + npm-query + @11.0.0 +

    +Dependency selector query +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm query <selector>
    +
    +

    Description

    +

    The npm query command allows for usage of css selectors in order to retrieve +an array of dependency objects.

    +

    Piping npm query to other commands

    +
    # find all dependencies with postinstall scripts & uninstall them
    +npm query ":attr(scripts, [postinstall])" | jq 'map(.name)|join("\n")' -r | xargs -I {} npm uninstall {}
    +
    +# find all git dependencies & explain who requires them
    +npm query ":type(git)" | jq 'map(.name)' | xargs -I {} npm why {}
    +
    +

    Extended Use Cases & Queries

    +
    // all deps
    +*
    +
    +// all direct deps
    +:root > *
    +
    +// direct production deps
    +:root > .prod
    +
    +// direct development deps
    +:root > .dev
    +
    +// any peer dep of a direct deps
    +:root > * > .peer
    +
    +// any workspace dep
    +.workspace
    +
    +// all workspaces that depend on another workspace
    +.workspace > .workspace
    +
    +// all workspaces that have peer deps
    +.workspace:has(.peer)
    +
    +// any dep named "lodash"
    +// equivalent to [name="lodash"]
    +#lodash
    +
    +// any deps named "lodash" & within semver range ^"1.2.3"
    +#lodash@^1.2.3
    +// equivalent to...
    +[name="lodash"]:semver(^1.2.3)
    +
    +// get the hoisted node for a given semver range
    +#lodash@^1.2.3:not(:deduped)
    +
    +// querying deps with a specific version
    +#lodash@2.1.5
    +// equivalent to...
    +[name="lodash"][version="2.1.5"]
    +
    +// has any deps
    +:has(*)
    +
    +// deps with no other deps (ie. "leaf" nodes)
    +:empty
    +
    +// manually querying git dependencies
    +[repository^=github:],
    +[repository^=git:],
    +[repository^=https://github.com],
    +[repository^=http://github.com],
    +[repository^=https://github.com],
    +[repository^=+git:...]
    +
    +// querying for all git dependencies
    +:type(git)
    +
    +// get production dependencies that aren't also dev deps
    +.prod:not(.dev)
    +
    +// get dependencies with specific licenses
    +[license=MIT], [license=ISC]
    +
    +// find all packages that have @ruyadorno as a contributor
    +:attr(contributors, [email=ruyadorno@github.com])
    +
    +

    Example Response Output

    +
      +
    • an array of dependency objects is returned which can contain multiple copies of the same package which may or may not have been linked or deduped
    • +
    +
    [
    +  {
    +    "name": "",
    +    "version": "",
    +    "description": "",
    +    "homepage": "",
    +    "bugs": {},
    +    "author": {},
    +    "license": {},
    +    "funding": {},
    +    "files": [],
    +    "main": "",
    +    "browser": "",
    +    "bin": {},
    +    "man": [],
    +    "directories": {},
    +    "repository": {},
    +    "scripts": {},
    +    "config": {},
    +    "dependencies": {},
    +    "devDependencies": {},
    +    "optionalDependencies": {},
    +    "bundledDependencies": {},
    +    "peerDependencies": {},
    +    "peerDependenciesMeta": {},
    +    "engines": {},
    +    "os": [],
    +    "cpu": [],
    +    "workspaces": {},
    +    "keywords": [],
    +    ...
    +  },
    +  ...
    +
    +

    Expecting a certain number of results

    +

    One common use of npm query is to make sure there is only one version of +a certain dependency in your tree. This is especially common for +ecosystems like that rely on typescript where having state split +across two different but identically-named packages causes bugs. You +can use the --expect-results or --expect-result-count in your setup +to ensure that npm will exit with an exit code if your tree doesn't look +like you want it to.

    +
    $ npm query '#react' --expect-result-count=1
    +
    +

    Perhaps you want to quickly check if there are any production +dependencies that could be updated:

    +
    $ npm query ':root>:outdated(in-range).prod' --no-expect-results
    +
    +

    Package lock only mode

    +

    If package-lock-only is enabled, only the information in the package lock (or shrinkwrap) is loaded. This means that information from the package.json files of your dependencies will not be included in the result set (e.g. description, homepage, engines).

    +

    Configuration

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    package-lock-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, the current operation will only use the package-lock.json, +ignoring node_modules.

    +

    For update this means only the package-lock.json will be updated, +instead of checking node_modules and downloading dependencies.

    +

    For list this means the output will be based on the tree described by the +package-lock.json, rather than the contents of node_modules.

    +

    expect-results

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Tells npm whether or not to expect results from the command. Can be either +true (expect some results) or false (expect no results).

    +

    This config can not be used with: expect-result-count

    +

    expect-result-count

    +
      +
    • Default: null
    • +
    • Type: null or Number
    • +
    +

    Tells to expect a specific number of results from the command.

    +

    This config can not be used with: expect-results

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-rebuild.html b/node_modules/npm/docs/output/commands/npm-rebuild.html new file mode 100644 index 00000000..541163fe --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-rebuild.html @@ -0,0 +1,297 @@ + + +npm-rebuild + + + + + +
    +
    +

    + npm-rebuild + @11.0.0 +

    +Rebuild a package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm rebuild [<package-spec>] ...]
    +
    +alias: rb
    +
    +

    Description

    +

    This command does the following:

    +
      +
    1. Execute lifecycle scripts (preinstall, install, postinstall, prepare)
    2. +
    3. Links bins depending on whether bin links are enabled
    4. +
    +

    This command is particularly useful in scenarios including but not limited to:

    +
      +
    1. Installing a new version of node.js, where you need to recompile all your C++ add-ons with the updated binary.
    2. +
    3. Installing with --ignore-scripts and --no-bin-links, to explicitly choose which packages to build and/or link bins.
    4. +
    +

    If one or more package specs are provided, then only packages with a name and version matching one of the specifiers will be rebuilt.

    +

    Usually, you should not need to run npm rebuild as it is already done for you as part of npm install (unless you suppressed these steps with --ignore-scripts or --no-bin-links).

    +

    If there is a binding.gyp file in the root of your package, then npm will use a default install hook:

    +
    "scripts": {
    +    "install": "node-gyp rebuild"
    +}
    +
    +

    This default behavior is suppressed if the package.json has its own install or preinstall scripts. It is also suppressed if the package specifies "gypfile": false

    +

    Configuration

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    + +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tells npm to create symlinks (or .cmd shims on Windows) for package +executables.

    +

    Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems.

    +

    foreground-scripts

    +
      +
    • Default: false unless when using npm pack or npm publish where it +defaults to true
    • +
    • Type: Boolean
    • +
    +

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-repo.html b/node_modules/npm/docs/output/commands/npm-repo.html new file mode 100644 index 00000000..cf5ad321 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-repo.html @@ -0,0 +1,244 @@ + + +npm-repo + + + + + +
    +
    +

    + npm-repo + @11.0.0 +

    +Open package repository page in the browser +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm repo [<pkgname> [<pkgname> ...]]
    +
    +

    Description

    +

    This command tries to guess at the likely location of a package's +repository URL, and then tries to open it using the +--browser config param. If no package name is +provided, it will search for a package.json in the current folder and use the +repository property.

    +

    Configuration

    +

    browser

    +
      +
    • Default: OS X: "open", Windows: "start", Others: "xdg-open"
    • +
    • Type: null, Boolean, or String
    • +
    +

    The browser that is called by npm commands to open websites.

    +

    Set to false to suppress browser behavior and instead print urls to +terminal.

    +

    Set to true to use default system URL opener.

    +

    registry

    + +

    The base URL of the npm registry.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-restart.html b/node_modules/npm/docs/output/commands/npm-restart.html new file mode 100644 index 00000000..ac1ee971 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-restart.html @@ -0,0 +1,219 @@ + + +npm-restart + + + + + +
    +
    +

    + npm-restart + @11.0.0 +

    +Restart a package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm restart [-- <args>]
    +
    +

    Description

    +

    This restarts a project. It is equivalent to running npm run-script restart.

    +

    If the current project has a "restart" script specified in +package.json, then the following scripts will be run:

    +
      +
    1. prerestart
    2. +
    3. restart
    4. +
    5. postrestart
    6. +
    +

    If it does not have a "restart" script specified, but it does have +stop and/or start scripts, then the following scripts will be run:

    +
      +
    1. prerestart
    2. +
    3. prestop
    4. +
    5. stop
    6. +
    7. poststop
    8. +
    9. prestart
    10. +
    11. start
    12. +
    13. poststart
    14. +
    15. postrestart
    16. +
    +

    Configuration

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    script-shell

    +
      +
    • Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
    • +
    • Type: null or String
    • +
    +

    The shell to use for scripts run with the npm exec, npm run and npm init <package-spec> commands.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-root.html b/node_modules/npm/docs/output/commands/npm-root.html new file mode 100644 index 00000000..5e51f975 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-root.html @@ -0,0 +1,203 @@ + + +npm-root + + + + + +
    +
    +

    + npm-root + @11.0.0 +

    +Display npm root +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm root
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Print the effective node_modules folder to standard out.

    +

    Useful for using npm in shell scripts that do things with the +node_modules folder. For example:

    +
    #!/bin/bash
    +global_node_modules="$(npm root --global)"
    +echo "Global packages installed in: ${global_node_modules}"
    +
    +

    Configuration

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-run-script.html b/node_modules/npm/docs/output/commands/npm-run-script.html new file mode 100644 index 00000000..5d4fd8a4 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-run-script.html @@ -0,0 +1,354 @@ + + +npm-run-script + + + + + +
    +
    +

    + npm-run-script + @11.0.0 +

    +Run arbitrary package scripts +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm run-script <command> [-- <args>]
    +
    +aliases: run, rum, urn
    +
    +

    Description

    +

    This runs an arbitrary command from a package's "scripts" object. If no +"command" is provided, it will list the available scripts.

    +

    run[-script] is used by the test, start, restart, and stop commands, but +can be called directly, as well. When the scripts in the package are +printed out, they're separated into lifecycle (test, start, restart) and +directly-run scripts.

    +

    Any positional arguments are passed to the specified script. Use -- to +pass --prefixed flags and options which would otherwise be parsed by npm.

    +

    For example:

    +
    npm run test -- --grep="pattern"
    +
    +

    The arguments will only be passed to the script specified after npm run +and not to any pre or post script.

    +

    The env script is a special built-in command that can be used to list +environment variables that will be available to the script at runtime. If an +"env" command is defined in your package, it will take precedence over the +built-in.

    +

    In addition to the shell's pre-existing PATH, npm run adds +node_modules/.bin to the PATH provided to scripts. Any binaries +provided by locally-installed dependencies can be used without the +node_modules/.bin prefix. For example, if there is a devDependency on +tap in your package, you should write:

    +
    "scripts": {"test": "tap test/*.js"}
    +
    +

    instead of

    +
    "scripts": {"test": "node_modules/.bin/tap test/*.js"}
    +
    +

    The actual shell your script is run within is platform dependent. By default, +on Unix-like systems it is the /bin/sh command, on Windows it is +cmd.exe. +The actual shell referred to by /bin/sh also depends on the system. +You can customize the shell with the +script-shell config.

    +

    Scripts are run from the root of the package folder, regardless of what the +current working directory is when npm run is called. If you want your +script to use different behavior based on what subdirectory you're in, you +can use the INIT_CWD environment variable, which holds the full path you +were in when you ran npm run.

    +

    npm run sets the NODE environment variable to the node executable +with which npm is executed.

    +

    If you try to run a script without having a node_modules directory and it +fails, you will be given a warning to run npm install, just in case you've +forgotten.

    +

    Workspaces support

    +

    You may use the workspace or +workspaces configs in order to run an +arbitrary command from a package's "scripts" object in the context of the +specified workspaces. If no "command" is provided, it will list the available +scripts for each of these configured workspaces.

    +

    Given a project with configured workspaces, e.g:

    +
    .
    ++-- package.json
    +`-- packages
    +   +-- a
    +   |   `-- package.json
    +   +-- b
    +   |   `-- package.json
    +   `-- c
    +       `-- package.json
    +
    +

    Assuming the workspace configuration is properly set up at the root level +package.json file. e.g:

    +
    {
    +    "workspaces": [ "./packages/*" ]
    +}
    +
    +

    And that each of the configured workspaces has a configured test script, +we can run tests in all of them using the +workspaces config:

    +
    npm test --workspaces
    +
    +

    Filtering workspaces

    +

    It's also possible to run a script in a single workspace using the workspace +config along with a name or directory path:

    +
    npm test --workspace=a
    +
    +

    The workspace config can also be specified multiple times in order to run a +specific script in the context of multiple workspaces. When defining values for +the workspace config in the command line, it also possible to use -w as a +shorthand, e.g:

    +
    npm test -w a -w b
    +
    +

    This last command will run test in both ./packages/a and ./packages/b +packages.

    +

    Configuration

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    if-present

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm will not exit with an error code when run-script is invoked +for a script that isn't defined in the scripts section of package.json. +This option can be used when it's desirable to optionally run a script when +it's present and fail if the script fails. This is useful, for example, when +running scripts that may only apply for some builds in an otherwise generic +CI setup.

    +

    This value is not exported to the environment for child processes.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    foreground-scripts

    +
      +
    • Default: false unless when using npm pack or npm publish where it +defaults to true
    • +
    • Type: Boolean
    • +
    +

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    +

    script-shell

    +
      +
    • Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
    • +
    • Type: null or String
    • +
    +

    The shell to use for scripts run with the npm exec, npm run and npm init <package-spec> commands.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-sbom.html b/node_modules/npm/docs/output/commands/npm-sbom.html new file mode 100644 index 00000000..7d57f380 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-sbom.html @@ -0,0 +1,447 @@ + + +npm-sbom + + + + + +
    +
    +

    + npm-sbom + @11.0.0 +

    +Generate a Software Bill of Materials (SBOM) +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm sbom
    +
    +

    Description

    +

    The npm sbom command generates a Software Bill of Materials (SBOM) listing the +dependencies for the current project. SBOMs can be generated in either +SPDX or CycloneDX format.

    +

    Example CycloneDX SBOM

    +
    {
    +  "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
    +  "bomFormat": "CycloneDX",
    +  "specVersion": "1.5",
    +  "serialNumber": "urn:uuid:09f55116-97e1-49cf-b3b8-44d0207e7730",
    +  "version": 1,
    +  "metadata": {
    +    "timestamp": "2023-09-01T00:00:00.001Z",
    +    "lifecycles": [
    +      {
    +        "phase": "build"
    +      }
    +    ],
    +    "tools": [
    +      {
    +        "vendor": "npm",
    +        "name": "cli",
    +        "version": "10.1.0"
    +      }
    +    ],
    +    "component": {
    +      "bom-ref": "simple@1.0.0",
    +      "type": "library",
    +      "name": "simple",
    +      "version": "1.0.0",
    +      "scope": "required",
    +      "author": "John Doe",
    +      "description": "simple react app",
    +      "purl": "pkg:npm/simple@1.0.0",
    +      "properties": [
    +        {
    +          "name": "cdx:npm:package:path",
    +          "value": ""
    +        }
    +      ],
    +      "externalReferences": [],
    +      "licenses": [
    +        {
    +          "license": {
    +            "id": "MIT"
    +          }
    +        }
    +      ]
    +    }
    +  },
    +  "components": [
    +    {
    +      "bom-ref": "lodash@4.17.21",
    +      "type": "library",
    +      "name": "lodash",
    +      "version": "4.17.21",
    +      "scope": "required",
    +      "author": "John-David Dalton",
    +      "description": "Lodash modular utilities.",
    +      "purl": "pkg:npm/lodash@4.17.21",
    +      "properties": [
    +        {
    +          "name": "cdx:npm:package:path",
    +          "value": "node_modules/lodash"
    +        }
    +      ],
    +      "externalReferences": [
    +        {
    +          "type": "distribution",
    +          "url": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
    +        },
    +        {
    +          "type": "vcs",
    +          "url": "git+https://github.com/lodash/lodash.git"
    +        },
    +        {
    +          "type": "website",
    +          "url": "https://lodash.com/"
    +        },
    +        {
    +          "type": "issue-tracker",
    +          "url": "https://github.com/lodash/lodash/issues"
    +        }
    +      ],
    +      "hashes": [
    +        {
    +          "alg": "SHA-512",
    +          "content": "bf690311ee7b95e713ba568322e3533f2dd1cb880b189e99d4edef13592b81764daec43e2c54c61d5c558dc5cfb35ecb85b65519e74026ff17675b6f8f916f4a"
    +        }
    +      ],
    +      "licenses": [
    +        {
    +          "license": {
    +            "id": "MIT"
    +          }
    +        }
    +      ]
    +    }
    +  ],
    +  "dependencies": [
    +    {
    +      "ref": "simple@1.0.0",
    +      "dependsOn": [
    +        "lodash@4.17.21"
    +      ]
    +    },
    +    {
    +      "ref": "lodash@4.17.21",
    +      "dependsOn": []
    +    }
    +  ]
    +}
    +
    +

    Example SPDX SBOM

    +
    {
    +  "spdxVersion": "SPDX-2.3",
    +  "dataLicense": "CC0-1.0",
    +  "SPDXID": "SPDXRef-DOCUMENT",
    +  "name": "simple@1.0.0",
    +  "documentNamespace": "http://spdx.org/spdxdocs/simple-1.0.0-bf81090e-8bbc-459d-bec9-abeb794e096a",
    +  "creationInfo": {
    +    "created": "2023-09-01T00:00:00.001Z",
    +    "creators": [
    +      "Tool: npm/cli-10.1.0"
    +    ]
    +  },
    +  "documentDescribes": [
    +    "SPDXRef-Package-simple-1.0.0"
    +  ],
    +  "packages": [
    +    {
    +      "name": "simple",
    +      "SPDXID": "SPDXRef-Package-simple-1.0.0",
    +      "versionInfo": "1.0.0",
    +      "packageFileName": "",
    +      "description": "simple react app",
    +      "primaryPackagePurpose": "LIBRARY",
    +      "downloadLocation": "NOASSERTION",
    +      "filesAnalyzed": false,
    +      "homepage": "NOASSERTION",
    +      "licenseDeclared": "MIT",
    +      "externalRefs": [
    +        {
    +          "referenceCategory": "PACKAGE-MANAGER",
    +          "referenceType": "purl",
    +          "referenceLocator": "pkg:npm/simple@1.0.0"
    +        }
    +      ]
    +    },
    +    {
    +      "name": "lodash",
    +      "SPDXID": "SPDXRef-Package-lodash-4.17.21",
    +      "versionInfo": "4.17.21",
    +      "packageFileName": "node_modules/lodash",
    +      "description": "Lodash modular utilities.",
    +      "downloadLocation": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
    +      "filesAnalyzed": false,
    +      "homepage": "https://lodash.com/",
    +      "licenseDeclared": "MIT",
    +      "externalRefs": [
    +        {
    +          "referenceCategory": "PACKAGE-MANAGER",
    +          "referenceType": "purl",
    +          "referenceLocator": "pkg:npm/lodash@4.17.21"
    +        }
    +      ],
    +      "checksums": [
    +        {
    +          "algorithm": "SHA512",
    +          "checksumValue": "bf690311ee7b95e713ba568322e3533f2dd1cb880b189e99d4edef13592b81764daec43e2c54c61d5c558dc5cfb35ecb85b65519e74026ff17675b6f8f916f4a"
    +        }
    +      ]
    +    }
    +  ],
    +  "relationships": [
    +    {
    +      "spdxElementId": "SPDXRef-DOCUMENT",
    +      "relatedSpdxElement": "SPDXRef-Package-simple-1.0.0",
    +      "relationshipType": "DESCRIBES"
    +    },
    +    {
    +      "spdxElementId": "SPDXRef-Package-simple-1.0.0",
    +      "relatedSpdxElement": "SPDXRef-Package-lodash-4.17.21",
    +      "relationshipType": "DEPENDS_ON"
    +    }
    +  ]
    +}
    +
    +

    Package lock only mode

    +

    If package-lock-only is enabled, only the information in the package +lock (or shrinkwrap) is loaded. This means that information from the +package.json files of your dependencies will not be included in the +result set (e.g. description, homepage, engines).

    +

    Configuration

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    package-lock-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, the current operation will only use the package-lock.json, +ignoring node_modules.

    +

    For update this means only the package-lock.json will be updated, +instead of checking node_modules and downloading dependencies.

    +

    For list this means the output will be based on the tree described by the +package-lock.json, rather than the contents of node_modules.

    +

    sbom-format

    +
      +
    • Default: null
    • +
    • Type: "cyclonedx" or "spdx"
    • +
    +

    SBOM format to use when generating SBOMs.

    +

    sbom-type

    +
      +
    • Default: "library"
    • +
    • Type: "library", "application", or "framework"
    • +
    +

    The type of package described by the generated SBOM. For SPDX, this is the +value for the primaryPackagePurpose field. For CycloneDX, this is the +value for the type field.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-search.html b/node_modules/npm/docs/output/commands/npm-search.html new file mode 100644 index 00000000..b109ce85 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-search.html @@ -0,0 +1,281 @@ + + +npm-search + + + + + +
    +
    +

    + npm-search + @11.0.0 +

    +Search for packages +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm search <search term> [<search term> ...]
    +
    +aliases: find, s, se
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Search the registry for packages matching the search terms. npm search +performs a linear, incremental, lexically-ordered search through package +metadata for all files in the registry. If your terminal has color +support, it will further highlight the matches in the results. This can +be disabled with the config item color

    +

    Additionally, using the --searchopts and --searchexclude options +paired with more search terms will include and exclude further patterns. +The main difference between --searchopts and the standard search terms +is that the former does not highlight results in the output and you can +use them more fine-grained filtering. Additionally, you can add both of +these to your config to change default search filtering behavior.

    +

    Search also allows targeting of maintainers in search results, by prefixing +their npm username with =.

    +

    If a term starts with /, then it's interpreted as a regular expression +and supports standard JavaScript RegExp syntax. In this case search will +ignore a trailing / . (Note you must escape or quote many regular +expression characters in most shells.)

    +

    Configuration

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    color

    +
      +
    • Default: true unless the NO_COLOR environ is set to something other than '0'
    • +
    • Type: "always" or Boolean
    • +
    +

    If false, never shows colors. If "always" then always shows colors. If +true, then only prints color codes for tty file descriptors.

    +

    parseable

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Output parseable results from commands that write to standard output. For +npm search, this will be tab-separated table format.

    +

    description

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Show the description in npm search

    +

    searchlimit

    +
      +
    • Default: 20
    • +
    • Type: Number
    • +
    +

    Number of items to limit search results to. Will not apply at all to legacy +searches.

    +

    searchopts

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    Space-separated options that are always passed to search.

    +

    searchexclude

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    Space-separated options that limit the results from search.

    +

    registry

    + +

    The base URL of the npm registry.

    +

    prefer-online

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, staleness checks for cached data will be forced, making the CLI +look for updates immediately even for fresh package data.

    +

    prefer-offline

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, staleness checks for cached data will be bypassed, but missing data +will be requested from the server. To force full offline mode, use +--offline.

    +

    offline

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Force offline mode: no network requests will be done during install. To +allow the CLI to fill in missing cache data, see --prefer-offline.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-shrinkwrap.html b/node_modules/npm/docs/output/commands/npm-shrinkwrap.html new file mode 100644 index 00000000..023f5fef --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-shrinkwrap.html @@ -0,0 +1,190 @@ + + +npm-shrinkwrap + + + + + +
    +
    +

    + npm-shrinkwrap + @11.0.0 +

    +Lock down dependency versions for publication +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm shrinkwrap
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    This command repurposes package-lock.json into a publishable +npm-shrinkwrap.json or simply creates a new one. The file created and +updated by this command will then take precedence over any other existing +or future package-lock.json files. For a detailed explanation of the +design and purpose of package locks in npm, see +package-lock-json.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-star.html b/node_modules/npm/docs/output/commands/npm-star.html new file mode 100644 index 00000000..2bd9e65a --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-star.html @@ -0,0 +1,217 @@ + + +npm-star + + + + + +
    +
    +

    + npm-star + @11.0.0 +

    +Mark your favorite packages +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm star [<package-spec>...]
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    "Starring" a package means that you have some interest in it. It's +a vaguely positive way to show that you care.

    +

    It's a boolean thing. Starring repeatedly has no additional effect.

    +

    More

    +

    There's also these extra commands to help you manage your favorite packages:

    +

    Unstar

    +

    You can also "unstar" a package using npm unstar

    +

    "Unstarring" is the same thing, but in reverse.

    +

    Listing stars

    +

    You can see all your starred packages using npm stars

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    unicode

    +
      +
    • Default: false on windows, true on mac/unix systems with a unicode locale, +as defined by the LC_ALL, LC_CTYPE, or LANG environment variables.
    • +
    • Type: Boolean
    • +
    +

    When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters instead of unicode glyphs.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-stars.html b/node_modules/npm/docs/output/commands/npm-stars.html new file mode 100644 index 00000000..8ddaec6f --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-stars.html @@ -0,0 +1,193 @@ + + +npm-stars + + + + + +
    +
    +

    + npm-stars + @11.0.0 +

    +View packages marked as favorites +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm stars [<user>]
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    If you have starred a lot of neat things and want to find them again +quickly this command lets you do just that.

    +

    You may also want to see your friend's favorite packages, in this case +you will most certainly enjoy this command.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-start.html b/node_modules/npm/docs/output/commands/npm-start.html new file mode 100644 index 00000000..1b761fe4 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-start.html @@ -0,0 +1,222 @@ + + +npm-start + + + + + +
    +
    +

    + npm-start + @11.0.0 +

    +Start a package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm start [-- <args>]
    +
    +

    Description

    +

    This runs a predefined command specified in the "start" property of +a package's "scripts" object.

    +

    If the "scripts" object does not define a "start" property, npm +will run node server.js.

    +

    Note that this is different from the default node behavior of running +the file specified in a package's "main" attribute when evoking with +node .

    +

    As of npm@2.0.0, you can +use custom arguments when executing scripts. Refer to npm run-script for more details.

    +

    Example

    +
    {
    +  "scripts": {
    +    "start": "node foo.js"
    +  }
    +}
    +
    +
    npm start
    +
    +> npm@x.x.x start
    +> node foo.js
    +
    +(foo.js output would be here)
    +
    +
    +

    Configuration

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    script-shell

    +
      +
    • Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
    • +
    • Type: null or String
    • +
    +

    The shell to use for scripts run with the npm exec, npm run and npm init <package-spec> commands.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-stop.html b/node_modules/npm/docs/output/commands/npm-stop.html new file mode 100644 index 00000000..645e4336 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-stop.html @@ -0,0 +1,217 @@ + + +npm-stop + + + + + +
    +
    +

    + npm-stop + @11.0.0 +

    +Stop a package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm stop [-- <args>]
    +
    +

    Description

    +

    This runs a predefined command specified in the "stop" property of a +package's "scripts" object.

    +

    Unlike with npm start, there is no default script +that will run if the "stop" property is not defined.

    +

    Example

    +
    {
    +  "scripts": {
    +    "stop": "node bar.js"
    +  }
    +}
    +
    +
    npm stop
    +
    +> npm@x.x.x stop
    +> node bar.js
    +
    +(bar.js output would be here)
    +
    +
    +

    Configuration

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    script-shell

    +
      +
    • Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
    • +
    • Type: null or String
    • +
    +

    The shell to use for scripts run with the npm exec, npm run and npm init <package-spec> commands.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-team.html b/node_modules/npm/docs/output/commands/npm-team.html new file mode 100644 index 00000000..8abe275d --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-team.html @@ -0,0 +1,280 @@ + + +npm-team + + + + + +
    +
    +

    + npm-team + @11.0.0 +

    +Manage organization teams and team memberships +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm team create <scope:team> [--otp <otpcode>]
    +npm team destroy <scope:team> [--otp <otpcode>]
    +npm team add <scope:team> <user> [--otp <otpcode>]
    +npm team rm <scope:team> <user> [--otp <otpcode>]
    +npm team ls <scope>|<scope:team>
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Used to manage teams in organizations, and change team memberships. Does not +handle permissions for packages.

    +

    Teams must always be fully qualified with the organization/scope they belong to +when operating on them, separated by a colon (:). That is, if you have a +newteam team in an org organization, you must always refer to that team +as @org:newteam in these commands.

    +

    If you have two-factor authentication enabled in auth-and-writes mode, then +you can provide a code from your authenticator with [--otp <otpcode>]. +If you don't include this then you will be taken through a second factor flow based +on your authtype.

    +
      +
    • +

      create / destroy: +Create a new team, or destroy an existing one. Note: You cannot remove the +developers team, learn more.

      +

      Here's how to create a new team newteam under the org org:

      +
      npm team create @org:newteam
      +
      +

      You should see a confirming message such as: +@org:newteam once the new +team has been created.

      +
    • +
    • +

      add: +Add a user to an existing team.

      +

      Adding a new user username to a team named newteam under the org org:

      +
      npm team add @org:newteam username
      +
      +

      On success, you should see a message: username added to @org:newteam

      +
    • +
    • +

      rm: +Using npm team rm you can also remove users from a team they belong to.

      +

      Here's an example removing user username from newteam team +in org organization:

      +
      npm team rm @org:newteam username
      +
      +

      Once the user is removed a confirmation message is displayed: +username removed from @org:newteam

      +
    • +
    • +

      ls: +If performed on an organization name, will return a list of existing teams +under that organization. If performed on a team, it will instead return a list +of all users belonging to that particular team.

      +

      Here's an example of how to list all teams from an org named org:

      +
      npm team ls @org
      +
      +

      Example listing all members of a team named newteam:

      +
      npm team ls @org:newteam
      +
      +
    • +
    +

    Details

    +

    npm team always operates directly on the current registry, configurable from +the command line using --registry=<registry url>.

    +

    You must be a team admin to create teams and manage team membership, under +the given organization. Listing teams and team memberships may be done by +any member of the organization.

    +

    Organization creation and management of team admins and organization members +is done through the website, not the npm CLI.

    +

    To use teams to manage permissions on packages belonging to your organization, +use the npm access command to grant or revoke the appropriate permissions.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    parseable

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Output parseable results from commands that write to standard output. For +npm search, this will be tab-separated table format.

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-test.html b/node_modules/npm/docs/output/commands/npm-test.html new file mode 100644 index 00000000..f82bb326 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-test.html @@ -0,0 +1,215 @@ + + +npm-test + + + + + +
    +
    +

    + npm-test + @11.0.0 +

    +Test a package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm test [-- <args>]
    +
    +aliases: tst, t
    +
    +

    Description

    +

    This runs a predefined command specified in the "test" property of +a package's "scripts" object.

    +

    Example

    +
    {
    +  "scripts": {
    +    "test": "node test.js"
    +  }
    +}
    +
    +
    npm test
    +> npm@x.x.x test
    +> node test.js
    +
    +(test.js output would be here)
    +
    +

    Configuration

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    script-shell

    +
      +
    • Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
    • +
    • Type: null or String
    • +
    +

    The shell to use for scripts run with the npm exec, npm run and npm init <package-spec> commands.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-token.html b/node_modules/npm/docs/output/commands/npm-token.html new file mode 100644 index 00000000..8df68fc4 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-token.html @@ -0,0 +1,256 @@ + + +npm-token + + + + + +
    +
    +

    + npm-token + @11.0.0 +

    +Manage your authentication tokens +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm token list
    +npm token revoke <id|token>
    +npm token create [--read-only] [--cidr=list]
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    This lets you list, create and revoke authentication tokens.

    +
      +
    • npm token list: +Shows a table of all active authentication tokens. You can request +this as JSON with --json or tab-separated values with --parseable.
    • +
    +
    Read only token npm_1f… with id 7f3134 created 2017-10-21
    +
    +Publish token npm_af…  with id c03241 created 2017-10-02
    +with IP Whitelist: 192.168.0.1/24
    +
    +Publish token npm_… with id e0cf92 created 2017-10-02
    +
    +
    +
      +
    • +

      npm token create [--read-only] [--cidr=<cidr-ranges>]: +Create a new authentication token. It can be --read-only, or accept +a list of +CIDR +ranges with which to limit use of this token. This will prompt you for +your password, and, if you have two-factor authentication enabled, an +otp.

      +

      Currently, the cli can not generate automation tokens. Please refer to +the docs +website +for more information on generating automation tokens.

      +
    • +
    +
    Created publish token a73c9572-f1b9-8983-983d-ba3ac3cc913d
    +
    +
      +
    • npm token revoke <token|id>: +Immediately removes an authentication token from the registry. You +will no longer be able to use it. This can accept both complete +tokens (such as those you get back from npm token create, and those +found in your .npmrc), and ids as seen in the parseable or json +output of npm token list. This will NOT accept the truncated token +found in the normal npm token list output.
    • +
    +

    Configuration

    +

    read-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    This is used to mark a token as unable to publish when configuring limited +access tokens with the npm token create command.

    +

    cidr

    +
      +
    • Default: null
    • +
    • Type: null or String (can be set multiple times)
    • +
    +

    This is a list of CIDR address to be used when configuring limited access +tokens with the npm token create command.

    +

    registry

    + +

    The base URL of the npm registry.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-uninstall.html b/node_modules/npm/docs/output/commands/npm-uninstall.html new file mode 100644 index 00000000..e1f43ac0 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-uninstall.html @@ -0,0 +1,286 @@ + + +npm-uninstall + + + + + +
    +
    +

    + npm-uninstall + @11.0.0 +

    +Remove a package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm uninstall [<@scope>/]<pkg>...
    +
    +aliases: unlink, remove, rm, r, un
    +
    +

    Description

    +

    This uninstalls a package, completely removing everything npm installed +on its behalf.

    +

    It also removes the package from the dependencies, devDependencies, +optionalDependencies, and peerDependencies objects in your +package.json.

    +

    Further, if you have an npm-shrinkwrap.json or package-lock.json, npm +will update those files as well.

    +

    --no-save will tell npm not to remove the package from your +package.json, npm-shrinkwrap.json, or package-lock.json files.

    +

    --save or -S will tell npm to remove the package from your +package.json, npm-shrinkwrap.json, and package-lock.json files. +This is the default, but you may need to use this if you have for +instance save=false in your npmrc file

    +

    In global mode (ie, with -g or --global appended to the command), +it uninstalls the current package context as a global package. +--no-save is ignored in this case.

    +

    Scope is optional and follows the usual rules for scope.

    +

    Examples

    +
    npm uninstall sax
    +
    +

    sax will no longer be in your package.json, npm-shrinkwrap.json, or +package-lock.json files.

    +
    npm uninstall lodash --no-save
    +
    +

    lodash will not be removed from your package.json, +npm-shrinkwrap.json, or package-lock.json files.

    +

    Configuration

    +

    save

    +
      +
    • Default: true unless when using npm update where it defaults to false
    • +
    • Type: Boolean
    • +
    +

    Save installed packages to a package.json file as dependencies.

    +

    When used with the npm rm command, removes the dependency from +package.json.

    +

    Will also prevent writing to package-lock.json if set to false.

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-unpublish.html b/node_modules/npm/docs/output/commands/npm-unpublish.html new file mode 100644 index 00000000..4456a22d --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-unpublish.html @@ -0,0 +1,275 @@ + + +npm-unpublish + + + + + +
    +
    +

    + npm-unpublish + @11.0.0 +

    +Remove a package from the registry +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm unpublish [<package-spec>]
    +
    +

    To learn more about how the npm registry treats unpublish, see our +unpublish policies.

    +

    Warning

    +

    Consider using the deprecate command instead, +if your intent is to encourage users to upgrade, or if you no longer +want to maintain a package.

    +

    Description

    +

    This removes a package version from the registry, deleting its entry and +removing the tarball.

    +

    The npm registry will return an error if you are not logged +in.

    +

    If you do not specify a package name at all, the name and version to be +unpublished will be pulled from the project in the current directory.

    +

    If you specify a package name but do not specify a version or if you +remove all of a package's versions then the registry will remove the +root package entry entirely.

    +

    Even if you unpublish a package version, that specific name and version +combination can never be reused. In order to publish the package again, +you must use a new version number. If you unpublish the entire package, +you may not publish any new versions of that package until 24 hours have +passed.

    +

    Configuration

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    force

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Removes various protections against unfortunate side effects, common +mistakes, unnecessary performance degradation, and malicious input.

    +
      +
    • Allow clobbering non-npm files in global installs.
    • +
    • Allow the npm version command to work on an unclean git repository.
    • +
    • Allow deleting the cache folder with npm cache clean.
    • +
    • Allow installing packages that have an engines declaration requiring a +different version of npm.
    • +
    • Allow installing packages that have an engines declaration requiring a +different version of node, even if --engine-strict is enabled.
    • +
    • Allow npm audit fix to install modules outside your stated dependency +range (including SemVer-major changes).
    • +
    • Allow unpublishing all versions of a published package.
    • +
    • Allow conflicting peerDependencies to be installed in the root project.
    • +
    • Implicitly set --yes during npm init.
    • +
    • Allow clobbering existing values in npm pkg
    • +
    • Allow unpublishing of entire packages (not just a single version).
    • +
    +

    If you don't have a clear idea of what you want to do, it is strongly +recommended that you do not use this option!

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-unstar.html b/node_modules/npm/docs/output/commands/npm-unstar.html new file mode 100644 index 00000000..082be228 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-unstar.html @@ -0,0 +1,214 @@ + + +npm-unstar + + + + + +
    +
    +

    + npm-unstar + @11.0.0 +

    +Remove an item from your favorite packages +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm unstar [<package-spec>...]
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    "Unstarring" a package is the opposite of npm star, +it removes an item from your list of favorite packages.

    +

    More

    +

    There's also these extra commands to help you manage your favorite packages:

    +

    Star

    +

    You can "star" a package using npm star

    +

    Listing stars

    +

    You can see all your starred packages using npm stars

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    unicode

    +
      +
    • Default: false on windows, true on mac/unix systems with a unicode locale, +as defined by the LC_ALL, LC_CTYPE, or LANG environment variables.
    • +
    • Type: Boolean
    • +
    +

    When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters instead of unicode glyphs.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-update.html b/node_modules/npm/docs/output/commands/npm-update.html new file mode 100644 index 00000000..0bd67db4 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-update.html @@ -0,0 +1,494 @@ + + +npm-update + + + + + +
    +
    +

    + npm-update + @11.0.0 +

    +Update packages +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm update [<pkg>...]
    +
    +aliases: up, upgrade, udpate
    +
    +

    Description

    +

    This command will update all the packages listed to the latest version +(specified by the tag config), respecting the semver +constraints of both your package and its dependencies (if they also require the +same package).

    +

    It will also install missing packages.

    +

    If the -g flag is specified, this command will update globally installed +packages.

    +

    If no package name is specified, all packages in the specified location (global +or local) will be updated.

    +

    Note that by default npm update will not update the semver values of direct +dependencies in your project package.json. If you want to also update +values in package.json you can run: npm update --save (or add the +save=true option to a configuration file +to make that the default behavior).

    +

    Example

    +

    For the examples below, assume that the current package is app and it depends +on dependencies, dep1 (dep2, .. etc.). The published versions of dep1 +are:

    +
    {
    +  "dist-tags": { "latest": "1.2.2" },
    +  "versions": [
    +    "1.2.2",
    +    "1.2.1",
    +    "1.2.0",
    +    "1.1.2",
    +    "1.1.1",
    +    "1.0.0",
    +    "0.4.1",
    +    "0.4.0",
    +    "0.2.0"
    +  ]
    +}
    +
    +

    Caret Dependencies

    +

    If app's package.json contains:

    +
    "dependencies": {
    +  "dep1": "^1.1.1"
    +}
    +
    +

    Then npm update will install dep1@1.2.2, because 1.2.2 is latest and +1.2.2 satisfies ^1.1.1.

    +

    Tilde Dependencies

    +

    However, if app's package.json contains:

    +
    "dependencies": {
    +  "dep1": "~1.1.1"
    +}
    +
    +

    In this case, running npm update will install dep1@1.1.2. Even though the +latest tag points to 1.2.2, this version does not satisfy ~1.1.1, which is +equivalent to >=1.1.1 <1.2.0. So the highest-sorting version that satisfies +~1.1.1 is used, which is 1.1.2.

    +

    Caret Dependencies below 1.0.0

    +

    Suppose app has a caret dependency on a version below 1.0.0, for example:

    +
    "dependencies": {
    +  "dep1": "^0.2.0"
    +}
    +
    +

    npm update will install dep1@0.2.0.

    +

    If the dependence were on ^0.4.0:

    +
    "dependencies": {
    +  "dep1": "^0.4.0"
    +}
    +
    +

    Then npm update will install dep1@0.4.1, because that is the highest-sorting +version that satisfies ^0.4.0 (>= 0.4.0 <0.5.0)

    +

    Subdependencies

    +

    Suppose your app now also has a dependency on dep2

    +
    {
    +  "name": "my-app",
    +  "dependencies": {
    +      "dep1": "^1.0.0",
    +      "dep2": "1.0.0"
    +  }
    +}
    +
    +

    and dep2 itself depends on this limited range of dep1

    +
    {
    +"name": "dep2",
    +  "dependencies": {
    +    "dep1": "~1.1.1"
    +  }
    +}
    +
    +

    Then npm update will install dep1@1.1.2 because that is the highest +version that dep2 allows. npm will prioritize having a single version +of dep1 in your tree rather than two when that single version can +satisfy the semver requirements of multiple dependencies in your tree. +In this case if you really did need your package to use a newer version +you would need to use npm install.

    +

    Updating Globally-Installed Packages

    +

    npm update -g will apply the update action to each globally installed +package that is outdated -- that is, has a version that is different from +wanted.

    +

    Note: Globally installed packages are treated as if they are installed with a +caret semver range specified. So if you require to update to latest you may +need to run npm install -g [<pkg>...]

    +

    NOTE: If a package has been upgraded to a version newer than latest, it will +be downgraded.

    +

    Configuration

    +

    save

    +
      +
    • Default: true unless when using npm update where it defaults to false
    • +
    • Type: Boolean
    • +
    +

    Save installed packages to a package.json file as dependencies.

    +

    When used with the npm rm command, removes the dependency from +package.json.

    +

    Will also prevent writing to package-lock.json if set to false.

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    install-strategy

    +
      +
    • Default: "hoisted"
    • +
    • Type: "hoisted", "nested", "shallow", or "linked"
    • +
    +

    Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted.

    +

    legacy-bundling

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=nested
    • +
    +

    Instead of hoisting package installs in node_modules, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets --install-strategy=nested.

    +

    global-style

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=shallow
    • +
    +

    Only install direct dependencies in the top level node_modules, but hoist +on deeper dependencies. Sets --install-strategy=shallow.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    strict-peer-deps

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, and --legacy-peer-deps is not set, then any +conflicting peerDependencies will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships.

    +

    By default, conflicting peerDependencies deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's peerDependencies object.

    +

    When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If --strict-peer-deps is set, then +this warning is treated as a failure.

    +

    package-lock

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to false, then ignore package-lock.json files when installing. This +will also prevent writing package-lock.json if save is true.

    +

    foreground-scripts

    +
      +
    • Default: false unless when using npm pack or npm publish where it +defaults to true
    • +
    • Type: Boolean
    • +
    +

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    audit

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for npm audit for details on what is +submitted.

    + +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tells npm to create symlinks (or .cmd shims on Windows) for package +executables.

    +

    Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems.

    +

    fund

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" displays the message at the end of each npm install +acknowledging the number of dependencies looking for funding. See npm fund for details.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-version.html b/node_modules/npm/docs/output/commands/npm-version.html new file mode 100644 index 00000000..e7679c65 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-version.html @@ -0,0 +1,349 @@ + + +npm-version + + + + + +
    +
    +

    + npm-version + @11.0.0 +

    +Bump a package version +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]
    +
    +alias: verison
    +
    +

    Configuration

    +

    allow-same-version

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Prevents throwing an error when npm version is used to set the new version +to the same value as the current version.

    +

    commit-hooks

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Run git commit hooks when using the npm version command.

    +

    git-tag-version

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tag the commit when using the npm version command. Setting this to false +results in no commit being made at all.

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    preid

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    The "prerelease identifier" to use as a prefix for the "prerelease" part of +a semver. Like the rc in 1.2.0-rc.8.

    +

    sign-git-tag

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, then the npm version command will tag the version using +-s to add a signature.

    +

    Note that git requires you to have set up GPG keys in your git configs for +this to work properly.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    workspaces-update

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to true, the npm cli will run an update after operations that may +possibly change the workspaces installed to the node_modules folder.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    Description

    +

    Run this in a package directory to bump the version and write the new data +back to package.json, package-lock.json, and, if present, +npm-shrinkwrap.json.

    +

    The newversion argument should be a valid semver string, a valid second +argument to semver.inc (one +of patch, minor, major, prepatch, preminor, premajor, +prerelease), or from-git. In the second case, the existing version will +be incremented by 1 in the specified field. from-git will try to read +the latest git tag, and use that as the new npm version.

    +

    If run in a git repo, it will also create a version commit and tag. This +behavior is controlled by git-tag-version (see below), and can be +disabled on the command line by running npm --no-git-tag-version version. +It will fail if the working directory is not clean, unless the -f or +--force flag is set.

    +

    If supplied with -m or --message config option, +npm will use it as a commit message when creating a version commit. If the +message config contains %s then that will be replaced with the resulting +version number. For example:

    +
    npm version patch -m "Upgrade to %s for reasons"
    +
    +

    If the sign-git-tag config is set, then the +tag will be signed using the -s flag to git. Note that you must have a default +GPG key set up in your git config for this to work properly. For example:

    +
    $ npm config set sign-git-tag true
    +$ npm version patch
    +
    +You need a passphrase to unlock the secret key for
    +user: "isaacs (http://blog.izs.me/) <i@izs.me>"
    +2048-bit RSA key, ID 6C481CF6, created 2010-08-31
    +
    +Enter passphrase:
    +
    +

    If preversion, version, or postversion are in the scripts property +of the package.json, they will be executed as part of running npm version.

    +

    The exact order of execution is as follows:

    +
      +
    1. Check to make sure the git working directory is clean before we get +started. Your scripts may add files to the commit in future steps. +This step is skipped if the --force flag is set.
    2. +
    3. Run the preversion script. These scripts have access to the old +version in package.json. A typical use would be running your full +test suite before deploying. Any files you want added to the commit +should be explicitly added using git add.
    4. +
    5. Bump version in package.json as requested (patch, minor, +major, etc).
    6. +
    7. Run the version script. These scripts have access to the new version +in package.json (so they can incorporate it into file headers in +generated files for example). Again, scripts should explicitly add +generated files to the commit using git add.
    8. +
    9. Commit and tag.
    10. +
    11. Run the postversion script. Use it to clean up the file system or +automatically push the commit and/or tag.
    12. +
    +

    Take the following example:

    +
    {
    +  "scripts": {
    +    "preversion": "npm test",
    +    "version": "npm run build && git add -A dist",
    +    "postversion": "git push && git push --tags && rm -rf build/temp"
    +  }
    +}
    +
    +

    This runs all your tests and proceeds only if they pass. Then runs your +build script, and adds everything in the dist directory to the commit. +After the commit, it pushes the new commit and tag up to the server, and +deletes the build/temp directory.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-view.html b/node_modules/npm/docs/output/commands/npm-view.html new file mode 100644 index 00000000..c8d4fdd5 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-view.html @@ -0,0 +1,305 @@ + + +npm-view + + + + + +
    +
    +

    + npm-view + @11.0.0 +

    +View registry info +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm view [<package-spec>] [<field>[.subfield]...]
    +
    +aliases: info, show, v
    +
    +

    Description

    +

    This command shows data about a package and prints it to stdout.

    +

    As an example, to view information about the connect package from the registry, you would run:

    +
    npm view connect
    +
    +

    The default version is "latest" if unspecified.

    +

    Field names can be specified after the package descriptor. +For example, to show the dependencies of the ronn package at version +0.3.5, you could do the following:

    +
    npm view ronn@0.3.5 dependencies
    +
    +

    By default, npm view shows data about the current project context (by looking for a package.json). +To show field data for the current project use a file path (i.e. .):

    +
    npm view . dependencies
    +
    +

    You can view child fields by separating them with a period. +To view the git repository URL for the latest version of npm, you would run the following command:

    +
    npm view npm repository.url
    +
    +

    This makes it easy to view information about a dependency with a bit of +shell scripting. For example, to view all the data about the version of +opts that ronn depends on, you could write the following:

    +
    npm view opts@$(npm view ronn dependencies.opts)
    +
    +

    For fields that are arrays, requesting a non-numeric field will return +all of the values from the objects in the list. For example, to get all +the contributor email addresses for the express package, you would run:

    +
    npm view express contributors.email
    +
    +

    You may also use numeric indices in square braces to specifically select +an item in an array field. To just get the email address of the first +contributor in the list, you can run:

    +
    npm view express contributors[0].email
    +
    +

    If the field value you are querying for is a property of an object, you should run:

    +
    npm view express time'[4.8.0]'
    +
    +

    Multiple fields may be specified, and will be printed one after another. +For example, to get all the contributor names and email addresses, you +can do this:

    +
    npm view express contributors.name contributors.email
    +
    +

    "Person" fields are shown as a string if they would be shown as an +object. So, for example, this will show the list of npm contributors in +the shortened string format. (See package.json for more on this.)

    +
    npm view npm contributors
    +
    +

    If a version range is provided, then data will be printed for every +matching version of the package. This will show which version of jsdom +was required by each matching version of yui3:

    +
    npm view yui3@'>0.5.4' dependencies.jsdom
    +
    +

    To show the connect package version history, you can do +this:

    +
    npm view connect versions
    +
    +

    Configuration

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    Output

    +

    If only a single string field for a single version is output, then it +will not be colorized or quoted, to enable piping the output to +another command. If the field is an object, it will be output as a JavaScript object literal.

    +

    If the --json flag is given, the outputted fields will be JSON.

    +

    If the version range matches multiple versions then each printed value +will be prefixed with the version it applies to.

    +

    If multiple fields are requested, then each of them is prefixed with +the field name.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm-whoami.html b/node_modules/npm/docs/output/commands/npm-whoami.html new file mode 100644 index 00000000..ab9c8600 --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm-whoami.html @@ -0,0 +1,193 @@ + + +npm-whoami + + + + + +
    +
    +

    + npm-whoami + @11.0.0 +

    +Display npm username +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm whoami
    +
    +

    Note: This command is unaware of workspaces.

    +

    Description

    +

    Display the npm username of the currently logged-in user.

    +

    If logged into a registry that provides token-based authentication, then +connect to the /-/whoami registry endpoint to find the username +associated with the token, and print to standard output.

    +

    If logged into a registry that uses Basic Auth, then simply print the +username portion of the authentication string.

    +

    Configuration

    +

    registry

    + +

    The base URL of the npm registry.

    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npm.html b/node_modules/npm/docs/output/commands/npm.html new file mode 100644 index 00000000..d3641aeb --- /dev/null +++ b/node_modules/npm/docs/output/commands/npm.html @@ -0,0 +1,304 @@ + + +npm + + + + + +
    +
    +

    + npm + @11.0.0 +

    +javascript package manager +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npm
    +
    +

    Note: This command is unaware of workspaces.

    +

    Version

    +

    11.0.0

    +

    Description

    +

    npm is the package manager for the Node JavaScript platform. It puts +modules in place so that node can find them, and manages dependency +conflicts intelligently.

    +

    It is extremely configurable to support a variety of use cases. Most +commonly, you use it to publish, discover, install, and develop node +programs.

    +

    Run npm help to get a list of available commands.

    +

    Important

    +

    npm comes preconfigured to use npm's public registry at +https://registry.npmjs.org by default. Use of the npm public registry is +subject to terms of use available at +https://docs.npmjs.com/policies/terms.

    +

    You can configure npm to use any compatible registry you like, and even +run your own registry. Use of someone else's registry is governed by +their terms of use.

    +

    Introduction

    +

    You probably got npm because you want to install stuff.

    +

    The very first thing you will most likely want to run in any node +program is npm install to install its dependencies.

    +

    You can also run npm install blerg to install the latest version of +"blerg". Check out npm install for more +info. It can do a lot of stuff.

    +

    Use the npm search command to show everything that's available in the +public registry. Use npm ls to show everything you've installed.

    +

    Dependencies

    +

    If a package lists a dependency using a git URL, npm will install that +dependency using the git +command and will generate an error if it is not installed.

    +

    If one of the packages npm tries to install is a native node module and +requires compiling of C++ Code, npm will use +node-gyp for that task. +For a Unix system, node-gyp +needs Python, make and a buildchain like GCC. On Windows, +Python and Microsoft Visual Studio C++ are needed. For more information +visit the node-gyp repository and +the node-gyp Wiki.

    +

    Directories

    +

    See folders to learn about where npm puts +stuff.

    +

    In particular, npm has two modes of operation:

    +
      +
    • local mode: +npm installs packages into the current project directory, which +defaults to the current working directory. Packages install to +./node_modules, and bins to ./node_modules/.bin.
    • +
    • global mode: +npm installs packages into the install prefix at +$npm_config_prefix/lib/node_modules and bins to +$npm_config_prefix/bin.
    • +
    +

    Local mode is the default. Use -g or --global on any command to +run in global mode instead.

    +

    Developer Usage

    +

    If you're using npm to develop and publish your code, check out the +following help topics:

    +
      +
    • json: +Make a package.json file. See +package.json.
    • +
    • link: +Links your current working code into Node's path, so that you don't +have to reinstall every time you make a change. Use npm link to do this.
    • +
    • install: +It's a good idea to install things if you don't need the symbolic +link. Especially, installing other peoples code from the registry is +done via npm install
    • +
    • adduser: +Create an account or log in. When you do this, npm will store +credentials in the user config file.
    • +
    • publish: +Use the npm publish command to upload your +code to the registry.
    • +
    +

    Configuration

    +

    npm is extremely configurable. It reads its configuration options from +5 places.

    +
      +
    • Command line switches: +Set a config with --key val. All keys take a value, even if they +are booleans (the config parser doesn't know what the options are at +the time of parsing). If you do not provide a value (--key) then +the option is set to boolean true.
    • +
    • Environment Variables: +Set any config by prefixing the name in an environment variable with +npm_config_. For example, export npm_config_key=val.
    • +
    • User Configs: +The file at $HOME/.npmrc is an ini-formatted list of configs. If +present, it is parsed. If the userconfig option is set in the cli +or env, that file will be used instead.
    • +
    • Global Configs: +The file found at ./etc/npmrc (relative to the global prefix will be +parsed if it is found. See npm prefix for +more info on the global prefix. If the globalconfig option is set +in the cli, env, or user config, then that file is parsed instead.
    • +
    • Defaults: +npm's default configuration options are defined in +lib/utils/config/definitions.js. These must not be changed.
    • +
    +

    See config for much much more information.

    +

    Contributions

    +

    Patches welcome!

    +

    If you would like to help, but don't know what to work on, read the +contributing +guidelines and +check the issues list.

    +

    Bugs

    +

    When you find issues, please report them: +https://github.com/npm/cli/issues

    +

    Please be sure to follow the template and bug reporting guidelines.

    +

    Feature Requests

    +

    Discuss new feature ideas on our discussion forum:

    + +

    Or suggest formal RFC proposals:

    + +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/commands/npx.html b/node_modules/npm/docs/output/commands/npx.html new file mode 100644 index 00000000..39ef19db --- /dev/null +++ b/node_modules/npm/docs/output/commands/npx.html @@ -0,0 +1,293 @@ + + +npx + + + + + +
    +
    +

    + npx + @11.0.0 +

    +Run a command from a local or remote npm package +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +
    npx -- <pkg>[@<version>] [args...]
    +npx --package=<pkg>[@<version>] -- <cmd> [args...]
    +npx -c '<cmd> [args...]'
    +npx --package=foo -c '<cmd> [args...]'
    +
    +

    Description

    +

    This command allows you to run an arbitrary command from an npm package +(either one installed locally, or fetched remotely), in a similar context +as running it via npm run.

    +

    Whatever packages are specified by the --package option will be +provided in the PATH of the executed command, along with any locally +installed package executables. The --package option may be +specified multiple times, to execute the supplied command in an environment +where all specified packages are available.

    +

    If any requested packages are not present in the local project +dependencies, then they are installed to a folder in the npm cache, which +is added to the PATH environment variable in the executed process. A +prompt is printed (which can be suppressed by providing either --yes or +--no).

    +

    Package names provided without a specifier will be matched with whatever +version exists in the local project. Package names with a specifier will +only be considered a match if they have the exact same name and version as +the local dependency.

    +

    If no -c or --call option is provided, then the positional arguments +are used to generate the command string. If no --package options +are provided, then npm will attempt to determine the executable name from +the package specifier provided as the first positional argument according +to the following heuristic:

    +
      +
    • If the package has a single entry in its bin field in package.json, +or if all entries are aliases of the same command, then that command +will be used.
    • +
    • If the package has multiple bin entries, and one of them matches the +unscoped portion of the name field, then that command will be used.
    • +
    • If this does not result in exactly one option (either because there are +no bin entries, or none of them match the name of the package), then +npm exec exits with an error.
    • +
    +

    To run a binary other than the named binary, specify one or more +--package options, which will prevent npm from inferring the package from +the first command argument.

    +

    npx vs npm exec

    +

    When run via the npx binary, all flags and options must be set prior to +any positional arguments. When run via npm exec, a double-hyphen -- +flag can be used to suppress npm's parsing of switches and options that +should be sent to the executed command.

    +

    For example:

    +
    $ npx foo@latest bar --package=@npmcli/foo
    +
    +

    In this case, npm will resolve the foo package name, and run the +following command:

    +
    $ foo bar --package=@npmcli/foo
    +
    +

    Since the --package option comes after the positional arguments, it is +treated as an argument to the executed command.

    +

    In contrast, due to npm's argument parsing logic, running this command is +different:

    +
    $ npm exec foo@latest bar --package=@npmcli/foo
    +
    +

    In this case, npm will parse the --package option first, resolving the +@npmcli/foo package. Then, it will execute the following command in that +context:

    +
    $ foo@latest bar
    +
    +

    The double-hyphen character is recommended to explicitly tell npm to stop +parsing command line options and switches. The following command would +thus be equivalent to the npx command above:

    +
    $ npm exec -- foo@latest bar --package=@npmcli/foo
    +
    +

    Examples

    +

    Run the version of tap in the local dependencies, with the provided +arguments:

    +
    $ npm exec -- tap --bail test/foo.js
    +$ npx tap --bail test/foo.js
    +
    +

    Run a command other than the command whose name matches the package name +by specifying a --package option:

    +
    $ npm exec --package=foo -- bar --bar-argument
    +# ~ or ~
    +$ npx --package=foo bar --bar-argument
    +
    +

    Run an arbitrary shell script, in the context of the current project:

    +
    $ npm x -c 'eslint && say "hooray, lint passed"'
    +$ npx -c 'eslint && say "hooray, lint passed"'
    +
    +

    Compatibility with Older npx Versions

    +

    The npx binary was rewritten in npm v7.0.0, and the standalone npx +package deprecated at that time. npx uses the npm exec +command instead of a separate argument parser and install process, with +some affordances to maintain backwards compatibility with the arguments it +accepted in previous versions.

    +

    This resulted in some shifts in its functionality:

    +
      +
    • Any npm config value may be provided.
    • +
    • To prevent security and user-experience problems from mistyping package +names, npx prompts before installing anything. Suppress this +prompt with the -y or --yes option.
    • +
    • The --no-install option is deprecated, and will be converted to --no.
    • +
    • Shell fallback functionality is removed, as it is not advisable.
    • +
    • The -p argument is a shorthand for --parseable in npm, but shorthand +for --package in npx. This is maintained, but only for the npx +executable.
    • +
    • The --ignore-existing option is removed. Locally installed bins are +always present in the executed process PATH.
    • +
    • The --npm option is removed. npx will always use the npm it ships +with.
    • +
    • The --node-arg and -n options have been removed. Use NODE_OPTIONS instead: e.g., +NODE_OPTIONS="--trace-warnings --trace-exit" npx foo --random=true
    • +
    • The --always-spawn option is redundant, and thus removed.
    • +
    • The --shell option is replaced with --script-shell, but maintained +in the npx executable for backwards compatibility.
    • +
    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/configuring-npm/folders.html b/node_modules/npm/docs/output/configuring-npm/folders.html new file mode 100644 index 00000000..8c5d99c5 --- /dev/null +++ b/node_modules/npm/docs/output/configuring-npm/folders.html @@ -0,0 +1,330 @@ + + +folders + + + + + +
    +
    +

    + folders + @11.0.0 +

    +Folder Structures Used by npm +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    npm puts various things on your computer. That's its job.

    +

    This document will tell you what it puts where.

    +

    tl;dr

    +
      +
    • Local install (default): puts stuff in ./node_modules of the current +package root.
    • +
    • Global install (with -g): puts stuff in /usr/local or wherever node +is installed.
    • +
    • Install it locally if you're going to require() it.
    • +
    • Install it globally if you're going to run it on the command line.
    • +
    • If you need both, then install it in both places, or use npm link.
    • +
    +

    prefix Configuration

    +

    The prefix config defaults to the location where +node is installed. On most systems, this is /usr/local. On Windows, it's +%AppData%\npm. On Unix systems, it's one level up, since node is typically +installed at {prefix}/bin/node rather than {prefix}/node.exe.

    +

    When the global flag is set, npm installs things into this prefix. +When it is not set, it uses the root of the current package, or the +current working directory if not in a package already.

    +

    Node Modules

    +

    Packages are dropped into the node_modules folder under the prefix. +When installing locally, this means that you can +require("packagename") to load its main module, or +require("packagename/lib/path/to/sub/module") to load other modules.

    +

    Global installs on Unix systems go to {prefix}/lib/node_modules. +Global installs on Windows go to {prefix}/node_modules (that is, no +lib folder.)

    +

    Scoped packages are installed the same way, except they are grouped together +in a sub-folder of the relevant node_modules folder with the name of that +scope prefix by the @ symbol, e.g. npm install @myorg/package would place +the package in {prefix}/node_modules/@myorg/package. See +scope for more details.

    +

    If you wish to require() a package, then install it locally.

    +

    Executables

    +

    When in global mode, executables are linked into {prefix}/bin on Unix, +or directly into {prefix} on Windows. Ensure that path is in your +terminal's PATH environment to run them.

    +

    When in local mode, executables are linked into +./node_modules/.bin so that they can be made available to scripts run +through npm. (For example, so that a test runner will be in the path +when you run npm test.)

    +

    Man Pages

    +

    When in global mode, man pages are linked into {prefix}/share/man.

    +

    When in local mode, man pages are not installed.

    +

    Man pages are not installed on Windows systems.

    +

    Cache

    +

    See npm cache. Cache files are stored in ~/.npm on Posix, or +%LocalAppData%/npm-cache on Windows.

    +

    This is controlled by the cache config param.

    +

    Temp Files

    +

    Temporary files are stored by default in the folder specified by the +tmp config, which defaults to the TMPDIR, TMP, or +TEMP environment variables, or /tmp on Unix and c:\windows\temp on Windows.

    +

    Temp files are given a unique folder under this root for each run of the +program, and are deleted upon successful exit.

    +

    More Information

    +

    When installing locally, npm first tries to find an appropriate +prefix folder. This is so that npm install foo@1.2.3 will install +to the sensible root of your package, even if you happen to have cded +into some other folder.

    +

    Starting at the $PWD, npm will walk up the folder tree checking for a +folder that contains either a package.json file, or a node_modules +folder. If such a thing is found, then that is treated as the effective +"current directory" for the purpose of running npm commands. (This +behavior is inspired by and similar to git's .git-folder seeking +logic when running git commands in a working dir.)

    +

    If no package root is found, then the current folder is used.

    +

    When you run npm install foo@1.2.3, then the package is loaded into +the cache, and then unpacked into ./node_modules/foo. Then, any of +foo's dependencies are similarly unpacked into +./node_modules/foo/node_modules/....

    +

    Any bin files are symlinked to ./node_modules/.bin/, so that they may +be found by npm scripts when necessary.

    +

    Global Installation

    +

    If the global config is set to true, then npm will +install packages "globally".

    +

    For global installation, packages are installed roughly the same way, +but using the folders described above.

    +

    Cycles, Conflicts, and Folder Parsimony

    +

    Cycles are handled using the property of node's module system that it +walks up the directories looking for node_modules folders. So, at every +stage, if a package is already installed in an ancestor node_modules +folder, then it is not installed at the current location.

    +

    Consider the case above, where foo -> bar -> baz. Imagine if, in +addition to that, baz depended on bar, so you'd have: +foo -> bar -> baz -> bar -> baz .... However, since the folder +structure is: foo/node_modules/bar/node_modules/baz, there's no need to +put another copy of bar into .../baz/node_modules, since when baz calls +require("bar"), it will get the copy that is installed in +foo/node_modules/bar.

    +

    This shortcut is only used if the exact same +version would be installed in multiple nested node_modules folders. It +is still possible to have a/node_modules/b/node_modules/a if the two +"a" packages are different versions. However, without repeating the +exact same package multiple times, an infinite regress will always be +prevented.

    +

    Another optimization can be made by installing dependencies at the +highest level possible, below the localized "target" folder (hoisting). +Since version 3, npm hoists dependencies by default.

    +

    Example

    +

    Consider this dependency graph:

    +
    foo
    ++-- blerg@1.2.5
    ++-- bar@1.2.3
    +|   +-- blerg@1.x (latest=1.3.7)
    +|   +-- baz@2.x
    +|   |   `-- quux@3.x
    +|   |       `-- bar@1.2.3 (cycle)
    +|   `-- asdf@*
    +`-- baz@1.2.3
    +    `-- quux@3.x
    +        `-- bar
    +
    +

    In this case, we might expect a folder structure like this +(with all dependencies hoisted to the highest level possible):

    +
    foo
    ++-- node_modules
    +    +-- blerg (1.2.5) <---[A]
    +    +-- bar (1.2.3) <---[B]
    +    |   +-- node_modules
    +    |       +-- baz (2.0.2) <---[C]
    +    +-- asdf (2.3.4)
    +    +-- baz (1.2.3) <---[D]
    +    +-- quux (3.2.0) <---[E]
    +
    +

    Since foo depends directly on bar@1.2.3 and baz@1.2.3, those are +installed in foo's node_modules folder.

    +

    Even though the latest copy of blerg is 1.3.7, foo has a specific +dependency on version 1.2.5. So, that gets installed at [A]. Since the +parent installation of blerg satisfies bar's dependency on blerg@1.x, +it does not install another copy under [B].

    +

    Bar [B] also has dependencies on baz and asdf. Because it depends on baz@2.x, it cannot +re-use the baz@1.2.3 installed in the parent node_modules folder [D], +and must install its own copy [C]. In order to minimize duplication, npm hoists +dependencies to the top level by default, so asdf is installed under [A].

    +

    Underneath bar, the baz -> quux -> bar dependency creates a cycle. +However, because bar is already in quux's ancestry [B], it does not +unpack another copy of bar into that folder. Likewise, quux's [E] +folder tree is empty, because its dependency on bar is satisfied +by the parent folder copy installed at [B].

    +

    For a graphical breakdown of what is installed where, use npm ls.

    +

    Publishing

    +

    Upon publishing, npm will look in the node_modules folder. If any of +the items there are not in the bundleDependencies array, then they will +not be included in the package tarball.

    +

    This allows a package maintainer to install all of their dependencies +(and dev dependencies) locally, but only re-publish those items that +cannot be found elsewhere. See package.json for more information.

    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/configuring-npm/install.html b/node_modules/npm/docs/output/configuring-npm/install.html new file mode 100644 index 00000000..a563910c --- /dev/null +++ b/node_modules/npm/docs/output/configuring-npm/install.html @@ -0,0 +1,225 @@ + + +install + + + + + +
    +
    +

    + install + @11.0.0 +

    +Download and install node and npm +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    To publish and install packages to and from the public npm registry, you +must install Node.js and the npm command line interface using either a Node +version manager or a Node installer. We strongly recommend using a Node +version manager to install Node.js and npm. We do not recommend using a +Node installer, since the Node installation process installs npm in a +directory with local permissions and can cause permissions errors when you +run npm packages globally.

    +

    Overview

    + +

    Checking your version of npm and Node.js

    +

    To see if you already have Node.js and npm installed and check the +installed version, run the following commands:

    +
    node -v
    +npm -v
    +
    +

    Using a Node version manager to install Node.js and npm

    +

    Node version managers allow you to install and switch between multiple +versions of Node.js and npm on your system so you can test your +applications on multiple versions of npm to ensure they work for users on +different versions. You can +search for them on GitHub.

    +

    Using a Node installer to install Node.js and npm

    +

    If you are unable to use a Node version manager, you can use a Node +installer to install both Node.js and npm on your system.

    + +

    OS X or Windows Node installers

    +

    If you're using OS X or Windows, use one of the installers from the +Node.js download page. Be sure to +install the version labeled LTS. Other versions have not yet been +tested with npm.

    +

    Linux or other operating systems Node installers

    +

    If you're using Linux or another operating system, use one of the following +installers:

    + +

    Or see this page to +install npm for Linux in the way many Linux developers prefer.

    +

    Less-common operating systems

    +

    For more information on installing Node.js on a variety of operating +systems, see this page.

    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/configuring-npm/npm-global.html b/node_modules/npm/docs/output/configuring-npm/npm-global.html new file mode 100644 index 00000000..8c5d99c5 --- /dev/null +++ b/node_modules/npm/docs/output/configuring-npm/npm-global.html @@ -0,0 +1,330 @@ + + +folders + + + + + +
    +
    +

    + folders + @11.0.0 +

    +Folder Structures Used by npm +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    npm puts various things on your computer. That's its job.

    +

    This document will tell you what it puts where.

    +

    tl;dr

    +
      +
    • Local install (default): puts stuff in ./node_modules of the current +package root.
    • +
    • Global install (with -g): puts stuff in /usr/local or wherever node +is installed.
    • +
    • Install it locally if you're going to require() it.
    • +
    • Install it globally if you're going to run it on the command line.
    • +
    • If you need both, then install it in both places, or use npm link.
    • +
    +

    prefix Configuration

    +

    The prefix config defaults to the location where +node is installed. On most systems, this is /usr/local. On Windows, it's +%AppData%\npm. On Unix systems, it's one level up, since node is typically +installed at {prefix}/bin/node rather than {prefix}/node.exe.

    +

    When the global flag is set, npm installs things into this prefix. +When it is not set, it uses the root of the current package, or the +current working directory if not in a package already.

    +

    Node Modules

    +

    Packages are dropped into the node_modules folder under the prefix. +When installing locally, this means that you can +require("packagename") to load its main module, or +require("packagename/lib/path/to/sub/module") to load other modules.

    +

    Global installs on Unix systems go to {prefix}/lib/node_modules. +Global installs on Windows go to {prefix}/node_modules (that is, no +lib folder.)

    +

    Scoped packages are installed the same way, except they are grouped together +in a sub-folder of the relevant node_modules folder with the name of that +scope prefix by the @ symbol, e.g. npm install @myorg/package would place +the package in {prefix}/node_modules/@myorg/package. See +scope for more details.

    +

    If you wish to require() a package, then install it locally.

    +

    Executables

    +

    When in global mode, executables are linked into {prefix}/bin on Unix, +or directly into {prefix} on Windows. Ensure that path is in your +terminal's PATH environment to run them.

    +

    When in local mode, executables are linked into +./node_modules/.bin so that they can be made available to scripts run +through npm. (For example, so that a test runner will be in the path +when you run npm test.)

    +

    Man Pages

    +

    When in global mode, man pages are linked into {prefix}/share/man.

    +

    When in local mode, man pages are not installed.

    +

    Man pages are not installed on Windows systems.

    +

    Cache

    +

    See npm cache. Cache files are stored in ~/.npm on Posix, or +%LocalAppData%/npm-cache on Windows.

    +

    This is controlled by the cache config param.

    +

    Temp Files

    +

    Temporary files are stored by default in the folder specified by the +tmp config, which defaults to the TMPDIR, TMP, or +TEMP environment variables, or /tmp on Unix and c:\windows\temp on Windows.

    +

    Temp files are given a unique folder under this root for each run of the +program, and are deleted upon successful exit.

    +

    More Information

    +

    When installing locally, npm first tries to find an appropriate +prefix folder. This is so that npm install foo@1.2.3 will install +to the sensible root of your package, even if you happen to have cded +into some other folder.

    +

    Starting at the $PWD, npm will walk up the folder tree checking for a +folder that contains either a package.json file, or a node_modules +folder. If such a thing is found, then that is treated as the effective +"current directory" for the purpose of running npm commands. (This +behavior is inspired by and similar to git's .git-folder seeking +logic when running git commands in a working dir.)

    +

    If no package root is found, then the current folder is used.

    +

    When you run npm install foo@1.2.3, then the package is loaded into +the cache, and then unpacked into ./node_modules/foo. Then, any of +foo's dependencies are similarly unpacked into +./node_modules/foo/node_modules/....

    +

    Any bin files are symlinked to ./node_modules/.bin/, so that they may +be found by npm scripts when necessary.

    +

    Global Installation

    +

    If the global config is set to true, then npm will +install packages "globally".

    +

    For global installation, packages are installed roughly the same way, +but using the folders described above.

    +

    Cycles, Conflicts, and Folder Parsimony

    +

    Cycles are handled using the property of node's module system that it +walks up the directories looking for node_modules folders. So, at every +stage, if a package is already installed in an ancestor node_modules +folder, then it is not installed at the current location.

    +

    Consider the case above, where foo -> bar -> baz. Imagine if, in +addition to that, baz depended on bar, so you'd have: +foo -> bar -> baz -> bar -> baz .... However, since the folder +structure is: foo/node_modules/bar/node_modules/baz, there's no need to +put another copy of bar into .../baz/node_modules, since when baz calls +require("bar"), it will get the copy that is installed in +foo/node_modules/bar.

    +

    This shortcut is only used if the exact same +version would be installed in multiple nested node_modules folders. It +is still possible to have a/node_modules/b/node_modules/a if the two +"a" packages are different versions. However, without repeating the +exact same package multiple times, an infinite regress will always be +prevented.

    +

    Another optimization can be made by installing dependencies at the +highest level possible, below the localized "target" folder (hoisting). +Since version 3, npm hoists dependencies by default.

    +

    Example

    +

    Consider this dependency graph:

    +
    foo
    ++-- blerg@1.2.5
    ++-- bar@1.2.3
    +|   +-- blerg@1.x (latest=1.3.7)
    +|   +-- baz@2.x
    +|   |   `-- quux@3.x
    +|   |       `-- bar@1.2.3 (cycle)
    +|   `-- asdf@*
    +`-- baz@1.2.3
    +    `-- quux@3.x
    +        `-- bar
    +
    +

    In this case, we might expect a folder structure like this +(with all dependencies hoisted to the highest level possible):

    +
    foo
    ++-- node_modules
    +    +-- blerg (1.2.5) <---[A]
    +    +-- bar (1.2.3) <---[B]
    +    |   +-- node_modules
    +    |       +-- baz (2.0.2) <---[C]
    +    +-- asdf (2.3.4)
    +    +-- baz (1.2.3) <---[D]
    +    +-- quux (3.2.0) <---[E]
    +
    +

    Since foo depends directly on bar@1.2.3 and baz@1.2.3, those are +installed in foo's node_modules folder.

    +

    Even though the latest copy of blerg is 1.3.7, foo has a specific +dependency on version 1.2.5. So, that gets installed at [A]. Since the +parent installation of blerg satisfies bar's dependency on blerg@1.x, +it does not install another copy under [B].

    +

    Bar [B] also has dependencies on baz and asdf. Because it depends on baz@2.x, it cannot +re-use the baz@1.2.3 installed in the parent node_modules folder [D], +and must install its own copy [C]. In order to minimize duplication, npm hoists +dependencies to the top level by default, so asdf is installed under [A].

    +

    Underneath bar, the baz -> quux -> bar dependency creates a cycle. +However, because bar is already in quux's ancestry [B], it does not +unpack another copy of bar into that folder. Likewise, quux's [E] +folder tree is empty, because its dependency on bar is satisfied +by the parent folder copy installed at [B].

    +

    For a graphical breakdown of what is installed where, use npm ls.

    +

    Publishing

    +

    Upon publishing, npm will look in the node_modules folder. If any of +the items there are not in the bundleDependencies array, then they will +not be included in the package tarball.

    +

    This allows a package maintainer to install all of their dependencies +(and dev dependencies) locally, but only re-publish those items that +cannot be found elsewhere. See package.json for more information.

    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/configuring-npm/npm-json.html b/node_modules/npm/docs/output/configuring-npm/npm-json.html new file mode 100644 index 00000000..b8b847d6 --- /dev/null +++ b/node_modules/npm/docs/output/configuring-npm/npm-json.html @@ -0,0 +1,1121 @@ + + +package.json + + + + + +
    +
    +

    + package.json + @11.0.0 +

    +Specifics of npm's package.json handling +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    This document is all you need to know about what's required in your +package.json file. It must be actual JSON, not just a JavaScript object +literal.

    +

    A lot of the behavior described in this document is affected by the config +settings described in config.

    +

    name

    +

    If you plan to publish your package, the most important things in your +package.json are the name and version fields as they will be required. The +name and version together form an identifier that is assumed to be +completely unique. Changes to the package should come along with changes +to the version. If you don't plan to publish your package, the name and +version fields are optional.

    +

    The name is what your thing is called.

    +

    Some rules:

    +
      +
    • The name must be less than or equal to 214 characters. This includes the +scope for scoped packages.
    • +
    • The names of scoped packages can begin with a dot or an underscore. This +is not permitted without a scope.
    • +
    • New packages must not have uppercase letters in the name.
    • +
    • The name ends up being part of a URL, an argument on the command line, +and a folder name. Therefore, the name can't contain any non-URL-safe +characters.
    • +
    +

    Some tips:

    +
      +
    • Don't use the same name as a core Node module.
    • +
    • Don't put "js" or "node" in the name. It's assumed that it's js, since +you're writing a package.json file, and you can specify the engine using +the "engines" field. (See below.)
    • +
    • The name will probably be passed as an argument to require(), so it +should be something short, but also reasonably descriptive.
    • +
    • You may want to check the npm registry to see if there's something by +that name already, before you get too attached to it. +https://www.npmjs.com/
    • +
    +

    A name can be optionally prefixed by a scope, e.g. @myorg/mypackage. See +scope for more detail.

    +

    version

    +

    If you plan to publish your package, the most important things in your +package.json are the name and version fields as they will be required. The +name and version together form an identifier that is assumed to be +completely unique. Changes to the package should come along with changes +to the version. If you don't plan to publish your package, the name and +version fields are optional.

    +

    Version must be parseable by +node-semver, which is bundled with +npm as a dependency. (npm install semver to use it yourself.)

    +

    description

    +

    Put a description in it. It's a string. This helps people discover your +package, as it's listed in npm search.

    +

    keywords

    +

    Put keywords in it. It's an array of strings. This helps people discover +your package as it's listed in npm search.

    +

    homepage

    +

    The URL to the project homepage.

    +

    Example:

    +
    "homepage": "https://github.com/owner/project#readme"
    +
    +

    bugs

    +

    The URL to your project's issue tracker and / or the email address to which +issues should be reported. These are helpful for people who encounter +issues with your package.

    +

    It should look like this:

    +
    {
    +  "bugs": {
    +    "url": "https://github.com/owner/project/issues",
    +    "email": "project@hostname.com"
    +  }
    +}
    +
    +

    You can specify either one or both values. If you want to provide only a +URL, you can specify the value for "bugs" as a simple string instead of an +object.

    +

    If a URL is provided, it will be used by the npm bugs command.

    +

    license

    +

    You should specify a license for your package so that people know how they +are permitted to use it, and any restrictions you're placing on it.

    +

    If you're using a common license such as BSD-2-Clause or MIT, add a current +SPDX license identifier for the license you're using, like this:

    +
    {
    +  "license" : "BSD-3-Clause"
    +}
    +
    +

    You can check the full list of SPDX license +IDs. Ideally you should pick one that is +OSI approved.

    +

    If your package is licensed under multiple common licenses, use an SPDX +license expression syntax version 2.0 +string, like this:

    +
    {
    +  "license" : "(ISC OR GPL-3.0)"
    +}
    +
    +

    If you are using a license that hasn't been assigned an SPDX identifier, or if +you are using a custom license, use a string value like this one:

    +
    {
    +  "license" : "SEE LICENSE IN <filename>"
    +}
    +
    +

    Then include a file named <filename> at the top level of the package.

    +

    Some old packages used license objects or a "licenses" property containing +an array of license objects:

    +
    // Not valid metadata
    +{
    +  "license" : {
    +    "type" : "ISC",
    +    "url" : "https://opensource.org/licenses/ISC"
    +  }
    +}
    +
    +// Not valid metadata
    +{
    +  "licenses" : [
    +    {
    +      "type": "MIT",
    +      "url": "https://www.opensource.org/licenses/mit-license.php"
    +    },
    +    {
    +      "type": "Apache-2.0",
    +      "url": "https://opensource.org/licenses/apache2.0.php"
    +    }
    +  ]
    +}
    +
    +

    Those styles are now deprecated. Instead, use SPDX expressions, like this:

    +
    {
    +  "license": "ISC"
    +}
    +
    +
    {
    +  "license": "(MIT OR Apache-2.0)"
    +}
    +
    +

    Finally, if you do not wish to grant others the right to use a private or +unpublished package under any terms:

    +
    {
    +  "license": "UNLICENSED"
    +}
    +
    +

    Consider also setting "private": true to prevent accidental publication.

    +

    people fields: author, contributors

    +

    The "author" is one person. "contributors" is an array of people. A +"person" is an object with a "name" field and optionally "url" and "email", +like this:

    +
    {
    +  "name" : "Barney Rubble",
    +  "email" : "b@rubble.com",
    +  "url" : "http://barnyrubble.tumblr.com/"
    +}
    +
    +

    Or you can shorten that all into a single string, and npm will parse it for +you:

    +
    {
    +  "author": "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)"
    +}
    +
    +

    Both email and url are optional either way.

    +

    npm also sets a top-level "maintainers" field with your npm user info.

    +

    funding

    +

    You can specify an object containing a URL that provides up-to-date +information about ways to help fund development of your package, a +string URL, or an array of objects and string URLs:

    +
    {
    +  "funding": {
    +    "type" : "individual",
    +    "url" : "http://example.com/donate"
    +  }
    +}
    +
    +
    {
    +  "funding": {
    +    "type" : "patreon",
    +    "url" : "https://www.patreon.com/my-account"
    +  }
    +}
    +
    +
    {
    +  "funding": "http://example.com/donate"
    +}
    +
    +
    {
    +  "funding": [
    +    {
    +      "type" : "individual",
    +      "url" : "http://example.com/donate"
    +    },
    +    "http://example.com/donateAlso",
    +    {
    +      "type" : "patreon",
    +      "url" : "https://www.patreon.com/my-account"
    +    }
    +  ]
    +}
    +
    +

    Users can use the npm fund subcommand to list the funding URLs of all +dependencies of their project, direct and indirect. A shortcut to visit +each funding URL is also available when providing the project name such as: +npm fund <projectname> (when there are multiple URLs, the first one will +be visited)

    +

    files

    +

    The optional files field is an array of file patterns that describes the +entries to be included when your package is installed as a dependency. File +patterns follow a similar syntax to .gitignore, but reversed: including a +file, directory, or glob pattern (*, **/*, and such) will make it so +that file is included in the tarball when it's packed. Omitting the field +will make it default to ["*"], which means it will include all files.

    +

    Some special files and directories are also included or excluded regardless +of whether they exist in the files array (see below).

    +

    You can also provide a .npmignore file in the root of your package or in +subdirectories, which will keep files from being included. At the root of +your package it will not override the "files" field, but in subdirectories +it will. The .npmignore file works just like a .gitignore. If there is +a .gitignore file, and .npmignore is missing, .gitignore's contents +will be used instead.

    +

    Certain files are always included, regardless of settings:

    +
      +
    • package.json
    • +
    • README
    • +
    • LICENSE / LICENCE
    • +
    • The file in the "main" field
    • +
    • The file(s) in the "bin" field
    • +
    +

    README & LICENSE can have any case and extension.

    +

    Some files are always ignored by default:

    +
      +
    • *.orig
    • +
    • .*.swp
    • +
    • .DS_Store
    • +
    • ._*
    • +
    • .git
    • +
    • .hg
    • +
    • .lock-wscript
    • +
    • .npmrc
    • +
    • .svn
    • +
    • .wafpickle-N
    • +
    • CVS
    • +
    • config.gypi
    • +
    • node_modules
    • +
    • npm-debug.log
    • +
    • package-lock.json (use +npm-shrinkwrap.json +if you wish it to be published)
    • +
    • pnpm-lock.yaml
    • +
    • yarn.lock
    • +
    • bun.lockb
    • +
    +

    Most of these ignored files can be included specifically if included in +the files globs. Exceptions to this are:

    +
      +
    • .git
    • +
    • .npmrc
    • +
    • node_modules
    • +
    • package-lock.json
    • +
    • pnpm-lock.yaml
    • +
    • yarn.lock
    • +
    • bun.lockb
    • +
    +

    These can not be included.

    +

    exports

    +

    The "exports" provides a modern alternative to "main" allowing multiple entry points to be defined, conditional entry resolution support between environments, and preventing any other entry points besides those defined in "exports". This encapsulation allows module authors to clearly define the public interface for their package. For more details see the node.js documentation on package entry points

    +

    main

    +

    The main field is a module ID that is the primary entry point to your +program. That is, if your package is named foo, and a user installs it, +and then does require("foo"), then your main module's exports object will +be returned.

    +

    This should be a module relative to the root of your package folder.

    +

    For most modules, it makes the most sense to have a main script and often +not much else.

    +

    If main is not set, it defaults to index.js in the package's root folder.

    +

    browser

    +

    If your module is meant to be used client-side the browser field should be +used instead of the main field. This is helpful to hint users that it might +rely on primitives that aren't available in Node.js modules. (e.g. +window)

    +

    bin

    +

    A lot of packages have one or more executable files that they'd like to +install into the PATH. npm makes this pretty easy (in fact, it uses this +feature to install the "npm" executable.)

    +

    To use this, supply a bin field in your package.json which is a map of +command name to local file name. When this package is installed globally, +that file will be either linked inside the global bins directory or +a cmd (Windows Command File) will be created which executes the specified +file in the bin field, so it is available to run by name or name.cmd (on +Windows PowerShell). When this package is installed as a dependency in another +package, the file will be linked where it will be available to that package +either directly by npm exec or by name in other scripts when invoking them +via npm run-script.

    +

    For example, myapp could have this:

    +
    {
    +  "bin": {
    +    "myapp": "bin/cli.js"
    +  }
    +}
    +
    +

    So, when you install myapp, in case of unix-like OS it'll create a symlink +from the cli.js script to /usr/local/bin/myapp and in case of windows it +will create a cmd file usually at C:\Users\{Username}\AppData\Roaming\npm\myapp.cmd +which runs the cli.js script.

    +

    If you have a single executable, and its name should be the name of the +package, then you can just supply it as a string. For example:

    +
    {
    +  "name": "my-program",
    +  "version": "1.2.5",
    +  "bin": "path/to/program"
    +}
    +
    +

    would be the same as this:

    +
    {
    +  "name": "my-program",
    +  "version": "1.2.5",
    +  "bin": {
    +    "my-program": "path/to/program"
    +  }
    +}
    +
    +

    Please make sure that your file(s) referenced in bin starts with +#!/usr/bin/env node, otherwise the scripts are started without the node +executable!

    +

    Note that you can also set the executable files using directories.bin.

    +

    See folders for more info on +executables.

    +

    man

    +

    Specify either a single file or an array of filenames to put in place for +the man program to find.

    +

    If only a single file is provided, then it's installed such that it is the +result from man <pkgname>, regardless of its actual filename. For +example:

    +
    {
    +  "name": "foo",
    +  "version": "1.2.3",
    +  "description": "A packaged foo fooer for fooing foos",
    +  "main": "foo.js",
    +  "man": "./man/doc.1"
    +}
    +
    +

    would link the ./man/doc.1 file in such that it is the target for man foo

    +

    If the filename doesn't start with the package name, then it's prefixed. +So, this:

    +
    {
    +  "name": "foo",
    +  "version": "1.2.3",
    +  "description": "A packaged foo fooer for fooing foos",
    +  "main": "foo.js",
    +  "man": [
    +    "./man/foo.1",
    +    "./man/bar.1"
    +  ]
    +}
    +
    +

    will create files to do man foo and man foo-bar.

    +

    Man files must end with a number, and optionally a .gz suffix if they are +compressed. The number dictates which man section the file is installed +into.

    +
    {
    +  "name": "foo",
    +  "version": "1.2.3",
    +  "description": "A packaged foo fooer for fooing foos",
    +  "main": "foo.js",
    +  "man": [
    +    "./man/foo.1",
    +    "./man/foo.2"
    +  ]
    +}
    +
    +

    will create entries for man foo and man 2 foo

    +

    directories

    +

    The CommonJS Packages spec +details a few ways that you can indicate the structure of your package +using a directories object. If you look at npm's +package.json, you'll see that it +has directories for doc, lib, and man.

    +

    In the future, this information may be used in other creative ways.

    +

    directories.bin

    +

    If you specify a bin directory in directories.bin, all the files in +that folder will be added.

    +

    Because of the way the bin directive works, specifying both a bin path +and setting directories.bin is an error. If you want to specify +individual files, use bin, and for all the files in an existing bin +directory, use directories.bin.

    +

    directories.man

    +

    A folder that is full of man pages. Sugar to generate a "man" array by +walking the folder.

    +

    repository

    +

    Specify the place where your code lives. This is helpful for people who +want to contribute. If the git repo is on GitHub, then the npm repo +command will be able to find you.

    +

    Do it like this:

    +
    {
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/cli.git"
    +  }
    +}
    +
    +

    The URL should be a publicly available (perhaps read-only) URL that can be +handed directly to a VCS program without any modification. It should not +be a URL to an html project page that you put in your browser. It's for +computers.

    +

    For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the +same shortcut syntax you use for npm install:

    +
    {
    +  "repository": "npm/npm",
    +
    +  "repository": "github:user/repo",
    +
    +  "repository": "gist:11081aaa281",
    +
    +  "repository": "bitbucket:user/repo",
    +
    +  "repository": "gitlab:user/repo"
    +}
    +
    +

    If the package.json for your package is not in the root directory (for +example if it is part of a monorepo), you can specify the directory in +which it lives:

    +
    {
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/cli.git",
    +    "directory": "workspaces/libnpmpublish"
    +  }
    +}
    +
    +

    scripts

    +

    The "scripts" property is a dictionary containing script commands that are +run at various times in the lifecycle of your package. The key is the +lifecycle event, and the value is the command to run at that point.

    +

    See scripts to find out more about writing package +scripts.

    +

    config

    +

    A "config" object can be used to set configuration parameters used in +package scripts that persist across upgrades. For instance, if a package +had the following:

    +
    {
    +  "name": "foo",
    +  "config": {
    +    "port": "8080"
    +  }
    +}
    +
    +

    It could also have a "start" command that referenced the +npm_package_config_port environment variable.

    +

    dependencies

    +

    Dependencies are specified in a simple object that maps a package name to a +version range. The version range is a string which has one or more +space-separated descriptors. Dependencies can also be identified with a +tarball or git URL.

    +

    Please do not put test harnesses or transpilers or other "development" +time tools in your dependencies object. See devDependencies, below.

    +

    See semver for more details about specifying version ranges.

    +
      +
    • version Must match version exactly
    • +
    • >version Must be greater than version
    • +
    • >=version etc
    • +
    • <version
    • +
    • <=version
    • +
    • ~version "Approximately equivalent to version" See +semver
    • +
    • ^version "Compatible with version" See semver
    • +
    • 1.2.x 1.2.0, 1.2.1, etc., but not 1.3.0
    • +
    • http://... See 'URLs as Dependencies' below
    • +
    • * Matches any version
    • +
    • "" (just an empty string) Same as *
    • +
    • version1 - version2 Same as >=version1 <=version2.
    • +
    • range1 || range2 Passes if either range1 or range2 are satisfied.
    • +
    • git... See 'Git URLs as Dependencies' below
    • +
    • user/repo See 'GitHub URLs' below
    • +
    • tag A specific version tagged and published as tag See npm dist-tag
    • +
    • path/path/path See Local Paths below
    • +
    • npm:@scope/pkg@version Custom alias for a pacakge See package-spec
    • +
    +

    For example, these are all valid:

    +
    {
    +  "dependencies": {
    +    "foo": "1.0.0 - 2.9999.9999",
    +    "bar": ">=1.0.2 <2.1.2",
    +    "baz": ">1.0.2 <=2.3.4",
    +    "boo": "2.0.1",
    +    "qux": "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0",
    +    "asd": "http://asdf.com/asdf.tar.gz",
    +    "til": "~1.2",
    +    "elf": "~1.2.3",
    +    "two": "2.x",
    +    "thr": "3.3.x",
    +    "lat": "latest",
    +    "dyl": "file:../dyl",
    +    "kpg": "npm:pkg@1.0.0"
    +  }
    +}
    +
    +

    URLs as Dependencies

    +

    You may specify a tarball URL in place of a version range.

    +

    This tarball will be downloaded and installed locally to your package at +install time.

    +

    Git URLs as Dependencies

    +

    Git URLs are of the form:

    +
    <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]
    +
    +

    <protocol> is one of git, git+ssh, git+http, git+https, or +git+file.

    +

    If #<commit-ish> is provided, it will be used to clone exactly that +commit. If the commit-ish has the format #semver:<semver>, <semver> can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for +a registry dependency. If neither #<commit-ish> or #semver:<semver> is +specified, then the default branch is used.

    +

    Examples:

    +
    git+ssh://git@github.com:npm/cli.git#v1.0.27
    +git+ssh://git@github.com:npm/cli#semver:^5.0
    +git+https://isaacs@github.com/npm/cli.git
    +git://github.com/npm/cli.git#v1.0.27
    +
    +

    When installing from a git repository, the presence of certain fields in the +package.json will cause npm to believe it needs to perform a build. To do so +your repository will be cloned into a temporary directory, all of its deps +installed, relevant scripts run, and the resulting directory packed and +installed.

    +

    This flow will occur if your git dependency uses workspaces, or if any of the +following scripts are present:

    +
      +
    • build
    • +
    • prepare
    • +
    • prepack
    • +
    • preinstall
    • +
    • install
    • +
    • postinstall
    • +
    +

    If your git repository includes pre-built artifacts, you will likely want to +make sure that none of the above scripts are defined, or your dependency +will be rebuilt for every installation.

    +

    GitHub URLs

    +

    As of version 1.1.65, you can refer to GitHub URLs as just "foo": +"user/foo-project". Just as with git URLs, a commit-ish suffix can be +included. For example:

    +
    {
    +  "name": "foo",
    +  "version": "0.0.0",
    +  "dependencies": {
    +    "express": "expressjs/express",
    +    "mocha": "mochajs/mocha#4727d357ea",
    +    "module": "user/repo#feature\/branch"
    +  }
    +}
    +
    +

    Local Paths

    +

    As of version 2.0.0 you can provide a path to a local directory that +contains a package. Local paths can be saved using npm install -S or npm install --save, using any of these forms:

    +
    ../foo/bar
    +~/foo/bar
    +./foo/bar
    +/foo/bar
    +
    +

    in which case they will be normalized to a relative path and added to your +package.json. For example:

    +
    {
    +  "name": "baz",
    +  "dependencies": {
    +    "bar": "file:../foo/bar"
    +  }
    +}
    +
    +

    This feature is helpful for local offline development and creating tests +that require npm installing where you don't want to hit an external server, +but should not be used when publishing your package to the public registry.

    +

    note: Packages linked by local path will not have their own +dependencies installed when npm install is ran in this case. You must +run npm install from inside the local path itself.

    +

    devDependencies

    +

    If someone is planning on downloading and using your module in their +program, then they probably don't want or need to download and build the +external test or documentation framework that you use.

    +

    In this case, it's best to map these additional items in a +devDependencies object.

    +

    These things will be installed when doing npm link or npm install from +the root of a package, and can be managed like any other npm configuration +param. See config for more on the topic.

    +

    For build steps that are not platform-specific, such as compiling +CoffeeScript or other languages to JavaScript, use the prepare script to +do this, and make the required package a devDependency.

    +

    For example:

    +
    {
    +  "name": "ethopia-waza",
    +  "description": "a delightfully fruity coffee varietal",
    +  "version": "1.2.3",
    +  "devDependencies": {
    +    "coffee-script": "~1.6.3"
    +  },
    +  "scripts": {
    +    "prepare": "coffee -o lib/ -c src/waza.coffee"
    +  },
    +  "main": "lib/waza.js"
    +}
    +
    +

    The prepare script will be run before publishing, so that users can +consume the functionality without requiring them to compile it themselves. +In dev mode (ie, locally running npm install), it'll run this script as +well, so that you can test it easily.

    +

    peerDependencies

    +

    In some cases, you want to express the compatibility of your package with a +host tool or library, while not necessarily doing a require of this host. +This is usually referred to as a plugin. Notably, your module may be +exposing a specific interface, expected and specified by the host +documentation.

    +

    For example:

    +
    {
    +  "name": "tea-latte",
    +  "version": "1.3.5",
    +  "peerDependencies": {
    +    "tea": "2.x"
    +  }
    +}
    +
    +

    This ensures your package tea-latte can be installed along with the +second major version of the host package tea only. npm install tea-latte could possibly yield the following dependency graph:

    +
    ├── tea-latte@1.3.5
    +└── tea@2.2.0
    +
    +

    In npm versions 3 through 6, peerDependencies were not automatically +installed, and would raise a warning if an invalid version of the peer +dependency was found in the tree. As of npm v7, peerDependencies are +installed by default.

    +

    Trying to install another plugin with a conflicting requirement may cause +an error if the tree cannot be resolved correctly. For this reason, make +sure your plugin requirement is as broad as possible, and not to lock it +down to specific patch versions.

    +

    Assuming the host complies with semver, only changes +in the host package's major version will break your plugin. Thus, if you've +worked with every 1.x version of the host package, use "^1.0" or "1.x" +to express this. If you depend on features introduced in 1.5.2, use +"^1.5.2".

    +

    peerDependenciesMeta

    +

    The peerDependenciesMeta field serves to provide npm more information on how +your peer dependencies are to be used. Specifically, it allows peer +dependencies to be marked as optional. Npm will not automatically install +optional peer dependencies. This allows you to +integrate and interact with a variety of host packages without requiring +all of them to be installed.

    +

    For example:

    +
    {
    +  "name": "tea-latte",
    +  "version": "1.3.5",
    +  "peerDependencies": {
    +    "tea": "2.x",
    +    "soy-milk": "1.2"
    +  },
    +  "peerDependenciesMeta": {
    +    "soy-milk": {
    +      "optional": true
    +    }
    +  }
    +}
    +
    +

    bundleDependencies

    +

    This defines an array of package names that will be bundled when publishing +the package.

    +

    In cases where you need to preserve npm packages locally or have them +available through a single file download, you can bundle the packages in a +tarball file by specifying the package names in the bundleDependencies +array and executing npm pack.

    +

    For example:

    +

    If we define a package.json like this:

    +
    {
    +  "name": "awesome-web-framework",
    +  "version": "1.0.0",
    +  "bundleDependencies": [
    +    "renderized",
    +    "super-streams"
    +  ]
    +}
    +
    +

    we can obtain awesome-web-framework-1.0.0.tgz file by running npm pack. +This file contains the dependencies renderized and super-streams which +can be installed in a new project by executing npm install awesome-web-framework-1.0.0.tgz. Note that the package names do not +include any versions, as that information is specified in dependencies.

    +

    If this is spelled "bundledDependencies", then that is also honored.

    +

    Alternatively, "bundleDependencies" can be defined as a boolean value. A +value of true will bundle all dependencies, a value of false will bundle +none.

    +

    optionalDependencies

    +

    If a dependency can be used, but you would like npm to proceed if it cannot +be found or fails to install, then you may put it in the +optionalDependencies object. This is a map of package name to version or +URL, just like the dependencies object. The difference is that build +failures do not cause installation to fail. Running npm install --omit=optional will prevent these dependencies from being installed.

    +

    It is still your program's responsibility to handle the lack of the +dependency. For example, something like this:

    +
    try {
    +  var foo = require('foo')
    +  var fooVersion = require('foo/package.json').version
    +} catch (er) {
    +  foo = null
    +}
    +if ( notGoodFooVersion(fooVersion) ) {
    +  foo = null
    +}
    +
    +// .. then later in your program ..
    +
    +if (foo) {
    +  foo.doFooThings()
    +}
    +
    +

    Entries in optionalDependencies will override entries of the same name in +dependencies, so it's usually best to only put in one place.

    +

    overrides

    +

    If you need to make specific changes to dependencies of your dependencies, for +example replacing the version of a dependency with a known security issue, +replacing an existing dependency with a fork, or making sure that the same +version of a package is used everywhere, then you may add an override.

    +

    Overrides provide a way to replace a package in your dependency tree with +another version, or another package entirely. These changes can be scoped as +specific or as vague as desired.

    +

    Overrides are only considered in the root package.json file for a project. +Overrides in installed dependencies (including +workspaces) are not considered in dependency tree +resolution. Published packages may dictate their resolutions by pinning +dependencies or using an +npm-shrinkwrap.json file.

    +

    To make sure the package foo is always installed as version 1.0.0 no matter +what version your dependencies rely on:

    +
    {
    +  "overrides": {
    +    "foo": "1.0.0"
    +  }
    +}
    +
    +

    The above is a short hand notation, the full object form can be used to allow +overriding a package itself as well as a child of the package. This will cause +foo to always be 1.0.0 while also making bar at any depth beyond foo +also 1.0.0:

    +
    {
    +  "overrides": {
    +    "foo": {
    +      ".": "1.0.0",
    +      "bar": "1.0.0"
    +    }
    +  }
    +}
    +
    +

    To only override foo to be 1.0.0 when it's a child (or grandchild, or great +grandchild, etc) of the package bar:

    +
    {
    +  "overrides": {
    +    "bar": {
    +      "foo": "1.0.0"
    +    }
    +  }
    +}
    +
    +

    Keys can be nested to any arbitrary length. To override foo only when it's a +child of bar and only when bar is a child of baz:

    +
    {
    +  "overrides": {
    +    "baz": {
    +      "bar": {
    +        "foo": "1.0.0"
    +      }
    +    }
    +  }
    +}
    +
    +

    The key of an override can also include a version, or range of versions. +To override foo to 1.0.0, but only when it's a child of bar@2.0.0:

    +
    {
    +  "overrides": {
    +    "bar@2.0.0": {
    +      "foo": "1.0.0"
    +    }
    +  }
    +}
    +
    +

    You may not set an override for a package that you directly depend on unless +both the dependency and the override itself share the exact same spec. To make +this limitation easier to deal with, overrides may also be defined as a +reference to a spec for a direct dependency by prefixing the name of the +package you wish the version to match with a $.

    +
    {
    +  "dependencies": {
    +    "foo": "^1.0.0"
    +  },
    +  "overrides": {
    +    // BAD, will throw an EOVERRIDE error
    +    // "foo": "^2.0.0"
    +    // GOOD, specs match so override is allowed
    +    // "foo": "^1.0.0"
    +    // BEST, the override is defined as a reference to the dependency
    +    "foo": "$foo",
    +    // the referenced package does not need to match the overridden one
    +    "bar": "$foo"
    +  }
    +}
    +
    +

    engines

    +

    You can specify the version of node that your stuff works on:

    +
    {
    +  "engines": {
    +    "node": ">=0.10.3 <15"
    +  }
    +}
    +
    +

    And, like with dependencies, if you don't specify the version (or if you +specify "*" as the version), then any version of node will do.

    +

    You can also use the "engines" field to specify which versions of npm are +capable of properly installing your program. For example:

    +
    {
    +  "engines": {
    +    "npm": "~1.0.20"
    +  }
    +}
    +
    +

    Unless the user has set the +engine-strict config flag, this field is +advisory only and will only produce warnings when your package is installed as a +dependency.

    +

    os

    +

    You can specify which operating systems your +module will run on:

    +
    {
    +  "os": [
    +    "darwin",
    +    "linux"
    +  ]
    +}
    +
    +

    You can also block instead of allowing operating systems, just prepend the +blocked os with a '!':

    +
    {
    +  "os": [
    +    "!win32"
    +  ]
    +}
    +
    +

    The host operating system is determined by process.platform

    +

    It is allowed to both block and allow an item, although there isn't any +good reason to do this.

    +

    cpu

    +

    If your code only runs on certain cpu architectures, +you can specify which ones.

    +
    {
    +  "cpu": [
    +    "x64",
    +    "ia32"
    +  ]
    +}
    +
    +

    Like the os option, you can also block architectures:

    +
    {
    +  "cpu": [
    +    "!arm",
    +    "!mips"
    +  ]
    +}
    +
    +

    The host architecture is determined by process.arch

    +

    libc

    +

    If your code only runs or builds in certain versions of libc, you can +specify which ones. This field only applies if os is linux.

    +
    {
    +  "os": "linux",
    +  "libc": "glibc"
    +}
    +
    +

    devEngines

    +

    The devEngines field aids engineers working on a codebase to all be using the same tooling.

    +

    You can specify a devEngines property in your package.json which will run before install, ci, and run commands.

    +
    +

    Note: engines and devEngines differ in object shape. They also function very differently. engines is designed to alert the user when a dependency uses a differening npm or node version that the project it's being used in, whereas devEngines is used to alert people interacting with the source code of a project.

    +
    +

    The supported keys under the devEngines property are cpu, os, libc, runtime, and packageManager. Each property can be an object or an array of objects. Objects must contain name, and optionally can specify version, and onFail. onFail can be warn, error, or ignore, and if left undefined is of the same value as error. npm will assume that you're running with node. +Here's an example of a project that will fail if the environment is not node and npm. If you set runtime.name or packageManager.name to any other string, it will fail within the npm CLI.

    +
    {
    +  "devEngines": {
    +    "runtime": {
    +      "name": "node",
    +      "onFail": "error"
    +    },
    +    "packageManager": {
    +      "name": "npm",
    +      "onFail": "error"
    +    }
    +  }
    +}
    +
    +

    private

    +

    If you set "private": true in your package.json, then npm will refuse to +publish it.

    +

    This is a way to prevent accidental publication of private repositories. +If you would like to ensure that a given package is only ever published to +a specific registry (for example, an internal registry), then use the +publishConfig dictionary described below to override the registry +config param at publish-time.

    +

    publishConfig

    +

    This is a set of config values that will be used at publish-time. It's +especially handy if you want to set the tag, registry or access, so that +you can ensure that a given package is not tagged with "latest", published +to the global public registry or that a scoped module is private by +default.

    +

    See config to see the list of config options that +can be overridden.

    +

    workspaces

    +

    The optional workspaces field is an array of file patterns that describes +locations within the local file system that the install client should look +up to find each workspace that needs to be +symlinked to the top level node_modules folder.

    +

    It can describe either the direct paths of the folders to be used as +workspaces or it can define globs that will resolve to these same folders.

    +

    In the following example, all folders located inside the folder +./packages will be treated as workspaces as long as they have valid +package.json files inside them:

    +
    {
    +  "name": "workspace-example",
    +  "workspaces": [
    +    "./packages/*"
    +  ]
    +}
    +
    +

    See workspaces for more examples.

    +

    DEFAULT VALUES

    +

    npm will default some values based on package contents.

    +
      +
    • +

      "scripts": {"start": "node server.js"}

      +

      If there is a server.js file in the root of your package, then npm will +default the start command to node server.js.

      +
    • +
    • +

      "scripts":{"install": "node-gyp rebuild"}

      +

      If there is a binding.gyp file in the root of your package and you have +not defined an install or preinstall script, npm will default the +install command to compile using node-gyp.

      +
    • +
    • +

      "contributors": [...]

      +

      If there is an AUTHORS file in the root of your package, npm will treat +each line as a Name <email> (url) format, where email and url are +optional. Lines which start with a # or are blank, will be ignored.

      +
    • +
    +

    SEE ALSO

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html b/node_modules/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html new file mode 100644 index 00000000..25af90bd --- /dev/null +++ b/node_modules/npm/docs/output/configuring-npm/npm-shrinkwrap-json.html @@ -0,0 +1,192 @@ + + +npm-shrinkwrap.json + + + + + +
    +
    +

    + npm-shrinkwrap.json + @11.0.0 +

    +A publishable lockfile +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    npm-shrinkwrap.json is a file created by npm shrinkwrap. It is identical to +package-lock.json, with one major caveat: Unlike package-lock.json, +npm-shrinkwrap.json may be included when publishing a package.

    +

    The recommended use-case for npm-shrinkwrap.json is applications deployed +through the publishing process on the registry: for example, daemons and +command-line tools intended as global installs or devDependencies. It's +strongly discouraged for library authors to publish this file, since that +would prevent end users from having control over transitive dependency +updates.

    +

    If both package-lock.json and npm-shrinkwrap.json are present in a +package root, npm-shrinkwrap.json will be preferred over the +package-lock.json file.

    +

    For full details and description of the npm-shrinkwrap.json file format, +refer to the manual page for +package-lock.json.

    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/configuring-npm/npmrc.html b/node_modules/npm/docs/output/configuring-npm/npmrc.html new file mode 100644 index 00000000..04cea4c5 --- /dev/null +++ b/node_modules/npm/docs/output/configuring-npm/npmrc.html @@ -0,0 +1,272 @@ + + +npmrc + + + + + +
    +
    +

    + npmrc + @11.0.0 +

    +The npm config files +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    npm gets its config settings from the command line, environment variables, +and npmrc files.

    +

    The npm config command can be used to update and edit the contents of the +user and global npmrc files.

    +

    For a list of available configuration options, see +config.

    +

    Files

    +

    The four relevant files are:

    +
      +
    • per-project config file (/path/to/my/project/.npmrc)
    • +
    • per-user config file (~/.npmrc)
    • +
    • global config file ($PREFIX/etc/npmrc)
    • +
    • npm builtin config file (/path/to/npm/npmrc)
    • +
    +

    All npm config files are an ini-formatted list of key = value parameters. +Environment variables can be replaced using ${VARIABLE_NAME}. For +example:

    +
    cache = ${HOME}/.npm-packages
    +
    +

    Each of these files is loaded, and config options are resolved in priority +order. For example, a setting in the userconfig file would override the +setting in the globalconfig file.

    +

    Array values are specified by adding "[]" after the key name. For example:

    +
    key[] = "first value"
    +key[] = "second value"
    +
    +

    Comments

    +

    Lines in .npmrc files are interpreted as comments when they begin with a +; or # character. .npmrc files are parsed by +npm/ini, which specifies this comment syntax.

    +

    For example:

    +
    # last modified: 01 Jan 2016
    +; Set a new registry for a scoped package
    +@myscope:registry=https://mycustomregistry.example.org
    +
    +

    Per-project config file

    +

    When working locally in a project, a .npmrc file in the root of the +project (ie, a sibling of node_modules and package.json) will set +config values specific to this project.

    +

    Note that this only applies to the root of the project that you're running +npm in. It has no effect when your module is published. For example, you +can't publish a module that forces itself to install globally, or in a +different location.

    +

    Additionally, this file is not read in global mode, such as when running +npm install -g.

    +

    Per-user config file

    +

    $HOME/.npmrc (or the userconfig param, if set in the environment or on +the command line)

    +

    Global config file

    +

    $PREFIX/etc/npmrc (or the globalconfig param, if set above): This file +is an ini-file formatted list of key = value parameters. Environment +variables can be replaced as above.

    +

    Built-in config file

    +

    path/to/npm/itself/npmrc

    +

    This is an unchangeable "builtin" configuration file that npm keeps +consistent across updates. Set fields in here using the ./configure +script that comes with npm. This is primarily for distribution maintainers +to override default configs in a standard and consistent manner.

    + +

    The settings _auth, _authToken, username and _password must all be +scoped to a specific registry. This ensures that npm will never send +credentials to the wrong host.

    +

    The full list is:

    +
      +
    • _auth (base64 authentication string)
    • +
    • _authToken (authentication token)
    • +
    • username
    • +
    • _password
    • +
    • email
    • +
    • cafile (path to certificate authority file)
    • +
    • keyfile (path to key file)
    • +
    +

    In order to scope these values, they must be prefixed by a URI fragment. +If the credential is meant for any request to a registry on a single host, +the scope may look like //registry.npmjs.org/:. If it must be scoped to a +specific path on the host that path may also be provided, such as +//my-custom-registry.org/unique/path:.

    +
    ; bad config
    +_authToken=MYTOKEN
    +
    +; good config
    +@myorg:registry=https://somewhere-else.com/myorg
    +@another:registry=https://somewhere-else.com/another
    +//registry.npmjs.org/:_authToken=MYTOKEN
    +
    +; would apply to both @myorg and @another
    +//somewhere-else.com/:_authToken=MYTOKEN
    +
    +; would apply only to @myorg
    +//somewhere-else.com/myorg/:_authToken=MYTOKEN1
    +
    +; would apply only to @another
    +//somewhere-else.com/another/:_authToken=MYTOKEN2
    +
    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/configuring-npm/package-json.html b/node_modules/npm/docs/output/configuring-npm/package-json.html new file mode 100644 index 00000000..b8b847d6 --- /dev/null +++ b/node_modules/npm/docs/output/configuring-npm/package-json.html @@ -0,0 +1,1121 @@ + + +package.json + + + + + +
    +
    +

    + package.json + @11.0.0 +

    +Specifics of npm's package.json handling +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    This document is all you need to know about what's required in your +package.json file. It must be actual JSON, not just a JavaScript object +literal.

    +

    A lot of the behavior described in this document is affected by the config +settings described in config.

    +

    name

    +

    If you plan to publish your package, the most important things in your +package.json are the name and version fields as they will be required. The +name and version together form an identifier that is assumed to be +completely unique. Changes to the package should come along with changes +to the version. If you don't plan to publish your package, the name and +version fields are optional.

    +

    The name is what your thing is called.

    +

    Some rules:

    +
      +
    • The name must be less than or equal to 214 characters. This includes the +scope for scoped packages.
    • +
    • The names of scoped packages can begin with a dot or an underscore. This +is not permitted without a scope.
    • +
    • New packages must not have uppercase letters in the name.
    • +
    • The name ends up being part of a URL, an argument on the command line, +and a folder name. Therefore, the name can't contain any non-URL-safe +characters.
    • +
    +

    Some tips:

    +
      +
    • Don't use the same name as a core Node module.
    • +
    • Don't put "js" or "node" in the name. It's assumed that it's js, since +you're writing a package.json file, and you can specify the engine using +the "engines" field. (See below.)
    • +
    • The name will probably be passed as an argument to require(), so it +should be something short, but also reasonably descriptive.
    • +
    • You may want to check the npm registry to see if there's something by +that name already, before you get too attached to it. +https://www.npmjs.com/
    • +
    +

    A name can be optionally prefixed by a scope, e.g. @myorg/mypackage. See +scope for more detail.

    +

    version

    +

    If you plan to publish your package, the most important things in your +package.json are the name and version fields as they will be required. The +name and version together form an identifier that is assumed to be +completely unique. Changes to the package should come along with changes +to the version. If you don't plan to publish your package, the name and +version fields are optional.

    +

    Version must be parseable by +node-semver, which is bundled with +npm as a dependency. (npm install semver to use it yourself.)

    +

    description

    +

    Put a description in it. It's a string. This helps people discover your +package, as it's listed in npm search.

    +

    keywords

    +

    Put keywords in it. It's an array of strings. This helps people discover +your package as it's listed in npm search.

    +

    homepage

    +

    The URL to the project homepage.

    +

    Example:

    +
    "homepage": "https://github.com/owner/project#readme"
    +
    +

    bugs

    +

    The URL to your project's issue tracker and / or the email address to which +issues should be reported. These are helpful for people who encounter +issues with your package.

    +

    It should look like this:

    +
    {
    +  "bugs": {
    +    "url": "https://github.com/owner/project/issues",
    +    "email": "project@hostname.com"
    +  }
    +}
    +
    +

    You can specify either one or both values. If you want to provide only a +URL, you can specify the value for "bugs" as a simple string instead of an +object.

    +

    If a URL is provided, it will be used by the npm bugs command.

    +

    license

    +

    You should specify a license for your package so that people know how they +are permitted to use it, and any restrictions you're placing on it.

    +

    If you're using a common license such as BSD-2-Clause or MIT, add a current +SPDX license identifier for the license you're using, like this:

    +
    {
    +  "license" : "BSD-3-Clause"
    +}
    +
    +

    You can check the full list of SPDX license +IDs. Ideally you should pick one that is +OSI approved.

    +

    If your package is licensed under multiple common licenses, use an SPDX +license expression syntax version 2.0 +string, like this:

    +
    {
    +  "license" : "(ISC OR GPL-3.0)"
    +}
    +
    +

    If you are using a license that hasn't been assigned an SPDX identifier, or if +you are using a custom license, use a string value like this one:

    +
    {
    +  "license" : "SEE LICENSE IN <filename>"
    +}
    +
    +

    Then include a file named <filename> at the top level of the package.

    +

    Some old packages used license objects or a "licenses" property containing +an array of license objects:

    +
    // Not valid metadata
    +{
    +  "license" : {
    +    "type" : "ISC",
    +    "url" : "https://opensource.org/licenses/ISC"
    +  }
    +}
    +
    +// Not valid metadata
    +{
    +  "licenses" : [
    +    {
    +      "type": "MIT",
    +      "url": "https://www.opensource.org/licenses/mit-license.php"
    +    },
    +    {
    +      "type": "Apache-2.0",
    +      "url": "https://opensource.org/licenses/apache2.0.php"
    +    }
    +  ]
    +}
    +
    +

    Those styles are now deprecated. Instead, use SPDX expressions, like this:

    +
    {
    +  "license": "ISC"
    +}
    +
    +
    {
    +  "license": "(MIT OR Apache-2.0)"
    +}
    +
    +

    Finally, if you do not wish to grant others the right to use a private or +unpublished package under any terms:

    +
    {
    +  "license": "UNLICENSED"
    +}
    +
    +

    Consider also setting "private": true to prevent accidental publication.

    +

    people fields: author, contributors

    +

    The "author" is one person. "contributors" is an array of people. A +"person" is an object with a "name" field and optionally "url" and "email", +like this:

    +
    {
    +  "name" : "Barney Rubble",
    +  "email" : "b@rubble.com",
    +  "url" : "http://barnyrubble.tumblr.com/"
    +}
    +
    +

    Or you can shorten that all into a single string, and npm will parse it for +you:

    +
    {
    +  "author": "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)"
    +}
    +
    +

    Both email and url are optional either way.

    +

    npm also sets a top-level "maintainers" field with your npm user info.

    +

    funding

    +

    You can specify an object containing a URL that provides up-to-date +information about ways to help fund development of your package, a +string URL, or an array of objects and string URLs:

    +
    {
    +  "funding": {
    +    "type" : "individual",
    +    "url" : "http://example.com/donate"
    +  }
    +}
    +
    +
    {
    +  "funding": {
    +    "type" : "patreon",
    +    "url" : "https://www.patreon.com/my-account"
    +  }
    +}
    +
    +
    {
    +  "funding": "http://example.com/donate"
    +}
    +
    +
    {
    +  "funding": [
    +    {
    +      "type" : "individual",
    +      "url" : "http://example.com/donate"
    +    },
    +    "http://example.com/donateAlso",
    +    {
    +      "type" : "patreon",
    +      "url" : "https://www.patreon.com/my-account"
    +    }
    +  ]
    +}
    +
    +

    Users can use the npm fund subcommand to list the funding URLs of all +dependencies of their project, direct and indirect. A shortcut to visit +each funding URL is also available when providing the project name such as: +npm fund <projectname> (when there are multiple URLs, the first one will +be visited)

    +

    files

    +

    The optional files field is an array of file patterns that describes the +entries to be included when your package is installed as a dependency. File +patterns follow a similar syntax to .gitignore, but reversed: including a +file, directory, or glob pattern (*, **/*, and such) will make it so +that file is included in the tarball when it's packed. Omitting the field +will make it default to ["*"], which means it will include all files.

    +

    Some special files and directories are also included or excluded regardless +of whether they exist in the files array (see below).

    +

    You can also provide a .npmignore file in the root of your package or in +subdirectories, which will keep files from being included. At the root of +your package it will not override the "files" field, but in subdirectories +it will. The .npmignore file works just like a .gitignore. If there is +a .gitignore file, and .npmignore is missing, .gitignore's contents +will be used instead.

    +

    Certain files are always included, regardless of settings:

    +
      +
    • package.json
    • +
    • README
    • +
    • LICENSE / LICENCE
    • +
    • The file in the "main" field
    • +
    • The file(s) in the "bin" field
    • +
    +

    README & LICENSE can have any case and extension.

    +

    Some files are always ignored by default:

    +
      +
    • *.orig
    • +
    • .*.swp
    • +
    • .DS_Store
    • +
    • ._*
    • +
    • .git
    • +
    • .hg
    • +
    • .lock-wscript
    • +
    • .npmrc
    • +
    • .svn
    • +
    • .wafpickle-N
    • +
    • CVS
    • +
    • config.gypi
    • +
    • node_modules
    • +
    • npm-debug.log
    • +
    • package-lock.json (use +npm-shrinkwrap.json +if you wish it to be published)
    • +
    • pnpm-lock.yaml
    • +
    • yarn.lock
    • +
    • bun.lockb
    • +
    +

    Most of these ignored files can be included specifically if included in +the files globs. Exceptions to this are:

    +
      +
    • .git
    • +
    • .npmrc
    • +
    • node_modules
    • +
    • package-lock.json
    • +
    • pnpm-lock.yaml
    • +
    • yarn.lock
    • +
    • bun.lockb
    • +
    +

    These can not be included.

    +

    exports

    +

    The "exports" provides a modern alternative to "main" allowing multiple entry points to be defined, conditional entry resolution support between environments, and preventing any other entry points besides those defined in "exports". This encapsulation allows module authors to clearly define the public interface for their package. For more details see the node.js documentation on package entry points

    +

    main

    +

    The main field is a module ID that is the primary entry point to your +program. That is, if your package is named foo, and a user installs it, +and then does require("foo"), then your main module's exports object will +be returned.

    +

    This should be a module relative to the root of your package folder.

    +

    For most modules, it makes the most sense to have a main script and often +not much else.

    +

    If main is not set, it defaults to index.js in the package's root folder.

    +

    browser

    +

    If your module is meant to be used client-side the browser field should be +used instead of the main field. This is helpful to hint users that it might +rely on primitives that aren't available in Node.js modules. (e.g. +window)

    +

    bin

    +

    A lot of packages have one or more executable files that they'd like to +install into the PATH. npm makes this pretty easy (in fact, it uses this +feature to install the "npm" executable.)

    +

    To use this, supply a bin field in your package.json which is a map of +command name to local file name. When this package is installed globally, +that file will be either linked inside the global bins directory or +a cmd (Windows Command File) will be created which executes the specified +file in the bin field, so it is available to run by name or name.cmd (on +Windows PowerShell). When this package is installed as a dependency in another +package, the file will be linked where it will be available to that package +either directly by npm exec or by name in other scripts when invoking them +via npm run-script.

    +

    For example, myapp could have this:

    +
    {
    +  "bin": {
    +    "myapp": "bin/cli.js"
    +  }
    +}
    +
    +

    So, when you install myapp, in case of unix-like OS it'll create a symlink +from the cli.js script to /usr/local/bin/myapp and in case of windows it +will create a cmd file usually at C:\Users\{Username}\AppData\Roaming\npm\myapp.cmd +which runs the cli.js script.

    +

    If you have a single executable, and its name should be the name of the +package, then you can just supply it as a string. For example:

    +
    {
    +  "name": "my-program",
    +  "version": "1.2.5",
    +  "bin": "path/to/program"
    +}
    +
    +

    would be the same as this:

    +
    {
    +  "name": "my-program",
    +  "version": "1.2.5",
    +  "bin": {
    +    "my-program": "path/to/program"
    +  }
    +}
    +
    +

    Please make sure that your file(s) referenced in bin starts with +#!/usr/bin/env node, otherwise the scripts are started without the node +executable!

    +

    Note that you can also set the executable files using directories.bin.

    +

    See folders for more info on +executables.

    +

    man

    +

    Specify either a single file or an array of filenames to put in place for +the man program to find.

    +

    If only a single file is provided, then it's installed such that it is the +result from man <pkgname>, regardless of its actual filename. For +example:

    +
    {
    +  "name": "foo",
    +  "version": "1.2.3",
    +  "description": "A packaged foo fooer for fooing foos",
    +  "main": "foo.js",
    +  "man": "./man/doc.1"
    +}
    +
    +

    would link the ./man/doc.1 file in such that it is the target for man foo

    +

    If the filename doesn't start with the package name, then it's prefixed. +So, this:

    +
    {
    +  "name": "foo",
    +  "version": "1.2.3",
    +  "description": "A packaged foo fooer for fooing foos",
    +  "main": "foo.js",
    +  "man": [
    +    "./man/foo.1",
    +    "./man/bar.1"
    +  ]
    +}
    +
    +

    will create files to do man foo and man foo-bar.

    +

    Man files must end with a number, and optionally a .gz suffix if they are +compressed. The number dictates which man section the file is installed +into.

    +
    {
    +  "name": "foo",
    +  "version": "1.2.3",
    +  "description": "A packaged foo fooer for fooing foos",
    +  "main": "foo.js",
    +  "man": [
    +    "./man/foo.1",
    +    "./man/foo.2"
    +  ]
    +}
    +
    +

    will create entries for man foo and man 2 foo

    +

    directories

    +

    The CommonJS Packages spec +details a few ways that you can indicate the structure of your package +using a directories object. If you look at npm's +package.json, you'll see that it +has directories for doc, lib, and man.

    +

    In the future, this information may be used in other creative ways.

    +

    directories.bin

    +

    If you specify a bin directory in directories.bin, all the files in +that folder will be added.

    +

    Because of the way the bin directive works, specifying both a bin path +and setting directories.bin is an error. If you want to specify +individual files, use bin, and for all the files in an existing bin +directory, use directories.bin.

    +

    directories.man

    +

    A folder that is full of man pages. Sugar to generate a "man" array by +walking the folder.

    +

    repository

    +

    Specify the place where your code lives. This is helpful for people who +want to contribute. If the git repo is on GitHub, then the npm repo +command will be able to find you.

    +

    Do it like this:

    +
    {
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/cli.git"
    +  }
    +}
    +
    +

    The URL should be a publicly available (perhaps read-only) URL that can be +handed directly to a VCS program without any modification. It should not +be a URL to an html project page that you put in your browser. It's for +computers.

    +

    For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the +same shortcut syntax you use for npm install:

    +
    {
    +  "repository": "npm/npm",
    +
    +  "repository": "github:user/repo",
    +
    +  "repository": "gist:11081aaa281",
    +
    +  "repository": "bitbucket:user/repo",
    +
    +  "repository": "gitlab:user/repo"
    +}
    +
    +

    If the package.json for your package is not in the root directory (for +example if it is part of a monorepo), you can specify the directory in +which it lives:

    +
    {
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/cli.git",
    +    "directory": "workspaces/libnpmpublish"
    +  }
    +}
    +
    +

    scripts

    +

    The "scripts" property is a dictionary containing script commands that are +run at various times in the lifecycle of your package. The key is the +lifecycle event, and the value is the command to run at that point.

    +

    See scripts to find out more about writing package +scripts.

    +

    config

    +

    A "config" object can be used to set configuration parameters used in +package scripts that persist across upgrades. For instance, if a package +had the following:

    +
    {
    +  "name": "foo",
    +  "config": {
    +    "port": "8080"
    +  }
    +}
    +
    +

    It could also have a "start" command that referenced the +npm_package_config_port environment variable.

    +

    dependencies

    +

    Dependencies are specified in a simple object that maps a package name to a +version range. The version range is a string which has one or more +space-separated descriptors. Dependencies can also be identified with a +tarball or git URL.

    +

    Please do not put test harnesses or transpilers or other "development" +time tools in your dependencies object. See devDependencies, below.

    +

    See semver for more details about specifying version ranges.

    +
      +
    • version Must match version exactly
    • +
    • >version Must be greater than version
    • +
    • >=version etc
    • +
    • <version
    • +
    • <=version
    • +
    • ~version "Approximately equivalent to version" See +semver
    • +
    • ^version "Compatible with version" See semver
    • +
    • 1.2.x 1.2.0, 1.2.1, etc., but not 1.3.0
    • +
    • http://... See 'URLs as Dependencies' below
    • +
    • * Matches any version
    • +
    • "" (just an empty string) Same as *
    • +
    • version1 - version2 Same as >=version1 <=version2.
    • +
    • range1 || range2 Passes if either range1 or range2 are satisfied.
    • +
    • git... See 'Git URLs as Dependencies' below
    • +
    • user/repo See 'GitHub URLs' below
    • +
    • tag A specific version tagged and published as tag See npm dist-tag
    • +
    • path/path/path See Local Paths below
    • +
    • npm:@scope/pkg@version Custom alias for a pacakge See package-spec
    • +
    +

    For example, these are all valid:

    +
    {
    +  "dependencies": {
    +    "foo": "1.0.0 - 2.9999.9999",
    +    "bar": ">=1.0.2 <2.1.2",
    +    "baz": ">1.0.2 <=2.3.4",
    +    "boo": "2.0.1",
    +    "qux": "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0",
    +    "asd": "http://asdf.com/asdf.tar.gz",
    +    "til": "~1.2",
    +    "elf": "~1.2.3",
    +    "two": "2.x",
    +    "thr": "3.3.x",
    +    "lat": "latest",
    +    "dyl": "file:../dyl",
    +    "kpg": "npm:pkg@1.0.0"
    +  }
    +}
    +
    +

    URLs as Dependencies

    +

    You may specify a tarball URL in place of a version range.

    +

    This tarball will be downloaded and installed locally to your package at +install time.

    +

    Git URLs as Dependencies

    +

    Git URLs are of the form:

    +
    <protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]
    +
    +

    <protocol> is one of git, git+ssh, git+http, git+https, or +git+file.

    +

    If #<commit-ish> is provided, it will be used to clone exactly that +commit. If the commit-ish has the format #semver:<semver>, <semver> can +be any valid semver range or exact version, and npm will look for any tags +or refs matching that range in the remote repository, much as it would for +a registry dependency. If neither #<commit-ish> or #semver:<semver> is +specified, then the default branch is used.

    +

    Examples:

    +
    git+ssh://git@github.com:npm/cli.git#v1.0.27
    +git+ssh://git@github.com:npm/cli#semver:^5.0
    +git+https://isaacs@github.com/npm/cli.git
    +git://github.com/npm/cli.git#v1.0.27
    +
    +

    When installing from a git repository, the presence of certain fields in the +package.json will cause npm to believe it needs to perform a build. To do so +your repository will be cloned into a temporary directory, all of its deps +installed, relevant scripts run, and the resulting directory packed and +installed.

    +

    This flow will occur if your git dependency uses workspaces, or if any of the +following scripts are present:

    +
      +
    • build
    • +
    • prepare
    • +
    • prepack
    • +
    • preinstall
    • +
    • install
    • +
    • postinstall
    • +
    +

    If your git repository includes pre-built artifacts, you will likely want to +make sure that none of the above scripts are defined, or your dependency +will be rebuilt for every installation.

    +

    GitHub URLs

    +

    As of version 1.1.65, you can refer to GitHub URLs as just "foo": +"user/foo-project". Just as with git URLs, a commit-ish suffix can be +included. For example:

    +
    {
    +  "name": "foo",
    +  "version": "0.0.0",
    +  "dependencies": {
    +    "express": "expressjs/express",
    +    "mocha": "mochajs/mocha#4727d357ea",
    +    "module": "user/repo#feature\/branch"
    +  }
    +}
    +
    +

    Local Paths

    +

    As of version 2.0.0 you can provide a path to a local directory that +contains a package. Local paths can be saved using npm install -S or npm install --save, using any of these forms:

    +
    ../foo/bar
    +~/foo/bar
    +./foo/bar
    +/foo/bar
    +
    +

    in which case they will be normalized to a relative path and added to your +package.json. For example:

    +
    {
    +  "name": "baz",
    +  "dependencies": {
    +    "bar": "file:../foo/bar"
    +  }
    +}
    +
    +

    This feature is helpful for local offline development and creating tests +that require npm installing where you don't want to hit an external server, +but should not be used when publishing your package to the public registry.

    +

    note: Packages linked by local path will not have their own +dependencies installed when npm install is ran in this case. You must +run npm install from inside the local path itself.

    +

    devDependencies

    +

    If someone is planning on downloading and using your module in their +program, then they probably don't want or need to download and build the +external test or documentation framework that you use.

    +

    In this case, it's best to map these additional items in a +devDependencies object.

    +

    These things will be installed when doing npm link or npm install from +the root of a package, and can be managed like any other npm configuration +param. See config for more on the topic.

    +

    For build steps that are not platform-specific, such as compiling +CoffeeScript or other languages to JavaScript, use the prepare script to +do this, and make the required package a devDependency.

    +

    For example:

    +
    {
    +  "name": "ethopia-waza",
    +  "description": "a delightfully fruity coffee varietal",
    +  "version": "1.2.3",
    +  "devDependencies": {
    +    "coffee-script": "~1.6.3"
    +  },
    +  "scripts": {
    +    "prepare": "coffee -o lib/ -c src/waza.coffee"
    +  },
    +  "main": "lib/waza.js"
    +}
    +
    +

    The prepare script will be run before publishing, so that users can +consume the functionality without requiring them to compile it themselves. +In dev mode (ie, locally running npm install), it'll run this script as +well, so that you can test it easily.

    +

    peerDependencies

    +

    In some cases, you want to express the compatibility of your package with a +host tool or library, while not necessarily doing a require of this host. +This is usually referred to as a plugin. Notably, your module may be +exposing a specific interface, expected and specified by the host +documentation.

    +

    For example:

    +
    {
    +  "name": "tea-latte",
    +  "version": "1.3.5",
    +  "peerDependencies": {
    +    "tea": "2.x"
    +  }
    +}
    +
    +

    This ensures your package tea-latte can be installed along with the +second major version of the host package tea only. npm install tea-latte could possibly yield the following dependency graph:

    +
    ├── tea-latte@1.3.5
    +└── tea@2.2.0
    +
    +

    In npm versions 3 through 6, peerDependencies were not automatically +installed, and would raise a warning if an invalid version of the peer +dependency was found in the tree. As of npm v7, peerDependencies are +installed by default.

    +

    Trying to install another plugin with a conflicting requirement may cause +an error if the tree cannot be resolved correctly. For this reason, make +sure your plugin requirement is as broad as possible, and not to lock it +down to specific patch versions.

    +

    Assuming the host complies with semver, only changes +in the host package's major version will break your plugin. Thus, if you've +worked with every 1.x version of the host package, use "^1.0" or "1.x" +to express this. If you depend on features introduced in 1.5.2, use +"^1.5.2".

    +

    peerDependenciesMeta

    +

    The peerDependenciesMeta field serves to provide npm more information on how +your peer dependencies are to be used. Specifically, it allows peer +dependencies to be marked as optional. Npm will not automatically install +optional peer dependencies. This allows you to +integrate and interact with a variety of host packages without requiring +all of them to be installed.

    +

    For example:

    +
    {
    +  "name": "tea-latte",
    +  "version": "1.3.5",
    +  "peerDependencies": {
    +    "tea": "2.x",
    +    "soy-milk": "1.2"
    +  },
    +  "peerDependenciesMeta": {
    +    "soy-milk": {
    +      "optional": true
    +    }
    +  }
    +}
    +
    +

    bundleDependencies

    +

    This defines an array of package names that will be bundled when publishing +the package.

    +

    In cases where you need to preserve npm packages locally or have them +available through a single file download, you can bundle the packages in a +tarball file by specifying the package names in the bundleDependencies +array and executing npm pack.

    +

    For example:

    +

    If we define a package.json like this:

    +
    {
    +  "name": "awesome-web-framework",
    +  "version": "1.0.0",
    +  "bundleDependencies": [
    +    "renderized",
    +    "super-streams"
    +  ]
    +}
    +
    +

    we can obtain awesome-web-framework-1.0.0.tgz file by running npm pack. +This file contains the dependencies renderized and super-streams which +can be installed in a new project by executing npm install awesome-web-framework-1.0.0.tgz. Note that the package names do not +include any versions, as that information is specified in dependencies.

    +

    If this is spelled "bundledDependencies", then that is also honored.

    +

    Alternatively, "bundleDependencies" can be defined as a boolean value. A +value of true will bundle all dependencies, a value of false will bundle +none.

    +

    optionalDependencies

    +

    If a dependency can be used, but you would like npm to proceed if it cannot +be found or fails to install, then you may put it in the +optionalDependencies object. This is a map of package name to version or +URL, just like the dependencies object. The difference is that build +failures do not cause installation to fail. Running npm install --omit=optional will prevent these dependencies from being installed.

    +

    It is still your program's responsibility to handle the lack of the +dependency. For example, something like this:

    +
    try {
    +  var foo = require('foo')
    +  var fooVersion = require('foo/package.json').version
    +} catch (er) {
    +  foo = null
    +}
    +if ( notGoodFooVersion(fooVersion) ) {
    +  foo = null
    +}
    +
    +// .. then later in your program ..
    +
    +if (foo) {
    +  foo.doFooThings()
    +}
    +
    +

    Entries in optionalDependencies will override entries of the same name in +dependencies, so it's usually best to only put in one place.

    +

    overrides

    +

    If you need to make specific changes to dependencies of your dependencies, for +example replacing the version of a dependency with a known security issue, +replacing an existing dependency with a fork, or making sure that the same +version of a package is used everywhere, then you may add an override.

    +

    Overrides provide a way to replace a package in your dependency tree with +another version, or another package entirely. These changes can be scoped as +specific or as vague as desired.

    +

    Overrides are only considered in the root package.json file for a project. +Overrides in installed dependencies (including +workspaces) are not considered in dependency tree +resolution. Published packages may dictate their resolutions by pinning +dependencies or using an +npm-shrinkwrap.json file.

    +

    To make sure the package foo is always installed as version 1.0.0 no matter +what version your dependencies rely on:

    +
    {
    +  "overrides": {
    +    "foo": "1.0.0"
    +  }
    +}
    +
    +

    The above is a short hand notation, the full object form can be used to allow +overriding a package itself as well as a child of the package. This will cause +foo to always be 1.0.0 while also making bar at any depth beyond foo +also 1.0.0:

    +
    {
    +  "overrides": {
    +    "foo": {
    +      ".": "1.0.0",
    +      "bar": "1.0.0"
    +    }
    +  }
    +}
    +
    +

    To only override foo to be 1.0.0 when it's a child (or grandchild, or great +grandchild, etc) of the package bar:

    +
    {
    +  "overrides": {
    +    "bar": {
    +      "foo": "1.0.0"
    +    }
    +  }
    +}
    +
    +

    Keys can be nested to any arbitrary length. To override foo only when it's a +child of bar and only when bar is a child of baz:

    +
    {
    +  "overrides": {
    +    "baz": {
    +      "bar": {
    +        "foo": "1.0.0"
    +      }
    +    }
    +  }
    +}
    +
    +

    The key of an override can also include a version, or range of versions. +To override foo to 1.0.0, but only when it's a child of bar@2.0.0:

    +
    {
    +  "overrides": {
    +    "bar@2.0.0": {
    +      "foo": "1.0.0"
    +    }
    +  }
    +}
    +
    +

    You may not set an override for a package that you directly depend on unless +both the dependency and the override itself share the exact same spec. To make +this limitation easier to deal with, overrides may also be defined as a +reference to a spec for a direct dependency by prefixing the name of the +package you wish the version to match with a $.

    +
    {
    +  "dependencies": {
    +    "foo": "^1.0.0"
    +  },
    +  "overrides": {
    +    // BAD, will throw an EOVERRIDE error
    +    // "foo": "^2.0.0"
    +    // GOOD, specs match so override is allowed
    +    // "foo": "^1.0.0"
    +    // BEST, the override is defined as a reference to the dependency
    +    "foo": "$foo",
    +    // the referenced package does not need to match the overridden one
    +    "bar": "$foo"
    +  }
    +}
    +
    +

    engines

    +

    You can specify the version of node that your stuff works on:

    +
    {
    +  "engines": {
    +    "node": ">=0.10.3 <15"
    +  }
    +}
    +
    +

    And, like with dependencies, if you don't specify the version (or if you +specify "*" as the version), then any version of node will do.

    +

    You can also use the "engines" field to specify which versions of npm are +capable of properly installing your program. For example:

    +
    {
    +  "engines": {
    +    "npm": "~1.0.20"
    +  }
    +}
    +
    +

    Unless the user has set the +engine-strict config flag, this field is +advisory only and will only produce warnings when your package is installed as a +dependency.

    +

    os

    +

    You can specify which operating systems your +module will run on:

    +
    {
    +  "os": [
    +    "darwin",
    +    "linux"
    +  ]
    +}
    +
    +

    You can also block instead of allowing operating systems, just prepend the +blocked os with a '!':

    +
    {
    +  "os": [
    +    "!win32"
    +  ]
    +}
    +
    +

    The host operating system is determined by process.platform

    +

    It is allowed to both block and allow an item, although there isn't any +good reason to do this.

    +

    cpu

    +

    If your code only runs on certain cpu architectures, +you can specify which ones.

    +
    {
    +  "cpu": [
    +    "x64",
    +    "ia32"
    +  ]
    +}
    +
    +

    Like the os option, you can also block architectures:

    +
    {
    +  "cpu": [
    +    "!arm",
    +    "!mips"
    +  ]
    +}
    +
    +

    The host architecture is determined by process.arch

    +

    libc

    +

    If your code only runs or builds in certain versions of libc, you can +specify which ones. This field only applies if os is linux.

    +
    {
    +  "os": "linux",
    +  "libc": "glibc"
    +}
    +
    +

    devEngines

    +

    The devEngines field aids engineers working on a codebase to all be using the same tooling.

    +

    You can specify a devEngines property in your package.json which will run before install, ci, and run commands.

    +
    +

    Note: engines and devEngines differ in object shape. They also function very differently. engines is designed to alert the user when a dependency uses a differening npm or node version that the project it's being used in, whereas devEngines is used to alert people interacting with the source code of a project.

    +
    +

    The supported keys under the devEngines property are cpu, os, libc, runtime, and packageManager. Each property can be an object or an array of objects. Objects must contain name, and optionally can specify version, and onFail. onFail can be warn, error, or ignore, and if left undefined is of the same value as error. npm will assume that you're running with node. +Here's an example of a project that will fail if the environment is not node and npm. If you set runtime.name or packageManager.name to any other string, it will fail within the npm CLI.

    +
    {
    +  "devEngines": {
    +    "runtime": {
    +      "name": "node",
    +      "onFail": "error"
    +    },
    +    "packageManager": {
    +      "name": "npm",
    +      "onFail": "error"
    +    }
    +  }
    +}
    +
    +

    private

    +

    If you set "private": true in your package.json, then npm will refuse to +publish it.

    +

    This is a way to prevent accidental publication of private repositories. +If you would like to ensure that a given package is only ever published to +a specific registry (for example, an internal registry), then use the +publishConfig dictionary described below to override the registry +config param at publish-time.

    +

    publishConfig

    +

    This is a set of config values that will be used at publish-time. It's +especially handy if you want to set the tag, registry or access, so that +you can ensure that a given package is not tagged with "latest", published +to the global public registry or that a scoped module is private by +default.

    +

    See config to see the list of config options that +can be overridden.

    +

    workspaces

    +

    The optional workspaces field is an array of file patterns that describes +locations within the local file system that the install client should look +up to find each workspace that needs to be +symlinked to the top level node_modules folder.

    +

    It can describe either the direct paths of the folders to be used as +workspaces or it can define globs that will resolve to these same folders.

    +

    In the following example, all folders located inside the folder +./packages will be treated as workspaces as long as they have valid +package.json files inside them:

    +
    {
    +  "name": "workspace-example",
    +  "workspaces": [
    +    "./packages/*"
    +  ]
    +}
    +
    +

    See workspaces for more examples.

    +

    DEFAULT VALUES

    +

    npm will default some values based on package contents.

    +
      +
    • +

      "scripts": {"start": "node server.js"}

      +

      If there is a server.js file in the root of your package, then npm will +default the start command to node server.js.

      +
    • +
    • +

      "scripts":{"install": "node-gyp rebuild"}

      +

      If there is a binding.gyp file in the root of your package and you have +not defined an install or preinstall script, npm will default the +install command to compile using node-gyp.

      +
    • +
    • +

      "contributors": [...]

      +

      If there is an AUTHORS file in the root of your package, npm will treat +each line as a Name <email> (url) format, where email and url are +optional. Lines which start with a # or are blank, will be ignored.

      +
    • +
    +

    SEE ALSO

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/configuring-npm/package-lock-json.html b/node_modules/npm/docs/output/configuring-npm/package-lock-json.html new file mode 100644 index 00000000..8017f033 --- /dev/null +++ b/node_modules/npm/docs/output/configuring-npm/package-lock-json.html @@ -0,0 +1,399 @@ + + +package-lock.json + + + + + +
    +
    +

    + package-lock.json + @11.0.0 +

    +A manifestation of the manifest +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    package-lock.json is automatically generated for any operations where npm +modifies either the node_modules tree, or package.json. It describes the +exact tree that was generated, such that subsequent installs are able to +generate identical trees, regardless of intermediate dependency updates.

    +

    This file is intended to be committed into source repositories, and serves +various purposes:

    +
      +
    • +

      Describe a single representation of a dependency tree such that +teammates, deployments, and continuous integration are guaranteed to +install exactly the same dependencies.

      +
    • +
    • +

      Provide a facility for users to "time-travel" to previous states of +node_modules without having to commit the directory itself.

      +
    • +
    • +

      Facilitate greater visibility of tree changes through readable source +control diffs.

      +
    • +
    • +

      Optimize the installation process by allowing npm to skip repeated +metadata resolutions for previously-installed packages.

      +
    • +
    • +

      As of npm v7, lockfiles include enough information to gain a complete +picture of the package tree, reducing the need to read package.json +files, and allowing for significant performance improvements.

      +
    • +
    +

    When npm creates or updates package-lock.json, it will infer line endings and indentation from package.json so that the formatting of both files matches.

    +

    package-lock.json vs npm-shrinkwrap.json

    +

    Both of these files have the same format, and perform similar functions in +the root of a project.

    +

    The difference is that package-lock.json cannot be published, and it will +be ignored if found in any place other than the root project.

    +

    In contrast, npm-shrinkwrap.json allows +publication, and defines the dependency tree from the point encountered. +This is not recommended unless deploying a CLI tool or otherwise using the +publication process for producing production packages.

    +

    If both package-lock.json and npm-shrinkwrap.json are present in the +root of a project, npm-shrinkwrap.json will take precedence and +package-lock.json will be ignored.

    +

    Hidden Lockfiles

    +

    In order to avoid processing the node_modules folder repeatedly, npm as +of v7 uses a "hidden" lockfile present in +node_modules/.package-lock.json. This contains information about the +tree, and is used in lieu of reading the entire node_modules hierarchy +provided that the following conditions are met:

    +
      +
    • All package folders it references exist in the node_modules hierarchy.
    • +
    • No package folders exist in the node_modules hierarchy that are not +listed in the lockfile.
    • +
    • The modified time of the file is at least as recent as all of the package +folders it references.
    • +
    +

    That is, the hidden lockfile will only be relevant if it was created as +part of the most recent update to the package tree. If another CLI mutates +the tree in any way, this will be detected, and the hidden lockfile will be +ignored.

    +

    Note that it is possible to manually change the contents of a package +in such a way that the modified time of the package folder is unaffected. +For example, if you add a file to node_modules/foo/lib/bar.js, then the +modified time on node_modules/foo will not reflect this change. If you +are manually editing files in node_modules, it is generally best to +delete the file at node_modules/.package-lock.json.

    +

    As the hidden lockfile is ignored by older npm versions, it does not +contain the backwards compatibility affordances present in "normal" +lockfiles. That is, it is lockfileVersion: 3, rather than +lockfileVersion: 2.

    +

    Handling Old Lockfiles

    +

    When npm detects a lockfile from npm v6 or before during the package +installation process, it is automatically updated to fetch missing +information from either the node_modules tree or (in the case of empty +node_modules trees or very old lockfile formats) the npm registry.

    +

    File Format

    +

    name

    +

    The name of the package this is a package-lock for. This will match what's +in package.json.

    +

    version

    +

    The version of the package this is a package-lock for. This will match +what's in package.json.

    +

    lockfileVersion

    +

    An integer version, starting at 1 with the version number of this +document whose semantics were used when generating this +package-lock.json.

    +

    Note that the file format changed significantly in npm v7 to track +information that would have otherwise required looking in node_modules or +the npm registry. Lockfiles generated by npm v7 will contain +lockfileVersion: 2.

    +
      +
    • No version provided: an "ancient" shrinkwrap file from a version of npm +prior to npm v5.
    • +
    • 1: The lockfile version used by npm v5 and v6.
    • +
    • 2: The lockfile version used by npm v7 and v8. Backwards compatible to v1 +lockfiles.
    • +
    • 3: The lockfile version used by npm v9 and above. Backwards compatible to npm v7.
    • +
    +

    npm will always attempt to get whatever data it can out of a lockfile, even +if it is not a version that it was designed to support.

    +

    packages

    +

    This is an object that maps package locations to an object containing the +information about that package.

    +

    The root project is typically listed with a key of "", and all other +packages are listed with their relative paths from the root project folder.

    +

    Package descriptors have the following fields:

    +
      +
    • +

      version: The version found in package.json

      +
    • +
    • +

      resolved: The place where the package was actually resolved from. In +the case of packages fetched from the registry, this will be a url to a +tarball. In the case of git dependencies, this will be the full git url +with commit sha. In the case of link dependencies, this will be the +location of the link target. registry.npmjs.org is a magic value meaning +"the currently configured registry".

      +
    • +
    • +

      integrity: A sha512 or sha1 Standard Subresource +Integrity +string for the artifact that was unpacked in this location.

      +
    • +
    • +

      link: A flag to indicate that this is a symbolic link. If this is +present, no other fields are specified, since the link target will also +be included in the lockfile.

      +
    • +
    • +

      dev, optional, devOptional: If the package is strictly part of the +devDependencies tree, then dev will be true. If it is strictly part +of the optionalDependencies tree, then optional will be set. If it +is both a dev dependency and an optional dependency of a non-dev +dependency, then devOptional will be set. (An optional dependency of +a dev dependency will have both dev and optional set.)

      +
    • +
    • +

      inBundle: A flag to indicate that the package is a bundled dependency.

      +
    • +
    • +

      hasInstallScript: A flag to indicate that the package has a preinstall, +install, or postinstall script.

      +
    • +
    • +

      hasShrinkwrap: A flag to indicate that the package has an +npm-shrinkwrap.json file.

      +
    • +
    • +

      bin, license, engines, dependencies, optionalDependencies: fields from +package.json

      +
    • +
    +

    dependencies

    +

    Legacy data for supporting versions of npm that use lockfileVersion: 1. +This is a mapping of package names to dependency objects. Because the +object structure is strictly hierarchical, symbolic link dependencies are +somewhat challenging to represent in some cases.

    +

    npm v7 ignores this section entirely if a packages section is present, +but does keep it up to date in order to support switching between npm v6 +and npm v7.

    +

    Dependency objects have the following fields:

    +
      +
    • +

      version: a specifier that varies depending on the nature of the package, +and is usable in fetching a new copy of it.

      +
        +
      • bundled dependencies: Regardless of source, this is a version number +that is purely for informational purposes.
      • +
      • registry sources: This is a version number. (eg, 1.2.3)
      • +
      • git sources: This is a git specifier with resolved committish. (eg, +git+https://example.com/foo/bar#115311855adb0789a0466714ed48a1499ffea97e)
      • +
      • http tarball sources: This is the URL of the tarball. (eg, +https://example.com/example-1.3.0.tgz)
      • +
      • local tarball sources: This is the file URL of the tarball. (eg +file:///opt/storage/example-1.3.0.tgz)
      • +
      • local link sources: This is the file URL of the link. (eg +file:libs/our-module)
      • +
      +
    • +
    • +

      integrity: A sha512 or sha1 Standard Subresource +Integrity +string for the artifact that was unpacked in this location. For git +dependencies, this is the commit sha.

      +
    • +
    • +

      resolved: For registry sources this is path of the tarball relative to +the registry URL. If the tarball URL isn't on the same server as the +registry URL then this is a complete URL. registry.npmjs.org is a magic +value meaning "the currently configured registry".

      +
    • +
    • +

      bundled: If true, this is the bundled dependency and will be installed +by the parent module. When installing, this module will be extracted +from the parent module during the extract phase, not installed as a +separate dependency.

      +
    • +
    • +

      dev: If true then this dependency is either a development dependency ONLY +of the top level module or a transitive dependency of one. This is false +for dependencies that are both a development dependency of the top level +and a transitive dependency of a non-development dependency of the top +level.

      +
    • +
    • +

      optional: If true then this dependency is either an optional dependency +ONLY of the top level module or a transitive dependency of one. This is +false for dependencies that are both an optional dependency of the top +level and a transitive dependency of a non-optional dependency of the top +level.

      +
    • +
    • +

      requires: This is a mapping of module name to version. This is a list of +everything this module requires, regardless of where it will be +installed. The version should match via normal matching rules a +dependency either in our dependencies or in a level higher than us.

      +
    • +
    • +

      dependencies: The dependencies of this dependency, exactly as at the top +level.

      +
    • +
    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/config.html b/node_modules/npm/docs/output/using-npm/config.html new file mode 100644 index 00000000..94207774 --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/config.html @@ -0,0 +1,1618 @@ + + +config + + + + + +
    +
    +

    + config + @11.0.0 +

    +More than you probably want to know about npm configuration +
    + +
    +

    Table of contents

    +
    +
    + +

    Description

    +

    This article details npm configuration in general. To learn about the config command, +see npm config.

    +

    npm gets its configuration values from the following sources, sorted by priority:

    +

    Command Line Flags

    +

    Putting --foo bar on the command line sets the foo configuration +parameter to "bar". A -- argument tells the cli parser to stop +reading flags. Using --flag without specifying any value will set +the value to true.

    +

    Example: --flag1 --flag2 will set both configuration parameters +to true, while --flag1 --flag2 bar will set flag1 to true, +and flag2 to bar. Finally, --flag1 --flag2 -- bar will set +both configuration parameters to true, and the bar is taken +as a command argument.

    +

    Environment Variables

    +

    Any environment variables that start with npm_config_ will be +interpreted as a configuration parameter. For example, putting +npm_config_foo=bar in your environment will set the foo +configuration parameter to bar. Any environment configurations that +are not given a value will be given the value of true. Config +values are case-insensitive, so NPM_CONFIG_FOO=bar will work the +same. However, please note that inside scripts +npm will set its own environment variables and Node will prefer +those lowercase versions over any uppercase ones that you might set. +For details see this issue.

    +

    Notice that you need to use underscores instead of dashes, so --allow-same-version +would become npm_config_allow_same_version=true.

    +

    npmrc Files

    +

    The four relevant files are:

    +
      +
    • per-project configuration file (/path/to/my/project/.npmrc)
    • +
    • per-user configuration file (defaults to $HOME/.npmrc; configurable via CLI +option --userconfig or environment variable $NPM_CONFIG_USERCONFIG)
    • +
    • global configuration file (defaults to $PREFIX/etc/npmrc; configurable via +CLI option --globalconfig or environment variable $NPM_CONFIG_GLOBALCONFIG)
    • +
    • npm's built-in configuration file (/path/to/npm/npmrc)
    • +
    +

    See npmrc for more details.

    +

    Default Configs

    +

    Run npm config ls -l to see a set of configuration parameters that are +internal to npm, and are defaults if nothing else is specified.

    +

    Shorthands and Other CLI Niceties

    +

    The following shorthands are parsed on the command-line:

    +
      +
    • -a: --all
    • +
    • --enjoy-by: --before
    • +
    • -c: --call
    • +
    • --desc: --description
    • +
    • -f: --force
    • +
    • -g: --global
    • +
    • --iwr: --include-workspace-root
    • +
    • -L: --location
    • +
    • -d: --loglevel info
    • +
    • -s: --loglevel silent
    • +
    • --silent: --loglevel silent
    • +
    • --ddd: --loglevel silly
    • +
    • --dd: --loglevel verbose
    • +
    • --verbose: --loglevel verbose
    • +
    • -q: --loglevel warn
    • +
    • --quiet: --loglevel warn
    • +
    • -l: --long
    • +
    • -m: --message
    • +
    • --local: --no-global
    • +
    • -n: --no-yes
    • +
    • --no: --no-yes
    • +
    • -p: --parseable
    • +
    • --porcelain: --parseable
    • +
    • -C: --prefix
    • +
    • --readonly: --read-only
    • +
    • --reg: --registry
    • +
    • -S: --save
    • +
    • -B: --save-bundle
    • +
    • -D: --save-dev
    • +
    • -E: --save-exact
    • +
    • -O: --save-optional
    • +
    • -P: --save-prod
    • +
    • -?: --usage
    • +
    • -h: --usage
    • +
    • -H: --usage
    • +
    • --help: --usage
    • +
    • -v: --version
    • +
    • -w: --workspace
    • +
    • --ws: --workspaces
    • +
    • -y: --yes
    • +
    +

    If the specified configuration param resolves unambiguously to a known +configuration parameter, then it is expanded to that configuration +parameter. For example:

    +
    npm ls --par
    +# same as:
    +npm ls --parseable
    +
    +

    If multiple single-character shorthands are strung together, and the +resulting combination is unambiguously not some other configuration +param, then it is expanded to its various component pieces. For +example:

    +
    npm ls -gpld
    +# same as:
    +npm ls --global --parseable --long --loglevel info
    +
    +

    Config Settings

    +

    _auth

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    A basic-auth string to use when authenticating against the npm registry. +This will ONLY be used to authenticate against the npm registry. For other +registries you will need to scope it like "//other-registry.tld/:_auth"

    +

    Warning: This should generally not be set via a command-line option. It is +safer to use a registry-provided authentication bearer token stored in the +~/.npmrc file by running npm login.

    +

    access

    +
      +
    • Default: 'public' for new packages, existing packages it will not change the +current level
    • +
    • Type: null, "restricted", or "public"
    • +
    +

    If you do not want your scoped package to be publicly viewable (and +installable) set --access=restricted.

    +

    Unscoped packages can not be set to restricted.

    +

    Note: This defaults to not changing the current access level for existing +packages. Specifying a value of restricted or public during publish will +change the access for an existing package the same way that npm access set status would.

    +

    all

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When running npm outdated and npm ls, setting --all will show all +outdated or installed packages, rather than only those directly depended +upon by the current project.

    +

    allow-same-version

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Prevents throwing an error when npm version is used to set the new version +to the same value as the current version.

    +

    audit

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" submit audit reports alongside the current npm command to the +default registry and all registries configured for scopes. See the +documentation for npm audit for details on what is +submitted.

    +

    audit-level

    +
      +
    • Default: null
    • +
    • Type: null, "info", "low", "moderate", "high", "critical", or "none"
    • +
    +

    The minimum level of vulnerability for npm audit to exit with a non-zero +exit code.

    +

    auth-type

    +
      +
    • Default: "web"
    • +
    • Type: "legacy" or "web"
    • +
    +

    What authentication strategy to use with login. Note that if an otp +config is given, this value will always be set to legacy.

    +

    before

    +
      +
    • Default: null
    • +
    • Type: null or Date
    • +
    +

    If passed to npm install, will rebuild the npm tree such that only +versions that were available on or before the --before time get +installed. If there's no versions available for the current set of direct +dependencies, the command will error.

    +

    If the requested version is a dist-tag and the given tag does not pass the +--before filter, the most recent version less than or equal to that tag +will be used. For example, foo@latest might install foo@1.2 even though +latest is 2.0.

    + +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tells npm to create symlinks (or .cmd shims on Windows) for package +executables.

    +

    Set to false to have it not do this. This can be used to work around the +fact that some file systems don't support symlinks, even on ostensibly Unix +systems.

    +

    browser

    +
      +
    • Default: OS X: "open", Windows: "start", Others: "xdg-open"
    • +
    • Type: null, Boolean, or String
    • +
    +

    The browser that is called by npm commands to open websites.

    +

    Set to false to suppress browser behavior and instead print urls to +terminal.

    +

    Set to true to use default system URL opener.

    +

    ca

    +
      +
    • Default: null
    • +
    • Type: null or String (can be set multiple times)
    • +
    +

    The Certificate Authority signing certificate that is trusted for SSL +connections to the registry. Values should be in PEM format (Windows calls +it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string +"\n". For example:

    +
    ca="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
    +
    +

    Set to null to only allow "known" registrars, or to a specific CA cert to +trust only that specific signing authority.

    +

    Multiple CAs can be trusted by specifying an array of certificates:

    +
    ca[]="..."
    +ca[]="..."
    +
    +

    See also the strict-ssl config.

    +

    cache

    +
      +
    • Default: Windows: %LocalAppData%\npm-cache, Posix: ~/.npm
    • +
    • Type: Path
    • +
    +

    The location of npm's cache directory.

    +

    cafile

    +
      +
    • Default: null
    • +
    • Type: Path
    • +
    +

    A path to a file containing one or multiple Certificate Authority signing +certificates. Similar to the ca setting, but allows for multiple CA's, as +well as for the CA information to be stored in a file on disk.

    +

    call

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    Optional companion option for npm exec, npx that allows for specifying a +custom command to be run along with the installed packages.

    +
    npm exec --package yo --package generator-node --call "yo node"
    +
    +

    cidr

    +
      +
    • Default: null
    • +
    • Type: null or String (can be set multiple times)
    • +
    +

    This is a list of CIDR address to be used when configuring limited access +tokens with the npm token create command.

    +

    color

    +
      +
    • Default: true unless the NO_COLOR environ is set to something other than '0'
    • +
    • Type: "always" or Boolean
    • +
    +

    If false, never shows colors. If "always" then always shows colors. If +true, then only prints color codes for tty file descriptors.

    +

    commit-hooks

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Run git commit hooks when using the npm version command.

    +

    cpu

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    Override CPU architecture of native modules to install. Acceptable values +are same as cpu field of package.json, which comes from process.arch.

    +

    depth

    +
      +
    • Default: Infinity if --all is set, otherwise 1
    • +
    • Type: null or Number
    • +
    +

    The depth to go when recursing packages for npm ls.

    +

    If not set, npm ls will show only the immediate dependencies of the root +project. If --all is set, then npm will show all dependencies by default.

    +

    description

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Show the description in npm search

    +

    diff

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Define arguments to compare in npm diff.

    +

    diff-dst-prefix

    +
      +
    • Default: "b/"
    • +
    • Type: String
    • +
    +

    Destination prefix to be used in npm diff output.

    +

    diff-ignore-all-space

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Ignore whitespace when comparing lines in npm diff.

    +

    diff-name-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Prints only filenames when using npm diff.

    +

    diff-no-prefix

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Do not show any source or destination prefix in npm diff output.

    +

    Note: this causes npm diff to ignore the --diff-src-prefix and +--diff-dst-prefix configs.

    +

    diff-src-prefix

    +
      +
    • Default: "a/"
    • +
    • Type: String
    • +
    +

    Source prefix to be used in npm diff output.

    +

    diff-text

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Treat all files as text in npm diff.

    +

    diff-unified

    +
      +
    • Default: 3
    • +
    • Type: Number
    • +
    +

    The number of lines of context to print in npm diff.

    +

    dry-run

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Indicates that you don't want npm to make any changes and that it should +only report what it would have done. This can be passed into any of the +commands that modify your local installation, eg, install, update, +dedupe, uninstall, as well as pack and publish.

    +

    Note: This is NOT honored by other network related commands, eg dist-tags, +owner, etc.

    +

    editor

    +
      +
    • Default: The EDITOR or VISUAL environment variables, or +'%SYSTEMROOT%\notepad.exe' on Windows, or 'vi' on Unix systems
    • +
    • Type: String
    • +
    +

    The command to run for npm edit and npm config edit.

    +

    engine-strict

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, then npm will stubbornly refuse to install (or even consider +installing) any package that claims to not be compatible with the current +Node.js version.

    +

    This can be overridden by setting the --force flag.

    +

    expect-result-count

    +
      +
    • Default: null
    • +
    • Type: null or Number
    • +
    +

    Tells to expect a specific number of results from the command.

    +

    This config can not be used with: expect-results

    +

    expect-results

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Tells npm whether or not to expect results from the command. Can be either +true (expect some results) or false (expect no results).

    +

    This config can not be used with: expect-result-count

    +

    fetch-retries

    +
      +
    • Default: 2
    • +
    • Type: Number
    • +
    +

    The "retries" config for the retry module to use when fetching packages +from the registry.

    +

    npm will retry idempotent read requests to the registry in the case of +network failures or 5xx HTTP errors.

    +

    fetch-retry-factor

    +
      +
    • Default: 10
    • +
    • Type: Number
    • +
    +

    The "factor" config for the retry module to use when fetching packages.

    +

    fetch-retry-maxtimeout

    +
      +
    • Default: 60000 (1 minute)
    • +
    • Type: Number
    • +
    +

    The "maxTimeout" config for the retry module to use when fetching +packages.

    +

    fetch-retry-mintimeout

    +
      +
    • Default: 10000 (10 seconds)
    • +
    • Type: Number
    • +
    +

    The "minTimeout" config for the retry module to use when fetching +packages.

    +

    fetch-timeout

    +
      +
    • Default: 300000 (5 minutes)
    • +
    • Type: Number
    • +
    +

    The maximum amount of time to wait for HTTP requests to complete.

    +

    force

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Removes various protections against unfortunate side effects, common +mistakes, unnecessary performance degradation, and malicious input.

    +
      +
    • Allow clobbering non-npm files in global installs.
    • +
    • Allow the npm version command to work on an unclean git repository.
    • +
    • Allow deleting the cache folder with npm cache clean.
    • +
    • Allow installing packages that have an engines declaration requiring a +different version of npm.
    • +
    • Allow installing packages that have an engines declaration requiring a +different version of node, even if --engine-strict is enabled.
    • +
    • Allow npm audit fix to install modules outside your stated dependency +range (including SemVer-major changes).
    • +
    • Allow unpublishing all versions of a published package.
    • +
    • Allow conflicting peerDependencies to be installed in the root project.
    • +
    • Implicitly set --yes during npm init.
    • +
    • Allow clobbering existing values in npm pkg
    • +
    • Allow unpublishing of entire packages (not just a single version).
    • +
    +

    If you don't have a clear idea of what you want to do, it is strongly +recommended that you do not use this option!

    +

    foreground-scripts

    +
      +
    • Default: false unless when using npm pack or npm publish where it +defaults to true
    • +
    • Type: Boolean
    • +
    +

    Run all build scripts (ie, preinstall, install, and postinstall) +scripts for installed packages in the foreground process, sharing standard +input, output, and error with the main npm process.

    +

    Note that this will generally make installs run slower, and be much noisier, +but can be useful for debugging.

    +

    format-package-lock

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Format package-lock.json or npm-shrinkwrap.json as a human readable +file.

    +

    fund

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    When "true" displays the message at the end of each npm install +acknowledging the number of dependencies looking for funding. See npm fund for details.

    +

    git

    +
      +
    • Default: "git"
    • +
    • Type: String
    • +
    +

    The command to use for git commands. If git is installed on the computer, +but is not in the PATH, then set this to the full path to the git binary.

    +

    git-tag-version

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Tag the commit when using the npm version command. Setting this to false +results in no commit being made at all.

    +

    global

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Operates in "global" mode, so that packages are installed into the prefix +folder instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    globalconfig

    +
      +
    • Default: The global --prefix setting plus 'etc/npmrc'. For example, +'/usr/local/etc/npmrc'
    • +
    • Type: Path
    • +
    +

    The config file to read for global config options.

    +

    heading

    +
      +
    • Default: "npm"
    • +
    • Type: String
    • +
    +

    The string that starts all the debugging log output.

    +

    https-proxy

    +
      +
    • Default: null
    • +
    • Type: null or URL
    • +
    +

    A proxy to use for outgoing https requests. If the HTTPS_PROXY or +https_proxy or HTTP_PROXY or http_proxy environment variables are set, +proxy settings will be honored by the underlying make-fetch-happen +library.

    +

    if-present

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm will not exit with an error code when run-script is invoked +for a script that isn't defined in the scripts section of package.json. +This option can be used when it's desirable to optionally run a script when +it's present and fail if the script fails. This is useful, for example, when +running scripts that may only apply for some builds in an otherwise generic +CI setup.

    +

    This value is not exported to the environment for child processes.

    +

    ignore-scripts

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, npm does not run scripts specified in package.json files.

    +

    Note that commands explicitly intended to run a particular script, such as +npm start, npm stop, npm restart, npm test, and npm run-script +will still run their intended script if ignore-scripts is set, but they +will not run any pre- or post-scripts.

    +

    include

    +
      +
    • Default:
    • +
    • Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Option that allows for defining which types of dependencies to install.

    +

    This is the inverse of --omit=<type>.

    +

    Dependency types specified in --include will not be omitted, regardless of +the order in which omit/include are specified on the command-line.

    +

    include-staged

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Allow installing "staged" published packages, as defined by npm RFC PR +#92.

    +

    This is experimental, and not implemented by the npm public registry.

    +

    include-workspace-root

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Include the workspace root when workspaces are enabled for a command.

    +

    When false, specifying individual workspaces via the workspace config, or +all workspaces via the workspaces flag, will cause npm to operate only on +the specified workspaces, and not on the root project.

    +

    This value is not exported to the environment for child processes.

    +

    init-author-email

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    The value npm init should use by default for the package author's email.

    +

    init-author-name

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    The value npm init should use by default for the package author's name.

    +

    init-author-url

    +
      +
    • Default: ""
    • +
    • Type: "" or URL
    • +
    +

    The value npm init should use by default for the package author's +homepage.

    +

    init-license

    +
      +
    • Default: "ISC"
    • +
    • Type: String
    • +
    +

    The value npm init should use by default for the package license.

    +

    init-module

    +
      +
    • Default: "~/.npm-init.js"
    • +
    • Type: Path
    • +
    +

    A module that will be loaded by the npm init command. See the +documentation for the +init-package-json module for +more information, or npm init.

    +

    init-version

    +
      +
    • Default: "1.0.0"
    • +
    • Type: SemVer string
    • +
    +

    The value that npm init should use by default for the package version +number, if not already set in package.json.

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When set file: protocol dependencies will be packed and installed as regular +dependencies instead of creating a symlink. This option has no effect on +workspaces.

    +

    install-strategy

    +
      +
    • Default: "hoisted"
    • +
    • Type: "hoisted", "nested", "shallow", or "linked"
    • +
    +

    Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (experimental) install in node_modules/.store, +link in place, unhoisted.

    +

    json

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Whether or not to output JSON data, rather than the normal output.

    +
      +
    • In npm pkg set it enables parsing set values with JSON.parse() before +saving them to your package.json.
    • +
    +

    Not supported by all npm commands.

    +

    legacy-peer-deps

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Causes npm to completely ignore peerDependencies when building a package +tree, as in npm versions 3 through 6.

    +

    If a package cannot be installed because of overly strict peerDependencies +that collide, it provides a way to move forward resolving the situation.

    +

    This differs from --omit=peer, in that --omit=peer will avoid unpacking +peerDependencies on disk, but will still design a tree such that +peerDependencies could be unpacked in a correct place.

    +

    Use of legacy-peer-deps is not recommended, as it will not enforce the +peerDependencies contract that meta-dependencies may rely on.

    +

    libc

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    Override libc of native modules to install. Acceptable values are same as +libc field of package.json

    + +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Used with npm ls, limiting output to only those packages that are linked.

    +

    local-address

    +
      +
    • Default: null
    • +
    • Type: IP Address
    • +
    +

    The IP address of the local interface to use when making connections to the +npm registry. Must be IPv4 in versions of Node prior to 0.12.

    +

    location

    +
      +
    • Default: "user" unless --global is passed, which will also set this value +to "global"
    • +
    • Type: "global", "user", or "project"
    • +
    +

    When passed to npm config this refers to which config file to use.

    +

    When set to "global" mode, packages are installed into the prefix folder +instead of the current working directory. See +folders for more on the differences in behavior.

    +
      +
    • packages are installed into the {prefix}/lib/node_modules folder, instead +of the current working directory.
    • +
    • bin files are linked to {prefix}/bin
    • +
    • man pages are linked to {prefix}/share/man
    • +
    +

    lockfile-version

    +
      +
    • Default: Version 3 if no lockfile, auto-converting v1 lockfiles to v3, +otherwise maintain current lockfile version.
    • +
    • Type: null, 1, 2, 3, "1", "2", or "3"
    • +
    +

    Set the lockfile format version to be used in package-lock.json and +npm-shrinkwrap-json files. Possible options are:

    +

    1: The lockfile version used by npm versions 5 and 6. Lacks some data that +is used during the install, resulting in slower and possibly less +deterministic installs. Prevents lockfile churn when interoperating with +older npm versions.

    +

    2: The default lockfile version used by npm version 7 and 8. Includes both +the version 1 lockfile data and version 3 lockfile data, for maximum +determinism and interoperability, at the expense of more bytes on disk.

    +

    3: Only the new lockfile information introduced in npm version 7. Smaller on +disk than lockfile version 2, but not interoperable with older npm versions. +Ideal if all users are on npm version 7 and higher.

    +

    loglevel

    +
      +
    • Default: "notice"
    • +
    • Type: "silent", "error", "warn", "notice", "http", "info", "verbose", or +"silly"
    • +
    +

    What level of logs to report. All logs are written to a debug log, with the +path to that file printed if the execution of a command fails.

    +

    Any logs of a higher level than the setting are shown. The default is +"notice".

    +

    See also the foreground-scripts config.

    +

    logs-dir

    +
      +
    • Default: A directory named _logs inside the cache
    • +
    • Type: null or Path
    • +
    +

    The location of npm's log directory. See npm logging +for more information.

    +

    logs-max

    +
      +
    • Default: 10
    • +
    • Type: Number
    • +
    +

    The maximum number of log files to store.

    +

    If set to 0, no log files will be written for the current run.

    +

    long

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Show extended information in ls, search, and help-search.

    +

    maxsockets

    +
      +
    • Default: 15
    • +
    • Type: Number
    • +
    +

    The maximum number of connections to use per origin (protocol/host/port +combination).

    +

    message

    +
      +
    • Default: "%s"
    • +
    • Type: String
    • +
    +

    Commit message which is used by npm version when creating version commit.

    +

    Any "%s" in the message will be replaced with the version number.

    +

    node-options

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    Options to pass through to Node.js via the NODE_OPTIONS environment +variable. This does not impact how npm itself is executed but it does impact +how lifecycle scripts are called.

    +

    noproxy

    +
      +
    • Default: The value of the NO_PROXY environment variable
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Domain extensions that should bypass any proxies.

    +

    Also accepts a comma-delimited string.

    +

    offline

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Force offline mode: no network requests will be done during install. To +allow the CLI to fill in missing cache data, see --prefer-offline.

    +

    omit

    +
      +
    • Default: 'dev' if the NODE_ENV environment variable is set to +'production', otherwise empty.
    • +
    • Type: "dev", "optional", or "peer" (can be set multiple times)
    • +
    +

    Dependency types to omit from the installation tree on disk.

    +

    Note that these dependencies are still resolved and added to the +package-lock.json or npm-shrinkwrap.json file. They are just not +physically installed on disk.

    +

    If a package type appears in both the --include and --omit lists, then +it will be included.

    +

    If the resulting omit list includes 'dev', then the NODE_ENV environment +variable will be set to 'production' for all lifecycle scripts.

    +

    omit-lockfile-registry-resolved

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    This option causes npm to create lock files without a resolved key for +registry dependencies. Subsequent installs will need to resolve tarball +endpoints with the configured registry, likely resulting in a longer install +time.

    +

    os

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    Override OS of native modules to install. Acceptable values are same as os +field of package.json, which comes from process.platform.

    +

    otp

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    +

    This is a one-time password from a two-factor authenticator. It's needed +when publishing or changing package permissions with npm access.

    +

    If not set, and a registry response fails with a challenge for a one-time +password, npm will prompt on the command line for one.

    +

    pack-destination

    +
      +
    • Default: "."
    • +
    • Type: String
    • +
    +

    Directory in which npm pack will save tarballs.

    +

    package

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    The package or packages to install for npm exec

    +

    package-lock

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to false, then ignore package-lock.json files when installing. This +will also prevent writing package-lock.json if save is true.

    +

    package-lock-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, the current operation will only use the package-lock.json, +ignoring node_modules.

    +

    For update this means only the package-lock.json will be updated, +instead of checking node_modules and downloading dependencies.

    +

    For list this means the output will be based on the tree described by the +package-lock.json, rather than the contents of node_modules.

    +

    parseable

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Output parseable results from commands that write to standard output. For +npm search, this will be tab-separated table format.

    +

    prefer-dedupe

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Prefer to deduplicate packages if possible, rather than choosing a newer +version of a dependency.

    +

    prefer-offline

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, staleness checks for cached data will be bypassed, but missing data +will be requested from the server. To force full offline mode, use +--offline.

    +

    prefer-online

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, staleness checks for cached data will be forced, making the CLI +look for updates immediately even for fresh package data.

    +

    prefix

    +
      +
    • Default: In global mode, the folder where the node executable is installed. +Otherwise, the nearest parent folder containing either a package.json file +or a node_modules folder.
    • +
    • Type: Path
    • +
    +

    The location to install global items. If set on the command line, then it +forces non-global commands to run in the specified folder.

    +

    preid

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    The "prerelease identifier" to use as a prefix for the "prerelease" part of +a semver. Like the rc in 1.2.0-rc.8.

    +

    progress

    +
      +
    • Default: true unless running in a known CI system
    • +
    • Type: Boolean
    • +
    +

    When set to true, npm will display a progress bar during time intensive +operations, if process.stderr and process.stdout are a TTY.

    +

    Set to false to suppress the progress bar.

    +

    provenance

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    When publishing from a supported cloud CI/CD system, the package will be +publicly linked to where it was built and published from.

    +

    This config can not be used with: provenance-file

    +

    provenance-file

    +
      +
    • Default: null
    • +
    • Type: Path
    • +
    +

    When publishing, the provenance bundle at the given path will be used.

    +

    This config can not be used with: provenance

    +

    proxy

    +
      +
    • Default: null
    • +
    • Type: null, false, or URL
    • +
    +

    A proxy to use for outgoing http requests. If the HTTP_PROXY or +http_proxy environment variables are set, proxy settings will be honored +by the underlying request library.

    +

    read-only

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    This is used to mark a token as unable to publish when configuring limited +access tokens with the npm token create command.

    +

    rebuild-bundle

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Rebuild bundled dependencies after installation.

    +

    registry

    + +

    The base URL of the npm registry.

    +

    replace-registry-host

    +
      +
    • Default: "npmjs"
    • +
    • Type: "npmjs", "never", "always", or String
    • +
    +

    Defines behavior for replacing the registry host in a lockfile with the +configured registry.

    +

    The default behavior is to replace package dist URLs from the default +registry (https://registry.npmjs.org) to the configured registry. If set to +"never", then use the registry value. If set to "always", then replace the +registry host with the configured host every time.

    +

    You may also specify a bare hostname (e.g., "registry.npmjs.org").

    +

    save

    +
      +
    • Default: true unless when using npm update where it defaults to false
    • +
    • Type: Boolean
    • +
    +

    Save installed packages to a package.json file as dependencies.

    +

    When used with the npm rm command, removes the dependency from +package.json.

    +

    Will also prevent writing to package-lock.json if set to false.

    +

    save-bundle

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If a package would be saved at install time by the use of --save, +--save-dev, or --save-optional, then also put it in the +bundleDependencies list.

    +

    Ignored if --save-peer is set, since peerDependencies cannot be bundled.

    +

    save-dev

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Save installed packages to a package.json file as devDependencies.

    +

    save-exact

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Dependencies saved to package.json will be configured with an exact version +rather than using npm's default semver range operator.

    +

    save-optional

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Save installed packages to a package.json file as optionalDependencies.

    +

    save-peer

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Save installed packages to a package.json file as peerDependencies

    +

    save-prefix

    +
      +
    • Default: "^"
    • +
    • Type: String
    • +
    +

    Configure how versions of packages installed to a package.json file via +--save or --save-dev get prefixed.

    +

    For example if a package has version 1.2.3, by default its version is set +to ^1.2.3 which allows minor upgrades for that package, but after npm config set save-prefix='~' it would be set to ~1.2.3 which only allows +patch upgrades.

    +

    save-prod

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Save installed packages into dependencies specifically. This is useful if +a package already exists in devDependencies or optionalDependencies, but +you want to move it to be a non-optional production dependency.

    +

    This is the default behavior if --save is true, and neither --save-dev +or --save-optional are true.

    +

    sbom-format

    +
      +
    • Default: null
    • +
    • Type: "cyclonedx" or "spdx"
    • +
    +

    SBOM format to use when generating SBOMs.

    +

    sbom-type

    +
      +
    • Default: "library"
    • +
    • Type: "library", "application", or "framework"
    • +
    +

    The type of package described by the generated SBOM. For SPDX, this is the +value for the primaryPackagePurpose field. For CycloneDX, this is the +value for the type field.

    +

    scope

    +
      +
    • Default: the scope of the current project, if any, or ""
    • +
    • Type: String
    • +
    +

    Associate an operation with a scope for a scoped registry.

    +

    Useful when logging in to or out of a private registry:

    +
    # log in, linking the scope to the custom registry
    +npm login --scope=@mycorp --registry=https://registry.mycorp.com
    +
    +# log out, removing the link and the auth token
    +npm logout --scope=@mycorp
    +
    +

    This will cause @mycorp to be mapped to the registry for future +installation of packages specified according to the pattern +@mycorp/package.

    +

    This will also cause npm init to create a scoped package.

    +
    # accept all defaults, and create a package named "@foo/whatever",
    +# instead of just named "whatever"
    +npm init --scope=@foo --yes
    +
    +

    script-shell

    +
      +
    • Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
    • +
    • Type: null or String
    • +
    +

    The shell to use for scripts run with the npm exec, npm run and npm init <package-spec> commands.

    +

    searchexclude

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    Space-separated options that limit the results from search.

    +

    searchlimit

    +
      +
    • Default: 20
    • +
    • Type: Number
    • +
    +

    Number of items to limit search results to. Will not apply at all to legacy +searches.

    +

    searchopts

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    +

    Space-separated options that are always passed to search.

    +

    searchstaleness

    +
      +
    • Default: 900
    • +
    • Type: Number
    • +
    +

    The age of the cache, in seconds, before another registry request is made if +using legacy search endpoint.

    +

    shell

    +
      +
    • Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on +Windows
    • +
    • Type: String
    • +
    +

    The shell to run for the npm explore command.

    +

    sign-git-commit

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, then the npm version command will commit the new package +version using -S to add a signature.

    +

    Note that git requires you to have set up GPG keys in your git configs for +this to work properly.

    +

    sign-git-tag

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, then the npm version command will tag the version using +-s to add a signature.

    +

    Note that git requires you to have set up GPG keys in your git configs for +this to work properly.

    +

    strict-peer-deps

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If set to true, and --legacy-peer-deps is not set, then any +conflicting peerDependencies will be treated as an install failure, even +if npm could reasonably guess the appropriate resolution based on non-peer +dependency relationships.

    +

    By default, conflicting peerDependencies deep in the dependency graph will +be resolved using the nearest non-peer dependency specification, even if +doing so will result in some packages receiving a peer dependency outside +the range set in their package's peerDependencies object.

    +

    When such an override is performed, a warning is printed, explaining the +conflict and the packages involved. If --strict-peer-deps is set, then +this warning is treated as a failure.

    +

    strict-ssl

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Whether or not to do SSL key validation when making requests to the registry +via https.

    +

    See also the ca config.

    +

    tag

    +
      +
    • Default: "latest"
    • +
    • Type: String
    • +
    +

    If you ask npm to install a package and don't tell it a specific version, +then it will install the specified tag.

    +

    It is the tag added to the package@version specified in the npm dist-tag add command, if no explicit tag is given.

    +

    When used by the npm diff command, this is the tag used to fetch the +tarball that will be compared with the local files by default.

    +

    If used in the npm publish command, this is the tag that will be added to +the package submitted to the registry.

    +

    tag-version-prefix

    +
      +
    • Default: "v"
    • +
    • Type: String
    • +
    +

    If set, alters the prefix used when tagging a new version when performing a +version increment using npm version. To remove the prefix altogether, set +it to the empty string: "".

    +

    Because other tools may rely on the convention that npm version tags look +like v1.0.0, only use this property if it is absolutely necessary. In +particular, use care when overriding this setting for public packages.

    +

    timing

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, writes timing information to a process specific json file in the +cache or logs-dir. The file name ends with -timing.json.

    +

    You can quickly view it with this json command line: +cat ~/.npm/_logs/*-timing.json | npm exec -- json -g.

    +

    Timing information will also be reported in the terminal. To suppress this +while still writing the timing file, use --silent.

    +

    umask

    +
      +
    • Default: 0
    • +
    • Type: Octal numeric string in range 0000..0777 (0..511)
    • +
    +

    The "umask" value to use when setting the file creation mode on files and +folders.

    +

    Folders and executables are given a mode which is 0o777 masked against +this value. Other files are given a mode which is 0o666 masked against +this value.

    +

    Note that the underlying system will also apply its own umask value to +files and folders that are created, and npm does not circumvent this, but +rather adds the --umask config to it.

    +

    Thus, the effective default umask value on most POSIX systems is 0o22, +meaning that folders and executables are created with a mode of 0o755 and +other files are created with a mode of 0o644.

    +

    unicode

    +
      +
    • Default: false on windows, true on mac/unix systems with a unicode locale, +as defined by the LC_ALL, LC_CTYPE, or LANG environment variables.
    • +
    • Type: Boolean
    • +
    +

    When set to true, npm uses unicode characters in the tree output. When +false, it uses ascii characters instead of unicode glyphs.

    +

    update-notifier

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    Set to false to suppress the update notification when using an older version +of npm than the latest.

    +

    usage

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    Show short usage output about the command specified.

    +

    user-agent

    +
      +
    • Default: "npm/{npm-version} node/{node-version} {platform} {arch} +workspaces/{workspaces} {ci}"
    • +
    • Type: String
    • +
    +

    Sets the User-Agent request header. The following fields are replaced with +their actual counterparts:

    +
      +
    • {npm-version} - The npm version in use
    • +
    • {node-version} - The Node.js version in use
    • +
    • {platform} - The value of process.platform
    • +
    • {arch} - The value of process.arch
    • +
    • {workspaces} - Set to true if the workspaces or workspace options +are set.
    • +
    • {ci} - The value of the ci-name config, if set, prefixed with ci/, or +an empty string if ci-name is empty.
    • +
    +

    userconfig

    +
      +
    • Default: "~/.npmrc"
    • +
    • Type: Path
    • +
    +

    The location of user-level configuration settings.

    +

    This may be overridden by the npm_config_userconfig environment variable +or the --userconfig command line option, but may not be overridden by +settings in the globalconfig file.

    +

    version

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, output the npm version and exit successfully.

    +

    Only relevant when specified explicitly on the command line.

    +

    versions

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    +

    If true, output the npm version as well as node's process.versions map and +the version in the current working directory's package.json file if one +exists, and exit successfully.

    +

    Only relevant when specified explicitly on the command line.

    +

    viewer

    +
      +
    • Default: "man" on Posix, "browser" on Windows
    • +
    • Type: String
    • +
    +

    The program to use to view help content.

    +

    Set to "browser" to view html help content in the default web browser.

    +

    which

    +
      +
    • Default: null
    • +
    • Type: null or Number
    • +
    +

    If there are multiple funding sources, which 1-indexed source URL to open.

    +

    workspace

    +
      +
    • Default:
    • +
    • Type: String (can be set multiple times)
    • +
    +

    Enable running a command in the context of the configured workspaces of the +current project while filtering by running only the workspaces defined by +this configuration option.

    +

    Valid values for the workspace config are either:

    +
      +
    • Workspace names
    • +
    • Path to a workspace directory
    • +
    • Path to a parent workspace directory (will result in selecting all +workspaces within that folder)
    • +
    +

    When set for the npm init command, this may be set to the folder of a +workspace which does not yet exist, to create the folder and set it up as a +brand new workspace within the project.

    +

    This value is not exported to the environment for child processes.

    +

    workspaces

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Set to true to run the command in the context of all configured +workspaces.

    +

    Explicitly setting this to false will cause commands like install to +ignore workspaces altogether. When not set explicitly:

    +
      +
    • Commands that operate on the node_modules tree (install, update, etc.) +will link workspaces into the node_modules folder. - Commands that do +other things (test, exec, publish, etc.) will operate on the root project, +unless one or more workspaces are specified in the workspace config.
    • +
    +

    This value is not exported to the environment for child processes.

    +

    workspaces-update

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    +

    If set to true, the npm cli will run an update after operations that may +possibly change the workspaces installed to the node_modules folder.

    +

    yes

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    +

    Automatically answer "yes" to any prompts that npm might print on the +command line.

    +

    also

    +
      +
    • Default: null
    • +
    • Type: null, "dev", or "development"
    • +
    • DEPRECATED: Please use --include=dev instead.
    • +
    +

    When set to dev or development, this is an alias for --include=dev.

    +

    cache-max

    +
      +
    • Default: Infinity
    • +
    • Type: Number
    • +
    • DEPRECATED: This option has been deprecated in favor of --prefer-online
    • +
    +

    --cache-max=0 is an alias for --prefer-online

    +

    cache-min

    +
      +
    • Default: 0
    • +
    • Type: Number
    • +
    • DEPRECATED: This option has been deprecated in favor of --prefer-offline.
    • +
    +

    --cache-min=9999 (or bigger) is an alias for --prefer-offline.

    +

    cert

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    • DEPRECATED: key and cert are no longer used for most registry +operations. Use registry scoped keyfile and cafile instead. Example: +//other-registry.tld/:keyfile=/path/to/key.pem +//other-registry.tld/:cafile=/path/to/cert.crt
    • +
    +

    A client certificate to pass when accessing the registry. Values should be +in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with +newlines replaced by the string "\n". For example:

    +
    cert="-----BEGIN CERTIFICATE-----\nXXXX\nXXXX\n-----END CERTIFICATE-----"
    +
    +

    It is not the path to a certificate file, though you can set a +registry-scoped "cafile" path like +"//other-registry.tld/:cafile=/path/to/cert.pem".

    +

    dev

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: Please use --include=dev instead.
    • +
    +

    Alias for --include=dev.

    +

    global-style

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=shallow
    • +
    +

    Only install direct dependencies in the top level node_modules, but hoist +on deeper dependencies. Sets --install-strategy=shallow.

    +

    init.author.email

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    • DEPRECATED: Use --init-author-email instead.
    • +
    +

    Alias for --init-author-email

    +

    init.author.name

    +
      +
    • Default: ""
    • +
    • Type: String
    • +
    • DEPRECATED: Use --init-author-name instead.
    • +
    +

    Alias for --init-author-name

    +

    init.author.url

    +
      +
    • Default: ""
    • +
    • Type: "" or URL
    • +
    • DEPRECATED: Use --init-author-url instead.
    • +
    +

    Alias for --init-author-url

    +

    init.license

    +
      +
    • Default: "ISC"
    • +
    • Type: String
    • +
    • DEPRECATED: Use --init-license instead.
    • +
    +

    Alias for --init-license

    +

    init.module

    +
      +
    • Default: "~/.npm-init.js"
    • +
    • Type: Path
    • +
    • DEPRECATED: Use --init-module instead.
    • +
    +

    Alias for --init-module

    +

    init.version

    +
      +
    • Default: "1.0.0"
    • +
    • Type: SemVer string
    • +
    • DEPRECATED: Use --init-version instead.
    • +
    +

    Alias for --init-version

    +

    key

    +
      +
    • Default: null
    • +
    • Type: null or String
    • +
    • DEPRECATED: key and cert are no longer used for most registry +operations. Use registry scoped keyfile and cafile instead. Example: +//other-registry.tld/:keyfile=/path/to/key.pem +//other-registry.tld/:cafile=/path/to/cert.crt
    • +
    +

    A client key to pass when accessing the registry. Values should be in PEM +format with newlines replaced by the string "\n". For example:

    +
    key="-----BEGIN PRIVATE KEY-----\nXXXX\nXXXX\n-----END PRIVATE KEY-----"
    +
    +

    It is not the path to a key file, though you can set a registry-scoped +"keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem".

    +

    legacy-bundling

    +
      +
    • Default: false
    • +
    • Type: Boolean
    • +
    • DEPRECATED: This option has been deprecated in favor of +--install-strategy=nested
    • +
    +

    Instead of hoisting package installs in node_modules, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets --install-strategy=nested.

    +

    only

    +
      +
    • Default: null
    • +
    • Type: null, "prod", or "production"
    • +
    • DEPRECATED: Use --omit=dev to omit dev dependencies from the install.
    • +
    +

    When set to prod or production, this is an alias for --omit=dev.

    +

    optional

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    • DEPRECATED: Use --omit=optional to exclude optional dependencies, or +--include=optional to include them.
    • +
    +

    Default value does install optional deps unless otherwise omitted.

    +

    Alias for --include=optional or --omit=optional

    +

    production

    +
      +
    • Default: null
    • +
    • Type: null or Boolean
    • +
    • DEPRECATED: Use --omit=dev instead.
    • +
    +

    Alias for --omit=dev

    +

    shrinkwrap

    +
      +
    • Default: true
    • +
    • Type: Boolean
    • +
    • DEPRECATED: Use the --package-lock setting instead.
    • +
    +

    Alias for --package-lock

    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/dependency-selectors.html b/node_modules/npm/docs/output/using-npm/dependency-selectors.html new file mode 100644 index 00000000..db54f7a6 --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/dependency-selectors.html @@ -0,0 +1,356 @@ + + +Dependency Selector Syntax & Querying + + + + + +
    +
    +

    + Dependency Selector Syntax & Querying + @11.0.0 +

    +Dependency Selector Syntax & Querying +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    The npm query command exposes a new dependency selector syntax (informed by & respecting many aspects of the CSS Selectors 4 Spec) which:

    +
      +
    • Standardizes the shape of, & querying of, dependency graphs with a robust object model, metadata & selector syntax
    • +
    • Leverages existing, known language syntax & operators from CSS to make disparate package information broadly accessible
    • +
    • Unlocks the ability to answer complex, multi-faceted questions about dependencies, their relationships & associative metadata
    • +
    • Consolidates redundant logic of similar query commands in npm (ex. npm fund, npm ls, npm outdated, npm audit ...)
    • +
    +

    Dependency Selector Syntax

    +

    Overview:

    +
      +
    • there is no "type" or "tag" selectors (ex. div, h1, a) as a dependency/target is the only type of Node that can be queried
    • +
    • the term "dependencies" is in reference to any Node found in a tree returned by Arborist
    • +
    +

    Combinators

    +
      +
    • > direct descendant/child
    • +
    • any descendant/child
    • +
    • ~ sibling
    • +
    +

    Selectors

    +
      +
    • * universal selector
    • +
    • #<name> dependency selector (equivalent to [name="..."])
    • +
    • #<name>@<version> (equivalent to [name=<name>]:semver(<version>))
    • +
    • , selector list delimiter
    • +
    • . dependency type selector
    • +
    • : pseudo selector
    • +
    +

    Dependency Type Selectors

    +
      +
    • .prod dependency found in the dependencies section of package.json, or is a child of said dependency
    • +
    • .dev dependency found in the devDependencies section of package.json, or is a child of said dependency
    • +
    • .optional dependency found in the optionalDependencies section of package.json, or has "optional": true set in its entry in the peerDependenciesMeta section of package.json, or a child of said dependency
    • +
    • .peer dependency found in the peerDependencies section of package.json
    • +
    • .workspace dependency found in the workspaces section of package.json
    • +
    • .bundled dependency found in the bundleDependencies section of package.json, or is a child of said dependency
    • +
    +

    Pseudo Selectors

    +
      +
    • :not(<selector>)
    • +
    • :has(<selector>)
    • +
    • :is(<selector list>)
    • +
    • :root matches the root node/dependency
    • +
    • :scope matches node/dependency it was queried against
    • +
    • :empty when a dependency has no dependencies
    • +
    • :private when a dependency is private
    • +
    • :link when a dependency is linked (for instance, workspaces or packages manually linked
    • +
    • :deduped when a dependency has been deduped (note that this does not always mean the dependency has been hoisted to the root of node_modules)
    • +
    • :overridden when a dependency has been overridden
    • +
    • :extraneous when a dependency exists but is not defined as a dependency of any node
    • +
    • :invalid when a dependency version is out of its ancestors specified range
    • +
    • :missing when a dependency is not found on disk
    • +
    • :semver(<spec>, [selector], [function]) match a valid node-semver version or range to a selector
    • +
    • :path(<path>) glob matching based on dependencies path relative to the project
    • +
    • :type(<type>) based on currently recognized types
    • +
    • :outdated(<type>) when a dependency is outdated
    • +
    • :vuln(<selector>) when a dependency has a known vulnerability
    • +
    +
    :semver(<spec>, [selector], [function])
    +

    The :semver() pseudo selector allows comparing fields from each node's package.json using semver methods. It accepts up to 3 parameters, all but the first of which are optional.

    +
      +
    • spec a semver version or range
    • +
    • selector an attribute selector for each node (default [version])
    • +
    • function a semver method to apply, one of: satisfies, intersects, subset, gt, gte, gtr, lt, lte, ltr, eq, neq or the special function infer (default infer)
    • +
    +

    When the special infer function is used the spec and the actual value from the node are compared. If both are versions, according to semver.valid(), eq is used. If both values are ranges, according to !semver.valid(), intersects is used. If the values are mixed types satisfies is used.

    +

    Some examples:

    +
      +
    • :semver(^1.0.0) returns every node that has a version satisfied by the provided range ^1.0.0
    • +
    • :semver(16.0.0, :attr(engines, [node])) returns every node which has an engines.node property satisfying the version 16.0.0
    • +
    • :semver(1.0.0, [version], lt) every node with a version less than 1.0.0
    • +
    +
    :outdated(<type>)
    +

    The :outdated pseudo selector retrieves data from the registry and returns information about which of your dependencies are outdated. The type parameter may be one of the following:

    +
      +
    • any (default) a version exists that is greater than the current one
    • +
    • in-range a version exists that is greater than the current one, and satisfies at least one if its parent's dependencies
    • +
    • out-of-range a version exists that is greater than the current one, does not satisfy at least one of its parent's dependencies
    • +
    • major a version exists that is a semver major greater than the current one
    • +
    • minor a version exists that is a semver minor greater than the current one
    • +
    • patch a version exists that is a semver patch greater than the current one
    • +
    +

    In addition to the filtering performed by the pseudo selector, some extra data is added to the resulting objects. The following data can be found under the queryContext property of each node.

    +
      +
    • versions an array of every available version of the given node
    • +
    • outdated.inRange an array of objects, each with a from and versions, where from is the on-disk location of the node that depends on the current node and versions is an array of all available versions that satisfies that dependency. This is only populated if :outdated(in-range) is used.
    • +
    • outdated.outOfRange an array of objects, identical in shape to inRange, but where the versions array is every available version that does not satisfy the dependency. This is only populated if :outdated(out-of-range) is used.
    • +
    +

    Some examples:

    +
      +
    • :root > :outdated(major) returns every direct dependency that has a new semver major release
    • +
    • .prod:outdated(in-range) returns production dependencies that have a new release that satisfies at least one of its parent's dependencies
    • +
    +
    :vuln
    +

    The :vuln pseudo selector retrieves data from the registry and returns information about which if your dependencies has a known vulnerability. Only dependencies whose current version matches a vulnerability will be returned. For example if you have semver@7.6.0 in your tree, a vulnerability for semver which affects versions <=6.3.1 will not match.

    +

    You can also filter results by certain attributes in advisories. Currently that includes severity and cwe. Note that severity filtering is done per severity, it does not include severities "higher" or "lower" than the one specified.

    +

    In addition to the filtering performed by the pseudo selector, info about each relevant advisory will be added to the queryContext attribute of each node under the advisories attribute.

    +

    Some examples:

    +
      +
    • :root > .prod:vuln returns direct production dependencies with any known vulnerability
    • +
    • :vuln([severity=high]) returns only dependencies with a vulnerability with a high severity.
    • +
    • :vuln([severity=high],[severity=moderate]) returns only dependencies with a vulnerability with a high or moderate severity.
    • +
    • :vuln([cwe=1333]) returns only dependencies with a vulnerability that includes CWE-1333 (ReDoS)
    • +
    +

    Attribute Selectors

    +

    The attribute selector evaluates the key/value pairs in package.json if they are Strings.

    +
      +
    • [] attribute selector (ie. existence of attribute)
    • +
    • [attribute=value] attribute value is equivalent...
    • +
    • [attribute~=value] attribute value contains word...
    • +
    • [attribute*=value] attribute value contains string...
    • +
    • [attribute|=value] attribute value is equal to or starts with...
    • +
    • [attribute^=value] attribute value starts with...
    • +
    • [attribute$=value] attribute value ends with...
    • +
    +

    Array & Object Attribute Selectors

    +

    The generic :attr() pseudo selector standardizes a pattern which can be used for attribute selection of Objects, Arrays or Arrays of Objects accessible via Arborist's Node.package metadata. This allows for iterative attribute selection beyond top-level String evaluation. The last argument passed to :attr() must be an attribute selector or a nested :attr(). See examples below:

    +

    Objects

    +
    /* return dependencies that have a `scripts.test` containing `"tap"` */
    +*:attr(scripts, [test~=tap])
    +
    +

    Nested Objects

    +

    Nested objects are expressed as sequential arguments to :attr().

    +
    /* return dependencies that have a testling config for opera browsers */
    +*:attr(testling, browsers, [~=opera])
    +
    +

    Arrays

    +

    Arrays specifically uses a special/reserved . character in place of a typical attribute name. Arrays also support exact value matching when a String is passed to the selector.

    +
    Example of an Array Attribute Selection:
    +
    /* removes the distinction between properties & arrays */
    +/* ie. we'd have to check the property & iterate to match selection */
    +*:attr([keywords^=react])
    +*:attr(contributors, :attr([name~=Jordan]))
    +
    +
    Example of an Array matching directly to a value:
    +
    /* return dependencies that have the exact keyword "react" */
    +/* this is equivalent to `*:keywords([value="react"])` */
    +*:attr([keywords=react])
    +
    +
    Example of an Array of Objects:
    +
    /* returns */
    +*:attr(contributors, [email=ruyadorno@github.com])
    +
    +

    Groups

    +

    Dependency groups are defined by the package relationships to their ancestors (ie. the dependency types that are defined in package.json). This approach is user-centric as the ecosystem has been taught to think about dependencies in these groups first-and-foremost. Dependencies are allowed to be included in multiple groups (ex. a prod dependency may also be a dev dependency (in that it's also required by another dev dependency) & may also be bundled - a selector for that type of dependency would look like: *.prod.dev.bundled).

    +
      +
    • .prod
    • +
    • .dev
    • +
    • .optional
    • +
    • .peer
    • +
    • .bundled
    • +
    • .workspace
    • +
    +

    Please note that currently workspace deps are always prod dependencies. Additionally the .root dependency is also considered a prod dependency.

    +

    Programmatic Usage

    +
      +
    • Arborist's Node Class has a .querySelectorAll() method +
        +
      • this method will return a filtered, flattened dependency Arborist Node list based on a valid query selector
      • +
      +
    • +
    +
    const Arborist = require('@npmcli/arborist')
    +const arb = new Arborist({})
    +
    +
    // root-level
    +arb.loadActual().then(async (tree) => {
    +  // query all production dependencies
    +  const results = await tree.querySelectorAll('.prod')
    +  console.log(results)
    +})
    +
    +
    // iterative
    +arb.loadActual().then(async (tree) => {
    +  // query for the deduped version of react
    +  const results = await tree.querySelectorAll('#react:not(:deduped)')
    +  // query the deduped react for git deps
    +  const deps = await results[0].querySelectorAll(':type(git)')
    +  console.log(deps)
    +})
    +
    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/developers.html b/node_modules/npm/docs/output/using-npm/developers.html new file mode 100644 index 00000000..bc147951 --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/developers.html @@ -0,0 +1,362 @@ + + +developers + + + + + +
    +
    +

    + developers + @11.0.0 +

    +Developer Guide +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    So, you've decided to use npm to develop (and maybe publish/deploy) +your project.

    +

    Fantastic!

    +

    There are a few things that you need to do above the simple steps +that your users will do to install your program.

    +

    About These Documents

    +

    These are man pages. If you install npm, you should be able to +then do man npm-thing to get the documentation on a particular +topic, or npm help thing to see the same information.

    +

    What is a Package

    +

    A package is:

    +
      +
    • a) a folder containing a program described by a package.json file
    • +
    • b) a gzipped tarball containing (a)
    • +
    • c) a url that resolves to (b)
    • +
    • d) a <name>@<version> that is published on the registry with (c)
    • +
    • e) a <name>@<tag> that points to (d)
    • +
    • f) a <name> that has a "latest" tag satisfying (e)
    • +
    • g) a git url that, when cloned, results in (a).
    • +
    +

    Even if you never publish your package, you can still get a lot of +benefits of using npm if you just want to write a node program (a), and +perhaps if you also want to be able to easily install it elsewhere +after packing it up into a tarball (b).

    +

    Git urls can be of the form:

    +
    git://github.com/user/project.git#commit-ish
    +git+ssh://user@hostname:project.git#commit-ish
    +git+http://user@hostname/project/blah.git#commit-ish
    +git+https://user@hostname/project/blah.git#commit-ish
    +
    +

    The commit-ish can be any tag, sha, or branch which can be supplied as +an argument to git checkout. The default is whatever the repository uses +as its default branch.

    +

    The package.json File

    +

    You need to have a package.json file in the root of your project to do +much of anything with npm. That is basically the whole interface.

    +

    See package.json for details about what +goes in that file. At the very least, you need:

    +
      +
    • +

      name: This should be a string that identifies your project. Please do +not use the name to specify that it runs on node, or is in JavaScript. +You can use the "engines" field to explicitly state the versions of node +(or whatever else) that your program requires, and it's pretty well +assumed that it's JavaScript.

      +

      It does not necessarily need to match your github repository name.

      +

      So, node-foo and bar-js are bad names. foo or bar are better.

      +
    • +
    • +

      version: A semver-compatible version.

      +
    • +
    • +

      engines: Specify the versions of node (or whatever else) that your +program runs on. The node API changes a lot, and there may be bugs or +new functionality that you depend on. Be explicit.

      +
    • +
    • +

      author: Take some credit.

      +
    • +
    • +

      scripts: If you have a special compilation or installation script, then +you should put it in the scripts object. You should definitely have at +least a basic smoke-test command as the "scripts.test" field. See +scripts.

      +
    • +
    • +

      main: If you have a single module that serves as the entry point to your +program (like what the "foo" package gives you at require("foo")), then +you need to specify that in the "main" field.

      +
    • +
    • +

      directories: This is an object mapping names to folders. The best ones +to include are "lib" and "doc", but if you use "man" to specify a folder +full of man pages, they'll get installed just like these ones.

      +
    • +
    +

    You can use npm init in the root of your package in order to get you +started with a pretty basic package.json file. See npm init for more info.

    +

    Keeping files out of your Package

    +

    Use a .npmignore file to keep stuff out of your package. If there's no +.npmignore file, but there is a .gitignore file, then npm will ignore +the stuff matched by the .gitignore file. If you want to include +something that is excluded by your .gitignore file, you can create an +empty .npmignore file to override it. Like git, npm looks for +.npmignore and .gitignore files in all subdirectories of your package, +not only the root directory.

    +

    .npmignore files follow the same pattern +rules +as .gitignore files:

    +
      +
    • Blank lines or lines starting with # are ignored.
    • +
    • Standard glob patterns work.
    • +
    • You can end patterns with a forward slash / to specify a directory.
    • +
    • You can negate a pattern by starting it with an exclamation point !.
    • +
    +

    By default, some paths and files are ignored, so there's no +need to add them to .npmignore explicitly. Some examples are:

    +
      +
    • .*.swp
    • +
    • ._*
    • +
    • .DS_Store
    • +
    • .git
    • +
    • .gitignore
    • +
    • .hg
    • +
    • .npmignore
    • +
    • .npmrc
    • +
    • .lock-wscript
    • +
    • .svn
    • +
    • .wafpickle-*
    • +
    • config.gypi
    • +
    • CVS
    • +
    • npm-debug.log
    • +
    +

    Additionally, everything in node_modules is ignored, except for +bundled dependencies. npm automatically handles this for you, so don't +bother adding node_modules to .npmignore.

    +

    The following paths and files are never ignored, so adding them to +.npmignore is pointless:

    +
      +
    • package.json
    • +
    • README (and its variants)
    • +
    • CHANGELOG (and its variants)
    • +
    • LICENSE / LICENCE
    • +
    +

    If, given the structure of your project, you find .npmignore to be a +maintenance headache, you might instead try populating the files +property of package.json, which is an array of file or directory names +that should be included in your package. Sometimes manually picking +which items to allow is easier to manage than building a block list.

    +

    See package.json for more info on +what can and can't be ignored.

    +

    Testing whether your .npmignore or files config works

    +

    If you want to double check that your package will include only the files +you intend it to when published, you can run the npm pack command locally +which will generate a tarball in the working directory, the same way it +does for publishing.

    + +

    npm link is designed to install a development package and see the +changes in real time without having to keep re-installing it. (You do +need to either re-link or npm rebuild -g to update compiled packages, +of course.)

    +

    More info at npm link.

    +

    Before Publishing: Make Sure Your Package Installs and Works

    +

    This is important.

    +

    If you can not install it locally, you'll have +problems trying to publish it. Or, worse yet, you'll be able to +publish it, but you'll be publishing a broken or pointless package. +So don't do that.

    +

    In the root of your package, do this:

    +
    npm install . -g
    +
    +

    That'll show you that it's working. If you'd rather just create a symlink +package that points to your working directory, then do this:

    +
    npm link
    +
    +

    Use npm ls -g to see if it's there.

    +

    To test a local install, go into some other folder, and then do:

    +
    cd ../some-other-folder
    +npm install ../my-package
    +
    +

    to install it locally into the node_modules folder in that other place.

    +

    Then go into the node-repl, and try using require("my-thing") to +bring in your module's main module.

    +

    Create a User Account

    +

    Create a user with the adduser command. It works like this:

    +
    npm adduser
    +
    +

    and then follow the prompts.

    +

    This is documented better in npm adduser.

    +

    Publish your Package

    +

    This part's easy. In the root of your folder, do this:

    +
    npm publish
    +
    +

    You can give publish a url to a tarball, or a filename of a tarball, +or a path to a folder.

    +

    Note that pretty much everything in that folder will be exposed +by default. So, if you have secret stuff in there, use a +.npmignore file to list out the globs to ignore, or publish +from a fresh checkout.

    +

    Brag about it

    +

    Send emails, write blogs, blab in IRC.

    +

    Tell the world how easy it is to install your program!

    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/logging.html b/node_modules/npm/docs/output/using-npm/logging.html new file mode 100644 index 00000000..47604373 --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/logging.html @@ -0,0 +1,236 @@ + + +Logging + + + + + +
    +
    +

    + Logging + @11.0.0 +

    +Why, What & How We Log +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    The npm CLI has various mechanisms for showing different levels of information back to end-users for certain commands, configurations & environments.

    +

    Setting Log File Location

    +

    All logs are written to a debug log, with the path to that file printed if the execution of a command fails.

    +

    The default location of the logs directory is a directory named _logs inside the npm cache. This can be changed with the logs-dir config option.

    +

    For example, if you wanted to write all your logs to the current working directory, you could run: npm install --logs-dir=.. This is especially helpful in debugging a specific npm issue as you can run +a command multiple times with different config values and then diff all the log files.

    +

    Log files will be removed from the logs-dir when the number of log files exceeds logs-max, with the oldest logs being deleted first.

    +

    To turn off logs completely set --logs-max=0.

    +

    Setting Log Levels

    +

    loglevel

    +

    loglevel is a global argument/config that can be set to determine the type of information to be displayed.

    +

    The default value of loglevel is "notice" but there are several levels/types of logs available, including:

    +
      +
    • "silent"
    • +
    • "error"
    • +
    • "warn"
    • +
    • "notice"
    • +
    • "http"
    • +
    • "info"
    • +
    • "verbose"
    • +
    • "silly"
    • +
    +

    All logs pertaining to a level proceeding the current setting will be shown.

    +
    Aliases
    +

    The log levels listed above have various corresponding aliases, including:

    +
      +
    • -d: --loglevel info
    • +
    • --dd: --loglevel verbose
    • +
    • --verbose: --loglevel verbose
    • +
    • --ddd: --loglevel silly
    • +
    • -q: --loglevel warn
    • +
    • --quiet: --loglevel warn
    • +
    • -s: --loglevel silent
    • +
    • --silent: --loglevel silent
    • +
    +

    foreground-scripts

    +

    The npm CLI began hiding the output of lifecycle scripts for npm install as of v7. Notably, this means you will not see logs/output from packages that may be using "install scripts" to display information back to you or from your own project's scripts defined in package.json. If you'd like to change this behavior & log this output you can set foreground-scripts to true.

    +

    Timing Information

    +

    The --timing config can be set which does a few +things:

    +
      +
    1. Always shows the full path to the debug log regardless of command exit status
    2. +
    3. Write timing information to a process specific timing file in the cache or logs-dir
    4. +
    5. Output timing information to the terminal
    6. +
    +

    This file contains a timers object where the keys are an identifier for the +portion of the process being timed and the value is the number of milliseconds it took to complete.

    +

    Sometimes it is helpful to get timing information without outputting anything to the terminal. For +example, the performance might be affected by writing to the terminal. In this case you can use +--timing --silent which will still write the timing file, but not output anything to the terminal +while running.

    +

    Registry Response Headers

    +

    npm-notice

    +

    The npm CLI reads from & logs any npm-notice headers that are returned from the configured registry. This mechanism can be used by third-party registries to provide useful information when network-dependent requests occur.

    +

    This header is not cached, and will not be logged if the request is served from the cache.

    +

    Logs and Sensitive Information

    +

    The npm CLI makes a best effort to redact the following from terminal output and log files:

    +
      +
    • Passwords inside basic auth URLs
    • +
    • npm tokens
    • +
    +

    However, this behavior should not be relied on to keep all possible sensitive information redacted. If you are concerned about secrets in your log file or terminal output, you can use --loglevel=silent and --logs-max=0 to ensure no logs are written to your terminal or filesystem.

    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/orgs.html b/node_modules/npm/docs/output/using-npm/orgs.html new file mode 100644 index 00000000..68264d66 --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/orgs.html @@ -0,0 +1,244 @@ + + +orgs + + + + + +
    +
    +

    + orgs + @11.0.0 +

    +Working with Teams & Orgs +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    There are three levels of org users:

    +
      +
    1. Super admin, controls billing & adding people to the org.
    2. +
    3. Team admin, manages team membership & package access.
    4. +
    5. Developer, works on packages they are given access to.
    6. +
    +

    The super admin is the only person who can add users to the org because it impacts the monthly bill. The super admin will use the website to manage membership. Every org has a developers team that all users are automatically added to.

    +

    The team admin is the person who manages team creation, team membership, and package access for teams. The team admin grants package access to teams, not individuals.

    +

    The developer will be able to access packages based on the teams they are on. Access is either read-write or read-only.

    +

    There are two main commands:

    +
      +
    1. npm team see npm team for more details
    2. +
    3. npm access see npm access for more details
    4. +
    +

    Team Admins create teams

    +
      +
    • Check who you’ve added to your org:
    • +
    +
    npm team ls <org>:developers
    +
    +
      +
    • +

      Each org is automatically given a developers team, so you can see the whole list of team members in your org. This team automatically gets read-write access to all packages, but you can change that with the access command.

      +
    • +
    • +

      Create a new team:

      +
    • +
    +
    npm team create <org:team>
    +
    +
      +
    • Add members to that team:
    • +
    +
    npm team add <org:team> <user>
    +
    +

    Publish a package and adjust package access

    +
      +
    • In package directory, run
    • +
    +
    npm init --scope=<org>
    +
    +

    to scope it for your org & publish as usual

    +
      +
    • Grant access:
    • +
    +
    npm access grant <read-only|read-write> <org:team> [<package>]
    +
    +
      +
    • Revoke access:
    • +
    +
    npm access revoke <org:team> [<package>]
    +
    +

    Monitor your package access

    +
      +
    • See what org packages a team member can access:
    • +
    +
    npm access ls-packages <org> <user>
    +
    +
      +
    • See packages available to a specific team:
    • +
    +
    npm access ls-packages <org:team>
    +
    +
      +
    • Check which teams are collaborating on a package:
    • +
    +
    npm access ls-collaborators <pkg>
    +
    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/package-spec.html b/node_modules/npm/docs/output/using-npm/package-spec.html new file mode 100644 index 00000000..b23958ad --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/package-spec.html @@ -0,0 +1,263 @@ + + +package-spec + + + + + +
    +
    +

    + package-spec + @11.0.0 +

    +Package name specifier +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    Commands like npm install and the dependency sections in the +package.json use a package name specifier. This can be many different +things that all refer to a "package". Examples include a package name, +git url, tarball, or local directory. These will generally be referred +to as <package-spec> in the help output for the npm commands that use +this package name specifier.

    +

    Package name

    +
      +
    • [<@scope>/]<pkg>
    • +
    • [<@scope>/]<pkg>@<tag>
    • +
    • [<@scope>/]<pkg>@<version>
    • +
    • [<@scope>/]<pkg>@<version range>
    • +
    +

    Refers to a package by name, with or without a scope, and optionally +tag, version, or version range. This is typically used in combination +with the registry config to refer to a +package in a registry.

    +

    Examples:

    +
      +
    • npm
    • +
    • @npmcli/arborist
    • +
    • @npmcli/arborist@latest
    • +
    • npm@6.13.1
    • +
    • npm@^4.0.0
    • +
    +

    Aliases

    +
      +
    • <alias>@npm:<name>
    • +
    +

    Primarily used by commands like npm install and in the dependency +sections in the package.json, this refers to a package by an alias. +The <alias> is the name of the package as it is reified in the +node_modules folder, and the <name> refers to a package name as +found in the configured registry.

    +

    See Package name above for more info on referring to a package by +name, and registry for configuring which +registry is used when referring to a package by name.

    +

    Examples:

    +
      +
    • semver:@npm:@npmcli/semver-with-patch
    • +
    • semver:@npm:semver@7.2.2
    • +
    • semver:@npm:semver@legacy
    • +
    +

    Folders

    +
      +
    • <folder>
    • +
    +

    This refers to a package on the local filesystem. Specifically this is +a folder with a package.json file in it. This should always be +prefixed with a / or ./ (or your OS equivalent) to reduce confusion. +npm currently will parse a string with more than one / in it as a +folder, but this is legacy behavior that may be removed in a future +version.

    +

    Examples:

    +
      +
    • ./my-package
    • +
    • /opt/npm/my-package
    • +
    +

    Tarballs

    +
      +
    • <tarball file>
    • +
    • <tarball url>
    • +
    +

    Examples:

    +
      +
    • ./my-package.tgz
    • +
    • https://registry.npmjs.org/semver/-/semver-1.0.0.tgz
    • +
    +

    Refers to a package in a tarball format, either on the local filesystem +or remotely via url. This is the format that packages exist in when +uploaded to a registry.

    +

    git urls

    +
      +
    • <git:// url>
    • +
    • <github username>/<github project>
    • +
    +

    Refers to a package in a git repo. This can be a full git url, git +shorthand, or a username/package on GitHub. You can specify a +git tag, branch, or other git ref by appending #ref.

    +

    Examples:

    +
      +
    • https://github.com/npm/cli.git
    • +
    • git@github.com:npm/cli.git
    • +
    • git+ssh://git@github.com/npm/cli#v6.0.0
    • +
    • github:npm/cli#HEAD
    • +
    • npm/cli#c12ea07
    • +
    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/registry.html b/node_modules/npm/docs/output/using-npm/registry.html new file mode 100644 index 00000000..1ab0e032 --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/registry.html @@ -0,0 +1,234 @@ + + +registry + + + + + +
    +
    +

    + registry + @11.0.0 +

    +The JavaScript Package Registry +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    To resolve packages by name and version, npm talks to a registry website +that implements the CommonJS Package Registry specification for reading +package info.

    +

    npm is configured to use the npm public registry at +https://registry.npmjs.org by default. Use of the npm public registry is +subject to terms of use available at https://docs.npmjs.com/policies/terms.

    +

    You can configure npm to use any compatible registry you like, and even run +your own registry. Use of someone else's registry may be governed by their +terms of use.

    +

    npm's package registry implementation supports several +write APIs as well, to allow for publishing packages and managing user +account information.

    +

    The npm public registry is powered by a CouchDB database, +of which there is a public mirror at https://skimdb.npmjs.com/registry.

    +

    The registry URL used is determined by the scope of the package (see +scope. If no scope is specified, the default registry is +used, which is supplied by the registry config +parameter. See npm config, +npmrc, and config for more on +managing npm's configuration. +Authentication configuration such as auth tokens and certificates are configured +specifically scoped to an individual registry. See +Auth Related Configuration

    +

    When the default registry is used in a package-lock or shrinkwrap it has the +special meaning of "the currently configured registry". If you create a lock +file while using the default registry you can switch to another registry and +npm will install packages from the new registry, but if you create a lock +file while using a custom registry packages will be installed from that +registry even after you change to another registry.

    +

    Does npm send any information about me back to the registry?

    +

    Yes.

    +

    When making requests of the registry npm adds two headers with information +about your environment:

    +
      +
    • Npm-Scope – If your project is scoped, this header will contain its +scope. In the future npm hopes to build registry features that use this +information to allow you to customize your experience for your +organization.
    • +
    • Npm-In-CI – Set to "true" if npm believes this install is running in a +continuous integration environment, "false" otherwise. This is detected by +looking for the following environment variables: CI, TDDIUM, +JENKINS_URL, bamboo.buildKey. If you'd like to learn more you may find +the original PR +interesting. +This is used to gather better metrics on how npm is used by humans, versus +build farms.
    • +
    +

    The npm registry does not try to correlate the information in these headers +with any authenticated accounts that may be used in the same requests.

    +

    How can I prevent my package from being published in the official registry?

    +

    Set "private": true in your package.json to prevent it from being +published at all, or +"publishConfig":{"registry":"http://my-internal-registry.local"} +to force it to be published only to your internal/private registry.

    +

    See package.json for more info on what goes in the package.json file.

    +

    Where can I find my (and others') published packages?

    +

    https://www.npmjs.com/

    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/removal.html b/node_modules/npm/docs/output/using-npm/removal.html new file mode 100644 index 00000000..8645555c --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/removal.html @@ -0,0 +1,205 @@ + + +removal + + + + + +
    +
    +

    + removal + @11.0.0 +

    +Cleaning the Slate +
    + +
    +

    Table of contents

    + +
    + +

    Synopsis

    +

    So sad to see you go.

    +
    sudo npm uninstall npm -g
    +
    +

    Or, if that fails, please proceed to more severe uninstalling methods.

    +

    More Severe Uninstalling

    +

    Usually, the above instructions are sufficient. That will remove +npm, but leave behind anything you've installed.

    +

    If that doesn't work, or if you require more drastic measures, +continue reading.

    +

    Note that this is only necessary for globally-installed packages. Local +installs are completely contained within a project's node_modules +folder. Delete that folder, and everything is gone unless a package's +install script is particularly ill-behaved.

    +

    This assumes that you installed node and npm in the default place. If +you configured node with a different --prefix, or installed npm with a +different prefix setting, then adjust the paths accordingly, replacing +/usr/local with your install prefix.

    +

    To remove everything npm-related manually:

    +
    rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
    +
    +

    If you installed things with npm, then your best bet is to uninstall +them with npm first, and then install them again once you have a +proper install. This can help find any symlinks that are lying +around:

    +
    ls -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm
    +
    +

    Prior to version 0.3, npm used shim files for executables and node +modules. To track those down, you can do the following:

    +
    find /usr/local/{lib/node,bin} -exec grep -l npm \{\} \; ;
    +
    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/scope.html b/node_modules/npm/docs/output/using-npm/scope.html new file mode 100644 index 00000000..ff185113 --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/scope.html @@ -0,0 +1,265 @@ + + +scope + + + + + +
    +
    +

    + scope + @11.0.0 +

    +Scoped packages +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    All npm packages have a name. Some package names also have a scope. A scope +follows the usual rules for package names (URL-safe characters, no leading dots +or underscores). When used in package names, scopes are preceded by an @ symbol +and followed by a slash, e.g.

    +
    @somescope/somepackagename
    +
    +

    Scopes are a way of grouping related packages together, and also affect a few +things about the way npm treats the package.

    +

    Each npm user/organization has their own scope, and only you can add packages +in your scope. This means you don't have to worry about someone taking your +package name ahead of you. Thus it is also a good way to signal official packages +for organizations.

    +

    Scoped packages can be published and installed as of npm@2 and are supported +by the primary npm registry. Unscoped packages can depend on scoped packages and +vice versa. The npm client is backwards-compatible with unscoped registries, +so it can be used to work with scoped and unscoped registries at the same time.

    +

    Installing scoped packages

    +

    Scoped packages are installed to a sub-folder of the regular installation +folder, e.g. if your other packages are installed in node_modules/packagename, +scoped modules will be installed in node_modules/@myorg/packagename. The scope +folder (@myorg) is simply the name of the scope preceded by an @ symbol, and can +contain any number of scoped packages.

    +

    A scoped package is installed by referencing it by name, preceded by an +@ symbol, in npm install:

    +
    npm install @myorg/mypackage
    +
    +

    Or in package.json:

    +
    "dependencies": {
    +  "@myorg/mypackage": "^1.3.0"
    +}
    +
    +

    Note that if the @ symbol is omitted, in either case, npm will instead attempt to +install from GitHub; see npm install.

    +

    Requiring scoped packages

    +

    Because scoped packages are installed into a scope folder, you have to +include the name of the scope when requiring them in your code, e.g.

    +
    require('@myorg/mypackage')
    +
    +

    There is nothing special about the way Node treats scope folders. This +simply requires the mypackage module in the folder named @myorg.

    +

    Publishing scoped packages

    +

    Scoped packages can be published from the CLI as of npm@2 and can be +published to any registry that supports them, including the primary npm +registry.

    +

    (As of 2015-04-19, and with npm 2.0 or better, the primary npm registry +does support scoped packages.)

    +

    If you wish, you may associate a scope with a registry; see below.

    +

    Publishing public scoped packages to the primary npm registry

    +

    Publishing to a scope, you have two options:

    +
      +
    • Publishing to your user scope (example: @username/module)
    • +
    • Publishing to an organization scope (example: @org/module)
    • +
    +

    If publishing a public module to an organization scope, you must +first either create an organization with the name of the scope +that you'd like to publish to or be added to an existing organization +with the appropriate permissions. For example, if you'd like to +publish to @org, you would need to create the org organization +on npmjs.com prior to trying to publish.

    +

    Scoped packages are not public by default. You will need to specify +--access public with the initial npm publish command. This will publish +the package and set access to public as if you had run npm access public +after publishing. You do not need to do this when publishing new versions of +an existing scoped package.

    +

    Publishing private scoped packages to the npm registry

    +

    To publish a private scoped package to the npm registry, you must have +an npm Private Modules +account.

    +

    You can then publish the module with npm publish or npm publish --access restricted, and it will be present in the npm registry, with +restricted access. You can then change the access permissions, if +desired, with npm access or on the npmjs.com website.

    +

    Associating a scope with a registry

    +

    Scopes can be associated with a separate registry. This allows you to +seamlessly use a mix of packages from the primary npm registry and one or more +private registries, such as GitHub Packages or the open source Verdaccio +project.

    +

    You can associate a scope with a registry at login, e.g.

    +
    npm login --registry=http://reg.example.com --scope=@myco
    +
    +

    Scopes have a many-to-one relationship with registries: one registry can +host multiple scopes, but a scope only ever points to one registry.

    +

    You can also associate a scope with a registry using npm config:

    +
    npm config set @myco:registry=http://reg.example.com
    +
    +

    Once a scope is associated with a registry, any npm install for a package +with that scope will request packages from that registry instead. Any +npm publish for a package name that contains the scope will be published to +that registry instead.

    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/scripts.html b/node_modules/npm/docs/output/using-npm/scripts.html new file mode 100644 index 00000000..33067cbd --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/scripts.html @@ -0,0 +1,485 @@ + + +scripts + + + + + +
    +
    +

    + scripts + @11.0.0 +

    +How npm handles the "scripts" field +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    The "scripts" property of your package.json file supports a number +of built-in scripts and their preset life cycle events as well as +arbitrary scripts. These all can be executed by running +npm run-script <stage> or npm run <stage> for short. Pre and post +commands with matching names will be run for those as well (e.g. premyscript, +myscript, postmyscript). Scripts from dependencies can be run with +npm explore <pkg> -- npm run <stage>.

    +

    Pre & Post Scripts

    +

    To create "pre" or "post" scripts for any scripts defined in the +"scripts" section of the package.json, simply create another script +with a matching name and add "pre" or "post" to the beginning of them.

    +
    {
    +  "scripts": {
    +    "precompress": "{{ executes BEFORE the `compress` script }}",
    +    "compress": "{{ run command to compress files }}",
    +    "postcompress": "{{ executes AFTER `compress` script }}"
    +  }
    +}
    +
    +

    In this example npm run compress would execute these scripts as +described.

    +

    Life Cycle Scripts

    +

    There are some special life cycle scripts that happen only in certain +situations. These scripts happen in addition to the pre<event>, post<event>, and +<event> scripts.

    +
      +
    • prepare, prepublish, prepublishOnly, prepack, postpack, dependencies
    • +
    +

    prepare (since npm@4.0.0)

    +
      +
    • +

      Runs BEFORE the package is packed, i.e. during npm publish +and npm pack

      +
    • +
    • +

      Runs on local npm install without any arguments

      +
    • +
    • +

      Runs AFTER prepublish, but BEFORE prepublishOnly

      +
    • +
    • +

      NOTE: If a package being installed through git contains a prepare +script, its dependencies and devDependencies will be installed, and +the prepare script will be run, before the package is packaged and +installed.

      +
    • +
    • +

      As of npm@7 these scripts run in the background. +To see the output, run with: --foreground-scripts.

      +
    • +
    +

    prepublish (DEPRECATED)

    +
      +
    • Does not run during npm publish, but does run during npm ci +and npm install. See below for more info.
    • +
    +

    prepublishOnly

    +
      +
    • Runs BEFORE the package is prepared and packed, ONLY on npm publish.
    • +
    +

    prepack

    +
      +
    • Runs BEFORE a tarball is packed (on "npm pack", "npm publish", and when installing a git dependency).
    • +
    • NOTE: "npm run pack" is NOT the same as "npm pack". "npm run pack" is an arbitrary user defined script name, where as, "npm pack" is a CLI defined command.
    • +
    +

    postpack

    +
      +
    • Runs AFTER the tarball has been generated but before it is moved to its final destination (if at all, publish does not save the tarball locally)
    • +
    +

    dependencies

    +
      +
    • Runs AFTER any operations that modify the node_modules directory IF changes occurred.
    • +
    • Does NOT run in global mode
    • +
    +

    Prepare and Prepublish

    +

    Deprecation Note: prepublish

    +

    Since npm@1.1.71, the npm CLI has run the prepublish script for both npm publish and npm install, because it's a convenient way to prepare a package for use (some common use cases are described in the section below). It has also turned out to be, in practice, very confusing. As of npm@4.0.0, a new event has been introduced, prepare, that preserves this existing behavior. A new event, prepublishOnly has been added as a transitional strategy to allow users to avoid the confusing behavior of existing npm versions and only run on npm publish (for instance, running the tests one last time to ensure they're in good shape).

    +

    See https://github.com/npm/npm/issues/10074 for a much lengthier justification, with further reading, for this change.

    +

    Use Cases

    +

    If you need to perform operations on your package before it is used, in a way that is not dependent on the operating system or architecture of the target system, use a prepublish script. This includes tasks such as:

    +
      +
    • Compiling CoffeeScript source code into JavaScript.
    • +
    • Creating minified versions of JavaScript source code.
    • +
    • Fetching remote resources that your package will use.
    • +
    +

    The advantage of doing these things at prepublish time is that they can be done once, in a single place, thus reducing complexity and variability. Additionally, this means that:

    +
      +
    • You can depend on coffee-script as a devDependency, and thus +your users don't need to have it installed.
    • +
    • You don't need to include minifiers in your package, reducing +the size for your users.
    • +
    • You don't need to rely on your users having curl or wget or +other system tools on the target machines.
    • +
    +

    Dependencies

    +

    The dependencies script is run any time an npm command causes changes to the node_modules directory. It is run AFTER the changes have been applied and the package.json and package-lock.json files have been updated.

    +

    Life Cycle Operation Order

    +

    npm cache add

    +
      +
    • prepare
    • +
    +

    npm ci

    +
      +
    • preinstall
    • +
    • install
    • +
    • postinstall
    • +
    • prepublish
    • +
    • preprepare
    • +
    • prepare
    • +
    • postprepare
    • +
    +

    These all run after the actual installation of modules into +node_modules, in order, with no internal actions happening in between

    +

    npm diff

    +
      +
    • prepare
    • +
    +

    npm install

    +

    These also run when you run npm install -g <pkg-name>

    +
      +
    • preinstall
    • +
    • install
    • +
    • postinstall
    • +
    • prepublish
    • +
    • preprepare
    • +
    • prepare
    • +
    • postprepare
    • +
    +

    If there is a binding.gyp file in the root of your package and you +haven't defined your own install or preinstall scripts, npm will +default the install command to compile using node-gyp via node-gyp rebuild

    +

    These are run from the scripts of <pkg-name>

    +

    npm pack

    +
      +
    • prepack
    • +
    • prepare
    • +
    • postpack
    • +
    +

    npm publish

    +
      +
    • prepublishOnly
    • +
    • prepack
    • +
    • prepare
    • +
    • postpack
    • +
    • publish
    • +
    • postpublish
    • +
    +

    npm rebuild

    +
      +
    • preinstall
    • +
    • install
    • +
    • postinstall
    • +
    • prepare
    • +
    +

    prepare is only run if the current directory is a symlink (e.g. with +linked packages)

    +

    npm restart

    +

    If there is a restart script defined, these events are run, otherwise +stop and start are both run if present, including their pre and +post iterations)

    +
      +
    • prerestart
    • +
    • restart
    • +
    • postrestart
    • +
    +

    npm run <user defined>

    +
      +
    • pre<user-defined>
    • +
    • <user-defined>
    • +
    • post<user-defined>
    • +
    +

    npm start

    +
      +
    • prestart
    • +
    • start
    • +
    • poststart
    • +
    +

    If there is a server.js file in the root of your package, then npm +will default the start command to node server.js. prestart and +poststart will still run in this case.

    +

    npm stop

    +
      +
    • prestop
    • +
    • stop
    • +
    • poststop
    • +
    +

    npm test

    +
      +
    • pretest
    • +
    • test
    • +
    • posttest
    • +
    +

    npm version

    +
      +
    • preversion
    • +
    • version
    • +
    • postversion
    • +
    +

    A Note on a lack of npm uninstall scripts

    +

    While npm v6 had uninstall lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there's no clear way to currently give the script enough context to be useful.

    +

    Reasons for a package removal include:

    +
      +
    • a user directly uninstalled this package
    • +
    • a user uninstalled a dependant package and so this dependency is being uninstalled
    • +
    • a user uninstalled a dependant package but another package also depends on this version
    • +
    • this version has been merged as a duplicate with another version
    • +
    • etc.
    • +
    +

    Due to the lack of necessary context, uninstall lifecycle scripts are not implemented and will not function.

    +

    User

    +

    When npm is run as root, scripts are always run with the effective uid +and gid of the working directory owner.

    +

    Environment

    +

    Package scripts run in an environment where many pieces of information +are made available regarding the setup of npm and the current state of +the process.

    +

    path

    +

    If you depend on modules that define executable scripts, like test +suites, then those executables will be added to the PATH for +executing the scripts. So, if your package.json has this:

    +
    {
    +  "name" : "foo",
    +  "dependencies" : {
    +    "bar" : "0.1.x"
    +  },
    +  "scripts": {
    +    "start" : "bar ./test"
    +  }
    +}
    +
    +

    then you could run npm start to execute the bar script, which is +exported into the node_modules/.bin directory on npm install.

    +

    package.json vars

    +

    The package.json fields are tacked onto the npm_package_ prefix. So, +for instance, if you had {"name":"foo", "version":"1.2.5"} in your +package.json file, then your package scripts would have the +npm_package_name environment variable set to "foo", and the +npm_package_version set to "1.2.5". You can access these variables +in your code with process.env.npm_package_name and +process.env.npm_package_version, and so on for other fields.

    +

    See package.json for more on package configs.

    +

    current lifecycle event

    +

    Lastly, the npm_lifecycle_event environment variable is set to +whichever stage of the cycle is being executed. So, you could have a +single script used for different parts of the process which switches +based on what's currently happening.

    +

    Objects are flattened following this format, so if you had +{"scripts":{"install":"foo.js"}} in your package.json, then you'd +see this in the script:

    +
    process.env.npm_package_scripts_install === "foo.js"
    +
    +

    Examples

    +

    For example, if your package.json contains this:

    +
    {
    +  "scripts" : {
    +    "install" : "scripts/install.js",
    +    "postinstall" : "scripts/install.js"
    +  }
    +}
    +
    +

    then scripts/install.js will be called for the install and post-install +stages of the lifecycle. Since scripts/install.js is running for two +different phases, it would be wise in this case to look at the +npm_lifecycle_event environment variable.

    +

    If you want to run a make command, you can do so. This works just +fine:

    +
    {
    +  "scripts" : {
    +    "preinstall" : "./configure",
    +    "install" : "make && make install",
    +    "test" : "make test"
    +  }
    +}
    +
    +

    Exiting

    +

    Scripts are run by passing the line as a script argument to sh.

    +

    If the script exits with a code other than 0, then this will abort the +process.

    +

    Note that these script files don't have to be Node.js or even +JavaScript programs. They just have to be some kind of executable +file.

    +

    Best Practices

    +
      +
    • Don't exit with a non-zero error code unless you really mean it. +If the failure is minor or only will prevent some optional features, then +it's better to just print a warning and exit successfully.
    • +
    • Try not to use scripts to do what npm can do for you. Read through +package.json to see all the things that you can specify and enable +by simply describing your package appropriately. In general, this +will lead to a more robust and consistent state.
    • +
    • Inspect the env to determine where to put things. For instance, if +the npm_config_binroot environment variable is set to /home/user/bin, then +don't try to install executables into /usr/local/bin. The user +probably set it up that way for a reason.
    • +
    • Don't prefix your script commands with "sudo". If root permissions +are required for some reason, then it'll fail with that error, and +the user will sudo the npm command in question.
    • +
    • Don't use install. Use a .gyp file for compilation, and prepare +for anything else. You should almost never have to explicitly set a +preinstall or install script. If you are doing this, please consider if +there is another option. The only valid use of install or preinstall +scripts is for compilation which must be done on the target architecture.
    • +
    • Scripts are run from the root of the package folder, regardless of what the +current working directory is when npm is invoked. If you want your +script to use different behavior based on what subdirectory you're in, you +can use the INIT_CWD environment variable, which holds the full path you +were in when you ran npm run.
    • +
    +

    See Also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/docs/output/using-npm/workspaces.html b/node_modules/npm/docs/output/using-npm/workspaces.html new file mode 100644 index 00000000..ebdbb762 --- /dev/null +++ b/node_modules/npm/docs/output/using-npm/workspaces.html @@ -0,0 +1,321 @@ + + +workspaces + + + + + +
    +
    +

    + workspaces + @11.0.0 +

    +Working with workspaces +
    + +
    +

    Table of contents

    + +
    + +

    Description

    +

    Workspaces is a generic term that refers to the set of features in the +npm cli that provides support for managing multiple packages from your local +file system from within a singular top-level, root package.

    +

    This set of features makes up for a much more streamlined workflow handling +linked packages from the local file system. It automates the linking process +as part of npm install and removes the need to manually use npm link in +order to add references to packages that should be symlinked into the current +node_modules folder.

    +

    We also refer to these packages being auto-symlinked during npm install as a +single workspace, meaning it's a nested package within the current local +file system that is explicitly defined in the package.json +workspaces configuration.

    +

    Defining workspaces

    +

    Workspaces are usually defined via the workspaces property of the +package.json file, e.g:

    +
    {
    +  "name": "my-workspaces-powered-project",
    +  "workspaces": [
    +    "packages/a"
    +  ]
    +}
    +
    +

    Given the above package.json example living at a current working +directory . that contains a folder named packages/a that itself contains +a package.json inside it, defining a Node.js package, e.g:

    +
    .
    ++-- package.json
    +`-- packages
    +   +-- a
    +   |   `-- package.json
    +
    +

    The expected result once running npm install in this current working +directory . is that the folder packages/a will get symlinked to the +node_modules folder of the current working dir.

    +

    Below is a post npm install example, given that same previous example +structure of files and folders:

    +
    .
    ++-- node_modules
    +|  `-- a -> ../packages/a
    ++-- package-lock.json
    ++-- package.json
    +`-- packages
    +   +-- a
    +   |   `-- package.json
    +
    +

    Getting started with workspaces

    +

    You may automate the required steps to define a new workspace using +npm init. For example in a project that already has a +package.json defined you can run:

    +
    npm init -w ./packages/a
    +
    +

    This command will create the missing folders and a new package.json +file (if needed) while also making sure to properly configure the +"workspaces" property of your root project package.json.

    +

    Adding dependencies to a workspace

    +

    It's possible to directly add/remove/update dependencies of your workspaces +using the workspace config.

    +

    For example, assuming the following structure:

    +
    .
    ++-- package.json
    +`-- packages
    +   +-- a
    +   |   `-- package.json
    +   `-- b
    +       `-- package.json
    +
    +

    If you want to add a dependency named abbrev from the registry as a +dependency of your workspace a, you may use the workspace config to tell +the npm installer that package should be added as a dependency of the provided +workspace:

    +
    npm install abbrev -w a
    +
    +

    Note: other installing commands such as uninstall, ci, etc will also +respect the provided workspace configuration.

    +

    Using workspaces

    +

    Given the specifics of how Node.js handles module resolution it's possible to consume any defined workspace +by its declared package.json name. Continuing from the example defined +above, let's also create a Node.js script that will require the workspace a +example module, e.g:

    +
    // ./packages/a/index.js
    +module.exports = 'a'
    +
    +// ./lib/index.js
    +const moduleA = require('a')
    +console.log(moduleA) // -> a
    +
    +

    When running it with:

    +

    node lib/index.js

    +

    This demonstrates how the nature of node_modules resolution allows for +workspaces to enable a portable workflow for requiring each workspace +in such a way that is also easy to publish these +nested workspaces to be consumed elsewhere.

    +

    Running commands in the context of workspaces

    +

    You can use the workspace configuration option to run commands in the context +of a configured workspace. +Additionally, if your current directory is in a workspace, the workspace +configuration is implicitly set, and prefix is set to the root workspace.

    +

    Following is a quick example on how to use the npm run command in the context +of nested workspaces. For a project containing multiple workspaces, e.g:

    +
    .
    ++-- package.json
    +`-- packages
    +   +-- a
    +   |   `-- package.json
    +   `-- b
    +       `-- package.json
    +
    +

    By running a command using the workspace option, it's possible to run the +given command in the context of that specific workspace. e.g:

    +
    npm run test --workspace=a
    +
    +

    You could also run the command within the workspace.

    +
    cd packages/a && npm run test
    +
    +

    Either will run the test script defined within the +./packages/a/package.json file.

    +

    Please note that you can also specify this argument multiple times in the +command-line in order to target multiple workspaces, e.g:

    +
    npm run test --workspace=a --workspace=b
    +
    +

    Or run the command for each workspace within the 'packages' folder:

    +
    npm run test --workspace=packages
    +
    +

    It's also possible to use the workspaces (plural) configuration option to +enable the same behavior but running that command in the context of all +configured workspaces. e.g:

    +
    npm run test --workspaces
    +
    +

    Will run the test script in both ./packages/a and ./packages/b.

    +

    Commands will be run in each workspace in the order they appear in your package.json

    +
    {
    +  "workspaces": [ "packages/a", "packages/b" ]
    +}
    +
    +

    Order of run is different with:

    +
    {
    +  "workspaces": [ "packages/b", "packages/a" ]
    +}
    +
    +

    Ignoring missing scripts

    +

    It is not required for all of the workspaces to implement scripts run with the npm run command.

    +

    By running the command with the --if-present flag, npm will ignore workspaces missing target script.

    +
    npm run test --workspaces --if-present
    +
    +

    See also

    +
    + + +
    + + + + \ No newline at end of file diff --git a/node_modules/npm/index.js b/node_modules/npm/index.js new file mode 100644 index 00000000..5447643e --- /dev/null +++ b/node_modules/npm/index.js @@ -0,0 +1,5 @@ +if (require.main === module) { + require('./lib/cli.js')(process) +} else { + throw new Error('The programmatic API was removed in npm v8.0.0') +} diff --git a/node_modules/npm/lib/arborist-cmd.js b/node_modules/npm/lib/arborist-cmd.js new file mode 100644 index 00000000..f0167887 --- /dev/null +++ b/node_modules/npm/lib/arborist-cmd.js @@ -0,0 +1,53 @@ +const { log } = require('proc-log') +const BaseCommand = require('./base-cmd.js') + +// This is the base for all commands whose execWorkspaces just gets +// a list of workspace names and passes it on to new Arborist() to +// be able to run a filtered Arborist.reify() at some point. +class ArboristCmd extends BaseCommand { + get isArboristCmd () { + return true + } + + static params = [ + 'workspace', + 'workspaces', + 'include-workspace-root', + 'install-links', + ] + + static workspaces = true + static ignoreImplicitWorkspace = false + static checkDevEngines = true + + constructor (npm) { + super(npm) + + const { config } = this.npm + + // when location isn't set and global isn't true check for a package.json at + // the localPrefix and set the location to project if found + const locationProject = config.get('location') === 'project' || ( + config.isDefault('location') + // this is different then `npm.global` which falls back to checking + // location which we do not want to use here + && !config.get('global') + && npm.localPackage + ) + + // if audit is not set and we are in global mode and location is not project + // and we assume its not a project related context, then we set audit=false + if (config.isDefault('audit') && (this.npm.global || !locationProject)) { + config.set('audit', false) + } else if (this.npm.global && config.get('audit')) { + log.warn('config', 'includes both --global and --audit, which is currently unsupported.') + } + } + + async execWorkspaces (args) { + await this.setWorkspaces() + return this.exec(args) + } +} + +module.exports = ArboristCmd diff --git a/node_modules/npm/lib/base-cmd.js b/node_modules/npm/lib/base-cmd.js new file mode 100644 index 00000000..941ffefa --- /dev/null +++ b/node_modules/npm/lib/base-cmd.js @@ -0,0 +1,215 @@ +const { log } = require('proc-log') + +class BaseCommand { + // these defaults can be overridden by individual commands + static workspaces = false + static ignoreImplicitWorkspace = true + static checkDevEngines = false + + // these should always be overridden by individual commands + static name = null + static description = null + static params = null + + // this is a static so that we can read from it without instantiating a command + // which would require loading the config + static get describeUsage () { + const { definitions } = require('@npmcli/config/lib/definitions') + const { aliases: cmdAliases } = require('./utils/cmd-list') + const seenExclusive = new Set() + const wrapWidth = 80 + const { description, usage = [''], name, params } = this + + const fullUsage = [ + `${description}`, + '', + 'Usage:', + ...usage.map(u => `npm ${name} ${u}`.trim()), + ] + + if (params) { + let results = '' + let line = '' + for (const param of params) { + /* istanbul ignore next */ + if (seenExclusive.has(param)) { + continue + } + const { exclusive } = definitions[param] + let paramUsage = `${definitions[param].usage}` + if (exclusive) { + const exclusiveParams = [paramUsage] + seenExclusive.add(param) + for (const e of exclusive) { + seenExclusive.add(e) + exclusiveParams.push(definitions[e].usage) + } + paramUsage = `${exclusiveParams.join('|')}` + } + paramUsage = `[${paramUsage}]` + if (line.length + paramUsage.length > wrapWidth) { + results = [results, line].filter(Boolean).join('\n') + line = '' + } + line = [line, paramUsage].filter(Boolean).join(' ') + } + fullUsage.push('') + fullUsage.push('Options:') + fullUsage.push([results, line].filter(Boolean).join('\n')) + } + + const aliases = Object.entries(cmdAliases).reduce((p, [k, v]) => { + return p.concat(v === name ? k : []) + }, []) + + if (aliases.length) { + const plural = aliases.length === 1 ? '' : 'es' + fullUsage.push('') + fullUsage.push(`alias${plural}: ${aliases.join(', ')}`) + } + + fullUsage.push('') + fullUsage.push(`Run "npm help ${name}" for more info`) + + return fullUsage.join('\n') + } + + constructor (npm) { + this.npm = npm + + const { config } = this.npm + + if (!this.constructor.skipConfigValidation) { + config.validate() + } + + if (config.get('workspaces') === false && config.get('workspace').length) { + throw new Error('Can not use --no-workspaces and --workspace at the same time') + } + } + + get name () { + return this.constructor.name + } + + get description () { + return this.constructor.description + } + + get params () { + return this.constructor.params + } + + get usage () { + return this.constructor.describeUsage + } + + usageError (prefix = '') { + if (prefix) { + prefix += '\n\n' + } + return Object.assign(new Error(`\n${prefix}${this.usage}`), { + code: 'EUSAGE', + }) + } + + // Compare the number of entries with what was expected + checkExpected (entries) { + if (!this.npm.config.isDefault('expect-results')) { + const expected = this.npm.config.get('expect-results') + if (!!entries !== !!expected) { + log.warn(this.name, `Expected ${expected ? '' : 'no '}results, got ${entries}`) + process.exitCode = 1 + } + } else if (!this.npm.config.isDefault('expect-result-count')) { + const expected = this.npm.config.get('expect-result-count') + if (expected !== entries) { + /* eslint-disable-next-line max-len */ + log.warn(this.name, `Expected ${expected} result${expected === 1 ? '' : 's'}, got ${entries}`) + process.exitCode = 1 + } + } + } + + // Checks the devEngines entry in the package.json at this.localPrefix + async checkDevEngines () { + const force = this.npm.flatOptions.force + + const { devEngines } = await require('@npmcli/package-json') + .normalize(this.npm.config.localPrefix) + .then(p => p.content) + .catch(() => ({})) + + if (typeof devEngines === 'undefined') { + return + } + + const { checkDevEngines, currentEnv } = require('npm-install-checks') + const current = currentEnv.devEngines({ + nodeVersion: this.npm.nodeVersion, + npmVersion: this.npm.version, + }) + + const failures = checkDevEngines(devEngines, current) + const warnings = failures.filter(f => f.isWarn) + const errors = failures.filter(f => f.isError) + + const genMsg = (failure, i = 0) => { + return [...new Set([ + // eslint-disable-next-line + i === 0 ? 'The developer of this package has specified the following through devEngines' : '', + `${failure.message}`, + `${failure.errors.map(e => e.message).join('\n')}`, + ])].filter(v => v).join('\n') + } + + [...warnings, ...(force ? errors : [])].forEach((failure, i) => { + const message = genMsg(failure, i) + log.warn('EBADDEVENGINES', message) + log.warn('EBADDEVENGINES', { + current: failure.current, + required: failure.required, + }) + }) + + if (force) { + return + } + + if (errors.length) { + const failure = errors[0] + const message = genMsg(failure) + throw Object.assign(new Error(message), { + engine: failure.engine, + code: 'EBADDEVENGINES', + current: failure.current, + required: failure.required, + }) + } + } + + async setWorkspaces () { + const { relative } = require('node:path') + + const includeWorkspaceRoot = this.isArboristCmd + ? false + : this.npm.config.get('include-workspace-root') + + const prefixInsideCwd = relative(this.npm.localPrefix, process.cwd()).startsWith('..') + const relativeFrom = prefixInsideCwd ? this.npm.localPrefix : process.cwd() + + const filters = this.npm.config.get('workspace') + const getWorkspaces = require('./utils/get-workspaces.js') + const ws = await getWorkspaces(filters, { + path: this.npm.localPrefix, + includeWorkspaceRoot, + relativeFrom, + }) + + this.workspaces = ws + this.workspaceNames = [...ws.keys()] + this.workspacePaths = [...ws.values()] + } +} + +module.exports = BaseCommand diff --git a/node_modules/npm/lib/cli.js b/node_modules/npm/lib/cli.js new file mode 100644 index 00000000..00b4fc0b --- /dev/null +++ b/node_modules/npm/lib/cli.js @@ -0,0 +1,12 @@ +try { + const { enableCompileCache } = require('node:module') + /* istanbul ignore next */ + if (enableCompileCache) { + enableCompileCache() + } +} catch (e) { /* istanbul ignore next */ } + +const validateEngines = require('./cli/validate-engines.js') +const cliEntry = require('node:path').resolve(__dirname, 'cli/entry.js') + +module.exports = (process) => validateEngines(process, () => require(cliEntry)) diff --git a/node_modules/npm/lib/cli/entry.js b/node_modules/npm/lib/cli/entry.js new file mode 100644 index 00000000..f36bc59f --- /dev/null +++ b/node_modules/npm/lib/cli/entry.js @@ -0,0 +1,74 @@ +/* eslint-disable max-len */ + +// Separated out for easier unit testing +module.exports = async (process, validateEngines) => { + // set it here so that regardless of what happens later, we don't + // leak any private CLI configs to other programs + process.title = 'npm' + + // Patch the global fs module here at the app level + require('graceful-fs').gracefulify(require('node:fs')) + + const satisfies = require('semver/functions/satisfies') + const ExitHandler = require('./exit-handler.js') + const exitHandler = new ExitHandler({ process }) + const Npm = require('../npm.js') + const npm = new Npm() + exitHandler.setNpm(npm) + + // only log node and npm paths in argv initially since argv can contain sensitive info. a cleaned version will be logged later + const { log, output } = require('proc-log') + log.verbose('cli', process.argv.slice(0, 2).join(' ')) + log.info('using', 'npm@%s', npm.version) + log.info('using', 'node@%s', process.version) + + // At this point we've required a few files and can be pretty sure we dont contain invalid syntax for this version of node. It's possible a lazy require would, but that's unlikely enough that it's not worth catching anymore and we attach the more important exit handlers. + validateEngines.off() + exitHandler.registerUncaughtHandlers() + + // It is now safe to log a warning if they are using a version of node that is not going to fail on syntax errors but is still unsupported and untested and might not work reliably. This is safe to use the logger now which we want since this will show up in the error log too. + if (!satisfies(validateEngines.node, validateEngines.engines)) { + log.warn('cli', validateEngines.unsupportedMessage) + } + + // Now actually fire up npm and run the command. + // This is how to use npm programmatically: + try { + const { exec, command, args } = await npm.load() + + if (!exec) { + return exitHandler.exit() + } + + if (!command) { + output.standard(npm.usage) + process.exitCode = 1 + return exitHandler.exit() + } + + // Options are prefixed by a hyphen-minus (-, \u2d). + // Other dash-type chars look similar but are invalid. + const nonDashArgs = npm.argv.filter(a => /^[\u2010-\u2015\u2212\uFE58\uFE63\uFF0D]/.test(a)) + if (nonDashArgs.length) { + log.error( + 'arg', + 'Argument starts with non-ascii dash, this is probably invalid:', + require('@npmcli/redact').redactLog(nonDashArgs.join(', ')) + ) + } + + const execPromise = npm.exec(command, args) + + // this is async but we dont await it, since its ok if it doesnt + // finish before the command finishes running. it uses command and argv + // so it must be initiated here, after the command name is set + const updateNotifier = require('./update-notifier.js') + // eslint-disable-next-line promise/catch-or-return + updateNotifier(npm).then((msg) => (npm.updateNotification = msg)) + + await execPromise + return exitHandler.exit() + } catch (err) { + return exitHandler.exit(err) + } +} diff --git a/node_modules/npm/lib/cli/exit-handler.js b/node_modules/npm/lib/cli/exit-handler.js new file mode 100644 index 00000000..e76b08c8 --- /dev/null +++ b/node_modules/npm/lib/cli/exit-handler.js @@ -0,0 +1,174 @@ +const { log, output, META } = require('proc-log') +const { errorMessage, getExitCodeFromError } = require('../utils/error-message.js') + +class ExitHandler { + #npm = null + #process = null + #exited = false + #exitErrorMessage = false + + #noNpmError = false + + get #hasNpm () { + return !!this.#npm + } + + get #loaded () { + return !!this.#npm?.loaded + } + + get #showExitErrorMessage () { + if (!this.#loaded) { + return false + } + if (!this.#exited) { + return true + } + return this.#exitErrorMessage + } + + get #notLoadedOrExited () { + return !this.#loaded && !this.#exited + } + + setNpm (npm) { + this.#npm = npm + } + + constructor ({ process }) { + this.#process = process + this.#process.on('exit', this.#handleProcesExitAndReset) + } + + registerUncaughtHandlers () { + this.#process.on('uncaughtException', this.#handleExit) + this.#process.on('unhandledRejection', this.#handleExit) + } + + exit (err) { + this.#handleExit(err) + } + + #handleProcesExitAndReset = (code) => { + this.#handleProcessExit(code) + + // Reset all the state. This is only relevant for tests since + // in reality the process fully exits here. + this.#process.off('exit', this.#handleProcesExitAndReset) + this.#process.off('uncaughtException', this.#handleExit) + this.#process.off('unhandledRejection', this.#handleExit) + if (this.#loaded) { + this.#npm.unload() + } + this.#npm = null + this.#exited = false + this.#exitErrorMessage = false + } + + #handleProcessExit (code) { + const numCode = Number(code) || 0 + // Always exit w/ a non-zero code if exit handler was not called + const exitCode = this.#exited ? numCode : (numCode || 1) + this.#process.exitCode = exitCode + + if (this.#notLoadedOrExited) { + // Exit handler was not called and npm was not loaded so we have to log something + this.#logConsoleError(new Error(`Process exited unexpectedly with code: ${exitCode}`)) + return + } + + if (this.#logNoNpmError()) { + return + } + + const os = require('node:os') + log.verbose('cwd', this.#process.cwd()) + log.verbose('os', `${os.type()} ${os.release()}`) + log.verbose('node', this.#process.version) + log.verbose('npm ', `v${this.#npm.version}`) + + // only show the notification if it finished + if (typeof this.#npm.updateNotification === 'string') { + log.notice('', this.#npm.updateNotification, { [META]: true, force: true }) + } + + if (!this.#exited) { + log.error('', 'Exit handler never called!') + log.error('', 'This is an error with npm itself. Please report this error at:') + log.error('', ' ') + if (this.#npm.silent) { + output.error('') + } + } + + log.verbose('exit', exitCode) + + if (exitCode) { + log.verbose('code', exitCode) + } else { + log.info('ok') + } + + if (this.#showExitErrorMessage) { + log.error('', this.#npm.exitErrorMessage()) + } + } + + #logConsoleError (err) { + // Run our error message formatters on all errors even if we + // have no npm or an unloaded npm. This will clean the error + // and possible return a formatted message about EACCESS or something. + const { summary, detail } = errorMessage(err, this.#npm) + const formatted = [...new Set([...summary, ...detail].flat().filter(Boolean))].join('\n') + // If we didn't get anything from the formatted message then just display the full stack + // eslint-disable-next-line no-console + console.error(formatted === err.message ? err.stack : formatted) + } + + #logNoNpmError (err) { + if (this.#hasNpm) { + return false + } + // Make sure we only log this error once + if (!this.#noNpmError) { + this.#noNpmError = true + this.#logConsoleError( + new Error(`Exit prior to setting npm in exit handler`, err ? { cause: err } : {}) + ) + } + return true + } + + #handleExit = (err) => { + this.#exited = true + + // No npm at all + if (this.#logNoNpmError(err)) { + return this.#process.exit(this.#process.exitCode || getExitCodeFromError(err) || 1) + } + + // npm was never loaded but we still might have a config loading error or + // something similar that we can run through the error message formatter + // to give the user a clue as to what happened.s + if (!this.#loaded) { + this.#logConsoleError(new Error('Exit prior to config file resolving', { cause: err })) + return this.#process.exit(this.#process.exitCode || getExitCodeFromError(err) || 1) + } + + this.#exitErrorMessage = err?.suppressError === true ? false : !!err + + // Prefer the exit code of the error, then the current process exit code, + // then set it to 1 if we still have an error. Otherwise we call process.exit + // with undefined so that it can determine the final exit code + const exitCode = err?.exitCode ?? this.#process.exitCode ?? (err ? 1 : undefined) + + // explicitly call process.exit now so we don't hang on things like the + // update notifier, also flush stdout/err beforehand because process.exit doesn't + // wait for that to happen. + this.#process.stderr.write('', () => this.#process.stdout.write('', () => { + this.#process.exit(exitCode) + })) + } +} + +module.exports = ExitHandler diff --git a/node_modules/npm/lib/cli/update-notifier.js b/node_modules/npm/lib/cli/update-notifier.js new file mode 100644 index 00000000..32cac183 --- /dev/null +++ b/node_modules/npm/lib/cli/update-notifier.js @@ -0,0 +1,121 @@ +// print a banner telling the user to upgrade npm to latest +// but not in CI, and not if we're doing that already. +// Check daily for betas, and weekly otherwise. + +const ciInfo = require('ci-info') +const gt = require('semver/functions/gt') +const gte = require('semver/functions/gte') +const parse = require('semver/functions/parse') +const { stat, writeFile } = require('node:fs/promises') +const { resolve } = require('node:path') + +// update check frequency +const DAILY = 1000 * 60 * 60 * 24 +const WEEKLY = DAILY * 7 + +// don't put it in the _cacache folder, just in npm's cache +const lastCheckedFile = npm => + resolve(npm.flatOptions.cache, '../_update-notifier-last-checked') + +// Actual check for updates. This is a separate function so that we only load +// this if we are doing the actual update +const updateCheck = async (npm, spec, version, current) => { + const pacote = require('pacote') + + const mani = await pacote.manifest(`npm@${spec}`, { + // always prefer latest, even if doing --tag=whatever on the cmd + defaultTag: 'latest', + ...npm.flatOptions, + cache: false, + }).catch(() => null) + + // if pacote failed, give up + if (!mani) { + return null + } + + const latest = mani.version + + // if the current version is *greater* than latest, we're on a 'next' + // and should get the updates from that release train. + // Note that this isn't another http request over the network, because + // the packument will be cached by pacote from previous request. + if (gt(version, latest) && spec === 'latest') { + return updateNotifier(npm, `^${version}`) + } + + // if we already have something >= the desired spec, then we're done + if (gte(version, latest)) { + return null + } + + const chalk = npm.logChalk + + // ok! notify the user about this update they should get. + // The message is saved for printing at process exit so it will not get + // lost in any other messages being printed as part of the command. + const update = parse(mani.version) + const type = update.major !== current.major ? 'major' + : update.minor !== current.minor ? 'minor' + : update.patch !== current.patch ? 'patch' + : 'prerelease' + const typec = type === 'major' ? 'red' + : type === 'minor' ? 'yellow' + : 'cyan' + const cmd = `npm install -g npm@${latest}` + const message = `\nNew ${chalk[typec](type)} version of npm available! ` + + `${chalk[typec](current)} -> ${chalk.blue(latest)}\n` + + `Changelog: ${chalk.blue(`https://github.com/npm/cli/releases/tag/v${latest}`)}\n` + + `To update run: ${chalk.underline(cmd)}\n` + + return message +} + +const updateNotifier = async (npm, spec = 'latest') => { + // if we're on a prerelease train, then updates are coming fast + // check for a new one daily. otherwise, weekly. + const { version } = npm + const current = parse(version) + + // if we're on a beta train, always get the next beta + if (current.prerelease.length) { + spec = `^${version}` + } + + // while on a beta train, get updates daily + const duration = spec !== 'latest' ? DAILY : WEEKLY + + const t = new Date(Date.now() - duration) + // if we don't have a file, then definitely check it. + const st = await stat(lastCheckedFile(npm)).catch(() => ({ mtime: t - 1 })) + + // if we've already checked within the specified duration, don't check again + if (!(t > st.mtime)) { + return null + } + + // intentional. do not await this. it's a best-effort update. if this + // fails, it's ok. might be using /dev/null as the cache or something weird + // like that. + writeFile(lastCheckedFile(npm), '').catch(() => {}) + + return updateCheck(npm, spec, version, current) +} + +// only update the notification timeout if we actually finished checking +module.exports = npm => { + if ( + // opted out + !npm.config.get('update-notifier') + // global npm update + || (npm.flatOptions.global && + ['install', 'update'].includes(npm.command) && + npm.argv.some(arg => /^npm(@|$)/.test(arg))) + // CI + || ciInfo.isCI + ) { + return Promise.resolve(null) + } + + return updateNotifier(npm) +} diff --git a/node_modules/npm/lib/cli/validate-engines.js b/node_modules/npm/lib/cli/validate-engines.js new file mode 100644 index 00000000..cf5315a2 --- /dev/null +++ b/node_modules/npm/lib/cli/validate-engines.js @@ -0,0 +1,49 @@ +// This is separate to indicate that it should contain code we expect to work in +// all versions of node >= 6. This is a best effort to catch syntax errors to +// give users a good error message if they are using a node version that doesn't +// allow syntax we are using such as private properties, etc. This file is +// linted with ecmaVersion=6 so we don't use invalid syntax, which is set in the +// .eslintrc.local.json file + +const { engines: { node: engines }, version } = require('../../package.json') +const npm = `v${version}` + +module.exports = (process, getCli) => { + const node = process.version + + /* eslint-disable-next-line max-len */ + const unsupportedMessage = `npm ${npm} does not support Node.js ${node}. This version of npm supports the following node versions: \`${engines}\`. You can find the latest version at https://nodejs.org/.` + + /* eslint-disable-next-line max-len */ + const brokenMessage = `ERROR: npm ${npm} is known not to run on Node.js ${node}. This version of npm supports the following node versions: \`${engines}\`. You can find the latest version at https://nodejs.org/.` + + // coverage ignored because this is only hit in very unsupported node versions + // and it's a best effort attempt to show something nice in those cases + /* istanbul ignore next */ + const syntaxErrorHandler = (err) => { + if (err instanceof SyntaxError) { + // eslint-disable-next-line no-console + console.error(`${brokenMessage}\n\nERROR:`) + // eslint-disable-next-line no-console + console.error(err) + return process.exit(1) + } + throw err + } + + process.on('uncaughtException', syntaxErrorHandler) + process.on('unhandledRejection', syntaxErrorHandler) + + // require this only after setting up the error handlers + const cli = getCli() + return cli(process, { + node, + npm, + engines, + unsupportedMessage, + off: () => { + process.off('uncaughtException', syntaxErrorHandler) + process.off('unhandledRejection', syntaxErrorHandler) + }, + }) +} diff --git a/node_modules/npm/lib/commands/access.js b/node_modules/npm/lib/commands/access.js new file mode 100644 index 00000000..547fa7af --- /dev/null +++ b/node_modules/npm/lib/commands/access.js @@ -0,0 +1,222 @@ +const libnpmaccess = require('libnpmaccess') +const npa = require('npm-package-arg') +const { output } = require('proc-log') +const pkgJson = require('@npmcli/package-json') +const localeCompare = require('@isaacs/string-locale-compare')('en') +const { otplease } = require('../utils/auth.js') +const getIdentity = require('../utils/get-identity.js') +const BaseCommand = require('../base-cmd.js') + +const commands = [ + 'get', + 'grant', + 'list', + 'revoke', + 'set', +] + +const setCommands = [ + 'status=public', + 'status=private', + 'mfa=none', + 'mfa=publish', + 'mfa=automation', + '2fa=none', + '2fa=publish', + '2fa=automation', +] + +class Access extends BaseCommand { + static description = 'Set access level on published packages' + static name = 'access' + static params = [ + 'json', + 'otp', + 'registry', + ] + + static usage = [ + 'list packages [||] []', + 'list collaborators [ []]', + 'get status []', + 'set status=public|private []', + 'set mfa=none|publish|automation []', + 'grant []', + 'revoke []', + ] + + static async completion (opts) { + const argv = opts.conf.argv.remain + if (argv.length === 2) { + return commands + } + + if (argv.length === 3) { + switch (argv[2]) { + case 'grant': + return ['read-only', 'read-write'] + case 'revoke': + return [] + case 'list': + case 'ls': + return ['packages', 'collaborators'] + case 'get': + return ['status'] + case 'set': + return setCommands + default: + throw new Error(argv[2] + ' not recognized') + } + } + } + + async exec ([cmd, subcmd, ...args]) { + if (!cmd) { + throw this.usageError() + } + if (!commands.includes(cmd)) { + throw this.usageError(`${cmd} is not a valid access command`) + } + // All commands take at least one more parameter so we can do this check up front + if (!subcmd) { + throw this.usageError() + } + + switch (cmd) { + case 'grant': + if (!['read-only', 'read-write'].includes(subcmd)) { + throw this.usageError('grant must be either `read-only` or `read-write`') + } + if (!args[0]) { + throw this.usageError('`` argument is required') + } + return this.#grant(subcmd, args[0], args[1]) + case 'revoke': + return this.#revoke(subcmd, args[0]) + case 'list': + case 'ls': + if (subcmd === 'packages') { + return this.#listPackages(args[0], args[1]) + } + if (subcmd === 'collaborators') { + return this.#listCollaborators(args[0], args[1]) + } + throw this.usageError(`list ${subcmd} is not a valid access command`) + case 'get': + if (subcmd !== 'status') { + throw this.usageError(`get ${subcmd} is not a valid access command`) + } + return this.#getStatus(args[0]) + case 'set': + if (!setCommands.includes(subcmd)) { + throw this.usageError(`set ${subcmd} is not a valid access command`) + } + return this.#set(subcmd, args[0]) + } + } + + async #grant (permissions, scope, pkg) { + await libnpmaccess.setPermissions(scope, pkg, permissions, this.npm.flatOptions) + } + + async #revoke (scope, pkg) { + await libnpmaccess.removePermissions(scope, pkg, this.npm.flatOptions) + } + + async #listPackages (owner, pkg) { + if (!owner) { + owner = await getIdentity(this.npm, this.npm.flatOptions) + } + const pkgs = await libnpmaccess.getPackages(owner, this.npm.flatOptions) + this.#output(pkgs, pkg) + } + + async #listCollaborators (pkg, user) { + const pkgName = await this.#getPackage(pkg, false) + const collabs = await libnpmaccess.getCollaborators(pkgName, this.npm.flatOptions) + this.#output(collabs, user) + } + + async #getStatus (pkg) { + const pkgName = await this.#getPackage(pkg, false) + const visibility = await libnpmaccess.getVisibility(pkgName, this.npm.flatOptions) + this.#output({ [pkgName]: visibility.public ? 'public' : 'private' }) + } + + async #set (subcmd, pkg) { + const [subkey, subval] = subcmd.split('=') + switch (subkey) { + case 'mfa': + case '2fa': + return this.#setMfa(pkg, subval) + case 'status': + return this.#setStatus(pkg, subval) + } + } + + async #setMfa (pkg, level) { + const pkgName = await this.#getPackage(pkg, false) + await otplease(this.npm, this.npm.flatOptions, (opts) => { + return libnpmaccess.setMfa(pkgName, level, opts) + }) + } + + async #setStatus (pkg, status) { + // only scoped packages can have their access changed + const pkgName = await this.#getPackage(pkg, true) + if (status === 'private') { + status = 'restricted' + } + await otplease(this.npm, this.npm.flatOptions, (opts) => { + return libnpmaccess.setAccess(pkgName, status, opts) + }) + return this.#getStatus(pkgName) + } + + async #getPackage (name, requireScope) { + if (!name) { + try { + const { content } = await pkgJson.normalize(this.npm.prefix) + name = content.name + } catch (err) { + if (err.code === 'ENOENT') { + throw Object.assign(new Error('no package name given and no package.json found'), { + code: 'ENOENT', + }) + } else { + throw err + } + } + } + + const spec = npa(name) + if (requireScope && !spec.scope) { + throw this.usageError('This command is only available for scoped packages.') + } + return name + } + + #output (items, limiter) { + const outputs = {} + const lookup = { + __proto__: null, + read: 'read-only', + write: 'read-write', + } + for (const item in items) { + const val = items[item] + outputs[item] = lookup[val] || val + } + if (this.npm.config.get('json')) { + output.buffer(outputs) + } else { + for (const item of Object.keys(outputs).sort(localeCompare)) { + if (!limiter || limiter === item) { + output.standard(`${item}: ${outputs[item]}`) + } + } + } + } +} + +module.exports = Access diff --git a/node_modules/npm/lib/commands/adduser.js b/node_modules/npm/lib/commands/adduser.js new file mode 100644 index 00000000..cf64e7a7 --- /dev/null +++ b/node_modules/npm/lib/commands/adduser.js @@ -0,0 +1,50 @@ +const { log, output } = require('proc-log') +const { redactLog: replaceInfo } = require('@npmcli/redact') +const auth = require('../utils/auth.js') +const BaseCommand = require('../base-cmd.js') + +class AddUser extends BaseCommand { + static description = 'Add a registry user account' + static name = 'adduser' + static params = [ + 'registry', + 'scope', + 'auth-type', + ] + + async exec () { + const scope = this.npm.config.get('scope') + let registry = this.npm.config.get('registry') + + if (scope) { + const scopedRegistry = this.npm.config.get(`${scope}:registry`) + const cliRegistry = this.npm.config.get('registry', 'cli') + if (scopedRegistry && !cliRegistry) { + registry = scopedRegistry + } + } + + const creds = this.npm.config.getCredentialsByURI(registry) + + log.notice('', `Log in on ${replaceInfo(registry)}`) + + const { message, newCreds } = await auth.adduser(this.npm, { + ...this.npm.flatOptions, + creds, + registry, + }) + + this.npm.config.delete('_token', 'user') // prevent legacy pollution + this.npm.config.setCredentialsByURI(registry, newCreds) + + if (scope) { + this.npm.config.set(scope + ':registry', registry, 'user') + } + + await this.npm.config.save('user') + + output.standard(message) + } +} + +module.exports = AddUser diff --git a/node_modules/npm/lib/commands/audit.js b/node_modules/npm/lib/commands/audit.js new file mode 100644 index 00000000..486bef1b --- /dev/null +++ b/node_modules/npm/lib/commands/audit.js @@ -0,0 +1,121 @@ +const npmAuditReport = require('npm-audit-report') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') +const auditError = require('../utils/audit-error.js') +const { log, output } = require('proc-log') +const reifyFinish = require('../utils/reify-finish.js') +const VerifySignatures = require('../utils/verify-signatures.js') + +class Audit extends ArboristWorkspaceCmd { + static description = 'Run a security audit' + static name = 'audit' + static params = [ + 'audit-level', + 'dry-run', + 'force', + 'json', + 'package-lock-only', + 'package-lock', + 'omit', + 'include', + 'foreground-scripts', + 'ignore-scripts', + ...super.params, + ] + + static usage = ['[fix|signatures]'] + + static async completion (opts) { + const argv = opts.conf.argv.remain + + if (argv.length === 2) { + return ['fix', 'signatures'] + } + + switch (argv[2]) { + case 'fix': + case 'signatures': + return [] + default: + throw Object.assign(new Error(argv[2] + ' not recognized'), { + code: 'EUSAGE', + }) + } + } + + async exec (args) { + if (args[0] === 'signatures') { + await this.auditSignatures() + } else { + await this.auditAdvisories(args) + } + } + + async auditAdvisories (args) { + const fix = args[0] === 'fix' + if (this.npm.config.get('package-lock') === false && fix) { + throw this.usageError('fix can not be used without a package-lock') + } + const reporter = this.npm.config.get('json') ? 'json' : 'detail' + const Arborist = require('@npmcli/arborist') + const opts = { + ...this.npm.flatOptions, + audit: true, + path: this.npm.prefix, + reporter, + workspaces: this.workspaceNames, + } + + const arb = new Arborist(opts) + await arb.audit({ fix }) + if (fix) { + await reifyFinish(this.npm, arb) + } else { + // will throw if there's an error, because this is an audit command + auditError(this.npm, arb.auditReport) + const result = npmAuditReport(arb.auditReport, { + ...opts, + chalk: this.npm.chalk, + }) + process.exitCode = process.exitCode || result.exitCode + output.standard(result.report) + } + } + + async auditSignatures () { + if (this.npm.global) { + throw Object.assign( + new Error('`npm audit signatures` does not support global packages'), { + code: 'EAUDITGLOBAL', + } + ) + } + + log.verbose('audit', 'loading installed dependencies') + const Arborist = require('@npmcli/arborist') + const opts = { + ...this.npm.flatOptions, + path: this.npm.prefix, + workspaces: this.workspaceNames, + } + + const arb = new Arborist(opts) + const tree = await arb.loadActual() + let filterSet = new Set() + if (opts.workspaces && opts.workspaces.length) { + filterSet = + arb.workspaceDependencySet( + tree, + opts.workspaces, + this.npm.flatOptions.includeWorkspaceRoot + ) + } else if (!this.npm.flatOptions.workspacesEnabled) { + filterSet = + arb.excludeWorkspacesDependencySet(tree) + } + + const verify = new VerifySignatures(tree, filterSet, this.npm, { ...opts }) + await verify.run() + } +} + +module.exports = Audit diff --git a/node_modules/npm/lib/commands/bugs.js b/node_modules/npm/lib/commands/bugs.js new file mode 100644 index 00000000..44926afb --- /dev/null +++ b/node_modules/npm/lib/commands/bugs.js @@ -0,0 +1,34 @@ +const PackageUrlCmd = require('../package-url-cmd.js') + +class Bugs extends PackageUrlCmd { + static description = 'Report bugs for a package in a web browser' + static name = 'bugs' + + getUrl (spec, mani) { + if (mani.bugs) { + if (typeof mani.bugs === 'string') { + return mani.bugs + } + + if (typeof mani.bugs === 'object' && mani.bugs.url) { + return mani.bugs.url + } + + if (typeof mani.bugs === 'object' && mani.bugs.email) { + return `mailto:${mani.bugs.email}` + } + } + + // try to get it from the repo, if possible + const info = this.hostedFromMani(mani) + const infoUrl = info?.bugs() + if (infoUrl) { + return infoUrl + } + + // just send them to the website, hopefully that has some info! + return `https://www.npmjs.com/package/${mani.name}` + } +} + +module.exports = Bugs diff --git a/node_modules/npm/lib/commands/cache.js b/node_modules/npm/lib/commands/cache.js new file mode 100644 index 00000000..45d308a5 --- /dev/null +++ b/node_modules/npm/lib/commands/cache.js @@ -0,0 +1,218 @@ +const cacache = require('cacache') +const pacote = require('pacote') +const fs = require('node:fs/promises') +const { join } = require('node:path') +const semver = require('semver') +const BaseCommand = require('../base-cmd.js') +const npa = require('npm-package-arg') +const jsonParse = require('json-parse-even-better-errors') +const localeCompare = require('@isaacs/string-locale-compare')('en') +const { log, output } = require('proc-log') + +const searchCachePackage = async (path, parsed, cacheKeys) => { + /* eslint-disable-next-line max-len */ + const searchMFH = new RegExp(`^make-fetch-happen:request-cache:.*(?', + 'clean []', + 'ls [@]', + 'verify', + ] + + static async completion (opts) { + const argv = opts.conf.argv.remain + if (argv.length === 2) { + return ['add', 'clean', 'verify', 'ls'] + } + + // TODO - eventually... + switch (argv[2]) { + case 'verify': + case 'clean': + case 'add': + case 'ls': + return [] + } + } + + async exec (args) { + const cmd = args.shift() + switch (cmd) { + case 'rm': case 'clear': case 'clean': + return await this.clean(args) + case 'add': + return await this.add(args) + case 'verify': case 'check': + return await this.verify() + case 'ls': + return await this.ls(args) + default: + throw this.usageError() + } + } + + // npm cache clean [pkg]* + async clean (args) { + const cachePath = join(this.npm.cache, '_cacache') + if (args.length === 0) { + if (!this.npm.config.get('force')) { + throw new Error(`As of npm@5, the npm cache self-heals from corruption issues + by treating integrity mismatches as cache misses. As a result, + data extracted from the cache is guaranteed to be valid. If you + want to make sure everything is consistent, use \`npm cache verify\` + instead. Deleting the cache can only make npm go slower, and is + not likely to correct any problems you may be encountering! + + On the other hand, if you're debugging an issue with the installer, + or race conditions that depend on the timing of writing to an empty + cache, you can use \`npm install --cache /tmp/empty-cache\` to use a + temporary cache instead of nuking the actual one. + + If you're sure you want to delete the entire cache, rerun this command + with --force.`) + } + return fs.rm(cachePath, { recursive: true, force: true }) + } + for (const key of args) { + let entry + try { + entry = await cacache.get(cachePath, key) + } catch { + log.warn('cache', `Not Found: ${key}`) + break + } + output.standard(`Deleted: ${key}`) + await cacache.rm.entry(cachePath, key) + // XXX this could leave other entries without content! + await cacache.rm.content(cachePath, entry.integrity) + } + } + + // npm cache add ... + // npm cache add ... + // npm cache add ... + // npm cache add ... + async add (args) { + log.silly('cache add', 'args', args) + if (args.length === 0) { + throw this.usageError('First argument to `add` is required') + } + + await Promise.all(args.map(async spec => { + log.silly('cache add', 'spec', spec) + // we ask pacote for the thing, and then just throw the data + // away so that it tee-pipes it into the cache like it does + // for a normal request. + await pacote.tarball.stream(spec, stream => { + stream.resume() + return stream.promise() + }, { ...this.npm.flatOptions }) + + await pacote.manifest(spec, { + ...this.npm.flatOptions, + fullMetadata: true, + }) + })) + } + + async verify () { + const cache = join(this.npm.cache, '_cacache') + const prefix = cache.indexOf(process.env.HOME) === 0 + ? `~${cache.slice(process.env.HOME.length)}` + : cache + const stats = await cacache.verify(cache) + output.standard(`Cache verified and compressed (${prefix})`) + output.standard(`Content verified: ${stats.verifiedContent} (${stats.keptSize} bytes)`) + if (stats.badContentCount) { + output.standard(`Corrupted content removed: ${stats.badContentCount}`) + } + if (stats.reclaimedCount) { + /* eslint-disable-next-line max-len */ + output.standard(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`) + } + if (stats.missingContent) { + output.standard(`Missing content: ${stats.missingContent}`) + } + output.standard(`Index entries: ${stats.totalEntries}`) + output.standard(`Finished in ${stats.runTime.total / 1000}s`) + } + + // npm cache ls [--package ...] + async ls (specs) { + const cachePath = join(this.npm.cache, '_cacache') + const cacheKeys = Object.keys(await cacache.ls(cachePath)) + if (specs.length > 0) { + // get results for each package spec specified + const results = new Set() + for (const spec of specs) { + const parsed = npa(spec) + if (parsed.rawSpec !== '' && parsed.type === 'tag') { + throw this.usageError('Cannot list cache keys for a tagged package.') + } + const keySet = await searchCachePackage(cachePath, parsed, cacheKeys) + for (const key of keySet) { + results.add(key) + } + } + [...results].sort(localeCompare).forEach(key => output.standard(key)) + return + } + cacheKeys.sort(localeCompare).forEach(key => output.standard(key)) + } +} + +module.exports = Cache diff --git a/node_modules/npm/lib/commands/ci.js b/node_modules/npm/lib/commands/ci.js new file mode 100644 index 00000000..c190de7e --- /dev/null +++ b/node_modules/npm/lib/commands/ci.js @@ -0,0 +1,129 @@ +const reifyFinish = require('../utils/reify-finish.js') +const runScript = require('@npmcli/run-script') +const fs = require('node:fs/promises') +const path = require('node:path') +const { log, time } = require('proc-log') +const validateLockfile = require('../utils/validate-lockfile.js') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') +const getWorkspaces = require('../utils/get-workspaces.js') + +class CI extends ArboristWorkspaceCmd { + static description = 'Clean install a project' + static name = 'ci' + + // These are in the order they will show up in when running "-h" + static params = [ + 'install-strategy', + 'legacy-bundling', + 'global-style', + 'omit', + 'include', + 'strict-peer-deps', + 'foreground-scripts', + 'ignore-scripts', + 'audit', + 'bin-links', + 'fund', + 'dry-run', + ...super.params, + ] + + async exec () { + if (this.npm.global) { + throw Object.assign(new Error('`npm ci` does not work for global packages'), { + code: 'ECIGLOBAL', + }) + } + + const where = this.npm.prefix + const Arborist = require('@npmcli/arborist') + const opts = { + ...this.npm.flatOptions, + packageLock: true, // npm ci should never skip lock files + path: where, + save: false, // npm ci should never modify the lockfile or package.json + workspaces: this.workspaceNames, + } + + const arb = new Arborist(opts) + await arb.loadVirtual().catch(er => { + log.verbose('loadVirtual', er.stack) + const msg = + 'The `npm ci` command can only install with an existing package-lock.json or\n' + + 'npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or\n' + + 'later to generate a package-lock.json file, then try again.' + throw this.usageError(msg) + }) + + // retrieves inventory of packages from loaded virtual tree (lock file) + const virtualInventory = new Map(arb.virtualTree.inventory) + + // build ideal tree step needs to come right after retrieving the virtual + // inventory since it's going to erase the previous ref to virtualTree + await arb.buildIdealTree() + + // verifies that the packages from the ideal tree will match + // the same versions that are present in the virtual tree (lock file) + // throws a validation error in case of mismatches + const errors = validateLockfile(virtualInventory, arb.idealTree.inventory) + if (errors.length) { + throw this.usageError( + '`npm ci` can only install packages when your package.json and ' + + 'package-lock.json or npm-shrinkwrap.json are in sync. Please ' + + 'update your lock file with `npm install` ' + + 'before continuing.\n\n' + + errors.join('\n') + ) + } + + const dryRun = this.npm.config.get('dry-run') + if (!dryRun) { + const workspacePaths = await getWorkspaces([], { + path: this.npm.localPrefix, + includeWorkspaceRoot: true, + }) + + // Only remove node_modules after we've successfully loaded the virtual + // tree and validated the lockfile + await time.start('npm-ci:rm', async () => { + return await Promise.all([...workspacePaths.values()].map(async modulePath => { + const fullPath = path.join(modulePath, 'node_modules') + // get the list of entries so we can skip the glob for performance + const entries = await fs.readdir(fullPath, null).catch(() => []) + return Promise.all(entries.map(folder => { + return fs.rm(path.join(fullPath, folder), { force: true, recursive: true }) + })) + })) + }) + } + + await arb.reify(opts) + + const ignoreScripts = this.npm.config.get('ignore-scripts') + // run the same set of scripts that `npm install` runs. + if (!ignoreScripts) { + const scripts = [ + 'preinstall', + 'install', + 'postinstall', + 'prepublish', // XXX should we remove this finally?? + 'preprepare', + 'prepare', + 'postprepare', + ] + const scriptShell = this.npm.config.get('script-shell') || undefined + for (const event of scripts) { + await runScript({ + path: where, + args: [], + scriptShell, + stdio: 'inherit', + event, + }) + } + } + await reifyFinish(this.npm, arb) + } +} + +module.exports = CI diff --git a/node_modules/npm/lib/commands/completion.js b/node_modules/npm/lib/commands/completion.js new file mode 100644 index 00000000..f8c2e00c --- /dev/null +++ b/node_modules/npm/lib/commands/completion.js @@ -0,0 +1,283 @@ +// Each command has a completion function that takes an options object and a cb +// The callback gets called with an error and an array of possible completions. +// The options object is built up based on the environment variables set by +// zsh or bash when calling a function for completion, based on the cursor +// position and the command line thus far. These are: +// COMP_CWORD: the index of the "word" in the command line being completed +// COMP_LINE: the full command line thusfar as a string +// COMP_POINT: the cursor index at the point of triggering completion +// +// We parse the command line with nopt, like npm does, and then create an +// options object containing: +// words: array of words in the command line +// w: the index of the word being completed (ie, COMP_CWORD) +// word: the word being completed +// line: the COMP_LINE +// lineLength +// point: the COMP_POINT, usually equal to line length, but not always, eg if +// the user has pressed the left-arrow to complete an earlier word +// partialLine: the line up to the point +// partialWord: the word being completed (which might be ''), up to the point +// conf: a nopt parse of the command line +// +// When the implementation completion method returns its list of strings, +// and arrays of strings, we filter that by any that start with the +// partialWord, since only those can possibly be valid matches. +// +// Matches are wrapped with ' to escape them, if necessary, and then printed +// one per line for the shell completion method to consume in IFS=$'\n' mode +// as an array. + +const fs = require('node:fs/promises') +const nopt = require('nopt') +const { resolve } = require('node:path') +const { output } = require('proc-log') +const Npm = require('../npm.js') +const { definitions, shorthands } = require('@npmcli/config/lib/definitions') +const { commands, aliases, deref } = require('../utils/cmd-list.js') +const { isWindowsShell } = require('../utils/is-windows.js') +const BaseCommand = require('../base-cmd.js') + +const fileExists = (file) => fs.stat(file).then(s => s.isFile()).catch(() => false) + +const configNames = Object.keys(definitions) +const shorthandNames = Object.keys(shorthands) +const allConfs = configNames.concat(shorthandNames) + +class Completion extends BaseCommand { + static description = 'Tab Completion for npm' + static name = 'completion' + + // completion for the completion command + static async completion (opts) { + if (opts.w > 2) { + return + } + + const [bashExists, zshExists] = await Promise.all([ + fileExists(resolve(process.env.HOME, '.bashrc')), + fileExists(resolve(process.env.HOME, '.zshrc')), + ]) + const out = [] + if (zshExists) { + out.push(['>>', '~/.zshrc']) + } + + if (bashExists) { + out.push(['>>', '~/.bashrc']) + } + + return out + } + + async exec (args) { + if (isWindowsShell) { + const msg = 'npm completion supported only in MINGW / Git bash on Windows' + throw Object.assign(new Error(msg), { + code: 'ENOTSUP', + }) + } + + const { COMP_CWORD, COMP_LINE, COMP_POINT, COMP_FISH } = process.env + + // if the COMP_* isn't in the env, then just dump the script. + if (COMP_CWORD === undefined || COMP_LINE === undefined || COMP_POINT === undefined) { + return dumpScript(resolve(this.npm.npmRoot, 'lib', 'utils', 'completion.sh')) + } + + // ok we're actually looking at the envs and outputting the suggestions + // get the partial line and partial word, + // if the point isn't at the end. + // ie, tabbing at: npm foo b|ar + const w = +COMP_CWORD + const words = args.map(unescape) + const word = words[w] + const line = COMP_LINE + const point = +COMP_POINT + const partialLine = line.slice(0, point) + const partialWords = words.slice(0, w) + + // figure out where in that last word the point is. + const partialWordRaw = args[w] + let i = partialWordRaw.length + while (partialWordRaw.slice(0, i) !== partialLine.slice(-1 * i) && i > 0) { + i-- + } + + const partialWord = unescape(partialWordRaw.slice(0, i)) + partialWords.push(partialWord) + + const opts = { + isFish: COMP_FISH === 'true', + words, + w, + word, + line, + lineLength: line.length, + point, + partialLine, + partialWords, + partialWord, + raw: args, + } + + if (partialWords.slice(0, -1).indexOf('--') === -1) { + if (word.charAt(0) === '-') { + return this.wrap(opts, configCompl(opts)) + } + + if (words[w - 1] && + words[w - 1].charAt(0) === '-' && + !isFlag(words[w - 1])) { + // awaiting a value for a non-bool config. + // don't even try to do this for now + return this.wrap(opts, configValueCompl(opts)) + } + } + + // try to find the npm command. + // it's the first thing after all the configs. + // take a little shortcut and use npm's arg parsing logic. + // don't have to worry about the last arg being implicitly + // boolean'ed, since the last block will catch that. + const types = Object.entries(definitions).reduce((acc, [key, def]) => { + acc[key] = def.type + return acc + }, {}) + const parsed = opts.conf = + nopt(types, shorthands, partialWords.slice(0, -1), 0) + // check if there's a command already. + const cmd = parsed.argv.remain[1] + if (!cmd) { + return this.wrap(opts, cmdCompl(opts, this.npm)) + } + + Object.keys(parsed).forEach(k => this.npm.config.set(k, parsed[k])) + + // at this point, if words[1] is some kind of npm command, + // then complete on it. + // otherwise, do nothing + try { + const { completion } = Npm.cmd(cmd) + if (completion) { + const comps = await completion(opts, this.npm) + return this.wrap(opts, comps) + } + } catch { + // it wasnt a valid command, so do nothing + } + } + + // The command should respond with an array. Loop over that, + // wrapping quotes around any that have spaces, and writing + // them to stdout. + // If any of the items are arrays, then join them with a space. + // Ie, returning ['a', 'b c', ['d', 'e']] would allow it to expand + // to: 'a', 'b c', or 'd' 'e' + wrap (opts, compls) { + // TODO this was dead code, leaving it in case we find some command we + // forgot that requires this. if so *that command should fix its + // completions* + // compls = compls.map(w => !/\s+/.test(w) ? w : '\'' + w + '\'') + + if (opts.partialWord) { + compls = compls.filter(c => c.startsWith(opts.partialWord)) + } + + if (compls.length > 0) { + output.standard(compls.join('\n')) + } + } +} + +const dumpScript = async (p) => { + const d = (await fs.readFile(p, 'utf8')).replace(/^#!.*?\n/, '') + await new Promise((res, rej) => { + let done = false + process.stdout.on('error', er => { + if (done) { + return + } + + done = true + + // Darwin is a pain sometimes. + // + // This is necessary because the "source" or "." program in + // bash on OS X closes its file argument before reading + // from it, meaning that you get exactly 1 write, which will + // work most of the time, and will always raise an EPIPE. + // + // Really, one should not be tossing away EPIPE errors, or any + // errors, so casually. But, without this, `. <(npm completion)` + // can never ever work on OS X. + // TODO Ignoring coverage, see 'non EPIPE errors cause failures' test. + /* istanbul ignore next */ + if (er.errno === 'EPIPE') { + res() + } else { + rej(er) + } + }) + + process.stdout.write(d, () => { + if (done) { + return + } + + done = true + res() + }) + }) +} + +const unescape = w => w.charAt(0) === '\'' ? w.replace(/^'|'$/g, '') + : w.replace(/\\ /g, ' ') + +// the current word has a dash. Return the config names, +// with the same number of dashes as the current word has. +const configCompl = opts => { + const word = opts.word + const split = word.match(/^(-+)((?:no-)*)(.*)$/) + const dashes = split[1] + const no = split[2] + const flags = configNames.filter(isFlag) + return allConfs.map(c => dashes + c) + .concat(flags.map(f => dashes + (no || 'no-') + f)) +} + +// expand with the valid values of various config values. +// not yet implemented. +const configValueCompl = () => [] + +// check if the thing is a flag or not. +const isFlag = word => { + // shorthands never take args. + const split = word.match(/^(-*)((?:no-)+)?(.*)$/) + const no = split[2] + const conf = split[3] + const { type } = definitions[conf] + return no || + type === Boolean || + (Array.isArray(type) && type.includes(Boolean)) || + shorthands[conf] +} + +// complete against the npm commands +// if they all resolve to the same thing, just return the thing it already is +const cmdCompl = (opts) => { + const allCommands = commands.concat(Object.keys(aliases)) + const matches = allCommands.filter(c => c.startsWith(opts.partialWord)) + if (!matches.length) { + return matches + } + + const derefs = new Set([...matches.map(c => deref(c))]) + if (derefs.size === 1) { + return [...derefs] + } + + return allCommands +} + +module.exports = Completion diff --git a/node_modules/npm/lib/commands/config.js b/node_modules/npm/lib/commands/config.js new file mode 100644 index 00000000..6b1447d7 --- /dev/null +++ b/node_modules/npm/lib/commands/config.js @@ -0,0 +1,410 @@ +const { mkdir, readFile, writeFile } = require('node:fs/promises') +const { dirname, resolve } = require('node:path') +const { spawn } = require('node:child_process') +const { EOL } = require('node:os') +const localeCompare = require('@isaacs/string-locale-compare')('en') +const pkgJson = require('@npmcli/package-json') +const { defaults, definitions } = require('@npmcli/config/lib/definitions') +const { log, output } = require('proc-log') +const BaseCommand = require('../base-cmd.js') +const { redact } = require('@npmcli/redact') + +// These are the configs that we can nerf-dart. Not all of them currently even +// *have* config definitions so we have to explicitly validate them here. +// This is used to validate during "npm config set" +const nerfDarts = [ + '_auth', + '_authToken', + '_password', + 'certfile', + 'email', + 'keyfile', + 'username', +] +// These are the config values to swap with "protected". It does not catch +// every single sensitive thing a user may put in the npmrc file but it gets +// the common ones. This is distinct from nerfDarts because that is used to +// validate valid configs during "npm config set", and folks may have old +// invalid entries lying around in a config file that we still want to protect +// when running "npm config list" +// This is a more general list of values to consider protected. You can not +// "npm config get" them, and they will not display during "npm config list" +const protected = [ + 'auth', + 'authToken', + 'certfile', + 'email', + 'keyfile', + 'password', + 'username', +] + +// take an array of `[key, value, k2=v2, k3, v3, ...]` and turn into +// { key: value, k2: v2, k3: v3 } +const keyValues = args => { + const kv = {} + for (let i = 0; i < args.length; i++) { + const arg = args[i].split('=') + const key = arg.shift() + const val = arg.length ? arg.join('=') + : i < args.length - 1 ? args[++i] + : '' + kv[key.trim()] = val.trim() + } + return kv +} + +const isProtected = (k) => { + // _password + if (k.startsWith('_')) { + return true + } + if (protected.includes(k)) { + return true + } + // //localhost:8080/:_password + if (k.startsWith('//')) { + if (k.includes(':_')) { + return true + } + // //registry:_authToken or //registry:authToken + for (const p of protected) { + if (k.endsWith(`:${p}`) || k.endsWith(`:_${p}`)) { + return true + } + } + } + return false +} + +// Private fields are either protected or they can redacted info +const isPrivate = (k, v) => isProtected(k) || redact(v) !== v + +const displayVar = (k, v) => + `${k} = ${isProtected(k, v) ? '(protected)' : JSON.stringify(redact(v))}` + +class Config extends BaseCommand { + static description = 'Manage the npm configuration files' + static name = 'config' + static usage = [ + 'set = [= ...]', + 'get [ [ ...]]', + 'delete [ ...]', + 'list [--json]', + 'edit', + 'fix', + ] + + static params = [ + 'json', + 'global', + 'editor', + 'location', + 'long', + ] + + static ignoreImplicitWorkspace = false + + static skipConfigValidation = true + + static async completion (opts) { + const argv = opts.conf.argv.remain + if (argv[1] !== 'config') { + argv.unshift('config') + } + + if (argv.length === 2) { + const cmds = ['get', 'set', 'delete', 'ls', 'rm', 'edit', 'fix'] + if (opts.partialWord !== 'l') { + cmds.push('list') + } + + return cmds + } + + const action = argv[2] + switch (action) { + case 'set': + // todo: complete with valid values, if possible. + if (argv.length > 3) { + return [] + } + + // fallthrough + /* eslint no-fallthrough:0 */ + case 'get': + case 'delete': + case 'rm': + return Object.keys(definitions) + case 'edit': + case 'list': + case 'ls': + case 'fix': + default: + return [] + } + } + + async exec ([action, ...args]) { + switch (action) { + case 'set': + await this.set(args) + break + case 'get': + await this.get(args) + break + case 'delete': + case 'rm': + case 'del': + await this.del(args) + break + case 'list': + case 'ls': + await (this.npm.flatOptions.json ? this.listJson() : this.list()) + break + case 'edit': + await this.edit() + break + case 'fix': + await this.fix() + break + default: + throw this.usageError() + } + } + + async set (args) { + if (!args.length) { + throw this.usageError() + } + + const where = this.npm.flatOptions.location + for (const [key, val] of Object.entries(keyValues(args))) { + log.info('config', 'set %j %j', key, val) + const baseKey = key.split(':').pop() + if (!this.npm.config.definitions[baseKey] && !nerfDarts.includes(baseKey)) { + throw new Error(`\`${baseKey}\` is not a valid npm option`) + } + const deprecated = this.npm.config.definitions[baseKey]?.deprecated + if (deprecated) { + throw new Error( + `The \`${baseKey}\` option is deprecated, and can not be set in this way${deprecated}` + ) + } + + if (val === '') { + this.npm.config.delete(key, where) + } else { + this.npm.config.set(key, val, where) + } + + if (!this.npm.config.validate(where)) { + log.warn('config', 'omitting invalid config values') + } + } + + await this.npm.config.save(where) + } + + async get (keys) { + if (!keys.length) { + return this.list() + } + + const out = [] + for (const key of keys) { + const val = this.npm.config.get(key) + if (isPrivate(key, val)) { + throw new Error(`The ${key} option is protected, and can not be retrieved in this way`) + } + + const pref = keys.length > 1 ? `${key}=` : '' + out.push(pref + val) + } + output.standard(out.join('\n')) + } + + async del (keys) { + if (!keys.length) { + throw this.usageError() + } + + const where = this.npm.flatOptions.location + for (const key of keys) { + this.npm.config.delete(key, where) + } + await this.npm.config.save(where) + } + + async edit () { + const ini = require('ini') + const e = this.npm.flatOptions.editor + const where = this.npm.flatOptions.location + const file = this.npm.config.data.get(where).source + + // save first, just to make sure it's synced up + // this also removes all the comments from the last time we edited it. + await this.npm.config.save(where) + + const data = ( + await readFile(file, 'utf8').catch(() => '') + ).replace(/\r\n/g, '\n') + const entries = Object.entries(defaults) + const defData = entries.reduce((str, [key, val]) => { + const obj = { [key]: val } + const i = ini.stringify(obj) + .replace(/\r\n/g, '\n') // normalizes output from ini.stringify + .replace(/\n$/m, '') + .replace(/^/g, '; ') + .replace(/\n/g, '\n; ') + .split('\n') + return str + '\n' + i + }, '') + + const tmpData = `;;;; +; npm ${where}config file: ${file} +; this is a simple ini-formatted file +; lines that start with semi-colons are comments +; run \`npm help 7 config\` for documentation of the various options +; +; Configs like \`@scope:registry\` map a scope to a given registry url. +; +; Configs like \`///:_authToken\` are auth that is restricted +; to the registry host specified. + +${data.split('\n').sort(localeCompare).join('\n').trim()} + +;;;; +; all available options shown below with default values +;;;; + +${defData} +`.split('\n').join(EOL) + await mkdir(dirname(file), { recursive: true }) + await writeFile(file, tmpData, 'utf8') + await new Promise((res, rej) => { + const [bin, ...args] = e.split(/\s+/) + const editor = spawn(bin, [...args, file], { stdio: 'inherit' }) + editor.on('exit', (code) => { + if (code) { + return rej(new Error(`editor process exited with code: ${code}`)) + } + return res() + }) + }) + } + + async fix () { + let problems + + try { + this.npm.config.validate() + return // if validate doesn't throw we have nothing to do + } catch (err) { + // coverage skipped because we don't need to test rethrowing errors + // istanbul ignore next + if (err.code !== 'ERR_INVALID_AUTH') { + throw err + } + + problems = err.problems + } + + if (!this.npm.config.isDefault('location')) { + problems = problems.filter((problem) => { + return problem.where === this.npm.config.get('location') + }) + } + + this.npm.config.repair(problems) + const locations = [] + + output.standard('The following configuration problems have been repaired:\n') + const summary = problems.map(({ action, from, to, key, where }) => { + // coverage disabled for else branch because it is intentionally omitted + // istanbul ignore else + if (action === 'rename') { + // we keep track of which configs were modified here so we know what to save later + locations.push(where) + return `~ \`${from}\` renamed to \`${to}\` in ${where} config` + } else if (action === 'delete') { + locations.push(where) + return `- \`${key}\` deleted from ${where} config` + } + }).join('\n') + output.standard(summary) + + return await Promise.all(locations.map((location) => this.npm.config.save(location))) + } + + async list () { + const msg = [] + // long does not have a flattener + const long = this.npm.config.get('long') + for (const [where, { data, source }] of this.npm.config.data.entries()) { + if (where === 'default' && !long) { + continue + } + + const entries = Object.entries(data).sort(([a], [b]) => localeCompare(a, b)) + if (!entries.length) { + continue + } + + msg.push(`; "${where}" config from ${source}`, '') + for (const [k, v] of entries) { + const display = displayVar(k, v) + const src = this.npm.config.find(k) + msg.push(src === where ? display : `; ${display} ; overridden by ${src}`) + msg.push() + } + msg.push('') + } + + if (!long) { + msg.push( + `; node bin location = ${process.execPath}`, + `; node version = ${process.version}`, + `; npm local prefix = ${this.npm.localPrefix}`, + `; npm version = ${this.npm.version}`, + `; cwd = ${process.cwd()}`, + `; HOME = ${process.env.HOME}`, + '; Run `npm config ls -l` to show all defaults.' + ) + msg.push('') + } + + if (!this.npm.global) { + const { content } = await pkgJson.normalize(this.npm.prefix).catch(() => ({ content: {} })) + + if (content.publishConfig) { + const pkgPath = resolve(this.npm.prefix, 'package.json') + msg.push(`; "publishConfig" from ${pkgPath}`) + msg.push('; This set of config values will be used at publish-time.', '') + const entries = Object.entries(content.publishConfig) + .sort(([a], [b]) => localeCompare(a, b)) + for (const [k, value] of entries) { + msg.push(displayVar(k, value)) + } + msg.push('') + } + } + + output.standard(msg.join('\n').trim()) + } + + async listJson () { + const publicConf = {} + for (const key in this.npm.config.list[0]) { + const value = this.npm.config.get(key) + if (isPrivate(key, value)) { + continue + } + + publicConf[key] = value + } + output.buffer(publicConf) + } +} + +module.exports = Config diff --git a/node_modules/npm/lib/commands/dedupe.js b/node_modules/npm/lib/commands/dedupe.js new file mode 100644 index 00000000..e07bcd31 --- /dev/null +++ b/node_modules/npm/lib/commands/dedupe.js @@ -0,0 +1,51 @@ +const reifyFinish = require('../utils/reify-finish.js') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +// dedupe duplicated packages, or find them in the tree +class Dedupe extends ArboristWorkspaceCmd { + static description = 'Reduce duplication in the package tree' + static name = 'dedupe' + static params = [ + 'install-strategy', + 'legacy-bundling', + 'global-style', + 'strict-peer-deps', + 'package-lock', + 'omit', + 'include', + 'ignore-scripts', + 'audit', + 'bin-links', + 'fund', + 'dry-run', + ...super.params, + ] + + async exec () { + if (this.npm.global) { + const er = new Error('`npm dedupe` does not work in global mode.') + er.code = 'EDEDUPEGLOBAL' + throw er + } + + const dryRun = this.npm.config.get('dry-run') + const where = this.npm.prefix + const Arborist = require('@npmcli/arborist') + const opts = { + ...this.npm.flatOptions, + path: where, + dryRun, + // Saving during dedupe would only update if one of your direct + // dependencies was also duplicated somewhere in your tree. It would be + // confusing if running this were to also update your package.json. In + // order to reduce potential confusion we set this to false. + save: false, + workspaces: this.workspaceNames, + } + const arb = new Arborist(opts) + await arb.dedupe(opts) + await reifyFinish(this.npm, arb) + } +} + +module.exports = Dedupe diff --git a/node_modules/npm/lib/commands/deprecate.js b/node_modules/npm/lib/commands/deprecate.js new file mode 100644 index 00000000..95eaf429 --- /dev/null +++ b/node_modules/npm/lib/commands/deprecate.js @@ -0,0 +1,76 @@ +const npmFetch = require('npm-registry-fetch') +const { otplease } = require('../utils/auth.js') +const npa = require('npm-package-arg') +const { log } = require('proc-log') +const semver = require('semver') +const getIdentity = require('../utils/get-identity.js') +const libaccess = require('libnpmaccess') +const BaseCommand = require('../base-cmd.js') + +class Deprecate extends BaseCommand { + static description = 'Deprecate a version of a package' + static name = 'deprecate' + static usage = [' '] + static params = [ + 'registry', + 'otp', + ] + + static ignoreImplicitWorkspace = true + + static async completion (opts, npm) { + if (opts.conf.argv.remain.length > 1) { + return [] + } + + const username = await getIdentity(npm, npm.flatOptions) + const packages = await libaccess.getPackages(username, npm.flatOptions) + return Object.keys(packages) + .filter((name) => + packages[name] === 'write' && + (opts.conf.argv.remain.length === 0 || + name.startsWith(opts.conf.argv.remain[0]))) + } + + async exec ([pkg, msg]) { + // msg == null because '' is a valid value, it indicates undeprecate + if (!pkg || msg == null) { + throw this.usageError() + } + + // fetch the data and make sure it exists. + const p = npa(pkg) + const spec = p.rawSpec === '*' ? '*' : p.fetchSpec + + if (semver.validRange(spec, true) === null) { + throw new Error(`invalid version range: ${spec}`) + } + + const uri = '/' + p.escapedName + const packument = await npmFetch.json(uri, { + ...this.npm.flatOptions, + spec: p, + query: { write: true }, + }) + + const versions = Object.keys(packument.versions) + .filter(v => semver.satisfies(v, spec, { includePrerelease: true })) + + if (versions.length) { + for (const v of versions) { + packument.versions[v].deprecated = msg + } + return otplease(this.npm, this.npm.flatOptions, opts => npmFetch(uri, { + ...opts, + spec: p, + method: 'PUT', + body: packument, + ignoreBody: true, + })) + } else { + log.warn('deprecate', 'No version found for', p.rawSpec) + } + } +} + +module.exports = Deprecate diff --git a/node_modules/npm/lib/commands/diff.js b/node_modules/npm/lib/commands/diff.js new file mode 100644 index 00000000..a97eed92 --- /dev/null +++ b/node_modules/npm/lib/commands/diff.js @@ -0,0 +1,291 @@ +const { resolve } = require('node:path') +const semver = require('semver') +const libnpmdiff = require('libnpmdiff') +const npa = require('npm-package-arg') +const pacote = require('pacote') +const pickManifest = require('npm-pick-manifest') +const { log, output } = require('proc-log') +const pkgJson = require('@npmcli/package-json') +const BaseCommand = require('../base-cmd.js') + +class Diff extends BaseCommand { + static description = 'The registry diff command' + static name = 'diff' + static usage = [ + '[...]', + ] + + static params = [ + 'diff', + 'diff-name-only', + 'diff-unified', + 'diff-ignore-all-space', + 'diff-no-prefix', + 'diff-src-prefix', + 'diff-dst-prefix', + 'diff-text', + 'global', + 'tag', + 'workspace', + 'workspaces', + 'include-workspace-root', + ] + + static workspaces = true + static ignoreImplicitWorkspace = false + + async exec (args) { + const specs = this.npm.config.get('diff').filter(d => d) + if (specs.length > 2) { + throw this.usageError(`Can't use more than two --diff arguments.`) + } + + // execWorkspaces may have set this already + if (!this.prefix) { + this.prefix = this.npm.prefix + } + + // this is the "top" directory, one up from node_modules + // in global mode we have to walk one up from globalDir because our + // node_modules is sometimes under ./lib, and in global mode we're only ever + // walking through node_modules (because we will have been given a package + // name already) + if (this.npm.global) { + this.top = resolve(this.npm.globalDir, '..') + } else { + this.top = this.prefix + } + + const [a, b] = await this.retrieveSpecs(specs) + log.info('diff', { src: a, dst: b }) + + const res = await libnpmdiff([a, b], { + ...this.npm.flatOptions, + diffFiles: args, + where: this.top, + }) + return output.standard(res) + } + + async execWorkspaces (args) { + await this.setWorkspaces() + for (const workspacePath of this.workspacePaths) { + this.top = workspacePath + this.prefix = workspacePath + await this.exec(args) + } + } + + // get the package name from the packument at `path` + // throws if no packument is present OR if it does not have `name` attribute + async packageName () { + let name + try { + const { content: pkg } = await pkgJson.normalize(this.prefix) + name = pkg.name + } catch { + log.verbose('diff', 'could not read project dir package.json') + } + + if (!name) { + throw this.usageError('Needs multiple arguments to compare or run from a project dir.') + } + + return name + } + + async retrieveSpecs ([a, b]) { + if (a && b) { + const specs = await this.convertVersionsToSpecs([a, b]) + return this.findVersionsByPackageName(specs) + } + + // no arguments, defaults to comparing cwd + // to its latest published registry version + if (!a) { + const pkgName = await this.packageName() + return [ + `${pkgName}@${this.npm.config.get('tag')}`, + `file:${this.prefix.replace(/#/g, '%23')}`, + ] + } + + // single argument, used to compare wanted versions of an + // installed dependency or to compare the cwd to a published version + let noPackageJson + let pkgName + try { + const { content: pkg } = await pkgJson.normalize(this.prefix) + pkgName = pkg.name + } catch { + log.verbose('diff', 'could not read project dir package.json') + noPackageJson = true + } + + const missingPackageJson = + this.usageError('Needs multiple arguments to compare or run from a project dir.') + + // using a valid semver range, that means it should just diff + // the cwd against a published version to the registry using the + // same project name and the provided semver range + if (semver.validRange(a)) { + if (!pkgName) { + throw missingPackageJson + } + return [ + `${pkgName}@${a}`, + `file:${this.prefix.replace(/#/g, '%23')}`, + ] + } + + // when using a single package name as arg and it's part of the current + // install tree, then retrieve the current installed version and compare + // it against the same value `npm outdated` would suggest you to update to + const spec = npa(a) + if (spec.registry) { + let actualTree + let node + const Arborist = require('@npmcli/arborist') + try { + const opts = { + ...this.npm.flatOptions, + path: this.top, + } + const arb = new Arborist(opts) + actualTree = await arb.loadActual(opts) + node = actualTree && + actualTree.inventory.query('name', spec.name) + .values().next().value + } catch { + log.verbose('diff', 'failed to load actual install tree') + } + + if (!node || !node.name || !node.package || !node.package.version) { + if (noPackageJson) { + throw missingPackageJson + } + return [ + `${spec.name}@${spec.fetchSpec}`, + `file:${this.prefix.replace(/#/g, '%23')}`, + ] + } + + const tryRootNodeSpec = () => + (actualTree && actualTree.edgesOut.get(spec.name) || {}).spec + + const tryAnySpec = () => { + for (const edge of node.edgesIn) { + return edge.spec + } + } + + const aSpec = `file:${node.realpath.replace(/#/g, '%23')}` + + // finds what version of the package to compare against, if a exact + // version or tag was passed than it should use that, otherwise + // work from the top of the arborist tree to find the original semver + // range declared in the package that depends on the package. + let bSpec + if (spec.rawSpec !== '*') { + bSpec = spec.rawSpec + } else { + const bTargetVersion = + tryRootNodeSpec() + || tryAnySpec() + + // figure out what to compare against, + // follows same logic to npm outdated "Wanted" results + const packument = await pacote.packument(spec, { + ...this.npm.flatOptions, + preferOnline: true, + }) + bSpec = pickManifest( + packument, + bTargetVersion, + { ...this.npm.flatOptions } + ).version + } + + return [ + `${spec.name}@${aSpec}`, + `${spec.name}@${bSpec}`, + ] + } else if (spec.type === 'directory') { + return [ + `file:${spec.fetchSpec.replace(/#/g, '%23')}`, + `file:${this.prefix.replace(/#/g, '%23')}`, + ] + } else { + throw this.usageError(`Spec type ${spec.type} not supported.`) + } + } + + async convertVersionsToSpecs ([a, b]) { + const semverA = semver.validRange(a) + const semverB = semver.validRange(b) + + // both specs are semver versions, assume current project dir name + if (semverA && semverB) { + let pkgName + try { + const { content: pkg } = await pkgJson.normalize(this.prefix) + pkgName = pkg.name + } catch { + log.verbose('diff', 'could not read project dir package.json') + } + + if (!pkgName) { + throw this.usageError('Needs to be run from a project dir in order to diff two versions.') + } + + return [`${pkgName}@${a}`, `${pkgName}@${b}`] + } + + // otherwise uses the name from the other arg to + // figure out the spec.name of what to compare + if (!semverA && semverB) { + return [a, `${npa(a).name}@${b}`] + } + + if (semverA && !semverB) { + return [`${npa(b).name}@${a}`, b] + } + + // no valid semver ranges used + return [a, b] + } + + async findVersionsByPackageName (specs) { + let actualTree + const Arborist = require('@npmcli/arborist') + try { + const opts = { + ...this.npm.flatOptions, + path: this.top, + } + const arb = new Arborist(opts) + actualTree = await arb.loadActual(opts) + } catch { + log.verbose('diff', 'failed to load actual install tree') + } + + return specs.map(i => { + const spec = npa(i) + if (spec.rawSpec !== '*') { + return i + } + + const node = actualTree + && actualTree.inventory.query('name', spec.name) + .values().next().value + + const res = !node || !node.package || !node.package.version + ? spec.fetchSpec + : `file:${node.realpath.replace(/#/g, '%23')}` + + return `${spec.name}@${res}` + }) + } +} + +module.exports = Diff diff --git a/node_modules/npm/lib/commands/dist-tag.js b/node_modules/npm/lib/commands/dist-tag.js new file mode 100644 index 00000000..3fdecd92 --- /dev/null +++ b/node_modules/npm/lib/commands/dist-tag.js @@ -0,0 +1,209 @@ +const npa = require('npm-package-arg') +const npmFetch = require('npm-registry-fetch') +const semver = require('semver') +const { log, output } = require('proc-log') +const { otplease } = require('../utils/auth.js') +const pkgJson = require('@npmcli/package-json') +const BaseCommand = require('../base-cmd.js') + +class DistTag extends BaseCommand { + static description = 'Modify package distribution tags' + static params = ['workspace', 'workspaces', 'include-workspace-root'] + static name = 'dist-tag' + static usage = [ + 'add []', + 'rm ', + 'ls []', + ] + + static workspaces = true + static ignoreImplicitWorkspace = false + + static async completion (opts) { + const argv = opts.conf.argv.remain + if (argv.length === 2) { + return ['add', 'rm', 'ls'] + } + + switch (argv[2]) { + default: + return [] + } + } + + async exec ([cmdName, pkg, tag]) { + const opts = { + ...this.npm.flatOptions, + } + + if (['add', 'a', 'set', 's'].includes(cmdName)) { + return this.add(pkg, tag, opts) + } + + if (['rm', 'r', 'del', 'd', 'remove'].includes(cmdName)) { + return this.remove(pkg, tag, opts) + } + + if (['ls', 'l', 'sl', 'list'].includes(cmdName)) { + return this.list(pkg, opts) + } + + if (!pkg) { + // when only using the pkg name the default behavior + // should be listing the existing tags + return this.list(cmdName, opts) + } else { + throw this.usageError() + } + } + + async execWorkspaces ([cmdName, pkg, tag]) { + // cmdName is some form of list + // pkg is one of: + // - unset + // - . + // - .@version + if (['ls', 'l', 'sl', 'list'].includes(cmdName) && (!pkg || pkg === '.' || /^\.@/.test(pkg))) { + return this.listWorkspaces() + } + + // pkg is unset + // cmdName is one of: + // - unset + // - . + // - .@version + if (!pkg && (!cmdName || cmdName === '.' || /^\.@/.test(cmdName))) { + return this.listWorkspaces() + } + + // anything else is just a regular dist-tag command + // so we fallback to the non-workspaces implementation + log.warn('dist-tag', 'Ignoring workspaces for specified package') + return this.exec([cmdName, pkg, tag]) + } + + async add (spec, tag, opts) { + spec = npa(spec || '') + const version = spec.rawSpec + const defaultTag = tag || this.npm.config.get('tag') + + log.verbose('dist-tag add', defaultTag, 'to', spec.name + '@' + version) + + // make sure new spec with tag is valid, this will throw if invalid + npa(`${spec.name}@${defaultTag}`) + + if (!spec.name || !version || !defaultTag) { + throw this.usageError('must provide a spec with a name and version, and a tag to add') + } + + const t = defaultTag.trim() + + if (semver.validRange(t)) { + throw new Error('Tag name must not be a valid SemVer range: ' + t) + } + + const tags = await this.fetchTags(spec, opts) + if (tags[t] === version) { + log.warn('dist-tag add', t, 'is already set to version', version) + return + } + tags[t] = version + const url = + `/-/package/${spec.escapedName}/dist-tags/${encodeURIComponent(t)}` + const reqOpts = { + ...opts, + method: 'PUT', + body: JSON.stringify(version), + headers: { + 'content-type': 'application/json', + }, + spec, + } + await otplease(this.npm, reqOpts, o => npmFetch(url, o)) + output.standard(`+${t}: ${spec.name}@${version}`) + } + + async remove (spec, tag, opts) { + spec = npa(spec || '') + log.verbose('dist-tag del', tag, 'from', spec.name) + + if (!spec.name) { + throw this.usageError() + } + + const tags = await this.fetchTags(spec, opts) + if (!tags[tag]) { + log.info('dist-tag del', tag, 'is not a dist-tag on', spec.name) + throw new Error(tag + ' is not a dist-tag on ' + spec.name) + } + const version = tags[tag] + delete tags[tag] + const url = + `/-/package/${spec.escapedName}/dist-tags/${encodeURIComponent(tag)}` + const reqOpts = { + ...opts, + method: 'DELETE', + spec, + } + await otplease(this.npm, reqOpts, o => npmFetch(url, o)) + output.standard(`-${tag}: ${spec.name}@${version}`) + } + + async list (spec, opts) { + if (!spec) { + if (this.npm.global) { + throw this.usageError() + } + const { content: { name } } = await pkgJson.normalize(this.npm.prefix) + if (!name) { + throw this.usageError() + } + + return this.list(name, opts) + } + spec = npa(spec) + + try { + const tags = await this.fetchTags(spec, opts) + const msg = + Object.keys(tags).map(k => `${k}: ${tags[k]}`).sort().join('\n') + output.standard(msg) + return tags + } catch (err) { + log.error('dist-tag ls', "Couldn't get dist-tag data for", spec) + throw err + } + } + + async listWorkspaces () { + await this.setWorkspaces() + + for (const name of this.workspaceNames) { + try { + output.standard(`${name}:`) + await this.list(npa(name), this.npm.flatOptions) + } catch { + // set the exitCode directly, but ignore the error + // since it will have already been logged by this.list() + process.exitCode = 1 + } + } + } + + async fetchTags (spec, opts) { + const data = await npmFetch.json( + `/-/package/${spec.escapedName}/dist-tags`, + { ...opts, 'prefer-online': true, spec } + ) + if (data && typeof data === 'object') { + delete data._etag + } + if (!data || !Object.keys(data).length) { + throw new Error('No dist-tags found for ' + spec.name) + } + + return data + } +} + +module.exports = DistTag diff --git a/node_modules/npm/lib/commands/docs.js b/node_modules/npm/lib/commands/docs.js new file mode 100644 index 00000000..2259b49f --- /dev/null +++ b/node_modules/npm/lib/commands/docs.js @@ -0,0 +1,21 @@ +const PackageUrlCmd = require('../package-url-cmd.js') + +class Docs extends PackageUrlCmd { + static description = 'Open documentation for a package in a web browser' + static name = 'docs' + + getUrl (spec, mani) { + if (mani.homepage) { + return mani.homepage + } + + const info = this.hostedFromMani(mani) + if (info) { + return info.docs() + } + + return `https://www.npmjs.com/package/${mani.name}` + } +} + +module.exports = Docs diff --git a/node_modules/npm/lib/commands/doctor.js b/node_modules/npm/lib/commands/doctor.js new file mode 100644 index 00000000..8f87fdc1 --- /dev/null +++ b/node_modules/npm/lib/commands/doctor.js @@ -0,0 +1,347 @@ +const cacache = require('cacache') +const { access, lstat, readdir, constants: { R_OK, W_OK, X_OK } } = require('node:fs/promises') +const npmFetch = require('make-fetch-happen') +const which = require('which') +const pacote = require('pacote') +const { resolve } = require('node:path') +const semver = require('semver') +const { log, output } = require('proc-log') +const ping = require('../utils/ping.js') +const { defaults } = require('@npmcli/config/lib/definitions') +const BaseCommand = require('../base-cmd.js') + +const maskLabel = mask => { + const label = [] + if (mask & R_OK) { + label.push('readable') + } + + if (mask & W_OK) { + label.push('writable') + } + + if (mask & X_OK) { + label.push('executable') + } + + return label.join(', ') +} + +const subcommands = [ + { + // Ping is left in as a legacy command but is listed as "connection" to + // make more sense to more people + groups: ['connection', 'ping', 'registry'], + title: 'Connecting to the registry', + cmd: 'checkPing', + }, { + groups: ['versions'], + title: 'Checking npm version', + cmd: 'getLatestNpmVersion', + }, { + groups: ['versions'], + title: 'Checking node version', + cmd: 'getLatestNodejsVersion', + }, { + groups: ['registry'], + title: 'Checking configured npm registry', + cmd: 'checkNpmRegistry', + }, { + groups: ['environment'], + title: 'Checking for git executable in PATH', + cmd: 'getGitPath', + }, { + groups: ['environment'], + title: 'Checking for global bin folder in PATH', + cmd: 'getBinPath', + }, { + groups: ['permissions', 'cache'], + title: 'Checking permissions on cached files (this may take awhile)', + cmd: 'checkCachePermission', + windows: false, + }, { + groups: ['permissions'], + title: 'Checking permissions on local node_modules (this may take awhile)', + cmd: 'checkLocalModulesPermission', + windows: false, + }, { + groups: ['permissions'], + title: 'Checking permissions on global node_modules (this may take awhile)', + cmd: 'checkGlobalModulesPermission', + windows: false, + }, { + groups: ['permissions'], + title: 'Checking permissions on local bin folder', + cmd: 'checkLocalBinPermission', + windows: false, + }, { + groups: ['permissions'], + title: 'Checking permissions on global bin folder', + cmd: 'checkGlobalBinPermission', + windows: false, + }, { + groups: ['cache'], + title: 'Verifying cache contents (this may take awhile)', + cmd: 'verifyCachedFiles', + windows: false, + }, + // TODO: + // group === 'dependencies'? + // - ensure arborist.loadActual() runs without errors and no invalid edges + // - ensure package-lock.json matches loadActual() + // - verify loadActual without hidden lock file matches hidden lockfile + // group === '???' + // - verify all local packages have bins linked + // What is the fix for these? +] + +class Doctor extends BaseCommand { + static description = 'Check the health of your npm environment' + static name = 'doctor' + static params = ['registry'] + static ignoreImplicitWorkspace = false + static usage = [`[${subcommands.flatMap(s => s.groups) + .filter((value, index, self) => self.indexOf(value) === index && value !== 'ping') + .join('] [')}]`] + + static subcommands = subcommands + + async exec (args) { + log.info('doctor', 'Running checkup') + let allOk = true + + const actions = this.actions(args) + + const chalk = this.npm.chalk + for (const { title, cmd } of actions) { + this.output(title) + // TODO when we have an in progress indicator that could go here + let result + try { + result = await this[cmd]() + this.output(`${chalk.green('Ok')}${result ? `\n${result}` : ''}\n`) + } catch (err) { + allOk = false + this.output(`${chalk.red('Not ok')}\n${chalk.cyan(err)}\n`) + } + } + + if (!allOk) { + if (this.npm.silent) { + /* eslint-disable-next-line max-len */ + throw new Error('Some problems found. Check logs or disable silent mode for recommendations.') + } else { + throw new Error('Some problems found. See above for recommendations.') + } + } + } + + async checkPing () { + log.info('doctor', 'Pinging registry') + try { + await ping({ ...this.npm.flatOptions, retry: false }) + return '' + } catch (er) { + if (/^E\d{3}$/.test(er.code || '')) { + throw er.code.slice(1) + ' ' + er.message + } else { + throw er.message + } + } + } + + async getLatestNpmVersion () { + log.info('doctor', 'Getting npm package information') + const latest = (await pacote.manifest('npm@latest', this.npm.flatOptions)).version + if (semver.gte(this.npm.version, latest)) { + return `current: v${this.npm.version}, latest: v${latest}` + } else { + throw `Use npm v${latest}` + } + } + + async getLatestNodejsVersion () { + // XXX get the latest in the current major as well + const current = process.version + const currentRange = `^${current}` + const url = 'https://nodejs.org/dist/index.json' + log.info('doctor', 'Getting Node.js release information') + const res = await npmFetch(url, { method: 'GET', ...this.npm.flatOptions }) + const data = await res.json() + let maxCurrent = '0.0.0' + let maxLTS = '0.0.0' + for (const { lts, version } of data) { + if (lts && semver.gt(version, maxLTS)) { + maxLTS = version + } + + if (semver.satisfies(version, currentRange) && semver.gt(version, maxCurrent)) { + maxCurrent = version + } + } + const recommended = semver.gt(maxCurrent, maxLTS) ? maxCurrent : maxLTS + if (semver.gte(process.version, recommended)) { + return `current: ${current}, recommended: ${recommended}` + } else { + throw `Use node ${recommended} (current: ${current})` + } + } + + async getBinPath () { + log.info('doctor', 'getBinPath', 'Finding npm global bin in your PATH') + if (!process.env.PATH.includes(this.npm.globalBin)) { + throw new Error(`Add ${this.npm.globalBin} to your $PATH`) + } + return this.npm.globalBin + } + + async checkCachePermission () { + return this.checkFilesPermission(this.npm.cache, true, R_OK) + } + + async checkLocalModulesPermission () { + return this.checkFilesPermission(this.npm.localDir, true, R_OK | W_OK, true) + } + + async checkGlobalModulesPermission () { + return this.checkFilesPermission(this.npm.globalDir, false, R_OK) + } + + async checkLocalBinPermission () { + return this.checkFilesPermission(this.npm.localBin, false, R_OK | W_OK | X_OK, true) + } + + async checkGlobalBinPermission () { + return this.checkFilesPermission(this.npm.globalBin, false, X_OK) + } + + async checkFilesPermission (root, shouldOwn, mask, missingOk) { + let ok = true + + try { + const uid = process.getuid() + const gid = process.getgid() + const files = new Set([root]) + for (const f of files) { + const st = await lstat(f).catch(er => { + // if it can't be missing, or if it can and the error wasn't that it was missing + if (!missingOk || er.code !== 'ENOENT') { + ok = false + log.warn('doctor', 'checkFilesPermission', 'error getting info for ' + f) + } + }) + + if (!st) { + continue + } + + if (shouldOwn && (uid !== st.uid || gid !== st.gid)) { + log.warn('doctor', 'checkFilesPermission', 'should be owner of ' + f) + ok = false + } + + if (!st.isDirectory() && !st.isFile()) { + continue + } + + try { + await access(f, mask) + } catch { + ok = false + const msg = `Missing permissions on ${f} (expect: ${maskLabel(mask)})` + log.error('doctor', 'checkFilesPermission', msg) + continue + } + + if (st.isDirectory()) { + const entries = await readdir(f).catch(() => { + ok = false + log.warn('doctor', 'checkFilesPermission', 'error reading directory ' + f) + return [] + }) + for (const entry of entries) { + files.add(resolve(f, entry)) + } + } + } + } finally { + if (!ok) { + throw ( + `Check the permissions of files in ${root}` + + (shouldOwn ? ' (should be owned by current user)' : '') + ) + } else { + return '' + } + } + } + + async getGitPath () { + log.info('doctor', 'Finding git in your PATH') + return await which('git').catch(er => { + log.warn('doctor', 'getGitPath', er) + throw new Error("Install git and ensure it's in your PATH.") + }) + } + + async verifyCachedFiles () { + log.info('doctor', 'verifyCachedFiles', 'Verifying the npm cache') + + const stats = await cacache.verify(this.npm.flatOptions.cache) + const { badContentCount, reclaimedCount, missingContent, reclaimedSize } = stats + if (badContentCount || reclaimedCount || missingContent) { + if (badContentCount) { + log.warn('doctor', 'verifyCachedFiles', `Corrupted content removed: ${badContentCount}`) + } + + if (reclaimedCount) { + log.warn( + 'doctor', + 'verifyCachedFiles', + `Content garbage-collected: ${reclaimedCount} (${reclaimedSize} bytes)` + ) + } + + if (missingContent) { + log.warn('doctor', 'verifyCachedFiles', `Missing content: ${missingContent}`) + } + + log.warn('doctor', 'verifyCachedFiles', 'Cache issues have been fixed') + } + log.info( + 'doctor', + 'verifyCachedFiles', + `Verification complete. Stats: ${JSON.stringify(stats, null, 2)}` + ) + return `verified ${stats.verifiedContent} tarballs` + } + + async checkNpmRegistry () { + if (this.npm.flatOptions.registry !== defaults.registry) { + throw `Try \`npm config set registry=${defaults.registry}\`` + } else { + return `using default registry (${defaults.registry})` + } + } + + output (...args) { + // TODO display layer should do this + if (!this.npm.silent) { + output.standard(...args) + } + } + + actions (params) { + return this.constructor.subcommands.filter(subcmd => { + if (process.platform === 'win32' && subcmd.windows === false) { + return false + } + if (params.length) { + return params.some(param => subcmd.groups.includes(param)) + } + return true + }) + } +} + +module.exports = Doctor diff --git a/node_modules/npm/lib/commands/edit.js b/node_modules/npm/lib/commands/edit.js new file mode 100644 index 00000000..b2c2ec8d --- /dev/null +++ b/node_modules/npm/lib/commands/edit.js @@ -0,0 +1,64 @@ +const { resolve } = require('node:path') +const { lstat } = require('node:fs/promises') +const cp = require('node:child_process') +const completion = require('../utils/installed-shallow.js') +const BaseCommand = require('../base-cmd.js') + +const splitPackageNames = (path) => path.split('/') +// combine scoped parts + .reduce((parts, part) => { + if (parts.length === 0) { + return [part] + } + + const lastPart = parts[parts.length - 1] + // check if previous part is the first part of a scoped package + if (lastPart[0] === '@' && !lastPart.includes('/')) { + parts[parts.length - 1] += '/' + part + } else { + parts.push(part) + } + + return parts + }, []) + .join('/node_modules/') + .replace(/(\/node_modules)+/, '/node_modules') + +// npm edit +// open the package folder in the $EDITOR +class Edit extends BaseCommand { + static description = 'Edit an installed package' + static name = 'edit' + static usage = ['[/...]'] + static params = ['editor'] + static ignoreImplicitWorkspace = false + + // TODO + /* istanbul ignore next */ + static async completion (opts, npm) { + return completion(npm, opts) + } + + async exec (args) { + if (args.length !== 1) { + throw this.usageError() + } + + const path = splitPackageNames(args[0]) + const dir = resolve(this.npm.dir, path) + + await lstat(dir) + await new Promise((res, rej) => { + const [bin, ...spawnArgs] = this.npm.config.get('editor').split(/\s+/) + const editor = cp.spawn(bin, [...spawnArgs, dir], { stdio: 'inherit' }) + editor.on('exit', async (code) => { + if (code) { + return rej(new Error(`editor process exited with code: ${code}`)) + } + await this.npm.exec('rebuild', [dir]).then(res).catch(rej) + }) + }) + } +} + +module.exports = Edit diff --git a/node_modules/npm/lib/commands/exec.js b/node_modules/npm/lib/commands/exec.js new file mode 100644 index 00000000..57ee8efe --- /dev/null +++ b/node_modules/npm/lib/commands/exec.js @@ -0,0 +1,110 @@ +const { resolve } = require('node:path') +const libexec = require('libnpmexec') +const BaseCommand = require('../base-cmd.js') + +class Exec extends BaseCommand { + static description = 'Run a command from a local or remote npm package' + static params = [ + 'package', + 'call', + 'workspace', + 'workspaces', + 'include-workspace-root', + ] + + static name = 'exec' + static usage = [ + '-- [@] [args...]', + '--package=[@] -- [args...]', + '-c \' [args...]\'', + '--package=foo -c \' [args...]\'', + ] + + static workspaces = true + static ignoreImplicitWorkspace = false + static isShellout = true + + async exec (args) { + return this.callExec(args) + } + + async execWorkspaces (args) { + await this.setWorkspaces() + + for (const [name, path] of this.workspaces) { + const locationMsg = + `in workspace ${this.npm.chalk.green(name)} at location:\n${this.npm.chalk.dim(path)}` + await this.callExec(args, { name, locationMsg, runPath: path }) + } + } + + async callExec (args, { name, locationMsg, runPath } = {}) { + let localBin = this.npm.localBin + let pkgPath = this.npm.localPrefix + + // This is where libnpmexec will actually run the scripts from + if (!runPath) { + runPath = process.cwd() + } else { + // We have to consider if the workspace has its own separate versions + // libnpmexec will walk up to localDir after looking here + localBin = resolve(this.npm.localDir, name, 'node_modules', '.bin') + // We also need to look for `bin` entries in the workspace package.json + // libnpmexec will NOT look in the project root for the bin entry + pkgPath = runPath + } + + const call = this.npm.config.get('call') + let globalPath + const { + flatOptions, + globalBin, + globalDir, + chalk, + } = this.npm + const scriptShell = this.npm.config.get('script-shell') || undefined + const packages = this.npm.config.get('package') + const yes = this.npm.config.get('yes') + // --prefix sets both of these to the same thing, meaning the global prefix + // is invalid (i.e. no lib/node_modules). This is not a trivial thing to + // untangle and fix so we work around it here. + if (this.npm.localPrefix !== this.npm.globalPrefix) { + globalPath = resolve(globalDir, '..') + } + + if (call && args.length) { + throw this.usageError() + } + + return libexec({ + ...flatOptions, + // we explicitly set packageLockOnly to false because if it's true + // when we try to install a missing package, we won't actually install it + packageLockOnly: false, + // what the user asked to run args[0] is run by default + args: [...args], // copy args so they dont get mutated + // specify a custom command to be run instead of args[0] + call, + chalk, + // where to look for bins globally, if a file matches call or args[0] it is called + globalBin, + // where to look for packages globally, if a package matches call or args[0] it is called + globalPath, + // where to look for bins locally, if a file matches call or args[0] it is called + localBin, + locationMsg, + // packages that need to be installed + packages, + // path where node_modules is + path: this.npm.localPrefix, + // where to look for package.json#bin entries first + pkgPath, + // cwd to run from + runPath, + scriptShell, + yes, + }) + } +} + +module.exports = Exec diff --git a/node_modules/npm/lib/commands/explain.js b/node_modules/npm/lib/commands/explain.js new file mode 100644 index 00000000..1505b4db --- /dev/null +++ b/node_modules/npm/lib/commands/explain.js @@ -0,0 +1,130 @@ +const { explainNode } = require('../utils/explain-dep.js') +const npa = require('npm-package-arg') +const semver = require('semver') +const { relative, resolve } = require('node:path') +const validName = require('validate-npm-package-name') +const { output } = require('proc-log') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +class Explain extends ArboristWorkspaceCmd { + static description = 'Explain installed packages' + static name = 'explain' + static usage = [''] + static params = [ + 'json', + 'workspace', + ] + + static ignoreImplicitWorkspace = false + + // TODO + /* istanbul ignore next */ + static async completion (opts, npm) { + const completion = require('../utils/installed-deep.js') + return completion(npm, opts) + } + + async exec (args) { + if (!args.length) { + throw this.usageError() + } + + const Arborist = require('@npmcli/arborist') + const arb = new Arborist({ path: this.npm.prefix, ...this.npm.flatOptions }) + const tree = await arb.loadActual() + + if (this.npm.flatOptions.workspacesEnabled + && this.workspaceNames + && this.workspaceNames.length + ) { + this.filterSet = arb.workspaceDependencySet(tree, this.workspaceNames) + } else if (!this.npm.flatOptions.workspacesEnabled) { + this.filterSet = + arb.excludeWorkspacesDependencySet(tree) + } + + const nodes = new Set() + for (const arg of args) { + for (const node of this.getNodes(tree, arg)) { + const filteredOut = this.filterSet + && this.filterSet.size > 0 + && !this.filterSet.has(node) + if (!filteredOut) { + nodes.add(node) + } + } + } + if (nodes.size === 0) { + throw new Error(`No dependencies found matching ${args.join(', ')}`) + } + + const expls = [] + for (const node of nodes) { + const { extraneous, dev, optional, devOptional, peer, inBundle, overridden } = node + const expl = node.explain() + if (extraneous) { + expl.extraneous = true + } else { + expl.dev = dev + expl.optional = optional + expl.devOptional = devOptional + expl.peer = peer + expl.bundled = inBundle + expl.overridden = overridden + } + expls.push(expl) + } + + if (this.npm.flatOptions.json) { + output.buffer(expls) + } else { + output.standard(expls.map(expl => { + return explainNode(expl, Infinity, this.npm.chalk) + }).join('\n\n')) + } + } + + getNodes (tree, arg) { + // if it's just a name, return packages by that name + const { validForOldPackages: valid } = validName(arg) + if (valid) { + return tree.inventory.query('packageName', arg) + } + + // if it's a location, get that node + const maybeLoc = arg.replace(/\\/g, '/').replace(/\/+$/, '') + const nodeByLoc = tree.inventory.get(maybeLoc) + if (nodeByLoc) { + return [nodeByLoc] + } + + // maybe a path to a node_modules folder + const maybePath = relative(this.npm.prefix, resolve(maybeLoc)) + .replace(/\\/g, '/').replace(/\/+$/, '') + const nodeByPath = tree.inventory.get(maybePath) + if (nodeByPath) { + return [nodeByPath] + } + + // otherwise, try to select all matching nodes + try { + return this.getNodesByVersion(tree, arg) + } catch { + return [] + } + } + + getNodesByVersion (tree, arg) { + const spec = npa(arg, this.npm.prefix) + if (spec.type !== 'version' && spec.type !== 'range') { + return [] + } + + return tree.inventory.filter(node => { + return node.package.name === spec.name && + semver.satisfies(node.package.version, spec.rawSpec) + }) + } +} + +module.exports = Explain diff --git a/node_modules/npm/lib/commands/explore.js b/node_modules/npm/lib/commands/explore.js new file mode 100644 index 00000000..184af2bd --- /dev/null +++ b/node_modules/npm/lib/commands/explore.js @@ -0,0 +1,74 @@ +const pkgJson = require('@npmcli/package-json') +const runScript = require('@npmcli/run-script') +const { join, relative } = require('node:path') +const { log, output } = require('proc-log') +const completion = require('../utils/installed-shallow.js') +const BaseCommand = require('../base-cmd.js') + +// npm explore [@] +// open a subshell to the package folder. +class Explore extends BaseCommand { + static description = 'Browse an installed package' + static name = 'explore' + static usage = [' [ -- ]'] + static params = ['shell'] + static ignoreImplicitWorkspace = false + + // TODO + /* istanbul ignore next */ + static async completion (opts, npm) { + return completion(npm, opts) + } + + async exec (args) { + if (args.length < 1 || !args[0]) { + throw this.usageError() + } + + const pkgname = args.shift() + + // detect and prevent any .. shenanigans + const path = join(this.npm.dir, join('/', pkgname)) + if (relative(path, this.npm.dir) === '') { + throw this.usageError() + } + + // run as if running a script named '_explore', which we set to either + // the set of arguments, or the shell config, and let @npmcli/run-script + // handle all the escaping and PATH setup stuff. + + const { content: pkg } = await pkgJson.normalize(path).catch(er => { + log.error('explore', `It doesn't look like ${pkgname} is installed.`) + throw er + }) + + const { shell } = this.npm.flatOptions + pkg.scripts = { + ...(pkg.scripts || {}), + _explore: args.join(' ').trim() || shell, + } + + if (!args.length) { + output.standard(`\nExploring ${path}\nType 'exit' or ^D when finished\n`) + } + + return runScript({ + ...this.npm.flatOptions, + pkg, + path, + event: '_explore', + stdio: 'inherit', + }).catch(er => { + process.exitCode = typeof er.code === 'number' && er.code !== 0 ? er.code + : 1 + // if it's not an exit error, or non-interactive, throw it + const isProcExit = er.message === 'command failed' && + (typeof er.code === 'number' || /^SIG/.test(er.signal || '')) + if (args.length || !isProcExit) { + throw er + } + }) + } +} + +module.exports = Explore diff --git a/node_modules/npm/lib/commands/find-dupes.js b/node_modules/npm/lib/commands/find-dupes.js new file mode 100644 index 00000000..735ac7c4 --- /dev/null +++ b/node_modules/npm/lib/commands/find-dupes.js @@ -0,0 +1,28 @@ +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +// dedupe duplicated packages, or find them in the tree +class FindDupes extends ArboristWorkspaceCmd { + static description = 'Find duplication in the package tree' + static name = 'find-dupes' + static params = [ + 'install-strategy', + 'legacy-bundling', + 'global-style', + 'strict-peer-deps', + 'package-lock', + 'omit', + 'include', + 'ignore-scripts', + 'audit', + 'bin-links', + 'fund', + ...super.params, + ] + + async exec () { + this.npm.config.set('dry-run', true) + return this.npm.exec('dedupe', []) + } +} + +module.exports = FindDupes diff --git a/node_modules/npm/lib/commands/fund.js b/node_modules/npm/lib/commands/fund.js new file mode 100644 index 00000000..8c194dac --- /dev/null +++ b/node_modules/npm/lib/commands/fund.js @@ -0,0 +1,221 @@ +const archy = require('archy') +const pacote = require('pacote') +const semver = require('semver') +const { output } = require('proc-log') +const npa = require('npm-package-arg') +const { depth } = require('treeverse') +const { readTree: getFundingInfo, normalizeFunding, isValidFunding } = require('libnpmfund') +const { openUrl } = require('../utils/open-url.js') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +const getPrintableName = ({ name, version }) => { + const printableVersion = version ? `@${version}` : '' + return `${name}${printableVersion}` +} + +const errCode = (msg, code) => Object.assign(new Error(msg), { code }) + +class Fund extends ArboristWorkspaceCmd { + static description = 'Retrieve funding information' + static name = 'fund' + static params = ['json', 'browser', 'unicode', 'workspace', 'which'] + static usage = ['[]'] + + // XXX: maybe worth making this generic for all commands? + usageMessage (paramsObj = {}) { + let msg = `\`npm ${this.constructor.name}` + const params = Object.entries(paramsObj) + if (params.length) { + msg += ` ${this.constructor.usage}` + } + for (const [key, value] of params) { + msg += ` --${key}=${value}` + } + return `${msg}\`` + } + + // TODO + /* istanbul ignore next */ + static async completion (opts, npm) { + const completion = require('../utils/installed-deep.js') + return completion(npm, opts) + } + + async exec (args) { + const spec = args[0] + + let fundingSourceNumber = this.npm.config.get('which') + if (fundingSourceNumber != null) { + fundingSourceNumber = parseInt(fundingSourceNumber, 10) + if (isNaN(fundingSourceNumber) || fundingSourceNumber < 1) { + throw errCode( + `${this.usageMessage({ which: 'fundingSourceNumber' })} must be given a positive integer`, + 'EFUNDNUMBER' + ) + } + } + + if (this.npm.global) { + throw errCode( + `${this.usageMessage()} does not support global packages`, + 'EFUNDGLOBAL' + ) + } + + const where = this.npm.prefix + const Arborist = require('@npmcli/arborist') + const arb = new Arborist({ ...this.npm.flatOptions, path: where }) + const tree = await arb.loadActual() + + if (spec) { + await this.openFundingUrl({ + path: where, + tree, + spec, + fundingSourceNumber, + }) + return + } + + // TODO: add !workspacesEnabled option handling to libnpmfund + const fundingInfo = getFundingInfo(tree, { + ...this.flatOptions, + Arborist, + workspaces: this.workspaceNames, + }) + + if (this.npm.config.get('json')) { + output.buffer(fundingInfo) + } else { + output.standard(this.printHuman(fundingInfo)) + } + } + + printHuman (fundingInfo) { + const unicode = this.npm.config.get('unicode') + const seenUrls = new Map() + + const tree = obj => archy(obj, '', { unicode }) + + const result = depth({ + tree: fundingInfo, + + // composes human readable package name + // and creates a new archy item for readable output + visit: ({ name, version, funding }) => { + const [fundingSource] = [].concat(normalizeFunding(funding)).filter(isValidFunding) + const { url } = fundingSource || {} + const pkgRef = getPrintableName({ name, version }) + + if (!url) { + return { label: pkgRef } + } + let item + if (seenUrls.has(url)) { + item = seenUrls.get(url) + item.label += `${this.npm.chalk.dim(',')} ${pkgRef}` + return null + } + item = { + label: tree({ + label: this.npm.chalk.blue(url), + nodes: [pkgRef], + }).trim(), + } + + // stacks all packages together under the same item + seenUrls.set(url, item) + return item + }, + + // puts child nodes back into returned archy + // output while also filtering out missing items + leave: (item, children) => { + if (item) { + item.nodes = children.filter(Boolean) + } + + return item + }, + + // turns tree-like object return by libnpmfund + // into children to be properly read by treeverse + getChildren: node => + Object.keys(node.dependencies || {}).map(key => ({ + name: key, + ...node.dependencies[key], + })), + }) + + const res = tree(result) + return res + } + + async openFundingUrl ({ path, tree, spec, fundingSourceNumber }) { + const arg = npa(spec, path) + + const retrievePackageMetadata = () => { + if (arg.type === 'directory') { + if (tree.path === arg.fetchSpec) { + // matches cwd, e.g: npm fund . + return tree.package + } else { + // matches any file path within current arborist inventory + for (const item of tree.inventory.values()) { + if (item.path === arg.fetchSpec) { + return item.package + } + } + } + } else { + // tries to retrieve a package from arborist inventory + // by matching resulted package name from the provided spec + const [item] = [...tree.inventory.query('name', arg.name)] + .filter(i => semver.valid(i.package.version)) + .sort((a, b) => semver.rcompare(a.package.version, b.package.version)) + + if (item) { + return item.package + } + } + } + + const { funding } = + retrievePackageMetadata() || + (await pacote.manifest(arg, this.npm.flatOptions).catch(() => ({}))) + + const validSources = [].concat(normalizeFunding(funding)).filter(isValidFunding) + + if (!validSources.length) { + throw errCode(`No valid funding method available for: ${spec}`, 'ENOFUND') + } + + const fundSource = fundingSourceNumber + ? validSources[fundingSourceNumber - 1] + : validSources.length === 1 ? validSources[0] + : null + + if (fundSource) { + return openUrl(this.npm, ...this.urlMessage(fundSource)) + } + + const ambiguousUrlMsg = [ + ...validSources.map((s, i) => `${i + 1}: ${this.urlMessage(s).reverse().join(': ')}`), + `Run ${this.usageMessage({ which: '1' })}` + + ', for example, to open the first funding URL listed in that package', + ] + if (fundingSourceNumber) { + ambiguousUrlMsg.unshift(`--which=${fundingSourceNumber} is not a valid index`) + } + output.standard(ambiguousUrlMsg.join('\n')) + } + + urlMessage (source) { + const { type, url } = source + const typePrefix = type ? `${type} funding` : 'Funding' + const message = `${typePrefix} available at the following URL` + return [url, message] + } +} + +module.exports = Fund diff --git a/node_modules/npm/lib/commands/get.js b/node_modules/npm/lib/commands/get.js new file mode 100644 index 00000000..4191f2c9 --- /dev/null +++ b/node_modules/npm/lib/commands/get.js @@ -0,0 +1,23 @@ +const Npm = require('../npm.js') +const BaseCommand = require('../base-cmd.js') + +class Get extends BaseCommand { + static description = 'Get a value from the npm configuration' + static name = 'get' + static usage = ['[ ...] (See `npm config`)'] + static params = ['long'] + static ignoreImplicitWorkspace = false + + // TODO + /* istanbul ignore next */ + static async completion (opts) { + const Config = Npm.cmd('config') + return Config.completion(opts) + } + + async exec (args) { + return this.npm.exec('config', ['get'].concat(args)) + } +} + +module.exports = Get diff --git a/node_modules/npm/lib/commands/help-search.js b/node_modules/npm/lib/commands/help-search.js new file mode 100644 index 00000000..72dd03ac --- /dev/null +++ b/node_modules/npm/lib/commands/help-search.js @@ -0,0 +1,195 @@ +const { readFile } = require('node:fs/promises') +const path = require('node:path') +const { glob } = require('glob') +const { output } = require('proc-log') +const BaseCommand = require('../base-cmd.js') + +const globify = pattern => pattern.split('\\').join('/') + +class HelpSearch extends BaseCommand { + static description = 'Search npm help documentation' + static name = 'help-search' + static usage = [''] + static params = ['long'] + + async exec (args) { + if (!args.length) { + throw this.usageError() + } + + const docPath = path.resolve(this.npm.npmRoot, 'docs/content') + let files = await glob(`${globify(docPath)}/*/*.md`) + // preserve glob@8 behavior + files = files.sort((a, b) => a.localeCompare(b, 'en')) + const data = await this.readFiles(files) + const results = await this.searchFiles(args, data) + const formatted = this.formatResults(args, results) + if (!formatted.trim()) { + output.standard(`No matches in help for: ${args.join(' ')}\n`) + } else { + output.standard(formatted) + } + } + + async readFiles (files) { + const res = {} + await Promise.all(files.map(async file => { + res[file] = (await readFile(file, 'utf8')) + .replace(/^---\n(.*\n)*?---\n/, '').trim() + })) + return res + } + + async searchFiles (args, data) { + const results = [] + for (const [file, content] of Object.entries(data)) { + const lowerCase = content.toLowerCase() + // skip if no matches at all + if (!args.some(a => lowerCase.includes(a.toLowerCase()))) { + continue + } + + const lines = content.split(/\n+/) + + // if a line has a search term, then skip it and the next line. + // if the next line has a search term, then skip all 3 + // otherwise, set the line to null. then remove the nulls. + for (let i = 0; i < lines.length; i++) { + const line = lines[i] + const nextLine = lines[i + 1] + let match = false + if (nextLine) { + match = args.some(a => + nextLine.toLowerCase().includes(a.toLowerCase())) + if (match) { + // skip over the next line, and the line after it. + i += 2 + continue + } + } + + match = args.some(a => line.toLowerCase().includes(a.toLowerCase())) + + if (match) { + // skip over the next line + i++ + continue + } + + lines[i] = null + } + + // now squish any string of nulls into a single null + const pruned = lines.reduce((l, r) => { + if (!(r === null && l[l.length - 1] === null)) { + l.push(r) + } + + return l + }, []) + + if (pruned[pruned.length - 1] === null) { + pruned.pop() + } + + if (pruned[0] === null) { + pruned.shift() + } + + // now count how many args were found + const found = {} + let totalHits = 0 + for (const line of pruned) { + for (const arg of args) { + const hit = (line || '').toLowerCase() + .split(arg.toLowerCase()).length - 1 + + if (hit > 0) { + found[arg] = (found[arg] || 0) + hit + totalHits += hit + } + } + } + + const cmd = 'npm help ' + + path.basename(file, '.md').replace(/^npm-/, '') + results.push({ + file, + cmd, + lines: pruned, + found: Object.keys(found), + hits: found, + totalHits, + }) + } + + // sort results by number of results found, then by number of hits + // then by number of matching lines + + // coverage is ignored here because the contents of results are + // nondeterministic due to either glob or readFiles or Object.entries + return results.sort(/* istanbul ignore next */ (a, b) => + a.found.length > b.found.length ? -1 + : a.found.length < b.found.length ? 1 + : a.totalHits > b.totalHits ? -1 + : a.totalHits < b.totalHits ? 1 + : a.lines.length > b.lines.length ? -1 + : a.lines.length < b.lines.length ? 1 + : 0).slice(0, 10) + } + + formatResults (args, results) { + const cols = Math.min(process.stdout.columns || Infinity, 80) + 1 + + const formattedOutput = results.map(res => { + const out = [res.cmd] + const r = Object.keys(res.hits) + .map(k => `${k}:${res.hits[k]}`) + .sort((a, b) => a > b ? 1 : -1) + .join(' ') + + out.push(' '.repeat((Math.max(1, cols - out.join(' ').length - r.length - 1)))) + out.push(r) + + if (!this.npm.config.get('long')) { + return out.join('') + } + + out.unshift('\n\n') + out.push('\n') + out.push('-'.repeat(cols - 1) + '\n') + res.lines.forEach((line, i) => { + if (line === null || i > 3) { + return + } + + const hilitLine = [] + for (const arg of args) { + const finder = line.toLowerCase().split(arg.toLowerCase()) + let p = 0 + for (const f of finder) { + hilitLine.push(line.slice(p, p + f.length)) + const word = line.slice(p + f.length, p + f.length + arg.length) + hilitLine.push(this.npm.chalk.blue(word)) + p += f.length + arg.length + } + } + out.push(hilitLine.join('') + '\n') + }) + + return out.join('') + }).join('\n') + + const finalOut = results.length && !this.npm.config.get('long') + ? 'Top hits for ' + (args.map(JSON.stringify).join(' ')) + '\n' + + '—'.repeat(cols - 1) + '\n' + + formattedOutput + '\n' + + '—'.repeat(cols - 1) + '\n' + + '(run with -l or --long to see more context)' + : formattedOutput + + return finalOut.trim() + } +} + +module.exports = HelpSearch diff --git a/node_modules/npm/lib/commands/help.js b/node_modules/npm/lib/commands/help.js new file mode 100644 index 00000000..057090da --- /dev/null +++ b/node_modules/npm/lib/commands/help.js @@ -0,0 +1,117 @@ +const spawn = require('@npmcli/promise-spawn') +const path = require('node:path') +const { openUrl } = require('../utils/open-url.js') +const { glob } = require('glob') +const { output, input } = require('proc-log') +const localeCompare = require('@isaacs/string-locale-compare')('en') +const { deref } = require('../utils/cmd-list.js') +const BaseCommand = require('../base-cmd.js') + +const globify = pattern => pattern.split('\\').join('/') + +// Strips out the number from foo.7 or foo.7. or foo.7.tgz +// We don't currently compress our man pages but if we ever did this would +// seamlessly continue supporting it +const manNumberRegex = /\.(\d+)(\.[^/\\]*)?$/ +// hardcoded names for mansections +// XXX: these are used in the docs workspace and should be exported +// from npm so section names can changed more easily +const manSectionNames = { + 1: 'commands', + 5: 'configuring-npm', + 7: 'using-npm', +} + +class Help extends BaseCommand { + static description = 'Get help on npm' + static name = 'help' + static usage = [' []'] + static params = ['viewer'] + + static async completion (opts, npm) { + if (opts.conf.argv.remain.length > 2) { + return [] + } + const g = path.resolve(npm.npmRoot, 'man/man[0-9]/*.[0-9]') + let files = await glob(globify(g)) + // preserve glob@8 behavior + files = files.sort((a, b) => a.localeCompare(b, 'en')) + + return Object.keys(files.reduce(function (acc, file) { + file = path.basename(file).replace(/\.[0-9]+$/, '') + file = file.replace(/^npm-/, '') + acc[file] = true + return acc + }, { help: true })) + } + + async exec (args) { + // By default we search all of our man subdirectories, but if the user has + // asked for a specific one we limit the search to just there + const manSearch = /^\d+$/.test(args[0]) ? `man${args.shift()}` : 'man*' + + if (!args.length) { + return output.standard(this.npm.usage) + } + + // npm help foo bar baz: search topics + if (args.length > 1) { + return this.helpSearch(args) + } + + // `npm help package.json` + const arg = (deref(args[0]) || args[0]).replace('.json', '-json') + + // find either section.n or npm-section.n + const f = globify(path.resolve(this.npm.npmRoot, `man/${manSearch}/?(npm-)${arg}.[0-9]*`)) + + const [man] = await glob(f).then(r => r.sort((a, b) => { + // Because the glob is (subtly) different from manNumberRegex, + // we can't rely on it passing. + const aManNumberMatch = a.match(manNumberRegex)?.[1] || 999 + const bManNumberMatch = b.match(manNumberRegex)?.[1] || 999 + if (aManNumberMatch !== bManNumberMatch) { + return aManNumberMatch - bManNumberMatch + } + return localeCompare(a, b) + })) + + return man ? this.viewMan(man) : this.helpSearch(args) + } + + helpSearch (args) { + return this.npm.exec('help-search', args) + } + + async viewMan (man) { + const viewer = this.npm.config.get('viewer') + + if (viewer === 'browser') { + return openUrl(this.npm, this.htmlMan(man), 'help available at the following URL', true) + } + + let args = ['man', [man]] + if (viewer === 'woman') { + args = ['emacsclient', ['-e', `(woman-find-file '${man}')`]] + } + + try { + await input.start(() => spawn(...args, { stdio: 'inherit' })) + } catch (err) { + if (err.code) { + throw new Error(`help process exited with code: ${err.code}`) + } else { + throw err + } + } + } + + // Returns the path to the html version of the man page + htmlMan (man) { + const sect = manSectionNames[man.match(manNumberRegex)[1]] + const f = path.basename(man).replace(manNumberRegex, '') + return 'file:///' + path.resolve(this.npm.npmRoot, `docs/output/${sect}/${f}.html`) + } +} + +module.exports = Help diff --git a/node_modules/npm/lib/commands/init.js b/node_modules/npm/lib/commands/init.js new file mode 100644 index 00000000..bef54b0e --- /dev/null +++ b/node_modules/npm/lib/commands/init.js @@ -0,0 +1,238 @@ +const { statSync } = require('node:fs') +const { relative, resolve } = require('node:path') +const { mkdir } = require('node:fs/promises') +const initJson = require('init-package-json') +const npa = require('npm-package-arg') +const libexec = require('libnpmexec') +const mapWorkspaces = require('@npmcli/map-workspaces') +const PackageJson = require('@npmcli/package-json') +const { log, output, input } = require('proc-log') +const updateWorkspaces = require('../utils/update-workspaces.js') +const BaseCommand = require('../base-cmd.js') + +const posixPath = p => p.split('\\').join('/') + +class Init extends BaseCommand { + static description = 'Create a package.json file' + static params = [ + 'init-author-name', + 'init-author-url', + 'init-license', + 'init-module', + 'init-version', + 'yes', + 'force', + 'scope', + 'workspace', + 'workspaces', + 'workspaces-update', + 'include-workspace-root', + ] + + static name = 'init' + static usage = [ + ' (same as `npx create-`)', + '<@scope> (same as `npx <@scope>/create`)', + ] + + static workspaces = true + static ignoreImplicitWorkspace = false + + async exec (args) { + // npm exec style + if (args.length) { + return await this.execCreate(args) + } + + // no args, uses classic init-package-json boilerplate + await this.template() + } + + async execWorkspaces (args) { + // if the root package is uninitiated, take care of it first + if (this.npm.flatOptions.includeWorkspaceRoot) { + await this.exec(args) + } + + // reads package.json for the top-level folder first, by doing this we + // ensure the command throw if no package.json is found before trying + // to create a workspace package.json file or its folders + const { content: pkg } = await PackageJson.normalize(this.npm.localPrefix).catch(err => { + if (err.code === 'ENOENT') { + log.warn('init', 'Missing package.json. Try with `--include-workspace-root`.') + } + throw err + }) + + // these are workspaces that are being created, so we cant use + // this.setWorkspaces() + const filters = this.npm.config.get('workspace') + const wPath = filterArg => resolve(this.npm.localPrefix, filterArg) + + const workspacesPaths = [] + // npm-exec style, runs in the context of each workspace filter + if (args.length) { + for (const filterArg of filters) { + const path = wPath(filterArg) + await mkdir(path, { recursive: true }) + workspacesPaths.push(path) + await this.execCreate(args, path) + await this.setWorkspace(pkg, path) + } + return + } + + // no args, uses classic init-package-json boilerplate + for (const filterArg of filters) { + const path = wPath(filterArg) + await mkdir(path, { recursive: true }) + workspacesPaths.push(path) + await this.template(path) + await this.setWorkspace(pkg, path) + } + + // reify packages once all workspaces have been initialized + await this.update(workspacesPaths) + } + + async execCreate (args, runPath = process.cwd()) { + const [initerName, ...otherArgs] = args + let packageName = initerName + + // Only a scope, possibly with a version + if (/^@[^/]+$/.test(initerName)) { + const [, scope, version] = initerName.split('@') + packageName = `@${scope}/create` + if (version) { + packageName = `${packageName}@${version}` + } + } else { + const req = npa(initerName) + if (req.type === 'git' && req.hosted) { + const { user, project } = req.hosted + packageName = initerName.replace(`${user}/${project}`, `${user}/create-${project}`) + } else if (req.registry) { + packageName = `${req.name.replace(/^(@[^/]+\/)?/, '$1create-')}@${req.rawSpec}` + } else { + throw Object.assign(new Error( + 'Unrecognized initializer: ' + initerName + + '\nFor more package binary executing power check out `npx`:' + + '\nhttps://docs.npmjs.com/cli/commands/npx' + ), { code: 'EUNSUPPORTED' }) + } + } + + const newArgs = [packageName, ...otherArgs] + const { + flatOptions, + localBin, + globalBin, + chalk, + } = this.npm + const scriptShell = this.npm.config.get('script-shell') || undefined + const yes = this.npm.config.get('yes') + + await libexec({ + ...flatOptions, + args: newArgs, + localBin, + globalBin, + output, + chalk, + path: this.npm.localPrefix, + runPath, + scriptShell, + yes, + }) + } + + async template (path = process.cwd()) { + const initFile = this.npm.config.get('init-module') + if (!this.npm.config.get('yes') && !this.npm.config.get('force')) { + output.standard([ + 'This utility will walk you through creating a package.json file.', + 'It only covers the most common items, and tries to guess sensible defaults.', + '', + 'See `npm help init` for definitive documentation on these fields', + 'and exactly what they do.', + '', + 'Use `npm install ` afterwards to install a package and', + 'save it as a dependency in the package.json file.', + '', + 'Press ^C at any time to quit.', + ].join('\n')) + } + + try { + const data = await input.read(() => initJson(path, initFile, this.npm.config)) + log.silly('package data', data) + return data + } catch (er) { + if (er.message === 'canceled') { + log.warn('init', 'canceled') + } else { + throw er + } + } + } + + async setWorkspace (pkg, workspacePath) { + const workspaces = await mapWorkspaces({ cwd: this.npm.localPrefix, pkg }) + + // skip setting workspace if current package.json glob already satisfies it + for (const wPath of workspaces.values()) { + if (wPath === workspacePath) { + return + } + } + + // if a create-pkg didn't generate a package.json at the workspace + // folder level, it might not be recognized as a workspace by + // mapWorkspaces, so we're just going to avoid touching the + // top-level package.json + try { + statSync(resolve(workspacePath, 'package.json')) + } catch { + return + } + + const pkgJson = await PackageJson.load(this.npm.localPrefix) + + pkgJson.update({ + workspaces: [ + ...(pkgJson.content.workspaces || []), + posixPath(relative(this.npm.localPrefix, workspacePath)), + ], + }) + + await pkgJson.save() + } + + async update (workspacesPaths) { + // translate workspaces paths into an array containing workspaces names + const workspaces = [] + for (const path of workspacesPaths) { + const { content: { name } } = await PackageJson.normalize(path).catch(() => ({ content: {} })) + + if (name) { + workspaces.push(name) + } + } + + const { + config, + flatOptions, + localPrefix, + } = this.npm + + await updateWorkspaces({ + config, + flatOptions, + localPrefix, + npm: this.npm, + workspaces, + }) + } +} + +module.exports = Init diff --git a/node_modules/npm/lib/commands/install-ci-test.js b/node_modules/npm/lib/commands/install-ci-test.js new file mode 100644 index 00000000..4b9dd269 --- /dev/null +++ b/node_modules/npm/lib/commands/install-ci-test.js @@ -0,0 +1,15 @@ +const CI = require('./ci.js') + +// npm install-ci-test +// Runs `npm ci` and then runs `npm test` +class InstallCITest extends CI { + static description = 'Install a project with a clean slate and run tests' + static name = 'install-ci-test' + + async exec (args) { + await this.npm.exec('ci', args) + return this.npm.exec('test', []) + } +} + +module.exports = InstallCITest diff --git a/node_modules/npm/lib/commands/install-test.js b/node_modules/npm/lib/commands/install-test.js new file mode 100644 index 00000000..e21ca7c9 --- /dev/null +++ b/node_modules/npm/lib/commands/install-test.js @@ -0,0 +1,15 @@ +const Install = require('./install.js') + +// npm install-test +// Runs `npm install` and then runs `npm test` +class InstallTest extends Install { + static description = 'Install package(s) and run tests' + static name = 'install-test' + + async exec (args) { + await this.npm.exec('install', args) + return this.npm.exec('test', []) + } +} + +module.exports = InstallTest diff --git a/node_modules/npm/lib/commands/install.js b/node_modules/npm/lib/commands/install.js new file mode 100644 index 00000000..71f4229b --- /dev/null +++ b/node_modules/npm/lib/commands/install.js @@ -0,0 +1,176 @@ +const { readdir } = require('node:fs/promises') +const { resolve, join } = require('node:path') +const { log } = require('proc-log') +const runScript = require('@npmcli/run-script') +const pacote = require('pacote') +const checks = require('npm-install-checks') +const reifyFinish = require('../utils/reify-finish.js') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +class Install extends ArboristWorkspaceCmd { + static description = 'Install a package' + static name = 'install' + + // These are in the order they will show up in when running "-h" + // If adding to this list, consider adding also to ci.js + static params = [ + 'save', + 'save-exact', + 'global', + 'install-strategy', + 'legacy-bundling', + 'global-style', + 'omit', + 'include', + 'strict-peer-deps', + 'prefer-dedupe', + 'package-lock', + 'package-lock-only', + 'foreground-scripts', + 'ignore-scripts', + 'audit', + 'bin-links', + 'fund', + 'dry-run', + 'cpu', + 'os', + 'libc', + ...super.params, + ] + + static usage = ['[ ...]'] + + static async completion (opts) { + const { partialWord } = opts + // install can complete to a folder with a package.json, or any package. + // if it has a slash, then it's gotta be a folder + // if it starts with https?://, then just give up, because it's a url + if (/^https?:\/\//.test(partialWord)) { + // do not complete to URLs + return [] + } + + if (/\//.test(partialWord)) { + // Complete fully to folder if there is exactly one match and it + // is a folder containing a package.json file. If that is not the + // case we return 0 matches, which will trigger the default bash + // complete. + const lastSlashIdx = partialWord.lastIndexOf('/') + const partialName = partialWord.slice(lastSlashIdx + 1) + const partialPath = partialWord.slice(0, lastSlashIdx) || '/' + + const isDirMatch = async sibling => { + if (sibling.slice(0, partialName.length) !== partialName) { + return false + } + + try { + const contents = await readdir(join(partialPath, sibling)) + const result = (contents.indexOf('package.json') !== -1) + return result + } catch { + return false + } + } + + try { + const siblings = await readdir(partialPath) + const matches = [] + for (const sibling of siblings) { + if (await isDirMatch(sibling)) { + matches.push(sibling) + } + } + if (matches.length === 1) { + return [join(partialPath, matches[0])] + } + // no matches + return [] + } catch { + return [] // invalid dir: no matching + } + } + // Note: there used to be registry completion here, + // but it stopped making sense somewhere around + // 50,000 packages on the registry + } + + async exec (args) { + // the /path/to/node_modules/.. + const globalTop = resolve(this.npm.globalDir, '..') + const ignoreScripts = this.npm.config.get('ignore-scripts') + const isGlobalInstall = this.npm.global + const where = isGlobalInstall ? globalTop : this.npm.prefix + const forced = this.npm.config.get('force') + const scriptShell = this.npm.config.get('script-shell') || undefined + + // be very strict about engines when trying to update npm itself + const npmInstall = args.find(arg => arg.startsWith('npm@') || arg === 'npm') + if (isGlobalInstall && npmInstall) { + const npmOptions = this.npm.flatOptions + const npmManifest = await pacote.manifest(npmInstall, npmOptions) + try { + checks.checkEngine(npmManifest, npmManifest.version, process.version) + } catch (e) { + if (forced) { + log.warn( + 'install', + /* eslint-disable-next-line max-len */ + `Forcing global npm install with incompatible version ${npmManifest.version} into node ${process.version}` + ) + } else { + throw e + } + } + } + + // don't try to install the prefix into itself + args = args.filter(a => resolve(a) !== this.npm.prefix) + + // `npm i -g` => "install this package globally" + if (where === globalTop && !args.length) { + args = ['.'] + } + + // throw usage error if trying to install empty package + // name to global space, e.g: `npm i -g ""` + if (where === globalTop && !args.every(Boolean)) { + throw this.usageError() + } + + const Arborist = require('@npmcli/arborist') + const opts = { + ...this.npm.flatOptions, + auditLevel: null, + path: where, + add: args, + workspaces: this.workspaceNames, + } + const arb = new Arborist(opts) + await arb.reify(opts) + + if (!args.length && !isGlobalInstall && !ignoreScripts) { + const scripts = [ + 'preinstall', + 'install', + 'postinstall', + 'prepublish', // XXX(npm9) should we remove this finally?? + 'preprepare', + 'prepare', + 'postprepare', + ] + for (const event of scripts) { + await runScript({ + path: where, + args: [], + scriptShell, + stdio: 'inherit', + event, + }) + } + } + await reifyFinish(this.npm, arb) + } +} + +module.exports = Install diff --git a/node_modules/npm/lib/commands/link.js b/node_modules/npm/lib/commands/link.js new file mode 100644 index 00000000..8a41548d --- /dev/null +++ b/node_modules/npm/lib/commands/link.js @@ -0,0 +1,189 @@ +const { readdir } = require('node:fs/promises') +const { resolve } = require('node:path') +const npa = require('npm-package-arg') +const pkgJson = require('@npmcli/package-json') +const semver = require('semver') +const reifyFinish = require('../utils/reify-finish.js') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +class Link extends ArboristWorkspaceCmd { + static description = 'Symlink a package folder' + static name = 'link' + static usage = [ + '[]', + ] + + static params = [ + 'save', + 'save-exact', + 'global', + 'install-strategy', + 'legacy-bundling', + 'global-style', + 'strict-peer-deps', + 'package-lock', + 'omit', + 'include', + 'ignore-scripts', + 'audit', + 'bin-links', + 'fund', + 'dry-run', + ...super.params, + ] + + static async completion (opts, npm) { + const dir = npm.globalDir + const files = await readdir(dir) + return files.filter(f => !/^[._-]/.test(f)) + } + + async exec (args) { + if (this.npm.global) { + throw Object.assign( + new Error( + 'link should never be --global.\n' + + 'Please re-run this command with --local' + ), + { code: 'ELINKGLOBAL' } + ) + } + // install-links is implicitly false when running `npm link` + this.npm.config.set('install-links', false) + + // link with no args: symlink the folder to the global location + // link with package arg: symlink the global to the local + args = args.filter(a => resolve(a) !== this.npm.prefix) + return args.length + ? this.linkInstall(args) + : this.linkPkg() + } + + async linkInstall (args) { + // load current packages from the global space, + // and then add symlinks installs locally + const globalTop = resolve(this.npm.globalDir, '..') + const Arborist = require('@npmcli/arborist') + const globalOpts = { + ...this.npm.flatOptions, + Arborist, + path: globalTop, + global: true, + prune: false, + } + const globalArb = new Arborist(globalOpts) + + // get only current top-level packages from the global space + const globals = await globalArb.loadActual({ + filter: (node, kid) => + !node.isRoot || args.some(a => npa(a).name === kid), + }) + + // any extra arg that is missing from the current + // global space should be reified there first + const missing = this.missingArgsFromTree(globals, args) + if (missing.length) { + await globalArb.reify({ + ...globalOpts, + add: missing, + }) + } + + // get a list of module names that should be linked in the local prefix + const names = [] + for (const a of args) { + const arg = npa(a) + if (arg.type === 'directory') { + const { content } = await pkgJson.normalize(arg.fetchSpec) + names.push(content.name) + } else { + names.push(arg.name) + } + } + + // npm link should not save=true by default unless you're + // using any of --save-dev or other types + const save = + Boolean( + (this.npm.config.find('save') !== 'default' && + this.npm.config.get('save')) || + this.npm.config.get('save-optional') || + this.npm.config.get('save-peer') || + this.npm.config.get('save-dev') || + this.npm.config.get('save-prod') + ) + // create a new arborist instance for the local prefix and + // reify all the pending names as symlinks there + const localArb = new Arborist({ + ...this.npm.flatOptions, + prune: false, + path: this.npm.prefix, + save, + }) + await localArb.reify({ + ...this.npm.flatOptions, + prune: false, + path: this.npm.prefix, + add: names.map(l => `file:${resolve(globalTop, 'node_modules', l).replace(/#/g, '%23')}`), + save, + workspaces: this.workspaceNames, + }) + + await reifyFinish(this.npm, localArb) + } + + async linkPkg () { + const wsp = this.workspacePaths + const paths = wsp && wsp.length ? wsp : [this.npm.prefix] + const add = paths.map(path => `file:${path.replace(/#/g, '%23')}`) + const globalTop = resolve(this.npm.globalDir, '..') + const Arborist = require('@npmcli/arborist') + const arb = new Arborist({ + ...this.npm.flatOptions, + Arborist, + path: globalTop, + global: true, + }) + await arb.reify({ + add, + }) + await reifyFinish(this.npm, arb) + } + + // Returns a list of items that can't be fulfilled by + // things found in the current arborist inventory + missingArgsFromTree (tree, args) { + if (tree.isLink) { + return this.missingArgsFromTree(tree.target, args) + } + + const foundNodes = [] + const missing = args.filter(a => { + const arg = npa(a) + const nodes = tree.children.values() + const argFound = [...nodes].every(node => { + // TODO: write tests for unmatching version specs, this is hard to test + // atm but should be simple once we have a mocked registry again + if (arg.name !== node.name /* istanbul ignore next */ || ( + arg.version && + /* istanbul ignore next */ + !semver.satisfies(node.version, arg.version) + )) { + foundNodes.push(node) + return true + } + }) + return argFound + }) + + // remote nodes from the loaded tree in order + // to avoid dropping them later when reifying + for (const node of foundNodes) { + node.parent = null + } + + return missing + } +} + +module.exports = Link diff --git a/node_modules/npm/lib/commands/ll.js b/node_modules/npm/lib/commands/ll.js new file mode 100644 index 00000000..99a144fd --- /dev/null +++ b/node_modules/npm/lib/commands/ll.js @@ -0,0 +1,13 @@ +const LS = require('./ls.js') + +class LL extends LS { + static name = 'll' + static usage = ['[[<@scope>/] ...]'] + + async exec (args) { + this.npm.config.set('long', true) + return super.exec(args) + } +} + +module.exports = LL diff --git a/node_modules/npm/lib/commands/login.js b/node_modules/npm/lib/commands/login.js new file mode 100644 index 00000000..630abf9a --- /dev/null +++ b/node_modules/npm/lib/commands/login.js @@ -0,0 +1,50 @@ +const { log, output } = require('proc-log') +const { redactLog: replaceInfo } = require('@npmcli/redact') +const auth = require('../utils/auth.js') +const BaseCommand = require('../base-cmd.js') + +class Login extends BaseCommand { + static description = 'Login to a registry user account' + static name = 'login' + static params = [ + 'registry', + 'scope', + 'auth-type', + ] + + async exec () { + const scope = this.npm.config.get('scope') + let registry = this.npm.config.get('registry') + + if (scope) { + const scopedRegistry = this.npm.config.get(`${scope}:registry`) + const cliRegistry = this.npm.config.get('registry', 'cli') + if (scopedRegistry && !cliRegistry) { + registry = scopedRegistry + } + } + + const creds = this.npm.config.getCredentialsByURI(registry) + + log.notice('', `Log in on ${replaceInfo(registry)}`) + + const { message, newCreds } = await auth.login(this.npm, { + ...this.npm.flatOptions, + creds, + registry, + }) + + this.npm.config.delete('_token', 'user') // prevent legacy pollution + this.npm.config.setCredentialsByURI(registry, newCreds) + + if (scope) { + this.npm.config.set(scope + ':registry', registry, 'user') + } + + await this.npm.config.save('user') + + output.standard(message) + } +} + +module.exports = Login diff --git a/node_modules/npm/lib/commands/logout.js b/node_modules/npm/lib/commands/logout.js new file mode 100644 index 00000000..dc5a0dfd --- /dev/null +++ b/node_modules/npm/lib/commands/logout.js @@ -0,0 +1,50 @@ +const npmFetch = require('npm-registry-fetch') +const { getAuth } = npmFetch +const { log } = require('proc-log') +const BaseCommand = require('../base-cmd.js') + +class Logout extends BaseCommand { + static description = 'Log out of the registry' + static name = 'logout' + static params = [ + 'registry', + 'scope', + ] + + async exec () { + const registry = this.npm.config.get('registry') + const scope = this.npm.config.get('scope') + const regRef = scope ? `${scope}:registry` : 'registry' + const reg = this.npm.config.get(regRef) || registry + + const auth = getAuth(reg, this.npm.flatOptions) + + const level = this.npm.config.find(`${auth.regKey}:${auth.authKey}`) + + // find the config level and only delete from there + if (auth.token) { + log.verbose('logout', `clearing token for ${reg}`) + await npmFetch(`/-/user/token/${encodeURIComponent(auth.token)}`, { + ...this.npm.flatOptions, + registry: reg, + method: 'DELETE', + ignoreBody: true, + }) + } else if (auth.isBasicAuth) { + log.verbose('logout', `clearing user credentials for ${reg}`) + } else { + const msg = `not logged in to ${reg}, so can't log out!` + throw Object.assign(new Error(msg), { code: 'ENEEDAUTH' }) + } + + if (scope) { + this.npm.config.delete(regRef, level) + } + + this.npm.config.clearCredentialsByURI(reg, level) + + await this.npm.config.save(level) + } +} + +module.exports = Logout diff --git a/node_modules/npm/lib/commands/ls.js b/node_modules/npm/lib/commands/ls.js new file mode 100644 index 00000000..bc8beb00 --- /dev/null +++ b/node_modules/npm/lib/commands/ls.js @@ -0,0 +1,579 @@ +const { resolve, relative, sep } = require('node:path') +const archy = require('archy') +const { breadth } = require('treeverse') +const npa = require('npm-package-arg') +const { output } = require('proc-log') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') +const localeCompare = require('@isaacs/string-locale-compare')('en') + +const relativePrefix = `.${sep}` + +const _depth = Symbol('depth') +const _dedupe = Symbol('dedupe') +const _filteredBy = Symbol('filteredBy') +const _include = Symbol('include') +const _invalid = Symbol('invalid') +const _name = Symbol('name') +const _missing = Symbol('missing') +const _parent = Symbol('parent') +const _problems = Symbol('problems') +const _required = Symbol('required') +const _type = Symbol('type') + +class LS extends ArboristWorkspaceCmd { + static description = 'List installed packages' + static name = 'ls' + static usage = [''] + static params = [ + 'all', + 'json', + 'long', + 'parseable', + 'global', + 'depth', + 'omit', + 'include', + 'link', + 'package-lock-only', + 'unicode', + ...super.params, + ] + + // TODO + /* istanbul ignore next */ + static async completion (opts, npm) { + const completion = require('../utils/installed-deep.js') + return completion(npm, opts) + } + + async exec (args) { + const all = this.npm.config.get('all') + const chalk = this.npm.chalk + const depth = this.npm.config.get('depth') + const global = this.npm.global + const json = this.npm.config.get('json') + const link = this.npm.config.get('link') + const long = this.npm.config.get('long') + const omit = this.npm.flatOptions.omit + const parseable = this.npm.config.get('parseable') + const unicode = this.npm.config.get('unicode') + const packageLockOnly = this.npm.config.get('package-lock-only') + const workspacesEnabled = this.npm.flatOptions.workspacesEnabled + + const path = global ? resolve(this.npm.globalDir, '..') : this.npm.prefix + + const Arborist = require('@npmcli/arborist') + + const arb = new Arborist({ + global, + ...this.npm.flatOptions, + legacyPeerDeps: false, + path, + }) + const tree = await this.initTree({ arb, args, packageLockOnly }) + + // filters by workspaces nodes when using -w + // We only have to filter the first layer of edges, so we don't + // explore anything that isn't part of the selected workspace set. + let wsNodes + if (this.workspaceNames && this.workspaceNames.length) { + wsNodes = arb.workspaceNodes(tree, this.workspaceNames) + } + const filterBySelectedWorkspaces = edge => { + if (!workspacesEnabled + && edge.from.isProjectRoot + && edge.to.isWorkspace + ) { + return false + } + + if (!wsNodes || !wsNodes.length) { + return true + } + + if (this.npm.flatOptions.includeWorkspaceRoot + && edge.to && !edge.to.isWorkspace) { + return true + } + + if (edge.from.isProjectRoot) { + return (edge.to + && edge.to.isWorkspace + && wsNodes.includes(edge.to.target)) + } + + return true + } + + const seenItems = new Set() + const seenNodes = new Map() + const problems = new Set() + + // defines special handling of printed depth when filtering with args + const filterDefaultDepth = depth === null ? Infinity : depth + const depthToPrint = (all || args.length) + ? filterDefaultDepth + : (depth || 0) + + // add root node of tree to list of seenNodes + seenNodes.set(tree.path, tree) + + // tree traversal happens here, using treeverse.breadth + const result = await breadth({ + tree, + // recursive method, `node` is going to be the current elem (starting from + // the `tree` obj) that was just visited in the `visit` method below + // `nodeResult` is going to be the returned `item` from `visit` + getChildren (node, nodeResult) { + const seenPaths = new Set() + const workspace = node.isWorkspace + const currentDepth = workspace ? 0 : node[_depth] + const shouldSkipChildren = + !(node instanceof Arborist.Node) || (currentDepth > depthToPrint) + return (shouldSkipChildren) + ? [] + : [...(node.target).edgesOut.values()] + .filter(filterBySelectedWorkspaces) + .filter(currentDepth === 0 ? filterByEdgesTypes({ + link, + omit, + }) : () => true) + .map(mapEdgesToNodes({ seenPaths })) + .concat(appendExtraneousChildren({ node, seenPaths })) + .sort(sortAlphabetically) + .map(augmentNodesWithMetadata({ + args, + currentDepth, + nodeResult, + seenNodes, + })) + }, + // visit each `node` of the `tree`, returning an `item` - these are + // the elements that will be used to build the final output + visit (node) { + node[_problems] = getProblems(node, { global }) + + const item = json + ? getJsonOutputItem(node, { global, long }) + : parseable + ? null + : getHumanOutputItem(node, { args, chalk, global, long }) + + // loop through list of node problems to add them to global list + if (node[_include]) { + for (const problem of node[_problems]) { + problems.add(problem) + } + } + + seenItems.add(item) + + // return a promise so we don't blow the stack + return Promise.resolve(item) + }, + }) + + // handle the special case of a broken package.json in the root folder + const [rootError] = tree.errors.filter(e => + e.code === 'EJSONPARSE' && e.path === resolve(path, 'package.json')) + + if (json) { + output.buffer(jsonOutput({ path, problems, result, rootError, seenItems })) + } else { + output.standard(parseable + ? parseableOutput({ seenNodes, global, long }) + : humanOutput({ chalk, result, seenItems, unicode }) + ) + } + + // if filtering items, should exit with error code on no results + if (result && !result[_include] && args.length) { + process.exitCode = 1 + } + + if (rootError) { + throw Object.assign( + new Error('Failed to parse root package.json'), + { code: 'EJSONPARSE' } + ) + } + + const shouldThrow = problems.size && + ![...problems].every(problem => problem.startsWith('extraneous:')) + + if (shouldThrow) { + throw Object.assign( + new Error([...problems].join('\n')), + { code: 'ELSPROBLEMS' } + ) + } + } + + async initTree ({ arb, args, packageLockOnly }) { + const tree = await ( + packageLockOnly + ? arb.loadVirtual() + : arb.loadActual() + ) + + tree[_include] = args.length === 0 + tree[_depth] = 0 + + return tree + } +} + +module.exports = LS + +const isGitNode = (node) => { + if (!node.resolved) { + return + } + + try { + const { type } = npa(node.resolved) + return type === 'git' || type === 'hosted' + } catch { + return false + } +} + +const isOptional = (node) => + node[_type] === 'optional' || node[_type] === 'peerOptional' + +const isExtraneous = (node, { global }) => + node.extraneous && !global + +const getProblems = (node, { global }) => { + const problems = new Set() + + if (node[_missing] && !isOptional(node)) { + problems.add(`missing: ${node.pkgid}, required by ${node[_missing]}`) + } + + if (node[_invalid]) { + problems.add(`invalid: ${node.pkgid} ${node.path}`) + } + + if (isExtraneous(node, { global })) { + problems.add(`extraneous: ${node.pkgid} ${node.path}`) + } + + return problems +} + +// annotates _parent and _include metadata into the resulting +// item obj allowing for filtering out results during output +const augmentItemWithIncludeMetadata = (node, item) => { + item[_parent] = node[_parent] + item[_include] = node[_include] + + // append current item to its parent.nodes which is the + // structure expected by archy in order to print tree + if (node[_include]) { + // includes all ancestors of included node + let p = node[_parent] + while (p) { + p[_include] = true + p = p[_parent] + } + } + + return item +} + +const getHumanOutputItem = (node, { args, chalk, global, long }) => { + const { pkgid, path } = node + const workspacePkgId = chalk.blueBright(pkgid) + let printable = node.isWorkspace ? workspacePkgId : pkgid + + // special formatting for top-level package name + if (node.isRoot) { + const hasNoPackageJson = !Object.keys(node.package).length + if (hasNoPackageJson || global) { + printable = path + } else { + printable += `${long ? '\n' : ' '}${path}` + } + } + + // TODO there is a LOT of overlap with lib/utils/explain-dep.js here + + const highlightDepName = args.length && node[_filteredBy] + const missingColor = isOptional(node) + ? chalk.yellow + : chalk.red + const missingMsg = `UNMET ${isOptional(node) ? 'OPTIONAL ' : ''}DEPENDENCY` + const targetLocation = node.root + ? relative(node.root.realpath, node.realpath) + : node.targetLocation + const invalid = node[_invalid] + ? `invalid: ${node[_invalid]}` + : '' + const label = + ( + node[_missing] + ? missingColor(missingMsg) + ' ' + : '' + ) + + `${highlightDepName ? chalk.yellow(printable) : printable}` + + ( + node[_dedupe] + ? ' ' + chalk.dim('deduped') + : '' + ) + + ( + invalid + ? ' ' + chalk.red(invalid) + : '' + ) + + ( + isExtraneous(node, { global }) + ? ' ' + chalk.red('extraneous') + : '' + ) + + ( + node.overridden + ? ' ' + chalk.dim('overridden') + : '' + ) + + (isGitNode(node) ? ` (${node.resolved})` : '') + + (node.isLink ? ` -> ${relativePrefix}${targetLocation}` : '') + + (long ? `\n${node.package.description || ''}` : '') + + return augmentItemWithIncludeMetadata(node, { label, nodes: [] }) +} + +const getJsonOutputItem = (node, { global, long }) => { + const item = {} + + if (node.version) { + item.version = node.version + } + + if (node.resolved) { + item.resolved = node.resolved + } + + // if the node is the project root, do not add the overridden flag. the project root can't be + // overridden anyway, and if we add the flag it causes undesirable behavior when `npm ls --json` + // is ran in an empty directory since we end up printing an object with only an overridden prop + if (!node.isProjectRoot) { + item.overridden = node.overridden + } + + item[_name] = node.name + + // special formatting for top-level package name + const hasPackageJson = + node && node.package && Object.keys(node.package).length + if (node.isRoot && hasPackageJson) { + item.name = node.package.name || node.name + } + + if (long && !node[_missing]) { + item.name = item[_name] + const { dependencies, ...packageInfo } = node.package + Object.assign(item, packageInfo) + item.extraneous = false + item.path = node.path + item._dependencies = { + ...node.package.dependencies, + ...node.package.optionalDependencies, + } + item.devDependencies = node.package.devDependencies || {} + item.peerDependencies = node.package.peerDependencies || {} + } + + // augment json output items with extra metadata + if (isExtraneous(node, { global })) { + item.extraneous = true + } + + if (node[_invalid]) { + item.invalid = node[_invalid] + } + + if (node[_missing] && !isOptional(node)) { + item.required = node[_required] + item.missing = true + } + if (node[_include] && node[_problems] && node[_problems].size) { + item.problems = [...node[_problems]] + } + + return augmentItemWithIncludeMetadata(node, item) +} + +const filterByEdgesTypes = ({ link, omit }) => (edge) => { + for (const omitType of omit) { + if (edge[omitType]) { + return false + } + } + return link ? edge.to && edge.to.isLink : true +} + +const appendExtraneousChildren = ({ node, seenPaths }) => + // extraneous children are not represented + // in edges out, so here we add them to the list: + [...node.children.values()] + .filter(i => !seenPaths.has(i.path) && i.extraneous) + +const mapEdgesToNodes = ({ seenPaths }) => (edge) => { + let node = edge.to + + // if the edge is linking to a missing node, we go ahead + // and create a new obj that will represent the missing node + if (edge.missing || (edge.optional && !node)) { + const { name, spec } = edge + const pkgid = `${name}@${spec}` + node = { name, pkgid, [_missing]: edge.from.pkgid } + } + + // keeps track of a set of seen paths to avoid the edge case in which a tree + // item would appear twice given that it's a children of an extraneous item, + // so it's marked extraneous but it will ALSO show up in edgesOuts of + // its parent so it ends up as two diff nodes if we don't track it + if (node.path) { + seenPaths.add(node.path) + } + + node[_required] = edge.spec || '*' + node[_type] = edge.type + + if (edge.invalid) { + const spec = JSON.stringify(node[_required]) + const from = edge.from.location || 'the root project' + node[_invalid] = (node[_invalid] ? node[_invalid] + ', ' : '') + + (`${spec} from ${from}`) + } + + return node +} + +const filterByPositionalArgs = (args, { node }) => + args.length > 0 ? args.some( + (spec) => (node.satisfies && node.satisfies(spec)) + ) : true + +const augmentNodesWithMetadata = ({ + args, + currentDepth, + nodeResult, + seenNodes, +}) => (node) => { + // if the original edge was a deduped dep, treeverse will fail to + // revisit that node in tree traversal logic, so we make it so that + // we have a diff obj for deduped nodes: + if (seenNodes.has(node.path)) { + const { realpath, root } = node + const targetLocation = root ? relative(root.realpath, realpath) + : node.targetLocation + node = { + name: node.name, + version: node.version, + pkgid: node.pkgid, + package: node.package, + path: node.path, + isLink: node.isLink, + realpath: node.realpath, + targetLocation, + [_type]: node[_type], + [_invalid]: node[_invalid], + [_missing]: node[_missing], + // if it's missing, it's not deduped, it's just missing + [_dedupe]: !node[_missing], + } + } else { + // keeps track of already seen nodes in order to check for dedupes + seenNodes.set(node.path, node) + } + + // _parent is going to be a ref to a treeverse-visited node (returned from + // getHumanOutputItem, getJsonOutputItem, etc) so that we have an easy + // shortcut to place new nodes in their right place during tree traversal + node[_parent] = nodeResult + // _include is the property that allow us to filter based on position args + // e.g: `npm ls foo`, `npm ls simple-output@2` + // _filteredBy is used to apply extra color info to the item that + // was used in args in order to filter + node[_filteredBy] = node[_include] = + filterByPositionalArgs(args, { node: seenNodes.get(node.path) }) + // _depth keeps track of how many levels deep tree traversal currently is + // so that we can `npm ls --depth=1` + node[_depth] = currentDepth + 1 + + return node +} + +const sortAlphabetically = ({ pkgid: a }, { pkgid: b }) => localeCompare(a, b) + +const humanOutput = ({ chalk, result, seenItems, unicode }) => { + // we need to traverse the entire tree in order to determine which items + // should be included (since a nested transitive included dep will make it + // so that all its ancestors should be displayed) + // here is where we put items in their expected place for archy output + for (const item of seenItems) { + if (item[_include] && item[_parent]) { + item[_parent].nodes.push(item) + } + } + + if (!result.nodes.length) { + result.nodes = ['(empty)'] + } + + const archyOutput = archy(result, '', { unicode }) + return chalk.reset(archyOutput) +} + +const jsonOutput = ({ path, problems, result, rootError, seenItems }) => { + if (problems.size) { + result.problems = [...problems] + } + + if (rootError) { + result.problems = [ + ...(result.problems || []), + ...[`error in ${path}: Failed to parse root package.json`], + ] + result.invalid = true + } + + // we need to traverse the entire tree in order to determine which items + // should be included (since a nested transitive included dep will make it + // so that all its ancestors should be displayed) + // here is where we put items in their expected place for json output + for (const item of seenItems) { + // append current item to its parent item.dependencies obj in order + // to provide a json object structure that represents the installed tree + if (item[_include] && item[_parent]) { + if (!item[_parent].dependencies) { + item[_parent].dependencies = {} + } + + item[_parent].dependencies[item[_name]] = item + } + } + + return result +} + +const parseableOutput = ({ global, long, seenNodes }) => { + let out = '' + for (const node of seenNodes.values()) { + if (node.path && node[_include]) { + out += node.path + if (long) { + out += `:${node.pkgid}` + out += node.path !== node.realpath ? `:${node.realpath}` : '' + out += isExtraneous(node, { global }) ? ':EXTRANEOUS' : '' + out += node[_invalid] ? ':INVALID' : '' + out += node.overridden ? ':OVERRIDDEN' : '' + } + out += '\n' + } + } + return out.trim() +} diff --git a/node_modules/npm/lib/commands/org.js b/node_modules/npm/lib/commands/org.js new file mode 100644 index 00000000..61349805 --- /dev/null +++ b/node_modules/npm/lib/commands/org.js @@ -0,0 +1,151 @@ +const liborg = require('libnpmorg') +const { otplease } = require('../utils/auth.js') +const BaseCommand = require('../base-cmd.js') +const { output } = require('proc-log') + +class Org extends BaseCommand { + static description = 'Manage orgs' + static name = 'org' + static usage = [ + 'set orgname username [developer | admin | owner]', + 'rm orgname username', + 'ls orgname []', + ] + + static params = ['registry', 'otp', 'json', 'parseable'] + + static async completion (opts) { + const argv = opts.conf.argv.remain + if (argv.length === 2) { + return ['set', 'rm', 'ls'] + } + + switch (argv[2]) { + case 'ls': + case 'add': + case 'rm': + case 'set': + return [] + default: + throw new Error(argv[2] + ' not recognized') + } + } + + async exec ([cmd, orgname, username, role]) { + return otplease(this.npm, { + ...this.npm.flatOptions, + }, opts => { + switch (cmd) { + case 'add': + case 'set': + return this.set(orgname, username, role, opts) + case 'rm': + return this.rm(orgname, username, opts) + case 'ls': + return this.ls(orgname, username, opts) + default: + throw this.usageError() + } + }) + } + + async set (org, user, role, opts) { + role = role || 'developer' + if (!org) { + throw new Error('First argument `orgname` is required.') + } + + if (!user) { + throw new Error('Second argument `username` is required.') + } + + if (!['owner', 'admin', 'developer'].find(x => x === role)) { + throw new Error( + /* eslint-disable-next-line max-len */ + 'Third argument `role` must be one of `owner`, `admin`, or `developer`, with `developer` being the default value if omitted.' + ) + } + + const memDeets = await liborg.set(org, user, role, opts) + if (opts.json) { + output.standard(JSON.stringify(memDeets, null, 2)) + } else if (opts.parseable) { + output.standard(['org', 'orgsize', 'user', 'role'].join('\t')) + output.standard( + [memDeets.org.name, memDeets.org.size, memDeets.user, memDeets.role].join('\t') + ) + } else if (!this.npm.silent) { + output.standard( + `Added ${memDeets.user} as ${memDeets.role} to ${memDeets.org.name}. You now have ${ + memDeets.org.size + } member${memDeets.org.size === 1 ? '' : 's'} in this org.` + ) + } + + return memDeets + } + + async rm (org, user, opts) { + if (!org) { + throw new Error('First argument `orgname` is required.') + } + + if (!user) { + throw new Error('Second argument `username` is required.') + } + + await liborg.rm(org, user, opts) + const roster = await liborg.ls(org, opts) + user = user.replace(/^[~@]?/, '') + org = org.replace(/^[~@]?/, '') + const userCount = Object.keys(roster).length + if (opts.json) { + output.buffer({ + user, + org, + userCount, + deleted: true, + }) + } else if (opts.parseable) { + output.standard(['user', 'org', 'userCount', 'deleted'].join('\t')) + output.standard([user, org, userCount, true].join('\t')) + } else if (!this.npm.silent) { + output.standard( + `Successfully removed ${user} from ${org}. You now have ${userCount} member${ + userCount === 1 ? '' : 's' + } in this org.` + ) + } + } + + async ls (org, user, opts) { + if (!org) { + throw new Error('First argument `orgname` is required.') + } + + let roster = await liborg.ls(org, opts) + if (user) { + const newRoster = {} + if (roster[user]) { + newRoster[user] = roster[user] + } + + roster = newRoster + } + if (opts.json) { + output.buffer(roster) + } else if (opts.parseable) { + output.standard(['user', 'role'].join('\t')) + Object.keys(roster).forEach(u => { + output.standard([u, roster[u]].join('\t')) + }) + } else if (!this.npm.silent) { + const chalk = this.npm.chalk + for (const u of Object.keys(roster).sort()) { + output.standard(`${u} - ${chalk.cyan(roster[u])}`) + } + } + } +} + +module.exports = Org diff --git a/node_modules/npm/lib/commands/outdated.js b/node_modules/npm/lib/commands/outdated.js new file mode 100644 index 00000000..c401c0d5 --- /dev/null +++ b/node_modules/npm/lib/commands/outdated.js @@ -0,0 +1,282 @@ +const { resolve } = require('node:path') +const { stripVTControlCharacters } = require('node:util') +const pacote = require('pacote') +const table = require('text-table') +const npa = require('npm-package-arg') +const pickManifest = require('npm-pick-manifest') +const { output } = require('proc-log') +const localeCompare = require('@isaacs/string-locale-compare')('en') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +const safeNpa = (spec) => { + try { + return npa(spec) + } catch { + return null + } +} + +// This string is load bearing and is shared with Arborist +const MISSING = 'MISSING' + +class Outdated extends ArboristWorkspaceCmd { + static description = 'Check for outdated packages' + static name = 'outdated' + static usage = ['[ ...]'] + static params = [ + 'all', + 'json', + 'long', + 'parseable', + 'global', + 'workspace', + ] + + #tree + #list = [] + #edges = new Set() + #filterSet + + async exec (args) { + const Arborist = require('@npmcli/arborist') + const arb = new Arborist({ + ...this.npm.flatOptions, + path: this.npm.global ? resolve(this.npm.globalDir, '..') : this.npm.prefix, + }) + this.#tree = await arb.loadActual() + + if (this.workspaceNames?.length) { + this.#filterSet = arb.workspaceDependencySet( + this.#tree, + this.workspaceNames, + this.npm.flatOptions.includeWorkspaceRoot + ) + } else if (!this.npm.flatOptions.workspacesEnabled) { + this.#filterSet = arb.excludeWorkspacesDependencySet(this.#tree) + } + + if (args.length) { + for (const arg of args) { + // specific deps + this.#getEdges(this.#tree.inventory.query('name', arg), 'edgesIn') + } + } else { + if (this.npm.config.get('all')) { + // all deps in tree + this.#getEdges(this.#tree.inventory.values(), 'edgesOut') + } + // top-level deps + this.#getEdges() + } + + await Promise.all([...this.#edges].map((e) => this.#getOutdatedInfo(e))) + + // sorts list alphabetically by name and then dependent + const outdated = this.#list + .sort((a, b) => localeCompare(a.name, b.name) || localeCompare(a.dependent, b.dependent)) + + if (outdated.length) { + process.exitCode = 1 + } + + if (this.npm.config.get('json')) { + output.buffer(this.#json(outdated)) + return + } + + const res = this.npm.config.get('parseable') + ? this.#parseable(outdated) + : this.#pretty(outdated) + + if (res) { + output.standard(res) + } + } + + #getEdges (nodes, type) { + // when no nodes are provided then it should only read direct deps + // from the root node and its workspaces direct dependencies + if (!nodes) { + this.#getEdgesOut(this.#tree) + this.#getWorkspacesEdges() + return + } + + for (const node of nodes) { + if (type === 'edgesOut') { + this.#getEdgesOut(node) + } else { + this.#getEdgesIn(node) + } + } + } + + #getEdgesIn (node) { + for (const edge of node.edgesIn) { + this.#trackEdge(edge) + } + } + + #getEdgesOut (node) { + // TODO: normalize usage of edges and avoid looping through nodes here + const edges = this.npm.global ? node.children.values() : node.edgesOut.values() + for (const edge of edges) { + this.#trackEdge(edge) + } + } + + #trackEdge (edge) { + if (edge.from && this.#filterSet?.size > 0 && !this.#filterSet.has(edge.from.target)) { + return + } + this.#edges.add(edge) + } + + #getWorkspacesEdges () { + if (this.npm.global) { + return + } + + for (const edge of this.#tree.edgesOut.values()) { + if (edge?.to?.target?.isWorkspace) { + this.#getEdgesOut(edge.to.target) + } + } + } + + async #getPackument (spec) { + return pacote.packument(spec, { + ...this.npm.flatOptions, + fullMetadata: this.npm.config.get('long'), + preferOnline: true, + }) + } + + async #getOutdatedInfo (edge) { + const alias = safeNpa(edge.spec)?.subSpec + const spec = npa(alias ? alias.name : edge.name) + const node = edge.to || edge + const { path, location, package: { version: current } = {} } = node + + const type = edge.optional ? 'optionalDependencies' + : edge.peer ? 'peerDependencies' + : edge.dev ? 'devDependencies' + : 'dependencies' + + for (const omitType of this.npm.flatOptions.omit) { + if (node[omitType]) { + return + } + } + + // deps different from prod not currently + // on disk are not included in the output + if (edge.error === MISSING && type !== 'dependencies') { + return + } + + // if it's not a range, version, or tag, skip it + if (!safeNpa(`${edge.name}@${edge.spec}`)?.registry) { + return null + } + + try { + const packument = await this.#getPackument(spec) + const expected = alias ? alias.fetchSpec : edge.spec + const wanted = pickManifest(packument, expected, this.npm.flatOptions) + const latest = pickManifest(packument, '*', this.npm.flatOptions) + if (!current || current !== wanted.version || wanted.version !== latest.version) { + this.#list.push({ + name: alias ? edge.spec.replace('npm', edge.name) : edge.name, + path, + type, + current, + location, + wanted: wanted.version, + latest: latest.version, + workspaceDependent: edge.from?.isWorkspace ? edge.from.pkgid : null, + dependent: edge.from?.name ?? 'global', + homepage: packument.homepage, + }) + } + } catch (err) { + // silently catch and ignore ETARGET, E403 & + // E404 errors, deps are just skipped + if (!['ETARGET', 'E404', 'E404'].includes(err.code)) { + throw err + } + } + } + + // formatting functions + + #pretty (list) { + if (!list.length) { + return + } + + const long = this.npm.config.get('long') + const { bold, yellow, red, cyan, blue } = this.npm.chalk + + return table([ + [ + 'Package', + 'Current', + 'Wanted', + 'Latest', + 'Location', + 'Depended by', + ...long ? ['Package Type', 'Homepage'] : [], + ].map(h => bold.underline(h)), + ...list.map((d) => [ + d.current === d.wanted ? yellow(d.name) : red(d.name), + d.current ?? 'MISSING', + cyan(d.wanted), + blue(d.latest), + d.location ?? '-', + d.workspaceDependent ? blue(d.workspaceDependent) : d.dependent, + ...long ? [d.type, blue(d.homepage ?? '')] : [], + ]), + ], { + align: ['l', 'r', 'r', 'r', 'l'], + stringLength: s => stripVTControlCharacters(s).length, + }) + } + + // --parseable creates output like this: + // :::: + #parseable (list) { + return list.map(d => [ + d.path, + `${d.name}@${d.wanted}`, + d.current ? `${d.name}@${d.current}` : 'MISSING', + `${d.name}@${d.latest}`, + d.dependent, + ...this.npm.config.get('long') ? [d.type, d.homepage] : [], + ].join(':')).join('\n') + } + + #json (list) { + // TODO(BREAKING_CHANGE): this should just return an array. It's a list and + // turing it into an object with keys is lossy since multiple items in the + // list could have the same key. For now we hack that by only changing + // top level values into arrays if they have multiple outdated items + return list.reduce((acc, d) => { + const dep = { + current: d.current, + wanted: d.wanted, + latest: d.latest, + dependent: d.dependent, + location: d.path, + ...this.npm.config.get('long') ? { type: d.type, homepage: d.homepage } : {}, + } + acc[d.name] = acc[d.name] + // If this item alread has an outdated dep then we turn it into an array + ? (Array.isArray(acc[d.name]) ? acc[d.name] : [acc[d.name]]).concat(dep) + : dep + return acc + }, {}) + } +} + +module.exports = Outdated diff --git a/node_modules/npm/lib/commands/owner.js b/node_modules/npm/lib/commands/owner.js new file mode 100644 index 00000000..0f12cf92 --- /dev/null +++ b/node_modules/npm/lib/commands/owner.js @@ -0,0 +1,233 @@ +const npa = require('npm-package-arg') +const npmFetch = require('npm-registry-fetch') +const pacote = require('pacote') +const { log, output } = require('proc-log') +const { otplease } = require('../utils/auth.js') +const pkgJson = require('@npmcli/package-json') +const BaseCommand = require('../base-cmd.js') +const { redact } = require('@npmcli/redact') + +const readJson = async (path) => { + try { + const { content } = await pkgJson.normalize(path) + return content + } catch { + return {} + } +} + +class Owner extends BaseCommand { + static description = 'Manage package owners' + static name = 'owner' + static params = [ + 'registry', + 'otp', + 'workspace', + 'workspaces', + ] + + static usage = [ + 'add ', + 'rm ', + 'ls ', + ] + + static workspaces = true + static ignoreImplicitWorkspace = false + + static async completion (opts, npm) { + const argv = opts.conf.argv.remain + if (argv.length > 3) { + return [] + } + + if (argv[1] !== 'owner') { + argv.unshift('owner') + } + + if (argv.length === 2) { + return ['add', 'rm', 'ls'] + } + + // reaches registry in order to autocomplete rm + if (argv[2] === 'rm') { + if (npm.global) { + return [] + } + const { name } = await readJson(npm.prefix) + if (!name) { + return [] + } + + const spec = npa(name) + const data = await pacote.packument(spec, { + ...npm.flatOptions, + fullMetadata: true, + }) + if (data && data.maintainers && data.maintainers.length) { + return data.maintainers.map(m => m.name) + } + } + return [] + } + + async exec ([action, ...args]) { + if (action === 'ls' || action === 'list') { + await this.ls(args[0]) + } else if (action === 'add') { + await this.changeOwners(args[0], args[1], 'add') + } else if (action === 'rm' || action === 'remove') { + await this.changeOwners(args[0], args[1], 'rm') + } else { + throw this.usageError() + } + } + + async execWorkspaces ([action, ...args]) { + await this.setWorkspaces() + // ls pkg or owner add/rm package + if ((action === 'ls' && args.length > 0) || args.length > 1) { + const implicitWorkspaces = this.npm.config.get('workspace', 'default') + if (implicitWorkspaces.length === 0) { + log.warn(`Ignoring specified workspace(s)`) + } + return this.exec([action, ...args]) + } + + for (const [name] of this.workspaces) { + if (action === 'ls' || action === 'list') { + await this.ls(name) + } else if (action === 'add') { + await this.changeOwners(args[0], name, 'add') + } else if (action === 'rm' || action === 'remove') { + await this.changeOwners(args[0], name, 'rm') + } else { + throw this.usageError() + } + } + } + + async ls (pkg) { + pkg = await this.getPkg(this.npm.prefix, pkg) + const spec = npa(pkg) + + try { + const packumentOpts = { ...this.npm.flatOptions, fullMetadata: true, preferOnline: true } + const { maintainers } = await pacote.packument(spec, packumentOpts) + if (!maintainers || !maintainers.length) { + output.standard('no admin found') + } else { + output.standard(maintainers.map(m => `${m.name} <${m.email}>`).join('\n')) + } + } catch (err) { + log.error('owner ls', "Couldn't get owner data", redact(pkg)) + throw err + } + } + + async getPkg (prefix, pkg) { + if (!pkg) { + if (this.npm.global) { + throw this.usageError() + } + const { name } = await readJson(prefix) + if (!name) { + throw this.usageError() + } + + return name + } + return pkg + } + + async changeOwners (user, pkg, addOrRm) { + if (!user) { + throw this.usageError() + } + + pkg = await this.getPkg(this.npm.prefix, pkg) + log.verbose(`owner ${addOrRm}`, '%s to %s', user, pkg) + + const spec = npa(pkg) + const uri = `/-/user/org.couchdb.user:${encodeURIComponent(user)}` + let u + + try { + u = await npmFetch.json(uri, this.npm.flatOptions) + } catch (err) { + log.error('owner mutate', `Error getting user data for ${user}`) + throw err + } + + // normalize user data + u = { name: u.name, email: u.email } + + const data = await pacote.packument(spec, { + ...this.npm.flatOptions, + fullMetadata: true, + preferOnline: true, + }) + + const owners = data.maintainers || [] + let maintainers + if (addOrRm === 'add') { + const existing = owners.find(o => o.name === u.name) + if (existing) { + log.info( + 'owner add', + `Already a package owner: ${existing.name} <${existing.email}>` + ) + return + } + maintainers = [ + ...owners, + u, + ] + } else { + maintainers = owners.filter(o => o.name !== u.name) + + if (maintainers.length === owners.length) { + log.info('owner rm', 'Not a package owner: ' + u.name) + return false + } + + if (!maintainers.length) { + throw Object.assign( + new Error( + 'Cannot remove all owners of a package. Add someone else first.' + ), + { code: 'EOWNERRM' } + ) + } + } + + const dataPath = `/${spec.escapedName}/-rev/${encodeURIComponent(data._rev)}` + try { + const res = await otplease(this.npm, this.npm.flatOptions, opts => { + return npmFetch.json(dataPath, { + ...opts, + method: 'PUT', + body: { + _id: data._id, + _rev: data._rev, + maintainers, + }, + spec, + }) + }) + if (addOrRm === 'add') { + output.standard(`+ ${user} (${spec.name})`) + } else { + output.standard(`- ${user} (${spec.name})`) + } + return res + } catch (err) { + throw Object.assign( + new Error('Failed to update package: ' + JSON.stringify(err.message)), + { code: 'EOWNERMUTATE' } + ) + } + } +} + +module.exports = Owner diff --git a/node_modules/npm/lib/commands/pack.js b/node_modules/npm/lib/commands/pack.js new file mode 100644 index 00000000..bd190d88 --- /dev/null +++ b/node_modules/npm/lib/commands/pack.js @@ -0,0 +1,87 @@ +const pacote = require('pacote') +const libpack = require('libnpmpack') +const npa = require('npm-package-arg') +const { log, output } = require('proc-log') +const { getContents, logTar } = require('../utils/tar.js') +const BaseCommand = require('../base-cmd.js') + +class Pack extends BaseCommand { + static description = 'Create a tarball from a package' + static name = 'pack' + static params = [ + 'dry-run', + 'json', + 'pack-destination', + 'workspace', + 'workspaces', + 'include-workspace-root', + 'ignore-scripts', + ] + + static usage = [''] + static workspaces = true + static ignoreImplicitWorkspace = false + + async exec (args) { + if (args.length === 0) { + args = ['.'] + } + + const unicode = this.npm.config.get('unicode') + const json = this.npm.config.get('json') + + const Arborist = require('@npmcli/arborist') + // Get the manifests and filenames first so we can bail early on manifest + // errors before making any tarballs + const manifests = [] + for (const arg of args) { + const spec = npa(arg) + const manifest = await pacote.manifest(spec, { ...this.npm.flatOptions, Arborist }) + if (!manifest._id) { + throw new Error('Invalid package, must have name and version') + } + manifests.push({ arg, manifest }) + } + + // Load tarball names up for printing afterward to isolate from the + // noise generated during packing + const tarballs = [] + for (const { arg, manifest } of manifests) { + const tarballData = await libpack(arg, { + ...this.npm.flatOptions, + foregroundScripts: this.npm.config.isDefault('foreground-scripts') + ? true + : this.npm.config.get('foreground-scripts'), + prefix: this.npm.localPrefix, + workspaces: this.workspacePaths, + }) + tarballs.push(await getContents(manifest, tarballData)) + } + + for (const [index, tar] of Object.entries(tarballs)) { + // XXX(BREAKING_CHANGE): publish outputs a json object with package + // names as keys. Pack should do the same here instead of an array + logTar(tar, { unicode, json, key: index }) + if (!json) { + output.standard(tar.filename.replace(/^@/, '').replace(/\//, '-')) + } + } + } + + async execWorkspaces (args) { + // If they either ask for nothing, or explicitly include '.' in the args, + // we effectively translate that into each workspace requested + + const useWorkspaces = args.length === 0 || args.includes('.') + + if (!useWorkspaces) { + log.warn('Ignoring workspaces for specified package(s)') + return this.exec(args) + } + + await this.setWorkspaces() + return this.exec([...this.workspacePaths, ...args.filter(a => a !== '.')]) + } +} + +module.exports = Pack diff --git a/node_modules/npm/lib/commands/ping.js b/node_modules/npm/lib/commands/ping.js new file mode 100644 index 00000000..3388ba1a --- /dev/null +++ b/node_modules/npm/lib/commands/ping.js @@ -0,0 +1,30 @@ +const { redact } = require('@npmcli/redact') +const { log, output } = require('proc-log') +const pingUtil = require('../utils/ping.js') +const BaseCommand = require('../base-cmd.js') + +class Ping extends BaseCommand { + static description = 'Ping npm registry' + static params = ['registry'] + static name = 'ping' + + async exec () { + const cleanRegistry = redact(this.npm.config.get('registry')) + log.notice('PING', cleanRegistry) + const start = Date.now() + const details = await pingUtil({ ...this.npm.flatOptions }) + const time = Date.now() - start + log.notice('PONG', `${time}ms`) + if (this.npm.config.get('json')) { + output.buffer({ + registry: cleanRegistry, + time, + details, + }) + } else if (Object.keys(details).length) { + log.notice('PONG', JSON.stringify(details, null, 2)) + } + } +} + +module.exports = Ping diff --git a/node_modules/npm/lib/commands/pkg.js b/node_modules/npm/lib/commands/pkg.js new file mode 100644 index 00000000..5a236f6e --- /dev/null +++ b/node_modules/npm/lib/commands/pkg.js @@ -0,0 +1,129 @@ +const { output } = require('proc-log') +const PackageJson = require('@npmcli/package-json') +const BaseCommand = require('../base-cmd.js') +const Queryable = require('../utils/queryable.js') + +class Pkg extends BaseCommand { + static description = 'Manages your package.json' + static name = 'pkg' + static usage = [ + 'set = [= ...]', + 'get [ [ ...]]', + 'delete [ ...]', + 'set [[].= ...]', + 'set [[].= ...]', + 'fix', + ] + + static params = [ + 'force', + 'json', + 'workspace', + 'workspaces', + ] + + static workspaces = true + static ignoreImplicitWorkspace = false + + async exec (args, { path = this.npm.localPrefix, workspace } = {}) { + if (this.npm.global) { + throw Object.assign( + new Error(`There's no package.json file to manage on global mode`), + { code: 'EPKGGLOBAL' } + ) + } + + const [cmd, ..._args] = args + switch (cmd) { + case 'get': + return this.get(_args, { path, workspace }) + case 'set': + return this.set(_args, { path, workspace }).then(p => p.save()) + case 'delete': + return this.delete(_args, { path, workspace }).then(p => p.save()) + case 'fix': + return PackageJson.fix(path).then(p => p.save()) + default: + throw this.usageError() + } + } + + async execWorkspaces (args) { + await this.setWorkspaces() + for (const [workspace, path] of this.workspaces.entries()) { + await this.exec(args, { path, workspace }) + } + } + + async get (args, { path, workspace }) { + this.npm.config.set('json', true) + const pkgJson = await PackageJson.load(path) + + let result = pkgJson.content + + if (args.length) { + result = new Queryable(result).query(args) + // in case there's only a single argument and a single result from the query + // just prints that one element to stdout. + // TODO(BREAKING_CHANGE): much like other places where we unwrap single + // item arrays this should go away. it makes the behavior unknown for users + // who don't already know the shape of the data. + if (Object.keys(result).length === 1 && args.length === 1) { + result = result[args] + } + } + + // The display layer is responsible for calling JSON.stringify on the result + // TODO: https://github.com/npm/cli/issues/5508 a raw mode has been requested similar + // to jq -r. If that was added then this method should no longer set `json:true` all the time + output.buffer(workspace ? { [workspace]: result } : result) + } + + async set (args, { path }) { + const setError = () => + this.usageError('npm pkg set expects a key=value pair of args.') + + if (!args.length) { + throw setError() + } + + const force = this.npm.config.get('force') + const json = this.npm.config.get('json') + const pkgJson = await PackageJson.load(path) + const q = new Queryable(pkgJson.content) + for (const arg of args) { + const [key, ...rest] = arg.split('=') + const value = rest.join('=') + if (!key || !value) { + throw setError() + } + + q.set(key, json ? JSON.parse(value) : value, { force }) + } + + return pkgJson.update(q.toJSON()) + } + + async delete (args, { path }) { + const setError = () => + this.usageError('npm pkg delete expects key args.') + + if (!args.length) { + throw setError() + } + + const pkgJson = await PackageJson.load(path) + const q = new Queryable(pkgJson.content) + for (const key of args) { + if (!key) { + throw setError() + } + + q.delete(key) + } + + return pkgJson.update(q.toJSON()) + } +} + +module.exports = Pkg diff --git a/node_modules/npm/lib/commands/prefix.js b/node_modules/npm/lib/commands/prefix.js new file mode 100644 index 00000000..907ed5af --- /dev/null +++ b/node_modules/npm/lib/commands/prefix.js @@ -0,0 +1,14 @@ +const { output } = require('proc-log') +const BaseCommand = require('../base-cmd.js') + +class Prefix extends BaseCommand { + static description = 'Display prefix' + static name = 'prefix' + static params = ['global'] + + async exec () { + return output.standard(this.npm.prefix) + } +} + +module.exports = Prefix diff --git a/node_modules/npm/lib/commands/profile.js b/node_modules/npm/lib/commands/profile.js new file mode 100644 index 00000000..965fcbcb --- /dev/null +++ b/node_modules/npm/lib/commands/profile.js @@ -0,0 +1,390 @@ +const { inspect } = require('node:util') +const { URL } = require('node:url') +const { log, output } = require('proc-log') +const { get, set, createToken } = require('npm-profile') +const qrcodeTerminal = require('qrcode-terminal') +const { otplease } = require('../utils/auth.js') +const readUserInfo = require('../utils/read-user-info.js') +const BaseCommand = require('../base-cmd.js') + +const qrcode = url => + new Promise((resolve) => qrcodeTerminal.generate(url, resolve)) + +const knownProfileKeys = [ + 'name', + 'email', + 'two-factor auth', + 'fullname', + 'homepage', + 'freenode', + 'twitter', + 'github', + 'created', + 'updated', +] + +const writableProfileKeys = [ + 'email', + 'password', + 'fullname', + 'homepage', + 'freenode', + 'twitter', + 'github', +] + +class Profile extends BaseCommand { + static description = 'Change settings on your registry profile' + static name = 'profile' + static usage = [ + 'enable-2fa [auth-only|auth-and-writes]', + 'disable-2fa', + 'get []', + 'set ', + ] + + static params = [ + 'registry', + 'json', + 'parseable', + 'otp', + ] + + static async completion (opts) { + var argv = opts.conf.argv.remain + + if (!argv[2]) { + return ['enable-2fa', 'disable-2fa', 'get', 'set'] + } + + switch (argv[2]) { + case 'enable-2fa': + case 'enable-tfa': + return ['auth-and-writes', 'auth-only'] + + case 'disable-2fa': + case 'disable-tfa': + case 'get': + case 'set': + return [] + default: + throw new Error(argv[2] + ' not recognized') + } + } + + async exec (args) { + if (args.length === 0) { + throw this.usageError() + } + + const [subcmd, ...opts] = args + + switch (subcmd) { + case 'enable-2fa': + case 'enable-tfa': + case 'enable2fa': + case 'enabletfa': + return this.enable2fa(opts) + case 'disable-2fa': + case 'disable-tfa': + case 'disable2fa': + case 'disabletfa': + return this.disable2fa() + case 'get': + return this.get(opts) + case 'set': + return this.set(opts) + default: + throw new Error('Unknown profile command: ' + subcmd) + } + } + + async get (args) { + const tfa = 'two-factor auth' + const info = await get({ ...this.npm.flatOptions }) + + if (!info.cidr_whitelist) { + delete info.cidr_whitelist + } + + if (this.npm.config.get('json')) { + output.buffer(info) + return + } + + // clean up and format key/values for output + const cleaned = {} + for (const key of knownProfileKeys) { + cleaned[key] = info[key] || '' + } + + const unknownProfileKeys = Object.keys(info).filter((k) => !(k in cleaned)) + for (const key of unknownProfileKeys) { + cleaned[key] = info[key] || '' + } + + delete cleaned.tfa + delete cleaned.email_verified + cleaned.email += info.email_verified ? ' (verified)' : '(unverified)' + + if (info.tfa && !info.tfa.pending) { + cleaned[tfa] = info.tfa.mode + } else { + cleaned[tfa] = 'disabled' + } + + if (args.length) { + const values = args // comma or space separated + .join(',') + .split(/,/) + .filter((arg) => arg.trim() !== '') + .map((arg) => cleaned[arg]) + .join('\t') + output.standard(values) + } else { + if (this.npm.config.get('parseable')) { + for (const key of Object.keys(info)) { + if (key === 'tfa') { + output.standard(`${key}\t${cleaned[tfa]}`) + } else { + output.standard(`${key}\t${info[key]}`) + } + } + } else { + for (const [key, value] of Object.entries(cleaned)) { + output.standard(`${key}: ${value}`) + } + } + } + } + + async set (args) { + const conf = { ...this.npm.flatOptions } + const prop = (args[0] || '').toLowerCase().trim() + + let value = args.length > 1 ? args.slice(1).join(' ') : null + + const readPasswords = async () => { + const newpassword = await readUserInfo.password('New password: ') + const confirmedpassword = await readUserInfo.password(' Again: ') + + if (newpassword !== confirmedpassword) { + log.warn('profile', 'Passwords do not match, please try again.') + return readPasswords() + } + + return newpassword + } + + if (prop !== 'password' && value === null) { + throw new Error('npm profile set ') + } + + if (prop === 'password' && value !== null) { + throw new Error( + 'npm profile set password\n' + + 'Do not include your current or new passwords on the command line.') + } + + if (writableProfileKeys.indexOf(prop) === -1) { + throw new Error(`"${prop}" is not a property we can set. ` + + `Valid properties are: ` + writableProfileKeys.join(', ')) + } + + if (prop === 'password') { + const current = await readUserInfo.password('Current password: ') + const newpassword = await readPasswords() + + value = { old: current, new: newpassword } + } + + // FIXME: Work around to not clear everything other than what we're setting + const user = await get(conf) + const newUser = {} + + for (const key of writableProfileKeys) { + newUser[key] = user[key] + } + + newUser[prop] = value + + const result = await otplease(this.npm, conf, c => set(newUser, c)) + + if (this.npm.config.get('json')) { + output.buffer({ [prop]: result[prop] }) + } else if (this.npm.config.get('parseable')) { + output.standard(prop + '\t' + result[prop]) + } else if (result[prop] != null) { + output.standard('Set', prop, 'to', result[prop]) + } else { + output.standard('Set', prop) + } + } + + async enable2fa (args) { + if (args.length > 1) { + throw new Error('npm profile enable-2fa [auth-and-writes|auth-only]') + } + + const mode = args[0] || 'auth-and-writes' + if (mode !== 'auth-only' && mode !== 'auth-and-writes') { + throw new Error( + `Invalid two-factor authentication mode "${mode}".\n` + + 'Valid modes are:\n' + + ' auth-only - Require two-factor authentication only when logging in\n' + + ' auth-and-writes - Require two-factor authentication when logging in ' + + 'AND when publishing' + ) + } + + if (this.npm.config.get('json') || this.npm.config.get('parseable')) { + throw new Error( + 'Enabling two-factor authentication is an interactive operation and ' + + (this.npm.config.get('json') ? 'JSON' : 'parseable') + ' output mode is not available' + ) + } + + const info = { + tfa: { + mode: mode, + }, + } + + // if they're using legacy auth currently then we have to + // update them to a bearer token before continuing. + const creds = this.npm.config.getCredentialsByURI(this.npm.config.get('registry')) + const auth = {} + + if (creds.token) { + auth.token = creds.token + } else if (creds.username) { + auth.basic = { username: creds.username, password: creds.password } + } else if (creds.auth) { + const basic = Buffer.from(creds.auth, 'base64').toString().split(':', 2) + auth.basic = { username: basic[0], password: basic[1] } + } + + if (!auth.basic && !auth.token) { + throw new Error( + 'You need to be logged in to registry ' + + `${this.npm.config.get('registry')} in order to enable 2fa` + ) + } + + if (auth.basic) { + log.info('profile', 'Updating authentication to bearer token') + const result = await createToken( + auth.basic.password, false, [], { ...this.npm.flatOptions } + ) + + if (!result.token) { + throw new Error( + `Your registry ${this.npm.config.get('registry')} does not seem to ` + + 'support bearer tokens. Bearer tokens are required for ' + + 'two-factor authentication' + ) + } + + this.npm.config.setCredentialsByURI( + this.npm.config.get('registry'), + { token: result.token } + ) + await this.npm.config.save('user') + } + + log.notice('profile', 'Enabling two factor authentication for ' + mode) + const password = await readUserInfo.password() + info.tfa.password = password + + log.info('profile', 'Determine if tfa is pending') + const userInfo = await get({ ...this.npm.flatOptions }) + + const conf = { ...this.npm.flatOptions } + if (userInfo && userInfo.tfa && userInfo.tfa.pending) { + log.info('profile', 'Resetting two-factor authentication') + await set({ tfa: { password, mode: 'disable' } }, conf) + } else if (userInfo && userInfo.tfa) { + if (!conf.otp) { + conf.otp = await readUserInfo.otp( + 'Enter one-time password: ' + ) + } + } + + log.info('profile', 'Setting two-factor authentication to ' + mode) + const challenge = await set(info, conf) + + if (challenge.tfa === null) { + output.standard('Two factor authentication mode changed to: ' + mode) + return + } + + const badResponse = typeof challenge.tfa !== 'string' + || !/^otpauth:[/][/]/.test(challenge.tfa) + if (badResponse) { + throw new Error( + 'Unknown error enabling two-factor authentication. Expected otpauth URL' + + ', got: ' + inspect(challenge.tfa) + ) + } + + const otpauth = new URL(challenge.tfa) + const secret = otpauth.searchParams.get('secret') + const code = await qrcode(challenge.tfa) + + output.standard( + 'Scan into your authenticator app:\n' + code + '\n Or enter code:', secret + ) + + const interactiveOTP = + await readUserInfo.otp('And an OTP code from your authenticator: ') + + log.info('profile', 'Finalizing two-factor authentication') + + const result = await set({ tfa: [interactiveOTP] }, conf) + + output.standard( + '2FA successfully enabled. Below are your recovery codes, ' + + 'please print these out.' + ) + output.standard( + 'You will need these to recover access to your account ' + + 'if you lose your authentication device.' + ) + + for (const tfaCode of result.tfa) { + output.standard('\t' + tfaCode) + } + } + + async disable2fa () { + const conf = { ...this.npm.flatOptions } + const info = await get(conf) + + if (!info.tfa || info.tfa.pending) { + output.standard('Two factor authentication not enabled.') + return + } + + const password = await readUserInfo.password() + + if (!conf.otp) { + const msg = 'Enter one-time password: ' + conf.otp = await readUserInfo.otp(msg) + } + + log.info('profile', 'disabling tfa') + + await set({ tfa: { password: password, mode: 'disable' } }, conf) + + if (this.npm.config.get('json')) { + output.buffer({ tfa: false }) + } else if (this.npm.config.get('parseable')) { + output.standard('tfa\tfalse') + } else { + output.standard('Two factor authentication disabled.') + } + } +} + +module.exports = Profile diff --git a/node_modules/npm/lib/commands/prune.js b/node_modules/npm/lib/commands/prune.js new file mode 100644 index 00000000..1bcf8a95 --- /dev/null +++ b/node_modules/npm/lib/commands/prune.js @@ -0,0 +1,34 @@ +const reifyFinish = require('../utils/reify-finish.js') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +// prune extraneous packages +class Prune extends ArboristWorkspaceCmd { + static description = 'Remove extraneous packages' + static name = 'prune' + static params = [ + 'omit', + 'include', + 'dry-run', + 'json', + 'foreground-scripts', + 'ignore-scripts', + ...super.params, + ] + + static usage = ['[[<@scope>/]...]'] + + async exec () { + const where = this.npm.prefix + const Arborist = require('@npmcli/arborist') + const opts = { + ...this.npm.flatOptions, + path: where, + workspaces: this.workspaceNames, + } + const arb = new Arborist(opts) + await arb.prune(opts) + await reifyFinish(this.npm, arb) + } +} + +module.exports = Prune diff --git a/node_modules/npm/lib/commands/publish.js b/node_modules/npm/lib/commands/publish.js new file mode 100644 index 00000000..c59588fe --- /dev/null +++ b/node_modules/npm/lib/commands/publish.js @@ -0,0 +1,264 @@ +const { log, output } = require('proc-log') +const semver = require('semver') +const pack = require('libnpmpack') +const libpub = require('libnpmpublish').publish +const runScript = require('@npmcli/run-script') +const pacote = require('pacote') +const npa = require('npm-package-arg') +const npmFetch = require('npm-registry-fetch') +const { redactLog: replaceInfo } = require('@npmcli/redact') +const { otplease } = require('../utils/auth.js') +const { getContents, logTar } = require('../utils/tar.js') +// for historical reasons, publishConfig in package.json can contain ANY config +// keys that npm supports in .npmrc files and elsewhere. We *may* want to +// revisit this at some point, and have a minimal set that's a SemVer-major +// change that ought to get a RFC written on it. +const { flatten } = require('@npmcli/config/lib/definitions') +const pkgJson = require('@npmcli/package-json') +const BaseCommand = require('../base-cmd.js') + +class Publish extends BaseCommand { + static description = 'Publish a package' + static name = 'publish' + static params = [ + 'tag', + 'access', + 'dry-run', + 'otp', + 'workspace', + 'workspaces', + 'include-workspace-root', + 'provenance', + ] + + static usage = [''] + static workspaces = true + static ignoreImplicitWorkspace = false + + async exec (args) { + if (args.length === 0) { + args = ['.'] + } + if (args.length !== 1) { + throw this.usageError() + } + + await this.#publish(args) + } + + async execWorkspaces (args) { + const useWorkspaces = args.length === 0 || args.includes('.') + if (!useWorkspaces) { + log.warn('Ignoring workspaces for specified package(s)') + return this.exec(args) + } + await this.setWorkspaces() + + for (const [name, workspace] of this.workspaces.entries()) { + try { + await this.#publish([workspace], { workspace: name }) + } catch (err) { + if (err.code !== 'EPRIVATE') { + throw err + } + // eslint-disable-next-line max-len + log.warn('publish', `Skipping workspace ${this.npm.chalk.cyan(name)}, marked as ${this.npm.chalk.bold('private')}`) + } + } + } + + async #publish (args, { workspace } = {}) { + log.verbose('publish', replaceInfo(args)) + + const unicode = this.npm.config.get('unicode') + const dryRun = this.npm.config.get('dry-run') + const json = this.npm.config.get('json') + const defaultTag = this.npm.config.get('tag') + const ignoreScripts = this.npm.config.get('ignore-scripts') + const { silent } = this.npm + + if (semver.validRange(defaultTag)) { + throw new Error('Tag name must not be a valid SemVer range: ' + defaultTag.trim()) + } + + const opts = { ...this.npm.flatOptions, progress: false } + + // you can publish name@version, ./foo.tgz, etc. + // even though the default is the 'file:.' cwd. + const spec = npa(args[0]) + let manifest = await this.#getManifest(spec, opts) + + // only run scripts for directory type publishes + if (spec.type === 'directory' && !ignoreScripts) { + await runScript({ + event: 'prepublishOnly', + path: spec.fetchSpec, + stdio: 'inherit', + pkg: manifest, + }) + } + + // we pass dryRun: true to libnpmpack so it doesn't write the file to disk + const tarballData = await pack(spec, { + ...opts, + foregroundScripts: this.npm.config.isDefault('foreground-scripts') + ? true + : this.npm.config.get('foreground-scripts'), + dryRun: true, + prefix: this.npm.localPrefix, + workspaces: this.workspacePaths, + }) + const pkgContents = await getContents(manifest, tarballData) + const logPkg = () => logTar(pkgContents, { unicode, json, key: workspace }) + + // The purpose of re-reading the manifest is in case it changed, + // so that we send the latest and greatest thing to the registry + // note that publishConfig might have changed as well! + manifest = await this.#getManifest(spec, opts, true) + + const isPreRelease = Boolean(semver.parse(manifest.version).prerelease.length) + const isDefaultTag = this.npm.config.isDefault('tag') + + if (isPreRelease && isDefaultTag) { + throw new Error('You must specify a tag using --tag when publishing a prerelease version.') + } + + // If we are not in JSON mode then we show the user the contents of the tarball + // before it is published so they can see it while their otp is pending + if (!json) { + logPkg() + } + + const resolved = npa.resolve(manifest.name, manifest.version) + + // make sure tag is valid, this will throw if invalid + npa(`${manifest.name}@${defaultTag}`) + + const registry = npmFetch.pickRegistry(resolved, opts) + const creds = this.npm.config.getCredentialsByURI(registry) + const noCreds = !(creds.token || creds.username || creds.certfile && creds.keyfile) + const outputRegistry = replaceInfo(registry) + + // if a workspace package is marked private then we skip it + if (workspace && manifest.private) { + throw Object.assign( + new Error(`This package has been marked as private + Remove the 'private' field from the package.json to publish it.`), + { code: 'EPRIVATE' } + ) + } + + if (noCreds) { + const msg = `This command requires you to be logged in to ${outputRegistry}` + if (dryRun) { + log.warn('', `${msg} (dry-run)`) + } else { + throw Object.assign(new Error(msg), { code: 'ENEEDAUTH' }) + } + } + + const latestVersion = await this.#latestPublishedVersion(resolved, registry) + const latestSemverIsGreater = !!latestVersion && semver.gte(latestVersion, manifest.version) + + if (latestSemverIsGreater && isDefaultTag) { + /* eslint-disable-next-line max-len */ + throw new Error(`Cannot implicitly apply the "latest" tag because published version ${latestVersion} is higher than the new version ${manifest.version}. You must specify a tag using --tag.`) + } + + const access = opts.access === null ? 'default' : opts.access + let msg = `Publishing to ${outputRegistry} with tag ${defaultTag} and ${access} access` + if (dryRun) { + msg = `${msg} (dry-run)` + } + + log.notice('', msg) + + if (!dryRun) { + await otplease(this.npm, opts, o => libpub(manifest, tarballData, o)) + } + + // In json mode we dont log until the publish has completed as this will + // add it to the output only if completes successfully + if (json) { + logPkg() + } + + if (spec.type === 'directory' && !ignoreScripts) { + await runScript({ + event: 'publish', + path: spec.fetchSpec, + stdio: 'inherit', + pkg: manifest, + }) + + await runScript({ + event: 'postpublish', + path: spec.fetchSpec, + stdio: 'inherit', + pkg: manifest, + }) + } + + if (!json && !silent) { + output.standard(`+ ${pkgContents.id}`) + } + } + + async #latestPublishedVersion (spec, registry) { + try { + const packument = await pacote.packument(spec, { + ...this.npm.flatOptions, + preferOnline: true, + registry, + }) + if (typeof packument?.versions === 'undefined') { + return null + } + const ordered = Object.keys(packument?.versions) + .flatMap(v => { + const s = new semver.SemVer(v) + return s.prerelease.length > 0 ? [] : s + }) + .sort((a, b) => b.compare(a)) + return ordered.length >= 1 ? ordered[0].version : null + } catch (e) { + return null + } + } + + // if it's a directory, read it from the file system + // otherwise, get the full metadata from whatever it is + // XXX can't pacote read the manifest from a directory? + async #getManifest (spec, opts, logWarnings = false) { + let manifest + if (spec.type === 'directory') { + const changes = [] + const pkg = await pkgJson.fix(spec.fetchSpec, { changes }) + if (changes.length && logWarnings) { + /* eslint-disable-next-line max-len */ + log.warn('publish', 'npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors.') + log.warn('publish', `errors corrected:\n${changes.join('\n')}`) + } + // Prepare is the special function for publishing, different than normalize + const { content } = await pkg.prepare() + manifest = content + } else { + manifest = await pacote.manifest(spec, { + ...opts, + fullmetadata: true, + fullReadJson: true, + }) + } + if (manifest.publishConfig) { + const cliFlags = this.npm.config.data.get('cli').raw + // Filter out properties set in CLI flags to prioritize them over + // corresponding `publishConfig` settings + const filteredPublishConfig = Object.fromEntries( + Object.entries(manifest.publishConfig).filter(([key]) => !(key in cliFlags))) + flatten(filteredPublishConfig, opts) + } + return manifest + } +} + +module.exports = Publish diff --git a/node_modules/npm/lib/commands/query.js b/node_modules/npm/lib/commands/query.js new file mode 100644 index 00000000..74a50fc5 --- /dev/null +++ b/node_modules/npm/lib/commands/query.js @@ -0,0 +1,126 @@ +const { resolve } = require('node:path') +const BaseCommand = require('../base-cmd.js') +const { log, output } = require('proc-log') + +class QuerySelectorItem { + constructor (node) { + // all enumerable properties from the target + Object.assign(this, node.target.package) + + // append extra info + this.pkgid = node.target.pkgid + this.location = node.target.location + this.path = node.target.path + this.realpath = node.target.realpath + this.resolved = node.target.resolved + this.from = [] + this.to = [] + this.dev = node.target.dev + this.inBundle = node.target.inBundle + this.deduped = this.from.length > 1 + this.overridden = node.overridden + this.queryContext = node.queryContext + for (const edge of node.target.edgesIn) { + this.from.push(edge.from.location) + } + for (const [, edge] of node.target.edgesOut) { + if (edge.to) { + this.to.push(edge.to.location) + } + } + } +} + +class Query extends BaseCommand { + #response = [] // response is the query response + #seen = new Set() // paths we've seen so we can keep response deduped + + static description = 'Retrieve a filtered list of packages' + static name = 'query' + static usage = [''] + + static workspaces = true + static ignoreImplicitWorkspace = false + + static params = [ + 'global', + 'workspace', + 'workspaces', + 'include-workspace-root', + 'package-lock-only', + 'expect-results', + ] + + constructor (...args) { + super(...args) + this.npm.config.set('json', true) + } + + async exec (args) { + const packageLock = this.npm.config.get('package-lock-only') + const Arborist = require('@npmcli/arborist') + const arb = new Arborist({ + ...this.npm.flatOptions, + // one dir up from wherever node_modules lives + path: resolve(this.npm.dir, '..'), + forceActual: !packageLock, + }) + let tree + if (packageLock) { + try { + tree = await arb.loadVirtual() + } catch (err) { + log.verbose('loadVirtual', err.stack) + throw this.usageError( + 'A package lock or shrinkwrap file is required in package-lock-only mode' + ) + } + } else { + tree = await arb.loadActual() + } + await this.#queryTree(tree, args[0]) + this.#output() + } + + async execWorkspaces (args) { + await this.setWorkspaces() + const Arborist = require('@npmcli/arborist') + const arb = new Arborist({ + ...this.npm.flatOptions, + path: this.npm.prefix, + }) + // FIXME: Workspace support in query does not work as expected so this does not + // do the same package-lock-only check as this.exec(). + // https://github.com/npm/cli/pull/6732#issuecomment-1708804921 + const tree = await arb.loadActual() + for (const path of this.workspacePaths) { + const wsTree = path === tree.root.path + ? tree // --includes-workspace-root + : await tree.querySelectorAll(`.workspace:path(${path})`).then(r => r[0].target) + await this.#queryTree(wsTree, args[0]) + } + this.#output() + } + + #output () { + this.checkExpected(this.#response.length) + output.buffer(this.#response) + } + + // builds a normalized inventory + async #queryTree (tree, arg) { + const items = await tree.querySelectorAll(arg, this.npm.flatOptions) + for (const node of items) { + const { location } = node.target + if (!location || !this.#seen.has(location)) { + const item = new QuerySelectorItem(node) + this.#response.push(item) + if (location) { + this.#seen.add(item.location) + } + } + } + } +} + +module.exports = Query diff --git a/node_modules/npm/lib/commands/rebuild.js b/node_modules/npm/lib/commands/rebuild.js new file mode 100644 index 00000000..1c198361 --- /dev/null +++ b/node_modules/npm/lib/commands/rebuild.js @@ -0,0 +1,84 @@ +const { resolve } = require('node:path') +const { output } = require('proc-log') +const npa = require('npm-package-arg') +const semver = require('semver') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +class Rebuild extends ArboristWorkspaceCmd { + static description = 'Rebuild a package' + static name = 'rebuild' + static params = [ + 'global', + 'bin-links', + 'foreground-scripts', + 'ignore-scripts', + ...super.params, + ] + + static usage = ['[] ...]'] + + // TODO + /* istanbul ignore next */ + static async completion (opts, npm) { + const completion = require('../utils/installed-deep.js') + return completion(npm, opts) + } + + async exec (args) { + const globalTop = resolve(this.npm.globalDir, '..') + const where = this.npm.global ? globalTop : this.npm.prefix + const Arborist = require('@npmcli/arborist') + const arb = new Arborist({ + ...this.npm.flatOptions, + path: where, + // TODO when extending ReifyCmd + // workspaces: this.workspaceNames, + }) + + if (args.length) { + // get the set of nodes matching the name that we want rebuilt + const tree = await arb.loadActual() + const specs = args.map(arg => { + const spec = npa(arg) + if (spec.rawSpec === '*') { + return spec + } + + if (spec.type !== 'range' && spec.type !== 'version' && spec.type !== 'directory') { + throw new Error('`npm rebuild` only supports SemVer version/range specifiers') + } + + return spec + }) + const nodes = tree.inventory.filter(node => this.isNode(specs, node)) + + await arb.rebuild({ nodes }) + } else { + await arb.rebuild() + } + + output.standard('rebuilt dependencies successfully') + } + + isNode (specs, node) { + return specs.some(spec => { + if (spec.type === 'directory') { + return node.path === spec.fetchSpec + } + + if (spec.name !== node.name) { + return false + } + + if (spec.rawSpec === '' || spec.rawSpec === '*') { + return true + } + + const { version } = node.package + // TODO: add tests for a package with missing version + return semver.satisfies(version, spec.fetchSpec) + }) + } +} + +module.exports = Rebuild diff --git a/node_modules/npm/lib/commands/repo.js b/node_modules/npm/lib/commands/repo.js new file mode 100644 index 00000000..0bfb2cf9 --- /dev/null +++ b/node_modules/npm/lib/commands/repo.js @@ -0,0 +1,55 @@ +const { URL } = require('node:url') +const PackageUrlCmd = require('../package-url-cmd.js') + +class Repo extends PackageUrlCmd { + static description = 'Open package repository page in the browser' + static name = 'repo' + + getUrl (spec, mani) { + const r = mani.repository + const rurl = !r ? null + : typeof r === 'string' ? r + : typeof r === 'object' && typeof r.url === 'string' ? r.url + : null + + if (!rurl) { + throw Object.assign(new Error('no repository'), { + pkgid: spec, + }) + } + + const info = this.hostedFromMani(mani) + const url = info ? + info.browse(mani.repository.directory) : unknownHostedUrl(rurl) + + if (!url) { + throw Object.assign(new Error('no repository: could not get url'), { + pkgid: spec, + }) + } + return url + } +} + +module.exports = Repo + +const unknownHostedUrl = url => { + try { + const { + protocol, + hostname, + pathname, + } = new URL(url) + + /* istanbul ignore next - URL ctor should prevent this */ + if (!protocol || !hostname) { + return null + } + + const proto = /(git\+)http:$/.test(protocol) ? 'http:' : 'https:' + const path = pathname.replace(/\.git$/, '') + return `${proto}//${hostname}${path}` + } catch { + return null + } +} diff --git a/node_modules/npm/lib/commands/restart.js b/node_modules/npm/lib/commands/restart.js new file mode 100644 index 00000000..7ca2eb32 --- /dev/null +++ b/node_modules/npm/lib/commands/restart.js @@ -0,0 +1,13 @@ +const LifecycleCmd = require('../lifecycle-cmd.js') + +// This ends up calling run-script(['restart', ...args]) +class Restart extends LifecycleCmd { + static description = 'Restart a package' + static name = 'restart' + static params = [ + 'ignore-scripts', + 'script-shell', + ] +} + +module.exports = Restart diff --git a/node_modules/npm/lib/commands/root.js b/node_modules/npm/lib/commands/root.js new file mode 100644 index 00000000..180f4c4e --- /dev/null +++ b/node_modules/npm/lib/commands/root.js @@ -0,0 +1,14 @@ +const { output } = require('proc-log') +const BaseCommand = require('../base-cmd.js') + +class Root extends BaseCommand { + static description = 'Display npm root' + static name = 'root' + static params = ['global'] + + async exec () { + output.standard(this.npm.dir) + } +} + +module.exports = Root diff --git a/node_modules/npm/lib/commands/run-script.js b/node_modules/npm/lib/commands/run-script.js new file mode 100644 index 00000000..50c745d6 --- /dev/null +++ b/node_modules/npm/lib/commands/run-script.js @@ -0,0 +1,218 @@ +const { output } = require('proc-log') +const pkgJson = require('@npmcli/package-json') +const BaseCommand = require('../base-cmd.js') +const { getError } = require('../utils/error-message.js') +const { outputError } = require('../utils/output-error.js') + +class RunScript extends BaseCommand { + static description = 'Run arbitrary package scripts' + static params = [ + 'workspace', + 'workspaces', + 'include-workspace-root', + 'if-present', + 'ignore-scripts', + 'foreground-scripts', + 'script-shell', + ] + + static name = 'run-script' + static usage = [' [-- ]'] + static workspaces = true + static ignoreImplicitWorkspace = false + static isShellout = true + static checkDevEngines = true + + static async completion (opts, npm) { + const argv = opts.conf.argv.remain + if (argv.length === 2) { + const { content: { scripts = {} } } = await pkgJson.normalize(npm.localPrefix) + .catch(() => ({ content: {} })) + if (opts.isFish) { + return Object.keys(scripts).map(s => `${s}\t${scripts[s].slice(0, 30)}`) + } + return Object.keys(scripts) + } + } + + async exec (args) { + if (args.length) { + await this.#run(args, { path: this.npm.localPrefix }) + } else { + await this.#list(this.npm.localPrefix) + } + } + + async execWorkspaces (args) { + await this.setWorkspaces() + + const ws = [...this.workspaces.entries()] + for (const [workspace, path] of ws) { + const last = path === ws.at(-1)[1] + + if (!args.length) { + const newline = await this.#list(path, { workspace }) + if (newline && !last) { + output.standard('') + } + continue + } + + const pkg = await pkgJson.normalize(path).then(p => p.content) + try { + await this.#run(args, { path, pkg, workspace }) + } catch (e) { + const err = getError(e, { npm: this.npm, command: null }) + outputError({ + ...err, + error: [ + ['', `Lifecycle script \`${args[0]}\` failed with error:`], + ...err.error, + ['workspace', pkg._id || pkg.name], + ['location', path], + ], + }) + process.exitCode = err.exitCode + if (!last) { + output.error('') + } + } + } + } + + async #run ([event, ...args], { path, pkg, workspace }) { + const runScript = require('@npmcli/run-script') + + pkg ??= await pkgJson.normalize(path).then(p => p.content) + + const { scripts = {} } = pkg + + if (event === 'restart' && !scripts.restart) { + scripts.restart = 'npm stop --if-present && npm start' + } else if (event === 'env' && !scripts.env) { + const { isWindowsShell } = require('../utils/is-windows.js') + scripts.env = isWindowsShell ? 'SET' : 'env' + } + + pkg.scripts = scripts + + if ( + !Object.prototype.hasOwnProperty.call(scripts, event) && + !(event === 'start' && (await runScript.isServerPackage(path))) + ) { + if (this.npm.config.get('if-present')) { + return + } + + const suggestions = require('../utils/did-you-mean.js')(pkg, event) + const wsArg = workspace && path !== this.npm.localPrefix + ? ` --workspace=${pkg._id || pkg.name}` + : '' + throw new Error([ + `Missing script: "${event}"${suggestions}\n`, + 'To see a list of scripts, run:', + ` npm run${wsArg}`, + ].join('\n')) + } + + // positional args only added to the main event, not pre/post + const events = [[event, args]] + if (!this.npm.config.get('ignore-scripts')) { + if (scripts[`pre${event}`]) { + events.unshift([`pre${event}`, []]) + } + + if (scripts[`post${event}`]) { + events.push([`post${event}`, []]) + } + } + + for (const [ev, evArgs] of events) { + await runScript({ + path, + // this || undefined is because runScript will be unhappy with the + // default null value + scriptShell: this.npm.config.get('script-shell') || undefined, + stdio: 'inherit', + pkg, + event: ev, + args: evArgs, + }) + } + } + + async #list (path, { workspace } = {}) { + const { scripts = {}, name, _id } = await pkgJson.normalize(path).then(p => p.content) + const scriptEntries = Object.entries(scripts) + + if (this.npm.silent) { + return + } + + if (this.npm.config.get('json')) { + output.buffer(workspace ? { [workspace]: scripts } : scripts) + return + } + + if (!scriptEntries.length) { + return + } + + if (this.npm.config.get('parseable')) { + output.standard(scriptEntries + .map((s) => (workspace ? [workspace, ...s] : s).join(':')) + .join('\n') + .trim()) + return + } + + const cmdList = [ + 'prepare', 'prepublishOnly', + 'prepack', 'postpack', + 'dependencies', + 'preinstall', 'install', 'postinstall', + 'prepublish', 'publish', 'postpublish', + 'prerestart', 'restart', 'postrestart', + 'prestart', 'start', 'poststart', + 'prestop', 'stop', 'poststop', + 'pretest', 'test', 'posttest', + 'preuninstall', 'uninstall', 'postuninstall', + 'preversion', 'version', 'postversion', + ] + const [cmds, runScripts] = scriptEntries.reduce((acc, s) => { + acc[cmdList.includes(s[0]) ? 0 : 1].push(s) + return acc + }, [[], []]) + + const { reset, bold, cyan, dim, blue } = this.npm.chalk + const pkgId = `in ${cyan(_id || name)}` + const title = (t) => reset(bold(t)) + + if (cmds.length) { + output.standard(`${title('Lifecycle scripts')} included ${pkgId}:`) + for (const [k, v] of cmds) { + output.standard(` ${k}`) + output.standard(` ${dim(v)}`) + } + } + + if (runScripts.length) { + const via = `via \`${blue('npm run-script')}\`:` + if (!cmds.length) { + output.standard(`${title('Scripts')} available ${pkgId} ${via}`) + } else { + output.standard(`available ${via}`) + } + for (const [k, v] of runScripts) { + output.standard(` ${k}`) + output.standard(` ${dim(v)}`) + } + } + + // Return true to indicate that something was output for this path + // that should be separated from others + return true + } +} + +module.exports = RunScript diff --git a/node_modules/npm/lib/commands/sbom.js b/node_modules/npm/lib/commands/sbom.js new file mode 100644 index 00000000..278c6d50 --- /dev/null +++ b/node_modules/npm/lib/commands/sbom.js @@ -0,0 +1,134 @@ +const localeCompare = require('@isaacs/string-locale-compare')('en') +const BaseCommand = require('../base-cmd.js') +const { log, output } = require('proc-log') +const { cyclonedxOutput } = require('../utils/sbom-cyclonedx.js') +const { spdxOutput } = require('../utils/sbom-spdx.js') + +const SBOM_FORMATS = ['cyclonedx', 'spdx'] + +class SBOM extends BaseCommand { + #response = {} // response is the sbom response + + static description = 'Generate a Software Bill of Materials (SBOM)' + static name = 'sbom' + static workspaces = true + + static params = [ + 'omit', + 'package-lock-only', + 'sbom-format', + 'sbom-type', + 'workspace', + 'workspaces', + ] + + async exec () { + const sbomFormat = this.npm.config.get('sbom-format') + const packageLockOnly = this.npm.config.get('package-lock-only') + + if (!sbomFormat) { + /* eslint-disable-next-line max-len */ + throw this.usageError(`Must specify --sbom-format flag with one of: ${SBOM_FORMATS.join(', ')}.`) + } + + const opts = { + ...this.npm.flatOptions, + path: this.npm.prefix, + forceActual: true, + } + const Arborist = require('@npmcli/arborist') + const arb = new Arborist(opts) + + const tree = packageLockOnly ? await arb.loadVirtual(opts).catch(() => { + /* eslint-disable-next-line max-len */ + throw this.usageError('A package lock or shrinkwrap file is required in package-lock-only mode') + }) : await arb.loadActual(opts) + + // Collect the list of selected workspaces in the project + const wsNodes = this.workspaceNames?.length + ? arb.workspaceNodes(tree, this.workspaceNames) + : null + + // Build the selector and query the tree for the list of nodes + const selector = this.#buildSelector({ wsNodes }) + log.info('sbom', `Using dependency selector: ${selector}`) + const items = await tree.querySelectorAll(selector) + + const errors = items.flatMap(node => detectErrors(node)) + if (errors.length) { + throw Object.assign(new Error([...new Set(errors)].join('\n')), { + code: 'ESBOMPROBLEMS', + }) + } + + // Populate the response with the list of unique nodes (sorted by location) + this.#buildResponse(items.sort((a, b) => localeCompare(a.location, b.location))) + + // TODO(BREAKING_CHANGE): all sbom output is in json mode but setting it before + // any of the errors will cause those to be thrown in json mode. + this.npm.config.set('json', true) + output.buffer(this.#response) + } + + async execWorkspaces (args) { + await this.setWorkspaces() + return this.exec(args) + } + + // Build the selector from all of the specified filter options + #buildSelector ({ wsNodes }) { + let selector + const omit = this.npm.flatOptions.omit + const workspacesEnabled = this.npm.flatOptions.workspacesEnabled + + // If omit is specified, omit all nodes and their children which match the + // specified selectors + const omits = omit.reduce((acc, o) => `${acc}:not(.${o})`, '') + + if (!workspacesEnabled) { + // If workspaces are disabled, omit all workspace nodes and their children + selector = `:root > :not(.workspace)${omits},:root > :not(.workspace) *${omits},:extraneous` + } else if (wsNodes && wsNodes.length > 0) { + // If one or more workspaces are selected, select only those workspaces and their children + selector = wsNodes.map(ws => `#${ws.name},#${ws.name} *${omits}`).join(',') + } else { + selector = `:root *${omits},:extraneous` + } + + // Always include the root node + return `:root,${selector}` + } + + // builds a normalized inventory + #buildResponse (items) { + const sbomFormat = this.npm.config.get('sbom-format') + const packageType = this.npm.config.get('sbom-type') + const packageLockOnly = this.npm.config.get('package-lock-only') + + this.#response = sbomFormat === 'cyclonedx' + ? cyclonedxOutput({ npm: this.npm, nodes: items, packageType, packageLockOnly }) + : spdxOutput({ npm: this.npm, nodes: items, packageType }) + } +} + +const detectErrors = (node) => { + const errors = [] + + // Look for missing dependencies (that are NOT optional), or invalid dependencies + for (const edge of node.edgesOut.values()) { + if (edge.missing && !(edge.type === 'optional' || edge.type === 'peerOptional')) { + errors.push(`missing: ${edge.name}@${edge.spec}, required by ${edge.from.pkgid}`) + } + + if (edge.invalid) { + /* istanbul ignore next */ + const spec = edge.spec || '*' + const from = edge.from.pkgid + errors.push(`invalid: ${edge.to.pkgid}, ${spec} required by ${from}`) + } + } + + return errors +} + +module.exports = SBOM diff --git a/node_modules/npm/lib/commands/search.js b/node_modules/npm/lib/commands/search.js new file mode 100644 index 00000000..8b6c01e3 --- /dev/null +++ b/node_modules/npm/lib/commands/search.js @@ -0,0 +1,70 @@ +const Pipeline = require('minipass-pipeline') +const libSearch = require('libnpmsearch') +const { log, output } = require('proc-log') +const formatSearchStream = require('../utils/format-search-stream.js') +const BaseCommand = require('../base-cmd.js') + +class Search extends BaseCommand { + static description = 'Search for packages' + static name = 'search' + static params = [ + 'json', + 'color', + 'parseable', + 'description', + 'searchlimit', + 'searchopts', + 'searchexclude', + 'registry', + 'prefer-online', + 'prefer-offline', + 'offline', + ] + + static usage = [' [ ...]'] + + async exec (args) { + const opts = { + ...this.npm.flatOptions, + ...this.npm.flatOptions.search, + include: args.map(s => s.toLowerCase()).filter(Boolean), + exclude: this.npm.flatOptions.search.exclude.split(/\s+/), + } + + if (opts.include.length === 0) { + throw new Error('search must be called with arguments') + } + + // Used later to figure out whether we had any packages go out + let anyOutput = false + + // Grab a configured output stream that will spit out packages in the desired format. + const outputStream = formatSearchStream({ + args, // --searchinclude options are not highlighted + ...opts, + npm: this.npm, + }) + + log.silly('search', 'searching packages') + const p = new Pipeline( + libSearch.stream(opts.include, opts), + outputStream + ) + + p.on('data', chunk => { + if (!anyOutput) { + anyOutput = true + } + output.standard(chunk.toString('utf8')) + }) + + await p.promise() + if (!anyOutput && !this.npm.config.get('json') && !this.npm.config.get('parseable')) { + output.standard('No matches found for ' + (args.map(JSON.stringify).join(' '))) + } + + log.silly('search', 'search completed') + } +} + +module.exports = Search diff --git a/node_modules/npm/lib/commands/set.js b/node_modules/npm/lib/commands/set.js new file mode 100644 index 00000000..2e61762b --- /dev/null +++ b/node_modules/npm/lib/commands/set.js @@ -0,0 +1,26 @@ +const Npm = require('../npm.js') +const BaseCommand = require('../base-cmd.js') + +class Set extends BaseCommand { + static description = 'Set a value in the npm configuration' + static name = 'set' + static usage = ['= [= ...] (See `npm config`)'] + static params = ['global', 'location'] + static ignoreImplicitWorkspace = false + + // TODO + /* istanbul ignore next */ + static async completion (opts) { + const Config = Npm.cmd('config') + return Config.completion(opts) + } + + async exec (args) { + if (!args.length) { + throw this.usageError() + } + return this.npm.exec('config', ['set'].concat(args)) + } +} + +module.exports = Set diff --git a/node_modules/npm/lib/commands/shrinkwrap.js b/node_modules/npm/lib/commands/shrinkwrap.js new file mode 100644 index 00000000..86215c18 --- /dev/null +++ b/node_modules/npm/lib/commands/shrinkwrap.js @@ -0,0 +1,73 @@ +const { resolve, basename } = require('node:path') +const { unlink } = require('node:fs/promises') +const { log } = require('proc-log') +const BaseCommand = require('../base-cmd.js') + +class Shrinkwrap extends BaseCommand { + static description = 'Lock down dependency versions for publication' + static name = 'shrinkwrap' + static ignoreImplicitWorkspace = false + + async exec () { + // if has a npm-shrinkwrap.json, nothing to do + // if has a package-lock.json, rename to npm-shrinkwrap.json + // if has neither, load the actual tree and save that as npm-shrinkwrap.json + // + // loadVirtual, fall back to loadActual + // rename shrinkwrap file type, and tree.meta.save() + if (this.npm.global) { + const er = new Error('`npm shrinkwrap` does not work for global packages') + er.code = 'ESHRINKWRAPGLOBAL' + throw er + } + + const Arborist = require('@npmcli/arborist') + const path = this.npm.prefix + const sw = resolve(path, 'npm-shrinkwrap.json') + const arb = new Arborist({ ...this.npm.flatOptions, path }) + const tree = await arb.loadVirtual().catch(() => arb.loadActual()) + const { meta } = tree + const newFile = meta.hiddenLockfile || !meta.loadedFromDisk + const oldFilename = meta.filename + const notSW = !newFile && basename(oldFilename) !== 'npm-shrinkwrap.json' + + // The computed lockfile version of a hidden lockfile is always 3 + // even if the actual value of the property is a different. + // When shrinkwrap is run with only a hidden lockfile we want to + // set the shrinkwrap lockfile version as whatever was explicitly + // requested with a fallback to the actual value from the hidden + // lockfile. + if (meta.hiddenLockfile) { + meta.lockfileVersion = arb.options.lockfileVersion || + meta.originalLockfileVersion + } + meta.hiddenLockfile = false + meta.filename = sw + await meta.save() + + const updatedVersion = meta.originalLockfileVersion !== meta.lockfileVersion + ? meta.lockfileVersion + : null + + if (newFile) { + let message = 'created a lockfile as npm-shrinkwrap.json' + if (updatedVersion) { + message += ` with version ${updatedVersion}` + } + log.notice('', message) + } else if (notSW) { + await unlink(oldFilename) + let message = 'package-lock.json has been renamed to npm-shrinkwrap.json' + if (updatedVersion) { + message += ` and updated to version ${updatedVersion}` + } + log.notice('', message) + } else if (updatedVersion) { + log.notice('', `npm-shrinkwrap.json updated to version ${updatedVersion}`) + } else { + log.notice('', 'npm-shrinkwrap.json up to date') + } + } +} + +module.exports = Shrinkwrap diff --git a/node_modules/npm/lib/commands/star.js b/node_modules/npm/lib/commands/star.js new file mode 100644 index 00000000..7d1be1d3 --- /dev/null +++ b/node_modules/npm/lib/commands/star.js @@ -0,0 +1,72 @@ +const npmFetch = require('npm-registry-fetch') +const npa = require('npm-package-arg') +const { log, output } = require('proc-log') +const getIdentity = require('../utils/get-identity') +const BaseCommand = require('../base-cmd.js') + +class Star extends BaseCommand { + static description = 'Mark your favorite packages' + static name = 'star' + static usage = ['[...]'] + static params = [ + 'registry', + 'unicode', + 'otp', + ] + + static ignoreImplicitWorkspace = false + + async exec (args) { + if (!args.length) { + throw this.usageError() + } + + // if we're unstarring, then show an empty star image + // otherwise, show the full star image + const unicode = this.npm.config.get('unicode') + const full = unicode ? '\u2605 ' : '(*)' + const empty = unicode ? '\u2606 ' : '( )' + const show = this.name === 'star' ? full : empty + + const pkgs = args.map(npa) + const username = await getIdentity(this.npm, this.npm.flatOptions) + + for (const pkg of pkgs) { + const fullData = await npmFetch.json(pkg.escapedName, { + ...this.npm.flatOptions, + spec: pkg, + query: { write: true }, + preferOnline: true, + }) + + const body = { + _id: fullData._id, + _rev: fullData._rev, + users: fullData.users || {}, + } + + if (this.name === 'star') { + log.info('star', 'starring', body._id) + body.users[username] = true + log.verbose('star', 'starring', body) + } else { + delete body.users[username] + log.info('unstar', 'unstarring', body._id) + log.verbose('unstar', 'unstarring', body) + } + + const data = await npmFetch.json(pkg.escapedName, { + ...this.npm.flatOptions, + spec: pkg, + method: 'PUT', + body, + }) + + output.standard(show + ' ' + pkg.name) + log.verbose('star', data) + return data + } + } +} + +module.exports = Star diff --git a/node_modules/npm/lib/commands/stars.js b/node_modules/npm/lib/commands/stars.js new file mode 100644 index 00000000..d059d012 --- /dev/null +++ b/node_modules/npm/lib/commands/stars.js @@ -0,0 +1,39 @@ +const npmFetch = require('npm-registry-fetch') +const { log, output } = require('proc-log') +const getIdentity = require('../utils/get-identity.js') +const BaseCommand = require('../base-cmd.js') + +class Stars extends BaseCommand { + static description = 'View packages marked as favorites' + static name = 'stars' + static usage = ['[]'] + static params = ['registry'] + static ignoreImplicitWorkspace = false + + async exec ([user]) { + try { + if (!user) { + user = await getIdentity(this.npm, this.npm.flatOptions) + } + + const { rows } = await npmFetch.json('/-/_view/starredByUser', { + ...this.npm.flatOptions, + query: { key: `"${user}"` }, + }) + if (rows.length === 0) { + log.warn('stars', 'user has not starred any packages') + } + + for (const row of rows) { + output.standard(row.value) + } + } catch (err) { + if (err.code === 'ENEEDAUTH') { + log.warn('stars', 'auth is required to look up your username') + } + throw err + } + } +} + +module.exports = Stars diff --git a/node_modules/npm/lib/commands/start.js b/node_modules/npm/lib/commands/start.js new file mode 100644 index 00000000..a16eade2 --- /dev/null +++ b/node_modules/npm/lib/commands/start.js @@ -0,0 +1,13 @@ +const LifecycleCmd = require('../lifecycle-cmd.js') + +// This ends up calling run-script(['start', ...args]) +class Start extends LifecycleCmd { + static description = 'Start a package' + static name = 'start' + static params = [ + 'ignore-scripts', + 'script-shell', + ] +} + +module.exports = Start diff --git a/node_modules/npm/lib/commands/stop.js b/node_modules/npm/lib/commands/stop.js new file mode 100644 index 00000000..ae3031f0 --- /dev/null +++ b/node_modules/npm/lib/commands/stop.js @@ -0,0 +1,13 @@ +const LifecycleCmd = require('../lifecycle-cmd.js') + +// This ends up calling run-script(['stop', ...args]) +class Stop extends LifecycleCmd { + static description = 'Stop a package' + static name = 'stop' + static params = [ + 'ignore-scripts', + 'script-shell', + ] +} + +module.exports = Stop diff --git a/node_modules/npm/lib/commands/team.js b/node_modules/npm/lib/commands/team.js new file mode 100644 index 00000000..089e9179 --- /dev/null +++ b/node_modules/npm/lib/commands/team.js @@ -0,0 +1,155 @@ +const columns = require('cli-columns') +const libteam = require('libnpmteam') +const { output } = require('proc-log') +const { otplease } = require('../utils/auth.js') + +const BaseCommand = require('../base-cmd.js') +class Team extends BaseCommand { + static description = 'Manage organization teams and team memberships' + static name = 'team' + static usage = [ + 'create [--otp ]', + 'destroy [--otp ]', + 'add [--otp ]', + 'rm [--otp ]', + 'ls |', + ] + + static params = [ + 'registry', + 'otp', + 'parseable', + 'json', + ] + + static ignoreImplicitWorkspace = false + + static async completion (opts) { + const { conf: { argv: { remain: argv } } } = opts + const subcommands = ['create', 'destroy', 'add', 'rm', 'ls'] + + if (argv.length === 2) { + return subcommands + } + + if (subcommands.includes(argv[2])) { + return [] + } + + throw new Error(argv[2] + ' not recognized') + } + + async exec ([cmd, entity = '', user = '']) { + // Entities are in the format : + // XXX: "description" option to libnpmteam is used as a description of the + // team, but in npm's options, this is a boolean meaning "show the + // description in npm search output". Hence its being set to null here. + await otplease(this.npm, { ...this.npm.flatOptions }, opts => { + entity = entity.replace(/^@/, '') + switch (cmd) { + case 'create': return this.create(entity, opts) + case 'destroy': return this.destroy(entity, opts) + case 'add': return this.add(entity, user, opts) + case 'rm': return this.rm(entity, user, opts) + case 'ls': { + const match = entity.match(/[^:]+:.+/) + if (match) { + return this.listUsers(entity, opts) + } else { + return this.listTeams(entity, opts) + } + } + default: + throw this.usageError() + } + }) + } + + async create (entity, opts) { + await libteam.create(entity, opts) + if (opts.json) { + output.buffer({ + created: true, + team: entity, + }) + } else if (opts.parseable) { + output.standard(`${entity}\tcreated`) + } else if (!this.npm.silent) { + output.standard(`+@${entity}`) + } + } + + async destroy (entity, opts) { + await libteam.destroy(entity, opts) + if (opts.json) { + output.buffer({ + deleted: true, + team: entity, + }) + } else if (opts.parseable) { + output.standard(`${entity}\tdeleted`) + } else if (!this.npm.silent) { + output.standard(`-@${entity}`) + } + } + + async add (entity, user, opts) { + await libteam.add(user, entity, opts) + if (opts.json) { + output.buffer({ + added: true, + team: entity, + user, + }) + } else if (opts.parseable) { + output.standard(`${user}\t${entity}\tadded`) + } else if (!this.npm.silent) { + output.standard(`${user} added to @${entity}`) + } + } + + async rm (entity, user, opts) { + await libteam.rm(user, entity, opts) + if (opts.json) { + output.buffer({ + removed: true, + team: entity, + user, + }) + } else if (opts.parseable) { + output.standard(`${user}\t${entity}\tremoved`) + } else if (!this.npm.silent) { + output.standard(`${user} removed from @${entity}`) + } + } + + async listUsers (entity, opts) { + const users = (await libteam.lsUsers(entity, opts)).sort() + if (opts.json) { + output.buffer(users) + } else if (opts.parseable) { + output.standard(users.join('\n')) + } else if (!this.npm.silent) { + const plural = users.length === 1 ? '' : 's' + const more = users.length === 0 ? '' : ':\n' + output.standard(`\n@${entity} has ${users.length} user${plural}${more}`) + output.standard(columns(users, { padding: 1 })) + } + } + + async listTeams (entity, opts) { + const teams = (await libteam.lsTeams(entity, opts)).sort() + if (opts.json) { + output.buffer(teams) + } else if (opts.parseable) { + output.standard(teams.join('\n')) + } else if (!this.npm.silent) { + const plural = teams.length === 1 ? '' : 's' + const more = teams.length === 0 ? '' : ':\n' + output.standard(`\n@${entity} has ${teams.length} team${plural}${more}`) + output.standard(columns(teams.map(t => `@${t}`), { padding: 1 })) + } + } +} + +module.exports = Team diff --git a/node_modules/npm/lib/commands/test.js b/node_modules/npm/lib/commands/test.js new file mode 100644 index 00000000..eccc47fc --- /dev/null +++ b/node_modules/npm/lib/commands/test.js @@ -0,0 +1,13 @@ +const LifecycleCmd = require('../lifecycle-cmd.js') + +// This ends up calling run-script(['test', ...args]) +class Test extends LifecycleCmd { + static description = 'Test a package' + static name = 'test' + static params = [ + 'ignore-scripts', + 'script-shell', + ] +} + +module.exports = Test diff --git a/node_modules/npm/lib/commands/token.js b/node_modules/npm/lib/commands/token.js new file mode 100644 index 00000000..d2e85ffe --- /dev/null +++ b/node_modules/npm/lib/commands/token.js @@ -0,0 +1,197 @@ +const { log, output } = require('proc-log') +const { listTokens, createToken, removeToken } = require('npm-profile') +const { otplease } = require('../utils/auth.js') +const readUserInfo = require('../utils/read-user-info.js') +const BaseCommand = require('../base-cmd.js') + +class Token extends BaseCommand { + static description = 'Manage your authentication tokens' + static name = 'token' + static usage = ['list', 'revoke ', 'create [--read-only] [--cidr=list]'] + static params = ['read-only', 'cidr', 'registry', 'otp'] + + static async completion (opts) { + const argv = opts.conf.argv.remain + const subcommands = ['list', 'revoke', 'create'] + if (argv.length === 2) { + return subcommands + } + + if (subcommands.includes(argv[2])) { + return [] + } + + throw new Error(argv[2] + ' not recognized') + } + + async exec (args) { + if (args.length === 0) { + return this.list() + } + switch (args[0]) { + case 'list': + case 'ls': + return this.list() + case 'rm': + case 'delete': + case 'revoke': + case 'remove': + return this.rm(args.slice(1)) + case 'create': + return this.create(args.slice(1)) + default: + throw this.usageError(`${args[0]} is not a recognized subcommand.`) + } + } + + async list () { + const json = this.npm.config.get('json') + const parseable = this.npm.config.get('parseable') + log.info('token', 'getting list') + const tokens = await listTokens(this.npm.flatOptions) + if (json) { + output.buffer(tokens) + return + } + if (parseable) { + output.standard(['key', 'token', 'created', 'readonly', 'CIDR whitelist'].join('\t')) + tokens.forEach(token => { + output.standard( + [ + token.key, + token.token, + token.created, + token.readonly ? 'true' : 'false', + token.cidr_whitelist ? token.cidr_whitelist.join(',') : '', + ].join('\t') + ) + }) + return + } + this.generateTokenIds(tokens, 6) + const chalk = this.npm.chalk + for (const token of tokens) { + const level = token.readonly ? 'Read only token' : 'Publish token' + const created = String(token.created).slice(0, 10) + /* eslint-disable-next-line max-len */ + output.standard(`${chalk.blue(level)} ${token.token}… with id ${chalk.cyan(token.id)} created ${created}`) + if (token.cidr_whitelist) { + output.standard(`with IP whitelist: ${chalk.green(token.cidr_whitelist.join(','))}`) + } + output.standard() + } + } + + async rm (args) { + if (args.length === 0) { + throw this.usageError('`` argument is required.') + } + + const json = this.npm.config.get('json') + const parseable = this.npm.config.get('parseable') + const toRemove = [] + const opts = { ...this.npm.flatOptions } + log.info('token', `removing ${toRemove.length} tokens`) + const tokens = await listTokens(opts) + args.forEach(id => { + const matches = tokens.filter(token => token.key.indexOf(id) === 0) + if (matches.length === 1) { + toRemove.push(matches[0].key) + } else if (matches.length > 1) { + throw new Error( + /* eslint-disable-next-line max-len */ + `Token ID "${id}" was ambiguous, a new token may have been created since you last ran \`npm token list\`.` + ) + } else { + const tokenMatches = tokens.some(t => id.indexOf(t.token) === 0) + if (!tokenMatches) { + throw new Error(`Unknown token id or value "${id}".`) + } + + toRemove.push(id) + } + }) + await Promise.all( + toRemove.map(key => { + return otplease(this.npm, opts, c => removeToken(key, c)) + }) + ) + if (json) { + output.buffer(toRemove) + } else if (parseable) { + output.standard(toRemove.join('\t')) + } else { + output.standard('Removed ' + toRemove.length + ' token' + (toRemove.length !== 1 ? 's' : '')) + } + } + + async create () { + const json = this.npm.config.get('json') + const parseable = this.npm.config.get('parseable') + const cidr = this.npm.config.get('cidr') + const readonly = this.npm.config.get('read-only') + + const validCIDR = await this.validateCIDRList(cidr) + const password = await readUserInfo.password() + log.info('token', 'creating') + const result = await otplease( + this.npm, + { ...this.npm.flatOptions }, + c => createToken(password, readonly, validCIDR, c) + ) + delete result.key + delete result.updated + if (json) { + output.buffer(result) + } else if (parseable) { + Object.keys(result).forEach(k => output.standard(k + '\t' + result[k])) + } else { + const chalk = this.npm.chalk + // Identical to list + const level = result.readonly ? 'read only' : 'publish' + output.standard(`Created ${chalk.blue(level)} token ${result.token}`) + if (result.cidr_whitelist?.length) { + output.standard(`with IP whitelist: ${chalk.green(result.cidr_whitelist.join(','))}`) + } + } + } + + invalidCIDRError (msg) { + return Object.assign(new Error(msg), { code: 'EINVALIDCIDR' }) + } + + generateTokenIds (tokens, minLength) { + for (const token of tokens) { + token.id = token.key + for (let ii = minLength; ii < token.key.length; ++ii) { + const match = tokens.some( + ot => ot !== token && ot.key.slice(0, ii) === token.key.slice(0, ii) + ) + if (!match) { + token.id = token.key.slice(0, ii) + break + } + } + } + } + + async validateCIDRList (cidrs) { + const { v4: isCidrV4, v6: isCidrV6 } = await import('is-cidr') + const maybeList = [].concat(cidrs).filter(Boolean) + const list = maybeList.length === 1 ? maybeList[0].split(/,\s*/) : maybeList + for (const cidr of list) { + if (isCidrV6(cidr)) { + throw this.invalidCIDRError( + `CIDR whitelist can only contain IPv4 addresses${cidr} is IPv6` + ) + } + + if (!isCidrV4(cidr)) { + throw this.invalidCIDRError(`CIDR whitelist contains invalid CIDR entry: ${cidr}`) + } + } + return list + } +} + +module.exports = Token diff --git a/node_modules/npm/lib/commands/uninstall.js b/node_modules/npm/lib/commands/uninstall.js new file mode 100644 index 00000000..f9baebe3 --- /dev/null +++ b/node_modules/npm/lib/commands/uninstall.js @@ -0,0 +1,56 @@ +const { resolve } = require('node:path') +const pkgJson = require('@npmcli/package-json') +const reifyFinish = require('../utils/reify-finish.js') +const completion = require('../utils/installed-shallow.js') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +class Uninstall extends ArboristWorkspaceCmd { + static description = 'Remove a package' + static name = 'uninstall' + static params = ['save', 'global', ...super.params] + static usage = ['[<@scope>/]...'] + static ignoreImplicitWorkspace = false + + // TODO + /* istanbul ignore next */ + static async completion (opts, npm) { + return completion(npm, opts) + } + + async exec (args) { + if (!args.length) { + if (!this.npm.global) { + throw new Error('Must provide a package name to remove') + } else { + try { + const { content: pkg } = await pkgJson.normalize(this.npm.localPrefix) + args.push(pkg.name) + } catch (er) { + if (er.code !== 'ENOENT' && er.code !== 'ENOTDIR') { + throw er + } else { + throw this.usageError() + } + } + } + } + + // the /path/to/node_modules/.. + const path = this.npm.global + ? resolve(this.npm.globalDir, '..') + : this.npm.localPrefix + + const Arborist = require('@npmcli/arborist') + const opts = { + ...this.npm.flatOptions, + path, + rm: args, + workspaces: this.workspaceNames, + } + const arb = new Arborist(opts) + await arb.reify(opts) + await reifyFinish(this.npm, arb) + } +} + +module.exports = Uninstall diff --git a/node_modules/npm/lib/commands/unpublish.js b/node_modules/npm/lib/commands/unpublish.js new file mode 100644 index 00000000..4944888f --- /dev/null +++ b/node_modules/npm/lib/commands/unpublish.js @@ -0,0 +1,176 @@ +const libaccess = require('libnpmaccess') +const libunpub = require('libnpmpublish').unpublish +const npa = require('npm-package-arg') +const pacote = require('pacote') +const { output, log } = require('proc-log') +const pkgJson = require('@npmcli/package-json') +const { flatten } = require('@npmcli/config/lib/definitions') +const getIdentity = require('../utils/get-identity.js') +const { otplease } = require('../utils/auth.js') +const BaseCommand = require('../base-cmd.js') + +const LAST_REMAINING_VERSION_ERROR = 'Refusing to delete the last version of the package. ' + +'It will block from republishing a new version for 24 hours.\n' + +'Run with --force to do this.' + +class Unpublish extends BaseCommand { + static description = 'Remove a package from the registry' + static name = 'unpublish' + static params = ['dry-run', 'force', 'workspace', 'workspaces'] + static usage = ['[]'] + static workspaces = true + static ignoreImplicitWorkspace = false + + static async getKeysOfVersions (name, opts) { + const packument = await pacote.packument(name, { + ...opts, + spec: name, + query: { write: true }, + }) + return Object.keys(packument.versions) + } + + static async completion (args, npm) { + const { partialWord, conf } = args + + if (conf.argv.remain.length >= 3) { + return [] + } + + const opts = { ...npm.flatOptions } + const username = await getIdentity(npm, { ...opts }).catch(() => null) + if (!username) { + return [] + } + + const access = await libaccess.getPackages(username, opts) + // do a bit of filtering at this point, so that we don't need + // to fetch versions for more than one thing, but also don't + // accidentally unpublish a whole project + let pkgs = Object.keys(access) + if (!partialWord || !pkgs.length) { + return pkgs + } + + const pp = npa(partialWord).name + pkgs = pkgs.filter(p => !p.indexOf(pp)) + if (pkgs.length > 1) { + return pkgs + } + + const versions = await Unpublish.getKeysOfVersions(pkgs[0], opts) + if (!versions.length) { + return pkgs + } else { + return versions.map(v => `${pkgs[0]}@${v}`) + } + } + + async exec (args, { localPrefix } = {}) { + if (args.length > 1) { + throw this.usageError() + } + + // workspace mode + if (!localPrefix) { + localPrefix = this.npm.localPrefix + } + + const force = this.npm.config.get('force') + const { silent } = this.npm + const dryRun = this.npm.config.get('dry-run') + + let spec + if (args.length) { + spec = npa(args[0]) + if (spec.type !== 'version' && spec.rawSpec !== '*') { + throw this.usageError( + 'Can only unpublish a single version, or the entire project.\n' + + 'Tags and ranges are not supported.' + ) + } + } + + log.silly('unpublish', 'args[0]', args[0]) + log.silly('unpublish', 'spec', spec) + + if (spec?.rawSpec === '*' && !force) { + throw this.usageError( + 'Refusing to delete entire project.\n' + + 'Run with --force to do this.' + ) + } + + const opts = { ...this.npm.flatOptions } + + let manifest + try { + const { content } = await pkgJson.prepare(localPrefix) + manifest = content + } catch (err) { + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') { + if (!spec) { + // We needed a local package.json to figure out what package to + // unpublish + throw this.usageError() + } + } else { + // folks should know if ANY local package.json had a parsing error. + // They may be relying on `publishConfig` to be loading and we don't + // want to ignore errors in that case. + throw err + } + } + + let pkgVersion // for cli output + if (spec) { + pkgVersion = spec.type === 'version' ? `@${spec.rawSpec}` : '' + } else { + spec = npa.resolve(manifest.name, manifest.version) + log.verbose('unpublish', manifest) + pkgVersion = manifest.version ? `@${manifest.version}` : '' + if (!manifest.version && !force) { + throw this.usageError( + 'Refusing to delete entire project.\n' + + 'Run with --force to do this.' + ) + } + } + + // If localPrefix has a package.json with a name that matches the package + // being unpublished, load up the publishConfig + if (manifest?.name === spec.name && manifest.publishConfig) { + const cliFlags = this.npm.config.data.get('cli').raw + // Filter out properties set in CLI flags to prioritize them over + // corresponding `publishConfig` settings + const filteredPublishConfig = Object.fromEntries( + Object.entries(manifest.publishConfig).filter(([key]) => !(key in cliFlags))) + flatten(filteredPublishConfig, opts) + } + + const versions = await Unpublish.getKeysOfVersions(spec.name, opts) + if (versions.length === 1 && spec.rawSpec === versions[0] && !force) { + throw this.usageError(LAST_REMAINING_VERSION_ERROR) + } + if (versions.length === 1) { + pkgVersion = '' + } + + if (!dryRun) { + await otplease(this.npm, opts, o => libunpub(spec, o)) + } + if (!silent) { + output.standard(`- ${spec.name}${pkgVersion}`) + } + } + + async execWorkspaces (args) { + await this.setWorkspaces() + + for (const path of this.workspacePaths) { + await this.exec(args, { localPrefix: path }) + } + } +} + +module.exports = Unpublish diff --git a/node_modules/npm/lib/commands/unstar.js b/node_modules/npm/lib/commands/unstar.js new file mode 100644 index 00000000..c7296686 --- /dev/null +++ b/node_modules/npm/lib/commands/unstar.js @@ -0,0 +1,8 @@ +const Star = require('./star.js') + +class Unstar extends Star { + static description = 'Remove an item from your favorite packages' + static name = 'unstar' +} + +module.exports = Unstar diff --git a/node_modules/npm/lib/commands/update.js b/node_modules/npm/lib/commands/update.js new file mode 100644 index 00000000..235a9a41 --- /dev/null +++ b/node_modules/npm/lib/commands/update.js @@ -0,0 +1,68 @@ +const path = require('node:path') +const { log } = require('proc-log') +const reifyFinish = require('../utils/reify-finish.js') +const ArboristWorkspaceCmd = require('../arborist-cmd.js') + +class Update extends ArboristWorkspaceCmd { + static description = 'Update packages' + static name = 'update' + + static params = [ + 'save', + 'global', + 'install-strategy', + 'legacy-bundling', + 'global-style', + 'omit', + 'include', + 'strict-peer-deps', + 'package-lock', + 'foreground-scripts', + 'ignore-scripts', + 'audit', + 'bin-links', + 'fund', + 'dry-run', + ...super.params, + ] + + static usage = ['[...]'] + + // TODO + /* istanbul ignore next */ + static async completion (opts, npm) { + const completion = require('../utils/installed-deep.js') + return completion(npm, opts) + } + + async exec (args) { + const update = args.length === 0 ? true : args + const global = path.resolve(this.npm.globalDir, '..') + const where = this.npm.global ? global : this.npm.prefix + + // In the context of `npm update` the save + // config value should default to `false` + const save = this.npm.config.isDefault('save') + ? false + : this.npm.config.get('save') + + if (this.npm.config.get('depth')) { + log.warn('update', 'The --depth option no longer has any effect. See RFC0019.\n' + + 'https://github.com/npm/rfcs/blob/latest/implemented/0019-remove-update-depth-option.md') + } + + const Arborist = require('@npmcli/arborist') + const opts = { + ...this.npm.flatOptions, + path: where, + save, + workspaces: this.workspaceNames, + } + const arb = new Arborist(opts) + + await arb.reify({ ...opts, update }) + await reifyFinish(this.npm, arb) + } +} + +module.exports = Update diff --git a/node_modules/npm/lib/commands/version.js b/node_modules/npm/lib/commands/version.js new file mode 100644 index 00000000..d6c2dd4c --- /dev/null +++ b/node_modules/npm/lib/commands/version.js @@ -0,0 +1,151 @@ +const { resolve } = require('node:path') +const { readFile } = require('node:fs/promises') +const { output } = require('proc-log') +const BaseCommand = require('../base-cmd.js') + +class Version extends BaseCommand { + static description = 'Bump a package version' + static name = 'version' + static params = [ + 'allow-same-version', + 'commit-hooks', + 'git-tag-version', + 'json', + 'preid', + 'sign-git-tag', + 'workspace', + 'workspaces', + 'workspaces-update', + 'include-workspace-root', + ] + + static workspaces = true + static ignoreImplicitWorkspace = false + + /* eslint-disable-next-line max-len */ + static usage = ['[ | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]'] + + static async completion (opts) { + const { + conf: { + argv: { remain }, + }, + } = opts + if (remain.length > 2) { + return [] + } + + return [ + 'major', + 'minor', + 'patch', + 'premajor', + 'preminor', + 'prepatch', + 'prerelease', + 'from-git', + ] + } + + async exec (args) { + switch (args.length) { + case 0: + return this.list() + case 1: + return this.change(args) + default: + throw this.usageError() + } + } + + async execWorkspaces (args) { + switch (args.length) { + case 0: + return this.listWorkspaces() + case 1: + return this.changeWorkspaces(args) + default: + throw this.usageError() + } + } + + async change (args) { + const libnpmversion = require('libnpmversion') + const prefix = this.npm.config.get('tag-version-prefix') + const version = await libnpmversion(args[0], { + ...this.npm.flatOptions, + path: this.npm.prefix, + }) + return output.standard(`${prefix}${version}`) + } + + async changeWorkspaces (args) { + const updateWorkspaces = require('../utils/update-workspaces.js') + const libnpmversion = require('libnpmversion') + const prefix = this.npm.config.get('tag-version-prefix') + const { + config, + flatOptions, + localPrefix, + } = this.npm + await this.setWorkspaces() + const updatedWorkspaces = [] + for (const [name, path] of this.workspaces) { + output.standard(name) + const version = await libnpmversion(args[0], { + ...flatOptions, + 'git-tag-version': false, + path, + }) + updatedWorkspaces.push(name) + output.standard(`${prefix}${version}`) + } + return updateWorkspaces({ + config, + flatOptions, + localPrefix, + npm: this.npm, + workspaces: updatedWorkspaces, + }) + } + + async list (results = {}) { + const pj = resolve(this.npm.prefix, 'package.json') + + const pkg = await readFile(pj, 'utf8') + .then(data => JSON.parse(data)) + .catch(() => ({})) + + if (pkg.name && pkg.version) { + results[pkg.name] = pkg.version + } + + results.npm = this.npm.version + for (const [key, version] of Object.entries(process.versions)) { + results[key] = version + } + + if (this.npm.config.get('json')) { + output.buffer(results) + } else { + output.standard(results) + } + } + + async listWorkspaces () { + const results = {} + await this.setWorkspaces() + for (const path of this.workspacePaths) { + const pj = resolve(path, 'package.json') + // setWorkspaces has already parsed package.json so we know it won't error + const pkg = await readFile(pj, 'utf8').then(data => JSON.parse(data)) + + if (pkg.name && pkg.version) { + results[pkg.name] = pkg.version + } + } + return this.list(results) + } +} + +module.exports = Version diff --git a/node_modules/npm/lib/commands/view.js b/node_modules/npm/lib/commands/view.js new file mode 100644 index 00000000..627c126f --- /dev/null +++ b/node_modules/npm/lib/commands/view.js @@ -0,0 +1,486 @@ +const columns = require('cli-columns') +const { readFile } = require('node:fs/promises') +const jsonParse = require('json-parse-even-better-errors') +const { log, output, META } = require('proc-log') +const npa = require('npm-package-arg') +const { resolve } = require('node:path') +const formatBytes = require('../utils/format-bytes.js') +const relativeDate = require('tiny-relative-date') +const semver = require('semver') +const { inspect } = require('node:util') +const { packument } = require('pacote') +const Queryable = require('../utils/queryable.js') +const BaseCommand = require('../base-cmd.js') +const { getError } = require('../utils/error-message.js') +const { jsonError, outputError } = require('../utils/output-error.js') + +const readJson = file => readFile(file, 'utf8').then(jsonParse) + +class View extends BaseCommand { + static description = 'View registry info' + static name = 'view' + static params = [ + 'json', + 'workspace', + 'workspaces', + 'include-workspace-root', + ] + + static workspaces = true + static ignoreImplicitWorkspace = false + static usage = ['[] [[.subfield]...]'] + + static async completion (opts, npm) { + if (opts.conf.argv.remain.length <= 2) { + // There used to be registry completion here, but it stopped + // making sense somewhere around 50,000 packages on the registry + return + } + // have the package, get the fields + const config = { + ...npm.flatOptions, + fullMetadata: true, + preferOnline: true, + } + const spec = npa(opts.conf.argv.remain[2]) + const pckmnt = await packument(spec, config) + const defaultTag = npm.config.get('tag') + const dv = pckmnt.versions[pckmnt['dist-tags'][defaultTag]] + pckmnt.versions = Object.keys(pckmnt.versions).sort(semver.compareLoose) + + return getCompletionFields(pckmnt).concat(getCompletionFields(dv)) + } + + async exec (args) { + let { pkg, local, rest } = parseArgs(args) + + if (local) { + if (this.npm.global) { + throw new Error('Cannot use view command in global mode.') + } + const dir = this.npm.prefix + const manifest = await readJson(resolve(dir, 'package.json')) + if (!manifest.name) { + throw new Error('Invalid package.json, no "name" field') + } + // put the version back if it existed + pkg = `${manifest.name}${pkg.slice(1)}` + } + + await this.#viewPackage(pkg, rest) + } + + async execWorkspaces (args) { + const { pkg, local, rest } = parseArgs(args) + + if (!local) { + log.warn('Ignoring workspaces for specified package(s)') + return this.exec([pkg, ...rest]) + } + + const json = this.npm.config.get('json') + await this.setWorkspaces() + + for (const name of this.workspaceNames) { + try { + await this.#viewPackage(`${name}${pkg.slice(1)}`, rest, { workspace: true }) + } catch (e) { + const err = getError(e, { npm: this.npm, command: this }) + if (err.code !== 'E404') { + throw e + } + if (json) { + output.buffer({ [META]: true, jsonError: { [name]: jsonError(err, this.npm) } }) + } else { + outputError(err) + } + process.exitCode = err.exitCode + } + } + } + + async #viewPackage (name, args, { workspace } = {}) { + const wholePackument = !args.length + const json = this.npm.config.get('json') + + // If we are viewing many packages and outputting individual fields then + // output the name before doing any async activity + if (!json && !wholePackument && workspace) { + output.standard(`${name}:`) + } + + const [pckmnt, data] = await this.#getData(name, args, wholePackument) + + if (!json && wholePackument) { + // pretty view (entire packument) + for (const v of data) { + output.standard(this.#prettyView(pckmnt, Object.values(v)[0][Queryable.ALL])) + } + return + } + + const res = this.#packageOutput(cleanData(data, wholePackument), pckmnt._id) + if (res) { + if (json) { + output.buffer(workspace ? { [name]: res } : res) + } else { + output.standard(res) + } + } + } + + async #getData (pkg, args) { + const spec = npa(pkg) + + const pckmnt = await packument(spec, { + ...this.npm.flatOptions, + preferOnline: true, + fullMetadata: true, + }) + + // get the data about this package + let version = this.npm.config.get('tag') + // rawSpec is the git url if this is from git + if (spec.type !== 'git' && spec.type !== 'directory' && spec.rawSpec !== '*') { + version = spec.rawSpec + } + + if (pckmnt['dist-tags']?.[version]) { + version = pckmnt['dist-tags'][version] + } + + if (pckmnt.time?.unpublished) { + const u = pckmnt.time.unpublished + throw Object.assign(new Error(`Unpublished on ${u.time}`), { + statusCode: 404, + code: 'E404', + pkgid: pckmnt._id, + }) + } + + const versions = pckmnt.versions || {} + pckmnt.versions = Object.keys(versions).filter(v => { + if (semver.valid(v)) { + return true + } + log.info('view', `Ignoring invalid version: ${v}`) + return false + }).sort(semver.compareLoose) + + // remove readme unless we asked for it + if (args.indexOf('readme') === -1) { + delete pckmnt.readme + } + + const data = Object.entries(versions) + .filter(([v]) => semver.satisfies(v, version, true)) + .flatMap(([, v]) => { + // remove readme unless we asked for it + if (args.indexOf('readme') !== -1) { + delete v.readme + } + return showFields({ + data: pckmnt, + version: v, + fields: args, + json: this.npm.config.get('json'), + }) + }) + + // No data has been pushed because no data is matching the specified version + if (!data.length && version !== 'latest') { + throw Object.assign(new Error(`No match found for version ${version}`), { + statusCode: 404, + code: 'E404', + pkgid: `${pckmnt._id}@${version}`, + }) + } + + return [pckmnt, data] + } + + #packageOutput (data, name) { + const json = this.npm.config.get('json') + const versions = Object.keys(data) + const includeVersions = versions.length > 1 + + let includeFields + const res = versions.flatMap((v) => { + const fields = Object.entries(data[v]) + + includeFields ||= (fields.length > 1) + + const msg = json ? {} : [] + + for (let [f, d] of fields) { + d = cleanup(d) + + if (json) { + msg[f] = d + continue + } + + if (includeVersions || includeFields || typeof d !== 'string') { + d = inspect(d, { + showHidden: false, + depth: 5, + colors: this.npm.color, + maxArrayLength: null, + }) + } + + if (f && includeFields) { + f += ' = ' + } + + msg.push(`${includeVersions ? `${name}@${v} ` : ''}${includeFields ? f : ''}${d}`) + } + + return msg + }) + + if (json) { + // TODO(BREAKING_CHANGE): all unwrapping should be removed. Users should know + // based on their arguments if they can expect an array or an object. And this + // unwrapping can break that assumption. Eg `npm view abbrev@^2` should always + // return an array, but currently since there is only one version matching `^2` + // this will return a single object instead. + const first = Object.keys(res[0] || {}) + const jsonRes = first.length === 1 ? res.map(m => m[first[0]]) : res + if (jsonRes.length === 0) { + return + } + if (jsonRes.length === 1) { + return jsonRes[0] + } + return jsonRes + } + + return res.join('\n').trim() + } + + #prettyView (packu, manifest) { + // More modern, pretty printing of default view + const unicode = this.npm.config.get('unicode') + const chalk = this.npm.chalk + const deps = Object.entries(manifest.dependencies || {}).map(([k, dep]) => + `${chalk.blue(k)}: ${dep}` + ) + // Sort dist-tags by publish time, then tag name, keeping latest at the top of the list + const distTags = Object.entries(packu['dist-tags']) + .sort(([aTag, aVer], [bTag, bVer]) => { + const aTime = aTag === 'latest' ? Infinity : Date.parse(packu.time[aVer]) + const bTime = bTag === 'latest' ? Infinity : Date.parse(packu.time[bVer]) + if (aTime === bTime) { + return aTag > bTag ? -1 : 1 + } + return aTime > bTime ? -1 : 1 + }) + .map(([k, t]) => `${chalk.blue(k)}: ${t}`) + + const site = manifest.homepage?.url || manifest.homepage + const bins = Object.keys(manifest.bin || {}) + const licenseField = manifest.license || 'Proprietary' + const license = typeof licenseField === 'string' + ? licenseField + : (licenseField.type || 'Proprietary') + + const res = [] + + res.push('') + res.push([ + chalk.underline.cyan(`${manifest.name}@${manifest.version}`), + license.toLowerCase().trim() === 'proprietary' + ? chalk.red(license) + : chalk.green(license), + `deps: ${deps.length ? chalk.cyan(deps.length) : chalk.cyan('none')}`, + `versions: ${chalk.cyan(packu.versions.length + '')}`, + ].join(' | ')) + + manifest.description && res.push(manifest.description) + if (site) { + res.push(chalk.blue(site)) + } + + manifest.deprecated && res.push( + `\n${chalk.redBright('DEPRECATED')}${unicode ? ' ⚠️ ' : '!!'} - ${manifest.deprecated}` + ) + + if (packu.keywords?.length) { + res.push(`\nkeywords: ${ + packu.keywords.map(k => chalk.cyan(k)).join(', ') + }`) + } + + if (bins.length) { + res.push(`\nbin: ${chalk.cyan(bins.join(', '))}`) + } + + res.push('\ndist') + res.push(`.tarball: ${chalk.blue(manifest.dist.tarball)}`) + res.push(`.shasum: ${chalk.green(manifest.dist.shasum)}`) + if (manifest.dist.integrity) { + res.push(`.integrity: ${chalk.green(manifest.dist.integrity)}`) + } + if (manifest.dist.unpackedSize) { + res.push(`.unpackedSize: ${chalk.blue(formatBytes(manifest.dist.unpackedSize, true))}`) + } + + if (deps.length) { + const maxDeps = 24 + res.push('\ndependencies:') + res.push(columns(deps.slice(0, maxDeps), { padding: 1 })) + if (deps.length > maxDeps) { + res.push(chalk.dim(`(...and ${deps.length - maxDeps} more.)`)) + } + } + + if (packu.maintainers?.length) { + res.push('\nmaintainers:') + packu.maintainers.forEach(u => + res.push(`- ${unparsePerson({ + name: chalk.blue(u.name), + email: chalk.dim(u.email) })}`) + ) + } + + res.push('\ndist-tags:') + const maxTags = 12 + res.push(columns(distTags.slice(0, maxTags), { padding: 1, sort: false })) + if (distTags.length > maxTags) { + res.push(chalk.dim(`(...and ${distTags.length - maxTags} more.)`)) + } + + const publisher = manifest._npmUser && unparsePerson({ + name: chalk.blue(manifest._npmUser.name), + email: chalk.dim(manifest._npmUser.email), + }) + if (publisher || packu.time) { + let publishInfo = 'published' + if (packu.time) { + publishInfo += ` ${chalk.cyan(relativeDate(packu.time[manifest.version]))}` + } + if (publisher) { + publishInfo += ` by ${publisher}` + } + res.push('') + res.push(publishInfo) + } + + return res.join('\n') + } +} + +module.exports = View + +function parseArgs (args) { + if (!args.length) { + args = ['.'] + } + + const pkg = args.shift() + + return { + pkg, + local: /^\.@/.test(pkg) || pkg === '.', + rest: args, + } +} + +function cleanData (obj, wholePackument) { + // JSON formatted output (JSON or specific attributes from packument) + const data = obj.reduce((acc, cur) => { + if (cur) { + Object.entries(cur).forEach(([k, v]) => { + acc[k] ||= {} + Object.keys(v).forEach((t) => { + acc[k][t] = cur[k][t] + }) + }) + } + return acc + }, {}) + + if (wholePackument) { + const cleaned = Object.entries(data).reduce((acc, [k, v]) => { + acc[k] = v[Queryable.ALL] + return acc + }, {}) + log.silly('view', cleaned) + return cleaned + } + + return data +} + +// return whatever was printed +function showFields ({ data, version, fields, json }) { + const o = [data, version].reduce((acc, s) => { + Object.entries(s).forEach(([k, v]) => { + acc[k] = v + }) + return acc + }, {}) + + const queryable = new Queryable(o) + + if (!fields.length) { + return { [version.version]: queryable.query(Queryable.ALL) } + } + + return fields.map((field) => { + const s = queryable.query(field, { unwrapSingleItemArrays: !json }) + if (s) { + return { [version.version]: s } + } + }) +} + +function cleanup (data) { + if (Array.isArray(data)) { + return data.map(cleanup) + } + + if (!data || typeof data !== 'object') { + return data + } + + const keys = Object.keys(data) + if (keys.length <= 3 && data.name && ( + (keys.length === 1) || + (keys.length === 3 && data.email && data.url) || + (keys.length === 2 && (data.email || data.url)) + )) { + data = unparsePerson(data) + } + + return data +} + +const unparsePerson = (d) => + `${d.name}${d.email ? ` <${d.email}>` : ''}${d.url ? ` (${d.url})` : ''}` + +function getCompletionFields (d, f = [], pref = []) { + Object.entries(d).forEach(([k, v]) => { + if (k.charAt(0) === '_' || k.indexOf('.') !== -1) { + return + } + const p = pref.concat(k).join('.') + f.push(p) + if (Array.isArray(v)) { + v.forEach((val, i) => { + const pi = p + '[' + i + ']' + if (val && typeof val === 'object') { + getCompletionFields(val, f, [p]) + } else { + f.push(pi) + } + }) + return + } + if (typeof v === 'object') { + getCompletionFields(v, f, [p]) + } + }) + return f +} diff --git a/node_modules/npm/lib/commands/whoami.js b/node_modules/npm/lib/commands/whoami.js new file mode 100644 index 00000000..6b6e93ce --- /dev/null +++ b/node_modules/npm/lib/commands/whoami.js @@ -0,0 +1,20 @@ +const { output } = require('proc-log') +const getIdentity = require('../utils/get-identity.js') +const BaseCommand = require('../base-cmd.js') + +class Whoami extends BaseCommand { + static description = 'Display npm username' + static name = 'whoami' + static params = ['registry'] + + async exec () { + const username = await getIdentity(this.npm, { ...this.npm.flatOptions }) + if (this.npm.config.get('json')) { + output.buffer(username) + } else { + output.standard(username) + } + } +} + +module.exports = Whoami diff --git a/node_modules/npm/lib/lifecycle-cmd.js b/node_modules/npm/lib/lifecycle-cmd.js new file mode 100644 index 00000000..a509a938 --- /dev/null +++ b/node_modules/npm/lib/lifecycle-cmd.js @@ -0,0 +1,20 @@ +const BaseCommand = require('./base-cmd.js') + +// The implementation of commands that are just "run a script" +// restart, start, stop, test +class LifecycleCmd extends BaseCommand { + static usage = ['[-- ]'] + static isShellout = true + static workspaces = true + static ignoreImplicitWorkspace = false + + async exec (args) { + return this.npm.exec('run-script', [this.constructor.name, ...args]) + } + + async execWorkspaces (args) { + return this.npm.exec('run-script', [this.constructor.name, ...args]) + } +} + +module.exports = LifecycleCmd diff --git a/node_modules/npm/lib/npm.js b/node_modules/npm/lib/npm.js new file mode 100644 index 00000000..893e032f --- /dev/null +++ b/node_modules/npm/lib/npm.js @@ -0,0 +1,475 @@ +const { resolve, dirname, join } = require('node:path') +const Config = require('@npmcli/config') +const which = require('which') +const fs = require('node:fs/promises') +const { definitions, flatten, shorthands } = require('@npmcli/config/lib/definitions') +const usage = require('./utils/npm-usage.js') +const LogFile = require('./utils/log-file.js') +const Timers = require('./utils/timers.js') +const Display = require('./utils/display.js') +const { log, time, output, META } = require('proc-log') +const { redactLog: replaceInfo } = require('@npmcli/redact') +const pkg = require('../package.json') +const { deref } = require('./utils/cmd-list.js') +const { jsonError, outputError } = require('./utils/output-error.js') + +class Npm { + static get version () { + return pkg.version + } + + static cmd (c) { + const command = deref(c) + if (!command) { + throw Object.assign(new Error(`Unknown command ${c}`), { + code: 'EUNKNOWNCOMMAND', + command: c, + }) + } + return require(`./commands/${command}.js`) + } + + unrefPromises = [] + updateNotification = null + argv = [] + + #command = null + #runId = new Date().toISOString().replace(/[.:]/g, '_') + #title = 'npm' + #argvClean = [] + #npmRoot = null + + #display = null + #logFile = new LogFile() + #timers = new Timers() + + // all these options are only used by tests in order to make testing more + // closely resemble real world usage. for now, npm has no programmatic API so + // it is ok to add stuff here, but we should not rely on it more than + // necessary. XXX: make these options not necessary by refactoring @npmcli/config + // - npmRoot: this is where npm looks for docs files and the builtin config + // - argv: this allows tests to extend argv in the same way the argv would + // be passed in via a CLI arg. + // - excludeNpmCwd: this is a hack to get @npmcli/config to stop walking up + // dirs to set a local prefix when it encounters the `npmRoot`. this + // allows tests created by tap inside this repo to not set the local + // prefix to `npmRoot` since that is the first dir it would encounter when + // doing implicit detection + constructor ({ + stdout = process.stdout, + stderr = process.stderr, + npmRoot = dirname(__dirname), + argv = [], + excludeNpmCwd = false, + } = {}) { + this.#display = new Display({ stdout, stderr }) + this.#npmRoot = npmRoot + this.config = new Config({ + npmPath: this.#npmRoot, + definitions, + flatten, + shorthands, + argv: [...process.argv, ...argv], + excludeNpmCwd, + }) + } + + async load () { + let err + try { + return await time.start('npm:load', () => this.#load()) + } catch (e) { + err = e + } + return this.#handleError(err) + } + + async #load () { + await time.start('npm:load:whichnode', async () => { + // TODO should we throw here? + const node = await which(process.argv[0]).catch(() => {}) + if (node && node.toUpperCase() !== process.execPath.toUpperCase()) { + log.verbose('node symlink', node) + process.execPath = node + this.config.execPath = node + } + }) + + await time.start('npm:load:configload', () => this.config.load()) + + // npm --versions + if (this.config.get('versions', 'cli')) { + this.argv = ['version'] + this.config.set('usage', false, 'cli') + } else { + this.argv = [...this.config.parsedArgv.remain] + } + + // Remove first argv since that is our command as typed + // Note that this might not be the actual name of the command + // due to aliases, etc. But we use the raw form of it later + // in user output so it must be preserved as is. + const commandArg = this.argv.shift() + + // This is the actual name of the command that will be run or + // undefined if deref could not find a match + const command = deref(commandArg) + + await this.#display.load({ + command, + loglevel: this.config.get('loglevel'), + stdoutColor: this.color, + stderrColor: this.logColor, + timing: this.config.get('timing'), + unicode: this.config.get('unicode'), + progress: this.flatOptions.progress, + json: this.config.get('json'), + heading: this.config.get('heading'), + }) + process.env.COLOR = this.color ? '1' : '0' + + // npm -v + // return from here early so we dont create any caches/logfiles/timers etc + if (this.config.get('version', 'cli')) { + output.standard(this.version) + return { exec: false } + } + + // mkdir this separately since the logs dir can be set to + // a different location. if this fails, then we don't have + // a cache dir, but we don't want to fail immediately since + // the command might not need a cache dir (like `npm --version`) + await time.start('npm:load:mkdirpcache', () => + fs.mkdir(this.cache, { recursive: true }) + .catch((e) => log.verbose('cache', `could not create cache: ${e}`))) + + // it's ok if this fails. user might have specified an invalid dir + // which we will tell them about at the end + if (this.config.get('logs-max') > 0) { + await time.start('npm:load:mkdirplogs', () => + fs.mkdir(this.#logsDir, { recursive: true }) + .catch((e) => log.verbose('logfile', `could not create logs-dir: ${e}`))) + } + + // note: this MUST be shorter than the actual argv length, because it + // uses the same memory, so node will truncate it if it's too long. + // We time this because setting process.title is slow sometimes but we + // have to do it for security reasons. But still helpful to know how slow it is. + time.start('npm:load:setTitle', () => { + const { parsedArgv: { cooked, remain } } = this.config + // Secrets are mostly in configs, so title is set using only the positional args + // to keep those from being leaked. We still do a best effort replaceInfo. + this.#title = ['npm'].concat(replaceInfo(remain)).join(' ').trim() + process.title = this.#title + // The cooked argv is also logged separately for debugging purposes. It is + // cleaned as a best effort by replacing known secrets like basic auth + // password and strings that look like npm tokens. XXX: for this to be + // safer the config should create a sanitized version of the argv as it + // has the full context of what each option contains. + this.#argvClean = replaceInfo(cooked) + log.verbose('title', this.title) + log.verbose('argv', this.#argvClean.map(JSON.stringify).join(' ')) + }) + + // logFile.load returns a promise that resolves when old logs are done being cleaned. + // We save this promise to an array so that we can await it in tests to ensure more + // deterministic logging behavior. The process will also hang open if this were to + // take a long time to resolve, but that is why process.exit is called explicitly + // in the exit-handler. + this.unrefPromises.push(this.#logFile.load({ + command, + path: this.logPath, + logsMax: this.config.get('logs-max'), + timing: this.config.get('timing'), + })) + + this.#timers.load({ + path: this.logPath, + timing: this.config.get('timing'), + }) + + const configScope = this.config.get('scope') + if (configScope && !/^@/.test(configScope)) { + this.config.set('scope', `@${configScope}`, this.config.find('scope')) + } + + if (this.config.get('force')) { + log.warn('using --force', 'Recommended protections disabled.') + } + + return { exec: true, command: commandArg, args: this.argv } + } + + async exec (cmd, args = this.argv) { + if (!this.#command) { + let err + try { + await this.#exec(cmd, args) + } catch (e) { + err = e + } + return this.#handleError(err) + } else { + return this.#exec(cmd, args) + } + } + + // Call an npm command + async #exec (cmd, args) { + const Command = this.constructor.cmd(cmd) + const command = new Command(this) + + // since 'test', 'start', 'stop', etc. commands re-enter this function + // to call the run-script command, we need to only set it one time. + if (!this.#command) { + this.#command = command + process.env.npm_command = this.command + } + + if (this.config.get('usage')) { + return output.standard(command.usage) + } + + let execWorkspaces = false + const hasWsConfig = this.config.get('workspaces') || this.config.get('workspace').length + // if cwd is a workspace, the default is set to [that workspace] + const implicitWs = this.config.get('workspace', 'default').length + // (-ws || -w foo) && (cwd is not a workspace || command is not ignoring implicit workspaces) + if (hasWsConfig && (!implicitWs || !Command.ignoreImplicitWorkspace)) { + if (this.global) { + throw new Error('Workspaces not supported for global packages') + } + if (!Command.workspaces) { + throw Object.assign(new Error('This command does not support workspaces.'), { + code: 'ENOWORKSPACES', + }) + } + execWorkspaces = true + } + + if (command.checkDevEngines && !this.global) { + await command.checkDevEngines() + } + + return time.start(`command:${cmd}`, () => + execWorkspaces ? command.execWorkspaces(args) : command.exec(args)) + } + + // This gets called at the end of the exit handler and + // during any tests to cleanup all of our listeners + // Everything in here should be synchronous + unload () { + this.#timers.off() + this.#display.off() + this.#logFile.off() + } + + finish (err) { + // Finish all our timer work, this will write the file if requested, end timers, etc + this.#timers.finish({ + id: this.#runId, + command: this.#argvClean, + logfiles: this.logFiles, + version: this.version, + }) + + output.flush({ + [META]: true, + // json can be set during a command so we send the + // final value of it to the display layer here + json: this.loaded && this.config.get('json'), + jsonError: jsonError(err, this), + }) + } + + exitErrorMessage () { + if (this.logFiles.length) { + return `A complete log of this run can be found in: ${this.logFiles}` + } + + const logsMax = this.config.get('logs-max') + if (logsMax <= 0) { + // user specified no log file + return `Log files were not written due to the config logs-max=${logsMax}` + } + + // could be an error writing to the directory + return `Log files were not written due to an error writing to the directory: ${this.#logsDir}` + + '\nYou can rerun the command with `--loglevel=verbose` to see the logs in your terminal' + } + + async #handleError (err) { + if (err) { + // Get the local package if it exists for a more helpful error message + const localPkg = await require('@npmcli/package-json') + .normalize(this.localPrefix) + .then(p => p.content) + .catch(() => null) + Object.assign(err, this.#getError(err, { pkg: localPkg })) + } + + this.finish(err) + + if (err) { + throw err + } + } + + #getError (rawErr, opts) { + const { files = [], ...error } = require('./utils/error-message.js').getError(rawErr, { + npm: this, + command: this.#command, + ...opts, + }) + + const { writeFileSync } = require('node:fs') + for (const [file, content] of files) { + const filePath = `${this.logPath}${file}` + const fileContent = `'Log files:\n${this.logFiles.join('\n')}\n\n${content.trim()}\n` + try { + writeFileSync(filePath, fileContent) + error.detail.push(['', `\n\nFor a full report see:\n${filePath}`]) + } catch (fileErr) { + log.warn('', `Could not write error message to ${file} due to ${fileErr}`) + } + } + + outputError(error) + + return error + } + + get title () { + return this.#title + } + + get loaded () { + return this.config.loaded + } + + get version () { + return this.constructor.version + } + + get command () { + return this.#command?.name + } + + get flatOptions () { + const { flat } = this.config + flat.nodeVersion = process.version + flat.npmVersion = pkg.version + if (this.command) { + flat.npmCommand = this.command + } + return flat + } + + // color and logColor are a special derived values that takes into + // consideration not only the config, but whether or not we are operating + // in a tty with the associated output (stdout/stderr) + get color () { + return this.flatOptions.color + } + + get logColor () { + return this.flatOptions.logColor + } + + get noColorChalk () { + return this.#display.chalk.noColor + } + + get chalk () { + return this.#display.chalk.stdout + } + + get logChalk () { + return this.#display.chalk.stderr + } + + get global () { + return this.config.get('global') || this.config.get('location') === 'global' + } + + get silent () { + return this.flatOptions.silent + } + + get lockfileVersion () { + return 2 + } + + get started () { + return this.#timers.started + } + + get logFiles () { + return this.#logFile.files + } + + get #logsDir () { + return this.config.get('logs-dir') || join(this.cache, '_logs') + } + + get logPath () { + return resolve(this.#logsDir, `${this.#runId}-`) + } + + get npmRoot () { + return this.#npmRoot + } + + get cache () { + return this.config.get('cache') + } + + get globalPrefix () { + return this.config.globalPrefix + } + + get localPrefix () { + return this.config.localPrefix + } + + get localPackage () { + return this.config.localPackage + } + + get globalDir () { + return process.platform !== 'win32' + ? resolve(this.globalPrefix, 'lib', 'node_modules') + : resolve(this.globalPrefix, 'node_modules') + } + + get localDir () { + return resolve(this.localPrefix, 'node_modules') + } + + get dir () { + return this.global ? this.globalDir : this.localDir + } + + get globalBin () { + const b = this.globalPrefix + return process.platform !== 'win32' ? resolve(b, 'bin') : b + } + + get localBin () { + return resolve(this.dir, '.bin') + } + + get bin () { + return this.global ? this.globalBin : this.localBin + } + + get prefix () { + return this.global ? this.globalPrefix : this.localPrefix + } + + get usage () { + return usage(this) + } +} + +module.exports = Npm diff --git a/node_modules/npm/lib/package-url-cmd.js b/node_modules/npm/lib/package-url-cmd.js new file mode 100644 index 00000000..c7ae3217 --- /dev/null +++ b/node_modules/npm/lib/package-url-cmd.js @@ -0,0 +1,64 @@ +const pacote = require('pacote') +const { openUrl } = require('./utils/open-url.js') +const { log } = require('proc-log') +const BaseCommand = require('./base-cmd.js') + +// Base command for opening urls from a package manifest (bugs, docs, repo) +class PackageUrlCommand extends BaseCommand { + static params = [ + 'browser', + 'registry', + 'workspace', + 'workspaces', + 'include-workspace-root', + ] + + static workspaces = true + static ignoreImplicitWorkspace = false + static usage = ['[ [ ...]]'] + + async exec (args) { + if (!args || !args.length) { + args = ['.'] + } + + for (const arg of args) { + // XXX It is very odd that `where` is how pacote knows to look anywhere + // other than the cwd. + const opts = { + ...this.npm.flatOptions, + where: this.npm.localPrefix, + fullMetadata: true, + } + const mani = await pacote.manifest(arg, opts) + const url = this.getUrl(arg, mani) + log.silly(this.name, 'url', url) + await openUrl(this.npm, url, `${mani.name} ${this.name} available at the following URL`) + } + } + + async execWorkspaces (args) { + if (args && args.length) { + return this.exec(args) + } + await this.setWorkspaces() + return this.exec(this.workspacePaths) + } + + // given a manifest, try to get the hosted git info from it based on + // repository (if a string) or repository.url (if an object) returns null + // if it's not a valid repo, or not a known hosted repo + hostedFromMani (mani) { + const hostedGitInfo = require('hosted-git-info') + const r = mani.repository + const rurl = !r ? null + : typeof r === 'string' ? r + : typeof r === 'object' && typeof r.url === 'string' ? r.url + : null + + // hgi returns undefined sometimes, but let's always return null here + return (rurl && hostedGitInfo.fromUrl(rurl.replace(/^git\+/, ''))) || null + } +} + +module.exports = PackageUrlCommand diff --git a/node_modules/npm/lib/utils/audit-error.js b/node_modules/npm/lib/utils/audit-error.js new file mode 100644 index 00000000..c56ec9ba --- /dev/null +++ b/node_modules/npm/lib/utils/audit-error.js @@ -0,0 +1,40 @@ +const { log, output } = require('proc-log') +const { redactLog: replaceInfo } = require('@npmcli/redact') + +// print an error or just nothing if the audit report has an error +// this is called by the audit command, and by the reify-output util +// prints a JSON version of the error if it's --json +// returns 'true' if there was an error, false otherwise + +const auditError = (npm, report) => { + if (!report || !report.error) { + return false + } + + if (npm.command !== 'audit') { + return true + } + + const { error } = report + + // ok, we care about it, then + log.warn('audit', error.message) + const { body: errBody } = error + const body = Buffer.isBuffer(errBody) ? errBody.toString() : errBody + if (npm.flatOptions.json) { + output.buffer({ + message: error.message, + method: error.method, + uri: replaceInfo(error.uri), + headers: error.headers, + statusCode: error.statusCode, + body, + }) + } else { + output.standard(body) + } + + throw 'audit endpoint returned an error' +} + +module.exports = auditError diff --git a/node_modules/npm/lib/utils/auth.js b/node_modules/npm/lib/utils/auth.js new file mode 100644 index 00000000..74727116 --- /dev/null +++ b/node_modules/npm/lib/utils/auth.js @@ -0,0 +1,109 @@ +const { webAuthOpener, adduserWeb, loginWeb, loginCouch, adduserCouch } = require('npm-profile') +const { log } = require('proc-log') +const { createOpener } = require('../utils/open-url.js') +const read = require('../utils/read-user-info.js') + +const otplease = async (npm, opts, fn) => { + try { + return await fn(opts) + } catch (err) { + if (!process.stdin.isTTY || !process.stdout.isTTY) { + throw err + } + + // web otp + if (err.code === 'EOTP' && err.body?.authUrl && err.body?.doneUrl) { + const { token: otp } = await webAuthOpener( + createOpener(npm, 'Authenticate your account at'), + err.body.authUrl, + err.body.doneUrl, + opts + ) + return await fn({ ...opts, otp }) + } + + // classic otp + if (err.code === 'EOTP' || (err.code === 'E401' && /one-time pass/.test(err.body))) { + const otp = await read.otp('This operation requires a one-time password.\nEnter OTP:') + return await fn({ ...opts, otp }) + } + + throw err + } +} + +const adduser = async (npm, { creds, ...opts }) => { + const authType = npm.config.get('auth-type') + let res + if (authType === 'web') { + try { + res = await adduserWeb(createOpener(npm, 'Create your account at'), opts) + } catch (err) { + if (err.code === 'ENYI') { + log.verbose('web add user not supported, trying couch') + } else { + throw err + } + } + } + + // auth type !== web or ENYI error w/ web adduser + if (!res) { + const username = await read.username('Username:', creds.username) + const password = await read.password('Password:', creds.password) + const email = await read.email('Email: (this IS public) ', creds.email) + // npm registry quirk: If you "add" an existing user with their current + // password, it's effectively a login, and if that account has otp you'll + // be prompted for it. + res = await otplease(npm, opts, (reqOpts) => adduserCouch(username, email, password, reqOpts)) + } + + // We don't know the username if it was a web login, all we can reliably log is scope and registry + const message = `Logged in${opts.scope ? ` to scope ${opts.scope}` : ''} on ${opts.registry}.` + + log.info('adduser', message) + + return { + message, + newCreds: { token: res.token }, + } +} + +const login = async (npm, { creds, ...opts }) => { + const authType = npm.config.get('auth-type') + let res + if (authType === 'web') { + try { + res = await loginWeb(createOpener(npm, 'Login at'), opts) + } catch (err) { + if (err.code === 'ENYI') { + log.verbose('web login not supported, trying couch') + } else { + throw err + } + } + } + + // auth type !== web or ENYI error w/ web login + if (!res) { + const username = await read.username('Username:', creds.username) + const password = await read.password('Password:', creds.password) + res = await otplease(npm, opts, (reqOpts) => loginCouch(username, password, reqOpts)) + } + + // We don't know the username if it was a web login, all we can reliably log is scope and registry + const message = `Logged in${opts.scope ? ` to scope ${opts.scope}` : ''} on ${opts.registry}.` + + log.info('login', message) + + return { + message, + newCreds: { token: res.token }, + } +} + +module.exports = { + adduser, + login, + otplease, +} diff --git a/node_modules/npm/lib/utils/cmd-list.js b/node_modules/npm/lib/utils/cmd-list.js new file mode 100644 index 00000000..039d6ffd --- /dev/null +++ b/node_modules/npm/lib/utils/cmd-list.js @@ -0,0 +1,177 @@ +const abbrev = require('abbrev') + +// These correspond to filenames in lib/commands +// Please keep this list sorted alphabetically +const commands = [ + 'access', + 'adduser', + 'audit', + 'bugs', + 'cache', + 'ci', + 'completion', + 'config', + 'dedupe', + 'deprecate', + 'diff', + 'dist-tag', + 'docs', + 'doctor', + 'edit', + 'exec', + 'explain', + 'explore', + 'find-dupes', + 'fund', + 'get', + 'help', + 'help-search', + 'init', + 'install', + 'install-ci-test', + 'install-test', + 'link', + 'll', + 'login', + 'logout', + 'ls', + 'org', + 'outdated', + 'owner', + 'pack', + 'ping', + 'pkg', + 'prefix', + 'profile', + 'prune', + 'publish', + 'query', + 'rebuild', + 'repo', + 'restart', + 'root', + 'run-script', + 'sbom', + 'search', + 'set', + 'shrinkwrap', + 'star', + 'stars', + 'start', + 'stop', + 'team', + 'test', + 'token', + 'uninstall', + 'unpublish', + 'unstar', + 'update', + 'version', + 'view', + 'whoami', +] + +// These must resolve to an entry in commands +const aliases = { + + // aliases + author: 'owner', + home: 'docs', + issues: 'bugs', + info: 'view', + show: 'view', + find: 'search', + add: 'install', + unlink: 'uninstall', + remove: 'uninstall', + rm: 'uninstall', + r: 'uninstall', + + // short names for common things + un: 'uninstall', + rb: 'rebuild', + list: 'ls', + ln: 'link', + create: 'init', + i: 'install', + it: 'install-test', + cit: 'install-ci-test', + up: 'update', + c: 'config', + s: 'search', + se: 'search', + tst: 'test', + t: 'test', + ddp: 'dedupe', + v: 'view', + run: 'run-script', + 'clean-install': 'ci', + 'clean-install-test': 'install-ci-test', + x: 'exec', + why: 'explain', + la: 'll', + verison: 'version', + ic: 'ci', + + // typos + innit: 'init', + // manually abbrev so that install-test doesn't make insta stop working + in: 'install', + ins: 'install', + inst: 'install', + insta: 'install', + instal: 'install', + isnt: 'install', + isnta: 'install', + isntal: 'install', + isntall: 'install', + 'install-clean': 'ci', + 'isntall-clean': 'ci', + hlep: 'help', + 'dist-tags': 'dist-tag', + upgrade: 'update', + udpate: 'update', + rum: 'run-script', + sit: 'install-ci-test', + urn: 'run-script', + ogr: 'org', + 'add-user': 'adduser', +} + +const deref = (c) => { + if (!c) { + return + } + + // Translate camelCase to snake-case (i.e. installTest to install-test) + if (c.match(/[A-Z]/)) { + c = c.replace(/([A-Z])/g, m => '-' + m.toLowerCase()) + } + + // if they asked for something exactly we are done + if (commands.includes(c)) { + return c + } + + // if they asked for a direct alias + if (aliases[c]) { + return aliases[c] + } + + const abbrevs = abbrev(commands.concat(Object.keys(aliases))) + + // first deref the abbrev, if there is one + // then resolve any aliases + // so `npm install-cl` will resolve to `install-clean` then to `ci` + let a = abbrevs[c] + while (aliases[a]) { + a = aliases[a] + } + return a +} + +module.exports = { + aliases, + commands, + deref, +} diff --git a/node_modules/npm/lib/utils/completion.fish b/node_modules/npm/lib/utils/completion.fish new file mode 100644 index 00000000..5e274ad7 --- /dev/null +++ b/node_modules/npm/lib/utils/completion.fish @@ -0,0 +1,40 @@ +# npm completions for Fish shell +# This script is a work in progress and does not fall under the normal semver contract as the rest of npm. + +# __fish_npm_needs_command taken from: +# https://stackoverflow.com/questions/16657803/creating-autocomplete-script-with-sub-commands +function __fish_npm_needs_command + set -l cmd (commandline -opc) + + if test (count $cmd) -eq 1 + return 0 + end + + return 1 +end + +# Taken from https://github.com/fish-shell/fish-shell/blob/HEAD/share/completions/npm.fish +function __fish_complete_npm -d "Complete the commandline using npm's 'completion' tool" + # tell npm we are fish shell + set -lx COMP_FISH true + if command -sq npm + # npm completion is bash-centric, so we need to translate fish's "commandline" stuff to bash's $COMP_* stuff + # COMP_LINE is an array with the words in the commandline + set -lx COMP_LINE (commandline -opc) + # COMP_CWORD is the index of the current word in COMP_LINE + # bash starts arrays with 0, so subtract 1 + set -lx COMP_CWORD (math (count $COMP_LINE) - 1) + # COMP_POINT is the index of point/cursor when the commandline is viewed as a string + set -lx COMP_POINT (commandline -C) + # If the cursor is after the last word, the empty token will disappear in the expansion + # Readd it + if test (commandline -ct) = "" + set COMP_CWORD (math $COMP_CWORD + 1) + set COMP_LINE $COMP_LINE "" + end + command npm completion -- $COMP_LINE 2>/dev/null + end +end + +# flush out what ships with fish +complete -e npm diff --git a/node_modules/npm/lib/utils/completion.sh b/node_modules/npm/lib/utils/completion.sh new file mode 100755 index 00000000..a3e51439 --- /dev/null +++ b/node_modules/npm/lib/utils/completion.sh @@ -0,0 +1,70 @@ +#!/bin/bash +###-begin-npm-completion-### +# +# npm command completion script +# +# Installation: npm completion >> ~/.bashrc (or ~/.zshrc) +# Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm +# + +if type complete &>/dev/null; then + _npm_completion () { + local words cword + if type _get_comp_words_by_ref &>/dev/null; then + _get_comp_words_by_ref -n = -n @ -n : -w words -i cword + else + cword="$COMP_CWORD" + words=("${COMP_WORDS[@]}") + fi + + local si="$IFS" + if ! IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \ + COMP_LINE="$COMP_LINE" \ + COMP_POINT="$COMP_POINT" \ + npm completion -- "${words[@]}" \ + 2>/dev/null)); then + local ret=$? + IFS="$si" + return $ret + fi + IFS="$si" + if type __ltrim_colon_completions &>/dev/null; then + __ltrim_colon_completions "${words[cword]}" + fi + } + complete -o default -F _npm_completion npm +elif type compdef &>/dev/null; then + _npm_completion() { + local si=$IFS + compadd -- $(COMP_CWORD=$((CURRENT-1)) \ + COMP_LINE=$BUFFER \ + COMP_POINT=0 \ + npm completion -- "${words[@]}" \ + 2>/dev/null) + IFS=$si + } + compdef _npm_completion npm +elif type compctl &>/dev/null; then + _npm_completion () { + local cword line point words si + read -Ac words + read -cn cword + let cword-=1 + read -l line + read -ln point + si="$IFS" + if ! IFS=$'\n' reply=($(COMP_CWORD="$cword" \ + COMP_LINE="$line" \ + COMP_POINT="$point" \ + npm completion -- "${words[@]}" \ + 2>/dev/null)); then + + local ret=$? + IFS="$si" + return $ret + fi + IFS="$si" + } + compctl -K _npm_completion npm +fi +###-end-npm-completion-### diff --git a/node_modules/npm/lib/utils/did-you-mean.js b/node_modules/npm/lib/utils/did-you-mean.js new file mode 100644 index 00000000..7428ed5d --- /dev/null +++ b/node_modules/npm/lib/utils/did-you-mean.js @@ -0,0 +1,34 @@ +const Npm = require('../npm') +const { distance } = require('fastest-levenshtein') +const { commands } = require('./cmd-list.js') + +const runScripts = ['stop', 'start', 'test', 'restart'] + +const isClose = (scmd, cmd) => distance(scmd, cmd) < scmd.length * 0.4 + +const didYouMean = (pkg, scmd) => { + const { scripts = {}, bin = {} } = pkg || {} + + const best = [ + ...commands + .filter(cmd => isClose(scmd, cmd) && scmd !== cmd) + .map(str => [str, Npm.cmd(str).description]), + ...Object.keys(scripts) + // We would already be suggesting this in `npm x` so omit them here + .filter(cmd => isClose(scmd, cmd) && !runScripts.includes(cmd)) + .map(str => [`run ${str}`, `run the "${str}" package script`]), + ...Object.keys(bin) + .filter(cmd => isClose(scmd, cmd)) + /* eslint-disable-next-line max-len */ + .map(str => [`exec ${str}`, `run the "${str}" command from either this or a remote npm package`]), + ] + + if (best.length === 0) { + return '' + } + + return `\n\nDid you mean ${best.length === 1 ? 'this' : 'one of these'}?\n` + + best.slice(0, 3).map(([msg, comment]) => ` npm ${msg} # ${comment}`).join('\n') +} + +module.exports = didYouMean diff --git a/node_modules/npm/lib/utils/display.js b/node_modules/npm/lib/utils/display.js new file mode 100644 index 00000000..67a3b98c --- /dev/null +++ b/node_modules/npm/lib/utils/display.js @@ -0,0 +1,539 @@ +const { log, output, input, META } = require('proc-log') +const { explain } = require('./explain-eresolve.js') +const { formatWithOptions } = require('./format') + +// This is the general approach to color: +// Eventually this will be exposed somewhere we can refer to these by name. +// Foreground colors only. Never set the background color. +/* + * Black # (Don't use) + * Red # Danger + * Green # Success + * Yellow # Warning + * Blue # Accent + * Magenta # Done + * Cyan # Emphasis + * White # (Don't use) + */ + +// Translates log levels to chalk colors +const COLOR_PALETTE = ({ chalk: c }) => ({ + heading: c.bold, + title: c.blueBright, + timing: c.magentaBright, + // loglevels + error: c.red, + warn: c.yellow, + notice: c.cyanBright, + http: c.green, + info: c.cyan, + verbose: c.blue, + silly: c.blue.dim, +}) + +const LEVEL_OPTIONS = { + silent: { + index: 0, + }, + error: { + index: 1, + }, + warn: { + index: 2, + }, + notice: { + index: 3, + }, + http: { + index: 4, + }, + info: { + index: 5, + }, + verbose: { + index: 6, + }, + silly: { + index: 7, + }, +} + +const LEVEL_METHODS = { + ...LEVEL_OPTIONS, + [log.KEYS.timing]: { + show: ({ timing, index }) => !!timing && index !== 0, + }, +} + +const setBlocking = (stream) => { + // Copied from https://github.com/yargs/set-blocking + // https://raw.githubusercontent.com/yargs/set-blocking/master/LICENSE.txt + /* istanbul ignore next - we trust that this works */ + if (stream._handle && stream.isTTY && typeof stream._handle.setBlocking === 'function') { + stream._handle.setBlocking(true) + } + return stream +} + +// These are important +// This is the key that is returned to the user for errors +const ERROR_KEY = 'error' +// This is the key producers use to indicate that there +// is a json error that should be merged into the finished output +const JSON_ERROR_KEY = 'jsonError' + +const isPlainObject = (v) => v && typeof v === 'object' && !Array.isArray(v) + +const getArrayOrObject = (items) => { + if (items.length) { + const foundNonObject = items.find(o => !isPlainObject(o)) + // Non-objects and arrays cant be merged, so just return the first item + if (foundNonObject) { + return foundNonObject + } + // We use objects with 0,1,2,etc keys to merge array + if (items.every((o, i) => Object.hasOwn(o, i))) { + return Object.assign([], ...items) + } + } + // Otherwise its an object with all object items merged together + return Object.assign({}, ...items.filter(o => isPlainObject(o))) +} + +const getJsonBuffer = ({ [JSON_ERROR_KEY]: metaError }, buffer) => { + const items = [] + // meta also contains the meta object passed to flush + const errors = metaError ? [metaError] : [] + // index 1 is the meta, 2 is the logged argument + for (const [, { [JSON_ERROR_KEY]: error }, obj] of buffer) { + if (obj) { + items.push(obj) + } + if (error) { + errors.push(error) + } + } + + if (!items.length && !errors.length) { + return null + } + + const res = getArrayOrObject(items) + + // This skips any error checking since we can only set an error property + // on an object that can be stringified + // XXX(BREAKING_CHANGE): remove this in favor of always returning an object with result and error keys + if (isPlainObject(res) && errors.length) { + // This is not ideal. JSON output has always been keyed at the root with an `error` + // key, so we cant change that without it being a breaking change. At the same time + // some commands output arbitrary keys at the top level of the output, such as package + // names. So the output could already have the same key. The choice here is to overwrite + // it with our error since that is (probably?) more important. + // XXX(BREAKING_CHANGE): all json output should be keyed under well known keys, eg `result` and `error` + if (res[ERROR_KEY]) { + log.warn('', `overwriting existing ${ERROR_KEY} on json output`) + } + res[ERROR_KEY] = getArrayOrObject(errors) + } + + return res +} + +const withMeta = (handler) => (level, ...args) => { + let meta = {} + const last = args.at(-1) + if (last && typeof last === 'object' && Object.hasOwn(last, META)) { + meta = args.pop() + } + return handler(level, meta, ...args) +} + +class Display { + #logState = { + buffering: true, + buffer: [], + } + + #outputState = { + buffering: true, + buffer: [], + } + + // colors + #noColorChalk + #stdoutChalk + #stdoutColor + #stderrChalk + #stderrColor + #logColors + + // progress + #progress + + // options + #command + #levelIndex + #timing + #json + #heading + #silent + + // display streams + #stdout + #stderr + + constructor ({ stdout, stderr }) { + this.#stdout = setBlocking(stdout) + this.#stderr = setBlocking(stderr) + + // Handlers are set immediately so they can buffer all events + process.on('log', this.#logHandler) + process.on('output', this.#outputHandler) + process.on('input', this.#inputHandler) + this.#progress = new Progress({ stream: stderr }) + } + + off () { + process.off('log', this.#logHandler) + this.#logState.buffer.length = 0 + process.off('output', this.#outputHandler) + this.#outputState.buffer.length = 0 + process.off('input', this.#inputHandler) + this.#progress.off() + } + + get chalk () { + return { + noColor: this.#noColorChalk, + stdout: this.#stdoutChalk, + stderr: this.#stderrChalk, + } + } + + async load ({ + command, + heading, + json, + loglevel, + progress, + stderrColor, + stdoutColor, + timing, + unicode, + }) { + // get createSupportsColor from chalk directly if this lands + // https://github.com/chalk/chalk/pull/600 + const [{ Chalk }, { createSupportsColor }] = await Promise.all([ + import('chalk'), + import('supports-color'), + ]) + // we get the chalk level based on a null stream meaning chalk will only use + // what it knows about the environment to get color support since we already + // determined in our definitions that we want to show colors. + const level = Math.max(createSupportsColor(null).level, 1) + this.#noColorChalk = new Chalk({ level: 0 }) + this.#stdoutColor = stdoutColor + this.#stdoutChalk = stdoutColor ? new Chalk({ level }) : this.#noColorChalk + this.#stderrColor = stderrColor + this.#stderrChalk = stderrColor ? new Chalk({ level }) : this.#noColorChalk + this.#logColors = COLOR_PALETTE({ chalk: this.#stderrChalk }) + + this.#command = command + this.#levelIndex = LEVEL_OPTIONS[loglevel].index + this.#timing = timing + this.#json = json + this.#heading = heading + this.#silent = this.#levelIndex <= 0 + + // Emit resume event on the logs which will flush output + log.resume() + output.flush() + this.#progress.load({ + unicode, + enabled: !!progress && !this.#silent, + }) + } + + // STREAM WRITES + + // Write formatted and (non-)colorized output to streams + #write (stream, options, ...args) { + const colors = stream === this.#stdout ? this.#stdoutColor : this.#stderrColor + const value = formatWithOptions({ colors, ...options }, ...args) + this.#progress.write(() => stream.write(value)) + } + + // HANDLERS + + // Arrow function assigned to a private class field so it can be passed + // directly as a listener and still reference "this" + #logHandler = withMeta((level, meta, ...args) => { + switch (level) { + case log.KEYS.resume: + this.#logState.buffering = false + this.#logState.buffer.forEach((item) => this.#tryWriteLog(...item)) + this.#logState.buffer.length = 0 + break + + case log.KEYS.pause: + this.#logState.buffering = true + break + + default: + if (this.#logState.buffering) { + this.#logState.buffer.push([level, meta, ...args]) + } else { + this.#tryWriteLog(level, meta, ...args) + } + break + } + }) + + // Arrow function assigned to a private class field so it can be passed + // directly as a listener and still reference "this" + #outputHandler = withMeta((level, meta, ...args) => { + this.#json = typeof meta.json === 'boolean' ? meta.json : this.#json + switch (level) { + case output.KEYS.flush: { + this.#outputState.buffering = false + if (this.#json) { + const json = getJsonBuffer(meta, this.#outputState.buffer) + if (json) { + this.#writeOutput(output.KEYS.standard, meta, JSON.stringify(json, null, 2)) + } + } else { + this.#outputState.buffer.forEach((item) => this.#writeOutput(...item)) + } + this.#outputState.buffer.length = 0 + break + } + + case output.KEYS.buffer: + this.#outputState.buffer.push([output.KEYS.standard, meta, ...args]) + break + + default: + if (this.#outputState.buffering) { + this.#outputState.buffer.push([level, meta, ...args]) + } else { + // HACK: Check if the argument looks like a run-script banner. This can be + // replaced with proc-log.META in @npmcli/run-script + if (typeof args[0] === 'string' && args[0].startsWith('\n> ') && args[0].endsWith('\n')) { + if (this.#silent || ['exec', 'explore'].includes(this.#command)) { + // Silent mode and some specific commands always hide run script banners + break + } else if (this.#json) { + // In json mode, change output to stderr since we dont want to break json + // parsing on stdout if the user is piping to jq or something. + // XXX: in a future (breaking?) change it might make sense for run-script to + // always output these banners with proc-log.output.error if we think they + // align closer with "logging" instead of "output" + level = output.KEYS.error + } + } + this.#writeOutput(level, meta, ...args) + } + break + } + }) + + #inputHandler = withMeta((level, meta, ...args) => { + switch (level) { + case input.KEYS.start: + log.pause() + this.#outputState.buffering = true + this.#progress.off() + break + + case input.KEYS.end: + log.resume() + output.flush() + this.#progress.resume() + break + + case input.KEYS.read: { + // The convention when calling input.read is to pass in a single fn that returns + // the promise to await. resolve and reject are provided by proc-log + const [res, rej, p] = args + return input.start(() => p() + .then(res) + .catch(rej) + // Any call to procLog.input.read will render a prompt to the user, so we always + // add a single newline of output to stdout to move the cursor to the next line + .finally(() => output.standard(''))) + } + } + }) + + // OUTPUT + + #writeOutput (level, meta, ...args) { + switch (level) { + case output.KEYS.standard: + this.#write(this.#stdout, {}, ...args) + break + + case output.KEYS.error: + this.#write(this.#stderr, {}, ...args) + break + } + } + + // LOGS + + #tryWriteLog (level, meta, ...args) { + try { + // Also (and this is a really inexcusable kludge), we patch the + // log.warn() method so that when we see a peerDep override + // explanation from Arborist, we can replace the object with a + // highly abbreviated explanation of what's being overridden. + // TODO: this could probably be moved to arborist now that display is refactored + const [heading, message, expl] = args + if (level === log.KEYS.warn && heading === 'ERESOLVE' && expl && typeof expl === 'object') { + this.#writeLog(level, meta, heading, message) + this.#writeLog(level, meta, '', explain(expl, this.#stderrChalk, 2)) + return + } + this.#writeLog(level, meta, ...args) + } catch (ex) { + try { + // if it crashed once, it might again! + this.#writeLog(log.KEYS.verbose, meta, '', `attempt to log crashed`, ...args, ex) + } catch (ex2) { + // This happens if the object has an inspect method that crashes so just console.error + // with the errors but don't do anything else that might error again. + // eslint-disable-next-line no-console + console.error(`attempt to log crashed`, ex, ex2) + } + } + } + + #writeLog (level, meta, ...args) { + const levelOpts = LEVEL_METHODS[level] + const show = levelOpts.show ?? (({ index }) => levelOpts.index <= index) + const force = meta.force && !this.#silent + + if (force || show({ index: this.#levelIndex, timing: this.#timing })) { + // this mutates the array so we can pass args directly to format later + const title = args.shift() + const prefix = [ + this.#logColors.heading(this.#heading), + this.#logColors[level](level), + title ? this.#logColors.title(title) : null, + ] + this.#write(this.#stderr, { prefix }, ...args) + } + } +} + +class Progress { + // Taken from https://github.com/sindresorhus/cli-spinners + // MIT License + // Copyright (c) Sindre Sorhus (https://sindresorhus.com) + static dots = { duration: 80, frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'] } + static lines = { duration: 130, frames: ['-', '\\', '|', '/'] } + + #stream + #spinner + #enabled = false + + #frameIndex = 0 + #lastUpdate = 0 + #interval + #timeout + + // We are rendering is enabled option is set and we are not waiting for the render timeout + get #rendering () { + return this.#enabled && !this.#timeout + } + + // We are spinning if enabled option is set and the render interval has been set + get #spinning () { + return this.#enabled && this.#interval + } + + constructor ({ stream }) { + this.#stream = stream + } + + load ({ enabled, unicode }) { + this.#enabled = enabled + this.#spinner = unicode ? Progress.dots : Progress.lines + // Dont render the spinner for short durations + this.#render(200) + } + + off () { + if (!this.#enabled) { + return + } + clearTimeout(this.#timeout) + this.#timeout = null + clearInterval(this.#interval) + this.#interval = null + this.#frameIndex = 0 + this.#lastUpdate = 0 + this.#clearSpinner() + } + + resume () { + this.#render() + } + + // If we are currenting rendering the spinner we clear it + // before writing our line and then re-render the spinner after. + // If not then all we need to do is write the line + write (write) { + if (this.#spinning) { + this.#clearSpinner() + } + write() + if (this.#spinning) { + this.#render() + } + } + + #render (ms) { + if (ms) { + this.#timeout = setTimeout(() => { + this.#timeout = null + this.#renderSpinner() + }, ms) + // Make sure this timeout does not keep the process open + this.#timeout.unref() + } else { + this.#renderSpinner() + } + } + + #renderSpinner () { + if (!this.#rendering) { + return + } + // We always attempt to render immediately but we only request to move to the next + // frame if it has been longer than our spinner frame duration since our last update + this.#renderFrame(Date.now() - this.#lastUpdate >= this.#spinner.duration) + clearInterval(this.#interval) + this.#interval = setInterval(() => this.#renderFrame(true), this.#spinner.duration) + } + + #renderFrame (next) { + if (next) { + this.#lastUpdate = Date.now() + this.#frameIndex++ + if (this.#frameIndex >= this.#spinner.frames.length) { + this.#frameIndex = 0 + } + } + this.#clearSpinner() + this.#stream.write(this.#spinner.frames[this.#frameIndex]) + } + + #clearSpinner () { + // Move to the start of the line and clear the rest of the line + this.#stream.cursorTo(0) + this.#stream.clearLine(1) + } +} + +module.exports = Display diff --git a/node_modules/npm/lib/utils/error-message.js b/node_modules/npm/lib/utils/error-message.js new file mode 100644 index 00000000..4b5582ac --- /dev/null +++ b/node_modules/npm/lib/utils/error-message.js @@ -0,0 +1,447 @@ +const { format } = require('node:util') +const { resolve } = require('node:path') +const { redactLog: replaceInfo } = require('@npmcli/redact') +const { log } = require('proc-log') + +const errorMessage = (er, npm) => { + const summary = [] + const detail = [] + const files = [] + + er.message &&= replaceInfo(er.message) + er.stack &&= replaceInfo(er.stack) + + switch (er.code) { + case 'ERESOLVE': { + const { report } = require('./explain-eresolve.js') + summary.push(['ERESOLVE', er.message]) + detail.push(['', '']) + // XXX(display): error messages are logged so we use the logColor since that is based + // on stderr. This should be handled solely by the display layer so it could also be + // printed to stdout if necessary. + const { explanation, file } = report(er, npm.logChalk, npm.noColorChalk) + detail.push(['', explanation]) + files.push(['eresolve-report.txt', file]) + break + } + + case 'ENOLOCK': { + const cmd = npm.command || '' + summary.push([cmd, 'This command requires an existing lockfile.']) + detail.push([cmd, 'Try creating one first with: npm i --package-lock-only']) + detail.push([cmd, `Original error: ${er.message}`]) + break + } + + case 'ENOAUDIT': + summary.push(['audit', er.message]) + break + + case 'ECONNREFUSED': + summary.push(['', er]) + detail.push(['', [ + '', + 'If you are behind a proxy, please make sure that the', + "'proxy' config is set properly. See: 'npm help config'", + ].join('\n')]) + break + + case 'EACCES': + case 'EPERM': { + const isCachePath = + typeof er.path === 'string' && npm.loaded && er.path.startsWith(npm.config.get('cache')) + const isCacheDest = + typeof er.dest === 'string' && npm.loaded && er.dest.startsWith(npm.config.get('cache')) + + if (process.platform !== 'win32' && (isCachePath || isCacheDest)) { + // user probably doesn't need this, but still add it to the debug log + log.verbose(er.stack) + summary.push(['', [ + '', + 'Your cache folder contains root-owned files, due to a bug in', + 'previous versions of npm which has since been addressed.', + '', + 'To permanently fix this problem, please run:', + ` sudo chown -R ${process.getuid()}:${process.getgid()} "${npm.config.get('cache')}"`, + ].join('\n')]) + } else { + summary.push(['', er]) + detail.push(['', [ + '', + 'The operation was rejected by your operating system.', + ...process.platform === 'win32' ? [ + "It's possible that the file was already in use (by a text editor or antivirus),", + 'or that you lack permissions to access it.', + ] : [ + 'It is likely you do not have the permissions to access this file as the current user', + ], + '', + 'If you believe this might be a permissions issue, please double-check the', + 'permissions of the file and its containing directories, or try running', + 'the command again as root/Administrator.', + ].join('\n')]) + } + break + } + + case 'ENOGIT': + summary.push(['', er.message]) + detail.push(['', [ + '', + 'Failed using git.', + 'Please check if you have git installed and in your PATH.', + ].join('\n')]) + break + + case 'EJSONPARSE': + // Check whether we ran into a conflict in our own package.json + if (er.path === resolve(npm.prefix, 'package.json')) { + const { isDiff } = require('parse-conflict-json') + const txt = require('node:fs').readFileSync(er.path, 'utf8').replace(/\r\n/g, '\n') + if (isDiff(txt)) { + detail.push(['', [ + 'Merge conflict detected in your package.json.', + '', + 'Please resolve the package.json conflict and retry.', + ].join('\n')]) + break + } + } + summary.push(['JSON.parse', er.message]) + detail.push(['JSON.parse', [ + 'Failed to parse JSON data.', + 'Note: package.json must be actual JSON, not just JavaScript.', + ].join('\n')]) + break + + case 'EOTP': + case 'E401': + // E401 is for places where we accidentally neglect OTP stuff + if (er.code === 'EOTP' || /one-time pass/.test(er.message)) { + summary.push(['', 'This operation requires a one-time password from your authenticator.']) + detail.push(['', [ + 'You can provide a one-time password by passing --otp= to the command you ran.', + 'If you already provided a one-time password then it is likely that you either typoed', + 'it, or it timed out. Please try again.', + ].join('\n')]) + } else { + // npm ERR! code E401 + // npm ERR! Unable to authenticate, need: Basic + const auth = !er.headers || !er.headers['www-authenticate'] + ? [] + : er.headers['www-authenticate'].map(au => au.split(/[,\s]+/))[0] + + if (auth.includes('Bearer')) { + summary.push(['', + 'Unable to authenticate, your authentication token seems to be invalid.', + ]) + detail.push(['', [ + 'To correct this please try logging in again with:', + ' npm login', + ].join('\n')]) + } else if (auth.includes('Basic')) { + summary.push(['', 'Incorrect or missing password.']) + detail.push(['', [ + 'If you were trying to login, change your password, create an', + 'authentication token or enable two-factor authentication then', + 'that means you likely typed your password in incorrectly.', + 'Please try again, or recover your password at:', + ' https://www.npmjs.com/forgot', + '', + 'If you were doing some other operation then your saved credentials are', + 'probably out of date. To correct this please try logging in again with:', + ' npm login', + ].join('\n')]) + } else { + summary.push(['', er.message || er]) + } + } + break + + case 'E404': + // There's no need to have 404 in the message as well. + summary.push(['404', er.message.replace(/^404\s+/, '')]) + if (er.pkgid && er.pkgid !== '-') { + const pkg = er.pkgid.replace(/(?!^)@.*$/, '') + + detail.push(['404', '']) + detail.push(['404', '', `'${replaceInfo(er.pkgid)}' is not in this registry.`]) + + const nameValidator = require('validate-npm-package-name') + const valResult = nameValidator(pkg) + + if (!valResult.validForNewPackages) { + detail.push(['404', 'This package name is not valid, because', '']) + + const errorsArray = [...(valResult.errors || []), ...(valResult.warnings || [])] + errorsArray.forEach((item, idx) => detail.push(['404', ' ' + (idx + 1) + '. ' + item])) + } + + detail.push(['404', '']) + detail.push(['404', 'Note that you can also install from a']) + detail.push(['404', 'tarball, folder, http url, or git url.']) + } + break + + case 'EPUBLISHCONFLICT': + summary.push(['publish fail', 'Cannot publish over existing version.']) + detail.push(['publish fail', "Update the 'version' field in package.json and try again."]) + detail.push(['publish fail', '']) + detail.push(['publish fail', 'To automatically increment version numbers, see:']) + detail.push(['publish fail', ' npm help version']) + break + + case 'EISGIT': + summary.push(['git', er.message]) + summary.push(['git', ` ${er.path}`]) + detail.push(['git', [ + 'Refusing to remove it. Update manually,', + 'or move it out of the way first.', + ].join('\n')]) + break + + case 'EBADDEVENGINES': { + const { current, required } = er + summary.push(['EBADDEVENGINES', er.message]) + detail.push(['EBADDEVENGINES', { current, required }]) + break + } + + case 'EBADPLATFORM': { + const actual = er.current + const expected = { ...er.required } + const checkedKeys = [] + for (const key in expected) { + if (Array.isArray(expected[key]) && expected[key].length > 0) { + expected[key] = expected[key].join(',') + checkedKeys.push(key) + } else if (expected[key] === undefined || + Array.isArray(expected[key]) && expected[key].length === 0) { + delete expected[key] + delete actual[key] + } else { + checkedKeys.push(key) + } + } + + const longestKey = Math.max(...checkedKeys.map((key) => key.length)) + const detailEntry = [] + for (const key of checkedKeys) { + const padding = key.length === longestKey + ? 1 + : 1 + (longestKey - key.length) + + // padding + 1 because 'actual' is longer than 'valid' + detailEntry.push(`Valid ${key}:${' '.repeat(padding + 1)}${expected[key]}`) + detailEntry.push(`Actual ${key}:${' '.repeat(padding)}${actual[key]}`) + } + + summary.push(['notsup', format( + 'Unsupported platform for %s: wanted %j (current: %j)', + er.pkgid, + expected, + actual + )]) + detail.push(['notsup', detailEntry.join('\n')]) + break + } + + case 'EEXIST': + summary.push(['', er.message]) + summary.push(['', 'File exists: ' + (er.dest || er.path)]) + detail.push(['', 'Remove the existing file and try again, or run npm']) + detail.push(['', 'with --force to overwrite files recklessly.']) + break + + case 'ENEEDAUTH': + summary.push(['need auth', er.message]) + detail.push(['need auth', 'You need to authorize this machine using `npm adduser`']) + break + + case 'ECONNRESET': + case 'ENOTFOUND': + case 'ETIMEDOUT': + case 'ERR_SOCKET_TIMEOUT': + case 'EAI_FAIL': + summary.push(['network', er.message]) + detail.push(['network', [ + 'This is a problem related to network connectivity.', + 'In most cases you are behind a proxy or have bad network settings.', + '', + 'If you are behind a proxy, please make sure that the', + "'proxy' config is set properly. See: 'npm help config'", + ].join('\n')]) + break + + case 'ETARGET': + summary.push(['notarget', er.message]) + detail.push(['notarget', [ + 'In most cases you or one of your dependencies are requesting', + "a package version that doesn't exist.", + ].join('\n')]) + break + + case 'E403': + summary.push(['403', er.message]) + detail.push(['403', [ + 'In most cases, you or one of your dependencies are requesting', + 'a package version that is forbidden by your security policy, or', + 'on a server you do not have access to.', + ].join('\n')]) + break + + case 'EBADENGINE': + summary.push(['engine', er.message]) + summary.push(['engine', 'Not compatible with your version of node/npm: ' + er.pkgid]) + detail.push(['notsup', [ + 'Not compatible with your version of node/npm: ' + er.pkgid, + 'Required: ' + JSON.stringify(er.required), + 'Actual: ' + + JSON.stringify({ npm: npm.version, node: process.version }), + ].join('\n')]) + break + + case 'ENOSPC': + summary.push(['nospc', er.message]) + detail.push(['nospc', [ + 'There appears to be insufficient space on your system to finish.', + 'Clear up some disk space and try again.', + ].join('\n')]) + break + + case 'EROFS': + summary.push(['rofs', er.message]) + detail.push(['rofs', [ + 'Often virtualized file systems, or other file systems', + "that don't support symlinks, give this error.", + ].join('\n')]) + break + + case 'ENOENT': + summary.push(['enoent', er.message]) + detail.push(['enoent', [ + 'This is related to npm not being able to find a file.', + er.file ? `\nCheck if the file '${er.file}' is present.` : '', + ].join('\n')]) + break + + case 'EMISSINGARG': + case 'EUNKNOWNTYPE': + case 'EINVALIDTYPE': + case 'ETOOMANYARGS': + summary.push(['typeerror', er.stack]) + detail.push(['typeerror', [ + 'This is an error with npm itself. Please report this error at:', + ' https://github.com/npm/cli/issues', + ].join('\n')]) + break + + default: + summary.push(['', er.message || er]) + if (er.cause) { + detail.push(['cause', er.cause.message]) + } + if (er.signal) { + detail.push(['signal', er.signal]) + } + if (er.cmd && Array.isArray(er.args)) { + detail.push(['command', ...[er.cmd, ...er.args.map(replaceInfo)]]) + } + if (er.stdout) { + detail.push(['', er.stdout.trim()]) + } + if (er.stderr) { + detail.push(['', er.stderr.trim()]) + } + break + } + + return { + summary, + detail, + files, + } +} + +const getExitCodeFromError = (err) => { + if (typeof err?.errno === 'number') { + return err.errno + } else if (typeof err?.code === 'number') { + return err.code + } +} + +const getError = (err, { npm, command, pkg }) => { + // if we got a command that just shells out to something else, then it + // will presumably print its own errors and exit with a proper status + // code if there's a problem. If we got an error with a code=0, then... + // something else went wrong along the way, so maybe an npm problem? + if (command?.constructor?.isShellout && typeof err.code === 'number' && err.code) { + return { + exitCode: err.code, + suppressError: true, + } + } + + // XXX: we should stop throwing strings + if (typeof err === 'string') { + return { + exitCode: 1, + suppressError: true, + summary: [['', err]], + } + } + + // XXX: we should stop throwing other non-errors + if (!(err instanceof Error)) { + return { + exitCode: 1, + suppressError: true, + summary: [['weird error', err]], + } + } + + if (err.code === 'EUNKNOWNCOMMAND') { + const suggestions = require('./did-you-mean.js')(pkg, err.command) + return { + exitCode: 1, + suppressError: true, + standard: [ + `Unknown command: "${err.command}"`, + suggestions, + 'To see a list of supported npm commands, run:', + ' npm help', + ], + } + } + + // Anything after this is not suppressed and get more logged information + + // add a code to the error if it doesnt have one and mutate some properties + // so they have redacted information + err.code ??= err.message.match(/^(?:Error: )?(E[A-Z]+)/)?.[1] + // this mutates the error and redacts stack/message + const { summary, detail, files } = errorMessage(err, npm) + + return { + err, + code: err.code, + exitCode: getExitCodeFromError(err) || 1, + suppressError: false, + summary, + detail, + files, + verbose: ['type', 'stack', 'statusCode', 'pkgid'] + .filter(k => err[k]) + .map(k => [k, replaceInfo(err[k])]), + error: ['code', 'syscall', 'file', 'path', 'dest', 'errno'] + .filter(k => err[k]) + .map(k => [k, err[k]]), + } +} + +module.exports = { + getExitCodeFromError, + errorMessage, + getError, +} diff --git a/node_modules/npm/lib/utils/explain-dep.js b/node_modules/npm/lib/utils/explain-dep.js new file mode 100644 index 00000000..4e9e9345 --- /dev/null +++ b/node_modules/npm/lib/utils/explain-dep.js @@ -0,0 +1,103 @@ +const { relative } = require('node:path') + +const explainNode = (node, depth, chalk) => + printNode(node, chalk) + + explainDependents(node, depth, chalk) + + explainLinksIn(node, depth, chalk) + +const colorType = (type, chalk) => { + const style = type === 'extraneous' ? chalk.red + : type === 'dev' ? chalk.blue + : type === 'optional' ? chalk.magenta + : type === 'peer' ? chalk.magentaBright + : type === 'bundled' ? chalk.underline.cyan + : type === 'workspace' ? chalk.blueBright + : type === 'overridden' ? chalk.dim + : /* istanbul ignore next */ s => s + return style(type) +} + +const printNode = (node, chalk) => { + const extra = [] + + for (const meta of ['extraneous', 'dev', 'optional', 'peer', 'bundled', 'overridden']) { + if (node[meta]) { + extra.push(` ${colorType(meta, chalk)}`) + } + } + + const pkgid = node.isWorkspace + ? chalk.blueBright(`${node.name}@${node.version}`) + : `${node.name}@${node.version}` + + return `${pkgid}${extra.join('')}` + + (node.location ? chalk.dim(`\n${node.location}`) : '') +} + +const explainLinksIn = ({ linksIn }, depth, chalk) => { + if (!linksIn || !linksIn.length || depth <= 0) { + return '' + } + + const messages = linksIn.map(link => explainNode(link, depth - 1, chalk)) + const str = '\n' + messages.join('\n') + return str.split('\n').join('\n ') +} + +const explainDependents = ({ dependents }, depth, chalk) => { + if (!dependents || !dependents.length || depth <= 0) { + return '' + } + + const max = Math.ceil(depth / 2) + const messages = dependents.slice(0, max) + .map(edge => explainEdge(edge, depth, chalk)) + + // show just the names of the first 5 deps that overflowed the list + if (dependents.length > max) { + let len = 0 + const maxLen = 50 + const showNames = [] + for (let i = max; i < dependents.length; i++) { + const { from: { name: depName = 'the root project' } } = dependents[i] + len += depName.length + if (len >= maxLen && i < dependents.length - 1) { + showNames.push('...') + break + } + showNames.push(depName) + } + const show = `(${showNames.join(', ')})` + messages.push(`${dependents.length - max} more ${show}`) + } + + const str = '\n' + messages.join('\n') + return str.split('\n').join('\n ') +} + +const explainEdge = ({ name, type, bundled, from, spec, rawSpec, overridden }, depth, chalk) => { + let dep = type === 'workspace' + ? chalk.bold(relative(from.location, spec.slice('file:'.length))) + : `${name}@"${spec}"` + if (overridden) { + dep = `${colorType('overridden', chalk)} ${dep} (was "${rawSpec}")` + } + + const fromMsg = ` from ${explainFrom(from, depth, chalk)}` + + return (type === 'prod' ? '' : `${colorType(type, chalk)} `) + + (bundled ? `${colorType('bundled', chalk)} ` : '') + + `${dep}${fromMsg}` +} + +const explainFrom = (from, depth, chalk) => { + if (!from.name && !from.version) { + return 'the root project' + } + + return printNode(from, chalk) + + explainDependents(from, depth - 1, chalk) + + explainLinksIn(from, depth - 1, chalk) +} + +module.exports = { explainNode, printNode, explainEdge } diff --git a/node_modules/npm/lib/utils/explain-eresolve.js b/node_modules/npm/lib/utils/explain-eresolve.js new file mode 100644 index 00000000..f3c6ae23 --- /dev/null +++ b/node_modules/npm/lib/utils/explain-eresolve.js @@ -0,0 +1,71 @@ +// this is called when an ERESOLVE error is caught in the exit-handler, +// or when there's a log.warn('eresolve', msg, explanation), to turn it +// into a human-intelligible explanation of what's wrong and how to fix. +const { explainEdge, explainNode, printNode } = require('./explain-dep.js') + +// expl is an explanation object that comes from Arborist. It looks like: +// Depth is how far we want to want to descend into the object making a report. +// The full report (ie, depth=Infinity) is always written to the cache folder +// at ${cache}/eresolve-report.txt along with full json. +const explain = (expl, chalk, depth) => { + const { edge, dep, current, peerConflict, currentEdge } = expl + + const out = [] + const whileInstalling = dep && dep.whileInstalling || + current && current.whileInstalling || + edge && edge.from && edge.from.whileInstalling + if (whileInstalling) { + out.push('While resolving: ' + printNode(whileInstalling, chalk)) + } + + // it "should" be impossible for an ERESOLVE explanation to lack both + // current and currentEdge, but better to have a less helpful error + // than a crashing failure. + if (current) { + out.push('Found: ' + explainNode(current, depth, chalk)) + } else if (peerConflict && peerConflict.current) { + out.push('Found: ' + explainNode(peerConflict.current, depth, chalk)) + } else if (currentEdge) { + out.push('Found: ' + explainEdge(currentEdge, depth, chalk)) + } else /* istanbul ignore else - should always have one */ if (edge) { + out.push('Found: ' + explainEdge(edge, depth, chalk)) + } + + out.push('\nCould not resolve dependency:\n' + + explainEdge(edge, depth, chalk)) + + if (peerConflict) { + const heading = '\nConflicting peer dependency:' + const pc = explainNode(peerConflict.peer, depth, chalk) + out.push(heading + ' ' + pc) + } + + return out.join('\n') +} + +// generate a full verbose report and tell the user how to fix it +const report = (expl, chalk, noColorChalk) => { + const flags = [ + expl.strictPeerDeps ? '--no-strict-peer-deps' : '', + '--force', + '--legacy-peer-deps', + ].filter(Boolean) + + const or = (arr) => arr.length <= 2 + ? arr.join(' or ') : + arr.map((v, i, l) => i + 1 === l.length ? `or ${v}` : v).join(', ') + + const fix = `Fix the upstream dependency conflict, or retry +this command with ${or(flags)} +to accept an incorrect (and potentially broken) dependency resolution.` + + return { + explanation: `${explain(expl, chalk, 4)}\n\n${fix}`, + file: `# npm resolution error report\n\n${explain(expl, noColorChalk, Infinity)}\n\n${fix}`, + } +} + +module.exports = { + explain, + report, +} diff --git a/node_modules/npm/lib/utils/format-bytes.js b/node_modules/npm/lib/utils/format-bytes.js new file mode 100644 index 00000000..d293001d --- /dev/null +++ b/node_modules/npm/lib/utils/format-bytes.js @@ -0,0 +1,30 @@ +// Convert bytes to printable output, for file reporting in tarballs +// Only supports up to GB because that's way larger than anything the registry +// supports anyways. + +const formatBytes = (bytes, space = true) => { + let spacer = '' + if (space) { + spacer = ' ' + } + + if (bytes < 1000) { + // B + return `${bytes}${spacer}B` + } + + if (bytes < 1000000) { + // kB + return `${(bytes / 1000).toFixed(1)}${spacer}kB` + } + + if (bytes < 1000000000) { + // MB + return `${(bytes / 1000000).toFixed(1)}${spacer}MB` + } + + // GB + return `${(bytes / 1000000000).toFixed(1)}${spacer}GB` +} + +module.exports = formatBytes diff --git a/node_modules/npm/lib/utils/format-search-stream.js b/node_modules/npm/lib/utils/format-search-stream.js new file mode 100644 index 00000000..b70bd915 --- /dev/null +++ b/node_modules/npm/lib/utils/format-search-stream.js @@ -0,0 +1,174 @@ +/* eslint-disable max-len */ +const { stripVTControlCharacters: strip } = require('node:util') +const { Minipass } = require('minipass') + +// This module consumes package data in the following format: +// +// { +// name: String, +// description: String, +// maintainers: [{ username: String, email: String }], +// keywords: String | [String], +// version: String, +// date: Date // can be null, +// } +// +// The returned stream will format this package data +// into a byte stream of formatted, displayable output. + +function filter (data, exclude) { + const words = [data.name] + .concat(data.maintainers.map(m => m.username)) + .concat(data.keywords || []) + .map(f => f?.trim?.()) + .filter(Boolean) + .join(' ') + .toLowerCase() + + if (exclude.find(pattern => { + // Treats both /foo and /foo/ as regex searches + if (pattern.startsWith('/')) { + if (pattern.endsWith('/')) { + pattern = pattern.slice(0, -1) + } + return words.match(new RegExp(pattern.slice(1))) + } + return words.includes(pattern) + })) { + return false + } + + return true +} + +module.exports = (opts) => { + return opts.json ? new JSONOutputStream(opts) : new TextOutputStream(opts) +} + +class JSONOutputStream extends Minipass { + #didFirst = false + #exclude + + constructor (opts) { + super() + this.#exclude = opts.exclude + } + + write (obj) { + if (!filter(obj, this.#exclude)) { + return + } + if (!this.#didFirst) { + super.write('[\n') + this.#didFirst = true + } else { + super.write('\n,\n') + } + + return super.write(JSON.stringify(obj)) + } + + end () { + super.write(this.#didFirst ? ']\n' : '\n[]\n') + super.end() + } +} + +class TextOutputStream extends Minipass { + #args + #chalk + #exclude + #parseable + + constructor (opts) { + super() + this.#args = opts.args.map(s => s.toLowerCase()).filter(Boolean) + this.#chalk = opts.npm.chalk + this.#exclude = opts.exclude + this.#parseable = opts.parseable + } + + write (data) { + if (!filter(data, this.#exclude)) { + return + } + // Normalize + const pkg = { + authors: data.maintainers.map((m) => `${strip(m.username)}`).join(' '), + publisher: strip(data.publisher?.username || ''), + date: data.date ? data.date.toISOString().slice(0, 10) : 'prehistoric', + description: strip(data.description ?? ''), + keywords: [], + name: strip(data.name), + version: data.version, + } + if (Array.isArray(data.keywords)) { + pkg.keywords = data.keywords.map(strip) + } else if (typeof data.keywords === 'string') { + pkg.keywords = strip(data.keywords.replace(/[,\s]+/, ' ')).split(' ') + } + + let output + if (this.#parseable) { + output = [pkg.name, pkg.description, pkg.author, pkg.date, pkg.version, pkg.keywords] + .filter(Boolean) + .map(col => ('' + col).replace(/\t/g, ' ')).join('\t') + return super.write(output) + } + + const keywords = pkg.keywords.map(k => { + if (this.#args.includes(k)) { + return this.#chalk.cyan(k) + } else { + return k + } + }).join(' ') + + let description = [] + for (const arg of this.#args) { + const finder = pkg.description.toLowerCase().split(arg.toLowerCase()) + let p = 0 + for (const f of finder) { + description.push(pkg.description.slice(p, p + f.length)) + const word = pkg.description.slice(p + f.length, p + f.length + arg.length) + description.push(this.#chalk.cyan(word)) + p += f.length + arg.length + } + } + description = description.filter(Boolean) + let name = pkg.name + if (this.#args.includes(pkg.name)) { + name = this.#chalk.cyan(pkg.name) + } else { + name = [] + for (const arg of this.#args) { + const finder = pkg.name.toLowerCase().split(arg.toLowerCase()) + let p = 0 + for (const f of finder) { + name.push(pkg.name.slice(p, p + f.length)) + const word = pkg.name.slice(p + f.length, p + f.length + arg.length) + name.push(this.#chalk.cyan(word)) + p += f.length + arg.length + } + } + name = this.#chalk.blue(name.join('')) + } + + if (description.length) { + output = `${name}\n${description.join('')}\n` + } else { + output = `${name}\n` + } + if (pkg.publisher) { + output += `Version ${this.#chalk.blue(pkg.version)} published ${this.#chalk.blue(pkg.date)} by ${this.#chalk.blue(pkg.publisher)}\n` + } else { + output += `Version ${this.#chalk.blue(pkg.version)} published ${this.#chalk.blue(pkg.date)} by ${this.#chalk.yellow('???')}\n` + } + output += `Maintainers: ${pkg.authors}\n` + if (keywords) { + output += `Keywords: ${keywords}\n` + } + output += `${this.#chalk.blue(`https://npm.im/${pkg.name}`)}\n` + return super.write(output) + } +} diff --git a/node_modules/npm/lib/utils/format.js b/node_modules/npm/lib/utils/format.js new file mode 100644 index 00000000..aaecfe1b --- /dev/null +++ b/node_modules/npm/lib/utils/format.js @@ -0,0 +1,50 @@ +const { formatWithOptions: baseFormatWithOptions } = require('node:util') + +// These are most assuredly not a mistake +// https://eslint.org/docs/latest/rules/no-control-regex +// \x00 through \x1f, \x7f through \x9f, not including \x09 \x0a \x0b \x0d +/* eslint-disable-next-line no-control-regex */ +const HAS_C01 = /[\x00-\x08\x0c\x0e-\x1f\x7f-\x9f]/ + +// Allows everything up to '[38;5;255m' in 8 bit notation +const ALLOWED_SGR = /^\[[0-9;]{0,8}m/ + +// '[38;5;255m'.length +const SGR_MAX_LEN = 10 + +// Strips all ANSI C0 and C1 control characters (except for SGR up to 8 bit) +function STRIP_C01 (str) { + if (!HAS_C01.test(str)) { + return str + } + let result = '' + for (let i = 0; i < str.length; i++) { + const char = str[i] + const code = char.charCodeAt(0) + if (!HAS_C01.test(char)) { + // Most characters are in this set so continue early if we can + result = `${result}${char}` + } else if (code === 27 && ALLOWED_SGR.test(str.slice(i + 1, i + SGR_MAX_LEN + 1))) { + // \x1b with allowed SGR + result = `${result}\x1b` + } else if (code <= 31) { + // escape all other C0 control characters besides \x7f + result = `${result}^${String.fromCharCode(code + 64)}` + } else { + // hasC01 ensures this is now a C1 control character or \x7f + result = `${result}^${String.fromCharCode(code - 64)}` + } + } + return result +} + +const formatWithOptions = ({ prefix: prefixes = [], eol = '\n', ...options }, ...args) => { + const prefix = prefixes.filter(p => p != null).join(' ') + const formatted = STRIP_C01(baseFormatWithOptions(options, ...args)) + // Splitting could be changed to only `\n` once we are sure we only emit unix newlines. + // The eol param to this function will put the correct newlines in place for the returned string. + const lines = formatted.split(/\r?\n/) + return lines.reduce((acc, l) => `${acc}${prefix}${prefix && l ? ' ' : ''}${l}${eol}`, '') +} + +module.exports = { formatWithOptions } diff --git a/node_modules/npm/lib/utils/get-identity.js b/node_modules/npm/lib/utils/get-identity.js new file mode 100644 index 00000000..d8f59da1 --- /dev/null +++ b/node_modules/npm/lib/utils/get-identity.js @@ -0,0 +1,26 @@ +const npmFetch = require('npm-registry-fetch') + +module.exports = async (npm, opts) => { + const { registry } = opts + + // First, check if we have a user/pass-based auth + const creds = npm.config.getCredentialsByURI(registry) + if (creds.username) { + return creds.username + } + + // No username, but we have other credentials; fetch the username from registry + if (creds.token || creds.certfile && creds.keyfile) { + const registryData = await npmFetch.json('/-/whoami', { ...opts }) + if (typeof registryData?.username === 'string') { + return registryData.username + } + } + + // At this point, even if they have a credentials object, it doesn't have a + // valid token. + throw Object.assign( + new Error('This command requires you to be logged in.'), + { code: 'ENEEDAUTH' } + ) +} diff --git a/node_modules/npm/lib/utils/get-workspaces.js b/node_modules/npm/lib/utils/get-workspaces.js new file mode 100644 index 00000000..48c26779 --- /dev/null +++ b/node_modules/npm/lib/utils/get-workspaces.js @@ -0,0 +1,54 @@ +const { resolve, relative } = require('node:path') +const mapWorkspaces = require('@npmcli/map-workspaces') +const { minimatch } = require('minimatch') +const pkgJson = require('@npmcli/package-json') + +// minimatch wants forward slashes only for glob patterns +const globify = pattern => pattern.split('\\').join('/') + +// Returns an Map of paths to workspaces indexed by workspace name +// { foo => '/path/to/foo' } +const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom }) => { + // TODO we need a better error to be bubbled up here if this call fails + const { content: pkg } = await pkgJson.normalize(path) + const workspaces = await mapWorkspaces({ cwd: path, pkg }) + let res = new Map() + if (includeWorkspaceRoot) { + res.set(pkg.name, path) + } + + if (!filters.length) { + res = new Map([...res, ...workspaces]) + } + + for (const filterArg of filters) { + for (const [workspaceName, workspacePath] of workspaces.entries()) { + let relativePath = relative(relativeFrom, workspacePath) + if (filterArg.startsWith('./')) { + relativePath = `./${relativePath}` + } + const relativeFilter = relative(path, filterArg) + if (filterArg === workspaceName + || resolve(relativeFrom, filterArg) === workspacePath + || minimatch(relativePath, `${globify(relativeFilter)}/*`) + || minimatch(relativePath, `${globify(filterArg)}/*`) + ) { + res.set(workspaceName, workspacePath) + } + } + } + + if (!res.size) { + let msg = '!' + if (filters.length) { + msg = `:\n ${filters.reduce( + (acc, filterArg) => `${acc} --workspace=${filterArg}`, '')}` + } + + throw new Error(`No workspaces found${msg}`) + } + + return res +} + +module.exports = getWorkspaces diff --git a/node_modules/npm/lib/utils/installed-deep.js b/node_modules/npm/lib/utils/installed-deep.js new file mode 100644 index 00000000..3c56c5d0 --- /dev/null +++ b/node_modules/npm/lib/utils/installed-deep.js @@ -0,0 +1,45 @@ +const { resolve } = require('node:path') +const localeCompare = require('@isaacs/string-locale-compare')('en') + +const installedDeep = async (npm) => { + const Arborist = require('@npmcli/arborist') + const { + depth, + global, + prefix, + workspacesEnabled, + } = npm.flatOptions + + const getValues = (tree) => + [...tree.inventory.values()] + .filter(i => i.location !== '' && !i.isRoot) + .map(i => { + return i + }) + .filter(i => (i.depth - 1) <= depth) + .sort((a, b) => (a.depth - b.depth) || localeCompare(a.name, b.name)) + + const res = new Set() + const gArb = new Arborist({ + global: true, + path: resolve(npm.globalDir, '..'), + workspacesEnabled, + }) + const gTree = await gArb.loadActual({ global: true }) + + for (const node of getValues(gTree)) { + res.add(global ? node.name : [node.name, '-g']) + } + + if (!global) { + const arb = new Arborist({ global: false, path: prefix, workspacesEnabled }) + const tree = await arb.loadActual() + for (const node of getValues(tree)) { + res.add(node.name) + } + } + + return [...res] +} + +module.exports = installedDeep diff --git a/node_modules/npm/lib/utils/installed-shallow.js b/node_modules/npm/lib/utils/installed-shallow.js new file mode 100644 index 00000000..d59318fe --- /dev/null +++ b/node_modules/npm/lib/utils/installed-shallow.js @@ -0,0 +1,19 @@ +const { readdirScoped } = require('@npmcli/fs') + +const installedShallow = async (npm, opts) => { + const names = async global => { + const paths = await readdirScoped(global ? npm.globalDir : npm.localDir) + return paths.map(p => p.replace(/\\/g, '/')) + } + const { conf: { argv: { remain } } } = opts + if (remain.length > 3) { + return null + } + + const { global } = npm.flatOptions + const locals = global ? [] : await names(false) + const globals = (await names(true)).map(n => global ? n : `${n} -g`) + return [...locals, ...globals] +} + +module.exports = installedShallow diff --git a/node_modules/npm/lib/utils/is-windows.js b/node_modules/npm/lib/utils/is-windows.js new file mode 100644 index 00000000..63c5671d --- /dev/null +++ b/node_modules/npm/lib/utils/is-windows.js @@ -0,0 +1,4 @@ +const isWindowsShell = (process.platform === 'win32') && + !/^MINGW(32|64)$/.test(process.env.MSYSTEM) && process.env.TERM !== 'cygwin' + +exports.isWindowsShell = isWindowsShell diff --git a/node_modules/npm/lib/utils/log-file.js b/node_modules/npm/lib/utils/log-file.js new file mode 100644 index 00000000..6c9bcd7f --- /dev/null +++ b/node_modules/npm/lib/utils/log-file.js @@ -0,0 +1,261 @@ +const os = require('node:os') +const { join, dirname, basename } = require('node:path') +const fsMiniPass = require('fs-minipass') +const fs = require('node:fs/promises') +const { log } = require('proc-log') +const { formatWithOptions } = require('./format') + +const padZero = (n, length) => n.toString().padStart(length.toString().length, '0') + +class LogFiles { + // Default to an array so we can buffer + // initial writes before we know the cache location + #logStream = [] + + // We cap log files at a certain number of log events per file. + // Note that each log event can write more than one line to the + // file. Then we rotate log files once this number of events is reached + #MAX_LOGS_PER_FILE = null + + // Now that we write logs continuously we need to have a backstop + // here for infinite loops that still log. This is also partially handled + // by the config.get('max-files') option, but this is a failsafe to + // prevent runaway log file creation + #MAX_FILES_PER_PROCESS = null + + #fileLogCount = 0 + #totalLogCount = 0 + #path = null + #logsMax = null + #files = [] + #timing = false + + constructor ({ + maxLogsPerFile = 50_000, + maxFilesPerProcess = 5, + } = {}) { + this.#MAX_LOGS_PER_FILE = maxLogsPerFile + this.#MAX_FILES_PER_PROCESS = maxFilesPerProcess + this.on() + } + + on () { + process.on('log', this.#logHandler) + } + + off () { + process.off('log', this.#logHandler) + this.#endStream() + } + + load ({ command, path, logsMax = Infinity, timing } = {}) { + if (['completion'].includes(command)) { + return + } + + // dir is user configurable and is required to exist so + // this can error if the dir is missing or not configured correctly + this.#path = path + this.#logsMax = logsMax + this.#timing = timing + + // Log stream has already ended + if (!this.#logStream) { + return + } + + log.verbose('logfile', `logs-max:${logsMax} dir:${this.#path}`) + + // Write the contents of our array buffer to our new file stream and + // set that as the new log logstream for future writes + // if logs max is 0 then the user does not want a log file + if (this.#logsMax > 0) { + const initialFile = this.#openLogFile() + if (initialFile) { + for (const item of this.#logStream) { + const formatted = this.#formatLogItem(...item) + if (formatted !== null) { + initialFile.write(formatted) + } + } + this.#logStream = initialFile + } + } + + log.verbose('logfile', this.files[0] || 'no logfile created') + + // Kickoff cleaning process, even if we aren't writing a logfile. + // This is async but it will always ignore the current logfile + // Return the result so it can be awaited in tests + return this.#cleanLogs() + } + + get files () { + return this.#files + } + + get #isBuffered () { + return Array.isArray(this.#logStream) + } + + #endStream (output) { + if (this.#logStream && !this.#isBuffered) { + this.#logStream.end(output) + this.#logStream = null + } + } + + #logHandler = (level, ...args) => { + // Ignore pause and resume events since we + // write everything to the log file + if (level === 'pause' || level === 'resume') { + return + } + + // If the stream is ended then do nothing + if (!this.#logStream) { + return + } + + if (this.#isBuffered) { + // Cant do anything but buffer the output if we dont + // have a file stream yet + this.#logStream.push([level, ...args]) + return + } + + const logOutput = this.#formatLogItem(level, ...args) + if (logOutput === null) { + return + } + + // Open a new log file if we've written too many logs to this one + if (this.#fileLogCount >= this.#MAX_LOGS_PER_FILE) { + // Write last chunk to the file and close it + this.#endStream(logOutput) + if (this.#files.length >= this.#MAX_FILES_PER_PROCESS) { + // but if its way too many then we just stop listening + this.off() + } else { + // otherwise we are ready for a new file for the next event + this.#logStream = this.#openLogFile() + } + } else { + this.#logStream.write(logOutput) + } + } + + #formatLogItem (level, title, ...args) { + // Only right timing logs to logfile if explicitly requests + if (level === log.KEYS.timing && !this.#timing) { + return null + } + + this.#fileLogCount += 1 + const prefix = [this.#totalLogCount++, level, title || null] + return formatWithOptions({ prefix, eol: os.EOL, colors: false }, ...args) + } + + #getLogFilePath (count = '') { + return `${this.#path}debug-${count}.log` + } + + #openLogFile () { + // Count in filename will be 0 indexed + const count = this.#files.length + + try { + // Pad with zeros so that our log files are always sorted properly + // We never want to write files ending in `-9.log` and `-10.log` because + // log file cleaning is done by deleting the oldest so in this example + // `-10.log` would be deleted next + const f = this.#getLogFilePath(padZero(count, this.#MAX_FILES_PER_PROCESS)) + // Some effort was made to make the async, but we need to write logs + // during process.on('exit') which has to be synchronous. So in order + // to never drop log messages, it is easiest to make it sync all the time + // and this was measured to be about 1.5% slower for 40k lines of output + const logStream = new fsMiniPass.WriteStreamSync(f, { flags: 'a' }) + if (count > 0) { + // Reset file log count if we are opening + // after our first file + this.#fileLogCount = 0 + } + this.#files.push(logStream.path) + return logStream + } catch (e) { + // If the user has a readonly logdir then we don't want to + // warn this on every command so it should be verbose + log.verbose('logfile', `could not be created: ${e}`) + } + } + + async #cleanLogs () { + // module to clean out the old log files + // this is a best-effort attempt. if a rm fails, we just + // log a message about it and move on. We do return a + // Promise that succeeds when we've tried to delete everything, + // just for the benefit of testing this function properly. + + try { + const logPath = this.#getLogFilePath() + const patternFileName = basename(logPath) + // tell glob to only match digits + .replace(/\d/g, 'd') + // Handle the old (prior to 8.2.0) log file names which did not have a + // counter suffix + .replace('-.log', '') + + let files = await fs.readdir( + dirname(logPath), { + withFileTypes: true, + encoding: 'utf-8', + }) + files = files.sort((a, b) => basename(a.name).localeCompare(basename(b.name), 'en')) + + const logFiles = [] + + for (const file of files) { + if (!file.isFile()) { + continue + } + + const genericFileName = file.name.replace(/\d/g, 'd') + const filePath = join(dirname(logPath), basename(file.name)) + + // Always ignore the currently written files + if ( + genericFileName.includes(patternFileName) + && genericFileName.endsWith('.log') + && !this.#files.includes(filePath) + ) { + logFiles.push(filePath) + } + } + + const toDelete = logFiles.length - this.#logsMax + + if (toDelete <= 0) { + return + } + + log.silly('logfile', `start cleaning logs, removing ${toDelete} files`) + + for (const file of logFiles.slice(0, toDelete)) { + try { + await fs.rm(file, { force: true }) + } catch (e) { + log.silly('logfile', 'error removing log file', file, e) + } + } + } catch (e) { + // Disable cleanup failure warnings when log writing is disabled + if (this.#logsMax > 0) { + log.verbose('logfile', 'error cleaning log files', e) + } + } finally { + log.silly('logfile', 'done cleaning log files') + } + } +} + +module.exports = LogFiles diff --git a/node_modules/npm/lib/utils/npm-usage.js b/node_modules/npm/lib/utils/npm-usage.js new file mode 100644 index 00000000..1bd790ca --- /dev/null +++ b/node_modules/npm/lib/utils/npm-usage.js @@ -0,0 +1,74 @@ +const { commands } = require('./cmd-list') + +const COL_MAX = 60 +const COL_MIN = 24 +const COL_GUTTER = 16 +const INDENT = 4 + +const indent = (repeat = INDENT) => ' '.repeat(repeat) +const indentNewline = (repeat) => `\n${indent(repeat)}` + +module.exports = (npm) => { + const browser = npm.config.get('viewer') === 'browser' ? ' (in a browser)' : '' + const allCommands = npm.config.get('long') ? cmdUsages(npm.constructor) : cmdNames() + + return `npm + +Usage: + +npm install install all the dependencies in your project +npm install add the dependency to your project +npm test run this project's tests +npm run run the script named +npm -h quick help on +npm -l display usage info for all commands +npm help search for help on ${browser} +npm help npm more involved overview${browser} + +All commands: +${allCommands} + +Specify configs in the ini-formatted file: +${indent() + npm.config.get('userconfig')} +or on the command line via: npm --key=value + +More configuration info: npm help config +Configuration fields: npm help 7 config + +npm@${npm.version} ${npm.npmRoot}` +} + +const cmdNames = () => { + const out = [''] + + const line = !process.stdout.columns ? COL_MAX + : Math.min(COL_MAX, Math.max(process.stdout.columns - COL_GUTTER, COL_MIN)) + + let l = 0 + for (const c of commands) { + if (out[l].length + c.length + 2 < line) { + out[l] += ', ' + c + } else { + out[l++] += ',' + out[l] = c + } + } + + return indentNewline() + out.join(indentNewline()).slice(2) +} + +const cmdUsages = (Npm) => { + // return a string of : + let maxLen = 0 + const set = [] + for (const c of commands) { + set.push([c, Npm.cmd(c).describeUsage.split('\n')]) + maxLen = Math.max(maxLen, c.length) + } + + return set.map(([name, usageLines]) => { + const gutter = indent(maxLen - name.length + 1) + const usage = usageLines.join(indentNewline(INDENT + maxLen + 1)) + return indentNewline() + name + gutter + usage + }).join('\n') +} diff --git a/node_modules/npm/lib/utils/open-url.js b/node_modules/npm/lib/utils/open-url.js new file mode 100644 index 00000000..632dcc79 --- /dev/null +++ b/node_modules/npm/lib/utils/open-url.js @@ -0,0 +1,98 @@ +const { open } = require('@npmcli/promise-spawn') +const { output, input } = require('proc-log') +const { URL } = require('node:url') +const readline = require('node:readline/promises') +const { once } = require('node:events') + +const assertValidUrl = (url) => { + try { + if (!/^https?:$/.test(new URL(url).protocol)) { + throw new Error() + } + } catch { + throw new Error('Invalid URL: ' + url) + } +} + +const outputMsg = (json, title, url) => { + if (json) { + output.buffer({ title, url }) + } else { + output.standard(`${title}:\n${url}`) + } +} + +// attempt to open URL in web-browser, print address otherwise: +const openUrl = async (npm, url, title, isFile) => { + url = encodeURI(url) + const browser = npm.config.get('browser') + const json = npm.config.get('json') + + if (browser === false) { + outputMsg(json, title, url) + return + } + + // We pass this in as true from the help command so we know we don't have to + // check the protocol + if (!isFile) { + assertValidUrl(url) + } + + try { + await input.start(() => open(url, { + command: browser === true ? null : browser, + })) + } catch (err) { + if (err.code !== 127) { + throw err + } + outputMsg(json, title, url) + } +} + +// Prompt to open URL in browser if possible +const openUrlPrompt = async (npm, url, title, prompt, { signal }) => { + const browser = npm.config.get('browser') + const json = npm.config.get('json') + + assertValidUrl(url) + outputMsg(json, title, url) + + if (browser === false || !process.stdin.isTTY || !process.stdout.isTTY) { + return + } + + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }) + + try { + await input.read(() => Promise.race([ + rl.question(prompt, { signal }), + once(rl, 'error'), + once(rl, 'SIGINT').then(() => { + throw new Error('canceled') + }), + ])) + rl.close() + await openUrl(npm, url, 'Browser unavailable. Please open the URL manually') + } catch (err) { + rl.close() + if (err.name !== 'AbortError') { + throw err + } + } +} + +// Rearrange arguments and return a function that takes the two arguments +// returned from the npm-profile methods that take an opener +const createOpener = (npm, title, prompt = 'Press ENTER to open in the browser...') => + (url, opts) => openUrlPrompt(npm, url, title, prompt, opts) + +module.exports = { + openUrl, + openUrlPrompt, + createOpener, +} diff --git a/node_modules/npm/lib/utils/output-error.js b/node_modules/npm/lib/utils/output-error.js new file mode 100644 index 00000000..27128e9f --- /dev/null +++ b/node_modules/npm/lib/utils/output-error.js @@ -0,0 +1,29 @@ +const { log, output } = require('proc-log') + +const outputError = ({ standard = [], verbose = [], error = [], summary = [], detail = [] }) => { + for (const line of standard) { + // Each output line is just a single string + output.standard(line) + } + for (const line of verbose) { + log.verbose(...line) + } + for (const line of [...error, ...summary, ...detail]) { + log.error(...line) + } +} + +const jsonError = (error, npm) => { + if (error && npm?.loaded && npm?.config.get('json')) { + return { + code: error.code, + summary: (error.summary || []).map(l => l.slice(1).join(' ')).join('\n').trim(), + detail: (error.detail || []).map(l => l.slice(1).join(' ')).join('\n').trim(), + } + } +} + +module.exports = { + outputError, + jsonError, +} diff --git a/node_modules/npm/lib/utils/ping.js b/node_modules/npm/lib/utils/ping.js new file mode 100644 index 00000000..3d47ca1e --- /dev/null +++ b/node_modules/npm/lib/utils/ping.js @@ -0,0 +1,7 @@ +// ping the npm registry +// used by the ping and doctor commands +const npmFetch = require('npm-registry-fetch') +module.exports = async (flatOptions) => { + const res = await npmFetch('/-/ping', { ...flatOptions, cache: false }) + return res.json().catch(() => ({})) +} diff --git a/node_modules/npm/lib/utils/queryable.js b/node_modules/npm/lib/utils/queryable.js new file mode 100644 index 00000000..a5fb25a8 --- /dev/null +++ b/node_modules/npm/lib/utils/queryable.js @@ -0,0 +1,310 @@ +const util = require('node:util') +const _delete = Symbol('delete') +const _append = Symbol('append') + +const sqBracketsMatcher = str => str.match(/(.+)\[([^\]]+)\]\.?(.*)$/) + +// replaces any occurrence of an empty-brackets (e.g: []) with a special +// Symbol(append) to represent it, this is going to be useful for the setter +// method that will push values to the end of the array when finding these +const replaceAppendSymbols = str => { + const matchEmptyBracket = str.match(/^(.*)\[\]\.?(.*)$/) + + if (matchEmptyBracket) { + const [, pre, post] = matchEmptyBracket + return [...replaceAppendSymbols(pre), _append, post].filter(Boolean) + } + + return [str] +} + +const parseKeys = key => { + const sqBracketItems = new Set() + sqBracketItems.add(_append) + const parseSqBrackets = str => { + const index = sqBracketsMatcher(str) + + // once we find square brackets, we recursively parse all these + if (index) { + const preSqBracketPortion = index[1] + + // we want to have a `new String` wrapper here in order to differentiate + // between multiple occurrences of the same string, e.g: + // foo.bar[foo.bar] should split into { foo: { bar: { 'foo.bar': {} } } + /* eslint-disable-next-line no-new-wrappers */ + const foundKey = new String(index[2]) + const postSqBracketPortion = index[3] + + // we keep track of items found during this step to make sure + // we don't try to split-separate keys that were defined within + // square brackets, since the key name itself might contain dots + sqBracketItems.add(foundKey) + + // returns an array that contains either dot-separate items (that will + // be split apart during the next step OR the fully parsed keys + // read from square brackets, e.g: + // foo.bar[1.0.0].a.b -> ['foo.bar', '1.0.0', 'a.b'] + return [ + ...parseSqBrackets(preSqBracketPortion), + foundKey, + ...(postSqBracketPortion ? parseSqBrackets(postSqBracketPortion) : []), + ] + } + + // at the end of parsing, any usage of the special empty-bracket syntax + // (e.g: foo.array[]) has not yet been parsed, here we'll take care + // of parsing it and adding a special symbol to represent it in + // the resulting list of keys + return replaceAppendSymbols(str) + } + + const res = [] + // starts by parsing items defined as square brackets, those might be + // representing properties that have a dot in the name or just array + // indexes, e.g: foo[1.0.0] or list[0] + const sqBracketKeys = parseSqBrackets(key.trim()) + + for (const k of sqBracketKeys) { + // keys parsed from square brackets should just be added to list of + // resulting keys as they might have dots as part of the key + if (sqBracketItems.has(k)) { + res.push(k) + } else { + // splits the dot-sep property names and add them to the list of keys + /* eslint-disable-next-line no-new-wrappers */ + for (const splitKey of k.split('.')) { + res.push(String(splitKey)) + } + } + } + + // returns an ordered list of strings in which each entry + // represents a key in an object defined by the previous entry + return res +} + +const getter = ({ data, key }, { unwrapSingleItemArrays = true } = {}) => { + // keys are a list in which each entry represents the name of + // a property that should be walked through the object in order to + // return the final found value + const keys = parseKeys(key) + let _data = data + let label = '' + + for (const k of keys) { + // empty-bracket-shortcut-syntax is not supported on getter + if (k === _append) { + throw Object.assign(new Error('Empty brackets are not valid syntax for retrieving values.'), { + code: 'EINVALIDSYNTAX', + }) + } + + // extra logic to take into account printing array, along with its + // special syntax in which using a dot-sep property name after an + // arry will expand it's results, e.g: + // arr.name -> arr[0].name=value, arr[1].name=value, ... + const maybeIndex = Number(k) + if (Array.isArray(_data) && !Number.isInteger(maybeIndex)) { + _data = _data.reduce((acc, i, index) => { + acc[`${label}[${index}].${k}`] = i[k] + return acc + }, {}) + return _data + } else { + if (!Object.hasOwn(_data, k)) { + return undefined + } + _data = _data[k] + } + + label += k + } + + // these are some legacy expectations from + // the old API consumed by lib/view.js + if (unwrapSingleItemArrays && Array.isArray(_data) && _data.length <= 1) { + _data = _data[0] + } + + return { + [key]: _data, + } +} + +const setter = ({ data, key, value, force }) => { + // setter goes to recursively transform the provided data obj, + // setting properties from the list of parsed keys, e.g: + // ['foo', 'bar', 'baz'] -> { foo: { bar: { baz: {} } } + const keys = parseKeys(key) + const setKeys = (_data, _key) => { + // handles array indexes, converting valid integers to numbers, + // note that occurrences of Symbol(append) will throw, + // so we just ignore these for now + let maybeIndex = Number.NaN + try { + maybeIndex = Number(_key) + } catch { + // leave it NaN + } + if (!Number.isNaN(maybeIndex)) { + _key = maybeIndex + } + + // creates new array in case key is an index + // and the array obj is not yet defined + const keyIsAnArrayIndex = _key === maybeIndex || _key === _append + const dataHasNoItems = !Object.keys(_data).length + if (keyIsAnArrayIndex && dataHasNoItems && !Array.isArray(_data)) { + _data = [] + } + + // converting from array to an object is also possible, in case the + // user is using force mode, we should also convert existing arrays + // to an empty object if the current _data is an array + if (force && Array.isArray(_data) && !keyIsAnArrayIndex) { + _data = { ..._data } + } + + // the _append key is a special key that is used to represent + // the empty-bracket notation, e.g: arr[] -> arr[arr.length] + if (_key === _append) { + if (!Array.isArray(_data)) { + throw Object.assign(new Error(`Can't use append syntax in non-Array element`), { + code: 'ENOAPPEND', + }) + } + _key = _data.length + } + + // retrieves the next data object to recursively iterate on, + // throws if trying to override a literal value or add props to an array + const next = () => { + const haveContents = !force && _data[_key] != null && value !== _delete + const shouldNotOverrideLiteralValue = !(typeof _data[_key] === 'object') + // if the next obj to recurse is an array and the next key to be + // appended to the resulting obj is not an array index, then it + // should throw since we can't append arbitrary props to arrays + const shouldNotAddPropsToArrays = + typeof keys[0] !== 'symbol' && Array.isArray(_data[_key]) && Number.isNaN(Number(keys[0])) + + const overrideError = haveContents && shouldNotOverrideLiteralValue + if (overrideError) { + throw Object.assign( + new Error(`Property ${_key} already exists and is not an Array or Object.`), + { code: 'EOVERRIDEVALUE' } + ) + } + + const addPropsToArrayError = haveContents && shouldNotAddPropsToArrays + if (addPropsToArrayError) { + throw Object.assign(new Error(`Can't add property ${key} to an Array.`), { + code: 'ENOADDPROP', + }) + } + + return typeof _data[_key] === 'object' ? _data[_key] || {} : {} + } + + // sets items from the parsed array of keys as objects, recurses to + // setKeys in case there are still items to be handled, otherwise it + // just sets the original value set by the user + if (keys.length) { + _data[_key] = setKeys(next(), keys.shift()) + } else { + // handles special deletion cases for obj props / array items + if (value === _delete) { + if (Array.isArray(_data)) { + _data.splice(_key, 1) + } else { + delete _data[_key] + } + } else { + // finally, sets the value in its right place + _data[_key] = value + } + } + + return _data + } + + setKeys(data, keys.shift()) +} + +class Queryable { + static ALL = '' + + #data = null + + constructor (obj) { + if (!obj || typeof obj !== 'object') { + throw Object.assign(new Error('Queryable needs an object to query properties from.'), { + code: 'ENOQUERYABLEOBJ', + }) + } + + this.#data = obj + } + + query (queries, opts) { + // this ugly interface here is meant to be a compatibility layer + // with the legacy API lib/view.js is consuming, if at some point + // we refactor that command then we can revisit making this nicer + if (queries === Queryable.ALL) { + return { [Queryable.ALL]: this.#data } + } + + const q = query => + getter({ + data: this.#data, + key: query, + }, opts) + + if (Array.isArray(queries)) { + let res = {} + for (const query of queries) { + res = { ...res, ...q(query) } + } + return res + } else { + return q(queries) + } + } + + // return the value for a single query if found, otherwise returns undefined + get (query) { + const obj = this.query(query) + if (obj) { + return obj[query] + } + } + + // creates objects along the way for the provided `query` parameter + // and assigns `value` to the last property of the query chain + set (query, value, { force } = {}) { + setter({ + data: this.#data, + key: query, + value, + force, + }) + } + + // deletes the value of the property found at `query` + delete (query) { + setter({ + data: this.#data, + key: query, + value: _delete, + }) + } + + toJSON () { + return this.#data + } + + [util.inspect.custom] () { + return this.toJSON() + } +} + +module.exports = Queryable diff --git a/node_modules/npm/lib/utils/read-user-info.js b/node_modules/npm/lib/utils/read-user-info.js new file mode 100644 index 00000000..a9a50f82 --- /dev/null +++ b/node_modules/npm/lib/utils/read-user-info.js @@ -0,0 +1,67 @@ +const { read: _read } = require('read') +const userValidate = require('npm-user-validate') +const { log, input } = require('proc-log') + +const otpPrompt = `This command requires a one-time password (OTP) from your authenticator app. +Enter one below. You can also pass one on the command line by appending --otp=123456. +For more information, see: +https://docs.npmjs.com/getting-started/using-two-factor-authentication +Enter OTP: ` +const passwordPrompt = 'npm password: ' +const usernamePrompt = 'npm username: ' +const emailPrompt = 'email (this IS public): ' + +const read = (...args) => input.read(() => _read(...args)) + +function readOTP (msg = otpPrompt, otp, isRetry) { + if (isRetry && otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp)) { + return otp.replace(/\s+/g, '') + } + + return read({ prompt: msg, default: otp || '' }) + .then((rOtp) => readOTP(msg, rOtp, true)) +} + +function readPassword (msg = passwordPrompt, password, isRetry) { + if (isRetry && password) { + return password + } + + return read({ prompt: msg, silent: true, default: password || '' }) + .then((rPassword) => readPassword(msg, rPassword, true)) +} + +function readUsername (msg = usernamePrompt, username, isRetry) { + if (isRetry && username) { + const error = userValidate.username(username) + if (error) { + log.warn(error.message) + } else { + return Promise.resolve(username.trim()) + } + } + + return read({ prompt: msg, default: username || '' }) + .then((rUsername) => readUsername(msg, rUsername, true)) +} + +function readEmail (msg = emailPrompt, email, isRetry) { + if (isRetry && email) { + const error = userValidate.email(email) + if (error) { + log.warn(error.message) + } else { + return email.trim() + } + } + + return read({ prompt: msg, default: email || '' }) + .then((username) => readEmail(msg, username, true)) +} + +module.exports = { + otp: readOTP, + password: readPassword, + username: readUsername, + email: readEmail, +} diff --git a/node_modules/npm/lib/utils/reify-finish.js b/node_modules/npm/lib/utils/reify-finish.js new file mode 100644 index 00000000..410c1973 --- /dev/null +++ b/node_modules/npm/lib/utils/reify-finish.js @@ -0,0 +1,33 @@ +const reifyOutput = require('./reify-output.js') +const ini = require('ini') +const { writeFile } = require('node:fs/promises') +const { resolve } = require('node:path') + +const reifyFinish = async (npm, arb) => { + await saveBuiltinConfig(npm, arb) + reifyOutput(npm, arb) +} + +const saveBuiltinConfig = async (npm, arb) => { + const { options: { global }, actualTree } = arb + if (!global) { + return + } + + // if we are using a builtin config, and just installed npm as + // a top-level global package, we have to preserve that config. + const npmNode = actualTree.inventory.get('node_modules/npm') + if (!npmNode) { + return + } + + const builtinConf = npm.config.data.get('builtin') + if (builtinConf.loadError) { + return + } + + const content = ini.stringify(builtinConf.raw).trim() + '\n' + await writeFile(resolve(npmNode.path, 'npmrc'), content) +} + +module.exports = reifyFinish diff --git a/node_modules/npm/lib/utils/reify-output.js b/node_modules/npm/lib/utils/reify-output.js new file mode 100644 index 00000000..025479f0 --- /dev/null +++ b/node_modules/npm/lib/utils/reify-output.js @@ -0,0 +1,199 @@ +// pass in an arborist object, and it'll output the data about what +// was done, what was audited, etc. +// +// added ## packages, removed ## packages, and audited ## packages in 19.157s +// +// 1 package is looking for funding +// run `npm fund` for details +// +// found 37 vulnerabilities (5 low, 7 moderate, 25 high) +// run `npm audit fix` to fix them, or `npm audit` for details + +const { log, output } = require('proc-log') +const { depth } = require('treeverse') +const ms = require('ms') +const npmAuditReport = require('npm-audit-report') +const { readTree: getFundingInfo } = require('libnpmfund') +const auditError = require('./audit-error.js') + +// TODO: output JSON if flatOptions.json is true +const reifyOutput = (npm, arb) => { + const { diff, actualTree } = arb + + // note: fails and crashes if we're running audit fix and there was an error + // which is a good thing, because there's no point printing all this other + // stuff in that case! + const auditReport = auditError(npm, arb.auditReport) ? null : arb.auditReport + + // don't print any info in --silent mode, but we still need to + // set the exitCode properly from the audit report, if we have one. + if (npm.silent) { + getAuditReport(npm, auditReport) + return + } + + const summary = { + added: 0, + removed: 0, + changed: 0, + audited: auditReport && !auditReport.error ? actualTree.inventory.size : 0, + funding: 0, + } + + if (diff) { + const showDiff = npm.config.get('dry-run') || npm.config.get('long') + const chalk = npm.chalk + + depth({ + tree: diff, + visit: d => { + switch (d.action) { + case 'REMOVE': + if (showDiff) { + /* eslint-disable-next-line max-len */ + output.standard(`${chalk.blue('remove')} ${d.actual.name} ${d.actual.package.version}`) + } + summary.removed++ + break + case 'ADD': + if (showDiff) { + output.standard(`${chalk.green('add')} ${d.ideal.name} ${d.ideal.package.version}`) + } + actualTree.inventory.has(d.ideal) && summary.added++ + break + case 'CHANGE': + if (showDiff) { + /* eslint-disable-next-line max-len */ + output.standard(`${chalk.cyan('change')} ${d.actual.name} ${d.actual.package.version} => ${d.ideal.package.version}`) + } + summary.changed++ + break + default: + return + } + const node = d.actual || d.ideal + log.silly(d.action, node.location) + }, + getChildren: d => d.children, + }) + } + + if (npm.flatOptions.fund) { + const fundingInfo = getFundingInfo(actualTree, { countOnly: true }) + summary.funding = fundingInfo.length + } + + if (npm.flatOptions.json) { + if (auditReport) { + // call this to set the exit code properly + getAuditReport(npm, auditReport) + summary.audit = npm.command === 'audit' ? auditReport + : auditReport.toJSON().metadata + } + output.buffer(summary) + } else { + packagesChangedMessage(npm, summary) + packagesFundingMessage(npm, summary) + printAuditReport(npm, auditReport) + } +} + +// if we're running `npm audit fix`, then we print the full audit report +// at the end if there's still stuff, because it's silly for `npm audit` +// to tell you to run `npm audit` for details. otherwise, use the summary +// report. if we get here, we know it's not quiet or json. +// If the loglevel is silent, then we just run the report +// to get the exitCode set appropriately. +const printAuditReport = (npm, report) => { + const res = getAuditReport(npm, report) + if (!res || !res.report) { + return + } + output.standard(`\n${res.report}`) +} + +const getAuditReport = (npm, report) => { + if (!report) { + return + } + + // when in silent mode, we print nothing. the JSON output is + // going to just JSON.stringify() the report object. + const reporter = npm.silent ? 'quiet' + : npm.flatOptions.json ? 'quiet' + : npm.command !== 'audit' ? 'install' + : 'detail' + const defaultAuditLevel = npm.command !== 'audit' ? 'none' : 'low' + const auditLevel = npm.flatOptions.auditLevel || defaultAuditLevel + + const res = npmAuditReport(report, { + reporter, + ...npm.flatOptions, + auditLevel, + chalk: npm.chalk, + }) + if (npm.command === 'audit') { + process.exitCode = process.exitCode || res.exitCode + } + return res +} + +const packagesChangedMessage = (npm, { added, removed, changed, audited }) => { + const msg = ['\n'] + if (added === 0 && removed === 0 && changed === 0) { + msg.push('up to date') + if (audited) { + msg.push(', ') + } + } else { + if (added) { + msg.push(`added ${added} package${added === 1 ? '' : 's'}`) + } + + if (removed) { + if (added) { + msg.push(', ') + } + + if (added && !audited && !changed) { + msg.push('and ') + } + + msg.push(`removed ${removed} package${removed === 1 ? '' : 's'}`) + } + if (changed) { + if (added || removed) { + msg.push(', ') + } + + if (!audited && (added || removed)) { + msg.push('and ') + } + + msg.push(`changed ${changed} package${changed === 1 ? '' : 's'}`) + } + if (audited) { + msg.push(', and ') + } + } + if (audited) { + msg.push(`audited ${audited} package${audited === 1 ? '' : 's'}`) + } + + msg.push(` in ${ms(Date.now() - npm.started)}`) + output.standard(msg.join('')) +} + +const packagesFundingMessage = (npm, { funding }) => { + if (!funding) { + return + } + + output.standard('') + const pkg = funding === 1 ? 'package' : 'packages' + const is = funding === 1 ? 'is' : 'are' + output.standard(`${funding} ${pkg} ${is} looking for funding`) + output.standard(' run `npm fund` for details') +} + +module.exports = reifyOutput diff --git a/node_modules/npm/lib/utils/sbom-cyclonedx.js b/node_modules/npm/lib/utils/sbom-cyclonedx.js new file mode 100644 index 00000000..f3bab280 --- /dev/null +++ b/node_modules/npm/lib/utils/sbom-cyclonedx.js @@ -0,0 +1,201 @@ +const crypto = require('node:crypto') +const normalizeData = require('normalize-package-data') +const parseLicense = require('spdx-expression-parse') +const npa = require('npm-package-arg') +const ssri = require('ssri') + +const CYCLONEDX_SCHEMA = 'http://cyclonedx.org/schema/bom-1.5.schema.json' +const CYCLONEDX_FORMAT = 'CycloneDX' +const CYCLONEDX_SCHEMA_VERSION = '1.5' + +const PROP_PATH = 'cdx:npm:package:path' +const PROP_BUNDLED = 'cdx:npm:package:bundled' +const PROP_DEVELOPMENT = 'cdx:npm:package:development' +const PROP_EXTRANEOUS = 'cdx:npm:package:extraneous' +const PROP_PRIVATE = 'cdx:npm:package:private' + +const REF_VCS = 'vcs' +const REF_WEBSITE = 'website' +const REF_ISSUE_TRACKER = 'issue-tracker' +const REF_DISTRIBUTION = 'distribution' + +const ALGO_MAP = { + sha1: 'SHA-1', + sha256: 'SHA-256', + sha384: 'SHA-384', + sha512: 'SHA-512', +} + +const cyclonedxOutput = ({ npm, nodes, packageType, packageLockOnly }) => { + const rootNode = nodes.find(node => node.isRoot) + const childNodes = nodes.filter(node => !node.isRoot && !node.isLink) + const uuid = crypto.randomUUID() + + const deps = [] + const seen = new Set() + for (let node of nodes) { + if (node.isLink) { + node = node.target + } + + if (seen.has(node)) { + continue + } + seen.add(node) + deps.push(toCyclonedxDependency(node, nodes)) + } + + const bom = { + $schema: CYCLONEDX_SCHEMA, + bomFormat: CYCLONEDX_FORMAT, + specVersion: CYCLONEDX_SCHEMA_VERSION, + serialNumber: `urn:uuid:${uuid}`, + version: 1, + metadata: { + timestamp: new Date().toISOString(), + lifecycles: [ + { phase: packageLockOnly ? 'pre-build' : 'build' }, + ], + tools: [ + { + vendor: 'npm', + name: 'cli', + version: npm.version, + }, + ], + component: toCyclonedxItem(rootNode, { packageType }), + }, + components: childNodes.map(toCyclonedxItem), + dependencies: deps, + } + + return bom +} + +const toCyclonedxItem = (node, { packageType }) => { + packageType = packageType || 'library' + + // Calculate purl from package spec + let spec = npa(node.pkgid) + spec = (spec.type === 'alias') ? spec.subSpec : spec + const purl = npa.toPurl(spec) + (isGitNode(node) ? `?vcs_url=${node.resolved}` : '') + + if (node.package) { + normalizeData(node.package) + } + + let parsedLicense + try { + let license = node.package?.license + if (license) { + if (typeof license === 'object') { + license = license.type + } + } + + parsedLicense = parseLicense(license) + } catch { + parsedLicense = null + } + + const component = { + 'bom-ref': toCyclonedxID(node), + type: packageType, + name: node.name, + version: node.version, + scope: (node.optional || node.devOptional) ? 'optional' : 'required', + author: (typeof node.package?.author === 'object') + ? node.package.author.name + : (node.package?.author || undefined), + description: node.package?.description || undefined, + purl: purl, + properties: [{ + name: PROP_PATH, + value: node.location, + }], + externalReferences: [], + } + + if (node.integrity) { + const integrity = ssri.parse(node.integrity, { single: true }) + component.hashes = [{ + alg: ALGO_MAP[integrity.algorithm] || /* istanbul ignore next */ 'SHA-512', + content: integrity.hexDigest(), + }] + } + + if (node.dev === true) { + component.properties.push(prop(PROP_DEVELOPMENT)) + } + + if (node.package?.private === true) { + component.properties.push(prop(PROP_PRIVATE)) + } + + if (node.extraneous === true) { + component.properties.push(prop(PROP_EXTRANEOUS)) + } + + if (node.inBundle === true) { + component.properties.push(prop(PROP_BUNDLED)) + } + + if (!node.isLink && node.resolved) { + component.externalReferences.push(extRef(REF_DISTRIBUTION, node.resolved)) + } + + if (node.package?.repository?.url) { + component.externalReferences.push(extRef(REF_VCS, node.package.repository.url)) + } + + if (node.package?.homepage) { + component.externalReferences.push(extRef(REF_WEBSITE, node.package.homepage)) + } + + if (node.package?.bugs?.url) { + component.externalReferences.push(extRef(REF_ISSUE_TRACKER, node.package.bugs.url)) + } + + // If license is a single SPDX license, use the license field + if (parsedLicense?.license) { + component.licenses = [{ license: { id: parsedLicense.license } }] + // If license is a conjunction, use the expression field + } else if (parsedLicense?.conjunction) { + component.licenses = [{ expression: node.package.license }] + } + + return component +} + +const toCyclonedxDependency = (node, nodes) => { + return { + ref: toCyclonedxID(node), + dependsOn: [...node.edgesOut.values()] + // Filter out edges that are linking to nodes not in the list + .filter(edge => nodes.find(n => n === edge.to)) + .map(edge => toCyclonedxID(edge.to)) + .filter(id => id), + } +} + +const toCyclonedxID = (node) => `${node.packageName}@${node.version}` + +const prop = (name) => ({ name, value: 'true' }) + +const extRef = (type, url) => ({ type, url }) + +const isGitNode = (node) => { + if (!node.resolved) { + return + } + + try { + const { type } = npa(node.resolved) + return type === 'git' || type === 'hosted' + } catch { + /* istanbul ignore next */ + return false + } +} + +module.exports = { cyclonedxOutput } diff --git a/node_modules/npm/lib/utils/sbom-spdx.js b/node_modules/npm/lib/utils/sbom-spdx.js new file mode 100644 index 00000000..16aed186 --- /dev/null +++ b/node_modules/npm/lib/utils/sbom-spdx.js @@ -0,0 +1,182 @@ + +const crypto = require('node:crypto') +const normalizeData = require('normalize-package-data') +const npa = require('npm-package-arg') +const ssri = require('ssri') + +const SPDX_SCHEMA_VERSION = 'SPDX-2.3' +const SPDX_DATA_LICENSE = 'CC0-1.0' +const SPDX_IDENTIFER = 'SPDXRef-DOCUMENT' + +const NO_ASSERTION = 'NOASSERTION' + +const REL_DESCRIBES = 'DESCRIBES' +const REL_PREREQ = 'PREREQUISITE_FOR' +const REL_OPTIONAL = 'OPTIONAL_DEPENDENCY_OF' +const REL_DEV = 'DEV_DEPENDENCY_OF' +const REL_DEP = 'DEPENDENCY_OF' + +const REF_CAT_PACKAGE_MANAGER = 'PACKAGE-MANAGER' +const REF_TYPE_PURL = 'purl' + +const spdxOutput = ({ npm, nodes, packageType }) => { + const rootNode = nodes.find(node => node.isRoot) + const childNodes = nodes.filter(node => !node.isRoot && !node.isLink) + const rootID = rootNode.pkgid + const uuid = crypto.randomUUID() + const ns = `http://spdx.org/spdxdocs/${npa(rootID).escapedName}-${rootNode.version}-${uuid}` + + const relationships = [] + const seen = new Set() + for (let node of nodes) { + if (node.isLink) { + node = node.target + } + + if (seen.has(node)) { + continue + } + seen.add(node) + + const rels = [...node.edgesOut.values()] + // Filter out edges that are linking to nodes not in the list + .filter(edge => nodes.find(n => n === edge.to)) + .map(edge => toSpdxRelationship(node, edge)) + .filter(rel => rel) + + relationships.push(...rels) + } + + const extraRelationships = nodes.filter(node => node.extraneous) + .map(node => toSpdxRelationship(rootNode, { to: node, type: 'optional' })) + + relationships.push(...extraRelationships) + + const bom = { + spdxVersion: SPDX_SCHEMA_VERSION, + dataLicense: SPDX_DATA_LICENSE, + SPDXID: SPDX_IDENTIFER, + name: rootID, + documentNamespace: ns, + creationInfo: { + created: new Date().toISOString(), + creators: [ + `Tool: npm/cli-${npm.version}`, + ], + }, + documentDescribes: [toSpdxID(rootNode)], + packages: [toSpdxItem(rootNode, { packageType }), ...childNodes.map(toSpdxItem)], + relationships: [ + { + spdxElementId: SPDX_IDENTIFER, + relatedSpdxElement: toSpdxID(rootNode), + relationshipType: REL_DESCRIBES, + }, + ...relationships, + ], + } + + return bom +} + +const toSpdxItem = (node, { packageType }) => { + normalizeData(node.package) + + // Calculate purl from package spec + let spec = npa(node.pkgid) + spec = (spec.type === 'alias') ? spec.subSpec : spec + const purl = npa.toPurl(spec) + (isGitNode(node) ? `?vcs_url=${node.resolved}` : '') + + /* For workspace nodes, use the location from their linkNode */ + let location = node.location + if (node.isWorkspace && node.linksIn.size > 0) { + location = node.linksIn.values().next().value.location + } + + let license = node.package?.license + if (license) { + if (typeof license === 'object') { + license = license.type + } + } + + const pkg = { + name: node.packageName, + SPDXID: toSpdxID(node), + versionInfo: node.version, + packageFileName: location, + description: node.package?.description || undefined, + primaryPackagePurpose: packageType ? packageType.toUpperCase() : undefined, + downloadLocation: (node.isLink ? undefined : node.resolved) || NO_ASSERTION, + filesAnalyzed: false, + homepage: node.package?.homepage || NO_ASSERTION, + licenseDeclared: license || NO_ASSERTION, + externalRefs: [ + { + referenceCategory: REF_CAT_PACKAGE_MANAGER, + referenceType: REF_TYPE_PURL, + referenceLocator: purl, + }, + ], + } + + if (node.integrity) { + const integrity = ssri.parse(node.integrity, { single: true }) + pkg.checksums = [{ + algorithm: integrity.algorithm.toUpperCase(), + checksumValue: integrity.hexDigest(), + }] + } + return pkg +} + +const toSpdxRelationship = (node, edge) => { + let type + switch (edge.type) { + case 'peer': + type = REL_PREREQ + break + case 'optional': + type = REL_OPTIONAL + break + case 'dev': + type = REL_DEV + break + default: + type = REL_DEP + } + + return { + spdxElementId: toSpdxID(edge.to), + relatedSpdxElement: toSpdxID(node), + relationshipType: type, + } +} + +const toSpdxID = (node) => { + let name = node.packageName + + // Strip leading @ for scoped packages + name = name.replace(/^@/, '') + + // Replace slashes with dots + name = name.replace(/\//g, '.') + + return `SPDXRef-Package-${name}-${node.version}` +} + +const isGitNode = (node) => { + if (!node.resolved) { + return + } + + try { + const { type } = npa(node.resolved) + return type === 'git' || type === 'hosted' + } catch { + /* istanbul ignore next */ + return false + } +} + +module.exports = { spdxOutput } diff --git a/node_modules/npm/lib/utils/tar.js b/node_modules/npm/lib/utils/tar.js new file mode 100644 index 00000000..63ef6067 --- /dev/null +++ b/node_modules/npm/lib/utils/tar.js @@ -0,0 +1,110 @@ +const tar = require('tar') +const ssri = require('ssri') +const { log, output } = require('proc-log') +const formatBytes = require('./format-bytes.js') +const localeCompare = require('@isaacs/string-locale-compare')('en', { + sensitivity: 'case', + numeric: true, +}) + +const logTar = (tarball, { unicode = false, json, key } = {}) => { + if (json) { + output.buffer(key == null ? tarball : { [key]: tarball }) + return + } + log.notice('') + log.notice('', `${unicode ? '📦 ' : 'package:'} ${tarball.name}@${tarball.version}`) + log.notice('Tarball Contents') + if (tarball.files.length) { + log.notice( + '', + tarball.files.map(f => + /^node_modules\//.test(f.path) ? null : `${formatBytes(f.size, false)} ${f.path}` + ).filter(f => f).join('\n') + ) + } + if (tarball.bundled.length) { + log.notice('Bundled Dependencies') + tarball.bundled.forEach(name => log.notice('', name)) + } + log.notice('Tarball Details') + log.notice('', `name: ${tarball.name}`) + log.notice('', `version: ${tarball.version}`) + if (tarball.filename) { + log.notice('', `filename: ${tarball.filename}`) + } + log.notice('', `package size: ${formatBytes(tarball.size)}`) + log.notice('', `unpacked size: ${formatBytes(tarball.unpackedSize)}`) + log.notice('', `shasum: ${tarball.shasum}`) + /* eslint-disable-next-line max-len */ + log.notice('', `integrity: ${tarball.integrity.toString().slice(0, 20)}[...]${tarball.integrity.toString().slice(80)}`) + if (tarball.bundled.length) { + log.notice('', `bundled deps: ${tarball.bundled.length}`) + log.notice('', `bundled files: ${tarball.entryCount - tarball.files.length}`) + log.notice('', `own files: ${tarball.files.length}`) + } + log.notice('', `total files: ${tarball.entryCount}`) + log.notice('', '') +} + +const getContents = async (manifest, tarball) => { + const files = [] + const bundled = new Set() + let totalEntries = 0 + let totalEntrySize = 0 + + // reads contents of tarball + const stream = tar.t({ + onentry (entry) { + totalEntries++ + totalEntrySize += entry.size + const p = entry.path + if (p.startsWith('package/node_modules/') && p !== 'package/node_modules/') { + const name = p.match(/^package\/node_modules\/((?:@[^/]+\/)?[^/]+)/)[1] + bundled.add(name) + } + files.push({ + path: entry.path.replace(/^package\//, ''), + size: entry.size, + mode: entry.mode, + }) + }, + }) + stream.end(tarball) + + const integrity = ssri.fromData(tarball, { + algorithms: ['sha1', 'sha512'], + }) + + const comparator = ({ path: a }, { path: b }) => localeCompare(a, b) + + const isUpper = str => { + const ch = str.charAt(0) + return ch === ch.toUpperCase() + } + + const uppers = files.filter(file => isUpper(file.path)) + const others = files.filter(file => !isUpper(file.path)) + + uppers.sort(comparator) + others.sort(comparator) + + const shasum = integrity.sha1[0].hexDigest() + return { + id: manifest._id || `${manifest.name}@${manifest.version}`, + name: manifest.name, + version: manifest.version, + size: tarball.length, + unpackedSize: totalEntrySize, + shasum, + integrity: ssri.parse(integrity.sha512[0]), + // @scope/packagename.tgz => scope-packagename.tgz + // we can safely use these global replace rules due to npm package naming rules + filename: `${manifest.name.replace('@', '').replace('/', '-')}-${manifest.version}.tgz`, + files: uppers.concat(others), + entryCount: totalEntries, + bundled: Array.from(bundled), + } +} + +module.exports = { logTar, getContents } diff --git a/node_modules/npm/lib/utils/timers.js b/node_modules/npm/lib/utils/timers.js new file mode 100644 index 00000000..16a25596 --- /dev/null +++ b/node_modules/npm/lib/utils/timers.js @@ -0,0 +1,89 @@ +const EE = require('node:events') +const fs = require('node:fs') +const { log, time } = require('proc-log') + +const INITIAL_TIMER = 'npm' + +class Timers extends EE { + #file + #timing + + #unfinished = new Map() + #finished = {} + + constructor () { + super() + this.on() + time.start(INITIAL_TIMER) + this.started = this.#unfinished.get(INITIAL_TIMER) + } + + on () { + process.on('time', this.#timeHandler) + } + + off () { + process.off('time', this.#timeHandler) + } + + load ({ path, timing } = {}) { + this.#timing = timing + this.#file = `${path}timing.json` + } + + finish (metadata) { + time.end(INITIAL_TIMER) + + for (const [name, timer] of this.#unfinished) { + log.silly('unfinished npm timer', name, timer) + } + + if (!this.#timing) { + // Not in timing mode, nothing else to do here + return + } + + try { + this.#writeFile(metadata) + log.info('timing', `Timing info written to: ${this.#file}`) + } catch (e) { + log.warn('timing', `could not write timing file: ${e}`) + } + } + + #writeFile (metadata) { + const globalStart = this.started + const globalEnd = this.#finished[INITIAL_TIMER] + const content = { + metadata, + timers: this.#finished, + // add any unfinished timers with their relative start/end + unfinishedTimers: [...this.#unfinished.entries()].reduce((acc, [name, start]) => { + acc[name] = [start - globalStart, globalEnd - globalStart] + return acc + }, {}), + } + fs.writeFileSync(this.#file, JSON.stringify(content) + '\n') + } + + #timeHandler = (level, name) => { + const now = Date.now() + switch (level) { + case time.KEYS.start: + this.#unfinished.set(name, now) + break + case time.KEYS.end: { + if (this.#unfinished.has(name)) { + const ms = now - this.#unfinished.get(name) + this.#finished[name] = ms + this.#unfinished.delete(name) + log.timing(name, `Completed in ${ms}ms`) + } else { + log.silly('timing', `Tried to end timer that doesn't exist: ${name}`) + } + } + } + } +} + +module.exports = Timers diff --git a/node_modules/npm/lib/utils/update-workspaces.js b/node_modules/npm/lib/utils/update-workspaces.js new file mode 100644 index 00000000..892f366e --- /dev/null +++ b/node_modules/npm/lib/utils/update-workspaces.js @@ -0,0 +1,40 @@ +'use strict' + +const reifyFinish = require('../utils/reify-finish.js') + +async function updateWorkspaces ({ + config, + flatOptions, + localPrefix, + npm, + workspaces, +}) { + if (!flatOptions.workspacesUpdate || !workspaces.length) { + return + } + + // default behavior is to not save by default in order to avoid + // race condition problems when publishing multiple workspaces + // that have dependencies on one another, it might still be useful + // in some cases, which then need to set --save + const save = config.isDefault('save') + ? false + : config.get('save') + + // runs a minimalistic reify update, targeting only the workspaces + // that had version updates and skipping fund/audit/save + const opts = { + ...flatOptions, + audit: false, + fund: false, + path: localPrefix, + save, + } + const Arborist = require('@npmcli/arborist') + const arb = new Arborist(opts) + + await arb.reify({ ...opts, update: workspaces }) + await reifyFinish(npm, arb) +} + +module.exports = updateWorkspaces diff --git a/node_modules/npm/lib/utils/validate-lockfile.js b/node_modules/npm/lib/utils/validate-lockfile.js new file mode 100644 index 00000000..29161ec5 --- /dev/null +++ b/node_modules/npm/lib/utils/validate-lockfile.js @@ -0,0 +1,29 @@ +// compares the inventory of package items in the tree +// that is about to be installed (idealTree) with the inventory +// of items stored in the package-lock file (virtualTree) +// +// Returns empty array if no errors found or an array populated +// with an entry for each validation error found. +function validateLockfile (virtualTree, idealTree) { + const errors = [] + + // loops through the inventory of packages resulted by ideal tree, + // for each package compares the versions with the version stored in the + // package-lock and adds an error to the list in case of mismatches + for (const [key, entry] of idealTree.entries()) { + const lock = virtualTree.get(key) + + if (!lock) { + errors.push(`Missing: ${entry.name}@${entry.version} from lock file`) + continue + } + + if (entry.version !== lock.version) { + errors.push(`Invalid: lock file's ${lock.name}@${lock.version} does ` + + `not satisfy ${entry.name}@${entry.version}`) + } + } + return errors +} + +module.exports = validateLockfile diff --git a/node_modules/npm/lib/utils/verify-signatures.js b/node_modules/npm/lib/utils/verify-signatures.js new file mode 100644 index 00000000..0a32742b --- /dev/null +++ b/node_modules/npm/lib/utils/verify-signatures.js @@ -0,0 +1,386 @@ +const npmFetch = require('npm-registry-fetch') +const localeCompare = require('@isaacs/string-locale-compare')('en') +const npa = require('npm-package-arg') +const pacote = require('pacote') +const tufClient = require('@sigstore/tuf') +const { log, output } = require('proc-log') + +const sortAlphabetically = (a, b) => localeCompare(a.name, b.name) + +class VerifySignatures { + constructor (tree, filterSet, npm, opts) { + this.tree = tree + this.filterSet = filterSet + this.npm = npm + this.opts = opts + this.keys = new Map() + this.invalid = [] + this.missing = [] + this.checkedPackages = new Set() + this.auditedWithKeysCount = 0 + this.verifiedSignatureCount = 0 + this.verifiedAttestationCount = 0 + this.exitCode = 0 + } + + async run () { + const start = process.hrtime.bigint() + const { default: pMap } = await import('p-map') + + // Find all deps in tree + const { edges, registries } = this.getEdgesOut(this.tree.inventory.values(), this.filterSet) + if (edges.size === 0) { + throw new Error('found no installed dependencies to audit') + } + + const tuf = await tufClient.initTUF({ + cachePath: this.opts.tufCache, + retry: this.opts.retry, + timeout: this.opts.timeout, + }) + await Promise.all([...registries].map(registry => this.setKeys({ registry, tuf }))) + + log.verbose('verifying registry signatures') + await pMap(edges, (e) => this.getVerifiedInfo(e), { concurrency: 20, stopOnError: true }) + + // Didn't find any dependencies that could be verified, e.g. only local + // deps, missing version, not on a registry etc. + if (!this.auditedWithKeysCount) { + throw new Error('found no dependencies to audit that were installed from ' + + 'a supported registry') + } + + const invalid = this.invalid.sort(sortAlphabetically) + const missing = this.missing.sort(sortAlphabetically) + + const hasNoInvalidOrMissing = invalid.length === 0 && missing.length === 0 + + if (!hasNoInvalidOrMissing) { + process.exitCode = 1 + } + + if (this.npm.config.get('json')) { + output.buffer({ invalid, missing }) + return + } + const end = process.hrtime.bigint() + const elapsed = end - start + + const auditedPlural = this.auditedWithKeysCount > 1 ? 's' : '' + const timing = `audited ${this.auditedWithKeysCount} package${auditedPlural} in ` + + `${Math.floor(Number(elapsed) / 1e9)}s` + output.standard(timing) + output.standard('') + + const verifiedBold = this.npm.chalk.bold('verified') + if (this.verifiedSignatureCount) { + if (this.verifiedSignatureCount === 1) { + /* eslint-disable-next-line max-len */ + output.standard(`${this.verifiedSignatureCount} package has a ${verifiedBold} registry signature`) + } else { + /* eslint-disable-next-line max-len */ + output.standard(`${this.verifiedSignatureCount} packages have ${verifiedBold} registry signatures`) + } + output.standard('') + } + + if (this.verifiedAttestationCount) { + if (this.verifiedAttestationCount === 1) { + /* eslint-disable-next-line max-len */ + output.standard(`${this.verifiedAttestationCount} package has a ${verifiedBold} attestation`) + } else { + /* eslint-disable-next-line max-len */ + output.standard(`${this.verifiedAttestationCount} packages have ${verifiedBold} attestations`) + } + output.standard('') + } + + if (missing.length) { + const missingClr = this.npm.chalk.redBright('missing') + if (missing.length === 1) { + /* eslint-disable-next-line max-len */ + output.standard(`1 package has a ${missingClr} registry signature but the registry is providing signing keys:`) + } else { + /* eslint-disable-next-line max-len */ + output.standard(`${missing.length} packages have ${missingClr} registry signatures but the registry is providing signing keys:`) + } + output.standard('') + missing.map(m => + output.standard(`${this.npm.chalk.red(`${m.name}@${m.version}`)} (${m.registry})`) + ) + } + + if (invalid.length) { + if (missing.length) { + output.standard('') + } + const invalidClr = this.npm.chalk.redBright('invalid') + // We can have either invalid signatures or invalid provenance + const invalidSignatures = this.invalid.filter(i => i.code === 'EINTEGRITYSIGNATURE') + if (invalidSignatures.length) { + if (invalidSignatures.length === 1) { + output.standard(`1 package has an ${invalidClr} registry signature:`) + } else { + /* eslint-disable-next-line max-len */ + output.standard(`${invalidSignatures.length} packages have ${invalidClr} registry signatures:`) + } + output.standard('') + invalidSignatures.map(i => + output.standard(`${this.npm.chalk.red(`${i.name}@${i.version}`)} (${i.registry})`) + ) + output.standard('') + } + + const invalidAttestations = this.invalid.filter(i => i.code === 'EATTESTATIONVERIFY') + if (invalidAttestations.length) { + if (invalidAttestations.length === 1) { + output.standard(`1 package has an ${invalidClr} attestation:`) + } else { + /* eslint-disable-next-line max-len */ + output.standard(`${invalidAttestations.length} packages have ${invalidClr} attestations:`) + } + output.standard('') + invalidAttestations.map(i => + output.standard(`${this.npm.chalk.red(`${i.name}@${i.version}`)} (${i.registry})`) + ) + output.standard('') + } + + if (invalid.length === 1) { + /* eslint-disable-next-line max-len */ + output.standard(`Someone might have tampered with this package since it was published on the registry!`) + } else { + /* eslint-disable-next-line max-len */ + output.standard(`Someone might have tampered with these packages since they were published on the registry!`) + } + output.standard('') + } + } + + getEdgesOut (nodes, filterSet) { + const edges = new Set() + const registries = new Set() + for (const node of nodes) { + for (const edge of node.edgesOut.values()) { + const filteredOut = + edge.from + && filterSet + && filterSet.size > 0 + && !filterSet.has(edge.from.target) + + if (!filteredOut) { + const spec = this.getEdgeSpec(edge) + if (spec) { + // Prefetch and cache public keys from used registries + registries.add(this.getSpecRegistry(spec)) + } + edges.add(edge) + } + } + } + return { edges, registries } + } + + async setKeys ({ registry, tuf }) { + const { host, pathname } = new URL(registry) + // Strip any trailing slashes from pathname + const regKey = `${host}${pathname.replace(/\/$/, '')}/keys.json` + let keys = await tuf.getTarget(regKey) + .then((target) => JSON.parse(target)) + .then(({ keys: ks }) => ks.map((key) => ({ + ...key, + keyid: key.keyId, + pemkey: `-----BEGIN PUBLIC KEY-----\n${key.publicKey.rawBytes}\n-----END PUBLIC KEY-----`, + expires: key.publicKey.validFor.end || null, + }))).catch(err => { + if (err.code === 'TUF_FIND_TARGET_ERROR') { + return null + } else { + throw err + } + }) + + // If keys not found in Sigstore TUF repo, fallback to registry keys API + if (!keys) { + keys = await npmFetch.json('/-/npm/v1/keys', { + ...this.npm.flatOptions, + registry, + }).then(({ keys: ks }) => ks.map((key) => ({ + ...key, + pemkey: `-----BEGIN PUBLIC KEY-----\n${key.key}\n-----END PUBLIC KEY-----`, + }))).catch(err => { + if (err.code === 'E404' || err.code === 'E400') { + return null + } else { + throw err + } + }) + } + + if (keys) { + this.keys.set(registry, keys) + } + } + + getEdgeType (edge) { + return edge.optional ? 'optionalDependencies' + : edge.peer ? 'peerDependencies' + : edge.dev ? 'devDependencies' + : 'dependencies' + } + + getEdgeSpec (edge) { + let name = edge.name + try { + name = npa(edge.spec).subSpec.name + } catch { + // leave it as edge.name + } + try { + return npa(`${name}@${edge.spec}`) + } catch { + // Skip packages with invalid spec + } + } + + buildRegistryConfig (registry) { + const keys = this.keys.get(registry) || [] + const parsedRegistry = new URL(registry) + const regKey = `//${parsedRegistry.host}${parsedRegistry.pathname}` + return { + [`${regKey}:_keys`]: keys, + } + } + + getSpecRegistry (spec) { + return npmFetch.pickRegistry(spec, this.npm.flatOptions) + } + + getValidPackageInfo (edge) { + const type = this.getEdgeType(edge) + // Skip potentially optional packages that are not on disk, as these could + // be omitted during install + if (edge.error === 'MISSING' && type !== 'dependencies') { + return + } + + const spec = this.getEdgeSpec(edge) + // Skip invalid version requirements + if (!spec) { + return + } + const node = edge.to || edge + const { version } = node.package || {} + + if (node.isWorkspace || // Skip local workspaces packages + !version || // Skip packages that don't have a installed version, e.g. optonal dependencies + !spec.registry) { // Skip if not from registry, e.g. git package + return + } + + for (const omitType of this.npm.config.get('omit')) { + if (node[omitType]) { + return + } + } + + return { + name: spec.name, + version, + type, + location: node.location, + registry: this.getSpecRegistry(spec), + } + } + + async verifySignatures (name, version, registry) { + const { + _integrity: integrity, + _signatures, + _attestations, + _resolved: resolved, + } = await pacote.manifest(`${name}@${version}`, { + verifySignatures: true, + verifyAttestations: true, + ...this.buildRegistryConfig(registry), + ...this.npm.flatOptions, + }) + const signatures = _signatures || [] + const result = { + integrity, + signatures, + attestations: _attestations, + resolved, + } + return result + } + + async getVerifiedInfo (edge) { + const info = this.getValidPackageInfo(edge) + if (!info) { + return + } + const { name, version, location, registry, type } = info + if (this.checkedPackages.has(location)) { + // we already did or are doing this one + return + } + this.checkedPackages.add(location) + + // We only "audit" or verify the signature, or the presence of it, on + // packages whose registry returns signing keys + const keys = this.keys.get(registry) || [] + if (keys.length) { + this.auditedWithKeysCount += 1 + } + + try { + const { integrity, signatures, attestations, resolved } = await this.verifySignatures( + name, version, registry + ) + + // Currently we only care about missing signatures on registries that provide a public key + // We could make this configurable in the future with a strict/paranoid mode + if (signatures.length) { + this.verifiedSignatureCount += 1 + } else if (keys.length) { + this.missing.push({ + integrity, + location, + name, + registry, + resolved, + version, + }) + } + + // Track verified attestations separately to registry signatures, as all + // packages on registries with signing keys are expected to have registry + // signatures, but not all packages have provenance and publish attestations. + if (attestations) { + this.verifiedAttestationCount += 1 + } + } catch (e) { + if (e.code === 'EINTEGRITYSIGNATURE' || e.code === 'EATTESTATIONVERIFY') { + this.invalid.push({ + code: e.code, + message: e.message, + integrity: e.integrity, + keyid: e.keyid, + location, + name, + registry, + resolved: e.resolved, + signature: e.signature, + predicateType: e.predicateType, + type, + version, + }) + } else { + throw e + } + } + } +} + +module.exports = VerifySignatures diff --git a/node_modules/npm/man/man1/npm-access.1 b/node_modules/npm/man/man1/npm-access.1 new file mode 100644 index 00000000..7352f706 --- /dev/null +++ b/node_modules/npm/man/man1/npm-access.1 @@ -0,0 +1,115 @@ +.TH "NPM-ACCESS" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-access\fR - Set access level on published packages +.SS "Synopsis" +.P +.RS 2 +.nf +npm access list packages \[lB]||\[rB] \[lB]\[rB] +npm access list collaborators \[lB] \[lB]\[rB]\[rB] +npm access get status \[lB]\[rB] +npm access set status=public|private \[lB]\[rB] +npm access set mfa=none|publish|automation \[lB]\[rB] +npm access grant \[lB]\[rB] +npm access revoke \[lB]\[rB] +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Used to set access controls on private packages. +.P +For all of the subcommands, \fBnpm access\fR will perform actions on the packages in the current working directory if no package name is passed to the subcommand. +.RS 0 +.IP \(bu 4 +public / restricted (deprecated): Set a package to be either publicly accessible or restricted. +.IP \(bu 4 +grant / revoke (deprecated): Add or remove the ability of users and teams to have read-only or read-write access to a package. +.IP \(bu 4 +2fa-required / 2fa-not-required (deprecated): Configure whether a package requires that anyone publishing it have two-factor authentication enabled on their account. +.IP \(bu 4 +ls-packages (deprecated): Show all of the packages a user or a team is able to access, along with the access level, except for read-only public packages (it won't print the whole registry listing) +.IP \(bu 4 +ls-collaborators (deprecated): Show all of the access privileges for a package. Will only show permissions for packages to which you have at least read access. If \fB\fR is passed in, the list is filtered only to teams \fIthat\fR user happens to belong to. +.IP \(bu 4 +edit (not implemented) +.RE 0 + +.SS "Details" +.P +\fBnpm access\fR always operates directly on the current registry, configurable from the command line using \fB--registry=\fR. +.P +Unscoped packages are \fIalways public\fR. +.P +Scoped packages \fIdefault to restricted\fR, but you can either publish them as public using \fBnpm publish --access=public\fR, or set their access as public using \fBnpm access public\fR after the initial publish. +.P +You must have privileges to set the access of a package: +.RS 0 +.IP \(bu 4 +You are an owner of an unscoped or scoped package. +.IP \(bu 4 +You are a member of the team that owns a scope. +.IP \(bu 4 +You have been given read-write privileges for a package, either as a member of a team or directly as an owner. +.RE 0 + +.P +If you have two-factor authentication enabled then you'll be prompted to provide a second factor, or may use the \fB--otp=...\fR option to specify it on the command line. +.P +If your account is not paid, then attempts to publish scoped packages will fail with an HTTP 402 status code (logically enough), unless you use \fB--access=public\fR. +.P +Management of teams and team memberships is done with the \fBnpm team\fR command. +.SS "Configuration" +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "See Also" +.RS 0 +.IP \(bu 4 +\fB\fBlibnpmaccess\fR\fR \fI\(lahttps://npm.im/libnpmaccess\(ra\fR +.IP \(bu 4 +npm help team +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help registry +.RE 0 diff --git a/node_modules/npm/man/man1/npm-adduser.1 b/node_modules/npm/man/man1/npm-adduser.1 new file mode 100644 index 00000000..283274b7 --- /dev/null +++ b/node_modules/npm/man/man1/npm-adduser.1 @@ -0,0 +1,91 @@ +.TH "NPM-ADDUSER" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-adduser\fR - Add a registry user account +.SS "Synopsis" +.P +.RS 2 +.nf +npm adduser + +alias: add-user +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Create a new user in the specified registry, and save the credentials to the \fB.npmrc\fR file. If no registry is specified, the default registry will be used (see npm help registry). +.P +When using \fBlegacy\fR for your \fBauth-type\fR, the username, password, and email are read in from prompts. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBscope\fR" +.RS 0 +.IP \(bu 4 +Default: the scope of the current project, if any, or "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Associate an operation with a scope for a scoped registry. +.P +Useful when logging in to or out of a private registry: +.P +.RS 2 +.nf +# log in, linking the scope to the custom registry +npm login --scope=@mycorp --registry=https://registry.mycorp.com + +# log out, removing the link and the auth token +npm logout --scope=@mycorp +.fi +.RE +.P +This will cause \fB@mycorp\fR to be mapped to the registry for future installation of packages specified according to the pattern \fB@mycorp/package\fR. +.P +This will also cause \fBnpm init\fR to create a scoped package. +.P +.RS 2 +.nf +# accept all defaults, and create a package named "@foo/whatever", +# instead of just named "whatever" +npm init --scope=@foo --yes +.fi +.RE +.SS "\fBauth-type\fR" +.RS 0 +.IP \(bu 4 +Default: "web" +.IP \(bu 4 +Type: "legacy" or "web" +.RE 0 + +.P +What authentication strategy to use with \fBlogin\fR. Note that if an \fBotp\fR config is given, this value will always be set to \fBlegacy\fR. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help owner +.IP \(bu 4 +npm help whoami +.IP \(bu 4 +npm help token +.IP \(bu 4 +npm help profile +.RE 0 diff --git a/node_modules/npm/man/man1/npm-audit.1 b/node_modules/npm/man/man1/npm-audit.1 new file mode 100644 index 00000000..39236214 --- /dev/null +++ b/node_modules/npm/man/man1/npm-audit.1 @@ -0,0 +1,448 @@ +.TH "NPM-AUDIT" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-audit\fR - Run a security audit +.SS "Synopsis" +.P +.RS 2 +.nf +npm audit \[lB]fix|signatures\[rB] +.fi +.RE +.SS "Description" +.P +The audit command submits a description of the dependencies configured in your project to your default registry and asks for a report of known vulnerabilities. If any vulnerabilities are found, then the impact and appropriate remediation will be calculated. If the \fBfix\fR argument is provided, then remediations will be applied to the package tree. +.P +The command will exit with a 0 exit code if no vulnerabilities were found. +.P +Note that some vulnerabilities cannot be fixed automatically and will require manual intervention or review. Also note that since \fBnpm audit +fix\fR runs a full-fledged \fBnpm install\fR under the hood, all configs that apply to the installer will also apply to \fBnpm install\fR -- so things like \fBnpm audit fix --package-lock-only\fR will work as expected. +.P +By default, the audit command will exit with a non-zero code if any vulnerability is found. It may be useful in CI environments to include the \fB--audit-level\fR parameter to specify the minimum vulnerability level that will cause the command to fail. This option does not filter the report output, it simply changes the command's failure threshold. +.SS "Package lock" +.P +By default npm requires a package-lock or shrinkwrap in order to run the audit. You can bypass the package lock with \fB--no-package-lock\fR but be aware the results may be different with every run, since npm will re-build the dependency tree each time. +.SS "Audit Signatures" +.P +To ensure the integrity of packages you download from the public npm registry, or any registry that supports signatures, you can verify the registry signatures of downloaded packages using the npm CLI. +.P +Registry signatures can be verified using the following \fBaudit\fR command: +.P +.RS 2 +.nf +$ npm audit signatures +.fi +.RE +.P +The \fBaudit signatures\fR command will also verify the provenance attestations of downloaded packages. Because provenance attestations are such a new feature, security features may be added to (or changed in) the attestation format over time. To ensure that you're always able to verify attestation signatures check that you're running the latest version of the npm CLI. Please note this often means updating npm beyond the version that ships with Node.js. +.P +The npm CLI supports registry signatures and signing keys provided by any registry if the following conventions are followed: +.RS 0 +.IP 1. 4 +Signatures are provided in the package's \fBpackument\fR in each published version within the \fBdist\fR object: +.RE 0 + +.P +.RS 2 +.nf +"dist":{ + "..omitted..": "..omitted..", + "signatures": \[lB]{ + "keyid": "SHA256:{{SHA256_PUBLIC_KEY}}", + "sig": "a312b9c3cb4a1b693e8ebac5ee1ca9cc01f2661c14391917dcb111517f72370809..." + }\[rB] +} +.fi +.RE +.P +See this \fBexample\fR \fI\(lahttps://registry.npmjs.org/light-cycle/1.4.3\(ra\fR of a signed package from the public npm registry. +.P +The \fBsig\fR is generated using the following template: \fB${package.name}@${package.version}:${package.dist.integrity}\fR and the \fBkeyid\fR has to match one of the public signing keys below. +.RS 0 +.IP 2. 4 +Public signing keys are provided at \fBregistry-host.tld/-/npm/v1/keys\fR in the following format: +.RE 0 + +.P +.RS 2 +.nf +{ + "keys": \[lB]{ + "expires": null, + "keyid": "SHA256:{{SHA256_PUBLIC_KEY}}", + "keytype": "ecdsa-sha2-nistp256", + "scheme": "ecdsa-sha2-nistp256", + "key": "{{B64_PUBLIC_KEY}}" + }\[rB] +} +.fi +.RE +.P +Keys response: +.RS 0 +.IP \(bu 4 +\fBexpires\fR: null or a simplified extended \fBISO 8601 format\fR \fI\(lahttps://en.wikipedia.org/wiki/ISO_8601\(ra\fR: \fBYYYY-MM-DDTHH:mm:ss.sssZ\fR +.IP \(bu 4 +\fBkeydid\fR: sha256 fingerprint of the public key +.IP \(bu 4 +\fBkeytype\fR: only \fBecdsa-sha2-nistp256\fR is currently supported by the npm CLI +.IP \(bu 4 +\fBscheme\fR: only \fBecdsa-sha2-nistp256\fR is currently supported by the npm CLI +.IP \(bu 4 +\fBkey\fR: base64 encoded public key +.RE 0 + +.P +See this \fBexample key's response from the public npm registry\fR \fI\(lahttps://registry.npmjs.org/-/npm/v1/keys\(ra\fR. +.SS "Audit Endpoints" +.P +There are two audit endpoints that npm may use to fetch vulnerability information: the \fBBulk Advisory\fR endpoint and the \fBQuick Audit\fR endpoint. +.SS "Bulk Advisory Endpoint" +.P +As of version 7, npm uses the much faster \fBBulk Advisory\fR endpoint to optimize the speed of calculating audit results. +.P +npm will generate a JSON payload with the name and list of versions of each package in the tree, and POST it to the default configured registry at the path \fB/-/npm/v1/security/advisories/bulk\fR. +.P +Any packages in the tree that do not have a \fBversion\fR field in their package.json file will be ignored. If any \fB--omit\fR options are specified (either via the \fB\fB--omit\fR config\fR \fI\(la/using-npm/config#omit\(ra\fR, or one of the shorthands such as \fB--production\fR, \fB--only=dev\fR, and so on), then packages will be omitted from the submitted payload as appropriate. +.P +If the registry responds with an error, or with an invalid response, then npm will attempt to load advisory data from the \fBQuick Audit\fR endpoint. +.P +The expected result will contain a set of advisory objects for each dependency that matches the advisory range. Each advisory object contains a \fBname\fR, \fBurl\fR, \fBid\fR, \fBseverity\fR, \fBvulnerable_versions\fR, and \fBtitle\fR. +.P +npm then uses these advisory objects to calculate vulnerabilities and meta-vulnerabilities of the dependencies within the tree. +.SS "Quick Audit Endpoint" +.P +If the \fBBulk Advisory\fR endpoint returns an error, or invalid data, npm will attempt to load advisory data from the \fBQuick Audit\fR endpoint, which is considerably slower in most cases. +.P +The full package tree as found in \fBpackage-lock.json\fR is submitted, along with the following pieces of additional metadata: +.RS 0 +.IP \(bu 4 +\fBnpm_version\fR +.IP \(bu 4 +\fBnode_version\fR +.IP \(bu 4 +\fBplatform\fR +.IP \(bu 4 +\fBarch\fR +.IP \(bu 4 +\fBnode_env\fR +.RE 0 + +.P +All packages in the tree are submitted to the Quick Audit endpoint. Omitted dependency types are skipped when generating the report. +.SS "Scrubbing" +.P +Out of an abundance of caution, npm versions 5 and 6 would "scrub" any packages from the submitted report if their name contained a \fB/\fR character, so as to avoid leaking the names of potentially private packages or git URLs. +.P +However, in practice, this resulted in audits often failing to properly detect meta-vulnerabilities, because the tree would appear to be invalid due to missing dependencies, and prevented the detection of vulnerabilities in package trees that used git dependencies or private modules. +.P +This scrubbing has been removed from npm as of version 7. +.SS "Calculating Meta-Vulnerabilities and Remediations" +.P +npm uses the \fB\fB@npmcli/metavuln-calculator\fR\fR \fI\(lahttp://npm.im/@npmcli/metavuln-calculator\(ra\fR module to turn a set of security advisories into a set of "vulnerability" objects. A "meta-vulnerability" is a dependency that is vulnerable by virtue of dependence on vulnerable versions of a vulnerable package. +.P +For example, if the package \fBfoo\fR is vulnerable in the range \fB>=1.0.2 +<2.0.0\fR, and the package \fBbar\fR depends on \fBfoo@^1.1.0\fR, then that version of \fBbar\fR can only be installed by installing a vulnerable version of \fBfoo\fR. In this case, \fBbar\fR is a "metavulnerability". +.P +Once metavulnerabilities for a given package are calculated, they are cached in the \fB~/.npm\fR folder and only re-evaluated if the advisory range changes, or a new version of the package is published (in which case, the new version is checked for metavulnerable status as well). +.P +If the chain of metavulnerabilities extends all the way to the root project, and it cannot be updated without changing its dependency ranges, then \fBnpm audit fix\fR will require the \fB--force\fR option to apply the remediation. If remediations do not require changes to the dependency ranges, then all vulnerable packages will be updated to a version that does not have an advisory or metavulnerability posted against it. +.SS "Exit Code" +.P +The \fBnpm audit\fR command will exit with a 0 exit code if no vulnerabilities were found. The \fBnpm audit fix\fR command will exit with 0 exit code if no vulnerabilities are found \fIor\fR if the remediation is able to successfully fix all vulnerabilities. +.P +If vulnerabilities were found the exit code will depend on the \fB\fBaudit-level\fR config\fR \fI\(la/using-npm/config#audit-level\(ra\fR. +.SS "Examples" +.P +Scan your project for vulnerabilities and automatically install any compatible updates to vulnerable dependencies: +.P +.RS 2 +.nf +$ npm audit fix +.fi +.RE +.P +Run \fBaudit fix\fR without modifying \fBnode_modules\fR, but still updating the pkglock: +.P +.RS 2 +.nf +$ npm audit fix --package-lock-only +.fi +.RE +.P +Skip updating \fBdevDependencies\fR: +.P +.RS 2 +.nf +$ npm audit fix --only=prod +.fi +.RE +.P +Have \fBaudit fix\fR install SemVer-major updates to toplevel dependencies, not just SemVer-compatible ones: +.P +.RS 2 +.nf +$ npm audit fix --force +.fi +.RE +.P +Do a dry run to get an idea of what \fBaudit fix\fR will do, and \fIalso\fR output install information in JSON format: +.P +.RS 2 +.nf +$ npm audit fix --dry-run --json +.fi +.RE +.P +Scan your project for vulnerabilities and just show the details, without fixing anything: +.P +.RS 2 +.nf +$ npm audit +.fi +.RE +.P +Get the detailed audit report in JSON format: +.P +.RS 2 +.nf +$ npm audit --json +.fi +.RE +.P +Fail an audit only if the results include a vulnerability with a level of moderate or higher: +.P +.RS 2 +.nf +$ npm audit --audit-level=moderate +.fi +.RE +.SS "Configuration" +.SS "\fBaudit-level\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null, "info", "low", "moderate", "high", "critical", or "none" +.RE 0 + +.P +The minimum level of vulnerability for \fBnpm audit\fR to exit with a non-zero exit code. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBforce\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input. +.RS 0 +.IP \(bu 4 +Allow clobbering non-npm files in global installs. +.IP \(bu 4 +Allow the \fBnpm version\fR command to work on an unclean git repository. +.IP \(bu 4 +Allow deleting the cache folder with \fBnpm cache clean\fR. +.IP \(bu 4 +Allow installing packages that have an \fBengines\fR declaration requiring a different version of npm. +.IP \(bu 4 +Allow installing packages that have an \fBengines\fR declaration requiring a different version of \fBnode\fR, even if \fB--engine-strict\fR is enabled. +.IP \(bu 4 +Allow \fBnpm audit fix\fR to install modules outside your stated dependency range (including SemVer-major changes). +.IP \(bu 4 +Allow unpublishing all versions of a published package. +.IP \(bu 4 +Allow conflicting peerDependencies to be installed in the root project. +.IP \(bu 4 +Implicitly set \fB--yes\fR during \fBnpm init\fR. +.IP \(bu 4 +Allow clobbering existing values in \fBnpm pkg\fR +.IP \(bu 4 +Allow unpublishing of entire packages (not just a single version). +.RE 0 + +.P +If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBpackage-lock-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, the current operation will only use the \fBpackage-lock.json\fR, ignoring \fBnode_modules\fR. +.P +For \fBupdate\fR this means only the \fBpackage-lock.json\fR will be updated, instead of checking \fBnode_modules\fR and downloading dependencies. +.P +For \fBlist\fR this means the output will be based on the tree described by the \fBpackage-lock.json\fR, rather than the contents of \fBnode_modules\fR. +.SS "\fBpackage-lock\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to false, then ignore \fBpackage-lock.json\fR files when installing. This will also prevent \fIwriting\fR \fBpackage-lock.json\fR if \fBsave\fR is true. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBforeground-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process. +.P +Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help config +.RE 0 diff --git a/node_modules/npm/man/man1/npm-bugs.1 b/node_modules/npm/man/man1/npm-bugs.1 new file mode 100644 index 00000000..a4cccc82 --- /dev/null +++ b/node_modules/npm/man/man1/npm-bugs.1 @@ -0,0 +1,115 @@ +.TH "NPM-BUGS" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-bugs\fR - Report bugs for a package in a web browser +.SS "Synopsis" +.P +.RS 2 +.nf +npm bugs \[lB] \[lB] ...\[rB]\[rB] + +alias: issues +.fi +.RE +.SS "Description" +.P +This command tries to guess at the likely location of a package's bug tracker URL or the \fBmailto\fR URL of the support email, and then tries to open it using the \fB\fB--browser\fR config\fR \fI\(la/using-npm/config#browser\(ra\fR param. If no package name is provided, it will search for a \fBpackage.json\fR in the current folder and use the \fBname\fR property. +.SS "Configuration" +.SS "\fBbrowser\fR" +.RS 0 +.IP \(bu 4 +Default: OS X: \fB"open"\fR, Windows: \fB"start"\fR, Others: \fB"xdg-open"\fR +.IP \(bu 4 +Type: null, Boolean, or String +.RE 0 + +.P +The browser that is called by npm commands to open websites. +.P +Set to \fBfalse\fR to suppress browser behavior and instead print urls to terminal. +.P +Set to \fBtrue\fR to use default system URL opener. +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help docs +.IP \(bu 4 +npm help view +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.RE 0 diff --git a/node_modules/npm/man/man1/npm-cache.1 b/node_modules/npm/man/man1/npm-cache.1 new file mode 100644 index 00000000..c1d5a37f --- /dev/null +++ b/node_modules/npm/man/man1/npm-cache.1 @@ -0,0 +1,78 @@ +.TH "NPM-CACHE" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-cache\fR - Manipulates packages cache +.SS "Synopsis" +.P +.RS 2 +.nf +npm cache add +npm cache clean \[lB]\[rB] +npm cache ls \[lB]@\[rB] +npm cache verify +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Used to add, list, or clean the npm cache folder. +.RS 0 +.IP \(bu 4 +add: Add the specified packages to the local cache. This command is primarily intended to be used internally by npm, but it can provide a way to add data to the local installation cache explicitly. +.IP \(bu 4 +clean: Delete all data out of the cache folder. Note that this is typically unnecessary, as npm's cache is self-healing and resistant to data corruption issues. +.IP \(bu 4 +verify: Verify the contents of the cache folder, garbage collecting any unneeded data, and verifying the integrity of the cache index and all cached data. +.RE 0 + +.SS "Details" +.P +npm stores cache data in an opaque directory within the configured \fBcache\fR, named \fB_cacache\fR. This directory is a \fB\fBcacache\fR\fR \fI\(lahttp://npm.im/cacache\(ra\fR-based content-addressable cache that stores all http request data as well as other package-related data. This directory is primarily accessed through \fBpacote\fR, the library responsible for all package fetching as of npm@5. +.P +All data that passes through the cache is fully verified for integrity on both insertion and extraction. Cache corruption will either trigger an error, or signal to \fBpacote\fR that the data must be refetched, which it will do automatically. For this reason, it should never be necessary to clear the cache for any reason other than reclaiming disk space, thus why \fBclean\fR now requires \fB--force\fR to run. +.P +There is currently no method exposed through npm to inspect or directly manage the contents of this cache. In order to access it, \fBcacache\fR must be used directly. +.P +npm will not remove data by itself: the cache will grow as new packages are installed. +.SS "A note about the cache's design" +.P +The npm cache is strictly a cache: it should not be relied upon as a persistent and reliable data store for package data. npm makes no guarantee that a previously-cached piece of data will be available later, and will automatically delete corrupted contents. The primary guarantee that the cache makes is that, if it does return data, that data will be exactly the data that was inserted. +.P +To run an offline verification of existing cache contents, use \fBnpm cache +verify\fR. +.SS "Configuration" +.SS "\fBcache\fR" +.RS 0 +.IP \(bu 4 +Default: Windows: \fB%LocalAppData%\[rs]npm-cache\fR, Posix: \fB~/.npm\fR +.IP \(bu 4 +Type: Path +.RE 0 + +.P +The location of npm's cache directory. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help pack +.IP \(bu 4 +https://npm.im/cacache +.IP \(bu 4 +https://npm.im/pacote +.IP \(bu 4 +https://npm.im/@npmcli/arborist +.IP \(bu 4 +https://npm.im/make-fetch-happen +.RE 0 diff --git a/node_modules/npm/man/man1/npm-ci.1 b/node_modules/npm/man/man1/npm-ci.1 new file mode 100644 index 00000000..5eb18d43 --- /dev/null +++ b/node_modules/npm/man/man1/npm-ci.1 @@ -0,0 +1,289 @@ +.TH "NPM-CI" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-ci\fR - Clean install a project +.SS "Synopsis" +.P +.RS 2 +.nf +npm ci + +aliases: clean-install, ic, install-clean, isntall-clean +.fi +.RE +.SS "Description" +.P +This command is similar to npm help install, except it's meant to be used in automated environments such as test platforms, continuous integration, and deployment -- or any situation where you want to make sure you're doing a clean install of your dependencies. +.P +The main differences between using \fBnpm install\fR and \fBnpm ci\fR are: +.RS 0 +.IP \(bu 4 +The project \fBmust\fR have an existing \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR. +.IP \(bu 4 +If dependencies in the package lock do not match those in \fBpackage.json\fR, \fBnpm ci\fR will exit with an error, instead of updating the package lock. +.IP \(bu 4 +\fBnpm ci\fR can only install entire projects at a time: individual dependencies cannot be added with this command. +.IP \(bu 4 +If a \fBnode_modules\fR is already present, it will be automatically removed before \fBnpm ci\fR begins its install. +.IP \(bu 4 +It will never write to \fBpackage.json\fR or any of the package-locks: installs are essentially frozen. +.RE 0 + +.P +NOTE: If you create your \fBpackage-lock.json\fR file by running \fBnpm install\fR with flags that can affect the shape of your dependency tree, such as \fB--legacy-peer-deps\fR or \fB--install-links\fR, you \fImust\fR provide the same flags to \fBnpm ci\fR or you are likely to encounter errors. An easy way to do this is to run, for example, \fBnpm config set legacy-peer-deps=true --location=project\fR and commit the \fB.npmrc\fR file to your repo. +.SS "Example" +.P +Make sure you have a package-lock and an up-to-date install: +.P +.RS 2 +.nf +$ cd ./my/npm/project +$ npm install +added 154 packages in 10s +$ ls | grep package-lock +.fi +.RE +.P +Run \fBnpm ci\fR in that project +.P +.RS 2 +.nf +$ npm ci +added 154 packages in 5s +.fi +.RE +.P +Configure Travis CI to build using \fBnpm ci\fR instead of \fBnpm install\fR: +.P +.RS 2 +.nf +# .travis.yml +install: +- npm ci +# keep the npm cache around to speed up installs +cache: + directories: + - "$HOME/.npm" +.fi +.RE +.SS "Configuration" +.SS "\fBinstall-strategy\fR" +.RS 0 +.IP \(bu 4 +Default: "hoisted" +.IP \(bu 4 +Type: "hoisted", "nested", "shallow", or "linked" +.RE 0 + +.P +Sets the strategy for installing packages in node_modules. hoisted (default): Install non-duplicated in top-level, and duplicated as necessary within directory structure. nested: (formerly --legacy-bundling) install in place, no hoisting. shallow (formerly --global-style) only install direct deps at top-level. linked: (experimental) install in node_modules/.store, link in place, unhoisted. +.SS "\fBlegacy-bundling\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=nested\fR +.RE 0 + +.P +Instead of hoisting package installs in \fBnode_modules\fR, install packages in the same manner that they are depended on. This may cause very deep directory structures and duplicate package installs as there is no de-duplicating. Sets \fB--install-strategy=nested\fR. +.SS "\fBglobal-style\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=shallow\fR +.RE 0 + +.P +Only install direct dependencies in the top level \fBnode_modules\fR, but hoist on deeper dependencies. Sets \fB--install-strategy=shallow\fR. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBstrict-peer-deps\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to \fBtrue\fR, and \fB--legacy-peer-deps\fR is not set, then \fIany\fR conflicting \fBpeerDependencies\fR will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships. +.P +By default, conflicting \fBpeerDependencies\fR deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's \fBpeerDependencies\fR object. +.P +When such an override is performed, a warning is printed, explaining the conflict and the packages involved. If \fB--strict-peer-deps\fR is set, then this warning is treated as a failure. +.SS "\fBforeground-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process. +.P +Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBaudit\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for npm help audit for details on what is submitted. +.SS "\fBbin-links\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables. +.P +Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. +.SS "\fBfund\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" displays the message at the end of each \fBnpm install\fR acknowledging the number of dependencies looking for funding. See npm help fund for details. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help install +.IP \(bu 4 +\fBpackage-lock.json\fR \fI\(la/configuring-npm/package-lock-json\(ra\fR +.RE 0 diff --git a/node_modules/npm/man/man1/npm-completion.1 b/node_modules/npm/man/man1/npm-completion.1 new file mode 100644 index 00000000..260445e8 --- /dev/null +++ b/node_modules/npm/man/man1/npm-completion.1 @@ -0,0 +1,35 @@ +.TH "NPM-COMPLETION" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-completion\fR - Tab Completion for npm +.SS "Synopsis" +.P +.RS 2 +.nf +npm completion +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Enables tab-completion in all npm commands. +.P +The synopsis above loads the completions into your current shell. Adding it to your ~/.bashrc or ~/.zshrc will make the completions available everywhere: +.P +.RS 2 +.nf +npm completion >> ~/.bashrc +npm completion >> ~/.zshrc +.fi +.RE +.P +You may of course also pipe the output of \fBnpm completion\fR to a file such as \fB/usr/local/etc/bash_completion.d/npm\fR or \fB/etc/bash_completion.d/npm\fR if you have a system that will read that file for you. +.P +When \fBCOMP_CWORD\fR, \fBCOMP_LINE\fR, and \fBCOMP_POINT\fR are defined in the environment, \fBnpm completion\fR acts in "plumbing mode", and outputs completions based on the arguments. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help developers +.IP \(bu 4 +npm help npm +.RE 0 diff --git a/node_modules/npm/man/man1/npm-config.1 b/node_modules/npm/man/man1/npm-config.1 new file mode 100644 index 00000000..11461b0e --- /dev/null +++ b/node_modules/npm/man/man1/npm-config.1 @@ -0,0 +1,187 @@ +.TH "NPM-CONFIG" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-config\fR - Manage the npm configuration files +.SS "Synopsis" +.P +.RS 2 +.nf +npm config set = \[lB]= ...\[rB] +npm config get \[lB] \[lB] ...\[rB]\[rB] +npm config delete \[lB] ...\[rB] +npm config list \[lB]--json\[rB] +npm config edit +npm config fix + +alias: c +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +npm gets its config settings from the command line, environment variables, \fBnpmrc\fR files, and in some cases, the \fBpackage.json\fR file. +.P +See npm help npmrc for more information about the npmrc files. +.P +See npm help config for a more thorough explanation of the mechanisms involved, and a full list of config options available. +.P +The \fBnpm config\fR command can be used to update and edit the contents of the user and global npmrc files. +.SS "Sub-commands" +.P +Config supports the following sub-commands: +.SS "set" +.P +.RS 2 +.nf +npm config set key=value \[lB]key=value...\[rB] +npm set key=value \[lB]key=value...\[rB] +.fi +.RE +.P +Sets each of the config keys to the value provided. Modifies the user configuration file unless \fB\fBlocation\fR\fR \fI\(la/commands/npm-config#location\(ra\fR is passed. +.P +If value is omitted, the key will be removed from your config file entirely. +.P +Note: for backwards compatibility, \fBnpm config set key value\fR is supported as an alias for \fBnpm config set key=value\fR. +.SS "get" +.P +.RS 2 +.nf +npm config get \[lB]key ...\[rB] +npm get \[lB]key ...\[rB] +.fi +.RE +.P +Echo the config value(s) to stdout. +.P +If multiple keys are provided, then the values will be prefixed with the key names. +.P +If no keys are provided, then this command behaves the same as \fBnpm config +list\fR. +.SS "list" +.P +.RS 2 +.nf +npm config list +.fi +.RE +.P +Show all the config settings. Use \fB-l\fR to also show defaults. Use \fB--json\fR to show the settings in json format. +.SS "delete" +.P +.RS 2 +.nf +npm config delete key \[lB]key ...\[rB] +.fi +.RE +.P +Deletes the specified keys from all configuration files. +.SS "edit" +.P +.RS 2 +.nf +npm config edit +.fi +.RE +.P +Opens the config file in an editor. Use the \fB--global\fR flag to edit the global config. +.SS "fix" +.P +.RS 2 +.nf +npm config fix +.fi +.RE +.P +Attempts to repair invalid configuration items. Usually this means attaching authentication config (i.e. \fB_auth\fR, \fB_authToken\fR) to the configured \fBregistry\fR. +.SS "Configuration" +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBeditor\fR" +.RS 0 +.IP \(bu 4 +Default: The EDITOR or VISUAL environment variables, or '%SYSTEMROOT%\[rs]notepad.exe' on Windows, or 'vi' on Unix systems +.IP \(bu 4 +Type: String +.RE 0 + +.P +The command to run for \fBnpm edit\fR and \fBnpm config edit\fR. +.SS "\fBlocation\fR" +.RS 0 +.IP \(bu 4 +Default: "user" unless \fB--global\fR is passed, which will also set this value to "global" +.IP \(bu 4 +Type: "global", "user", or "project" +.RE 0 + +.P +When passed to \fBnpm config\fR this refers to which config file to use. +.P +When set to "global" mode, packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBlong\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Show extended information in \fBls\fR, \fBsearch\fR, and \fBhelp-search\fR. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help config +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help npm +.RE 0 diff --git a/node_modules/npm/man/man1/npm-dedupe.1 b/node_modules/npm/man/man1/npm-dedupe.1 new file mode 100644 index 00000000..47539800 --- /dev/null +++ b/node_modules/npm/man/man1/npm-dedupe.1 @@ -0,0 +1,290 @@ +.TH "NPM-DEDUPE" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-dedupe\fR - Reduce duplication in the package tree +.SS "Synopsis" +.P +.RS 2 +.nf +npm dedupe + +alias: ddp +.fi +.RE +.SS "Description" +.P +Searches the local package tree and attempts to simplify the overall structure by moving dependencies further up the tree, where they can be more effectively shared by multiple dependent packages. +.P +For example, consider this dependency graph: +.P +.RS 2 +.nf +a ++-- b <-- depends on c@1.0.x +| `-- c@1.0.3 +`-- d <-- depends on c@~1.0.9 + `-- c@1.0.10 +.fi +.RE +.P +In this case, \fBnpm dedupe\fR will transform the tree to: +.P +.RS 2 +.nf +a ++-- b ++-- d +`-- c@1.0.10 +.fi +.RE +.P +Because of the hierarchical nature of node's module lookup, b and d will both get their dependency met by the single c package at the root level of the tree. +.P +In some cases, you may have a dependency graph like this: +.P +.RS 2 +.nf +a ++-- b <-- depends on c@1.0.x ++-- c@1.0.3 +`-- d <-- depends on c@1.x + `-- c@1.9.9 +.fi +.RE +.P +During the installation process, the \fBc@1.0.3\fR dependency for \fBb\fR was placed in the root of the tree. Though \fBd\fR's dependency on \fBc@1.x\fR could have been satisfied by \fBc@1.0.3\fR, the newer \fBc@1.9.0\fR dependency was used, because npm favors updates by default, even when doing so causes duplication. +.P +Running \fBnpm dedupe\fR will cause npm to note the duplication and re-evaluate, deleting the nested \fBc\fR module, because the one in the root is sufficient. +.P +To prefer deduplication over novelty during the installation process, run \fBnpm install --prefer-dedupe\fR or \fBnpm config set prefer-dedupe true\fR. +.P +Arguments are ignored. Dedupe always acts on the entire tree. +.P +Note that this operation transforms the dependency tree, but will never result in new modules being installed. +.P +Using \fBnpm find-dupes\fR will run the command in \fB--dry-run\fR mode. +.P +Note: \fBnpm dedupe\fR will never update the semver values of direct dependencies in your project \fBpackage.json\fR, if you want to update values in \fBpackage.json\fR you can run: \fBnpm update --save\fR instead. +.SS "Configuration" +.SS "\fBinstall-strategy\fR" +.RS 0 +.IP \(bu 4 +Default: "hoisted" +.IP \(bu 4 +Type: "hoisted", "nested", "shallow", or "linked" +.RE 0 + +.P +Sets the strategy for installing packages in node_modules. hoisted (default): Install non-duplicated in top-level, and duplicated as necessary within directory structure. nested: (formerly --legacy-bundling) install in place, no hoisting. shallow (formerly --global-style) only install direct deps at top-level. linked: (experimental) install in node_modules/.store, link in place, unhoisted. +.SS "\fBlegacy-bundling\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=nested\fR +.RE 0 + +.P +Instead of hoisting package installs in \fBnode_modules\fR, install packages in the same manner that they are depended on. This may cause very deep directory structures and duplicate package installs as there is no de-duplicating. Sets \fB--install-strategy=nested\fR. +.SS "\fBglobal-style\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=shallow\fR +.RE 0 + +.P +Only install direct dependencies in the top level \fBnode_modules\fR, but hoist on deeper dependencies. Sets \fB--install-strategy=shallow\fR. +.SS "\fBstrict-peer-deps\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to \fBtrue\fR, and \fB--legacy-peer-deps\fR is not set, then \fIany\fR conflicting \fBpeerDependencies\fR will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships. +.P +By default, conflicting \fBpeerDependencies\fR deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's \fBpeerDependencies\fR object. +.P +When such an override is performed, a warning is printed, explaining the conflict and the packages involved. If \fB--strict-peer-deps\fR is set, then this warning is treated as a failure. +.SS "\fBpackage-lock\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to false, then ignore \fBpackage-lock.json\fR files when installing. This will also prevent \fIwriting\fR \fBpackage-lock.json\fR if \fBsave\fR is true. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBaudit\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for npm help audit for details on what is submitted. +.SS "\fBbin-links\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables. +.P +Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. +.SS "\fBfund\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" displays the message at the end of each \fBnpm install\fR acknowledging the number of dependencies looking for funding. See npm help fund for details. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help find-dupes +.IP \(bu 4 +npm help ls +.IP \(bu 4 +npm help update +.IP \(bu 4 +npm help install +.RE 0 diff --git a/node_modules/npm/man/man1/npm-deprecate.1 b/node_modules/npm/man/man1/npm-deprecate.1 new file mode 100644 index 00000000..80ff5023 --- /dev/null +++ b/node_modules/npm/man/man1/npm-deprecate.1 @@ -0,0 +1,73 @@ +.TH "NPM-DEPRECATE" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-deprecate\fR - Deprecate a version of a package +.SS "Synopsis" +.P +.RS 2 +.nf +npm deprecate +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +This command will update the npm registry entry for a package, providing a deprecation warning to all who attempt to install it. +.P +It works on \fBversion ranges\fR \fI\(lahttps://semver.npmjs.com/\(ra\fR as well as specific versions, so you can do something like this: +.P +.RS 2 +.nf +npm deprecate my-thing@"< 0.2.3" "critical bug fixed in v0.2.3" +.fi +.RE +.P +SemVer ranges passed to this command are interpreted such that they \fIdo\fR include prerelease versions. For example: +.P +.RS 2 +.nf +npm deprecate my-thing@1.x "1.x is no longer supported" +.fi +.RE +.P +In this case, a version \fBmy-thing@1.0.0-beta.0\fR will also be deprecated. +.P +You must be the package owner to deprecate something. See the \fBowner\fR and \fBadduser\fR help topics. +.P +To un-deprecate a package, specify an empty string (\fB""\fR) for the \fBmessage\fR argument. Note that you must use double quotes with no space between them to format an empty string. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help owner +.IP \(bu 4 +npm help adduser +.RE 0 diff --git a/node_modules/npm/man/man1/npm-diff.1 b/node_modules/npm/man/man1/npm-diff.1 new file mode 100644 index 00000000..442ea98f --- /dev/null +++ b/node_modules/npm/man/man1/npm-diff.1 @@ -0,0 +1,310 @@ +.TH "NPM-DIFF" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-diff\fR - The registry diff command +.SS "Synopsis" +.P +.RS 2 +.nf +npm diff \[lB]...\[rB] +.fi +.RE +.SS "Description" +.P +Similar to its \fBgit diff\fR counterpart, this command will print diff patches of files for packages published to the npm registry. +.RS 0 +.IP \(bu 4 +\fBnpm diff --diff= --diff=\fR +.P +Compares two package versions using their registry specifiers, e.g: \fBnpm diff --diff=pkg@1.0.0 --diff=pkg@^2.0.0\fR. It's also possible to compare across forks of any package, e.g: \fBnpm diff --diff=pkg@1.0.0 --diff=pkg-fork@1.0.0\fR. +.P +Any valid spec can be used, so that it's also possible to compare directories or git repositories, e.g: \fBnpm diff --diff=pkg@latest --diff=./packages/pkg\fR +.P +Here's an example comparing two different versions of a package named \fBabbrev\fR from the registry: +.P +.RS 2 +.nf +npm diff --diff=abbrev@1.1.0 --diff=abbrev@1.1.1 +.fi +.RE +.P +On success, output looks like: +.P +.RS 2 +.nf +diff --git a/package.json b/package.json +index v1.1.0..v1.1.1 100644 +--- a/package.json ++++ b/package.json +@@ -1,6 +1,6 @@ + { + "name": "abbrev", +- "version": "1.1.0", ++ "version": "1.1.1", + "description": "Like ruby's abbrev module, but in js", + "author": "Isaac Z. Schlueter ", + "main": "abbrev.js", +.fi +.RE +.P +Given the flexible nature of npm specs, you can also target local directories or git repos just like when using \fBnpm install\fR: +.P +.RS 2 +.nf +npm diff --diff=https://github.com/npm/libnpmdiff --diff=./local-path +.fi +.RE +.P +In the example above we can compare the contents from the package installed from the git repo at \fBgithub.com/npm/libnpmdiff\fR with the contents of the \fB./local-path\fR that contains a valid package, such as a modified copy of the original. +.IP \(bu 4 +\fBnpm diff\fR (in a package directory, no arguments): +.P +If the package is published to the registry, \fBnpm diff\fR will fetch the tarball version tagged as \fBlatest\fR (this value can be configured using the \fBtag\fR option) and proceed to compare the contents of files present in that tarball, with the current files in your local file system. +.P +This workflow provides a handy way for package authors to see what package-tracked files have been changed in comparison with the latest published version of that package. +.IP \(bu 4 +\fBnpm diff --diff=\fR (in a package directory): +.P +When using a single package name (with no version or tag specifier) as an argument, \fBnpm diff\fR will work in a similar way to \fB\fBnpm-outdated\fR\fR \fI\(lanpm-outdated\(ra\fR and reach for the registry to figure out what current published version of the package named \fB\fR will satisfy its dependent declared semver-range. Once that specific version is known \fBnpm diff\fR will print diff patches comparing the current version of \fB\fR found in the local file system with that specific version returned by the registry. +.P +Given a package named \fBabbrev\fR that is currently installed: +.P +.RS 2 +.nf +npm diff --diff=abbrev +.fi +.RE +.P +That will request from the registry its most up to date version and will print a diff output comparing the currently installed version to this newer one if the version numbers are not the same. +.IP \(bu 4 +\fBnpm diff --diff=\fR (in a package directory): +.P +Similar to using only a single package name, it's also possible to declare a full registry specifier version if you wish to compare the local version of an installed package with the specific version/tag/semver-range provided in \fB\fR. +.P +An example: assuming \fBpkg@1.0.0\fR is installed in the current \fBnode_modules\fR folder, running: +.P +.RS 2 +.nf +npm diff --diff=pkg@2.0.0 +.fi +.RE +.P +It will effectively be an alias to \fBnpm diff --diff=pkg@1.0.0 --diff=pkg@2.0.0\fR. +.IP \(bu 4 +\fBnpm diff --diff= \[lB]--diff=\[rB]\fR (in a package directory): +.P +Using \fBnpm diff\fR along with semver-valid version numbers is a shorthand to compare different versions of the current package. +.P +It needs to be run from a package directory, such that for a package named \fBpkg\fR running \fBnpm diff --diff=1.0.0 --diff=1.0.1\fR is the same as running \fBnpm diff --diff=pkg@1.0.0 --diff=pkg@1.0.1\fR. +.P +If only a single argument \fB\fR is provided, then the current local file system is going to be compared against that version. +.P +Here's an example comparing two specific versions (published to the configured registry) of the current project directory: +.P +.RS 2 +.nf +npm diff --diff=1.0.0 --diff=1.1.0 +.fi +.RE +.RE 0 + +.P +Note that tag names are not valid \fB--diff\fR argument values, if you wish to compare to a published tag, you must use the \fBpkg@tagname\fR syntax. +.SS "Filtering files" +.P +It's possible to also specify positional arguments using file names or globs pattern matching in order to limit the result of diff patches to only a subset of files for a given package, e.g: +.P +.RS 2 +.nf +npm diff --diff=pkg@2 ./lib/ CHANGELOG.md +.fi +.RE +.P +In the example above the diff output is only going to print contents of files located within the folder \fB./lib/\fR and changed lines of code within the \fBCHANGELOG.md\fR file. +.SS "Configuration" +.SS "\fBdiff\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Define arguments to compare in \fBnpm diff\fR. +.SS "\fBdiff-name-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Prints only filenames when using \fBnpm diff\fR. +.SS "\fBdiff-unified\fR" +.RS 0 +.IP \(bu 4 +Default: 3 +.IP \(bu 4 +Type: Number +.RE 0 + +.P +The number of lines of context to print in \fBnpm diff\fR. +.SS "\fBdiff-ignore-all-space\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Ignore whitespace when comparing lines in \fBnpm diff\fR. +.SS "\fBdiff-no-prefix\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Do not show any source or destination prefix in \fBnpm diff\fR output. +.P +Note: this causes \fBnpm diff\fR to ignore the \fB--diff-src-prefix\fR and \fB--diff-dst-prefix\fR configs. +.SS "\fBdiff-src-prefix\fR" +.RS 0 +.IP \(bu 4 +Default: "a/" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Source prefix to be used in \fBnpm diff\fR output. +.SS "\fBdiff-dst-prefix\fR" +.RS 0 +.IP \(bu 4 +Default: "b/" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Destination prefix to be used in \fBnpm diff\fR output. +.SS "\fBdiff-text\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Treat all files as text in \fBnpm diff\fR. +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBtag\fR" +.RS 0 +.IP \(bu 4 +Default: "latest" +.IP \(bu 4 +Type: String +.RE 0 + +.P +If you ask npm to install a package and don't tell it a specific version, then it will install the specified tag. +.P +It is the tag added to the package@version specified in the \fBnpm dist-tag +add\fR command, if no explicit tag is given. +.P +When used by the \fBnpm diff\fR command, this is the tag used to fetch the tarball that will be compared with the local files by default. +.P +If used in the \fBnpm publish\fR command, this is the tag that will be added to the package submitted to the registry. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SH "SEE ALSO" +.RS 0 +.IP \(bu 4 +npm help outdated +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help registry +.RE 0 diff --git a/node_modules/npm/man/man1/npm-dist-tag.1 b/node_modules/npm/man/man1/npm-dist-tag.1 new file mode 100644 index 00000000..83989172 --- /dev/null +++ b/node_modules/npm/man/man1/npm-dist-tag.1 @@ -0,0 +1,144 @@ +.TH "NPM-DIST-TAG" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-dist-tag\fR - Modify package distribution tags +.SS "Synopsis" +.P +.RS 2 +.nf +npm dist-tag add \[lB]\[rB] +npm dist-tag rm +npm dist-tag ls \[lB]\[rB] + +alias: dist-tags +.fi +.RE +.SS "Description" +.P +Add, remove, and enumerate distribution tags on a package: +.RS 0 +.IP \(bu 4 +add: Tags the specified version of the package with the specified tag, or the \fB\fB--tag\fR config\fR \fI\(la/using-npm/config#tag\(ra\fR if not specified. If you have two-factor authentication on auth-and-writes then you\[cq]ll need to include a one-time password on the command line with \fB--otp \fR, or go through a second factor flow based on your \fBauthtype\fR. +.IP \(bu 4 +rm: Clear a tag that is no longer in use from the package. If you have two-factor authentication on auth-and-writes then you\[cq]ll need to include a one-time password on the command line with \fB--otp \fR, or go through a second factor flow based on your \fBauthtype\fR +.IP \(bu 4 +ls: Show all of the dist-tags for a package, defaulting to the package in the current prefix. This is the default action if none is specified. +.RE 0 + +.P +A tag can be used when installing packages as a reference to a version instead of using a specific version number: +.P +.RS 2 +.nf +npm install @ +.fi +.RE +.P +When installing dependencies, a preferred tagged version may be specified: +.P +.RS 2 +.nf +npm install --tag +.fi +.RE +.P +(This also applies to any other commands that resolve and install dependencies, such as \fBnpm dedupe\fR, \fBnpm update\fR, and \fBnpm audit fix\fR.) +.P +Publishing a package sets the \fBlatest\fR tag to the published version unless the \fB--tag\fR option is used. For example, \fBnpm publish --tag=beta\fR. +.P +By default, \fBnpm install \fR (without any \fB@\fR or \fB@\fR specifier) installs the \fBlatest\fR tag. +.SS "Purpose" +.P +Tags can be used to provide an alias instead of version numbers. +.P +For example, a project might choose to have multiple streams of development and use a different tag for each stream, e.g., \fBstable\fR, \fBbeta\fR, \fBdev\fR, \fBcanary\fR. +.P +By default, the \fBlatest\fR tag is used by npm to identify the current version of a package, and \fBnpm install \fR (without any \fB@\fR or \fB@\fR specifier) installs the \fBlatest\fR tag. Typically, projects only use the \fBlatest\fR tag for stable release versions, and use other tags for unstable versions such as prereleases. +.P +The \fBnext\fR tag is used by some projects to identify the upcoming version. +.P +Other than \fBlatest\fR, no tag has any special significance to npm itself. +.SS "Caveats" +.P +This command used to be known as \fBnpm tag\fR, which only created new tags, and so had a different syntax. +.P +Tags must share a namespace with version numbers, because they are specified in the same slot: \fBnpm install @\fR vs \fBnpm install @\fR. +.P +Tags that can be interpreted as valid semver ranges will be rejected. For example, \fBv1.4\fR cannot be used as a tag, because it is interpreted by semver as \fB>=1.4.0 <1.5.0\fR. See \fI\(lahttps://github.com/npm/npm/issues/6082\(ra\fR. +.P +The simplest way to avoid semver problems with tags is to use tags that do not begin with a number or the letter \fBv\fR. +.SS "Configuration" +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help dedupe +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.RE 0 diff --git a/node_modules/npm/man/man1/npm-docs.1 b/node_modules/npm/man/man1/npm-docs.1 new file mode 100644 index 00000000..fa1ecaa6 --- /dev/null +++ b/node_modules/npm/man/man1/npm-docs.1 @@ -0,0 +1,113 @@ +.TH "NPM-DOCS" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-docs\fR - Open documentation for a package in a web browser +.SS "Synopsis" +.P +.RS 2 +.nf +npm docs \[lB] \[lB] ...\[rB]\[rB] + +alias: home +.fi +.RE +.SS "Description" +.P +This command tries to guess at the likely location of a package's documentation URL, and then tries to open it using the \fB\fB--browser\fR config\fR \fI\(la/using-npm/config#browser\(ra\fR param. You can pass multiple package names at once. If no package name is provided, it will search for a \fBpackage.json\fR in the current folder and use the \fBname\fR property. +.SS "Configuration" +.SS "\fBbrowser\fR" +.RS 0 +.IP \(bu 4 +Default: OS X: \fB"open"\fR, Windows: \fB"start"\fR, Others: \fB"xdg-open"\fR +.IP \(bu 4 +Type: null, Boolean, or String +.RE 0 + +.P +The browser that is called by npm commands to open websites. +.P +Set to \fBfalse\fR to suppress browser behavior and instead print urls to terminal. +.P +Set to \fBtrue\fR to use default system URL opener. +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help view +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.RE 0 diff --git a/node_modules/npm/man/man1/npm-doctor.1 b/node_modules/npm/man/man1/npm-doctor.1 new file mode 100644 index 00000000..8924a815 --- /dev/null +++ b/node_modules/npm/man/man1/npm-doctor.1 @@ -0,0 +1,82 @@ +.TH "NPM-DOCTOR" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-doctor\fR - Check the health of your npm environment +.SS "Synopsis" +.P +.RS 2 +.nf +npm doctor \[lB]connection\[rB] \[lB]registry\[rB] \[lB]versions\[rB] \[lB]environment\[rB] \[lB]permissions\[rB] \[lB]cache\[rB] +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +\fBnpm doctor\fR runs a set of checks to ensure that your npm installation has what it needs to manage your JavaScript packages. npm is mostly a standalone tool, but it does have some basic requirements that must be met: +.RS 0 +.IP \(bu 4 +Node.js and git must be executable by npm. +.IP \(bu 4 +The primary npm registry, \fBregistry.npmjs.com\fR, or another service that uses the registry API, is available. +.IP \(bu 4 +The directories that npm uses, \fBnode_modules\fR (both locally and globally), exist and can be written by the current user. +.IP \(bu 4 +The npm cache exists, and the package tarballs within it aren't corrupt. +.RE 0 + +.P +Without all of these working properly, npm may not work properly. Many issues are often attributable to things that are outside npm's code base, so \fBnpm doctor\fR confirms that the npm installation is in a good state. +.P +Also, in addition to this, there are also very many issue reports due to using old versions of npm. Since npm is constantly improving, running \fBnpm@latest\fR is better than an old version. +.P +\fBnpm doctor\fR verifies the following items in your environment, and if there are any recommended changes, it will display them. By default npm runs all of these checks. You can limit what checks are ran by specifying them as extra arguments. +.SS "\fBConnecting to the registry\fR" +.P +By default, npm installs from the primary npm registry, \fBregistry.npmjs.org\fR. \fBnpm doctor\fR hits a special connection testing endpoint within the registry. This can also be checked with \fBnpm ping\fR. If this check fails, you may be using a proxy that needs to be configured, or may need to talk to your IT staff to get access over HTTPS to \fBregistry.npmjs.org\fR. +.P +This check is done against whichever registry you've configured (you can see what that is by running \fBnpm config get registry\fR), and if you're using a private registry that doesn't support the \fB/whoami\fR endpoint supported by the primary registry, this check may fail. +.SS "\fBChecking npm version\fR" +.P +While Node.js may come bundled with a particular version of npm, it's the policy of the CLI team that we recommend all users run \fBnpm@latest\fR if they can. As the CLI is maintained by a small team of contributors, there are only resources for a single line of development, so npm's own long-term support releases typically only receive critical security and regression fixes. The team believes that the latest tested version of npm is almost always likely to be the most functional and defect-free version of npm. +.SS "\fBChecking node version\fR" +.P +For most users, in most circumstances, the best version of Node will be the latest long-term support (LTS) release. Those of you who want access to new ECMAscript features or bleeding-edge changes to Node's standard library may be running a newer version, and some may be required to run an older version of Node because of enterprise change control policies. That's OK! But in general, the npm team recommends that most users run Node.js LTS. +.SS "\fBChecking configured npm registry\fR" +.P +You may be installing from private package registries for your project or company. That's great! Others may be following tutorials or StackOverflow questions in an effort to troubleshoot problems you may be having. Sometimes, this may entail changing the registry you're pointing at. This part of \fBnpm doctor\fR just lets you, and maybe whoever's helping you with support, know that you're not using the default registry. +.SS "\fBChecking for git executable in PATH\fR" +.P +While it's documented in the README, it may not be obvious that npm needs Git installed to do many of the things that it does. Also, in some cases \[en] especially on Windows \[en] you may have Git set up in such a way that it's not accessible via your \fBPATH\fR so that npm can find it. This check ensures that Git is available. +.SS "Permissions checks" +.RS 0 +.IP \(bu 4 +Your cache must be readable and writable by the user running npm. +.IP \(bu 4 +Global package binaries must be writable by the user running npm. +.IP \(bu 4 +Your local \fBnode_modules\fR path, if you're running \fBnpm doctor\fR with a project directory, must be readable and writable by the user running npm. +.RE 0 + +.SS "Validate the checksums of cached packages" +.P +When an npm package is published, the publishing process generates a checksum that npm uses at install time to verify that the package didn't get corrupted in transit. \fBnpm doctor\fR uses these checksums to validate the package tarballs in your local cache (you can see where that cache is located with \fBnpm config get cache\fR). In the event that there are corrupt packages in your cache, you should probably run \fBnpm cache clean -f\fR and reset the cache. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help bugs +.IP \(bu 4 +npm help help +.IP \(bu 4 +npm help ping +.RE 0 diff --git a/node_modules/npm/man/man1/npm-edit.1 b/node_modules/npm/man/man1/npm-edit.1 new file mode 100644 index 00000000..dc417574 --- /dev/null +++ b/node_modules/npm/man/man1/npm-edit.1 @@ -0,0 +1,43 @@ +.TH "NPM-EDIT" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-edit\fR - Edit an installed package +.SS "Synopsis" +.P +.RS 2 +.nf +npm edit \[lB]/...\[rB] +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Selects a dependency in the current project and opens the package folder in the default editor (or whatever you've configured as the npm \fBeditor\fR config -- see \fB\fBnpm-config\fR\fR \fI\(lanpm-config\(ra\fR.) +.P +After it has been edited, the package is rebuilt so as to pick up any changes in compiled packages. +.P +For instance, you can do \fBnpm install connect\fR to install connect into your package, and then \fBnpm edit connect\fR to make a few changes to your locally installed copy. +.SS "Configuration" +.SS "\fBeditor\fR" +.RS 0 +.IP \(bu 4 +Default: The EDITOR or VISUAL environment variables, or '%SYSTEMROOT%\[rs]notepad.exe' on Windows, or 'vi' on Unix systems +.IP \(bu 4 +Type: String +.RE 0 + +.P +The command to run for \fBnpm edit\fR and \fBnpm config edit\fR. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help explore +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.RE 0 diff --git a/node_modules/npm/man/man1/npm-exec.1 b/node_modules/npm/man/man1/npm-exec.1 new file mode 100644 index 00000000..a959ff3e --- /dev/null +++ b/node_modules/npm/man/man1/npm-exec.1 @@ -0,0 +1,350 @@ +.TH "NPM-EXEC" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-exec\fR - Run a command from a local or remote npm package +.SS "Synopsis" +.P +.RS 2 +.nf +npm exec -- \[lB]@\[rB] \[lB]args...\[rB] +npm exec --package=\[lB]@\[rB] -- \[lB]args...\[rB] +npm exec -c ' \[lB]args...\[rB]' +npm exec --package=foo -c ' \[lB]args...\[rB]' + +alias: x +.fi +.RE +.SS "Description" +.P +This command allows you to run an arbitrary command from an npm package (either one installed locally, or fetched remotely), in a similar context as running it via \fBnpm run\fR. +.P +Run without positional arguments or \fB--call\fR, this allows you to interactively run commands in the same sort of shell environment that \fBpackage.json\fR scripts are run. Interactive mode is not supported in CI environments when standard input is a TTY, to prevent hangs. +.P +Whatever packages are specified by the \fB--package\fR option will be provided in the \fBPATH\fR of the executed command, along with any locally installed package executables. The \fB--package\fR option may be specified multiple times, to execute the supplied command in an environment where all specified packages are available. +.P +If any requested packages are not present in the local project dependencies, then a prompt is printed, which can be suppressed by providing either \fB--yes\fR or \fB--no\fR. When standard input is not a TTY or a CI environment is detected, \fB--yes\fR is assumed. The requested packages are installed to a folder in the npm cache, which is added to the \fBPATH\fR environment variable in the executed process. +.P +Package names provided without a specifier will be matched with whatever version exists in the local project. Package names with a specifier will only be considered a match if they have the exact same name and version as the local dependency. +.P +If no \fB-c\fR or \fB--call\fR option is provided, then the positional arguments are used to generate the command string. If no \fB--package\fR options are provided, then npm will attempt to determine the executable name from the package specifier provided as the first positional argument according to the following heuristic: +.RS 0 +.IP \(bu 4 +If the package has a single entry in its \fBbin\fR field in \fBpackage.json\fR, or if all entries are aliases of the same command, then that command will be used. +.IP \(bu 4 +If the package has multiple \fBbin\fR entries, and one of them matches the unscoped portion of the \fBname\fR field, then that command will be used. +.IP \(bu 4 +If this does not result in exactly one option (either because there are no bin entries, or none of them match the \fBname\fR of the package), then \fBnpm exec\fR exits with an error. +.RE 0 + +.P +To run a binary \fIother than\fR the named binary, specify one or more \fB--package\fR options, which will prevent npm from inferring the package from the first command argument. +.SS "\fBnpx\fR vs \fBnpm exec\fR" +.P +When run via the \fBnpx\fR binary, all flags and options \fImust\fR be set prior to any positional arguments. When run via \fBnpm exec\fR, a double-hyphen \fB--\fR flag can be used to suppress npm's parsing of switches and options that should be sent to the executed command. +.P +For example: +.P +.RS 2 +.nf +$ npx foo@latest bar --package=@npmcli/foo +.fi +.RE +.P +In this case, npm will resolve the \fBfoo\fR package name, and run the following command: +.P +.RS 2 +.nf +$ foo bar --package=@npmcli/foo +.fi +.RE +.P +Since the \fB--package\fR option comes \fIafter\fR the positional arguments, it is treated as an argument to the executed command. +.P +In contrast, due to npm's argument parsing logic, running this command is different: +.P +.RS 2 +.nf +$ npm exec foo@latest bar --package=@npmcli/foo +.fi +.RE +.P +In this case, npm will parse the \fB--package\fR option first, resolving the \fB@npmcli/foo\fR package. Then, it will execute the following command in that context: +.P +.RS 2 +.nf +$ foo@latest bar +.fi +.RE +.P +The double-hyphen character is recommended to explicitly tell npm to stop parsing command line options and switches. The following command would thus be equivalent to the \fBnpx\fR command above: +.P +.RS 2 +.nf +$ npm exec -- foo@latest bar --package=@npmcli/foo +.fi +.RE +.SS "Configuration" +.SS "\fBpackage\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +The package or packages to install for npm help exec +.SS "\fBcall\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Optional companion option for \fBnpm exec\fR, \fBnpx\fR that allows for specifying a custom command to be run along with the installed packages. +.P +.RS 2 +.nf +npm exec --package yo --package generator-node --call "yo node" +.fi +.RE +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "Examples" +.P +Run the version of \fBtap\fR in the local dependencies, with the provided arguments: +.P +.RS 2 +.nf +$ npm exec -- tap --bail test/foo.js +$ npx tap --bail test/foo.js +.fi +.RE +.P +Run a command \fIother than\fR the command whose name matches the package name by specifying a \fB--package\fR option: +.P +.RS 2 +.nf +$ npm exec --package=foo -- bar --bar-argument +# ~ or ~ +$ npx --package=foo bar --bar-argument +.fi +.RE +.P +Run an arbitrary shell script, in the context of the current project: +.P +.RS 2 +.nf +$ npm x -c 'eslint && say "hooray, lint passed"' +$ npx -c 'eslint && say "hooray, lint passed"' +.fi +.RE +.SS "Workspaces support" +.P +You may use the \fB\fBworkspace\fR\fR \fI\(la/using-npm/config#workspace\(ra\fR or \fB\fBworkspaces\fR\fR \fI\(la/using-npm/config#workspaces\(ra\fR configs in order to run an arbitrary command from an npm package (either one installed locally, or fetched remotely) in the context of the specified workspaces. If no positional argument or \fB--call\fR option is provided, it will open an interactive subshell in the context of each of these configured workspaces one at a time. +.P +Given a project with configured workspaces, e.g: +.P +.RS 2 +.nf +. ++-- package.json +`-- packages + +-- a + | `-- package.json + +-- b + | `-- package.json + `-- c + `-- package.json +.fi +.RE +.P +Assuming the workspace configuration is properly set up at the root level \fBpackage.json\fR file. e.g: +.P +.RS 2 +.nf +{ + "workspaces": \[lB] "./packages/*" \[rB] +} +.fi +.RE +.P +You can execute an arbitrary command from a package in the context of each of the configured workspaces when using the \fB\fBworkspaces\fR config options\fR \fI\(la/using-npm/config#workspace\(ra\fR, in this example we're using \fBeslint\fR to lint any js file found within each workspace folder: +.P +.RS 2 +.nf +npm exec --ws -- eslint ./*.js +.fi +.RE +.SS "Filtering workspaces" +.P +It's also possible to execute a command in a single workspace using the \fBworkspace\fR config along with a name or directory path: +.P +.RS 2 +.nf +npm exec --workspace=a -- eslint ./*.js +.fi +.RE +.P +The \fBworkspace\fR config can also be specified multiple times in order to run a specific script in the context of multiple workspaces. When defining values for the \fBworkspace\fR config in the command line, it also possible to use \fB-w\fR as a shorthand, e.g: +.P +.RS 2 +.nf +npm exec -w a -w b -- eslint ./*.js +.fi +.RE +.P +This last command will run the \fBeslint\fR command in both \fB./packages/a\fR and \fB./packages/b\fR folders. +.SS "Compatibility with Older npx Versions" +.P +The \fBnpx\fR binary was rewritten in npm v7.0.0, and the standalone \fBnpx\fR package deprecated at that time. \fBnpx\fR uses the \fBnpm exec\fR command instead of a separate argument parser and install process, with some affordances to maintain backwards compatibility with the arguments it accepted in previous versions. +.P +This resulted in some shifts in its functionality: +.RS 0 +.IP \(bu 4 +Any \fBnpm\fR config value may be provided. +.IP \(bu 4 +To prevent security and user-experience problems from mistyping package names, \fBnpx\fR prompts before installing anything. Suppress this prompt with the \fB-y\fR or \fB--yes\fR option. +.IP \(bu 4 +The \fB--no-install\fR option is deprecated, and will be converted to \fB--no\fR. +.IP \(bu 4 +Shell fallback functionality is removed, as it is not advisable. +.IP \(bu 4 +The \fB-p\fR argument is a shorthand for \fB--parseable\fR in npm, but shorthand for \fB--package\fR in npx. This is maintained, but only for the \fBnpx\fR executable. +.IP \(bu 4 +The \fB--ignore-existing\fR option is removed. Locally installed bins are always present in the executed process \fBPATH\fR. +.IP \(bu 4 +The \fB--npm\fR option is removed. \fBnpx\fR will always use the \fBnpm\fR it ships with. +.IP \(bu 4 +The \fB--node-arg\fR and \fB-n\fR options are removed. +.IP \(bu 4 +The \fB--always-spawn\fR option is redundant, and thus removed. +.IP \(bu 4 +The \fB--shell\fR option is replaced with \fB--script-shell\fR, but maintained in the \fBnpx\fR executable for backwards compatibility. +.RE 0 + +.SS "A note on caching" +.P +The npm cli utilizes its internal package cache when using the package name specified. You can use the following to change how and when the cli uses this cache. See npm help cache for more on how the cache works. +.SS "prefer-online" +.P +Forces staleness checks for packages, making the cli look for updates immediately even if the package is already in the cache. +.SS "prefer-offline" +.P +Bypasses staleness checks for packages. Missing data will still be requested from the server. To force full offline mode, use \fBoffline\fR. +.SS "offline" +.P +Forces full offline mode. Any packages not locally cached will result in an error. +.SS "workspace" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result to selecting all of the nested workspaces) +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "workspaces" +.RS 0 +.IP \(bu 4 +Alias: \fB--ws\fR +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +Default: \fBfalse\fR +.RE 0 + +.P +Run scripts in the context of all configured workspaces for the current project. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help run-script +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +npm help test +.IP \(bu 4 +npm help start +.IP \(bu 4 +npm help restart +.IP \(bu 4 +npm help stop +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help workspaces +.IP \(bu 4 +npm help npx +.RE 0 diff --git a/node_modules/npm/man/man1/npm-explain.1 b/node_modules/npm/man/man1/npm-explain.1 new file mode 100644 index 00000000..efef3975 --- /dev/null +++ b/node_modules/npm/man/man1/npm-explain.1 @@ -0,0 +1,118 @@ +.TH "NPM-EXPLAIN" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-explain\fR - Explain installed packages +.SS "Synopsis" +.P +.RS 2 +.nf +npm explain + +alias: why +.fi +.RE +.SS "Description" +.P +This command will print the chain of dependencies causing a given package to be installed in the current project. +.P +If one or more package specs are provided, then only packages matching one of the specifiers will have their relationships explained. +.P +The package spec can also refer to a folder within \fB./node_modules\fR +.P +For example, running \fBnpm explain glob\fR within npm's source tree will show: +.P +.RS 2 +.nf +glob@7.1.6 +node_modules/glob + glob@"^7.1.4" from the root project + +glob@7.1.1 dev +node_modules/tacks/node_modules/glob + glob@"^7.0.5" from rimraf@2.6.2 + node_modules/tacks/node_modules/rimraf + rimraf@"^2.6.2" from tacks@1.3.0 + node_modules/tacks + dev tacks@"^1.3.0" from the root project +.fi +.RE +.P +To explain just the package residing at a specific folder, pass that as the argument to the command. This can be useful when trying to figure out exactly why a given dependency is being duplicated to satisfy conflicting version requirements within the project. +.P +.RS 2 +.nf +$ npm explain node_modules/nyc/node_modules/find-up +find-up@3.0.0 dev +node_modules/nyc/node_modules/find-up + find-up@"^3.0.0" from nyc@14.1.1 + node_modules/nyc + nyc@"^14.1.1" from tap@14.10.8 + node_modules/tap + dev tap@"^14.10.8" from the root project +.fi +.RE +.SS "Configuration" +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help ls +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help link +.IP \(bu 4 +npm help prune +.IP \(bu 4 +npm help outdated +.IP \(bu 4 +npm help update +.RE 0 diff --git a/node_modules/npm/man/man1/npm-explore.1 b/node_modules/npm/man/man1/npm-explore.1 new file mode 100644 index 00000000..47b672d8 --- /dev/null +++ b/node_modules/npm/man/man1/npm-explore.1 @@ -0,0 +1,49 @@ +.TH "NPM-EXPLORE" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-explore\fR - Browse an installed package +.SS "Synopsis" +.P +.RS 2 +.nf +npm explore \[lB] -- \[rB] +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Spawn a subshell in the directory of the installed package specified. +.P +If a command is specified, then it is run in the subshell, which then immediately terminates. +.P +This is particularly handy in the case of git submodules in the \fBnode_modules\fR folder: +.P +.RS 2 +.nf +npm explore some-dependency -- git pull origin master +.fi +.RE +.P +Note that the package is \fInot\fR automatically rebuilt afterwards, so be sure to use \fBnpm rebuild \fR if you make any changes. +.SS "Configuration" +.SS "\fBshell\fR" +.RS 0 +.IP \(bu 4 +Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on Windows +.IP \(bu 4 +Type: String +.RE 0 + +.P +The shell to run for the \fBnpm explore\fR command. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help edit +.IP \(bu 4 +npm help rebuild +.IP \(bu 4 +npm help install +.RE 0 diff --git a/node_modules/npm/man/man1/npm-find-dupes.1 b/node_modules/npm/man/man1/npm-find-dupes.1 new file mode 100644 index 00000000..bc302ea5 --- /dev/null +++ b/node_modules/npm/man/man1/npm-find-dupes.1 @@ -0,0 +1,225 @@ +.TH "NPM-FIND-DUPES" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-find-dupes\fR - Find duplication in the package tree +.SS "Synopsis" +.P +.RS 2 +.nf +npm find-dupes +.fi +.RE +.SS "Description" +.P +Runs \fBnpm dedupe\fR in \fB--dry-run\fR mode, making npm only output the duplications, without actually changing the package tree. +.SS "Configuration" +.SS "\fBinstall-strategy\fR" +.RS 0 +.IP \(bu 4 +Default: "hoisted" +.IP \(bu 4 +Type: "hoisted", "nested", "shallow", or "linked" +.RE 0 + +.P +Sets the strategy for installing packages in node_modules. hoisted (default): Install non-duplicated in top-level, and duplicated as necessary within directory structure. nested: (formerly --legacy-bundling) install in place, no hoisting. shallow (formerly --global-style) only install direct deps at top-level. linked: (experimental) install in node_modules/.store, link in place, unhoisted. +.SS "\fBlegacy-bundling\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=nested\fR +.RE 0 + +.P +Instead of hoisting package installs in \fBnode_modules\fR, install packages in the same manner that they are depended on. This may cause very deep directory structures and duplicate package installs as there is no de-duplicating. Sets \fB--install-strategy=nested\fR. +.SS "\fBglobal-style\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=shallow\fR +.RE 0 + +.P +Only install direct dependencies in the top level \fBnode_modules\fR, but hoist on deeper dependencies. Sets \fB--install-strategy=shallow\fR. +.SS "\fBstrict-peer-deps\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to \fBtrue\fR, and \fB--legacy-peer-deps\fR is not set, then \fIany\fR conflicting \fBpeerDependencies\fR will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships. +.P +By default, conflicting \fBpeerDependencies\fR deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's \fBpeerDependencies\fR object. +.P +When such an override is performed, a warning is printed, explaining the conflict and the packages involved. If \fB--strict-peer-deps\fR is set, then this warning is treated as a failure. +.SS "\fBpackage-lock\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to false, then ignore \fBpackage-lock.json\fR files when installing. This will also prevent \fIwriting\fR \fBpackage-lock.json\fR if \fBsave\fR is true. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBaudit\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for npm help audit for details on what is submitted. +.SS "\fBbin-links\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables. +.P +Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. +.SS "\fBfund\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" displays the message at the end of each \fBnpm install\fR acknowledging the number of dependencies looking for funding. See npm help fund for details. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help dedupe +.IP \(bu 4 +npm help ls +.IP \(bu 4 +npm help update +.IP \(bu 4 +npm help install +.RE 0 diff --git a/node_modules/npm/man/man1/npm-fund.1 b/node_modules/npm/man/man1/npm-fund.1 new file mode 100644 index 00000000..86b8034a --- /dev/null +++ b/node_modules/npm/man/man1/npm-fund.1 @@ -0,0 +1,142 @@ +.TH "NPM-FUND" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-fund\fR - Retrieve funding information +.SS "Synopsis" +.P +.RS 2 +.nf +npm fund \[lB]\[rB] +.fi +.RE +.SS "Description" +.P +This command retrieves information on how to fund the dependencies of a given project. If no package name is provided, it will list all dependencies that are looking for funding in a tree structure, listing the type of funding and the url to visit. If a package name is provided then it tries to open its funding url using the \fB\fB--browser\fR config\fR \fI\(la/using-npm/config#browser\(ra\fR param; if there are multiple funding sources for the package, the user will be instructed to pass the \fB--which\fR option to disambiguate. +.P +The list will avoid duplicated entries and will stack all packages that share the same url as a single entry. Thus, the list does not have the same shape of the output from \fBnpm ls\fR. +.SS "Example" +.SS "Workspaces support" +.P +It's possible to filter the results to only include a single workspace and its dependencies using the \fB\fBworkspace\fR config\fR \fI\(la/using-npm/config#workspace\(ra\fR option. +.SS "Example:" +.P +Here's an example running \fBnpm fund\fR in a project with a configured workspace \fBa\fR: +.P +.RS 2 +.nf +$ npm fund +test-workspaces-fund@1.0.0 ++-- https://example.com/a +| | `-- a@1.0.0 +| `-- https://example.com/maintainer +| `-- foo@1.0.0 ++-- https://example.com/npmcli-funding +| `-- @npmcli/test-funding +`-- https://example.com/org + `-- bar@2.0.0 +.fi +.RE +.P +And here is an example of the expected result when filtering only by a specific workspace \fBa\fR in the same project: +.P +.RS 2 +.nf +$ npm fund -w a +test-workspaces-fund@1.0.0 +`-- https://example.com/a + | `-- a@1.0.0 + `-- https://example.com/maintainer + `-- foo@2.0.0 +.fi +.RE +.SS "Configuration" +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBbrowser\fR" +.RS 0 +.IP \(bu 4 +Default: OS X: \fB"open"\fR, Windows: \fB"start"\fR, Others: \fB"xdg-open"\fR +.IP \(bu 4 +Type: null, Boolean, or String +.RE 0 + +.P +The browser that is called by npm commands to open websites. +.P +Set to \fBfalse\fR to suppress browser behavior and instead print urls to terminal. +.P +Set to \fBtrue\fR to use default system URL opener. +.SS "\fBunicode\fR" +.RS 0 +.IP \(bu 4 +Default: false on windows, true on mac/unix systems with a unicode locale, as defined by the \fBLC_ALL\fR, \fBLC_CTYPE\fR, or \fBLANG\fR environment variables. +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBwhich\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Number +.RE 0 + +.P +If there are multiple funding sources, which 1-indexed source URL to open. +.SH "SEE ALSO" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help docs +.IP \(bu 4 +npm help ls +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help workspaces +.RE 0 diff --git a/node_modules/npm/man/man1/npm-help-search.1 b/node_modules/npm/man/man1/npm-help-search.1 new file mode 100644 index 00000000..71781970 --- /dev/null +++ b/node_modules/npm/man/man1/npm-help-search.1 @@ -0,0 +1,37 @@ +.TH "NPM-HELP-SEARCH" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-help-search\fR - Search npm help documentation +.SS "Synopsis" +.P +.RS 2 +.nf +npm help-search +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +This command will search the npm markdown documentation files for the terms provided, and then list the results, sorted by relevance. +.P +If only one result is found, then it will show that help topic. +.P +If the argument to \fBnpm help\fR is not a known help topic, then it will call \fBhelp-search\fR. It is rarely if ever necessary to call this command directly. +.SS "Configuration" +.SS "\fBlong\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Show extended information in \fBls\fR, \fBsearch\fR, and \fBhelp-search\fR. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help npm +.IP \(bu 4 +npm help help +.RE 0 diff --git a/node_modules/npm/man/man1/npm-help.1 b/node_modules/npm/man/man1/npm-help.1 new file mode 100644 index 00000000..09e59985 --- /dev/null +++ b/node_modules/npm/man/man1/npm-help.1 @@ -0,0 +1,47 @@ +.TH "NPM-HELP" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-help\fR - Get help on npm +.SS "Synopsis" +.P +.RS 2 +.nf +npm help \[lB]\[rB] + +alias: hlep +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +If supplied a topic, then show the appropriate documentation page. +.P +If the topic does not exist, or if multiple terms are provided, then npm will run the \fBhelp-search\fR command to find a match. Note that, if \fBhelp-search\fR finds a single subject, then it will run \fBhelp\fR on that topic, so unique matches are equivalent to specifying a topic name. +.SS "Configuration" +.SS "\fBviewer\fR" +.RS 0 +.IP \(bu 4 +Default: "man" on Posix, "browser" on Windows +.IP \(bu 4 +Type: String +.RE 0 + +.P +The program to use to view help content. +.P +Set to \fB"browser"\fR to view html help content in the default web browser. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help npm +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help help-search +.RE 0 diff --git a/node_modules/npm/man/man1/npm-init.1 b/node_modules/npm/man/man1/npm-init.1 new file mode 100644 index 00000000..ace9295a --- /dev/null +++ b/node_modules/npm/man/man1/npm-init.1 @@ -0,0 +1,366 @@ +.TH "NPM-INIT" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-init\fR - Create a package.json file +.SS "Synopsis" +.P +.RS 2 +.nf +npm init (same as `npx create-`) +npm init <@scope> (same as `npx <@scope>/create`) + +aliases: create, innit +.fi +.RE +.SS "Description" +.P +\fBnpm init \fR can be used to set up a new or existing npm package. +.P +\fBinitializer\fR in this case is an npm package named \fBcreate-\fR, which will be installed by npm help npm-exec, and then have its main bin executed -- presumably creating or updating \fBpackage.json\fR and running any other initialization-related operations. +.P +The init command is transformed to a corresponding \fBnpm exec\fR operation as follows: +.RS 0 +.IP \(bu 4 +\fBnpm init foo\fR -> \fBnpm exec create-foo\fR +.IP \(bu 4 +\fBnpm init @usr/foo\fR -> \fBnpm exec @usr/create-foo\fR +.IP \(bu 4 +\fBnpm init @usr\fR -> \fBnpm exec @usr/create\fR +.IP \(bu 4 +\fBnpm init @usr@2.0.0\fR -> \fBnpm exec @usr/create@2.0.0\fR +.IP \(bu 4 +\fBnpm init @usr/foo@2.0.0\fR -> \fBnpm exec @usr/create-foo@2.0.0\fR +.RE 0 + +.P +If the initializer is omitted (by just calling \fBnpm init\fR), init will fall back to legacy init behavior. It will ask you a bunch of questions, and then write a package.json for you. It will attempt to make reasonable guesses based on existing fields, dependencies, and options selected. It is strictly additive, so it will keep any fields and values that were already set. You can also use \fB-y\fR/\fB--yes\fR to skip the questionnaire altogether. If you pass \fB--scope\fR, it will create a scoped package. +.P +\fINote:\fR if a user already has the \fBcreate-\fR package globally installed, that will be what \fBnpm init\fR uses. If you want npm to use the latest version, or another specific version you must specify it: +.RS 0 +.IP \(bu 4 +\fBnpm init foo@latest\fR # fetches and runs the latest \fBcreate-foo\fR from the registry +.IP \(bu 4 +\fBnpm init foo@1.2.3\fR # runs \fBcreate-foo@1.2.3\fR specifically +.RE 0 + +.SS "Forwarding additional options" +.P +Any additional options will be passed directly to the command, so \fBnpm init +foo -- --hello\fR will map to \fBnpm exec -- create-foo --hello\fR. +.P +To better illustrate how options are forwarded, here's a more evolved example showing options passed to both the \fBnpm cli\fR and a create package, both following commands are equivalent: +.RS 0 +.IP \(bu 4 +\fBnpm init foo -y --registry= -- --hello -a\fR +.IP \(bu 4 +\fBnpm exec -y --registry= -- create-foo --hello -a\fR +.RE 0 + +.SS "Examples" +.P +Create a new React-based project using \fB\fBcreate-react-app\fR\fR \fI\(lahttps://npm.im/create-react-app\(ra\fR: +.P +.RS 2 +.nf +$ npm init react-app ./my-react-app +.fi +.RE +.P +Create a new \fBesm\fR-compatible package using \fB\fBcreate-esm\fR\fR \fI\(lahttps://npm.im/create-esm\(ra\fR: +.P +.RS 2 +.nf +$ mkdir my-esm-lib && cd my-esm-lib +$ npm init esm --yes +.fi +.RE +.P +Generate a plain old package.json using legacy init: +.P +.RS 2 +.nf +$ mkdir my-npm-pkg && cd my-npm-pkg +$ git init +$ npm init +.fi +.RE +.P +Generate it without having it ask any questions: +.P +.RS 2 +.nf +$ npm init -y +.fi +.RE +.SS "Workspaces support" +.P +It's possible to create a new workspace within your project by using the \fBworkspace\fR config option. When using \fBnpm init -w \fR the cli will create the folders and boilerplate expected while also adding a reference to your project \fBpackage.json\fR \fB"workspaces": \[lB]\[rB]\fR property in order to make sure that new generated \fBworkspace\fR is properly set up as such. +.P +Given a project with no workspaces, e.g: +.P +.RS 2 +.nf +. ++-- package.json +.fi +.RE +.P +You may generate a new workspace using the legacy init: +.P +.RS 2 +.nf +$ npm init -w packages/a +.fi +.RE +.P +That will generate a new folder and \fBpackage.json\fR file, while also updating your top-level \fBpackage.json\fR to add the reference to this new workspace: +.P +.RS 2 +.nf +. ++-- package.json +`-- packages + `-- a + `-- package.json +.fi +.RE +.P +The workspaces init also supports the \fBnpm init -w \fR syntax, following the same set of rules explained earlier in the initial \fBDescription\fR section of this page. Similar to the previous example of creating a new React-based project using \fB\fBcreate-react-app\fR\fR \fI\(lahttps://npm.im/create-react-app\(ra\fR, the following syntax will make sure to create the new react app as a nested \fBworkspace\fR within your project and configure your \fBpackage.json\fR to recognize it as such: +.P +.RS 2 +.nf +npm init -w packages/my-react-app react-app . +.fi +.RE +.P +This will make sure to generate your react app as expected, one important consideration to have in mind is that \fBnpm exec\fR is going to be run in the context of the newly created folder for that workspace, and that's the reason why in this example the initializer uses the initializer name followed with a dot to represent the current directory in that context, e.g: \fBreact-app .\fR: +.P +.RS 2 +.nf +. ++-- package.json +`-- packages + +-- a + | `-- package.json + `-- my-react-app + +-- README + +-- package.json + `-- ... +.fi +.RE +.SS "Configuration" +.SS "\fBinit-author-name\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +The value \fBnpm init\fR should use by default for the package author's name. +.SS "\fBinit-author-url\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: "" or URL +.RE 0 + +.P +The value \fBnpm init\fR should use by default for the package author's homepage. +.SS "\fBinit-license\fR" +.RS 0 +.IP \(bu 4 +Default: "ISC" +.IP \(bu 4 +Type: String +.RE 0 + +.P +The value \fBnpm init\fR should use by default for the package license. +.SS "\fBinit-module\fR" +.RS 0 +.IP \(bu 4 +Default: "~/.npm-init.js" +.IP \(bu 4 +Type: Path +.RE 0 + +.P +A module that will be loaded by the \fBnpm init\fR command. See the documentation for the \fBinit-package-json\fR \fI\(lahttps://github.com/npm/init-package-json\(ra\fR module for more information, or npm help init. +.SS "\fBinit-version\fR" +.RS 0 +.IP \(bu 4 +Default: "1.0.0" +.IP \(bu 4 +Type: SemVer string +.RE 0 + +.P +The value that \fBnpm init\fR should use by default for the package version number, if not already set in package.json. +.SS "\fByes\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Automatically answer "yes" to any prompts that npm might print on the command line. +.SS "\fBforce\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input. +.RS 0 +.IP \(bu 4 +Allow clobbering non-npm files in global installs. +.IP \(bu 4 +Allow the \fBnpm version\fR command to work on an unclean git repository. +.IP \(bu 4 +Allow deleting the cache folder with \fBnpm cache clean\fR. +.IP \(bu 4 +Allow installing packages that have an \fBengines\fR declaration requiring a different version of npm. +.IP \(bu 4 +Allow installing packages that have an \fBengines\fR declaration requiring a different version of \fBnode\fR, even if \fB--engine-strict\fR is enabled. +.IP \(bu 4 +Allow \fBnpm audit fix\fR to install modules outside your stated dependency range (including SemVer-major changes). +.IP \(bu 4 +Allow unpublishing all versions of a published package. +.IP \(bu 4 +Allow conflicting peerDependencies to be installed in the root project. +.IP \(bu 4 +Implicitly set \fB--yes\fR during \fBnpm init\fR. +.IP \(bu 4 +Allow clobbering existing values in \fBnpm pkg\fR +.IP \(bu 4 +Allow unpublishing of entire packages (not just a single version). +.RE 0 + +.P +If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! +.SS "\fBscope\fR" +.RS 0 +.IP \(bu 4 +Default: the scope of the current project, if any, or "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Associate an operation with a scope for a scoped registry. +.P +Useful when logging in to or out of a private registry: +.P +.RS 2 +.nf +# log in, linking the scope to the custom registry +npm login --scope=@mycorp --registry=https://registry.mycorp.com + +# log out, removing the link and the auth token +npm logout --scope=@mycorp +.fi +.RE +.P +This will cause \fB@mycorp\fR to be mapped to the registry for future installation of packages specified according to the pattern \fB@mycorp/package\fR. +.P +This will also cause \fBnpm init\fR to create a scoped package. +.P +.RS 2 +.nf +# accept all defaults, and create a package named "@foo/whatever", +# instead of just named "whatever" +npm init --scope=@foo --yes +.fi +.RE +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces-update\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, the npm cli will run an update after operations that may possibly change the workspaces installed to the \fBnode_modules\fR folder. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +\fBinit-package-json module\fR \fI\(lahttp://npm.im/init-package-json\(ra\fR +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help version +.IP \(bu 4 +npm help scope +.IP \(bu 4 +npm help exec +.IP \(bu 4 +npm help workspaces +.RE 0 diff --git a/node_modules/npm/man/man1/npm-install-ci-test.1 b/node_modules/npm/man/man1/npm-install-ci-test.1 new file mode 100644 index 00000000..72fc3a85 --- /dev/null +++ b/node_modules/npm/man/man1/npm-install-ci-test.1 @@ -0,0 +1,239 @@ +.TH "NPM-INSTALL-CI-TEST" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-install-ci-test\fR - Install a project with a clean slate and run tests +.SS "Synopsis" +.P +.RS 2 +.nf +npm install-ci-test + +aliases: cit, clean-install-test, sit +.fi +.RE +.SS "Description" +.P +This command runs \fBnpm ci\fR followed immediately by \fBnpm test\fR. +.SS "Configuration" +.SS "\fBinstall-strategy\fR" +.RS 0 +.IP \(bu 4 +Default: "hoisted" +.IP \(bu 4 +Type: "hoisted", "nested", "shallow", or "linked" +.RE 0 + +.P +Sets the strategy for installing packages in node_modules. hoisted (default): Install non-duplicated in top-level, and duplicated as necessary within directory structure. nested: (formerly --legacy-bundling) install in place, no hoisting. shallow (formerly --global-style) only install direct deps at top-level. linked: (experimental) install in node_modules/.store, link in place, unhoisted. +.SS "\fBlegacy-bundling\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=nested\fR +.RE 0 + +.P +Instead of hoisting package installs in \fBnode_modules\fR, install packages in the same manner that they are depended on. This may cause very deep directory structures and duplicate package installs as there is no de-duplicating. Sets \fB--install-strategy=nested\fR. +.SS "\fBglobal-style\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=shallow\fR +.RE 0 + +.P +Only install direct dependencies in the top level \fBnode_modules\fR, but hoist on deeper dependencies. Sets \fB--install-strategy=shallow\fR. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBstrict-peer-deps\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to \fBtrue\fR, and \fB--legacy-peer-deps\fR is not set, then \fIany\fR conflicting \fBpeerDependencies\fR will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships. +.P +By default, conflicting \fBpeerDependencies\fR deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's \fBpeerDependencies\fR object. +.P +When such an override is performed, a warning is printed, explaining the conflict and the packages involved. If \fB--strict-peer-deps\fR is set, then this warning is treated as a failure. +.SS "\fBforeground-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process. +.P +Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBaudit\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for npm help audit for details on what is submitted. +.SS "\fBbin-links\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables. +.P +Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. +.SS "\fBfund\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" displays the message at the end of each \fBnpm install\fR acknowledging the number of dependencies looking for funding. See npm help fund for details. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help install-test +.IP \(bu 4 +npm help ci +.IP \(bu 4 +npm help test +.RE 0 diff --git a/node_modules/npm/man/man1/npm-install-test.1 b/node_modules/npm/man/man1/npm-install-test.1 new file mode 100644 index 00000000..20320bba --- /dev/null +++ b/node_modules/npm/man/man1/npm-install-test.1 @@ -0,0 +1,346 @@ +.TH "NPM-INSTALL-TEST" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-install-test\fR - Install package(s) and run tests +.SS "Synopsis" +.P +.RS 2 +.nf +npm install-test \[lB] ...\[rB] + +alias: it +.fi +.RE +.SS "Description" +.P +This command runs an \fBnpm install\fR followed immediately by an \fBnpm test\fR. It takes exactly the same arguments as \fBnpm install\fR. +.SS "Configuration" +.SS "\fBsave\fR" +.RS 0 +.IP \(bu 4 +Default: \fBtrue\fR unless when using \fBnpm update\fR where it defaults to \fBfalse\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Save installed packages to a \fBpackage.json\fR file as dependencies. +.P +When used with the \fBnpm rm\fR command, removes the dependency from \fBpackage.json\fR. +.P +Will also prevent writing to \fBpackage-lock.json\fR if set to \fBfalse\fR. +.SS "\fBsave-exact\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Dependencies saved to package.json will be configured with an exact version rather than using npm's default semver range operator. +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBinstall-strategy\fR" +.RS 0 +.IP \(bu 4 +Default: "hoisted" +.IP \(bu 4 +Type: "hoisted", "nested", "shallow", or "linked" +.RE 0 + +.P +Sets the strategy for installing packages in node_modules. hoisted (default): Install non-duplicated in top-level, and duplicated as necessary within directory structure. nested: (formerly --legacy-bundling) install in place, no hoisting. shallow (formerly --global-style) only install direct deps at top-level. linked: (experimental) install in node_modules/.store, link in place, unhoisted. +.SS "\fBlegacy-bundling\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=nested\fR +.RE 0 + +.P +Instead of hoisting package installs in \fBnode_modules\fR, install packages in the same manner that they are depended on. This may cause very deep directory structures and duplicate package installs as there is no de-duplicating. Sets \fB--install-strategy=nested\fR. +.SS "\fBglobal-style\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=shallow\fR +.RE 0 + +.P +Only install direct dependencies in the top level \fBnode_modules\fR, but hoist on deeper dependencies. Sets \fB--install-strategy=shallow\fR. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBstrict-peer-deps\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to \fBtrue\fR, and \fB--legacy-peer-deps\fR is not set, then \fIany\fR conflicting \fBpeerDependencies\fR will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships. +.P +By default, conflicting \fBpeerDependencies\fR deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's \fBpeerDependencies\fR object. +.P +When such an override is performed, a warning is printed, explaining the conflict and the packages involved. If \fB--strict-peer-deps\fR is set, then this warning is treated as a failure. +.SS "\fBprefer-dedupe\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Prefer to deduplicate packages if possible, rather than choosing a newer version of a dependency. +.SS "\fBpackage-lock\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to false, then ignore \fBpackage-lock.json\fR files when installing. This will also prevent \fIwriting\fR \fBpackage-lock.json\fR if \fBsave\fR is true. +.SS "\fBpackage-lock-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, the current operation will only use the \fBpackage-lock.json\fR, ignoring \fBnode_modules\fR. +.P +For \fBupdate\fR this means only the \fBpackage-lock.json\fR will be updated, instead of checking \fBnode_modules\fR and downloading dependencies. +.P +For \fBlist\fR this means the output will be based on the tree described by the \fBpackage-lock.json\fR, rather than the contents of \fBnode_modules\fR. +.SS "\fBforeground-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process. +.P +Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBaudit\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for npm help audit for details on what is submitted. +.SS "\fBbin-links\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables. +.P +Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. +.SS "\fBfund\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" displays the message at the end of each \fBnpm install\fR acknowledging the number of dependencies looking for funding. See npm help fund for details. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBcpu\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +Override CPU architecture of native modules to install. Acceptable values are same as \fBcpu\fR field of package.json, which comes from \fBprocess.arch\fR. +.SS "\fBos\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +Override OS of native modules to install. Acceptable values are same as \fBos\fR field of package.json, which comes from \fBprocess.platform\fR. +.SS "\fBlibc\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +Override libc of native modules to install. Acceptable values are same as \fBlibc\fR field of package.json +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help install-ci-test +.IP \(bu 4 +npm help test +.RE 0 diff --git a/node_modules/npm/man/man1/npm-install.1 b/node_modules/npm/man/man1/npm-install.1 new file mode 100644 index 00000000..3b327113 --- /dev/null +++ b/node_modules/npm/man/man1/npm-install.1 @@ -0,0 +1,762 @@ +.TH "NPM-INSTALL" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-install\fR - Install a package +.SS "Synopsis" +.P +.RS 2 +.nf +npm install \[lB] ...\[rB] + +aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall +.fi +.RE +.SS "Description" +.P +This command installs a package and any packages that it depends on. If the package has a package-lock, or an npm shrinkwrap file, or a yarn lock file, the installation of dependencies will be driven by that, respecting the following order of precedence: +.RS 0 +.IP \(bu 4 +\fBnpm-shrinkwrap.json\fR +.IP \(bu 4 +\fBpackage-lock.json\fR +.IP \(bu 4 +\fByarn.lock\fR +.RE 0 + +.P +See \fBpackage-lock.json\fR \fI\(la/configuring-npm/package-lock-json\(ra\fR and npm help shrinkwrap. +.P +A \fBpackage\fR is: +.RS 0 +.IP \(bu 4 +a) a folder containing a program described by a \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR file +.IP \(bu 4 +b) a gzipped tarball containing (a) +.IP \(bu 4 +c) a url that resolves to (b) +.IP \(bu 4 +d) a \fB@\fR that is published on the registry (see npm help registry) with (c) +.IP \(bu 4 +e) a \fB@\fR (see npm help dist-tag) that points to (d) +.IP \(bu 4 +f) a \fB\fR that has a "latest" tag satisfying (e) +.IP \(bu 4 +g) a \fB\fR that resolves to (a) +.RE 0 + +.P +Even if you never publish your package, you can still get a lot of benefits of using npm if you just want to write a node program (a), and perhaps if you also want to be able to easily install it elsewhere after packing it up into a tarball (b). +.RS 0 +.IP \(bu 4 +\fBnpm install\fR (in a package directory, no arguments): +.P +Install the dependencies to the local \fBnode_modules\fR folder. +.P +In global mode (ie, with \fB-g\fR or \fB--global\fR appended to the command), it installs the current package context (ie, the current working directory) as a global package. +.P +By default, \fBnpm install\fR will install all modules listed as dependencies in \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR. +.P +With the \fB--production\fR flag (or when the \fBNODE_ENV\fR environment variable is set to \fBproduction\fR), npm will not install modules listed in \fBdevDependencies\fR. To install all modules listed in both \fBdependencies\fR and \fBdevDependencies\fR when \fBNODE_ENV\fR environment variable is set to \fBproduction\fR, you can use \fB--production=false\fR. +.RS 4 +.P +NOTE: The \fB--production\fR flag has no particular meaning when adding a dependency to a project. +.RE 0 + +.IP \(bu 4 +\fBnpm install \fR: +.P +If \fB\fR sits inside the root of your project, its dependencies will be installed and may be hoisted to the top-level \fBnode_modules\fR as they would for other types of dependencies. If \fB\fR sits outside the root of your project, \fInpm will not install the package dependencies\fR in the directory \fB\fR, but it will create a symlink to \fB\fR. +.RS 4 +.P +NOTE: If you want to install the content of a directory like a package from the registry instead of creating a link, you would need to use the \fB--install-links\fR option. +.RE 0 + +.P +Example: +.P +.RS 2 +.nf +npm install ../../other-package --install-links +npm install ./sub-package +.fi +.RE +.IP \(bu 4 +\fBnpm install \fR: +.P +Install a package that is sitting on the filesystem. Note: if you just want to link a dev directory into your npm root, you can do this more easily by using npm help link. +.P +Tarball requirements: +.RS 4 +.IP \(bu 4 +The filename \fImust\fR use \fB.tar\fR, \fB.tar.gz\fR, or \fB.tgz\fR as the extension. +.IP \(bu 4 +The package contents should reside in a subfolder inside the tarball (usually it is called \fBpackage/\fR). npm strips one directory layer when installing the package (an equivalent of \fBtar x +--strip-components=1\fR is run). +.IP \(bu 4 +The package must contain a \fBpackage.json\fR file with \fBname\fR and \fBversion\fR properties. +.RE 0 + +.P +Example: +.P +.RS 2 +.nf +npm install ./package.tgz +.fi +.RE +.IP \(bu 4 +\fBnpm install \fR: +.P +Fetch the tarball url, and then install it. In order to distinguish between this and other options, the argument must start with "http://" or "https://" +.P +Example: +.P +.RS 2 +.nf +npm install https://github.com/indexzero/forever/tarball/v0.5.6 +.fi +.RE +.IP \(bu 4 +\fBnpm install \[lB]<@scope>/\[rB]\fR: +.P +Do a \fB@\fR install, where \fB\fR is the "tag" config. (See \fB\fBconfig\fR\fR \fI\(la/using-npm/config#tag\(ra\fR. The config's default value is \fBlatest\fR.) +.P +In most cases, this will install the version of the modules tagged as \fBlatest\fR on the npm registry. +.P +Example: +.P +.RS 2 +.nf +npm install sax +.fi +.RE +.P +\fBnpm install\fR saves any specified packages into \fBdependencies\fR by default. Additionally, you can control where and how they get saved with some additional flags: +.RS 4 +.IP \(bu 4 +\fB-P, --save-prod\fR: Package will appear in your \fBdependencies\fR. This is the default unless \fB-D\fR or \fB-O\fR are present. +.IP \(bu 4 +\fB-D, --save-dev\fR: Package will appear in your \fBdevDependencies\fR. +.IP \(bu 4 +\fB--save-peer\fR: Package will appear in your \fBpeerDependencies\fR. +.IP \(bu 4 +\fB-O, --save-optional\fR: Package will appear in your \fBoptionalDependencies\fR. +.IP \(bu 4 +\fB--no-save\fR: Prevents saving to \fBdependencies\fR. +.RE 0 + +.P +When using any of the above options to save dependencies to your package.json, there are two additional, optional flags: +.RS 4 +.IP \(bu 4 +\fB-E, --save-exact\fR: Saved dependencies will be configured with an exact version rather than using npm's default semver range operator. +.IP \(bu 4 +\fB-B, --save-bundle\fR: Saved dependencies will also be added to your \fBbundleDependencies\fR list. +.RE 0 + +.P +Further, if you have an \fBnpm-shrinkwrap.json\fR or \fBpackage-lock.json\fR then it will be updated as well. +.P +\fB\fR is optional. The package will be downloaded from the registry associated with the specified scope. If no registry is associated with the given scope the default registry is assumed. See npm help scope. +.P +Note: if you do not include the @-symbol on your scope name, npm will interpret this as a GitHub repository instead, see below. Scopes names must also be followed by a slash. +.P +Examples: +.P +.RS 2 +.nf +npm install sax +npm install githubname/reponame +npm install @myorg/privatepackage +npm install node-tap --save-dev +npm install dtrace-provider --save-optional +npm install readable-stream --save-exact +npm install ansi-regex --save-bundle +.fi +.RE +.IP \(bu 4 +\fBnpm install @npm:\fR: +.P +Install a package under a custom alias. Allows multiple versions of a same-name package side-by-side, more convenient import names for packages with otherwise long ones, and using git forks replacements or forked npm packages as replacements. Aliasing works only on your project and does not rename packages in transitive dependencies. Aliases should follow the naming conventions stated in \fB\fBvalidate-npm-package-name\fR\fR \fI\(lahttps://www.npmjs.com/package/validate-npm-package-name#naming-rules\(ra\fR. +.P +Examples: +.P +.RS 2 +.nf +npm install my-react@npm:react +npm install jquery2@npm:jquery@2 +npm install jquery3@npm:jquery@3 +npm install npa@npm:npm-package-arg +.fi +.RE +.IP \(bu 4 +\fBnpm install \[lB]<@scope>/\[rB]@\fR: +.P +Install the version of the package that is referenced by the specified tag. If the tag does not exist in the registry data for that package, then this will fail. +.P +Example: +.P +.RS 2 +.nf +npm install sax@latest +npm install @myorg/mypackage@latest +.fi +.RE +.IP \(bu 4 +\fBnpm install \[lB]<@scope>/\[rB]@\fR: +.P +Install the specified version of the package. This will fail if the version has not been published to the registry. +.P +Example: +.P +.RS 2 +.nf +npm install sax@0.1.1 +npm install @myorg/privatepackage@1.5.0 +.fi +.RE +.IP \(bu 4 +\fBnpm install \[lB]<@scope>/\[rB]@\fR: +.P +Install a version of the package matching the specified version range. This will follow the same rules for resolving dependencies described in \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR. +.P +Note that most version ranges must be put in quotes so that your shell will treat it as a single argument. +.P +Example: +.P +.RS 2 +.nf +npm install sax@">=0.1.0 <0.2.0" +npm install @myorg/privatepackage@"16 - 17" +.fi +.RE +.IP \(bu 4 +\fBnpm install \fR: +.P +Installs the package from the hosted git provider, cloning it with \fBgit\fR. For a full git remote url, only that URL will be attempted. +.P +.RS 2 +.nf +://\[lB]\[lB]:\[rB]@\[rB]\[lB]:\[rB]\[lB]:\[rB]\[lB]/\[rB]\[lB]# | #semver:\[rB] +.fi +.RE +.P +\fB\fR is one of \fBgit\fR, \fBgit+ssh\fR, \fBgit+http\fR, \fBgit+https\fR, or \fBgit+file\fR. +.P +If \fB#\fR is provided, it will be used to clone exactly that commit. If the commit-ish has the format \fB#semver:\fR, \fB\fR can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither \fB#\fR or \fB#semver:\fR is specified, then the default branch of the repository is used. +.P +If the repository makes use of submodules, those submodules will be cloned as well. +.P +If the package being installed contains a \fBprepare\fR script, its \fBdependencies\fR and \fBdevDependencies\fR will be installed, and the prepare script will be run, before the package is packaged and installed. +.P +The following git environment variables are recognized by npm and will be added to the environment when running git: +.RS 4 +.IP \(bu 4 +\fBGIT_ASKPASS\fR +.IP \(bu 4 +\fBGIT_EXEC_PATH\fR +.IP \(bu 4 +\fBGIT_PROXY_COMMAND\fR +.IP \(bu 4 +\fBGIT_SSH\fR +.IP \(bu 4 +\fBGIT_SSH_COMMAND\fR +.IP \(bu 4 +\fBGIT_SSL_CAINFO\fR +.IP \(bu 4 +\fBGIT_SSL_NO_VERIFY\fR +.RE 0 + +.P +See the git man page for details. +.P +Examples: +.P +.RS 2 +.nf +npm install git+ssh://git@github.com:npm/cli.git#v1.0.27 +npm install git+ssh://git@github.com:npm/cli#pull/273 +npm install git+ssh://git@github.com:npm/cli#semver:^5.0 +npm install git+https://isaacs@github.com/npm/cli.git +npm install git://github.com/npm/cli.git#v1.0.27 +GIT_SSH_COMMAND='ssh -i ~/.ssh/custom_ident' npm install git+ssh://git@github.com:npm/cli.git +.fi +.RE +.IP \(bu 4 +\fBnpm install /\[lB]#\[rB]\fR: +.IP \(bu 4 +\fBnpm install github:/\[lB]#\[rB]\fR: +.P +Install the package at \fBhttps://github.com/githubname/githubrepo\fR by attempting to clone it using \fBgit\fR. +.P +If \fB#\fR is provided, it will be used to clone exactly that commit. If the commit-ish has the format \fB#semver:\fR, \fB\fR can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither \fB#\fR or \fB#semver:\fR is specified, then the default branch is used. +.P +As with regular git dependencies, \fBdependencies\fR and \fBdevDependencies\fR will be installed if the package has a \fBprepare\fR script before the package is done installing. +.P +Examples: +.P +.RS 2 +.nf +npm install mygithubuser/myproject +npm install github:mygithubuser/myproject +.fi +.RE +.IP \(bu 4 +\fBnpm install gist:\[lB]/\[rB]\[lB]#|#semver:\[rB]\fR: +.P +Install the package at \fBhttps://gist.github.com/gistID\fR by attempting to clone it using \fBgit\fR. The GitHub username associated with the gist is optional and will not be saved in \fBpackage.json\fR. +.P +As with regular git dependencies, \fBdependencies\fR and \fBdevDependencies\fR will be installed if the package has a \fBprepare\fR script before the package is done installing. +.P +Example: +.P +.RS 2 +.nf +npm install gist:101a11beef +.fi +.RE +.IP \(bu 4 +\fBnpm install bitbucket:/\[lB]#\[rB]\fR: +.P +Install the package at \fBhttps://bitbucket.org/bitbucketname/bitbucketrepo\fR by attempting to clone it using \fBgit\fR. +.P +If \fB#\fR is provided, it will be used to clone exactly that commit. If the commit-ish has the format \fB#semver:\fR, \fB\fR can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither \fB#\fR or \fB#semver:\fR is specified, then \fBmaster\fR is used. +.P +As with regular git dependencies, \fBdependencies\fR and \fBdevDependencies\fR will be installed if the package has a \fBprepare\fR script before the package is done installing. +.P +Example: +.P +.RS 2 +.nf +npm install bitbucket:mybitbucketuser/myproject +.fi +.RE +.IP \(bu 4 +\fBnpm install gitlab:/\[lB]#\[rB]\fR: +.P +Install the package at \fBhttps://gitlab.com/gitlabname/gitlabrepo\fR by attempting to clone it using \fBgit\fR. +.P +If \fB#\fR is provided, it will be used to clone exactly that commit. If the commit-ish has the format \fB#semver:\fR, \fB\fR can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither \fB#\fR or \fB#semver:\fR is specified, then \fBmaster\fR is used. +.P +As with regular git dependencies, \fBdependencies\fR and \fBdevDependencies\fR will be installed if the package has a \fBprepare\fR script before the package is done installing. +.P +Example: +.P +.RS 2 +.nf +npm install gitlab:mygitlabuser/myproject +npm install gitlab:myusr/myproj#semver:^5.0 +.fi +.RE +.RE 0 + +.P +You may combine multiple arguments and even multiple types of arguments. For example: +.P +.RS 2 +.nf +npm install sax@">=0.1.0 <0.2.0" bench supervisor +.fi +.RE +.P +The \fB--tag\fR argument will apply to all of the specified install targets. If a tag with the given name exists, the tagged version is preferred over newer versions. +.P +The \fB--dry-run\fR argument will report in the usual way what the install would have done without actually installing anything. +.P +The \fB--package-lock-only\fR argument will only update the \fBpackage-lock.json\fR, instead of checking \fBnode_modules\fR and downloading dependencies. +.P +The \fB-f\fR or \fB--force\fR argument will force npm to fetch remote resources even if a local copy exists on disk. +.P +.RS 2 +.nf +npm install sax --force +.fi +.RE +.SS "Configuration" +.P +See the npm help config help doc. Many of the configuration params have some effect on installation, since that's most of what npm does. +.P +These are some of the most common options related to installation. +.SS "\fBsave\fR" +.RS 0 +.IP \(bu 4 +Default: \fBtrue\fR unless when using \fBnpm update\fR where it defaults to \fBfalse\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Save installed packages to a \fBpackage.json\fR file as dependencies. +.P +When used with the \fBnpm rm\fR command, removes the dependency from \fBpackage.json\fR. +.P +Will also prevent writing to \fBpackage-lock.json\fR if set to \fBfalse\fR. +.SS "\fBsave-exact\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Dependencies saved to package.json will be configured with an exact version rather than using npm's default semver range operator. +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBinstall-strategy\fR" +.RS 0 +.IP \(bu 4 +Default: "hoisted" +.IP \(bu 4 +Type: "hoisted", "nested", "shallow", or "linked" +.RE 0 + +.P +Sets the strategy for installing packages in node_modules. hoisted (default): Install non-duplicated in top-level, and duplicated as necessary within directory structure. nested: (formerly --legacy-bundling) install in place, no hoisting. shallow (formerly --global-style) only install direct deps at top-level. linked: (experimental) install in node_modules/.store, link in place, unhoisted. +.SS "\fBlegacy-bundling\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=nested\fR +.RE 0 + +.P +Instead of hoisting package installs in \fBnode_modules\fR, install packages in the same manner that they are depended on. This may cause very deep directory structures and duplicate package installs as there is no de-duplicating. Sets \fB--install-strategy=nested\fR. +.SS "\fBglobal-style\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=shallow\fR +.RE 0 + +.P +Only install direct dependencies in the top level \fBnode_modules\fR, but hoist on deeper dependencies. Sets \fB--install-strategy=shallow\fR. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBstrict-peer-deps\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to \fBtrue\fR, and \fB--legacy-peer-deps\fR is not set, then \fIany\fR conflicting \fBpeerDependencies\fR will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships. +.P +By default, conflicting \fBpeerDependencies\fR deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's \fBpeerDependencies\fR object. +.P +When such an override is performed, a warning is printed, explaining the conflict and the packages involved. If \fB--strict-peer-deps\fR is set, then this warning is treated as a failure. +.SS "\fBprefer-dedupe\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Prefer to deduplicate packages if possible, rather than choosing a newer version of a dependency. +.SS "\fBpackage-lock\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to false, then ignore \fBpackage-lock.json\fR files when installing. This will also prevent \fIwriting\fR \fBpackage-lock.json\fR if \fBsave\fR is true. +.SS "\fBpackage-lock-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, the current operation will only use the \fBpackage-lock.json\fR, ignoring \fBnode_modules\fR. +.P +For \fBupdate\fR this means only the \fBpackage-lock.json\fR will be updated, instead of checking \fBnode_modules\fR and downloading dependencies. +.P +For \fBlist\fR this means the output will be based on the tree described by the \fBpackage-lock.json\fR, rather than the contents of \fBnode_modules\fR. +.SS "\fBforeground-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process. +.P +Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBaudit\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for npm help audit for details on what is submitted. +.SS "\fBbin-links\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables. +.P +Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. +.SS "\fBfund\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" displays the message at the end of each \fBnpm install\fR acknowledging the number of dependencies looking for funding. See npm help fund for details. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBcpu\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +Override CPU architecture of native modules to install. Acceptable values are same as \fBcpu\fR field of package.json, which comes from \fBprocess.arch\fR. +.SS "\fBos\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +Override OS of native modules to install. Acceptable values are same as \fBos\fR field of package.json, which comes from \fBprocess.platform\fR. +.SS "\fBlibc\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +Override libc of native modules to install. Acceptable values are same as \fBlibc\fR field of package.json +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "Algorithm" +.P +Given a \fBpackage{dep}\fR structure: \fBA{B,C}, B{C}, C{D}\fR, the npm install algorithm produces: +.P +.RS 2 +.nf +A ++-- B ++-- C ++-- D +.fi +.RE +.P +That is, the dependency from B to C is satisfied by the fact that A already caused C to be installed at a higher level. D is still installed at the top level because nothing conflicts with it. +.P +For \fBA{B,C}, B{C,D@1}, C{D@2}\fR, this algorithm produces: +.P +.RS 2 +.nf +A ++-- B ++-- C + `-- D@2 ++-- D@1 +.fi +.RE +.P +Because B's D@1 will be installed in the top-level, C now has to install D@2 privately for itself. This algorithm is deterministic, but different trees may be produced if two dependencies are requested for installation in a different order. +.P +See npm help folders for a more detailed description of the specific folder structures that npm creates. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help update +.IP \(bu 4 +npm help audit +.IP \(bu 4 +npm help fund +.IP \(bu 4 +npm help link +.IP \(bu 4 +npm help rebuild +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help dist-tag +.IP \(bu 4 +npm help uninstall +.IP \(bu 4 +npm help shrinkwrap +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help workspaces +.RE 0 diff --git a/node_modules/npm/man/man1/npm-link.1 b/node_modules/npm/man/man1/npm-link.1 new file mode 100644 index 00000000..0ed6887d --- /dev/null +++ b/node_modules/npm/man/man1/npm-link.1 @@ -0,0 +1,355 @@ +.TH "NPM-LINK" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-link\fR - Symlink a package folder +.SS "Synopsis" +.P +.RS 2 +.nf +npm link \[lB]\[rB] + +alias: ln +.fi +.RE +.SS "Description" +.P +This is handy for installing your own stuff, so that you can work on it and test iteratively without having to continually rebuild. +.P +Package linking is a two-step process. +.P +First, \fBnpm link\fR in a package folder with no arguments will create a symlink in the global folder \fB{prefix}/lib/node_modules/\fR that links to the package where the \fBnpm link\fR command was executed. It will also link any bins in the package to \fB{prefix}/bin/{name}\fR. Note that \fBnpm link\fR uses the global prefix (see \fBnpm prefix -g\fR for its value). +.P +Next, in some other location, \fBnpm link package-name\fR will create a symbolic link from globally-installed \fBpackage-name\fR to \fBnode_modules/\fR of the current folder. +.P +Note that \fBpackage-name\fR is taken from \fBpackage.json\fR, \fInot\fR from the directory name. +.P +The package name can be optionally prefixed with a scope. See npm help scope. The scope must be preceded by an @-symbol and followed by a slash. +.P +When creating tarballs for \fBnpm publish\fR, the linked packages are "snapshotted" to their current state by resolving the symbolic links, if they are included in \fBbundleDependencies\fR. +.P +For example: +.P +.RS 2 +.nf +cd ~/projects/node-redis # go into the package directory +npm link # creates global link +cd ~/projects/node-bloggy # go into some other package directory. +npm link redis # link-install the package +.fi +.RE +.P +Now, any changes to \fB~/projects/node-redis\fR will be reflected in \fB~/projects/node-bloggy/node_modules/node-redis/\fR. Note that the link should be to the package name, not the directory name for that package. +.P +You may also shortcut the two steps in one. For example, to do the above use-case in a shorter way: +.P +.RS 2 +.nf +cd ~/projects/node-bloggy # go into the dir of your main project +npm link ../node-redis # link the dir of your dependency +.fi +.RE +.P +The second line is the equivalent of doing: +.P +.RS 2 +.nf +(cd ../node-redis; npm link) +npm link redis +.fi +.RE +.P +That is, it first creates a global link, and then links the global installation target into your project's \fBnode_modules\fR folder. +.P +Note that in this case, you are referring to the directory name, \fBnode-redis\fR, rather than the package name \fBredis\fR. +.P +If your linked package is scoped (see npm help scope) your link command must include that scope, e.g. +.P +.RS 2 +.nf +npm link @myorg/privatepackage +.fi +.RE +.SS "Caveat" +.P +Note that package dependencies linked in this way are \fInot\fR saved to \fBpackage.json\fR by default, on the assumption that the intention is to have a link stand in for a regular non-link dependency. Otherwise, for example, if you depend on \fBredis@^3.0.1\fR, and ran \fBnpm link redis\fR, it would replace the \fB^3.0.1\fR dependency with \fBfile:../path/to/node-redis\fR, which you probably don't want! Additionally, other users or developers on your project would run into issues if they do not have their folders set up exactly the same as yours. +.P +If you are adding a \fInew\fR dependency as a link, you should add it to the relevant metadata by running \fBnpm install --package-lock-only\fR. +.P +If you \fIwant\fR to save the \fBfile:\fR reference in your \fBpackage.json\fR and \fBpackage-lock.json\fR files, you can use \fBnpm link --save\fR to do so. +.SS "Workspace Usage" +.P +\fBnpm link --workspace \fR will link the relevant package as a dependency of the specified workspace(s). Note that It may actually be linked into the parent project's \fBnode_modules\fR folder, if there are no conflicting dependencies. +.P +\fBnpm link --workspace \fR will create a global link to the specified workspace(s). +.SS "Configuration" +.SS "\fBsave\fR" +.RS 0 +.IP \(bu 4 +Default: \fBtrue\fR unless when using \fBnpm update\fR where it defaults to \fBfalse\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Save installed packages to a \fBpackage.json\fR file as dependencies. +.P +When used with the \fBnpm rm\fR command, removes the dependency from \fBpackage.json\fR. +.P +Will also prevent writing to \fBpackage-lock.json\fR if set to \fBfalse\fR. +.SS "\fBsave-exact\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Dependencies saved to package.json will be configured with an exact version rather than using npm's default semver range operator. +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBinstall-strategy\fR" +.RS 0 +.IP \(bu 4 +Default: "hoisted" +.IP \(bu 4 +Type: "hoisted", "nested", "shallow", or "linked" +.RE 0 + +.P +Sets the strategy for installing packages in node_modules. hoisted (default): Install non-duplicated in top-level, and duplicated as necessary within directory structure. nested: (formerly --legacy-bundling) install in place, no hoisting. shallow (formerly --global-style) only install direct deps at top-level. linked: (experimental) install in node_modules/.store, link in place, unhoisted. +.SS "\fBlegacy-bundling\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=nested\fR +.RE 0 + +.P +Instead of hoisting package installs in \fBnode_modules\fR, install packages in the same manner that they are depended on. This may cause very deep directory structures and duplicate package installs as there is no de-duplicating. Sets \fB--install-strategy=nested\fR. +.SS "\fBglobal-style\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=shallow\fR +.RE 0 + +.P +Only install direct dependencies in the top level \fBnode_modules\fR, but hoist on deeper dependencies. Sets \fB--install-strategy=shallow\fR. +.SS "\fBstrict-peer-deps\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to \fBtrue\fR, and \fB--legacy-peer-deps\fR is not set, then \fIany\fR conflicting \fBpeerDependencies\fR will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships. +.P +By default, conflicting \fBpeerDependencies\fR deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's \fBpeerDependencies\fR object. +.P +When such an override is performed, a warning is printed, explaining the conflict and the packages involved. If \fB--strict-peer-deps\fR is set, then this warning is treated as a failure. +.SS "\fBpackage-lock\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to false, then ignore \fBpackage-lock.json\fR files when installing. This will also prevent \fIwriting\fR \fBpackage-lock.json\fR if \fBsave\fR is true. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBaudit\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for npm help audit for details on what is submitted. +.SS "\fBbin-links\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables. +.P +Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. +.SS "\fBfund\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" displays the message at the end of each \fBnpm install\fR acknowledging the number of dependencies looking for funding. See npm help fund for details. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help developers +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.RE 0 diff --git a/node_modules/npm/man/man1/npm-login.1 b/node_modules/npm/man/man1/npm-login.1 new file mode 100644 index 00000000..e7e7cc4c --- /dev/null +++ b/node_modules/npm/man/man1/npm-login.1 @@ -0,0 +1,95 @@ +.TH "NPM-LOGIN" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-login\fR - Login to a registry user account +.SS "Synopsis" +.P +.RS 2 +.nf +npm login +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Verify a user in the specified registry, and save the credentials to the \fB.npmrc\fR file. If no registry is specified, the default registry will be used (see npm help config). +.P +When using \fBlegacy\fR for your \fBauth-type\fR, the username and password, are read in from prompts. +.P +To reset your password, go to \fI\(lahttps://www.npmjs.com/forgot\(ra\fR +.P +To change your email address, go to \fI\(lahttps://www.npmjs.com/email-edit\(ra\fR +.P +You may use this command multiple times with the same user account to authorize on a new machine. When authenticating on a new machine, the username, password and email address must all match with your existing record. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBscope\fR" +.RS 0 +.IP \(bu 4 +Default: the scope of the current project, if any, or "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Associate an operation with a scope for a scoped registry. +.P +Useful when logging in to or out of a private registry: +.P +.RS 2 +.nf +# log in, linking the scope to the custom registry +npm login --scope=@mycorp --registry=https://registry.mycorp.com + +# log out, removing the link and the auth token +npm logout --scope=@mycorp +.fi +.RE +.P +This will cause \fB@mycorp\fR to be mapped to the registry for future installation of packages specified according to the pattern \fB@mycorp/package\fR. +.P +This will also cause \fBnpm init\fR to create a scoped package. +.P +.RS 2 +.nf +# accept all defaults, and create a package named "@foo/whatever", +# instead of just named "whatever" +npm init --scope=@foo --yes +.fi +.RE +.SS "\fBauth-type\fR" +.RS 0 +.IP \(bu 4 +Default: "web" +.IP \(bu 4 +Type: "legacy" or "web" +.RE 0 + +.P +What authentication strategy to use with \fBlogin\fR. Note that if an \fBotp\fR config is given, this value will always be set to \fBlegacy\fR. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help owner +.IP \(bu 4 +npm help whoami +.IP \(bu 4 +npm help token +.IP \(bu 4 +npm help profile +.RE 0 diff --git a/node_modules/npm/man/man1/npm-logout.1 b/node_modules/npm/man/man1/npm-logout.1 new file mode 100644 index 00000000..97d75001 --- /dev/null +++ b/node_modules/npm/man/man1/npm-logout.1 @@ -0,0 +1,75 @@ +.TH "NPM-LOGOUT" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-logout\fR - Log out of the registry +.SS "Synopsis" +.P +.RS 2 +.nf +npm logout +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +When logged into a registry that supports token-based authentication, tell the server to end this token's session. This will invalidate the token everywhere you're using it, not just for the current environment. +.P +When logged into a legacy registry that uses username and password authentication, this will clear the credentials in your user configuration. In this case, it will \fIonly\fR affect the current environment. +.P +If \fB--scope\fR is provided, this will find the credentials for the registry connected to that scope, if set. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBscope\fR" +.RS 0 +.IP \(bu 4 +Default: the scope of the current project, if any, or "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Associate an operation with a scope for a scoped registry. +.P +Useful when logging in to or out of a private registry: +.P +.RS 2 +.nf +# log in, linking the scope to the custom registry +npm login --scope=@mycorp --registry=https://registry.mycorp.com + +# log out, removing the link and the auth token +npm logout --scope=@mycorp +.fi +.RE +.P +This will cause \fB@mycorp\fR to be mapped to the registry for future installation of packages specified according to the pattern \fB@mycorp/package\fR. +.P +This will also cause \fBnpm init\fR to create a scoped package. +.P +.RS 2 +.nf +# accept all defaults, and create a package named "@foo/whatever", +# instead of just named "whatever" +npm init --scope=@foo --yes +.fi +.RE +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help adduser +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help whoami +.RE 0 diff --git a/node_modules/npm/man/man1/npm-ls.1 b/node_modules/npm/man/man1/npm-ls.1 new file mode 100644 index 00000000..15e44a19 --- /dev/null +++ b/node_modules/npm/man/man1/npm-ls.1 @@ -0,0 +1,271 @@ +.TH "NPM-LS" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-ls\fR - List installed packages +.SS "Synopsis" +.P +.RS 2 +.nf +npm ls + +alias: list +.fi +.RE +.SS "Description" +.P +This command will print to stdout all the versions of packages that are installed, as well as their dependencies when \fB--all\fR is specified, in a tree structure. +.P +Note: to get a "bottoms up" view of why a given package is included in the tree at all, use npm help explain. +.P +Positional arguments are \fBname@version-range\fR identifiers, which will limit the results to only the paths to the packages named. Note that nested packages will \fIalso\fR show the paths to the specified packages. For example, running \fBnpm ls promzard\fR in npm's source tree will show: +.P +.RS 2 +.nf +npm@11.0.0 /path/to/npm +└─┬ init-package-json@0.0.4 + └── promzard@0.1.5 +.fi +.RE +.P +It will print out extraneous, missing, and invalid packages. +.P +If a project specifies git urls for dependencies these are shown in parentheses after the \fBname@version\fR to make it easier for users to recognize potential forks of a project. +.P +The tree shown is the logical dependency tree, based on package dependencies, not the physical layout of your \fBnode_modules\fR folder. +.P +When run as \fBll\fR or \fBla\fR, it shows extended information by default. +.SS "Configuration" +.SS "\fBall\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When running \fBnpm outdated\fR and \fBnpm ls\fR, setting \fB--all\fR will show all outdated or installed packages, rather than only those directly depended upon by the current project. +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBlong\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Show extended information in \fBls\fR, \fBsearch\fR, and \fBhelp-search\fR. +.SS "\fBparseable\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Output parseable results from commands that write to standard output. For \fBnpm search\fR, this will be tab-separated table format. +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBdepth\fR" +.RS 0 +.IP \(bu 4 +Default: \fBInfinity\fR if \fB--all\fR is set, otherwise \fB1\fR +.IP \(bu 4 +Type: null or Number +.RE 0 + +.P +The depth to go when recursing packages for \fBnpm ls\fR. +.P +If not set, \fBnpm ls\fR will show only the immediate dependencies of the root project. If \fB--all\fR is set, then npm will show all dependencies by default. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBlink\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Used with \fBnpm ls\fR, limiting output to only those packages that are linked. +.SS "\fBpackage-lock-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, the current operation will only use the \fBpackage-lock.json\fR, ignoring \fBnode_modules\fR. +.P +For \fBupdate\fR this means only the \fBpackage-lock.json\fR will be updated, instead of checking \fBnode_modules\fR and downloading dependencies. +.P +For \fBlist\fR this means the output will be based on the tree described by the \fBpackage-lock.json\fR, rather than the contents of \fBnode_modules\fR. +.SS "\fBunicode\fR" +.RS 0 +.IP \(bu 4 +Default: false on windows, true on mac/unix systems with a unicode locale, as defined by the \fBLC_ALL\fR, \fBLC_CTYPE\fR, or \fBLANG\fR environment variables. +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help explain +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help explain +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help link +.IP \(bu 4 +npm help prune +.IP \(bu 4 +npm help outdated +.IP \(bu 4 +npm help update +.RE 0 diff --git a/node_modules/npm/man/man1/npm-org.1 b/node_modules/npm/man/man1/npm-org.1 new file mode 100644 index 00000000..daca7825 --- /dev/null +++ b/node_modules/npm/man/man1/npm-org.1 @@ -0,0 +1,125 @@ +.TH "NPM-ORG" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-org\fR - Manage orgs +.SS "Synopsis" +.P +.RS 2 +.nf +npm org set orgname username \[lB]developer | admin | owner\[rB] +npm org rm orgname username +npm org ls orgname \[lB]\[rB] + +alias: ogr +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Example" +.P +Add a new developer to an org: +.P +.RS 2 +.nf +$ npm org set my-org @mx-smith +.fi +.RE +.P +Add a new admin to an org (or change a developer to an admin): +.P +.RS 2 +.nf +$ npm org set my-org @mx-santos admin +.fi +.RE +.P +Remove a user from an org: +.P +.RS 2 +.nf +$ npm org rm my-org mx-santos +.fi +.RE +.P +List all users in an org: +.P +.RS 2 +.nf +$ npm org ls my-org +.fi +.RE +.P +List all users in JSON format: +.P +.RS 2 +.nf +$ npm org ls my-org --json +.fi +.RE +.P +See what role a user has in an org: +.P +.RS 2 +.nf +$ npm org ls my-org @mx-santos +.fi +.RE +.SS "Description" +.P +You can use the \fBnpm org\fR commands to manage and view users of an organization. It supports adding and removing users, changing their roles, listing them, and finding specific ones and their roles. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBparseable\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Output parseable results from commands that write to standard output. For \fBnpm search\fR, this will be tab-separated table format. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "using orgs" +.IP \(bu 4 +\fBDocumentation on npm Orgs\fR \fI\(lahttps://docs.npmjs.com/orgs/\(ra\fR +.RE 0 diff --git a/node_modules/npm/man/man1/npm-outdated.1 b/node_modules/npm/man/man1/npm-outdated.1 new file mode 100644 index 00000000..aab4bdff --- /dev/null +++ b/node_modules/npm/man/man1/npm-outdated.1 @@ -0,0 +1,182 @@ +.TH "NPM-OUTDATED" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-outdated\fR - Check for outdated packages +.SS "Synopsis" +.P +.RS 2 +.nf +npm outdated \[lB] ...\[rB] +.fi +.RE +.SS "Description" +.P +This command will check the registry to see if any (or, specific) installed packages are currently outdated. +.P +By default, only the direct dependencies of the root project and direct dependencies of your configured \fIworkspaces\fR are shown. Use \fB--all\fR to find all outdated meta-dependencies as well. +.P +In the output: +.RS 0 +.IP \(bu 4 +\fBwanted\fR is the maximum version of the package that satisfies the semver range specified in \fBpackage.json\fR. If there's no available semver range (i.e. you're running \fBnpm outdated --global\fR, or the package isn't included in \fBpackage.json\fR), then \fBwanted\fR shows the currently-installed version. +.IP \(bu 4 +\fBlatest\fR is the version of the package tagged as latest in the registry. Running \fBnpm publish\fR with no special configuration will publish the package with a dist-tag of \fBlatest\fR. This may or may not be the maximum version of the package, or the most-recently published version of the package, depending on how the package's developer manages the latest npm help dist-tag. +.IP \(bu 4 +\fBlocation\fR is where in the physical tree the package is located. +.IP \(bu 4 +\fBdepended by\fR shows which package depends on the displayed dependency +.IP \(bu 4 +\fBpackage type\fR (when using \fB--long\fR / \fB-l\fR) tells you whether this package is a \fBdependency\fR or a dev/peer/optional dependency. Packages not included in \fBpackage.json\fR are always marked \fBdependencies\fR. +.IP \(bu 4 +\fBhomepage\fR (when using \fB--long\fR / \fB-l\fR) is the \fBhomepage\fR value contained in the package's packument +.IP \(bu 4 +Red means there's a newer version matching your semver requirements, so you should update now. +.IP \(bu 4 +Yellow indicates that there's a newer version \fIabove\fR your semver requirements (usually new major, or new 0.x minor) so proceed with caution. +.RE 0 + +.SS "An example" +.P +.RS 2 +.nf +$ npm outdated +Package Current Wanted Latest Location Depended by +glob 5.0.15 5.0.15 6.0.1 node_modules/glob dependent-package-name +nothingness 0.0.3 git git node_modules/nothingness dependent-package-name +npm 3.5.1 3.5.2 3.5.1 node_modules/npm dependent-package-name +local-dev 0.0.3 linked linked local-dev dependent-package-name +once 1.3.2 1.3.3 1.3.3 node_modules/once dependent-package-name +.fi +.RE +.P +With these \fBdependencies\fR: +.P +.RS 2 +.nf +{ + "glob": "^5.0.15", + "nothingness": "github:othiym23/nothingness#master", + "npm": "^3.5.1", + "once": "^1.3.1" +} +.fi +.RE +.P +A few things to note: +.RS 0 +.IP \(bu 4 +\fBglob\fR requires \fB^5\fR, which prevents npm from installing \fBglob@6\fR, which is outside the semver range. +.IP \(bu 4 +Git dependencies will always be reinstalled, because of how they're specified. The installed committish might satisfy the dependency specifier (if it's something immutable, like a commit SHA), or it might not, so \fBnpm outdated\fR and \fBnpm update\fR have to fetch Git repos to check. This is why currently doing a reinstall of a Git dependency always forces a new clone and install. +.IP \(bu 4 +\fBnpm@3.5.2\fR is marked as "wanted", but "latest" is \fBnpm@3.5.1\fR because npm uses dist-tags to manage its \fBlatest\fR and \fBnext\fR release channels. \fBnpm update\fR will install the \fInewest\fR version, but \fBnpm install npm\fR (with no semver range) will install whatever's tagged as \fBlatest\fR. +.IP \(bu 4 +\fBonce\fR is just plain out of date. Reinstalling \fBnode_modules\fR from scratch or running \fBnpm update\fR will bring it up to spec. +.RE 0 + +.SS "Configuration" +.SS "\fBall\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When running \fBnpm outdated\fR and \fBnpm ls\fR, setting \fB--all\fR will show all outdated or installed packages, rather than only those directly depended upon by the current project. +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBlong\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Show extended information in \fBls\fR, \fBsearch\fR, and \fBhelp-search\fR. +.SS "\fBparseable\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Output parseable results from commands that write to standard output. For \fBnpm search\fR, this will be tab-separated table format. +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help update +.IP \(bu 4 +npm help dist-tag +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help workspaces +.RE 0 diff --git a/node_modules/npm/man/man1/npm-owner.1 b/node_modules/npm/man/man1/npm-owner.1 new file mode 100644 index 00000000..6cf50562 --- /dev/null +++ b/node_modules/npm/man/man1/npm-owner.1 @@ -0,0 +1,110 @@ +.TH "NPM-OWNER" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-owner\fR - Manage package owners +.SS "Synopsis" +.P +.RS 2 +.nf +npm owner add +npm owner rm +npm owner ls + +alias: author +.fi +.RE +.SS "Description" +.P +Manage ownership of published packages. +.RS 0 +.IP \(bu 4 +ls: List all the users who have access to modify a package and push new versions. Handy when you need to know who to bug for help. +.IP \(bu 4 +add: Add a new user as a maintainer of a package. This user is enabled to modify metadata, publish new versions, and add other owners. +.IP \(bu 4 +rm: Remove a user from the package owner list. This immediately revokes their privileges. +.RE 0 + +.P +Note that there is only one level of access. Either you can modify a package, or you can't. Future versions may contain more fine-grained access levels, but that is not implemented at this time. +.P +If you have two-factor authentication enabled with \fBauth-and-writes\fR (see npm help npm-profile) then you'll need to go through a second factor flow when changing ownership or include an otp on the command line with \fB--otp\fR. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help profile +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help adduser +.RE 0 diff --git a/node_modules/npm/man/man1/npm-pack.1 b/node_modules/npm/man/man1/npm-pack.1 new file mode 100644 index 00000000..a6aa420e --- /dev/null +++ b/node_modules/npm/man/man1/npm-pack.1 @@ -0,0 +1,142 @@ +.TH "NPM-PACK" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-pack\fR - Create a tarball from a package +.SS "Synopsis" +.P +.RS 2 +.nf +npm pack +.fi +.RE +.SS "Configuration" +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBpack-destination\fR" +.RS 0 +.IP \(bu 4 +Default: "." +.IP \(bu 4 +Type: String +.RE 0 + +.P +Directory in which \fBnpm pack\fR will save tarballs. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "Description" +.P +For anything that's installable (that is, a package folder, tarball, tarball url, git url, name@tag, name@version, name, or scoped name), this command will fetch it to the cache, copy the tarball to the current working directory as \fB-.tgz\fR, and then write the filenames out to stdout. +.P +If the same package is specified multiple times, then the file will be overwritten the second time. +.P +If no arguments are supplied, then npm packs the current package folder. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +\fBnpm-packlist package\fR \fI\(lahttp://npm.im/npm-packlist\(ra\fR +.IP \(bu 4 +npm help cache +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.RE 0 diff --git a/node_modules/npm/man/man1/npm-ping.1 b/node_modules/npm/man/man1/npm-ping.1 new file mode 100644 index 00000000..0f15acec --- /dev/null +++ b/node_modules/npm/man/man1/npm-ping.1 @@ -0,0 +1,52 @@ +.TH "NPM-PING" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-ping\fR - Ping npm registry +.SS "Synopsis" +.P +.RS 2 +.nf +npm ping +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Ping the configured or given npm registry and verify authentication. If it works it will output something like: +.P +.RS 2 +.nf +npm notice PING https://registry.npmjs.org/ +npm notice PONG 255ms +.fi +.RE +.P +otherwise you will get an error: +.P +.RS 2 +.nf +npm notice PING http://foo.com/ +npm ERR! code E404 +npm ERR! 404 Not Found - GET http://www.foo.com/-/ping?write=true +.fi +.RE +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help doctor +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.RE 0 diff --git a/node_modules/npm/man/man1/npm-pkg.1 b/node_modules/npm/man/man1/npm-pkg.1 new file mode 100644 index 00000000..cfab2291 --- /dev/null +++ b/node_modules/npm/man/man1/npm-pkg.1 @@ -0,0 +1,286 @@ +.TH "NPM-PKG" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-pkg\fR - Manages your package.json +.SS "Synopsis" +.P +.RS 2 +.nf +npm pkg set = \[lB]= ...\[rB] +npm pkg get \[lB] \[lB] ...\[rB]\[rB] +npm pkg delete \[lB] ...\[rB] +npm pkg set \[lB]\[lB]\[rB].= ...\[rB] +npm pkg set \[lB]\[lB]\[rB].= ...\[rB] +npm pkg fix +.fi +.RE +.SS "Description" +.P +A command that automates the management of \fBpackage.json\fR files. \fBnpm pkg\fR provide 3 different sub commands that allow you to modify or retrieve values for given object keys in your \fBpackage.json\fR. +.P +The syntax to retrieve and set fields is a dot separated representation of the nested object properties to be found within your \fBpackage.json\fR, it's the same notation used in npm help view to retrieve information from the registry manifest, below you can find more examples on how to use it. +.P +Returned values are always in \fBjson\fR format. +.RS 0 +.IP \(bu 4 +\fBnpm pkg get \fR +.P +Retrieves a value \fBkey\fR, defined in your \fBpackage.json\fR file. +.P +For example, in order to retrieve the name of the current package, you can run: +.P +.RS 2 +.nf +npm pkg get name +.fi +.RE +.P +It's also possible to retrieve multiple values at once: +.P +.RS 2 +.nf +npm pkg get name version +.fi +.RE +.P +You can view child fields by separating them with a period. To retrieve the value of a test \fBscript\fR value, you would run the following command: +.P +.RS 2 +.nf +npm pkg get scripts.test +.fi +.RE +.P +For fields that are arrays, requesting a non-numeric field will return all of the values from the objects in the list. For example, to get all the contributor emails for a package, you would run: +.P +.RS 2 +.nf +npm pkg get contributors.email +.fi +.RE +.P +You may also use numeric indices in square braces to specifically select an item in an array field. To just get the email address of the first contributor in the list, you can run: +.P +.RS 2 +.nf +npm pkg get contributors\[lB]0\[rB].email +.fi +.RE +.P +For complex fields you can also name a property in square brackets to specifically select a child field. This is especially helpful with the exports object: +.P +.RS 2 +.nf +npm pkg get "exports\[lB].\[rB].require" +.fi +.RE +.IP \(bu 4 +\fBnpm pkg set =\fR +.P +Sets a \fBvalue\fR in your \fBpackage.json\fR based on the \fBfield\fR value. When saving to your \fBpackage.json\fR file the same set of rules used during \fBnpm install\fR and other cli commands that touches the \fBpackage.json\fR file are used, making sure to respect the existing indentation and possibly applying some validation prior to saving values to the file. +.P +The same syntax used to retrieve values from your package can also be used to define new properties or overriding existing ones, below are some examples of how the dot separated syntax can be used to edit your \fBpackage.json\fR file. +.P +Defining a new bin named \fBmynewcommand\fR in your \fBpackage.json\fR that points to a file \fBcli.js\fR: +.P +.RS 2 +.nf +npm pkg set bin.mynewcommand=cli.js +.fi +.RE +.P +Setting multiple fields at once is also possible: +.P +.RS 2 +.nf +npm pkg set description='Awesome package' engines.node='>=10' +.fi +.RE +.P +It's also possible to add to array values, for example to add a new contributor entry: +.P +.RS 2 +.nf +npm pkg set contributors\[lB]0\[rB].name='Foo' contributors\[lB]0\[rB].email='foo@bar.ca' +.fi +.RE +.P +You may also append items to the end of an array using the special empty bracket notation: +.P +.RS 2 +.nf +npm pkg set contributors\[lB]\[rB].name='Foo' contributors\[lB]\[rB].name='Bar' +.fi +.RE +.P +It's also possible to parse values as json prior to saving them to your \fBpackage.json\fR file, for example in order to set a \fB"private": true\fR property: +.P +.RS 2 +.nf +npm pkg set private=true --json +.fi +.RE +.P +It also enables saving values as numbers: +.P +.RS 2 +.nf +npm pkg set tap.timeout=60 --json +.fi +.RE +.IP \(bu 4 +\fBnpm pkg delete \fR +.P +Deletes a \fBkey\fR from your \fBpackage.json\fR +.P +The same syntax used to set values from your package can also be used to remove existing ones. For example, in order to remove a script named build: +.P +.RS 2 +.nf +npm pkg delete scripts.build +.fi +.RE +.IP \(bu 4 +\fBnpm pkg fix\fR +.P +Auto corrects common errors in your \fBpackage.json\fR. npm already does this during \fBpublish\fR, which leads to subtle (mostly harmless) differences between the contents of your \fBpackage.json\fR file and the manifest that npm uses during installation. +.RE 0 + +.SS "Workspaces support" +.P +You can set/get/delete items across your configured workspaces by using the \fB\fBworkspace\fR\fR \fI\(la/using-npm/config#workspace\(ra\fR or \fB\fBworkspaces\fR\fR \fI\(la/using-npm/config#workspaces\(ra\fR config options. +.P +For example, setting a \fBfunding\fR value across all configured workspaces of a project: +.P +.RS 2 +.nf +npm pkg set funding=https://example.com --ws +.fi +.RE +.P +When using \fBnpm pkg get\fR to retrieve info from your configured workspaces, the returned result will be in a json format in which top level keys are the names of each workspace, the values of these keys will be the result values returned from each of the configured workspaces, e.g: +.P +.RS 2 +.nf +npm pkg get name version --ws +{ + "a": { + "name": "a", + "version": "1.0.0" + }, + "b": { + "name": "b", + "version": "1.0.0" + } +} +.fi +.RE +.SS "Configuration" +.SS "\fBforce\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input. +.RS 0 +.IP \(bu 4 +Allow clobbering non-npm files in global installs. +.IP \(bu 4 +Allow the \fBnpm version\fR command to work on an unclean git repository. +.IP \(bu 4 +Allow deleting the cache folder with \fBnpm cache clean\fR. +.IP \(bu 4 +Allow installing packages that have an \fBengines\fR declaration requiring a different version of npm. +.IP \(bu 4 +Allow installing packages that have an \fBengines\fR declaration requiring a different version of \fBnode\fR, even if \fB--engine-strict\fR is enabled. +.IP \(bu 4 +Allow \fBnpm audit fix\fR to install modules outside your stated dependency range (including SemVer-major changes). +.IP \(bu 4 +Allow unpublishing all versions of a published package. +.IP \(bu 4 +Allow conflicting peerDependencies to be installed in the root project. +.IP \(bu 4 +Implicitly set \fB--yes\fR during \fBnpm init\fR. +.IP \(bu 4 +Allow clobbering existing values in \fBnpm pkg\fR +.IP \(bu 4 +Allow unpublishing of entire packages (not just a single version). +.RE 0 + +.P +If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SH "SEE ALSO" +.RS 0 +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help init +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help workspaces +.RE 0 diff --git a/node_modules/npm/man/man1/npm-prefix.1 b/node_modules/npm/man/man1/npm-prefix.1 new file mode 100644 index 00000000..cac17c68 --- /dev/null +++ b/node_modules/npm/man/man1/npm-prefix.1 @@ -0,0 +1,63 @@ +.TH "NPM-PREFIX" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-prefix\fR - Display prefix +.SS "Synopsis" +.P +.RS 2 +.nf +npm prefix +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Print the local prefix to standard output. This is the closest parent directory to contain a \fBpackage.json\fR file or \fBnode_modules\fR directory, unless \fB-g\fR is also specified. +.P +If \fB-g\fR is specified, this will be the value of the global prefix. See npm help config for more detail. +.SS "Example" +.P +.RS 2 +.nf +npm prefix +/usr/local/projects/foo +.fi +.RE +.P +.RS 2 +.nf +npm prefix -g +/usr/local +.fi +.RE +.SS "Configuration" +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help root +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.RE 0 diff --git a/node_modules/npm/man/man1/npm-profile.1 b/node_modules/npm/man/man1/npm-profile.1 new file mode 100644 index 00000000..0eed3756 --- /dev/null +++ b/node_modules/npm/man/man1/npm-profile.1 @@ -0,0 +1,126 @@ +.TH "NPM-PROFILE" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-profile\fR - Change settings on your registry profile +.SS "Synopsis" +.P +.RS 2 +.nf +npm profile enable-2fa \[lB]auth-only|auth-and-writes\[rB] +npm profile disable-2fa +npm profile get \[lB]\[rB] +npm profile set +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Change your profile information on the registry. Note that this command depends on the registry implementation, so third-party registries may not support this interface. +.RS 0 +.IP \(bu 4 +\fBnpm profile get \[lB]\[rB]\fR: Display all of the properties of your profile, or one or more specific properties. It looks like: +.RE 0 + +.P +.RS 2 +.nf +name: example +email: e@example.com (verified) +two-factor auth: auth-and-writes +fullname: Example User +homepage: +freenode: +twitter: +github: +created: 2015-02-26T01:38:35.892Z +updated: 2017-10-02T21:29:45.922Z +.fi +.RE +.RS 0 +.IP \(bu 4 +\fBnpm profile set \fR: Set the value of a profile property. You can set the following properties this way: email, fullname, homepage, freenode, twitter, github +.IP \(bu 4 +\fBnpm profile set password\fR: Change your password. This is interactive, you'll be prompted for your current password and a new password. You'll also be prompted for an OTP if you have two-factor authentication enabled. +.IP \(bu 4 +\fBnpm profile enable-2fa \[lB]auth-and-writes|auth-only\[rB]\fR: Enables two-factor authentication. Defaults to \fBauth-and-writes\fR mode. Modes are: +.RS 4 +.IP \(bu 4 +\fBauth-only\fR: Require an OTP when logging in or making changes to your account's authentication. The OTP will be required on both the website and the command line. +.IP \(bu 4 +\fBauth-and-writes\fR: Requires an OTP at all the times \fBauth-only\fR does, and also requires one when publishing a module, setting the \fBlatest\fR dist-tag, or changing access via \fBnpm access\fR and \fBnpm owner\fR. +.RE 0 + +.IP \(bu 4 +\fBnpm profile disable-2fa\fR: Disables two-factor authentication. +.RE 0 + +.SS "Details" +.P +Some of these commands may not be available on non npmjs.com registries. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBparseable\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Output parseable results from commands that write to standard output. For \fBnpm search\fR, this will be tab-separated table format. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help adduser +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help owner +.IP \(bu 4 +npm help whoami +.IP \(bu 4 +npm help token +.RE 0 diff --git a/node_modules/npm/man/man1/npm-prune.1 b/node_modules/npm/man/man1/npm-prune.1 new file mode 100644 index 00000000..e01d867a --- /dev/null +++ b/node_modules/npm/man/man1/npm-prune.1 @@ -0,0 +1,184 @@ +.TH "NPM-PRUNE" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-prune\fR - Remove extraneous packages +.SS "Synopsis" +.P +.RS 2 +.nf +npm prune \[lB]\[lB]<@scope>/\[rB]...\[rB] +.fi +.RE +.SS "Description" +.P +This command removes "extraneous" packages. If a package name is provided, then only packages matching one of the supplied names are removed. +.P +Extraneous packages are those present in the \fBnode_modules\fR folder that are not listed as any package's dependency list. +.P +If the \fB--omit=dev\fR flag is specified or the \fBNODE_ENV\fR environment variable is set to \fBproduction\fR, this command will remove the packages specified in your \fBdevDependencies\fR. +.P +If the \fB--dry-run\fR flag is used then no changes will actually be made. +.P +If the \fB--json\fR flag is used, then the changes \fBnpm prune\fR made (or would have made with \fB--dry-run\fR) are printed as a JSON object. +.P +In normal operation, extraneous modules are pruned automatically, so you'll only need this command with the \fB--production\fR flag. However, in the real world, operation is not always "normal". When crashes or mistakes happen, this command can help clean up any resulting garbage. +.SS "Configuration" +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBforeground-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process. +.P +Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help uninstall +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help ls +.RE 0 diff --git a/node_modules/npm/man/man1/npm-publish.1 b/node_modules/npm/man/man1/npm-publish.1 new file mode 100644 index 00000000..f584ca31 --- /dev/null +++ b/node_modules/npm/man/man1/npm-publish.1 @@ -0,0 +1,226 @@ +.TH "NPM-PUBLISH" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-publish\fR - Publish a package +.SS "Synopsis" +.P +.RS 2 +.nf +npm publish +.fi +.RE +.SS "Description" +.P +Publishes a package to the registry so that it can be installed by name. +.P +By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a npm help scope in the name, combined with a scope-configured registry (see \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR). +.P +A \fBpackage\fR is interpreted the same way as other commands (like \fBnpm install\fR) and can be: +.RS 0 +.IP \(bu 4 +a) a folder containing a program described by a \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR file +.IP \(bu 4 +b) a gzipped tarball containing (a) +.IP \(bu 4 +c) a url that resolves to (b) +.IP \(bu 4 +d) a \fB@\fR that is published on the registry (see npm help registry) with (c) +.IP \(bu 4 +e) a \fB@\fR (see npm help dist-tag) that points to (d) +.IP \(bu 4 +f) a \fB\fR that has a "latest" tag satisfying (e) +.IP \(bu 4 +g) a \fB\fR that resolves to (a) +.RE 0 + +.P +The publish will fail if the package name and version combination already exists in the specified registry. +.P +Once a package is published with a given name and version, that specific name and version combination can never be used again, even if it is removed with npm help unpublish. +.P +As of \fBnpm@5\fR, both a sha1sum and an integrity field with a sha512sum of the tarball will be submitted to the registry during publication. Subsequent installs will use the strongest supported algorithm to verify downloads. +.P +Similar to \fB--dry-run\fR see npm help pack, which figures out the files to be included and packs them into a tarball to be uploaded to the registry. +.SS "Files included in package" +.P +To see what will be included in your package, run \fBnpm pack --dry-run\fR. All files are included by default, with the following exceptions: +.RS 0 +.IP \(bu 4 +Certain files that are relevant to package installation and distribution are always included. For example, \fBpackage.json\fR, \fBREADME.md\fR, \fBLICENSE\fR, and so on. +.IP \(bu 4 +If there is a "files" list in \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR, then only the files specified will be included. (If directories are specified, then they will be walked recursively and their contents included, subject to the same ignore rules.) +.IP \(bu 4 +If there is a \fB.gitignore\fR or \fB.npmignore\fR file, then ignored files in that and all child directories will be excluded from the package. If \fIboth\fR files exist, then the \fB.gitignore\fR is ignored, and only the \fB.npmignore\fR is used. +.P +\fB.npmignore\fR files follow the \fBsame pattern rules\fR \fI\(lahttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring\(ra\fR as \fB.gitignore\fR files +.IP \(bu 4 +If the file matches certain patterns, then it will \fInever\fR be included, unless explicitly added to the \fB"files"\fR list in \fBpackage.json\fR, or un-ignored with a \fB!\fR rule in a \fB.npmignore\fR or \fB.gitignore\fR file. +.IP \(bu 4 +Symbolic links are never included in npm packages. +.RE 0 + +.P +See npm help developers for full details on what's included in the published package, as well as details on how the package is built. +.P +See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for more info on what can and can't be ignored. +.SS "Configuration" +.SS "\fBtag\fR" +.RS 0 +.IP \(bu 4 +Default: "latest" +.IP \(bu 4 +Type: String +.RE 0 + +.P +If you ask npm to install a package and don't tell it a specific version, then it will install the specified tag. +.P +It is the tag added to the package@version specified in the \fBnpm dist-tag +add\fR command, if no explicit tag is given. +.P +When used by the \fBnpm diff\fR command, this is the tag used to fetch the tarball that will be compared with the local files by default. +.P +If used in the \fBnpm publish\fR command, this is the tag that will be added to the package submitted to the registry. +.SS "\fBaccess\fR" +.RS 0 +.IP \(bu 4 +Default: 'public' for new packages, existing packages it will not change the current level +.IP \(bu 4 +Type: null, "restricted", or "public" +.RE 0 + +.P +If you do not want your scoped package to be publicly viewable (and installable) set \fB--access=restricted\fR. +.P +Unscoped packages can not be set to \fBrestricted\fR. +.P +Note: This defaults to not changing the current access level for existing packages. Specifying a value of \fBrestricted\fR or \fBpublic\fR during publish will change the access for an existing package the same way that \fBnpm access set +status\fR would. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBprovenance\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When publishing from a supported cloud CI/CD system, the package will be publicly linked to where it was built and published from. +.P +This config can not be used with: \fBprovenance-file\fR +.SS "\fBprovenance-file\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: Path +.RE 0 + +.P +When publishing, the provenance bundle at the given path will be used. +.P +This config can not be used with: \fBprovenance\fR +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +\fBnpm-packlist package\fR \fI\(lahttp://npm.im/npm-packlist\(ra\fR +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help scope +.IP \(bu 4 +npm help adduser +.IP \(bu 4 +npm help owner +.IP \(bu 4 +npm help deprecate +.IP \(bu 4 +npm help dist-tag +.IP \(bu 4 +npm help pack +.IP \(bu 4 +npm help profile +.RE 0 diff --git a/node_modules/npm/man/man1/npm-query.1 b/node_modules/npm/man/man1/npm-query.1 new file mode 100644 index 00000000..83f5eb48 --- /dev/null +++ b/node_modules/npm/man/man1/npm-query.1 @@ -0,0 +1,281 @@ +.TH "NPM-QUERY" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-query\fR - Dependency selector query +.SS "Synopsis" +.P +.RS 2 +.nf +npm query +.fi +.RE +.SS "Description" +.P +The \fBnpm query\fR command allows for usage of css selectors in order to retrieve an array of dependency objects. +.SS "Piping npm query to other commands" +.P +.RS 2 +.nf +# find all dependencies with postinstall scripts & uninstall them +npm query ":attr(scripts, \[lB]postinstall\[rB])" | jq 'map(.name)|join("\[rs]n")' -r | xargs -I {} npm uninstall {} + +# find all git dependencies & explain who requires them +npm query ":type(git)" | jq 'map(.name)' | xargs -I {} npm why {} +.fi +.RE +.SS "Extended Use Cases & Queries" +.P +.RS 2 +.nf +// all deps +* + +// all direct deps +:root > * + +// direct production deps +:root > .prod + +// direct development deps +:root > .dev + +// any peer dep of a direct deps +:root > * > .peer + +// any workspace dep +.workspace + +// all workspaces that depend on another workspace +.workspace > .workspace + +// all workspaces that have peer deps +.workspace:has(.peer) + +// any dep named "lodash" +// equivalent to \[lB]name="lodash"\[rB] +#lodash + +// any deps named "lodash" & within semver range ^"1.2.3" +#lodash@^1.2.3 +// equivalent to... +\[lB]name="lodash"\[rB]:semver(^1.2.3) + +// get the hoisted node for a given semver range +#lodash@^1.2.3:not(:deduped) + +// querying deps with a specific version +#lodash@2.1.5 +// equivalent to... +\[lB]name="lodash"\[rB]\[lB]version="2.1.5"\[rB] + +// has any deps +:has(*) + +// deps with no other deps (ie. "leaf" nodes) +:empty + +// manually querying git dependencies +\[lB]repository^=github:\[rB], +\[lB]repository^=git:\[rB], +\[lB]repository^=https://github.com\[rB], +\[lB]repository^=http://github.com\[rB], +\[lB]repository^=https://github.com\[rB], +\[lB]repository^=+git:...\[rB] + +// querying for all git dependencies +:type(git) + +// get production dependencies that aren't also dev deps +.prod:not(.dev) + +// get dependencies with specific licenses +\[lB]license=MIT\[rB], \[lB]license=ISC\[rB] + +// find all packages that have @ruyadorno as a contributor +:attr(contributors, \[lB]email=ruyadorno@github.com\[rB]) +.fi +.RE +.SS "Example Response Output" +.RS 0 +.IP \(bu 4 +an array of dependency objects is returned which can contain multiple copies of the same package which may or may not have been linked or deduped +.RE 0 + +.P +.RS 2 +.nf +\[lB] + { + "name": "", + "version": "", + "description": "", + "homepage": "", + "bugs": {}, + "author": {}, + "license": {}, + "funding": {}, + "files": \[lB]\[rB], + "main": "", + "browser": "", + "bin": {}, + "man": \[lB]\[rB], + "directories": {}, + "repository": {}, + "scripts": {}, + "config": {}, + "dependencies": {}, + "devDependencies": {}, + "optionalDependencies": {}, + "bundledDependencies": {}, + "peerDependencies": {}, + "peerDependenciesMeta": {}, + "engines": {}, + "os": \[lB]\[rB], + "cpu": \[lB]\[rB], + "workspaces": {}, + "keywords": \[lB]\[rB], + ... + }, + ... +.fi +.RE +.SS "Expecting a certain number of results" +.P +One common use of \fBnpm query\fR is to make sure there is only one version of a certain dependency in your tree. This is especially common for ecosystems like that rely on \fBtypescript\fR where having state split across two different but identically-named packages causes bugs. You can use the \fB--expect-results\fR or \fB--expect-result-count\fR in your setup to ensure that npm will exit with an exit code if your tree doesn't look like you want it to. +.P +.RS 2 +.nf +$ npm query '#react' --expect-result-count=1 +.fi +.RE +.P +Perhaps you want to quickly check if there are any production dependencies that could be updated: +.P +.RS 2 +.nf +$ npm query ':root>:outdated(in-range).prod' --no-expect-results +.fi +.RE +.SS "Package lock only mode" +.P +If package-lock-only is enabled, only the information in the package lock (or shrinkwrap) is loaded. This means that information from the package.json files of your dependencies will not be included in the result set (e.g. description, homepage, engines). +.SS "Configuration" +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBpackage-lock-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, the current operation will only use the \fBpackage-lock.json\fR, ignoring \fBnode_modules\fR. +.P +For \fBupdate\fR this means only the \fBpackage-lock.json\fR will be updated, instead of checking \fBnode_modules\fR and downloading dependencies. +.P +For \fBlist\fR this means the output will be based on the tree described by the \fBpackage-lock.json\fR, rather than the contents of \fBnode_modules\fR. +.SS "\fBexpect-results\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Tells npm whether or not to expect results from the command. Can be either true (expect some results) or false (expect no results). +.P +This config can not be used with: \fBexpect-result-count\fR +.SS "\fBexpect-result-count\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Number +.RE 0 + +.P +Tells to expect a specific number of results from the command. +.P +This config can not be used with: \fBexpect-results\fR +.SH "SEE ALSO" +.RS 0 +.IP \(bu 4 +npm help "dependency selectors" +.RE 0 diff --git a/node_modules/npm/man/man1/npm-rebuild.1 b/node_modules/npm/man/man1/npm-rebuild.1 new file mode 100644 index 00000000..904ec74a --- /dev/null +++ b/node_modules/npm/man/man1/npm-rebuild.1 @@ -0,0 +1,178 @@ +.TH "NPM-REBUILD" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-rebuild\fR - Rebuild a package +.SS "Synopsis" +.P +.RS 2 +.nf +npm rebuild \[lB]\[rB] ...\[rB] + +alias: rb +.fi +.RE +.SS "Description" +.P +This command does the following: +.RS 0 +.IP 1. 4 +Execute lifecycle scripts (\fBpreinstall\fR, \fBinstall\fR, \fBpostinstall\fR, \fBprepare\fR) +.IP 2. 4 +Links bins depending on whether bin links are enabled +.RE 0 + +.P +This command is particularly useful in scenarios including but not limited to: +.RS 0 +.IP 1. 4 +Installing a new version of \fBnode.js\fR, where you need to recompile all your C++ add-ons with the updated binary. +.IP 2. 4 +Installing with \fB--ignore-scripts\fR and \fB--no-bin-links\fR, to explicitly choose which packages to build and/or link bins. +.RE 0 + +.P +If one or more package specs are provided, then only packages with a name and version matching one of the specifiers will be rebuilt. +.P +Usually, you should not need to run \fBnpm rebuild\fR as it is already done for you as part of npm install (unless you suppressed these steps with \fB--ignore-scripts\fR or \fB--no-bin-links\fR). +.P +If there is a \fBbinding.gyp\fR file in the root of your package, then npm will use a default install hook: +.P +.RS 2 +.nf +"scripts": { + "install": "node-gyp rebuild" +} +.fi +.RE +.P +This default behavior is suppressed if the \fBpackage.json\fR has its own \fBinstall\fR or \fBpreinstall\fR scripts. It is also suppressed if the package specifies \fB"gypfile": false\fR +.SS "Configuration" +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBbin-links\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables. +.P +Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. +.SS "\fBforeground-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process. +.P +Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help install +.RE 0 diff --git a/node_modules/npm/man/man1/npm-repo.1 b/node_modules/npm/man/man1/npm-repo.1 new file mode 100644 index 00000000..1536ae5d --- /dev/null +++ b/node_modules/npm/man/man1/npm-repo.1 @@ -0,0 +1,103 @@ +.TH "NPM-REPO" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-repo\fR - Open package repository page in the browser +.SS "Synopsis" +.P +.RS 2 +.nf +npm repo \[lB] \[lB] ...\[rB]\[rB] +.fi +.RE +.SS "Description" +.P +This command tries to guess at the likely location of a package's repository URL, and then tries to open it using the \fB\fB--browser\fR config\fR \fI\(la/using-npm/config#browser\(ra\fR param. If no package name is provided, it will search for a \fBpackage.json\fR in the current folder and use the \fBrepository\fR property. +.SS "Configuration" +.SS "\fBbrowser\fR" +.RS 0 +.IP \(bu 4 +Default: OS X: \fB"open"\fR, Windows: \fB"start"\fR, Others: \fB"xdg-open"\fR +.IP \(bu 4 +Type: null, Boolean, or String +.RE 0 + +.P +The browser that is called by npm commands to open websites. +.P +Set to \fBfalse\fR to suppress browser behavior and instead print urls to terminal. +.P +Set to \fBtrue\fR to use default system URL opener. +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help docs +.IP \(bu 4 +npm help config +.RE 0 diff --git a/node_modules/npm/man/man1/npm-restart.1 b/node_modules/npm/man/man1/npm-restart.1 new file mode 100644 index 00000000..c1f7d129 --- /dev/null +++ b/node_modules/npm/man/man1/npm-restart.1 @@ -0,0 +1,85 @@ +.TH "NPM-RESTART" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-restart\fR - Restart a package +.SS "Synopsis" +.P +.RS 2 +.nf +npm restart \[lB]-- \[rB] +.fi +.RE +.SS "Description" +.P +This restarts a project. It is equivalent to running \fBnpm run-script +restart\fR. +.P +If the current project has a \fB"restart"\fR script specified in \fBpackage.json\fR, then the following scripts will be run: +.RS 0 +.IP 1. 4 +prerestart +.IP 2. 4 +restart +.IP 3. 4 +postrestart +.RE 0 + +.P +If it does \fInot\fR have a \fB"restart"\fR script specified, but it does have \fBstop\fR and/or \fBstart\fR scripts, then the following scripts will be run: +.RS 0 +.IP 1. 4 +prerestart +.IP 2. 4 +prestop +.IP 3. 4 +stop +.IP 4. 4 +poststop +.IP 5. 4 +prestart +.IP 6. 4 +start +.IP 7. 4 +poststart +.IP 8. 4 +postrestart +.RE 0 + +.SS "Configuration" +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBscript-shell\fR" +.RS 0 +.IP \(bu 4 +Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +The shell to use for scripts run with the \fBnpm exec\fR, \fBnpm run\fR and \fBnpm +init \fR commands. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help run-script +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +npm help test +.IP \(bu 4 +npm help start +.IP \(bu 4 +npm help stop +.IP \(bu 4 +npm help restart +.RE 0 diff --git a/node_modules/npm/man/man1/npm-root.1 b/node_modules/npm/man/man1/npm-root.1 new file mode 100644 index 00000000..4f222a69 --- /dev/null +++ b/node_modules/npm/man/man1/npm-root.1 @@ -0,0 +1,56 @@ +.TH "NPM-ROOT" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-root\fR - Display npm root +.SS "Synopsis" +.P +.RS 2 +.nf +npm root +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Print the effective \fBnode_modules\fR folder to standard out. +.P +Useful for using npm in shell scripts that do things with the \fBnode_modules\fR folder. For example: +.P +.RS 2 +.nf +#!/bin/bash +global_node_modules="$(npm root --global)" +echo "Global packages installed in: ${global_node_modules}" +.fi +.RE +.SS "Configuration" +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help prefix +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.RE 0 diff --git a/node_modules/npm/man/man1/npm-run-script.1 b/node_modules/npm/man/man1/npm-run-script.1 new file mode 100644 index 00000000..303dd432 --- /dev/null +++ b/node_modules/npm/man/man1/npm-run-script.1 @@ -0,0 +1,234 @@ +.TH "NPM-RUN-SCRIPT" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-run-script\fR - Run arbitrary package scripts +.SS "Synopsis" +.P +.RS 2 +.nf +npm run-script \[lB]-- \[rB] + +aliases: run, rum, urn +.fi +.RE +.SS "Description" +.P +This runs an arbitrary command from a package's \fB"scripts"\fR object. If no \fB"command"\fR is provided, it will list the available scripts. +.P +\fBrun\[lB]-script\[rB]\fR is used by the test, start, restart, and stop commands, but can be called directly, as well. When the scripts in the package are printed out, they're separated into lifecycle (test, start, restart) and directly-run scripts. +.P +Any positional arguments are passed to the specified script. Use \fB--\fR to pass \fB-\fR-prefixed flags and options which would otherwise be parsed by npm. +.P +For example: +.P +.RS 2 +.nf +npm run test -- --grep="pattern" +.fi +.RE +.P +The arguments will only be passed to the script specified after \fBnpm run\fR and not to any \fBpre\fR or \fBpost\fR script. +.P +The \fBenv\fR script is a special built-in command that can be used to list environment variables that will be available to the script at runtime. If an "env" command is defined in your package, it will take precedence over the built-in. +.P +In addition to the shell's pre-existing \fBPATH\fR, \fBnpm run\fR adds \fBnode_modules/.bin\fR to the \fBPATH\fR provided to scripts. Any binaries provided by locally-installed dependencies can be used without the \fBnode_modules/.bin\fR prefix. For example, if there is a \fBdevDependency\fR on \fBtap\fR in your package, you should write: +.P +.RS 2 +.nf +"scripts": {"test": "tap test/*.js"} +.fi +.RE +.P +instead of +.P +.RS 2 +.nf +"scripts": {"test": "node_modules/.bin/tap test/*.js"} +.fi +.RE +.P +The actual shell your script is run within is platform dependent. By default, on Unix-like systems it is the \fB/bin/sh\fR command, on Windows it is \fBcmd.exe\fR. The actual shell referred to by \fB/bin/sh\fR also depends on the system. You can customize the shell with the \fB\fBscript-shell\fR config\fR \fI\(la/using-npm/config#script-shell\(ra\fR. +.P +Scripts are run from the root of the package folder, regardless of what the current working directory is when \fBnpm run\fR is called. If you want your script to use different behavior based on what subdirectory you're in, you can use the \fBINIT_CWD\fR environment variable, which holds the full path you were in when you ran \fBnpm run\fR. +.P +\fBnpm run\fR sets the \fBNODE\fR environment variable to the \fBnode\fR executable with which \fBnpm\fR is executed. +.P +If you try to run a script without having a \fBnode_modules\fR directory and it fails, you will be given a warning to run \fBnpm install\fR, just in case you've forgotten. +.SS "Workspaces support" +.P +You may use the \fB\fBworkspace\fR\fR \fI\(la/using-npm/config#workspace\(ra\fR or \fB\fBworkspaces\fR\fR \fI\(la/using-npm/config#workspaces\(ra\fR configs in order to run an arbitrary command from a package's \fB"scripts"\fR object in the context of the specified workspaces. If no \fB"command"\fR is provided, it will list the available scripts for each of these configured workspaces. +.P +Given a project with configured workspaces, e.g: +.P +.RS 2 +.nf +. ++-- package.json +`-- packages + +-- a + | `-- package.json + +-- b + | `-- package.json + `-- c + `-- package.json +.fi +.RE +.P +Assuming the workspace configuration is properly set up at the root level \fBpackage.json\fR file. e.g: +.P +.RS 2 +.nf +{ + "workspaces": \[lB] "./packages/*" \[rB] +} +.fi +.RE +.P +And that each of the configured workspaces has a configured \fBtest\fR script, we can run tests in all of them using the \fB\fBworkspaces\fR config\fR \fI\(la/using-npm/config#workspaces\(ra\fR: +.P +.RS 2 +.nf +npm test --workspaces +.fi +.RE +.SS "Filtering workspaces" +.P +It's also possible to run a script in a single workspace using the \fBworkspace\fR config along with a name or directory path: +.P +.RS 2 +.nf +npm test --workspace=a +.fi +.RE +.P +The \fBworkspace\fR config can also be specified multiple times in order to run a specific script in the context of multiple workspaces. When defining values for the \fBworkspace\fR config in the command line, it also possible to use \fB-w\fR as a shorthand, e.g: +.P +.RS 2 +.nf +npm test -w a -w b +.fi +.RE +.P +This last command will run \fBtest\fR in both \fB./packages/a\fR and \fB./packages/b\fR packages. +.SS "Configuration" +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBif-present\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm will not exit with an error code when \fBrun-script\fR is invoked for a script that isn't defined in the \fBscripts\fR section of \fBpackage.json\fR. This option can be used when it's desirable to optionally run a script when it's present and fail if the script fails. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup. +.P +This value is not exported to the environment for child processes. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBforeground-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process. +.P +Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging. +.SS "\fBscript-shell\fR" +.RS 0 +.IP \(bu 4 +Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +The shell to use for scripts run with the \fBnpm exec\fR, \fBnpm run\fR and \fBnpm +init \fR commands. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +npm help test +.IP \(bu 4 +npm help start +.IP \(bu 4 +npm help restart +.IP \(bu 4 +npm help stop +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help workspaces +.RE 0 diff --git a/node_modules/npm/man/man1/npm-sbom.1 b/node_modules/npm/man/man1/npm-sbom.1 new file mode 100644 index 00000000..9e33d7f2 --- /dev/null +++ b/node_modules/npm/man/man1/npm-sbom.1 @@ -0,0 +1,314 @@ +.TH "NPM-SBOM" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-sbom\fR - Generate a Software Bill of Materials (SBOM) +.SS "Synopsis" +.P +.RS 2 +.nf +npm sbom +.fi +.RE +.SS "Description" +.P +The \fBnpm sbom\fR command generates a Software Bill of Materials (SBOM) listing the dependencies for the current project. SBOMs can be generated in either \fBSPDX\fR \fI\(lahttps://spdx.dev/\(ra\fR or \fBCycloneDX\fR \fI\(lahttps://cyclonedx.org/\(ra\fR format. +.SS "Example CycloneDX SBOM" +.P +.RS 2 +.nf +{ + "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json", + "bomFormat": "CycloneDX", + "specVersion": "1.5", + "serialNumber": "urn:uuid:09f55116-97e1-49cf-b3b8-44d0207e7730", + "version": 1, + "metadata": { + "timestamp": "2023-09-01T00:00:00.001Z", + "lifecycles": \[lB] + { + "phase": "build" + } + \[rB], + "tools": \[lB] + { + "vendor": "npm", + "name": "cli", + "version": "10.1.0" + } + \[rB], + "component": { + "bom-ref": "simple@1.0.0", + "type": "library", + "name": "simple", + "version": "1.0.0", + "scope": "required", + "author": "John Doe", + "description": "simple react app", + "purl": "pkg:npm/simple@1.0.0", + "properties": \[lB] + { + "name": "cdx:npm:package:path", + "value": "" + } + \[rB], + "externalReferences": \[lB]\[rB], + "licenses": \[lB] + { + "license": { + "id": "MIT" + } + } + \[rB] + } + }, + "components": \[lB] + { + "bom-ref": "lodash@4.17.21", + "type": "library", + "name": "lodash", + "version": "4.17.21", + "scope": "required", + "author": "John-David Dalton", + "description": "Lodash modular utilities.", + "purl": "pkg:npm/lodash@4.17.21", + "properties": \[lB] + { + "name": "cdx:npm:package:path", + "value": "node_modules/lodash" + } + \[rB], + "externalReferences": \[lB] + { + "type": "distribution", + "url": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" + }, + { + "type": "vcs", + "url": "git+https://github.com/lodash/lodash.git" + }, + { + "type": "website", + "url": "https://lodash.com/" + }, + { + "type": "issue-tracker", + "url": "https://github.com/lodash/lodash/issues" + } + \[rB], + "hashes": \[lB] + { + "alg": "SHA-512", + "content": "bf690311ee7b95e713ba568322e3533f2dd1cb880b189e99d4edef13592b81764daec43e2c54c61d5c558dc5cfb35ecb85b65519e74026ff17675b6f8f916f4a" + } + \[rB], + "licenses": \[lB] + { + "license": { + "id": "MIT" + } + } + \[rB] + } + \[rB], + "dependencies": \[lB] + { + "ref": "simple@1.0.0", + "dependsOn": \[lB] + "lodash@4.17.21" + \[rB] + }, + { + "ref": "lodash@4.17.21", + "dependsOn": \[lB]\[rB] + } + \[rB] +} +.fi +.RE +.SS "Example SPDX SBOM" +.P +.RS 2 +.nf +{ + "spdxVersion": "SPDX-2.3", + "dataLicense": "CC0-1.0", + "SPDXID": "SPDXRef-DOCUMENT", + "name": "simple@1.0.0", + "documentNamespace": "http://spdx.org/spdxdocs/simple-1.0.0-bf81090e-8bbc-459d-bec9-abeb794e096a", + "creationInfo": { + "created": "2023-09-01T00:00:00.001Z", + "creators": \[lB] + "Tool: npm/cli-10.1.0" + \[rB] + }, + "documentDescribes": \[lB] + "SPDXRef-Package-simple-1.0.0" + \[rB], + "packages": \[lB] + { + "name": "simple", + "SPDXID": "SPDXRef-Package-simple-1.0.0", + "versionInfo": "1.0.0", + "packageFileName": "", + "description": "simple react app", + "primaryPackagePurpose": "LIBRARY", + "downloadLocation": "NOASSERTION", + "filesAnalyzed": false, + "homepage": "NOASSERTION", + "licenseDeclared": "MIT", + "externalRefs": \[lB] + { + "referenceCategory": "PACKAGE-MANAGER", + "referenceType": "purl", + "referenceLocator": "pkg:npm/simple@1.0.0" + } + \[rB] + }, + { + "name": "lodash", + "SPDXID": "SPDXRef-Package-lodash-4.17.21", + "versionInfo": "4.17.21", + "packageFileName": "node_modules/lodash", + "description": "Lodash modular utilities.", + "downloadLocation": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "filesAnalyzed": false, + "homepage": "https://lodash.com/", + "licenseDeclared": "MIT", + "externalRefs": \[lB] + { + "referenceCategory": "PACKAGE-MANAGER", + "referenceType": "purl", + "referenceLocator": "pkg:npm/lodash@4.17.21" + } + \[rB], + "checksums": \[lB] + { + "algorithm": "SHA512", + "checksumValue": "bf690311ee7b95e713ba568322e3533f2dd1cb880b189e99d4edef13592b81764daec43e2c54c61d5c558dc5cfb35ecb85b65519e74026ff17675b6f8f916f4a" + } + \[rB] + } + \[rB], + "relationships": \[lB] + { + "spdxElementId": "SPDXRef-DOCUMENT", + "relatedSpdxElement": "SPDXRef-Package-simple-1.0.0", + "relationshipType": "DESCRIBES" + }, + { + "spdxElementId": "SPDXRef-Package-simple-1.0.0", + "relatedSpdxElement": "SPDXRef-Package-lodash-4.17.21", + "relationshipType": "DEPENDS_ON" + } + \[rB] +} +.fi +.RE +.SS "Package lock only mode" +.P +If package-lock-only is enabled, only the information in the package lock (or shrinkwrap) is loaded. This means that information from the package.json files of your dependencies will not be included in the result set (e.g. description, homepage, engines). +.SS "Configuration" +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBpackage-lock-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, the current operation will only use the \fBpackage-lock.json\fR, ignoring \fBnode_modules\fR. +.P +For \fBupdate\fR this means only the \fBpackage-lock.json\fR will be updated, instead of checking \fBnode_modules\fR and downloading dependencies. +.P +For \fBlist\fR this means the output will be based on the tree described by the \fBpackage-lock.json\fR, rather than the contents of \fBnode_modules\fR. +.SS "\fBsbom-format\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: "cyclonedx" or "spdx" +.RE 0 + +.P +SBOM format to use when generating SBOMs. +.SS "\fBsbom-type\fR" +.RS 0 +.IP \(bu 4 +Default: "library" +.IP \(bu 4 +Type: "library", "application", or "framework" +.RE 0 + +.P +The type of package described by the generated SBOM. For SPDX, this is the value for the \fBprimaryPackagePurpose\fR field. For CycloneDX, this is the value for the \fBtype\fR field. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SH "SEE ALSO" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help "dependency selectors" +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help workspaces +.RE 0 diff --git a/node_modules/npm/man/man1/npm-search.1 b/node_modules/npm/man/man1/npm-search.1 new file mode 100644 index 00000000..b4bd3edf --- /dev/null +++ b/node_modules/npm/man/man1/npm-search.1 @@ -0,0 +1,156 @@ +.TH "NPM-SEARCH" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-search\fR - Search for packages +.SS "Synopsis" +.P +.RS 2 +.nf +npm search \[lB] ...\[rB] + +aliases: find, s, se +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Search the registry for packages matching the search terms. \fBnpm search\fR performs a linear, incremental, lexically-ordered search through package metadata for all files in the registry. If your terminal has color support, it will further highlight the matches in the results. This can be disabled with the config item \fBcolor\fR +.P +Additionally, using the \fB--searchopts\fR and \fB--searchexclude\fR options paired with more search terms will include and exclude further patterns. The main difference between \fB--searchopts\fR and the standard search terms is that the former does not highlight results in the output and you can use them more fine-grained filtering. Additionally, you can add both of these to your config to change default search filtering behavior. +.P +Search also allows targeting of maintainers in search results, by prefixing their npm username with \fB=\fR. +.P +If a term starts with \fB/\fR, then it's interpreted as a regular expression and supports standard JavaScript RegExp syntax. In this case search will ignore a trailing \fB/\fR . (Note you must escape or quote many regular expression characters in most shells.) +.SS "Configuration" +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBcolor\fR" +.RS 0 +.IP \(bu 4 +Default: true unless the NO_COLOR environ is set to something other than '0' +.IP \(bu 4 +Type: "always" or Boolean +.RE 0 + +.P +If false, never shows colors. If \fB"always"\fR then always shows colors. If true, then only prints color codes for tty file descriptors. +.SS "\fBparseable\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Output parseable results from commands that write to standard output. For \fBnpm search\fR, this will be tab-separated table format. +.SS "\fBdescription\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Show the description in \fBnpm search\fR +.SS "\fBsearchlimit\fR" +.RS 0 +.IP \(bu 4 +Default: 20 +.IP \(bu 4 +Type: Number +.RE 0 + +.P +Number of items to limit search results to. Will not apply at all to legacy searches. +.SS "\fBsearchopts\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Space-separated options that are always passed to search. +.SS "\fBsearchexclude\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Space-separated options that limit the results from search. +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBprefer-online\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, staleness checks for cached data will be forced, making the CLI look for updates immediately even for fresh package data. +.SS "\fBprefer-offline\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, staleness checks for cached data will be bypassed, but missing data will be requested from the server. To force full offline mode, use \fB--offline\fR. +.SS "\fBoffline\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Force offline mode: no network requests will be done during install. To allow the CLI to fill in missing cache data, see \fB--prefer-offline\fR. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help view +.IP \(bu 4 +npm help cache +.IP \(bu 4 +https://npm.im/npm-registry-fetch +.RE 0 diff --git a/node_modules/npm/man/man1/npm-shrinkwrap.1 b/node_modules/npm/man/man1/npm-shrinkwrap.1 new file mode 100644 index 00000000..f4003d1e --- /dev/null +++ b/node_modules/npm/man/man1/npm-shrinkwrap.1 @@ -0,0 +1,32 @@ +.TH "NPM-SHRINKWRAP" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-shrinkwrap\fR - Lock down dependency versions for publication +.SS "Synopsis" +.P +.RS 2 +.nf +npm shrinkwrap +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +This command repurposes \fBpackage-lock.json\fR into a publishable \fBnpm-shrinkwrap.json\fR or simply creates a new one. The file created and updated by this command will then take precedence over any other existing or future \fBpackage-lock.json\fR files. For a detailed explanation of the design and purpose of package locks in npm, see npm help package-lock-json. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help run-script +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +\fBpackage-lock.json\fR \fI\(la/configuring-npm/package-lock-json\(ra\fR +.IP \(bu 4 +\fBnpm-shrinkwrap.json\fR \fI\(la/configuring-npm/npm-shrinkwrap-json\(ra\fR +.IP \(bu 4 +npm help ls +.RE 0 diff --git a/node_modules/npm/man/man1/npm-star.1 b/node_modules/npm/man/man1/npm-star.1 new file mode 100644 index 00000000..9965ec8c --- /dev/null +++ b/node_modules/npm/man/man1/npm-star.1 @@ -0,0 +1,76 @@ +.TH "NPM-STAR" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-star\fR - Mark your favorite packages +.SS "Synopsis" +.P +.RS 2 +.nf +npm star \[lB]...\[rB] +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +"Starring" a package means that you have some interest in it. It's a vaguely positive way to show that you care. +.P +It's a boolean thing. Starring repeatedly has no additional effect. +.SS "More" +.P +There's also these extra commands to help you manage your favorite packages: +.SS "Unstar" +.P +You can also "unstar" a package using npm help unstar +.P +"Unstarring" is the same thing, but in reverse. +.SS "Listing stars" +.P +You can see all your starred packages using npm help stars +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBunicode\fR" +.RS 0 +.IP \(bu 4 +Default: false on windows, true on mac/unix systems with a unicode locale, as defined by the \fBLC_ALL\fR, \fBLC_CTYPE\fR, or \fBLANG\fR environment variables. +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help unstar +.IP \(bu 4 +npm help stars +.IP \(bu 4 +npm help view +.IP \(bu 4 +npm help whoami +.IP \(bu 4 +npm help adduser +.RE 0 diff --git a/node_modules/npm/man/man1/npm-stars.1 b/node_modules/npm/man/man1/npm-stars.1 new file mode 100644 index 00000000..a45038b7 --- /dev/null +++ b/node_modules/npm/man/man1/npm-stars.1 @@ -0,0 +1,41 @@ +.TH "NPM-STARS" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-stars\fR - View packages marked as favorites +.SS "Synopsis" +.P +.RS 2 +.nf +npm stars \[lB]\[rB] +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +If you have starred a lot of neat things and want to find them again quickly this command lets you do just that. +.P +You may also want to see your friend's favorite packages, in this case you will most certainly enjoy this command. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help star +.IP \(bu 4 +npm help unstar +.IP \(bu 4 +npm help view +.IP \(bu 4 +npm help whoami +.IP \(bu 4 +npm help adduser +.RE 0 diff --git a/node_modules/npm/man/man1/npm-start.1 b/node_modules/npm/man/man1/npm-start.1 new file mode 100644 index 00000000..89ee167e --- /dev/null +++ b/node_modules/npm/man/man1/npm-start.1 @@ -0,0 +1,79 @@ +.TH "NPM-START" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-start\fR - Start a package +.SS "Synopsis" +.P +.RS 2 +.nf +npm start \[lB]-- \[rB] +.fi +.RE +.SS "Description" +.P +This runs a predefined command specified in the \fB"start"\fR property of a package's \fB"scripts"\fR object. +.P +If the \fB"scripts"\fR object does not define a \fB"start"\fR property, npm will run \fBnode server.js\fR. +.P +Note that this is different from the default node behavior of running the file specified in a package's \fB"main"\fR attribute when evoking with \fBnode .\fR +.P +As of \fB\fBnpm@2.0.0\fR\fR \fI\(lahttps://blog.npmjs.org/post/98131109725/npm-2-0-0\(ra\fR, you can use custom arguments when executing scripts. Refer to npm help run-script for more details. +.SS "Example" +.P +.RS 2 +.nf +{ + "scripts": { + "start": "node foo.js" + } +} +.fi +.RE +.P +.RS 2 +.nf +npm start + +> npm@x.x.x start +> node foo.js + +(foo.js output would be here) + +.fi +.RE +.SS "Configuration" +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBscript-shell\fR" +.RS 0 +.IP \(bu 4 +Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +The shell to use for scripts run with the \fBnpm exec\fR, \fBnpm run\fR and \fBnpm +init \fR commands. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help run-script +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +npm help test +.IP \(bu 4 +npm help restart +.IP \(bu 4 +npm help stop +.RE 0 diff --git a/node_modules/npm/man/man1/npm-stop.1 b/node_modules/npm/man/man1/npm-stop.1 new file mode 100644 index 00000000..05cc8f8a --- /dev/null +++ b/node_modules/npm/man/man1/npm-stop.1 @@ -0,0 +1,75 @@ +.TH "NPM-STOP" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-stop\fR - Stop a package +.SS "Synopsis" +.P +.RS 2 +.nf +npm stop \[lB]-- \[rB] +.fi +.RE +.SS "Description" +.P +This runs a predefined command specified in the "stop" property of a package's "scripts" object. +.P +Unlike with npm help start, there is no default script that will run if the \fB"stop"\fR property is not defined. +.SS "Example" +.P +.RS 2 +.nf +{ + "scripts": { + "stop": "node bar.js" + } +} +.fi +.RE +.P +.RS 2 +.nf +npm stop + +> npm@x.x.x stop +> node bar.js + +(bar.js output would be here) + +.fi +.RE +.SS "Configuration" +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBscript-shell\fR" +.RS 0 +.IP \(bu 4 +Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +The shell to use for scripts run with the \fBnpm exec\fR, \fBnpm run\fR and \fBnpm +init \fR commands. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help run-script +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +npm help test +.IP \(bu 4 +npm help start +.IP \(bu 4 +npm help restart +.RE 0 diff --git a/node_modules/npm/man/man1/npm-team.1 b/node_modules/npm/man/man1/npm-team.1 new file mode 100644 index 00000000..96351687 --- /dev/null +++ b/node_modules/npm/man/man1/npm-team.1 @@ -0,0 +1,148 @@ +.TH "NPM-TEAM" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-team\fR - Manage organization teams and team memberships +.SS "Synopsis" +.P +.RS 2 +.nf +npm team create \[lB]--otp \[rB] +npm team destroy \[lB]--otp \[rB] +npm team add \[lB]--otp \[rB] +npm team rm \[lB]--otp \[rB] +npm team ls | +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Used to manage teams in organizations, and change team memberships. Does not handle permissions for packages. +.P +Teams must always be fully qualified with the organization/scope they belong to when operating on them, separated by a colon (\fB:\fR). That is, if you have a \fBnewteam\fR team in an \fBorg\fR organization, you must always refer to that team as \fB@org:newteam\fR in these commands. +.P +If you have two-factor authentication enabled in \fBauth-and-writes\fR mode, then you can provide a code from your authenticator with \fB\[lB]--otp \[rB]\fR. If you don't include this then you will be taken through a second factor flow based on your \fBauthtype\fR. +.RS 0 +.IP \(bu 4 +create / destroy: Create a new team, or destroy an existing one. Note: You cannot remove the \fBdevelopers\fR team, \fBlearn more.\fR \fI\(lahttps://docs.npmjs.com/about-developers-team\(ra\fR +.P +Here's how to create a new team \fBnewteam\fR under the \fBorg\fR org: +.P +.RS 2 +.nf +npm team create @org:newteam +.fi +.RE +.P +You should see a confirming message such as: \fB+@org:newteam\fR once the new team has been created. +.IP \(bu 4 +add: Add a user to an existing team. +.P +Adding a new user \fBusername\fR to a team named \fBnewteam\fR under the \fBorg\fR org: +.P +.RS 2 +.nf +npm team add @org:newteam username +.fi +.RE +.P +On success, you should see a message: \fBusername added to @org:newteam\fR +.IP \(bu 4 +rm: Using \fBnpm team rm\fR you can also remove users from a team they belong to. +.P +Here's an example removing user \fBusername\fR from \fBnewteam\fR team in \fBorg\fR organization: +.P +.RS 2 +.nf +npm team rm @org:newteam username +.fi +.RE +.P +Once the user is removed a confirmation message is displayed: \fBusername removed from @org:newteam\fR +.IP \(bu 4 +ls: If performed on an organization name, will return a list of existing teams under that organization. If performed on a team, it will instead return a list of all users belonging to that particular team. +.P +Here's an example of how to list all teams from an org named \fBorg\fR: +.P +.RS 2 +.nf +npm team ls @org +.fi +.RE +.P +Example listing all members of a team named \fBnewteam\fR: +.P +.RS 2 +.nf +npm team ls @org:newteam +.fi +.RE +.RE 0 + +.SS "Details" +.P +\fBnpm team\fR always operates directly on the current registry, configurable from the command line using \fB--registry=\fR. +.P +You must be a \fIteam admin\fR to create teams and manage team membership, under the given organization. Listing teams and team memberships may be done by any member of the organization. +.P +Organization creation and management of team admins and \fIorganization\fR members is done through the website, not the npm CLI. +.P +To use teams to manage permissions on packages belonging to your organization, use the \fBnpm access\fR command to grant or revoke the appropriate permissions. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "\fBparseable\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Output parseable results from commands that write to standard output. For \fBnpm search\fR, this will be tab-separated table format. +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help access +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help registry +.RE 0 diff --git a/node_modules/npm/man/man1/npm-test.1 b/node_modules/npm/man/man1/npm-test.1 new file mode 100644 index 00000000..7aff8375 --- /dev/null +++ b/node_modules/npm/man/man1/npm-test.1 @@ -0,0 +1,73 @@ +.TH "NPM-TEST" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-test\fR - Test a package +.SS "Synopsis" +.P +.RS 2 +.nf +npm test \[lB]-- \[rB] + +aliases: tst, t +.fi +.RE +.SS "Description" +.P +This runs a predefined command specified in the \fB"test"\fR property of a package's \fB"scripts"\fR object. +.SS "Example" +.P +.RS 2 +.nf +{ + "scripts": { + "test": "node test.js" + } +} +.fi +.RE +.P +.RS 2 +.nf +npm test +> npm@x.x.x test +> node test.js + +(test.js output would be here) +.fi +.RE +.SS "Configuration" +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBscript-shell\fR" +.RS 0 +.IP \(bu 4 +Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +The shell to use for scripts run with the \fBnpm exec\fR, \fBnpm run\fR and \fBnpm +init \fR commands. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help run-script +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +npm help start +.IP \(bu 4 +npm help restart +.IP \(bu 4 +npm help stop +.RE 0 diff --git a/node_modules/npm/man/man1/npm-token.1 b/node_modules/npm/man/man1/npm-token.1 new file mode 100644 index 00000000..139a61c5 --- /dev/null +++ b/node_modules/npm/man/man1/npm-token.1 @@ -0,0 +1,112 @@ +.TH "NPM-TOKEN" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-token\fR - Manage your authentication tokens +.SS "Synopsis" +.P +.RS 2 +.nf +npm token list +npm token revoke +npm token create \[lB]--read-only\[rB] \[lB]--cidr=list\[rB] +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +This lets you list, create and revoke authentication tokens. +.RS 0 +.IP \(bu 4 +\fBnpm token list\fR: Shows a table of all active authentication tokens. You can request this as JSON with \fB--json\fR or tab-separated values with \fB--parseable\fR. +.RE 0 + +.P +.RS 2 +.nf +Read only token npm_1f… with id 7f3134 created 2017-10-21 + +Publish token npm_af… with id c03241 created 2017-10-02 +with IP Whitelist: 192.168.0.1/24 + +Publish token npm_… with id e0cf92 created 2017-10-02 + +.fi +.RE +.RS 0 +.IP \(bu 4 +\fBnpm token create \[lB]--read-only\[rB] \[lB]--cidr=\[rB]\fR: Create a new authentication token. It can be \fB--read-only\fR, or accept a list of \fBCIDR\fR \fI\(lahttps://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing\(ra\fR ranges with which to limit use of this token. This will prompt you for your password, and, if you have two-factor authentication enabled, an otp. +.P +Currently, the cli can not generate automation tokens. Please refer to the \fBdocs website\fR \fI\(lahttps://docs.npmjs.com/creating-and-viewing-access-tokens\(ra\fR for more information on generating automation tokens. +.RE 0 + +.P +.RS 2 +.nf +Created publish token a73c9572-f1b9-8983-983d-ba3ac3cc913d +.fi +.RE +.RS 0 +.IP \(bu 4 +\fBnpm token revoke \fR: Immediately removes an authentication token from the registry. You will no longer be able to use it. This can accept both complete tokens (such as those you get back from \fBnpm token create\fR, and those found in your \fB.npmrc\fR), and ids as seen in the parseable or json output of \fBnpm token list\fR. This will NOT accept the truncated token found in the normal \fBnpm token list\fR output. +.RE 0 + +.SS "Configuration" +.SS "\fBread-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +This is used to mark a token as unable to publish when configuring limited access tokens with the \fBnpm token create\fR command. +.SS "\fBcidr\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String (can be set multiple times) +.RE 0 + +.P +This is a list of CIDR address to be used when configuring limited access tokens with the \fBnpm token create\fR command. +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help adduser +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help owner +.IP \(bu 4 +npm help whoami +.IP \(bu 4 +npm help profile +.RE 0 diff --git a/node_modules/npm/man/man1/npm-uninstall.1 b/node_modules/npm/man/man1/npm-uninstall.1 new file mode 100644 index 00000000..5c1ec680 --- /dev/null +++ b/node_modules/npm/man/man1/npm-uninstall.1 @@ -0,0 +1,159 @@ +.TH "NPM-UNINSTALL" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-uninstall\fR - Remove a package +.SS "Synopsis" +.P +.RS 2 +.nf +npm uninstall \[lB]<@scope>/\[rB]... + +aliases: unlink, remove, rm, r, un +.fi +.RE +.SS "Description" +.P +This uninstalls a package, completely removing everything npm installed on its behalf. +.P +It also removes the package from the \fBdependencies\fR, \fBdevDependencies\fR, \fBoptionalDependencies\fR, and \fBpeerDependencies\fR objects in your \fBpackage.json\fR. +.P +Further, if you have an \fBnpm-shrinkwrap.json\fR or \fBpackage-lock.json\fR, npm will update those files as well. +.P +\fB--no-save\fR will tell npm not to remove the package from your \fBpackage.json\fR, \fBnpm-shrinkwrap.json\fR, or \fBpackage-lock.json\fR files. +.P +\fB--save\fR or \fB-S\fR will tell npm to remove the package from your \fBpackage.json\fR, \fBnpm-shrinkwrap.json\fR, and \fBpackage-lock.json\fR files. This is the default, but you may need to use this if you have for instance \fBsave=false\fR in your \fBnpmrc\fR file +.P +In global mode (ie, with \fB-g\fR or \fB--global\fR appended to the command), it uninstalls the current package context as a global package. \fB--no-save\fR is ignored in this case. +.P +Scope is optional and follows the usual rules for npm help scope. +.SS "Examples" +.P +.RS 2 +.nf +npm uninstall sax +.fi +.RE +.P +\fBsax\fR will no longer be in your \fBpackage.json\fR, \fBnpm-shrinkwrap.json\fR, or \fBpackage-lock.json\fR files. +.P +.RS 2 +.nf +npm uninstall lodash --no-save +.fi +.RE +.P +\fBlodash\fR will not be removed from your \fBpackage.json\fR, \fBnpm-shrinkwrap.json\fR, or \fBpackage-lock.json\fR files. +.SS "Configuration" +.SS "\fBsave\fR" +.RS 0 +.IP \(bu 4 +Default: \fBtrue\fR unless when using \fBnpm update\fR where it defaults to \fBfalse\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Save installed packages to a \fBpackage.json\fR file as dependencies. +.P +When used with the \fBnpm rm\fR command, removes the dependency from \fBpackage.json\fR. +.P +Will also prevent writing to \fBpackage-lock.json\fR if set to \fBfalse\fR. +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help prune +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.RE 0 diff --git a/node_modules/npm/man/man1/npm-unpublish.1 b/node_modules/npm/man/man1/npm-unpublish.1 new file mode 100644 index 00000000..b7d070c4 --- /dev/null +++ b/node_modules/npm/man/man1/npm-unpublish.1 @@ -0,0 +1,137 @@ +.TH "NPM-UNPUBLISH" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-unpublish\fR - Remove a package from the registry +.SS "Synopsis" +.P +.RS 2 +.nf +npm unpublish \[lB]\[rB] +.fi +.RE +.P +To learn more about how the npm registry treats unpublish, see our \fBunpublish policies\fR \fI\(lahttps://docs.npmjs.com/policies/unpublish\(ra\fR. +.SS "Warning" +.P +Consider using the npm help deprecate command instead, if your intent is to encourage users to upgrade, or if you no longer want to maintain a package. +.SS "Description" +.P +This removes a package version from the registry, deleting its entry and removing the tarball. +.P +The npm registry will return an error if you are not npm help "logged in". +.P +If you do not specify a package name at all, the name and version to be unpublished will be pulled from the project in the current directory. +.P +If you specify a package name but do not specify a version or if you remove all of a package's versions then the registry will remove the root package entry entirely. +.P +Even if you unpublish a package version, that specific name and version combination can never be reused. In order to publish the package again, you must use a new version number. If you unpublish the entire package, you may not publish any new versions of that package until 24 hours have passed. +.SS "Configuration" +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBforce\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input. +.RS 0 +.IP \(bu 4 +Allow clobbering non-npm files in global installs. +.IP \(bu 4 +Allow the \fBnpm version\fR command to work on an unclean git repository. +.IP \(bu 4 +Allow deleting the cache folder with \fBnpm cache clean\fR. +.IP \(bu 4 +Allow installing packages that have an \fBengines\fR declaration requiring a different version of npm. +.IP \(bu 4 +Allow installing packages that have an \fBengines\fR declaration requiring a different version of \fBnode\fR, even if \fB--engine-strict\fR is enabled. +.IP \(bu 4 +Allow \fBnpm audit fix\fR to install modules outside your stated dependency range (including SemVer-major changes). +.IP \(bu 4 +Allow unpublishing all versions of a published package. +.IP \(bu 4 +Allow conflicting peerDependencies to be installed in the root project. +.IP \(bu 4 +Implicitly set \fB--yes\fR during \fBnpm init\fR. +.IP \(bu 4 +Allow clobbering existing values in \fBnpm pkg\fR +.IP \(bu 4 +Allow unpublishing of entire packages (not just a single version). +.RE 0 + +.P +If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help deprecate +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help adduser +.IP \(bu 4 +npm help owner +.IP \(bu 4 +npm help login +.RE 0 diff --git a/node_modules/npm/man/man1/npm-unstar.1 b/node_modules/npm/man/man1/npm-unstar.1 new file mode 100644 index 00000000..8c91421b --- /dev/null +++ b/node_modules/npm/man/man1/npm-unstar.1 @@ -0,0 +1,70 @@ +.TH "NPM-UNSTAR" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-unstar\fR - Remove an item from your favorite packages +.SS "Synopsis" +.P +.RS 2 +.nf +npm unstar \[lB]...\[rB] +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +"Unstarring" a package is the opposite of npm help star, it removes an item from your list of favorite packages. +.SS "More" +.P +There's also these extra commands to help you manage your favorite packages: +.SS "Star" +.P +You can "star" a package using npm help star +.SS "Listing stars" +.P +You can see all your starred packages using npm help stars +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBunicode\fR" +.RS 0 +.IP \(bu 4 +Default: false on windows, true on mac/unix systems with a unicode locale, as defined by the \fBLC_ALL\fR, \fBLC_CTYPE\fR, or \fBLANG\fR environment variables. +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help star +.IP \(bu 4 +npm help stars +.IP \(bu 4 +npm help view +.IP \(bu 4 +npm help whoami +.IP \(bu 4 +npm help adduser +.RE 0 diff --git a/node_modules/npm/man/man1/npm-update.1 b/node_modules/npm/man/man1/npm-update.1 new file mode 100644 index 00000000..cfac4fa4 --- /dev/null +++ b/node_modules/npm/man/man1/npm-update.1 @@ -0,0 +1,406 @@ +.TH "NPM-UPDATE" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-update\fR - Update packages +.SS "Synopsis" +.P +.RS 2 +.nf +npm update \[lB]...\[rB] + +aliases: up, upgrade, udpate +.fi +.RE +.SS "Description" +.P +This command will update all the packages listed to the latest version (specified by the \fB\fBtag\fR config\fR \fI\(la/using-npm/config#tag\(ra\fR), respecting the semver constraints of both your package and its dependencies (if they also require the same package). +.P +It will also install missing packages. +.P +If the \fB-g\fR flag is specified, this command will update globally installed packages. +.P +If no package name is specified, all packages in the specified location (global or local) will be updated. +.P +Note that by default \fBnpm update\fR will not update the semver values of direct dependencies in your project \fBpackage.json\fR. If you want to also update values in \fBpackage.json\fR you can run: \fBnpm update --save\fR (or add the \fBsave=true\fR option to a npm help "configuration file" to make that the default behavior). +.SS "Example" +.P +For the examples below, assume that the current package is \fBapp\fR and it depends on dependencies, \fBdep1\fR (\fBdep2\fR, .. etc.). The published versions of \fBdep1\fR are: +.P +.RS 2 +.nf +{ + "dist-tags": { "latest": "1.2.2" }, + "versions": \[lB] + "1.2.2", + "1.2.1", + "1.2.0", + "1.1.2", + "1.1.1", + "1.0.0", + "0.4.1", + "0.4.0", + "0.2.0" + \[rB] +} +.fi +.RE +.SS "Caret Dependencies" +.P +If \fBapp\fR's \fBpackage.json\fR contains: +.P +.RS 2 +.nf +"dependencies": { + "dep1": "^1.1.1" +} +.fi +.RE +.P +Then \fBnpm update\fR will install \fBdep1@1.2.2\fR, because \fB1.2.2\fR is \fBlatest\fR and \fB1.2.2\fR satisfies \fB^1.1.1\fR. +.SS "Tilde Dependencies" +.P +However, if \fBapp\fR's \fBpackage.json\fR contains: +.P +.RS 2 +.nf +"dependencies": { + "dep1": "~1.1.1" +} +.fi +.RE +.P +In this case, running \fBnpm update\fR will install \fBdep1@1.1.2\fR. Even though the \fBlatest\fR tag points to \fB1.2.2\fR, this version does not satisfy \fB~1.1.1\fR, which is equivalent to \fB>=1.1.1 <1.2.0\fR. So the highest-sorting version that satisfies \fB~1.1.1\fR is used, which is \fB1.1.2\fR. +.SS "Caret Dependencies below 1.0.0" +.P +Suppose \fBapp\fR has a caret dependency on a version below \fB1.0.0\fR, for example: +.P +.RS 2 +.nf +"dependencies": { + "dep1": "^0.2.0" +} +.fi +.RE +.P +\fBnpm update\fR will install \fBdep1@0.2.0\fR. +.P +If the dependence were on \fB^0.4.0\fR: +.P +.RS 2 +.nf +"dependencies": { + "dep1": "^0.4.0" +} +.fi +.RE +.P +Then \fBnpm update\fR will install \fBdep1@0.4.1\fR, because that is the highest-sorting version that satisfies \fB^0.4.0\fR (\fB>= 0.4.0 <0.5.0\fR) +.SS "Subdependencies" +.P +Suppose your app now also has a dependency on \fBdep2\fR +.P +.RS 2 +.nf +{ + "name": "my-app", + "dependencies": { + "dep1": "^1.0.0", + "dep2": "1.0.0" + } +} +.fi +.RE +.P +and \fBdep2\fR itself depends on this limited range of \fBdep1\fR +.P +.RS 2 +.nf +{ +"name": "dep2", + "dependencies": { + "dep1": "~1.1.1" + } +} +.fi +.RE +.P +Then \fBnpm update\fR will install \fBdep1@1.1.2\fR because that is the highest version that \fBdep2\fR allows. npm will prioritize having a single version of \fBdep1\fR in your tree rather than two when that single version can satisfy the semver requirements of multiple dependencies in your tree. In this case if you really did need your package to use a newer version you would need to use \fBnpm install\fR. +.SS "Updating Globally-Installed Packages" +.P +\fBnpm update -g\fR will apply the \fBupdate\fR action to each globally installed package that is \fBoutdated\fR -- that is, has a version that is different from \fBwanted\fR. +.P +Note: Globally installed packages are treated as if they are installed with a caret semver range specified. So if you require to update to \fBlatest\fR you may need to run \fBnpm install -g \[lB]...\[rB]\fR +.P +NOTE: If a package has been upgraded to a version newer than \fBlatest\fR, it will be \fIdowngraded\fR. +.SS "Configuration" +.SS "\fBsave\fR" +.RS 0 +.IP \(bu 4 +Default: \fBtrue\fR unless when using \fBnpm update\fR where it defaults to \fBfalse\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Save installed packages to a \fBpackage.json\fR file as dependencies. +.P +When used with the \fBnpm rm\fR command, removes the dependency from \fBpackage.json\fR. +.P +Will also prevent writing to \fBpackage-lock.json\fR if set to \fBfalse\fR. +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBinstall-strategy\fR" +.RS 0 +.IP \(bu 4 +Default: "hoisted" +.IP \(bu 4 +Type: "hoisted", "nested", "shallow", or "linked" +.RE 0 + +.P +Sets the strategy for installing packages in node_modules. hoisted (default): Install non-duplicated in top-level, and duplicated as necessary within directory structure. nested: (formerly --legacy-bundling) install in place, no hoisting. shallow (formerly --global-style) only install direct deps at top-level. linked: (experimental) install in node_modules/.store, link in place, unhoisted. +.SS "\fBlegacy-bundling\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=nested\fR +.RE 0 + +.P +Instead of hoisting package installs in \fBnode_modules\fR, install packages in the same manner that they are depended on. This may cause very deep directory structures and duplicate package installs as there is no de-duplicating. Sets \fB--install-strategy=nested\fR. +.SS "\fBglobal-style\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=shallow\fR +.RE 0 + +.P +Only install direct dependencies in the top level \fBnode_modules\fR, but hoist on deeper dependencies. Sets \fB--install-strategy=shallow\fR. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBstrict-peer-deps\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to \fBtrue\fR, and \fB--legacy-peer-deps\fR is not set, then \fIany\fR conflicting \fBpeerDependencies\fR will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships. +.P +By default, conflicting \fBpeerDependencies\fR deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's \fBpeerDependencies\fR object. +.P +When such an override is performed, a warning is printed, explaining the conflict and the packages involved. If \fB--strict-peer-deps\fR is set, then this warning is treated as a failure. +.SS "\fBpackage-lock\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to false, then ignore \fBpackage-lock.json\fR files when installing. This will also prevent \fIwriting\fR \fBpackage-lock.json\fR if \fBsave\fR is true. +.SS "\fBforeground-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process. +.P +Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBaudit\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for npm help audit for details on what is submitted. +.SS "\fBbin-links\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables. +.P +Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. +.SS "\fBfund\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" displays the message at the end of each \fBnpm install\fR acknowledging the number of dependencies looking for funding. See npm help fund for details. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help outdated +.IP \(bu 4 +npm help shrinkwrap +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help ls +.RE 0 diff --git a/node_modules/npm/man/man1/npm-version.1 b/node_modules/npm/man/man1/npm-version.1 new file mode 100644 index 00000000..fef0dc3c --- /dev/null +++ b/node_modules/npm/man/man1/npm-version.1 @@ -0,0 +1,229 @@ +.TH "NPM-VERSION" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-version\fR - Bump a package version +.SS "Synopsis" +.P +.RS 2 +.nf +npm version \[lB] | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git\[rB] + +alias: verison +.fi +.RE +.SS "Configuration" +.SS "\fBallow-same-version\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Prevents throwing an error when \fBnpm version\fR is used to set the new version to the same value as the current version. +.SS "\fBcommit-hooks\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run git commit hooks when using the \fBnpm version\fR command. +.SS "\fBgit-tag-version\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tag the commit when using the \fBnpm version\fR command. Setting this to false results in no commit being made at all. +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBpreid\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +The "prerelease identifier" to use as a prefix for the "prerelease" part of a semver. Like the \fBrc\fR in \fB1.2.0-rc.8\fR. +.SS "\fBsign-git-tag\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, then the \fBnpm version\fR command will tag the version using \fB-s\fR to add a signature. +.P +Note that git requires you to have set up GPG keys in your git configs for this to work properly. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces-update\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, the npm cli will run an update after operations that may possibly change the workspaces installed to the \fBnode_modules\fR folder. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "Description" +.P +Run this in a package directory to bump the version and write the new data back to \fBpackage.json\fR, \fBpackage-lock.json\fR, and, if present, \fBnpm-shrinkwrap.json\fR. +.P +The \fBnewversion\fR argument should be a valid semver string, a valid second argument to \fBsemver.inc\fR \fI\(lahttps://github.com/npm/node-semver#functions\(ra\fR (one of \fBpatch\fR, \fBminor\fR, \fBmajor\fR, \fBprepatch\fR, \fBpreminor\fR, \fBpremajor\fR, \fBprerelease\fR), or \fBfrom-git\fR. In the second case, the existing version will be incremented by 1 in the specified field. \fBfrom-git\fR will try to read the latest git tag, and use that as the new npm version. +.P +If run in a git repo, it will also create a version commit and tag. This behavior is controlled by \fBgit-tag-version\fR (see below), and can be disabled on the command line by running \fBnpm --no-git-tag-version version\fR. It will fail if the working directory is not clean, unless the \fB-f\fR or \fB--force\fR flag is set. +.P +If supplied with \fB-m\fR or \fB\fB--message\fR config\fR \fI\(la/using-npm/config#message\(ra\fR option, npm will use it as a commit message when creating a version commit. If the \fBmessage\fR config contains \fB%s\fR then that will be replaced with the resulting version number. For example: +.P +.RS 2 +.nf +npm version patch -m "Upgrade to %s for reasons" +.fi +.RE +.P +If the \fB\fBsign-git-tag\fR config\fR \fI\(la/using-npm/config#sign-git-tag\(ra\fR is set, then the tag will be signed using the \fB-s\fR flag to git. Note that you must have a default GPG key set up in your git config for this to work properly. For example: +.P +.RS 2 +.nf +$ npm config set sign-git-tag true +$ npm version patch + +You need a passphrase to unlock the secret key for +user: "isaacs (http://blog.izs.me/) " +2048-bit RSA key, ID 6C481CF6, created 2010-08-31 + +Enter passphrase: +.fi +.RE +.P +If \fBpreversion\fR, \fBversion\fR, or \fBpostversion\fR are in the \fBscripts\fR property of the package.json, they will be executed as part of running \fBnpm +version\fR. +.P +The exact order of execution is as follows: +.RS 0 +.IP 1. 4 +Check to make sure the git working directory is clean before we get started. Your scripts may add files to the commit in future steps. This step is skipped if the \fB--force\fR flag is set. +.IP 2. 4 +Run the \fBpreversion\fR script. These scripts have access to the old \fBversion\fR in package.json. A typical use would be running your full test suite before deploying. Any files you want added to the commit should be explicitly added using \fBgit add\fR. +.IP 3. 4 +Bump \fBversion\fR in \fBpackage.json\fR as requested (\fBpatch\fR, \fBminor\fR, \fBmajor\fR, etc). +.IP 4. 4 +Run the \fBversion\fR script. These scripts have access to the new \fBversion\fR in package.json (so they can incorporate it into file headers in generated files for example). Again, scripts should explicitly add generated files to the commit using \fBgit add\fR. +.IP 5. 4 +Commit and tag. +.IP 6. 4 +Run the \fBpostversion\fR script. Use it to clean up the file system or automatically push the commit and/or tag. +.RE 0 + +.P +Take the following example: +.P +.RS 2 +.nf +{ + "scripts": { + "preversion": "npm test", + "version": "npm run build && git add -A dist", + "postversion": "git push && git push --tags && rm -rf build/temp" + } +} +.fi +.RE +.P +This runs all your tests and proceeds only if they pass. Then runs your \fBbuild\fR script, and adds everything in the \fBdist\fR directory to the commit. After the commit, it pushes the new commit and tag up to the server, and deletes the \fBbuild/temp\fR directory. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help init +.IP \(bu 4 +npm help run-script +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help config +.RE 0 diff --git a/node_modules/npm/man/man1/npm-view.1 b/node_modules/npm/man/man1/npm-view.1 new file mode 100644 index 00000000..db248715 --- /dev/null +++ b/node_modules/npm/man/man1/npm-view.1 @@ -0,0 +1,213 @@ +.TH "NPM-VIEW" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-view\fR - View registry info +.SS "Synopsis" +.P +.RS 2 +.nf +npm view \[lB]\[rB] \[lB]\[lB].subfield\[rB]...\[rB] + +aliases: info, show, v +.fi +.RE +.SS "Description" +.P +This command shows data about a package and prints it to stdout. +.P +As an example, to view information about the \fBconnect\fR package from the registry, you would run: +.P +.RS 2 +.nf +npm view connect +.fi +.RE +.P +The default version is \fB"latest"\fR if unspecified. +.P +Field names can be specified after the package descriptor. For example, to show the dependencies of the \fBronn\fR package at version \fB0.3.5\fR, you could do the following: +.P +.RS 2 +.nf +npm view ronn@0.3.5 dependencies +.fi +.RE +.P +By default, \fBnpm view\fR shows data about the current project context (by looking for a \fBpackage.json\fR). To show field data for the current project use a file path (i.e. \fB.\fR): +.P +.RS 2 +.nf +npm view . dependencies +.fi +.RE +.P +You can view child fields by separating them with a period. To view the git repository URL for the latest version of \fBnpm\fR, you would run the following command: +.P +.RS 2 +.nf +npm view npm repository.url +.fi +.RE +.P +This makes it easy to view information about a dependency with a bit of shell scripting. For example, to view all the data about the version of \fBopts\fR that \fBronn\fR depends on, you could write the following: +.P +.RS 2 +.nf +npm view opts@$(npm view ronn dependencies.opts) +.fi +.RE +.P +For fields that are arrays, requesting a non-numeric field will return all of the values from the objects in the list. For example, to get all the contributor email addresses for the \fBexpress\fR package, you would run: +.P +.RS 2 +.nf +npm view express contributors.email +.fi +.RE +.P +You may also use numeric indices in square braces to specifically select an item in an array field. To just get the email address of the first contributor in the list, you can run: +.P +.RS 2 +.nf +npm view express contributors\[lB]0\[rB].email +.fi +.RE +.P +If the field value you are querying for is a property of an object, you should run: +.P +.RS 2 +.nf +npm view express time'\[lB]4.8.0\[rB]' +.fi +.RE +.P +Multiple fields may be specified, and will be printed one after another. For example, to get all the contributor names and email addresses, you can do this: +.P +.RS 2 +.nf +npm view express contributors.name contributors.email +.fi +.RE +.P +"Person" fields are shown as a string if they would be shown as an object. So, for example, this will show the list of \fBnpm\fR contributors in the shortened string format. (See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for more on this.) +.P +.RS 2 +.nf +npm view npm contributors +.fi +.RE +.P +If a version range is provided, then data will be printed for every matching version of the package. This will show which version of \fBjsdom\fR was required by each matching version of \fByui3\fR: +.P +.RS 2 +.nf +npm view yui3@'>0.5.4' dependencies.jsdom +.fi +.RE +.P +To show the \fBconnect\fR package version history, you can do this: +.P +.RS 2 +.nf +npm view connect versions +.fi +.RE +.SS "Configuration" +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "Output" +.P +If only a single string field for a single version is output, then it will not be colorized or quoted, to enable piping the output to another command. If the field is an object, it will be output as a JavaScript object literal. +.P +If the \fB--json\fR flag is given, the outputted fields will be JSON. +.P +If the version range matches multiple versions then each printed value will be prefixed with the version it applies to. +.P +If multiple fields are requested, then each of them is prefixed with the field name. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help "package spec" +.IP \(bu 4 +npm help search +.IP \(bu 4 +npm help registry +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help docs +.RE 0 diff --git a/node_modules/npm/man/man1/npm-whoami.1 b/node_modules/npm/man/man1/npm-whoami.1 new file mode 100644 index 00000000..4202647f --- /dev/null +++ b/node_modules/npm/man/man1/npm-whoami.1 @@ -0,0 +1,39 @@ +.TH "NPM-WHOAMI" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-whoami\fR - Display npm username +.SS "Synopsis" +.P +.RS 2 +.nf +npm whoami +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Description" +.P +Display the npm username of the currently logged-in user. +.P +If logged into a registry that provides token-based authentication, then connect to the \fB/-/whoami\fR registry endpoint to find the username associated with the token, and print to standard output. +.P +If logged into a registry that uses Basic Auth, then simply print the \fBusername\fR portion of the authentication string. +.SS "Configuration" +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help adduser +.RE 0 diff --git a/node_modules/npm/man/man1/npm.1 b/node_modules/npm/man/man1/npm.1 new file mode 100644 index 00000000..ffcdbf0f --- /dev/null +++ b/node_modules/npm/man/man1/npm.1 @@ -0,0 +1,131 @@ +.TH "NPM" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm\fR - javascript package manager +.SS "Synopsis" +.P +.RS 2 +.nf +npm +.fi +.RE +.P +Note: This command is unaware of workspaces. +.SS "Version" +.P +11.0.0 +.SS "Description" +.P +npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently. +.P +It is extremely configurable to support a variety of use cases. Most commonly, you use it to publish, discover, install, and develop node programs. +.P +Run \fBnpm help\fR to get a list of available commands. +.SS "Important" +.P +npm comes preconfigured to use npm's public registry at https://registry.npmjs.org by default. Use of the npm public registry is subject to terms of use available at https://docs.npmjs.com/policies/terms. +.P +You can configure npm to use any compatible registry you like, and even run your own registry. Use of someone else's registry is governed by their terms of use. +.SS "Introduction" +.P +You probably got npm because you want to install stuff. +.P +The very first thing you will most likely want to run in any node program is \fBnpm install\fR to install its dependencies. +.P +You can also run \fBnpm install blerg\fR to install the latest version of "blerg". Check out npm help install for more info. It can do a lot of stuff. +.P +Use the \fBnpm search\fR command to show everything that's available in the public registry. Use \fBnpm ls\fR to show everything you've installed. +.SS "Dependencies" +.P +If a package lists a dependency using a git URL, npm will install that dependency using the \fB\fBgit\fR\fR \fI\(lahttps://github.com/git-guides/install-git\(ra\fR command and will generate an error if it is not installed. +.P +If one of the packages npm tries to install is a native node module and requires compiling of C++ Code, npm will use \fBnode-gyp\fR \fI\(lahttps://github.com/nodejs/node-gyp\(ra\fR for that task. For a Unix system, \fBnode-gyp\fR \fI\(lahttps://github.com/nodejs/node-gyp\(ra\fR needs Python, make and a buildchain like GCC. On Windows, Python and Microsoft Visual Studio C++ are needed. For more information visit \fBthe node-gyp repository\fR \fI\(lahttps://github.com/nodejs/node-gyp\(ra\fR and the \fBnode-gyp Wiki\fR \fI\(lahttps://github.com/nodejs/node-gyp/wiki\(ra\fR. +.SS "Directories" +.P +See npm help folders to learn about where npm puts stuff. +.P +In particular, npm has two modes of operation: +.RS 0 +.IP \(bu 4 +local mode: npm installs packages into the current project directory, which defaults to the current working directory. Packages install to \fB./node_modules\fR, and bins to \fB./node_modules/.bin\fR. +.IP \(bu 4 +global mode: npm installs packages into the install prefix at \fB$npm_config_prefix/lib/node_modules\fR and bins to \fB$npm_config_prefix/bin\fR. +.RE 0 + +.P +Local mode is the default. Use \fB-g\fR or \fB--global\fR on any command to run in global mode instead. +.SS "Developer Usage" +.P +If you're using npm to develop and publish your code, check out the following help topics: +.RS 0 +.IP \(bu 4 +json: Make a package.json file. See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR. +.IP \(bu 4 +link: Links your current working code into Node's path, so that you don't have to reinstall every time you make a change. Use npm help link to do this. +.IP \(bu 4 +install: It's a good idea to install things if you don't need the symbolic link. Especially, installing other peoples code from the registry is done via npm help install +.IP \(bu 4 +adduser: Create an account or log in. When you do this, npm will store credentials in the user config file. +.IP \(bu 4 +publish: Use the npm help publish command to upload your code to the registry. +.RE 0 + +.SS "Configuration" +.P +npm is extremely configurable. It reads its configuration options from 5 places. +.RS 0 +.IP \(bu 4 +Command line switches: Set a config with \fB--key val\fR. All keys take a value, even if they are booleans (the config parser doesn't know what the options are at the time of parsing). If you do not provide a value (\fB--key\fR) then the option is set to boolean \fBtrue\fR. +.IP \(bu 4 +Environment Variables: Set any config by prefixing the name in an environment variable with \fBnpm_config_\fR. For example, \fBexport npm_config_key=val\fR. +.IP \(bu 4 +User Configs: The file at \fB$HOME/.npmrc\fR is an ini-formatted list of configs. If present, it is parsed. If the \fBuserconfig\fR option is set in the cli or env, that file will be used instead. +.IP \(bu 4 +Global Configs: The file found at \fB./etc/npmrc\fR (relative to the global prefix will be parsed if it is found. See npm help prefix for more info on the global prefix. If the \fBglobalconfig\fR option is set in the cli, env, or user config, then that file is parsed instead. +.IP \(bu 4 +Defaults: npm's default configuration options are defined in \fBlib/utils/config/definitions.js\fR. These must not be changed. +.RE 0 + +.P +See npm help config for much much more information. +.SS "Contributions" +.P +Patches welcome! +.P +If you would like to help, but don't know what to work on, read the \fBcontributing guidelines\fR \fI\(lahttps://github.com/npm/cli/blob/latest/CONTRIBUTING.md\(ra\fR and check the issues list. +.SS "Bugs" +.P +When you find issues, please report them: \fI\(lahttps://github.com/npm/cli/issues\(ra\fR +.P +Please be sure to follow the template and bug reporting guidelines. +.SS "Feature Requests" +.P +Discuss new feature ideas on our discussion forum: +.RS 0 +.IP \(bu 4 +\fI\(lahttps://github.com/orgs/community/discussions/categories/npm\(ra\fR +.RE 0 + +.P +Or suggest formal RFC proposals: +.RS 0 +.IP \(bu 4 +\fI\(lahttps://github.com/npm/rfcs\(ra\fR +.RE 0 + +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help help +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help prefix +.IP \(bu 4 +npm help publish +.RE 0 diff --git a/node_modules/npm/man/man1/npx.1 b/node_modules/npm/man/man1/npx.1 new file mode 100644 index 00000000..3e25d37e --- /dev/null +++ b/node_modules/npm/man/man1/npx.1 @@ -0,0 +1,156 @@ +.TH "NPX" "1" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpx\fR - Run a command from a local or remote npm package +.SS "Synopsis" +.P +.RS 2 +.nf +npx -- \[lB]@\[rB] \[lB]args...\[rB] +npx --package=\[lB]@\[rB] -- \[lB]args...\[rB] +npx -c ' \[lB]args...\[rB]' +npx --package=foo -c ' \[lB]args...\[rB]' +.fi +.RE +.SS "Description" +.P +This command allows you to run an arbitrary command from an npm package (either one installed locally, or fetched remotely), in a similar context as running it via \fBnpm run\fR. +.P +Whatever packages are specified by the \fB--package\fR option will be provided in the \fBPATH\fR of the executed command, along with any locally installed package executables. The \fB--package\fR option may be specified multiple times, to execute the supplied command in an environment where all specified packages are available. +.P +If any requested packages are not present in the local project dependencies, then they are installed to a folder in the npm cache, which is added to the \fBPATH\fR environment variable in the executed process. A prompt is printed (which can be suppressed by providing either \fB--yes\fR or \fB--no\fR). +.P +Package names provided without a specifier will be matched with whatever version exists in the local project. Package names with a specifier will only be considered a match if they have the exact same name and version as the local dependency. +.P +If no \fB-c\fR or \fB--call\fR option is provided, then the positional arguments are used to generate the command string. If no \fB--package\fR options are provided, then npm will attempt to determine the executable name from the package specifier provided as the first positional argument according to the following heuristic: +.RS 0 +.IP \(bu 4 +If the package has a single entry in its \fBbin\fR field in \fBpackage.json\fR, or if all entries are aliases of the same command, then that command will be used. +.IP \(bu 4 +If the package has multiple \fBbin\fR entries, and one of them matches the unscoped portion of the \fBname\fR field, then that command will be used. +.IP \(bu 4 +If this does not result in exactly one option (either because there are no bin entries, or none of them match the \fBname\fR of the package), then \fBnpm exec\fR exits with an error. +.RE 0 + +.P +To run a binary \fIother than\fR the named binary, specify one or more \fB--package\fR options, which will prevent npm from inferring the package from the first command argument. +.SS "\fBnpx\fR vs \fBnpm exec\fR" +.P +When run via the \fBnpx\fR binary, all flags and options \fImust\fR be set prior to any positional arguments. When run via \fBnpm exec\fR, a double-hyphen \fB--\fR flag can be used to suppress npm's parsing of switches and options that should be sent to the executed command. +.P +For example: +.P +.RS 2 +.nf +$ npx foo@latest bar --package=@npmcli/foo +.fi +.RE +.P +In this case, npm will resolve the \fBfoo\fR package name, and run the following command: +.P +.RS 2 +.nf +$ foo bar --package=@npmcli/foo +.fi +.RE +.P +Since the \fB--package\fR option comes \fIafter\fR the positional arguments, it is treated as an argument to the executed command. +.P +In contrast, due to npm's argument parsing logic, running this command is different: +.P +.RS 2 +.nf +$ npm exec foo@latest bar --package=@npmcli/foo +.fi +.RE +.P +In this case, npm will parse the \fB--package\fR option first, resolving the \fB@npmcli/foo\fR package. Then, it will execute the following command in that context: +.P +.RS 2 +.nf +$ foo@latest bar +.fi +.RE +.P +The double-hyphen character is recommended to explicitly tell npm to stop parsing command line options and switches. The following command would thus be equivalent to the \fBnpx\fR command above: +.P +.RS 2 +.nf +$ npm exec -- foo@latest bar --package=@npmcli/foo +.fi +.RE +.SS "Examples" +.P +Run the version of \fBtap\fR in the local dependencies, with the provided arguments: +.P +.RS 2 +.nf +$ npm exec -- tap --bail test/foo.js +$ npx tap --bail test/foo.js +.fi +.RE +.P +Run a command \fIother than\fR the command whose name matches the package name by specifying a \fB--package\fR option: +.P +.RS 2 +.nf +$ npm exec --package=foo -- bar --bar-argument +# ~ or ~ +$ npx --package=foo bar --bar-argument +.fi +.RE +.P +Run an arbitrary shell script, in the context of the current project: +.P +.RS 2 +.nf +$ npm x -c 'eslint && say "hooray, lint passed"' +$ npx -c 'eslint && say "hooray, lint passed"' +.fi +.RE +.SS "Compatibility with Older npx Versions" +.P +The \fBnpx\fR binary was rewritten in npm v7.0.0, and the standalone \fBnpx\fR package deprecated at that time. \fBnpx\fR uses the \fBnpm exec\fR command instead of a separate argument parser and install process, with some affordances to maintain backwards compatibility with the arguments it accepted in previous versions. +.P +This resulted in some shifts in its functionality: +.RS 0 +.IP \(bu 4 +Any \fBnpm\fR config value may be provided. +.IP \(bu 4 +To prevent security and user-experience problems from mistyping package names, \fBnpx\fR prompts before installing anything. Suppress this prompt with the \fB-y\fR or \fB--yes\fR option. +.IP \(bu 4 +The \fB--no-install\fR option is deprecated, and will be converted to \fB--no\fR. +.IP \(bu 4 +Shell fallback functionality is removed, as it is not advisable. +.IP \(bu 4 +The \fB-p\fR argument is a shorthand for \fB--parseable\fR in npm, but shorthand for \fB--package\fR in npx. This is maintained, but only for the \fBnpx\fR executable. +.IP \(bu 4 +The \fB--ignore-existing\fR option is removed. Locally installed bins are always present in the executed process \fBPATH\fR. +.IP \(bu 4 +The \fB--npm\fR option is removed. \fBnpx\fR will always use the \fBnpm\fR it ships with. +.IP \(bu 4 +The \fB--node-arg\fR and \fB-n\fR options have been removed. Use \fB\fBNODE_OPTIONS\fR\fR \fI\(lahttps://nodejs.org/api/cli.html#node_optionsoptions\(ra\fR instead: e.g., \fBNODE_OPTIONS="--trace-warnings --trace-exit" npx foo --random=true\fR +.IP \(bu 4 +The \fB--always-spawn\fR option is redundant, and thus removed. +.IP \(bu 4 +The \fB--shell\fR option is replaced with \fB--script-shell\fR, but maintained in the \fBnpx\fR executable for backwards compatibility. +.RE 0 + +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help run-script +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +npm help test +.IP \(bu 4 +npm help start +.IP \(bu 4 +npm help restart +.IP \(bu 4 +npm help stop +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help exec +.RE 0 diff --git a/node_modules/npm/man/man5/folders.5 b/node_modules/npm/man/man5/folders.5 new file mode 100644 index 00000000..8348e518 --- /dev/null +++ b/node_modules/npm/man/man5/folders.5 @@ -0,0 +1,152 @@ +.TH "FOLDERS" "5" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBfolders\fR - Folder Structures Used by npm +.SS "Description" +.P +npm puts various things on your computer. That's its job. +.P +This document will tell you what it puts where. +.SS "tl;dr" +.RS 0 +.IP \(bu 4 +Local install (default): puts stuff in \fB./node_modules\fR of the current package root. +.IP \(bu 4 +Global install (with \fB-g\fR): puts stuff in /usr/local or wherever node is installed. +.IP \(bu 4 +Install it \fBlocally\fR if you're going to \fBrequire()\fR it. +.IP \(bu 4 +Install it \fBglobally\fR if you're going to run it on the command line. +.IP \(bu 4 +If you need both, then install it in both places, or use \fBnpm link\fR. +.RE 0 + +.SS "prefix Configuration" +.P +The \fB\fBprefix\fR config\fR \fI\(la/using-npm/config#prefix\(ra\fR defaults to the location where node is installed. On most systems, this is \fB/usr/local\fR. On Windows, it's \fB%AppData%\[rs]npm\fR. On Unix systems, it's one level up, since node is typically installed at \fB{prefix}/bin/node\fR rather than \fB{prefix}/node.exe\fR. +.P +When the \fBglobal\fR flag is set, npm installs things into this prefix. When it is not set, it uses the root of the current package, or the current working directory if not in a package already. +.SS "Node Modules" +.P +Packages are dropped into the \fBnode_modules\fR folder under the \fBprefix\fR. When installing locally, this means that you can \fBrequire("packagename")\fR to load its main module, or \fBrequire("packagename/lib/path/to/sub/module")\fR to load other modules. +.P +Global installs on Unix systems go to \fB{prefix}/lib/node_modules\fR. Global installs on Windows go to \fB{prefix}/node_modules\fR (that is, no \fBlib\fR folder.) +.P +Scoped packages are installed the same way, except they are grouped together in a sub-folder of the relevant \fBnode_modules\fR folder with the name of that scope prefix by the @ symbol, e.g. \fBnpm install @myorg/package\fR would place the package in \fB{prefix}/node_modules/@myorg/package\fR. See npm help scope for more details. +.P +If you wish to \fBrequire()\fR a package, then install it locally. +.SS "Executables" +.P +When in global mode, executables are linked into \fB{prefix}/bin\fR on Unix, or directly into \fB{prefix}\fR on Windows. Ensure that path is in your terminal's \fBPATH\fR environment to run them. +.P +When in local mode, executables are linked into \fB./node_modules/.bin\fR so that they can be made available to scripts run through npm. (For example, so that a test runner will be in the path when you run \fBnpm test\fR.) +.SS "Man Pages" +.P +When in global mode, man pages are linked into \fB{prefix}/share/man\fR. +.P +When in local mode, man pages are not installed. +.P +Man pages are not installed on Windows systems. +.SS "Cache" +.P +See npm help cache. Cache files are stored in \fB~/.npm\fR on Posix, or \fB%LocalAppData%/npm-cache\fR on Windows. +.P +This is controlled by the \fB\fBcache\fR config\fR \fI\(la/using-npm/config#cache\(ra\fR param. +.SS "Temp Files" +.P +Temporary files are stored by default in the folder specified by the \fB\fBtmp\fR config\fR \fI\(la/using-npm/config#tmp\(ra\fR, which defaults to the TMPDIR, TMP, or TEMP environment variables, or \fB/tmp\fR on Unix and \fBc:\[rs]windows\[rs]temp\fR on Windows. +.P +Temp files are given a unique folder under this root for each run of the program, and are deleted upon successful exit. +.SS "More Information" +.P +When installing locally, npm first tries to find an appropriate \fBprefix\fR folder. This is so that \fBnpm install foo@1.2.3\fR will install to the sensible root of your package, even if you happen to have \fBcd\fRed into some other folder. +.P +Starting at the $PWD, npm will walk up the folder tree checking for a folder that contains either a \fBpackage.json\fR file, or a \fBnode_modules\fR folder. If such a thing is found, then that is treated as the effective "current directory" for the purpose of running npm commands. (This behavior is inspired by and similar to git's .git-folder seeking logic when running git commands in a working dir.) +.P +If no package root is found, then the current folder is used. +.P +When you run \fBnpm install foo@1.2.3\fR, then the package is loaded into the cache, and then unpacked into \fB./node_modules/foo\fR. Then, any of foo's dependencies are similarly unpacked into \fB./node_modules/foo/node_modules/...\fR. +.P +Any bin files are symlinked to \fB./node_modules/.bin/\fR, so that they may be found by npm scripts when necessary. +.SS "Global Installation" +.P +If the \fB\fBglobal\fR config\fR \fI\(la/using-npm/config#global\(ra\fR is set to true, then npm will install packages "globally". +.P +For global installation, packages are installed roughly the same way, but using the folders described above. +.SS "Cycles, Conflicts, and Folder Parsimony" +.P +Cycles are handled using the property of node's module system that it walks up the directories looking for \fBnode_modules\fR folders. So, at every stage, if a package is already installed in an ancestor \fBnode_modules\fR folder, then it is not installed at the current location. +.P +Consider the case above, where \fBfoo -> bar -> baz\fR. Imagine if, in addition to that, baz depended on bar, so you'd have: \fBfoo -> bar -> baz -> bar -> baz ...\fR. However, since the folder structure is: \fBfoo/node_modules/bar/node_modules/baz\fR, there's no need to put another copy of bar into \fB.../baz/node_modules\fR, since when baz calls \fBrequire("bar")\fR, it will get the copy that is installed in \fBfoo/node_modules/bar\fR. +.P +This shortcut is only used if the exact same version would be installed in multiple nested \fBnode_modules\fR folders. It is still possible to have \fBa/node_modules/b/node_modules/a\fR if the two "a" packages are different versions. However, without repeating the exact same package multiple times, an infinite regress will always be prevented. +.P +Another optimization can be made by installing dependencies at the highest level possible, below the localized "target" folder (hoisting). Since version 3, npm hoists dependencies by default. +.SS "Example" +.P +Consider this dependency graph: +.P +.RS 2 +.nf +foo ++-- blerg@1.2.5 ++-- bar@1.2.3 +| +-- blerg@1.x (latest=1.3.7) +| +-- baz@2.x +| | `-- quux@3.x +| | `-- bar@1.2.3 (cycle) +| `-- asdf@* +`-- baz@1.2.3 + `-- quux@3.x + `-- bar +.fi +.RE +.P +In this case, we might expect a folder structure like this (with all dependencies hoisted to the highest level possible): +.P +.RS 2 +.nf +foo ++-- node_modules + +-- blerg (1.2.5) <---\[lB]A\[rB] + +-- bar (1.2.3) <---\[lB]B\[rB] + | +-- node_modules + | +-- baz (2.0.2) <---\[lB]C\[rB] + +-- asdf (2.3.4) + +-- baz (1.2.3) <---\[lB]D\[rB] + +-- quux (3.2.0) <---\[lB]E\[rB] +.fi +.RE +.P +Since foo depends directly on \fBbar@1.2.3\fR and \fBbaz@1.2.3\fR, those are installed in foo's \fBnode_modules\fR folder. +.P +Even though the latest copy of blerg is 1.3.7, foo has a specific dependency on version 1.2.5. So, that gets installed at \[lB]A\[rB]. Since the parent installation of blerg satisfies bar's dependency on \fBblerg@1.x\fR, it does not install another copy under \[lB]B\[rB]. +.P +Bar \[lB]B\[rB] also has dependencies on baz and asdf. Because it depends on \fBbaz@2.x\fR, it cannot re-use the \fBbaz@1.2.3\fR installed in the parent \fBnode_modules\fR folder \[lB]D\[rB], and must install its own copy \[lB]C\[rB]. In order to minimize duplication, npm hoists dependencies to the top level by default, so asdf is installed under \[lB]A\[rB]. +.P +Underneath bar, the \fBbaz -> quux -> bar\fR dependency creates a cycle. However, because bar is already in quux's ancestry \[lB]B\[rB], it does not unpack another copy of bar into that folder. Likewise, quux's \[lB]E\[rB] folder tree is empty, because its dependency on bar is satisfied by the parent folder copy installed at \[lB]B\[rB]. +.P +For a graphical breakdown of what is installed where, use \fBnpm ls\fR. +.SS "Publishing" +.P +Upon publishing, npm will look in the \fBnode_modules\fR folder. If any of the items there are not in the \fBbundleDependencies\fR array, then they will not be included in the package tarball. +.P +This allows a package maintainer to install all of their dependencies (and dev dependencies) locally, but only re-publish those items that cannot be found elsewhere. See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for more information. +.SS "See also" +.RS 0 +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help pack +.IP \(bu 4 +npm help cache +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help publish +.RE 0 diff --git a/node_modules/npm/man/man5/install.5 b/node_modules/npm/man/man5/install.5 new file mode 100644 index 00000000..b49be9e9 --- /dev/null +++ b/node_modules/npm/man/man5/install.5 @@ -0,0 +1,57 @@ +.TH "INSTALL" "5" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBinstall\fR - Download and install node and npm +.SS "Description" +.P +To publish and install packages to and from the public npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. \fBWe strongly recommend using a Node version manager to install Node.js and npm.\fR We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally. +.SS "Overview" +.RS 0 +.IP \(bu 4 +\fBChecking your version of npm and Node.js\fR \fI(Checking your version of npm and Node.js)\fR +.IP \(bu 4 +\fBUsing a Node version manager to install Node.js and npm\fR \fI(Using a Node version manager to install Node.js and npm)\fR +.IP \(bu 4 +\fBUsing a Node installer to install Node.js and npm\fR \fI(Using a Node installer to install Node.js and npm)\fR +.RE 0 + +.SS "Checking your version of npm and Node.js" +.P +To see if you already have Node.js and npm installed and check the installed version, run the following commands: +.P +.RS 2 +.nf +node -v +npm -v +.fi +.RE +.SS "Using a Node version manager to install Node.js and npm" +.P +Node version managers allow you to install and switch between multiple versions of Node.js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions. You can \fBsearch for them on GitHub\fR \fI\(lahttps://github.com/search?q=node+version+manager+archived%3Afalse&type=repositories&ref=advsearch\(ra\fR. +.SS "Using a Node installer to install Node.js and npm" +.P +If you are unable to use a Node version manager, you can use a Node installer to install both Node.js and npm on your system. +.RS 0 +.IP \(bu 4 +\fBNode.js installer\fR \fI\(lahttps://nodejs.org/en/download/\(ra\fR +.IP \(bu 4 +\fBNodeSource installer\fR \fI\(lahttps://github.com/nodesource/distributions\(ra\fR. If you use Linux, we recommend that you use a NodeSource installer. +.RE 0 + +.SS "OS X or Windows Node installers" +.P +If you're using OS X or Windows, use one of the installers from the \fBNode.js download page\fR \fI\(lahttps://nodejs.org/en/download/\(ra\fR. Be sure to install the version labeled \fBLTS\fR. Other versions have not yet been tested with npm. +.SS "Linux or other operating systems Node installers" +.P +If you're using Linux or another operating system, use one of the following installers: +.RS 0 +.IP \(bu 4 +\fBNodeSource installer\fR \fI\(lahttps://github.com/nodesource/distributions\(ra\fR (recommended) +.IP \(bu 4 +One of the installers on the \fBNode.js download page\fR \fI\(lahttps://nodejs.org/en/download/\(ra\fR +.RE 0 + +.P +Or see \fBthis page\fR \fI\(lahttps://nodejs.org/en/download/package-manager/\(ra\fR to install npm for Linux in the way many Linux developers prefer. +.SS "Less-common operating systems" +.P +For more information on installing Node.js on a variety of operating systems, see \fBthis page\fR \fI\(lahttps://nodejs.org/en/download/package-manager/\(ra\fR. diff --git a/node_modules/npm/man/man5/npm-global.5 b/node_modules/npm/man/man5/npm-global.5 new file mode 100644 index 00000000..8348e518 --- /dev/null +++ b/node_modules/npm/man/man5/npm-global.5 @@ -0,0 +1,152 @@ +.TH "FOLDERS" "5" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBfolders\fR - Folder Structures Used by npm +.SS "Description" +.P +npm puts various things on your computer. That's its job. +.P +This document will tell you what it puts where. +.SS "tl;dr" +.RS 0 +.IP \(bu 4 +Local install (default): puts stuff in \fB./node_modules\fR of the current package root. +.IP \(bu 4 +Global install (with \fB-g\fR): puts stuff in /usr/local or wherever node is installed. +.IP \(bu 4 +Install it \fBlocally\fR if you're going to \fBrequire()\fR it. +.IP \(bu 4 +Install it \fBglobally\fR if you're going to run it on the command line. +.IP \(bu 4 +If you need both, then install it in both places, or use \fBnpm link\fR. +.RE 0 + +.SS "prefix Configuration" +.P +The \fB\fBprefix\fR config\fR \fI\(la/using-npm/config#prefix\(ra\fR defaults to the location where node is installed. On most systems, this is \fB/usr/local\fR. On Windows, it's \fB%AppData%\[rs]npm\fR. On Unix systems, it's one level up, since node is typically installed at \fB{prefix}/bin/node\fR rather than \fB{prefix}/node.exe\fR. +.P +When the \fBglobal\fR flag is set, npm installs things into this prefix. When it is not set, it uses the root of the current package, or the current working directory if not in a package already. +.SS "Node Modules" +.P +Packages are dropped into the \fBnode_modules\fR folder under the \fBprefix\fR. When installing locally, this means that you can \fBrequire("packagename")\fR to load its main module, or \fBrequire("packagename/lib/path/to/sub/module")\fR to load other modules. +.P +Global installs on Unix systems go to \fB{prefix}/lib/node_modules\fR. Global installs on Windows go to \fB{prefix}/node_modules\fR (that is, no \fBlib\fR folder.) +.P +Scoped packages are installed the same way, except they are grouped together in a sub-folder of the relevant \fBnode_modules\fR folder with the name of that scope prefix by the @ symbol, e.g. \fBnpm install @myorg/package\fR would place the package in \fB{prefix}/node_modules/@myorg/package\fR. See npm help scope for more details. +.P +If you wish to \fBrequire()\fR a package, then install it locally. +.SS "Executables" +.P +When in global mode, executables are linked into \fB{prefix}/bin\fR on Unix, or directly into \fB{prefix}\fR on Windows. Ensure that path is in your terminal's \fBPATH\fR environment to run them. +.P +When in local mode, executables are linked into \fB./node_modules/.bin\fR so that they can be made available to scripts run through npm. (For example, so that a test runner will be in the path when you run \fBnpm test\fR.) +.SS "Man Pages" +.P +When in global mode, man pages are linked into \fB{prefix}/share/man\fR. +.P +When in local mode, man pages are not installed. +.P +Man pages are not installed on Windows systems. +.SS "Cache" +.P +See npm help cache. Cache files are stored in \fB~/.npm\fR on Posix, or \fB%LocalAppData%/npm-cache\fR on Windows. +.P +This is controlled by the \fB\fBcache\fR config\fR \fI\(la/using-npm/config#cache\(ra\fR param. +.SS "Temp Files" +.P +Temporary files are stored by default in the folder specified by the \fB\fBtmp\fR config\fR \fI\(la/using-npm/config#tmp\(ra\fR, which defaults to the TMPDIR, TMP, or TEMP environment variables, or \fB/tmp\fR on Unix and \fBc:\[rs]windows\[rs]temp\fR on Windows. +.P +Temp files are given a unique folder under this root for each run of the program, and are deleted upon successful exit. +.SS "More Information" +.P +When installing locally, npm first tries to find an appropriate \fBprefix\fR folder. This is so that \fBnpm install foo@1.2.3\fR will install to the sensible root of your package, even if you happen to have \fBcd\fRed into some other folder. +.P +Starting at the $PWD, npm will walk up the folder tree checking for a folder that contains either a \fBpackage.json\fR file, or a \fBnode_modules\fR folder. If such a thing is found, then that is treated as the effective "current directory" for the purpose of running npm commands. (This behavior is inspired by and similar to git's .git-folder seeking logic when running git commands in a working dir.) +.P +If no package root is found, then the current folder is used. +.P +When you run \fBnpm install foo@1.2.3\fR, then the package is loaded into the cache, and then unpacked into \fB./node_modules/foo\fR. Then, any of foo's dependencies are similarly unpacked into \fB./node_modules/foo/node_modules/...\fR. +.P +Any bin files are symlinked to \fB./node_modules/.bin/\fR, so that they may be found by npm scripts when necessary. +.SS "Global Installation" +.P +If the \fB\fBglobal\fR config\fR \fI\(la/using-npm/config#global\(ra\fR is set to true, then npm will install packages "globally". +.P +For global installation, packages are installed roughly the same way, but using the folders described above. +.SS "Cycles, Conflicts, and Folder Parsimony" +.P +Cycles are handled using the property of node's module system that it walks up the directories looking for \fBnode_modules\fR folders. So, at every stage, if a package is already installed in an ancestor \fBnode_modules\fR folder, then it is not installed at the current location. +.P +Consider the case above, where \fBfoo -> bar -> baz\fR. Imagine if, in addition to that, baz depended on bar, so you'd have: \fBfoo -> bar -> baz -> bar -> baz ...\fR. However, since the folder structure is: \fBfoo/node_modules/bar/node_modules/baz\fR, there's no need to put another copy of bar into \fB.../baz/node_modules\fR, since when baz calls \fBrequire("bar")\fR, it will get the copy that is installed in \fBfoo/node_modules/bar\fR. +.P +This shortcut is only used if the exact same version would be installed in multiple nested \fBnode_modules\fR folders. It is still possible to have \fBa/node_modules/b/node_modules/a\fR if the two "a" packages are different versions. However, without repeating the exact same package multiple times, an infinite regress will always be prevented. +.P +Another optimization can be made by installing dependencies at the highest level possible, below the localized "target" folder (hoisting). Since version 3, npm hoists dependencies by default. +.SS "Example" +.P +Consider this dependency graph: +.P +.RS 2 +.nf +foo ++-- blerg@1.2.5 ++-- bar@1.2.3 +| +-- blerg@1.x (latest=1.3.7) +| +-- baz@2.x +| | `-- quux@3.x +| | `-- bar@1.2.3 (cycle) +| `-- asdf@* +`-- baz@1.2.3 + `-- quux@3.x + `-- bar +.fi +.RE +.P +In this case, we might expect a folder structure like this (with all dependencies hoisted to the highest level possible): +.P +.RS 2 +.nf +foo ++-- node_modules + +-- blerg (1.2.5) <---\[lB]A\[rB] + +-- bar (1.2.3) <---\[lB]B\[rB] + | +-- node_modules + | +-- baz (2.0.2) <---\[lB]C\[rB] + +-- asdf (2.3.4) + +-- baz (1.2.3) <---\[lB]D\[rB] + +-- quux (3.2.0) <---\[lB]E\[rB] +.fi +.RE +.P +Since foo depends directly on \fBbar@1.2.3\fR and \fBbaz@1.2.3\fR, those are installed in foo's \fBnode_modules\fR folder. +.P +Even though the latest copy of blerg is 1.3.7, foo has a specific dependency on version 1.2.5. So, that gets installed at \[lB]A\[rB]. Since the parent installation of blerg satisfies bar's dependency on \fBblerg@1.x\fR, it does not install another copy under \[lB]B\[rB]. +.P +Bar \[lB]B\[rB] also has dependencies on baz and asdf. Because it depends on \fBbaz@2.x\fR, it cannot re-use the \fBbaz@1.2.3\fR installed in the parent \fBnode_modules\fR folder \[lB]D\[rB], and must install its own copy \[lB]C\[rB]. In order to minimize duplication, npm hoists dependencies to the top level by default, so asdf is installed under \[lB]A\[rB]. +.P +Underneath bar, the \fBbaz -> quux -> bar\fR dependency creates a cycle. However, because bar is already in quux's ancestry \[lB]B\[rB], it does not unpack another copy of bar into that folder. Likewise, quux's \[lB]E\[rB] folder tree is empty, because its dependency on bar is satisfied by the parent folder copy installed at \[lB]B\[rB]. +.P +For a graphical breakdown of what is installed where, use \fBnpm ls\fR. +.SS "Publishing" +.P +Upon publishing, npm will look in the \fBnode_modules\fR folder. If any of the items there are not in the \fBbundleDependencies\fR array, then they will not be included in the package tarball. +.P +This allows a package maintainer to install all of their dependencies (and dev dependencies) locally, but only re-publish those items that cannot be found elsewhere. See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for more information. +.SS "See also" +.RS 0 +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help pack +.IP \(bu 4 +npm help cache +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help publish +.RE 0 diff --git a/node_modules/npm/man/man5/npm-json.5 b/node_modules/npm/man/man5/npm-json.5 new file mode 100644 index 00000000..4b807fbf --- /dev/null +++ b/node_modules/npm/man/man5/npm-json.5 @@ -0,0 +1,1160 @@ +.TH "PACKAGE.JSON" "5" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBpackage.json\fR - Specifics of npm's package.json handling +.SS "Description" +.P +This document is all you need to know about what's required in your package.json file. It must be actual JSON, not just a JavaScript object literal. +.P +A lot of the behavior described in this document is affected by the config settings described in npm help config. +.SS "name" +.P +If you plan to publish your package, the \fImost\fR important things in your package.json are the name and version fields as they will be required. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version. If you don't plan to publish your package, the name and version fields are optional. +.P +The name is what your thing is called. +.P +Some rules: +.RS 0 +.IP \(bu 4 +The name must be less than or equal to 214 characters. This includes the scope for scoped packages. +.IP \(bu 4 +The names of scoped packages can begin with a dot or an underscore. This is not permitted without a scope. +.IP \(bu 4 +New packages must not have uppercase letters in the name. +.IP \(bu 4 +The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can't contain any non-URL-safe characters. +.RE 0 + +.P +Some tips: +.RS 0 +.IP \(bu 4 +Don't use the same name as a core Node module. +.IP \(bu 4 +Don't put "js" or "node" in the name. It's assumed that it's js, since you're writing a package.json file, and you can specify the engine using the "\fBengines\fR \fI(engines)\fR" field. (See below.) +.IP \(bu 4 +The name will probably be passed as an argument to require(), so it should be something short, but also reasonably descriptive. +.IP \(bu 4 +You may want to check the npm registry to see if there's something by that name already, before you get too attached to it. \fI\(lahttps://www.npmjs.com/\(ra\fR +.RE 0 + +.P +A name can be optionally prefixed by a scope, e.g. \fB@myorg/mypackage\fR. See npm help scope for more detail. +.SS "version" +.P +If you plan to publish your package, the \fImost\fR important things in your package.json are the name and version fields as they will be required. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version. If you don't plan to publish your package, the name and version fields are optional. +.P +Version must be parseable by \fBnode-semver\fR \fI\(lahttps://github.com/npm/node-semver\(ra\fR, which is bundled with npm as a dependency. (\fBnpm install semver\fR to use it yourself.) +.SS "description" +.P +Put a description in it. It's a string. This helps people discover your package, as it's listed in \fBnpm search\fR. +.SS "keywords" +.P +Put keywords in it. It's an array of strings. This helps people discover your package as it's listed in \fBnpm search\fR. +.SS "homepage" +.P +The URL to the project homepage. +.P +Example: +.P +.RS 2 +.nf +"homepage": "https://github.com/owner/project#readme" +.fi +.RE +.SS "bugs" +.P +The URL to your project's issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package. +.P +It should look like this: +.P +.RS 2 +.nf +{ + "bugs": { + "url": "https://github.com/owner/project/issues", + "email": "project@hostname.com" + } +} +.fi +.RE +.P +You can specify either one or both values. If you want to provide only a URL, you can specify the value for "bugs" as a simple string instead of an object. +.P +If a URL is provided, it will be used by the \fBnpm bugs\fR command. +.SS "license" +.P +You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it. +.P +If you're using a common license such as BSD-2-Clause or MIT, add a current SPDX license identifier for the license you're using, like this: +.P +.RS 2 +.nf +{ + "license" : "BSD-3-Clause" +} +.fi +.RE +.P +You can check \fBthe full list of SPDX license IDs\fR \fI\(lahttps://spdx.org/licenses/\(ra\fR. Ideally you should pick one that is \fBOSI\fR \fI\(lahttps://opensource.org/licenses/\(ra\fR approved. +.P +If your package is licensed under multiple common licenses, use an \fBSPDX license expression syntax version 2.0 string\fR \fI\(lahttps://spdx.dev/specifications/\(ra\fR, like this: +.P +.RS 2 +.nf +{ + "license" : "(ISC OR GPL-3.0)" +} +.fi +.RE +.P +If you are using a license that hasn't been assigned an SPDX identifier, or if you are using a custom license, use a string value like this one: +.P +.RS 2 +.nf +{ + "license" : "SEE LICENSE IN " +} +.fi +.RE +.P +Then include a file named \fB\fR at the top level of the package. +.P +Some old packages used license objects or a "licenses" property containing an array of license objects: +.P +.RS 2 +.nf +// Not valid metadata +{ + "license" : { + "type" : "ISC", + "url" : "https://opensource.org/licenses/ISC" + } +} + +// Not valid metadata +{ + "licenses" : \[lB] + { + "type": "MIT", + "url": "https://www.opensource.org/licenses/mit-license.php" + }, + { + "type": "Apache-2.0", + "url": "https://opensource.org/licenses/apache2.0.php" + } + \[rB] +} +.fi +.RE +.P +Those styles are now deprecated. Instead, use SPDX expressions, like this: +.P +.RS 2 +.nf +{ + "license": "ISC" +} +.fi +.RE +.P +.RS 2 +.nf +{ + "license": "(MIT OR Apache-2.0)" +} +.fi +.RE +.P +Finally, if you do not wish to grant others the right to use a private or unpublished package under any terms: +.P +.RS 2 +.nf +{ + "license": "UNLICENSED" +} +.fi +.RE +.P +Consider also setting \fB"private": true\fR to prevent accidental publication. +.SS "people fields: author, contributors" +.P +The "author" is one person. "contributors" is an array of people. A "person" is an object with a "name" field and optionally "url" and "email", like this: +.P +.RS 2 +.nf +{ + "name" : "Barney Rubble", + "email" : "b@rubble.com", + "url" : "http://barnyrubble.tumblr.com/" +} +.fi +.RE +.P +Or you can shorten that all into a single string, and npm will parse it for you: +.P +.RS 2 +.nf +{ + "author": "Barney Rubble (http://barnyrubble.tumblr.com/)" +} +.fi +.RE +.P +Both email and url are optional either way. +.P +npm also sets a top-level "maintainers" field with your npm user info. +.SS "funding" +.P +You can specify an object containing a URL that provides up-to-date information about ways to help fund development of your package, a string URL, or an array of objects and string URLs: +.P +.RS 2 +.nf +{ + "funding": { + "type" : "individual", + "url" : "http://example.com/donate" + } +} +.fi +.RE +.P +.RS 2 +.nf +{ + "funding": { + "type" : "patreon", + "url" : "https://www.patreon.com/my-account" + } +} +.fi +.RE +.P +.RS 2 +.nf +{ + "funding": "http://example.com/donate" +} +.fi +.RE +.P +.RS 2 +.nf +{ + "funding": \[lB] + { + "type" : "individual", + "url" : "http://example.com/donate" + }, + "http://example.com/donateAlso", + { + "type" : "patreon", + "url" : "https://www.patreon.com/my-account" + } + \[rB] +} +.fi +.RE +.P +Users can use the \fBnpm fund\fR subcommand to list the \fBfunding\fR URLs of all dependencies of their project, direct and indirect. A shortcut to visit each funding URL is also available when providing the project name such as: \fBnpm fund \fR (when there are multiple URLs, the first one will be visited) +.SS "files" +.P +The optional \fBfiles\fR field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to \fB.gitignore\fR, but reversed: including a file, directory, or glob pattern (\fB*\fR, \fB**/*\fR, and such) will make it so that file is included in the tarball when it's packed. Omitting the field will make it default to \fB\[lB]"*"\[rB]\fR, which means it will include all files. +.P +Some special files and directories are also included or excluded regardless of whether they exist in the \fBfiles\fR array (see below). +.P +You can also provide a \fB.npmignore\fR file in the root of your package or in subdirectories, which will keep files from being included. At the root of your package it will not override the "files" field, but in subdirectories it will. The \fB.npmignore\fR file works just like a \fB.gitignore\fR. If there is a \fB.gitignore\fR file, and \fB.npmignore\fR is missing, \fB.gitignore\fR's contents will be used instead. +.P +Certain files are always included, regardless of settings: +.RS 0 +.IP \(bu 4 +\fBpackage.json\fR +.IP \(bu 4 +\fBREADME\fR +.IP \(bu 4 +\fBLICENSE\fR / \fBLICENCE\fR +.IP \(bu 4 +The file in the "main" field +.IP \(bu 4 +The file(s) in the "bin" field +.RE 0 + +.P +\fBREADME\fR & \fBLICENSE\fR can have any case and extension. +.P +Some files are always ignored by default: +.RS 0 +.IP \(bu 4 +\fB*.orig\fR +.IP \(bu 4 +\fB.*.swp\fR +.IP \(bu 4 +\fB.DS_Store\fR +.IP \(bu 4 +\fB._*\fR +.IP \(bu 4 +\fB.git\fR +.IP \(bu 4 +\fB.hg\fR +.IP \(bu 4 +\fB.lock-wscript\fR +.IP \(bu 4 +\fB.npmrc\fR +.IP \(bu 4 +\fB.svn\fR +.IP \(bu 4 +\fB.wafpickle-N\fR +.IP \(bu 4 +\fBCVS\fR +.IP \(bu 4 +\fBconfig.gypi\fR +.IP \(bu 4 +\fBnode_modules\fR +.IP \(bu 4 +\fBnpm-debug.log\fR +.IP \(bu 4 +\fBpackage-lock.json\fR (use \fB\fBnpm-shrinkwrap.json\fR\fR \fI\(la/configuring-npm/npm-shrinkwrap-json\(ra\fR if you wish it to be published) +.IP \(bu 4 +\fBpnpm-lock.yaml\fR +.IP \(bu 4 +\fByarn.lock\fR +.IP \(bu 4 +\fBbun.lockb\fR +.RE 0 + +.P +Most of these ignored files can be included specifically if included in the \fBfiles\fR globs. Exceptions to this are: +.RS 0 +.IP \(bu 4 +\fB.git\fR +.IP \(bu 4 +\fB.npmrc\fR +.IP \(bu 4 +\fBnode_modules\fR +.IP \(bu 4 +\fBpackage-lock.json\fR +.IP \(bu 4 +\fBpnpm-lock.yaml\fR +.IP \(bu 4 +\fByarn.lock\fR +.IP \(bu 4 +\fBbun.lockb\fR +.RE 0 + +.P +These can not be included. +.SS "exports" +.P +The "exports" provides a modern alternative to "main" allowing multiple entry points to be defined, conditional entry resolution support between environments, and preventing any other entry points besides those defined in "exports". This encapsulation allows module authors to clearly define the public interface for their package. For more details see the \fBnode.js documentation on package entry points\fR \fI\(lahttps://nodejs.org/api/packages.html#package-entry-points\(ra\fR +.SS "main" +.P +The main field is a module ID that is the primary entry point to your program. That is, if your package is named \fBfoo\fR, and a user installs it, and then does \fBrequire("foo")\fR, then your main module's exports object will be returned. +.P +This should be a module relative to the root of your package folder. +.P +For most modules, it makes the most sense to have a main script and often not much else. +.P +If \fBmain\fR is not set, it defaults to \fBindex.js\fR in the package's root folder. +.SS "browser" +.P +If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren't available in Node.js modules. (e.g. \fBwindow\fR) +.SS "bin" +.P +A lot of packages have one or more executable files that they'd like to install into the PATH. npm makes this pretty easy (in fact, it uses this feature to install the "npm" executable.) +.P +To use this, supply a \fBbin\fR field in your package.json which is a map of command name to local file name. When this package is installed globally, that file will be either linked inside the global bins directory or a cmd (Windows Command File) will be created which executes the specified file in the \fBbin\fR field, so it is available to run by \fBname\fR or \fBname.cmd\fR (on Windows PowerShell). When this package is installed as a dependency in another package, the file will be linked where it will be available to that package either directly by \fBnpm exec\fR or by name in other scripts when invoking them via \fBnpm run-script\fR. +.P +For example, myapp could have this: +.P +.RS 2 +.nf +{ + "bin": { + "myapp": "bin/cli.js" + } +} +.fi +.RE +.P +So, when you install myapp, in case of unix-like OS it'll create a symlink from the \fBcli.js\fR script to \fB/usr/local/bin/myapp\fR and in case of windows it will create a cmd file usually at \fBC:\[rs]Users\[rs]{Username}\[rs]AppData\[rs]Roaming\[rs]npm\[rs]myapp.cmd\fR which runs the \fBcli.js\fR script. +.P +If you have a single executable, and its name should be the name of the package, then you can just supply it as a string. For example: +.P +.RS 2 +.nf +{ + "name": "my-program", + "version": "1.2.5", + "bin": "path/to/program" +} +.fi +.RE +.P +would be the same as this: +.P +.RS 2 +.nf +{ + "name": "my-program", + "version": "1.2.5", + "bin": { + "my-program": "path/to/program" + } +} +.fi +.RE +.P +Please make sure that your file(s) referenced in \fBbin\fR starts with \fB#!/usr/bin/env node\fR, otherwise the scripts are started without the node executable! +.P +Note that you can also set the executable files using \fBdirectories.bin\fR \fI(directories.bin)\fR. +.P +See \fBfolders\fR \fI\(la/configuring-npm/folders#executables\(ra\fR for more info on executables. +.SS "man" +.P +Specify either a single file or an array of filenames to put in place for the \fBman\fR program to find. +.P +If only a single file is provided, then it's installed such that it is the result from \fBman \fR, regardless of its actual filename. For example: +.P +.RS 2 +.nf +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": "./man/doc.1" +} +.fi +.RE +.P +would link the \fB./man/doc.1\fR file in such that it is the target for \fBman +foo\fR +.P +If the filename doesn't start with the package name, then it's prefixed. So, this: +.P +.RS 2 +.nf +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": \[lB] + "./man/foo.1", + "./man/bar.1" + \[rB] +} +.fi +.RE +.P +will create files to do \fBman foo\fR and \fBman foo-bar\fR. +.P +Man files must end with a number, and optionally a \fB.gz\fR suffix if they are compressed. The number dictates which man section the file is installed into. +.P +.RS 2 +.nf +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": \[lB] + "./man/foo.1", + "./man/foo.2" + \[rB] +} +.fi +.RE +.P +will create entries for \fBman foo\fR and \fBman 2 foo\fR +.SS "directories" +.P +The CommonJS \fBPackages\fR \fI\(lahttp://wiki.commonjs.org/wiki/Packages/1.0\(ra\fR spec details a few ways that you can indicate the structure of your package using a \fBdirectories\fR object. If you look at \fBnpm's package.json\fR \fI\(lahttps://registry.npmjs.org/npm/latest\(ra\fR, you'll see that it has directories for doc, lib, and man. +.P +In the future, this information may be used in other creative ways. +.SS "directories.bin" +.P +If you specify a \fBbin\fR directory in \fBdirectories.bin\fR, all the files in that folder will be added. +.P +Because of the way the \fBbin\fR directive works, specifying both a \fBbin\fR path and setting \fBdirectories.bin\fR is an error. If you want to specify individual files, use \fBbin\fR, and for all the files in an existing \fBbin\fR directory, use \fBdirectories.bin\fR. +.SS "directories.man" +.P +A folder that is full of man pages. Sugar to generate a "man" array by walking the folder. +.SS "repository" +.P +Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the \fBnpm repo\fR command will be able to find you. +.P +Do it like this: +.P +.RS 2 +.nf +{ + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git" + } +} +.fi +.RE +.P +The URL should be a publicly available (perhaps read-only) URL that can be handed directly to a VCS program without any modification. It should not be a URL to an html project page that you put in your browser. It's for computers. +.P +For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for \fBnpm install\fR: +.P +.RS 2 +.nf +{ + "repository": "npm/npm", + + "repository": "github:user/repo", + + "repository": "gist:11081aaa281", + + "repository": "bitbucket:user/repo", + + "repository": "gitlab:user/repo" +} +.fi +.RE +.P +If the \fBpackage.json\fR for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives: +.P +.RS 2 +.nf +{ + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmpublish" + } +} +.fi +.RE +.SS "scripts" +.P +The "scripts" property is a dictionary containing script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the command to run at that point. +.P +See npm help scripts to find out more about writing package scripts. +.SS "config" +.P +A "config" object can be used to set configuration parameters used in package scripts that persist across upgrades. For instance, if a package had the following: +.P +.RS 2 +.nf +{ + "name": "foo", + "config": { + "port": "8080" + } +} +.fi +.RE +.P +It could also have a "start" command that referenced the \fBnpm_package_config_port\fR environment variable. +.SS "dependencies" +.P +Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL. +.P +\fBPlease do not put test harnesses or transpilers or other "development" time tools in your \fBdependencies\fB object.\fR See \fBdevDependencies\fR, below. +.P +See \fBsemver\fR \fI\(lahttps://github.com/npm/node-semver#versions\(ra\fR for more details about specifying version ranges. +.RS 0 +.IP \(bu 4 +\fBversion\fR Must match \fBversion\fR exactly +.IP \(bu 4 +\fB>version\fR Must be greater than \fBversion\fR +.IP \(bu 4 +\fB>=version\fR etc +.IP \(bu 4 +\fB=version1 <=version2\fR. +.IP \(bu 4 +\fBrange1 || range2\fR Passes if either range1 or range2 are satisfied. +.IP \(bu 4 +\fBgit...\fR See 'Git URLs as Dependencies' below +.IP \(bu 4 +\fBuser/repo\fR See 'GitHub URLs' below +.IP \(bu 4 +\fBtag\fR A specific version tagged and published as \fBtag\fR See npm help dist-tag +.IP \(bu 4 +\fBpath/path/path\fR See \fBLocal Paths\fR \fI(Local Paths)\fR below +.IP \(bu 4 +\fBnpm:@scope/pkg@version\fR Custom alias for a pacakge See \fB\fBpackage-spec\fR\fR \fI\(la/using-npm/package-spec#aliases\(ra\fR +.RE 0 + +.P +For example, these are all valid: +.P +.RS 2 +.nf +{ + "dependencies": { + "foo": "1.0.0 - 2.9999.9999", + "bar": ">=1.0.2 <2.1.2", + "baz": ">1.0.2 <=2.3.4", + "boo": "2.0.1", + "qux": "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0", + "asd": "http://asdf.com/asdf.tar.gz", + "til": "~1.2", + "elf": "~1.2.3", + "two": "2.x", + "thr": "3.3.x", + "lat": "latest", + "dyl": "file:../dyl", + "kpg": "npm:pkg@1.0.0" + } +} +.fi +.RE +.SS "URLs as Dependencies" +.P +You may specify a tarball URL in place of a version range. +.P +This tarball will be downloaded and installed locally to your package at install time. +.SS "Git URLs as Dependencies" +.P +Git URLs are of the form: +.P +.RS 2 +.nf +://\[lB]\[lB]:\[rB]@\[rB]\[lB]:\[rB]\[lB]:\[rB]\[lB]/\[rB]\[lB]# | #semver:\[rB] +.fi +.RE +.P +\fB\fR is one of \fBgit\fR, \fBgit+ssh\fR, \fBgit+http\fR, \fBgit+https\fR, or \fBgit+file\fR. +.P +If \fB#\fR is provided, it will be used to clone exactly that commit. If the commit-ish has the format \fB#semver:\fR, \fB\fR can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither \fB#\fR or \fB#semver:\fR is specified, then the default branch is used. +.P +Examples: +.P +.RS 2 +.nf +git+ssh://git@github.com:npm/cli.git#v1.0.27 +git+ssh://git@github.com:npm/cli#semver:^5.0 +git+https://isaacs@github.com/npm/cli.git +git://github.com/npm/cli.git#v1.0.27 +.fi +.RE +.P +When installing from a \fBgit\fR repository, the presence of certain fields in the \fBpackage.json\fR will cause npm to believe it needs to perform a build. To do so your repository will be cloned into a temporary directory, all of its deps installed, relevant scripts run, and the resulting directory packed and installed. +.P +This flow will occur if your git dependency uses \fBworkspaces\fR, or if any of the following scripts are present: +.RS 0 +.IP \(bu 4 +\fBbuild\fR +.IP \(bu 4 +\fBprepare\fR +.IP \(bu 4 +\fBprepack\fR +.IP \(bu 4 +\fBpreinstall\fR +.IP \(bu 4 +\fBinstall\fR +.IP \(bu 4 +\fBpostinstall\fR +.RE 0 + +.P +If your git repository includes pre-built artifacts, you will likely want to make sure that none of the above scripts are defined, or your dependency will be rebuilt for every installation. +.SS "GitHub URLs" +.P +As of version 1.1.65, you can refer to GitHub URLs as just "foo": "user/foo-project". Just as with git URLs, a \fBcommit-ish\fR suffix can be included. For example: +.P +.RS 2 +.nf +{ + "name": "foo", + "version": "0.0.0", + "dependencies": { + "express": "expressjs/express", + "mocha": "mochajs/mocha#4727d357ea", + "module": "user/repo#feature\[rs]/branch" + } +} +.fi +.RE +.SS "Local Paths" +.P +As of version 2.0.0 you can provide a path to a local directory that contains a package. Local paths can be saved using \fBnpm install -S\fR or \fBnpm +install --save\fR, using any of these forms: +.P +.RS 2 +.nf +../foo/bar +~/foo/bar +./foo/bar +/foo/bar +.fi +.RE +.P +in which case they will be normalized to a relative path and added to your \fBpackage.json\fR. For example: +.P +.RS 2 +.nf +{ + "name": "baz", + "dependencies": { + "bar": "file:../foo/bar" + } +} +.fi +.RE +.P +This feature is helpful for local offline development and creating tests that require npm installing where you don't want to hit an external server, but should not be used when publishing your package to the public registry. +.P +\fInote\fR: Packages linked by local path will not have their own dependencies installed when \fBnpm install\fR is ran in this case. You must run \fBnpm install\fR from inside the local path itself. +.SS "devDependencies" +.P +If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the external test or documentation framework that you use. +.P +In this case, it's best to map these additional items in a \fBdevDependencies\fR object. +.P +These things will be installed when doing \fBnpm link\fR or \fBnpm install\fR from the root of a package, and can be managed like any other npm configuration param. See npm help config for more on the topic. +.P +For build steps that are not platform-specific, such as compiling CoffeeScript or other languages to JavaScript, use the \fBprepare\fR script to do this, and make the required package a devDependency. +.P +For example: +.P +.RS 2 +.nf +{ + "name": "ethopia-waza", + "description": "a delightfully fruity coffee varietal", + "version": "1.2.3", + "devDependencies": { + "coffee-script": "~1.6.3" + }, + "scripts": { + "prepare": "coffee -o lib/ -c src/waza.coffee" + }, + "main": "lib/waza.js" +} +.fi +.RE +.P +The \fBprepare\fR script will be run before publishing, so that users can consume the functionality without requiring them to compile it themselves. In dev mode (ie, locally running \fBnpm install\fR), it'll run this script as well, so that you can test it easily. +.SS "peerDependencies" +.P +In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a \fBrequire\fR of this host. This is usually referred to as a \fIplugin\fR. Notably, your module may be exposing a specific interface, expected and specified by the host documentation. +.P +For example: +.P +.RS 2 +.nf +{ + "name": "tea-latte", + "version": "1.3.5", + "peerDependencies": { + "tea": "2.x" + } +} +.fi +.RE +.P +This ensures your package \fBtea-latte\fR can be installed \fIalong\fR with the second major version of the host package \fBtea\fR only. \fBnpm install +tea-latte\fR could possibly yield the following dependency graph: +.P +.RS 2 +.nf +├── tea-latte@1.3.5 +└── tea@2.2.0 +.fi +.RE +.P +In npm versions 3 through 6, \fBpeerDependencies\fR were not automatically installed, and would raise a warning if an invalid version of the peer dependency was found in the tree. As of npm v7, peerDependencies \fIare\fR installed by default. +.P +Trying to install another plugin with a conflicting requirement may cause an error if the tree cannot be resolved correctly. For this reason, make sure your plugin requirement is as broad as possible, and not to lock it down to specific patch versions. +.P +Assuming the host complies with \fBsemver\fR \fI\(lahttps://semver.org/\(ra\fR, only changes in the host package's major version will break your plugin. Thus, if you've worked with every 1.x version of the host package, use \fB"^1.0"\fR or \fB"1.x"\fR to express this. If you depend on features introduced in 1.5.2, use \fB"^1.5.2"\fR. +.SS "peerDependenciesMeta" +.P +The \fBpeerDependenciesMeta\fR field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer dependencies to be marked as optional. Npm will not automatically install optional peer dependencies. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed. +.P +For example: +.P +.RS 2 +.nf +{ + "name": "tea-latte", + "version": "1.3.5", + "peerDependencies": { + "tea": "2.x", + "soy-milk": "1.2" + }, + "peerDependenciesMeta": { + "soy-milk": { + "optional": true + } + } +} +.fi +.RE +.SS "bundleDependencies" +.P +This defines an array of package names that will be bundled when publishing the package. +.P +In cases where you need to preserve npm packages locally or have them available through a single file download, you can bundle the packages in a tarball file by specifying the package names in the \fBbundleDependencies\fR array and executing \fBnpm pack\fR. +.P +For example: +.P +If we define a package.json like this: +.P +.RS 2 +.nf +{ + "name": "awesome-web-framework", + "version": "1.0.0", + "bundleDependencies": \[lB] + "renderized", + "super-streams" + \[rB] +} +.fi +.RE +.P +we can obtain \fBawesome-web-framework-1.0.0.tgz\fR file by running \fBnpm pack\fR. This file contains the dependencies \fBrenderized\fR and \fBsuper-streams\fR which can be installed in a new project by executing \fBnpm install +awesome-web-framework-1.0.0.tgz\fR. Note that the package names do not include any versions, as that information is specified in \fBdependencies\fR. +.P +If this is spelled \fB"bundledDependencies"\fR, then that is also honored. +.P +Alternatively, \fB"bundleDependencies"\fR can be defined as a boolean value. A value of \fBtrue\fR will bundle all dependencies, a value of \fBfalse\fR will bundle none. +.SS "optionalDependencies" +.P +If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the \fBoptionalDependencies\fR object. This is a map of package name to version or URL, just like the \fBdependencies\fR object. The difference is that build failures do not cause installation to fail. Running \fBnpm install +--omit=optional\fR will prevent these dependencies from being installed. +.P +It is still your program's responsibility to handle the lack of the dependency. For example, something like this: +.P +.RS 2 +.nf +try { + var foo = require('foo') + var fooVersion = require('foo/package.json').version +} catch (er) { + foo = null +} +if ( notGoodFooVersion(fooVersion) ) { + foo = null +} + +// .. then later in your program .. + +if (foo) { + foo.doFooThings() +} +.fi +.RE +.P +Entries in \fBoptionalDependencies\fR will override entries of the same name in \fBdependencies\fR, so it's usually best to only put in one place. +.SS "overrides" +.P +If you need to make specific changes to dependencies of your dependencies, for example replacing the version of a dependency with a known security issue, replacing an existing dependency with a fork, or making sure that the same version of a package is used everywhere, then you may add an override. +.P +Overrides provide a way to replace a package in your dependency tree with another version, or another package entirely. These changes can be scoped as specific or as vague as desired. +.P +Overrides are only considered in the root \fBpackage.json\fR file for a project. Overrides in installed dependencies (including npm help workspaces) are not considered in dependency tree resolution. Published packages may dictate their resolutions by pinning dependencies or using an \fB\fBnpm-shrinkwrap.json\fR\fR \fI\(la/configuring-npm/npm-shrinkwrap-json\(ra\fR file. +.P +To make sure the package \fBfoo\fR is always installed as version \fB1.0.0\fR no matter what version your dependencies rely on: +.P +.RS 2 +.nf +{ + "overrides": { + "foo": "1.0.0" + } +} +.fi +.RE +.P +The above is a short hand notation, the full object form can be used to allow overriding a package itself as well as a child of the package. This will cause \fBfoo\fR to always be \fB1.0.0\fR while also making \fBbar\fR at any depth beyond \fBfoo\fR also \fB1.0.0\fR: +.P +.RS 2 +.nf +{ + "overrides": { + "foo": { + ".": "1.0.0", + "bar": "1.0.0" + } + } +} +.fi +.RE +.P +To only override \fBfoo\fR to be \fB1.0.0\fR when it's a child (or grandchild, or great grandchild, etc) of the package \fBbar\fR: +.P +.RS 2 +.nf +{ + "overrides": { + "bar": { + "foo": "1.0.0" + } + } +} +.fi +.RE +.P +Keys can be nested to any arbitrary length. To override \fBfoo\fR only when it's a child of \fBbar\fR and only when \fBbar\fR is a child of \fBbaz\fR: +.P +.RS 2 +.nf +{ + "overrides": { + "baz": { + "bar": { + "foo": "1.0.0" + } + } + } +} +.fi +.RE +.P +The key of an override can also include a version, or range of versions. To override \fBfoo\fR to \fB1.0.0\fR, but only when it's a child of \fBbar@2.0.0\fR: +.P +.RS 2 +.nf +{ + "overrides": { + "bar@2.0.0": { + "foo": "1.0.0" + } + } +} +.fi +.RE +.P +You may not set an override for a package that you directly depend on unless both the dependency and the override itself share the exact same spec. To make this limitation easier to deal with, overrides may also be defined as a reference to a spec for a direct dependency by prefixing the name of the package you wish the version to match with a \fB$\fR. +.P +.RS 2 +.nf +{ + "dependencies": { + "foo": "^1.0.0" + }, + "overrides": { + // BAD, will throw an EOVERRIDE error + // "foo": "^2.0.0" + // GOOD, specs match so override is allowed + // "foo": "^1.0.0" + // BEST, the override is defined as a reference to the dependency + "foo": "$foo", + // the referenced package does not need to match the overridden one + "bar": "$foo" + } +} +.fi +.RE +.SS "engines" +.P +You can specify the version of node that your stuff works on: +.P +.RS 2 +.nf +{ + "engines": { + "node": ">=0.10.3 <15" + } +} +.fi +.RE +.P +And, like with dependencies, if you don't specify the version (or if you specify "*" as the version), then any version of node will do. +.P +You can also use the "engines" field to specify which versions of npm are capable of properly installing your program. For example: +.P +.RS 2 +.nf +{ + "engines": { + "npm": "~1.0.20" + } +} +.fi +.RE +.P +Unless the user has set the \fB\fBengine-strict\fR config\fR \fI\(la/using-npm/config#engine-strict\(ra\fR flag, this field is advisory only and will only produce warnings when your package is installed as a dependency. +.SS "os" +.P +You can specify which operating systems your module will run on: +.P +.RS 2 +.nf +{ + "os": \[lB] + "darwin", + "linux" + \[rB] +} +.fi +.RE +.P +You can also block instead of allowing operating systems, just prepend the blocked os with a '!': +.P +.RS 2 +.nf +{ + "os": \[lB] + "!win32" + \[rB] +} +.fi +.RE +.P +The host operating system is determined by \fBprocess.platform\fR +.P +It is allowed to both block and allow an item, although there isn't any good reason to do this. +.SS "cpu" +.P +If your code only runs on certain cpu architectures, you can specify which ones. +.P +.RS 2 +.nf +{ + "cpu": \[lB] + "x64", + "ia32" + \[rB] +} +.fi +.RE +.P +Like the \fBos\fR option, you can also block architectures: +.P +.RS 2 +.nf +{ + "cpu": \[lB] + "!arm", + "!mips" + \[rB] +} +.fi +.RE +.P +The host architecture is determined by \fBprocess.arch\fR +.SS "libc" +.P +If your code only runs or builds in certain versions of libc, you can specify which ones. This field only applies if \fBos\fR is \fBlinux\fR. +.P +.RS 2 +.nf +{ + "os": "linux", + "libc": "glibc" +} +.fi +.RE +.SS "devEngines" +.P +The \fBdevEngines\fR field aids engineers working on a codebase to all be using the same tooling. +.P +You can specify a \fBdevEngines\fR property in your \fBpackage.json\fR which will run before \fBinstall\fR, \fBci\fR, and \fBrun\fR commands. +.RS 0 +.P +Note: \fBengines\fR and \fBdevEngines\fR differ in object shape. They also function very differently. \fBengines\fR is designed to alert the user when a dependency uses a differening npm or node version that the project it's being used in, whereas \fBdevEngines\fR is used to alert people interacting with the source code of a project. +.RE 0 + +.P +The supported keys under the \fBdevEngines\fR property are \fBcpu\fR, \fBos\fR, \fBlibc\fR, \fBruntime\fR, and \fBpackageManager\fR. Each property can be an object or an array of objects. Objects must contain \fBname\fR, and optionally can specify \fBversion\fR, and \fBonFail\fR. \fBonFail\fR can be \fBwarn\fR, \fBerror\fR, or \fBignore\fR, and if left undefined is of the same value as \fBerror\fR. \fBnpm\fR will assume that you're running with \fBnode\fR. Here's an example of a project that will fail if the environment is not \fBnode\fR and \fBnpm\fR. If you set \fBruntime.name\fR or \fBpackageManager.name\fR to any other string, it will fail within the npm CLI. +.P +.RS 2 +.nf +{ + "devEngines": { + "runtime": { + "name": "node", + "onFail": "error" + }, + "packageManager": { + "name": "npm", + "onFail": "error" + } + } +} +.fi +.RE +.SS "private" +.P +If you set \fB"private": true\fR in your package.json, then npm will refuse to publish it. +.P +This is a way to prevent accidental publication of private repositories. If you would like to ensure that a given package is only ever published to a specific registry (for example, an internal registry), then use the \fBpublishConfig\fR dictionary described below to override the \fBregistry\fR config param at publish-time. +.SS "publishConfig" +.P +This is a set of config values that will be used at publish-time. It's especially handy if you want to set the tag, registry or access, so that you can ensure that a given package is not tagged with "latest", published to the global public registry or that a scoped module is private by default. +.P +See npm help config to see the list of config options that can be overridden. +.SS "workspaces" +.P +The optional \fBworkspaces\fR field is an array of file patterns that describes locations within the local file system that the install client should look up to find each npm help workspace that needs to be symlinked to the top level \fBnode_modules\fR folder. +.P +It can describe either the direct paths of the folders to be used as workspaces or it can define globs that will resolve to these same folders. +.P +In the following example, all folders located inside the folder \fB./packages\fR will be treated as workspaces as long as they have valid \fBpackage.json\fR files inside them: +.P +.RS 2 +.nf +{ + "name": "workspace-example", + "workspaces": \[lB] + "./packages/*" + \[rB] +} +.fi +.RE +.P +See npm help workspaces for more examples. +.SS "DEFAULT VALUES" +.P +npm will default some values based on package contents. +.RS 0 +.IP \(bu 4 +\fB"scripts": {"start": "node server.js"}\fR +.P +If there is a \fBserver.js\fR file in the root of your package, then npm will default the \fBstart\fR command to \fBnode server.js\fR. +.IP \(bu 4 +\fB"scripts":{"install": "node-gyp rebuild"}\fR +.P +If there is a \fBbinding.gyp\fR file in the root of your package and you have not defined an \fBinstall\fR or \fBpreinstall\fR script, npm will default the \fBinstall\fR command to compile using node-gyp. +.IP \(bu 4 +\fB"contributors": \[lB]...\[rB]\fR +.P +If there is an \fBAUTHORS\fR file in the root of your package, npm will treat each line as a \fBName (url)\fR format, where email and url are optional. Lines which start with a \fB#\fR or are blank, will be ignored. +.RE 0 + +.SS "SEE ALSO" +.RS 0 +.IP \(bu 4 +\fBsemver\fR \fI\(lahttps://github.com/npm/node-semver#versions\(ra\fR +.IP \(bu 4 +npm help workspaces +.IP \(bu 4 +npm help init +.IP \(bu 4 +npm help version +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help help +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help uninstall +.RE 0 diff --git a/node_modules/npm/man/man5/npm-shrinkwrap-json.5 b/node_modules/npm/man/man5/npm-shrinkwrap-json.5 new file mode 100644 index 00000000..0600f5d6 --- /dev/null +++ b/node_modules/npm/man/man5/npm-shrinkwrap-json.5 @@ -0,0 +1,23 @@ +.TH "NPM-SHRINKWRAP.JSON" "5" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpm-shrinkwrap.json\fR - A publishable lockfile +.SS "Description" +.P +\fBnpm-shrinkwrap.json\fR is a file created by npm help shrinkwrap. It is identical to \fBpackage-lock.json\fR, with one major caveat: Unlike \fBpackage-lock.json\fR, \fBnpm-shrinkwrap.json\fR may be included when publishing a package. +.P +The recommended use-case for \fBnpm-shrinkwrap.json\fR is applications deployed through the publishing process on the registry: for example, daemons and command-line tools intended as global installs or \fBdevDependencies\fR. It's strongly discouraged for library authors to publish this file, since that would prevent end users from having control over transitive dependency updates. +.P +If both \fBpackage-lock.json\fR and \fBnpm-shrinkwrap.json\fR are present in a package root, \fBnpm-shrinkwrap.json\fR will be preferred over the \fBpackage-lock.json\fR file. +.P +For full details and description of the \fBnpm-shrinkwrap.json\fR file format, refer to the manual page for \fBpackage-lock.json\fR \fI\(la/configuring-npm/package-lock-json\(ra\fR. +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help shrinkwrap +.IP \(bu 4 +\fBpackage-lock.json\fR \fI\(la/configuring-npm/package-lock-json\(ra\fR +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help install +.RE 0 diff --git a/node_modules/npm/man/man5/npmrc.5 b/node_modules/npm/man/man5/npmrc.5 new file mode 100644 index 00000000..098793f1 --- /dev/null +++ b/node_modules/npm/man/man5/npmrc.5 @@ -0,0 +1,132 @@ +.TH "NPMRC" "5" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBnpmrc\fR - The npm config files +.SS "Description" +.P +npm gets its config settings from the command line, environment variables, and \fBnpmrc\fR files. +.P +The \fBnpm config\fR command can be used to update and edit the contents of the user and global npmrc files. +.P +For a list of available configuration options, see npm help config. +.SS "Files" +.P +The four relevant files are: +.RS 0 +.IP \(bu 4 +per-project config file (\fB/path/to/my/project/.npmrc\fR) +.IP \(bu 4 +per-user config file (\fB~/.npmrc\fR) +.IP \(bu 4 +global config file (\fB$PREFIX/etc/npmrc\fR) +.IP \(bu 4 +npm builtin config file (\fB/path/to/npm/npmrc\fR) +.RE 0 + +.P +All npm config files are an ini-formatted list of \fBkey = value\fR parameters. Environment variables can be replaced using \fB${VARIABLE_NAME}\fR. For example: +.P +.RS 2 +.nf +cache = ${HOME}/.npm-packages +.fi +.RE +.P +Each of these files is loaded, and config options are resolved in priority order. For example, a setting in the userconfig file would override the setting in the globalconfig file. +.P +Array values are specified by adding "\[lB]\[rB]" after the key name. For example: +.P +.RS 2 +.nf +key\[lB]\[rB] = "first value" +key\[lB]\[rB] = "second value" +.fi +.RE +.SS "Comments" +.P +Lines in \fB.npmrc\fR files are interpreted as comments when they begin with a \fB;\fR or \fB#\fR character. \fB.npmrc\fR files are parsed by \fBnpm/ini\fR \fI\(lahttps://github.com/npm/ini\(ra\fR, which specifies this comment syntax. +.P +For example: +.P +.RS 2 +.nf +# last modified: 01 Jan 2016 +; Set a new registry for a scoped package +@myscope:registry=https://mycustomregistry.example.org +.fi +.RE +.SS "Per-project config file" +.P +When working locally in a project, a \fB.npmrc\fR file in the root of the project (ie, a sibling of \fBnode_modules\fR and \fBpackage.json\fR) will set config values specific to this project. +.P +Note that this only applies to the root of the project that you're running npm in. It has no effect when your module is published. For example, you can't publish a module that forces itself to install globally, or in a different location. +.P +Additionally, this file is not read in global mode, such as when running \fBnpm install -g\fR. +.SS "Per-user config file" +.P +\fB$HOME/.npmrc\fR (or the \fBuserconfig\fR param, if set in the environment or on the command line) +.SS "Global config file" +.P +\fB$PREFIX/etc/npmrc\fR (or the \fBglobalconfig\fR param, if set above): This file is an ini-file formatted list of \fBkey = value\fR parameters. Environment variables can be replaced as above. +.SS "Built-in config file" +.P +\fBpath/to/npm/itself/npmrc\fR +.P +This is an unchangeable "builtin" configuration file that npm keeps consistent across updates. Set fields in here using the \fB./configure\fR script that comes with npm. This is primarily for distribution maintainers to override default configs in a standard and consistent manner. +.SS "Auth related configuration" +.P +The settings \fB_auth\fR, \fB_authToken\fR, \fBusername\fR and \fB_password\fR must all be scoped to a specific registry. This ensures that \fBnpm\fR will never send credentials to the wrong host. +.P +The full list is: +.RS 0 +.IP \(bu 4 +\fB_auth\fR (base64 authentication string) +.IP \(bu 4 +\fB_authToken\fR (authentication token) +.IP \(bu 4 +\fBusername\fR +.IP \(bu 4 +\fB_password\fR +.IP \(bu 4 +\fBemail\fR +.IP \(bu 4 +\fBcafile\fR (path to certificate authority file) +.IP \(bu 4 +\fBkeyfile\fR (path to key file) +.RE 0 + +.P +In order to scope these values, they must be prefixed by a URI fragment. If the credential is meant for any request to a registry on a single host, the scope may look like \fB//registry.npmjs.org/:\fR. If it must be scoped to a specific path on the host that path may also be provided, such as \fB//my-custom-registry.org/unique/path:\fR. +.P +.RS 2 +.nf +; bad config +_authToken=MYTOKEN + +; good config +@myorg:registry=https://somewhere-else.com/myorg +@another:registry=https://somewhere-else.com/another +//registry.npmjs.org/:_authToken=MYTOKEN + +; would apply to both @myorg and @another +//somewhere-else.com/:_authToken=MYTOKEN + +; would apply only to @myorg +//somewhere-else.com/myorg/:_authToken=MYTOKEN1 + +; would apply only to @another +//somewhere-else.com/another/:_authToken=MYTOKEN2 +.fi +.RE +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help config +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help npm +.RE 0 diff --git a/node_modules/npm/man/man5/package-json.5 b/node_modules/npm/man/man5/package-json.5 new file mode 100644 index 00000000..4b807fbf --- /dev/null +++ b/node_modules/npm/man/man5/package-json.5 @@ -0,0 +1,1160 @@ +.TH "PACKAGE.JSON" "5" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBpackage.json\fR - Specifics of npm's package.json handling +.SS "Description" +.P +This document is all you need to know about what's required in your package.json file. It must be actual JSON, not just a JavaScript object literal. +.P +A lot of the behavior described in this document is affected by the config settings described in npm help config. +.SS "name" +.P +If you plan to publish your package, the \fImost\fR important things in your package.json are the name and version fields as they will be required. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version. If you don't plan to publish your package, the name and version fields are optional. +.P +The name is what your thing is called. +.P +Some rules: +.RS 0 +.IP \(bu 4 +The name must be less than or equal to 214 characters. This includes the scope for scoped packages. +.IP \(bu 4 +The names of scoped packages can begin with a dot or an underscore. This is not permitted without a scope. +.IP \(bu 4 +New packages must not have uppercase letters in the name. +.IP \(bu 4 +The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can't contain any non-URL-safe characters. +.RE 0 + +.P +Some tips: +.RS 0 +.IP \(bu 4 +Don't use the same name as a core Node module. +.IP \(bu 4 +Don't put "js" or "node" in the name. It's assumed that it's js, since you're writing a package.json file, and you can specify the engine using the "\fBengines\fR \fI(engines)\fR" field. (See below.) +.IP \(bu 4 +The name will probably be passed as an argument to require(), so it should be something short, but also reasonably descriptive. +.IP \(bu 4 +You may want to check the npm registry to see if there's something by that name already, before you get too attached to it. \fI\(lahttps://www.npmjs.com/\(ra\fR +.RE 0 + +.P +A name can be optionally prefixed by a scope, e.g. \fB@myorg/mypackage\fR. See npm help scope for more detail. +.SS "version" +.P +If you plan to publish your package, the \fImost\fR important things in your package.json are the name and version fields as they will be required. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version. If you don't plan to publish your package, the name and version fields are optional. +.P +Version must be parseable by \fBnode-semver\fR \fI\(lahttps://github.com/npm/node-semver\(ra\fR, which is bundled with npm as a dependency. (\fBnpm install semver\fR to use it yourself.) +.SS "description" +.P +Put a description in it. It's a string. This helps people discover your package, as it's listed in \fBnpm search\fR. +.SS "keywords" +.P +Put keywords in it. It's an array of strings. This helps people discover your package as it's listed in \fBnpm search\fR. +.SS "homepage" +.P +The URL to the project homepage. +.P +Example: +.P +.RS 2 +.nf +"homepage": "https://github.com/owner/project#readme" +.fi +.RE +.SS "bugs" +.P +The URL to your project's issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package. +.P +It should look like this: +.P +.RS 2 +.nf +{ + "bugs": { + "url": "https://github.com/owner/project/issues", + "email": "project@hostname.com" + } +} +.fi +.RE +.P +You can specify either one or both values. If you want to provide only a URL, you can specify the value for "bugs" as a simple string instead of an object. +.P +If a URL is provided, it will be used by the \fBnpm bugs\fR command. +.SS "license" +.P +You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it. +.P +If you're using a common license such as BSD-2-Clause or MIT, add a current SPDX license identifier for the license you're using, like this: +.P +.RS 2 +.nf +{ + "license" : "BSD-3-Clause" +} +.fi +.RE +.P +You can check \fBthe full list of SPDX license IDs\fR \fI\(lahttps://spdx.org/licenses/\(ra\fR. Ideally you should pick one that is \fBOSI\fR \fI\(lahttps://opensource.org/licenses/\(ra\fR approved. +.P +If your package is licensed under multiple common licenses, use an \fBSPDX license expression syntax version 2.0 string\fR \fI\(lahttps://spdx.dev/specifications/\(ra\fR, like this: +.P +.RS 2 +.nf +{ + "license" : "(ISC OR GPL-3.0)" +} +.fi +.RE +.P +If you are using a license that hasn't been assigned an SPDX identifier, or if you are using a custom license, use a string value like this one: +.P +.RS 2 +.nf +{ + "license" : "SEE LICENSE IN " +} +.fi +.RE +.P +Then include a file named \fB\fR at the top level of the package. +.P +Some old packages used license objects or a "licenses" property containing an array of license objects: +.P +.RS 2 +.nf +// Not valid metadata +{ + "license" : { + "type" : "ISC", + "url" : "https://opensource.org/licenses/ISC" + } +} + +// Not valid metadata +{ + "licenses" : \[lB] + { + "type": "MIT", + "url": "https://www.opensource.org/licenses/mit-license.php" + }, + { + "type": "Apache-2.0", + "url": "https://opensource.org/licenses/apache2.0.php" + } + \[rB] +} +.fi +.RE +.P +Those styles are now deprecated. Instead, use SPDX expressions, like this: +.P +.RS 2 +.nf +{ + "license": "ISC" +} +.fi +.RE +.P +.RS 2 +.nf +{ + "license": "(MIT OR Apache-2.0)" +} +.fi +.RE +.P +Finally, if you do not wish to grant others the right to use a private or unpublished package under any terms: +.P +.RS 2 +.nf +{ + "license": "UNLICENSED" +} +.fi +.RE +.P +Consider also setting \fB"private": true\fR to prevent accidental publication. +.SS "people fields: author, contributors" +.P +The "author" is one person. "contributors" is an array of people. A "person" is an object with a "name" field and optionally "url" and "email", like this: +.P +.RS 2 +.nf +{ + "name" : "Barney Rubble", + "email" : "b@rubble.com", + "url" : "http://barnyrubble.tumblr.com/" +} +.fi +.RE +.P +Or you can shorten that all into a single string, and npm will parse it for you: +.P +.RS 2 +.nf +{ + "author": "Barney Rubble (http://barnyrubble.tumblr.com/)" +} +.fi +.RE +.P +Both email and url are optional either way. +.P +npm also sets a top-level "maintainers" field with your npm user info. +.SS "funding" +.P +You can specify an object containing a URL that provides up-to-date information about ways to help fund development of your package, a string URL, or an array of objects and string URLs: +.P +.RS 2 +.nf +{ + "funding": { + "type" : "individual", + "url" : "http://example.com/donate" + } +} +.fi +.RE +.P +.RS 2 +.nf +{ + "funding": { + "type" : "patreon", + "url" : "https://www.patreon.com/my-account" + } +} +.fi +.RE +.P +.RS 2 +.nf +{ + "funding": "http://example.com/donate" +} +.fi +.RE +.P +.RS 2 +.nf +{ + "funding": \[lB] + { + "type" : "individual", + "url" : "http://example.com/donate" + }, + "http://example.com/donateAlso", + { + "type" : "patreon", + "url" : "https://www.patreon.com/my-account" + } + \[rB] +} +.fi +.RE +.P +Users can use the \fBnpm fund\fR subcommand to list the \fBfunding\fR URLs of all dependencies of their project, direct and indirect. A shortcut to visit each funding URL is also available when providing the project name such as: \fBnpm fund \fR (when there are multiple URLs, the first one will be visited) +.SS "files" +.P +The optional \fBfiles\fR field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to \fB.gitignore\fR, but reversed: including a file, directory, or glob pattern (\fB*\fR, \fB**/*\fR, and such) will make it so that file is included in the tarball when it's packed. Omitting the field will make it default to \fB\[lB]"*"\[rB]\fR, which means it will include all files. +.P +Some special files and directories are also included or excluded regardless of whether they exist in the \fBfiles\fR array (see below). +.P +You can also provide a \fB.npmignore\fR file in the root of your package or in subdirectories, which will keep files from being included. At the root of your package it will not override the "files" field, but in subdirectories it will. The \fB.npmignore\fR file works just like a \fB.gitignore\fR. If there is a \fB.gitignore\fR file, and \fB.npmignore\fR is missing, \fB.gitignore\fR's contents will be used instead. +.P +Certain files are always included, regardless of settings: +.RS 0 +.IP \(bu 4 +\fBpackage.json\fR +.IP \(bu 4 +\fBREADME\fR +.IP \(bu 4 +\fBLICENSE\fR / \fBLICENCE\fR +.IP \(bu 4 +The file in the "main" field +.IP \(bu 4 +The file(s) in the "bin" field +.RE 0 + +.P +\fBREADME\fR & \fBLICENSE\fR can have any case and extension. +.P +Some files are always ignored by default: +.RS 0 +.IP \(bu 4 +\fB*.orig\fR +.IP \(bu 4 +\fB.*.swp\fR +.IP \(bu 4 +\fB.DS_Store\fR +.IP \(bu 4 +\fB._*\fR +.IP \(bu 4 +\fB.git\fR +.IP \(bu 4 +\fB.hg\fR +.IP \(bu 4 +\fB.lock-wscript\fR +.IP \(bu 4 +\fB.npmrc\fR +.IP \(bu 4 +\fB.svn\fR +.IP \(bu 4 +\fB.wafpickle-N\fR +.IP \(bu 4 +\fBCVS\fR +.IP \(bu 4 +\fBconfig.gypi\fR +.IP \(bu 4 +\fBnode_modules\fR +.IP \(bu 4 +\fBnpm-debug.log\fR +.IP \(bu 4 +\fBpackage-lock.json\fR (use \fB\fBnpm-shrinkwrap.json\fR\fR \fI\(la/configuring-npm/npm-shrinkwrap-json\(ra\fR if you wish it to be published) +.IP \(bu 4 +\fBpnpm-lock.yaml\fR +.IP \(bu 4 +\fByarn.lock\fR +.IP \(bu 4 +\fBbun.lockb\fR +.RE 0 + +.P +Most of these ignored files can be included specifically if included in the \fBfiles\fR globs. Exceptions to this are: +.RS 0 +.IP \(bu 4 +\fB.git\fR +.IP \(bu 4 +\fB.npmrc\fR +.IP \(bu 4 +\fBnode_modules\fR +.IP \(bu 4 +\fBpackage-lock.json\fR +.IP \(bu 4 +\fBpnpm-lock.yaml\fR +.IP \(bu 4 +\fByarn.lock\fR +.IP \(bu 4 +\fBbun.lockb\fR +.RE 0 + +.P +These can not be included. +.SS "exports" +.P +The "exports" provides a modern alternative to "main" allowing multiple entry points to be defined, conditional entry resolution support between environments, and preventing any other entry points besides those defined in "exports". This encapsulation allows module authors to clearly define the public interface for their package. For more details see the \fBnode.js documentation on package entry points\fR \fI\(lahttps://nodejs.org/api/packages.html#package-entry-points\(ra\fR +.SS "main" +.P +The main field is a module ID that is the primary entry point to your program. That is, if your package is named \fBfoo\fR, and a user installs it, and then does \fBrequire("foo")\fR, then your main module's exports object will be returned. +.P +This should be a module relative to the root of your package folder. +.P +For most modules, it makes the most sense to have a main script and often not much else. +.P +If \fBmain\fR is not set, it defaults to \fBindex.js\fR in the package's root folder. +.SS "browser" +.P +If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren't available in Node.js modules. (e.g. \fBwindow\fR) +.SS "bin" +.P +A lot of packages have one or more executable files that they'd like to install into the PATH. npm makes this pretty easy (in fact, it uses this feature to install the "npm" executable.) +.P +To use this, supply a \fBbin\fR field in your package.json which is a map of command name to local file name. When this package is installed globally, that file will be either linked inside the global bins directory or a cmd (Windows Command File) will be created which executes the specified file in the \fBbin\fR field, so it is available to run by \fBname\fR or \fBname.cmd\fR (on Windows PowerShell). When this package is installed as a dependency in another package, the file will be linked where it will be available to that package either directly by \fBnpm exec\fR or by name in other scripts when invoking them via \fBnpm run-script\fR. +.P +For example, myapp could have this: +.P +.RS 2 +.nf +{ + "bin": { + "myapp": "bin/cli.js" + } +} +.fi +.RE +.P +So, when you install myapp, in case of unix-like OS it'll create a symlink from the \fBcli.js\fR script to \fB/usr/local/bin/myapp\fR and in case of windows it will create a cmd file usually at \fBC:\[rs]Users\[rs]{Username}\[rs]AppData\[rs]Roaming\[rs]npm\[rs]myapp.cmd\fR which runs the \fBcli.js\fR script. +.P +If you have a single executable, and its name should be the name of the package, then you can just supply it as a string. For example: +.P +.RS 2 +.nf +{ + "name": "my-program", + "version": "1.2.5", + "bin": "path/to/program" +} +.fi +.RE +.P +would be the same as this: +.P +.RS 2 +.nf +{ + "name": "my-program", + "version": "1.2.5", + "bin": { + "my-program": "path/to/program" + } +} +.fi +.RE +.P +Please make sure that your file(s) referenced in \fBbin\fR starts with \fB#!/usr/bin/env node\fR, otherwise the scripts are started without the node executable! +.P +Note that you can also set the executable files using \fBdirectories.bin\fR \fI(directories.bin)\fR. +.P +See \fBfolders\fR \fI\(la/configuring-npm/folders#executables\(ra\fR for more info on executables. +.SS "man" +.P +Specify either a single file or an array of filenames to put in place for the \fBman\fR program to find. +.P +If only a single file is provided, then it's installed such that it is the result from \fBman \fR, regardless of its actual filename. For example: +.P +.RS 2 +.nf +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": "./man/doc.1" +} +.fi +.RE +.P +would link the \fB./man/doc.1\fR file in such that it is the target for \fBman +foo\fR +.P +If the filename doesn't start with the package name, then it's prefixed. So, this: +.P +.RS 2 +.nf +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": \[lB] + "./man/foo.1", + "./man/bar.1" + \[rB] +} +.fi +.RE +.P +will create files to do \fBman foo\fR and \fBman foo-bar\fR. +.P +Man files must end with a number, and optionally a \fB.gz\fR suffix if they are compressed. The number dictates which man section the file is installed into. +.P +.RS 2 +.nf +{ + "name": "foo", + "version": "1.2.3", + "description": "A packaged foo fooer for fooing foos", + "main": "foo.js", + "man": \[lB] + "./man/foo.1", + "./man/foo.2" + \[rB] +} +.fi +.RE +.P +will create entries for \fBman foo\fR and \fBman 2 foo\fR +.SS "directories" +.P +The CommonJS \fBPackages\fR \fI\(lahttp://wiki.commonjs.org/wiki/Packages/1.0\(ra\fR spec details a few ways that you can indicate the structure of your package using a \fBdirectories\fR object. If you look at \fBnpm's package.json\fR \fI\(lahttps://registry.npmjs.org/npm/latest\(ra\fR, you'll see that it has directories for doc, lib, and man. +.P +In the future, this information may be used in other creative ways. +.SS "directories.bin" +.P +If you specify a \fBbin\fR directory in \fBdirectories.bin\fR, all the files in that folder will be added. +.P +Because of the way the \fBbin\fR directive works, specifying both a \fBbin\fR path and setting \fBdirectories.bin\fR is an error. If you want to specify individual files, use \fBbin\fR, and for all the files in an existing \fBbin\fR directory, use \fBdirectories.bin\fR. +.SS "directories.man" +.P +A folder that is full of man pages. Sugar to generate a "man" array by walking the folder. +.SS "repository" +.P +Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the \fBnpm repo\fR command will be able to find you. +.P +Do it like this: +.P +.RS 2 +.nf +{ + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git" + } +} +.fi +.RE +.P +The URL should be a publicly available (perhaps read-only) URL that can be handed directly to a VCS program without any modification. It should not be a URL to an html project page that you put in your browser. It's for computers. +.P +For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for \fBnpm install\fR: +.P +.RS 2 +.nf +{ + "repository": "npm/npm", + + "repository": "github:user/repo", + + "repository": "gist:11081aaa281", + + "repository": "bitbucket:user/repo", + + "repository": "gitlab:user/repo" +} +.fi +.RE +.P +If the \fBpackage.json\fR for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives: +.P +.RS 2 +.nf +{ + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmpublish" + } +} +.fi +.RE +.SS "scripts" +.P +The "scripts" property is a dictionary containing script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the command to run at that point. +.P +See npm help scripts to find out more about writing package scripts. +.SS "config" +.P +A "config" object can be used to set configuration parameters used in package scripts that persist across upgrades. For instance, if a package had the following: +.P +.RS 2 +.nf +{ + "name": "foo", + "config": { + "port": "8080" + } +} +.fi +.RE +.P +It could also have a "start" command that referenced the \fBnpm_package_config_port\fR environment variable. +.SS "dependencies" +.P +Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL. +.P +\fBPlease do not put test harnesses or transpilers or other "development" time tools in your \fBdependencies\fB object.\fR See \fBdevDependencies\fR, below. +.P +See \fBsemver\fR \fI\(lahttps://github.com/npm/node-semver#versions\(ra\fR for more details about specifying version ranges. +.RS 0 +.IP \(bu 4 +\fBversion\fR Must match \fBversion\fR exactly +.IP \(bu 4 +\fB>version\fR Must be greater than \fBversion\fR +.IP \(bu 4 +\fB>=version\fR etc +.IP \(bu 4 +\fB=version1 <=version2\fR. +.IP \(bu 4 +\fBrange1 || range2\fR Passes if either range1 or range2 are satisfied. +.IP \(bu 4 +\fBgit...\fR See 'Git URLs as Dependencies' below +.IP \(bu 4 +\fBuser/repo\fR See 'GitHub URLs' below +.IP \(bu 4 +\fBtag\fR A specific version tagged and published as \fBtag\fR See npm help dist-tag +.IP \(bu 4 +\fBpath/path/path\fR See \fBLocal Paths\fR \fI(Local Paths)\fR below +.IP \(bu 4 +\fBnpm:@scope/pkg@version\fR Custom alias for a pacakge See \fB\fBpackage-spec\fR\fR \fI\(la/using-npm/package-spec#aliases\(ra\fR +.RE 0 + +.P +For example, these are all valid: +.P +.RS 2 +.nf +{ + "dependencies": { + "foo": "1.0.0 - 2.9999.9999", + "bar": ">=1.0.2 <2.1.2", + "baz": ">1.0.2 <=2.3.4", + "boo": "2.0.1", + "qux": "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0", + "asd": "http://asdf.com/asdf.tar.gz", + "til": "~1.2", + "elf": "~1.2.3", + "two": "2.x", + "thr": "3.3.x", + "lat": "latest", + "dyl": "file:../dyl", + "kpg": "npm:pkg@1.0.0" + } +} +.fi +.RE +.SS "URLs as Dependencies" +.P +You may specify a tarball URL in place of a version range. +.P +This tarball will be downloaded and installed locally to your package at install time. +.SS "Git URLs as Dependencies" +.P +Git URLs are of the form: +.P +.RS 2 +.nf +://\[lB]\[lB]:\[rB]@\[rB]\[lB]:\[rB]\[lB]:\[rB]\[lB]/\[rB]\[lB]# | #semver:\[rB] +.fi +.RE +.P +\fB\fR is one of \fBgit\fR, \fBgit+ssh\fR, \fBgit+http\fR, \fBgit+https\fR, or \fBgit+file\fR. +.P +If \fB#\fR is provided, it will be used to clone exactly that commit. If the commit-ish has the format \fB#semver:\fR, \fB\fR can be any valid semver range or exact version, and npm will look for any tags or refs matching that range in the remote repository, much as it would for a registry dependency. If neither \fB#\fR or \fB#semver:\fR is specified, then the default branch is used. +.P +Examples: +.P +.RS 2 +.nf +git+ssh://git@github.com:npm/cli.git#v1.0.27 +git+ssh://git@github.com:npm/cli#semver:^5.0 +git+https://isaacs@github.com/npm/cli.git +git://github.com/npm/cli.git#v1.0.27 +.fi +.RE +.P +When installing from a \fBgit\fR repository, the presence of certain fields in the \fBpackage.json\fR will cause npm to believe it needs to perform a build. To do so your repository will be cloned into a temporary directory, all of its deps installed, relevant scripts run, and the resulting directory packed and installed. +.P +This flow will occur if your git dependency uses \fBworkspaces\fR, or if any of the following scripts are present: +.RS 0 +.IP \(bu 4 +\fBbuild\fR +.IP \(bu 4 +\fBprepare\fR +.IP \(bu 4 +\fBprepack\fR +.IP \(bu 4 +\fBpreinstall\fR +.IP \(bu 4 +\fBinstall\fR +.IP \(bu 4 +\fBpostinstall\fR +.RE 0 + +.P +If your git repository includes pre-built artifacts, you will likely want to make sure that none of the above scripts are defined, or your dependency will be rebuilt for every installation. +.SS "GitHub URLs" +.P +As of version 1.1.65, you can refer to GitHub URLs as just "foo": "user/foo-project". Just as with git URLs, a \fBcommit-ish\fR suffix can be included. For example: +.P +.RS 2 +.nf +{ + "name": "foo", + "version": "0.0.0", + "dependencies": { + "express": "expressjs/express", + "mocha": "mochajs/mocha#4727d357ea", + "module": "user/repo#feature\[rs]/branch" + } +} +.fi +.RE +.SS "Local Paths" +.P +As of version 2.0.0 you can provide a path to a local directory that contains a package. Local paths can be saved using \fBnpm install -S\fR or \fBnpm +install --save\fR, using any of these forms: +.P +.RS 2 +.nf +../foo/bar +~/foo/bar +./foo/bar +/foo/bar +.fi +.RE +.P +in which case they will be normalized to a relative path and added to your \fBpackage.json\fR. For example: +.P +.RS 2 +.nf +{ + "name": "baz", + "dependencies": { + "bar": "file:../foo/bar" + } +} +.fi +.RE +.P +This feature is helpful for local offline development and creating tests that require npm installing where you don't want to hit an external server, but should not be used when publishing your package to the public registry. +.P +\fInote\fR: Packages linked by local path will not have their own dependencies installed when \fBnpm install\fR is ran in this case. You must run \fBnpm install\fR from inside the local path itself. +.SS "devDependencies" +.P +If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the external test or documentation framework that you use. +.P +In this case, it's best to map these additional items in a \fBdevDependencies\fR object. +.P +These things will be installed when doing \fBnpm link\fR or \fBnpm install\fR from the root of a package, and can be managed like any other npm configuration param. See npm help config for more on the topic. +.P +For build steps that are not platform-specific, such as compiling CoffeeScript or other languages to JavaScript, use the \fBprepare\fR script to do this, and make the required package a devDependency. +.P +For example: +.P +.RS 2 +.nf +{ + "name": "ethopia-waza", + "description": "a delightfully fruity coffee varietal", + "version": "1.2.3", + "devDependencies": { + "coffee-script": "~1.6.3" + }, + "scripts": { + "prepare": "coffee -o lib/ -c src/waza.coffee" + }, + "main": "lib/waza.js" +} +.fi +.RE +.P +The \fBprepare\fR script will be run before publishing, so that users can consume the functionality without requiring them to compile it themselves. In dev mode (ie, locally running \fBnpm install\fR), it'll run this script as well, so that you can test it easily. +.SS "peerDependencies" +.P +In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a \fBrequire\fR of this host. This is usually referred to as a \fIplugin\fR. Notably, your module may be exposing a specific interface, expected and specified by the host documentation. +.P +For example: +.P +.RS 2 +.nf +{ + "name": "tea-latte", + "version": "1.3.5", + "peerDependencies": { + "tea": "2.x" + } +} +.fi +.RE +.P +This ensures your package \fBtea-latte\fR can be installed \fIalong\fR with the second major version of the host package \fBtea\fR only. \fBnpm install +tea-latte\fR could possibly yield the following dependency graph: +.P +.RS 2 +.nf +├── tea-latte@1.3.5 +└── tea@2.2.0 +.fi +.RE +.P +In npm versions 3 through 6, \fBpeerDependencies\fR were not automatically installed, and would raise a warning if an invalid version of the peer dependency was found in the tree. As of npm v7, peerDependencies \fIare\fR installed by default. +.P +Trying to install another plugin with a conflicting requirement may cause an error if the tree cannot be resolved correctly. For this reason, make sure your plugin requirement is as broad as possible, and not to lock it down to specific patch versions. +.P +Assuming the host complies with \fBsemver\fR \fI\(lahttps://semver.org/\(ra\fR, only changes in the host package's major version will break your plugin. Thus, if you've worked with every 1.x version of the host package, use \fB"^1.0"\fR or \fB"1.x"\fR to express this. If you depend on features introduced in 1.5.2, use \fB"^1.5.2"\fR. +.SS "peerDependenciesMeta" +.P +The \fBpeerDependenciesMeta\fR field serves to provide npm more information on how your peer dependencies are to be used. Specifically, it allows peer dependencies to be marked as optional. Npm will not automatically install optional peer dependencies. This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed. +.P +For example: +.P +.RS 2 +.nf +{ + "name": "tea-latte", + "version": "1.3.5", + "peerDependencies": { + "tea": "2.x", + "soy-milk": "1.2" + }, + "peerDependenciesMeta": { + "soy-milk": { + "optional": true + } + } +} +.fi +.RE +.SS "bundleDependencies" +.P +This defines an array of package names that will be bundled when publishing the package. +.P +In cases where you need to preserve npm packages locally or have them available through a single file download, you can bundle the packages in a tarball file by specifying the package names in the \fBbundleDependencies\fR array and executing \fBnpm pack\fR. +.P +For example: +.P +If we define a package.json like this: +.P +.RS 2 +.nf +{ + "name": "awesome-web-framework", + "version": "1.0.0", + "bundleDependencies": \[lB] + "renderized", + "super-streams" + \[rB] +} +.fi +.RE +.P +we can obtain \fBawesome-web-framework-1.0.0.tgz\fR file by running \fBnpm pack\fR. This file contains the dependencies \fBrenderized\fR and \fBsuper-streams\fR which can be installed in a new project by executing \fBnpm install +awesome-web-framework-1.0.0.tgz\fR. Note that the package names do not include any versions, as that information is specified in \fBdependencies\fR. +.P +If this is spelled \fB"bundledDependencies"\fR, then that is also honored. +.P +Alternatively, \fB"bundleDependencies"\fR can be defined as a boolean value. A value of \fBtrue\fR will bundle all dependencies, a value of \fBfalse\fR will bundle none. +.SS "optionalDependencies" +.P +If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the \fBoptionalDependencies\fR object. This is a map of package name to version or URL, just like the \fBdependencies\fR object. The difference is that build failures do not cause installation to fail. Running \fBnpm install +--omit=optional\fR will prevent these dependencies from being installed. +.P +It is still your program's responsibility to handle the lack of the dependency. For example, something like this: +.P +.RS 2 +.nf +try { + var foo = require('foo') + var fooVersion = require('foo/package.json').version +} catch (er) { + foo = null +} +if ( notGoodFooVersion(fooVersion) ) { + foo = null +} + +// .. then later in your program .. + +if (foo) { + foo.doFooThings() +} +.fi +.RE +.P +Entries in \fBoptionalDependencies\fR will override entries of the same name in \fBdependencies\fR, so it's usually best to only put in one place. +.SS "overrides" +.P +If you need to make specific changes to dependencies of your dependencies, for example replacing the version of a dependency with a known security issue, replacing an existing dependency with a fork, or making sure that the same version of a package is used everywhere, then you may add an override. +.P +Overrides provide a way to replace a package in your dependency tree with another version, or another package entirely. These changes can be scoped as specific or as vague as desired. +.P +Overrides are only considered in the root \fBpackage.json\fR file for a project. Overrides in installed dependencies (including npm help workspaces) are not considered in dependency tree resolution. Published packages may dictate their resolutions by pinning dependencies or using an \fB\fBnpm-shrinkwrap.json\fR\fR \fI\(la/configuring-npm/npm-shrinkwrap-json\(ra\fR file. +.P +To make sure the package \fBfoo\fR is always installed as version \fB1.0.0\fR no matter what version your dependencies rely on: +.P +.RS 2 +.nf +{ + "overrides": { + "foo": "1.0.0" + } +} +.fi +.RE +.P +The above is a short hand notation, the full object form can be used to allow overriding a package itself as well as a child of the package. This will cause \fBfoo\fR to always be \fB1.0.0\fR while also making \fBbar\fR at any depth beyond \fBfoo\fR also \fB1.0.0\fR: +.P +.RS 2 +.nf +{ + "overrides": { + "foo": { + ".": "1.0.0", + "bar": "1.0.0" + } + } +} +.fi +.RE +.P +To only override \fBfoo\fR to be \fB1.0.0\fR when it's a child (or grandchild, or great grandchild, etc) of the package \fBbar\fR: +.P +.RS 2 +.nf +{ + "overrides": { + "bar": { + "foo": "1.0.0" + } + } +} +.fi +.RE +.P +Keys can be nested to any arbitrary length. To override \fBfoo\fR only when it's a child of \fBbar\fR and only when \fBbar\fR is a child of \fBbaz\fR: +.P +.RS 2 +.nf +{ + "overrides": { + "baz": { + "bar": { + "foo": "1.0.0" + } + } + } +} +.fi +.RE +.P +The key of an override can also include a version, or range of versions. To override \fBfoo\fR to \fB1.0.0\fR, but only when it's a child of \fBbar@2.0.0\fR: +.P +.RS 2 +.nf +{ + "overrides": { + "bar@2.0.0": { + "foo": "1.0.0" + } + } +} +.fi +.RE +.P +You may not set an override for a package that you directly depend on unless both the dependency and the override itself share the exact same spec. To make this limitation easier to deal with, overrides may also be defined as a reference to a spec for a direct dependency by prefixing the name of the package you wish the version to match with a \fB$\fR. +.P +.RS 2 +.nf +{ + "dependencies": { + "foo": "^1.0.0" + }, + "overrides": { + // BAD, will throw an EOVERRIDE error + // "foo": "^2.0.0" + // GOOD, specs match so override is allowed + // "foo": "^1.0.0" + // BEST, the override is defined as a reference to the dependency + "foo": "$foo", + // the referenced package does not need to match the overridden one + "bar": "$foo" + } +} +.fi +.RE +.SS "engines" +.P +You can specify the version of node that your stuff works on: +.P +.RS 2 +.nf +{ + "engines": { + "node": ">=0.10.3 <15" + } +} +.fi +.RE +.P +And, like with dependencies, if you don't specify the version (or if you specify "*" as the version), then any version of node will do. +.P +You can also use the "engines" field to specify which versions of npm are capable of properly installing your program. For example: +.P +.RS 2 +.nf +{ + "engines": { + "npm": "~1.0.20" + } +} +.fi +.RE +.P +Unless the user has set the \fB\fBengine-strict\fR config\fR \fI\(la/using-npm/config#engine-strict\(ra\fR flag, this field is advisory only and will only produce warnings when your package is installed as a dependency. +.SS "os" +.P +You can specify which operating systems your module will run on: +.P +.RS 2 +.nf +{ + "os": \[lB] + "darwin", + "linux" + \[rB] +} +.fi +.RE +.P +You can also block instead of allowing operating systems, just prepend the blocked os with a '!': +.P +.RS 2 +.nf +{ + "os": \[lB] + "!win32" + \[rB] +} +.fi +.RE +.P +The host operating system is determined by \fBprocess.platform\fR +.P +It is allowed to both block and allow an item, although there isn't any good reason to do this. +.SS "cpu" +.P +If your code only runs on certain cpu architectures, you can specify which ones. +.P +.RS 2 +.nf +{ + "cpu": \[lB] + "x64", + "ia32" + \[rB] +} +.fi +.RE +.P +Like the \fBos\fR option, you can also block architectures: +.P +.RS 2 +.nf +{ + "cpu": \[lB] + "!arm", + "!mips" + \[rB] +} +.fi +.RE +.P +The host architecture is determined by \fBprocess.arch\fR +.SS "libc" +.P +If your code only runs or builds in certain versions of libc, you can specify which ones. This field only applies if \fBos\fR is \fBlinux\fR. +.P +.RS 2 +.nf +{ + "os": "linux", + "libc": "glibc" +} +.fi +.RE +.SS "devEngines" +.P +The \fBdevEngines\fR field aids engineers working on a codebase to all be using the same tooling. +.P +You can specify a \fBdevEngines\fR property in your \fBpackage.json\fR which will run before \fBinstall\fR, \fBci\fR, and \fBrun\fR commands. +.RS 0 +.P +Note: \fBengines\fR and \fBdevEngines\fR differ in object shape. They also function very differently. \fBengines\fR is designed to alert the user when a dependency uses a differening npm or node version that the project it's being used in, whereas \fBdevEngines\fR is used to alert people interacting with the source code of a project. +.RE 0 + +.P +The supported keys under the \fBdevEngines\fR property are \fBcpu\fR, \fBos\fR, \fBlibc\fR, \fBruntime\fR, and \fBpackageManager\fR. Each property can be an object or an array of objects. Objects must contain \fBname\fR, and optionally can specify \fBversion\fR, and \fBonFail\fR. \fBonFail\fR can be \fBwarn\fR, \fBerror\fR, or \fBignore\fR, and if left undefined is of the same value as \fBerror\fR. \fBnpm\fR will assume that you're running with \fBnode\fR. Here's an example of a project that will fail if the environment is not \fBnode\fR and \fBnpm\fR. If you set \fBruntime.name\fR or \fBpackageManager.name\fR to any other string, it will fail within the npm CLI. +.P +.RS 2 +.nf +{ + "devEngines": { + "runtime": { + "name": "node", + "onFail": "error" + }, + "packageManager": { + "name": "npm", + "onFail": "error" + } + } +} +.fi +.RE +.SS "private" +.P +If you set \fB"private": true\fR in your package.json, then npm will refuse to publish it. +.P +This is a way to prevent accidental publication of private repositories. If you would like to ensure that a given package is only ever published to a specific registry (for example, an internal registry), then use the \fBpublishConfig\fR dictionary described below to override the \fBregistry\fR config param at publish-time. +.SS "publishConfig" +.P +This is a set of config values that will be used at publish-time. It's especially handy if you want to set the tag, registry or access, so that you can ensure that a given package is not tagged with "latest", published to the global public registry or that a scoped module is private by default. +.P +See npm help config to see the list of config options that can be overridden. +.SS "workspaces" +.P +The optional \fBworkspaces\fR field is an array of file patterns that describes locations within the local file system that the install client should look up to find each npm help workspace that needs to be symlinked to the top level \fBnode_modules\fR folder. +.P +It can describe either the direct paths of the folders to be used as workspaces or it can define globs that will resolve to these same folders. +.P +In the following example, all folders located inside the folder \fB./packages\fR will be treated as workspaces as long as they have valid \fBpackage.json\fR files inside them: +.P +.RS 2 +.nf +{ + "name": "workspace-example", + "workspaces": \[lB] + "./packages/*" + \[rB] +} +.fi +.RE +.P +See npm help workspaces for more examples. +.SS "DEFAULT VALUES" +.P +npm will default some values based on package contents. +.RS 0 +.IP \(bu 4 +\fB"scripts": {"start": "node server.js"}\fR +.P +If there is a \fBserver.js\fR file in the root of your package, then npm will default the \fBstart\fR command to \fBnode server.js\fR. +.IP \(bu 4 +\fB"scripts":{"install": "node-gyp rebuild"}\fR +.P +If there is a \fBbinding.gyp\fR file in the root of your package and you have not defined an \fBinstall\fR or \fBpreinstall\fR script, npm will default the \fBinstall\fR command to compile using node-gyp. +.IP \(bu 4 +\fB"contributors": \[lB]...\[rB]\fR +.P +If there is an \fBAUTHORS\fR file in the root of your package, npm will treat each line as a \fBName (url)\fR format, where email and url are optional. Lines which start with a \fB#\fR or are blank, will be ignored. +.RE 0 + +.SS "SEE ALSO" +.RS 0 +.IP \(bu 4 +\fBsemver\fR \fI\(lahttps://github.com/npm/node-semver#versions\(ra\fR +.IP \(bu 4 +npm help workspaces +.IP \(bu 4 +npm help init +.IP \(bu 4 +npm help version +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help help +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help uninstall +.RE 0 diff --git a/node_modules/npm/man/man5/package-lock-json.5 b/node_modules/npm/man/man5/package-lock-json.5 new file mode 100644 index 00000000..0fe3cf89 --- /dev/null +++ b/node_modules/npm/man/man5/package-lock-json.5 @@ -0,0 +1,158 @@ +.TH "PACKAGE-LOCK.JSON" "5" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBpackage-lock.json\fR - A manifestation of the manifest +.SS "Description" +.P +\fBpackage-lock.json\fR is automatically generated for any operations where npm modifies either the \fBnode_modules\fR tree, or \fBpackage.json\fR. It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates. +.P +This file is intended to be committed into source repositories, and serves various purposes: +.RS 0 +.IP \(bu 4 +Describe a single representation of a dependency tree such that teammates, deployments, and continuous integration are guaranteed to install exactly the same dependencies. +.IP \(bu 4 +Provide a facility for users to "time-travel" to previous states of \fBnode_modules\fR without having to commit the directory itself. +.IP \(bu 4 +Facilitate greater visibility of tree changes through readable source control diffs. +.IP \(bu 4 +Optimize the installation process by allowing npm to skip repeated metadata resolutions for previously-installed packages. +.IP \(bu 4 +As of npm v7, lockfiles include enough information to gain a complete picture of the package tree, reducing the need to read \fBpackage.json\fR files, and allowing for significant performance improvements. +.RE 0 + +.P +When \fBnpm\fR creates or updates \fBpackage-lock.json\fR, it will infer line endings and indentation from \fBpackage.json\fR so that the formatting of both files matches. +.SS "\fBpackage-lock.json\fR vs \fBnpm-shrinkwrap.json\fR" +.P +Both of these files have the same format, and perform similar functions in the root of a project. +.P +The difference is that \fBpackage-lock.json\fR cannot be published, and it will be ignored if found in any place other than the root project. +.P +In contrast, \fBnpm-shrinkwrap.json\fR \fI\(la/configuring-npm/npm-shrinkwrap-json\(ra\fR allows publication, and defines the dependency tree from the point encountered. This is not recommended unless deploying a CLI tool or otherwise using the publication process for producing production packages. +.P +If both \fBpackage-lock.json\fR and \fBnpm-shrinkwrap.json\fR are present in the root of a project, \fBnpm-shrinkwrap.json\fR will take precedence and \fBpackage-lock.json\fR will be ignored. +.SS "Hidden Lockfiles" +.P +In order to avoid processing the \fBnode_modules\fR folder repeatedly, npm as of v7 uses a "hidden" lockfile present in \fBnode_modules/.package-lock.json\fR. This contains information about the tree, and is used in lieu of reading the entire \fBnode_modules\fR hierarchy provided that the following conditions are met: +.RS 0 +.IP \(bu 4 +All package folders it references exist in the \fBnode_modules\fR hierarchy. +.IP \(bu 4 +No package folders exist in the \fBnode_modules\fR hierarchy that are not listed in the lockfile. +.IP \(bu 4 +The modified time of the file is at least as recent as all of the package folders it references. +.RE 0 + +.P +That is, the hidden lockfile will only be relevant if it was created as part of the most recent update to the package tree. If another CLI mutates the tree in any way, this will be detected, and the hidden lockfile will be ignored. +.P +Note that it \fIis\fR possible to manually change the \fIcontents\fR of a package in such a way that the modified time of the package folder is unaffected. For example, if you add a file to \fBnode_modules/foo/lib/bar.js\fR, then the modified time on \fBnode_modules/foo\fR will not reflect this change. If you are manually editing files in \fBnode_modules\fR, it is generally best to delete the file at \fBnode_modules/.package-lock.json\fR. +.P +As the hidden lockfile is ignored by older npm versions, it does not contain the backwards compatibility affordances present in "normal" lockfiles. That is, it is \fBlockfileVersion: 3\fR, rather than \fBlockfileVersion: 2\fR. +.SS "Handling Old Lockfiles" +.P +When npm detects a lockfile from npm v6 or before during the package installation process, it is automatically updated to fetch missing information from either the \fBnode_modules\fR tree or (in the case of empty \fBnode_modules\fR trees or very old lockfile formats) the npm registry. +.SS "File Format" +.SS "\fBname\fR" +.P +The name of the package this is a package-lock for. This will match what's in \fBpackage.json\fR. +.SS "\fBversion\fR" +.P +The version of the package this is a package-lock for. This will match what's in \fBpackage.json\fR. +.SS "\fBlockfileVersion\fR" +.P +An integer version, starting at \fB1\fR with the version number of this document whose semantics were used when generating this \fBpackage-lock.json\fR. +.P +Note that the file format changed significantly in npm v7 to track information that would have otherwise required looking in \fBnode_modules\fR or the npm registry. Lockfiles generated by npm v7 will contain \fBlockfileVersion: 2\fR. +.RS 0 +.IP \(bu 4 +No version provided: an "ancient" shrinkwrap file from a version of npm prior to npm v5. +.IP \(bu 4 +\fB1\fR: The lockfile version used by npm v5 and v6. +.IP \(bu 4 +\fB2\fR: The lockfile version used by npm v7 and v8. Backwards compatible to v1 lockfiles. +.IP \(bu 4 +\fB3\fR: The lockfile version used by npm v9 and above. Backwards compatible to npm v7. +.RE 0 + +.P +npm will always attempt to get whatever data it can out of a lockfile, even if it is not a version that it was designed to support. +.SS "\fBpackages\fR" +.P +This is an object that maps package locations to an object containing the information about that package. +.P +The root project is typically listed with a key of \fB""\fR, and all other packages are listed with their relative paths from the root project folder. +.P +Package descriptors have the following fields: +.RS 0 +.IP \(bu 4 +version: The version found in \fBpackage.json\fR +.IP \(bu 4 +resolved: The place where the package was actually resolved from. In the case of packages fetched from the registry, this will be a url to a tarball. In the case of git dependencies, this will be the full git url with commit sha. In the case of link dependencies, this will be the location of the link target. \fBregistry.npmjs.org\fR is a magic value meaning "the currently configured registry". +.IP \(bu 4 +integrity: A \fBsha512\fR or \fBsha1\fR \fBStandard Subresource Integrity\fR \fI\(lahttps://w3c.github.io/webappsec/specs/subresourceintegrity/\(ra\fR string for the artifact that was unpacked in this location. +.IP \(bu 4 +link: A flag to indicate that this is a symbolic link. If this is present, no other fields are specified, since the link target will also be included in the lockfile. +.IP \(bu 4 +dev, optional, devOptional: If the package is strictly part of the \fBdevDependencies\fR tree, then \fBdev\fR will be true. If it is strictly part of the \fBoptionalDependencies\fR tree, then \fBoptional\fR will be set. If it is both a \fBdev\fR dependency \fIand\fR an \fBoptional\fR dependency of a non-dev dependency, then \fBdevOptional\fR will be set. (An \fBoptional\fR dependency of a \fBdev\fR dependency will have both \fBdev\fR and \fBoptional\fR set.) +.IP \(bu 4 +inBundle: A flag to indicate that the package is a bundled dependency. +.IP \(bu 4 +hasInstallScript: A flag to indicate that the package has a \fBpreinstall\fR, \fBinstall\fR, or \fBpostinstall\fR script. +.IP \(bu 4 +hasShrinkwrap: A flag to indicate that the package has an \fBnpm-shrinkwrap.json\fR file. +.IP \(bu 4 +bin, license, engines, dependencies, optionalDependencies: fields from \fBpackage.json\fR +.RE 0 + +.SS "dependencies" +.P +Legacy data for supporting versions of npm that use \fBlockfileVersion: 1\fR. This is a mapping of package names to dependency objects. Because the object structure is strictly hierarchical, symbolic link dependencies are somewhat challenging to represent in some cases. +.P +npm v7 ignores this section entirely if a \fBpackages\fR section is present, but does keep it up to date in order to support switching between npm v6 and npm v7. +.P +Dependency objects have the following fields: +.RS 0 +.IP \(bu 4 +version: a specifier that varies depending on the nature of the package, and is usable in fetching a new copy of it. +.RS 4 +.IP \(bu 4 +bundled dependencies: Regardless of source, this is a version number that is purely for informational purposes. +.IP \(bu 4 +registry sources: This is a version number. (eg, \fB1.2.3\fR) +.IP \(bu 4 +git sources: This is a git specifier with resolved committish. (eg, \fBgit+https://example.com/foo/bar#115311855adb0789a0466714ed48a1499ffea97e\fR) +.IP \(bu 4 +http tarball sources: This is the URL of the tarball. (eg, \fBhttps://example.com/example-1.3.0.tgz\fR) +.IP \(bu 4 +local tarball sources: This is the file URL of the tarball. (eg \fBfile:///opt/storage/example-1.3.0.tgz\fR) +.IP \(bu 4 +local link sources: This is the file URL of the link. (eg \fBfile:libs/our-module\fR) +.RE 0 + +.IP \(bu 4 +integrity: A \fBsha512\fR or \fBsha1\fR \fBStandard Subresource Integrity\fR \fI\(lahttps://w3c.github.io/webappsec/specs/subresourceintegrity/\(ra\fR string for the artifact that was unpacked in this location. For git dependencies, this is the commit sha. +.IP \(bu 4 +resolved: For registry sources this is path of the tarball relative to the registry URL. If the tarball URL isn't on the same server as the registry URL then this is a complete URL. \fBregistry.npmjs.org\fR is a magic value meaning "the currently configured registry". +.IP \(bu 4 +bundled: If true, this is the bundled dependency and will be installed by the parent module. When installing, this module will be extracted from the parent module during the extract phase, not installed as a separate dependency. +.IP \(bu 4 +dev: If true then this dependency is either a development dependency ONLY of the top level module or a transitive dependency of one. This is false for dependencies that are both a development dependency of the top level and a transitive dependency of a non-development dependency of the top level. +.IP \(bu 4 +optional: If true then this dependency is either an optional dependency ONLY of the top level module or a transitive dependency of one. This is false for dependencies that are both an optional dependency of the top level and a transitive dependency of a non-optional dependency of the top level. +.IP \(bu 4 +requires: This is a mapping of module name to version. This is a list of everything this module requires, regardless of where it will be installed. The version should match via normal matching rules a dependency either in our \fBdependencies\fR or in a level higher than us. +.IP \(bu 4 +dependencies: The dependencies of this dependency, exactly as at the top level. +.RE 0 + +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help shrinkwrap +.IP \(bu 4 +\fBnpm-shrinkwrap.json\fR \fI\(la/configuring-npm/npm-shrinkwrap-json\(ra\fR +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help install +.RE 0 diff --git a/node_modules/npm/man/man7/config.7 b/node_modules/npm/man/man7/config.7 new file mode 100644 index 00000000..c9bfc8f9 --- /dev/null +++ b/node_modules/npm/man/man7/config.7 @@ -0,0 +1,2041 @@ +.TH "CONFIG" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBconfig\fR - More than you probably want to know about npm configuration +.SS "Description" +.P +This article details npm configuration in general. To learn about the \fBconfig\fR command, see npm help config. +.P +npm gets its configuration values from the following sources, sorted by priority: +.SS "Command Line Flags" +.P +Putting \fB--foo bar\fR on the command line sets the \fBfoo\fR configuration parameter to \fB"bar"\fR. A \fB--\fR argument tells the cli parser to stop reading flags. Using \fB--flag\fR without specifying any value will set the value to \fBtrue\fR. +.P +Example: \fB--flag1 --flag2\fR will set both configuration parameters to \fBtrue\fR, while \fB--flag1 --flag2 bar\fR will set \fBflag1\fR to \fBtrue\fR, and \fBflag2\fR to \fBbar\fR. Finally, \fB--flag1 --flag2 -- bar\fR will set both configuration parameters to \fBtrue\fR, and the \fBbar\fR is taken as a command argument. +.SS "Environment Variables" +.P +Any environment variables that start with \fBnpm_config_\fR will be interpreted as a configuration parameter. For example, putting \fBnpm_config_foo=bar\fR in your environment will set the \fBfoo\fR configuration parameter to \fBbar\fR. Any environment configurations that are not given a value will be given the value of \fBtrue\fR. Config values are case-insensitive, so \fBNPM_CONFIG_FOO=bar\fR will work the same. However, please note that inside npm help scripts npm will set its own environment variables and Node will prefer those lowercase versions over any uppercase ones that you might set. For details see \fBthis issue\fR \fI\(lahttps://github.com/npm/npm/issues/14528\(ra\fR. +.P +Notice that you need to use underscores instead of dashes, so \fB--allow-same-version\fR would become \fBnpm_config_allow_same_version=true\fR. +.SS "npmrc Files" +.P +The four relevant files are: +.RS 0 +.IP \(bu 4 +per-project configuration file (\fB/path/to/my/project/.npmrc\fR) +.IP \(bu 4 +per-user configuration file (defaults to \fB$HOME/.npmrc\fR; configurable via CLI option \fB--userconfig\fR or environment variable \fB$NPM_CONFIG_USERCONFIG\fR) +.IP \(bu 4 +global configuration file (defaults to \fB$PREFIX/etc/npmrc\fR; configurable via CLI option \fB--globalconfig\fR or environment variable \fB$NPM_CONFIG_GLOBALCONFIG\fR) +.IP \(bu 4 +npm's built-in configuration file (\fB/path/to/npm/npmrc\fR) +.RE 0 + +.P +See npm help npmrc for more details. +.SS "Default Configs" +.P +Run \fBnpm config ls -l\fR to see a set of configuration parameters that are internal to npm, and are defaults if nothing else is specified. +.SS "Shorthands and Other CLI Niceties" +.P +The following shorthands are parsed on the command-line: +.RS 0 +.IP \(bu 4 +\fB-a\fR: \fB--all\fR +.IP \(bu 4 +\fB--enjoy-by\fR: \fB--before\fR +.IP \(bu 4 +\fB-c\fR: \fB--call\fR +.IP \(bu 4 +\fB--desc\fR: \fB--description\fR +.IP \(bu 4 +\fB-f\fR: \fB--force\fR +.IP \(bu 4 +\fB-g\fR: \fB--global\fR +.IP \(bu 4 +\fB--iwr\fR: \fB--include-workspace-root\fR +.IP \(bu 4 +\fB-L\fR: \fB--location\fR +.IP \(bu 4 +\fB-d\fR: \fB--loglevel info\fR +.IP \(bu 4 +\fB-s\fR: \fB--loglevel silent\fR +.IP \(bu 4 +\fB--silent\fR: \fB--loglevel silent\fR +.IP \(bu 4 +\fB--ddd\fR: \fB--loglevel silly\fR +.IP \(bu 4 +\fB--dd\fR: \fB--loglevel verbose\fR +.IP \(bu 4 +\fB--verbose\fR: \fB--loglevel verbose\fR +.IP \(bu 4 +\fB-q\fR: \fB--loglevel warn\fR +.IP \(bu 4 +\fB--quiet\fR: \fB--loglevel warn\fR +.IP \(bu 4 +\fB-l\fR: \fB--long\fR +.IP \(bu 4 +\fB-m\fR: \fB--message\fR +.IP \(bu 4 +\fB--local\fR: \fB--no-global\fR +.IP \(bu 4 +\fB-n\fR: \fB--no-yes\fR +.IP \(bu 4 +\fB--no\fR: \fB--no-yes\fR +.IP \(bu 4 +\fB-p\fR: \fB--parseable\fR +.IP \(bu 4 +\fB--porcelain\fR: \fB--parseable\fR +.IP \(bu 4 +\fB-C\fR: \fB--prefix\fR +.IP \(bu 4 +\fB--readonly\fR: \fB--read-only\fR +.IP \(bu 4 +\fB--reg\fR: \fB--registry\fR +.IP \(bu 4 +\fB-S\fR: \fB--save\fR +.IP \(bu 4 +\fB-B\fR: \fB--save-bundle\fR +.IP \(bu 4 +\fB-D\fR: \fB--save-dev\fR +.IP \(bu 4 +\fB-E\fR: \fB--save-exact\fR +.IP \(bu 4 +\fB-O\fR: \fB--save-optional\fR +.IP \(bu 4 +\fB-P\fR: \fB--save-prod\fR +.IP \(bu 4 +\fB-?\fR: \fB--usage\fR +.IP \(bu 4 +\fB-h\fR: \fB--usage\fR +.IP \(bu 4 +\fB-H\fR: \fB--usage\fR +.IP \(bu 4 +\fB--help\fR: \fB--usage\fR +.IP \(bu 4 +\fB-v\fR: \fB--version\fR +.IP \(bu 4 +\fB-w\fR: \fB--workspace\fR +.IP \(bu 4 +\fB--ws\fR: \fB--workspaces\fR +.IP \(bu 4 +\fB-y\fR: \fB--yes\fR +.RE 0 + +.P +If the specified configuration param resolves unambiguously to a known configuration parameter, then it is expanded to that configuration parameter. For example: +.P +.RS 2 +.nf +npm ls --par +# same as: +npm ls --parseable +.fi +.RE +.P +If multiple single-character shorthands are strung together, and the resulting combination is unambiguously not some other configuration param, then it is expanded to its various component pieces. For example: +.P +.RS 2 +.nf +npm ls -gpld +# same as: +npm ls --global --parseable --long --loglevel info +.fi +.RE +.SS "Config Settings" +.SS "\fB_auth\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +A basic-auth string to use when authenticating against the npm registry. This will ONLY be used to authenticate against the npm registry. For other registries you will need to scope it like "//other-registry.tld/:_auth" +.P +Warning: This should generally not be set via a command-line option. It is safer to use a registry-provided authentication bearer token stored in the ~/.npmrc file by running \fBnpm login\fR. +.SS "\fBaccess\fR" +.RS 0 +.IP \(bu 4 +Default: 'public' for new packages, existing packages it will not change the current level +.IP \(bu 4 +Type: null, "restricted", or "public" +.RE 0 + +.P +If you do not want your scoped package to be publicly viewable (and installable) set \fB--access=restricted\fR. +.P +Unscoped packages can not be set to \fBrestricted\fR. +.P +Note: This defaults to not changing the current access level for existing packages. Specifying a value of \fBrestricted\fR or \fBpublic\fR during publish will change the access for an existing package the same way that \fBnpm access set +status\fR would. +.SS "\fBall\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When running \fBnpm outdated\fR and \fBnpm ls\fR, setting \fB--all\fR will show all outdated or installed packages, rather than only those directly depended upon by the current project. +.SS "\fBallow-same-version\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Prevents throwing an error when \fBnpm version\fR is used to set the new version to the same value as the current version. +.SS "\fBaudit\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for npm help audit for details on what is submitted. +.SS "\fBaudit-level\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null, "info", "low", "moderate", "high", "critical", or "none" +.RE 0 + +.P +The minimum level of vulnerability for \fBnpm audit\fR to exit with a non-zero exit code. +.SS "\fBauth-type\fR" +.RS 0 +.IP \(bu 4 +Default: "web" +.IP \(bu 4 +Type: "legacy" or "web" +.RE 0 + +.P +What authentication strategy to use with \fBlogin\fR. Note that if an \fBotp\fR config is given, this value will always be set to \fBlegacy\fR. +.SS "\fBbefore\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Date +.RE 0 + +.P +If passed to \fBnpm install\fR, will rebuild the npm tree such that only versions that were available \fBon or before\fR the \fB--before\fR time get installed. If there's no versions available for the current set of direct dependencies, the command will error. +.P +If the requested version is a \fBdist-tag\fR and the given tag does not pass the \fB--before\fR filter, the most recent version less than or equal to that tag will be used. For example, \fBfoo@latest\fR might install \fBfoo@1.2\fR even though \fBlatest\fR is \fB2.0\fR. +.SS "\fBbin-links\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tells npm to create symlinks (or \fB.cmd\fR shims on Windows) for package executables. +.P +Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems. +.SS "\fBbrowser\fR" +.RS 0 +.IP \(bu 4 +Default: OS X: \fB"open"\fR, Windows: \fB"start"\fR, Others: \fB"xdg-open"\fR +.IP \(bu 4 +Type: null, Boolean, or String +.RE 0 + +.P +The browser that is called by npm commands to open websites. +.P +Set to \fBfalse\fR to suppress browser behavior and instead print urls to terminal. +.P +Set to \fBtrue\fR to use default system URL opener. +.SS "\fBca\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String (can be set multiple times) +.RE 0 + +.P +The Certificate Authority signing certificate that is trusted for SSL connections to the registry. Values should be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string "\[rs]n". For example: +.P +.RS 2 +.nf +ca="-----BEGIN CERTIFICATE-----\[rs]nXXXX\[rs]nXXXX\[rs]n-----END CERTIFICATE-----" +.fi +.RE +.P +Set to \fBnull\fR to only allow "known" registrars, or to a specific CA cert to trust only that specific signing authority. +.P +Multiple CAs can be trusted by specifying an array of certificates: +.P +.RS 2 +.nf +ca\[lB]\[rB]="..." +ca\[lB]\[rB]="..." +.fi +.RE +.P +See also the \fBstrict-ssl\fR config. +.SS "\fBcache\fR" +.RS 0 +.IP \(bu 4 +Default: Windows: \fB%LocalAppData%\[rs]npm-cache\fR, Posix: \fB~/.npm\fR +.IP \(bu 4 +Type: Path +.RE 0 + +.P +The location of npm's cache directory. +.SS "\fBcafile\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: Path +.RE 0 + +.P +A path to a file containing one or multiple Certificate Authority signing certificates. Similar to the \fBca\fR setting, but allows for multiple CA's, as well as for the CA information to be stored in a file on disk. +.SS "\fBcall\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Optional companion option for \fBnpm exec\fR, \fBnpx\fR that allows for specifying a custom command to be run along with the installed packages. +.P +.RS 2 +.nf +npm exec --package yo --package generator-node --call "yo node" +.fi +.RE +.SS "\fBcidr\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String (can be set multiple times) +.RE 0 + +.P +This is a list of CIDR address to be used when configuring limited access tokens with the \fBnpm token create\fR command. +.SS "\fBcolor\fR" +.RS 0 +.IP \(bu 4 +Default: true unless the NO_COLOR environ is set to something other than '0' +.IP \(bu 4 +Type: "always" or Boolean +.RE 0 + +.P +If false, never shows colors. If \fB"always"\fR then always shows colors. If true, then only prints color codes for tty file descriptors. +.SS "\fBcommit-hooks\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run git commit hooks when using the \fBnpm version\fR command. +.SS "\fBcpu\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +Override CPU architecture of native modules to install. Acceptable values are same as \fBcpu\fR field of package.json, which comes from \fBprocess.arch\fR. +.SS "\fBdepth\fR" +.RS 0 +.IP \(bu 4 +Default: \fBInfinity\fR if \fB--all\fR is set, otherwise \fB1\fR +.IP \(bu 4 +Type: null or Number +.RE 0 + +.P +The depth to go when recursing packages for \fBnpm ls\fR. +.P +If not set, \fBnpm ls\fR will show only the immediate dependencies of the root project. If \fB--all\fR is set, then npm will show all dependencies by default. +.SS "\fBdescription\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Show the description in \fBnpm search\fR +.SS "\fBdiff\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Define arguments to compare in \fBnpm diff\fR. +.SS "\fBdiff-dst-prefix\fR" +.RS 0 +.IP \(bu 4 +Default: "b/" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Destination prefix to be used in \fBnpm diff\fR output. +.SS "\fBdiff-ignore-all-space\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Ignore whitespace when comparing lines in \fBnpm diff\fR. +.SS "\fBdiff-name-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Prints only filenames when using \fBnpm diff\fR. +.SS "\fBdiff-no-prefix\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Do not show any source or destination prefix in \fBnpm diff\fR output. +.P +Note: this causes \fBnpm diff\fR to ignore the \fB--diff-src-prefix\fR and \fB--diff-dst-prefix\fR configs. +.SS "\fBdiff-src-prefix\fR" +.RS 0 +.IP \(bu 4 +Default: "a/" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Source prefix to be used in \fBnpm diff\fR output. +.SS "\fBdiff-text\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Treat all files as text in \fBnpm diff\fR. +.SS "\fBdiff-unified\fR" +.RS 0 +.IP \(bu 4 +Default: 3 +.IP \(bu 4 +Type: Number +.RE 0 + +.P +The number of lines of context to print in \fBnpm diff\fR. +.SS "\fBdry-run\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, \fBinstall\fR, \fBupdate\fR, \fBdedupe\fR, \fBuninstall\fR, as well as \fBpack\fR and \fBpublish\fR. +.P +Note: This is NOT honored by other network related commands, eg \fBdist-tags\fR, \fBowner\fR, etc. +.SS "\fBeditor\fR" +.RS 0 +.IP \(bu 4 +Default: The EDITOR or VISUAL environment variables, or '%SYSTEMROOT%\[rs]notepad.exe' on Windows, or 'vi' on Unix systems +.IP \(bu 4 +Type: String +.RE 0 + +.P +The command to run for \fBnpm edit\fR and \fBnpm config edit\fR. +.SS "\fBengine-strict\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, then npm will stubbornly refuse to install (or even consider installing) any package that claims to not be compatible with the current Node.js version. +.P +This can be overridden by setting the \fB--force\fR flag. +.SS "\fBexpect-result-count\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Number +.RE 0 + +.P +Tells to expect a specific number of results from the command. +.P +This config can not be used with: \fBexpect-results\fR +.SS "\fBexpect-results\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Tells npm whether or not to expect results from the command. Can be either true (expect some results) or false (expect no results). +.P +This config can not be used with: \fBexpect-result-count\fR +.SS "\fBfetch-retries\fR" +.RS 0 +.IP \(bu 4 +Default: 2 +.IP \(bu 4 +Type: Number +.RE 0 + +.P +The "retries" config for the \fBretry\fR module to use when fetching packages from the registry. +.P +npm will retry idempotent read requests to the registry in the case of network failures or 5xx HTTP errors. +.SS "\fBfetch-retry-factor\fR" +.RS 0 +.IP \(bu 4 +Default: 10 +.IP \(bu 4 +Type: Number +.RE 0 + +.P +The "factor" config for the \fBretry\fR module to use when fetching packages. +.SS "\fBfetch-retry-maxtimeout\fR" +.RS 0 +.IP \(bu 4 +Default: 60000 (1 minute) +.IP \(bu 4 +Type: Number +.RE 0 + +.P +The "maxTimeout" config for the \fBretry\fR module to use when fetching packages. +.SS "\fBfetch-retry-mintimeout\fR" +.RS 0 +.IP \(bu 4 +Default: 10000 (10 seconds) +.IP \(bu 4 +Type: Number +.RE 0 + +.P +The "minTimeout" config for the \fBretry\fR module to use when fetching packages. +.SS "\fBfetch-timeout\fR" +.RS 0 +.IP \(bu 4 +Default: 300000 (5 minutes) +.IP \(bu 4 +Type: Number +.RE 0 + +.P +The maximum amount of time to wait for HTTP requests to complete. +.SS "\fBforce\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input. +.RS 0 +.IP \(bu 4 +Allow clobbering non-npm files in global installs. +.IP \(bu 4 +Allow the \fBnpm version\fR command to work on an unclean git repository. +.IP \(bu 4 +Allow deleting the cache folder with \fBnpm cache clean\fR. +.IP \(bu 4 +Allow installing packages that have an \fBengines\fR declaration requiring a different version of npm. +.IP \(bu 4 +Allow installing packages that have an \fBengines\fR declaration requiring a different version of \fBnode\fR, even if \fB--engine-strict\fR is enabled. +.IP \(bu 4 +Allow \fBnpm audit fix\fR to install modules outside your stated dependency range (including SemVer-major changes). +.IP \(bu 4 +Allow unpublishing all versions of a published package. +.IP \(bu 4 +Allow conflicting peerDependencies to be installed in the root project. +.IP \(bu 4 +Implicitly set \fB--yes\fR during \fBnpm init\fR. +.IP \(bu 4 +Allow clobbering existing values in \fBnpm pkg\fR +.IP \(bu 4 +Allow unpublishing of entire packages (not just a single version). +.RE 0 + +.P +If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! +.SS "\fBforeground-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: \fBfalse\fR unless when using \fBnpm pack\fR or \fBnpm publish\fR where it defaults to \fBtrue\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Run all build scripts (ie, \fBpreinstall\fR, \fBinstall\fR, and \fBpostinstall\fR) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process. +.P +Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging. +.SS "\fBformat-package-lock\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Format \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR as a human readable file. +.SS "\fBfund\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When "true" displays the message at the end of each \fBnpm install\fR acknowledging the number of dependencies looking for funding. See npm help fund for details. +.SS "\fBgit\fR" +.RS 0 +.IP \(bu 4 +Default: "git" +.IP \(bu 4 +Type: String +.RE 0 + +.P +The command to use for git commands. If git is installed on the computer, but is not in the \fBPATH\fR, then set this to the full path to the git binary. +.SS "\fBgit-tag-version\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Tag the commit when using the \fBnpm version\fR command. Setting this to false results in no commit being made at all. +.SS "\fBglobal\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBglobalconfig\fR" +.RS 0 +.IP \(bu 4 +Default: The global --prefix setting plus 'etc/npmrc'. For example, '/usr/local/etc/npmrc' +.IP \(bu 4 +Type: Path +.RE 0 + +.P +The config file to read for global config options. +.SS "\fBheading\fR" +.RS 0 +.IP \(bu 4 +Default: "npm" +.IP \(bu 4 +Type: String +.RE 0 + +.P +The string that starts all the debugging log output. +.SS "\fBhttps-proxy\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or URL +.RE 0 + +.P +A proxy to use for outgoing https requests. If the \fBHTTPS_PROXY\fR or \fBhttps_proxy\fR or \fBHTTP_PROXY\fR or \fBhttp_proxy\fR environment variables are set, proxy settings will be honored by the underlying \fBmake-fetch-happen\fR library. +.SS "\fBif-present\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm will not exit with an error code when \fBrun-script\fR is invoked for a script that isn't defined in the \fBscripts\fR section of \fBpackage.json\fR. This option can be used when it's desirable to optionally run a script when it's present and fail if the script fails. This is useful, for example, when running scripts that may only apply for some builds in an otherwise generic CI setup. +.P +This value is not exported to the environment for child processes. +.SS "\fBignore-scripts\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, npm does not run scripts specified in package.json files. +.P +Note that commands explicitly intended to run a particular script, such as \fBnpm start\fR, \fBnpm stop\fR, \fBnpm restart\fR, \fBnpm test\fR, and \fBnpm run-script\fR will still run their intended script if \fBignore-scripts\fR is set, but they will \fInot\fR run any pre- or post-scripts. +.SS "\fBinclude\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: "prod", "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Option that allows for defining which types of dependencies to install. +.P +This is the inverse of \fB--omit=\fR. +.P +Dependency types specified in \fB--include\fR will not be omitted, regardless of the order in which omit/include are specified on the command-line. +.SS "\fBinclude-staged\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Allow installing "staged" published packages, as defined by \fBnpm RFC PR #92\fR \fI\(lahttps://github.com/npm/rfcs/pull/92\(ra\fR. +.P +This is experimental, and not implemented by the npm public registry. +.SS "\fBinclude-workspace-root\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Include the workspace root when workspaces are enabled for a command. +.P +When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project. +.P +This value is not exported to the environment for child processes. +.SS "\fBinit-author-email\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +The value \fBnpm init\fR should use by default for the package author's email. +.SS "\fBinit-author-name\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +The value \fBnpm init\fR should use by default for the package author's name. +.SS "\fBinit-author-url\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: "" or URL +.RE 0 + +.P +The value \fBnpm init\fR should use by default for the package author's homepage. +.SS "\fBinit-license\fR" +.RS 0 +.IP \(bu 4 +Default: "ISC" +.IP \(bu 4 +Type: String +.RE 0 + +.P +The value \fBnpm init\fR should use by default for the package license. +.SS "\fBinit-module\fR" +.RS 0 +.IP \(bu 4 +Default: "~/.npm-init.js" +.IP \(bu 4 +Type: Path +.RE 0 + +.P +A module that will be loaded by the \fBnpm init\fR command. See the documentation for the \fBinit-package-json\fR \fI\(lahttps://github.com/npm/init-package-json\(ra\fR module for more information, or npm help init. +.SS "\fBinit-version\fR" +.RS 0 +.IP \(bu 4 +Default: "1.0.0" +.IP \(bu 4 +Type: SemVer string +.RE 0 + +.P +The value that \fBnpm init\fR should use by default for the package version number, if not already set in package.json. +.SS "\fBinstall-links\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +.SS "\fBinstall-strategy\fR" +.RS 0 +.IP \(bu 4 +Default: "hoisted" +.IP \(bu 4 +Type: "hoisted", "nested", "shallow", or "linked" +.RE 0 + +.P +Sets the strategy for installing packages in node_modules. hoisted (default): Install non-duplicated in top-level, and duplicated as necessary within directory structure. nested: (formerly --legacy-bundling) install in place, no hoisting. shallow (formerly --global-style) only install direct deps at top-level. linked: (experimental) install in node_modules/.store, link in place, unhoisted. +.SS "\fBjson\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to output JSON data, rather than the normal output. +.RS 0 +.IP \(bu 4 +In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR. +.RE 0 + +.P +Not supported by all npm commands. +.SS "\fBlegacy-peer-deps\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Causes npm to completely ignore \fBpeerDependencies\fR when building a package tree, as in npm versions 3 through 6. +.P +If a package cannot be installed because of overly strict \fBpeerDependencies\fR that collide, it provides a way to move forward resolving the situation. +.P +This differs from \fB--omit=peer\fR, in that \fB--omit=peer\fR will avoid unpacking \fBpeerDependencies\fR on disk, but will still design a tree such that \fBpeerDependencies\fR \fIcould\fR be unpacked in a correct place. +.P +Use of \fBlegacy-peer-deps\fR is not recommended, as it will not enforce the \fBpeerDependencies\fR contract that meta-dependencies may rely on. +.SS "\fBlibc\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +Override libc of native modules to install. Acceptable values are same as \fBlibc\fR field of package.json +.SS "\fBlink\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Used with \fBnpm ls\fR, limiting output to only those packages that are linked. +.SS "\fBlocal-address\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: IP Address +.RE 0 + +.P +The IP address of the local interface to use when making connections to the npm registry. Must be IPv4 in versions of Node prior to 0.12. +.SS "\fBlocation\fR" +.RS 0 +.IP \(bu 4 +Default: "user" unless \fB--global\fR is passed, which will also set this value to "global" +.IP \(bu 4 +Type: "global", "user", or "project" +.RE 0 + +.P +When passed to \fBnpm config\fR this refers to which config file to use. +.P +When set to "global" mode, packages are installed into the \fBprefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior. +.RS 0 +.IP \(bu 4 +packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the current working directory. +.IP \(bu 4 +bin files are linked to \fB{prefix}/bin\fR +.IP \(bu 4 +man pages are linked to \fB{prefix}/share/man\fR +.RE 0 + +.SS "\fBlockfile-version\fR" +.RS 0 +.IP \(bu 4 +Default: Version 3 if no lockfile, auto-converting v1 lockfiles to v3, otherwise maintain current lockfile version. +.IP \(bu 4 +Type: null, 1, 2, 3, "1", "2", or "3" +.RE 0 + +.P +Set the lockfile format version to be used in package-lock.json and npm-shrinkwrap-json files. Possible options are: +.P +1: The lockfile version used by npm versions 5 and 6. Lacks some data that is used during the install, resulting in slower and possibly less deterministic installs. Prevents lockfile churn when interoperating with older npm versions. +.P +2: The default lockfile version used by npm version 7 and 8. Includes both the version 1 lockfile data and version 3 lockfile data, for maximum determinism and interoperability, at the expense of more bytes on disk. +.P +3: Only the new lockfile information introduced in npm version 7. Smaller on disk than lockfile version 2, but not interoperable with older npm versions. Ideal if all users are on npm version 7 and higher. +.SS "\fBloglevel\fR" +.RS 0 +.IP \(bu 4 +Default: "notice" +.IP \(bu 4 +Type: "silent", "error", "warn", "notice", "http", "info", "verbose", or "silly" +.RE 0 + +.P +What level of logs to report. All logs are written to a debug log, with the path to that file printed if the execution of a command fails. +.P +Any logs of a higher level than the setting are shown. The default is "notice". +.P +See also the \fBforeground-scripts\fR config. +.SS "\fBlogs-dir\fR" +.RS 0 +.IP \(bu 4 +Default: A directory named \fB_logs\fR inside the cache +.IP \(bu 4 +Type: null or Path +.RE 0 + +.P +The location of npm's log directory. See npm help logging for more information. +.SS "\fBlogs-max\fR" +.RS 0 +.IP \(bu 4 +Default: 10 +.IP \(bu 4 +Type: Number +.RE 0 + +.P +The maximum number of log files to store. +.P +If set to 0, no log files will be written for the current run. +.SS "\fBlong\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Show extended information in \fBls\fR, \fBsearch\fR, and \fBhelp-search\fR. +.SS "\fBmaxsockets\fR" +.RS 0 +.IP \(bu 4 +Default: 15 +.IP \(bu 4 +Type: Number +.RE 0 + +.P +The maximum number of connections to use per origin (protocol/host/port combination). +.SS "\fBmessage\fR" +.RS 0 +.IP \(bu 4 +Default: "%s" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Commit message which is used by \fBnpm version\fR when creating version commit. +.P +Any "%s" in the message will be replaced with the version number. +.SS "\fBnode-options\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +Options to pass through to Node.js via the \fBNODE_OPTIONS\fR environment variable. This does not impact how npm itself is executed but it does impact how lifecycle scripts are called. +.SS "\fBnoproxy\fR" +.RS 0 +.IP \(bu 4 +Default: The value of the NO_PROXY environment variable +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Domain extensions that should bypass any proxies. +.P +Also accepts a comma-delimited string. +.SS "\fBoffline\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Force offline mode: no network requests will be done during install. To allow the CLI to fill in missing cache data, see \fB--prefer-offline\fR. +.SS "\fBomit\fR" +.RS 0 +.IP \(bu 4 +Default: 'dev' if the \fBNODE_ENV\fR environment variable is set to 'production', otherwise empty. +.IP \(bu 4 +Type: "dev", "optional", or "peer" (can be set multiple times) +.RE 0 + +.P +Dependency types to omit from the installation tree on disk. +.P +Note that these dependencies \fIare\fR still resolved and added to the \fBpackage-lock.json\fR or \fBnpm-shrinkwrap.json\fR file. They are just not physically installed on disk. +.P +If a package type appears in both the \fB--include\fR and \fB--omit\fR lists, then it will be included. +.P +If the resulting omit list includes \fB'dev'\fR, then the \fBNODE_ENV\fR environment variable will be set to \fB'production'\fR for all lifecycle scripts. +.SS "\fBomit-lockfile-registry-resolved\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +This option causes npm to create lock files without a \fBresolved\fR key for registry dependencies. Subsequent installs will need to resolve tarball endpoints with the configured registry, likely resulting in a longer install time. +.SS "\fBos\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +Override OS of native modules to install. Acceptable values are same as \fBos\fR field of package.json, which comes from \fBprocess.platform\fR. +.SS "\fBotp\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with \fBnpm access\fR. +.P +If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one. +.SS "\fBpack-destination\fR" +.RS 0 +.IP \(bu 4 +Default: "." +.IP \(bu 4 +Type: String +.RE 0 + +.P +Directory in which \fBnpm pack\fR will save tarballs. +.SS "\fBpackage\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +The package or packages to install for npm help exec +.SS "\fBpackage-lock\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to false, then ignore \fBpackage-lock.json\fR files when installing. This will also prevent \fIwriting\fR \fBpackage-lock.json\fR if \fBsave\fR is true. +.SS "\fBpackage-lock-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, the current operation will only use the \fBpackage-lock.json\fR, ignoring \fBnode_modules\fR. +.P +For \fBupdate\fR this means only the \fBpackage-lock.json\fR will be updated, instead of checking \fBnode_modules\fR and downloading dependencies. +.P +For \fBlist\fR this means the output will be based on the tree described by the \fBpackage-lock.json\fR, rather than the contents of \fBnode_modules\fR. +.SS "\fBparseable\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Output parseable results from commands that write to standard output. For \fBnpm search\fR, this will be tab-separated table format. +.SS "\fBprefer-dedupe\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Prefer to deduplicate packages if possible, rather than choosing a newer version of a dependency. +.SS "\fBprefer-offline\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, staleness checks for cached data will be bypassed, but missing data will be requested from the server. To force full offline mode, use \fB--offline\fR. +.SS "\fBprefer-online\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, staleness checks for cached data will be forced, making the CLI look for updates immediately even for fresh package data. +.SS "\fBprefix\fR" +.RS 0 +.IP \(bu 4 +Default: In global mode, the folder where the node executable is installed. Otherwise, the nearest parent folder containing either a package.json file or a node_modules folder. +.IP \(bu 4 +Type: Path +.RE 0 + +.P +The location to install global items. If set on the command line, then it forces non-global commands to run in the specified folder. +.SS "\fBpreid\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +The "prerelease identifier" to use as a prefix for the "prerelease" part of a semver. Like the \fBrc\fR in \fB1.2.0-rc.8\fR. +.SS "\fBprogress\fR" +.RS 0 +.IP \(bu 4 +Default: \fBtrue\fR unless running in a known CI system +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set to \fBtrue\fR, npm will display a progress bar during time intensive operations, if \fBprocess.stderr\fR and \fBprocess.stdout\fR are a TTY. +.P +Set to \fBfalse\fR to suppress the progress bar. +.SS "\fBprovenance\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When publishing from a supported cloud CI/CD system, the package will be publicly linked to where it was built and published from. +.P +This config can not be used with: \fBprovenance-file\fR +.SS "\fBprovenance-file\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: Path +.RE 0 + +.P +When publishing, the provenance bundle at the given path will be used. +.P +This config can not be used with: \fBprovenance\fR +.SS "\fBproxy\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null, false, or URL +.RE 0 + +.P +A proxy to use for outgoing http requests. If the \fBHTTP_PROXY\fR or \fBhttp_proxy\fR environment variables are set, proxy settings will be honored by the underlying \fBrequest\fR library. +.SS "\fBread-only\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +This is used to mark a token as unable to publish when configuring limited access tokens with the \fBnpm token create\fR command. +.SS "\fBrebuild-bundle\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Rebuild bundled dependencies after installation. +.SS "\fBregistry\fR" +.RS 0 +.IP \(bu 4 +Default: "https://registry.npmjs.org/" +.IP \(bu 4 +Type: URL +.RE 0 + +.P +The base URL of the npm registry. +.SS "\fBreplace-registry-host\fR" +.RS 0 +.IP \(bu 4 +Default: "npmjs" +.IP \(bu 4 +Type: "npmjs", "never", "always", or String +.RE 0 + +.P +Defines behavior for replacing the registry host in a lockfile with the configured registry. +.P +The default behavior is to replace package dist URLs from the default registry (https://registry.npmjs.org) to the configured registry. If set to "never", then use the registry value. If set to "always", then replace the registry host with the configured host every time. +.P +You may also specify a bare hostname (e.g., "registry.npmjs.org"). +.SS "\fBsave\fR" +.RS 0 +.IP \(bu 4 +Default: \fBtrue\fR unless when using \fBnpm update\fR where it defaults to \fBfalse\fR +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Save installed packages to a \fBpackage.json\fR file as dependencies. +.P +When used with the \fBnpm rm\fR command, removes the dependency from \fBpackage.json\fR. +.P +Will also prevent writing to \fBpackage-lock.json\fR if set to \fBfalse\fR. +.SS "\fBsave-bundle\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If a package would be saved at install time by the use of \fB--save\fR, \fB--save-dev\fR, or \fB--save-optional\fR, then also put it in the \fBbundleDependencies\fR list. +.P +Ignored if \fB--save-peer\fR is set, since peerDependencies cannot be bundled. +.SS "\fBsave-dev\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Save installed packages to a package.json file as \fBdevDependencies\fR. +.SS "\fBsave-exact\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Dependencies saved to package.json will be configured with an exact version rather than using npm's default semver range operator. +.SS "\fBsave-optional\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Save installed packages to a package.json file as \fBoptionalDependencies\fR. +.SS "\fBsave-peer\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Save installed packages to a package.json file as \fBpeerDependencies\fR +.SS "\fBsave-prefix\fR" +.RS 0 +.IP \(bu 4 +Default: "^" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Configure how versions of packages installed to a package.json file via \fB--save\fR or \fB--save-dev\fR get prefixed. +.P +For example if a package has version \fB1.2.3\fR, by default its version is set to \fB^1.2.3\fR which allows minor upgrades for that package, but after \fBnpm +config set save-prefix='~'\fR it would be set to \fB~1.2.3\fR which only allows patch upgrades. +.SS "\fBsave-prod\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Save installed packages into \fBdependencies\fR specifically. This is useful if a package already exists in \fBdevDependencies\fR or \fBoptionalDependencies\fR, but you want to move it to be a non-optional production dependency. +.P +This is the default behavior if \fB--save\fR is true, and neither \fB--save-dev\fR or \fB--save-optional\fR are true. +.SS "\fBsbom-format\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: "cyclonedx" or "spdx" +.RE 0 + +.P +SBOM format to use when generating SBOMs. +.SS "\fBsbom-type\fR" +.RS 0 +.IP \(bu 4 +Default: "library" +.IP \(bu 4 +Type: "library", "application", or "framework" +.RE 0 + +.P +The type of package described by the generated SBOM. For SPDX, this is the value for the \fBprimaryPackagePurpose\fR field. For CycloneDX, this is the value for the \fBtype\fR field. +.SS "\fBscope\fR" +.RS 0 +.IP \(bu 4 +Default: the scope of the current project, if any, or "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Associate an operation with a scope for a scoped registry. +.P +Useful when logging in to or out of a private registry: +.P +.RS 2 +.nf +# log in, linking the scope to the custom registry +npm login --scope=@mycorp --registry=https://registry.mycorp.com + +# log out, removing the link and the auth token +npm logout --scope=@mycorp +.fi +.RE +.P +This will cause \fB@mycorp\fR to be mapped to the registry for future installation of packages specified according to the pattern \fB@mycorp/package\fR. +.P +This will also cause \fBnpm init\fR to create a scoped package. +.P +.RS 2 +.nf +# accept all defaults, and create a package named "@foo/whatever", +# instead of just named "whatever" +npm init --scope=@foo --yes +.fi +.RE +.SS "\fBscript-shell\fR" +.RS 0 +.IP \(bu 4 +Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows +.IP \(bu 4 +Type: null or String +.RE 0 + +.P +The shell to use for scripts run with the \fBnpm exec\fR, \fBnpm run\fR and \fBnpm +init \fR commands. +.SS "\fBsearchexclude\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Space-separated options that limit the results from search. +.SS "\fBsearchlimit\fR" +.RS 0 +.IP \(bu 4 +Default: 20 +.IP \(bu 4 +Type: Number +.RE 0 + +.P +Number of items to limit search results to. Will not apply at all to legacy searches. +.SS "\fBsearchopts\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Space-separated options that are always passed to search. +.SS "\fBsearchstaleness\fR" +.RS 0 +.IP \(bu 4 +Default: 900 +.IP \(bu 4 +Type: Number +.RE 0 + +.P +The age of the cache, in seconds, before another registry request is made if using legacy search endpoint. +.SS "\fBshell\fR" +.RS 0 +.IP \(bu 4 +Default: SHELL environment variable, or "bash" on Posix, or "cmd.exe" on Windows +.IP \(bu 4 +Type: String +.RE 0 + +.P +The shell to run for the \fBnpm explore\fR command. +.SS "\fBsign-git-commit\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, then the \fBnpm version\fR command will commit the new package version using \fB-S\fR to add a signature. +.P +Note that git requires you to have set up GPG keys in your git configs for this to work properly. +.SS "\fBsign-git-tag\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, then the \fBnpm version\fR command will tag the version using \fB-s\fR to add a signature. +.P +Note that git requires you to have set up GPG keys in your git configs for this to work properly. +.SS "\fBstrict-peer-deps\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to \fBtrue\fR, and \fB--legacy-peer-deps\fR is not set, then \fIany\fR conflicting \fBpeerDependencies\fR will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships. +.P +By default, conflicting \fBpeerDependencies\fR deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's \fBpeerDependencies\fR object. +.P +When such an override is performed, a warning is printed, explaining the conflict and the packages involved. If \fB--strict-peer-deps\fR is set, then this warning is treated as a failure. +.SS "\fBstrict-ssl\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Whether or not to do SSL key validation when making requests to the registry via https. +.P +See also the \fBca\fR config. +.SS "\fBtag\fR" +.RS 0 +.IP \(bu 4 +Default: "latest" +.IP \(bu 4 +Type: String +.RE 0 + +.P +If you ask npm to install a package and don't tell it a specific version, then it will install the specified tag. +.P +It is the tag added to the package@version specified in the \fBnpm dist-tag +add\fR command, if no explicit tag is given. +.P +When used by the \fBnpm diff\fR command, this is the tag used to fetch the tarball that will be compared with the local files by default. +.P +If used in the \fBnpm publish\fR command, this is the tag that will be added to the package submitted to the registry. +.SS "\fBtag-version-prefix\fR" +.RS 0 +.IP \(bu 4 +Default: "v" +.IP \(bu 4 +Type: String +.RE 0 + +.P +If set, alters the prefix used when tagging a new version when performing a version increment using \fBnpm version\fR. To remove the prefix altogether, set it to the empty string: \fB""\fR. +.P +Because other tools may rely on the convention that npm version tags look like \fBv1.0.0\fR, \fIonly use this property if it is absolutely necessary\fR. In particular, use care when overriding this setting for public packages. +.SS "\fBtiming\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, writes timing information to a process specific json file in the cache or \fBlogs-dir\fR. The file name ends with \fB-timing.json\fR. +.P +You can quickly view it with this \fBjson\fR \fI\(lahttps://npm.im/json\(ra\fR command line: \fBcat ~/.npm/_logs/*-timing.json | npm exec -- json -g\fR. +.P +Timing information will also be reported in the terminal. To suppress this while still writing the timing file, use \fB--silent\fR. +.SS "\fBumask\fR" +.RS 0 +.IP \(bu 4 +Default: 0 +.IP \(bu 4 +Type: Octal numeric string in range 0000..0777 (0..511) +.RE 0 + +.P +The "umask" value to use when setting the file creation mode on files and folders. +.P +Folders and executables are given a mode which is \fB0o777\fR masked against this value. Other files are given a mode which is \fB0o666\fR masked against this value. +.P +Note that the underlying system will \fIalso\fR apply its own umask value to files and folders that are created, and npm does not circumvent this, but rather adds the \fB--umask\fR config to it. +.P +Thus, the effective default umask value on most POSIX systems is 0o22, meaning that folders and executables are created with a mode of 0o755 and other files are created with a mode of 0o644. +.SS "\fBunicode\fR" +.RS 0 +.IP \(bu 4 +Default: false on windows, true on mac/unix systems with a unicode locale, as defined by the \fBLC_ALL\fR, \fBLC_CTYPE\fR, or \fBLANG\fR environment variables. +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs. +.SS "\fBupdate-notifier\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Set to false to suppress the update notification when using an older version of npm than the latest. +.SS "\fBusage\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +Show short usage output about the command specified. +.SS "\fBuser-agent\fR" +.RS 0 +.IP \(bu 4 +Default: "npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}" +.IP \(bu 4 +Type: String +.RE 0 + +.P +Sets the User-Agent request header. The following fields are replaced with their actual counterparts: +.RS 0 +.IP \(bu 4 +\fB{npm-version}\fR - The npm version in use +.IP \(bu 4 +\fB{node-version}\fR - The Node.js version in use +.IP \(bu 4 +\fB{platform}\fR - The value of \fBprocess.platform\fR +.IP \(bu 4 +\fB{arch}\fR - The value of \fBprocess.arch\fR +.IP \(bu 4 +\fB{workspaces}\fR - Set to \fBtrue\fR if the \fBworkspaces\fR or \fBworkspace\fR options are set. +.IP \(bu 4 +\fB{ci}\fR - The value of the \fBci-name\fR config, if set, prefixed with \fBci/\fR, or an empty string if \fBci-name\fR is empty. +.RE 0 + +.SS "\fBuserconfig\fR" +.RS 0 +.IP \(bu 4 +Default: "~/.npmrc" +.IP \(bu 4 +Type: Path +.RE 0 + +.P +The location of user-level configuration settings. +.P +This may be overridden by the \fBnpm_config_userconfig\fR environment variable or the \fB--userconfig\fR command line option, but may \fInot\fR be overridden by settings in the \fBglobalconfig\fR file. +.SS "\fBversion\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, output the npm version and exit successfully. +.P +Only relevant when specified explicitly on the command line. +.SS "\fBversions\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If true, output the npm version as well as node's \fBprocess.versions\fR map and the version in the current working directory's \fBpackage.json\fR file if one exists, and exit successfully. +.P +Only relevant when specified explicitly on the command line. +.SS "\fBviewer\fR" +.RS 0 +.IP \(bu 4 +Default: "man" on Posix, "browser" on Windows +.IP \(bu 4 +Type: String +.RE 0 + +.P +The program to use to view help content. +.P +Set to \fB"browser"\fR to view html help content in the default web browser. +.SS "\fBwhich\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Number +.RE 0 + +.P +If there are multiple funding sources, which 1-indexed source URL to open. +.SS "\fBworkspace\fR" +.RS 0 +.IP \(bu 4 +Default: +.IP \(bu 4 +Type: String (can be set multiple times) +.RE 0 + +.P +Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. +.P +Valid values for the \fBworkspace\fR config are either: +.RS 0 +.IP \(bu 4 +Workspace names +.IP \(bu 4 +Path to a workspace directory +.IP \(bu 4 +Path to a parent workspace directory (will result in selecting all workspaces within that folder) +.RE 0 + +.P +When set for the \fBnpm init\fR command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Set to true to run the command in the context of \fBall\fR configured workspaces. +.P +Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly: +.RS 0 +.IP \(bu 4 +Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config. +.RE 0 + +.P +This value is not exported to the environment for child processes. +.SS "\fBworkspaces-update\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.RE 0 + +.P +If set to true, the npm cli will run an update after operations that may possibly change the workspaces installed to the \fBnode_modules\fR folder. +.SS "\fByes\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.RE 0 + +.P +Automatically answer "yes" to any prompts that npm might print on the command line. +.SS "\fBalso\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null, "dev", or "development" +.IP \(bu 4 +DEPRECATED: Please use --include=dev instead. +.RE 0 + +.P +When set to \fBdev\fR or \fBdevelopment\fR, this is an alias for \fB--include=dev\fR. +.SS "\fBcache-max\fR" +.RS 0 +.IP \(bu 4 +Default: Infinity +.IP \(bu 4 +Type: Number +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--prefer-online\fR +.RE 0 + +.P +\fB--cache-max=0\fR is an alias for \fB--prefer-online\fR +.SS "\fBcache-min\fR" +.RS 0 +.IP \(bu 4 +Default: 0 +.IP \(bu 4 +Type: Number +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--prefer-offline\fR. +.RE 0 + +.P +\fB--cache-min=9999 (or bigger)\fR is an alias for \fB--prefer-offline\fR. +.SS "\fBcert\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.IP \(bu 4 +DEPRECATED: \fBkey\fR and \fBcert\fR are no longer used for most registry operations. Use registry scoped \fBkeyfile\fR and \fBcafile\fR instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem //other-registry.tld/:cafile=/path/to/cert.crt +.RE 0 + +.P +A client certificate to pass when accessing the registry. Values should be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with newlines replaced by the string "\[rs]n". For example: +.P +.RS 2 +.nf +cert="-----BEGIN CERTIFICATE-----\[rs]nXXXX\[rs]nXXXX\[rs]n-----END CERTIFICATE-----" +.fi +.RE +.P +It is \fInot\fR the path to a certificate file, though you can set a registry-scoped "cafile" path like "//other-registry.tld/:cafile=/path/to/cert.pem". +.SS "\fBdev\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: Please use --include=dev instead. +.RE 0 + +.P +Alias for \fB--include=dev\fR. +.SS "\fBglobal-style\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=shallow\fR +.RE 0 + +.P +Only install direct dependencies in the top level \fBnode_modules\fR, but hoist on deeper dependencies. Sets \fB--install-strategy=shallow\fR. +.SS "\fBinit.author.email\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.IP \(bu 4 +DEPRECATED: Use \fB--init-author-email\fR instead. +.RE 0 + +.P +Alias for \fB--init-author-email\fR +.SS "\fBinit.author.name\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: String +.IP \(bu 4 +DEPRECATED: Use \fB--init-author-name\fR instead. +.RE 0 + +.P +Alias for \fB--init-author-name\fR +.SS "\fBinit.author.url\fR" +.RS 0 +.IP \(bu 4 +Default: "" +.IP \(bu 4 +Type: "" or URL +.IP \(bu 4 +DEPRECATED: Use \fB--init-author-url\fR instead. +.RE 0 + +.P +Alias for \fB--init-author-url\fR +.SS "\fBinit.license\fR" +.RS 0 +.IP \(bu 4 +Default: "ISC" +.IP \(bu 4 +Type: String +.IP \(bu 4 +DEPRECATED: Use \fB--init-license\fR instead. +.RE 0 + +.P +Alias for \fB--init-license\fR +.SS "\fBinit.module\fR" +.RS 0 +.IP \(bu 4 +Default: "~/.npm-init.js" +.IP \(bu 4 +Type: Path +.IP \(bu 4 +DEPRECATED: Use \fB--init-module\fR instead. +.RE 0 + +.P +Alias for \fB--init-module\fR +.SS "\fBinit.version\fR" +.RS 0 +.IP \(bu 4 +Default: "1.0.0" +.IP \(bu 4 +Type: SemVer string +.IP \(bu 4 +DEPRECATED: Use \fB--init-version\fR instead. +.RE 0 + +.P +Alias for \fB--init-version\fR +.SS "\fBkey\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or String +.IP \(bu 4 +DEPRECATED: \fBkey\fR and \fBcert\fR are no longer used for most registry operations. Use registry scoped \fBkeyfile\fR and \fBcafile\fR instead. Example: //other-registry.tld/:keyfile=/path/to/key.pem //other-registry.tld/:cafile=/path/to/cert.crt +.RE 0 + +.P +A client key to pass when accessing the registry. Values should be in PEM format with newlines replaced by the string "\[rs]n". For example: +.P +.RS 2 +.nf +key="-----BEGIN PRIVATE KEY-----\[rs]nXXXX\[rs]nXXXX\[rs]n-----END PRIVATE KEY-----" +.fi +.RE +.P +It is \fInot\fR the path to a key file, though you can set a registry-scoped "keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem". +.SS "\fBlegacy-bundling\fR" +.RS 0 +.IP \(bu 4 +Default: false +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: This option has been deprecated in favor of \fB--install-strategy=nested\fR +.RE 0 + +.P +Instead of hoisting package installs in \fBnode_modules\fR, install packages in the same manner that they are depended on. This may cause very deep directory structures and duplicate package installs as there is no de-duplicating. Sets \fB--install-strategy=nested\fR. +.SS "\fBonly\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null, "prod", or "production" +.IP \(bu 4 +DEPRECATED: Use \fB--omit=dev\fR to omit dev dependencies from the install. +.RE 0 + +.P +When set to \fBprod\fR or \fBproduction\fR, this is an alias for \fB--omit=dev\fR. +.SS "\fBoptional\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.IP \(bu 4 +DEPRECATED: Use \fB--omit=optional\fR to exclude optional dependencies, or \fB--include=optional\fR to include them. +.RE 0 + +.P +Default value does install optional deps unless otherwise omitted. +.P +Alias for --include=optional or --omit=optional +.SS "\fBproduction\fR" +.RS 0 +.IP \(bu 4 +Default: null +.IP \(bu 4 +Type: null or Boolean +.IP \(bu 4 +DEPRECATED: Use \fB--omit=dev\fR instead. +.RE 0 + +.P +Alias for \fB--omit=dev\fR +.SS "\fBshrinkwrap\fR" +.RS 0 +.IP \(bu 4 +Default: true +.IP \(bu 4 +Type: Boolean +.IP \(bu 4 +DEPRECATED: Use the --package-lock setting instead. +.RE 0 + +.P +Alias for --package-lock +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +npm help folders +.IP \(bu 4 +npm help npm +.RE 0 diff --git a/node_modules/npm/man/man7/dependency-selectors.7 b/node_modules/npm/man/man7/dependency-selectors.7 new file mode 100644 index 00000000..7331ef39 --- /dev/null +++ b/node_modules/npm/man/man7/dependency-selectors.7 @@ -0,0 +1,331 @@ +.TH "QUERYING" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBQuerying\fR - Dependency Selector Syntax & Querying +.SS "Description" +.P +The npm help query command exposes a new dependency selector syntax (informed by & respecting many aspects of the \fBCSS Selectors 4 Spec\fR \fI\(lahttps://dev.w3.org/csswg/selectors4/#relational\(ra\fR) which: +.RS 0 +.IP \(bu 4 +Standardizes the shape of, & querying of, dependency graphs with a robust object model, metadata & selector syntax +.IP \(bu 4 +Leverages existing, known language syntax & operators from CSS to make disparate package information broadly accessible +.IP \(bu 4 +Unlocks the ability to answer complex, multi-faceted questions about dependencies, their relationships & associative metadata +.IP \(bu 4 +Consolidates redundant logic of similar query commands in \fBnpm\fR (ex. \fBnpm fund\fR, \fBnpm ls\fR, \fBnpm outdated\fR, \fBnpm audit\fR ...) +.RE 0 + +.SS "Dependency Selector Syntax" +.SS "Overview:" +.RS 0 +.IP \(bu 4 +there is no "type" or "tag" selectors (ex. \fBdiv, h1, a\fR) as a dependency/target is the only type of \fBNode\fR that can be queried +.IP \(bu 4 +the term "dependencies" is in reference to any \fBNode\fR found in a \fBtree\fR returned by \fBArborist\fR +.RE 0 + +.SS "Combinators" +.RS 0 +.IP \(bu 4 +\fB>\fR direct descendant/child +.IP \(bu 4 +\fB \fR any descendant/child +.IP \(bu 4 +\fB~\fR sibling +.RE 0 + +.SS "Selectors" +.RS 0 +.IP \(bu 4 +\fB*\fR universal selector +.IP \(bu 4 +\fB#\fR dependency selector (equivalent to \fB\[lB]name="..."\[rB]\fR) +.IP \(bu 4 +\fB#@\fR (equivalent to \fB\[lB]name=\[rB]:semver()\fR) +.IP \(bu 4 +\fB,\fR selector list delimiter +.IP \(bu 4 +\fB.\fR dependency type selector +.IP \(bu 4 +\fB:\fR pseudo selector +.RE 0 + +.SS "Dependency Type Selectors" +.RS 0 +.IP \(bu 4 +\fB.prod\fR dependency found in the \fBdependencies\fR section of \fBpackage.json\fR, or is a child of said dependency +.IP \(bu 4 +\fB.dev\fR dependency found in the \fBdevDependencies\fR section of \fBpackage.json\fR, or is a child of said dependency +.IP \(bu 4 +\fB.optional\fR dependency found in the \fBoptionalDependencies\fR section of \fBpackage.json\fR, or has \fB"optional": true\fR set in its entry in the \fBpeerDependenciesMeta\fR section of \fBpackage.json\fR, or a child of said dependency +.IP \(bu 4 +\fB.peer\fR dependency found in the \fBpeerDependencies\fR section of \fBpackage.json\fR +.IP \(bu 4 +\fB.workspace\fR dependency found in the \fB\fBworkspaces\fR\fR \fI\(lahttps://docs.npmjs.com/cli/v8/using-npm/workspaces\(ra\fR section of \fBpackage.json\fR +.IP \(bu 4 +\fB.bundled\fR dependency found in the \fBbundleDependencies\fR section of \fBpackage.json\fR, or is a child of said dependency +.RE 0 + +.SS "Pseudo Selectors" +.RS 0 +.IP \(bu 4 +\fB\fB:not()\fR\fR \fI\(lahttps://developer.mozilla.org/en-US/docs/Web/CSS/:not\(ra\fR +.IP \(bu 4 +\fB\fB:has()\fR\fR \fI\(lahttps://developer.mozilla.org/en-US/docs/Web/CSS/:has\(ra\fR +.IP \(bu 4 +\fB\fB:is()\fR\fR \fI\(lahttps://developer.mozilla.org/en-US/docs/Web/CSS/:is\(ra\fR +.IP \(bu 4 +\fB\fB:root\fR\fR \fI\(lahttps://developer.mozilla.org/en-US/docs/Web/CSS/:root\(ra\fR matches the root node/dependency +.IP \(bu 4 +\fB\fB:scope\fR\fR \fI\(lahttps://developer.mozilla.org/en-US/docs/Web/CSS/:scope\(ra\fR matches node/dependency it was queried against +.IP \(bu 4 +\fB\fB:empty\fR\fR \fI\(lahttps://developer.mozilla.org/en-US/docs/Web/CSS/:empty\(ra\fR when a dependency has no dependencies +.IP \(bu 4 +\fB\fB:private\fR\fR \fI\(lahttps://docs.npmjs.com/cli/v8/configuring-npm/package-json#private\(ra\fR when a dependency is private +.IP \(bu 4 +\fB:link\fR when a dependency is linked (for instance, workspaces or packages manually \fB\fBlinked\fR\fR \fI\(lahttps://docs.npmjs.com/cli/v8/commands/npm-link\(ra\fR +.IP \(bu 4 +\fB:deduped\fR when a dependency has been deduped (note that this does \fInot\fR always mean the dependency has been hoisted to the root of node_modules) +.IP \(bu 4 +\fB:overridden\fR when a dependency has been overridden +.IP \(bu 4 +\fB:extraneous\fR when a dependency exists but is not defined as a dependency of any node +.IP \(bu 4 +\fB:invalid\fR when a dependency version is out of its ancestors specified range +.IP \(bu 4 +\fB:missing\fR when a dependency is not found on disk +.IP \(bu 4 +\fB:semver(, \[lB]selector\[rB], \[lB]function\[rB])\fR match a valid \fB\fBnode-semver\fR\fR \fI\(lahttps://github.com/npm/node-semver\(ra\fR version or range to a selector +.IP \(bu 4 +\fB:path()\fR \fBglob\fR \fI\(lahttps://www.npmjs.com/package/glob\(ra\fR matching based on dependencies path relative to the project +.IP \(bu 4 +\fB:type()\fR \fBbased on currently recognized types\fR \fI\(lahttps://github.com/npm/npm-package-arg#result-object\(ra\fR +.IP \(bu 4 +\fB:outdated()\fR when a dependency is outdated +.IP \(bu 4 +\fB:vuln()\fR when a dependency has a known vulnerability +.RE 0 + +.SS "\fB:semver(, \[lB]selector\[rB], \[lB]function\[rB])\fR" +.P +The \fB:semver()\fR pseudo selector allows comparing fields from each node's \fBpackage.json\fR using \fBsemver\fR \fI\(lahttps://github.com/npm/node-semver#readme\(ra\fR methods. It accepts up to 3 parameters, all but the first of which are optional. +.RS 0 +.IP \(bu 4 +\fBspec\fR a semver version or range +.IP \(bu 4 +\fBselector\fR an attribute selector for each node (default \fB\[lB]version\[rB]\fR) +.IP \(bu 4 +\fBfunction\fR a semver method to apply, one of: \fBsatisfies\fR, \fBintersects\fR, \fBsubset\fR, \fBgt\fR, \fBgte\fR, \fBgtr\fR, \fBlt\fR, \fBlte\fR, \fBltr\fR, \fBeq\fR, \fBneq\fR or the special function \fBinfer\fR (default \fBinfer\fR) +.RE 0 + +.P +When the special \fBinfer\fR function is used the \fBspec\fR and the actual value from the node are compared. If both are versions, according to \fBsemver.valid()\fR, \fBeq\fR is used. If both values are ranges, according to \fB!semver.valid()\fR, \fBintersects\fR is used. If the values are mixed types \fBsatisfies\fR is used. +.P +Some examples: +.RS 0 +.IP \(bu 4 +\fB:semver(^1.0.0)\fR returns every node that has a \fBversion\fR satisfied by the provided range \fB^1.0.0\fR +.IP \(bu 4 +\fB:semver(16.0.0, :attr(engines, \[lB]node\[rB]))\fR returns every node which has an \fBengines.node\fR property satisfying the version \fB16.0.0\fR +.IP \(bu 4 +\fB:semver(1.0.0, \[lB]version\[rB], lt)\fR every node with a \fBversion\fR less than \fB1.0.0\fR +.RE 0 + +.SS "\fB:outdated()\fR" +.P +The \fB:outdated\fR pseudo selector retrieves data from the registry and returns information about which of your dependencies are outdated. The type parameter may be one of the following: +.RS 0 +.IP \(bu 4 +\fBany\fR (default) a version exists that is greater than the current one +.IP \(bu 4 +\fBin-range\fR a version exists that is greater than the current one, and satisfies at least one if its parent's dependencies +.IP \(bu 4 +\fBout-of-range\fR a version exists that is greater than the current one, does not satisfy at least one of its parent's dependencies +.IP \(bu 4 +\fBmajor\fR a version exists that is a semver major greater than the current one +.IP \(bu 4 +\fBminor\fR a version exists that is a semver minor greater than the current one +.IP \(bu 4 +\fBpatch\fR a version exists that is a semver patch greater than the current one +.RE 0 + +.P +In addition to the filtering performed by the pseudo selector, some extra data is added to the resulting objects. The following data can be found under the \fBqueryContext\fR property of each node. +.RS 0 +.IP \(bu 4 +\fBversions\fR an array of every available version of the given node +.IP \(bu 4 +\fBoutdated.inRange\fR an array of objects, each with a \fBfrom\fR and \fBversions\fR, where \fBfrom\fR is the on-disk location of the node that depends on the current node and \fBversions\fR is an array of all available versions that satisfies that dependency. This is only populated if \fB:outdated(in-range)\fR is used. +.IP \(bu 4 +\fBoutdated.outOfRange\fR an array of objects, identical in shape to \fBinRange\fR, but where the \fBversions\fR array is every available version that does not satisfy the dependency. This is only populated if \fB:outdated(out-of-range)\fR is used. +.RE 0 + +.P +Some examples: +.RS 0 +.IP \(bu 4 +\fB:root > :outdated(major)\fR returns every direct dependency that has a new semver major release +.IP \(bu 4 +\fB.prod:outdated(in-range)\fR returns production dependencies that have a new release that satisfies at least one of its parent's dependencies +.RE 0 + +.SS "\fB:vuln\fR" +.P +The \fB:vuln\fR pseudo selector retrieves data from the registry and returns information about which if your dependencies has a known vulnerability. Only dependencies whose current version matches a vulnerability will be returned. For example if you have \fBsemver@7.6.0\fR in your tree, a vulnerability for \fBsemver\fR which affects versions \fB<=6.3.1\fR will not match. +.P +You can also filter results by certain attributes in advisories. Currently that includes \fBseverity\fR and \fBcwe\fR. Note that severity filtering is done per severity, it does not include severities "higher" or "lower" than the one specified. +.P +In addition to the filtering performed by the pseudo selector, info about each relevant advisory will be added to the \fBqueryContext\fR attribute of each node under the \fBadvisories\fR attribute. +.P +Some examples: +.RS 0 +.IP \(bu 4 +\fB:root > .prod:vuln\fR returns direct production dependencies with any known vulnerability +.IP \(bu 4 +\fB:vuln(\[lB]severity=high\[rB])\fR returns only dependencies with a vulnerability with a \fBhigh\fR severity. +.IP \(bu 4 +\fB:vuln(\[lB]severity=high\[rB],\[lB]severity=moderate\[rB])\fR returns only dependencies with a vulnerability with a \fBhigh\fR or \fBmoderate\fR severity. +.IP \(bu 4 +\fB:vuln(\[lB]cwe=1333\[rB])\fR returns only dependencies with a vulnerability that includes CWE-1333 (ReDoS) +.RE 0 + +.SS "\fBAttribute Selectors\fR \fI\(lahttps://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors\(ra\fR" +.P +The attribute selector evaluates the key/value pairs in \fBpackage.json\fR if they are \fBString\fRs. +.RS 0 +.IP \(bu 4 +\fB\[lB]\[rB]\fR attribute selector (ie. existence of attribute) +.IP \(bu 4 +\fB\[lB]attribute=value\[rB]\fR attribute value is equivalent... +.IP \(bu 4 +\fB\[lB]attribute~=value\[rB]\fR attribute value contains word... +.IP \(bu 4 +\fB\[lB]attribute*=value\[rB]\fR attribute value contains string... +.IP \(bu 4 +\fB\[lB]attribute|=value\[rB]\fR attribute value is equal to or starts with... +.IP \(bu 4 +\fB\[lB]attribute^=value\[rB]\fR attribute value starts with... +.IP \(bu 4 +\fB\[lB]attribute$=value\[rB]\fR attribute value ends with... +.RE 0 + +.SS "\fBArray\fR & \fBObject\fR Attribute Selectors" +.P +The generic \fB:attr()\fR pseudo selector standardizes a pattern which can be used for attribute selection of \fBObject\fRs, \fBArray\fRs or \fBArrays\fR of \fBObject\fRs accessible via \fBArborist\fR's \fBNode.package\fR metadata. This allows for iterative attribute selection beyond top-level \fBString\fR evaluation. The last argument passed to \fB:attr()\fR must be an \fBattribute\fR selector or a nested \fB:attr()\fR. See examples below: +.SS "\fBObjects\fR" +.P +.RS 2 +.nf +/* return dependencies that have a `scripts.test` containing `"tap"` */ +*:attr(scripts, \[lB]test~=tap\[rB]) +.fi +.RE +.SS "Nested \fBObjects\fR" +.P +Nested objects are expressed as sequential arguments to \fB:attr()\fR. +.P +.RS 2 +.nf +/* return dependencies that have a testling config for opera browsers */ +*:attr(testling, browsers, \[lB]~=opera\[rB]) +.fi +.RE +.SS "\fBArrays\fR" +.P +\fBArray\fRs specifically uses a special/reserved \fB.\fR character in place of a typical attribute name. \fBArrays\fR also support exact \fBvalue\fR matching when a \fBString\fR is passed to the selector. +.SS "Example of an \fBArray\fR Attribute Selection:" +.P +.RS 2 +.nf +/* removes the distinction between properties & arrays */ +/* ie. we'd have to check the property & iterate to match selection */ +*:attr(\[lB]keywords^=react\[rB]) +*:attr(contributors, :attr(\[lB]name~=Jordan\[rB])) +.fi +.RE +.SS "Example of an \fBArray\fR matching directly to a value:" +.P +.RS 2 +.nf +/* return dependencies that have the exact keyword "react" */ +/* this is equivalent to `*:keywords(\[lB]value="react"\[rB])` */ +*:attr(\[lB]keywords=react\[rB]) +.fi +.RE +.SS "Example of an \fBArray\fR of \fBObject\fRs:" +.P +.RS 2 +.nf +/* returns */ +*:attr(contributors, \[lB]email=ruyadorno@github.com\[rB]) +.fi +.RE +.SS "Groups" +.P +Dependency groups are defined by the package relationships to their ancestors (ie. the dependency types that are defined in \fBpackage.json\fR). This approach is user-centric as the ecosystem has been taught to think about dependencies in these groups first-and-foremost. Dependencies are allowed to be included in multiple groups (ex. a \fBprod\fR dependency may also be a \fBdev\fR dependency (in that it's also required by another \fBdev\fR dependency) & may also be \fBbundled\fR - a selector for that type of dependency would look like: \fB*.prod.dev.bundled\fR). +.RS 0 +.IP \(bu 4 +\fB.prod\fR +.IP \(bu 4 +\fB.dev\fR +.IP \(bu 4 +\fB.optional\fR +.IP \(bu 4 +\fB.peer\fR +.IP \(bu 4 +\fB.bundled\fR +.IP \(bu 4 +\fB.workspace\fR +.RE 0 + +.P +Please note that currently \fBworkspace\fR deps are always \fBprod\fR dependencies. Additionally the \fB.root\fR dependency is also considered a \fBprod\fR dependency. +.SS "Programmatic Usage" +.RS 0 +.IP \(bu 4 +\fBArborist\fR's \fBNode\fR Class has a \fB.querySelectorAll()\fR method +.RS 4 +.IP \(bu 4 +this method will return a filtered, flattened dependency Arborist \fBNode\fR list based on a valid query selector +.RE 0 + +.RE 0 + +.P +.RS 2 +.nf +const Arborist = require('@npmcli/arborist') +const arb = new Arborist({}) +.fi +.RE +.P +.RS 2 +.nf +// root-level +arb.loadActual().then(async (tree) => { + // query all production dependencies + const results = await tree.querySelectorAll('.prod') + console.log(results) +}) +.fi +.RE +.P +.RS 2 +.nf +// iterative +arb.loadActual().then(async (tree) => { + // query for the deduped version of react + const results = await tree.querySelectorAll('#react:not(:deduped)') + // query the deduped react for git deps + const deps = await results\[lB]0\[rB].querySelectorAll(':type(git)') + console.log(deps) +}) +.fi +.RE +.SH "SEE ALSO" +.RS 0 +.IP \(bu 4 +npm help query +.IP \(bu 4 +\fB@npmcli/arborist\fR \fI\(lahttps://npm.im/@npmcli/arborist\(ra\fR +.RE 0 diff --git a/node_modules/npm/man/man7/developers.7 b/node_modules/npm/man/man7/developers.7 new file mode 100644 index 00000000..b6fc1102 --- /dev/null +++ b/node_modules/npm/man/man7/developers.7 @@ -0,0 +1,236 @@ +.TH "DEVELOPERS" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBdevelopers\fR - Developer Guide +.SS "Description" +.P +So, you've decided to use npm to develop (and maybe publish/deploy) your project. +.P +Fantastic! +.P +There are a few things that you need to do above the simple steps that your users will do to install your program. +.SS "About These Documents" +.P +These are man pages. If you install npm, you should be able to then do \fBman npm-thing\fR to get the documentation on a particular topic, or \fBnpm help thing\fR to see the same information. +.SS "What is a Package" +.P +A package is: +.RS 0 +.IP \(bu 4 +a) a folder containing a program described by a package.json file +.IP \(bu 4 +b) a gzipped tarball containing (a) +.IP \(bu 4 +c) a url that resolves to (b) +.IP \(bu 4 +d) a \fB@\fR that is published on the registry with (c) +.IP \(bu 4 +e) a \fB@\fR that points to (d) +.IP \(bu 4 +f) a \fB\fR that has a "latest" tag satisfying (e) +.IP \(bu 4 +g) a \fBgit\fR url that, when cloned, results in (a). +.RE 0 + +.P +Even if you never publish your package, you can still get a lot of benefits of using npm if you just want to write a node program (a), and perhaps if you also want to be able to easily install it elsewhere after packing it up into a tarball (b). +.P +Git urls can be of the form: +.P +.RS 2 +.nf +git://github.com/user/project.git#commit-ish +git+ssh://user@hostname:project.git#commit-ish +git+http://user@hostname/project/blah.git#commit-ish +git+https://user@hostname/project/blah.git#commit-ish +.fi +.RE +.P +The \fBcommit-ish\fR can be any tag, sha, or branch which can be supplied as an argument to \fBgit checkout\fR. The default is whatever the repository uses as its default branch. +.SS "The package.json File" +.P +You need to have a \fBpackage.json\fR file in the root of your project to do much of anything with npm. That is basically the whole interface. +.P +See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for details about what goes in that file. At the very least, you need: +.RS 0 +.IP \(bu 4 +name: This should be a string that identifies your project. Please do not use the name to specify that it runs on node, or is in JavaScript. You can use the "engines" field to explicitly state the versions of node (or whatever else) that your program requires, and it's pretty well assumed that it's JavaScript. +.P +It does not necessarily need to match your github repository name. +.P +So, \fBnode-foo\fR and \fBbar-js\fR are bad names. \fBfoo\fR or \fBbar\fR are better. +.IP \(bu 4 +version: A semver-compatible version. +.IP \(bu 4 +engines: Specify the versions of node (or whatever else) that your program runs on. The node API changes a lot, and there may be bugs or new functionality that you depend on. Be explicit. +.IP \(bu 4 +author: Take some credit. +.IP \(bu 4 +scripts: If you have a special compilation or installation script, then you should put it in the \fBscripts\fR object. You should definitely have at least a basic smoke-test command as the "scripts.test" field. See npm help scripts. +.IP \(bu 4 +main: If you have a single module that serves as the entry point to your program (like what the "foo" package gives you at require("foo")), then you need to specify that in the "main" field. +.IP \(bu 4 +directories: This is an object mapping names to folders. The best ones to include are "lib" and "doc", but if you use "man" to specify a folder full of man pages, they'll get installed just like these ones. +.RE 0 + +.P +You can use \fBnpm init\fR in the root of your package in order to get you started with a pretty basic package.json file. See npm help init for more info. +.SS "Keeping files \fIout\fR of your Package" +.P +Use a \fB.npmignore\fR file to keep stuff out of your package. If there's no \fB.npmignore\fR file, but there \fIis\fR a \fB.gitignore\fR file, then npm will ignore the stuff matched by the \fB.gitignore\fR file. If you \fIwant\fR to include something that is excluded by your \fB.gitignore\fR file, you can create an empty \fB.npmignore\fR file to override it. Like \fBgit\fR, \fBnpm\fR looks for \fB.npmignore\fR and \fB.gitignore\fR files in all subdirectories of your package, not only the root directory. +.P +\fB.npmignore\fR files follow the \fBsame pattern rules\fR \fI\(lahttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#_ignoring\(ra\fR as \fB.gitignore\fR files: +.RS 0 +.IP \(bu 4 +Blank lines or lines starting with \fB#\fR are ignored. +.IP \(bu 4 +Standard glob patterns work. +.IP \(bu 4 +You can end patterns with a forward slash \fB/\fR to specify a directory. +.IP \(bu 4 +You can negate a pattern by starting it with an exclamation point \fB!\fR. +.RE 0 + +.P +By default, some paths and files are ignored, so there's no need to add them to \fB.npmignore\fR explicitly. Some examples are: +.RS 0 +.IP \(bu 4 +\fB.*.swp\fR +.IP \(bu 4 +\fB._*\fR +.IP \(bu 4 +\fB.DS_Store\fR +.IP \(bu 4 +\fB.git\fR +.IP \(bu 4 +\fB.gitignore\fR +.IP \(bu 4 +\fB.hg\fR +.IP \(bu 4 +\fB.npmignore\fR +.IP \(bu 4 +\fB.npmrc\fR +.IP \(bu 4 +\fB.lock-wscript\fR +.IP \(bu 4 +\fB.svn\fR +.IP \(bu 4 +\fB.wafpickle-*\fR +.IP \(bu 4 +\fBconfig.gypi\fR +.IP \(bu 4 +\fBCVS\fR +.IP \(bu 4 +\fBnpm-debug.log\fR +.RE 0 + +.P +Additionally, everything in \fBnode_modules\fR is ignored, except for bundled dependencies. npm automatically handles this for you, so don't bother adding \fBnode_modules\fR to \fB.npmignore\fR. +.P +The following paths and files are never ignored, so adding them to \fB.npmignore\fR is pointless: +.RS 0 +.IP \(bu 4 +\fBpackage.json\fR +.IP \(bu 4 +\fBREADME\fR (and its variants) +.IP \(bu 4 +\fBCHANGELOG\fR (and its variants) +.IP \(bu 4 +\fBLICENSE\fR / \fBLICENCE\fR +.RE 0 + +.P +If, given the structure of your project, you find \fB.npmignore\fR to be a maintenance headache, you might instead try populating the \fBfiles\fR property of \fBpackage.json\fR, which is an array of file or directory names that should be included in your package. Sometimes manually picking which items to allow is easier to manage than building a block list. +.P +See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for more info on what can and can't be ignored. +.SS "Testing whether your \fB.npmignore\fR or \fBfiles\fR config works" +.P +If you want to double check that your package will include only the files you intend it to when published, you can run the \fBnpm pack\fR command locally which will generate a tarball in the working directory, the same way it does for publishing. +.SS "Link Packages" +.P +\fBnpm link\fR is designed to install a development package and see the changes in real time without having to keep re-installing it. (You do need to either re-link or \fBnpm rebuild -g\fR to update compiled packages, of course.) +.P +More info at npm help link. +.SS "Before Publishing: Make Sure Your Package Installs and Works" +.P +\fBThis is important.\fR +.P +If you can not install it locally, you'll have problems trying to publish it. Or, worse yet, you'll be able to publish it, but you'll be publishing a broken or pointless package. So don't do that. +.P +In the root of your package, do this: +.P +.RS 2 +.nf +npm install . -g +.fi +.RE +.P +That'll show you that it's working. If you'd rather just create a symlink package that points to your working directory, then do this: +.P +.RS 2 +.nf +npm link +.fi +.RE +.P +Use \fBnpm ls -g\fR to see if it's there. +.P +To test a local install, go into some other folder, and then do: +.P +.RS 2 +.nf +cd ../some-other-folder +npm install ../my-package +.fi +.RE +.P +to install it locally into the node_modules folder in that other place. +.P +Then go into the node-repl, and try using require("my-thing") to bring in your module's main module. +.SS "Create a User Account" +.P +Create a user with the adduser command. It works like this: +.P +.RS 2 +.nf +npm adduser +.fi +.RE +.P +and then follow the prompts. +.P +This is documented better in npm help adduser. +.SS "Publish your Package" +.P +This part's easy. In the root of your folder, do this: +.P +.RS 2 +.nf +npm publish +.fi +.RE +.P +You can give publish a url to a tarball, or a filename of a tarball, or a path to a folder. +.P +Note that pretty much \fBeverything in that folder will be exposed\fR by default. So, if you have secret stuff in there, use a \fB.npmignore\fR file to list out the globs to ignore, or publish from a fresh checkout. +.SS "Brag about it" +.P +Send emails, write blogs, blab in IRC. +.P +Tell the world how easy it is to install your program! +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help npm +.IP \(bu 4 +npm help init +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help scripts +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help adduser +.IP \(bu 4 +npm help registry +.RE 0 diff --git a/node_modules/npm/man/man7/logging.7 b/node_modules/npm/man/man7/logging.7 new file mode 100644 index 00000000..4b1bd5a1 --- /dev/null +++ b/node_modules/npm/man/man7/logging.7 @@ -0,0 +1,108 @@ +.TH "LOGGING" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBLogging\fR - Why, What & How We Log +.SS "Description" +.P +The \fBnpm\fR CLI has various mechanisms for showing different levels of information back to end-users for certain commands, configurations & environments. +.SS "Setting Log File Location" +.P +All logs are written to a debug log, with the path to that file printed if the execution of a command fails. +.P +The default location of the logs directory is a directory named \fB_logs\fR inside the npm cache. This can be changed with the \fBlogs-dir\fR config option. +.P +For example, if you wanted to write all your logs to the current working directory, you could run: \fBnpm install --logs-dir=.\fR. This is especially helpful in debugging a specific \fBnpm\fR issue as you can run a command multiple times with different config values and then diff all the log files. +.P +Log files will be removed from the \fBlogs-dir\fR when the number of log files exceeds \fBlogs-max\fR, with the oldest logs being deleted first. +.P +To turn off logs completely set \fB--logs-max=0\fR. +.SS "Setting Log Levels" +.SS "\fBloglevel\fR" +.P +\fBloglevel\fR is a global argument/config that can be set to determine the type of information to be displayed. +.P +The default value of \fBloglevel\fR is \fB"notice"\fR but there are several levels/types of logs available, including: +.RS 0 +.IP \(bu 4 +\fB"silent"\fR +.IP \(bu 4 +\fB"error"\fR +.IP \(bu 4 +\fB"warn"\fR +.IP \(bu 4 +\fB"notice"\fR +.IP \(bu 4 +\fB"http"\fR +.IP \(bu 4 +\fB"info"\fR +.IP \(bu 4 +\fB"verbose"\fR +.IP \(bu 4 +\fB"silly"\fR +.RE 0 + +.P +All logs pertaining to a level proceeding the current setting will be shown. +.SS "Aliases" +.P +The log levels listed above have various corresponding aliases, including: +.RS 0 +.IP \(bu 4 +\fB-d\fR: \fB--loglevel info\fR +.IP \(bu 4 +\fB--dd\fR: \fB--loglevel verbose\fR +.IP \(bu 4 +\fB--verbose\fR: \fB--loglevel verbose\fR +.IP \(bu 4 +\fB--ddd\fR: \fB--loglevel silly\fR +.IP \(bu 4 +\fB-q\fR: \fB--loglevel warn\fR +.IP \(bu 4 +\fB--quiet\fR: \fB--loglevel warn\fR +.IP \(bu 4 +\fB-s\fR: \fB--loglevel silent\fR +.IP \(bu 4 +\fB--silent\fR: \fB--loglevel silent\fR +.RE 0 + +.SS "\fBforeground-scripts\fR" +.P +The \fBnpm\fR CLI began hiding the output of lifecycle scripts for \fBnpm install\fR as of \fBv7\fR. Notably, this means you will not see logs/output from packages that may be using "install scripts" to display information back to you or from your own project's scripts defined in \fBpackage.json\fR. If you'd like to change this behavior & log this output you can set \fBforeground-scripts\fR to \fBtrue\fR. +.SS "Timing Information" +.P +The \fB\fB--timing\fR config\fR \fI\(la/using-npm/config#timing\(ra\fR can be set which does a few things: +.RS 0 +.IP 1. 4 +Always shows the full path to the debug log regardless of command exit status +.IP 2. 4 +Write timing information to a process specific timing file in the cache or \fBlogs-dir\fR +.IP 3. 4 +Output timing information to the terminal +.RE 0 + +.P +This file contains a \fBtimers\fR object where the keys are an identifier for the portion of the process being timed and the value is the number of milliseconds it took to complete. +.P +Sometimes it is helpful to get timing information without outputting anything to the terminal. For example, the performance might be affected by writing to the terminal. In this case you can use \fB--timing --silent\fR which will still write the timing file, but not output anything to the terminal while running. +.SS "Registry Response Headers" +.SS "\fBnpm-notice\fR" +.P +The \fBnpm\fR CLI reads from & logs any \fBnpm-notice\fR headers that are returned from the configured registry. This mechanism can be used by third-party registries to provide useful information when network-dependent requests occur. +.P +This header is not cached, and will not be logged if the request is served from the cache. +.SS "Logs and Sensitive Information" +.P +The \fBnpm\fR CLI makes a best effort to redact the following from terminal output and log files: +.RS 0 +.IP \(bu 4 +Passwords inside basic auth URLs +.IP \(bu 4 +npm tokens +.RE 0 + +.P +However, this behavior should not be relied on to keep all possible sensitive information redacted. If you are concerned about secrets in your log file or terminal output, you can use \fB--loglevel=silent\fR and \fB--logs-max=0\fR to ensure no logs are written to your terminal or filesystem. +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help config +.RE 0 diff --git a/node_modules/npm/man/man7/orgs.7 b/node_modules/npm/man/man7/orgs.7 new file mode 100644 index 00000000..4f61c68e --- /dev/null +++ b/node_modules/npm/man/man7/orgs.7 @@ -0,0 +1,145 @@ +.TH "ORGS" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBorgs\fR - Working with Teams & Orgs +.SS "Description" +.P +There are three levels of org users: +.RS 0 +.IP 1. 4 +Super admin, controls billing & adding people to the org. +.IP 2. 4 +Team admin, manages team membership & package access. +.IP 3. 4 +Developer, works on packages they are given access to. +.RE 0 + +.P +The super admin is the only person who can add users to the org because it impacts the monthly bill. The super admin will use the website to manage membership. Every org has a \fBdevelopers\fR team that all users are automatically added to. +.P +The team admin is the person who manages team creation, team membership, and package access for teams. The team admin grants package access to teams, not individuals. +.P +The developer will be able to access packages based on the teams they are on. Access is either read-write or read-only. +.P +There are two main commands: +.RS 0 +.IP 1. 4 +\fBnpm team\fR see npm help team for more details +.IP 2. 4 +\fBnpm access\fR see npm help access for more details +.RE 0 + +.SS "Team Admins create teams" +.RS 0 +.IP \(bu 4 +Check who you\[cq]ve added to your org: +.RE 0 + +.P +.RS 2 +.nf +npm team ls :developers +.fi +.RE +.RS 0 +.IP \(bu 4 +Each org is automatically given a \fBdevelopers\fR team, so you can see the whole list of team members in your org. This team automatically gets read-write access to all packages, but you can change that with the \fBaccess\fR command. +.IP \(bu 4 +Create a new team: +.RE 0 + +.P +.RS 2 +.nf +npm team create +.fi +.RE +.RS 0 +.IP \(bu 4 +Add members to that team: +.RE 0 + +.P +.RS 2 +.nf +npm team add +.fi +.RE +.SS "Publish a package and adjust package access" +.RS 0 +.IP \(bu 4 +In package directory, run +.RE 0 + +.P +.RS 2 +.nf +npm init --scope= +.fi +.RE +.P +to scope it for your org & publish as usual +.RS 0 +.IP \(bu 4 +Grant access: +.RE 0 + +.P +.RS 2 +.nf +npm access grant \[lB]\[rB] +.fi +.RE +.RS 0 +.IP \(bu 4 +Revoke access: +.RE 0 + +.P +.RS 2 +.nf +npm access revoke \[lB]\[rB] +.fi +.RE +.SS "Monitor your package access" +.RS 0 +.IP \(bu 4 +See what org packages a team member can access: +.RE 0 + +.P +.RS 2 +.nf +npm access ls-packages +.fi +.RE +.RS 0 +.IP \(bu 4 +See packages available to a specific team: +.RE 0 + +.P +.RS 2 +.nf +npm access ls-packages +.fi +.RE +.RS 0 +.IP \(bu 4 +Check which teams are collaborating on a package: +.RE 0 + +.P +.RS 2 +.nf +npm access ls-collaborators +.fi +.RE +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help team +.IP \(bu 4 +npm help access +.IP \(bu 4 +npm help scope +.RE 0 diff --git a/node_modules/npm/man/man7/package-spec.7 b/node_modules/npm/man/man7/package-spec.7 new file mode 100644 index 00000000..0d68ede4 --- /dev/null +++ b/node_modules/npm/man/man7/package-spec.7 @@ -0,0 +1,126 @@ +.TH "PACKAGE-SPEC" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBpackage-spec\fR - Package name specifier +.SS "Description" +.P +Commands like \fBnpm install\fR and the dependency sections in the \fBpackage.json\fR use a package name specifier. This can be many different things that all refer to a "package". Examples include a package name, git url, tarball, or local directory. These will generally be referred to as \fB\fR in the help output for the npm commands that use this package name specifier. +.SS "Package name" +.RS 0 +.IP \(bu 4 +\fB\[lB]<@scope>/\[rB]\fR +.IP \(bu 4 +\fB\[lB]<@scope>/\[rB]@\fR +.IP \(bu 4 +\fB\[lB]<@scope>/\[rB]@\fR +.IP \(bu 4 +\fB\[lB]<@scope>/\[rB]@\fR +.RE 0 + +.P +Refers to a package by name, with or without a scope, and optionally tag, version, or version range. This is typically used in combination with the \fBregistry\fR \fI\(la/using-npm/config#registry\(ra\fR config to refer to a package in a registry. +.P +Examples: +.RS 0 +.IP \(bu 4 +\fBnpm\fR +.IP \(bu 4 +\fB@npmcli/arborist\fR +.IP \(bu 4 +\fB@npmcli/arborist@latest\fR +.IP \(bu 4 +\fBnpm@6.13.1\fR +.IP \(bu 4 +\fBnpm@^4.0.0\fR +.RE 0 + +.SS "Aliases" +.RS 0 +.IP \(bu 4 +\fB@npm:\fR +.RE 0 + +.P +Primarily used by commands like \fBnpm install\fR and in the dependency sections in the \fBpackage.json\fR, this refers to a package by an alias. The \fB\fR is the name of the package as it is reified in the \fBnode_modules\fR folder, and the \fB\fR refers to a package name as found in the configured registry. +.P +See \fBPackage name\fR above for more info on referring to a package by name, and \fBregistry\fR \fI\(la/using-npm/config#registry\(ra\fR for configuring which registry is used when referring to a package by name. +.P +Examples: +.RS 0 +.IP \(bu 4 +\fBsemver:@npm:@npmcli/semver-with-patch\fR +.IP \(bu 4 +\fBsemver:@npm:semver@7.2.2\fR +.IP \(bu 4 +\fBsemver:@npm:semver@legacy\fR +.RE 0 + +.SS "Folders" +.RS 0 +.IP \(bu 4 +\fB\fR +.RE 0 + +.P +This refers to a package on the local filesystem. Specifically this is a folder with a \fBpackage.json\fR file in it. This \fIshould\fR always be prefixed with a \fB/\fR or \fB./\fR (or your OS equivalent) to reduce confusion. npm currently will parse a string with more than one \fB/\fR in it as a folder, but this is legacy behavior that may be removed in a future version. +.P +Examples: +.RS 0 +.IP \(bu 4 +\fB./my-package\fR +.IP \(bu 4 +\fB/opt/npm/my-package\fR +.RE 0 + +.SS "Tarballs" +.RS 0 +.IP \(bu 4 +\fB\fR +.IP \(bu 4 +\fB\fR +.RE 0 + +.P +Examples: +.RS 0 +.IP \(bu 4 +\fB./my-package.tgz\fR +.IP \(bu 4 +\fBhttps://registry.npmjs.org/semver/-/semver-1.0.0.tgz\fR +.RE 0 + +.P +Refers to a package in a tarball format, either on the local filesystem or remotely via url. This is the format that packages exist in when uploaded to a registry. +.SS "git urls" +.RS 0 +.IP \(bu 4 +\fB\fR +.IP \(bu 4 +\fB/\fR +.RE 0 + +.P +Refers to a package in a git repo. This can be a full git url, git shorthand, or a username/package on GitHub. You can specify a git tag, branch, or other git ref by appending \fB#ref\fR. +.P +Examples: +.RS 0 +.IP \(bu 4 +\fBhttps://github.com/npm/cli.git\fR +.IP \(bu 4 +\fBgit@github.com:npm/cli.git\fR +.IP \(bu 4 +\fBgit+ssh://git@github.com/npm/cli#v6.0.0\fR +.IP \(bu 4 +\fBgithub:npm/cli#HEAD\fR +.IP \(bu 4 +\fBnpm/cli#c12ea07\fR +.RE 0 + +.SS "See also" +.RS 0 +.IP \(bu 4 +\fBnpm-package-arg\fR \fI\(lahttps://npm.im/npm-package-arg\(ra\fR +.IP \(bu 4 +npm help scope +.IP \(bu 4 +npm help config +.RE 0 diff --git a/node_modules/npm/man/man7/registry.7 b/node_modules/npm/man/man7/registry.7 new file mode 100644 index 00000000..82e7b3c7 --- /dev/null +++ b/node_modules/npm/man/man7/registry.7 @@ -0,0 +1,51 @@ +.TH "REGISTRY" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBregistry\fR - The JavaScript Package Registry +.SS "Description" +.P +To resolve packages by name and version, npm talks to a registry website that implements the CommonJS Package Registry specification for reading package info. +.P +npm is configured to use the \fBnpm public registry\fR at \fI\(lahttps://registry.npmjs.org\(ra\fR by default. Use of the npm public registry is subject to terms of use available at \fI\(lahttps://docs.npmjs.com/policies/terms\(ra\fR. +.P +You can configure npm to use any compatible registry you like, and even run your own registry. Use of someone else's registry may be governed by their terms of use. +.P +npm's package registry implementation supports several write APIs as well, to allow for publishing packages and managing user account information. +.P +The npm public registry is powered by a CouchDB database, of which there is a public mirror at \fI\(lahttps://skimdb.npmjs.com/registry\(ra\fR. +.P +The registry URL used is determined by the scope of the package (see npm help scope. If no scope is specified, the default registry is used, which is supplied by the \fB\fBregistry\fR config\fR \fI\(la/using-npm/config#registry\(ra\fR parameter. See npm help config, npm help npmrc, and npm help config for more on managing npm's configuration. Authentication configuration such as auth tokens and certificates are configured specifically scoped to an individual registry. See \fBAuth Related Configuration\fR \fI\(la/configuring-npm/npmrc#auth-related-configuration\(ra\fR +.P +When the default registry is used in a package-lock or shrinkwrap it has the special meaning of "the currently configured registry". If you create a lock file while using the default registry you can switch to another registry and npm will install packages from the new registry, but if you create a lock file while using a custom registry packages will be installed from that registry even after you change to another registry. +.SS "Does npm send any information about me back to the registry?" +.P +Yes. +.P +When making requests of the registry npm adds two headers with information about your environment: +.RS 0 +.IP \(bu 4 +\fBNpm-Scope\fR \[en] If your project is scoped, this header will contain its scope. In the future npm hopes to build registry features that use this information to allow you to customize your experience for your organization. +.IP \(bu 4 +\fBNpm-In-CI\fR \[en] Set to "true" if npm believes this install is running in a continuous integration environment, "false" otherwise. This is detected by looking for the following environment variables: \fBCI\fR, \fBTDDIUM\fR, \fBJENKINS_URL\fR, \fBbamboo.buildKey\fR. If you'd like to learn more you may find the \fBoriginal PR\fR \fI\(lahttps://github.com/npm/npm-registry-client/pull/129\(ra\fR interesting. This is used to gather better metrics on how npm is used by humans, versus build farms. +.RE 0 + +.P +The npm registry does not try to correlate the information in these headers with any authenticated accounts that may be used in the same requests. +.SS "How can I prevent my package from being published in the official registry?" +.P +Set \fB"private": true\fR in your \fBpackage.json\fR to prevent it from being published at all, or \fB"publishConfig":{"registry":"http://my-internal-registry.local"}\fR to force it to be published only to your internal/private registry. +.P +See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for more info on what goes in the package.json file. +.SS "Where can I find my (and others') published packages?" +.P +\fI\(lahttps://www.npmjs.com/\(ra\fR +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help config +.IP \(bu 4 +npm help npmrc +.IP \(bu 4 +npm help developers +.RE 0 diff --git a/node_modules/npm/man/man7/removal.7 b/node_modules/npm/man/man7/removal.7 new file mode 100644 index 00000000..f571d2a6 --- /dev/null +++ b/node_modules/npm/man/man7/removal.7 @@ -0,0 +1,54 @@ +.TH "REMOVAL" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBremoval\fR - Cleaning the Slate +.SS "Synopsis" +.P +So sad to see you go. +.P +.RS 2 +.nf +sudo npm uninstall npm -g +.fi +.RE +.P +Or, if that fails, please proceed to more severe uninstalling methods. +.SS "More Severe Uninstalling" +.P +Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you've installed. +.P +If that doesn't work, or if you require more drastic measures, continue reading. +.P +Note that this is only necessary for globally-installed packages. Local installs are completely contained within a project's \fBnode_modules\fR folder. Delete that folder, and everything is gone unless a package's install script is particularly ill-behaved. +.P +This assumes that you installed node and npm in the default place. If you configured node with a different \fB--prefix\fR, or installed npm with a different prefix setting, then adjust the paths accordingly, replacing \fB/usr/local\fR with your install prefix. +.P +To remove everything npm-related manually: +.P +.RS 2 +.nf +rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm* +.fi +.RE +.P +If you installed things \fIwith\fR npm, then your best bet is to uninstall them with npm first, and then install them again once you have a proper install. This can help find any symlinks that are lying around: +.P +.RS 2 +.nf +ls -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm +.fi +.RE +.P +Prior to version 0.3, npm used shim files for executables and node modules. To track those down, you can do the following: +.P +.RS 2 +.nf +find /usr/local/{lib/node,bin} -exec grep -l npm \[rs]{\[rs]} \[rs]; ; +.fi +.RE +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help uninstall +.IP \(bu 4 +npm help prune +.RE 0 diff --git a/node_modules/npm/man/man7/scope.7 b/node_modules/npm/man/man7/scope.7 new file mode 100644 index 00000000..f665aafe --- /dev/null +++ b/node_modules/npm/man/man7/scope.7 @@ -0,0 +1,113 @@ +.TH "SCOPE" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBscope\fR - Scoped packages +.SS "Description" +.P +All npm packages have a name. Some package names also have a scope. A scope follows the usual rules for package names (URL-safe characters, no leading dots or underscores). When used in package names, scopes are preceded by an \fB@\fR symbol and followed by a slash, e.g. +.P +.RS 2 +.nf +@somescope/somepackagename +.fi +.RE +.P +Scopes are a way of grouping related packages together, and also affect a few things about the way npm treats the package. +.P +Each npm user/organization has their own scope, and only you can add packages in your scope. This means you don't have to worry about someone taking your package name ahead of you. Thus it is also a good way to signal official packages for organizations. +.P +Scoped packages can be published and installed as of \fBnpm@2\fR and are supported by the primary npm registry. Unscoped packages can depend on scoped packages and vice versa. The npm client is backwards-compatible with unscoped registries, so it can be used to work with scoped and unscoped registries at the same time. +.SS "Installing scoped packages" +.P +Scoped packages are installed to a sub-folder of the regular installation folder, e.g. if your other packages are installed in \fBnode_modules/packagename\fR, scoped modules will be installed in \fBnode_modules/@myorg/packagename\fR. The scope folder (\fB@myorg\fR) is simply the name of the scope preceded by an \fB@\fR symbol, and can contain any number of scoped packages. +.P +A scoped package is installed by referencing it by name, preceded by an \fB@\fR symbol, in \fBnpm install\fR: +.P +.RS 2 +.nf +npm install @myorg/mypackage +.fi +.RE +.P +Or in \fBpackage.json\fR: +.P +.RS 2 +.nf +"dependencies": { + "@myorg/mypackage": "^1.3.0" +} +.fi +.RE +.P +Note that if the \fB@\fR symbol is omitted, in either case, npm will instead attempt to install from GitHub; see npm help install. +.SS "Requiring scoped packages" +.P +Because scoped packages are installed into a scope folder, you have to include the name of the scope when requiring them in your code, e.g. +.P +.RS 2 +.nf +require('@myorg/mypackage') +.fi +.RE +.P +There is nothing special about the way Node treats scope folders. This simply requires the \fBmypackage\fR module in the folder named \fB@myorg\fR. +.SS "Publishing scoped packages" +.P +Scoped packages can be published from the CLI as of \fBnpm@2\fR and can be published to any registry that supports them, including the primary npm registry. +.P +(As of 2015-04-19, and with npm 2.0 or better, the primary npm registry \fBdoes\fR support scoped packages.) +.P +If you wish, you may associate a scope with a registry; see below. +.SS "Publishing public scoped packages to the primary npm registry" +.P +Publishing to a scope, you have two options: +.RS 0 +.IP \(bu 4 +Publishing to your user scope (example: \fB@username/module\fR) +.IP \(bu 4 +Publishing to an organization scope (example: \fB@org/module\fR) +.RE 0 + +.P +If publishing a public module to an organization scope, you must first either create an organization with the name of the scope that you'd like to publish to or be added to an existing organization with the appropriate permissions. For example, if you'd like to publish to \fB@org\fR, you would need to create the \fBorg\fR organization on npmjs.com prior to trying to publish. +.P +Scoped packages are not public by default. You will need to specify \fB--access public\fR with the initial \fBnpm publish\fR command. This will publish the package and set access to \fBpublic\fR as if you had run \fBnpm access public\fR after publishing. You do not need to do this when publishing new versions of an existing scoped package. +.SS "Publishing private scoped packages to the npm registry" +.P +To publish a private scoped package to the npm registry, you must have an \fBnpm Private Modules\fR \fI\(lahttps://docs.npmjs.com/private-modules/intro\(ra\fR account. +.P +You can then publish the module with \fBnpm publish\fR or \fBnpm publish +--access restricted\fR, and it will be present in the npm registry, with restricted access. You can then change the access permissions, if desired, with \fBnpm access\fR or on the npmjs.com website. +.SS "Associating a scope with a registry" +.P +Scopes can be associated with a separate registry. This allows you to seamlessly use a mix of packages from the primary npm registry and one or more private registries, such as \fBGitHub Packages\fR \fI\(lahttps://github.com/features/packages\(ra\fR or the open source \fBVerdaccio\fR \fI\(lahttps://verdaccio.org\(ra\fR project. +.P +You can associate a scope with a registry at login, e.g. +.P +.RS 2 +.nf +npm login --registry=http://reg.example.com --scope=@myco +.fi +.RE +.P +Scopes have a many-to-one relationship with registries: one registry can host multiple scopes, but a scope only ever points to one registry. +.P +You can also associate a scope with a registry using \fBnpm config\fR: +.P +.RS 2 +.nf +npm config set @myco:registry=http://reg.example.com +.fi +.RE +.P +Once a scope is associated with a registry, any \fBnpm install\fR for a package with that scope will request packages from that registry instead. Any \fBnpm publish\fR for a package name that contains the scope will be published to that registry instead. +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help access +.IP \(bu 4 +npm help registry +.RE 0 diff --git a/node_modules/npm/man/man7/scripts.7 b/node_modules/npm/man/man7/scripts.7 new file mode 100644 index 00000000..e2846188 --- /dev/null +++ b/node_modules/npm/man/man7/scripts.7 @@ -0,0 +1,406 @@ +.TH "SCRIPTS" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBscripts\fR - How npm handles the "scripts" field +.SS "Description" +.P +The \fB"scripts"\fR property of your \fBpackage.json\fR file supports a number of built-in scripts and their preset life cycle events as well as arbitrary scripts. These all can be executed by running \fBnpm run-script \fR or \fBnpm run \fR for short. \fIPre\fR and \fIpost\fR commands with matching names will be run for those as well (e.g. \fBpremyscript\fR, \fBmyscript\fR, \fBpostmyscript\fR). Scripts from dependencies can be run with \fBnpm explore -- npm run \fR. +.SS "Pre & Post Scripts" +.P +To create "pre" or "post" scripts for any scripts defined in the \fB"scripts"\fR section of the \fBpackage.json\fR, simply create another script \fIwith a matching name\fR and add "pre" or "post" to the beginning of them. +.P +.RS 2 +.nf +{ + "scripts": { + "precompress": "{{ executes BEFORE the `compress` script }}", + "compress": "{{ run command to compress files }}", + "postcompress": "{{ executes AFTER `compress` script }}" + } +} +.fi +.RE +.P +In this example \fBnpm run compress\fR would execute these scripts as described. +.SS "Life Cycle Scripts" +.P +There are some special life cycle scripts that happen only in certain situations. These scripts happen in addition to the \fBpre\fR, \fBpost\fR, and \fB\fR scripts. +.RS 0 +.IP \(bu 4 +\fBprepare\fR, \fBprepublish\fR, \fBprepublishOnly\fR, \fBprepack\fR, \fBpostpack\fR, \fBdependencies\fR +.RE 0 + +.P +\fBprepare\fR (since \fBnpm@4.0.0\fR) +.RS 0 +.IP \(bu 4 +Runs BEFORE the package is packed, i.e. during \fBnpm publish\fR and \fBnpm pack\fR +.IP \(bu 4 +Runs on local \fBnpm install\fR without any arguments +.IP \(bu 4 +Runs AFTER \fBprepublish\fR, but BEFORE \fBprepublishOnly\fR +.IP \(bu 4 +NOTE: If a package being installed through git contains a \fBprepare\fR script, its \fBdependencies\fR and \fBdevDependencies\fR will be installed, and the prepare script will be run, before the package is packaged and installed. +.IP \(bu 4 +As of \fBnpm@7\fR these scripts run in the background. To see the output, run with: \fB--foreground-scripts\fR. +.RE 0 + +.P +\fBprepublish\fR (DEPRECATED) +.RS 0 +.IP \(bu 4 +Does not run during \fBnpm publish\fR, but does run during \fBnpm ci\fR and \fBnpm install\fR. See below for more info. +.RE 0 + +.P +\fBprepublishOnly\fR +.RS 0 +.IP \(bu 4 +Runs BEFORE the package is prepared and packed, ONLY on \fBnpm publish\fR. +.RE 0 + +.P +\fBprepack\fR +.RS 0 +.IP \(bu 4 +Runs BEFORE a tarball is packed (on "\fBnpm pack\fR", "\fBnpm publish\fR", and when installing a git dependency). +.IP \(bu 4 +NOTE: "\fBnpm run pack\fR" is NOT the same as "\fBnpm pack\fR". "\fBnpm run pack\fR" is an arbitrary user defined script name, where as, "\fBnpm pack\fR" is a CLI defined command. +.RE 0 + +.P +\fBpostpack\fR +.RS 0 +.IP \(bu 4 +Runs AFTER the tarball has been generated but before it is moved to its final destination (if at all, publish does not save the tarball locally) +.RE 0 + +.P +\fBdependencies\fR +.RS 0 +.IP \(bu 4 +Runs AFTER any operations that modify the \fBnode_modules\fR directory IF changes occurred. +.IP \(bu 4 +Does NOT run in global mode +.RE 0 + +.SS "Prepare and Prepublish" +.P +\fBDeprecation Note: prepublish\fR +.P +Since \fBnpm@1.1.71\fR, the npm CLI has run the \fBprepublish\fR script for both \fBnpm publish\fR and \fBnpm install\fR, because it's a convenient way to prepare a package for use (some common use cases are described in the section below). It has also turned out to be, in practice, \fBvery confusing\fR \fI\(lahttps://github.com/npm/npm/issues/10074\(ra\fR. As of \fBnpm@4.0.0\fR, a new event has been introduced, \fBprepare\fR, that preserves this existing behavior. A \fInew\fR event, \fBprepublishOnly\fR has been added as a transitional strategy to allow users to avoid the confusing behavior of existing npm versions and only run on \fBnpm publish\fR (for instance, running the tests one last time to ensure they're in good shape). +.P +See \fI\(lahttps://github.com/npm/npm/issues/10074\(ra\fR for a much lengthier justification, with further reading, for this change. +.P +\fBUse Cases\fR +.P +If you need to perform operations on your package before it is used, in a way that is not dependent on the operating system or architecture of the target system, use a \fBprepublish\fR script. This includes tasks such as: +.RS 0 +.IP \(bu 4 +Compiling CoffeeScript source code into JavaScript. +.IP \(bu 4 +Creating minified versions of JavaScript source code. +.IP \(bu 4 +Fetching remote resources that your package will use. +.RE 0 + +.P +The advantage of doing these things at \fBprepublish\fR time is that they can be done once, in a single place, thus reducing complexity and variability. Additionally, this means that: +.RS 0 +.IP \(bu 4 +You can depend on \fBcoffee-script\fR as a \fBdevDependency\fR, and thus your users don't need to have it installed. +.IP \(bu 4 +You don't need to include minifiers in your package, reducing the size for your users. +.IP \(bu 4 +You don't need to rely on your users having \fBcurl\fR or \fBwget\fR or other system tools on the target machines. +.RE 0 + +.SS "Dependencies" +.P +The \fBdependencies\fR script is run any time an \fBnpm\fR command causes changes to the \fBnode_modules\fR directory. It is run AFTER the changes have been applied and the \fBpackage.json\fR and \fBpackage-lock.json\fR files have been updated. +.SS "Life Cycle Operation Order" +.SS "npm help \"cache add\"" +.RS 0 +.IP \(bu 4 +\fBprepare\fR +.RE 0 + +.SS "npm help ci" +.RS 0 +.IP \(bu 4 +\fBpreinstall\fR +.IP \(bu 4 +\fBinstall\fR +.IP \(bu 4 +\fBpostinstall\fR +.IP \(bu 4 +\fBprepublish\fR +.IP \(bu 4 +\fBpreprepare\fR +.IP \(bu 4 +\fBprepare\fR +.IP \(bu 4 +\fBpostprepare\fR +.RE 0 + +.P +These all run after the actual installation of modules into \fBnode_modules\fR, in order, with no internal actions happening in between +.SS "npm help diff" +.RS 0 +.IP \(bu 4 +\fBprepare\fR +.RE 0 + +.SS "npm help install" +.P +These also run when you run \fBnpm install -g \fR +.RS 0 +.IP \(bu 4 +\fBpreinstall\fR +.IP \(bu 4 +\fBinstall\fR +.IP \(bu 4 +\fBpostinstall\fR +.IP \(bu 4 +\fBprepublish\fR +.IP \(bu 4 +\fBpreprepare\fR +.IP \(bu 4 +\fBprepare\fR +.IP \(bu 4 +\fBpostprepare\fR +.RE 0 + +.P +If there is a \fBbinding.gyp\fR file in the root of your package and you haven't defined your own \fBinstall\fR or \fBpreinstall\fR scripts, npm will default the \fBinstall\fR command to compile using node-gyp via \fBnode-gyp +rebuild\fR +.P +These are run from the scripts of \fB\fR +.SS "npm help pack" +.RS 0 +.IP \(bu 4 +\fBprepack\fR +.IP \(bu 4 +\fBprepare\fR +.IP \(bu 4 +\fBpostpack\fR +.RE 0 + +.SS "npm help publish" +.RS 0 +.IP \(bu 4 +\fBprepublishOnly\fR +.IP \(bu 4 +\fBprepack\fR +.IP \(bu 4 +\fBprepare\fR +.IP \(bu 4 +\fBpostpack\fR +.IP \(bu 4 +\fBpublish\fR +.IP \(bu 4 +\fBpostpublish\fR +.RE 0 + +.SS "npm help rebuild" +.RS 0 +.IP \(bu 4 +\fBpreinstall\fR +.IP \(bu 4 +\fBinstall\fR +.IP \(bu 4 +\fBpostinstall\fR +.IP \(bu 4 +\fBprepare\fR +.RE 0 + +.P +\fBprepare\fR is only run if the current directory is a symlink (e.g. with linked packages) +.SS "npm help restart" +.P +If there is a \fBrestart\fR script defined, these events are run, otherwise \fBstop\fR and \fBstart\fR are both run if present, including their \fBpre\fR and \fBpost\fR iterations) +.RS 0 +.IP \(bu 4 +\fBprerestart\fR +.IP \(bu 4 +\fBrestart\fR +.IP \(bu 4 +\fBpostrestart\fR +.RE 0 + +.SS "\fB\fBnpm run \fR\fR \fI\(la/commands/npm-run-script\(ra\fR" +.RS 0 +.IP \(bu 4 +\fBpre\fR +.IP \(bu 4 +\fB\fR +.IP \(bu 4 +\fBpost\fR +.RE 0 + +.SS "npm help start" +.RS 0 +.IP \(bu 4 +\fBprestart\fR +.IP \(bu 4 +\fBstart\fR +.IP \(bu 4 +\fBpoststart\fR +.RE 0 + +.P +If there is a \fBserver.js\fR file in the root of your package, then npm will default the \fBstart\fR command to \fBnode server.js\fR. \fBprestart\fR and \fBpoststart\fR will still run in this case. +.SS "npm help stop" +.RS 0 +.IP \(bu 4 +\fBprestop\fR +.IP \(bu 4 +\fBstop\fR +.IP \(bu 4 +\fBpoststop\fR +.RE 0 + +.SS "npm help test" +.RS 0 +.IP \(bu 4 +\fBpretest\fR +.IP \(bu 4 +\fBtest\fR +.IP \(bu 4 +\fBposttest\fR +.RE 0 + +.SS "npm help version" +.RS 0 +.IP \(bu 4 +\fBpreversion\fR +.IP \(bu 4 +\fBversion\fR +.IP \(bu 4 +\fBpostversion\fR +.RE 0 + +.SS "A Note on a lack of npm help uninstall scripts" +.P +While npm v6 had \fBuninstall\fR lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there's no clear way to currently give the script enough context to be useful. +.P +Reasons for a package removal include: +.RS 0 +.IP \(bu 4 +a user directly uninstalled this package +.IP \(bu 4 +a user uninstalled a dependant package and so this dependency is being uninstalled +.IP \(bu 4 +a user uninstalled a dependant package but another package also depends on this version +.IP \(bu 4 +this version has been merged as a duplicate with another version +.IP \(bu 4 +etc. +.RE 0 + +.P +Due to the lack of necessary context, \fBuninstall\fR lifecycle scripts are not implemented and will not function. +.SS "User" +.P +When npm is run as root, scripts are always run with the effective uid and gid of the working directory owner. +.SS "Environment" +.P +Package scripts run in an environment where many pieces of information are made available regarding the setup of npm and the current state of the process. +.SS "path" +.P +If you depend on modules that define executable scripts, like test suites, then those executables will be added to the \fBPATH\fR for executing the scripts. So, if your package.json has this: +.P +.RS 2 +.nf +{ + "name" : "foo", + "dependencies" : { + "bar" : "0.1.x" + }, + "scripts": { + "start" : "bar ./test" + } +} +.fi +.RE +.P +then you could run \fBnpm start\fR to execute the \fBbar\fR script, which is exported into the \fBnode_modules/.bin\fR directory on \fBnpm install\fR. +.SS "package.json vars" +.P +The package.json fields are tacked onto the \fBnpm_package_\fR prefix. So, for instance, if you had \fB{"name":"foo", "version":"1.2.5"}\fR in your package.json file, then your package scripts would have the \fBnpm_package_name\fR environment variable set to "foo", and the \fBnpm_package_version\fR set to "1.2.5". You can access these variables in your code with \fBprocess.env.npm_package_name\fR and \fBprocess.env.npm_package_version\fR, and so on for other fields. +.P +See \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for more on package configs. +.SS "current lifecycle event" +.P +Lastly, the \fBnpm_lifecycle_event\fR environment variable is set to whichever stage of the cycle is being executed. So, you could have a single script used for different parts of the process which switches based on what's currently happening. +.P +Objects are flattened following this format, so if you had \fB{"scripts":{"install":"foo.js"}}\fR in your package.json, then you'd see this in the script: +.P +.RS 2 +.nf +process.env.npm_package_scripts_install === "foo.js" +.fi +.RE +.SS "Examples" +.P +For example, if your package.json contains this: +.P +.RS 2 +.nf +{ + "scripts" : { + "install" : "scripts/install.js", + "postinstall" : "scripts/install.js" + } +} +.fi +.RE +.P +then \fBscripts/install.js\fR will be called for the install and post-install stages of the lifecycle. Since \fBscripts/install.js\fR is running for two different phases, it would be wise in this case to look at the \fBnpm_lifecycle_event\fR environment variable. +.P +If you want to run a make command, you can do so. This works just fine: +.P +.RS 2 +.nf +{ + "scripts" : { + "preinstall" : "./configure", + "install" : "make && make install", + "test" : "make test" + } +} +.fi +.RE +.SS "Exiting" +.P +Scripts are run by passing the line as a script argument to \fBsh\fR. +.P +If the script exits with a code other than 0, then this will abort the process. +.P +Note that these script files don't have to be Node.js or even JavaScript programs. They just have to be some kind of executable file. +.SS "Best Practices" +.RS 0 +.IP \(bu 4 +Don't exit with a non-zero error code unless you \fIreally\fR mean it. If the failure is minor or only will prevent some optional features, then it's better to just print a warning and exit successfully. +.IP \(bu 4 +Try not to use scripts to do what npm can do for you. Read through \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json\(ra\fR to see all the things that you can specify and enable by simply describing your package appropriately. In general, this will lead to a more robust and consistent state. +.IP \(bu 4 +Inspect the env to determine where to put things. For instance, if the \fBnpm_config_binroot\fR environment variable is set to \fB/home/user/bin\fR, then don't try to install executables into \fB/usr/local/bin\fR. The user probably set it up that way for a reason. +.IP \(bu 4 +Don't prefix your script commands with "sudo". If root permissions are required for some reason, then it'll fail with that error, and the user will sudo the npm command in question. +.IP \(bu 4 +Don't use \fBinstall\fR. Use a \fB.gyp\fR file for compilation, and \fBprepare\fR for anything else. You should almost never have to explicitly set a preinstall or install script. If you are doing this, please consider if there is another option. The only valid use of \fBinstall\fR or \fBpreinstall\fR scripts is for compilation which must be done on the target architecture. +.IP \(bu 4 +Scripts are run from the root of the package folder, regardless of what the current working directory is when \fBnpm\fR is invoked. If you want your script to use different behavior based on what subdirectory you're in, you can use the \fBINIT_CWD\fR environment variable, which holds the full path you were in when you ran \fBnpm run\fR. +.RE 0 + +.SS "See Also" +.RS 0 +.IP \(bu 4 +npm help run-script +.IP \(bu 4 +\fBpackage.json\fR \fI\(la/configuring-npm/package-json\(ra\fR +.IP \(bu 4 +npm help developers +.IP \(bu 4 +npm help install +.RE 0 diff --git a/node_modules/npm/man/man7/workspaces.7 b/node_modules/npm/man/man7/workspaces.7 new file mode 100644 index 00000000..c3cdec35 --- /dev/null +++ b/node_modules/npm/man/man7/workspaces.7 @@ -0,0 +1,214 @@ +.TH "WORKSPACES" "7" "December 2024" "NPM@11.0.0" "" +.SH "NAME" +\fBworkspaces\fR - Working with workspaces +.SS "Description" +.P +\fBWorkspaces\fR is a generic term that refers to the set of features in the npm cli that provides support for managing multiple packages from your local file system from within a singular top-level, root package. +.P +This set of features makes up for a much more streamlined workflow handling linked packages from the local file system. It automates the linking process as part of \fBnpm install\fR and removes the need to manually use \fBnpm link\fR in order to add references to packages that should be symlinked into the current \fBnode_modules\fR folder. +.P +We also refer to these packages being auto-symlinked during \fBnpm install\fR as a single \fBworkspace\fR, meaning it's a nested package within the current local file system that is explicitly defined in the \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json#workspaces\(ra\fR \fBworkspaces\fR configuration. +.SS "Defining workspaces" +.P +Workspaces are usually defined via the \fBworkspaces\fR property of the \fB\fBpackage.json\fR\fR \fI\(la/configuring-npm/package-json#workspaces\(ra\fR file, e.g: +.P +.RS 2 +.nf +{ + "name": "my-workspaces-powered-project", + "workspaces": \[lB] + "packages/a" + \[rB] +} +.fi +.RE +.P +Given the above \fBpackage.json\fR example living at a current working directory \fB.\fR that contains a folder named \fBpackages/a\fR that itself contains a \fBpackage.json\fR inside it, defining a Node.js package, e.g: +.P +.RS 2 +.nf +. ++-- package.json +`-- packages + +-- a + | `-- package.json +.fi +.RE +.P +The expected result once running \fBnpm install\fR in this current working directory \fB.\fR is that the folder \fBpackages/a\fR will get symlinked to the \fBnode_modules\fR folder of the current working dir. +.P +Below is a post \fBnpm install\fR example, given that same previous example structure of files and folders: +.P +.RS 2 +.nf +. ++-- node_modules +| `-- a -> ../packages/a ++-- package-lock.json ++-- package.json +`-- packages + +-- a + | `-- package.json +.fi +.RE +.SS "Getting started with workspaces" +.P +You may automate the required steps to define a new workspace using npm help init. For example in a project that already has a \fBpackage.json\fR defined you can run: +.P +.RS 2 +.nf +npm init -w ./packages/a +.fi +.RE +.P +This command will create the missing folders and a new \fBpackage.json\fR file (if needed) while also making sure to properly configure the \fB"workspaces"\fR property of your root project \fBpackage.json\fR. +.SS "Adding dependencies to a workspace" +.P +It's possible to directly add/remove/update dependencies of your workspaces using the \fB\fBworkspace\fR config\fR \fI\(la/using-npm/config#workspace\(ra\fR. +.P +For example, assuming the following structure: +.P +.RS 2 +.nf +. ++-- package.json +`-- packages + +-- a + | `-- package.json + `-- b + `-- package.json +.fi +.RE +.P +If you want to add a dependency named \fBabbrev\fR from the registry as a dependency of your workspace \fBa\fR, you may use the workspace config to tell the npm installer that package should be added as a dependency of the provided workspace: +.P +.RS 2 +.nf +npm install abbrev -w a +.fi +.RE +.P +Note: other installing commands such as \fBuninstall\fR, \fBci\fR, etc will also respect the provided \fBworkspace\fR configuration. +.SS "Using workspaces" +.P +Given the \fBspecifics of how Node.js handles module resolution\fR \fI\(lahttps://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_all_together\(ra\fR it's possible to consume any defined workspace by its declared \fBpackage.json\fR \fBname\fR. Continuing from the example defined above, let's also create a Node.js script that will require the workspace \fBa\fR example module, e.g: +.P +.RS 2 +.nf +// ./packages/a/index.js +module.exports = 'a' + +// ./lib/index.js +const moduleA = require('a') +console.log(moduleA) // -> a +.fi +.RE +.P +When running it with: +.P +\fBnode lib/index.js\fR +.P +This demonstrates how the nature of \fBnode_modules\fR resolution allows for \fBworkspaces\fR to enable a portable workflow for requiring each \fBworkspace\fR in such a way that is also easy to npm help publish these nested workspaces to be consumed elsewhere. +.SS "Running commands in the context of workspaces" +.P +You can use the \fBworkspace\fR configuration option to run commands in the context of a configured workspace. Additionally, if your current directory is in a workspace, the \fBworkspace\fR configuration is implicitly set, and \fBprefix\fR is set to the root workspace. +.P +Following is a quick example on how to use the \fBnpm run\fR command in the context of nested workspaces. For a project containing multiple workspaces, e.g: +.P +.RS 2 +.nf +. ++-- package.json +`-- packages + +-- a + | `-- package.json + `-- b + `-- package.json +.fi +.RE +.P +By running a command using the \fBworkspace\fR option, it's possible to run the given command in the context of that specific workspace. e.g: +.P +.RS 2 +.nf +npm run test --workspace=a +.fi +.RE +.P +You could also run the command within the workspace. +.P +.RS 2 +.nf +cd packages/a && npm run test +.fi +.RE +.P +Either will run the \fBtest\fR script defined within the \fB./packages/a/package.json\fR file. +.P +Please note that you can also specify this argument multiple times in the command-line in order to target multiple workspaces, e.g: +.P +.RS 2 +.nf +npm run test --workspace=a --workspace=b +.fi +.RE +.P +Or run the command for each workspace within the 'packages' folder: +.P +.RS 2 +.nf +npm run test --workspace=packages +.fi +.RE +.P +It's also possible to use the \fBworkspaces\fR (plural) configuration option to enable the same behavior but running that command in the context of \fBall\fR configured workspaces. e.g: +.P +.RS 2 +.nf +npm run test --workspaces +.fi +.RE +.P +Will run the \fBtest\fR script in both \fB./packages/a\fR and \fB./packages/b\fR. +.P +Commands will be run in each workspace in the order they appear in your \fBpackage.json\fR +.P +.RS 2 +.nf +{ + "workspaces": \[lB] "packages/a", "packages/b" \[rB] +} +.fi +.RE +.P +Order of run is different with: +.P +.RS 2 +.nf +{ + "workspaces": \[lB] "packages/b", "packages/a" \[rB] +} +.fi +.RE +.SS "Ignoring missing scripts" +.P +It is not required for all of the workspaces to implement scripts run with the \fBnpm run\fR command. +.P +By running the command with the \fB--if-present\fR flag, npm will ignore workspaces missing target script. +.P +.RS 2 +.nf +npm run test --workspaces --if-present +.fi +.RE +.SS "See also" +.RS 0 +.IP \(bu 4 +npm help install +.IP \(bu 4 +npm help publish +.IP \(bu 4 +npm help run-script +.IP \(bu 4 +npm help config +.RE 0 diff --git a/node_modules/npm/node_modules/@isaacs/cliui/LICENSE.txt b/node_modules/npm/node_modules/@isaacs/cliui/LICENSE.txt new file mode 100644 index 00000000..c7e27478 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/LICENSE.txt @@ -0,0 +1,14 @@ +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/npm/node_modules/@isaacs/cliui/build/index.cjs b/node_modules/npm/node_modules/@isaacs/cliui/build/index.cjs new file mode 100644 index 00000000..aca2b850 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/build/index.cjs @@ -0,0 +1,317 @@ +'use strict'; + +const align = { + right: alignRight, + center: alignCenter +}; +const top = 0; +const right = 1; +const bottom = 2; +const left = 3; +class UI { + constructor(opts) { + var _a; + this.width = opts.width; + /* c8 ignore start */ + this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true; + /* c8 ignore stop */ + this.rows = []; + } + span(...args) { + const cols = this.div(...args); + cols.span = true; + } + resetOutput() { + this.rows = []; + } + div(...args) { + if (args.length === 0) { + this.div(''); + } + if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') { + return this.applyLayoutDSL(args[0]); + } + const cols = args.map(arg => { + if (typeof arg === 'string') { + return this.colFromString(arg); + } + return arg; + }); + this.rows.push(cols); + return cols; + } + shouldApplyLayoutDSL(...args) { + return args.length === 1 && typeof args[0] === 'string' && + /[\t\n]/.test(args[0]); + } + applyLayoutDSL(str) { + const rows = str.split('\n').map(row => row.split('\t')); + let leftColumnWidth = 0; + // simple heuristic for layout, make sure the + // second column lines up along the left-hand. + // don't allow the first column to take up more + // than 50% of the screen. + rows.forEach(columns => { + if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) { + leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0])); + } + }); + // generate a table: + // replacing ' ' with padding calculations. + // using the algorithmically generated width. + rows.forEach(columns => { + this.div(...columns.map((r, i) => { + return { + text: r.trim(), + padding: this.measurePadding(r), + width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined + }; + })); + }); + return this.rows[this.rows.length - 1]; + } + colFromString(text) { + return { + text, + padding: this.measurePadding(text) + }; + } + measurePadding(str) { + // measure padding without ansi escape codes + const noAnsi = mixin.stripAnsi(str); + return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]; + } + toString() { + const lines = []; + this.rows.forEach(row => { + this.rowToString(row, lines); + }); + // don't display any lines with the + // hidden flag set. + return lines + .filter(line => !line.hidden) + .map(line => line.text) + .join('\n'); + } + rowToString(row, lines) { + this.rasterize(row).forEach((rrow, r) => { + let str = ''; + rrow.forEach((col, c) => { + const { width } = row[c]; // the width with padding. + const wrapWidth = this.negatePadding(row[c]); // the width without padding. + let ts = col; // temporary string used during alignment/padding. + if (wrapWidth > mixin.stringWidth(col)) { + ts += ' '.repeat(wrapWidth - mixin.stringWidth(col)); + } + // align the string within its column. + if (row[c].align && row[c].align !== 'left' && this.wrap) { + const fn = align[row[c].align]; + ts = fn(ts, wrapWidth); + if (mixin.stringWidth(ts) < wrapWidth) { + /* c8 ignore start */ + const w = width || 0; + /* c8 ignore stop */ + ts += ' '.repeat(w - mixin.stringWidth(ts) - 1); + } + } + // apply border and padding to string. + const padding = row[c].padding || [0, 0, 0, 0]; + if (padding[left]) { + str += ' '.repeat(padding[left]); + } + str += addBorder(row[c], ts, '| '); + str += ts; + str += addBorder(row[c], ts, ' |'); + if (padding[right]) { + str += ' '.repeat(padding[right]); + } + // if prior row is span, try to render the + // current row on the prior line. + if (r === 0 && lines.length > 0) { + str = this.renderInline(str, lines[lines.length - 1]); + } + }); + // remove trailing whitespace. + lines.push({ + text: str.replace(/ +$/, ''), + span: row.span + }); + }); + return lines; + } + // if the full 'source' can render in + // the target line, do so. + renderInline(source, previousLine) { + const match = source.match(/^ */); + /* c8 ignore start */ + const leadingWhitespace = match ? match[0].length : 0; + /* c8 ignore stop */ + const target = previousLine.text; + const targetTextWidth = mixin.stringWidth(target.trimEnd()); + if (!previousLine.span) { + return source; + } + // if we're not applying wrapping logic, + // just always append to the span. + if (!this.wrap) { + previousLine.hidden = true; + return target + source; + } + if (leadingWhitespace < targetTextWidth) { + return source; + } + previousLine.hidden = true; + return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart(); + } + rasterize(row) { + const rrows = []; + const widths = this.columnWidths(row); + let wrapped; + // word wrap all columns, and create + // a data-structure that is easy to rasterize. + row.forEach((col, c) => { + // leave room for left and right padding. + col.width = widths[c]; + if (this.wrap) { + wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n'); + } + else { + wrapped = col.text.split('\n'); + } + if (col.border) { + wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.'); + wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'"); + } + // add top and bottom padding. + if (col.padding) { + wrapped.unshift(...new Array(col.padding[top] || 0).fill('')); + wrapped.push(...new Array(col.padding[bottom] || 0).fill('')); + } + wrapped.forEach((str, r) => { + if (!rrows[r]) { + rrows.push([]); + } + const rrow = rrows[r]; + for (let i = 0; i < c; i++) { + if (rrow[i] === undefined) { + rrow.push(''); + } + } + rrow.push(str); + }); + }); + return rrows; + } + negatePadding(col) { + /* c8 ignore start */ + let wrapWidth = col.width || 0; + /* c8 ignore stop */ + if (col.padding) { + wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0); + } + if (col.border) { + wrapWidth -= 4; + } + return wrapWidth; + } + columnWidths(row) { + if (!this.wrap) { + return row.map(col => { + return col.width || mixin.stringWidth(col.text); + }); + } + let unset = row.length; + let remainingWidth = this.width; + // column widths can be set in config. + const widths = row.map(col => { + if (col.width) { + unset--; + remainingWidth -= col.width; + return col.width; + } + return undefined; + }); + // any unset widths should be calculated. + /* c8 ignore start */ + const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0; + /* c8 ignore stop */ + return widths.map((w, i) => { + if (w === undefined) { + return Math.max(unsetWidth, _minWidth(row[i])); + } + return w; + }); + } +} +function addBorder(col, ts, style) { + if (col.border) { + if (/[.']-+[.']/.test(ts)) { + return ''; + } + if (ts.trim().length !== 0) { + return style; + } + return ' '; + } + return ''; +} +// calculates the minimum width of +// a column, based on padding preferences. +function _minWidth(col) { + const padding = col.padding || []; + const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0); + if (col.border) { + return minWidth + 4; + } + return minWidth; +} +function getWindowWidth() { + /* c8 ignore start */ + if (typeof process === 'object' && process.stdout && process.stdout.columns) { + return process.stdout.columns; + } + return 80; +} +/* c8 ignore stop */ +function alignRight(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + if (strWidth < width) { + return ' '.repeat(width - strWidth) + str; + } + return str; +} +function alignCenter(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + /* c8 ignore start */ + if (strWidth >= width) { + return str; + } + /* c8 ignore stop */ + return ' '.repeat((width - strWidth) >> 1) + str; +} +let mixin; +function cliui(opts, _mixin) { + mixin = _mixin; + return new UI({ + /* c8 ignore start */ + width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(), + wrap: opts === null || opts === void 0 ? void 0 : opts.wrap + /* c8 ignore stop */ + }); +} + +// Bootstrap cliui with CommonJS dependencies: +const stringWidth = require('string-width-cjs'); +const stripAnsi = require('strip-ansi-cjs'); +const wrap = require('wrap-ansi-cjs'); +function ui(opts) { + return cliui(opts, { + stringWidth, + stripAnsi, + wrap + }); +} + +module.exports = ui; diff --git a/node_modules/npm/node_modules/@isaacs/cliui/build/index.d.cts b/node_modules/npm/node_modules/@isaacs/cliui/build/index.d.cts new file mode 100644 index 00000000..4567f945 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/build/index.d.cts @@ -0,0 +1,43 @@ +interface UIOptions { + width: number; + wrap?: boolean; + rows?: string[]; +} +interface Column { + text: string; + width?: number; + align?: "right" | "left" | "center"; + padding: number[]; + border?: boolean; +} +interface ColumnArray extends Array { + span: boolean; +} +interface Line { + hidden?: boolean; + text: string; + span?: boolean; +} +declare class UI { + width: number; + wrap: boolean; + rows: ColumnArray[]; + constructor(opts: UIOptions); + span(...args: ColumnArray): void; + resetOutput(): void; + div(...args: (Column | string)[]): ColumnArray; + private shouldApplyLayoutDSL; + private applyLayoutDSL; + private colFromString; + private measurePadding; + toString(): string; + rowToString(row: ColumnArray, lines: Line[]): Line[]; + // if the full 'source' can render in + // the target line, do so. + private renderInline; + private rasterize; + private negatePadding; + private columnWidths; +} +declare function ui(opts: UIOptions): UI; +export { ui as default }; diff --git a/node_modules/npm/node_modules/@isaacs/cliui/build/lib/index.js b/node_modules/npm/node_modules/@isaacs/cliui/build/lib/index.js new file mode 100644 index 00000000..587b5ecd --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/build/lib/index.js @@ -0,0 +1,302 @@ +'use strict'; +const align = { + right: alignRight, + center: alignCenter +}; +const top = 0; +const right = 1; +const bottom = 2; +const left = 3; +export class UI { + constructor(opts) { + var _a; + this.width = opts.width; + /* c8 ignore start */ + this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true; + /* c8 ignore stop */ + this.rows = []; + } + span(...args) { + const cols = this.div(...args); + cols.span = true; + } + resetOutput() { + this.rows = []; + } + div(...args) { + if (args.length === 0) { + this.div(''); + } + if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === 'string') { + return this.applyLayoutDSL(args[0]); + } + const cols = args.map(arg => { + if (typeof arg === 'string') { + return this.colFromString(arg); + } + return arg; + }); + this.rows.push(cols); + return cols; + } + shouldApplyLayoutDSL(...args) { + return args.length === 1 && typeof args[0] === 'string' && + /[\t\n]/.test(args[0]); + } + applyLayoutDSL(str) { + const rows = str.split('\n').map(row => row.split('\t')); + let leftColumnWidth = 0; + // simple heuristic for layout, make sure the + // second column lines up along the left-hand. + // don't allow the first column to take up more + // than 50% of the screen. + rows.forEach(columns => { + if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) { + leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0])); + } + }); + // generate a table: + // replacing ' ' with padding calculations. + // using the algorithmically generated width. + rows.forEach(columns => { + this.div(...columns.map((r, i) => { + return { + text: r.trim(), + padding: this.measurePadding(r), + width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined + }; + })); + }); + return this.rows[this.rows.length - 1]; + } + colFromString(text) { + return { + text, + padding: this.measurePadding(text) + }; + } + measurePadding(str) { + // measure padding without ansi escape codes + const noAnsi = mixin.stripAnsi(str); + return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]; + } + toString() { + const lines = []; + this.rows.forEach(row => { + this.rowToString(row, lines); + }); + // don't display any lines with the + // hidden flag set. + return lines + .filter(line => !line.hidden) + .map(line => line.text) + .join('\n'); + } + rowToString(row, lines) { + this.rasterize(row).forEach((rrow, r) => { + let str = ''; + rrow.forEach((col, c) => { + const { width } = row[c]; // the width with padding. + const wrapWidth = this.negatePadding(row[c]); // the width without padding. + let ts = col; // temporary string used during alignment/padding. + if (wrapWidth > mixin.stringWidth(col)) { + ts += ' '.repeat(wrapWidth - mixin.stringWidth(col)); + } + // align the string within its column. + if (row[c].align && row[c].align !== 'left' && this.wrap) { + const fn = align[row[c].align]; + ts = fn(ts, wrapWidth); + if (mixin.stringWidth(ts) < wrapWidth) { + /* c8 ignore start */ + const w = width || 0; + /* c8 ignore stop */ + ts += ' '.repeat(w - mixin.stringWidth(ts) - 1); + } + } + // apply border and padding to string. + const padding = row[c].padding || [0, 0, 0, 0]; + if (padding[left]) { + str += ' '.repeat(padding[left]); + } + str += addBorder(row[c], ts, '| '); + str += ts; + str += addBorder(row[c], ts, ' |'); + if (padding[right]) { + str += ' '.repeat(padding[right]); + } + // if prior row is span, try to render the + // current row on the prior line. + if (r === 0 && lines.length > 0) { + str = this.renderInline(str, lines[lines.length - 1]); + } + }); + // remove trailing whitespace. + lines.push({ + text: str.replace(/ +$/, ''), + span: row.span + }); + }); + return lines; + } + // if the full 'source' can render in + // the target line, do so. + renderInline(source, previousLine) { + const match = source.match(/^ */); + /* c8 ignore start */ + const leadingWhitespace = match ? match[0].length : 0; + /* c8 ignore stop */ + const target = previousLine.text; + const targetTextWidth = mixin.stringWidth(target.trimEnd()); + if (!previousLine.span) { + return source; + } + // if we're not applying wrapping logic, + // just always append to the span. + if (!this.wrap) { + previousLine.hidden = true; + return target + source; + } + if (leadingWhitespace < targetTextWidth) { + return source; + } + previousLine.hidden = true; + return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart(); + } + rasterize(row) { + const rrows = []; + const widths = this.columnWidths(row); + let wrapped; + // word wrap all columns, and create + // a data-structure that is easy to rasterize. + row.forEach((col, c) => { + // leave room for left and right padding. + col.width = widths[c]; + if (this.wrap) { + wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split('\n'); + } + else { + wrapped = col.text.split('\n'); + } + if (col.border) { + wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.'); + wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'"); + } + // add top and bottom padding. + if (col.padding) { + wrapped.unshift(...new Array(col.padding[top] || 0).fill('')); + wrapped.push(...new Array(col.padding[bottom] || 0).fill('')); + } + wrapped.forEach((str, r) => { + if (!rrows[r]) { + rrows.push([]); + } + const rrow = rrows[r]; + for (let i = 0; i < c; i++) { + if (rrow[i] === undefined) { + rrow.push(''); + } + } + rrow.push(str); + }); + }); + return rrows; + } + negatePadding(col) { + /* c8 ignore start */ + let wrapWidth = col.width || 0; + /* c8 ignore stop */ + if (col.padding) { + wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0); + } + if (col.border) { + wrapWidth -= 4; + } + return wrapWidth; + } + columnWidths(row) { + if (!this.wrap) { + return row.map(col => { + return col.width || mixin.stringWidth(col.text); + }); + } + let unset = row.length; + let remainingWidth = this.width; + // column widths can be set in config. + const widths = row.map(col => { + if (col.width) { + unset--; + remainingWidth -= col.width; + return col.width; + } + return undefined; + }); + // any unset widths should be calculated. + /* c8 ignore start */ + const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0; + /* c8 ignore stop */ + return widths.map((w, i) => { + if (w === undefined) { + return Math.max(unsetWidth, _minWidth(row[i])); + } + return w; + }); + } +} +function addBorder(col, ts, style) { + if (col.border) { + if (/[.']-+[.']/.test(ts)) { + return ''; + } + if (ts.trim().length !== 0) { + return style; + } + return ' '; + } + return ''; +} +// calculates the minimum width of +// a column, based on padding preferences. +function _minWidth(col) { + const padding = col.padding || []; + const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0); + if (col.border) { + return minWidth + 4; + } + return minWidth; +} +function getWindowWidth() { + /* c8 ignore start */ + if (typeof process === 'object' && process.stdout && process.stdout.columns) { + return process.stdout.columns; + } + return 80; +} +/* c8 ignore stop */ +function alignRight(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + if (strWidth < width) { + return ' '.repeat(width - strWidth) + str; + } + return str; +} +function alignCenter(str, width) { + str = str.trim(); + const strWidth = mixin.stringWidth(str); + /* c8 ignore start */ + if (strWidth >= width) { + return str; + } + /* c8 ignore stop */ + return ' '.repeat((width - strWidth) >> 1) + str; +} +let mixin; +export function cliui(opts, _mixin) { + mixin = _mixin; + return new UI({ + /* c8 ignore start */ + width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(), + wrap: opts === null || opts === void 0 ? void 0 : opts.wrap + /* c8 ignore stop */ + }); +} diff --git a/node_modules/npm/node_modules/@isaacs/cliui/index.mjs b/node_modules/npm/node_modules/@isaacs/cliui/index.mjs new file mode 100644 index 00000000..5177519a --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/index.mjs @@ -0,0 +1,14 @@ +// Bootstrap cliui with ESM dependencies: +import { cliui } from './build/lib/index.js' + +import stringWidth from 'string-width' +import stripAnsi from 'strip-ansi' +import wrap from 'wrap-ansi' + +export default function ui (opts) { + return cliui(opts, { + stringWidth, + stripAnsi, + wrap + }) +} diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/index.js b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/index.js new file mode 100644 index 00000000..ddfdba39 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +export default function ansiRegex({onlyFirst = false} = {}) { + // Valid string terminator sequences are BEL, ESC\, and 0x9c + const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)'; + const pattern = [ + `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))', + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +} diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/license b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/package.json b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/package.json new file mode 100644 index 00000000..49f3f610 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/package.json @@ -0,0 +1,61 @@ +{ + "name": "ansi-regex", + "version": "6.1.0", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "funding": "https://github.com/chalk/ansi-regex?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "types": "./index.d.ts", + "sideEffects": false, + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "ansi-escapes": "^5.0.0", + "ava": "^3.15.0", + "tsd": "^0.21.0", + "xo": "^0.54.2" + } +} diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/LICENSE-MIT.txt b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/LICENSE-MIT.txt new file mode 100644 index 00000000..a41e0a7e --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +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/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/RGI_Emoji.js b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/RGI_Emoji.js new file mode 100644 index 00000000..3fbe9241 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/RGI_Emoji.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uD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u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\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uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]/g; +}; diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/RGI_Emoji.js b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/RGI_Emoji.js new file mode 100644 index 00000000..ecf32f17 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/RGI_Emoji.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074}|\u{E0065}\u{E006E}\u{E0067})\u{E007F}|(?:\u{1F9D1}\u{1F3FF}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FE}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FD}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FB}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FC}-\u{1F3FF}]|\u{1F468}(?:\u{1F3FB}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]))?|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC})?|(?:\u{1F469}(?:\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}]))|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]\u200D\u{1F91D}\u200D\u{1F9D1})[\u{1F3FB}-\u{1F3FF}]|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F469}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1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|\u{1F9D1}(?:\u200D(?:\u{1F91D}\u200D\u{1F9D1}|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F9D1}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F636}\u200D\u{1F32B}|\u{1F3F3}\uFE0F\u200D\u26A7|\u{1F43B}\u200D\u2744|(?:[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u{1F3F4}\u200D\u2620|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F202}\u{1F237}\u{1F321}\u{1F324}-\u{1F32C}\u{1F336}\u{1F37D}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}\u{1F39F}\u{1F3CD}\u{1F3CE}\u{1F3D4}-\u{1F3DF}\u{1F3F5}\u{1F3F7}\u{1F43F}\u{1F4FD}\u{1F549}\u{1F54A}\u{1F56F}\u{1F570}\u{1F573}\u{1F576}-\u{1F579}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1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\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270C\u270D\u{1F574}\u{1F590}][\uFE0F\u{1F3FB}-\u{1F3FF}]|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F408}\u{1F415}\u{1F43B}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F62E}\u{1F635}\u{1F636}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F384}\u{1F386}-\u{1F393}\u{1F3A0}-\u{1F3C1}\u{1F3C5}\u{1F3C6}\u{1F3C8}\u{1F3C9}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F8}-\u{1F407}\u{1F409}-\u{1F414}\u{1F416}-\u{1F43A}\u{1F43C}-\u{1F43E}\u{1F440}\u{1F444}\u{1F445}\u{1F451}-\u{1F465}\u{1F46A}\u{1F479}-\u{1F47B}\u{1F47D}-\u{1F480}\u{1F484}\u{1F488}-\u{1F48E}\u{1F490}\u{1F492}-\u{1F4A9}\u{1F4AB}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F5A4}\u{1F5FB}-\u{1F62D}\u{1F62F}-\u{1F634}\u{1F637}-\u{1F644}\u{1F648}-\u{1F64A}\u{1F680}-\u{1F6A2}\u{1F6A4}-\u{1F6B3}\u{1F6B7}-\u{1F6BF}\u{1F6C1}-\u{1F6C5}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90D}\u{1F90E}\u{1F910}-\u{1F917}\u{1F91D}\u{1F920}-\u{1F925}\u{1F927}-\u{1F92F}\u{1F93A}\u{1F93F}-\u{1F945}\u{1F947}-\u{1F976}\u{1F978}\u{1F97A}-\u{1F9B4}\u{1F9B7}\u{1F9BA}\u{1F9BC}-\u{1F9CB}\u{1F9D0}\u{1F9E0}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]/gu; +}; diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/index.js b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/index.js new file mode 100644 index 00000000..1a4fc8d0 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074}|\u{E0065}\u{E006E}\u{E0067})\u{E007F}|(?:\u{1F9D1}\u{1F3FF}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FE}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FD}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FB}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FC}-\u{1F3FF}]|\u{1F468}(?:\u{1F3FB}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]))?|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC})?|(?:\u{1F469}(?:\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}]))|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]\u200D\u{1F91D}\u200D\u{1F9D1})[\u{1F3FB}-\u{1F3FF}]|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F469}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[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BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F9D1}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F636}\u200D\u{1F32B}|\u{1F3F3}\uFE0F\u200D\u26A7|\u{1F43B}\u200D\u2744|(?:[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u{1F3F4}\u200D\u2620|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299\u{1F170}\u{1F171}\u{1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FF}]|\u{1F3F4}|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270C\u270D\u{1F574}\u{1F590}][\uFE0F\u{1F3FB}-\u{1F3FF}]|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F408}\u{1F415}\u{1F43B}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F62E}\u{1F635}\u{1F636}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F384}\u{1F386}-\u{1F393}\u{1F3A0}-\u{1F3C1}\u{1F3C5}\u{1F3C6}\u{1F3C8}\u{1F3C9}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F8}-\u{1F407}\u{1F409}-\u{1F414}\u{1F416}-\u{1F43A}\u{1F43C}-\u{1F43E}\u{1F440}\u{1F444}\u{1F445}\u{1F451}-\u{1F465}\u{1F46A}\u{1F479}-\u{1F47B}\u{1F47D}-\u{1F480}\u{1F484}\u{1F488}-\u{1F48E}\u{1F490}\u{1F492}-\u{1F4A9}\u{1F4AB}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F5A4}\u{1F5FB}-\u{1F62D}\u{1F62F}-\u{1F634}\u{1F637}-\u{1F644}\u{1F648}-\u{1F64A}\u{1F680}-\u{1F6A2}\u{1F6A4}-\u{1F6B3}\u{1F6B7}-\u{1F6BF}\u{1F6C1}-\u{1F6C5}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90D}\u{1F90E}\u{1F910}-\u{1F917}\u{1F91D}\u{1F920}-\u{1F925}\u{1F927}-\u{1F92F}\u{1F93A}\u{1F93F}-\u{1F945}\u{1F947}-\u{1F976}\u{1F978}\u{1F97A}-\u{1F9B4}\u{1F9B7}\u{1F9BA}\u{1F9BC}-\u{1F9CB}\u{1F9D0}\u{1F9E0}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90C}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F978}\u{1F97A}-\u{1F9CB}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90C}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F978}\u{1F97A}-\u{1F9CB}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]\uFE0F|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; +}; diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/text.js b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/text.js new file mode 100644 index 00000000..8e9f9857 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074}|\u{E0065}\u{E006E}\u{E0067})\u{E007F}|(?:\u{1F9D1}\u{1F3FF}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FE}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FD}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FB}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FC}-\u{1F3FF}]|\u{1F468}(?:\u{1F3FB}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]))?|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC})?|(?:\u{1F469}(?:\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}]))|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]\u200D\u{1F91D}\u200D\u{1F9D1})[\u{1F3FB}-\u{1F3FF}]|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F469}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u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u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F9D1}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F636}\u200D\u{1F32B}|\u{1F3F3}\uFE0F\u200D\u26A7|\u{1F43B}\u200D\u2744|(?:[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u{1F3F4}\u200D\u2620|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F202}\u{1F237}\u{1F321}\u{1F324}-\u{1F32C}\u{1F336}\u{1F37D}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}\u{1F39F}\u{1F3CD}\u{1F3CE}\u{1F3D4}-\u{1F3DF}\u{1F3F5}\u{1F3F7}\u{1F43F}\u{1F4FD}\u{1F549}\u{1F54A}\u{1F56F}\u{1F570}\u{1F573}\u{1F576}-\u{1F579}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}\u{1F6CB}\u{1F6CD}-\u{1F6CF}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6F0}\u{1F6F3}])\uFE0F|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F469}\u200D\u{1F467}|\u{1F469}\u200D\u{1F466}|\u{1F635}\u200D\u{1F4AB}|\u{1F62E}\u200D\u{1F4A8}|\u{1F415}\u200D\u{1F9BA}|\u{1F9D1}(?:\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC}|\u{1F3FB})?|\u{1F469}(?:\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC}|\u{1F3FB})?|\u{1F1FD}\u{1F1F0}|\u{1F1F6}\u{1F1E6}|\u{1F1F4}\u{1F1F2}|\u{1F408}\u200D\u2B1B|\u2764\uFE0F\u200D[\u{1F525}\u{1FA79}]|\u{1F441}\uFE0F|\u{1F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\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]|\u{1F3F4}|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270C\u270D\u{1F574}\u{1F590}][\uFE0F\u{1F3FB}-\u{1F3FF}]|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F408}\u{1F415}\u{1F43B}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F62E}\u{1F635}\u{1F636}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F384}\u{1F386}-\u{1F393}\u{1F3A0}-\u{1F3C1}\u{1F3C5}\u{1F3C6}\u{1F3C8}\u{1F3C9}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F8}-\u{1F407}\u{1F409}-\u{1F414}\u{1F416}-\u{1F43A}\u{1F43C}-\u{1F43E}\u{1F440}\u{1F444}\u{1F445}\u{1F451}-\u{1F465}\u{1F46A}\u{1F479}-\u{1F47B}\u{1F47D}-\u{1F480}\u{1F484}\u{1F488}-\u{1F48E}\u{1F490}\u{1F492}-\u{1F4A9}\u{1F4AB}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F5A4}\u{1F5FB}-\u{1F62D}\u{1F62F}-\u{1F634}\u{1F637}-\u{1F644}\u{1F648}-\u{1F64A}\u{1F680}-\u{1F6A2}\u{1F6A4}-\u{1F6B3}\u{1F6B7}-\u{1F6BF}\u{1F6C1}-\u{1F6C5}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90D}\u{1F90E}\u{1F910}-\u{1F917}\u{1F91D}\u{1F920}-\u{1F925}\u{1F927}-\u{1F92F}\u{1F93A}\u{1F93F}-\u{1F945}\u{1F947}-\u{1F976}\u{1F978}\u{1F97A}-\u{1F9B4}\u{1F9B7}\u{1F9BA}\u{1F9BC}-\u{1F9CB}\u{1F9D0}\u{1F9E0}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90C}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F978}\u{1F97A}-\u{1F9CB}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]\uFE0F?/gu; +}; diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/index.js b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/index.js new file mode 100644 index 00000000..c0490d4c --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC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92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD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\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; +}; diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/package.json b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/package.json new file mode 100644 index 00000000..eac892a1 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/package.json @@ -0,0 +1,52 @@ +{ + "name": "emoji-regex", + "version": "9.2.2", + "description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.", + "homepage": "https://mths.be/emoji-regex", + "main": "index.js", + "types": "index.d.ts", + "keywords": [ + "unicode", + "regex", + "regexp", + "regular expressions", + "code points", + "symbols", + "characters", + "emoji" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "repository": { + "type": "git", + "url": "https://github.com/mathiasbynens/emoji-regex.git" + }, + "bugs": "https://github.com/mathiasbynens/emoji-regex/issues", + "files": [ + "LICENSE-MIT.txt", + "index.js", + "index.d.ts", + "RGI_Emoji.js", + "RGI_Emoji.d.ts", + "text.js", + "text.d.ts", + "es2015" + ], + "scripts": { + "build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src es2015_types -D -d ./es2015; node script/inject-sequences.js", + "test": "mocha", + "test:watch": "npm run test -- --watch" + }, + "devDependencies": { + "@babel/cli": "^7.4.4", + "@babel/core": "^7.4.4", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/preset-env": "^7.4.4", + "@unicode/unicode-13.0.0": "^1.0.3", + "mocha": "^6.1.4", + "regexgen": "^1.3.0" + } +} diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/text.js b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/text.js new file mode 100644 index 00000000..9bc63ce7 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\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BB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD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DC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F?/g; +}; diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/index.js b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/index.js new file mode 100644 index 00000000..9294488f --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/index.js @@ -0,0 +1,54 @@ +import stripAnsi from 'strip-ansi'; +import eastAsianWidth from 'eastasianwidth'; +import emojiRegex from 'emoji-regex'; + +export default function stringWidth(string, options = {}) { + if (typeof string !== 'string' || string.length === 0) { + return 0; + } + + options = { + ambiguousIsNarrow: true, + ...options + }; + + string = stripAnsi(string); + + if (string.length === 0) { + return 0; + } + + string = string.replace(emojiRegex(), ' '); + + const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2; + let width = 0; + + for (const character of string) { + const codePoint = character.codePointAt(0); + + // Ignore control characters + if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) { + continue; + } + + // Ignore combining characters + if (codePoint >= 0x300 && codePoint <= 0x36F) { + continue; + } + + const code = eastAsianWidth.eastAsianWidth(character); + switch (code) { + case 'F': + case 'W': + width += 2; + break; + case 'A': + width += ambiguousCharacterWidth; + break; + default: + width += 1; + } + } + + return width; +} diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/license b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/@isaacs/cliui/node_modules/string-width/package.json b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/package.json new file mode 100644 index 00000000..f46d6770 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/package.json @@ -0,0 +1,59 @@ +{ + "name": "string-width", + "version": "5.1.2", + "description": "Get the visual width of a string - the number of columns required to display it", + "license": "MIT", + "repository": "sindresorhus/string-width", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "string", + "character", + "unicode", + "width", + "visual", + "column", + "columns", + "fullwidth", + "full-width", + "full", + "ansi", + "escape", + "codes", + "cli", + "command-line", + "terminal", + "console", + "cjk", + "chinese", + "japanese", + "korean", + "fixed-width" + ], + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.14.0", + "xo": "^0.38.2" + } +} diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/index.js b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/index.js new file mode 100644 index 00000000..ba19750e --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/index.js @@ -0,0 +1,14 @@ +import ansiRegex from 'ansi-regex'; + +const regex = ansiRegex(); + +export default function stripAnsi(string) { + if (typeof string !== 'string') { + throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); + } + + // Even though the regex is global, we don't need to reset the `.lastIndex` + // because unlike `.exec()` and `.test()`, `.replace()` does it automatically + // and doing it manually has a performance penalty. + return string.replace(regex, ''); +} diff --git a/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/license b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/package.json b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/package.json new file mode 100644 index 00000000..e1f455c3 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/package.json @@ -0,0 +1,57 @@ +{ + "name": "strip-ansi", + "version": "7.1.0", + "description": "Strip ANSI escape codes from a string", + "license": "MIT", + "repository": "chalk/strip-ansi", + "funding": "https://github.com/chalk/strip-ansi?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.17.0", + "xo": "^0.44.0" + } +} diff --git a/node_modules/npm/node_modules/@isaacs/cliui/package.json b/node_modules/npm/node_modules/@isaacs/cliui/package.json new file mode 100644 index 00000000..7a952532 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/cliui/package.json @@ -0,0 +1,86 @@ +{ + "name": "@isaacs/cliui", + "version": "8.0.2", + "description": "easily create complex multi-column command-line-interfaces", + "main": "build/index.cjs", + "exports": { + ".": [ + { + "import": "./index.mjs", + "require": "./build/index.cjs" + }, + "./build/index.cjs" + ] + }, + "type": "module", + "module": "./index.mjs", + "scripts": { + "check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'", + "fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'", + "pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs", + "test": "c8 mocha ./test/*.cjs", + "test:esm": "c8 mocha ./test/**/*.mjs", + "postest": "check", + "coverage": "c8 report --check-coverage", + "precompile": "rimraf build", + "compile": "tsc", + "postcompile": "npm run build:cjs", + "build:cjs": "rollup -c", + "prepare": "npm run compile" + }, + "repository": "yargs/cliui", + "standard": { + "ignore": [ + "**/example/**" + ], + "globals": [ + "it" + ] + }, + "keywords": [ + "cli", + "command-line", + "layout", + "design", + "console", + "wrap", + "table" + ], + "author": "Ben Coe ", + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "devDependencies": { + "@types/node": "^14.0.27", + "@typescript-eslint/eslint-plugin": "^4.0.0", + "@typescript-eslint/parser": "^4.0.0", + "c8": "^7.3.0", + "chai": "^4.2.0", + "chalk": "^4.1.0", + "cross-env": "^7.0.2", + "eslint": "^7.6.0", + "eslint-plugin-import": "^2.22.0", + "eslint-plugin-node": "^11.1.0", + "gts": "^3.0.0", + "mocha": "^10.0.0", + "rimraf": "^3.0.2", + "rollup": "^2.23.1", + "rollup-plugin-ts": "^3.0.2", + "standardx": "^7.0.0", + "typescript": "^4.0.0" + }, + "files": [ + "build", + "index.mjs", + "!*.d.ts" + ], + "engines": { + "node": ">=12" + } +} diff --git a/node_modules/npm/node_modules/@isaacs/fs-minipass/LICENSE b/node_modules/npm/node_modules/@isaacs/fs-minipass/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/fs-minipass/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js b/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js new file mode 100644 index 00000000..2b3178c5 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js @@ -0,0 +1,430 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WriteStreamSync = exports.WriteStream = exports.ReadStreamSync = exports.ReadStream = void 0; +const events_1 = __importDefault(require("events")); +const fs_1 = __importDefault(require("fs")); +const minipass_1 = require("minipass"); +const writev = fs_1.default.writev; +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_1.Minipass { + [_errored] = false; + [_fd]; + [_path]; + [_readSize]; + [_reading] = false; + [_size]; + [_remain]; + [_autoClose]; + 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 : undefined; + 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]; + } + //@ts-ignore + write() { + throw new TypeError('this is a readable stream'); + } + //@ts-ignore + end() { + throw new TypeError('this is a readable stream'); + } + [_open]() { + fs_1.default.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](); + /* c8 ignore start */ + if (buf.length === 0) { + return process.nextTick(() => this[_onread](null, 0, buf)); + } + /* c8 ignore stop */ + fs_1.default.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b)); + } + } + [_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] = undefined; + fs_1.default.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.subarray(0, br) : buf); + } + if (br === 0 || this[_remain] <= 0) { + ret = false; + this[_close](); + super.end(); + } + return ret; + } + emit(ev, ...args) { + switch (ev) { + case 'prefinish': + case 'finish': + return false; + case 'drain': + if (typeof this[_fd] === 'number') { + this[_read](); + } + return false; + case 'error': + if (this[_errored]) { + return false; + } + this[_errored] = true; + return super.emit(ev, ...args); + default: + return super.emit(ev, ...args); + } + } +} +exports.ReadStream = ReadStream; +class ReadStreamSync extends ReadStream { + [_open]() { + let threw = true; + try { + this[_onopen](null, fs_1.default.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](); + /* c8 ignore start */ + const br = buf.length === 0 + ? 0 + : fs_1.default.readSync(this[_fd], buf, 0, buf.length, null); + /* c8 ignore stop */ + 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] = undefined; + fs_1.default.closeSync(fd); + this.emit('close'); + } + } +} +exports.ReadStreamSync = ReadStreamSync; +class WriteStream extends events_1.default { + readable = false; + writable = true; + [_errored] = false; + [_writing] = false; + [_ended] = false; + [_queue] = []; + [_needDrain] = false; + [_path]; + [_mode]; + [_autoClose]; + [_fd]; + [_defaultFlag]; + [_flags]; + [_finished] = false; + [_pos]; + constructor(path, opt) { + opt = opt || {}; + super(opt); + this[_path] = path; + this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined; + this[_mode] = opt.mode === undefined ? 0o666 : opt.mode; + this[_pos] = typeof opt.start === 'number' ? opt.start : undefined; + this[_autoClose] = + typeof opt.autoClose === 'boolean' ? opt.autoClose : true; + // truncating makes no sense when writing into the middle + const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'; + this[_defaultFlag] = opt.flags === undefined; + this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags; + if (this[_fd] === undefined) { + this[_open](); + } + } + emit(ev, ...args) { + if (ev === 'error') { + if (this[_errored]) { + return false; + } + this[_errored] = true; + } + return super.emit(ev, ...args); + } + get fd() { + return this[_fd]; + } + get path() { + return this[_path]; + } + [_onerror](er) { + this[_close](); + this[_writing] = true; + this.emit('error', er); + } + [_open]() { + fs_1.default.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); + if (!this[_writing]) { + this[_flush](); + } + } + } + end(buf, enc) { + if (buf) { + //@ts-ignore + 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] === undefined || 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_1.default.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] !== undefined && typeof bw === 'number') { + 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] = undefined; + fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close')); + } + } +} +exports.WriteStream = WriteStream; +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_1.default.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_1.default.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] = undefined; + fs_1.default.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_1.default.writeSync(this[_fd], buf, 0, buf.length, this[_pos])); + threw = false; + } + finally { + if (threw) { + try { + this[_close](); + } + catch { + // ok error + } + } + } + } +} +exports.WriteStreamSync = WriteStreamSync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json b/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/esm/index.js b/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/esm/index.js new file mode 100644 index 00000000..287a0f61 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/esm/index.js @@ -0,0 +1,420 @@ +import EE from 'events'; +import fs from 'fs'; +import { Minipass } from 'minipass'; +const writev = fs.writev; +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'); +export class ReadStream extends Minipass { + [_errored] = false; + [_fd]; + [_path]; + [_readSize]; + [_reading] = false; + [_size]; + [_remain]; + [_autoClose]; + 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 : undefined; + 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]; + } + //@ts-ignore + write() { + throw new TypeError('this is a readable stream'); + } + //@ts-ignore + 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](); + /* c8 ignore start */ + if (buf.length === 0) { + return process.nextTick(() => this[_onread](null, 0, buf)); + } + /* c8 ignore stop */ + fs.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b)); + } + } + [_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] = undefined; + 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.subarray(0, br) : buf); + } + if (br === 0 || this[_remain] <= 0) { + ret = false; + this[_close](); + super.end(); + } + return ret; + } + emit(ev, ...args) { + switch (ev) { + case 'prefinish': + case 'finish': + return false; + case 'drain': + if (typeof this[_fd] === 'number') { + this[_read](); + } + return false; + case 'error': + if (this[_errored]) { + return false; + } + this[_errored] = true; + return super.emit(ev, ...args); + default: + return super.emit(ev, ...args); + } + } +} +export 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](); + /* c8 ignore start */ + const br = buf.length === 0 + ? 0 + : fs.readSync(this[_fd], buf, 0, buf.length, null); + /* c8 ignore stop */ + 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] = undefined; + fs.closeSync(fd); + this.emit('close'); + } + } +} +export class WriteStream extends EE { + readable = false; + writable = true; + [_errored] = false; + [_writing] = false; + [_ended] = false; + [_queue] = []; + [_needDrain] = false; + [_path]; + [_mode]; + [_autoClose]; + [_fd]; + [_defaultFlag]; + [_flags]; + [_finished] = false; + [_pos]; + constructor(path, opt) { + opt = opt || {}; + super(opt); + this[_path] = path; + this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined; + this[_mode] = opt.mode === undefined ? 0o666 : opt.mode; + this[_pos] = typeof opt.start === 'number' ? opt.start : undefined; + this[_autoClose] = + typeof opt.autoClose === 'boolean' ? opt.autoClose : true; + // truncating makes no sense when writing into the middle + const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w'; + this[_defaultFlag] = opt.flags === undefined; + this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags; + if (this[_fd] === undefined) { + this[_open](); + } + } + emit(ev, ...args) { + if (ev === 'error') { + if (this[_errored]) { + return false; + } + this[_errored] = true; + } + return super.emit(ev, ...args); + } + 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); + if (!this[_writing]) { + this[_flush](); + } + } + } + end(buf, enc) { + if (buf) { + //@ts-ignore + 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] === undefined || 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] !== undefined && typeof bw === 'number') { + 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] = undefined; + fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')); + } + } +} +export 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] = undefined; + 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 { + // ok error + } + } + } + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/esm/package.json b/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/fs-minipass/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/@isaacs/fs-minipass/package.json b/node_modules/npm/node_modules/@isaacs/fs-minipass/package.json new file mode 100644 index 00000000..cc4576c4 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/fs-minipass/package.json @@ -0,0 +1,72 @@ +{ + "name": "@isaacs/fs-minipass", + "version": "4.0.1", + "main": "./dist/commonjs/index.js", + "scripts": { + "prepare": "tshy", + "pretest": "npm run prepare", + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "keywords": [], + "author": "Isaac Z. Schlueter", + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/fs-minipass.git" + }, + "description": "fs read and write streams based on minipass", + "dependencies": { + "minipass": "^7.0.4" + }, + "devDependencies": { + "@types/node": "^20.11.30", + "mutate-fs": "^2.1.1", + "prettier": "^3.2.5", + "tap": "^18.7.1", + "tshy": "^1.12.0", + "typedoc": "^0.25.12" + }, + "files": [ + "dist" + ], + "engines": { + "node": ">=18.0.0" + }, + "tshy": { + "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" + } + } + }, + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + } +} diff --git a/node_modules/npm/node_modules/@isaacs/string-locale-compare/LICENSE b/node_modules/npm/node_modules/@isaacs/string-locale-compare/LICENSE new file mode 100644 index 00000000..05eeeb88 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/string-locale-compare/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/@isaacs/string-locale-compare/index.js b/node_modules/npm/node_modules/@isaacs/string-locale-compare/index.js new file mode 100644 index 00000000..0f68ab67 --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/string-locale-compare/index.js @@ -0,0 +1,42 @@ +const hasIntl = typeof Intl === 'object' && !!Intl +const Collator = hasIntl && Intl.Collator +const cache = new Map() + +const collatorCompare = (locale, opts) => { + const collator = new Collator(locale, opts) + return (a, b) => collator.compare(a, b) +} + +const localeCompare = (locale, opts) => (a, b) => a.localeCompare(b, locale, opts) + +const knownOptions = [ + 'sensitivity', + 'numeric', + 'ignorePunctuation', + 'caseFirst', +] + +const { hasOwnProperty } = Object.prototype + +module.exports = (locale, options = {}) => { + if (!locale || typeof locale !== 'string') + throw new TypeError('locale required') + + const opts = knownOptions.reduce((opts, k) => { + if (hasOwnProperty.call(options, k)) { + opts[k] = options[k] + } + return opts + }, {}) + const key = `${locale}\n${JSON.stringify(opts)}` + + if (cache.has(key)) + return cache.get(key) + + const compare = hasIntl + ? collatorCompare(locale, opts) + : localeCompare(locale, opts) + cache.set(key, compare) + + return compare +} diff --git a/node_modules/npm/node_modules/@isaacs/string-locale-compare/package.json b/node_modules/npm/node_modules/@isaacs/string-locale-compare/package.json new file mode 100644 index 00000000..58de848a --- /dev/null +++ b/node_modules/npm/node_modules/@isaacs/string-locale-compare/package.json @@ -0,0 +1,28 @@ +{ + "name": "@isaacs/string-locale-compare", + "version": "1.1.0", + "files": [ + "index.js" + ], + "main": "index.js", + "description": "Compare strings with Intl.Collator if available, falling back to String.localeCompare otherwise", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/string-locale-compare" + }, + "author": "Isaac Z. Schlueter (https://izs.me)", + "license": "ISC", + "scripts": { + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "tap": { + "check-coverage": true + }, + "devDependencies": { + "tap": "^15.0.9" + } +} diff --git a/node_modules/npm/node_modules/@npmcli/agent/lib/agents.js b/node_modules/npm/node_modules/@npmcli/agent/lib/agents.js new file mode 100644 index 00000000..c541b930 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/agent/lib/agents.js @@ -0,0 +1,206 @@ +'use strict' + +const net = require('net') +const tls = require('tls') +const { once } = require('events') +const timers = require('timers/promises') +const { normalizeOptions, cacheOptions } = require('./options') +const { getProxy, getProxyAgent, proxyCache } = require('./proxy.js') +const Errors = require('./errors.js') +const { Agent: AgentBase } = require('agent-base') + +module.exports = class Agent extends AgentBase { + #options + #timeouts + #proxy + #noProxy + #ProxyAgent + + constructor (options = {}) { + const { timeouts, proxy, noProxy, ...normalizedOptions } = normalizeOptions(options) + + super(normalizedOptions) + + this.#options = normalizedOptions + this.#timeouts = timeouts + + if (proxy) { + this.#proxy = new URL(proxy) + this.#noProxy = noProxy + this.#ProxyAgent = getProxyAgent(proxy) + } + } + + get proxy () { + return this.#proxy ? { url: this.#proxy } : {} + } + + #getProxy (options) { + if (!this.#proxy) { + return + } + + const proxy = getProxy(`${options.protocol}//${options.host}:${options.port}`, { + proxy: this.#proxy, + noProxy: this.#noProxy, + }) + + if (!proxy) { + return + } + + const cacheKey = cacheOptions({ + ...options, + ...this.#options, + timeouts: this.#timeouts, + proxy, + }) + + if (proxyCache.has(cacheKey)) { + return proxyCache.get(cacheKey) + } + + let ProxyAgent = this.#ProxyAgent + if (Array.isArray(ProxyAgent)) { + ProxyAgent = this.isSecureEndpoint(options) ? ProxyAgent[1] : ProxyAgent[0] + } + + const proxyAgent = new ProxyAgent(proxy, { + ...this.#options, + socketOptions: { family: this.#options.family }, + }) + proxyCache.set(cacheKey, proxyAgent) + + return proxyAgent + } + + // takes an array of promises and races them against the connection timeout + // which will throw the necessary error if it is hit. This will return the + // result of the promise race. + async #timeoutConnection ({ promises, options, timeout }, ac = new AbortController()) { + if (timeout) { + const connectionTimeout = timers.setTimeout(timeout, null, { signal: ac.signal }) + .then(() => { + throw new Errors.ConnectionTimeoutError(`${options.host}:${options.port}`) + }).catch((err) => { + if (err.name === 'AbortError') { + return + } + throw err + }) + promises.push(connectionTimeout) + } + + let result + try { + result = await Promise.race(promises) + ac.abort() + } catch (err) { + ac.abort() + throw err + } + return result + } + + async connect (request, options) { + // if the connection does not have its own lookup function + // set, then use the one from our options + options.lookup ??= this.#options.lookup + + let socket + let timeout = this.#timeouts.connection + const isSecureEndpoint = this.isSecureEndpoint(options) + + const proxy = this.#getProxy(options) + if (proxy) { + // some of the proxies will wait for the socket to fully connect before + // returning so we have to await this while also racing it against the + // connection timeout. + const start = Date.now() + socket = await this.#timeoutConnection({ + options, + timeout, + promises: [proxy.connect(request, options)], + }) + // see how much time proxy.connect took and subtract it from + // the timeout + if (timeout) { + timeout = timeout - (Date.now() - start) + } + } else { + socket = (isSecureEndpoint ? tls : net).connect(options) + } + + socket.setKeepAlive(this.keepAlive, this.keepAliveMsecs) + socket.setNoDelay(this.keepAlive) + + const abortController = new AbortController() + const { signal } = abortController + + const connectPromise = socket[isSecureEndpoint ? 'secureConnecting' : 'connecting'] + ? once(socket, isSecureEndpoint ? 'secureConnect' : 'connect', { signal }) + : Promise.resolve() + + await this.#timeoutConnection({ + options, + timeout, + promises: [ + connectPromise, + once(socket, 'error', { signal }).then((err) => { + throw err[0] + }), + ], + }, abortController) + + if (this.#timeouts.idle) { + socket.setTimeout(this.#timeouts.idle, () => { + socket.destroy(new Errors.IdleTimeoutError(`${options.host}:${options.port}`)) + }) + } + + return socket + } + + addRequest (request, options) { + const proxy = this.#getProxy(options) + // it would be better to call proxy.addRequest here but this causes the + // http-proxy-agent to call its super.addRequest which causes the request + // to be added to the agent twice. since we only support 3 agents + // currently (see the required agents in proxy.js) we have manually + // checked that the only public methods we need to call are called in the + // next block. this could change in the future and presumably we would get + // failing tests until we have properly called the necessary methods on + // each of our proxy agents + if (proxy?.setRequestProps) { + proxy.setRequestProps(request, options) + } + + request.setHeader('connection', this.keepAlive ? 'keep-alive' : 'close') + + if (this.#timeouts.response) { + let responseTimeout + request.once('finish', () => { + setTimeout(() => { + request.destroy(new Errors.ResponseTimeoutError(request, this.#proxy)) + }, this.#timeouts.response) + }) + request.once('response', () => { + clearTimeout(responseTimeout) + }) + } + + if (this.#timeouts.transfer) { + let transferTimeout + request.once('response', (res) => { + setTimeout(() => { + res.destroy(new Errors.TransferTimeoutError(request, this.#proxy)) + }, this.#timeouts.transfer) + res.once('close', () => { + clearTimeout(transferTimeout) + }) + }) + } + + return super.addRequest(request, options) + } +} diff --git a/node_modules/npm/node_modules/@npmcli/agent/lib/dns.js b/node_modules/npm/node_modules/@npmcli/agent/lib/dns.js new file mode 100644 index 00000000..3c6946c5 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/agent/lib/dns.js @@ -0,0 +1,53 @@ +'use strict' + +const { LRUCache } = require('lru-cache') +const dns = require('dns') + +// this is a factory so that each request can have its own opts (i.e. ttl) +// while still sharing the cache across all requests +const cache = new LRUCache({ max: 50 }) + +const getOptions = ({ + family = 0, + hints = dns.ADDRCONFIG, + all = false, + verbatim = undefined, + ttl = 5 * 60 * 1000, + lookup = dns.lookup, +}) => ({ + // hints and lookup are returned since both are top level properties to (net|tls).connect + hints, + lookup: (hostname, ...args) => { + const callback = args.pop() // callback is always last arg + const lookupOptions = args[0] ?? {} + + const options = { + family, + hints, + all, + verbatim, + ...(typeof lookupOptions === 'number' ? { family: lookupOptions } : lookupOptions), + } + + const key = JSON.stringify({ hostname, ...options }) + + if (cache.has(key)) { + const cached = cache.get(key) + return process.nextTick(callback, null, ...cached) + } + + lookup(hostname, options, (err, ...result) => { + if (err) { + return callback(err) + } + + cache.set(key, result, { ttl }) + return callback(null, ...result) + }) + }, +}) + +module.exports = { + cache, + getOptions, +} diff --git a/node_modules/npm/node_modules/@npmcli/agent/lib/errors.js b/node_modules/npm/node_modules/@npmcli/agent/lib/errors.js new file mode 100644 index 00000000..70475aec --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/agent/lib/errors.js @@ -0,0 +1,61 @@ +'use strict' + +class InvalidProxyProtocolError extends Error { + constructor (url) { + super(`Invalid protocol \`${url.protocol}\` connecting to proxy \`${url.host}\``) + this.code = 'EINVALIDPROXY' + this.proxy = url + } +} + +class ConnectionTimeoutError extends Error { + constructor (host) { + super(`Timeout connecting to host \`${host}\``) + this.code = 'ECONNECTIONTIMEOUT' + this.host = host + } +} + +class IdleTimeoutError extends Error { + constructor (host) { + super(`Idle timeout reached for host \`${host}\``) + this.code = 'EIDLETIMEOUT' + this.host = host + } +} + +class ResponseTimeoutError extends Error { + constructor (request, proxy) { + let msg = 'Response timeout ' + if (proxy) { + msg += `from proxy \`${proxy.host}\` ` + } + msg += `connecting to host \`${request.host}\`` + super(msg) + this.code = 'ERESPONSETIMEOUT' + this.proxy = proxy + this.request = request + } +} + +class TransferTimeoutError extends Error { + constructor (request, proxy) { + let msg = 'Transfer timeout ' + if (proxy) { + msg += `from proxy \`${proxy.host}\` ` + } + msg += `for \`${request.host}\`` + super(msg) + this.code = 'ETRANSFERTIMEOUT' + this.proxy = proxy + this.request = request + } +} + +module.exports = { + InvalidProxyProtocolError, + ConnectionTimeoutError, + IdleTimeoutError, + ResponseTimeoutError, + TransferTimeoutError, +} diff --git a/node_modules/npm/node_modules/@npmcli/agent/lib/index.js b/node_modules/npm/node_modules/@npmcli/agent/lib/index.js new file mode 100644 index 00000000..b33d6eae --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/agent/lib/index.js @@ -0,0 +1,56 @@ +'use strict' + +const { LRUCache } = require('lru-cache') +const { normalizeOptions, cacheOptions } = require('./options') +const { getProxy, proxyCache } = require('./proxy.js') +const dns = require('./dns.js') +const Agent = require('./agents.js') + +const agentCache = new LRUCache({ max: 20 }) + +const getAgent = (url, { agent, proxy, noProxy, ...options } = {}) => { + // false has meaning so this can't be a simple truthiness check + if (agent != null) { + return agent + } + + url = new URL(url) + + const proxyForUrl = getProxy(url, { proxy, noProxy }) + const normalizedOptions = { + ...normalizeOptions(options), + proxy: proxyForUrl, + } + + const cacheKey = cacheOptions({ + ...normalizedOptions, + secureEndpoint: url.protocol === 'https:', + }) + + if (agentCache.has(cacheKey)) { + return agentCache.get(cacheKey) + } + + const newAgent = new Agent(normalizedOptions) + agentCache.set(cacheKey, newAgent) + + return newAgent +} + +module.exports = { + getAgent, + Agent, + // these are exported for backwards compatability + HttpAgent: Agent, + HttpsAgent: Agent, + cache: { + proxy: proxyCache, + agent: agentCache, + dns: dns.cache, + clear: () => { + proxyCache.clear() + agentCache.clear() + dns.cache.clear() + }, + }, +} diff --git a/node_modules/npm/node_modules/@npmcli/agent/lib/options.js b/node_modules/npm/node_modules/@npmcli/agent/lib/options.js new file mode 100644 index 00000000..0bf53f72 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/agent/lib/options.js @@ -0,0 +1,86 @@ +'use strict' + +const dns = require('./dns') + +const normalizeOptions = (opts) => { + const family = parseInt(opts.family ?? '0', 10) + const keepAlive = opts.keepAlive ?? true + + const normalized = { + // nodejs http agent options. these are all the defaults + // but kept here to increase the likelihood of cache hits + // https://nodejs.org/api/http.html#new-agentoptions + keepAliveMsecs: keepAlive ? 1000 : undefined, + maxSockets: opts.maxSockets ?? 15, + maxTotalSockets: Infinity, + maxFreeSockets: keepAlive ? 256 : undefined, + scheduling: 'fifo', + // then spread the rest of the options + ...opts, + // we already set these to their defaults that we want + family, + keepAlive, + // our custom timeout options + timeouts: { + // the standard timeout option is mapped to our idle timeout + // and then deleted below + idle: opts.timeout ?? 0, + connection: 0, + response: 0, + transfer: 0, + ...opts.timeouts, + }, + // get the dns options that go at the top level of socket connection + ...dns.getOptions({ family, ...opts.dns }), + } + + // remove timeout since we already used it to set our own idle timeout + delete normalized.timeout + + return normalized +} + +const createKey = (obj) => { + let key = '' + const sorted = Object.entries(obj).sort((a, b) => a[0] - b[0]) + for (let [k, v] of sorted) { + if (v == null) { + v = 'null' + } else if (v instanceof URL) { + v = v.toString() + } else if (typeof v === 'object') { + v = createKey(v) + } + key += `${k}:${v}:` + } + return key +} + +const cacheOptions = ({ secureEndpoint, ...options }) => createKey({ + secureEndpoint: !!secureEndpoint, + // socket connect options + family: options.family, + hints: options.hints, + localAddress: options.localAddress, + // tls specific connect options + strictSsl: secureEndpoint ? !!options.rejectUnauthorized : false, + ca: secureEndpoint ? options.ca : null, + cert: secureEndpoint ? options.cert : null, + key: secureEndpoint ? options.key : null, + // http agent options + keepAlive: options.keepAlive, + keepAliveMsecs: options.keepAliveMsecs, + maxSockets: options.maxSockets, + maxTotalSockets: options.maxTotalSockets, + maxFreeSockets: options.maxFreeSockets, + scheduling: options.scheduling, + // timeout options + timeouts: options.timeouts, + // proxy + proxy: options.proxy, +}) + +module.exports = { + normalizeOptions, + cacheOptions, +} diff --git a/node_modules/npm/node_modules/@npmcli/agent/lib/proxy.js b/node_modules/npm/node_modules/@npmcli/agent/lib/proxy.js new file mode 100644 index 00000000..6272e929 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/agent/lib/proxy.js @@ -0,0 +1,88 @@ +'use strict' + +const { HttpProxyAgent } = require('http-proxy-agent') +const { HttpsProxyAgent } = require('https-proxy-agent') +const { SocksProxyAgent } = require('socks-proxy-agent') +const { LRUCache } = require('lru-cache') +const { InvalidProxyProtocolError } = require('./errors.js') + +const PROXY_CACHE = new LRUCache({ max: 20 }) + +const SOCKS_PROTOCOLS = new Set(SocksProxyAgent.protocols) + +const PROXY_ENV_KEYS = new Set(['https_proxy', 'http_proxy', 'proxy', 'no_proxy']) + +const PROXY_ENV = Object.entries(process.env).reduce((acc, [key, value]) => { + key = key.toLowerCase() + if (PROXY_ENV_KEYS.has(key)) { + acc[key] = value + } + return acc +}, {}) + +const getProxyAgent = (url) => { + url = new URL(url) + + const protocol = url.protocol.slice(0, -1) + if (SOCKS_PROTOCOLS.has(protocol)) { + return SocksProxyAgent + } + if (protocol === 'https' || protocol === 'http') { + return [HttpProxyAgent, HttpsProxyAgent] + } + + throw new InvalidProxyProtocolError(url) +} + +const isNoProxy = (url, noProxy) => { + if (typeof noProxy === 'string') { + noProxy = noProxy.split(',').map((p) => p.trim()).filter(Boolean) + } + + if (!noProxy || !noProxy.length) { + return false + } + + const hostSegments = url.hostname.split('.').reverse() + + return noProxy.some((no) => { + const noSegments = no.split('.').filter(Boolean).reverse() + if (!noSegments.length) { + return false + } + + for (let i = 0; i < noSegments.length; i++) { + if (hostSegments[i] !== noSegments[i]) { + return false + } + } + + return true + }) +} + +const getProxy = (url, { proxy, noProxy }) => { + url = new URL(url) + + if (!proxy) { + proxy = url.protocol === 'https:' + ? PROXY_ENV.https_proxy + : PROXY_ENV.https_proxy || PROXY_ENV.http_proxy || PROXY_ENV.proxy + } + + if (!noProxy) { + noProxy = PROXY_ENV.no_proxy + } + + if (!proxy || isNoProxy(url, noProxy)) { + return null + } + + return new URL(proxy) +} + +module.exports = { + getProxyAgent, + getProxy, + proxyCache: PROXY_CACHE, +} diff --git a/node_modules/npm/node_modules/@npmcli/agent/package.json b/node_modules/npm/node_modules/@npmcli/agent/package.json new file mode 100644 index 00000000..4d648fb5 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/agent/package.json @@ -0,0 +1,60 @@ +{ + "name": "@npmcli/agent", + "version": "3.0.0", + "description": "the http/https agent used by the npm cli", + "main": "lib/index.js", + "scripts": { + "gencerts": "bash scripts/create-cert.sh", + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "author": "GitHub Inc.", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/agent/issues" + }, + "homepage": "https://github.com/npm/agent#readme", + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.1", + "publish": "true" + }, + "dependencies": { + "agent-base": "^7.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^10.0.1", + "socks-proxy-agent": "^8.0.3" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.1", + "minipass-fetch": "^3.0.3", + "nock": "^13.2.7", + "socksv5": "^0.0.6", + "tap": "^16.3.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/agent.git" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/LICENSE.md b/node_modules/npm/node_modules/@npmcli/arborist/LICENSE.md new file mode 100644 index 00000000..5fc208ff --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/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/npm/node_modules/@npmcli/arborist/README.md b/node_modules/npm/node_modules/@npmcli/arborist/README.md new file mode 100644 index 00000000..81d79cbf --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/README.md @@ -0,0 +1,349 @@ +# @npmcli/arborist + +[![npm version](https://img.shields.io/npm/v/@npmcli/arborist.svg)](https://npm.im/@npmcli/arborist) +[![license](https://img.shields.io/npm/l/@npmcli/arborist.svg)](https://npm.im/@npmcli/arborist) +[![CI - @npmcli/arborist](https://github.com/npm/cli/actions/workflows/ci-npmcli-arborist.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-npmcli-arborist.yml) + +Inspect and manage `node_modules` trees. + +![a tree with the word ARBORIST superimposed on it](https://raw.githubusercontent.com/npm/arborist/main/docs/logo.svg?sanitize=true) + +There's more documentation [in the docs +folder](https://github.com/npm/cli/tree/latest/workspaces/arborist/docs). + +## USAGE + +```js +const Arborist = require('@npmcli/arborist') + +const arb = new Arborist({ + // options object + + // where we're doing stuff. defaults to cwd. + path: '/path/to/package/root', + + // url to the default registry. defaults to npm's default registry + registry: 'https://registry.npmjs.org', + + // scopes can be mapped to a different registry + '@foo:registry': 'https://registry.foo.com/', + + // Auth can be provided in a couple of different ways. If none are + // provided, then requests are anonymous, and private packages will 404. + // Arborist doesn't do anything with these, it just passes them down + // the chain to pacote and npm-registry-fetch. + + // Safest: a bearer token provided by a registry: + // 1. an npm auth token, used with the default registry + token: 'deadbeefcafebad', + // 2. an alias for the same thing: + _authToken: 'deadbeefcafebad', + + // insecure options: + // 3. basic auth, username:password, base64 encoded + auth: 'aXNhYWNzOm5vdCBteSByZWFsIHBhc3N3b3Jk', + // 4. username and base64 encoded password + username: 'isaacs', + password: 'bm90IG15IHJlYWwgcGFzc3dvcmQ=', + + // auth configs can also be scoped to a given registry with this + // rather unusual pattern: + '//registry.foo.com:token': 'blahblahblah', + '//basic.auth.only.foo.com:_auth': 'aXNhYWNzOm5vdCBteSByZWFsIHBhc3N3b3Jk', + '//registry.foo.com:always-auth': true, +}) + +// READING + +// returns a promise. reads the actual contents of node_modules +arb.loadActual().then(tree => { + // tree is also stored at arb.virtualTree +}) + +// read just what the package-lock.json/npm-shrinkwrap says +// This *also* loads the yarn.lock file, but that's only relevant +// when building the ideal tree. +arb.loadVirtual().then(tree => { + // tree is also stored at arb.virtualTree + // now arb.virtualTree is loaded + // this fails if there's no package-lock.json or package.json in the folder + // note that loading this way should only be done if there's no + // node_modules folder +}) + +// OPTIMIZING AND DESIGNING + +// build an ideal tree from the package.json and various lockfiles. +arb.buildIdealTree(options).then(() => { + // next step is to reify that ideal tree onto disk. + // options can be: + // rm: array of package names to remove at top level + // add: Array of package specifiers to add at the top level. Each of + // these will be resolved with pacote.manifest if the name can't be + // determined from the spec. (Eg, `github:foo/bar` vs `foo@somespec`.) + // The dep will be saved in the location where it already exists, + // (or pkg.dependencies) unless a different saveType is specified. + // saveType: Save added packages in a specific dependency set. + // - null (default) Wherever they exist already, or 'dependencies' + // - prod: definitely in 'dependencies' + // - optional: in 'optionalDependencies' + // - dev: devDependencies + // - peer: save in peerDependencies, and remove any optional flag from + // peerDependenciesMeta if one exists + // - peerOptional: save in peerDependencies, and add a + // peerDepsMeta[name].optional flag + // saveBundle: add newly added deps to the bundleDependencies list + // update: Either `true` to just go ahead and update everything, or an + // object with any or all of the following fields: + // - all: boolean. set to true to just update everything + // - names: names of packages update (like `npm update foo`) + // prune: boolean, default true. Prune extraneous nodes from the tree. + // preferDedupe: prefer to deduplicate packages if possible, rather than + // choosing a newer version of a dependency. Defaults to false, ie, + // always try to get the latest and greatest deps. + // legacyBundling: Nest every dep under the node requiring it, npm v2 style. + // No unnecessary deduplication. Default false. + + // At the end of this process, arb.idealTree is set. +}) + +// WRITING + +// Make the idealTree be the thing that's on disk +arb.reify({ + // write the lockfile(s) back to disk, and package.json with any updates + // defaults to 'true' + save: true, +}).then(() => { + // node modules has been written to match the idealTree +}) +``` + +## DATA STRUCTURES + +A `node_modules` tree is a logical graph of dependencies overlaid on a +physical tree of folders. + +A `Node` represents a package folder on disk, either at the root of the +package, or within a `node_modules` folder. The physical structure of the +folder tree is represented by the `node.parent` reference to the containing +folder, and `node.children` map of nodes within its `node_modules` +folder, where the key in the map is the name of the folder in +`node_modules`, and the value is the child node. + +A node without a parent is a top of tree. + +A `Link` represents a symbolic link to a package on disk. This can be a +symbolic link to a package folder within the current tree, or elsewhere on +disk. The `link.target` is a reference to the actual node. Links differ +from Nodes in that dependencies are resolved from the _target_ location, +rather than from the link location. + +An `Edge` represents a dependency relationship. Each node has an `edgesIn` +set, and an `edgesOut` map. Each edge has a `type` which specifies what +kind of dependency it represents: `'prod'` for regular dependencies, +`'peer'` for peerDependencies, `'dev'` for devDependencies, and +`'optional'` for optionalDependencies. `edge.from` is a reference to the +node that has the dependency, and `edge.to` is a reference to the node that +requires the dependency. + +As nodes are moved around in the tree, the graph edges are automatically +updated to point at the new module resolution targets. In other words, +`edge.from`, `edge.name`, and `edge.spec` are immutable; `edge.to` is +updated automatically when a node's parent changes. + +### class Node + +All arborist trees are `Node` objects. A `Node` refers +to a package folder, which may have children in `node_modules`. + +* `node.name` The name of this node's folder in `node_modules`. +* `node.parent` Physical parent node in the tree. The package in whose + `node_modules` folder this package lives. Null if node is top of tree. + + Setting `node.parent` will automatically update `node.location` and all + graph edges affected by the move. + +* `node.meta` A `Shrinkwrap` object which looks up `resolved` and + `integrity` values for all modules in this tree. Only relevant on `root` + nodes. + +* `node.children` Map of packages located in the node's `node_modules` + folder. +* `node.package` The contents of this node's `package.json` file. +* `node.path` File path to this package. If the node is a link, then this + is the path to the link, not to the link target. If the node is _not_ a + link, then this matches `node.realpath`. +* `node.realpath` The full real filepath on disk where this node lives. +* `node.location` A slash-normalized relative path from the root node to + this node's path. +* `node.isLink` Whether this represents a symlink. Always `false` for Node + objects, always `true` for Link objects. +* `node.isRoot` True if this node is a root node. (Ie, if `node.root === + node`.) +* `node.root` The root node where we are working. If not assigned to some + other value, resolves to the node itself. (Ie, the root node's `root` + property refers to itself.) +* `node.isTop` True if this node is the top of its tree (ie, has no + `parent`, false otherwise). +* `node.top` The top node in this node's tree. This will be equal to + `node.root` for simple trees, but link targets will frequently be outside + of (or nested somewhere within) a `node_modules` hierarchy, and so will + have a different `top`. +* `node.dev`, `node.optional`, `node.devOptional`, `node.peer`, Indicators + as to whether this node is a dev, optional, and/or peer dependency. + These flags are relevant when pruning dependencies out of the tree or + deciding what to reify. See **Package Dependency Flags** below for + explanations. +* `node.edgesOut` Edges in the dependency graph indicating nodes that this + node depends on, which resolve its dependencies. +* `node.edgesIn` Edges in the dependency graph indicating nodes that depend + on this node. + +* `extraneous` True if this package is not required by any other for any + reason. False for top of tree. + +* `node.resolve(name)` Identify the node that will be returned when code + in this package runs `require(name)` + +* `node.errors` Array of errors encountered while parsing package.json or + version specifiers. + +### class Link + +Link objects represent a symbolic link within the `node_modules` folder. +They have most of the same properties and methods as `Node` objects, with a +few differences. + +* `link.target` A Node object representing the package that the link + references. If this is a Node already present within the tree, then it + will be the same object. If it's outside of the tree, then it will be + treated as the top of its own tree. +* `link.isLink` Always true. +* `link.children` This is always an empty map, since links don't have their + own children directly. + +### class Edge + +Edge objects represent a dependency relationship a package node to the +point in the tree where the dependency will be loaded. As nodes are moved +within the tree, Edges automatically update to point to the appropriate +location. + +* `new Edge({ from, type, name, spec })` Creates a new edge with the + specified fields. After instantiation, none of the fields can be + changed directly. +* `edge.from` The node that has the dependency. +* `edge.type` The type of dependency. One of `'prod'`, `'dev'`, `'peer'`, + or `'optional'`. +* `edge.name` The name of the dependency. Ie, the key in the + relevant `package.json` dependencies object. +* `edge.spec` The specifier that is required. This can be a version, + range, tag name, git url, or tarball URL. Any specifier allowed by npm + is supported. +* `edge.to` Automatically set to the node in the tree that matches the + `name` field. +* `edge.valid` True if `edge.to` satisfies the specifier. +* `edge.error` A string indicating the type of error if there is a problem, + or `null` if it's valid. Values, in order of precedence: + * `DETACHED` Indicates that the edge has been detached from its + `edge.from` node, typically because a new edge was created when a + dependency specifier was modified. + * `MISSING` Indicates that the dependency is unmet. Note that this is + _not_ set for unmet dependencies of the `optional` type. + * `PEER LOCAL` Indicates that a `peerDependency` is found in the + node's local `node_modules` folder, and the node is not the top of + the tree. This violates the `peerDependency` contract, because it + means that the dependency is not a peer. + * `INVALID` Indicates that the dependency does not satisfy `edge.spec`. +* `edge.reload()` Re-resolve to find the appropriate value for `edge.to`. + Called automatically from the `Node` class when the tree is mutated. + +### Package Dependency Flags + +The dependency type of a node can be determined efficiently by looking at +the `dev`, `optional`, and `devOptional` flags on the node object. These +are updated by arborist when necessary whenever the tree is modified in +such a way that the dependency graph can change, and are relevant when +pruning nodes from the tree. + +``` +| extraneous | peer | dev | optional | devOptional | meaning | prune? | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| | | | | | production dep | never | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| X | N/A | N/A | N/A | N/A | nothing depends on | always | +| | | | | | this, it is trash | | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| | | X | | X | devDependency, or | if pruning dev | +| | | | | not in lock | only depended upon | | +| | | | | | by devDependencies | | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| | | | X | X | optionalDependency, | if pruning | +| | | | | not in lock | or only depended on | optional | +| | | | | | by optionalDeps | | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| | | X | X | X | Optional dependency | if pruning EITHER | +| | | | | not in lock | of dep(s) in the | dev OR optional | +| | | | | | dev hierarchy | | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| | | | | X | BOTH a non-optional | if pruning BOTH | +| | | | | in lock | dep within the dev | dev AND optional | +| | | | | | hierarchy, AND a | | +| | | | | | dep within the | | +| | | | | | optional hierarchy | | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| | X | | | | peer dependency, or | if pruning peers | +| | | | | | only depended on by | | +| | | | | | peer dependencies | | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| | X | X | | X | peer dependency of | if pruning peer | +| | | | | not in lock | dev node hierarchy | OR dev deps | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| | X | | X | X | peer dependency of | if pruning peer | +| | | | | not in lock | optional nodes, or | OR optional deps | +| | | | | | peerOptional dep | | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| | X | X | X | X | peer optional deps | if pruning peer | +| | | | | not in lock | of the dev dep | OR optional OR | +| | | | | | hierarchy | dev | +|------------+------+-----+----------+-------------+---------------------+-------------------| +| | X | | | X | BOTH a non-optional | if pruning peers | +| | | | | in lock | peer dep within the | OR: | +| | | | | | dev hierarchy, AND | BOTH optional | +| | | | | | a peer optional dep | AND dev deps | ++------------+------+-----+----------+-------------+---------------------+-------------------+ +``` + +* If none of these flags are set, then the node is required by the + dependency and/or peerDependency hierarchy. It should not be pruned. +* If _both_ `node.dev` and `node.optional` are set, then the node is an + optional dependency of one of the packages in the devDependency + hierarchy. It should be pruned if _either_ dev or optional deps are + being removed. +* If `node.dev` is set, but `node.optional` is not, then the node is + required in the devDependency hierarchy. It should be pruned if dev + dependencies are being removed. +* If `node.optional` is set, but `node.dev` is not, then the node is + required in the optionalDependency hierarchy. It should be pruned if + optional dependencies are being removed. +* If `node.devOptional` is set, then the node is a (non-optional) + dependency within the devDependency hierarchy, _and_ a dependency + within the `optionalDependency` hierarchy. It should be pruned if + _both_ dev and optional dependencies are being removed. +* If `node.peer` is set, then all the same semantics apply as above, except + that the dep is brought in by a peer dep at some point, rather than a + normal non-peer dependency. + +Note: `devOptional` is only set in the shrinkwrap/package-lock file if +_neither_ `dev` nor `optional` are set, as it would be redundant. + +## BIN + +Arborist ships with a cli that can be used to run arborist specific commands outside of the context of the npm CLI. This script is currently not part of the public API and is subject to breaking changes outside of major version bumps. + +To see the usage run: + +``` +npx @npmcli/arborist --help +``` diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/actual.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/actual.js new file mode 100644 index 00000000..866b2cd8 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/actual.js @@ -0,0 +1,19 @@ +const Arborist = require('../') + +const printTree = require('./lib/print-tree.js') + +module.exports = (options, time) => new Arborist(options) + .loadActual(options) + .then(time) + .then(async ({ timing, result: tree }) => { + printTree(tree) + if (options.save) { + await tree.meta.save() + } + if (options.saveHidden) { + tree.meta.hiddenLockfile = true + tree.meta.filename = options.path + '/node_modules/.package-lock.json' + await tree.meta.save() + } + return `read ${tree.inventory.size} deps in ${timing.ms}` + }) diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/audit.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/audit.js new file mode 100644 index 00000000..0e32833d --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/audit.js @@ -0,0 +1,51 @@ +const Arborist = require('../') + +const printTree = require('./lib/print-tree.js') +const log = require('./lib/logging.js') + +const Vuln = require('../lib/vuln.js') +const printReport = report => { + for (const vuln of report.values()) { + log.info(printVuln(vuln)) + } + if (report.topVulns.size) { + log.info('\n# top-level vulnerabilities') + for (const vuln of report.topVulns.values()) { + log.info(printVuln(vuln)) + } + } +} + +const printVuln = vuln => { + return { + __proto__: { constructor: Vuln }, + name: vuln.name, + issues: [...vuln.advisories].map(a => printAdvisory(a)), + range: vuln.simpleRange, + nodes: [...vuln.nodes].map(node => `${node.name} ${node.location || '#ROOT'}`), + ...(vuln.topNodes.size === 0 ? {} : { + topNodes: [...vuln.topNodes].map(node => `${node.location || '#ROOT'}`), + }), + } +} + +const printAdvisory = a => `${a.title}${a.url ? ' ' + a.url : ''}` + +module.exports = (options, time) => { + const arb = new Arborist(options) + return arb + .audit(options) + .then(time) + .then(async ({ timing, result: tree }) => { + if (options.fix) { + printTree(tree) + } + printReport(arb.auditReport) + if (tree.meta && options.save) { + await tree.meta.save() + } + return options.fix + ? `resolved ${tree.inventory.size} deps in ${timing.seconds}` + : `done in ${timing.seconds}` + }) +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/funding.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/funding.js new file mode 100644 index 00000000..cf25976d --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/funding.js @@ -0,0 +1,38 @@ +const Arborist = require('../') + +const log = require('./lib/logging.js') + +module.exports = (options, time) => { + const query = options._.shift() + const a = new Arborist(options) + return a + .loadVirtual() + .then(tree => { + // only load the actual tree if the virtual one doesn't have modern metadata + if (!tree.meta || !(tree.meta.originalLockfileVersion >= 2)) { + log.error('old metadata, load actual') + throw 'load actual' + } else { + log.error('meta ok, return virtual tree') + return tree + } + }) + .catch(() => a.loadActual()) + .then(time) + .then(({ timing, result: tree }) => { + if (!query) { + for (const node of tree.inventory.values()) { + if (node.package.funding) { + log.info(node.name, node.location, node.package.funding) + } + } + } else { + for (const node of tree.inventory.query('name', query)) { + if (node.package.funding) { + log.info(node.name, node.location, node.package.funding) + } + } + } + return `read ${tree.inventory.size} deps in ${timing.ms}` + }) +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/ideal.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/ideal.js new file mode 100644 index 00000000..1dd206e8 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/ideal.js @@ -0,0 +1,14 @@ +const Arborist = require('../') + +const printTree = require('./lib/print-tree.js') + +module.exports = (options, time) => new Arborist(options) + .buildIdealTree(options) + .then(time) + .then(async ({ timing, result: tree }) => { + printTree(tree) + if (tree.meta && options.save) { + await tree.meta.save() + } + return `resolved ${tree.inventory.size} deps in ${timing.seconds}` + }) diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/index.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/index.js new file mode 100755 index 00000000..7c5d45f1 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/index.js @@ -0,0 +1,112 @@ +#!/usr/bin/env node + +const fs = require('node:fs') +const path = require('node:path') +const { time } = require('proc-log') + +const { bin, arb: options } = require('./lib/options') +const version = require('../package.json').version + +const usage = (message = '') => `Arborist - the npm tree doctor + +Version: ${version} +${message && '\n' + message + '\n'} +# USAGE + arborist [path] [options...] + +# COMMANDS + + * reify: reify ideal tree to node_modules (install, update, rm, ...) + * prune: prune the ideal tree and reify (like npm prune) + * ideal: generate and print the ideal tree + * actual: read and print the actual tree in node_modules + * virtual: read and print the virtual tree in the local shrinkwrap file + * shrinkwrap: load a local shrinkwrap and print its data + * audit: perform a security audit on project dependencies + * funding: query funding information in the local package tree. A second + positional argument after the path name can limit to a package name. + * license: query license information in the local package tree. A second + positional argument after the path name can limit to a license type. + * help: print this text + * version: print the version + +# OPTIONS + + Most npm options are supported, but in camelCase rather than css-case. For + example, instead of '--dry-run', use '--dryRun'. + + Additionally: + + * --loglevel=warn|--quiet will supppress the printing of package trees + * --logfile will output logs to a file + * --timing will show timing information + * Instead of 'npm install ', use 'arborist reify --add='. + The '--add=' option can be specified multiple times. + * Instead of 'npm rm ', use 'arborist reify --rm='. + The '--rm=' option can be specified multiple times. + * Instead of 'npm update', use 'arborist reify --update-all'. + * 'npm audit fix' is 'arborist audit --fix' +` + +const commands = { + version: () => console.log(version), + help: () => console.log(usage()), + exit: () => { + process.exitCode = 1 + console.error( + usage(`Error: command '${bin.command}' does not exist.`) + ) + }, +} + +const commandFiles = fs.readdirSync(__dirname).filter((f) => path.extname(f) === '.js' && f !== __filename) + +for (const file of commandFiles) { + const command = require(`./${file}`) + const name = path.basename(file, '.js') + const totalTime = `bin:${name}:init` + const scriptTime = `bin:${name}:script` + + commands[name] = () => { + const timers = require('./lib/timers') + const log = require('./lib/logging') + + log.info(name, options) + + const timeEnd = time.start(totalTime) + const scriptEnd = time.start(scriptTime) + + return command(options, (result) => { + scriptEnd() + return { + result, + timing: { + seconds: `${timers.get(scriptTime) / 1e9}s`, + ms: `${timers.get(scriptTime) / 1e6}ms`, + }, + } + }) + .then((result) => { + log.info(result) + return result + }) + .catch((err) => { + process.exitCode = 1 + log.error(err) + return err + }) + .then((r) => { + timeEnd() + if (bin.loglevel !== 'silent') { + console[process.exitCode ? 'error' : 'log'](r) + } + return r + }) + } +} + +if (commands[bin.command]) { + commands[bin.command]() +} else { + commands.exit() +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/logging.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/logging.js new file mode 100644 index 00000000..431eea3e --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/logging.js @@ -0,0 +1,77 @@ +const { log } = require('proc-log') +const fs = require('node:fs') +const { dirname } = require('node:path') +const os = require('node:os') +const { inspect, format } = require('node:util') + +const { bin: options } = require('./options.js') + +// add a meta method to proc-log for passing optional +// metadata through to log handlers +const META = Symbol('meta') +const parseArgs = (...args) => { + const { [META]: isMeta } = args[args.length - 1] || {} + return isMeta + ? [args[args.length - 1], ...args.slice(0, args.length - 1)] + : [{}, ...args] +} +log.meta = (meta = {}) => ({ [META]: true, ...meta }) + +const levels = new Map([ + 'silly', + 'verbose', + 'info', + 'http', + 'notice', + 'warn', + 'error', + 'silent', +].map((level, index) => [level, index])) + +const addLogListener = (write, { eol = os.EOL, loglevel = 'silly', colors = false } = {}) => { + const levelIndex = levels.get(loglevel) + + const magenta = m => colors ? `\x1B[35m${m}\x1B[39m` : m + const dim = m => colors ? `\x1B[2m${m}\x1B[22m` : m + const red = m => colors ? `\x1B[31m${m}\x1B[39m` : m + + const formatter = (level, ...args) => { + const depth = level === 'error' && args[0] && args[0].code === 'ERESOLVE' ? Infinity : 10 + + if (level === 'info' && args[0] === 'timeEnd') { + args[1] = dim(args[1]) + } else if (level === 'error' && args[0] === 'timeError') { + args[1] = red(args[1]) + } + + const messages = args.map(a => typeof a === 'string' ? a : inspect(a, { depth, colors })) + const pref = `${process.pid} ${magenta(level)} ` + + return pref + format(...messages).trim().split('\n').join(`${eol}${pref}`) + eol + } + + process.on('log', (...args) => { + const [meta, level, ...logArgs] = parseArgs(...args) + + if (levelIndex <= levels.get(level) || meta.force) { + write(formatter(level, ...logArgs)) + } + }) +} + +if (options.loglevel !== 'silent') { + addLogListener((v) => process.stderr.write(v), { + eol: '\n', + colors: options.colors, + loglevel: options.loglevel, + }) +} + +if (options.logfile) { + log.silly('logfile', options.logfile) + fs.mkdirSync(dirname(options.logfile), { recursive: true }) + const fd = fs.openSync(options.logfile, 'a') + addLogListener((str) => fs.writeSync(fd, str)) +} + +module.exports = log diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/options.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/options.js new file mode 100644 index 00000000..419c8185 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/options.js @@ -0,0 +1,123 @@ +const nopt = require('nopt') +const path = require('node:path') + +const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k) + +const cleanPath = (val) => { + const k = Symbol('key') + const data = {} + nopt.typeDefs.path.validate(data, k, val) + return data[k] +} + +const parse = (...noptArgs) => { + const binOnlyOpts = { + command: String, + loglevel: String, + colors: Boolean, + timing: ['always', Boolean], + logfile: String, + } + + const arbOpts = { + add: Array, + rm: Array, + omit: Array, + update: Array, + workspaces: Array, + global: Boolean, + force: Boolean, + 'global-style': Boolean, + 'prefer-dedupe': Boolean, + 'legacy-peer-deps': Boolean, + 'update-all': Boolean, + before: Date, + path: path, + cache: path, + ...binOnlyOpts, + } + + const short = { + quiet: ['--loglevel', 'warn'], + logs: ['--logfile', 'true'], + w: '--workspaces', + g: '--global', + f: '--force', + } + + const defaults = { + // key order is important for command and path + // since they shift positional args + // command is 1st, path is 2nd + command: (o) => o.argv.remain.shift(), + path: (o) => cleanPath(o.argv.remain.shift() || '.'), + colors: has(process.env, 'NO_COLOR') ? false : !!process.stderr.isTTY, + loglevel: 'silly', + timing: (o) => o.loglevel === 'silly', + cache: `${process.env.HOME}/.npm/_cacache`, + } + + const derived = [ + // making update either `all` or an array of names but not both + ({ updateAll: all, update: names, ...o }) => { + if (all || names) { + o.update = all != null ? { all } : { names } + } + return o + }, + ({ logfile, ...o }) => { + // logfile is parsed as a string so if its true or set but empty + // then set the default logfile + if (logfile === 'true' || logfile === '') { + logfile = `arb-log-${new Date().toISOString().replace(/[.:]/g, '_')}.log` + } + // then parse it the same as nopt parses other paths + if (logfile) { + o.logfile = cleanPath(logfile) + } + return o + }, + ] + + const transforms = [ + // Camelcase all top level keys + (o) => { + const entries = Object.entries(o).map(([k, v]) => [ + k.replace(/-./g, s => s[1].toUpperCase()), + v, + ]) + return Object.fromEntries(entries) + }, + // Set defaults on unset keys + (o) => { + for (const [k, v] of Object.entries(defaults)) { + if (!has(o, k)) { + o[k] = typeof v === 'function' ? v(o) : v + } + } + return o + }, + // Set/unset derived values + ...derived.map((derive) => (o) => derive(o) || o), + // Separate bin and arborist options + ({ argv: { remain: _ }, ...o }) => { + const bin = { _ } + for (const k of Object.keys(binOnlyOpts)) { + if (has(o, k)) { + bin[k] = o[k] + delete o[k] + } + } + return { bin, arb: o } + }, + ] + + let options = nopt(arbOpts, short, ...noptArgs) + for (const t of transforms) { + options = t(options) + } + + return options +} + +module.exports = parse() diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/print-tree.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/print-tree.js new file mode 100644 index 00000000..a110e6bc --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/print-tree.js @@ -0,0 +1,4 @@ +const { inspect } = require('node:util') +const log = require('./logging.js') + +module.exports = tree => log.info(inspect(tree.toJSON(), { depth: Infinity })) diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/timers.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/timers.js new file mode 100644 index 00000000..a7ec534f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/lib/timers.js @@ -0,0 +1,33 @@ +const { bin: options } = require('./options.js') +const log = require('./logging.js') + +const timers = new Map() +const finished = new Map() + +process.on('time', (level, name) => { + if (level === 'start') { + if (timers.has(name)) { + throw new Error('conflicting timer! ' + name) + } + timers.set(name, process.hrtime.bigint()) + } else if (level === 'end') { + if (!timers.has(name)) { + throw new Error('timer not started! ' + name) + } + const elapsed = Number(process.hrtime.bigint() - timers.get(name)) + timers.delete(name) + finished.set(name, elapsed) + if (options.timing) { + log.info('timeEnd', `${name} ${elapsed / 1e9}s`, log.meta({ force: options.timing === 'always' })) + } + } +}) + +process.on('exit', () => { + for (const name of timers.keys()) { + log.error('timeError', 'Dangling timer:', name) + process.exitCode = 1 + } +}) + +module.exports = finished diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/license.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/license.js new file mode 100644 index 00000000..77d57967 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/license.js @@ -0,0 +1,48 @@ +const localeCompare = require('@isaacs/string-locale-compare')('en') +const Arborist = require('../') +const log = require('./lib/logging.js') + +module.exports = (options, time) => { + const query = options._.shift() + const a = new Arborist(options) + return a + .loadVirtual() + .then(tree => { + // only load the actual tree if the virtual one doesn't have modern metadata + if (!tree.meta || !(tree.meta.originalLockfileVersion >= 2)) { + throw 'load actual' + } else { + return tree + } + }).catch((er) => { + log.error('loading actual tree', er) + return a.loadActual() + }) + .then(time) + .then(({ result: tree }) => { + const output = [] + if (!query) { + const set = [] + for (const license of tree.inventory.query('license')) { + set.push([tree.inventory.query('license', license).size, license]) + } + + for (const [count, license] of set.sort((a, b) => + a[1] && b[1] ? b[0] - a[0] || localeCompare(a[1], b[1]) + : a[1] ? -1 + : b[1] ? 1 + : 0)) { + output.push(`${count} ${license}`) + log.info(count, license) + } + } else { + for (const node of tree.inventory.query('license', query === 'undefined' ? undefined : query)) { + const msg = `${node.name} ${node.location} ${node.package.description || ''}` + output.push(msg) + log.info(msg) + } + } + + return output.join('\n') + }) +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/prune.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/prune.js new file mode 100644 index 00000000..3c52bc13 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/prune.js @@ -0,0 +1,48 @@ +const Arborist = require('../') + +const printTree = require('./lib/print-tree.js') +const log = require('./lib/logging.js') + +const printDiff = diff => { + const { depth } = require('treeverse') + depth({ + tree: diff, + visit: d => { + if (d.location === '') { + return + } + switch (d.action) { + case 'REMOVE': + log.info('REMOVE', d.actual.location) + break + case 'ADD': + log.info('ADD', d.ideal.location, d.ideal.resolved) + break + case 'CHANGE': + log.info('CHANGE', d.actual.location, { + from: d.actual.resolved, + to: d.ideal.resolved, + }) + break + } + }, + getChildren: d => d.children, + }) +} + +module.exports = (options, time) => { + const arb = new Arborist(options) + return arb + .prune(options) + .then(time) + .then(async ({ timing, result: tree }) => { + printTree(tree) + if (options.dryRun) { + printDiff(arb.diff) + } + if (tree.meta && options.save) { + await tree.meta.save() + } + return `resolved ${tree.inventory.size} deps in ${timing.seconds}` + }) +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/reify.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/reify.js new file mode 100644 index 00000000..3f3aafe8 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/reify.js @@ -0,0 +1,48 @@ +const Arborist = require('../') + +const printTree = require('./lib/print-tree.js') +const log = require('./lib/logging.js') + +const printDiff = diff => { + const { depth } = require('treeverse') + depth({ + tree: diff, + visit: d => { + if (d.location === '') { + return + } + switch (d.action) { + case 'REMOVE': + log.info('REMOVE', d.actual.location) + break + case 'ADD': + log.info('ADD', d.ideal.location, d.ideal.resolved) + break + case 'CHANGE': + log.info('CHANGE', d.actual.location, { + from: d.actual.resolved, + to: d.ideal.resolved, + }) + break + } + }, + getChildren: d => d.children, + }) +} + +module.exports = (options, time) => { + const arb = new Arborist(options) + return arb + .reify(options) + .then(time) + .then(async ({ timing, result: tree }) => { + printTree(tree) + if (options.dryRun) { + printDiff(arb.diff) + } + if (tree.meta && options.save) { + await tree.meta.save() + } + return `resolved ${tree.inventory.size} deps in ${timing.seconds}` + }) +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/shrinkwrap.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/shrinkwrap.js new file mode 100644 index 00000000..56603224 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/shrinkwrap.js @@ -0,0 +1,7 @@ +const Shrinkwrap = require('../lib/shrinkwrap.js') + +module.exports = (options, time) => Shrinkwrap + .load(options) + .then((s) => s.commit()) + .then(time) + .then(({ result: s }) => JSON.stringify(s, 0, 2)) diff --git a/node_modules/npm/node_modules/@npmcli/arborist/bin/virtual.js b/node_modules/npm/node_modules/@npmcli/arborist/bin/virtual.js new file mode 100644 index 00000000..95b1de28 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/bin/virtual.js @@ -0,0 +1,14 @@ +const Arborist = require('../') + +const printTree = require('./lib/print-tree.js') + +module.exports = (options, time) => new Arborist(options) + .loadVirtual() + .then(time) + .then(async ({ timing, result: tree }) => { + printTree(tree) + if (options.save) { + await tree.meta.save() + } + return `read ${tree.inventory.size} deps in ${timing.ms}` + }) diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js new file mode 100644 index 00000000..2e30eb1d --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js @@ -0,0 +1,143 @@ +// add and remove dependency specs to/from pkg manifest + +const { log } = require('proc-log') +const localeCompare = require('@isaacs/string-locale-compare')('en') + +const add = ({ pkg, add, saveBundle, saveType }) => { + for (const { name, rawSpec } of add) { + let addSaveType = saveType + // if the user does not give us a type, we infer which type(s) + // to keep based on the same order of priority we do when + // building the tree as defined in the _loadDeps method of + // the node class. + if (!addSaveType) { + addSaveType = inferSaveType(pkg, name) + } + + if (addSaveType === 'prod') { + // a production dependency can only exist as production (rpj ensures it + // doesn't coexist w/ optional) + deleteSubKey(pkg, 'devDependencies', name, 'dependencies') + deleteSubKey(pkg, 'peerDependencies', name, 'dependencies') + } else if (addSaveType === 'dev') { + // a dev dependency may co-exist as peer, or optional, but not production + deleteSubKey(pkg, 'dependencies', name, 'devDependencies') + } else if (addSaveType === 'optional') { + // an optional dependency may co-exist as dev (rpj ensures it doesn't + // coexist w/ prod) + deleteSubKey(pkg, 'peerDependencies', name, 'optionalDependencies') + } else { // peer or peerOptional is all that's left + // a peer dependency may coexist as dev + deleteSubKey(pkg, 'dependencies', name, 'peerDependencies') + deleteSubKey(pkg, 'optionalDependencies', name, 'peerDependencies') + } + + const depType = saveTypeMap.get(addSaveType) + + pkg[depType] = pkg[depType] || {} + if (rawSpec !== '*' || pkg[depType][name] === undefined) { + pkg[depType][name] = rawSpec + } + if (addSaveType === 'optional') { + // Affordance for previous npm versions that require this behaviour + pkg.dependencies = pkg.dependencies || {} + pkg.dependencies[name] = pkg.optionalDependencies[name] + } + + if (addSaveType === 'peer' || addSaveType === 'peerOptional') { + const pdm = pkg.peerDependenciesMeta || {} + if (addSaveType === 'peer' && pdm[name] && pdm[name].optional) { + pdm[name].optional = false + } else if (addSaveType === 'peerOptional') { + pdm[name] = pdm[name] || {} + pdm[name].optional = true + pkg.peerDependenciesMeta = pdm + } + // peerDeps are often also a devDep, so that they can be tested when + // using package managers that don't auto-install peer deps + if (pkg.devDependencies && pkg.devDependencies[name] !== undefined) { + pkg.devDependencies[name] = pkg.peerDependencies[name] + } + } + + if (saveBundle && addSaveType !== 'peer' && addSaveType !== 'peerOptional') { + // keep it sorted, keep it unique + const bd = new Set(pkg.bundleDependencies || []) + bd.add(name) + pkg.bundleDependencies = [...bd].sort(localeCompare) + } + } + + return pkg +} + +// Canonical source of both the map between saveType and where it correlates to +// in the package, and the names of all our dependencies attributes +const saveTypeMap = new Map([ + ['dev', 'devDependencies'], + ['optional', 'optionalDependencies'], + ['prod', 'dependencies'], + ['peerOptional', 'peerDependencies'], + ['peer', 'peerDependencies'], +]) + +// Finds where the package is already in the spec and infers saveType from that +const inferSaveType = (pkg, name) => { + for (const saveType of saveTypeMap.keys()) { + if (hasSubKey(pkg, saveTypeMap.get(saveType), name)) { + if ( + saveType === 'peerOptional' && + (!hasSubKey(pkg, 'peerDependenciesMeta', name) || + !pkg.peerDependenciesMeta[name].optional) + ) { + return 'peer' + } + return saveType + } + } + return 'prod' +} + +const hasSubKey = (pkg, depType, name) => { + return pkg[depType] && Object.prototype.hasOwnProperty.call(pkg[depType], name) +} + +// Removes a subkey and warns about it if it's being replaced +const deleteSubKey = (pkg, depType, name, replacedBy) => { + if (hasSubKey(pkg, depType, name)) { + if (replacedBy) { + log.warn('idealTree', `Removing ${depType}.${name} in favor of ${replacedBy}.${name}`) + } + delete pkg[depType][name] + + // clean up peerDepsMeta if we are removing something from peerDependencies + if (depType === 'peerDependencies' && pkg.peerDependenciesMeta) { + delete pkg.peerDependenciesMeta[name] + if (!Object.keys(pkg.peerDependenciesMeta).length) { + delete pkg.peerDependenciesMeta + } + } + + if (!Object.keys(pkg[depType]).length) { + delete pkg[depType] + } + } +} + +const rm = (pkg, rm) => { + for (const depType of new Set(saveTypeMap.values())) { + for (const name of rm) { + deleteSubKey(pkg, depType, name) + } + } + if (pkg.bundleDependencies) { + pkg.bundleDependencies = pkg.bundleDependencies + .filter(name => !rm.includes(name)) + if (!pkg.bundleDependencies.length) { + delete pkg.bundleDependencies + } + } + return pkg +} + +module.exports = { add, rm, saveTypeMap, hasSubKey } diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js new file mode 100644 index 00000000..6bd4e940 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -0,0 +1,1523 @@ +// mixin implementing the buildIdealTree method +const localeCompare = require('@isaacs/string-locale-compare')('en') +const rpj = require('read-package-json-fast') +const npa = require('npm-package-arg') +const pacote = require('pacote') +const cacache = require('cacache') +const { callLimit: promiseCallLimit } = require('promise-call-limit') +const realpath = require('../../lib/realpath.js') +const { resolve, dirname } = require('node:path') +const treeCheck = require('../tree-check.js') +const { readdirScoped } = require('@npmcli/fs') +const { lstat, readlink } = require('node:fs/promises') +const { depth } = require('treeverse') +const { log, time } = require('proc-log') +const { redact } = require('@npmcli/redact') + +const { + OK, + REPLACE, + CONFLICT, +} = require('../can-place-dep.js') +const PlaceDep = require('../place-dep.js') + +const debug = require('../debug.js') +const fromPath = require('../from-path.js') +const calcDepFlags = require('../calc-dep-flags.js') +const Shrinkwrap = require('../shrinkwrap.js') +const { defaultLockfileVersion } = Shrinkwrap +const Node = require('../node.js') +const Link = require('../link.js') +const addRmPkgDeps = require('../add-rm-pkg-deps.js') +const optionalSet = require('../optional-set.js') +const { checkEngine, checkPlatform } = require('npm-install-checks') +const relpath = require('../relpath.js') +const resetDepFlags = require('../reset-dep-flags.js') + +// note: some of these symbols are shared so we can hit +// them with unit tests and reuse them across mixins +const _updateAll = Symbol.for('updateAll') +const _flagsSuspect = Symbol.for('flagsSuspect') +const _setWorkspaces = Symbol.for('setWorkspaces') +const _updateNames = Symbol.for('updateNames') +const _resolvedAdd = Symbol.for('resolvedAdd') +const _usePackageLock = Symbol.for('usePackageLock') +const _rpcache = Symbol.for('realpathCache') +const _stcache = Symbol.for('statCache') + +// used by Reify mixin +const _addNodeToTrashList = Symbol.for('addNodeToTrashList') + +// Push items in, pop them sorted by depth and then path +// Sorts physically shallower deps up to the front of the queue, because +// they'll affect things deeper in, then alphabetical for consistency between +// installs +class DepsQueue { + #deps = [] + #sorted = true + + get length () { + return this.#deps.length + } + + push (item) { + if (!this.#deps.includes(item)) { + this.#sorted = false + this.#deps.push(item) + } + } + + pop () { + if (!this.#sorted) { + this.#deps.sort((a, b) => (a.depth - b.depth) || localeCompare(a.path, b.path)) + this.#sorted = true + } + return this.#deps.shift() + } +} + +module.exports = cls => class IdealTreeBuilder extends cls { + #complete + #currentDep = null + #depsQueue = new DepsQueue() + #depsSeen = new Set() + #explicitRequests = new Set() + #follow + #installStrategy + #linkNodes = new Set() + #loadFailures = new Set() + #manifests = new Map() + #mutateTree = false + // a map of each module in a peer set to the thing that depended on + // that set of peers in the first place. Use a WeakMap so that we + // don't hold onto references for nodes that are garbage collected. + #peerSetSource = new WeakMap() + #preferDedupe = false + #prune + #strictPeerDeps + #virtualRoots = new Map() + + constructor (options) { + super(options) + + // normalize trailing slash + const registry = options.registry || 'https://registry.npmjs.org' + options.registry = this.registry = registry.replace(/\/+$/, '') + '/' + + const { + follow = false, + installStrategy = 'hoisted', + idealTree = null, + installLinks = false, + legacyPeerDeps = false, + packageLock = true, + strictPeerDeps = false, + workspaces, + global, + } = options + + this.#strictPeerDeps = !!strictPeerDeps + + this.idealTree = idealTree + this.installLinks = installLinks + this.legacyPeerDeps = legacyPeerDeps + + this[_usePackageLock] = packageLock + this.#installStrategy = global ? 'shallow' : installStrategy + this.#follow = !!follow + + if (workspaces?.length && global) { + throw new Error('Cannot operate on workspaces in global mode') + } + + this[_updateAll] = false + this[_updateNames] = [] + this[_resolvedAdd] = [] + } + + get explicitRequests () { + return new Set(this.#explicitRequests) + } + + // public method + async buildIdealTree (options = {}) { + if (this.idealTree) { + return this.idealTree + } + + // allow the user to set reify options on the ctor as well. + // XXX: deprecate separate reify() options object. + options = { ...this.options, ...options } + + // an empty array or any falsey value is the same as null + if (!options.add || options.add.length === 0) { + options.add = null + } + if (!options.rm || options.rm.length === 0) { + options.rm = null + } + + const timeEnd = time.start('idealTree') + + if (!options.add && !options.rm && !options.update && this.options.global) { + throw new Error('global requires add, rm, or update option') + } + + // first get the virtual tree, if possible. If there's a lockfile, then + // that defines the ideal tree, unless the root package.json is not + // satisfied by what the ideal tree provides. + // from there, we start adding nodes to it to satisfy the deps requested + // by the package.json in the root. + + this.#parseSettings(options) + + // start tracker block + this.addTracker('idealTree') + + try { + await this.#initTree() + await this.#inflateAncientLockfile() + await this.#applyUserRequests(options) + await this.#buildDeps() + await this.#fixDepFlags() + await this.#pruneFailedOptional() + await this.#checkEngineAndPlatform() + } finally { + timeEnd() + this.finishTracker('idealTree') + } + + return treeCheck(this.idealTree) + } + + async #checkEngineAndPlatform () { + const { engineStrict, npmVersion, nodeVersion } = this.options + for (const node of this.idealTree.inventory.values()) { + if (!node.optional) { + try { + // if devEngines is present in the root node we ignore the engines check + if (!(node.isRoot && node.package.devEngines)) { + checkEngine(node.package, npmVersion, nodeVersion, this.options.force) + } + } catch (err) { + if (engineStrict) { + throw err + } + log.warn(err.code, err.message, { + package: err.pkgid, + required: err.required, + current: err.current, + }) + } + checkPlatform(node.package, this.options.force) + } + } + } + + #parseSettings (options) { + const update = options.update === true ? { all: true } + : Array.isArray(options.update) ? { names: options.update } + : options.update || {} + + if (update.all || !Array.isArray(update.names)) { + update.names = [] + } + + this.#complete = !!options.complete + this.#preferDedupe = !!options.preferDedupe + + // validates list of update names, they must + // be dep names only, no semver ranges are supported + for (const name of update.names) { + const spec = npa(name) + const validationError = + new TypeError(`Update arguments must only contain package names, eg: + npm update ${spec.name}`) + validationError.code = 'EUPDATEARGS' + + // If they gave us anything other than a bare package name + if (spec.raw !== spec.name) { + throw validationError + } + } + this[_updateNames] = update.names + + this[_updateAll] = update.all + // we prune by default unless explicitly set to boolean false + this.#prune = options.prune !== false + + // set if we add anything, but also set here if we know we'll make + // changes and thus have to maybe prune later. + this.#mutateTree = !!( + options.add || + options.rm || + update.all || + update.names.length + ) + } + + // load the initial tree, either the virtualTree from a shrinkwrap, + // or just the root node from a package.json + async #initTree () { + const timeEnd = time.start('idealTree:init') + let root + if (this.options.global) { + root = await this.#globalRootNode() + } else { + try { + const pkg = await rpj(this.path + '/package.json') + root = await this.#rootNodeFromPackage(pkg) + } catch (err) { + if (err.code === 'EJSONPARSE') { + throw err + } + root = await this.#rootNodeFromPackage({}) + } + } + return this[_setWorkspaces](root) + // ok to not have a virtual tree. probably initial install. + // When updating all, we load the shrinkwrap, but don't bother + // to build out the full virtual tree from it, since we'll be + // reconstructing it anyway. + .then(root => this.options.global ? root + : !this[_usePackageLock] || this[_updateAll] + ? Shrinkwrap.reset({ + path: this.path, + lockfileVersion: this.options.lockfileVersion, + resolveOptions: this.options, + }).then(meta => Object.assign(root, { meta })) + : this.loadVirtual({ root })) + + // if we don't have a lockfile to go from, then start with the + // actual tree, so we only make the minimum required changes. + // don't do this for global installs or updates, because in those + // cases we don't use a lockfile anyway. + // Load on a new Arborist object, so the Nodes aren't the same, + // or else it'll get super confusing when we change them! + .then(async root => { + if ((!this[_updateAll] && !this.options.global && !root.meta.loadedFromDisk) || (this.options.global && this[_updateNames].length)) { + await new this.constructor(this.options).loadActual({ root }) + const tree = root.target + // even though we didn't load it from a package-lock.json FILE, + // we still loaded it "from disk", meaning we have to reset + // dep flags before assuming that any mutations were reflected. + if (tree.children.size) { + root.meta.loadedFromDisk = true + // set these so that we don't try to ancient lockfile reload it + root.meta.originalLockfileVersion = root.meta.lockfileVersion = this.options.lockfileVersion || defaultLockfileVersion + } + } + root.meta.inferFormattingOptions(root.package) + return root + }) + + .then(tree => { + // search the virtual tree for invalid edges, if any are found add their source to + // the depsQueue so that we'll fix it later + depth({ + tree, + getChildren: (node) => { + const children = [] + for (const edge of node.edgesOut.values()) { + children.push(edge.to) + } + return children + }, + filter: node => node, + visit: node => { + for (const edge of node.edgesOut.values()) { + if (!edge.valid) { + this.#depsQueue.push(node) + break // no need to continue the loop after the first hit + } + } + }, + }) + // null the virtual tree, because we're about to hack away at it + // if you want another one, load another copy. + this.idealTree = tree + this.virtualTree = null + timeEnd() + return tree + }) + } + + async #globalRootNode () { + const root = await this.#rootNodeFromPackage({ dependencies: {} }) + // this is a gross kludge to handle the fact that we don't save + // metadata on the root node in global installs, because the "root" + // node is something like /usr/local/lib. + const meta = new Shrinkwrap({ + path: this.path, + lockfileVersion: this.options.lockfileVersion, + resolveOptions: this.options, + }) + meta.reset() + root.meta = meta + return root + } + + async #rootNodeFromPackage (pkg) { + // if the path doesn't exist, then we explode at this point. Note that + // this is not a problem for reify(), since it creates the root path + // before ever loading trees. + // TODO: make buildIdealTree() and loadActual handle a missing root path, + // or a symlink to a missing target, and let reify() create it as needed. + const real = await realpath(this.path, this[_rpcache], this[_stcache]) + const Cls = real === this.path ? Node : Link + const root = new Cls({ + path: this.path, + realpath: real, + pkg, + extraneous: false, + dev: false, + devOptional: false, + peer: false, + optional: false, + global: this.options.global, + installLinks: this.installLinks, + legacyPeerDeps: this.legacyPeerDeps, + loadOverrides: true, + }) + if (root.isLink) { + root.target = new Node({ + path: real, + realpath: real, + pkg, + extraneous: false, + dev: false, + devOptional: false, + peer: false, + optional: false, + global: this.options.global, + installLinks: this.installLinks, + legacyPeerDeps: this.legacyPeerDeps, + root, + }) + } + return root + } + + // process the add/rm requests by modifying the root node, and the + // update.names request by queueing nodes dependent on those named. + async #applyUserRequests (options) { + const timeEnd = time.start('idealTree:userRequests') + const tree = this.idealTree.target + + if (!this.options.workspaces.length) { + await this.#applyUserRequestsToNode(tree, options) + } else { + const nodes = this.workspaceNodes(tree, this.options.workspaces) + if (this.options.includeWorkspaceRoot) { + nodes.push(tree) + } + const appliedRequests = nodes.map( + node => this.#applyUserRequestsToNode(node, options) + ) + await Promise.all(appliedRequests) + } + + timeEnd() + } + + async #applyUserRequestsToNode (tree, options) { + // If we have a list of package names to update, and we know it's + // going to update them wherever they are, add any paths into those + // named nodes to the buildIdealTree queue. + if (!this.options.global && this[_updateNames].length) { + this.#queueNamedUpdates() + } + + // global updates only update the globalTop nodes, but we need to know + // that they're there, and not reinstall the world unnecessarily. + const globalExplicitUpdateNames = [] + if (this.options.global && (this[_updateAll] || this[_updateNames].length)) { + const nm = resolve(this.path, 'node_modules') + const paths = await readdirScoped(nm).catch(() => []) + for (const p of paths) { + const name = p.replace(/\\/g, '/') + tree.package.dependencies = tree.package.dependencies || {} + const updateName = this[_updateNames].includes(name) + if (this[_updateAll] || updateName) { + if (updateName) { + globalExplicitUpdateNames.push(name) + } + const dir = resolve(nm, name) + const st = await lstat(dir) + .catch(/* istanbul ignore next */ () => null) + if (st && st.isSymbolicLink()) { + const target = await readlink(dir) + const real = resolve(dirname(dir), target).replace(/#/g, '%23') + tree.package.dependencies[name] = `file:${real}` + } else { + tree.package.dependencies[name] = '*' + } + } + } + } + + if (this.auditReport && this.auditReport.size > 0) { + await this.#queueVulnDependents(options) + } + + const { add, rm } = options + + if (rm && rm.length) { + addRmPkgDeps.rm(tree.package, rm) + for (const name of rm) { + this.#explicitRequests.add({ from: tree, name, action: 'DELETE' }) + } + } + + if (add && add.length) { + await this.#add(tree, options) + } + + // triggers a refresh of all edgesOut. this has to be done BEFORE + // adding the edges to explicitRequests, because the package setter + // resets all edgesOut. + if (add && add.length || rm && rm.length || this.options.global) { + tree.package = tree.package + } + + for (const spec of this[_resolvedAdd]) { + if (spec.tree === tree) { + this.#explicitRequests.add(tree.edgesOut.get(spec.name)) + } + } + for (const name of globalExplicitUpdateNames) { + this.#explicitRequests.add(tree.edgesOut.get(name)) + } + + this.#depsQueue.push(tree) + } + + // This returns a promise because we might not have the name yet, and need to + // call pacote.manifest to find the name. + async #add (tree, { add, saveType = null, saveBundle = false }) { + // If we have a link it will need to be added relative to the target's path + const path = tree.target.path + + // get the name for each of the specs in the list. + // ie, doing `foo@bar` we just return foo but if it's a url or git, we + // don't know the name until we fetch it and look in its manifest. + await Promise.all(add.map(async rawSpec => { + // We do NOT provide the path to npa here, because user-additions need to + // be resolved relative to the tree being added to. + let spec = npa(rawSpec) + + // if it's just @'' then we reload whatever's there, or get latest + // if it's an explicit tag, we need to install that specific tag version + const isTag = spec.rawSpec && spec.type === 'tag' + + // look up the names of file/directory/git specs + if (!spec.name || isTag) { + const mani = await pacote.manifest(spec, { ...this.options }) + if (isTag) { + // translate tag to a version + spec = npa(`${mani.name}@${mani.version}`) + } + spec.name = mani.name + } + + const { name } = spec + if (spec.type === 'file') { + spec = npa(`file:${relpath(path, spec.fetchSpec).replace(/#/g, '%23')}`, path) + spec.name = name + } else if (spec.type === 'directory') { + try { + const real = await realpath(spec.fetchSpec, this[_rpcache], this[_stcache]) + spec = npa(`file:${relpath(path, real).replace(/#/g, '%23')}`, path) + spec.name = name + } catch { + // TODO: create synthetic test case to simulate realpath failure + } + } + spec.tree = tree + this[_resolvedAdd].push(spec) + })) + + // now this._resolvedAdd is a list of spec objects with names. + // find a home for each of them! + addRmPkgDeps.add({ + pkg: tree.package, + add: this[_resolvedAdd], + saveBundle, + saveType, + }) + } + + // TODO: provide a way to fix bundled deps by exposing metadata about + // what's in the bundle at each published manifest. Without that, we + // can't possibly fix bundled deps without breaking a ton of other stuff, + // and leaving the user subject to getting it overwritten later anyway. + async #queueVulnDependents (options) { + for (const vuln of this.auditReport.values()) { + for (const node of vuln.nodes) { + const bundler = node.getBundler() + + // XXX this belongs in the audit report itself, not here. + // We shouldn't even get these things here, and they shouldn't + // be printed by npm-audit-report as if they can be fixed, because + // they can't. + if (bundler) { + log.warn(`audit fix ${node.name}@${node.version}`, + `${node.location}\nis a bundled dependency of\n${ + bundler.name}@${bundler.version} at ${bundler.location}\n` + + 'It cannot be fixed automatically.\n' + + `Check for updates to the ${bundler.name} package.`) + continue + } + + for (const edge of node.edgesIn) { + this.addTracker('idealTree', edge.from.name, edge.from.location) + this.#depsQueue.push(edge.from) + } + } + } + + // note any that can't be fixed at the root level without --force + // if there's a fix, we use that. otherwise, the user has to remove it, + // find a different thing, fix the upstream, etc. + // + // XXX: how to handle top nodes that aren't the root? Maybe the report + // just tells the user to cd into that directory and fix it? + if (this.options.force && this.auditReport && this.auditReport.topVulns.size) { + options.add = options.add || [] + options.rm = options.rm || [] + const nodesTouched = new Set() + for (const [name, topVuln] of this.auditReport.topVulns.entries()) { + const { + simpleRange, + topNodes, + fixAvailable, + } = topVuln + for (const node of topNodes) { + if (!node.isProjectRoot && !node.isWorkspace) { + // not something we're going to fix, sorry. have to cd into + // that directory and fix it yourself. + log.warn('audit', 'Manual fix required in linked project ' + + `at ./${node.location} for ${name}@${simpleRange}.\n` + + `'cd ./${node.location}' and run 'npm audit' for details.`) + continue + } + + if (!fixAvailable) { + log.warn('audit', `No fix available for ${name}@${simpleRange}`) + continue + } + + // name may be different if parent fixes the dep + // see Vuln fixAvailable setter + const { isSemVerMajor, version, name: fixName } = fixAvailable + const breakingMessage = isSemVerMajor + ? 'a SemVer major change' + : 'outside your stated dependency range' + log.warn('audit', `Updating ${fixName} to ${version}, ` + + `which is ${breakingMessage}.`) + + await this.#add(node, { add: [`${fixName}@${version}`] }) + nodesTouched.add(node) + } + } + for (const node of nodesTouched) { + node.package = node.package + } + } + } + + #avoidRange (name) { + if (!this.auditReport) { + return null + } + const vuln = this.auditReport.get(name) + if (!vuln) { + return null + } + return vuln.range + } + + #queueNamedUpdates () { + // ignore top nodes, since they are not loaded the same way, and + // probably have their own project associated with them. + + // for every node with one of the names on the list, we add its + // dependents to the queue to be evaluated. in buildDepStep, + // anything on the update names list will get refreshed, even if + // it isn't a problem. + + // XXX this could be faster by doing a series of inventory.query('name') + // calls rather than walking over everything in the tree. + for (const node of this.idealTree.inventory.values()) { + // XXX add any invalid edgesOut to the queue + if (this[_updateNames].includes(node.name) && + !node.isTop && !node.inDepBundle && !node.inShrinkwrap) { + for (const edge of node.edgesIn) { + this.addTracker('idealTree', edge.from.name, edge.from.location) + this.#depsQueue.push(edge.from) + } + } + } + } + + async #inflateAncientLockfile () { + const { meta, inventory } = this.idealTree + const ancient = meta.ancientLockfile + const old = meta.loadedFromDisk && !(meta.originalLockfileVersion >= 2) + + if (inventory.size === 0 || !ancient && !old) { + return + } + + // if the lockfile is from node v5 or earlier, then we'll have to reload + // all the manifests of everything we encounter. this is costly, but at + // least it's just a one-time hit. + const timeEnd = time.start('idealTree:inflate') + + // don't warn if we're not gonna actually write it back anyway. + const heading = ancient ? 'ancient lockfile' : 'old lockfile' + if (ancient || !this.options.lockfileVersion || + this.options.lockfileVersion >= defaultLockfileVersion) { + log.warn(heading, + ` +The ${meta.type} file was created with an old version of npm, +so supplemental metadata must be fetched from the registry. + +This is a one-time fix-up, please be patient... +`) + } + + this.addTracker('idealTree:inflate') + const queue = [] + for (const node of inventory.values()) { + if (node.isProjectRoot) { + continue + } + + // if the node's location isn't within node_modules then this is actually + // a link target, so skip it. the link node itself will be queued later. + if (!node.location.startsWith('node_modules')) { + continue + } + + queue.push(async () => { + log.silly('inflate', node.location) + const { resolved, version, path, name, location, integrity } = node + // don't try to hit the registry for linked deps + const useResolved = resolved && ( + !version || resolved.startsWith('file:') + ) + const id = useResolved ? resolved : version + const spec = npa.resolve(name, id, dirname(path)) + const t = `idealTree:inflate:${location}` + this.addTracker(t) + try { + const mani = await pacote.manifest(spec, { + ...this.options, + resolved: resolved, + integrity: integrity, + fullMetadata: false, + }) + node.package = { ...mani, _id: `${mani.name}@${mani.version}` } + } catch (er) { + const warning = `Could not fetch metadata for ${name}@${id}` + log.warn(heading, warning, er) + } + this.finishTracker(t) + }) + } + await promiseCallLimit(queue) + + // have to re-calc dep flags, because the nodes don't have edges + // until their packages get assigned, so everything looks extraneous + calcDepFlags(this.idealTree) + + // yes, yes, this isn't the "original" version, but now that it's been + // upgraded, we need to make sure we don't do the work to upgrade it + // again, since it's now as new as can be. + if (!this.options.lockfileVersion && !meta.hiddenLockfile) { + meta.originalLockfileVersion = defaultLockfileVersion + } + this.finishTracker('idealTree:inflate') + timeEnd() + } + + // at this point we have a virtual tree with the actual root node's + // package deps, which may be partly or entirely incomplete, invalid + // or extraneous. + #buildDeps () { + const timeEnd = time.start('idealTree:buildDeps') + const tree = this.idealTree.target + tree.assertRootOverrides() + this.#depsQueue.push(tree) + // XXX also push anything that depends on a node with a name + // in the override list + log.silly('idealTree', 'buildDeps') + this.addTracker('idealTree', tree.name, '') + return this.#buildDepStep().then(timeEnd) + } + + async #buildDepStep () { + // removes tracker of previous dependency in the queue + if (this.#currentDep) { + const { location, name } = this.#currentDep + time.end(`idealTree:${location || '#root'}`) + this.finishTracker('idealTree', name, location) + this.#currentDep = null + } + + if (!this.#depsQueue.length) { + return this.#resolveLinks() + } + + const node = this.#depsQueue.pop() + const bd = node.package.bundleDependencies + const hasBundle = bd && Array.isArray(bd) && bd.length + const { hasShrinkwrap } = node + + // if the node was already visited, or has since been removed from the + // tree, skip over it and process the rest of the queue. If a node has + // a shrinkwrap, also skip it, because it's going to get its deps + // satisfied by whatever's in that file anyway. + if (this.#depsSeen.has(node) || + node.root !== this.idealTree || + hasShrinkwrap && !this.#complete) { + return this.#buildDepStep() + } + + this.#depsSeen.add(node) + this.#currentDep = node + time.start(`idealTree:${node.location || '#root'}`) + + // if we're loading a _complete_ ideal tree, for a --package-lock-only + // installation for example, we have to crack open the tarball and + // look inside if it has bundle deps or shrinkwraps. note that this is + // not necessary during a reification, because we just update the + // ideal tree by reading bundles/shrinkwraps in place. + // Don't bother if the node is from the actual tree and hasn't + // been resolved, because we can't fetch it anyway, could be anything! + const crackOpen = this.#complete && + node !== this.idealTree && + node.resolved && + (hasBundle || hasShrinkwrap) + if (crackOpen) { + const Arborist = this.constructor + const opt = { ...this.options } + await cacache.tmp.withTmp(this.cache, opt, async path => { + await pacote.extract(node.resolved, path, { + ...opt, + Arborist, + resolved: node.resolved, + integrity: node.integrity, + }) + + if (hasShrinkwrap) { + await new Arborist({ ...this.options, path }) + .loadVirtual({ root: node }) + } + + if (hasBundle) { + await new Arborist({ ...this.options, path }) + .loadActual({ root: node, ignoreMissing: true }) + } + }) + } + + // if any deps are missing or invalid, then we fetch the manifest for + // the thing we want, and build a new dep node from that. + // Then, find the ideal placement for that node. The ideal placement + // searches from the node's deps (or parent deps in the case of non-root + // peer deps), and walks up the tree until it finds the highest spot + // where it doesn't cause any conflicts. + // + // A conflict can be: + // - A node by that name already exists at that location. + // - The parent has a peer dep on that name + // - One of the node's peer deps conflicts at that location, unless the + // peer dep is met by a node at that location, which is fine. + // + // If we create a new node, then build its ideal deps as well. + // + // Note: this is the same "maximally naive" deduping tree-building + // algorithm that npm has used since v3. In a case like this: + // + // root -> (a@1, b@1||2) + // a -> (b@1) + // + // You'll end up with a tree like this: + // + // root + // +-- a@1 + // | +-- b@1 + // +-- b@2 + // + // rather than this, more deduped, but just as correct tree: + // + // root + // +-- a@1 + // +-- b@1 + // + // Another way to look at it is that this algorithm favors getting higher + // version deps at higher levels in the tree, even if that reduces + // potential deduplication. + // + // Set `preferDedupe: true` in the options to replace the shallower + // dep if allowed. + + const tasks = [] + const peerSource = this.#peerSetSource.get(node) || node + for (const edge of this.#problemEdges(node)) { + if (edge.peerConflicted) { + continue + } + + // peerSetSource is only relevant when we have a peerEntryEdge + // otherwise we're setting regular non-peer deps as if they have + // a virtual root of whatever brought in THIS node. + // so we VR the node itself if the edge is not a peer + const source = edge.peer ? peerSource : node + + const virtualRoot = this.#virtualRoot(source, true) + // reuse virtual root if we already have one, but don't + // try to do the override ahead of time, since we MAY be able + // to create a more correct tree than the virtual root could. + const vrEdge = virtualRoot && virtualRoot.edgesOut.get(edge.name) + const vrDep = vrEdge && vrEdge.valid && vrEdge.to + // only re-use the virtualRoot if it's a peer edge we're placing. + // otherwise, we end up in situations where we override peer deps that + // we could have otherwise found homes for. Eg: + // xy -> (x, y) + // x -> PEER(z@1) + // y -> PEER(z@2) + // If xy is a dependency, we can resolve this like: + // project + // +-- xy + // | +-- y + // | +-- z@2 + // +-- x + // +-- z@1 + // But if x and y are loaded in the same virtual root, then they will + // be forced to agree on a version of z. + const required = new Set([edge.from]) + const parent = edge.peer ? virtualRoot : null + const dep = vrDep && vrDep.satisfies(edge) ? vrDep + : await this.#nodeFromEdge(edge, parent, null, required) + + /* istanbul ignore next */ + debug(() => { + if (!dep) { + throw new Error('no dep??') + } + }) + + tasks.push({ edge, dep }) + } + + const placeDeps = tasks.sort((a, b) => localeCompare(a.edge.name, b.edge.name)) + + const promises = [] + for (const { edge, dep } of placeDeps) { + const pd = new PlaceDep({ + edge, + dep, + + auditReport: this.auditReport, + explicitRequest: this.#explicitRequests.has(edge), + force: this.options.force, + installLinks: this.installLinks, + installStrategy: this.#installStrategy, + legacyPeerDeps: this.legacyPeerDeps, + preferDedupe: this.#preferDedupe, + strictPeerDeps: this.#strictPeerDeps, + updateNames: this[_updateNames], + }) + // placing a dep is actually a tree of placing the dep itself + // and all of its peer group that aren't already met by the tree + depth({ + tree: pd, + getChildren: pd => pd.children, + visit: pd => { + const { placed, edge, canPlace: cpd } = pd + // if we didn't place anything, nothing to do here + if (!placed) { + return + } + + // we placed something, that means we changed the tree + if (placed.errors.length) { + this.#loadFailures.add(placed) + } + this.#mutateTree = true + if (cpd.canPlaceSelf === OK) { + for (const edgeIn of placed.edgesIn) { + if (edgeIn === edge) { + continue + } + const { from, valid, peerConflicted } = edgeIn + if (!peerConflicted && !valid && !this.#depsSeen.has(from)) { + this.addTracker('idealTree', from.name, from.location) + this.#depsQueue.push(edgeIn.from) + } + } + } else { + /* istanbul ignore else - should be only OK or REPLACE here */ + if (cpd.canPlaceSelf === REPLACE) { + // this may also create some invalid edges, for example if we're + // intentionally causing something to get nested which was + // previously placed in this location. + for (const edgeIn of placed.edgesIn) { + if (edgeIn === edge) { + continue + } + + const { valid, peerConflicted } = edgeIn + if (!valid && !peerConflicted) { + // if it's already been visited, we have to re-visit + // otherwise, just enqueue normally. + this.#depsSeen.delete(edgeIn.from) + this.#depsQueue.push(edgeIn.from) + } + } + } + } + + /* istanbul ignore if - should be impossible */ + if (cpd.canPlaceSelf === CONFLICT) { + debug(() => { + const er = new Error('placed with canPlaceSelf=CONFLICT') + throw Object.assign(er, { placeDep: pd }) + }) + return + } + + // lastly, also check for the missing deps of the node we placed, + // and any holes created by pruning out conflicted peer sets. + this.#depsQueue.push(placed) + for (const dep of pd.needEvaluation) { + this.#depsSeen.delete(dep) + this.#depsQueue.push(dep) + } + + // pre-fetch any problem edges, since we'll need these soon + // if it fails at this point, though, dont' worry because it + // may well be an optional dep that has gone missing. it'll + // fail later anyway. + for (const e of this.#problemEdges(placed)) { + // XXX This is somehow load bearing. This makes tests that print + // the ideal tree of a tree with tarball dependencies fail. This + // can't be changed or removed till we figure out why + // The test is named "tarball deps with transitive tarball deps" + promises.push(() => + this.#fetchManifest(npa.resolve(e.name, e.spec, fromPath(placed, e))) + .catch(() => null) + ) + } + }, + }) + } + + for (const { to } of node.edgesOut.values()) { + if (to && to.isLink && to.target) { + this.#linkNodes.add(to) + } + } + + await promiseCallLimit(promises) + return this.#buildDepStep() + } + + // loads a node from an edge, and then loads its peer deps (and their + // peer deps, on down the line) into a virtual root parent. + async #nodeFromEdge (edge, parent_, secondEdge, required) { + // create a virtual root node with the same deps as the node that + // is requesting this one, so that we can get all the peer deps in + // a context where they're likely to be resolvable. + // Note that the virtual root will also have virtual copies of the + // targets of any child Links, so that they resolve appropriately. + const parent = parent_ || this.#virtualRoot(edge.from) + + const spec = npa.resolve(edge.name, edge.spec, edge.from.path) + const first = await this.#nodeFromSpec(edge.name, spec, parent, edge) + + // we might have a case where the parent has a peer dependency on + // `foo@*` which resolves to v2, but another dep in the set has a + // peerDependency on `foo@1`. In that case, if we force it to be v2, + // we're unnecessarily triggering an ERESOLVE. + // If we have a second edge to worry about, and it's not satisfied + // by the first node, try a second and see if that satisfies the + // original edge here. + const spec2 = secondEdge && npa.resolve( + edge.name, + secondEdge.spec, + secondEdge.from.path + ) + const second = secondEdge && !secondEdge.valid + ? await this.#nodeFromSpec(edge.name, spec2, parent, secondEdge) + : null + + // pick the second one if they're both happy with that, otherwise first + const node = second && edge.valid ? second : first + // ensure the one we want is the one that's placed + node.parent = parent + + if (required.has(edge.from) && edge.type !== 'peerOptional' || + secondEdge && ( + required.has(secondEdge.from) && secondEdge.type !== 'peerOptional')) { + required.add(node) + } + + // keep track of the thing that caused this node to be included. + const src = parent.sourceReference + this.#peerSetSource.set(node, src) + + // do not load the peers along with the set if this is a global top pkg + // otherwise we'll be tempted to put peers as other top-level installed + // things, potentially clobbering what's there already, which is not + // what we want. the missing edges will be picked up on the next pass. + if (this.options.global && edge.from.isProjectRoot) { + return node + } + + // otherwise, we have to make sure that our peers can go along with us. + return this.#loadPeerSet(node, required) + } + + #virtualRoot (node, reuse = false) { + if (reuse && this.#virtualRoots.has(node)) { + return this.#virtualRoots.get(node) + } + + const vr = new Node({ + path: node.realpath, + sourceReference: node, + installLinks: this.installLinks, + legacyPeerDeps: this.legacyPeerDeps, + overrides: node.overrides, + }) + + // also need to set up any targets from any link deps, so that + // they are properly reflected in the virtual environment + for (const child of node.children.values()) { + if (child.isLink) { + new Node({ + path: child.realpath, + sourceReference: child.target, + root: vr, + }) + } + } + + this.#virtualRoots.set(node, vr) + return vr + } + + #problemEdges (node) { + // skip over any bundled deps, they're not our problem. + // Note that this WILL fetch bundled meta-deps which are also dependencies + // but not listed as bundled deps. When reifying, we first unpack any + // nodes that have bundleDependencies, then do a loadActual on them, move + // the nodes into the ideal tree, and then prune. So, fetching those + // possibly-bundled meta-deps at this point doesn't cause any worse + // problems than a few unnecessary packument fetches. + + // also skip over any nodes in the tree that failed to load, since those + // will crash the install later on anyway. + const bd = node.isProjectRoot || node.isWorkspace ? null + : node.package.bundleDependencies + const bundled = new Set(bd || []) + + const problems = [] + for (const edge of node.edgesOut.values()) { + // If it's included in a bundle, we take whatever is specified. + if (bundled.has(edge.name)) { + continue + } + + // If it's already been logged as a load failure, skip it. + if (edge.to && this.#loadFailures.has(edge.to)) { + continue + } + + // If it's shrinkwrapped, we use what the shrinkwap wants. + if (edge.to && edge.to.inShrinkwrap) { + continue + } + + // If the edge has no destination, that's a problem, unless + // if it's peerOptional and not explicitly requested. + if (!edge.to) { + if (edge.type !== 'peerOptional' || + this.#explicitRequests.has(edge)) { + problems.push(edge) + } + continue + } + + // If the edge has an error, there's a problem. + if (!edge.valid) { + problems.push(edge) + continue + } + + // If the edge is a workspace, and it's valid, leave it alone + if (edge.to.isWorkspace) { + continue + } + + // user explicitly asked to update this package by name, problem + if (this[_updateNames].includes(edge.name)) { + problems.push(edge) + continue + } + + // fixing a security vulnerability with this package, problem + if (this.auditReport && this.auditReport.isVulnerable(edge.to)) { + problems.push(edge) + continue + } + + // user has explicitly asked to install this package, problem + if (this.#explicitRequests.has(edge)) { + problems.push(edge) + continue + } + } + return problems + } + + async #fetchManifest (spec) { + const options = { + ...this.options, + avoid: this.#avoidRange(spec.name), + fullMetadata: true, + } + // get the intended spec and stored metadata from yarn.lock file, + // if available and valid. + spec = this.idealTree.meta.checkYarnLock(spec, options) + + if (this.#manifests.has(spec.raw)) { + return this.#manifests.get(spec.raw) + } else { + log.silly('fetch manifest', spec.raw.replace(spec.rawSpec, redact(spec.rawSpec))) + const mani = await pacote.manifest(spec, options) + this.#manifests.set(spec.raw, mani) + return mani + } + } + + #nodeFromSpec (name, spec, parent, edge) { + // pacote will slap integrity on its options, so we have to clone + // the object so it doesn't get mutated. + // Don't bother to load the manifest for link deps, because the target + // might be within another package that doesn't exist yet. + const { installLinks, legacyPeerDeps } = this + const isWorkspace = this.idealTree.workspaces && this.idealTree.workspaces.has(spec.name) + + // spec is a directory, link it unless installLinks is set or it's a workspace + // TODO post arborist refactor, will need to check for installStrategy=linked + if (spec.type === 'directory' && (isWorkspace || !installLinks)) { + return this.#linkFromSpec(name, spec, parent, edge) + } + + // if the spec matches a workspace name, then see if the workspace node will + // satisfy the edge. if it does, we return the workspace node to make sure it + // takes priority. + if (isWorkspace) { + const existingNode = this.idealTree.edgesOut.get(spec.name).to + if (existingNode && existingNode.isWorkspace && existingNode.satisfies(edge)) { + return existingNode + } + } + + // spec isn't a directory, and either isn't a workspace or the workspace we have + // doesn't satisfy the edge. try to fetch a manifest and build a node from that. + return this.#fetchManifest(spec) + .then(pkg => new Node({ name, pkg, parent, installLinks, legacyPeerDeps }), error => { + error.requiredBy = edge.from.location || '.' + + // failed to load the spec, either because of enotarget or + // fetch failure of some other sort. save it so we can verify + // later that it's optional, otherwise the error is fatal. + const n = new Node({ + name, + parent, + error, + installLinks, + legacyPeerDeps, + }) + this.#loadFailures.add(n) + return n + }) + } + + #linkFromSpec (name, spec, parent) { + const realpath = spec.fetchSpec + const { installLinks, legacyPeerDeps } = this + return rpj(realpath + '/package.json').catch(() => ({})).then(pkg => { + const link = new Link({ name, parent, realpath, pkg, installLinks, legacyPeerDeps }) + this.#linkNodes.add(link) + return link + }) + } + + // load all peer deps and meta-peer deps into the node's parent + // At the end of this, the node's peer-type outward edges are all + // resolved, and so are all of theirs, but other dep types are not. + // We prefer to get peer deps that meet the requiring node's dependency, + // if possible, since that almost certainly works (since that package was + // developed with this set of deps) and will typically be more restrictive. + // Note that the peers in the set can conflict either with each other, + // or with a direct dependency from the virtual root parent! In strict + // mode, this is always an error. In force mode, it never is, and we + // prefer the parent's non-peer dep over a peer dep, or the version that + // gets placed first. In non-strict mode, we behave strictly if the + // virtual root is based on the root project, and allow non-peer parent + // deps to override, but throw if no preference can be determined. + async #loadPeerSet (node, required) { + const peerEdges = [...node.edgesOut.values()] + // we typically only install non-optional peers, but we have to + // factor them into the peerSet so that we can avoid conflicts + .filter(e => e.peer && !(e.valid && e.to)) + .sort(({ name: a }, { name: b }) => localeCompare(a, b)) + + for (const edge of peerEdges) { + // already placed this one, and we're happy with it. + if (edge.valid && edge.to) { + continue + } + + const parentEdge = node.parent.edgesOut.get(edge.name) + const { isProjectRoot, isWorkspace } = node.parent.sourceReference + const isMine = isProjectRoot || isWorkspace + const conflictOK = this.options.force || !isMine && !this.#strictPeerDeps + + if (!edge.to) { + if (!parentEdge) { + // easy, just put the thing there + await this.#nodeFromEdge(edge, node.parent, null, required) + continue + } else { + // if the parent's edge is very broad like >=1, and the edge in + // question is something like 1.x, then we want to get a 1.x, not + // a 2.x. pass along the child edge as an advisory guideline. + // if the parent edge doesn't satisfy the child edge, and the + // child edge doesn't satisfy the parent edge, then we have + // a conflict. this is always a problem in strict mode, never + // in force mode, and a problem in non-strict mode if this isn't + // on behalf of our project. in all such cases, we warn at least. + const dep = await this.#nodeFromEdge( + parentEdge, + node.parent, + edge, + required + ) + + // hooray! that worked! + if (edge.valid) { + continue + } + + // allow it. either we're overriding, or it's not something + // that will be installed by default anyway, and we'll fail when + // we get to the point where we need to, if we need to. + if (conflictOK || !required.has(dep)) { + edge.peerConflicted = true + continue + } + + // problem + this.#failPeerConflict(edge, parentEdge) + } + } + + // There is something present already, and we're not happy about it + // See if the thing we WOULD be happy with is also going to satisfy + // the other dependents on the current node. + const current = edge.to + const dep = await this.#nodeFromEdge(edge, null, null, required) + if (dep.canReplace(current)) { + await this.#nodeFromEdge(edge, node.parent, null, required) + continue + } + + // at this point we know that there is a dep there, and + // we don't like it. always fail strictly, always allow forcibly or + // in non-strict mode if it's not our fault. don't warn here, because + // we are going to warn again when we place the deps, if we end up + // overriding for something else. If the thing that has this dep + // isn't also required, then there's a good chance we won't need it, + // so allow it for now and let it conflict if it turns out to actually + // be necessary for the installation. + if (conflictOK || !required.has(edge.from)) { + continue + } + + // ok, it's the root, or we're in unforced strict mode, so this is bad + this.#failPeerConflict(edge, parentEdge) + } + return node + } + + #failPeerConflict (edge, currentEdge) { + const expl = this.#explainPeerConflict(edge, currentEdge) + throw Object.assign(new Error('unable to resolve dependency tree'), expl) + } + + #explainPeerConflict (edge, currentEdge) { + const node = edge.from + const curNode = node.resolve(edge.name) + const current = curNode.explain() + return { + code: 'ERESOLVE', + current, + // it SHOULD be impossible to get here without a current node in place, + // but this at least gives us something report on when bugs creep into + // the tree handling logic. + currentEdge: currentEdge ? currentEdge.explain() : null, + edge: edge.explain(), + strictPeerDeps: this.#strictPeerDeps, + force: this.options.force, + } + } + + // go through all the links in the this.#linkNodes set + // for each one: + // - if outside the root, ignore it, assume it's fine, it's not our problem + // - if a node in the tree already, assign the target to that node. + // - if a path under an existing node, then assign that as the fsParent, + // and add it to the _depsQueue + // + // call buildDepStep if anything was added to the queue, otherwise we're done + #resolveLinks () { + for (const link of this.#linkNodes) { + this.#linkNodes.delete(link) + + // link we never ended up placing, skip it + if (link.root !== this.idealTree) { + continue + } + + const tree = this.idealTree.target + const external = !link.target.isDescendantOf(tree) + + // outside the root, somebody else's problem, ignore it + if (external && !this.#follow) { + continue + } + + // didn't find a parent for it or it has not been seen yet + // so go ahead and process it. + const unseenLink = (link.target.parent || link.target.fsParent) && + !this.#depsSeen.has(link.target) + + if (this.#follow && + !link.target.parent && + !link.target.fsParent || + unseenLink) { + this.addTracker('idealTree', link.target.name, link.target.location) + this.#depsQueue.push(link.target) + } + } + + if (this.#depsQueue.length) { + return this.#buildDepStep() + } + } + + #fixDepFlags () { + const timeEnd = time.start('idealTree:fixDepFlags') + const metaFromDisk = this.idealTree.meta.loadedFromDisk + const flagsSuspect = this[_flagsSuspect] + const mutateTree = this.#mutateTree + // if the options set prune:false, then we don't prune, but we still + // mark the extraneous items in the tree if we modified it at all. + // If we did no modifications, we just iterate over the extraneous nodes. + // if we started with an empty tree, then the dep flags are already + // all set to true, and there can be nothing extraneous, so there's + // nothing to prune, because we built it from scratch. if we didn't + // add or remove anything, then also nothing to do. + if (metaFromDisk && mutateTree) { + resetDepFlags(this.idealTree) + } + + // update all the dev/optional/etc flags in the tree + // either we started with a fresh tree, or we + // reset all the flags to find the extraneous nodes. + // + // if we started from a blank slate, or changed something, then + // the dep flags will be all set to true. + if (!metaFromDisk || mutateTree) { + calcDepFlags(this.idealTree) + } else { + // otherwise just unset all the flags on the root node + // since they will sometimes have the default value + this.idealTree.extraneous = false + this.idealTree.dev = false + this.idealTree.optional = false + this.idealTree.devOptional = false + this.idealTree.peer = false + } + + // at this point, any node marked as extraneous should be pruned. + // if we started from a shrinkwrap, and then added/removed something, + // then the tree is suspect. Prune what is marked as extraneous. + // otherwise, don't bother. + const needPrune = metaFromDisk && (mutateTree || flagsSuspect) + if (this.#prune && needPrune) { + this.#idealTreePrune() + for (const node of this.idealTree.inventory.values()) { + if (node.extraneous) { + node.parent = null + } + } + } + + timeEnd() + } + + #idealTreePrune () { + for (const node of this.idealTree.inventory.values()) { + if (node.extraneous) { + node.parent = null + } + } + } + + #pruneFailedOptional () { + for (const node of this.#loadFailures) { + if (!node.optional) { + throw node.errors[0] + } + + const set = optionalSet(node) + for (const node of set) { + node.parent = null + } + } + } + + async prune (options = {}) { + // allow the user to set options on the ctor as well. + // XXX: deprecate separate method options objects. + options = { ...this.options, ...options } + + await this.buildIdealTree(options) + + this.#idealTreePrune() + + if (!this.options.workspacesEnabled) { + const excludeNodes = this.excludeWorkspacesDependencySet(this.idealTree) + for (const node of this.idealTree.inventory.values()) { + if ( + node.parent !== null + && !node.isProjectRoot + && !excludeNodes.has(node) + ) { + this[_addNodeToTrashList](node) + } + } + } + + return this.reify(options) + } +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/index.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/index.js new file mode 100644 index 00000000..3622f957 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/index.js @@ -0,0 +1,280 @@ +// The arborist manages three trees: +// - actual +// - virtual +// - ideal +// +// The actual tree is what's present on disk in the node_modules tree +// and elsewhere that links may extend. +// +// The virtual tree is loaded from metadata (package.json and lock files). +// +// The ideal tree is what we WANT that actual tree to become. This starts +// with the virtual tree, and then applies the options requesting +// add/remove/update actions. +// +// To reify a tree, we calculate a diff between the ideal and actual trees, +// and then turn the actual tree into the ideal tree by taking the actions +// required. At the end of the reification process, the actualTree is +// updated to reflect the changes. +// +// Each tree has an Inventory at the root. Shrinkwrap is tracked by Arborist +// instance. It always refers to the actual tree, but is updated (and written +// to disk) on reification. + +// Each of the mixin "classes" adds functionality, but are not dependent on +// constructor call order. So, we just load them in an array, and build up +// the base class, so that the overall voltron class is easier to test and +// cover, and separation of concerns can be maintained. + +const { resolve } = require('node:path') +const { homedir } = require('node:os') +const { depth } = require('treeverse') +const mapWorkspaces = require('@npmcli/map-workspaces') +const { log, time } = require('proc-log') +const { saveTypeMap } = require('../add-rm-pkg-deps.js') +const AuditReport = require('../audit-report.js') +const relpath = require('../relpath.js') +const PackumentCache = require('../packument-cache.js') + +const mixins = [ + require('../tracker.js'), + require('./build-ideal-tree.js'), + require('./load-actual.js'), + require('./load-virtual.js'), + require('./rebuild.js'), + require('./reify.js'), + require('./isolated-reifier.js'), +] + +const _setWorkspaces = Symbol.for('setWorkspaces') +const Base = mixins.reduce((a, b) => b(a), require('node:events')) + +// if it's 1, 2, or 3, set it explicitly that. +// if undefined or null, set it null +// otherwise, throw. +const lockfileVersion = lfv => { + if (lfv === 1 || lfv === 2 || lfv === 3) { + return lfv + } + + if (lfv === undefined || lfv === null) { + return null + } + + throw new TypeError('Invalid lockfileVersion config: ' + lfv) +} + +class Arborist extends Base { + constructor (options = {}) { + const timeEnd = time.start('arborist:ctor') + super(options) + this.options = { + nodeVersion: process.version, + ...options, + Arborist: this.constructor, + binLinks: 'binLinks' in options ? !!options.binLinks : true, + cache: options.cache || `${homedir()}/.npm/_cacache`, + dryRun: !!options.dryRun, + formatPackageLock: 'formatPackageLock' in options ? !!options.formatPackageLock : true, + force: !!options.force, + global: !!options.global, + ignoreScripts: !!options.ignoreScripts, + installStrategy: options.global ? 'shallow' : (options.installStrategy ? options.installStrategy : 'hoisted'), + lockfileVersion: lockfileVersion(options.lockfileVersion), + packageLockOnly: !!options.packageLockOnly, + packumentCache: options.packumentCache || new PackumentCache(), + path: options.path || '.', + rebuildBundle: 'rebuildBundle' in options ? !!options.rebuildBundle : true, + replaceRegistryHost: options.replaceRegistryHost, + savePrefix: 'savePrefix' in options ? options.savePrefix : '^', + scriptShell: options.scriptShell, + workspaces: options.workspaces || [], + workspacesEnabled: options.workspacesEnabled !== false, + } + // TODO we only ever look at this.options.replaceRegistryHost, not + // this.replaceRegistryHost. Defaulting needs to be written back to + // this.options to work properly + this.replaceRegistryHost = this.options.replaceRegistryHost = + (!this.options.replaceRegistryHost || this.options.replaceRegistryHost === 'npmjs') ? + 'registry.npmjs.org' : this.options.replaceRegistryHost + + if (options.saveType && !saveTypeMap.get(options.saveType)) { + throw new Error(`Invalid saveType ${options.saveType}`) + } + this.cache = resolve(this.options.cache) + this.diff = null + this.path = resolve(this.options.path) + timeEnd() + } + + // TODO: We should change these to static functions instead + // of methods for the next major version + + // Get the actual nodes corresponding to a root node's child workspaces, + // given a list of workspace names. + workspaceNodes (tree, workspaces) { + const wsMap = tree.workspaces + if (!wsMap) { + log.warn('workspaces', 'filter set, but no workspaces present') + return [] + } + + const nodes = [] + for (const name of workspaces) { + const path = wsMap.get(name) + if (!path) { + log.warn('workspaces', `${name} in filter set, but not in workspaces`) + continue + } + + const loc = relpath(tree.realpath, path) + const node = tree.inventory.get(loc) + + if (!node) { + log.warn('workspaces', `${name} in filter set, but no workspace folder present`) + continue + } + + nodes.push(node) + } + + return nodes + } + + // returns a set of workspace nodes and all their deps + // TODO why is includeWorkspaceRoot a param? + // TODO why is workspaces a param? + workspaceDependencySet (tree, workspaces, includeWorkspaceRoot) { + const wsNodes = this.workspaceNodes(tree, workspaces) + if (includeWorkspaceRoot) { + for (const edge of tree.edgesOut.values()) { + if (edge.type !== 'workspace' && edge.to) { + wsNodes.push(edge.to) + } + } + } + const wsDepSet = new Set(wsNodes) + const extraneous = new Set() + for (const node of wsDepSet) { + for (const edge of node.edgesOut.values()) { + const dep = edge.to + if (dep) { + wsDepSet.add(dep) + if (dep.isLink) { + wsDepSet.add(dep.target) + } + } + } + for (const child of node.children.values()) { + if (child.extraneous) { + extraneous.add(child) + } + } + } + for (const extra of extraneous) { + wsDepSet.add(extra) + } + + return wsDepSet + } + + // returns a set of root dependencies, excluding dependencies that are + // exclusively workspace dependencies + excludeWorkspacesDependencySet (tree) { + const rootDepSet = new Set() + depth({ + tree, + visit: node => { + for (const { to } of node.edgesOut.values()) { + if (!to || to.isWorkspace) { + continue + } + for (const edgeIn of to.edgesIn.values()) { + if (edgeIn.from.isRoot || rootDepSet.has(edgeIn.from)) { + rootDepSet.add(to) + } + } + } + return node + }, + filter: node => node, + getChildren: (node, tree) => + [...tree.edgesOut.values()].map(edge => edge.to), + }) + return rootDepSet + } + + async [_setWorkspaces] (node) { + const workspaces = await mapWorkspaces({ + cwd: node.path, + pkg: node.package, + }) + + if (node && workspaces.size) { + node.workspaces = workspaces + } + + return node + } + + async audit (options = {}) { + this.addTracker('audit') + if (this.options.global) { + throw Object.assign( + new Error('`npm audit` does not support testing globals'), + { code: 'EAUDITGLOBAL' } + ) + } + + // allow the user to set options on the ctor as well. + // XXX: deprecate separate method options objects. + options = { ...this.options, ...options } + + const timeEnd = time.start('audit') + let tree + if (options.packageLock === false) { + // build ideal tree + await this.loadActual(options) + await this.buildIdealTree() + tree = this.idealTree + } else { + tree = await this.loadVirtual() + } + if (this.options.workspaces.length) { + options.filterSet = this.workspaceDependencySet( + tree, + this.options.workspaces, + this.options.includeWorkspaceRoot + ) + } + if (!options.workspacesEnabled) { + options.filterSet = + this.excludeWorkspacesDependencySet(tree) + } + this.auditReport = await AuditReport.load(tree, options) + const ret = options.fix ? this.reify(options) : this.auditReport + timeEnd() + this.finishTracker('audit') + return ret + } + + async dedupe (options = {}) { + // allow the user to set options on the ctor as well. + // XXX: deprecate separate method options objects. + options = { ...this.options, ...options } + const tree = await this.loadVirtual().catch(() => this.loadActual()) + const names = [] + for (const name of tree.inventory.query('name')) { + if (tree.inventory.query('name', name).size > 1) { + names.push(name) + } + } + return this.reify({ + ...options, + preferDedupe: true, + update: { names }, + }) + } +} + +module.exports = Arborist diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/isolated-reifier.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/isolated-reifier.js new file mode 100644 index 00000000..4fbcd801 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/isolated-reifier.js @@ -0,0 +1,453 @@ +const _makeIdealGraph = Symbol('makeIdealGraph') +const _createIsolatedTree = Symbol.for('createIsolatedTree') +const _createBundledTree = Symbol('createBundledTree') +const { mkdirSync } = require('node:fs') +const pacote = require('pacote') +const { join } = require('node:path') +const { depth } = require('treeverse') +const crypto = require('node:crypto') + +// cache complicated function results +const memoize = (fn) => { + const memo = new Map() + return async function (arg) { + const key = arg + if (memo.has(key)) { + return memo.get(key) + } + const result = {} + memo.set(key, result) + await fn(result, arg) + return result + } +} + +module.exports = cls => class IsolatedReifier extends cls { + /** + * Create an ideal graph. + * + * An implementation of npm RFC-0042 + * https://github.com/npm/rfcs/blob/main/accepted/0042-isolated-mode.md + * + * This entire file should be considered technical debt that will be resolved + * with an Arborist refactor or rewrite. Embedded logic in Nodes and Links, + * and the incremental state of building trees and reifying contains too many + * assumptions to do a linked mode properly. + * + * Instead, this approach takes a tree built from build-ideal-tree, and + * returns a new tree-like structure without the embedded logic of Node and + * Link classes. + * + * Since the RFC requires leaving the package-lock in place, this approach + * temporarily replaces the tree state for a couple of steps of reifying. + * + **/ + async [_makeIdealGraph] (options) { + /* Make sure that the ideal tree is build as the rest of + * the algorithm depends on it. + */ + const bitOpt = { + ...options, + complete: false, + } + await this.buildIdealTree(bitOpt) + const idealTree = this.idealTree + + this.rootNode = {} + const root = this.rootNode + this.counter = 0 + + // memoize to cache generating proxy Nodes + this.externalProxyMemo = memoize(this.externalProxy.bind(this)) + this.workspaceProxyMemo = memoize(this.workspaceProxy.bind(this)) + + root.external = [] + root.isProjectRoot = true + root.localLocation = idealTree.location + root.localPath = idealTree.path + root.workspaces = await Promise.all( + Array.from(idealTree.fsChildren.values(), this.workspaceProxyMemo)) + const processed = new Set() + const queue = [idealTree, ...idealTree.fsChildren] + while (queue.length !== 0) { + const next = queue.pop() + if (processed.has(next.location)) { + continue + } + processed.add(next.location) + next.edgesOut.forEach(e => { + if (!e.to || (next.package.bundleDependencies || next.package.bundledDependencies || []).includes(e.to.name)) { + return + } + queue.push(e.to) + }) + if (!next.isProjectRoot && !next.isWorkspace) { + root.external.push(await this.externalProxyMemo(next)) + } + } + + await this.assignCommonProperties(idealTree, root) + + this.idealGraph = root + } + + async workspaceProxy (result, node) { + result.localLocation = node.location + result.localPath = node.path + result.isWorkspace = true + result.resolved = node.resolved + await this.assignCommonProperties(node, result) + } + + async externalProxy (result, node) { + await this.assignCommonProperties(node, result) + if (node.hasShrinkwrap) { + const dir = join( + node.root.path, + 'node_modules', + '.store', + `${node.name}@${node.version}` + ) + mkdirSync(dir, { recursive: true }) + // TODO this approach feels wrong + // and shouldn't be necessary for shrinkwraps + await pacote.extract(node.resolved, dir, { + ...this.options, + resolved: node.resolved, + integrity: node.integrity, + }) + const Arborist = this.constructor + const arb = new Arborist({ ...this.options, path: dir }) + await arb[_makeIdealGraph]({ dev: false }) + this.rootNode.external.push(...arb.idealGraph.external) + arb.idealGraph.external.forEach(e => { + e.root = this.rootNode + e.id = `${node.id}=>${e.id}` + }) + result.localDependencies = [] + result.externalDependencies = arb.idealGraph.externalDependencies + result.externalOptionalDependencies = arb.idealGraph.externalOptionalDependencies + result.dependencies = [ + ...result.externalDependencies, + ...result.localDependencies, + ...result.externalOptionalDependencies, + ] + } + result.optional = node.optional + result.resolved = node.resolved + result.version = node.version + } + + async assignCommonProperties (node, result) { + function validEdgesOut (node) { + return [...node.edgesOut.values()].filter(e => e.to && e.to.target && !(node.package.bundledDepenedencies || node.package.bundleDependencies || []).includes(e.to.name)) + } + const edges = validEdgesOut(node) + const optionalDeps = edges.filter(e => e.optional).map(e => e.to.target) + const nonOptionalDeps = edges.filter(e => !e.optional).map(e => e.to.target) + + result.localDependencies = await Promise.all(nonOptionalDeps.filter(n => n.isWorkspace).map(this.workspaceProxyMemo)) + result.externalDependencies = await Promise.all(nonOptionalDeps.filter(n => !n.isWorkspace).map(this.externalProxyMemo)) + result.externalOptionalDependencies = await Promise.all(optionalDeps.map(this.externalProxyMemo)) + result.dependencies = [ + ...result.externalDependencies, + ...result.localDependencies, + ...result.externalOptionalDependencies, + ] + result.root = this.rootNode + result.id = this.counter++ + result.name = node.name + result.package = { ...node.package } + result.package.bundleDependencies = undefined + result.hasInstallScript = node.hasInstallScript + } + + async [_createBundledTree] () { + // TODO: make sure that idealTree object exists + const idealTree = this.idealTree + // TODO: test workspaces having bundled deps + const queue = [] + + for (const [, edge] of idealTree.edgesOut) { + if (edge.to && (idealTree.package.bundleDependencies || idealTree.package.bundledDependencies || []).includes(edge.to.name)) { + queue.push({ from: idealTree, to: edge.to }) + } + } + for (const child of idealTree.fsChildren) { + for (const [, edge] of child.edgesOut) { + if (edge.to && (child.package.bundleDependencies || child.package.bundledDependencies || []).includes(edge.to.name)) { + queue.push({ from: child, to: edge.to }) + } + } + } + + const processed = new Set() + const nodes = new Map() + const edges = [] + while (queue.length !== 0) { + const nextEdge = queue.pop() + const key = `${nextEdge.from.location}=>${nextEdge.to.location}` + // should be impossible, unless bundled is duped + /* istanbul ignore next */ + if (processed.has(key)) { + continue + } + processed.add(key) + const from = nextEdge.from + if (!from.isRoot && !from.isWorkspace) { + nodes.set(from.location, { location: from.location, resolved: from.resolved, name: from.name, optional: from.optional, pkg: { ...from.package, bundleDependencies: undefined } }) + } + const to = nextEdge.to + nodes.set(to.location, { location: to.location, resolved: to.resolved, name: to.name, optional: to.optional, pkg: { ...to.package, bundleDependencies: undefined } }) + edges.push({ from: from.isRoot ? 'root' : from.location, to: to.location }) + + to.edgesOut.forEach(e => { + // an edge out should always have a to + /* istanbul ignore else */ + if (e.to) { + queue.push({ from: e.from, to: e.to }) + } + }) + } + return { edges, nodes } + } + + async [_createIsolatedTree] () { + await this[_makeIdealGraph](this.options) + + const proxiedIdealTree = this.idealGraph + + const bundledTree = await this[_createBundledTree]() + + const treeHash = (startNode) => { + // generate short hash based on the dependency tree + // starting at this node + const deps = [] + const branch = [] + depth({ + tree: startNode, + getChildren: node => node.dependencies, + filter: node => node, + visit: node => { + branch.push(`${node.name}@${node.version}`) + deps.push(`${branch.join('->')}::${node.resolved}`) + }, + leave: () => { + branch.pop() + }, + }) + deps.sort() + return crypto.createHash('shake256', { outputLength: 16 }) + .update(deps.join(',')) + .digest('base64') + // Node v14 doesn't support base64url + .replace(/\+/g, '-') + .replace(/\//g, '_') + .replace(/=+$/m, '') + } + + const getKey = (idealTreeNode) => { + return `${idealTreeNode.name}@${idealTreeNode.version}-${treeHash(idealTreeNode)}` + } + + const root = { + fsChildren: [], + integrity: null, + inventory: new Map(), + isLink: false, + isRoot: true, + binPaths: [], + edgesIn: new Set(), + edgesOut: new Map(), + hasShrinkwrap: false, + parent: null, + // TODO: we should probably not reference this.idealTree + resolved: this.idealTree.resolved, + isTop: true, + path: proxiedIdealTree.root.localPath, + realpath: proxiedIdealTree.root.localPath, + package: proxiedIdealTree.root.package, + meta: { loadedFromDisk: false }, + global: false, + isProjectRoot: true, + children: [], + } + // root.inventory.set('', t) + // root.meta = this.idealTree.meta + // TODO We should mock better the inventory object because it is used by audit-report.js ... maybe + root.inventory.query = () => { + return [] + } + const processed = new Set() + proxiedIdealTree.workspaces.forEach(c => { + const workspace = { + edgesIn: new Set(), + edgesOut: new Map(), + children: [], + hasInstallScript: c.hasInstallScript, + binPaths: [], + package: c.package, + location: c.localLocation, + path: c.localPath, + realpath: c.localPath, + resolved: c.resolved, + } + root.fsChildren.push(workspace) + root.inventory.set(workspace.location, workspace) + }) + const generateChild = (node, location, pkg, inStore) => { + const newChild = { + global: false, + globalTop: false, + isProjectRoot: false, + isTop: false, + location, + name: node.name, + optional: node.optional, + top: { path: proxiedIdealTree.root.localPath }, + children: [], + edgesIn: new Set(), + edgesOut: new Map(), + binPaths: [], + fsChildren: [], + /* istanbul ignore next -- emulate Node */ + getBundler () { + return null + }, + hasShrinkwrap: false, + inDepBundle: false, + integrity: null, + isLink: false, + isRoot: false, + isInStore: inStore, + path: join(proxiedIdealTree.root.localPath, location), + realpath: join(proxiedIdealTree.root.localPath, location), + resolved: node.resolved, + version: pkg.version, + package: pkg, + } + newChild.target = newChild + root.children.push(newChild) + root.inventory.set(newChild.location, newChild) + } + proxiedIdealTree.external.forEach(c => { + const key = getKey(c) + if (processed.has(key)) { + return + } + processed.add(key) + const location = join('node_modules', '.store', key, 'node_modules', c.name) + generateChild(c, location, c.package, true) + }) + bundledTree.nodes.forEach(node => { + generateChild(node, node.location, node.pkg, false) + }) + bundledTree.edges.forEach(e => { + const from = e.from === 'root' ? root : root.inventory.get(e.from) + const to = root.inventory.get(e.to) + // Maybe optional should be propagated from the original edge + const edge = { optional: false, from, to } + from.edgesOut.set(to.name, edge) + to.edgesIn.add(edge) + }) + const memo = new Set() + + function processEdges (node, externalEdge) { + externalEdge = !!externalEdge + const key = getKey(node) + if (memo.has(key)) { + return + } + memo.add(key) + + let from, nmFolder + if (externalEdge) { + const fromLocation = join('node_modules', '.store', key, 'node_modules', node.name) + from = root.children.find(c => c.location === fromLocation) + nmFolder = join('node_modules', '.store', key, 'node_modules') + } else { + from = node.isProjectRoot ? root : root.fsChildren.find(c => c.location === node.localLocation) + nmFolder = join(node.localLocation, 'node_modules') + } + + const processDeps = (dep, optional, external) => { + optional = !!optional + external = !!external + + const location = join(nmFolder, dep.name) + const binNames = dep.package.bin && Object.keys(dep.package.bin) || [] + const toKey = getKey(dep) + + let target + if (external) { + const toLocation = join('node_modules', '.store', toKey, 'node_modules', dep.name) + target = root.children.find(c => c.location === toLocation) + } else { + target = root.fsChildren.find(c => c.location === dep.localLocation) + } + // TODO: we should no-op is an edge has already been created with the same fromKey and toKey + + binNames.forEach(bn => { + target.binPaths.push(join(from.realpath, 'node_modules', '.bin', bn)) + }) + + const link = { + global: false, + globalTop: false, + isProjectRoot: false, + edgesIn: new Set(), + edgesOut: new Map(), + binPaths: [], + isTop: false, + optional, + location: location, + path: join(dep.root.localPath, nmFolder, dep.name), + realpath: target.path, + name: toKey, + resolved: dep.resolved, + top: { path: dep.root.localPath }, + children: [], + fsChildren: [], + isLink: true, + isStoreLink: true, + isRoot: false, + package: { _id: 'abc', bundleDependencies: undefined, deprecated: undefined, bin: target.package.bin, scripts: dep.package.scripts }, + target, + } + const newEdge1 = { optional, from, to: link } + from.edgesOut.set(dep.name, newEdge1) + link.edgesIn.add(newEdge1) + const newEdge2 = { optional: false, from: link, to: target } + link.edgesOut.set(dep.name, newEdge2) + target.edgesIn.add(newEdge2) + root.children.push(link) + } + + for (const dep of node.localDependencies) { + processEdges(dep, false) + // nonOptional, local + processDeps(dep, false, false) + } + for (const dep of node.externalDependencies) { + processEdges(dep, true) + // nonOptional, external + processDeps(dep, false, true) + } + for (const dep of node.externalOptionalDependencies) { + processEdges(dep, true) + // optional, external + processDeps(dep, true, true) + } + } + + processEdges(proxiedIdealTree, false) + for (const node of proxiedIdealTree.workspaces) { + processEdges(node, false) + } + root.children.forEach(c => c.parent = root) + root.children.forEach(c => c.root = root) + root.root = root + root.target = root + return root + } +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js new file mode 100644 index 00000000..22c1c287 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js @@ -0,0 +1,438 @@ +// mix-in implementing the loadActual method + +const { relative, dirname, resolve, join, normalize } = require('node:path') + +const rpj = require('read-package-json-fast') +const { readdirScoped } = require('@npmcli/fs') +const { walkUp } = require('walk-up-path') +const ancestorPath = require('common-ancestor-path') +const treeCheck = require('../tree-check.js') + +const Shrinkwrap = require('../shrinkwrap.js') +const calcDepFlags = require('../calc-dep-flags.js') +const Node = require('../node.js') +const Link = require('../link.js') +const realpath = require('../realpath.js') + +// public symbols +const _changePath = Symbol.for('_changePath') +const _setWorkspaces = Symbol.for('setWorkspaces') +const _rpcache = Symbol.for('realpathCache') +const _stcache = Symbol.for('statCache') + +module.exports = cls => class ActualLoader extends cls { + #actualTree + // ensure when walking the tree that we don't call loadTree on the same + // actual node more than one time. + #actualTreeLoaded = new Set() + #actualTreePromise + + // cache of nodes when loading the actualTree, so that we avoid loaded the + // same node multiple times when symlinks attack. + #cache = new Map() + #filter + + // cache of link targets for setting fsParent links + // We don't do fsParent as a magic getter/setter, because it'd be too costly + // to keep up to date along the walk. + // And, we know that it can ONLY be relevant when the node is a target of a + // link, otherwise it'd be in a node_modules folder, so take advantage of + // that to limit the scans later. + #topNodes = new Set() + #transplantFilter + + constructor (options) { + super(options) + + // the tree of nodes on disk + this.actualTree = options.actualTree + + // caches for cached realpath calls + const cwd = process.cwd() + // assume that the cwd is real enough for our purposes + this[_rpcache] = new Map([[cwd, cwd]]) + this[_stcache] = new Map() + } + + // public method + // TODO remove options param in next semver major + async loadActual (options = {}) { + // In the past this.actualTree was set as a promise that eventually + // resolved, and overwrite this.actualTree with the resolved value. This + // was a problem because virtually no other code expects this.actualTree to + // be a promise. Instead we only set it once resolved, and also return it + // from the promise so that it is what's returned from this function when + // awaited. + if (this.actualTree) { + return this.actualTree + } + if (!this.#actualTreePromise) { + // allow the user to set options on the ctor as well. + // XXX: deprecate separate method options objects. + options = { ...this.options, ...options } + + this.#actualTreePromise = this.#loadActual(options) + .then(tree => { + // reset all deps to extraneous prior to recalc + if (!options.root) { + for (const node of tree.inventory.values()) { + node.extraneous = true + } + } + + // only reset root flags if we're not re-rooting, + // otherwise leave as-is + calcDepFlags(tree, !options.root) + this.actualTree = treeCheck(tree) + return this.actualTree + }) + } + return this.#actualTreePromise + } + + // return the promise so that we don't ever have more than one going at the + // same time. This is so that buildIdealTree can default to the actualTree + // if no shrinkwrap present, but reify() can still call buildIdealTree and + // loadActual in parallel safely. + + async #loadActual (options) { + // mostly realpath to throw if the root doesn't exist + const { + global, + filter = () => true, + root = null, + transplantFilter = () => true, + ignoreMissing = false, + forceActual = false, + } = options + this.#filter = filter + this.#transplantFilter = transplantFilter + + if (global) { + const real = await realpath(this.path, this[_rpcache], this[_stcache]) + const params = { + path: this.path, + realpath: real, + pkg: {}, + global, + loadOverrides: true, + } + if (this.path === real) { + this.#actualTree = this.#newNode(params) + } else { + this.#actualTree = await this.#newLink(params) + } + } else { + // not in global mode, hidden lockfile is allowed, load root pkg too + this.#actualTree = await this.#loadFSNode({ + path: this.path, + real: await realpath(this.path, this[_rpcache], this[_stcache]), + loadOverrides: true, + }) + + this.#actualTree.assertRootOverrides() + + // if forceActual is set, don't even try the hidden lockfile + if (!forceActual) { + // Note: hidden lockfile will be rejected if it's not the latest thing + // in the folder, or if any of the entries in the hidden lockfile are + // missing. + const meta = await Shrinkwrap.load({ + path: this.#actualTree.path, + hiddenLockfile: true, + resolveOptions: this.options, + }) + + if (meta.loadedFromDisk) { + this.#actualTree.meta = meta + // have to load on a new Arborist object, so we don't assign + // the virtualTree on this one! Also, the weird reference is because + // we can't easily get a ref to Arborist in this module, without + // creating a circular reference, since this class is a mixin used + // to build up the Arborist class itself. + await new this.constructor({ ...this.options }).loadVirtual({ + root: this.#actualTree, + }) + await this[_setWorkspaces](this.#actualTree) + + this.#transplant(root) + return this.#actualTree + } + } + + const meta = await Shrinkwrap.load({ + path: this.#actualTree.path, + lockfileVersion: this.options.lockfileVersion, + resolveOptions: this.options, + }) + this.#actualTree.meta = meta + } + + await this.#loadFSTree(this.#actualTree) + await this[_setWorkspaces](this.#actualTree) + + // if there are workspace targets without Link nodes created, load + // the targets, so that we know what they are. + if (this.#actualTree.workspaces && this.#actualTree.workspaces.size) { + const promises = [] + for (const path of this.#actualTree.workspaces.values()) { + if (!this.#cache.has(path)) { + // workspace overrides use the root overrides + const p = this.#loadFSNode({ path, root: this.#actualTree, useRootOverrides: true }) + .then(node => this.#loadFSTree(node)) + promises.push(p) + } + } + await Promise.all(promises) + } + + if (!ignoreMissing) { + await this.#findMissingEdges() + } + + // try to find a node that is the parent in a fs tree sense, but not a + // node_modules tree sense, of any link targets. this allows us to + // resolve deps that node will find, but a legacy npm view of the + // world would not have noticed. + for (const path of this.#topNodes) { + const node = this.#cache.get(path) + if (node && !node.parent && !node.fsParent) { + for (const p of walkUp(dirname(path))) { + if (this.#cache.has(p)) { + node.fsParent = this.#cache.get(p) + break + } + } + } + } + + this.#transplant(root) + + if (global) { + // need to depend on the children, or else all of them + // will end up being flagged as extraneous, since the + // global root isn't a "real" project + const tree = this.#actualTree + const actualRoot = tree.isLink ? tree.target : tree + const { dependencies = {} } = actualRoot.package + for (const [name, kid] of actualRoot.children.entries()) { + const def = kid.isLink ? `file:${kid.realpath.replace(/#/g, '%23')}` : '*' + dependencies[name] = dependencies[name] || def + } + actualRoot.package = { ...actualRoot.package, dependencies } + } + return this.#actualTree + } + + #transplant (root) { + if (!root || root === this.#actualTree) { + return + } + + this.#actualTree[_changePath](root.path) + for (const node of this.#actualTree.children.values()) { + if (!this.#transplantFilter(node)) { + node.root = null + } + } + + root.replace(this.#actualTree) + for (const node of this.#actualTree.fsChildren) { + node.root = this.#transplantFilter(node) ? root : null + } + + this.#actualTree = root + } + + async #loadFSNode ({ path, parent, real, root, loadOverrides, useRootOverrides }) { + if (!real) { + try { + real = await realpath(path, this[_rpcache], this[_stcache]) + } catch (error) { + // if realpath fails, just provide a dummy error node + return new Node({ + error, + path, + realpath: path, + parent, + root, + loadOverrides, + }) + } + } + + const cached = this.#cache.get(path) + let node + // missing edges get a dummy node, assign the parent and return it + if (cached && !cached.dummy) { + cached.parent = parent + return cached + } else { + const params = { + installLinks: this.installLinks, + legacyPeerDeps: this.legacyPeerDeps, + path, + realpath: real, + parent, + root, + loadOverrides, + } + + try { + const pkg = await rpj(join(real, 'package.json')) + params.pkg = pkg + if (useRootOverrides && root.overrides) { + params.overrides = root.overrides.getNodeRule({ name: pkg.name, version: pkg.version }) + } + } catch (err) { + params.error = err + } + + // soldier on if read-package-json raises an error, passing it to the + // Node which will attach it to its errors array (Link passes it along to + // its target node) + if (normalize(path) === real) { + node = this.#newNode(params) + } else { + node = await this.#newLink(params) + } + } + this.#cache.set(path, node) + return node + } + + #newNode (options) { + // check it for an fsParent if it's a tree top. there's a decent chance + // it'll get parented later, making the fsParent scan a no-op, but better + // safe than sorry, since it's cheap. + const { parent, realpath } = options + if (!parent) { + this.#topNodes.add(realpath) + } + return new Node(options) + } + + async #newLink (options) { + const { realpath } = options + this.#topNodes.add(realpath) + const target = this.#cache.get(realpath) + const link = new Link({ ...options, target }) + + if (!target) { + // Link set its target itself in this case + this.#cache.set(realpath, link.target) + // if a link target points at a node outside of the root tree's + // node_modules hierarchy, then load that node as well. + await this.#loadFSTree(link.target) + } + + return link + } + + async #loadFSTree (node) { + const did = this.#actualTreeLoaded + if (!node.isLink && !did.has(node.target.realpath)) { + did.add(node.target.realpath) + await this.#loadFSChildren(node.target) + return Promise.all( + [...node.target.children.entries()] + .filter(([, kid]) => !did.has(kid.realpath)) + .map(([, kid]) => this.#loadFSTree(kid)) + ) + } + } + + // create child nodes for all the entries in node_modules + // and attach them to the node as a parent + async #loadFSChildren (node) { + const nm = resolve(node.realpath, 'node_modules') + try { + const kids = await readdirScoped(nm).then(paths => paths.map(p => p.replace(/\\/g, '/'))) + return Promise.all( + // ignore . dirs and retired scoped package folders + kids.filter(kid => !/^(@[^/]+\/)?\./.test(kid)) + .filter(kid => this.#filter(node, kid)) + .map(kid => this.#loadFSNode({ + parent: node, + path: resolve(nm, kid), + }))) + } catch { + // error in the readdir is not fatal, just means no kids + } + } + + async #findMissingEdges () { + // try to resolve any missing edges by walking up the directory tree, + // checking for the package in each node_modules folder. stop at the + // root directory. + // The tricky move here is that we load a "dummy" node for the folder + // containing the node_modules folder, so that it can be assigned as + // the fsParent. It's a bad idea to *actually* load that full node, + // because people sometimes develop in ~/projects/node_modules/... + // so we'd end up loading a massive tree with lots of unrelated junk. + const nmContents = new Map() + const tree = this.#actualTree + for (const node of tree.inventory.values()) { + const ancestor = ancestorPath(node.realpath, this.path) + + const depPromises = [] + for (const [name, edge] of node.edgesOut.entries()) { + const notMissing = !edge.missing && + !(edge.to && (edge.to.dummy || edge.to.parent !== node)) + if (notMissing) { + continue + } + + // start the walk from the dirname, because we would have found + // the dep in the loadFSTree step already if it was local. + for (const p of walkUp(dirname(node.realpath))) { + // only walk as far as the nearest ancestor + // this keeps us from going into completely unrelated + // places when a project is just missing something, but + // allows for finding the transitive deps of link targets. + // ie, if it has to go up and back out to get to the path + // from the nearest common ancestor, we've gone too far. + if (ancestor && /^\.\.(?:[\\/]|$)/.test(relative(ancestor, p))) { + break + } + + let entries + if (!nmContents.has(p)) { + entries = await readdirScoped(p + '/node_modules') + .catch(() => []).then(paths => paths.map(p => p.replace(/\\/g, '/'))) + nmContents.set(p, entries) + } else { + entries = nmContents.get(p) + } + + if (!entries.includes(name)) { + continue + } + + let d + if (!this.#cache.has(p)) { + d = new Node({ path: p, root: node.root, dummy: true }) + this.#cache.set(p, d) + } else { + d = this.#cache.get(p) + } + if (d.dummy) { + // it's a placeholder, so likely would not have loaded this dep, + // unless another dep in the tree also needs it. + const depPath = normalize(`${p}/node_modules/${name}`) + const cached = this.#cache.get(depPath) + if (!cached || cached.dummy) { + depPromises.push(this.#loadFSNode({ + path: depPath, + root: node.root, + parent: d, + }).then(node => this.#loadFSTree(node))) + } + } + break + } + } + await Promise.all(depPromises) + } + } +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js new file mode 100644 index 00000000..7c51f8b9 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js @@ -0,0 +1,303 @@ +// mixin providing the loadVirtual method +const mapWorkspaces = require('@npmcli/map-workspaces') + +const { resolve } = require('node:path') + +const nameFromFolder = require('@npmcli/name-from-folder') +const consistentResolve = require('../consistent-resolve.js') +const Shrinkwrap = require('../shrinkwrap.js') +const Node = require('../node.js') +const Link = require('../link.js') +const relpath = require('../relpath.js') +const calcDepFlags = require('../calc-dep-flags.js') +const rpj = require('read-package-json-fast') +const treeCheck = require('../tree-check.js') + +const flagsSuspect = Symbol.for('flagsSuspect') +const setWorkspaces = Symbol.for('setWorkspaces') + +module.exports = cls => class VirtualLoader extends cls { + #rootOptionProvided + + constructor (options) { + super(options) + + // the virtual tree we load from a shrinkwrap + this.virtualTree = options.virtualTree + this[flagsSuspect] = false + } + + // public method + async loadVirtual (options = {}) { + if (this.virtualTree) { + return this.virtualTree + } + + // allow the user to set reify options on the ctor as well. + // XXX: deprecate separate reify() options object. + options = { ...this.options, ...options } + + if (options.root && options.root.meta) { + await this.#loadFromShrinkwrap(options.root.meta, options.root) + return treeCheck(this.virtualTree) + } + + const s = await Shrinkwrap.load({ + path: this.path, + lockfileVersion: this.options.lockfileVersion, + resolveOptions: this.options, + }) + if (!s.loadedFromDisk && !options.root) { + const er = new Error('loadVirtual requires existing shrinkwrap file') + throw Object.assign(er, { code: 'ENOLOCK' }) + } + + // when building the ideal tree, we pass in a root node to this function + // otherwise, load it from the root package json or the lockfile + const { + root = await this.#loadRoot(s), + } = options + + this.#rootOptionProvided = options.root + + await this.#loadFromShrinkwrap(s, root) + root.assertRootOverrides() + return treeCheck(this.virtualTree) + } + + async #loadRoot (s) { + const pj = this.path + '/package.json' + const pkg = await rpj(pj).catch(() => s.data.packages['']) || {} + return this[setWorkspaces](this.#loadNode('', pkg, true)) + } + + async #loadFromShrinkwrap (s, root) { + if (!this.#rootOptionProvided) { + // root is never any of these things, but might be a brand new + // baby Node object that never had its dep flags calculated. + root.extraneous = false + root.dev = false + root.optional = false + root.devOptional = false + root.peer = false + } else { + this[flagsSuspect] = true + } + + this.#checkRootEdges(s, root) + root.meta = s + this.virtualTree = root + const { links, nodes } = this.#resolveNodes(s, root) + await this.#resolveLinks(links, nodes) + if (!(s.originalLockfileVersion >= 2)) { + this.#assignBundles(nodes) + } + if (this[flagsSuspect]) { + // reset all dep flags + // can't use inventory here, because virtualTree might not be root + for (const node of nodes.values()) { + if (node.isRoot || node === this.#rootOptionProvided) { + continue + } + node.extraneous = true + node.dev = true + node.optional = true + node.devOptional = true + node.peer = true + } + calcDepFlags(this.virtualTree, !this.#rootOptionProvided) + } + return root + } + + // check the lockfile deps, and see if they match. if they do not + // then we have to reset dep flags at the end. for example, if the + // user manually edits their package.json file, then we need to know + // that the idealTree is no longer entirely trustworthy. + #checkRootEdges (s, root) { + // loaded virtually from tree, no chance of being out of sync + // ancient lockfiles are critically damaged by this process, + // so we need to just hope for the best in those cases. + if (!s.loadedFromDisk || s.ancientLockfile) { + return + } + + const lock = s.get('') + const prod = lock.dependencies || {} + const dev = lock.devDependencies || {} + const optional = lock.optionalDependencies || {} + const peer = lock.peerDependencies || {} + const peerOptional = {} + + if (lock.peerDependenciesMeta) { + for (const [name, meta] of Object.entries(lock.peerDependenciesMeta)) { + if (meta.optional && peer[name] !== undefined) { + peerOptional[name] = peer[name] + delete peer[name] + } + } + } + + for (const name of Object.keys(optional)) { + delete prod[name] + } + + const lockWS = {} + const workspaces = mapWorkspaces.virtual({ + cwd: this.path, + lockfile: s.data, + }) + + for (const [name, path] of workspaces.entries()) { + lockWS[name] = `file:${path.replace(/#/g, '%23')}` + } + + // Should rootNames exclude optional? + const rootNames = new Set(root.edgesOut.keys()) + + const lockByType = ({ dev, optional, peer, peerOptional, prod, workspace: lockWS }) + + // Find anything in shrinkwrap deps that doesn't match root's type or spec + for (const type in lockByType) { + const deps = lockByType[type] + for (const name in deps) { + const edge = root.edgesOut.get(name) + if (!edge || edge.type !== type || edge.spec !== deps[name]) { + return this[flagsSuspect] = true + } + rootNames.delete(name) + } + } + // Something was in root that's not accounted for in shrinkwrap + if (rootNames.size) { + return this[flagsSuspect] = true + } + } + + // separate out link metadatas, and create Node objects for nodes + #resolveNodes (s, root) { + const links = new Map() + const nodes = new Map([['', root]]) + for (const [location, meta] of Object.entries(s.data.packages)) { + // skip the root because we already got it + if (!location) { + continue + } + + if (meta.link) { + links.set(location, meta) + } else { + nodes.set(location, this.#loadNode(location, meta)) + } + } + return { links, nodes } + } + + // links is the set of metadata, and nodes is the map of non-Link nodes + // Set the targets to nodes in the set, if we have them (we might not) + async #resolveLinks (links, nodes) { + for (const [location, meta] of links.entries()) { + const targetPath = resolve(this.path, meta.resolved) + const targetLoc = relpath(this.path, targetPath) + const target = nodes.get(targetLoc) + const link = this.#loadLink(location, targetLoc, target, meta) + nodes.set(location, link) + nodes.set(targetLoc, link.target) + + // we always need to read the package.json for link targets + // outside node_modules because they can be changed by the local user + if (!link.target.parent) { + const pj = link.realpath + '/package.json' + const pkg = await rpj(pj).catch(() => null) + if (pkg) { + link.target.package = pkg + } + } + } + } + + #assignBundles (nodes) { + for (const [location, node] of nodes) { + // Skip assignment of parentage for the root package + if (!location || node.isLink && !node.target.location) { + continue + } + const { name, parent, package: { inBundle } } = node + + if (!parent) { + continue + } + + // read inBundle from package because 'package' here is + // actually a v2 lockfile metadata entry. + // If the *parent* is also bundled, though, or if the parent has + // no dependency on it, then we assume that it's being pulled in + // just by virtue of its parent or a transitive dep being bundled. + const { package: ppkg } = parent + const { inBundle: parentBundled } = ppkg + if (inBundle && !parentBundled && parent.edgesOut.has(node.name)) { + if (!ppkg.bundleDependencies) { + ppkg.bundleDependencies = [name] + } else { + ppkg.bundleDependencies.push(name) + } + } + } + } + + #loadNode (location, sw, loadOverrides) { + const p = this.virtualTree ? this.virtualTree.realpath : this.path + const path = resolve(p, location) + // shrinkwrap doesn't include package name unless necessary + if (!sw.name) { + sw.name = nameFromFolder(path) + } + + const dev = sw.dev + const optional = sw.optional + const devOptional = dev || optional || sw.devOptional + const peer = sw.peer + + const node = new Node({ + installLinks: this.installLinks, + legacyPeerDeps: this.legacyPeerDeps, + root: this.virtualTree, + path, + realpath: path, + integrity: sw.integrity, + resolved: consistentResolve(sw.resolved, this.path, path), + pkg: sw, + hasShrinkwrap: sw.hasShrinkwrap, + dev, + optional, + devOptional, + peer, + loadOverrides, + }) + // cast to boolean because they're undefined in the lock file when false + node.extraneous = !!sw.extraneous + node.devOptional = !!(sw.devOptional || sw.dev || sw.optional) + node.peer = !!sw.peer + node.optional = !!sw.optional + node.dev = !!sw.dev + return node + } + + #loadLink (location, targetLoc, target) { + const path = resolve(this.path, location) + const link = new Link({ + installLinks: this.installLinks, + legacyPeerDeps: this.legacyPeerDeps, + path, + realpath: resolve(this.path, targetLoc), + target, + pkg: target && target.package, + }) + link.extraneous = target.extraneous + link.devOptional = target.devOptional + link.peer = target.peer + link.optional = target.optional + link.dev = target.dev + return link + } +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js new file mode 100644 index 00000000..3340ddaa --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js @@ -0,0 +1,402 @@ +// Arborist.rebuild({path = this.path}) will do all the binlinks and +// bundle building needed. Called by reify, and by `npm rebuild`. + +const localeCompare = require('@isaacs/string-locale-compare')('en') +const { depth: dfwalk } = require('treeverse') +const promiseAllRejectLate = require('promise-all-reject-late') +const rpj = require('read-package-json-fast') +const binLinks = require('bin-links') +const runScript = require('@npmcli/run-script') +const { callLimit: promiseCallLimit } = require('promise-call-limit') +const { resolve } = require('node:path') +const { isNodeGypPackage, defaultGypInstallScript } = require('@npmcli/node-gyp') +const { log, time } = require('proc-log') + +const boolEnv = b => b ? '1' : '' +const sortNodes = (a, b) => + (a.depth - b.depth) || localeCompare(a.path, b.path) + +const _checkBins = Symbol.for('checkBins') + +// defined by reify mixin +const _handleOptionalFailure = Symbol.for('handleOptionalFailure') +const _trashList = Symbol.for('trashList') + +module.exports = cls => class Builder extends cls { + #doHandleOptionalFailure + #oldMeta = null + #queues + + constructor (options) { + super(options) + + this.scriptsRun = new Set() + this.#resetQueues() + } + + async rebuild ({ nodes, handleOptionalFailure = false } = {}) { + // nothing to do if we're not building anything! + if (this.options.ignoreScripts && !this.options.binLinks) { + return + } + + // when building for the first time, as part of reify, we ignore + // failures in optional nodes, and just delete them. however, when + // running JUST a rebuild, we treat optional failures as real fails + this.#doHandleOptionalFailure = handleOptionalFailure + + if (!nodes) { + nodes = await this.#loadDefaultNodes() + } + + // separates links nodes so that it can run + // prepare scripts and link bins in the expected order + const timeEnd = time.start('build') + + const { + depNodes, + linkNodes, + } = this.#retrieveNodesByType(nodes) + + // build regular deps + await this.#build(depNodes, {}) + + // build link deps + if (linkNodes.size) { + this.#resetQueues() + await this.#build(linkNodes, { type: 'links' }) + } + + timeEnd() + } + + // if we don't have a set of nodes, then just rebuild + // the actual tree on disk. + async #loadDefaultNodes () { + let nodes + const tree = await this.loadActual() + let filterSet + if (!this.options.workspacesEnabled) { + filterSet = this.excludeWorkspacesDependencySet(tree) + nodes = tree.inventory.filter(node => + filterSet.has(node) || node.isProjectRoot + ) + } else if (this.options.workspaces.length) { + filterSet = this.workspaceDependencySet( + tree, + this.options.workspaces, + this.options.includeWorkspaceRoot + ) + nodes = tree.inventory.filter(node => filterSet.has(node)) + } else { + nodes = tree.inventory.values() + } + return nodes + } + + #retrieveNodesByType (nodes) { + const depNodes = new Set() + const linkNodes = new Set() + const storeNodes = new Set() + + for (const node of nodes) { + if (node.isStoreLink) { + storeNodes.add(node) + } else if (node.isLink) { + linkNodes.add(node) + } else { + depNodes.add(node) + } + } + // Make sure that store linked nodes are processed last. + // We can't process store links separately or else lifecycle scripts on + // standard nodes might not have bin links yet. + for (const node of storeNodes) { + depNodes.add(node) + } + + // deduplicates link nodes and their targets, avoids + // calling lifecycle scripts twice when running `npm rebuild` + // ref: https://github.com/npm/cli/issues/2905 + // + // we avoid doing so if global=true since `bin-links` relies + // on having the target nodes available in global mode. + if (!this.options.global) { + for (const node of linkNodes) { + depNodes.delete(node.target) + } + } + + return { + depNodes, + linkNodes, + } + } + + #resetQueues () { + this.#queues = { + preinstall: [], + install: [], + postinstall: [], + prepare: [], + bin: [], + } + } + + async #build (nodes, { type = 'deps' }) { + const timeEnd = time.start(`build:${type}`) + + await this.#buildQueues(nodes) + + if (!this.options.ignoreScripts) { + await this.#runScripts('preinstall') + } + + // links should run prepare scripts and only link bins after that + if (type === 'links') { + if (!this.options.ignoreScripts) { + await this.#runScripts('prepare') + } + } + if (this.options.binLinks) { + await this.#linkAllBins() + } + + if (!this.options.ignoreScripts) { + await this.#runScripts('install') + await this.#runScripts('postinstall') + } + + timeEnd() + } + + async #buildQueues (nodes) { + const timeEnd = time.start('build:queue') + const set = new Set() + + const promises = [] + for (const node of nodes) { + promises.push(this.#addToBuildSet(node, set)) + + // if it has bundle deps, add those too, if rebuildBundle + if (this.options.rebuildBundle !== false) { + const bd = node.package.bundleDependencies + if (bd && bd.length) { + dfwalk({ + tree: node, + leave: node => promises.push(this.#addToBuildSet(node, set)), + getChildren: node => [...node.children.values()], + filter: node => node.inBundle, + }) + } + } + } + await promiseAllRejectLate(promises) + + // now sort into the queues for the 4 things we have to do + // run in the same predictable order that buildIdealTree uses + // there's no particular reason for doing it in this order rather + // than another, but sorting *somehow* makes it consistent. + const queue = [...set].sort(sortNodes) + + for (const node of queue) { + const { package: { bin, scripts = {} } } = node.target + const { preinstall, install, postinstall, prepare } = scripts + const tests = { bin, preinstall, install, postinstall, prepare } + for (const [key, has] of Object.entries(tests)) { + if (has) { + this.#queues[key].push(node) + } + } + } + timeEnd() + } + + async [_checkBins] (node) { + // if the node is a global top, and we're not in force mode, then + // any existing bins need to either be missing, or a symlink into + // the node path. Otherwise a package can have a preinstall script + // that unlinks something, to allow them to silently overwrite system + // binaries, which is unsafe and insecure. + if (!node.globalTop || this.options.force) { + return + } + const { path, package: pkg } = node + await binLinks.checkBins({ pkg, path, top: true, global: true }) + } + + async #addToBuildSet (node, set, refreshed = false) { + if (set.has(node)) { + return + } + + if (this.#oldMeta === null) { + const { root: { meta } } = node + this.#oldMeta = meta && meta.loadedFromDisk && + !(meta.originalLockfileVersion >= 2) + } + + const { package: pkg, hasInstallScript } = node.target + const { gypfile, bin, scripts = {} } = pkg + + const { preinstall, install, postinstall, prepare } = scripts + const anyScript = preinstall || install || postinstall || prepare + if (!refreshed && !anyScript && (hasInstallScript || this.#oldMeta)) { + // we either have an old metadata (and thus might have scripts) + // or we have an indication that there's install scripts (but + // don't yet know what they are) so we have to load the package.json + // from disk to see what the deal is. Failure here just means + // no scripts to add, probably borked package.json. + // add to the set then remove while we're reading the pj, so we + // don't accidentally hit it multiple times. + set.add(node) + const pkg = await rpj(node.path + '/package.json').catch(() => ({})) + set.delete(node) + + const { scripts = {} } = pkg + node.package.scripts = scripts + return this.#addToBuildSet(node, set, true) + } + + // Rebuild node-gyp dependencies lacking an install or preinstall script + // note that 'scripts' might be missing entirely, and the package may + // set gypfile:false to avoid this automatic detection. + const isGyp = gypfile !== false && + !install && + !preinstall && + await isNodeGypPackage(node.path) + + if (bin || preinstall || install || postinstall || prepare || isGyp) { + if (bin) { + await this[_checkBins](node) + } + if (isGyp) { + scripts.install = defaultGypInstallScript + node.package.scripts = scripts + } + set.add(node) + } + } + + async #runScripts (event) { + const queue = this.#queues[event] + + if (!queue.length) { + return + } + + const timeEnd = time.start(`build:run:${event}`) + const stdio = this.options.foregroundScripts ? 'inherit' : 'pipe' + const limit = this.options.foregroundScripts ? 1 : undefined + await promiseCallLimit(queue.map(node => async () => { + const { + path, + integrity, + resolved, + optional, + peer, + dev, + devOptional, + package: pkg, + location, + isStoreLink, + } = node.target + + // skip any that we know we'll be deleting + // or storeLinks + if (this[_trashList].has(path) || isStoreLink) { + return + } + + const timeEndLocation = time.start(`build:run:${event}:${location}`) + log.info('run', pkg._id, event, location, pkg.scripts[event]) + const env = { + npm_package_resolved: resolved, + npm_package_integrity: integrity, + npm_package_json: resolve(path, 'package.json'), + npm_package_optional: boolEnv(optional), + npm_package_dev: boolEnv(dev), + npm_package_peer: boolEnv(peer), + npm_package_dev_optional: + boolEnv(devOptional && !dev && !optional), + } + const runOpts = { + event, + path, + pkg, + stdio, + env, + scriptShell: this.options.scriptShell, + } + const p = runScript(runOpts).catch(er => { + const { code, signal } = er + log.info('run', pkg._id, event, { code, signal }) + throw er + }).then(({ args, code, signal, stdout, stderr }) => { + this.scriptsRun.add({ + pkg, + path, + event, + // I do not know why this needs to be on THIS line but refactoring + // this function would be quite a process + // eslint-disable-next-line promise/always-return + cmd: args && args[args.length - 1], + env, + code, + signal, + stdout, + stderr, + }) + log.info('run', pkg._id, event, { code, signal }) + }) + + await (this.#doHandleOptionalFailure + ? this[_handleOptionalFailure](node, p) + : p) + + timeEndLocation() + }), { limit }) + timeEnd() + } + + async #linkAllBins () { + const queue = this.#queues.bin + if (!queue.length) { + return + } + + const timeEnd = time.start('build:link') + const promises = [] + // sort the queue by node path, so that the module-local collision + // detector in bin-links will always resolve the same way. + for (const node of queue.sort(sortNodes)) { + // TODO these run before they're awaited + promises.push(this.#createBinLinks(node)) + } + + await promiseAllRejectLate(promises) + timeEnd() + } + + async #createBinLinks (node) { + if (this[_trashList].has(node.path)) { + return + } + + const timeEnd = time.start(`build:link:${node.location}`) + + const p = binLinks({ + pkg: node.package, + path: node.path, + top: !!(node.isTop || node.globalTop), + force: this.options.force, + global: !!node.globalTop, + }) + + await (this.#doHandleOptionalFailure + ? this[_handleOptionalFailure](node, p) + : p) + + timeEnd() + } +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js new file mode 100644 index 00000000..be920272 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js @@ -0,0 +1,1535 @@ +// mixin implementing the reify method +const onExit = require('../signal-handling.js') +const pacote = require('pacote') +const AuditReport = require('../audit-report.js') +const { subset, intersects } = require('semver') +const npa = require('npm-package-arg') +const semver = require('semver') +const debug = require('../debug.js') +const { walkUp } = require('walk-up-path') +const { log, time } = require('proc-log') +const hgi = require('hosted-git-info') +const rpj = require('read-package-json-fast') + +const { dirname, resolve, relative, join } = require('node:path') +const { depth: dfwalk } = require('treeverse') +const { + lstat, + mkdir, + rm, + symlink, +} = require('node:fs/promises') +const { moveFile } = require('@npmcli/fs') +const PackageJson = require('@npmcli/package-json') +const packageContents = require('@npmcli/installed-package-contents') +const runScript = require('@npmcli/run-script') +const { checkEngine, checkPlatform } = require('npm-install-checks') + +const treeCheck = require('../tree-check.js') +const relpath = require('../relpath.js') +const Diff = require('../diff.js') +const retirePath = require('../retire-path.js') +const promiseAllRejectLate = require('promise-all-reject-late') +const { callLimit: promiseCallLimit } = require('promise-call-limit') +const optionalSet = require('../optional-set.js') +const calcDepFlags = require('../calc-dep-flags.js') +const { saveTypeMap, hasSubKey } = require('../add-rm-pkg-deps.js') + +const Shrinkwrap = require('../shrinkwrap.js') +const { defaultLockfileVersion } = Shrinkwrap + +// Part of steps (steps need refactoring before we can do anything about these) +const _retireShallowNodes = Symbol.for('retireShallowNodes') +const _loadBundlesAndUpdateTrees = Symbol.for('loadBundlesAndUpdateTrees') +const _submitQuickAudit = Symbol('submitQuickAudit') +const _addOmitsToTrashList = Symbol('addOmitsToTrashList') +const _unpackNewModules = Symbol.for('unpackNewModules') +const _build = Symbol.for('build') + +// shared by rebuild mixin +const _trashList = Symbol.for('trashList') +const _handleOptionalFailure = Symbol.for('handleOptionalFailure') +const _loadTrees = Symbol.for('loadTrees') +// defined by rebuild mixin +const _checkBins = Symbol.for('checkBins') + +// shared symbols for swapping out when testing +// TODO tests should not be this deep into internals +const _diffTrees = Symbol.for('diffTrees') +const _createSparseTree = Symbol.for('createSparseTree') +const _loadShrinkwrapsAndUpdateTrees = Symbol.for('loadShrinkwrapsAndUpdateTrees') +const _reifyNode = Symbol.for('reifyNode') +const _updateAll = Symbol.for('updateAll') +const _updateNames = Symbol.for('updateNames') +const _moveContents = Symbol.for('moveContents') +const _moveBackRetiredUnchanged = Symbol.for('moveBackRetiredUnchanged') +const _removeTrash = Symbol.for('removeTrash') +const _renamePath = Symbol.for('renamePath') +const _rollbackRetireShallowNodes = Symbol.for('rollbackRetireShallowNodes') +const _rollbackCreateSparseTree = Symbol.for('rollbackCreateSparseTree') +const _rollbackMoveBackRetiredUnchanged = Symbol.for('rollbackMoveBackRetiredUnchanged') +const _saveIdealTree = Symbol.for('saveIdealTree') +const _reifyPackages = Symbol.for('reifyPackages') + +// defined by build-ideal-tree mixin +const _resolvedAdd = Symbol.for('resolvedAdd') +const _usePackageLock = Symbol.for('usePackageLock') +// used by build-ideal-tree mixin +const _addNodeToTrashList = Symbol.for('addNodeToTrashList') + +const _createIsolatedTree = Symbol.for('createIsolatedTree') + +module.exports = cls => class Reifier extends cls { + #bundleMissing = new Set() // child nodes we'd EXPECT to be included in a bundle, but aren't + #bundleUnpacked = new Set() // the nodes we unpack to read their bundles + #dryRun + #nmValidated = new Set() + #omitDev + #omitPeer + #omitOptional + #retiredPaths = {} + #retiredUnchanged = {} + #savePrefix + #shrinkwrapInflated = new Set() + #sparseTreeDirs = new Set() + #sparseTreeRoots = new Set() + + constructor (options) { + super(options) + + this[_trashList] = new Set() + } + + // public method + async reify (options = {}) { + const linked = (options.installStrategy || this.options.installStrategy) === 'linked' + + if (this.options.packageLockOnly && this.options.global) { + const er = new Error('cannot generate lockfile for global packages') + er.code = 'ESHRINKWRAPGLOBAL' + throw er + } + + const omit = new Set(options.omit || []) + this.#omitDev = omit.has('dev') + this.#omitOptional = omit.has('optional') + this.#omitPeer = omit.has('peer') + + // start tracker block + this.addTracker('reify') + const timeEnd = time.start('reify') + // don't create missing dirs on dry runs + if (!this.options.packageLockOnly && !this.options.dryRun) { + // we do NOT want to set ownership on this folder, especially + // recursively, because it can have other side effects to do that + // in a project directory. We just want to make it if it's missing. + await mkdir(resolve(this.path), { recursive: true }) + + // do not allow the top-level node_modules to be a symlink + await this.#validateNodeModules(resolve(this.path, 'node_modules')) + } + await this[_loadTrees](options) + + const oldTree = this.idealTree + if (linked) { + // swap out the tree with the isolated tree + // this is currently technical debt which will be resolved in a refactor + // of Node/Link trees + log.warn('reify', 'The "linked" install strategy is EXPERIMENTAL and may contain bugs.') + this.idealTree = await this[_createIsolatedTree]() + } + await this[_diffTrees]() + await this[_reifyPackages]() + if (linked) { + // swap back in the idealTree + // so that the lockfile is preserved + this.idealTree = oldTree + } + await this[_saveIdealTree](options) + // clean up any trash that is still in the tree + for (const path of this[_trashList]) { + const loc = relpath(this.idealTree.realpath, path) + const node = this.idealTree.inventory.get(loc) + if (node && node.root === this.idealTree) { + node.parent = null + } + } + + // if we filtered to only certain nodes, then anything ELSE needs + // to be untouched in the resulting actual tree, even if it differs + // in the idealTree. Copy over anything that was in the actual and + // was not changed, delete anything in the ideal and not actual. + // Then we move the entire idealTree over to this.actualTree, and + // save the hidden lockfile. + if (this.diff && this.diff.filterSet.size) { + const reroot = new Set() + + const { filterSet } = this.diff + const seen = new Set() + for (const [loc, ideal] of this.idealTree.inventory.entries()) { + seen.add(loc) + + // if it's an ideal node from the filter set, then skip it + // because we already made whatever changes were necessary + if (filterSet.has(ideal)) { + continue + } + + // otherwise, if it's not in the actualTree, then it's not a thing + // that we actually added. And if it IS in the actualTree, then + // it's something that we left untouched, so we need to record + // that. + const actual = this.actualTree.inventory.get(loc) + if (!actual) { + ideal.root = null + } else { + if ([...actual.linksIn].some(link => filterSet.has(link))) { + seen.add(actual.location) + continue + } + const { realpath, isLink } = actual + if (isLink && ideal.isLink && ideal.realpath === realpath) { + continue + } else { + reroot.add(actual) + } + } + } + + // now find any actual nodes that may not be present in the ideal + // tree, but were left behind by virtue of not being in the filter + for (const [loc, actual] of this.actualTree.inventory.entries()) { + if (seen.has(loc)) { + continue + } + seen.add(loc) + + // we know that this is something that ISN'T in the idealTree, + // or else we will have addressed it in the previous loop. + // If it's in the filterSet, that means we intentionally removed + // it, so nothing to do here. + if (filterSet.has(actual)) { + continue + } + + reroot.add(actual) + } + + // go through the rerooted actual nodes, and move them over. + for (const actual of reroot) { + actual.root = this.idealTree + } + + // prune out any tops that lack a linkIn, they are no longer relevant. + for (const top of this.idealTree.tops) { + if (top.linksIn.size === 0) { + top.root = null + } + } + + // need to calculate dep flags, since nodes may have been marked + // as extraneous or otherwise incorrect during transit. + calcDepFlags(this.idealTree) + } + + // save the ideal's meta as a hidden lockfile after we actualize it + this.idealTree.meta.filename = + this.idealTree.realpath + '/node_modules/.package-lock.json' + this.idealTree.meta.hiddenLockfile = true + this.idealTree.meta.lockfileVersion = defaultLockfileVersion + + this.actualTree = this.idealTree + this.idealTree = null + + if (!this.options.global) { + await this.actualTree.meta.save() + const ignoreScripts = !!this.options.ignoreScripts + // if we aren't doing a dry run or ignoring scripts and we actually made changes to the dep + // tree, then run the dependencies scripts + if (!this.options.dryRun && !ignoreScripts && this.diff && this.diff.children.length) { + const { path, package: pkg } = this.actualTree.target + const stdio = this.options.foregroundScripts ? 'inherit' : 'pipe' + const { scripts = {} } = pkg + for (const event of ['predependencies', 'dependencies', 'postdependencies']) { + if (Object.prototype.hasOwnProperty.call(scripts, event)) { + log.info('run', pkg._id, event, scripts[event]) + await time.start(`reify:run:${event}`, () => runScript({ + event, + path, + pkg, + stdio, + scriptShell: this.options.scriptShell, + })) + } + } + } + } + // This is a very bad pattern and I can't wait to stop doing it + this.auditReport = await this.auditReport + + this.finishTracker('reify') + timeEnd() + return treeCheck(this.actualTree) + } + + async [_reifyPackages] () { + // we don't submit the audit report or write to disk on dry runs + if (this.options.dryRun) { + return + } + + if (this.options.packageLockOnly) { + // we already have the complete tree, so just audit it now, + // and that's all we have to do here. + return this[_submitQuickAudit]() + } + + // ok, we're about to start touching the fs. need to roll back + // if we get an early termination. + let reifyTerminated = null + const removeHandler = onExit(({ signal }) => { + // only call once. if signal hits twice, we just terminate + removeHandler() + reifyTerminated = Object.assign(new Error('process terminated'), { + signal, + }) + return false + }) + + // [rollbackfn, [...actions]] + // after each step, if the process was terminated, execute the rollback + // note that each rollback *also* calls the previous one when it's + // finished, and then the first one throws the error, so we only need + // a new rollback step when we have a new thing that must be done to + // revert the install. + const steps = [ + [_rollbackRetireShallowNodes, [ + _retireShallowNodes, + ]], + [_rollbackCreateSparseTree, [ + _createSparseTree, + _addOmitsToTrashList, + _loadShrinkwrapsAndUpdateTrees, + _loadBundlesAndUpdateTrees, + _submitQuickAudit, + _unpackNewModules, + ]], + [_rollbackMoveBackRetiredUnchanged, [ + _moveBackRetiredUnchanged, + _build, + ]], + ] + for (const [rollback, actions] of steps) { + for (const action of actions) { + try { + await this[action]() + if (reifyTerminated) { + throw reifyTerminated + } + } catch (er) { + // TODO rollbacks shouldn't be relied on to throw err + await this[rollback](er) + /* istanbul ignore next - rollback throws, should never hit this */ + throw er + } + } + } + + // no rollback for this one, just exit with the error, since the + // install completed and can't be safely recovered at this point. + await this[_removeTrash]() + if (reifyTerminated) { + throw reifyTerminated + } + + // done modifying the file system, no need to keep listening for sigs + removeHandler() + } + + // when doing a local install, we load everything and figure it all out. + // when doing a global install, we *only* care about the explicit requests. + [_loadTrees] (options) { + const timeEnd = time.start('reify:loadTrees') + const bitOpt = { + ...options, + complete: this.options.packageLockOnly || this.options.dryRun, + } + + // if we're only writing a package lock, then it doesn't matter what's here + if (this.options.packageLockOnly) { + return this.buildIdealTree(bitOpt).then(timeEnd) + } + + const actualOpt = this.options.global ? { + ignoreMissing: true, + global: true, + filter: (node, kid) => { + // if it's not the project root, and we have no explicit requests, + // then we're already into a nested dep, so we keep it + if (this.explicitRequests.size === 0 || !node.isProjectRoot) { + return true + } + + // if we added it as an edgeOut, then we want it + if (this.idealTree.edgesOut.has(kid)) { + return true + } + + // if it's an explicit request, then we want it + const hasExplicit = [...this.explicitRequests] + .some(edge => edge.name === kid) + if (hasExplicit) { + return true + } + + // ignore the rest of the global install folder + return false + }, + } : { ignoreMissing: true } + + if (!this.options.global) { + return Promise.all([ + this.loadActual(actualOpt), + this.buildIdealTree(bitOpt), + ]).then(timeEnd) + } + + // the global install space tends to have a lot of stuff in it. don't + // load all of it, just what we care about. we won't be saving a + // hidden lockfile in there anyway. Note that we have to load ideal + // BEFORE loading actual, so that the actualOpt can use the + // explicitRequests which is set during buildIdealTree + return this.buildIdealTree(bitOpt) + .then(() => this.loadActual(actualOpt)) + .then(timeEnd) + } + + [_diffTrees] () { + if (this.options.packageLockOnly) { + return + } + + const timeEnd = time.start('reify:diffTrees') + // XXX if we have an existing diff already, there should be a way + // to just invalidate the parts that changed, but avoid walking the + // whole tree again. + + const includeWorkspaces = this.options.workspacesEnabled + const includeRootDeps = !includeWorkspaces + || this.options.includeWorkspaceRoot && this.options.workspaces.length > 0 + + const filterNodes = [] + if (this.options.global && this.explicitRequests.size) { + const idealTree = this.idealTree.target + const actualTree = this.actualTree.target + // we ONLY are allowed to make changes in the global top-level + // children where there's an explicit request. + for (const { name } of this.explicitRequests) { + const ideal = idealTree.children.get(name) + if (ideal) { + filterNodes.push(ideal) + } + const actual = actualTree.children.get(name) + if (actual) { + filterNodes.push(actual) + } + } + } else { + if (includeWorkspaces) { + // add all ws nodes to filterNodes + for (const ws of this.options.workspaces) { + const ideal = this.idealTree.children.get(ws) + if (ideal) { + filterNodes.push(ideal) + } + const actual = this.actualTree.children.get(ws) + if (actual) { + filterNodes.push(actual) + } + } + } + if (includeRootDeps) { + // add all non-workspace nodes to filterNodes + for (const tree of [this.idealTree, this.actualTree]) { + for (const { type, to } of tree.edgesOut.values()) { + if (type !== 'workspace' && to) { + filterNodes.push(to) + } + } + } + } + } + + // find all the nodes that need to change between the actual + // and ideal trees. + this.diff = Diff.calculate({ + shrinkwrapInflated: this.#shrinkwrapInflated, + filterNodes, + actual: this.actualTree, + ideal: this.idealTree, + }) + + // we don't have to add 'removed' folders to the trashlist, because + // they'll be moved aside to a retirement folder, and then the retired + // folder will be deleted at the end. This is important when we have + // a folder like FOO being "removed" in favor of a folder like "foo", + // because if we remove node_modules/FOO on case-insensitive systems, + // it will remove the dep that we *want* at node_modules/foo. + + timeEnd() + } + + // add the node and all its bins to the list of things to be + // removed later on in the process. optionally, also mark them + // as a retired paths, so that we move them out of the way and + // replace them when rolling back on failure. + [_addNodeToTrashList] (node, retire = false) { + const paths = [node.path, ...node.binPaths] + const moves = this.#retiredPaths + log.silly('reify', 'mark', retire ? 'retired' : 'deleted', paths) + for (const path of paths) { + if (retire) { + const retired = retirePath(path) + moves[path] = retired + this[_trashList].add(retired) + } else { + this[_trashList].add(path) + } + } + } + + // move aside the shallowest nodes in the tree that have to be + // changed or removed, so that we can rollback if necessary. + [_retireShallowNodes] () { + const timeEnd = time.start('reify:retireShallow') + const moves = this.#retiredPaths = {} + for (const diff of this.diff.children) { + if (diff.action === 'CHANGE' || diff.action === 'REMOVE') { + // we'll have to clean these up at the end, so add them to the list + this[_addNodeToTrashList](diff.actual, true) + } + } + log.silly('reify', 'moves', moves) + const movePromises = Object.entries(moves) + .map(([from, to]) => this[_renamePath](from, to)) + return promiseAllRejectLate(movePromises).then(timeEnd) + } + + [_renamePath] (from, to, didMkdirp = false) { + return moveFile(from, to) + .catch(er => { + // Occasionally an expected bin file might not exist in the package, + // or a shim/symlink might have been moved aside. If we've already + // handled the most common cause of ENOENT (dir doesn't exist yet), + // then just ignore any ENOENT. + if (er.code === 'ENOENT') { + return didMkdirp ? null : mkdir(dirname(to), { recursive: true }).then(() => + this[_renamePath](from, to, true)) + } else if (er.code === 'EEXIST') { + return rm(to, { recursive: true, force: true }).then(() => moveFile(from, to)) + } else { + throw er + } + }) + } + + [_rollbackRetireShallowNodes] (er) { + const timeEnd = time.start('reify:rollback:retireShallow') + const moves = this.#retiredPaths + const movePromises = Object.entries(moves) + .map(([from, to]) => this[_renamePath](to, from)) + return promiseAllRejectLate(movePromises) + // ignore subsequent rollback errors + .catch(() => {}) + .then(timeEnd) + .then(() => { + throw er + }) + } + + // adding to the trash list will skip reifying, and delete them + // if they are currently in the tree and otherwise untouched. + [_addOmitsToTrashList] () { + if (!this.#omitDev && !this.#omitOptional && !this.#omitPeer) { + return + } + + const timeEnd = time.start('reify:trashOmits') + + for (const node of this.idealTree.inventory.values()) { + const { top } = node + + // if the top is not the root or workspace then we do not want to omit it + if (!top.isProjectRoot && !top.isWorkspace) { + continue + } + + // if a diff filter has been created, then we do not omit the node if the + // top node is not in that set + if (this.diff?.filterSet?.size && !this.diff.filterSet.has(top)) { + continue + } + + // omit node if the dep type matches any omit flags that were set + if ( + node.peer && this.#omitPeer || + node.dev && this.#omitDev || + node.optional && this.#omitOptional || + node.devOptional && this.#omitOptional && this.#omitDev + ) { + this[_addNodeToTrashList](node) + } + } + + timeEnd() + } + + [_createSparseTree] () { + const timeEnd = time.start('reify:createSparse') + // if we call this fn again, we look for the previous list + // so that we can avoid making the same directory multiple times + const leaves = this.diff.leaves + .filter(diff => { + return (diff.action === 'ADD' || diff.action === 'CHANGE') && + !this.#sparseTreeDirs.has(diff.ideal.path) && + !diff.ideal.isLink + }) + .map(diff => diff.ideal) + + // we check this in parallel, so guard against multiple attempts to + // retire the same path at the same time. + const dirsChecked = new Set() + return promiseAllRejectLate(leaves.map(async node => { + for (const d of walkUp(node.path)) { + if (d === node.top.path) { + break + } + if (dirsChecked.has(d)) { + continue + } + dirsChecked.add(d) + const st = await lstat(d).catch(() => null) + // this can happen if we have a link to a package with a name + // that the filesystem treats as if it is the same thing. + // would be nice to have conditional istanbul ignores here... + /* istanbul ignore next - defense in depth */ + if (st && !st.isDirectory()) { + const retired = retirePath(d) + this.#retiredPaths[d] = retired + this[_trashList].add(retired) + await this[_renamePath](d, retired) + } + } + this.#sparseTreeDirs.add(node.path) + const made = await mkdir(node.path, { recursive: true }) + // if the directory already exists, made will be undefined. if that's the case + // we don't want to remove it because we aren't the ones who created it so we + // omit it from the #sparseTreeRoots + if (made) { + this.#sparseTreeRoots.add(made) + } + })).then(timeEnd) + } + + [_rollbackCreateSparseTree] (er) { + const timeEnd = time.start('reify:rollback:createSparse') + // cut the roots of the sparse tree that were created, not the leaves + const roots = this.#sparseTreeRoots + // also delete the moves that we retired, so that we can move them back + const failures = [] + const targets = [...roots, ...Object.keys(this.#retiredPaths)] + const unlinks = targets + .map(path => rm(path, { recursive: true, force: true }).catch(er => failures.push([path, er]))) + return promiseAllRejectLate(unlinks).then(() => { + // eslint-disable-next-line promise/always-return + if (failures.length) { + log.warn('cleanup', 'Failed to remove some directories', failures) + } + }) + .then(timeEnd) + .then(() => this[_rollbackRetireShallowNodes](er)) + } + + // shrinkwrap nodes define their dependency branches with a file, so + // we need to unpack them, read that shrinkwrap file, and then update + // the tree by calling loadVirtual with the node as the root. + [_loadShrinkwrapsAndUpdateTrees] () { + const seen = this.#shrinkwrapInflated + const shrinkwraps = this.diff.leaves + .filter(d => (d.action === 'CHANGE' || d.action === 'ADD' || !d.action) && + d.ideal.hasShrinkwrap && !seen.has(d.ideal) && + !this[_trashList].has(d.ideal.path)) + + if (!shrinkwraps.length) { + return + } + + const timeEnd = time.start('reify:loadShrinkwraps') + + const Arborist = this.constructor + return promiseAllRejectLate(shrinkwraps.map(diff => { + const node = diff.ideal + seen.add(node) + return diff.action ? this[_reifyNode](node) : node + })) + .then(nodes => promiseAllRejectLate(nodes.map(node => new Arborist({ + ...this.options, + path: node.path, + }).loadVirtual({ root: node })))) + // reload the diff and sparse tree because the ideal tree changed + .then(() => this[_diffTrees]()) + .then(() => this[_createSparseTree]()) + .then(() => this[_addOmitsToTrashList]()) + .then(() => this[_loadShrinkwrapsAndUpdateTrees]()) + .then(timeEnd) + } + + // create a symlink for Links, extract for Nodes + // return the node object, since we usually want that + // handle optional dep failures here + // If node is in trash list, skip it + // If reifying fails, and the node is optional, add it and its optionalSet + // to the trash list + // Always return the node. + [_reifyNode] (node) { + if (this[_trashList].has(node.path)) { + return node + } + + const timeEnd = time.start(`reifyNode:${node.location}`) + this.addTracker('reify', node.name, node.location) + + const { npmVersion, nodeVersion, cpu, os, libc } = this.options + const p = Promise.resolve().then(async () => { + // when we reify an optional node, check the engine and platform + // first. be sure to ignore the --force and --engine-strict flags, + // since we always want to skip any optional packages we can't install. + // these checks throwing will result in a rollback and removal + // of the mismatches + // eslint-disable-next-line promise/always-return + if (node.optional) { + checkEngine(node.package, npmVersion, nodeVersion, false) + checkPlatform(node.package, false, { cpu, os, libc }) + } + await this[_checkBins](node) + await this.#extractOrLink(node) + const { _id, deprecated } = node.package + // The .catch is in _handleOptionalFailure. Not ideal, this should be cleaned up. + // eslint-disable-next-line promise/always-return + if (deprecated) { + log.warn('deprecated', `${_id}: ${deprecated}`) + } + }) + + return this[_handleOptionalFailure](node, p) + .then(() => { + this.finishTracker('reify', node.name, node.location) + timeEnd() + return node + }) + } + + // do not allow node_modules to be a symlink + async #validateNodeModules (nm) { + if (this.options.force || this.#nmValidated.has(nm)) { + return + } + const st = await lstat(nm).catch(() => null) + if (!st || st.isDirectory()) { + this.#nmValidated.add(nm) + return + } + log.warn('reify', 'Removing non-directory', nm) + await rm(nm, { recursive: true, force: true }) + } + + async #extractOrLink (node) { + const nm = resolve(node.parent.path, 'node_modules') + await this.#validateNodeModules(nm) + + if (!node.isLink) { + // in normal cases, node.resolved should *always* be set by now. + // however, it is possible when a lockfile is damaged, or very old, + // or in some other race condition bugs in npm v6, that a previously + // bundled dependency will have just a version, but no resolved value, + // and no 'bundled: true' setting. + // Do the best with what we have, or else remove it from the tree + // entirely, since we can't possibly reify it. + let res = null + if (node.resolved) { + const registryResolved = this.#registryResolved(node.resolved) + if (registryResolved) { + res = `${node.name}@${registryResolved}` + } + } else if (node.package.name && node.version) { + res = `${node.package.name}@${node.version}` + } + + // no idea what this thing is. remove it from the tree. + if (!res) { + const warning = 'invalid or damaged lockfile detected\n' + + 'please re-try this operation once it completes\n' + + 'so that the damage can be corrected, or perform\n' + + 'a fresh install with no lockfile if the problem persists.' + log.warn('reify', warning) + log.verbose('reify', 'unrecognized node in tree', node.path) + node.parent = null + node.fsParent = null + this[_addNodeToTrashList](node) + return + } + await debug(async () => { + const st = await lstat(node.path).catch(() => null) + if (st && !st.isDirectory()) { + debug.log('unpacking into a non-directory', node) + throw Object.assign(new Error('ENOTDIR: not a directory'), { + code: 'ENOTDIR', + path: node.path, + }) + } + }) + await pacote.extract(res, node.path, { + ...this.options, + resolved: node.resolved, + integrity: node.integrity, + }) + // store nodes don't use Node class so node.package doesn't get updated + if (node.isInStore) { + const pkg = await rpj(join(node.path, 'package.json')) + node.package.scripts = pkg.scripts + } + return + } + + // node.isLink + await rm(node.path, { recursive: true, force: true }) + + // symlink + const dir = dirname(node.path) + const target = node.realpath + const rel = relative(dir, target) + await mkdir(dir, { recursive: true }) + return symlink(rel, node.path, 'junction') + } + + // if the node is optional, then the failure of the promise is nonfatal + // just add it and its optional set to the trash list. + [_handleOptionalFailure] (node, p) { + return (node.optional ? p.catch(() => { + const set = optionalSet(node) + for (node of set) { + log.verbose('reify', 'failed optional dependency', node.path) + this[_addNodeToTrashList](node) + } + }) : p).then(() => node) + } + + #registryResolved (resolved) { + // the default registry url is a magic value meaning "the currently + // configured registry". + // `resolved` must never be falsey. + // + // XXX: use a magic string that isn't also a valid value, like + // ${REGISTRY} or something. This has to be threaded through the + // Shrinkwrap and Node classes carefully, so for now, just treat + // the default reg as the magical animal that it has been. + const resolvedURL = hgi.parseUrl(resolved) + + if (!resolvedURL) { + // if we could not parse the url at all then returning nothing + // here means it will get removed from the tree in the next step + return + } + + if ((this.options.replaceRegistryHost === resolvedURL.hostname) + || this.options.replaceRegistryHost === 'always') { + // this.registry always has a trailing slash + return `${this.registry.slice(0, -1)}${resolvedURL.pathname}${resolvedURL.searchParams}` + } + + return resolved + } + + // bundles are *sort of* like shrinkwraps, in that the branch is defined + // by the contents of the package. however, in their case, rather than + // shipping a virtual tree that must be reified, they ship an entire + // reified actual tree that must be unpacked and not modified. + [_loadBundlesAndUpdateTrees] (depth = 0, bundlesByDepth) { + let maxBundleDepth + if (!bundlesByDepth) { + bundlesByDepth = new Map() + maxBundleDepth = -1 + dfwalk({ + tree: this.diff, + visit: diff => { + const node = diff.ideal + if (!node) { + return + } + if (node.isProjectRoot) { + return + } + + const { bundleDependencies } = node.package + if (bundleDependencies && bundleDependencies.length) { + maxBundleDepth = Math.max(maxBundleDepth, node.depth) + if (!bundlesByDepth.has(node.depth)) { + bundlesByDepth.set(node.depth, [node]) + } else { + bundlesByDepth.get(node.depth).push(node) + } + } + }, + getChildren: diff => diff.children, + }) + + bundlesByDepth.set('maxBundleDepth', maxBundleDepth) + } else { + maxBundleDepth = bundlesByDepth.get('maxBundleDepth') + } + + if (depth === 0) { + time.start('reify:loadBundles') + } + + if (depth > maxBundleDepth) { + // if we did something, then prune the tree and update the diffs + if (maxBundleDepth !== -1) { + this.#pruneBundledMetadeps(bundlesByDepth) + this[_diffTrees]() + } + time.end('reify:loadBundles') + return + } + + // skip any that have since been removed from the tree, eg by a + // shallower bundle overwriting them with a bundled meta-dep. + const set = (bundlesByDepth.get(depth) || []) + .filter(node => node.root === this.idealTree && + node.target !== node.root && + !this[_trashList].has(node.path)) + + if (!set.length) { + return this[_loadBundlesAndUpdateTrees](depth + 1, bundlesByDepth) + } + + // extract all the nodes with bundles + return promiseCallLimit(set.map(node => { + return () => { + this.#bundleUnpacked.add(node) + return this[_reifyNode](node) + } + }), { rejectLate: true }) + // then load their unpacked children and move into the ideal tree + .then(nodes => + promiseAllRejectLate(nodes.map(async node => { + const arb = new this.constructor({ + ...this.options, + path: node.path, + }) + const notTransplanted = new Set(node.children.keys()) + await arb.loadActual({ + root: node, + // don't transplant any sparse folders we created + // loadActual will set node.package to {} for empty directories + // if by chance there are some empty folders in the node_modules + // tree for some other reason, then ok, ignore those too. + transplantFilter: node => { + if (node.package._id) { + // it's actually in the bundle if it gets transplanted + notTransplanted.delete(node.name) + return true + } else { + return false + } + }, + }) + for (const name of notTransplanted) { + this.#bundleMissing.add(node.children.get(name)) + } + }))) + // move onto the next level of bundled items + .then(() => this[_loadBundlesAndUpdateTrees](depth + 1, bundlesByDepth)) + } + + // https://github.com/npm/cli/issues/1597#issuecomment-667639545 + #pruneBundledMetadeps (bundlesByDepth) { + const bundleShadowed = new Set() + + // Example dep graph: + // root -> (a, c) + // a -> BUNDLE(b) + // b -> c + // c -> b + // + // package tree: + // root + // +-- a + // | +-- b(1) + // | +-- c(1) + // +-- b(2) + // +-- c(2) + // 1. mark everything that's shadowed by anything in the bundle. This + // marks b(2) and c(2). + // 2. anything with edgesIn from outside the set, mark not-extraneous, + // remove from set. This unmarks c(2). + // 3. continue until no change + // 4. remove everything in the set from the tree. b(2) is pruned + + // create the list of nodes shadowed by children of bundlers + for (const bundles of bundlesByDepth.values()) { + // skip the 'maxBundleDepth' item + if (!Array.isArray(bundles)) { + continue + } + for (const node of bundles) { + for (const name of node.children.keys()) { + const shadow = node.parent.resolve(name) + if (!shadow) { + continue + } + bundleShadowed.add(shadow) + shadow.extraneous = true + } + } + } + + // lib -> (a@1.x) BUNDLE(a@1.2.3 (b@1.2.3)) + // a@1.2.3 -> (b@1.2.3) + // a@1.3.0 -> (b@2) + // b@1.2.3 -> () + // b@2 -> (c@2) + // + // root + // +-- lib + // | +-- a@1.2.3 + // | +-- b@1.2.3 + // +-- b@2 <-- shadowed, now extraneous + // +-- c@2 <-- also shadowed, because only dependent is shadowed + for (const shadow of bundleShadowed) { + for (const shadDep of shadow.edgesOut.values()) { + /* istanbul ignore else - pretty unusual situation, just being + * defensive here. Would mean that a bundled dep has a dependency + * that is unmet. which, weird, but if you bundle it, we take + * whatever you put there and assume the publisher knows best. */ + if (shadDep.to) { + bundleShadowed.add(shadDep.to) + shadDep.to.extraneous = true + } + } + } + + let changed + do { + changed = false + for (const shadow of bundleShadowed) { + for (const edge of shadow.edgesIn) { + if (!bundleShadowed.has(edge.from)) { + shadow.extraneous = false + bundleShadowed.delete(shadow) + changed = true + break + } + } + } + } while (changed) + + for (const shadow of bundleShadowed) { + this[_addNodeToTrashList](shadow) + shadow.root = null + } + } + + async [_submitQuickAudit] () { + if (this.options.audit === false) { + this.auditReport = null + return + } + + // we submit the quick audit at this point in the process, as soon as + // we have all the deps resolved, so that it can overlap with the other + // actions as much as possible. Stash the promise, which we resolve + // before finishing the reify() and returning the tree. Thus, we do + // NOT return the promise, as the intent is for this to run in parallel + // with the reification, and be resolved at a later time. + const timeEnd = time.start('reify:audit') + const options = { ...this.options } + const tree = this.idealTree + + // if we're operating on a workspace, only audit the workspace deps + if (this.options.workspaces.length) { + options.filterSet = this.workspaceDependencySet( + tree, + this.options.workspaces, + this.options.includeWorkspaceRoot + ) + } + + this.auditReport = AuditReport.load(tree, options).then(res => { + timeEnd() + return res + }) + } + + // ok! actually unpack stuff into their target locations! + // The sparse tree has already been created, so we walk the diff + // kicking off each unpack job. If any fail, we rm the sparse + // tree entirely and try to put everything back where it was. + [_unpackNewModules] () { + const timeEnd = time.start('reify:unpack') + const unpacks = [] + dfwalk({ + tree: this.diff, + visit: diff => { + // no unpacking if we don't want to change this thing + if (diff.action !== 'CHANGE' && diff.action !== 'ADD') { + return + } + + const node = diff.ideal + const bd = this.#bundleUnpacked.has(node) + const sw = this.#shrinkwrapInflated.has(node) + const bundleMissing = this.#bundleMissing.has(node) + + // check whether we still need to unpack this one. + // test the inDepBundle last, since that's potentially a tree walk. + const doUnpack = node && // can't unpack if removed! + // root node already exists + !node.isRoot && + // already unpacked to read bundle + !bd && + // already unpacked to read sw + !sw && + // already unpacked by another dep's bundle + (bundleMissing || !node.inDepBundle) + + if (doUnpack) { + unpacks.push(this[_reifyNode](node)) + } + }, + getChildren: diff => diff.children, + }) + return promiseAllRejectLate(unpacks).then(timeEnd) + } + + // This is the part where we move back the unchanging nodes that were + // the children of a node that did change. If this fails, the rollback + // is a three-step process. First, we try to move the retired unchanged + // nodes BACK to their retirement folders, then delete the sparse tree, + // then move everything out of retirement. + [_moveBackRetiredUnchanged] () { + // get a list of all unchanging children of any shallow retired nodes + // if they are not the ancestor of any node in the diff set, then the + // directory won't already exist, so just rename it over. + // This is sort of an inverse diff tree, of all the nodes where + // the actualTree and idealTree _don't_ differ, starting from the + // shallowest nodes that we moved aside in the first place. + const timeEnd = time.start('reify:unretire') + const moves = this.#retiredPaths + this.#retiredUnchanged = {} + return promiseAllRejectLate(this.diff.children.map(diff => { + // skip if nothing was retired + if (diff.action !== 'CHANGE' && diff.action !== 'REMOVE') { + return + } + + const { path: realFolder } = diff.actual + const retireFolder = moves[realFolder] + /* istanbul ignore next - should be impossible */ + debug(() => { + if (!retireFolder) { + const er = new Error('trying to un-retire but not retired') + throw Object.assign(er, { + realFolder, + retireFolder, + actual: diff.actual, + ideal: diff.ideal, + action: diff.action, + }) + } + }) + + this.#retiredUnchanged[retireFolder] = [] + return promiseAllRejectLate(diff.unchanged.map(node => { + // no need to roll back links, since we'll just delete them anyway + if (node.isLink) { + return mkdir(dirname(node.path), { recursive: true, force: true }) + .then(() => this[_reifyNode](node)) + } + + // will have been moved/unpacked along with bundler + if (node.inDepBundle && !this.#bundleMissing.has(node)) { + return + } + + this.#retiredUnchanged[retireFolder].push(node) + + const rel = relative(realFolder, node.path) + const fromPath = resolve(retireFolder, rel) + // if it has bundleDependencies, then make node_modules. otherwise + // skip it. + const bd = node.package.bundleDependencies + const dir = bd && bd.length ? node.path + '/node_modules' : node.path + return mkdir(dir, { recursive: true }).then(() => this[_moveContents](node, fromPath)) + })) + })).then(timeEnd) + } + + // move the contents from the fromPath to the node.path + [_moveContents] (node, fromPath) { + return packageContents({ + path: fromPath, + depth: 1, + packageJsonCache: new Map([[fromPath + '/package.json', node.package]]), + }).then(res => promiseAllRejectLate(res.map(path => { + const rel = relative(fromPath, path) + const to = resolve(node.path, rel) + return this[_renamePath](path, to) + }))) + } + + [_rollbackMoveBackRetiredUnchanged] (er) { + const moves = this.#retiredPaths + // flip the mapping around to go back + const realFolders = new Map(Object.entries(moves).map(([k, v]) => [v, k])) + const promises = Object.entries(this.#retiredUnchanged) + .map(([retireFolder, nodes]) => promiseAllRejectLate(nodes.map(node => { + const realFolder = realFolders.get(retireFolder) + const rel = relative(realFolder, node.path) + const fromPath = resolve(retireFolder, rel) + return this[_moveContents]({ ...node, path: fromPath }, node.path) + }))) + return promiseAllRejectLate(promises) + .then(() => this[_rollbackCreateSparseTree](er)) + } + + [_build] () { + const timeEnd = time.start('reify:build') + + // for all the things being installed, run their appropriate scripts + // run in tip->root order, so as to be more likely to build a node's + // deps before attempting to build it itself + const nodes = [] + dfwalk({ + tree: this.diff, + leave: diff => { + if (!diff.ideal.isProjectRoot) { + nodes.push(diff.ideal) + } + }, + // process adds before changes, ignore removals + getChildren: diff => diff && diff.children, + filter: diff => diff.action === 'ADD' || diff.action === 'CHANGE', + }) + + // pick up link nodes from the unchanged list as we want to run their + // scripts in every install despite of having a diff status change + for (const node of this.diff.unchanged) { + const tree = node.root.target + + // skip links that only live within node_modules as they are most + // likely managed by packages we installed, we only want to rebuild + // unchanged links we directly manage + const linkedFromRoot = node.parent === tree || node.target.fsTop === tree + if (node.isLink && linkedFromRoot) { + nodes.push(node) + } + } + + return this.rebuild({ nodes, handleOptionalFailure: true }).then(timeEnd) + } + + // the tree is pretty much built now, so it's cleanup time. + // remove the retired folders, and any deleted nodes + // If this fails, there isn't much we can do but tell the user about it. + // Thankfully, it's pretty unlikely that it'll fail, since rm is a node builtin. + async [_removeTrash] () { + const timeEnd = time.start('reify:trash') + const promises = [] + const failures = [] + const _rm = path => rm(path, { recursive: true, force: true }).catch(er => failures.push([path, er])) + + for (const path of this[_trashList]) { + promises.push(_rm(path)) + } + + await promiseAllRejectLate(promises) + if (failures.length) { + log.warn('cleanup', 'Failed to remove some directories', failures) + } + + timeEnd() + } + + // last but not least, we save the ideal tree metadata to the package-lock + // or shrinkwrap file, and any additions or removals to package.json + async [_saveIdealTree] (options) { + // the ideal tree is actualized now, hooray! + // it still contains all the references to optional nodes that were removed + // for install failures. Those still end up in the shrinkwrap, so we + // save it first, then prune out the optional trash, and then return it. + + const save = !(options.save === false) + + // we check for updates in order to make sure we run save ideal tree + // even though save=false since we want `npm update` to be able to + // write to package-lock files by default + const hasUpdates = this[_updateAll] || this[_updateNames].length + + // we're going to completely skip save ideal tree in case of a global or + // dry-run install and also if the save option is set to false, EXCEPT for + // update since the expected behavior for npm7+ is for update to + // NOT save to package.json, we make that exception since we still want + // saveIdealTree to be able to write the lockfile by default. + const saveIdealTree = !( + (!save && !hasUpdates) + || this.options.global + || this.options.dryRun + ) + + if (!saveIdealTree) { + return false + } + + const timeEnd = time.start('reify:save') + + const updatedTrees = new Set() + const updateNodes = nodes => { + for (const { name, tree: addTree } of nodes) { + // addTree either the root, or a workspace + const edge = addTree.edgesOut.get(name) + const pkg = addTree.package + const req = npa.resolve(name, edge.spec, addTree.realpath) + const { rawSpec, subSpec } = req + + const spec = subSpec ? subSpec.rawSpec : rawSpec + const child = edge.to + + // if we tried to install an optional dep, but it was a version + // that we couldn't resolve, this MAY be missing. if we haven't + // blown up by now, it's because it was not a problem, though, so + // just move on. + if (!child || !addTree.isTop) { + continue + } + + let newSpec + // True if the dependency is getting installed from a local file path + // In this case it is not possible to do the normal version comparisons + // as the new version will be a file path + const isLocalDep = req.type === 'directory' || req.type === 'file' + if (req.registry) { + const version = child.version + const prefixRange = version ? this.options.savePrefix + version : '*' + // if we installed a range, then we save the range specified + // if it is not a subset of the ^x.y.z. eg, installing a range + // of `1.x <1.2.3` will not be saved as `^1.2.0`, because that + // would allow versions outside the requested range. Tags and + // specific versions save with the save-prefix. + const isRange = (subSpec || req).type === 'range' + + let range = spec + if ( + !isRange || + spec === '*' || + subset(prefixRange, spec, { loose: true }) + ) { + range = prefixRange + } + + const pname = child.packageName + const alias = name !== pname + newSpec = alias ? `npm:${pname}@${range}` : range + } else if (req.hosted) { + // save the git+https url if it has auth, otherwise shortcut + const h = req.hosted + const opt = { noCommittish: false } + if (h.https && h.auth) { + newSpec = `git+${h.https(opt)}` + } else { + newSpec = h.shortcut(opt) + } + } else if (isLocalDep) { + // when finding workspace nodes, make sure that + // we save them using their version instead of + // using their relative path + if (edge.type === 'workspace') { + const { version } = edge.to.target + const prefixRange = version ? this.options.savePrefix + version : '*' + newSpec = prefixRange + } else { + // save the relative path in package.json + // Normally saveSpec is updated with the proper relative + // path already, but it's possible to specify a full absolute + // path initially, in which case we can end up with the wrong + // thing, so just get the ultimate fetchSpec and relativize it. + const p = req.fetchSpec.replace(/^file:/, '') + const rel = relpath(addTree.realpath, p).replace(/#/g, '%23') + newSpec = `file:${rel}` + } + } else { + newSpec = req.saveSpec + } + + if (options.saveType) { + const depType = saveTypeMap.get(options.saveType) + pkg[depType][name] = newSpec + // rpj will have moved it here if it was in both + // if it is empty it will be deleted later + if (options.saveType === 'prod' && pkg.optionalDependencies) { + delete pkg.optionalDependencies[name] + } + } else { + if (hasSubKey(pkg, 'dependencies', name)) { + pkg.dependencies[name] = newSpec + } + + if (hasSubKey(pkg, 'devDependencies', name)) { + pkg.devDependencies[name] = newSpec + // don't update peer or optional if we don't have to + if (hasSubKey(pkg, 'peerDependencies', name) && (isLocalDep || !intersects(newSpec, pkg.peerDependencies[name]))) { + pkg.peerDependencies[name] = newSpec + } + + if (hasSubKey(pkg, 'optionalDependencies', name) && (isLocalDep || !intersects(newSpec, pkg.optionalDependencies[name]))) { + pkg.optionalDependencies[name] = newSpec + } + } else { + if (hasSubKey(pkg, 'peerDependencies', name)) { + pkg.peerDependencies[name] = newSpec + } + + if (hasSubKey(pkg, 'optionalDependencies', name)) { + pkg.optionalDependencies[name] = newSpec + } + } + } + + updatedTrees.add(addTree) + } + } + + // Returns true if any of the edges from this node has a semver + // range definition that is an exact match to the version installed + // e.g: should return true if for a given an installed version 1.0.0, + // range is either =1.0.0 or 1.0.0 + const exactVersion = node => { + for (const edge of node.edgesIn) { + try { + if (semver.subset(edge.spec, node.version)) { + return false + } + } catch { + // ignore errors + } + } + return true + } + + // helper that retrieves an array of nodes that were + // potentially updated during the reify process, in order + // to limit the number of nodes to check and update, only + // select nodes from the inventory that are direct deps + // of a given package.json (project root or a workspace) + // and in ase of using a list of `names`, restrict nodes + // to only names that are found in this list + const retrieveUpdatedNodes = names => { + const filterDirectDependencies = node => + !node.isRoot && node.resolveParent && node.resolveParent.isRoot + && (!names || names.includes(node.name)) + && exactVersion(node) // skip update for exact ranges + + const directDeps = this.idealTree.inventory + .filter(filterDirectDependencies) + + // traverses the list of direct dependencies and collect all nodes + // to be updated, since any of them might have changed during reify + const nodes = [] + for (const node of directDeps) { + for (const edgeIn of node.edgesIn) { + nodes.push({ + name: node.name, + tree: edgeIn.from.target, + }) + } + } + return nodes + } + + if (save) { + // when using update all alongside with save, we'll make + // sure to refresh every dependency of the root idealTree + if (this[_updateAll]) { + const nodes = retrieveUpdatedNodes() + updateNodes(nodes) + } else { + // resolvedAdd is the list of user add requests, but with names added + // to things like git repos and tarball file/urls. However, if the + // user requested 'foo@', and we have a foo@file:../foo, then we should + // end up saving the spec we actually used, not whatever they gave us. + if (this[_resolvedAdd].length) { + updateNodes(this[_resolvedAdd]) + } + + // if updating given dependencies by name, restrict the list of + // nodes to check to only those currently in _updateNames + if (this[_updateNames].length) { + const nodes = retrieveUpdatedNodes(this[_updateNames]) + updateNodes(nodes) + } + + // grab any from explicitRequests that had deps removed + for (const { from: tree } of this.explicitRequests) { + updatedTrees.add(tree) + } + } + } + + if (save) { + for (const tree of updatedTrees) { + // refresh the edges so they have the correct specs + tree.package = tree.package + const pkgJson = await PackageJson.load(tree.path, { create: true }) + const { + dependencies = {}, + devDependencies = {}, + optionalDependencies = {}, + peerDependencies = {}, + // bundleDependencies is not required by PackageJson like the other + // fields here PackageJson also doesn't omit an empty array for this + // field so defaulting this to an empty array would add that field to + // every package.json file. + bundleDependencies, + } = tree.package + + pkgJson.update({ + dependencies, + devDependencies, + optionalDependencies, + peerDependencies, + bundleDependencies, + }) + await pkgJson.save() + } + } + + // before now edge specs could be changing, affecting the `requires` field + // in the package lock, so we hold off saving to the very last action + if (this[_usePackageLock]) { + // preserve indentation, if possible + let format = this.idealTree.package[Symbol.for('indent')] + if (format === undefined) { + format = ' ' + } + + // TODO this ignores options.save + await this.idealTree.meta.save({ + format: (this.options.formatPackageLock && format) ? format + : this.options.formatPackageLock, + }) + } + + timeEnd() + return true + } +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js new file mode 100644 index 00000000..dbd9be8b --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js @@ -0,0 +1,345 @@ +// an object representing the set of vulnerabilities in a tree +/* eslint camelcase: "off" */ + +const localeCompare = require('@isaacs/string-locale-compare')('en') +const npa = require('npm-package-arg') +const pickManifest = require('npm-pick-manifest') + +const Vuln = require('./vuln.js') +const Calculator = require('@npmcli/metavuln-calculator') + +const _getReport = Symbol('getReport') +const _fixAvailable = Symbol('fixAvailable') +const _checkTopNode = Symbol('checkTopNode') +const _init = Symbol('init') +const _omit = Symbol('omit') +const { log, time } = require('proc-log') + +const npmFetch = require('npm-registry-fetch') + +class AuditReport extends Map { + static load (tree, opts) { + return new AuditReport(tree, opts).run() + } + + get auditReportVersion () { + return 2 + } + + toJSON () { + const obj = { + auditReportVersion: this.auditReportVersion, + vulnerabilities: {}, + metadata: { + vulnerabilities: { + info: 0, + low: 0, + moderate: 0, + high: 0, + critical: 0, + total: this.size, + }, + dependencies: { + prod: 0, + dev: 0, + optional: 0, + peer: 0, + peerOptional: 0, + total: this.tree.inventory.size - 1, + }, + }, + } + + for (const node of this.tree.inventory.values()) { + const { dependencies } = obj.metadata + let prod = true + for (const type of [ + 'dev', + 'optional', + 'peer', + 'peerOptional', + ]) { + if (node[type]) { + dependencies[type]++ + prod = false + } + } + if (prod) { + dependencies.prod++ + } + } + + // if it doesn't have any topVulns, then it's fixable with audit fix + // for each topVuln, figure out if it's fixable with audit fix --force, + // or if we have to just delete the thing, and if the fix --force will + // require a semver major update. + const vulnerabilities = [] + for (const [name, vuln] of this.entries()) { + vulnerabilities.push([name, vuln.toJSON()]) + obj.metadata.vulnerabilities[vuln.severity]++ + } + + obj.vulnerabilities = vulnerabilities + .sort(([a], [b]) => localeCompare(a, b)) + .reduce((set, [name, vuln]) => { + set[name] = vuln + return set + }, {}) + + return obj + } + + constructor (tree, opts = {}) { + super() + const { omit } = opts + this[_omit] = new Set(omit || []) + this.topVulns = new Map() + + this.calculator = new Calculator(opts) + this.error = null + this.options = opts + this.tree = tree + this.filterSet = opts.filterSet + } + + async run () { + this.report = await this[_getReport]() + log.silly('audit report', this.report) + if (this.report) { + await this[_init]() + } + return this + } + + isVulnerable (node) { + const vuln = this.get(node.packageName) + return !!(vuln && vuln.isVulnerable(node)) + } + + async [_init] () { + const timeEnd = time.start('auditReport:init') + + const promises = [] + for (const [name, advisories] of Object.entries(this.report)) { + for (const advisory of advisories) { + promises.push(this.calculator.calculate(name, advisory)) + } + } + + // now the advisories are calculated with a set of versions + // and the packument. turn them into our style of vuln objects + // which also have the affected nodes, and also create entries + // for all the metavulns that we find from dependents. + const advisories = new Set(await Promise.all(promises)) + const seen = new Set() + for (const advisory of advisories) { + const { name, range } = advisory + const k = `${name}@${range}` + + const vuln = this.get(name) || new Vuln({ name, advisory }) + if (this.has(name)) { + vuln.addAdvisory(advisory) + } + super.set(name, vuln) + + // don't flag the exact same name/range more than once + // adding multiple advisories with the same range is fine, but no + // need to search for nodes we already would have added. + if (!seen.has(k)) { + const p = [] + for (const node of this.tree.inventory.query('packageName', name)) { + if (!shouldAudit(node, this[_omit], this.filterSet)) { + continue + } + + // if not vulnerable by this advisory, keep searching + if (!advisory.testVersion(node.version)) { + continue + } + + // we will have loaded the source already if this is a metavuln + if (advisory.type === 'metavuln') { + vuln.addVia(this.get(advisory.dependency)) + } + + // already marked this one, no need to do it again + if (vuln.nodes.has(node)) { + continue + } + + // haven't marked this one yet. get its dependents. + vuln.nodes.add(node) + for (const { from: dep, spec } of node.edgesIn) { + if (dep.isTop && !vuln.topNodes.has(dep)) { + this[_checkTopNode](dep, vuln, spec) + } else { + // calculate a metavuln, if necessary + const calc = this.calculator.calculate(dep.packageName, advisory) + // eslint-disable-next-line promise/always-return + p.push(calc.then(meta => { + // eslint-disable-next-line promise/always-return + if (meta.testVersion(dep.version, spec)) { + advisories.add(meta) + } + })) + } + } + } + await Promise.all(p) + seen.add(k) + } + + // make sure we actually got something. if not, remove it + // this can happen if you are loading from a lockfile created by + // npm v5, since it lists the current version of all deps, + // rather than the range that is actually depended upon, + // or if using --omit with the older audit endpoint. + if (this.get(name).nodes.size === 0) { + this.delete(name) + continue + } + + // if the vuln is valid, but THIS advisory doesn't apply to any of + // the nodes it references, then remove it from the advisory list. + // happens when using omit with old audit endpoint. + for (const advisory of vuln.advisories) { + const relevant = [...vuln.nodes] + .some(n => advisory.testVersion(n.version)) + if (!relevant) { + vuln.deleteAdvisory(advisory) + } + } + } + + timeEnd() + } + + [_checkTopNode] (topNode, vuln, spec) { + vuln.fixAvailable = this[_fixAvailable](topNode, vuln, spec) + + if (vuln.fixAvailable !== true) { + // now we know the top node is vulnerable, and cannot be + // upgraded out of the bad place without --force. But, there's + // no need to add it to the actual vulns list, because nothing + // depends on root. + this.topVulns.set(vuln.name, vuln) + vuln.topNodes.add(topNode) + } + } + + // check whether the top node is vulnerable. + // check whether we can get out of the bad place with --force, and if + // so, whether that update is SemVer Major + [_fixAvailable] (topNode, vuln, spec) { + // this will always be set to at least {name, versions:{}} + const paku = vuln.packument + + if (!vuln.testSpec(spec)) { + return true + } + + // similarly, even if we HAVE a packument, but we're looking for it + // somewhere other than the registry, and we got something vulnerable, + // then we're stuck with it. + const specObj = npa(spec) + if (!specObj.registry) { + return false + } + + if (specObj.subSpec) { + spec = specObj.subSpec.rawSpec + } + + // We don't provide fixes for top nodes other than root, but we + // still check to see if the node is fixable with a different version, + // and if that is a semver major bump. + try { + const { + _isSemVerMajor: isSemVerMajor, + version, + name, + } = pickManifest(paku, spec, { + ...this.options, + before: null, + avoid: vuln.range, + avoidStrict: true, + }) + return { name, version, isSemVerMajor } + } catch (er) { + return false + } + } + + set () { + throw new Error('do not call AuditReport.set() directly') + } + + async [_getReport] () { + // if we're not auditing, just return false + if (this.options.audit === false || this.options.offline === true || this.tree.inventory.size === 1) { + return null + } + + const timeEnd = time.start('auditReport:getReport') + try { + const body = prepareBulkData(this.tree, this[_omit], this.filterSet) + log.silly('audit', 'bulk request', body) + + // no sense asking if we don't have anything to audit, + // we know it'll be empty + if (!Object.keys(body).length) { + return null + } + + const res = await npmFetch('/-/npm/v1/security/advisories/bulk', { + ...this.options, + registry: this.options.auditRegistry || this.options.registry, + method: 'POST', + gzip: true, + body, + }) + + return await res.json() + } catch (er) { + log.verbose('audit error', er) + log.silly('audit error', String(er.body)) + this.error = er + return null + } finally { + timeEnd() + } + } +} + +// return true if we should audit this one +const shouldAudit = (node, omit, filterSet) => + !node.version ? false + : node.isRoot ? false + : filterSet && filterSet.size !== 0 && !filterSet.has(node) ? false + : omit.size === 0 ? true + : !( // otherwise, just ensure we're not omitting this one + node.dev && omit.has('dev') || + node.optional && omit.has('optional') || + node.devOptional && omit.has('dev') && omit.has('optional') || + node.peer && omit.has('peer') + ) + +const prepareBulkData = (tree, omit, filterSet) => { + const payload = {} + for (const name of tree.inventory.query('packageName')) { + const set = new Set() + for (const node of tree.inventory.query('packageName', name)) { + if (!shouldAudit(node, omit, filterSet)) { + continue + } + + set.add(node.version) + } + if (set.size) { + payload[name] = [...set] + } + } + return payload +} + +module.exports = AuditReport diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js new file mode 100644 index 00000000..bcd30d0f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js @@ -0,0 +1,126 @@ +const { depth } = require('treeverse') + +const calcDepFlags = (tree, resetRoot = true) => { + if (resetRoot) { + tree.dev = false + tree.optional = false + tree.devOptional = false + tree.peer = false + } + const ret = depth({ + tree, + visit: node => calcDepFlagsStep(node), + filter: node => node, + getChildren: (node, tree) => + [...tree.edgesOut.values()].map(edge => edge.to), + }) + return ret +} + +const calcDepFlagsStep = (node) => { + // This rewalk is necessary to handle cases where devDep and optional + // or normal dependency graphs overlap deep in the dep graph. + // Since we're only walking through deps that are not already flagged + // as non-dev/non-optional, it's typically a very shallow traversal + node.extraneous = false + resetParents(node, 'extraneous') + resetParents(node, 'dev') + resetParents(node, 'peer') + resetParents(node, 'devOptional') + resetParents(node, 'optional') + + // for links, map their hierarchy appropriately + if (node.isLink) { + // node.target can be null, we check to ensure it's not null before proceeding + if (node.target == null) { + return node + } + node.target.dev = node.dev + node.target.optional = node.optional + node.target.devOptional = node.devOptional + node.target.peer = node.peer + return calcDepFlagsStep(node.target) + } + + node.edgesOut.forEach(({ peer, optional, dev, to }) => { + // if the dep is missing, then its flags are already maximally unset + if (!to) { + return + } + + // everything with any kind of edge into it is not extraneous + to.extraneous = false + + // devOptional is the *overlap* of the dev and optional tree. + // however, for convenience and to save an extra rewalk, we leave + // it set when we are in *either* tree, and then omit it from the + // package-lock if either dev or optional are set. + const unsetDevOpt = !node.devOptional && !node.dev && !node.optional && !dev && !optional + + // if we are not in the devOpt tree, then we're also not in + // either the dev or opt trees + const unsetDev = unsetDevOpt || !node.dev && !dev + const unsetOpt = unsetDevOpt || !node.optional && !optional + const unsetPeer = !node.peer && !peer + + if (unsetPeer) { + unsetFlag(to, 'peer') + } + + if (unsetDevOpt) { + unsetFlag(to, 'devOptional') + } + + if (unsetDev) { + unsetFlag(to, 'dev') + } + + if (unsetOpt) { + unsetFlag(to, 'optional') + } + }) + + return node +} + +const resetParents = (node, flag) => { + if (node[flag]) { + return + } + + for (let p = node; p && (p === node || p[flag]); p = p.resolveParent) { + p[flag] = false + } +} + +// typically a short walk, since it only traverses deps that have the flag set. +const unsetFlag = (node, flag) => { + if (node[flag]) { + node[flag] = false + depth({ + tree: node, + visit: node => { + node.extraneous = node[flag] = false + if (node.isLink && node.target) { + node.target.extraneous = node.target[flag] = false + } + }, + getChildren: node => { + const children = [] + const targetNode = node.isLink && node.target ? node.target : node + for (const edge of targetNode.edgesOut.values()) { + if ( + edge.to && + edge.to[flag] && + ((flag !== 'peer' && edge.type === 'peer') || edge.type === 'prod') + ) { + children.push(edge.to) + } + } + return children + }, + }) + } +} + +module.exports = calcDepFlags diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js new file mode 100644 index 00000000..1a3ccff6 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/can-place-dep.js @@ -0,0 +1,436 @@ +// Internal methods used by buildIdealTree. +// Answer the question: "can I put this dep here?" +// +// IMPORTANT: *nothing* in this class should *ever* modify or mutate the tree +// at all. The contract here is strictly limited to read operations. We call +// this in the process of walking through the ideal tree checking many +// different potential placement targets for a given node. If a change is made +// to the tree along the way, that can cause serious problems! +// +// In order to enforce this restriction, in debug mode, canPlaceDep() will +// snapshot the tree at the start of the process, and then at the end, will +// verify that it still matches the snapshot, and throw an error if any changes +// occurred. +// +// The algorithm is roughly like this: +// - check the node itself: +// - if there is no version present, and no conflicting edges from target, +// OK, provided all peers can be placed at or above the target. +// - if the current version matches, KEEP +// - if there is an older version present, which can be replaced, then +// - if satisfying and preferDedupe? KEEP +// - else: REPLACE +// - if there is a newer version present, and preferDedupe, REPLACE +// - if the version present satisfies the edge, KEEP +// - else: CONFLICT +// - if the node is not in conflict, check each of its peers: +// - if the peer can be placed in the target, continue +// - else if the peer can be placed in a parent, and there is no other +// conflicting version shadowing it, continue +// - else CONFLICT +// - If the peers are not in conflict, return the original node's value +// +// An exception to this logic is that if the target is the deepest location +// that a node can be placed, and the conflicting node can be placed deeper, +// then we will return REPLACE rather than CONFLICT, and Arborist will queue +// the replaced node for resolution elsewhere. + +const localeCompare = require('@isaacs/string-locale-compare')('en') +const semver = require('semver') +const debug = require('./debug.js') +const peerEntrySets = require('./peer-entry-sets.js') +const deepestNestingTarget = require('./deepest-nesting-target.js') + +const CONFLICT = Symbol('CONFLICT') +const OK = Symbol('OK') +const REPLACE = Symbol('REPLACE') +const KEEP = Symbol('KEEP') + +class CanPlaceDep { + // dep is a dep that we're trying to place. it should already live in + // a virtual tree where its peer set is loaded as children of the root. + // target is the actual place where we're trying to place this dep + // in a node_modules folder. + // edge is the edge that we're trying to satisfy with this placement. + // parent is the CanPlaceDep object of the entry node when placing a peer. + constructor (options) { + const { + dep, + target, + edge, + preferDedupe, + parent = null, + peerPath = [], + explicitRequest = false, + } = options + + debug(() => { + if (!dep) { + throw new Error('no dep provided to CanPlaceDep') + } + + if (!target) { + throw new Error('no target provided to CanPlaceDep') + } + + if (!edge) { + throw new Error('no edge provided to CanPlaceDep') + } + + this._treeSnapshot = JSON.stringify([...target.root.inventory.entries()] + .map(([loc, { packageName, version, resolved }]) => { + return [loc, packageName, version, resolved] + }).sort(([a], [b]) => localeCompare(a, b))) + }) + + // the result of whether we can place it or not + this.canPlace = null + // if peers conflict, but this one doesn't, then that is useful info + this.canPlaceSelf = null + + this.dep = dep + this.target = target + this.edge = edge + this.explicitRequest = explicitRequest + + // preventing cycles when we check peer sets + this.peerPath = peerPath + // we always prefer to dedupe peers, because they are trying + // a bit harder to be singletons. + this.preferDedupe = !!preferDedupe || edge.peer + this.parent = parent + this.children = [] + + this.isSource = target === this.peerSetSource + this.name = edge.name + this.current = target.children.get(this.name) + this.targetEdge = target.edgesOut.get(this.name) + this.conflicts = new Map() + + // check if this dep was already subject to a peerDep override while + // building the peerSet. + this.edgeOverride = !dep.satisfies(edge) + + this.canPlace = this.checkCanPlace() + if (!this.canPlaceSelf) { + this.canPlaceSelf = this.canPlace + } + + debug(() => { + const treeSnapshot = JSON.stringify([...target.root.inventory.entries()] + .map(([loc, { packageName, version, resolved }]) => { + return [loc, packageName, version, resolved] + }).sort(([a], [b]) => localeCompare(a, b))) + /* istanbul ignore if */ + if (this._treeSnapshot !== treeSnapshot) { + throw Object.assign(new Error('tree changed in CanPlaceDep'), { + expect: this._treeSnapshot, + actual: treeSnapshot, + }) + } + }) + } + + checkCanPlace () { + const { target, targetEdge, current, dep } = this + + // if the dep failed to load, we're going to fail the build or + // prune it out anyway, so just move forward placing/replacing it. + if (dep.errors.length) { + return current ? REPLACE : OK + } + + // cannot place peers inside their dependents, except for tops + if (targetEdge && targetEdge.peer && !target.isTop) { + return CONFLICT + } + + // skip this test if there's a current node, because we might be able + // to dedupe against it anyway + if (!current && + targetEdge && + !dep.satisfies(targetEdge) && + targetEdge !== this.edge) { + return CONFLICT + } + + return current ? this.checkCanPlaceCurrent() : this.checkCanPlaceNoCurrent() + } + + // we know that the target has a dep by this name in its node_modules + // already. Can return KEEP, REPLACE, or CONFLICT. + checkCanPlaceCurrent () { + const { preferDedupe, explicitRequest, current, target, edge, dep } = this + + if (dep.matches(current)) { + if (current.satisfies(edge) || this.edgeOverride) { + return explicitRequest ? REPLACE : KEEP + } + } + + const { version: curVer } = current + const { version: newVer } = dep + const tryReplace = curVer && newVer && semver.gte(newVer, curVer) + if (tryReplace && dep.canReplace(current)) { + // It's extremely rare that a replaceable node would be a conflict, if + // the current one wasn't a conflict, but it is theoretically possible + // if peer deps are pinned. In that case we treat it like any other + // conflict, and keep trying. + const cpp = this.canPlacePeers(REPLACE) + if (cpp !== CONFLICT) { + return cpp + } + } + + // ok, can't replace the current with new one, but maybe current is ok? + if (current.satisfies(edge) && (!explicitRequest || preferDedupe)) { + return KEEP + } + + // if we prefer deduping, then try replacing newer with older + if (preferDedupe && !tryReplace && dep.canReplace(current)) { + const cpp = this.canPlacePeers(REPLACE) + if (cpp !== CONFLICT) { + return cpp + } + } + + // Check for interesting cases! + // First, is this the deepest place that this thing can go, and NOT the + // deepest place where the conflicting dep can go? If so, replace it, + // and let it re-resolve deeper in the tree. + const myDeepest = this.deepestNestingTarget + + // ok, i COULD be placed deeper, so leave the current one alone. + if (target !== myDeepest) { + return CONFLICT + } + + // if we are not checking a peerDep, then we MUST place it here, in the + // target that has a non-peer dep on it. + if (!edge.peer && target === edge.from) { + return this.canPlacePeers(REPLACE) + } + + // if we aren't placing a peer in a set, then we're done here. + // This is ignored because it SHOULD be redundant, as far as I can tell, + // with the deepest target and target===edge.from tests. But until we + // can prove that isn't possible, this condition is here for safety. + /* istanbul ignore if - allegedly impossible */ + if (!this.parent && !edge.peer) { + return CONFLICT + } + + // check the deps in the peer group for each edge into that peer group + // if ALL of them can be pushed deeper, or if it's ok to replace its + // members with the contents of the new peer group, then we're good. + let canReplace = true + for (const [entryEdge, currentPeers] of peerEntrySets(current)) { + if (entryEdge === this.edge || entryEdge === this.peerEntryEdge) { + continue + } + + // First, see if it's ok to just replace the peerSet entirely. + // we do this by walking out from the entryEdge, because in a case like + // this: + // + // v -> PEER(a@1||2) + // a@1 -> PEER(b@1) + // a@2 -> PEER(b@2) + // b@1 -> PEER(a@1) + // b@2 -> PEER(a@2) + // + // root + // +-- v + // +-- a@2 + // +-- b@2 + // + // Trying to place a peer group of (a@1, b@1) would fail to note that + // they can be replaced, if we did it by looping 1 by 1. If we are + // replacing something, we don't have to check its peer deps, because + // the peerDeps in the placed peerSet will presumably satisfy. + const entryNode = entryEdge.to + const entryRep = dep.parent.children.get(entryNode.name) + if (entryRep) { + if (entryRep.canReplace(entryNode, dep.parent.children.keys())) { + continue + } + } + + let canClobber = !entryRep + if (!entryRep) { + const peerReplacementWalk = new Set([entryNode]) + OUTER: for (const currentPeer of peerReplacementWalk) { + for (const edge of currentPeer.edgesOut.values()) { + if (!edge.peer || !edge.valid) { + continue + } + const rep = dep.parent.children.get(edge.name) + if (!rep) { + if (edge.to) { + peerReplacementWalk.add(edge.to) + } + continue + } + if (!rep.satisfies(edge)) { + canClobber = false + break OUTER + } + } + } + } + if (canClobber) { + continue + } + + // ok, we can't replace, but maybe we can nest the current set deeper? + let canNestCurrent = true + for (const currentPeer of currentPeers) { + if (!canNestCurrent) { + break + } + + // still possible to nest this peerSet + const curDeep = deepestNestingTarget(entryEdge.from, currentPeer.name) + if (curDeep === target || target.isDescendantOf(curDeep)) { + canNestCurrent = false + canReplace = false + } + if (canNestCurrent) { + continue + } + } + } + + // if we can nest or replace all the current peer groups, we can replace. + if (canReplace) { + return this.canPlacePeers(REPLACE) + } + + return CONFLICT + } + + checkCanPlaceNoCurrent () { + const { target, peerEntryEdge, dep, name } = this + + // check to see what that name resolves to here, and who may depend on + // being able to reach it by crawling up past the parent. we know + // that it's not the target's direct child node, and if it was a direct + // dep of the target, we would have conflicted earlier. + const current = target !== peerEntryEdge.from && target.resolve(name) + if (current) { + for (const edge of current.edgesIn.values()) { + if (edge.from.isDescendantOf(target) && edge.valid) { + if (!dep.satisfies(edge)) { + return CONFLICT + } + } + } + } + + // no objections, so this is fine as long as peers are ok here. + return this.canPlacePeers(OK) + } + + get deepestNestingTarget () { + const start = this.parent ? this.parent.deepestNestingTarget + : this.edge.from + return deepestNestingTarget(start, this.name) + } + + get conflictChildren () { + return this.allChildren.filter(c => c.canPlace === CONFLICT) + } + + get allChildren () { + const set = new Set(this.children) + for (const child of set) { + for (const grandchild of child.children) { + set.add(grandchild) + } + } + return [...set] + } + + get top () { + return this.parent ? this.parent.top : this + } + + // check if peers can go here. returns state or CONFLICT + canPlacePeers (state) { + this.canPlaceSelf = state + if (this._canPlacePeers) { + return this._canPlacePeers + } + + // TODO: represent peerPath in ERESOLVE error somehow? + const peerPath = [...this.peerPath, this.dep] + let sawConflict = false + for (const peerEdge of this.dep.edgesOut.values()) { + if (!peerEdge.peer || !peerEdge.to || peerPath.includes(peerEdge.to)) { + continue + } + const peer = peerEdge.to + // it may be the case that the *initial* dep can be nested, but a peer + // of that dep needs to be placed shallower, because the target has + // a peer dep on the peer as well. + const target = deepestNestingTarget(this.target, peer.name) + const cpp = new CanPlaceDep({ + dep: peer, + target, + parent: this, + edge: peerEdge, + peerPath, + // always place peers in preferDedupe mode + preferDedupe: true, + }) + /* istanbul ignore next */ + debug(() => { + if (this.children.some(c => c.dep === cpp.dep)) { + throw new Error('checking same dep repeatedly') + } + }) + this.children.push(cpp) + + if (cpp.canPlace === CONFLICT) { + sawConflict = true + } + } + + this._canPlacePeers = sawConflict ? CONFLICT : state + return this._canPlacePeers + } + + // what is the node that is causing this peerSet to be placed? + get peerSetSource () { + return this.parent ? this.parent.peerSetSource : this.edge.from + } + + get peerEntryEdge () { + return this.top.edge + } + + static get CONFLICT () { + return CONFLICT + } + + static get OK () { + return OK + } + + static get REPLACE () { + return REPLACE + } + + static get KEEP () { + return KEEP + } + + get description () { + const { canPlace } = this + return canPlace && canPlace.description || + /* istanbul ignore next - old node affordance */ canPlace + } +} + +module.exports = CanPlaceDep diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/case-insensitive-map.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/case-insensitive-map.js new file mode 100644 index 00000000..afc6afbe --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/case-insensitive-map.js @@ -0,0 +1,50 @@ +// package children are represented with a Map object, but many file systems +// are case-insensitive and unicode-normalizing, so we need to treat +// node.children.get('FOO') and node.children.get('foo') as the same thing. + +module.exports = class CIMap extends Map { + #keys = new Map() + + constructor (items = []) { + super() + for (const [key, val] of items) { + this.set(key, val) + } + } + + #normKey (key) { + if (typeof key !== 'string') { + return key + } + return key.normalize('NFKD').toLowerCase() + } + + get (key) { + const normKey = this.#normKey(key) + return this.#keys.has(normKey) ? super.get(this.#keys.get(normKey)) + : undefined + } + + set (key, val) { + const normKey = this.#normKey(key) + if (this.#keys.has(normKey)) { + super.delete(this.#keys.get(normKey)) + } + this.#keys.set(normKey, key) + return super.set(key, val) + } + + delete (key) { + const normKey = this.#normKey(key) + if (this.#keys.has(normKey)) { + const prevKey = this.#keys.get(normKey) + this.#keys.delete(normKey) + return super.delete(prevKey) + } + } + + has (key) { + const normKey = this.#normKey(key) + return this.#keys.has(normKey) && super.has(this.#keys.get(normKey)) + } +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/consistent-resolve.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/consistent-resolve.js new file mode 100644 index 00000000..7c988048 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/consistent-resolve.js @@ -0,0 +1,45 @@ +// take a path and a resolved value, and turn it into a resolution from +// the given new path. This is used with converting a package.json's +// relative file: path into one suitable for a lockfile, or between +// lockfiles, and for converting hosted git repos to a consistent url type. +const npa = require('npm-package-arg') +const relpath = require('./relpath.js') +const consistentResolve = (resolved, fromPath, toPath, relPaths = false) => { + if (!resolved) { + return null + } + + try { + const hostedOpt = { noCommittish: false } + const { + fetchSpec, + saveSpec, + type, + hosted, + rawSpec, + raw, + } = npa(resolved, fromPath) + if (type === 'file' || type === 'directory') { + const cleanFetchSpec = fetchSpec.replace(/#/g, '%23') + if (relPaths && toPath) { + return `file:${relpath(toPath, cleanFetchSpec)}` + } + return `file:${cleanFetchSpec}` + } + if (hosted) { + return `git+${hosted.auth ? hosted.https(hostedOpt) : hosted.sshurl(hostedOpt)}` + } + if (type === 'git') { + return saveSpec + } + if (rawSpec === '*') { + return raw + } + return rawSpec + } catch (_) { + // whatever we passed in was not acceptable to npa. + // leave it 100% untouched. + return resolved + } +} +module.exports = consistentResolve diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/debug.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/debug.js new file mode 100644 index 00000000..d5197b46 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/debug.js @@ -0,0 +1,32 @@ +// certain assertions we should do only when testing arborist itself, because +// they are too expensive or aggressive and would break user programs if we +// miss a situation where they are actually valid. +// +// call like this: +// +// /* istanbul ignore next - debug check */ +// debug(() => { +// if (someExpensiveCheck) +// throw new Error('expensive check should have returned false') +// }) + +// run in debug mode if explicitly requested, running arborist tests, +// or working in the arborist project directory. + +const debug = process.env.ARBORIST_DEBUG !== '0' && ( + process.env.ARBORIST_DEBUG === '1' || + /\barborist\b/.test(process.env.NODE_DEBUG || '') || + process.env.npm_package_name === '@npmcli/arborist' && + ['test', 'snap'].includes(process.env.npm_lifecycle_event) || + process.cwd() === require('node:path').resolve(__dirname, '..') +) + +module.exports = debug ? fn => fn() : () => {} +const red = process.stderr.isTTY ? msg => `\x1B[31m${msg}\x1B[39m` : m => m +module.exports.log = (...msg) => module.exports(() => { + const { format } = require('node:util') + const prefix = `\n${process.pid} ${red(format(msg.shift()))} ` + msg = (prefix + format(...msg).trim().split('\n').join(prefix)).trim() + /* eslint-disable-next-line no-console */ + console.error(msg) +}) diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/deepest-nesting-target.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/deepest-nesting-target.js new file mode 100644 index 00000000..2c6647f5 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/deepest-nesting-target.js @@ -0,0 +1,18 @@ +// given a starting node, what is the *deepest* target where name could go? +// This is not on the Node class for the simple reason that we sometimes +// need to check the deepest *potential* target for a Node that is not yet +// added to the tree where we are checking. +const deepestNestingTarget = (start, name) => { + for (const target of start.ancestry()) { + // note: this will skip past the first target if edge is peer + if (target.isProjectRoot || !target.resolveParent || target.globalTop) { + return target + } + const targetEdge = target.edgesOut.get(name) + if (!targetEdge || !targetEdge.peer) { + return target + } + } +} + +module.exports = deepestNestingTarget diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/dep-valid.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/dep-valid.js new file mode 100644 index 00000000..e80310d9 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/dep-valid.js @@ -0,0 +1,150 @@ +// Do not rely on package._fields, so that we don't throw +// false failures if a tree is generated by other clients. +// Only relies on child.resolved, which MAY come from +// client-specific package.json meta _fields, but most of +// the time will be pulled out of a lockfile + +const semver = require('semver') +const npa = require('npm-package-arg') +const { relative } = require('node:path') +const fromPath = require('./from-path.js') + +const depValid = (child, requested, requestor) => { + // NB: we don't do much to verify 'tag' type requests. + // Just verify that we got a remote resolution. Presumably, it + // came from a registry and was tagged at some point. + + if (typeof requested === 'string') { + try { + // tarball/dir must have resolved to the same tgz on disk, but for + // file: deps that depend on other files/dirs, we must resolve the + // location based on the *requestor* file/dir, not where it ends up. + // '' is equivalent to '*' + requested = npa.resolve(child.name, requested || '*', fromPath(requestor, requestor.edgesOut.get(child.name))) + } catch (er) { + // Not invalid because the child doesn't match, but because + // the spec itself is not supported. Nothing would match, + // so the edge is definitely not valid and never can be. + er.dependency = child.name + er.requested = requested + requestor.errors.push(er) + return false + } + } + + // if the lockfile is super old, or hand-modified, + // then it's possible to hit this state. + if (!requested) { + const er = new Error('Invalid dependency specifier') + er.dependency = child.name + er.requested = requested + requestor.errors.push(er) + return false + } + + switch (requested.type) { + case 'range': + if (requested.fetchSpec === '*') { + return true + } + // fallthrough + case 'version': + // if it's a version or a range other than '*', semver it + return semver.satisfies(child.version, requested.fetchSpec, true) + + case 'directory': + return linkValid(child, requested, requestor) + + case 'file': + return tarballValid(child, requested, requestor) + + case 'alias': + // check that the alias target is valid + return depValid(child, requested.subSpec, requestor) + + case 'tag': + // if it's a tag, we just verify that it has a tarball resolution + // presumably, it came from the registry and was tagged at some point + return child.resolved && npa(child.resolved).type === 'remote' + + case 'remote': + // verify that we got it from the desired location + return child.resolved === requested.fetchSpec + + case 'git': { + // if it's a git type, verify that they're the same repo + // + // if it specifies a definite commit, then it must have the + // same commit to be considered the same repo + // + // if it has a #semver: specifier, verify that the + // version in the package is in the semver range + const resRepo = npa(child.resolved || '') + const resHost = resRepo.hosted + const reqHost = requested.hosted + const reqCommit = /^[a-fA-F0-9]{40}$/.test(requested.gitCommittish || '') + const nc = { noCommittish: !reqCommit } + if (!resHost) { + if (resRepo.fetchSpec !== requested.fetchSpec) { + return false + } + } else { + if (reqHost?.ssh(nc) !== resHost.ssh(nc)) { + return false + } + } + if (!requested.gitRange) { + return true + } + return semver.satisfies(child.package.version, requested.gitRange, { + loose: true, + }) + } + + default: // unpossible, just being cautious + break + } + + const er = new Error('Unsupported dependency type') + er.dependency = child.name + er.requested = requested + requestor.errors.push(er) + return false +} + +const linkValid = (child, requested, requestor) => { + const isLink = !!child.isLink + // if we're installing links and the node is a link, then it's invalid because we want + // a real node to be there. Except for workspaces. They are always links. + if (requestor.installLinks && !child.isWorkspace) { + return !isLink + } + + // directory must be a link to the specified folder + return isLink && relative(child.realpath, requested.fetchSpec) === '' +} + +const tarballValid = (child, requested) => { + if (child.isLink) { + return false + } + + if (child.resolved) { + return child.resolved.replace(/\\/g, '/') === `file:${requested.fetchSpec.replace(/\\/g, '/')}` + } + + // if we have a legacy mutated package.json file. we can't be 100% + // sure that it resolved to the same file, but if it was the same + // request, that's a pretty good indicator of sameness. + if (child.package._requested) { + return child.package._requested.saveSpec === requested.saveSpec + } + + // ok, we're probably dealing with some legacy cruft here, not much + // we can do at this point unfortunately. + return false +} + +module.exports = (child, requested, accept, requestor) => + depValid(child, requested, requestor) || + (typeof accept === 'string' ? depValid(child, accept, requestor) : false) diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/diff.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/diff.js new file mode 100644 index 00000000..fb94407b --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/diff.js @@ -0,0 +1,306 @@ +// a tree representing the difference between two trees +// A Diff node's parent is not necessarily the parent of +// the node location it refers to, but rather the highest level +// node that needs to be either changed or removed. +// Thus, the root Diff node is the shallowest change required +// for a given branch of the tree being mutated. + +const { depth } = require('treeverse') +const { existsSync } = require('node:fs') + +const ssri = require('ssri') + +class Diff { + constructor ({ actual, ideal, filterSet, shrinkwrapInflated }) { + this.filterSet = filterSet + this.shrinkwrapInflated = shrinkwrapInflated + this.children = [] + this.actual = actual + this.ideal = ideal + if (this.ideal) { + this.resolved = this.ideal.resolved + this.integrity = this.ideal.integrity + } + this.action = getAction(this) + this.parent = null + // the set of leaf nodes that we rake up to the top level + this.leaves = [] + // the set of nodes that don't change in this branch of the tree + this.unchanged = [] + // the set of nodes that will be removed in this branch of the tree + this.removed = [] + } + + static calculate ({ + actual, + ideal, + filterNodes = [], + shrinkwrapInflated = new Set(), + }) { + // if there's a filterNode, then: + // - get the path from the root to the filterNode. The root or + // root.target should have an edge either to the filterNode or + // a link to the filterNode. If not, abort. Add the path to the + // filterSet. + // - Add set of Nodes depended on by the filterNode to filterSet. + // - Anything outside of that set should be ignored by getChildren + const filterSet = new Set() + const extraneous = new Set() + for (const filterNode of filterNodes) { + const { root } = filterNode + if (root !== ideal && root !== actual) { + throw new Error('invalid filterNode: outside idealTree/actualTree') + } + const rootTarget = root.target + const edge = [...rootTarget.edgesOut.values()].filter(e => { + return e.to && (e.to === filterNode || e.to.target === filterNode) + })[0] + filterSet.add(root) + filterSet.add(rootTarget) + filterSet.add(ideal) + filterSet.add(actual) + if (edge && edge.to) { + filterSet.add(edge.to) + filterSet.add(edge.to.target) + } + filterSet.add(filterNode) + + depth({ + tree: filterNode, + visit: node => filterSet.add(node), + getChildren: node => { + node = node.target + const loc = node.location + const idealNode = ideal.inventory.get(loc) + const ideals = !idealNode ? [] + : [...idealNode.edgesOut.values()].filter(e => e.to).map(e => e.to) + const actualNode = actual.inventory.get(loc) + const actuals = !actualNode ? [] + : [...actualNode.edgesOut.values()].filter(e => e.to).map(e => e.to) + if (actualNode) { + for (const child of actualNode.children.values()) { + if (child.extraneous) { + extraneous.add(child) + } + } + } + + return ideals.concat(actuals) + }, + }) + } + for (const extra of extraneous) { + filterSet.add(extra) + } + + return depth({ + tree: new Diff({ actual, ideal, filterSet, shrinkwrapInflated }), + getChildren, + leave, + }) + } +} + +const getAction = ({ actual, ideal }) => { + if (!ideal) { + return 'REMOVE' + } + + // bundled meta-deps are copied over to the ideal tree when we visit it, + // so they'll appear to be missing here. There's no need to handle them + // in the diff, though, because they'll be replaced at reify time anyway + // Otherwise, add the missing node. + if (!actual) { + return ideal.inDepBundle ? null : 'ADD' + } + + // always ignore the root node + if (ideal.isRoot && actual.isRoot) { + return null + } + + // if the versions don't match, it's a change no matter what + if (ideal.version !== actual.version) { + return 'CHANGE' + } + + const binsExist = ideal.binPaths.every((path) => existsSync(path)) + + // top nodes, links, and git deps won't have integrity, but do have resolved + // if neither node has integrity, the bins exist, and either (a) neither + // node has a resolved value or (b) they both do and match, then we can + // leave this one alone since we already know the versions match due to + // the condition above. The "neither has resolved" case (a) cannot be + // treated as a 'mark CHANGE and refetch', because shrinkwraps, bundles, + // and link deps may lack this information, and we don't want to try to + // go to the registry for something that isn't there. + const noIntegrity = !ideal.integrity && !actual.integrity + const noResolved = !ideal.resolved && !actual.resolved + const resolvedMatch = ideal.resolved && ideal.resolved === actual.resolved + if (noIntegrity && binsExist && (resolvedMatch || noResolved)) { + return null + } + + // otherwise, verify that it's the same bits + // note that if ideal has integrity, and resolved doesn't, we treat + // that as a 'change', so that it gets re-fetched and locked down. + const integrityMismatch = !ideal.integrity || !actual.integrity || + !ssri.parse(ideal.integrity).match(actual.integrity) + if (integrityMismatch || !binsExist) { + return 'CHANGE' + } + + return null +} + +const allChildren = node => { + if (!node) { + return new Map() + } + + // if the node is root, and also a link, then what we really + // want is to traverse the target's children + if (node.isRoot && node.isLink) { + return allChildren(node.target) + } + + const kids = new Map() + for (const n of [node, ...node.fsChildren]) { + for (const kid of n.children.values()) { + kids.set(kid.path, kid) + } + } + return kids +} + +// functions for the walk options when we traverse the trees +// to create the diff tree +const getChildren = diff => { + const children = [] + const { + actual, + ideal, + unchanged, + removed, + filterSet, + shrinkwrapInflated, + } = diff + + // Note: we DON'T diff fsChildren themselves, because they are either + // included in the package contents, or part of some other project, and + // will never appear in legacy shrinkwraps anyway. but we _do_ include the + // child nodes of fsChildren, because those are nodes that we are typically + // responsible for installing. + const actualKids = allChildren(actual) + const idealKids = allChildren(ideal) + + if (ideal && ideal.hasShrinkwrap && !shrinkwrapInflated.has(ideal)) { + // Guaranteed to get a diff.leaves here, because we always + // be called with a proper Diff object when ideal has a shrinkwrap + // that has not been inflated. + diff.leaves.push(diff) + return children + } + + const paths = new Set([...actualKids.keys(), ...idealKids.keys()]) + for (const path of paths) { + const actual = actualKids.get(path) + const ideal = idealKids.get(path) + diffNode({ + actual, + ideal, + children, + unchanged, + removed, + filterSet, + shrinkwrapInflated, + }) + } + + if (diff.leaves && !children.length) { + diff.leaves.push(diff) + } + + return children +} + +const diffNode = ({ + actual, + ideal, + children, + unchanged, + removed, + filterSet, + shrinkwrapInflated, +}) => { + if (filterSet.size && !(filterSet.has(ideal) || filterSet.has(actual))) { + return + } + + const action = getAction({ actual, ideal }) + + // if it's a match, then get its children + // otherwise, this is the child diff node + if (action || (!shrinkwrapInflated.has(ideal) && ideal.hasShrinkwrap)) { + if (action === 'REMOVE') { + removed.push(actual) + } + children.push(new Diff({ actual, ideal, filterSet, shrinkwrapInflated })) + } else { + unchanged.push(ideal) + // !*! Weird dirty hack warning !*! + // + // Bundled deps aren't loaded in the ideal tree, because we don't know + // what they are going to be without unpacking. Swap them over now if + // the bundling node isn't changing, so we don't prune them later. + // + // It's a little bit dirty to be doing this here, since it means that + // diffing trees can mutate them, but otherwise we have to walk over + // all unchanging bundlers and correct the diff later, so it's more + // efficient to just fix it while we're passing through already. + // + // Note that moving over a bundled dep will break the links to other + // deps under this parent, which may have been transitively bundled. + // Breaking those links means that we'll no longer see the transitive + // dependency, meaning that it won't appear as bundled any longer! + // In order to not end up dropping transitively bundled deps, we have + // to get the list of nodes to move, then move them all at once, rather + // than moving them one at a time in the first loop. + const bd = ideal.package.bundleDependencies + if (actual && bd && bd.length) { + const bundledChildren = [] + for (const node of actual.children.values()) { + if (node.inBundle) { + bundledChildren.push(node) + } + } + for (const node of bundledChildren) { + node.parent = ideal + } + } + children.push(...getChildren({ + actual, + ideal, + unchanged, + removed, + filterSet, + shrinkwrapInflated, + })) + } +} + +// set the parentage in the leave step so that we aren't attaching +// child nodes only to remove them later. also bubble up the unchanged +// nodes so that we can move them out of staging in the reification step. +const leave = (diff, children) => { + children.forEach(kid => { + kid.parent = diff + diff.leaves.push(...kid.leaves) + diff.unchanged.push(...kid.unchanged) + diff.removed.push(...kid.removed) + }) + diff.children = children + return diff +} + +module.exports = Diff diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/edge.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/edge.js new file mode 100644 index 00000000..77ba196e --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/edge.js @@ -0,0 +1,301 @@ +// An edge in the dependency graph +// Represents a dependency relationship of some kind + +const util = require('node:util') +const npa = require('npm-package-arg') +const depValid = require('./dep-valid.js') + +class ArboristEdge { + constructor (edge) { + this.name = edge.name + this.spec = edge.spec + this.type = edge.type + + const edgeFrom = edge.from?.location + const edgeTo = edge.to?.location + const override = edge.overrides?.value + + if (edgeFrom != null) { + this.from = edgeFrom + } + if (edgeTo) { + this.to = edgeTo + } + if (edge.error) { + this.error = edge.error + } + if (edge.peerConflicted) { + this.peerConflicted = true + } + if (override) { + this.overridden = override + } + } +} + +class Edge { + #accept + #error + #explanation + #from + #name + #spec + #to + #type + + static types = Object.freeze([ + 'prod', + 'dev', + 'optional', + 'peer', + 'peerOptional', + 'workspace', + ]) + + // XXX where is this used? + static errors = Object.freeze([ + 'DETACHED', + 'MISSING', + 'PEER LOCAL', + 'INVALID', + ]) + + constructor (options) { + const { type, name, spec, accept, from, overrides } = options + + // XXX are all of these error states even possible? + if (typeof spec !== 'string') { + throw new TypeError('must provide string spec') + } + if (!Edge.types.includes(type)) { + throw new TypeError(`invalid type: ${type}\n(valid types are: ${Edge.types.join(', ')})`) + } + if (type === 'workspace' && npa(spec).type !== 'directory') { + throw new TypeError('workspace edges must be a symlink') + } + if (typeof name !== 'string') { + throw new TypeError('must provide dependency name') + } + if (!from) { + throw new TypeError('must provide "from" node') + } + if (accept !== undefined) { + if (typeof accept !== 'string') { + throw new TypeError('accept field must be a string if provided') + } + this.#accept = accept || '*' + } + if (overrides !== undefined) { + this.overrides = overrides + } + + this.#name = name + this.#type = type + this.#spec = spec + this.#explanation = null + this.#from = from + + from.edgesOut.get(this.#name)?.detach() + from.addEdgeOut(this) + + this.reload(true) + this.peerConflicted = false + } + + satisfiedBy (node) { + if (node.name !== this.#name) { + return false + } + + // NOTE: this condition means we explicitly do not support overriding + // bundled or shrinkwrapped dependencies + if (node.hasShrinkwrap || node.inShrinkwrap || node.inBundle) { + return depValid(node, this.rawSpec, this.#accept, this.#from) + } + return depValid(node, this.spec, this.#accept, this.#from) + } + + // return the edge data, and an explanation of how that edge came to be here + explain (seen = []) { + if (!this.#explanation) { + const explanation = { + type: this.#type, + name: this.#name, + spec: this.spec, + } + if (this.rawSpec !== this.spec) { + explanation.rawSpec = this.rawSpec + explanation.overridden = true + } + if (this.bundled) { + explanation.bundled = this.bundled + } + if (this.error) { + explanation.error = this.error + } + if (this.#from) { + explanation.from = this.#from.explain(null, seen) + } + this.#explanation = explanation + } + return this.#explanation + } + + get bundled () { + return !!this.#from?.package?.bundleDependencies?.includes(this.#name) + } + + get workspace () { + return this.#type === 'workspace' + } + + get prod () { + return this.#type === 'prod' + } + + get dev () { + return this.#type === 'dev' + } + + get optional () { + return this.#type === 'optional' || this.#type === 'peerOptional' + } + + get peer () { + return this.#type === 'peer' || this.#type === 'peerOptional' + } + + get type () { + return this.#type + } + + get name () { + return this.#name + } + + get rawSpec () { + return this.#spec + } + + get spec () { + if (this.overrides?.value && this.overrides.value !== '*' && this.overrides.name === this.#name) { + if (this.overrides.value.startsWith('$')) { + const ref = this.overrides.value.slice(1) + // we may be a virtual root, if we are we want to resolve reference overrides + // from the real root, not the virtual one + const pkg = this.#from.sourceReference + ? this.#from.sourceReference.root.package + : this.#from.root.package + if (pkg.devDependencies?.[ref]) { + return pkg.devDependencies[ref] + } + if (pkg.optionalDependencies?.[ref]) { + return pkg.optionalDependencies[ref] + } + if (pkg.dependencies?.[ref]) { + return pkg.dependencies[ref] + } + if (pkg.peerDependencies?.[ref]) { + return pkg.peerDependencies[ref] + } + + throw new Error(`Unable to resolve reference ${this.overrides.value}`) + } + return this.overrides.value + } + return this.#spec + } + + get accept () { + return this.#accept + } + + get valid () { + return !this.error + } + + get missing () { + return this.error === 'MISSING' + } + + get invalid () { + return this.error === 'INVALID' + } + + get peerLocal () { + return this.error === 'PEER LOCAL' + } + + get error () { + if (!this.#error) { + if (!this.#to) { + if (this.optional) { + this.#error = null + } else { + this.#error = 'MISSING' + } + } else if (this.peer && this.#from === this.#to.parent && !this.#from.isTop) { + this.#error = 'PEER LOCAL' + } else if (!this.satisfiedBy(this.#to)) { + this.#error = 'INVALID' + } else { + this.#error = 'OK' + } + } + if (this.#error === 'OK') { + return null + } + return this.#error + } + + reload (hard = false) { + this.#explanation = null + if (this.#from.overrides) { + this.overrides = this.#from.overrides.getEdgeRule(this) + } else { + delete this.overrides + } + const newTo = this.#from.resolve(this.#name) + if (newTo !== this.#to) { + if (this.#to) { + this.#to.edgesIn.delete(this) + } + this.#to = newTo + this.#error = null + if (this.#to) { + this.#to.addEdgeIn(this) + } + } else if (hard) { + this.#error = null + } + } + + detach () { + this.#explanation = null + if (this.#to) { + this.#to.edgesIn.delete(this) + } + this.#from.edgesOut.delete(this.#name) + this.#to = null + this.#error = 'DETACHED' + this.#from = null + } + + get from () { + return this.#from + } + + get to () { + return this.#to + } + + toJSON () { + return new ArboristEdge(this) + } + + [util.inspect.custom] () { + return this.toJSON() + } +} + +module.exports = Edge diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/from-path.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/from-path.js new file mode 100644 index 00000000..f7e44749 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/from-path.js @@ -0,0 +1,30 @@ +// file dependencies need their dependencies resolved based on the location +// where the tarball was found, not the location where they end up getting +// installed. directory (ie, symlink) deps also need to be resolved based on +// their targets, but that's what realpath is + +const { dirname } = require('node:path') +const npa = require('npm-package-arg') + +const fromPath = (node, edge) => { + if (edge && edge.overrides && edge.overrides.name === edge.name && edge.overrides.value) { + // fromPath could be called with a node that has a virtual root, if that + // happens we want to make sure we get the real root node when overrides + // are in use. this is to allow things like overriding a dependency with a + // tarball file that's a relative path from the project root + if (node.sourceReference) { + return node.sourceReference.root.realpath + } + return node.root.realpath + } + + if (node.resolved) { + const spec = npa(node.resolved) + if (spec?.type === 'file') { + return dirname(spec.fetchSpec) + } + } + return node.realpath +} + +module.exports = fromPath diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/gather-dep-set.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/gather-dep-set.js new file mode 100644 index 00000000..2c85a640 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/gather-dep-set.js @@ -0,0 +1,43 @@ +// Given a set of nodes in a tree, and a filter function to test +// incoming edges to the dep set that should be ignored otherwise. +// +// find the set of deps that are only depended upon by nodes in the set, or +// their dependencies, or edges that are ignored. +// +// Used when figuring out what to prune when replacing a node with a newer +// version, or when an optional dep fails to install. + +const gatherDepSet = (set, edgeFilter) => { + const deps = new Set(set) + + // add the full set of dependencies. note that this loop will continue + // as the deps set increases in size. + for (const node of deps) { + for (const edge of node.edgesOut.values()) { + if (edge.to && edgeFilter(edge)) { + deps.add(edge.to) + } + } + } + + // now remove all nodes in the set that have a dependant outside the set + // if any change is made, then re-check + // continue until no changes made, or deps set evaporates fully. + let changed = true + while (changed === true && deps.size > 0) { + changed = false + for (const dep of deps) { + for (const edge of dep.edgesIn) { + if (!deps.has(edge.from) && edgeFilter(edge)) { + changed = true + deps.delete(dep) + break + } + } + } + } + + return deps +} + +module.exports = gatherDepSet diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/index.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/index.js new file mode 100644 index 00000000..5baaee6e --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/index.js @@ -0,0 +1,6 @@ +module.exports = require('./arborist/index.js') +module.exports.Arborist = module.exports +module.exports.Node = require('./node.js') +module.exports.Link = require('./link.js') +module.exports.Edge = require('./edge.js') +module.exports.Shrinkwrap = require('./shrinkwrap.js') diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/inventory.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/inventory.js new file mode 100644 index 00000000..7b3f294f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/inventory.js @@ -0,0 +1,138 @@ +// a class to manage an inventory and set of indexes of a set of objects based +// on specific fields. +const { hasOwnProperty } = Object.prototype +const debug = require('./debug.js') + +const keys = ['name', 'license', 'funding', 'realpath', 'packageName'] +class Inventory extends Map { + #index + + constructor () { + super() + this.#index = new Map() + for (const key of keys) { + this.#index.set(key, new Map()) + } + } + + // XXX where is this used? + get primaryKey () { + return 'location' + } + + // XXX where is this used? + get indexes () { + return [...keys] + } + + * filter (fn) { + for (const node of this.values()) { + if (fn(node)) { + yield node + } + } + } + + add (node) { + const root = super.get('') + if (root && node.root !== root && node.root !== root.root) { + debug(() => { + throw Object.assign(new Error('adding external node to inventory'), { + root: root.path, + node: node.path, + nodeRoot: node.root.path, + }) + }) + return + } + + const current = super.get(node.location) + if (current) { + if (current === node) { + return + } + this.delete(current) + } + super.set(node.location, node) + for (const [key, map] of this.#index.entries()) { + let val + if (hasOwnProperty.call(node, key)) { + // if the node has the value, use it even if it's false + val = node[key] + } else if (key === 'license' && node.package) { + // handling for the outdated "licenses" array, just pick the first one + // also support the alternative spelling "licence" + if (node.package.license) { + val = node.package.license + } else if (node.package.licence) { + val = node.package.licence + } else if (Array.isArray(node.package.licenses)) { + val = node.package.licenses[0] + } else if (Array.isArray(node.package.licences)) { + val = node.package.licences[0] + } + } else if (node[key]) { + val = node[key] + } else { + val = node.package?.[key] + } + if (val && typeof val === 'object') { + // We currently only use license and funding + /* istanbul ignore next - not used */ + if (key === 'license') { + val = val.type + } else if (key === 'funding') { + val = val.url + } + } + if (!map.has(val)) { + map.set(val, new Set()) + } + map.get(val).add(node) + } + } + + delete (node) { + if (!this.has(node)) { + return + } + + super.delete(node.location) + for (const [key, map] of this.#index.entries()) { + let val + if (node[key] !== undefined) { + val = node[key] + } else { + val = node.package?.[key] + } + const set = map.get(val) + if (set) { + set.delete(node) + if (set.size === 0) { + map.delete(node[key]) + } + } + } + } + + query (key, val) { + const map = this.#index.get(key) + if (arguments.length === 2) { + if (map.has(val)) { + return map.get(val) + } + return new Set() + } + return map.keys() + } + + has (node) { + return super.get(node.location) === node + } + + set () { + throw new Error('direct set() not supported, use inventory.add(node)') + } +} + +module.exports = Inventory diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/link.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/link.js new file mode 100644 index 00000000..266ec451 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/link.js @@ -0,0 +1,126 @@ +const relpath = require('./relpath.js') +const Node = require('./node.js') +const _loadDeps = Symbol.for('Arborist.Node._loadDeps') +const _target = Symbol.for('_target') +const { dirname } = require('node:path') +// defined by Node class +const _delistFromMeta = Symbol.for('_delistFromMeta') +const _refreshLocation = Symbol.for('_refreshLocation') +class Link extends Node { + constructor (options) { + const { root, realpath, target, parent, fsParent, isStoreLink } = options + + if (!realpath && !(target && target.path)) { + throw new TypeError('must provide realpath for Link node') + } + + super({ + ...options, + realpath: realpath || target.path, + root: root || (parent ? parent.root + : fsParent ? fsParent.root + : target ? target.root + : null), + }) + + this.isStoreLink = isStoreLink || false + + if (target) { + this.target = target + } else if (this.realpath === this.root.path) { + this.target = this.root + } else { + this.target = new Node({ + ...options, + path: realpath, + parent: null, + fsParent: null, + root: this.root, + }) + } + } + + get version () { + return this.target ? this.target.version : this.package.version || '' + } + + get target () { + return this[_target] + } + + set target (target) { + const current = this[_target] + if (target === current) { + return + } + + if (!target) { + if (current && current.linksIn) { + current.linksIn.delete(this) + } + if (this.path) { + this[_delistFromMeta]() + this[_target] = null + this.package = {} + this[_refreshLocation]() + } else { + this[_target] = null + } + return + } + + if (!this.path) { + // temp node pending assignment to a tree + // we know it's not in the inventory yet, because no path. + if (target.path) { + this.realpath = target.path + } else { + target.path = target.realpath = this.realpath + } + target.root = this.root + this[_target] = target + target.linksIn.add(this) + this.package = target.package + return + } + + // have to refresh metadata, because either realpath or package + // is very likely changing. + this[_delistFromMeta]() + this.package = target.package + this.realpath = target.path + this[_refreshLocation]() + + target.root = this.root + } + + // a link always resolves to the relative path to its target + get resolved () { + // the path/realpath guard is there for the benefit of setting + // these things in the "wrong" order + return this.path && this.realpath + ? `file:${relpath(dirname(this.path), this.realpath).replace(/#/g, '%23')}` + : null + } + + set resolved (r) {} + + // deps are resolved on the target, not the Link + // so this is a no-op + [_loadDeps] () {} + + // links can't have children, only their targets can + // fix it to an empty list so that we can still call + // things that iterate over them, just as a no-op + get children () { + return new Map() + } + + set children (c) {} + + get isLink () { + return true + } +} + +module.exports = Link diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js new file mode 100644 index 00000000..c519a7b5 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js @@ -0,0 +1,1475 @@ +// inventory, path, realpath, root, and parent +// +// node.root is a reference to the root module in the tree (ie, typically the +// cwd project folder) +// +// node.location is the /-delimited path from the root module to the node. In +// the case of link targets that may be outside of the root's package tree, +// this can include some number of /../ path segments. The location of the +// root module is always '.'. node.location thus never contains drive letters +// or absolute paths, and is portable within a given project, suitable for +// inclusion in lockfiles and metadata. +// +// node.path is the path to the place where this node lives on disk. It is +// system-specific and absolute. +// +// node.realpath is the path to where the module actually resides on disk. In +// the case of non-link nodes, node.realpath is equivalent to node.path. In +// the case of link nodes, it is equivalent to node.target.path. +// +// Setting node.parent will set the node's root to the parent's root, as well +// as updating edgesIn and edgesOut to reload dependency resolutions as needed, +// and setting node.path to parent.path/node_modules/name. +// +// node.inventory is a Map of name to a Set() of all the nodes under a given +// root by that name. It's empty for non-root nodes, and changing the root +// reference will remove it from the old root's inventory and add it to the new +// one. This map is useful for cases like `npm update foo` or `npm ls foo` +// where we need to quickly find all instances of a given package name within a +// tree. + +const semver = require('semver') +const nameFromFolder = require('@npmcli/name-from-folder') +const Edge = require('./edge.js') +const Inventory = require('./inventory.js') +const OverrideSet = require('./override-set.js') +const { normalize } = require('read-package-json-fast') +const { getPaths: getBinPaths } = require('bin-links') +const npa = require('npm-package-arg') +const debug = require('./debug.js') +const gatherDepSet = require('./gather-dep-set.js') +const treeCheck = require('./tree-check.js') +const { walkUp } = require('walk-up-path') + +const { resolve, relative, dirname, basename } = require('node:path') +const util = require('node:util') +const _package = Symbol('_package') +const _parent = Symbol('_parent') +const _target = Symbol.for('_target') +const _fsParent = Symbol('_fsParent') +const _reloadNamedEdges = Symbol('_reloadNamedEdges') +// overridden by Link class +const _loadDeps = Symbol.for('Arborist.Node._loadDeps') +const _refreshLocation = Symbol.for('_refreshLocation') +const _changePath = Symbol.for('_changePath') +// used by Link class as well +const _delistFromMeta = Symbol.for('_delistFromMeta') +const _explain = Symbol('_explain') +const _explanation = Symbol('_explanation') + +const relpath = require('./relpath.js') +const consistentResolve = require('./consistent-resolve.js') + +const printableTree = require('./printable.js') +const CaseInsensitiveMap = require('./case-insensitive-map.js') + +const querySelectorAll = require('./query-selector-all.js') + +class Node { + #global + #meta + #root + #workspaces + + constructor (options) { + // NB: path can be null if it's a link target + const { + root, + path, + realpath, + parent, + error, + meta, + fsParent, + resolved, + integrity, + // allow setting name explicitly when we haven't set a path yet + name, + children, + fsChildren, + installLinks = false, + legacyPeerDeps = false, + linksIn, + isInStore = false, + hasShrinkwrap, + overrides, + loadOverrides = false, + extraneous = true, + dev = true, + optional = true, + devOptional = true, + peer = true, + global = false, + dummy = false, + sourceReference = null, + } = options + // this object gives querySelectorAll somewhere to stash context about a node + // while processing a query + this.queryContext = {} + + // true if part of a global install + this.#global = global + + this.#workspaces = null + + this.errors = error ? [error] : [] + this.isInStore = isInStore + + // this will usually be null, except when modeling a + // package's dependencies in a virtual root. + this.sourceReference = sourceReference + + // TODO if this came from pacote.manifest we don't have to do this, + // we can be told to skip this step + const pkg = sourceReference ? sourceReference.package + : normalize(options.pkg || {}) + + this.name = name || + nameFromFolder(path || pkg.name || realpath) || + pkg.name || + null + + // should be equal if not a link + this.path = path ? resolve(path) : null + + if (!this.name && (!this.path || this.path !== dirname(this.path))) { + throw new TypeError('could not detect node name from path or package') + } + + this.realpath = !this.isLink ? this.path : resolve(realpath) + + this.resolved = resolved || null + if (!this.resolved) { + // note: this *only* works for non-file: deps, so we avoid even + // trying here. + // file: deps are tracked in package.json will _resolved set to the + // full path to the tarball or link target. However, if the package + // is checked into git or moved to another location, that's 100% not + // portable at all! The _where and _location don't provide much help, + // since _location is just where the module ended up in the tree, + // and _where can be different than the actual root if it's a + // meta-dep deeper in the dependency graph. + // + // If we don't have the other oldest indicators of legacy npm, then it's + // probably what we're getting from pacote, which IS trustworthy. + // + // Otherwise, hopefully a shrinkwrap will help us out. + const resolved = consistentResolve(pkg._resolved) + if (resolved && !(/^file:/.test(resolved) && pkg._where)) { + this.resolved = resolved + } + } + this.integrity = integrity || pkg._integrity || null + this.hasShrinkwrap = hasShrinkwrap || pkg._hasShrinkwrap || false + this.installLinks = installLinks + this.legacyPeerDeps = legacyPeerDeps + + this.children = new CaseInsensitiveMap() + this.fsChildren = new Set() + this.inventory = new Inventory() + this.tops = new Set() + this.linksIn = new Set(linksIn || []) + + // these three are set by an Arborist taking a catalog + // after the tree is built. We don't get this along the way, + // because they have a tendency to change as new children are + // added, especially when they're deduped. Eg, a dev dep may be + // a 3-levels-deep dependency of a non-dev dep. If we calc the + // flags along the way, then they'll tend to be invalid by the + // time we need to look at them. + if (!dummy) { + this.dev = dev + this.optional = optional + this.devOptional = devOptional + this.peer = peer + this.extraneous = extraneous + this.dummy = false + } else { + // true if this is a placeholder for the purpose of serving as a + // fsParent to link targets that get their deps resolved outside + // the root tree folder. + this.dummy = true + this.dev = false + this.optional = false + this.devOptional = false + this.peer = false + this.extraneous = false + } + + this.edgesIn = new Set() + this.edgesOut = new CaseInsensitiveMap() + + // have to set the internal package ref before assigning the parent, + // because this.package is read when adding to inventory + this[_package] = pkg && typeof pkg === 'object' ? pkg : {} + + if (overrides) { + this.overrides = overrides + } else if (loadOverrides) { + const overrides = this[_package].overrides || {} + if (Object.keys(overrides).length > 0) { + this.overrides = new OverrideSet({ + overrides: this[_package].overrides, + }) + } + } + + // only relevant for the root and top nodes + this.meta = meta + + // Note: this is _slightly_ less efficient for the initial tree + // building than it could be, but in exchange, it's a much simpler + // algorithm. + // If this node has a bunch of children, and those children satisfy + // its various deps, then we're going to _first_ create all the + // edges, and _then_ assign the children into place, re-resolving + // them all in _reloadNamedEdges. + // A more efficient, but more complicated, approach would be to + // flag this node as being a part of a tree build, so it could + // hold off on resolving its deps until its children are in place. + + // call the parent setter + // Must be set prior to calling _loadDeps, because top-ness is relevant + + // will also assign root if present on the parent + this[_parent] = null + this.parent = parent || null + + this[_fsParent] = null + this.fsParent = fsParent || null + + // see parent/root setters below. + // root is set to parent's root if we have a parent, otherwise if it's + // null, then it's set to the node itself. + if (!parent && !fsParent) { + this.root = root || null + } + + // mostly a convenience for testing, but also a way to create + // trees in a more declarative way than setting parent on each + if (children) { + for (const c of children) { + new Node({ ...c, parent: this }) + } + } + if (fsChildren) { + for (const c of fsChildren) { + new Node({ ...c, fsParent: this }) + } + } + + // now load all the dep edges + this[_loadDeps]() + } + + get meta () { + return this.#meta + } + + set meta (meta) { + this.#meta = meta + if (meta) { + meta.add(this) + } + } + + get global () { + if (this.#root === this) { + return this.#global + } + return this.#root.global + } + + // true for packages installed directly in the global node_modules folder + get globalTop () { + return this.global && this.parent && this.parent.isProjectRoot + } + + get workspaces () { + return this.#workspaces + } + + set workspaces (workspaces) { + // deletes edges if they already exists + if (this.#workspaces) { + for (const name of this.#workspaces.keys()) { + if (!workspaces.has(name)) { + this.edgesOut.get(name).detach() + } + } + } + + this.#workspaces = workspaces + this.#loadWorkspaces() + this[_loadDeps]() + } + + get binPaths () { + if (!this.parent) { + return [] + } + + return getBinPaths({ + pkg: this[_package], + path: this.path, + global: this.global, + top: this.globalTop, + }) + } + + get hasInstallScript () { + const { hasInstallScript, scripts } = this.package + const { install, preinstall, postinstall } = scripts || {} + return !!(hasInstallScript || install || preinstall || postinstall) + } + + get version () { + return this[_package].version || '' + } + + get packageName () { + return this[_package].name || null + } + + get pkgid () { + const { name = '', version = '' } = this.package + // root package will prefer package name over folder name, + // and never be called an alias. + const { isProjectRoot } = this + const myname = isProjectRoot ? name || this.name + : this.name + const alias = !isProjectRoot && name && myname !== name ? `npm:${name}@` + : '' + return `${myname}@${alias}${version}` + } + + get overridden () { + return !!(this.overrides && this.overrides.value && this.overrides.name === this.name) + } + + get package () { + return this[_package] + } + + set package (pkg) { + // just detach them all. we could make this _slightly_ more efficient + // by only detaching the ones that changed, but we'd still have to walk + // them all, and the comparison logic gets a bit tricky. we generally + // only do this more than once at the root level, so the resolve() calls + // are only one level deep, and there's not much to be saved, anyway. + // simpler to just toss them all out. + for (const edge of this.edgesOut.values()) { + edge.detach() + } + + this[_explanation] = null + /* istanbul ignore next - should be impossible */ + if (!pkg || typeof pkg !== 'object') { + debug(() => { + throw new Error('setting Node.package to non-object') + }) + pkg = {} + } + this[_package] = pkg + this.#loadWorkspaces() + this[_loadDeps]() + // do a hard reload, since the dependents may now be valid or invalid + // as a result of the package change. + this.edgesIn.forEach(edge => edge.reload(true)) + } + + // node.explain(nodes seen already, edge we're trying to satisfy + // if edge is not specified, it lists every edge into the node. + explain (edge = null, seen = []) { + if (this[_explanation]) { + return this[_explanation] + } + + return this[_explanation] = this[_explain](edge, seen) + } + + [_explain] (edge, seen) { + if (this.isProjectRoot && !this.sourceReference) { + return { + location: this.path, + } + } + + const why = { + name: this.isProjectRoot || this.isTop ? this.packageName : this.name, + version: this.package.version, + } + if (this.errors.length || !this.packageName || !this.package.version) { + why.errors = this.errors.length ? this.errors : [ + new Error('invalid package: lacks name and/or version'), + ] + why.package = this.package + } + + if (this.root.sourceReference) { + const { name, version } = this.root.package + why.whileInstalling = { + name, + version, + path: this.root.sourceReference.path, + } + } + + if (this.sourceReference) { + return this.sourceReference.explain(edge, seen) + } + + if (seen.includes(this)) { + return why + } + + why.location = this.location + why.isWorkspace = this.isWorkspace + + // make a new list each time. we can revisit, but not loop. + seen = seen.concat(this) + + why.dependents = [] + if (edge) { + why.dependents.push(edge.explain(seen)) + } else { + // ignore invalid edges, since those aren't satisfied by this thing, + // and are not keeping it held in this spot anyway. + const edges = [] + for (const edge of this.edgesIn) { + if (!edge.valid && !edge.from.isProjectRoot) { + continue + } + + edges.push(edge) + } + for (const edge of edges) { + why.dependents.push(edge.explain(seen)) + } + } + + if (this.linksIn.size) { + why.linksIn = [...this.linksIn].map(link => link[_explain](edge, seen)) + } + + return why + } + + isDescendantOf (node) { + for (let p = this; p; p = p.resolveParent) { + if (p === node) { + return true + } + } + return false + } + + getBundler (path = []) { + // made a cycle, definitely not bundled! + if (path.includes(this)) { + return null + } + + path.push(this) + + const parent = this[_parent] + if (!parent) { + return null + } + + const pBundler = parent.getBundler(path) + if (pBundler) { + return pBundler + } + + const ppkg = parent.package + const bd = ppkg && ppkg.bundleDependencies + // explicit bundling + if (Array.isArray(bd) && bd.includes(this.name)) { + return parent + } + + // deps that are deduped up to the bundling level are bundled. + // however, if they get their dep met further up than that, + // then they are not bundled. Ie, installing a package with + // unmet bundled deps will not cause your deps to be bundled. + for (const edge of this.edgesIn) { + const eBundler = edge.from.getBundler(path) + if (!eBundler) { + continue + } + + if (eBundler === parent) { + return eBundler + } + } + + return null + } + + get inBundle () { + return !!this.getBundler() + } + + // when reifying, if a package is technically in a bundleDependencies list, + // but that list is the root project, we still have to install it. This + // getter returns true if it's in a dependency's bundle list, not the root's. + get inDepBundle () { + const bundler = this.getBundler() + return !!bundler && bundler !== this.root + } + + get isWorkspace () { + if (this.isProjectRoot) { + return false + } + const { root } = this + const { type, to } = root.edgesOut.get(this.packageName) || {} + return type === 'workspace' && to && (to.target === this || to === this) + } + + get isRoot () { + return this === this.root + } + + get isProjectRoot () { + // only treat as project root if it's the actual link that is the root, + // or the target of the root link, but NOT if it's another link to the + // same root that happens to be somewhere else. + return this === this.root || this === this.root.target + } + + get isRegistryDependency () { + if (this.edgesIn.size === 0) { + return false + } + for (const edge of this.edgesIn) { + if (!npa(edge.spec).registry) { + return false + } + } + return true + } + + * ancestry () { + for (let anc = this; anc; anc = anc.resolveParent) { + yield anc + } + } + + set root (root) { + // setting to null means this is the new root + // should only ever be one step + while (root && root.root !== root) { + root = root.root + } + + root = root || this + + // delete from current root inventory + this[_delistFromMeta]() + + // can't set the root (yet) if there's no way to determine location + // this allows us to do new Node({...}) and then set the root later. + // just make the assignment so we don't lose it, and move on. + if (!this.path || !root.realpath || !root.path) { + this.#root = root + return + } + + // temporarily become a root node + this.#root = this + + // break all linksIn, we're going to re-set them if needed later + for (const link of this.linksIn) { + link[_target] = null + this.linksIn.delete(link) + } + + // temporarily break this link as well, we'll re-set if possible later + const { target } = this + if (this.isLink) { + if (target) { + target.linksIn.delete(this) + if (target.root === this) { + target[_delistFromMeta]() + } + } + this[_target] = null + } + + // if this is part of a cascading root set, then don't do this bit + // but if the parent/fsParent is in a different set, we have to break + // that reference before proceeding + if (this.parent && this.parent.root !== root) { + this.parent.children.delete(this.name) + this[_parent] = null + } + if (this.fsParent && this.fsParent.root !== root) { + this.fsParent.fsChildren.delete(this) + this[_fsParent] = null + } + + if (root === this) { + this[_refreshLocation]() + } else { + // setting to some different node. + const loc = relpath(root.realpath, this.path) + const current = root.inventory.get(loc) + + // clobber whatever is there now + if (current) { + current.root = null + } + + this.#root = root + // set this.location and add to inventory + this[_refreshLocation]() + + // try to find our parent/fsParent in the new root inventory + for (const p of walkUp(dirname(this.path))) { + if (p === this.path) { + continue + } + const ploc = relpath(root.realpath, p) + const parent = root.inventory.get(ploc) + if (parent) { + /* istanbul ignore next - impossible */ + if (parent.isLink) { + debug(() => { + throw Object.assign(new Error('assigning parentage to link'), { + path: this.path, + parent: parent.path, + parentReal: parent.realpath, + }) + }) + continue + } + const childLoc = `${ploc}${ploc ? '/' : ''}node_modules/${this.name}` + const isParent = this.location === childLoc + if (isParent) { + const oldChild = parent.children.get(this.name) + if (oldChild && oldChild !== this) { + oldChild.root = null + } + if (this.parent) { + this.parent.children.delete(this.name) + this.parent[_reloadNamedEdges](this.name) + } + parent.children.set(this.name, this) + this[_parent] = parent + // don't do it for links, because they don't have a target yet + // we'll hit them up a bit later on. + if (!this.isLink) { + parent[_reloadNamedEdges](this.name) + } + } else { + /* istanbul ignore if - should be impossible, since we break + * all fsParent/child relationships when moving? */ + if (this.fsParent) { + this.fsParent.fsChildren.delete(this) + } + parent.fsChildren.add(this) + this[_fsParent] = parent + } + break + } + } + + // if it doesn't have a parent, it's a top node + if (!this.parent) { + root.tops.add(this) + } else { + root.tops.delete(this) + } + + // assign parentage for any nodes that need to have this as a parent + // this can happen when we have a node at nm/a/nm/b added *before* + // the node at nm/a, which might have the root node as a fsParent. + // we can't rely on the public setter here, because it calls into + // this function to set up these references! + // check dirname so that /foo isn't treated as the fsparent of /foo-bar + const nmloc = `${this.location}${this.location ? '/' : ''}node_modules/` + // only walk top nodes, since anything else already has a parent. + for (const child of root.tops) { + const isChild = child.location === nmloc + child.name + const isFsChild = + dirname(child.path).startsWith(this.path) && + child !== this && + !child.parent && + ( + !child.fsParent || + child.fsParent === this || + dirname(this.path).startsWith(child.fsParent.path) + ) + + if (!isChild && !isFsChild) { + continue + } + + // set up the internal parentage links + if (this.isLink) { + child.root = null + } else { + // can't possibly have a parent, because it's in tops + if (child.fsParent) { + child.fsParent.fsChildren.delete(child) + } + child[_fsParent] = null + if (isChild) { + this.children.set(child.name, child) + child[_parent] = this + root.tops.delete(child) + } else { + this.fsChildren.add(child) + child[_fsParent] = this + } + } + } + + // look for any nodes with the same realpath. either they're links + // to that realpath, or a thing at that realpath if we're adding a link + // (if we're adding a regular node, we already deleted the old one) + for (const node of root.inventory.query('realpath', this.realpath)) { + if (node === this) { + continue + } + + /* istanbul ignore next - should be impossible */ + debug(() => { + if (node.root !== root) { + throw new Error('inventory contains node from other root') + } + }) + + if (this.isLink) { + const target = node.target + this[_target] = target + this[_package] = target.package + target.linksIn.add(this) + // reload edges here, because now we have a target + if (this.parent) { + this.parent[_reloadNamedEdges](this.name) + } + break + } else { + /* istanbul ignore else - should be impossible */ + if (node.isLink) { + node[_target] = this + node[_package] = this.package + this.linksIn.add(node) + if (node.parent) { + node.parent[_reloadNamedEdges](node.name) + } + } else { + debug(() => { + throw Object.assign(new Error('duplicate node in root setter'), { + path: this.path, + realpath: this.realpath, + root: root.realpath, + }) + }) + } + } + } + } + + // reload all edgesIn where the root doesn't match, so we don't have + // cross-tree dependency graphs + for (const edge of this.edgesIn) { + if (edge.from.root !== root) { + edge.reload() + } + } + // reload all edgesOut where root doens't match, or is missing, since + // it might not be missing in the new tree + for (const edge of this.edgesOut.values()) { + if (!edge.to || edge.to.root !== root) { + edge.reload() + } + } + + // now make sure our family comes along for the ride! + const family = new Set([ + ...this.fsChildren, + ...this.children.values(), + ...this.inventory.values(), + ].filter(n => n !== this)) + + for (const child of family) { + if (child.root !== root) { + child[_delistFromMeta]() + child[_parent] = null + this.children.delete(child.name) + child[_fsParent] = null + this.fsChildren.delete(child) + for (const l of child.linksIn) { + l[_target] = null + child.linksIn.delete(l) + } + } + } + for (const child of family) { + if (child.root !== root) { + child.root = root + } + } + + // if we had a target, and didn't find one in the new root, then bring + // it over as well, but only if we're setting the link into a new root, + // as we don't want to lose the target any time we remove a link. + if (this.isLink && target && !this.target && root !== this) { + target.root = root + } + + if (!this.overrides && this.parent && this.parent.overrides) { + this.overrides = this.parent.overrides.getNodeRule(this) + } + // tree should always be valid upon root setter completion. + treeCheck(this) + if (this !== root) { + treeCheck(root) + } + } + + get root () { + return this.#root || this + } + + #loadWorkspaces () { + if (!this.#workspaces) { + return + } + + for (const [name, path] of this.#workspaces.entries()) { + new Edge({ from: this, name, spec: `file:${path.replace(/#/g, '%23')}`, type: 'workspace' }) + } + } + + [_loadDeps] () { + // Caveat! Order is relevant! + // Packages in optionalDependencies are optional. + // Packages in both deps and devDeps are required. + // Note the subtle breaking change from v6: it is no longer possible + // to have a different spec for a devDep than production dep. + + // Linked targets that are disconnected from the tree are tops, + // but don't have a 'path' field, only a 'realpath', because we + // don't know their canonical location. We don't need their devDeps. + const pd = this.package.peerDependencies + const ad = this.package.acceptDependencies || {} + if (pd && typeof pd === 'object' && !this.legacyPeerDeps) { + const pm = this.package.peerDependenciesMeta || {} + const peerDependencies = {} + const peerOptional = {} + for (const [name, dep] of Object.entries(pd)) { + if (pm[name]?.optional) { + peerOptional[name] = dep + } else { + peerDependencies[name] = dep + } + } + this.#loadDepType(peerDependencies, 'peer', ad) + this.#loadDepType(peerOptional, 'peerOptional', ad) + } + + this.#loadDepType(this.package.dependencies, 'prod', ad) + this.#loadDepType(this.package.optionalDependencies, 'optional', ad) + + const { globalTop, isTop, path, sourceReference } = this + const { + globalTop: srcGlobalTop, + isTop: srcTop, + path: srcPath, + } = sourceReference || {} + const thisDev = isTop && !globalTop && path + const srcDev = !sourceReference || srcTop && !srcGlobalTop && srcPath + if (thisDev && srcDev) { + this.#loadDepType(this.package.devDependencies, 'dev', ad) + } + } + + #loadDepType (deps, type, ad) { + // Because of the order in which _loadDeps runs, we always want to + // prioritize a new edge over an existing one + for (const [name, spec] of Object.entries(deps || {})) { + const current = this.edgesOut.get(name) + if (!current || current.type !== 'workspace') { + new Edge({ from: this, name, spec, accept: ad[name], type }) + } + } + } + + get fsParent () { + // in debug setter prevents fsParent from being this + return this[_fsParent] + } + + set fsParent (fsParent) { + if (!fsParent) { + if (this[_fsParent]) { + this.root = null + } + return + } + + debug(() => { + if (fsParent === this) { + throw new Error('setting node to its own fsParent') + } + + if (fsParent.realpath === this.realpath) { + throw new Error('setting fsParent to same path') + } + + // the initial set MUST be an actual walk-up from the realpath + // subsequent sets will re-root on the new fsParent's path. + if (!this[_fsParent] && this.realpath.indexOf(fsParent.realpath) !== 0) { + throw Object.assign(new Error('setting fsParent improperly'), { + path: this.path, + realpath: this.realpath, + fsParent: { + path: fsParent.path, + realpath: fsParent.realpath, + }, + }) + } + }) + + if (fsParent.isLink) { + fsParent = fsParent.target + } + + // setting a thing to its own fsParent is not normal, but no-op for safety + if (this === fsParent || fsParent.realpath === this.realpath) { + return + } + + // nothing to do + if (this[_fsParent] === fsParent) { + return + } + + const oldFsParent = this[_fsParent] + const newPath = !oldFsParent ? this.path + : resolve(fsParent.path, relative(oldFsParent.path, this.path)) + const nmPath = resolve(fsParent.path, 'node_modules', this.name) + + // this is actually the parent, set that instead + if (newPath === nmPath) { + this.parent = fsParent + return + } + + const pathChange = newPath !== this.path + + // remove from old parent/fsParent + const oldParent = this.parent + const oldName = this.name + if (this.parent) { + this.parent.children.delete(this.name) + this[_parent] = null + } + if (this.fsParent) { + this.fsParent.fsChildren.delete(this) + this[_fsParent] = null + } + + // update this.path/realpath for this and all children/fsChildren + if (pathChange) { + this[_changePath](newPath) + } + + if (oldParent) { + oldParent[_reloadNamedEdges](oldName) + } + + // clobbers anything at that path, resets all appropriate references + this.root = fsParent.root + } + + // is it safe to replace one node with another? check the edges to + // make sure no one will get upset. Note that the node might end up + // having its own unmet dependencies, if the new node has new deps. + // Note that there are cases where Arborist will opt to insert a node + // into the tree even though this function returns false! This is + // necessary when a root dependency is added or updated, or when a + // root dependency brings peer deps along with it. In that case, we + // will go ahead and create the invalid state, and then try to resolve + // it with more tree construction, because it's a user request. + canReplaceWith (node, ignorePeers) { + if (node.name !== this.name) { + return false + } + + if (node.packageName !== this.packageName) { + return false + } + + // XXX need to check for two root nodes? + if (node.overrides !== this.overrides) { + return false + } + ignorePeers = new Set(ignorePeers) + + // gather up all the deps of this node and that are only depended + // upon by deps of this node. those ones don't count, since + // they'll be replaced if this node is replaced anyway. + const depSet = gatherDepSet([this], e => e.to !== this && e.valid) + + for (const edge of this.edgesIn) { + // when replacing peer sets, we need to be able to replace the entire + // peer group, which means we ignore incoming edges from other peers + // within the replacement set. + if (!this.isTop && + edge.from.parent === this.parent && + edge.peer && + ignorePeers.has(edge.from.name)) { + continue + } + + // only care about edges that don't originate from this node + if (!depSet.has(edge.from) && !edge.satisfiedBy(node)) { + return false + } + } + + return true + } + + canReplace (node, ignorePeers) { + return node.canReplaceWith(this, ignorePeers) + } + + // return true if it's safe to remove this node, because anything that + // is depending on it would be fine with the thing that they would resolve + // to if it was removed, or nothing is depending on it in the first place. + canDedupe (preferDedupe = false) { + // not allowed to mess with shrinkwraps or bundles + if (this.inDepBundle || this.inShrinkwrap) { + return false + } + + // it's a top level pkg, or a dep of one + if (!this.resolveParent || !this.resolveParent.resolveParent) { + return false + } + + // no one wants it, remove it + if (this.edgesIn.size === 0) { + return true + } + + const other = this.resolveParent.resolveParent.resolve(this.name) + + // nothing else, need this one + if (!other) { + return false + } + + // if it's the same thing, then always fine to remove + if (other.matches(this)) { + return true + } + + // if the other thing can't replace this, then skip it + if (!other.canReplace(this)) { + return false + } + + // if we prefer dedupe, or if the version is greater/equal, take the other + if (preferDedupe || semver.gte(other.version, this.version)) { + return true + } + + return false + } + + satisfies (requested) { + if (requested instanceof Edge) { + return this.name === requested.name && requested.satisfiedBy(this) + } + + const parsed = npa(requested) + const { name = this.name, rawSpec: spec } = parsed + return this.name === name && this.satisfies(new Edge({ + from: new Node({ path: this.root.realpath }), + type: 'prod', + name, + spec, + })) + } + + matches (node) { + // if the nodes are literally the same object, obviously a match. + if (node === this) { + return true + } + + // if the names don't match, they're different things, even if + // the package contents are identical. + if (node.name !== this.name) { + return false + } + + // if they're links, they match if the targets match + if (this.isLink) { + return node.isLink && this.target.matches(node.target) + } + + // if they're two project root nodes, they're different if the paths differ + if (this.isProjectRoot && node.isProjectRoot) { + return this.path === node.path + } + + // if the integrity matches, then they're the same. + if (this.integrity && node.integrity) { + return this.integrity === node.integrity + } + + // if no integrity, check resolved + if (this.resolved && node.resolved) { + return this.resolved === node.resolved + } + + // if no resolved, check both package name and version + // otherwise, conclude that they are different things + return this.packageName && node.packageName && + this.packageName === node.packageName && + this.version && node.version && + this.version === node.version + } + + // replace this node with the supplied argument + // Useful when mutating an ideal tree, so we can avoid having to call + // the parent/root setters more than necessary. + replaceWith (node) { + node.replace(this) + } + + replace (node) { + this[_delistFromMeta]() + + // if the name matches, but is not identical, we are intending to clobber + // something case-insensitively, so merely setting name and path won't + // have the desired effect. just set the path so it'll collide in the + // parent's children map, and leave it at that. + if (node.parent?.children.get(this.name) === node) { + this.path = resolve(node.parent.path, 'node_modules', this.name) + } else { + this.path = node.path + this.name = node.name + } + + if (!this.isLink) { + this.realpath = this.path + } + this[_refreshLocation]() + + // keep children when a node replaces another + if (!this.isLink) { + for (const kid of node.children.values()) { + kid.parent = this + } + if (node.isLink && node.target) { + node.target.root = null + } + } + + if (!node.isRoot) { + this.root = node.root + } + + treeCheck(this) + } + + get inShrinkwrap () { + return this.parent && + (this.parent.hasShrinkwrap || this.parent.inShrinkwrap) + } + + get parent () { + // setter prevents _parent from being this + return this[_parent] + } + + // This setter keeps everything in order when we move a node from + // one point in a logical tree to another. Edges get reloaded, + // metadata updated, etc. It's also called when we *replace* a node + // with another by the same name (eg, to update or dedupe). + // This does a couple of walks out on the node_modules tree, recursing + // into child nodes. However, as setting the parent is typically done + // with nodes that don't have have many children, and (deduped) package + // trees tend to be broad rather than deep, it's not that bad. + // The only walk that starts from the parent rather than this node is + // limited by edge name. + set parent (parent) { + // when setting to null, just remove it from the tree entirely + if (!parent) { + // but only delete it if we actually had a parent in the first place + // otherwise it's just setting to null when it's already null + if (this[_parent]) { + this.root = null + } + return + } + + if (parent.isLink) { + parent = parent.target + } + + // setting a thing to its own parent is not normal, but no-op for safety + if (this === parent) { + return + } + + const oldParent = this[_parent] + + // nothing to do + if (oldParent === parent) { + return + } + + // ok now we know something is actually changing, and parent is not a link + const newPath = resolve(parent.path, 'node_modules', this.name) + const pathChange = newPath !== this.path + + // remove from old parent/fsParent + if (oldParent) { + oldParent.children.delete(this.name) + this[_parent] = null + } + if (this.fsParent) { + this.fsParent.fsChildren.delete(this) + this[_fsParent] = null + } + + // update this.path/realpath for this and all children/fsChildren + if (pathChange) { + this[_changePath](newPath) + } + + if (parent.overrides) { + this.overrides = parent.overrides.getNodeRule(this) + } + + // clobbers anything at that path, resets all appropriate references + this.root = parent.root + } + + // Call this before changing path or updating the _root reference. + // Removes the node from its root the metadata and inventory. + [_delistFromMeta] () { + const root = this.root + if (!root.realpath || !this.path) { + return + } + root.inventory.delete(this) + root.tops.delete(this) + if (root.meta) { + root.meta.delete(this.path) + } + /* istanbul ignore next - should be impossible */ + debug(() => { + if ([...root.inventory.values()].includes(this)) { + throw new Error('failed to delist') + } + }) + } + + // update this.path/realpath and the paths of all children/fsChildren + [_changePath] (newPath) { + // have to de-list before changing paths + this[_delistFromMeta]() + const oldPath = this.path + this.path = newPath + const namePattern = /(?:^|\/|\\)node_modules[\\/](@[^/\\]+[\\/][^\\/]+|[^\\/]+)$/ + const nameChange = newPath.match(namePattern) + if (nameChange && this.name !== nameChange[1]) { + this.name = nameChange[1].replace(/\\/g, '/') + } + + // if we move a link target, update link realpaths + if (!this.isLink) { + this.realpath = newPath + for (const link of this.linksIn) { + link[_delistFromMeta]() + link.realpath = newPath + link[_refreshLocation]() + } + } + // if we move /x to /y, then a module at /x/a/b becomes /y/a/b + for (const child of this.fsChildren) { + child[_changePath](resolve(newPath, relative(oldPath, child.path))) + } + for (const [name, child] of this.children.entries()) { + child[_changePath](resolve(newPath, 'node_modules', name)) + } + + this[_refreshLocation]() + } + + // Called whenever the root/parent is changed. + // NB: need to remove from former root's meta/inventory and then update + // this.path BEFORE calling this method! + [_refreshLocation] () { + const root = this.root + const loc = relpath(root.realpath, this.path) + + this.location = loc + + root.inventory.add(this) + if (root.meta) { + root.meta.add(this) + } + } + + assertRootOverrides () { + if (!this.isProjectRoot || !this.overrides) { + return + } + + for (const edge of this.edgesOut.values()) { + // if these differ an override has been applied, those are not allowed + // for top level dependencies so throw an error + if (edge.spec !== edge.rawSpec && !edge.spec.startsWith('$')) { + throw Object.assign(new Error(`Override for ${edge.name}@${edge.rawSpec} conflicts with direct dependency`), { code: 'EOVERRIDE' }) + } + } + } + + addEdgeOut (edge) { + if (this.overrides) { + edge.overrides = this.overrides.getEdgeRule(edge) + } + + this.edgesOut.set(edge.name, edge) + } + + addEdgeIn (edge) { + if (edge.overrides) { + this.overrides = edge.overrides + } + + this.edgesIn.add(edge) + + // try to get metadata from the yarn.lock file + if (this.root.meta) { + this.root.meta.addEdge(edge) + } + } + + [_reloadNamedEdges] (name, rootLoc = this.location) { + const edge = this.edgesOut.get(name) + // if we don't have an edge, do nothing, but keep descending + const rootLocResolved = edge && edge.to && + edge.to.location === `${rootLoc}/node_modules/${edge.name}` + const sameResolved = edge && this.resolve(name) === edge.to + const recheck = rootLocResolved || !sameResolved + if (edge && recheck) { + edge.reload(true) + } + for (const c of this.children.values()) { + c[_reloadNamedEdges](name, rootLoc) + } + + for (const c of this.fsChildren) { + c[_reloadNamedEdges](name, rootLoc) + } + } + + get isLink () { + return false + } + + get target () { + return this + } + + set target (n) { + debug(() => { + throw Object.assign(new Error('cannot set target on non-Link Nodes'), { + path: this.path, + }) + }) + } + + get depth () { + if (this.isTop) { + return 0 + } + return this.parent.depth + 1 + } + + get isTop () { + return !this.parent || this.globalTop + } + + get top () { + if (this.isTop) { + return this + } + return this.parent.top + } + + get isFsTop () { + return !this.fsParent + } + + get fsTop () { + if (this.isFsTop) { + return this + } + return this.fsParent.fsTop + } + + get resolveParent () { + return this.parent || this.fsParent + } + + resolve (name) { + /* istanbul ignore next - should be impossible, + * but I keep doing this mistake in tests */ + debug(() => { + if (typeof name !== 'string' || !name) { + throw new Error('non-string passed to Node.resolve') + } + }) + const mine = this.children.get(name) + if (mine) { + return mine + } + const resolveParent = this.resolveParent + if (resolveParent) { + return resolveParent.resolve(name) + } + return null + } + + inNodeModules () { + const rp = this.realpath + const name = this.name + const scoped = name.charAt(0) === '@' + const d = dirname(rp) + const nm = scoped ? dirname(d) : d + const dir = dirname(nm) + const base = scoped ? `${basename(d)}/${basename(rp)}` : basename(rp) + return base === name && basename(nm) === 'node_modules' ? dir : false + } + + // maybe accept both string value or array of strings + // seems to be what dom API does + querySelectorAll (query, opts) { + return querySelectorAll(this, query, opts) + } + + toJSON () { + return printableTree(this) + } + + [util.inspect.custom] () { + return this.toJSON() + } +} + +module.exports = Node diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/optional-set.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/optional-set.js new file mode 100644 index 00000000..9f5184ea --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/optional-set.js @@ -0,0 +1,38 @@ +// when an optional dep fails to install, we need to remove the branch of the +// graph up to the first optionalDependencies, as well as any nodes that are +// only required by other nodes in the set. +// +// This function finds the set of nodes that will need to be removed in that +// case. +// +// Note that this is *only* going to work with trees where calcDepFlags +// has been called, because we rely on the node.optional flag. + +const gatherDepSet = require('./gather-dep-set.js') +const optionalSet = node => { + if (!node.optional) { + return new Set() + } + + // start with the node, then walk up the dependency graph until we + // get to the boundaries that define the optional set. since the + // node is optional, we know that all paths INTO this area of the + // graph are optional, but there may be non-optional dependencies + // WITHIN the area. + const set = new Set([node]) + for (const node of set) { + for (const edge of node.edgesIn) { + if (!edge.optional) { + set.add(edge.from) + } + } + } + + // now that we've hit the boundary, gather the rest of the nodes in + // the optional section. that's the set of dependencies that are only + // depended upon by other nodes within the set, or optional dependencies + // from outside the set. + return gatherDepSet(set, edge => !edge.optional) +} + +module.exports = optionalSet diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/override-resolves.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/override-resolves.js new file mode 100644 index 00000000..c061cbce --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/override-resolves.js @@ -0,0 +1,11 @@ +function overrideResolves (resolved, opts) { + const { omitLockfileRegistryResolved = false } = opts + + if (omitLockfileRegistryResolved) { + return undefined + } + + return resolved +} + +module.exports = { overrideResolves } diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/override-set.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/override-set.js new file mode 100644 index 00000000..bfc5a5d7 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/override-set.js @@ -0,0 +1,147 @@ +const npa = require('npm-package-arg') +const semver = require('semver') + +class OverrideSet { + constructor ({ overrides, key, parent }) { + this.parent = parent + this.children = new Map() + + if (typeof overrides === 'string') { + overrides = { '.': overrides } + } + + // change a literal empty string to * so we can use truthiness checks on + // the value property later + if (overrides['.'] === '') { + overrides['.'] = '*' + } + + if (parent) { + const spec = npa(key) + if (!spec.name) { + throw new Error(`Override without name: ${key}`) + } + + this.name = spec.name + spec.name = '' + this.key = key + this.keySpec = spec.toString() + this.value = overrides['.'] || this.keySpec + } + + for (const [key, childOverrides] of Object.entries(overrides)) { + if (key === '.') { + continue + } + + const child = new OverrideSet({ + parent: this, + key, + overrides: childOverrides, + }) + + this.children.set(child.key, child) + } + } + + getEdgeRule (edge) { + for (const rule of this.ruleset.values()) { + if (rule.name !== edge.name) { + continue + } + + // if keySpec is * we found our override + if (rule.keySpec === '*') { + return rule + } + + let spec = npa(`${edge.name}@${edge.spec}`) + if (spec.type === 'alias') { + spec = spec.subSpec + } + + if (spec.type === 'git') { + if (spec.gitRange && semver.intersects(spec.gitRange, rule.keySpec)) { + return rule + } + + continue + } + + if (spec.type === 'range' || spec.type === 'version') { + if (semver.intersects(spec.fetchSpec, rule.keySpec)) { + return rule + } + + continue + } + + // if we got this far, the spec type is one of tag, directory or file + // which means we have no real way to make version comparisons, so we + // just accept the override + return rule + } + + return this + } + + getNodeRule (node) { + for (const rule of this.ruleset.values()) { + if (rule.name !== node.name) { + continue + } + + if (semver.satisfies(node.version, rule.keySpec) || + semver.satisfies(node.version, rule.value)) { + return rule + } + } + + return this + } + + getMatchingRule (node) { + for (const rule of this.ruleset.values()) { + if (rule.name !== node.name) { + continue + } + + if (semver.satisfies(node.version, rule.keySpec) || + semver.satisfies(node.version, rule.value)) { + return rule + } + } + + return null + } + + * ancestry () { + for (let ancestor = this; ancestor; ancestor = ancestor.parent) { + yield ancestor + } + } + + get isRoot () { + return !this.parent + } + + get ruleset () { + const ruleset = new Map() + + for (const override of this.ancestry()) { + for (const kid of override.children.values()) { + if (!ruleset.has(kid.key)) { + ruleset.set(kid.key, kid) + } + } + + if (!override.isRoot && !ruleset.has(override.key)) { + ruleset.set(override.key, override) + } + } + + return ruleset + } +} + +module.exports = OverrideSet diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/packument-cache.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/packument-cache.js new file mode 100644 index 00000000..26e463eb --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/packument-cache.js @@ -0,0 +1,77 @@ +const { LRUCache } = require('lru-cache') +const { getHeapStatistics } = require('node:v8') +const { log } = require('proc-log') + +// This is an in-memory cache that Pacote uses for packuments. +// Packuments are usually cached on disk. This allows for rapid re-requests +// of the same packument to bypass disk reads. The tradeoff here is memory +// usage for disk reads. +class PackumentCache extends LRUCache { + static #heapLimit = Math.floor(getHeapStatistics().heap_size_limit) + + #sizeKey + #disposed = new Set() + + #log (...args) { + log.silly('packumentCache', ...args) + } + + constructor ({ + // How much of this.#heapLimit to take up + heapFactor = 0.25, + // How much of this.#maxSize we allow any one packument to take up + // Anything over this is not cached + maxEntryFactor = 0.5, + sizeKey = '_contentLength', + } = {}) { + const maxSize = Math.floor(PackumentCache.#heapLimit * heapFactor) + const maxEntrySize = Math.floor(maxSize * maxEntryFactor) + super({ + maxSize, + maxEntrySize, + sizeCalculation: (p) => { + // Don't cache if we dont know the size + // Some versions of pacote set this to `0`, newer versions set it to `null` + if (!p[sizeKey]) { + return maxEntrySize + 1 + } + if (p[sizeKey] < 10_000) { + return p[sizeKey] * 2 + } + if (p[sizeKey] < 1_000_000) { + return Math.floor(p[sizeKey] * 1.5) + } + // It is less beneficial to store a small amount of super large things + // at the cost of all other packuments. + return maxEntrySize + 1 + }, + dispose: (v, k) => { + this.#disposed.add(k) + this.#log(k, 'dispose') + }, + }) + this.#sizeKey = sizeKey + this.#log(`heap:${PackumentCache.#heapLimit} maxSize:${maxSize} maxEntrySize:${maxEntrySize}`) + } + + set (k, v, ...args) { + // we use disposed only for a logging signal if we are setting packuments that + // have already been evicted from the cache previously. logging here could help + // us tune this in the future. + const disposed = this.#disposed.has(k) + /* istanbul ignore next - this doesnt happen consistently so hard to test without resorting to unit tests */ + if (disposed) { + this.#disposed.delete(k) + } + this.#log(k, 'set', `size:${v[this.#sizeKey]} disposed:${disposed}`) + return super.set(k, v, ...args) + } + + has (k, ...args) { + const has = super.has(k, ...args) + this.#log(k, `cache-${has ? 'hit' : 'miss'}`) + return has + } +} + +module.exports = PackumentCache diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/peer-entry-sets.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/peer-entry-sets.js new file mode 100644 index 00000000..a2da8c8c --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/peer-entry-sets.js @@ -0,0 +1,77 @@ +// Given a node in a tree, return all of the peer dependency sets that +// it is a part of, with the entry (top or non-peer) edges into the sets +// identified. +// +// With this information, we can determine whether it is appropriate to +// replace the entire peer set with another (and remove the old one), +// push the set deeper into the tree, and so on. +// +// Returns a Map of { edge => Set(peerNodes) }, + +const peerEntrySets = node => { + // this is the union of all peer groups that the node is a part of + // later, we identify all of the entry edges, and create a set of + // 1 or more overlapping sets that this node is a part of. + const unionSet = new Set([node]) + for (const node of unionSet) { + for (const edge of node.edgesOut.values()) { + if (edge.valid && edge.peer && edge.to) { + unionSet.add(edge.to) + } + } + for (const edge of node.edgesIn) { + if (edge.valid && edge.peer) { + unionSet.add(edge.from) + } + } + } + const entrySets = new Map() + for (const peer of unionSet) { + for (const edge of peer.edgesIn) { + // if not valid, it doesn't matter anyway. either it's been previously + // peerConflicted, or it's the thing we're interested in replacing. + if (!edge.valid) { + continue + } + // this is the entry point into the peer set + if (!edge.peer || edge.from.isTop) { + // get the subset of peer brought in by this peer entry edge + const sub = new Set([peer]) + for (const peer of sub) { + for (const edge of peer.edgesOut.values()) { + if (edge.valid && edge.peer && edge.to) { + sub.add(edge.to) + } + } + } + // if this subset does not include the node we are focused on, + // then it is not relevant for our purposes. Example: + // + // a -> (b, c, d) + // b -> PEER(d) b -> d -> e -> f <-> g + // c -> PEER(f, h) c -> (f <-> g, h -> g) + // d -> PEER(e) d -> e -> f <-> g + // e -> PEER(f) + // f -> PEER(g) + // g -> PEER(f) + // h -> PEER(g) + // + // The unionSet(e) will include c, but we don't actually care about + // it. We only expanded to the edge of the peer nodes in order to + // find the entry edges that caused the inclusion of peer sets + // including (e), so we want: + // Map{ + // Edge(a->b) => Set(b, d, e, f, g) + // Edge(a->d) => Set(d, e, f, g) + // } + if (sub.has(node)) { + entrySets.set(edge, sub) + } + } + } + } + + return entrySets +} + +module.exports = peerEntrySets diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js new file mode 100644 index 00000000..fca36eb6 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js @@ -0,0 +1,569 @@ +// Given a dep, a node that depends on it, and the edge representing that +// dependency, place the dep somewhere in the node's tree, and all of its +// peer dependencies. +// +// Handles all of the tree updating needed to place the dep, including +// removing replaced nodes, pruning now-extraneous or invalidated nodes, +// and saves a set of what was placed and what needs re-evaluation as +// a result. + +const localeCompare = require('@isaacs/string-locale-compare')('en') +const { log } = require('proc-log') +const { redact } = require('@npmcli/redact') +const deepestNestingTarget = require('./deepest-nesting-target.js') +const CanPlaceDep = require('./can-place-dep.js') +const { + KEEP, + CONFLICT, +} = CanPlaceDep +const debug = require('./debug.js') + +const Link = require('./link.js') +const gatherDepSet = require('./gather-dep-set.js') +const peerEntrySets = require('./peer-entry-sets.js') + +class PlaceDep { + constructor (options) { + this.auditReport = options.auditReport + this.dep = options.dep + this.edge = options.edge + this.explicitRequest = options.explicitRequest + this.force = options.force + this.installLinks = options.installLinks + this.installStrategy = options.installStrategy + this.legacyPeerDeps = options.legacyPeerDeps + this.parent = options.parent || null + this.preferDedupe = options.preferDedupe + this.strictPeerDeps = options.strictPeerDeps + this.updateNames = options.updateNames + + this.canPlace = null + this.canPlaceSelf = null + // XXX this only appears to be used by tests + this.checks = new Map() + this.children = [] + this.needEvaluation = new Set() + this.peerConflict = null + this.placed = null + this.target = null + + this.current = this.edge.to + this.name = this.edge.name + this.top = this.parent?.top || this + + // nothing to do if the edge is fine as it is + if (this.edge.to && + !this.edge.error && + !this.explicitRequest && + !this.updateNames.includes(this.edge.name) && + !this.auditReport?.isVulnerable(this.edge.to)) { + return + } + + // walk up the tree until we hit either a top/root node, or a place + // where the dep is not a peer dep. + const start = this.getStartNode() + + for (const target of start.ancestry()) { + // if the current location has a peerDep on it, then we can't place here + // this is pretty rare to hit, since we always prefer deduping peers, + // and the getStartNode will start us out above any peers from the + // thing that depends on it. but we could hit it with something like: + // + // a -> (b@1, c@1) + // +-- c@1 + // +-- b -> PEEROPTIONAL(v) (c@2) + // +-- c@2 -> (v) + // + // So we check if we can place v under c@2, that's fine. + // Then we check under b, and can't, because of the optional peer dep. + // but we CAN place it under a, so the correct thing to do is keep + // walking up the tree. + const targetEdge = target.edgesOut.get(this.edge.name) + if (!target.isTop && targetEdge && targetEdge.peer) { + continue + } + + const cpd = new CanPlaceDep({ + dep: this.dep, + edge: this.edge, + // note: this sets the parent's canPlace as the parent of this + // canPlace, but it does NOT add this canPlace to the parent's + // children. This way, we can know that it's a peer dep, and + // get the top edge easily, while still maintaining the + // tree of checks that factored into the original decision. + parent: this.parent && this.parent.canPlace, + target, + preferDedupe: this.preferDedupe, + explicitRequest: this.explicitRequest, + }) + this.checks.set(target, cpd) + + // It's possible that a "conflict" is a conflict among the *peers* of + // a given node we're trying to place, but there actually is no current + // node. Eg, + // root -> (a, b) + // a -> PEER(c) + // b -> PEER(d) + // d -> PEER(c@2) + // We place (a), and get a peer of (c) along with it. + // then we try to place (b), and get CONFLICT in the check, because + // of the conflicting peer from (b)->(d)->(c@2). In that case, we + // should treat (b) and (d) as OK, and place them in the last place + // where they did not themselves conflict, and skip c@2 if conflict + // is ok by virtue of being forced or not ours and not strict. + if (cpd.canPlaceSelf !== CONFLICT) { + this.canPlaceSelf = cpd + } + + // we found a place this can go, along with all its peer friends. + // we break when we get the first conflict + if (cpd.canPlace !== CONFLICT) { + this.canPlace = cpd + } else { + break + } + + // if it's a load failure, just plop it in the first place attempted, + // since we're going to crash the build or prune it out anyway. + // but, this will frequently NOT be a successful canPlace, because + // it'll have no version or other information. + if (this.dep.errors.length) { + break + } + + // nest packages like npm v1 and v2 + // very disk-inefficient + if (this.installStrategy === 'nested') { + break + } + + // when installing globally, or just in global style, we never place + // deps above the first level. + if (this.installStrategy === 'shallow') { + const rp = target.resolveParent + if (rp && rp.isProjectRoot) { + break + } + } + } + + // if we can't find a target, that means that the last place checked, + // and all the places before it, had a conflict. + if (!this.canPlace) { + // if not forced, and it's our dep, or strictPeerDeps is set, then + // this is an ERESOLVE error. + if (!this.force && (this.isMine || this.strictPeerDeps)) { + return this.failPeerConflict() + } + + // ok! we're gonna allow the conflict, but we should still warn + // if we have a current, then we treat CONFLICT as a KEEP. + // otherwise, we just skip it. Only warn on the one that actually + // could not be placed somewhere. + if (!this.canPlaceSelf) { + this.warnPeerConflict() + return + } + + this.canPlace = this.canPlaceSelf + } + + // now we have a target, a tree of CanPlaceDep results for the peer group, + // and we are ready to go + + /* istanbul ignore next */ + if (!this.canPlace) { + debug(() => { + throw new Error('canPlace not set, but trying to place in tree') + }) + return + } + + const { target } = this.canPlace + + log.silly( + 'placeDep', + target.location || 'ROOT', + `${this.dep.name}@${this.dep.version}`, + this.canPlace.description, + `for: ${this.edge.from.package._id || this.edge.from.location}`, + `want: ${redact(this.edge.spec || '*')}` + ) + + const placementType = this.canPlace.canPlace === CONFLICT + ? this.canPlace.canPlaceSelf + : this.canPlace.canPlace + + // if we're placing in the tree with --force, we can get here even though + // it's a conflict. Treat it as a KEEP, but warn and move on. + if (placementType === KEEP) { + // this was a peerConflicted peer dep + if (this.edge.peer && !this.edge.valid) { + this.warnPeerConflict() + } + + // if we get a KEEP in a update scenario, then we MAY have something + // already duplicating this unnecessarily! For example: + // ``` + // root (dep: y@1) + // +-- x (dep: y@1.1) + // | +-- y@1.1.0 (replacing with 1.1.2, got KEEP at the root) + // +-- y@1.1.2 (updated already from 1.0.0) + // ``` + // Now say we do `reify({update:['y']})`, and the latest version is + // 1.1.2, which we now have in the root. We'll try to place y@1.1.2 + // first in x, then in the root, ending with KEEP, because we already + // have it. In that case, we ought to REMOVE the nm/x/nm/y node, because + // it is an unnecessary duplicate. + this.pruneDedupable(target) + return + } + + // we were told to place it here in the target, so either it does not + // already exist in the tree, OR it's shadowed. + // handle otherwise unresolvable dependency nesting loops by + // creating a symbolic link + // a1 -> b1 -> a2 -> b2 -> a1 -> ... + // instead of nesting forever, when the loop occurs, create + // a symbolic link to the earlier instance + for (let p = target; p; p = p.resolveParent) { + if (p.matches(this.dep) && !p.isTop) { + this.placed = new Link({ parent: target, target: p }) + return + } + } + + // XXX if we are replacing SOME of a peer entry group, we will need to + // remove any that are not being replaced and will now be invalid, and + // re-evaluate them deeper into the tree. + + const virtualRoot = this.dep.parent + this.placed = new this.dep.constructor({ + name: this.dep.name, + pkg: this.dep.package, + resolved: this.dep.resolved, + integrity: this.dep.integrity, + installLinks: this.installLinks, + legacyPeerDeps: this.legacyPeerDeps, + error: this.dep.errors[0], + ...(this.dep.overrides ? { overrides: this.dep.overrides } : {}), + ...(this.dep.isLink ? { target: this.dep.target, realpath: this.dep.realpath } : {}), + }) + + this.oldDep = target.children.get(this.name) + if (this.oldDep) { + this.replaceOldDep() + } else { + this.placed.parent = target + } + + // if it's a peerConflicted peer dep, warn about it + if (this.edge.peer && !this.placed.satisfies(this.edge)) { + this.warnPeerConflict() + } + + // If the edge is not an error, then we're updating something, and + // MAY end up putting a better/identical node further up the tree in + // a way that causes an unnecessary duplication. If so, remove the + // now-unnecessary node. + if (this.edge.valid && this.edge.to && this.edge.to !== this.placed) { + this.pruneDedupable(this.edge.to, false) + } + + // in case we just made some duplicates that can be removed, + // prune anything deeper in the tree that can be replaced by this + for (const node of target.root.inventory.query('name', this.name)) { + if (node.isDescendantOf(target) && !node.isTop) { + this.pruneDedupable(node, false) + // only walk the direct children of the ones we kept + if (node.root === target.root) { + for (const kid of node.children.values()) { + this.pruneDedupable(kid, false) + } + } + } + } + + // also place its unmet or invalid peer deps at this location + // loop through any peer deps from the thing we just placed, and place + // those ones as well. it's safe to do this with the virtual nodes, + // because we're copying rather than moving them out of the virtual root, + // otherwise they'd be gone and the peer set would change throughout + // this loop. + for (const peerEdge of this.placed.edgesOut.values()) { + if (peerEdge.valid || !peerEdge.peer || peerEdge.peerConflicted) { + continue + } + + const peer = virtualRoot.children.get(peerEdge.name) + + // Note: if the virtualRoot *doesn't* have the peer, then that means + // it's an optional peer dep. If it's not being properly met (ie, + // peerEdge.valid is false), then this is likely heading for an + // ERESOLVE error, unless it can walk further up the tree. + if (!peer) { + continue + } + + // peerConflicted peerEdge, just accept what's there already + if (!peer.satisfies(peerEdge)) { + continue + } + + this.children.push(new PlaceDep({ + auditReport: this.auditReport, + explicitRequest: this.explicitRequest, + force: this.force, + installLinks: this.installLinks, + installStrategy: this.installStrategy, + legacyPeerDeps: this.legaycPeerDeps, + preferDedupe: this.preferDedupe, + strictPeerDeps: this.strictPeerDeps, + updateNames: this.updateName, + parent: this, + dep: peer, + node: this.placed, + edge: peerEdge, + })) + } + } + + replaceOldDep () { + const target = this.oldDep.parent + + // XXX handle replacing an entire peer group? + // what about cases where we need to push some other peer groups deeper + // into the tree? all the tree updating should be done here, and track + // all the things that we add and remove, so that we can know what + // to re-evaluate. + + // if we're replacing, we should also remove any nodes for edges that + // are now invalid, and where this (or its deps) is the only dependent, + // and also recurse on that pruning. Otherwise leaving that dep node + // around can result in spurious conflicts pushing nodes deeper into + // the tree than needed in the case of cycles that will be removed + // later anyway. + const oldDeps = [] + for (const [name, edge] of this.oldDep.edgesOut.entries()) { + if (!this.placed.edgesOut.has(name) && edge.to) { + oldDeps.push(...gatherDepSet([edge.to], e => e.to !== edge.to)) + } + } + + // gather all peer edgesIn which are at this level, and will not be + // satisfied by the new dependency. Those are the peer sets that need + // to be either warned about (if they cannot go deeper), or removed and + // re-placed (if they can). + const prunePeerSets = [] + for (const edge of this.oldDep.edgesIn) { + if (this.placed.satisfies(edge) || + !edge.peer || + edge.from.parent !== target || + edge.peerConflicted) { + // not a peer dep, not invalid, or not from this level, so it's fine + // to just let it re-evaluate as a problemEdge later, or let it be + // satisfied by the new dep being placed. + continue + } + for (const entryEdge of peerEntrySets(edge.from).keys()) { + // either this one needs to be pruned and re-evaluated, or marked + // as peerConflicted and warned about. If the entryEdge comes in from + // the root or a workspace, then we have to leave it alone, and in that + // case, it will have already warned or crashed by getting to this point + const entryNode = entryEdge.to + const deepestTarget = deepestNestingTarget(entryNode) + if (deepestTarget !== target && + !(entryEdge.from.isProjectRoot || entryEdge.from.isWorkspace)) { + prunePeerSets.push(...gatherDepSet([entryNode], e => { + return e.to !== entryNode && !e.peerConflicted + })) + } else { + this.warnPeerConflict(edge, this.dep) + } + } + } + + this.placed.replace(this.oldDep) + this.pruneForReplacement(this.placed, oldDeps) + for (const dep of prunePeerSets) { + for (const edge of dep.edgesIn) { + this.needEvaluation.add(edge.from) + } + dep.root = null + } + } + + pruneForReplacement (node, oldDeps) { + // gather up all the now-invalid/extraneous edgesOut, as long as they are + // only depended upon by the old node/deps + const invalidDeps = new Set([...node.edgesOut.values()] + .filter(e => e.to && !e.valid).map(e => e.to)) + for (const dep of oldDeps) { + const set = gatherDepSet([dep], e => e.to !== dep && e.valid) + for (const dep of set) { + invalidDeps.add(dep) + } + } + + // ignore dependency edges from the node being replaced, but + // otherwise filter the set down to just the set with no + // dependencies from outside the set, except the node in question. + const deps = gatherDepSet(invalidDeps, edge => + edge.from !== node && edge.to !== node && edge.valid) + + // now just delete whatever's left, because it's junk + for (const dep of deps) { + dep.root = null + } + } + + // prune all the nodes in a branch of the tree that can be safely removed + // This is only the most basic duplication detection; it finds if there + // is another satisfying node further up the tree, and if so, dedupes. + // Even in installStategy is nested, we do this amount of deduplication. + pruneDedupable (node, descend = true) { + if (node.canDedupe(this.preferDedupe)) { + // gather up all deps that have no valid edges in from outside + // the dep set, except for this node we're deduping, so that we + // also prune deps that would be made extraneous. + const deps = gatherDepSet([node], e => e.to !== node && e.valid) + for (const node of deps) { + node.root = null + } + return + } + if (descend) { + // sort these so that they're deterministically ordered + // otherwise, resulting tree shape is dependent on the order + // in which they happened to be resolved. + const nodeSort = (a, b) => localeCompare(a.location, b.location) + + const children = [...node.children.values()].sort(nodeSort) + for (const child of children) { + this.pruneDedupable(child) + } + const fsChildren = [...node.fsChildren].sort(nodeSort) + for (const topNode of fsChildren) { + const children = [...topNode.children.values()].sort(nodeSort) + for (const child of children) { + this.pruneDedupable(child) + } + } + } + } + + get isMine () { + const { edge } = this.top + const { from: node } = edge + + if (node.isWorkspace || node.isProjectRoot) { + return true + } + + if (!edge.peer) { + return false + } + + // re-entry case. check if any non-peer edges come from the project, + // or any entryEdges on peer groups are from the root. + let hasPeerEdges = false + for (const edge of node.edgesIn) { + if (edge.peer) { + hasPeerEdges = true + continue + } + if (edge.from.isWorkspace || edge.from.isProjectRoot) { + return true + } + } + if (hasPeerEdges) { + for (const edge of peerEntrySets(node).keys()) { + if (edge.from.isWorkspace || edge.from.isProjectRoot) { + return true + } + } + } + + return false + } + + warnPeerConflict (edge, dep) { + edge = edge || this.edge + dep = dep || this.dep + edge.peerConflicted = true + const expl = this.explainPeerConflict(edge, dep) + log.warn('ERESOLVE', 'overriding peer dependency', expl) + } + + failPeerConflict (edge, dep) { + edge = edge || this.top.edge + dep = dep || this.top.dep + const expl = this.explainPeerConflict(edge, dep) + throw Object.assign(new Error('could not resolve'), expl) + } + + explainPeerConflict (edge, dep) { + const { from: node } = edge + const curNode = node.resolve(edge.name) + + // XXX decorate more with this.canPlace and this.canPlaceSelf, + // this.checks, this.children, walk over conflicted peers, etc. + const expl = { + code: 'ERESOLVE', + edge: edge.explain(), + dep: dep.explain(edge), + force: this.force, + isMine: this.isMine, + strictPeerDeps: this.strictPeerDeps, + } + + if (this.parent) { + // this is the conflicted peer + expl.current = curNode && curNode.explain(edge) + expl.peerConflict = this.current && this.current.explain(this.edge) + } else { + expl.current = curNode && curNode.explain() + if (this.canPlaceSelf && this.canPlaceSelf.canPlaceSelf !== CONFLICT) { + // failed while checking for a child dep + const cps = this.canPlaceSelf + for (const peer of cps.conflictChildren) { + if (peer.current) { + expl.peerConflict = { + current: peer.current.explain(), + peer: peer.dep.explain(peer.edge), + } + break + } + } + } else { + expl.peerConflict = { + current: this.current && this.current.explain(), + peer: this.dep.explain(this.edge), + } + } + } + + return expl + } + + getStartNode () { + // if we are a peer, then we MUST be at least as shallow as the peer + // dependent + const from = this.parent?.getStartNode() || this.edge.from + return deepestNestingTarget(from, this.name) + } + + // XXX this only appears to be used by tests + get allChildren () { + const set = new Set(this.children) + for (const child of set) { + for (const grandchild of child.children) { + set.add(grandchild) + } + } + return [...set] + } +} + +module.exports = PlaceDep diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/printable.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/printable.js new file mode 100644 index 00000000..53c3f7a5 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/printable.js @@ -0,0 +1,198 @@ +// helper function to output a clearer visualization +// of the current node and its descendents +const localeCompare = require('@isaacs/string-locale-compare')('en') +const util = require('node:util') +const relpath = require('./relpath.js') + +class ArboristNode { + constructor (tree, path) { + this.name = tree.name + if (tree.packageName && tree.packageName !== this.name) { + this.packageName = tree.packageName + } + if (tree.version) { + this.version = tree.version + } + this.location = tree.location + this.path = tree.path + if (tree.realpath !== this.path) { + this.realpath = tree.realpath + } + if (tree.resolved !== null) { + this.resolved = tree.resolved + } + if (tree.extraneous) { + this.extraneous = true + } + if (tree.dev) { + this.dev = true + } + if (tree.optional) { + this.optional = true + } + if (tree.devOptional && !tree.dev && !tree.optional) { + this.devOptional = true + } + if (tree.peer) { + this.peer = true + } + if (tree.inBundle) { + this.bundled = true + } + if (tree.inDepBundle) { + this.bundler = tree.getBundler().location + } + if (tree.isProjectRoot) { + this.isProjectRoot = true + } + if (tree.isWorkspace) { + this.isWorkspace = true + } + const bd = tree.package && tree.package.bundleDependencies + if (bd && bd.length) { + this.bundleDependencies = bd + } + if (tree.inShrinkwrap) { + this.inShrinkwrap = true + } else if (tree.hasShrinkwrap) { + this.hasShrinkwrap = true + } + if (tree.error) { + this.error = treeError(tree.error) + } + if (tree.errors && tree.errors.length) { + this.errors = tree.errors.map(treeError) + } + + if (tree.overrides) { + this.overrides = new Map([...tree.overrides.ruleset.values()] + .map((override) => [override.key, override.value])) + } + + // edgesOut sorted by name + if (tree.edgesOut.size) { + this.edgesOut = new Map([...tree.edgesOut.entries()] + .sort(([a], [b]) => localeCompare(a, b)) + .map(([name, edge]) => [name, new EdgeOut(edge)])) + } + + // edgesIn sorted by location + if (tree.edgesIn.size) { + this.edgesIn = new Set([...tree.edgesIn] + .sort((a, b) => localeCompare(a.from.location, b.from.location)) + .map(edge => new EdgeIn(edge))) + } + + if (tree.workspaces && tree.workspaces.size) { + this.workspaces = new Map([...tree.workspaces.entries()] + .map(([name, path]) => [name, relpath(tree.root.realpath, path)])) + } + + // fsChildren sorted by path + if (tree.fsChildren.size) { + this.fsChildren = new Set([...tree.fsChildren] + .sort(({ path: a }, { path: b }) => localeCompare(a, b)) + .map(tree => printableTree(tree, path))) + } + + // children sorted by name + if (tree.children.size) { + this.children = new Map([...tree.children.entries()] + .sort(([a], [b]) => localeCompare(a, b)) + .map(([name, tree]) => [name, printableTree(tree, path)])) + } + } +} + +class ArboristVirtualNode extends ArboristNode { + constructor (tree, path) { + super(tree, path) + this.sourceReference = printableTree(tree.sourceReference, path) + } +} + +class ArboristLink extends ArboristNode { + constructor (tree, path) { + super(tree, path) + this.target = printableTree(tree.target, path) + } +} + +const treeError = ({ code, path }) => ({ + code, + ...(path ? { path } : {}), +}) + +// print out edges without dumping the full node all over again +// this base class will toJSON as a plain old object, but the +// util.inspect() output will be a bit cleaner +class Edge { + constructor (edge) { + this.type = edge.type + this.name = edge.name + this.spec = edge.rawSpec || '*' + if (edge.rawSpec !== edge.spec) { + this.override = edge.spec + } + if (edge.error) { + this.error = edge.error + } + if (edge.peerConflicted) { + this.peerConflicted = edge.peerConflicted + } + } +} + +// don't care about 'from' for edges out +class EdgeOut extends Edge { + constructor (edge) { + super(edge) + this.to = edge.to && edge.to.location + } + + [util.inspect.custom] () { + return `{ ${this.type} ${this.name}@${this.spec}${ + this.override ? ` overridden:${this.override}` : '' + }${ + this.to ? ' -> ' + this.to : '' + }${ + this.error ? ' ' + this.error : '' + }${ + this.peerConflicted ? ' peerConflicted' : '' + } }` + } +} + +// don't care about 'to' for edges in +class EdgeIn extends Edge { + constructor (edge) { + super(edge) + this.from = edge.from && edge.from.location + } + + [util.inspect.custom] () { + return `{ ${this.from || '""'} ${this.type} ${this.name}@${this.spec}${ + this.error ? ' ' + this.error : '' + }${ + this.peerConflicted ? ' peerConflicted' : '' + } }` + } +} + +const printableTree = (tree, path = []) => { + if (!tree) { + return tree + } + + const Cls = tree.isLink ? ArboristLink + : tree.sourceReference ? ArboristVirtualNode + : ArboristNode + if (path.includes(tree)) { + const obj = Object.create(Cls.prototype) + return Object.assign(obj, { location: tree.location }) + } + path.push(tree) + return new Cls(tree, path) +} + +module.exports = printableTree diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/query-selector-all.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/query-selector-all.js new file mode 100644 index 00000000..c2cd00d0 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/query-selector-all.js @@ -0,0 +1,945 @@ +'use strict' + +const { resolve } = require('node:path') +const { parser, arrayDelimiter } = require('@npmcli/query') +const localeCompare = require('@isaacs/string-locale-compare')('en') +const { log } = require('proc-log') +const { minimatch } = require('minimatch') +const npa = require('npm-package-arg') +const pacote = require('pacote') +const semver = require('semver') +const npmFetch = require('npm-registry-fetch') + +// handle results for parsed query asts, results are stored in a map that has a +// key that points to each ast selector node and stores the resulting array of +// arborist nodes as its value, that is essential to how we handle multiple +// query selectors, e.g: `#a, #b, #c` <- 3 diff ast selector nodes +class Results { + #currentAstSelector + #initialItems + #inventory + #outdatedCache = new Map() + #vulnCache + #pendingCombinator + #results = new Map() + #targetNode + + constructor (opts) { + this.#currentAstSelector = opts.rootAstNode.nodes[0] + this.#inventory = opts.inventory + this.#initialItems = opts.initialItems + this.#vulnCache = opts.vulnCache + this.#targetNode = opts.targetNode + + this.currentResults = this.#initialItems + + // We get this when first called and need to pass it to pacote + this.flatOptions = opts.flatOptions || {} + + // reset by rootAstNode walker + this.currentAstNode = opts.rootAstNode + } + + get currentResults () { + return this.#results.get(this.#currentAstSelector) + } + + set currentResults (value) { + this.#results.set(this.#currentAstSelector, value) + } + + // retrieves the initial items to which start the filtering / matching + // for most of the different types of recognized ast nodes, e.g: class (aka + // depType), id, *, etc in different contexts we need to start with the + // current list of filtered results, for example a query for `.workspace` + // actually means the same as `*.workspace` so we want to start with the full + // inventory if that's the first ast node we're reading but if it appears in + // the middle of a query it should respect the previous filtered results, + // combinators are a special case in which we always want to have the + // complete inventory list in order to use the left-hand side ast node as a + // filter combined with the element on its right-hand side + get initialItems () { + const firstParsed = + (this.currentAstNode.parent.nodes[0] === this.currentAstNode) && + (this.currentAstNode.parent.parent.type === 'root') + + if (firstParsed) { + return this.#initialItems + } + + if (this.currentAstNode.prev().type === 'combinator') { + return this.#inventory + } + return this.currentResults + } + + // combinators need information about previously filtered items along + // with info of the items parsed / retrieved from the selector right + // past the combinator, for this reason combinators are stored and + // only ran as the last part of each selector logic + processPendingCombinator (nextResults) { + if (this.#pendingCombinator) { + const res = this.#pendingCombinator(this.currentResults, nextResults) + this.#pendingCombinator = null + this.currentResults = res + } else { + this.currentResults = nextResults + } + } + + // when collecting results to a root astNode, we traverse the list of child + // selector nodes and collect all of their resulting arborist nodes into a + // single/flat Set of items, this ensures we also deduplicate items + collect (rootAstNode) { + return new Set(rootAstNode.nodes.flatMap(n => this.#results.get(n))) + } + + // selector types map to the '.type' property of the ast nodes via `${astNode.type}Type` + // + // attribute selector [name=value], etc + attributeType () { + const nextResults = this.initialItems.filter(node => + attributeMatch(this.currentAstNode, node.package) + ) + this.processPendingCombinator(nextResults) + } + + // dependency type selector (i.e. .prod, .dev, etc) + // css calls this class, we interpret is as dependency type + classType () { + const depTypeFn = depTypes[String(this.currentAstNode)] + if (!depTypeFn) { + throw Object.assign( + new Error(`\`${String(this.currentAstNode)}\` is not a supported dependency type.`), + { code: 'EQUERYNODEPTYPE' } + ) + } + const nextResults = depTypeFn(this.initialItems) + this.processPendingCombinator(nextResults) + } + + // combinators (i.e. '>', ' ', '~') + combinatorType () { + this.#pendingCombinator = combinators[String(this.currentAstNode)] + } + + // name selectors (i.e. #foo) + // css calls this id, we interpret it as name + idType () { + const name = this.currentAstNode.value + const nextResults = this.initialItems.filter(node => + (name === node.name) || (name === node.package.name) + ) + this.processPendingCombinator(nextResults) + } + + // pseudo selectors (prefixed with :) + async pseudoType () { + const pseudoFn = `${this.currentAstNode.value.slice(1)}Pseudo` + if (!this[pseudoFn]) { + throw Object.assign( + new Error(`\`${this.currentAstNode.value + }\` is not a supported pseudo selector.`), + { code: 'EQUERYNOPSEUDO' } + ) + } + const nextResults = await this[pseudoFn]() + this.processPendingCombinator(nextResults) + } + + selectorType () { + this.#currentAstSelector = this.currentAstNode + // starts a new array in which resulting items + // can be stored for each given ast selector + if (!this.currentResults) { + this.currentResults = [] + } + } + + universalType () { + this.processPendingCombinator(this.initialItems) + } + + // pseudo selectors map to the 'value' property of the pseudo selectors in the ast nodes + // via selectors via `${value.slice(1)}Pseudo` + attrPseudo () { + const { lookupProperties, attributeMatcher } = this.currentAstNode + + return this.initialItems.filter(node => { + let objs = [node.package] + for (const prop of lookupProperties) { + // if an isArray symbol is found that means we'll need to iterate + // over the previous found array to basically make sure we traverse + // all its indexes testing for possible objects that may eventually + // hold more keys specified in a selector + if (prop === arrayDelimiter) { + objs = objs.flat() + continue + } + + // otherwise just maps all currently found objs + // to the next prop from the lookup properties list, + // filters out any empty key lookup + objs = objs.flatMap(obj => obj[prop] || []) + + // in case there's no property found in the lookup + // just filters that item out + const noAttr = objs.every(obj => !obj) + if (noAttr) { + return false + } + } + + // if any of the potential object matches + // that item should be in the final result + return objs.some(obj => attributeMatch(attributeMatcher, obj)) + }) + } + + emptyPseudo () { + return this.initialItems.filter(node => node.edgesOut.size === 0) + } + + extraneousPseudo () { + return this.initialItems.filter(node => node.extraneous) + } + + async hasPseudo () { + const found = [] + for (const item of this.initialItems) { + // This is the one time initialItems differs from inventory + const res = await retrieveNodesFromParsedAst({ + flatOptions: this.flatOptions, + initialItems: [item], + inventory: this.#inventory, + rootAstNode: this.currentAstNode.nestedNode, + targetNode: item, + vulnCache: this.#vulnCache, + }) + if (res.size > 0) { + found.push(item) + } + } + return found + } + + invalidPseudo () { + const found = [] + for (const node of this.initialItems) { + for (const edge of node.edgesIn) { + if (edge.invalid) { + found.push(node) + break + } + } + } + return found + } + + async isPseudo () { + const res = await retrieveNodesFromParsedAst({ + flatOptions: this.flatOptions, + initialItems: this.initialItems, + inventory: this.#inventory, + rootAstNode: this.currentAstNode.nestedNode, + targetNode: this.currentAstNode, + vulnCache: this.#vulnCache, + }) + return [...res] + } + + linkPseudo () { + return this.initialItems.filter(node => node.isLink || (node.isTop && !node.isRoot)) + } + + missingPseudo () { + return this.#inventory.reduce((res, node) => { + for (const edge of node.edgesOut.values()) { + if (edge.missing) { + const pkg = { name: edge.name, version: edge.spec } + const item = new this.#targetNode.constructor({ pkg }) + item.queryContext = { + missing: true, + } + item.edgesIn = new Set([edge]) + res.push(item) + } + } + return res + }, []) + } + + async notPseudo () { + const res = await retrieveNodesFromParsedAst({ + flatOptions: this.flatOptions, + initialItems: this.initialItems, + inventory: this.#inventory, + rootAstNode: this.currentAstNode.nestedNode, + targetNode: this.currentAstNode, + vulnCache: this.#vulnCache, + }) + const internalSelector = new Set(res) + return this.initialItems.filter(node => + !internalSelector.has(node)) + } + + overriddenPseudo () { + return this.initialItems.filter(node => node.overridden) + } + + pathPseudo () { + return this.initialItems.filter(node => { + if (!this.currentAstNode.pathValue) { + return true + } + return minimatch( + node.realpath.replace(/\\+/g, '/'), + resolve(node.root.realpath, this.currentAstNode.pathValue).replace(/\\+/g, '/') + ) + }) + } + + privatePseudo () { + return this.initialItems.filter(node => node.package.private) + } + + rootPseudo () { + return this.initialItems.filter(node => node === this.#targetNode.root) + } + + scopePseudo () { + return this.initialItems.filter(node => node === this.#targetNode) + } + + semverPseudo () { + const { + attributeMatcher, + lookupProperties, + semverFunc = 'infer', + semverValue, + } = this.currentAstNode + const { qualifiedAttribute } = attributeMatcher + + if (!semverValue) { + // DEPRECATED: remove this warning and throw an error as part of @npmcli/arborist@6 + log.warn('query', 'usage of :semver() with no parameters is deprecated') + return this.initialItems + } + + if (!semver.valid(semverValue) && !semver.validRange(semverValue)) { + throw Object.assign( + new Error(`\`${semverValue}\` is not a valid semver version or range`), + { code: 'EQUERYINVALIDSEMVER' }) + } + + const valueIsVersion = !!semver.valid(semverValue) + + const nodeMatches = (node, obj) => { + // if we already have an operator, the user provided some test as part of the selector + // we evaluate that first because if it fails we don't want this node anyway + if (attributeMatcher.operator) { + if (!attributeMatch(attributeMatcher, obj)) { + // if the initial operator doesn't match, we're done + return false + } + } + + const attrValue = obj[qualifiedAttribute] + // both valid and validRange return null for undefined, so this will skip both nodes that + // do not have the attribute defined as well as those where the attribute value is invalid + // and those where the value from the package.json is not a string + if ((!semver.valid(attrValue) && !semver.validRange(attrValue)) || + typeof attrValue !== 'string') { + return false + } + + const attrIsVersion = !!semver.valid(attrValue) + + let actualFunc = semverFunc + + // if we're asked to infer, we examine outputs to make a best guess + if (actualFunc === 'infer') { + if (valueIsVersion && attrIsVersion) { + // two versions -> semver.eq + actualFunc = 'eq' + } else if (!valueIsVersion && !attrIsVersion) { + // two ranges -> semver.intersects + actualFunc = 'intersects' + } else { + // anything else -> semver.satisfies + actualFunc = 'satisfies' + } + } + + if (['eq', 'neq', 'gt', 'gte', 'lt', 'lte'].includes(actualFunc)) { + // both sides must be versions, but one is not + if (!valueIsVersion || !attrIsVersion) { + return false + } + + return semver[actualFunc](attrValue, semverValue) + } else if (['gtr', 'ltr', 'satisfies'].includes(actualFunc)) { + // at least one side must be a version, but neither is + if (!valueIsVersion && !attrIsVersion) { + return false + } + + return valueIsVersion + ? semver[actualFunc](semverValue, attrValue) + : semver[actualFunc](attrValue, semverValue) + } else if (['intersects', 'subset'].includes(actualFunc)) { + // these accept two ranges and since a version is also a range, anything goes + return semver[actualFunc](attrValue, semverValue) + } else { + // user provided a function we don't know about, throw an error + throw Object.assign(new Error(`\`semver.${actualFunc}\` is not a supported operator.`), + { code: 'EQUERYINVALIDOPERATOR' }) + } + } + + return this.initialItems.filter((node) => { + // no lookupProperties just means its a top level property, see if it matches + if (!lookupProperties.length) { + return nodeMatches(node, node.package) + } + + // this code is mostly duplicated from attrPseudo to traverse into the package until we get + // to our deepest requested object + let objs = [node.package] + for (const prop of lookupProperties) { + if (prop === arrayDelimiter) { + objs = objs.flat() + continue + } + + objs = objs.flatMap(obj => obj[prop] || []) + const noAttr = objs.every(obj => !obj) + if (noAttr) { + return false + } + + return objs.some(obj => nodeMatches(node, obj)) + } + }) + } + + typePseudo () { + if (!this.currentAstNode.typeValue) { + return this.initialItems + } + return this.initialItems + .flatMap(node => { + const found = [] + for (const edge of node.edgesIn) { + if (npa(`${edge.name}@${edge.spec}`).type === this.currentAstNode.typeValue) { + found.push(edge.to) + } + } + return found + }) + } + + dedupedPseudo () { + return this.initialItems.filter(node => node.target.edgesIn.size > 1) + } + + async vulnPseudo () { + if (!this.initialItems.length) { + return this.initialItems + } + if (!this.#vulnCache) { + const packages = {} + // We have to map the items twice, once to get the request, and a second time to filter out the results of that request + this.initialItems.map((node) => { + if (node.isProjectRoot || node.package.private) { + return + } + if (!packages[node.name]) { + packages[node.name] = [] + } + if (!packages[node.name].includes(node.version)) { + packages[node.name].push(node.version) + } + }) + const res = await npmFetch('/-/npm/v1/security/advisories/bulk', { + ...this.flatOptions, + registry: this.flatOptions.auditRegistry || this.flatOptions.registry, + method: 'POST', + gzip: true, + body: packages, + }) + this.#vulnCache = await res.json() + } + const advisories = this.#vulnCache + const { vulns } = this.currentAstNode + return this.initialItems.filter(item => { + const vulnerable = advisories[item.name]?.filter(advisory => { + // This could be for another version of this package elsewhere in the tree + if (!semver.intersects(advisory.vulnerable_versions, item.version)) { + return false + } + if (!vulns) { + return true + } + // vulns are OR with each other, if any one matches we're done + for (const vuln of vulns) { + if (vuln.severity && !vuln.severity.includes('*')) { + if (!vuln.severity.includes(advisory.severity)) { + continue + } + } + + if (vuln?.cwe) { + // * is special, it means "has a cwe" + if (vuln.cwe.includes('*')) { + if (!advisory.cwe.length) { + continue + } + } else if (!vuln.cwe.every(cwe => advisory.cwe.includes(`CWE-${cwe}`))) { + continue + } + } + return true + } + }) + if (vulnerable?.length) { + item.queryContext = { + advisories: vulnerable, + } + return true + } + return false + }) + } + + async outdatedPseudo () { + const { outdatedKind = 'any' } = this.currentAstNode + + // filter the initialItems + // NOTE: this uses a Promise.all around a map without in-line concurrency handling + // since the only async action taken is retrieving the packument, which is limited + // based on the max-sockets config in make-fetch-happen + const initialResults = await Promise.all(this.initialItems.map(async (node) => { + // the root can't be outdated, skip it + if (node.isProjectRoot) { + return false + } + + // private packages can't be published, skip them + if (node.package.private) { + return false + } + + // we cache the promise representing the full versions list, this helps reduce the + // number of requests we send by keeping population of the cache in a single tick + // making it less likely that multiple requests for the same package will be inflight + if (!this.#outdatedCache.has(node.name)) { + this.#outdatedCache.set(node.name, getPackageVersions(node.name, this.flatOptions)) + } + const availableVersions = await this.#outdatedCache.get(node.name) + + // we attach _all_ versions to the queryContext to allow consumers to do their own + // filtering and comparisons + node.queryContext.versions = availableVersions + + // next we further reduce the set to versions that are greater than the current one + const greaterVersions = availableVersions.filter((available) => { + return semver.gt(available, node.version) + }) + + // no newer versions than the current one, drop this node from the result set + if (!greaterVersions.length) { + return false + } + + // if we got here, we know that newer versions exist, if the kind is 'any' we're done + if (outdatedKind === 'any') { + return node + } + + // look for newer versions that differ from current by a specific part of the semver version + if (['major', 'minor', 'patch'].includes(outdatedKind)) { + // filter the versions greater than our current one based on semver.diff + const filteredVersions = greaterVersions.filter((version) => { + return semver.diff(node.version, version) === outdatedKind + }) + + // no available versions are of the correct diff type + if (!filteredVersions.length) { + return false + } + + return node + } + + // look for newer versions that satisfy at least one edgeIn to this node + if (outdatedKind === 'in-range') { + const inRangeContext = [] + for (const edge of node.edgesIn) { + const inRangeVersions = greaterVersions.filter((version) => { + return semver.satisfies(version, edge.spec) + }) + + // this edge has no in-range candidates, just move on + if (!inRangeVersions.length) { + continue + } + + inRangeContext.push({ + from: edge.from.location, + versions: inRangeVersions, + }) + } + + // if we didn't find at least one match, drop this node + if (!inRangeContext.length) { + return false + } + + // now add to the context each version that is in-range for each edgeIn + node.queryContext.outdated = { + ...node.queryContext.outdated, + inRange: inRangeContext, + } + + return node + } + + // look for newer versions that _do not_ satisfy at least one edgeIn + if (outdatedKind === 'out-of-range') { + const outOfRangeContext = [] + for (const edge of node.edgesIn) { + const outOfRangeVersions = greaterVersions.filter((version) => { + return !semver.satisfies(version, edge.spec) + }) + + // this edge has no out-of-range candidates, skip it + if (!outOfRangeVersions.length) { + continue + } + + outOfRangeContext.push({ + from: edge.from.location, + versions: outOfRangeVersions, + }) + } + + // if we didn't add at least one thing to the context, this node is not a match + if (!outOfRangeContext.length) { + return false + } + + // attach the out-of-range context to the node + node.queryContext.outdated = { + ...node.queryContext.outdated, + outOfRange: outOfRangeContext, + } + + return node + } + + // any other outdatedKind is unknown and will never match + return false + })) + + // return an array with the holes for non-matching nodes removed + return initialResults.filter(Boolean) + } +} + +// operators for attribute selectors +const attributeOperators = { + // attribute value is equivalent + '=' ({ attr, value }) { + return attr === value + }, + // attribute value contains word + '~=' ({ attr, value }) { + return (attr.match(/\w+/g) || []).includes(value) + }, + // attribute value contains string + '*=' ({ attr, value }) { + return attr.includes(value) + }, + // attribute value is equal or starts with + '|=' ({ attr, value }) { + return attr.startsWith(`${value}-`) + }, + // attribute value starts with + '^=' ({ attr, value }) { + return attr.startsWith(value) + }, + // attribute value ends with + '$=' ({ attr, value }) { + return attr.endsWith(value) + }, +} + +const attributeOperator = ({ attr, value, insensitive, operator }) => { + if (typeof attr === 'number') { + attr = String(attr) + } + if (typeof attr !== 'string') { + // It's an object or an array, bail + return false + } + if (insensitive) { + attr = attr.toLowerCase() + } + + return attributeOperators[operator]({ + attr, + insensitive, + value, + }) +} + +const attributeMatch = (matcher, obj) => { + const insensitive = !!matcher.insensitive + const operator = matcher.operator || '' + const attribute = matcher.qualifiedAttribute + let value = matcher.value || '' + // return early if checking existence + if (operator === '') { + return Boolean(obj[attribute]) + } + if (insensitive) { + value = value.toLowerCase() + } + // in case the current object is an array + // then we try to match every item in the array + if (Array.isArray(obj[attribute])) { + return obj[attribute].find((i, index) => { + const attr = obj[attribute][index] || '' + return attributeOperator({ attr, value, insensitive, operator }) + }) + } else { + const attr = obj[attribute] || '' + return attributeOperator({ attr, value, insensitive, operator }) + } +} + +const edgeIsType = (node, type, seen = new Set()) => { + for (const edgeIn of node.edgesIn) { + // TODO Need a test with an infinite loop + if (seen.has(edgeIn)) { + continue + } + seen.add(edgeIn) + if (edgeIn.type === type || edgeIn.from[type] || edgeIsType(edgeIn.from, type, seen)) { + return true + } + } + return false +} + +const filterByType = (nodes, type) => { + const found = [] + for (const node of nodes) { + if (node[type] || edgeIsType(node, type)) { + found.push(node) + } + } + return found +} + +const depTypes = { + // dependency + '.prod' (prevResults) { + const found = [] + for (const node of prevResults) { + if (!node.dev) { + found.push(node) + } + } + return found + }, + // devDependency + '.dev' (prevResults) { + return filterByType(prevResults, 'dev') + }, + // optionalDependency + '.optional' (prevResults) { + return filterByType(prevResults, 'optional') + }, + // peerDependency + '.peer' (prevResults) { + return filterByType(prevResults, 'peer') + }, + // workspace + '.workspace' (prevResults) { + return prevResults.filter(node => node.isWorkspace) + }, + // bundledDependency + '.bundled' (prevResults) { + return prevResults.filter(node => node.inBundle) + }, +} + +// checks if a given node has a direct parent in any of the nodes provided in +// the compare nodes array +const hasParent = (node, compareNodes) => { + // All it takes is one so we loop and return on the first hit + for (let compareNode of compareNodes) { + if (compareNode.isLink) { + compareNode = compareNode.target + } + + // follows logical parent for link anscestors + if (node.isTop && (node.resolveParent === compareNode)) { + return true + } + // follows edges-in to check if they match a possible parent + for (const edge of node.edgesIn) { + if (edge && edge.from === compareNode) { + return true + } + } + } + return false +} + +// checks if a given node is a descendant of any of the nodes provided in the +// compareNodes array +const hasAscendant = (node, compareNodes, seen = new Set()) => { + // TODO (future) loop over ancestry property + if (hasParent(node, compareNodes)) { + return true + } + + if (node.isTop && node.resolveParent) { + /* istanbul ignore if - investigate if linksIn check obviates need for this */ + if (hasAscendant(node.resolveParent, compareNodes)) { + return true + } + } + for (const edge of node.edgesIn) { + // TODO Need a test with an infinite loop + if (seen.has(edge)) { + continue + } + seen.add(edge) + if (edge && edge.from && hasAscendant(edge.from, compareNodes, seen)) { + return true + } + } + for (const linkNode of node.linksIn) { + if (hasAscendant(linkNode, compareNodes, seen)) { + return true + } + } + return false +} + +const combinators = { + // direct descendant + '>' (prevResults, nextResults) { + return nextResults.filter(node => hasParent(node, prevResults)) + }, + // any descendant + ' ' (prevResults, nextResults) { + return nextResults.filter(node => hasAscendant(node, prevResults)) + }, + // sibling + '~' (prevResults, nextResults) { + // Return any node in nextResults that is a sibling of (aka shares a + // parent with) a node in prevResults + const parentNodes = new Set() // Parents of everything in prevResults + for (const node of prevResults) { + for (const edge of node.edgesIn) { + // edge.from always exists cause it's from another node's edgesIn + parentNodes.add(edge.from) + } + } + return nextResults.filter(node => + !prevResults.includes(node) && hasParent(node, [...parentNodes]) + ) + }, +} + +// get a list of available versions of a package filtered to respect --before +// NOTE: this runs over each node and should not throw +const getPackageVersions = async (name, opts) => { + let packument + try { + packument = await pacote.packument(name, { + ...opts, + fullMetadata: false, // we only need the corgi + }) + } catch (err) { + // if the fetch fails, log a warning and pretend there are no versions + log.warn('query', `could not retrieve packument for ${name}: ${err.message}`) + return [] + } + + // start with a sorted list of all versions (lowest first) + let candidates = Object.keys(packument.versions).sort(semver.compare) + + // if the packument has a time property, and the user passed a before flag, then + // we filter this list down to only those versions that existed before the specified date + if (packument.time && opts.before) { + candidates = candidates.filter((version) => { + // this version isn't found in the times at all, drop it + if (!packument.time[version]) { + return false + } + + return Date.parse(packument.time[version]) <= opts.before + }) + } + + return candidates +} + +const retrieveNodesFromParsedAst = async (opts) => { + // when we first call this it's the parsed query. all other times it's + // results.currentNode.nestedNode + const rootAstNode = opts.rootAstNode + + if (!rootAstNode.nodes) { + return new Set() + } + + const results = new Results(opts) + + const astNodeQueue = new Set() + // walk is sync, so we have to build up our async functions and then await them later + rootAstNode.walk((nextAstNode) => { + astNodeQueue.add(nextAstNode) + }) + + for (const nextAstNode of astNodeQueue) { + // This is the only place we reset currentAstNode + results.currentAstNode = nextAstNode + const updateFn = `${results.currentAstNode.type}Type` + if (typeof results[updateFn] !== 'function') { + throw Object.assign( + new Error(`\`${results.currentAstNode.type}\` is not a supported selector.`), + { code: 'EQUERYNOSELECTOR' } + ) + } + await results[updateFn]() + } + + return results.collect(rootAstNode) +} + +const querySelectorAll = async (targetNode, query, flatOptions) => { + // This never changes ever we just pass it around. But we can't scope it to + // this whole file if we ever want to support concurrent calls to this + // function. + const inventory = [...targetNode.root.inventory.values()] + // res is a Set of items returned for each parsed css ast selector + const res = await retrieveNodesFromParsedAst({ + initialItems: inventory, + inventory, + flatOptions, + rootAstNode: parser(query), + targetNode, + }) + + // returns nodes ordered by realpath + return [...res].sort((a, b) => localeCompare(a.location, b.location)) +} + +module.exports = querySelectorAll diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/realpath.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/realpath.js new file mode 100644 index 00000000..6e5ad9b7 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/realpath.js @@ -0,0 +1,95 @@ +// look up the realpath, but cache stats to minimize overhead +// If the parent folder is in the realpath cache, then we just +// lstat the child, since there's no need to do a full realpath +// This is not a separate module, and is much simpler than Node's +// built-in fs.realpath, because we only care about symbolic links, +// so we can handle many fewer edge cases. + +const { lstat, readlink } = require('node:fs/promises') +const { resolve, basename, dirname } = require('node:path') + +const realpathCached = (path, rpcache, stcache, depth) => { + // just a safety against extremely deep eloops + /* istanbul ignore next */ + if (depth > 2000) { + throw eloop(path) + } + + path = resolve(path) + if (rpcache.has(path)) { + return Promise.resolve(rpcache.get(path)) + } + + const dir = dirname(path) + const base = basename(path) + + if (base && rpcache.has(dir)) { + return realpathChild(dir, base, rpcache, stcache, depth) + } + + // if it's the root, then we know it's real + if (!base) { + rpcache.set(dir, dir) + return Promise.resolve(dir) + } + + // the parent, what is that? + // find out, and then come back. + return realpathCached(dir, rpcache, stcache, depth + 1).then(() => + realpathCached(path, rpcache, stcache, depth + 1)) +} + +const lstatCached = (path, stcache) => { + if (stcache.has(path)) { + return Promise.resolve(stcache.get(path)) + } + + const p = lstat(path).then(st => { + stcache.set(path, st) + return st + }) + stcache.set(path, p) + return p +} + +// This is a slight fib, as it doesn't actually occur during a stat syscall. +// But file systems are giant piles of lies, so whatever. +const eloop = path => + Object.assign(new Error( + `ELOOP: too many symbolic links encountered, stat '${path}'`), { + errno: -62, + syscall: 'stat', + code: 'ELOOP', + path: path, + }) + +const realpathChild = (dir, base, rpcache, stcache, depth) => { + const realdir = rpcache.get(dir) + // that unpossible + /* istanbul ignore next */ + if (typeof realdir === 'undefined') { + throw new Error('in realpathChild without parent being in realpath cache') + } + + const realish = resolve(realdir, base) + return lstatCached(realish, stcache).then(st => { + if (!st.isSymbolicLink()) { + rpcache.set(resolve(dir, base), realish) + return realish + } + + return readlink(realish).then(target => { + const resolved = resolve(realdir, target) + if (realish === resolved) { + throw eloop(realish) + } + + return realpathCached(resolved, rpcache, stcache, depth + 1) + }).then(real => { + rpcache.set(resolve(dir, base), real) + return real + }) + }) +} + +module.exports = realpathCached diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/relpath.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/relpath.js new file mode 100644 index 00000000..a4187b5f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/relpath.js @@ -0,0 +1,3 @@ +const { relative } = require('node:path') +const relpath = (from, to) => relative(from, to).replace(/\\/g, '/') +module.exports = relpath diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/reset-dep-flags.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/reset-dep-flags.js new file mode 100644 index 00000000..e259e901 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/reset-dep-flags.js @@ -0,0 +1,15 @@ +// Sometimes we need to actually do a walk from the root, because you can +// have a cycle of deps that all depend on each other, but no path from root. +// Also, since the ideal tree is loaded from the shrinkwrap, it had extraneous +// flags set false that might now be actually extraneous, and dev/optional +// flags that are also now incorrect. This method sets all flags to true, so +// we can find the set that is actually extraneous. +module.exports = tree => { + for (const node of tree.inventory.values()) { + node.extraneous = true + node.dev = true + node.devOptional = true + node.peer = true + node.optional = true + } +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/retire-path.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/retire-path.js new file mode 100644 index 00000000..5bff79a1 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/retire-path.js @@ -0,0 +1,19 @@ +const crypto = require('node:crypto') +const { dirname, basename, resolve } = require('node:path') + +// use sha1 because it's faster, and collisions extremely unlikely anyway +const pathSafeHash = s => + crypto.createHash('sha1') + .update(s) + .digest('base64') + .replace(/[^a-zA-Z0-9]+/g, '') + .slice(0, 8) + +const retirePath = from => { + const d = dirname(from) + const b = basename(from) + const hash = pathSafeHash(from) + return resolve(d, `.${b}-${hash}`) +} + +module.exports = retirePath diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js new file mode 100644 index 00000000..5f720ed9 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js @@ -0,0 +1,1181 @@ +// a module that manages a shrinkwrap file (npm-shrinkwrap.json or +// package-lock.json). + +// Increment whenever the lockfile version updates +// v1 - npm <=6 +// v2 - arborist v1, npm v7, backwards compatible with v1, add 'packages' +// v3 will drop the 'dependencies' field, backwards comp with v2, not v1 +// +// We cannot bump to v3 until npm v6 is out of common usage, and +// definitely not before npm v8. + +const localeCompare = require('@isaacs/string-locale-compare')('en') +const defaultLockfileVersion = 3 + +// for comparing nodes to yarn.lock entries +const mismatch = (a, b) => a && b && a !== b + +// this.tree => the root node for the tree (ie, same path as this) +// - Set the first time we do `this.add(node)` for a path matching this.path +// +// this.add(node) => +// - decorate the node with the metadata we have, if we have it, and it matches +// - add to the map of nodes needing to be committed, so that subsequent +// changes are captured when we commit that location's metadata. +// +// this.commit() => +// - commit all nodes awaiting update to their metadata entries +// - re-generate this.data and this.yarnLock based on this.tree +// +// Note that between this.add() and this.commit(), `this.data` will be out of +// date! Always call `commit()` before relying on it. +// +// After calling this.commit(), any nodes not present in the tree will have +// been removed from the shrinkwrap data as well. + +const { log } = require('proc-log') +const YarnLock = require('./yarn-lock.js') +const { + readFile, + readdir, + readlink, + rm, + stat, + writeFile, +} = require('node:fs/promises') + +const { resolve, basename, relative } = require('node:path') +const specFromLock = require('./spec-from-lock.js') +const versionFromTgz = require('./version-from-tgz.js') +const npa = require('npm-package-arg') +const pkgJson = require('@npmcli/package-json') +const parseJSON = require('parse-conflict-json') +const nameFromFolder = require('@npmcli/name-from-folder') + +const stringify = require('json-stringify-nice') +const swKeyOrder = [ + 'name', + 'version', + 'lockfileVersion', + 'resolved', + 'integrity', + 'requires', + 'packages', + 'dependencies', +] + +// used to rewrite from yarn registry to npm registry +const yarnRegRe = /^https?:\/\/registry\.yarnpkg\.com\// +const npmRegRe = /^https?:\/\/registry\.npmjs\.org\// + +// sometimes resolved: is weird or broken, or something npa can't handle +const specFromResolved = resolved => { + try { + return npa(resolved) + } catch (er) { + return {} + } +} + +const relpath = require('./relpath.js') + +const consistentResolve = require('./consistent-resolve.js') +const { overrideResolves } = require('./override-resolves.js') + +const pkgMetaKeys = [ + // note: name is included if necessary, for alias packages + 'version', + 'dependencies', + 'peerDependencies', + 'peerDependenciesMeta', + 'optionalDependencies', + 'bundleDependencies', + 'acceptDependencies', + 'funding', + 'engines', + 'os', + 'cpu', + '_integrity', + 'license', + '_hasShrinkwrap', + 'hasInstallScript', + 'bin', + 'deprecated', + 'workspaces', +] + +const nodeMetaKeys = [ + 'integrity', + 'inBundle', + 'hasShrinkwrap', + 'hasInstallScript', +] + +const metaFieldFromPkg = (pkg, key) => { + const val = pkg[key] + if (val) { + // get only the license type, not the full object + if (key === 'license' && typeof val === 'object' && val.type) { + return val.type + } + // skip empty objects and falsey values + if (typeof val !== 'object' || Object.keys(val).length) { + return val + } + } + return null +} + +// check to make sure that there are no packages newer than or missing from the hidden lockfile +const assertNoNewer = async (path, data, lockTime, dir, seen) => { + const base = basename(dir) + const isNM = dir !== path && base === 'node_modules' + const isScope = dir !== path && base.startsWith('@') + const isParent = (dir === path) || isNM || isScope + + const parent = isParent ? dir : resolve(dir, 'node_modules') + const rel = relpath(path, dir) + seen.add(rel) + let entries + if (dir === path) { + entries = [{ name: 'node_modules', isDirectory: () => true }] + } else { + const { mtime: dirTime } = await stat(dir) + if (dirTime > lockTime) { + throw new Error(`out of date, updated: ${rel}`) + } + if (!isScope && !isNM && !data.packages[rel]) { + throw new Error(`missing from lockfile: ${rel}`) + } + entries = await readdir(parent, { withFileTypes: true }).catch(() => []) + } + + // TODO limit concurrency here, this is recursive + await Promise.all(entries.map(async dirent => { + const child = resolve(parent, dirent.name) + if (dirent.isDirectory() && !dirent.name.startsWith('.')) { + await assertNoNewer(path, data, lockTime, child, seen) + } else if (dirent.isSymbolicLink()) { + const target = resolve(parent, await readlink(child)) + const tstat = await stat(target).catch( + /* istanbul ignore next - windows */ () => null) + seen.add(relpath(path, child)) + /* istanbul ignore next - windows cannot do this */ + if (tstat?.isDirectory() && !seen.has(relpath(path, target))) { + await assertNoNewer(path, data, lockTime, target, seen) + } + } + })) + + if (dir !== path) { + return + } + + // assert that all the entries in the lockfile were seen + for (const loc in data.packages) { + if (!seen.has(loc)) { + throw new Error(`missing from node_modules: ${loc}`) + } + } +} + +class Shrinkwrap { + static get defaultLockfileVersion () { + return defaultLockfileVersion + } + + static load (options) { + return new Shrinkwrap(options).load() + } + + static get keyOrder () { + return swKeyOrder + } + + static async reset (options) { + // still need to know if it was loaded from the disk, but don't + // bother reading it if we're gonna just throw it away. + const s = new Shrinkwrap(options) + s.reset() + + const [sw, lock] = await s.resetFiles + + // XXX this is duplicated in this.load(), but using loadFiles instead of resetFiles + if (s.hiddenLockfile) { + s.filename = resolve(s.path, 'node_modules/.package-lock.json') + } else if (s.shrinkwrapOnly || sw) { + s.filename = resolve(s.path, 'npm-shrinkwrap.json') + } else { + s.filename = resolve(s.path, 'package-lock.json') + } + s.loadedFromDisk = !!(sw || lock) + // TODO what uses this? + s.type = basename(s.filename) + + return s + } + + static metaFromNode (node, path, options = {}) { + if (node.isLink) { + return { + resolved: relpath(path, node.realpath), + link: true, + } + } + + const meta = {} + for (const key of pkgMetaKeys) { + const val = metaFieldFromPkg(node.package, key) + if (val) { + meta[key.replace(/^_/, '')] = val + } + } + // we only include name if different from the node path name, and for the + // root to help prevent churn based on the name of the directory the + // project is in + const pname = node.packageName + // when Target package name and Target node share the same name, we include the name, target node should have name as per realpath. + if (pname && (node === node.root || pname !== node.name || nameFromFolder(node.realpath) !== pname)) { + meta.name = pname + } + + if (node.isTop && node.package.devDependencies) { + meta.devDependencies = node.package.devDependencies + } + + for (const key of nodeMetaKeys) { + if (node[key]) { + meta[key] = node[key] + } + } + + const resolved = consistentResolve(node.resolved, node.path, path, true) + // hide resolved from registry dependencies. + if (!resolved) { + // no-op + } else if (node.isRegistryDependency) { + meta.resolved = overrideResolves(resolved, options) + } else { + meta.resolved = resolved + } + + if (node.extraneous) { + meta.extraneous = true + } else { + if (node.peer) { + meta.peer = true + } + if (node.dev) { + meta.dev = true + } + if (node.optional) { + meta.optional = true + } + if (node.devOptional && !node.dev && !node.optional) { + meta.devOptional = true + } + } + return meta + } + + #awaitingUpdate = new Map() + + constructor (options = {}) { + const { + path, + indent = 2, + newline = '\n', + shrinkwrapOnly = false, + hiddenLockfile = false, + lockfileVersion, + resolveOptions = {}, + } = options + + if (hiddenLockfile) { + this.lockfileVersion = 3 + } else if (lockfileVersion) { + this.lockfileVersion = parseInt(lockfileVersion, 10) + } else { + this.lockfileVersion = null + } + + this.tree = null + this.path = resolve(path || '.') + this.filename = null + this.data = null + this.indent = indent + this.newline = newline + this.loadedFromDisk = false + this.type = null + this.yarnLock = null + this.hiddenLockfile = hiddenLockfile + this.loadingError = null + this.resolveOptions = resolveOptions + // only load npm-shrinkwrap.json in dep trees, not package-lock + this.shrinkwrapOnly = shrinkwrapOnly + } + + // check to see if a spec is present in the yarn.lock file, and if so, + // if we should use it, and what it should resolve to. This is only + // done when we did not load a shrinkwrap from disk. Also, decorate + // the options object if provided with the resolved and integrity that + // we expect. + checkYarnLock (spec, options = {}) { + spec = npa(spec) + const { yarnLock, loadedFromDisk } = this + const useYarnLock = yarnLock && !loadedFromDisk + const fromYarn = useYarnLock && yarnLock.entries.get(spec.raw) + if (fromYarn && fromYarn.version) { + // if it's the yarn or npm default registry, use the version as + // our effective spec. if it's any other kind of thing, use that. + const { resolved, version, integrity } = fromYarn + const isYarnReg = spec.registry && yarnRegRe.test(resolved) + const isnpmReg = spec.registry && !isYarnReg && npmRegRe.test(resolved) + const isReg = isnpmReg || isYarnReg + // don't use the simple version if the "registry" url is + // something else entirely! + const tgz = isReg && versionFromTgz(spec.name, resolved) || {} + let yspec = resolved + if (tgz.name === spec.name && tgz.version === version) { + yspec = version + } else if (isReg && tgz.name && tgz.version) { + yspec = `npm:${tgz.name}@${tgz.version}` + } + if (yspec) { + options.resolved = resolved.replace(yarnRegRe, 'https://registry.npmjs.org/') + options.integrity = integrity + return npa(`${spec.name}@${yspec}`) + } + } + return spec + } + + // throw away the shrinkwrap data so we can start fresh + // still worth doing a load() first so we know which files to write. + reset () { + this.tree = null + this.#awaitingUpdate = new Map() + const lockfileVersion = this.lockfileVersion || defaultLockfileVersion + this.originalLockfileVersion = lockfileVersion + + this.data = { + lockfileVersion, + requires: true, + packages: {}, + dependencies: {}, + } + } + + // files to potentially read from and write to, in order of priority + get #filenameSet () { + if (this.shrinkwrapOnly) { + return [`${this.path}/npm-shrinkwrap.json`] + } + if (this.hiddenLockfile) { + return [`${this.path}/node_modules/.package-lock.json`] + } + return [ + `${this.path}/npm-shrinkwrap.json`, + `${this.path}/package-lock.json`, + `${this.path}/yarn.lock`, + ] + } + + get loadFiles () { + return Promise.all( + this.#filenameSet.map(file => file && readFile(file, 'utf8').then(d => d, er => { + /* istanbul ignore else - can't test without breaking module itself */ + if (er.code === 'ENOENT') { + return '' + } else { + throw er + } + })) + ) + } + + get resetFiles () { + // slice out yarn, we only care about lock or shrinkwrap when checking + // this way, since we're not actually loading the full lock metadata + return Promise.all(this.#filenameSet.slice(0, 2) + .map(file => file && stat(file).then(st => st.isFile(), er => { + /* istanbul ignore else - can't test without breaking module itself */ + if (er.code === 'ENOENT') { + return null + } else { + throw er + } + }) + ) + ) + } + + inferFormattingOptions (packageJSONData) { + const { + [Symbol.for('indent')]: indent, + [Symbol.for('newline')]: newline, + } = packageJSONData + if (indent !== undefined) { + this.indent = indent + } + if (newline !== undefined) { + this.newline = newline + } + } + + async load () { + // we don't need to load package-lock.json except for top of tree nodes, + // only npm-shrinkwrap.json. + let data + try { + const [sw, lock, yarn] = await this.loadFiles + data = sw || lock || '{}' + + // use shrinkwrap only for deps, otherwise prefer package-lock + // and ignore npm-shrinkwrap if both are present. + // TODO: emit a warning here or something if both are present. + if (this.hiddenLockfile) { + this.filename = resolve(this.path, 'node_modules/.package-lock.json') + } else if (this.shrinkwrapOnly || sw) { + this.filename = resolve(this.path, 'npm-shrinkwrap.json') + } else { + this.filename = resolve(this.path, 'package-lock.json') + } + this.type = basename(this.filename) + this.loadedFromDisk = Boolean(sw || lock) + + if (yarn) { + this.yarnLock = new YarnLock() + // ignore invalid yarn data. we'll likely clobber it later anyway. + try { + this.yarnLock.parse(yarn) + } catch { + // ignore errors + } + } + + data = parseJSON(data) + this.inferFormattingOptions(data) + + if (this.hiddenLockfile && data.packages) { + // add a few ms just to account for jitter + const lockTime = +(await stat(this.filename)).mtime + 10 + await assertNoNewer(this.path, data, lockTime, this.path, new Set()) + } + + // all good! hidden lockfile is the newest thing in here. + } catch (er) { + /* istanbul ignore else */ + if (typeof this.filename === 'string') { + const rel = relpath(this.path, this.filename) + log.verbose('shrinkwrap', `failed to load ${rel}`, er.message) + } else { + log.verbose('shrinkwrap', `failed to load ${this.path}`, er.message) + } + this.loadingError = er + this.loadedFromDisk = false + this.ancientLockfile = false + data = {} + } + // auto convert v1 lockfiles to v3 + // leave v2 in place unless configured + // v3 by default + let lockfileVersion = defaultLockfileVersion + if (this.lockfileVersion) { + lockfileVersion = this.lockfileVersion + } else if (data.lockfileVersion && data.lockfileVersion !== 1) { + lockfileVersion = data.lockfileVersion + } + + this.data = { + ...data, + lockfileVersion, + requires: true, + packages: data.packages || {}, + dependencies: data.dependencies || {}, + } + + this.originalLockfileVersion = data.lockfileVersion + + // use default if it wasn't explicitly set, and the current file is + // less than our default. otherwise, keep whatever is in the file, + // unless we had an explicit setting already. + if (!this.lockfileVersion) { + this.lockfileVersion = this.data.lockfileVersion = lockfileVersion + } + this.ancientLockfile = this.loadedFromDisk && + !(data.lockfileVersion >= 2) && !data.requires + + // load old lockfile deps into the packages listing + if (data.dependencies && !data.packages) { + let pkg + try { + pkg = await pkgJson.normalize(this.path) + pkg = pkg.content + } catch { + pkg = {} + } + this.#loadAll('', null, this.data) + this.#fixDependencies(pkg) + } + return this + } + + #loadAll (location, name, lock) { + // migrate a v1 package lock to the new format. + const meta = this.#metaFromLock(location, name, lock) + // dependencies nested under a link are actually under the link target + if (meta.link) { + location = meta.resolved + } + if (lock.dependencies) { + for (const name in lock.dependencies) { + const loc = location + (location ? '/' : '') + 'node_modules/' + name + this.#loadAll(loc, name, lock.dependencies[name]) + } + } + } + + // v1 lockfiles track the optional/dev flags, but they don't tell us + // which thing had what kind of dep on what other thing, so we need + // to correct that now, or every link will be considered prod + #fixDependencies (pkg) { + // we need the root package.json because legacy shrinkwraps just + // have requires:true at the root level, which is even less useful + // than merging all dep types into one object. + const root = this.data.packages[''] + for (const key of pkgMetaKeys) { + const val = metaFieldFromPkg(pkg, key) + if (val) { + root[key.replace(/^_/, '')] = val + } + } + + for (const loc in this.data.packages) { + const meta = this.data.packages[loc] + if (!meta.requires || !loc) { + continue + } + + // resolve each require to a meta entry + // if this node isn't optional, but the dep is, then it's an optionalDep + // likewise for dev deps. + // This isn't perfect, but it's a pretty good approximation, and at + // least gets us out of having all 'prod' edges, which throws off the + // buildIdealTree process + for (const name in meta.requires) { + const dep = this.#resolveMetaNode(loc, name) + // this overwrites the false value set above + // default to dependencies if the dep just isn't in the tree, which + // maybe should be an error, since it means that the shrinkwrap is + // invalid, but we can't do much better without any info. + let depType = 'dependencies' + /* istanbul ignore else - dev deps are only for the root level */ + if (dep?.optional && !meta.optional) { + depType = 'optionalDependencies' + } else if (dep?.dev && !meta.dev) { + // XXX is this even reachable? + depType = 'devDependencies' + } + if (!meta[depType]) { + meta[depType] = {} + } + meta[depType][name] = meta.requires[name] + } + delete meta.requires + } + } + + #resolveMetaNode (loc, name) { + for (let path = loc; true; path = path.replace(/(^|\/)[^/]*$/, '')) { + const check = `${path}${path ? '/' : ''}node_modules/${name}` + if (this.data.packages[check]) { + return this.data.packages[check] + } + + if (!path) { + break + } + } + return null + } + + #lockFromLoc (lock, path, i = 0) { + if (!lock) { + return null + } + + if (path[i] === '') { + i++ + } + + if (i >= path.length) { + return lock + } + + if (!lock.dependencies) { + return null + } + + return this.#lockFromLoc(lock.dependencies[path[i]], path, i + 1) + } + + // pass in a path relative to the root path, or an absolute path, + // get back a /-normalized location based on root path. + #pathToLoc (path) { + return relpath(this.path, resolve(this.path, path)) + } + + delete (nodePath) { + if (!this.data) { + throw new Error('run load() before getting or setting data') + } + const location = this.#pathToLoc(nodePath) + this.#awaitingUpdate.delete(location) + + delete this.data.packages[location] + const path = location.split(/(?:^|\/)node_modules\//) + const name = path.pop() + const pLock = this.#lockFromLoc(this.data, path) + if (pLock && pLock.dependencies) { + delete pLock.dependencies[name] + } + } + + get (nodePath) { + if (!this.data) { + throw new Error('run load() before getting or setting data') + } + + const location = this.#pathToLoc(nodePath) + if (this.#awaitingUpdate.has(location)) { + this.#updateWaitingNode(location) + } + + // first try to get from the newer spot, which we know has + // all the things we need. + if (this.data.packages[location]) { + return this.data.packages[location] + } + + // otherwise, fall back to the legacy metadata, and hope for the best + // get the node in the shrinkwrap corresponding to this spot + const path = location.split(/(?:^|\/)node_modules\//) + const name = path[path.length - 1] + const lock = this.#lockFromLoc(this.data, path) + + return this.#metaFromLock(location, name, lock) + } + + #metaFromLock (location, name, lock) { + // This function tries as hard as it can to figure out the metadata + // from a lockfile which may be outdated or incomplete. Since v1 + // lockfiles used the "version" field to contain a variety of + // different possible types of data, this gets a little complicated. + if (!lock) { + return {} + } + + // try to figure out a npm-package-arg spec from the lockfile entry + // This will return null if we could not get anything valid out of it. + const spec = specFromLock(name, lock, this.path) + + if (spec.type === 'directory') { + // the "version" was a file: url to a non-tarball path + // this is a symlink dep. We don't store much metadata + // about symlinks, just the target. + const target = relpath(this.path, spec.fetchSpec) + this.data.packages[location] = { + link: true, + resolved: target, + } + // also save the link target, omitting version since we don't know + // what it is, but we know it isn't a link to itself! + if (!this.data.packages[target]) { + this.#metaFromLock(target, name, { ...lock, version: null }) + } + return this.data.packages[location] + } + + const meta = {} + // when calling loadAll we'll change these into proper dep objects + if (lock.requires && typeof lock.requires === 'object') { + meta.requires = lock.requires + } + + if (lock.optional) { + meta.optional = true + } + if (lock.dev) { + meta.dev = true + } + + // the root will typically have a name from the root project's + // package.json file. + if (location === '') { + meta.name = lock.name + } + + // if we have integrity, save it now. + if (lock.integrity) { + meta.integrity = lock.integrity + } + + if (lock.version && !lock.integrity) { + // this is usually going to be a git url or symlink, but it could + // also be a registry dependency that did not have integrity at + // the time it was saved. + // Symlinks were already handled above, so that leaves git. + // + // For git, always save the full SSH url. we'll actually fetch the + // tgz most of the time, since it's faster, but it won't work for + // private repos, and we can't get back to the ssh from the tgz, + // so we store the ssh instead. + // For unknown git hosts, just resolve to the raw spec in lock.version + if (spec.type === 'git') { + meta.resolved = consistentResolve(spec, this.path, this.path) + + // return early because there is nothing else we can do with this + return this.data.packages[location] = meta + } else if (spec.registry) { + // registry dep that didn't save integrity. grab the version, and + // fall through to pick up the resolved and potentially name. + meta.version = lock.version + } + // only other possible case is a tarball without integrity. + // fall through to do what we can with the filename later. + } + + // at this point, we know that the spec is either a registry dep + // (ie, version, because locking, which means a resolved url), + // or a remote dep, or file: url. Remote deps and file urls + // have a fetchSpec equal to the fully resolved thing. + // Registry deps, we take what's in the lockfile. + if (lock.resolved || (spec.type && !spec.registry)) { + if (spec.registry) { + meta.resolved = lock.resolved + } else if (spec.type === 'file') { + meta.resolved = consistentResolve(spec, this.path, this.path, true) + } else if (spec.fetchSpec) { + meta.resolved = spec.fetchSpec + } + } + + // at this point, if still we don't have a version, do our best to + // infer it from the tarball url/file. This works a surprising + // amount of the time, even though it's not guaranteed. + if (!meta.version) { + if (spec.type === 'file' || spec.type === 'remote') { + const fromTgz = versionFromTgz(spec.name, spec.fetchSpec) || + versionFromTgz(spec.name, meta.resolved) + if (fromTgz) { + meta.version = fromTgz.version + if (fromTgz.name !== name) { + meta.name = fromTgz.name + } + } + } else if (spec.type === 'alias') { + meta.name = spec.subSpec.name + meta.version = spec.subSpec.fetchSpec + } else if (spec.type === 'version') { + meta.version = spec.fetchSpec + } + // ok, I did my best! good luck! + } + + if (lock.bundled) { + meta.inBundle = true + } + + // save it for next time + return this.data.packages[location] = meta + } + + add (node) { + if (!this.data) { + throw new Error('run load() before getting or setting data') + } + + // will be actually updated on read + const loc = relpath(this.path, node.path) + if (node.path === this.path) { + this.tree = node + } + + // if we have metadata about this node, and it's a match, then + // try to decorate it. + if (node.resolved === null || node.integrity === null) { + const { + resolved, + integrity, + hasShrinkwrap, + version, + } = this.get(node.path) + + let pathFixed = null + if (resolved) { + if (!/^file:/.test(resolved)) { + pathFixed = resolved + } else { + pathFixed = `file:${resolve(this.path, resolved.slice(5)).replace(/#/g, '%23')}` + } + } + + // if we have one, only set the other if it matches + // otherwise it could be for a completely different thing. + const resolvedOk = !resolved || !node.resolved || + node.resolved === pathFixed + const integrityOk = !integrity || !node.integrity || + node.integrity === integrity + const versionOk = !version || !node.version || version === node.version + + const allOk = (resolved || integrity || version) && + resolvedOk && integrityOk && versionOk + + if (allOk) { + node.resolved = node.resolved || pathFixed || null + node.integrity = node.integrity || integrity || null + node.hasShrinkwrap = node.hasShrinkwrap || hasShrinkwrap || false + } else { + // try to read off the package or node itself + const { + resolved, + integrity, + hasShrinkwrap, + } = Shrinkwrap.metaFromNode(node, this.path, this.resolveOptions) + node.resolved = node.resolved || resolved || null + node.integrity = node.integrity || integrity || null + node.hasShrinkwrap = node.hasShrinkwrap || hasShrinkwrap || false + } + } + this.#awaitingUpdate.set(loc, node) + } + + addEdge (edge) { + if (!this.yarnLock || !edge.valid) { + return + } + + const { to: node } = edge + + // if it's already set up, nothing to do + if (node.resolved !== null && node.integrity !== null) { + return + } + + // if the yarn lock is empty, nothing to do + if (!this.yarnLock.entries || !this.yarnLock.entries.size) { + return + } + + // we relativize the path here because that's how it shows up in the lock + // XXX why is this different from pathFixed in this.add?? + let pathFixed = null + if (node.resolved) { + if (!/file:/.test(node.resolved)) { + pathFixed = node.resolved + } else { + pathFixed = consistentResolve(node.resolved, node.path, this.path, true) + } + } + + const spec = npa(`${node.name}@${edge.spec}`) + const entry = this.yarnLock.entries.get(`${node.name}@${edge.spec}`) + + if (!entry || + mismatch(node.version, entry.version) || + mismatch(node.integrity, entry.integrity) || + mismatch(pathFixed, entry.resolved)) { + return + } + + if (entry.resolved && yarnRegRe.test(entry.resolved) && spec.registry) { + entry.resolved = entry.resolved.replace(yarnRegRe, 'https://registry.npmjs.org/') + } + + node.integrity = node.integrity || entry.integrity || null + node.resolved = node.resolved || + consistentResolve(entry.resolved, this.path, node.path) || null + + this.#awaitingUpdate.set(relpath(this.path, node.path), node) + } + + #updateWaitingNode (loc) { + const node = this.#awaitingUpdate.get(loc) + this.#awaitingUpdate.delete(loc) + this.data.packages[loc] = Shrinkwrap.metaFromNode( + node, + this.path, + this.resolveOptions) + } + + commit () { + if (this.tree) { + if (this.yarnLock) { + this.yarnLock.fromTree(this.tree) + } + const root = Shrinkwrap.metaFromNode( + this.tree.target, + this.path, + this.resolveOptions) + this.data.packages = {} + if (Object.keys(root).length) { + this.data.packages[''] = root + } + for (const node of this.tree.root.inventory.values()) { + // only way this.tree is not root is if the root is a link to it + if (node === this.tree || node.isRoot || node.location === '') { + continue + } + const loc = relpath(this.path, node.path) + this.data.packages[loc] = Shrinkwrap.metaFromNode( + node, + this.path, + this.resolveOptions) + } + } else if (this.#awaitingUpdate.size > 0) { + for (const loc of this.#awaitingUpdate.keys()) { + this.#updateWaitingNode(loc) + } + } + + // if we haven't set it by now, use the default + if (!this.lockfileVersion) { + this.lockfileVersion = defaultLockfileVersion + } + this.data.lockfileVersion = this.lockfileVersion + + // hidden lockfiles don't include legacy metadata or a root entry + if (this.hiddenLockfile) { + delete this.data.packages[''] + delete this.data.dependencies + } else if (this.tree && this.lockfileVersion <= 3) { + this.#buildLegacyLockfile(this.tree, this.data) + } + + // lf version 1 = dependencies only + // lf version 2 = dependencies and packages + // lf version 3 = packages only + if (this.lockfileVersion >= 3) { + const { dependencies, ...data } = this.data + return data + } else if (this.lockfileVersion < 2) { + const { packages, ...data } = this.data + return data + } else { + return { ...this.data } + } + } + + #buildLegacyLockfile (node, lock, path = []) { + if (node === this.tree) { + // the root node + lock.name = node.packageName || node.name + if (node.version) { + lock.version = node.version + } + } + + // npm v6 and before tracked 'from', meaning "the request that led + // to this package being installed". However, that's inherently + // racey and non-deterministic in a world where deps are deduped + // ahead of fetch time. In order to maintain backwards compatibility + // with v6 in the lockfile, we do this trick where we pick a valid + // dep link out of the edgesIn set. Choose the edge with the fewest + // number of `node_modules` sections in the requestor path, and then + // lexically sort afterwards. + const edge = [...node.edgesIn].filter(e => e.valid).sort((a, b) => { + const aloc = a.from.location.split('node_modules') + const bloc = b.from.location.split('node_modules') + /* istanbul ignore next - sort calling order is indeterminate */ + if (aloc.length > bloc.length) { + return 1 + } + if (bloc.length > aloc.length) { + return -1 + } + return localeCompare(aloc[aloc.length - 1], bloc[bloc.length - 1]) + })[0] + + const res = consistentResolve(node.resolved, this.path, this.path, true) + const rSpec = specFromResolved(res) + + // if we don't have anything (ie, it's extraneous) then use the resolved + // value as if that was where we got it from, since at least it's true. + // if we don't have either, just an empty object so nothing matches below. + // This will effectively just save the version and resolved, as if it's + // a standard version/range dep, which is a reasonable default. + let spec = rSpec + if (edge) { + spec = npa.resolve(node.name, edge.spec, edge.from.realpath) + } + + if (node.isLink) { + lock.version = `file:${relpath(this.path, node.realpath).replace(/#/g, '%23')}` + } else if (spec && (spec.type === 'file' || spec.type === 'remote')) { + lock.version = spec.saveSpec + } else if (spec && spec.type === 'git' || rSpec.type === 'git') { + lock.version = node.resolved + /* istanbul ignore else - don't think there are any cases where a git + * spec (or indeed, ANY npa spec) doesn't have a .raw member */ + if (spec.raw) { + lock.from = spec.raw + } + } else if (!node.isRoot && + node.package && + node.packageName && + node.packageName !== node.name) { + lock.version = `npm:${node.packageName}@${node.version}` + } else if (node.package && node.version) { + lock.version = node.version + } + + if (node.inDepBundle) { + lock.bundled = true + } + + // when we didn't resolve to git, file, or dir, and didn't request + // git, file, dir, or remote, then the resolved value is necessary. + if (node.resolved && + !node.isLink && + rSpec.type !== 'git' && + rSpec.type !== 'file' && + rSpec.type !== 'directory' && + spec.type !== 'directory' && + spec.type !== 'git' && + spec.type !== 'file' && + spec.type !== 'remote') { + lock.resolved = overrideResolves(node.resolved, this.resolveOptions) + } + + if (node.integrity) { + lock.integrity = node.integrity + } + + if (node.extraneous) { + lock.extraneous = true + } else if (!node.isLink) { + if (node.peer) { + lock.peer = true + } + + if (node.devOptional && !node.dev && !node.optional) { + lock.devOptional = true + } + + if (node.dev) { + lock.dev = true + } + + if (node.optional) { + lock.optional = true + } + } + + const depender = node.target + if (depender.edgesOut.size > 0) { + if (node !== this.tree) { + const entries = [...depender.edgesOut.entries()] + lock.requires = entries.reduce((set, [k, v]) => { + // omit peer deps from legacy lockfile requires field, because + // npm v6 doesn't handle peer deps, and this triggers some bad + // behavior if the dep can't be found in the dependencies list. + const { spec, peer } = v + if (peer) { + return set + } + if (spec.startsWith('file:')) { + // turn absolute file: paths into relative paths from the node + // this especially shows up with workspace edges when the root + // node is also a workspace in the set. + const p = resolve(node.realpath, spec.slice('file:'.length)) + set[k] = `file:${relpath(node.realpath, p).replace(/#/g, '%23')}` + } else { + set[k] = spec + } + return set + }, {}) + } else { + lock.requires = true + } + } + + // now we walk the children, putting them in the 'dependencies' object + const { children } = node.target + if (!children.size) { + delete lock.dependencies + } else { + const kidPath = [...path, node.realpath] + const dependencies = {} + // skip any that are already in the descent path, so cyclical link + // dependencies don't blow up with ELOOP. + let found = false + for (const [name, kid] of children.entries()) { + if (path.includes(kid.realpath)) { + continue + } + dependencies[name] = this.#buildLegacyLockfile(kid, {}, kidPath) + found = true + } + if (found) { + lock.dependencies = dependencies + } + } + return lock + } + + toJSON () { + if (!this.data) { + throw new Error('run load() before getting or setting data') + } + + return this.commit() + } + + toString (options = {}) { + const data = this.toJSON() + const { format = true } = options + const defaultIndent = this.indent || 2 + const indent = format === true ? defaultIndent + : format || 0 + const eol = format ? this.newline || '\n' : '' + return stringify(data, swKeyOrder, indent).replace(/\n/g, eol) + } + + save (options = {}) { + if (!this.data) { + throw new Error('run load() before saving data') + } + + // This must be called before the lockfile conversion check below since it sets properties as part of `commit()` + const json = this.toString(options) + if ( + !this.hiddenLockfile + && this.originalLockfileVersion !== undefined + && this.originalLockfileVersion !== this.lockfileVersion + ) { + log.warn( + 'shrinkwrap', + `Converting lock file (${relative(process.cwd(), this.filename)}) from v${this.originalLockfileVersion} -> v${this.lockfileVersion}` + ) + } + + return Promise.all([ + writeFile(this.filename, json).catch(er => { + if (this.hiddenLockfile) { + // well, we did our best. + // if we reify, and there's nothing there, then it might be lacking + // a node_modules folder, but then the lockfile is not important. + // Remove the file, so that in case there WERE deps, but we just + // failed to update the file for some reason, it's not out of sync. + return rm(this.filename, { recursive: true, force: true }) + } + throw er + }), + this.yarnLock && this.yarnLock.entries.size && + writeFile(this.path + '/yarn.lock', this.yarnLock.toString()), + ]) + } +} + +module.exports = Shrinkwrap diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/signal-handling.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/signal-handling.js new file mode 100644 index 00000000..18841d94 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/signal-handling.js @@ -0,0 +1,74 @@ +const signals = require('./signals.js') + +// for testing, expose the process being used +module.exports = Object.assign(fn => setup(fn), { process }) + +// do all of this in a setup function so that we can call it +// multiple times for multiple reifies that might be going on. +// Otherwise, Arborist.reify() is a global action, which is a +// new constraint we'd be adding with this behavior. +const setup = fn => { + const { process } = module.exports + + const sigListeners = { loaded: false } + + const unload = () => { + if (!sigListeners.loaded) { + return + } + for (const sig of signals) { + try { + process.removeListener(sig, sigListeners[sig]) + } catch { + // ignore errors + } + } + process.removeListener('beforeExit', onBeforeExit) + sigListeners.loaded = false + } + + const onBeforeExit = () => { + // this trick ensures that we exit with the same signal we caught + // Ie, if you press ^C and npm gets a SIGINT, we'll do the rollback + // and then exit with a SIGINT signal once we've removed the handler. + // The timeout is there because signals are asynchronous, so we need + // the process to NOT exit on its own, which means we have to have + // something keeping the event loop looping. Hence this hack. + unload() + process.kill(process.pid, signalReceived) + setTimeout(() => {}, 500) + } + + let signalReceived = null + const listener = (sig, fn) => () => { + signalReceived = sig + + // if we exit normally, but caught a signal which would have been fatal, + // then re-send it once we're done with whatever cleanup we have to do. + unload() + if (process.listeners(sig).length < 1) { + process.once('beforeExit', onBeforeExit) + } + + fn({ signal: sig }) + } + + // do the actual loading here + for (const sig of signals) { + sigListeners[sig] = listener(sig, fn) + const max = process.getMaxListeners() + try { + // if we call this a bunch of times, avoid triggering the warning + const { length } = process.listeners(sig) + if (length >= max) { + process.setMaxListeners(length + 1) + } + process.on(sig, sigListeners[sig]) + } catch { + // ignore errors + } + } + sigListeners.loaded = true + + return unload +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/signals.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/signals.js new file mode 100644 index 00000000..8dcd585c --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/signals.js @@ -0,0 +1,58 @@ +// copied from signal-exit + +// 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. + +const platform = global.__ARBORIST_FAKE_PLATFORM__ || process.platform + +module.exports = [ + 'SIGABRT', + 'SIGALRM', + 'SIGHUP', + 'SIGINT', + 'SIGTERM', +] + +if (platform !== 'win32') { + module.exports.push( + 'SIGVTALRM', + 'SIGXCPU', + 'SIGXFSZ', + 'SIGUSR2', + 'SIGTRAP', + 'SIGSYS', + 'SIGQUIT', + 'SIGIOT' + // should detect profiler and enable/disable accordingly. + // see #21 + // 'SIGPROF' + ) +} + +if (platform === 'linux') { + module.exports.push( + 'SIGIO', + 'SIGPOLL', + 'SIGPWR', + 'SIGSTKFLT', + 'SIGUNUSED' + ) +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/spec-from-lock.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/spec-from-lock.js new file mode 100644 index 00000000..49b53c8f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/spec-from-lock.js @@ -0,0 +1,34 @@ +const npa = require('npm-package-arg') + +// extracted from npm v6 lib/install/realize-shrinkwrap-specifier.js +const specFromLock = (name, lock, where) => { + try { + if (lock.version) { + const spec = npa.resolve(name, lock.version, where) + if (lock.integrity || spec.type === 'git') { + return spec + } + } + if (lock.from) { + // legacy metadata includes "from", but not integrity + const spec = npa.resolve(name, lock.from, where) + if (spec.registry && lock.version) { + return npa.resolve(name, lock.version, where) + } else if (!lock.resolved) { + return spec + } + } + if (lock.resolved) { + return npa.resolve(name, lock.resolved, where) + } + } catch { + // ignore errors + } + try { + return npa.resolve(name, lock.version, where) + } catch { + return {} + } +} + +module.exports = specFromLock diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js new file mode 100644 index 00000000..4a754d99 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/tracker.js @@ -0,0 +1,86 @@ +const proggy = require('proggy') + +module.exports = cls => class Tracker extends cls { + #progress = new Map() + + #createTracker (key, name) { + const tracker = new proggy.Tracker(name ?? key) + tracker.on('done', () => this.#progress.delete(key)) + this.#progress.set(key, tracker) + } + + addTracker (section, subsection = null, key = null) { + if (section === null || section === undefined) { + this.#onError(`Tracker can't be null or undefined`) + } + + if (key === null) { + key = subsection + } + + const hasTracker = this.#progress.has(section) + const hasSubtracker = this.#progress.has(`${section}:${key}`) + + if (hasTracker && subsection === null) { + // 0. existing tracker, no subsection + this.#onError(`Tracker "${section}" already exists`) + } else if (!hasTracker && subsection === null) { + // 1. no existing tracker, no subsection + // Create a new progress tracker + this.#createTracker(section) + } else if (!hasTracker && subsection !== null) { + // 2. no parent tracker and subsection + this.#onError(`Parent tracker "${section}" does not exist`) + } else if (!hasTracker || !hasSubtracker) { + // 3. existing parent tracker, no subsection tracker + // Create a new subtracker and update parents + const parentTracker = this.#progress.get(section) + parentTracker.update(parentTracker.value, parentTracker.total + 1) + this.#createTracker(`${section}:${key}`, `${section}:${subsection}`) + } + // 4. existing parent tracker, existing subsection tracker + // skip it + } + + finishTracker (section, subsection = null, key = null) { + if (section === null || section === undefined) { + this.#onError(`Tracker can't be null or undefined`) + } + + if (key === null) { + key = subsection + } + + const hasTracker = this.#progress.has(section) + const hasSubtracker = this.#progress.has(`${section}:${key}`) + + // 0. parent tracker exists, no subsection + // Finish parent tracker and remove from this.#progress + if (hasTracker && subsection === null) { + // check if parent tracker does + // not have any remaining children + const keys = this.#progress.keys() + for (const key of keys) { + if (key.match(new RegExp(section + ':'))) { + this.finishTracker(section, key) + } + } + // remove parent tracker + this.#progress.get(section).finish() + } else if (!hasTracker && subsection === null) { + // 1. no existing parent tracker, no subsection + this.#onError(`Tracker "${section}" does not exist`) + } else if (!hasTracker || hasSubtracker) { + // 2. subtracker exists + // Finish subtracker and remove from this.#progress + const parentTracker = this.#progress.get(section) + parentTracker.update(parentTracker.value + 1) + this.#progress.get(`${section}:${key}`).finish() + } + // 3. existing parent tracker, no subsection + } + + #onError (msg) { + throw new Error(msg) + } +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/tree-check.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/tree-check.js new file mode 100644 index 00000000..62a50bc7 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/tree-check.js @@ -0,0 +1,155 @@ +const debug = require('./debug.js') + +const checkTree = (tree, checkUnreachable = true) => { + const log = [['START TREE CHECK', tree.path]] + + // this can only happen in tests where we have a "tree" object + // that isn't actually a tree. + if (!tree.root || !tree.root.inventory) { + return tree + } + + const { inventory } = tree.root + const seen = new Set() + const check = (node, via = tree, viaType = 'self') => { + log.push([ + 'CHECK', + node && node.location, + via && via.location, + viaType, + 'seen=' + seen.has(node), + 'promise=' + !!(node && node.then), + 'root=' + !!(node && node.isRoot), + ]) + + if (!node || seen.has(node) || node.then) { + return + } + + seen.add(node) + + if (node.isRoot && node !== tree.root) { + throw Object.assign(new Error('double root'), { + node: node.path, + realpath: node.realpath, + tree: tree.path, + root: tree.root.path, + via: via.path, + viaType, + log, + }) + } + + if (node.root !== tree.root) { + throw Object.assign(new Error('node from other root in tree'), { + node: node.path, + realpath: node.realpath, + tree: tree.path, + root: tree.root.path, + via: via.path, + viaType, + otherRoot: node.root && node.root.path, + log, + }) + } + + if (!node.isRoot && node.inventory.size !== 0) { + throw Object.assign(new Error('non-root has non-zero inventory'), { + node: node.path, + tree: tree.path, + root: tree.root.path, + via: via.path, + viaType, + inventory: [...node.inventory.values()].map(node => + [node.path, node.location]), + log, + }) + } + + if (!node.isRoot && !inventory.has(node) && !node.dummy) { + throw Object.assign(new Error('not in inventory'), { + node: node.path, + tree: tree.path, + root: tree.root.path, + via: via.path, + viaType, + log, + }) + } + + const devEdges = [...node.edgesOut.values()].filter(e => e.dev) + if (!node.isTop && devEdges.length) { + throw Object.assign(new Error('dev edges on non-top node'), { + node: node.path, + tree: tree.path, + root: tree.root.path, + via: via.path, + viaType, + devEdges: devEdges.map(e => [e.type, e.name, e.spec, e.error]), + log, + }) + } + + if (node.path === tree.root.path && node !== tree.root && !tree.root.isLink) { + throw Object.assign(new Error('node with same path as root'), { + node: node.path, + tree: tree.path, + root: tree.root.path, + via: via.path, + viaType, + log, + }) + } + + if (!node.isLink && node.path !== node.realpath) { + throw Object.assign(new Error('non-link with mismatched path/realpath'), { + node: node.path, + tree: tree.path, + realpath: node.realpath, + root: tree.root.path, + via: via.path, + viaType, + log, + }) + } + + const { parent, fsParent, target } = node + check(parent, node, 'parent') + check(fsParent, node, 'fsParent') + check(target, node, 'target') + log.push(['CHILDREN', node.location, ...node.children.keys()]) + for (const kid of node.children.values()) { + check(kid, node, 'children') + } + for (const kid of node.fsChildren) { + check(kid, node, 'fsChildren') + } + for (const link of node.linksIn) { + check(link, node, 'linksIn') + } + for (const top of node.tops) { + check(top, node, 'tops') + } + log.push(['DONE', node.location]) + } + check(tree) + if (checkUnreachable) { + for (const node of inventory.values()) { + if (!seen.has(node) && node !== tree.root) { + throw Object.assign(new Error('unreachable in inventory'), { + node: node.path, + realpath: node.realpath, + location: node.location, + root: tree.root.path, + tree: tree.path, + log, + }) + } + } + } + return tree +} + +// should only ever run this check in debug mode +module.exports = tree => tree +debug(() => module.exports = checkTree) diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js new file mode 100644 index 00000000..77e3956c --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/version-from-tgz.js @@ -0,0 +1,47 @@ +const semver = require('semver') +const { basename } = require('node:path') +const { URL } = require('node:url') +module.exports = (name, tgz) => { + const base = basename(tgz) + if (!base.endsWith('.tgz')) { + return null + } + + if (tgz.startsWith('http:/') || tgz.startsWith('https:/')) { + const u = new URL(tgz) + // registry url? check for most likely pattern. + // either /@foo/bar/-/bar-1.2.3.tgz or + // /foo/-/foo-1.2.3.tgz, and fall through to + // basename checking. Note that registries can + // be mounted below the root url, so /a/b/-/x/y/foo/-/foo-1.2.3.tgz + // is a potential option. + const tfsplit = u.pathname.slice(1).split('/-/') + if (tfsplit.length > 1) { + const afterTF = tfsplit.pop() + if (afterTF === base) { + const pre = tfsplit.pop() + const preSplit = pre.split(/\/|%2f/i) + const project = preSplit.pop() + const scope = preSplit.pop() + return versionFromBaseScopeName(base, scope, project) + } + } + } + + const split = name.split(/\/|%2f/i) + const project = split.pop() + const scope = split.pop() + return versionFromBaseScopeName(base, scope, project) +} + +const versionFromBaseScopeName = (base, scope, name) => { + if (!base.startsWith(name + '-')) { + return null + } + + const parsed = semver.parse(base.substring(name.length + 1, base.length - 4)) + return parsed ? { + name: scope && scope.charAt(0) === '@' ? `${scope}/${name}` : name, + version: parsed.version, + } : null +} diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/vuln.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/vuln.js new file mode 100644 index 00000000..2bffe54f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/vuln.js @@ -0,0 +1,214 @@ +// An object representing a vulnerability either as the result of an +// advisory or due to the package in question depending exclusively on +// vulnerable versions of a dep. +// +// - name: package name +// - range: Set of vulnerable versions +// - nodes: Set of nodes affected +// - effects: Set of vulns triggered by this one +// - advisories: Set of advisories (including metavulns) causing this vuln. +// All of the entries in via are vulnerability objects returned by +// @npmcli/metavuln-calculator +// - via: dependency vulns which cause this one + +const { satisfies, simplifyRange } = require('semver') +const semverOpt = { loose: true, includePrerelease: true } + +const localeCompare = require('@isaacs/string-locale-compare')('en') +const npa = require('npm-package-arg') + +const severities = new Map([ + ['info', 0], [0, 'info'], + ['low', 1], [1, 'low'], + ['moderate', 2], [2, 'moderate'], + ['high', 3], [3, 'high'], + ['critical', 4], [4, 'critical'], + [null, -1], [-1, null], +]) + +class Vuln { + #range = null + #simpleRange = null + // assume a fix is available unless it hits a top node + // that locks it in place, setting this false or {isSemVerMajor, version}. + #fixAvailable = true + + constructor ({ name, advisory }) { + this.name = name + this.via = new Set() + this.advisories = new Set() + this.severity = null + this.effects = new Set() + this.topNodes = new Set() + this.nodes = new Set() + this.addAdvisory(advisory) + this.packument = advisory.packument + this.versions = advisory.versions + } + + get fixAvailable () { + return this.#fixAvailable + } + + set fixAvailable (f) { + this.#fixAvailable = f + // if there's a fix available for this at the top level, it means that + // it will also fix the vulns that led to it being there. to get there, + // we set the vias to the most "strict" of fix availables. + // - false: no fix is available + // - {name, version, isSemVerMajor} fix requires -f, is semver major + // - {name, version} fix requires -f, not semver major + // - true: fix does not require -f + // TODO: duped entries may require different fixes but the current + // structure does not support this, so the case were a top level fix + // corrects a duped entry may mean you have to run fix more than once + for (const v of this.via) { + // don't blow up on loops + if (v.fixAvailable === f) { + continue + } + + if (f === false) { + v.fixAvailable = f + } else if (v.fixAvailable === true) { + v.fixAvailable = f + } else if (typeof f === 'object' && ( + typeof v.fixAvailable !== 'object' || !v.fixAvailable.isSemVerMajor)) { + v.fixAvailable = f + } + } + } + + get isDirect () { + for (const node of this.nodes.values()) { + for (const edge of node.edgesIn) { + if (edge.from.isProjectRoot || edge.from.isWorkspace) { + return true + } + } + } + return false + } + + testSpec (spec) { + const specObj = npa(spec) + if (!specObj.registry) { + return true + } + + if (specObj.subSpec) { + spec = specObj.subSpec.rawSpec + } + + for (const v of this.versions) { + if (satisfies(v, spec) && !satisfies(v, this.range, semverOpt)) { + return false + } + } + return true + } + + toJSON () { + return { + name: this.name, + severity: this.severity, + isDirect: this.isDirect, + // just loop over the advisories, since via is only Vuln objects, + // and calculated advisories have all the info we need + via: [...this.advisories].map(v => v.type === 'metavuln' ? v.dependency : { + ...v, + versions: undefined, + vulnerableVersions: undefined, + id: undefined, + }).sort((a, b) => + localeCompare(String(a.source || a), String(b.source || b))), + effects: [...this.effects].map(v => v.name).sort(localeCompare), + range: this.simpleRange, + nodes: [...this.nodes].map(n => n.location).sort(localeCompare), + fixAvailable: this.#fixAvailable, + } + } + + addVia (v) { + this.via.add(v) + v.effects.add(this) + // call the setter since we might add vias _after_ setting fixAvailable + this.fixAvailable = this.fixAvailable + } + + deleteVia (v) { + this.via.delete(v) + v.effects.delete(this) + } + + deleteAdvisory (advisory) { + this.advisories.delete(advisory) + // make sure we have the max severity of all the vulns causing this one + this.severity = null + this.#range = null + this.#simpleRange = null + // refresh severity + for (const advisory of this.advisories) { + this.addAdvisory(advisory) + } + + // remove any effects that are no longer relevant + const vias = new Set([...this.advisories].map(a => a.dependency)) + for (const via of this.via) { + if (!vias.has(via.name)) { + this.deleteVia(via) + } + } + } + + addAdvisory (advisory) { + this.advisories.add(advisory) + const sev = severities.get(advisory.severity) + this.#range = null + this.#simpleRange = null + if (sev > severities.get(this.severity)) { + this.severity = advisory.severity + } + } + + get range () { + if (!this.#range) { + this.#range = [...this.advisories].map(v => v.range).join(' || ') + } + return this.#range + } + + get simpleRange () { + if (this.#simpleRange && this.#simpleRange === this.#range) { + return this.#simpleRange + } + + const versions = [...this.advisories][0].versions + const range = this.range + this.#simpleRange = simplifyRange(versions, range, semverOpt) + this.#range = this.#simpleRange + return this.#simpleRange + } + + isVulnerable (node) { + if (this.nodes.has(node)) { + return true + } + + const { version } = node.package + if (!version) { + return false + } + + for (const v of this.advisories) { + if (v.testVersion(version)) { + this.nodes.add(node) + return true + } + } + + return false + } +} + +module.exports = Vuln diff --git a/node_modules/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js b/node_modules/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js new file mode 100644 index 00000000..fc628065 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js @@ -0,0 +1,377 @@ +// parse a yarn lock file +// basic format +// +// [, ...]: +// +// : +// +// +// Assume that any key or value might be quoted, though that's only done +// in practice if certain chars are in the string. When writing back, we follow +// Yarn's rules for quoting, to cause minimal friction. +// +// The data format would support nested objects, but at this time, it +// appears that yarn does not use that for anything, so in the interest +// of a simpler parser algorithm, this implementation only supports a +// single layer of sub objects. +// +// This doesn't deterministically define the shape of the tree, and so +// cannot be used (on its own) for Arborist.loadVirtual. +// But it can give us resolved, integrity, and version, which is useful +// for Arborist.loadActual and for building the ideal tree. +// +// At the very least, when a yarn.lock file is present, we update it +// along the way, and save it back in Shrinkwrap.save() +// +// NIHing this rather than using @yarnpkg/lockfile because that module +// is an impenetrable 10kloc of webpack flow output, which is overkill +// for something relatively simple and tailored to Arborist's use case. + +const localeCompare = require('@isaacs/string-locale-compare')('en') +const consistentResolve = require('./consistent-resolve.js') +const { dirname } = require('node:path') +const { breadth } = require('treeverse') + +// Sort Yarn entries respecting the yarn.lock sort order +const yarnEntryPriorities = { + name: 1, + version: 2, + uid: 3, + resolved: 4, + integrity: 5, + registry: 6, + dependencies: 7, +} + +const priorityThenLocaleCompare = (a, b) => { + if (!yarnEntryPriorities[a] && !yarnEntryPriorities[b]) { + return localeCompare(a, b) + } + /* istanbul ignore next */ + return (yarnEntryPriorities[a] || 100) > (yarnEntryPriorities[b] || 100) ? 1 : -1 +} + +const quoteIfNeeded = val => { + if ( + typeof val === 'boolean' || + typeof val === 'number' || + val.startsWith('true') || + val.startsWith('false') || + /[:\s\n\\",[\]]/g.test(val) || + !/^[a-zA-Z]/g.test(val) + ) { + return JSON.stringify(val) + } + + return val +} + +// sort a key/value object into a string of JSON stringified keys and vals +const sortKV = obj => Object.keys(obj) + .sort(localeCompare) + .map(k => ` ${quoteIfNeeded(k)} ${quoteIfNeeded(obj[k])}`) + .join('\n') + +// for checking against previous entries +const match = (p, n) => + p.integrity && n.integrity ? p.integrity === n.integrity + : p.resolved && n.resolved ? p.resolved === n.resolved + : p.version && n.version ? p.version === n.version + : true + +const prefix = +`# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +` + +const nullSymbol = Symbol('null') +class YarnLock { + static parse (data) { + return new YarnLock().parse(data) + } + + static fromTree (tree) { + return new YarnLock().fromTree(tree) + } + + constructor () { + this.entries = null + this.endCurrent() + } + + endCurrent () { + this.current = null + this.subkey = nullSymbol + } + + parse (data) { + const ENTRY_START = /^[^\s].*:$/ + const SUBKEY = /^ {2}[^\s]+:$/ + const SUBVAL = /^ {4}[^\s]+ .+$/ + const METADATA = /^ {2}[^\s]+ .+$/ + this.entries = new Map() + this.current = null + const linere = /([^\r\n]*)\r?\n/gm + let match + let lineNum = 0 + if (!/\n$/.test(data)) { + data += '\n' + } + while (match = linere.exec(data)) { + const line = match[1] + lineNum++ + if (line.charAt(0) === '#') { + continue + } + if (line === '') { + this.endCurrent() + continue + } + if (ENTRY_START.test(line)) { + this.endCurrent() + const specs = this.splitQuoted(line.slice(0, -1), /, */) + this.current = new YarnLockEntry(specs) + specs.forEach(spec => this.entries.set(spec, this.current)) + continue + } + if (SUBKEY.test(line)) { + this.subkey = line.slice(2, -1) + this.current[this.subkey] = {} + continue + } + if (SUBVAL.test(line) && this.current && this.current[this.subkey]) { + const subval = this.splitQuoted(line.trimLeft(), ' ') + if (subval.length === 2) { + this.current[this.subkey][subval[0]] = subval[1] + continue + } + } + // any other metadata + if (METADATA.test(line) && this.current) { + const metadata = this.splitQuoted(line.trimLeft(), ' ') + if (metadata.length === 2) { + // strip off the legacy shasum hashes + if (metadata[0] === 'resolved') { + metadata[1] = metadata[1].replace(/#.*/, '') + } + this.current[metadata[0]] = metadata[1] + continue + } + } + + throw Object.assign(new Error('invalid or corrupted yarn.lock file'), { + position: match.index, + content: match[0], + line: lineNum, + }) + } + this.endCurrent() + return this + } + + splitQuoted (str, delim) { + // a,"b,c",d"e,f => ['a','"b','c"','d"e','f'] => ['a','b,c','d"e','f'] + const split = str.split(delim) + const out = [] + let o = 0 + for (let i = 0; i < split.length; i++) { + const chunk = split[i] + if (/^".*"$/.test(chunk)) { + out[o++] = chunk.trim().slice(1, -1) + } else if (/^"/.test(chunk)) { + let collect = chunk.trimLeft().slice(1) + while (++i < split.length) { + const n = split[i] + // something that is not a slash, followed by an even number + // of slashes then a " then end => ending on an unescaped " + if (/[^\\](\\\\)*"$/.test(n)) { + collect += n.trimRight().slice(0, -1) + break + } else { + collect += n + } + } + out[o++] = collect + } else { + out[o++] = chunk.trim() + } + } + return out + } + + toString () { + return prefix + [...new Set([...this.entries.values()])] + .map(e => e.toString()) + .sort((a, b) => localeCompare(a.replace(/"/g, ''), b.replace(/"/g, ''))).join('\n\n') + '\n' + } + + fromTree (tree) { + this.entries = new Map() + // walk the tree in a deterministic order, breadth-first, alphabetical + breadth({ + tree, + visit: node => this.addEntryFromNode(node), + getChildren: node => [...node.children.values(), ...node.fsChildren] + .sort((a, b) => a.depth - b.depth || localeCompare(a.name, b.name)), + }) + return this + } + + addEntryFromNode (node) { + const specs = [...node.edgesIn] + .map(e => `${node.name}@${e.spec}`) + .sort(localeCompare) + + // Note: + // yarn will do excessive duplication in a case like this: + // root -> (x@1.x, y@1.x, z@1.x) + // y@1.x -> (x@1.1, z@2.x) + // z@1.x -> () + // z@2.x -> (x@1.x) + // + // where x@1.2 exists, because the "x@1.x" spec will *always* resolve + // to x@1.2, which doesn't work for y's dep on x@1.1, so you'll get this: + // + // root + // +-- x@1.2.0 + // +-- y + // | +-- x@1.1.0 + // | +-- z@2 + // | +-- x@1.2.0 + // +-- z@1 + // + // instead of this more deduped tree that arborist builds by default: + // + // root + // +-- x@1.2.0 (dep is x@1.x, from root) + // +-- y + // | +-- x@1.1.0 + // | +-- z@2 (dep on x@1.x deduped to x@1.1.0 under y) + // +-- z@1 + // + // In order to not create an invalid yarn.lock file with conflicting + // entries, AND not tell yarn to create an invalid tree, we need to + // ignore the x@1.x spec coming from z, since it's already in the entries. + // + // So, if the integrity and resolved don't match a previous entry, skip it. + // We call this method on shallower nodes first, so this is fine. + const n = this.entryDataFromNode(node) + let priorEntry = null + const newSpecs = [] + for (const s of specs) { + const prev = this.entries.get(s) + // no previous entry for this spec at all, so it's new + if (!prev) { + // if we saw a match already, then assign this spec to it as well + if (priorEntry) { + priorEntry.addSpec(s) + } else { + newSpecs.push(s) + } + continue + } + + const m = match(prev, n) + // there was a prior entry, but a different thing. skip this one + if (!m) { + continue + } + + // previous matches, but first time seeing it, so already has this spec. + // go ahead and add all the previously unseen specs, though + if (!priorEntry) { + priorEntry = prev + for (const s of newSpecs) { + priorEntry.addSpec(s) + this.entries.set(s, priorEntry) + } + newSpecs.length = 0 + continue + } + + // have a prior entry matching n, and matching the prev we just saw + // add the spec to it + priorEntry.addSpec(s) + this.entries.set(s, priorEntry) + } + + // if we never found a matching prior, then this is a whole new thing + if (!priorEntry) { + const entry = Object.assign(new YarnLockEntry(newSpecs), n) + for (const s of newSpecs) { + this.entries.set(s, entry) + } + } else { + // pick up any new info that we got for this node, so that we can + // decorate with integrity/resolved/etc. + Object.assign(priorEntry, n) + } + } + + entryDataFromNode (node) { + const n = {} + if (node.package.dependencies) { + n.dependencies = node.package.dependencies + } + if (node.package.optionalDependencies) { + n.optionalDependencies = node.package.optionalDependencies + } + if (node.version) { + n.version = node.version + } + if (node.resolved) { + n.resolved = consistentResolve( + node.resolved, + node.isLink ? dirname(node.path) : node.path, + node.root.path, + true + ) + } + if (node.integrity) { + n.integrity = node.integrity + } + + return n + } + + static get Entry () { + return YarnLockEntry + } +} + +class YarnLockEntry { + #specs + constructor (specs) { + this.#specs = new Set(specs) + this.resolved = null + this.version = null + this.integrity = null + this.dependencies = null + this.optionalDependencies = null + } + + toString () { + // sort objects to the bottom, then alphabetical + return ([...this.#specs] + .sort(localeCompare) + .map(quoteIfNeeded).join(', ') + + ':\n' + + Object.getOwnPropertyNames(this) + .filter(prop => this[prop] !== null) + .sort(priorityThenLocaleCompare) + .map(prop => + typeof this[prop] !== 'object' + ? ` ${prop} ${prop === 'integrity' ? this[prop] : JSON.stringify(this[prop])}\n` + : Object.keys(this[prop]).length === 0 ? '' + : ` ${prop}:\n` + sortKV(this[prop]) + '\n') + .join('')).trim() + } + + addSpec (spec) { + this.#specs.add(spec) + } +} + +module.exports = YarnLock diff --git a/node_modules/npm/node_modules/@npmcli/arborist/package.json b/node_modules/npm/node_modules/@npmcli/arborist/package.json new file mode 100644 index 00000000..a8c9ae04 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/arborist/package.json @@ -0,0 +1,99 @@ +{ + "name": "@npmcli/arborist", + "version": "9.0.0", + "description": "Manage node_modules trees", + "dependencies": { + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/fs": "^4.0.0", + "@npmcli/installed-package-contents": "^3.0.0", + "@npmcli/map-workspaces": "^4.0.1", + "@npmcli/metavuln-calculator": "^9.0.0", + "@npmcli/name-from-folder": "^3.0.0", + "@npmcli/node-gyp": "^4.0.0", + "@npmcli/package-json": "^6.0.1", + "@npmcli/query": "^4.0.0", + "@npmcli/redact": "^3.0.0", + "@npmcli/run-script": "^9.0.1", + "bin-links": "^5.0.0", + "cacache": "^19.0.1", + "common-ancestor-path": "^1.0.1", + "hosted-git-info": "^8.0.0", + "json-stringify-nice": "^1.1.4", + "lru-cache": "^10.2.2", + "minimatch": "^9.0.4", + "nopt": "^8.0.0", + "npm-install-checks": "^7.1.0", + "npm-package-arg": "^12.0.0", + "npm-pick-manifest": "^10.0.0", + "npm-registry-fetch": "^18.0.1", + "pacote": "^21.0.0", + "parse-conflict-json": "^4.0.0", + "proc-log": "^5.0.0", + "proggy": "^3.0.0", + "promise-all-reject-late": "^1.0.0", + "promise-call-limit": "^3.0.1", + "read-package-json-fast": "^4.0.0", + "semver": "^7.3.7", + "ssri": "^12.0.0", + "treeverse": "^3.0.0", + "walk-up-path": "^4.0.0" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/mock-registry": "^1.0.0", + "@npmcli/template-oss": "4.23.6", + "benchmark": "^2.1.4", + "minify-registry-metadata": "^4.0.0", + "nock": "^13.3.3", + "tap": "^16.3.8", + "tar-stream": "^3.0.0", + "tcompare": "^5.0.6" + }, + "scripts": { + "test": "tap", + "posttest": "npm run lint", + "snap": "tap", + "test-proxy": "ARBORIST_TEST_PROXY=1 tap --snapshot", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "benchmark": "node scripts/benchmark.js", + "benchclean": "rm -rf scripts/benchmark/*/", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/arborist" + }, + "author": "GitHub Inc.", + "license": "ISC", + "files": [ + "bin/", + "lib/" + ], + "main": "lib/index.js", + "bin": { + "arborist": "bin/index.js" + }, + "tap": { + "after": "test/fixtures/cleanup.js", + "test-env": [ + "LC_ALL=sk" + ], + "timeout": "720", + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + } +} diff --git a/node_modules/npm/node_modules/@npmcli/config/LICENSE b/node_modules/npm/node_modules/@npmcli/config/LICENSE new file mode 100644 index 00000000..19cec97b --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/LICENSE @@ -0,0 +1,15 @@ +The 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 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/npm/node_modules/@npmcli/config/README.md b/node_modules/npm/node_modules/@npmcli/config/README.md new file mode 100644 index 00000000..12a5e233 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/README.md @@ -0,0 +1,257 @@ +# `@npmcli/config` + +Configuration management for the npm cli. + +This module is the spiritual descendant of +[`npmconf`](http://npm.im/npmconf), and the code that once lived in npm's +`lib/config/` folder. + +It does the management of configuration files that npm uses, but +importantly, does _not_ define all the configuration defaults or types, as +those parts make more sense to live within the npm CLI itself. + +The only exceptions: + +- The `prefix` config value has some special semantics, setting the local + prefix if specified on the CLI options and not in global mode, or the + global prefix otherwise. +- The `project` config file is loaded based on the local prefix (which can + only be set by the CLI config options, and otherwise defaults to a walk + up the folder tree to the first parent containing a `node_modules` + folder, `package.json` file, or `package-lock.json` file.) +- The `userconfig` value, as set by the environment and CLI (defaulting to + `~/.npmrc`, is used to load user configs. +- The `globalconfig` value, as set by the environment, CLI, and + `userconfig` file (defaulting to `$PREFIX/etc/npmrc`) is used to load + global configs. +- A `builtin` config, read from a `npmrc` file in the root of the npm + project itself, overrides all defaults. + +The resulting hierarchy of configs: + +- CLI switches. eg `--some-key=some-value` on the command line. These are + parsed by [`nopt`](http://npm.im/nopt), which is not a great choice, but + it's the one that npm has used forever, and changing it will be + difficult. +- Environment variables. eg `npm_config_some_key=some_value` in the + environment. There is no way at this time to modify this prefix. +- INI-formatted project configs. eg `some-key = some-value` in the + `localPrefix` folder (ie, the `cwd`, or its nearest parent that contains + either a `node_modules` folder or `package.json` file.) +- INI-formatted userconfig file. eg `some-key = some-value` in `~/.npmrc`. + The `userconfig` config value can be overridden by the `cli`, `env`, or + `project` configs to change this value. +- INI-formatted globalconfig file. eg `some-key = some-value` in + the `globalPrefix` folder, which is inferred by looking at the location + of the node executable, or the `prefix` setting in the `cli`, `env`, + `project`, or `userconfig`. The `globalconfig` value at any of those + levels can override this. +- INI-formatted builtin config file. eg `some-key = some-value` in + `/usr/local/lib/node_modules/npm/npmrc`. This is not configurable, and + is determined by looking in the `npmPath` folder. +- Default values (passed in by npm when it loads this module). + +## USAGE + +```js +const Config = require('@npmcli/config') +const { shorthands, definitions, flatten } = require('@npmcli/config/lib/definitions') + +const conf = new Config({ + // path to the npm module being run + npmPath: resolve(__dirname, '..'), + definitions, + shorthands, + flatten, + // optional, defaults to process.argv + // argv: [] <- if you are using this package in your own cli + // and dont want to have colliding argv + argv: process.argv, + // optional, defaults to process.env + env: process.env, + // optional, defaults to process.execPath + execPath: process.execPath, + // optional, defaults to process.platform + platform: process.platform, + // optional, defaults to process.cwd() + cwd: process.cwd(), +}) + +// emits log events on the process object +// see `proc-log` for more info +process.on('log', (level, ...args) => { + console.log(level, ...args) +}) + +// returns a promise that fails if config loading fails, and +// resolves when the config object is ready for action +conf.load().then(() => { + conf.validate() + console.log('loaded ok! some-key = ' + conf.get('some-key')) +}).catch(er => { + console.error('error loading configs!', er) +}) +``` + +## API + +The `Config` class is the sole export. + +```js +const Config = require('@npmcli/config') +``` + +### static `Config.typeDefs` + +The type definitions passed to `nopt` for CLI option parsing and known +configuration validation. + +### constructor `new Config(options)` + +Options: + +- `types` Types of all known config values. Note that some are effectively + given semantic value in the config loading process itself. +- `shorthands` An object mapping a shorthand value to an array of CLI + arguments that replace it. +- `defaults` Default values for each of the known configuration keys. + These should be defined for all configs given a type, and must be valid. +- `npmPath` The path to the `npm` module, for loading the `builtin` config + file. +- `cwd` Optional, defaults to `process.cwd()`, used for inferring the + `localPrefix` and loading the `project` config. +- `platform` Optional, defaults to `process.platform`. Used when inferring + the `globalPrefix` from the `execPath`, since this is done diferently on + Windows. +- `execPath` Optional, defaults to `process.execPath`. Used to infer the + `globalPrefix`. +- `env` Optional, defaults to `process.env`. Source of the environment + variables for configuration. +- `argv` Optional, defaults to `process.argv`. Source of the CLI options + used for configuration. + +Returns a `config` object, which is not yet loaded. + +Fields: + +- `config.globalPrefix` The prefix for `global` operations. Set by the + `prefix` config value, or defaults based on the location of the + `execPath` option. +- `config.localPrefix` The prefix for `local` operations. Set by the + `prefix` config value on the CLI only, or defaults to either the `cwd` or + its nearest ancestor containing a `node_modules` folder or `package.json` + file. +- `config.sources` A read-only `Map` of the file (or a comment, if no file + found, or relevant) to the config level loaded from that source. +- `config.data` A `Map` of config level to `ConfigData` objects. These + objects should not be modified directly under any circumstances. + - `source` The source where this data was loaded from. + - `raw` The raw data used to generate this config data, as it was parsed + initially from the environment, config file, or CLI options. + - `data` The data object reflecting the inheritance of configs up to this + point in the chain. + - `loadError` Any errors encountered that prevented the loading of this + config data. +- `config.list` A list sorted in priority of all the config data objects in + the prototype chain. `config.list[0]` is the `cli` level, + `config.list[1]` is the `env` level, and so on. +- `cwd` The `cwd` param +- `env` The `env` param +- `argv` The `argv` param +- `execPath` The `execPath` param +- `platform` The `platform` param +- `defaults` The `defaults` param +- `shorthands` The `shorthands` param +- `types` The `types` param +- `npmPath` The `npmPath` param +- `globalPrefix` The effective `globalPrefix` +- `localPrefix` The effective `localPrefix` +- `prefix` If `config.get('global')` is true, then `globalPrefix`, + otherwise `localPrefix` +- `home` The user's home directory, found by looking at `env.HOME` or + calling `os.homedir()`. +- `loaded` A boolean indicating whether or not configs are loaded +- `valid` A getter that returns `true` if all the config objects are valid. + Any data objects that have been modified with `config.set(...)` will be + re-evaluated when `config.valid` is read. + +### `config.load()` + +Load configuration from the various sources of information. + +Returns a `Promise` that resolves when configuration is loaded, and fails +if a fatal error is encountered. + +### `config.find(key)` + +Find the effective place in the configuration levels a given key is set. +Returns one of: `cli`, `env`, `project`, `user`, `global`, `builtin`, or +`default`. + +Returns `null` if the key is not set. + +### `config.get(key, where = 'cli')` + +Load the given key from the config stack. + +### `config.set(key, value, where = 'cli')` + +Set the key to the specified value, at the specified level in the config +stack. + +### `config.delete(key, where = 'cli')` + +Delete the configuration key from the specified level in the config stack. + +### `config.validate(where)` + +Verify that all known configuration options are set to valid values, and +log a warning if they are invalid. + +Invalid auth options will cause this method to throw an error with a `code` +property of `ERR_INVALID_AUTH`, and a `problems` property listing the specific +concerns with the current configuration. + +If `where` is not set, then all config objects are validated. + +Returns `true` if all configs are valid. + +Note that it's usually enough (and more efficient) to just check +`config.valid`, since each data object is marked for re-evaluation on every +`config.set()` operation. + +### `config.repair(problems)` + +Accept an optional array of problems (as thrown by `config.validate()`) and +perform the necessary steps to resolve them. If no problems are provided, +this method will call `config.validate()` internally to retrieve them. + +Note that you must `await config.save('user')` in order to persist the changes. + +### `config.isDefault(key)` + +Returns `true` if the value is coming directly from the +default definitions, if the current value for the key config is +coming from any other source, returns `false`. + +This method can be used for avoiding or tweaking default values, e.g: + +> Given a global default definition of foo='foo' it's possible to read that +> value such as: +> +> ```js +> const save = config.get('foo') +> ``` +> +> Now in a different place of your app it's possible to avoid using the `foo` +> default value, by checking to see if the current config value is currently +> one that was defined by the default definitions: +> +> ```js +> const save = config.isDefault('foo') ? 'bar' : config.get('foo') +> ``` + +### `config.save(where)` + +Save the config file specified by the `where` param. Must be one of +`project`, `user`, `global`, `builtin`. diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/definitions/definition.js b/node_modules/npm/node_modules/@npmcli/config/lib/definitions/definition.js new file mode 100644 index 00000000..333a9192 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/definitions/definition.js @@ -0,0 +1,253 @@ +// class that describes a config key we know about +// this keeps us from defining a config key and not +// providing a default, description, etc. +// +// TODO: some kind of categorization system, so we can +// say "these are for registry access", "these are for +// version resolution" etc. + +const required = ['type', 'description', 'default', 'key'] + +const allowed = [ + 'default', + 'defaultDescription', + 'deprecated', + 'description', + 'exclusive', + 'flatten', + 'hint', + 'key', + 'short', + 'type', + 'typeDescription', + 'usage', + 'envExport', +] + +const { + semver: { type: semver }, + Umask: { type: Umask }, + url: { type: url }, + path: { type: path }, +} = require('../type-defs.js') + +class Definition { + constructor (key, def) { + this.key = key + // if it's set falsey, don't export it, otherwise we do by default + this.envExport = true + Object.assign(this, def) + this.validate() + if (!this.defaultDescription) { + this.defaultDescription = describeValue(this.default) + } + if (!this.typeDescription) { + this.typeDescription = describeType(this.type) + } + // hint is only used for non-boolean values + if (!this.hint) { + if (this.type === Number) { + this.hint = '' + } else { + this.hint = `<${this.key}>` + } + } + if (!this.usage) { + this.usage = describeUsage(this) + } + } + + validate () { + for (const req of required) { + if (!Object.prototype.hasOwnProperty.call(this, req)) { + throw new Error(`config lacks ${req}: ${this.key}`) + } + } + if (!this.key) { + throw new Error(`config lacks key: ${this.key}`) + } + for (const field of Object.keys(this)) { + if (!allowed.includes(field)) { + throw new Error(`config defines unknown field ${field}: ${this.key}`) + } + } + } + + // a textual description of this config, suitable for help output + describe () { + const description = unindent(this.description) + const noEnvExport = this.envExport + ? '' + : ` +This value is not exported to the environment for child processes. +` + const deprecated = !this.deprecated ? '' : `* DEPRECATED: ${unindent(this.deprecated)}\n` + /* eslint-disable-next-line max-len */ + const exclusive = !this.exclusive ? '' : `\nThis config can not be used with: \`${this.exclusive.join('`, `')}\`` + return wrapAll(`#### \`${this.key}\` + +* Default: ${unindent(this.defaultDescription)} +* Type: ${unindent(this.typeDescription)} +${deprecated} +${description} +${exclusive} +${noEnvExport}`) + } +} + +const describeUsage = def => { + let key = '' + + // Single type + if (!Array.isArray(def.type)) { + if (def.short) { + key = `-${def.short}|` + } + + if (def.type === Boolean && def.default !== false) { + key = `${key}--no-${def.key}` + } else { + key = `${key}--${def.key}` + } + + if (def.type !== Boolean) { + key = `${key} ${def.hint}` + } + + return key + } + + key = `--${def.key}` + if (def.short) { + key = `-${def.short}|--${def.key}` + } + + // Multiple types + let types = def.type + const multiple = types.includes(Array) + const bool = types.includes(Boolean) + + // null type means optional and doesn't currently affect usage output since + // all non-optional params have defaults so we render everything as optional + types = types.filter(t => t !== null && t !== Array && t !== Boolean) + + if (!types.length) { + return key + } + + let description + if (!types.some(t => typeof t !== 'string')) { + // Specific values, use specifics given + description = `<${types.filter(d => d).join('|')}>` + } else { + // Generic values, use hint + description = def.hint + } + + if (bool) { + // Currently none of our multi-type configs with boolean values default to + // false so all their hints should show `--no-`, if we ever add ones that + // default to false we can branch the logic here + key = `--no-${def.key}|${key}` + } + + const usage = `${key} ${description}` + if (multiple) { + return `${usage} [${usage} ...]` + } else { + return usage + } +} + +const describeType = type => { + if (Array.isArray(type)) { + const descriptions = type.filter(t => t !== Array).map(t => describeType(t)) + + // [a] => "a" + // [a, b] => "a or b" + // [a, b, c] => "a, b, or c" + // [a, Array] => "a (can be set multiple times)" + // [a, Array, b] => "a or b (can be set multiple times)" + const last = descriptions.length > 1 ? [descriptions.pop()] : [] + const oxford = descriptions.length > 1 ? ', or ' : ' or ' + const words = [descriptions.join(', ')].concat(last).join(oxford) + const multiple = type.includes(Array) ? ' (can be set multiple times)' : '' + return `${words}${multiple}` + } + + // Note: these are not quite the same as the description printed + // when validation fails. In that case, we want to give the user + // a bit more information to help them figure out what's wrong. + switch (type) { + case String: + return 'String' + case Number: + return 'Number' + case Umask: + return 'Octal numeric string in range 0000..0777 (0..511)' + case Boolean: + return 'Boolean' + case Date: + return 'Date' + case path: + return 'Path' + case semver: + return 'SemVer string' + case url: + return 'URL' + default: + return describeValue(type) + } +} + +// if it's a string, quote it. otherwise, just cast to string. +const describeValue = val => (typeof val === 'string' ? JSON.stringify(val) : String(val)) + +const unindent = s => { + // get the first \n followed by a bunch of spaces, and pluck off + // that many spaces from the start of every line. + const match = s.match(/\n +/) + return !match ? s.trim() : s.split(match[0]).join('\n').trim() +} + +const wrap = s => { + const cols = Math.min(Math.max(20, process.stdout.columns) || 80, 80) - 5 + return unindent(s) + .split(/[ \n]+/) + .reduce((left, right) => { + const last = left.split('\n').pop() + const join = last.length && last.length + right.length > cols ? '\n' : ' ' + return left + join + right + }) +} + +const wrapAll = s => { + let inCodeBlock = false + return s + .split('\n\n') + .map(block => { + if (inCodeBlock || block.startsWith('```')) { + inCodeBlock = !block.endsWith('```') + return block + } + + if (block.charAt(0) === '*') { + return ( + '* ' + + block + .slice(1) + .trim() + .split('\n* ') + .map(li => { + return wrap(li).replace(/\n/g, '\n ') + }) + .join('\n* ') + ) + } else { + return wrap(block) + } + }) + .join('\n\n') +} + +module.exports = Definition diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/definitions/definitions.js b/node_modules/npm/node_modules/@npmcli/config/lib/definitions/definitions.js new file mode 100644 index 00000000..cbad7c73 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/definitions/definitions.js @@ -0,0 +1,2282 @@ +const Definition = require('./definition.js') + +const ciInfo = require('ci-info') +const querystring = require('node:querystring') +const { join } = require('node:path') + +const isWindows = process.platform === 'win32' + +// used by cafile flattening to flatOptions.ca +const { readFileSync } = require('node:fs') +const maybeReadFile = file => { + try { + return readFileSync(file, 'utf8') + } catch (er) { + if (er.code !== 'ENOENT') { + throw er + } + return null + } +} + +const buildOmitList = obj => { + const include = obj.include || [] + const omit = obj.omit || [] + + const only = obj.only + if (/^prod(uction)?$/.test(only) || obj.production) { + omit.push('dev') + } else if (obj.production === false) { + include.push('dev') + } + + if (/^dev/.test(obj.also)) { + include.push('dev') + } + + if (obj.dev) { + include.push('dev') + } + + if (obj.optional === false) { + omit.push('optional') + } else if (obj.optional === true) { + include.push('optional') + } + + obj.omit = [...new Set(omit)].filter(type => !include.includes(type)) + obj.include = [...new Set(include)] + + if (obj.omit.includes('dev')) { + process.env.NODE_ENV = 'production' + } + + return obj.omit +} + +const editor = process.env.EDITOR || + process.env.VISUAL || + (isWindows ? `${process.env.SYSTEMROOT}\\notepad.exe` : 'vi') + +const shell = isWindows ? process.env.ComSpec || 'cmd' + : process.env.SHELL || 'sh' + +const { networkInterfaces } = require('node:os') +const getLocalAddresses = () => { + try { + return Object.values(networkInterfaces()).map( + int => int.map(({ address }) => address) + ).reduce((set, addrs) => set.concat(addrs), [null]) + } catch (e) { + return [null] + } +} + +const unicode = /UTF-?8$/i.test( + process.env.LC_ALL || + process.env.LC_CTYPE || + process.env.LANG +) + +// use LOCALAPPDATA on Windows, if set +// https://github.com/npm/cli/pull/899 +const cacheRoot = (isWindows && process.env.LOCALAPPDATA) || '~' +const cacheExtra = isWindows ? 'npm-cache' : '.npm' +const cache = `${cacheRoot}/${cacheExtra}` + +// TODO: refactor these type definitions so that they are less +// weird to pull out of the config module. +// TODO: use better type definition/validation API, nopt's is so weird. +const { + semver: { type: Semver }, + Umask: { type: Umask }, + url: { type: url }, + path: { type: path }, +} = require('../type-defs.js') + +// basic flattening function, just copy it over camelCase +const flatten = (key, obj, flatOptions) => { + const camel = key.replace(/-([a-z])/g, (_0, _1) => _1.toUpperCase()) + flatOptions[camel] = obj[key] +} + +// TODO: +// Instead of having each definition provide a flatten method, +// provide the (?list of?) flat option field(s?) that it impacts. +// When that config is set, we mark the relevant flatOption fields +// dirty. Then, a getter for that field defines how we actually +// set it. +// +// So, `save-dev`, `save-optional`, `save-prod`, et al would indicate +// that they affect the `saveType` flat option. Then the config.flat +// object has a `get saveType () { ... }` that looks at the "real" +// config settings from files etc and returns the appropriate value. +// +// Getters will also (maybe?) give us a hook to audit flat option +// usage, so we can document and group these more appropriately. +// +// This will be a problem with cases where we currently do: +// const opts = { ...npm.flatOptions, foo: 'bar' }, but we can maybe +// instead do `npm.config.set('foo', 'bar')` prior to passing the +// config object down where it needs to go. +// +// This way, when we go hunting for "where does saveType come from anyway!?" +// while fixing some Arborist bug, we won't have to hunt through too +// many places. + +// XXX: We should really deprecate all these `--save-blah` switches +// in favor of a single `--save-type` option. The unfortunate shortcut +// we took for `--save-peer --save-optional` being `--save-type=peerOptional` +// makes this tricky, and likely a breaking change. + +// Define all config keys we know about. They are indexed by their own key for +// ease of lookup later. This duplication is an optimization so that we don't +// have to do an extra function call just to "reuse" the key in both places. + +const definitions = { + _auth: new Definition('_auth', { + default: null, + type: [null, String], + description: ` + A basic-auth string to use when authenticating against the npm registry. + This will ONLY be used to authenticate against the npm registry. For other + registries you will need to scope it like "//other-registry.tld/:_auth" + + Warning: This should generally not be set via a command-line option. It + is safer to use a registry-provided authentication bearer token stored in + the ~/.npmrc file by running \`npm login\`. + `, + flatten, + }), + access: new Definition('access', { + default: null, + defaultDescription: ` + 'public' for new packages, existing packages it will not change the current level + `, + type: [null, 'restricted', 'public'], + description: ` + If you do not want your scoped package to be publicly viewable (and + installable) set \`--access=restricted\`. + + Unscoped packages can not be set to \`restricted\`. + + Note: This defaults to not changing the current access level for existing + packages. Specifying a value of \`restricted\` or \`public\` during + publish will change the access for an existing package the same way that + \`npm access set status\` would. + `, + flatten, + }), + all: new Definition('all', { + default: false, + type: Boolean, + short: 'a', + description: ` + When running \`npm outdated\` and \`npm ls\`, setting \`--all\` will show + all outdated or installed packages, rather than only those directly + depended upon by the current project. + `, + flatten, + }), + 'allow-same-version': new Definition('allow-same-version', { + default: false, + type: Boolean, + description: ` + Prevents throwing an error when \`npm version\` is used to set the new + version to the same value as the current version. + `, + flatten, + }), + also: new Definition('also', { + default: null, + type: [null, 'dev', 'development'], + description: ` + When set to \`dev\` or \`development\`, this is an alias for + \`--include=dev\`. + `, + deprecated: 'Please use --include=dev instead.', + flatten (key, obj, flatOptions) { + definitions.omit.flatten('omit', obj, flatOptions) + }, + }), + audit: new Definition('audit', { + default: true, + type: Boolean, + description: ` + When "true" submit audit reports alongside the current npm command to the + default registry and all registries configured for scopes. See the + documentation for [\`npm audit\`](/commands/npm-audit) for details on what + is submitted. + `, + flatten, + }), + 'audit-level': new Definition('audit-level', { + default: null, + type: [null, 'info', 'low', 'moderate', 'high', 'critical', 'none'], + description: ` + The minimum level of vulnerability for \`npm audit\` to exit with + a non-zero exit code. + `, + flatten, + }), + 'auth-type': new Definition('auth-type', { + default: 'web', + type: ['legacy', 'web'], + description: ` + What authentication strategy to use with \`login\`. + Note that if an \`otp\` config is given, this value will always be set to \`legacy\`. + `, + flatten, + }), + before: new Definition('before', { + default: null, + type: [null, Date], + description: ` + If passed to \`npm install\`, will rebuild the npm tree such that only + versions that were available **on or before** the \`--before\` time get + installed. If there's no versions available for the current set of + direct dependencies, the command will error. + + If the requested version is a \`dist-tag\` and the given tag does not + pass the \`--before\` filter, the most recent version less than or equal + to that tag will be used. For example, \`foo@latest\` might install + \`foo@1.2\` even though \`latest\` is \`2.0\`. + `, + flatten, + }), + 'bin-links': new Definition('bin-links', { + default: true, + type: Boolean, + description: ` + Tells npm to create symlinks (or \`.cmd\` shims on Windows) for package + executables. + + Set to false to have it not do this. This can be used to work around the + fact that some file systems don't support symlinks, even on ostensibly + Unix systems. + `, + flatten, + }), + browser: new Definition('browser', { + default: null, + defaultDescription: ` + OS X: \`"open"\`, Windows: \`"start"\`, Others: \`"xdg-open"\` + `, + type: [null, Boolean, String], + description: ` + The browser that is called by npm commands to open websites. + + Set to \`false\` to suppress browser behavior and instead print urls to + terminal. + + Set to \`true\` to use default system URL opener. + `, + flatten, + }), + ca: new Definition('ca', { + default: null, + type: [null, String, Array], + description: ` + The Certificate Authority signing certificate that is trusted for SSL + connections to the registry. Values should be in PEM format (Windows + calls it "Base-64 encoded X.509 (.CER)") with newlines replaced by the + string "\\n". For example: + + \`\`\`ini + ca="-----BEGIN CERTIFICATE-----\\nXXXX\\nXXXX\\n-----END CERTIFICATE-----" + \`\`\` + + Set to \`null\` to only allow "known" registrars, or to a specific CA + cert to trust only that specific signing authority. + + Multiple CAs can be trusted by specifying an array of certificates: + + \`\`\`ini + ca[]="..." + ca[]="..." + \`\`\` + + See also the \`strict-ssl\` config. + `, + flatten, + }), + cache: new Definition('cache', { + default: cache, + defaultDescription: ` + Windows: \`%LocalAppData%\\npm-cache\`, Posix: \`~/.npm\` + `, + type: path, + description: ` + The location of npm's cache directory. + `, + flatten (key, obj, flatOptions) { + flatOptions.cache = join(obj.cache, '_cacache') + flatOptions.npxCache = join(obj.cache, '_npx') + flatOptions.tufCache = join(obj.cache, '_tuf') + }, + }), + 'cache-max': new Definition('cache-max', { + default: Infinity, + type: Number, + description: ` + \`--cache-max=0\` is an alias for \`--prefer-online\` + `, + deprecated: ` + This option has been deprecated in favor of \`--prefer-online\` + `, + flatten (key, obj, flatOptions) { + if (obj[key] <= 0) { + flatOptions.preferOnline = true + } + }, + }), + 'cache-min': new Definition('cache-min', { + default: 0, + type: Number, + description: ` + \`--cache-min=9999 (or bigger)\` is an alias for \`--prefer-offline\`. + `, + deprecated: ` + This option has been deprecated in favor of \`--prefer-offline\`. + `, + flatten (key, obj, flatOptions) { + if (obj[key] >= 9999) { + flatOptions.preferOffline = true + } + }, + }), + cafile: new Definition('cafile', { + default: null, + type: path, + description: ` + A path to a file containing one or multiple Certificate Authority signing + certificates. Similar to the \`ca\` setting, but allows for multiple + CA's, as well as for the CA information to be stored in a file on disk. + `, + flatten (key, obj, flatOptions) { + // always set to null in defaults + if (!obj.cafile) { + return + } + + const raw = maybeReadFile(obj.cafile) + if (!raw) { + return + } + + const delim = '-----END CERTIFICATE-----' + flatOptions.ca = raw.replace(/\r\n/g, '\n').split(delim) + .filter(section => section.trim()) + .map(section => section.trimLeft() + delim) + }, + }), + call: new Definition('call', { + default: '', + type: String, + short: 'c', + description: ` + Optional companion option for \`npm exec\`, \`npx\` that allows for + specifying a custom command to be run along with the installed packages. + + \`\`\`bash + npm exec --package yo --package generator-node --call "yo node" + \`\`\` + `, + flatten, + }), + cert: new Definition('cert', { + default: null, + type: [null, String], + description: ` + A client certificate to pass when accessing the registry. Values should + be in PEM format (Windows calls it "Base-64 encoded X.509 (.CER)") with + newlines replaced by the string "\\n". For example: + + \`\`\`ini + cert="-----BEGIN CERTIFICATE-----\\nXXXX\\nXXXX\\n-----END CERTIFICATE-----" + \`\`\` + + It is _not_ the path to a certificate file, though you can set a registry-scoped + "cafile" path like "//other-registry.tld/:cafile=/path/to/cert.pem". + `, + deprecated: ` + \`key\` and \`cert\` are no longer used for most registry operations. + Use registry scoped \`keyfile\` and \`cafile\` instead. + Example: + //other-registry.tld/:keyfile=/path/to/key.pem + //other-registry.tld/:cafile=/path/to/cert.crt + `, + flatten, + }), + cidr: new Definition('cidr', { + default: null, + type: [null, String, Array], + description: ` + This is a list of CIDR address to be used when configuring limited access + tokens with the \`npm token create\` command. + `, + flatten, + }), + // This should never be directly used, the flattened value is the derived value + // and is sent to other modules, and is also exposed as `npm.color` for use + // inside npm itself. + color: new Definition('color', { + default: !process.env.NO_COLOR || process.env.NO_COLOR === '0', + usage: '--color|--no-color|--color always', + defaultDescription: ` + true unless the NO_COLOR environ is set to something other than '0' + `, + type: ['always', Boolean], + description: ` + If false, never shows colors. If \`"always"\` then always shows colors. + If true, then only prints color codes for tty file descriptors. + `, + flatten (key, obj, flatOptions) { + flatOptions.color = !obj.color ? false + : obj.color === 'always' ? true + : !!process.stdout.isTTY + flatOptions.logColor = !obj.color ? false + : obj.color === 'always' ? true + : !!process.stderr.isTTY + }, + }), + 'commit-hooks': new Definition('commit-hooks', { + default: true, + type: Boolean, + description: ` + Run git commit hooks when using the \`npm version\` command. + `, + flatten, + }), + cpu: new Definition('cpu', { + default: null, + type: [null, String], + description: ` + Override CPU architecture of native modules to install. + Acceptable values are same as \`cpu\` field of package.json, + which comes from \`process.arch\`. + `, + flatten, + }), + depth: new Definition('depth', { + default: null, + defaultDescription: ` + \`Infinity\` if \`--all\` is set, otherwise \`1\` + `, + type: [null, Number], + description: ` + The depth to go when recursing packages for \`npm ls\`. + + If not set, \`npm ls\` will show only the immediate dependencies of the + root project. If \`--all\` is set, then npm will show all dependencies + by default. + `, + flatten, + }), + description: new Definition('description', { + default: true, + type: Boolean, + usage: '--no-description', + description: ` + Show the description in \`npm search\` + `, + flatten (key, obj, flatOptions) { + flatOptions.search = flatOptions.search || { limit: 20 } + flatOptions.search[key] = obj[key] + }, + }), + dev: new Definition('dev', { + default: false, + type: Boolean, + description: ` + Alias for \`--include=dev\`. + `, + deprecated: 'Please use --include=dev instead.', + flatten (key, obj, flatOptions) { + definitions.omit.flatten('omit', obj, flatOptions) + }, + }), + diff: new Definition('diff', { + default: [], + hint: '', + type: [String, Array], + description: ` + Define arguments to compare in \`npm diff\`. + `, + flatten, + }), + 'diff-ignore-all-space': new Definition('diff-ignore-all-space', { + default: false, + type: Boolean, + description: ` + Ignore whitespace when comparing lines in \`npm diff\`. + `, + flatten, + }), + 'diff-name-only': new Definition('diff-name-only', { + default: false, + type: Boolean, + description: ` + Prints only filenames when using \`npm diff\`. + `, + flatten, + }), + 'diff-no-prefix': new Definition('diff-no-prefix', { + default: false, + type: Boolean, + description: ` + Do not show any source or destination prefix in \`npm diff\` output. + + Note: this causes \`npm diff\` to ignore the \`--diff-src-prefix\` and + \`--diff-dst-prefix\` configs. + `, + flatten, + }), + 'diff-dst-prefix': new Definition('diff-dst-prefix', { + default: 'b/', + hint: '', + type: String, + description: ` + Destination prefix to be used in \`npm diff\` output. + `, + flatten, + }), + 'diff-src-prefix': new Definition('diff-src-prefix', { + default: 'a/', + hint: '', + type: String, + description: ` + Source prefix to be used in \`npm diff\` output. + `, + flatten, + }), + 'diff-text': new Definition('diff-text', { + default: false, + type: Boolean, + description: ` + Treat all files as text in \`npm diff\`. + `, + flatten, + }), + 'diff-unified': new Definition('diff-unified', { + default: 3, + type: Number, + description: ` + The number of lines of context to print in \`npm diff\`. + `, + flatten, + }), + 'dry-run': new Definition('dry-run', { + default: false, + type: Boolean, + description: ` + Indicates that you don't want npm to make any changes and that it should + only report what it would have done. This can be passed into any of the + commands that modify your local installation, eg, \`install\`, + \`update\`, \`dedupe\`, \`uninstall\`, as well as \`pack\` and + \`publish\`. + + Note: This is NOT honored by other network related commands, eg + \`dist-tags\`, \`owner\`, etc. + `, + flatten, + }), + editor: new Definition('editor', { + default: editor, + defaultDescription: ` + The EDITOR or VISUAL environment variables, or '%SYSTEMROOT%\\notepad.exe' on Windows, + or 'vi' on Unix systems + `, + type: String, + description: ` + The command to run for \`npm edit\` and \`npm config edit\`. + `, + flatten, + }), + 'engine-strict': new Definition('engine-strict', { + default: false, + type: Boolean, + description: ` + If set to true, then npm will stubbornly refuse to install (or even + consider installing) any package that claims to not be compatible with + the current Node.js version. + + This can be overridden by setting the \`--force\` flag. + `, + flatten, + }), + 'expect-result-count': new Definition('expect-result-count', { + default: null, + type: [null, Number], + hint: '', + exclusive: ['expect-results'], + description: ` + Tells to expect a specific number of results from the command. + `, + }), + 'expect-results': new Definition('expect-results', { + default: null, + type: [null, Boolean], + exclusive: ['expect-result-count'], + description: ` + Tells npm whether or not to expect results from the command. + Can be either true (expect some results) or false (expect no results). + `, + }), + 'fetch-retries': new Definition('fetch-retries', { + default: 2, + type: Number, + description: ` + The "retries" config for the \`retry\` module to use when fetching + packages from the registry. + + npm will retry idempotent read requests to the registry in the case + of network failures or 5xx HTTP errors. + `, + flatten (key, obj, flatOptions) { + flatOptions.retry = flatOptions.retry || {} + flatOptions.retry.retries = obj[key] + }, + }), + 'fetch-retry-factor': new Definition('fetch-retry-factor', { + default: 10, + type: Number, + description: ` + The "factor" config for the \`retry\` module to use when fetching + packages. + `, + flatten (key, obj, flatOptions) { + flatOptions.retry = flatOptions.retry || {} + flatOptions.retry.factor = obj[key] + }, + }), + 'fetch-retry-maxtimeout': new Definition('fetch-retry-maxtimeout', { + default: 60000, + defaultDescription: '60000 (1 minute)', + type: Number, + description: ` + The "maxTimeout" config for the \`retry\` module to use when fetching + packages. + `, + flatten (key, obj, flatOptions) { + flatOptions.retry = flatOptions.retry || {} + flatOptions.retry.maxTimeout = obj[key] + }, + }), + 'fetch-retry-mintimeout': new Definition('fetch-retry-mintimeout', { + default: 10000, + defaultDescription: '10000 (10 seconds)', + type: Number, + description: ` + The "minTimeout" config for the \`retry\` module to use when fetching + packages. + `, + flatten (key, obj, flatOptions) { + flatOptions.retry = flatOptions.retry || {} + flatOptions.retry.minTimeout = obj[key] + }, + }), + 'fetch-timeout': new Definition('fetch-timeout', { + default: 5 * 60 * 1000, + defaultDescription: `${5 * 60 * 1000} (5 minutes)`, + type: Number, + description: ` + The maximum amount of time to wait for HTTP requests to complete. + `, + flatten (key, obj, flatOptions) { + flatOptions.timeout = obj[key] + }, + }), + force: new Definition('force', { + default: false, + type: Boolean, + short: 'f', + description: ` + Removes various protections against unfortunate side effects, common + mistakes, unnecessary performance degradation, and malicious input. + + * Allow clobbering non-npm files in global installs. + * Allow the \`npm version\` command to work on an unclean git repository. + * Allow deleting the cache folder with \`npm cache clean\`. + * Allow installing packages that have an \`engines\` declaration + requiring a different version of npm. + * Allow installing packages that have an \`engines\` declaration + requiring a different version of \`node\`, even if \`--engine-strict\` + is enabled. + * Allow \`npm audit fix\` to install modules outside your stated + dependency range (including SemVer-major changes). + * Allow unpublishing all versions of a published package. + * Allow conflicting peerDependencies to be installed in the root project. + * Implicitly set \`--yes\` during \`npm init\`. + * Allow clobbering existing values in \`npm pkg\` + * Allow unpublishing of entire packages (not just a single version). + + If you don't have a clear idea of what you want to do, it is strongly + recommended that you do not use this option! + `, + flatten, + }), + 'foreground-scripts': new Definition('foreground-scripts', { + default: false, + defaultDescription: `\`false\` unless when using \`npm pack\` or \`npm publish\` where it + defaults to \`true\``, + type: Boolean, + description: ` + Run all build scripts (ie, \`preinstall\`, \`install\`, and + \`postinstall\`) scripts for installed packages in the foreground + process, sharing standard input, output, and error with the main npm + process. + + Note that this will generally make installs run slower, and be much + noisier, but can be useful for debugging. + `, + flatten, + }), + 'format-package-lock': new Definition('format-package-lock', { + default: true, + type: Boolean, + description: ` + Format \`package-lock.json\` or \`npm-shrinkwrap.json\` as a human + readable file. + `, + flatten, + }), + fund: new Definition('fund', { + default: true, + type: Boolean, + description: ` + When "true" displays the message at the end of each \`npm install\` + acknowledging the number of dependencies looking for funding. + See [\`npm fund\`](/commands/npm-fund) for details. + `, + flatten, + }), + git: new Definition('git', { + default: 'git', + type: String, + description: ` + The command to use for git commands. If git is installed on the + computer, but is not in the \`PATH\`, then set this to the full path to + the git binary. + `, + flatten, + }), + 'git-tag-version': new Definition('git-tag-version', { + default: true, + type: Boolean, + description: ` + Tag the commit when using the \`npm version\` command. Setting this to + false results in no commit being made at all. + `, + flatten, + }), + global: new Definition('global', { + default: false, + type: Boolean, + short: 'g', + description: ` + Operates in "global" mode, so that packages are installed into the + \`prefix\` folder instead of the current working directory. See + [folders](/configuring-npm/folders) for more on the differences in + behavior. + + * packages are installed into the \`{prefix}/lib/node_modules\` folder, + instead of the current working directory. + * bin files are linked to \`{prefix}/bin\` + * man pages are linked to \`{prefix}/share/man\` + `, + flatten: (key, obj, flatOptions) => { + flatten(key, obj, flatOptions) + if (flatOptions.global) { + flatOptions.location = 'global' + } + }, + }), + // the globalconfig has its default defined outside of this module + globalconfig: new Definition('globalconfig', { + type: path, + default: '', + defaultDescription: ` + The global --prefix setting plus 'etc/npmrc'. For example, + '/usr/local/etc/npmrc' + `, + description: ` + The config file to read for global config options. + `, + flatten, + }), + 'global-style': new Definition('global-style', { + default: false, + type: Boolean, + description: ` + Only install direct dependencies in the top level \`node_modules\`, + but hoist on deeper dependencies. + Sets \`--install-strategy=shallow\`. + `, + deprecated: ` + This option has been deprecated in favor of \`--install-strategy=shallow\` + `, + flatten (key, obj, flatOptions) { + if (obj[key]) { + obj['install-strategy'] = 'shallow' + flatOptions.installStrategy = 'shallow' + } + }, + }), + heading: new Definition('heading', { + default: 'npm', + type: String, + description: ` + The string that starts all the debugging log output. + `, + flatten, + }), + 'https-proxy': new Definition('https-proxy', { + default: null, + type: [null, url], + description: ` + A proxy to use for outgoing https requests. If the \`HTTPS_PROXY\` or + \`https_proxy\` or \`HTTP_PROXY\` or \`http_proxy\` environment variables + are set, proxy settings will be honored by the underlying + \`make-fetch-happen\` library. + `, + flatten, + }), + 'if-present': new Definition('if-present', { + default: false, + type: Boolean, + envExport: false, + description: ` + If true, npm will not exit with an error code when \`run-script\` is + invoked for a script that isn't defined in the \`scripts\` section of + \`package.json\`. This option can be used when it's desirable to + optionally run a script when it's present and fail if the script fails. + This is useful, for example, when running scripts that may only apply for + some builds in an otherwise generic CI setup. + `, + flatten, + }), + 'ignore-scripts': new Definition('ignore-scripts', { + default: false, + type: Boolean, + description: ` + If true, npm does not run scripts specified in package.json files. + + Note that commands explicitly intended to run a particular script, such + as \`npm start\`, \`npm stop\`, \`npm restart\`, \`npm test\`, and \`npm + run-script\` will still run their intended script if \`ignore-scripts\` is + set, but they will *not* run any pre- or post-scripts. + `, + flatten, + }), + include: new Definition('include', { + default: [], + type: [Array, 'prod', 'dev', 'optional', 'peer'], + description: ` + Option that allows for defining which types of dependencies to install. + + This is the inverse of \`--omit=\`. + + Dependency types specified in \`--include\` will not be omitted, + regardless of the order in which omit/include are specified on the + command-line. + `, + flatten (key, obj, flatOptions) { + // just call the omit flattener, it reads from obj.include + definitions.omit.flatten('omit', obj, flatOptions) + }, + }), + 'include-staged': new Definition('include-staged', { + default: false, + type: Boolean, + description: ` + Allow installing "staged" published packages, as defined by [npm RFC PR + #92](https://github.com/npm/rfcs/pull/92). + + This is experimental, and not implemented by the npm public registry. + `, + flatten, + }), + 'include-workspace-root': new Definition('include-workspace-root', { + default: false, + type: Boolean, + envExport: false, + description: ` + Include the workspace root when workspaces are enabled for a command. + + When false, specifying individual workspaces via the \`workspace\` config, + or all workspaces via the \`workspaces\` flag, will cause npm to operate only + on the specified workspaces, and not on the root project. + `, + flatten, + }), + 'init-author-email': new Definition('init-author-email', { + default: '', + hint: '', + type: String, + description: ` + The value \`npm init\` should use by default for the package author's + email. + `, + }), + 'init-author-name': new Definition('init-author-name', { + default: '', + hint: '', + type: String, + description: ` + The value \`npm init\` should use by default for the package author's name. + `, + }), + 'init-author-url': new Definition('init-author-url', { + default: '', + type: ['', url], + hint: '', + description: ` + The value \`npm init\` should use by default for the package author's homepage. + `, + }), + 'init-license': new Definition('init-license', { + default: 'ISC', + hint: '', + type: String, + description: ` + The value \`npm init\` should use by default for the package license. + `, + }), + 'init-module': new Definition('init-module', { + default: '~/.npm-init.js', + type: path, + hint: '', + description: ` + A module that will be loaded by the \`npm init\` command. See the + documentation for the + [init-package-json](https://github.com/npm/init-package-json) module for + more information, or [npm init](/commands/npm-init). + `, + }), + 'init-version': new Definition('init-version', { + default: '1.0.0', + type: Semver, + hint: '', + description: ` + The value that \`npm init\` should use by default for the package + version number, if not already set in package.json. + `, + }), + // these "aliases" are historically supported in .npmrc files, unfortunately + // They should be removed in a future npm version. + 'init.author.email': new Definition('init.author.email', { + default: '', + type: String, + deprecated: ` + Use \`--init-author-email\` instead.`, + description: ` + Alias for \`--init-author-email\` + `, + }), + 'init.author.name': new Definition('init.author.name', { + default: '', + type: String, + deprecated: ` + Use \`--init-author-name\` instead. + `, + description: ` + Alias for \`--init-author-name\` + `, + }), + 'init.author.url': new Definition('init.author.url', { + default: '', + type: ['', url], + deprecated: ` + Use \`--init-author-url\` instead. + `, + description: ` + Alias for \`--init-author-url\` + `, + }), + 'init.license': new Definition('init.license', { + default: 'ISC', + type: String, + deprecated: ` + Use \`--init-license\` instead. + `, + description: ` + Alias for \`--init-license\` + `, + }), + 'init.module': new Definition('init.module', { + default: '~/.npm-init.js', + type: path, + deprecated: ` + Use \`--init-module\` instead. + `, + description: ` + Alias for \`--init-module\` + `, + }), + 'init.version': new Definition('init.version', { + default: '1.0.0', + type: Semver, + deprecated: ` + Use \`--init-version\` instead. + `, + description: ` + Alias for \`--init-version\` + `, + }), + 'install-links': new Definition('install-links', { + default: false, + type: Boolean, + description: ` + When set file: protocol dependencies will be packed and installed as + regular dependencies instead of creating a symlink. This option has + no effect on workspaces. + `, + flatten, + }), + 'install-strategy': new Definition('install-strategy', { + default: 'hoisted', + type: ['hoisted', 'nested', 'shallow', 'linked'], + description: ` + Sets the strategy for installing packages in node_modules. + hoisted (default): Install non-duplicated in top-level, and duplicated as + necessary within directory structure. + nested: (formerly --legacy-bundling) install in place, no hoisting. + shallow (formerly --global-style) only install direct deps at top-level. + linked: (experimental) install in node_modules/.store, link in place, + unhoisted. + `, + flatten, + }), + json: new Definition('json', { + default: false, + type: Boolean, + description: ` + Whether or not to output JSON data, rather than the normal output. + + * In \`npm pkg set\` it enables parsing set values with JSON.parse() + before saving them to your \`package.json\`. + + Not supported by all npm commands. + `, + flatten, + }), + key: new Definition('key', { + default: null, + type: [null, String], + description: ` + A client key to pass when accessing the registry. Values should be in + PEM format with newlines replaced by the string "\\n". For example: + + \`\`\`ini + key="-----BEGIN PRIVATE KEY-----\\nXXXX\\nXXXX\\n-----END PRIVATE KEY-----" + \`\`\` + + It is _not_ the path to a key file, though you can set a registry-scoped + "keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem". + `, + deprecated: ` + \`key\` and \`cert\` are no longer used for most registry operations. + Use registry scoped \`keyfile\` and \`cafile\` instead. + Example: + //other-registry.tld/:keyfile=/path/to/key.pem + //other-registry.tld/:cafile=/path/to/cert.crt + `, + flatten, + }), + 'legacy-bundling': new Definition('legacy-bundling', { + default: false, + type: Boolean, + description: ` + Instead of hoisting package installs in \`node_modules\`, install packages + in the same manner that they are depended on. This may cause very deep + directory structures and duplicate package installs as there is no + de-duplicating. + Sets \`--install-strategy=nested\`. + `, + deprecated: ` + This option has been deprecated in favor of \`--install-strategy=nested\` + `, + flatten (key, obj, flatOptions) { + if (obj[key]) { + obj['install-strategy'] = 'nested' + flatOptions.installStrategy = 'nested' + } + }, + }), + 'legacy-peer-deps': new Definition('legacy-peer-deps', { + default: false, + type: Boolean, + description: ` + Causes npm to completely ignore \`peerDependencies\` when building a + package tree, as in npm versions 3 through 6. + + If a package cannot be installed because of overly strict + \`peerDependencies\` that collide, it provides a way to move forward + resolving the situation. + + This differs from \`--omit=peer\`, in that \`--omit=peer\` will avoid + unpacking \`peerDependencies\` on disk, but will still design a tree such + that \`peerDependencies\` _could_ be unpacked in a correct place. + + Use of \`legacy-peer-deps\` is not recommended, as it will not enforce + the \`peerDependencies\` contract that meta-dependencies may rely on. + `, + flatten, + }), + libc: new Definition('libc', { + default: null, + type: [null, String], + description: ` + Override libc of native modules to install. + Acceptable values are same as \`libc\` field of package.json + `, + flatten, + }), + link: new Definition('link', { + default: false, + type: Boolean, + description: ` + Used with \`npm ls\`, limiting output to only those packages that are + linked. + `, + }), + 'local-address': new Definition('local-address', { + default: null, + type: getLocalAddresses(), + typeDescription: 'IP Address', + description: ` + The IP address of the local interface to use when making connections to + the npm registry. Must be IPv4 in versions of Node prior to 0.12. + `, + flatten, + }), + location: new Definition('location', { + default: 'user', + short: 'L', + type: [ + 'global', + 'user', + 'project', + ], + defaultDescription: ` + "user" unless \`--global\` is passed, which will also set this value to "global" + `, + description: ` + When passed to \`npm config\` this refers to which config file to use. + + When set to "global" mode, packages are installed into the \`prefix\` folder + instead of the current working directory. See + [folders](/configuring-npm/folders) for more on the differences in behavior. + + * packages are installed into the \`{prefix}/lib/node_modules\` folder, + instead of the current working directory. + * bin files are linked to \`{prefix}/bin\` + * man pages are linked to \`{prefix}/share/man\` + `, + flatten: (key, obj, flatOptions) => { + flatten(key, obj, flatOptions) + if (flatOptions.global) { + flatOptions.location = 'global' + } + if (obj.location === 'global') { + flatOptions.global = true + } + }, + }), + 'lockfile-version': new Definition('lockfile-version', { + default: null, + type: [null, 1, 2, 3, '1', '2', '3'], + defaultDescription: ` + Version 3 if no lockfile, auto-converting v1 lockfiles to v3, otherwise + maintain current lockfile version.`, + description: ` + Set the lockfile format version to be used in package-lock.json and + npm-shrinkwrap-json files. Possible options are: + + 1: The lockfile version used by npm versions 5 and 6. Lacks some data that + is used during the install, resulting in slower and possibly less + deterministic installs. Prevents lockfile churn when interoperating with + older npm versions. + + 2: The default lockfile version used by npm version 7 and 8. Includes both + the version 1 lockfile data and version 3 lockfile data, for maximum + determinism and interoperability, at the expense of more bytes on disk. + + 3: Only the new lockfile information introduced in npm version 7. Smaller + on disk than lockfile version 2, but not interoperable with older npm + versions. Ideal if all users are on npm version 7 and higher. + `, + flatten: (key, obj, flatOptions) => { + flatOptions.lockfileVersion = obj[key] && parseInt(obj[key], 10) + }, + }), + loglevel: new Definition('loglevel', { + default: 'notice', + type: [ + 'silent', + 'error', + 'warn', + 'notice', + 'http', + 'info', + 'verbose', + 'silly', + ], + description: ` + What level of logs to report. All logs are written to a debug log, + with the path to that file printed if the execution of a command fails. + + Any logs of a higher level than the setting are shown. The default is + "notice". + + See also the \`foreground-scripts\` config. + `, + flatten (key, obj, flatOptions) { + flatOptions.silent = obj[key] === 'silent' + }, + }), + 'logs-dir': new Definition('logs-dir', { + default: null, + type: [null, path], + defaultDescription: ` + A directory named \`_logs\` inside the cache + `, + description: ` + The location of npm's log directory. See [\`npm + logging\`](/using-npm/logging) for more information. + `, + }), + 'logs-max': new Definition('logs-max', { + default: 10, + type: Number, + description: ` + The maximum number of log files to store. + + If set to 0, no log files will be written for the current run. + `, + }), + long: new Definition('long', { + default: false, + type: Boolean, + short: 'l', + description: ` + Show extended information in \`ls\`, \`search\`, and \`help-search\`. + `, + }), + maxsockets: new Definition('maxsockets', { + default: 15, + type: Number, + description: ` + The maximum number of connections to use per origin (protocol/host/port + combination). + `, + flatten (key, obj, flatOptions) { + flatOptions.maxSockets = obj[key] + }, + }), + message: new Definition('message', { + default: '%s', + type: String, + short: 'm', + description: ` + Commit message which is used by \`npm version\` when creating version commit. + + Any "%s" in the message will be replaced with the version number. + `, + flatten, + }), + 'node-options': new Definition('node-options', { + default: null, + type: [null, String], + description: ` + Options to pass through to Node.js via the \`NODE_OPTIONS\` environment + variable. This does not impact how npm itself is executed but it does + impact how lifecycle scripts are called. + `, + }), + noproxy: new Definition('noproxy', { + default: '', + defaultDescription: ` + The value of the NO_PROXY environment variable + `, + type: [String, Array], + description: ` + Domain extensions that should bypass any proxies. + + Also accepts a comma-delimited string. + `, + flatten (key, obj, flatOptions) { + if (Array.isArray(obj[key])) { + flatOptions.noProxy = obj[key].join(',') + } else { + flatOptions.noProxy = obj[key] + } + }, + }), + offline: new Definition('offline', { + default: false, + type: Boolean, + description: ` + Force offline mode: no network requests will be done during install. To allow + the CLI to fill in missing cache data, see \`--prefer-offline\`. + `, + flatten, + }), + omit: new Definition('omit', { + default: process.env.NODE_ENV === 'production' ? ['dev'] : [], + defaultDescription: ` + 'dev' if the \`NODE_ENV\` environment variable is set to 'production', + otherwise empty. + `, + type: [Array, 'dev', 'optional', 'peer'], + description: ` + Dependency types to omit from the installation tree on disk. + + Note that these dependencies _are_ still resolved and added to the + \`package-lock.json\` or \`npm-shrinkwrap.json\` file. They are just + not physically installed on disk. + + If a package type appears in both the \`--include\` and \`--omit\` + lists, then it will be included. + + If the resulting omit list includes \`'dev'\`, then the \`NODE_ENV\` + environment variable will be set to \`'production'\` for all lifecycle + scripts. + `, + flatten (key, obj, flatOptions) { + flatOptions.omit = buildOmitList(obj) + }, + }), + 'omit-lockfile-registry-resolved': new Definition('omit-lockfile-registry-resolved', { + default: false, + type: Boolean, + description: ` + This option causes npm to create lock files without a \`resolved\` key for + registry dependencies. Subsequent installs will need to resolve tarball + endpoints with the configured registry, likely resulting in a longer install + time. + `, + flatten, + }), + only: new Definition('only', { + default: null, + type: [null, 'prod', 'production'], + deprecated: ` + Use \`--omit=dev\` to omit dev dependencies from the install. + `, + description: ` + When set to \`prod\` or \`production\`, this is an alias for + \`--omit=dev\`. + `, + flatten (key, obj, flatOptions) { + definitions.omit.flatten('omit', obj, flatOptions) + }, + }), + optional: new Definition('optional', { + default: null, + type: [null, Boolean], + deprecated: ` + Use \`--omit=optional\` to exclude optional dependencies, or + \`--include=optional\` to include them. + + Default value does install optional deps unless otherwise omitted. + `, + description: ` + Alias for --include=optional or --omit=optional + `, + flatten (key, obj, flatOptions) { + definitions.omit.flatten('omit', obj, flatOptions) + }, + }), + os: new Definition('os', { + default: null, + type: [null, String], + description: ` + Override OS of native modules to install. + Acceptable values are same as \`os\` field of package.json, + which comes from \`process.platform\`. + `, + flatten, + }), + otp: new Definition('otp', { + default: null, + type: [null, String], + description: ` + This is a one-time password from a two-factor authenticator. It's needed + when publishing or changing package permissions with \`npm access\`. + + If not set, and a registry response fails with a challenge for a one-time + password, npm will prompt on the command line for one. + `, + flatten (key, obj, flatOptions) { + flatten(key, obj, flatOptions) + if (obj.otp) { + obj['auth-type'] = 'legacy' + flatten('auth-type', obj, flatOptions) + } + }, + }), + package: new Definition('package', { + default: [], + hint: '', + type: [String, Array], + description: ` + The package or packages to install for [\`npm exec\`](/commands/npm-exec) + `, + flatten, + }), + 'package-lock': new Definition('package-lock', { + default: true, + type: Boolean, + description: ` + If set to false, then ignore \`package-lock.json\` files when installing. + This will also prevent _writing_ \`package-lock.json\` if \`save\` is + true. + `, + flatten: (key, obj, flatOptions) => { + flatten(key, obj, flatOptions) + if (flatOptions.packageLockOnly) { + flatOptions.packageLock = true + } + }, + }), + 'package-lock-only': new Definition('package-lock-only', { + default: false, + type: Boolean, + description: ` + If set to true, the current operation will only use the \`package-lock.json\`, + ignoring \`node_modules\`. + + For \`update\` this means only the \`package-lock.json\` will be updated, + instead of checking \`node_modules\` and downloading dependencies. + + For \`list\` this means the output will be based on the tree described by the + \`package-lock.json\`, rather than the contents of \`node_modules\`. + `, + flatten: (key, obj, flatOptions) => { + flatten(key, obj, flatOptions) + if (flatOptions.packageLockOnly) { + flatOptions.packageLock = true + } + }, + }), + 'pack-destination': new Definition('pack-destination', { + default: '.', + type: String, + description: ` + Directory in which \`npm pack\` will save tarballs. + `, + flatten, + }), + parseable: new Definition('parseable', { + default: false, + type: Boolean, + short: 'p', + description: ` + Output parseable results from commands that write to standard output. For + \`npm search\`, this will be tab-separated table format. + `, + flatten, + }), + 'prefer-dedupe': new Definition('prefer-dedupe', { + default: false, + type: Boolean, + description: ` + Prefer to deduplicate packages if possible, rather than + choosing a newer version of a dependency. + `, + flatten, + }), + 'prefer-offline': new Definition('prefer-offline', { + default: false, + type: Boolean, + description: ` + If true, staleness checks for cached data will be bypassed, but missing + data will be requested from the server. To force full offline mode, use + \`--offline\`. + `, + flatten, + }), + 'prefer-online': new Definition('prefer-online', { + default: false, + type: Boolean, + description: ` + If true, staleness checks for cached data will be forced, making the CLI + look for updates immediately even for fresh package data. + `, + flatten, + }), + // `prefix` has its default defined outside of this module + prefix: new Definition('prefix', { + type: path, + short: 'C', + default: '', + defaultDescription: ` + In global mode, the folder where the node executable is installed. + Otherwise, the nearest parent folder containing either a package.json + file or a node_modules folder. + `, + description: ` + The location to install global items. If set on the command line, then + it forces non-global commands to run in the specified folder. + `, + }), + preid: new Definition('preid', { + default: '', + hint: 'prerelease-id', + type: String, + description: ` + The "prerelease identifier" to use as a prefix for the "prerelease" part + of a semver. Like the \`rc\` in \`1.2.0-rc.8\`. + `, + flatten, + }), + production: new Definition('production', { + default: null, + type: [null, Boolean], + deprecated: 'Use `--omit=dev` instead.', + description: 'Alias for `--omit=dev`', + flatten (key, obj, flatOptions) { + definitions.omit.flatten('omit', obj, flatOptions) + }, + }), + progress: new Definition('progress', { + default: !ciInfo.isCI, + defaultDescription: ` + \`true\` unless running in a known CI system + `, + type: Boolean, + description: ` + When set to \`true\`, npm will display a progress bar during time + intensive operations, if \`process.stderr\` and \`process.stdout\` are a TTY. + + Set to \`false\` to suppress the progress bar. + `, + flatten (key, obj, flatOptions) { + flatOptions.progress = !obj.progress ? false + // progress is only written to stderr but we disable it unless stdout is a tty + // also. This prevents the progress from appearing when piping output to another + // command which doesn't break anything, but does look very odd to users. + : !!process.stderr.isTTY && !!process.stdout.isTTY && process.env.TERM !== 'dumb' + }, + }), + provenance: new Definition('provenance', { + default: false, + type: Boolean, + exclusive: ['provenance-file'], + description: ` + When publishing from a supported cloud CI/CD system, the package will be + publicly linked to where it was built and published from. + `, + flatten, + }), + 'provenance-file': new Definition('provenance-file', { + default: null, + type: path, + hint: '', + exclusive: ['provenance'], + description: ` + When publishing, the provenance bundle at the given path will be used. + `, + flatten, + }), + proxy: new Definition('proxy', { + default: null, + type: [null, false, url], // allow proxy to be disabled explicitly + description: ` + A proxy to use for outgoing http requests. If the \`HTTP_PROXY\` or + \`http_proxy\` environment variables are set, proxy settings will be + honored by the underlying \`request\` library. + `, + flatten, + }), + 'read-only': new Definition('read-only', { + default: false, + type: Boolean, + description: ` + This is used to mark a token as unable to publish when configuring + limited access tokens with the \`npm token create\` command. + `, + flatten, + }), + 'rebuild-bundle': new Definition('rebuild-bundle', { + default: true, + type: Boolean, + description: ` + Rebuild bundled dependencies after installation. + `, + flatten, + }), + registry: new Definition('registry', { + default: 'https://registry.npmjs.org/', + type: url, + description: ` + The base URL of the npm registry. + `, + flatten, + }), + 'replace-registry-host': new Definition('replace-registry-host', { + default: 'npmjs', + hint: ' | hostname', + type: ['npmjs', 'never', 'always', String], + description: ` + Defines behavior for replacing the registry host in a lockfile with the + configured registry. + + The default behavior is to replace package dist URLs from the default + registry (https://registry.npmjs.org) to the configured registry. If set to + "never", then use the registry value. If set to "always", then replace the + registry host with the configured host every time. + + You may also specify a bare hostname (e.g., "registry.npmjs.org"). + `, + flatten, + }), + save: new Definition('save', { + default: true, + defaultDescription: `\`true\` unless when using \`npm update\` where it + defaults to \`false\``, + usage: '-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle', + type: Boolean, + short: 'S', + description: ` + Save installed packages to a \`package.json\` file as dependencies. + + When used with the \`npm rm\` command, removes the dependency from + \`package.json\`. + + Will also prevent writing to \`package-lock.json\` if set to \`false\`. + `, + flatten, + }), + 'save-bundle': new Definition('save-bundle', { + default: false, + type: Boolean, + short: 'B', + description: ` + If a package would be saved at install time by the use of \`--save\`, + \`--save-dev\`, or \`--save-optional\`, then also put it in the + \`bundleDependencies\` list. + + Ignored if \`--save-peer\` is set, since peerDependencies cannot be bundled. + `, + flatten (key, obj, flatOptions) { + // XXX update arborist to just ignore it if resulting saveType is peer + // otherwise this won't have the expected effect: + // + // npm config set save-peer true + // npm i foo --save-bundle --save-prod <-- should bundle + flatOptions.saveBundle = obj['save-bundle'] && !obj['save-peer'] + }, + }), + 'save-dev': new Definition('save-dev', { + default: false, + type: Boolean, + short: 'D', + description: ` + Save installed packages to a package.json file as \`devDependencies\`. + `, + flatten (key, obj, flatOptions) { + if (!obj[key]) { + if (flatOptions.saveType === 'dev') { + delete flatOptions.saveType + } + return + } + + flatOptions.saveType = 'dev' + }, + }), + 'save-exact': new Definition('save-exact', { + default: false, + type: Boolean, + short: 'E', + description: ` + Dependencies saved to package.json will be configured with an exact + version rather than using npm's default semver range operator. + `, + flatten (key, obj, flatOptions) { + // just call the save-prefix flattener, it reads from obj['save-exact'] + definitions['save-prefix'].flatten('save-prefix', obj, flatOptions) + }, + }), + 'save-optional': new Definition('save-optional', { + default: false, + type: Boolean, + short: 'O', + description: ` + Save installed packages to a package.json file as + \`optionalDependencies\`. + `, + flatten (key, obj, flatOptions) { + if (!obj[key]) { + if (flatOptions.saveType === 'optional') { + delete flatOptions.saveType + } else if (flatOptions.saveType === 'peerOptional') { + flatOptions.saveType = 'peer' + } + return + } + + if (flatOptions.saveType === 'peerOptional') { + return + } + + if (flatOptions.saveType === 'peer') { + flatOptions.saveType = 'peerOptional' + } else { + flatOptions.saveType = 'optional' + } + }, + }), + 'save-peer': new Definition('save-peer', { + default: false, + type: Boolean, + description: ` + Save installed packages to a package.json file as \`peerDependencies\` + `, + flatten (key, obj, flatOptions) { + if (!obj[key]) { + if (flatOptions.saveType === 'peer') { + delete flatOptions.saveType + } else if (flatOptions.saveType === 'peerOptional') { + flatOptions.saveType = 'optional' + } + return + } + + if (flatOptions.saveType === 'peerOptional') { + return + } + + if (flatOptions.saveType === 'optional') { + flatOptions.saveType = 'peerOptional' + } else { + flatOptions.saveType = 'peer' + } + }, + }), + 'save-prefix': new Definition('save-prefix', { + default: '^', + type: String, + description: ` + Configure how versions of packages installed to a package.json file via + \`--save\` or \`--save-dev\` get prefixed. + + For example if a package has version \`1.2.3\`, by default its version is + set to \`^1.2.3\` which allows minor upgrades for that package, but after + \`npm config set save-prefix='~'\` it would be set to \`~1.2.3\` which + only allows patch upgrades. + `, + flatten (key, obj, flatOptions) { + flatOptions.savePrefix = obj['save-exact'] ? '' : obj['save-prefix'] + obj['save-prefix'] = flatOptions.savePrefix + }, + }), + 'save-prod': new Definition('save-prod', { + default: false, + type: Boolean, + short: 'P', + description: ` + Save installed packages into \`dependencies\` specifically. This is + useful if a package already exists in \`devDependencies\` or + \`optionalDependencies\`, but you want to move it to be a non-optional + production dependency. + + This is the default behavior if \`--save\` is true, and neither + \`--save-dev\` or \`--save-optional\` are true. + `, + flatten (key, obj, flatOptions) { + if (!obj[key]) { + if (flatOptions.saveType === 'prod') { + delete flatOptions.saveType + } + return + } + + flatOptions.saveType = 'prod' + }, + }), + 'sbom-format': new Definition('sbom-format', { + default: null, + type: [ + 'cyclonedx', + 'spdx', + ], + description: ` + SBOM format to use when generating SBOMs. + `, + flatten, + }), + 'sbom-type': new Definition('sbom-type', { + default: 'library', + type: [ + 'library', + 'application', + 'framework', + ], + description: ` + The type of package described by the generated SBOM. For SPDX, this is the + value for the \`primaryPackagePurpose\` field. For CycloneDX, this is the + value for the \`type\` field. + `, + flatten, + }), + scope: new Definition('scope', { + default: '', + defaultDescription: ` + the scope of the current project, if any, or "" + `, + type: String, + hint: '<@scope>', + description: ` + Associate an operation with a scope for a scoped registry. + + Useful when logging in to or out of a private registry: + + \`\`\` + # log in, linking the scope to the custom registry + npm login --scope=@mycorp --registry=https://registry.mycorp.com + + # log out, removing the link and the auth token + npm logout --scope=@mycorp + \`\`\` + + This will cause \`@mycorp\` to be mapped to the registry for future + installation of packages specified according to the pattern + \`@mycorp/package\`. + + This will also cause \`npm init\` to create a scoped package. + + \`\`\` + # accept all defaults, and create a package named "@foo/whatever", + # instead of just named "whatever" + npm init --scope=@foo --yes + \`\`\` + `, + flatten (key, obj, flatOptions) { + const value = obj[key] + const scope = value && !/^@/.test(value) ? `@${value}` : value + flatOptions.scope = scope + // projectScope is kept for compatibility with npm-registry-fetch + flatOptions.projectScope = scope + }, + }), + 'script-shell': new Definition('script-shell', { + default: null, + defaultDescription: ` + '/bin/sh' on POSIX systems, 'cmd.exe' on Windows + `, + type: [null, String], + description: ` + The shell to use for scripts run with the \`npm exec\`, + \`npm run\` and \`npm init \` commands. + `, + flatten (key, obj, flatOptions) { + flatOptions.scriptShell = obj[key] || undefined + }, + }), + searchexclude: new Definition('searchexclude', { + default: '', + type: String, + description: ` + Space-separated options that limit the results from search. + `, + flatten (key, obj, flatOptions) { + flatOptions.search = flatOptions.search || { limit: 20 } + flatOptions.search.exclude = obj[key].toLowerCase() + }, + }), + searchlimit: new Definition('searchlimit', { + default: 20, + type: Number, + description: ` + Number of items to limit search results to. Will not apply at all to + legacy searches. + `, + flatten (key, obj, flatOptions) { + flatOptions.search = flatOptions.search || {} + flatOptions.search.limit = obj[key] + }, + }), + searchopts: new Definition('searchopts', { + default: '', + type: String, + description: ` + Space-separated options that are always passed to search. + `, + flatten (key, obj, flatOptions) { + flatOptions.search = flatOptions.search || { limit: 20 } + flatOptions.search.opts = querystring.parse(obj[key]) + }, + }), + searchstaleness: new Definition('searchstaleness', { + default: 15 * 60, + type: Number, + description: ` + The age of the cache, in seconds, before another registry request is made + if using legacy search endpoint. + `, + flatten (key, obj, flatOptions) { + flatOptions.search = flatOptions.search || { limit: 20 } + flatOptions.search.staleness = obj[key] + }, + }), + shell: new Definition('shell', { + default: shell, + defaultDescription: ` + SHELL environment variable, or "bash" on Posix, or "cmd.exe" on Windows + `, + type: String, + description: ` + The shell to run for the \`npm explore\` command. + `, + flatten, + }), + shrinkwrap: new Definition('shrinkwrap', { + default: true, + type: Boolean, + deprecated: ` + Use the --package-lock setting instead. + `, + description: ` + Alias for --package-lock + `, + flatten (key, obj, flatOptions) { + obj['package-lock'] = obj.shrinkwrap + definitions['package-lock'].flatten('package-lock', obj, flatOptions) + }, + }), + 'sign-git-commit': new Definition('sign-git-commit', { + default: false, + type: Boolean, + description: ` + If set to true, then the \`npm version\` command will commit the new + package version using \`-S\` to add a signature. + + Note that git requires you to have set up GPG keys in your git configs + for this to work properly. + `, + flatten, + }), + 'sign-git-tag': new Definition('sign-git-tag', { + default: false, + type: Boolean, + description: ` + If set to true, then the \`npm version\` command will tag the version + using \`-s\` to add a signature. + + Note that git requires you to have set up GPG keys in your git configs + for this to work properly. + `, + flatten, + }), + 'strict-peer-deps': new Definition('strict-peer-deps', { + default: false, + type: Boolean, + description: ` + If set to \`true\`, and \`--legacy-peer-deps\` is not set, then _any_ + conflicting \`peerDependencies\` will be treated as an install failure, + even if npm could reasonably guess the appropriate resolution based on + non-peer dependency relationships. + + By default, conflicting \`peerDependencies\` deep in the dependency graph + will be resolved using the nearest non-peer dependency specification, + even if doing so will result in some packages receiving a peer dependency + outside the range set in their package's \`peerDependencies\` object. + + When such an override is performed, a warning is printed, explaining the + conflict and the packages involved. If \`--strict-peer-deps\` is set, + then this warning is treated as a failure. + `, + flatten, + }), + 'strict-ssl': new Definition('strict-ssl', { + default: true, + type: Boolean, + description: ` + Whether or not to do SSL key validation when making requests to the + registry via https. + + See also the \`ca\` config. + `, + flatten (key, obj, flatOptions) { + flatOptions.strictSSL = obj[key] + }, + }), + tag: new Definition('tag', { + default: 'latest', + type: String, + description: ` + If you ask npm to install a package and don't tell it a specific version, + then it will install the specified tag. + + It is the tag added to the package@version specified in the + \`npm dist-tag add\` command, if no explicit tag is given. + + When used by the \`npm diff\` command, this is the tag used to fetch the + tarball that will be compared with the local files by default. + + If used in the \`npm publish\` command, this is the tag that will be + added to the package submitted to the registry. + `, + flatten (key, obj, flatOptions) { + flatOptions.defaultTag = obj[key] + }, + }), + 'tag-version-prefix': new Definition('tag-version-prefix', { + default: 'v', + type: String, + description: ` + If set, alters the prefix used when tagging a new version when performing + a version increment using \`npm version\`. To remove the prefix + altogether, set it to the empty string: \`""\`. + + Because other tools may rely on the convention that npm version tags look + like \`v1.0.0\`, _only use this property if it is absolutely necessary_. + In particular, use care when overriding this setting for public packages. + `, + flatten, + }), + timing: new Definition('timing', { + default: false, + type: Boolean, + description: ` + If true, writes timing information to a process specific json file in + the cache or \`logs-dir\`. The file name ends with \`-timing.json\`. + + You can quickly view it with this [json](https://npm.im/json) command + line: \`cat ~/.npm/_logs/*-timing.json | npm exec -- json -g\`. + + Timing information will also be reported in the terminal. To suppress this + while still writing the timing file, use \`--silent\`. + `, + }), + umask: new Definition('umask', { + default: 0, + type: Umask, + description: ` + The "umask" value to use when setting the file creation mode on files and + folders. + + Folders and executables are given a mode which is \`0o777\` masked + against this value. Other files are given a mode which is \`0o666\` + masked against this value. + + Note that the underlying system will _also_ apply its own umask value to + files and folders that are created, and npm does not circumvent this, but + rather adds the \`--umask\` config to it. + + Thus, the effective default umask value on most POSIX systems is 0o22, + meaning that folders and executables are created with a mode of 0o755 and + other files are created with a mode of 0o644. + `, + flatten, + }), + unicode: new Definition('unicode', { + default: unicode, + defaultDescription: ` + false on windows, true on mac/unix systems with a unicode locale, as + defined by the \`LC_ALL\`, \`LC_CTYPE\`, or \`LANG\` environment variables. + `, + type: Boolean, + description: ` + When set to true, npm uses unicode characters in the tree output. When + false, it uses ascii characters instead of unicode glyphs. + `, + flatten, + }), + 'update-notifier': new Definition('update-notifier', { + default: true, + type: Boolean, + description: ` + Set to false to suppress the update notification when using an older + version of npm than the latest. + `, + }), + usage: new Definition('usage', { + default: false, + type: Boolean, + short: ['?', 'H', 'h'], + description: ` + Show short usage output about the command specified. + `, + }), + 'user-agent': new Definition('user-agent', { + default: 'npm/{npm-version} ' + + 'node/{node-version} ' + + '{platform} ' + + '{arch} ' + + 'workspaces/{workspaces} ' + + '{ci}', + type: String, + description: ` + Sets the User-Agent request header. The following fields are replaced + with their actual counterparts: + + * \`{npm-version}\` - The npm version in use + * \`{node-version}\` - The Node.js version in use + * \`{platform}\` - The value of \`process.platform\` + * \`{arch}\` - The value of \`process.arch\` + * \`{workspaces}\` - Set to \`true\` if the \`workspaces\` or \`workspace\` + options are set. + * \`{ci}\` - The value of the \`ci-name\` config, if set, prefixed with + \`ci/\`, or an empty string if \`ci-name\` is empty. + `, + flatten (key, obj, flatOptions) { + const value = obj[key] + const ciName = ciInfo.name?.toLowerCase().split(' ').join('-') || null + let inWorkspaces = false + if (obj.workspaces || obj.workspace && obj.workspace.length) { + inWorkspaces = true + } + flatOptions.userAgent = + value.replace(/\{node-version\}/gi, process.version) + .replace(/\{npm-version\}/gi, obj['npm-version']) + .replace(/\{platform\}/gi, process.platform) + .replace(/\{arch\}/gi, process.arch) + .replace(/\{workspaces\}/gi, inWorkspaces) + .replace(/\{ci\}/gi, ciName ? `ci/${ciName}` : '') + .trim() + + // We can't clobber the original or else subsequent flattening will fail + // (i.e. when we change the underlying config values) + // obj[key] = flatOptions.userAgent + + // user-agent is a unique kind of config item that gets set from a template + // and ends up translated. Because of this, the normal "should we set this + // to process.env also doesn't work + process.env.npm_config_user_agent = flatOptions.userAgent + }, + }), + userconfig: new Definition('userconfig', { + default: '~/.npmrc', + type: path, + description: ` + The location of user-level configuration settings. + + This may be overridden by the \`npm_config_userconfig\` environment + variable or the \`--userconfig\` command line option, but may _not_ + be overridden by settings in the \`globalconfig\` file. + `, + }), + version: new Definition('version', { + default: false, + type: Boolean, + short: 'v', + description: ` + If true, output the npm version and exit successfully. + + Only relevant when specified explicitly on the command line. + `, + }), + versions: new Definition('versions', { + default: false, + type: Boolean, + description: ` + If true, output the npm version as well as node's \`process.versions\` + map and the version in the current working directory's \`package.json\` + file if one exists, and exit successfully. + + Only relevant when specified explicitly on the command line. + `, + }), + viewer: new Definition('viewer', { + default: isWindows ? 'browser' : 'man', + defaultDescription: ` + "man" on Posix, "browser" on Windows + `, + type: String, + description: ` + The program to use to view help content. + + Set to \`"browser"\` to view html help content in the default web browser. + `, + }), + which: new Definition('which', { + default: null, + hint: '', + type: [null, Number], + description: ` + If there are multiple funding sources, which 1-indexed source URL to open. + `, + }), + workspace: new Definition('workspace', { + default: [], + type: [String, Array], + hint: '', + short: 'w', + envExport: false, + description: ` + Enable running a command in the context of the configured workspaces of the + current project while filtering by running only the workspaces defined by + this configuration option. + + Valid values for the \`workspace\` config are either: + + * Workspace names + * Path to a workspace directory + * Path to a parent workspace directory (will result in selecting all + workspaces within that folder) + + When set for the \`npm init\` command, this may be set to the folder of + a workspace which does not yet exist, to create the folder and set it + up as a brand new workspace within the project. + `, + flatten: (key, obj, flatOptions) => { + definitions['user-agent'].flatten('user-agent', obj, flatOptions) + }, + }), + workspaces: new Definition('workspaces', { + default: null, + type: [null, Boolean], + short: 'ws', + envExport: false, + description: ` + Set to true to run the command in the context of **all** configured + workspaces. + + Explicitly setting this to false will cause commands like \`install\` to + ignore workspaces altogether. + When not set explicitly: + + - Commands that operate on the \`node_modules\` tree (install, update, + etc.) will link workspaces into the \`node_modules\` folder. + - Commands that do other things (test, exec, publish, etc.) will operate + on the root project, _unless_ one or more workspaces are specified in + the \`workspace\` config. + `, + flatten: (key, obj, flatOptions) => { + definitions['user-agent'].flatten('user-agent', obj, flatOptions) + + // TODO: this is a derived value, and should be reworked when we have a + // pattern for derived value + + // workspacesEnabled is true whether workspaces is null or true + // commands contextually work with workspaces or not regardless of + // configuration, so we need an option specifically to disable workspaces + flatOptions.workspacesEnabled = obj[key] !== false + }, + }), + 'workspaces-update': new Definition('workspaces-update', { + default: true, + type: Boolean, + description: ` + If set to true, the npm cli will run an update after operations that may + possibly change the workspaces installed to the \`node_modules\` folder. + `, + flatten, + }), + yes: new Definition('yes', { + default: null, + type: [null, Boolean], + short: 'y', + description: ` + Automatically answer "yes" to any prompts that npm might print on + the command line. + `, + }), +} + +module.exports = definitions diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/definitions/index.js b/node_modules/npm/node_modules/@npmcli/config/lib/definitions/index.js new file mode 100644 index 00000000..8255a904 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/definitions/index.js @@ -0,0 +1,66 @@ +const definitions = require('./definitions.js') + +// use the defined flattening function, and copy over any scoped +// registries and registry-specific "nerfdart" configs verbatim +// +// TODO: make these getters so that we only have to make dirty +// the thing that changed, and then flatten the fields that +// could have changed when a config.set is called. +// +// TODO: move nerfdart auth stuff into a nested object that +// is only passed along to paths that end up calling npm-registry-fetch. +const flatten = (obj, flat = {}) => { + for (const [key, val] of Object.entries(obj)) { + const def = definitions[key] + if (def && def.flatten) { + def.flatten(key, obj, flat) + } else if (/@.*:registry$/i.test(key) || /^\/\//.test(key)) { + flat[key] = val + } + } + return flat +} + +const definitionProps = Object.entries(definitions) + .reduce((acc, [key, { short = [], default: d }]) => { + // can be either an array or string + for (const s of [].concat(short)) { + acc.shorthands[s] = [`--${key}`] + } + acc.defaults[key] = d + return acc + }, { shorthands: {}, defaults: {} }) + +// aliases where they get expanded into a completely different thing +// these are NOT supported in the environment or npmrc files, only +// expanded on the CLI. +// TODO: when we switch off of nopt, use an arg parser that supports +// more reasonable aliasing and short opts right in the definitions set. +const shorthands = { + 'enjoy-by': ['--before'], + d: ['--loglevel', 'info'], + dd: ['--loglevel', 'verbose'], + ddd: ['--loglevel', 'silly'], + quiet: ['--loglevel', 'warn'], + q: ['--loglevel', 'warn'], + s: ['--loglevel', 'silent'], + silent: ['--loglevel', 'silent'], + verbose: ['--loglevel', 'verbose'], + desc: ['--description'], + help: ['--usage'], + local: ['--no-global'], + n: ['--no-yes'], + no: ['--no-yes'], + porcelain: ['--parseable'], + readonly: ['--read-only'], + reg: ['--registry'], + iwr: ['--include-workspace-root'], + ...definitionProps.shorthands, +} + +module.exports = { + defaults: definitionProps.defaults, + definitions, + flatten, + shorthands, +} diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/env-replace.js b/node_modules/npm/node_modules/@npmcli/config/lib/env-replace.js new file mode 100644 index 00000000..c851f6e4 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/env-replace.js @@ -0,0 +1,14 @@ +// replace any ${ENV} values with the appropriate environ. + +const envExpr = /(? f.replace(envExpr, (orig, esc, name) => { + const val = env[name] !== undefined ? env[name] : `$\{${name}}` + + // consume the escape chars that are relevant. + if (esc.length % 2) { + return orig.slice((esc.length + 1) / 2) + } + + return (esc.slice(esc.length / 2)) + val +}) diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/errors.js b/node_modules/npm/node_modules/@npmcli/config/lib/errors.js new file mode 100644 index 00000000..61615091 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/errors.js @@ -0,0 +1,23 @@ +'use strict' + +class ErrInvalidAuth extends Error { + constructor (problems) { + let message = 'Invalid auth configuration found: ' + message += problems.map((problem) => { + // istanbul ignore else + if (problem.action === 'delete') { + return `\`${problem.key}\` is not allowed in ${problem.where} config` + } else if (problem.action === 'rename') { + return `\`${problem.from}\` must be renamed to \`${problem.to}\` in ${problem.where} config` + } + }).join(', ') + message += '\nPlease run `npm config fix` to repair your configuration.`' + super(message) + this.code = 'ERR_INVALID_AUTH' + this.problems = problems + } +} + +module.exports = { + ErrInvalidAuth, +} diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/index.js b/node_modules/npm/node_modules/@npmcli/config/lib/index.js new file mode 100644 index 00000000..4aa76d8e --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/index.js @@ -0,0 +1,931 @@ +// TODO: set the scope config from package.json or explicit cli config +const { walkUp } = require('walk-up-path') +const ini = require('ini') +const nopt = require('nopt') +const { log, time } = require('proc-log') + +const { resolve, dirname, join } = require('node:path') +const { homedir } = require('node:os') +const { + readFile, + writeFile, + chmod, + unlink, + stat, + mkdir, +} = require('node:fs/promises') + +const fileExists = (...p) => stat(resolve(...p)) + .then((st) => st.isFile()) + .catch(() => false) + +const dirExists = (...p) => stat(resolve(...p)) + .then((st) => st.isDirectory()) + .catch(() => false) + +const hasOwnProperty = (obj, key) => + Object.prototype.hasOwnProperty.call(obj, key) + +const typeDefs = require('./type-defs.js') +const nerfDart = require('./nerf-dart.js') +const envReplace = require('./env-replace.js') +const parseField = require('./parse-field.js') +const setEnvs = require('./set-envs.js') + +// types that can be saved back to +const confFileTypes = new Set([ + 'global', + 'user', + 'project', +]) + +const confTypes = new Set([ + 'default', + 'builtin', + ...confFileTypes, + 'env', + 'cli', +]) + +class Config { + #loaded = false + #flatten + // populated the first time we flatten the object + #flatOptions = null + + static get typeDefs () { + return typeDefs + } + + constructor ({ + definitions, + shorthands, + flatten, + npmPath, + + // options just to override in tests, mostly + env = process.env, + argv = process.argv, + platform = process.platform, + execPath = process.execPath, + cwd = process.cwd(), + excludeNpmCwd = false, + }) { + // turn the definitions into nopt's weirdo syntax + this.definitions = definitions + const types = {} + const defaults = {} + this.deprecated = {} + for (const [key, def] of Object.entries(definitions)) { + defaults[key] = def.default + types[key] = def.type + if (def.deprecated) { + this.deprecated[key] = def.deprecated.trim().replace(/\n +/, '\n') + } + } + + this.#flatten = flatten + this.types = types + this.shorthands = shorthands + this.defaults = defaults + + this.npmPath = npmPath + this.npmBin = join(this.npmPath, 'bin/npm-cli.js') + this.argv = argv + this.env = env + this.execPath = execPath + this.platform = platform + this.cwd = cwd + this.excludeNpmCwd = excludeNpmCwd + + // set when we load configs + this.globalPrefix = null + this.localPrefix = null + this.localPackage = null + + // defaults to env.HOME, but will always be *something* + this.home = null + + // set up the prototype chain of config objects + const wheres = [...confTypes] + this.data = new Map() + let parent = null + for (const where of wheres) { + this.data.set(where, parent = new ConfigData(parent)) + } + + this.data.set = () => { + throw new Error('cannot change internal config data structure') + } + this.data.delete = () => { + throw new Error('cannot change internal config data structure') + } + + this.sources = new Map([]) + + this.list = [] + for (const { data } of this.data.values()) { + this.list.unshift(data) + } + Object.freeze(this.list) + + this.#loaded = false + } + + get loaded () { + return this.#loaded + } + + get prefix () { + return this.#get('global') ? this.globalPrefix : this.localPrefix + } + + // return the location where key is found. + find (key) { + if (!this.loaded) { + throw new Error('call config.load() before reading values') + } + + // have to look in reverse order + const entries = [...this.data.entries()] + for (let i = entries.length - 1; i > -1; i--) { + const [where, { data }] = entries[i] + if (hasOwnProperty(data, key)) { + return where + } + } + return null + } + + get (key, where) { + if (!this.loaded) { + throw new Error('call config.load() before reading values') + } + return this.#get(key, where) + } + + // we need to get values sometimes, so use this internal one to do so + // while in the process of loading. + #get (key, where = null) { + if (where !== null && !confTypes.has(where)) { + throw new Error('invalid config location param: ' + where) + } + const { data } = this.data.get(where || 'cli') + return where === null || hasOwnProperty(data, key) ? data[key] : undefined + } + + set (key, val, where = 'cli') { + if (!this.loaded) { + throw new Error('call config.load() before setting values') + } + if (!confTypes.has(where)) { + throw new Error('invalid config location param: ' + where) + } + this.#checkDeprecated(key) + const { data, raw } = this.data.get(where) + data[key] = val + if (['global', 'user', 'project'].includes(where)) { + raw[key] = val + } + + // this is now dirty, the next call to this.valid will have to check it + this.data.get(where)[_valid] = null + + // the flat options are invalidated, regenerate next time they're needed + this.#flatOptions = null + } + + get flat () { + if (this.#flatOptions) { + return this.#flatOptions + } + + // create the object for flat options passed to deps + const timeEnd = time.start('config:load:flatten') + this.#flatOptions = {} + // walk from least priority to highest + for (const { data } of this.data.values()) { + this.#flatten(data, this.#flatOptions) + } + this.#flatOptions.nodeBin = this.execPath + this.#flatOptions.npmBin = this.npmBin + timeEnd() + + return this.#flatOptions + } + + delete (key, where = 'cli') { + if (!this.loaded) { + throw new Error('call config.load() before deleting values') + } + if (!confTypes.has(where)) { + throw new Error('invalid config location param: ' + where) + } + const { data, raw } = this.data.get(where) + delete data[key] + if (['global', 'user', 'project'].includes(where)) { + delete raw[key] + } + } + + async load () { + if (this.loaded) { + throw new Error('attempting to load npm config multiple times') + } + + // first load the defaults, which sets the global prefix + this.loadDefaults() + + // next load the builtin config, as this sets new effective defaults + await this.loadBuiltinConfig() + + // cli and env are not async, and can set the prefix, relevant to project + this.loadCLI() + this.loadEnv() + + // next project config, which can affect userconfig location + await this.loadProjectConfig() + + // then user config, which can affect globalconfig location + await this.loadUserConfig() + + // last but not least, global config file + await this.loadGlobalConfig() + + // set this before calling setEnvs, so that we don't have to share + // private attributes, as that module also does a bunch of get operations + this.#loaded = true + + // set proper globalPrefix now that everything is loaded + this.globalPrefix = this.get('prefix') + + this.setEnvs() + } + + loadDefaults () { + this.loadGlobalPrefix() + this.loadHome() + + const defaultsObject = { + ...this.defaults, + prefix: this.globalPrefix, + } + + try { + defaultsObject['npm-version'] = require(join(this.npmPath, 'package.json')).version + } catch { + // in some weird state where the passed in npmPath does not have a package.json + // this will never happen in npm, but is guarded here in case this is consumed + // in other ways + tests + } + + this.#loadObject(defaultsObject, 'default', 'default values') + + const { data } = this.data.get('default') + + // if the prefix is set on cli, env, or userconfig, then we need to + // default the globalconfig file to that location, instead of the default + // global prefix. It's weird that `npm get globalconfig --prefix=/foo` + // returns `/foo/etc/npmrc`, but better to not change it at this point. + // define a custom getter, but turn into a normal prop + // if we set it. otherwise it can't be set on child objects + Object.defineProperty(data, 'globalconfig', { + get: () => resolve(this.#get('prefix'), 'etc/npmrc'), + set (value) { + Object.defineProperty(data, 'globalconfig', { + value, + configurable: true, + writable: true, + enumerable: true, + }) + }, + configurable: true, + enumerable: true, + }) + } + + loadHome () { + this.home = this.env.HOME || homedir() + } + + loadGlobalPrefix () { + if (this.globalPrefix) { + throw new Error('cannot load default global prefix more than once') + } + + if (this.env.PREFIX) { + this.globalPrefix = this.env.PREFIX + } else if (this.platform === 'win32') { + // c:\node\node.exe --> prefix=c:\node\ + this.globalPrefix = dirname(this.execPath) + } else { + // /usr/local/bin/node --> prefix=/usr/local + this.globalPrefix = dirname(dirname(this.execPath)) + + // destdir only is respected on Unix + if (this.env.DESTDIR) { + this.globalPrefix = join(this.env.DESTDIR, this.globalPrefix) + } + } + } + + loadEnv () { + const conf = Object.create(null) + for (const [envKey, envVal] of Object.entries(this.env)) { + if (!/^npm_config_/i.test(envKey) || envVal === '') { + continue + } + let key = envKey.slice('npm_config_'.length) + if (!key.startsWith('//')) { // don't normalize nerf-darted keys + key = key.replace(/(?!^)_/g, '-') // don't replace _ at the start of the key + .toLowerCase() + } + conf[key] = envVal + } + this.#loadObject(conf, 'env', 'environment') + } + + loadCLI () { + nopt.invalidHandler = (k, val, type) => + this.invalidHandler(k, val, type, 'command line options', 'cli') + const conf = nopt(this.types, this.shorthands, this.argv) + nopt.invalidHandler = null + this.parsedArgv = conf.argv + delete conf.argv + this.#loadObject(conf, 'cli', 'command line options') + } + + get valid () { + for (const [where, { valid }] of this.data.entries()) { + if (valid === false || valid === null && !this.validate(where)) { + return false + } + } + return true + } + + validate (where) { + if (!where) { + let valid = true + const authProblems = [] + + for (const entryWhere of this.data.keys()) { + // no need to validate our defaults, we know they're fine + // cli was already validated when parsed the first time + if (entryWhere === 'default' || entryWhere === 'builtin' || entryWhere === 'cli') { + continue + } + const ret = this.validate(entryWhere) + valid = valid && ret + + if (['global', 'user', 'project'].includes(entryWhere)) { + // after validating everything else, we look for old auth configs we no longer support + // if these keys are found, we build up a list of them and the appropriate action and + // attach it as context on the thrown error + + // first, keys that should be removed + for (const key of ['_authtoken', '-authtoken']) { + if (this.get(key, entryWhere)) { + authProblems.push({ action: 'delete', key, where: entryWhere }) + } + } + + // NOTE we pull registry without restricting to the current 'where' because we want to + // suggest scoping things to the registry they would be applied to, which is the default + // regardless of where it was defined + const nerfedReg = nerfDart(this.get('registry')) + // keys that should be nerfed but currently are not + for (const key of ['_auth', '_authToken', 'username', '_password']) { + if (this.get(key, entryWhere)) { + // username and _password must both exist in the same file to be recognized correctly + if (key === 'username' && !this.get('_password', entryWhere)) { + authProblems.push({ action: 'delete', key, where: entryWhere }) + } else if (key === '_password' && !this.get('username', entryWhere)) { + authProblems.push({ action: 'delete', key, where: entryWhere }) + } else { + authProblems.push({ + action: 'rename', + from: key, + to: `${nerfedReg}:${key}`, + where: entryWhere, + }) + } + } + } + } + } + + if (authProblems.length) { + const { ErrInvalidAuth } = require('./errors.js') + throw new ErrInvalidAuth(authProblems) + } + + return valid + } else { + const obj = this.data.get(where) + obj[_valid] = true + + nopt.invalidHandler = (k, val, type) => + this.invalidHandler(k, val, type, obj.source, where) + + nopt.clean(obj.data, this.types, typeDefs) + + nopt.invalidHandler = null + return obj[_valid] + } + } + + // fixes problems identified by validate(), accepts the 'problems' property from a thrown + // ErrInvalidAuth to avoid having to check everything again + repair (problems) { + if (!problems) { + try { + this.validate() + } catch (err) { + // coverage skipped here because we don't need to test re-throwing an error + // istanbul ignore next + if (err.code !== 'ERR_INVALID_AUTH') { + throw err + } + + problems = err.problems + } finally { + if (!problems) { + problems = [] + } + } + } + + for (const problem of problems) { + // coverage disabled for else branch because it doesn't do anything and shouldn't + // istanbul ignore else + if (problem.action === 'delete') { + this.delete(problem.key, problem.where) + } else if (problem.action === 'rename') { + const raw = this.data.get(problem.where).raw?.[problem.from] + const calculated = this.get(problem.from, problem.where) + this.set(problem.to, raw || calculated, problem.where) + this.delete(problem.from, problem.where) + } + } + } + + // Returns true if the value is coming directly from the source defined + // in default definitions, if the current value for the key config is + // coming from any other different source, returns false + isDefault (key) { + const [defaultType, ...types] = [...confTypes] + const defaultData = this.data.get(defaultType).data + + return hasOwnProperty(defaultData, key) + && types.every(type => { + const typeData = this.data.get(type).data + return !hasOwnProperty(typeData, key) + }) + } + + invalidHandler (k, val, type, source, where) { + const typeDescription = require('./type-description.js') + log.warn( + 'invalid config', + k + '=' + JSON.stringify(val), + `set in ${source}` + ) + this.data.get(where)[_valid] = false + + if (Array.isArray(type)) { + if (type.includes(typeDefs.url.type)) { + type = typeDefs.url.type + } else { + /* istanbul ignore if - no actual configs matching this, but + * path types SHOULD be handled this way, like URLs, for the + * same reason */ + if (type.includes(typeDefs.path.type)) { + type = typeDefs.path.type + } + } + } + + const typeDesc = typeDescription(type) + const mustBe = typeDesc + .filter(m => m !== undefined && m !== Array) + const msg = 'Must be' + this.#getOneOfKeywords(mustBe, typeDesc) + const desc = mustBe.length === 1 ? mustBe[0] + : [...new Set(mustBe.map(n => typeof n === 'string' ? n : JSON.stringify(n)))].join(', ') + log.warn('invalid config', msg, desc) + } + + #getOneOfKeywords (mustBe, typeDesc) { + let keyword + if (mustBe.length === 1 && typeDesc.includes(Array)) { + keyword = ' one or more' + } else if (mustBe.length > 1 && typeDesc.includes(Array)) { + keyword = ' one or more of:' + } else if (mustBe.length > 1) { + keyword = ' one of:' + } else { + keyword = '' + } + return keyword + } + + #loadObject (obj, where, source, er = null) { + // obj is the raw data read from the file + const conf = this.data.get(where) + if (conf.source) { + const m = `double-loading "${where}" configs from ${source}, ` + + `previously loaded from ${conf.source}` + throw new Error(m) + } + + if (this.sources.has(source)) { + const m = `double-loading config "${source}" as "${where}", ` + + `previously loaded as "${this.sources.get(source)}"` + throw new Error(m) + } + + conf.source = source + this.sources.set(source, where) + if (er) { + conf.loadError = er + if (er.code !== 'ENOENT') { + log.verbose('config', `error loading ${where} config`, er) + } + } else { + conf.raw = obj + for (const [key, value] of Object.entries(obj)) { + const k = envReplace(key, this.env) + const v = this.parseField(value, k) + if (where !== 'default') { + this.#checkDeprecated(k) + if (this.definitions[key]?.exclusive) { + for (const exclusive of this.definitions[key].exclusive) { + if (!this.isDefault(exclusive)) { + throw new TypeError(`--${key} can not be provided when using --${exclusive}`) + } + } + } + } + conf.data[k] = v + } + } + } + + #checkDeprecated (key) { + // XXX(npm9+) make this throw an error + if (this.deprecated[key]) { + log.warn('config', key, this.deprecated[key]) + } + } + + // Parse a field, coercing it to the best type available. + parseField (f, key, listElement = false) { + return parseField(f, key, this, listElement) + } + + async #loadFile (file, type) { + // only catch the error from readFile, not from the loadObject call + log.silly('config', `load:file:${file}`) + await readFile(file, 'utf8').then( + data => { + const parsedConfig = ini.parse(data) + if (type === 'project' && parsedConfig.prefix) { + // Log error if prefix is mentioned in project .npmrc + /* eslint-disable-next-line max-len */ + log.error('config', `prefix cannot be changed from project config: ${file}.`) + } + return this.#loadObject(parsedConfig, type, file) + }, + er => this.#loadObject(null, type, file, er) + ) + } + + loadBuiltinConfig () { + return this.#loadFile(resolve(this.npmPath, 'npmrc'), 'builtin') + } + + async loadProjectConfig () { + // the localPrefix can be set by the CLI config, but otherwise is + // found by walking up the folder tree. either way, we load it before + // we return to make sure localPrefix is set + await this.loadLocalPrefix() + + // if we have not detected a local package json yet, try now that we + // have a local prefix + if (this.localPackage == null) { + this.localPackage = await fileExists(this.localPrefix, 'package.json') + } + + if (this.#get('global') === true || this.#get('location') === 'global') { + this.data.get('project').source = '(global mode enabled, ignored)' + this.sources.set(this.data.get('project').source, 'project') + return + } + + const projectFile = resolve(this.localPrefix, '.npmrc') + // if we're in the ~ directory, and there happens to be a node_modules + // folder (which is not TOO uncommon, it turns out), then we can end + // up loading the "project" config where the "userconfig" will be, + // which causes some calamaties. So, we only load project config if + // it doesn't match what the userconfig will be. + if (projectFile !== this.#get('userconfig')) { + return this.#loadFile(projectFile, 'project') + } else { + this.data.get('project').source = '(same as "user" config, ignored)' + this.sources.set(this.data.get('project').source, 'project') + } + } + + async loadLocalPrefix () { + const cliPrefix = this.#get('prefix', 'cli') + if (cliPrefix) { + this.localPrefix = cliPrefix + return + } + + const cliWorkspaces = this.#get('workspaces', 'cli') + const isGlobal = this.#get('global') || this.#get('location') === 'global' + + for (const p of walkUp(this.cwd)) { + // HACK: this is an option set in tests to stop the local prefix from being set + // on tests that are created inside the npm repo + if (this.excludeNpmCwd && p === this.npmPath) { + break + } + + const hasPackageJson = await fileExists(p, 'package.json') + + if (!this.localPrefix && (hasPackageJson || await dirExists(p, 'node_modules'))) { + this.localPrefix = p + this.localPackage = hasPackageJson + + // if workspaces are disabled, or we're in global mode, return now + if (cliWorkspaces === false || isGlobal) { + return + } + + // otherwise, continue the loop + continue + } + + if (this.localPrefix && hasPackageJson) { + const pkgJson = require('@npmcli/package-json') + // if we already set localPrefix but this dir has a package.json + // then we need to see if `p` is a workspace root by reading its package.json + // however, if reading it fails then we should just move on + const { content: pkg } = await pkgJson.normalize(p).catch(() => ({ content: {} })) + if (!pkg?.workspaces) { + continue + } + + const mapWorkspaces = require('@npmcli/map-workspaces') + const workspaces = await mapWorkspaces({ cwd: p, pkg }) + for (const w of workspaces.values()) { + if (w === this.localPrefix) { + // see if there's a .npmrc file in the workspace, if so log a warning + if (await fileExists(this.localPrefix, '.npmrc')) { + log.warn('config', `ignoring workspace config at ${this.localPrefix}/.npmrc`) + } + + // set the workspace in the default layer, which allows it to be overridden easily + const { data } = this.data.get('default') + data.workspace = [this.localPrefix] + this.localPrefix = p + this.localPackage = hasPackageJson + log.info('config', `found workspace root at ${this.localPrefix}`) + // we found a root, so we return now + return + } + } + } + } + + if (!this.localPrefix) { + this.localPrefix = this.cwd + } + } + + loadUserConfig () { + return this.#loadFile(this.#get('userconfig'), 'user') + } + + loadGlobalConfig () { + return this.#loadFile(this.#get('globalconfig'), 'global') + } + + async save (where) { + if (!this.loaded) { + throw new Error('call config.load() before saving') + } + if (!confFileTypes.has(where)) { + throw new Error('invalid config location param: ' + where) + } + + const conf = this.data.get(where) + conf[_loadError] = null + + if (where === 'user') { + // if email is nerfed, then we want to de-nerf it + const nerfed = nerfDart(this.get('registry')) + const email = this.get(`${nerfed}:email`, 'user') + if (email) { + this.delete(`${nerfed}:email`, 'user') + this.set('email', email, 'user') + } + } + + // We need the actual raw data before we called parseField so that we are + // saving the same content back to the file + const iniData = ini.stringify(conf.raw).trim() + '\n' + if (!iniData.trim()) { + // ignore the unlink error (eg, if file doesn't exist) + await unlink(conf.source).catch(() => {}) + return + } + const dir = dirname(conf.source) + await mkdir(dir, { recursive: true }) + await writeFile(conf.source, iniData, 'utf8') + const mode = where === 'user' ? 0o600 : 0o666 + await chmod(conf.source, mode) + } + + clearCredentialsByURI (uri, level = 'user') { + const nerfed = nerfDart(uri) + const def = nerfDart(this.get('registry')) + if (def === nerfed) { + this.delete(`-authtoken`, level) + this.delete(`_authToken`, level) + this.delete(`_authtoken`, level) + this.delete(`_auth`, level) + this.delete(`_password`, level) + this.delete(`username`, level) + // de-nerf email if it's nerfed to the default registry + const email = this.get(`${nerfed}:email`, level) + if (email) { + this.set('email', email, level) + } + } + this.delete(`${nerfed}:_authToken`, level) + this.delete(`${nerfed}:_auth`, level) + this.delete(`${nerfed}:_password`, level) + this.delete(`${nerfed}:username`, level) + this.delete(`${nerfed}:email`, level) + this.delete(`${nerfed}:certfile`, level) + this.delete(`${nerfed}:keyfile`, level) + } + + setCredentialsByURI (uri, { token, username, password, certfile, keyfile }) { + const nerfed = nerfDart(uri) + + // field that hasn't been used as documented for a LONG time, + // and as of npm 7.10.0, isn't used at all. We just always + // send auth if we have it, only to the URIs under the nerf dart. + this.delete(`${nerfed}:always-auth`, 'user') + + this.delete(`${nerfed}:email`, 'user') + if (certfile && keyfile) { + this.set(`${nerfed}:certfile`, certfile, 'user') + this.set(`${nerfed}:keyfile`, keyfile, 'user') + // cert/key may be used in conjunction with other credentials, thus no `else` + } + if (token) { + this.set(`${nerfed}:_authToken`, token, 'user') + this.delete(`${nerfed}:_password`, 'user') + this.delete(`${nerfed}:username`, 'user') + } else if (username || password) { + if (!username) { + throw new Error('must include username') + } + if (!password) { + throw new Error('must include password') + } + this.delete(`${nerfed}:_authToken`, 'user') + this.set(`${nerfed}:username`, username, 'user') + // note: not encrypted, no idea why we bothered to do this, but oh well + // protects against shoulder-hacks if password is memorable, I guess? + const encoded = Buffer.from(password, 'utf8').toString('base64') + this.set(`${nerfed}:_password`, encoded, 'user') + } else if (!certfile || !keyfile) { + throw new Error('No credentials to set.') + } + } + + // this has to be a bit more complicated to support legacy data of all forms + getCredentialsByURI (uri) { + const nerfed = nerfDart(uri) + const def = nerfDart(this.get('registry')) + const creds = {} + + // email is handled differently, it used to always be nerfed and now it never should be + // if it's set nerfed to the default registry, then we copy it to the unnerfed key + // TODO: evaluate removing 'email' from the credentials object returned here + const email = this.get(`${nerfed}:email`) || this.get('email') + if (email) { + if (nerfed === def) { + this.set('email', email, 'user') + } + creds.email = email + } + + const certfileReg = this.get(`${nerfed}:certfile`) + const keyfileReg = this.get(`${nerfed}:keyfile`) + if (certfileReg && keyfileReg) { + creds.certfile = certfileReg + creds.keyfile = keyfileReg + // cert/key may be used in conjunction with other credentials, thus no `return` + } + + const tokenReg = this.get(`${nerfed}:_authToken`) + if (tokenReg) { + creds.token = tokenReg + return creds + } + + const userReg = this.get(`${nerfed}:username`) + const passReg = this.get(`${nerfed}:_password`) + if (userReg && passReg) { + creds.username = userReg + creds.password = Buffer.from(passReg, 'base64').toString('utf8') + const auth = `${creds.username}:${creds.password}` + creds.auth = Buffer.from(auth, 'utf8').toString('base64') + return creds + } + + const authReg = this.get(`${nerfed}:_auth`) + if (authReg) { + const authDecode = Buffer.from(authReg, 'base64').toString('utf8') + const authSplit = authDecode.split(':') + creds.username = authSplit.shift() + creds.password = authSplit.join(':') + creds.auth = authReg + return creds + } + + // at this point, nothing else is usable so just return what we do have + return creds + } + + // set up the environment object we have with npm_config_* environs + // for all configs that are different from their default values, and + // set EDITOR and HOME. + setEnvs () { + setEnvs(this) + } +} + +const _loadError = Symbol('loadError') +const _valid = Symbol('valid') + +class ConfigData { + #data + #source = null + #raw = null + constructor (parent) { + this.#data = Object.create(parent && parent.data) + this.#raw = {} + this[_valid] = true + } + + get data () { + return this.#data + } + + get valid () { + return this[_valid] + } + + set source (s) { + if (this.#source) { + throw new Error('cannot set ConfigData source more than once') + } + this.#source = s + } + + get source () { + return this.#source + } + + set loadError (e) { + if (this[_loadError] || (Object.keys(this.#raw).length)) { + throw new Error('cannot set ConfigData loadError after load') + } + this[_loadError] = e + } + + get loadError () { + return this[_loadError] + } + + set raw (r) { + if (Object.keys(this.#raw).length || this[_loadError]) { + throw new Error('cannot set ConfigData raw after load') + } + this.#raw = r + } + + get raw () { + return this.#raw + } +} + +module.exports = Config diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/nerf-dart.js b/node_modules/npm/node_modules/@npmcli/config/lib/nerf-dart.js new file mode 100644 index 00000000..030d92a8 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/nerf-dart.js @@ -0,0 +1,18 @@ +const { URL } = require('node:url') + +/** + * Maps a URL to an identifier. + * + * Name courtesy schiffertronix media LLC, a New Jersey corporation + * + * @param {String} uri The URL to be nerfed. + * + * @returns {String} A nerfed URL. + */ +module.exports = (url) => { + const parsed = new URL(url) + const from = `${parsed.protocol}//${parsed.host}${parsed.pathname}` + const rel = new URL('.', from) + const res = `//${rel.host}${rel.pathname}` + return res +} diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/parse-field.js b/node_modules/npm/node_modules/@npmcli/config/lib/parse-field.js new file mode 100644 index 00000000..9ac3d21c --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/parse-field.js @@ -0,0 +1,86 @@ +// Parse a field, coercing it to the best type available. +const typeDefs = require('./type-defs.js') +const envReplace = require('./env-replace.js') +const { resolve } = require('node:path') + +const { parse: umaskParse } = require('./umask.js') + +const parseField = (f, key, opts, listElement = false) => { + if (typeof f !== 'string' && !Array.isArray(f)) { + return f + } + + const { platform, types, home, env } = opts + + // type can be array or a single thing. coerce to array. + const typeList = new Set([].concat(types[key])) + const isPath = typeList.has(typeDefs.path.type) + const isBool = typeList.has(typeDefs.Boolean.type) + const isString = isPath || typeList.has(typeDefs.String.type) + const isUmask = typeList.has(typeDefs.Umask.type) + const isNumber = typeList.has(typeDefs.Number.type) + const isList = !listElement && typeList.has(Array) + const isDate = typeList.has(typeDefs.Date.type) + + if (Array.isArray(f)) { + return !isList ? f : f.map(field => parseField(field, key, opts, true)) + } + + // now we know it's a string + f = f.trim() + + // list types get put in the environment separated by double-\n + // usually a single \n would suffice, but ca/cert configs can contain + // line breaks and multiple entries. + if (isList) { + return parseField(f.split('\n\n'), key, opts) + } + + // --foo is like --foo=true for boolean types + if (isBool && !isString && f === '') { + return true + } + + // string types can be the string 'true', 'false', etc. + // otherwise, parse these values out + if (!isString && !isPath && !isNumber) { + switch (f) { + case 'true': return true + case 'false': return false + case 'null': return null + case 'undefined': return undefined + } + } + + f = envReplace(f, env) + + if (isDate) { + return new Date(f) + } + + if (isPath) { + const homePattern = platform === 'win32' ? /^~(\/|\\)/ : /^~\// + if (homePattern.test(f) && home) { + f = resolve(home, f.slice(2)) + } else { + f = resolve(f) + } + } + + if (isUmask) { + try { + return umaskParse(f) + } catch (er) { + // let it warn later when we validate + return f + } + } + + if (isNumber && !isNaN(f)) { + f = +f + } + + return f +} + +module.exports = parseField diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/set-envs.js b/node_modules/npm/node_modules/@npmcli/config/lib/set-envs.js new file mode 100644 index 00000000..b6f5a305 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/set-envs.js @@ -0,0 +1,108 @@ +// Set environment variables for any non-default configs, +// so that they're already there when we run lifecycle scripts. +// +// See https://github.com/npm/rfcs/pull/90 + +// Return the env key if this is a thing that belongs in the env. +// Ie, if the key isn't a @scope, //nerf.dart, or _private, +// and the value is a string or array. Otherwise return false. +const envKey = (key, val) => { + return !/^[/@_]/.test(key) && + (typeof envVal(val) === 'string') && + `npm_config_${key.replace(/-/g, '_').toLowerCase()}` +} + +const envVal = val => Array.isArray(val) ? val.map(v => envVal(v)).join('\n\n') + : val === null || val === undefined || val === false ? '' + : typeof val === 'object' ? null + : String(val) + +const sameConfigValue = (def, val) => + !Array.isArray(val) || !Array.isArray(def) ? def === val + : sameArrayValue(def, val) + +const sameArrayValue = (def, val) => { + if (def.length !== val.length) { + return false + } + + for (let i = 0; i < def.length; i++) { + /* istanbul ignore next - there are no array configs where the default + * is not an empty array, so this loop is a no-op, but it's the correct + * thing to do if we ever DO add a config like that. */ + if (def[i] !== val[i]) { + return false + } + } + return true +} + +const setEnv = (env, rawKey, rawVal) => { + const val = envVal(rawVal) + const key = envKey(rawKey, val) + if (key && val !== null) { + env[key] = val + } +} + +const setEnvs = (config) => { + // This ensures that all npm config values that are not the defaults are + // shared appropriately with child processes, without false positives. + const { + env, + defaults, + definitions, + list: [cliConf, envConf], + } = config + + env.INIT_CWD = process.cwd() + + // if the key is deprecated, skip it always. + // if the key is the default value, + // if the environ is NOT the default value, + // set the environ + // else skip it, it's fine + // if the key is NOT the default value, + // if the env is setting it, then leave it (already set) + // otherwise, set the env + const cliSet = new Set(Object.keys(cliConf)) + const envSet = new Set(Object.keys(envConf)) + for (const key in cliConf) { + const { deprecated, envExport = true } = definitions[key] || {} + if (deprecated || envExport === false) { + continue + } + + if (sameConfigValue(defaults[key], cliConf[key])) { + // config is the default, if the env thought different, then we + // have to set it BACK to the default in the environment. + if (!sameConfigValue(envConf[key], cliConf[key])) { + setEnv(env, key, cliConf[key]) + } + } else { + // config is not the default. if the env wasn't the one to set + // it that way, then we have to put it in the env + if (!(envSet.has(key) && !cliSet.has(key))) { + setEnv(env, key, cliConf[key]) + } + } + } + + // also set some other common nice envs that we want to rely on + env.HOME = config.home + env.npm_config_global_prefix = config.globalPrefix + env.npm_config_local_prefix = config.localPrefix + if (cliConf.editor) { + env.EDITOR = cliConf.editor + } + + // note: this doesn't afect the *current* node process, of course, since + // it's already started, but it does affect the options passed to scripts. + if (cliConf['node-options']) { + env.NODE_OPTIONS = cliConf['node-options'] + } + env.npm_execpath = config.npmBin + env.NODE = env.npm_node_execpath = config.execPath +} + +module.exports = setEnvs diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/type-defs.js b/node_modules/npm/node_modules/@npmcli/config/lib/type-defs.js new file mode 100644 index 00000000..3c9dfe19 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/type-defs.js @@ -0,0 +1,61 @@ +const nopt = require('nopt') + +const { validate: validateUmask } = require('./umask.js') + +class Umask {} +class Semver {} +const semverValid = require('semver/functions/valid') +const validateSemver = (data, k, val) => { + const valid = semverValid(val) + if (!valid) { + return false + } + data[k] = valid +} + +const noptValidatePath = nopt.typeDefs.path.validate +const validatePath = (data, k, val) => { + if (typeof val !== 'string') { + return false + } + return noptValidatePath(data, k, val) +} + +// add descriptions so we can validate more usefully +module.exports = { + ...nopt.typeDefs, + semver: { + type: Semver, + validate: validateSemver, + description: 'full valid SemVer string', + }, + Umask: { + type: Umask, + validate: validateUmask, + description: 'octal number in range 0o000..0o777 (0..511)', + }, + url: { + ...nopt.typeDefs.url, + description: 'full url with "http://"', + }, + path: { + ...nopt.typeDefs.path, + validate: validatePath, + description: 'valid filesystem path', + }, + Number: { + ...nopt.typeDefs.Number, + description: 'numeric value', + }, + Boolean: { + ...nopt.typeDefs.Boolean, + description: 'boolean value (true or false)', + }, + Date: { + ...nopt.typeDefs.Date, + description: 'valid Date string', + }, +} + +// TODO: make nopt less of a global beast so this kludge isn't necessary +nopt.typeDefs = module.exports diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/type-description.js b/node_modules/npm/node_modules/@npmcli/config/lib/type-description.js new file mode 100644 index 00000000..f5e0d164 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/type-description.js @@ -0,0 +1,21 @@ +// return the description of the valid values of a field +// returns a string for one thing, or an array of descriptions +const typeDefs = require('./type-defs.js') +const typeDescription = t => { + if (!t || typeof t !== 'function' && typeof t !== 'object') { + return t + } + + if (Array.isArray(t)) { + return t.map(t => typeDescription(t)) + } + + for (const { type, description } of Object.values(typeDefs)) { + if (type === t) { + return description || type + } + } + + return t +} +module.exports = t => [].concat(typeDescription(t)).filter(t => t !== undefined) diff --git a/node_modules/npm/node_modules/@npmcli/config/lib/umask.js b/node_modules/npm/node_modules/@npmcli/config/lib/umask.js new file mode 100644 index 00000000..2ddc5ca7 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/lib/umask.js @@ -0,0 +1,35 @@ +const parse = val => { + // this is run via nopt and parse field where everything is + // converted to a string first, ignoring coverage for now + // instead of figuring out what is happening under the hood in nopt + // istanbul ignore else + if (typeof val === 'string') { + if (/^0o?[0-7]+$/.test(val)) { + return parseInt(val.replace(/^0o?/, ''), 8) + } else if (/^[1-9][0-9]*$/.test(val)) { + return parseInt(val, 10) + } else { + throw new Error(`invalid umask value: ${val}`) + } + } else { + if (typeof val !== 'number') { + throw new Error(`invalid umask value: ${val}`) + } + val = Math.floor(val) + if (val < 0 || val > 511) { + throw new Error(`invalid umask value: ${val}`) + } + return val + } +} + +const validate = (data, k, val) => { + try { + data[k] = parse(val) + return true + } catch (er) { + return false + } +} + +module.exports = { parse, validate } diff --git a/node_modules/npm/node_modules/@npmcli/config/package.json b/node_modules/npm/node_modules/@npmcli/config/package.json new file mode 100644 index 00000000..eb89879f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/config/package.json @@ -0,0 +1,57 @@ +{ + "name": "@npmcli/config", + "version": "10.0.0", + "files": [ + "bin/", + "lib/" + ], + "main": "lib/index.js", + "description": "Configuration management for the npm cli", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/config" + }, + "author": "GitHub Inc.", + "license": "ISC", + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/mock-globals": "^1.0.0", + "@npmcli/template-oss": "4.23.6", + "tap": "^16.3.8" + }, + "dependencies": { + "@npmcli/map-workspaces": "^4.0.1", + "@npmcli/package-json": "^6.0.1", + "ci-info": "^4.0.0", + "ini": "^5.0.0", + "nopt": "^8.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5", + "walk-up-path": "^4.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + } +} diff --git a/node_modules/npm/node_modules/@npmcli/fs/LICENSE.md b/node_modules/npm/node_modules/@npmcli/fs/LICENSE.md new file mode 100644 index 00000000..5fc208ff --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/fs/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/npm/node_modules/@npmcli/fs/lib/common/get-options.js b/node_modules/npm/node_modules/@npmcli/fs/lib/common/get-options.js new file mode 100644 index 00000000..cb5982f7 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/@npmcli/fs/lib/common/node.js b/node_modules/npm/node_modules/@npmcli/fs/lib/common/node.js new file mode 100644 index 00000000..4d13bc03 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/@npmcli/fs/lib/cp/LICENSE b/node_modules/npm/node_modules/@npmcli/fs/lib/cp/LICENSE new file mode 100644 index 00000000..93546dfb --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/@npmcli/fs/lib/cp/errors.js b/node_modules/npm/node_modules/@npmcli/fs/lib/cp/errors.js new file mode 100644 index 00000000..1cd1e05d --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/fs/lib/cp/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/npm/node_modules/@npmcli/fs/lib/cp/index.js b/node_modules/npm/node_modules/@npmcli/fs/lib/cp/index.js new file mode 100644 index 00000000..972ce7aa --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/fs/lib/cp/index.js @@ -0,0 +1,22 @@ +const fs = require('fs/promises') +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/npm/node_modules/@npmcli/fs/lib/cp/polyfill.js b/node_modules/npm/node_modules/@npmcli/fs/lib/cp/polyfill.js new file mode 100644 index 00000000..80eb10de --- /dev/null +++ b/node_modules/npm/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/promises') +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/npm/node_modules/@npmcli/fs/lib/index.js b/node_modules/npm/node_modules/@npmcli/fs/lib/index.js new file mode 100644 index 00000000..81c74630 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/fs/lib/index.js @@ -0,0 +1,13 @@ +'use strict' + +const cp = require('./cp/index.js') +const withTempDir = require('./with-temp-dir.js') +const readdirScoped = require('./readdir-scoped.js') +const moveFile = require('./move-file.js') + +module.exports = { + cp, + withTempDir, + readdirScoped, + moveFile, +} diff --git a/node_modules/npm/node_modules/@npmcli/fs/lib/move-file.js b/node_modules/npm/node_modules/@npmcli/fs/lib/move-file.js new file mode 100644 index 00000000..d56e06d3 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/fs/lib/move-file.js @@ -0,0 +1,78 @@ +const { dirname, join, resolve, relative, isAbsolute } = require('path') +const fs = require('fs/promises') + +const pathExists = async path => { + try { + await fs.access(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 fs.mkdir(dirname(destination), { recursive: true }) + + try { + await fs.rename(source, destination) + } catch (error) { + if (error.code === 'EXDEV' || error.code === 'EPERM') { + const sourceStat = await fs.lstat(source) + if (sourceStat.isDirectory()) { + const files = await fs.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 fs.copyFile(source, destination) + } + } else { + throw error + } + } + + if (root) { + await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => { + let target = await fs.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 fs.stat(resolve(dirname(symSource), target)) + if (targetStat.isDirectory()) { + targetStat = 'junction' + } + } catch { + // targetStat remains 'file' + } + await fs.symlink( + target, + symDestination, + targetStat + ) + })) + await fs.rm(source, { recursive: true, force: true }) + } +} + +module.exports = moveFile diff --git a/node_modules/npm/node_modules/@npmcli/fs/lib/readdir-scoped.js b/node_modules/npm/node_modules/@npmcli/fs/lib/readdir-scoped.js new file mode 100644 index 00000000..cd601dfb --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/fs/lib/readdir-scoped.js @@ -0,0 +1,20 @@ +const { readdir } = require('fs/promises') +const { join } = require('path') + +const readdirScoped = async (dir) => { + const results = [] + + for (const item of await readdir(dir)) { + if (item.startsWith('@')) { + for (const scopedItem of await readdir(join(dir, item))) { + results.push(join(item, scopedItem)) + } + } else { + results.push(item) + } + } + + return results +} + +module.exports = readdirScoped diff --git a/node_modules/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js b/node_modules/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js new file mode 100644 index 00000000..0738ac4f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/fs/lib/with-temp-dir.js @@ -0,0 +1,39 @@ +const { join, sep } = require('path') + +const getOptions = require('./common/get-options.js') +const { mkdir, mkdtemp, rm } = require('fs/promises') + +// 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 + await mkdir(root, { recursive: true }) + + const target = await mkdtemp(join(`${root}${sep}`, options.tmpPrefix || '')) + 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/npm/node_modules/@npmcli/fs/package.json b/node_modules/npm/node_modules/@npmcli/fs/package.json new file mode 100644 index 00000000..e4063ec8 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/fs/package.json @@ -0,0 +1,54 @@ +{ + "name": "@npmcli/fs", + "version": "4.0.0", + "description": "filesystem utilities for the npm cli", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "scripts": { + "snap": "tap", + "test": "tap", + "npmclilint": "npmcli-lint", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "postsnap": "npm run lintfix --", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/fs.git" + }, + "keywords": [ + "npm", + "oss" + ], + "author": "GitHub Inc.", + "license": "ISC", + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.0.1" + }, + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/@npmcli/git/LICENSE b/node_modules/npm/node_modules/@npmcli/git/LICENSE new file mode 100644 index 00000000..8f90f96f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/LICENSE @@ -0,0 +1,15 @@ +The 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 NPM DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE 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/npm/node_modules/@npmcli/git/lib/clone.js b/node_modules/npm/node_modules/@npmcli/git/lib/clone.js new file mode 100644 index 00000000..e25a4d14 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/clone.js @@ -0,0 +1,172 @@ +// The goal here is to minimize both git workload and +// the number of refs we download over the network. +// +// Every method ends up with the checked out working dir +// at the specified ref, and resolves with the git sha. + +// Only certain whitelisted hosts get shallow cloning. +// Many hosts (including GHE) don't always support it. +// A failed shallow fetch takes a LOT longer than a full +// fetch in most cases, so we skip it entirely. +// Set opts.gitShallow = true/false to force this behavior +// one way or the other. +const shallowHosts = new Set([ + 'github.com', + 'gist.github.com', + 'gitlab.com', + 'bitbucket.com', + 'bitbucket.org', +]) +// we have to use url.parse until we add the same shim that hosted-git-info has +// to handle scp:// urls +const { parse } = require('url') // eslint-disable-line node/no-deprecated-api +const path = require('path') + +const getRevs = require('./revs.js') +const spawn = require('./spawn.js') +const { isWindows } = require('./utils.js') + +const pickManifest = require('npm-pick-manifest') +const fs = require('fs/promises') + +module.exports = (repo, ref = 'HEAD', target = null, opts = {}) => + getRevs(repo, opts).then(revs => clone( + repo, + revs, + ref, + resolveRef(revs, ref, opts), + target || defaultTarget(repo, opts.cwd), + opts + )) + +const maybeShallow = (repo, opts) => { + if (opts.gitShallow === false || opts.gitShallow) { + return opts.gitShallow + } + return shallowHosts.has(parse(repo).host) +} + +const defaultTarget = (repo, /* istanbul ignore next */ cwd = process.cwd()) => + path.resolve(cwd, path.basename(repo.replace(/[/\\]?\.git$/, ''))) + +const clone = (repo, revs, ref, revDoc, target, opts) => { + if (!revDoc) { + return unresolved(repo, ref, target, opts) + } + if (revDoc.sha === revs.refs.HEAD.sha) { + return plain(repo, revDoc, target, opts) + } + if (revDoc.type === 'tag' || revDoc.type === 'branch') { + return branch(repo, revDoc, target, opts) + } + return other(repo, revDoc, target, opts) +} + +const resolveRef = (revs, ref, opts) => { + const { spec = {} } = opts + ref = spec.gitCommittish || ref + /* istanbul ignore next - will fail anyway, can't pull */ + if (!revs) { + return null + } + if (spec.gitRange) { + return pickManifest(revs, spec.gitRange, opts) + } + if (!ref) { + return revs.refs.HEAD + } + if (revs.refs[ref]) { + return revs.refs[ref] + } + if (revs.shas[ref]) { + return revs.refs[revs.shas[ref][0]] + } + return null +} + +// pull request or some other kind of advertised ref +const other = (repo, revDoc, target, opts) => { + const shallow = maybeShallow(repo, opts) + + const fetchOrigin = ['fetch', 'origin', revDoc.rawRef] + .concat(shallow ? ['--depth=1'] : []) + + const git = (args) => spawn(args, { ...opts, cwd: target }) + return fs.mkdir(target, { recursive: true }) + .then(() => git(['init'])) + .then(() => isWindows(opts) + ? git(['config', '--local', '--add', 'core.longpaths', 'true']) + : null) + .then(() => git(['remote', 'add', 'origin', repo])) + .then(() => git(fetchOrigin)) + .then(() => git(['checkout', revDoc.sha])) + .then(() => updateSubmodules(target, opts)) + .then(() => revDoc.sha) +} + +// tag or branches. use -b +const branch = (repo, revDoc, target, opts) => { + const args = [ + 'clone', + '-b', + revDoc.ref, + repo, + target, + '--recurse-submodules', + ] + if (maybeShallow(repo, opts)) { + args.push('--depth=1') + } + if (isWindows(opts)) { + args.push('--config', 'core.longpaths=true') + } + return spawn(args, opts).then(() => revDoc.sha) +} + +// just the head. clone it +const plain = (repo, revDoc, target, opts) => { + const args = [ + 'clone', + repo, + target, + '--recurse-submodules', + ] + if (maybeShallow(repo, opts)) { + args.push('--depth=1') + } + if (isWindows(opts)) { + args.push('--config', 'core.longpaths=true') + } + return spawn(args, opts).then(() => revDoc.sha) +} + +const updateSubmodules = async (target, opts) => { + const hasSubmodules = await fs.stat(`${target}/.gitmodules`) + .then(() => true) + .catch(() => false) + if (!hasSubmodules) { + return null + } + return spawn([ + 'submodule', + 'update', + '-q', + '--init', + '--recursive', + ], { ...opts, cwd: target }) +} + +const unresolved = (repo, ref, target, opts) => { + // can't do this one shallowly, because the ref isn't advertised + // but we can avoid checking out the working dir twice, at least + const lp = isWindows(opts) ? ['--config', 'core.longpaths=true'] : [] + const cloneArgs = ['clone', '--mirror', '-q', repo, target + '/.git'] + const git = (args) => spawn(args, { ...opts, cwd: target }) + return fs.mkdir(target, { recursive: true }) + .then(() => git(cloneArgs.concat(lp))) + .then(() => git(['init'])) + .then(() => git(['checkout', ref])) + .then(() => updateSubmodules(target, opts)) + .then(() => git(['rev-parse', '--revs-only', 'HEAD'])) + .then(({ stdout }) => stdout.trim()) +} diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/errors.js b/node_modules/npm/node_modules/@npmcli/git/lib/errors.js new file mode 100644 index 00000000..3ceaa458 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/errors.js @@ -0,0 +1,36 @@ + +const maxRetry = 3 + +class GitError extends Error { + shouldRetry () { + return false + } +} + +class GitConnectionError extends GitError { + constructor () { + super('A git connection error occurred') + } + + shouldRetry (number) { + return number < maxRetry + } +} + +class GitPathspecError extends GitError { + constructor () { + super('The git reference could not be found') + } +} + +class GitUnknownError extends GitError { + constructor () { + super('An unknown git error occurred') + } +} + +module.exports = { + GitConnectionError, + GitPathspecError, + GitUnknownError, +} diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/find.js b/node_modules/npm/node_modules/@npmcli/git/lib/find.js new file mode 100644 index 00000000..34bd310b --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/find.js @@ -0,0 +1,15 @@ +const is = require('./is.js') +const { dirname } = require('path') + +module.exports = async ({ cwd = process.cwd(), root } = {}) => { + while (true) { + if (await is({ cwd })) { + return cwd + } + const next = dirname(cwd) + if (cwd === root || cwd === next) { + return null + } + cwd = next + } +} diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/index.js b/node_modules/npm/node_modules/@npmcli/git/lib/index.js new file mode 100644 index 00000000..10a65f78 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/index.js @@ -0,0 +1,9 @@ +module.exports = { + clone: require('./clone.js'), + revs: require('./revs.js'), + spawn: require('./spawn.js'), + is: require('./is.js'), + find: require('./find.js'), + isClean: require('./is-clean.js'), + errors: require('./errors.js'), +} diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/is-clean.js b/node_modules/npm/node_modules/@npmcli/git/lib/is-clean.js new file mode 100644 index 00000000..182373be --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/is-clean.js @@ -0,0 +1,6 @@ +const spawn = require('./spawn.js') + +module.exports = (opts = {}) => + spawn(['status', '--porcelain=v1', '-uno'], opts) + .then(res => !res.stdout.trim().split(/\r?\n+/) + .map(l => l.trim()).filter(l => l).length) diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/is.js b/node_modules/npm/node_modules/@npmcli/git/lib/is.js new file mode 100644 index 00000000..f5a0e875 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/is.js @@ -0,0 +1,4 @@ +// not an airtight indicator, but a good gut-check to even bother trying +const { stat } = require('fs/promises') +module.exports = ({ cwd = process.cwd() } = {}) => + stat(cwd + '/.git').then(() => true, () => false) diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/lines-to-revs.js b/node_modules/npm/node_modules/@npmcli/git/lib/lines-to-revs.js new file mode 100644 index 00000000..6bd7e7a4 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/lines-to-revs.js @@ -0,0 +1,147 @@ +// turn an array of lines from `git ls-remote` into a thing +// vaguely resembling a packument, where docs are a resolved ref + +const semver = require('semver') + +module.exports = lines => finish(lines.reduce(linesToRevsReducer, { + versions: {}, + 'dist-tags': {}, + refs: {}, + shas: {}, +})) + +const finish = revs => distTags(shaList(peelTags(revs))) + +// We can check out shallow clones on specific SHAs if we have a ref +const shaList = revs => { + Object.keys(revs.refs).forEach(ref => { + const doc = revs.refs[ref] + if (!revs.shas[doc.sha]) { + revs.shas[doc.sha] = [ref] + } else { + revs.shas[doc.sha].push(ref) + } + }) + return revs +} + +// Replace any tags with their ^{} counterparts, if those exist +const peelTags = revs => { + Object.keys(revs.refs).filter(ref => ref.endsWith('^{}')).forEach(ref => { + const peeled = revs.refs[ref] + const unpeeled = revs.refs[ref.replace(/\^\{\}$/, '')] + if (unpeeled) { + unpeeled.sha = peeled.sha + delete revs.refs[ref] + } + }) + return revs +} + +const distTags = revs => { + // not entirely sure what situations would result in an + // ichabod repo, but best to be careful in Sleepy Hollow anyway + const HEAD = revs.refs.HEAD || /* istanbul ignore next */ {} + const versions = Object.keys(revs.versions) + versions.forEach(v => { + // simulate a dist-tags with latest pointing at the + // 'latest' branch if one exists and is a version, + // or HEAD if not. + const ver = revs.versions[v] + if (revs.refs.latest && ver.sha === revs.refs.latest.sha) { + revs['dist-tags'].latest = v + } else if (ver.sha === HEAD.sha) { + revs['dist-tags'].HEAD = v + if (!revs.refs.latest) { + revs['dist-tags'].latest = v + } + } + }) + return revs +} + +const refType = ref => { + if (ref.startsWith('refs/tags/')) { + return 'tag' + } + if (ref.startsWith('refs/heads/')) { + return 'branch' + } + if (ref.startsWith('refs/pull/')) { + return 'pull' + } + if (ref === 'HEAD') { + return 'head' + } + // Could be anything, ignore for now + /* istanbul ignore next */ + return 'other' +} + +// return the doc, or null if we should ignore it. +const lineToRevDoc = line => { + const split = line.trim().split(/\s+/, 2) + if (split.length < 2) { + return null + } + + const sha = split[0].trim() + const rawRef = split[1].trim() + const type = refType(rawRef) + + if (type === 'tag') { + // refs/tags/foo^{} is the 'peeled tag', ie the commit + // that is tagged by refs/tags/foo they resolve to the same + // content, just different objects in git's data structure. + // But, we care about the thing the tag POINTS to, not the tag + // object itself, so we only look at the peeled tag refs, and + // ignore the pointer. + // For now, though, we have to save both, because some tags + // don't have peels, if they were not annotated. + const ref = rawRef.slice('refs/tags/'.length) + return { sha, ref, rawRef, type } + } + + if (type === 'branch') { + const ref = rawRef.slice('refs/heads/'.length) + return { sha, ref, rawRef, type } + } + + if (type === 'pull') { + // NB: merged pull requests installable with #pull/123/merge + // for the merged pr, or #pull/123 for the PR head + const ref = rawRef.slice('refs/'.length).replace(/\/head$/, '') + return { sha, ref, rawRef, type } + } + + if (type === 'head') { + const ref = 'HEAD' + return { sha, ref, rawRef, type } + } + + // at this point, all we can do is leave the ref un-munged + return { sha, ref: rawRef, rawRef, type } +} + +const linesToRevsReducer = (revs, line) => { + const doc = lineToRevDoc(line) + + if (!doc) { + return revs + } + + revs.refs[doc.ref] = doc + revs.refs[doc.rawRef] = doc + + if (doc.type === 'tag') { + // try to pull a semver value out of tags like `release-v1.2.3` + // which is a pretty common pattern. + const match = !doc.ref.endsWith('^{}') && + doc.ref.match(/v?(\d+\.\d+\.\d+(?:[-+].+)?)$/) + if (match && semver.valid(match[1], true)) { + revs.versions[semver.clean(match[1], true)] = doc + } + } + + return revs +} diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/make-error.js b/node_modules/npm/node_modules/@npmcli/git/lib/make-error.js new file mode 100644 index 00000000..7540ec7c --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/make-error.js @@ -0,0 +1,33 @@ +const { + GitConnectionError, + GitPathspecError, + GitUnknownError, +} = require('./errors.js') + +const connectionErrorRe = new RegExp([ + 'remote error: Internal Server Error', + 'The remote end hung up unexpectedly', + 'Connection timed out', + 'Operation timed out', + 'Failed to connect to .* Timed out', + 'Connection reset by peer', + 'SSL_ERROR_SYSCALL', + 'The requested URL returned error: 503', +].join('|')) + +const missingPathspecRe = /pathspec .* did not match any file\(s\) known to git/ + +function makeError (er) { + const message = er.stderr + let gitEr + if (connectionErrorRe.test(message)) { + gitEr = new GitConnectionError(message) + } else if (missingPathspecRe.test(message)) { + gitEr = new GitPathspecError(message) + } else { + gitEr = new GitUnknownError(message) + } + return Object.assign(gitEr, er) +} + +module.exports = makeError diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/opts.js b/node_modules/npm/node_modules/@npmcli/git/lib/opts.js new file mode 100644 index 00000000..1e80e9ef --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/opts.js @@ -0,0 +1,57 @@ +const fs = require('node:fs') +const os = require('node:os') +const path = require('node:path') +const ini = require('ini') + +const gitConfigPath = path.join(os.homedir(), '.gitconfig') + +let cachedConfig = null + +// Function to load and cache the git config +const loadGitConfig = () => { + if (cachedConfig === null) { + try { + cachedConfig = {} + if (fs.existsSync(gitConfigPath)) { + const configContent = fs.readFileSync(gitConfigPath, 'utf-8') + cachedConfig = ini.parse(configContent) + } + } catch (error) { + cachedConfig = {} + } + } + return cachedConfig +} + +const checkGitConfigs = () => { + const config = loadGitConfig() + return { + sshCommandSetInConfig: config?.core?.sshCommand !== undefined, + askPassSetInConfig: config?.core?.askpass !== undefined, + } +} + +const sshCommandSetInEnv = process.env.GIT_SSH_COMMAND !== undefined +const askPassSetInEnv = process.env.GIT_ASKPASS !== undefined +const { sshCommandSetInConfig, askPassSetInConfig } = checkGitConfigs() + +// Values we want to set if they're not already defined by the end user +// This defaults to accepting new ssh host key fingerprints +const finalGitEnv = { + ...(askPassSetInEnv || askPassSetInConfig ? {} : { + GIT_ASKPASS: 'echo', + }), + ...(sshCommandSetInEnv || sshCommandSetInConfig ? {} : { + GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new', + }), +} + +module.exports = (opts = {}) => ({ + stdioString: true, + ...opts, + shell: false, + env: opts.env || { ...finalGitEnv, ...process.env }, +}) + +// Export the loadGitConfig function for testing +module.exports.loadGitConfig = loadGitConfig diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/revs.js b/node_modules/npm/node_modules/@npmcli/git/lib/revs.js new file mode 100644 index 00000000..ca14837d --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/revs.js @@ -0,0 +1,28 @@ +const pinflight = require('promise-inflight') +const spawn = require('./spawn.js') +const { LRUCache } = require('lru-cache') + +const revsCache = new LRUCache({ + max: 100, + ttl: 5 * 60 * 1000, +}) + +const linesToRevs = require('./lines-to-revs.js') + +module.exports = async (repo, opts = {}) => { + if (!opts.noGitRevCache) { + const cached = revsCache.get(repo) + if (cached) { + return cached + } + } + + return pinflight(`ls-remote:${repo}`, () => + spawn(['ls-remote', repo], opts) + .then(({ stdout }) => linesToRevs(stdout.trim().split('\n'))) + .then(revs => { + revsCache.set(repo, revs) + return revs + }) + ) +} diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/spawn.js b/node_modules/npm/node_modules/@npmcli/git/lib/spawn.js new file mode 100644 index 00000000..03c1cbde --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/spawn.js @@ -0,0 +1,44 @@ +const spawn = require('@npmcli/promise-spawn') +const promiseRetry = require('promise-retry') +const { log } = require('proc-log') +const makeError = require('./make-error.js') +const makeOpts = require('./opts.js') + +module.exports = (gitArgs, opts = {}) => { + const whichGit = require('./which.js') + const gitPath = whichGit(opts) + + if (gitPath instanceof Error) { + return Promise.reject(gitPath) + } + + // undocumented option, mostly only here for tests + const args = opts.allowReplace || gitArgs[0] === '--no-replace-objects' + ? gitArgs + : ['--no-replace-objects', ...gitArgs] + + let retryOpts = opts.retry + if (retryOpts === null || retryOpts === undefined) { + retryOpts = { + retries: opts.fetchRetries || 2, + factor: opts.fetchRetryFactor || 10, + maxTimeout: opts.fetchRetryMaxtimeout || 60000, + minTimeout: opts.fetchRetryMintimeout || 1000, + } + } + return promiseRetry((retryFn, number) => { + if (number !== 1) { + log.silly('git', `Retrying git command: ${ + args.join(' ')} attempt # ${number}`) + } + + return spawn(gitPath, args, makeOpts(opts)) + .catch(er => { + const gitError = makeError(er) + if (!gitError.shouldRetry(number)) { + throw gitError + } + retryFn(gitError) + }) + }, retryOpts) +} diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/utils.js b/node_modules/npm/node_modules/@npmcli/git/lib/utils.js new file mode 100644 index 00000000..fcd9578a --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/utils.js @@ -0,0 +1,3 @@ +const isWindows = opts => (opts.fakePlatform || process.platform) === 'win32' + +exports.isWindows = isWindows diff --git a/node_modules/npm/node_modules/@npmcli/git/lib/which.js b/node_modules/npm/node_modules/@npmcli/git/lib/which.js new file mode 100644 index 00000000..dc2a1ad2 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/lib/which.js @@ -0,0 +1,18 @@ +const which = require('which') + +let gitPath +try { + gitPath = which.sync('git') +} catch { + // ignore errors +} + +module.exports = (opts = {}) => { + if (opts.git) { + return opts.git + } + if (!gitPath || opts.git === false) { + return Object.assign(new Error('No git binary found in $PATH'), { code: 'ENOGIT' }) + } + return gitPath +} diff --git a/node_modules/npm/node_modules/@npmcli/git/package.json b/node_modules/npm/node_modules/@npmcli/git/package.json new file mode 100644 index 00000000..2bc6730b --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/git/package.json @@ -0,0 +1,59 @@ +{ + "name": "@npmcli/git", + "version": "6.0.1", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "description": "a util for spawning git from npm CLI contexts", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/git.git" + }, + "author": "GitHub Inc.", + "license": "ISC", + "scripts": { + "lint": "npm run eslint", + "snap": "tap", + "test": "tap", + "posttest": "npm run lint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "tap": { + "timeout": 600, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "npm-package-arg": "^11.0.0", + "slash": "^3.0.0", + "tap": "^16.0.1" + }, + "dependencies": { + "@npmcli/promise-spawn": "^8.0.0", + "ini": "^5.0.0", + "lru-cache": "^10.0.1", + "npm-pick-manifest": "^10.0.0", + "proc-log": "^5.0.0", + "promise-inflight": "^1.0.1", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^5.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + } +} diff --git a/node_modules/npm/node_modules/@npmcli/installed-package-contents/LICENSE b/node_modules/npm/node_modules/@npmcli/installed-package-contents/LICENSE new file mode 100644 index 00000000..19cec97b --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/installed-package-contents/LICENSE @@ -0,0 +1,15 @@ +The 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 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/npm/node_modules/@npmcli/installed-package-contents/README.md b/node_modules/npm/node_modules/@npmcli/installed-package-contents/README.md new file mode 100644 index 00000000..edd23bd2 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/installed-package-contents/README.md @@ -0,0 +1,109 @@ +# @npmcli/installed-package-contents + +Get the list of files installed in a package in node_modules, including +bundled dependencies. + +This is useful if you want to remove a package node from the tree _without_ +removing its child nodes, for example to extract a new version of the +dependency into place safely. + +It's sort of the reflection of [npm-packlist](http://npm.im/npm-packlist), +but for listing out the _installed_ files rather than the files that _will_ +be installed. This is of course a much simpler operation, because we don't +have to handle ignore files or package.json `files` lists. + +## USAGE + +```js +// programmatic usage +const pkgContents = require('@npmcli/installed-package-contents') + +pkgContents({ path: 'node_modules/foo', depth: 1 }).then(files => { + // files is an array of items that need to be passed to + // rimraf or moved out of the way to make the folder empty + // if foo bundled dependencies, those will be included. + // It will not traverse into child directories, because we set + // depth:1 in the options. + // If the folder doesn't exist, this returns an empty array. +}) + +pkgContents({ path: 'node_modules/foo', depth: Infinity }).then(files => { + // setting depth:Infinity tells it to keep walking forever + // until it hits something that isn't a directory, so we'll + // just get the list of all files, but not their containing + // directories. +}) +``` + +As a CLI: + +```bash +$ installed-package-contents node_modules/bundle-some -d1 +node_modules/.bin/some +node_modules/bundle-some/package.json +node_modules/bundle-some/node_modules/@scope/baz +node_modules/bundle-some/node_modules/.bin/foo +node_modules/bundle-some/node_modules/foo +``` + +CLI options: + +``` +Usage: + installed-package-contents [-d --depth=] + +Lists the files installed for a package specified by . + +Options: + -d --depth= Provide a numeric value ("Infinity" is allowed) + to specify how deep in the file tree to traverse. + Default=1 + -h --help Show this usage information +``` + +## OPTIONS + +* `depth` Number, default `1`. How deep to traverse through folders to get + contents. Typically you'd want to set this to either `1` (to get the + surface files and folders) or `Infinity` (to get all files), but any + other positive number is supported as well. If set to `0` or a + negative number, returns the path provided and (if it is a package) its + set of linked bins. +* `path` Required. Path to the package in `node_modules` where traversal + should begin. + +## RETURN VALUE + +A Promise that resolves to an array of fully-resolved files and folders +matching the criteria. This includes all bundled dependencies in +`node_modules`, and any linked executables in `node_modules/.bin` that the +package caused to be installed. + +An empty or missing package folder will return an empty array. Empty +directories _within_ package contents are listed, even if the `depth` +argument would cause them to be traversed into. + +## CAVEAT + +If using this module to generate a list of files that should be recursively +removed to clear away the package, note that this will leave empty +directories behind in certain cases: + +- If all child packages are bundled dependencies, then the + `node_modules` folder will remain. +- If all child packages within a given scope were bundled dependencies, + then the `node_modules/@scope` folder will remain. +- If all linked bin scripts were removed, then an empty `node_modules/.bin` + folder will remain. + +In the interest of speed and algorithmic complexity, this module does _not_ +do a subsequent readdir to see if it would remove all directory entries, +though it would be easier to look at if it returned `node_modules` or +`.bin` in that case rather than the contents. However, if the intent is to +pass these arguments to `rimraf`, it hardly makes sense to do _two_ +`readdir` calls just so that we can have the luxury of having to make a +third. + +Since the primary use case is to delete a package's contents so that they +can be re-filled with a new version of that package, this caveat does not +pose a problem. Empty directories are already ignored by both npm and git. diff --git a/node_modules/npm/node_modules/@npmcli/installed-package-contents/bin/index.js b/node_modules/npm/node_modules/@npmcli/installed-package-contents/bin/index.js new file mode 100755 index 00000000..7b83b23b --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/installed-package-contents/bin/index.js @@ -0,0 +1,44 @@ +#! /usr/bin/env node + +const { relative } = require('path') +const pkgContents = require('../') + +const usage = `Usage: + installed-package-contents [-d --depth=] + +Lists the files installed for a package specified by . + +Options: + -d --depth= Provide a numeric value ("Infinity" is allowed) + to specify how deep in the file tree to traverse. + Default=1 + -h --help Show this usage information` + +const options = {} + +process.argv.slice(2).forEach(arg => { + let match + if ((match = arg.match(/^(?:--depth=|-d)([0-9]+|Infinity)/))) { + options.depth = +match[1] + } else if (arg === '-h' || arg === '--help') { + console.log(usage) + process.exit(0) + } else { + options.path = arg + } +}) + +if (!options.path) { + console.error('ERROR: no path provided') + console.error(usage) + process.exit(1) +} + +const cwd = process.cwd() + +pkgContents(options) + .then(list => list.sort().forEach(p => console.log(relative(cwd, p)))) + .catch(/* istanbul ignore next - pretty unusual */ er => { + console.error(er) + process.exit(1) + }) diff --git a/node_modules/npm/node_modules/@npmcli/installed-package-contents/lib/index.js b/node_modules/npm/node_modules/@npmcli/installed-package-contents/lib/index.js new file mode 100644 index 00000000..ab1486cd --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/installed-package-contents/lib/index.js @@ -0,0 +1,181 @@ +// to GET CONTENTS for folder at PATH (which may be a PACKAGE): +// - if PACKAGE, read path/package.json +// - if bins in ../node_modules/.bin, add those to result +// - if depth >= maxDepth, add PATH to result, and finish +// - readdir(PATH, with file types) +// - add all FILEs in PATH to result +// - if PARENT: +// - if depth < maxDepth, add GET CONTENTS of all DIRs in PATH +// - else, add all DIRs in PATH +// - if no parent +// - if no bundled deps, +// - if depth < maxDepth, add GET CONTENTS of DIRs in path except +// node_modules +// - else, add all DIRs in path other than node_modules +// - if has bundled deps, +// - get list of bundled deps +// - add GET CONTENTS of bundled deps, PACKAGE=true, depth + 1 + +const bundled = require('npm-bundled') +const { readFile, readdir, stat } = require('fs/promises') +const { resolve, basename, dirname } = require('path') +const normalizePackageBin = require('npm-normalize-package-bin') + +const readPackage = ({ path, packageJsonCache }) => packageJsonCache.has(path) + ? Promise.resolve(packageJsonCache.get(path)) + : readFile(path).then(json => { + const pkg = normalizePackageBin(JSON.parse(json)) + packageJsonCache.set(path, pkg) + return pkg + }).catch(() => null) + +// just normalize bundle deps and bin, that's all we care about here. +const normalized = Symbol('package data has been normalized') +const rpj = ({ path, packageJsonCache }) => readPackage({ path, packageJsonCache }) + .then(pkg => { + if (!pkg || pkg[normalized]) { + return pkg + } + if (pkg.bundledDependencies && !pkg.bundleDependencies) { + pkg.bundleDependencies = pkg.bundledDependencies + delete pkg.bundledDependencies + } + const bd = pkg.bundleDependencies + if (bd === true) { + pkg.bundleDependencies = [ + ...Object.keys(pkg.dependencies || {}), + ...Object.keys(pkg.optionalDependencies || {}), + ] + } + if (typeof bd === 'object' && !Array.isArray(bd)) { + pkg.bundleDependencies = Object.keys(bd) + } + pkg[normalized] = true + return pkg + }) + +const pkgContents = async ({ + path, + depth = 1, + currentDepth = 0, + pkg = null, + result = null, + packageJsonCache = null, +}) => { + if (!result) { + result = new Set() + } + + if (!packageJsonCache) { + packageJsonCache = new Map() + } + + if (pkg === true) { + return rpj({ path: path + '/package.json', packageJsonCache }) + .then(p => pkgContents({ + path, + depth, + currentDepth, + pkg: p, + result, + packageJsonCache, + })) + } + + if (pkg) { + // add all bins to result if they exist + if (pkg.bin) { + const dir = dirname(path) + const scope = basename(dir) + const nm = /^@.+/.test(scope) ? dirname(dir) : dir + + const binFiles = [] + Object.keys(pkg.bin).forEach(b => { + const base = resolve(nm, '.bin', b) + binFiles.push(base, base + '.cmd', base + '.ps1') + }) + + const bins = await Promise.all( + binFiles.map(b => stat(b).then(() => b).catch(() => null)) + ) + bins.filter(b => b).forEach(b => result.add(b)) + } + } + + if (currentDepth >= depth) { + result.add(path) + return result + } + + // we'll need bundle list later, so get that now in parallel + const [dirEntries, bundleDeps] = await Promise.all([ + readdir(path, { withFileTypes: true }), + currentDepth === 0 && pkg && pkg.bundleDependencies + ? bundled({ path, packageJsonCache }) : null, + ]).catch(() => []) + + // not a thing, probably a missing folder + if (!dirEntries) { + return result + } + + // empty folder, just add the folder itself to the result + if (!dirEntries.length && !bundleDeps && currentDepth !== 0) { + result.add(path) + return result + } + + const recursePromises = [] + + for (const entry of dirEntries) { + const p = resolve(path, entry.name) + if (entry.isDirectory() === false) { + result.add(p) + continue + } + + if (currentDepth !== 0 || entry.name !== 'node_modules') { + if (currentDepth < depth - 1) { + recursePromises.push(pkgContents({ + path: p, + packageJsonCache, + depth, + currentDepth: currentDepth + 1, + result, + })) + } else { + result.add(p) + } + continue + } + } + + if (bundleDeps) { + // bundle deps are all folders + // we always recurse to get pkg bins, but if currentDepth is too high, + // it'll return early before walking their contents. + recursePromises.push(...bundleDeps.map(dep => { + const p = resolve(path, 'node_modules', dep) + return pkgContents({ + path: p, + packageJsonCache, + pkg: true, + depth, + currentDepth: currentDepth + 1, + result, + }) + })) + } + + if (recursePromises.length) { + await Promise.all(recursePromises) + } + + return result +} + +module.exports = ({ path, ...opts }) => pkgContents({ + path: resolve(path), + ...opts, + pkg: true, +}).then(results => [...results]) diff --git a/node_modules/npm/node_modules/@npmcli/installed-package-contents/package.json b/node_modules/npm/node_modules/@npmcli/installed-package-contents/package.json new file mode 100644 index 00000000..d5b68a73 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/installed-package-contents/package.json @@ -0,0 +1,52 @@ +{ + "name": "@npmcli/installed-package-contents", + "version": "3.0.0", + "description": "Get the list of files installed in a package in node_modules, including bundled dependencies", + "author": "GitHub Inc.", + "main": "lib/index.js", + "bin": { + "installed-package-contents": "bin/index.js" + }, + "license": "ISC", + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.3.0" + }, + "dependencies": { + "npm-bundled": "^4.0.0", + "npm-normalize-package-bin": "^4.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/installed-package-contents.git" + }, + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/@npmcli/map-workspaces/LICENSE.md b/node_modules/npm/node_modules/@npmcli/map-workspaces/LICENSE.md new file mode 100644 index 00000000..5fc208ff --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/map-workspaces/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/npm/node_modules/@npmcli/map-workspaces/lib/index.js b/node_modules/npm/node_modules/@npmcli/map-workspaces/lib/index.js new file mode 100644 index 00000000..f38b8cd3 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/map-workspaces/lib/index.js @@ -0,0 +1,226 @@ +const path = require('path') + +const getName = require('@npmcli/name-from-folder') +const { minimatch } = require('minimatch') +const pkgJson = require('@npmcli/package-json') +const { glob } = require('glob') + +function appendNegatedPatterns (allPatterns) { + const patterns = [] + const negatedPatterns = [] + for (let pattern of allPatterns) { + const excl = pattern.match(/^!+/) + if (excl) { + pattern = pattern.slice(excl[0].length) + } + + // strip off any / or ./ from the start of the pattern. /foo => foo + pattern = pattern.replace(/^\.?\/+/, '') + + // an odd number of ! means a negated pattern. !!foo ==> foo + const negate = excl && excl[0].length % 2 === 1 + if (negate) { + negatedPatterns.push(pattern) + } else { + // remove negated patterns that appeared before this pattern to avoid + // ignoring paths that were matched afterwards + // e.g: ['packages/**', '!packages/b/**', 'packages/b/a'] + // in the above list, the last pattern overrides the negated pattern + // right before it. In effect, the above list would become: + // ['packages/**', 'packages/b/a'] + // The order matters here which is why we must do it inside the loop + // as opposed to doing it all together at the end. + for (let i = 0; i < negatedPatterns.length; ++i) { + const negatedPattern = negatedPatterns[i] + if (minimatch(pattern, negatedPattern)) { + negatedPatterns.splice(i, 1) + } + } + patterns.push(pattern) + } + } + + // use the negated patterns to eagerly remove all the patterns that + // can be removed to avoid unnecessary crawling + for (const negated of negatedPatterns) { + for (const pattern of minimatch.match(patterns, negated)) { + patterns.splice(patterns.indexOf(pattern), 1) + } + } + return { patterns, negatedPatterns } +} + +function getPatterns (workspaces) { + const workspacesDeclaration = + Array.isArray(workspaces.packages) + ? workspaces.packages + : workspaces + + if (!Array.isArray(workspacesDeclaration)) { + throw getError({ + message: 'workspaces config expects an Array', + code: 'EWORKSPACESCONFIG', + }) + } + + return appendNegatedPatterns(workspacesDeclaration) +} + +function getPackageName (pkg, pathname) { + return pkg.name || getName(pathname) +} + +// make sure glob pattern only matches folders +function getGlobPattern (pattern) { + pattern = pattern.replace(/\\/g, '/') + return pattern.endsWith('/') + ? pattern + : `${pattern}/` +} + +function getError ({ Type = TypeError, message, code }) { + return Object.assign(new Type(message), { code }) +} + +function reverseResultMap (map) { + return new Map(Array.from(map, item => item.reverse())) +} + +async function mapWorkspaces (opts = {}) { + if (!opts || !opts.pkg) { + throw getError({ + message: 'mapWorkspaces missing pkg info', + code: 'EMAPWORKSPACESPKG', + }) + } + if (!opts.cwd) { + opts.cwd = process.cwd() + } + + const { workspaces = [] } = opts.pkg + const { patterns, negatedPatterns } = getPatterns(workspaces) + const results = new Map() + + if (!patterns.length && !negatedPatterns.length) { + return results + } + + const seen = new Map() + const getGlobOpts = () => ({ + ...opts, + ignore: [ + ...opts.ignore || [], + '**/node_modules/**', + // just ignore the negated patterns to avoid unnecessary crawling + ...negatedPatterns, + ], + }) + + let matches = await glob(patterns.map((p) => getGlobPattern(p)), getGlobOpts()) + // preserves glob@8 behavior + matches = matches.sort((a, b) => a.localeCompare(b, 'en')) + + // we must preserve the order of results according to the given list of + // workspace patterns + const orderedMatches = [] + for (const pattern of patterns) { + orderedMatches.push(...matches.filter((m) => { + return minimatch(m, pattern, { partial: true, windowsPathsNoEscape: true }) + })) + } + + for (const match of orderedMatches) { + let pkg + try { + pkg = await pkgJson.normalize(path.join(opts.cwd, match)) + } catch (err) { + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') { + continue + } else { + throw err + } + } + + const name = getPackageName(pkg.content, pkg.path) + + let seenPackagePathnames = seen.get(name) + if (!seenPackagePathnames) { + seenPackagePathnames = new Set() + seen.set(name, seenPackagePathnames) + } + seenPackagePathnames.add(pkg.path) + } + + const errorMessageArray = ['must not have multiple workspaces with the same name'] + for (const [packageName, seenPackagePathnames] of seen) { + if (seenPackagePathnames.size > 1) { + addDuplicateErrorMessages(errorMessageArray, packageName, seenPackagePathnames) + } else { + results.set(packageName, seenPackagePathnames.values().next().value) + } + } + + if (errorMessageArray.length > 1) { + throw getError({ + Type: Error, + message: errorMessageArray.join('\n'), + code: 'EDUPLICATEWORKSPACE', + }) + } + + return results +} + +function addDuplicateErrorMessages (messageArray, packageName, packagePathnames) { + messageArray.push( + `package '${packageName}' has conflicts in the following paths:` + ) + + for (const packagePathname of packagePathnames) { + messageArray.push( + ' ' + packagePathname + ) + } +} + +mapWorkspaces.virtual = function (opts = {}) { + if (!opts || !opts.lockfile) { + throw getError({ + message: 'mapWorkspaces.virtual missing lockfile info', + code: 'EMAPWORKSPACESLOCKFILE', + }) + } + if (!opts.cwd) { + opts.cwd = process.cwd() + } + + const { packages = {} } = opts.lockfile + const { workspaces = [] } = packages[''] || {} + // uses a pathname-keyed map in order to negate the exact items + const results = new Map() + const { patterns, negatedPatterns } = getPatterns(workspaces) + if (!patterns.length && !negatedPatterns.length) { + return results + } + negatedPatterns.push('**/node_modules/**') + + const packageKeys = Object.keys(packages) + for (const pattern of negatedPatterns) { + for (const packageKey of minimatch.match(packageKeys, pattern)) { + packageKeys.splice(packageKeys.indexOf(packageKey), 1) + } + } + + for (const pattern of patterns) { + for (const packageKey of minimatch.match(packageKeys, pattern)) { + const packagePathname = path.join(opts.cwd, packageKey) + const name = getPackageName(packages[packageKey], packagePathname) + results.set(packagePathname, name) + } + } + + // Invert pathname-keyed to a proper name-to-pathnames Map + return reverseResultMap(results) +} + +module.exports = mapWorkspaces diff --git a/node_modules/npm/node_modules/@npmcli/map-workspaces/package.json b/node_modules/npm/node_modules/@npmcli/map-workspaces/package.json new file mode 100644 index 00000000..78a515e0 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/map-workspaces/package.json @@ -0,0 +1,61 @@ +{ + "name": "@npmcli/map-workspaces", + "version": "4.0.2", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "description": "Retrieves a name:pathname Map for a given workspaces config", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/map-workspaces.git" + }, + "keywords": [ + "npm", + "npmcli", + "libnpm", + "cli", + "workspaces", + "map-workspaces" + ], + "author": "GitHub Inc.", + "license": "ISC", + "scripts": { + "lint": "npm run eslint", + "pretest": "npm run lint", + "test": "tap", + "snap": "tap", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "tap": { + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.4", + "tap": "^16.0.1" + }, + "dependencies": { + "@npmcli/name-from-folder": "^3.0.0", + "@npmcli/package-json": "^6.0.0", + "glob": "^10.2.2", + "minimatch": "^9.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.4", + "publish": "true" + } +} diff --git a/node_modules/npm/node_modules/@npmcli/metavuln-calculator/LICENSE b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/LICENSE new file mode 100644 index 00000000..19cec97b --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/LICENSE @@ -0,0 +1,15 @@ +The 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 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/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js new file mode 100644 index 00000000..01f6a66f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js @@ -0,0 +1,435 @@ +const hash = require('./hash.js') +const semver = require('semver') +const semverOpt = { includePrerelease: true, loose: true } +const getDepSpec = require('./get-dep-spec.js') + +// any fields that we don't want in the cache need to be hidden +const _source = Symbol('source') +const _packument = Symbol('packument') +const _versionVulnMemo = Symbol('versionVulnMemo') +const _updated = Symbol('updated') +const _options = Symbol('options') +const _specVulnMemo = Symbol('specVulnMemo') +const _testVersion = Symbol('testVersion') +const _testVersions = Symbol('testVersions') +const _calculateRange = Symbol('calculateRange') +const _markVulnerable = Symbol('markVulnerable') +const _testSpec = Symbol('testSpec') + +class Advisory { + constructor (name, source, options = {}) { + this.source = source.id + this[_source] = source + this[_options] = options + this.name = name + if (!source.name) { + source.name = name + } + + this.dependency = source.name + + if (this.type === 'advisory') { + this.title = source.title + this.url = source.url + } else { + this.title = `Depends on vulnerable versions of ${source.name}` + this.url = null + } + + this.severity = source.severity || 'high' + this.versions = [] + this.vulnerableVersions = [] + this.cwe = source.cwe + this.cvss = source.cvss + + // advisories have the range, metavulns do not + // if an advisory doesn't specify range, assume all are vulnerable + this.range = this.type === 'advisory' ? source.vulnerable_versions || '*' + : null + + this.id = hash(this) + + this[_packument] = null + // memoized list of which versions are vulnerable + this[_versionVulnMemo] = new Map() + // memoized list of which dependency specs are vulnerable + this[_specVulnMemo] = new Map() + this[_updated] = false + } + + // true if we updated from what we had in cache + get updated () { + return this[_updated] + } + + get type () { + return this.dependency === this.name ? 'advisory' : 'metavuln' + } + + get packument () { + return this[_packument] + } + + // load up the data from a cache entry and a fetched packument + load (cached, packument) { + // basic data integrity gutcheck + if (!cached || typeof cached !== 'object') { + throw new TypeError('invalid cached data, expected object') + } + + if (!packument || typeof packument !== 'object') { + throw new TypeError('invalid packument data, expected object') + } + + if (cached.id && cached.id !== this.id) { + throw Object.assign(new Error('loading from incorrect cache entry'), { + expected: this.id, + actual: cached.id, + }) + } + if (packument.name !== this.name) { + throw Object.assign(new Error('loading from incorrect packument'), { + expected: this.name, + actual: packument.name, + }) + } + if (this[_packument]) { + throw new Error('advisory object already loaded') + } + + // if we have a range from the initialization, and the cached + // data has a *different* range, then we know we have to recalc. + // just don't use the cached data, so we will definitely not match later + if (!this.range || cached.range && cached.range === this.range) { + Object.assign(this, cached) + } + + this[_packument] = packument + + const pakuVersions = Object.keys(packument.versions || {}) + const allVersions = new Set([...pakuVersions, ...this.versions]) + const versionsAdded = [] + const versionsRemoved = [] + for (const v of allVersions) { + if (!this.versions.includes(v)) { + versionsAdded.push(v) + this.versions.push(v) + } else if (!pakuVersions.includes(v)) { + versionsRemoved.push(v) + } + } + + // strip out any removed versions from our lists, and sort by semver + this.versions = semver.sort(this.versions.filter(v => + !versionsRemoved.includes(v)), semverOpt) + + // if no changes, then just return what we got from cache + // versions added or removed always means we changed + // otherwise, advisories change if the range changes, and + // metavulns change if the source was updated + const unchanged = this.type === 'advisory' + ? this.range && this.range === cached.range + : !this[_source].updated + + // if the underlying source changed, by an advisory updating the + // range, or a source advisory being updated, then we have to re-check + // otherwise, only recheck the new ones. + this.vulnerableVersions = !unchanged ? [] + : semver.sort(this.vulnerableVersions.filter(v => + !versionsRemoved.includes(v)), semverOpt) + + if (unchanged && !versionsAdded.length && !versionsRemoved.length) { + // nothing added or removed, nothing to do here. use the cached copy. + return this + } + + this[_updated] = true + + // test any versions newly added + if (!unchanged || versionsAdded.length) { + this[_testVersions](unchanged ? versionsAdded : this.versions) + } + this.vulnerableVersions = semver.sort(this.vulnerableVersions, semverOpt) + + // metavulns have to calculate their range, since cache is invalidated + // advisories just get their range from the advisory above + if (this.type === 'metavuln') { + this[_calculateRange]() + } + + return this + } + + [_calculateRange] () { + // calling semver.simplifyRange with a massive list of versions, and those + // versions all concatenated with `||` is a geometric CPU explosion! + // we can try to be a *little* smarter up front by doing x-y for all + // contiguous version sets in the list + const ranges = [] + this.versions = semver.sort(this.versions, semverOpt) + this.vulnerableVersions = semver.sort(this.vulnerableVersions, semverOpt) + for (let v = 0, vulnVer = 0; v < this.versions.length; v++) { + // figure out the vulnerable subrange + const vr = [this.versions[v]] + while (v < this.versions.length) { + if (this.versions[v] !== this.vulnerableVersions[vulnVer]) { + // we don't test prerelease versions, so just skip past it + if (/-/.test(this.versions[v])) { + v++ + continue + } + break + } + if (vr.length > 1) { + vr[1] = this.versions[v] + } else { + vr.push(this.versions[v]) + } + v++ + vulnVer++ + } + // it'll either be just the first version, which means no overlap, + // or the start and end versions, which might be the same version + if (vr.length > 1) { + const tail = this.versions[this.versions.length - 1] + ranges.push(vr[1] === tail ? `>=${vr[0]}` + : vr[0] === vr[1] ? vr[0] + : vr.join(' - ')) + } + } + const metavuln = ranges.join(' || ').trim() + this.range = !metavuln ? '<0.0.0-0' + : semver.simplifyRange(this.versions, metavuln, semverOpt) + } + + // returns true if marked as vulnerable, false if ok + // spec is a dependency specifier, for metavuln cases + // where the version might not be in the packument. if + // we have the packument and spec is not provided, then + // we use the dependency version from the manifest. + testVersion (version, spec = null) { + const sv = String(version) + if (this[_versionVulnMemo].has(sv)) { + return this[_versionVulnMemo].get(sv) + } + + const result = this[_testVersion](version, spec) + if (result) { + this[_markVulnerable](version) + } + this[_versionVulnMemo].set(sv, !!result) + return result + } + + [_markVulnerable] (version) { + const sv = String(version) + if (!this.vulnerableVersions.includes(sv)) { + this.vulnerableVersions.push(sv) + } + } + + [_testVersion] (version, spec) { + const sv = String(version) + if (this.vulnerableVersions.includes(sv)) { + return true + } + + if (this.type === 'advisory') { + // advisory, just test range + return semver.satisfies(version, this.range, semverOpt) + } + + // check the dependency of this version on the vulnerable dep + // if we got a version that's not in the packument, fall back on + // the spec provided, if possible. + const mani = this[_packument]?.versions?.[version] || { + dependencies: { + [this.dependency]: spec, + }, + } + + if (!spec) { + spec = getDepSpec(mani, this.dependency) + } + + // no dep, no vuln + if (spec === null) { + return false + } + + if (!semver.validRange(spec, semverOpt)) { + // not a semver range, nothing we can hope to do about it + return true + } + + const bd = mani.bundleDependencies + const bundled = bd && bd.includes(this[_source].name) + // XXX if bundled, then semver.intersects() means vulnerable + // else, pick a manifest and see if it can't be avoided + // try to pick a version of the dep that isn't vulnerable + const avoid = this[_source].range + + if (bundled) { + return semver.intersects(spec, avoid, semverOpt) + } + + return this[_source].testSpec(spec) + } + + testSpec (spec) { + // testing all the versions is a bit costly, and the spec tends to stay + // consistent across multiple versions, so memoize this as well, in case + // we're testing lots of versions. + const memo = this[_specVulnMemo] + if (memo.has(spec)) { + return memo.get(spec) + } + + const res = this[_testSpec](spec) + memo.set(spec, res) + return res + } + + [_testSpec] (spec) { + for (const v of this.versions) { + const satisfies = semver.satisfies(v, spec) + if (!satisfies) { + continue + } + if (!this.testVersion(v)) { + return false + } + } + // either vulnerable, or not installable because nothing satisfied + // either way, best avoided. + return true + } + + [_testVersions] (versions) { + if (!versions.length) { + return + } + + // set of lists of versions + const versionSets = new Set() + versions = semver.sort(versions.map(v => semver.parse(v, semverOpt))) + + // start out with the versions grouped by major and minor + let last = versions[0].major + '.' + versions[0].minor + let list = [] + versionSets.add(list) + for (const v of versions) { + const k = v.major + '.' + v.minor + if (k !== last) { + last = k + list = [] + versionSets.add(list) + } + list.push(v) + } + + for (const set of versionSets) { + // it's common to have version lists like: + // 1.0.0 + // 1.0.1-alpha.0 + // 1.0.1-alpha.1 + // ... + // 1.0.1-alpha.999 + // 1.0.1 + // 1.0.2-alpha.0 + // ... + // 1.0.2-alpha.99 + // 1.0.2 + // with a huge number of prerelease versions that are not installable + // anyway. + // If mid has a prerelease tag, and set[0] does not, then walk it + // back until we hit a non-prerelease version + // If mid has a prerelease tag, and set[set.length-1] does not, + // then walk it forward until we hit a version without a prerelease tag + // Similarly, if the head/tail is a prerelease, but there is a non-pr + // version in the set, then start there instead. + let h = 0 + const origHeadVuln = this.testVersion(set[h]) + while (h < set.length && /-/.test(String(set[h]))) { + h++ + } + + // don't filter out the whole list! they might all be pr's + if (h === set.length) { + h = 0 + } else if (origHeadVuln) { + // if the original was vulnerable, assume so are all of these + for (let hh = 0; hh < h; hh++) { + this[_markVulnerable](set[hh]) + } + } + + let t = set.length - 1 + const origTailVuln = this.testVersion(set[t]) + while (t > h && /-/.test(String(set[t]))) { + t-- + } + + // don't filter out the whole list! might all be pr's + if (t === h) { + t = set.length - 1 + } else if (origTailVuln) { + // if original tail was vulnerable, assume these are as well + for (let tt = set.length - 1; tt > t; tt--) { + this[_markVulnerable](set[tt]) + } + } + + const headVuln = h === 0 ? origHeadVuln + : this.testVersion(set[h]) + + const tailVuln = t === set.length - 1 ? origTailVuln + : this.testVersion(set[t]) + + // if head and tail both vulnerable, whole list is thrown out + if (headVuln && tailVuln) { + for (let v = h; v < t; v++) { + this[_markVulnerable](set[v]) + } + continue + } + + // if length is 2 or 1, then we marked them all already + if (t < h + 2) { + continue + } + + const mid = Math.floor(set.length / 2) + const pre = set.slice(0, mid) + const post = set.slice(mid) + + // if the parent list wasn't prereleases, then drop pr tags + // from end of the pre list, and beginning of the post list, + // marking as vulnerable if the midpoint item we picked is. + if (!/-/.test(String(pre[0]))) { + const midVuln = this.testVersion(pre[pre.length - 1]) + while (/-/.test(String(pre[pre.length - 1]))) { + const v = pre.pop() + if (midVuln) { + this[_markVulnerable](v) + } + } + } + + if (!/-/.test(String(post[post.length - 1]))) { + const midVuln = this.testVersion(post[0]) + while (/-/.test(String(post[0]))) { + const v = post.shift() + if (midVuln) { + this[_markVulnerable](v) + } + } + } + + versionSets.add(pre) + versionSets.add(post) + } + } +} + +module.exports = Advisory diff --git a/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/get-dep-spec.js b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/get-dep-spec.js new file mode 100644 index 00000000..8d1d72b8 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/get-dep-spec.js @@ -0,0 +1,15 @@ +module.exports = (mani, name) => { + // skip dev because that only matters at the root, + // where we aren't fetching a manifest from the registry + // with multiple versions anyway. + const { + dependencies: deps = {}, + optionalDependencies: optDeps = {}, + peerDependencies: peerDeps = {}, + } = mani + + return deps && typeof deps[name] === 'string' ? deps[name] + : optDeps && typeof optDeps[name] === 'string' ? optDeps[name] + : peerDeps && typeof peerDeps[name] === 'string' ? peerDeps[name] + : null +} diff --git a/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/hash.js b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/hash.js new file mode 100644 index 00000000..634bf99d --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/hash.js @@ -0,0 +1,5 @@ +const { createHash } = require('crypto') + +module.exports = ({ name, source }) => createHash('sha512') + .update(JSON.stringify([name, source])) + .digest('base64') diff --git a/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js new file mode 100644 index 00000000..971409b5 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js @@ -0,0 +1,128 @@ +// this is the public class that is used by consumers. +// the Advisory class handles all the calculation, and this +// class handles all the IO with the registry and cache. +const pacote = require('pacote') +const cacache = require('cacache') +const { time } = require('proc-log') +const Advisory = require('./advisory.js') +const { homedir } = require('os') +const jsonParse = require('json-parse-even-better-errors') + +const _packument = Symbol('packument') +const _cachePut = Symbol('cachePut') +const _cacheGet = Symbol('cacheGet') +const _cacheData = Symbol('cacheData') +const _packuments = Symbol('packuments') +const _cache = Symbol('cache') +const _options = Symbol('options') +const _advisories = Symbol('advisories') +const _calculate = Symbol('calculate') + +class Calculator { + constructor (options = {}) { + this[_options] = { ...options } + this[_cache] = this[_options].cache || (homedir() + '/.npm/_cacache') + this[_options].cache = this[_cache] + this[_packuments] = new Map() + this[_cacheData] = new Map() + this[_advisories] = new Map() + } + + get cache () { + return this[_cache] + } + + get options () { + return { ...this[_options] } + } + + async calculate (name, source) { + const k = `security-advisory:${name}:${source.id}` + if (this[_advisories].has(k)) { + return this[_advisories].get(k) + } + + const p = this[_calculate](name, source) + this[_advisories].set(k, p) + return p + } + + async [_calculate] (name, source) { + const k = `security-advisory:${name}:${source.id}` + const timeEnd = time.start(`metavuln:calculate:${k}`) + const advisory = new Advisory(name, source, this[_options]) + // load packument and cached advisory + const [cached, packument] = await Promise.all([ + this[_cacheGet](advisory), + this[_packument](name), + ]) + const timeEndLoad = time.start(`metavuln:load:${k}`) + advisory.load(cached, packument) + timeEndLoad() + if (advisory.updated) { + await this[_cachePut](advisory) + } + this[_advisories].set(k, advisory) + timeEnd() + return advisory + } + + async [_cachePut] (advisory) { + const { name, id } = advisory + const key = `security-advisory:${name}:${id}` + const timeEnd = time.start(`metavuln:cache:put:${key}`) + const data = JSON.stringify(advisory) + const options = { ...this[_options] } + this[_cacheData].set(key, jsonParse(data)) + await cacache.put(this[_cache], key, data, options).catch(() => {}) + timeEnd() + } + + async [_cacheGet] (advisory) { + const { name, id } = advisory + const key = `security-advisory:${name}:${id}` + /* istanbul ignore if - should be impossible, since we memoize the + * advisory object itself using the same key, just being cautious */ + if (this[_cacheData].has(key)) { + return this[_cacheData].get(key) + } + + const timeEnd = time.start(`metavuln:cache:get:${key}`) + const p = cacache.get(this[_cache], key, { ...this[_options] }) + .catch(() => ({ data: '{}' })) + .then(({ data }) => { + data = jsonParse(data) + timeEnd() + this[_cacheData].set(key, data) + return data + }) + this[_cacheData].set(key, p) + return p + } + + async [_packument] (name) { + if (this[_packuments].has(name)) { + return this[_packuments].get(name) + } + + const timeEnd = time.start(`metavuln:packument:${name}`) + const p = pacote.packument(name, { ...this[_options] }) + .catch(() => { + // presumably not something from the registry. + // an empty packument will have an effective range of * + return { + name, + versions: {}, + } + }) + .then(paku => { + timeEnd() + this[_packuments].set(name, paku) + return paku + }) + this[_packuments].set(name, p) + return p + } +} + +module.exports = Calculator diff --git a/node_modules/npm/node_modules/@npmcli/metavuln-calculator/package.json b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/package.json new file mode 100644 index 00000000..1343b374 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/metavuln-calculator/package.json @@ -0,0 +1,62 @@ +{ + "name": "@npmcli/metavuln-calculator", + "version": "9.0.0", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "description": "Calculate meta-vulnerabilities from package security advisories", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/metavuln-calculator.git" + }, + "author": "GitHub Inc.", + "license": "ISC", + "scripts": { + "test": "tap", + "posttest": "npm run lint", + "snap": "tap", + "postsnap": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force" + }, + "tap": { + "check-coverage": true, + "coverage-map": "map.js", + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.4", + "require-inject": "^1.4.4", + "tap": "^16.0.1" + }, + "dependencies": { + "cacache": "^19.0.0", + "json-parse-even-better-errors": "^4.0.0", + "pacote": "^21.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.4", + "publish": "true", + "ciVersions": [ + "16.14.0", + "16.x", + "18.0.0", + "18.x" + ] + } +} diff --git a/node_modules/npm/node_modules/@npmcli/name-from-folder/LICENSE b/node_modules/npm/node_modules/@npmcli/name-from-folder/LICENSE new file mode 100644 index 00000000..d24a9fca --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/name-from-folder/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 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/npm/node_modules/@npmcli/name-from-folder/lib/index.js b/node_modules/npm/node_modules/@npmcli/name-from-folder/lib/index.js new file mode 100644 index 00000000..afb1dbb7 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/name-from-folder/lib/index.js @@ -0,0 +1,7 @@ +const { basename, dirname } = require('path') + +const getName = (parent, base) => + parent.charAt(0) === '@' ? `${parent}/${base}` : base + +module.exports = dir => dir ? getName(basename(dirname(dir)), basename(dir)) + : false diff --git a/node_modules/npm/node_modules/@npmcli/name-from-folder/package.json b/node_modules/npm/node_modules/@npmcli/name-from-folder/package.json new file mode 100644 index 00000000..323edd81 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/name-from-folder/package.json @@ -0,0 +1,45 @@ +{ + "name": "@npmcli/name-from-folder", + "version": "3.0.0", + "files": [ + "bin/", + "lib/" + ], + "main": "lib/index.js", + "description": "Get the package name from a folder path", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/name-from-folder.git" + }, + "author": "GitHub Inc.", + "license": "ISC", + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.3.2" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/@npmcli/node-gyp/LICENSE b/node_modules/npm/node_modules/@npmcli/node-gyp/LICENSE new file mode 100644 index 00000000..3609cabc --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/node-gyp/LICENSE @@ -0,0 +1,7 @@ +ISC License: + +Copyright (c) 2023 by GitHub 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/npm/node_modules/@npmcli/node-gyp/lib/index.js b/node_modules/npm/node_modules/@npmcli/node-gyp/lib/index.js new file mode 100644 index 00000000..cdf18560 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/node-gyp/lib/index.js @@ -0,0 +1,14 @@ +const util = require('util') +const fs = require('fs') +const { stat } = fs.promises || { stat: util.promisify(fs.stat) } + +async function isNodeGypPackage (path) { + return await stat(`${path}/binding.gyp`) + .then(st => st.isFile()) + .catch(() => false) +} + +module.exports = { + isNodeGypPackage, + defaultGypInstallScript: 'node-gyp rebuild', +} diff --git a/node_modules/npm/node_modules/@npmcli/node-gyp/package.json b/node_modules/npm/node_modules/@npmcli/node-gyp/package.json new file mode 100644 index 00000000..3be9663a --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/node-gyp/package.json @@ -0,0 +1,50 @@ +{ + "name": "@npmcli/node-gyp", + "version": "4.0.0", + "description": "Tools for dealing with node-gyp packages", + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/node-gyp.git" + }, + "keywords": [ + "npm", + "cli", + "node-gyp" + ], + "files": [ + "bin/", + "lib/" + ], + "main": "lib/index.js", + "author": "GitHub Inc.", + "license": "ISC", + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/@npmcli/package-json/LICENSE b/node_modules/npm/node_modules/@npmcli/package-json/LICENSE new file mode 100644 index 00000000..6a1f3708 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/package-json/LICENSE @@ -0,0 +1,18 @@ +ISC License + +Copyright GitHub 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/npm/node_modules/@npmcli/package-json/lib/index.js b/node_modules/npm/node_modules/@npmcli/package-json/lib/index.js new file mode 100644 index 00000000..23f326dd --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/package-json/lib/index.js @@ -0,0 +1,283 @@ +const { readFile, writeFile } = require('node:fs/promises') +const { resolve } = require('node:path') +const parseJSON = require('json-parse-even-better-errors') + +const updateDeps = require('./update-dependencies.js') +const updateScripts = require('./update-scripts.js') +const updateWorkspaces = require('./update-workspaces.js') +const normalize = require('./normalize.js') +const { read, parse } = require('./read-package.js') +const { packageSort } = require('./sort.js') + +// a list of handy specialized helper functions that take +// care of special cases that are handled by the npm cli +const knownSteps = new Set([ + updateDeps, + updateScripts, + updateWorkspaces, +]) + +// list of all keys that are handled by "knownSteps" helpers +const knownKeys = new Set([ + ...updateDeps.knownKeys, + 'scripts', + 'workspaces', +]) + +class PackageJson { + static normalizeSteps = Object.freeze([ + '_id', + '_attributes', + 'bundledDependencies', + 'bundleDependencies', + 'optionalDedupe', + 'scripts', + 'funding', + 'bin', + ]) + + // npm pkg fix + static fixSteps = Object.freeze([ + 'binRefs', + 'bundleDependencies', + 'bundleDependenciesFalse', + 'fixNameField', + 'fixVersionField', + 'fixRepositoryField', + 'fixDependencies', + 'devDependencies', + 'scriptpath', + ]) + + static prepareSteps = Object.freeze([ + '_id', + '_attributes', + 'bundledDependencies', + 'bundleDependencies', + 'bundleDependenciesDeleteFalse', + 'gypfile', + 'serverjs', + 'scriptpath', + 'authors', + 'readme', + 'mans', + 'binDir', + 'gitHead', + 'fillTypes', + 'normalizeData', + 'binRefs', + ]) + + // create a new empty package.json, so we can save at the given path even + // though we didn't start from a parsed file + static async create (path, opts = {}) { + const p = new PackageJson() + await p.create(path) + if (opts.data) { + return p.update(opts.data) + } + return p + } + + // Loads a package.json at given path and JSON parses + static async load (path, opts = {}) { + const p = new PackageJson() + // Avoid try/catch if we aren't going to create + if (!opts.create) { + return p.load(path) + } + + try { + return await p.load(path) + } catch (err) { + if (!err.message.startsWith('Could not read package.json')) { + throw err + } + return await p.create(path) + } + } + + // npm pkg fix + static async fix (path, opts) { + const p = new PackageJson() + await p.load(path, true) + return p.fix(opts) + } + + // read-package-json compatible behavior + static async prepare (path, opts) { + const p = new PackageJson() + await p.load(path, true) + return p.prepare(opts) + } + + // read-package-json-fast compatible behavior + static async normalize (path, opts) { + const p = new PackageJson() + await p.load(path) + return p.normalize(opts) + } + + #path + #manifest + #readFileContent = '' + #canSave = true + + // Load content from given path + async load (path, parseIndex) { + this.#path = path + let parseErr + try { + this.#readFileContent = await read(this.filename) + } catch (err) { + if (!parseIndex) { + throw err + } + parseErr = err + } + + if (parseErr) { + const indexFile = resolve(this.path, 'index.js') + let indexFileContent + try { + indexFileContent = await readFile(indexFile, 'utf8') + } catch (err) { + throw parseErr + } + try { + this.fromComment(indexFileContent) + } catch (err) { + throw parseErr + } + // This wasn't a package.json so prevent saving + this.#canSave = false + return this + } + + return this.fromJSON(this.#readFileContent) + } + + // Load data from a JSON string/buffer + fromJSON (data) { + this.#manifest = parse(data) + return this + } + + fromContent (data) { + this.#manifest = data + this.#canSave = false + return this + } + + // Load data from a comment + // /**package { "name": "foo", "version": "1.2.3", ... } **/ + fromComment (data) { + data = data.split(/^\/\*\*package(?:\s|$)/m) + + if (data.length < 2) { + throw new Error('File has no package in comments') + } + data = data[1] + data = data.split(/\*\*\/$/m) + + if (data.length < 2) { + throw new Error('File has no package in comments') + } + data = data[0] + data = data.replace(/^\s*\*/mg, '') + + this.#manifest = parseJSON(data) + return this + } + + get content () { + return this.#manifest + } + + get path () { + return this.#path + } + + get filename () { + if (this.path) { + return resolve(this.path, 'package.json') + } + return undefined + } + + create (path) { + this.#path = path + this.#manifest = {} + return this + } + + // This should be the ONLY way to set content in the manifest + update (content) { + if (!this.content) { + throw new Error('Can not update without content. Please `load` or `create`') + } + + for (const step of knownSteps) { + this.#manifest = step({ content, originalContent: this.content }) + } + + // unknown properties will just be overwitten + for (const [key, value] of Object.entries(content)) { + if (!knownKeys.has(key)) { + this.content[key] = value + } + } + + return this + } + + async save ({ sort } = {}) { + if (!this.#canSave) { + throw new Error('No package.json to save to') + } + const { + [Symbol.for('indent')]: indent, + [Symbol.for('newline')]: newline, + ...rest + } = this.content + + const format = indent === undefined ? ' ' : indent + const eol = newline === undefined ? '\n' : newline + + const content = sort ? packageSort(rest) : rest + + const fileContent = `${ + JSON.stringify(content, null, format) + }\n` + .replace(/\n/g, eol) + + if (fileContent.trim() !== this.#readFileContent.trim()) { + return await writeFile(this.filename, fileContent) + } + } + + async normalize (opts = {}) { + if (!opts.steps) { + opts.steps = this.constructor.normalizeSteps + } + await normalize(this, opts) + return this + } + + async prepare (opts = {}) { + if (!opts.steps) { + opts.steps = this.constructor.prepareSteps + } + await normalize(this, opts) + return this + } + + async fix (opts = {}) { + // This one is not overridable + opts.steps = this.constructor.fixSteps + await normalize(this, opts) + return this + } +} + +module.exports = PackageJson diff --git a/node_modules/npm/node_modules/@npmcli/package-json/lib/normalize.js b/node_modules/npm/node_modules/@npmcli/package-json/lib/normalize.js new file mode 100644 index 00000000..3adec014 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/package-json/lib/normalize.js @@ -0,0 +1,615 @@ +const valid = require('semver/functions/valid') +const clean = require('semver/functions/clean') +const fs = require('node:fs/promises') +const path = require('node:path') +const { log } = require('proc-log') + +/** + * @type {import('hosted-git-info')} + */ +let _hostedGitInfo +function lazyHostedGitInfo () { + if (!_hostedGitInfo) { + _hostedGitInfo = require('hosted-git-info') + } + return _hostedGitInfo +} + +/** + * @type {import('glob').glob} + */ +let _glob +function lazyLoadGlob () { + if (!_glob) { + _glob = require('glob').glob + } + return _glob +} + +// used to be npm-normalize-package-bin +function normalizePackageBin (pkg, changes) { + if (pkg.bin) { + if (typeof pkg.bin === 'string' && pkg.name) { + changes?.push('"bin" was converted to an object') + pkg.bin = { [pkg.name]: pkg.bin } + } else if (Array.isArray(pkg.bin)) { + changes?.push('"bin" was converted to an object') + pkg.bin = pkg.bin.reduce((acc, k) => { + acc[path.basename(k)] = k + return acc + }, {}) + } + if (typeof pkg.bin === 'object') { + for (const binKey in pkg.bin) { + if (typeof pkg.bin[binKey] !== 'string') { + delete pkg.bin[binKey] + changes?.push(`removed invalid "bin[${binKey}]"`) + continue + } + const base = path.basename(secureAndUnixifyPath(binKey)) + if (!base) { + delete pkg.bin[binKey] + changes?.push(`removed invalid "bin[${binKey}]"`) + continue + } + + const binTarget = secureAndUnixifyPath(pkg.bin[binKey]) + + if (!binTarget) { + delete pkg.bin[binKey] + changes?.push(`removed invalid "bin[${binKey}]"`) + continue + } + + if (base !== binKey) { + delete pkg.bin[binKey] + changes?.push(`"bin[${binKey}]" was renamed to "bin[${base}]"`) + } + if (binTarget !== pkg.bin[binKey]) { + changes?.push(`"bin[${base}]" script name was cleaned`) + } + pkg.bin[base] = binTarget + } + + if (Object.keys(pkg.bin).length === 0) { + changes?.push('empty "bin" was removed') + delete pkg.bin + } + + return pkg + } + } + delete pkg.bin +} + +function normalizePackageMan (pkg, changes) { + if (pkg.man) { + const mans = [] + for (const man of (Array.isArray(pkg.man) ? pkg.man : [pkg.man])) { + if (typeof man !== 'string') { + changes?.push(`removed invalid "man [${man}]"`) + } else { + mans.push(secureAndUnixifyPath(man)) + } + } + + if (!mans.length) { + changes?.push('empty "man" was removed') + } else { + pkg.man = mans + return pkg + } + } + delete pkg.man +} + +function isCorrectlyEncodedName (spec) { + return !spec.match(/[/@\s+%:]/) && + spec === encodeURIComponent(spec) +} + +function isValidScopedPackageName (spec) { + if (spec.charAt(0) !== '@') { + return false + } + + const rest = spec.slice(1).split('/') + if (rest.length !== 2) { + return false + } + + return rest[0] && rest[1] && + rest[0] === encodeURIComponent(rest[0]) && + rest[1] === encodeURIComponent(rest[1]) +} + +function unixifyPath (ref) { + return ref.replace(/\\|:/g, '/') +} + +function secureAndUnixifyPath (ref) { + const secured = unixifyPath(path.join('.', path.join('/', unixifyPath(ref)))) + return secured.startsWith('./') ? '' : secured +} + +// We don't want the `changes` array in here by default because this is a hot +// path for parsing packuments during install. So the calling method passes it +// in if it wants to track changes. +const normalize = async (pkg, { strict, steps, root, changes, allowLegacyCase }) => { + if (!pkg.content) { + throw new Error('Can not normalize without content') + } + const data = pkg.content + const scripts = data.scripts || {} + const pkgId = `${data.name ?? ''}@${data.version ?? ''}` + + // name and version are load bearing so we have to clean them up first + if (steps.includes('fixNameField') || steps.includes('normalizeData')) { + if (!data.name && !strict) { + changes?.push('Missing "name" field was set to an empty string') + data.name = '' + } else { + if (typeof data.name !== 'string') { + throw new Error('name field must be a string.') + } + if (!strict) { + const name = data.name.trim() + if (data.name !== name) { + changes?.push(`Whitespace was trimmed from "name"`) + data.name = name + } + } + + if (data.name.startsWith('.') || + !(isValidScopedPackageName(data.name) || isCorrectlyEncodedName(data.name)) || + (strict && (!allowLegacyCase) && data.name !== data.name.toLowerCase()) || + data.name.toLowerCase() === 'node_modules' || + data.name.toLowerCase() === 'favicon.ico') { + throw new Error('Invalid name: ' + JSON.stringify(data.name)) + } + } + } + + if (steps.includes('fixVersionField') || steps.includes('normalizeData')) { + // allow "loose" semver 1.0 versions in non-strict mode + // enforce strict semver 2.0 compliance in strict mode + const loose = !strict + if (!data.version) { + data.version = '' + } else { + if (!valid(data.version, loose)) { + throw new Error(`Invalid version: "${data.version}"`) + } + const version = clean(data.version, loose) + if (version !== data.version) { + changes?.push(`"version" was cleaned and set to "${version}"`) + data.version = version + } + } + } + // remove attributes that start with "_" + if (steps.includes('_attributes')) { + for (const key in data) { + if (key.startsWith('_')) { + changes?.push(`"${key}" was removed`) + delete pkg.content[key] + } + } + } + + // build the "_id" attribute + if (steps.includes('_id')) { + if (data.name && data.version) { + changes?.push(`"_id" was set to ${pkgId}`) + data._id = pkgId + } + } + + // fix bundledDependencies typo + // normalize bundleDependencies + if (steps.includes('bundledDependencies')) { + if (data.bundleDependencies === undefined && data.bundledDependencies !== undefined) { + data.bundleDependencies = data.bundledDependencies + } + changes?.push(`Deleted incorrect "bundledDependencies"`) + delete data.bundledDependencies + } + // expand "bundleDependencies: true or translate from object" + if (steps.includes('bundleDependencies')) { + const bd = data.bundleDependencies + if (bd === false && !steps.includes('bundleDependenciesDeleteFalse')) { + changes?.push(`"bundleDependencies" was changed from "false" to "[]"`) + data.bundleDependencies = [] + } else if (bd === true) { + changes?.push(`"bundleDependencies" was auto-populated from "dependencies"`) + data.bundleDependencies = Object.keys(data.dependencies || {}) + } else if (bd && typeof bd === 'object') { + if (!Array.isArray(bd)) { + changes?.push(`"bundleDependencies" was changed from an object to an array`) + data.bundleDependencies = Object.keys(bd) + } + } else if ('bundleDependencies' in data) { + changes?.push(`"bundleDependencies" was removed`) + delete data.bundleDependencies + } + } + + // it was once common practice to list deps both in optionalDependencies and + // in dependencies, to support npm versions that did not know about + // optionalDependencies. This is no longer a relevant need, so duplicating + // the deps in two places is unnecessary and excessive. + if (steps.includes('optionalDedupe')) { + if (data.dependencies && + data.optionalDependencies && typeof data.optionalDependencies === 'object') { + for (const name in data.optionalDependencies) { + changes?.push(`optionalDependencies."${name}" was removed`) + delete data.dependencies[name] + } + if (!Object.keys(data.dependencies).length) { + changes?.push(`Empty "optionalDependencies" was removed`) + delete data.dependencies + } + } + } + + // add "install" attribute if any "*.gyp" files exist + if (steps.includes('gypfile')) { + if (!scripts.install && !scripts.preinstall && data.gypfile !== false) { + const files = await lazyLoadGlob()('*.gyp', { cwd: pkg.path }) + if (files.length) { + scripts.install = 'node-gyp rebuild' + data.scripts = scripts + data.gypfile = true + changes?.push(`"scripts.install" was set to "node-gyp rebuild"`) + changes?.push(`"gypfile" was set to "true"`) + } + } + } + + // add "start" attribute if "server.js" exists + if (steps.includes('serverjs') && !scripts.start) { + try { + await fs.access(path.join(pkg.path, 'server.js')) + scripts.start = 'node server.js' + data.scripts = scripts + changes?.push('"scripts.start" was set to "node server.js"') + } catch { + // do nothing + } + } + + // strip "node_modules/.bin" from scripts entries + // remove invalid scripts entries (non-strings) + if ((steps.includes('scripts') || steps.includes('scriptpath')) && data.scripts !== undefined) { + const spre = /^(\.[/\\])?node_modules[/\\].bin[\\/]/ + if (typeof data.scripts === 'object') { + for (const name in data.scripts) { + if (typeof data.scripts[name] !== 'string') { + delete data.scripts[name] + changes?.push(`Invalid scripts."${name}" was removed`) + } else if (steps.includes('scriptpath') && spre.test(data.scripts[name])) { + data.scripts[name] = data.scripts[name].replace(spre, '') + changes?.push(`scripts entry "${name}" was fixed to remove node_modules/.bin reference`) + } + } + } else { + changes?.push(`Removed invalid "scripts"`) + delete data.scripts + } + } + + if (steps.includes('funding')) { + if (data.funding && typeof data.funding === 'string') { + data.funding = { url: data.funding } + changes?.push(`"funding" was changed to an object with a url attribute`) + } + } + + // populate "authors" attribute + if (steps.includes('authors') && !data.contributors) { + try { + const authorData = await fs.readFile(path.join(pkg.path, 'AUTHORS'), 'utf8') + const authors = authorData.split(/\r?\n/g) + .map(line => line.replace(/^\s*#.*$/, '').trim()) + .filter(line => line) + data.contributors = authors + changes?.push('"contributors" was auto-populated with the contents of the "AUTHORS" file') + } catch { + // do nothing + } + } + + // populate "readme" attribute + if (steps.includes('readme') && !data.readme) { + const mdre = /\.m?a?r?k?d?o?w?n?$/i + const files = await lazyLoadGlob()('{README,README.*}', { + cwd: pkg.path, + nocase: true, + mark: true, + }) + let readmeFile + for (const file of files) { + // don't accept directories. + if (!file.endsWith(path.sep)) { + if (file.match(mdre)) { + readmeFile = file + break + } + if (file.endsWith('README')) { + readmeFile = file + } + } + } + if (readmeFile) { + const readmeData = await fs.readFile(path.join(pkg.path, readmeFile), 'utf8') + data.readme = readmeData + data.readmeFilename = readmeFile + changes?.push(`"readme" was set to the contents of ${readmeFile}`) + changes?.push(`"readmeFilename" was set to ${readmeFile}`) + } + if (!data.readme) { + // this.warn('missingReadme') + data.readme = 'ERROR: No README data found!' + } + } + + // expand directories.man + if (steps.includes('mans')) { + if (data.directories?.man && !data.man) { + const manDir = secureAndUnixifyPath(data.directories.man) + const cwd = path.resolve(pkg.path, manDir) + const files = await lazyLoadGlob()('**/*.[0-9]', { cwd }) + data.man = files.map(man => + path.relative(pkg.path, path.join(cwd, man)).split(path.sep).join('/') + ) + } + normalizePackageMan(data, changes) + } + + if (steps.includes('bin') || steps.includes('binDir') || steps.includes('binRefs')) { + normalizePackageBin(data, changes) + } + + // expand "directories.bin" + if (steps.includes('binDir') && data.directories?.bin && !data.bin) { + const binsDir = path.resolve(pkg.path, secureAndUnixifyPath(data.directories.bin)) + const bins = await lazyLoadGlob()('**', { cwd: binsDir }) + data.bin = bins.reduce((acc, binFile) => { + if (binFile && !binFile.startsWith('.')) { + const binName = path.basename(binFile) + acc[binName] = path.join(data.directories.bin, binFile) + } + return acc + }, {}) + // *sigh* + normalizePackageBin(data, changes) + } + + // populate "gitHead" attribute + if (steps.includes('gitHead') && !data.gitHead) { + const git = require('@npmcli/git') + const gitRoot = await git.find({ cwd: pkg.path, root }) + let head + if (gitRoot) { + try { + head = await fs.readFile(path.resolve(gitRoot, '.git/HEAD'), 'utf8') + } catch (err) { + // do nothing + } + } + let headData + if (head) { + if (head.startsWith('ref: ')) { + const headRef = head.replace(/^ref: /, '').trim() + const headFile = path.resolve(gitRoot, '.git', headRef) + try { + headData = await fs.readFile(headFile, 'utf8') + headData = headData.replace(/^ref: /, '').trim() + } catch (err) { + // do nothing + } + if (!headData) { + const packFile = path.resolve(gitRoot, '.git/packed-refs') + try { + let refs = await fs.readFile(packFile, 'utf8') + if (refs) { + refs = refs.split('\n') + for (let i = 0; i < refs.length; i++) { + const match = refs[i].match(/^([0-9a-f]{40}) (.+)$/) + if (match && match[2].trim() === headRef) { + headData = match[1] + break + } + } + } + } catch { + // do nothing + } + } + } else { + headData = head.trim() + } + } + if (headData) { + data.gitHead = headData + } + } + + // populate "types" attribute + if (steps.includes('fillTypes')) { + const index = data.main || 'index.js' + + if (typeof index !== 'string') { + throw new TypeError('The "main" attribute must be of type string.') + } + + // TODO exports is much more complicated than this in verbose format + // We need to support for instance + + // "exports": { + // ".": [ + // { + // "default": "./lib/npm.js" + // }, + // "./lib/npm.js" + // ], + // "./package.json": "./package.json" + // }, + // as well as conditional exports + + // if (data.exports && typeof data.exports === 'string') { + // index = data.exports + // } + + // if (data.exports && data.exports['.']) { + // index = data.exports['.'] + // if (typeof index !== 'string') { + // } + // } + const extless = path.join(path.dirname(index), path.basename(index, path.extname(index))) + const dts = `./${extless}.d.ts` + const hasDTSFields = 'types' in data || 'typings' in data + if (!hasDTSFields) { + try { + await fs.access(path.join(pkg.path, dts)) + data.types = dts.split(path.sep).join('/') + } catch { + // do nothing + } + } + } + + // "normalizeData" from "read-package-json", which was just a call through to + // "normalize-package-data". We only call the "fixer" functions because + // outside of that it was also clobbering _id (which we already conditionally + // do) and also adding the gypfile script (which we also already + // conditionally do) + + // Some steps are isolated so we can do a limited subset of these in `fix` + if (steps.includes('fixRepositoryField') || steps.includes('normalizeData')) { + if (data.repositories) { + /* eslint-disable-next-line max-len */ + changes?.push(`"repository" was set to the first entry in "repositories" (${data.repository})`) + data.repository = data.repositories[0] + } + if (data.repository) { + if (typeof data.repository === 'string') { + changes?.push('"repository" was changed from a string to an object') + data.repository = { + type: 'git', + url: data.repository, + } + } + if (data.repository.url) { + const hosted = lazyHostedGitInfo().fromUrl(data.repository.url) + let r + if (hosted) { + if (hosted.getDefaultRepresentation() === 'shortcut') { + r = hosted.https() + } else { + r = hosted.toString() + } + if (r !== data.repository.url) { + changes?.push(`"repository.url" was normalized to "${r}"`) + data.repository.url = r + } + } + } + } + } + + if (steps.includes('fixDependencies') || steps.includes('normalizeData')) { + // peerDependencies? + // devDependencies is meaningless here, it's ignored on an installed package + for (const type of ['dependencies', 'devDependencies', 'optionalDependencies']) { + if (data[type]) { + let secondWarning = true + if (typeof data[type] === 'string') { + changes?.push(`"${type}" was converted from a string into an object`) + data[type] = data[type].trim().split(/[\n\r\s\t ,]+/) + secondWarning = false + } + if (Array.isArray(data[type])) { + if (secondWarning) { + changes?.push(`"${type}" was converted from an array into an object`) + } + const o = {} + for (const d of data[type]) { + if (typeof d === 'string') { + const dep = d.trim().split(/(:?[@\s><=])/) + const dn = dep.shift() + const dv = dep.join('').replace(/^@/, '').trim() + o[dn] = dv + } + } + data[type] = o + } + } + } + // normalize-package-data used to put optional dependencies BACK into + // dependencies here, we no longer do this + + for (const deps of ['dependencies', 'devDependencies']) { + if (deps in data) { + if (!data[deps] || typeof data[deps] !== 'object') { + changes?.push(`Removed invalid "${deps}"`) + delete data[deps] + } else { + for (const d in data[deps]) { + const r = data[deps][d] + if (typeof r !== 'string') { + changes?.push(`Removed invalid "${deps}.${d}"`) + delete data[deps][d] + } + const hosted = lazyHostedGitInfo().fromUrl(data[deps][d])?.toString() + if (hosted && hosted !== data[deps][d]) { + changes?.push(`Normalized git reference to "${deps}.${d}"`) + data[deps][d] = hosted.toString() + } + } + } + } + } + } + + if (steps.includes('normalizeData')) { + const legacyFixer = require('normalize-package-data/lib/fixer.js') + const legacyMakeWarning = require('normalize-package-data/lib/make_warning.js') + legacyFixer.warn = function () { + changes?.push(legacyMakeWarning.apply(null, arguments)) + } + + const legacySteps = [ + 'fixDescriptionField', + 'fixModulesField', + 'fixFilesField', + 'fixManField', + 'fixBugsField', + 'fixKeywordsField', + 'fixBundleDependenciesField', + 'fixHomepageField', + 'fixReadmeField', + 'fixLicenseField', + 'fixPeople', + 'fixTypos', + ] + for (const legacyStep of legacySteps) { + legacyFixer[legacyStep](data) + } + } + + // Warn if the bin references don't point to anything. This might be better + // in normalize-package-data if it had access to the file path. + if (steps.includes('binRefs') && data.bin instanceof Object) { + for (const key in data.bin) { + try { + await fs.access(path.resolve(pkg.path, data.bin[key])) + } catch { + log.warn('package-json', pkgId, `No bin file found at ${data.bin[key]}`) + // XXX: should a future breaking change delete bin entries that cannot be accessed? + } + } + } +} + +module.exports = normalize diff --git a/node_modules/npm/node_modules/@npmcli/package-json/lib/read-package.js b/node_modules/npm/node_modules/@npmcli/package-json/lib/read-package.js new file mode 100644 index 00000000..d6c86ce3 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/package-json/lib/read-package.js @@ -0,0 +1,39 @@ +// This is JUST the code needed to open a package.json file and parse it. +// It's isolated out so that code needing to parse a package.json file can do so in the same way as this module does, without needing to require the whole module, or needing to require the underlying parsing library. + +const { readFile } = require('fs/promises') +const parseJSON = require('json-parse-even-better-errors') + +async function read (filename) { + try { + const data = await readFile(filename, 'utf8') + return data + } catch (err) { + err.message = `Could not read package.json: ${err}` + throw err + } +} + +function parse (data) { + try { + const content = parseJSON(data) + return content + } catch (err) { + err.message = `Invalid package.json: ${err}` + throw err + } +} + +// This is what most external libs will use. +// PackageJson will call read and parse separately +async function readPackage (filename) { + const data = await read(filename) + const content = parse(data) + return content +} + +module.exports = { + read, + parse, + readPackage, +} diff --git a/node_modules/npm/node_modules/@npmcli/package-json/lib/sort.js b/node_modules/npm/node_modules/@npmcli/package-json/lib/sort.js new file mode 100644 index 00000000..0bd0d519 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/package-json/lib/sort.js @@ -0,0 +1,101 @@ +/** + * arbitrary sort order for package.json largely pulled from: + * https://github.com/keithamus/sort-package-json/blob/main/defaultRules.md + * + * cross checked with: + * https://github.com/npm/types/blob/main/types/index.d.ts#L104 + * https://docs.npmjs.com/cli/configuring-npm/package-json + */ +function packageSort (json) { + const { + name, + version, + private: isPrivate, + description, + keywords, + homepage, + bugs, + repository, + funding, + license, + author, + maintainers, + contributors, + type, + imports, + exports, + main, + browser, + types, + bin, + man, + directories, + files, + workspaces, + scripts, + config, + dependencies, + devDependencies, + peerDependencies, + peerDependenciesMeta, + optionalDependencies, + bundledDependencies, + bundleDependencies, + engines, + os, + cpu, + publishConfig, + devEngines, + licenses, + overrides, + ...rest + } = json + + return { + ...(typeof name !== 'undefined' ? { name } : {}), + ...(typeof version !== 'undefined' ? { version } : {}), + ...(typeof isPrivate !== 'undefined' ? { private: isPrivate } : {}), + ...(typeof description !== 'undefined' ? { description } : {}), + ...(typeof keywords !== 'undefined' ? { keywords } : {}), + ...(typeof homepage !== 'undefined' ? { homepage } : {}), + ...(typeof bugs !== 'undefined' ? { bugs } : {}), + ...(typeof repository !== 'undefined' ? { repository } : {}), + ...(typeof funding !== 'undefined' ? { funding } : {}), + ...(typeof license !== 'undefined' ? { license } : {}), + ...(typeof author !== 'undefined' ? { author } : {}), + ...(typeof maintainers !== 'undefined' ? { maintainers } : {}), + ...(typeof contributors !== 'undefined' ? { contributors } : {}), + ...(typeof type !== 'undefined' ? { type } : {}), + ...(typeof imports !== 'undefined' ? { imports } : {}), + ...(typeof exports !== 'undefined' ? { exports } : {}), + ...(typeof main !== 'undefined' ? { main } : {}), + ...(typeof browser !== 'undefined' ? { browser } : {}), + ...(typeof types !== 'undefined' ? { types } : {}), + ...(typeof bin !== 'undefined' ? { bin } : {}), + ...(typeof man !== 'undefined' ? { man } : {}), + ...(typeof directories !== 'undefined' ? { directories } : {}), + ...(typeof files !== 'undefined' ? { files } : {}), + ...(typeof workspaces !== 'undefined' ? { workspaces } : {}), + ...(typeof scripts !== 'undefined' ? { scripts } : {}), + ...(typeof config !== 'undefined' ? { config } : {}), + ...(typeof dependencies !== 'undefined' ? { dependencies } : {}), + ...(typeof devDependencies !== 'undefined' ? { devDependencies } : {}), + ...(typeof peerDependencies !== 'undefined' ? { peerDependencies } : {}), + ...(typeof peerDependenciesMeta !== 'undefined' ? { peerDependenciesMeta } : {}), + ...(typeof optionalDependencies !== 'undefined' ? { optionalDependencies } : {}), + ...(typeof bundledDependencies !== 'undefined' ? { bundledDependencies } : {}), + ...(typeof bundleDependencies !== 'undefined' ? { bundleDependencies } : {}), + ...(typeof engines !== 'undefined' ? { engines } : {}), + ...(typeof os !== 'undefined' ? { os } : {}), + ...(typeof cpu !== 'undefined' ? { cpu } : {}), + ...(typeof publishConfig !== 'undefined' ? { publishConfig } : {}), + ...(typeof devEngines !== 'undefined' ? { devEngines } : {}), + ...(typeof licenses !== 'undefined' ? { licenses } : {}), + ...(typeof overrides !== 'undefined' ? { overrides } : {}), + ...rest, + } +} + +module.exports = { + packageSort, +} diff --git a/node_modules/npm/node_modules/@npmcli/package-json/lib/update-dependencies.js b/node_modules/npm/node_modules/@npmcli/package-json/lib/update-dependencies.js new file mode 100644 index 00000000..7259949a --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/package-json/lib/update-dependencies.js @@ -0,0 +1,75 @@ +const depTypes = new Set([ + 'dependencies', + 'optionalDependencies', + 'devDependencies', + 'peerDependencies', +]) + +// sort alphabetically all types of deps for a given package +const orderDeps = (content) => { + for (const type of depTypes) { + if (content && content[type]) { + content[type] = Object.keys(content[type]) + .sort((a, b) => a.localeCompare(b, 'en')) + .reduce((res, key) => { + res[key] = content[type][key] + return res + }, {}) + } + } + return content +} + +const updateDependencies = ({ content, originalContent }) => { + const pkg = orderDeps({ + ...content, + }) + + // optionalDependencies don't need to be repeated in two places + if (pkg.dependencies) { + if (pkg.optionalDependencies) { + for (const name of Object.keys(pkg.optionalDependencies)) { + delete pkg.dependencies[name] + } + } + } + + const result = { ...originalContent } + + // loop through all types of dependencies and update package json pkg + for (const type of depTypes) { + if (pkg[type]) { + result[type] = pkg[type] + } + + // prune empty type props from resulting object + const emptyDepType = + pkg[type] + && typeof pkg === 'object' + && Object.keys(pkg[type]).length === 0 + if (emptyDepType) { + delete result[type] + } + } + + // if original package.json had dep in peerDeps AND deps, preserve that. + const { dependencies: origProd, peerDependencies: origPeer } = + originalContent || {} + const { peerDependencies: newPeer } = result + if (origProd && origPeer && newPeer) { + // we have original prod/peer deps, and new peer deps + // copy over any that were in both in the original + for (const name of Object.keys(origPeer)) { + if (origProd[name] !== undefined && newPeer[name] !== undefined) { + result.dependencies = result.dependencies || {} + result.dependencies[name] = newPeer[name] + } + } + } + + return result +} + +updateDependencies.knownKeys = depTypes + +module.exports = updateDependencies diff --git a/node_modules/npm/node_modules/@npmcli/package-json/lib/update-scripts.js b/node_modules/npm/node_modules/@npmcli/package-json/lib/update-scripts.js new file mode 100644 index 00000000..30495e54 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/package-json/lib/update-scripts.js @@ -0,0 +1,29 @@ +const updateScripts = ({ content, originalContent = {} }) => { + const newScripts = content.scripts + + if (!newScripts) { + return originalContent + } + + // validate scripts content being appended + const hasInvalidScripts = () => + Object.entries(newScripts) + .some(([key, value]) => + typeof key !== 'string' || typeof value !== 'string') + if (hasInvalidScripts()) { + throw Object.assign( + new TypeError( + 'package.json scripts should be a key-value pair of strings.'), + { code: 'ESCRIPTSINVALID' } + ) + } + + return { + ...originalContent, + scripts: { + ...newScripts, + }, + } +} + +module.exports = updateScripts diff --git a/node_modules/npm/node_modules/@npmcli/package-json/lib/update-workspaces.js b/node_modules/npm/node_modules/@npmcli/package-json/lib/update-workspaces.js new file mode 100644 index 00000000..04bf6323 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/package-json/lib/update-workspaces.js @@ -0,0 +1,26 @@ +const updateWorkspaces = ({ content, originalContent = {} }) => { + const newWorkspaces = content.workspaces + + if (!newWorkspaces) { + return originalContent + } + + // validate workspaces content being appended + const hasInvalidWorkspaces = () => + newWorkspaces.some(w => !(typeof w === 'string')) + if (!newWorkspaces.length || hasInvalidWorkspaces()) { + throw Object.assign( + new TypeError('workspaces should be an array of strings.'), + { code: 'EWORKSPACESINVALID' } + ) + } + + return { + ...originalContent, + workspaces: [ + ...newWorkspaces, + ], + } +} + +module.exports = updateWorkspaces diff --git a/node_modules/npm/node_modules/@npmcli/package-json/package.json b/node_modules/npm/node_modules/@npmcli/package-json/package.json new file mode 100644 index 00000000..97070e27 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/package-json/package.json @@ -0,0 +1,61 @@ +{ + "name": "@npmcli/package-json", + "version": "6.1.0", + "description": "Programmatic API to update package.json", + "keywords": [ + "npm", + "oss" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/npm/package-json.git" + }, + "license": "ISC", + "author": "GitHub Inc.", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "scripts": { + "snap": "tap", + "test": "tap", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "postsnap": "npm run lintfix --", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "dependencies": { + "@npmcli/git": "^6.0.0", + "glob": "^10.2.2", + "hosted-git-info": "^8.0.0", + "json-parse-even-better-errors": "^4.0.0", + "normalize-package-data": "^7.0.0", + "proc-log": "^5.0.0", + "semver": "^7.5.3" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.5", + "read-package-json": "^7.0.0", + "read-package-json-fast": "^4.0.0", + "tap": "^16.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.5", + "publish": "true" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/@npmcli/promise-spawn/LICENSE b/node_modules/npm/node_modules/@npmcli/promise-spawn/LICENSE new file mode 100644 index 00000000..8f90f96f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/promise-spawn/LICENSE @@ -0,0 +1,15 @@ +The 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 NPM DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE 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/npm/node_modules/@npmcli/promise-spawn/lib/escape.js b/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/escape.js new file mode 100644 index 00000000..9aca8bde --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/escape.js @@ -0,0 +1,68 @@ +'use strict' + +// eslint-disable-next-line max-len +// this code adapted from: https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ +const cmd = (input, doubleEscape) => { + if (!input.length) { + return '""' + } + + let result + if (!/[ \t\n\v"]/.test(input)) { + result = input + } else { + result = '"' + for (let i = 0; i <= input.length; ++i) { + let slashCount = 0 + while (input[i] === '\\') { + ++i + ++slashCount + } + + if (i === input.length) { + result += '\\'.repeat(slashCount * 2) + break + } + + if (input[i] === '"') { + result += '\\'.repeat(slashCount * 2 + 1) + result += input[i] + } else { + result += '\\'.repeat(slashCount) + result += input[i] + } + } + result += '"' + } + + // and finally, prefix shell meta chars with a ^ + result = result.replace(/[ !%^&()<>|"]/g, '^$&') + if (doubleEscape) { + result = result.replace(/[ !%^&()<>|"]/g, '^$&') + } + + return result +} + +const sh = (input) => { + if (!input.length) { + return `''` + } + + if (!/[\t\n\r "#$&'()*;<>?\\`|~]/.test(input)) { + return input + } + + // replace single quotes with '\'' and wrap the whole result in a fresh set of quotes + const result = `'${input.replace(/'/g, `'\\''`)}'` + // if the input string already had single quotes around it, clean those up + .replace(/^(?:'')+(?!$)/, '') + .replace(/\\'''/g, `\\'`) + + return result +} + +module.exports = { + cmd, + sh, +} diff --git a/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js b/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js new file mode 100644 index 00000000..aa7b55d8 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js @@ -0,0 +1,218 @@ +'use strict' + +const { spawn } = require('child_process') +const os = require('os') +const which = require('which') + +const escape = require('./escape.js') + +// 'extra' object is for decorating the error a bit more +const promiseSpawn = (cmd, args, opts = {}, extra = {}) => { + if (opts.shell) { + return spawnWithShell(cmd, args, opts, extra) + } + + let resolve, reject + const promise = new Promise((_resolve, _reject) => { + resolve = _resolve + reject = _reject + }) + + // Create error here so we have a more useful stack trace when rejecting + const closeError = new Error('command failed') + + const stdout = [] + const stderr = [] + + const getResult = (result) => ({ + cmd, + args, + ...result, + ...stdioResult(stdout, stderr, opts), + ...extra, + }) + const rejectWithOpts = (er, erOpts) => { + const resultError = getResult(erOpts) + reject(Object.assign(er, resultError)) + } + + const proc = spawn(cmd, args, opts) + promise.stdin = proc.stdin + promise.process = proc + + proc.on('error', rejectWithOpts) + + if (proc.stdout) { + proc.stdout.on('data', c => stdout.push(c)) + proc.stdout.on('error', rejectWithOpts) + } + + if (proc.stderr) { + proc.stderr.on('data', c => stderr.push(c)) + proc.stderr.on('error', rejectWithOpts) + } + + proc.on('close', (code, signal) => { + if (code || signal) { + rejectWithOpts(closeError, { code, signal }) + } else { + resolve(getResult({ code, signal })) + } + }) + + return promise +} + +const spawnWithShell = (cmd, args, opts, extra) => { + let command = opts.shell + // if shell is set to true, we use a platform default. we can't let the core + // spawn method decide this for us because we need to know what shell is in use + // ahead of time so that we can escape arguments properly. we don't need coverage here. + if (command === true) { + // istanbul ignore next + command = process.platform === 'win32' ? process.env.ComSpec : 'sh' + } + + const options = { ...opts, shell: false } + const realArgs = [] + let script = cmd + + // first, determine if we're in windows because if we are we need to know if we're + // running an .exe or a .cmd/.bat since the latter requires extra escaping + const isCmd = /(?:^|\\)cmd(?:\.exe)?$/i.test(command) + if (isCmd) { + let doubleEscape = false + + // find the actual command we're running + let initialCmd = '' + let insideQuotes = false + for (let i = 0; i < cmd.length; ++i) { + const char = cmd.charAt(i) + if (char === ' ' && !insideQuotes) { + break + } + + initialCmd += char + if (char === '"' || char === "'") { + insideQuotes = !insideQuotes + } + } + + let pathToInitial + try { + pathToInitial = which.sync(initialCmd, { + path: (options.env && findInObject(options.env, 'PATH')) || process.env.PATH, + pathext: (options.env && findInObject(options.env, 'PATHEXT')) || process.env.PATHEXT, + }).toLowerCase() + } catch (err) { + pathToInitial = initialCmd.toLowerCase() + } + + doubleEscape = pathToInitial.endsWith('.cmd') || pathToInitial.endsWith('.bat') + for (const arg of args) { + script += ` ${escape.cmd(arg, doubleEscape)}` + } + realArgs.push('/d', '/s', '/c', script) + options.windowsVerbatimArguments = true + } else { + for (const arg of args) { + script += ` ${escape.sh(arg)}` + } + realArgs.push('-c', script) + } + + return promiseSpawn(command, realArgs, options, extra) +} + +// open a file with the default application as defined by the user's OS +const open = (_args, opts = {}, extra = {}) => { + const options = { ...opts, shell: true } + const args = [].concat(_args) + + let platform = process.platform + // process.platform === 'linux' may actually indicate WSL, if that's the case + // open the argument with sensible-browser which is pre-installed + // In WSL, set the default browser using, for example, + // export BROWSER="/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe" + // or + // export BROWSER="/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" + // To permanently set the default browser, add the appropriate entry to your shell's + // RC file, e.g. .bashrc or .zshrc. + if (platform === 'linux' && os.release().toLowerCase().includes('microsoft')) { + platform = 'wsl' + if (!process.env.BROWSER) { + return Promise.reject( + new Error('Set the BROWSER environment variable to your desired browser.')) + } + } + + let command = options.command + if (!command) { + if (platform === 'win32') { + // spawnWithShell does not do the additional os.release() check, so we + // have to force the shell here to make sure we treat WSL as windows. + options.shell = process.env.ComSpec + // also, the start command accepts a title so to make sure that we don't + // accidentally interpret the first arg as the title, we stick an empty + // string immediately after the start command + command = 'start ""' + } else if (platform === 'wsl') { + command = 'sensible-browser' + } else if (platform === 'darwin') { + command = 'open' + } else { + command = 'xdg-open' + } + } + + return spawnWithShell(command, args, options, extra) +} +promiseSpawn.open = open + +const isPipe = (stdio = 'pipe', fd) => { + if (stdio === 'pipe' || stdio === null) { + return true + } + + if (Array.isArray(stdio)) { + return isPipe(stdio[fd], fd) + } + + return false +} + +const stdioResult = (stdout, stderr, { stdioString = true, stdio }) => { + const result = { + stdout: null, + stderr: null, + } + + // stdio is [stdin, stdout, stderr] + if (isPipe(stdio, 1)) { + result.stdout = Buffer.concat(stdout) + if (stdioString) { + result.stdout = result.stdout.toString().trim() + } + } + + if (isPipe(stdio, 2)) { + result.stderr = Buffer.concat(stderr) + if (stdioString) { + result.stderr = result.stderr.toString().trim() + } + } + + return result +} + +// case insensitive lookup in an object +const findInObject = (obj, key) => { + key = key.toLowerCase() + for (const objKey of Object.keys(obj).sort()) { + if (objKey.toLowerCase() === key) { + return obj[objKey] + } + } +} + +module.exports = promiseSpawn diff --git a/node_modules/npm/node_modules/@npmcli/promise-spawn/package.json b/node_modules/npm/node_modules/@npmcli/promise-spawn/package.json new file mode 100644 index 00000000..f5fb026b --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/promise-spawn/package.json @@ -0,0 +1,51 @@ +{ + "name": "@npmcli/promise-spawn", + "version": "8.0.2", + "files": [ + "bin/", + "lib/" + ], + "main": "./lib/index.js", + "description": "spawn processes the way the npm cli likes to do", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/promise-spawn.git" + }, + "author": "GitHub Inc.", + "license": "ISC", + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "postsnap": "npm run lintfix --", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "tap": { + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.4", + "spawk": "^1.7.1", + "tap": "^16.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.4", + "publish": true + }, + "dependencies": { + "which": "^5.0.0" + } +} diff --git a/node_modules/npm/node_modules/@npmcli/query/LICENSE b/node_modules/npm/node_modules/@npmcli/query/LICENSE new file mode 100644 index 00000000..5fc208ff --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/query/LICENSE @@ -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/npm/node_modules/@npmcli/query/lib/index.js b/node_modules/npm/node_modules/@npmcli/query/lib/index.js new file mode 100644 index 00000000..db7dc345 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/query/lib/index.js @@ -0,0 +1,255 @@ +'use strict' + +const parser = require('postcss-selector-parser') + +const arrayDelimiter = Symbol('arrayDelimiter') + +const escapeSlashes = str => + str.replace(/\//g, '\\/') + +const unescapeSlashes = str => + str.replace(/\\\//g, '/') + +// recursively fixes up any :attr pseudo-class found +const fixupAttr = astNode => { + const properties = [] + const matcher = {} + for (const selectorAstNode of astNode.nodes) { + const [firstAstNode] = selectorAstNode.nodes + if (firstAstNode.type === 'tag') { + properties.push(firstAstNode.value) + } + } + + const lastSelectorAstNode = astNode.nodes.pop() + const [attributeAstNode] = lastSelectorAstNode.nodes + + if (attributeAstNode.value === ':attr') { + const appendParts = fixupAttr(attributeAstNode) + properties.push(arrayDelimiter, ...appendParts.lookupProperties) + matcher.qualifiedAttribute = appendParts.attributeMatcher.qualifiedAttribute + matcher.operator = appendParts.attributeMatcher.operator + matcher.value = appendParts.attributeMatcher.value + + // backwards compatibility + matcher.attribute = appendParts.attributeMatcher.attribute + + if (appendParts.attributeMatcher.insensitive) { + matcher.insensitive = true + } + } else { + if (attributeAstNode.type !== 'attribute') { + throw Object.assign( + new Error('`:attr` pseudo-class expects an attribute matcher as the last value'), + { code: 'EQUERYATTR' } + ) + } + + matcher.qualifiedAttribute = unescapeSlashes(attributeAstNode.qualifiedAttribute) + matcher.operator = attributeAstNode.operator + matcher.value = attributeAstNode.value + + // backwards compatibility + matcher.attribute = matcher.qualifiedAttribute + + if (attributeAstNode.insensitive) { + matcher.insensitive = true + } + } + + astNode.lookupProperties = properties + astNode.attributeMatcher = matcher + astNode.nodes.length = 0 + return astNode +} + +// fixed up nested pseudo nodes will have their internal selectors moved +// to a new root node that will be referenced by the `nestedNode` property, +// this tweak makes it simpler to reuse `retrieveNodesFromParsedAst` to +// recursively parse and extract results from the internal selectors +const fixupNestedPseudo = astNode => { + // create a new ast root node and relocate any children + // selectors of the current ast node to this new root + const newRootNode = parser.root() + astNode.nestedNode = newRootNode + newRootNode.nodes = [...astNode.nodes] + + // clean up the ast by removing the children nodes from the + // current ast node while also cleaning up their `parent` refs + astNode.nodes.length = 0 + for (const currAstNode of newRootNode.nodes) { + currAstNode.parent = newRootNode + } + + // recursively fixup nodes of any nested selector + transformAst(newRootNode) +} + +// :semver(, [version|range|selector], [function]) +// note: the first or second parameter must be a static version or range +const fixupSemverSpecs = astNode => { + // if we have three nodes, the last is the semver function to use, pull that out first + if (astNode.nodes.length === 3) { + const funcNode = astNode.nodes.pop().nodes[0] + if (funcNode.type === 'tag') { + astNode.semverFunc = funcNode.value + } else if (funcNode.type === 'string') { + // a string is always in some type of quotes, we don't want those so slice them off + astNode.semverFunc = funcNode.value.slice(1, -1) + } else { + // anything that isn't a tag or a string isn't a function name + throw Object.assign( + new Error('`:semver` pseudo-class expects a function name as last value'), + { code: 'ESEMVERFUNC' } + ) + } + } + + // now if we have 1 node, it's a static value + // istanbul ignore else + if (astNode.nodes.length === 1) { + const semverNode = astNode.nodes.pop() + astNode.semverValue = semverNode.nodes.reduce((res, next) => `${res}${String(next)}`, '') + } else if (astNode.nodes.length === 2) { + // and if we have two nodes, one of them is a static value and we need to determine which it is + for (let i = 0; i < astNode.nodes.length; ++i) { + const type = astNode.nodes[i].nodes[0].type + // the type of the first child may be combinator for ranges, such as >14 + if (type === 'tag' || type === 'combinator') { + const semverNode = astNode.nodes.splice(i, 1)[0] + astNode.semverValue = semverNode.nodes.reduce((res, next) => `${res}${String(next)}`, '') + astNode.semverPosition = i + break + } + } + + if (typeof astNode.semverValue === 'undefined') { + throw Object.assign( + new Error('`:semver` pseudo-class expects a static value in the first or second position'), + { code: 'ESEMVERVALUE' } + ) + } + } + + // if we got here, the last remaining child should be attribute selector + if (astNode.nodes.length === 1) { + fixupAttr(astNode) + } else { + // if we don't have a selector, we default to `[version]` + astNode.attributeMatcher = { + insensitive: false, + attribute: 'version', + qualifiedAttribute: 'version', + } + astNode.lookupProperties = [] + } + + astNode.nodes.length = 0 +} + +const fixupTypes = astNode => { + const [valueAstNode] = astNode.nodes[0].nodes + const { value } = valueAstNode || {} + astNode.typeValue = value + astNode.nodes.length = 0 +} + +const fixupPaths = astNode => { + astNode.pathValue = unescapeSlashes(String(astNode.nodes[0])) + astNode.nodes.length = 0 +} + +const fixupOutdated = astNode => { + if (astNode.nodes.length) { + astNode.outdatedKind = String(astNode.nodes[0]) + astNode.nodes.length = 0 + } +} + +const fixupVuln = astNode => { + const vulns = [] + if (astNode.nodes.length) { + for (const selector of astNode.nodes) { + const vuln = {} + for (const node of selector.nodes) { + if (node.type !== 'attribute') { + throw Object.assign( + new Error(':vuln pseudo-class only accepts attribute matchers or "cwe" tag'), + { code: 'EQUERYATTR' } + ) + } + if (!['severity', 'cwe'].includes(node._attribute)) { + throw Object.assign( + new Error(':vuln pseudo-class only matches "severity" and "cwe" attributes'), + { code: 'EQUERYATTR' } + ) + } + if (!node.operator) { + node.operator = '=' + node.value = '*' + } + if (node.operator !== '=') { + throw Object.assign( + new Error(':vuln pseudo-class attribute selector only accepts "=" operator', node), + { code: 'EQUERYATTR' } + ) + } + if (!vuln[node._attribute]) { + vuln[node._attribute] = [] + } + vuln[node._attribute].push(node._value) + } + vulns.push(vuln) + } + astNode.vulns = vulns + astNode.nodes.length = 0 + } +} + +// a few of the supported ast nodes need to be tweaked in order to properly be +// interpreted as proper arborist query selectors, namely semver ranges from +// both ids and :semver pseudo-class selectors need to be translated from what +// are usually multiple ast nodes, such as: tag:1, class:.0, class:.0 to a +// single `1.0.0` value, other pseudo-class selectors also get preprocessed in +// order to make it simpler to execute later when traversing each ast node +// using rootNode.walk(), such as :path, :type, etc. transformAst handles all +// these modifications to the parsed ast by doing an extra, initial traversal +// of the parsed ast from the query and modifying the parsed nodes accordingly +const transformAst = selector => { + selector.walk((nextAstNode) => { + switch (nextAstNode.value) { + case ':attr': + return fixupAttr(nextAstNode) + case ':is': + case ':has': + case ':not': + return fixupNestedPseudo(nextAstNode) + case ':path': + return fixupPaths(nextAstNode) + case ':semver': + return fixupSemverSpecs(nextAstNode) + case ':type': + return fixupTypes(nextAstNode) + case ':outdated': + return fixupOutdated(nextAstNode) + case ':vuln': + return fixupVuln(nextAstNode) + } + }) +} + +const queryParser = (query) => { + // if query is an empty string or any falsy + // value, just returns an empty result + if (!query) { + return [] + } + + return parser(transformAst) + .astSync(escapeSlashes(query), { lossless: false }) +} + +module.exports = { + parser: queryParser, + arrayDelimiter, +} diff --git a/node_modules/npm/node_modules/@npmcli/query/package.json b/node_modules/npm/node_modules/@npmcli/query/package.json new file mode 100644 index 00000000..14f7fbfa --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/query/package.json @@ -0,0 +1,64 @@ +{ + "name": "@npmcli/query", + "version": "4.0.0", + "description": "npm query parser and tools", + "main": "lib/index.js", + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "contributors": [ + { + "name": "Ruy Adorno", + "url": "https://ruyadorno.com", + "twitter": "ruyadorno" + } + ], + "keywords": [ + "ast", + "npm", + "npmcli", + "parser", + "postcss", + "postcss-selector-parser", + "query" + ], + "author": "GitHub Inc.", + "license": "ISC", + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.2.0" + }, + "dependencies": { + "postcss-selector-parser": "^6.1.2" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/query.git" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/@npmcli/redact/LICENSE b/node_modules/npm/node_modules/@npmcli/redact/LICENSE new file mode 100644 index 00000000..c2164411 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/redact/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 npm + +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/npm/node_modules/@npmcli/redact/lib/deep-map.js b/node_modules/npm/node_modules/@npmcli/redact/lib/deep-map.js new file mode 100644 index 00000000..b555cf9f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/redact/lib/deep-map.js @@ -0,0 +1,78 @@ +function filterError (input) { + return { + errorType: input.name, + message: input.message, + stack: input.stack, + ...(input.code ? { code: input.code } : {}), + ...(input.statusCode ? { statusCode: input.statusCode } : {}), + } +} + +const deepMap = (input, handler = v => v, path = ['$'], seen = new Set([input])) => { + // this is in an effort to maintain bole's error logging behavior + if (path.join('.') === '$' && input instanceof Error) { + return deepMap({ err: filterError(input) }, handler, path, seen) + } + if (input instanceof Error) { + return deepMap(filterError(input), handler, path, seen) + } + if (input instanceof Buffer) { + return `[unable to log instanceof buffer]` + } + if (input instanceof Uint8Array) { + return `[unable to log instanceof Uint8Array]` + } + + if (Array.isArray(input)) { + const result = [] + for (let i = 0; i < input.length; i++) { + const element = input[i] + const elementPath = [...path, i] + if (element instanceof Object) { + if (!seen.has(element)) { // avoid getting stuck in circular reference + seen.add(element) + result.push(deepMap(handler(element, elementPath), handler, elementPath, seen)) + } + } else { + result.push(handler(element, elementPath)) + } + } + return result + } + + if (input === null) { + return null + } else if (typeof input === 'object' || typeof input === 'function') { + const result = {} + + for (const propertyName of Object.getOwnPropertyNames(input)) { + // skip logging internal properties + if (propertyName.startsWith('_')) { + continue + } + + try { + const property = input[propertyName] + const propertyPath = [...path, propertyName] + if (property instanceof Object) { + if (!seen.has(property)) { // avoid getting stuck in circular reference + seen.add(property) + result[propertyName] = deepMap( + handler(property, propertyPath), handler, propertyPath, seen + ) + } + } else { + result[propertyName] = handler(property, propertyPath) + } + } catch (err) { + // a getter may throw an error + result[propertyName] = `[error getting value: ${err.message}]` + } + } + return result + } + + return handler(input, path) +} + +module.exports = { deepMap } diff --git a/node_modules/npm/node_modules/@npmcli/redact/lib/index.js b/node_modules/npm/node_modules/@npmcli/redact/lib/index.js new file mode 100644 index 00000000..9b10c7f6 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/redact/lib/index.js @@ -0,0 +1,44 @@ +const matchers = require('./matchers') +const { redactUrlPassword } = require('./utils') + +const REPLACE = '***' + +const redact = (value) => { + if (typeof value !== 'string' || !value) { + return value + } + return redactUrlPassword(value, REPLACE) + .replace(matchers.NPM_SECRET.pattern, `npm_${REPLACE}`) + .replace(matchers.UUID.pattern, REPLACE) +} + +// split on \s|= similar to how nopt parses options +const splitAndRedact = (str) => { + // stateful regex, don't move out of this scope + const splitChars = /[\s=]/g + + let match = null + let result = '' + let index = 0 + while (match = splitChars.exec(str)) { + result += redact(str.slice(index, match.index)) + match[0] + index = splitChars.lastIndex + } + + return result + redact(str.slice(index)) +} + +// replaces auth info in an array of arguments or in a strings +const redactLog = (arg) => { + if (typeof arg === 'string') { + return splitAndRedact(arg) + } else if (Array.isArray(arg)) { + return arg.map((a) => typeof a === 'string' ? splitAndRedact(a) : a) + } + return arg +} + +module.exports = { + redact, + redactLog, +} diff --git a/node_modules/npm/node_modules/@npmcli/redact/lib/matchers.js b/node_modules/npm/node_modules/@npmcli/redact/lib/matchers.js new file mode 100644 index 00000000..fe9b9071 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/redact/lib/matchers.js @@ -0,0 +1,81 @@ +const TYPE_REGEX = 'regex' +const TYPE_URL = 'url' +const TYPE_PATH = 'path' + +const NPM_SECRET = { + type: TYPE_REGEX, + pattern: /\b(npms?_)[a-zA-Z0-9]{36,48}\b/gi, + replacement: `[REDACTED_NPM_SECRET]`, +} + +const AUTH_HEADER = { + type: TYPE_REGEX, + pattern: /\b(Basic\s+|Bearer\s+)[\w+=\-.]+\b/gi, + replacement: `[REDACTED_AUTH_HEADER]`, +} + +const JSON_WEB_TOKEN = { + type: TYPE_REGEX, + pattern: /\b[A-Za-z0-9-_]{10,}(?!\.\d+\.)\.[A-Za-z0-9-_]{3,}\.[A-Za-z0-9-_]{20,}\b/gi, + replacement: `[REDACTED_JSON_WEB_TOKEN]`, +} + +const UUID = { + type: TYPE_REGEX, + pattern: /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi, + replacement: `[REDACTED_UUID]`, +} + +const URL_MATCHER = { + type: TYPE_REGEX, + pattern: /(?:https?|ftp):\/\/[^\s/"$.?#].[^\s"]*/gi, + replacement: '[REDACTED_URL]', +} + +const DEEP_HEADER_AUTHORIZATION = { + type: TYPE_PATH, + predicate: ({ path }) => path.endsWith('.headers.authorization'), + replacement: '[REDACTED_HEADER_AUTHORIZATION]', +} + +const DEEP_HEADER_SET_COOKIE = { + type: TYPE_PATH, + predicate: ({ path }) => path.endsWith('.headers.set-cookie'), + replacement: '[REDACTED_HEADER_SET_COOKIE]', +} + +const REWRITE_REQUEST = { + type: TYPE_PATH, + predicate: ({ path }) => path.endsWith('.request'), + replacement: (input) => ({ + method: input?.method, + path: input?.path, + headers: input?.headers, + url: input?.url, + }), +} + +const REWRITE_RESPONSE = { + type: TYPE_PATH, + predicate: ({ path }) => path.endsWith('.response'), + replacement: (input) => ({ + data: input?.data, + status: input?.status, + headers: input?.headers, + }), +} + +module.exports = { + TYPE_REGEX, + TYPE_URL, + TYPE_PATH, + NPM_SECRET, + AUTH_HEADER, + JSON_WEB_TOKEN, + UUID, + URL_MATCHER, + DEEP_HEADER_AUTHORIZATION, + DEEP_HEADER_SET_COOKIE, + REWRITE_REQUEST, + REWRITE_RESPONSE, +} diff --git a/node_modules/npm/node_modules/@npmcli/redact/lib/server.js b/node_modules/npm/node_modules/@npmcli/redact/lib/server.js new file mode 100644 index 00000000..669e834d --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/redact/lib/server.js @@ -0,0 +1,34 @@ +const { + AUTH_HEADER, + JSON_WEB_TOKEN, + NPM_SECRET, + DEEP_HEADER_AUTHORIZATION, + DEEP_HEADER_SET_COOKIE, + REWRITE_REQUEST, + REWRITE_RESPONSE, +} = require('./matchers') + +const { + redactUrlMatcher, + redactUrlPasswordMatcher, + redactMatchers, +} = require('./utils') + +const { deepMap } = require('./deep-map') + +const _redact = redactMatchers( + NPM_SECRET, + AUTH_HEADER, + JSON_WEB_TOKEN, + DEEP_HEADER_AUTHORIZATION, + DEEP_HEADER_SET_COOKIE, + REWRITE_REQUEST, + REWRITE_RESPONSE, + redactUrlMatcher( + redactUrlPasswordMatcher() + ) +) + +const redact = (input) => deepMap(input, (value, path) => _redact(value, { path })) + +module.exports = { redact } diff --git a/node_modules/npm/node_modules/@npmcli/redact/lib/utils.js b/node_modules/npm/node_modules/@npmcli/redact/lib/utils.js new file mode 100644 index 00000000..8395ab25 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/redact/lib/utils.js @@ -0,0 +1,202 @@ +const { + URL_MATCHER, + TYPE_URL, + TYPE_REGEX, + TYPE_PATH, +} = require('./matchers') + +/** + * creates a string of asterisks, + * this forces a minimum asterisk for security purposes + */ +const asterisk = (length = 0) => { + length = typeof length === 'string' ? length.length : length + if (length < 8) { + return '*'.repeat(8) + } + return '*'.repeat(length) +} + +/** + * escapes all special regex chars + * @see https://stackoverflow.com/a/9310752 + * @see https://github.com/tc39/proposal-regex-escaping + */ +const escapeRegExp = (text) => { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, `\\$&`) +} + +/** + * provieds a regex "or" of the url versions of a string + */ +const urlEncodeRegexGroup = (value) => { + const decoded = decodeURIComponent(value) + const encoded = encodeURIComponent(value) + const union = [...new Set([encoded, decoded, value])].map(escapeRegExp).join('|') + return union +} + +/** + * a tagged template literal that returns a regex ensures all variables are excaped + */ +const urlEncodeRegexTag = (strings, ...values) => { + let pattern = '' + for (let i = 0; i < values.length; i++) { + pattern += strings[i] + `(${urlEncodeRegexGroup(values[i])})` + } + pattern += strings[strings.length - 1] + return new RegExp(pattern) +} + +/** + * creates a matcher for redacting url hostname + */ +const redactUrlHostnameMatcher = ({ hostname, replacement } = {}) => ({ + type: TYPE_URL, + predicate: ({ url }) => url.hostname === hostname, + pattern: ({ url }) => { + return urlEncodeRegexTag`(^${url.protocol}//${url.username}:.+@)?${url.hostname}` + }, + replacement: `$1${replacement || asterisk()}`, +}) + +/** + * creates a matcher for redacting url search / query parameter values + */ +const redactUrlSearchParamsMatcher = ({ param, replacement } = {}) => ({ + type: TYPE_URL, + predicate: ({ url }) => url.searchParams.has(param), + pattern: ({ url }) => urlEncodeRegexTag`(${param}=)${url.searchParams.get(param)}`, + replacement: `$1${replacement || asterisk()}`, +}) + +/** creates a matcher for redacting the url password */ +const redactUrlPasswordMatcher = ({ replacement } = {}) => ({ + type: TYPE_URL, + predicate: ({ url }) => url.password, + pattern: ({ url }) => urlEncodeRegexTag`(^${url.protocol}//${url.username}:)${url.password}`, + replacement: `$1${replacement || asterisk()}`, +}) + +const redactUrlReplacement = (...matchers) => (subValue) => { + try { + const url = new URL(subValue) + return redactMatchers(...matchers)(subValue, { url }) + } catch (err) { + return subValue + } +} + +/** + * creates a matcher / submatcher for urls, this function allows you to first + * collect all urls within a larger string and then pass those urls to a + * submatcher + * + * @example + * console.log("this will first match all urls, then pass those urls to the password patcher") + * redactMatchers(redactUrlMatcher(redactUrlPasswordMatcher())) + * + * @example + * console.log( + * "this will assume you are passing in a string that is a url, and will redact the password" + * ) + * redactMatchers(redactUrlPasswordMatcher()) + * + */ +const redactUrlMatcher = (...matchers) => { + return { + ...URL_MATCHER, + replacement: redactUrlReplacement(...matchers), + } +} + +const matcherFunctions = { + [TYPE_REGEX]: (matcher) => (value) => { + if (typeof value === 'string') { + value = value.replace(matcher.pattern, matcher.replacement) + } + return value + }, + [TYPE_URL]: (matcher) => (value, ctx) => { + if (typeof value === 'string') { + try { + const url = ctx?.url || new URL(value) + const { predicate, pattern } = matcher + const predicateValue = predicate({ url }) + if (predicateValue) { + value = value.replace(pattern({ url }), matcher.replacement) + } + } catch (_e) { + return value + } + } + return value + }, + [TYPE_PATH]: (matcher) => (value, ctx) => { + const rawPath = ctx?.path + const path = rawPath.join('.').toLowerCase() + const { predicate, replacement } = matcher + const replace = typeof replacement === 'function' ? replacement : () => replacement + const shouldRun = predicate({ rawPath, path }) + if (shouldRun) { + value = replace(value, { rawPath, path }) + } + return value + }, +} + +/** converts a matcher to a function */ +const redactMatcher = (matcher) => { + return matcherFunctions[matcher.type](matcher) +} + +/** converts a series of matchers to a function */ +const redactMatchers = (...matchers) => (value, ctx) => { + const flatMatchers = matchers.flat() + return flatMatchers.reduce((result, matcher) => { + const fn = (typeof matcher === 'function') ? matcher : redactMatcher(matcher) + return fn(result, ctx) + }, value) +} + +/** + * replacement handler, keeping $1 (if it exists) and replacing the + * rest of the string with asterisks, maintaining string length + */ +const redactDynamicReplacement = () => (value, start) => { + if (typeof start === 'number') { + return asterisk(value) + } + return start + asterisk(value.substring(start.length).length) +} + +/** + * replacement handler, keeping $1 (if it exists) and replacing the + * rest of the string with a fixed number of asterisks + */ +const redactFixedReplacement = (length) => (_value, start) => { + if (typeof start === 'number') { + return asterisk(length) + } + return start + asterisk(length) +} + +const redactUrlPassword = (value, replacement) => { + return redactMatchers(redactUrlPasswordMatcher({ replacement }))(value) +} + +module.exports = { + asterisk, + escapeRegExp, + urlEncodeRegexGroup, + urlEncodeRegexTag, + redactUrlHostnameMatcher, + redactUrlSearchParamsMatcher, + redactUrlPasswordMatcher, + redactUrlMatcher, + redactUrlReplacement, + redactDynamicReplacement, + redactFixedReplacement, + redactMatchers, + redactUrlPassword, +} diff --git a/node_modules/npm/node_modules/@npmcli/redact/package.json b/node_modules/npm/node_modules/@npmcli/redact/package.json new file mode 100644 index 00000000..649f82ef --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/redact/package.json @@ -0,0 +1,52 @@ +{ + "name": "@npmcli/redact", + "version": "3.0.0", + "description": "Redact sensitive npm information from output", + "main": "lib/index.js", + "exports": { + ".": "./lib/index.js", + "./server": "./lib/server.js", + "./package.json": "./package.json" + }, + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "keywords": [], + "author": "GitHub Inc.", + "license": "ISC", + "files": [ + "bin/", + "lib/" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/npm/redact.git" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ], + "timeout": 120 + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.3.10" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } +} diff --git a/node_modules/npm/node_modules/@npmcli/run-script/LICENSE b/node_modules/npm/node_modules/@npmcli/run-script/LICENSE new file mode 100644 index 00000000..19cec97b --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/LICENSE @@ -0,0 +1,15 @@ +The 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 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/npm/node_modules/@npmcli/run-script/lib/is-server-package.js b/node_modules/npm/node_modules/@npmcli/run-script/lib/is-server-package.js new file mode 100644 index 00000000..c36c40d4 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/lib/is-server-package.js @@ -0,0 +1,11 @@ +const { stat } = require('node:fs/promises') +const { resolve } = require('node:path') + +module.exports = async path => { + try { + const st = await stat(resolve(path, 'server.js')) + return st.isFile() + } catch (er) { + return false + } +} diff --git a/node_modules/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js b/node_modules/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js new file mode 100644 index 00000000..8a32d719 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js @@ -0,0 +1,40 @@ +/* eslint camelcase: "off" */ +const setPATH = require('./set-path.js') +const { resolve } = require('path') +const npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js') + +const makeSpawnArgs = options => { + const { + event, + path, + scriptShell = true, + binPaths, + env, + stdio, + cmd, + args, + stdioString, + } = options + + const spawnEnv = setPATH(path, binPaths, { + // we need to at least save the PATH environment var + ...process.env, + ...env, + npm_package_json: resolve(path, 'package.json'), + npm_lifecycle_event: event, + npm_lifecycle_script: cmd, + npm_config_node_gyp, + }) + + const spawnOpts = { + env: spawnEnv, + stdioString, + stdio, + cwd: path, + shell: scriptShell, + } + + return [cmd, args, spawnOpts] +} + +module.exports = makeSpawnArgs diff --git a/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp b/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp new file mode 100755 index 00000000..5bec64d9 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +node "$npm_config_node_gyp" "$@" diff --git a/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd b/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd new file mode 100755 index 00000000..4c6987ac --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node-gyp.cmd @@ -0,0 +1 @@ +@node "%npm_config_node_gyp%" %* diff --git a/node_modules/npm/node_modules/@npmcli/run-script/lib/package-envs.js b/node_modules/npm/node_modules/@npmcli/run-script/lib/package-envs.js new file mode 100644 index 00000000..612f850f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/lib/package-envs.js @@ -0,0 +1,29 @@ +const packageEnvs = (vals, prefix, env = {}) => { + for (const [key, val] of Object.entries(vals)) { + if (val === undefined) { + continue + } else if (val === null || val === false) { + env[`${prefix}${key}`] = '' + } else if (Array.isArray(val)) { + val.forEach((item, index) => { + packageEnvs({ [`${key}_${index}`]: item }, `${prefix}`, env) + }) + } else if (typeof val === 'object') { + packageEnvs(val, `${prefix}${key}_`, env) + } else { + env[`${prefix}${key}`] = String(val) + } + } + return env +} + +// https://github.com/npm/rfcs/pull/183 defines which fields we put into the environment +module.exports = pkg => { + return packageEnvs({ + name: pkg.name, + version: pkg.version, + config: pkg.config, + engines: pkg.engines, + bin: pkg.bin, + }, 'npm_package_') +} diff --git a/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js b/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js new file mode 100644 index 00000000..9900c963 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js @@ -0,0 +1,112 @@ +const makeSpawnArgs = require('./make-spawn-args.js') +const promiseSpawn = require('@npmcli/promise-spawn') +const packageEnvs = require('./package-envs.js') +const { isNodeGypPackage, defaultGypInstallScript } = require('@npmcli/node-gyp') +const signalManager = require('./signal-manager.js') +const isServerPackage = require('./is-server-package.js') + +const runScriptPkg = async options => { + const { + event, + path, + scriptShell, + binPaths = false, + env = {}, + stdio = 'pipe', + pkg, + args = [], + stdioString, + // how long to wait for a process.kill signal + // only exposed here so that we can make the test go a bit faster. + signalTimeout = 500, + } = options + + const { scripts = {}, gypfile } = pkg + let cmd = null + if (options.cmd) { + cmd = options.cmd + } else if (pkg.scripts && pkg.scripts[event]) { + cmd = pkg.scripts[event] + } else if ( + // If there is no preinstall or install script, default to rebuilding node-gyp packages. + event === 'install' && + !scripts.install && + !scripts.preinstall && + gypfile !== false && + await isNodeGypPackage(path) + ) { + cmd = defaultGypInstallScript + } else if (event === 'start' && await isServerPackage(path)) { + cmd = 'node server.js' + } + + if (!cmd) { + return { code: 0, signal: null } + } + + let inputEnd = () => {} + if (stdio === 'inherit') { + let banner + if (pkg._id) { + banner = `\n> ${pkg._id} ${event}\n` + } else { + banner = `\n> ${event}\n` + } + banner += `> ${cmd.trim().replace(/\n/g, '\n> ')}` + if (args.length) { + banner += ` ${args.join(' ')}` + } + banner += '\n' + const { output, input } = require('proc-log') + output.standard(banner) + inputEnd = input.start() + } + + const [spawnShell, spawnArgs, spawnOpts] = makeSpawnArgs({ + event, + path, + scriptShell, + binPaths, + env: { ...env, ...packageEnvs(pkg) }, + stdio, + cmd, + args, + stdioString, + }) + + const p = promiseSpawn(spawnShell, spawnArgs, spawnOpts, { + event, + script: cmd, + pkgid: pkg._id, + path, + }) + + if (stdio === 'inherit') { + signalManager.add(p.process) + } + + if (p.stdin) { + p.stdin.end() + } + + return p.catch(er => { + const { signal } = er + // coverage disabled because win32 never emits signals + /* istanbul ignore next */ + if (stdio === 'inherit' && signal) { + // by the time we reach here, the child has already exited. we send the + // signal back to ourselves again so that npm will exit with the same + // status as the child + process.kill(process.pid, signal) + + // just in case we don't die, reject after 500ms + // this also keeps the node process open long enough to actually + // get the signal, rather than terminating gracefully. + return new Promise((res, rej) => setTimeout(() => rej(er), signalTimeout)) + } else { + throw er + } + }).finally(inputEnd) +} + +module.exports = runScriptPkg diff --git a/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script.js b/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script.js new file mode 100644 index 00000000..b00304c8 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script.js @@ -0,0 +1,15 @@ +const PackageJson = require('@npmcli/package-json') +const runScriptPkg = require('./run-script-pkg.js') +const validateOptions = require('./validate-options.js') +const isServerPackage = require('./is-server-package.js') + +const runScript = async options => { + validateOptions(options) + if (options.pkg) { + return runScriptPkg(options) + } + const { content: pkg } = await PackageJson.normalize(options.path) + return runScriptPkg({ ...options, pkg }) +} + +module.exports = Object.assign(runScript, { isServerPackage }) diff --git a/node_modules/npm/node_modules/@npmcli/run-script/lib/set-path.js b/node_modules/npm/node_modules/@npmcli/run-script/lib/set-path.js new file mode 100644 index 00000000..c59c270d --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/lib/set-path.js @@ -0,0 +1,45 @@ +const { resolve, dirname, delimiter } = require('path') +// the path here is relative, even though it does not need to be +// in order to make the posix tests pass in windows +const nodeGypPath = resolve(__dirname, '../lib/node-gyp-bin') + +// Windows typically calls its PATH environ 'Path', but this is not +// guaranteed, nor is it guaranteed to be the only one. Merge them +// all together in the order they appear in the object. +const setPATH = (projectPath, binPaths, env) => { + const PATH = Object.keys(env).filter(p => /^path$/i.test(p) && env[p]) + .map(p => env[p].split(delimiter)) + .reduce((set, p) => set.concat(p.filter(concatted => !set.includes(concatted))), []) + .join(delimiter) + + const pathArr = [] + if (binPaths) { + pathArr.push(...binPaths) + } + // unshift the ./node_modules/.bin from every folder + // walk up until dirname() does nothing, at the root + // XXX we should specify a cwd that we don't go above + let p = projectPath + let pp + do { + pathArr.push(resolve(p, 'node_modules', '.bin')) + pp = p + p = dirname(p) + } while (p !== pp) + pathArr.push(nodeGypPath, PATH) + + const pathVal = pathArr.join(delimiter) + + // XXX include the node-gyp-bin path somehow? Probably better for + // npm or arborist or whoever to just provide that by putting it in + // the PATH environ, since that's preserved anyway. + for (const key of Object.keys(env)) { + if (/^path$/i.test(key)) { + env[key] = pathVal + } + } + + return env +} + +module.exports = setPATH diff --git a/node_modules/npm/node_modules/@npmcli/run-script/lib/signal-manager.js b/node_modules/npm/node_modules/@npmcli/run-script/lib/signal-manager.js new file mode 100644 index 00000000..a099a4af --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/lib/signal-manager.js @@ -0,0 +1,50 @@ +const runningProcs = new Set() +let handlersInstalled = false + +const forwardedSignals = [ + 'SIGINT', + 'SIGTERM', +] + +// no-op, this is so receiving the signal doesn't cause us to exit immediately +// instead, we exit after all children have exited when we re-send the signal +// to ourselves. see the catch handler at the bottom of run-script-pkg.js +const handleSignal = signal => { + for (const proc of runningProcs) { + proc.kill(signal) + } +} + +const setupListeners = () => { + for (const signal of forwardedSignals) { + process.on(signal, handleSignal) + } + handlersInstalled = true +} + +const cleanupListeners = () => { + if (runningProcs.size === 0) { + for (const signal of forwardedSignals) { + process.removeListener(signal, handleSignal) + } + handlersInstalled = false + } +} + +const add = proc => { + runningProcs.add(proc) + if (!handlersInstalled) { + setupListeners() + } + + proc.once('exit', () => { + runningProcs.delete(proc) + cleanupListeners() + }) +} + +module.exports = { + add, + handleSignal, + forwardedSignals, +} diff --git a/node_modules/npm/node_modules/@npmcli/run-script/lib/validate-options.js b/node_modules/npm/node_modules/@npmcli/run-script/lib/validate-options.js new file mode 100644 index 00000000..8d855916 --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/lib/validate-options.js @@ -0,0 +1,39 @@ +const validateOptions = options => { + if (typeof options !== 'object' || !options) { + throw new TypeError('invalid options object provided to runScript') + } + + const { + event, + path, + scriptShell, + env = {}, + stdio = 'pipe', + args = [], + cmd, + } = options + + if (!event || typeof event !== 'string') { + throw new TypeError('valid event not provided to runScript') + } + if (!path || typeof path !== 'string') { + throw new TypeError('valid path not provided to runScript') + } + if (scriptShell !== undefined && typeof scriptShell !== 'string') { + throw new TypeError('invalid scriptShell option provided to runScript') + } + if (typeof env !== 'object' || !env) { + throw new TypeError('invalid env option provided to runScript') + } + if (typeof stdio !== 'string' && !Array.isArray(stdio)) { + throw new TypeError('invalid stdio option provided to runScript') + } + if (!Array.isArray(args) || args.some(a => typeof a !== 'string')) { + throw new TypeError('invalid args option provided to runScript') + } + if (cmd !== undefined && typeof cmd !== 'string') { + throw new TypeError('invalid cmd option provided to runScript') + } +} + +module.exports = validateOptions diff --git a/node_modules/npm/node_modules/@npmcli/run-script/package.json b/node_modules/npm/node_modules/@npmcli/run-script/package.json new file mode 100644 index 00000000..38a2ac9f --- /dev/null +++ b/node_modules/npm/node_modules/@npmcli/run-script/package.json @@ -0,0 +1,54 @@ +{ + "name": "@npmcli/run-script", + "version": "9.0.2", + "description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", + "author": "GitHub Inc.", + "license": "ISC", + "scripts": { + "test": "tap", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "postlint": "template-oss-check", + "snap": "tap", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.4", + "spawk": "^1.8.1", + "tap": "^16.0.1" + }, + "dependencies": { + "@npmcli/node-gyp": "^4.0.0", + "@npmcli/package-json": "^6.0.0", + "@npmcli/promise-spawn": "^8.0.0", + "node-gyp": "^11.0.0", + "proc-log": "^5.0.0", + "which": "^5.0.0" + }, + "files": [ + "bin/", + "lib/" + ], + "main": "lib/run-script.js", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/run-script.git" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.4", + "publish": "true" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/LICENSE b/node_modules/npm/node_modules/@pkgjs/parseargs/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/LICENSE @@ -0,0 +1,201 @@ + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/examples/is-default-value.js b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/is-default-value.js new file mode 100644 index 00000000..0a67972b --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/is-default-value.js @@ -0,0 +1,25 @@ +'use strict'; + +// This example shows how to understand if a default value is used or not. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + file: { short: 'f', type: 'string', default: 'FOO' }, +}; + +const { values, tokens } = parseArgs({ options, tokens: true }); + +const isFileDefault = !tokens.some((token) => token.kind === 'option' && + token.name === 'file' +); + +console.log(values); +console.log(`Is the file option [${values.file}] the default value? ${isFileDefault}`); + +// Try the following: +// node is-default-value.js +// node is-default-value.js -f FILE +// node is-default-value.js --file FILE diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js new file mode 100644 index 00000000..943e643e --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/limit-long-syntax.js @@ -0,0 +1,35 @@ +'use strict'; + +// This is an example of using tokens to add a custom behaviour. +// +// Require the use of `=` for long options and values by blocking +// the use of space separated values. +// So allow `--foo=bar`, and not allow `--foo bar`. +// +// Note: this is not a common behaviour, most CLIs allow both forms. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + file: { short: 'f', type: 'string' }, + log: { type: 'string' }, +}; + +const { values, tokens } = parseArgs({ options, tokens: true }); + +const badToken = tokens.find((token) => token.kind === 'option' && + token.value != null && + token.rawName.startsWith('--') && + !token.inlineValue +); +if (badToken) { + throw new Error(`Option value for '${badToken.rawName}' must be inline, like '${badToken.rawName}=VALUE'`); +} + +console.log(values); + +// Try the following: +// node limit-long-syntax.js -f FILE --log=LOG +// node limit-long-syntax.js --file FILE diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/examples/negate.js b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/negate.js new file mode 100644 index 00000000..b6634690 --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/negate.js @@ -0,0 +1,43 @@ +'use strict'; + +// This example is used in the documentation. + +// How might I add my own support for --no-foo? + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + 'color': { type: 'boolean' }, + 'no-color': { type: 'boolean' }, + 'logfile': { type: 'string' }, + 'no-logfile': { type: 'boolean' }, +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +// Reprocess the option tokens and overwrite the returned values. +tokens + .filter((token) => token.kind === 'option') + .forEach((token) => { + if (token.name.startsWith('no-')) { + // Store foo:false for --no-foo + const positiveName = token.name.slice(3); + values[positiveName] = false; + delete values[token.name]; + } else { + // Resave value so last one wins if both --foo and --no-foo. + values[token.name] = token.value ?? true; + } + }); + +const color = values.color; +const logfile = values.logfile ?? 'default.log'; + +console.log({ logfile, color }); + +// Try the following: +// node negate.js +// node negate.js --no-logfile --no-color +// negate.js --logfile=test.log --color +// node negate.js --no-logfile --logfile=test.log --color --no-color diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js new file mode 100644 index 00000000..0c324688 --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/no-repeated-options.js @@ -0,0 +1,31 @@ +'use strict'; + +// This is an example of using tokens to add a custom behaviour. +// +// Throw an error if an option is used more than once. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const options = { + ding: { type: 'boolean', short: 'd' }, + beep: { type: 'boolean', short: 'b' } +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +const seenBefore = new Set(); +tokens.forEach((token) => { + if (token.kind !== 'option') return; + if (seenBefore.has(token.name)) { + throw new Error(`option '${token.name}' used multiple times`); + } + seenBefore.add(token.name); +}); + +console.log(values); + +// Try the following: +// node no-repeated-options --ding --beep +// node no-repeated-options --beep -b +// node no-repeated-options -ddd diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs new file mode 100644 index 00000000..8ab7367b --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/ordered-options.mjs @@ -0,0 +1,41 @@ +// This is an example of using tokens to add a custom behaviour. +// +// This adds a option order check so that --some-unstable-option +// may only be used after --enable-experimental-options +// +// Note: this is not a common behaviour, the order of different options +// does not usually matter. + +import { parseArgs } from '../index.js'; + +function findTokenIndex(tokens, target) { + return tokens.findIndex((token) => token.kind === 'option' && + token.name === target + ); +} + +const experimentalName = 'enable-experimental-options'; +const unstableName = 'some-unstable-option'; + +const options = { + [experimentalName]: { type: 'boolean' }, + [unstableName]: { type: 'boolean' }, +}; + +const { values, tokens } = parseArgs({ options, tokens: true }); + +const experimentalIndex = findTokenIndex(tokens, experimentalName); +const unstableIndex = findTokenIndex(tokens, unstableName); +if (unstableIndex !== -1 && + ((experimentalIndex === -1) || (unstableIndex < experimentalIndex))) { + throw new Error(`'--${experimentalName}' must be specified before '--${unstableName}'`); +} + +console.log(values); + +/* eslint-disable max-len */ +// Try the following: +// node ordered-options.mjs +// node ordered-options.mjs --some-unstable-option +// node ordered-options.mjs --some-unstable-option --enable-experimental-options +// node ordered-options.mjs --enable-experimental-options --some-unstable-option diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js new file mode 100644 index 00000000..eff04c2a --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/examples/simple-hard-coded.js @@ -0,0 +1,26 @@ +'use strict'; + +// This example is used in the documentation. + +// 1. const { parseArgs } = require('node:util'); // from node +// 2. const { parseArgs } = require('@pkgjs/parseargs'); // from package +const { parseArgs } = require('..'); // in repo + +const args = ['-f', '--bar', 'b']; +const options = { + foo: { + type: 'boolean', + short: 'f' + }, + bar: { + type: 'string' + } +}; +const { + values, + positionals +} = parseArgs({ args, options }); +console.log(values, positionals); + +// Try the following: +// node simple-hard-coded.js diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/index.js b/node_modules/npm/node_modules/@pkgjs/parseargs/index.js new file mode 100644 index 00000000..b1004c7b --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/index.js @@ -0,0 +1,396 @@ +'use strict'; + +const { + ArrayPrototypeForEach, + ArrayPrototypeIncludes, + ArrayPrototypeMap, + ArrayPrototypePush, + ArrayPrototypePushApply, + ArrayPrototypeShift, + ArrayPrototypeSlice, + ArrayPrototypeUnshiftApply, + ObjectEntries, + ObjectPrototypeHasOwnProperty: ObjectHasOwn, + StringPrototypeCharAt, + StringPrototypeIndexOf, + StringPrototypeSlice, + StringPrototypeStartsWith, +} = require('./internal/primordials'); + +const { + validateArray, + validateBoolean, + validateBooleanArray, + validateObject, + validateString, + validateStringArray, + validateUnion, +} = require('./internal/validators'); + +const { + kEmptyObject, +} = require('./internal/util'); + +const { + findLongOptionForShort, + isLoneLongOption, + isLoneShortOption, + isLongOptionAndValue, + isOptionValue, + isOptionLikeValue, + isShortOptionAndValue, + isShortOptionGroup, + useDefaultValueOption, + objectGetOwn, + optionsGetOwn, +} = require('./utils'); + +const { + codes: { + ERR_INVALID_ARG_VALUE, + ERR_PARSE_ARGS_INVALID_OPTION_VALUE, + ERR_PARSE_ARGS_UNKNOWN_OPTION, + ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL, + }, +} = require('./internal/errors'); + +function getMainArgs() { + // Work out where to slice process.argv for user supplied arguments. + + // Check node options for scenarios where user CLI args follow executable. + const execArgv = process.execArgv; + if (ArrayPrototypeIncludes(execArgv, '-e') || + ArrayPrototypeIncludes(execArgv, '--eval') || + ArrayPrototypeIncludes(execArgv, '-p') || + ArrayPrototypeIncludes(execArgv, '--print')) { + return ArrayPrototypeSlice(process.argv, 1); + } + + // Normally first two arguments are executable and script, then CLI arguments + return ArrayPrototypeSlice(process.argv, 2); +} + +/** + * In strict mode, throw for possible usage errors like --foo --bar + * + * @param {object} token - from tokens as available from parseArgs + */ +function checkOptionLikeValue(token) { + if (!token.inlineValue && isOptionLikeValue(token.value)) { + // Only show short example if user used short option. + const example = StringPrototypeStartsWith(token.rawName, '--') ? + `'${token.rawName}=-XYZ'` : + `'--${token.name}=-XYZ' or '${token.rawName}-XYZ'`; + const errorMessage = `Option '${token.rawName}' argument is ambiguous. +Did you forget to specify the option argument for '${token.rawName}'? +To specify an option argument starting with a dash use ${example}.`; + throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(errorMessage); + } +} + +/** + * In strict mode, throw for usage errors. + * + * @param {object} config - from config passed to parseArgs + * @param {object} token - from tokens as available from parseArgs + */ +function checkOptionUsage(config, token) { + if (!ObjectHasOwn(config.options, token.name)) { + throw new ERR_PARSE_ARGS_UNKNOWN_OPTION( + token.rawName, config.allowPositionals); + } + + const short = optionsGetOwn(config.options, token.name, 'short'); + const shortAndLong = `${short ? `-${short}, ` : ''}--${token.name}`; + const type = optionsGetOwn(config.options, token.name, 'type'); + if (type === 'string' && typeof token.value !== 'string') { + throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(`Option '${shortAndLong} ' argument missing`); + } + // (Idiomatic test for undefined||null, expecting undefined.) + if (type === 'boolean' && token.value != null) { + throw new ERR_PARSE_ARGS_INVALID_OPTION_VALUE(`Option '${shortAndLong}' does not take an argument`); + } +} + + +/** + * Store the option value in `values`. + * + * @param {string} longOption - long option name e.g. 'foo' + * @param {string|undefined} optionValue - value from user args + * @param {object} options - option configs, from parseArgs({ options }) + * @param {object} values - option values returned in `values` by parseArgs + */ +function storeOption(longOption, optionValue, options, values) { + if (longOption === '__proto__') { + return; // No. Just no. + } + + // We store based on the option value rather than option type, + // preserving the users intent for author to deal with. + const newValue = optionValue ?? true; + if (optionsGetOwn(options, longOption, 'multiple')) { + // Always store value in array, including for boolean. + // values[longOption] starts out not present, + // first value is added as new array [newValue], + // subsequent values are pushed to existing array. + // (note: values has null prototype, so simpler usage) + if (values[longOption]) { + ArrayPrototypePush(values[longOption], newValue); + } else { + values[longOption] = [newValue]; + } + } else { + values[longOption] = newValue; + } +} + +/** + * Store the default option value in `values`. + * + * @param {string} longOption - long option name e.g. 'foo' + * @param {string + * | boolean + * | string[] + * | boolean[]} optionValue - default value from option config + * @param {object} values - option values returned in `values` by parseArgs + */ +function storeDefaultOption(longOption, optionValue, values) { + if (longOption === '__proto__') { + return; // No. Just no. + } + + values[longOption] = optionValue; +} + +/** + * Process args and turn into identified tokens: + * - option (along with value, if any) + * - positional + * - option-terminator + * + * @param {string[]} args - from parseArgs({ args }) or mainArgs + * @param {object} options - option configs, from parseArgs({ options }) + */ +function argsToTokens(args, options) { + const tokens = []; + let index = -1; + let groupCount = 0; + + const remainingArgs = ArrayPrototypeSlice(args); + while (remainingArgs.length > 0) { + const arg = ArrayPrototypeShift(remainingArgs); + const nextArg = remainingArgs[0]; + if (groupCount > 0) + groupCount--; + else + index++; + + // Check if `arg` is an options terminator. + // Guideline 10 in https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html + if (arg === '--') { + // Everything after a bare '--' is considered a positional argument. + ArrayPrototypePush(tokens, { kind: 'option-terminator', index }); + ArrayPrototypePushApply( + tokens, ArrayPrototypeMap(remainingArgs, (arg) => { + return { kind: 'positional', index: ++index, value: arg }; + }) + ); + break; // Finished processing args, leave while loop. + } + + if (isLoneShortOption(arg)) { + // e.g. '-f' + const shortOption = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(shortOption, options); + let value; + let inlineValue; + if (optionsGetOwn(options, longOption, 'type') === 'string' && + isOptionValue(nextArg)) { + // e.g. '-f', 'bar' + value = ArrayPrototypeShift(remainingArgs); + inlineValue = false; + } + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: arg, + index, value, inlineValue }); + if (value != null) ++index; + continue; + } + + if (isShortOptionGroup(arg, options)) { + // Expand -fXzy to -f -X -z -y + const expanded = []; + for (let index = 1; index < arg.length; index++) { + const shortOption = StringPrototypeCharAt(arg, index); + const longOption = findLongOptionForShort(shortOption, options); + if (optionsGetOwn(options, longOption, 'type') !== 'string' || + index === arg.length - 1) { + // Boolean option, or last short in group. Well formed. + ArrayPrototypePush(expanded, `-${shortOption}`); + } else { + // String option in middle. Yuck. + // Expand -abfFILE to -a -b -fFILE + ArrayPrototypePush(expanded, `-${StringPrototypeSlice(arg, index)}`); + break; // finished short group + } + } + ArrayPrototypeUnshiftApply(remainingArgs, expanded); + groupCount = expanded.length; + continue; + } + + if (isShortOptionAndValue(arg, options)) { + // e.g. -fFILE + const shortOption = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(shortOption, options); + const value = StringPrototypeSlice(arg, 2); + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: `-${shortOption}`, + index, value, inlineValue: true }); + continue; + } + + if (isLoneLongOption(arg)) { + // e.g. '--foo' + const longOption = StringPrototypeSlice(arg, 2); + let value; + let inlineValue; + if (optionsGetOwn(options, longOption, 'type') === 'string' && + isOptionValue(nextArg)) { + // e.g. '--foo', 'bar' + value = ArrayPrototypeShift(remainingArgs); + inlineValue = false; + } + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: arg, + index, value, inlineValue }); + if (value != null) ++index; + continue; + } + + if (isLongOptionAndValue(arg)) { + // e.g. --foo=bar + const equalIndex = StringPrototypeIndexOf(arg, '='); + const longOption = StringPrototypeSlice(arg, 2, equalIndex); + const value = StringPrototypeSlice(arg, equalIndex + 1); + ArrayPrototypePush( + tokens, + { kind: 'option', name: longOption, rawName: `--${longOption}`, + index, value, inlineValue: true }); + continue; + } + + ArrayPrototypePush(tokens, { kind: 'positional', index, value: arg }); + } + + return tokens; +} + +const parseArgs = (config = kEmptyObject) => { + const args = objectGetOwn(config, 'args') ?? getMainArgs(); + const strict = objectGetOwn(config, 'strict') ?? true; + const allowPositionals = objectGetOwn(config, 'allowPositionals') ?? !strict; + const returnTokens = objectGetOwn(config, 'tokens') ?? false; + const options = objectGetOwn(config, 'options') ?? { __proto__: null }; + // Bundle these up for passing to strict-mode checks. + const parseConfig = { args, strict, options, allowPositionals }; + + // Validate input configuration. + validateArray(args, 'args'); + validateBoolean(strict, 'strict'); + validateBoolean(allowPositionals, 'allowPositionals'); + validateBoolean(returnTokens, 'tokens'); + validateObject(options, 'options'); + ArrayPrototypeForEach( + ObjectEntries(options), + ({ 0: longOption, 1: optionConfig }) => { + validateObject(optionConfig, `options.${longOption}`); + + // type is required + const optionType = objectGetOwn(optionConfig, 'type'); + validateUnion(optionType, `options.${longOption}.type`, ['string', 'boolean']); + + if (ObjectHasOwn(optionConfig, 'short')) { + const shortOption = optionConfig.short; + validateString(shortOption, `options.${longOption}.short`); + if (shortOption.length !== 1) { + throw new ERR_INVALID_ARG_VALUE( + `options.${longOption}.short`, + shortOption, + 'must be a single character' + ); + } + } + + const multipleOption = objectGetOwn(optionConfig, 'multiple'); + if (ObjectHasOwn(optionConfig, 'multiple')) { + validateBoolean(multipleOption, `options.${longOption}.multiple`); + } + + const defaultValue = objectGetOwn(optionConfig, 'default'); + if (defaultValue !== undefined) { + let validator; + switch (optionType) { + case 'string': + validator = multipleOption ? validateStringArray : validateString; + break; + + case 'boolean': + validator = multipleOption ? validateBooleanArray : validateBoolean; + break; + } + validator(defaultValue, `options.${longOption}.default`); + } + } + ); + + // Phase 1: identify tokens + const tokens = argsToTokens(args, options); + + // Phase 2: process tokens into parsed option values and positionals + const result = { + values: { __proto__: null }, + positionals: [], + }; + if (returnTokens) { + result.tokens = tokens; + } + ArrayPrototypeForEach(tokens, (token) => { + if (token.kind === 'option') { + if (strict) { + checkOptionUsage(parseConfig, token); + checkOptionLikeValue(token); + } + storeOption(token.name, token.value, options, result.values); + } else if (token.kind === 'positional') { + if (!allowPositionals) { + throw new ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL(token.value); + } + ArrayPrototypePush(result.positionals, token.value); + } + }); + + // Phase 3: fill in default values for missing args + ArrayPrototypeForEach(ObjectEntries(options), ({ 0: longOption, + 1: optionConfig }) => { + const mustSetDefault = useDefaultValueOption(longOption, + optionConfig, + result.values); + if (mustSetDefault) { + storeDefaultOption(longOption, + objectGetOwn(optionConfig, 'default'), + result.values); + } + }); + + + return result; +}; + +module.exports = { + parseArgs, +}; diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/internal/errors.js b/node_modules/npm/node_modules/@pkgjs/parseargs/internal/errors.js new file mode 100644 index 00000000..e1b237b5 --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/internal/errors.js @@ -0,0 +1,47 @@ +'use strict'; + +class ERR_INVALID_ARG_TYPE extends TypeError { + constructor(name, expected, actual) { + super(`${name} must be ${expected} got ${actual}`); + this.code = 'ERR_INVALID_ARG_TYPE'; + } +} + +class ERR_INVALID_ARG_VALUE extends TypeError { + constructor(arg1, arg2, expected) { + super(`The property ${arg1} ${expected}. Received '${arg2}'`); + this.code = 'ERR_INVALID_ARG_VALUE'; + } +} + +class ERR_PARSE_ARGS_INVALID_OPTION_VALUE extends Error { + constructor(message) { + super(message); + this.code = 'ERR_PARSE_ARGS_INVALID_OPTION_VALUE'; + } +} + +class ERR_PARSE_ARGS_UNKNOWN_OPTION extends Error { + constructor(option, allowPositionals) { + const suggestDashDash = allowPositionals ? `. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- ${JSON.stringify(option)}` : ''; + super(`Unknown option '${option}'${suggestDashDash}`); + this.code = 'ERR_PARSE_ARGS_UNKNOWN_OPTION'; + } +} + +class ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL extends Error { + constructor(positional) { + super(`Unexpected argument '${positional}'. This command does not take positional arguments`); + this.code = 'ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL'; + } +} + +module.exports = { + codes: { + ERR_INVALID_ARG_TYPE, + ERR_INVALID_ARG_VALUE, + ERR_PARSE_ARGS_INVALID_OPTION_VALUE, + ERR_PARSE_ARGS_UNKNOWN_OPTION, + ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL, + } +}; diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/internal/primordials.js b/node_modules/npm/node_modules/@pkgjs/parseargs/internal/primordials.js new file mode 100644 index 00000000..63e23ab1 --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/internal/primordials.js @@ -0,0 +1,393 @@ +/* +This file is copied from https://github.com/nodejs/node/blob/v14.19.3/lib/internal/per_context/primordials.js +under the following license: + +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. +*/ + +'use strict'; + +/* eslint-disable node-core/prefer-primordials */ + +// This file subclasses and stores the JS builtins that come from the VM +// so that Node.js's builtin modules do not need to later look these up from +// the global proxy, which can be mutated by users. + +// Use of primordials have sometimes a dramatic impact on performance, please +// benchmark all changes made in performance-sensitive areas of the codebase. +// See: https://github.com/nodejs/node/pull/38248 + +const primordials = {}; + +const { + defineProperty: ReflectDefineProperty, + getOwnPropertyDescriptor: ReflectGetOwnPropertyDescriptor, + ownKeys: ReflectOwnKeys, +} = Reflect; + +// `uncurryThis` is equivalent to `func => Function.prototype.call.bind(func)`. +// It is using `bind.bind(call)` to avoid using `Function.prototype.bind` +// and `Function.prototype.call` after it may have been mutated by users. +const { apply, bind, call } = Function.prototype; +const uncurryThis = bind.bind(call); +primordials.uncurryThis = uncurryThis; + +// `applyBind` is equivalent to `func => Function.prototype.apply.bind(func)`. +// It is using `bind.bind(apply)` to avoid using `Function.prototype.bind` +// and `Function.prototype.apply` after it may have been mutated by users. +const applyBind = bind.bind(apply); +primordials.applyBind = applyBind; + +// Methods that accept a variable number of arguments, and thus it's useful to +// also create `${prefix}${key}Apply`, which uses `Function.prototype.apply`, +// instead of `Function.prototype.call`, and thus doesn't require iterator +// destructuring. +const varargsMethods = [ + // 'ArrayPrototypeConcat' is omitted, because it performs the spread + // on its own for arrays and array-likes with a truthy + // @@isConcatSpreadable symbol property. + 'ArrayOf', + 'ArrayPrototypePush', + 'ArrayPrototypeUnshift', + // 'FunctionPrototypeCall' is omitted, since there's 'ReflectApply' + // and 'FunctionPrototypeApply'. + 'MathHypot', + 'MathMax', + 'MathMin', + 'StringPrototypeConcat', + 'TypedArrayOf', +]; + +function getNewKey(key) { + return typeof key === 'symbol' ? + `Symbol${key.description[7].toUpperCase()}${key.description.slice(8)}` : + `${key[0].toUpperCase()}${key.slice(1)}`; +} + +function copyAccessor(dest, prefix, key, { enumerable, get, set }) { + ReflectDefineProperty(dest, `${prefix}Get${key}`, { + value: uncurryThis(get), + enumerable + }); + if (set !== undefined) { + ReflectDefineProperty(dest, `${prefix}Set${key}`, { + value: uncurryThis(set), + enumerable + }); + } +} + +function copyPropsRenamed(src, dest, prefix) { + for (const key of ReflectOwnKeys(src)) { + const newKey = getNewKey(key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); + if ('get' in desc) { + copyAccessor(dest, prefix, newKey, desc); + } else { + const name = `${prefix}${newKey}`; + ReflectDefineProperty(dest, name, desc); + if (varargsMethods.includes(name)) { + ReflectDefineProperty(dest, `${name}Apply`, { + // `src` is bound as the `this` so that the static `this` points + // to the object it was defined on, + // e.g.: `ArrayOfApply` gets a `this` of `Array`: + value: applyBind(desc.value, src), + }); + } + } + } +} + +function copyPropsRenamedBound(src, dest, prefix) { + for (const key of ReflectOwnKeys(src)) { + const newKey = getNewKey(key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); + if ('get' in desc) { + copyAccessor(dest, prefix, newKey, desc); + } else { + const { value } = desc; + if (typeof value === 'function') { + desc.value = value.bind(src); + } + + const name = `${prefix}${newKey}`; + ReflectDefineProperty(dest, name, desc); + if (varargsMethods.includes(name)) { + ReflectDefineProperty(dest, `${name}Apply`, { + value: applyBind(value, src), + }); + } + } + } +} + +function copyPrototype(src, dest, prefix) { + for (const key of ReflectOwnKeys(src)) { + const newKey = getNewKey(key); + const desc = ReflectGetOwnPropertyDescriptor(src, key); + if ('get' in desc) { + copyAccessor(dest, prefix, newKey, desc); + } else { + const { value } = desc; + if (typeof value === 'function') { + desc.value = uncurryThis(value); + } + + const name = `${prefix}${newKey}`; + ReflectDefineProperty(dest, name, desc); + if (varargsMethods.includes(name)) { + ReflectDefineProperty(dest, `${name}Apply`, { + value: applyBind(value), + }); + } + } + } +} + +// Create copies of configurable value properties of the global object +[ + 'Proxy', + 'globalThis', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + primordials[name] = globalThis[name]; +}); + +// Create copies of URI handling functions +[ + decodeURI, + decodeURIComponent, + encodeURI, + encodeURIComponent, +].forEach((fn) => { + primordials[fn.name] = fn; +}); + +// Create copies of the namespace objects +[ + 'JSON', + 'Math', + 'Proxy', + 'Reflect', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + copyPropsRenamed(global[name], primordials, name); +}); + +// Create copies of intrinsic objects +[ + 'Array', + 'ArrayBuffer', + 'BigInt', + 'BigInt64Array', + 'BigUint64Array', + 'Boolean', + 'DataView', + 'Date', + 'Error', + 'EvalError', + 'Float32Array', + 'Float64Array', + 'Function', + 'Int16Array', + 'Int32Array', + 'Int8Array', + 'Map', + 'Number', + 'Object', + 'RangeError', + 'ReferenceError', + 'RegExp', + 'Set', + 'String', + 'Symbol', + 'SyntaxError', + 'TypeError', + 'URIError', + 'Uint16Array', + 'Uint32Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'WeakMap', + 'WeakSet', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + const original = global[name]; + primordials[name] = original; + copyPropsRenamed(original, primordials, name); + copyPrototype(original.prototype, primordials, `${name}Prototype`); +}); + +// Create copies of intrinsic objects that require a valid `this` to call +// static methods. +// Refs: https://www.ecma-international.org/ecma-262/#sec-promise.all +[ + 'Promise', +].forEach((name) => { + // eslint-disable-next-line no-restricted-globals + const original = global[name]; + primordials[name] = original; + copyPropsRenamedBound(original, primordials, name); + copyPrototype(original.prototype, primordials, `${name}Prototype`); +}); + +// Create copies of abstract intrinsic objects that are not directly exposed +// on the global object. +// Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object +[ + { name: 'TypedArray', original: Reflect.getPrototypeOf(Uint8Array) }, + { name: 'ArrayIterator', original: { + prototype: Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()), + } }, + { name: 'StringIterator', original: { + prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()), + } }, +].forEach(({ name, original }) => { + primordials[name] = original; + // The static %TypedArray% methods require a valid `this`, but can't be bound, + // as they need a subclass constructor as the receiver: + copyPrototype(original, primordials, name); + copyPrototype(original.prototype, primordials, `${name}Prototype`); +}); + +/* eslint-enable node-core/prefer-primordials */ + +const { + ArrayPrototypeForEach, + FunctionPrototypeCall, + Map, + ObjectFreeze, + ObjectSetPrototypeOf, + Set, + SymbolIterator, + WeakMap, + WeakSet, +} = primordials; + +// Because these functions are used by `makeSafe`, which is exposed +// on the `primordials` object, it's important to use const references +// to the primordials that they use: +const createSafeIterator = (factory, next) => { + class SafeIterator { + constructor(iterable) { + this._iterator = factory(iterable); + } + next() { + return next(this._iterator); + } + [SymbolIterator]() { + return this; + } + } + ObjectSetPrototypeOf(SafeIterator.prototype, null); + ObjectFreeze(SafeIterator.prototype); + ObjectFreeze(SafeIterator); + return SafeIterator; +}; + +primordials.SafeArrayIterator = createSafeIterator( + primordials.ArrayPrototypeSymbolIterator, + primordials.ArrayIteratorPrototypeNext +); +primordials.SafeStringIterator = createSafeIterator( + primordials.StringPrototypeSymbolIterator, + primordials.StringIteratorPrototypeNext +); + +const copyProps = (src, dest) => { + ArrayPrototypeForEach(ReflectOwnKeys(src), (key) => { + if (!ReflectGetOwnPropertyDescriptor(dest, key)) { + ReflectDefineProperty( + dest, + key, + ReflectGetOwnPropertyDescriptor(src, key)); + } + }); +}; + +const makeSafe = (unsafe, safe) => { + if (SymbolIterator in unsafe.prototype) { + const dummy = new unsafe(); + let next; // We can reuse the same `next` method. + + ArrayPrototypeForEach(ReflectOwnKeys(unsafe.prototype), (key) => { + if (!ReflectGetOwnPropertyDescriptor(safe.prototype, key)) { + const desc = ReflectGetOwnPropertyDescriptor(unsafe.prototype, key); + if ( + typeof desc.value === 'function' && + desc.value.length === 0 && + SymbolIterator in (FunctionPrototypeCall(desc.value, dummy) ?? {}) + ) { + const createIterator = uncurryThis(desc.value); + next = next ?? uncurryThis(createIterator(dummy).next); + const SafeIterator = createSafeIterator(createIterator, next); + desc.value = function() { + return new SafeIterator(this); + }; + } + ReflectDefineProperty(safe.prototype, key, desc); + } + }); + } else { + copyProps(unsafe.prototype, safe.prototype); + } + copyProps(unsafe, safe); + + ObjectSetPrototypeOf(safe.prototype, null); + ObjectFreeze(safe.prototype); + ObjectFreeze(safe); + return safe; +}; +primordials.makeSafe = makeSafe; + +// Subclass the constructors because we need to use their prototype +// methods later. +// Defining the `constructor` is necessary here to avoid the default +// constructor which uses the user-mutable `%ArrayIteratorPrototype%.next`. +primordials.SafeMap = makeSafe( + Map, + class SafeMap extends Map { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeWeakMap = makeSafe( + WeakMap, + class SafeWeakMap extends WeakMap { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeSet = makeSafe( + Set, + class SafeSet extends Set { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); +primordials.SafeWeakSet = makeSafe( + WeakSet, + class SafeWeakSet extends WeakSet { + constructor(i) { super(i); } // eslint-disable-line no-useless-constructor + } +); + +ObjectSetPrototypeOf(primordials, null); +ObjectFreeze(primordials); + +module.exports = primordials; diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/internal/util.js b/node_modules/npm/node_modules/@pkgjs/parseargs/internal/util.js new file mode 100644 index 00000000..b9b8fe5b --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/internal/util.js @@ -0,0 +1,14 @@ +'use strict'; + +// This is a placeholder for util.js in node.js land. + +const { + ObjectCreate, + ObjectFreeze, +} = require('./primordials'); + +const kEmptyObject = ObjectFreeze(ObjectCreate(null)); + +module.exports = { + kEmptyObject, +}; diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/internal/validators.js b/node_modules/npm/node_modules/@pkgjs/parseargs/internal/validators.js new file mode 100644 index 00000000..b5ac4fb5 --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/internal/validators.js @@ -0,0 +1,89 @@ +'use strict'; + +// This file is a proxy of the original file located at: +// https://github.com/nodejs/node/blob/main/lib/internal/validators.js +// Every addition or modification to this file must be evaluated +// during the PR review. + +const { + ArrayIsArray, + ArrayPrototypeIncludes, + ArrayPrototypeJoin, +} = require('./primordials'); + +const { + codes: { + ERR_INVALID_ARG_TYPE + } +} = require('./errors'); + +function validateString(value, name) { + if (typeof value !== 'string') { + throw new ERR_INVALID_ARG_TYPE(name, 'String', value); + } +} + +function validateUnion(value, name, union) { + if (!ArrayPrototypeIncludes(union, value)) { + throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value); + } +} + +function validateBoolean(value, name) { + if (typeof value !== 'boolean') { + throw new ERR_INVALID_ARG_TYPE(name, 'Boolean', value); + } +} + +function validateArray(value, name) { + if (!ArrayIsArray(value)) { + throw new ERR_INVALID_ARG_TYPE(name, 'Array', value); + } +} + +function validateStringArray(value, name) { + validateArray(value, name); + for (let i = 0; i < value.length; i++) { + validateString(value[i], `${name}[${i}]`); + } +} + +function validateBooleanArray(value, name) { + validateArray(value, name); + for (let i = 0; i < value.length; i++) { + validateBoolean(value[i], `${name}[${i}]`); + } +} + +/** + * @param {unknown} value + * @param {string} name + * @param {{ + * allowArray?: boolean, + * allowFunction?: boolean, + * nullable?: boolean + * }} [options] + */ +function validateObject(value, name, options) { + const useDefaultOptions = options == null; + const allowArray = useDefaultOptions ? false : options.allowArray; + const allowFunction = useDefaultOptions ? false : options.allowFunction; + const nullable = useDefaultOptions ? false : options.nullable; + if ((!nullable && value === null) || + (!allowArray && ArrayIsArray(value)) || + (typeof value !== 'object' && ( + !allowFunction || typeof value !== 'function' + ))) { + throw new ERR_INVALID_ARG_TYPE(name, 'Object', value); + } +} + +module.exports = { + validateArray, + validateObject, + validateString, + validateStringArray, + validateUnion, + validateBoolean, + validateBooleanArray, +}; diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/package.json b/node_modules/npm/node_modules/@pkgjs/parseargs/package.json new file mode 100644 index 00000000..0bcc05c0 --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/package.json @@ -0,0 +1,36 @@ +{ + "name": "@pkgjs/parseargs", + "version": "0.11.0", + "description": "Polyfill of future proposal for `util.parseArgs()`", + "engines": { + "node": ">=14" + }, + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "scripts": { + "coverage": "c8 --check-coverage tape 'test/*.js'", + "test": "c8 tape 'test/*.js'", + "posttest": "eslint .", + "fix": "npm run posttest -- --fix" + }, + "repository": { + "type": "git", + "url": "git@github.com:pkgjs/parseargs.git" + }, + "keywords": [], + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/pkgjs/parseargs/issues" + }, + "homepage": "https://github.com/pkgjs/parseargs#readme", + "devDependencies": { + "c8": "^7.10.0", + "eslint": "^8.2.0", + "eslint-plugin-node-core": "iansu/eslint-plugin-node-core", + "tape": "^5.2.2" + } +} diff --git a/node_modules/npm/node_modules/@pkgjs/parseargs/utils.js b/node_modules/npm/node_modules/@pkgjs/parseargs/utils.js new file mode 100644 index 00000000..d7f420a2 --- /dev/null +++ b/node_modules/npm/node_modules/@pkgjs/parseargs/utils.js @@ -0,0 +1,198 @@ +'use strict'; + +const { + ArrayPrototypeFind, + ObjectEntries, + ObjectPrototypeHasOwnProperty: ObjectHasOwn, + StringPrototypeCharAt, + StringPrototypeIncludes, + StringPrototypeStartsWith, +} = require('./internal/primordials'); + +const { + validateObject, +} = require('./internal/validators'); + +// These are internal utilities to make the parsing logic easier to read, and +// add lots of detail for the curious. They are in a separate file to allow +// unit testing, although that is not essential (this could be rolled into +// main file and just tested implicitly via API). +// +// These routines are for internal use, not for export to client. + +/** + * Return the named property, but only if it is an own property. + */ +function objectGetOwn(obj, prop) { + if (ObjectHasOwn(obj, prop)) + return obj[prop]; +} + +/** + * Return the named options property, but only if it is an own property. + */ +function optionsGetOwn(options, longOption, prop) { + if (ObjectHasOwn(options, longOption)) + return objectGetOwn(options[longOption], prop); +} + +/** + * Determines if the argument may be used as an option value. + * @example + * isOptionValue('V') // returns true + * isOptionValue('-v') // returns true (greedy) + * isOptionValue('--foo') // returns true (greedy) + * isOptionValue(undefined) // returns false + */ +function isOptionValue(value) { + if (value == null) return false; + + // Open Group Utility Conventions are that an option-argument + // is the argument after the option, and may start with a dash. + return true; // greedy! +} + +/** + * Detect whether there is possible confusion and user may have omitted + * the option argument, like `--port --verbose` when `port` of type:string. + * In strict mode we throw errors if value is option-like. + */ +function isOptionLikeValue(value) { + if (value == null) return false; + + return value.length > 1 && StringPrototypeCharAt(value, 0) === '-'; +} + +/** + * Determines if `arg` is just a short option. + * @example '-f' + */ +function isLoneShortOption(arg) { + return arg.length === 2 && + StringPrototypeCharAt(arg, 0) === '-' && + StringPrototypeCharAt(arg, 1) !== '-'; +} + +/** + * Determines if `arg` is a lone long option. + * @example + * isLoneLongOption('a') // returns false + * isLoneLongOption('-a') // returns false + * isLoneLongOption('--foo') // returns true + * isLoneLongOption('--foo=bar') // returns false + */ +function isLoneLongOption(arg) { + return arg.length > 2 && + StringPrototypeStartsWith(arg, '--') && + !StringPrototypeIncludes(arg, '=', 3); +} + +/** + * Determines if `arg` is a long option and value in the same argument. + * @example + * isLongOptionAndValue('--foo') // returns false + * isLongOptionAndValue('--foo=bar') // returns true + */ +function isLongOptionAndValue(arg) { + return arg.length > 2 && + StringPrototypeStartsWith(arg, '--') && + StringPrototypeIncludes(arg, '=', 3); +} + +/** + * Determines if `arg` is a short option group. + * + * See Guideline 5 of the [Open Group Utility Conventions](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html). + * One or more options without option-arguments, followed by at most one + * option that takes an option-argument, should be accepted when grouped + * behind one '-' delimiter. + * @example + * isShortOptionGroup('-a', {}) // returns false + * isShortOptionGroup('-ab', {}) // returns true + * // -fb is an option and a value, not a short option group + * isShortOptionGroup('-fb', { + * options: { f: { type: 'string' } } + * }) // returns false + * isShortOptionGroup('-bf', { + * options: { f: { type: 'string' } } + * }) // returns true + * // -bfb is an edge case, return true and caller sorts it out + * isShortOptionGroup('-bfb', { + * options: { f: { type: 'string' } } + * }) // returns true + */ +function isShortOptionGroup(arg, options) { + if (arg.length <= 2) return false; + if (StringPrototypeCharAt(arg, 0) !== '-') return false; + if (StringPrototypeCharAt(arg, 1) === '-') return false; + + const firstShort = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(firstShort, options); + return optionsGetOwn(options, longOption, 'type') !== 'string'; +} + +/** + * Determine if arg is a short string option followed by its value. + * @example + * isShortOptionAndValue('-a', {}); // returns false + * isShortOptionAndValue('-ab', {}); // returns false + * isShortOptionAndValue('-fFILE', { + * options: { foo: { short: 'f', type: 'string' }} + * }) // returns true + */ +function isShortOptionAndValue(arg, options) { + validateObject(options, 'options'); + + if (arg.length <= 2) return false; + if (StringPrototypeCharAt(arg, 0) !== '-') return false; + if (StringPrototypeCharAt(arg, 1) === '-') return false; + + const shortOption = StringPrototypeCharAt(arg, 1); + const longOption = findLongOptionForShort(shortOption, options); + return optionsGetOwn(options, longOption, 'type') === 'string'; +} + +/** + * Find the long option associated with a short option. Looks for a configured + * `short` and returns the short option itself if a long option is not found. + * @example + * findLongOptionForShort('a', {}) // returns 'a' + * findLongOptionForShort('b', { + * options: { bar: { short: 'b' } } + * }) // returns 'bar' + */ +function findLongOptionForShort(shortOption, options) { + validateObject(options, 'options'); + const longOptionEntry = ArrayPrototypeFind( + ObjectEntries(options), + ({ 1: optionConfig }) => objectGetOwn(optionConfig, 'short') === shortOption + ); + return longOptionEntry?.[0] ?? shortOption; +} + +/** + * Check if the given option includes a default value + * and that option has not been set by the input args. + * + * @param {string} longOption - long option name e.g. 'foo' + * @param {object} optionConfig - the option configuration properties + * @param {object} values - option values returned in `values` by parseArgs + */ +function useDefaultValueOption(longOption, optionConfig, values) { + return objectGetOwn(optionConfig, 'default') !== undefined && + values[longOption] === undefined; +} + +module.exports = { + findLongOptionForShort, + isLoneLongOption, + isLoneShortOption, + isLongOptionAndValue, + isOptionValue, + isOptionLikeValue, + isShortOptionAndValue, + isShortOptionGroup, + useDefaultValueOption, + objectGetOwn, + optionsGetOwn, +}; diff --git a/node_modules/npm/node_modules/@sigstore/bundle/LICENSE b/node_modules/npm/node_modules/@sigstore/bundle/LICENSE new file mode 100644 index 00000000..e9e7c167 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/bundle/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 The Sigstore Authors + + 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. diff --git a/node_modules/npm/node_modules/@sigstore/bundle/dist/build.js b/node_modules/npm/node_modules/@sigstore/bundle/dist/build.js new file mode 100644 index 00000000..ade73640 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/bundle/dist/build.js @@ -0,0 +1,100 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toMessageSignatureBundle = toMessageSignatureBundle; +exports.toDSSEBundle = toDSSEBundle; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const protobuf_specs_1 = require("@sigstore/protobuf-specs"); +const bundle_1 = require("./bundle"); +// Message signature bundle - $case: 'messageSignature' +function toMessageSignatureBundle(options) { + return { + mediaType: options.certificateChain + ? bundle_1.BUNDLE_V02_MEDIA_TYPE + : bundle_1.BUNDLE_V03_MEDIA_TYPE, + content: { + $case: 'messageSignature', + messageSignature: { + messageDigest: { + algorithm: protobuf_specs_1.HashAlgorithm.SHA2_256, + digest: options.digest, + }, + signature: options.signature, + }, + }, + verificationMaterial: toVerificationMaterial(options), + }; +} +// DSSE envelope bundle - $case: 'dsseEnvelope' +function toDSSEBundle(options) { + return { + mediaType: options.certificateChain + ? bundle_1.BUNDLE_V02_MEDIA_TYPE + : bundle_1.BUNDLE_V03_MEDIA_TYPE, + content: { + $case: 'dsseEnvelope', + dsseEnvelope: toEnvelope(options), + }, + verificationMaterial: toVerificationMaterial(options), + }; +} +function toEnvelope(options) { + return { + payloadType: options.artifactType, + payload: options.artifact, + signatures: [toSignature(options)], + }; +} +function toSignature(options) { + return { + keyid: options.keyHint || '', + sig: options.signature, + }; +} +// Verification material +function toVerificationMaterial(options) { + return { + content: toKeyContent(options), + tlogEntries: [], + timestampVerificationData: { rfc3161Timestamps: [] }, + }; +} +function toKeyContent(options) { + if (options.certificate) { + if (options.certificateChain) { + return { + $case: 'x509CertificateChain', + x509CertificateChain: { + certificates: [{ rawBytes: options.certificate }], + }, + }; + } + else { + return { + $case: 'certificate', + certificate: { rawBytes: options.certificate }, + }; + } + } + else { + return { + $case: 'publicKey', + publicKey: { + hint: options.keyHint || '', + }, + }; + } +} diff --git a/node_modules/npm/node_modules/@sigstore/bundle/dist/bundle.js b/node_modules/npm/node_modules/@sigstore/bundle/dist/bundle.js new file mode 100644 index 00000000..eb67a0dd --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/bundle/dist/bundle.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BUNDLE_V03_MEDIA_TYPE = exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = void 0; +exports.isBundleWithCertificateChain = isBundleWithCertificateChain; +exports.isBundleWithPublicKey = isBundleWithPublicKey; +exports.isBundleWithMessageSignature = isBundleWithMessageSignature; +exports.isBundleWithDsseEnvelope = isBundleWithDsseEnvelope; +exports.BUNDLE_V01_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.1'; +exports.BUNDLE_V02_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.2'; +exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle+json;version=0.3'; +exports.BUNDLE_V03_MEDIA_TYPE = 'application/vnd.dev.sigstore.bundle.v0.3+json'; +// Type guards for bundle variants. +function isBundleWithCertificateChain(b) { + return b.verificationMaterial.content.$case === 'x509CertificateChain'; +} +function isBundleWithPublicKey(b) { + return b.verificationMaterial.content.$case === 'publicKey'; +} +function isBundleWithMessageSignature(b) { + return b.content.$case === 'messageSignature'; +} +function isBundleWithDsseEnvelope(b) { + return b.content.$case === 'dsseEnvelope'; +} diff --git a/node_modules/npm/node_modules/@sigstore/bundle/dist/error.js b/node_modules/npm/node_modules/@sigstore/bundle/dist/error.js new file mode 100644 index 00000000..f8429532 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/bundle/dist/error.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValidationError = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +class ValidationError extends Error { + constructor(message, fields) { + super(message); + this.fields = fields; + } +} +exports.ValidationError = ValidationError; diff --git a/node_modules/npm/node_modules/@sigstore/bundle/dist/index.js b/node_modules/npm/node_modules/@sigstore/bundle/dist/index.js new file mode 100644 index 00000000..1b012aca --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/bundle/dist/index.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isBundleV01 = exports.assertBundleV02 = exports.assertBundleV01 = exports.assertBundleLatest = exports.assertBundle = exports.envelopeToJSON = exports.envelopeFromJSON = exports.bundleToJSON = exports.bundleFromJSON = exports.ValidationError = exports.isBundleWithPublicKey = exports.isBundleWithMessageSignature = exports.isBundleWithDsseEnvelope = exports.isBundleWithCertificateChain = exports.BUNDLE_V03_MEDIA_TYPE = exports.BUNDLE_V03_LEGACY_MEDIA_TYPE = exports.BUNDLE_V02_MEDIA_TYPE = exports.BUNDLE_V01_MEDIA_TYPE = exports.toMessageSignatureBundle = exports.toDSSEBundle = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +var build_1 = require("./build"); +Object.defineProperty(exports, "toDSSEBundle", { enumerable: true, get: function () { return build_1.toDSSEBundle; } }); +Object.defineProperty(exports, "toMessageSignatureBundle", { enumerable: true, get: function () { return build_1.toMessageSignatureBundle; } }); +var bundle_1 = require("./bundle"); +Object.defineProperty(exports, "BUNDLE_V01_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V01_MEDIA_TYPE; } }); +Object.defineProperty(exports, "BUNDLE_V02_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V02_MEDIA_TYPE; } }); +Object.defineProperty(exports, "BUNDLE_V03_LEGACY_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V03_LEGACY_MEDIA_TYPE; } }); +Object.defineProperty(exports, "BUNDLE_V03_MEDIA_TYPE", { enumerable: true, get: function () { return bundle_1.BUNDLE_V03_MEDIA_TYPE; } }); +Object.defineProperty(exports, "isBundleWithCertificateChain", { enumerable: true, get: function () { return bundle_1.isBundleWithCertificateChain; } }); +Object.defineProperty(exports, "isBundleWithDsseEnvelope", { enumerable: true, get: function () { return bundle_1.isBundleWithDsseEnvelope; } }); +Object.defineProperty(exports, "isBundleWithMessageSignature", { enumerable: true, get: function () { return bundle_1.isBundleWithMessageSignature; } }); +Object.defineProperty(exports, "isBundleWithPublicKey", { enumerable: true, get: function () { return bundle_1.isBundleWithPublicKey; } }); +var error_1 = require("./error"); +Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return error_1.ValidationError; } }); +var serialized_1 = require("./serialized"); +Object.defineProperty(exports, "bundleFromJSON", { enumerable: true, get: function () { return serialized_1.bundleFromJSON; } }); +Object.defineProperty(exports, "bundleToJSON", { enumerable: true, get: function () { return serialized_1.bundleToJSON; } }); +Object.defineProperty(exports, "envelopeFromJSON", { enumerable: true, get: function () { return serialized_1.envelopeFromJSON; } }); +Object.defineProperty(exports, "envelopeToJSON", { enumerable: true, get: function () { return serialized_1.envelopeToJSON; } }); +var validate_1 = require("./validate"); +Object.defineProperty(exports, "assertBundle", { enumerable: true, get: function () { return validate_1.assertBundle; } }); +Object.defineProperty(exports, "assertBundleLatest", { enumerable: true, get: function () { return validate_1.assertBundleLatest; } }); +Object.defineProperty(exports, "assertBundleV01", { enumerable: true, get: function () { return validate_1.assertBundleV01; } }); +Object.defineProperty(exports, "assertBundleV02", { enumerable: true, get: function () { return validate_1.assertBundleV02; } }); +Object.defineProperty(exports, "isBundleV01", { enumerable: true, get: function () { return validate_1.isBundleV01; } }); diff --git a/node_modules/npm/node_modules/@sigstore/bundle/dist/serialized.js b/node_modules/npm/node_modules/@sigstore/bundle/dist/serialized.js new file mode 100644 index 00000000..be0d2a2d --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/bundle/dist/serialized.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.envelopeToJSON = exports.envelopeFromJSON = exports.bundleToJSON = exports.bundleFromJSON = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const protobuf_specs_1 = require("@sigstore/protobuf-specs"); +const bundle_1 = require("./bundle"); +const validate_1 = require("./validate"); +const bundleFromJSON = (obj) => { + const bundle = protobuf_specs_1.Bundle.fromJSON(obj); + switch (bundle.mediaType) { + case bundle_1.BUNDLE_V01_MEDIA_TYPE: + (0, validate_1.assertBundleV01)(bundle); + break; + case bundle_1.BUNDLE_V02_MEDIA_TYPE: + (0, validate_1.assertBundleV02)(bundle); + break; + default: + (0, validate_1.assertBundleLatest)(bundle); + break; + } + return bundle; +}; +exports.bundleFromJSON = bundleFromJSON; +const bundleToJSON = (bundle) => { + return protobuf_specs_1.Bundle.toJSON(bundle); +}; +exports.bundleToJSON = bundleToJSON; +const envelopeFromJSON = (obj) => { + return protobuf_specs_1.Envelope.fromJSON(obj); +}; +exports.envelopeFromJSON = envelopeFromJSON; +const envelopeToJSON = (envelope) => { + return protobuf_specs_1.Envelope.toJSON(envelope); +}; +exports.envelopeToJSON = envelopeToJSON; diff --git a/node_modules/npm/node_modules/@sigstore/bundle/dist/utility.js b/node_modules/npm/node_modules/@sigstore/bundle/dist/utility.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/bundle/dist/utility.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/npm/node_modules/@sigstore/bundle/dist/validate.js b/node_modules/npm/node_modules/@sigstore/bundle/dist/validate.js new file mode 100644 index 00000000..21b8b5ee --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/bundle/dist/validate.js @@ -0,0 +1,199 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assertBundle = assertBundle; +exports.assertBundleV01 = assertBundleV01; +exports.isBundleV01 = isBundleV01; +exports.assertBundleV02 = assertBundleV02; +exports.assertBundleLatest = assertBundleLatest; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const error_1 = require("./error"); +// Performs basic validation of a Sigstore bundle to ensure that all required +// fields are populated. This is not a complete validation of the bundle, but +// rather a check that the bundle is in a valid state to be processed by the +// rest of the code. +function assertBundle(b) { + const invalidValues = validateBundleBase(b); + if (invalidValues.length > 0) { + throw new error_1.ValidationError('invalid bundle', invalidValues); + } +} +// Asserts that the given bundle conforms to the v0.1 bundle format. +function assertBundleV01(b) { + const invalidValues = []; + invalidValues.push(...validateBundleBase(b)); + invalidValues.push(...validateInclusionPromise(b)); + if (invalidValues.length > 0) { + throw new error_1.ValidationError('invalid v0.1 bundle', invalidValues); + } +} +// Type guard to determine if Bundle is a v0.1 bundle. +function isBundleV01(b) { + try { + assertBundleV01(b); + return true; + } + catch (e) { + return false; + } +} +// Asserts that the given bundle conforms to the v0.2 bundle format. +function assertBundleV02(b) { + const invalidValues = []; + invalidValues.push(...validateBundleBase(b)); + invalidValues.push(...validateInclusionProof(b)); + if (invalidValues.length > 0) { + throw new error_1.ValidationError('invalid v0.2 bundle', invalidValues); + } +} +// Asserts that the given bundle conforms to the newest (0.3) bundle format. +function assertBundleLatest(b) { + const invalidValues = []; + invalidValues.push(...validateBundleBase(b)); + invalidValues.push(...validateInclusionProof(b)); + invalidValues.push(...validateNoCertificateChain(b)); + if (invalidValues.length > 0) { + throw new error_1.ValidationError('invalid bundle', invalidValues); + } +} +function validateBundleBase(b) { + const invalidValues = []; + // Media type validation + if (b.mediaType === undefined || + (!b.mediaType.match(/^application\/vnd\.dev\.sigstore\.bundle\+json;version=\d\.\d/) && + !b.mediaType.match(/^application\/vnd\.dev\.sigstore\.bundle\.v\d\.\d\+json/))) { + invalidValues.push('mediaType'); + } + // Content-related validation + if (b.content === undefined) { + invalidValues.push('content'); + } + else { + switch (b.content.$case) { + case 'messageSignature': + if (b.content.messageSignature.messageDigest === undefined) { + invalidValues.push('content.messageSignature.messageDigest'); + } + else { + if (b.content.messageSignature.messageDigest.digest.length === 0) { + invalidValues.push('content.messageSignature.messageDigest.digest'); + } + } + if (b.content.messageSignature.signature.length === 0) { + invalidValues.push('content.messageSignature.signature'); + } + break; + case 'dsseEnvelope': + if (b.content.dsseEnvelope.payload.length === 0) { + invalidValues.push('content.dsseEnvelope.payload'); + } + if (b.content.dsseEnvelope.signatures.length !== 1) { + invalidValues.push('content.dsseEnvelope.signatures'); + } + else { + if (b.content.dsseEnvelope.signatures[0].sig.length === 0) { + invalidValues.push('content.dsseEnvelope.signatures[0].sig'); + } + } + break; + } + } + // Verification material-related validation + if (b.verificationMaterial === undefined) { + invalidValues.push('verificationMaterial'); + } + else { + if (b.verificationMaterial.content === undefined) { + invalidValues.push('verificationMaterial.content'); + } + else { + switch (b.verificationMaterial.content.$case) { + case 'x509CertificateChain': + if (b.verificationMaterial.content.x509CertificateChain.certificates + .length === 0) { + invalidValues.push('verificationMaterial.content.x509CertificateChain.certificates'); + } + b.verificationMaterial.content.x509CertificateChain.certificates.forEach((cert, i) => { + if (cert.rawBytes.length === 0) { + invalidValues.push(`verificationMaterial.content.x509CertificateChain.certificates[${i}].rawBytes`); + } + }); + break; + case 'certificate': + if (b.verificationMaterial.content.certificate.rawBytes.length === 0) { + invalidValues.push('verificationMaterial.content.certificate.rawBytes'); + } + break; + } + } + if (b.verificationMaterial.tlogEntries === undefined) { + invalidValues.push('verificationMaterial.tlogEntries'); + } + else { + if (b.verificationMaterial.tlogEntries.length > 0) { + b.verificationMaterial.tlogEntries.forEach((entry, i) => { + if (entry.logId === undefined) { + invalidValues.push(`verificationMaterial.tlogEntries[${i}].logId`); + } + if (entry.kindVersion === undefined) { + invalidValues.push(`verificationMaterial.tlogEntries[${i}].kindVersion`); + } + }); + } + } + } + return invalidValues; +} +// Necessary for V01 bundles +function validateInclusionPromise(b) { + const invalidValues = []; + if (b.verificationMaterial && + b.verificationMaterial.tlogEntries?.length > 0) { + b.verificationMaterial.tlogEntries.forEach((entry, i) => { + if (entry.inclusionPromise === undefined) { + invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionPromise`); + } + }); + } + return invalidValues; +} +// Necessary for V02 and later bundles +function validateInclusionProof(b) { + const invalidValues = []; + if (b.verificationMaterial && + b.verificationMaterial.tlogEntries?.length > 0) { + b.verificationMaterial.tlogEntries.forEach((entry, i) => { + if (entry.inclusionProof === undefined) { + invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionProof`); + } + else { + if (entry.inclusionProof.checkpoint === undefined) { + invalidValues.push(`verificationMaterial.tlogEntries[${i}].inclusionProof.checkpoint`); + } + } + }); + } + return invalidValues; +} +// Necessary for V03 and later bundles +function validateNoCertificateChain(b) { + const invalidValues = []; + /* istanbul ignore next */ + if (b.verificationMaterial?.content?.$case === 'x509CertificateChain') { + invalidValues.push('verificationMaterial.content.$case'); + } + return invalidValues; +} diff --git a/node_modules/npm/node_modules/@sigstore/bundle/package.json b/node_modules/npm/node_modules/@sigstore/bundle/package.json new file mode 100644 index 00000000..ee5d2b92 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/bundle/package.json @@ -0,0 +1,35 @@ +{ + "name": "@sigstore/bundle", + "version": "3.0.0", + "description": "Sigstore bundle type", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "clean": "shx rm -rf dist *.tsbuildinfo", + "build": "tsc --build", + "test": "jest" + }, + "files": [ + "dist", + "store" + ], + "author": "bdehamer@github.com", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/sigstore/sigstore-js.git" + }, + "bugs": { + "url": "https://github.com/sigstore/sigstore-js/issues" + }, + "homepage": "https://github.com/sigstore/sigstore-js/tree/main/packages/bundle#readme", + "publishConfig": { + "provenance": true + }, + "dependencies": { + "@sigstore/protobuf-specs": "^0.3.2" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } +} diff --git a/node_modules/npm/node_modules/@sigstore/core/LICENSE b/node_modules/npm/node_modules/@sigstore/core/LICENSE new file mode 100644 index 00000000..e9e7c167 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 The Sigstore Authors + + 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. diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/asn1/error.js b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/error.js new file mode 100644 index 00000000..17d93b0f --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/error.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ASN1TypeError = exports.ASN1ParseError = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +class ASN1ParseError extends Error { +} +exports.ASN1ParseError = ASN1ParseError; +class ASN1TypeError extends Error { +} +exports.ASN1TypeError = ASN1TypeError; diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/asn1/index.js b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/index.js new file mode 100644 index 00000000..348b2ea4 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/index.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ASN1Obj = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +var obj_1 = require("./obj"); +Object.defineProperty(exports, "ASN1Obj", { enumerable: true, get: function () { return obj_1.ASN1Obj; } }); diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/asn1/length.js b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/length.js new file mode 100644 index 00000000..cb7ebf09 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/length.js @@ -0,0 +1,62 @@ +"use strict"; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeLength = decodeLength; +exports.encodeLength = encodeLength; +const error_1 = require("./error"); +// Decodes the length of a DER-encoded ANS.1 element from the supplied stream. +// https://learn.microsoft.com/en-us/windows/win32/seccertenroll/about-encoded-length-and-value-bytes +function decodeLength(stream) { + const buf = stream.getUint8(); + // If the most significant bit is UNSET the length is just the value of the + // byte. + if ((buf & 0x80) === 0x00) { + return buf; + } + // Otherwise, the lower 7 bits of the first byte indicate the number of bytes + // that follow to encode the length. + const byteCount = buf & 0x7f; + // Ensure the encoded length can safely fit in a JS number. + if (byteCount > 6) { + throw new error_1.ASN1ParseError('length exceeds 6 byte limit'); + } + // Iterate over the bytes that encode the length. + let len = 0; + for (let i = 0; i < byteCount; i++) { + len = len * 256 + stream.getUint8(); + } + // This is a valid ASN.1 length encoding, but we don't support it. + if (len === 0) { + throw new error_1.ASN1ParseError('indefinite length encoding not supported'); + } + return len; +} +// Translates the supplied value to a DER-encoded length. +function encodeLength(len) { + if (len < 128) { + return Buffer.from([len]); + } + // Bitwise operations on large numbers are not supported in JS, so we need to + // use BigInts. + let val = BigInt(len); + const bytes = []; + while (val > 0n) { + bytes.unshift(Number(val & 255n)); + val = val >> 8n; + } + return Buffer.from([0x80 | bytes.length, ...bytes]); +} diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/asn1/obj.js b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/obj.js new file mode 100644 index 00000000..5f9ac9cd --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/obj.js @@ -0,0 +1,152 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ASN1Obj = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const stream_1 = require("../stream"); +const error_1 = require("./error"); +const length_1 = require("./length"); +const parse_1 = require("./parse"); +const tag_1 = require("./tag"); +class ASN1Obj { + constructor(tag, value, subs) { + this.tag = tag; + this.value = value; + this.subs = subs; + } + // Constructs an ASN.1 object from a Buffer of DER-encoded bytes. + static parseBuffer(buf) { + return parseStream(new stream_1.ByteStream(buf)); + } + toDER() { + const valueStream = new stream_1.ByteStream(); + if (this.subs.length > 0) { + for (const sub of this.subs) { + valueStream.appendView(sub.toDER()); + } + } + else { + valueStream.appendView(this.value); + } + const value = valueStream.buffer; + // Concat tag/length/value + const obj = new stream_1.ByteStream(); + obj.appendChar(this.tag.toDER()); + obj.appendView((0, length_1.encodeLength)(value.length)); + obj.appendView(value); + return obj.buffer; + } + ///////////////////////////////////////////////////////////////////////////// + // Convenience methods for parsing ASN.1 primitives into JS types + // Returns the ASN.1 object's value as a boolean. Throws an error if the + // object is not a boolean. + toBoolean() { + if (!this.tag.isBoolean()) { + throw new error_1.ASN1TypeError('not a boolean'); + } + return (0, parse_1.parseBoolean)(this.value); + } + // Returns the ASN.1 object's value as a BigInt. Throws an error if the + // object is not an integer. + toInteger() { + if (!this.tag.isInteger()) { + throw new error_1.ASN1TypeError('not an integer'); + } + return (0, parse_1.parseInteger)(this.value); + } + // Returns the ASN.1 object's value as an OID string. Throws an error if the + // object is not an OID. + toOID() { + if (!this.tag.isOID()) { + throw new error_1.ASN1TypeError('not an OID'); + } + return (0, parse_1.parseOID)(this.value); + } + // Returns the ASN.1 object's value as a Date. Throws an error if the object + // is not either a UTCTime or a GeneralizedTime. + toDate() { + switch (true) { + case this.tag.isUTCTime(): + return (0, parse_1.parseTime)(this.value, true); + case this.tag.isGeneralizedTime(): + return (0, parse_1.parseTime)(this.value, false); + default: + throw new error_1.ASN1TypeError('not a date'); + } + } + // Returns the ASN.1 object's value as a number[] where each number is the + // value of a bit in the bit string. Throws an error if the object is not a + // bit string. + toBitString() { + if (!this.tag.isBitString()) { + throw new error_1.ASN1TypeError('not a bit string'); + } + return (0, parse_1.parseBitString)(this.value); + } +} +exports.ASN1Obj = ASN1Obj; +///////////////////////////////////////////////////////////////////////////// +// Internal stream parsing functions +function parseStream(stream) { + // Parse tag, length, and value from stream + const tag = new tag_1.ASN1Tag(stream.getUint8()); + const len = (0, length_1.decodeLength)(stream); + const value = stream.slice(stream.position, len); + const start = stream.position; + let subs = []; + // If the object is constructed, parse its children. Sometimes, children + // are embedded in OCTESTRING objects, so we need to check those + // for children as well. + if (tag.constructed) { + subs = collectSubs(stream, len); + } + else if (tag.isOctetString()) { + // Attempt to parse children of OCTETSTRING objects. If anything fails, + // assume the object is not constructed and treat as primitive. + try { + subs = collectSubs(stream, len); + } + catch (e) { + // Fail silently and treat as primitive + } + } + // If there are no children, move stream cursor to the end of the object + if (subs.length === 0) { + stream.seek(start + len); + } + return new ASN1Obj(tag, value, subs); +} +function collectSubs(stream, len) { + // Calculate end of object content + const end = stream.position + len; + // Make sure there are enough bytes left in the stream. This should never + // happen, cause it'll get caught when the stream is sliced in parseStream. + // Leaving as an extra check just in case. + /* istanbul ignore if */ + if (end > stream.length) { + throw new error_1.ASN1ParseError('invalid length'); + } + // Parse all children + const subs = []; + while (stream.position < end) { + subs.push(parseStream(stream)); + } + // When we're done parsing children, we should be at the end of the object + if (stream.position !== end) { + throw new error_1.ASN1ParseError('invalid length'); + } + return subs; +} diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/asn1/parse.js b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/parse.js new file mode 100644 index 00000000..7fbb4263 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/parse.js @@ -0,0 +1,124 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseInteger = parseInteger; +exports.parseStringASCII = parseStringASCII; +exports.parseTime = parseTime; +exports.parseOID = parseOID; +exports.parseBoolean = parseBoolean; +exports.parseBitString = parseBitString; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const RE_TIME_SHORT_YEAR = /^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\.\d{3})?Z$/; +const RE_TIME_LONG_YEAR = /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\.\d{3})?Z$/; +// Parse a BigInt from the DER-encoded buffer +// https://learn.microsoft.com/en-us/windows/win32/seccertenroll/about-integer +function parseInteger(buf) { + let pos = 0; + const end = buf.length; + let val = buf[pos]; + const neg = val > 0x7f; + // Consume any padding bytes + const pad = neg ? 0xff : 0x00; + while (val == pad && ++pos < end) { + val = buf[pos]; + } + // Calculate remaining bytes to read + const len = end - pos; + if (len === 0) + return BigInt(neg ? -1 : 0); + // Handle two's complement for negative numbers + val = neg ? val - 256 : val; + // Parse remaining bytes + let n = BigInt(val); + for (let i = pos + 1; i < end; ++i) { + n = n * BigInt(256) + BigInt(buf[i]); + } + return n; +} +// Parse an ASCII string from the DER-encoded buffer +// https://learn.microsoft.com/en-us/windows/win32/seccertenroll/about-basic-types#boolean +function parseStringASCII(buf) { + return buf.toString('ascii'); +} +// Parse a Date from the DER-encoded buffer +// https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.5.1 +function parseTime(buf, shortYear) { + const timeStr = parseStringASCII(buf); + // Parse the time string into matches - captured groups start at index 1 + const m = shortYear + ? RE_TIME_SHORT_YEAR.exec(timeStr) + : RE_TIME_LONG_YEAR.exec(timeStr); + if (!m) { + throw new Error('invalid time'); + } + // Translate dates with a 2-digit year to 4 digits per the spec + if (shortYear) { + let year = Number(m[1]); + year += year >= 50 ? 1900 : 2000; + m[1] = year.toString(); + } + // Translate to ISO8601 format and parse + return new Date(`${m[1]}-${m[2]}-${m[3]}T${m[4]}:${m[5]}:${m[6]}Z`); +} +// Parse an OID from the DER-encoded buffer +// https://learn.microsoft.com/en-us/windows/win32/seccertenroll/about-object-identifier +function parseOID(buf) { + let pos = 0; + const end = buf.length; + // Consume first byte which encodes the first two OID components + let n = buf[pos++]; + const first = Math.floor(n / 40); + const second = n % 40; + let oid = `${first}.${second}`; + // Consume remaining bytes + let val = 0; + for (; pos < end; ++pos) { + n = buf[pos]; + val = (val << 7) + (n & 0x7f); + // If the left-most bit is NOT set, then this is the last byte in the + // sequence and we can add the value to the OID and reset the accumulator + if ((n & 0x80) === 0) { + oid += `.${val}`; + val = 0; + } + } + return oid; +} +// Parse a boolean from the DER-encoded buffer +// https://learn.microsoft.com/en-us/windows/win32/seccertenroll/about-basic-types#boolean +function parseBoolean(buf) { + return buf[0] !== 0; +} +// Parse a bit string from the DER-encoded buffer +// https://learn.microsoft.com/en-us/windows/win32/seccertenroll/about-bit-string +function parseBitString(buf) { + // First byte tell us how many unused bits are in the last byte + const unused = buf[0]; + const start = 1; + const end = buf.length; + const bits = []; + for (let i = start; i < end; ++i) { + const byte = buf[i]; + // The skip value is only used for the last byte + const skip = i === end - 1 ? unused : 0; + // Iterate over each bit in the byte (most significant first) + for (let j = 7; j >= skip; --j) { + // Read the bit and add it to the bit string + bits.push((byte >> j) & 0x01); + } + } + return bits; +} diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/asn1/tag.js b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/tag.js new file mode 100644 index 00000000..84dd938d --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/asn1/tag.js @@ -0,0 +1,86 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ASN1Tag = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const error_1 = require("./error"); +const UNIVERSAL_TAG = { + BOOLEAN: 0x01, + INTEGER: 0x02, + BIT_STRING: 0x03, + OCTET_STRING: 0x04, + OBJECT_IDENTIFIER: 0x06, + SEQUENCE: 0x10, + SET: 0x11, + PRINTABLE_STRING: 0x13, + UTC_TIME: 0x17, + GENERALIZED_TIME: 0x18, +}; +const TAG_CLASS = { + UNIVERSAL: 0x00, + APPLICATION: 0x01, + CONTEXT_SPECIFIC: 0x02, + PRIVATE: 0x03, +}; +// https://learn.microsoft.com/en-us/windows/win32/seccertenroll/about-encoded-tag-bytes +class ASN1Tag { + constructor(enc) { + // Bits 0 through 4 are the tag number + this.number = enc & 0x1f; + // Bit 5 is the constructed bit + this.constructed = (enc & 0x20) === 0x20; + // Bit 6 & 7 are the class + this.class = enc >> 6; + if (this.number === 0x1f) { + throw new error_1.ASN1ParseError('long form tags not supported'); + } + if (this.class === TAG_CLASS.UNIVERSAL && this.number === 0x00) { + throw new error_1.ASN1ParseError('unsupported tag 0x00'); + } + } + isUniversal() { + return this.class === TAG_CLASS.UNIVERSAL; + } + isContextSpecific(num) { + const res = this.class === TAG_CLASS.CONTEXT_SPECIFIC; + return num !== undefined ? res && this.number === num : res; + } + isBoolean() { + return this.isUniversal() && this.number === UNIVERSAL_TAG.BOOLEAN; + } + isInteger() { + return this.isUniversal() && this.number === UNIVERSAL_TAG.INTEGER; + } + isBitString() { + return this.isUniversal() && this.number === UNIVERSAL_TAG.BIT_STRING; + } + isOctetString() { + return this.isUniversal() && this.number === UNIVERSAL_TAG.OCTET_STRING; + } + isOID() { + return (this.isUniversal() && this.number === UNIVERSAL_TAG.OBJECT_IDENTIFIER); + } + isUTCTime() { + return this.isUniversal() && this.number === UNIVERSAL_TAG.UTC_TIME; + } + isGeneralizedTime() { + return this.isUniversal() && this.number === UNIVERSAL_TAG.GENERALIZED_TIME; + } + toDER() { + return this.number | (this.constructed ? 0x20 : 0x00) | (this.class << 6); + } +} +exports.ASN1Tag = ASN1Tag; diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/crypto.js b/node_modules/npm/node_modules/@sigstore/core/dist/crypto.js new file mode 100644 index 00000000..296b5ba4 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/crypto.js @@ -0,0 +1,60 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createPublicKey = createPublicKey; +exports.digest = digest; +exports.verify = verify; +exports.bufferEqual = bufferEqual; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const crypto_1 = __importDefault(require("crypto")); +function createPublicKey(key, type = 'spki') { + if (typeof key === 'string') { + return crypto_1.default.createPublicKey(key); + } + else { + return crypto_1.default.createPublicKey({ key, format: 'der', type: type }); + } +} +function digest(algorithm, ...data) { + const hash = crypto_1.default.createHash(algorithm); + for (const d of data) { + hash.update(d); + } + return hash.digest(); +} +function verify(data, key, signature, algorithm) { + // The try/catch is to work around an issue in Node 14.x where verify throws + // an error in some scenarios if the signature is invalid. + try { + return crypto_1.default.verify(algorithm, data, key, signature); + } + catch (e) { + /* istanbul ignore next */ + return false; + } +} +function bufferEqual(a, b) { + try { + return crypto_1.default.timingSafeEqual(a, b); + } + catch { + /* istanbul ignore next */ + return false; + } +} diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/dsse.js b/node_modules/npm/node_modules/@sigstore/core/dist/dsse.js new file mode 100644 index 00000000..ca7b6363 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/dsse.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.preAuthEncoding = preAuthEncoding; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const PAE_PREFIX = 'DSSEv1'; +// DSSE Pre-Authentication Encoding +function preAuthEncoding(payloadType, payload) { + const prefix = [ + PAE_PREFIX, + payloadType.length, + payloadType, + payload.length, + '', + ].join(' '); + return Buffer.concat([Buffer.from(prefix, 'ascii'), payload]); +} diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/encoding.js b/node_modules/npm/node_modules/@sigstore/core/dist/encoding.js new file mode 100644 index 00000000..7113af66 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/encoding.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.base64Encode = base64Encode; +exports.base64Decode = base64Decode; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const BASE64_ENCODING = 'base64'; +const UTF8_ENCODING = 'utf-8'; +function base64Encode(str) { + return Buffer.from(str, UTF8_ENCODING).toString(BASE64_ENCODING); +} +function base64Decode(str) { + return Buffer.from(str, BASE64_ENCODING).toString(UTF8_ENCODING); +} diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/index.js b/node_modules/npm/node_modules/@sigstore/core/dist/index.js new file mode 100644 index 00000000..ac35e86a --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/index.js @@ -0,0 +1,56 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.X509SCTExtension = exports.X509Certificate = exports.EXTENSION_OID_SCT = exports.ByteStream = exports.RFC3161Timestamp = exports.pem = exports.json = exports.encoding = exports.dsse = exports.crypto = exports.ASN1Obj = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +var asn1_1 = require("./asn1"); +Object.defineProperty(exports, "ASN1Obj", { enumerable: true, get: function () { return asn1_1.ASN1Obj; } }); +exports.crypto = __importStar(require("./crypto")); +exports.dsse = __importStar(require("./dsse")); +exports.encoding = __importStar(require("./encoding")); +exports.json = __importStar(require("./json")); +exports.pem = __importStar(require("./pem")); +var rfc3161_1 = require("./rfc3161"); +Object.defineProperty(exports, "RFC3161Timestamp", { enumerable: true, get: function () { return rfc3161_1.RFC3161Timestamp; } }); +var stream_1 = require("./stream"); +Object.defineProperty(exports, "ByteStream", { enumerable: true, get: function () { return stream_1.ByteStream; } }); +var x509_1 = require("./x509"); +Object.defineProperty(exports, "EXTENSION_OID_SCT", { enumerable: true, get: function () { return x509_1.EXTENSION_OID_SCT; } }); +Object.defineProperty(exports, "X509Certificate", { enumerable: true, get: function () { return x509_1.X509Certificate; } }); +Object.defineProperty(exports, "X509SCTExtension", { enumerable: true, get: function () { return x509_1.X509SCTExtension; } }); diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/json.js b/node_modules/npm/node_modules/@sigstore/core/dist/json.js new file mode 100644 index 00000000..7808d033 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/json.js @@ -0,0 +1,60 @@ +"use strict"; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.canonicalize = canonicalize; +// JSON canonicalization per https://github.com/cyberphone/json-canonicalization +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function canonicalize(object) { + let buffer = ''; + if (object === null || typeof object !== 'object' || object.toJSON != null) { + // Primitives or toJSONable objects + buffer += JSON.stringify(object); + } + else if (Array.isArray(object)) { + // Array - maintain element order + buffer += '['; + let first = true; + object.forEach((element) => { + if (!first) { + buffer += ','; + } + first = false; + // recursive call + buffer += canonicalize(element); + }); + buffer += ']'; + } + else { + // Object - Sort properties before serializing + buffer += '{'; + let first = true; + Object.keys(object) + .sort() + .forEach((property) => { + if (!first) { + buffer += ','; + } + first = false; + buffer += JSON.stringify(property); + buffer += ':'; + // recursive call + buffer += canonicalize(object[property]); + }); + buffer += '}'; + } + return buffer; +} diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/oid.js b/node_modules/npm/node_modules/@sigstore/core/dist/oid.js new file mode 100644 index 00000000..ac7a6430 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/oid.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SHA2_HASH_ALGOS = exports.ECDSA_SIGNATURE_ALGOS = void 0; +exports.ECDSA_SIGNATURE_ALGOS = { + '1.2.840.10045.4.3.1': 'sha224', + '1.2.840.10045.4.3.2': 'sha256', + '1.2.840.10045.4.3.3': 'sha384', + '1.2.840.10045.4.3.4': 'sha512', +}; +exports.SHA2_HASH_ALGOS = { + '2.16.840.1.101.3.4.2.1': 'sha256', + '2.16.840.1.101.3.4.2.2': 'sha384', + '2.16.840.1.101.3.4.2.3': 'sha512', +}; diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/pem.js b/node_modules/npm/node_modules/@sigstore/core/dist/pem.js new file mode 100644 index 00000000..f1241d28 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/pem.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toDER = toDER; +exports.fromDER = fromDER; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const PEM_HEADER = /-----BEGIN (.*)-----/; +const PEM_FOOTER = /-----END (.*)-----/; +function toDER(certificate) { + let der = ''; + certificate.split('\n').forEach((line) => { + if (line.match(PEM_HEADER) || line.match(PEM_FOOTER)) { + return; + } + der += line; + }); + return Buffer.from(der, 'base64'); +} +// Translates a DER-encoded buffer into a PEM-encoded string. Standard PEM +// encoding dictates that each certificate should have a trailing newline after +// the footer. +function fromDER(certificate, type = 'CERTIFICATE') { + // Base64-encode the certificate. + const der = certificate.toString('base64'); + // Split the certificate into lines of 64 characters. + const lines = der.match(/.{1,64}/g) || ''; + return [`-----BEGIN ${type}-----`, ...lines, `-----END ${type}-----`] + .join('\n') + .concat('\n'); +} diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/error.js b/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/error.js new file mode 100644 index 00000000..b9b549b0 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/error.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RFC3161TimestampVerificationError = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +class RFC3161TimestampVerificationError extends Error { +} +exports.RFC3161TimestampVerificationError = RFC3161TimestampVerificationError; diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/index.js b/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/index.js new file mode 100644 index 00000000..b77ecf1c --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/index.js @@ -0,0 +1,20 @@ +"use strict"; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RFC3161Timestamp = void 0; +var timestamp_1 = require("./timestamp"); +Object.defineProperty(exports, "RFC3161Timestamp", { enumerable: true, get: function () { return timestamp_1.RFC3161Timestamp; } }); diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/timestamp.js b/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/timestamp.js new file mode 100644 index 00000000..3e61fc1a --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/timestamp.js @@ -0,0 +1,201 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RFC3161Timestamp = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const asn1_1 = require("../asn1"); +const crypto = __importStar(require("../crypto")); +const oid_1 = require("../oid"); +const error_1 = require("./error"); +const tstinfo_1 = require("./tstinfo"); +const OID_PKCS9_CONTENT_TYPE_SIGNED_DATA = '1.2.840.113549.1.7.2'; +const OID_PKCS9_CONTENT_TYPE_TSTINFO = '1.2.840.113549.1.9.16.1.4'; +const OID_PKCS9_MESSAGE_DIGEST_KEY = '1.2.840.113549.1.9.4'; +class RFC3161Timestamp { + constructor(asn1) { + this.root = asn1; + } + static parse(der) { + const asn1 = asn1_1.ASN1Obj.parseBuffer(der); + return new RFC3161Timestamp(asn1); + } + get status() { + return this.pkiStatusInfoObj.subs[0].toInteger(); + } + get contentType() { + return this.contentTypeObj.toOID(); + } + get eContentType() { + return this.eContentTypeObj.toOID(); + } + get signingTime() { + return this.tstInfo.genTime; + } + get signerIssuer() { + return this.signerSidObj.subs[0].value; + } + get signerSerialNumber() { + return this.signerSidObj.subs[1].value; + } + get signerDigestAlgorithm() { + const oid = this.signerDigestAlgorithmObj.subs[0].toOID(); + return oid_1.SHA2_HASH_ALGOS[oid]; + } + get signatureAlgorithm() { + const oid = this.signatureAlgorithmObj.subs[0].toOID(); + return oid_1.ECDSA_SIGNATURE_ALGOS[oid]; + } + get signatureValue() { + return this.signatureValueObj.value; + } + get tstInfo() { + // Need to unpack tstInfo from an OCTET STRING + return new tstinfo_1.TSTInfo(this.eContentObj.subs[0].subs[0]); + } + verify(data, publicKey) { + if (!this.timeStampTokenObj) { + throw new error_1.RFC3161TimestampVerificationError('timeStampToken is missing'); + } + // Check for expected ContentInfo content type + if (this.contentType !== OID_PKCS9_CONTENT_TYPE_SIGNED_DATA) { + throw new error_1.RFC3161TimestampVerificationError(`incorrect content type: ${this.contentType}`); + } + // Check for expected encapsulated content type + if (this.eContentType !== OID_PKCS9_CONTENT_TYPE_TSTINFO) { + throw new error_1.RFC3161TimestampVerificationError(`incorrect encapsulated content type: ${this.eContentType}`); + } + // Check that the tstInfo references the correct artifact + this.tstInfo.verify(data); + // Check that the signed message digest matches the tstInfo + this.verifyMessageDigest(); + // Check that the signature is valid for the signed attributes + this.verifySignature(publicKey); + } + verifyMessageDigest() { + // Check that the tstInfo matches the signed data + const tstInfoDigest = crypto.digest(this.signerDigestAlgorithm, this.tstInfo.raw); + const expectedDigest = this.messageDigestAttributeObj.subs[1].subs[0].value; + if (!crypto.bufferEqual(tstInfoDigest, expectedDigest)) { + throw new error_1.RFC3161TimestampVerificationError('signed data does not match tstInfo'); + } + } + verifySignature(key) { + // Encode the signed attributes for verification + const signedAttrs = this.signedAttrsObj.toDER(); + signedAttrs[0] = 0x31; // Change context-specific tag to SET + // Check that the signature is valid for the signed attributes + const verified = crypto.verify(signedAttrs, key, this.signatureValue, this.signatureAlgorithm); + if (!verified) { + throw new error_1.RFC3161TimestampVerificationError('signature verification failed'); + } + } + // https://www.rfc-editor.org/rfc/rfc3161#section-2.4.2 + get pkiStatusInfoObj() { + // pkiStatusInfo is the first element of the timestamp response sequence + return this.root.subs[0]; + } + // https://www.rfc-editor.org/rfc/rfc3161#section-2.4.2 + get timeStampTokenObj() { + // timeStampToken is the first element of the timestamp response sequence + return this.root.subs[1]; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-3 + get contentTypeObj() { + return this.timeStampTokenObj.subs[0]; + } + // https://www.rfc-editor.org/rfc/rfc5652#section-3 + get signedDataObj() { + const obj = this.timeStampTokenObj.subs.find((sub) => sub.tag.isContextSpecific(0x00)); + return obj.subs[0]; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-5.1 + get encapContentInfoObj() { + return this.signedDataObj.subs[2]; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-5.1 + get signerInfosObj() { + // SignerInfos is the last element of the signed data sequence + const sd = this.signedDataObj; + return sd.subs[sd.subs.length - 1]; + } + // https://www.rfc-editor.org/rfc/rfc5652#section-5.1 + get signerInfoObj() { + // Only supporting one signer + return this.signerInfosObj.subs[0]; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-5.2 + get eContentTypeObj() { + return this.encapContentInfoObj.subs[0]; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-5.2 + get eContentObj() { + return this.encapContentInfoObj.subs[1]; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-5.3 + get signedAttrsObj() { + const signedAttrs = this.signerInfoObj.subs.find((sub) => sub.tag.isContextSpecific(0x00)); + return signedAttrs; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-5.3 + get messageDigestAttributeObj() { + const messageDigest = this.signedAttrsObj.subs.find((sub) => sub.subs[0].tag.isOID() && + sub.subs[0].toOID() === OID_PKCS9_MESSAGE_DIGEST_KEY); + return messageDigest; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-5.3 + get signerSidObj() { + return this.signerInfoObj.subs[1]; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-5.3 + get signerDigestAlgorithmObj() { + // Signature is the 2nd element of the signerInfoObj object + return this.signerInfoObj.subs[2]; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-5.3 + get signatureAlgorithmObj() { + // Signature is the 4th element of the signerInfoObj object + return this.signerInfoObj.subs[4]; + } + // https://datatracker.ietf.org/doc/html/rfc5652#section-5.3 + get signatureValueObj() { + // Signature is the 6th element of the signerInfoObj object + return this.signerInfoObj.subs[5]; + } +} +exports.RFC3161Timestamp = RFC3161Timestamp; diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js b/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js new file mode 100644 index 00000000..dc8e4fb3 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js @@ -0,0 +1,61 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TSTInfo = void 0; +const crypto = __importStar(require("../crypto")); +const oid_1 = require("../oid"); +const error_1 = require("./error"); +class TSTInfo { + constructor(asn1) { + this.root = asn1; + } + get version() { + return this.root.subs[0].toInteger(); + } + get genTime() { + return this.root.subs[4].toDate(); + } + get messageImprintHashAlgorithm() { + const oid = this.messageImprintObj.subs[0].subs[0].toOID(); + return oid_1.SHA2_HASH_ALGOS[oid]; + } + get messageImprintHashedMessage() { + return this.messageImprintObj.subs[1].value; + } + get raw() { + return this.root.toDER(); + } + verify(data) { + const digest = crypto.digest(this.messageImprintHashAlgorithm, data); + if (!crypto.bufferEqual(digest, this.messageImprintHashedMessage)) { + throw new error_1.RFC3161TimestampVerificationError('message imprint does not match artifact'); + } + } + // https://www.rfc-editor.org/rfc/rfc3161#section-2.4.2 + get messageImprintObj() { + return this.root.subs[2]; + } +} +exports.TSTInfo = TSTInfo; diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/stream.js b/node_modules/npm/node_modules/@sigstore/core/dist/stream.js new file mode 100644 index 00000000..0a24f858 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/stream.js @@ -0,0 +1,115 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ByteStream = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +class StreamError extends Error { +} +class ByteStream { + constructor(buffer) { + this.start = 0; + if (buffer) { + this.buf = buffer; + this.view = Buffer.from(buffer); + } + else { + this.buf = new ArrayBuffer(0); + this.view = Buffer.from(this.buf); + } + } + get buffer() { + return this.view.subarray(0, this.start); + } + get length() { + return this.view.byteLength; + } + get position() { + return this.start; + } + seek(position) { + this.start = position; + } + // Returns a Buffer containing the specified number of bytes starting at the + // given start position. + slice(start, len) { + const end = start + len; + if (end > this.length) { + throw new StreamError('request past end of buffer'); + } + return this.view.subarray(start, end); + } + appendChar(char) { + this.ensureCapacity(1); + this.view[this.start] = char; + this.start += 1; + } + appendUint16(num) { + this.ensureCapacity(2); + const value = new Uint16Array([num]); + const view = new Uint8Array(value.buffer); + this.view[this.start] = view[1]; + this.view[this.start + 1] = view[0]; + this.start += 2; + } + appendUint24(num) { + this.ensureCapacity(3); + const value = new Uint32Array([num]); + const view = new Uint8Array(value.buffer); + this.view[this.start] = view[2]; + this.view[this.start + 1] = view[1]; + this.view[this.start + 2] = view[0]; + this.start += 3; + } + appendView(view) { + this.ensureCapacity(view.length); + this.view.set(view, this.start); + this.start += view.length; + } + getBlock(size) { + if (size <= 0) { + return Buffer.alloc(0); + } + if (this.start + size > this.view.length) { + throw new Error('request past end of buffer'); + } + const result = this.view.subarray(this.start, this.start + size); + this.start += size; + return result; + } + getUint8() { + return this.getBlock(1)[0]; + } + getUint16() { + const block = this.getBlock(2); + return (block[0] << 8) | block[1]; + } + ensureCapacity(size) { + if (this.start + size > this.view.byteLength) { + const blockSize = ByteStream.BLOCK_SIZE + (size > ByteStream.BLOCK_SIZE ? size : 0); + this.realloc(this.view.byteLength + blockSize); + } + } + realloc(size) { + const newArray = new ArrayBuffer(size); + const newView = Buffer.from(newArray); + // Copy the old buffer into the new one + newView.set(this.view); + this.buf = newArray; + this.view = newView; + } +} +exports.ByteStream = ByteStream; +ByteStream.BLOCK_SIZE = 1024; diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/x509/cert.js b/node_modules/npm/node_modules/@sigstore/core/dist/x509/cert.js new file mode 100644 index 00000000..72ea8e07 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/x509/cert.js @@ -0,0 +1,230 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.X509Certificate = exports.EXTENSION_OID_SCT = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const asn1_1 = require("../asn1"); +const crypto = __importStar(require("../crypto")); +const oid_1 = require("../oid"); +const pem = __importStar(require("../pem")); +const ext_1 = require("./ext"); +const EXTENSION_OID_SUBJECT_KEY_ID = '2.5.29.14'; +const EXTENSION_OID_KEY_USAGE = '2.5.29.15'; +const EXTENSION_OID_SUBJECT_ALT_NAME = '2.5.29.17'; +const EXTENSION_OID_BASIC_CONSTRAINTS = '2.5.29.19'; +const EXTENSION_OID_AUTHORITY_KEY_ID = '2.5.29.35'; +exports.EXTENSION_OID_SCT = '1.3.6.1.4.1.11129.2.4.2'; +class X509Certificate { + constructor(asn1) { + this.root = asn1; + } + static parse(cert) { + const der = typeof cert === 'string' ? pem.toDER(cert) : cert; + const asn1 = asn1_1.ASN1Obj.parseBuffer(der); + return new X509Certificate(asn1); + } + get tbsCertificate() { + return this.tbsCertificateObj; + } + get version() { + // version number is the first element of the version context specific tag + const ver = this.versionObj.subs[0].toInteger(); + return `v${(ver + BigInt(1)).toString()}`; + } + get serialNumber() { + return this.serialNumberObj.value; + } + get notBefore() { + // notBefore is the first element of the validity sequence + return this.validityObj.subs[0].toDate(); + } + get notAfter() { + // notAfter is the second element of the validity sequence + return this.validityObj.subs[1].toDate(); + } + get issuer() { + return this.issuerObj.value; + } + get subject() { + return this.subjectObj.value; + } + get publicKey() { + return this.subjectPublicKeyInfoObj.toDER(); + } + get signatureAlgorithm() { + const oid = this.signatureAlgorithmObj.subs[0].toOID(); + return oid_1.ECDSA_SIGNATURE_ALGOS[oid]; + } + get signatureValue() { + // Signature value is a bit string, so we need to skip the first byte + return this.signatureValueObj.value.subarray(1); + } + get subjectAltName() { + const ext = this.extSubjectAltName; + return ext?.uri || /* istanbul ignore next */ ext?.rfc822Name; + } + get extensions() { + // The extension list is the first (and only) element of the extensions + // context specific tag + /* istanbul ignore next */ + const extSeq = this.extensionsObj?.subs[0]; + /* istanbul ignore next */ + return extSeq?.subs || []; + } + get extKeyUsage() { + const ext = this.findExtension(EXTENSION_OID_KEY_USAGE); + return ext ? new ext_1.X509KeyUsageExtension(ext) : undefined; + } + get extBasicConstraints() { + const ext = this.findExtension(EXTENSION_OID_BASIC_CONSTRAINTS); + return ext ? new ext_1.X509BasicConstraintsExtension(ext) : undefined; + } + get extSubjectAltName() { + const ext = this.findExtension(EXTENSION_OID_SUBJECT_ALT_NAME); + return ext ? new ext_1.X509SubjectAlternativeNameExtension(ext) : undefined; + } + get extAuthorityKeyID() { + const ext = this.findExtension(EXTENSION_OID_AUTHORITY_KEY_ID); + return ext ? new ext_1.X509AuthorityKeyIDExtension(ext) : undefined; + } + get extSubjectKeyID() { + const ext = this.findExtension(EXTENSION_OID_SUBJECT_KEY_ID); + return ext + ? new ext_1.X509SubjectKeyIDExtension(ext) + : /* istanbul ignore next */ undefined; + } + get extSCT() { + const ext = this.findExtension(exports.EXTENSION_OID_SCT); + return ext ? new ext_1.X509SCTExtension(ext) : undefined; + } + get isCA() { + const ca = this.extBasicConstraints?.isCA || false; + // If the KeyUsage extension is present, keyCertSign must be set + if (this.extKeyUsage) { + return ca && this.extKeyUsage.keyCertSign; + } + // TODO: test coverage for this case + /* istanbul ignore next */ + return ca; + } + extension(oid) { + const ext = this.findExtension(oid); + return ext ? new ext_1.X509Extension(ext) : undefined; + } + verify(issuerCertificate) { + // Use the issuer's public key if provided, otherwise use the subject's + const publicKey = issuerCertificate?.publicKey || this.publicKey; + const key = crypto.createPublicKey(publicKey); + return crypto.verify(this.tbsCertificate.toDER(), key, this.signatureValue, this.signatureAlgorithm); + } + validForDate(date) { + return this.notBefore <= date && date <= this.notAfter; + } + equals(other) { + return this.root.toDER().equals(other.root.toDER()); + } + // Creates a copy of the certificate with a new buffer + clone() { + const der = this.root.toDER(); + const clone = Buffer.alloc(der.length); + der.copy(clone); + return X509Certificate.parse(clone); + } + findExtension(oid) { + // Find the extension with the given OID. The OID will always be the first + // element of the extension sequence + return this.extensions.find((ext) => ext.subs[0].toOID() === oid); + } + ///////////////////////////////////////////////////////////////////////////// + // The following properties use the documented x509 structure to locate the + // desired ASN.1 object + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1 + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1.1.1 + get tbsCertificateObj() { + // tbsCertificate is the first element of the certificate sequence + return this.root.subs[0]; + } + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1.1.2 + get signatureAlgorithmObj() { + // signatureAlgorithm is the second element of the certificate sequence + return this.root.subs[1]; + } + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1.1.3 + get signatureValueObj() { + // signatureValue is the third element of the certificate sequence + return this.root.subs[2]; + } + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.1 + get versionObj() { + // version is the first element of the tbsCertificate sequence + return this.tbsCertificateObj.subs[0]; + } + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.2 + get serialNumberObj() { + // serialNumber is the second element of the tbsCertificate sequence + return this.tbsCertificateObj.subs[1]; + } + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.4 + get issuerObj() { + // issuer is the fourth element of the tbsCertificate sequence + return this.tbsCertificateObj.subs[3]; + } + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.5 + get validityObj() { + // version is the fifth element of the tbsCertificate sequence + return this.tbsCertificateObj.subs[4]; + } + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.6 + get subjectObj() { + // subject is the sixth element of the tbsCertificate sequence + return this.tbsCertificateObj.subs[5]; + } + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.7 + get subjectPublicKeyInfoObj() { + // subjectPublicKeyInfo is the seventh element of the tbsCertificate sequence + return this.tbsCertificateObj.subs[6]; + } + // Extensions can't be located by index because their position varies. Instead, + // we need to find the extensions context specific tag + // https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.9 + get extensionsObj() { + return this.tbsCertificateObj.subs.find((sub) => sub.tag.isContextSpecific(0x03)); + } +} +exports.X509Certificate = X509Certificate; diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/x509/ext.js b/node_modules/npm/node_modules/@sigstore/core/dist/x509/ext.js new file mode 100644 index 00000000..1d481261 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/x509/ext.js @@ -0,0 +1,145 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.X509SCTExtension = exports.X509SubjectKeyIDExtension = exports.X509AuthorityKeyIDExtension = exports.X509SubjectAlternativeNameExtension = exports.X509KeyUsageExtension = exports.X509BasicConstraintsExtension = exports.X509Extension = void 0; +const stream_1 = require("../stream"); +const sct_1 = require("./sct"); +// https://www.rfc-editor.org/rfc/rfc5280#section-4.1 +class X509Extension { + constructor(asn1) { + this.root = asn1; + } + get oid() { + return this.root.subs[0].toOID(); + } + get critical() { + // The critical field is optional and will be the second element of the + // extension sequence if present. Default to false if not present. + return this.root.subs.length === 3 ? this.root.subs[1].toBoolean() : false; + } + get value() { + return this.extnValueObj.value; + } + get valueObj() { + return this.extnValueObj; + } + get extnValueObj() { + // The extnValue field will be the last element of the extension sequence + return this.root.subs[this.root.subs.length - 1]; + } +} +exports.X509Extension = X509Extension; +// https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.9 +class X509BasicConstraintsExtension extends X509Extension { + get isCA() { + return this.sequence.subs[0]?.toBoolean() ?? false; + } + get pathLenConstraint() { + return this.sequence.subs.length > 1 + ? this.sequence.subs[1].toInteger() + : undefined; + } + // The extnValue field contains a single sequence wrapping the isCA and + // pathLenConstraint. + get sequence() { + return this.extnValueObj.subs[0]; + } +} +exports.X509BasicConstraintsExtension = X509BasicConstraintsExtension; +// https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.3 +class X509KeyUsageExtension extends X509Extension { + get digitalSignature() { + return this.bitString[0] === 1; + } + get keyCertSign() { + return this.bitString[5] === 1; + } + get crlSign() { + return this.bitString[6] === 1; + } + // The extnValue field contains a single bit string which is a bit mask + // indicating which key usages are enabled. + get bitString() { + return this.extnValueObj.subs[0].toBitString(); + } +} +exports.X509KeyUsageExtension = X509KeyUsageExtension; +// https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.6 +class X509SubjectAlternativeNameExtension extends X509Extension { + get rfc822Name() { + return this.findGeneralName(0x01)?.value.toString('ascii'); + } + get uri() { + return this.findGeneralName(0x06)?.value.toString('ascii'); + } + // Retrieve the value of an otherName with the given OID. + otherName(oid) { + const otherName = this.findGeneralName(0x00); + if (otherName === undefined) { + return undefined; + } + // The otherName is a sequence containing an OID and a value. + // Need to check that the OID matches the one we're looking for. + const otherNameOID = otherName.subs[0].toOID(); + if (otherNameOID !== oid) { + return undefined; + } + // The otherNameValue is a sequence containing the actual value. + const otherNameValue = otherName.subs[1]; + return otherNameValue.subs[0].value.toString('ascii'); + } + findGeneralName(tag) { + return this.generalNames.find((gn) => gn.tag.isContextSpecific(tag)); + } + // The extnValue field contains a sequence of GeneralNames. + get generalNames() { + return this.extnValueObj.subs[0].subs; + } +} +exports.X509SubjectAlternativeNameExtension = X509SubjectAlternativeNameExtension; +// https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.1 +class X509AuthorityKeyIDExtension extends X509Extension { + get keyIdentifier() { + return this.findSequenceMember(0x00)?.value; + } + findSequenceMember(tag) { + return this.sequence.subs.find((el) => el.tag.isContextSpecific(tag)); + } + // The extnValue field contains a single sequence wrapping the keyIdentifier + get sequence() { + return this.extnValueObj.subs[0]; + } +} +exports.X509AuthorityKeyIDExtension = X509AuthorityKeyIDExtension; +// https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.2 +class X509SubjectKeyIDExtension extends X509Extension { + get keyIdentifier() { + return this.extnValueObj.subs[0].value; + } +} +exports.X509SubjectKeyIDExtension = X509SubjectKeyIDExtension; +// https://www.rfc-editor.org/rfc/rfc6962#section-3.3 +class X509SCTExtension extends X509Extension { + constructor(asn1) { + super(asn1); + } + get signedCertificateTimestamps() { + const buf = this.extnValueObj.subs[0].value; + const stream = new stream_1.ByteStream(buf); + // The overall list length is encoded in the first two bytes -- note this + // is the length of the list in bytes, NOT the number of SCTs in the list + const end = stream.getUint16() + 2; + const sctList = []; + while (stream.position < end) { + // Read the length of the next SCT + const sctLength = stream.getUint16(); + // Slice out the bytes for the next SCT and parse it + const sct = stream.getBlock(sctLength); + sctList.push(sct_1.SignedCertificateTimestamp.parse(sct)); + } + if (stream.position !== end) { + throw new Error('SCT list length does not match actual length'); + } + return sctList; + } +} +exports.X509SCTExtension = X509SCTExtension; diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/x509/index.js b/node_modules/npm/node_modules/@sigstore/core/dist/x509/index.js new file mode 100644 index 00000000..cdd77e58 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/x509/index.js @@ -0,0 +1,23 @@ +"use strict"; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.X509SCTExtension = exports.X509Certificate = exports.EXTENSION_OID_SCT = void 0; +var cert_1 = require("./cert"); +Object.defineProperty(exports, "EXTENSION_OID_SCT", { enumerable: true, get: function () { return cert_1.EXTENSION_OID_SCT; } }); +Object.defineProperty(exports, "X509Certificate", { enumerable: true, get: function () { return cert_1.X509Certificate; } }); +var ext_1 = require("./ext"); +Object.defineProperty(exports, "X509SCTExtension", { enumerable: true, get: function () { return ext_1.X509SCTExtension; } }); diff --git a/node_modules/npm/node_modules/@sigstore/core/dist/x509/sct.js b/node_modules/npm/node_modules/@sigstore/core/dist/x509/sct.js new file mode 100644 index 00000000..1603059c --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/dist/x509/sct.js @@ -0,0 +1,141 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SignedCertificateTimestamp = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const crypto = __importStar(require("../crypto")); +const stream_1 = require("../stream"); +class SignedCertificateTimestamp { + constructor(options) { + this.version = options.version; + this.logID = options.logID; + this.timestamp = options.timestamp; + this.extensions = options.extensions; + this.hashAlgorithm = options.hashAlgorithm; + this.signatureAlgorithm = options.signatureAlgorithm; + this.signature = options.signature; + } + get datetime() { + return new Date(Number(this.timestamp.readBigInt64BE())); + } + // Returns the hash algorithm used to generate the SCT's signature. + // https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.4.1 + get algorithm() { + switch (this.hashAlgorithm) { + /* istanbul ignore next */ + case 0: + return 'none'; + /* istanbul ignore next */ + case 1: + return 'md5'; + /* istanbul ignore next */ + case 2: + return 'sha1'; + /* istanbul ignore next */ + case 3: + return 'sha224'; + case 4: + return 'sha256'; + /* istanbul ignore next */ + case 5: + return 'sha384'; + /* istanbul ignore next */ + case 6: + return 'sha512'; + /* istanbul ignore next */ + default: + return 'unknown'; + } + } + verify(preCert, key) { + // Assemble the digitally-signed struct (the data over which the signature + // was generated). + // https://www.rfc-editor.org/rfc/rfc6962#section-3.2 + const stream = new stream_1.ByteStream(); + stream.appendChar(this.version); + stream.appendChar(0x00); // SignatureType = certificate_timestamp(0) + stream.appendView(this.timestamp); + stream.appendUint16(0x01); // LogEntryType = precert_entry(1) + stream.appendView(preCert); + stream.appendUint16(this.extensions.byteLength); + /* istanbul ignore next - extensions are very uncommon */ + if (this.extensions.byteLength > 0) { + stream.appendView(this.extensions); + } + return crypto.verify(stream.buffer, key, this.signature, this.algorithm); + } + // Parses a SignedCertificateTimestamp from a buffer. SCTs are encoded using + // TLS encoding which means the fields and lengths of most fields are + // specified as part of the SCT and TLS specs. + // https://www.rfc-editor.org/rfc/rfc6962#section-3.2 + // https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.4.1 + static parse(buf) { + const stream = new stream_1.ByteStream(buf); + // Version - enum { v1(0), (255) } + const version = stream.getUint8(); + // Log ID - struct { opaque key_id[32]; } + const logID = stream.getBlock(32); + // Timestamp - uint64 + const timestamp = stream.getBlock(8); + // Extensions - opaque extensions<0..2^16-1>; + const extenstionLength = stream.getUint16(); + const extensions = stream.getBlock(extenstionLength); + // Hash algo - enum { sha256(4), . . . (255) } + const hashAlgorithm = stream.getUint8(); + // Signature algo - enum { anonymous(0), rsa(1), dsa(2), ecdsa(3), (255) } + const signatureAlgorithm = stream.getUint8(); + // Signature - opaque signature<0..2^16-1>; + const sigLength = stream.getUint16(); + const signature = stream.getBlock(sigLength); + // Check that we read the entire buffer + if (stream.position !== buf.length) { + throw new Error('SCT buffer length mismatch'); + } + return new SignedCertificateTimestamp({ + version, + logID, + timestamp, + extensions, + hashAlgorithm, + signatureAlgorithm, + signature, + }); + } +} +exports.SignedCertificateTimestamp = SignedCertificateTimestamp; diff --git a/node_modules/npm/node_modules/@sigstore/core/package.json b/node_modules/npm/node_modules/@sigstore/core/package.json new file mode 100644 index 00000000..af5dd281 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/core/package.json @@ -0,0 +1,31 @@ +{ + "name": "@sigstore/core", + "version": "2.0.0", + "description": "Base library for Sigstore", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "clean": "shx rm -rf dist *.tsbuildinfo", + "build": "tsc --build", + "test": "jest" + }, + "files": [ + "dist" + ], + "author": "bdehamer@github.com", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/sigstore/sigstore-js.git" + }, + "bugs": { + "url": "https://github.com/sigstore/sigstore-js/issues" + }, + "homepage": "https://github.com/sigstore/sigstore-js/tree/main/packages/core#readme", + "publishConfig": { + "provenance": true + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/LICENSE b/node_modules/npm/node_modules/@sigstore/protobuf-specs/LICENSE new file mode 100644 index 00000000..e9e7c167 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 The Sigstore Authors + + 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. diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.js new file mode 100644 index 00000000..0c367a83 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.js @@ -0,0 +1,89 @@ +"use strict"; +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Signature = exports.Envelope = void 0; +function createBaseEnvelope() { + return { payload: Buffer.alloc(0), payloadType: "", signatures: [] }; +} +exports.Envelope = { + fromJSON(object) { + return { + payload: isSet(object.payload) ? Buffer.from(bytesFromBase64(object.payload)) : Buffer.alloc(0), + payloadType: isSet(object.payloadType) ? String(object.payloadType) : "", + signatures: Array.isArray(object?.signatures) ? object.signatures.map((e) => exports.Signature.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.payload !== undefined && + (obj.payload = base64FromBytes(message.payload !== undefined ? message.payload : Buffer.alloc(0))); + message.payloadType !== undefined && (obj.payloadType = message.payloadType); + if (message.signatures) { + obj.signatures = message.signatures.map((e) => e ? exports.Signature.toJSON(e) : undefined); + } + else { + obj.signatures = []; + } + return obj; + }, +}; +function createBaseSignature() { + return { sig: Buffer.alloc(0), keyid: "" }; +} +exports.Signature = { + fromJSON(object) { + return { + sig: isSet(object.sig) ? Buffer.from(bytesFromBase64(object.sig)) : Buffer.alloc(0), + keyid: isSet(object.keyid) ? String(object.keyid) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.sig !== undefined && (obj.sig = base64FromBytes(message.sig !== undefined ? message.sig : Buffer.alloc(0))); + message.keyid !== undefined && (obj.keyid = message.keyid); + return obj; + }, +}; +var tsProtoGlobalThis = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/events.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/events.js new file mode 100644 index 00000000..073093b8 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/events.js @@ -0,0 +1,185 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CloudEventBatch = exports.CloudEvent_CloudEventAttributeValue = exports.CloudEvent_AttributesEntry = exports.CloudEvent = void 0; +/* eslint-disable */ +const any_1 = require("./google/protobuf/any"); +const timestamp_1 = require("./google/protobuf/timestamp"); +function createBaseCloudEvent() { + return { id: "", source: "", specVersion: "", type: "", attributes: {}, data: undefined }; +} +exports.CloudEvent = { + fromJSON(object) { + return { + id: isSet(object.id) ? String(object.id) : "", + source: isSet(object.source) ? String(object.source) : "", + specVersion: isSet(object.specVersion) ? String(object.specVersion) : "", + type: isSet(object.type) ? String(object.type) : "", + attributes: isObject(object.attributes) + ? Object.entries(object.attributes).reduce((acc, [key, value]) => { + acc[key] = exports.CloudEvent_CloudEventAttributeValue.fromJSON(value); + return acc; + }, {}) + : {}, + data: isSet(object.binaryData) + ? { $case: "binaryData", binaryData: Buffer.from(bytesFromBase64(object.binaryData)) } + : isSet(object.textData) + ? { $case: "textData", textData: String(object.textData) } + : isSet(object.protoData) + ? { $case: "protoData", protoData: any_1.Any.fromJSON(object.protoData) } + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.id !== undefined && (obj.id = message.id); + message.source !== undefined && (obj.source = message.source); + message.specVersion !== undefined && (obj.specVersion = message.specVersion); + message.type !== undefined && (obj.type = message.type); + obj.attributes = {}; + if (message.attributes) { + Object.entries(message.attributes).forEach(([k, v]) => { + obj.attributes[k] = exports.CloudEvent_CloudEventAttributeValue.toJSON(v); + }); + } + message.data?.$case === "binaryData" && + (obj.binaryData = message.data?.binaryData !== undefined ? base64FromBytes(message.data?.binaryData) : undefined); + message.data?.$case === "textData" && (obj.textData = message.data?.textData); + message.data?.$case === "protoData" && + (obj.protoData = message.data?.protoData ? any_1.Any.toJSON(message.data?.protoData) : undefined); + return obj; + }, +}; +function createBaseCloudEvent_AttributesEntry() { + return { key: "", value: undefined }; +} +exports.CloudEvent_AttributesEntry = { + fromJSON(object) { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? exports.CloudEvent_CloudEventAttributeValue.fromJSON(object.value) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && + (obj.value = message.value ? exports.CloudEvent_CloudEventAttributeValue.toJSON(message.value) : undefined); + return obj; + }, +}; +function createBaseCloudEvent_CloudEventAttributeValue() { + return { attr: undefined }; +} +exports.CloudEvent_CloudEventAttributeValue = { + fromJSON(object) { + return { + attr: isSet(object.ceBoolean) + ? { $case: "ceBoolean", ceBoolean: Boolean(object.ceBoolean) } + : isSet(object.ceInteger) + ? { $case: "ceInteger", ceInteger: Number(object.ceInteger) } + : isSet(object.ceString) + ? { $case: "ceString", ceString: String(object.ceString) } + : isSet(object.ceBytes) + ? { $case: "ceBytes", ceBytes: Buffer.from(bytesFromBase64(object.ceBytes)) } + : isSet(object.ceUri) + ? { $case: "ceUri", ceUri: String(object.ceUri) } + : isSet(object.ceUriRef) + ? { $case: "ceUriRef", ceUriRef: String(object.ceUriRef) } + : isSet(object.ceTimestamp) + ? { $case: "ceTimestamp", ceTimestamp: fromJsonTimestamp(object.ceTimestamp) } + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.attr?.$case === "ceBoolean" && (obj.ceBoolean = message.attr?.ceBoolean); + message.attr?.$case === "ceInteger" && (obj.ceInteger = Math.round(message.attr?.ceInteger)); + message.attr?.$case === "ceString" && (obj.ceString = message.attr?.ceString); + message.attr?.$case === "ceBytes" && + (obj.ceBytes = message.attr?.ceBytes !== undefined ? base64FromBytes(message.attr?.ceBytes) : undefined); + message.attr?.$case === "ceUri" && (obj.ceUri = message.attr?.ceUri); + message.attr?.$case === "ceUriRef" && (obj.ceUriRef = message.attr?.ceUriRef); + message.attr?.$case === "ceTimestamp" && (obj.ceTimestamp = message.attr?.ceTimestamp.toISOString()); + return obj; + }, +}; +function createBaseCloudEventBatch() { + return { events: [] }; +} +exports.CloudEventBatch = { + fromJSON(object) { + return { events: Array.isArray(object?.events) ? object.events.map((e) => exports.CloudEvent.fromJSON(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.events) { + obj.events = message.events.map((e) => e ? exports.CloudEvent.toJSON(e) : undefined); + } + else { + obj.events = []; + } + return obj; + }, +}; +var tsProtoGlobalThis = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function fromTimestamp(t) { + let millis = Number(t.seconds) * 1000; + millis += t.nanos / 1000000; + return new Date(millis); +} +function fromJsonTimestamp(o) { + if (o instanceof Date) { + return o; + } + else if (typeof o === "string") { + return new Date(o); + } + else { + return fromTimestamp(timestamp_1.Timestamp.fromJSON(o)); + } +} +function isObject(value) { + return typeof value === "object" && value !== null; +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/api/field_behavior.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/api/field_behavior.js new file mode 100644 index 00000000..da627499 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/api/field_behavior.js @@ -0,0 +1,119 @@ +"use strict"; +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fieldBehaviorToJSON = exports.fieldBehaviorFromJSON = exports.FieldBehavior = void 0; +/** + * An indicator of the behavior of a given field (for example, that a field + * is required in requests, or given as output but ignored as input). + * This **does not** change the behavior in protocol buffers itself; it only + * denotes the behavior and may affect how API tooling handles the field. + * + * Note: This enum **may** receive new values in the future. + */ +var FieldBehavior; +(function (FieldBehavior) { + /** FIELD_BEHAVIOR_UNSPECIFIED - Conventional default for enums. Do not use this. */ + FieldBehavior[FieldBehavior["FIELD_BEHAVIOR_UNSPECIFIED"] = 0] = "FIELD_BEHAVIOR_UNSPECIFIED"; + /** + * OPTIONAL - Specifically denotes a field as optional. + * While all fields in protocol buffers are optional, this may be specified + * for emphasis if appropriate. + */ + FieldBehavior[FieldBehavior["OPTIONAL"] = 1] = "OPTIONAL"; + /** + * REQUIRED - Denotes a field as required. + * This indicates that the field **must** be provided as part of the request, + * and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + */ + FieldBehavior[FieldBehavior["REQUIRED"] = 2] = "REQUIRED"; + /** + * OUTPUT_ONLY - Denotes a field as output only. + * This indicates that the field is provided in responses, but including the + * field in a request does nothing (the server *must* ignore it and + * *must not* throw an error as a result of the field's presence). + */ + FieldBehavior[FieldBehavior["OUTPUT_ONLY"] = 3] = "OUTPUT_ONLY"; + /** + * INPUT_ONLY - Denotes a field as input only. + * This indicates that the field is provided in requests, and the + * corresponding field is not included in output. + */ + FieldBehavior[FieldBehavior["INPUT_ONLY"] = 4] = "INPUT_ONLY"; + /** + * IMMUTABLE - Denotes a field as immutable. + * This indicates that the field may be set once in a request to create a + * resource, but may not be changed thereafter. + */ + FieldBehavior[FieldBehavior["IMMUTABLE"] = 5] = "IMMUTABLE"; + /** + * UNORDERED_LIST - Denotes that a (repeated) field is an unordered list. + * This indicates that the service may provide the elements of the list + * in any arbitrary order, rather than the order the user originally + * provided. Additionally, the list's order may or may not be stable. + */ + FieldBehavior[FieldBehavior["UNORDERED_LIST"] = 6] = "UNORDERED_LIST"; +})(FieldBehavior = exports.FieldBehavior || (exports.FieldBehavior = {})); +function fieldBehaviorFromJSON(object) { + switch (object) { + case 0: + case "FIELD_BEHAVIOR_UNSPECIFIED": + return FieldBehavior.FIELD_BEHAVIOR_UNSPECIFIED; + case 1: + case "OPTIONAL": + return FieldBehavior.OPTIONAL; + case 2: + case "REQUIRED": + return FieldBehavior.REQUIRED; + case 3: + case "OUTPUT_ONLY": + return FieldBehavior.OUTPUT_ONLY; + case 4: + case "INPUT_ONLY": + return FieldBehavior.INPUT_ONLY; + case 5: + case "IMMUTABLE": + return FieldBehavior.IMMUTABLE; + case 6: + case "UNORDERED_LIST": + return FieldBehavior.UNORDERED_LIST; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FieldBehavior"); + } +} +exports.fieldBehaviorFromJSON = fieldBehaviorFromJSON; +function fieldBehaviorToJSON(object) { + switch (object) { + case FieldBehavior.FIELD_BEHAVIOR_UNSPECIFIED: + return "FIELD_BEHAVIOR_UNSPECIFIED"; + case FieldBehavior.OPTIONAL: + return "OPTIONAL"; + case FieldBehavior.REQUIRED: + return "REQUIRED"; + case FieldBehavior.OUTPUT_ONLY: + return "OUTPUT_ONLY"; + case FieldBehavior.INPUT_ONLY: + return "INPUT_ONLY"; + case FieldBehavior.IMMUTABLE: + return "IMMUTABLE"; + case FieldBehavior.UNORDERED_LIST: + return "UNORDERED_LIST"; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FieldBehavior"); + } +} +exports.fieldBehaviorToJSON = fieldBehaviorToJSON; +var tsProtoGlobalThis = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/any.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/any.js new file mode 100644 index 00000000..6b3f3c97 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/any.js @@ -0,0 +1,65 @@ +"use strict"; +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Any = void 0; +function createBaseAny() { + return { typeUrl: "", value: Buffer.alloc(0) }; +} +exports.Any = { + fromJSON(object) { + return { + typeUrl: isSet(object.typeUrl) ? String(object.typeUrl) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + }; + }, + toJSON(message) { + const obj = {}; + message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : Buffer.alloc(0))); + return obj; + }, +}; +var tsProtoGlobalThis = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/descriptor.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/descriptor.js new file mode 100644 index 00000000..d429aac8 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/descriptor.js @@ -0,0 +1,1308 @@ +"use strict"; +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GeneratedCodeInfo_Annotation = exports.GeneratedCodeInfo = exports.SourceCodeInfo_Location = exports.SourceCodeInfo = exports.UninterpretedOption_NamePart = exports.UninterpretedOption = exports.MethodOptions = exports.ServiceOptions = exports.EnumValueOptions = exports.EnumOptions = exports.OneofOptions = exports.FieldOptions = exports.MessageOptions = exports.FileOptions = exports.MethodDescriptorProto = exports.ServiceDescriptorProto = exports.EnumValueDescriptorProto = exports.EnumDescriptorProto_EnumReservedRange = exports.EnumDescriptorProto = exports.OneofDescriptorProto = exports.FieldDescriptorProto = exports.ExtensionRangeOptions = exports.DescriptorProto_ReservedRange = exports.DescriptorProto_ExtensionRange = exports.DescriptorProto = exports.FileDescriptorProto = exports.FileDescriptorSet = exports.methodOptions_IdempotencyLevelToJSON = exports.methodOptions_IdempotencyLevelFromJSON = exports.MethodOptions_IdempotencyLevel = exports.fieldOptions_JSTypeToJSON = exports.fieldOptions_JSTypeFromJSON = exports.FieldOptions_JSType = exports.fieldOptions_CTypeToJSON = exports.fieldOptions_CTypeFromJSON = exports.FieldOptions_CType = exports.fileOptions_OptimizeModeToJSON = exports.fileOptions_OptimizeModeFromJSON = exports.FileOptions_OptimizeMode = exports.fieldDescriptorProto_LabelToJSON = exports.fieldDescriptorProto_LabelFromJSON = exports.FieldDescriptorProto_Label = exports.fieldDescriptorProto_TypeToJSON = exports.fieldDescriptorProto_TypeFromJSON = exports.FieldDescriptorProto_Type = void 0; +var FieldDescriptorProto_Type; +(function (FieldDescriptorProto_Type) { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_DOUBLE"] = 1] = "TYPE_DOUBLE"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_FLOAT"] = 2] = "TYPE_FLOAT"; + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_INT64"] = 3] = "TYPE_INT64"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_UINT64"] = 4] = "TYPE_UINT64"; + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_INT32"] = 5] = "TYPE_INT32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_FIXED64"] = 6] = "TYPE_FIXED64"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_FIXED32"] = 7] = "TYPE_FIXED32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_BOOL"] = 8] = "TYPE_BOOL"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_STRING"] = 9] = "TYPE_STRING"; + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. + */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_GROUP"] = 10] = "TYPE_GROUP"; + /** TYPE_MESSAGE - Length-delimited aggregate. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_MESSAGE"] = 11] = "TYPE_MESSAGE"; + /** TYPE_BYTES - New in version 2. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_BYTES"] = 12] = "TYPE_BYTES"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_UINT32"] = 13] = "TYPE_UINT32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_ENUM"] = 14] = "TYPE_ENUM"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SFIXED32"] = 15] = "TYPE_SFIXED32"; + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SFIXED64"] = 16] = "TYPE_SFIXED64"; + /** TYPE_SINT32 - Uses ZigZag encoding. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SINT32"] = 17] = "TYPE_SINT32"; + /** TYPE_SINT64 - Uses ZigZag encoding. */ + FieldDescriptorProto_Type[FieldDescriptorProto_Type["TYPE_SINT64"] = 18] = "TYPE_SINT64"; +})(FieldDescriptorProto_Type = exports.FieldDescriptorProto_Type || (exports.FieldDescriptorProto_Type = {})); +function fieldDescriptorProto_TypeFromJSON(object) { + switch (object) { + case 1: + case "TYPE_DOUBLE": + return FieldDescriptorProto_Type.TYPE_DOUBLE; + case 2: + case "TYPE_FLOAT": + return FieldDescriptorProto_Type.TYPE_FLOAT; + case 3: + case "TYPE_INT64": + return FieldDescriptorProto_Type.TYPE_INT64; + case 4: + case "TYPE_UINT64": + return FieldDescriptorProto_Type.TYPE_UINT64; + case 5: + case "TYPE_INT32": + return FieldDescriptorProto_Type.TYPE_INT32; + case 6: + case "TYPE_FIXED64": + return FieldDescriptorProto_Type.TYPE_FIXED64; + case 7: + case "TYPE_FIXED32": + return FieldDescriptorProto_Type.TYPE_FIXED32; + case 8: + case "TYPE_BOOL": + return FieldDescriptorProto_Type.TYPE_BOOL; + case 9: + case "TYPE_STRING": + return FieldDescriptorProto_Type.TYPE_STRING; + case 10: + case "TYPE_GROUP": + return FieldDescriptorProto_Type.TYPE_GROUP; + case 11: + case "TYPE_MESSAGE": + return FieldDescriptorProto_Type.TYPE_MESSAGE; + case 12: + case "TYPE_BYTES": + return FieldDescriptorProto_Type.TYPE_BYTES; + case 13: + case "TYPE_UINT32": + return FieldDescriptorProto_Type.TYPE_UINT32; + case 14: + case "TYPE_ENUM": + return FieldDescriptorProto_Type.TYPE_ENUM; + case 15: + case "TYPE_SFIXED32": + return FieldDescriptorProto_Type.TYPE_SFIXED32; + case 16: + case "TYPE_SFIXED64": + return FieldDescriptorProto_Type.TYPE_SFIXED64; + case 17: + case "TYPE_SINT32": + return FieldDescriptorProto_Type.TYPE_SINT32; + case 18: + case "TYPE_SINT64": + return FieldDescriptorProto_Type.TYPE_SINT64; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FieldDescriptorProto_Type"); + } +} +exports.fieldDescriptorProto_TypeFromJSON = fieldDescriptorProto_TypeFromJSON; +function fieldDescriptorProto_TypeToJSON(object) { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return "TYPE_DOUBLE"; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return "TYPE_FLOAT"; + case FieldDescriptorProto_Type.TYPE_INT64: + return "TYPE_INT64"; + case FieldDescriptorProto_Type.TYPE_UINT64: + return "TYPE_UINT64"; + case FieldDescriptorProto_Type.TYPE_INT32: + return "TYPE_INT32"; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return "TYPE_FIXED64"; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return "TYPE_FIXED32"; + case FieldDescriptorProto_Type.TYPE_BOOL: + return "TYPE_BOOL"; + case FieldDescriptorProto_Type.TYPE_STRING: + return "TYPE_STRING"; + case FieldDescriptorProto_Type.TYPE_GROUP: + return "TYPE_GROUP"; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return "TYPE_MESSAGE"; + case FieldDescriptorProto_Type.TYPE_BYTES: + return "TYPE_BYTES"; + case FieldDescriptorProto_Type.TYPE_UINT32: + return "TYPE_UINT32"; + case FieldDescriptorProto_Type.TYPE_ENUM: + return "TYPE_ENUM"; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return "TYPE_SFIXED32"; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return "TYPE_SFIXED64"; + case FieldDescriptorProto_Type.TYPE_SINT32: + return "TYPE_SINT32"; + case FieldDescriptorProto_Type.TYPE_SINT64: + return "TYPE_SINT64"; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FieldDescriptorProto_Type"); + } +} +exports.fieldDescriptorProto_TypeToJSON = fieldDescriptorProto_TypeToJSON; +var FieldDescriptorProto_Label; +(function (FieldDescriptorProto_Label) { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + FieldDescriptorProto_Label[FieldDescriptorProto_Label["LABEL_OPTIONAL"] = 1] = "LABEL_OPTIONAL"; + FieldDescriptorProto_Label[FieldDescriptorProto_Label["LABEL_REQUIRED"] = 2] = "LABEL_REQUIRED"; + FieldDescriptorProto_Label[FieldDescriptorProto_Label["LABEL_REPEATED"] = 3] = "LABEL_REPEATED"; +})(FieldDescriptorProto_Label = exports.FieldDescriptorProto_Label || (exports.FieldDescriptorProto_Label = {})); +function fieldDescriptorProto_LabelFromJSON(object) { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FieldDescriptorProto_Label"); + } +} +exports.fieldDescriptorProto_LabelFromJSON = fieldDescriptorProto_LabelFromJSON; +function fieldDescriptorProto_LabelToJSON(object) { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return "LABEL_OPTIONAL"; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FieldDescriptorProto_Label"); + } +} +exports.fieldDescriptorProto_LabelToJSON = fieldDescriptorProto_LabelToJSON; +/** Generated classes can be optimized for speed or code size. */ +var FileOptions_OptimizeMode; +(function (FileOptions_OptimizeMode) { + /** SPEED - Generate complete code for parsing, serialization, */ + FileOptions_OptimizeMode[FileOptions_OptimizeMode["SPEED"] = 1] = "SPEED"; + /** CODE_SIZE - etc. */ + FileOptions_OptimizeMode[FileOptions_OptimizeMode["CODE_SIZE"] = 2] = "CODE_SIZE"; + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + FileOptions_OptimizeMode[FileOptions_OptimizeMode["LITE_RUNTIME"] = 3] = "LITE_RUNTIME"; +})(FileOptions_OptimizeMode = exports.FileOptions_OptimizeMode || (exports.FileOptions_OptimizeMode = {})); +function fileOptions_OptimizeModeFromJSON(object) { + switch (object) { + case 1: + case "SPEED": + return FileOptions_OptimizeMode.SPEED; + case 2: + case "CODE_SIZE": + return FileOptions_OptimizeMode.CODE_SIZE; + case 3: + case "LITE_RUNTIME": + return FileOptions_OptimizeMode.LITE_RUNTIME; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FileOptions_OptimizeMode"); + } +} +exports.fileOptions_OptimizeModeFromJSON = fileOptions_OptimizeModeFromJSON; +function fileOptions_OptimizeModeToJSON(object) { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return "SPEED"; + case FileOptions_OptimizeMode.CODE_SIZE: + return "CODE_SIZE"; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return "LITE_RUNTIME"; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FileOptions_OptimizeMode"); + } +} +exports.fileOptions_OptimizeModeToJSON = fileOptions_OptimizeModeToJSON; +var FieldOptions_CType; +(function (FieldOptions_CType) { + /** STRING - Default mode. */ + FieldOptions_CType[FieldOptions_CType["STRING"] = 0] = "STRING"; + FieldOptions_CType[FieldOptions_CType["CORD"] = 1] = "CORD"; + FieldOptions_CType[FieldOptions_CType["STRING_PIECE"] = 2] = "STRING_PIECE"; +})(FieldOptions_CType = exports.FieldOptions_CType || (exports.FieldOptions_CType = {})); +function fieldOptions_CTypeFromJSON(object) { + switch (object) { + case 0: + case "STRING": + return FieldOptions_CType.STRING; + case 1: + case "CORD": + return FieldOptions_CType.CORD; + case 2: + case "STRING_PIECE": + return FieldOptions_CType.STRING_PIECE; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FieldOptions_CType"); + } +} +exports.fieldOptions_CTypeFromJSON = fieldOptions_CTypeFromJSON; +function fieldOptions_CTypeToJSON(object) { + switch (object) { + case FieldOptions_CType.STRING: + return "STRING"; + case FieldOptions_CType.CORD: + return "CORD"; + case FieldOptions_CType.STRING_PIECE: + return "STRING_PIECE"; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FieldOptions_CType"); + } +} +exports.fieldOptions_CTypeToJSON = fieldOptions_CTypeToJSON; +var FieldOptions_JSType; +(function (FieldOptions_JSType) { + /** JS_NORMAL - Use the default type. */ + FieldOptions_JSType[FieldOptions_JSType["JS_NORMAL"] = 0] = "JS_NORMAL"; + /** JS_STRING - Use JavaScript strings. */ + FieldOptions_JSType[FieldOptions_JSType["JS_STRING"] = 1] = "JS_STRING"; + /** JS_NUMBER - Use JavaScript numbers. */ + FieldOptions_JSType[FieldOptions_JSType["JS_NUMBER"] = 2] = "JS_NUMBER"; +})(FieldOptions_JSType = exports.FieldOptions_JSType || (exports.FieldOptions_JSType = {})); +function fieldOptions_JSTypeFromJSON(object) { + switch (object) { + case 0: + case "JS_NORMAL": + return FieldOptions_JSType.JS_NORMAL; + case 1: + case "JS_STRING": + return FieldOptions_JSType.JS_STRING; + case 2: + case "JS_NUMBER": + return FieldOptions_JSType.JS_NUMBER; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FieldOptions_JSType"); + } +} +exports.fieldOptions_JSTypeFromJSON = fieldOptions_JSTypeFromJSON; +function fieldOptions_JSTypeToJSON(object) { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return "JS_NORMAL"; + case FieldOptions_JSType.JS_STRING: + return "JS_STRING"; + case FieldOptions_JSType.JS_NUMBER: + return "JS_NUMBER"; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum FieldOptions_JSType"); + } +} +exports.fieldOptions_JSTypeToJSON = fieldOptions_JSTypeToJSON; +/** + * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + * or neither? HTTP based RPC implementation may choose GET verb for safe + * methods, and PUT verb for idempotent methods instead of the default POST. + */ +var MethodOptions_IdempotencyLevel; +(function (MethodOptions_IdempotencyLevel) { + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["IDEMPOTENCY_UNKNOWN"] = 0] = "IDEMPOTENCY_UNKNOWN"; + /** NO_SIDE_EFFECTS - implies idempotent */ + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["NO_SIDE_EFFECTS"] = 1] = "NO_SIDE_EFFECTS"; + /** IDEMPOTENT - idempotent, but may have side effects */ + MethodOptions_IdempotencyLevel[MethodOptions_IdempotencyLevel["IDEMPOTENT"] = 2] = "IDEMPOTENT"; +})(MethodOptions_IdempotencyLevel = exports.MethodOptions_IdempotencyLevel || (exports.MethodOptions_IdempotencyLevel = {})); +function methodOptions_IdempotencyLevelFromJSON(object) { + switch (object) { + case 0: + case "IDEMPOTENCY_UNKNOWN": + return MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; + case 1: + case "NO_SIDE_EFFECTS": + return MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS; + case 2: + case "IDEMPOTENT": + return MethodOptions_IdempotencyLevel.IDEMPOTENT; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum MethodOptions_IdempotencyLevel"); + } +} +exports.methodOptions_IdempotencyLevelFromJSON = methodOptions_IdempotencyLevelFromJSON; +function methodOptions_IdempotencyLevelToJSON(object) { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return "IDEMPOTENCY_UNKNOWN"; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return "NO_SIDE_EFFECTS"; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return "IDEMPOTENT"; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum MethodOptions_IdempotencyLevel"); + } +} +exports.methodOptions_IdempotencyLevelToJSON = methodOptions_IdempotencyLevelToJSON; +function createBaseFileDescriptorSet() { + return { file: [] }; +} +exports.FileDescriptorSet = { + fromJSON(object) { + return { file: Array.isArray(object?.file) ? object.file.map((e) => exports.FileDescriptorProto.fromJSON(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.file) { + obj.file = message.file.map((e) => e ? exports.FileDescriptorProto.toJSON(e) : undefined); + } + else { + obj.file = []; + } + return obj; + }, +}; +function createBaseFileDescriptorProto() { + return { + name: "", + package: "", + dependency: [], + publicDependency: [], + weakDependency: [], + messageType: [], + enumType: [], + service: [], + extension: [], + options: undefined, + sourceCodeInfo: undefined, + syntax: "", + }; +} +exports.FileDescriptorProto = { + fromJSON(object) { + return { + name: isSet(object.name) ? String(object.name) : "", + package: isSet(object.package) ? String(object.package) : "", + dependency: Array.isArray(object?.dependency) ? object.dependency.map((e) => String(e)) : [], + publicDependency: Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e) => Number(e)) + : [], + weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e) => Number(e)) : [], + messageType: Array.isArray(object?.messageType) + ? object.messageType.map((e) => exports.DescriptorProto.fromJSON(e)) + : [], + enumType: Array.isArray(object?.enumType) ? object.enumType.map((e) => exports.EnumDescriptorProto.fromJSON(e)) : [], + service: Array.isArray(object?.service) ? object.service.map((e) => exports.ServiceDescriptorProto.fromJSON(e)) : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e) => exports.FieldDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? exports.FileOptions.fromJSON(object.options) : undefined, + sourceCodeInfo: isSet(object.sourceCodeInfo) ? exports.SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, + syntax: isSet(object.syntax) ? String(object.syntax) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + message.package !== undefined && (obj.package = message.package); + if (message.dependency) { + obj.dependency = message.dependency.map((e) => e); + } + else { + obj.dependency = []; + } + if (message.publicDependency) { + obj.publicDependency = message.publicDependency.map((e) => Math.round(e)); + } + else { + obj.publicDependency = []; + } + if (message.weakDependency) { + obj.weakDependency = message.weakDependency.map((e) => Math.round(e)); + } + else { + obj.weakDependency = []; + } + if (message.messageType) { + obj.messageType = message.messageType.map((e) => e ? exports.DescriptorProto.toJSON(e) : undefined); + } + else { + obj.messageType = []; + } + if (message.enumType) { + obj.enumType = message.enumType.map((e) => e ? exports.EnumDescriptorProto.toJSON(e) : undefined); + } + else { + obj.enumType = []; + } + if (message.service) { + obj.service = message.service.map((e) => e ? exports.ServiceDescriptorProto.toJSON(e) : undefined); + } + else { + obj.service = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => e ? exports.FieldDescriptorProto.toJSON(e) : undefined); + } + else { + obj.extension = []; + } + message.options !== undefined && (obj.options = message.options ? exports.FileOptions.toJSON(message.options) : undefined); + message.sourceCodeInfo !== undefined && + (obj.sourceCodeInfo = message.sourceCodeInfo ? exports.SourceCodeInfo.toJSON(message.sourceCodeInfo) : undefined); + message.syntax !== undefined && (obj.syntax = message.syntax); + return obj; + }, +}; +function createBaseDescriptorProto() { + return { + name: "", + field: [], + extension: [], + nestedType: [], + enumType: [], + extensionRange: [], + oneofDecl: [], + options: undefined, + reservedRange: [], + reservedName: [], + }; +} +exports.DescriptorProto = { + fromJSON(object) { + return { + name: isSet(object.name) ? String(object.name) : "", + field: Array.isArray(object?.field) ? object.field.map((e) => exports.FieldDescriptorProto.fromJSON(e)) : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e) => exports.FieldDescriptorProto.fromJSON(e)) + : [], + nestedType: Array.isArray(object?.nestedType) + ? object.nestedType.map((e) => exports.DescriptorProto.fromJSON(e)) + : [], + enumType: Array.isArray(object?.enumType) ? object.enumType.map((e) => exports.EnumDescriptorProto.fromJSON(e)) : [], + extensionRange: Array.isArray(object?.extensionRange) + ? object.extensionRange.map((e) => exports.DescriptorProto_ExtensionRange.fromJSON(e)) + : [], + oneofDecl: Array.isArray(object?.oneofDecl) + ? object.oneofDecl.map((e) => exports.OneofDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? exports.MessageOptions.fromJSON(object.options) : undefined, + reservedRange: Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e) => exports.DescriptorProto_ReservedRange.fromJSON(e)) + : [], + reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + if (message.field) { + obj.field = message.field.map((e) => e ? exports.FieldDescriptorProto.toJSON(e) : undefined); + } + else { + obj.field = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => e ? exports.FieldDescriptorProto.toJSON(e) : undefined); + } + else { + obj.extension = []; + } + if (message.nestedType) { + obj.nestedType = message.nestedType.map((e) => e ? exports.DescriptorProto.toJSON(e) : undefined); + } + else { + obj.nestedType = []; + } + if (message.enumType) { + obj.enumType = message.enumType.map((e) => e ? exports.EnumDescriptorProto.toJSON(e) : undefined); + } + else { + obj.enumType = []; + } + if (message.extensionRange) { + obj.extensionRange = message.extensionRange.map((e) => e ? exports.DescriptorProto_ExtensionRange.toJSON(e) : undefined); + } + else { + obj.extensionRange = []; + } + if (message.oneofDecl) { + obj.oneofDecl = message.oneofDecl.map((e) => e ? exports.OneofDescriptorProto.toJSON(e) : undefined); + } + else { + obj.oneofDecl = []; + } + message.options !== undefined && + (obj.options = message.options ? exports.MessageOptions.toJSON(message.options) : undefined); + if (message.reservedRange) { + obj.reservedRange = message.reservedRange.map((e) => e ? exports.DescriptorProto_ReservedRange.toJSON(e) : undefined); + } + else { + obj.reservedRange = []; + } + if (message.reservedName) { + obj.reservedName = message.reservedName.map((e) => e); + } + else { + obj.reservedName = []; + } + return obj; + }, +}; +function createBaseDescriptorProto_ExtensionRange() { + return { start: 0, end: 0, options: undefined }; +} +exports.DescriptorProto_ExtensionRange = { + fromJSON(object) { + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + options: isSet(object.options) ? exports.ExtensionRangeOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + message.options !== undefined && + (obj.options = message.options ? exports.ExtensionRangeOptions.toJSON(message.options) : undefined); + return obj; + }, +}; +function createBaseDescriptorProto_ReservedRange() { + return { start: 0, end: 0 }; +} +exports.DescriptorProto_ReservedRange = { + fromJSON(object) { + return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + }, + toJSON(message) { + const obj = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, +}; +function createBaseExtensionRangeOptions() { + return { uninterpretedOption: [] }; +} +exports.ExtensionRangeOptions = { + fromJSON(object) { + return { + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? exports.UninterpretedOption.toJSON(e) : undefined); + } + else { + obj.uninterpretedOption = []; + } + return obj; + }, +}; +function createBaseFieldDescriptorProto() { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} +exports.FieldDescriptorProto = { + fromJSON(object) { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, + typeName: isSet(object.typeName) ? String(object.typeName) : "", + extendee: isSet(object.extendee) ? String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + options: isSet(object.options) ? exports.FieldOptions.fromJSON(object.options) : undefined, + proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.label !== undefined && (obj.label = fieldDescriptorProto_LabelToJSON(message.label)); + message.type !== undefined && (obj.type = fieldDescriptorProto_TypeToJSON(message.type)); + message.typeName !== undefined && (obj.typeName = message.typeName); + message.extendee !== undefined && (obj.extendee = message.extendee); + message.defaultValue !== undefined && (obj.defaultValue = message.defaultValue); + message.oneofIndex !== undefined && (obj.oneofIndex = Math.round(message.oneofIndex)); + message.jsonName !== undefined && (obj.jsonName = message.jsonName); + message.options !== undefined && (obj.options = message.options ? exports.FieldOptions.toJSON(message.options) : undefined); + message.proto3Optional !== undefined && (obj.proto3Optional = message.proto3Optional); + return obj; + }, +}; +function createBaseOneofDescriptorProto() { + return { name: "", options: undefined }; +} +exports.OneofDescriptorProto = { + fromJSON(object) { + return { + name: isSet(object.name) ? String(object.name) : "", + options: isSet(object.options) ? exports.OneofOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + message.options !== undefined && (obj.options = message.options ? exports.OneofOptions.toJSON(message.options) : undefined); + return obj; + }, +}; +function createBaseEnumDescriptorProto() { + return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; +} +exports.EnumDescriptorProto = { + fromJSON(object) { + return { + name: isSet(object.name) ? String(object.name) : "", + value: Array.isArray(object?.value) ? object.value.map((e) => exports.EnumValueDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? exports.EnumOptions.fromJSON(object.options) : undefined, + reservedRange: Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e) => exports.EnumDescriptorProto_EnumReservedRange.fromJSON(e)) + : [], + reservedName: Array.isArray(object?.reservedName) + ? object.reservedName.map((e) => String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + if (message.value) { + obj.value = message.value.map((e) => e ? exports.EnumValueDescriptorProto.toJSON(e) : undefined); + } + else { + obj.value = []; + } + message.options !== undefined && (obj.options = message.options ? exports.EnumOptions.toJSON(message.options) : undefined); + if (message.reservedRange) { + obj.reservedRange = message.reservedRange.map((e) => e ? exports.EnumDescriptorProto_EnumReservedRange.toJSON(e) : undefined); + } + else { + obj.reservedRange = []; + } + if (message.reservedName) { + obj.reservedName = message.reservedName.map((e) => e); + } + else { + obj.reservedName = []; + } + return obj; + }, +}; +function createBaseEnumDescriptorProto_EnumReservedRange() { + return { start: 0, end: 0 }; +} +exports.EnumDescriptorProto_EnumReservedRange = { + fromJSON(object) { + return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + }, + toJSON(message) { + const obj = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, +}; +function createBaseEnumValueDescriptorProto() { + return { name: "", number: 0, options: undefined }; +} +exports.EnumValueDescriptorProto = { + fromJSON(object) { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + options: isSet(object.options) ? exports.EnumValueOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.options !== undefined && + (obj.options = message.options ? exports.EnumValueOptions.toJSON(message.options) : undefined); + return obj; + }, +}; +function createBaseServiceDescriptorProto() { + return { name: "", method: [], options: undefined }; +} +exports.ServiceDescriptorProto = { + fromJSON(object) { + return { + name: isSet(object.name) ? String(object.name) : "", + method: Array.isArray(object?.method) ? object.method.map((e) => exports.MethodDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? exports.ServiceOptions.fromJSON(object.options) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + if (message.method) { + obj.method = message.method.map((e) => e ? exports.MethodDescriptorProto.toJSON(e) : undefined); + } + else { + obj.method = []; + } + message.options !== undefined && + (obj.options = message.options ? exports.ServiceOptions.toJSON(message.options) : undefined); + return obj; + }, +}; +function createBaseMethodDescriptorProto() { + return { + name: "", + inputType: "", + outputType: "", + options: undefined, + clientStreaming: false, + serverStreaming: false, + }; +} +exports.MethodDescriptorProto = { + fromJSON(object) { + return { + name: isSet(object.name) ? String(object.name) : "", + inputType: isSet(object.inputType) ? String(object.inputType) : "", + outputType: isSet(object.outputType) ? String(object.outputType) : "", + options: isSet(object.options) ? exports.MethodOptions.fromJSON(object.options) : undefined, + clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.name !== undefined && (obj.name = message.name); + message.inputType !== undefined && (obj.inputType = message.inputType); + message.outputType !== undefined && (obj.outputType = message.outputType); + message.options !== undefined && + (obj.options = message.options ? exports.MethodOptions.toJSON(message.options) : undefined); + message.clientStreaming !== undefined && (obj.clientStreaming = message.clientStreaming); + message.serverStreaming !== undefined && (obj.serverStreaming = message.serverStreaming); + return obj; + }, +}; +function createBaseFileOptions() { + return { + javaPackage: "", + javaOuterClassname: "", + javaMultipleFiles: false, + javaGenerateEqualsAndHash: false, + javaStringCheckUtf8: false, + optimizeFor: 1, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + phpGenericServices: false, + deprecated: false, + ccEnableArenas: false, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", + uninterpretedOption: [], + }; +} +exports.FileOptions = { + fromJSON(object) { + return { + javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) + ? Boolean(object.javaGenerateEqualsAndHash) + : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, + goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, + phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, + objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); + message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); + message.javaMultipleFiles !== undefined && (obj.javaMultipleFiles = message.javaMultipleFiles); + message.javaGenerateEqualsAndHash !== undefined && + (obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash); + message.javaStringCheckUtf8 !== undefined && (obj.javaStringCheckUtf8 = message.javaStringCheckUtf8); + message.optimizeFor !== undefined && (obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor)); + message.goPackage !== undefined && (obj.goPackage = message.goPackage); + message.ccGenericServices !== undefined && (obj.ccGenericServices = message.ccGenericServices); + message.javaGenericServices !== undefined && (obj.javaGenericServices = message.javaGenericServices); + message.pyGenericServices !== undefined && (obj.pyGenericServices = message.pyGenericServices); + message.phpGenericServices !== undefined && (obj.phpGenericServices = message.phpGenericServices); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.ccEnableArenas !== undefined && (obj.ccEnableArenas = message.ccEnableArenas); + message.objcClassPrefix !== undefined && (obj.objcClassPrefix = message.objcClassPrefix); + message.csharpNamespace !== undefined && (obj.csharpNamespace = message.csharpNamespace); + message.swiftPrefix !== undefined && (obj.swiftPrefix = message.swiftPrefix); + message.phpClassPrefix !== undefined && (obj.phpClassPrefix = message.phpClassPrefix); + message.phpNamespace !== undefined && (obj.phpNamespace = message.phpNamespace); + message.phpMetadataNamespace !== undefined && (obj.phpMetadataNamespace = message.phpMetadataNamespace); + message.rubyPackage !== undefined && (obj.rubyPackage = message.rubyPackage); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? exports.UninterpretedOption.toJSON(e) : undefined); + } + else { + obj.uninterpretedOption = []; + } + return obj; + }, +}; +function createBaseMessageOptions() { + return { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, + uninterpretedOption: [], + }; +} +exports.MessageOptions = { + fromJSON(object) { + return { + messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) + ? Boolean(object.noStandardDescriptorAccessor) + : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); + message.noStandardDescriptorAccessor !== undefined && + (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.mapEntry !== undefined && (obj.mapEntry = message.mapEntry); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? exports.UninterpretedOption.toJSON(e) : undefined); + } + else { + obj.uninterpretedOption = []; + } + return obj; + }, +}; +function createBaseFieldOptions() { + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + uninterpretedOption: [], + }; +} +exports.FieldOptions = { + fromJSON(object) { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + packed: isSet(object.packed) ? Boolean(object.packed) : false, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, + lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? Boolean(object.weak) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); + message.packed !== undefined && (obj.packed = message.packed); + message.jstype !== undefined && (obj.jstype = fieldOptions_JSTypeToJSON(message.jstype)); + message.lazy !== undefined && (obj.lazy = message.lazy); + message.unverifiedLazy !== undefined && (obj.unverifiedLazy = message.unverifiedLazy); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.weak !== undefined && (obj.weak = message.weak); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? exports.UninterpretedOption.toJSON(e) : undefined); + } + else { + obj.uninterpretedOption = []; + } + return obj; + }, +}; +function createBaseOneofOptions() { + return { uninterpretedOption: [] }; +} +exports.OneofOptions = { + fromJSON(object) { + return { + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? exports.UninterpretedOption.toJSON(e) : undefined); + } + else { + obj.uninterpretedOption = []; + } + return obj; + }, +}; +function createBaseEnumOptions() { + return { allowAlias: false, deprecated: false, uninterpretedOption: [] }; +} +exports.EnumOptions = { + fromJSON(object) { + return { + allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? exports.UninterpretedOption.toJSON(e) : undefined); + } + else { + obj.uninterpretedOption = []; + } + return obj; + }, +}; +function createBaseEnumValueOptions() { + return { deprecated: false, uninterpretedOption: [] }; +} +exports.EnumValueOptions = { + fromJSON(object) { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? exports.UninterpretedOption.toJSON(e) : undefined); + } + else { + obj.uninterpretedOption = []; + } + return obj; + }, +}; +function createBaseServiceOptions() { + return { deprecated: false, uninterpretedOption: [] }; +} +exports.ServiceOptions = { + fromJSON(object) { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? exports.UninterpretedOption.toJSON(e) : undefined); + } + else { + obj.uninterpretedOption = []; + } + return obj; + }, +}; +function createBaseMethodOptions() { + return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; +} +exports.MethodOptions = { + fromJSON(object) { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + idempotencyLevel: isSet(object.idempotencyLevel) + ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) + : 0, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e) => exports.UninterpretedOption.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.idempotencyLevel !== undefined && + (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? exports.UninterpretedOption.toJSON(e) : undefined); + } + else { + obj.uninterpretedOption = []; + } + return obj; + }, +}; +function createBaseUninterpretedOption() { + return { + name: [], + identifierValue: "", + positiveIntValue: "0", + negativeIntValue: "0", + doubleValue: 0, + stringValue: Buffer.alloc(0), + aggregateValue: "", + }; +} +exports.UninterpretedOption = { + fromJSON(object) { + return { + name: Array.isArray(object?.name) ? object.name.map((e) => exports.UninterpretedOption_NamePart.fromJSON(e)) : [], + identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? String(object.positiveIntValue) : "0", + negativeIntValue: isSet(object.negativeIntValue) ? String(object.negativeIntValue) : "0", + doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + stringValue: isSet(object.stringValue) ? Buffer.from(bytesFromBase64(object.stringValue)) : Buffer.alloc(0), + aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + }; + }, + toJSON(message) { + const obj = {}; + if (message.name) { + obj.name = message.name.map((e) => e ? exports.UninterpretedOption_NamePart.toJSON(e) : undefined); + } + else { + obj.name = []; + } + message.identifierValue !== undefined && (obj.identifierValue = message.identifierValue); + message.positiveIntValue !== undefined && (obj.positiveIntValue = message.positiveIntValue); + message.negativeIntValue !== undefined && (obj.negativeIntValue = message.negativeIntValue); + message.doubleValue !== undefined && (obj.doubleValue = message.doubleValue); + message.stringValue !== undefined && + (obj.stringValue = base64FromBytes(message.stringValue !== undefined ? message.stringValue : Buffer.alloc(0))); + message.aggregateValue !== undefined && (obj.aggregateValue = message.aggregateValue); + return obj; + }, +}; +function createBaseUninterpretedOption_NamePart() { + return { namePart: "", isExtension: false }; +} +exports.UninterpretedOption_NamePart = { + fromJSON(object) { + return { + namePart: isSet(object.namePart) ? String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.namePart !== undefined && (obj.namePart = message.namePart); + message.isExtension !== undefined && (obj.isExtension = message.isExtension); + return obj; + }, +}; +function createBaseSourceCodeInfo() { + return { location: [] }; +} +exports.SourceCodeInfo = { + fromJSON(object) { + return { + location: Array.isArray(object?.location) + ? object.location.map((e) => exports.SourceCodeInfo_Location.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.location) { + obj.location = message.location.map((e) => e ? exports.SourceCodeInfo_Location.toJSON(e) : undefined); + } + else { + obj.location = []; + } + return obj; + }, +}; +function createBaseSourceCodeInfo_Location() { + return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; +} +exports.SourceCodeInfo_Location = { + fromJSON(object) { + return { + path: Array.isArray(object?.path) ? object.path.map((e) => Number(e)) : [], + span: Array.isArray(object?.span) ? object.span.map((e) => Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", + leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e) => String(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } + else { + obj.path = []; + } + if (message.span) { + obj.span = message.span.map((e) => Math.round(e)); + } + else { + obj.span = []; + } + message.leadingComments !== undefined && (obj.leadingComments = message.leadingComments); + message.trailingComments !== undefined && (obj.trailingComments = message.trailingComments); + if (message.leadingDetachedComments) { + obj.leadingDetachedComments = message.leadingDetachedComments.map((e) => e); + } + else { + obj.leadingDetachedComments = []; + } + return obj; + }, +}; +function createBaseGeneratedCodeInfo() { + return { annotation: [] }; +} +exports.GeneratedCodeInfo = { + fromJSON(object) { + return { + annotation: Array.isArray(object?.annotation) + ? object.annotation.map((e) => exports.GeneratedCodeInfo_Annotation.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.annotation) { + obj.annotation = message.annotation.map((e) => e ? exports.GeneratedCodeInfo_Annotation.toJSON(e) : undefined); + } + else { + obj.annotation = []; + } + return obj; + }, +}; +function createBaseGeneratedCodeInfo_Annotation() { + return { path: [], sourceFile: "", begin: 0, end: 0 }; +} +exports.GeneratedCodeInfo_Annotation = { + fromJSON(object) { + return { + path: Array.isArray(object?.path) ? object.path.map((e) => Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", + begin: isSet(object.begin) ? Number(object.begin) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + }; + }, + toJSON(message) { + const obj = {}; + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } + else { + obj.path = []; + } + message.sourceFile !== undefined && (obj.sourceFile = message.sourceFile); + message.begin !== undefined && (obj.begin = Math.round(message.begin)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, +}; +var tsProtoGlobalThis = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.js new file mode 100644 index 00000000..159135fe --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.js @@ -0,0 +1,24 @@ +"use strict"; +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Timestamp = void 0; +function createBaseTimestamp() { + return { seconds: "0", nanos: 0 }; +} +exports.Timestamp = { + fromJSON(object) { + return { + seconds: isSet(object.seconds) ? String(object.seconds) : "0", + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + toJSON(message) { + const obj = {}; + message.seconds !== undefined && (obj.seconds = message.seconds); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.js new file mode 100644 index 00000000..3773867f --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.js @@ -0,0 +1,112 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Bundle = exports.VerificationMaterial = exports.TimestampVerificationData = void 0; +/* eslint-disable */ +const envelope_1 = require("./envelope"); +const sigstore_common_1 = require("./sigstore_common"); +const sigstore_rekor_1 = require("./sigstore_rekor"); +function createBaseTimestampVerificationData() { + return { rfc3161Timestamps: [] }; +} +exports.TimestampVerificationData = { + fromJSON(object) { + return { + rfc3161Timestamps: Array.isArray(object?.rfc3161Timestamps) + ? object.rfc3161Timestamps.map((e) => sigstore_common_1.RFC3161SignedTimestamp.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.rfc3161Timestamps) { + obj.rfc3161Timestamps = message.rfc3161Timestamps.map((e) => e ? sigstore_common_1.RFC3161SignedTimestamp.toJSON(e) : undefined); + } + else { + obj.rfc3161Timestamps = []; + } + return obj; + }, +}; +function createBaseVerificationMaterial() { + return { content: undefined, tlogEntries: [], timestampVerificationData: undefined }; +} +exports.VerificationMaterial = { + fromJSON(object) { + return { + content: isSet(object.publicKey) + ? { $case: "publicKey", publicKey: sigstore_common_1.PublicKeyIdentifier.fromJSON(object.publicKey) } + : isSet(object.x509CertificateChain) + ? { + $case: "x509CertificateChain", + x509CertificateChain: sigstore_common_1.X509CertificateChain.fromJSON(object.x509CertificateChain), + } + : isSet(object.certificate) + ? { $case: "certificate", certificate: sigstore_common_1.X509Certificate.fromJSON(object.certificate) } + : undefined, + tlogEntries: Array.isArray(object?.tlogEntries) + ? object.tlogEntries.map((e) => sigstore_rekor_1.TransparencyLogEntry.fromJSON(e)) + : [], + timestampVerificationData: isSet(object.timestampVerificationData) + ? exports.TimestampVerificationData.fromJSON(object.timestampVerificationData) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.content?.$case === "publicKey" && + (obj.publicKey = message.content?.publicKey ? sigstore_common_1.PublicKeyIdentifier.toJSON(message.content?.publicKey) : undefined); + message.content?.$case === "x509CertificateChain" && + (obj.x509CertificateChain = message.content?.x509CertificateChain + ? sigstore_common_1.X509CertificateChain.toJSON(message.content?.x509CertificateChain) + : undefined); + message.content?.$case === "certificate" && + (obj.certificate = message.content?.certificate + ? sigstore_common_1.X509Certificate.toJSON(message.content?.certificate) + : undefined); + if (message.tlogEntries) { + obj.tlogEntries = message.tlogEntries.map((e) => e ? sigstore_rekor_1.TransparencyLogEntry.toJSON(e) : undefined); + } + else { + obj.tlogEntries = []; + } + message.timestampVerificationData !== undefined && + (obj.timestampVerificationData = message.timestampVerificationData + ? exports.TimestampVerificationData.toJSON(message.timestampVerificationData) + : undefined); + return obj; + }, +}; +function createBaseBundle() { + return { mediaType: "", verificationMaterial: undefined, content: undefined }; +} +exports.Bundle = { + fromJSON(object) { + return { + mediaType: isSet(object.mediaType) ? String(object.mediaType) : "", + verificationMaterial: isSet(object.verificationMaterial) + ? exports.VerificationMaterial.fromJSON(object.verificationMaterial) + : undefined, + content: isSet(object.messageSignature) + ? { $case: "messageSignature", messageSignature: sigstore_common_1.MessageSignature.fromJSON(object.messageSignature) } + : isSet(object.dsseEnvelope) + ? { $case: "dsseEnvelope", dsseEnvelope: envelope_1.Envelope.fromJSON(object.dsseEnvelope) } + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.mediaType !== undefined && (obj.mediaType = message.mediaType); + message.verificationMaterial !== undefined && (obj.verificationMaterial = message.verificationMaterial + ? exports.VerificationMaterial.toJSON(message.verificationMaterial) + : undefined); + message.content?.$case === "messageSignature" && (obj.messageSignature = message.content?.messageSignature + ? sigstore_common_1.MessageSignature.toJSON(message.content?.messageSignature) + : undefined); + message.content?.$case === "dsseEnvelope" && + (obj.dsseEnvelope = message.content?.dsseEnvelope ? envelope_1.Envelope.toJSON(message.content?.dsseEnvelope) : undefined); + return obj; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.js new file mode 100644 index 00000000..c6f9baa9 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.js @@ -0,0 +1,588 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TimeRange = exports.X509CertificateChain = exports.SubjectAlternativeName = exports.X509Certificate = exports.DistinguishedName = exports.ObjectIdentifierValuePair = exports.ObjectIdentifier = exports.PublicKeyIdentifier = exports.PublicKey = exports.RFC3161SignedTimestamp = exports.LogId = exports.MessageSignature = exports.HashOutput = exports.subjectAlternativeNameTypeToJSON = exports.subjectAlternativeNameTypeFromJSON = exports.SubjectAlternativeNameType = exports.publicKeyDetailsToJSON = exports.publicKeyDetailsFromJSON = exports.PublicKeyDetails = exports.hashAlgorithmToJSON = exports.hashAlgorithmFromJSON = exports.HashAlgorithm = void 0; +/* eslint-disable */ +const timestamp_1 = require("./google/protobuf/timestamp"); +/** + * Only a subset of the secure hash standard algorithms are supported. + * See for more + * details. + * UNSPECIFIED SHOULD not be used, primary reason for inclusion is to force + * any proto JSON serialization to emit the used hash algorithm, as default + * option is to *omit* the default value of an enum (which is the first + * value, represented by '0'. + */ +var HashAlgorithm; +(function (HashAlgorithm) { + HashAlgorithm[HashAlgorithm["HASH_ALGORITHM_UNSPECIFIED"] = 0] = "HASH_ALGORITHM_UNSPECIFIED"; + HashAlgorithm[HashAlgorithm["SHA2_256"] = 1] = "SHA2_256"; + HashAlgorithm[HashAlgorithm["SHA2_384"] = 2] = "SHA2_384"; + HashAlgorithm[HashAlgorithm["SHA2_512"] = 3] = "SHA2_512"; + HashAlgorithm[HashAlgorithm["SHA3_256"] = 4] = "SHA3_256"; + HashAlgorithm[HashAlgorithm["SHA3_384"] = 5] = "SHA3_384"; +})(HashAlgorithm = exports.HashAlgorithm || (exports.HashAlgorithm = {})); +function hashAlgorithmFromJSON(object) { + switch (object) { + case 0: + case "HASH_ALGORITHM_UNSPECIFIED": + return HashAlgorithm.HASH_ALGORITHM_UNSPECIFIED; + case 1: + case "SHA2_256": + return HashAlgorithm.SHA2_256; + case 2: + case "SHA2_384": + return HashAlgorithm.SHA2_384; + case 3: + case "SHA2_512": + return HashAlgorithm.SHA2_512; + case 4: + case "SHA3_256": + return HashAlgorithm.SHA3_256; + case 5: + case "SHA3_384": + return HashAlgorithm.SHA3_384; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum HashAlgorithm"); + } +} +exports.hashAlgorithmFromJSON = hashAlgorithmFromJSON; +function hashAlgorithmToJSON(object) { + switch (object) { + case HashAlgorithm.HASH_ALGORITHM_UNSPECIFIED: + return "HASH_ALGORITHM_UNSPECIFIED"; + case HashAlgorithm.SHA2_256: + return "SHA2_256"; + case HashAlgorithm.SHA2_384: + return "SHA2_384"; + case HashAlgorithm.SHA2_512: + return "SHA2_512"; + case HashAlgorithm.SHA3_256: + return "SHA3_256"; + case HashAlgorithm.SHA3_384: + return "SHA3_384"; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum HashAlgorithm"); + } +} +exports.hashAlgorithmToJSON = hashAlgorithmToJSON; +/** + * Details of a specific public key, capturing the the key encoding method, + * and signature algorithm. + * + * PublicKeyDetails captures the public key/hash algorithm combinations + * recommended in the Sigstore ecosystem. + * + * This is modelled as a linear set as we want to provide a small number of + * opinionated options instead of allowing every possible permutation. + * + * Any changes to this enum MUST be reflected in the algorithm registry. + * See: docs/algorithm-registry.md + * + * To avoid the possibility of contradicting formats such as PKCS1 with + * ED25519 the valid permutations are listed as a linear set instead of a + * cartesian set (i.e one combined variable instead of two, one for encoding + * and one for the signature algorithm). + */ +var PublicKeyDetails; +(function (PublicKeyDetails) { + PublicKeyDetails[PublicKeyDetails["PUBLIC_KEY_DETAILS_UNSPECIFIED"] = 0] = "PUBLIC_KEY_DETAILS_UNSPECIFIED"; + /** + * PKCS1_RSA_PKCS1V5 - RSA + * + * @deprecated + */ + PublicKeyDetails[PublicKeyDetails["PKCS1_RSA_PKCS1V5"] = 1] = "PKCS1_RSA_PKCS1V5"; + /** + * PKCS1_RSA_PSS - See RFC8017 + * + * @deprecated + */ + PublicKeyDetails[PublicKeyDetails["PKCS1_RSA_PSS"] = 2] = "PKCS1_RSA_PSS"; + /** @deprecated */ + PublicKeyDetails[PublicKeyDetails["PKIX_RSA_PKCS1V5"] = 3] = "PKIX_RSA_PKCS1V5"; + /** @deprecated */ + PublicKeyDetails[PublicKeyDetails["PKIX_RSA_PSS"] = 4] = "PKIX_RSA_PSS"; + /** PKIX_RSA_PKCS1V15_2048_SHA256 - RSA public key in PKIX format, PKCS#1v1.5 signature */ + PublicKeyDetails[PublicKeyDetails["PKIX_RSA_PKCS1V15_2048_SHA256"] = 9] = "PKIX_RSA_PKCS1V15_2048_SHA256"; + PublicKeyDetails[PublicKeyDetails["PKIX_RSA_PKCS1V15_3072_SHA256"] = 10] = "PKIX_RSA_PKCS1V15_3072_SHA256"; + PublicKeyDetails[PublicKeyDetails["PKIX_RSA_PKCS1V15_4096_SHA256"] = 11] = "PKIX_RSA_PKCS1V15_4096_SHA256"; + /** PKIX_RSA_PSS_2048_SHA256 - RSA public key in PKIX format, RSASSA-PSS signature */ + PublicKeyDetails[PublicKeyDetails["PKIX_RSA_PSS_2048_SHA256"] = 16] = "PKIX_RSA_PSS_2048_SHA256"; + PublicKeyDetails[PublicKeyDetails["PKIX_RSA_PSS_3072_SHA256"] = 17] = "PKIX_RSA_PSS_3072_SHA256"; + PublicKeyDetails[PublicKeyDetails["PKIX_RSA_PSS_4096_SHA256"] = 18] = "PKIX_RSA_PSS_4096_SHA256"; + /** + * PKIX_ECDSA_P256_HMAC_SHA_256 - ECDSA + * + * @deprecated + */ + PublicKeyDetails[PublicKeyDetails["PKIX_ECDSA_P256_HMAC_SHA_256"] = 6] = "PKIX_ECDSA_P256_HMAC_SHA_256"; + /** PKIX_ECDSA_P256_SHA_256 - See NIST FIPS 186-4 */ + PublicKeyDetails[PublicKeyDetails["PKIX_ECDSA_P256_SHA_256"] = 5] = "PKIX_ECDSA_P256_SHA_256"; + PublicKeyDetails[PublicKeyDetails["PKIX_ECDSA_P384_SHA_384"] = 12] = "PKIX_ECDSA_P384_SHA_384"; + PublicKeyDetails[PublicKeyDetails["PKIX_ECDSA_P521_SHA_512"] = 13] = "PKIX_ECDSA_P521_SHA_512"; + /** PKIX_ED25519 - Ed 25519 */ + PublicKeyDetails[PublicKeyDetails["PKIX_ED25519"] = 7] = "PKIX_ED25519"; + PublicKeyDetails[PublicKeyDetails["PKIX_ED25519_PH"] = 8] = "PKIX_ED25519_PH"; + /** + * LMS_SHA256 - LMS and LM-OTS + * + * These keys and signatures may be used by private Sigstore + * deployments, but are not currently supported by the public + * good instance. + * + * USER WARNING: LMS and LM-OTS are both stateful signature schemes. + * Using them correctly requires discretion and careful consideration + * to ensure that individual secret keys are not used more than once. + * In addition, LM-OTS is a single-use scheme, meaning that it + * MUST NOT be used for more than one signature per LM-OTS key. + * If you cannot maintain these invariants, you MUST NOT use these + * schemes. + */ + PublicKeyDetails[PublicKeyDetails["LMS_SHA256"] = 14] = "LMS_SHA256"; + PublicKeyDetails[PublicKeyDetails["LMOTS_SHA256"] = 15] = "LMOTS_SHA256"; +})(PublicKeyDetails = exports.PublicKeyDetails || (exports.PublicKeyDetails = {})); +function publicKeyDetailsFromJSON(object) { + switch (object) { + case 0: + case "PUBLIC_KEY_DETAILS_UNSPECIFIED": + return PublicKeyDetails.PUBLIC_KEY_DETAILS_UNSPECIFIED; + case 1: + case "PKCS1_RSA_PKCS1V5": + return PublicKeyDetails.PKCS1_RSA_PKCS1V5; + case 2: + case "PKCS1_RSA_PSS": + return PublicKeyDetails.PKCS1_RSA_PSS; + case 3: + case "PKIX_RSA_PKCS1V5": + return PublicKeyDetails.PKIX_RSA_PKCS1V5; + case 4: + case "PKIX_RSA_PSS": + return PublicKeyDetails.PKIX_RSA_PSS; + case 9: + case "PKIX_RSA_PKCS1V15_2048_SHA256": + return PublicKeyDetails.PKIX_RSA_PKCS1V15_2048_SHA256; + case 10: + case "PKIX_RSA_PKCS1V15_3072_SHA256": + return PublicKeyDetails.PKIX_RSA_PKCS1V15_3072_SHA256; + case 11: + case "PKIX_RSA_PKCS1V15_4096_SHA256": + return PublicKeyDetails.PKIX_RSA_PKCS1V15_4096_SHA256; + case 16: + case "PKIX_RSA_PSS_2048_SHA256": + return PublicKeyDetails.PKIX_RSA_PSS_2048_SHA256; + case 17: + case "PKIX_RSA_PSS_3072_SHA256": + return PublicKeyDetails.PKIX_RSA_PSS_3072_SHA256; + case 18: + case "PKIX_RSA_PSS_4096_SHA256": + return PublicKeyDetails.PKIX_RSA_PSS_4096_SHA256; + case 6: + case "PKIX_ECDSA_P256_HMAC_SHA_256": + return PublicKeyDetails.PKIX_ECDSA_P256_HMAC_SHA_256; + case 5: + case "PKIX_ECDSA_P256_SHA_256": + return PublicKeyDetails.PKIX_ECDSA_P256_SHA_256; + case 12: + case "PKIX_ECDSA_P384_SHA_384": + return PublicKeyDetails.PKIX_ECDSA_P384_SHA_384; + case 13: + case "PKIX_ECDSA_P521_SHA_512": + return PublicKeyDetails.PKIX_ECDSA_P521_SHA_512; + case 7: + case "PKIX_ED25519": + return PublicKeyDetails.PKIX_ED25519; + case 8: + case "PKIX_ED25519_PH": + return PublicKeyDetails.PKIX_ED25519_PH; + case 14: + case "LMS_SHA256": + return PublicKeyDetails.LMS_SHA256; + case 15: + case "LMOTS_SHA256": + return PublicKeyDetails.LMOTS_SHA256; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum PublicKeyDetails"); + } +} +exports.publicKeyDetailsFromJSON = publicKeyDetailsFromJSON; +function publicKeyDetailsToJSON(object) { + switch (object) { + case PublicKeyDetails.PUBLIC_KEY_DETAILS_UNSPECIFIED: + return "PUBLIC_KEY_DETAILS_UNSPECIFIED"; + case PublicKeyDetails.PKCS1_RSA_PKCS1V5: + return "PKCS1_RSA_PKCS1V5"; + case PublicKeyDetails.PKCS1_RSA_PSS: + return "PKCS1_RSA_PSS"; + case PublicKeyDetails.PKIX_RSA_PKCS1V5: + return "PKIX_RSA_PKCS1V5"; + case PublicKeyDetails.PKIX_RSA_PSS: + return "PKIX_RSA_PSS"; + case PublicKeyDetails.PKIX_RSA_PKCS1V15_2048_SHA256: + return "PKIX_RSA_PKCS1V15_2048_SHA256"; + case PublicKeyDetails.PKIX_RSA_PKCS1V15_3072_SHA256: + return "PKIX_RSA_PKCS1V15_3072_SHA256"; + case PublicKeyDetails.PKIX_RSA_PKCS1V15_4096_SHA256: + return "PKIX_RSA_PKCS1V15_4096_SHA256"; + case PublicKeyDetails.PKIX_RSA_PSS_2048_SHA256: + return "PKIX_RSA_PSS_2048_SHA256"; + case PublicKeyDetails.PKIX_RSA_PSS_3072_SHA256: + return "PKIX_RSA_PSS_3072_SHA256"; + case PublicKeyDetails.PKIX_RSA_PSS_4096_SHA256: + return "PKIX_RSA_PSS_4096_SHA256"; + case PublicKeyDetails.PKIX_ECDSA_P256_HMAC_SHA_256: + return "PKIX_ECDSA_P256_HMAC_SHA_256"; + case PublicKeyDetails.PKIX_ECDSA_P256_SHA_256: + return "PKIX_ECDSA_P256_SHA_256"; + case PublicKeyDetails.PKIX_ECDSA_P384_SHA_384: + return "PKIX_ECDSA_P384_SHA_384"; + case PublicKeyDetails.PKIX_ECDSA_P521_SHA_512: + return "PKIX_ECDSA_P521_SHA_512"; + case PublicKeyDetails.PKIX_ED25519: + return "PKIX_ED25519"; + case PublicKeyDetails.PKIX_ED25519_PH: + return "PKIX_ED25519_PH"; + case PublicKeyDetails.LMS_SHA256: + return "LMS_SHA256"; + case PublicKeyDetails.LMOTS_SHA256: + return "LMOTS_SHA256"; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum PublicKeyDetails"); + } +} +exports.publicKeyDetailsToJSON = publicKeyDetailsToJSON; +var SubjectAlternativeNameType; +(function (SubjectAlternativeNameType) { + SubjectAlternativeNameType[SubjectAlternativeNameType["SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED"] = 0] = "SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED"; + SubjectAlternativeNameType[SubjectAlternativeNameType["EMAIL"] = 1] = "EMAIL"; + SubjectAlternativeNameType[SubjectAlternativeNameType["URI"] = 2] = "URI"; + /** + * OTHER_NAME - OID 1.3.6.1.4.1.57264.1.7 + * See https://github.com/sigstore/fulcio/blob/main/docs/oid-info.md#1361415726417--othername-san + * for more details. + */ + SubjectAlternativeNameType[SubjectAlternativeNameType["OTHER_NAME"] = 3] = "OTHER_NAME"; +})(SubjectAlternativeNameType = exports.SubjectAlternativeNameType || (exports.SubjectAlternativeNameType = {})); +function subjectAlternativeNameTypeFromJSON(object) { + switch (object) { + case 0: + case "SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED": + return SubjectAlternativeNameType.SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED; + case 1: + case "EMAIL": + return SubjectAlternativeNameType.EMAIL; + case 2: + case "URI": + return SubjectAlternativeNameType.URI; + case 3: + case "OTHER_NAME": + return SubjectAlternativeNameType.OTHER_NAME; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum SubjectAlternativeNameType"); + } +} +exports.subjectAlternativeNameTypeFromJSON = subjectAlternativeNameTypeFromJSON; +function subjectAlternativeNameTypeToJSON(object) { + switch (object) { + case SubjectAlternativeNameType.SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED: + return "SUBJECT_ALTERNATIVE_NAME_TYPE_UNSPECIFIED"; + case SubjectAlternativeNameType.EMAIL: + return "EMAIL"; + case SubjectAlternativeNameType.URI: + return "URI"; + case SubjectAlternativeNameType.OTHER_NAME: + return "OTHER_NAME"; + default: + throw new tsProtoGlobalThis.Error("Unrecognized enum value " + object + " for enum SubjectAlternativeNameType"); + } +} +exports.subjectAlternativeNameTypeToJSON = subjectAlternativeNameTypeToJSON; +function createBaseHashOutput() { + return { algorithm: 0, digest: Buffer.alloc(0) }; +} +exports.HashOutput = { + fromJSON(object) { + return { + algorithm: isSet(object.algorithm) ? hashAlgorithmFromJSON(object.algorithm) : 0, + digest: isSet(object.digest) ? Buffer.from(bytesFromBase64(object.digest)) : Buffer.alloc(0), + }; + }, + toJSON(message) { + const obj = {}; + message.algorithm !== undefined && (obj.algorithm = hashAlgorithmToJSON(message.algorithm)); + message.digest !== undefined && + (obj.digest = base64FromBytes(message.digest !== undefined ? message.digest : Buffer.alloc(0))); + return obj; + }, +}; +function createBaseMessageSignature() { + return { messageDigest: undefined, signature: Buffer.alloc(0) }; +} +exports.MessageSignature = { + fromJSON(object) { + return { + messageDigest: isSet(object.messageDigest) ? exports.HashOutput.fromJSON(object.messageDigest) : undefined, + signature: isSet(object.signature) ? Buffer.from(bytesFromBase64(object.signature)) : Buffer.alloc(0), + }; + }, + toJSON(message) { + const obj = {}; + message.messageDigest !== undefined && + (obj.messageDigest = message.messageDigest ? exports.HashOutput.toJSON(message.messageDigest) : undefined); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : Buffer.alloc(0))); + return obj; + }, +}; +function createBaseLogId() { + return { keyId: Buffer.alloc(0) }; +} +exports.LogId = { + fromJSON(object) { + return { keyId: isSet(object.keyId) ? Buffer.from(bytesFromBase64(object.keyId)) : Buffer.alloc(0) }; + }, + toJSON(message) { + const obj = {}; + message.keyId !== undefined && + (obj.keyId = base64FromBytes(message.keyId !== undefined ? message.keyId : Buffer.alloc(0))); + return obj; + }, +}; +function createBaseRFC3161SignedTimestamp() { + return { signedTimestamp: Buffer.alloc(0) }; +} +exports.RFC3161SignedTimestamp = { + fromJSON(object) { + return { + signedTimestamp: isSet(object.signedTimestamp) + ? Buffer.from(bytesFromBase64(object.signedTimestamp)) + : Buffer.alloc(0), + }; + }, + toJSON(message) { + const obj = {}; + message.signedTimestamp !== undefined && + (obj.signedTimestamp = base64FromBytes(message.signedTimestamp !== undefined ? message.signedTimestamp : Buffer.alloc(0))); + return obj; + }, +}; +function createBasePublicKey() { + return { rawBytes: undefined, keyDetails: 0, validFor: undefined }; +} +exports.PublicKey = { + fromJSON(object) { + return { + rawBytes: isSet(object.rawBytes) ? Buffer.from(bytesFromBase64(object.rawBytes)) : undefined, + keyDetails: isSet(object.keyDetails) ? publicKeyDetailsFromJSON(object.keyDetails) : 0, + validFor: isSet(object.validFor) ? exports.TimeRange.fromJSON(object.validFor) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.rawBytes !== undefined && + (obj.rawBytes = message.rawBytes !== undefined ? base64FromBytes(message.rawBytes) : undefined); + message.keyDetails !== undefined && (obj.keyDetails = publicKeyDetailsToJSON(message.keyDetails)); + message.validFor !== undefined && + (obj.validFor = message.validFor ? exports.TimeRange.toJSON(message.validFor) : undefined); + return obj; + }, +}; +function createBasePublicKeyIdentifier() { + return { hint: "" }; +} +exports.PublicKeyIdentifier = { + fromJSON(object) { + return { hint: isSet(object.hint) ? String(object.hint) : "" }; + }, + toJSON(message) { + const obj = {}; + message.hint !== undefined && (obj.hint = message.hint); + return obj; + }, +}; +function createBaseObjectIdentifier() { + return { id: [] }; +} +exports.ObjectIdentifier = { + fromJSON(object) { + return { id: Array.isArray(object?.id) ? object.id.map((e) => Number(e)) : [] }; + }, + toJSON(message) { + const obj = {}; + if (message.id) { + obj.id = message.id.map((e) => Math.round(e)); + } + else { + obj.id = []; + } + return obj; + }, +}; +function createBaseObjectIdentifierValuePair() { + return { oid: undefined, value: Buffer.alloc(0) }; +} +exports.ObjectIdentifierValuePair = { + fromJSON(object) { + return { + oid: isSet(object.oid) ? exports.ObjectIdentifier.fromJSON(object.oid) : undefined, + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + }; + }, + toJSON(message) { + const obj = {}; + message.oid !== undefined && (obj.oid = message.oid ? exports.ObjectIdentifier.toJSON(message.oid) : undefined); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : Buffer.alloc(0))); + return obj; + }, +}; +function createBaseDistinguishedName() { + return { organization: "", commonName: "" }; +} +exports.DistinguishedName = { + fromJSON(object) { + return { + organization: isSet(object.organization) ? String(object.organization) : "", + commonName: isSet(object.commonName) ? String(object.commonName) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.organization !== undefined && (obj.organization = message.organization); + message.commonName !== undefined && (obj.commonName = message.commonName); + return obj; + }, +}; +function createBaseX509Certificate() { + return { rawBytes: Buffer.alloc(0) }; +} +exports.X509Certificate = { + fromJSON(object) { + return { rawBytes: isSet(object.rawBytes) ? Buffer.from(bytesFromBase64(object.rawBytes)) : Buffer.alloc(0) }; + }, + toJSON(message) { + const obj = {}; + message.rawBytes !== undefined && + (obj.rawBytes = base64FromBytes(message.rawBytes !== undefined ? message.rawBytes : Buffer.alloc(0))); + return obj; + }, +}; +function createBaseSubjectAlternativeName() { + return { type: 0, identity: undefined }; +} +exports.SubjectAlternativeName = { + fromJSON(object) { + return { + type: isSet(object.type) ? subjectAlternativeNameTypeFromJSON(object.type) : 0, + identity: isSet(object.regexp) + ? { $case: "regexp", regexp: String(object.regexp) } + : isSet(object.value) + ? { $case: "value", value: String(object.value) } + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.type !== undefined && (obj.type = subjectAlternativeNameTypeToJSON(message.type)); + message.identity?.$case === "regexp" && (obj.regexp = message.identity?.regexp); + message.identity?.$case === "value" && (obj.value = message.identity?.value); + return obj; + }, +}; +function createBaseX509CertificateChain() { + return { certificates: [] }; +} +exports.X509CertificateChain = { + fromJSON(object) { + return { + certificates: Array.isArray(object?.certificates) + ? object.certificates.map((e) => exports.X509Certificate.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.certificates) { + obj.certificates = message.certificates.map((e) => e ? exports.X509Certificate.toJSON(e) : undefined); + } + else { + obj.certificates = []; + } + return obj; + }, +}; +function createBaseTimeRange() { + return { start: undefined, end: undefined }; +} +exports.TimeRange = { + fromJSON(object) { + return { + start: isSet(object.start) ? fromJsonTimestamp(object.start) : undefined, + end: isSet(object.end) ? fromJsonTimestamp(object.end) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.start !== undefined && (obj.start = message.start.toISOString()); + message.end !== undefined && (obj.end = message.end.toISOString()); + return obj; + }, +}; +var tsProtoGlobalThis = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function fromTimestamp(t) { + let millis = Number(t.seconds) * 1000; + millis += t.nanos / 1000000; + return new Date(millis); +} +function fromJsonTimestamp(o) { + if (o instanceof Date) { + return o; + } + else if (typeof o === "string") { + return new Date(o); + } + else { + return fromTimestamp(timestamp_1.Timestamp.fromJSON(o)); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.js new file mode 100644 index 00000000..398193b2 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.js @@ -0,0 +1,167 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TransparencyLogEntry = exports.InclusionPromise = exports.InclusionProof = exports.Checkpoint = exports.KindVersion = void 0; +/* eslint-disable */ +const sigstore_common_1 = require("./sigstore_common"); +function createBaseKindVersion() { + return { kind: "", version: "" }; +} +exports.KindVersion = { + fromJSON(object) { + return { + kind: isSet(object.kind) ? String(object.kind) : "", + version: isSet(object.version) ? String(object.version) : "", + }; + }, + toJSON(message) { + const obj = {}; + message.kind !== undefined && (obj.kind = message.kind); + message.version !== undefined && (obj.version = message.version); + return obj; + }, +}; +function createBaseCheckpoint() { + return { envelope: "" }; +} +exports.Checkpoint = { + fromJSON(object) { + return { envelope: isSet(object.envelope) ? String(object.envelope) : "" }; + }, + toJSON(message) { + const obj = {}; + message.envelope !== undefined && (obj.envelope = message.envelope); + return obj; + }, +}; +function createBaseInclusionProof() { + return { logIndex: "0", rootHash: Buffer.alloc(0), treeSize: "0", hashes: [], checkpoint: undefined }; +} +exports.InclusionProof = { + fromJSON(object) { + return { + logIndex: isSet(object.logIndex) ? String(object.logIndex) : "0", + rootHash: isSet(object.rootHash) ? Buffer.from(bytesFromBase64(object.rootHash)) : Buffer.alloc(0), + treeSize: isSet(object.treeSize) ? String(object.treeSize) : "0", + hashes: Array.isArray(object?.hashes) ? object.hashes.map((e) => Buffer.from(bytesFromBase64(e))) : [], + checkpoint: isSet(object.checkpoint) ? exports.Checkpoint.fromJSON(object.checkpoint) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.logIndex !== undefined && (obj.logIndex = message.logIndex); + message.rootHash !== undefined && + (obj.rootHash = base64FromBytes(message.rootHash !== undefined ? message.rootHash : Buffer.alloc(0))); + message.treeSize !== undefined && (obj.treeSize = message.treeSize); + if (message.hashes) { + obj.hashes = message.hashes.map((e) => base64FromBytes(e !== undefined ? e : Buffer.alloc(0))); + } + else { + obj.hashes = []; + } + message.checkpoint !== undefined && + (obj.checkpoint = message.checkpoint ? exports.Checkpoint.toJSON(message.checkpoint) : undefined); + return obj; + }, +}; +function createBaseInclusionPromise() { + return { signedEntryTimestamp: Buffer.alloc(0) }; +} +exports.InclusionPromise = { + fromJSON(object) { + return { + signedEntryTimestamp: isSet(object.signedEntryTimestamp) + ? Buffer.from(bytesFromBase64(object.signedEntryTimestamp)) + : Buffer.alloc(0), + }; + }, + toJSON(message) { + const obj = {}; + message.signedEntryTimestamp !== undefined && + (obj.signedEntryTimestamp = base64FromBytes(message.signedEntryTimestamp !== undefined ? message.signedEntryTimestamp : Buffer.alloc(0))); + return obj; + }, +}; +function createBaseTransparencyLogEntry() { + return { + logIndex: "0", + logId: undefined, + kindVersion: undefined, + integratedTime: "0", + inclusionPromise: undefined, + inclusionProof: undefined, + canonicalizedBody: Buffer.alloc(0), + }; +} +exports.TransparencyLogEntry = { + fromJSON(object) { + return { + logIndex: isSet(object.logIndex) ? String(object.logIndex) : "0", + logId: isSet(object.logId) ? sigstore_common_1.LogId.fromJSON(object.logId) : undefined, + kindVersion: isSet(object.kindVersion) ? exports.KindVersion.fromJSON(object.kindVersion) : undefined, + integratedTime: isSet(object.integratedTime) ? String(object.integratedTime) : "0", + inclusionPromise: isSet(object.inclusionPromise) ? exports.InclusionPromise.fromJSON(object.inclusionPromise) : undefined, + inclusionProof: isSet(object.inclusionProof) ? exports.InclusionProof.fromJSON(object.inclusionProof) : undefined, + canonicalizedBody: isSet(object.canonicalizedBody) + ? Buffer.from(bytesFromBase64(object.canonicalizedBody)) + : Buffer.alloc(0), + }; + }, + toJSON(message) { + const obj = {}; + message.logIndex !== undefined && (obj.logIndex = message.logIndex); + message.logId !== undefined && (obj.logId = message.logId ? sigstore_common_1.LogId.toJSON(message.logId) : undefined); + message.kindVersion !== undefined && + (obj.kindVersion = message.kindVersion ? exports.KindVersion.toJSON(message.kindVersion) : undefined); + message.integratedTime !== undefined && (obj.integratedTime = message.integratedTime); + message.inclusionPromise !== undefined && + (obj.inclusionPromise = message.inclusionPromise ? exports.InclusionPromise.toJSON(message.inclusionPromise) : undefined); + message.inclusionProof !== undefined && + (obj.inclusionProof = message.inclusionProof ? exports.InclusionProof.toJSON(message.inclusionProof) : undefined); + message.canonicalizedBody !== undefined && + (obj.canonicalizedBody = base64FromBytes(message.canonicalizedBody !== undefined ? message.canonicalizedBody : Buffer.alloc(0))); + return obj; + }, +}; +var tsProtoGlobalThis = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js new file mode 100644 index 00000000..8791aba2 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js @@ -0,0 +1,158 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ClientTrustConfig = exports.SigningConfig = exports.TrustedRoot = exports.CertificateAuthority = exports.TransparencyLogInstance = void 0; +/* eslint-disable */ +const sigstore_common_1 = require("./sigstore_common"); +function createBaseTransparencyLogInstance() { + return { baseUrl: "", hashAlgorithm: 0, publicKey: undefined, logId: undefined, checkpointKeyId: undefined }; +} +exports.TransparencyLogInstance = { + fromJSON(object) { + return { + baseUrl: isSet(object.baseUrl) ? String(object.baseUrl) : "", + hashAlgorithm: isSet(object.hashAlgorithm) ? (0, sigstore_common_1.hashAlgorithmFromJSON)(object.hashAlgorithm) : 0, + publicKey: isSet(object.publicKey) ? sigstore_common_1.PublicKey.fromJSON(object.publicKey) : undefined, + logId: isSet(object.logId) ? sigstore_common_1.LogId.fromJSON(object.logId) : undefined, + checkpointKeyId: isSet(object.checkpointKeyId) ? sigstore_common_1.LogId.fromJSON(object.checkpointKeyId) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.baseUrl !== undefined && (obj.baseUrl = message.baseUrl); + message.hashAlgorithm !== undefined && (obj.hashAlgorithm = (0, sigstore_common_1.hashAlgorithmToJSON)(message.hashAlgorithm)); + message.publicKey !== undefined && + (obj.publicKey = message.publicKey ? sigstore_common_1.PublicKey.toJSON(message.publicKey) : undefined); + message.logId !== undefined && (obj.logId = message.logId ? sigstore_common_1.LogId.toJSON(message.logId) : undefined); + message.checkpointKeyId !== undefined && + (obj.checkpointKeyId = message.checkpointKeyId ? sigstore_common_1.LogId.toJSON(message.checkpointKeyId) : undefined); + return obj; + }, +}; +function createBaseCertificateAuthority() { + return { subject: undefined, uri: "", certChain: undefined, validFor: undefined }; +} +exports.CertificateAuthority = { + fromJSON(object) { + return { + subject: isSet(object.subject) ? sigstore_common_1.DistinguishedName.fromJSON(object.subject) : undefined, + uri: isSet(object.uri) ? String(object.uri) : "", + certChain: isSet(object.certChain) ? sigstore_common_1.X509CertificateChain.fromJSON(object.certChain) : undefined, + validFor: isSet(object.validFor) ? sigstore_common_1.TimeRange.fromJSON(object.validFor) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.subject !== undefined && + (obj.subject = message.subject ? sigstore_common_1.DistinguishedName.toJSON(message.subject) : undefined); + message.uri !== undefined && (obj.uri = message.uri); + message.certChain !== undefined && + (obj.certChain = message.certChain ? sigstore_common_1.X509CertificateChain.toJSON(message.certChain) : undefined); + message.validFor !== undefined && + (obj.validFor = message.validFor ? sigstore_common_1.TimeRange.toJSON(message.validFor) : undefined); + return obj; + }, +}; +function createBaseTrustedRoot() { + return { mediaType: "", tlogs: [], certificateAuthorities: [], ctlogs: [], timestampAuthorities: [] }; +} +exports.TrustedRoot = { + fromJSON(object) { + return { + mediaType: isSet(object.mediaType) ? String(object.mediaType) : "", + tlogs: Array.isArray(object?.tlogs) ? object.tlogs.map((e) => exports.TransparencyLogInstance.fromJSON(e)) : [], + certificateAuthorities: Array.isArray(object?.certificateAuthorities) + ? object.certificateAuthorities.map((e) => exports.CertificateAuthority.fromJSON(e)) + : [], + ctlogs: Array.isArray(object?.ctlogs) + ? object.ctlogs.map((e) => exports.TransparencyLogInstance.fromJSON(e)) + : [], + timestampAuthorities: Array.isArray(object?.timestampAuthorities) + ? object.timestampAuthorities.map((e) => exports.CertificateAuthority.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + message.mediaType !== undefined && (obj.mediaType = message.mediaType); + if (message.tlogs) { + obj.tlogs = message.tlogs.map((e) => e ? exports.TransparencyLogInstance.toJSON(e) : undefined); + } + else { + obj.tlogs = []; + } + if (message.certificateAuthorities) { + obj.certificateAuthorities = message.certificateAuthorities.map((e) => e ? exports.CertificateAuthority.toJSON(e) : undefined); + } + else { + obj.certificateAuthorities = []; + } + if (message.ctlogs) { + obj.ctlogs = message.ctlogs.map((e) => e ? exports.TransparencyLogInstance.toJSON(e) : undefined); + } + else { + obj.ctlogs = []; + } + if (message.timestampAuthorities) { + obj.timestampAuthorities = message.timestampAuthorities.map((e) => e ? exports.CertificateAuthority.toJSON(e) : undefined); + } + else { + obj.timestampAuthorities = []; + } + return obj; + }, +}; +function createBaseSigningConfig() { + return { caUrl: "", oidcUrl: "", tlogUrls: [], tsaUrls: [] }; +} +exports.SigningConfig = { + fromJSON(object) { + return { + caUrl: isSet(object.caUrl) ? String(object.caUrl) : "", + oidcUrl: isSet(object.oidcUrl) ? String(object.oidcUrl) : "", + tlogUrls: Array.isArray(object?.tlogUrls) ? object.tlogUrls.map((e) => String(e)) : [], + tsaUrls: Array.isArray(object?.tsaUrls) ? object.tsaUrls.map((e) => String(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.caUrl !== undefined && (obj.caUrl = message.caUrl); + message.oidcUrl !== undefined && (obj.oidcUrl = message.oidcUrl); + if (message.tlogUrls) { + obj.tlogUrls = message.tlogUrls.map((e) => e); + } + else { + obj.tlogUrls = []; + } + if (message.tsaUrls) { + obj.tsaUrls = message.tsaUrls.map((e) => e); + } + else { + obj.tsaUrls = []; + } + return obj; + }, +}; +function createBaseClientTrustConfig() { + return { mediaType: "", trustedRoot: undefined, signingConfig: undefined }; +} +exports.ClientTrustConfig = { + fromJSON(object) { + return { + mediaType: isSet(object.mediaType) ? String(object.mediaType) : "", + trustedRoot: isSet(object.trustedRoot) ? exports.TrustedRoot.fromJSON(object.trustedRoot) : undefined, + signingConfig: isSet(object.signingConfig) ? exports.SigningConfig.fromJSON(object.signingConfig) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.mediaType !== undefined && (obj.mediaType = message.mediaType); + message.trustedRoot !== undefined && + (obj.trustedRoot = message.trustedRoot ? exports.TrustedRoot.toJSON(message.trustedRoot) : undefined); + message.signingConfig !== undefined && + (obj.signingConfig = message.signingConfig ? exports.SigningConfig.toJSON(message.signingConfig) : undefined); + return obj; + }, +}; +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.js new file mode 100644 index 00000000..4af83c5a --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.js @@ -0,0 +1,324 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Input = exports.Artifact = exports.ArtifactVerificationOptions_ObserverTimestampOptions = exports.ArtifactVerificationOptions_TlogIntegratedTimestampOptions = exports.ArtifactVerificationOptions_TimestampAuthorityOptions = exports.ArtifactVerificationOptions_CtlogOptions = exports.ArtifactVerificationOptions_TlogOptions = exports.ArtifactVerificationOptions = exports.PublicKeyIdentities = exports.CertificateIdentities = exports.CertificateIdentity = void 0; +/* eslint-disable */ +const sigstore_bundle_1 = require("./sigstore_bundle"); +const sigstore_common_1 = require("./sigstore_common"); +const sigstore_trustroot_1 = require("./sigstore_trustroot"); +function createBaseCertificateIdentity() { + return { issuer: "", san: undefined, oids: [] }; +} +exports.CertificateIdentity = { + fromJSON(object) { + return { + issuer: isSet(object.issuer) ? String(object.issuer) : "", + san: isSet(object.san) ? sigstore_common_1.SubjectAlternativeName.fromJSON(object.san) : undefined, + oids: Array.isArray(object?.oids) ? object.oids.map((e) => sigstore_common_1.ObjectIdentifierValuePair.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + message.issuer !== undefined && (obj.issuer = message.issuer); + message.san !== undefined && (obj.san = message.san ? sigstore_common_1.SubjectAlternativeName.toJSON(message.san) : undefined); + if (message.oids) { + obj.oids = message.oids.map((e) => e ? sigstore_common_1.ObjectIdentifierValuePair.toJSON(e) : undefined); + } + else { + obj.oids = []; + } + return obj; + }, +}; +function createBaseCertificateIdentities() { + return { identities: [] }; +} +exports.CertificateIdentities = { + fromJSON(object) { + return { + identities: Array.isArray(object?.identities) + ? object.identities.map((e) => exports.CertificateIdentity.fromJSON(e)) + : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.identities) { + obj.identities = message.identities.map((e) => e ? exports.CertificateIdentity.toJSON(e) : undefined); + } + else { + obj.identities = []; + } + return obj; + }, +}; +function createBasePublicKeyIdentities() { + return { publicKeys: [] }; +} +exports.PublicKeyIdentities = { + fromJSON(object) { + return { + publicKeys: Array.isArray(object?.publicKeys) ? object.publicKeys.map((e) => sigstore_common_1.PublicKey.fromJSON(e)) : [], + }; + }, + toJSON(message) { + const obj = {}; + if (message.publicKeys) { + obj.publicKeys = message.publicKeys.map((e) => e ? sigstore_common_1.PublicKey.toJSON(e) : undefined); + } + else { + obj.publicKeys = []; + } + return obj; + }, +}; +function createBaseArtifactVerificationOptions() { + return { + signers: undefined, + tlogOptions: undefined, + ctlogOptions: undefined, + tsaOptions: undefined, + integratedTsOptions: undefined, + observerOptions: undefined, + }; +} +exports.ArtifactVerificationOptions = { + fromJSON(object) { + return { + signers: isSet(object.certificateIdentities) + ? { + $case: "certificateIdentities", + certificateIdentities: exports.CertificateIdentities.fromJSON(object.certificateIdentities), + } + : isSet(object.publicKeys) + ? { $case: "publicKeys", publicKeys: exports.PublicKeyIdentities.fromJSON(object.publicKeys) } + : undefined, + tlogOptions: isSet(object.tlogOptions) + ? exports.ArtifactVerificationOptions_TlogOptions.fromJSON(object.tlogOptions) + : undefined, + ctlogOptions: isSet(object.ctlogOptions) + ? exports.ArtifactVerificationOptions_CtlogOptions.fromJSON(object.ctlogOptions) + : undefined, + tsaOptions: isSet(object.tsaOptions) + ? exports.ArtifactVerificationOptions_TimestampAuthorityOptions.fromJSON(object.tsaOptions) + : undefined, + integratedTsOptions: isSet(object.integratedTsOptions) + ? exports.ArtifactVerificationOptions_TlogIntegratedTimestampOptions.fromJSON(object.integratedTsOptions) + : undefined, + observerOptions: isSet(object.observerOptions) + ? exports.ArtifactVerificationOptions_ObserverTimestampOptions.fromJSON(object.observerOptions) + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.signers?.$case === "certificateIdentities" && + (obj.certificateIdentities = message.signers?.certificateIdentities + ? exports.CertificateIdentities.toJSON(message.signers?.certificateIdentities) + : undefined); + message.signers?.$case === "publicKeys" && (obj.publicKeys = message.signers?.publicKeys + ? exports.PublicKeyIdentities.toJSON(message.signers?.publicKeys) + : undefined); + message.tlogOptions !== undefined && (obj.tlogOptions = message.tlogOptions + ? exports.ArtifactVerificationOptions_TlogOptions.toJSON(message.tlogOptions) + : undefined); + message.ctlogOptions !== undefined && (obj.ctlogOptions = message.ctlogOptions + ? exports.ArtifactVerificationOptions_CtlogOptions.toJSON(message.ctlogOptions) + : undefined); + message.tsaOptions !== undefined && (obj.tsaOptions = message.tsaOptions + ? exports.ArtifactVerificationOptions_TimestampAuthorityOptions.toJSON(message.tsaOptions) + : undefined); + message.integratedTsOptions !== undefined && (obj.integratedTsOptions = message.integratedTsOptions + ? exports.ArtifactVerificationOptions_TlogIntegratedTimestampOptions.toJSON(message.integratedTsOptions) + : undefined); + message.observerOptions !== undefined && (obj.observerOptions = message.observerOptions + ? exports.ArtifactVerificationOptions_ObserverTimestampOptions.toJSON(message.observerOptions) + : undefined); + return obj; + }, +}; +function createBaseArtifactVerificationOptions_TlogOptions() { + return { threshold: 0, performOnlineVerification: false, disable: false }; +} +exports.ArtifactVerificationOptions_TlogOptions = { + fromJSON(object) { + return { + threshold: isSet(object.threshold) ? Number(object.threshold) : 0, + performOnlineVerification: isSet(object.performOnlineVerification) + ? Boolean(object.performOnlineVerification) + : false, + disable: isSet(object.disable) ? Boolean(object.disable) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.threshold !== undefined && (obj.threshold = Math.round(message.threshold)); + message.performOnlineVerification !== undefined && + (obj.performOnlineVerification = message.performOnlineVerification); + message.disable !== undefined && (obj.disable = message.disable); + return obj; + }, +}; +function createBaseArtifactVerificationOptions_CtlogOptions() { + return { threshold: 0, disable: false }; +} +exports.ArtifactVerificationOptions_CtlogOptions = { + fromJSON(object) { + return { + threshold: isSet(object.threshold) ? Number(object.threshold) : 0, + disable: isSet(object.disable) ? Boolean(object.disable) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.threshold !== undefined && (obj.threshold = Math.round(message.threshold)); + message.disable !== undefined && (obj.disable = message.disable); + return obj; + }, +}; +function createBaseArtifactVerificationOptions_TimestampAuthorityOptions() { + return { threshold: 0, disable: false }; +} +exports.ArtifactVerificationOptions_TimestampAuthorityOptions = { + fromJSON(object) { + return { + threshold: isSet(object.threshold) ? Number(object.threshold) : 0, + disable: isSet(object.disable) ? Boolean(object.disable) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.threshold !== undefined && (obj.threshold = Math.round(message.threshold)); + message.disable !== undefined && (obj.disable = message.disable); + return obj; + }, +}; +function createBaseArtifactVerificationOptions_TlogIntegratedTimestampOptions() { + return { threshold: 0, disable: false }; +} +exports.ArtifactVerificationOptions_TlogIntegratedTimestampOptions = { + fromJSON(object) { + return { + threshold: isSet(object.threshold) ? Number(object.threshold) : 0, + disable: isSet(object.disable) ? Boolean(object.disable) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.threshold !== undefined && (obj.threshold = Math.round(message.threshold)); + message.disable !== undefined && (obj.disable = message.disable); + return obj; + }, +}; +function createBaseArtifactVerificationOptions_ObserverTimestampOptions() { + return { threshold: 0, disable: false }; +} +exports.ArtifactVerificationOptions_ObserverTimestampOptions = { + fromJSON(object) { + return { + threshold: isSet(object.threshold) ? Number(object.threshold) : 0, + disable: isSet(object.disable) ? Boolean(object.disable) : false, + }; + }, + toJSON(message) { + const obj = {}; + message.threshold !== undefined && (obj.threshold = Math.round(message.threshold)); + message.disable !== undefined && (obj.disable = message.disable); + return obj; + }, +}; +function createBaseArtifact() { + return { data: undefined }; +} +exports.Artifact = { + fromJSON(object) { + return { + data: isSet(object.artifactUri) + ? { $case: "artifactUri", artifactUri: String(object.artifactUri) } + : isSet(object.artifact) + ? { $case: "artifact", artifact: Buffer.from(bytesFromBase64(object.artifact)) } + : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.data?.$case === "artifactUri" && (obj.artifactUri = message.data?.artifactUri); + message.data?.$case === "artifact" && + (obj.artifact = message.data?.artifact !== undefined ? base64FromBytes(message.data?.artifact) : undefined); + return obj; + }, +}; +function createBaseInput() { + return { + artifactTrustRoot: undefined, + artifactVerificationOptions: undefined, + bundle: undefined, + artifact: undefined, + }; +} +exports.Input = { + fromJSON(object) { + return { + artifactTrustRoot: isSet(object.artifactTrustRoot) ? sigstore_trustroot_1.TrustedRoot.fromJSON(object.artifactTrustRoot) : undefined, + artifactVerificationOptions: isSet(object.artifactVerificationOptions) + ? exports.ArtifactVerificationOptions.fromJSON(object.artifactVerificationOptions) + : undefined, + bundle: isSet(object.bundle) ? sigstore_bundle_1.Bundle.fromJSON(object.bundle) : undefined, + artifact: isSet(object.artifact) ? exports.Artifact.fromJSON(object.artifact) : undefined, + }; + }, + toJSON(message) { + const obj = {}; + message.artifactTrustRoot !== undefined && + (obj.artifactTrustRoot = message.artifactTrustRoot ? sigstore_trustroot_1.TrustedRoot.toJSON(message.artifactTrustRoot) : undefined); + message.artifactVerificationOptions !== undefined && + (obj.artifactVerificationOptions = message.artifactVerificationOptions + ? exports.ArtifactVerificationOptions.toJSON(message.artifactVerificationOptions) + : undefined); + message.bundle !== undefined && (obj.bundle = message.bundle ? sigstore_bundle_1.Bundle.toJSON(message.bundle) : undefined); + message.artifact !== undefined && (obj.artifact = message.artifact ? exports.Artifact.toJSON(message.artifact) : undefined); + return obj; + }, +}; +var tsProtoGlobalThis = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); +function bytesFromBase64(b64) { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } + else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} +function base64FromBytes(arr) { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } + else { + const bin = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} +function isSet(value) { + return value !== null && value !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/index.js b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/index.js new file mode 100644 index 00000000..eafb768c --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/dist/index.js @@ -0,0 +1,37 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +__exportStar(require("./__generated__/envelope"), exports); +__exportStar(require("./__generated__/sigstore_bundle"), exports); +__exportStar(require("./__generated__/sigstore_common"), exports); +__exportStar(require("./__generated__/sigstore_rekor"), exports); +__exportStar(require("./__generated__/sigstore_trustroot"), exports); +__exportStar(require("./__generated__/sigstore_verification"), exports); diff --git a/node_modules/npm/node_modules/@sigstore/protobuf-specs/package.json b/node_modules/npm/node_modules/@sigstore/protobuf-specs/package.json new file mode 100644 index 00000000..92ae4acb --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/protobuf-specs/package.json @@ -0,0 +1,31 @@ +{ + "name": "@sigstore/protobuf-specs", + "version": "0.3.2", + "description": "code-signing for npm packages", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "tsc" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/sigstore/protobuf-specs.git" + }, + "files": [ + "dist" + ], + "author": "bdehamer@github.com", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/sigstore/protobuf-specs/issues" + }, + "homepage": "https://github.com/sigstore/protobuf-specs#readme", + "devDependencies": { + "@tsconfig/node16": "^16.1.1", + "@types/node": "^18.14.0", + "typescript": "^4.9.5" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/LICENSE b/node_modules/npm/node_modules/@sigstore/sign/LICENSE new file mode 100644 index 00000000..e9e7c167 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 The Sigstore Authors + + 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. diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/base.js b/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/base.js new file mode 100644 index 00000000..61d5eba4 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/base.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BaseBundleBuilder = void 0; +// BaseBundleBuilder is a base class for BundleBuilder implementations. It +// provides a the basic wokflow for signing and witnessing an artifact. +// Subclasses must implement the `package` method to assemble a valid bundle +// with the generated signature and verification material. +class BaseBundleBuilder { + constructor(options) { + this.signer = options.signer; + this.witnesses = options.witnesses; + } + // Executes the signing/witnessing process for the given artifact. + async create(artifact) { + const signature = await this.prepare(artifact).then((blob) => this.signer.sign(blob)); + const bundle = await this.package(artifact, signature); + // Invoke all of the witnesses in parallel + const verificationMaterials = await Promise.all(this.witnesses.map((witness) => witness.testify(bundle.content, publicKey(signature.key)))); + // Collect the verification material from all of the witnesses + const tlogEntryList = []; + const timestampList = []; + verificationMaterials.forEach(({ tlogEntries, rfc3161Timestamps }) => { + tlogEntryList.push(...(tlogEntries ?? [])); + timestampList.push(...(rfc3161Timestamps ?? [])); + }); + // Merge the collected verification material into the bundle + bundle.verificationMaterial.tlogEntries = tlogEntryList; + bundle.verificationMaterial.timestampVerificationData = { + rfc3161Timestamps: timestampList, + }; + return bundle; + } + // Override this function to apply any pre-signing transformations to the + // artifact. The returned buffer will be signed by the signer. The default + // implementation simply returns the artifact data. + async prepare(artifact) { + return artifact.data; + } +} +exports.BaseBundleBuilder = BaseBundleBuilder; +// Extracts the public key from a KeyMaterial. Returns either the public key +// or the certificate, depending on the type of key material. +function publicKey(key) { + switch (key.$case) { + case 'publicKey': + return key.publicKey; + case 'x509Certificate': + return key.certificate; + } +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/bundle.js b/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/bundle.js new file mode 100644 index 00000000..ed32286a --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/bundle.js @@ -0,0 +1,71 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toMessageSignatureBundle = toMessageSignatureBundle; +exports.toDSSEBundle = toDSSEBundle; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const sigstore = __importStar(require("@sigstore/bundle")); +const util_1 = require("../util"); +// Helper functions for assembling the parts of a Sigstore bundle +// Message signature bundle - $case: 'messageSignature' +function toMessageSignatureBundle(artifact, signature) { + const digest = util_1.crypto.digest('sha256', artifact.data); + return sigstore.toMessageSignatureBundle({ + digest, + signature: signature.signature, + certificate: signature.key.$case === 'x509Certificate' + ? util_1.pem.toDER(signature.key.certificate) + : undefined, + keyHint: signature.key.$case === 'publicKey' ? signature.key.hint : undefined, + certificateChain: true, + }); +} +// DSSE envelope bundle - $case: 'dsseEnvelope' +function toDSSEBundle(artifact, signature, certificateChain) { + return sigstore.toDSSEBundle({ + artifact: artifact.data, + artifactType: artifact.type, + signature: signature.signature, + certificate: signature.key.$case === 'x509Certificate' + ? util_1.pem.toDER(signature.key.certificate) + : undefined, + keyHint: signature.key.$case === 'publicKey' ? signature.key.hint : undefined, + certificateChain, + }); +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/dsse.js b/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/dsse.js new file mode 100644 index 00000000..86046ba8 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/dsse.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DSSEBundleBuilder = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const util_1 = require("../util"); +const base_1 = require("./base"); +const bundle_1 = require("./bundle"); +// BundleBuilder implementation for DSSE wrapped attestations +class DSSEBundleBuilder extends base_1.BaseBundleBuilder { + constructor(options) { + super(options); + this.certificateChain = options.certificateChain ?? false; + } + // DSSE requires the artifact to be pre-encoded with the payload type + // before the signature is generated. + async prepare(artifact) { + const a = artifactDefaults(artifact); + return util_1.dsse.preAuthEncoding(a.type, a.data); + } + // Packages the artifact and signature into a DSSE bundle + async package(artifact, signature) { + return (0, bundle_1.toDSSEBundle)(artifactDefaults(artifact), signature, this.certificateChain); + } +} +exports.DSSEBundleBuilder = DSSEBundleBuilder; +// Defaults the artifact type to an empty string if not provided +function artifactDefaults(artifact) { + return { + ...artifact, + type: artifact.type ?? '', + }; +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/index.js b/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/index.js new file mode 100644 index 00000000..d67c8c32 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/index.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MessageSignatureBundleBuilder = exports.DSSEBundleBuilder = void 0; +var dsse_1 = require("./dsse"); +Object.defineProperty(exports, "DSSEBundleBuilder", { enumerable: true, get: function () { return dsse_1.DSSEBundleBuilder; } }); +var message_1 = require("./message"); +Object.defineProperty(exports, "MessageSignatureBundleBuilder", { enumerable: true, get: function () { return message_1.MessageSignatureBundleBuilder; } }); diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/message.js b/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/message.js new file mode 100644 index 00000000..e3991f42 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/bundler/message.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MessageSignatureBundleBuilder = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const base_1 = require("./base"); +const bundle_1 = require("./bundle"); +// BundleBuilder implementation for raw message signatures +class MessageSignatureBundleBuilder extends base_1.BaseBundleBuilder { + constructor(options) { + super(options); + } + async package(artifact, signature) { + return (0, bundle_1.toMessageSignatureBundle)(artifact, signature); + } +} +exports.MessageSignatureBundleBuilder = MessageSignatureBundleBuilder; diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/error.js b/node_modules/npm/node_modules/@sigstore/sign/dist/error.js new file mode 100644 index 00000000..d28f1913 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/error.js @@ -0,0 +1,39 @@ +"use strict"; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.InternalError = void 0; +exports.internalError = internalError; +const error_1 = require("./external/error"); +class InternalError extends Error { + constructor({ code, message, cause, }) { + super(message); + this.name = this.constructor.name; + this.cause = cause; + this.code = code; + } +} +exports.InternalError = InternalError; +function internalError(err, code, message) { + if (err instanceof error_1.HTTPError) { + message += ` - ${err.message}`; + } + throw new InternalError({ + code: code, + message: message, + cause: err, + }); +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/external/error.js b/node_modules/npm/node_modules/@sigstore/sign/dist/external/error.js new file mode 100644 index 00000000..a6a65ade --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/external/error.js @@ -0,0 +1,26 @@ +"use strict"; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.HTTPError = void 0; +class HTTPError extends Error { + constructor({ status, message, location, }) { + super(`(${status}) ${message}`); + this.statusCode = status; + this.location = location; + } +} +exports.HTTPError = HTTPError; diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/external/fetch.js b/node_modules/npm/node_modules/@sigstore/sign/dist/external/fetch.js new file mode 100644 index 00000000..116090f3 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/external/fetch.js @@ -0,0 +1,98 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fetchWithRetry = fetchWithRetry; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const http2_1 = require("http2"); +const make_fetch_happen_1 = __importDefault(require("make-fetch-happen")); +const proc_log_1 = require("proc-log"); +const promise_retry_1 = __importDefault(require("promise-retry")); +const util_1 = require("../util"); +const error_1 = require("./error"); +const { HTTP2_HEADER_LOCATION, HTTP2_HEADER_CONTENT_TYPE, HTTP2_HEADER_USER_AGENT, HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_TOO_MANY_REQUESTS, HTTP_STATUS_REQUEST_TIMEOUT, } = http2_1.constants; +async function fetchWithRetry(url, options) { + return (0, promise_retry_1.default)(async (retry, attemptNum) => { + const method = options.method || 'POST'; + const headers = { + [HTTP2_HEADER_USER_AGENT]: util_1.ua.getUserAgent(), + ...options.headers, + }; + const response = await (0, make_fetch_happen_1.default)(url, { + method, + headers, + body: options.body, + timeout: options.timeout, + retry: false, // We're handling retries ourselves + }).catch((reason) => { + proc_log_1.log.http('fetch', `${method} ${url} attempt ${attemptNum} failed with ${reason}`); + return retry(reason); + }); + if (response.ok) { + return response; + } + else { + const error = await errorFromResponse(response); + proc_log_1.log.http('fetch', `${method} ${url} attempt ${attemptNum} failed with ${response.status}`); + if (retryable(response.status)) { + return retry(error); + } + else { + throw error; + } + } + }, retryOpts(options.retry)); +} +// Translate a Response into an HTTPError instance. This will attempt to parse +// the response body for a message, but will default to the statusText if none +// is found. +const errorFromResponse = async (response) => { + let message = response.statusText; + const location = response.headers.get(HTTP2_HEADER_LOCATION) || undefined; + const contentType = response.headers.get(HTTP2_HEADER_CONTENT_TYPE); + // If response type is JSON, try to parse the body for a message + if (contentType?.includes('application/json')) { + try { + const body = await response.json(); + message = body.message || message; + } + catch (e) { + // ignore + } + } + return new error_1.HTTPError({ + status: response.status, + message: message, + location: location, + }); +}; +// Determine if a status code is retryable. This includes 5xx errors, 408, and +// 429. +const retryable = (status) => [HTTP_STATUS_REQUEST_TIMEOUT, HTTP_STATUS_TOO_MANY_REQUESTS].includes(status) || status >= HTTP_STATUS_INTERNAL_SERVER_ERROR; +// Normalize the retry options to the format expected by promise-retry +const retryOpts = (retry) => { + if (typeof retry === 'boolean') { + return { retries: retry ? 1 : 0 }; + } + else if (typeof retry === 'number') { + return { retries: retry }; + } + else { + return { retries: 0, ...retry }; + } +}; diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/external/fulcio.js b/node_modules/npm/node_modules/@sigstore/sign/dist/external/fulcio.js new file mode 100644 index 00000000..de6a1ad9 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/external/fulcio.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Fulcio = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const fetch_1 = require("./fetch"); +/** + * Fulcio API client. + */ +class Fulcio { + constructor(options) { + this.options = options; + } + async createSigningCertificate(request) { + const { baseURL, retry, timeout } = this.options; + const url = `${baseURL}/api/v2/signingCert`; + const response = await (0, fetch_1.fetchWithRetry)(url, { + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(request), + timeout, + retry, + }); + return response.json(); + } +} +exports.Fulcio = Fulcio; diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/external/rekor.js b/node_modules/npm/node_modules/@sigstore/sign/dist/external/rekor.js new file mode 100644 index 00000000..bb59a126 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/external/rekor.js @@ -0,0 +1,80 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Rekor = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const fetch_1 = require("./fetch"); +/** + * Rekor API client. + */ +class Rekor { + constructor(options) { + this.options = options; + } + /** + * Create a new entry in the Rekor log. + * @param propsedEntry {ProposedEntry} Data to create a new entry + * @returns {Promise} The created entry + */ + async createEntry(propsedEntry) { + const { baseURL, timeout, retry } = this.options; + const url = `${baseURL}/api/v1/log/entries`; + const response = await (0, fetch_1.fetchWithRetry)(url, { + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + body: JSON.stringify(propsedEntry), + timeout, + retry, + }); + const data = await response.json(); + return entryFromResponse(data); + } + /** + * Get an entry from the Rekor log. + * @param uuid {string} The UUID of the entry to retrieve + * @returns {Promise} The retrieved entry + */ + async getEntry(uuid) { + const { baseURL, timeout, retry } = this.options; + const url = `${baseURL}/api/v1/log/entries/${uuid}`; + const response = await (0, fetch_1.fetchWithRetry)(url, { + method: 'GET', + headers: { + Accept: 'application/json', + }, + timeout, + retry, + }); + const data = await response.json(); + return entryFromResponse(data); + } +} +exports.Rekor = Rekor; +// Unpack the response from the Rekor API into a more convenient format. +function entryFromResponse(data) { + const entries = Object.entries(data); + if (entries.length != 1) { + throw new Error('Received multiple entries in Rekor response'); + } + // Grab UUID and entry data from the response + const [uuid, entry] = entries[0]; + return { + ...entry, + uuid, + }; +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/external/tsa.js b/node_modules/npm/node_modules/@sigstore/sign/dist/external/tsa.js new file mode 100644 index 00000000..a948ba9c --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/external/tsa.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TimestampAuthority = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const fetch_1 = require("./fetch"); +class TimestampAuthority { + constructor(options) { + this.options = options; + } + async createTimestamp(request) { + const { baseURL, timeout, retry } = this.options; + const url = `${baseURL}/api/v1/timestamp`; + const response = await (0, fetch_1.fetchWithRetry)(url, { + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(request), + timeout, + retry, + }); + return response.buffer(); + } +} +exports.TimestampAuthority = TimestampAuthority; diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/identity/ci.js b/node_modules/npm/node_modules/@sigstore/sign/dist/identity/ci.js new file mode 100644 index 00000000..d7913395 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/identity/ci.js @@ -0,0 +1,73 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CIContextProvider = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const make_fetch_happen_1 = __importDefault(require("make-fetch-happen")); +// Collection of all the CI-specific providers we have implemented +const providers = [getGHAToken, getEnv]; +/** + * CIContextProvider is a composite identity provider which will iterate + * over all of the CI-specific providers and return the token from the first + * one that resolves. + */ +class CIContextProvider { + /* istanbul ignore next */ + constructor(audience = 'sigstore') { + this.audience = audience; + } + // Invoke all registered ProviderFuncs and return the value of whichever one + // resolves first. + async getToken() { + return Promise.any(providers.map((getToken) => getToken(this.audience))).catch(() => Promise.reject('CI: no tokens available')); + } +} +exports.CIContextProvider = CIContextProvider; +/** + * getGHAToken can retrieve an OIDC token when running in a GitHub Actions + * workflow + */ +async function getGHAToken(audience) { + // Check to see if we're running in GitHub Actions + if (!process.env.ACTIONS_ID_TOKEN_REQUEST_URL || + !process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN) { + return Promise.reject('no token available'); + } + // Construct URL to request token w/ appropriate audience + const url = new URL(process.env.ACTIONS_ID_TOKEN_REQUEST_URL); + url.searchParams.append('audience', audience); + const response = await (0, make_fetch_happen_1.default)(url.href, { + retry: 2, + headers: { + Accept: 'application/json', + Authorization: `Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`, + }, + }); + return response.json().then((data) => data.value); +} +/** + * getEnv can retrieve an OIDC token from an environment variable. + * This matches the behavior of https://github.com/sigstore/cosign/tree/main/pkg/providers/envvar + */ +async function getEnv() { + if (!process.env.SIGSTORE_ID_TOKEN) { + return Promise.reject('no token available'); + } + return process.env.SIGSTORE_ID_TOKEN; +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/identity/index.js b/node_modules/npm/node_modules/@sigstore/sign/dist/identity/index.js new file mode 100644 index 00000000..1c1223b4 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/identity/index.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CIContextProvider = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +var ci_1 = require("./ci"); +Object.defineProperty(exports, "CIContextProvider", { enumerable: true, get: function () { return ci_1.CIContextProvider; } }); diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/identity/provider.js b/node_modules/npm/node_modules/@sigstore/sign/dist/identity/provider.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/identity/provider.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/index.js b/node_modules/npm/node_modules/@sigstore/sign/dist/index.js new file mode 100644 index 00000000..383b7608 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/index.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TSAWitness = exports.RekorWitness = exports.DEFAULT_REKOR_URL = exports.FulcioSigner = exports.DEFAULT_FULCIO_URL = exports.CIContextProvider = exports.InternalError = exports.MessageSignatureBundleBuilder = exports.DSSEBundleBuilder = void 0; +var bundler_1 = require("./bundler"); +Object.defineProperty(exports, "DSSEBundleBuilder", { enumerable: true, get: function () { return bundler_1.DSSEBundleBuilder; } }); +Object.defineProperty(exports, "MessageSignatureBundleBuilder", { enumerable: true, get: function () { return bundler_1.MessageSignatureBundleBuilder; } }); +var error_1 = require("./error"); +Object.defineProperty(exports, "InternalError", { enumerable: true, get: function () { return error_1.InternalError; } }); +var identity_1 = require("./identity"); +Object.defineProperty(exports, "CIContextProvider", { enumerable: true, get: function () { return identity_1.CIContextProvider; } }); +var signer_1 = require("./signer"); +Object.defineProperty(exports, "DEFAULT_FULCIO_URL", { enumerable: true, get: function () { return signer_1.DEFAULT_FULCIO_URL; } }); +Object.defineProperty(exports, "FulcioSigner", { enumerable: true, get: function () { return signer_1.FulcioSigner; } }); +var witness_1 = require("./witness"); +Object.defineProperty(exports, "DEFAULT_REKOR_URL", { enumerable: true, get: function () { return witness_1.DEFAULT_REKOR_URL; } }); +Object.defineProperty(exports, "RekorWitness", { enumerable: true, get: function () { return witness_1.RekorWitness; } }); +Object.defineProperty(exports, "TSAWitness", { enumerable: true, get: function () { return witness_1.TSAWitness; } }); diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ca.js b/node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ca.js new file mode 100644 index 00000000..f01703cf --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ca.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CAClient = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const error_1 = require("../../error"); +const fulcio_1 = require("../../external/fulcio"); +class CAClient { + constructor(options) { + this.fulcio = new fulcio_1.Fulcio({ + baseURL: options.fulcioBaseURL, + retry: options.retry, + timeout: options.timeout, + }); + } + async createSigningCertificate(identityToken, publicKey, challenge) { + const request = toCertificateRequest(identityToken, publicKey, challenge); + try { + const resp = await this.fulcio.createSigningCertificate(request); + // Account for the fact that the response may contain either a + // signedCertificateEmbeddedSct or a signedCertificateDetachedSct. + const cert = resp.signedCertificateEmbeddedSct + ? resp.signedCertificateEmbeddedSct + : resp.signedCertificateDetachedSct; + return cert.chain.certificates; + } + catch (err) { + (0, error_1.internalError)(err, 'CA_CREATE_SIGNING_CERTIFICATE_ERROR', 'error creating signing certificate'); + } + } +} +exports.CAClient = CAClient; +function toCertificateRequest(identityToken, publicKey, challenge) { + return { + credentials: { + oidcIdentityToken: identityToken, + }, + publicKeyRequest: { + publicKey: { + algorithm: 'ECDSA', + content: publicKey, + }, + proofOfPossession: challenge.toString('base64'), + }, + }; +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ephemeral.js b/node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ephemeral.js new file mode 100644 index 00000000..481aa5c3 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/ephemeral.js @@ -0,0 +1,45 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EphemeralSigner = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const crypto_1 = __importDefault(require("crypto")); +const EC_KEYPAIR_TYPE = 'ec'; +const P256_CURVE = 'P-256'; +// Signer implementation which uses an ephemeral keypair to sign artifacts. +// The private key lives only in memory and is tied to the lifetime of the +// EphemeralSigner instance. +class EphemeralSigner { + constructor() { + this.keypair = crypto_1.default.generateKeyPairSync(EC_KEYPAIR_TYPE, { + namedCurve: P256_CURVE, + }); + } + async sign(data) { + const signature = crypto_1.default.sign(null, data, this.keypair.privateKey); + const publicKey = this.keypair.publicKey + .export({ format: 'pem', type: 'spki' }) + .toString('ascii'); + return { + signature: signature, + key: { $case: 'publicKey', publicKey }, + }; + } +} +exports.EphemeralSigner = EphemeralSigner; diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/index.js b/node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/index.js new file mode 100644 index 00000000..89a43254 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/signer/fulcio/index.js @@ -0,0 +1,87 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FulcioSigner = exports.DEFAULT_FULCIO_URL = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const error_1 = require("../../error"); +const util_1 = require("../../util"); +const ca_1 = require("./ca"); +const ephemeral_1 = require("./ephemeral"); +exports.DEFAULT_FULCIO_URL = 'https://fulcio.sigstore.dev'; +// Signer implementation which can be used to decorate another signer +// with a Fulcio-issued signing certificate for the signer's public key. +// Must be instantiated with an identity provider which can provide a JWT +// which represents the identity to be bound to the signing certificate. +class FulcioSigner { + constructor(options) { + this.ca = new ca_1.CAClient({ + ...options, + fulcioBaseURL: options.fulcioBaseURL || /* istanbul ignore next */ exports.DEFAULT_FULCIO_URL, + }); + this.identityProvider = options.identityProvider; + this.keyHolder = options.keyHolder || new ephemeral_1.EphemeralSigner(); + } + async sign(data) { + // Retrieve identity token from the supplied identity provider + const identityToken = await this.getIdentityToken(); + // Extract challenge claim from OIDC token + let subject; + try { + subject = util_1.oidc.extractJWTSubject(identityToken); + } + catch (err) { + throw new error_1.InternalError({ + code: 'IDENTITY_TOKEN_PARSE_ERROR', + message: `invalid identity token: ${identityToken}`, + cause: err, + }); + } + // Construct challenge value by signing the subject claim + const challenge = await this.keyHolder.sign(Buffer.from(subject)); + if (challenge.key.$case !== 'publicKey') { + throw new error_1.InternalError({ + code: 'CA_CREATE_SIGNING_CERTIFICATE_ERROR', + message: 'unexpected format for signing key', + }); + } + // Create signing certificate + const certificates = await this.ca.createSigningCertificate(identityToken, challenge.key.publicKey, challenge.signature); + // Generate artifact signature + const signature = await this.keyHolder.sign(data); + // Specifically returning only the first certificate in the chain + // as the key. + return { + signature: signature.signature, + key: { + $case: 'x509Certificate', + certificate: certificates[0], + }, + }; + } + async getIdentityToken() { + try { + return await this.identityProvider.getToken(); + } + catch (err) { + throw new error_1.InternalError({ + code: 'IDENTITY_TOKEN_READ_ERROR', + message: 'error retrieving identity token', + cause: err, + }); + } + } +} +exports.FulcioSigner = FulcioSigner; diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/signer/index.js b/node_modules/npm/node_modules/@sigstore/sign/dist/signer/index.js new file mode 100644 index 00000000..e2087767 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/signer/index.js @@ -0,0 +1,22 @@ +"use strict"; +/* istanbul ignore file */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FulcioSigner = exports.DEFAULT_FULCIO_URL = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +var fulcio_1 = require("./fulcio"); +Object.defineProperty(exports, "DEFAULT_FULCIO_URL", { enumerable: true, get: function () { return fulcio_1.DEFAULT_FULCIO_URL; } }); +Object.defineProperty(exports, "FulcioSigner", { enumerable: true, get: function () { return fulcio_1.FulcioSigner; } }); diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/signer/signer.js b/node_modules/npm/node_modules/@sigstore/sign/dist/signer/signer.js new file mode 100644 index 00000000..b92c5418 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/signer/signer.js @@ -0,0 +1,17 @@ +"use strict"; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/types/fetch.js b/node_modules/npm/node_modules/@sigstore/sign/dist/types/fetch.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/types/fetch.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/util/index.js b/node_modules/npm/node_modules/@sigstore/sign/dist/util/index.js new file mode 100644 index 00000000..f467c915 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/util/index.js @@ -0,0 +1,49 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ua = exports.oidc = exports.pem = exports.json = exports.encoding = exports.dsse = exports.crypto = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +var core_1 = require("@sigstore/core"); +Object.defineProperty(exports, "crypto", { enumerable: true, get: function () { return core_1.crypto; } }); +Object.defineProperty(exports, "dsse", { enumerable: true, get: function () { return core_1.dsse; } }); +Object.defineProperty(exports, "encoding", { enumerable: true, get: function () { return core_1.encoding; } }); +Object.defineProperty(exports, "json", { enumerable: true, get: function () { return core_1.json; } }); +Object.defineProperty(exports, "pem", { enumerable: true, get: function () { return core_1.pem; } }); +exports.oidc = __importStar(require("./oidc")); +exports.ua = __importStar(require("./ua")); diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/util/oidc.js b/node_modules/npm/node_modules/@sigstore/sign/dist/util/oidc.js new file mode 100644 index 00000000..37c5b168 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/util/oidc.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extractJWTSubject = extractJWTSubject; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const core_1 = require("@sigstore/core"); +function extractJWTSubject(jwt) { + const parts = jwt.split('.', 3); + const payload = JSON.parse(core_1.encoding.base64Decode(parts[1])); + switch (payload.iss) { + case 'https://accounts.google.com': + case 'https://oauth2.sigstore.dev/auth': + return payload.email; + default: + return payload.sub; + } +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/util/ua.js b/node_modules/npm/node_modules/@sigstore/sign/dist/util/ua.js new file mode 100644 index 00000000..b15ff207 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/util/ua.js @@ -0,0 +1,32 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getUserAgent = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const os_1 = __importDefault(require("os")); +// Format User-Agent: / () +// source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent +const getUserAgent = () => { + const packageVersion = require('../../package.json').version; + const nodeVersion = process.version; + const platformName = os_1.default.platform(); + const archName = os_1.default.arch(); + return `sigstore-js/${packageVersion} (Node ${nodeVersion}) (${platformName}/${archName})`; +}; +exports.getUserAgent = getUserAgent; diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/witness/index.js b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/index.js new file mode 100644 index 00000000..72677c39 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/index.js @@ -0,0 +1,24 @@ +"use strict"; +/* istanbul ignore file */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TSAWitness = exports.RekorWitness = exports.DEFAULT_REKOR_URL = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +var tlog_1 = require("./tlog"); +Object.defineProperty(exports, "DEFAULT_REKOR_URL", { enumerable: true, get: function () { return tlog_1.DEFAULT_REKOR_URL; } }); +Object.defineProperty(exports, "RekorWitness", { enumerable: true, get: function () { return tlog_1.RekorWitness; } }); +var tsa_1 = require("./tsa"); +Object.defineProperty(exports, "TSAWitness", { enumerable: true, get: function () { return tsa_1.TSAWitness; } }); diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/client.js b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/client.js new file mode 100644 index 00000000..22c895f2 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/client.js @@ -0,0 +1,61 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TLogClient = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const error_1 = require("../../error"); +const error_2 = require("../../external/error"); +const rekor_1 = require("../../external/rekor"); +class TLogClient { + constructor(options) { + this.fetchOnConflict = options.fetchOnConflict ?? false; + this.rekor = new rekor_1.Rekor({ + baseURL: options.rekorBaseURL, + retry: options.retry, + timeout: options.timeout, + }); + } + async createEntry(proposedEntry) { + let entry; + try { + entry = await this.rekor.createEntry(proposedEntry); + } + catch (err) { + // If the entry already exists, fetch it (if enabled) + if (entryExistsError(err) && this.fetchOnConflict) { + // Grab the UUID of the existing entry from the location header + /* istanbul ignore next */ + const uuid = err.location.split('/').pop() || ''; + try { + entry = await this.rekor.getEntry(uuid); + } + catch (err) { + (0, error_1.internalError)(err, 'TLOG_FETCH_ENTRY_ERROR', 'error fetching tlog entry'); + } + } + else { + (0, error_1.internalError)(err, 'TLOG_CREATE_ENTRY_ERROR', 'error creating tlog entry'); + } + } + return entry; + } +} +exports.TLogClient = TLogClient; +function entryExistsError(value) { + return (value instanceof error_2.HTTPError && + value.statusCode === 409 && + value.location !== undefined); +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/entry.js b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/entry.js new file mode 100644 index 00000000..bb1c68e9 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/entry.js @@ -0,0 +1,140 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toProposedEntry = toProposedEntry; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const bundle_1 = require("@sigstore/bundle"); +const util_1 = require("../../util"); +const SHA256_ALGORITHM = 'sha256'; +function toProposedEntry(content, publicKey, +// TODO: Remove this parameter once have completely switched to 'dsse' entries +entryType = 'dsse') { + switch (content.$case) { + case 'dsseEnvelope': + // TODO: Remove this conditional once have completely ditched "intoto" entries + if (entryType === 'intoto') { + return toProposedIntotoEntry(content.dsseEnvelope, publicKey); + } + return toProposedDSSEEntry(content.dsseEnvelope, publicKey); + case 'messageSignature': + return toProposedHashedRekordEntry(content.messageSignature, publicKey); + } +} +// Returns a properly formatted Rekor "hashedrekord" entry for the given digest +// and signature +function toProposedHashedRekordEntry(messageSignature, publicKey) { + const hexDigest = messageSignature.messageDigest.digest.toString('hex'); + const b64Signature = messageSignature.signature.toString('base64'); + const b64Key = util_1.encoding.base64Encode(publicKey); + return { + apiVersion: '0.0.1', + kind: 'hashedrekord', + spec: { + data: { + hash: { + algorithm: SHA256_ALGORITHM, + value: hexDigest, + }, + }, + signature: { + content: b64Signature, + publicKey: { + content: b64Key, + }, + }, + }, + }; +} +// Returns a properly formatted Rekor "dsse" entry for the given DSSE envelope +// and signature +function toProposedDSSEEntry(envelope, publicKey) { + const envelopeJSON = JSON.stringify((0, bundle_1.envelopeToJSON)(envelope)); + const encodedKey = util_1.encoding.base64Encode(publicKey); + return { + apiVersion: '0.0.1', + kind: 'dsse', + spec: { + proposedContent: { + envelope: envelopeJSON, + verifiers: [encodedKey], + }, + }, + }; +} +// Returns a properly formatted Rekor "intoto" entry for the given DSSE +// envelope and signature +function toProposedIntotoEntry(envelope, publicKey) { + // Calculate the value for the payloadHash field in the Rekor entry + const payloadHash = util_1.crypto + .digest(SHA256_ALGORITHM, envelope.payload) + .toString('hex'); + // Calculate the value for the hash field in the Rekor entry + const envelopeHash = calculateDSSEHash(envelope, publicKey); + // Collect values for re-creating the DSSE envelope. + // Double-encode payload and signature cause that's what Rekor expects + const payload = util_1.encoding.base64Encode(envelope.payload.toString('base64')); + const sig = util_1.encoding.base64Encode(envelope.signatures[0].sig.toString('base64')); + const keyid = envelope.signatures[0].keyid; + const encodedKey = util_1.encoding.base64Encode(publicKey); + // Create the envelope portion of the entry. Note the inclusion of the + // publicKey in the signature struct is not a standard part of a DSSE + // envelope, but is required by Rekor. + const dsse = { + payloadType: envelope.payloadType, + payload: payload, + signatures: [{ sig, publicKey: encodedKey }], + }; + // If the keyid is an empty string, Rekor seems to remove it altogether. We + // need to do the same here so that we can properly recreate the entry for + // verification. + if (keyid.length > 0) { + dsse.signatures[0].keyid = keyid; + } + return { + apiVersion: '0.0.2', + kind: 'intoto', + spec: { + content: { + envelope: dsse, + hash: { algorithm: SHA256_ALGORITHM, value: envelopeHash }, + payloadHash: { algorithm: SHA256_ALGORITHM, value: payloadHash }, + }, + }, + }; +} +// Calculates the hash of a DSSE envelope for inclusion in a Rekor entry. +// There is no standard way to do this, so the scheme we're using as as +// follows: +// * payload is base64 encoded +// * signature is base64 encoded (only the first signature is used) +// * keyid is included ONLY if it is NOT an empty string +// * The resulting JSON is canonicalized and hashed to a hex string +function calculateDSSEHash(envelope, publicKey) { + const dsse = { + payloadType: envelope.payloadType, + payload: envelope.payload.toString('base64'), + signatures: [ + { sig: envelope.signatures[0].sig.toString('base64'), publicKey }, + ], + }; + // If the keyid is an empty string, Rekor seems to remove it altogether. + if (envelope.signatures[0].keyid.length > 0) { + dsse.signatures[0].keyid = envelope.signatures[0].keyid; + } + return util_1.crypto + .digest(SHA256_ALGORITHM, util_1.json.canonicalize(dsse)) + .toString('hex'); +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/index.js b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/index.js new file mode 100644 index 00000000..6197b09d --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tlog/index.js @@ -0,0 +1,82 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RekorWitness = exports.DEFAULT_REKOR_URL = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const util_1 = require("../../util"); +const client_1 = require("./client"); +const entry_1 = require("./entry"); +exports.DEFAULT_REKOR_URL = 'https://rekor.sigstore.dev'; +class RekorWitness { + constructor(options) { + this.entryType = options.entryType; + this.tlog = new client_1.TLogClient({ + ...options, + rekorBaseURL: options.rekorBaseURL || /* istanbul ignore next */ exports.DEFAULT_REKOR_URL, + }); + } + async testify(content, publicKey) { + const proposedEntry = (0, entry_1.toProposedEntry)(content, publicKey, this.entryType); + const entry = await this.tlog.createEntry(proposedEntry); + return toTransparencyLogEntry(entry); + } +} +exports.RekorWitness = RekorWitness; +function toTransparencyLogEntry(entry) { + const logID = Buffer.from(entry.logID, 'hex'); + // Parse entry body so we can extract the kind and version. + const bodyJSON = util_1.encoding.base64Decode(entry.body); + const entryBody = JSON.parse(bodyJSON); + const promise = entry?.verification?.signedEntryTimestamp + ? inclusionPromise(entry.verification.signedEntryTimestamp) + : undefined; + const proof = entry?.verification?.inclusionProof + ? inclusionProof(entry.verification.inclusionProof) + : undefined; + const tlogEntry = { + logIndex: entry.logIndex.toString(), + logId: { + keyId: logID, + }, + integratedTime: entry.integratedTime.toString(), + kindVersion: { + kind: entryBody.kind, + version: entryBody.apiVersion, + }, + inclusionPromise: promise, + inclusionProof: proof, + canonicalizedBody: Buffer.from(entry.body, 'base64'), + }; + return { + tlogEntries: [tlogEntry], + }; +} +function inclusionPromise(promise) { + return { + signedEntryTimestamp: Buffer.from(promise, 'base64'), + }; +} +function inclusionProof(proof) { + return { + logIndex: proof.logIndex.toString(), + treeSize: proof.treeSize.toString(), + rootHash: Buffer.from(proof.rootHash, 'hex'), + hashes: proof.hashes.map((h) => Buffer.from(h, 'hex')), + checkpoint: { + envelope: proof.checkpoint, + }, + }; +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tsa/client.js b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tsa/client.js new file mode 100644 index 00000000..754de374 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tsa/client.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TSAClient = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const error_1 = require("../../error"); +const tsa_1 = require("../../external/tsa"); +const util_1 = require("../../util"); +const SHA256_ALGORITHM = 'sha256'; +class TSAClient { + constructor(options) { + this.tsa = new tsa_1.TimestampAuthority({ + baseURL: options.tsaBaseURL, + retry: options.retry, + timeout: options.timeout, + }); + } + async createTimestamp(signature) { + const request = { + artifactHash: util_1.crypto + .digest(SHA256_ALGORITHM, signature) + .toString('base64'), + hashAlgorithm: SHA256_ALGORITHM, + }; + try { + return await this.tsa.createTimestamp(request); + } + catch (err) { + (0, error_1.internalError)(err, 'TSA_CREATE_TIMESTAMP_ERROR', 'error creating timestamp'); + } + } +} +exports.TSAClient = TSAClient; diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tsa/index.js b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tsa/index.js new file mode 100644 index 00000000..d4f5c7c8 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/tsa/index.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TSAWitness = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const client_1 = require("./client"); +class TSAWitness { + constructor(options) { + this.tsa = new client_1.TSAClient({ + tsaBaseURL: options.tsaBaseURL, + retry: options.retry, + timeout: options.timeout, + }); + } + async testify(content) { + const signature = extractSignature(content); + const timestamp = await this.tsa.createTimestamp(signature); + return { + rfc3161Timestamps: [{ signedTimestamp: timestamp }], + }; + } +} +exports.TSAWitness = TSAWitness; +function extractSignature(content) { + switch (content.$case) { + case 'dsseEnvelope': + return content.dsseEnvelope.signatures[0].sig; + case 'messageSignature': + return content.messageSignature.signature; + } +} diff --git a/node_modules/npm/node_modules/@sigstore/sign/dist/witness/witness.js b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/witness.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/dist/witness/witness.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/npm/node_modules/@sigstore/sign/package.json b/node_modules/npm/node_modules/@sigstore/sign/package.json new file mode 100644 index 00000000..fe05e8dc --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/sign/package.json @@ -0,0 +1,46 @@ +{ + "name": "@sigstore/sign", + "version": "3.0.0", + "description": "Sigstore signing library", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "clean": "shx rm -rf dist *.tsbuildinfo", + "build": "tsc --build", + "test": "jest" + }, + "files": [ + "dist" + ], + "author": "bdehamer@github.com", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/sigstore/sigstore-js.git" + }, + "bugs": { + "url": "https://github.com/sigstore/sigstore-js/issues" + }, + "homepage": "https://github.com/sigstore/sigstore-js/tree/main/packages/sign#readme", + "publishConfig": { + "provenance": true + }, + "devDependencies": { + "@sigstore/jest": "^0.0.0", + "@sigstore/mock": "^0.8.0", + "@sigstore/rekor-types": "^3.0.0", + "@types/make-fetch-happen": "^10.0.4", + "@types/promise-retry": "^1.1.6" + }, + "dependencies": { + "@sigstore/bundle": "^3.0.0", + "@sigstore/core": "^2.0.0", + "@sigstore/protobuf-specs": "^0.3.2", + "make-fetch-happen": "^14.0.1", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } +} diff --git a/node_modules/npm/node_modules/@sigstore/tuf/LICENSE b/node_modules/npm/node_modules/@sigstore/tuf/LICENSE new file mode 100644 index 00000000..e9e7c167 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/tuf/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 The Sigstore Authors + + 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. diff --git a/node_modules/npm/node_modules/@sigstore/tuf/dist/appdata.js b/node_modules/npm/node_modules/@sigstore/tuf/dist/appdata.js new file mode 100644 index 00000000..06a8143e --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/tuf/dist/appdata.js @@ -0,0 +1,43 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.appDataPath = appDataPath; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const os_1 = __importDefault(require("os")); +const path_1 = __importDefault(require("path")); +function appDataPath(name) { + const homedir = os_1.default.homedir(); + switch (process.platform) { + /* istanbul ignore next */ + case 'darwin': { + const appSupport = path_1.default.join(homedir, 'Library', 'Application Support'); + return path_1.default.join(appSupport, name); + } + /* istanbul ignore next */ + case 'win32': { + const localAppData = process.env.LOCALAPPDATA || path_1.default.join(homedir, 'AppData', 'Local'); + return path_1.default.join(localAppData, name, 'Data'); + } + /* istanbul ignore next */ + default: { + const localData = process.env.XDG_DATA_HOME || path_1.default.join(homedir, '.local', 'share'); + return path_1.default.join(localData, name); + } + } +} diff --git a/node_modules/npm/node_modules/@sigstore/tuf/dist/client.js b/node_modules/npm/node_modules/@sigstore/tuf/dist/client.js new file mode 100644 index 00000000..328f49e4 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/tuf/dist/client.js @@ -0,0 +1,111 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TUFClient = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const fs_1 = __importDefault(require("fs")); +const path_1 = __importDefault(require("path")); +const tuf_js_1 = require("tuf-js"); +const _1 = require("."); +const target_1 = require("./target"); +const TARGETS_DIR_NAME = 'targets'; +class TUFClient { + constructor(options) { + const url = new URL(options.mirrorURL); + const repoName = encodeURIComponent(url.host + url.pathname.replace(/\/$/, '')); + const cachePath = path_1.default.join(options.cachePath, repoName); + initTufCache(cachePath); + seedCache({ + cachePath, + mirrorURL: options.mirrorURL, + tufRootPath: options.rootPath, + forceInit: options.forceInit, + }); + this.updater = initClient({ + mirrorURL: options.mirrorURL, + cachePath, + forceCache: options.forceCache, + retry: options.retry, + timeout: options.timeout, + }); + } + async refresh() { + return this.updater.refresh(); + } + getTarget(targetName) { + return (0, target_1.readTarget)(this.updater, targetName); + } +} +exports.TUFClient = TUFClient; +// Initializes the TUF cache directory structure including the initial +// root.json file. If the cache directory does not exist, it will be +// created. If the targets directory does not exist, it will be created. +// If the root.json file does not exist, it will be copied from the +// rootPath argument. +function initTufCache(cachePath) { + const targetsPath = path_1.default.join(cachePath, TARGETS_DIR_NAME); + if (!fs_1.default.existsSync(cachePath)) { + fs_1.default.mkdirSync(cachePath, { recursive: true }); + } + if (!fs_1.default.existsSync(targetsPath)) { + fs_1.default.mkdirSync(targetsPath); + } +} +// Populates the TUF cache with the initial root.json file. If the root.json +// file does not exist (or we're forcing re-initialization), copy it from either +// the rootPath argument or from one of the repo seeds. +function seedCache({ cachePath, mirrorURL, tufRootPath, forceInit, }) { + const cachedRootPath = path_1.default.join(cachePath, 'root.json'); + // If the root.json file does not exist (or we're forcing re-initialization), + // populate it either from the supplied rootPath or from one of the repo seeds. + if (!fs_1.default.existsSync(cachedRootPath) || forceInit) { + if (tufRootPath) { + fs_1.default.copyFileSync(tufRootPath, cachedRootPath); + } + else { + const seeds = require('../seeds.json'); + const repoSeed = seeds[mirrorURL]; + if (!repoSeed) { + throw new _1.TUFError({ + code: 'TUF_INIT_CACHE_ERROR', + message: `No root.json found for mirror: ${mirrorURL}`, + }); + } + fs_1.default.writeFileSync(cachedRootPath, Buffer.from(repoSeed['root.json'], 'base64')); + // Copy any seed targets into the cache + Object.entries(repoSeed.targets).forEach(([targetName, target]) => { + fs_1.default.writeFileSync(path_1.default.join(cachePath, TARGETS_DIR_NAME, targetName), Buffer.from(target, 'base64')); + }); + } + } +} +function initClient(options) { + const config = { + fetchTimeout: options.timeout, + fetchRetry: options.retry, + }; + return new tuf_js_1.Updater({ + metadataBaseUrl: options.mirrorURL, + targetBaseUrl: `${options.mirrorURL}/targets`, + metadataDir: options.cachePath, + targetDir: path_1.default.join(options.cachePath, TARGETS_DIR_NAME), + forceCache: options.forceCache, + config, + }); +} diff --git a/node_modules/npm/node_modules/@sigstore/tuf/dist/error.js b/node_modules/npm/node_modules/@sigstore/tuf/dist/error.js new file mode 100644 index 00000000..e13971b2 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/tuf/dist/error.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TUFError = void 0; +class TUFError extends Error { + constructor({ code, message, cause, }) { + super(message); + this.code = code; + this.cause = cause; + this.name = this.constructor.name; + } +} +exports.TUFError = TUFError; diff --git a/node_modules/npm/node_modules/@sigstore/tuf/dist/index.js b/node_modules/npm/node_modules/@sigstore/tuf/dist/index.js new file mode 100644 index 00000000..2af5de93 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/tuf/dist/index.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TUFError = exports.DEFAULT_MIRROR_URL = void 0; +exports.getTrustedRoot = getTrustedRoot; +exports.initTUF = initTUF; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const protobuf_specs_1 = require("@sigstore/protobuf-specs"); +const appdata_1 = require("./appdata"); +const client_1 = require("./client"); +exports.DEFAULT_MIRROR_URL = 'https://tuf-repo-cdn.sigstore.dev'; +const DEFAULT_CACHE_DIR = 'sigstore-js'; +const DEFAULT_RETRY = { retries: 2 }; +const DEFAULT_TIMEOUT = 5000; +const TRUSTED_ROOT_TARGET = 'trusted_root.json'; +async function getTrustedRoot( +/* istanbul ignore next */ +options = {}) { + const client = createClient(options); + const trustedRoot = await client.getTarget(TRUSTED_ROOT_TARGET); + return protobuf_specs_1.TrustedRoot.fromJSON(JSON.parse(trustedRoot)); +} +async function initTUF( +/* istanbul ignore next */ +options = {}) { + const client = createClient(options); + return client.refresh().then(() => client); +} +// Create a TUF client with default options +function createClient(options) { + /* istanbul ignore next */ + return new client_1.TUFClient({ + cachePath: options.cachePath || (0, appdata_1.appDataPath)(DEFAULT_CACHE_DIR), + rootPath: options.rootPath, + mirrorURL: options.mirrorURL || exports.DEFAULT_MIRROR_URL, + retry: options.retry ?? DEFAULT_RETRY, + timeout: options.timeout ?? DEFAULT_TIMEOUT, + forceCache: options.forceCache ?? false, + forceInit: options.forceInit ?? options.force ?? false, + }); +} +var error_1 = require("./error"); +Object.defineProperty(exports, "TUFError", { enumerable: true, get: function () { return error_1.TUFError; } }); diff --git a/node_modules/npm/node_modules/@sigstore/tuf/dist/target.js b/node_modules/npm/node_modules/@sigstore/tuf/dist/target.js new file mode 100644 index 00000000..5c6675bd --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/tuf/dist/target.js @@ -0,0 +1,79 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.readTarget = readTarget; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const fs_1 = __importDefault(require("fs")); +const error_1 = require("./error"); +// Downloads and returns the specified target from the provided TUF Updater. +async function readTarget(tuf, targetPath) { + const path = await getTargetPath(tuf, targetPath); + return new Promise((resolve, reject) => { + fs_1.default.readFile(path, 'utf-8', (err, data) => { + if (err) { + reject(new error_1.TUFError({ + code: 'TUF_READ_TARGET_ERROR', + message: `error reading target ${path}`, + cause: err, + })); + } + else { + resolve(data); + } + }); + }); +} +// Returns the local path to the specified target. If the target is not yet +// cached locally, the provided TUF Updater will be used to download and +// cache the target. +async function getTargetPath(tuf, target) { + let targetInfo; + try { + targetInfo = await tuf.getTargetInfo(target); + } + catch (err) { + throw new error_1.TUFError({ + code: 'TUF_REFRESH_METADATA_ERROR', + message: 'error refreshing TUF metadata', + cause: err, + }); + } + if (!targetInfo) { + throw new error_1.TUFError({ + code: 'TUF_FIND_TARGET_ERROR', + message: `target ${target} not found`, + }); + } + let path = await tuf.findCachedTarget(targetInfo); + // An empty path here means the target has not been cached locally, or is + // out of date. In either case, we need to download it. + if (!path) { + try { + path = await tuf.downloadTarget(targetInfo); + } + catch (err) { + throw new error_1.TUFError({ + code: 'TUF_DOWNLOAD_TARGET_ERROR', + message: `error downloading target ${path}`, + cause: err, + }); + } + } + return path; +} diff --git a/node_modules/npm/node_modules/@sigstore/tuf/package.json b/node_modules/npm/node_modules/@sigstore/tuf/package.json new file mode 100644 index 00000000..808689df --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/tuf/package.json @@ -0,0 +1,41 @@ +{ + "name": "@sigstore/tuf", + "version": "3.0.0", + "description": "Client for the Sigstore TUF repository", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "clean": "shx rm -rf dist *.tsbuildinfo", + "build": "tsc --build", + "test": "jest" + }, + "files": [ + "dist", + "seeds.json" + ], + "author": "bdehamer@github.com", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/sigstore/sigstore-js.git" + }, + "bugs": { + "url": "https://github.com/sigstore/sigstore-js/issues" + }, + "homepage": "https://github.com/sigstore/sigstore-js/tree/main/packages/tuf#readme", + "publishConfig": { + "provenance": true + }, + "devDependencies": { + "@sigstore/jest": "^0.0.0", + "@tufjs/repo-mock": "^3.0.1", + "@types/make-fetch-happen": "^10.0.4" + }, + "dependencies": { + "@sigstore/protobuf-specs": "^0.3.2", + "tuf-js": "^3.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } +} diff --git a/node_modules/npm/node_modules/@sigstore/tuf/seeds.json b/node_modules/npm/node_modules/@sigstore/tuf/seeds.json new file mode 100644 index 00000000..d1d3c6b5 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/tuf/seeds.json @@ -0,0 +1 @@ +{"https://tuf-repo-cdn.sigstore.dev":{"root.json":"ewogInNpZ25hdHVyZXMiOiBbCiAgewogICAia2V5aWQiOiAiNmYyNjAwODlkNTkyM2RhZjIwMTY2Y2E2NTdjNTQzYWY2MTgzNDZhYjk3MTg4NGE5OTk2MmIwMTk4OGJiZTBjMyIsCiAgICJzaWciOiAiMzA0NjAyMjEwMDhhYjFmNmYxN2Q0ZjllNmQ3ZGNmMWM4ODkxMmI2YjUzY2MxMDM4ODY0NGFlMWYwOWJjMzdhMDgyY2QwNjAwM2UwMjIxMDBlMTQ1ZWY0YzdiNzgyZDRlODEwN2I1MzQzN2U2NjlkMDQ3Njg5MmNlOTk5OTAzYWUzM2QxNDQ0ODM2Njk5NmU3IgogIH0sCiAgewogICAia2V5aWQiOiAiZTcxYTU0ZDU0MzgzNWJhODZhZGFkOTQ2MDM3OWM3NjQxZmI4NzI2ZDE2NGVhNzY2ODAxYTFjNTIyYWJhN2VhMiIsCiAgICJzaWciOiAiMzA0NTAyMjEwMGM3NjhiMmY4NmRhOTk1NjkwMTljMTYwYTA4MWRhNTRhZTM2YzM0YzBhMzEyMGQzY2I2OWI1M2I3ZDExMzc1OGUwMjIwNGY2NzE1MThmNjE3YjIwZDQ2NTM3ZmFlNmMzYjYzYmFlODkxM2Y0ZjE5NjIxNTYxMDVjYzRmMDE5YWMzNWM2YSIKICB9LAogIHsKICAgImtleWlkIjogIjIyZjRjYWVjNmQ4ZTZmOTU1NWFmNjZiM2Q0YzNjYjA2YTNiYjIzZmRjN2UzOWM5MTZjNjFmNDYyZTZmNTJiMDYiLAogICAic2lnIjogIjMwNDUwMjIxMDBiNDQzNGU2OTk1ZDM2OGQyM2U3NDc1OWFjZDBjYjkwMTNjODNhNWQzNTExZjBmOTk3ZWM1NGM0N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FqeHlIL2xxL3d6K1F3Q2dZSUtvWkl6ajBFQXdNRGFBQXdaUUl4QUxaTFo4QmdSWHpLeExNTU45VklsTytlNGhyQm5OQmdGN3R6N0hucm93djJOZXRaRXJJQUNLRnltQmx2V0R2dE1BSXdaTytraTZzc1ExYnNabzk4TzhtRUFmMk5aN2lpQ2dERFUwVndqZWNvNnp5ZWgwekJUczkvN2dWNkFITlE1M3hEIgogICAgICAgICAgfQogICAgICAgIF0KICAgICAgfSwKICAgICAgInZhbGlkRm9yIjogewogICAgICAgICJzdGFydCI6ICIyMDIzLTA0LTE0VDAwOjAwOjAwLjAwMFoiCiAgICAgIH0KICAgIH0KICBdCn0K","registry.npmjs.org%2Fkeys.json":"ewogICAgImtleXMiOiBbCiAgICAgICAgewogICAgICAgICAgICAia2V5SWQiOiAiU0hBMjU2OmpsM2J3c3d1ODBQampva0NnaDBvMnc1YzJVNExoUUFFNTdnajljejFrekEiLAogICAgICAgICAgICAia2V5VXNhZ2UiOiAibnBtOnNpZ25hdHVyZXMiLAogICAgICAgICAgICAicHVibGljS2V5IjogewogICAgICAgICAgICAgICAgInJhd0J5dGVzIjogIk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRTFPbGIzek1BRkZ4WEtIaUlrUU81Y0ozWWhsNWk2VVBwK0lodXRlQkpidUhjQTVVb2dLbzBFV3RsV3dXNktTYUtvVE5FWUw3SmxDUWlWbmtoQmt0VWdnPT0iLAogICAgICAgICAgICAgICAgImtleURldGFpbHMiOiAiUEtJWF9FQ0RTQV9QMjU2X1NIQV8yNTYiLAogICAgICAgICAgICAgICAgInZhbGlkRm9yIjogewogICAgICAgICAgICAgICAgICAgICJzdGFydCI6ICIxOTk5LTAxLTAxVDAwOjAwOjAwLjAwMFoiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImtleUlkIjogIlNIQTI1NjpqbDNid3N3dTgwUGpqb2tDZ2gwbzJ3NWMyVTRMaFFBRTU3Z2o5Y3oxa3pBIiwKICAgICAgICAgICAgImtleVVzYWdlIjogIm5wbTphdHRlc3RhdGlvbnMiLAogICAgICAgICAgICAicHVibGljS2V5IjogewogICAgICAgICAgICAgICAgInJhd0J5dGVzIjogIk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRTFPbGIzek1BRkZ4WEtIaUlrUU81Y0ozWWhsNWk2VVBwK0lodXRlQkpidUhjQTVVb2dLbzBFV3RsV3dXNktTYUtvVE5FWUw3SmxDUWlWbmtoQmt0VWdnPT0iLAogICAgICAgICAgICAgICAgImtleURldGFpbHMiOiAiUEtJWF9FQ0RTQV9QMjU2X1NIQV8yNTYiLAogICAgICAgICAgICAgICAgInZhbGlkRm9yIjogewogICAgICAgICAgICAgICAgICAgICJzdGFydCI6ICIyMDIyLTEyLTAxVDAwOjAwOjAwLjAwMFoiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICBdCn0K"}}} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/bundle/dsse.js b/node_modules/npm/node_modules/@sigstore/verify/dist/bundle/dsse.js new file mode 100644 index 00000000..1033fc42 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/bundle/dsse.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DSSESignatureContent = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const core_1 = require("@sigstore/core"); +class DSSESignatureContent { + constructor(env) { + this.env = env; + } + compareDigest(digest) { + return core_1.crypto.bufferEqual(digest, core_1.crypto.digest('sha256', this.env.payload)); + } + compareSignature(signature) { + return core_1.crypto.bufferEqual(signature, this.signature); + } + verifySignature(key) { + return core_1.crypto.verify(this.preAuthEncoding, key, this.signature); + } + get signature() { + return this.env.signatures.length > 0 + ? this.env.signatures[0].sig + : Buffer.from(''); + } + // DSSE Pre-Authentication Encoding + get preAuthEncoding() { + return core_1.dsse.preAuthEncoding(this.env.payloadType, this.env.payload); + } +} +exports.DSSESignatureContent = DSSESignatureContent; diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/bundle/index.js b/node_modules/npm/node_modules/@sigstore/verify/dist/bundle/index.js new file mode 100644 index 00000000..4287d803 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/bundle/index.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toSignedEntity = toSignedEntity; +exports.signatureContent = signatureContent; +const core_1 = require("@sigstore/core"); +const dsse_1 = require("./dsse"); +const message_1 = require("./message"); +function toSignedEntity(bundle, artifact) { + const { tlogEntries, timestampVerificationData } = bundle.verificationMaterial; + const timestamps = []; + for (const entry of tlogEntries) { + timestamps.push({ + $case: 'transparency-log', + tlogEntry: entry, + }); + } + for (const ts of timestampVerificationData?.rfc3161Timestamps ?? []) { + timestamps.push({ + $case: 'timestamp-authority', + timestamp: core_1.RFC3161Timestamp.parse(ts.signedTimestamp), + }); + } + return { + signature: signatureContent(bundle, artifact), + key: key(bundle), + tlogEntries, + timestamps, + }; +} +function signatureContent(bundle, artifact) { + switch (bundle.content.$case) { + case 'dsseEnvelope': + return new dsse_1.DSSESignatureContent(bundle.content.dsseEnvelope); + case 'messageSignature': + return new message_1.MessageSignatureContent(bundle.content.messageSignature, artifact); + } +} +function key(bundle) { + switch (bundle.verificationMaterial.content.$case) { + case 'publicKey': + return { + $case: 'public-key', + hint: bundle.verificationMaterial.content.publicKey.hint, + }; + case 'x509CertificateChain': + return { + $case: 'certificate', + certificate: core_1.X509Certificate.parse(bundle.verificationMaterial.content.x509CertificateChain + .certificates[0].rawBytes), + }; + case 'certificate': + return { + $case: 'certificate', + certificate: core_1.X509Certificate.parse(bundle.verificationMaterial.content.certificate.rawBytes), + }; + } +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/bundle/message.js b/node_modules/npm/node_modules/@sigstore/verify/dist/bundle/message.js new file mode 100644 index 00000000..836148c6 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/bundle/message.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MessageSignatureContent = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const core_1 = require("@sigstore/core"); +class MessageSignatureContent { + constructor(messageSignature, artifact) { + this.signature = messageSignature.signature; + this.messageDigest = messageSignature.messageDigest.digest; + this.artifact = artifact; + } + compareSignature(signature) { + return core_1.crypto.bufferEqual(signature, this.signature); + } + compareDigest(digest) { + return core_1.crypto.bufferEqual(digest, this.messageDigest); + } + verifySignature(key) { + return core_1.crypto.verify(this.artifact, key, this.signature); + } +} +exports.MessageSignatureContent = MessageSignatureContent; diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/error.js b/node_modules/npm/node_modules/@sigstore/verify/dist/error.js new file mode 100644 index 00000000..6cb1cd41 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/error.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PolicyError = exports.VerificationError = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +class BaseError extends Error { + constructor({ code, message, cause, }) { + super(message); + this.code = code; + this.cause = cause; + this.name = this.constructor.name; + } +} +class VerificationError extends BaseError { +} +exports.VerificationError = VerificationError; +class PolicyError extends BaseError { +} +exports.PolicyError = PolicyError; diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/index.js b/node_modules/npm/node_modules/@sigstore/verify/dist/index.js new file mode 100644 index 00000000..3222876f --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/index.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Verifier = exports.toTrustMaterial = exports.VerificationError = exports.PolicyError = exports.toSignedEntity = void 0; +/* istanbul ignore file */ +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +var bundle_1 = require("./bundle"); +Object.defineProperty(exports, "toSignedEntity", { enumerable: true, get: function () { return bundle_1.toSignedEntity; } }); +var error_1 = require("./error"); +Object.defineProperty(exports, "PolicyError", { enumerable: true, get: function () { return error_1.PolicyError; } }); +Object.defineProperty(exports, "VerificationError", { enumerable: true, get: function () { return error_1.VerificationError; } }); +var trust_1 = require("./trust"); +Object.defineProperty(exports, "toTrustMaterial", { enumerable: true, get: function () { return trust_1.toTrustMaterial; } }); +var verifier_1 = require("./verifier"); +Object.defineProperty(exports, "Verifier", { enumerable: true, get: function () { return verifier_1.Verifier; } }); diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/key/certificate.js b/node_modules/npm/node_modules/@sigstore/verify/dist/key/certificate.js new file mode 100644 index 00000000..a916de0e --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/key/certificate.js @@ -0,0 +1,205 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CertificateChainVerifier = void 0; +exports.verifyCertificateChain = verifyCertificateChain; +const error_1 = require("../error"); +const trust_1 = require("../trust"); +function verifyCertificateChain(leaf, certificateAuthorities) { + // Filter list of trusted CAs to those which are valid for the given + // leaf certificate. + const cas = (0, trust_1.filterCertAuthorities)(certificateAuthorities, { + start: leaf.notBefore, + end: leaf.notAfter, + }); + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ + let error; + for (const ca of cas) { + try { + const verifier = new CertificateChainVerifier({ + trustedCerts: ca.certChain, + untrustedCert: leaf, + }); + return verifier.verify(); + } + catch (err) { + error = err; + } + } + // If we failed to verify the certificate chain for all of the trusted + // CAs, throw the last error we encountered. + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: 'Failed to verify certificate chain', + cause: error, + }); +} +class CertificateChainVerifier { + constructor(opts) { + this.untrustedCert = opts.untrustedCert; + this.trustedCerts = opts.trustedCerts; + this.localCerts = dedupeCertificates([ + ...opts.trustedCerts, + opts.untrustedCert, + ]); + } + verify() { + // Construct certificate path from leaf to root + const certificatePath = this.sort(); + // Perform validation checks on each certificate in the path + this.checkPath(certificatePath); + // Return verified certificate path + return certificatePath; + } + sort() { + const leafCert = this.untrustedCert; + // Construct all possible paths from the leaf + let paths = this.buildPaths(leafCert); + // Filter for paths which contain a trusted certificate + paths = paths.filter((path) => path.some((cert) => this.trustedCerts.includes(cert))); + if (paths.length === 0) { + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: 'no trusted certificate path found', + }); + } + // Find the shortest of possible paths + /* istanbul ignore next */ + const path = paths.reduce((prev, curr) => prev.length < curr.length ? prev : curr); + // Construct chain from shortest path + // Removes the last certificate in the path, which will be a second copy + // of the root certificate given that the root is self-signed. + return [leafCert, ...path].slice(0, -1); + } + // Recursively build all possible paths from the leaf to the root + buildPaths(certificate) { + const paths = []; + const issuers = this.findIssuer(certificate); + if (issuers.length === 0) { + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: 'no valid certificate path found', + }); + } + for (let i = 0; i < issuers.length; i++) { + const issuer = issuers[i]; + // Base case - issuer is self + if (issuer.equals(certificate)) { + paths.push([certificate]); + continue; + } + // Recursively build path for the issuer + const subPaths = this.buildPaths(issuer); + // Construct paths by appending the issuer to each subpath + for (let j = 0; j < subPaths.length; j++) { + paths.push([issuer, ...subPaths[j]]); + } + } + return paths; + } + // Return all possible issuers for the given certificate + findIssuer(certificate) { + let issuers = []; + let keyIdentifier; + // Exit early if the certificate is self-signed + if (certificate.subject.equals(certificate.issuer)) { + if (certificate.verify()) { + return [certificate]; + } + } + // If the certificate has an authority key identifier, use that + // to find the issuer + if (certificate.extAuthorityKeyID) { + keyIdentifier = certificate.extAuthorityKeyID.keyIdentifier; + // TODO: Add support for authorityCertIssuer/authorityCertSerialNumber + // though Fulcio doesn't appear to use these + } + // Find possible issuers by comparing the authorityKeyID/subjectKeyID + // or issuer/subject. Potential issuers are added to the result array. + this.localCerts.forEach((possibleIssuer) => { + if (keyIdentifier) { + if (possibleIssuer.extSubjectKeyID) { + if (possibleIssuer.extSubjectKeyID.keyIdentifier.equals(keyIdentifier)) { + issuers.push(possibleIssuer); + } + return; + } + } + // Fallback to comparing certificate issuer and subject if + // subjectKey/authorityKey extensions are not present + if (possibleIssuer.subject.equals(certificate.issuer)) { + issuers.push(possibleIssuer); + } + }); + // Remove any issuers which fail to verify the certificate + issuers = issuers.filter((issuer) => { + try { + return certificate.verify(issuer); + } + catch (ex) { + /* istanbul ignore next - should never error */ + return false; + } + }); + return issuers; + } + checkPath(path) { + /* istanbul ignore if */ + if (path.length < 1) { + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: 'certificate chain must contain at least one certificate', + }); + } + // Ensure that all certificates beyond the leaf are CAs + const validCAs = path.slice(1).every((cert) => cert.isCA); + if (!validCAs) { + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: 'intermediate certificate is not a CA', + }); + } + // Certificate's issuer must match the subject of the next certificate + // in the chain + for (let i = path.length - 2; i >= 0; i--) { + /* istanbul ignore if */ + if (!path[i].issuer.equals(path[i + 1].subject)) { + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: 'incorrect certificate name chaining', + }); + } + } + // Check pathlength constraints + for (let i = 0; i < path.length; i++) { + const cert = path[i]; + // If the certificate is a CA, check the path length + if (cert.extBasicConstraints?.isCA) { + const pathLength = cert.extBasicConstraints.pathLenConstraint; + // The path length, if set, indicates how many intermediate + // certificates (NOT including the leaf) are allowed to follow. The + // pathLength constraint of any intermediate CA certificate MUST be + // greater than or equal to it's own depth in the chain (with an + // adjustment for the leaf certificate) + if (pathLength !== undefined && pathLength < i - 1) { + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: 'path length constraint exceeded', + }); + } + } + } + } +} +exports.CertificateChainVerifier = CertificateChainVerifier; +// Remove duplicate certificates from the array +function dedupeCertificates(certs) { + for (let i = 0; i < certs.length; i++) { + for (let j = i + 1; j < certs.length; j++) { + if (certs[i].equals(certs[j])) { + certs.splice(j, 1); + j--; + } + } + } + return certs; +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/key/index.js b/node_modules/npm/node_modules/@sigstore/verify/dist/key/index.js new file mode 100644 index 00000000..cc894aab --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/key/index.js @@ -0,0 +1,72 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyPublicKey = verifyPublicKey; +exports.verifyCertificate = verifyCertificate; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const core_1 = require("@sigstore/core"); +const error_1 = require("../error"); +const certificate_1 = require("./certificate"); +const sct_1 = require("./sct"); +const OID_FULCIO_ISSUER_V1 = '1.3.6.1.4.1.57264.1.1'; +const OID_FULCIO_ISSUER_V2 = '1.3.6.1.4.1.57264.1.8'; +function verifyPublicKey(hint, timestamps, trustMaterial) { + const key = trustMaterial.publicKey(hint); + timestamps.forEach((timestamp) => { + if (!key.validFor(timestamp)) { + throw new error_1.VerificationError({ + code: 'PUBLIC_KEY_ERROR', + message: `Public key is not valid for timestamp: ${timestamp.toISOString()}`, + }); + } + }); + return { key: key.publicKey }; +} +function verifyCertificate(leaf, timestamps, trustMaterial) { + // Check that leaf certificate chains to a trusted CA + const path = (0, certificate_1.verifyCertificateChain)(leaf, trustMaterial.certificateAuthorities); + // Check that ALL certificates are valid for ALL of the timestamps + const validForDate = timestamps.every((timestamp) => path.every((cert) => cert.validForDate(timestamp))); + if (!validForDate) { + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: 'certificate is not valid or expired at the specified date', + }); + } + return { + scts: (0, sct_1.verifySCTs)(path[0], path[1], trustMaterial.ctlogs), + signer: getSigner(path[0]), + }; +} +function getSigner(cert) { + let issuer; + const issuerExtension = cert.extension(OID_FULCIO_ISSUER_V2); + /* istanbul ignore next */ + if (issuerExtension) { + issuer = issuerExtension.valueObj.subs?.[0]?.value.toString('ascii'); + } + else { + issuer = cert.extension(OID_FULCIO_ISSUER_V1)?.value.toString('ascii'); + } + const identity = { + extensions: { issuer }, + subjectAlternativeName: cert.subjectAltName, + }; + return { + key: core_1.crypto.createPublicKey(cert.publicKey), + identity, + }; +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/key/sct.js b/node_modules/npm/node_modules/@sigstore/verify/dist/key/sct.js new file mode 100644 index 00000000..8eca4873 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/key/sct.js @@ -0,0 +1,78 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifySCTs = verifySCTs; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const core_1 = require("@sigstore/core"); +const error_1 = require("../error"); +const trust_1 = require("../trust"); +function verifySCTs(cert, issuer, ctlogs) { + let extSCT; + // Verifying the SCT requires that we remove the SCT extension and + // re-encode the TBS structure to DER -- this value is part of the data + // over which the signature is calculated. Since this is a destructive action + // we create a copy of the certificate so we can remove the SCT extension + // without affecting the original certificate. + const clone = cert.clone(); + // Intentionally not using the findExtension method here because we want to + // remove the the SCT extension from the certificate before calculating the + // PreCert structure + for (let i = 0; i < clone.extensions.length; i++) { + const ext = clone.extensions[i]; + if (ext.subs[0].toOID() === core_1.EXTENSION_OID_SCT) { + extSCT = new core_1.X509SCTExtension(ext); + // Remove the extension from the certificate + clone.extensions.splice(i, 1); + break; + } + } + // No SCT extension found to verify + if (!extSCT) { + return []; + } + // Found an SCT extension but it has no SCTs + /* istanbul ignore if -- too difficult to fabricate test case for this */ + if (extSCT.signedCertificateTimestamps.length === 0) { + return []; + } + // Construct the PreCert structure + // https://www.rfc-editor.org/rfc/rfc6962#section-3.2 + const preCert = new core_1.ByteStream(); + // Calculate hash of the issuer's public key + const issuerId = core_1.crypto.digest('sha256', issuer.publicKey); + preCert.appendView(issuerId); + // Re-encodes the certificate to DER after removing the SCT extension + const tbs = clone.tbsCertificate.toDER(); + preCert.appendUint24(tbs.length); + preCert.appendView(tbs); + // Calculate and return the verification results for each SCT + return extSCT.signedCertificateTimestamps.map((sct) => { + // Find the ctlog instance that corresponds to the SCT's logID + const validCTLogs = (0, trust_1.filterTLogAuthorities)(ctlogs, { + logID: sct.logID, + targetDate: sct.datetime, + }); + // See if the SCT is valid for any of the CT logs + const verified = validCTLogs.some((log) => sct.verify(preCert.buffer, log.publicKey)); + if (!verified) { + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: 'SCT verification failed', + }); + } + return sct.logID; + }); +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/policy.js b/node_modules/npm/node_modules/@sigstore/verify/dist/policy.js new file mode 100644 index 00000000..f5960cf0 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/policy.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifySubjectAlternativeName = verifySubjectAlternativeName; +exports.verifyExtensions = verifyExtensions; +const error_1 = require("./error"); +function verifySubjectAlternativeName(policyIdentity, signerIdentity) { + if (signerIdentity === undefined || !signerIdentity.match(policyIdentity)) { + throw new error_1.PolicyError({ + code: 'UNTRUSTED_SIGNER_ERROR', + message: `certificate identity error - expected ${policyIdentity}, got ${signerIdentity}`, + }); + } +} +function verifyExtensions(policyExtensions, signerExtensions = {}) { + let key; + for (key in policyExtensions) { + if (signerExtensions[key] !== policyExtensions[key]) { + throw new error_1.PolicyError({ + code: 'UNTRUSTED_SIGNER_ERROR', + message: `invalid certificate extension - expected ${key}=${policyExtensions[key]}, got ${key}=${signerExtensions[key]}`, + }); + } + } +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/shared.types.js b/node_modules/npm/node_modules/@sigstore/verify/dist/shared.types.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/shared.types.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/checkpoint.js b/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/checkpoint.js new file mode 100644 index 00000000..46619b67 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/checkpoint.js @@ -0,0 +1,157 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyCheckpoint = verifyCheckpoint; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const core_1 = require("@sigstore/core"); +const error_1 = require("../error"); +const trust_1 = require("../trust"); +// Separator between the note and the signatures in a checkpoint +const CHECKPOINT_SEPARATOR = '\n\n'; +// Checkpoint signatures are of the following form: +// "– \n" +// where: +// - the prefix is an emdash (U+2014). +// - gives a human-readable representation of the signing ID. +// - is the first 4 bytes of the SHA256 hash of the +// associated public key followed by the signature bytes. +const SIGNATURE_REGEX = /\u2014 (\S+) (\S+)\n/g; +// Verifies the checkpoint value in the given tlog entry. There are two steps +// to the verification: +// 1. Verify that all signatures in the checkpoint can be verified against a +// trusted public key +// 2. Verify that the root hash in the checkpoint matches the root hash in the +// inclusion proof +// See: https://github.com/transparency-dev/formats/blob/main/log/README.md +function verifyCheckpoint(entry, tlogs) { + // Filter tlog instances to just those which were valid at the time of the + // entry + const validTLogs = (0, trust_1.filterTLogAuthorities)(tlogs, { + targetDate: new Date(Number(entry.integratedTime) * 1000), + }); + const inclusionProof = entry.inclusionProof; + const signedNote = SignedNote.fromString(inclusionProof.checkpoint.envelope); + const checkpoint = LogCheckpoint.fromString(signedNote.note); + // Verify that the signatures in the checkpoint are all valid + if (!verifySignedNote(signedNote, validTLogs)) { + throw new error_1.VerificationError({ + code: 'TLOG_INCLUSION_PROOF_ERROR', + message: 'invalid checkpoint signature', + }); + } + // Verify that the root hash from the checkpoint matches the root hash in the + // inclusion proof + if (!core_1.crypto.bufferEqual(checkpoint.logHash, inclusionProof.rootHash)) { + throw new error_1.VerificationError({ + code: 'TLOG_INCLUSION_PROOF_ERROR', + message: 'root hash mismatch', + }); + } +} +// Verifies the signatures in the SignedNote. For each signature, the +// corresponding transparency log is looked up by the key hint and the +// signature is verified against the public key in the transparency log. +// Throws an error if any of the signatures are invalid. +function verifySignedNote(signedNote, tlogs) { + const data = Buffer.from(signedNote.note, 'utf-8'); + return signedNote.signatures.every((signature) => { + // Find the transparency log instance with the matching key hint + const tlog = tlogs.find((tlog) => core_1.crypto.bufferEqual(tlog.logID.subarray(0, 4), signature.keyHint)); + if (!tlog) { + return false; + } + return core_1.crypto.verify(data, tlog.publicKey, signature.signature); + }); +} +// SignedNote represents a signed note from a transparency log checkpoint. Consists +// of a body (or note) and one more signatures calculated over the body. See +// https://github.com/transparency-dev/formats/blob/main/log/README.md#signed-envelope +class SignedNote { + constructor(note, signatures) { + this.note = note; + this.signatures = signatures; + } + // Deserialize a SignedNote from a string + static fromString(envelope) { + if (!envelope.includes(CHECKPOINT_SEPARATOR)) { + throw new error_1.VerificationError({ + code: 'TLOG_INCLUSION_PROOF_ERROR', + message: 'missing checkpoint separator', + }); + } + // Split the note into the header and the data portions at the separator + const split = envelope.indexOf(CHECKPOINT_SEPARATOR); + const header = envelope.slice(0, split + 1); + const data = envelope.slice(split + CHECKPOINT_SEPARATOR.length); + // Find all the signature lines in the data portion + const matches = data.matchAll(SIGNATURE_REGEX); + // Parse each of the matched signature lines into the name and signature. + // The first four bytes of the signature are the key hint (should match the + // first four bytes of the log ID), and the rest is the signature itself. + const signatures = Array.from(matches, (match) => { + const [, name, signature] = match; + const sigBytes = Buffer.from(signature, 'base64'); + if (sigBytes.length < 5) { + throw new error_1.VerificationError({ + code: 'TLOG_INCLUSION_PROOF_ERROR', + message: 'malformed checkpoint signature', + }); + } + return { + name, + keyHint: sigBytes.subarray(0, 4), + signature: sigBytes.subarray(4), + }; + }); + if (signatures.length === 0) { + throw new error_1.VerificationError({ + code: 'TLOG_INCLUSION_PROOF_ERROR', + message: 'no signatures found in checkpoint', + }); + } + return new SignedNote(header, signatures); + } +} +// LogCheckpoint represents a transparency log checkpoint. Consists of the +// following: +// - origin: the name of the transparency log +// - logSize: the size of the log at the time of the checkpoint +// - logHash: the root hash of the log at the time of the checkpoint +// - rest: the rest of the checkpoint body, which is a list of log entries +// See: +// https://github.com/transparency-dev/formats/blob/main/log/README.md#checkpoint-body +class LogCheckpoint { + constructor(origin, logSize, logHash, rest) { + this.origin = origin; + this.logSize = logSize; + this.logHash = logHash; + this.rest = rest; + } + static fromString(note) { + const lines = note.trimEnd().split('\n'); + if (lines.length < 3) { + throw new error_1.VerificationError({ + code: 'TLOG_INCLUSION_PROOF_ERROR', + message: 'too few lines in checkpoint header', + }); + } + const origin = lines[0]; + const logSize = BigInt(lines[1]); + const rootHash = Buffer.from(lines[2], 'base64'); + const rest = lines.slice(3); + return new LogCheckpoint(origin, logSize, rootHash, rest); + } +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/index.js b/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/index.js new file mode 100644 index 00000000..56e948de --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/index.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyTSATimestamp = verifyTSATimestamp; +exports.verifyTLogTimestamp = verifyTLogTimestamp; +const error_1 = require("../error"); +const checkpoint_1 = require("./checkpoint"); +const merkle_1 = require("./merkle"); +const set_1 = require("./set"); +const tsa_1 = require("./tsa"); +function verifyTSATimestamp(timestamp, data, timestampAuthorities) { + (0, tsa_1.verifyRFC3161Timestamp)(timestamp, data, timestampAuthorities); + return { + type: 'timestamp-authority', + logID: timestamp.signerSerialNumber, + timestamp: timestamp.signingTime, + }; +} +function verifyTLogTimestamp(entry, tlogAuthorities) { + let inclusionVerified = false; + if (isTLogEntryWithInclusionPromise(entry)) { + (0, set_1.verifyTLogSET)(entry, tlogAuthorities); + inclusionVerified = true; + } + if (isTLogEntryWithInclusionProof(entry)) { + (0, merkle_1.verifyMerkleInclusion)(entry); + (0, checkpoint_1.verifyCheckpoint)(entry, tlogAuthorities); + inclusionVerified = true; + } + if (!inclusionVerified) { + throw new error_1.VerificationError({ + code: 'TLOG_MISSING_INCLUSION_ERROR', + message: 'inclusion could not be verified', + }); + } + return { + type: 'transparency-log', + logID: entry.logId.keyId, + timestamp: new Date(Number(entry.integratedTime) * 1000), + }; +} +function isTLogEntryWithInclusionPromise(entry) { + return entry.inclusionPromise !== undefined; +} +function isTLogEntryWithInclusionProof(entry) { + return entry.inclusionProof !== undefined; +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/merkle.js b/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/merkle.js new file mode 100644 index 00000000..f57cae42 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/merkle.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyMerkleInclusion = verifyMerkleInclusion; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const core_1 = require("@sigstore/core"); +const error_1 = require("../error"); +const RFC6962_LEAF_HASH_PREFIX = Buffer.from([0x00]); +const RFC6962_NODE_HASH_PREFIX = Buffer.from([0x01]); +function verifyMerkleInclusion(entry) { + const inclusionProof = entry.inclusionProof; + const logIndex = BigInt(inclusionProof.logIndex); + const treeSize = BigInt(inclusionProof.treeSize); + if (logIndex < 0n || logIndex >= treeSize) { + throw new error_1.VerificationError({ + code: 'TLOG_INCLUSION_PROOF_ERROR', + message: `invalid index: ${logIndex}`, + }); + } + // Figure out which subset of hashes corresponds to the inner and border + // nodes + const { inner, border } = decompInclProof(logIndex, treeSize); + if (inclusionProof.hashes.length !== inner + border) { + throw new error_1.VerificationError({ + code: 'TLOG_INCLUSION_PROOF_ERROR', + message: 'invalid hash count', + }); + } + const innerHashes = inclusionProof.hashes.slice(0, inner); + const borderHashes = inclusionProof.hashes.slice(inner); + // The entry's hash is the leaf hash + const leafHash = hashLeaf(entry.canonicalizedBody); + // Chain the hashes belonging to the inner and border portions + const calculatedHash = chainBorderRight(chainInner(leafHash, innerHashes, logIndex), borderHashes); + // Calculated hash should match the root hash in the inclusion proof + if (!core_1.crypto.bufferEqual(calculatedHash, inclusionProof.rootHash)) { + throw new error_1.VerificationError({ + code: 'TLOG_INCLUSION_PROOF_ERROR', + message: 'calculated root hash does not match inclusion proof', + }); + } +} +// Breaks down inclusion proof for a leaf at the specified index in a tree of +// the specified size. The split point is where paths to the index leaf and +// the (size - 1) leaf diverge. Returns lengths of the bottom and upper proof +// parts. +function decompInclProof(index, size) { + const inner = innerProofSize(index, size); + const border = onesCount(index >> BigInt(inner)); + return { inner, border }; +} +// Computes a subtree hash for a node on or below the tree's right border. +// Assumes the provided proof hashes are ordered from lower to higher levels +// and seed is the initial hash of the node specified by the index. +function chainInner(seed, hashes, index) { + return hashes.reduce((acc, h, i) => { + if ((index >> BigInt(i)) & BigInt(1)) { + return hashChildren(h, acc); + } + else { + return hashChildren(acc, h); + } + }, seed); +} +// Computes a subtree hash for nodes along the tree's right border. +function chainBorderRight(seed, hashes) { + return hashes.reduce((acc, h) => hashChildren(h, acc), seed); +} +function innerProofSize(index, size) { + return bitLength(index ^ (size - BigInt(1))); +} +// Counts the number of ones in the binary representation of the given number. +// https://en.wikipedia.org/wiki/Hamming_weight +function onesCount(num) { + return num.toString(2).split('1').length - 1; +} +// Returns the number of bits necessary to represent an integer in binary. +function bitLength(n) { + if (n === 0n) { + return 0; + } + return n.toString(2).length; +} +// Hashing logic according to RFC6962. +// https://datatracker.ietf.org/doc/html/rfc6962#section-2 +function hashChildren(left, right) { + return core_1.crypto.digest('sha256', RFC6962_NODE_HASH_PREFIX, left, right); +} +function hashLeaf(leaf) { + return core_1.crypto.digest('sha256', RFC6962_LEAF_HASH_PREFIX, leaf); +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/set.js b/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/set.js new file mode 100644 index 00000000..5d3f47bb --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/set.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyTLogSET = verifyTLogSET; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const core_1 = require("@sigstore/core"); +const error_1 = require("../error"); +const trust_1 = require("../trust"); +// Verifies the SET for the given entry against the list of trusted +// transparency logs. Returns true if the SET can be verified against at least +// one of the trusted logs; otherwise, returns false. +function verifyTLogSET(entry, tlogs) { + // Filter the list of tlog instances to only those which might be able to + // verify the SET + const validTLogs = (0, trust_1.filterTLogAuthorities)(tlogs, { + logID: entry.logId.keyId, + targetDate: new Date(Number(entry.integratedTime) * 1000), + }); + // Check to see if we can verify the SET against any of the valid tlogs + const verified = validTLogs.some((tlog) => { + // Re-create the original Rekor verification payload + const payload = toVerificationPayload(entry); + // Canonicalize the payload and turn into a buffer for verification + const data = Buffer.from(core_1.json.canonicalize(payload), 'utf8'); + // Extract the SET from the tlog entry + const signature = entry.inclusionPromise.signedEntryTimestamp; + return core_1.crypto.verify(data, tlog.publicKey, signature); + }); + if (!verified) { + throw new error_1.VerificationError({ + code: 'TLOG_INCLUSION_PROMISE_ERROR', + message: 'inclusion promise could not be verified', + }); + } +} +// Returns a properly formatted "VerificationPayload" for one of the +// transaction log entires in the given bundle which can be used for SET +// verification. +function toVerificationPayload(entry) { + const { integratedTime, logIndex, logId, canonicalizedBody } = entry; + return { + body: canonicalizedBody.toString('base64'), + integratedTime: Number(integratedTime), + logIndex: Number(logIndex), + logID: logId.keyId.toString('hex'), + }; +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/tsa.js b/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/tsa.js new file mode 100644 index 00000000..70388cd0 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/timestamp/tsa.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyRFC3161Timestamp = verifyRFC3161Timestamp; +const core_1 = require("@sigstore/core"); +const error_1 = require("../error"); +const certificate_1 = require("../key/certificate"); +const trust_1 = require("../trust"); +function verifyRFC3161Timestamp(timestamp, data, timestampAuthorities) { + const signingTime = timestamp.signingTime; + // Filter for CAs which were valid at the time of signing + timestampAuthorities = (0, trust_1.filterCertAuthorities)(timestampAuthorities, { + start: signingTime, + end: signingTime, + }); + // Filter for CAs which match serial and issuer embedded in the timestamp + timestampAuthorities = filterCAsBySerialAndIssuer(timestampAuthorities, { + serialNumber: timestamp.signerSerialNumber, + issuer: timestamp.signerIssuer, + }); + // Check that we can verify the timestamp with AT LEAST ONE of the remaining + // CAs + const verified = timestampAuthorities.some((ca) => { + try { + verifyTimestampForCA(timestamp, data, ca); + return true; + } + catch (e) { + return false; + } + }); + if (!verified) { + throw new error_1.VerificationError({ + code: 'TIMESTAMP_ERROR', + message: 'timestamp could not be verified', + }); + } +} +function verifyTimestampForCA(timestamp, data, ca) { + const [leaf, ...cas] = ca.certChain; + const signingKey = core_1.crypto.createPublicKey(leaf.publicKey); + const signingTime = timestamp.signingTime; + // Verify the certificate chain for the provided CA + try { + new certificate_1.CertificateChainVerifier({ + untrustedCert: leaf, + trustedCerts: cas, + }).verify(); + } + catch (e) { + throw new error_1.VerificationError({ + code: 'TIMESTAMP_ERROR', + message: 'invalid certificate chain', + }); + } + // Check that all of the CA certs were valid at the time of signing + const validAtSigningTime = ca.certChain.every((cert) => cert.validForDate(signingTime)); + if (!validAtSigningTime) { + throw new error_1.VerificationError({ + code: 'TIMESTAMP_ERROR', + message: 'timestamp was signed with an expired certificate', + }); + } + // Check that the signing certificate's key can be used to verify the + // timestamp signature. + timestamp.verify(data, signingKey); +} +// Filters the list of CAs to those which have a leaf signing certificate which +// matches the given serial number and issuer. +function filterCAsBySerialAndIssuer(timestampAuthorities, criteria) { + return timestampAuthorities.filter((ca) => ca.certChain.length > 0 && + core_1.crypto.bufferEqual(ca.certChain[0].serialNumber, criteria.serialNumber) && + core_1.crypto.bufferEqual(ca.certChain[0].issuer, criteria.issuer)); +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/dsse.js b/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/dsse.js new file mode 100644 index 00000000..d71ed8c6 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/dsse.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyDSSETLogBody = verifyDSSETLogBody; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const error_1 = require("../error"); +// Compare the given intoto tlog entry to the given bundle +function verifyDSSETLogBody(tlogEntry, content) { + switch (tlogEntry.apiVersion) { + case '0.0.1': + return verifyDSSE001TLogBody(tlogEntry, content); + default: + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: `unsupported dsse version: ${tlogEntry.apiVersion}`, + }); + } +} +// Compare the given dsse v0.0.1 tlog entry to the given DSSE envelope. +function verifyDSSE001TLogBody(tlogEntry, content) { + // Ensure the bundle's DSSE only contains a single signature + if (tlogEntry.spec.signatures?.length !== 1) { + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: 'signature count mismatch', + }); + } + const tlogSig = tlogEntry.spec.signatures[0].signature; + // Ensure that the signature in the bundle's DSSE matches tlog entry + if (!content.compareSignature(Buffer.from(tlogSig, 'base64'))) + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: 'tlog entry signature mismatch', + }); + // Ensure the digest of the bundle's DSSE payload matches the digest in the + // tlog entry + const tlogHash = tlogEntry.spec.payloadHash?.value || ''; + if (!content.compareDigest(Buffer.from(tlogHash, 'hex'))) { + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: 'DSSE payload hash mismatch', + }); + } +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js b/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js new file mode 100644 index 00000000..c4aa345b --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyHashedRekordTLogBody = verifyHashedRekordTLogBody; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const error_1 = require("../error"); +// Compare the given hashedrekord tlog entry to the given bundle +function verifyHashedRekordTLogBody(tlogEntry, content) { + switch (tlogEntry.apiVersion) { + case '0.0.1': + return verifyHashedrekord001TLogBody(tlogEntry, content); + default: + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: `unsupported hashedrekord version: ${tlogEntry.apiVersion}`, + }); + } +} +// Compare the given hashedrekord v0.0.1 tlog entry to the given message +// signature +function verifyHashedrekord001TLogBody(tlogEntry, content) { + // Ensure that the bundles message signature matches the tlog entry + const tlogSig = tlogEntry.spec.signature.content || ''; + if (!content.compareSignature(Buffer.from(tlogSig, 'base64'))) { + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: 'signature mismatch', + }); + } + // Ensure that the bundle's message digest matches the tlog entry + const tlogDigest = tlogEntry.spec.data.hash?.value || ''; + if (!content.compareDigest(Buffer.from(tlogDigest, 'hex'))) { + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: 'digest mismatch', + }); + } +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/index.js b/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/index.js new file mode 100644 index 00000000..da235360 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/index.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyTLogBody = verifyTLogBody; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const error_1 = require("../error"); +const dsse_1 = require("./dsse"); +const hashedrekord_1 = require("./hashedrekord"); +const intoto_1 = require("./intoto"); +// Verifies that the given tlog entry matches the supplied signature content. +function verifyTLogBody(entry, sigContent) { + const { kind, version } = entry.kindVersion; + const body = JSON.parse(entry.canonicalizedBody.toString('utf8')); + if (kind !== body.kind || version !== body.apiVersion) { + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: `kind/version mismatch - expected: ${kind}/${version}, received: ${body.kind}/${body.apiVersion}`, + }); + } + switch (body.kind) { + case 'dsse': + return (0, dsse_1.verifyDSSETLogBody)(body, sigContent); + case 'intoto': + return (0, intoto_1.verifyIntotoTLogBody)(body, sigContent); + case 'hashedrekord': + return (0, hashedrekord_1.verifyHashedRekordTLogBody)(body, sigContent); + /* istanbul ignore next */ + default: + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: `unsupported kind: ${kind}`, + }); + } +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/intoto.js b/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/intoto.js new file mode 100644 index 00000000..9096ae94 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/tlog/intoto.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyIntotoTLogBody = verifyIntotoTLogBody; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const error_1 = require("../error"); +// Compare the given intoto tlog entry to the given bundle +function verifyIntotoTLogBody(tlogEntry, content) { + switch (tlogEntry.apiVersion) { + case '0.0.2': + return verifyIntoto002TLogBody(tlogEntry, content); + default: + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: `unsupported intoto version: ${tlogEntry.apiVersion}`, + }); + } +} +// Compare the given intoto v0.0.2 tlog entry to the given DSSE envelope. +function verifyIntoto002TLogBody(tlogEntry, content) { + // Ensure the bundle's DSSE contains a single signature + if (tlogEntry.spec.content.envelope.signatures?.length !== 1) { + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: 'signature count mismatch', + }); + } + // Signature is double-base64-encoded in the tlog entry + const tlogSig = base64Decode(tlogEntry.spec.content.envelope.signatures[0].sig); + // Ensure that the signature in the bundle's DSSE matches tlog entry + if (!content.compareSignature(Buffer.from(tlogSig, 'base64'))) { + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: 'tlog entry signature mismatch', + }); + } + // Ensure the digest of the bundle's DSSE payload matches the digest in the + // tlog entry + const tlogHash = tlogEntry.spec.content.payloadHash?.value || ''; + if (!content.compareDigest(Buffer.from(tlogHash, 'hex'))) { + throw new error_1.VerificationError({ + code: 'TLOG_BODY_ERROR', + message: 'DSSE payload hash mismatch', + }); + } +} +function base64Decode(str) { + return Buffer.from(str, 'base64').toString('utf-8'); +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/trust/filter.js b/node_modules/npm/node_modules/@sigstore/verify/dist/trust/filter.js new file mode 100644 index 00000000..880a16cf --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/trust/filter.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.filterCertAuthorities = filterCertAuthorities; +exports.filterTLogAuthorities = filterTLogAuthorities; +function filterCertAuthorities(certAuthorities, criteria) { + return certAuthorities.filter((ca) => { + return (ca.validFor.start <= criteria.start && ca.validFor.end >= criteria.end); + }); +} +// Filter the list of tlog instances to only those which match the given log +// ID and have public keys which are valid for the given integrated time. +function filterTLogAuthorities(tlogAuthorities, criteria) { + return tlogAuthorities.filter((tlog) => { + // If we're filtering by log ID and the log IDs don't match, we can't use + // this tlog + if (criteria.logID && !tlog.logID.equals(criteria.logID)) { + return false; + } + // Check that the integrated time is within the validFor range + return (tlog.validFor.start <= criteria.targetDate && + criteria.targetDate <= tlog.validFor.end); + }); +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/trust/index.js b/node_modules/npm/node_modules/@sigstore/verify/dist/trust/index.js new file mode 100644 index 00000000..bfab2eb4 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/trust/index.js @@ -0,0 +1,86 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.filterTLogAuthorities = exports.filterCertAuthorities = void 0; +exports.toTrustMaterial = toTrustMaterial; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const core_1 = require("@sigstore/core"); +const protobuf_specs_1 = require("@sigstore/protobuf-specs"); +const error_1 = require("../error"); +const BEGINNING_OF_TIME = new Date(0); +const END_OF_TIME = new Date(8640000000000000); +var filter_1 = require("./filter"); +Object.defineProperty(exports, "filterCertAuthorities", { enumerable: true, get: function () { return filter_1.filterCertAuthorities; } }); +Object.defineProperty(exports, "filterTLogAuthorities", { enumerable: true, get: function () { return filter_1.filterTLogAuthorities; } }); +function toTrustMaterial(root, keys) { + const keyFinder = typeof keys === 'function' ? keys : keyLocator(keys); + return { + certificateAuthorities: root.certificateAuthorities.map(createCertAuthority), + timestampAuthorities: root.timestampAuthorities.map(createCertAuthority), + tlogs: root.tlogs.map(createTLogAuthority), + ctlogs: root.ctlogs.map(createTLogAuthority), + publicKey: keyFinder, + }; +} +function createTLogAuthority(tlogInstance) { + const keyDetails = tlogInstance.publicKey.keyDetails; + const keyType = keyDetails === protobuf_specs_1.PublicKeyDetails.PKCS1_RSA_PKCS1V5 || + keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V5 || + keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_2048_SHA256 || + keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_3072_SHA256 || + keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_4096_SHA256 + ? 'pkcs1' + : 'spki'; + return { + logID: tlogInstance.logId.keyId, + publicKey: core_1.crypto.createPublicKey(tlogInstance.publicKey.rawBytes, keyType), + validFor: { + start: tlogInstance.publicKey.validFor?.start || BEGINNING_OF_TIME, + end: tlogInstance.publicKey.validFor?.end || END_OF_TIME, + }, + }; +} +function createCertAuthority(ca) { + /* istanbul ignore next */ + return { + certChain: ca.certChain.certificates.map((cert) => { + return core_1.X509Certificate.parse(cert.rawBytes); + }), + validFor: { + start: ca.validFor?.start || BEGINNING_OF_TIME, + end: ca.validFor?.end || END_OF_TIME, + }, + }; +} +function keyLocator(keys) { + return (hint) => { + const key = (keys || {})[hint]; + if (!key) { + throw new error_1.VerificationError({ + code: 'PUBLIC_KEY_ERROR', + message: `key not found: ${hint}`, + }); + } + return { + publicKey: core_1.crypto.createPublicKey(key.rawBytes), + validFor: (date) => { + /* istanbul ignore next */ + return ((key.validFor?.start || BEGINNING_OF_TIME) <= date && + (key.validFor?.end || END_OF_TIME) >= date); + }, + }; + }; +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/trust/trust.types.js b/node_modules/npm/node_modules/@sigstore/verify/dist/trust/trust.types.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/trust/trust.types.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/npm/node_modules/@sigstore/verify/dist/verifier.js b/node_modules/npm/node_modules/@sigstore/verify/dist/verifier.js new file mode 100644 index 00000000..829727cd --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/dist/verifier.js @@ -0,0 +1,141 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Verifier = void 0; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const util_1 = require("util"); +const error_1 = require("./error"); +const key_1 = require("./key"); +const policy_1 = require("./policy"); +const timestamp_1 = require("./timestamp"); +const tlog_1 = require("./tlog"); +class Verifier { + constructor(trustMaterial, options = {}) { + this.trustMaterial = trustMaterial; + this.options = { + ctlogThreshold: options.ctlogThreshold ?? 1, + tlogThreshold: options.tlogThreshold ?? 1, + tsaThreshold: options.tsaThreshold ?? 0, + }; + } + verify(entity, policy) { + const timestamps = this.verifyTimestamps(entity); + const signer = this.verifySigningKey(entity, timestamps); + this.verifyTLogs(entity); + this.verifySignature(entity, signer); + if (policy) { + this.verifyPolicy(policy, signer.identity || {}); + } + return signer; + } + // Checks that all of the timestamps in the entity are valid and returns them + verifyTimestamps(entity) { + let tlogCount = 0; + let tsaCount = 0; + const timestamps = entity.timestamps.map((timestamp) => { + switch (timestamp.$case) { + case 'timestamp-authority': + tsaCount++; + return (0, timestamp_1.verifyTSATimestamp)(timestamp.timestamp, entity.signature.signature, this.trustMaterial.timestampAuthorities); + case 'transparency-log': + tlogCount++; + return (0, timestamp_1.verifyTLogTimestamp)(timestamp.tlogEntry, this.trustMaterial.tlogs); + } + }); + // Check for duplicate timestamps + if (containsDupes(timestamps)) { + throw new error_1.VerificationError({ + code: 'TIMESTAMP_ERROR', + message: 'duplicate timestamp', + }); + } + if (tlogCount < this.options.tlogThreshold) { + throw new error_1.VerificationError({ + code: 'TIMESTAMP_ERROR', + message: `expected ${this.options.tlogThreshold} tlog timestamps, got ${tlogCount}`, + }); + } + if (tsaCount < this.options.tsaThreshold) { + throw new error_1.VerificationError({ + code: 'TIMESTAMP_ERROR', + message: `expected ${this.options.tsaThreshold} tsa timestamps, got ${tsaCount}`, + }); + } + return timestamps.map((t) => t.timestamp); + } + // Checks that the signing key is valid for all of the the supplied timestamps + // and returns the signer. + verifySigningKey({ key }, timestamps) { + switch (key.$case) { + case 'public-key': { + return (0, key_1.verifyPublicKey)(key.hint, timestamps, this.trustMaterial); + } + case 'certificate': { + const result = (0, key_1.verifyCertificate)(key.certificate, timestamps, this.trustMaterial); + /* istanbul ignore next - no fixture */ + if (containsDupes(result.scts)) { + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: 'duplicate SCT', + }); + } + if (result.scts.length < this.options.ctlogThreshold) { + throw new error_1.VerificationError({ + code: 'CERTIFICATE_ERROR', + message: `expected ${this.options.ctlogThreshold} SCTs, got ${result.scts.length}`, + }); + } + return result.signer; + } + } + } + // Checks that the tlog entries are valid for the supplied content + verifyTLogs({ signature: content, tlogEntries }) { + tlogEntries.forEach((entry) => (0, tlog_1.verifyTLogBody)(entry, content)); + } + // Checks that the signature is valid for the supplied content + verifySignature(entity, signer) { + if (!entity.signature.verifySignature(signer.key)) { + throw new error_1.VerificationError({ + code: 'SIGNATURE_ERROR', + message: 'signature verification failed', + }); + } + } + verifyPolicy(policy, identity) { + // Check the subject alternative name of the signer matches the policy + if (policy.subjectAlternativeName) { + (0, policy_1.verifySubjectAlternativeName)(policy.subjectAlternativeName, identity.subjectAlternativeName); + } + // Check that the extensions of the signer match the policy + if (policy.extensions) { + (0, policy_1.verifyExtensions)(policy.extensions, identity.extensions); + } + } +} +exports.Verifier = Verifier; +// Checks for duplicate items in the array. Objects are compared using +// deep equality. +function containsDupes(arr) { + for (let i = 0; i < arr.length; i++) { + for (let j = i + 1; j < arr.length; j++) { + if ((0, util_1.isDeepStrictEqual)(arr[i], arr[j])) { + return true; + } + } + } + return false; +} diff --git a/node_modules/npm/node_modules/@sigstore/verify/package.json b/node_modules/npm/node_modules/@sigstore/verify/package.json new file mode 100644 index 00000000..edf72b8b --- /dev/null +++ b/node_modules/npm/node_modules/@sigstore/verify/package.json @@ -0,0 +1,36 @@ +{ + "name": "@sigstore/verify", + "version": "2.0.0", + "description": "Verification of Sigstore signatures", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "clean": "shx rm -rf dist *.tsbuildinfo", + "build": "tsc --build", + "test": "jest" + }, + "files": [ + "dist" + ], + "author": "bdehamer@github.com", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/sigstore/sigstore-js.git" + }, + "bugs": { + "url": "https://github.com/sigstore/sigstore-js/issues" + }, + "homepage": "https://github.com/sigstore/sigstore-js/tree/main/packages/verify#readme", + "publishConfig": { + "provenance": true + }, + "dependencies": { + "@sigstore/protobuf-specs": "^0.3.2", + "@sigstore/bundle": "^3.0.0", + "@sigstore/core": "^2.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } +} diff --git a/node_modules/npm/node_modules/@tufjs/canonical-json/LICENSE b/node_modules/npm/node_modules/@tufjs/canonical-json/LICENSE new file mode 100644 index 00000000..420700f5 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/canonical-json/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 GitHub and the TUF 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/npm/node_modules/@tufjs/canonical-json/lib/index.js b/node_modules/npm/node_modules/@tufjs/canonical-json/lib/index.js new file mode 100644 index 00000000..d480696d --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/canonical-json/lib/index.js @@ -0,0 +1,64 @@ +const COMMA = ','; +const COLON = ':'; +const LEFT_SQUARE_BRACKET = '['; +const RIGHT_SQUARE_BRACKET = ']'; +const LEFT_CURLY_BRACKET = '{'; +const RIGHT_CURLY_BRACKET = '}'; + +// Recursively encodes the supplied object according to the canonical JSON form +// as specified at http://wiki.laptop.org/go/Canonical_JSON. It's a restricted +// dialect of JSON in which keys are lexically sorted, floats are not allowed, +// and only double quotes and backslashes are escaped. +function canonicalize(object) { + const buffer = []; + if (typeof object === 'string') { + buffer.push(canonicalizeString(object)); + } else if (typeof object === 'boolean') { + buffer.push(JSON.stringify(object)); + } else if (Number.isInteger(object)) { + buffer.push(JSON.stringify(object)); + } else if (object === null) { + buffer.push(JSON.stringify(object)); + } else if (Array.isArray(object)) { + buffer.push(LEFT_SQUARE_BRACKET); + let first = true; + object.forEach((element) => { + if (!first) { + buffer.push(COMMA); + } + first = false; + buffer.push(canonicalize(element)); + }); + buffer.push(RIGHT_SQUARE_BRACKET); + } else if (typeof object === 'object') { + buffer.push(LEFT_CURLY_BRACKET); + let first = true; + Object.keys(object) + .sort() + .forEach((property) => { + if (!first) { + buffer.push(COMMA); + } + first = false; + buffer.push(canonicalizeString(property)); + buffer.push(COLON); + buffer.push(canonicalize(object[property])); + }); + buffer.push(RIGHT_CURLY_BRACKET); + } else { + throw new TypeError('cannot encode ' + object.toString()); + } + + return buffer.join(''); +} + +// String canonicalization consists of escaping backslash (\) and double +// quote (") characters and wrapping the resulting string in double quotes. +function canonicalizeString(string) { + const escapedString = string.replace(/\\/g, '\\\\').replace(/"/g, '\\"'); + return '"' + escapedString + '"'; +} + +module.exports = { + canonicalize, +}; diff --git a/node_modules/npm/node_modules/@tufjs/canonical-json/package.json b/node_modules/npm/node_modules/@tufjs/canonical-json/package.json new file mode 100644 index 00000000..886c0c39 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/canonical-json/package.json @@ -0,0 +1,35 @@ +{ + "name": "@tufjs/canonical-json", + "version": "2.0.0", + "description": "OLPC JSON canonicalization", + "main": "lib/index.js", + "typings": "lib/index.d.ts", + "license": "MIT", + "keywords": [ + "json", + "canonical", + "canonicalize", + "canonicalization", + "crypto", + "signature", + "olpc" + ], + "author": "bdehamer@github.com", + "repository": { + "type": "git", + "url": "git+https://github.com/theupdateframework/tuf-js.git" + }, + "homepage": "https://github.com/theupdateframework/tuf-js/tree/main/packages/canonical-json#readme", + "bugs": { + "url": "https://github.com/theupdateframework/tuf-js/issues" + }, + "files": [ + "lib/" + ], + "scripts": { + "test": "jest" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } +} diff --git a/node_modules/npm/node_modules/@tufjs/models/LICENSE b/node_modules/npm/node_modules/@tufjs/models/LICENSE new file mode 100644 index 00000000..420700f5 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 GitHub and the TUF 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/npm/node_modules/@tufjs/models/dist/base.js b/node_modules/npm/node_modules/@tufjs/models/dist/base.js new file mode 100644 index 00000000..85e45d8f --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/base.js @@ -0,0 +1,92 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Signed = exports.MetadataKind = void 0; +exports.isMetadataKind = isMetadataKind; +const util_1 = __importDefault(require("util")); +const error_1 = require("./error"); +const utils_1 = require("./utils"); +const SPECIFICATION_VERSION = ['1', '0', '31']; +var MetadataKind; +(function (MetadataKind) { + MetadataKind["Root"] = "root"; + MetadataKind["Timestamp"] = "timestamp"; + MetadataKind["Snapshot"] = "snapshot"; + MetadataKind["Targets"] = "targets"; +})(MetadataKind || (exports.MetadataKind = MetadataKind = {})); +function isMetadataKind(value) { + return (typeof value === 'string' && + Object.values(MetadataKind).includes(value)); +} +/*** + * A base class for the signed part of TUF metadata. + * + * Objects with base class Signed are usually included in a ``Metadata`` object + * on the signed attribute. This class provides attributes and methods that + * are common for all TUF metadata types (roles). + */ +class Signed { + constructor(options) { + this.specVersion = options.specVersion || SPECIFICATION_VERSION.join('.'); + const specList = this.specVersion.split('.'); + if (!(specList.length === 2 || specList.length === 3) || + !specList.every((item) => isNumeric(item))) { + throw new error_1.ValueError('Failed to parse specVersion'); + } + // major version must match + if (specList[0] != SPECIFICATION_VERSION[0]) { + throw new error_1.ValueError('Unsupported specVersion'); + } + this.expires = options.expires; + this.version = options.version; + this.unrecognizedFields = options.unrecognizedFields || {}; + } + equals(other) { + if (!(other instanceof Signed)) { + return false; + } + return (this.specVersion === other.specVersion && + this.expires === other.expires && + this.version === other.version && + util_1.default.isDeepStrictEqual(this.unrecognizedFields, other.unrecognizedFields)); + } + isExpired(referenceTime) { + if (!referenceTime) { + referenceTime = new Date(); + } + return referenceTime >= new Date(this.expires); + } + static commonFieldsFromJSON(data) { + const { spec_version, expires, version, ...rest } = data; + if (!utils_1.guard.isDefined(spec_version)) { + throw new error_1.ValueError('spec_version is not defined'); + } + else if (typeof spec_version !== 'string') { + throw new TypeError('spec_version must be a string'); + } + if (!utils_1.guard.isDefined(expires)) { + throw new error_1.ValueError('expires is not defined'); + } + else if (!(typeof expires === 'string')) { + throw new TypeError('expires must be a string'); + } + if (!utils_1.guard.isDefined(version)) { + throw new error_1.ValueError('version is not defined'); + } + else if (!(typeof version === 'number')) { + throw new TypeError('version must be a number'); + } + return { + specVersion: spec_version, + expires, + version, + unrecognizedFields: rest, + }; + } +} +exports.Signed = Signed; +function isNumeric(str) { + return !isNaN(Number(str)); +} diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/delegations.js b/node_modules/npm/node_modules/@tufjs/models/dist/delegations.js new file mode 100644 index 00000000..7165f1e2 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/delegations.js @@ -0,0 +1,115 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Delegations = void 0; +const util_1 = __importDefault(require("util")); +const error_1 = require("./error"); +const key_1 = require("./key"); +const role_1 = require("./role"); +const utils_1 = require("./utils"); +/** + * A container object storing information about all delegations. + * + * Targets roles that are trusted to provide signed metadata files + * describing targets with designated pathnames and/or further delegations. + */ +class Delegations { + constructor(options) { + this.keys = options.keys; + this.unrecognizedFields = options.unrecognizedFields || {}; + if (options.roles) { + if (Object.keys(options.roles).some((roleName) => role_1.TOP_LEVEL_ROLE_NAMES.includes(roleName))) { + throw new error_1.ValueError('Delegated role name conflicts with top-level role name'); + } + } + this.succinctRoles = options.succinctRoles; + this.roles = options.roles; + } + equals(other) { + if (!(other instanceof Delegations)) { + return false; + } + return (util_1.default.isDeepStrictEqual(this.keys, other.keys) && + util_1.default.isDeepStrictEqual(this.roles, other.roles) && + util_1.default.isDeepStrictEqual(this.unrecognizedFields, other.unrecognizedFields) && + util_1.default.isDeepStrictEqual(this.succinctRoles, other.succinctRoles)); + } + *rolesForTarget(targetPath) { + if (this.roles) { + for (const role of Object.values(this.roles)) { + if (role.isDelegatedPath(targetPath)) { + yield { role: role.name, terminating: role.terminating }; + } + } + } + else if (this.succinctRoles) { + yield { + role: this.succinctRoles.getRoleForTarget(targetPath), + terminating: true, + }; + } + } + toJSON() { + const json = { + keys: keysToJSON(this.keys), + ...this.unrecognizedFields, + }; + if (this.roles) { + json.roles = rolesToJSON(this.roles); + } + else if (this.succinctRoles) { + json.succinct_roles = this.succinctRoles.toJSON(); + } + return json; + } + static fromJSON(data) { + const { keys, roles, succinct_roles, ...unrecognizedFields } = data; + let succinctRoles; + if (utils_1.guard.isObject(succinct_roles)) { + succinctRoles = role_1.SuccinctRoles.fromJSON(succinct_roles); + } + return new Delegations({ + keys: keysFromJSON(keys), + roles: rolesFromJSON(roles), + unrecognizedFields, + succinctRoles, + }); + } +} +exports.Delegations = Delegations; +function keysToJSON(keys) { + return Object.entries(keys).reduce((acc, [keyId, key]) => ({ + ...acc, + [keyId]: key.toJSON(), + }), {}); +} +function rolesToJSON(roles) { + return Object.values(roles).map((role) => role.toJSON()); +} +function keysFromJSON(data) { + if (!utils_1.guard.isObjectRecord(data)) { + throw new TypeError('keys is malformed'); + } + return Object.entries(data).reduce((acc, [keyID, keyData]) => ({ + ...acc, + [keyID]: key_1.Key.fromJSON(keyID, keyData), + }), {}); +} +function rolesFromJSON(data) { + let roleMap; + if (utils_1.guard.isDefined(data)) { + if (!utils_1.guard.isObjectArray(data)) { + throw new TypeError('roles is malformed'); + } + roleMap = data.reduce((acc, role) => { + const delegatedRole = role_1.DelegatedRole.fromJSON(role); + return { + ...acc, + [delegatedRole.name]: delegatedRole, + }; + }, {}); + } + return roleMap; +} diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/error.js b/node_modules/npm/node_modules/@tufjs/models/dist/error.js new file mode 100644 index 00000000..ba806987 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/error.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UnsupportedAlgorithmError = exports.CryptoError = exports.LengthOrHashMismatchError = exports.UnsignedMetadataError = exports.RepositoryError = exports.ValueError = void 0; +// An error about insufficient values +class ValueError extends Error { +} +exports.ValueError = ValueError; +// An error with a repository's state, such as a missing file. +// It covers all exceptions that come from the repository side when +// looking from the perspective of users of metadata API or ngclient. +class RepositoryError extends Error { +} +exports.RepositoryError = RepositoryError; +// An error about metadata object with insufficient threshold of signatures. +class UnsignedMetadataError extends RepositoryError { +} +exports.UnsignedMetadataError = UnsignedMetadataError; +// An error while checking the length and hash values of an object. +class LengthOrHashMismatchError extends RepositoryError { +} +exports.LengthOrHashMismatchError = LengthOrHashMismatchError; +class CryptoError extends Error { +} +exports.CryptoError = CryptoError; +class UnsupportedAlgorithmError extends CryptoError { +} +exports.UnsupportedAlgorithmError = UnsupportedAlgorithmError; diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/file.js b/node_modules/npm/node_modules/@tufjs/models/dist/file.js new file mode 100644 index 00000000..b35fe595 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/file.js @@ -0,0 +1,183 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TargetFile = exports.MetaFile = void 0; +const crypto_1 = __importDefault(require("crypto")); +const util_1 = __importDefault(require("util")); +const error_1 = require("./error"); +const utils_1 = require("./utils"); +// A container with information about a particular metadata file. +// +// This class is used for Timestamp and Snapshot metadata. +class MetaFile { + constructor(opts) { + if (opts.version <= 0) { + throw new error_1.ValueError('Metafile version must be at least 1'); + } + if (opts.length !== undefined) { + validateLength(opts.length); + } + this.version = opts.version; + this.length = opts.length; + this.hashes = opts.hashes; + this.unrecognizedFields = opts.unrecognizedFields || {}; + } + equals(other) { + if (!(other instanceof MetaFile)) { + return false; + } + return (this.version === other.version && + this.length === other.length && + util_1.default.isDeepStrictEqual(this.hashes, other.hashes) && + util_1.default.isDeepStrictEqual(this.unrecognizedFields, other.unrecognizedFields)); + } + verify(data) { + // Verifies that the given data matches the expected length. + if (this.length !== undefined) { + if (data.length !== this.length) { + throw new error_1.LengthOrHashMismatchError(`Expected length ${this.length} but got ${data.length}`); + } + } + // Verifies that the given data matches the supplied hashes. + if (this.hashes) { + Object.entries(this.hashes).forEach(([key, value]) => { + let hash; + try { + hash = crypto_1.default.createHash(key); + } + catch (e) { + throw new error_1.LengthOrHashMismatchError(`Hash algorithm ${key} not supported`); + } + const observedHash = hash.update(data).digest('hex'); + if (observedHash !== value) { + throw new error_1.LengthOrHashMismatchError(`Expected hash ${value} but got ${observedHash}`); + } + }); + } + } + toJSON() { + const json = { + version: this.version, + ...this.unrecognizedFields, + }; + if (this.length !== undefined) { + json.length = this.length; + } + if (this.hashes) { + json.hashes = this.hashes; + } + return json; + } + static fromJSON(data) { + const { version, length, hashes, ...rest } = data; + if (typeof version !== 'number') { + throw new TypeError('version must be a number'); + } + if (utils_1.guard.isDefined(length) && typeof length !== 'number') { + throw new TypeError('length must be a number'); + } + if (utils_1.guard.isDefined(hashes) && !utils_1.guard.isStringRecord(hashes)) { + throw new TypeError('hashes must be string keys and values'); + } + return new MetaFile({ + version, + length, + hashes, + unrecognizedFields: rest, + }); + } +} +exports.MetaFile = MetaFile; +// Container for info about a particular target file. +// +// This class is used for Target metadata. +class TargetFile { + constructor(opts) { + validateLength(opts.length); + this.length = opts.length; + this.path = opts.path; + this.hashes = opts.hashes; + this.unrecognizedFields = opts.unrecognizedFields || {}; + } + get custom() { + const custom = this.unrecognizedFields['custom']; + if (!custom || Array.isArray(custom) || !(typeof custom === 'object')) { + return {}; + } + return custom; + } + equals(other) { + if (!(other instanceof TargetFile)) { + return false; + } + return (this.length === other.length && + this.path === other.path && + util_1.default.isDeepStrictEqual(this.hashes, other.hashes) && + util_1.default.isDeepStrictEqual(this.unrecognizedFields, other.unrecognizedFields)); + } + async verify(stream) { + let observedLength = 0; + // Create a digest for each hash algorithm + const digests = Object.keys(this.hashes).reduce((acc, key) => { + try { + acc[key] = crypto_1.default.createHash(key); + } + catch (e) { + throw new error_1.LengthOrHashMismatchError(`Hash algorithm ${key} not supported`); + } + return acc; + }, {}); + // Read stream chunk by chunk + for await (const chunk of stream) { + // Keep running tally of stream length + observedLength += chunk.length; + // Append chunk to each digest + Object.values(digests).forEach((digest) => { + digest.update(chunk); + }); + } + // Verify length matches expected value + if (observedLength !== this.length) { + throw new error_1.LengthOrHashMismatchError(`Expected length ${this.length} but got ${observedLength}`); + } + // Verify each digest matches expected value + Object.entries(digests).forEach(([key, value]) => { + const expected = this.hashes[key]; + const actual = value.digest('hex'); + if (actual !== expected) { + throw new error_1.LengthOrHashMismatchError(`Expected hash ${expected} but got ${actual}`); + } + }); + } + toJSON() { + return { + length: this.length, + hashes: this.hashes, + ...this.unrecognizedFields, + }; + } + static fromJSON(path, data) { + const { length, hashes, ...rest } = data; + if (typeof length !== 'number') { + throw new TypeError('length must be a number'); + } + if (!utils_1.guard.isStringRecord(hashes)) { + throw new TypeError('hashes must have string keys and values'); + } + return new TargetFile({ + length, + path, + hashes, + unrecognizedFields: rest, + }); + } +} +exports.TargetFile = TargetFile; +// Check that supplied length if valid +function validateLength(length) { + if (length < 0) { + throw new error_1.ValueError('Length must be at least 0'); + } +} diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/index.js b/node_modules/npm/node_modules/@tufjs/models/dist/index.js new file mode 100644 index 00000000..a4dc7836 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/index.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Timestamp = exports.Targets = exports.Snapshot = exports.Signature = exports.Root = exports.Metadata = exports.Key = exports.TargetFile = exports.MetaFile = exports.ValueError = exports.MetadataKind = void 0; +var base_1 = require("./base"); +Object.defineProperty(exports, "MetadataKind", { enumerable: true, get: function () { return base_1.MetadataKind; } }); +var error_1 = require("./error"); +Object.defineProperty(exports, "ValueError", { enumerable: true, get: function () { return error_1.ValueError; } }); +var file_1 = require("./file"); +Object.defineProperty(exports, "MetaFile", { enumerable: true, get: function () { return file_1.MetaFile; } }); +Object.defineProperty(exports, "TargetFile", { enumerable: true, get: function () { return file_1.TargetFile; } }); +var key_1 = require("./key"); +Object.defineProperty(exports, "Key", { enumerable: true, get: function () { return key_1.Key; } }); +var metadata_1 = require("./metadata"); +Object.defineProperty(exports, "Metadata", { enumerable: true, get: function () { return metadata_1.Metadata; } }); +var root_1 = require("./root"); +Object.defineProperty(exports, "Root", { enumerable: true, get: function () { return root_1.Root; } }); +var signature_1 = require("./signature"); +Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return signature_1.Signature; } }); +var snapshot_1 = require("./snapshot"); +Object.defineProperty(exports, "Snapshot", { enumerable: true, get: function () { return snapshot_1.Snapshot; } }); +var targets_1 = require("./targets"); +Object.defineProperty(exports, "Targets", { enumerable: true, get: function () { return targets_1.Targets; } }); +var timestamp_1 = require("./timestamp"); +Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return timestamp_1.Timestamp; } }); diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/key.js b/node_modules/npm/node_modules/@tufjs/models/dist/key.js new file mode 100644 index 00000000..5e55b09d --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/key.js @@ -0,0 +1,85 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Key = void 0; +const util_1 = __importDefault(require("util")); +const error_1 = require("./error"); +const utils_1 = require("./utils"); +const key_1 = require("./utils/key"); +// A container class representing the public portion of a Key. +class Key { + constructor(options) { + const { keyID, keyType, scheme, keyVal, unrecognizedFields } = options; + this.keyID = keyID; + this.keyType = keyType; + this.scheme = scheme; + this.keyVal = keyVal; + this.unrecognizedFields = unrecognizedFields || {}; + } + // Verifies the that the metadata.signatures contains a signature made with + // this key and is correctly signed. + verifySignature(metadata) { + const signature = metadata.signatures[this.keyID]; + if (!signature) + throw new error_1.UnsignedMetadataError('no signature for key found in metadata'); + if (!this.keyVal.public) + throw new error_1.UnsignedMetadataError('no public key found'); + const publicKey = (0, key_1.getPublicKey)({ + keyType: this.keyType, + scheme: this.scheme, + keyVal: this.keyVal.public, + }); + const signedData = metadata.signed.toJSON(); + try { + if (!utils_1.crypto.verifySignature(signedData, publicKey, signature.sig)) { + throw new error_1.UnsignedMetadataError(`failed to verify ${this.keyID} signature`); + } + } + catch (error) { + if (error instanceof error_1.UnsignedMetadataError) { + throw error; + } + throw new error_1.UnsignedMetadataError(`failed to verify ${this.keyID} signature`); + } + } + equals(other) { + if (!(other instanceof Key)) { + return false; + } + return (this.keyID === other.keyID && + this.keyType === other.keyType && + this.scheme === other.scheme && + util_1.default.isDeepStrictEqual(this.keyVal, other.keyVal) && + util_1.default.isDeepStrictEqual(this.unrecognizedFields, other.unrecognizedFields)); + } + toJSON() { + return { + keytype: this.keyType, + scheme: this.scheme, + keyval: this.keyVal, + ...this.unrecognizedFields, + }; + } + static fromJSON(keyID, data) { + const { keytype, scheme, keyval, ...rest } = data; + if (typeof keytype !== 'string') { + throw new TypeError('keytype must be a string'); + } + if (typeof scheme !== 'string') { + throw new TypeError('scheme must be a string'); + } + if (!utils_1.guard.isStringRecord(keyval)) { + throw new TypeError('keyval must be a string record'); + } + return new Key({ + keyID, + keyType: keytype, + scheme, + keyVal: keyval, + unrecognizedFields: rest, + }); + } +} +exports.Key = Key; diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/metadata.js b/node_modules/npm/node_modules/@tufjs/models/dist/metadata.js new file mode 100644 index 00000000..389d2504 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/metadata.js @@ -0,0 +1,160 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Metadata = void 0; +const canonical_json_1 = require("@tufjs/canonical-json"); +const util_1 = __importDefault(require("util")); +const base_1 = require("./base"); +const error_1 = require("./error"); +const root_1 = require("./root"); +const signature_1 = require("./signature"); +const snapshot_1 = require("./snapshot"); +const targets_1 = require("./targets"); +const timestamp_1 = require("./timestamp"); +const utils_1 = require("./utils"); +/*** + * A container for signed TUF metadata. + * + * Provides methods to convert to and from json, read and write to and + * from JSON and to create and verify metadata signatures. + * + * ``Metadata[T]`` is a generic container type where T can be any one type of + * [``Root``, ``Timestamp``, ``Snapshot``, ``Targets``]. The purpose of this + * is to allow static type checking of the signed attribute in code using + * Metadata:: + * + * root_md = Metadata[Root].fromJSON("root.json") + * # root_md type is now Metadata[Root]. This means signed and its + * # attributes like consistent_snapshot are now statically typed and the + * # types can be verified by static type checkers and shown by IDEs + * + * Using a type constraint is not required but not doing so means T is not a + * specific type so static typing cannot happen. Note that the type constraint + * ``[Root]`` is not validated at runtime (as pure annotations are not available + * then). + * + * Apart from ``expires`` all of the arguments to the inner constructors have + * reasonable default values for new metadata. + */ +class Metadata { + constructor(signed, signatures, unrecognizedFields) { + this.signed = signed; + this.signatures = signatures || {}; + this.unrecognizedFields = unrecognizedFields || {}; + } + sign(signer, append = true) { + const bytes = Buffer.from((0, canonical_json_1.canonicalize)(this.signed.toJSON())); + const signature = signer(bytes); + if (!append) { + this.signatures = {}; + } + this.signatures[signature.keyID] = signature; + } + verifyDelegate(delegatedRole, delegatedMetadata) { + let role; + let keys = {}; + switch (this.signed.type) { + case base_1.MetadataKind.Root: + keys = this.signed.keys; + role = this.signed.roles[delegatedRole]; + break; + case base_1.MetadataKind.Targets: + if (!this.signed.delegations) { + throw new error_1.ValueError(`No delegations found for ${delegatedRole}`); + } + keys = this.signed.delegations.keys; + if (this.signed.delegations.roles) { + role = this.signed.delegations.roles[delegatedRole]; + } + else if (this.signed.delegations.succinctRoles) { + if (this.signed.delegations.succinctRoles.isDelegatedRole(delegatedRole)) { + role = this.signed.delegations.succinctRoles; + } + } + break; + default: + throw new TypeError('invalid metadata type'); + } + if (!role) { + throw new error_1.ValueError(`no delegation found for ${delegatedRole}`); + } + const signingKeys = new Set(); + role.keyIDs.forEach((keyID) => { + const key = keys[keyID]; + // If we dont' have the key, continue checking other keys + if (!key) { + return; + } + try { + key.verifySignature(delegatedMetadata); + signingKeys.add(key.keyID); + } + catch (error) { + // continue + } + }); + if (signingKeys.size < role.threshold) { + throw new error_1.UnsignedMetadataError(`${delegatedRole} was signed by ${signingKeys.size}/${role.threshold} keys`); + } + } + equals(other) { + if (!(other instanceof Metadata)) { + return false; + } + return (this.signed.equals(other.signed) && + util_1.default.isDeepStrictEqual(this.signatures, other.signatures) && + util_1.default.isDeepStrictEqual(this.unrecognizedFields, other.unrecognizedFields)); + } + toJSON() { + const signatures = Object.values(this.signatures).map((signature) => { + return signature.toJSON(); + }); + return { + signatures, + signed: this.signed.toJSON(), + ...this.unrecognizedFields, + }; + } + static fromJSON(type, data) { + const { signed, signatures, ...rest } = data; + if (!utils_1.guard.isDefined(signed) || !utils_1.guard.isObject(signed)) { + throw new TypeError('signed is not defined'); + } + if (type !== signed._type) { + throw new error_1.ValueError(`expected '${type}', got ${signed['_type']}`); + } + if (!utils_1.guard.isObjectArray(signatures)) { + throw new TypeError('signatures is not an array'); + } + let signedObj; + switch (type) { + case base_1.MetadataKind.Root: + signedObj = root_1.Root.fromJSON(signed); + break; + case base_1.MetadataKind.Timestamp: + signedObj = timestamp_1.Timestamp.fromJSON(signed); + break; + case base_1.MetadataKind.Snapshot: + signedObj = snapshot_1.Snapshot.fromJSON(signed); + break; + case base_1.MetadataKind.Targets: + signedObj = targets_1.Targets.fromJSON(signed); + break; + default: + throw new TypeError('invalid metadata type'); + } + const sigMap = {}; + // Ensure that each signature is unique + signatures.forEach((sigData) => { + const sig = signature_1.Signature.fromJSON(sigData); + if (sigMap[sig.keyID]) { + throw new error_1.ValueError(`multiple signatures found for keyid: ${sig.keyID}`); + } + sigMap[sig.keyID] = sig; + }); + return new Metadata(signedObj, sigMap, rest); + } +} +exports.Metadata = Metadata; diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/role.js b/node_modules/npm/node_modules/@tufjs/models/dist/role.js new file mode 100644 index 00000000..f7ddbc6f --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/role.js @@ -0,0 +1,299 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SuccinctRoles = exports.DelegatedRole = exports.Role = exports.TOP_LEVEL_ROLE_NAMES = void 0; +const crypto_1 = __importDefault(require("crypto")); +const minimatch_1 = require("minimatch"); +const util_1 = __importDefault(require("util")); +const error_1 = require("./error"); +const utils_1 = require("./utils"); +exports.TOP_LEVEL_ROLE_NAMES = [ + 'root', + 'targets', + 'snapshot', + 'timestamp', +]; +/** + * Container that defines which keys are required to sign roles metadata. + * + * Role defines how many keys are required to successfully sign the roles + * metadata, and which keys are accepted. + */ +class Role { + constructor(options) { + const { keyIDs, threshold, unrecognizedFields } = options; + if (hasDuplicates(keyIDs)) { + throw new error_1.ValueError('duplicate key IDs found'); + } + if (threshold < 1) { + throw new error_1.ValueError('threshold must be at least 1'); + } + this.keyIDs = keyIDs; + this.threshold = threshold; + this.unrecognizedFields = unrecognizedFields || {}; + } + equals(other) { + if (!(other instanceof Role)) { + return false; + } + return (this.threshold === other.threshold && + util_1.default.isDeepStrictEqual(this.keyIDs, other.keyIDs) && + util_1.default.isDeepStrictEqual(this.unrecognizedFields, other.unrecognizedFields)); + } + toJSON() { + return { + keyids: this.keyIDs, + threshold: this.threshold, + ...this.unrecognizedFields, + }; + } + static fromJSON(data) { + const { keyids, threshold, ...rest } = data; + if (!utils_1.guard.isStringArray(keyids)) { + throw new TypeError('keyids must be an array'); + } + if (typeof threshold !== 'number') { + throw new TypeError('threshold must be a number'); + } + return new Role({ + keyIDs: keyids, + threshold, + unrecognizedFields: rest, + }); + } +} +exports.Role = Role; +function hasDuplicates(array) { + return new Set(array).size !== array.length; +} +/** + * A container with information about a delegated role. + * + * A delegation can happen in two ways: + * - ``paths`` is set: delegates targets matching any path pattern in ``paths`` + * - ``pathHashPrefixes`` is set: delegates targets whose target path hash + * starts with any of the prefixes in ``pathHashPrefixes`` + * + * ``paths`` and ``pathHashPrefixes`` are mutually exclusive: both cannot be + * set, at least one of them must be set. + */ +class DelegatedRole extends Role { + constructor(opts) { + super(opts); + const { name, terminating, paths, pathHashPrefixes } = opts; + this.name = name; + this.terminating = terminating; + if (opts.paths && opts.pathHashPrefixes) { + throw new error_1.ValueError('paths and pathHashPrefixes are mutually exclusive'); + } + this.paths = paths; + this.pathHashPrefixes = pathHashPrefixes; + } + equals(other) { + if (!(other instanceof DelegatedRole)) { + return false; + } + return (super.equals(other) && + this.name === other.name && + this.terminating === other.terminating && + util_1.default.isDeepStrictEqual(this.paths, other.paths) && + util_1.default.isDeepStrictEqual(this.pathHashPrefixes, other.pathHashPrefixes)); + } + isDelegatedPath(targetFilepath) { + if (this.paths) { + return this.paths.some((pathPattern) => isTargetInPathPattern(targetFilepath, pathPattern)); + } + if (this.pathHashPrefixes) { + const hasher = crypto_1.default.createHash('sha256'); + const pathHash = hasher.update(targetFilepath).digest('hex'); + return this.pathHashPrefixes.some((pathHashPrefix) => pathHash.startsWith(pathHashPrefix)); + } + return false; + } + toJSON() { + const json = { + ...super.toJSON(), + name: this.name, + terminating: this.terminating, + }; + if (this.paths) { + json.paths = this.paths; + } + if (this.pathHashPrefixes) { + json.path_hash_prefixes = this.pathHashPrefixes; + } + return json; + } + static fromJSON(data) { + const { keyids, threshold, name, terminating, paths, path_hash_prefixes, ...rest } = data; + if (!utils_1.guard.isStringArray(keyids)) { + throw new TypeError('keyids must be an array of strings'); + } + if (typeof threshold !== 'number') { + throw new TypeError('threshold must be a number'); + } + if (typeof name !== 'string') { + throw new TypeError('name must be a string'); + } + if (typeof terminating !== 'boolean') { + throw new TypeError('terminating must be a boolean'); + } + if (utils_1.guard.isDefined(paths) && !utils_1.guard.isStringArray(paths)) { + throw new TypeError('paths must be an array of strings'); + } + if (utils_1.guard.isDefined(path_hash_prefixes) && + !utils_1.guard.isStringArray(path_hash_prefixes)) { + throw new TypeError('path_hash_prefixes must be an array of strings'); + } + return new DelegatedRole({ + keyIDs: keyids, + threshold, + name, + terminating, + paths, + pathHashPrefixes: path_hash_prefixes, + unrecognizedFields: rest, + }); + } +} +exports.DelegatedRole = DelegatedRole; +// JS version of Ruby's Array#zip +const zip = (a, b) => a.map((k, i) => [k, b[i]]); +function isTargetInPathPattern(target, pattern) { + const targetParts = target.split('/'); + const patternParts = pattern.split('/'); + if (patternParts.length != targetParts.length) { + return false; + } + return zip(targetParts, patternParts).every(([targetPart, patternPart]) => (0, minimatch_1.minimatch)(targetPart, patternPart)); +} +/** + * Succinctly defines a hash bin delegation graph. + * + * A ``SuccinctRoles`` object describes a delegation graph that covers all + * targets, distributing them uniformly over the delegated roles (i.e. bins) + * in the graph. + * + * The total number of bins is 2 to the power of the passed ``bit_length``. + * + * Bin names are the concatenation of the passed ``name_prefix`` and a + * zero-padded hex representation of the bin index separated by a hyphen. + * + * The passed ``keyids`` and ``threshold`` is used for each bin, and each bin + * is 'terminating'. + * + * For details: https://github.com/theupdateframework/taps/blob/master/tap15.md + */ +class SuccinctRoles extends Role { + constructor(opts) { + super(opts); + const { bitLength, namePrefix } = opts; + if (bitLength <= 0 || bitLength > 32) { + throw new error_1.ValueError('bitLength must be between 1 and 32'); + } + this.bitLength = bitLength; + this.namePrefix = namePrefix; + // Calculate the suffix_len value based on the total number of bins in + // hex. If bit_length = 10 then number_of_bins = 1024 or bin names will + // have a suffix between "000" and "3ff" in hex and suffix_len will be 3 + // meaning the third bin will have a suffix of "003". + this.numberOfBins = Math.pow(2, bitLength); + // suffix_len is calculated based on "number_of_bins - 1" as the name + // of the last bin contains the number "number_of_bins -1" as a suffix. + this.suffixLen = (this.numberOfBins - 1).toString(16).length; + } + equals(other) { + if (!(other instanceof SuccinctRoles)) { + return false; + } + return (super.equals(other) && + this.bitLength === other.bitLength && + this.namePrefix === other.namePrefix); + } + /*** + * Calculates the name of the delegated role responsible for 'target_filepath'. + * + * The target at path ''target_filepath' is assigned to a bin by casting + * the left-most 'bit_length' of bits of the file path hash digest to + * int, using it as bin index between 0 and '2**bit_length - 1'. + * + * Args: + * target_filepath: URL path to a target file, relative to a base + * targets URL. + */ + getRoleForTarget(targetFilepath) { + const hasher = crypto_1.default.createHash('sha256'); + const hasherBuffer = hasher.update(targetFilepath).digest(); + // can't ever need more than 4 bytes (32 bits). + const hashBytes = hasherBuffer.subarray(0, 4); + // Right shift hash bytes, so that we only have the leftmost + // bit_length bits that we care about. + const shiftValue = 32 - this.bitLength; + const binNumber = hashBytes.readUInt32BE() >>> shiftValue; + // Add zero padding if necessary and cast to hex the suffix. + const suffix = binNumber.toString(16).padStart(this.suffixLen, '0'); + return `${this.namePrefix}-${suffix}`; + } + *getRoles() { + for (let i = 0; i < this.numberOfBins; i++) { + const suffix = i.toString(16).padStart(this.suffixLen, '0'); + yield `${this.namePrefix}-${suffix}`; + } + } + /*** + * Determines whether the given ``role_name`` is in one of + * the delegated roles that ``SuccinctRoles`` represents. + * + * Args: + * role_name: The name of the role to check against. + */ + isDelegatedRole(roleName) { + const desiredPrefix = this.namePrefix + '-'; + if (!roleName.startsWith(desiredPrefix)) { + return false; + } + const suffix = roleName.slice(desiredPrefix.length, roleName.length); + if (suffix.length != this.suffixLen) { + return false; + } + // make sure the suffix is a hex string + if (!suffix.match(/^[0-9a-fA-F]+$/)) { + return false; + } + const num = parseInt(suffix, 16); + return 0 <= num && num < this.numberOfBins; + } + toJSON() { + const json = { + ...super.toJSON(), + bit_length: this.bitLength, + name_prefix: this.namePrefix, + }; + return json; + } + static fromJSON(data) { + const { keyids, threshold, bit_length, name_prefix, ...rest } = data; + if (!utils_1.guard.isStringArray(keyids)) { + throw new TypeError('keyids must be an array of strings'); + } + if (typeof threshold !== 'number') { + throw new TypeError('threshold must be a number'); + } + if (typeof bit_length !== 'number') { + throw new TypeError('bit_length must be a number'); + } + if (typeof name_prefix !== 'string') { + throw new TypeError('name_prefix must be a string'); + } + return new SuccinctRoles({ + keyIDs: keyids, + threshold, + bitLength: bit_length, + namePrefix: name_prefix, + unrecognizedFields: rest, + }); + } +} +exports.SuccinctRoles = SuccinctRoles; diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/root.js b/node_modules/npm/node_modules/@tufjs/models/dist/root.js new file mode 100644 index 00000000..36d0ef0f --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/root.js @@ -0,0 +1,116 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Root = void 0; +const util_1 = __importDefault(require("util")); +const base_1 = require("./base"); +const error_1 = require("./error"); +const key_1 = require("./key"); +const role_1 = require("./role"); +const utils_1 = require("./utils"); +/** + * A container for the signed part of root metadata. + * + * The top-level role and metadata file signed by the root keys. + * This role specifies trusted keys for all other top-level roles, which may further delegate trust. + */ +class Root extends base_1.Signed { + constructor(options) { + super(options); + this.type = base_1.MetadataKind.Root; + this.keys = options.keys || {}; + this.consistentSnapshot = options.consistentSnapshot ?? true; + if (!options.roles) { + this.roles = role_1.TOP_LEVEL_ROLE_NAMES.reduce((acc, role) => ({ + ...acc, + [role]: new role_1.Role({ keyIDs: [], threshold: 1 }), + }), {}); + } + else { + const roleNames = new Set(Object.keys(options.roles)); + if (!role_1.TOP_LEVEL_ROLE_NAMES.every((role) => roleNames.has(role))) { + throw new error_1.ValueError('missing top-level role'); + } + this.roles = options.roles; + } + } + addKey(key, role) { + if (!this.roles[role]) { + throw new error_1.ValueError(`role ${role} does not exist`); + } + if (!this.roles[role].keyIDs.includes(key.keyID)) { + this.roles[role].keyIDs.push(key.keyID); + } + this.keys[key.keyID] = key; + } + equals(other) { + if (!(other instanceof Root)) { + return false; + } + return (super.equals(other) && + this.consistentSnapshot === other.consistentSnapshot && + util_1.default.isDeepStrictEqual(this.keys, other.keys) && + util_1.default.isDeepStrictEqual(this.roles, other.roles)); + } + toJSON() { + return { + _type: this.type, + spec_version: this.specVersion, + version: this.version, + expires: this.expires, + keys: keysToJSON(this.keys), + roles: rolesToJSON(this.roles), + consistent_snapshot: this.consistentSnapshot, + ...this.unrecognizedFields, + }; + } + static fromJSON(data) { + const { unrecognizedFields, ...commonFields } = base_1.Signed.commonFieldsFromJSON(data); + const { keys, roles, consistent_snapshot, ...rest } = unrecognizedFields; + if (typeof consistent_snapshot !== 'boolean') { + throw new TypeError('consistent_snapshot must be a boolean'); + } + return new Root({ + ...commonFields, + keys: keysFromJSON(keys), + roles: rolesFromJSON(roles), + consistentSnapshot: consistent_snapshot, + unrecognizedFields: rest, + }); + } +} +exports.Root = Root; +function keysToJSON(keys) { + return Object.entries(keys).reduce((acc, [keyID, key]) => ({ ...acc, [keyID]: key.toJSON() }), {}); +} +function rolesToJSON(roles) { + return Object.entries(roles).reduce((acc, [roleName, role]) => ({ ...acc, [roleName]: role.toJSON() }), {}); +} +function keysFromJSON(data) { + let keys; + if (utils_1.guard.isDefined(data)) { + if (!utils_1.guard.isObjectRecord(data)) { + throw new TypeError('keys must be an object'); + } + keys = Object.entries(data).reduce((acc, [keyID, keyData]) => ({ + ...acc, + [keyID]: key_1.Key.fromJSON(keyID, keyData), + }), {}); + } + return keys; +} +function rolesFromJSON(data) { + let roles; + if (utils_1.guard.isDefined(data)) { + if (!utils_1.guard.isObjectRecord(data)) { + throw new TypeError('roles must be an object'); + } + roles = Object.entries(data).reduce((acc, [roleName, roleData]) => ({ + ...acc, + [roleName]: role_1.Role.fromJSON(roleData), + }), {}); + } + return roles; +} diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/signature.js b/node_modules/npm/node_modules/@tufjs/models/dist/signature.js new file mode 100644 index 00000000..33eb204e --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/signature.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Signature = void 0; +/** + * A container class containing information about a signature. + * + * Contains a signature and the keyid uniquely identifying the key used + * to generate the signature. + * + * Provide a `fromJSON` method to create a Signature from a JSON object. + */ +class Signature { + constructor(options) { + const { keyID, sig } = options; + this.keyID = keyID; + this.sig = sig; + } + toJSON() { + return { + keyid: this.keyID, + sig: this.sig, + }; + } + static fromJSON(data) { + const { keyid, sig } = data; + if (typeof keyid !== 'string') { + throw new TypeError('keyid must be a string'); + } + if (typeof sig !== 'string') { + throw new TypeError('sig must be a string'); + } + return new Signature({ + keyID: keyid, + sig: sig, + }); + } +} +exports.Signature = Signature; diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/snapshot.js b/node_modules/npm/node_modules/@tufjs/models/dist/snapshot.js new file mode 100644 index 00000000..e90ea8e7 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/snapshot.js @@ -0,0 +1,71 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Snapshot = void 0; +const util_1 = __importDefault(require("util")); +const base_1 = require("./base"); +const file_1 = require("./file"); +const utils_1 = require("./utils"); +/** + * A container for the signed part of snapshot metadata. + * + * Snapshot contains information about all target Metadata files. + * A top-level role that specifies the latest versions of all targets metadata files, + * and hence the latest versions of all targets (including any dependencies between them) on the repository. + */ +class Snapshot extends base_1.Signed { + constructor(opts) { + super(opts); + this.type = base_1.MetadataKind.Snapshot; + this.meta = opts.meta || { 'targets.json': new file_1.MetaFile({ version: 1 }) }; + } + equals(other) { + if (!(other instanceof Snapshot)) { + return false; + } + return super.equals(other) && util_1.default.isDeepStrictEqual(this.meta, other.meta); + } + toJSON() { + return { + _type: this.type, + meta: metaToJSON(this.meta), + spec_version: this.specVersion, + version: this.version, + expires: this.expires, + ...this.unrecognizedFields, + }; + } + static fromJSON(data) { + const { unrecognizedFields, ...commonFields } = base_1.Signed.commonFieldsFromJSON(data); + const { meta, ...rest } = unrecognizedFields; + return new Snapshot({ + ...commonFields, + meta: metaFromJSON(meta), + unrecognizedFields: rest, + }); + } +} +exports.Snapshot = Snapshot; +function metaToJSON(meta) { + return Object.entries(meta).reduce((acc, [path, metadata]) => ({ + ...acc, + [path]: metadata.toJSON(), + }), {}); +} +function metaFromJSON(data) { + let meta; + if (utils_1.guard.isDefined(data)) { + if (!utils_1.guard.isObjectRecord(data)) { + throw new TypeError('meta field is malformed'); + } + else { + meta = Object.entries(data).reduce((acc, [path, metadata]) => ({ + ...acc, + [path]: file_1.MetaFile.fromJSON(metadata), + }), {}); + } + } + return meta; +} diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/targets.js b/node_modules/npm/node_modules/@tufjs/models/dist/targets.js new file mode 100644 index 00000000..54bd8f8c --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/targets.js @@ -0,0 +1,92 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Targets = void 0; +const util_1 = __importDefault(require("util")); +const base_1 = require("./base"); +const delegations_1 = require("./delegations"); +const file_1 = require("./file"); +const utils_1 = require("./utils"); +// Container for the signed part of targets metadata. +// +// Targets contains verifying information about target files and also delegates +// responsible to other Targets roles. +class Targets extends base_1.Signed { + constructor(options) { + super(options); + this.type = base_1.MetadataKind.Targets; + this.targets = options.targets || {}; + this.delegations = options.delegations; + } + addTarget(target) { + this.targets[target.path] = target; + } + equals(other) { + if (!(other instanceof Targets)) { + return false; + } + return (super.equals(other) && + util_1.default.isDeepStrictEqual(this.targets, other.targets) && + util_1.default.isDeepStrictEqual(this.delegations, other.delegations)); + } + toJSON() { + const json = { + _type: this.type, + spec_version: this.specVersion, + version: this.version, + expires: this.expires, + targets: targetsToJSON(this.targets), + ...this.unrecognizedFields, + }; + if (this.delegations) { + json.delegations = this.delegations.toJSON(); + } + return json; + } + static fromJSON(data) { + const { unrecognizedFields, ...commonFields } = base_1.Signed.commonFieldsFromJSON(data); + const { targets, delegations, ...rest } = unrecognizedFields; + return new Targets({ + ...commonFields, + targets: targetsFromJSON(targets), + delegations: delegationsFromJSON(delegations), + unrecognizedFields: rest, + }); + } +} +exports.Targets = Targets; +function targetsToJSON(targets) { + return Object.entries(targets).reduce((acc, [path, target]) => ({ + ...acc, + [path]: target.toJSON(), + }), {}); +} +function targetsFromJSON(data) { + let targets; + if (utils_1.guard.isDefined(data)) { + if (!utils_1.guard.isObjectRecord(data)) { + throw new TypeError('targets must be an object'); + } + else { + targets = Object.entries(data).reduce((acc, [path, target]) => ({ + ...acc, + [path]: file_1.TargetFile.fromJSON(path, target), + }), {}); + } + } + return targets; +} +function delegationsFromJSON(data) { + let delegations; + if (utils_1.guard.isDefined(data)) { + if (!utils_1.guard.isObject(data)) { + throw new TypeError('delegations must be an object'); + } + else { + delegations = delegations_1.Delegations.fromJSON(data); + } + } + return delegations; +} diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/timestamp.js b/node_modules/npm/node_modules/@tufjs/models/dist/timestamp.js new file mode 100644 index 00000000..9880c4c9 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/timestamp.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Timestamp = void 0; +const base_1 = require("./base"); +const file_1 = require("./file"); +const utils_1 = require("./utils"); +/** + * A container for the signed part of timestamp metadata. + * + * A top-level that specifies the latest version of the snapshot role metadata file, + * and hence the latest versions of all metadata and targets on the repository. + */ +class Timestamp extends base_1.Signed { + constructor(options) { + super(options); + this.type = base_1.MetadataKind.Timestamp; + this.snapshotMeta = options.snapshotMeta || new file_1.MetaFile({ version: 1 }); + } + equals(other) { + if (!(other instanceof Timestamp)) { + return false; + } + return super.equals(other) && this.snapshotMeta.equals(other.snapshotMeta); + } + toJSON() { + return { + _type: this.type, + spec_version: this.specVersion, + version: this.version, + expires: this.expires, + meta: { 'snapshot.json': this.snapshotMeta.toJSON() }, + ...this.unrecognizedFields, + }; + } + static fromJSON(data) { + const { unrecognizedFields, ...commonFields } = base_1.Signed.commonFieldsFromJSON(data); + const { meta, ...rest } = unrecognizedFields; + return new Timestamp({ + ...commonFields, + snapshotMeta: snapshotMetaFromJSON(meta), + unrecognizedFields: rest, + }); + } +} +exports.Timestamp = Timestamp; +function snapshotMetaFromJSON(data) { + let snapshotMeta; + if (utils_1.guard.isDefined(data)) { + const snapshotData = data['snapshot.json']; + if (!utils_1.guard.isDefined(snapshotData) || !utils_1.guard.isObject(snapshotData)) { + throw new TypeError('missing snapshot.json in meta'); + } + else { + snapshotMeta = file_1.MetaFile.fromJSON(snapshotData); + } + } + return snapshotMeta; +} diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/utils/guard.js b/node_modules/npm/node_modules/@tufjs/models/dist/utils/guard.js new file mode 100644 index 00000000..911e8475 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/utils/guard.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isDefined = isDefined; +exports.isObject = isObject; +exports.isStringArray = isStringArray; +exports.isObjectArray = isObjectArray; +exports.isStringRecord = isStringRecord; +exports.isObjectRecord = isObjectRecord; +function isDefined(val) { + return val !== undefined; +} +function isObject(value) { + return typeof value === 'object' && value !== null; +} +function isStringArray(value) { + return Array.isArray(value) && value.every((v) => typeof v === 'string'); +} +function isObjectArray(value) { + return Array.isArray(value) && value.every(isObject); +} +function isStringRecord(value) { + return (typeof value === 'object' && + value !== null && + Object.keys(value).every((k) => typeof k === 'string') && + Object.values(value).every((v) => typeof v === 'string')); +} +function isObjectRecord(value) { + return (typeof value === 'object' && + value !== null && + Object.keys(value).every((k) => typeof k === 'string') && + Object.values(value).every((v) => typeof v === 'object' && v !== null)); +} diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/utils/index.js b/node_modules/npm/node_modules/@tufjs/models/dist/utils/index.js new file mode 100644 index 00000000..872aae28 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/utils/index.js @@ -0,0 +1,28 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.crypto = exports.guard = void 0; +exports.guard = __importStar(require("./guard")); +exports.crypto = __importStar(require("./verify")); diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/utils/key.js b/node_modules/npm/node_modules/@tufjs/models/dist/utils/key.js new file mode 100644 index 00000000..3c3ec07f --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/utils/key.js @@ -0,0 +1,142 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getPublicKey = getPublicKey; +const crypto_1 = __importDefault(require("crypto")); +const error_1 = require("../error"); +const oid_1 = require("./oid"); +const ASN1_TAG_SEQUENCE = 0x30; +const ANS1_TAG_BIT_STRING = 0x03; +const NULL_BYTE = 0x00; +const OID_EDDSA = '1.3.101.112'; +const OID_EC_PUBLIC_KEY = '1.2.840.10045.2.1'; +const OID_EC_CURVE_P256V1 = '1.2.840.10045.3.1.7'; +const PEM_HEADER = '-----BEGIN PUBLIC KEY-----'; +function getPublicKey(keyInfo) { + switch (keyInfo.keyType) { + case 'rsa': + return getRSAPublicKey(keyInfo); + case 'ed25519': + return getED25519PublicKey(keyInfo); + case 'ecdsa': + case 'ecdsa-sha2-nistp256': + case 'ecdsa-sha2-nistp384': + return getECDCSAPublicKey(keyInfo); + default: + throw new error_1.UnsupportedAlgorithmError(`Unsupported key type: ${keyInfo.keyType}`); + } +} +function getRSAPublicKey(keyInfo) { + // Only support PEM-encoded RSA keys + if (!keyInfo.keyVal.startsWith(PEM_HEADER)) { + throw new error_1.CryptoError('Invalid key format'); + } + const key = crypto_1.default.createPublicKey(keyInfo.keyVal); + switch (keyInfo.scheme) { + case 'rsassa-pss-sha256': + return { + key: key, + padding: crypto_1.default.constants.RSA_PKCS1_PSS_PADDING, + }; + default: + throw new error_1.UnsupportedAlgorithmError(`Unsupported RSA scheme: ${keyInfo.scheme}`); + } +} +function getED25519PublicKey(keyInfo) { + let key; + // If key is already PEM-encoded we can just parse it + if (keyInfo.keyVal.startsWith(PEM_HEADER)) { + key = crypto_1.default.createPublicKey(keyInfo.keyVal); + } + else { + // If key is not PEM-encoded it had better be hex + if (!isHex(keyInfo.keyVal)) { + throw new error_1.CryptoError('Invalid key format'); + } + key = crypto_1.default.createPublicKey({ + key: ed25519.hexToDER(keyInfo.keyVal), + format: 'der', + type: 'spki', + }); + } + return { key }; +} +function getECDCSAPublicKey(keyInfo) { + let key; + // If key is already PEM-encoded we can just parse it + if (keyInfo.keyVal.startsWith(PEM_HEADER)) { + key = crypto_1.default.createPublicKey(keyInfo.keyVal); + } + else { + // If key is not PEM-encoded it had better be hex + if (!isHex(keyInfo.keyVal)) { + throw new error_1.CryptoError('Invalid key format'); + } + key = crypto_1.default.createPublicKey({ + key: ecdsa.hexToDER(keyInfo.keyVal), + format: 'der', + type: 'spki', + }); + } + return { key }; +} +const ed25519 = { + // Translates a hex key into a crypto KeyObject + // https://keygen.sh/blog/how-to-use-hexadecimal-ed25519-keys-in-node/ + hexToDER: (hex) => { + const key = Buffer.from(hex, 'hex'); + const oid = (0, oid_1.encodeOIDString)(OID_EDDSA); + // Create a byte sequence containing the OID and key + const elements = Buffer.concat([ + Buffer.concat([ + Buffer.from([ASN1_TAG_SEQUENCE]), + Buffer.from([oid.length]), + oid, + ]), + Buffer.concat([ + Buffer.from([ANS1_TAG_BIT_STRING]), + Buffer.from([key.length + 1]), + Buffer.from([NULL_BYTE]), + key, + ]), + ]); + // Wrap up by creating a sequence of elements + const der = Buffer.concat([ + Buffer.from([ASN1_TAG_SEQUENCE]), + Buffer.from([elements.length]), + elements, + ]); + return der; + }, +}; +const ecdsa = { + hexToDER: (hex) => { + const key = Buffer.from(hex, 'hex'); + const bitString = Buffer.concat([ + Buffer.from([ANS1_TAG_BIT_STRING]), + Buffer.from([key.length + 1]), + Buffer.from([NULL_BYTE]), + key, + ]); + const oids = Buffer.concat([ + (0, oid_1.encodeOIDString)(OID_EC_PUBLIC_KEY), + (0, oid_1.encodeOIDString)(OID_EC_CURVE_P256V1), + ]); + const oidSequence = Buffer.concat([ + Buffer.from([ASN1_TAG_SEQUENCE]), + Buffer.from([oids.length]), + oids, + ]); + // Wrap up by creating a sequence of elements + const der = Buffer.concat([ + Buffer.from([ASN1_TAG_SEQUENCE]), + Buffer.from([oidSequence.length + bitString.length]), + oidSequence, + bitString, + ]); + return der; + }, +}; +const isHex = (key) => /^[0-9a-fA-F]+$/.test(key); diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/utils/oid.js b/node_modules/npm/node_modules/@tufjs/models/dist/utils/oid.js new file mode 100644 index 00000000..00b29c30 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/utils/oid.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeOIDString = encodeOIDString; +const ANS1_TAG_OID = 0x06; +function encodeOIDString(oid) { + const parts = oid.split('.'); + // The first two subidentifiers are encoded into the first byte + const first = parseInt(parts[0], 10) * 40 + parseInt(parts[1], 10); + const rest = []; + parts.slice(2).forEach((part) => { + const bytes = encodeVariableLengthInteger(parseInt(part, 10)); + rest.push(...bytes); + }); + const der = Buffer.from([first, ...rest]); + return Buffer.from([ANS1_TAG_OID, der.length, ...der]); +} +function encodeVariableLengthInteger(value) { + const bytes = []; + let mask = 0x00; + while (value > 0) { + bytes.unshift((value & 0x7f) | mask); + value >>= 7; + mask = 0x80; + } + return bytes; +} diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/utils/types.js b/node_modules/npm/node_modules/@tufjs/models/dist/utils/types.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/utils/types.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/npm/node_modules/@tufjs/models/dist/utils/verify.js b/node_modules/npm/node_modules/@tufjs/models/dist/utils/verify.js new file mode 100644 index 00000000..8232b6f6 --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/dist/utils/verify.js @@ -0,0 +1,13 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifySignature = void 0; +const canonical_json_1 = require("@tufjs/canonical-json"); +const crypto_1 = __importDefault(require("crypto")); +const verifySignature = (metaDataSignedData, key, signature) => { + const canonicalData = Buffer.from((0, canonical_json_1.canonicalize)(metaDataSignedData)); + return crypto_1.default.verify(undefined, canonicalData, key, Buffer.from(signature, 'hex')); +}; +exports.verifySignature = verifySignature; diff --git a/node_modules/npm/node_modules/@tufjs/models/package.json b/node_modules/npm/node_modules/@tufjs/models/package.json new file mode 100644 index 00000000..8e5132dd --- /dev/null +++ b/node_modules/npm/node_modules/@tufjs/models/package.json @@ -0,0 +1,37 @@ +{ + "name": "@tufjs/models", + "version": "3.0.1", + "description": "TUF metadata models", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsc --build", + "clean": "rm -rf dist && rm tsconfig.tsbuildinfo", + "test": "jest" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/theupdateframework/tuf-js.git" + }, + "keywords": [ + "tuf", + "security", + "update" + ], + "author": "bdehamer@github.com", + "license": "MIT", + "bugs": { + "url": "https://github.com/theupdateframework/tuf-js/issues" + }, + "homepage": "https://github.com/theupdateframework/tuf-js/tree/main/packages/models#readme", + "dependencies": { + "@tufjs/canonical-json": "2.0.0", + "minimatch": "^9.0.5" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } +} diff --git a/node_modules/npm/node_modules/abbrev/LICENSE b/node_modules/npm/node_modules/abbrev/LICENSE new file mode 100644 index 00000000..9bcfa9d7 --- /dev/null +++ b/node_modules/npm/node_modules/abbrev/LICENSE @@ -0,0 +1,46 @@ +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/npm/node_modules/abbrev/lib/index.js b/node_modules/npm/node_modules/abbrev/lib/index.js new file mode 100644 index 00000000..9f48801f --- /dev/null +++ b/node_modules/npm/node_modules/abbrev/lib/index.js @@ -0,0 +1,50 @@ +module.exports = abbrev + +function abbrev (...args) { + let list = args.length === 1 || Array.isArray(args[0]) ? args[0] : args + + for (let i = 0, l = list.length; i < l; i++) { + list[i] = typeof list[i] === 'string' ? list[i] : String(list[i]) + } + + // sort them lexicographically, so that they're next to their nearest kin + list = list.sort(lexSort) + + // walk through each, seeing how much it has in common with the next and previous + const abbrevs = {} + let prev = '' + for (let ii = 0, ll = list.length; ii < ll; ii++) { + const current = list[ii] + const next = list[ii + 1] || '' + let nextMatches = true + let prevMatches = true + if (current === next) { + continue + } + let j = 0 + const cl = current.length + for (; j < cl; j++) { + const 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 (let a = current.slice(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/npm/node_modules/abbrev/package.json b/node_modules/npm/node_modules/abbrev/package.json new file mode 100644 index 00000000..9dfcc009 --- /dev/null +++ b/node_modules/npm/node_modules/abbrev/package.json @@ -0,0 +1,45 @@ +{ + "name": "abbrev", + "version": "3.0.0", + "description": "Like ruby's abbrev module, but in js", + "author": "GitHub Inc.", + "main": "lib/index.js", + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/abbrev-js.git" + }, + "license": "ISC", + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.3.0" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + } +} diff --git a/node_modules/npm/node_modules/agent-base/LICENSE b/node_modules/npm/node_modules/agent-base/LICENSE new file mode 100644 index 00000000..008728cb --- /dev/null +++ b/node_modules/npm/node_modules/agent-base/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2013 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. \ No newline at end of file diff --git a/node_modules/npm/node_modules/agent-base/dist/helpers.js b/node_modules/npm/node_modules/agent-base/dist/helpers.js new file mode 100644 index 00000000..ef3f9202 --- /dev/null +++ b/node_modules/npm/node_modules/agent-base/dist/helpers.js @@ -0,0 +1,66 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.req = exports.json = exports.toBuffer = void 0; +const http = __importStar(require("http")); +const https = __importStar(require("https")); +async function toBuffer(stream) { + let length = 0; + const chunks = []; + for await (const chunk of stream) { + length += chunk.length; + chunks.push(chunk); + } + return Buffer.concat(chunks, length); +} +exports.toBuffer = toBuffer; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +async function json(stream) { + const buf = await toBuffer(stream); + const str = buf.toString('utf8'); + try { + return JSON.parse(str); + } + catch (_err) { + const err = _err; + err.message += ` (input: ${str})`; + throw err; + } +} +exports.json = json; +function req(url, opts = {}) { + const href = typeof url === 'string' ? url : url.href; + const req = (href.startsWith('https:') ? https : http).request(url, opts); + const promise = new Promise((resolve, reject) => { + req + .once('response', resolve) + .once('error', reject) + .end(); + }); + req.then = promise.then.bind(promise); + return req; +} +exports.req = req; +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/agent-base/dist/index.js b/node_modules/npm/node_modules/agent-base/dist/index.js new file mode 100644 index 00000000..c3c4099c --- /dev/null +++ b/node_modules/npm/node_modules/agent-base/dist/index.js @@ -0,0 +1,180 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Agent = void 0; +const net = __importStar(require("net")); +const http = __importStar(require("http")); +const https_1 = require("https"); +__exportStar(require("./helpers"), exports); +const INTERNAL = Symbol('AgentBaseInternalState'); +class Agent extends http.Agent { + constructor(opts) { + super(opts); + this[INTERNAL] = {}; + } + /** + * Determine whether this is an `http` or `https` request. + */ + isSecureEndpoint(options) { + if (options) { + // First check the `secureEndpoint` property explicitly, since this + // means that a parent `Agent` is "passing through" to this instance. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (typeof options.secureEndpoint === 'boolean') { + return options.secureEndpoint; + } + // If no explicit `secure` endpoint, check if `protocol` property is + // set. This will usually be the case since using a full string URL + // or `URL` instance should be the most common usage. + if (typeof options.protocol === 'string') { + return options.protocol === 'https:'; + } + } + // Finally, if no `protocol` property was set, then fall back to + // checking the stack trace of the current call stack, and try to + // detect the "https" module. + 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); + } + // In order to support async signatures in `connect()` and Node's native + // connection pooling in `http.Agent`, the array of sockets for each origin + // has to be updated synchronously. This is so the length of the array is + // accurate when `addRequest()` is next called. We achieve this by creating a + // fake socket and adding it to `sockets[origin]` and incrementing + // `totalSocketCount`. + incrementSockets(name) { + // If `maxSockets` and `maxTotalSockets` are both Infinity then there is no + // need to create a fake socket because Node.js native connection pooling + // will never be invoked. + if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) { + return null; + } + // All instances of `sockets` are expected TypeScript errors. The + // alternative is to add it as a private property of this class but that + // will break TypeScript subclassing. + if (!this.sockets[name]) { + // @ts-expect-error `sockets` is readonly in `@types/node` + this.sockets[name] = []; + } + const fakeSocket = new net.Socket({ writable: false }); + this.sockets[name].push(fakeSocket); + // @ts-expect-error `totalSocketCount` isn't defined in `@types/node` + this.totalSocketCount++; + return fakeSocket; + } + decrementSockets(name, socket) { + if (!this.sockets[name] || socket === null) { + return; + } + const sockets = this.sockets[name]; + const index = sockets.indexOf(socket); + if (index !== -1) { + sockets.splice(index, 1); + // @ts-expect-error `totalSocketCount` isn't defined in `@types/node` + this.totalSocketCount--; + if (sockets.length === 0) { + // @ts-expect-error `sockets` is readonly in `@types/node` + delete this.sockets[name]; + } + } + } + // In order to properly update the socket pool, we need to call `getName()` on + // the core `https.Agent` if it is a secureEndpoint. + getName(options) { + const secureEndpoint = typeof options.secureEndpoint === 'boolean' + ? options.secureEndpoint + : this.isSecureEndpoint(options); + if (secureEndpoint) { + // @ts-expect-error `getName()` isn't defined in `@types/node` + return https_1.Agent.prototype.getName.call(this, options); + } + // @ts-expect-error `getName()` isn't defined in `@types/node` + return super.getName(options); + } + createSocket(req, options, cb) { + const connectOpts = { + ...options, + secureEndpoint: this.isSecureEndpoint(options), + }; + const name = this.getName(connectOpts); + const fakeSocket = this.incrementSockets(name); + Promise.resolve() + .then(() => this.connect(req, connectOpts)) + .then((socket) => { + this.decrementSockets(name, fakeSocket); + if (socket instanceof http.Agent) { + try { + // @ts-expect-error `addRequest()` isn't defined in `@types/node` + return socket.addRequest(req, connectOpts); + } + catch (err) { + return cb(err); + } + } + this[INTERNAL].currentSocket = socket; + // @ts-expect-error `createSocket()` isn't defined in `@types/node` + super.createSocket(req, options, cb); + }, (err) => { + this.decrementSockets(name, fakeSocket); + cb(err); + }); + } + createConnection() { + const socket = this[INTERNAL].currentSocket; + this[INTERNAL].currentSocket = undefined; + if (!socket) { + throw new Error('No socket was returned in the `connect()` function'); + } + return socket; + } + get defaultPort() { + return (this[INTERNAL].defaultPort ?? + (this.protocol === 'https:' ? 443 : 80)); + } + set defaultPort(v) { + if (this[INTERNAL]) { + this[INTERNAL].defaultPort = v; + } + } + get protocol() { + return (this[INTERNAL].protocol ?? + (this.isSecureEndpoint() ? 'https:' : 'http:')); + } + set protocol(v) { + if (this[INTERNAL]) { + this[INTERNAL].protocol = v; + } + } +} +exports.Agent = Agent; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/agent-base/package.json b/node_modules/npm/node_modules/agent-base/package.json new file mode 100644 index 00000000..175ee71f --- /dev/null +++ b/node_modules/npm/node_modules/agent-base/package.json @@ -0,0 +1,46 @@ +{ + "name": "agent-base", + "version": "7.1.3", + "description": "Turn a function into an `http.Agent` instance", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "repository": { + "type": "git", + "url": "https://github.com/TooTallNate/proxy-agents.git", + "directory": "packages/agent-base" + }, + "keywords": [ + "http", + "agent", + "base", + "barebones", + "https" + ], + "author": "Nathan Rajlich (http://n8.io/)", + "license": "MIT", + "devDependencies": { + "@types/debug": "^4.1.7", + "@types/jest": "^29.5.1", + "@types/node": "^14.18.45", + "@types/semver": "^7.3.13", + "@types/ws": "^6.0.4", + "async-listen": "^3.0.0", + "jest": "^29.5.0", + "ts-jest": "^29.1.0", + "typescript": "^5.0.4", + "ws": "^5.2.4", + "tsconfig": "0.0.0" + }, + "engines": { + "node": ">= 14" + }, + "scripts": { + "build": "tsc", + "test": "jest --env node --verbose --bail", + "lint": "eslint . --ext .ts", + "pack": "node ../../scripts/pack.mjs" + } +} \ No newline at end of file diff --git a/node_modules/npm/node_modules/ansi-regex/index.js b/node_modules/npm/node_modules/ansi-regex/index.js new file mode 100644 index 00000000..616ff837 --- /dev/null +++ b/node_modules/npm/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = ({onlyFirst = false} = {}) => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; diff --git a/node_modules/npm/node_modules/ansi-regex/license b/node_modules/npm/node_modules/ansi-regex/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/npm/node_modules/ansi-regex/license @@ -0,0 +1,9 @@ +MIT License + +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/npm/node_modules/ansi-regex/package.json b/node_modules/npm/node_modules/ansi-regex/package.json new file mode 100644 index 00000000..017f5311 --- /dev/null +++ b/node_modules/npm/node_modules/ansi-regex/package.json @@ -0,0 +1,55 @@ +{ + "name": "ansi-regex", + "version": "5.0.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/npm/node_modules/ansi-styles/index.js b/node_modules/npm/node_modules/ansi-styles/index.js new file mode 100644 index 00000000..d7bede44 --- /dev/null +++ b/node_modules/npm/node_modules/ansi-styles/index.js @@ -0,0 +1,223 @@ +const ANSI_BACKGROUND_OFFSET = 10; + +const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`; + +const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`; + +const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`; + +const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + gray: [90, 39], // Alias of `blackBright` + grey: [90, 39], // Alias of `blackBright` + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39], + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgGray: [100, 49], // Alias of `bgBlackBright` + bgGrey: [100, 49], // Alias of `bgBlackBright` + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49], + }, +}; + +export const modifierNames = Object.keys(styles.modifier); +export const foregroundColorNames = Object.keys(styles.color); +export const backgroundColorNames = Object.keys(styles.bgColor); +export const colorNames = [...foregroundColorNames, ...backgroundColorNames]; + +function assembleStyles() { + const codes = new Map(); + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m`, + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false, + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false, + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi = wrapAnsi16(); + styles.color.ansi256 = wrapAnsi256(); + styles.color.ansi16m = wrapAnsi16m(); + styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); + + // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js + Object.defineProperties(styles, { + rgbToAnsi256: { + value: (red, green, blue) => { + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (red === green && green === blue) { + if (red < 8) { + return 16; + } + + if (red > 248) { + return 231; + } + + return Math.round(((red - 8) / 247) * 24) + 232; + } + + return 16 + + (36 * Math.round(red / 255 * 5)) + + (6 * Math.round(green / 255 * 5)) + + Math.round(blue / 255 * 5); + }, + enumerable: false, + }, + hexToRgb: { + value: hex => { + const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); + if (!matches) { + return [0, 0, 0]; + } + + let [colorString] = matches; + + if (colorString.length === 3) { + colorString = [...colorString].map(character => character + character).join(''); + } + + const integer = Number.parseInt(colorString, 16); + + return [ + /* eslint-disable no-bitwise */ + (integer >> 16) & 0xFF, + (integer >> 8) & 0xFF, + integer & 0xFF, + /* eslint-enable no-bitwise */ + ]; + }, + enumerable: false, + }, + hexToAnsi256: { + value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)), + enumerable: false, + }, + ansi256ToAnsi: { + value: code => { + if (code < 8) { + return 30 + code; + } + + if (code < 16) { + return 90 + (code - 8); + } + + let red; + let green; + let blue; + + if (code >= 232) { + red = (((code - 232) * 10) + 8) / 255; + green = red; + blue = red; + } else { + code -= 16; + + const remainder = code % 36; + + red = Math.floor(code / 36) / 5; + green = Math.floor(remainder / 6) / 5; + blue = (remainder % 6) / 5; + } + + const value = Math.max(red, green, blue) * 2; + + if (value === 0) { + return 30; + } + + // eslint-disable-next-line no-bitwise + let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red)); + + if (value === 2) { + result += 60; + } + + return result; + }, + enumerable: false, + }, + rgbToAnsi: { + value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), + enumerable: false, + }, + hexToAnsi: { + value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), + enumerable: false, + }, + }); + + return styles; +} + +const ansiStyles = assembleStyles(); + +export default ansiStyles; diff --git a/node_modules/npm/node_modules/ansi-styles/license b/node_modules/npm/node_modules/ansi-styles/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/ansi-styles/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/ansi-styles/package.json b/node_modules/npm/node_modules/ansi-styles/package.json new file mode 100644 index 00000000..6cd3ca5b --- /dev/null +++ b/node_modules/npm/node_modules/ansi-styles/package.json @@ -0,0 +1,54 @@ +{ + "name": "ansi-styles", + "version": "6.2.1", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": "chalk/ansi-styles", + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd", + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "ava": "^3.15.0", + "svg-term-cli": "^2.1.1", + "tsd": "^0.19.0", + "xo": "^0.47.0" + } +} diff --git a/node_modules/npm/node_modules/aproba/LICENSE b/node_modules/npm/node_modules/aproba/LICENSE new file mode 100644 index 00000000..f4be44d8 --- /dev/null +++ b/node_modules/npm/node_modules/aproba/LICENSE @@ -0,0 +1,14 @@ +Copyright (c) 2015, Rebecca Turner + +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/npm/node_modules/aproba/index.js b/node_modules/npm/node_modules/aproba/index.js new file mode 100644 index 00000000..fd947481 --- /dev/null +++ b/node_modules/npm/node_modules/aproba/index.js @@ -0,0 +1,105 @@ +'use strict' +module.exports = validate + +function isArguments (thingy) { + return thingy != null && typeof thingy === 'object' && thingy.hasOwnProperty('callee') +} + +const types = { + '*': {label: 'any', check: () => true}, + A: {label: 'array', check: _ => Array.isArray(_) || isArguments(_)}, + S: {label: 'string', check: _ => typeof _ === 'string'}, + N: {label: 'number', check: _ => typeof _ === 'number'}, + F: {label: 'function', check: _ => typeof _ === 'function'}, + O: {label: 'object', check: _ => typeof _ === 'object' && _ != null && !types.A.check(_) && !types.E.check(_)}, + B: {label: 'boolean', check: _ => typeof _ === 'boolean'}, + E: {label: 'error', check: _ => _ instanceof Error}, + Z: {label: 'null', check: _ => _ == null} +} + +function addSchema (schema, arity) { + const group = arity[schema.length] = arity[schema.length] || [] + if (group.indexOf(schema) === -1) group.push(schema) +} + +function validate (rawSchemas, args) { + if (arguments.length !== 2) throw wrongNumberOfArgs(['SA'], arguments.length) + if (!rawSchemas) throw missingRequiredArg(0, 'rawSchemas') + if (!args) throw missingRequiredArg(1, 'args') + if (!types.S.check(rawSchemas)) throw invalidType(0, ['string'], rawSchemas) + if (!types.A.check(args)) throw invalidType(1, ['array'], args) + const schemas = rawSchemas.split('|') + const arity = {} + + schemas.forEach(schema => { + for (let ii = 0; ii < schema.length; ++ii) { + const type = schema[ii] + if (!types[type]) throw unknownType(ii, type) + } + if (/E.*E/.test(schema)) throw moreThanOneError(schema) + addSchema(schema, arity) + if (/E/.test(schema)) { + addSchema(schema.replace(/E.*$/, 'E'), arity) + addSchema(schema.replace(/E/, 'Z'), arity) + if (schema.length === 1) addSchema('', arity) + } + }) + let matching = arity[args.length] + if (!matching) { + throw wrongNumberOfArgs(Object.keys(arity), args.length) + } + for (let ii = 0; ii < args.length; ++ii) { + let newMatching = matching.filter(schema => { + const type = schema[ii] + const typeCheck = types[type].check + return typeCheck(args[ii]) + }) + if (!newMatching.length) { + const labels = matching.map(_ => types[_[ii]].label).filter(_ => _ != null) + throw invalidType(ii, labels, args[ii]) + } + matching = newMatching + } +} + +function missingRequiredArg (num) { + return newException('EMISSINGARG', 'Missing required argument #' + (num + 1)) +} + +function unknownType (num, type) { + return newException('EUNKNOWNTYPE', 'Unknown type ' + type + ' in argument #' + (num + 1)) +} + +function invalidType (num, expectedTypes, value) { + let valueType + Object.keys(types).forEach(typeCode => { + if (types[typeCode].check(value)) valueType = types[typeCode].label + }) + return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' + + englishList(expectedTypes) + ' but got ' + valueType) +} + +function englishList (list) { + return list.join(', ').replace(/, ([^,]+)$/, ' or $1') +} + +function wrongNumberOfArgs (expected, got) { + const english = englishList(expected) + const args = expected.every(ex => ex.length === 1) + ? 'argument' + : 'arguments' + return newException('EWRONGARGCOUNT', 'Expected ' + english + ' ' + args + ' but got ' + got) +} + +function moreThanOneError (schema) { + return newException('ETOOMANYERRORTYPES', + 'Only one error type per argument signature is allowed, more than one found in "' + schema + '"') +} + +function newException (code, msg) { + const err = new Error(msg) + err.code = code + /* istanbul ignore else */ + if (Error.captureStackTrace) Error.captureStackTrace(err, validate) + return err +} diff --git a/node_modules/npm/node_modules/aproba/package.json b/node_modules/npm/node_modules/aproba/package.json new file mode 100644 index 00000000..d2212d30 --- /dev/null +++ b/node_modules/npm/node_modules/aproba/package.json @@ -0,0 +1,35 @@ +{ + "name": "aproba", + "version": "2.0.0", + "description": "A ridiculously light-weight argument validator (now browser friendly)", + "main": "index.js", + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "standard": "^11.0.1", + "tap": "^12.0.1" + }, + "files": [ + "index.js" + ], + "scripts": { + "pretest": "standard", + "test": "tap --100 -J test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/iarna/aproba" + }, + "keywords": [ + "argument", + "validate" + ], + "author": "Rebecca Turner ", + "license": "ISC", + "bugs": { + "url": "https://github.com/iarna/aproba/issues" + }, + "homepage": "https://github.com/iarna/aproba" +} diff --git a/node_modules/npm/node_modules/archy/LICENSE b/node_modules/npm/node_modules/archy/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/npm/node_modules/archy/LICENSE @@ -0,0 +1,18 @@ +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/npm/node_modules/archy/examples/beep.js b/node_modules/npm/node_modules/archy/examples/beep.js new file mode 100644 index 00000000..9c070479 --- /dev/null +++ b/node_modules/npm/node_modules/archy/examples/beep.js @@ -0,0 +1,24 @@ +var archy = require('../'); +var s = archy({ + label : 'beep', + nodes : [ + 'ity', + { + label : 'boop', + nodes : [ + { + label : 'o_O', + nodes : [ + { + label : 'oh', + nodes : [ 'hello', 'puny' ] + }, + 'human' + ] + }, + 'party\ntime!' + ] + } + ] +}); +console.log(s); diff --git a/node_modules/npm/node_modules/archy/examples/multi_line.js b/node_modules/npm/node_modules/archy/examples/multi_line.js new file mode 100644 index 00000000..8afdfada --- /dev/null +++ b/node_modules/npm/node_modules/archy/examples/multi_line.js @@ -0,0 +1,25 @@ +var archy = require('../'); + +var s = archy({ + label : 'beep\none\ntwo', + nodes : [ + 'ity', + { + label : 'boop', + nodes : [ + { + label : 'o_O\nwheee', + nodes : [ + { + label : 'oh', + nodes : [ 'hello', 'puny\nmeat' ] + }, + 'creature' + ] + }, + 'party\ntime!' + ] + } + ] +}); +console.log(s); diff --git a/node_modules/npm/node_modules/archy/index.js b/node_modules/npm/node_modules/archy/index.js new file mode 100644 index 00000000..869d64e6 --- /dev/null +++ b/node_modules/npm/node_modules/archy/index.js @@ -0,0 +1,35 @@ +module.exports = function archy (obj, prefix, opts) { + if (prefix === undefined) prefix = ''; + if (!opts) opts = {}; + var chr = function (s) { + var chars = { + '│' : '|', + '└' : '`', + '├' : '+', + '─' : '-', + '┬' : '-' + }; + return opts.unicode === false ? chars[s] : s; + }; + + if (typeof obj === 'string') obj = { label : obj }; + + var nodes = obj.nodes || []; + var lines = (obj.label || '').split('\n'); + var splitter = '\n' + prefix + (nodes.length ? chr('│') : ' ') + ' '; + + return prefix + + lines.join(splitter) + '\n' + + nodes.map(function (node, ix) { + var last = ix === nodes.length - 1; + var more = node.nodes && node.nodes.length; + var prefix_ = prefix + (last ? ' ' : chr('│')) + ' '; + + return prefix + + (last ? chr('└') : chr('├')) + chr('─') + + (more ? chr('┬') : chr('─')) + ' ' + + archy(node, prefix_, opts).slice(prefix.length + 2) + ; + }).join('') + ; +}; diff --git a/node_modules/npm/node_modules/archy/package.json b/node_modules/npm/node_modules/archy/package.json new file mode 100644 index 00000000..0ce3149f --- /dev/null +++ b/node_modules/npm/node_modules/archy/package.json @@ -0,0 +1,40 @@ +{ + "name" : "archy", + "version" : "1.0.0", + "description" : "render nested hierarchies `npm ls` style with unicode pipes", + "main" : "index.js", + "devDependencies" : { + "tap" : "~0.3.3", + "tape" : "~0.1.1" + }, + "scripts" : { + "test" : "tap test" + }, + "testling" : { + "files" : "test/*.js", + "browsers" : { + "iexplore" : [ "6.0", "7.0", "8.0", "9.0" ], + "chrome" : [ "20.0" ], + "firefox" : [ "10.0", "15.0" ], + "safari" : [ "5.1" ], + "opera" : [ "12.0" ] + } + }, + "repository" : { + "type" : "git", + "url" : "http://github.com/substack/node-archy.git" + }, + "keywords" : [ + "hierarchy", + "npm ls", + "unicode", + "pretty", + "print" + ], + "author" : { + "name" : "James Halliday", + "email" : "mail@substack.net", + "url" : "http://substack.net" + }, + "license" : "MIT" +} diff --git a/node_modules/npm/node_modules/archy/test/beep.js b/node_modules/npm/node_modules/archy/test/beep.js new file mode 100644 index 00000000..4ea74f9c --- /dev/null +++ b/node_modules/npm/node_modules/archy/test/beep.js @@ -0,0 +1,40 @@ +var test = require('tape'); +var archy = require('../'); + +test('beep', function (t) { + var s = archy({ + label : 'beep', + nodes : [ + 'ity', + { + label : 'boop', + nodes : [ + { + label : 'o_O', + nodes : [ + { + label : 'oh', + nodes : [ 'hello', 'puny' ] + }, + 'human' + ] + }, + 'party!' + ] + } + ] + }); + t.equal(s, [ + 'beep', + '├── ity', + '└─┬ boop', + ' ├─┬ o_O', + ' │ ├─┬ oh', + ' │ │ ├── hello', + ' │ │ └── puny', + ' │ └── human', + ' └── party!', + '' + ].join('\n')); + t.end(); +}); diff --git a/node_modules/npm/node_modules/archy/test/multi_line.js b/node_modules/npm/node_modules/archy/test/multi_line.js new file mode 100644 index 00000000..2cf2154d --- /dev/null +++ b/node_modules/npm/node_modules/archy/test/multi_line.js @@ -0,0 +1,45 @@ +var test = require('tape'); +var archy = require('../'); + +test('multi-line', function (t) { + var s = archy({ + label : 'beep\none\ntwo', + nodes : [ + 'ity', + { + label : 'boop', + nodes : [ + { + label : 'o_O\nwheee', + nodes : [ + { + label : 'oh', + nodes : [ 'hello', 'puny\nmeat' ] + }, + 'creature' + ] + }, + 'party\ntime!' + ] + } + ] + }); + t.equal(s, [ + 'beep', + '│ one', + '│ two', + '├── ity', + '└─┬ boop', + ' ├─┬ o_O', + ' │ │ wheee', + ' │ ├─┬ oh', + ' │ │ ├── hello', + ' │ │ └── puny', + ' │ │ meat', + ' │ └── creature', + ' └── party', + ' time!', + '' + ].join('\n')); + t.end(); +}); diff --git a/node_modules/npm/node_modules/archy/test/non_unicode.js b/node_modules/npm/node_modules/archy/test/non_unicode.js new file mode 100644 index 00000000..7204d332 --- /dev/null +++ b/node_modules/npm/node_modules/archy/test/non_unicode.js @@ -0,0 +1,40 @@ +var test = require('tape'); +var archy = require('../'); + +test('beep', function (t) { + var s = archy({ + label : 'beep', + nodes : [ + 'ity', + { + label : 'boop', + nodes : [ + { + label : 'o_O', + nodes : [ + { + label : 'oh', + nodes : [ 'hello', 'puny' ] + }, + 'human' + ] + }, + 'party!' + ] + } + ] + }, '', { unicode : false }); + t.equal(s, [ + 'beep', + '+-- ity', + '`-- boop', + ' +-- o_O', + ' | +-- oh', + ' | | +-- hello', + ' | | `-- puny', + ' | `-- human', + ' `-- party!', + '' + ].join('\n')); + t.end(); +}); diff --git a/node_modules/npm/node_modules/balanced-match/LICENSE.md b/node_modules/npm/node_modules/balanced-match/LICENSE.md new file mode 100644 index 00000000..2cdc8e41 --- /dev/null +++ b/node_modules/npm/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/npm/node_modules/balanced-match/index.js b/node_modules/npm/node_modules/balanced-match/index.js new file mode 100644 index 00000000..c67a6460 --- /dev/null +++ b/node_modules/npm/node_modules/balanced-match/index.js @@ -0,0 +1,62 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/node_modules/npm/node_modules/balanced-match/package.json b/node_modules/npm/node_modules/balanced-match/package.json new file mode 100644 index 00000000..ce6073e0 --- /dev/null +++ b/node_modules/npm/node_modules/balanced-match/package.json @@ -0,0 +1,48 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "1.0.2", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "tape test/test.js", + "bench": "matcha test/bench.js" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "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/npm/node_modules/bin-links/LICENSE b/node_modules/npm/node_modules/bin-links/LICENSE new file mode 100644 index 00000000..19cec97b --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/LICENSE @@ -0,0 +1,15 @@ +The 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 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/npm/node_modules/bin-links/lib/bin-target.js b/node_modules/npm/node_modules/bin-links/lib/bin-target.js new file mode 100644 index 00000000..0629285d --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/bin-target.js @@ -0,0 +1,9 @@ +const isWindows = require('./is-windows.js') +const getPrefix = require('./get-prefix.js') +const getNodeModules = require('./get-node-modules.js') +const { dirname } = require('path') + +module.exports = ({ top, path }) => + !top ? getNodeModules(path) + '/.bin' + : isWindows ? getPrefix(path) + : dirname(getPrefix(path)) + '/bin' diff --git a/node_modules/npm/node_modules/bin-links/lib/check-bin.js b/node_modules/npm/node_modules/bin-links/lib/check-bin.js new file mode 100644 index 00000000..c5b997bb --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/check-bin.js @@ -0,0 +1,74 @@ +// check to see if a bin is allowed to be overwritten +// either rejects or resolves to nothing. return value not relevant. +const isWindows = require('./is-windows.js') +const binTarget = require('./bin-target.js') +const { resolve, dirname } = require('path') +const readCmdShim = require('read-cmd-shim') +const { readlink } = require('fs/promises') + +const checkBin = async ({ bin, path, top, global, force }) => { + // always ok to clobber when forced + // always ok to clobber local bins, or when forced + if (force || !global || !top) { + return + } + + // ok, need to make sure, then + const target = resolve(binTarget({ path, top }), bin) + path = resolve(path) + return isWindows ? checkShim({ target, path }) : checkLink({ target, path }) +} + +// only enoent is allowed. anything else is a problem. +const handleReadLinkError = async ({ er, target }) => + er.code === 'ENOENT' ? null + : failEEXIST({ target }) + +const checkLink = async ({ target, path }) => { + const current = await readlink(target) + .catch(er => handleReadLinkError({ er, target })) + + if (!current) { + return + } + + const resolved = resolve(dirname(target), current) + + if (resolved.toLowerCase().indexOf(path.toLowerCase()) !== 0) { + return failEEXIST({ target }) + } +} + +const handleReadCmdShimError = ({ er, target }) => + er.code === 'ENOENT' ? null + : failEEXIST({ target }) + +const failEEXIST = ({ target }) => + Promise.reject(Object.assign(new Error('EEXIST: file already exists'), { + path: target, + code: 'EEXIST', + })) + +const checkShim = async ({ target, path }) => { + const shims = [ + target, + target + '.cmd', + target + '.ps1', + ] + await Promise.all(shims.map(async shim => { + const current = await readCmdShim(shim) + .catch(er => handleReadCmdShimError({ er, target: shim })) + + if (!current) { + return + } + + const resolved = resolve(dirname(shim), current.replace(/\\/g, '/')) + + if (resolved.toLowerCase().indexOf(path.toLowerCase()) !== 0) { + return failEEXIST({ target: shim }) + } + })) +} + +module.exports = checkBin diff --git a/node_modules/npm/node_modules/bin-links/lib/check-bins.js b/node_modules/npm/node_modules/bin-links/lib/check-bins.js new file mode 100644 index 00000000..76a683c9 --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/check-bins.js @@ -0,0 +1,18 @@ +const checkBin = require('./check-bin.js') +const normalize = require('npm-normalize-package-bin') +const checkBins = async ({ pkg, path, top, global, force }) => { + // always ok to clobber when forced + // always ok to clobber local bins, or when forced + if (force || !global || !top) { + return + } + + pkg = normalize(pkg) + if (!pkg.bin) { + return + } + + await Promise.all(Object.keys(pkg.bin) + .map(bin => checkBin({ bin, path, top, global, force }))) +} +module.exports = checkBins diff --git a/node_modules/npm/node_modules/bin-links/lib/fix-bin.js b/node_modules/npm/node_modules/bin-links/lib/fix-bin.js new file mode 100644 index 00000000..453bd4f3 --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/fix-bin.js @@ -0,0 +1,42 @@ +// make sure that bins are executable, and that they don't have +// windows line-endings on the hashbang line. +const { + chmod, + open, + readFile, +} = require('fs/promises') + +const execMode = 0o777 & (~process.umask()) + +const writeFileAtomic = require('write-file-atomic') + +const isWindowsHashBang = buf => + buf[0] === '#'.charCodeAt(0) && + buf[1] === '!'.charCodeAt(0) && + /^#![^\n]+\r\n/.test(buf.toString()) + +const isWindowsHashbangFile = file => { + const FALSE = () => false + return open(file, 'r').then(fh => { + const buf = Buffer.alloc(2048) + return fh.read(buf, 0, 2048, 0) + .then( + () => { + const isWHB = isWindowsHashBang(buf) + return fh.close().then(() => isWHB, () => isWHB) + }, + // don't leak FD if read() fails + () => fh.close().then(FALSE, FALSE) + ) + }, FALSE) +} + +const dos2Unix = file => + readFile(file, 'utf8').then(content => + writeFileAtomic(file, content.replace(/^(#![^\n]+)\r\n/, '$1\n'))) + +const fixBin = (file, mode = execMode) => chmod(file, mode) + .then(() => isWindowsHashbangFile(file)) + .then(isWHB => isWHB ? dos2Unix(file) : null) + +module.exports = fixBin diff --git a/node_modules/npm/node_modules/bin-links/lib/get-node-modules.js b/node_modules/npm/node_modules/bin-links/lib/get-node-modules.js new file mode 100644 index 00000000..5c16b3b8 --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/get-node-modules.js @@ -0,0 +1,19 @@ +// we know it's global and/or not top, so the path has to be +// {prefix}/node_modules/{name}. Can't rely on pkg.name, because +// it might be installed as an alias. + +const { dirname, basename } = require('path') +// this gets called a lot and can't change, so memoize it +const memo = new Map() +module.exports = path => { + if (memo.has(path)) { + return memo.get(path) + } + + const scopeOrNm = dirname(path) + const nm = basename(scopeOrNm) === 'node_modules' ? scopeOrNm + : dirname(scopeOrNm) + + memo.set(path, nm) + return nm +} diff --git a/node_modules/npm/node_modules/bin-links/lib/get-paths.js b/node_modules/npm/node_modules/bin-links/lib/get-paths.js new file mode 100644 index 00000000..b93e6982 --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/get-paths.js @@ -0,0 +1,42 @@ +// get all the paths that are (or might be) installed for a given pkg +// There's no guarantee that all of these will be installed, but if they +// are present, then we can assume that they're associated. +const binTarget = require('./bin-target.js') +const manTarget = require('./man-target.js') +const { resolve, basename, extname } = require('path') +const isWindows = require('./is-windows.js') +module.exports = ({ path, pkg, global, top }) => { + if (top && !global) { + return [] + } + + const binSet = [] + const binTarg = binTarget({ path, top }) + if (pkg.bin) { + for (const bin of Object.keys(pkg.bin)) { + const b = resolve(binTarg, bin) + binSet.push(b) + if (isWindows) { + binSet.push(b + '.cmd') + binSet.push(b + '.ps1') + } + } + } + + const manTarg = manTarget({ path, top }) + const manSet = [] + if (manTarg && pkg.man && Array.isArray(pkg.man) && pkg.man.length) { + for (const man of pkg.man) { + if (!/.\.[0-9]+(\.gz)?$/.test(man)) { + return binSet + } + + const section = extname(basename(man, '.gz')).slice(1) + const base = basename(man) + + manSet.push(resolve(manTarg, 'man' + section, base)) + } + } + + return manSet.length ? [...binSet, ...manSet] : binSet +} diff --git a/node_modules/npm/node_modules/bin-links/lib/get-prefix.js b/node_modules/npm/node_modules/bin-links/lib/get-prefix.js new file mode 100644 index 00000000..d5cf9c9d --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/get-prefix.js @@ -0,0 +1,3 @@ +const { dirname } = require('path') +const getNodeModules = require('./get-node-modules.js') +module.exports = path => dirname(getNodeModules(path)) diff --git a/node_modules/npm/node_modules/bin-links/lib/index.js b/node_modules/npm/node_modules/bin-links/lib/index.js new file mode 100644 index 00000000..ab3bd13c --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/index.js @@ -0,0 +1,44 @@ +const linkBins = require('./link-bins.js') +const linkMans = require('./link-mans.js') + +const binLinks = opts => { + const { path, pkg, force, global, top } = opts + // global top pkgs on windows get bins installed in {prefix}, and no mans + // + // unix global top pkgs get their bins installed in {prefix}/bin, + // and mans in {prefix}/share/man + // + // non-top pkgs get their bins installed in {prefix}/node_modules/.bin, + // and do not install mans + // + // non-global top pkgs don't have any bins or mans linked. From here on + // out, if it's top, we know that it's global, so no need to pass that + // option further down the stack. + if (top && !global) { + return Promise.resolve() + } + + return Promise.all([ + // allow clobbering within the local node_modules/.bin folder. + // only global bins are protected in this way, or else it is + // yet another vector for excessive dependency conflicts. + linkBins({ path, pkg, top, force: force || !top }), + linkMans({ path, pkg, top, force }), + ]) +} + +const shimBin = require('./shim-bin.js') +const linkGently = require('./link-gently.js') +const resetSeen = () => { + shimBin.resetSeen() + linkGently.resetSeen() +} + +const checkBins = require('./check-bins.js') +const getPaths = require('./get-paths.js') + +module.exports = Object.assign(binLinks, { + checkBins, + resetSeen, + getPaths, +}) diff --git a/node_modules/npm/node_modules/bin-links/lib/is-windows.js b/node_modules/npm/node_modules/bin-links/lib/is-windows.js new file mode 100644 index 00000000..da3b2fb2 --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/is-windows.js @@ -0,0 +1,2 @@ +const platform = process.env.__TESTING_BIN_LINKS_PLATFORM__ || process.platform +module.exports = platform === 'win32' diff --git a/node_modules/npm/node_modules/bin-links/lib/link-bin.js b/node_modules/npm/node_modules/bin-links/lib/link-bin.js new file mode 100644 index 00000000..fb579350 --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/link-bin.js @@ -0,0 +1,9 @@ +const linkGently = require('./link-gently.js') +const fixBin = require('./fix-bin.js') + +// linking bins is simple. just symlink, and if we linked it, fix the bin up +const linkBin = ({ path, to, from, absFrom, force }) => + linkGently({ path, to, from, absFrom, force }) + .then(linked => linked && fixBin(absFrom)) + +module.exports = linkBin diff --git a/node_modules/npm/node_modules/bin-links/lib/link-bins.js b/node_modules/npm/node_modules/bin-links/lib/link-bins.js new file mode 100644 index 00000000..9bf7d721 --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/link-bins.js @@ -0,0 +1,23 @@ +const isWindows = require('./is-windows.js') +const binTarget = require('./bin-target.js') +const { dirname, resolve, relative } = require('path') +const linkBin = isWindows ? require('./shim-bin.js') : require('./link-bin.js') +const normalize = require('npm-normalize-package-bin') + +const linkBins = ({ path, pkg, top, force }) => { + pkg = normalize(pkg) + if (!pkg.bin) { + return Promise.resolve([]) + } + const promises = [] + const target = binTarget({ path, top }) + for (const [key, val] of Object.entries(pkg.bin)) { + const to = resolve(target, key) + const absFrom = resolve(path, val) + const from = relative(dirname(to), absFrom) + promises.push(linkBin({ path, from, to, absFrom, force })) + } + return Promise.all(promises) +} + +module.exports = linkBins diff --git a/node_modules/npm/node_modules/bin-links/lib/link-gently.js b/node_modules/npm/node_modules/bin-links/lib/link-gently.js new file mode 100644 index 00000000..a39d3bce --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/link-gently.js @@ -0,0 +1,96 @@ +// if the thing isn't there, skip it +// if there's a non-symlink there already, eexist +// if there's a symlink already, pointing somewhere else, eexist +// if there's a symlink already, pointing into our pkg, remove it first +// then create the symlink + +const { resolve, dirname } = require('path') +const { lstat, mkdir, readlink, rm, symlink } = require('fs/promises') +const { log } = require('proc-log') +const throwSignificant = er => { + if (er.code === 'ENOENT') { + return + } + if (er.code === 'EACCES') { + log.warn('error adding file', er.message) + return + } + throw er +} + +const rmOpts = { + recursive: true, + force: true, +} + +// even in --force mode, we never create a link over a link we've +// already created. you can have multiple packages in a tree trying +// to contend for the same bin, or the same manpage listed multiple times, +// which creates a race condition and nondeterminism. +const seen = new Set() + +const SKIP = Symbol('skip - missing or already installed') +const CLOBBER = Symbol('clobber - ours or in forceful mode') + +const linkGently = async ({ path, to, from, absFrom, force }) => { + if (seen.has(to)) { + return false + } + seen.add(to) + + // if the script or manpage isn't there, just ignore it. + // this arguably *should* be an install error of some sort, + // or at least a warning, but npm has always behaved this + // way in the past, so it'd be a breaking change + return Promise.all([ + lstat(absFrom).catch(throwSignificant), + lstat(to).catch(throwSignificant), + ]).then(([stFrom, stTo]) => { + // not present in package, skip it + if (!stFrom) { + return SKIP + } + + // exists! maybe clobber if we can + if (stTo) { + if (!stTo.isSymbolicLink()) { + return force && rm(to, rmOpts).then(() => CLOBBER) + } + + return readlink(to).then(target => { + if (target === from) { + return SKIP + } // skip it, already set up like we want it. + + target = resolve(dirname(to), target) + if (target.indexOf(path) === 0 || force) { + return rm(to, rmOpts).then(() => CLOBBER) + } + // neither skip nor clobber + return false + }) + } else { + // doesn't exist, dir might not either + return mkdir(dirname(to), { recursive: true }) + } + }) + .then(skipOrClobber => { + if (skipOrClobber === SKIP) { + return false + } + return symlink(from, to, 'file').catch(er => { + if (skipOrClobber === CLOBBER || force) { + return rm(to, rmOpts).then(() => symlink(from, to, 'file')) + } + throw er + }).then(() => true) + }) +} + +const resetSeen = () => { + for (const p of seen) { + seen.delete(p) + } +} + +module.exports = Object.assign(linkGently, { resetSeen }) diff --git a/node_modules/npm/node_modules/bin-links/lib/link-mans.js b/node_modules/npm/node_modules/bin-links/lib/link-mans.js new file mode 100644 index 00000000..b6dd214c --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/link-mans.js @@ -0,0 +1,53 @@ +const { dirname, relative, join, resolve, basename } = require('path') +const linkGently = require('./link-gently.js') +const manTarget = require('./man-target.js') + +const linkMans = async ({ path, pkg, top, force }) => { + const target = manTarget({ path, top }) + if (!target || !Array.isArray(pkg?.man) || !pkg.man.length) { + return [] + } + + const links = [] + // `new Set` to filter out duplicates + for (let man of new Set(pkg.man)) { + if (!man || typeof man !== 'string') { + continue + } + // break any links to c:\\blah or /foo/blah or ../blah + man = join('/', man).replace(/\\|:/g, '/').slice(1) + const parseMan = man.match(/\.([0-9]+)(\.gz)?$/) + if (!parseMan) { + throw Object.assign(new Error('invalid man entry name\n' + + 'Man files must end with a number, ' + + 'and optionally a .gz suffix if they are compressed.' + ), { + code: 'EBADMAN', + path, + pkgid: pkg._id, + man, + }) + } + + const section = parseMan[1] + const base = basename(man) + const absFrom = resolve(path, man) + /* istanbul ignore if - that unpossible */ + if (absFrom.indexOf(path) !== 0) { + throw Object.assign(new Error('invalid man entry'), { + code: 'EBADMAN', + path, + pkgid: pkg._id, + man, + }) + } + + const to = resolve(target, 'man' + section, base) + const from = relative(dirname(to), absFrom) + + links.push(linkGently({ from, to, path, absFrom, force })) + } + return Promise.all(links) +} + +module.exports = linkMans diff --git a/node_modules/npm/node_modules/bin-links/lib/man-target.js b/node_modules/npm/node_modules/bin-links/lib/man-target.js new file mode 100644 index 00000000..efe66f38 --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/man-target.js @@ -0,0 +1,6 @@ +const isWindows = require('./is-windows.js') +const getPrefix = require('./get-prefix.js') +const { dirname } = require('path') + +module.exports = ({ top, path }) => !top || isWindows ? null + : dirname(getPrefix(path)) + '/share/man' diff --git a/node_modules/npm/node_modules/bin-links/lib/shim-bin.js b/node_modules/npm/node_modules/bin-links/lib/shim-bin.js new file mode 100644 index 00000000..67e27027 --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/lib/shim-bin.js @@ -0,0 +1,86 @@ +const { resolve, dirname } = require('path') +const { lstat } = require('fs/promises') +const throwNonEnoent = er => { + if (er.code !== 'ENOENT') { + throw er + } +} + +const cmdShim = require('cmd-shim') +const readCmdShim = require('read-cmd-shim') + +const fixBin = require('./fix-bin.js') + +// even in --force mode, we never create a shim over a shim we've +// already created. you can have multiple packages in a tree trying +// to contend for the same bin, which creates a race condition and +// nondeterminism. +const seen = new Set() + +const failEEXIST = ({ to, from }) => + Promise.reject(Object.assign(new Error('EEXIST: file already exists'), { + path: to, + dest: from, + code: 'EEXIST', + })) + +const handleReadCmdShimError = ({ er, from, to }) => + er.code === 'ENOENT' ? null + : er.code === 'ENOTASHIM' ? failEEXIST({ from, to }) + : Promise.reject(er) + +const SKIP = Symbol('skip - missing or already installed') +const shimBin = ({ path, to, from, absFrom, force }) => { + const shims = [ + to, + to + '.cmd', + to + '.ps1', + ] + + for (const shim of shims) { + if (seen.has(shim)) { + return true + } + seen.add(shim) + } + + return Promise.all([ + ...shims, + absFrom, + ].map(f => lstat(f).catch(throwNonEnoent))).then((stats) => { + const [, , , stFrom] = stats + if (!stFrom) { + return SKIP + } + + if (force) { + return false + } + + return Promise.all(shims.map((s, i) => [s, stats[i]]).map(([s, st]) => { + if (!st) { + return false + } + return readCmdShim(s) + .then(target => { + target = resolve(dirname(to), target) + if (target.indexOf(resolve(path)) !== 0) { + return failEEXIST({ from, to, path }) + } + return false + }, er => handleReadCmdShimError({ er, from, to })) + })) + }) + .then(skip => skip !== SKIP && doShim(absFrom, to)) +} + +const doShim = (absFrom, to) => + cmdShim(absFrom, to).then(() => fixBin(absFrom)) + +const resetSeen = () => { + for (const p of seen) { + seen.delete(p) + } +} + +module.exports = Object.assign(shimBin, { resetSeen }) diff --git a/node_modules/npm/node_modules/bin-links/package.json b/node_modules/npm/node_modules/bin-links/package.json new file mode 100644 index 00000000..22858d66 --- /dev/null +++ b/node_modules/npm/node_modules/bin-links/package.json @@ -0,0 +1,61 @@ +{ + "name": "bin-links", + "version": "5.0.0", + "description": "JavaScript package binary linker", + "main": "./lib/index.js", + "scripts": { + "snap": "tap", + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/bin-links.git" + }, + "keywords": [ + "npm", + "link", + "bins" + ], + "license": "ISC", + "dependencies": { + "cmd-shim": "^7.0.0", + "npm-normalize-package-bin": "^4.0.0", + "proc-log": "^5.0.0", + "read-cmd-shim": "^5.0.0", + "write-file-atomic": "^6.0.0" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "require-inject": "^1.4.4", + "tap": "^16.0.1" + }, + "tap": { + "check-coverage": true, + "coverage-map": "map.js", + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "windowsCI": false, + "version": "4.23.3", + "publish": true + } +} diff --git a/node_modules/npm/node_modules/binary-extensions/binary-extensions.json b/node_modules/npm/node_modules/binary-extensions/binary-extensions.json new file mode 100644 index 00000000..ac08048e --- /dev/null +++ b/node_modules/npm/node_modules/binary-extensions/binary-extensions.json @@ -0,0 +1,263 @@ +[ + "3dm", + "3ds", + "3g2", + "3gp", + "7z", + "a", + "aac", + "adp", + "afdesign", + "afphoto", + "afpub", + "ai", + "aif", + "aiff", + "alz", + "ape", + "apk", + "appimage", + "ar", + "arj", + "asf", + "au", + "avi", + "bak", + "baml", + "bh", + "bin", + "bk", + "bmp", + "btif", + "bz2", + "bzip2", + "cab", + "caf", + "cgm", + "class", + "cmx", + "cpio", + "cr2", + "cur", + "dat", + "dcm", + "deb", + "dex", + "djvu", + "dll", + "dmg", + "dng", + "doc", + "docm", + "docx", + "dot", + "dotm", + "dra", + "DS_Store", + "dsk", + "dts", + "dtshd", + "dvb", + "dwg", + "dxf", + "ecelp4800", + "ecelp7470", + "ecelp9600", + "egg", + "eol", + "eot", + "epub", + "exe", + "f4v", + "fbs", + "fh", + "fla", + "flac", + "flatpak", + "fli", + "flv", + "fpx", + "fst", + "fvt", + "g3", + "gh", + "gif", + "graffle", + "gz", + "gzip", + "h261", + "h263", + "h264", + "icns", + "ico", + "ief", + "img", + "ipa", + "iso", + "jar", + "jpeg", + "jpg", + "jpgv", + "jpm", + "jxr", + "key", + "ktx", + "lha", + "lib", + "lvp", + "lz", + "lzh", + "lzma", + "lzo", + "m3u", + "m4a", + "m4v", + "mar", + "mdi", + "mht", + "mid", + "midi", + "mj2", + "mka", + "mkv", + "mmr", + "mng", + "mobi", + "mov", + "movie", + "mp3", + "mp4", + "mp4a", + "mpeg", + "mpg", + "mpga", + "mxu", + "nef", + "npx", + "numbers", + "nupkg", + "o", + "odp", + "ods", + "odt", + "oga", + "ogg", + "ogv", + "otf", + "ott", + "pages", + "pbm", + "pcx", + "pdb", + "pdf", + "pea", + "pgm", + "pic", + "png", + "pnm", + "pot", + "potm", + "potx", + "ppa", + "ppam", + "ppm", + "pps", + "ppsm", + "ppsx", + "ppt", + "pptm", + "pptx", + "psd", + "pya", + "pyc", + "pyo", + "pyv", + "qt", + "rar", + "ras", + "raw", + "resources", + "rgb", + "rip", + "rlc", + "rmf", + "rmvb", + "rpm", + "rtf", + "rz", + "s3m", + "s7z", + "scpt", + "sgi", + "shar", + "snap", + "sil", + "sketch", + "slk", + "smv", + "snk", + "so", + "stl", + "suo", + "sub", + "swf", + "tar", + "tbz", + "tbz2", + "tga", + "tgz", + "thmx", + "tif", + "tiff", + "tlz", + "ttc", + "ttf", + "txz", + "udf", + "uvh", + "uvi", + "uvm", + "uvp", + "uvs", + "uvu", + "viv", + "vob", + "war", + "wav", + "wax", + "wbmp", + "wdp", + "weba", + "webm", + "webp", + "whl", + "wim", + "wm", + "wma", + "wmv", + "wmx", + "woff", + "woff2", + "wrm", + "wvx", + "xbm", + "xif", + "xla", + "xlam", + "xls", + "xlsb", + "xlsm", + "xlsx", + "xlt", + "xltm", + "xltx", + "xm", + "xmind", + "xpi", + "xpm", + "xwd", + "xz", + "z", + "zip", + "zipx" +] diff --git a/node_modules/npm/node_modules/binary-extensions/index.js b/node_modules/npm/node_modules/binary-extensions/index.js new file mode 100644 index 00000000..6c99c7eb --- /dev/null +++ b/node_modules/npm/node_modules/binary-extensions/index.js @@ -0,0 +1,3 @@ +import binaryExtensions from './binary-extensions.json' with {type: 'json'}; + +export default binaryExtensions; diff --git a/node_modules/npm/node_modules/binary-extensions/license b/node_modules/npm/node_modules/binary-extensions/license new file mode 100644 index 00000000..5493a1a6 --- /dev/null +++ b/node_modules/npm/node_modules/binary-extensions/license @@ -0,0 +1,10 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) +Copyright (c) Paul Miller (https://paulmillr.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/npm/node_modules/binary-extensions/package.json b/node_modules/npm/node_modules/binary-extensions/package.json new file mode 100644 index 00000000..0d309f78 --- /dev/null +++ b/node_modules/npm/node_modules/binary-extensions/package.json @@ -0,0 +1,45 @@ +{ + "name": "binary-extensions", + "version": "3.0.0", + "description": "List of binary file extensions", + "license": "MIT", + "repository": "sindresorhus/binary-extensions", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": { + "types": "./index.d.ts", + "default": "./index.js" + }, + "sideEffects": false, + "engines": { + "node": ">=18.20" + }, + "scripts": { + "//test": "xo && ava && tsd", + "test": "ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts", + "binary-extensions.json" + ], + "keywords": [ + "binary", + "extensions", + "extension", + "file", + "json", + "list", + "array" + ], + "devDependencies": { + "ava": "^6.1.2", + "tsd": "^0.31.0", + "xo": "^0.58.0" + } +} diff --git a/node_modules/npm/node_modules/brace-expansion/LICENSE b/node_modules/npm/node_modules/brace-expansion/LICENSE new file mode 100644 index 00000000..de322667 --- /dev/null +++ b/node_modules/npm/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +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/npm/node_modules/brace-expansion/index.js b/node_modules/npm/node_modules/brace-expansion/index.js new file mode 100644 index 00000000..4af9ddee --- /dev/null +++ b/node_modules/npm/node_modules/brace-expansion/index.js @@ -0,0 +1,203 @@ +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/npm/node_modules/brace-expansion/package.json b/node_modules/npm/node_modules/brace-expansion/package.json new file mode 100644 index 00000000..7097d41e --- /dev/null +++ b/node_modules/npm/node_modules/brace-expansion/package.json @@ -0,0 +1,46 @@ +{ + "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/npm/node_modules/cacache/LICENSE.md b/node_modules/npm/node_modules/cacache/LICENSE.md new file mode 100644 index 00000000..8d28acf8 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/LICENSE.md @@ -0,0 +1,16 @@ +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/npm/node_modules/cacache/lib/content/path.js b/node_modules/npm/node_modules/cacache/lib/content/path.js new file mode 100644 index 00000000..ad5a76a4 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/content/path.js @@ -0,0 +1,29 @@ +'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/npm/node_modules/cacache/lib/content/read.js b/node_modules/npm/node_modules/cacache/lib/content/read.js new file mode 100644 index 00000000..5f6192c3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/content/read.js @@ -0,0 +1,165 @@ +'use strict' + +const fs = require('fs/promises') +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 = size ? { size } : await fs.stat(cpath) + return { stat, cpath, sri } + }) + + 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 (stat.size !== data.length) { + throw sizeError(stat.size, data.length) + } + + 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.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) => { + // get size + const stat = size ? { size } : await fs.stat(cpath) + return { stat, cpath, sri } + }) + + return readPipeline(cpath, stat.size, sri, stream) + }).catch(err => stream.emit('error', err)) + + return stream +} + +module.exports.copy = copy + +function copy (cache, integrity, dest) { + return withContentSri(cache, integrity, (cpath) => { + return fs.copyFile(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 + } + } + } +} + +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 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/npm/node_modules/cacache/lib/content/rm.js b/node_modules/npm/node_modules/cacache/lib/content/rm.js new file mode 100644 index 00000000..ce58d679 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/content/rm.js @@ -0,0 +1,18 @@ +'use strict' + +const fs = require('fs/promises') +const contentPath = require('./path') +const { hasContent } = require('./read') + +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 fs.rm(contentPath(cache, content.sri), { recursive: true, force: true }) + return true + } else { + return false + } +} diff --git a/node_modules/npm/node_modules/cacache/lib/content/write.js b/node_modules/npm/node_modules/cacache/lib/content/write.js new file mode 100644 index 00000000..e7187abc --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/content/write.js @@ -0,0 +1,206 @@ +'use strict' + +const events = require('events') + +const contentPath = require('./path') +const fs = require('fs/promises') +const { moveFile } = require('@npmcli/fs') +const { Minipass } = require('minipass') +const Pipeline = require('minipass-pipeline') +const Flush = require('minipass-flush') +const path = require('path') +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 (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) + } + + 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 }) + } + } + } + return { integrity: sri, size: data.length } +} + +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 + ) + this.handleContentP.catch(error => this.emit('error', error)) + } + 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 fs.rm(tmp.target, { recursive: true, force: true }) + } + } +} + +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 fs.mkdir(path.dirname(tmpTarget), { recursive: true }) + return { + target: tmpTarget, + moved: false, + } +} + +async function moveToDestination (tmp, cache, sri) { + 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) +} + +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/npm/node_modules/cacache/lib/entry-index.js b/node_modules/npm/node_modules/cacache/lib/entry-index.js new file mode 100644 index 00000000..0e09b108 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/entry-index.js @@ -0,0 +1,336 @@ +'use strict' + +const crypto = require('crypto') +const { + appendFile, + mkdir, + readFile, + readdir, + rm, + writeFile, +} = require('fs/promises') +const { Minipass } = require('minipass') +const path = require('path') +const ssri = require('ssri') +const uniqueFilename = require('unique-filename') + +const contentPath = require('./content/path') +const hashToSegments = require('./util/hash-to-segments') +const indexV = require('../package.json')['cache-version'].index +const { moveFile } = require('@npmcli/fs') + +const lsStreamConcurrency = 5 + +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 mkdir(path.dirname(target), { recursive: true }) + return { + target, + moved: false, + } + } + + const teardown = async (tmp) => { + if (!tmp.moved) { + return rm(tmp.target, { recursive: true, force: true }) + } + } + + const write = async (tmp) => { + await writeFile(tmp.target, newIndex, { flag: 'wx' }) + await mkdir(path.dirname(bucket), { recursive: true }) + // we use @npmcli/move-file directly here because we + // want to overwrite the existing file + await moveFile(tmp.target, bucket) + tmp.moved = true + } + + // 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, time } = opts + const bucket = bucketPath(cache, key) + const entry = { + key, + integrity: integrity && ssri.stringify(integrity), + time: time || Date.now(), + size, + metadata, + } + try { + await mkdir(path.dirname(bucket), { recursive: true }) + 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 appendFile(bucket, `\n${hashEntry(stringified)}\t${stringified}`) + } catch (err) { + if (err.code === 'ENOENT') { + return undefined + } + + 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.delete = del + +function del (cache, key, opts = {}) { + if (!opts.removeFully) { + return insert(cache, key, null, opts) + } + + const bucket = bucketPath(cache, key) + return rm(bucket, { recursive: true, force: true }) +} + +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 { default: pMap } = await import('p-map') + const buckets = await readdirOrEmpty(indexDir) + await pMap(buckets, async (bucket) => { + const bucketPath = path.join(indexDir, bucket) + const subbuckets = await readdirOrEmpty(bucketPath) + await pMap(subbuckets, async (subbucket) => { + const subbucketPath = path.join(bucketPath, subbucket) + + // "/cachename//./*" + const subbucketEntries = await readdirOrEmpty(subbucketPath) + await pMap(subbucketEntries, 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 + } + }, + { concurrency: lsStreamConcurrency }) + }, + { concurrency: lsStreamConcurrency }) + }, + { concurrency: lsStreamConcurrency }) + 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 readFile(bucket, 'utf8') + return _bucketEntries(data, filter) +} + +function _bucketEntries (data) { + 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 (_) { + // eslint-ignore-next-line no-empty-block + } + // coverage disabled here, no need to test with an entry that parses to something falsey + // istanbul ignore else + 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 readdir(dir).catch((err) => { + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') { + return [] + } + + throw err + }) +} diff --git a/node_modules/npm/node_modules/cacache/lib/get.js b/node_modules/npm/node_modules/cacache/lib/get.js new file mode 100644 index 00000000..80ec206c --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/get.js @@ -0,0 +1,170 @@ +'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 + +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/npm/node_modules/cacache/lib/index.js b/node_modules/npm/node_modules/cacache/lib/index.js new file mode 100644 index 00000000..c9b0da5f --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/index.js @@ -0,0 +1,42 @@ +'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.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.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/npm/node_modules/cacache/lib/memoization.js b/node_modules/npm/node_modules/cacache/lib/memoization.js new file mode 100644 index 00000000..2ecc6091 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/memoization.js @@ -0,0 +1,72 @@ +'use strict' + +const { LRUCache } = require('lru-cache') + +const MEMOIZED = new LRUCache({ + 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/npm/node_modules/cacache/lib/put.js b/node_modules/npm/node_modules/cacache/lib/put.js new file mode 100644 index 00000000..9fc932d5 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/put.js @@ -0,0 +1,80 @@ +'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/npm/node_modules/cacache/lib/rm.js b/node_modules/npm/node_modules/cacache/lib/rm.js new file mode 100644 index 00000000..a94760c7 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/rm.js @@ -0,0 +1,31 @@ +'use strict' + +const { rm } = require('fs/promises') +const glob = require('./util/glob.js') +const index = require('./entry-index') +const memo = require('./memoization') +const path = require('path') +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 + +async 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 }))) +} diff --git a/node_modules/npm/node_modules/cacache/lib/util/glob.js b/node_modules/npm/node_modules/cacache/lib/util/glob.js new file mode 100644 index 00000000..8500c1c1 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/util/glob.js @@ -0,0 +1,7 @@ +'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/npm/node_modules/cacache/lib/util/hash-to-segments.js b/node_modules/npm/node_modules/cacache/lib/util/hash-to-segments.js new file mode 100644 index 00000000..445599b5 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/util/hash-to-segments.js @@ -0,0 +1,7 @@ +'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/npm/node_modules/cacache/lib/util/tmp.js b/node_modules/npm/node_modules/cacache/lib/util/tmp.js new file mode 100644 index 00000000..0bf53021 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/util/tmp.js @@ -0,0 +1,26 @@ +'use strict' + +const { withTempDir } = require('@npmcli/fs') +const fs = require('fs/promises') +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 withTempDir(path.join(cache, 'tmp'), cb, opts) +} diff --git a/node_modules/npm/node_modules/cacache/lib/verify.js b/node_modules/npm/node_modules/cacache/lib/verify.js new file mode 100644 index 00000000..dcff3aa7 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/lib/verify.js @@ -0,0 +1,258 @@ +'use strict' + +const { + mkdir, + readFile, + rm, + stat, + truncate, + writeFile, +} = require('fs/promises') +const contentPath = require('./content/path') +const fsm = require('fs-minipass') +const glob = require('./util/glob.js') +const index = require('./entry-index') +const path = require('path') +const ssri = require('ssri') + +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 () { + return { startTime: new Date() } +} + +async function markEndTime () { + return { endTime: new Date() } +} + +async function fixPerms (cache, opts) { + opts.log.silly('verify', 'fixing cache permissions') + await mkdir(cache, { recursive: true }) + 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, rm it. +// +async function garbageCollect (cache, opts) { + opts.log.silly('verify', 'garbage collecting content') + const { default: pMap } = await import('p-map') + const indexStream = index.lsStream(cache) + const liveContent = new Set() + indexStream.on('data', (entry) => { + if (opts.filter && !opts.filter(entry)) { + 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()) + } + }) + await new Promise((resolve, reject) => { + indexStream.on('end', resolve).on('error', reject) + }) + const contentDir = contentPath.contentDir(cache) + const files = await glob(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 stat(f) + await rm(f, { recursive: true, force: true }) + stats.reclaimedSize += s.size + } + return stats + }, + { concurrency: opts.concurrency } + ) + return stats +} + +async function verifyContent (filepath, sri) { + const contentInfo = {} + try { + const { size } = await 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 rm(filepath, { recursive: true, force: true }) + contentInfo.valid = false + } + return contentInfo +} + +async function rebuildIndex (cache, opts) { + opts.log.silly('verify', 'rebuilding index') + const { default: pMap } = await import('p-map') + 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) { + await 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 index.insert(cache, entry.key, entry.integrity, { + metadata: entry.metadata, + size: entry.size, + time: entry.time, + }) + 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 rm(path.join(cache, 'tmp'), { recursive: true, force: true }) +} + +async function writeVerifile (cache, opts) { + const verifile = path.join(cache, '_lastverified') + opts.log.silly('verify', 'writing verifile to ' + verifile) + return writeFile(verifile, `${Date.now()}`) +} + +module.exports.lastRun = lastRun + +async function lastRun (cache) { + const data = await readFile(path.join(cache, '_lastverified'), { encoding: 'utf8' }) + return new Date(+data) +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/chownr/LICENSE.md b/node_modules/npm/node_modules/cacache/node_modules/chownr/LICENSE.md new file mode 100644 index 00000000..881248b6 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/chownr/LICENSE.md @@ -0,0 +1,63 @@ +All packages under `src/` are licensed according to the terms in +their respective `LICENSE` or `LICENSE.md` files. + +The remainder of this project is licensed under the Blue Oak +Model License, as follows: + +----- + +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/commonjs/index.js b/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/commonjs/index.js new file mode 100644 index 00000000..6a7b68d5 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/commonjs/index.js @@ -0,0 +1,93 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.chownrSync = exports.chownr = void 0; +const node_fs_1 = __importDefault(require("node:fs")); +const node_path_1 = __importDefault(require("node:path")); +const lchownSync = (path, uid, gid) => { + try { + return node_fs_1.default.lchownSync(path, uid, gid); + } + catch (er) { + if (er?.code !== 'ENOENT') + throw er; + } +}; +const chown = (cpath, uid, gid, cb) => { + node_fs_1.default.lchown(cpath, uid, gid, er => { + // Skip ENOENT error + cb(er && er?.code !== 'ENOENT' ? er : null); + }); +}; +const chownrKid = (p, child, uid, gid, cb) => { + if (child.isDirectory()) { + (0, exports.chownr)(node_path_1.default.resolve(p, child.name), uid, gid, (er) => { + if (er) + return cb(er); + const cpath = node_path_1.default.resolve(p, child.name); + chown(cpath, uid, gid, cb); + }); + } + else { + const cpath = node_path_1.default.resolve(p, child.name); + chown(cpath, uid, gid, cb); + } +}; +const chownr = (p, uid, gid, cb) => { + node_fs_1.default.readdir(p, { withFileTypes: true }, (er, children) => { + // any error other than ENOTDIR or ENOTSUP means it's not readable, + // or doesn't exist. give up. + if (er) { + if (er.code === 'ENOENT') + return cb(); + else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') + return cb(er); + } + if (er || !children.length) + return chown(p, uid, gid, cb); + let len = children.length; + let errState = null; + const then = (er) => { + /* c8 ignore start */ + if (errState) + return; + /* c8 ignore stop */ + if (er) + return cb((errState = er)); + if (--len === 0) + return chown(p, uid, gid, cb); + }; + for (const child of children) { + chownrKid(p, child, uid, gid, then); + } + }); +}; +exports.chownr = chownr; +const chownrKidSync = (p, child, uid, gid) => { + if (child.isDirectory()) + (0, exports.chownrSync)(node_path_1.default.resolve(p, child.name), uid, gid); + lchownSync(node_path_1.default.resolve(p, child.name), uid, gid); +}; +const chownrSync = (p, uid, gid) => { + let children; + try { + children = node_fs_1.default.readdirSync(p, { withFileTypes: true }); + } + catch (er) { + const e = er; + if (e?.code === 'ENOENT') + return; + else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP') + return lchownSync(p, uid, gid); + else + throw e; + } + for (const child of children) { + chownrKidSync(p, child, uid, gid); + } + return lchownSync(p, uid, gid); +}; +exports.chownrSync = chownrSync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/commonjs/package.json b/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/esm/index.js b/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/esm/index.js new file mode 100644 index 00000000..5c281529 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/esm/index.js @@ -0,0 +1,85 @@ +import fs from 'node:fs'; +import path from 'node:path'; +const lchownSync = (path, uid, gid) => { + try { + return fs.lchownSync(path, uid, gid); + } + catch (er) { + if (er?.code !== 'ENOENT') + throw er; + } +}; +const chown = (cpath, uid, gid, cb) => { + fs.lchown(cpath, uid, gid, er => { + // Skip ENOENT error + cb(er && er?.code !== 'ENOENT' ? er : null); + }); +}; +const chownrKid = (p, child, uid, gid, cb) => { + if (child.isDirectory()) { + chownr(path.resolve(p, child.name), uid, gid, (er) => { + if (er) + return cb(er); + const cpath = path.resolve(p, child.name); + chown(cpath, uid, gid, cb); + }); + } + else { + const cpath = path.resolve(p, child.name); + chown(cpath, uid, gid, cb); + } +}; +export const chownr = (p, uid, gid, cb) => { + fs.readdir(p, { withFileTypes: true }, (er, children) => { + // any error other than ENOTDIR or ENOTSUP means it's not readable, + // or doesn't exist. give up. + if (er) { + if (er.code === 'ENOENT') + return cb(); + else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') + return cb(er); + } + if (er || !children.length) + return chown(p, uid, gid, cb); + let len = children.length; + let errState = null; + const then = (er) => { + /* c8 ignore start */ + if (errState) + return; + /* c8 ignore stop */ + if (er) + return cb((errState = er)); + if (--len === 0) + return chown(p, uid, gid, cb); + }; + for (const child of children) { + chownrKid(p, child, uid, gid, then); + } + }); +}; +const chownrKidSync = (p, child, uid, gid) => { + if (child.isDirectory()) + chownrSync(path.resolve(p, child.name), uid, gid); + lchownSync(path.resolve(p, child.name), uid, gid); +}; +export const chownrSync = (p, uid, gid) => { + let children; + try { + children = fs.readdirSync(p, { withFileTypes: true }); + } + catch (er) { + const e = er; + if (e?.code === 'ENOENT') + return; + else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP') + return lchownSync(p, uid, gid); + else + throw e; + } + for (const child of children) { + chownrKidSync(p, child, uid, gid); + } + return lchownSync(p, uid, gid); +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/esm/package.json b/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/chownr/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/chownr/package.json b/node_modules/npm/node_modules/cacache/node_modules/chownr/package.json new file mode 100644 index 00000000..09aa6b2e --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/chownr/package.json @@ -0,0 +1,69 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "name": "chownr", + "description": "like `chown -R`", + "version": "3.0.0", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/chownr.git" + }, + "files": [ + "dist" + ], + "devDependencies": { + "@types/node": "^20.12.5", + "mkdirp": "^3.0.1", + "prettier": "^3.2.5", + "rimraf": "^5.0.5", + "tap": "^18.7.2", + "tshy": "^1.13.1", + "typedoc": "^0.25.12" + }, + "scripts": { + "prepare": "tshy", + "pretest": "npm run prepare", + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + }, + "tshy": { + "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" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + } +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/minizlib/LICENSE b/node_modules/npm/node_modules/cacache/node_modules/minizlib/LICENSE new file mode 100644 index 00000000..49f7efe4 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/minizlib/LICENSE @@ -0,0 +1,26 @@ +Minizlib was created by Isaac Z. Schlueter. +It is a derivative work of the Node.js project. + +""" +Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors +Copyright (c) 2017-2023 Node.js contributors. All rights reserved. +Copyright (c) 2017-2023 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/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/constants.js b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/constants.js new file mode 100644 index 00000000..dfc2c195 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/constants.js @@ -0,0 +1,123 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.constants = void 0; +// Update with any zlib constants that are added or changed in the future. +// Node v6 didn't export this, so we just hard code the version and rely +// on all the other hard-coded values from zlib v4736. When node v6 +// support drops, we can just export the realZlibConstants object. +const zlib_1 = __importDefault(require("zlib")); +/* c8 ignore start */ +const realZlibConstants = zlib_1.default.constants || { ZLIB_VERNUM: 4736 }; +/* c8 ignore stop */ +exports.constants = Object.freeze(Object.assign(Object.create(null), { + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + Z_VERSION_ERROR: -6, + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + DEFLATE: 1, + INFLATE: 2, + GZIP: 3, + GUNZIP: 4, + DEFLATERAW: 5, + INFLATERAW: 6, + UNZIP: 7, + BROTLI_DECODE: 8, + BROTLI_ENCODE: 9, + Z_MIN_WINDOWBITS: 8, + Z_MAX_WINDOWBITS: 15, + Z_DEFAULT_WINDOWBITS: 15, + Z_MIN_CHUNK: 64, + Z_MAX_CHUNK: Infinity, + Z_DEFAULT_CHUNK: 16384, + Z_MIN_MEMLEVEL: 1, + Z_MAX_MEMLEVEL: 9, + Z_DEFAULT_MEMLEVEL: 8, + Z_MIN_LEVEL: -1, + Z_MAX_LEVEL: 9, + Z_DEFAULT_LEVEL: -1, + BROTLI_OPERATION_PROCESS: 0, + BROTLI_OPERATION_FLUSH: 1, + BROTLI_OPERATION_FINISH: 2, + BROTLI_OPERATION_EMIT_METADATA: 3, + BROTLI_MODE_GENERIC: 0, + BROTLI_MODE_TEXT: 1, + BROTLI_MODE_FONT: 2, + BROTLI_DEFAULT_MODE: 0, + BROTLI_MIN_QUALITY: 0, + BROTLI_MAX_QUALITY: 11, + BROTLI_DEFAULT_QUALITY: 11, + BROTLI_MIN_WINDOW_BITS: 10, + BROTLI_MAX_WINDOW_BITS: 24, + BROTLI_LARGE_MAX_WINDOW_BITS: 30, + BROTLI_DEFAULT_WINDOW: 22, + BROTLI_MIN_INPUT_BLOCK_BITS: 16, + BROTLI_MAX_INPUT_BLOCK_BITS: 24, + BROTLI_PARAM_MODE: 0, + BROTLI_PARAM_QUALITY: 1, + BROTLI_PARAM_LGWIN: 2, + BROTLI_PARAM_LGBLOCK: 3, + BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4, + BROTLI_PARAM_SIZE_HINT: 5, + BROTLI_PARAM_LARGE_WINDOW: 6, + BROTLI_PARAM_NPOSTFIX: 7, + BROTLI_PARAM_NDIRECT: 8, + BROTLI_DECODER_RESULT_ERROR: 0, + BROTLI_DECODER_RESULT_SUCCESS: 1, + BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0, + BROTLI_DECODER_PARAM_LARGE_WINDOW: 1, + BROTLI_DECODER_NO_ERROR: 0, + BROTLI_DECODER_SUCCESS: 1, + BROTLI_DECODER_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1, + BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5, + BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6, + BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7, + BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10, + BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11, + BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12, + BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13, + BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14, + BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15, + BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16, + BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19, + BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21, + BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27, + BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30, + BROTLI_DECODER_ERROR_UNREACHABLE: -31, +}, realZlibConstants)); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/index.js b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/index.js new file mode 100644 index 00000000..ad65eef0 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/index.js @@ -0,0 +1,352 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BrotliDecompress = exports.BrotliCompress = exports.Brotli = exports.Unzip = exports.InflateRaw = exports.DeflateRaw = exports.Gunzip = exports.Gzip = exports.Inflate = exports.Deflate = exports.Zlib = exports.ZlibError = exports.constants = void 0; +const assert_1 = __importDefault(require("assert")); +const buffer_1 = require("buffer"); +const minipass_1 = require("minipass"); +const zlib_1 = __importDefault(require("zlib")); +const constants_js_1 = require("./constants.js"); +var constants_js_2 = require("./constants.js"); +Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return constants_js_2.constants; } }); +const OriginalBufferConcat = buffer_1.Buffer.concat; +const _superWrite = Symbol('_superWrite'); +class ZlibError extends Error { + code; + errno; + constructor(err) { + super('zlib: ' + err.message); + this.code = err.code; + this.errno = err.errno; + /* c8 ignore next */ + if (!this.code) + this.code = 'ZLIB_ERROR'; + this.message = 'zlib: ' + err.message; + Error.captureStackTrace(this, this.constructor); + } + get name() { + return 'ZlibError'; + } +} +exports.ZlibError = ZlibError; +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. +const _flushFlag = Symbol('flushFlag'); +class ZlibBase extends minipass_1.Minipass { + #sawError = false; + #ended = false; + #flushFlag; + #finishFlushFlag; + #fullFlushFlag; + #handle; + #onError; + get sawError() { + return this.#sawError; + } + get handle() { + return this.#handle; + } + /* c8 ignore start */ + get flushFlag() { + return this.#flushFlag; + } + /* c8 ignore stop */ + constructor(opts, mode) { + if (!opts || typeof opts !== 'object') + throw new TypeError('invalid options for ZlibBase constructor'); + //@ts-ignore + super(opts); + /* c8 ignore start */ + this.#flushFlag = opts.flush ?? 0; + this.#finishFlushFlag = opts.finishFlush ?? 0; + this.#fullFlushFlag = opts.fullFlushFlag ?? 0; + /* c8 ignore stop */ + // this will throw if any options are invalid for the class selected + try { + // @types/node doesn't know that it exports the classes, but they're there + //@ts-ignore + this.#handle = new zlib_1.default[mode](opts); + } + catch (er) { + // make sure that all errors get decorated properly + throw new ZlibError(er); + } + this.#onError = err => { + // no sense raising multiple errors, since we abort on the first one. + if (this.#sawError) + return; + this.#sawError = true; + // there is no way to cleanly recover. + // continuing only obscures problems. + this.close(); + this.emit('error', err); + }; + this.#handle?.on('error', er => this.#onError(new ZlibError(er))); + this.once('end', () => this.close); + } + close() { + if (this.#handle) { + this.#handle.close(); + this.#handle = undefined; + this.emit('close'); + } + } + reset() { + if (!this.#sawError) { + (0, assert_1.default)(this.#handle, 'zlib binding closed'); + //@ts-ignore + return this.#handle.reset?.(); + } + } + flush(flushFlag) { + if (this.ended) + return; + if (typeof flushFlag !== 'number') + flushFlag = this.#fullFlushFlag; + this.write(Object.assign(buffer_1.Buffer.alloc(0), { [_flushFlag]: flushFlag })); + } + end(chunk, encoding, cb) { + /* c8 ignore start */ + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + /* c8 ignore stop */ + if (chunk) { + if (encoding) + this.write(chunk, encoding); + else + this.write(chunk); + } + this.flush(this.#finishFlushFlag); + this.#ended = true; + return super.end(cb); + } + get ended() { + return this.#ended; + } + // overridden in the gzip classes to do portable writes + [_superWrite](data) { + return super.write(data); + } + write(chunk, encoding, cb) { + // process the chunk using the sync process + // then super.write() all the outputted chunks + if (typeof encoding === 'function') + (cb = encoding), (encoding = 'utf8'); + if (typeof chunk === 'string') + chunk = buffer_1.Buffer.from(chunk, encoding); + if (this.#sawError) + return; + (0, assert_1.default)(this.#handle, 'zlib binding closed'); + // _processChunk tries to .close() the native handle after it's done, so we + // intercept that by temporarily making it a no-op. + // diving into the node:zlib internals a bit here + const nativeHandle = this.#handle + ._handle; + const originalNativeClose = nativeHandle.close; + nativeHandle.close = () => { }; + const originalClose = this.#handle.close; + this.#handle.close = () => { }; + // It also calls `Buffer.concat()` at the end, which may be convenient + // for some, but which we are not interested in as it slows us down. + buffer_1.Buffer.concat = args => args; + let result = undefined; + try { + const flushFlag = typeof chunk[_flushFlag] === 'number' + ? chunk[_flushFlag] + : this.#flushFlag; + result = this.#handle._processChunk(chunk, flushFlag); + // if we don't throw, reset it back how it was + buffer_1.Buffer.concat = OriginalBufferConcat; + } + catch (err) { + // or if we do, put Buffer.concat() back before we emit error + // Error events call into user code, which may call Buffer.concat() + buffer_1.Buffer.concat = OriginalBufferConcat; + this.#onError(new ZlibError(err)); + } + finally { + if (this.#handle) { + // Core zlib resets `_handle` to null after attempting to close the + // native handle. Our no-op handler prevented actual closure, but we + // need to restore the `._handle` property. + ; + this.#handle._handle = + nativeHandle; + nativeHandle.close = originalNativeClose; + this.#handle.close = originalClose; + // `_processChunk()` adds an 'error' listener. If we don't remove it + // after each call, these handlers start piling up. + this.#handle.removeAllListeners('error'); + // make sure OUR error listener is still attached tho + } + } + if (this.#handle) + this.#handle.on('error', er => this.#onError(new ZlibError(er))); + let writeReturn; + if (result) { + if (Array.isArray(result) && result.length > 0) { + const r = result[0]; + // The first buffer is always `handle._outBuffer`, which would be + // re-used for later invocations; so, we always have to copy that one. + writeReturn = this[_superWrite](buffer_1.Buffer.from(r)); + for (let i = 1; i < result.length; i++) { + writeReturn = this[_superWrite](result[i]); + } + } + else { + // either a single Buffer or an empty array + writeReturn = this[_superWrite](buffer_1.Buffer.from(result)); + } + } + if (cb) + cb(); + return writeReturn; + } +} +class Zlib extends ZlibBase { + #level; + #strategy; + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants_js_1.constants.Z_NO_FLUSH; + opts.finishFlush = opts.finishFlush || constants_js_1.constants.Z_FINISH; + opts.fullFlushFlag = constants_js_1.constants.Z_FULL_FLUSH; + super(opts, mode); + this.#level = opts.level; + this.#strategy = opts.strategy; + } + params(level, strategy) { + if (this.sawError) + return; + if (!this.handle) + throw new Error('cannot switch params when binding is closed'); + // no way to test this without also not supporting params at all + /* c8 ignore start */ + if (!this.handle.params) + throw new Error('not supported in this implementation'); + /* c8 ignore stop */ + if (this.#level !== level || this.#strategy !== strategy) { + this.flush(constants_js_1.constants.Z_SYNC_FLUSH); + (0, assert_1.default)(this.handle, 'zlib binding closed'); + // .params() calls .flush(), but the latter is always async in the + // core zlib. We override .flush() temporarily to intercept that and + // flush synchronously. + const origFlush = this.handle.flush; + this.handle.flush = (flushFlag, cb) => { + /* c8 ignore start */ + if (typeof flushFlag === 'function') { + cb = flushFlag; + flushFlag = this.flushFlag; + } + /* c8 ignore stop */ + this.flush(flushFlag); + cb?.(); + }; + try { + ; + this.handle.params(level, strategy); + } + finally { + this.handle.flush = origFlush; + } + /* c8 ignore start */ + if (this.handle) { + this.#level = level; + this.#strategy = strategy; + } + /* c8 ignore stop */ + } + } +} +exports.Zlib = Zlib; +// minimal 2-byte header +class Deflate extends Zlib { + constructor(opts) { + super(opts, 'Deflate'); + } +} +exports.Deflate = Deflate; +class Inflate extends Zlib { + constructor(opts) { + super(opts, 'Inflate'); + } +} +exports.Inflate = Inflate; +class Gzip extends Zlib { + #portable; + constructor(opts) { + super(opts, 'Gzip'); + this.#portable = opts && !!opts.portable; + } + [_superWrite](data) { + if (!this.#portable) + return super[_superWrite](data); + // we'll always get the header emitted in one first chunk + // overwrite the OS indicator byte with 0xFF + this.#portable = false; + data[9] = 255; + return super[_superWrite](data); + } +} +exports.Gzip = Gzip; +class Gunzip extends Zlib { + constructor(opts) { + super(opts, 'Gunzip'); + } +} +exports.Gunzip = Gunzip; +// raw - no header +class DeflateRaw extends Zlib { + constructor(opts) { + super(opts, 'DeflateRaw'); + } +} +exports.DeflateRaw = DeflateRaw; +class InflateRaw extends Zlib { + constructor(opts) { + super(opts, 'InflateRaw'); + } +} +exports.InflateRaw = InflateRaw; +// auto-detect header. +class Unzip extends Zlib { + constructor(opts) { + super(opts, 'Unzip'); + } +} +exports.Unzip = Unzip; +class Brotli extends ZlibBase { + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants_js_1.constants.BROTLI_OPERATION_PROCESS; + opts.finishFlush = + opts.finishFlush || constants_js_1.constants.BROTLI_OPERATION_FINISH; + opts.fullFlushFlag = constants_js_1.constants.BROTLI_OPERATION_FLUSH; + super(opts, mode); + } +} +exports.Brotli = Brotli; +class BrotliCompress extends Brotli { + constructor(opts) { + super(opts, 'BrotliCompress'); + } +} +exports.BrotliCompress = BrotliCompress; +class BrotliDecompress extends Brotli { + constructor(opts) { + super(opts, 'BrotliDecompress'); + } +} +exports.BrotliDecompress = BrotliDecompress; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/package.json b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/constants.js b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/constants.js new file mode 100644 index 00000000..7faf40be --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/constants.js @@ -0,0 +1,117 @@ +// Update with any zlib constants that are added or changed in the future. +// Node v6 didn't export this, so we just hard code the version and rely +// on all the other hard-coded values from zlib v4736. When node v6 +// support drops, we can just export the realZlibConstants object. +import realZlib from 'zlib'; +/* c8 ignore start */ +const realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 }; +/* c8 ignore stop */ +export const constants = Object.freeze(Object.assign(Object.create(null), { + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + Z_VERSION_ERROR: -6, + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + DEFLATE: 1, + INFLATE: 2, + GZIP: 3, + GUNZIP: 4, + DEFLATERAW: 5, + INFLATERAW: 6, + UNZIP: 7, + BROTLI_DECODE: 8, + BROTLI_ENCODE: 9, + Z_MIN_WINDOWBITS: 8, + Z_MAX_WINDOWBITS: 15, + Z_DEFAULT_WINDOWBITS: 15, + Z_MIN_CHUNK: 64, + Z_MAX_CHUNK: Infinity, + Z_DEFAULT_CHUNK: 16384, + Z_MIN_MEMLEVEL: 1, + Z_MAX_MEMLEVEL: 9, + Z_DEFAULT_MEMLEVEL: 8, + Z_MIN_LEVEL: -1, + Z_MAX_LEVEL: 9, + Z_DEFAULT_LEVEL: -1, + BROTLI_OPERATION_PROCESS: 0, + BROTLI_OPERATION_FLUSH: 1, + BROTLI_OPERATION_FINISH: 2, + BROTLI_OPERATION_EMIT_METADATA: 3, + BROTLI_MODE_GENERIC: 0, + BROTLI_MODE_TEXT: 1, + BROTLI_MODE_FONT: 2, + BROTLI_DEFAULT_MODE: 0, + BROTLI_MIN_QUALITY: 0, + BROTLI_MAX_QUALITY: 11, + BROTLI_DEFAULT_QUALITY: 11, + BROTLI_MIN_WINDOW_BITS: 10, + BROTLI_MAX_WINDOW_BITS: 24, + BROTLI_LARGE_MAX_WINDOW_BITS: 30, + BROTLI_DEFAULT_WINDOW: 22, + BROTLI_MIN_INPUT_BLOCK_BITS: 16, + BROTLI_MAX_INPUT_BLOCK_BITS: 24, + BROTLI_PARAM_MODE: 0, + BROTLI_PARAM_QUALITY: 1, + BROTLI_PARAM_LGWIN: 2, + BROTLI_PARAM_LGBLOCK: 3, + BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4, + BROTLI_PARAM_SIZE_HINT: 5, + BROTLI_PARAM_LARGE_WINDOW: 6, + BROTLI_PARAM_NPOSTFIX: 7, + BROTLI_PARAM_NDIRECT: 8, + BROTLI_DECODER_RESULT_ERROR: 0, + BROTLI_DECODER_RESULT_SUCCESS: 1, + BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0, + BROTLI_DECODER_PARAM_LARGE_WINDOW: 1, + BROTLI_DECODER_NO_ERROR: 0, + BROTLI_DECODER_SUCCESS: 1, + BROTLI_DECODER_NEEDS_MORE_INPUT: 2, + BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1, + BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2, + BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4, + BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5, + BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6, + BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7, + BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9, + BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10, + BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11, + BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12, + BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13, + BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14, + BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15, + BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16, + BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19, + BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21, + BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22, + BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26, + BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27, + BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30, + BROTLI_DECODER_ERROR_UNREACHABLE: -31, +}, realZlibConstants)); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/index.js b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/index.js new file mode 100644 index 00000000..a6269b50 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/index.js @@ -0,0 +1,333 @@ +import assert from 'assert'; +import { Buffer } from 'buffer'; +import { Minipass } from 'minipass'; +import realZlib from 'zlib'; +import { constants } from './constants.js'; +export { constants } from './constants.js'; +const OriginalBufferConcat = Buffer.concat; +const _superWrite = Symbol('_superWrite'); +export class ZlibError extends Error { + code; + errno; + constructor(err) { + super('zlib: ' + err.message); + this.code = err.code; + this.errno = err.errno; + /* c8 ignore next */ + if (!this.code) + this.code = 'ZLIB_ERROR'; + this.message = 'zlib: ' + err.message; + Error.captureStackTrace(this, this.constructor); + } + get name() { + return 'ZlibError'; + } +} +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. +const _flushFlag = Symbol('flushFlag'); +class ZlibBase extends Minipass { + #sawError = false; + #ended = false; + #flushFlag; + #finishFlushFlag; + #fullFlushFlag; + #handle; + #onError; + get sawError() { + return this.#sawError; + } + get handle() { + return this.#handle; + } + /* c8 ignore start */ + get flushFlag() { + return this.#flushFlag; + } + /* c8 ignore stop */ + constructor(opts, mode) { + if (!opts || typeof opts !== 'object') + throw new TypeError('invalid options for ZlibBase constructor'); + //@ts-ignore + super(opts); + /* c8 ignore start */ + this.#flushFlag = opts.flush ?? 0; + this.#finishFlushFlag = opts.finishFlush ?? 0; + this.#fullFlushFlag = opts.fullFlushFlag ?? 0; + /* c8 ignore stop */ + // this will throw if any options are invalid for the class selected + try { + // @types/node doesn't know that it exports the classes, but they're there + //@ts-ignore + this.#handle = new realZlib[mode](opts); + } + catch (er) { + // make sure that all errors get decorated properly + throw new ZlibError(er); + } + this.#onError = err => { + // no sense raising multiple errors, since we abort on the first one. + if (this.#sawError) + return; + this.#sawError = true; + // there is no way to cleanly recover. + // continuing only obscures problems. + this.close(); + this.emit('error', err); + }; + this.#handle?.on('error', er => this.#onError(new ZlibError(er))); + this.once('end', () => this.close); + } + close() { + if (this.#handle) { + this.#handle.close(); + this.#handle = undefined; + this.emit('close'); + } + } + reset() { + if (!this.#sawError) { + assert(this.#handle, 'zlib binding closed'); + //@ts-ignore + return this.#handle.reset?.(); + } + } + flush(flushFlag) { + if (this.ended) + return; + if (typeof flushFlag !== 'number') + flushFlag = this.#fullFlushFlag; + this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag })); + } + end(chunk, encoding, cb) { + /* c8 ignore start */ + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + /* c8 ignore stop */ + if (chunk) { + if (encoding) + this.write(chunk, encoding); + else + this.write(chunk); + } + this.flush(this.#finishFlushFlag); + this.#ended = true; + return super.end(cb); + } + get ended() { + return this.#ended; + } + // overridden in the gzip classes to do portable writes + [_superWrite](data) { + return super.write(data); + } + write(chunk, encoding, cb) { + // process the chunk using the sync process + // then super.write() all the outputted chunks + if (typeof encoding === 'function') + (cb = encoding), (encoding = 'utf8'); + if (typeof chunk === 'string') + chunk = Buffer.from(chunk, encoding); + if (this.#sawError) + return; + assert(this.#handle, 'zlib binding closed'); + // _processChunk tries to .close() the native handle after it's done, so we + // intercept that by temporarily making it a no-op. + // diving into the node:zlib internals a bit here + const nativeHandle = this.#handle + ._handle; + const originalNativeClose = nativeHandle.close; + nativeHandle.close = () => { }; + const originalClose = this.#handle.close; + this.#handle.close = () => { }; + // It also calls `Buffer.concat()` at the end, which may be convenient + // for some, but which we are not interested in as it slows us down. + Buffer.concat = args => args; + let result = undefined; + try { + const flushFlag = typeof chunk[_flushFlag] === 'number' + ? chunk[_flushFlag] + : this.#flushFlag; + result = this.#handle._processChunk(chunk, flushFlag); + // if we don't throw, reset it back how it was + Buffer.concat = OriginalBufferConcat; + } + catch (err) { + // or if we do, put Buffer.concat() back before we emit error + // Error events call into user code, which may call Buffer.concat() + Buffer.concat = OriginalBufferConcat; + this.#onError(new ZlibError(err)); + } + finally { + if (this.#handle) { + // Core zlib resets `_handle` to null after attempting to close the + // native handle. Our no-op handler prevented actual closure, but we + // need to restore the `._handle` property. + ; + this.#handle._handle = + nativeHandle; + nativeHandle.close = originalNativeClose; + this.#handle.close = originalClose; + // `_processChunk()` adds an 'error' listener. If we don't remove it + // after each call, these handlers start piling up. + this.#handle.removeAllListeners('error'); + // make sure OUR error listener is still attached tho + } + } + if (this.#handle) + this.#handle.on('error', er => this.#onError(new ZlibError(er))); + let writeReturn; + if (result) { + if (Array.isArray(result) && result.length > 0) { + const r = result[0]; + // The first buffer is always `handle._outBuffer`, which would be + // re-used for later invocations; so, we always have to copy that one. + writeReturn = this[_superWrite](Buffer.from(r)); + for (let i = 1; i < result.length; i++) { + writeReturn = this[_superWrite](result[i]); + } + } + else { + // either a single Buffer or an empty array + writeReturn = this[_superWrite](Buffer.from(result)); + } + } + if (cb) + cb(); + return writeReturn; + } +} +export class Zlib extends ZlibBase { + #level; + #strategy; + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants.Z_NO_FLUSH; + opts.finishFlush = opts.finishFlush || constants.Z_FINISH; + opts.fullFlushFlag = constants.Z_FULL_FLUSH; + super(opts, mode); + this.#level = opts.level; + this.#strategy = opts.strategy; + } + params(level, strategy) { + if (this.sawError) + return; + if (!this.handle) + throw new Error('cannot switch params when binding is closed'); + // no way to test this without also not supporting params at all + /* c8 ignore start */ + if (!this.handle.params) + throw new Error('not supported in this implementation'); + /* c8 ignore stop */ + if (this.#level !== level || this.#strategy !== strategy) { + this.flush(constants.Z_SYNC_FLUSH); + assert(this.handle, 'zlib binding closed'); + // .params() calls .flush(), but the latter is always async in the + // core zlib. We override .flush() temporarily to intercept that and + // flush synchronously. + const origFlush = this.handle.flush; + this.handle.flush = (flushFlag, cb) => { + /* c8 ignore start */ + if (typeof flushFlag === 'function') { + cb = flushFlag; + flushFlag = this.flushFlag; + } + /* c8 ignore stop */ + this.flush(flushFlag); + cb?.(); + }; + try { + ; + this.handle.params(level, strategy); + } + finally { + this.handle.flush = origFlush; + } + /* c8 ignore start */ + if (this.handle) { + this.#level = level; + this.#strategy = strategy; + } + /* c8 ignore stop */ + } + } +} +// minimal 2-byte header +export class Deflate extends Zlib { + constructor(opts) { + super(opts, 'Deflate'); + } +} +export class Inflate extends Zlib { + constructor(opts) { + super(opts, 'Inflate'); + } +} +export class Gzip extends Zlib { + #portable; + constructor(opts) { + super(opts, 'Gzip'); + this.#portable = opts && !!opts.portable; + } + [_superWrite](data) { + if (!this.#portable) + return super[_superWrite](data); + // we'll always get the header emitted in one first chunk + // overwrite the OS indicator byte with 0xFF + this.#portable = false; + data[9] = 255; + return super[_superWrite](data); + } +} +export class Gunzip extends Zlib { + constructor(opts) { + super(opts, 'Gunzip'); + } +} +// raw - no header +export class DeflateRaw extends Zlib { + constructor(opts) { + super(opts, 'DeflateRaw'); + } +} +export class InflateRaw extends Zlib { + constructor(opts) { + super(opts, 'InflateRaw'); + } +} +// auto-detect header. +export class Unzip extends Zlib { + constructor(opts) { + super(opts, 'Unzip'); + } +} +export class Brotli extends ZlibBase { + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS; + opts.finishFlush = + opts.finishFlush || constants.BROTLI_OPERATION_FINISH; + opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH; + super(opts, mode); + } +} +export class BrotliCompress extends Brotli { + constructor(opts) { + super(opts, 'BrotliCompress'); + } +} +export class BrotliDecompress extends Brotli { + constructor(opts) { + super(opts, 'BrotliDecompress'); + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/package.json b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/minizlib/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/minizlib/package.json b/node_modules/npm/node_modules/cacache/node_modules/minizlib/package.json new file mode 100644 index 00000000..e94623ff --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/minizlib/package.json @@ -0,0 +1,81 @@ +{ + "name": "minizlib", + "version": "3.0.1", + "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.", + "main": "./dist/commonjs/index.js", + "dependencies": { + "minipass": "^7.0.4", + "rimraf": "^5.0.5" + }, + "scripts": { + "prepare": "tshy", + "pretest": "npm run prepare", + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/minizlib.git" + }, + "keywords": [ + "zlib", + "gzip", + "gunzip", + "deflate", + "inflate", + "compression", + "zip", + "unzip" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "MIT", + "devDependencies": { + "@types/node": "^20.11.29", + "mkdirp": "^3.0.1", + "tap": "^18.7.1", + "tshy": "^1.12.0", + "typedoc": "^0.25.12" + }, + "files": [ + "dist" + ], + "engines": { + "node": ">= 18" + }, + "tshy": { + "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" + } + } + }, + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + } +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/LICENSE b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/LICENSE new file mode 100644 index 00000000..0a034db7 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2011-2023 James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me) + +This project is free software 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/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/package.json b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/package.json new file mode 100644 index 00000000..9d04a66e --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/package.json @@ -0,0 +1,91 @@ +{ + "name": "mkdirp", + "description": "Recursively mkdir, like `mkdir -p`", + "version": "3.0.1", + "keywords": [ + "mkdir", + "directory", + "make dir", + "make", + "dir", + "recursive", + "native" + ], + "bin": "./dist/cjs/src/bin.js", + "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", + "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" + }, + "devDependencies": { + "@types/brace-expansion": "^1.1.0", + "@types/node": "^18.11.9", + "@types/tap": "^15.0.7", + "c8": "^7.12.0", + "eslint-config-prettier": "^8.6.0", + "prettier": "^2.8.2", + "tap": "^16.3.3", + "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" + }, + "repository": { + "type": "git", + "url": "https://github.com/isaacs/node-mkdirp.git" + }, + "license": "MIT", + "engines": { + "node": ">=10" + } +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.d.ts new file mode 100644 index 00000000..34e00522 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.d.ts @@ -0,0 +1,3 @@ +#!/usr/bin/env node +export {}; +//# sourceMappingURL=bin.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.d.ts.map new file mode 100644 index 00000000..c10c656e --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../src/bin.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.js new file mode 100755 index 00000000..757aae1f --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.js @@ -0,0 +1,80 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const package_json_1 = require("../package.json"); +const usage = () => ` +usage: mkdirp [DIR1,DIR2..] {OPTIONS} + + Create each supplied directory including any necessary parent directories + that don't yet exist. + + If the directory already exists, do nothing. + +OPTIONS are: + + -m If a directory needs to be created, set the mode as an octal + --mode= permission string. + + -v --version Print the mkdirp version number + + -h --help Print this helpful banner + + -p --print Print the first directories created for each path provided + + --manual Use manual implementation, even if native is available +`; +const dirs = []; +const opts = {}; +let doPrint = false; +let dashdash = false; +let manual = false; +for (const arg of process.argv.slice(2)) { + if (dashdash) + dirs.push(arg); + else if (arg === '--') + dashdash = true; + else if (arg === '--manual') + manual = true; + else if (/^-h/.test(arg) || /^--help/.test(arg)) { + console.log(usage()); + process.exit(0); + } + else if (arg === '-v' || arg === '--version') { + console.log(package_json_1.version); + process.exit(0); + } + else if (arg === '-p' || arg === '--print') { + doPrint = true; + } + else if (/^-m/.test(arg) || /^--mode=/.test(arg)) { + // these don't get covered in CI, but work locally + // weird because the tests below show as passing in the output. + /* c8 ignore start */ + const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8); + if (isNaN(mode)) { + console.error(`invalid mode argument: ${arg}\nMust be an octal number.`); + process.exit(1); + } + /* c8 ignore stop */ + opts.mode = mode; + } + else + dirs.push(arg); +} +const index_js_1 = require("./index.js"); +const impl = manual ? index_js_1.mkdirp.manual : index_js_1.mkdirp; +if (dirs.length === 0) { + console.error(usage()); +} +// these don't get covered in CI, but work locally +/* c8 ignore start */ +Promise.all(dirs.map(dir => impl(dir, opts))) + .then(made => (doPrint ? made.forEach(m => m && console.log(m)) : null)) + .catch(er => { + console.error(er.message); + if (er.code) + console.error(' code: ' + er.code); + process.exit(1); +}); +/* c8 ignore stop */ +//# sourceMappingURL=bin.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.js.map new file mode 100644 index 00000000..d9929530 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/bin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../../src/bin.ts"],"names":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from '../package.json'\nimport { MkdirpOptions } from './opts-arg.js'\n\nconst usage = () => `\nusage: mkdirp [DIR1,DIR2..] {OPTIONS}\n\n Create each supplied directory including any necessary parent directories\n that don't yet exist.\n\n If the directory already exists, do nothing.\n\nOPTIONS are:\n\n -m If a directory needs to be created, set the mode as an octal\n --mode= permission string.\n\n -v --version Print the mkdirp version number\n\n -h --help Print this helpful banner\n\n -p --print Print the first directories created for each path provided\n\n --manual Use manual implementation, even if native is available\n`\n\nconst dirs: string[] = []\nconst opts: MkdirpOptions = {}\nlet doPrint: boolean = false\nlet dashdash = false\nlet manual = false\nfor (const arg of process.argv.slice(2)) {\n if (dashdash) dirs.push(arg)\n else if (arg === '--') dashdash = true\n else if (arg === '--manual') manual = true\n else if (/^-h/.test(arg) || /^--help/.test(arg)) {\n console.log(usage())\n process.exit(0)\n } else if (arg === '-v' || arg === '--version') {\n console.log(version)\n process.exit(0)\n } else if (arg === '-p' || arg === '--print') {\n doPrint = true\n } else if (/^-m/.test(arg) || /^--mode=/.test(arg)) {\n // these don't get covered in CI, but work locally\n // weird because the tests below show as passing in the output.\n /* c8 ignore start */\n const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8)\n if (isNaN(mode)) {\n console.error(`invalid mode argument: ${arg}\\nMust be an octal number.`)\n process.exit(1)\n }\n /* c8 ignore stop */\n opts.mode = mode\n } else dirs.push(arg)\n}\n\nimport { mkdirp } from './index.js'\nconst impl = manual ? mkdirp.manual : mkdirp\nif (dirs.length === 0) {\n console.error(usage())\n}\n\n// these don't get covered in CI, but work locally\n/* c8 ignore start */\nPromise.all(dirs.map(dir => impl(dir, opts)))\n .then(made => (doPrint ? made.forEach(m => m && console.log(m)) : null))\n .catch(er => {\n console.error(er.message)\n if (er.code) console.error(' code: ' + er.code)\n process.exit(1)\n })\n/* c8 ignore stop */\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.d.ts new file mode 100644 index 00000000..e47794b3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.d.ts @@ -0,0 +1,4 @@ +import { MkdirpOptionsResolved } from './opts-arg.js'; +export declare const findMade: (opts: MkdirpOptionsResolved, parent: string, path?: string) => Promise; +export declare const findMadeSync: (opts: MkdirpOptionsResolved, parent: string, path?: string) => undefined | string; +//# sourceMappingURL=find-made.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.d.ts.map new file mode 100644 index 00000000..00d5d1a4 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"find-made.d.ts","sourceRoot":"","sources":["../../../src/find-made.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAErD,eAAO,MAAM,QAAQ,SACb,qBAAqB,UACnB,MAAM,SACP,MAAM,KACZ,QAAQ,SAAS,GAAG,MAAM,CAe5B,CAAA;AAED,eAAO,MAAM,YAAY,SACjB,qBAAqB,UACnB,MAAM,SACP,MAAM,KACZ,SAAS,GAAG,MAad,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.js new file mode 100644 index 00000000..e831ef27 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.findMadeSync = exports.findMade = void 0; +const path_1 = require("path"); +const findMade = async (opts, parent, path) => { + // we never want the 'made' return value to be a root directory + if (path === parent) { + return; + } + return opts.statAsync(parent).then(st => (st.isDirectory() ? path : undefined), // will fail later + // will fail later + er => { + const fer = er; + return fer && fer.code === 'ENOENT' + ? (0, exports.findMade)(opts, (0, path_1.dirname)(parent), parent) + : undefined; + }); +}; +exports.findMade = findMade; +const findMadeSync = (opts, parent, path) => { + if (path === parent) { + return undefined; + } + try { + return opts.statSync(parent).isDirectory() ? path : undefined; + } + catch (er) { + const fer = er; + return fer && fer.code === 'ENOENT' + ? (0, exports.findMadeSync)(opts, (0, path_1.dirname)(parent), parent) + : undefined; + } +}; +exports.findMadeSync = findMadeSync; +//# sourceMappingURL=find-made.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.js.map new file mode 100644 index 00000000..30a0d663 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/find-made.js.map @@ -0,0 +1 @@ +{"version":3,"file":"find-made.js","sourceRoot":"","sources":["../../../src/find-made.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAGvB,MAAM,QAAQ,GAAG,KAAK,EAC3B,IAA2B,EAC3B,MAAc,EACd,IAAa,EACgB,EAAE;IAC/B,+DAA+D;IAC/D,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,OAAM;KACP;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAChC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,kBAAkB;IAC/D,AAD6C,kBAAkB;IAC/D,EAAE,CAAC,EAAE;QACH,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;YACjC,CAAC,CAAC,IAAA,gBAAQ,EAAC,IAAI,EAAE,IAAA,cAAO,EAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YACzC,CAAC,CAAC,SAAS,CAAA;IACf,CAAC,CACF,CAAA;AACH,CAAC,CAAA;AAnBY,QAAA,QAAQ,YAmBpB;AAEM,MAAM,YAAY,GAAG,CAC1B,IAA2B,EAC3B,MAAc,EACd,IAAa,EACO,EAAE;IACtB,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,OAAO,SAAS,CAAA;KACjB;IAED,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;KAC9D;IAAC,OAAO,EAAE,EAAE;QACX,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;YACjC,CAAC,CAAC,IAAA,oBAAY,EAAC,IAAI,EAAE,IAAA,cAAO,EAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAC7C,CAAC,CAAC,SAAS,CAAA;KACd;AACH,CAAC,CAAA;AAjBY,QAAA,YAAY,gBAiBxB","sourcesContent":["import { dirname } from 'path'\nimport { MkdirpOptionsResolved } from './opts-arg.js'\n\nexport const findMade = async (\n opts: MkdirpOptionsResolved,\n parent: string,\n path?: string\n): Promise => {\n // we never want the 'made' return value to be a root directory\n if (path === parent) {\n return\n }\n\n return opts.statAsync(parent).then(\n st => (st.isDirectory() ? path : undefined), // will fail later\n er => {\n const fer = er as NodeJS.ErrnoException\n return fer && fer.code === 'ENOENT'\n ? findMade(opts, dirname(parent), parent)\n : undefined\n }\n )\n}\n\nexport const findMadeSync = (\n opts: MkdirpOptionsResolved,\n parent: string,\n path?: string\n): undefined | string => {\n if (path === parent) {\n return undefined\n }\n\n try {\n return opts.statSync(parent).isDirectory() ? path : undefined\n } catch (er) {\n const fer = er as NodeJS.ErrnoException\n return fer && fer.code === 'ENOENT'\n ? findMadeSync(opts, dirname(parent), parent)\n : undefined\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.d.ts new file mode 100644 index 00000000..fc9e43b3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.d.ts @@ -0,0 +1,39 @@ +import { MkdirpOptions } from './opts-arg.js'; +export { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'; +export { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'; +export { useNative, useNativeSync } from './use-native.js'; +export declare const mkdirpSync: (path: string, opts?: MkdirpOptions) => string | void; +export declare const sync: (path: string, opts?: MkdirpOptions) => string | void; +export declare const manual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; +}; +export declare const manualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; +export declare const native: ((path: string, options?: MkdirpOptions | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; +}; +export declare const nativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; +export declare const mkdirp: ((path: string, opts?: MkdirpOptions) => Promise) & { + mkdirpSync: (path: string, opts?: MkdirpOptions) => string | void; + mkdirpNative: ((path: string, options?: MkdirpOptions | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; + }; + mkdirpNativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; + mkdirpManual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; + }; + mkdirpManualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; + sync: (path: string, opts?: MkdirpOptions) => string | void; + native: ((path: string, options?: MkdirpOptions | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; + }; + nativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; + manual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; + }; + manualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; + useNative: ((opts?: MkdirpOptions | undefined) => boolean) & { + sync: (opts?: MkdirpOptions | undefined) => boolean; + }; + useNativeSync: (opts?: MkdirpOptions | undefined) => boolean; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.d.ts.map new file mode 100644 index 00000000..0e915bbc --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAItD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG1D,eAAO,MAAM,UAAU,SAAU,MAAM,SAAS,aAAa,kBAM5D,CAAA;AAED,eAAO,MAAM,IAAI,SARgB,MAAM,SAAS,aAAa,kBAQ/B,CAAA;AAC9B,eAAO,MAAM,MAAM;;CAAe,CAAA;AAClC,eAAO,MAAM,UAAU,oHAAmB,CAAA;AAC1C,eAAO,MAAM,MAAM;;CAAe,CAAA;AAClC,eAAO,MAAM,UAAU,kFAAmB,CAAA;AAC1C,eAAO,MAAM,MAAM,UACJ,MAAM,SAAS,aAAa;uBAdV,MAAM,SAAS,aAAa;;;;;;;;;iBAA5B,MAAM,SAAS,aAAa;;;;;;;;;;;;;CAoC5D,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.js new file mode 100644 index 00000000..ab9dc62c --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mkdirp = exports.nativeSync = exports.native = exports.manualSync = exports.manual = exports.sync = exports.mkdirpSync = exports.useNativeSync = exports.useNative = exports.mkdirpNativeSync = exports.mkdirpNative = exports.mkdirpManualSync = exports.mkdirpManual = void 0; +const mkdirp_manual_js_1 = require("./mkdirp-manual.js"); +const mkdirp_native_js_1 = require("./mkdirp-native.js"); +const opts_arg_js_1 = require("./opts-arg.js"); +const path_arg_js_1 = require("./path-arg.js"); +const use_native_js_1 = require("./use-native.js"); +/* c8 ignore start */ +var mkdirp_manual_js_2 = require("./mkdirp-manual.js"); +Object.defineProperty(exports, "mkdirpManual", { enumerable: true, get: function () { return mkdirp_manual_js_2.mkdirpManual; } }); +Object.defineProperty(exports, "mkdirpManualSync", { enumerable: true, get: function () { return mkdirp_manual_js_2.mkdirpManualSync; } }); +var mkdirp_native_js_2 = require("./mkdirp-native.js"); +Object.defineProperty(exports, "mkdirpNative", { enumerable: true, get: function () { return mkdirp_native_js_2.mkdirpNative; } }); +Object.defineProperty(exports, "mkdirpNativeSync", { enumerable: true, get: function () { return mkdirp_native_js_2.mkdirpNativeSync; } }); +var use_native_js_2 = require("./use-native.js"); +Object.defineProperty(exports, "useNative", { enumerable: true, get: function () { return use_native_js_2.useNative; } }); +Object.defineProperty(exports, "useNativeSync", { enumerable: true, get: function () { return use_native_js_2.useNativeSync; } }); +/* c8 ignore stop */ +const mkdirpSync = (path, opts) => { + path = (0, path_arg_js_1.pathArg)(path); + const resolved = (0, opts_arg_js_1.optsArg)(opts); + return (0, use_native_js_1.useNativeSync)(resolved) + ? (0, mkdirp_native_js_1.mkdirpNativeSync)(path, resolved) + : (0, mkdirp_manual_js_1.mkdirpManualSync)(path, resolved); +}; +exports.mkdirpSync = mkdirpSync; +exports.sync = exports.mkdirpSync; +exports.manual = mkdirp_manual_js_1.mkdirpManual; +exports.manualSync = mkdirp_manual_js_1.mkdirpManualSync; +exports.native = mkdirp_native_js_1.mkdirpNative; +exports.nativeSync = mkdirp_native_js_1.mkdirpNativeSync; +exports.mkdirp = Object.assign(async (path, opts) => { + path = (0, path_arg_js_1.pathArg)(path); + const resolved = (0, opts_arg_js_1.optsArg)(opts); + return (0, use_native_js_1.useNative)(resolved) + ? (0, mkdirp_native_js_1.mkdirpNative)(path, resolved) + : (0, mkdirp_manual_js_1.mkdirpManual)(path, resolved); +}, { + mkdirpSync: exports.mkdirpSync, + mkdirpNative: mkdirp_native_js_1.mkdirpNative, + mkdirpNativeSync: mkdirp_native_js_1.mkdirpNativeSync, + mkdirpManual: mkdirp_manual_js_1.mkdirpManual, + mkdirpManualSync: mkdirp_manual_js_1.mkdirpManualSync, + sync: exports.mkdirpSync, + native: mkdirp_native_js_1.mkdirpNative, + nativeSync: mkdirp_native_js_1.mkdirpNativeSync, + manual: mkdirp_manual_js_1.mkdirpManual, + manualSync: mkdirp_manual_js_1.mkdirpManualSync, + useNative: use_native_js_1.useNative, + useNativeSync: use_native_js_1.useNativeSync, +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/index.js.map new file mode 100644 index 00000000..fdb57267 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/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,IAAA,yBAAS,EAAC,QAAQ,CAAC;QACxB,CAAC,CAAC,IAAA,+BAAY,EAAC,IAAI,EAAE,QAAQ,CAAC;QAC9B,CAAC,CAAC,IAAA,+BAAY,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAClC,CAAC,EACD;IACE,UAAU,EAAV,kBAAU;IACV,YAAY,EAAZ,+BAAY;IACZ,gBAAgB,EAAhB,mCAAgB;IAChB,YAAY,EAAZ,+BAAY;IACZ,gBAAgB,EAAhB,mCAAgB;IAEhB,IAAI,EAAE,kBAAU;IAChB,MAAM,EAAE,+BAAY;IACpB,UAAU,EAAE,mCAAgB;IAC5B,MAAM,EAAE,+BAAY;IACpB,UAAU,EAAE,mCAAgB;IAC5B,SAAS,EAAT,yBAAS;IACT,aAAa,EAAb,6BAAa;CACd,CACF,CAAA","sourcesContent":["import { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nimport { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\nimport { pathArg } from './path-arg.js'\nimport { useNative, useNativeSync } from './use-native.js'\n/* c8 ignore start */\nexport { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nexport { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'\nexport { useNative, useNativeSync } from './use-native.js'\n/* c8 ignore stop */\n\nexport const mkdirpSync = (path: string, opts?: MkdirpOptions) => {\n path = pathArg(path)\n const resolved = optsArg(opts)\n return useNativeSync(resolved)\n ? mkdirpNativeSync(path, resolved)\n : mkdirpManualSync(path, resolved)\n}\n\nexport const sync = mkdirpSync\nexport const manual = mkdirpManual\nexport const manualSync = mkdirpManualSync\nexport const native = mkdirpNative\nexport const nativeSync = mkdirpNativeSync\nexport const mkdirp = Object.assign(\n async (path: string, opts?: MkdirpOptions) => {\n path = pathArg(path)\n const resolved = optsArg(opts)\n return useNative(resolved)\n ? mkdirpNative(path, resolved)\n : mkdirpManual(path, resolved)\n },\n {\n mkdirpSync,\n mkdirpNative,\n mkdirpNativeSync,\n mkdirpManual,\n mkdirpManualSync,\n\n sync: mkdirpSync,\n native: mkdirpNative,\n nativeSync: mkdirpNativeSync,\n manual: mkdirpManual,\n manualSync: mkdirpManualSync,\n useNative,\n useNativeSync,\n }\n)\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts new file mode 100644 index 00000000..e49cdf9f --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts @@ -0,0 +1,6 @@ +import { MkdirpOptions } from './opts-arg.js'; +export declare const mkdirpManualSync: (path: string, options?: MkdirpOptions, made?: string | undefined | void) => string | undefined | void; +export declare const mkdirpManual: ((path: string, options?: MkdirpOptions, made?: string | undefined | void) => Promise) & { + sync: (path: string, options?: MkdirpOptions, made?: string | undefined | void) => string | undefined | void; +}; +//# sourceMappingURL=mkdirp-manual.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts.map new file mode 100644 index 00000000..9301bab1 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdirp-manual.d.ts","sourceRoot":"","sources":["../../../src/mkdirp-manual.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,gBAAgB,SACrB,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,MAAM,GAAG,SAAS,GAAG,IAmCvB,CAAA;AAED,eAAO,MAAM,YAAY,UAEf,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;iBA7C/B,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,MAAM,GAAG,SAAS,GAAG,IAAI;CAqF3B,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js new file mode 100644 index 00000000..d9bd1d8b --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js @@ -0,0 +1,79 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mkdirpManual = exports.mkdirpManualSync = void 0; +const path_1 = require("path"); +const opts_arg_js_1 = require("./opts-arg.js"); +const mkdirpManualSync = (path, options, made) => { + const parent = (0, path_1.dirname)(path); + const opts = { ...(0, opts_arg_js_1.optsArg)(options), recursive: false }; + if (parent === path) { + try { + return opts.mkdirSync(path, opts); + } + catch (er) { + // swallowed by recursive implementation on posix systems + // any other error is a failure + const fer = er; + if (fer && fer.code !== 'EISDIR') { + throw er; + } + return; + } + } + try { + opts.mkdirSync(path, opts); + return made || path; + } + catch (er) { + const fer = er; + if (fer && fer.code === 'ENOENT') { + return (0, exports.mkdirpManualSync)(path, opts, (0, exports.mkdirpManualSync)(parent, opts, made)); + } + if (fer && fer.code !== 'EEXIST' && fer && fer.code !== 'EROFS') { + throw er; + } + try { + if (!opts.statSync(path).isDirectory()) + throw er; + } + catch (_) { + throw er; + } + } +}; +exports.mkdirpManualSync = mkdirpManualSync; +exports.mkdirpManual = Object.assign(async (path, options, made) => { + const opts = (0, opts_arg_js_1.optsArg)(options); + opts.recursive = false; + const parent = (0, path_1.dirname)(path); + if (parent === path) { + return opts.mkdirAsync(path, opts).catch(er => { + // swallowed by recursive implementation on posix systems + // any other error is a failure + const fer = er; + if (fer && fer.code !== 'EISDIR') { + throw er; + } + }); + } + return opts.mkdirAsync(path, opts).then(() => made || path, async (er) => { + const fer = er; + if (fer && fer.code === 'ENOENT') { + return (0, exports.mkdirpManual)(parent, opts).then((made) => (0, exports.mkdirpManual)(path, opts, made)); + } + if (fer && fer.code !== 'EEXIST' && fer.code !== 'EROFS') { + throw er; + } + return opts.statAsync(path).then(st => { + if (st.isDirectory()) { + return made; + } + else { + throw er; + } + }, () => { + throw er; + }); + }); +}, { sync: exports.mkdirpManualSync }); +//# sourceMappingURL=mkdirp-manual.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js.map new file mode 100644 index 00000000..ff7ba24d --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdirp-manual.js","sourceRoot":"","sources":["../../../src/mkdirp-manual.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAC9B,+CAAsD;AAE/C,MAAM,gBAAgB,GAAG,CAC9B,IAAY,EACZ,OAAuB,EACvB,IAAgC,EACL,EAAE;IAC7B,MAAM,MAAM,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,CAAA;IAC5B,MAAM,IAAI,GAAG,EAAE,GAAG,IAAA,qBAAO,EAAC,OAAO,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;IAEtD,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,IAAI;YACF,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SAClC;QAAC,OAAO,EAAE,EAAE;YACX,yDAAyD;YACzD,+BAA+B;YAC/B,MAAM,GAAG,GAAG,EAA2B,CAAA;YACvC,IAAI,GAAG,IAAI,G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,+BAA+B;YAC/B,MAAM,GAAG,GAAG,EAA2B,CAAA;YACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAChC,MAAM,EAAE,CAAA;aACT;QACH,CAAC,CAAC,CAAA;KACH;IAED,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CACrC,GAAG,EAAE,CAAC,IAAI,IAAI,IAAI,EAClB,KAAK,EAAC,EAAE,EAAC,EAAE;QACT,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;YAChC,OAAO,IAAA,oBAAY,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,CACpC,CAAC,IAAgC,EAAE,EAAE,CAAC,IAAA,oBAAY,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CACrE,CAAA;SACF;QACD,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE;YACxD,MAAM,EAAE,CAAA;SACT;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAC9B,EAAE,CAAC,EAAE;YACH,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;gBACpB,OAAO,IAAI,CAAA;aACZ;iBAAM;gBACL,MAAM,EAAE,CAAA;aACT;QACH,CAAC,EACD,GAAG,EAAE;YACH,MAAM,EAAE,CAAA;QACV,CAAC,CACF,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC,EACD,EAAE,IAAI,EAAE,wBAAgB,EAAE,CAC3B,CAAA","sourcesContent":["import { dirname } from 'path'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nexport const mkdirpManualSync = (\n path: string,\n options?: MkdirpOptions,\n made?: string | undefined | void\n): string | undefined | void => {\n const parent = dirname(path)\n const opts = { ...optsArg(options), recursive: false }\n\n if (parent === path) {\n try {\n return opts.mkdirSync(path, opts)\n } catch (er) {\n // swallowed by recursive implementation on posix systems\n // any other error is a failure\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code !== 'EISDIR') {\n throw er\n }\n return\n }\n }\n\n try {\n opts.mkdirSync(path, opts)\n return made || path\n } catch (er) {\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code === 'ENOENT') {\n return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))\n }\n if (fer && fer.code !== 'EEXIST' && fer && fer.code !== 'EROFS') {\n throw er\n }\n try {\n if (!opts.statSync(path).isDirectory()) throw er\n } catch (_) {\n throw er\n }\n }\n}\n\nexport const mkdirpManual = Object.assign(\n async (\n path: string,\n options?: MkdirpOptions,\n made?: string | undefined | void\n ): Promise => {\n const opts = optsArg(options)\n opts.recursive = false\n const parent = dirname(path)\n if (parent === path) {\n return opts.mkdirAsync(path, opts).catch(er => {\n // swallowed by recursive implementation on posix systems\n // any other error is a failure\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code !== 'EISDIR') {\n throw er\n }\n })\n }\n\n return opts.mkdirAsync(path, opts).then(\n () => made || path,\n async er => {\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code === 'ENOENT') {\n return mkdirpManual(parent, opts).then(\n (made?: string | undefined | void) => mkdirpManual(path, opts, made)\n )\n }\n if (fer && fer.code !== 'EEXIST' && fer.code !== 'EROFS') {\n throw er\n }\n return opts.statAsync(path).then(\n st => {\n if (st.isDirectory()) {\n return made\n } else {\n throw er\n }\n },\n () => {\n throw er\n }\n )\n }\n )\n },\n { sync: mkdirpManualSync }\n)\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts new file mode 100644 index 00000000..28b64814 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts @@ -0,0 +1,6 @@ +import { MkdirpOptions } from './opts-arg.js'; +export declare const mkdirpNativeSync: (path: string, options?: MkdirpOptions) => string | void | undefined; +export declare const mkdirpNative: ((path: string, options?: MkdirpOptions) => Promise) & { + sync: (path: string, options?: MkdirpOptions) => string | void | undefined; +}; +//# sourceMappingURL=mkdirp-native.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts.map new file mode 100644 index 00000000..379c0f65 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdirp-native.d.ts","sourceRoot":"","sources":["../../../src/mkdirp-native.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,gBAAgB,SACrB,MAAM,YACF,aAAa,KACtB,MAAM,GAAG,IAAI,GAAG,SAoBlB,CAAA;AAED,eAAO,MAAM,YAAY,UAEf,MAAM,YACF,aAAa,KACtB,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;iBA5B/B,MAAM,YACF,aAAa,KACtB,MAAM,GAAG,IAAI,GAAG,SAAS;CAgD3B,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js new file mode 100644 index 00000000..9f00567d --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mkdirpNative = exports.mkdirpNativeSync = void 0; +const path_1 = require("path"); +const find_made_js_1 = require("./find-made.js"); +const mkdirp_manual_js_1 = require("./mkdirp-manual.js"); +const opts_arg_js_1 = require("./opts-arg.js"); +const mkdirpNativeSync = (path, options) => { + const opts = (0, opts_arg_js_1.optsArg)(options); + opts.recursive = true; + const parent = (0, path_1.dirname)(path); + if (parent === path) { + return opts.mkdirSync(path, opts); + } + const made = (0, find_made_js_1.findMadeSync)(opts, path); + try { + opts.mkdirSync(path, opts); + return made; + } + catch (er) { + const fer = er; + if (fer && fer.code === 'ENOENT') { + return (0, mkdirp_manual_js_1.mkdirpManualSync)(path, opts); + } + else { + throw er; + } + } +}; +exports.mkdirpNativeSync = mkdirpNativeSync; +exports.mkdirpNative = Object.assign(async (path, options) => { + const opts = { ...(0, opts_arg_js_1.optsArg)(options), recursive: true }; + const parent = (0, path_1.dirname)(path); + if (parent === path) { + return await opts.mkdirAsync(path, opts); + } + return (0, find_made_js_1.findMade)(opts, path).then((made) => opts + .mkdirAsync(path, opts) + .then(m => made || m) + .catch(er => { + const fer = er; + if (fer && fer.code === 'ENOENT') { + return (0, mkdirp_manual_js_1.mkdirpManual)(path, opts); + } + else { + throw er; + } + })); +}, { sync: exports.mkdirpNativeSync }); +//# sourceMappingURL=mkdirp-native.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js.map new file mode 100644 index 00000000..1f889ee9 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdirp-native.js","sourceRoot":"","sources":["../../../src/mkdirp-native.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAC9B,iDAAuD;AACvD,yDAAmE;AACnE,+CAAsD;AAE/C,MAAM,gBAAgB,GAAG,CAC9B,IAAY,EACZ,OAAuB,EACI,EAAE;IAC7B,MAAM,IAAI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tB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC;SACpB,KAAK,CAAC,EAAE,CAAC,EAAE;QACV,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;YAChC,OAAO,IAAA,+BAAY,EAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SAChC;aAAM;YACL,MAAM,EAAE,CAAA;SACT;IACH,CAAC,CAAC,CACL,CAAA;AACH,CAAC,EACD,EAAE,IAAI,EAAE,wBAAgB,EAAE,CAC3B,CAAA","sourcesContent":["import { dirname } from 'path'\nimport { findMade, findMadeSync } from './find-made.js'\nimport { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nexport const mkdirpNativeSync = (\n path: string,\n options?: MkdirpOptions\n): string | void | undefined => {\n const opts = optsArg(options)\n opts.recursive = true\n const parent = dirname(path)\n if (parent === path) {\n return opts.mkdirSync(path, opts)\n }\n\n const made = findMadeSync(opts, path)\n try {\n opts.mkdirSync(path, opts)\n return made\n } catch (er) {\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code === 'ENOENT') {\n return mkdirpManualSync(path, opts)\n } else {\n throw er\n }\n }\n}\n\nexport const mkdirpNative = Object.assign(\n async (\n path: string,\n options?: MkdirpOptions\n ): Promise => {\n const opts = { ...optsArg(options), recursive: true }\n const parent = dirname(path)\n if (parent === path) {\n return await opts.mkdirAsync(path, opts)\n }\n\n return findMade(opts, path).then((made?: string | undefined) =>\n opts\n .mkdirAsync(path, opts)\n .then(m => made || m)\n .catch(er => {\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code === 'ENOENT') {\n return mkdirpManual(path, opts)\n } else {\n throw er\n }\n })\n )\n },\n { sync: mkdirpNativeSync }\n)\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts new file mode 100644 index 00000000..73d076b3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts @@ -0,0 +1,42 @@ +/// +/// +import { MakeDirectoryOptions, Stats } from 'fs'; +export interface FsProvider { + stat?: (path: string, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any) => any; + mkdir?: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }, callback: (err: NodeJS.ErrnoException | null, made?: string) => any) => any; + statSync?: (path: string) => Stats; + mkdirSync?: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }) => string | undefined; +} +interface Options extends FsProvider { + mode?: number | string; + fs?: FsProvider; + mkdirAsync?: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }) => Promise; + statAsync?: (path: string) => Promise; +} +export type MkdirpOptions = Options | number | string; +export interface MkdirpOptionsResolved { + mode: number; + fs: FsProvider; + mkdirAsync: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }) => Promise; + statAsync: (path: string) => Promise; + stat: (path: string, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any) => any; + mkdir: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }, callback: (err: NodeJS.ErrnoException | null, made?: string) => any) => any; + statSync: (path: string) => Stats; + mkdirSync: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }) => string | undefined; + recursive?: boolean; +} +export declare const optsArg: (opts?: MkdirpOptions) => MkdirpOptionsResolved; +export {}; +//# sourceMappingURL=opts-arg.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts.map new file mode 100644 index 00000000..e5751617 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdir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,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;AAErD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,UAAU,CAAA;IACd,UAAU,EAAE,CACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KACjD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAChC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,CAAA;IAC3C,IAAI,EAAE,CACJ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,GAAG,KAC/D,GAAG,CAAA;IACR,KAAK,EAAE,CACL,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,EACpD,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,KAChE,GAAG,CAAA;IACR,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAA;IACjC,SAAS,EAAE,CACT,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KACjD,MAAM,GAAG,SAAS,CAAA;IACvB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,OAAO,UAAW,aAAa,KAAG,qBA2C9C,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.js new file mode 100644 index 00000000..e8f486c0 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.optsArg = void 0; +const fs_1 = require("fs"); +const optsArg = (opts) => { + if (!opts) { + opts = { mode: 0o777 }; + } + else if (typeof opts === 'object') { + opts = { mode: 0o777, ...opts }; + } + else if (typeof opts === 'number') { + opts = { mode: opts }; + } + else if (typeof opts === 'string') { + opts = { mode: parseInt(opts, 8) }; + } + else { + throw new TypeError('invalid options argument'); + } + const resolved = opts; + const optsFs = opts.fs || {}; + opts.mkdir = opts.mkdir || optsFs.mkdir || fs_1.mkdir; + opts.mkdirAsync = opts.mkdirAsync + ? opts.mkdirAsync + : async (path, options) => { + return new Promise((res, rej) => resolved.mkdir(path, options, (er, made) => er ? rej(er) : res(made))); + }; + opts.stat = opts.stat || optsFs.stat || fs_1.stat; + opts.statAsync = opts.statAsync + ? opts.statAsync + : async (path) => new Promise((res, rej) => resolved.stat(path, (err, stats) => (err ? rej(err) : res(stats)))); + opts.statSync = opts.statSync || optsFs.statSync || fs_1.statSync; + opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || fs_1.mkdirSync; + return resolved; +}; +exports.optsArg = optsArg; +//# sourceMappingURL=opts-arg.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.js.map new file mode 100644 index 00000000..fd5590f4 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/opts-arg.js.map @@ -0,0 +1 @@ +{"version":3,"file":"opts-arg.js","sourceRoot":"","sources":["../../../src/opts-arg.ts"],"names":[],"mappings":";;;AAAA,2BAOW;AAwDJ,MAAM,OAAO,GAAG,CAAC,IAAoB,EAAyB,EAAE;IACrE,IAAI,CAAC,I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S,GAAG,IAAI,CAAC,SAAS;QAC7B,CAAC,CAAC,IAAI,CAAC,SAAS;QAChB,CAAC,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE,CACrB,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CACvB,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CACnE,CAAA;IAEP,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,aAAQ,CAAA;IAC5D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,IAAI,cAAS,CAAA;IAEhE,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AA3CY,QAAA,OAAO,WA2CnB","sourcesContent":["import {\n MakeDirectoryOptions,\n mkdir,\n mkdirSync,\n stat,\n Stats,\n statSync,\n} from 'fs'\n\nexport interface FsProvider {\n stat?: (\n path: string,\n callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any\n ) => any\n mkdir?: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean },\n callback: (err: NodeJS.ErrnoException | null, made?: string) => any\n ) => any\n statSync?: (path: string) => Stats\n mkdirSync?: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean }\n ) => string | undefined\n}\n\ninterface Options extends FsProvider {\n mode?: number | string\n fs?: FsProvider\n mkdirAsync?: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean }\n ) => Promise\n statAsync?: (path: string) => Promise\n}\n\nexport type MkdirpOptions = Options | number | string\n\nexport interface MkdirpOptionsResolved {\n mode: number\n fs: FsProvider\n mkdirAsync: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean }\n ) => Promise\n statAsync: (path: string) => Promise\n stat: (\n path: string,\n callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any\n ) => any\n mkdir: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean },\n callback: (err: NodeJS.ErrnoException | null, made?: string) => any\n ) => any\n statSync: (path: string) => Stats\n mkdirSync: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean }\n ) => string | undefined\n recursive?: boolean\n}\n\nexport const optsArg = (opts?: MkdirpOptions): MkdirpOptionsResolved => {\n if (!opts) {\n opts = { mode: 0o777 }\n } else if (typeof opts === 'object') {\n opts = { mode: 0o777, ...opts }\n } else if (typeof opts === 'number') {\n opts = { mode: opts }\n } else if (typeof opts === 'string') {\n opts = { mode: parseInt(opts, 8) }\n } else {\n throw new TypeError('invalid options argument')\n }\n\n const resolved = opts as MkdirpOptionsResolved\n const optsFs = opts.fs || {}\n\n opts.mkdir = opts.mkdir || optsFs.mkdir || mkdir\n\n opts.mkdirAsync = opts.mkdirAsync\n ? opts.mkdirAsync\n : async (\n path: string,\n options: MakeDirectoryOptions & { recursive?: boolean }\n ): Promise => {\n return new Promise((res, rej) =>\n resolved.mkdir(path, options, (er, made) =>\n er ? rej(er) : res(made)\n )\n )\n }\n\n opts.stat = opts.stat || optsFs.stat || stat\n opts.statAsync = opts.statAsync\n ? opts.statAsync\n : async (path: string) =>\n new Promise((res, rej) =>\n resolved.stat(path, (err, stats) => (err ? rej(err) : res(stats)))\n )\n\n opts.statSync = opts.statSync || optsFs.statSync || statSync\n opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || mkdirSync\n\n return resolved\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts new file mode 100644 index 00000000..ad0ccfc4 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts @@ -0,0 +1,2 @@ +export declare const pathArg: (path: string) => string; +//# sourceMappingURL=path-arg.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts.map new file mode 100644 index 00000000..3b52b077 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"path-arg.d.ts","sourceRoot":"","sources":["../../../src/path-arg.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,SAAU,MAAM,WAyBnC,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.js new file mode 100644 index 00000000..a6b457f6 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pathArg = void 0; +const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform; +const path_1 = require("path"); +const pathArg = (path) => { + if (/\0/.test(path)) { + // simulate same failure that node raises + throw Object.assign(new TypeError('path must be a string without null bytes'), { + path, + code: 'ERR_INVALID_ARG_VALUE', + }); + } + path = (0, path_1.resolve)(path); + if (platform === 'win32') { + const badWinChars = /[*|"<>?:]/; + const { root } = (0, path_1.parse)(path); + if (badWinChars.test(path.substring(root.length))) { + throw Object.assign(new Error('Illegal characters in path.'), { + path, + code: 'EINVAL', + }); + } + } + return path; +}; +exports.pathArg = pathArg; +//# sourceMappingURL=path-arg.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.js.map new file mode 100644 index 00000000..ad3b5d38 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/path-arg.js.map @@ -0,0 +1 @@ +{"version":3,"file":"path-arg.js","sourceRoot":"","sources":["../../../src/path-arg.ts"],"names":[],"mappings":";;;AAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,OAAO,CAAC,QAAQ,CAAA;AAC5E,+BAAqC;AAC9B,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;IACtC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACnB,yCAAyC;QACzC,MAAM,MAAM,CAAC,MAAM,CACjB,IAAI,SAAS,CAAC,0CAA0C,CAAC,EACzD;YACE,IAAI;YACJ,IAAI,EAAE,uBAAuB;SAC9B,CACF,CAAA;KACF;IAED,IAAI,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,CAAA;IACpB,IAAI,QAAQ,KAAK,OAAO,EAAE;QACxB,MAAM,WAAW,GAAG,WAAW,CAAA;QAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,YAAK,EAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE;YACjD,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,EAAE;gBAC5D,IAAI;gBACJ,IAAI,EAAE,QAAQ;aACf,CAAC,CAAA;SACH;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAzBY,QAAA,OAAO,WAyBnB","sourcesContent":["const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform\nimport { parse, resolve } from 'path'\nexport const pathArg = (path: string) => {\n if (/\\0/.test(path)) {\n // simulate same failure that node raises\n throw Object.assign(\n new TypeError('path must be a string without null bytes'),\n {\n path,\n code: 'ERR_INVALID_ARG_VALUE',\n }\n )\n }\n\n path = resolve(path)\n if (platform === 'win32') {\n const badWinChars = /[*|\"<>?:]/\n const { root } = parse(path)\n if (badWinChars.test(path.substring(root.length))) {\n throw Object.assign(new Error('Illegal characters in path.'), {\n path,\n code: 'EINVAL',\n })\n }\n }\n\n return path\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.d.ts new file mode 100644 index 00000000..1c6cb619 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.d.ts @@ -0,0 +1,6 @@ +import { MkdirpOptions } from './opts-arg.js'; +export declare const useNativeSync: (opts?: MkdirpOptions) => boolean; +export declare const useNative: ((opts?: MkdirpOptions) => boolean) & { + sync: (opts?: MkdirpOptions) => boolean; +}; +//# sourceMappingURL=use-native.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.d.ts.map new file mode 100644 index 00000000..7dc275e3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"use-native.d.ts","sourceRoot":"","sources":["../../../src/use-native.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAMtD,eAAO,MAAM,aAAa,UAEd,aAAa,YAA0C,CAAA;AAEnE,eAAO,MAAM,SAAS,WAGR,aAAa;kBALf,aAAa;CASxB,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.js new file mode 100644 index 00000000..550b3452 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.useNative = exports.useNativeSync = void 0; +const fs_1 = require("fs"); +const opts_arg_js_1 = require("./opts-arg.js"); +const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version; +const versArr = version.replace(/^v/, '').split('.'); +const hasNative = +versArr[0] > 10 || (+versArr[0] === 10 && +versArr[1] >= 12); +exports.useNativeSync = !hasNative + ? () => false + : (opts) => (0, opts_arg_js_1.optsArg)(opts).mkdirSync === fs_1.mkdirSync; +exports.useNative = Object.assign(!hasNative + ? () => false + : (opts) => (0, opts_arg_js_1.optsArg)(opts).mkdir === fs_1.mkdir, { + sync: exports.useNativeSync, +}); +//# sourceMappingURL=use-native.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.js.map new file mode 100644 index 00000000..9a15efeb --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/cjs/src/use-native.js.map @@ -0,0 +1 @@ +{"version":3,"file":"use-native.js","sourceRoot":"","sources":["../../../src/use-native.ts"],"names":[],"mappings":";;;AAAA,2BAAqC;AACrC,+CAAsD;AAEtD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,OAAO,CAAC,OAAO,CAAA;AAC9E,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACpD,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAElE,QAAA,aAAa,GAAG,CAAC,SAAS;IACrC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK;IACb,CAAC,CAAC,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,SAAS,KAAK,cAAS,CAAA;AAEtD,QAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CACpC,CAAC,SAAS;IACR,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK;IACb,CAAC,CAAC,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,KAAK,KAAK,UAAK,EAC3D;IACE,IAAI,EAAE,qBAAa;CACpB,CACF,CAAA","sourcesContent":["import { mkdir, mkdirSync } from 'fs'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nconst version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version\nconst versArr = version.replace(/^v/, '').split('.')\nconst hasNative = +versArr[0] > 10 || (+versArr[0] === 10 && +versArr[1] >= 12)\n\nexport const useNativeSync = !hasNative\n ? () => false\n : (opts?: MkdirpOptions) => optsArg(opts).mkdirSync === mkdirSync\n\nexport const useNative = Object.assign(\n !hasNative\n ? () => false\n : (opts?: MkdirpOptions) => optsArg(opts).mkdir === mkdir,\n {\n sync: useNativeSync,\n }\n)\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.d.ts new file mode 100644 index 00000000..e47794b3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.d.ts @@ -0,0 +1,4 @@ +import { MkdirpOptionsResolved } from './opts-arg.js'; +export declare const findMade: (opts: MkdirpOptionsResolved, parent: string, path?: string) => Promise; +export declare const findMadeSync: (opts: MkdirpOptionsResolved, parent: string, path?: string) => undefined | string; +//# sourceMappingURL=find-made.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.d.ts.map new file mode 100644 index 00000000..411aad14 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"find-made.d.ts","sourceRoot":"","sources":["../../src/find-made.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAErD,eAAO,MAAM,QAAQ,SACb,qBAAqB,UACnB,MAAM,SACP,MAAM,KACZ,QAAQ,SAAS,GAAG,MAAM,CAe5B,CAAA;AAED,eAAO,MAAM,YAAY,SACjB,qBAAqB,UACnB,MAAM,SACP,MAAM,KACZ,SAAS,GAAG,MAad,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.js new file mode 100644 index 00000000..3e72fd59 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.js @@ -0,0 +1,30 @@ +import { dirname } from 'path'; +export const findMade = async (opts, parent, path) => { + // we never want the 'made' return value to be a root directory + if (path === parent) { + return; + } + return opts.statAsync(parent).then(st => (st.isDirectory() ? path : undefined), // will fail later + // will fail later + er => { + const fer = er; + return fer && fer.code === 'ENOENT' + ? findMade(opts, dirname(parent), parent) + : undefined; + }); +}; +export const findMadeSync = (opts, parent, path) => { + if (path === parent) { + return undefined; + } + try { + return opts.statSync(parent).isDirectory() ? path : undefined; + } + catch (er) { + const fer = er; + return fer && fer.code === 'ENOENT' + ? findMadeSync(opts, dirname(parent), parent) + : undefined; + } +}; +//# sourceMappingURL=find-made.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.js.map new file mode 100644 index 00000000..7b58089c --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/find-made.js.map @@ -0,0 +1 @@ +{"version":3,"file":"find-made.js","sourceRoot":"","sources":["../../src/find-made.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAG9B,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAC3B,IAA2B,EAC3B,MAAc,EACd,IAAa,EACgB,EAAE;IAC/B,+DAA+D;IAC/D,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,OAAM;KACP;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAChC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,kBAAkB;IAC/D,AAD6C,kBAAkB;IAC/D,EAAE,CAAC,EAAE;QACH,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;YACjC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YACzC,CAAC,CAAC,SAAS,CAAA;IACf,CAAC,CACF,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAA2B,EAC3B,MAAc,EACd,IAAa,EACO,EAAE;IACtB,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,OAAO,SAAS,CAAA;KACjB;IAED,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;KAC9D;IAAC,OAAO,EAAE,EAAE;QACX,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;YACjC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAC7C,CAAC,CAAC,SAAS,CAAA;KACd;AACH,CAAC,CAAA","sourcesContent":["import { dirname } from 'path'\nimport { MkdirpOptionsResolved } from './opts-arg.js'\n\nexport const findMade = async (\n opts: MkdirpOptionsResolved,\n parent: string,\n path?: string\n): Promise => {\n // we never want the 'made' return value to be a root directory\n if (path === parent) {\n return\n }\n\n return opts.statAsync(parent).then(\n st => (st.isDirectory() ? path : undefined), // will fail later\n er => {\n const fer = er as NodeJS.ErrnoException\n return fer && fer.code === 'ENOENT'\n ? findMade(opts, dirname(parent), parent)\n : undefined\n }\n )\n}\n\nexport const findMadeSync = (\n opts: MkdirpOptionsResolved,\n parent: string,\n path?: string\n): undefined | string => {\n if (path === parent) {\n return undefined\n }\n\n try {\n return opts.statSync(parent).isDirectory() ? path : undefined\n } catch (er) {\n const fer = er as NodeJS.ErrnoException\n return fer && fer.code === 'ENOENT'\n ? findMadeSync(opts, dirname(parent), parent)\n : undefined\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.d.ts new file mode 100644 index 00000000..fc9e43b3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.d.ts @@ -0,0 +1,39 @@ +import { MkdirpOptions } from './opts-arg.js'; +export { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'; +export { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'; +export { useNative, useNativeSync } from './use-native.js'; +export declare const mkdirpSync: (path: string, opts?: MkdirpOptions) => string | void; +export declare const sync: (path: string, opts?: MkdirpOptions) => string | void; +export declare const manual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; +}; +export declare const manualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; +export declare const native: ((path: string, options?: MkdirpOptions | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; +}; +export declare const nativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; +export declare const mkdirp: ((path: string, opts?: MkdirpOptions) => Promise) & { + mkdirpSync: (path: string, opts?: MkdirpOptions) => string | void; + mkdirpNative: ((path: string, options?: MkdirpOptions | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; + }; + mkdirpNativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; + mkdirpManual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; + }; + mkdirpManualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; + sync: (path: string, opts?: MkdirpOptions) => string | void; + native: ((path: string, options?: MkdirpOptions | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; + }; + nativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined; + manual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & { + sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; + }; + manualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined; + useNative: ((opts?: MkdirpOptions | undefined) => boolean) & { + sync: (opts?: MkdirpOptions | undefined) => boolean; + }; + useNativeSync: (opts?: MkdirpOptions | undefined) => boolean; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.d.ts.map new file mode 100644 index 00000000..cfcc7808 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAItD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG1D,eAAO,MAAM,UAAU,SAAU,MAAM,SAAS,aAAa,kBAM5D,CAAA;AAED,eAAO,MAAM,IAAI,SARgB,MAAM,SAAS,aAAa,kBAQ/B,CAAA;AAC9B,eAAO,MAAM,MAAM;;CAAe,CAAA;AAClC,eAAO,MAAM,UAAU,oHAAmB,CAAA;AAC1C,eAAO,MAAM,MAAM;;CAAe,CAAA;AAClC,eAAO,MAAM,UAAU,kFAAmB,CAAA;AAC1C,eAAO,MAAM,MAAM,UACJ,MAAM,SAAS,aAAa;uBAdV,MAAM,SAAS,aAAa;;;;;;;;;iBAA5B,MAAM,SAAS,aAAa;;;;;;;;;;;;;CAoC5D,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.js new file mode 100644 index 00000000..0217ecc8 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.js @@ -0,0 +1,43 @@ +import { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'; +import { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'; +import { optsArg } from './opts-arg.js'; +import { pathArg } from './path-arg.js'; +import { useNative, useNativeSync } from './use-native.js'; +/* c8 ignore start */ +export { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'; +export { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'; +export { useNative, useNativeSync } from './use-native.js'; +/* c8 ignore stop */ +export const mkdirpSync = (path, opts) => { + path = pathArg(path); + const resolved = optsArg(opts); + return useNativeSync(resolved) + ? mkdirpNativeSync(path, resolved) + : mkdirpManualSync(path, resolved); +}; +export const sync = mkdirpSync; +export const manual = mkdirpManual; +export const manualSync = mkdirpManualSync; +export const native = mkdirpNative; +export const nativeSync = mkdirpNativeSync; +export const mkdirp = Object.assign(async (path, opts) => { + path = pathArg(path); + const resolved = optsArg(opts); + return useNative(resolved) + ? mkdirpNative(path, resolved) + : mkdirpManual(path, resolved); +}, { + mkdirpSync, + mkdirpNative, + mkdirpNativeSync, + mkdirpManual, + mkdirpManualSync, + sync: mkdirpSync, + native: mkdirpNative, + nativeSync: mkdirpNativeSync, + manual: mkdirpManual, + manualSync: mkdirpManualSync, + useNative, + useNativeSync, +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.js.map new file mode 100644 index 00000000..47a8133a --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAiB,OAAO,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,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,CAAA;AAClC,CAAC,EACD;IACE,UAAU;IACV,YAAY;IACZ,gBAAgB;IAChB,YAAY;IACZ,gBAAgB;IAEhB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,YAAY;IACpB,UAAU,EAAE,gBAAgB;IAC5B,SAAS;IACT,aAAa;CACd,CACF,CAAA","sourcesContent":["import { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nimport { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\nimport { pathArg } from './path-arg.js'\nimport { useNative, useNativeSync } from './use-native.js'\n/* c8 ignore start */\nexport { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nexport { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'\nexport { useNative, useNativeSync } from './use-native.js'\n/* c8 ignore stop */\n\nexport const mkdirpSync = (path: string, opts?: MkdirpOptions) => {\n path = pathArg(path)\n const resolved = optsArg(opts)\n return useNativeSync(resolved)\n ? mkdirpNativeSync(path, resolved)\n : mkdirpManualSync(path, resolved)\n}\n\nexport const sync = mkdirpSync\nexport const manual = mkdirpManual\nexport const manualSync = mkdirpManualSync\nexport const native = mkdirpNative\nexport const nativeSync = mkdirpNativeSync\nexport const mkdirp = Object.assign(\n async (path: string, opts?: MkdirpOptions) => {\n path = pathArg(path)\n const resolved = optsArg(opts)\n return useNative(resolved)\n ? mkdirpNative(path, resolved)\n : mkdirpManual(path, resolved)\n },\n {\n mkdirpSync,\n mkdirpNative,\n mkdirpNativeSync,\n mkdirpManual,\n mkdirpManualSync,\n\n sync: mkdirpSync,\n native: mkdirpNative,\n nativeSync: mkdirpNativeSync,\n manual: mkdirpManual,\n manualSync: mkdirpManualSync,\n useNative,\n useNativeSync,\n }\n)\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts new file mode 100644 index 00000000..e49cdf9f --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts @@ -0,0 +1,6 @@ +import { MkdirpOptions } from './opts-arg.js'; +export declare const mkdirpManualSync: (path: string, options?: MkdirpOptions, made?: string | undefined | void) => string | undefined | void; +export declare const mkdirpManual: ((path: string, options?: MkdirpOptions, made?: string | undefined | void) => Promise) & { + sync: (path: string, options?: MkdirpOptions, made?: string | undefined | void) => string | undefined | void; +}; +//# sourceMappingURL=mkdirp-manual.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts.map new file mode 100644 index 00000000..ae7f243d --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdirp-manual.d.ts","sourceRoot":"","sources":["../../src/mkdirp-manual.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,gBAAgB,SACrB,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,MAAM,GAAG,SAAS,GAAG,IAmCvB,CAAA;AAED,eAAO,MAAM,YAAY,UAEf,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;iBA7C/B,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,MAAM,GAAG,SAAS,GAAG,IAAI;CAqF3B,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.js new file mode 100644 index 00000000..a4d044e0 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.js @@ -0,0 +1,75 @@ +import { dirname } from 'path'; +import { optsArg } from './opts-arg.js'; +export const mkdirpManualSync = (path, options, made) => { + const parent = dirname(path); + const opts = { ...optsArg(options), recursive: false }; + if (parent === path) { + try { + return opts.mkdirSync(path, opts); + } + catch (er) { + // swallowed by recursive implementation on posix systems + // any other error is a failure + const fer = er; + if (fer && fer.code !== 'EISDIR') { + throw er; + } + return; + } + } + try { + opts.mkdirSync(path, opts); + return made || path; + } + catch (er) { + const fer = er; + if (fer && fer.code === 'ENOENT') { + return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made)); + } + if (fer && fer.code !== 'EEXIST' && fer && fer.code !== 'EROFS') { + throw er; + } + try { + if (!opts.statSync(path).isDirectory()) + throw er; + } + catch (_) { + throw er; + } + } +}; +export const mkdirpManual = Object.assign(async (path, options, made) => { + const opts = optsArg(options); + opts.recursive = false; + const parent = dirname(path); + if (parent === path) { + return opts.mkdirAsync(path, opts).catch(er => { + // swallowed by recursive implementation on posix systems + // any other error is a failure + const fer = er; + if (fer && fer.code !== 'EISDIR') { + throw er; + } + }); + } + return opts.mkdirAsync(path, opts).then(() => made || path, async (er) => { + const fer = er; + if (fer && fer.code === 'ENOENT') { + return mkdirpManual(parent, opts).then((made) => mkdirpManual(path, opts, made)); + } + if (fer && fer.code !== 'EEXIST' && fer.code !== 'EROFS') { + throw er; + } + return opts.statAsync(path).then(st => { + if (st.isDirectory()) { + return made; + } + else { + throw er; + } + }, () => { + throw er; + }); + }); +}, { sync: mkdirpManualSync }); +//# sourceMappingURL=mkdirp-manual.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.js.map new file mode 100644 index 00000000..29eab250 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-manual.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdirp-manual.js","sourceRoot":"","sources":["../../src/mkdirp-manual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAiB,OAAO,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,IAAY,EACZ,OAAuB,EACvB,IAAgC,EACL,EAAE;IAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;IAEtD,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,IAAI;YACF,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SAClC;QAAC,OAAO,EAAE,EAAE;YACX,yDAAyD;YACzD,+BAA+B;YAC/B,MAAM,GAAG,GAAG,EAA2B,CAAA;YACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAChC,MAAM,EAAE,CAAA;aACT;YACD,OAAM;SACP;KACF;IAED,IAAI;QACF,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAC1B,OAAO,IAAI,IAAI,IAAI,CAAA;KACpB;IAAC,OAAO,EAAE,EAAE;QACX,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;YAChC,OAAO,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CA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pC,CAAC,IAAgC,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CACrE,CAAA;SACF;QACD,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE;YACxD,MAAM,EAAE,CAAA;SACT;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAC9B,EAAE,CAAC,EAAE;YACH,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;gBACpB,OAAO,IAAI,CAAA;aACZ;iBAAM;gBACL,MAAM,EAAE,CAAA;aACT;QACH,CAAC,EACD,GAAG,EAAE;YACH,MAAM,EAAE,CAAA;QACV,CAAC,CACF,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC,EACD,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAC3B,CAAA","sourcesContent":["import { dirname } from 'path'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nexport const mkdirpManualSync = (\n path: string,\n options?: MkdirpOptions,\n made?: string | undefined | void\n): string | undefined | void => {\n const parent = dirname(path)\n const opts = { ...optsArg(options), recursive: false }\n\n if (parent === path) {\n try {\n return opts.mkdirSync(path, opts)\n } catch (er) {\n // swallowed by recursive implementation on posix systems\n // any other error is a failure\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code !== 'EISDIR') {\n throw er\n }\n return\n }\n }\n\n try {\n opts.mkdirSync(path, opts)\n return made || path\n } catch (er) {\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code === 'ENOENT') {\n return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))\n }\n if (fer && fer.code !== 'EEXIST' && fer && fer.code !== 'EROFS') {\n throw er\n }\n try {\n if (!opts.statSync(path).isDirectory()) throw er\n } catch (_) {\n throw er\n }\n }\n}\n\nexport const mkdirpManual = Object.assign(\n async (\n path: string,\n options?: MkdirpOptions,\n made?: string | undefined | void\n ): Promise => {\n const opts = optsArg(options)\n opts.recursive = false\n const parent = dirname(path)\n if (parent === path) {\n return opts.mkdirAsync(path, opts).catch(er => {\n // swallowed by recursive implementation on posix systems\n // any other error is a failure\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code !== 'EISDIR') {\n throw er\n }\n })\n }\n\n return opts.mkdirAsync(path, opts).then(\n () => made || path,\n async er => {\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code === 'ENOENT') {\n return mkdirpManual(parent, opts).then(\n (made?: string | undefined | void) => mkdirpManual(path, opts, made)\n )\n }\n if (fer && fer.code !== 'EEXIST' && fer.code !== 'EROFS') {\n throw er\n }\n return opts.statAsync(path).then(\n st => {\n if (st.isDirectory()) {\n return made\n } else {\n throw er\n }\n },\n () => {\n throw er\n }\n )\n }\n )\n },\n { sync: mkdirpManualSync }\n)\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts new file mode 100644 index 00000000..28b64814 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts @@ -0,0 +1,6 @@ +import { MkdirpOptions } from './opts-arg.js'; +export declare const mkdirpNativeSync: (path: string, options?: MkdirpOptions) => string | void | undefined; +export declare const mkdirpNative: ((path: string, options?: MkdirpOptions) => Promise) & { + sync: (path: string, options?: MkdirpOptions) => string | void | undefined; +}; +//# sourceMappingURL=mkdirp-native.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts.map new file mode 100644 index 00000000..517dfabe --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdirp-native.d.ts","sourceRoot":"","sources":["../../src/mkdirp-native.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,gBAAgB,SACrB,MAAM,YACF,aAAa,KACtB,MAAM,GAAG,IAAI,GAAG,SAoBlB,CAAA;AAED,eAAO,MAAM,YAAY,UAEf,MAAM,YACF,aAAa,KACtB,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;iBA5B/B,MAAM,YACF,aAAa,KACtB,MAAM,GAAG,IAAI,GAAG,SAAS;CAgD3B,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.js new file mode 100644 index 00000000..99d10a54 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.js @@ -0,0 +1,46 @@ +import { dirname } from 'path'; +import { findMade, findMadeSync } from './find-made.js'; +import { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'; +import { optsArg } from './opts-arg.js'; +export const mkdirpNativeSync = (path, options) => { + const opts = optsArg(options); + opts.recursive = true; + const parent = dirname(path); + if (parent === path) { + return opts.mkdirSync(path, opts); + } + const made = findMadeSync(opts, path); + try { + opts.mkdirSync(path, opts); + return made; + } + catch (er) { + const fer = er; + if (fer && fer.code === 'ENOENT') { + return mkdirpManualSync(path, opts); + } + else { + throw er; + } + } +}; +export const mkdirpNative = Object.assign(async (path, options) => { + const opts = { ...optsArg(options), recursive: true }; + const parent = dirname(path); + if (parent === path) { + return await opts.mkdirAsync(path, opts); + } + return findMade(opts, path).then((made) => opts + .mkdirAsync(path, opts) + .then(m => made || m) + .catch(er => { + const fer = er; + if (fer && fer.code === 'ENOENT') { + return mkdirpManual(path, opts); + } + else { + throw er; + } + })); +}, { sync: mkdirpNativeSync }); +//# sourceMappingURL=mkdirp-native.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.js.map new file mode 100644 index 00000000..27de32d9 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/mkdirp-native.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mkdirp-native.js","sourceRoot":"","sources":["../../src/mkdirp-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAiB,OAAO,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,IAAY,EACZ,OAAuB,EACI,EAAE;IAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;IACrB,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;KAClC;IAED,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACrC,IAAI;QACF,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAC1B,OAAO,IAAI,CAAA;KACZ;IAAC,OAAO,EAAE,EAAE;QACX,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;YAChC,OAAO,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SACpC;aAAM;YACL,MAAM,EAAE,CAAA;SACT;KACF;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CACvC,KAAK,EACH,IAAY,EACZ,OAAuB,EACa,EAAE;IACtC,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;IACrD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;KACzC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAyB,EAAE,EAAE,CAC7D,IAAI;SACD,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC;SACtB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC;SACpB,KAAK,CAAC,EAAE,CAAC,EAAE;QACV,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;YAChC,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SAChC;aAAM;YACL,MAAM,EAAE,CAAA;SACT;IACH,CAAC,CAAC,CACL,CAAA;AACH,CAAC,EACD,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAC3B,CAAA","sourcesContent":["import { dirname } from 'path'\nimport { findMade, findMadeSync } from './find-made.js'\nimport { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nexport const mkdirpNativeSync = (\n path: string,\n options?: MkdirpOptions\n): string | void | undefined => {\n const opts = optsArg(options)\n opts.recursive = true\n const parent = dirname(path)\n if (parent === path) {\n return opts.mkdirSync(path, opts)\n }\n\n const made = findMadeSync(opts, path)\n try {\n opts.mkdirSync(path, opts)\n return made\n } catch (er) {\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code === 'ENOENT') {\n return mkdirpManualSync(path, opts)\n } else {\n throw er\n }\n }\n}\n\nexport const mkdirpNative = Object.assign(\n async (\n path: string,\n options?: MkdirpOptions\n ): Promise => {\n const opts = { ...optsArg(options), recursive: true }\n const parent = dirname(path)\n if (parent === path) {\n return await opts.mkdirAsync(path, opts)\n }\n\n return findMade(opts, path).then((made?: string | undefined) =>\n opts\n .mkdirAsync(path, opts)\n .then(m => made || m)\n .catch(er => {\n const fer = er as NodeJS.ErrnoException\n if (fer && fer.code === 'ENOENT') {\n return mkdirpManual(path, opts)\n } else {\n throw er\n }\n })\n )\n },\n { sync: mkdirpNativeSync }\n)\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.d.ts new file mode 100644 index 00000000..73d076b3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.d.ts @@ -0,0 +1,42 @@ +/// +/// +import { MakeDirectoryOptions, Stats } from 'fs'; +export interface FsProvider { + stat?: (path: string, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any) => any; + mkdir?: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }, callback: (err: NodeJS.ErrnoException | null, made?: string) => any) => any; + statSync?: (path: string) => Stats; + mkdirSync?: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }) => string | undefined; +} +interface Options extends FsProvider { + mode?: number | string; + fs?: FsProvider; + mkdirAsync?: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }) => Promise; + statAsync?: (path: string) => Promise; +} +export type MkdirpOptions = Options | number | string; +export interface MkdirpOptionsResolved { + mode: number; + fs: FsProvider; + mkdirAsync: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }) => Promise; + statAsync: (path: string) => Promise; + stat: (path: string, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any) => any; + mkdir: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }, callback: (err: NodeJS.ErrnoException | null, made?: string) => any) => any; + statSync: (path: string) => Stats; + mkdirSync: (path: string, opts: MakeDirectoryOptions & { + recursive?: boolean; + }) => string | undefined; + recursive?: boolean; +} +export declare const optsArg: (opts?: MkdirpOptions) => MkdirpOptionsResolved; +export {}; +//# sourceMappingURL=opts-arg.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.d.ts.map new file mode 100644 index 00000000..717deb5f --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"opts-arg.d.ts","sourceRoot":"","sources":["../../src/opts-arg.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,oBAAoB,EAIpB,KAAK,EAEN,MAAM,IAAI,CAAA;AAEX,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,CACL,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,GAAG,KAC/D,GAAG,CAAA;IACR,KAAK,CAAC,EAAE,CACN,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,EACpD,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,KAChE,GAAG,CAAA;IACR,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,M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D,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,KAChE,GAAG,CAAA;IACR,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAA;IACjC,SAAS,EAAE,CACT,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KACjD,MAAM,GAAG,SAAS,CAAA;IACvB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,OAAO,UAAW,aAAa,KAAG,qBA2C9C,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.js new file mode 100644 index 00000000..d47e2927 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.js @@ -0,0 +1,34 @@ +import { mkdir, mkdirSync, stat, statSync, } from 'fs'; +export const optsArg = (opts) => { + if (!opts) { + opts = { mode: 0o777 }; + } + else if (typeof opts === 'object') { + opts = { mode: 0o777, ...opts }; + } + else if (typeof opts === 'number') { + opts = { mode: opts }; + } + else if (typeof opts === 'string') { + opts = { mode: parseInt(opts, 8) }; + } + else { + throw new TypeError('invalid options argument'); + } + const resolved = opts; + const optsFs = opts.fs || {}; + opts.mkdir = opts.mkdir || optsFs.mkdir || mkdir; + opts.mkdirAsync = opts.mkdirAsync + ? opts.mkdirAsync + : async (path, options) => { + return new Promise((res, rej) => resolved.mkdir(path, options, (er, made) => er ? rej(er) : res(made))); + }; + opts.stat = opts.stat || optsFs.stat || stat; + opts.statAsync = opts.statAsync + ? opts.statAsync + : async (path) => new Promise((res, rej) => resolved.stat(path, (err, stats) => (err ? rej(err) : res(stats)))); + opts.statSync = opts.statSync || optsFs.statSync || statSync; + opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || mkdirSync; + return resolved; +}; +//# sourceMappingURL=opts-arg.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.js.map new file mode 100644 index 00000000..663286dc --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/opts-arg.js.map @@ -0,0 +1 @@ +{"version":3,"file":"opts-arg.js","sourceRoot":"","sources":["../../src/opts-arg.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,SAAS,EACT,IAAI,EAEJ,QAAQ,GACT,MAAM,IAAI,CAAA;AAwDX,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAoB,EAAyB,EAAE;IACrE,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;KACvB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,IAAI,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,CAAA;KAChC;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;KACtB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,IAAI,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAA;KACnC;SAAM;QACL,MAAM,IAAI,SAAS,CAAC,0BAA0B,CAAC,CAAA;KAChD;IAED,MAAM,QAAQ,GAAG,IAA6B,CAAA;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;IAE5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,KAAK,CAAA;IA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'fs'\n\nexport interface FsProvider {\n stat?: (\n path: string,\n callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any\n ) => any\n mkdir?: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean },\n callback: (err: NodeJS.ErrnoException | null, made?: string) => any\n ) => any\n statSync?: (path: string) => Stats\n mkdirSync?: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean }\n ) => string | undefined\n}\n\ninterface Options extends FsProvider {\n mode?: number | string\n fs?: FsProvider\n mkdirAsync?: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean }\n ) => Promise\n statAsync?: (path: string) => Promise\n}\n\nexport type MkdirpOptions = Options | number | string\n\nexport interface MkdirpOptionsResolved {\n mode: number\n fs: FsProvider\n mkdirAsync: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean }\n ) => Promise\n statAsync: (path: string) => Promise\n stat: (\n path: string,\n callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any\n ) => any\n mkdir: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean },\n callback: (err: NodeJS.ErrnoException | null, made?: string) => any\n ) => any\n statSync: (path: string) => Stats\n mkdirSync: (\n path: string,\n opts: MakeDirectoryOptions & { recursive?: boolean }\n ) => string | undefined\n recursive?: boolean\n}\n\nexport const optsArg = (opts?: MkdirpOptions): MkdirpOptionsResolved => {\n if (!opts) {\n opts = { mode: 0o777 }\n } else if (typeof opts === 'object') {\n opts = { mode: 0o777, ...opts }\n } else if (typeof opts === 'number') {\n opts = { mode: opts }\n } else if (typeof opts === 'string') {\n opts = { mode: parseInt(opts, 8) }\n } else {\n throw new TypeError('invalid options argument')\n }\n\n const resolved = opts as MkdirpOptionsResolved\n const optsFs = opts.fs || {}\n\n opts.mkdir = opts.mkdir || optsFs.mkdir || mkdir\n\n opts.mkdirAsync = opts.mkdirAsync\n ? opts.mkdirAsync\n : async (\n path: string,\n options: MakeDirectoryOptions & { recursive?: boolean }\n ): Promise => {\n return new Promise((res, rej) =>\n resolved.mkdir(path, options, (er, made) =>\n er ? rej(er) : res(made)\n )\n )\n }\n\n opts.stat = opts.stat || optsFs.stat || stat\n opts.statAsync = opts.statAsync\n ? opts.statAsync\n : async (path: string) =>\n new Promise((res, rej) =>\n resolved.stat(path, (err, stats) => (err ? rej(err) : res(stats)))\n )\n\n opts.statSync = opts.statSync || optsFs.statSync || statSync\n opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || mkdirSync\n\n return resolved\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/package.json b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.d.ts new file mode 100644 index 00000000..ad0ccfc4 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.d.ts @@ -0,0 +1,2 @@ +export declare const pathArg: (path: string) => string; +//# sourceMappingURL=path-arg.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.d.ts.map new file mode 100644 index 00000000..801799e7 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"path-arg.d.ts","sourceRoot":"","sources":["../../src/path-arg.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,SAAU,MAAM,WAyBnC,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.js new file mode 100644 index 00000000..03539cc5 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.js @@ -0,0 +1,24 @@ +const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform; +import { parse, resolve } from 'path'; +export const pathArg = (path) => { + if (/\0/.test(path)) { + // simulate same failure that node raises + throw Object.assign(new TypeError('path must be a string without null bytes'), { + path, + code: 'ERR_INVALID_ARG_VALUE', + }); + } + path = resolve(path); + if (platform === 'win32') { + const badWinChars = /[*|"<>?:]/; + const { root } = parse(path); + if (badWinChars.test(path.substring(root.length))) { + throw Object.assign(new Error('Illegal characters in path.'), { + path, + code: 'EINVAL', + }); + } + } + return path; +}; +//# sourceMappingURL=path-arg.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.js.map new file mode 100644 index 00000000..43efe1e3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/path-arg.js.map @@ -0,0 +1 @@ +{"version":3,"file":"path-arg.js","sourceRoot":"","sources":["../../src/path-arg.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,OAAO,CAAC,QAAQ,CAAA;AAC5E,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACrC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;IACtC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACnB,yCAAyC;QACzC,MAAM,MAAM,CAAC,MAAM,CACjB,IAAI,SAAS,CAAC,0CAA0C,CAAC,EACzD;YACE,IAAI;YACJ,IAAI,EAAE,uBAAuB;SAC9B,CACF,CAAA;KACF;IAED,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpB,IAAI,QAAQ,KAAK,OAAO,EAAE;QACxB,MAAM,WAAW,GAAG,WAAW,CAAA;QAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE;YACjD,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,EAAE;gBAC5D,IAAI;gBACJ,IAAI,EAAE,QAAQ;aACf,CAAC,CAAA;SACH;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA","sourcesContent":["const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform\nimport { parse, resolve } from 'path'\nexport const pathArg = (path: string) => {\n if (/\\0/.test(path)) {\n // simulate same failure that node raises\n throw Object.assign(\n new TypeError('path must be a string without null bytes'),\n {\n path,\n code: 'ERR_INVALID_ARG_VALUE',\n }\n )\n }\n\n path = resolve(path)\n if (platform === 'win32') {\n const badWinChars = /[*|\"<>?:]/\n const { root } = parse(path)\n if (badWinChars.test(path.substring(root.length))) {\n throw Object.assign(new Error('Illegal characters in path.'), {\n path,\n code: 'EINVAL',\n })\n }\n }\n\n return path\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.d.ts b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.d.ts new file mode 100644 index 00000000..1c6cb619 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.d.ts @@ -0,0 +1,6 @@ +import { MkdirpOptions } from './opts-arg.js'; +export declare const useNativeSync: (opts?: MkdirpOptions) => boolean; +export declare const useNative: ((opts?: MkdirpOptions) => boolean) & { + sync: (opts?: MkdirpOptions) => boolean; +}; +//# sourceMappingURL=use-native.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.d.ts.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.d.ts.map new file mode 100644 index 00000000..e2484228 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"use-native.d.ts","sourceRoot":"","sources":["../../src/use-native.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAMtD,eAAO,MAAM,aAAa,UAEd,aAAa,YAA0C,CAAA;AAEnE,eAAO,MAAM,SAAS,WAGR,aAAa;kBALf,aAAa;CASxB,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.js b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.js new file mode 100644 index 00000000..ad209386 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.js @@ -0,0 +1,14 @@ +import { mkdir, mkdirSync } from 'fs'; +import { optsArg } from './opts-arg.js'; +const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version; +const versArr = version.replace(/^v/, '').split('.'); +const hasNative = +versArr[0] > 10 || (+versArr[0] === 10 && +versArr[1] >= 12); +export const useNativeSync = !hasNative + ? () => false + : (opts) => optsArg(opts).mkdirSync === mkdirSync; +export const useNative = Object.assign(!hasNative + ? () => false + : (opts) => optsArg(opts).mkdir === mkdir, { + sync: useNativeSync, +}); +//# sourceMappingURL=use-native.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.js.map b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.js.map new file mode 100644 index 00000000..08c616d3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/dist/mjs/use-native.js.map @@ -0,0 +1 @@ +{"version":3,"file":"use-native.js","sourceRoot":"","sources":["../../src/use-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AACrC,OAAO,EAAiB,OAAO,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,OAAO,CAAC,OAAO,CAAA;AAC9E,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACpD,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS;IACrC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK;IACb,CAAC,CAAC,CAAC,IAAoB,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,CAAA;AAEnE,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CACpC,CAAC,SAAS;IACR,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK;IACb,CAAC,CAAC,CAAC,IAAoB,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,EAC3D;IACE,IAAI,EAAE,aAAa;CACpB,CACF,CAAA","sourcesContent":["import { mkdir, mkdirSync } from 'fs'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nconst version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version\nconst versArr = version.replace(/^v/, '').split('.')\nconst hasNative = +versArr[0] > 10 || (+versArr[0] === 10 && +versArr[1] >= 12)\n\nexport const useNativeSync = !hasNative\n ? () => false\n : (opts?: MkdirpOptions) => optsArg(opts).mkdirSync === mkdirSync\n\nexport const useNative = Object.assign(\n !hasNative\n ? () => false\n : (opts?: MkdirpOptions) => optsArg(opts).mkdir === mkdir,\n {\n sync: useNativeSync,\n }\n)\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/package.json b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/package.json new file mode 100644 index 00000000..f31ac331 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/package.json @@ -0,0 +1,91 @@ +{ + "name": "mkdirp", + "description": "Recursively mkdir, like `mkdir -p`", + "version": "3.0.1", + "keywords": [ + "mkdir", + "directory", + "make dir", + "make", + "dir", + "recursive", + "native" + ], + "bin": "./dist/cjs/src/bin.js", + "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", + "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" + }, + "devDependencies": { + "@types/brace-expansion": "^1.1.0", + "@types/node": "^18.11.9", + "@types/tap": "^15.0.7", + "c8": "^7.12.0", + "eslint-config-prettier": "^8.6.0", + "prettier": "^2.8.2", + "tap": "^16.3.3", + "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" + }, + "repository": { + "type": "git", + "url": "https://github.com/isaacs/node-mkdirp.git" + }, + "license": "MIT", + "engines": { + "node": ">=10" + } +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/mkdirp/readme.markdown b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/readme.markdown new file mode 100644 index 00000000..df654b80 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/mkdirp/readme.markdown @@ -0,0 +1,281 @@ +# mkdirp + +Like `mkdir -p`, but in Node.js! + +Now with a modern API and no\* bugs! + +\* may contain some bugs + +# example + +## pow.js + +```js +// hybrid module, import or require() both work +import { mkdirp } from 'mkdirp' +// or: +const { mkdirp } = require('mkdirp') + +// return value is a Promise resolving to the first directory created +mkdirp('/tmp/foo/bar/baz').then(made => + console.log(`made directories, starting with ${made}`) +) +``` + +Output (where `/tmp/foo` already exists) + +``` +made directories, starting with /tmp/foo/bar +``` + +Or, if you don't have time to wait around for promises: + +```js +import { mkdirp } from 'mkdirp' + +// return value is the first directory created +const made = mkdirp.sync('/tmp/foo/bar/baz') +console.log(`made directories, starting with ${made}`) +``` + +And now /tmp/foo/bar/baz exists, huzzah! + +# methods + +```js +import { mkdirp } from 'mkdirp' +``` + +## `mkdirp(dir: string, opts?: MkdirpOptions) => Promise` + +Create a new directory and any necessary subdirectories at `dir` +with octal permission string `opts.mode`. If `opts` is a string +or number, it will be treated as the `opts.mode`. + +If `opts.mode` isn't specified, it defaults to `0o777`. + +Promise resolves to first directory `made` that had to be +created, or `undefined` if everything already exists. Promise +rejects if any errors are encountered. Note that, in the case of +promise rejection, some directories _may_ have been created, as +recursive directory creation is not an atomic operation. + +You can optionally pass in an alternate `fs` implementation by +passing in `opts.fs`. Your implementation should have +`opts.fs.mkdir(path, opts, cb)` and `opts.fs.stat(path, cb)`. + +You can also override just one or the other of `mkdir` and `stat` +by passing in `opts.stat` or `opts.mkdir`, or providing an `fs` +option that only overrides one of these. + +## `mkdirp.sync(dir: string, opts: MkdirpOptions) => string|undefined` + +Synchronously create a new directory and any necessary +subdirectories at `dir` with octal permission string `opts.mode`. +If `opts` is a string or number, it will be treated as the +`opts.mode`. + +If `opts.mode` isn't specified, it defaults to `0o777`. + +Returns the first directory that had to be created, or undefined +if everything already exists. + +You can optionally pass in an alternate `fs` implementation by +passing in `opts.fs`. Your implementation should have +`opts.fs.mkdirSync(path, mode)` and `opts.fs.statSync(path)`. + +You can also override just one or the other of `mkdirSync` and +`statSync` by passing in `opts.statSync` or `opts.mkdirSync`, or +providing an `fs` option that only overrides one of these. + +## `mkdirp.manual`, `mkdirp.manualSync` + +Use the manual implementation (not the native one). This is the +default when the native implementation is not available or the +stat/mkdir implementation is overridden. + +## `mkdirp.native`, `mkdirp.nativeSync` + +Use the native implementation (not the manual one). This is the +default when the native implementation is available and +stat/mkdir are not overridden. + +# implementation + +On Node.js v10.12.0 and above, use the native `fs.mkdir(p, +{recursive:true})` option, unless `fs.mkdir`/`fs.mkdirSync` has +been overridden by an option. + +## native implementation + +- If the path is a root directory, then pass it to the underlying + implementation and return the result/error. (In this case, + it'll either succeed or fail, but we aren't actually creating + any dirs.) +- Walk up the path statting each directory, to find the first + path that will be created, `made`. +- Call `fs.mkdir(path, { recursive: true })` (or `fs.mkdirSync`) +- If error, raise it to the caller. +- Return `made`. + +## manual implementation + +- Call underlying `fs.mkdir` implementation, with `recursive: +false` +- If error: + - If path is a root directory, raise to the caller and do not + handle it + - If ENOENT, mkdirp parent dir, store result as `made` + - stat(path) + - If error, raise original `mkdir` error + - If directory, return `made` + - Else, raise original `mkdir` error +- else + - return `undefined` if a root dir, or `made` if set, or `path` + +## windows vs unix caveat + +On Windows file systems, attempts to create a root directory (ie, +a drive letter or root UNC path) will fail. If the root +directory exists, then it will fail with `EPERM`. If the root +directory does not exist, then it will fail with `ENOENT`. + +On posix file systems, attempts to create a root directory (in +recursive mode) will succeed silently, as it is treated like just +another directory that already exists. (In non-recursive mode, +of course, it fails with `EEXIST`.) + +In order to preserve this system-specific behavior (and because +it's not as if we can create the parent of a root directory +anyway), attempts to create a root directory are passed directly +to the `fs` implementation, and any errors encountered are not +handled. + +## native error caveat + +The native implementation (as of at least Node.js v13.4.0) does +not provide appropriate errors in some cases (see +[nodejs/node#31481](https://github.com/nodejs/node/issues/31481) +and +[nodejs/node#28015](https://github.com/nodejs/node/issues/28015)). + +In order to work around this issue, the native implementation +will fall back to the manual implementation if an `ENOENT` error +is encountered. + +# choosing a recursive mkdir implementation + +There are a few to choose from! Use the one that suits your +needs best :D + +## use `fs.mkdir(path, {recursive: true}, cb)` if: + +- You wish to optimize performance even at the expense of other + factors. +- You don't need to know the first dir created. +- You are ok with getting `ENOENT` as the error when some other + problem is the actual cause. +- You can limit your platforms to Node.js v10.12 and above. +- You're ok with using callbacks instead of promises. +- You don't need/want a CLI. +- You don't need to override the `fs` methods in use. + +## use this module (mkdirp 1.x or 2.x) if: + +- You need to know the first directory that was created. +- You wish to use the native implementation if available, but + fall back when it's not. +- You prefer promise-returning APIs to callback-taking APIs. +- You want more useful error messages than the native recursive + mkdir provides (at least as of Node.js v13.4), and are ok with + re-trying on `ENOENT` to achieve this. +- You need (or at least, are ok with) a CLI. +- You need to override the `fs` methods in use. + +## use [`make-dir`](http://npm.im/make-dir) if: + +- You do not need to know the first dir created (and wish to save + a few `stat` calls when using the native implementation for + this reason). +- You wish to use the native implementation if available, but + fall back when it's not. +- You prefer promise-returning APIs to callback-taking APIs. +- You are ok with occasionally getting `ENOENT` errors for + failures that are actually related to something other than a + missing file system entry. +- You don't need/want a CLI. +- You need to override the `fs` methods in use. + +## use mkdirp 0.x if: + +- You need to know the first directory that was created. +- You need (or at least, are ok with) a CLI. +- You need to override the `fs` methods in use. +- You're ok with using callbacks instead of promises. +- You are not running on Windows, where the root-level ENOENT + errors can lead to infinite regress. +- You think vinyl just sounds warmer and richer for some weird + reason. +- You are supporting truly ancient Node.js versions, before even + the advent of a `Promise` language primitive. (Please don't. + You deserve better.) + +# cli + +This package also ships with a `mkdirp` command. + +``` +$ mkdirp -h + +usage: mkdirp [DIR1,DIR2..] {OPTIONS} + + Create each supplied directory including any necessary parent directories + that don't yet exist. + + If the directory already exists, do nothing. + +OPTIONS are: + + -m If a directory needs to be created, set the mode as an octal + --mode= permission string. + + -v --version Print the mkdirp version number + + -h --help Print this helpful banner + + -p --print Print the first directories created for each path provided + + --manual Use manual implementation, even if native is available +``` + +# install + +With [npm](http://npmjs.org) do: + +``` +npm install mkdirp +``` + +to get the library locally, or + +``` +npm install -g mkdirp +``` + +to get the command everywhere, or + +``` +npx mkdirp ... +``` + +to run the command without installing it globally. + +# platform support + +This module works on node v8, but only v10 and above are officially +supported, as Node v8 reached its LTS end of life 2020-01-01, which is in +the past, as of this writing. + +# license + +MIT diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/LICENSE b/node_modules/npm/node_modules/cacache/node_modules/tar/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/cacache/node_modules/tar/dist/commonjs/create.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/create.js new file mode 100644 index 00000000..3190afc4 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/create.js @@ -0,0 +1,83 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.create = void 0; +const fs_minipass_1 = require("@isaacs/fs-minipass"); +const node_path_1 = __importDefault(require("node:path")); +const list_js_1 = require("./list.js"); +const make_command_js_1 = require("./make-command.js"); +const pack_js_1 = require("./pack.js"); +const createFileSync = (opt, files) => { + const p = new pack_js_1.PackSync(opt); + const stream = new fs_minipass_1.WriteStreamSync(opt.file, { + mode: opt.mode || 0o666, + }); + p.pipe(stream); + addFilesSync(p, files); +}; +const createFile = (opt, files) => { + const p = new pack_js_1.Pack(opt); + const stream = new fs_minipass_1.WriteStream(opt.file, { + mode: opt.mode || 0o666, + }); + p.pipe(stream); + const promise = new Promise((res, rej) => { + stream.on('error', rej); + stream.on('close', res); + p.on('error', rej); + }); + addFilesAsync(p, files); + return promise; +}; +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') { + (0, list_js_1.list)({ + file: node_path_1.default.resolve(p.cwd, file.slice(1)), + sync: true, + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + }); + p.end(); +}; +const addFilesAsync = async (p, files) => { + for (let i = 0; i < files.length; i++) { + const file = String(files[i]); + if (file.charAt(0) === '@') { + await (0, list_js_1.list)({ + file: node_path_1.default.resolve(String(p.cwd), file.slice(1)), + noResume: true, + onReadEntry: entry => { + p.add(entry); + }, + }); + } + else { + p.add(file); + } + } + p.end(); +}; +const createSync = (opt, files) => { + const p = new pack_js_1.PackSync(opt); + addFilesSync(p, files); + return p; +}; +const createAsync = (opt, files) => { + const p = new pack_js_1.Pack(opt); + addFilesAsync(p, files); + return p; +}; +exports.create = (0, make_command_js_1.makeCommand)(createFileSync, createFile, createSync, createAsync, (_opt, files) => { + if (!files?.length) { + throw new TypeError('no paths specified to add to archive'); + } +}); +//# sourceMappingURL=create.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/cwd-error.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/cwd-error.js new file mode 100644 index 00000000..d703a777 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/cwd-error.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CwdError = void 0; +class CwdError extends Error { + path; + code; + syscall = 'chdir'; + constructor(path, code) { + super(`${code}: Cannot cd into '${path}'`); + this.path = path; + this.code = code; + } + get name() { + return 'CwdError'; + } +} +exports.CwdError = CwdError; +//# sourceMappingURL=cwd-error.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/extract.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/extract.js new file mode 100644 index 00000000..f848cbcb --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/extract.js @@ -0,0 +1,78 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extract = void 0; +// tar -x +const fsm = __importStar(require("@isaacs/fs-minipass")); +const node_fs_1 = __importDefault(require("node:fs")); +const list_js_1 = require("./list.js"); +const make_command_js_1 = require("./make-command.js"); +const unpack_js_1 = require("./unpack.js"); +const extractFileSync = (opt) => { + const u = new unpack_js_1.UnpackSync(opt); + const file = opt.file; + const stat = node_fs_1.default.statSync(file); + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const stream = new fsm.ReadStreamSync(file, { + readSize: readSize, + size: stat.size, + }); + stream.pipe(u); +}; +const extractFile = (opt, _) => { + const u = new unpack_js_1.Unpack(opt); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const file = opt.file; + const p = new Promise((resolve, reject) => { + u.on('error', reject); + u.on('close', resolve); + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + node_fs_1.default.stat(file, (er, stat) => { + if (er) { + reject(er); + } + else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size, + }); + stream.on('error', reject); + stream.pipe(u); + } + }); + }); + return p; +}; +exports.extract = (0, make_command_js_1.makeCommand)(extractFileSync, extractFile, opt => new unpack_js_1.UnpackSync(opt), opt => new unpack_js_1.Unpack(opt), (opt, files) => { + if (files?.length) + (0, list_js_1.filesFilter)(opt, files); +}); +//# sourceMappingURL=extract.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/get-write-flag.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/get-write-flag.js new file mode 100644 index 00000000..94add8f6 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/get-write-flag.js @@ -0,0 +1,29 @@ +"use strict"; +// Get the appropriate flag to use for creating files +// We use fmap on Windows platforms for files less than +// 512kb. This is a fairly low limit, but avoids making +// things slower in some cases. Since most of what this +// library is used for is extracting tarballs of many +// relatively small files in npm packages and the like, +// it can be a big boost on Windows platforms. +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getWriteFlag = void 0; +const fs_1 = __importDefault(require("fs")); +const platform = process.env.__FAKE_PLATFORM__ || process.platform; +const isWindows = platform === 'win32'; +/* c8 ignore start */ +const { O_CREAT, O_TRUNC, O_WRONLY } = fs_1.default.constants; +const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) || + fs_1.default.constants.UV_FS_O_FILEMAP || + 0; +/* c8 ignore stop */ +const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP; +const fMapLimit = 512 * 1024; +const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY; +exports.getWriteFlag = !fMapEnabled ? + () => 'w' + : (size) => (size < fMapLimit ? fMapFlag : 'w'); +//# sourceMappingURL=get-write-flag.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/header.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/header.js new file mode 100644 index 00000000..b3a48037 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/header.js @@ -0,0 +1,306 @@ +"use strict"; +// parse a 512-byte header block to a data object, or vice-versa +// encode returns `true` if a pax extended header is needed, because +// the data could not be faithfully encoded in a simple header. +// (Also, check header.needPax to see if it needs a pax header.) +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Header = void 0; +const node_path_1 = require("node:path"); +const large = __importStar(require("./large-numbers.js")); +const types = __importStar(require("./types.js")); +class Header { + cksumValid = false; + needPax = false; + nullBlock = false; + block; + path; + mode; + uid; + gid; + size; + cksum; + #type = 'Unsupported'; + linkpath; + uname; + gname; + devmaj = 0; + devmin = 0; + atime; + ctime; + mtime; + charset; + comment; + constructor(data, off = 0, ex, gex) { + if (Buffer.isBuffer(data)) { + this.decode(data, off || 0, ex, gex); + } + else if (data) { + this.#slurp(data); + } + } + decode(buf, off, ex, gex) { + if (!off) { + off = 0; + } + if (!buf || !(buf.length >= off + 512)) { + throw new Error('need 512 bytes for header'); + } + this.path = decString(buf, off, 100); + this.mode = decNumber(buf, off + 100, 8); + this.uid = decNumber(buf, off + 108, 8); + this.gid = decNumber(buf, off + 116, 8); + this.size = decNumber(buf, off + 124, 12); + this.mtime = decDate(buf, off + 136, 12); + this.cksum = decNumber(buf, off + 148, 12); + // if we have extended or global extended headers, apply them now + // See https://github.com/npm/node-tar/pull/187 + // Apply global before local, so it overrides + if (gex) + this.#slurp(gex, true); + if (ex) + this.#slurp(ex); + // old tar versions marked dirs as a file with a trailing / + const t = decString(buf, off + 156, 1); + if (types.isCode(t)) { + this.#type = t || '0'; + } + if (this.#type === '0' && this.path.slice(-1) === '/') { + this.#type = '5'; + } + // tar implementations sometimes incorrectly put the stat(dir).size + // as the size in the tarball, even though Directory entries are + // not able to have any body at all. In the very rare chance that + // it actually DOES have a body, we weren't going to do anything with + // it anyway, and it'll just be a warning about an invalid header. + if (this.#type === '5') { + this.size = 0; + } + this.linkpath = decString(buf, off + 157, 100); + if (buf.subarray(off + 257, off + 265).toString() === + 'ustar\u000000') { + this.uname = decString(buf, off + 265, 32); + this.gname = decString(buf, off + 297, 32); + /* c8 ignore start */ + this.devmaj = decNumber(buf, off + 329, 8) ?? 0; + this.devmin = decNumber(buf, off + 337, 8) ?? 0; + /* c8 ignore stop */ + if (buf[off + 475] !== 0) { + // definitely a prefix, definitely >130 chars. + const prefix = decString(buf, off + 345, 155); + this.path = prefix + '/' + this.path; + } + else { + const prefix = decString(buf, off + 345, 130); + if (prefix) { + this.path = prefix + '/' + this.path; + } + this.atime = decDate(buf, off + 476, 12); + this.ctime = decDate(buf, off + 488, 12); + } + } + let sum = 8 * 0x20; + for (let i = off; i < off + 148; i++) { + sum += buf[i]; + } + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i]; + } + this.cksumValid = sum === this.cksum; + if (this.cksum === undefined && sum === 8 * 0x20) { + this.nullBlock = true; + } + } + #slurp(ex, gex = false) { + Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. Also, any + // null/undefined values are ignored. + return !(v === null || + v === undefined || + (k === 'path' && gex) || + (k === 'linkpath' && gex) || + k === 'global'); + }))); + } + encode(buf, off = 0) { + if (!buf) { + buf = this.block = Buffer.alloc(512); + } + if (this.#type === 'Unsupported') { + this.#type = '0'; + } + if (!(buf.length >= off + 512)) { + throw new Error('need 512 bytes for header'); + } + const prefixSize = this.ctime || this.atime ? 130 : 155; + const split = splitPrefix(this.path || '', prefixSize); + const path = split[0]; + const prefix = split[1]; + this.needPax = !!split[2]; + this.needPax = encString(buf, off, 100, path) || this.needPax; + this.needPax = + encNumber(buf, off + 100, 8, this.mode) || this.needPax; + this.needPax = + encNumber(buf, off + 108, 8, this.uid) || this.needPax; + this.needPax = + encNumber(buf, off + 116, 8, this.gid) || this.needPax; + this.needPax = + encNumber(buf, off + 124, 12, this.size) || this.needPax; + this.needPax = + encDate(buf, off + 136, 12, this.mtime) || this.needPax; + buf[off + 156] = this.#type.charCodeAt(0); + this.needPax = + encString(buf, off + 157, 100, this.linkpath) || this.needPax; + buf.write('ustar\u000000', off + 257, 8); + this.needPax = + encString(buf, off + 265, 32, this.uname) || this.needPax; + this.needPax = + encString(buf, off + 297, 32, this.gname) || this.needPax; + this.needPax = + encNumber(buf, off + 329, 8, this.devmaj) || this.needPax; + this.needPax = + encNumber(buf, off + 337, 8, this.devmin) || this.needPax; + this.needPax = + encString(buf, off + 345, prefixSize, prefix) || this.needPax; + if (buf[off + 475] !== 0) { + this.needPax = + encString(buf, off + 345, 155, prefix) || this.needPax; + } + else { + this.needPax = + encString(buf, off + 345, 130, prefix) || this.needPax; + this.needPax = + encDate(buf, off + 476, 12, this.atime) || this.needPax; + this.needPax = + encDate(buf, off + 488, 12, this.ctime) || this.needPax; + } + let sum = 8 * 0x20; + for (let i = off; i < off + 148; i++) { + sum += buf[i]; + } + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i]; + } + this.cksum = sum; + encNumber(buf, off + 148, 8, this.cksum); + this.cksumValid = true; + return this.needPax; + } + get type() { + return (this.#type === 'Unsupported' ? + this.#type + : types.name.get(this.#type)); + } + get typeKey() { + return this.#type; + } + set type(type) { + const c = String(types.code.get(type)); + if (types.isCode(c) || c === 'Unsupported') { + this.#type = c; + } + else if (types.isCode(type)) { + this.#type = type; + } + else { + throw new TypeError('invalid entry type: ' + type); + } + } +} +exports.Header = Header; +const splitPrefix = (p, prefixSize) => { + const pathSize = 100; + let pp = p; + let prefix = ''; + let ret = undefined; + const root = node_path_1.posix.parse(p).root || '.'; + if (Buffer.byteLength(pp) < pathSize) { + ret = [pp, prefix, false]; + } + else { + // first set prefix to the dir, and path to the base + prefix = node_path_1.posix.dirname(pp); + pp = node_path_1.posix.basename(pp); + do { + if (Buffer.byteLength(pp) <= pathSize && + Buffer.byteLength(prefix) <= prefixSize) { + // both fit! + ret = [pp, prefix, false]; + } + else if (Buffer.byteLength(pp) > pathSize && + Buffer.byteLength(prefix) <= prefixSize) { + // prefix fits in prefix, but path doesn't fit in path + ret = [pp.slice(0, pathSize - 1), prefix, true]; + } + else { + // make path take a bit from prefix + pp = node_path_1.posix.join(node_path_1.posix.basename(prefix), pp); + prefix = node_path_1.posix.dirname(prefix); + } + } while (prefix !== root && ret === undefined); + // at this point, found no resolution, just truncate + if (!ret) { + ret = [p.slice(0, pathSize - 1), '', true]; + } + } + return ret; +}; +const decString = (buf, off, size) => buf + .subarray(off, off + size) + .toString('utf8') + .replace(/\0.*/, ''); +const decDate = (buf, off, size) => numToDate(decNumber(buf, off, size)); +const numToDate = (num) => num === undefined ? undefined : new Date(num * 1000); +const decNumber = (buf, off, size) => Number(buf[off]) & 0x80 ? + large.parse(buf.subarray(off, off + size)) + : decSmallNumber(buf, off, size); +const nanUndef = (value) => (isNaN(value) ? undefined : value); +const decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf + .subarray(off, off + size) + .toString('utf8') + .replace(/\0.*$/, '') + .trim(), 8)); +// the maximum encodable as a null-terminated octal, by field size +const MAXNUM = { + 12: 0o77777777777, + 8: 0o7777777, +}; +const encNumber = (buf, off, size, num) => num === undefined ? false + : num > MAXNUM[size] || num < 0 ? + (large.encode(num, buf.subarray(off, off + size)), true) + : (encSmallNumber(buf, off, size, num), false); +const encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, 'ascii'); +const octalString = (num, size) => padOctal(Math.floor(num).toString(8), size); +const padOctal = (str, size) => (str.length === size - 1 ? + str + : new Array(size - str.length - 1).join('0') + str + ' ') + '\0'; +const encDate = (buf, off, size, date) => date === undefined ? false : (encNumber(buf, off, size, date.getTime() / 1000)); +// enough to fill the longest string we've got +const NULLS = new Array(156).join('\0'); +// pad with nulls, return true if it's longer or non-ascii +const encString = (buf, off, size, str) => str === undefined ? false : ((buf.write(str + NULLS, off, size, 'utf8'), + str.length !== Buffer.byteLength(str) || str.length > size)); +//# sourceMappingURL=header.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/index.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/index.js new file mode 100644 index 00000000..e93ed5ad --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/index.js @@ -0,0 +1,54 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.u = exports.types = exports.r = exports.t = exports.x = exports.c = void 0; +__exportStar(require("./create.js"), exports); +var create_js_1 = require("./create.js"); +Object.defineProperty(exports, "c", { enumerable: true, get: function () { return create_js_1.create; } }); +__exportStar(require("./extract.js"), exports); +var extract_js_1 = require("./extract.js"); +Object.defineProperty(exports, "x", { enumerable: true, get: function () { return extract_js_1.extract; } }); +__exportStar(require("./header.js"), exports); +__exportStar(require("./list.js"), exports); +var list_js_1 = require("./list.js"); +Object.defineProperty(exports, "t", { enumerable: true, get: function () { return list_js_1.list; } }); +// classes +__exportStar(require("./pack.js"), exports); +__exportStar(require("./parse.js"), exports); +__exportStar(require("./pax.js"), exports); +__exportStar(require("./read-entry.js"), exports); +__exportStar(require("./replace.js"), exports); +var replace_js_1 = require("./replace.js"); +Object.defineProperty(exports, "r", { enumerable: true, get: function () { return replace_js_1.replace; } }); +exports.types = __importStar(require("./types.js")); +__exportStar(require("./unpack.js"), exports); +__exportStar(require("./update.js"), exports); +var update_js_1 = require("./update.js"); +Object.defineProperty(exports, "u", { enumerable: true, get: function () { return update_js_1.update; } }); +__exportStar(require("./write-entry.js"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/large-numbers.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/large-numbers.js new file mode 100644 index 00000000..5b07aa7f --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/large-numbers.js @@ -0,0 +1,99 @@ +"use strict"; +// Tar can encode large and negative numbers using a leading byte of +// 0xff for negative, and 0x80 for positive. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parse = exports.encode = void 0; +const encode = (num, buf) => { + if (!Number.isSafeInteger(num)) { + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('cannot encode number outside of javascript safe integer range'); + } + else if (num < 0) { + encodeNegative(num, buf); + } + else { + encodePositive(num, buf); + } + return buf; +}; +exports.encode = encode; +const encodePositive = (num, buf) => { + buf[0] = 0x80; + for (var i = buf.length; i > 1; i--) { + buf[i - 1] = num & 0xff; + num = Math.floor(num / 0x100); + } +}; +const encodeNegative = (num, buf) => { + buf[0] = 0xff; + var flipped = false; + num = num * -1; + for (var i = buf.length; i > 1; i--) { + var byte = num & 0xff; + num = Math.floor(num / 0x100); + if (flipped) { + buf[i - 1] = onesComp(byte); + } + else if (byte === 0) { + buf[i - 1] = 0; + } + else { + flipped = true; + buf[i - 1] = twosComp(byte); + } + } +}; +const parse = (buf) => { + const pre = buf[0]; + const value = pre === 0x80 ? pos(buf.subarray(1, buf.length)) + : pre === 0xff ? twos(buf) + : null; + if (value === null) { + throw Error('invalid base256 encoding'); + } + if (!Number.isSafeInteger(value)) { + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('parsed number outside of javascript safe integer range'); + } + return value; +}; +exports.parse = parse; +const twos = (buf) => { + var len = buf.length; + var sum = 0; + var flipped = false; + for (var i = len - 1; i > -1; i--) { + var byte = Number(buf[i]); + var f; + if (flipped) { + f = onesComp(byte); + } + else if (byte === 0) { + f = byte; + } + else { + flipped = true; + f = twosComp(byte); + } + if (f !== 0) { + sum -= f * Math.pow(256, len - i - 1); + } + } + return sum; +}; +const pos = (buf) => { + var len = buf.length; + var sum = 0; + for (var i = len - 1; i > -1; i--) { + var byte = Number(buf[i]); + if (byte !== 0) { + sum += byte * Math.pow(256, len - i - 1); + } + } + return sum; +}; +const onesComp = (byte) => (0xff ^ byte) & 0xff; +const twosComp = (byte) => ((0xff ^ byte) + 1) & 0xff; +//# sourceMappingURL=large-numbers.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/list.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/list.js new file mode 100644 index 00000000..3cd34bb4 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/list.js @@ -0,0 +1,136 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.list = exports.filesFilter = void 0; +// tar -t +const fsm = __importStar(require("@isaacs/fs-minipass")); +const node_fs_1 = __importDefault(require("node:fs")); +const path_1 = require("path"); +const make_command_js_1 = require("./make-command.js"); +const parse_js_1 = require("./parse.js"); +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); +const onReadEntryFunction = (opt) => { + const onReadEntry = opt.onReadEntry; + opt.onReadEntry = + onReadEntry ? + e => { + onReadEntry(e); + e.resume(); + } + : e => e.resume(); +}; +// construct a filter that limits the file entries listed +// include child entries if a dir is included +const filesFilter = (opt, files) => { + const map = new Map(files.map(f => [(0, strip_trailing_slashes_js_1.stripTrailingSlashes)(f), true])); + const filter = opt.filter; + const mapHas = (file, r = '') => { + const root = r || (0, path_1.parse)(file).root || '.'; + let ret; + if (file === root) + ret = false; + else { + const m = map.get(file); + if (m !== undefined) { + ret = m; + } + else { + ret = mapHas((0, path_1.dirname)(file), root); + } + } + map.set(file, ret); + return ret; + }; + opt.filter = + filter ? + (file, entry) => filter(file, entry) && mapHas((0, strip_trailing_slashes_js_1.stripTrailingSlashes)(file)) + : file => mapHas((0, strip_trailing_slashes_js_1.stripTrailingSlashes)(file)); +}; +exports.filesFilter = filesFilter; +const listFileSync = (opt) => { + const p = new parse_js_1.Parser(opt); + const file = opt.file; + let fd; + try { + const stat = node_fs_1.default.statSync(file); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + if (stat.size < readSize) { + p.end(node_fs_1.default.readFileSync(file)); + } + else { + let pos = 0; + const buf = Buffer.allocUnsafe(readSize); + fd = node_fs_1.default.openSync(file, 'r'); + while (pos < stat.size) { + const bytesRead = node_fs_1.default.readSync(fd, buf, 0, readSize, pos); + pos += bytesRead; + p.write(buf.subarray(0, bytesRead)); + } + p.end(); + } + } + finally { + if (typeof fd === 'number') { + try { + node_fs_1.default.closeSync(fd); + /* c8 ignore next */ + } + catch (er) { } + } + } +}; +const listFile = (opt, _files) => { + const parse = new parse_js_1.Parser(opt); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const file = opt.file; + const p = new Promise((resolve, reject) => { + parse.on('error', reject); + parse.on('end', resolve); + node_fs_1.default.stat(file, (er, stat) => { + if (er) { + reject(er); + } + else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size, + }); + stream.on('error', reject); + stream.pipe(parse); + } + }); + }); + return p; +}; +exports.list = (0, make_command_js_1.makeCommand)(listFileSync, listFile, opt => new parse_js_1.Parser(opt), opt => new parse_js_1.Parser(opt), (opt, files) => { + if (files?.length) + (0, exports.filesFilter)(opt, files); + if (!opt.noResume) + onReadEntryFunction(opt); +}); +//# sourceMappingURL=list.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/make-command.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/make-command.js new file mode 100644 index 00000000..1814319e --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/make-command.js @@ -0,0 +1,61 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeCommand = void 0; +const options_js_1 = require("./options.js"); +const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => { + return Object.assign((opt_ = [], entries, cb) => { + if (Array.isArray(opt_)) { + entries = opt_; + opt_ = {}; + } + if (typeof entries === 'function') { + cb = entries; + entries = undefined; + } + if (!entries) { + entries = []; + } + else { + entries = Array.from(entries); + } + const opt = (0, options_js_1.dealias)(opt_); + validate?.(opt, entries); + if ((0, options_js_1.isSyncFile)(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions'); + } + return syncFile(opt, entries); + } + else if ((0, options_js_1.isAsyncFile)(opt)) { + const p = asyncFile(opt, entries); + // weirdness to make TS happy + const c = cb ? cb : undefined; + return c ? p.then(() => c(), c) : p; + } + else if ((0, options_js_1.isSyncNoFile)(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions'); + } + return syncNoFile(opt, entries); + } + else if ((0, options_js_1.isAsyncNoFile)(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback only supported with file option'); + } + return asyncNoFile(opt, entries); + /* c8 ignore start */ + } + else { + throw new Error('impossible options??'); + } + /* c8 ignore stop */ + }, { + syncFile, + asyncFile, + syncNoFile, + asyncNoFile, + validate, + }); +}; +exports.makeCommand = makeCommand; +//# sourceMappingURL=make-command.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/mkdir.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/mkdir.js new file mode 100644 index 00000000..2b13ecba --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/mkdir.js @@ -0,0 +1,209 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mkdirSync = exports.mkdir = void 0; +const chownr_1 = require("chownr"); +const fs_1 = __importDefault(require("fs")); +const mkdirp_1 = require("mkdirp"); +const node_path_1 = __importDefault(require("node:path")); +const cwd_error_js_1 = require("./cwd-error.js"); +const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); +const symlink_error_js_1 = require("./symlink-error.js"); +const cGet = (cache, key) => cache.get((0, normalize_windows_path_js_1.normalizeWindowsPath)(key)); +const cSet = (cache, key, val) => cache.set((0, normalize_windows_path_js_1.normalizeWindowsPath)(key), val); +const checkCwd = (dir, cb) => { + fs_1.default.stat(dir, (er, st) => { + if (er || !st.isDirectory()) { + er = new cwd_error_js_1.CwdError(dir, er?.code || 'ENOTDIR'); + } + cb(er); + }); +}; +/** + * Wrapper around mkdirp for tar's needs. + * + * The main purpose is to avoid creating directories if we know that + * they already exist (and track which ones exist for this purpose), + * and prevent entries from being extracted into symlinked folders, + * if `preservePaths` is not set. + */ +const mkdir = (dir, opt, cb) => { + dir = (0, normalize_windows_path_js_1.normalizeWindowsPath)(dir); + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + /* c8 ignore next */ + const umask = opt.umask ?? 0o22; + const mode = opt.mode | 0o0700; + const needChmod = (mode & umask) !== 0; + const uid = opt.uid; + const gid = opt.gid; + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + (uid !== opt.processUid || gid !== opt.processGid); + const preserve = opt.preserve; + const unlink = opt.unlink; + const cache = opt.cache; + const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd); + const done = (er, created) => { + if (er) { + cb(er); + } + else { + cSet(cache, dir, true); + if (created && doChown) { + (0, chownr_1.chownr)(created, uid, gid, er => done(er)); + } + else if (needChmod) { + fs_1.default.chmod(dir, mode, cb); + } + else { + cb(); + } + } + }; + if (cache && cGet(cache, dir) === true) { + return done(); + } + if (dir === cwd) { + return checkCwd(dir, done); + } + if (preserve) { + return (0, mkdirp_1.mkdirp)(dir, { mode }).then(made => done(null, made ?? undefined), // oh, ts + done); + } + const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir)); + const parts = sub.split('/'); + mkdir_(cwd, parts, mode, cache, unlink, cwd, undefined, done); +}; +exports.mkdir = mkdir; +const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => { + if (!parts.length) { + return cb(null, created); + } + const p = parts.shift(); + const part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(base + '/' + p)); + if (cGet(cache, part)) { + return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); + } + fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); +}; +const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => { + if (er) { + fs_1.default.lstat(part, (statEr, st) => { + if (statEr) { + statEr.path = + statEr.path && (0, normalize_windows_path_js_1.normalizeWindowsPath)(statEr.path); + cb(statEr); + } + else if (st.isDirectory()) { + mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); + } + else if (unlink) { + fs_1.default.unlink(part, er => { + if (er) { + return cb(er); + } + fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); + }); + } + else if (st.isSymbolicLink()) { + return cb(new symlink_error_js_1.SymlinkError(part, part + '/' + parts.join('/'))); + } + else { + cb(er); + } + }); + } + else { + created = created || part; + mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); + } +}; +const checkCwdSync = (dir) => { + let ok = false; + let code = undefined; + try { + ok = fs_1.default.statSync(dir).isDirectory(); + } + catch (er) { + code = er?.code; + } + finally { + if (!ok) { + throw new cwd_error_js_1.CwdError(dir, code ?? 'ENOTDIR'); + } + } +}; +const mkdirSync = (dir, opt) => { + dir = (0, normalize_windows_path_js_1.normalizeWindowsPath)(dir); + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + /* c8 ignore next */ + const umask = opt.umask ?? 0o22; + const mode = opt.mode | 0o700; + const needChmod = (mode & umask) !== 0; + const uid = opt.uid; + const gid = opt.gid; + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + (uid !== opt.processUid || gid !== opt.processGid); + const preserve = opt.preserve; + const unlink = opt.unlink; + const cache = opt.cache; + const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd); + const done = (created) => { + cSet(cache, dir, true); + if (created && doChown) { + (0, chownr_1.chownrSync)(created, uid, gid); + } + if (needChmod) { + fs_1.default.chmodSync(dir, mode); + } + }; + if (cache && cGet(cache, dir) === true) { + return done(); + } + if (dir === cwd) { + checkCwdSync(cwd); + return done(); + } + if (preserve) { + return done((0, mkdirp_1.mkdirpSync)(dir, mode) ?? undefined); + } + const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir)); + const parts = sub.split('/'); + let created = undefined; + for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) { + part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(part)); + if (cGet(cache, part)) { + continue; + } + try { + fs_1.default.mkdirSync(part, mode); + created = created || part; + cSet(cache, part, true); + } + catch (er) { + const st = fs_1.default.lstatSync(part); + if (st.isDirectory()) { + cSet(cache, part, true); + continue; + } + else if (unlink) { + fs_1.default.unlinkSync(part); + fs_1.default.mkdirSync(part, mode); + created = created || part; + cSet(cache, part, true); + continue; + } + else if (st.isSymbolicLink()) { + return new symlink_error_js_1.SymlinkError(part, part + '/' + parts.join('/')); + } + } + } + return done(created); +}; +exports.mkdirSync = mkdirSync; +//# sourceMappingURL=mkdir.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/mode-fix.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/mode-fix.js new file mode 100644 index 00000000..49dd7279 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/mode-fix.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.modeFix = void 0; +const modeFix = (mode, isDir, portable) => { + mode &= 0o7777; + // in portable mode, use the minimum reasonable umask + // if this system creates files with 0o664 by default + // (as some linux distros do), then we'll write the + // archive with 0o644 instead. Also, don't ever create + // a file that is not readable/writable by the owner. + if (portable) { + mode = (mode | 0o600) & ~0o22; + } + // if dirs are readable, then they should be listable + if (isDir) { + if (mode & 0o400) { + mode |= 0o100; + } + if (mode & 0o40) { + mode |= 0o10; + } + if (mode & 0o4) { + mode |= 0o1; + } + } + return mode; +}; +exports.modeFix = modeFix; +//# sourceMappingURL=mode-fix.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/normalize-unicode.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/normalize-unicode.js new file mode 100644 index 00000000..2f08ce46 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/normalize-unicode.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizeUnicode = void 0; +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +const normalizeCache = Object.create(null); +const { hasOwnProperty } = Object.prototype; +const normalizeUnicode = (s) => { + if (!hasOwnProperty.call(normalizeCache, s)) { + normalizeCache[s] = s.normalize('NFD'); + } + return normalizeCache[s]; +}; +exports.normalizeUnicode = normalizeUnicode; +//# sourceMappingURL=normalize-unicode.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/normalize-windows-path.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/normalize-windows-path.js new file mode 100644 index 00000000..b0c7aaa9 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/normalize-windows-path.js @@ -0,0 +1,12 @@ +"use strict"; +// on windows, either \ or / are valid directory separators. +// on unix, \ is a valid character in filenames. +// so, on windows, and only on windows, we replace all \ chars with /, +// so that we can use / as our one and only directory separator char. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizeWindowsPath = void 0; +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +exports.normalizeWindowsPath = platform !== 'win32' ? + (p) => p + : (p) => p && p.replace(/\\/g, '/'); +//# sourceMappingURL=normalize-windows-path.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/options.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/options.js new file mode 100644 index 00000000..4cd06505 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/options.js @@ -0,0 +1,66 @@ +"use strict"; +// turn tar(1) style args like `C` into the more verbose things like `cwd` +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dealias = exports.isNoFile = exports.isFile = exports.isAsync = exports.isSync = exports.isAsyncNoFile = exports.isSyncNoFile = exports.isAsyncFile = exports.isSyncFile = void 0; +const argmap = new Map([ + ['C', 'cwd'], + ['f', 'file'], + ['z', 'gzip'], + ['P', 'preservePaths'], + ['U', 'unlink'], + ['strip-components', 'strip'], + ['stripComponents', 'strip'], + ['keep-newer', 'newer'], + ['keepNewer', 'newer'], + ['keep-newer-files', 'newer'], + ['keepNewerFiles', 'newer'], + ['k', 'keep'], + ['keep-existing', 'keep'], + ['keepExisting', 'keep'], + ['m', 'noMtime'], + ['no-mtime', 'noMtime'], + ['p', 'preserveOwner'], + ['L', 'follow'], + ['h', 'follow'], + ['onentry', 'onReadEntry'], +]); +const isSyncFile = (o) => !!o.sync && !!o.file; +exports.isSyncFile = isSyncFile; +const isAsyncFile = (o) => !o.sync && !!o.file; +exports.isAsyncFile = isAsyncFile; +const isSyncNoFile = (o) => !!o.sync && !o.file; +exports.isSyncNoFile = isSyncNoFile; +const isAsyncNoFile = (o) => !o.sync && !o.file; +exports.isAsyncNoFile = isAsyncNoFile; +const isSync = (o) => !!o.sync; +exports.isSync = isSync; +const isAsync = (o) => !o.sync; +exports.isAsync = isAsync; +const isFile = (o) => !!o.file; +exports.isFile = isFile; +const isNoFile = (o) => !o.file; +exports.isNoFile = isNoFile; +const dealiasKey = (k) => { + const d = argmap.get(k); + if (d) + return d; + return k; +}; +const dealias = (opt = {}) => { + if (!opt) + return {}; + const result = {}; + for (const [key, v] of Object.entries(opt)) { + // TS doesn't know that aliases are going to always be the same type + const k = dealiasKey(key); + result[k] = v; + } + // affordance for deprecated noChmod -> chmod + if (result.chmod === undefined && result.noChmod === false) { + result.chmod = true; + } + delete result.noChmod; + return result; +}; +exports.dealias = dealias; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/pack.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/pack.js new file mode 100644 index 00000000..303e9306 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/pack.js @@ -0,0 +1,477 @@ +"use strict"; +// A readable tar stream creator +// Technically, this is a transform stream that you write paths into, +// and tar format comes out of. +// The `add()` method is like `write()` but returns this, +// and end() return `this` as well, so you can +// do `new Pack(opt).add('files').add('dir').end().pipe(output) +// You could also do something like: +// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar')) +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PackSync = exports.Pack = exports.PackJob = void 0; +const fs_1 = __importDefault(require("fs")); +const write_entry_js_1 = require("./write-entry.js"); +class PackJob { + path; + absolute; + entry; + stat; + readdir; + pending = false; + ignore = false; + piped = false; + constructor(path, absolute) { + this.path = path || './'; + this.absolute = absolute; + } +} +exports.PackJob = PackJob; +const minipass_1 = require("minipass"); +const zlib = __importStar(require("minizlib")); +const yallist_1 = require("yallist"); +const read_entry_js_1 = require("./read-entry.js"); +const warn_method_js_1 = require("./warn-method.js"); +const EOF = Buffer.alloc(1024); +const ONSTAT = Symbol('onStat'); +const ENDED = Symbol('ended'); +const QUEUE = Symbol('queue'); +const CURRENT = Symbol('current'); +const PROCESS = Symbol('process'); +const PROCESSING = Symbol('processing'); +const PROCESSJOB = Symbol('processJob'); +const JOBS = Symbol('jobs'); +const JOBDONE = Symbol('jobDone'); +const ADDFSENTRY = Symbol('addFSEntry'); +const ADDTARENTRY = Symbol('addTarEntry'); +const STAT = Symbol('stat'); +const READDIR = Symbol('readdir'); +const ONREADDIR = Symbol('onreaddir'); +const PIPE = Symbol('pipe'); +const ENTRY = Symbol('entry'); +const ENTRYOPT = Symbol('entryOpt'); +const WRITEENTRYCLASS = Symbol('writeEntryClass'); +const WRITE = Symbol('write'); +const ONDRAIN = Symbol('ondrain'); +const path_1 = __importDefault(require("path")); +const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); +class Pack extends minipass_1.Minipass { + opt; + cwd; + maxReadSize; + preservePaths; + strict; + noPax; + prefix; + linkCache; + statCache; + file; + portable; + zip; + readdirCache; + noDirRecurse; + follow; + noMtime; + mtime; + filter; + jobs; + [WRITEENTRYCLASS]; + onWriteEntry; + [QUEUE]; + [JOBS] = 0; + [PROCESSING] = false; + [ENDED] = false; + constructor(opt = {}) { + //@ts-ignore + super(); + this.opt = opt; + this.file = opt.file || ''; + this.cwd = opt.cwd || process.cwd(); + this.maxReadSize = opt.maxReadSize; + this.preservePaths = !!opt.preservePaths; + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.prefix = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.prefix || ''); + this.linkCache = opt.linkCache || new Map(); + this.statCache = opt.statCache || new Map(); + this.readdirCache = opt.readdirCache || new Map(); + this.onWriteEntry = opt.onWriteEntry; + this[WRITEENTRYCLASS] = write_entry_js_1.WriteEntry; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + this.portable = !!opt.portable; + if (opt.gzip || opt.brotli) { + if (opt.gzip && opt.brotli) { + throw new TypeError('gzip and brotli are mutually exclusive'); + } + if (opt.gzip) { + if (typeof opt.gzip !== 'object') { + opt.gzip = {}; + } + if (this.portable) { + opt.gzip.portable = true; + } + this.zip = new zlib.Gzip(opt.gzip); + } + if (opt.brotli) { + if (typeof opt.brotli !== 'object') { + opt.brotli = {}; + } + this.zip = new zlib.BrotliCompress(opt.brotli); + } + /* c8 ignore next */ + if (!this.zip) + throw new Error('impossible'); + const zip = this.zip; + zip.on('data', chunk => super.write(chunk)); + zip.on('end', () => super.end()); + zip.on('drain', () => this[ONDRAIN]()); + this.on('resume', () => zip.resume()); + } + else { + this.on('drain', this[ONDRAIN]); + } + this.noDirRecurse = !!opt.noDirRecurse; + this.follow = !!opt.follow; + this.noMtime = !!opt.noMtime; + if (opt.mtime) + this.mtime = opt.mtime; + this.filter = + typeof opt.filter === 'function' ? opt.filter : () => true; + this[QUEUE] = new yallist_1.Yallist(); + this[JOBS] = 0; + this.jobs = Number(opt.jobs) || 4; + this[PROCESSING] = false; + this[ENDED] = false; + } + [WRITE](chunk) { + return super.write(chunk); + } + add(path) { + this.write(path); + return this; + } + end(path, encoding, cb) { + /* c8 ignore start */ + if (typeof path === 'function') { + cb = path; + path = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + /* c8 ignore stop */ + if (path) { + this.add(path); + } + this[ENDED] = true; + this[PROCESS](); + /* c8 ignore next */ + if (cb) + cb(); + return this; + } + write(path) { + if (this[ENDED]) { + throw new Error('write after end'); + } + if (path instanceof read_entry_js_1.ReadEntry) { + this[ADDTARENTRY](path); + } + else { + this[ADDFSENTRY](path); + } + return this.flowing; + } + [ADDTARENTRY](p) { + const absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.resolve(this.cwd, p.path)); + // in this case, we don't have to wait for the stat + if (!this.filter(p.path, p)) { + p.resume(); + } + else { + const job = new PackJob(p.path, absolute); + job.entry = new write_entry_js_1.WriteEntryTar(p, this[ENTRYOPT](job)); + job.entry.on('end', () => this[JOBDONE](job)); + this[JOBS] += 1; + this[QUEUE].push(job); + } + this[PROCESS](); + } + [ADDFSENTRY](p) { + const absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.resolve(this.cwd, p)); + this[QUEUE].push(new PackJob(p, absolute)); + this[PROCESS](); + } + [STAT](job) { + job.pending = true; + this[JOBS] += 1; + const stat = this.follow ? 'stat' : 'lstat'; + fs_1.default[stat](job.absolute, (er, stat) => { + job.pending = false; + this[JOBS] -= 1; + if (er) { + this.emit('error', er); + } + else { + this[ONSTAT](job, stat); + } + }); + } + [ONSTAT](job, stat) { + this.statCache.set(job.absolute, stat); + job.stat = stat; + // now we have the stat, we can filter it. + if (!this.filter(job.path, stat)) { + job.ignore = true; + } + this[PROCESS](); + } + [READDIR](job) { + job.pending = true; + this[JOBS] += 1; + fs_1.default.readdir(job.absolute, (er, entries) => { + job.pending = false; + this[JOBS] -= 1; + if (er) { + return this.emit('error', er); + } + this[ONREADDIR](job, entries); + }); + } + [ONREADDIR](job, entries) { + this.readdirCache.set(job.absolute, entries); + job.readdir = entries; + this[PROCESS](); + } + [PROCESS]() { + if (this[PROCESSING]) { + return; + } + this[PROCESSING] = true; + for (let w = this[QUEUE].head; !!w && this[JOBS] < this.jobs; w = w.next) { + this[PROCESSJOB](w.value); + if (w.value.ignore) { + const p = w.next; + this[QUEUE].removeNode(w); + w.next = p; + } + } + this[PROCESSING] = false; + if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) { + if (this.zip) { + this.zip.end(EOF); + } + else { + super.write(EOF); + super.end(); + } + } + } + get [CURRENT]() { + return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value; + } + [JOBDONE](_job) { + this[QUEUE].shift(); + this[JOBS] -= 1; + this[PROCESS](); + } + [PROCESSJOB](job) { + if (job.pending) { + return; + } + if (job.entry) { + if (job === this[CURRENT] && !job.piped) { + this[PIPE](job); + } + return; + } + if (!job.stat) { + const sc = this.statCache.get(job.absolute); + if (sc) { + this[ONSTAT](job, sc); + } + else { + this[STAT](job); + } + } + if (!job.stat) { + return; + } + // filtered out! + if (job.ignore) { + return; + } + if (!this.noDirRecurse && + job.stat.isDirectory() && + !job.readdir) { + const rc = this.readdirCache.get(job.absolute); + if (rc) { + this[ONREADDIR](job, rc); + } + else { + this[READDIR](job); + } + if (!job.readdir) { + return; + } + } + // we know it doesn't have an entry, because that got checked above + job.entry = this[ENTRY](job); + if (!job.entry) { + job.ignore = true; + return; + } + if (job === this[CURRENT] && !job.piped) { + this[PIPE](job); + } + } + [ENTRYOPT](job) { + return { + onwarn: (code, msg, data) => this.warn(code, msg, data), + noPax: this.noPax, + cwd: this.cwd, + absolute: job.absolute, + preservePaths: this.preservePaths, + maxReadSize: this.maxReadSize, + strict: this.strict, + portable: this.portable, + linkCache: this.linkCache, + statCache: this.statCache, + noMtime: this.noMtime, + mtime: this.mtime, + prefix: this.prefix, + onWriteEntry: this.onWriteEntry, + }; + } + [ENTRY](job) { + this[JOBS] += 1; + try { + const e = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)); + return e + .on('end', () => this[JOBDONE](job)) + .on('error', er => this.emit('error', er)); + } + catch (er) { + this.emit('error', er); + } + } + [ONDRAIN]() { + if (this[CURRENT] && this[CURRENT].entry) { + this[CURRENT].entry.resume(); + } + } + // like .pipe() but using super, because our write() is special + [PIPE](job) { + job.piped = true; + if (job.readdir) { + job.readdir.forEach(entry => { + const p = job.path; + const base = p === './' ? '' : p.replace(/\/*$/, '/'); + this[ADDFSENTRY](base + entry); + }); + } + const source = job.entry; + const zip = this.zip; + /* c8 ignore start */ + if (!source) + throw new Error('cannot pipe without source'); + /* c8 ignore stop */ + if (zip) { + source.on('data', chunk => { + if (!zip.write(chunk)) { + source.pause(); + } + }); + } + else { + source.on('data', chunk => { + if (!super.write(chunk)) { + source.pause(); + } + }); + } + } + pause() { + if (this.zip) { + this.zip.pause(); + } + return super.pause(); + } + warn(code, message, data = {}) { + (0, warn_method_js_1.warnMethod)(this, code, message, data); + } +} +exports.Pack = Pack; +class PackSync extends Pack { + sync = true; + constructor(opt) { + super(opt); + this[WRITEENTRYCLASS] = write_entry_js_1.WriteEntrySync; + } + // pause/resume are no-ops in sync streams. + pause() { } + resume() { } + [STAT](job) { + const stat = this.follow ? 'statSync' : 'lstatSync'; + this[ONSTAT](job, fs_1.default[stat](job.absolute)); + } + [READDIR](job) { + this[ONREADDIR](job, fs_1.default.readdirSync(job.absolute)); + } + // gotta get it all in this tick + [PIPE](job) { + const source = job.entry; + const zip = this.zip; + if (job.readdir) { + job.readdir.forEach(entry => { + const p = job.path; + const base = p === './' ? '' : p.replace(/\/*$/, '/'); + this[ADDFSENTRY](base + entry); + }); + } + /* c8 ignore start */ + if (!source) + throw new Error('Cannot pipe without source'); + /* c8 ignore stop */ + if (zip) { + source.on('data', chunk => { + zip.write(chunk); + }); + } + else { + source.on('data', chunk => { + super[WRITE](chunk); + }); + } + } +} +exports.PackSync = PackSync; +//# sourceMappingURL=pack.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/package.json b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/parse.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/parse.js new file mode 100644 index 00000000..9746a258 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/parse.js @@ -0,0 +1,599 @@ +"use strict"; +// this[BUFFER] is the remainder of a chunk if we're waiting for +// the full 512 bytes of a header to come in. We will Buffer.concat() +// it to the next write(), which is a mem copy, but a small one. +// +// this[QUEUE] is a Yallist of entries that haven't been emitted +// yet this can only get filled up if the user keeps write()ing after +// a write() returns false, or does a write() with more than one entry +// +// We don't buffer chunks, we always parse them and either create an +// entry, or push it into the active entry. The ReadEntry class knows +// to throw data away if .ignore=true +// +// Shift entry off the buffer when it emits 'end', and emit 'entry' for +// the next one in the list. +// +// At any time, we're pushing body chunks into the entry at WRITEENTRY, +// and waiting for 'end' on the entry at READENTRY +// +// ignored entries get .resume() called on them straight away +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Parser = void 0; +const events_1 = require("events"); +const minizlib_1 = require("minizlib"); +const yallist_1 = require("yallist"); +const header_js_1 = require("./header.js"); +const pax_js_1 = require("./pax.js"); +const read_entry_js_1 = require("./read-entry.js"); +const warn_method_js_1 = require("./warn-method.js"); +const maxMetaEntrySize = 1024 * 1024; +const gzipHeader = Buffer.from([0x1f, 0x8b]); +const STATE = Symbol('state'); +const WRITEENTRY = Symbol('writeEntry'); +const READENTRY = Symbol('readEntry'); +const NEXTENTRY = Symbol('nextEntry'); +const PROCESSENTRY = Symbol('processEntry'); +const EX = Symbol('extendedHeader'); +const GEX = Symbol('globalExtendedHeader'); +const META = Symbol('meta'); +const EMITMETA = Symbol('emitMeta'); +const BUFFER = Symbol('buffer'); +const QUEUE = Symbol('queue'); +const ENDED = Symbol('ended'); +const EMITTEDEND = Symbol('emittedEnd'); +const EMIT = Symbol('emit'); +const UNZIP = Symbol('unzip'); +const CONSUMECHUNK = Symbol('consumeChunk'); +const CONSUMECHUNKSUB = Symbol('consumeChunkSub'); +const CONSUMEBODY = Symbol('consumeBody'); +const CONSUMEMETA = Symbol('consumeMeta'); +const CONSUMEHEADER = Symbol('consumeHeader'); +const CONSUMING = Symbol('consuming'); +const BUFFERCONCAT = Symbol('bufferConcat'); +const MAYBEEND = Symbol('maybeEnd'); +const WRITING = Symbol('writing'); +const ABORTED = Symbol('aborted'); +const DONE = Symbol('onDone'); +const SAW_VALID_ENTRY = Symbol('sawValidEntry'); +const SAW_NULL_BLOCK = Symbol('sawNullBlock'); +const SAW_EOF = Symbol('sawEOF'); +const CLOSESTREAM = Symbol('closeStream'); +const noop = () => true; +class Parser extends events_1.EventEmitter { + file; + strict; + maxMetaEntrySize; + filter; + brotli; + writable = true; + readable = false; + [QUEUE] = new yallist_1.Yallist(); + [BUFFER]; + [READENTRY]; + [WRITEENTRY]; + [STATE] = 'begin'; + [META] = ''; + [EX]; + [GEX]; + [ENDED] = false; + [UNZIP]; + [ABORTED] = false; + [SAW_VALID_ENTRY]; + [SAW_NULL_BLOCK] = false; + [SAW_EOF] = false; + [WRITING] = false; + [CONSUMING] = false; + [EMITTEDEND] = false; + constructor(opt = {}) { + super(); + this.file = opt.file || ''; + // these BADARCHIVE errors can't be detected early. listen on DONE. + this.on(DONE, () => { + if (this[STATE] === 'begin' || + this[SAW_VALID_ENTRY] === false) { + // either less than 1 block of data, or all entries were invalid. + // Either way, probably not even a tarball. + this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format'); + } + }); + if (opt.ondone) { + this.on(DONE, opt.ondone); + } + else { + this.on(DONE, () => { + this.emit('prefinish'); + this.emit('finish'); + this.emit('end'); + }); + } + this.strict = !!opt.strict; + this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize; + this.filter = typeof opt.filter === 'function' ? opt.filter : noop; + // Unlike gzip, brotli doesn't have any magic bytes to identify it + // Users need to explicitly tell us they're extracting a brotli file + // Or we infer from the file extension + const isTBR = opt.file && + (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')); + // if it's a tbr file it MIGHT be brotli, but we don't know until + // we look at it and verify it's not a valid tar file. + this.brotli = + !opt.gzip && opt.brotli !== undefined ? opt.brotli + : isTBR ? undefined + : false; + // have to set this so that streams are ok piping into it + this.on('end', () => this[CLOSESTREAM]()); + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + if (typeof opt.onReadEntry === 'function') { + this.on('entry', opt.onReadEntry); + } + } + warn(code, message, data = {}) { + (0, warn_method_js_1.warnMethod)(this, code, message, data); + } + [CONSUMEHEADER](chunk, position) { + if (this[SAW_VALID_ENTRY] === undefined) { + this[SAW_VALID_ENTRY] = false; + } + let header; + try { + header = new header_js_1.Header(chunk, position, this[EX], this[GEX]); + } + catch (er) { + return this.warn('TAR_ENTRY_INVALID', er); + } + if (header.nullBlock) { + if (this[SAW_NULL_BLOCK]) { + this[SAW_EOF] = true; + // ending an archive with no entries. pointless, but legal. + if (this[STATE] === 'begin') { + this[STATE] = 'header'; + } + this[EMIT]('eof'); + } + else { + this[SAW_NULL_BLOCK] = true; + this[EMIT]('nullBlock'); + } + } + else { + this[SAW_NULL_BLOCK] = false; + if (!header.cksumValid) { + this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header }); + } + else if (!header.path) { + this.warn('TAR_ENTRY_INVALID', 'path is required', { header }); + } + else { + const type = header.type; + if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) { + this.warn('TAR_ENTRY_INVALID', 'linkpath required', { + header, + }); + } + else if (!/^(Symbolic)?Link$/.test(type) && + !/^(Global)?ExtendedHeader$/.test(type) && + header.linkpath) { + this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', { + header, + }); + } + else { + const entry = (this[WRITEENTRY] = new read_entry_js_1.ReadEntry(header, this[EX], this[GEX])); + // we do this for meta & ignored entries as well, because they + // are still valid tar, or else we wouldn't know to ignore them + if (!this[SAW_VALID_ENTRY]) { + if (entry.remain) { + // this might be the one! + const onend = () => { + if (!entry.invalid) { + this[SAW_VALID_ENTRY] = true; + } + }; + entry.on('end', onend); + } + else { + this[SAW_VALID_ENTRY] = true; + } + } + if (entry.meta) { + if (entry.size > this.maxMetaEntrySize) { + entry.ignore = true; + this[EMIT]('ignoredEntry', entry); + this[STATE] = 'ignore'; + entry.resume(); + } + else if (entry.size > 0) { + this[META] = ''; + entry.on('data', c => (this[META] += c)); + this[STATE] = 'meta'; + } + } + else { + this[EX] = undefined; + entry.ignore = + entry.ignore || !this.filter(entry.path, entry); + if (entry.ignore) { + // probably valid, just not something we care about + this[EMIT]('ignoredEntry', entry); + this[STATE] = entry.remain ? 'ignore' : 'header'; + entry.resume(); + } + else { + if (entry.remain) { + this[STATE] = 'body'; + } + else { + this[STATE] = 'header'; + entry.end(); + } + if (!this[READENTRY]) { + this[QUEUE].push(entry); + this[NEXTENTRY](); + } + else { + this[QUEUE].push(entry); + } + } + } + } + } + } + } + [CLOSESTREAM]() { + queueMicrotask(() => this.emit('close')); + } + [PROCESSENTRY](entry) { + let go = true; + if (!entry) { + this[READENTRY] = undefined; + go = false; + } + else if (Array.isArray(entry)) { + const [ev, ...args] = entry; + this.emit(ev, ...args); + } + else { + this[READENTRY] = entry; + this.emit('entry', entry); + if (!entry.emittedEnd) { + entry.on('end', () => this[NEXTENTRY]()); + go = false; + } + } + return go; + } + [NEXTENTRY]() { + do { } while (this[PROCESSENTRY](this[QUEUE].shift())); + if (!this[QUEUE].length) { + // At this point, there's nothing in the queue, but we may have an + // entry which is being consumed (readEntry). + // If we don't, then we definitely can handle more data. + // If we do, and either it's flowing, or it has never had any data + // written to it, then it needs more. + // The only other possibility is that it has returned false from a + // write() call, so we wait for the next drain to continue. + const re = this[READENTRY]; + const drainNow = !re || re.flowing || re.size === re.remain; + if (drainNow) { + if (!this[WRITING]) { + this.emit('drain'); + } + } + else { + re.once('drain', () => this.emit('drain')); + } + } + } + [CONSUMEBODY](chunk, position) { + // write up to but no more than writeEntry.blockRemain + const entry = this[WRITEENTRY]; + /* c8 ignore start */ + if (!entry) { + throw new Error('attempt to consume body without entry??'); + } + const br = entry.blockRemain ?? 0; + /* c8 ignore stop */ + const c = br >= chunk.length && position === 0 ? + chunk + : chunk.subarray(position, position + br); + entry.write(c); + if (!entry.blockRemain) { + this[STATE] = 'header'; + this[WRITEENTRY] = undefined; + entry.end(); + } + return c.length; + } + [CONSUMEMETA](chunk, position) { + const entry = this[WRITEENTRY]; + const ret = this[CONSUMEBODY](chunk, position); + // if we finished, then the entry is reset + if (!this[WRITEENTRY] && entry) { + this[EMITMETA](entry); + } + return ret; + } + [EMIT](ev, data, extra) { + if (!this[QUEUE].length && !this[READENTRY]) { + this.emit(ev, data, extra); + } + else { + this[QUEUE].push([ev, data, extra]); + } + } + [EMITMETA](entry) { + this[EMIT]('meta', this[META]); + switch (entry.type) { + case 'ExtendedHeader': + case 'OldExtendedHeader': + this[EX] = pax_js_1.Pax.parse(this[META], this[EX], false); + break; + case 'GlobalExtendedHeader': + this[GEX] = pax_js_1.Pax.parse(this[META], this[GEX], true); + break; + case 'NextFileHasLongPath': + case 'OldGnuLongPath': { + const ex = this[EX] ?? Object.create(null); + this[EX] = ex; + ex.path = this[META].replace(/\0.*/, ''); + break; + } + case 'NextFileHasLongLinkpath': { + const ex = this[EX] || Object.create(null); + this[EX] = ex; + ex.linkpath = this[META].replace(/\0.*/, ''); + break; + } + /* c8 ignore start */ + default: + throw new Error('unknown meta: ' + entry.type); + /* c8 ignore stop */ + } + } + abort(error) { + this[ABORTED] = true; + this.emit('abort', error); + // always throws, even in non-strict mode + this.warn('TAR_ABORT', error, { recoverable: false }); + } + write(chunk, encoding, cb) { + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, + /* c8 ignore next */ + typeof encoding === 'string' ? encoding : 'utf8'); + } + if (this[ABORTED]) { + /* c8 ignore next */ + cb?.(); + return false; + } + // first write, might be gzipped + const needSniff = this[UNZIP] === undefined || + (this.brotli === undefined && this[UNZIP] === false); + if (needSniff && chunk) { + if (this[BUFFER]) { + chunk = Buffer.concat([this[BUFFER], chunk]); + this[BUFFER] = undefined; + } + if (chunk.length < gzipHeader.length) { + this[BUFFER] = chunk; + /* c8 ignore next */ + cb?.(); + return true; + } + // look for gzip header + for (let i = 0; this[UNZIP] === undefined && i < gzipHeader.length; i++) { + if (chunk[i] !== gzipHeader[i]) { + this[UNZIP] = false; + } + } + const maybeBrotli = this.brotli === undefined; + if (this[UNZIP] === false && maybeBrotli) { + // read the first header to see if it's a valid tar file. If so, + // we can safely assume that it's not actually brotli, despite the + // .tbr or .tar.br file extension. + // if we ended before getting a full chunk, yes, def brotli + if (chunk.length < 512) { + if (this[ENDED]) { + this.brotli = true; + } + else { + this[BUFFER] = chunk; + /* c8 ignore next */ + cb?.(); + return true; + } + } + else { + // if it's tar, it's pretty reliably not brotli, chances of + // that happening are astronomical. + try { + new header_js_1.Header(chunk.subarray(0, 512)); + this.brotli = false; + } + catch (_) { + this.brotli = true; + } + } + } + if (this[UNZIP] === undefined || + (this[UNZIP] === false && this.brotli)) { + const ended = this[ENDED]; + this[ENDED] = false; + this[UNZIP] = + this[UNZIP] === undefined ? + new minizlib_1.Unzip({}) + : new minizlib_1.BrotliDecompress({}); + this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)); + this[UNZIP].on('error', er => this.abort(er)); + this[UNZIP].on('end', () => { + this[ENDED] = true; + this[CONSUMECHUNK](); + }); + this[WRITING] = true; + const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk); + this[WRITING] = false; + cb?.(); + return ret; + } + } + this[WRITING] = true; + if (this[UNZIP]) { + this[UNZIP].write(chunk); + } + else { + this[CONSUMECHUNK](chunk); + } + this[WRITING] = false; + // return false if there's a queue, or if the current entry isn't flowing + const ret = this[QUEUE].length ? false + : this[READENTRY] ? this[READENTRY].flowing + : true; + // if we have no queue, then that means a clogged READENTRY + if (!ret && !this[QUEUE].length) { + this[READENTRY]?.once('drain', () => this.emit('drain')); + } + /* c8 ignore next */ + cb?.(); + return ret; + } + [BUFFERCONCAT](c) { + if (c && !this[ABORTED]) { + this[BUFFER] = + this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c; + } + } + [MAYBEEND]() { + if (this[ENDED] && + !this[EMITTEDEND] && + !this[ABORTED] && + !this[CONSUMING]) { + this[EMITTEDEND] = true; + const entry = this[WRITEENTRY]; + if (entry && entry.blockRemain) { + // truncated, likely a damaged file + const have = this[BUFFER] ? this[BUFFER].length : 0; + this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry }); + if (this[BUFFER]) { + entry.write(this[BUFFER]); + } + entry.end(); + } + this[EMIT](DONE); + } + } + [CONSUMECHUNK](chunk) { + if (this[CONSUMING] && chunk) { + this[BUFFERCONCAT](chunk); + } + else if (!chunk && !this[BUFFER]) { + this[MAYBEEND](); + } + else if (chunk) { + this[CONSUMING] = true; + if (this[BUFFER]) { + this[BUFFERCONCAT](chunk); + const c = this[BUFFER]; + this[BUFFER] = undefined; + this[CONSUMECHUNKSUB](c); + } + else { + this[CONSUMECHUNKSUB](chunk); + } + while (this[BUFFER] && + this[BUFFER]?.length >= 512 && + !this[ABORTED] && + !this[SAW_EOF]) { + const c = this[BUFFER]; + this[BUFFER] = undefined; + this[CONSUMECHUNKSUB](c); + } + this[CONSUMING] = false; + } + if (!this[BUFFER] || this[ENDED]) { + this[MAYBEEND](); + } + } + [CONSUMECHUNKSUB](chunk) { + // we know that we are in CONSUMING mode, so anything written goes into + // the buffer. Advance the position and put any remainder in the buffer. + let position = 0; + const length = chunk.length; + while (position + 512 <= length && + !this[ABORTED] && + !this[SAW_EOF]) { + switch (this[STATE]) { + case 'begin': + case 'header': + this[CONSUMEHEADER](chunk, position); + position += 512; + break; + case 'ignore': + case 'body': + position += this[CONSUMEBODY](chunk, position); + break; + case 'meta': + position += this[CONSUMEMETA](chunk, position); + break; + /* c8 ignore start */ + default: + throw new Error('invalid state: ' + this[STATE]); + /* c8 ignore stop */ + } + } + if (position < length) { + if (this[BUFFER]) { + this[BUFFER] = Buffer.concat([ + chunk.subarray(position), + this[BUFFER], + ]); + } + else { + this[BUFFER] = chunk.subarray(position); + } + } + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + if (cb) + this.once('finish', cb); + if (!this[ABORTED]) { + if (this[UNZIP]) { + /* c8 ignore start */ + if (chunk) + this[UNZIP].write(chunk); + /* c8 ignore stop */ + this[UNZIP].end(); + } + else { + this[ENDED] = true; + if (this.brotli === undefined) + chunk = chunk || Buffer.alloc(0); + if (chunk) + this.write(chunk); + this[MAYBEEND](); + } + } + return this; + } +} +exports.Parser = Parser; +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/path-reservations.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/path-reservations.js new file mode 100644 index 00000000..9ff391c4 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/path-reservations.js @@ -0,0 +1,170 @@ +"use strict"; +// A path exclusive reservation system +// reserve([list, of, paths], fn) +// When the fn is first in line for all its paths, it +// is called with a cb that clears the reservation. +// +// Used by async unpack to avoid clobbering paths in use, +// while still allowing maximal safe parallelization. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PathReservations = void 0; +const node_path_1 = require("node:path"); +const normalize_unicode_js_1 = require("./normalize-unicode.js"); +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +const isWindows = platform === 'win32'; +// return a set of parent dirs for a given path +// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d'] +const getDirs = (path) => { + const dirs = path + .split('/') + .slice(0, -1) + .reduce((set, path) => { + const s = set[set.length - 1]; + if (s !== undefined) { + path = (0, node_path_1.join)(s, path); + } + set.push(path || '/'); + return set; + }, []); + return dirs; +}; +class PathReservations { + // path => [function or Set] + // A Set object means a directory reservation + // A fn is a direct reservation on that path + #queues = new Map(); + // fn => {paths:[path,...], dirs:[path, ...]} + #reservations = new Map(); + // functions currently running + #running = new Set(); + reserve(paths, fn) { + paths = + isWindows ? + ['win32 parallelization disabled'] + : paths.map(p => { + // don't need normPath, because we skip this entirely for windows + return (0, strip_trailing_slashes_js_1.stripTrailingSlashes)((0, node_path_1.join)((0, normalize_unicode_js_1.normalizeUnicode)(p))).toLowerCase(); + }); + const dirs = new Set(paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b))); + this.#reservations.set(fn, { dirs, paths }); + for (const p of paths) { + const q = this.#queues.get(p); + if (!q) { + this.#queues.set(p, [fn]); + } + else { + q.push(fn); + } + } + for (const dir of dirs) { + const q = this.#queues.get(dir); + if (!q) { + this.#queues.set(dir, [new Set([fn])]); + } + else { + const l = q[q.length - 1]; + if (l instanceof Set) { + l.add(fn); + } + else { + q.push(new Set([fn])); + } + } + } + return this.#run(fn); + } + // return the queues for each path the function cares about + // fn => {paths, dirs} + #getQueues(fn) { + const res = this.#reservations.get(fn); + /* c8 ignore start */ + if (!res) { + throw new Error('function does not have any path reservations'); + } + /* c8 ignore stop */ + return { + paths: res.paths.map((path) => this.#queues.get(path)), + dirs: [...res.dirs].map(path => this.#queues.get(path)), + }; + } + // check if fn is first in line for all its paths, and is + // included in the first set for all its dir queues + check(fn) { + const { paths, dirs } = this.#getQueues(fn); + return (paths.every(q => q && q[0] === fn) && + dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))); + } + // run the function if it's first in line and not already running + #run(fn) { + if (this.#running.has(fn) || !this.check(fn)) { + return false; + } + this.#running.add(fn); + fn(() => this.#clear(fn)); + return true; + } + #clear(fn) { + if (!this.#running.has(fn)) { + return false; + } + const res = this.#reservations.get(fn); + /* c8 ignore start */ + if (!res) { + throw new Error('invalid reservation'); + } + /* c8 ignore stop */ + const { paths, dirs } = res; + const next = new Set(); + for (const path of paths) { + const q = this.#queues.get(path); + /* c8 ignore start */ + if (!q || q?.[0] !== fn) { + continue; + } + /* c8 ignore stop */ + const q0 = q[1]; + if (!q0) { + this.#queues.delete(path); + continue; + } + q.shift(); + if (typeof q0 === 'function') { + next.add(q0); + } + else { + for (const f of q0) { + next.add(f); + } + } + } + for (const dir of dirs) { + const q = this.#queues.get(dir); + const q0 = q?.[0]; + /* c8 ignore next - type safety only */ + if (!q || !(q0 instanceof Set)) + continue; + if (q0.size === 1 && q.length === 1) { + this.#queues.delete(dir); + continue; + } + else if (q0.size === 1) { + q.shift(); + // next one must be a function, + // or else the Set would've been reused + const n = q[0]; + if (typeof n === 'function') { + next.add(n); + } + } + else { + q0.delete(fn); + } + } + this.#running.delete(fn); + next.forEach(fn => this.#run(fn)); + return true; + } +} +exports.PathReservations = PathReservations; +//# sourceMappingURL=path-reservations.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/pax.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/pax.js new file mode 100644 index 00000000..d30c0f3e --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/pax.js @@ -0,0 +1,158 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Pax = void 0; +const node_path_1 = require("node:path"); +const header_js_1 = require("./header.js"); +class Pax { + atime; + mtime; + ctime; + charset; + comment; + gid; + uid; + gname; + uname; + linkpath; + dev; + ino; + nlink; + path; + size; + mode; + global; + constructor(obj, global = false) { + this.atime = obj.atime; + this.charset = obj.charset; + this.comment = obj.comment; + this.ctime = obj.ctime; + this.dev = obj.dev; + this.gid = obj.gid; + this.global = global; + this.gname = obj.gname; + this.ino = obj.ino; + this.linkpath = obj.linkpath; + this.mtime = obj.mtime; + this.nlink = obj.nlink; + this.path = obj.path; + this.size = obj.size; + this.uid = obj.uid; + this.uname = obj.uname; + } + encode() { + const body = this.encodeBody(); + if (body === '') { + return Buffer.allocUnsafe(0); + } + const bodyLen = Buffer.byteLength(body); + // round up to 512 bytes + // add 512 for header + const bufLen = 512 * Math.ceil(1 + bodyLen / 512); + const buf = Buffer.allocUnsafe(bufLen); + // 0-fill the header section, it might not hit every field + for (let i = 0; i < 512; i++) { + buf[i] = 0; + } + new header_js_1.Header({ + // XXX split the path + // then the path should be PaxHeader + basename, but less than 99, + // prepend with the dirname + /* c8 ignore start */ + path: ('PaxHeader/' + (0, node_path_1.basename)(this.path ?? '')).slice(0, 99), + /* c8 ignore stop */ + mode: this.mode || 0o644, + uid: this.uid, + gid: this.gid, + size: bodyLen, + mtime: this.mtime, + type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader', + linkpath: '', + uname: this.uname || '', + gname: this.gname || '', + devmaj: 0, + devmin: 0, + atime: this.atime, + ctime: this.ctime, + }).encode(buf); + buf.write(body, 512, bodyLen, 'utf8'); + // null pad after the body + for (let i = bodyLen + 512; i < buf.length; i++) { + buf[i] = 0; + } + return buf; + } + encodeBody() { + return (this.encodeField('path') + + this.encodeField('ctime') + + this.encodeField('atime') + + this.encodeField('dev') + + this.encodeField('ino') + + this.encodeField('nlink') + + this.encodeField('charset') + + this.encodeField('comment') + + this.encodeField('gid') + + this.encodeField('gname') + + this.encodeField('linkpath') + + this.encodeField('mtime') + + this.encodeField('size') + + this.encodeField('uid') + + this.encodeField('uname')); + } + encodeField(field) { + if (this[field] === undefined) { + return ''; + } + const r = this[field]; + const v = r instanceof Date ? r.getTime() / 1000 : r; + const s = ' ' + + (field === 'dev' || field === 'ino' || field === 'nlink' ? + 'SCHILY.' + : '') + + field + + '=' + + v + + '\n'; + const byteLen = Buffer.byteLength(s); + // the digits includes the length of the digits in ascii base-10 + // so if it's 9 characters, then adding 1 for the 9 makes it 10 + // which makes it 11 chars. + let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1; + if (byteLen + digits >= Math.pow(10, digits)) { + digits += 1; + } + const len = digits + byteLen; + return len + s; + } + static parse(str, ex, g = false) { + return new Pax(merge(parseKV(str), ex), g); + } +} +exports.Pax = Pax; +const merge = (a, b) => b ? Object.assign({}, b, a) : a; +const parseKV = (str) => str + .replace(/\n$/, '') + .split('\n') + .reduce(parseKVLine, Object.create(null)); +const parseKVLine = (set, line) => { + const n = parseInt(line, 10); + // XXX Values with \n in them will fail this. + // Refactor to not be a naive line-by-line parse. + if (n !== Buffer.byteLength(line) + 1) { + return set; + } + line = line.slice((n + ' ').length); + const kv = line.split('='); + const r = kv.shift(); + if (!r) { + return set; + } + const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1'); + const v = kv.join('='); + set[k] = + /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? + new Date(Number(v) * 1000) + : /^[0-9]+$/.test(v) ? +v + : v; + return set; +}; +//# sourceMappingURL=pax.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/read-entry.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/read-entry.js new file mode 100644 index 00000000..15e2d55c --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/read-entry.js @@ -0,0 +1,140 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReadEntry = void 0; +const minipass_1 = require("minipass"); +const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); +class ReadEntry extends minipass_1.Minipass { + extended; + globalExtended; + header; + startBlockSize; + blockRemain; + remain; + type; + meta = false; + ignore = false; + path; + mode; + uid; + gid; + uname; + gname; + size = 0; + mtime; + atime; + ctime; + linkpath; + dev; + ino; + nlink; + invalid = false; + absolute; + unsupported = false; + constructor(header, ex, gex) { + super({}); + // read entries always start life paused. this is to avoid the + // situation where Minipass's auto-ending empty streams results + // in an entry ending before we're ready for it. + this.pause(); + this.extended = ex; + this.globalExtended = gex; + this.header = header; + /* c8 ignore start */ + this.remain = header.size ?? 0; + /* c8 ignore stop */ + this.startBlockSize = 512 * Math.ceil(this.remain / 512); + this.blockRemain = this.startBlockSize; + this.type = header.type; + switch (this.type) { + case 'File': + case 'OldFile': + case 'Link': + case 'SymbolicLink': + case 'CharacterDevice': + case 'BlockDevice': + case 'Directory': + case 'FIFO': + case 'ContiguousFile': + case 'GNUDumpDir': + break; + case 'NextFileHasLongLinkpath': + case 'NextFileHasLongPath': + case 'OldGnuLongPath': + case 'GlobalExtendedHeader': + case 'ExtendedHeader': + case 'OldExtendedHeader': + this.meta = true; + break; + // NOTE: gnutar and bsdtar treat unrecognized types as 'File' + // it may be worth doing the same, but with a warning. + default: + this.ignore = true; + } + /* c8 ignore start */ + if (!header.path) { + throw new Error('no path provided for tar.ReadEntry'); + } + /* c8 ignore stop */ + this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(header.path); + this.mode = header.mode; + if (this.mode) { + this.mode = this.mode & 0o7777; + } + this.uid = header.uid; + this.gid = header.gid; + this.uname = header.uname; + this.gname = header.gname; + this.size = this.remain; + this.mtime = header.mtime; + this.atime = header.atime; + this.ctime = header.ctime; + /* c8 ignore start */ + this.linkpath = + header.linkpath ? + (0, normalize_windows_path_js_1.normalizeWindowsPath)(header.linkpath) + : undefined; + /* c8 ignore stop */ + this.uname = header.uname; + this.gname = header.gname; + if (ex) { + this.#slurp(ex); + } + if (gex) { + this.#slurp(gex, true); + } + } + write(data) { + const writeLen = data.length; + if (writeLen > this.blockRemain) { + throw new Error('writing more to entry than is appropriate'); + } + const r = this.remain; + const br = this.blockRemain; + this.remain = Math.max(0, r - writeLen); + this.blockRemain = Math.max(0, br - writeLen); + if (this.ignore) { + return true; + } + if (r >= writeLen) { + return super.write(data); + } + // r < writeLen + return super.write(data.subarray(0, r)); + } + #slurp(ex, gex = false) { + if (ex.path) + ex.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(ex.path); + if (ex.linkpath) + ex.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(ex.linkpath); + Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. Also, any + // null/undefined values are ignored. + return !(v === null || + v === undefined || + (k === 'path' && gex)); + }))); + } +} +exports.ReadEntry = ReadEntry; +//# sourceMappingURL=read-entry.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/replace.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/replace.js new file mode 100644 index 00000000..262deecd --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/replace.js @@ -0,0 +1,231 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.replace = void 0; +// tar -r +const fs_minipass_1 = require("@isaacs/fs-minipass"); +const node_fs_1 = __importDefault(require("node:fs")); +const node_path_1 = __importDefault(require("node:path")); +const header_js_1 = require("./header.js"); +const list_js_1 = require("./list.js"); +const make_command_js_1 = require("./make-command.js"); +const options_js_1 = require("./options.js"); +const pack_js_1 = require("./pack.js"); +// starting at the head of the file, read a Header +// If the checksum is invalid, that's our position to start writing +// If it is, jump forward by the specified size (round up to 512) +// and try again. +// Write the new Pack stream starting there. +const replaceSync = (opt, files) => { + const p = new pack_js_1.PackSync(opt); + let threw = true; + let fd; + let position; + try { + try { + fd = node_fs_1.default.openSync(opt.file, 'r+'); + } + catch (er) { + if (er?.code === 'ENOENT') { + fd = node_fs_1.default.openSync(opt.file, 'w+'); + } + else { + throw er; + } + } + const st = node_fs_1.default.fstatSync(fd); + const headBuf = Buffer.alloc(512); + POSITION: for (position = 0; position < st.size; position += 512) { + for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { + bytes = node_fs_1.default.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos); + if (position === 0 && + headBuf[0] === 0x1f && + headBuf[1] === 0x8b) { + throw new Error('cannot append to compressed archives'); + } + if (!bytes) { + break POSITION; + } + } + const h = new header_js_1.Header(headBuf); + if (!h.cksumValid) { + break; + } + const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512); + if (position + entryBlockSize + 512 > st.size) { + break; + } + // the 512 for the header we just parsed will be added as well + // also jump ahead all the blocks for the body + position += entryBlockSize; + if (opt.mtimeCache && h.mtime) { + opt.mtimeCache.set(String(h.path), h.mtime); + } + } + threw = false; + streamSync(opt, p, position, fd, files); + } + finally { + if (threw) { + try { + node_fs_1.default.closeSync(fd); + } + catch (er) { } + } + } +}; +const streamSync = (opt, p, position, fd, files) => { + const stream = new fs_minipass_1.WriteStreamSync(opt.file, { + fd: fd, + start: position, + }); + p.pipe(stream); + addFilesSync(p, files); +}; +const replaceAsync = (opt, files) => { + files = Array.from(files); + const p = new pack_js_1.Pack(opt); + const getPos = (fd, size, cb_) => { + const cb = (er, pos) => { + if (er) { + node_fs_1.default.close(fd, _ => cb_(er)); + } + else { + cb_(null, pos); + } + }; + let position = 0; + if (size === 0) { + return cb(null, 0); + } + let bufPos = 0; + const headBuf = Buffer.alloc(512); + const onread = (er, bytes) => { + if (er || typeof bytes === 'undefined') { + return cb(er); + } + bufPos += bytes; + if (bufPos < 512 && bytes) { + return node_fs_1.default.read(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos, onread); + } + if (position === 0 && + headBuf[0] === 0x1f && + headBuf[1] === 0x8b) { + return cb(new Error('cannot append to compressed archives')); + } + // truncated header + if (bufPos < 512) { + return cb(null, position); + } + const h = new header_js_1.Header(headBuf); + if (!h.cksumValid) { + return cb(null, position); + } + /* c8 ignore next */ + const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512); + if (position + entryBlockSize + 512 > size) { + return cb(null, position); + } + position += entryBlockSize + 512; + if (position >= size) { + return cb(null, position); + } + if (opt.mtimeCache && h.mtime) { + opt.mtimeCache.set(String(h.path), h.mtime); + } + bufPos = 0; + node_fs_1.default.read(fd, headBuf, 0, 512, position, onread); + }; + node_fs_1.default.read(fd, headBuf, 0, 512, position, onread); + }; + const promise = new Promise((resolve, reject) => { + p.on('error', reject); + let flag = 'r+'; + const onopen = (er, fd) => { + if (er && er.code === 'ENOENT' && flag === 'r+') { + flag = 'w+'; + return node_fs_1.default.open(opt.file, flag, onopen); + } + if (er || !fd) { + return reject(er); + } + node_fs_1.default.fstat(fd, (er, st) => { + if (er) { + return node_fs_1.default.close(fd, () => reject(er)); + } + getPos(fd, st.size, (er, position) => { + if (er) { + return reject(er); + } + const stream = new fs_minipass_1.WriteStream(opt.file, { + fd: fd, + start: position, + }); + p.pipe(stream); + stream.on('error', reject); + stream.on('close', resolve); + addFilesAsync(p, files); + }); + }); + }; + node_fs_1.default.open(opt.file, flag, onopen); + }); + return promise; +}; +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') { + (0, list_js_1.list)({ + file: node_path_1.default.resolve(p.cwd, file.slice(1)), + sync: true, + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + }); + p.end(); +}; +const addFilesAsync = async (p, files) => { + for (let i = 0; i < files.length; i++) { + const file = String(files[i]); + if (file.charAt(0) === '@') { + await (0, list_js_1.list)({ + file: node_path_1.default.resolve(String(p.cwd), file.slice(1)), + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + } + p.end(); +}; +exports.replace = (0, make_command_js_1.makeCommand)(replaceSync, replaceAsync, +/* c8 ignore start */ +() => { + throw new TypeError('file is required'); +}, () => { + throw new TypeError('file is required'); +}, +/* c8 ignore stop */ +(opt, entries) => { + if (!(0, options_js_1.isFile)(opt)) { + throw new TypeError('file is required'); + } + if (opt.gzip || + opt.brotli || + opt.file.endsWith('.br') || + opt.file.endsWith('.tbr')) { + throw new TypeError('cannot append to compressed archives'); + } + if (!entries?.length) { + throw new TypeError('no paths specified to add/replace'); + } +}); +//# sourceMappingURL=replace.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/strip-absolute-path.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/strip-absolute-path.js new file mode 100644 index 00000000..bb7639c3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/strip-absolute-path.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.stripAbsolutePath = void 0; +// unix absolute paths are also absolute on win32, so we use this for both +const node_path_1 = require("node:path"); +const { isAbsolute, parse } = node_path_1.win32; +// returns [root, stripped] +// Note that windows will think that //x/y/z/a has a "root" of //x/y, and in +// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip / +// explicitly if it's the first character. +// drive-specific relative paths on Windows get their root stripped off even +// though they are not absolute, so `c:../foo` becomes ['c:', '../foo'] +const stripAbsolutePath = (path) => { + let r = ''; + let parsed = parse(path); + while (isAbsolute(path) || parsed.root) { + // windows will think that //x/y/z has a "root" of //x/y/ + // but strip the //?/C:/ off of //?/C:/path + const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ? + '/' + : parsed.root; + path = path.slice(root.length); + r += root; + parsed = parse(path); + } + return [r, path]; +}; +exports.stripAbsolutePath = stripAbsolutePath; +//# sourceMappingURL=strip-absolute-path.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/strip-trailing-slashes.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/strip-trailing-slashes.js new file mode 100644 index 00000000..6fa74ad6 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/strip-trailing-slashes.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.stripTrailingSlashes = void 0; +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +const stripTrailingSlashes = (str) => { + let i = str.length - 1; + let slashesStart = -1; + while (i > -1 && str.charAt(i) === '/') { + slashesStart = i; + i--; + } + return slashesStart === -1 ? str : str.slice(0, slashesStart); +}; +exports.stripTrailingSlashes = stripTrailingSlashes; +//# sourceMappingURL=strip-trailing-slashes.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/symlink-error.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/symlink-error.js new file mode 100644 index 00000000..cc19ac1a --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/symlink-error.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SymlinkError = void 0; +class SymlinkError extends Error { + path; + symlink; + syscall = 'symlink'; + code = 'TAR_SYMLINK_ERROR'; + constructor(symlink, path) { + super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link'); + this.symlink = symlink; + this.path = path; + } + get name() { + return 'SymlinkError'; + } +} +exports.SymlinkError = SymlinkError; +//# sourceMappingURL=symlink-error.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/types.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/types.js new file mode 100644 index 00000000..cb9b684e --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/types.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.code = exports.name = exports.isName = exports.isCode = void 0; +const isCode = (c) => exports.name.has(c); +exports.isCode = isCode; +const isName = (c) => exports.code.has(c); +exports.isName = isName; +// map types from key to human-friendly name +exports.name = new Map([ + ['0', 'File'], + // same as File + ['', 'OldFile'], + ['1', 'Link'], + ['2', 'SymbolicLink'], + // Devices and FIFOs aren't fully supported + // they are parsed, but skipped when unpacking + ['3', 'CharacterDevice'], + ['4', 'BlockDevice'], + ['5', 'Directory'], + ['6', 'FIFO'], + // same as File + ['7', 'ContiguousFile'], + // pax headers + ['g', 'GlobalExtendedHeader'], + ['x', 'ExtendedHeader'], + // vendor-specific stuff + // skip + ['A', 'SolarisACL'], + // like 5, but with data, which should be skipped + ['D', 'GNUDumpDir'], + // metadata only, skip + ['I', 'Inode'], + // data = link path of next file + ['K', 'NextFileHasLongLinkpath'], + // data = path of next file + ['L', 'NextFileHasLongPath'], + // skip + ['M', 'ContinuationFile'], + // like L + ['N', 'OldGnuLongPath'], + // skip + ['S', 'SparseFile'], + // skip + ['V', 'TapeVolumeHeader'], + // like x + ['X', 'OldExtendedHeader'], +]); +// map the other direction +exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]])); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/unpack.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/unpack.js new file mode 100644 index 00000000..edf8acbb --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/unpack.js @@ -0,0 +1,919 @@ +"use strict"; +// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet. +// but the path reservations are required to avoid race conditions where +// parallelized unpack ops may mess with one another, due to dependencies +// (like a Link depending on its target) or destructive operations (like +// clobbering an fs object to create one of a different type.) +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UnpackSync = exports.Unpack = void 0; +const fsm = __importStar(require("@isaacs/fs-minipass")); +const node_assert_1 = __importDefault(require("node:assert")); +const node_crypto_1 = require("node:crypto"); +const node_fs_1 = __importDefault(require("node:fs")); +const node_path_1 = __importDefault(require("node:path")); +const get_write_flag_js_1 = require("./get-write-flag.js"); +const mkdir_js_1 = require("./mkdir.js"); +const normalize_unicode_js_1 = require("./normalize-unicode.js"); +const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); +const parse_js_1 = require("./parse.js"); +const strip_absolute_path_js_1 = require("./strip-absolute-path.js"); +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); +const wc = __importStar(require("./winchars.js")); +const path_reservations_js_1 = require("./path-reservations.js"); +const ONENTRY = Symbol('onEntry'); +const CHECKFS = Symbol('checkFs'); +const CHECKFS2 = Symbol('checkFs2'); +const PRUNECACHE = Symbol('pruneCache'); +const ISREUSABLE = Symbol('isReusable'); +const MAKEFS = Symbol('makeFs'); +const FILE = Symbol('file'); +const DIRECTORY = Symbol('directory'); +const LINK = Symbol('link'); +const SYMLINK = Symbol('symlink'); +const HARDLINK = Symbol('hardlink'); +const UNSUPPORTED = Symbol('unsupported'); +const CHECKPATH = Symbol('checkPath'); +const MKDIR = Symbol('mkdir'); +const ONERROR = Symbol('onError'); +const PENDING = Symbol('pending'); +const PEND = Symbol('pend'); +const UNPEND = Symbol('unpend'); +const ENDED = Symbol('ended'); +const MAYBECLOSE = Symbol('maybeClose'); +const SKIP = Symbol('skip'); +const DOCHOWN = Symbol('doChown'); +const UID = Symbol('uid'); +const GID = Symbol('gid'); +const CHECKED_CWD = Symbol('checkedCwd'); +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +const isWindows = platform === 'win32'; +const DEFAULT_MAX_DEPTH = 1024; +// Unlinks on Windows are not atomic. +// +// This means that if you have a file entry, followed by another +// file entry with an identical name, and you cannot re-use the file +// (because it's a hardlink, or because unlink:true is set, or it's +// Windows, which does not have useful nlink values), then the unlink +// will be committed to the disk AFTER the new file has been written +// over the old one, deleting the new file. +// +// To work around this, on Windows systems, we rename the file and then +// delete the renamed file. It's a sloppy kludge, but frankly, I do not +// know of a better way to do this, given windows' non-atomic unlink +// semantics. +// +// See: https://github.com/npm/node-tar/issues/183 +/* c8 ignore start */ +const unlinkFile = (path, cb) => { + if (!isWindows) { + return node_fs_1.default.unlink(path, cb); + } + const name = path + '.DELETE.' + (0, node_crypto_1.randomBytes)(16).toString('hex'); + node_fs_1.default.rename(path, name, er => { + if (er) { + return cb(er); + } + node_fs_1.default.unlink(name, cb); + }); +}; +/* c8 ignore stop */ +/* c8 ignore start */ +const unlinkFileSync = (path) => { + if (!isWindows) { + return node_fs_1.default.unlinkSync(path); + } + const name = path + '.DELETE.' + (0, node_crypto_1.randomBytes)(16).toString('hex'); + node_fs_1.default.renameSync(path, name); + node_fs_1.default.unlinkSync(name); +}; +/* c8 ignore stop */ +// this.gid, entry.gid, this.processUid +const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a + : b !== undefined && b === b >>> 0 ? b + : c; +// clear the cache if it's a case-insensitive unicode-squashing match. +// we can't know if the current file system is case-sensitive or supports +// unicode fully, so we check for similarity on the maximally compatible +// representation. Err on the side of pruning, since all it's doing is +// preventing lstats, and it's not the end of the world if we get a false +// positive. +// Note that on windows, we always drop the entire cache whenever a +// symbolic link is encountered, because 8.3 filenames are impossible +// to reason about, and collisions are hazards rather than just failures. +const cacheKeyNormalize = (path) => (0, strip_trailing_slashes_js_1.stripTrailingSlashes)((0, normalize_windows_path_js_1.normalizeWindowsPath)((0, normalize_unicode_js_1.normalizeUnicode)(path))).toLowerCase(); +// remove all cache entries matching ${abs}/** +const pruneCache = (cache, abs) => { + abs = cacheKeyNormalize(abs); + for (const path of cache.keys()) { + const pnorm = cacheKeyNormalize(path); + if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) { + cache.delete(path); + } + } +}; +const dropCache = (cache) => { + for (const key of cache.keys()) { + cache.delete(key); + } +}; +class Unpack extends parse_js_1.Parser { + [ENDED] = false; + [CHECKED_CWD] = false; + [PENDING] = 0; + reservations = new path_reservations_js_1.PathReservations(); + transform; + writable = true; + readable = false; + dirCache; + uid; + gid; + setOwner; + preserveOwner; + processGid; + processUid; + maxDepth; + forceChown; + win32; + newer; + keep; + noMtime; + preservePaths; + unlink; + cwd; + strip; + processUmask; + umask; + dmode; + fmode; + chmod; + constructor(opt = {}) { + opt.ondone = () => { + this[ENDED] = true; + this[MAYBECLOSE](); + }; + super(opt); + this.transform = opt.transform; + this.dirCache = opt.dirCache || new Map(); + this.chmod = !!opt.chmod; + if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { + // need both or neither + if (typeof opt.uid !== 'number' || + typeof opt.gid !== 'number') { + throw new TypeError('cannot set owner without number uid and gid'); + } + if (opt.preserveOwner) { + throw new TypeError('cannot preserve owner in archive and also set owner explicitly'); + } + this.uid = opt.uid; + this.gid = opt.gid; + this.setOwner = true; + } + else { + this.uid = undefined; + this.gid = undefined; + this.setOwner = false; + } + // default true for root + if (opt.preserveOwner === undefined && + typeof opt.uid !== 'number') { + this.preserveOwner = !!(process.getuid && process.getuid() === 0); + } + else { + this.preserveOwner = !!opt.preserveOwner; + } + this.processUid = + (this.preserveOwner || this.setOwner) && process.getuid ? + process.getuid() + : undefined; + this.processGid = + (this.preserveOwner || this.setOwner) && process.getgid ? + process.getgid() + : undefined; + // prevent excessively deep nesting of subfolders + // set to `Infinity` to remove this restriction + this.maxDepth = + typeof opt.maxDepth === 'number' ? + opt.maxDepth + : DEFAULT_MAX_DEPTH; + // mostly just for testing, but useful in some cases. + // Forcibly trigger a chown on every entry, no matter what + this.forceChown = opt.forceChown === true; + // turn > this[ONENTRY](entry)); + } + // a bad or damaged archive is a warning for Parser, but an error + // when extracting. Mark those errors as unrecoverable, because + // the Unpack contract cannot be met. + warn(code, msg, data = {}) { + if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') { + data.recoverable = false; + } + return super.warn(code, msg, data); + } + [MAYBECLOSE]() { + if (this[ENDED] && this[PENDING] === 0) { + this.emit('prefinish'); + this.emit('finish'); + this.emit('end'); + } + } + [CHECKPATH](entry) { + const p = (0, normalize_windows_path_js_1.normalizeWindowsPath)(entry.path); + const parts = p.split('/'); + if (this.strip) { + if (parts.length < this.strip) { + return false; + } + if (entry.type === 'Link') { + const linkparts = (0, normalize_windows_path_js_1.normalizeWindowsPath)(String(entry.linkpath)).split('/'); + if (linkparts.length >= this.strip) { + entry.linkpath = linkparts.slice(this.strip).join('/'); + } + else { + return false; + } + } + parts.splice(0, this.strip); + entry.path = parts.join('/'); + } + if (isFinite(this.maxDepth) && parts.length > this.maxDepth) { + this.warn('TAR_ENTRY_ERROR', 'path excessively deep', { + entry, + path: p, + depth: parts.length, + maxDepth: this.maxDepth, + }); + return false; + } + if (!this.preservePaths) { + if (parts.includes('..') || + /* c8 ignore next */ + (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) { + this.warn('TAR_ENTRY_ERROR', `path contains '..'`, { + entry, + path: p, + }); + return false; + } + // strip off the root + const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(p); + if (root) { + entry.path = String(stripped); + this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, { + entry, + path: p, + }); + } + } + if (node_path_1.default.isAbsolute(entry.path)) { + entry.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(entry.path)); + } + else { + entry.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(this.cwd, entry.path)); + } + // if we somehow ended up with a path that escapes the cwd, and we are + // not in preservePaths mode, then something is fishy! This should have + // been prevented above, so ignore this for coverage. + /* c8 ignore start - defense in depth */ + if (!this.preservePaths && + typeof entry.absolute === 'string' && + entry.absolute.indexOf(this.cwd + '/') !== 0 && + entry.absolute !== this.cwd) { + this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', { + entry, + path: (0, normalize_windows_path_js_1.normalizeWindowsPath)(entry.path), + resolvedPath: entry.absolute, + cwd: this.cwd, + }); + return false; + } + /* c8 ignore stop */ + // an archive can set properties on the extraction directory, but it + // may not replace the cwd with a different kind of thing entirely. + if (entry.absolute === this.cwd && + entry.type !== 'Directory' && + entry.type !== 'GNUDumpDir') { + return false; + } + // only encode : chars that aren't drive letter indicators + if (this.win32) { + const { root: aRoot } = node_path_1.default.win32.parse(String(entry.absolute)); + entry.absolute = + aRoot + wc.encode(String(entry.absolute).slice(aRoot.length)); + const { root: pRoot } = node_path_1.default.win32.parse(entry.path); + entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length)); + } + return true; + } + [ONENTRY](entry) { + if (!this[CHECKPATH](entry)) { + return entry.resume(); + } + node_assert_1.default.equal(typeof entry.absolute, 'string'); + switch (entry.type) { + case 'Directory': + case 'GNUDumpDir': + if (entry.mode) { + entry.mode = entry.mode | 0o700; + } + // eslint-disable-next-line no-fallthrough + case 'File': + case 'OldFile': + case 'ContiguousFile': + case 'Link': + case 'SymbolicLink': + return this[CHECKFS](entry); + case 'CharacterDevice': + case 'BlockDevice': + case 'FIFO': + default: + return this[UNSUPPORTED](entry); + } + } + [ONERROR](er, entry) { + // Cwd has to exist, or else nothing works. That's serious. + // Other errors are warnings, which raise the error in strict + // mode, but otherwise continue on. + if (er.name === 'CwdError') { + this.emit('error', er); + } + else { + this.warn('TAR_ENTRY_ERROR', er, { entry }); + this[UNPEND](); + entry.resume(); + } + } + [MKDIR](dir, mode, cb) { + (0, mkdir_js_1.mkdir)((0, normalize_windows_path_js_1.normalizeWindowsPath)(dir), { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cache: this.dirCache, + cwd: this.cwd, + mode: mode, + }, cb); + } + [DOCHOWN](entry) { + // in preserve owner mode, chown if the entry doesn't match process + // in set owner mode, chown if setting doesn't match process + return (this.forceChown || + (this.preserveOwner && + ((typeof entry.uid === 'number' && + entry.uid !== this.processUid) || + (typeof entry.gid === 'number' && + entry.gid !== this.processGid))) || + (typeof this.uid === 'number' && + this.uid !== this.processUid) || + (typeof this.gid === 'number' && this.gid !== this.processGid)); + } + [UID](entry) { + return uint32(this.uid, entry.uid, this.processUid); + } + [GID](entry) { + return uint32(this.gid, entry.gid, this.processGid); + } + [FILE](entry, fullyDone) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.fmode; + const stream = new fsm.WriteStream(String(entry.absolute), { + // slight lie, but it can be numeric flags + flags: (0, get_write_flag_js_1.getWriteFlag)(entry.size), + mode: mode, + autoClose: false, + }); + stream.on('error', (er) => { + if (stream.fd) { + node_fs_1.default.close(stream.fd, () => { }); + } + // flush all the data out so that we aren't left hanging + // if the error wasn't actually fatal. otherwise the parse + // is blocked, and we never proceed. + stream.write = () => true; + this[ONERROR](er, entry); + fullyDone(); + }); + let actions = 1; + const done = (er) => { + if (er) { + /* c8 ignore start - we should always have a fd by now */ + if (stream.fd) { + node_fs_1.default.close(stream.fd, () => { }); + } + /* c8 ignore stop */ + this[ONERROR](er, entry); + fullyDone(); + return; + } + if (--actions === 0) { + if (stream.fd !== undefined) { + node_fs_1.default.close(stream.fd, er => { + if (er) { + this[ONERROR](er, entry); + } + else { + this[UNPEND](); + } + fullyDone(); + }); + } + } + }; + stream.on('finish', () => { + // if futimes fails, try utimes + // if utimes fails, fail with the original error + // same for fchown/chown + const abs = String(entry.absolute); + const fd = stream.fd; + if (typeof fd === 'number' && entry.mtime && !this.noMtime) { + actions++; + const atime = entry.atime || new Date(); + const mtime = entry.mtime; + node_fs_1.default.futimes(fd, atime, mtime, er => er ? + node_fs_1.default.utimes(abs, atime, mtime, er2 => done(er2 && er)) + : done()); + } + if (typeof fd === 'number' && this[DOCHOWN](entry)) { + actions++; + const uid = this[UID](entry); + const gid = this[GID](entry); + if (typeof uid === 'number' && typeof gid === 'number') { + node_fs_1.default.fchown(fd, uid, gid, er => er ? + node_fs_1.default.chown(abs, uid, gid, er2 => done(er2 && er)) + : done()); + } + } + done(); + }); + const tx = this.transform ? this.transform(entry) || entry : entry; + if (tx !== entry) { + tx.on('error', (er) => { + this[ONERROR](er, entry); + fullyDone(); + }); + entry.pipe(tx); + } + tx.pipe(stream); + } + [DIRECTORY](entry, fullyDone) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.dmode; + this[MKDIR](String(entry.absolute), mode, er => { + if (er) { + this[ONERROR](er, entry); + fullyDone(); + return; + } + let actions = 1; + const done = () => { + if (--actions === 0) { + fullyDone(); + this[UNPEND](); + entry.resume(); + } + }; + if (entry.mtime && !this.noMtime) { + actions++; + node_fs_1.default.utimes(String(entry.absolute), entry.atime || new Date(), entry.mtime, done); + } + if (this[DOCHOWN](entry)) { + actions++; + node_fs_1.default.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done); + } + done(); + }); + } + [UNSUPPORTED](entry) { + entry.unsupported = true; + this.warn('TAR_ENTRY_UNSUPPORTED', `unsupported entry type: ${entry.type}`, { entry }); + entry.resume(); + } + [SYMLINK](entry, done) { + this[LINK](entry, String(entry.linkpath), 'symlink', done); + } + [HARDLINK](entry, done) { + const linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(this.cwd, String(entry.linkpath))); + this[LINK](entry, linkpath, 'link', done); + } + [PEND]() { + this[PENDING]++; + } + [UNPEND]() { + this[PENDING]--; + this[MAYBECLOSE](); + } + [SKIP](entry) { + this[UNPEND](); + entry.resume(); + } + // Check if we can reuse an existing filesystem entry safely and + // overwrite it, rather than unlinking and recreating + // Windows doesn't report a useful nlink, so we just never reuse entries + [ISREUSABLE](entry, st) { + return (entry.type === 'File' && + !this.unlink && + st.isFile() && + st.nlink <= 1 && + !isWindows); + } + // check if a thing is there, and if so, try to clobber it + [CHECKFS](entry) { + this[PEND](); + const paths = [entry.path]; + if (entry.linkpath) { + paths.push(entry.linkpath); + } + this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)); + } + [PRUNECACHE](entry) { + // if we are not creating a directory, and the path is in the dirCache, + // then that means we are about to delete the directory we created + // previously, and it is no longer going to be a directory, and neither + // is any of its children. + // If a symbolic link is encountered, all bets are off. There is no + // reasonable way to sanitize the cache in such a way we will be able to + // avoid having filesystem collisions. If this happens with a non-symlink + // entry, it'll just fail to unpack, but a symlink to a directory, using an + // 8.3 shortname or certain unicode attacks, can evade detection and lead + // to arbitrary writes to anywhere on the system. + if (entry.type === 'SymbolicLink') { + dropCache(this.dirCache); + } + else if (entry.type !== 'Directory') { + pruneCache(this.dirCache, String(entry.absolute)); + } + } + [CHECKFS2](entry, fullyDone) { + this[PRUNECACHE](entry); + const done = (er) => { + this[PRUNECACHE](entry); + fullyDone(er); + }; + const checkCwd = () => { + this[MKDIR](this.cwd, this.dmode, er => { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + this[CHECKED_CWD] = true; + start(); + }); + }; + const start = () => { + if (entry.absolute !== this.cwd) { + const parent = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.dirname(String(entry.absolute))); + if (parent !== this.cwd) { + return this[MKDIR](parent, this.dmode, er => { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + afterMakeParent(); + }); + } + } + afterMakeParent(); + }; + const afterMakeParent = () => { + node_fs_1.default.lstat(String(entry.absolute), (lstatEr, st) => { + if (st && + (this.keep || + /* c8 ignore next */ + (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { + this[SKIP](entry); + done(); + return; + } + if (lstatEr || this[ISREUSABLE](entry, st)) { + return this[MAKEFS](null, entry, done); + } + if (st.isDirectory()) { + if (entry.type === 'Directory') { + const needChmod = this.chmod && + entry.mode && + (st.mode & 0o7777) !== entry.mode; + const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done); + if (!needChmod) { + return afterChmod(); + } + return node_fs_1.default.chmod(String(entry.absolute), Number(entry.mode), afterChmod); + } + // Not a dir entry, have to remove it. + // NB: the only way to end up with an entry that is the cwd + // itself, in such a way that == does not detect, is a + // tricky windows absolute path with UNC or 8.3 parts (and + // preservePaths:true, or else it will have been stripped). + // In that case, the user has opted out of path protections + // explicitly, so if they blow away the cwd, c'est la vie. + if (entry.absolute !== this.cwd) { + return node_fs_1.default.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done)); + } + } + // not a dir, and not reusable + // don't remove if the cwd, we want that error + if (entry.absolute === this.cwd) { + return this[MAKEFS](null, entry, done); + } + unlinkFile(String(entry.absolute), er => this[MAKEFS](er ?? null, entry, done)); + }); + }; + if (this[CHECKED_CWD]) { + start(); + } + else { + checkCwd(); + } + } + [MAKEFS](er, entry, done) { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + switch (entry.type) { + case 'File': + case 'OldFile': + case 'ContiguousFile': + return this[FILE](entry, done); + case 'Link': + return this[HARDLINK](entry, done); + case 'SymbolicLink': + return this[SYMLINK](entry, done); + case 'Directory': + case 'GNUDumpDir': + return this[DIRECTORY](entry, done); + } + } + [LINK](entry, linkpath, link, done) { + // XXX: get the type ('symlink' or 'junction') for windows + node_fs_1.default[link](linkpath, String(entry.absolute), er => { + if (er) { + this[ONERROR](er, entry); + } + else { + this[UNPEND](); + entry.resume(); + } + done(); + }); + } +} +exports.Unpack = Unpack; +const callSync = (fn) => { + try { + return [null, fn()]; + } + catch (er) { + return [er, null]; + } +}; +class UnpackSync extends Unpack { + sync = true; + [MAKEFS](er, entry) { + return super[MAKEFS](er, entry, () => { }); + } + [CHECKFS](entry) { + this[PRUNECACHE](entry); + if (!this[CHECKED_CWD]) { + const er = this[MKDIR](this.cwd, this.dmode); + if (er) { + return this[ONERROR](er, entry); + } + this[CHECKED_CWD] = true; + } + // don't bother to make the parent if the current entry is the cwd, + // we've already checked it. + if (entry.absolute !== this.cwd) { + const parent = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.dirname(String(entry.absolute))); + if (parent !== this.cwd) { + const mkParent = this[MKDIR](parent, this.dmode); + if (mkParent) { + return this[ONERROR](mkParent, entry); + } + } + } + const [lstatEr, st] = callSync(() => node_fs_1.default.lstatSync(String(entry.absolute))); + if (st && + (this.keep || + /* c8 ignore next */ + (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { + return this[SKIP](entry); + } + if (lstatEr || this[ISREUSABLE](entry, st)) { + return this[MAKEFS](null, entry); + } + if (st.isDirectory()) { + if (entry.type === 'Directory') { + const needChmod = this.chmod && + entry.mode && + (st.mode & 0o7777) !== entry.mode; + const [er] = needChmod ? + callSync(() => { + node_fs_1.default.chmodSync(String(entry.absolute), Number(entry.mode)); + }) + : []; + return this[MAKEFS](er, entry); + } + // not a dir entry, have to remove it + const [er] = callSync(() => node_fs_1.default.rmdirSync(String(entry.absolute))); + this[MAKEFS](er, entry); + } + // not a dir, and not reusable. + // don't remove if it's the cwd, since we want that error. + const [er] = entry.absolute === this.cwd ? + [] + : callSync(() => unlinkFileSync(String(entry.absolute))); + this[MAKEFS](er, entry); + } + [FILE](entry, done) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.fmode; + const oner = (er) => { + let closeError; + try { + node_fs_1.default.closeSync(fd); + } + catch (e) { + closeError = e; + } + if (er || closeError) { + this[ONERROR](er || closeError, entry); + } + done(); + }; + let fd; + try { + fd = node_fs_1.default.openSync(String(entry.absolute), (0, get_write_flag_js_1.getWriteFlag)(entry.size), mode); + } + catch (er) { + return oner(er); + } + const tx = this.transform ? this.transform(entry) || entry : entry; + if (tx !== entry) { + tx.on('error', (er) => this[ONERROR](er, entry)); + entry.pipe(tx); + } + tx.on('data', (chunk) => { + try { + node_fs_1.default.writeSync(fd, chunk, 0, chunk.length); + } + catch (er) { + oner(er); + } + }); + tx.on('end', () => { + let er = null; + // try both, falling futimes back to utimes + // if either fails, handle the first error + if (entry.mtime && !this.noMtime) { + const atime = entry.atime || new Date(); + const mtime = entry.mtime; + try { + node_fs_1.default.futimesSync(fd, atime, mtime); + } + catch (futimeser) { + try { + node_fs_1.default.utimesSync(String(entry.absolute), atime, mtime); + } + catch (utimeser) { + er = futimeser; + } + } + } + if (this[DOCHOWN](entry)) { + const uid = this[UID](entry); + const gid = this[GID](entry); + try { + node_fs_1.default.fchownSync(fd, Number(uid), Number(gid)); + } + catch (fchowner) { + try { + node_fs_1.default.chownSync(String(entry.absolute), Number(uid), Number(gid)); + } + catch (chowner) { + er = er || fchowner; + } + } + } + oner(er); + }); + } + [DIRECTORY](entry, done) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.dmode; + const er = this[MKDIR](String(entry.absolute), mode); + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + if (entry.mtime && !this.noMtime) { + try { + node_fs_1.default.utimesSync(String(entry.absolute), entry.atime || new Date(), entry.mtime); + /* c8 ignore next */ + } + catch (er) { } + } + if (this[DOCHOWN](entry)) { + try { + node_fs_1.default.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry))); + } + catch (er) { } + } + done(); + entry.resume(); + } + [MKDIR](dir, mode) { + try { + return (0, mkdir_js_1.mkdirSync)((0, normalize_windows_path_js_1.normalizeWindowsPath)(dir), { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cache: this.dirCache, + cwd: this.cwd, + mode: mode, + }); + } + catch (er) { + return er; + } + } + [LINK](entry, linkpath, link, done) { + const ls = `${link}Sync`; + try { + node_fs_1.default[ls](linkpath, String(entry.absolute)); + done(); + entry.resume(); + } + catch (er) { + return this[ONERROR](er, entry); + } + } +} +exports.UnpackSync = UnpackSync; +//# sourceMappingURL=unpack.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/update.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/update.js new file mode 100644 index 00000000..7687896f --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/update.js @@ -0,0 +1,33 @@ +"use strict"; +// tar -u +Object.defineProperty(exports, "__esModule", { value: true }); +exports.update = void 0; +const make_command_js_1 = require("./make-command.js"); +const replace_js_1 = require("./replace.js"); +// just call tar.r with the filter and mtimeCache +exports.update = (0, make_command_js_1.makeCommand)(replace_js_1.replace.syncFile, replace_js_1.replace.asyncFile, replace_js_1.replace.syncNoFile, replace_js_1.replace.asyncNoFile, (opt, entries = []) => { + replace_js_1.replace.validate?.(opt, entries); + mtimeFilter(opt); +}); +const mtimeFilter = (opt) => { + const filter = opt.filter; + if (!opt.mtimeCache) { + opt.mtimeCache = new Map(); + } + opt.filter = + filter ? + (path, stat) => filter(path, stat) && + !( + /* c8 ignore start */ + ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > + (stat.mtime ?? 0)) + /* c8 ignore stop */ + ) + : (path, stat) => !( + /* c8 ignore start */ + ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > + (stat.mtime ?? 0)) + /* c8 ignore stop */ + ); +}; +//# sourceMappingURL=update.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/warn-method.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/warn-method.js new file mode 100644 index 00000000..f2550277 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/warn-method.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.warnMethod = void 0; +const warnMethod = (self, code, message, data = {}) => { + if (self.file) { + data.file = self.file; + } + if (self.cwd) { + data.cwd = self.cwd; + } + data.code = + (message instanceof Error && + message.code) || + code; + data.tarCode = code; + if (!self.strict && data.recoverable !== false) { + if (message instanceof Error) { + data = Object.assign(message, data); + message = message.message; + } + self.emit('warn', code, message, data); + } + else if (message instanceof Error) { + self.emit('error', Object.assign(message, data)); + } + else { + self.emit('error', Object.assign(new Error(`${code}: ${message}`), data)); + } +}; +exports.warnMethod = warnMethod; +//# sourceMappingURL=warn-method.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/winchars.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/winchars.js new file mode 100644 index 00000000..c0a44058 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/winchars.js @@ -0,0 +1,14 @@ +"use strict"; +// When writing files on Windows, translate the characters to their +// 0xf000 higher-encoded versions. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decode = exports.encode = void 0; +const raw = ['|', '<', '>', '?', ':']; +const win = raw.map(char => String.fromCharCode(0xf000 + char.charCodeAt(0))); +const toWin = new Map(raw.map((char, i) => [char, win[i]])); +const toRaw = new Map(win.map((char, i) => [char, raw[i]])); +const encode = (s) => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s); +exports.encode = encode; +const decode = (s) => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s); +exports.decode = decode; +//# sourceMappingURL=winchars.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/write-entry.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/write-entry.js new file mode 100644 index 00000000..45b7efeb --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/commonjs/write-entry.js @@ -0,0 +1,689 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WriteEntryTar = exports.WriteEntrySync = exports.WriteEntry = void 0; +const fs_1 = __importDefault(require("fs")); +const minipass_1 = require("minipass"); +const path_1 = __importDefault(require("path")); +const header_js_1 = require("./header.js"); +const mode_fix_js_1 = require("./mode-fix.js"); +const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); +const options_js_1 = require("./options.js"); +const pax_js_1 = require("./pax.js"); +const strip_absolute_path_js_1 = require("./strip-absolute-path.js"); +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); +const warn_method_js_1 = require("./warn-method.js"); +const winchars = __importStar(require("./winchars.js")); +const prefixPath = (path, prefix) => { + if (!prefix) { + return (0, normalize_windows_path_js_1.normalizeWindowsPath)(path); + } + path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path).replace(/^\.(\/|$)/, ''); + return (0, strip_trailing_slashes_js_1.stripTrailingSlashes)(prefix) + '/' + path; +}; +const maxReadSize = 16 * 1024 * 1024; +const PROCESS = Symbol('process'); +const FILE = Symbol('file'); +const DIRECTORY = Symbol('directory'); +const SYMLINK = Symbol('symlink'); +const HARDLINK = Symbol('hardlink'); +const HEADER = Symbol('header'); +const READ = Symbol('read'); +const LSTAT = Symbol('lstat'); +const ONLSTAT = Symbol('onlstat'); +const ONREAD = Symbol('onread'); +const ONREADLINK = Symbol('onreadlink'); +const OPENFILE = Symbol('openfile'); +const ONOPENFILE = Symbol('onopenfile'); +const CLOSE = Symbol('close'); +const MODE = Symbol('mode'); +const AWAITDRAIN = Symbol('awaitDrain'); +const ONDRAIN = Symbol('ondrain'); +const PREFIX = Symbol('prefix'); +class WriteEntry extends minipass_1.Minipass { + path; + portable; + myuid = (process.getuid && process.getuid()) || 0; + // until node has builtin pwnam functions, this'll have to do + myuser = process.env.USER || ''; + maxReadSize; + linkCache; + statCache; + preservePaths; + cwd; + strict; + mtime; + noPax; + noMtime; + prefix; + fd; + blockLen = 0; + blockRemain = 0; + buf; + pos = 0; + remain = 0; + length = 0; + offset = 0; + win32; + absolute; + header; + type; + linkpath; + stat; + onWriteEntry; + #hadError = false; + constructor(p, opt_ = {}) { + const opt = (0, options_js_1.dealias)(opt_); + super(); + this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(p); + // suppress atime, ctime, uid, gid, uname, gname + this.portable = !!opt.portable; + this.maxReadSize = opt.maxReadSize || maxReadSize; + this.linkCache = opt.linkCache || new Map(); + this.statCache = opt.statCache || new Map(); + this.preservePaths = !!opt.preservePaths; + this.cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd || process.cwd()); + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.noMtime = !!opt.noMtime; + this.mtime = opt.mtime; + this.prefix = + opt.prefix ? (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.prefix) : undefined; + this.onWriteEntry = opt.onWriteEntry; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + let pathWarn = false; + if (!this.preservePaths) { + const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(this.path); + if (root && typeof stripped === 'string') { + this.path = stripped; + pathWarn = root; + } + } + this.win32 = !!opt.win32 || process.platform === 'win32'; + if (this.win32) { + // force the \ to / normalization, since we might not *actually* + // be on windows, but want \ to be considered a path separator. + this.path = winchars.decode(this.path.replace(/\\/g, '/')); + p = p.replace(/\\/g, '/'); + } + this.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.absolute || path_1.default.resolve(this.cwd, p)); + if (this.path === '') { + this.path = './'; + } + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }); + } + const cs = this.statCache.get(this.absolute); + if (cs) { + this[ONLSTAT](cs); + } + else { + this[LSTAT](); + } + } + warn(code, message, data = {}) { + return (0, warn_method_js_1.warnMethod)(this, code, message, data); + } + emit(ev, ...data) { + if (ev === 'error') { + this.#hadError = true; + } + return super.emit(ev, ...data); + } + [LSTAT]() { + fs_1.default.lstat(this.absolute, (er, stat) => { + if (er) { + return this.emit('error', er); + } + this[ONLSTAT](stat); + }); + } + [ONLSTAT](stat) { + this.statCache.set(this.absolute, stat); + this.stat = stat; + if (!stat.isFile()) { + stat.size = 0; + } + this.type = getType(stat); + this.emit('stat', stat); + this[PROCESS](); + } + [PROCESS]() { + switch (this.type) { + case 'File': + return this[FILE](); + case 'Directory': + return this[DIRECTORY](); + case 'SymbolicLink': + return this[SYMLINK](); + // unsupported types are ignored. + default: + return this.end(); + } + } + [MODE](mode) { + return (0, mode_fix_js_1.modeFix)(mode, this.type === 'Directory', this.portable); + } + [PREFIX](path) { + return prefixPath(path, this.prefix); + } + [HEADER]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot write header before stat'); + } + /* c8 ignore stop */ + if (this.type === 'Directory' && this.portable) { + this.noMtime = true; + } + this.onWriteEntry?.(this); + this.header = new header_js_1.Header({ + path: this[PREFIX](this.path), + // only apply the prefix to hard links. + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this[MODE](this.stat.mode), + uid: this.portable ? undefined : this.stat.uid, + gid: this.portable ? undefined : this.stat.gid, + size: this.stat.size, + mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime, + /* c8 ignore next */ + type: this.type === 'Unsupported' ? undefined : this.type, + uname: this.portable ? undefined + : this.stat.uid === this.myuid ? this.myuser + : '', + atime: this.portable ? undefined : this.stat.atime, + ctime: this.portable ? undefined : this.stat.ctime, + }); + if (this.header.encode() && !this.noPax) { + super.write(new pax_js_1.Pax({ + atime: this.portable ? undefined : this.header.atime, + ctime: this.portable ? undefined : this.header.ctime, + gid: this.portable ? undefined : this.header.gid, + mtime: this.noMtime ? undefined : (this.mtime || this.header.mtime), + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + size: this.header.size, + uid: this.portable ? undefined : this.header.uid, + uname: this.portable ? undefined : this.header.uname, + dev: this.portable ? undefined : this.stat.dev, + ino: this.portable ? undefined : this.stat.ino, + nlink: this.portable ? undefined : this.stat.nlink, + }).encode()); + } + const block = this.header?.block; + /* c8 ignore start */ + if (!block) { + throw new Error('failed to encode header'); + } + /* c8 ignore stop */ + super.write(block); + } + [DIRECTORY]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create directory entry without stat'); + } + /* c8 ignore stop */ + if (this.path.slice(-1) !== '/') { + this.path += '/'; + } + this.stat.size = 0; + this[HEADER](); + this.end(); + } + [SYMLINK]() { + fs_1.default.readlink(this.absolute, (er, linkpath) => { + if (er) { + return this.emit('error', er); + } + this[ONREADLINK](linkpath); + }); + } + [ONREADLINK](linkpath) { + this.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(linkpath); + this[HEADER](); + this.end(); + } + [HARDLINK](linkpath) { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create link entry without stat'); + } + /* c8 ignore stop */ + this.type = 'Link'; + this.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.relative(this.cwd, linkpath)); + this.stat.size = 0; + this[HEADER](); + this.end(); + } + [FILE]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create file entry without stat'); + } + /* c8 ignore stop */ + if (this.stat.nlink > 1) { + const linkKey = `${this.stat.dev}:${this.stat.ino}`; + const linkpath = this.linkCache.get(linkKey); + if (linkpath?.indexOf(this.cwd) === 0) { + return this[HARDLINK](linkpath); + } + this.linkCache.set(linkKey, this.absolute); + } + this[HEADER](); + if (this.stat.size === 0) { + return this.end(); + } + this[OPENFILE](); + } + [OPENFILE]() { + fs_1.default.open(this.absolute, 'r', (er, fd) => { + if (er) { + return this.emit('error', er); + } + this[ONOPENFILE](fd); + }); + } + [ONOPENFILE](fd) { + this.fd = fd; + if (this.#hadError) { + return this[CLOSE](); + } + /* c8 ignore start */ + if (!this.stat) { + throw new Error('should stat before calling onopenfile'); + } + /* c8 ignore start */ + this.blockLen = 512 * Math.ceil(this.stat.size / 512); + this.blockRemain = this.blockLen; + const bufLen = Math.min(this.blockLen, this.maxReadSize); + this.buf = Buffer.allocUnsafe(bufLen); + this.offset = 0; + this.pos = 0; + this.remain = this.stat.size; + this.length = this.buf.length; + this[READ](); + } + [READ]() { + const { fd, buf, offset, length, pos } = this; + if (fd === undefined || buf === undefined) { + throw new Error('cannot read file without first opening'); + } + fs_1.default.read(fd, buf, offset, length, pos, (er, bytesRead) => { + if (er) { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + return this[CLOSE](() => this.emit('error', er)); + } + this[ONREAD](bytesRead); + }); + } + /* c8 ignore start */ + [CLOSE](cb = () => { }) { + /* c8 ignore stop */ + if (this.fd !== undefined) + fs_1.default.close(this.fd, cb); + } + [ONREAD](bytesRead) { + if (bytesRead <= 0 && this.remain > 0) { + const er = Object.assign(new Error('encountered unexpected EOF'), { + path: this.absolute, + syscall: 'read', + code: 'EOF', + }); + return this[CLOSE](() => this.emit('error', er)); + } + if (bytesRead > this.remain) { + const er = Object.assign(new Error('did not encounter expected EOF'), { + path: this.absolute, + syscall: 'read', + code: 'EOF', + }); + return this[CLOSE](() => this.emit('error', er)); + } + /* c8 ignore start */ + if (!this.buf) { + throw new Error('should have created buffer prior to reading'); + } + /* c8 ignore stop */ + // null out the rest of the buffer, if we could fit the block padding + // at the end of this loop, we've incremented bytesRead and this.remain + // to be incremented up to the blockRemain level, as if we had expected + // to get a null-padded file, and read it until the end. then we will + // decrement both remain and blockRemain by bytesRead, and know that we + // reached the expected EOF, without any null buffer to append. + if (bytesRead === this.remain) { + for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) { + this.buf[i + this.offset] = 0; + bytesRead++; + this.remain++; + } + } + const chunk = this.offset === 0 && bytesRead === this.buf.length ? + this.buf + : this.buf.subarray(this.offset, this.offset + bytesRead); + const flushed = this.write(chunk); + if (!flushed) { + this[AWAITDRAIN](() => this[ONDRAIN]()); + } + else { + this[ONDRAIN](); + } + } + [AWAITDRAIN](cb) { + this.once('drain', cb); + } + write(chunk, encoding, cb) { + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); + } + /* c8 ignore stop */ + if (this.blockRemain < chunk.length) { + const er = Object.assign(new Error('writing more data than expected'), { + path: this.absolute, + }); + return this.emit('error', er); + } + this.remain -= chunk.length; + this.blockRemain -= chunk.length; + this.pos += chunk.length; + this.offset += chunk.length; + return super.write(chunk, null, cb); + } + [ONDRAIN]() { + if (!this.remain) { + if (this.blockRemain) { + super.write(Buffer.alloc(this.blockRemain)); + } + return this[CLOSE](er => er ? this.emit('error', er) : this.end()); + } + /* c8 ignore start */ + if (!this.buf) { + throw new Error('buffer lost somehow in ONDRAIN'); + } + /* c8 ignore stop */ + if (this.offset >= this.length) { + // if we only have a smaller bit left to read, alloc a smaller buffer + // otherwise, keep it the same length it was before. + this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)); + this.offset = 0; + } + this.length = this.buf.length - this.offset; + this[READ](); + } +} +exports.WriteEntry = WriteEntry; +class WriteEntrySync extends WriteEntry { + sync = true; + [LSTAT]() { + this[ONLSTAT](fs_1.default.lstatSync(this.absolute)); + } + [SYMLINK]() { + this[ONREADLINK](fs_1.default.readlinkSync(this.absolute)); + } + [OPENFILE]() { + this[ONOPENFILE](fs_1.default.openSync(this.absolute, 'r')); + } + [READ]() { + let threw = true; + try { + const { fd, buf, offset, length, pos } = this; + /* c8 ignore start */ + if (fd === undefined || buf === undefined) { + throw new Error('fd and buf must be set in READ method'); + } + /* c8 ignore stop */ + const bytesRead = fs_1.default.readSync(fd, buf, offset, length, pos); + this[ONREAD](bytesRead); + threw = false; + } + finally { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + if (threw) { + try { + this[CLOSE](() => { }); + } + catch (er) { } + } + } + } + [AWAITDRAIN](cb) { + cb(); + } + /* c8 ignore start */ + [CLOSE](cb = () => { }) { + /* c8 ignore stop */ + if (this.fd !== undefined) + fs_1.default.closeSync(this.fd); + cb(); + } +} +exports.WriteEntrySync = WriteEntrySync; +class WriteEntryTar extends minipass_1.Minipass { + blockLen = 0; + blockRemain = 0; + buf = 0; + pos = 0; + remain = 0; + length = 0; + preservePaths; + portable; + strict; + noPax; + noMtime; + readEntry; + type; + prefix; + path; + mode; + uid; + gid; + uname; + gname; + header; + mtime; + atime; + ctime; + linkpath; + size; + onWriteEntry; + warn(code, message, data = {}) { + return (0, warn_method_js_1.warnMethod)(this, code, message, data); + } + constructor(readEntry, opt_ = {}) { + const opt = (0, options_js_1.dealias)(opt_); + super(); + this.preservePaths = !!opt.preservePaths; + this.portable = !!opt.portable; + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.noMtime = !!opt.noMtime; + this.onWriteEntry = opt.onWriteEntry; + this.readEntry = readEntry; + const { type } = readEntry; + /* c8 ignore start */ + if (type === 'Unsupported') { + throw new Error('writing entry that should be ignored'); + } + /* c8 ignore stop */ + this.type = type; + if (this.type === 'Directory' && this.portable) { + this.noMtime = true; + } + this.prefix = opt.prefix; + this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(readEntry.path); + this.mode = + readEntry.mode !== undefined ? + this[MODE](readEntry.mode) + : undefined; + this.uid = this.portable ? undefined : readEntry.uid; + this.gid = this.portable ? undefined : readEntry.gid; + this.uname = this.portable ? undefined : readEntry.uname; + this.gname = this.portable ? undefined : readEntry.gname; + this.size = readEntry.size; + this.mtime = + this.noMtime ? undefined : opt.mtime || readEntry.mtime; + this.atime = this.portable ? undefined : readEntry.atime; + this.ctime = this.portable ? undefined : readEntry.ctime; + this.linkpath = + readEntry.linkpath !== undefined ? + (0, normalize_windows_path_js_1.normalizeWindowsPath)(readEntry.linkpath) + : undefined; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + let pathWarn = false; + if (!this.preservePaths) { + const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(this.path); + if (root && typeof stripped === 'string') { + this.path = stripped; + pathWarn = root; + } + } + this.remain = readEntry.size; + this.blockRemain = readEntry.startBlockSize; + this.onWriteEntry?.(this); + this.header = new header_js_1.Header({ + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this.mode, + uid: this.portable ? undefined : this.uid, + gid: this.portable ? undefined : this.gid, + size: this.size, + mtime: this.noMtime ? undefined : this.mtime, + type: this.type, + uname: this.portable ? undefined : this.uname, + atime: this.portable ? undefined : this.atime, + ctime: this.portable ? undefined : this.ctime, + }); + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }); + } + if (this.header.encode() && !this.noPax) { + super.write(new pax_js_1.Pax({ + atime: this.portable ? undefined : this.atime, + ctime: this.portable ? undefined : this.ctime, + gid: this.portable ? undefined : this.gid, + mtime: this.noMtime ? undefined : this.mtime, + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + size: this.size, + uid: this.portable ? undefined : this.uid, + uname: this.portable ? undefined : this.uname, + dev: this.portable ? undefined : this.readEntry.dev, + ino: this.portable ? undefined : this.readEntry.ino, + nlink: this.portable ? undefined : this.readEntry.nlink, + }).encode()); + } + const b = this.header?.block; + /* c8 ignore start */ + if (!b) + throw new Error('failed to encode header'); + /* c8 ignore stop */ + super.write(b); + readEntry.pipe(this); + } + [PREFIX](path) { + return prefixPath(path, this.prefix); + } + [MODE](mode) { + return (0, mode_fix_js_1.modeFix)(mode, this.type === 'Directory', this.portable); + } + write(chunk, encoding, cb) { + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); + } + /* c8 ignore stop */ + const writeLen = chunk.length; + if (writeLen > this.blockRemain) { + throw new Error('writing more to entry than is appropriate'); + } + this.blockRemain -= writeLen; + return super.write(chunk, cb); + } + end(chunk, encoding, cb) { + if (this.blockRemain) { + super.write(Buffer.alloc(this.blockRemain)); + } + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding ?? 'utf8'); + } + if (cb) + this.once('finish', cb); + chunk ? super.end(chunk, cb) : super.end(cb); + /* c8 ignore stop */ + return this; + } +} +exports.WriteEntryTar = WriteEntryTar; +const getType = (stat) => stat.isFile() ? 'File' + : stat.isDirectory() ? 'Directory' + : stat.isSymbolicLink() ? 'SymbolicLink' + : 'Unsupported'; +//# sourceMappingURL=write-entry.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/create.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/create.js new file mode 100644 index 00000000..512a9911 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/create.js @@ -0,0 +1,77 @@ +import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'; +import path from 'node:path'; +import { list } from './list.js'; +import { makeCommand } from './make-command.js'; +import { Pack, PackSync } from './pack.js'; +const createFileSync = (opt, files) => { + const p = new PackSync(opt); + const stream = new WriteStreamSync(opt.file, { + mode: opt.mode || 0o666, + }); + p.pipe(stream); + addFilesSync(p, files); +}; +const createFile = (opt, files) => { + const p = new Pack(opt); + const stream = new WriteStream(opt.file, { + mode: opt.mode || 0o666, + }); + p.pipe(stream); + const promise = new Promise((res, rej) => { + stream.on('error', rej); + stream.on('close', res); + p.on('error', rej); + }); + addFilesAsync(p, files); + return promise; +}; +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') { + list({ + file: path.resolve(p.cwd, file.slice(1)), + sync: true, + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + }); + p.end(); +}; +const addFilesAsync = async (p, files) => { + for (let i = 0; i < files.length; i++) { + const file = String(files[i]); + if (file.charAt(0) === '@') { + await list({ + file: path.resolve(String(p.cwd), file.slice(1)), + noResume: true, + onReadEntry: entry => { + p.add(entry); + }, + }); + } + else { + p.add(file); + } + } + p.end(); +}; +const createSync = (opt, files) => { + const p = new PackSync(opt); + addFilesSync(p, files); + return p; +}; +const createAsync = (opt, files) => { + const p = new Pack(opt); + addFilesAsync(p, files); + return p; +}; +export const create = makeCommand(createFileSync, createFile, createSync, createAsync, (_opt, files) => { + if (!files?.length) { + throw new TypeError('no paths specified to add to archive'); + } +}); +//# sourceMappingURL=create.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/cwd-error.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/cwd-error.js new file mode 100644 index 00000000..289a066b --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/cwd-error.js @@ -0,0 +1,14 @@ +export class CwdError extends Error { + path; + code; + syscall = 'chdir'; + constructor(path, code) { + super(`${code}: Cannot cd into '${path}'`); + this.path = path; + this.code = code; + } + get name() { + return 'CwdError'; + } +} +//# sourceMappingURL=cwd-error.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/extract.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/extract.js new file mode 100644 index 00000000..2274feef --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/extract.js @@ -0,0 +1,49 @@ +// tar -x +import * as fsm from '@isaacs/fs-minipass'; +import fs from 'node:fs'; +import { filesFilter } from './list.js'; +import { makeCommand } from './make-command.js'; +import { Unpack, UnpackSync } from './unpack.js'; +const extractFileSync = (opt) => { + const u = new UnpackSync(opt); + const file = opt.file; + const stat = fs.statSync(file); + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const stream = new fsm.ReadStreamSync(file, { + readSize: readSize, + size: stat.size, + }); + stream.pipe(u); +}; +const extractFile = (opt, _) => { + const u = new Unpack(opt); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const file = opt.file; + const p = new Promise((resolve, reject) => { + u.on('error', reject); + u.on('close', resolve); + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + fs.stat(file, (er, stat) => { + if (er) { + reject(er); + } + else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size, + }); + stream.on('error', reject); + stream.pipe(u); + } + }); + }); + return p; +}; +export const extract = makeCommand(extractFileSync, extractFile, opt => new UnpackSync(opt), opt => new Unpack(opt), (opt, files) => { + if (files?.length) + filesFilter(opt, files); +}); +//# sourceMappingURL=extract.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/get-write-flag.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/get-write-flag.js new file mode 100644 index 00000000..2c7f3e8b --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/get-write-flag.js @@ -0,0 +1,23 @@ +// Get the appropriate flag to use for creating files +// We use fmap on Windows platforms for files less than +// 512kb. This is a fairly low limit, but avoids making +// things slower in some cases. Since most of what this +// library is used for is extracting tarballs of many +// relatively small files in npm packages and the like, +// it can be a big boost on Windows platforms. +import fs from 'fs'; +const platform = process.env.__FAKE_PLATFORM__ || process.platform; +const isWindows = platform === 'win32'; +/* c8 ignore start */ +const { O_CREAT, O_TRUNC, O_WRONLY } = fs.constants; +const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) || + fs.constants.UV_FS_O_FILEMAP || + 0; +/* c8 ignore stop */ +const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP; +const fMapLimit = 512 * 1024; +const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY; +export const getWriteFlag = !fMapEnabled ? + () => 'w' + : (size) => (size < fMapLimit ? fMapFlag : 'w'); +//# sourceMappingURL=get-write-flag.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/header.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/header.js new file mode 100644 index 00000000..e15192b1 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/header.js @@ -0,0 +1,279 @@ +// parse a 512-byte header block to a data object, or vice-versa +// encode returns `true` if a pax extended header is needed, because +// the data could not be faithfully encoded in a simple header. +// (Also, check header.needPax to see if it needs a pax header.) +import { posix as pathModule } from 'node:path'; +import * as large from './large-numbers.js'; +import * as types from './types.js'; +export class Header { + cksumValid = false; + needPax = false; + nullBlock = false; + block; + path; + mode; + uid; + gid; + size; + cksum; + #type = 'Unsupported'; + linkpath; + uname; + gname; + devmaj = 0; + devmin = 0; + atime; + ctime; + mtime; + charset; + comment; + constructor(data, off = 0, ex, gex) { + if (Buffer.isBuffer(data)) { + this.decode(data, off || 0, ex, gex); + } + else if (data) { + this.#slurp(data); + } + } + decode(buf, off, ex, gex) { + if (!off) { + off = 0; + } + if (!buf || !(buf.length >= off + 512)) { + throw new Error('need 512 bytes for header'); + } + this.path = decString(buf, off, 100); + this.mode = decNumber(buf, off + 100, 8); + this.uid = decNumber(buf, off + 108, 8); + this.gid = decNumber(buf, off + 116, 8); + this.size = decNumber(buf, off + 124, 12); + this.mtime = decDate(buf, off + 136, 12); + this.cksum = decNumber(buf, off + 148, 12); + // if we have extended or global extended headers, apply them now + // See https://github.com/npm/node-tar/pull/187 + // Apply global before local, so it overrides + if (gex) + this.#slurp(gex, true); + if (ex) + this.#slurp(ex); + // old tar versions marked dirs as a file with a trailing / + const t = decString(buf, off + 156, 1); + if (types.isCode(t)) { + this.#type = t || '0'; + } + if (this.#type === '0' && this.path.slice(-1) === '/') { + this.#type = '5'; + } + // tar implementations sometimes incorrectly put the stat(dir).size + // as the size in the tarball, even though Directory entries are + // not able to have any body at all. In the very rare chance that + // it actually DOES have a body, we weren't going to do anything with + // it anyway, and it'll just be a warning about an invalid header. + if (this.#type === '5') { + this.size = 0; + } + this.linkpath = decString(buf, off + 157, 100); + if (buf.subarray(off + 257, off + 265).toString() === + 'ustar\u000000') { + this.uname = decString(buf, off + 265, 32); + this.gname = decString(buf, off + 297, 32); + /* c8 ignore start */ + this.devmaj = decNumber(buf, off + 329, 8) ?? 0; + this.devmin = decNumber(buf, off + 337, 8) ?? 0; + /* c8 ignore stop */ + if (buf[off + 475] !== 0) { + // definitely a prefix, definitely >130 chars. + const prefix = decString(buf, off + 345, 155); + this.path = prefix + '/' + this.path; + } + else { + const prefix = decString(buf, off + 345, 130); + if (prefix) { + this.path = prefix + '/' + this.path; + } + this.atime = decDate(buf, off + 476, 12); + this.ctime = decDate(buf, off + 488, 12); + } + } + let sum = 8 * 0x20; + for (let i = off; i < off + 148; i++) { + sum += buf[i]; + } + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i]; + } + this.cksumValid = sum === this.cksum; + if (this.cksum === undefined && sum === 8 * 0x20) { + this.nullBlock = true; + } + } + #slurp(ex, gex = false) { + Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. Also, any + // null/undefined values are ignored. + return !(v === null || + v === undefined || + (k === 'path' && gex) || + (k === 'linkpath' && gex) || + k === 'global'); + }))); + } + encode(buf, off = 0) { + if (!buf) { + buf = this.block = Buffer.alloc(512); + } + if (this.#type === 'Unsupported') { + this.#type = '0'; + } + if (!(buf.length >= off + 512)) { + throw new Error('need 512 bytes for header'); + } + const prefixSize = this.ctime || this.atime ? 130 : 155; + const split = splitPrefix(this.path || '', prefixSize); + const path = split[0]; + const prefix = split[1]; + this.needPax = !!split[2]; + this.needPax = encString(buf, off, 100, path) || this.needPax; + this.needPax = + encNumber(buf, off + 100, 8, this.mode) || this.needPax; + this.needPax = + encNumber(buf, off + 108, 8, this.uid) || this.needPax; + this.needPax = + encNumber(buf, off + 116, 8, this.gid) || this.needPax; + this.needPax = + encNumber(buf, off + 124, 12, this.size) || this.needPax; + this.needPax = + encDate(buf, off + 136, 12, this.mtime) || this.needPax; + buf[off + 156] = this.#type.charCodeAt(0); + this.needPax = + encString(buf, off + 157, 100, this.linkpath) || this.needPax; + buf.write('ustar\u000000', off + 257, 8); + this.needPax = + encString(buf, off + 265, 32, this.uname) || this.needPax; + this.needPax = + encString(buf, off + 297, 32, this.gname) || this.needPax; + this.needPax = + encNumber(buf, off + 329, 8, this.devmaj) || this.needPax; + this.needPax = + encNumber(buf, off + 337, 8, this.devmin) || this.needPax; + this.needPax = + encString(buf, off + 345, prefixSize, prefix) || this.needPax; + if (buf[off + 475] !== 0) { + this.needPax = + encString(buf, off + 345, 155, prefix) || this.needPax; + } + else { + this.needPax = + encString(buf, off + 345, 130, prefix) || this.needPax; + this.needPax = + encDate(buf, off + 476, 12, this.atime) || this.needPax; + this.needPax = + encDate(buf, off + 488, 12, this.ctime) || this.needPax; + } + let sum = 8 * 0x20; + for (let i = off; i < off + 148; i++) { + sum += buf[i]; + } + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i]; + } + this.cksum = sum; + encNumber(buf, off + 148, 8, this.cksum); + this.cksumValid = true; + return this.needPax; + } + get type() { + return (this.#type === 'Unsupported' ? + this.#type + : types.name.get(this.#type)); + } + get typeKey() { + return this.#type; + } + set type(type) { + const c = String(types.code.get(type)); + if (types.isCode(c) || c === 'Unsupported') { + this.#type = c; + } + else if (types.isCode(type)) { + this.#type = type; + } + else { + throw new TypeError('invalid entry type: ' + type); + } + } +} +const splitPrefix = (p, prefixSize) => { + const pathSize = 100; + let pp = p; + let prefix = ''; + let ret = undefined; + const root = pathModule.parse(p).root || '.'; + if (Buffer.byteLength(pp) < pathSize) { + ret = [pp, prefix, false]; + } + else { + // first set prefix to the dir, and path to the base + prefix = pathModule.dirname(pp); + pp = pathModule.basename(pp); + do { + if (Buffer.byteLength(pp) <= pathSize && + Buffer.byteLength(prefix) <= prefixSize) { + // both fit! + ret = [pp, prefix, false]; + } + else if (Buffer.byteLength(pp) > pathSize && + Buffer.byteLength(prefix) <= prefixSize) { + // prefix fits in prefix, but path doesn't fit in path + ret = [pp.slice(0, pathSize - 1), prefix, true]; + } + else { + // make path take a bit from prefix + pp = pathModule.join(pathModule.basename(prefix), pp); + prefix = pathModule.dirname(prefix); + } + } while (prefix !== root && ret === undefined); + // at this point, found no resolution, just truncate + if (!ret) { + ret = [p.slice(0, pathSize - 1), '', true]; + } + } + return ret; +}; +const decString = (buf, off, size) => buf + .subarray(off, off + size) + .toString('utf8') + .replace(/\0.*/, ''); +const decDate = (buf, off, size) => numToDate(decNumber(buf, off, size)); +const numToDate = (num) => num === undefined ? undefined : new Date(num * 1000); +const decNumber = (buf, off, size) => Number(buf[off]) & 0x80 ? + large.parse(buf.subarray(off, off + size)) + : decSmallNumber(buf, off, size); +const nanUndef = (value) => (isNaN(value) ? undefined : value); +const decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf + .subarray(off, off + size) + .toString('utf8') + .replace(/\0.*$/, '') + .trim(), 8)); +// the maximum encodable as a null-terminated octal, by field size +const MAXNUM = { + 12: 0o77777777777, + 8: 0o7777777, +}; +const encNumber = (buf, off, size, num) => num === undefined ? false + : num > MAXNUM[size] || num < 0 ? + (large.encode(num, buf.subarray(off, off + size)), true) + : (encSmallNumber(buf, off, size, num), false); +const encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, 'ascii'); +const octalString = (num, size) => padOctal(Math.floor(num).toString(8), size); +const padOctal = (str, size) => (str.length === size - 1 ? + str + : new Array(size - str.length - 1).join('0') + str + ' ') + '\0'; +const encDate = (buf, off, size, date) => date === undefined ? false : (encNumber(buf, off, size, date.getTime() / 1000)); +// enough to fill the longest string we've got +const NULLS = new Array(156).join('\0'); +// pad with nulls, return true if it's longer or non-ascii +const encString = (buf, off, size, str) => str === undefined ? false : ((buf.write(str + NULLS, off, size, 'utf8'), + str.length !== Buffer.byteLength(str) || str.length > size)); +//# sourceMappingURL=header.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/index.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/index.js new file mode 100644 index 00000000..1bac6415 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/index.js @@ -0,0 +1,20 @@ +export * from './create.js'; +export { create as c } from './create.js'; +export * from './extract.js'; +export { extract as x } from './extract.js'; +export * from './header.js'; +export * from './list.js'; +export { list as t } from './list.js'; +// classes +export * from './pack.js'; +export * from './parse.js'; +export * from './pax.js'; +export * from './read-entry.js'; +export * from './replace.js'; +export { replace as r } from './replace.js'; +export * as types from './types.js'; +export * from './unpack.js'; +export * from './update.js'; +export { update as u } from './update.js'; +export * from './write-entry.js'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/large-numbers.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/large-numbers.js new file mode 100644 index 00000000..4f2f7e5f --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/large-numbers.js @@ -0,0 +1,94 @@ +// Tar can encode large and negative numbers using a leading byte of +// 0xff for negative, and 0x80 for positive. +export const encode = (num, buf) => { + if (!Number.isSafeInteger(num)) { + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('cannot encode number outside of javascript safe integer range'); + } + else if (num < 0) { + encodeNegative(num, buf); + } + else { + encodePositive(num, buf); + } + return buf; +}; +const encodePositive = (num, buf) => { + buf[0] = 0x80; + for (var i = buf.length; i > 1; i--) { + buf[i - 1] = num & 0xff; + num = Math.floor(num / 0x100); + } +}; +const encodeNegative = (num, buf) => { + buf[0] = 0xff; + var flipped = false; + num = num * -1; + for (var i = buf.length; i > 1; i--) { + var byte = num & 0xff; + num = Math.floor(num / 0x100); + if (flipped) { + buf[i - 1] = onesComp(byte); + } + else if (byte === 0) { + buf[i - 1] = 0; + } + else { + flipped = true; + buf[i - 1] = twosComp(byte); + } + } +}; +export const parse = (buf) => { + const pre = buf[0]; + const value = pre === 0x80 ? pos(buf.subarray(1, buf.length)) + : pre === 0xff ? twos(buf) + : null; + if (value === null) { + throw Error('invalid base256 encoding'); + } + if (!Number.isSafeInteger(value)) { + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('parsed number outside of javascript safe integer range'); + } + return value; +}; +const twos = (buf) => { + var len = buf.length; + var sum = 0; + var flipped = false; + for (var i = len - 1; i > -1; i--) { + var byte = Number(buf[i]); + var f; + if (flipped) { + f = onesComp(byte); + } + else if (byte === 0) { + f = byte; + } + else { + flipped = true; + f = twosComp(byte); + } + if (f !== 0) { + sum -= f * Math.pow(256, len - i - 1); + } + } + return sum; +}; +const pos = (buf) => { + var len = buf.length; + var sum = 0; + for (var i = len - 1; i > -1; i--) { + var byte = Number(buf[i]); + if (byte !== 0) { + sum += byte * Math.pow(256, len - i - 1); + } + } + return sum; +}; +const onesComp = (byte) => (0xff ^ byte) & 0xff; +const twosComp = (byte) => ((0xff ^ byte) + 1) & 0xff; +//# sourceMappingURL=large-numbers.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/list.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/list.js new file mode 100644 index 00000000..f4906840 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/list.js @@ -0,0 +1,106 @@ +// tar -t +import * as fsm from '@isaacs/fs-minipass'; +import fs from 'node:fs'; +import { dirname, parse } from 'path'; +import { makeCommand } from './make-command.js'; +import { Parser } from './parse.js'; +import { stripTrailingSlashes } from './strip-trailing-slashes.js'; +const onReadEntryFunction = (opt) => { + const onReadEntry = opt.onReadEntry; + opt.onReadEntry = + onReadEntry ? + e => { + onReadEntry(e); + e.resume(); + } + : e => e.resume(); +}; +// construct a filter that limits the file entries listed +// include child entries if a dir is included +export const filesFilter = (opt, files) => { + const map = new Map(files.map(f => [stripTrailingSlashes(f), true])); + const filter = opt.filter; + const mapHas = (file, r = '') => { + const root = r || parse(file).root || '.'; + let ret; + if (file === root) + ret = false; + else { + const m = map.get(file); + if (m !== undefined) { + ret = m; + } + else { + ret = mapHas(dirname(file), root); + } + } + map.set(file, ret); + return ret; + }; + opt.filter = + filter ? + (file, entry) => filter(file, entry) && mapHas(stripTrailingSlashes(file)) + : file => mapHas(stripTrailingSlashes(file)); +}; +const listFileSync = (opt) => { + const p = new Parser(opt); + const file = opt.file; + let fd; + try { + const stat = fs.statSync(file); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + if (stat.size < readSize) { + p.end(fs.readFileSync(file)); + } + else { + let pos = 0; + const buf = Buffer.allocUnsafe(readSize); + fd = fs.openSync(file, 'r'); + while (pos < stat.size) { + const bytesRead = fs.readSync(fd, buf, 0, readSize, pos); + pos += bytesRead; + p.write(buf.subarray(0, bytesRead)); + } + p.end(); + } + } + finally { + if (typeof fd === 'number') { + try { + fs.closeSync(fd); + /* c8 ignore next */ + } + catch (er) { } + } + } +}; +const listFile = (opt, _files) => { + const parse = new Parser(opt); + const readSize = opt.maxReadSize || 16 * 1024 * 1024; + const file = opt.file; + const p = new Promise((resolve, reject) => { + parse.on('error', reject); + parse.on('end', resolve); + fs.stat(file, (er, stat) => { + if (er) { + reject(er); + } + else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size, + }); + stream.on('error', reject); + stream.pipe(parse); + } + }); + }); + return p; +}; +export const list = makeCommand(listFileSync, listFile, opt => new Parser(opt), opt => new Parser(opt), (opt, files) => { + if (files?.length) + filesFilter(opt, files); + if (!opt.noResume) + onReadEntryFunction(opt); +}); +//# sourceMappingURL=list.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/make-command.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/make-command.js new file mode 100644 index 00000000..f2f737bc --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/make-command.js @@ -0,0 +1,57 @@ +import { dealias, isAsyncFile, isAsyncNoFile, isSyncFile, isSyncNoFile, } from './options.js'; +export const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => { + return Object.assign((opt_ = [], entries, cb) => { + if (Array.isArray(opt_)) { + entries = opt_; + opt_ = {}; + } + if (typeof entries === 'function') { + cb = entries; + entries = undefined; + } + if (!entries) { + entries = []; + } + else { + entries = Array.from(entries); + } + const opt = dealias(opt_); + validate?.(opt, entries); + if (isSyncFile(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions'); + } + return syncFile(opt, entries); + } + else if (isAsyncFile(opt)) { + const p = asyncFile(opt, entries); + // weirdness to make TS happy + const c = cb ? cb : undefined; + return c ? p.then(() => c(), c) : p; + } + else if (isSyncNoFile(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions'); + } + return syncNoFile(opt, entries); + } + else if (isAsyncNoFile(opt)) { + if (typeof cb === 'function') { + throw new TypeError('callback only supported with file option'); + } + return asyncNoFile(opt, entries); + /* c8 ignore start */ + } + else { + throw new Error('impossible options??'); + } + /* c8 ignore stop */ + }, { + syncFile, + asyncFile, + syncNoFile, + asyncNoFile, + validate, + }); +}; +//# sourceMappingURL=make-command.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/mkdir.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/mkdir.js new file mode 100644 index 00000000..13498ef0 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/mkdir.js @@ -0,0 +1,201 @@ +import { chownr, chownrSync } from 'chownr'; +import fs from 'fs'; +import { mkdirp, mkdirpSync } from 'mkdirp'; +import path from 'node:path'; +import { CwdError } from './cwd-error.js'; +import { normalizeWindowsPath } from './normalize-windows-path.js'; +import { SymlinkError } from './symlink-error.js'; +const cGet = (cache, key) => cache.get(normalizeWindowsPath(key)); +const cSet = (cache, key, val) => cache.set(normalizeWindowsPath(key), val); +const checkCwd = (dir, cb) => { + fs.stat(dir, (er, st) => { + if (er || !st.isDirectory()) { + er = new CwdError(dir, er?.code || 'ENOTDIR'); + } + cb(er); + }); +}; +/** + * Wrapper around mkdirp for tar's needs. + * + * The main purpose is to avoid creating directories if we know that + * they already exist (and track which ones exist for this purpose), + * and prevent entries from being extracted into symlinked folders, + * if `preservePaths` is not set. + */ +export const mkdir = (dir, opt, cb) => { + dir = normalizeWindowsPath(dir); + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + /* c8 ignore next */ + const umask = opt.umask ?? 0o22; + const mode = opt.mode | 0o0700; + const needChmod = (mode & umask) !== 0; + const uid = opt.uid; + const gid = opt.gid; + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + (uid !== opt.processUid || gid !== opt.processGid); + const preserve = opt.preserve; + const unlink = opt.unlink; + const cache = opt.cache; + const cwd = normalizeWindowsPath(opt.cwd); + const done = (er, created) => { + if (er) { + cb(er); + } + else { + cSet(cache, dir, true); + if (created && doChown) { + chownr(created, uid, gid, er => done(er)); + } + else if (needChmod) { + fs.chmod(dir, mode, cb); + } + else { + cb(); + } + } + }; + if (cache && cGet(cache, dir) === true) { + return done(); + } + if (dir === cwd) { + return checkCwd(dir, done); + } + if (preserve) { + return mkdirp(dir, { mode }).then(made => done(null, made ?? undefined), // oh, ts + done); + } + const sub = normalizeWindowsPath(path.relative(cwd, dir)); + const parts = sub.split('/'); + mkdir_(cwd, parts, mode, cache, unlink, cwd, undefined, done); +}; +const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => { + if (!parts.length) { + return cb(null, created); + } + const p = parts.shift(); + const part = normalizeWindowsPath(path.resolve(base + '/' + p)); + if (cGet(cache, part)) { + return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); + } + fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); +}; +const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => { + if (er) { + fs.lstat(part, (statEr, st) => { + if (statEr) { + statEr.path = + statEr.path && normalizeWindowsPath(statEr.path); + cb(statEr); + } + else if (st.isDirectory()) { + mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); + } + else if (unlink) { + fs.unlink(part, er => { + if (er) { + return cb(er); + } + fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); + }); + } + else if (st.isSymbolicLink()) { + return cb(new SymlinkError(part, part + '/' + parts.join('/'))); + } + else { + cb(er); + } + }); + } + else { + created = created || part; + mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); + } +}; +const checkCwdSync = (dir) => { + let ok = false; + let code = undefined; + try { + ok = fs.statSync(dir).isDirectory(); + } + catch (er) { + code = er?.code; + } + finally { + if (!ok) { + throw new CwdError(dir, code ?? 'ENOTDIR'); + } + } +}; +export const mkdirSync = (dir, opt) => { + dir = normalizeWindowsPath(dir); + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + /* c8 ignore next */ + const umask = opt.umask ?? 0o22; + const mode = opt.mode | 0o700; + const needChmod = (mode & umask) !== 0; + const uid = opt.uid; + const gid = opt.gid; + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + (uid !== opt.processUid || gid !== opt.processGid); + const preserve = opt.preserve; + const unlink = opt.unlink; + const cache = opt.cache; + const cwd = normalizeWindowsPath(opt.cwd); + const done = (created) => { + cSet(cache, dir, true); + if (created && doChown) { + chownrSync(created, uid, gid); + } + if (needChmod) { + fs.chmodSync(dir, mode); + } + }; + if (cache && cGet(cache, dir) === true) { + return done(); + } + if (dir === cwd) { + checkCwdSync(cwd); + return done(); + } + if (preserve) { + return done(mkdirpSync(dir, mode) ?? undefined); + } + const sub = normalizeWindowsPath(path.relative(cwd, dir)); + const parts = sub.split('/'); + let created = undefined; + for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) { + part = normalizeWindowsPath(path.resolve(part)); + if (cGet(cache, part)) { + continue; + } + try { + fs.mkdirSync(part, mode); + created = created || part; + cSet(cache, part, true); + } + catch (er) { + const st = fs.lstatSync(part); + if (st.isDirectory()) { + cSet(cache, part, true); + continue; + } + else if (unlink) { + fs.unlinkSync(part); + fs.mkdirSync(part, mode); + created = created || part; + cSet(cache, part, true); + continue; + } + else if (st.isSymbolicLink()) { + return new SymlinkError(part, part + '/' + parts.join('/')); + } + } + } + return done(created); +}; +//# sourceMappingURL=mkdir.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/mode-fix.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/mode-fix.js new file mode 100644 index 00000000..5fd3bb88 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/mode-fix.js @@ -0,0 +1,25 @@ +export const modeFix = (mode, isDir, portable) => { + mode &= 0o7777; + // in portable mode, use the minimum reasonable umask + // if this system creates files with 0o664 by default + // (as some linux distros do), then we'll write the + // archive with 0o644 instead. Also, don't ever create + // a file that is not readable/writable by the owner. + if (portable) { + mode = (mode | 0o600) & ~0o22; + } + // if dirs are readable, then they should be listable + if (isDir) { + if (mode & 0o400) { + mode |= 0o100; + } + if (mode & 0o40) { + mode |= 0o10; + } + if (mode & 0o4) { + mode |= 0o1; + } + } + return mode; +}; +//# sourceMappingURL=mode-fix.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/normalize-unicode.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/normalize-unicode.js new file mode 100644 index 00000000..94e50954 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/normalize-unicode.js @@ -0,0 +1,13 @@ +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +const normalizeCache = Object.create(null); +const { hasOwnProperty } = Object.prototype; +export const normalizeUnicode = (s) => { + if (!hasOwnProperty.call(normalizeCache, s)) { + normalizeCache[s] = s.normalize('NFD'); + } + return normalizeCache[s]; +}; +//# sourceMappingURL=normalize-unicode.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/normalize-windows-path.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/normalize-windows-path.js new file mode 100644 index 00000000..2d97d2b8 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/normalize-windows-path.js @@ -0,0 +1,9 @@ +// on windows, either \ or / are valid directory separators. +// on unix, \ is a valid character in filenames. +// so, on windows, and only on windows, we replace all \ chars with /, +// so that we can use / as our one and only directory separator char. +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +export const normalizeWindowsPath = platform !== 'win32' ? + (p) => p + : (p) => p && p.replace(/\\/g, '/'); +//# sourceMappingURL=normalize-windows-path.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/options.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/options.js new file mode 100644 index 00000000..a006d36c --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/options.js @@ -0,0 +1,54 @@ +// turn tar(1) style args like `C` into the more verbose things like `cwd` +const argmap = new Map([ + ['C', 'cwd'], + ['f', 'file'], + ['z', 'gzip'], + ['P', 'preservePaths'], + ['U', 'unlink'], + ['strip-components', 'strip'], + ['stripComponents', 'strip'], + ['keep-newer', 'newer'], + ['keepNewer', 'newer'], + ['keep-newer-files', 'newer'], + ['keepNewerFiles', 'newer'], + ['k', 'keep'], + ['keep-existing', 'keep'], + ['keepExisting', 'keep'], + ['m', 'noMtime'], + ['no-mtime', 'noMtime'], + ['p', 'preserveOwner'], + ['L', 'follow'], + ['h', 'follow'], + ['onentry', 'onReadEntry'], +]); +export const isSyncFile = (o) => !!o.sync && !!o.file; +export const isAsyncFile = (o) => !o.sync && !!o.file; +export const isSyncNoFile = (o) => !!o.sync && !o.file; +export const isAsyncNoFile = (o) => !o.sync && !o.file; +export const isSync = (o) => !!o.sync; +export const isAsync = (o) => !o.sync; +export const isFile = (o) => !!o.file; +export const isNoFile = (o) => !o.file; +const dealiasKey = (k) => { + const d = argmap.get(k); + if (d) + return d; + return k; +}; +export const dealias = (opt = {}) => { + if (!opt) + return {}; + const result = {}; + for (const [key, v] of Object.entries(opt)) { + // TS doesn't know that aliases are going to always be the same type + const k = dealiasKey(key); + result[k] = v; + } + // affordance for deprecated noChmod -> chmod + if (result.chmod === undefined && result.noChmod === false) { + result.chmod = true; + } + delete result.noChmod; + return result; +}; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/pack.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/pack.js new file mode 100644 index 00000000..f59f32f9 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/pack.js @@ -0,0 +1,445 @@ +// A readable tar stream creator +// Technically, this is a transform stream that you write paths into, +// and tar format comes out of. +// The `add()` method is like `write()` but returns this, +// and end() return `this` as well, so you can +// do `new Pack(opt).add('files').add('dir').end().pipe(output) +// You could also do something like: +// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar')) +import fs from 'fs'; +import { WriteEntry, WriteEntrySync, WriteEntryTar, } from './write-entry.js'; +export class PackJob { + path; + absolute; + entry; + stat; + readdir; + pending = false; + ignore = false; + piped = false; + constructor(path, absolute) { + this.path = path || './'; + this.absolute = absolute; + } +} +import { Minipass } from 'minipass'; +import * as zlib from 'minizlib'; +import { Yallist } from 'yallist'; +import { ReadEntry } from './read-entry.js'; +import { warnMethod, } from './warn-method.js'; +const EOF = Buffer.alloc(1024); +const ONSTAT = Symbol('onStat'); +const ENDED = Symbol('ended'); +const QUEUE = Symbol('queue'); +const CURRENT = Symbol('current'); +const PROCESS = Symbol('process'); +const PROCESSING = Symbol('processing'); +const PROCESSJOB = Symbol('processJob'); +const JOBS = Symbol('jobs'); +const JOBDONE = Symbol('jobDone'); +const ADDFSENTRY = Symbol('addFSEntry'); +const ADDTARENTRY = Symbol('addTarEntry'); +const STAT = Symbol('stat'); +const READDIR = Symbol('readdir'); +const ONREADDIR = Symbol('onreaddir'); +const PIPE = Symbol('pipe'); +const ENTRY = Symbol('entry'); +const ENTRYOPT = Symbol('entryOpt'); +const WRITEENTRYCLASS = Symbol('writeEntryClass'); +const WRITE = Symbol('write'); +const ONDRAIN = Symbol('ondrain'); +import path from 'path'; +import { normalizeWindowsPath } from './normalize-windows-path.js'; +export class Pack extends Minipass { + opt; + cwd; + maxReadSize; + preservePaths; + strict; + noPax; + prefix; + linkCache; + statCache; + file; + portable; + zip; + readdirCache; + noDirRecurse; + follow; + noMtime; + mtime; + filter; + jobs; + [WRITEENTRYCLASS]; + onWriteEntry; + [QUEUE]; + [JOBS] = 0; + [PROCESSING] = false; + [ENDED] = false; + constructor(opt = {}) { + //@ts-ignore + super(); + this.opt = opt; + this.file = opt.file || ''; + this.cwd = opt.cwd || process.cwd(); + this.maxReadSize = opt.maxReadSize; + this.preservePaths = !!opt.preservePaths; + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.prefix = normalizeWindowsPath(opt.prefix || ''); + this.linkCache = opt.linkCache || new Map(); + this.statCache = opt.statCache || new Map(); + this.readdirCache = opt.readdirCache || new Map(); + this.onWriteEntry = opt.onWriteEntry; + this[WRITEENTRYCLASS] = WriteEntry; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + this.portable = !!opt.portable; + if (opt.gzip || opt.brotli) { + if (opt.gzip && opt.brotli) { + throw new TypeError('gzip and brotli are mutually exclusive'); + } + if (opt.gzip) { + if (typeof opt.gzip !== 'object') { + opt.gzip = {}; + } + if (this.portable) { + opt.gzip.portable = true; + } + this.zip = new zlib.Gzip(opt.gzip); + } + if (opt.brotli) { + if (typeof opt.brotli !== 'object') { + opt.brotli = {}; + } + this.zip = new zlib.BrotliCompress(opt.brotli); + } + /* c8 ignore next */ + if (!this.zip) + throw new Error('impossible'); + const zip = this.zip; + zip.on('data', chunk => super.write(chunk)); + zip.on('end', () => super.end()); + zip.on('drain', () => this[ONDRAIN]()); + this.on('resume', () => zip.resume()); + } + else { + this.on('drain', this[ONDRAIN]); + } + this.noDirRecurse = !!opt.noDirRecurse; + this.follow = !!opt.follow; + this.noMtime = !!opt.noMtime; + if (opt.mtime) + this.mtime = opt.mtime; + this.filter = + typeof opt.filter === 'function' ? opt.filter : () => true; + this[QUEUE] = new Yallist(); + this[JOBS] = 0; + this.jobs = Number(opt.jobs) || 4; + this[PROCESSING] = false; + this[ENDED] = false; + } + [WRITE](chunk) { + return super.write(chunk); + } + add(path) { + this.write(path); + return this; + } + end(path, encoding, cb) { + /* c8 ignore start */ + if (typeof path === 'function') { + cb = path; + path = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + /* c8 ignore stop */ + if (path) { + this.add(path); + } + this[ENDED] = true; + this[PROCESS](); + /* c8 ignore next */ + if (cb) + cb(); + return this; + } + write(path) { + if (this[ENDED]) { + throw new Error('write after end'); + } + if (path instanceof ReadEntry) { + this[ADDTARENTRY](path); + } + else { + this[ADDFSENTRY](path); + } + return this.flowing; + } + [ADDTARENTRY](p) { + const absolute = normalizeWindowsPath(path.resolve(this.cwd, p.path)); + // in this case, we don't have to wait for the stat + if (!this.filter(p.path, p)) { + p.resume(); + } + else { + const job = new PackJob(p.path, absolute); + job.entry = new WriteEntryTar(p, this[ENTRYOPT](job)); + job.entry.on('end', () => this[JOBDONE](job)); + this[JOBS] += 1; + this[QUEUE].push(job); + } + this[PROCESS](); + } + [ADDFSENTRY](p) { + const absolute = normalizeWindowsPath(path.resolve(this.cwd, p)); + this[QUEUE].push(new PackJob(p, absolute)); + this[PROCESS](); + } + [STAT](job) { + job.pending = true; + this[JOBS] += 1; + const stat = this.follow ? 'stat' : 'lstat'; + fs[stat](job.absolute, (er, stat) => { + job.pending = false; + this[JOBS] -= 1; + if (er) { + this.emit('error', er); + } + else { + this[ONSTAT](job, stat); + } + }); + } + [ONSTAT](job, stat) { + this.statCache.set(job.absolute, stat); + job.stat = stat; + // now we have the stat, we can filter it. + if (!this.filter(job.path, stat)) { + job.ignore = true; + } + this[PROCESS](); + } + [READDIR](job) { + job.pending = true; + this[JOBS] += 1; + fs.readdir(job.absolute, (er, entries) => { + job.pending = false; + this[JOBS] -= 1; + if (er) { + return this.emit('error', er); + } + this[ONREADDIR](job, entries); + }); + } + [ONREADDIR](job, entries) { + this.readdirCache.set(job.absolute, entries); + job.readdir = entries; + this[PROCESS](); + } + [PROCESS]() { + if (this[PROCESSING]) { + return; + } + this[PROCESSING] = true; + for (let w = this[QUEUE].head; !!w && this[JOBS] < this.jobs; w = w.next) { + this[PROCESSJOB](w.value); + if (w.value.ignore) { + const p = w.next; + this[QUEUE].removeNode(w); + w.next = p; + } + } + this[PROCESSING] = false; + if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) { + if (this.zip) { + this.zip.end(EOF); + } + else { + super.write(EOF); + super.end(); + } + } + } + get [CURRENT]() { + return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value; + } + [JOBDONE](_job) { + this[QUEUE].shift(); + this[JOBS] -= 1; + this[PROCESS](); + } + [PROCESSJOB](job) { + if (job.pending) { + return; + } + if (job.entry) { + if (job === this[CURRENT] && !job.piped) { + this[PIPE](job); + } + return; + } + if (!job.stat) { + const sc = this.statCache.get(job.absolute); + if (sc) { + this[ONSTAT](job, sc); + } + else { + this[STAT](job); + } + } + if (!job.stat) { + return; + } + // filtered out! + if (job.ignore) { + return; + } + if (!this.noDirRecurse && + job.stat.isDirectory() && + !job.readdir) { + const rc = this.readdirCache.get(job.absolute); + if (rc) { + this[ONREADDIR](job, rc); + } + else { + this[READDIR](job); + } + if (!job.readdir) { + return; + } + } + // we know it doesn't have an entry, because that got checked above + job.entry = this[ENTRY](job); + if (!job.entry) { + job.ignore = true; + return; + } + if (job === this[CURRENT] && !job.piped) { + this[PIPE](job); + } + } + [ENTRYOPT](job) { + return { + onwarn: (code, msg, data) => this.warn(code, msg, data), + noPax: this.noPax, + cwd: this.cwd, + absolute: job.absolute, + preservePaths: this.preservePaths, + maxReadSize: this.maxReadSize, + strict: this.strict, + portable: this.portable, + linkCache: this.linkCache, + statCache: this.statCache, + noMtime: this.noMtime, + mtime: this.mtime, + prefix: this.prefix, + onWriteEntry: this.onWriteEntry, + }; + } + [ENTRY](job) { + this[JOBS] += 1; + try { + const e = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)); + return e + .on('end', () => this[JOBDONE](job)) + .on('error', er => this.emit('error', er)); + } + catch (er) { + this.emit('error', er); + } + } + [ONDRAIN]() { + if (this[CURRENT] && this[CURRENT].entry) { + this[CURRENT].entry.resume(); + } + } + // like .pipe() but using super, because our write() is special + [PIPE](job) { + job.piped = true; + if (job.readdir) { + job.readdir.forEach(entry => { + const p = job.path; + const base = p === './' ? '' : p.replace(/\/*$/, '/'); + this[ADDFSENTRY](base + entry); + }); + } + const source = job.entry; + const zip = this.zip; + /* c8 ignore start */ + if (!source) + throw new Error('cannot pipe without source'); + /* c8 ignore stop */ + if (zip) { + source.on('data', chunk => { + if (!zip.write(chunk)) { + source.pause(); + } + }); + } + else { + source.on('data', chunk => { + if (!super.write(chunk)) { + source.pause(); + } + }); + } + } + pause() { + if (this.zip) { + this.zip.pause(); + } + return super.pause(); + } + warn(code, message, data = {}) { + warnMethod(this, code, message, data); + } +} +export class PackSync extends Pack { + sync = true; + constructor(opt) { + super(opt); + this[WRITEENTRYCLASS] = WriteEntrySync; + } + // pause/resume are no-ops in sync streams. + pause() { } + resume() { } + [STAT](job) { + const stat = this.follow ? 'statSync' : 'lstatSync'; + this[ONSTAT](job, fs[stat](job.absolute)); + } + [READDIR](job) { + this[ONREADDIR](job, fs.readdirSync(job.absolute)); + } + // gotta get it all in this tick + [PIPE](job) { + const source = job.entry; + const zip = this.zip; + if (job.readdir) { + job.readdir.forEach(entry => { + const p = job.path; + const base = p === './' ? '' : p.replace(/\/*$/, '/'); + this[ADDFSENTRY](base + entry); + }); + } + /* c8 ignore start */ + if (!source) + throw new Error('Cannot pipe without source'); + /* c8 ignore stop */ + if (zip) { + source.on('data', chunk => { + zip.write(chunk); + }); + } + else { + source.on('data', chunk => { + super[WRITE](chunk); + }); + } + } +} +//# sourceMappingURL=pack.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/package.json b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/parse.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/parse.js new file mode 100644 index 00000000..cce43047 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/parse.js @@ -0,0 +1,595 @@ +// this[BUFFER] is the remainder of a chunk if we're waiting for +// the full 512 bytes of a header to come in. We will Buffer.concat() +// it to the next write(), which is a mem copy, but a small one. +// +// this[QUEUE] is a Yallist of entries that haven't been emitted +// yet this can only get filled up if the user keeps write()ing after +// a write() returns false, or does a write() with more than one entry +// +// We don't buffer chunks, we always parse them and either create an +// entry, or push it into the active entry. The ReadEntry class knows +// to throw data away if .ignore=true +// +// Shift entry off the buffer when it emits 'end', and emit 'entry' for +// the next one in the list. +// +// At any time, we're pushing body chunks into the entry at WRITEENTRY, +// and waiting for 'end' on the entry at READENTRY +// +// ignored entries get .resume() called on them straight away +import { EventEmitter as EE } from 'events'; +import { BrotliDecompress, Unzip } from 'minizlib'; +import { Yallist } from 'yallist'; +import { Header } from './header.js'; +import { Pax } from './pax.js'; +import { ReadEntry } from './read-entry.js'; +import { warnMethod, } from './warn-method.js'; +const maxMetaEntrySize = 1024 * 1024; +const gzipHeader = Buffer.from([0x1f, 0x8b]); +const STATE = Symbol('state'); +const WRITEENTRY = Symbol('writeEntry'); +const READENTRY = Symbol('readEntry'); +const NEXTENTRY = Symbol('nextEntry'); +const PROCESSENTRY = Symbol('processEntry'); +const EX = Symbol('extendedHeader'); +const GEX = Symbol('globalExtendedHeader'); +const META = Symbol('meta'); +const EMITMETA = Symbol('emitMeta'); +const BUFFER = Symbol('buffer'); +const QUEUE = Symbol('queue'); +const ENDED = Symbol('ended'); +const EMITTEDEND = Symbol('emittedEnd'); +const EMIT = Symbol('emit'); +const UNZIP = Symbol('unzip'); +const CONSUMECHUNK = Symbol('consumeChunk'); +const CONSUMECHUNKSUB = Symbol('consumeChunkSub'); +const CONSUMEBODY = Symbol('consumeBody'); +const CONSUMEMETA = Symbol('consumeMeta'); +const CONSUMEHEADER = Symbol('consumeHeader'); +const CONSUMING = Symbol('consuming'); +const BUFFERCONCAT = Symbol('bufferConcat'); +const MAYBEEND = Symbol('maybeEnd'); +const WRITING = Symbol('writing'); +const ABORTED = Symbol('aborted'); +const DONE = Symbol('onDone'); +const SAW_VALID_ENTRY = Symbol('sawValidEntry'); +const SAW_NULL_BLOCK = Symbol('sawNullBlock'); +const SAW_EOF = Symbol('sawEOF'); +const CLOSESTREAM = Symbol('closeStream'); +const noop = () => true; +export class Parser extends EE { + file; + strict; + maxMetaEntrySize; + filter; + brotli; + writable = true; + readable = false; + [QUEUE] = new Yallist(); + [BUFFER]; + [READENTRY]; + [WRITEENTRY]; + [STATE] = 'begin'; + [META] = ''; + [EX]; + [GEX]; + [ENDED] = false; + [UNZIP]; + [ABORTED] = false; + [SAW_VALID_ENTRY]; + [SAW_NULL_BLOCK] = false; + [SAW_EOF] = false; + [WRITING] = false; + [CONSUMING] = false; + [EMITTEDEND] = false; + constructor(opt = {}) { + super(); + this.file = opt.file || ''; + // these BADARCHIVE errors can't be detected early. listen on DONE. + this.on(DONE, () => { + if (this[STATE] === 'begin' || + this[SAW_VALID_ENTRY] === false) { + // either less than 1 block of data, or all entries were invalid. + // Either way, probably not even a tarball. + this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format'); + } + }); + if (opt.ondone) { + this.on(DONE, opt.ondone); + } + else { + this.on(DONE, () => { + this.emit('prefinish'); + this.emit('finish'); + this.emit('end'); + }); + } + this.strict = !!opt.strict; + this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize; + this.filter = typeof opt.filter === 'function' ? opt.filter : noop; + // Unlike gzip, brotli doesn't have any magic bytes to identify it + // Users need to explicitly tell us they're extracting a brotli file + // Or we infer from the file extension + const isTBR = opt.file && + (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')); + // if it's a tbr file it MIGHT be brotli, but we don't know until + // we look at it and verify it's not a valid tar file. + this.brotli = + !opt.gzip && opt.brotli !== undefined ? opt.brotli + : isTBR ? undefined + : false; + // have to set this so that streams are ok piping into it + this.on('end', () => this[CLOSESTREAM]()); + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + if (typeof opt.onReadEntry === 'function') { + this.on('entry', opt.onReadEntry); + } + } + warn(code, message, data = {}) { + warnMethod(this, code, message, data); + } + [CONSUMEHEADER](chunk, position) { + if (this[SAW_VALID_ENTRY] === undefined) { + this[SAW_VALID_ENTRY] = false; + } + let header; + try { + header = new Header(chunk, position, this[EX], this[GEX]); + } + catch (er) { + return this.warn('TAR_ENTRY_INVALID', er); + } + if (header.nullBlock) { + if (this[SAW_NULL_BLOCK]) { + this[SAW_EOF] = true; + // ending an archive with no entries. pointless, but legal. + if (this[STATE] === 'begin') { + this[STATE] = 'header'; + } + this[EMIT]('eof'); + } + else { + this[SAW_NULL_BLOCK] = true; + this[EMIT]('nullBlock'); + } + } + else { + this[SAW_NULL_BLOCK] = false; + if (!header.cksumValid) { + this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header }); + } + else if (!header.path) { + this.warn('TAR_ENTRY_INVALID', 'path is required', { header }); + } + else { + const type = header.type; + if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) { + this.warn('TAR_ENTRY_INVALID', 'linkpath required', { + header, + }); + } + else if (!/^(Symbolic)?Link$/.test(type) && + !/^(Global)?ExtendedHeader$/.test(type) && + header.linkpath) { + this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', { + header, + }); + } + else { + const entry = (this[WRITEENTRY] = new ReadEntry(header, this[EX], this[GEX])); + // we do this for meta & ignored entries as well, because they + // are still valid tar, or else we wouldn't know to ignore them + if (!this[SAW_VALID_ENTRY]) { + if (entry.remain) { + // this might be the one! + const onend = () => { + if (!entry.invalid) { + this[SAW_VALID_ENTRY] = true; + } + }; + entry.on('end', onend); + } + else { + this[SAW_VALID_ENTRY] = true; + } + } + if (entry.meta) { + if (entry.size > this.maxMetaEntrySize) { + entry.ignore = true; + this[EMIT]('ignoredEntry', entry); + this[STATE] = 'ignore'; + entry.resume(); + } + else if (entry.size > 0) { + this[META] = ''; + entry.on('data', c => (this[META] += c)); + this[STATE] = 'meta'; + } + } + else { + this[EX] = undefined; + entry.ignore = + entry.ignore || !this.filter(entry.path, entry); + if (entry.ignore) { + // probably valid, just not something we care about + this[EMIT]('ignoredEntry', entry); + this[STATE] = entry.remain ? 'ignore' : 'header'; + entry.resume(); + } + else { + if (entry.remain) { + this[STATE] = 'body'; + } + else { + this[STATE] = 'header'; + entry.end(); + } + if (!this[READENTRY]) { + this[QUEUE].push(entry); + this[NEXTENTRY](); + } + else { + this[QUEUE].push(entry); + } + } + } + } + } + } + } + [CLOSESTREAM]() { + queueMicrotask(() => this.emit('close')); + } + [PROCESSENTRY](entry) { + let go = true; + if (!entry) { + this[READENTRY] = undefined; + go = false; + } + else if (Array.isArray(entry)) { + const [ev, ...args] = entry; + this.emit(ev, ...args); + } + else { + this[READENTRY] = entry; + this.emit('entry', entry); + if (!entry.emittedEnd) { + entry.on('end', () => this[NEXTENTRY]()); + go = false; + } + } + return go; + } + [NEXTENTRY]() { + do { } while (this[PROCESSENTRY](this[QUEUE].shift())); + if (!this[QUEUE].length) { + // At this point, there's nothing in the queue, but we may have an + // entry which is being consumed (readEntry). + // If we don't, then we definitely can handle more data. + // If we do, and either it's flowing, or it has never had any data + // written to it, then it needs more. + // The only other possibility is that it has returned false from a + // write() call, so we wait for the next drain to continue. + const re = this[READENTRY]; + const drainNow = !re || re.flowing || re.size === re.remain; + if (drainNow) { + if (!this[WRITING]) { + this.emit('drain'); + } + } + else { + re.once('drain', () => this.emit('drain')); + } + } + } + [CONSUMEBODY](chunk, position) { + // write up to but no more than writeEntry.blockRemain + const entry = this[WRITEENTRY]; + /* c8 ignore start */ + if (!entry) { + throw new Error('attempt to consume body without entry??'); + } + const br = entry.blockRemain ?? 0; + /* c8 ignore stop */ + const c = br >= chunk.length && position === 0 ? + chunk + : chunk.subarray(position, position + br); + entry.write(c); + if (!entry.blockRemain) { + this[STATE] = 'header'; + this[WRITEENTRY] = undefined; + entry.end(); + } + return c.length; + } + [CONSUMEMETA](chunk, position) { + const entry = this[WRITEENTRY]; + const ret = this[CONSUMEBODY](chunk, position); + // if we finished, then the entry is reset + if (!this[WRITEENTRY] && entry) { + this[EMITMETA](entry); + } + return ret; + } + [EMIT](ev, data, extra) { + if (!this[QUEUE].length && !this[READENTRY]) { + this.emit(ev, data, extra); + } + else { + this[QUEUE].push([ev, data, extra]); + } + } + [EMITMETA](entry) { + this[EMIT]('meta', this[META]); + switch (entry.type) { + case 'ExtendedHeader': + case 'OldExtendedHeader': + this[EX] = Pax.parse(this[META], this[EX], false); + break; + case 'GlobalExtendedHeader': + this[GEX] = Pax.parse(this[META], this[GEX], true); + break; + case 'NextFileHasLongPath': + case 'OldGnuLongPath': { + const ex = this[EX] ?? Object.create(null); + this[EX] = ex; + ex.path = this[META].replace(/\0.*/, ''); + break; + } + case 'NextFileHasLongLinkpath': { + const ex = this[EX] || Object.create(null); + this[EX] = ex; + ex.linkpath = this[META].replace(/\0.*/, ''); + break; + } + /* c8 ignore start */ + default: + throw new Error('unknown meta: ' + entry.type); + /* c8 ignore stop */ + } + } + abort(error) { + this[ABORTED] = true; + this.emit('abort', error); + // always throws, even in non-strict mode + this.warn('TAR_ABORT', error, { recoverable: false }); + } + write(chunk, encoding, cb) { + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, + /* c8 ignore next */ + typeof encoding === 'string' ? encoding : 'utf8'); + } + if (this[ABORTED]) { + /* c8 ignore next */ + cb?.(); + return false; + } + // first write, might be gzipped + const needSniff = this[UNZIP] === undefined || + (this.brotli === undefined && this[UNZIP] === false); + if (needSniff && chunk) { + if (this[BUFFER]) { + chunk = Buffer.concat([this[BUFFER], chunk]); + this[BUFFER] = undefined; + } + if (chunk.length < gzipHeader.length) { + this[BUFFER] = chunk; + /* c8 ignore next */ + cb?.(); + return true; + } + // look for gzip header + for (let i = 0; this[UNZIP] === undefined && i < gzipHeader.length; i++) { + if (chunk[i] !== gzipHeader[i]) { + this[UNZIP] = false; + } + } + const maybeBrotli = this.brotli === undefined; + if (this[UNZIP] === false && maybeBrotli) { + // read the first header to see if it's a valid tar file. If so, + // we can safely assume that it's not actually brotli, despite the + // .tbr or .tar.br file extension. + // if we ended before getting a full chunk, yes, def brotli + if (chunk.length < 512) { + if (this[ENDED]) { + this.brotli = true; + } + else { + this[BUFFER] = chunk; + /* c8 ignore next */ + cb?.(); + return true; + } + } + else { + // if it's tar, it's pretty reliably not brotli, chances of + // that happening are astronomical. + try { + new Header(chunk.subarray(0, 512)); + this.brotli = false; + } + catch (_) { + this.brotli = true; + } + } + } + if (this[UNZIP] === undefined || + (this[UNZIP] === false && this.brotli)) { + const ended = this[ENDED]; + this[ENDED] = false; + this[UNZIP] = + this[UNZIP] === undefined ? + new Unzip({}) + : new BrotliDecompress({}); + this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)); + this[UNZIP].on('error', er => this.abort(er)); + this[UNZIP].on('end', () => { + this[ENDED] = true; + this[CONSUMECHUNK](); + }); + this[WRITING] = true; + const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk); + this[WRITING] = false; + cb?.(); + return ret; + } + } + this[WRITING] = true; + if (this[UNZIP]) { + this[UNZIP].write(chunk); + } + else { + this[CONSUMECHUNK](chunk); + } + this[WRITING] = false; + // return false if there's a queue, or if the current entry isn't flowing + const ret = this[QUEUE].length ? false + : this[READENTRY] ? this[READENTRY].flowing + : true; + // if we have no queue, then that means a clogged READENTRY + if (!ret && !this[QUEUE].length) { + this[READENTRY]?.once('drain', () => this.emit('drain')); + } + /* c8 ignore next */ + cb?.(); + return ret; + } + [BUFFERCONCAT](c) { + if (c && !this[ABORTED]) { + this[BUFFER] = + this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c; + } + } + [MAYBEEND]() { + if (this[ENDED] && + !this[EMITTEDEND] && + !this[ABORTED] && + !this[CONSUMING]) { + this[EMITTEDEND] = true; + const entry = this[WRITEENTRY]; + if (entry && entry.blockRemain) { + // truncated, likely a damaged file + const have = this[BUFFER] ? this[BUFFER].length : 0; + this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry }); + if (this[BUFFER]) { + entry.write(this[BUFFER]); + } + entry.end(); + } + this[EMIT](DONE); + } + } + [CONSUMECHUNK](chunk) { + if (this[CONSUMING] && chunk) { + this[BUFFERCONCAT](chunk); + } + else if (!chunk && !this[BUFFER]) { + this[MAYBEEND](); + } + else if (chunk) { + this[CONSUMING] = true; + if (this[BUFFER]) { + this[BUFFERCONCAT](chunk); + const c = this[BUFFER]; + this[BUFFER] = undefined; + this[CONSUMECHUNKSUB](c); + } + else { + this[CONSUMECHUNKSUB](chunk); + } + while (this[BUFFER] && + this[BUFFER]?.length >= 512 && + !this[ABORTED] && + !this[SAW_EOF]) { + const c = this[BUFFER]; + this[BUFFER] = undefined; + this[CONSUMECHUNKSUB](c); + } + this[CONSUMING] = false; + } + if (!this[BUFFER] || this[ENDED]) { + this[MAYBEEND](); + } + } + [CONSUMECHUNKSUB](chunk) { + // we know that we are in CONSUMING mode, so anything written goes into + // the buffer. Advance the position and put any remainder in the buffer. + let position = 0; + const length = chunk.length; + while (position + 512 <= length && + !this[ABORTED] && + !this[SAW_EOF]) { + switch (this[STATE]) { + case 'begin': + case 'header': + this[CONSUMEHEADER](chunk, position); + position += 512; + break; + case 'ignore': + case 'body': + position += this[CONSUMEBODY](chunk, position); + break; + case 'meta': + position += this[CONSUMEMETA](chunk, position); + break; + /* c8 ignore start */ + default: + throw new Error('invalid state: ' + this[STATE]); + /* c8 ignore stop */ + } + } + if (position < length) { + if (this[BUFFER]) { + this[BUFFER] = Buffer.concat([ + chunk.subarray(position), + this[BUFFER], + ]); + } + else { + this[BUFFER] = chunk.subarray(position); + } + } + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + if (cb) + this.once('finish', cb); + if (!this[ABORTED]) { + if (this[UNZIP]) { + /* c8 ignore start */ + if (chunk) + this[UNZIP].write(chunk); + /* c8 ignore stop */ + this[UNZIP].end(); + } + else { + this[ENDED] = true; + if (this.brotli === undefined) + chunk = chunk || Buffer.alloc(0); + if (chunk) + this.write(chunk); + this[MAYBEEND](); + } + } + return this; + } +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/path-reservations.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/path-reservations.js new file mode 100644 index 00000000..e63b9c91 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/path-reservations.js @@ -0,0 +1,166 @@ +// A path exclusive reservation system +// reserve([list, of, paths], fn) +// When the fn is first in line for all its paths, it +// is called with a cb that clears the reservation. +// +// Used by async unpack to avoid clobbering paths in use, +// while still allowing maximal safe parallelization. +import { join } from 'node:path'; +import { normalizeUnicode } from './normalize-unicode.js'; +import { stripTrailingSlashes } from './strip-trailing-slashes.js'; +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +const isWindows = platform === 'win32'; +// return a set of parent dirs for a given path +// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d'] +const getDirs = (path) => { + const dirs = path + .split('/') + .slice(0, -1) + .reduce((set, path) => { + const s = set[set.length - 1]; + if (s !== undefined) { + path = join(s, path); + } + set.push(path || '/'); + return set; + }, []); + return dirs; +}; +export class PathReservations { + // path => [function or Set] + // A Set object means a directory reservation + // A fn is a direct reservation on that path + #queues = new Map(); + // fn => {paths:[path,...], dirs:[path, ...]} + #reservations = new Map(); + // functions currently running + #running = new Set(); + reserve(paths, fn) { + paths = + isWindows ? + ['win32 parallelization disabled'] + : paths.map(p => { + // don't need normPath, because we skip this entirely for windows + return stripTrailingSlashes(join(normalizeUnicode(p))).toLowerCase(); + }); + const dirs = new Set(paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b))); + this.#reservations.set(fn, { dirs, paths }); + for (const p of paths) { + const q = this.#queues.get(p); + if (!q) { + this.#queues.set(p, [fn]); + } + else { + q.push(fn); + } + } + for (const dir of dirs) { + const q = this.#queues.get(dir); + if (!q) { + this.#queues.set(dir, [new Set([fn])]); + } + else { + const l = q[q.length - 1]; + if (l instanceof Set) { + l.add(fn); + } + else { + q.push(new Set([fn])); + } + } + } + return this.#run(fn); + } + // return the queues for each path the function cares about + // fn => {paths, dirs} + #getQueues(fn) { + const res = this.#reservations.get(fn); + /* c8 ignore start */ + if (!res) { + throw new Error('function does not have any path reservations'); + } + /* c8 ignore stop */ + return { + paths: res.paths.map((path) => this.#queues.get(path)), + dirs: [...res.dirs].map(path => this.#queues.get(path)), + }; + } + // check if fn is first in line for all its paths, and is + // included in the first set for all its dir queues + check(fn) { + const { paths, dirs } = this.#getQueues(fn); + return (paths.every(q => q && q[0] === fn) && + dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))); + } + // run the function if it's first in line and not already running + #run(fn) { + if (this.#running.has(fn) || !this.check(fn)) { + return false; + } + this.#running.add(fn); + fn(() => this.#clear(fn)); + return true; + } + #clear(fn) { + if (!this.#running.has(fn)) { + return false; + } + const res = this.#reservations.get(fn); + /* c8 ignore start */ + if (!res) { + throw new Error('invalid reservation'); + } + /* c8 ignore stop */ + const { paths, dirs } = res; + const next = new Set(); + for (const path of paths) { + const q = this.#queues.get(path); + /* c8 ignore start */ + if (!q || q?.[0] !== fn) { + continue; + } + /* c8 ignore stop */ + const q0 = q[1]; + if (!q0) { + this.#queues.delete(path); + continue; + } + q.shift(); + if (typeof q0 === 'function') { + next.add(q0); + } + else { + for (const f of q0) { + next.add(f); + } + } + } + for (const dir of dirs) { + const q = this.#queues.get(dir); + const q0 = q?.[0]; + /* c8 ignore next - type safety only */ + if (!q || !(q0 instanceof Set)) + continue; + if (q0.size === 1 && q.length === 1) { + this.#queues.delete(dir); + continue; + } + else if (q0.size === 1) { + q.shift(); + // next one must be a function, + // or else the Set would've been reused + const n = q[0]; + if (typeof n === 'function') { + next.add(n); + } + } + else { + q0.delete(fn); + } + } + this.#running.delete(fn); + next.forEach(fn => this.#run(fn)); + return true; + } +} +//# sourceMappingURL=path-reservations.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/pax.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/pax.js new file mode 100644 index 00000000..832808f3 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/pax.js @@ -0,0 +1,154 @@ +import { basename } from 'node:path'; +import { Header } from './header.js'; +export class Pax { + atime; + mtime; + ctime; + charset; + comment; + gid; + uid; + gname; + uname; + linkpath; + dev; + ino; + nlink; + path; + size; + mode; + global; + constructor(obj, global = false) { + this.atime = obj.atime; + this.charset = obj.charset; + this.comment = obj.comment; + this.ctime = obj.ctime; + this.dev = obj.dev; + this.gid = obj.gid; + this.global = global; + this.gname = obj.gname; + this.ino = obj.ino; + this.linkpath = obj.linkpath; + this.mtime = obj.mtime; + this.nlink = obj.nlink; + this.path = obj.path; + this.size = obj.size; + this.uid = obj.uid; + this.uname = obj.uname; + } + encode() { + const body = this.encodeBody(); + if (body === '') { + return Buffer.allocUnsafe(0); + } + const bodyLen = Buffer.byteLength(body); + // round up to 512 bytes + // add 512 for header + const bufLen = 512 * Math.ceil(1 + bodyLen / 512); + const buf = Buffer.allocUnsafe(bufLen); + // 0-fill the header section, it might not hit every field + for (let i = 0; i < 512; i++) { + buf[i] = 0; + } + new Header({ + // XXX split the path + // then the path should be PaxHeader + basename, but less than 99, + // prepend with the dirname + /* c8 ignore start */ + path: ('PaxHeader/' + basename(this.path ?? '')).slice(0, 99), + /* c8 ignore stop */ + mode: this.mode || 0o644, + uid: this.uid, + gid: this.gid, + size: bodyLen, + mtime: this.mtime, + type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader', + linkpath: '', + uname: this.uname || '', + gname: this.gname || '', + devmaj: 0, + devmin: 0, + atime: this.atime, + ctime: this.ctime, + }).encode(buf); + buf.write(body, 512, bodyLen, 'utf8'); + // null pad after the body + for (let i = bodyLen + 512; i < buf.length; i++) { + buf[i] = 0; + } + return buf; + } + encodeBody() { + return (this.encodeField('path') + + this.encodeField('ctime') + + this.encodeField('atime') + + this.encodeField('dev') + + this.encodeField('ino') + + this.encodeField('nlink') + + this.encodeField('charset') + + this.encodeField('comment') + + this.encodeField('gid') + + this.encodeField('gname') + + this.encodeField('linkpath') + + this.encodeField('mtime') + + this.encodeField('size') + + this.encodeField('uid') + + this.encodeField('uname')); + } + encodeField(field) { + if (this[field] === undefined) { + return ''; + } + const r = this[field]; + const v = r instanceof Date ? r.getTime() / 1000 : r; + const s = ' ' + + (field === 'dev' || field === 'ino' || field === 'nlink' ? + 'SCHILY.' + : '') + + field + + '=' + + v + + '\n'; + const byteLen = Buffer.byteLength(s); + // the digits includes the length of the digits in ascii base-10 + // so if it's 9 characters, then adding 1 for the 9 makes it 10 + // which makes it 11 chars. + let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1; + if (byteLen + digits >= Math.pow(10, digits)) { + digits += 1; + } + const len = digits + byteLen; + return len + s; + } + static parse(str, ex, g = false) { + return new Pax(merge(parseKV(str), ex), g); + } +} +const merge = (a, b) => b ? Object.assign({}, b, a) : a; +const parseKV = (str) => str + .replace(/\n$/, '') + .split('\n') + .reduce(parseKVLine, Object.create(null)); +const parseKVLine = (set, line) => { + const n = parseInt(line, 10); + // XXX Values with \n in them will fail this. + // Refactor to not be a naive line-by-line parse. + if (n !== Buffer.byteLength(line) + 1) { + return set; + } + line = line.slice((n + ' ').length); + const kv = line.split('='); + const r = kv.shift(); + if (!r) { + return set; + } + const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1'); + const v = kv.join('='); + set[k] = + /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? + new Date(Number(v) * 1000) + : /^[0-9]+$/.test(v) ? +v + : v; + return set; +}; +//# sourceMappingURL=pax.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/read-entry.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/read-entry.js new file mode 100644 index 00000000..23cc673e --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/read-entry.js @@ -0,0 +1,136 @@ +import { Minipass } from 'minipass'; +import { normalizeWindowsPath } from './normalize-windows-path.js'; +export class ReadEntry extends Minipass { + extended; + globalExtended; + header; + startBlockSize; + blockRemain; + remain; + type; + meta = false; + ignore = false; + path; + mode; + uid; + gid; + uname; + gname; + size = 0; + mtime; + atime; + ctime; + linkpath; + dev; + ino; + nlink; + invalid = false; + absolute; + unsupported = false; + constructor(header, ex, gex) { + super({}); + // read entries always start life paused. this is to avoid the + // situation where Minipass's auto-ending empty streams results + // in an entry ending before we're ready for it. + this.pause(); + this.extended = ex; + this.globalExtended = gex; + this.header = header; + /* c8 ignore start */ + this.remain = header.size ?? 0; + /* c8 ignore stop */ + this.startBlockSize = 512 * Math.ceil(this.remain / 512); + this.blockRemain = this.startBlockSize; + this.type = header.type; + switch (this.type) { + case 'File': + case 'OldFile': + case 'Link': + case 'SymbolicLink': + case 'CharacterDevice': + case 'BlockDevice': + case 'Directory': + case 'FIFO': + case 'ContiguousFile': + case 'GNUDumpDir': + break; + case 'NextFileHasLongLinkpath': + case 'NextFileHasLongPath': + case 'OldGnuLongPath': + case 'GlobalExtendedHeader': + case 'ExtendedHeader': + case 'OldExtendedHeader': + this.meta = true; + break; + // NOTE: gnutar and bsdtar treat unrecognized types as 'File' + // it may be worth doing the same, but with a warning. + default: + this.ignore = true; + } + /* c8 ignore start */ + if (!header.path) { + throw new Error('no path provided for tar.ReadEntry'); + } + /* c8 ignore stop */ + this.path = normalizeWindowsPath(header.path); + this.mode = header.mode; + if (this.mode) { + this.mode = this.mode & 0o7777; + } + this.uid = header.uid; + this.gid = header.gid; + this.uname = header.uname; + this.gname = header.gname; + this.size = this.remain; + this.mtime = header.mtime; + this.atime = header.atime; + this.ctime = header.ctime; + /* c8 ignore start */ + this.linkpath = + header.linkpath ? + normalizeWindowsPath(header.linkpath) + : undefined; + /* c8 ignore stop */ + this.uname = header.uname; + this.gname = header.gname; + if (ex) { + this.#slurp(ex); + } + if (gex) { + this.#slurp(gex, true); + } + } + write(data) { + const writeLen = data.length; + if (writeLen > this.blockRemain) { + throw new Error('writing more to entry than is appropriate'); + } + const r = this.remain; + const br = this.blockRemain; + this.remain = Math.max(0, r - writeLen); + this.blockRemain = Math.max(0, br - writeLen); + if (this.ignore) { + return true; + } + if (r >= writeLen) { + return super.write(data); + } + // r < writeLen + return super.write(data.subarray(0, r)); + } + #slurp(ex, gex = false) { + if (ex.path) + ex.path = normalizeWindowsPath(ex.path); + if (ex.linkpath) + ex.linkpath = normalizeWindowsPath(ex.linkpath); + Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. Also, any + // null/undefined values are ignored. + return !(v === null || + v === undefined || + (k === 'path' && gex)); + }))); + } +} +//# sourceMappingURL=read-entry.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/replace.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/replace.js new file mode 100644 index 00000000..bab622bf --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/replace.js @@ -0,0 +1,225 @@ +// tar -r +import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'; +import fs from 'node:fs'; +import path from 'node:path'; +import { Header } from './header.js'; +import { list } from './list.js'; +import { makeCommand } from './make-command.js'; +import { isFile, } from './options.js'; +import { Pack, PackSync } from './pack.js'; +// starting at the head of the file, read a Header +// If the checksum is invalid, that's our position to start writing +// If it is, jump forward by the specified size (round up to 512) +// and try again. +// Write the new Pack stream starting there. +const replaceSync = (opt, files) => { + const p = new PackSync(opt); + let threw = true; + let fd; + let position; + try { + try { + fd = fs.openSync(opt.file, 'r+'); + } + catch (er) { + if (er?.code === 'ENOENT') { + fd = fs.openSync(opt.file, 'w+'); + } + else { + throw er; + } + } + const st = fs.fstatSync(fd); + const headBuf = Buffer.alloc(512); + POSITION: for (position = 0; position < st.size; position += 512) { + for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { + bytes = fs.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos); + if (position === 0 && + headBuf[0] === 0x1f && + headBuf[1] === 0x8b) { + throw new Error('cannot append to compressed archives'); + } + if (!bytes) { + break POSITION; + } + } + const h = new Header(headBuf); + if (!h.cksumValid) { + break; + } + const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512); + if (position + entryBlockSize + 512 > st.size) { + break; + } + // the 512 for the header we just parsed will be added as well + // also jump ahead all the blocks for the body + position += entryBlockSize; + if (opt.mtimeCache && h.mtime) { + opt.mtimeCache.set(String(h.path), h.mtime); + } + } + threw = false; + streamSync(opt, p, position, fd, files); + } + finally { + if (threw) { + try { + fs.closeSync(fd); + } + catch (er) { } + } + } +}; +const streamSync = (opt, p, position, fd, files) => { + const stream = new WriteStreamSync(opt.file, { + fd: fd, + start: position, + }); + p.pipe(stream); + addFilesSync(p, files); +}; +const replaceAsync = (opt, files) => { + files = Array.from(files); + const p = new Pack(opt); + const getPos = (fd, size, cb_) => { + const cb = (er, pos) => { + if (er) { + fs.close(fd, _ => cb_(er)); + } + else { + cb_(null, pos); + } + }; + let position = 0; + if (size === 0) { + return cb(null, 0); + } + let bufPos = 0; + const headBuf = Buffer.alloc(512); + const onread = (er, bytes) => { + if (er || typeof bytes === 'undefined') { + return cb(er); + } + bufPos += bytes; + if (bufPos < 512 && bytes) { + return fs.read(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos, onread); + } + if (position === 0 && + headBuf[0] === 0x1f && + headBuf[1] === 0x8b) { + return cb(new Error('cannot append to compressed archives')); + } + // truncated header + if (bufPos < 512) { + return cb(null, position); + } + const h = new Header(headBuf); + if (!h.cksumValid) { + return cb(null, position); + } + /* c8 ignore next */ + const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512); + if (position + entryBlockSize + 512 > size) { + return cb(null, position); + } + position += entryBlockSize + 512; + if (position >= size) { + return cb(null, position); + } + if (opt.mtimeCache && h.mtime) { + opt.mtimeCache.set(String(h.path), h.mtime); + } + bufPos = 0; + fs.read(fd, headBuf, 0, 512, position, onread); + }; + fs.read(fd, headBuf, 0, 512, position, onread); + }; + const promise = new Promise((resolve, reject) => { + p.on('error', reject); + let flag = 'r+'; + const onopen = (er, fd) => { + if (er && er.code === 'ENOENT' && flag === 'r+') { + flag = 'w+'; + return fs.open(opt.file, flag, onopen); + } + if (er || !fd) { + return reject(er); + } + fs.fstat(fd, (er, st) => { + if (er) { + return fs.close(fd, () => reject(er)); + } + getPos(fd, st.size, (er, position) => { + if (er) { + return reject(er); + } + const stream = new WriteStream(opt.file, { + fd: fd, + start: position, + }); + p.pipe(stream); + stream.on('error', reject); + stream.on('close', resolve); + addFilesAsync(p, files); + }); + }); + }; + fs.open(opt.file, flag, onopen); + }); + return promise; +}; +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') { + list({ + file: path.resolve(p.cwd, file.slice(1)), + sync: true, + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + }); + p.end(); +}; +const addFilesAsync = async (p, files) => { + for (let i = 0; i < files.length; i++) { + const file = String(files[i]); + if (file.charAt(0) === '@') { + await list({ + file: path.resolve(String(p.cwd), file.slice(1)), + noResume: true, + onReadEntry: entry => p.add(entry), + }); + } + else { + p.add(file); + } + } + p.end(); +}; +export const replace = makeCommand(replaceSync, replaceAsync, +/* c8 ignore start */ +() => { + throw new TypeError('file is required'); +}, () => { + throw new TypeError('file is required'); +}, +/* c8 ignore stop */ +(opt, entries) => { + if (!isFile(opt)) { + throw new TypeError('file is required'); + } + if (opt.gzip || + opt.brotli || + opt.file.endsWith('.br') || + opt.file.endsWith('.tbr')) { + throw new TypeError('cannot append to compressed archives'); + } + if (!entries?.length) { + throw new TypeError('no paths specified to add/replace'); + } +}); +//# sourceMappingURL=replace.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/strip-absolute-path.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/strip-absolute-path.js new file mode 100644 index 00000000..cce5ff80 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/strip-absolute-path.js @@ -0,0 +1,25 @@ +// unix absolute paths are also absolute on win32, so we use this for both +import { win32 } from 'node:path'; +const { isAbsolute, parse } = win32; +// returns [root, stripped] +// Note that windows will think that //x/y/z/a has a "root" of //x/y, and in +// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip / +// explicitly if it's the first character. +// drive-specific relative paths on Windows get their root stripped off even +// though they are not absolute, so `c:../foo` becomes ['c:', '../foo'] +export const stripAbsolutePath = (path) => { + let r = ''; + let parsed = parse(path); + while (isAbsolute(path) || parsed.root) { + // windows will think that //x/y/z has a "root" of //x/y/ + // but strip the //?/C:/ off of //?/C:/path + const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ? + '/' + : parsed.root; + path = path.slice(root.length); + r += root; + parsed = parse(path); + } + return [r, path]; +}; +//# sourceMappingURL=strip-absolute-path.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/strip-trailing-slashes.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/strip-trailing-slashes.js new file mode 100644 index 00000000..ace4218a --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/strip-trailing-slashes.js @@ -0,0 +1,14 @@ +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +export const stripTrailingSlashes = (str) => { + let i = str.length - 1; + let slashesStart = -1; + while (i > -1 && str.charAt(i) === '/') { + slashesStart = i; + i--; + } + return slashesStart === -1 ? str : str.slice(0, slashesStart); +}; +//# sourceMappingURL=strip-trailing-slashes.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/symlink-error.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/symlink-error.js new file mode 100644 index 00000000..d31766e2 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/symlink-error.js @@ -0,0 +1,15 @@ +export class SymlinkError extends Error { + path; + symlink; + syscall = 'symlink'; + code = 'TAR_SYMLINK_ERROR'; + constructor(symlink, path) { + super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link'); + this.symlink = symlink; + this.path = path; + } + get name() { + return 'SymlinkError'; + } +} +//# sourceMappingURL=symlink-error.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/types.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/types.js new file mode 100644 index 00000000..27b982ae --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/types.js @@ -0,0 +1,45 @@ +export const isCode = (c) => name.has(c); +export const isName = (c) => code.has(c); +// map types from key to human-friendly name +export const name = new Map([ + ['0', 'File'], + // same as File + ['', 'OldFile'], + ['1', 'Link'], + ['2', 'SymbolicLink'], + // Devices and FIFOs aren't fully supported + // they are parsed, but skipped when unpacking + ['3', 'CharacterDevice'], + ['4', 'BlockDevice'], + ['5', 'Directory'], + ['6', 'FIFO'], + // same as File + ['7', 'ContiguousFile'], + // pax headers + ['g', 'GlobalExtendedHeader'], + ['x', 'ExtendedHeader'], + // vendor-specific stuff + // skip + ['A', 'SolarisACL'], + // like 5, but with data, which should be skipped + ['D', 'GNUDumpDir'], + // metadata only, skip + ['I', 'Inode'], + // data = link path of next file + ['K', 'NextFileHasLongLinkpath'], + // data = path of next file + ['L', 'NextFileHasLongPath'], + // skip + ['M', 'ContinuationFile'], + // like L + ['N', 'OldGnuLongPath'], + // skip + ['S', 'SparseFile'], + // skip + ['V', 'TapeVolumeHeader'], + // like x + ['X', 'OldExtendedHeader'], +]); +// map the other direction +export const code = new Map(Array.from(name).map(kv => [kv[1], kv[0]])); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/unpack.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/unpack.js new file mode 100644 index 00000000..6e744cfc --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/unpack.js @@ -0,0 +1,888 @@ +// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet. +// but the path reservations are required to avoid race conditions where +// parallelized unpack ops may mess with one another, due to dependencies +// (like a Link depending on its target) or destructive operations (like +// clobbering an fs object to create one of a different type.) +import * as fsm from '@isaacs/fs-minipass'; +import assert from 'node:assert'; +import { randomBytes } from 'node:crypto'; +import fs from 'node:fs'; +import path from 'node:path'; +import { getWriteFlag } from './get-write-flag.js'; +import { mkdir, mkdirSync } from './mkdir.js'; +import { normalizeUnicode } from './normalize-unicode.js'; +import { normalizeWindowsPath } from './normalize-windows-path.js'; +import { Parser } from './parse.js'; +import { stripAbsolutePath } from './strip-absolute-path.js'; +import { stripTrailingSlashes } from './strip-trailing-slashes.js'; +import * as wc from './winchars.js'; +import { PathReservations } from './path-reservations.js'; +const ONENTRY = Symbol('onEntry'); +const CHECKFS = Symbol('checkFs'); +const CHECKFS2 = Symbol('checkFs2'); +const PRUNECACHE = Symbol('pruneCache'); +const ISREUSABLE = Symbol('isReusable'); +const MAKEFS = Symbol('makeFs'); +const FILE = Symbol('file'); +const DIRECTORY = Symbol('directory'); +const LINK = Symbol('link'); +const SYMLINK = Symbol('symlink'); +const HARDLINK = Symbol('hardlink'); +const UNSUPPORTED = Symbol('unsupported'); +const CHECKPATH = Symbol('checkPath'); +const MKDIR = Symbol('mkdir'); +const ONERROR = Symbol('onError'); +const PENDING = Symbol('pending'); +const PEND = Symbol('pend'); +const UNPEND = Symbol('unpend'); +const ENDED = Symbol('ended'); +const MAYBECLOSE = Symbol('maybeClose'); +const SKIP = Symbol('skip'); +const DOCHOWN = Symbol('doChown'); +const UID = Symbol('uid'); +const GID = Symbol('gid'); +const CHECKED_CWD = Symbol('checkedCwd'); +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; +const isWindows = platform === 'win32'; +const DEFAULT_MAX_DEPTH = 1024; +// Unlinks on Windows are not atomic. +// +// This means that if you have a file entry, followed by another +// file entry with an identical name, and you cannot re-use the file +// (because it's a hardlink, or because unlink:true is set, or it's +// Windows, which does not have useful nlink values), then the unlink +// will be committed to the disk AFTER the new file has been written +// over the old one, deleting the new file. +// +// To work around this, on Windows systems, we rename the file and then +// delete the renamed file. It's a sloppy kludge, but frankly, I do not +// know of a better way to do this, given windows' non-atomic unlink +// semantics. +// +// See: https://github.com/npm/node-tar/issues/183 +/* c8 ignore start */ +const unlinkFile = (path, cb) => { + if (!isWindows) { + return fs.unlink(path, cb); + } + const name = path + '.DELETE.' + randomBytes(16).toString('hex'); + fs.rename(path, name, er => { + if (er) { + return cb(er); + } + fs.unlink(name, cb); + }); +}; +/* c8 ignore stop */ +/* c8 ignore start */ +const unlinkFileSync = (path) => { + if (!isWindows) { + return fs.unlinkSync(path); + } + const name = path + '.DELETE.' + randomBytes(16).toString('hex'); + fs.renameSync(path, name); + fs.unlinkSync(name); +}; +/* c8 ignore stop */ +// this.gid, entry.gid, this.processUid +const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a + : b !== undefined && b === b >>> 0 ? b + : c; +// clear the cache if it's a case-insensitive unicode-squashing match. +// we can't know if the current file system is case-sensitive or supports +// unicode fully, so we check for similarity on the maximally compatible +// representation. Err on the side of pruning, since all it's doing is +// preventing lstats, and it's not the end of the world if we get a false +// positive. +// Note that on windows, we always drop the entire cache whenever a +// symbolic link is encountered, because 8.3 filenames are impossible +// to reason about, and collisions are hazards rather than just failures. +const cacheKeyNormalize = (path) => stripTrailingSlashes(normalizeWindowsPath(normalizeUnicode(path))).toLowerCase(); +// remove all cache entries matching ${abs}/** +const pruneCache = (cache, abs) => { + abs = cacheKeyNormalize(abs); + for (const path of cache.keys()) { + const pnorm = cacheKeyNormalize(path); + if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) { + cache.delete(path); + } + } +}; +const dropCache = (cache) => { + for (const key of cache.keys()) { + cache.delete(key); + } +}; +export class Unpack extends Parser { + [ENDED] = false; + [CHECKED_CWD] = false; + [PENDING] = 0; + reservations = new PathReservations(); + transform; + writable = true; + readable = false; + dirCache; + uid; + gid; + setOwner; + preserveOwner; + processGid; + processUid; + maxDepth; + forceChown; + win32; + newer; + keep; + noMtime; + preservePaths; + unlink; + cwd; + strip; + processUmask; + umask; + dmode; + fmode; + chmod; + constructor(opt = {}) { + opt.ondone = () => { + this[ENDED] = true; + this[MAYBECLOSE](); + }; + super(opt); + this.transform = opt.transform; + this.dirCache = opt.dirCache || new Map(); + this.chmod = !!opt.chmod; + if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { + // need both or neither + if (typeof opt.uid !== 'number' || + typeof opt.gid !== 'number') { + throw new TypeError('cannot set owner without number uid and gid'); + } + if (opt.preserveOwner) { + throw new TypeError('cannot preserve owner in archive and also set owner explicitly'); + } + this.uid = opt.uid; + this.gid = opt.gid; + this.setOwner = true; + } + else { + this.uid = undefined; + this.gid = undefined; + this.setOwner = false; + } + // default true for root + if (opt.preserveOwner === undefined && + typeof opt.uid !== 'number') { + this.preserveOwner = !!(process.getuid && process.getuid() === 0); + } + else { + this.preserveOwner = !!opt.preserveOwner; + } + this.processUid = + (this.preserveOwner || this.setOwner) && process.getuid ? + process.getuid() + : undefined; + this.processGid = + (this.preserveOwner || this.setOwner) && process.getgid ? + process.getgid() + : undefined; + // prevent excessively deep nesting of subfolders + // set to `Infinity` to remove this restriction + this.maxDepth = + typeof opt.maxDepth === 'number' ? + opt.maxDepth + : DEFAULT_MAX_DEPTH; + // mostly just for testing, but useful in some cases. + // Forcibly trigger a chown on every entry, no matter what + this.forceChown = opt.forceChown === true; + // turn > this[ONENTRY](entry)); + } + // a bad or damaged archive is a warning for Parser, but an error + // when extracting. Mark those errors as unrecoverable, because + // the Unpack contract cannot be met. + warn(code, msg, data = {}) { + if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') { + data.recoverable = false; + } + return super.warn(code, msg, data); + } + [MAYBECLOSE]() { + if (this[ENDED] && this[PENDING] === 0) { + this.emit('prefinish'); + this.emit('finish'); + this.emit('end'); + } + } + [CHECKPATH](entry) { + const p = normalizeWindowsPath(entry.path); + const parts = p.split('/'); + if (this.strip) { + if (parts.length < this.strip) { + return false; + } + if (entry.type === 'Link') { + const linkparts = normalizeWindowsPath(String(entry.linkpath)).split('/'); + if (linkparts.length >= this.strip) { + entry.linkpath = linkparts.slice(this.strip).join('/'); + } + else { + return false; + } + } + parts.splice(0, this.strip); + entry.path = parts.join('/'); + } + if (isFinite(this.maxDepth) && parts.length > this.maxDepth) { + this.warn('TAR_ENTRY_ERROR', 'path excessively deep', { + entry, + path: p, + depth: parts.length, + maxDepth: this.maxDepth, + }); + return false; + } + if (!this.preservePaths) { + if (parts.includes('..') || + /* c8 ignore next */ + (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) { + this.warn('TAR_ENTRY_ERROR', `path contains '..'`, { + entry, + path: p, + }); + return false; + } + // strip off the root + const [root, stripped] = stripAbsolutePath(p); + if (root) { + entry.path = String(stripped); + this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, { + entry, + path: p, + }); + } + } + if (path.isAbsolute(entry.path)) { + entry.absolute = normalizeWindowsPath(path.resolve(entry.path)); + } + else { + entry.absolute = normalizeWindowsPath(path.resolve(this.cwd, entry.path)); + } + // if we somehow ended up with a path that escapes the cwd, and we are + // not in preservePaths mode, then something is fishy! This should have + // been prevented above, so ignore this for coverage. + /* c8 ignore start - defense in depth */ + if (!this.preservePaths && + typeof entry.absolute === 'string' && + entry.absolute.indexOf(this.cwd + '/') !== 0 && + entry.absolute !== this.cwd) { + this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', { + entry, + path: normalizeWindowsPath(entry.path), + resolvedPath: entry.absolute, + cwd: this.cwd, + }); + return false; + } + /* c8 ignore stop */ + // an archive can set properties on the extraction directory, but it + // may not replace the cwd with a different kind of thing entirely. + if (entry.absolute === this.cwd && + entry.type !== 'Directory' && + entry.type !== 'GNUDumpDir') { + return false; + } + // only encode : chars that aren't drive letter indicators + if (this.win32) { + const { root: aRoot } = path.win32.parse(String(entry.absolute)); + entry.absolute = + aRoot + wc.encode(String(entry.absolute).slice(aRoot.length)); + const { root: pRoot } = path.win32.parse(entry.path); + entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length)); + } + return true; + } + [ONENTRY](entry) { + if (!this[CHECKPATH](entry)) { + return entry.resume(); + } + assert.equal(typeof entry.absolute, 'string'); + switch (entry.type) { + case 'Directory': + case 'GNUDumpDir': + if (entry.mode) { + entry.mode = entry.mode | 0o700; + } + // eslint-disable-next-line no-fallthrough + case 'File': + case 'OldFile': + case 'ContiguousFile': + case 'Link': + case 'SymbolicLink': + return this[CHECKFS](entry); + case 'CharacterDevice': + case 'BlockDevice': + case 'FIFO': + default: + return this[UNSUPPORTED](entry); + } + } + [ONERROR](er, entry) { + // Cwd has to exist, or else nothing works. That's serious. + // Other errors are warnings, which raise the error in strict + // mode, but otherwise continue on. + if (er.name === 'CwdError') { + this.emit('error', er); + } + else { + this.warn('TAR_ENTRY_ERROR', er, { entry }); + this[UNPEND](); + entry.resume(); + } + } + [MKDIR](dir, mode, cb) { + mkdir(normalizeWindowsPath(dir), { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cache: this.dirCache, + cwd: this.cwd, + mode: mode, + }, cb); + } + [DOCHOWN](entry) { + // in preserve owner mode, chown if the entry doesn't match process + // in set owner mode, chown if setting doesn't match process + return (this.forceChown || + (this.preserveOwner && + ((typeof entry.uid === 'number' && + entry.uid !== this.processUid) || + (typeof entry.gid === 'number' && + entry.gid !== this.processGid))) || + (typeof this.uid === 'number' && + this.uid !== this.processUid) || + (typeof this.gid === 'number' && this.gid !== this.processGid)); + } + [UID](entry) { + return uint32(this.uid, entry.uid, this.processUid); + } + [GID](entry) { + return uint32(this.gid, entry.gid, this.processGid); + } + [FILE](entry, fullyDone) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.fmode; + const stream = new fsm.WriteStream(String(entry.absolute), { + // slight lie, but it can be numeric flags + flags: getWriteFlag(entry.size), + mode: mode, + autoClose: false, + }); + stream.on('error', (er) => { + if (stream.fd) { + fs.close(stream.fd, () => { }); + } + // flush all the data out so that we aren't left hanging + // if the error wasn't actually fatal. otherwise the parse + // is blocked, and we never proceed. + stream.write = () => true; + this[ONERROR](er, entry); + fullyDone(); + }); + let actions = 1; + const done = (er) => { + if (er) { + /* c8 ignore start - we should always have a fd by now */ + if (stream.fd) { + fs.close(stream.fd, () => { }); + } + /* c8 ignore stop */ + this[ONERROR](er, entry); + fullyDone(); + return; + } + if (--actions === 0) { + if (stream.fd !== undefined) { + fs.close(stream.fd, er => { + if (er) { + this[ONERROR](er, entry); + } + else { + this[UNPEND](); + } + fullyDone(); + }); + } + } + }; + stream.on('finish', () => { + // if futimes fails, try utimes + // if utimes fails, fail with the original error + // same for fchown/chown + const abs = String(entry.absolute); + const fd = stream.fd; + if (typeof fd === 'number' && entry.mtime && !this.noMtime) { + actions++; + const atime = entry.atime || new Date(); + const mtime = entry.mtime; + fs.futimes(fd, atime, mtime, er => er ? + fs.utimes(abs, atime, mtime, er2 => done(er2 && er)) + : done()); + } + if (typeof fd === 'number' && this[DOCHOWN](entry)) { + actions++; + const uid = this[UID](entry); + const gid = this[GID](entry); + if (typeof uid === 'number' && typeof gid === 'number') { + fs.fchown(fd, uid, gid, er => er ? + fs.chown(abs, uid, gid, er2 => done(er2 && er)) + : done()); + } + } + done(); + }); + const tx = this.transform ? this.transform(entry) || entry : entry; + if (tx !== entry) { + tx.on('error', (er) => { + this[ONERROR](er, entry); + fullyDone(); + }); + entry.pipe(tx); + } + tx.pipe(stream); + } + [DIRECTORY](entry, fullyDone) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.dmode; + this[MKDIR](String(entry.absolute), mode, er => { + if (er) { + this[ONERROR](er, entry); + fullyDone(); + return; + } + let actions = 1; + const done = () => { + if (--actions === 0) { + fullyDone(); + this[UNPEND](); + entry.resume(); + } + }; + if (entry.mtime && !this.noMtime) { + actions++; + fs.utimes(String(entry.absolute), entry.atime || new Date(), entry.mtime, done); + } + if (this[DOCHOWN](entry)) { + actions++; + fs.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done); + } + done(); + }); + } + [UNSUPPORTED](entry) { + entry.unsupported = true; + this.warn('TAR_ENTRY_UNSUPPORTED', `unsupported entry type: ${entry.type}`, { entry }); + entry.resume(); + } + [SYMLINK](entry, done) { + this[LINK](entry, String(entry.linkpath), 'symlink', done); + } + [HARDLINK](entry, done) { + const linkpath = normalizeWindowsPath(path.resolve(this.cwd, String(entry.linkpath))); + this[LINK](entry, linkpath, 'link', done); + } + [PEND]() { + this[PENDING]++; + } + [UNPEND]() { + this[PENDING]--; + this[MAYBECLOSE](); + } + [SKIP](entry) { + this[UNPEND](); + entry.resume(); + } + // Check if we can reuse an existing filesystem entry safely and + // overwrite it, rather than unlinking and recreating + // Windows doesn't report a useful nlink, so we just never reuse entries + [ISREUSABLE](entry, st) { + return (entry.type === 'File' && + !this.unlink && + st.isFile() && + st.nlink <= 1 && + !isWindows); + } + // check if a thing is there, and if so, try to clobber it + [CHECKFS](entry) { + this[PEND](); + const paths = [entry.path]; + if (entry.linkpath) { + paths.push(entry.linkpath); + } + this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)); + } + [PRUNECACHE](entry) { + // if we are not creating a directory, and the path is in the dirCache, + // then that means we are about to delete the directory we created + // previously, and it is no longer going to be a directory, and neither + // is any of its children. + // If a symbolic link is encountered, all bets are off. There is no + // reasonable way to sanitize the cache in such a way we will be able to + // avoid having filesystem collisions. If this happens with a non-symlink + // entry, it'll just fail to unpack, but a symlink to a directory, using an + // 8.3 shortname or certain unicode attacks, can evade detection and lead + // to arbitrary writes to anywhere on the system. + if (entry.type === 'SymbolicLink') { + dropCache(this.dirCache); + } + else if (entry.type !== 'Directory') { + pruneCache(this.dirCache, String(entry.absolute)); + } + } + [CHECKFS2](entry, fullyDone) { + this[PRUNECACHE](entry); + const done = (er) => { + this[PRUNECACHE](entry); + fullyDone(er); + }; + const checkCwd = () => { + this[MKDIR](this.cwd, this.dmode, er => { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + this[CHECKED_CWD] = true; + start(); + }); + }; + const start = () => { + if (entry.absolute !== this.cwd) { + const parent = normalizeWindowsPath(path.dirname(String(entry.absolute))); + if (parent !== this.cwd) { + return this[MKDIR](parent, this.dmode, er => { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + afterMakeParent(); + }); + } + } + afterMakeParent(); + }; + const afterMakeParent = () => { + fs.lstat(String(entry.absolute), (lstatEr, st) => { + if (st && + (this.keep || + /* c8 ignore next */ + (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { + this[SKIP](entry); + done(); + return; + } + if (lstatEr || this[ISREUSABLE](entry, st)) { + return this[MAKEFS](null, entry, done); + } + if (st.isDirectory()) { + if (entry.type === 'Directory') { + const needChmod = this.chmod && + entry.mode && + (st.mode & 0o7777) !== entry.mode; + const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done); + if (!needChmod) { + return afterChmod(); + } + return fs.chmod(String(entry.absolute), Number(entry.mode), afterChmod); + } + // Not a dir entry, have to remove it. + // NB: the only way to end up with an entry that is the cwd + // itself, in such a way that == does not detect, is a + // tricky windows absolute path with UNC or 8.3 parts (and + // preservePaths:true, or else it will have been stripped). + // In that case, the user has opted out of path protections + // explicitly, so if they blow away the cwd, c'est la vie. + if (entry.absolute !== this.cwd) { + return fs.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done)); + } + } + // not a dir, and not reusable + // don't remove if the cwd, we want that error + if (entry.absolute === this.cwd) { + return this[MAKEFS](null, entry, done); + } + unlinkFile(String(entry.absolute), er => this[MAKEFS](er ?? null, entry, done)); + }); + }; + if (this[CHECKED_CWD]) { + start(); + } + else { + checkCwd(); + } + } + [MAKEFS](er, entry, done) { + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + switch (entry.type) { + case 'File': + case 'OldFile': + case 'ContiguousFile': + return this[FILE](entry, done); + case 'Link': + return this[HARDLINK](entry, done); + case 'SymbolicLink': + return this[SYMLINK](entry, done); + case 'Directory': + case 'GNUDumpDir': + return this[DIRECTORY](entry, done); + } + } + [LINK](entry, linkpath, link, done) { + // XXX: get the type ('symlink' or 'junction') for windows + fs[link](linkpath, String(entry.absolute), er => { + if (er) { + this[ONERROR](er, entry); + } + else { + this[UNPEND](); + entry.resume(); + } + done(); + }); + } +} +const callSync = (fn) => { + try { + return [null, fn()]; + } + catch (er) { + return [er, null]; + } +}; +export class UnpackSync extends Unpack { + sync = true; + [MAKEFS](er, entry) { + return super[MAKEFS](er, entry, () => { }); + } + [CHECKFS](entry) { + this[PRUNECACHE](entry); + if (!this[CHECKED_CWD]) { + const er = this[MKDIR](this.cwd, this.dmode); + if (er) { + return this[ONERROR](er, entry); + } + this[CHECKED_CWD] = true; + } + // don't bother to make the parent if the current entry is the cwd, + // we've already checked it. + if (entry.absolute !== this.cwd) { + const parent = normalizeWindowsPath(path.dirname(String(entry.absolute))); + if (parent !== this.cwd) { + const mkParent = this[MKDIR](parent, this.dmode); + if (mkParent) { + return this[ONERROR](mkParent, entry); + } + } + } + const [lstatEr, st] = callSync(() => fs.lstatSync(String(entry.absolute))); + if (st && + (this.keep || + /* c8 ignore next */ + (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { + return this[SKIP](entry); + } + if (lstatEr || this[ISREUSABLE](entry, st)) { + return this[MAKEFS](null, entry); + } + if (st.isDirectory()) { + if (entry.type === 'Directory') { + const needChmod = this.chmod && + entry.mode && + (st.mode & 0o7777) !== entry.mode; + const [er] = needChmod ? + callSync(() => { + fs.chmodSync(String(entry.absolute), Number(entry.mode)); + }) + : []; + return this[MAKEFS](er, entry); + } + // not a dir entry, have to remove it + const [er] = callSync(() => fs.rmdirSync(String(entry.absolute))); + this[MAKEFS](er, entry); + } + // not a dir, and not reusable. + // don't remove if it's the cwd, since we want that error. + const [er] = entry.absolute === this.cwd ? + [] + : callSync(() => unlinkFileSync(String(entry.absolute))); + this[MAKEFS](er, entry); + } + [FILE](entry, done) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.fmode; + const oner = (er) => { + let closeError; + try { + fs.closeSync(fd); + } + catch (e) { + closeError = e; + } + if (er || closeError) { + this[ONERROR](er || closeError, entry); + } + done(); + }; + let fd; + try { + fd = fs.openSync(String(entry.absolute), getWriteFlag(entry.size), mode); + } + catch (er) { + return oner(er); + } + const tx = this.transform ? this.transform(entry) || entry : entry; + if (tx !== entry) { + tx.on('error', (er) => this[ONERROR](er, entry)); + entry.pipe(tx); + } + tx.on('data', (chunk) => { + try { + fs.writeSync(fd, chunk, 0, chunk.length); + } + catch (er) { + oner(er); + } + }); + tx.on('end', () => { + let er = null; + // try both, falling futimes back to utimes + // if either fails, handle the first error + if (entry.mtime && !this.noMtime) { + const atime = entry.atime || new Date(); + const mtime = entry.mtime; + try { + fs.futimesSync(fd, atime, mtime); + } + catch (futimeser) { + try { + fs.utimesSync(String(entry.absolute), atime, mtime); + } + catch (utimeser) { + er = futimeser; + } + } + } + if (this[DOCHOWN](entry)) { + const uid = this[UID](entry); + const gid = this[GID](entry); + try { + fs.fchownSync(fd, Number(uid), Number(gid)); + } + catch (fchowner) { + try { + fs.chownSync(String(entry.absolute), Number(uid), Number(gid)); + } + catch (chowner) { + er = er || fchowner; + } + } + } + oner(er); + }); + } + [DIRECTORY](entry, done) { + const mode = typeof entry.mode === 'number' ? + entry.mode & 0o7777 + : this.dmode; + const er = this[MKDIR](String(entry.absolute), mode); + if (er) { + this[ONERROR](er, entry); + done(); + return; + } + if (entry.mtime && !this.noMtime) { + try { + fs.utimesSync(String(entry.absolute), entry.atime || new Date(), entry.mtime); + /* c8 ignore next */ + } + catch (er) { } + } + if (this[DOCHOWN](entry)) { + try { + fs.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry))); + } + catch (er) { } + } + done(); + entry.resume(); + } + [MKDIR](dir, mode) { + try { + return mkdirSync(normalizeWindowsPath(dir), { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cache: this.dirCache, + cwd: this.cwd, + mode: mode, + }); + } + catch (er) { + return er; + } + } + [LINK](entry, linkpath, link, done) { + const ls = `${link}Sync`; + try { + fs[ls](linkpath, String(entry.absolute)); + done(); + entry.resume(); + } + catch (er) { + return this[ONERROR](er, entry); + } + } +} +//# sourceMappingURL=unpack.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/update.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/update.js new file mode 100644 index 00000000..21398e97 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/update.js @@ -0,0 +1,30 @@ +// tar -u +import { makeCommand } from './make-command.js'; +import { replace as r } from './replace.js'; +// just call tar.r with the filter and mtimeCache +export const update = makeCommand(r.syncFile, r.asyncFile, r.syncNoFile, r.asyncNoFile, (opt, entries = []) => { + r.validate?.(opt, entries); + mtimeFilter(opt); +}); +const mtimeFilter = (opt) => { + const filter = opt.filter; + if (!opt.mtimeCache) { + opt.mtimeCache = new Map(); + } + opt.filter = + filter ? + (path, stat) => filter(path, stat) && + !( + /* c8 ignore start */ + ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > + (stat.mtime ?? 0)) + /* c8 ignore stop */ + ) + : (path, stat) => !( + /* c8 ignore start */ + ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > + (stat.mtime ?? 0)) + /* c8 ignore stop */ + ); +}; +//# sourceMappingURL=update.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/warn-method.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/warn-method.js new file mode 100644 index 00000000..13e798af --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/warn-method.js @@ -0,0 +1,27 @@ +export const warnMethod = (self, code, message, data = {}) => { + if (self.file) { + data.file = self.file; + } + if (self.cwd) { + data.cwd = self.cwd; + } + data.code = + (message instanceof Error && + message.code) || + code; + data.tarCode = code; + if (!self.strict && data.recoverable !== false) { + if (message instanceof Error) { + data = Object.assign(message, data); + message = message.message; + } + self.emit('warn', code, message, data); + } + else if (message instanceof Error) { + self.emit('error', Object.assign(message, data)); + } + else { + self.emit('error', Object.assign(new Error(`${code}: ${message}`), data)); + } +}; +//# sourceMappingURL=warn-method.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/winchars.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/winchars.js new file mode 100644 index 00000000..c41eb86d --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/winchars.js @@ -0,0 +1,9 @@ +// When writing files on Windows, translate the characters to their +// 0xf000 higher-encoded versions. +const raw = ['|', '<', '>', '?', ':']; +const win = raw.map(char => String.fromCharCode(0xf000 + char.charCodeAt(0))); +const toWin = new Map(raw.map((char, i) => [char, win[i]])); +const toRaw = new Map(win.map((char, i) => [char, raw[i]])); +export const encode = (s) => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s); +export const decode = (s) => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s); +//# sourceMappingURL=winchars.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/write-entry.js b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/write-entry.js new file mode 100644 index 00000000..9028cd67 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/dist/esm/write-entry.js @@ -0,0 +1,657 @@ +import fs from 'fs'; +import { Minipass } from 'minipass'; +import path from 'path'; +import { Header } from './header.js'; +import { modeFix } from './mode-fix.js'; +import { normalizeWindowsPath } from './normalize-windows-path.js'; +import { dealias, } from './options.js'; +import { Pax } from './pax.js'; +import { stripAbsolutePath } from './strip-absolute-path.js'; +import { stripTrailingSlashes } from './strip-trailing-slashes.js'; +import { warnMethod, } from './warn-method.js'; +import * as winchars from './winchars.js'; +const prefixPath = (path, prefix) => { + if (!prefix) { + return normalizeWindowsPath(path); + } + path = normalizeWindowsPath(path).replace(/^\.(\/|$)/, ''); + return stripTrailingSlashes(prefix) + '/' + path; +}; +const maxReadSize = 16 * 1024 * 1024; +const PROCESS = Symbol('process'); +const FILE = Symbol('file'); +const DIRECTORY = Symbol('directory'); +const SYMLINK = Symbol('symlink'); +const HARDLINK = Symbol('hardlink'); +const HEADER = Symbol('header'); +const READ = Symbol('read'); +const LSTAT = Symbol('lstat'); +const ONLSTAT = Symbol('onlstat'); +const ONREAD = Symbol('onread'); +const ONREADLINK = Symbol('onreadlink'); +const OPENFILE = Symbol('openfile'); +const ONOPENFILE = Symbol('onopenfile'); +const CLOSE = Symbol('close'); +const MODE = Symbol('mode'); +const AWAITDRAIN = Symbol('awaitDrain'); +const ONDRAIN = Symbol('ondrain'); +const PREFIX = Symbol('prefix'); +export class WriteEntry extends Minipass { + path; + portable; + myuid = (process.getuid && process.getuid()) || 0; + // until node has builtin pwnam functions, this'll have to do + myuser = process.env.USER || ''; + maxReadSize; + linkCache; + statCache; + preservePaths; + cwd; + strict; + mtime; + noPax; + noMtime; + prefix; + fd; + blockLen = 0; + blockRemain = 0; + buf; + pos = 0; + remain = 0; + length = 0; + offset = 0; + win32; + absolute; + header; + type; + linkpath; + stat; + onWriteEntry; + #hadError = false; + constructor(p, opt_ = {}) { + const opt = dealias(opt_); + super(); + this.path = normalizeWindowsPath(p); + // suppress atime, ctime, uid, gid, uname, gname + this.portable = !!opt.portable; + this.maxReadSize = opt.maxReadSize || maxReadSize; + this.linkCache = opt.linkCache || new Map(); + this.statCache = opt.statCache || new Map(); + this.preservePaths = !!opt.preservePaths; + this.cwd = normalizeWindowsPath(opt.cwd || process.cwd()); + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.noMtime = !!opt.noMtime; + this.mtime = opt.mtime; + this.prefix = + opt.prefix ? normalizeWindowsPath(opt.prefix) : undefined; + this.onWriteEntry = opt.onWriteEntry; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + let pathWarn = false; + if (!this.preservePaths) { + const [root, stripped] = stripAbsolutePath(this.path); + if (root && typeof stripped === 'string') { + this.path = stripped; + pathWarn = root; + } + } + this.win32 = !!opt.win32 || process.platform === 'win32'; + if (this.win32) { + // force the \ to / normalization, since we might not *actually* + // be on windows, but want \ to be considered a path separator. + this.path = winchars.decode(this.path.replace(/\\/g, '/')); + p = p.replace(/\\/g, '/'); + } + this.absolute = normalizeWindowsPath(opt.absolute || path.resolve(this.cwd, p)); + if (this.path === '') { + this.path = './'; + } + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }); + } + const cs = this.statCache.get(this.absolute); + if (cs) { + this[ONLSTAT](cs); + } + else { + this[LSTAT](); + } + } + warn(code, message, data = {}) { + return warnMethod(this, code, message, data); + } + emit(ev, ...data) { + if (ev === 'error') { + this.#hadError = true; + } + return super.emit(ev, ...data); + } + [LSTAT]() { + fs.lstat(this.absolute, (er, stat) => { + if (er) { + return this.emit('error', er); + } + this[ONLSTAT](stat); + }); + } + [ONLSTAT](stat) { + this.statCache.set(this.absolute, stat); + this.stat = stat; + if (!stat.isFile()) { + stat.size = 0; + } + this.type = getType(stat); + this.emit('stat', stat); + this[PROCESS](); + } + [PROCESS]() { + switch (this.type) { + case 'File': + return this[FILE](); + case 'Directory': + return this[DIRECTORY](); + case 'SymbolicLink': + return this[SYMLINK](); + // unsupported types are ignored. + default: + return this.end(); + } + } + [MODE](mode) { + return modeFix(mode, this.type === 'Directory', this.portable); + } + [PREFIX](path) { + return prefixPath(path, this.prefix); + } + [HEADER]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot write header before stat'); + } + /* c8 ignore stop */ + if (this.type === 'Directory' && this.portable) { + this.noMtime = true; + } + this.onWriteEntry?.(this); + this.header = new Header({ + path: this[PREFIX](this.path), + // only apply the prefix to hard links. + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this[MODE](this.stat.mode), + uid: this.portable ? undefined : this.stat.uid, + gid: this.portable ? undefined : this.stat.gid, + size: this.stat.size, + mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime, + /* c8 ignore next */ + type: this.type === 'Unsupported' ? undefined : this.type, + uname: this.portable ? undefined + : this.stat.uid === this.myuid ? this.myuser + : '', + atime: this.portable ? undefined : this.stat.atime, + ctime: this.portable ? undefined : this.stat.ctime, + }); + if (this.header.encode() && !this.noPax) { + super.write(new Pax({ + atime: this.portable ? undefined : this.header.atime, + ctime: this.portable ? undefined : this.header.ctime, + gid: this.portable ? undefined : this.header.gid, + mtime: this.noMtime ? undefined : (this.mtime || this.header.mtime), + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + size: this.header.size, + uid: this.portable ? undefined : this.header.uid, + uname: this.portable ? undefined : this.header.uname, + dev: this.portable ? undefined : this.stat.dev, + ino: this.portable ? undefined : this.stat.ino, + nlink: this.portable ? undefined : this.stat.nlink, + }).encode()); + } + const block = this.header?.block; + /* c8 ignore start */ + if (!block) { + throw new Error('failed to encode header'); + } + /* c8 ignore stop */ + super.write(block); + } + [DIRECTORY]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create directory entry without stat'); + } + /* c8 ignore stop */ + if (this.path.slice(-1) !== '/') { + this.path += '/'; + } + this.stat.size = 0; + this[HEADER](); + this.end(); + } + [SYMLINK]() { + fs.readlink(this.absolute, (er, linkpath) => { + if (er) { + return this.emit('error', er); + } + this[ONREADLINK](linkpath); + }); + } + [ONREADLINK](linkpath) { + this.linkpath = normalizeWindowsPath(linkpath); + this[HEADER](); + this.end(); + } + [HARDLINK](linkpath) { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create link entry without stat'); + } + /* c8 ignore stop */ + this.type = 'Link'; + this.linkpath = normalizeWindowsPath(path.relative(this.cwd, linkpath)); + this.stat.size = 0; + this[HEADER](); + this.end(); + } + [FILE]() { + /* c8 ignore start */ + if (!this.stat) { + throw new Error('cannot create file entry without stat'); + } + /* c8 ignore stop */ + if (this.stat.nlink > 1) { + const linkKey = `${this.stat.dev}:${this.stat.ino}`; + const linkpath = this.linkCache.get(linkKey); + if (linkpath?.indexOf(this.cwd) === 0) { + return this[HARDLINK](linkpath); + } + this.linkCache.set(linkKey, this.absolute); + } + this[HEADER](); + if (this.stat.size === 0) { + return this.end(); + } + this[OPENFILE](); + } + [OPENFILE]() { + fs.open(this.absolute, 'r', (er, fd) => { + if (er) { + return this.emit('error', er); + } + this[ONOPENFILE](fd); + }); + } + [ONOPENFILE](fd) { + this.fd = fd; + if (this.#hadError) { + return this[CLOSE](); + } + /* c8 ignore start */ + if (!this.stat) { + throw new Error('should stat before calling onopenfile'); + } + /* c8 ignore start */ + this.blockLen = 512 * Math.ceil(this.stat.size / 512); + this.blockRemain = this.blockLen; + const bufLen = Math.min(this.blockLen, this.maxReadSize); + this.buf = Buffer.allocUnsafe(bufLen); + this.offset = 0; + this.pos = 0; + this.remain = this.stat.size; + this.length = this.buf.length; + this[READ](); + } + [READ]() { + const { fd, buf, offset, length, pos } = this; + if (fd === undefined || buf === undefined) { + throw new Error('cannot read file without first opening'); + } + fs.read(fd, buf, offset, length, pos, (er, bytesRead) => { + if (er) { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + return this[CLOSE](() => this.emit('error', er)); + } + this[ONREAD](bytesRead); + }); + } + /* c8 ignore start */ + [CLOSE](cb = () => { }) { + /* c8 ignore stop */ + if (this.fd !== undefined) + fs.close(this.fd, cb); + } + [ONREAD](bytesRead) { + if (bytesRead <= 0 && this.remain > 0) { + const er = Object.assign(new Error('encountered unexpected EOF'), { + path: this.absolute, + syscall: 'read', + code: 'EOF', + }); + return this[CLOSE](() => this.emit('error', er)); + } + if (bytesRead > this.remain) { + const er = Object.assign(new Error('did not encounter expected EOF'), { + path: this.absolute, + syscall: 'read', + code: 'EOF', + }); + return this[CLOSE](() => this.emit('error', er)); + } + /* c8 ignore start */ + if (!this.buf) { + throw new Error('should have created buffer prior to reading'); + } + /* c8 ignore stop */ + // null out the rest of the buffer, if we could fit the block padding + // at the end of this loop, we've incremented bytesRead and this.remain + // to be incremented up to the blockRemain level, as if we had expected + // to get a null-padded file, and read it until the end. then we will + // decrement both remain and blockRemain by bytesRead, and know that we + // reached the expected EOF, without any null buffer to append. + if (bytesRead === this.remain) { + for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) { + this.buf[i + this.offset] = 0; + bytesRead++; + this.remain++; + } + } + const chunk = this.offset === 0 && bytesRead === this.buf.length ? + this.buf + : this.buf.subarray(this.offset, this.offset + bytesRead); + const flushed = this.write(chunk); + if (!flushed) { + this[AWAITDRAIN](() => this[ONDRAIN]()); + } + else { + this[ONDRAIN](); + } + } + [AWAITDRAIN](cb) { + this.once('drain', cb); + } + write(chunk, encoding, cb) { + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); + } + /* c8 ignore stop */ + if (this.blockRemain < chunk.length) { + const er = Object.assign(new Error('writing more data than expected'), { + path: this.absolute, + }); + return this.emit('error', er); + } + this.remain -= chunk.length; + this.blockRemain -= chunk.length; + this.pos += chunk.length; + this.offset += chunk.length; + return super.write(chunk, null, cb); + } + [ONDRAIN]() { + if (!this.remain) { + if (this.blockRemain) { + super.write(Buffer.alloc(this.blockRemain)); + } + return this[CLOSE](er => er ? this.emit('error', er) : this.end()); + } + /* c8 ignore start */ + if (!this.buf) { + throw new Error('buffer lost somehow in ONDRAIN'); + } + /* c8 ignore stop */ + if (this.offset >= this.length) { + // if we only have a smaller bit left to read, alloc a smaller buffer + // otherwise, keep it the same length it was before. + this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)); + this.offset = 0; + } + this.length = this.buf.length - this.offset; + this[READ](); + } +} +export class WriteEntrySync extends WriteEntry { + sync = true; + [LSTAT]() { + this[ONLSTAT](fs.lstatSync(this.absolute)); + } + [SYMLINK]() { + this[ONREADLINK](fs.readlinkSync(this.absolute)); + } + [OPENFILE]() { + this[ONOPENFILE](fs.openSync(this.absolute, 'r')); + } + [READ]() { + let threw = true; + try { + const { fd, buf, offset, length, pos } = this; + /* c8 ignore start */ + if (fd === undefined || buf === undefined) { + throw new Error('fd and buf must be set in READ method'); + } + /* c8 ignore stop */ + const bytesRead = fs.readSync(fd, buf, offset, length, pos); + this[ONREAD](bytesRead); + threw = false; + } + finally { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + if (threw) { + try { + this[CLOSE](() => { }); + } + catch (er) { } + } + } + } + [AWAITDRAIN](cb) { + cb(); + } + /* c8 ignore start */ + [CLOSE](cb = () => { }) { + /* c8 ignore stop */ + if (this.fd !== undefined) + fs.closeSync(this.fd); + cb(); + } +} +export class WriteEntryTar extends Minipass { + blockLen = 0; + blockRemain = 0; + buf = 0; + pos = 0; + remain = 0; + length = 0; + preservePaths; + portable; + strict; + noPax; + noMtime; + readEntry; + type; + prefix; + path; + mode; + uid; + gid; + uname; + gname; + header; + mtime; + atime; + ctime; + linkpath; + size; + onWriteEntry; + warn(code, message, data = {}) { + return warnMethod(this, code, message, data); + } + constructor(readEntry, opt_ = {}) { + const opt = dealias(opt_); + super(); + this.preservePaths = !!opt.preservePaths; + this.portable = !!opt.portable; + this.strict = !!opt.strict; + this.noPax = !!opt.noPax; + this.noMtime = !!opt.noMtime; + this.onWriteEntry = opt.onWriteEntry; + this.readEntry = readEntry; + const { type } = readEntry; + /* c8 ignore start */ + if (type === 'Unsupported') { + throw new Error('writing entry that should be ignored'); + } + /* c8 ignore stop */ + this.type = type; + if (this.type === 'Directory' && this.portable) { + this.noMtime = true; + } + this.prefix = opt.prefix; + this.path = normalizeWindowsPath(readEntry.path); + this.mode = + readEntry.mode !== undefined ? + this[MODE](readEntry.mode) + : undefined; + this.uid = this.portable ? undefined : readEntry.uid; + this.gid = this.portable ? undefined : readEntry.gid; + this.uname = this.portable ? undefined : readEntry.uname; + this.gname = this.portable ? undefined : readEntry.gname; + this.size = readEntry.size; + this.mtime = + this.noMtime ? undefined : opt.mtime || readEntry.mtime; + this.atime = this.portable ? undefined : readEntry.atime; + this.ctime = this.portable ? undefined : readEntry.ctime; + this.linkpath = + readEntry.linkpath !== undefined ? + normalizeWindowsPath(readEntry.linkpath) + : undefined; + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn); + } + let pathWarn = false; + if (!this.preservePaths) { + const [root, stripped] = stripAbsolutePath(this.path); + if (root && typeof stripped === 'string') { + this.path = stripped; + pathWarn = root; + } + } + this.remain = readEntry.size; + this.blockRemain = readEntry.startBlockSize; + this.onWriteEntry?.(this); + this.header = new Header({ + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this.mode, + uid: this.portable ? undefined : this.uid, + gid: this.portable ? undefined : this.gid, + size: this.size, + mtime: this.noMtime ? undefined : this.mtime, + type: this.type, + uname: this.portable ? undefined : this.uname, + atime: this.portable ? undefined : this.atime, + ctime: this.portable ? undefined : this.ctime, + }); + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }); + } + if (this.header.encode() && !this.noPax) { + super.write(new Pax({ + atime: this.portable ? undefined : this.atime, + ctime: this.portable ? undefined : this.ctime, + gid: this.portable ? undefined : this.gid, + mtime: this.noMtime ? undefined : this.mtime, + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' && this.linkpath !== undefined ? + this[PREFIX](this.linkpath) + : this.linkpath, + size: this.size, + uid: this.portable ? undefined : this.uid, + uname: this.portable ? undefined : this.uname, + dev: this.portable ? undefined : this.readEntry.dev, + ino: this.portable ? undefined : this.readEntry.ino, + nlink: this.portable ? undefined : this.readEntry.nlink, + }).encode()); + } + const b = this.header?.block; + /* c8 ignore start */ + if (!b) + throw new Error('failed to encode header'); + /* c8 ignore stop */ + super.write(b); + readEntry.pipe(this); + } + [PREFIX](path) { + return prefixPath(path, this.prefix); + } + [MODE](mode) { + return modeFix(mode, this.type === 'Directory', this.portable); + } + write(chunk, encoding, cb) { + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); + } + /* c8 ignore stop */ + const writeLen = chunk.length; + if (writeLen > this.blockRemain) { + throw new Error('writing more to entry than is appropriate'); + } + this.blockRemain -= writeLen; + return super.write(chunk, cb); + } + end(chunk, encoding, cb) { + if (this.blockRemain) { + super.write(Buffer.alloc(this.blockRemain)); + } + /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ + if (typeof chunk === 'function') { + cb = chunk; + encoding = undefined; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = undefined; + } + if (typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding ?? 'utf8'); + } + if (cb) + this.once('finish', cb); + chunk ? super.end(chunk, cb) : super.end(cb); + /* c8 ignore stop */ + return this; + } +} +const getType = (stat) => stat.isFile() ? 'File' + : stat.isDirectory() ? 'Directory' + : stat.isSymbolicLink() ? 'SymbolicLink' + : 'Unsupported'; +//# sourceMappingURL=write-entry.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/tar/package.json b/node_modules/npm/node_modules/cacache/node_modules/tar/package.json new file mode 100644 index 00000000..0283103e --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/tar/package.json @@ -0,0 +1,325 @@ +{ + "author": "Isaac Z. Schlueter", + "name": "tar", + "description": "tar for node", + "version": "7.4.3", + "repository": { + "type": "git", + "url": "https://github.com/isaacs/node-tar.git" + }, + "scripts": { + "genparse": "node scripts/generate-parse-fixtures.js", + "snap": "tap", + "test": "tap", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "prepare": "tshy", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --log-level warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.0.1", + "mkdirp": "^3.0.1", + "yallist": "^5.0.0" + }, + "devDependencies": { + "chmodr": "^1.2.0", + "end-of-stream": "^1.4.3", + "events-to-array": "^2.0.3", + "mutate-fs": "^2.1.1", + "nock": "^13.5.4", + "prettier": "^3.2.5", + "rimraf": "^5.0.5", + "tap": "^18.7.2", + "tshy": "^1.13.1", + "typedoc": "^0.25.13" + }, + "license": "ISC", + "engines": { + "node": ">=18" + }, + "files": [ + "dist" + ], + "tap": { + "coverage-map": "map.js", + "timeout": 0, + "typecheck": true + }, + "prettier": { + "experimentalTernaries": true, + "semi": false, + "printWidth": 70, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./c": "./src/create.ts", + "./create": "./src/create.ts", + "./replace": "./src/create.ts", + "./r": "./src/create.ts", + "./list": "./src/list.ts", + "./t": "./src/list.ts", + "./update": "./src/update.ts", + "./u": "./src/update.ts", + "./extract": "./src/extract.ts", + "./x": "./src/extract.ts", + "./pack": "./src/pack.ts", + "./unpack": "./src/unpack.ts", + "./parse": "./src/parse.ts", + "./read-entry": "./src/read-entry.ts", + "./write-entry": "./src/write-entry.ts", + "./header": "./src/header.ts", + "./pax": "./src/pax.ts", + "./types": "./src/types.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "source": "./src/index.ts", + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "source": "./src/index.ts", + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./c": { + "import": { + "source": "./src/create.ts", + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "source": "./src/create.ts", + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./create": { + "import": { + "source": "./src/create.ts", + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "source": "./src/create.ts", + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./replace": { + "import": { + "source": "./src/create.ts", + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "source": "./src/create.ts", + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./r": { + "import": { + "source": "./src/create.ts", + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "source": "./src/create.ts", + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./list": { + "import": { + "source": "./src/list.ts", + "types": "./dist/esm/list.d.ts", + "default": "./dist/esm/list.js" + }, + "require": { + "source": "./src/list.ts", + "types": "./dist/commonjs/list.d.ts", + "default": "./dist/commonjs/list.js" + } + }, + "./t": { + "import": { + "source": "./src/list.ts", + "types": "./dist/esm/list.d.ts", + "default": "./dist/esm/list.js" + }, + "require": { + "source": "./src/list.ts", + "types": "./dist/commonjs/list.d.ts", + "default": "./dist/commonjs/list.js" + } + }, + "./update": { + "import": { + "source": "./src/update.ts", + "types": "./dist/esm/update.d.ts", + "default": "./dist/esm/update.js" + }, + "require": { + "source": "./src/update.ts", + "types": "./dist/commonjs/update.d.ts", + "default": "./dist/commonjs/update.js" + } + }, + "./u": { + "import": { + "source": "./src/update.ts", + "types": "./dist/esm/update.d.ts", + "default": "./dist/esm/update.js" + }, + "require": { + "source": "./src/update.ts", + "types": "./dist/commonjs/update.d.ts", + "default": "./dist/commonjs/update.js" + } + }, + "./extract": { + "import": { + "source": "./src/extract.ts", + "types": "./dist/esm/extract.d.ts", + "default": "./dist/esm/extract.js" + }, + "require": { + "source": "./src/extract.ts", + "types": "./dist/commonjs/extract.d.ts", + "default": "./dist/commonjs/extract.js" + } + }, + "./x": { + "import": { + "source": "./src/extract.ts", + "types": "./dist/esm/extract.d.ts", + "default": "./dist/esm/extract.js" + }, + "require": { + "source": "./src/extract.ts", + "types": "./dist/commonjs/extract.d.ts", + "default": "./dist/commonjs/extract.js" + } + }, + "./pack": { + "import": { + "source": "./src/pack.ts", + "types": "./dist/esm/pack.d.ts", + "default": "./dist/esm/pack.js" + }, + "require": { + "source": "./src/pack.ts", + "types": "./dist/commonjs/pack.d.ts", + "default": "./dist/commonjs/pack.js" + } + }, + "./unpack": { + "import": { + "source": "./src/unpack.ts", + "types": "./dist/esm/unpack.d.ts", + "default": "./dist/esm/unpack.js" + }, + "require": { + "source": "./src/unpack.ts", + "types": "./dist/commonjs/unpack.d.ts", + "default": "./dist/commonjs/unpack.js" + } + }, + "./parse": { + "import": { + "source": "./src/parse.ts", + "types": "./dist/esm/parse.d.ts", + "default": "./dist/esm/parse.js" + }, + "require": { + "source": "./src/parse.ts", + "types": "./dist/commonjs/parse.d.ts", + "default": "./dist/commonjs/parse.js" + } + }, + "./read-entry": { + "import": { + "source": "./src/read-entry.ts", + "types": "./dist/esm/read-entry.d.ts", + "default": "./dist/esm/read-entry.js" + }, + "require": { + "source": "./src/read-entry.ts", + "types": "./dist/commonjs/read-entry.d.ts", + "default": "./dist/commonjs/read-entry.js" + } + }, + "./write-entry": { + "import": { + "source": "./src/write-entry.ts", + "types": "./dist/esm/write-entry.d.ts", + "default": "./dist/esm/write-entry.js" + }, + "require": { + "source": "./src/write-entry.ts", + "types": "./dist/commonjs/write-entry.d.ts", + "default": "./dist/commonjs/write-entry.js" + } + }, + "./header": { + "import": { + "source": "./src/header.ts", + "types": "./dist/esm/header.d.ts", + "default": "./dist/esm/header.js" + }, + "require": { + "source": "./src/header.ts", + "types": "./dist/commonjs/header.d.ts", + "default": "./dist/commonjs/header.js" + } + }, + "./pax": { + "import": { + "source": "./src/pax.ts", + "types": "./dist/esm/pax.d.ts", + "default": "./dist/esm/pax.js" + }, + "require": { + "source": "./src/pax.ts", + "types": "./dist/commonjs/pax.d.ts", + "default": "./dist/commonjs/pax.js" + } + }, + "./types": { + "import": { + "source": "./src/types.ts", + "types": "./dist/esm/types.d.ts", + "default": "./dist/esm/types.js" + }, + "require": { + "source": "./src/types.ts", + "types": "./dist/commonjs/types.d.ts", + "default": "./dist/commonjs/types.js" + } + } + }, + "type": "module", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts" +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/yallist/LICENSE.md b/node_modules/npm/node_modules/cacache/node_modules/yallist/LICENSE.md new file mode 100644 index 00000000..881248b6 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/yallist/LICENSE.md @@ -0,0 +1,63 @@ +All packages under `src/` are licensed according to the terms in +their respective `LICENSE` or `LICENSE.md` files. + +The remainder of this project is licensed under the Blue Oak +Model License, as follows: + +----- + +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/commonjs/index.js b/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/commonjs/index.js new file mode 100644 index 00000000..c1e1e474 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/commonjs/index.js @@ -0,0 +1,384 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Node = exports.Yallist = void 0; +class Yallist { + tail; + head; + length = 0; + static create(list = []) { + return new Yallist(list); + } + constructor(list = []) { + for (const item of list) { + this.push(item); + } + } + *[Symbol.iterator]() { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value; + } + } + removeNode(node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list'); + } + const next = node.next; + const prev = node.prev; + if (next) { + next.prev = prev; + } + if (prev) { + prev.next = next; + } + if (node === this.head) { + this.head = next; + } + if (node === this.tail) { + this.tail = prev; + } + this.length--; + node.next = undefined; + node.prev = undefined; + node.list = undefined; + return next; + } + unshiftNode(node) { + if (node === this.head) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + const head = this.head; + node.list = this; + node.next = head; + if (head) { + head.prev = node; + } + this.head = node; + if (!this.tail) { + this.tail = node; + } + this.length++; + } + pushNode(node) { + if (node === this.tail) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + const tail = this.tail; + node.list = this; + node.prev = tail; + if (tail) { + tail.next = node; + } + this.tail = node; + if (!this.head) { + this.head = node; + } + this.length++; + } + push(...args) { + for (let i = 0, l = args.length; i < l; i++) { + push(this, args[i]); + } + return this.length; + } + unshift(...args) { + for (var i = 0, l = args.length; i < l; i++) { + unshift(this, args[i]); + } + return this.length; + } + pop() { + if (!this.tail) { + return undefined; + } + const res = this.tail.value; + const t = this.tail; + this.tail = this.tail.prev; + if (this.tail) { + this.tail.next = undefined; + } + else { + this.head = undefined; + } + t.list = undefined; + this.length--; + return res; + } + shift() { + if (!this.head) { + return undefined; + } + const res = this.head.value; + const h = this.head; + this.head = this.head.next; + if (this.head) { + this.head.prev = undefined; + } + else { + this.tail = undefined; + } + h.list = undefined; + this.length--; + return res; + } + forEach(fn, thisp) { + thisp = thisp || this; + for (let walker = this.head, i = 0; !!walker; i++) { + fn.call(thisp, walker.value, i, this); + walker = walker.next; + } + } + forEachReverse(fn, thisp) { + thisp = thisp || this; + for (let walker = this.tail, i = this.length - 1; !!walker; i--) { + fn.call(thisp, walker.value, i, this); + walker = walker.prev; + } + } + get(n) { + let i = 0; + let walker = this.head; + for (; !!walker && i < n; i++) { + walker = walker.next; + } + if (i === n && !!walker) { + return walker.value; + } + } + getReverse(n) { + let i = 0; + let walker = this.tail; + for (; !!walker && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev; + } + if (i === n && !!walker) { + return walker.value; + } + } + map(fn, thisp) { + thisp = thisp || this; + const res = new Yallist(); + for (let walker = this.head; !!walker;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.next; + } + return res; + } + mapReverse(fn, thisp) { + thisp = thisp || this; + var res = new Yallist(); + for (let walker = this.tail; !!walker;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.prev; + } + return res; + } + reduce(fn, initial) { + let acc; + let walker = this.head; + if (arguments.length > 1) { + acc = initial; + } + else if (this.head) { + walker = this.head.next; + acc = this.head.value; + } + else { + throw new TypeError('Reduce of empty list with no initial value'); + } + for (var i = 0; !!walker; i++) { + acc = fn(acc, walker.value, i); + walker = walker.next; + } + return acc; + } + reduceReverse(fn, initial) { + let acc; + let walker = this.tail; + if (arguments.length > 1) { + acc = initial; + } + else if (this.tail) { + walker = this.tail.prev; + acc = this.tail.value; + } + else { + throw new TypeError('Reduce of empty list with no initial value'); + } + for (let i = this.length - 1; !!walker; i--) { + acc = fn(acc, walker.value, i); + walker = walker.prev; + } + return acc; + } + toArray() { + const arr = new Array(this.length); + for (let i = 0, walker = this.head; !!walker; i++) { + arr[i] = walker.value; + walker = walker.next; + } + return arr; + } + toArrayReverse() { + const arr = new Array(this.length); + for (let i = 0, walker = this.tail; !!walker; i++) { + arr[i] = walker.value; + walker = walker.prev; + } + return arr; + } + slice(from = 0, to = this.length) { + if (to < 0) { + to += this.length; + } + if (from < 0) { + from += this.length; + } + const ret = new Yallist(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + let walker = this.head; + let i = 0; + for (i = 0; !!walker && i < from; i++) { + walker = walker.next; + } + for (; !!walker && i < to; i++, walker = walker.next) { + ret.push(walker.value); + } + return ret; + } + sliceReverse(from = 0, to = this.length) { + if (to < 0) { + to += this.length; + } + if (from < 0) { + from += this.length; + } + const ret = new Yallist(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + let i = this.length; + let walker = this.tail; + for (; !!walker && i > to; i--) { + walker = walker.prev; + } + for (; !!walker && i > from; i--, walker = walker.prev) { + ret.push(walker.value); + } + return ret; + } + splice(start, deleteCount = 0, ...nodes) { + if (start > this.length) { + start = this.length - 1; + } + if (start < 0) { + start = this.length + start; + } + let walker = this.head; + for (let i = 0; !!walker && i < start; i++) { + walker = walker.next; + } + const ret = []; + for (let i = 0; !!walker && i < deleteCount; i++) { + ret.push(walker.value); + walker = this.removeNode(walker); + } + if (!walker) { + walker = this.tail; + } + else if (walker !== this.tail) { + walker = walker.prev; + } + for (const v of nodes) { + walker = insertAfter(this, walker, v); + } + return ret; + } + reverse() { + const head = this.head; + const tail = this.tail; + for (let walker = head; !!walker; walker = walker.prev) { + const p = walker.prev; + walker.prev = walker.next; + walker.next = p; + } + this.head = tail; + this.tail = head; + return this; + } +} +exports.Yallist = Yallist; +// insertAfter undefined means "make the node the new head of list" +function insertAfter(self, node, value) { + const prev = node; + const next = node ? node.next : self.head; + const inserted = new Node(value, prev, next, self); + if (inserted.next === undefined) { + self.tail = inserted; + } + if (inserted.prev === undefined) { + self.head = inserted; + } + self.length++; + return inserted; +} +function push(self, item) { + self.tail = new Node(item, self.tail, undefined, self); + if (!self.head) { + self.head = self.tail; + } + self.length++; +} +function unshift(self, item) { + self.head = new Node(item, undefined, self.head, self); + if (!self.tail) { + self.tail = self.head; + } + self.length++; +} +class Node { + list; + next; + prev; + value; + constructor(value, prev, next, list) { + this.list = list; + this.value = value; + if (prev) { + prev.next = this; + this.prev = prev; + } + else { + this.prev = undefined; + } + if (next) { + next.prev = this; + this.next = next; + } + else { + this.next = undefined; + } + } +} +exports.Node = Node; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/commonjs/package.json b/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/esm/index.js b/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/esm/index.js new file mode 100644 index 00000000..3d81c511 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/esm/index.js @@ -0,0 +1,379 @@ +export class Yallist { + tail; + head; + length = 0; + static create(list = []) { + return new Yallist(list); + } + constructor(list = []) { + for (const item of list) { + this.push(item); + } + } + *[Symbol.iterator]() { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value; + } + } + removeNode(node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list'); + } + const next = node.next; + const prev = node.prev; + if (next) { + next.prev = prev; + } + if (prev) { + prev.next = next; + } + if (node === this.head) { + this.head = next; + } + if (node === this.tail) { + this.tail = prev; + } + this.length--; + node.next = undefined; + node.prev = undefined; + node.list = undefined; + return next; + } + unshiftNode(node) { + if (node === this.head) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + const head = this.head; + node.list = this; + node.next = head; + if (head) { + head.prev = node; + } + this.head = node; + if (!this.tail) { + this.tail = node; + } + this.length++; + } + pushNode(node) { + if (node === this.tail) { + return; + } + if (node.list) { + node.list.removeNode(node); + } + const tail = this.tail; + node.list = this; + node.prev = tail; + if (tail) { + tail.next = node; + } + this.tail = node; + if (!this.head) { + this.head = node; + } + this.length++; + } + push(...args) { + for (let i = 0, l = args.length; i < l; i++) { + push(this, args[i]); + } + return this.length; + } + unshift(...args) { + for (var i = 0, l = args.length; i < l; i++) { + unshift(this, args[i]); + } + return this.length; + } + pop() { + if (!this.tail) { + return undefined; + } + const res = this.tail.value; + const t = this.tail; + this.tail = this.tail.prev; + if (this.tail) { + this.tail.next = undefined; + } + else { + this.head = undefined; + } + t.list = undefined; + this.length--; + return res; + } + shift() { + if (!this.head) { + return undefined; + } + const res = this.head.value; + const h = this.head; + this.head = this.head.next; + if (this.head) { + this.head.prev = undefined; + } + else { + this.tail = undefined; + } + h.list = undefined; + this.length--; + return res; + } + forEach(fn, thisp) { + thisp = thisp || this; + for (let walker = this.head, i = 0; !!walker; i++) { + fn.call(thisp, walker.value, i, this); + walker = walker.next; + } + } + forEachReverse(fn, thisp) { + thisp = thisp || this; + for (let walker = this.tail, i = this.length - 1; !!walker; i--) { + fn.call(thisp, walker.value, i, this); + walker = walker.prev; + } + } + get(n) { + let i = 0; + let walker = this.head; + for (; !!walker && i < n; i++) { + walker = walker.next; + } + if (i === n && !!walker) { + return walker.value; + } + } + getReverse(n) { + let i = 0; + let walker = this.tail; + for (; !!walker && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev; + } + if (i === n && !!walker) { + return walker.value; + } + } + map(fn, thisp) { + thisp = thisp || this; + const res = new Yallist(); + for (let walker = this.head; !!walker;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.next; + } + return res; + } + mapReverse(fn, thisp) { + thisp = thisp || this; + var res = new Yallist(); + for (let walker = this.tail; !!walker;) { + res.push(fn.call(thisp, walker.value, this)); + walker = walker.prev; + } + return res; + } + reduce(fn, initial) { + let acc; + let walker = this.head; + if (arguments.length > 1) { + acc = initial; + } + else if (this.head) { + walker = this.head.next; + acc = this.head.value; + } + else { + throw new TypeError('Reduce of empty list with no initial value'); + } + for (var i = 0; !!walker; i++) { + acc = fn(acc, walker.value, i); + walker = walker.next; + } + return acc; + } + reduceReverse(fn, initial) { + let acc; + let walker = this.tail; + if (arguments.length > 1) { + acc = initial; + } + else if (this.tail) { + walker = this.tail.prev; + acc = this.tail.value; + } + else { + throw new TypeError('Reduce of empty list with no initial value'); + } + for (let i = this.length - 1; !!walker; i--) { + acc = fn(acc, walker.value, i); + walker = walker.prev; + } + return acc; + } + toArray() { + const arr = new Array(this.length); + for (let i = 0, walker = this.head; !!walker; i++) { + arr[i] = walker.value; + walker = walker.next; + } + return arr; + } + toArrayReverse() { + const arr = new Array(this.length); + for (let i = 0, walker = this.tail; !!walker; i++) { + arr[i] = walker.value; + walker = walker.prev; + } + return arr; + } + slice(from = 0, to = this.length) { + if (to < 0) { + to += this.length; + } + if (from < 0) { + from += this.length; + } + const ret = new Yallist(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + let walker = this.head; + let i = 0; + for (i = 0; !!walker && i < from; i++) { + walker = walker.next; + } + for (; !!walker && i < to; i++, walker = walker.next) { + ret.push(walker.value); + } + return ret; + } + sliceReverse(from = 0, to = this.length) { + if (to < 0) { + to += this.length; + } + if (from < 0) { + from += this.length; + } + const ret = new Yallist(); + if (to < from || to < 0) { + return ret; + } + if (from < 0) { + from = 0; + } + if (to > this.length) { + to = this.length; + } + let i = this.length; + let walker = this.tail; + for (; !!walker && i > to; i--) { + walker = walker.prev; + } + for (; !!walker && i > from; i--, walker = walker.prev) { + ret.push(walker.value); + } + return ret; + } + splice(start, deleteCount = 0, ...nodes) { + if (start > this.length) { + start = this.length - 1; + } + if (start < 0) { + start = this.length + start; + } + let walker = this.head; + for (let i = 0; !!walker && i < start; i++) { + walker = walker.next; + } + const ret = []; + for (let i = 0; !!walker && i < deleteCount; i++) { + ret.push(walker.value); + walker = this.removeNode(walker); + } + if (!walker) { + walker = this.tail; + } + else if (walker !== this.tail) { + walker = walker.prev; + } + for (const v of nodes) { + walker = insertAfter(this, walker, v); + } + return ret; + } + reverse() { + const head = this.head; + const tail = this.tail; + for (let walker = head; !!walker; walker = walker.prev) { + const p = walker.prev; + walker.prev = walker.next; + walker.next = p; + } + this.head = tail; + this.tail = head; + return this; + } +} +// insertAfter undefined means "make the node the new head of list" +function insertAfter(self, node, value) { + const prev = node; + const next = node ? node.next : self.head; + const inserted = new Node(value, prev, next, self); + if (inserted.next === undefined) { + self.tail = inserted; + } + if (inserted.prev === undefined) { + self.head = inserted; + } + self.length++; + return inserted; +} +function push(self, item) { + self.tail = new Node(item, self.tail, undefined, self); + if (!self.head) { + self.head = self.tail; + } + self.length++; +} +function unshift(self, item) { + self.head = new Node(item, undefined, self.head, self); + if (!self.tail) { + self.tail = self.head; + } + self.length++; +} +export class Node { + list; + next; + prev; + value; + constructor(value, prev, next, list) { + this.list = list; + this.value = value; + if (prev) { + prev.next = this; + this.prev = prev; + } + else { + this.prev = undefined; + } + if (next) { + next.prev = this; + this.next = next; + } + else { + this.next = undefined; + } + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/esm/package.json b/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/yallist/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/cacache/node_modules/yallist/package.json b/node_modules/npm/node_modules/cacache/node_modules/yallist/package.json new file mode 100644 index 00000000..2f524780 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/node_modules/yallist/package.json @@ -0,0 +1,68 @@ +{ + "name": "yallist", + "version": "5.0.0", + "description": "Yet Another Linked List", + "files": [ + "dist" + ], + "devDependencies": { + "prettier": "^3.2.5", + "tap": "^18.7.2", + "tshy": "^1.13.1", + "typedoc": "^0.25.13" + }, + "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 --ignore-path ../../.prettierignore --cache", + "typedoc": "typedoc" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/yallist.git" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "BlueOak-1.0.0", + "tshy": { + "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" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "prettier": { + "semi": false, + "printWidth": 70, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "engines": { + "node": ">=18" + } +} diff --git a/node_modules/npm/node_modules/cacache/package.json b/node_modules/npm/node_modules/cacache/package.json new file mode 100644 index 00000000..ebb0f3f8 --- /dev/null +++ b/node_modules/npm/node_modules/cacache/package.json @@ -0,0 +1,83 @@ +{ + "name": "cacache", + "version": "19.0.1", + "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": { + "test": "tap", + "snap": "tap", + "coverage": "tap", + "test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test", + "lint": "npm run eslint", + "npmclilint": "npmcli-lint", + "lintfix": "npm run eslint -- --fix", + "postsnap": "npm run lintfix --", + "postlint": "template-oss-check", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+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": "^4.0.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^10.0.1", + "minipass": "^7.0.3", + "minipass-collect": "^2.0.1", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^7.0.2", + "ssri": "^12.0.0", + "tar": "^7.4.3", + "unique-filename": "^4.0.0" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "windowsCI": false, + "version": "4.23.3", + "publish": "true" + }, + "author": "GitHub Inc.", + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/chalk/license b/node_modules/npm/node_modules/chalk/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/chalk/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/chalk/package.json b/node_modules/npm/node_modules/chalk/package.json new file mode 100644 index 00000000..3c500105 --- /dev/null +++ b/node_modules/npm/node_modules/chalk/package.json @@ -0,0 +1,83 @@ +{ + "name": "chalk", + "version": "5.3.0", + "description": "Terminal string styling done right", + "license": "MIT", + "repository": "chalk/chalk", + "funding": "https://github.com/chalk/chalk?sponsor=1", + "type": "module", + "main": "./source/index.js", + "exports": "./source/index.js", + "imports": { + "#ansi-styles": "./source/vendor/ansi-styles/index.js", + "#supports-color": { + "node": "./source/vendor/supports-color/index.js", + "default": "./source/vendor/supports-color/browser.js" + } + }, + "types": "./source/index.d.ts", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "scripts": { + "test": "xo && c8 ava && tsd", + "bench": "matcha benchmark.js" + }, + "files": [ + "source", + "!source/index.test-d.ts" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "ansi", + "style", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "@types/node": "^16.11.10", + "ava": "^3.15.0", + "c8": "^7.10.0", + "color-convert": "^2.0.1", + "execa": "^6.0.0", + "log-update": "^5.0.0", + "matcha": "^0.7.0", + "tsd": "^0.19.0", + "xo": "^0.53.0", + "yoctodelay": "^2.0.0" + }, + "sideEffects": false, + "xo": { + "rules": { + "unicorn/prefer-string-slice": "off", + "@typescript-eslint/consistent-type-imports": "off", + "@typescript-eslint/consistent-type-exports": "off", + "@typescript-eslint/consistent-type-definitions": "off", + "unicorn/expiring-todo-comments": "off" + } + }, + "c8": { + "reporter": [ + "text", + "lcov" + ], + "exclude": [ + "source/vendor" + ] + } +} diff --git a/node_modules/npm/node_modules/chalk/source/index.js b/node_modules/npm/node_modules/chalk/source/index.js new file mode 100644 index 00000000..8bc993da --- /dev/null +++ b/node_modules/npm/node_modules/chalk/source/index.js @@ -0,0 +1,225 @@ +import ansiStyles from '#ansi-styles'; +import supportsColor from '#supports-color'; +import { // eslint-disable-line import/order + stringReplaceAll, + stringEncaseCRLFWithFirstIndex, +} from './utilities.js'; + +const {stdout: stdoutColor, stderr: stderrColor} = supportsColor; + +const GENERATOR = Symbol('GENERATOR'); +const STYLER = Symbol('STYLER'); +const IS_EMPTY = Symbol('IS_EMPTY'); + +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = [ + 'ansi', + 'ansi', + 'ansi256', + 'ansi16m', +]; + +const styles = Object.create(null); + +const applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { + throw new Error('The `level` option should be an integer from 0 to 3'); + } + + // Detect level if not set manually + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === undefined ? colorLevel : options.level; +}; + +export class Chalk { + constructor(options) { + // eslint-disable-next-line no-constructor-return + return chalkFactory(options); + } +} + +const chalkFactory = options => { + const chalk = (...strings) => strings.join(' '); + applyOptions(chalk, options); + + Object.setPrototypeOf(chalk, createChalk.prototype); + + return chalk; +}; + +function createChalk(options) { + return chalkFactory(options); +} + +Object.setPrototypeOf(createChalk.prototype, Function.prototype); + +for (const [styleName, style] of Object.entries(ansiStyles)) { + styles[styleName] = { + get() { + const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]); + Object.defineProperty(this, styleName, {value: builder}); + return builder; + }, + }; +} + +styles.visible = { + get() { + const builder = createBuilder(this, this[STYLER], true); + Object.defineProperty(this, 'visible', {value: builder}); + return builder; + }, +}; + +const getModelAnsi = (model, level, type, ...arguments_) => { + if (model === 'rgb') { + if (level === 'ansi16m') { + return ansiStyles[type].ansi16m(...arguments_); + } + + if (level === 'ansi256') { + return ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_)); + } + + return ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_)); + } + + if (model === 'hex') { + return getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_)); + } + + return ansiStyles[type][model](...arguments_); +}; + +const usedModels = ['rgb', 'hex', 'ansi256']; + +for (const model of usedModels) { + styles[model] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]); + return createBuilder(this, styler, this[IS_EMPTY]); + }; + }, + }; + + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]); + return createBuilder(this, styler, this[IS_EMPTY]); + }; + }, + }; +} + +const proto = Object.defineProperties(() => {}, { + ...styles, + level: { + enumerable: true, + get() { + return this[GENERATOR].level; + }, + set(level) { + this[GENERATOR].level = level; + }, + }, +}); + +const createStyler = (open, close, parent) => { + let openAll; + let closeAll; + if (parent === undefined) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } + + return { + open, + close, + openAll, + closeAll, + parent, + }; +}; + +const createBuilder = (self, _styler, _isEmpty) => { + // Single argument is hot path, implicit coercion is faster than anything + // eslint-disable-next-line no-implicit-coercion + const builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); + + // We alter the prototype because we must return a function, but there is + // no way to create a function with a different prototype + Object.setPrototypeOf(builder, proto); + + builder[GENERATOR] = self; + builder[STYLER] = _styler; + builder[IS_EMPTY] = _isEmpty; + + return builder; +}; + +const applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self[IS_EMPTY] ? '' : string; + } + + let styler = self[STYLER]; + + if (styler === undefined) { + return string; + } + + const {openAll, closeAll} = styler; + if (string.includes('\u001B')) { + while (styler !== undefined) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + string = stringReplaceAll(string, styler.close, styler.open); + + styler = styler.parent; + } + } + + // We can move both next actions out of loop, because remaining actions in loop won't have + // any/visible effect on parts we add here. Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 + const lfIndex = string.indexOf('\n'); + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); + } + + return openAll + string + closeAll; +}; + +Object.defineProperties(createChalk.prototype, styles); + +const chalk = createChalk(); +export const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0}); + +export { + modifierNames, + foregroundColorNames, + backgroundColorNames, + colorNames, + + // TODO: Remove these aliases in the next major version + modifierNames as modifiers, + foregroundColorNames as foregroundColors, + backgroundColorNames as backgroundColors, + colorNames as colors, +} from './vendor/ansi-styles/index.js'; + +export { + stdoutColor as supportsColor, + stderrColor as supportsColorStderr, +}; + +export default chalk; diff --git a/node_modules/npm/node_modules/chalk/source/utilities.js b/node_modules/npm/node_modules/chalk/source/utilities.js new file mode 100644 index 00000000..4366dee0 --- /dev/null +++ b/node_modules/npm/node_modules/chalk/source/utilities.js @@ -0,0 +1,33 @@ +// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`. +export function stringReplaceAll(string, substring, replacer) { + let index = string.indexOf(substring); + if (index === -1) { + return string; + } + + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ''; + do { + returnValue += string.slice(endIndex, index) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); + + returnValue += string.slice(endIndex); + return returnValue; +} + +export function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) { + let endIndex = 0; + let returnValue = ''; + do { + const gotCR = string[index - 1] === '\r'; + returnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + endIndex = index + 1; + index = string.indexOf('\n', endIndex); + } while (index !== -1); + + returnValue += string.slice(endIndex); + return returnValue; +} diff --git a/node_modules/npm/node_modules/chalk/source/vendor/ansi-styles/index.js b/node_modules/npm/node_modules/chalk/source/vendor/ansi-styles/index.js new file mode 100644 index 00000000..eaa7bed6 --- /dev/null +++ b/node_modules/npm/node_modules/chalk/source/vendor/ansi-styles/index.js @@ -0,0 +1,223 @@ +const ANSI_BACKGROUND_OFFSET = 10; + +const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`; + +const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`; + +const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`; + +const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + gray: [90, 39], // Alias of `blackBright` + grey: [90, 39], // Alias of `blackBright` + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39], + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgGray: [100, 49], // Alias of `bgBlackBright` + bgGrey: [100, 49], // Alias of `bgBlackBright` + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49], + }, +}; + +export const modifierNames = Object.keys(styles.modifier); +export const foregroundColorNames = Object.keys(styles.color); +export const backgroundColorNames = Object.keys(styles.bgColor); +export const colorNames = [...foregroundColorNames, ...backgroundColorNames]; + +function assembleStyles() { + const codes = new Map(); + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m`, + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false, + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false, + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + styles.color.ansi = wrapAnsi16(); + styles.color.ansi256 = wrapAnsi256(); + styles.color.ansi16m = wrapAnsi16m(); + styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET); + styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET); + + // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js + Object.defineProperties(styles, { + rgbToAnsi256: { + value(red, green, blue) { + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (red === green && green === blue) { + if (red < 8) { + return 16; + } + + if (red > 248) { + return 231; + } + + return Math.round(((red - 8) / 247) * 24) + 232; + } + + return 16 + + (36 * Math.round(red / 255 * 5)) + + (6 * Math.round(green / 255 * 5)) + + Math.round(blue / 255 * 5); + }, + enumerable: false, + }, + hexToRgb: { + value(hex) { + const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); + if (!matches) { + return [0, 0, 0]; + } + + let [colorString] = matches; + + if (colorString.length === 3) { + colorString = [...colorString].map(character => character + character).join(''); + } + + const integer = Number.parseInt(colorString, 16); + + return [ + /* eslint-disable no-bitwise */ + (integer >> 16) & 0xFF, + (integer >> 8) & 0xFF, + integer & 0xFF, + /* eslint-enable no-bitwise */ + ]; + }, + enumerable: false, + }, + hexToAnsi256: { + value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)), + enumerable: false, + }, + ansi256ToAnsi: { + value(code) { + if (code < 8) { + return 30 + code; + } + + if (code < 16) { + return 90 + (code - 8); + } + + let red; + let green; + let blue; + + if (code >= 232) { + red = (((code - 232) * 10) + 8) / 255; + green = red; + blue = red; + } else { + code -= 16; + + const remainder = code % 36; + + red = Math.floor(code / 36) / 5; + green = Math.floor(remainder / 6) / 5; + blue = (remainder % 6) / 5; + } + + const value = Math.max(red, green, blue) * 2; + + if (value === 0) { + return 30; + } + + // eslint-disable-next-line no-bitwise + let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red)); + + if (value === 2) { + result += 60; + } + + return result; + }, + enumerable: false, + }, + rgbToAnsi: { + value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), + enumerable: false, + }, + hexToAnsi: { + value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), + enumerable: false, + }, + }); + + return styles; +} + +const ansiStyles = assembleStyles(); + +export default ansiStyles; diff --git a/node_modules/npm/node_modules/chalk/source/vendor/supports-color/browser.js b/node_modules/npm/node_modules/chalk/source/vendor/supports-color/browser.js new file mode 100644 index 00000000..9fa6888f --- /dev/null +++ b/node_modules/npm/node_modules/chalk/source/vendor/supports-color/browser.js @@ -0,0 +1,30 @@ +/* eslint-env browser */ + +const level = (() => { + if (navigator.userAgentData) { + const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium'); + if (brand && brand.version > 93) { + return 3; + } + } + + if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) { + return 1; + } + + return 0; +})(); + +const colorSupport = level !== 0 && { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3, +}; + +const supportsColor = { + stdout: colorSupport, + stderr: colorSupport, +}; + +export default supportsColor; diff --git a/node_modules/npm/node_modules/chalk/source/vendor/supports-color/index.js b/node_modules/npm/node_modules/chalk/source/vendor/supports-color/index.js new file mode 100644 index 00000000..4ce0a2da --- /dev/null +++ b/node_modules/npm/node_modules/chalk/source/vendor/supports-color/index.js @@ -0,0 +1,182 @@ +import process from 'node:process'; +import os from 'node:os'; +import tty from 'node:tty'; + +// From: https://github.com/sindresorhus/has-flag/blob/main/index.js +/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) { +function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) { + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +} + +const {env} = process; + +let flagForceColor; +if ( + hasFlag('no-color') + || hasFlag('no-colors') + || hasFlag('color=false') + || hasFlag('color=never') +) { + flagForceColor = 0; +} else if ( + hasFlag('color') + || hasFlag('colors') + || hasFlag('color=true') + || hasFlag('color=always') +) { + flagForceColor = 1; +} + +function envForceColor() { + if ('FORCE_COLOR' in env) { + if (env.FORCE_COLOR === 'true') { + return 1; + } + + if (env.FORCE_COLOR === 'false') { + return 0; + } + + return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3); + } +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3, + }; +} + +function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) { + const noFlagForceColor = envForceColor(); + if (noFlagForceColor !== undefined) { + flagForceColor = noFlagForceColor; + } + + const forceColor = sniffFlags ? flagForceColor : noFlagForceColor; + + if (forceColor === 0) { + return 0; + } + + if (sniffFlags) { + if (hasFlag('color=16m') + || hasFlag('color=full') + || hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + } + + // Check for Azure DevOps pipelines. + // Has to be above the `!streamIsTTY` check. + if ('TF_BUILD' in env && 'AGENT_NAME' in env) { + return 1; + } + + if (haveStream && !streamIsTTY && forceColor === undefined) { + return 0; + } + + const min = forceColor || 0; + + if (env.TERM === 'dumb') { + return min; + } + + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 + && Number(osRelease[2]) >= 10_586 + ) { + return Number(osRelease[2]) >= 14_931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) { + return 3; + } + + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + + if (env.COLORTERM === 'truecolor') { + return 3; + } + + if (env.TERM === 'xterm-kitty') { + return 3; + } + + if ('TERM_PROGRAM' in env) { + const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': { + return version >= 3 ? 3 : 2; + } + + case 'Apple_Terminal': { + return 2; + } + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + return min; +} + +export function createSupportsColor(stream, options = {}) { + const level = _supportsColor(stream, { + streamIsTTY: stream && stream.isTTY, + ...options, + }); + + return translateLevel(level); +} + +const supportsColor = { + stdout: createSupportsColor({isTTY: tty.isatty(1)}), + stderr: createSupportsColor({isTTY: tty.isatty(2)}), +}; + +export default supportsColor; diff --git a/node_modules/npm/node_modules/chownr/LICENSE b/node_modules/npm/node_modules/chownr/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/chownr/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/chownr/chownr.js b/node_modules/npm/node_modules/chownr/chownr.js new file mode 100644 index 00000000..0d409321 --- /dev/null +++ b/node_modules/npm/node_modules/chownr/chownr.js @@ -0,0 +1,167 @@ +'use strict' +const fs = require('fs') +const path = require('path') + +/* istanbul ignore next */ +const LCHOWN = fs.lchown ? 'lchown' : 'chown' +/* istanbul ignore next */ +const LCHOWNSYNC = fs.lchownSync ? 'lchownSync' : 'chownSync' + +/* istanbul ignore next */ +const needEISDIRHandled = fs.lchown && + !process.version.match(/v1[1-9]+\./) && + !process.version.match(/v10\.[6-9]/) + +const lchownSync = (path, uid, gid) => { + try { + return fs[LCHOWNSYNC](path, uid, gid) + } catch (er) { + if (er.code !== 'ENOENT') + throw er + } +} + +/* istanbul ignore next */ +const chownSync = (path, uid, gid) => { + try { + return fs.chownSync(path, uid, gid) + } catch (er) { + if (er.code !== 'ENOENT') + throw er + } +} + +/* istanbul ignore next */ +const handleEISDIR = + needEISDIRHandled ? (path, uid, gid, cb) => er => { + // Node prior to v10 had a very questionable implementation of + // fs.lchown, which would always try to call fs.open on a directory + // Fall back to fs.chown in those cases. + if (!er || er.code !== 'EISDIR') + cb(er) + else + fs.chown(path, uid, gid, cb) + } + : (_, __, ___, cb) => cb + +/* istanbul ignore next */ +const handleEISDirSync = + needEISDIRHandled ? (path, uid, gid) => { + try { + return lchownSync(path, uid, gid) + } catch (er) { + if (er.code !== 'EISDIR') + throw er + chownSync(path, uid, gid) + } + } + : (path, uid, gid) => lchownSync(path, uid, gid) + +// fs.readdir could only accept an options object as of node v6 +const nodeVersion = process.version +let readdir = (path, options, cb) => fs.readdir(path, options, cb) +let readdirSync = (path, options) => fs.readdirSync(path, options) +/* istanbul ignore next */ +if (/^v4\./.test(nodeVersion)) + readdir = (path, options, cb) => fs.readdir(path, cb) + +const chown = (cpath, uid, gid, cb) => { + fs[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, er => { + // Skip ENOENT error + cb(er && er.code !== 'ENOENT' ? er : null) + })) +} + +const chownrKid = (p, child, uid, gid, cb) => { + if (typeof child === 'string') + return fs.lstat(path.resolve(p, child), (er, stats) => { + // Skip ENOENT error + if (er) + return cb(er.code !== 'ENOENT' ? er : null) + stats.name = child + chownrKid(p, stats, uid, gid, cb) + }) + + if (child.isDirectory()) { + chownr(path.resolve(p, child.name), uid, gid, er => { + if (er) + return cb(er) + const cpath = path.resolve(p, child.name) + chown(cpath, uid, gid, cb) + }) + } else { + const cpath = path.resolve(p, child.name) + chown(cpath, uid, gid, cb) + } +} + + +const chownr = (p, uid, gid, cb) => { + readdir(p, { withFileTypes: true }, (er, children) => { + // any error other than ENOTDIR or ENOTSUP means it's not readable, + // or doesn't exist. give up. + if (er) { + if (er.code === 'ENOENT') + return cb() + else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') + return cb(er) + } + if (er || !children.length) + return chown(p, uid, gid, cb) + + let len = children.length + let errState = null + const then = er => { + if (errState) + return + if (er) + return cb(errState = er) + if (-- len === 0) + return chown(p, uid, gid, cb) + } + + children.forEach(child => chownrKid(p, child, uid, gid, then)) + }) +} + +const chownrKidSync = (p, child, uid, gid) => { + if (typeof child === 'string') { + try { + const stats = fs.lstatSync(path.resolve(p, child)) + stats.name = child + child = stats + } catch (er) { + if (er.code === 'ENOENT') + return + else + throw er + } + } + + if (child.isDirectory()) + chownrSync(path.resolve(p, child.name), uid, gid) + + handleEISDirSync(path.resolve(p, child.name), uid, gid) +} + +const chownrSync = (p, uid, gid) => { + let children + try { + children = readdirSync(p, { withFileTypes: true }) + } catch (er) { + if (er.code === 'ENOENT') + return + else if (er.code === 'ENOTDIR' || er.code === 'ENOTSUP') + return handleEISDirSync(p, uid, gid) + else + throw er + } + + if (children && children.length) + children.forEach(child => chownrKidSync(p, child, uid, gid)) + + return handleEISDirSync(p, uid, gid) +} + +module.exports = chownr +chownr.sync = chownrSync diff --git a/node_modules/npm/node_modules/chownr/package.json b/node_modules/npm/node_modules/chownr/package.json new file mode 100644 index 00000000..5b0214ca --- /dev/null +++ b/node_modules/npm/node_modules/chownr/package.json @@ -0,0 +1,32 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "name": "chownr", + "description": "like `chown -R`", + "version": "2.0.0", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/chownr.git" + }, + "main": "chownr.js", + "files": [ + "chownr.js" + ], + "devDependencies": { + "mkdirp": "0.3", + "rimraf": "^2.7.1", + "tap": "^14.10.6" + }, + "tap": { + "check-coverage": true + }, + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "license": "ISC", + "engines": { + "node": ">=10" + } +} diff --git a/node_modules/npm/node_modules/ci-info/LICENSE b/node_modules/npm/node_modules/ci-info/LICENSE new file mode 100644 index 00000000..95f61daa --- /dev/null +++ b/node_modules/npm/node_modules/ci-info/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Thomas Watson Steen + +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/npm/node_modules/ci-info/index.js b/node_modules/npm/node_modules/ci-info/index.js new file mode 100644 index 00000000..9eba6940 --- /dev/null +++ b/node_modules/npm/node_modules/ci-info/index.js @@ -0,0 +1,102 @@ +'use strict' + +const vendors = require('./vendors.json') + +const env = process.env + +// Used for testing only +Object.defineProperty(exports, '_vendors', { + value: vendors.map(function (v) { + return v.constant + }) +}) + +exports.name = null +exports.isPR = null +exports.id = null + +vendors.forEach(function (vendor) { + const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env] + const isCI = envs.every(function (obj) { + return checkEnv(obj) + }) + + exports[vendor.constant] = isCI + + if (!isCI) { + return + } + + exports.name = vendor.name + exports.isPR = checkPR(vendor) + exports.id = vendor.constant +}) + +exports.isCI = !!( + env.CI !== 'false' && // Bypass all checks if CI env is explicitly set to 'false' + (env.BUILD_ID || // Jenkins, Cloudbees + env.BUILD_NUMBER || // Jenkins, TeamCity + env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari + env.CI_APP_ID || // Appflow + env.CI_BUILD_ID || // Appflow + env.CI_BUILD_NUMBER || // Appflow + env.CI_NAME || // Codeship and others + env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI + env.RUN_ID || // TaskCluster, dsari + exports.name || + false) +) + +function checkEnv (obj) { + // "env": "CIRRUS" + if (typeof obj === 'string') return !!env[obj] + + // "env": { "env": "NODE", "includes": "/app/.heroku/node/bin/node" } + if ('env' in obj) { + // Currently there are no other types, uncomment when there are + // if ('includes' in obj) { + return env[obj.env] && env[obj.env].includes(obj.includes) + // } + } + + if ('any' in obj) { + return obj.any.some(function (k) { + return !!env[k] + }) + } + + return Object.keys(obj).every(function (k) { + return env[k] === obj[k] + }) +} + +function checkPR (vendor) { + switch (typeof vendor.pr) { + case 'string': + // "pr": "CIRRUS_PR" + return !!env[vendor.pr] + case 'object': + if ('env' in vendor.pr) { + if ('any' in vendor.pr) { + // "pr": { "env": "CODEBUILD_WEBHOOK_EVENT", "any": ["PULL_REQUEST_CREATED", "PULL_REQUEST_UPDATED"] } + return vendor.pr.any.some(function (key) { + return env[vendor.pr.env] === key + }) + } else { + // "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" } + return vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne + } + } else if ('any' in vendor.pr) { + // "pr": { "any": ["ghprbPullId", "CHANGE_ID"] } + return vendor.pr.any.some(function (key) { + return !!env[key] + }) + } else { + // "pr": { "DRONE_BUILD_EVENT": "pull_request" } + return checkEnv(vendor.pr) + } + default: + // PR detection not supported for this vendor + return null + } +} diff --git a/node_modules/npm/node_modules/ci-info/package.json b/node_modules/npm/node_modules/ci-info/package.json new file mode 100644 index 00000000..156329d2 --- /dev/null +++ b/node_modules/npm/node_modules/ci-info/package.json @@ -0,0 +1,51 @@ +{ + "name": "ci-info", + "version": "4.1.0", + "description": "Get details about the current Continuous Integration environment", + "main": "index.js", + "typings": "index.d.ts", + "author": "Thomas Watson Steen (https://twitter.com/wa7son)", + "license": "MIT", + "repository": "https://github.com/watson/ci-info.git", + "bugs": "https://github.com/watson/ci-info/issues", + "homepage": "https://github.com/watson/ci-info", + "contributors": [ + { + "name": "Sibiraj", + "url": "https://github.com/sibiraj-s" + } + ], + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "keywords": [ + "ci", + "continuous", + "integration", + "test", + "detect" + ], + "files": [ + "vendors.json", + "index.js", + "index.d.ts", + "CHANGELOG.md" + ], + "scripts": { + "lint:fix": "standard --fix", + "test": "standard && node test.js", + "prepare": "husky install || true" + }, + "devDependencies": { + "clear-module": "^4.1.2", + "husky": "^9.1.6", + "standard": "^17.1.2", + "tape": "^5.9.0" + }, + "engines": { + "node": ">=8" + } +} diff --git a/node_modules/npm/node_modules/ci-info/vendors.json b/node_modules/npm/node_modules/ci-info/vendors.json new file mode 100644 index 00000000..64d5924d --- /dev/null +++ b/node_modules/npm/node_modules/ci-info/vendors.json @@ -0,0 +1,348 @@ +[ + { + "name": "Agola CI", + "constant": "AGOLA", + "env": "AGOLA_GIT_REF", + "pr": "AGOLA_PULL_REQUEST_ID" + }, + { + "name": "Appcircle", + "constant": "APPCIRCLE", + "env": "AC_APPCIRCLE", + "pr": { + "env": "AC_GIT_PR", + "ne": "false" + } + }, + { + "name": "AppVeyor", + "constant": "APPVEYOR", + "env": "APPVEYOR", + "pr": "APPVEYOR_PULL_REQUEST_NUMBER" + }, + { + "name": "AWS CodeBuild", + "constant": "CODEBUILD", + "env": "CODEBUILD_BUILD_ARN", + "pr": { + "env": "CODEBUILD_WEBHOOK_EVENT", + "any": [ + "PULL_REQUEST_CREATED", + "PULL_REQUEST_UPDATED", + "PULL_REQUEST_REOPENED" + ] + } + }, + { + "name": "Azure Pipelines", + "constant": "AZURE_PIPELINES", + "env": "TF_BUILD", + "pr": { + "BUILD_REASON": "PullRequest" + } + }, + { + "name": "Bamboo", + "constant": "BAMBOO", + "env": "bamboo_planKey" + }, + { + "name": "Bitbucket Pipelines", + "constant": "BITBUCKET", + "env": "BITBUCKET_COMMIT", + "pr": "BITBUCKET_PR_ID" + }, + { + "name": "Bitrise", + "constant": "BITRISE", + "env": "BITRISE_IO", + "pr": "BITRISE_PULL_REQUEST" + }, + { + "name": "Buddy", + "constant": "BUDDY", + "env": "BUDDY_WORKSPACE_ID", + "pr": "BUDDY_EXECUTION_PULL_REQUEST_ID" + }, + { + "name": "Buildkite", + "constant": "BUILDKITE", + "env": "BUILDKITE", + "pr": { + "env": "BUILDKITE_PULL_REQUEST", + "ne": "false" + } + }, + { + "name": "CircleCI", + "constant": "CIRCLE", + "env": "CIRCLECI", + "pr": "CIRCLE_PULL_REQUEST" + }, + { + "name": "Cirrus CI", + "constant": "CIRRUS", + "env": "CIRRUS_CI", + "pr": "CIRRUS_PR" + }, + { + "name": "Codefresh", + "constant": "CODEFRESH", + "env": "CF_BUILD_ID", + "pr": { + "any": [ + "CF_PULL_REQUEST_NUMBER", + "CF_PULL_REQUEST_ID" + ] + } + }, + { + "name": "Codemagic", + "constant": "CODEMAGIC", + "env": "CM_BUILD_ID", + "pr": "CM_PULL_REQUEST" + }, + { + "name": "Codeship", + "constant": "CODESHIP", + "env": { + "CI_NAME": "codeship" + } + }, + { + "name": "Drone", + "constant": "DRONE", + "env": "DRONE", + "pr": { + "DRONE_BUILD_EVENT": "pull_request" + } + }, + { + "name": "dsari", + "constant": "DSARI", + "env": "DSARI" + }, + { + "name": "Earthly", + "constant": "EARTHLY", + "env": "EARTHLY_CI" + }, + { + "name": "Expo Application Services", + "constant": "EAS", + "env": "EAS_BUILD" + }, + { + "name": "Gerrit", + "constant": "GERRIT", + "env": "GERRIT_PROJECT" + }, + { + "name": "Gitea Actions", + "constant": "GITEA_ACTIONS", + "env": "GITEA_ACTIONS" + }, + { + "name": "GitHub Actions", + "constant": "GITHUB_ACTIONS", + "env": "GITHUB_ACTIONS", + "pr": { + "GITHUB_EVENT_NAME": "pull_request" + } + }, + { + "name": "GitLab CI", + "constant": "GITLAB", + "env": "GITLAB_CI", + "pr": "CI_MERGE_REQUEST_ID" + }, + { + "name": "GoCD", + "constant": "GOCD", + "env": "GO_PIPELINE_LABEL" + }, + { + "name": "Google Cloud Build", + "constant": "GOOGLE_CLOUD_BUILD", + "env": "BUILDER_OUTPUT" + }, + { + "name": "Harness CI", + "constant": "HARNESS", + "env": "HARNESS_BUILD_ID" + }, + { + "name": "Heroku", + "constant": "HEROKU", + "env": { + "env": "NODE", + "includes": "/app/.heroku/node/bin/node" + } + }, + { + "name": "Hudson", + "constant": "HUDSON", + "env": "HUDSON_URL" + }, + { + "name": "Jenkins", + "constant": "JENKINS", + "env": [ + "JENKINS_URL", + "BUILD_ID" + ], + "pr": { + "any": [ + "ghprbPullId", + "CHANGE_ID" + ] + } + }, + { + "name": "LayerCI", + "constant": "LAYERCI", + "env": "LAYERCI", + "pr": "LAYERCI_PULL_REQUEST" + }, + { + "name": "Magnum CI", + "constant": "MAGNUM", + "env": "MAGNUM" + }, + { + "name": "Netlify CI", + "constant": "NETLIFY", + "env": "NETLIFY", + "pr": { + "env": "PULL_REQUEST", + "ne": "false" + } + }, + { + "name": "Nevercode", + "constant": "NEVERCODE", + "env": "NEVERCODE", + "pr": { + "env": "NEVERCODE_PULL_REQUEST", + "ne": "false" + } + }, + { + "name": "Prow", + "constant": "PROW", + "env": "PROW_JOB_ID" + }, + { + "name": "ReleaseHub", + "constant": "RELEASEHUB", + "env": "RELEASE_BUILD_ID" + }, + { + "name": "Render", + "constant": "RENDER", + "env": "RENDER", + "pr": { + "IS_PULL_REQUEST": "true" + } + }, + { + "name": "Sail CI", + "constant": "SAIL", + "env": "SAILCI", + "pr": "SAIL_PULL_REQUEST_NUMBER" + }, + { + "name": "Screwdriver", + "constant": "SCREWDRIVER", + "env": "SCREWDRIVER", + "pr": { + "env": "SD_PULL_REQUEST", + "ne": "false" + } + }, + { + "name": "Semaphore", + "constant": "SEMAPHORE", + "env": "SEMAPHORE", + "pr": "PULL_REQUEST_NUMBER" + }, + { + "name": "Sourcehut", + "constant": "SOURCEHUT", + "env": { + "CI_NAME": "sourcehut" + } + }, + { + "name": "Strider CD", + "constant": "STRIDER", + "env": "STRIDER" + }, + { + "name": "TaskCluster", + "constant": "TASKCLUSTER", + "env": [ + "TASK_ID", + "RUN_ID" + ] + }, + { + "name": "TeamCity", + "constant": "TEAMCITY", + "env": "TEAMCITY_VERSION" + }, + { + "name": "Travis CI", + "constant": "TRAVIS", + "env": "TRAVIS", + "pr": { + "env": "TRAVIS_PULL_REQUEST", + "ne": "false" + } + }, + { + "name": "Vela", + "constant": "VELA", + "env": "VELA", + "pr": { + "VELA_PULL_REQUEST": "1" + } + }, + { + "name": "Vercel", + "constant": "VERCEL", + "env": { + "any": [ + "NOW_BUILDER", + "VERCEL" + ] + }, + "pr": "VERCEL_GIT_PULL_REQUEST_ID" + }, + { + "name": "Visual Studio App Center", + "constant": "APPCENTER", + "env": "APPCENTER_BUILD_ID" + }, + { + "name": "Woodpecker", + "constant": "WOODPECKER", + "env": { + "CI": "woodpecker" + }, + "pr": { + "CI_BUILD_EVENT": "pull_request" + } + }, + { + "name": "Xcode Cloud", + "constant": "XCODE_CLOUD", + "env": "CI_XCODE_PROJECT", + "pr": "CI_PULL_REQUEST_NUMBER" + }, + { + "name": "Xcode Server", + "constant": "XCODE_SERVER", + "env": "XCS" + } +] diff --git a/node_modules/npm/node_modules/cidr-regex/LICENSE b/node_modules/npm/node_modules/cidr-regex/LICENSE new file mode 100644 index 00000000..9669c20f --- /dev/null +++ b/node_modules/npm/node_modules/cidr-regex/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) silverwind +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 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/npm/node_modules/cidr-regex/dist/index.js b/node_modules/npm/node_modules/cidr-regex/dist/index.js new file mode 100644 index 00000000..2817f65e --- /dev/null +++ b/node_modules/npm/node_modules/cidr-regex/dist/index.js @@ -0,0 +1,15 @@ +import ipRegex from "ip-regex"; +const defaultOpts = { exact: false }; +const v4str = `${ipRegex.v4().source}\\/(3[0-2]|[12]?[0-9])`; +const v6str = `${ipRegex.v6().source}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`; +const v4exact = new RegExp(`^${v4str}$`); +const v6exact = new RegExp(`^${v6str}$`); +const v46exact = new RegExp(`(?:^${v4str}$)|(?:^${v6str}$)`); +const cidrRegex = ({ exact } = defaultOpts) => exact ? v46exact : new RegExp(`(?:${v4str})|(?:${v6str})`, "g"); +const v4 = cidrRegex.v4 = ({ exact } = defaultOpts) => exact ? v4exact : new RegExp(v4str, "g"); +const v6 = cidrRegex.v6 = ({ exact } = defaultOpts) => exact ? v6exact : new RegExp(v6str, "g"); +export { + cidrRegex as default, + v4, + v6 +}; diff --git a/node_modules/npm/node_modules/cidr-regex/package.json b/node_modules/npm/node_modules/cidr-regex/package.json new file mode 100644 index 00000000..88b8297b --- /dev/null +++ b/node_modules/npm/node_modules/cidr-regex/package.json @@ -0,0 +1,40 @@ +{ + "name": "cidr-regex", + "version": "4.1.1", + "description": "Regular expression for matching IP addresses in CIDR notation", + "author": "silverwind ", + "contributors": [ + "Felipe Apostol (http://flipjs.io/)" + ], + "repository": "silverwind/cidr-regex", + "license": "BSD-2-Clause", + "type": "module", + "sideEffects": false, + "main": "./dist/index.js", + "exports": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "engines": { + "node": ">=14" + }, + "dependencies": { + "ip-regex": "^5.0.0" + }, + "devDependencies": { + "@types/node": "20.12.12", + "eslint": "8.57.0", + "eslint-config-silverwind": "85.1.4", + "eslint-config-silverwind-typescript": "3.2.7", + "typescript": "5.4.5", + "typescript-config-silverwind": "4.3.2", + "updates": "16.1.1", + "versions": "12.0.2", + "vite": "5.2.11", + "vite-config-silverwind": "1.1.2", + "vite-plugin-dts": "3.9.1", + "vitest": "1.6.0", + "vitest-config-silverwind": "9.0.6" + } +} diff --git a/node_modules/npm/node_modules/cli-columns/color.js b/node_modules/npm/node_modules/cli-columns/color.js new file mode 100644 index 00000000..11027047 --- /dev/null +++ b/node_modules/npm/node_modules/cli-columns/color.js @@ -0,0 +1,16 @@ +const chalk = require('chalk'); +const columns = require('.'); + +// prettier-ignore +const values = [ + 'blue' + chalk.bgBlue('berry'), + '笔菠萝' + chalk.yellow('苹果笔'), + chalk.red('apple'), 'pomegranate', + 'durian', chalk.green('star fruit'), + 'パイナップル', 'apricot', 'banana', + 'pineapple', chalk.bgRed.yellow('orange') +]; + +console.log(''); +console.log(columns(values)); +console.log(''); diff --git a/node_modules/npm/node_modules/cli-columns/index.js b/node_modules/npm/node_modules/cli-columns/index.js new file mode 100644 index 00000000..1090aa21 --- /dev/null +++ b/node_modules/npm/node_modules/cli-columns/index.js @@ -0,0 +1,82 @@ +'use strict'; + +const stringWidth = require('string-width'); +const stripAnsi = require('strip-ansi'); + +const concat = Array.prototype.concat; +const defaults = { + character: ' ', + newline: '\n', + padding: 2, + sort: true, + width: 0, +}; + +function byPlainText(a, b) { + const plainA = stripAnsi(a); + const plainB = stripAnsi(b); + + if (plainA === plainB) { + return 0; + } + + if (plainA > plainB) { + return 1; + } + + return -1; +} + +function makeArray() { + return []; +} + +function makeList(count) { + return Array.apply(null, Array(count)); +} + +function padCell(fullWidth, character, value) { + const valueWidth = stringWidth(value); + const filler = makeList(fullWidth - valueWidth + 1); + + return value + filler.join(character); +} + +function toRows(rows, cell, i) { + rows[i % rows.length].push(cell); + + return rows; +} + +function toString(arr) { + return arr.join(''); +} + +function columns(values, options) { + values = concat.apply([], values); + options = Object.assign({}, defaults, options); + + let cells = values.filter(Boolean).map(String); + + if (options.sort !== false) { + cells = cells.sort(byPlainText); + } + + const termWidth = options.width || process.stdout.columns; + const cellWidth = + Math.max.apply(null, cells.map(stringWidth)) + options.padding; + const columnCount = Math.floor(termWidth / cellWidth) || 1; + const rowCount = Math.ceil(cells.length / columnCount) || 1; + + if (columnCount === 1) { + return cells.join(options.newline); + } + + return cells + .map(padCell.bind(null, cellWidth, options.character)) + .reduce(toRows, makeList(rowCount).map(makeArray)) + .map(toString) + .join(options.newline); +} + +module.exports = columns; diff --git a/node_modules/npm/node_modules/cli-columns/license b/node_modules/npm/node_modules/cli-columns/license new file mode 100644 index 00000000..67147a98 --- /dev/null +++ b/node_modules/npm/node_modules/cli-columns/license @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Shannon Moeller (shannonmoeller.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/npm/node_modules/cli-columns/package.json b/node_modules/npm/node_modules/cli-columns/package.json new file mode 100644 index 00000000..129f2c13 --- /dev/null +++ b/node_modules/npm/node_modules/cli-columns/package.json @@ -0,0 +1,54 @@ +{ + "name": "cli-columns", + "version": "4.0.0", + "description": "Columnated lists for the CLI.", + "scripts": { + "lint": "npx eslint --fix '*.js' && npx prettier --write '*.js'", + "test": "node test.js && node color.js" + }, + "keywords": [ + "ansi", + "cli", + "column", + "columnate", + "columns", + "grid", + "list", + "log", + "ls", + "row", + "rows", + "unicode", + "unix" + ], + "author": "Shannon Moeller (http://shannonmoeller.com)", + "homepage": "https://github.com/shannonmoeller/cli-columns#readme", + "repository": "shannonmoeller/cli-columns", + "license": "MIT", + "main": "index.js", + "files": [ + "*.js" + ], + "dependencies": { + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "devDependencies": { + "chalk": "^4.1.2" + }, + "engines": { + "node": ">= 10" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true + }, + "parserOptions": { + "ecmaVersion": 8 + } + }, + "prettier": { + "singleQuote": true + } +} diff --git a/node_modules/npm/node_modules/cli-columns/test.js b/node_modules/npm/node_modules/cli-columns/test.js new file mode 100644 index 00000000..4d95e7cf --- /dev/null +++ b/node_modules/npm/node_modules/cli-columns/test.js @@ -0,0 +1,101 @@ +'use strict'; + +const assert = require('assert'); +const chalk = require('chalk'); +const stripAnsi = require('strip-ansi'); +const columns = require('./index.js'); +const tests = []; + +function test(msg, fn) { + tests.push([msg, fn]); +} + +process.nextTick(async function run() { + for (const [msg, fn] of tests) { + try { + await fn(assert); + console.log(`pass - ${msg}`); + } catch (error) { + console.error(`fail - ${msg}`, error); + process.exit(1); + } + } +}); + +// prettier-ignore +test('should print one column list', t => { + const cols = columns(['foo', ['bar', 'baz'], ['bar', 'qux']], { + width: 1 + }); + + const expected = + 'bar\n' + + 'bar\n' + + 'baz\n' + + 'foo\n' + + 'qux'; + + t.equal(cols, expected); +}); + +// prettier-ignore +test('should print three column list', t => { + const cols = columns(['foo', ['bar', 'baz'], ['bat', 'qux']], { + width: 16 + }); + + const expected = + 'bar baz qux \n' + + 'bat foo '; + + t.equal(cols, expected); +}); + +// prettier-ignore +test('should print complex list', t => { + const cols = columns( + [ + 'foo', 'bar', 'baz', + chalk.cyan('嶜憃撊') + ' 噾噿嚁', + 'blue' + chalk.bgBlue('berry'), + chalk.red('apple'), 'pomegranate', + 'durian', chalk.green('star fruit'), + 'apricot', 'banana pineapple' + ], + { + width: 80 + } + ); + + const expected = + 'apple bar durian star fruit \n' + + 'apricot baz foo 嶜憃撊 噾噿嚁 \n' + + 'banana pineapple blueberry pomegranate '; + + t.equal(stripAnsi(cols), expected); +}); + +// prettier-ignore +test('should optionally not sort', t => { + const cols = columns( + [ + 'foo', 'bar', 'baz', + chalk.cyan('嶜憃撊') + ' 噾噿嚁', + 'blue' + chalk.bgBlue('berry'), + chalk.red('apple'), 'pomegranate', + 'durian', chalk.green('star fruit'), + 'apricot', 'banana pineapple' + ], + { + sort: false, + width: 80 + } + ); + + const expected = + 'foo 嶜憃撊 噾噿嚁 pomegranate apricot \n' + + 'bar blueberry durian banana pineapple \n' + + 'baz apple star fruit '; + + t.equal(stripAnsi(cols), expected); +}); diff --git a/node_modules/npm/node_modules/cmd-shim/LICENSE b/node_modules/npm/node_modules/cmd-shim/LICENSE new file mode 100644 index 00000000..20a47625 --- /dev/null +++ b/node_modules/npm/node_modules/cmd-shim/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/npm/node_modules/cmd-shim/lib/index.js b/node_modules/npm/node_modules/cmd-shim/lib/index.js new file mode 100644 index 00000000..c13890ae --- /dev/null +++ b/node_modules/npm/node_modules/cmd-shim/lib/index.js @@ -0,0 +1,247 @@ +// On windows, create a .cmd file. +// Read the #! in the file to see what it uses. The vast majority +// of the time, this will be either: +// "#!/usr/bin/env " +// or: +// "#! " +// +// Write a binroot/pkg.bin + ".cmd" file that has this line in it: +// @ %dp0% %* + +const { + chmod, + mkdir, + readFile, + stat, + unlink, + writeFile, +} = require('fs/promises') + +const { dirname, relative } = require('path') +const toBatchSyntax = require('./to-batch-syntax') +// linting disabled because this regex is really long +// eslint-disable-next-line max-len +const shebangExpr = /^#!\s*(?:\/usr\/bin\/env\s+(?:-S\s+)?((?:[^ \t=]+=[^ \t=]+\s+)*))?([^ \t]+)(.*)$/ + +const cmdShimIfExists = (from, to) => + stat(from).then(() => cmdShim(from, to), () => {}) + +// Try to unlink, but ignore errors. +// Any problems will surface later. +const rm = path => unlink(path).catch(() => {}) + +const cmdShim = (from, to) => + stat(from).then(() => cmdShim_(from, to)) + +const cmdShim_ = (from, to) => Promise.all([ + rm(to), + rm(to + '.cmd'), + rm(to + '.ps1'), +]).then(() => writeShim(from, to)) + +const writeShim = (from, to) => + // make a cmd file and a sh script + // First, check if the bin is a #! of some sort. + // If not, then assume it's something that'll be compiled, or some other + // sort of script, and just call it directly. + mkdir(dirname(to), { recursive: true }) + .then(() => readFile(from, 'utf8')) + .then(data => { + const firstLine = data.trim().split(/\r*\n/)[0] + const shebang = firstLine.match(shebangExpr) + if (!shebang) { + return writeShim_(from, to) + } + const vars = shebang[1] || '' + const prog = shebang[2] + const args = shebang[3] || '' + return writeShim_(from, to, prog, args, vars) + }, () => writeShim_(from, to)) + +const writeShim_ = (from, to, prog, args, variables) => { + let shTarget = relative(dirname(to), from) + let target = shTarget.split('/').join('\\') + let longProg + let shProg = prog && prog.split('\\').join('/') + let shLongProg + let pwshProg = shProg && `"${shProg}$exe"` + let pwshLongProg + shTarget = shTarget.split('\\').join('/') + args = args || '' + variables = variables || '' + if (!prog) { + prog = `"%dp0%\\${target}"` + shProg = `"$basedir/${shTarget}"` + pwshProg = shProg + args = '' + target = '' + shTarget = '' + } else { + longProg = `"%dp0%\\${prog}.exe"` + shLongProg = `"$basedir/${prog}"` + pwshLongProg = `"$basedir/${prog}$exe"` + target = `"%dp0%\\${target}"` + shTarget = `"$basedir/${shTarget}"` + } + + // Subroutine trick to fix https://github.com/npm/cmd-shim/issues/10 + // and https://github.com/npm/cli/issues/969 + const head = '@ECHO off\r\n' + + 'GOTO start\r\n' + + ':find_dp0\r\n' + + 'SET dp0=%~dp0\r\n' + + 'EXIT /b\r\n' + + ':start\r\n' + + 'SETLOCAL\r\n' + + 'CALL :find_dp0\r\n' + + let cmd + if (longProg) { + shLongProg = shLongProg.trim() + args = args.trim() + const variablesBatch = toBatchSyntax.convertToSetCommands(variables) + cmd = head + + variablesBatch + + '\r\n' + + `IF EXIST ${longProg} (\r\n` + + ` SET "_prog=${longProg.replace(/(^")|("$)/g, '')}"\r\n` + + ') ELSE (\r\n' + + ` SET "_prog=${prog.replace(/(^")|("$)/g, '')}"\r\n` + + ' SET PATHEXT=%PATHEXT:;.JS;=;%\r\n' + + ')\r\n' + + '\r\n' + // prevent "Terminate Batch Job? (Y/n)" message + // https://github.com/npm/cli/issues/969#issuecomment-737496588 + + 'endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & ' + + `"%_prog%" ${args} ${target} %*\r\n` + } else { + cmd = `${head}${prog} ${args} ${target} %*\r\n` + } + + // #!/bin/sh + // basedir=`dirname "$0"` + // + // case `uname` in + // *CYGWIN*|*MINGW*|*MSYS*) + // if command -v cygpath > /dev/null 2>&1; then + // basedir=`cygpath -w "$basedir"` + // fi + // ;; + // esac + // + // if [ -x "$basedir/node.exe" ]; then + // exec "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@" + // else + // exec node "$basedir/node_modules/npm/bin/npm-cli.js" "$@" + // fi + + let sh = '#!/bin/sh\n' + + sh = sh + + `basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")\n` + + '\n' + + 'case `uname` in\n' + + ' *CYGWIN*|*MINGW*|*MSYS*)\n' + + ' if command -v cygpath > /dev/null 2>&1; then\n' + + ' basedir=`cygpath -w "$basedir"`\n' + + ' fi\n' + + ' ;;\n' + + 'esac\n' + + '\n' + + if (shLongProg) { + sh = sh + + `if [ -x ${shLongProg} ]; then\n` + + ` exec ${variables}${shLongProg} ${args} ${shTarget} "$@"\n` + + 'else \n' + + ` exec ${variables}${shProg} ${args} ${shTarget} "$@"\n` + + 'fi\n' + } else { + sh = sh + + `exec ${shProg} ${args} ${shTarget} "$@"\n` + } + + // #!/usr/bin/env pwsh + // $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + // + // $ret=0 + // $exe = "" + // if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + // # Fix case when both the Windows and Linux builds of Node + // # are installed in the same directory + // $exe = ".exe" + // } + // if (Test-Path "$basedir/node") { + // # Suport pipeline input + // if ($MyInvocation.ExpectingInput) { + // input | & "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args + // } else { + // & "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args + // } + // $ret=$LASTEXITCODE + // } else { + // # Support pipeline input + // if ($MyInvocation.ExpectingInput) { + // $input | & "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args + // } else { + // & "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args + // } + // $ret=$LASTEXITCODE + // } + // exit $ret + let pwsh = '#!/usr/bin/env pwsh\n' + + '$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent\n' + + '\n' + + '$exe=""\n' + + 'if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {\n' + + ' # Fix case when both the Windows and Linux builds of Node\n' + + ' # are installed in the same directory\n' + + ' $exe=".exe"\n' + + '}\n' + if (shLongProg) { + pwsh = pwsh + + '$ret=0\n' + + `if (Test-Path ${pwshLongProg}) {\n` + + ' # Support pipeline input\n' + + ' if ($MyInvocation.ExpectingInput) {\n' + + ` $input | & ${pwshLongProg} ${args} ${shTarget} $args\n` + + ' } else {\n' + + ` & ${pwshLongProg} ${args} ${shTarget} $args\n` + + ' }\n' + + ' $ret=$LASTEXITCODE\n' + + '} else {\n' + + ' # Support pipeline input\n' + + ' if ($MyInvocation.ExpectingInput) {\n' + + ` $input | & ${pwshProg} ${args} ${shTarget} $args\n` + + ' } else {\n' + + ` & ${pwshProg} ${args} ${shTarget} $args\n` + + ' }\n' + + ' $ret=$LASTEXITCODE\n' + + '}\n' + + 'exit $ret\n' + } else { + pwsh = pwsh + + '# Support pipeline input\n' + + 'if ($MyInvocation.ExpectingInput) {\n' + + ` $input | & ${pwshProg} ${args} ${shTarget} $args\n` + + '} else {\n' + + ` & ${pwshProg} ${args} ${shTarget} $args\n` + + '}\n' + + 'exit $LASTEXITCODE\n' + } + + return Promise.all([ + writeFile(to + '.ps1', pwsh, 'utf8'), + writeFile(to + '.cmd', cmd, 'utf8'), + writeFile(to, sh, 'utf8'), + ]).then(() => chmodShim(to)) +} + +const chmodShim = to => Promise.all([ + chmod(to, 0o755), + chmod(to + '.cmd', 0o755), + chmod(to + '.ps1', 0o755), +]) + +module.exports = cmdShim +cmdShim.ifExists = cmdShimIfExists diff --git a/node_modules/npm/node_modules/cmd-shim/lib/to-batch-syntax.js b/node_modules/npm/node_modules/cmd-shim/lib/to-batch-syntax.js new file mode 100644 index 00000000..86a3f014 --- /dev/null +++ b/node_modules/npm/node_modules/cmd-shim/lib/to-batch-syntax.js @@ -0,0 +1,49 @@ +exports.replaceDollarWithPercentPair = replaceDollarWithPercentPair +exports.convertToSetCommand = convertToSetCommand +exports.convertToSetCommands = convertToSetCommands + +function convertToSetCommand (key, value) { + var line = '' + key = key || '' + key = key.trim() + value = value || '' + value = value.trim() + if (key && value && value.length > 0) { + line = '@SET ' + key + '=' + replaceDollarWithPercentPair(value) + '\r\n' + } + return line +} + +function extractVariableValuePairs (declarations) { + var pairs = {} + declarations.map(function (declaration) { + var split = declaration.split('=') + pairs[split[0]] = split[1] + }) + return pairs +} + +function convertToSetCommands (variableString) { + var variableValuePairs = extractVariableValuePairs(variableString.split(' ')) + var variableDeclarationsAsBatch = '' + Object.keys(variableValuePairs).forEach(function (key) { + variableDeclarationsAsBatch += convertToSetCommand(key, variableValuePairs[key]) + }) + return variableDeclarationsAsBatch +} + +function replaceDollarWithPercentPair (value) { + var dollarExpressions = /\$\{?([^$@#?\- \t{}:]+)\}?/g + var result = '' + var startIndex = 0 + do { + var match = dollarExpressions.exec(value) + if (match) { + var betweenMatches = value.substring(startIndex, match.index) || '' + result += betweenMatches + '%' + match[1] + '%' + startIndex = dollarExpressions.lastIndex + } + } while (dollarExpressions.lastIndex > 0) + result += value.slice(startIndex) + return result +} diff --git a/node_modules/npm/node_modules/cmd-shim/package.json b/node_modules/npm/node_modules/cmd-shim/package.json new file mode 100644 index 00000000..5f2e85d1 --- /dev/null +++ b/node_modules/npm/node_modules/cmd-shim/package.json @@ -0,0 +1,48 @@ +{ + "name": "cmd-shim", + "version": "7.0.0", + "description": "Used in npm for command line application support", + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cmd-shim.git" + }, + "license": "ISC", + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.1", + "tap": "^16.0.1" + }, + "files": [ + "bin/", + "lib/" + ], + "main": "lib/index.js", + "tap": { + "before": "test/00-setup.js", + "after": "test/zz-cleanup.js", + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.1", + "publish": true + } +} diff --git a/node_modules/npm/node_modules/color-convert/LICENSE b/node_modules/npm/node_modules/color-convert/LICENSE new file mode 100644 index 00000000..5b4c386f --- /dev/null +++ b/node_modules/npm/node_modules/color-convert/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2011-2016 Heather Arthur + +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/npm/node_modules/color-convert/conversions.js b/node_modules/npm/node_modules/color-convert/conversions.js new file mode 100644 index 00000000..2657f265 --- /dev/null +++ b/node_modules/npm/node_modules/color-convert/conversions.js @@ -0,0 +1,839 @@ +/* MIT license */ +/* eslint-disable no-mixed-operators */ +const cssKeywords = require('color-name'); + +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) + +const reverseKeywords = {}; +for (const key of Object.keys(cssKeywords)) { + reverseKeywords[cssKeywords[key]] = key; +} + +const convert = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} +}; + +module.exports = convert; + +// Hide .channels and .labels properties +for (const model of Object.keys(convert)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } + + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } + + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } + + const {channels, labels} = convert[model]; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); +} + +convert.rgb.hsl = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const delta = max - min; + let h; + let s; + + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } + + h = Math.min(h * 60, 360); + + if (h < 0) { + h += 360; + } + + const l = (min + max) / 2; + + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } + + return [h, s * 100, l * 100]; +}; + +convert.rgb.hsv = function (rgb) { + let rdif; + let gdif; + let bdif; + let h; + let s; + + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const v = Math.max(r, g, b); + const diff = v - Math.min(r, g, b); + const diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; + + if (diff === 0) { + h = 0; + s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } + + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } + + return [ + h * 360, + s * 100, + v * 100 + ]; +}; + +convert.rgb.hwb = function (rgb) { + const r = rgb[0]; + const g = rgb[1]; + let b = rgb[2]; + const h = convert.rgb.hsl(rgb)[0]; + const w = 1 / 255 * Math.min(r, Math.min(g, b)); + + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); + + return [h, w * 100, b * 100]; +}; + +convert.rgb.cmyk = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + + const k = Math.min(1 - r, 1 - g, 1 - b); + const c = (1 - r - k) / (1 - k) || 0; + const m = (1 - g - k) / (1 - k) || 0; + const y = (1 - b - k) / (1 - k) || 0; + + return [c * 100, m * 100, y * 100, k * 100]; +}; + +function comparativeDistance(x, y) { + /* + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + */ + return ( + ((x[0] - y[0]) ** 2) + + ((x[1] - y[1]) ** 2) + + ((x[2] - y[2]) ** 2) + ); +} + +convert.rgb.keyword = function (rgb) { + const reversed = reverseKeywords[rgb]; + if (reversed) { + return reversed; + } + + let currentClosestDistance = Infinity; + let currentClosestKeyword; + + for (const keyword of Object.keys(cssKeywords)) { + const value = cssKeywords[keyword]; + + // Compute comparative distance + const distance = comparativeDistance(rgb, value); + + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + + return currentClosestKeyword; +}; + +convert.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; +}; + +convert.rgb.xyz = function (rgb) { + let r = rgb[0] / 255; + let g = rgb[1] / 255; + let b = rgb[2] / 255; + + // Assume sRGB + r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); + g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); + b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); + + const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + + return [x * 100, y * 100, z * 100]; +}; + +convert.rgb.lab = function (rgb) { + const xyz = convert.rgb.xyz(rgb); + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + return [l, a, b]; +}; + +convert.hsl.rgb = function (hsl) { + const h = hsl[0] / 360; + const s = hsl[1] / 100; + const l = hsl[2] / 100; + let t2; + let t3; + let val; + + if (s === 0) { + val = l * 255; + return [val, val, val]; + } + + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } + + const t1 = 2 * l - t2; + + const rgb = [0, 0, 0]; + for (let i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; + } + + if (t3 > 1) { + t3--; + } + + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } + + rgb[i] = val * 255; + } + + return rgb; +}; + +convert.hsl.hsv = function (hsl) { + const h = hsl[0]; + let s = hsl[1] / 100; + let l = hsl[2] / 100; + let smin = s; + const lmin = Math.max(l, 0.01); + + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + const v = (l + s) / 2; + const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); + + return [h, sv * 100, v * 100]; +}; + +convert.hsv.rgb = function (hsv) { + const h = hsv[0] / 60; + const s = hsv[1] / 100; + let v = hsv[2] / 100; + const hi = Math.floor(h) % 6; + + const f = h - Math.floor(h); + const p = 255 * v * (1 - s); + const q = 255 * v * (1 - (s * f)); + const t = 255 * v * (1 - (s * (1 - f))); + v *= 255; + + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +}; + +convert.hsv.hsl = function (hsv) { + const h = hsv[0]; + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const vmin = Math.max(v, 0.01); + let sl; + let l; + + l = (2 - s) * v; + const lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; + + return [h, sl * 100, l * 100]; +}; + +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert.hwb.rgb = function (hwb) { + const h = hwb[0] / 360; + let wh = hwb[1] / 100; + let bl = hwb[2] / 100; + const ratio = wh + bl; + let f; + + // Wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } + + const i = Math.floor(6 * h); + const v = 1 - bl; + f = 6 * h - i; + + if ((i & 0x01) !== 0) { + f = 1 - f; + } + + const n = wh + f * (v - wh); // Linear interpolation + + let r; + let g; + let b; + /* eslint-disable max-statements-per-line,no-multi-spaces */ + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } + /* eslint-enable max-statements-per-line,no-multi-spaces */ + + return [r * 255, g * 255, b * 255]; +}; + +convert.cmyk.rgb = function (cmyk) { + const c = cmyk[0] / 100; + const m = cmyk[1] / 100; + const y = cmyk[2] / 100; + const k = cmyk[3] / 100; + + const r = 1 - Math.min(1, c * (1 - k) + k); + const g = 1 - Math.min(1, m * (1 - k) + k); + const b = 1 - Math.min(1, y * (1 - k) + k); + + return [r * 255, g * 255, b * 255]; +}; + +convert.xyz.rgb = function (xyz) { + const x = xyz[0] / 100; + const y = xyz[1] / 100; + const z = xyz[2] / 100; + let r; + let g; + let b; + + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); + + // Assume sRGB + r = r > 0.0031308 + ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) + : r * 12.92; + + g = g > 0.0031308 + ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) + : g * 12.92; + + b = b > 0.0031308 + ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) + : b * 12.92; + + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + + return [r * 255, g * 255, b * 255]; +}; + +convert.xyz.lab = function (xyz) { + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + return [l, a, b]; +}; + +convert.lab.xyz = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let x; + let y; + let z; + + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; + + const y2 = y ** 3; + const x2 = x ** 3; + const z2 = z ** 3; + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; + + x *= 95.047; + y *= 100; + z *= 108.883; + + return [x, y, z]; +}; + +convert.lab.lch = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let h; + + const hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; + + if (h < 0) { + h += 360; + } + + const c = Math.sqrt(a * a + b * b); + + return [l, c, h]; +}; + +convert.lch.lab = function (lch) { + const l = lch[0]; + const c = lch[1]; + const h = lch[2]; + + const hr = h / 360 * 2 * Math.PI; + const a = c * Math.cos(hr); + const b = c * Math.sin(hr); + + return [l, a, b]; +}; + +convert.rgb.ansi16 = function (args, saturation = null) { + const [r, g, b] = args; + let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization + + value = Math.round(value / 50); + + if (value === 0) { + return 30; + } + + let ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); + + if (value === 2) { + ansi += 60; + } + + return ansi; +}; + +convert.hsv.ansi16 = function (args) { + // Optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); +}; + +convert.rgb.ansi256 = function (args) { + const r = args[0]; + const g = args[1]; + const b = args[2]; + + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } + + if (r > 248) { + return 231; + } + + return Math.round(((r - 8) / 247) * 24) + 232; + } + + const ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); + + return ansi; +}; + +convert.ansi16.rgb = function (args) { + let color = args % 10; + + // Handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } + + color = color / 10.5 * 255; + + return [color, color, color]; + } + + const mult = (~~(args > 50) + 1) * 0.5; + const r = ((color & 1) * mult) * 255; + const g = (((color >> 1) & 1) * mult) * 255; + const b = (((color >> 2) & 1) * mult) * 255; + + return [r, g, b]; +}; + +convert.ansi256.rgb = function (args) { + // Handle greyscale + if (args >= 232) { + const c = (args - 232) * 10 + 8; + return [c, c, c]; + } + + args -= 16; + + let rem; + const r = Math.floor(args / 36) / 5 * 255; + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; + const b = (rem % 6) / 5 * 255; + + return [r, g, b]; +}; + +convert.rgb.hex = function (args) { + const integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); + + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert.hex.rgb = function (args) { + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } + + let colorString = match[0]; + + if (match[0].length === 3) { + colorString = colorString.split('').map(char => { + return char + char; + }).join(''); + } + + const integer = parseInt(colorString, 16); + const r = (integer >> 16) & 0xFF; + const g = (integer >> 8) & 0xFF; + const b = integer & 0xFF; + + return [r, g, b]; +}; + +convert.rgb.hcg = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const max = Math.max(Math.max(r, g), b); + const min = Math.min(Math.min(r, g), b); + const chroma = (max - min); + let grayscale; + let hue; + + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } + + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma; + } + + hue /= 6; + hue %= 1; + + return [hue * 360, chroma * 100, grayscale * 100]; +}; + +convert.hsl.hcg = function (hsl) { + const s = hsl[1] / 100; + const l = hsl[2] / 100; + + const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); + + let f = 0; + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } + + return [hsl[0], c * 100, f * 100]; +}; + +convert.hsv.hcg = function (hsv) { + const s = hsv[1] / 100; + const v = hsv[2] / 100; + + const c = s * v; + let f = 0; + + if (c < 1.0) { + f = (v - c) / (1 - c); + } + + return [hsv[0], c * 100, f * 100]; +}; + +convert.hcg.rgb = function (hcg) { + const h = hcg[0] / 360; + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } + + const pure = [0, 0, 0]; + const hi = (h % 1) * 6; + const v = hi % 1; + const w = 1 - v; + let mg = 0; + + /* eslint-disable max-statements-per-line */ + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; + } + /* eslint-enable max-statements-per-line */ + + mg = (1.0 - c) * g; + + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; +}; + +convert.hcg.hsv = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + const v = c + g * (1.0 - c); + let f = 0; + + if (v > 0.0) { + f = c / v; + } + + return [hcg[0], f * 100, v * 100]; +}; + +convert.hcg.hsl = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + const l = g * (1.0 - c) + 0.5 * c; + let s = 0; + + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } + + return [hcg[0], s * 100, l * 100]; +}; + +convert.hcg.hwb = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; + +convert.hwb.hcg = function (hwb) { + const w = hwb[1] / 100; + const b = hwb[2] / 100; + const v = 1 - b; + const c = v - w; + let g = 0; + + if (c < 1) { + g = (v - c) / (1 - c); + } + + return [hwb[0], c * 100, g * 100]; +}; + +convert.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +}; + +convert.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; + +convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; + +convert.gray.hsl = function (args) { + return [0, 0, args[0]]; +}; + +convert.gray.hsv = convert.gray.hsl; + +convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; + +convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; + +convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; +}; + +convert.gray.hex = function (gray) { + const val = Math.round(gray[0] / 100 * 255) & 0xFF; + const integer = (val << 16) + (val << 8) + val; + + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert.rgb.gray = function (rgb) { + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; diff --git a/node_modules/npm/node_modules/color-convert/index.js b/node_modules/npm/node_modules/color-convert/index.js new file mode 100644 index 00000000..b648e573 --- /dev/null +++ b/node_modules/npm/node_modules/color-convert/index.js @@ -0,0 +1,81 @@ +const conversions = require('./conversions'); +const route = require('./route'); + +const convert = {}; + +const models = Object.keys(conversions); + +function wrapRaw(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + return fn(args); + }; + + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +function wrapRounded(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + const result = fn(args); + + // We're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (let len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } + + return result; + }; + + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +models.forEach(fromModel => { + convert[fromModel] = {}; + + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); + + const routes = route(fromModel); + const routeModels = Object.keys(routes); + + routeModels.forEach(toModel => { + const fn = routes[toModel]; + + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); +}); + +module.exports = convert; diff --git a/node_modules/npm/node_modules/color-convert/package.json b/node_modules/npm/node_modules/color-convert/package.json new file mode 100644 index 00000000..6e48000c --- /dev/null +++ b/node_modules/npm/node_modules/color-convert/package.json @@ -0,0 +1,48 @@ +{ + "name": "color-convert", + "description": "Plain color conversion functions", + "version": "2.0.1", + "author": "Heather Arthur ", + "license": "MIT", + "repository": "Qix-/color-convert", + "scripts": { + "pretest": "xo", + "test": "node test/basic.js" + }, + "engines": { + "node": ">=7.0.0" + }, + "keywords": [ + "color", + "colour", + "convert", + "converter", + "conversion", + "rgb", + "hsl", + "hsv", + "hwb", + "cmyk", + "ansi", + "ansi16" + ], + "files": [ + "index.js", + "conversions.js", + "route.js" + ], + "xo": { + "rules": { + "default-case": 0, + "no-inline-comments": 0, + "operator-linebreak": 0 + } + }, + "devDependencies": { + "chalk": "^2.4.2", + "xo": "^0.24.0" + }, + "dependencies": { + "color-name": "~1.1.4" + } +} diff --git a/node_modules/npm/node_modules/color-convert/route.js b/node_modules/npm/node_modules/color-convert/route.js new file mode 100644 index 00000000..1a08521b --- /dev/null +++ b/node_modules/npm/node_modules/color-convert/route.js @@ -0,0 +1,97 @@ +const conversions = require('./conversions'); + +/* + This function routes a model to all other models. + + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). + + conversions that are not possible simply are not included. +*/ + +function buildGraph() { + const graph = {}; + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + const models = Object.keys(conversions); + + for (let len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } + + return graph; +} + +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS(fromModel) { + const graph = buildGraph(); + const queue = [fromModel]; // Unshift -> queue -> pop + + graph[fromModel].distance = 0; + + while (queue.length) { + const current = queue.pop(); + const adjacents = Object.keys(conversions[current]); + + for (let len = adjacents.length, i = 0; i < len; i++) { + const adjacent = adjacents[i]; + const node = graph[adjacent]; + + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } + + return graph; +} + +function link(from, to) { + return function (args) { + return to(from(args)); + }; +} + +function wrapConversion(toModel, graph) { + const path = [graph[toModel].parent, toModel]; + let fn = conversions[graph[toModel].parent][toModel]; + + let cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } + + fn.conversion = path; + return fn; +} + +module.exports = function (fromModel) { + const graph = deriveBFS(fromModel); + const conversion = {}; + + const models = Object.keys(graph); + for (let len = models.length, i = 0; i < len; i++) { + const toModel = models[i]; + const node = graph[toModel]; + + if (node.parent === null) { + // No possible conversion, or this node is the source model. + continue; + } + + conversion[toModel] = wrapConversion(toModel, graph); + } + + return conversion; +}; + diff --git a/node_modules/npm/node_modules/color-name/LICENSE b/node_modules/npm/node_modules/color-name/LICENSE new file mode 100644 index 00000000..c6b10012 --- /dev/null +++ b/node_modules/npm/node_modules/color-name/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2015 Dmitry Ivanov + +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. \ No newline at end of file diff --git a/node_modules/npm/node_modules/color-name/index.js b/node_modules/npm/node_modules/color-name/index.js new file mode 100644 index 00000000..b7c198a6 --- /dev/null +++ b/node_modules/npm/node_modules/color-name/index.js @@ -0,0 +1,152 @@ +'use strict' + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; diff --git a/node_modules/npm/node_modules/color-name/package.json b/node_modules/npm/node_modules/color-name/package.json new file mode 100644 index 00000000..782dd828 --- /dev/null +++ b/node_modules/npm/node_modules/color-name/package.json @@ -0,0 +1,28 @@ +{ + "name": "color-name", + "version": "1.1.4", + "description": "A list of color names and its values", + "main": "index.js", + "files": [ + "index.js" + ], + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "git@github.com:colorjs/color-name.git" + }, + "keywords": [ + "color-name", + "color", + "color-keyword", + "keyword" + ], + "author": "DY ", + "license": "MIT", + "bugs": { + "url": "https://github.com/colorjs/color-name/issues" + }, + "homepage": "https://github.com/colorjs/color-name" +} diff --git a/node_modules/npm/node_modules/common-ancestor-path/LICENSE b/node_modules/npm/node_modules/common-ancestor-path/LICENSE new file mode 100644 index 00000000..05eeeb88 --- /dev/null +++ b/node_modules/npm/node_modules/common-ancestor-path/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/common-ancestor-path/index.js b/node_modules/npm/node_modules/common-ancestor-path/index.js new file mode 100644 index 00000000..09ae3178 --- /dev/null +++ b/node_modules/npm/node_modules/common-ancestor-path/index.js @@ -0,0 +1,17 @@ +const {parse, sep, normalize: norm} = require('path') + +function* commonArrayMembers (a, b) { + const [l, s] = a.length > b.length ? [a, b] : [b, a] + for (const x of s) { + if (x === l.shift()) + yield x + else + break + } +} + +const commonAncestorPath = (a, b) => a === b ? a + : parse(a).root !== parse(b).root ? null + : [...commonArrayMembers(norm(a).split(sep), norm(b).split(sep))].join(sep) + +module.exports = (...paths) => paths.reduce(commonAncestorPath) diff --git a/node_modules/npm/node_modules/common-ancestor-path/package.json b/node_modules/npm/node_modules/common-ancestor-path/package.json new file mode 100644 index 00000000..4375d1d0 --- /dev/null +++ b/node_modules/npm/node_modules/common-ancestor-path/package.json @@ -0,0 +1,28 @@ +{ + "name": "common-ancestor-path", + "version": "1.0.1", + "files": [ + "index.js" + ], + "description": "Find the common ancestor of 2 or more paths on Windows or Unix", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/common-ancestor-path" + }, + "author": "Isaac Z. Schlueter (https://izs.me)", + "license": "ISC", + "scripts": { + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "tap": { + "check-coverage": true + }, + "devDependencies": { + "require-inject": "^1.4.4", + "tap": "^14.10.7" + } +} diff --git a/node_modules/npm/node_modules/cross-spawn/LICENSE b/node_modules/npm/node_modules/cross-spawn/LICENSE new file mode 100644 index 00000000..8407b9a3 --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Made With MOXY Lda + +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/npm/node_modules/cross-spawn/index.js b/node_modules/npm/node_modules/cross-spawn/index.js new file mode 100644 index 00000000..5509742c --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/index.js @@ -0,0 +1,39 @@ +'use strict'; + +const cp = require('child_process'); +const parse = require('./lib/parse'); +const enoent = require('./lib/enoent'); + +function spawn(command, args, options) { + // Parse the arguments + const parsed = parse(command, args, options); + + // Spawn the child process + const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); + + // Hook into child process "exit" event to emit an error if the command + // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 + enoent.hookChildProcess(spawned, parsed); + + return spawned; +} + +function spawnSync(command, args, options) { + // Parse the arguments + const parsed = parse(command, args, options); + + // Spawn the child process + const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); + + // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 + result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); + + return result; +} + +module.exports = spawn; +module.exports.spawn = spawn; +module.exports.sync = spawnSync; + +module.exports._parse = parse; +module.exports._enoent = enoent; diff --git a/node_modules/npm/node_modules/cross-spawn/lib/enoent.js b/node_modules/npm/node_modules/cross-spawn/lib/enoent.js new file mode 100644 index 00000000..da334713 --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/lib/enoent.js @@ -0,0 +1,59 @@ +'use strict'; + +const isWin = process.platform === 'win32'; + +function notFoundError(original, syscall) { + return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { + code: 'ENOENT', + errno: 'ENOENT', + syscall: `${syscall} ${original.command}`, + path: original.command, + spawnargs: original.args, + }); +} + +function hookChildProcess(cp, parsed) { + if (!isWin) { + return; + } + + const originalEmit = cp.emit; + + cp.emit = function (name, arg1) { + // If emitting "exit" event and exit code is 1, we need to check if + // the command exists and emit an "error" instead + // See https://github.com/IndigoUnited/node-cross-spawn/issues/16 + if (name === 'exit') { + const err = verifyENOENT(arg1, parsed); + + if (err) { + return originalEmit.call(cp, 'error', err); + } + } + + return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params + }; +} + +function verifyENOENT(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, 'spawn'); + } + + return null; +} + +function verifyENOENTSync(status, parsed) { + if (isWin && status === 1 && !parsed.file) { + return notFoundError(parsed.original, 'spawnSync'); + } + + return null; +} + +module.exports = { + hookChildProcess, + verifyENOENT, + verifyENOENTSync, + notFoundError, +}; diff --git a/node_modules/npm/node_modules/cross-spawn/lib/parse.js b/node_modules/npm/node_modules/cross-spawn/lib/parse.js new file mode 100644 index 00000000..0129d747 --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/lib/parse.js @@ -0,0 +1,91 @@ +'use strict'; + +const path = require('path'); +const resolveCommand = require('./util/resolveCommand'); +const escape = require('./util/escape'); +const readShebang = require('./util/readShebang'); + +const isWin = process.platform === 'win32'; +const isExecutableRegExp = /\.(?:com|exe)$/i; +const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; + +function detectShebang(parsed) { + parsed.file = resolveCommand(parsed); + + const shebang = parsed.file && readShebang(parsed.file); + + if (shebang) { + parsed.args.unshift(parsed.file); + parsed.command = shebang; + + return resolveCommand(parsed); + } + + return parsed.file; +} + +function parseNonShell(parsed) { + if (!isWin) { + return parsed; + } + + // Detect & add support for shebangs + const commandFile = detectShebang(parsed); + + // We don't need a shell if the command filename is an executable + const needsShell = !isExecutableRegExp.test(commandFile); + + // If a shell is required, use cmd.exe and take care of escaping everything correctly + // Note that `forceShell` is an hidden option used only in tests + if (parsed.options.forceShell || needsShell) { + // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/` + // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument + // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called, + // we need to double escape them + const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); + + // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar) + // This is necessary otherwise it will always fail with ENOENT in those cases + parsed.command = path.normalize(parsed.command); + + // Escape command & arguments + parsed.command = escape.command(parsed.command); + parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars)); + + const shellCommand = [parsed.command].concat(parsed.args).join(' '); + + parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; + parsed.command = process.env.comspec || 'cmd.exe'; + parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped + } + + return parsed; +} + +function parse(command, args, options) { + // Normalize arguments, similar to nodejs + if (args && !Array.isArray(args)) { + options = args; + args = null; + } + + args = args ? args.slice(0) : []; // Clone array to avoid changing the original + options = Object.assign({}, options); // Clone object to avoid changing the original + + // Build our parsed object + const parsed = { + command, + args, + options, + file: undefined, + original: { + command, + args, + }, + }; + + // Delegate further parsing to shell or non-shell + return options.shell ? parsed : parseNonShell(parsed); +} + +module.exports = parse; diff --git a/node_modules/npm/node_modules/cross-spawn/lib/util/escape.js b/node_modules/npm/node_modules/cross-spawn/lib/util/escape.js new file mode 100644 index 00000000..7bf2905c --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/lib/util/escape.js @@ -0,0 +1,47 @@ +'use strict'; + +// See http://www.robvanderwoude.com/escapechars.php +const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; + +function escapeCommand(arg) { + // Escape meta chars + arg = arg.replace(metaCharsRegExp, '^$1'); + + return arg; +} + +function escapeArgument(arg, doubleEscapeMetaChars) { + // Convert to string + arg = `${arg}`; + + // Algorithm below is based on https://qntm.org/cmd + // It's slightly altered to disable JS backtracking to avoid hanging on specially crafted input + // Please see https://github.com/moxystudio/node-cross-spawn/pull/160 for more information + + // Sequence of backslashes followed by a double quote: + // double up all the backslashes and escape the double quote + arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"'); + + // Sequence of backslashes followed by the end of the string + // (which will become a double quote later): + // double up all the backslashes + arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1'); + + // All other backslashes occur literally + + // Quote the whole thing: + arg = `"${arg}"`; + + // Escape meta chars + arg = arg.replace(metaCharsRegExp, '^$1'); + + // Double escape meta chars if necessary + if (doubleEscapeMetaChars) { + arg = arg.replace(metaCharsRegExp, '^$1'); + } + + return arg; +} + +module.exports.command = escapeCommand; +module.exports.argument = escapeArgument; diff --git a/node_modules/npm/node_modules/cross-spawn/lib/util/readShebang.js b/node_modules/npm/node_modules/cross-spawn/lib/util/readShebang.js new file mode 100644 index 00000000..5e83733f --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/lib/util/readShebang.js @@ -0,0 +1,23 @@ +'use strict'; + +const fs = require('fs'); +const shebangCommand = require('shebang-command'); + +function readShebang(command) { + // Read the first 150 bytes from the file + const size = 150; + const buffer = Buffer.alloc(size); + + let fd; + + try { + fd = fs.openSync(command, 'r'); + fs.readSync(fd, buffer, 0, size, 0); + fs.closeSync(fd); + } catch (e) { /* Empty */ } + + // Attempt to extract shebang (null is returned if not a shebang) + return shebangCommand(buffer.toString()); +} + +module.exports = readShebang; diff --git a/node_modules/npm/node_modules/cross-spawn/lib/util/resolveCommand.js b/node_modules/npm/node_modules/cross-spawn/lib/util/resolveCommand.js new file mode 100644 index 00000000..79724550 --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/lib/util/resolveCommand.js @@ -0,0 +1,52 @@ +'use strict'; + +const path = require('path'); +const which = require('which'); +const getPathKey = require('path-key'); + +function resolveCommandAttempt(parsed, withoutPathExt) { + const env = parsed.options.env || process.env; + const cwd = process.cwd(); + const hasCustomCwd = parsed.options.cwd != null; + // Worker threads do not have process.chdir() + const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled; + + // If a custom `cwd` was specified, we need to change the process cwd + // because `which` will do stat calls but does not support a custom cwd + if (shouldSwitchCwd) { + try { + process.chdir(parsed.options.cwd); + } catch (err) { + /* Empty */ + } + } + + let resolved; + + try { + resolved = which.sync(parsed.command, { + path: env[getPathKey({ env })], + pathExt: withoutPathExt ? path.delimiter : undefined, + }); + } catch (e) { + /* Empty */ + } finally { + if (shouldSwitchCwd) { + process.chdir(cwd); + } + } + + // If we successfully resolved, ensure that an absolute path is returned + // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it + if (resolved) { + resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved); + } + + return resolved; +} + +function resolveCommand(parsed) { + return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true); +} + +module.exports = resolveCommand; diff --git a/node_modules/npm/node_modules/cross-spawn/node_modules/which/LICENSE b/node_modules/npm/node_modules/cross-spawn/node_modules/which/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/node_modules/which/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/cross-spawn/node_modules/which/README.md b/node_modules/npm/node_modules/cross-spawn/node_modules/which/README.md new file mode 100644 index 00000000..cd833509 --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/node_modules/which/README.md @@ -0,0 +1,54 @@ +# which + +Like the unix `which` utility. + +Finds the first instance of a specified executable in the PATH +environment variable. Does not cache the results, so `hash -r` is not +needed when the PATH changes. + +## USAGE + +```javascript +var which = require('which') + +// async usage +which('node', function (er, resolvedPath) { + // er is returned if no "node" is found on the PATH + // if it is found, then the absolute path to the exec is returned +}) + +// or promise +which('node').then(resolvedPath => { ... }).catch(er => { ... not found ... }) + +// sync usage +// throws if not found +var resolved = which.sync('node') + +// if nothrow option is used, returns null if not found +resolved = which.sync('node', {nothrow: true}) + +// Pass options to override the PATH and PATHEXT environment vars. +which('node', { path: someOtherPath }, function (er, resolved) { + if (er) + throw er + console.log('found at %j', resolved) +}) +``` + +## CLI USAGE + +Same as the BSD `which(1)` binary. + +``` +usage: which [-as] program ... +``` + +## OPTIONS + +You may pass an options object as the second argument. + +- `path`: Use instead of the `PATH` environment variable. +- `pathExt`: Use instead of the `PATHEXT` environment variable. +- `all`: Return all matches, instead of just the first one. Note that + this means the function returns an array of strings instead of a + single string. diff --git a/node_modules/npm/node_modules/cross-spawn/node_modules/which/bin/node-which b/node_modules/npm/node_modules/cross-spawn/node_modules/which/bin/node-which new file mode 100755 index 00000000..7cee3729 --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/node_modules/which/bin/node-which @@ -0,0 +1,52 @@ +#!/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/npm/node_modules/cross-spawn/node_modules/which/package.json b/node_modules/npm/node_modules/cross-spawn/node_modules/which/package.json new file mode 100644 index 00000000..97ad7fba --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/node_modules/which/package.json @@ -0,0 +1,43 @@ +{ + "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/npm/node_modules/cross-spawn/node_modules/which/which.js b/node_modules/npm/node_modules/cross-spawn/node_modules/which/which.js new file mode 100644 index 00000000..82afffd2 --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/node_modules/which/which.js @@ -0,0 +1,125 @@ +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/npm/node_modules/cross-spawn/package.json b/node_modules/npm/node_modules/cross-spawn/package.json new file mode 100644 index 00000000..24b2eb4c --- /dev/null +++ b/node_modules/npm/node_modules/cross-spawn/package.json @@ -0,0 +1,73 @@ +{ + "name": "cross-spawn", + "version": "7.0.6", + "description": "Cross platform child_process#spawn and child_process#spawnSync", + "keywords": [ + "spawn", + "spawnSync", + "windows", + "cross-platform", + "path-ext", + "shebang", + "cmd", + "execute" + ], + "author": "André Cruz ", + "homepage": "https://github.com/moxystudio/node-cross-spawn", + "repository": { + "type": "git", + "url": "git@github.com:moxystudio/node-cross-spawn.git" + }, + "license": "MIT", + "main": "index.js", + "files": [ + "lib" + ], + "scripts": { + "lint": "eslint .", + "test": "jest --env node --coverage", + "prerelease": "npm t && npm run lint", + "release": "standard-version", + "postrelease": "git push --follow-tags origin HEAD && npm publish" + }, + "husky": { + "hooks": { + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS", + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.js": [ + "eslint --fix", + "git add" + ] + }, + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + }, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "devDependencies": { + "@commitlint/cli": "^8.1.0", + "@commitlint/config-conventional": "^8.1.0", + "babel-core": "^6.26.3", + "babel-jest": "^24.9.0", + "babel-preset-moxy": "^3.1.0", + "eslint": "^5.16.0", + "eslint-config-moxy": "^7.1.0", + "husky": "^3.0.5", + "jest": "^24.9.0", + "lint-staged": "^9.2.5", + "mkdirp": "^0.5.1", + "rimraf": "^3.0.0", + "standard-version": "^9.5.0" + }, + "engines": { + "node": ">= 8" + } +} diff --git a/node_modules/npm/node_modules/cssesc/LICENSE-MIT.txt b/node_modules/npm/node_modules/cssesc/LICENSE-MIT.txt new file mode 100644 index 00000000..a41e0a7e --- /dev/null +++ b/node_modules/npm/node_modules/cssesc/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +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/npm/node_modules/cssesc/README.md b/node_modules/npm/node_modules/cssesc/README.md new file mode 100644 index 00000000..58fb8fe0 --- /dev/null +++ b/node_modules/npm/node_modules/cssesc/README.md @@ -0,0 +1,201 @@ +# cssesc [![Build status](https://travis-ci.org/mathiasbynens/cssesc.svg?branch=master)](https://travis-ci.org/mathiasbynens/cssesc) [![Code coverage status](https://img.shields.io/codecov/c/github/mathiasbynens/cssesc.svg)](https://codecov.io/gh/mathiasbynens/cssesc) + +A JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output. + +This is a JavaScript library for [escaping text for use in CSS strings or identifiers](https://mathiasbynens.be/notes/css-escapes) while generating the shortest possible valid ASCII-only output. [Here’s an online demo.](https://mothereff.in/css-escapes) + +[A polyfill for the CSSOM `CSS.escape()` method is available in a separate repository.](https://mths.be/cssescape) (In comparison, _cssesc_ is much more powerful.) + +Feel free to fork if you see possible improvements! + +## Installation + +Via [npm](https://www.npmjs.com/): + +```bash +npm install cssesc +``` + +In a browser: + +```html + +``` + +In [Node.js](https://nodejs.org/): + +```js +const cssesc = require('cssesc'); +``` + +In Ruby using [the `ruby-cssesc` wrapper gem](https://github.com/borodean/ruby-cssesc): + +```bash +gem install ruby-cssesc +``` + +```ruby +require 'ruby-cssesc' +CSSEsc.escape('I ♥ Ruby', is_identifier: true) +``` + +In Sass using [`sassy-escape`](https://github.com/borodean/sassy-escape): + +```bash +gem install sassy-escape +``` + +```scss +body { + content: escape('I ♥ Sass', $is-identifier: true); +} +``` + +## API + +### `cssesc(value, options)` + +This function takes a value and returns an escaped version of the value where any characters that are not printable ASCII symbols are escaped using the shortest possible (but valid) [escape sequences for use in CSS strings or identifiers](https://mathiasbynens.be/notes/css-escapes). + +```js +cssesc('Ich ♥ Bücher'); +// → 'Ich \\2665 B\\FC cher' + +cssesc('foo 𝌆 bar'); +// → 'foo \\1D306 bar' +``` + +By default, `cssesc` returns a string that can be used as part of a CSS string. If the target is a CSS identifier rather than a CSS string, use the `isIdentifier: true` setting (see below). + +The optional `options` argument accepts an object with the following options: + +#### `isIdentifier` + +The default value for the `isIdentifier` option is `false`. This means that the input text will be escaped for use in a CSS string literal. If you want to use the result as a CSS identifier instead (in a selector, for example), set this option to `true`. + +```js +cssesc('123a2b'); +// → '123a2b' + +cssesc('123a2b', { + 'isIdentifier': true +}); +// → '\\31 23a2b' +``` + +#### `quotes` + +The default value for the `quotes` option is `'single'`. This means that any occurences of `'` in the input text will be escaped as `\'`, so that the output can be used in a CSS string literal wrapped in single quotes. + +```js +cssesc('Lorem ipsum "dolor" sit \'amet\' etc.'); +// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.' +// → "Lorem ipsum \"dolor\" sit \\'amet\\' etc." + +cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { + 'quotes': 'single' +}); +// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.' +// → "Lorem ipsum \"dolor\" sit \\'amet\\' etc." +``` + +If you want to use the output as part of a CSS string literal wrapped in double quotes, set the `quotes` option to `'double'`. + +```js +cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { + 'quotes': 'double' +}); +// → 'Lorem ipsum \\"dolor\\" sit \'amet\' etc.' +// → "Lorem ipsum \\\"dolor\\\" sit 'amet' etc." +``` + +#### `wrap` + +The `wrap` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output will be a valid CSS string literal wrapped in quotes. The type of quotes can be specified through the `quotes` setting. + +```js +cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { + 'quotes': 'single', + 'wrap': true +}); +// → '\'Lorem ipsum "dolor" sit \\\'amet\\\' etc.\'' +// → "\'Lorem ipsum \"dolor\" sit \\\'amet\\\' etc.\'" + +cssesc('Lorem ipsum "dolor" sit \'amet\' etc.', { + 'quotes': 'double', + 'wrap': true +}); +// → '"Lorem ipsum \\"dolor\\" sit \'amet\' etc."' +// → "\"Lorem ipsum \\\"dolor\\\" sit \'amet\' etc.\"" +``` + +#### `escapeEverything` + +The `escapeEverything` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, all the symbols in the output will be escaped, even printable ASCII symbols. + +```js +cssesc('lolwat"foo\'bar', { + 'escapeEverything': true +}); +// → '\\6C\\6F\\6C\\77\\61\\74\\"\\66\\6F\\6F\\\'\\62\\61\\72' +// → "\\6C\\6F\\6C\\77\\61\\74\\\"\\66\\6F\\6F\\'\\62\\61\\72" +``` + +#### Overriding the default options globally + +The global default settings can be overridden by modifying the `css.options` object. This saves you from passing in an `options` object for every call to `encode` if you want to use the non-default setting. + +```js +// Read the global default setting for `escapeEverything`: +cssesc.options.escapeEverything; +// → `false` by default + +// Override the global default setting for `escapeEverything`: +cssesc.options.escapeEverything = true; + +// Using the global default setting for `escapeEverything`, which is now `true`: +cssesc('foo © bar ≠ baz 𝌆 qux'); +// → '\\66\\6F\\6F\\ \\A9\\ \\62\\61\\72\\ \\2260\\ \\62\\61\\7A\\ \\1D306\\ \\71\\75\\78' +``` + +### `cssesc.version` + +A string representing the semantic version number. + +### Using the `cssesc` binary + +To use the `cssesc` binary in your shell, simply install cssesc globally using npm: + +```bash +npm install -g cssesc +``` + +After that you will be able to escape text for use in CSS strings or identifiers from the command line: + +```bash +$ cssesc 'föo ♥ bår 𝌆 baz' +f\F6o \2665 b\E5r \1D306 baz +``` + +If the output needs to be a CSS identifier rather than part of a string literal, use the `-i`/`--identifier` option: + +```bash +$ cssesc --identifier 'föo ♥ bår 𝌆 baz' +f\F6o\ \2665\ b\E5r\ \1D306\ baz +``` + +See `cssesc --help` for the full list of options. + +## Support + +This library supports the Node.js and browser versions mentioned in [`.babelrc`](https://github.com/mathiasbynens/cssesc/blob/master/.babelrc). For a version that supports a wider variety of legacy browsers and environments out-of-the-box, [see v0.1.0](https://github.com/mathiasbynens/cssesc/releases/tag/v0.1.0). + +## Author + +| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](https://mathiasbynens.be/) | + +## License + +This library is available under the [MIT](https://mths.be/mit) license. diff --git a/node_modules/npm/node_modules/cssesc/bin/cssesc b/node_modules/npm/node_modules/cssesc/bin/cssesc new file mode 100755 index 00000000..188c034f --- /dev/null +++ b/node_modules/npm/node_modules/cssesc/bin/cssesc @@ -0,0 +1,116 @@ +#!/usr/bin/env node +const fs = require('fs'); +const cssesc = require('../cssesc.js'); +const strings = process.argv.splice(2); +const stdin = process.stdin; +const options = {}; +const log = console.log; + +const main = function() { + const option = strings[0]; + + if (/^(?:-h|--help|undefined)$/.test(option)) { + log( + 'cssesc v%s - https://mths.be/cssesc', + cssesc.version + ); + log([ + '\nUsage:\n', + '\tcssesc [string]', + '\tcssesc [-i | --identifier] [string]', + '\tcssesc [-s | --single-quotes] [string]', + '\tcssesc [-d | --double-quotes] [string]', + '\tcssesc [-w | --wrap] [string]', + '\tcssesc [-e | --escape-everything] [string]', + '\tcssesc [-v | --version]', + '\tcssesc [-h | --help]', + '\nExamples:\n', + '\tcssesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', + '\tcssesc --identifier \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', + '\tcssesc --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', + '\tcssesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'', + '\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | cssesc' + ].join('\n')); + return process.exit(1); + } + + if (/^(?:-v|--version)$/.test(option)) { + log('v%s', cssesc.version); + return process.exit(1); + } + + strings.forEach(function(string) { + // Process options + if (/^(?:-i|--identifier)$/.test(string)) { + options.isIdentifier = true; + return; + } + if (/^(?:-s|--single-quotes)$/.test(string)) { + options.quotes = 'single'; + return; + } + if (/^(?:-d|--double-quotes)$/.test(string)) { + options.quotes = 'double'; + return; + } + if (/^(?:-w|--wrap)$/.test(string)) { + options.wrap = true; + return; + } + if (/^(?:-e|--escape-everything)$/.test(string)) { + options.escapeEverything = true; + return; + } + + // Process string(s) + let result; + try { + result = cssesc(string, options); + log(result); + } catch (exception) { + log(exception.message + '\n'); + log('Error: failed to escape.'); + log('If you think this is a bug in cssesc, please report it:'); + log('https://github.com/mathiasbynens/cssesc/issues/new'); + log( + '\nStack trace using cssesc@%s:\n', + cssesc.version + ); + log(exception.stack); + return process.exit(1); + } + }); + // Return with exit status 0 outside of the `forEach` loop, in case + // multiple strings were passed in. + return process.exit(0); + +}; + +if (stdin.isTTY) { + // handle shell arguments + main(); +} else { + let timeout; + // Either the script is called from within a non-TTY context, or `stdin` + // content is being piped in. + if (!process.stdout.isTTY) { + // The script was called from a non-TTY context. This is a rather uncommon + // use case we don’t actively support. However, we don’t want the script + // to wait forever in such cases, so… + timeout = setTimeout(function() { + // …if no piped data arrived after a whole minute, handle shell + // arguments instead. + main(); + }, 60000); + } + let data = ''; + stdin.on('data', function(chunk) { + clearTimeout(timeout); + data += chunk; + }); + stdin.on('end', function() { + strings.push(data.trim()); + main(); + }); + stdin.resume(); +} diff --git a/node_modules/npm/node_modules/cssesc/cssesc.js b/node_modules/npm/node_modules/cssesc/cssesc.js new file mode 100644 index 00000000..1c0928e4 --- /dev/null +++ b/node_modules/npm/node_modules/cssesc/cssesc.js @@ -0,0 +1,110 @@ +/*! https://mths.be/cssesc v3.0.0 by @mathias */ +'use strict'; + +var object = {}; +var hasOwnProperty = object.hasOwnProperty; +var merge = function merge(options, defaults) { + if (!options) { + return defaults; + } + var result = {}; + for (var key in defaults) { + // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since + // only recognized option names are used. + result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key]; + } + return result; +}; + +var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/; +var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/; +var regexAlwaysEscape = /['"\\]/; +var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g; + +// https://mathiasbynens.be/notes/css-escapes#css +var cssesc = function cssesc(string, options) { + options = merge(options, cssesc.options); + if (options.quotes != 'single' && options.quotes != 'double') { + options.quotes = 'single'; + } + var quote = options.quotes == 'double' ? '"' : '\''; + var isIdentifier = options.isIdentifier; + + var firstChar = string.charAt(0); + var output = ''; + var counter = 0; + var length = string.length; + while (counter < length) { + var character = string.charAt(counter++); + var codePoint = character.charCodeAt(); + var value = void 0; + // If it’s not a printable ASCII character… + if (codePoint < 0x20 || codePoint > 0x7E) { + if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) { + // It’s a high surrogate, and there is a next character. + var extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { + // next character is low surrogate + codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000; + } else { + // It’s an unmatched surrogate; only append this code unit, in case + // the next code unit is the high surrogate of a surrogate pair. + counter--; + } + } + value = '\\' + codePoint.toString(16).toUpperCase() + ' '; + } else { + if (options.escapeEverything) { + if (regexAnySingleEscape.test(character)) { + value = '\\' + character; + } else { + value = '\\' + codePoint.toString(16).toUpperCase() + ' '; + } + } else if (/[\t\n\f\r\x0B]/.test(character)) { + value = '\\' + codePoint.toString(16).toUpperCase() + ' '; + } else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) { + value = '\\' + character; + } else { + value = character; + } + } + output += value; + } + + if (isIdentifier) { + if (/^-[-\d]/.test(output)) { + output = '\\-' + output.slice(1); + } else if (/\d/.test(firstChar)) { + output = '\\3' + firstChar + ' ' + output.slice(1); + } + } + + // Remove spaces after `\HEX` escapes that are not followed by a hex digit, + // since they’re redundant. Note that this is only possible if the escape + // sequence isn’t preceded by an odd number of backslashes. + output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) { + if ($1 && $1.length % 2) { + // It’s not safe to remove the space, so don’t. + return $0; + } + // Strip the space. + return ($1 || '') + $2; + }); + + if (!isIdentifier && options.wrap) { + return quote + output + quote; + } + return output; +}; + +// Expose default options (so they can be overridden globally). +cssesc.options = { + 'escapeEverything': false, + 'isIdentifier': false, + 'quotes': 'single', + 'wrap': false +}; + +cssesc.version = '3.0.0'; + +module.exports = cssesc; diff --git a/node_modules/npm/node_modules/cssesc/man/cssesc.1 b/node_modules/npm/node_modules/cssesc/man/cssesc.1 new file mode 100644 index 00000000..eee4996d --- /dev/null +++ b/node_modules/npm/node_modules/cssesc/man/cssesc.1 @@ -0,0 +1,70 @@ +.Dd August 9, 2013 +.Dt cssesc 1 +.Sh NAME +.Nm cssesc +.Nd escape text for use in CSS string literals or identifiers +.Sh SYNOPSIS +.Nm +.Op Fl i | -identifier Ar string +.br +.Op Fl s | -single-quotes Ar string +.br +.Op Fl d | -double-quotes Ar string +.br +.Op Fl w | -wrap Ar string +.br +.Op Fl e | -escape-everything Ar string +.br +.Op Fl v | -version +.br +.Op Fl h | -help +.Sh DESCRIPTION +.Nm +escapes strings for use in CSS string literals or identifiers while generating the shortest possible valid ASCII-only output. +.Sh OPTIONS +.Bl -ohang -offset +.It Sy "-s, --single-quotes" +Escape any occurences of ' in the input string as \\', so that the output can be used in a CSS string literal wrapped in single quotes. +.It Sy "-d, --double-quotes" +Escape any occurences of " in the input string as \\", so that the output can be used in a CSS string literal wrapped in double quotes. +.It Sy "-w, --wrap" +Make sure the output is a valid CSS string literal wrapped in quotes. The type of quotes can be specified using the +.Ar -s | --single-quotes +or +.Ar -d | --double-quotes +settings. +.It Sy "-e, --escape-everything" +Escape all the symbols in the output, even printable ASCII symbols. +.It Sy "-v, --version" +Print cssesc's version. +.It Sy "-h, --help" +Show the help screen. +.El +.Sh EXIT STATUS +The +.Nm cssesc +utility exits with one of the following values: +.Pp +.Bl -tag -width flag -compact +.It Li 0 +.Nm +successfully escaped the given text and printed the result. +.It Li 1 +.Nm +wasn't instructed to escape anything (for example, the +.Ar --help +flag was set); or, an error occurred. +.El +.Sh EXAMPLES +.Bl -ohang -offset +.It Sy "cssesc 'foo bar baz'" +Print an escaped version of the given text. +.It Sy echo\ 'foo bar baz'\ |\ cssesc +Print an escaped version of the text that gets piped in. +.El +.Sh BUGS +cssesc's bug tracker is located at . +.Sh AUTHOR +Mathias Bynens +.Sh WWW + diff --git a/node_modules/npm/node_modules/cssesc/package.json b/node_modules/npm/node_modules/cssesc/package.json new file mode 100644 index 00000000..076c84dc --- /dev/null +++ b/node_modules/npm/node_modules/cssesc/package.json @@ -0,0 +1,51 @@ +{ + "name": "cssesc", + "version": "3.0.0", + "description": "A JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output.", + "homepage": "https://mths.be/cssesc", + "engines": { + "node": ">=4" + }, + "main": "cssesc.js", + "bin": "bin/cssesc", + "man": "man/cssesc.1", + "keywords": [ + "css", + "escape", + "identifier", + "string", + "tool" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "repository": { + "type": "git", + "url": "https://github.com/mathiasbynens/cssesc.git" + }, + "bugs": "https://github.com/mathiasbynens/cssesc/issues", + "files": [ + "LICENSE-MIT.txt", + "cssesc.js", + "bin/", + "man/" + ], + "scripts": { + "build": "grunt template && babel cssesc.js -o cssesc.js", + "test": "mocha tests", + "cover": "istanbul cover --report html node_modules/.bin/_mocha tests -- -u exports -R spec" + }, + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-preset-env": "^1.6.1", + "codecov": "^1.0.1", + "grunt": "^1.0.1", + "grunt-template": "^1.0.0", + "istanbul": "^0.4.4", + "mocha": "^2.5.3", + "regenerate": "^1.2.1", + "requirejs": "^2.1.16" + } +} diff --git a/node_modules/npm/node_modules/debug/LICENSE b/node_modules/npm/node_modules/debug/LICENSE new file mode 100644 index 00000000..1a9820e2 --- /dev/null +++ b/node_modules/npm/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +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/npm/node_modules/debug/package.json b/node_modules/npm/node_modules/debug/package.json new file mode 100644 index 00000000..60dfcf57 --- /dev/null +++ b/node_modules/npm/node_modules/debug/package.json @@ -0,0 +1,65 @@ +{ + "name": "debug", + "version": "4.4.0", + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "description": "Lightweight debugging utility for Node.js and the browser", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "LICENSE", + "README.md" + ], + "author": "Josh Junon (https://github.com/qix-)", + "contributors": [ + "TJ Holowaychuk ", + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:node": "istanbul cover _mocha -- test.js test.node.js", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls" + }, + "dependencies": { + "ms": "^2.1.3" + }, + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "sinon": "^14.0.0", + "xo": "^0.23.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + }, + "xo": { + "rules": { + "import/extensions": "off" + } + } +} diff --git a/node_modules/npm/node_modules/debug/src/browser.js b/node_modules/npm/node_modules/debug/src/browser.js new file mode 100644 index 00000000..df8e179e --- /dev/null +++ b/node_modules/npm/node_modules/debug/src/browser.js @@ -0,0 +1,272 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + let m; + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + // eslint-disable-next-line no-return-assign + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/npm/node_modules/debug/src/common.js b/node_modules/npm/node_modules/debug/src/common.js new file mode 100644 index 00000000..528c7ecf --- /dev/null +++ b/node_modules/npm/node_modules/debug/src/common.js @@ -0,0 +1,292 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + const split = (typeof namespaces === 'string' ? namespaces : '') + .trim() + .replace(' ', ',') + .split(',') + .filter(Boolean); + + for (const ns of split) { + if (ns[0] === '-') { + createDebug.skips.push(ns.slice(1)); + } else { + createDebug.names.push(ns); + } + } + } + + /** + * Checks if the given string matches a namespace template, honoring + * asterisks as wildcards. + * + * @param {String} search + * @param {String} template + * @return {Boolean} + */ + function matchesTemplate(search, template) { + let searchIndex = 0; + let templateIndex = 0; + let starIndex = -1; + let matchIndex = 0; + + while (searchIndex < search.length) { + if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) { + // Match character or proceed with wildcard + if (template[templateIndex] === '*') { + starIndex = templateIndex; + matchIndex = searchIndex; + templateIndex++; // Skip the '*' + } else { + searchIndex++; + templateIndex++; + } + } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition + // Backtrack to the last '*' and try to match more characters + templateIndex = starIndex + 1; + matchIndex++; + searchIndex = matchIndex; + } else { + return false; // No match + } + } + + // Handle trailing '*' in template + while (templateIndex < template.length && template[templateIndex] === '*') { + templateIndex++; + } + + return templateIndex === template.length; + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names, + ...createDebug.skips.map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + for (const skip of createDebug.skips) { + if (matchesTemplate(name, skip)) { + return false; + } + } + + for (const ns of createDebug.names) { + if (matchesTemplate(name, ns)) { + return true; + } + } + + return false; + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/npm/node_modules/debug/src/index.js b/node_modules/npm/node_modules/debug/src/index.js new file mode 100644 index 00000000..bf4c57f2 --- /dev/null +++ b/node_modules/npm/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/npm/node_modules/debug/src/node.js b/node_modules/npm/node_modules/debug/src/node.js new file mode 100644 index 00000000..715560a4 --- /dev/null +++ b/node_modules/npm/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/npm/node_modules/diff/CONTRIBUTING.md b/node_modules/npm/node_modules/diff/CONTRIBUTING.md new file mode 100644 index 00000000..199c556c --- /dev/null +++ b/node_modules/npm/node_modules/diff/CONTRIBUTING.md @@ -0,0 +1,40 @@ +# How to Contribute + +## Pull Requests + +We also accept [pull requests][pull-request]! + +Generally we like to see pull requests that + +- Maintain the existing code style +- Are focused on a single change (i.e. avoid large refactoring or style adjustments in untouched code if not the primary goal of the pull request) +- Have [good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) +- Have tests +- Don't decrease the current code coverage (see coverage/lcov-report/index.html) + +## Building + +``` +yarn +yarn test +``` + +Running `yarn test -- dev` will watch for tests within Node and `karma start` may be used for manual testing in browsers. + +If you notice any problems, please report them to the GitHub issue tracker at +[http://github.com/kpdecker/jsdiff/issues](http://github.com/kpdecker/jsdiff/issues). + +## Releasing + +A full release may be completed by first updating the `"version"` property in package.json, then running the following: + +``` +yarn clean +yarn grunt release +yarn publish +``` + +After releasing, remember to: +* commit the `package.json` change and push it to GitHub +* create a new version tag on GitHub +* update `diff.js` on the `gh-pages` branch to the latest built version from the `dist/` folder. diff --git a/node_modules/npm/node_modules/diff/LICENSE b/node_modules/npm/node_modules/diff/LICENSE new file mode 100644 index 00000000..2d48b19f --- /dev/null +++ b/node_modules/npm/node_modules/diff/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2009-2015, Kevin Decker +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. + +3. Neither the name of the copyright holder 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 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/npm/node_modules/diff/dist/diff.js b/node_modules/npm/node_modules/diff/dist/diff.js new file mode 100644 index 00000000..2c2c3334 --- /dev/null +++ b/node_modules/npm/node_modules/diff/dist/diff.js @@ -0,0 +1,2106 @@ +/*! + + diff v7.0.0 + +BSD 3-Clause License + +Copyright (c) 2009-2015, Kevin Decker +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. + +3. Neither the name of the copyright holder 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 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. + +@license +*/ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Diff = {})); +})(this, (function (exports) { 'use strict'; + + function Diff() {} + Diff.prototype = { + diff: function diff(oldString, newString) { + var _options$timeout; + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var callback = options.callback; + if (typeof options === 'function') { + callback = options; + options = {}; + } + var self = this; + function done(value) { + value = self.postProcess(value, options); + if (callback) { + setTimeout(function () { + callback(value); + }, 0); + return true; + } else { + return value; + } + } + + // Allow subclasses to massage the input prior to running + oldString = this.castInput(oldString, options); + newString = this.castInput(newString, options); + oldString = this.removeEmpty(this.tokenize(oldString, options)); + newString = this.removeEmpty(this.tokenize(newString, options)); + var newLen = newString.length, + oldLen = oldString.length; + var editLength = 1; + var maxEditLength = newLen + oldLen; + if (options.maxEditLength != null) { + maxEditLength = Math.min(maxEditLength, options.maxEditLength); + } + var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; + var abortAfterTimestamp = Date.now() + maxExecutionTime; + var bestPath = [{ + oldPos: -1, + lastComponent: undefined + }]; + + // Seed editLength = 0, i.e. the content starts with the same values + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options); + if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // Identity per the equality and tokenizer + return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken)); + } + + // Once we hit the right edge of the edit graph on some diagonal k, we can + // definitely reach the end of the edit graph in no more than k edits, so + // there's no point in considering any moves to diagonal k+1 any more (from + // which we're guaranteed to need at least k+1 more edits). + // Similarly, once we've reached the bottom of the edit graph, there's no + // point considering moves to lower diagonals. + // We record this fact by setting minDiagonalToConsider and + // maxDiagonalToConsider to some finite value once we've hit the edge of + // the edit graph. + // This optimization is not faithful to the original algorithm presented in + // Myers's paper, which instead pointlessly extends D-paths off the end of + // the edit graph - see page 7 of Myers's paper which notes this point + // explicitly and illustrates it with a diagram. This has major performance + // implications for some common scenarios. For instance, to compute a diff + // where the new text simply appends d characters on the end of the + // original text of length n, the true Myers algorithm will take O(n+d^2) + // time while this optimization needs only O(n+d) time. + var minDiagonalToConsider = -Infinity, + maxDiagonalToConsider = Infinity; + + // Main worker method. checks all permutations of a given edit length for acceptance. + function execEditLength() { + for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { + var basePath = void 0; + var removePath = bestPath[diagonalPath - 1], + addPath = bestPath[diagonalPath + 1]; + if (removePath) { + // No one else is going to attempt to use this value, clear it + bestPath[diagonalPath - 1] = undefined; + } + var canAdd = false; + if (addPath) { + // what newPos will be after we do an insertion: + var addPathNewPos = addPath.oldPos - diagonalPath; + canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; + } + var canRemove = removePath && removePath.oldPos + 1 < oldLen; + if (!canAdd && !canRemove) { + // If this path is a terminal then prune + bestPath[diagonalPath] = undefined; + continue; + } + + // Select the diagonal that we want to branch from. We select the prior + // path whose position in the old string is the farthest from the origin + // and does not pass the bounds of the diff graph + if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) { + basePath = self.addToPath(addPath, true, false, 0, options); + } else { + basePath = self.addToPath(removePath, false, true, 1, options); + } + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options); + if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // If we have hit the end of both strings, then we are done + return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); + } else { + bestPath[diagonalPath] = basePath; + if (basePath.oldPos + 1 >= oldLen) { + maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); + } + if (newPos + 1 >= newLen) { + minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); + } + } + } + editLength++; + } + + // Performs the length of edit iteration. Is a bit fugly as this has to support the + // sync and async mode which is never fun. Loops over execEditLength until a value + // is produced, or until the edit length exceeds options.maxEditLength (if given), + // in which case it will return undefined. + if (callback) { + (function exec() { + setTimeout(function () { + if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { + return callback(); + } + if (!execEditLength()) { + exec(); + } + }, 0); + })(); + } else { + while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { + var ret = execEditLength(); + if (ret) { + return ret; + } + } + } + }, + addToPath: function addToPath(path, added, removed, oldPosInc, options) { + var last = path.lastComponent; + if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) { + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: last.count + 1, + added: added, + removed: removed, + previousComponent: last.previousComponent + } + }; + } else { + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: 1, + added: added, + removed: removed, + previousComponent: last + } + }; + } + }, + extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) { + var newLen = newString.length, + oldLen = oldString.length, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, + commonCount = 0; + while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) { + newPos++; + oldPos++; + commonCount++; + if (options.oneChangePerToken) { + basePath.lastComponent = { + count: 1, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } + } + if (commonCount && !options.oneChangePerToken) { + basePath.lastComponent = { + count: commonCount, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } + basePath.oldPos = oldPos; + return newPos; + }, + equals: function equals(left, right, options) { + if (options.comparator) { + return options.comparator(left, right); + } else { + return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase(); + } + }, + removeEmpty: function removeEmpty(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + if (array[i]) { + ret.push(array[i]); + } + } + return ret; + }, + castInput: function castInput(value) { + return value; + }, + tokenize: function tokenize(value) { + return Array.from(value); + }, + join: function join(chars) { + return chars.join(''); + }, + postProcess: function postProcess(changeObjects) { + return changeObjects; + } + }; + function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { + // First we convert our linked list of components in reverse order to an + // array in the right order: + var components = []; + var nextComponent; + while (lastComponent) { + components.push(lastComponent); + nextComponent = lastComponent.previousComponent; + delete lastComponent.previousComponent; + lastComponent = nextComponent; + } + components.reverse(); + var componentPos = 0, + componentLen = components.length, + newPos = 0, + oldPos = 0; + for (; componentPos < componentLen; componentPos++) { + var component = components[componentPos]; + if (!component.removed) { + if (!component.added && useLongestToken) { + var value = newString.slice(newPos, newPos + component.count); + value = value.map(function (value, i) { + var oldValue = oldString[oldPos + i]; + return oldValue.length > value.length ? oldValue : value; + }); + component.value = diff.join(value); + } else { + component.value = diff.join(newString.slice(newPos, newPos + component.count)); + } + newPos += component.count; + + // Common case + if (!component.added) { + oldPos += component.count; + } + } else { + component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); + oldPos += component.count; + } + } + return components; + } + + var characterDiff = new Diff(); + function diffChars(oldStr, newStr, options) { + return characterDiff.diff(oldStr, newStr, options); + } + + function longestCommonPrefix(str1, str2) { + var i; + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[i] != str2[i]) { + return str1.slice(0, i); + } + } + return str1.slice(0, i); + } + function longestCommonSuffix(str1, str2) { + var i; + + // Unlike longestCommonPrefix, we need a special case to handle all scenarios + // where we return the empty string since str1.slice(-0) will return the + // entire string. + if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) { + return ''; + } + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) { + return str1.slice(-i); + } + } + return str1.slice(-i); + } + function replacePrefix(string, oldPrefix, newPrefix) { + if (string.slice(0, oldPrefix.length) != oldPrefix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug")); + } + return newPrefix + string.slice(oldPrefix.length); + } + function replaceSuffix(string, oldSuffix, newSuffix) { + if (!oldSuffix) { + return string + newSuffix; + } + if (string.slice(-oldSuffix.length) != oldSuffix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug")); + } + return string.slice(0, -oldSuffix.length) + newSuffix; + } + function removePrefix(string, oldPrefix) { + return replacePrefix(string, oldPrefix, ''); + } + function removeSuffix(string, oldSuffix) { + return replaceSuffix(string, oldSuffix, ''); + } + function maximumOverlap(string1, string2) { + return string2.slice(0, overlapCount(string1, string2)); + } + + // Nicked from https://stackoverflow.com/a/60422853/1709587 + function overlapCount(a, b) { + // Deal with cases where the strings differ in length + var startA = 0; + if (a.length > b.length) { + startA = a.length - b.length; + } + var endB = b.length; + if (a.length < b.length) { + endB = a.length; + } + // Create a back-reference for each index + // that should be followed in case of a mismatch. + // We only need B to make these references: + var map = Array(endB); + var k = 0; // Index that lags behind j + map[0] = 0; + for (var j = 1; j < endB; j++) { + if (b[j] == b[k]) { + map[j] = map[k]; // skip over the same character (optional optimisation) + } else { + map[j] = k; + } + while (k > 0 && b[j] != b[k]) { + k = map[k]; + } + if (b[j] == b[k]) { + k++; + } + } + // Phase 2: use these references while iterating over A + k = 0; + for (var i = startA; i < a.length; i++) { + while (k > 0 && a[i] != b[k]) { + k = map[k]; + } + if (a[i] == b[k]) { + k++; + } + } + return k; + } + + /** + * Returns true if the string consistently uses Windows line endings. + */ + function hasOnlyWinLineEndings(string) { + return string.includes('\r\n') && !string.startsWith('\n') && !string.match(/[^\r]\n/); + } + + /** + * Returns true if the string consistently uses Unix line endings. + */ + function hasOnlyUnixLineEndings(string) { + return !string.includes('\r\n') && string.includes('\n'); + } + + // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode + // + // Ranges and exceptions: + // Latin-1 Supplement, 0080–00FF + // - U+00D7 × Multiplication sign + // - U+00F7 ÷ Division sign + // Latin Extended-A, 0100–017F + // Latin Extended-B, 0180–024F + // IPA Extensions, 0250–02AF + // Spacing Modifier Letters, 02B0–02FF + // - U+02C7 ˇ ˇ Caron + // - U+02D8 ˘ ˘ Breve + // - U+02D9 ˙ ˙ Dot Above + // - U+02DA ˚ ˚ Ring Above + // - U+02DB ˛ ˛ Ogonek + // - U+02DC ˜ ˜ Small Tilde + // - U+02DD ˝ ˝ Double Acute Accent + // Latin Extended Additional, 1E00–1EFF + var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}"; + + // Each token is one of the following: + // - A punctuation mark plus the surrounding whitespace + // - A word plus the surrounding whitespace + // - Pure whitespace (but only in the special case where this the entire text + // is just whitespace) + // + // We have to include surrounding whitespace in the tokens because the two + // alternative approaches produce horribly broken results: + // * If we just discard the whitespace, we can't fully reproduce the original + // text from the sequence of tokens and any attempt to render the diff will + // get the whitespace wrong. + // * If we have separate tokens for whitespace, then in a typical text every + // second token will be a single space character. But this often results in + // the optimal diff between two texts being a perverse one that preserves + // the spaces between words but deletes and reinserts actual common words. + // See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640 + // for an example. + // + // Keeping the surrounding whitespace of course has implications for .equals + // and .join, not just .tokenize. + + // This regex does NOT fully implement the tokenization rules described above. + // Instead, it gives runs of whitespace their own "token". The tokenize method + // then handles stitching whitespace tokens onto adjacent word or punctuation + // tokens. + var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), 'ug'); + var wordDiff = new Diff(); + wordDiff.equals = function (left, right, options) { + if (options.ignoreCase) { + left = left.toLowerCase(); + right = right.toLowerCase(); + } + return left.trim() === right.trim(); + }; + wordDiff.tokenize = function (value) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parts; + if (options.intlSegmenter) { + if (options.intlSegmenter.resolvedOptions().granularity != 'word') { + throw new Error('The segmenter passed must have a granularity of "word"'); + } + parts = Array.from(options.intlSegmenter.segment(value), function (segment) { + return segment.segment; + }); + } else { + parts = value.match(tokenizeIncludingWhitespace) || []; + } + var tokens = []; + var prevPart = null; + parts.forEach(function (part) { + if (/\s/.test(part)) { + if (prevPart == null) { + tokens.push(part); + } else { + tokens.push(tokens.pop() + part); + } + } else if (/\s/.test(prevPart)) { + if (tokens[tokens.length - 1] == prevPart) { + tokens.push(tokens.pop() + part); + } else { + tokens.push(prevPart + part); + } + } else { + tokens.push(part); + } + prevPart = part; + }); + return tokens; + }; + wordDiff.join = function (tokens) { + // Tokens being joined here will always have appeared consecutively in the + // same text, so we can simply strip off the leading whitespace from all the + // tokens except the first (and except any whitespace-only tokens - but such + // a token will always be the first and only token anyway) and then join them + // and the whitespace around words and punctuation will end up correct. + return tokens.map(function (token, i) { + if (i == 0) { + return token; + } else { + return token.replace(/^\s+/, ''); + } + }).join(''); + }; + wordDiff.postProcess = function (changes, options) { + if (!changes || options.oneChangePerToken) { + return changes; + } + var lastKeep = null; + // Change objects representing any insertion or deletion since the last + // "keep" change object. There can be at most one of each. + var insertion = null; + var deletion = null; + changes.forEach(function (change) { + if (change.added) { + insertion = change; + } else if (change.removed) { + deletion = change; + } else { + if (insertion || deletion) { + // May be false at start of text + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change); + } + lastKeep = change; + insertion = null; + deletion = null; + } + }); + if (insertion || deletion) { + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null); + } + return changes; + }; + function diffWords(oldStr, newStr, options) { + // This option has never been documented and never will be (it's clearer to + // just call `diffWordsWithSpace` directly if you need that behavior), but + // has existed in jsdiff for a long time, so we retain support for it here + // for the sake of backwards compatibility. + if ((options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace) { + return diffWordsWithSpace(oldStr, newStr, options); + } + return wordDiff.diff(oldStr, newStr, options); + } + function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) { + // Before returning, we tidy up the leading and trailing whitespace of the + // change objects to eliminate cases where trailing whitespace in one object + // is repeated as leading whitespace in the next. + // Below are examples of the outcomes we want here to explain the code. + // I=insert, K=keep, D=delete + // 1. diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want: K:'foo ' D:'bar ' K:'baz' + // + // 2. Diffing 'foo bar baz' vs 'foo qux baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz' + // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz' + // + // 3. Diffing 'foo\nbar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:'\nbar ' K:' baz' + // After cleanup, we want K'foo' D:'\nbar' K:' baz' + // + // 4. Diffing 'foo baz' vs 'foo\nbar baz' + // Prior to cleanup, we have K:'foo\n' I:'\nbar ' K:' baz' + // After cleanup, we ideally want K'foo' I:'\nbar' K:' baz' + // but don't actually manage this currently (the pre-cleanup change + // objects don't contain enough information to make it possible). + // + // 5. Diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want K:'foo ' D:' bar ' K:'baz' + // + // Our handling is unavoidably imperfect in the case where there's a single + // indel between keeps and the whitespace has changed. For instance, consider + // diffing 'foo\tbar\nbaz' vs 'foo baz'. Unless we create an extra change + // object to represent the insertion of the space character (which isn't even + // a token), we have no way to avoid losing information about the texts' + // original whitespace in the result we return. Still, we do our best to + // output something that will look sensible if we e.g. print it with + // insertions in green and deletions in red. + + // Between two "keep" change objects (or before the first or after the last + // change object), we can have either: + // * A "delete" followed by an "insert" + // * Just an "insert" + // * Just a "delete" + // We handle the three cases separately. + if (deletion && insertion) { + var oldWsPrefix = deletion.value.match(/^\s*/)[0]; + var oldWsSuffix = deletion.value.match(/\s*$/)[0]; + var newWsPrefix = insertion.value.match(/^\s*/)[0]; + var newWsSuffix = insertion.value.match(/\s*$/)[0]; + if (startKeep) { + var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix); + startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix); + deletion.value = removePrefix(deletion.value, commonWsPrefix); + insertion.value = removePrefix(insertion.value, commonWsPrefix); + } + if (endKeep) { + var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix); + endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix); + deletion.value = removeSuffix(deletion.value, commonWsSuffix); + insertion.value = removeSuffix(insertion.value, commonWsSuffix); + } + } else if (insertion) { + // The whitespaces all reflect what was in the new text rather than + // the old, so we essentially have no information about whitespace + // insertion or deletion. We just want to dedupe the whitespace. + // We do that by having each change object keep its trailing + // whitespace and deleting duplicate leading whitespace where + // present. + if (startKeep) { + insertion.value = insertion.value.replace(/^\s*/, ''); + } + if (endKeep) { + endKeep.value = endKeep.value.replace(/^\s*/, ''); + } + // otherwise we've got a deletion and no insertion + } else if (startKeep && endKeep) { + var newWsFull = endKeep.value.match(/^\s*/)[0], + delWsStart = deletion.value.match(/^\s*/)[0], + delWsEnd = deletion.value.match(/\s*$/)[0]; + + // Any whitespace that comes straight after startKeep in both the old and + // new texts, assign to startKeep and remove from the deletion. + var newWsStart = longestCommonPrefix(newWsFull, delWsStart); + deletion.value = removePrefix(deletion.value, newWsStart); + + // Any whitespace that comes straight before endKeep in both the old and + // new texts, and hasn't already been assigned to startKeep, assign to + // endKeep and remove from the deletion. + var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd); + deletion.value = removeSuffix(deletion.value, newWsEnd); + endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd); + + // If there's any whitespace from the new text that HASN'T already been + // assigned, assign it to the start: + startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length)); + } else if (endKeep) { + // We are at the start of the text. Preserve all the whitespace on + // endKeep, and just remove whitespace from the end of deletion to the + // extent that it overlaps with the start of endKeep. + var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0]; + var deletionWsSuffix = deletion.value.match(/\s*$/)[0]; + var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix); + deletion.value = removeSuffix(deletion.value, overlap); + } else if (startKeep) { + // We are at the END of the text. Preserve all the whitespace on + // startKeep, and just remove whitespace from the start of deletion to + // the extent that it overlaps with the end of startKeep. + var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0]; + var deletionWsPrefix = deletion.value.match(/^\s*/)[0]; + var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix); + deletion.value = removePrefix(deletion.value, _overlap); + } + } + var wordWithSpaceDiff = new Diff(); + wordWithSpaceDiff.tokenize = function (value) { + // Slightly different to the tokenizeIncludingWhitespace regex used above in + // that this one treats each individual newline as a distinct tokens, rather + // than merging them into other surrounding whitespace. This was requested + // in https://github.com/kpdecker/jsdiff/issues/180 & + // https://github.com/kpdecker/jsdiff/issues/211 + var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), 'ug'); + return value.match(regex) || []; + }; + function diffWordsWithSpace(oldStr, newStr, options) { + return wordWithSpaceDiff.diff(oldStr, newStr, options); + } + + function generateOptions(options, defaults) { + if (typeof options === 'function') { + defaults.callback = options; + } else if (options) { + for (var name in options) { + /* istanbul ignore else */ + if (options.hasOwnProperty(name)) { + defaults[name] = options[name]; + } + } + } + return defaults; + } + + var lineDiff = new Diff(); + lineDiff.tokenize = function (value, options) { + if (options.stripTrailingCr) { + // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior + value = value.replace(/\r\n/g, '\n'); + } + var retLines = [], + linesAndNewlines = value.split(/(\n|\r\n)/); + + // Ignore the final empty token that occurs if the string ends with a new line + if (!linesAndNewlines[linesAndNewlines.length - 1]) { + linesAndNewlines.pop(); + } + + // Merge the content and line separators into single tokens + for (var i = 0; i < linesAndNewlines.length; i++) { + var line = linesAndNewlines[i]; + if (i % 2 && !options.newlineIsToken) { + retLines[retLines.length - 1] += line; + } else { + retLines.push(line); + } + } + return retLines; + }; + lineDiff.equals = function (left, right, options) { + // If we're ignoring whitespace, we need to normalise lines by stripping + // whitespace before checking equality. (This has an annoying interaction + // with newlineIsToken that requires special handling: if newlines get their + // own token, then we DON'T want to trim the *newline* tokens down to empty + // strings, since this would cause us to treat whitespace-only line content + // as equal to a separator between lines, which would be weird and + // inconsistent with the documented behavior of the options.) + if (options.ignoreWhitespace) { + if (!options.newlineIsToken || !left.includes('\n')) { + left = left.trim(); + } + if (!options.newlineIsToken || !right.includes('\n')) { + right = right.trim(); + } + } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) { + if (left.endsWith('\n')) { + left = left.slice(0, -1); + } + if (right.endsWith('\n')) { + right = right.slice(0, -1); + } + } + return Diff.prototype.equals.call(this, left, right, options); + }; + function diffLines(oldStr, newStr, callback) { + return lineDiff.diff(oldStr, newStr, callback); + } + + // Kept for backwards compatibility. This is a rather arbitrary wrapper method + // that just calls `diffLines` with `ignoreWhitespace: true`. It's confusing to + // have two ways to do exactly the same thing in the API, so we no longer + // document this one (library users should explicitly use `diffLines` with + // `ignoreWhitespace: true` instead) but we keep it around to maintain + // compatibility with code that used old versions. + function diffTrimmedLines(oldStr, newStr, callback) { + var options = generateOptions(callback, { + ignoreWhitespace: true + }); + return lineDiff.diff(oldStr, newStr, options); + } + + var sentenceDiff = new Diff(); + sentenceDiff.tokenize = function (value) { + return value.split(/(\S.+?[.!?])(?=\s+|$)/); + }; + function diffSentences(oldStr, newStr, callback) { + return sentenceDiff.diff(oldStr, newStr, callback); + } + + var cssDiff = new Diff(); + cssDiff.tokenize = function (value) { + return value.split(/([{}:;,]|\s+)/); + }; + function diffCss(oldStr, newStr, callback) { + return cssDiff.diff(oldStr, newStr, callback); + } + + function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); + } + return t; + } + function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; + } + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; + } + function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); + } + 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 _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + var jsonDiff = new Diff(); + // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a + // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: + jsonDiff.useLongestToken = true; + jsonDiff.tokenize = lineDiff.tokenize; + jsonDiff.castInput = function (value, options) { + var undefinedReplacement = options.undefinedReplacement, + _options$stringifyRep = options.stringifyReplacer, + stringifyReplacer = _options$stringifyRep === void 0 ? function (k, v) { + return typeof v === 'undefined' ? undefinedReplacement : v; + } : _options$stringifyRep; + return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); + }; + jsonDiff.equals = function (left, right, options) { + return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options); + }; + function diffJson(oldObj, newObj, options) { + return jsonDiff.diff(oldObj, newObj, options); + } + + // This function handles the presence of circular references by bailing out when encountering an + // object that is already on the "stack" of items being processed. Accepts an optional replacer + function canonicalize(obj, stack, replacementStack, replacer, key) { + stack = stack || []; + replacementStack = replacementStack || []; + if (replacer) { + obj = replacer(key, obj); + } + var i; + for (i = 0; i < stack.length; i += 1) { + if (stack[i] === obj) { + return replacementStack[i]; + } + } + var canonicalizedObj; + if ('[object Array]' === Object.prototype.toString.call(obj)) { + stack.push(obj); + canonicalizedObj = new Array(obj.length); + replacementStack.push(canonicalizedObj); + for (i = 0; i < obj.length; i += 1) { + canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); + } + stack.pop(); + replacementStack.pop(); + return canonicalizedObj; + } + if (obj && obj.toJSON) { + obj = obj.toJSON(); + } + if (_typeof(obj) === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + replacementStack.push(canonicalizedObj); + var sortedKeys = [], + _key; + for (_key in obj) { + /* istanbul ignore else */ + if (Object.prototype.hasOwnProperty.call(obj, _key)) { + sortedKeys.push(_key); + } + } + sortedKeys.sort(); + for (i = 0; i < sortedKeys.length; i += 1) { + _key = sortedKeys[i]; + canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); + } + stack.pop(); + replacementStack.pop(); + } else { + canonicalizedObj = obj; + } + return canonicalizedObj; + } + + var arrayDiff = new Diff(); + arrayDiff.tokenize = function (value) { + return value.slice(); + }; + arrayDiff.join = arrayDiff.removeEmpty = function (value) { + return value; + }; + function diffArrays(oldArr, newArr, callback) { + return arrayDiff.diff(oldArr, newArr, callback); + } + + function unixToWin(patch) { + if (Array.isArray(patch)) { + return patch.map(unixToWin); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line, i) { + var _hunk$lines; + return line.startsWith('\\') || line.endsWith('\r') || (_hunk$lines = hunk.lines[i + 1]) !== null && _hunk$lines !== void 0 && _hunk$lines.startsWith('\\') ? line : line + '\r'; + }) + }); + }) + }); + } + function winToUnix(patch) { + if (Array.isArray(patch)) { + return patch.map(winToUnix); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line) { + return line.endsWith('\r') ? line.substring(0, line.length - 1) : line; + }) + }); + }) + }); + } + + /** + * Returns true if the patch consistently uses Unix line endings (or only involves one line and has + * no line endings). + */ + function isUnix(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return !patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return !line.startsWith('\\') && line.endsWith('\r'); + }); + }); + }); + } + + /** + * Returns true if the patch uses Windows line endings and only Windows line endings. + */ + function isWin(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return line.endsWith('\r'); + }); + }); + }) && patch.every(function (index) { + return index.hunks.every(function (hunk) { + return hunk.lines.every(function (line, i) { + var _hunk$lines2; + return line.startsWith('\\') || line.endsWith('\r') || ((_hunk$lines2 = hunk.lines[i + 1]) === null || _hunk$lines2 === void 0 ? void 0 : _hunk$lines2.startsWith('\\')); + }); + }); + }); + } + + function parsePatch(uniDiff) { + var diffstr = uniDiff.split(/\n/), + list = [], + i = 0; + function parseIndex() { + var index = {}; + list.push(index); + + // Parse diff metadata + while (i < diffstr.length) { + var line = diffstr[i]; + + // File header found, end parsing diff metadata + if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { + break; + } + + // Diff index + var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); + if (header) { + index.index = header[1]; + } + i++; + } + + // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + parseFileHeader(index); + parseFileHeader(index); + + // Parse hunks + index.hunks = []; + while (i < diffstr.length) { + var _line = diffstr[i]; + if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) { + break; + } else if (/^@@/.test(_line)) { + index.hunks.push(parseHunk()); + } else if (_line) { + throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); + } else { + i++; + } + } + } + + // Parses the --- and +++ headers, if none are found, no lines + // are consumed. + function parseFileHeader(index) { + var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]); + if (fileHeader) { + var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; + var data = fileHeader[2].split('\t', 2); + var fileName = data[0].replace(/\\\\/g, '\\'); + if (/^".*"$/.test(fileName)) { + fileName = fileName.substr(1, fileName.length - 2); + } + index[keyPrefix + 'FileName'] = fileName; + index[keyPrefix + 'Header'] = (data[1] || '').trim(); + i++; + } + } + + // Parses a hunk + // This assumes that we are at the start of a hunk. + function parseHunk() { + var chunkHeaderIndex = i, + chunkHeaderLine = diffstr[i++], + chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); + var hunk = { + oldStart: +chunkHeader[1], + oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2], + newStart: +chunkHeader[3], + newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4], + lines: [] + }; + + // Unified Diff Format quirk: If the chunk size is 0, + // the first number is one lower than one would expect. + // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 + if (hunk.oldLines === 0) { + hunk.oldStart += 1; + } + if (hunk.newLines === 0) { + hunk.newStart += 1; + } + var addCount = 0, + removeCount = 0; + for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || (_diffstr$i = diffstr[i]) !== null && _diffstr$i !== void 0 && _diffstr$i.startsWith('\\')); i++) { + var _diffstr$i; + var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; + if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { + hunk.lines.push(diffstr[i]); + if (operation === '+') { + addCount++; + } else if (operation === '-') { + removeCount++; + } else if (operation === ' ') { + addCount++; + removeCount++; + } + } else { + throw new Error("Hunk at line ".concat(chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i])); + } + } + + // Handle the empty block count case + if (!addCount && hunk.newLines === 1) { + hunk.newLines = 0; + } + if (!removeCount && hunk.oldLines === 1) { + hunk.oldLines = 0; + } + + // Perform sanity checking + if (addCount !== hunk.newLines) { + throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + if (removeCount !== hunk.oldLines) { + throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + return hunk; + } + while (i < diffstr.length) { + parseIndex(); + } + return list; + } + + // Iterator that traverses in the range of [min, max], stepping + // by distance from a given start position. I.e. for [0, 4], with + // start of 2, this will iterate 2, 3, 1, 4, 0. + function distanceIterator (start, minLine, maxLine) { + var wantForward = true, + backwardExhausted = false, + forwardExhausted = false, + localOffset = 1; + return function iterator() { + if (wantForward && !forwardExhausted) { + if (backwardExhausted) { + localOffset++; + } else { + wantForward = false; + } + + // Check if trying to fit beyond text length, and if not, check it fits + // after offset location (or desired location on first iteration) + if (start + localOffset <= maxLine) { + return start + localOffset; + } + forwardExhausted = true; + } + if (!backwardExhausted) { + if (!forwardExhausted) { + wantForward = true; + } + + // Check if trying to fit before text beginning, and if not, check it fits + // before offset location + if (minLine <= start - localOffset) { + return start - localOffset++; + } + backwardExhausted = true; + return iterator(); + } + + // We tried to fit hunk before text beginning and beyond text length, then + // hunk can't fit on the text. Return undefined + }; + } + + function applyPatch(source, uniDiff) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } + if (Array.isArray(uniDiff)) { + if (uniDiff.length > 1) { + throw new Error('applyPatch only works with a single input.'); + } + uniDiff = uniDiff[0]; + } + if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) { + if (hasOnlyWinLineEndings(source) && isUnix(uniDiff)) { + uniDiff = unixToWin(uniDiff); + } else if (hasOnlyUnixLineEndings(source) && isWin(uniDiff)) { + uniDiff = winToUnix(uniDiff); + } + } + + // Apply the diff to the input + var lines = source.split('\n'), + hunks = uniDiff.hunks, + compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { + return line === patchContent; + }, + fuzzFactor = options.fuzzFactor || 0, + minLine = 0; + if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) { + throw new Error('fuzzFactor must be a non-negative integer'); + } + + // Special case for empty patch. + if (!hunks.length) { + return source; + } + + // Before anything else, handle EOFNL insertion/removal. If the patch tells us to make a change + // to the EOFNL that is redundant/impossible - i.e. to remove a newline that's not there, or add a + // newline that already exists - then we either return false and fail to apply the patch (if + // fuzzFactor is 0) or simply ignore the problem and do nothing (if fuzzFactor is >0). + // If we do need to remove/add a newline at EOF, this will always be in the final hunk: + var prevLine = '', + removeEOFNL = false, + addEOFNL = false; + for (var i = 0; i < hunks[hunks.length - 1].lines.length; i++) { + var line = hunks[hunks.length - 1].lines[i]; + if (line[0] == '\\') { + if (prevLine[0] == '+') { + removeEOFNL = true; + } else if (prevLine[0] == '-') { + addEOFNL = true; + } + } + prevLine = line; + } + if (removeEOFNL) { + if (addEOFNL) { + // This means the final line gets changed but doesn't have a trailing newline in either the + // original or patched version. In that case, we do nothing if fuzzFactor > 0, and if + // fuzzFactor is 0, we simply validate that the source file has no trailing newline. + if (!fuzzFactor && lines[lines.length - 1] == '') { + return false; + } + } else if (lines[lines.length - 1] == '') { + lines.pop(); + } else if (!fuzzFactor) { + return false; + } + } else if (addEOFNL) { + if (lines[lines.length - 1] != '') { + lines.push(''); + } else if (!fuzzFactor) { + return false; + } + } + + /** + * Checks if the hunk can be made to fit at the provided location with at most `maxErrors` + * insertions, substitutions, or deletions, while ensuring also that: + * - lines deleted in the hunk match exactly, and + * - wherever an insertion operation or block of insertion operations appears in the hunk, the + * immediately preceding and following lines of context match exactly + * + * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0]. + * + * If the hunk can be applied, returns an object with properties `oldLineLastI` and + * `replacementLines`. Otherwise, returns null. + */ + function applyHunk(hunkLines, toPos, maxErrors) { + var hunkLinesI = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var lastContextLineMatched = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var patchedLines = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : []; + var patchedLinesLength = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; + var nConsecutiveOldContextLines = 0; + var nextContextLineMustMatch = false; + for (; hunkLinesI < hunkLines.length; hunkLinesI++) { + var hunkLine = hunkLines[hunkLinesI], + operation = hunkLine.length > 0 ? hunkLine[0] : ' ', + content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine; + if (operation === '-') { + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + toPos++; + nConsecutiveOldContextLines = 0; + } else { + if (!maxErrors || lines[toPos] == null) { + return null; + } + patchedLines[patchedLinesLength] = lines[toPos]; + return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1); + } + } + if (operation === '+') { + if (!lastContextLineMatched) { + return null; + } + patchedLines[patchedLinesLength] = content; + patchedLinesLength++; + nConsecutiveOldContextLines = 0; + nextContextLineMustMatch = true; + } + if (operation === ' ') { + nConsecutiveOldContextLines++; + patchedLines[patchedLinesLength] = lines[toPos]; + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + patchedLinesLength++; + lastContextLineMatched = true; + nextContextLineMustMatch = false; + toPos++; + } else { + if (nextContextLineMustMatch || !maxErrors) { + return null; + } + + // Consider 3 possibilities in sequence: + // 1. lines contains a *substitution* not included in the patch context, or + // 2. lines contains an *insertion* not included in the patch context, or + // 3. lines contains a *deletion* not included in the patch context + // The first two options are of course only possible if the line from lines is non-null - + // i.e. only option 3 is possible if we've overrun the end of the old file. + return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength); + } + } + } + + // Before returning, trim any unmodified context lines off the end of patchedLines and reduce + // toPos (and thus oldLineLastI) accordingly. This allows later hunks to be applied to a region + // that starts in this hunk's trailing context. + patchedLinesLength -= nConsecutiveOldContextLines; + toPos -= nConsecutiveOldContextLines; + patchedLines.length = patchedLinesLength; + return { + patchedLines: patchedLines, + oldLineLastI: toPos - 1 + }; + } + var resultLines = []; + + // Search best fit offsets for each hunk based on the previous ones + var prevHunkOffset = 0; + for (var _i = 0; _i < hunks.length; _i++) { + var hunk = hunks[_i]; + var hunkResult = void 0; + var maxLine = lines.length - hunk.oldLines + fuzzFactor; + var toPos = void 0; + for (var maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) { + toPos = hunk.oldStart + prevHunkOffset - 1; + var iterator = distanceIterator(toPos, minLine, maxLine); + for (; toPos !== undefined; toPos = iterator()) { + hunkResult = applyHunk(hunk.lines, toPos, maxErrors); + if (hunkResult) { + break; + } + } + if (hunkResult) { + break; + } + } + if (!hunkResult) { + return false; + } + + // Copy everything from the end of where we applied the last hunk to the start of this hunk + for (var _i2 = minLine; _i2 < toPos; _i2++) { + resultLines.push(lines[_i2]); + } + + // Add the lines produced by applying the hunk: + for (var _i3 = 0; _i3 < hunkResult.patchedLines.length; _i3++) { + var _line = hunkResult.patchedLines[_i3]; + resultLines.push(_line); + } + + // Set lower text limit to end of the current hunk, so next ones don't try + // to fit over already patched text + minLine = hunkResult.oldLineLastI + 1; + + // Note the offset between where the patch said the hunk should've applied and where we + // applied it, so we can adjust future hunks accordingly: + prevHunkOffset = toPos + 1 - hunk.oldStart; + } + + // Copy over the rest of the lines from the old text + for (var _i4 = minLine; _i4 < lines.length; _i4++) { + resultLines.push(lines[_i4]); + } + return resultLines.join('\n'); + } + + // Wrapper that supports multiple file patches via callbacks. + function applyPatches(uniDiff, options) { + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } + var currentIndex = 0; + function processIndex() { + var index = uniDiff[currentIndex++]; + if (!index) { + return options.complete(); + } + options.loadFile(index, function (err, data) { + if (err) { + return options.complete(err); + } + var updatedContent = applyPatch(data, index, options); + options.patched(index, updatedContent, function (err) { + if (err) { + return options.complete(err); + } + processIndex(); + }); + }); + } + processIndex(); + } + + function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + if (!options) { + options = {}; + } + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (typeof options.context === 'undefined') { + options.context = 4; + } + if (options.newlineIsToken) { + throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions'); + } + if (!options.callback) { + return diffLinesResultToPatch(diffLines(oldStr, newStr, options)); + } else { + var _options = options, + _callback = _options.callback; + diffLines(oldStr, newStr, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(diff) { + var patch = diffLinesResultToPatch(diff); + _callback(patch); + } + })); + } + function diffLinesResultToPatch(diff) { + // STEP 1: Build up the patch with no "\ No newline at end of file" lines and with the arrays + // of lines containing trailing newline characters. We'll tidy up later... + + if (!diff) { + return; + } + diff.push({ + value: '', + lines: [] + }); // Append an empty value to make cleanup easier + + function contextLines(lines) { + return lines.map(function (entry) { + return ' ' + entry; + }); + } + var hunks = []; + var oldRangeStart = 0, + newRangeStart = 0, + curRange = [], + oldLine = 1, + newLine = 1; + var _loop = function _loop() { + var current = diff[i], + lines = current.lines || splitLines(current.value); + current.lines = lines; + if (current.added || current.removed) { + var _curRange; + // If we have previous context, start with that + if (!oldRangeStart) { + var prev = diff[i - 1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + if (prev) { + curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } + } + + // Output our changes + (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { + return (current.added ? '+' : '-') + entry; + }))); + + // Track the updated file position + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } + } else { + // Identical context lines. Track line changes + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= options.context * 2 && i < diff.length - 2) { + var _curRange2; + // Overlapping + (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); + } else { + var _curRange3; + // end the range and output + var contextSize = Math.min(lines.length, options.context); + (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); + var _hunk = { + oldStart: oldRangeStart, + oldLines: oldLine - oldRangeStart + contextSize, + newStart: newRangeStart, + newLines: newLine - newRangeStart + contextSize, + lines: curRange + }; + hunks.push(_hunk); + oldRangeStart = 0; + newRangeStart = 0; + curRange = []; + } + } + oldLine += lines.length; + newLine += lines.length; + } + }; + for (var i = 0; i < diff.length; i++) { + _loop(); + } + + // Step 2: eliminate the trailing `\n` from each line of each hunk, and, where needed, add + // "\ No newline at end of file". + for (var _i = 0, _hunks = hunks; _i < _hunks.length; _i++) { + var hunk = _hunks[_i]; + for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) { + if (hunk.lines[_i2].endsWith('\n')) { + hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1); + } else { + hunk.lines.splice(_i2 + 1, 0, '\\ No newline at end of file'); + _i2++; // Skip the line we just added, then continue iterating + } + } + } + return { + oldFileName: oldFileName, + newFileName: newFileName, + oldHeader: oldHeader, + newHeader: newHeader, + hunks: hunks + }; + } + } + function formatPatch(diff) { + if (Array.isArray(diff)) { + return diff.map(formatPatch).join('\n'); + } + var ret = []; + if (diff.oldFileName == diff.newFileName) { + ret.push('Index: ' + diff.oldFileName); + } + ret.push('==================================================================='); + ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); + ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); + for (var i = 0; i < diff.hunks.length; i++) { + var hunk = diff.hunks[i]; + // Unified Diff Format quirk: If the chunk size is 0, + // the first number is one lower than one would expect. + // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 + if (hunk.oldLines === 0) { + hunk.oldStart -= 1; + } + if (hunk.newLines === 0) { + hunk.newStart -= 1; + } + ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); + ret.push.apply(ret, hunk.lines); + } + return ret.join('\n') + '\n'; + } + function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + var _options2; + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (!((_options2 = options) !== null && _options2 !== void 0 && _options2.callback)) { + var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + if (!patchObj) { + return; + } + return formatPatch(patchObj); + } else { + var _options3 = options, + _callback2 = _options3.callback; + structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(patchObj) { + if (!patchObj) { + _callback2(); + } else { + _callback2(formatPatch(patchObj)); + } + } + })); + } + } + function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { + return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); + } + + /** + * Split `text` into an array of lines, including the trailing newline character (where present) + */ + function splitLines(text) { + var hasTrailingNl = text.endsWith('\n'); + var result = text.split('\n').map(function (line) { + return line + '\n'; + }); + if (hasTrailingNl) { + result.pop(); + } else { + result.push(result.pop().slice(0, -1)); + } + return result; + } + + function arrayEqual(a, b) { + if (a.length !== b.length) { + return false; + } + return arrayStartsWith(a, b); + } + function arrayStartsWith(array, start) { + if (start.length > array.length) { + return false; + } + for (var i = 0; i < start.length; i++) { + if (start[i] !== array[i]) { + return false; + } + } + return true; + } + + function calcLineCount(hunk) { + var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), + oldLines = _calcOldNewLineCount.oldLines, + newLines = _calcOldNewLineCount.newLines; + if (oldLines !== undefined) { + hunk.oldLines = oldLines; + } else { + delete hunk.oldLines; + } + if (newLines !== undefined) { + hunk.newLines = newLines; + } else { + delete hunk.newLines; + } + } + function merge(mine, theirs, base) { + mine = loadPatch(mine, base); + theirs = loadPatch(theirs, base); + var ret = {}; + + // For index we just let it pass through as it doesn't have any necessary meaning. + // Leaving sanity checks on this to the API consumer that may know more about the + // meaning in their own context. + if (mine.index || theirs.index) { + ret.index = mine.index || theirs.index; + } + if (mine.newFileName || theirs.newFileName) { + if (!fileNameChanged(mine)) { + // No header or no change in ours, use theirs (and ours if theirs does not exist) + ret.oldFileName = theirs.oldFileName || mine.oldFileName; + ret.newFileName = theirs.newFileName || mine.newFileName; + ret.oldHeader = theirs.oldHeader || mine.oldHeader; + ret.newHeader = theirs.newHeader || mine.newHeader; + } else if (!fileNameChanged(theirs)) { + // No header or no change in theirs, use ours + ret.oldFileName = mine.oldFileName; + ret.newFileName = mine.newFileName; + ret.oldHeader = mine.oldHeader; + ret.newHeader = mine.newHeader; + } else { + // Both changed... figure it out + ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); + ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); + ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); + ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); + } + } + ret.hunks = []; + var mineIndex = 0, + theirsIndex = 0, + mineOffset = 0, + theirsOffset = 0; + while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { + var mineCurrent = mine.hunks[mineIndex] || { + oldStart: Infinity + }, + theirsCurrent = theirs.hunks[theirsIndex] || { + oldStart: Infinity + }; + if (hunkBefore(mineCurrent, theirsCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); + mineIndex++; + theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; + } else if (hunkBefore(theirsCurrent, mineCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); + theirsIndex++; + mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; + } else { + // Overlap, merge as best we can + var mergedHunk = { + oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), + oldLines: 0, + newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), + newLines: 0, + lines: [] + }; + mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); + theirsIndex++; + mineIndex++; + ret.hunks.push(mergedHunk); + } + } + return ret; + } + function loadPatch(param, base) { + if (typeof param === 'string') { + if (/^@@/m.test(param) || /^Index:/m.test(param)) { + return parsePatch(param)[0]; + } + if (!base) { + throw new Error('Must provide a base reference or pass in a patch'); + } + return structuredPatch(undefined, undefined, base, param); + } + return param; + } + function fileNameChanged(patch) { + return patch.newFileName && patch.newFileName !== patch.oldFileName; + } + function selectField(index, mine, theirs) { + if (mine === theirs) { + return mine; + } else { + index.conflict = true; + return { + mine: mine, + theirs: theirs + }; + } + } + function hunkBefore(test, check) { + return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; + } + function cloneHunk(hunk, offset) { + return { + oldStart: hunk.oldStart, + oldLines: hunk.oldLines, + newStart: hunk.newStart + offset, + newLines: hunk.newLines, + lines: hunk.lines + }; + } + function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { + // This will generally result in a conflicted hunk, but there are cases where the context + // is the only overlap where we can successfully merge the content here. + var mine = { + offset: mineOffset, + lines: mineLines, + index: 0 + }, + their = { + offset: theirOffset, + lines: theirLines, + index: 0 + }; + + // Handle any leading content + insertLeading(hunk, mine, their); + insertLeading(hunk, their, mine); + + // Now in the overlap content. Scan through and select the best changes from each. + while (mine.index < mine.lines.length && their.index < their.lines.length) { + var mineCurrent = mine.lines[mine.index], + theirCurrent = their.lines[their.index]; + if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { + // Both modified ... + mutualChange(hunk, mine, their); + } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { + var _hunk$lines; + // Mine inserted + (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); + } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { + var _hunk$lines2; + // Theirs inserted + (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); + } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { + // Mine removed or edited + removal(hunk, mine, their); + } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { + // Their removed or edited + removal(hunk, their, mine, true); + } else if (mineCurrent === theirCurrent) { + // Context identity + hunk.lines.push(mineCurrent); + mine.index++; + their.index++; + } else { + // Context mismatch + conflict(hunk, collectChange(mine), collectChange(their)); + } + } + + // Now push anything that may be remaining + insertTrailing(hunk, mine); + insertTrailing(hunk, their); + calcLineCount(hunk); + } + function mutualChange(hunk, mine, their) { + var myChanges = collectChange(mine), + theirChanges = collectChange(their); + if (allRemoves(myChanges) && allRemoves(theirChanges)) { + // Special case for remove changes that are supersets of one another + if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { + var _hunk$lines3; + (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); + return; + } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { + var _hunk$lines4; + (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); + return; + } + } else if (arrayEqual(myChanges, theirChanges)) { + var _hunk$lines5; + (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); + return; + } + conflict(hunk, myChanges, theirChanges); + } + function removal(hunk, mine, their, swap) { + var myChanges = collectChange(mine), + theirChanges = collectContext(their, myChanges); + if (theirChanges.merged) { + var _hunk$lines6; + (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); + } else { + conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); + } + } + function conflict(hunk, mine, their) { + hunk.conflict = true; + hunk.lines.push({ + conflict: true, + mine: mine, + theirs: their + }); + } + function insertLeading(hunk, insert, their) { + while (insert.offset < their.offset && insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + insert.offset++; + } + } + function insertTrailing(hunk, insert) { + while (insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + } + } + function collectChange(state) { + var ret = [], + operation = state.lines[state.index][0]; + while (state.index < state.lines.length) { + var line = state.lines[state.index]; + + // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. + if (operation === '-' && line[0] === '+') { + operation = '+'; + } + if (operation === line[0]) { + ret.push(line); + state.index++; + } else { + break; + } + } + return ret; + } + function collectContext(state, matchChanges) { + var changes = [], + merged = [], + matchIndex = 0, + contextChanges = false, + conflicted = false; + while (matchIndex < matchChanges.length && state.index < state.lines.length) { + var change = state.lines[state.index], + match = matchChanges[matchIndex]; + + // Once we've hit our add, then we are done + if (match[0] === '+') { + break; + } + contextChanges = contextChanges || change[0] !== ' '; + merged.push(match); + matchIndex++; + + // Consume any additions in the other block as a conflict to attempt + // to pull in the remaining context after this + if (change[0] === '+') { + conflicted = true; + while (change[0] === '+') { + changes.push(change); + change = state.lines[++state.index]; + } + } + if (match.substr(1) === change.substr(1)) { + changes.push(change); + state.index++; + } else { + conflicted = true; + } + } + if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { + conflicted = true; + } + if (conflicted) { + return changes; + } + while (matchIndex < matchChanges.length) { + merged.push(matchChanges[matchIndex++]); + } + return { + merged: merged, + changes: changes + }; + } + function allRemoves(changes) { + return changes.reduce(function (prev, change) { + return prev && change[0] === '-'; + }, true); + } + function skipRemoveSuperset(state, removeChanges, delta) { + for (var i = 0; i < delta; i++) { + var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); + if (state.lines[state.index + i] !== ' ' + changeContent) { + return false; + } + } + state.index += delta; + return true; + } + function calcOldNewLineCount(lines) { + var oldLines = 0; + var newLines = 0; + lines.forEach(function (line) { + if (typeof line !== 'string') { + var myCount = calcOldNewLineCount(line.mine); + var theirCount = calcOldNewLineCount(line.theirs); + if (oldLines !== undefined) { + if (myCount.oldLines === theirCount.oldLines) { + oldLines += myCount.oldLines; + } else { + oldLines = undefined; + } + } + if (newLines !== undefined) { + if (myCount.newLines === theirCount.newLines) { + newLines += myCount.newLines; + } else { + newLines = undefined; + } + } + } else { + if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { + newLines++; + } + if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { + oldLines++; + } + } + }); + return { + oldLines: oldLines, + newLines: newLines + }; + } + + function reversePatch(structuredPatch) { + if (Array.isArray(structuredPatch)) { + return structuredPatch.map(reversePatch).reverse(); + } + return _objectSpread2(_objectSpread2({}, structuredPatch), {}, { + oldFileName: structuredPatch.newFileName, + oldHeader: structuredPatch.newHeader, + newFileName: structuredPatch.oldFileName, + newHeader: structuredPatch.oldHeader, + hunks: structuredPatch.hunks.map(function (hunk) { + return { + oldLines: hunk.newLines, + oldStart: hunk.newStart, + newLines: hunk.oldLines, + newStart: hunk.oldStart, + lines: hunk.lines.map(function (l) { + if (l.startsWith('-')) { + return "+".concat(l.slice(1)); + } + if (l.startsWith('+')) { + return "-".concat(l.slice(1)); + } + return l; + }) + }; + }) + }); + } + + // See: http://code.google.com/p/google-diff-match-patch/wiki/API + function convertChangesToDMP(changes) { + var ret = [], + change, + operation; + for (var i = 0; i < changes.length; i++) { + change = changes[i]; + if (change.added) { + operation = 1; + } else if (change.removed) { + operation = -1; + } else { + operation = 0; + } + ret.push([operation, change.value]); + } + return ret; + } + + function convertChangesToXML(changes) { + var ret = []; + for (var i = 0; i < changes.length; i++) { + var change = changes[i]; + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + ret.push(escapeHTML(change.value)); + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + } + return ret.join(''); + } + function escapeHTML(s) { + var n = s; + n = n.replace(/&/g, '&'); + n = n.replace(//g, '>'); + n = n.replace(/"/g, '"'); + return n; + } + + exports.Diff = Diff; + exports.applyPatch = applyPatch; + exports.applyPatches = applyPatches; + exports.canonicalize = canonicalize; + exports.convertChangesToDMP = convertChangesToDMP; + exports.convertChangesToXML = convertChangesToXML; + exports.createPatch = createPatch; + exports.createTwoFilesPatch = createTwoFilesPatch; + exports.diffArrays = diffArrays; + exports.diffChars = diffChars; + exports.diffCss = diffCss; + exports.diffJson = diffJson; + exports.diffLines = diffLines; + exports.diffSentences = diffSentences; + exports.diffTrimmedLines = diffTrimmedLines; + exports.diffWords = diffWords; + exports.diffWordsWithSpace = diffWordsWithSpace; + exports.formatPatch = formatPatch; + exports.merge = merge; + exports.parsePatch = parsePatch; + exports.reversePatch = reversePatch; + exports.structuredPatch = structuredPatch; + +})); diff --git a/node_modules/npm/node_modules/diff/dist/diff.min.js b/node_modules/npm/node_modules/diff/dist/diff.min.js new file mode 100644 index 00000000..4d96b763 --- /dev/null +++ b/node_modules/npm/node_modules/diff/dist/diff.min.js @@ -0,0 +1,37 @@ +/*! + + diff v7.0.0 + +BSD 3-Clause License + +Copyright (c) 2009-2015, Kevin Decker +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. + +3. Neither the name of the copyright holder 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 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. + +@license +*/ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Diff={})}(this,function(e){"use strict";function r(){}function w(e,n,t,r,i){for(var o,l=[];n;)l.push(n),o=n.previousComponent,delete n.previousComponent,n=o;l.reverse();for(var a=0,u=l.length,s=0,f=0;ae.length?n:e}),d.value=e.join(c)):d.value=e.join(t.slice(s,s+d.count)),s+=d.count,d.added||(f+=d.count))}return l}r.prototype={diff:function(l,a){var u=2=d&&c<=v+1)return f(w(s,p[0].lastComponent,a,l,s.useLongestToken));var g=-1/0,m=1/0;function i(){for(var e=Math.max(g,-h);e<=Math.min(m,h);e+=2){var n=void 0,t=p[e-1],r=p[e+1],i=(t&&(p[e-1]=void 0),!1),o=(r&&(o=r.oldPos-e,i=r&&0<=o&&o=d&&c<=v+1)return f(w(s,n.lastComponent,a,l,s.useLongestToken));(p[e]=n).oldPos+1>=d&&(m=Math.min(m,e-1)),c<=v+1&&(g=Math.max(g,e+1))}else p[e]=void 0}h++}if(n)!function e(){setTimeout(function(){if(tr)return n();i()||e()},0)}();else for(;h<=t&&Date.now()<=r;){var o=i();if(o)return o}},addToPath:function(e,n,t,r,i){var o=e.lastComponent;return o&&!i.oneChangePerToken&&o.added===n&&o.removed===t?{oldPos:e.oldPos+r,lastComponent:{count:o.count+1,added:n,removed:t,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:n,removed:t,previousComponent:o}}},extractCommon:function(e,n,t,r,i){for(var o=n.length,l=t.length,a=e.oldPos,u=a-r,s=0;u+1n.length&&(t=e.length-n.length);var r=n.length;e.lengthe.length)&&(n=e.length);for(var t=0,r=new Array(n);te.length)return!1;for(var t=0;t"):r.removed&&n.push(""),n.push(r.value.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")),r.added?n.push(""):r.removed&&n.push("")}return n.join("")},e.createPatch=function(e,n,t,r,i,o){return M(e,e,n,t,r,i,o)},e.createTwoFilesPatch=M,e.diffArrays=function(e,n,t){return F.diff(e,n,t)},e.diffChars=function(e,n,t){return I.diff(e,n,t)},e.diffCss=function(e,n,t){return m.diff(e,n,t)},e.diffJson=function(e,n,t){return x.diff(e,n,t)},e.diffLines=y,e.diffSentences=function(e,n,t){return g.diff(e,n,t)},e.diffTrimmedLines=function(e,n,t){return t=function(e,n){if("function"==typeof e)n.callback=e;else if(e)for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}(t,{ignoreWhitespace:!0}),v.diff(e,n,t)},e.diffWords=function(e,n,t){return null==(null==t?void 0:t.ignoreWhitespace)||t.ignoreWhitespace?i.diff(e,n,t):a(e,n,t)},e.diffWordsWithSpace=a,e.formatPatch=E,e.merge=function(e,n,t){e=J(e,t),n=J(n,t);for(var r={},i=((e.index||n.index)&&(r.index=e.index||n.index),(e.newFileName||n.newFileName)&&(q(e)?q(n)?(r.oldFileName=H(r,e.oldFileName,n.oldFileName),r.newFileName=H(r,e.newFileName,n.newFileName),r.oldHeader=H(r,e.oldHeader,n.oldHeader),r.newHeader=H(r,e.newHeader,n.newHeader)):(r.oldFileName=e.oldFileName,r.newFileName=e.newFileName,r.oldHeader=e.oldHeader,r.newHeader=e.newHeader):(r.oldFileName=n.oldFileName||e.oldFileName,r.newFileName=n.newFileName||e.newFileName,r.oldHeader=n.oldHeader||e.oldHeader,r.newHeader=n.newHeader||e.newHeader)),r.hunks=[],0),o=0,l=0,a=0;i'); + } else if (change.removed) { + ret.push(''); + } + ret.push(escapeHTML(change.value)); + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + } + return ret.join(''); +} +function escapeHTML(s) { + var n = s; + n = n.replace(/&/g, '&'); + n = n.replace(//g, '>'); + n = n.replace(/"/g, '"'); + return n; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJjb252ZXJ0Q2hhbmdlc1RvWE1MIiwiY2hhbmdlcyIsInJldCIsImkiLCJsZW5ndGgiLCJjaGFuZ2UiLCJhZGRlZCIsInB1c2giLCJyZW1vdmVkIiwiZXNjYXBlSFRNTCIsInZhbHVlIiwiam9pbiIsInMiLCJuIiwicmVwbGFjZSJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L3htbC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gY29udmVydENoYW5nZXNUb1hNTChjaGFuZ2VzKSB7XG4gIGxldCByZXQgPSBbXTtcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBjaGFuZ2VzLmxlbmd0aDsgaSsrKSB7XG4gICAgbGV0IGNoYW5nZSA9IGNoYW5nZXNbaV07XG4gICAgaWYgKGNoYW5nZS5hZGRlZCkge1xuICAgICAgcmV0LnB1c2goJzxpbnM+Jyk7XG4gICAgfSBlbHNlIGlmIChjaGFuZ2UucmVtb3ZlZCkge1xuICAgICAgcmV0LnB1c2goJzxkZWw+Jyk7XG4gICAgfVxuXG4gICAgcmV0LnB1c2goZXNjYXBlSFRNTChjaGFuZ2UudmFsdWUpKTtcblxuICAgIGlmIChjaGFuZ2UuYWRkZWQpIHtcbiAgICAgIHJldC5wdXNoKCc8L2lucz4nKTtcbiAgICB9IGVsc2UgaWYgKGNoYW5nZS5yZW1vdmVkKSB7XG4gICAgICByZXQucHVzaCgnPC9kZWw+Jyk7XG4gICAgfVxuICB9XG4gIHJldHVybiByZXQuam9pbignJyk7XG59XG5cbmZ1bmN0aW9u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UNBLE9BQU9MLEdBQUcsQ0FBQ1MsSUFBSSxDQUFDLEVBQUUsQ0FBQztBQUNyQjtBQUVBLFNBQVNGLFVBQVVBLENBQUNHLENBQUMsRUFBRTtFQUNyQixJQUFJQyxDQUFDLEdBQUdELENBQUM7RUFDVEMsQ0FBQyxHQUFHQSxDQUFDLENBQUNDLE9BQU8sQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDO0VBQzVCRCxDQUFDLEdBQUdBLENBQUMsQ0FBQ0MsT0FBTyxDQUFDLElBQUksRUFBRSxNQUFNLENBQUM7RUFDM0JELENBQUMsR0FBR0EsQ0FBQyxDQUFDQyxPQUFPLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQztFQUMzQkQsQ0FBQyxHQUFHQSxDQUFDLENBQUNDLE9BQU8sQ0FBQyxJQUFJLEVBQUUsUUFBUSxDQUFDO0VBRTdCLE9BQU9ELENBQUM7QUFDViIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/node_modules/npm/node_modules/diff/lib/diff/array.js b/node_modules/npm/node_modules/diff/lib/diff/array.js new file mode 100644 index 00000000..bd0802db --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/diff/array.js @@ -0,0 +1,39 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.arrayDiff = void 0; +exports.diffArrays = diffArrays; +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_base = _interopRequireDefault(require("./base")) +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/*istanbul ignore end*/ +var arrayDiff = +/*istanbul ignore start*/ +exports.arrayDiff = +/*istanbul ignore end*/ +new +/*istanbul ignore start*/ +_base +/*istanbul ignore end*/ +[ +/*istanbul ignore start*/ +"default" +/*istanbul ignore end*/ +](); +arrayDiff.tokenize = function (value) { + return value.slice(); +}; +arrayDiff.join = arrayDiff.removeEmpty = function (value) { + return value; +}; +function diffArrays(oldArr, newArr, callback) { + return arrayDiff.diff(oldArr, newArr, callback); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfYmFzZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwib2JqIiwiX19lc01vZHVsZSIsImFycmF5RGlmZiIsImV4cG9ydHMiLCJEaWZmIiwidG9rZW5pemUiLCJ2YWx1ZSIsInNsaWNlIiwiam9pbiIsInJlbW92ZUVtcHR5IiwiZGlmZkFycmF5cyIsIm9sZEFyciIsIm5ld0FyciIsImNhbGxiYWNrIiwiZGlmZiJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2FycmF5LmpzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBhcnJheURpZmYgPSBuZXcgRGlmZigpO1xuYXJyYXlEaWZmLnRva2VuaXplID0gZnVuY3Rpb24odmFsdWUpIHtcbiAgcmV0dXJuIHZhbHVlLnNsaWNlKCk7XG59O1xuYXJyYXlEaWZmLmpvaW4gPSBhcnJheURpZmYucmVtb3ZlRW1wdHkgPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWU7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZkFycmF5cyhvbGRBcnIsIG5ld0FyciwgY2FsbGJhY2spIHsgcmV0dXJuIGFycmF5RGlmZi5kaWZmKG9sZEFyciwgbmV3QXJyLCBjYWxsYmFjayk7IH1cbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBQSxLQUFBLEdBQUFDLHNCQUFBLENBQUFDLE9BQUE7QUFBQTtBQUFBO0FBQTBCLG1DQUFBRCx1QkFBQUUsR0FBQSxXQUFBQSxHQUFBLElBQUFBLEdBQUEsQ0FBQUMsVUFBQSxHQUFBRCxHQUFBLGdCQUFBQSxHQUFBO0FBQUE7QUFFbkIsSUFBTUUsU0FBUztBQUFBO0FBQUFDLE9BQUEsQ0FBQUQsU0FBQTtBQUFBO0FBQUc7QUFBSUU7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUEsQ0FBSSxDQUFDLENBQUM7QUFDbkNGLFNBQVMsQ0FBQ0csUUFBUSxHQUFHLFVBQVNDLEtBQUssRUFBRTtFQUNuQyxPQUFPQSxLQUFLLENBQUNDLEtBQUssQ0FBQyxDQUFDO0FBQ3RCLENBQUM7QUFDREwsU0FBUyxDQUFDTSxJQUFJLEdBQUdOLFNBQVMsQ0FBQ08sV0FBVyxHQUFHLFVBQVNILEtBQUssRUFBRTtFQUN2RCxPQUFPQSxLQUFLO0FBQ2QsQ0FBQztBQUVNLFNBQVNJLFVBQVVBLENBQUNDLE1BQU0sRUFBRUMsTUFBTSxFQUFFQyxRQUFRLEVBQUU7RUFBRSxPQUFPWCxTQUFTLENBQUNZLElBQUksQ0FBQ0gsTUFBTSxFQUFFQyxNQUFNLEVBQUVDLFFBQVEsQ0FBQztBQUFFIiwiaWdub3JlTGlzdCI6W119 diff --git a/node_modules/npm/node_modules/diff/lib/diff/base.js b/node_modules/npm/node_modules/diff/lib/diff/base.js new file mode 100644 index 00000000..d2b4b447 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/diff/base.js @@ -0,0 +1,304 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = Diff; +/*istanbul ignore end*/ +function Diff() {} +Diff.prototype = { + /*istanbul ignore start*/ + /*istanbul ignore end*/ + diff: function diff(oldString, newString) { + /*istanbul ignore start*/ + var _options$timeout; + var + /*istanbul ignore end*/ + options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var callback = options.callback; + if (typeof options === 'function') { + callback = options; + options = {}; + } + var self = this; + function done(value) { + value = self.postProcess(value, options); + if (callback) { + setTimeout(function () { + callback(value); + }, 0); + return true; + } else { + return value; + } + } + + // Allow subclasses to massage the input prior to running + oldString = this.castInput(oldString, options); + newString = this.castInput(newString, options); + oldString = this.removeEmpty(this.tokenize(oldString, options)); + newString = this.removeEmpty(this.tokenize(newString, options)); + var newLen = newString.length, + oldLen = oldString.length; + var editLength = 1; + var maxEditLength = newLen + oldLen; + if (options.maxEditLength != null) { + maxEditLength = Math.min(maxEditLength, options.maxEditLength); + } + var maxExecutionTime = + /*istanbul ignore start*/ + (_options$timeout = + /*istanbul ignore end*/ + options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; + var abortAfterTimestamp = Date.now() + maxExecutionTime; + var bestPath = [{ + oldPos: -1, + lastComponent: undefined + }]; + + // Seed editLength = 0, i.e. the content starts with the same values + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options); + if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // Identity per the equality and tokenizer + return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken)); + } + + // Once we hit the right edge of the edit graph on some diagonal k, we can + // definitely reach the end of the edit graph in no more than k edits, so + // there's no point in considering any moves to diagonal k+1 any more (from + // which we're guaranteed to need at least k+1 more edits). + // Similarly, once we've reached the bottom of the edit graph, there's no + // point considering moves to lower diagonals. + // We record this fact by setting minDiagonalToConsider and + // maxDiagonalToConsider to some finite value once we've hit the edge of + // the edit graph. + // This optimization is not faithful to the original algorithm presented in + // Myers's paper, which instead pointlessly extends D-paths off the end of + // the edit graph - see page 7 of Myers's paper which notes this point + // explicitly and illustrates it with a diagram. This has major performance + // implications for some common scenarios. For instance, to compute a diff + // where the new text simply appends d characters on the end of the + // original text of length n, the true Myers algorithm will take O(n+d^2) + // time while this optimization needs only O(n+d) time. + var minDiagonalToConsider = -Infinity, + maxDiagonalToConsider = Infinity; + + // Main worker method. checks all permutations of a given edit length for acceptance. + function execEditLength() { + for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { + var basePath = + /*istanbul ignore start*/ + void 0 + /*istanbul ignore end*/ + ; + var removePath = bestPath[diagonalPath - 1], + addPath = bestPath[diagonalPath + 1]; + if (removePath) { + // No one else is going to attempt to use this value, clear it + bestPath[diagonalPath - 1] = undefined; + } + var canAdd = false; + if (addPath) { + // what newPos will be after we do an insertion: + var addPathNewPos = addPath.oldPos - diagonalPath; + canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; + } + var canRemove = removePath && removePath.oldPos + 1 < oldLen; + if (!canAdd && !canRemove) { + // If this path is a terminal then prune + bestPath[diagonalPath] = undefined; + continue; + } + + // Select the diagonal that we want to branch from. We select the prior + // path whose position in the old string is the farthest from the origin + // and does not pass the bounds of the diff graph + if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) { + basePath = self.addToPath(addPath, true, false, 0, options); + } else { + basePath = self.addToPath(removePath, false, true, 1, options); + } + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options); + if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // If we have hit the end of both strings, then we are done + return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); + } else { + bestPath[diagonalPath] = basePath; + if (basePath.oldPos + 1 >= oldLen) { + maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); + } + if (newPos + 1 >= newLen) { + minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); + } + } + } + editLength++; + } + + // Performs the length of edit iteration. Is a bit fugly as this has to support the + // sync and async mode which is never fun. Loops over execEditLength until a value + // is produced, or until the edit length exceeds options.maxEditLength (if given), + // in which case it will return undefined. + if (callback) { + (function exec() { + setTimeout(function () { + if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { + return callback(); + } + if (!execEditLength()) { + exec(); + } + }, 0); + })(); + } else { + while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { + var ret = execEditLength(); + if (ret) { + return ret; + } + } + } + }, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + addToPath: function addToPath(path, added, removed, oldPosInc, options) { + var last = path.lastComponent; + if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) { + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: last.count + 1, + added: added, + removed: removed, + previousComponent: last.previousComponent + } + }; + } else { + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: 1, + added: added, + removed: removed, + previousComponent: last + } + }; + } + }, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) { + var newLen = newString.length, + oldLen = oldString.length, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, + commonCount = 0; + while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) { + newPos++; + oldPos++; + commonCount++; + if (options.oneChangePerToken) { + basePath.lastComponent = { + count: 1, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } + } + if (commonCount && !options.oneChangePerToken) { + basePath.lastComponent = { + count: commonCount, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } + basePath.oldPos = oldPos; + return newPos; + }, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + equals: function equals(left, right, options) { + if (options.comparator) { + return options.comparator(left, right); + } else { + return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase(); + } + }, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + removeEmpty: function removeEmpty(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + if (array[i]) { + ret.push(array[i]); + } + } + return ret; + }, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + castInput: function castInput(value) { + return value; + }, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + tokenize: function tokenize(value) { + return Array.from(value); + }, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + join: function join(chars) { + return chars.join(''); + }, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + postProcess: function postProcess(changeObjects) { + return changeObjects; + } +}; +function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { + // First we convert our linked list of components in reverse order to an + // array in the right order: + var components = []; + var nextComponent; + while (lastComponent) { + components.push(lastComponent); + nextComponent = lastComponent.previousComponent; + delete lastComponent.previousComponent; + lastComponent = nextComponent; + } + components.reverse(); + var componentPos = 0, + componentLen = components.length, + newPos = 0, + oldPos = 0; + for (; componentPos < componentLen; componentPos++) { + var component = components[componentPos]; + if (!component.removed) { + if (!component.added && useLongestToken) { + var value = newString.slice(newPos, newPos + component.count); + value = value.map(function (value, i) { + var oldValue = oldString[oldPos + i]; + return oldValue.length > value.length ? oldValue : value; + }); + component.value = diff.join(value); + } else { + component.value = diff.join(newString.slice(newPos, newPos + component.count)); + } + newPos += component.count; + + // Common case + if (!component.added) { + oldPos += component.count; + } + } else { + component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); + oldPos += component.count; + } + } + return components; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJEaWZmIiwicHJvdG90eXBlIiwiZGlmZiIsIm9sZFN0cmluZyIsIm5ld1N0cmluZyIsIl9vcHRpb25zJHRpbWVvdXQiLCJvcHRpb25zIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwidW5kZWZpbmVkIiwiY2FsbGJhY2siLCJzZWxmIiwiZG9uZSIsInZhbHVlIiwicG9zdFByb2Nlc3MiLCJzZXRUaW1lb3V0IiwiY2FzdElucHV0IiwicmVtb3ZlRW1wdHkiLCJ0b2tlbml6ZSIsIm5ld0xlbiIsIm9sZExlbiIsImVkaXRMZW5ndGgiLCJtYXhFZGl0TGVuZ3RoIiwiTWF0aCIsIm1pbiIsIm1heEV4ZWN1dGlvblRpbWUiLCJ0aW1lb3V0IiwiSW5maW5pdHkiLCJhYm9ydEFmdGVyVGltZXN0YW1wIiwiRGF0ZSIsIm5vdyIsImJlc3RQYXRoIiwib2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QUFJLENBQUNyRSxTQUFTLENBQUM4RSxLQUFLLENBQUNqRCxNQUFNLEVBQUVBLE1BQU0sR0FBR2dELFNBQVMsQ0FBQ3RCLEtBQUssQ0FBQyxDQUFDO01BQzlFMUIsTUFBTSxJQUFJZ0QsU0FBUyxDQUFDdEIsS0FBSztJQUMzQjtFQUNGO0VBRUEsT0FBT2lCLFVBQVU7QUFDbkIiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/node_modules/npm/node_modules/diff/lib/diff/character.js b/node_modules/npm/node_modules/diff/lib/diff/character.js new file mode 100644 index 00000000..6a3cf1c4 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/diff/character.js @@ -0,0 +1,33 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.characterDiff = void 0; +exports.diffChars = diffChars; +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_base = _interopRequireDefault(require("./base")) +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/*istanbul ignore end*/ +var characterDiff = +/*istanbul ignore start*/ +exports.characterDiff = +/*istanbul ignore end*/ +new +/*istanbul ignore start*/ +_base +/*istanbul ignore end*/ +[ +/*istanbul ignore start*/ +"default" +/*istanbul ignore end*/ +](); +function diffChars(oldStr, newStr, options) { + return characterDiff.diff(oldStr, newStr, options); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfYmFzZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwib2JqIiwiX19lc01vZHVsZSIsImNoYXJhY3RlckRpZmYiLCJleHBvcnRzIiwiRGlmZiIsImRpZmZDaGFycyIsIm9sZFN0ciIsIm5ld1N0ciIsIm9wdGlvbnMiLCJkaWZmIl0sInNvdXJjZXMiOlsiLi4vLi4vc3JjL2RpZmYvY2hhcmFjdGVyLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBjaGFyYWN0ZXJEaWZmID0gbmV3IERpZmYoKTtcbmV4cG9ydCBmdW5jdGlvbiBkaWZmQ2hhcnMob2xkU3RyLCBuZXdTdHIsIG9wdGlvbnMpIHsgcmV0dXJuIGNoYXJhY3RlckRpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgb3B0aW9ucyk7IH1cbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBQSxLQUFBLEdBQUFDLHNCQUFBLENBQUFDLE9BQUE7QUFBQTtBQUFBO0FBQTBCLG1DQUFBRCx1QkFBQUUsR0FBQSxXQUFBQSxHQUFBLElBQUFBLEdBQUEsQ0FBQUMsVUFBQSxHQUFBRCxHQUFBLGdCQUFBQSxHQUFBO0FBQUE7QUFFbkIsSUFBTUUsYUFBYTtBQUFBO0FBQUFDLE9BQUEsQ0FBQUQsYUFBQTtBQUFBO0FBQUc7QUFBSUU7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUEsQ0FBSSxDQUFDLENBQUM7QUFDaEMsU0FBU0MsU0FBU0EsQ0FBQ0MsTUFBTSxFQUFFQyxNQUFNLEVBQUVDLE9BQU8sRUFBRTtFQUFFLE9BQU9OLGFBQWEsQ0FBQ08sSUFBSSxDQUFDSCxNQUFNLEVBQUVDLE1BQU0sRUFBRUMsT0FBTyxDQUFDO0FBQUUiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/node_modules/npm/node_modules/diff/lib/diff/css.js b/node_modules/npm/node_modules/diff/lib/diff/css.js new file mode 100644 index 00000000..63218278 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/diff/css.js @@ -0,0 +1,36 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.cssDiff = void 0; +exports.diffCss = diffCss; +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_base = _interopRequireDefault(require("./base")) +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/*istanbul ignore end*/ +var cssDiff = +/*istanbul ignore start*/ +exports.cssDiff = +/*istanbul ignore end*/ +new +/*istanbul ignore start*/ +_base +/*istanbul ignore end*/ +[ +/*istanbul ignore start*/ +"default" +/*istanbul ignore end*/ +](); +cssDiff.tokenize = function (value) { + return value.split(/([{}:;,]|\s+)/); +}; +function diffCss(oldStr, newStr, callback) { + return cssDiff.diff(oldStr, newStr, callback); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfYmFzZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwib2JqIiwiX19lc01vZHVsZSIsImNzc0RpZmYiLCJleHBvcnRzIiwiRGlmZiIsInRva2VuaXplIiwidmFsdWUiLCJzcGxpdCIsImRpZmZDc3MiLCJvbGRTdHIiLCJuZXdTdHIiLCJjYWxsYmFjayIsImRpZmYiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvZGlmZi9jc3MuanMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IERpZmYgZnJvbSAnLi9iYXNlJztcblxuZXhwb3J0IGNvbnN0IGNzc0RpZmYgPSBuZXcgRGlmZigpO1xuY3NzRGlmZi50b2tlbml6ZSA9IGZ1bmN0aW9uKHZhbHVlKSB7XG4gIHJldHVybiB2YWx1ZS5zcGxpdCgvKFt7fTo7LF18XFxzKykvKTtcbn07XG5cbmV4cG9ydCBmdW5jdGlvbiBkaWZmQ3NzKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjaykgeyByZXR1cm4gY3NzRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7IH1cbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBQSxLQUFBLEdBQUFDLHNCQUFBLENBQUFDLE9BQUE7QUFBQTtBQUFBO0FBQTBCLG1DQUFBRCx1QkFBQUUsR0FBQSxXQUFBQSxHQUFBLElBQUFBLEdBQUEsQ0FBQUMsVUFBQSxHQUFBRCxHQUFBLGdCQUFBQSxHQUFBO0FBQUE7QUFFbkIsSUFBTUUsT0FBTztBQUFBO0FBQUFDLE9BQUEsQ0FBQUQsT0FBQTtBQUFBO0FBQUc7QUFBSUU7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUE7QUFBQUEsQ0FBSSxDQUFDLENBQUM7QUFDakNGLE9BQU8sQ0FBQ0csUUFBUSxHQUFHLFVBQVNDLEtBQUssRUFBRTtFQUNqQyxPQUFPQSxLQUFLLENBQUNDLEtBQUssQ0FBQyxlQUFlLENBQUM7QUFDckMsQ0FBQztBQUVNLFNBQVNDLE9BQU9BLENBQUNDLE1BQU0sRUFBRUMsTUFBTSxFQUFFQyxRQUFRLEVBQUU7RUFBRSxPQUFPVCxPQUFPLENBQUNVLElBQUksQ0FBQ0gsTUFBTSxFQUFFQyxNQUFNLEVBQUVDLFFBQVEsQ0FBQztBQUFFIiwiaWdub3JlTGlzdCI6W119 diff --git a/node_modules/npm/node_modules/diff/lib/diff/json.js b/node_modules/npm/node_modules/diff/lib/diff/json.js new file mode 100644 index 00000000..a3f07480 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/diff/json.js @@ -0,0 +1,143 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.canonicalize = canonicalize; +exports.diffJson = diffJson; +exports.jsonDiff = void 0; +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_base = _interopRequireDefault(require("./base")) +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_line = require("./line") +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +/*istanbul ignore end*/ +var jsonDiff = +/*istanbul ignore start*/ +exports.jsonDiff = +/*istanbul ignore end*/ +new +/*istanbul ignore start*/ +_base +/*istanbul ignore end*/ +[ +/*istanbul ignore start*/ +"default" +/*istanbul ignore end*/ +](); +// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a +// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: +jsonDiff.useLongestToken = true; +jsonDiff.tokenize = +/*istanbul ignore start*/ +_line +/*istanbul ignore end*/ +. +/*istanbul ignore start*/ +lineDiff +/*istanbul ignore end*/ +.tokenize; +jsonDiff.castInput = function (value, options) { + var + /*istanbul ignore start*/ + /*istanbul ignore end*/ + undefinedReplacement = options.undefinedReplacement, + /*istanbul ignore start*/ + _options$stringifyRep = + /*istanbul ignore end*/ + options.stringifyReplacer, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + stringifyReplacer = _options$stringifyRep === void 0 ? function (k, v) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + typeof v === 'undefined' ? undefinedReplacement : v + ); + } : _options$stringifyRep; + return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); +}; +jsonDiff.equals = function (left, right, options) { + return ( + /*istanbul ignore start*/ + _base + /*istanbul ignore end*/ + [ + /*istanbul ignore start*/ + "default" + /*istanbul ignore end*/ + ].prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options) + ); +}; +function diffJson(oldObj, newObj, options) { + return jsonDiff.diff(oldObj, newObj, options); +} + +// This function handles the presence of circular references by bailing out when encountering an +// object that is already on the "stack" of items being processed. Accepts an optional replacer +function canonicalize(obj, stack, replacementStack, replacer, key) { + stack = stack || []; + replacementStack = replacementStack || []; + if (replacer) { + obj = replacer(key, obj); + } + var i; + for (i = 0; i < stack.length; i += 1) { + if (stack[i] === obj) { + return replacementStack[i]; + } + } + var canonicalizedObj; + if ('[object Array]' === Object.prototype.toString.call(obj)) { + stack.push(obj); + canonicalizedObj = new Array(obj.length); + replacementStack.push(canonicalizedObj); + for (i = 0; i < obj.length; i += 1) { + canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); + } + stack.pop(); + replacementStack.pop(); + return canonicalizedObj; + } + if (obj && obj.toJSON) { + obj = obj.toJSON(); + } + if ( + /*istanbul ignore start*/ + _typeof( + /*istanbul ignore end*/ + obj) === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + replacementStack.push(canonicalizedObj); + var sortedKeys = [], + _key; + for (_key in obj) { + /* istanbul ignore else */ + if (Object.prototype.hasOwnProperty.call(obj, _key)) { + sortedKeys.push(_key); + } + } + sortedKeys.sort(); + for (i = 0; i < sortedKeys.length; i += 1) { + _key = sortedKeys[i]; + canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); + } + stack.pop(); + replacementStack.pop(); + } else { + canonicalizedObj = obj; + } + return canonicalizedObj; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfYmFzZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwiX2xpbmUiLCJvYmoiLCJfX2VzTW9kdWxlIiwiX3R5cGVvZiIsIm8iLCJTeW1ib2wiLCJpdGVyYXRvciIsImNvbnN0cnVjdG9yIiwicHJvdG90eXBlIiwianNvbkRpZmYiLCJleHBvcnRzIiwiRGlmZiIsInVzZUxvbmdlc3RUb2tlbiIsInRva2VuaXplIiwibGluZURpZmYiLCJjYXN0SW5wdXQiLCJ2YWx1ZSIsIm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LENBQUN4QixHQUFHLENBQUNxQyxJQUFHLENBQUMsRUFBRUgsS0FBSyxFQUFFQyxnQkFBZ0IsRUFBRUMsUUFBUSxFQUFFQyxJQUFHLENBQUM7SUFDeEY7SUFDQUgsS0FBSyxDQUFDVyxHQUFHLENBQUMsQ0FBQztJQUNYVixnQkFBZ0IsQ0FBQ1UsR0FBRyxDQUFDLENBQUM7RUFDeEIsQ0FBQyxNQUFNO0lBQ0xMLGdCQUFnQixHQUFHeEMsR0FBRztFQUN4QjtFQUNBLE9BQU93QyxnQkFBZ0I7QUFDekIiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/node_modules/npm/node_modules/diff/lib/diff/line.js b/node_modules/npm/node_modules/diff/lib/diff/line.js new file mode 100644 index 00000000..71f3f247 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/diff/line.js @@ -0,0 +1,121 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.diffLines = diffLines; +exports.diffTrimmedLines = diffTrimmedLines; +exports.lineDiff = void 0; +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_base = _interopRequireDefault(require("./base")) +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_params = require("../util/params") +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/*istanbul ignore end*/ +var lineDiff = +/*istanbul ignore start*/ +exports.lineDiff = +/*istanbul ignore end*/ +new +/*istanbul ignore start*/ +_base +/*istanbul ignore end*/ +[ +/*istanbul ignore start*/ +"default" +/*istanbul ignore end*/ +](); +lineDiff.tokenize = function (value, options) { + if (options.stripTrailingCr) { + // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior + value = value.replace(/\r\n/g, '\n'); + } + var retLines = [], + linesAndNewlines = value.split(/(\n|\r\n)/); + + // Ignore the final empty token that occurs if the string ends with a new line + if (!linesAndNewlines[linesAndNewlines.length - 1]) { + linesAndNewlines.pop(); + } + + // Merge the content and line separators into single tokens + for (var i = 0; i < linesAndNewlines.length; i++) { + var line = linesAndNewlines[i]; + if (i % 2 && !options.newlineIsToken) { + retLines[retLines.length - 1] += line; + } else { + retLines.push(line); + } + } + return retLines; +}; +lineDiff.equals = function (left, right, options) { + // If we're ignoring whitespace, we need to normalise lines by stripping + // whitespace before checking equality. (This has an annoying interaction + // with newlineIsToken that requires special handling: if newlines get their + // own token, then we DON'T want to trim the *newline* tokens down to empty + // strings, since this would cause us to treat whitespace-only line content + // as equal to a separator between lines, which would be weird and + // inconsistent with the documented behavior of the options.) + if (options.ignoreWhitespace) { + if (!options.newlineIsToken || !left.includes('\n')) { + left = left.trim(); + } + if (!options.newlineIsToken || !right.includes('\n')) { + right = right.trim(); + } + } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) { + if (left.endsWith('\n')) { + left = left.slice(0, -1); + } + if (right.endsWith('\n')) { + right = right.slice(0, -1); + } + } + return ( + /*istanbul ignore start*/ + _base + /*istanbul ignore end*/ + [ + /*istanbul ignore start*/ + "default" + /*istanbul ignore end*/ + ].prototype.equals.call(this, left, right, options) + ); +}; +function diffLines(oldStr, newStr, callback) { + return lineDiff.diff(oldStr, newStr, callback); +} + +// Kept for backwards compatibility. This is a rather arbitrary wrapper method +// that just calls `diffLines` with `ignoreWhitespace: true`. It's confusing to +// have two ways to do exactly the same thing in the API, so we no longer +// document this one (library users should explicitly use `diffLines` with +// `ignoreWhitespace: true` instead) but we keep it around to maintain +// compatibility with code that used old versions. +function diffTrimmedLines(oldStr, newStr, callback) { + var options = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _params + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + generateOptions) + /*istanbul ignore end*/ + (callback, { + ignoreWhitespace: true + }); + return lineDiff.diff(oldStr, newStr, options); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfYm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9BQU8sQ0FBQztBQUMvQyIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/node_modules/npm/node_modules/diff/lib/diff/sentence.js b/node_modules/npm/node_modules/diff/lib/diff/sentence.js new file mode 100644 index 00000000..66d8ece2 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/diff/sentence.js @@ -0,0 +1,36 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.diffSentences = diffSentences; +exports.sentenceDiff = void 0; +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_base = _interopRequireDefault(require("./base")) +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/*istanbul ignore end*/ +var sentenceDiff = +/*istanbul ignore start*/ +exports.sentenceDiff = +/*istanbul ignore end*/ +new +/*istanbul ignore start*/ +_base +/*istanbul ignore end*/ +[ +/*istanbul ignore start*/ +"default" +/*istanbul ignore end*/ +](); +sentenceDiff.tokenize = function (value) { + return value.split(/(\S.+?[.!?])(?=\s+|$)/); +}; +function diffSentences(oldStr, newStr, callback) { + return sentenceDiff.diff(oldStr, newStr, callback); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfYmFzZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwib2JqIiwiX19lc01vZHVsZSIsInNlbnRlbmNlRGlmZiIsImV4cG9ydHMiLCJEaWZmIiwidG9rZW5pemUiLCJ2YWx1ZSIsInNwbGl0IiwiZGlmZlNlbnRlbmNlcyIsIm9sZFN0ciIsIm5ld1N0ciIsImNhbGxiYWNrIiwiZGlmZiJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3NlbnRlbmNlLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cblxuZXhwb3J0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git a/node_modules/npm/node_modules/diff/lib/diff/word.js b/node_modules/npm/node_modules/diff/lib/diff/word.js new file mode 100644 index 00000000..64919db4 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/diff/word.js @@ -0,0 +1,543 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.diffWords = diffWords; +exports.diffWordsWithSpace = diffWordsWithSpace; +exports.wordWithSpaceDiff = exports.wordDiff = void 0; +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_base = _interopRequireDefault(require("./base")) +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_string = require("../util/string") +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/*istanbul ignore end*/ +// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode +// +// Ranges and exceptions: +// Latin-1 Supplement, 0080–00FF +// - U+00D7 × Multiplication sign +// - U+00F7 ÷ Division sign +// Latin Extended-A, 0100–017F +// Latin Extended-B, 0180–024F +// IPA Extensions, 0250–02AF +// Spacing Modifier Letters, 02B0–02FF +// - U+02C7 ˇ ˇ Caron +// - U+02D8 ˘ ˘ Breve +// - U+02D9 ˙ ˙ Dot Above +// - U+02DA ˚ ˚ Ring Above +// - U+02DB ˛ ˛ Ogonek +// - U+02DC ˜ ˜ Small Tilde +// - U+02DD ˝ ˝ Double Acute Accent +// Latin Extended Additional, 1E00–1EFF +var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}"; + +// Each token is one of the following: +// - A punctuation mark plus the surrounding whitespace +// - A word plus the surrounding whitespace +// - Pure whitespace (but only in the special case where this the entire text +// is just whitespace) +// +// We have to include surrounding whitespace in the tokens because the two +// alternative approaches produce horribly broken results: +// * If we just discard the whitespace, we can't fully reproduce the original +// text from the sequence of tokens and any attempt to render the diff will +// get the whitespace wrong. +// * If we have separate tokens for whitespace, then in a typical text every +// second token will be a single space character. But this often results in +// the optimal diff between two texts being a perverse one that preserves +// the spaces between words but deletes and reinserts actual common words. +// See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640 +// for an example. +// +// Keeping the surrounding whitespace of course has implications for .equals +// and .join, not just .tokenize. + +// This regex does NOT fully implement the tokenization rules described above. +// Instead, it gives runs of whitespace their own "token". The tokenize method +// then handles stitching whitespace tokens onto adjacent word or punctuation +// tokens. +var tokenizeIncludingWhitespace = new RegExp( +/*istanbul ignore start*/ +"[".concat( +/*istanbul ignore end*/ +extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), 'ug'); +var wordDiff = +/*istanbul ignore start*/ +exports.wordDiff = +/*istanbul ignore end*/ +new +/*istanbul ignore start*/ +_base +/*istanbul ignore end*/ +[ +/*istanbul ignore start*/ +"default" +/*istanbul ignore end*/ +](); +wordDiff.equals = function (left, right, options) { + if (options.ignoreCase) { + left = left.toLowerCase(); + right = right.toLowerCase(); + } + return left.trim() === right.trim(); +}; +wordDiff.tokenize = function (value) { + /*istanbul ignore start*/ + var + /*istanbul ignore end*/ + options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parts; + if (options.intlSegmenter) { + if (options.intlSegmenter.resolvedOptions().granularity != 'word') { + throw new Error('The segmenter passed must have a granularity of "word"'); + } + parts = Array.from(options.intlSegmenter.segment(value), function (segment) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + segment.segment + ); + }); + } else { + parts = value.match(tokenizeIncludingWhitespace) || []; + } + var tokens = []; + var prevPart = null; + parts.forEach(function (part) { + if (/\s/.test(part)) { + if (prevPart == null) { + tokens.push(part); + } else { + tokens.push(tokens.pop() + part); + } + } else if (/\s/.test(prevPart)) { + if (tokens[tokens.length - 1] == prevPart) { + tokens.push(tokens.pop() + part); + } else { + tokens.push(prevPart + part); + } + } else { + tokens.push(part); + } + prevPart = part; + }); + return tokens; +}; +wordDiff.join = function (tokens) { + // Tokens being joined here will always have appeared consecutively in the + // same text, so we can simply strip off the leading whitespace from all the + // tokens except the first (and except any whitespace-only tokens - but such + // a token will always be the first and only token anyway) and then join them + // and the whitespace around words and punctuation will end up correct. + return tokens.map(function (token, i) { + if (i == 0) { + return token; + } else { + return token.replace(/^\s+/, ''); + } + }).join(''); +}; +wordDiff.postProcess = function (changes, options) { + if (!changes || options.oneChangePerToken) { + return changes; + } + var lastKeep = null; + // Change objects representing any insertion or deletion since the last + // "keep" change object. There can be at most one of each. + var insertion = null; + var deletion = null; + changes.forEach(function (change) { + if (change.added) { + insertion = change; + } else if (change.removed) { + deletion = change; + } else { + if (insertion || deletion) { + // May be false at start of text + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change); + } + lastKeep = change; + insertion = null; + deletion = null; + } + }); + if (insertion || deletion) { + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null); + } + return changes; +}; +function diffWords(oldStr, newStr, options) { + // This option has never been documented and never will be (it's clearer to + // just call `diffWordsWithSpace` directly if you need that behavior), but + // has existed in jsdiff for a long time, so we retain support for it here + // for the sake of backwards compatibility. + if ( + /*istanbul ignore start*/ + ( + /*istanbul ignore end*/ + options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace) { + return diffWordsWithSpace(oldStr, newStr, options); + } + return wordDiff.diff(oldStr, newStr, options); +} +function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) { + // Before returning, we tidy up the leading and trailing whitespace of the + // change objects to eliminate cases where trailing whitespace in one object + // is repeated as leading whitespace in the next. + // Below are examples of the outcomes we want here to explain the code. + // I=insert, K=keep, D=delete + // 1. diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want: K:'foo ' D:'bar ' K:'baz' + // + // 2. Diffing 'foo bar baz' vs 'foo qux baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz' + // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz' + // + // 3. Diffing 'foo\nbar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:'\nbar ' K:' baz' + // After cleanup, we want K'foo' D:'\nbar' K:' baz' + // + // 4. Diffing 'foo baz' vs 'foo\nbar baz' + // Prior to cleanup, we have K:'foo\n' I:'\nbar ' K:' baz' + // After cleanup, we ideally want K'foo' I:'\nbar' K:' baz' + // but don't actually manage this currently (the pre-cleanup change + // objects don't contain enough information to make it possible). + // + // 5. Diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want K:'foo ' D:' bar ' K:'baz' + // + // Our handling is unavoidably imperfect in the case where there's a single + // indel between keeps and the whitespace has changed. For instance, consider + // diffing 'foo\tbar\nbaz' vs 'foo baz'. Unless we create an extra change + // object to represent the insertion of the space character (which isn't even + // a token), we have no way to avoid losing information about the texts' + // original whitespace in the result we return. Still, we do our best to + // output something that will look sensible if we e.g. print it with + // insertions in green and deletions in red. + + // Between two "keep" change objects (or before the first or after the last + // change object), we can have either: + // * A "delete" followed by an "insert" + // * Just an "insert" + // * Just a "delete" + // We handle the three cases separately. + if (deletion && insertion) { + var oldWsPrefix = deletion.value.match(/^\s*/)[0]; + var oldWsSuffix = deletion.value.match(/\s*$/)[0]; + var newWsPrefix = insertion.value.match(/^\s*/)[0]; + var newWsSuffix = insertion.value.match(/\s*$/)[0]; + if (startKeep) { + var commonWsPrefix = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + longestCommonPrefix) + /*istanbul ignore end*/ + (oldWsPrefix, newWsPrefix); + startKeep.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + replaceSuffix) + /*istanbul ignore end*/ + (startKeep.value, newWsPrefix, commonWsPrefix); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removePrefix) + /*istanbul ignore end*/ + (deletion.value, commonWsPrefix); + insertion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removePrefix) + /*istanbul ignore end*/ + (insertion.value, commonWsPrefix); + } + if (endKeep) { + var commonWsSuffix = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + longestCommonSuffix) + /*istanbul ignore end*/ + (oldWsSuffix, newWsSuffix); + endKeep.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + replacePrefix) + /*istanbul ignore end*/ + (endKeep.value, newWsSuffix, commonWsSuffix); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removeSuffix) + /*istanbul ignore end*/ + (deletion.value, commonWsSuffix); + insertion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removeSuffix) + /*istanbul ignore end*/ + (insertion.value, commonWsSuffix); + } + } else if (insertion) { + // The whitespaces all reflect what was in the new text rather than + // the old, so we essentially have no information about whitespace + // insertion or deletion. We just want to dedupe the whitespace. + // We do that by having each change object keep its trailing + // whitespace and deleting duplicate leading whitespace where + // present. + if (startKeep) { + insertion.value = insertion.value.replace(/^\s*/, ''); + } + if (endKeep) { + endKeep.value = endKeep.value.replace(/^\s*/, ''); + } + // otherwise we've got a deletion and no insertion + } else if (startKeep && endKeep) { + var newWsFull = endKeep.value.match(/^\s*/)[0], + delWsStart = deletion.value.match(/^\s*/)[0], + delWsEnd = deletion.value.match(/\s*$/)[0]; + + // Any whitespace that comes straight after startKeep in both the old and + // new texts, assign to startKeep and remove from the deletion. + var newWsStart = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + longestCommonPrefix) + /*istanbul ignore end*/ + (newWsFull, delWsStart); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removePrefix) + /*istanbul ignore end*/ + (deletion.value, newWsStart); + + // Any whitespace that comes straight before endKeep in both the old and + // new texts, and hasn't already been assigned to startKeep, assign to + // endKeep and remove from the deletion. + var newWsEnd = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + longestCommonSuffix) + /*istanbul ignore end*/ + ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removePrefix) + /*istanbul ignore end*/ + (newWsFull, newWsStart), delWsEnd); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removeSuffix) + /*istanbul ignore end*/ + (deletion.value, newWsEnd); + endKeep.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + replacePrefix) + /*istanbul ignore end*/ + (endKeep.value, newWsFull, newWsEnd); + + // If there's any whitespace from the new text that HASN'T already been + // assigned, assign it to the start: + startKeep.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + replaceSuffix) + /*istanbul ignore end*/ + (startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length)); + } else if (endKeep) { + // We are at the start of the text. Preserve all the whitespace on + // endKeep, and just remove whitespace from the end of deletion to the + // extent that it overlaps with the start of endKeep. + var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0]; + var deletionWsSuffix = deletion.value.match(/\s*$/)[0]; + var overlap = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + maximumOverlap) + /*istanbul ignore end*/ + (deletionWsSuffix, endKeepWsPrefix); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removeSuffix) + /*istanbul ignore end*/ + (deletion.value, overlap); + } else if (startKeep) { + // We are at the END of the text. Preserve all the whitespace on + // startKeep, and just remove whitespace from the start of deletion to + // the extent that it overlaps with the end of startKeep. + var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0]; + var deletionWsPrefix = deletion.value.match(/^\s*/)[0]; + var _overlap = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + maximumOverlap) + /*istanbul ignore end*/ + (startKeepWsSuffix, deletionWsPrefix); + deletion.value = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + removePrefix) + /*istanbul ignore end*/ + (deletion.value, _overlap); + } +} +var wordWithSpaceDiff = +/*istanbul ignore start*/ +exports.wordWithSpaceDiff = +/*istanbul ignore end*/ +new +/*istanbul ignore start*/ +_base +/*istanbul ignore end*/ +[ +/*istanbul ignore start*/ +"default" +/*istanbul ignore end*/ +](); +wordWithSpaceDiff.tokenize = function (value) { + // Slightly different to the tokenizeIncludingWhitespace regex used above in + // that this one treats each individual newline as a distinct tokens, rather + // than merging them into other surrounding whitespace. This was requested + // in https://github.com/kpdecker/jsdiff/issues/180 & + // https://github.com/kpdecker/jsdiff/issues/211 + var regex = new RegExp( + /*istanbul ignore start*/ + "(\\r?\\n)|[".concat( + /*istanbul ignore end*/ + extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), 'ug'); + return value.match(regex) || []; +}; +function diffWordsWithSpace(oldStr, newStr, options) { + return wordWithSpaceDiff.diff(oldStr, newStr, options); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfYmFzZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwiX3N0cmluZyIsIm9iaiIsIl9fZXNNb2R1bGUiLCJleHRlbmRlZFdvcmRDaGFycyIsInRva2VuaXplSW5jbHVkaW5nV2hpdGVzcGFjZSIsIlJlZ0V4cCIsImNvbmNhdCIsIndvcmREaWZmIiwiZXhwb3J0cyIsIkRpZmYiLCJlcXVhbHMiLCJsZWZ0IiwicmlnaHQiLCJvcHRpb25zIiwiaWdub3JlQ2FzZSIsInRvTG93ZXJDYXNlIiwidHJpbSIsInRva2VuaXplIiwidmFsdWUiLCJhcmd1bWVudHMiLCJsZW5ndGgiLCJ1bmRlZmluZWQiLCJwYXJ0cyIsImludGxTZWdtZW50ZXIiLCJyZXNvbHZlZE9wdGlvbnMiLCJncmFudWxhcml0eSIsIkVycm9yIiwiQXJyYXkiLCJmcm9tIiwic2VnbWVudCIsIm1hdGNoIiwidG9rZW5zIiwicHJldlBhcnQiLCJmb3JFYWNoIiwicGFydCIsInRlc3QiLCJwdXNoIiwicG9wIiwiam9pbiIsIm1hcCIsInRva2VuIiwiaSIsInJlcGxhY2UiLCJwb3N0UHJvY2VzcyIsImNoYW5nZ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UFFQyxNQUFNLEVBQUUxQyxPQUFPLENBQUM7QUFDeEQiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/node_modules/npm/node_modules/diff/lib/index.es6.js b/node_modules/npm/node_modules/diff/lib/index.es6.js new file mode 100644 index 00000000..6e872723 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/index.es6.js @@ -0,0 +1,2041 @@ +function Diff() {} +Diff.prototype = { + diff: function diff(oldString, newString) { + var _options$timeout; + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var callback = options.callback; + if (typeof options === 'function') { + callback = options; + options = {}; + } + var self = this; + function done(value) { + value = self.postProcess(value, options); + if (callback) { + setTimeout(function () { + callback(value); + }, 0); + return true; + } else { + return value; + } + } + + // Allow subclasses to massage the input prior to running + oldString = this.castInput(oldString, options); + newString = this.castInput(newString, options); + oldString = this.removeEmpty(this.tokenize(oldString, options)); + newString = this.removeEmpty(this.tokenize(newString, options)); + var newLen = newString.length, + oldLen = oldString.length; + var editLength = 1; + var maxEditLength = newLen + oldLen; + if (options.maxEditLength != null) { + maxEditLength = Math.min(maxEditLength, options.maxEditLength); + } + var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; + var abortAfterTimestamp = Date.now() + maxExecutionTime; + var bestPath = [{ + oldPos: -1, + lastComponent: undefined + }]; + + // Seed editLength = 0, i.e. the content starts with the same values + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options); + if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // Identity per the equality and tokenizer + return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken)); + } + + // Once we hit the right edge of the edit graph on some diagonal k, we can + // definitely reach the end of the edit graph in no more than k edits, so + // there's no point in considering any moves to diagonal k+1 any more (from + // which we're guaranteed to need at least k+1 more edits). + // Similarly, once we've reached the bottom of the edit graph, there's no + // point considering moves to lower diagonals. + // We record this fact by setting minDiagonalToConsider and + // maxDiagonalToConsider to some finite value once we've hit the edge of + // the edit graph. + // This optimization is not faithful to the original algorithm presented in + // Myers's paper, which instead pointlessly extends D-paths off the end of + // the edit graph - see page 7 of Myers's paper which notes this point + // explicitly and illustrates it with a diagram. This has major performance + // implications for some common scenarios. For instance, to compute a diff + // where the new text simply appends d characters on the end of the + // original text of length n, the true Myers algorithm will take O(n+d^2) + // time while this optimization needs only O(n+d) time. + var minDiagonalToConsider = -Infinity, + maxDiagonalToConsider = Infinity; + + // Main worker method. checks all permutations of a given edit length for acceptance. + function execEditLength() { + for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { + var basePath = void 0; + var removePath = bestPath[diagonalPath - 1], + addPath = bestPath[diagonalPath + 1]; + if (removePath) { + // No one else is going to attempt to use this value, clear it + bestPath[diagonalPath - 1] = undefined; + } + var canAdd = false; + if (addPath) { + // what newPos will be after we do an insertion: + var addPathNewPos = addPath.oldPos - diagonalPath; + canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; + } + var canRemove = removePath && removePath.oldPos + 1 < oldLen; + if (!canAdd && !canRemove) { + // If this path is a terminal then prune + bestPath[diagonalPath] = undefined; + continue; + } + + // Select the diagonal that we want to branch from. We select the prior + // path whose position in the old string is the farthest from the origin + // and does not pass the bounds of the diff graph + if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) { + basePath = self.addToPath(addPath, true, false, 0, options); + } else { + basePath = self.addToPath(removePath, false, true, 1, options); + } + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options); + if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // If we have hit the end of both strings, then we are done + return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); + } else { + bestPath[diagonalPath] = basePath; + if (basePath.oldPos + 1 >= oldLen) { + maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); + } + if (newPos + 1 >= newLen) { + minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); + } + } + } + editLength++; + } + + // Performs the length of edit iteration. Is a bit fugly as this has to support the + // sync and async mode which is never fun. Loops over execEditLength until a value + // is produced, or until the edit length exceeds options.maxEditLength (if given), + // in which case it will return undefined. + if (callback) { + (function exec() { + setTimeout(function () { + if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { + return callback(); + } + if (!execEditLength()) { + exec(); + } + }, 0); + })(); + } else { + while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { + var ret = execEditLength(); + if (ret) { + return ret; + } + } + } + }, + addToPath: function addToPath(path, added, removed, oldPosInc, options) { + var last = path.lastComponent; + if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) { + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: last.count + 1, + added: added, + removed: removed, + previousComponent: last.previousComponent + } + }; + } else { + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: 1, + added: added, + removed: removed, + previousComponent: last + } + }; + } + }, + extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) { + var newLen = newString.length, + oldLen = oldString.length, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, + commonCount = 0; + while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) { + newPos++; + oldPos++; + commonCount++; + if (options.oneChangePerToken) { + basePath.lastComponent = { + count: 1, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } + } + if (commonCount && !options.oneChangePerToken) { + basePath.lastComponent = { + count: commonCount, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } + basePath.oldPos = oldPos; + return newPos; + }, + equals: function equals(left, right, options) { + if (options.comparator) { + return options.comparator(left, right); + } else { + return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase(); + } + }, + removeEmpty: function removeEmpty(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + if (array[i]) { + ret.push(array[i]); + } + } + return ret; + }, + castInput: function castInput(value) { + return value; + }, + tokenize: function tokenize(value) { + return Array.from(value); + }, + join: function join(chars) { + return chars.join(''); + }, + postProcess: function postProcess(changeObjects) { + return changeObjects; + } +}; +function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { + // First we convert our linked list of components in reverse order to an + // array in the right order: + var components = []; + var nextComponent; + while (lastComponent) { + components.push(lastComponent); + nextComponent = lastComponent.previousComponent; + delete lastComponent.previousComponent; + lastComponent = nextComponent; + } + components.reverse(); + var componentPos = 0, + componentLen = components.length, + newPos = 0, + oldPos = 0; + for (; componentPos < componentLen; componentPos++) { + var component = components[componentPos]; + if (!component.removed) { + if (!component.added && useLongestToken) { + var value = newString.slice(newPos, newPos + component.count); + value = value.map(function (value, i) { + var oldValue = oldString[oldPos + i]; + return oldValue.length > value.length ? oldValue : value; + }); + component.value = diff.join(value); + } else { + component.value = diff.join(newString.slice(newPos, newPos + component.count)); + } + newPos += component.count; + + // Common case + if (!component.added) { + oldPos += component.count; + } + } else { + component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); + oldPos += component.count; + } + } + return components; +} + +var characterDiff = new Diff(); +function diffChars(oldStr, newStr, options) { + return characterDiff.diff(oldStr, newStr, options); +} + +function longestCommonPrefix(str1, str2) { + var i; + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[i] != str2[i]) { + return str1.slice(0, i); + } + } + return str1.slice(0, i); +} +function longestCommonSuffix(str1, str2) { + var i; + + // Unlike longestCommonPrefix, we need a special case to handle all scenarios + // where we return the empty string since str1.slice(-0) will return the + // entire string. + if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) { + return ''; + } + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) { + return str1.slice(-i); + } + } + return str1.slice(-i); +} +function replacePrefix(string, oldPrefix, newPrefix) { + if (string.slice(0, oldPrefix.length) != oldPrefix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug")); + } + return newPrefix + string.slice(oldPrefix.length); +} +function replaceSuffix(string, oldSuffix, newSuffix) { + if (!oldSuffix) { + return string + newSuffix; + } + if (string.slice(-oldSuffix.length) != oldSuffix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug")); + } + return string.slice(0, -oldSuffix.length) + newSuffix; +} +function removePrefix(string, oldPrefix) { + return replacePrefix(string, oldPrefix, ''); +} +function removeSuffix(string, oldSuffix) { + return replaceSuffix(string, oldSuffix, ''); +} +function maximumOverlap(string1, string2) { + return string2.slice(0, overlapCount(string1, string2)); +} + +// Nicked from https://stackoverflow.com/a/60422853/1709587 +function overlapCount(a, b) { + // Deal with cases where the strings differ in length + var startA = 0; + if (a.length > b.length) { + startA = a.length - b.length; + } + var endB = b.length; + if (a.length < b.length) { + endB = a.length; + } + // Create a back-reference for each index + // that should be followed in case of a mismatch. + // We only need B to make these references: + var map = Array(endB); + var k = 0; // Index that lags behind j + map[0] = 0; + for (var j = 1; j < endB; j++) { + if (b[j] == b[k]) { + map[j] = map[k]; // skip over the same character (optional optimisation) + } else { + map[j] = k; + } + while (k > 0 && b[j] != b[k]) { + k = map[k]; + } + if (b[j] == b[k]) { + k++; + } + } + // Phase 2: use these references while iterating over A + k = 0; + for (var i = startA; i < a.length; i++) { + while (k > 0 && a[i] != b[k]) { + k = map[k]; + } + if (a[i] == b[k]) { + k++; + } + } + return k; +} + +/** + * Returns true if the string consistently uses Windows line endings. + */ +function hasOnlyWinLineEndings(string) { + return string.includes('\r\n') && !string.startsWith('\n') && !string.match(/[^\r]\n/); +} + +/** + * Returns true if the string consistently uses Unix line endings. + */ +function hasOnlyUnixLineEndings(string) { + return !string.includes('\r\n') && string.includes('\n'); +} + +// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode +// +// Ranges and exceptions: +// Latin-1 Supplement, 0080–00FF +// - U+00D7 × Multiplication sign +// - U+00F7 ÷ Division sign +// Latin Extended-A, 0100–017F +// Latin Extended-B, 0180–024F +// IPA Extensions, 0250–02AF +// Spacing Modifier Letters, 02B0–02FF +// - U+02C7 ˇ ˇ Caron +// - U+02D8 ˘ ˘ Breve +// - U+02D9 ˙ ˙ Dot Above +// - U+02DA ˚ ˚ Ring Above +// - U+02DB ˛ ˛ Ogonek +// - U+02DC ˜ ˜ Small Tilde +// - U+02DD ˝ ˝ Double Acute Accent +// Latin Extended Additional, 1E00–1EFF +var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}"; + +// Each token is one of the following: +// - A punctuation mark plus the surrounding whitespace +// - A word plus the surrounding whitespace +// - Pure whitespace (but only in the special case where this the entire text +// is just whitespace) +// +// We have to include surrounding whitespace in the tokens because the two +// alternative approaches produce horribly broken results: +// * If we just discard the whitespace, we can't fully reproduce the original +// text from the sequence of tokens and any attempt to render the diff will +// get the whitespace wrong. +// * If we have separate tokens for whitespace, then in a typical text every +// second token will be a single space character. But this often results in +// the optimal diff between two texts being a perverse one that preserves +// the spaces between words but deletes and reinserts actual common words. +// See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640 +// for an example. +// +// Keeping the surrounding whitespace of course has implications for .equals +// and .join, not just .tokenize. + +// This regex does NOT fully implement the tokenization rules described above. +// Instead, it gives runs of whitespace their own "token". The tokenize method +// then handles stitching whitespace tokens onto adjacent word or punctuation +// tokens. +var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), 'ug'); +var wordDiff = new Diff(); +wordDiff.equals = function (left, right, options) { + if (options.ignoreCase) { + left = left.toLowerCase(); + right = right.toLowerCase(); + } + return left.trim() === right.trim(); +}; +wordDiff.tokenize = function (value) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parts; + if (options.intlSegmenter) { + if (options.intlSegmenter.resolvedOptions().granularity != 'word') { + throw new Error('The segmenter passed must have a granularity of "word"'); + } + parts = Array.from(options.intlSegmenter.segment(value), function (segment) { + return segment.segment; + }); + } else { + parts = value.match(tokenizeIncludingWhitespace) || []; + } + var tokens = []; + var prevPart = null; + parts.forEach(function (part) { + if (/\s/.test(part)) { + if (prevPart == null) { + tokens.push(part); + } else { + tokens.push(tokens.pop() + part); + } + } else if (/\s/.test(prevPart)) { + if (tokens[tokens.length - 1] == prevPart) { + tokens.push(tokens.pop() + part); + } else { + tokens.push(prevPart + part); + } + } else { + tokens.push(part); + } + prevPart = part; + }); + return tokens; +}; +wordDiff.join = function (tokens) { + // Tokens being joined here will always have appeared consecutively in the + // same text, so we can simply strip off the leading whitespace from all the + // tokens except the first (and except any whitespace-only tokens - but such + // a token will always be the first and only token anyway) and then join them + // and the whitespace around words and punctuation will end up correct. + return tokens.map(function (token, i) { + if (i == 0) { + return token; + } else { + return token.replace(/^\s+/, ''); + } + }).join(''); +}; +wordDiff.postProcess = function (changes, options) { + if (!changes || options.oneChangePerToken) { + return changes; + } + var lastKeep = null; + // Change objects representing any insertion or deletion since the last + // "keep" change object. There can be at most one of each. + var insertion = null; + var deletion = null; + changes.forEach(function (change) { + if (change.added) { + insertion = change; + } else if (change.removed) { + deletion = change; + } else { + if (insertion || deletion) { + // May be false at start of text + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change); + } + lastKeep = change; + insertion = null; + deletion = null; + } + }); + if (insertion || deletion) { + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null); + } + return changes; +}; +function diffWords(oldStr, newStr, options) { + // This option has never been documented and never will be (it's clearer to + // just call `diffWordsWithSpace` directly if you need that behavior), but + // has existed in jsdiff for a long time, so we retain support for it here + // for the sake of backwards compatibility. + if ((options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace) { + return diffWordsWithSpace(oldStr, newStr, options); + } + return wordDiff.diff(oldStr, newStr, options); +} +function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) { + // Before returning, we tidy up the leading and trailing whitespace of the + // change objects to eliminate cases where trailing whitespace in one object + // is repeated as leading whitespace in the next. + // Below are examples of the outcomes we want here to explain the code. + // I=insert, K=keep, D=delete + // 1. diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want: K:'foo ' D:'bar ' K:'baz' + // + // 2. Diffing 'foo bar baz' vs 'foo qux baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz' + // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz' + // + // 3. Diffing 'foo\nbar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:'\nbar ' K:' baz' + // After cleanup, we want K'foo' D:'\nbar' K:' baz' + // + // 4. Diffing 'foo baz' vs 'foo\nbar baz' + // Prior to cleanup, we have K:'foo\n' I:'\nbar ' K:' baz' + // After cleanup, we ideally want K'foo' I:'\nbar' K:' baz' + // but don't actually manage this currently (the pre-cleanup change + // objects don't contain enough information to make it possible). + // + // 5. Diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want K:'foo ' D:' bar ' K:'baz' + // + // Our handling is unavoidably imperfect in the case where there's a single + // indel between keeps and the whitespace has changed. For instance, consider + // diffing 'foo\tbar\nbaz' vs 'foo baz'. Unless we create an extra change + // object to represent the insertion of the space character (which isn't even + // a token), we have no way to avoid losing information about the texts' + // original whitespace in the result we return. Still, we do our best to + // output something that will look sensible if we e.g. print it with + // insertions in green and deletions in red. + + // Between two "keep" change objects (or before the first or after the last + // change object), we can have either: + // * A "delete" followed by an "insert" + // * Just an "insert" + // * Just a "delete" + // We handle the three cases separately. + if (deletion && insertion) { + var oldWsPrefix = deletion.value.match(/^\s*/)[0]; + var oldWsSuffix = deletion.value.match(/\s*$/)[0]; + var newWsPrefix = insertion.value.match(/^\s*/)[0]; + var newWsSuffix = insertion.value.match(/\s*$/)[0]; + if (startKeep) { + var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix); + startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix); + deletion.value = removePrefix(deletion.value, commonWsPrefix); + insertion.value = removePrefix(insertion.value, commonWsPrefix); + } + if (endKeep) { + var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix); + endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix); + deletion.value = removeSuffix(deletion.value, commonWsSuffix); + insertion.value = removeSuffix(insertion.value, commonWsSuffix); + } + } else if (insertion) { + // The whitespaces all reflect what was in the new text rather than + // the old, so we essentially have no information about whitespace + // insertion or deletion. We just want to dedupe the whitespace. + // We do that by having each change object keep its trailing + // whitespace and deleting duplicate leading whitespace where + // present. + if (startKeep) { + insertion.value = insertion.value.replace(/^\s*/, ''); + } + if (endKeep) { + endKeep.value = endKeep.value.replace(/^\s*/, ''); + } + // otherwise we've got a deletion and no insertion + } else if (startKeep && endKeep) { + var newWsFull = endKeep.value.match(/^\s*/)[0], + delWsStart = deletion.value.match(/^\s*/)[0], + delWsEnd = deletion.value.match(/\s*$/)[0]; + + // Any whitespace that comes straight after startKeep in both the old and + // new texts, assign to startKeep and remove from the deletion. + var newWsStart = longestCommonPrefix(newWsFull, delWsStart); + deletion.value = removePrefix(deletion.value, newWsStart); + + // Any whitespace that comes straight before endKeep in both the old and + // new texts, and hasn't already been assigned to startKeep, assign to + // endKeep and remove from the deletion. + var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd); + deletion.value = removeSuffix(deletion.value, newWsEnd); + endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd); + + // If there's any whitespace from the new text that HASN'T already been + // assigned, assign it to the start: + startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length)); + } else if (endKeep) { + // We are at the start of the text. Preserve all the whitespace on + // endKeep, and just remove whitespace from the end of deletion to the + // extent that it overlaps with the start of endKeep. + var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0]; + var deletionWsSuffix = deletion.value.match(/\s*$/)[0]; + var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix); + deletion.value = removeSuffix(deletion.value, overlap); + } else if (startKeep) { + // We are at the END of the text. Preserve all the whitespace on + // startKeep, and just remove whitespace from the start of deletion to + // the extent that it overlaps with the end of startKeep. + var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0]; + var deletionWsPrefix = deletion.value.match(/^\s*/)[0]; + var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix); + deletion.value = removePrefix(deletion.value, _overlap); + } +} +var wordWithSpaceDiff = new Diff(); +wordWithSpaceDiff.tokenize = function (value) { + // Slightly different to the tokenizeIncludingWhitespace regex used above in + // that this one treats each individual newline as a distinct tokens, rather + // than merging them into other surrounding whitespace. This was requested + // in https://github.com/kpdecker/jsdiff/issues/180 & + // https://github.com/kpdecker/jsdiff/issues/211 + var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), 'ug'); + return value.match(regex) || []; +}; +function diffWordsWithSpace(oldStr, newStr, options) { + return wordWithSpaceDiff.diff(oldStr, newStr, options); +} + +function generateOptions(options, defaults) { + if (typeof options === 'function') { + defaults.callback = options; + } else if (options) { + for (var name in options) { + /* istanbul ignore else */ + if (options.hasOwnProperty(name)) { + defaults[name] = options[name]; + } + } + } + return defaults; +} + +var lineDiff = new Diff(); +lineDiff.tokenize = function (value, options) { + if (options.stripTrailingCr) { + // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior + value = value.replace(/\r\n/g, '\n'); + } + var retLines = [], + linesAndNewlines = value.split(/(\n|\r\n)/); + + // Ignore the final empty token that occurs if the string ends with a new line + if (!linesAndNewlines[linesAndNewlines.length - 1]) { + linesAndNewlines.pop(); + } + + // Merge the content and line separators into single tokens + for (var i = 0; i < linesAndNewlines.length; i++) { + var line = linesAndNewlines[i]; + if (i % 2 && !options.newlineIsToken) { + retLines[retLines.length - 1] += line; + } else { + retLines.push(line); + } + } + return retLines; +}; +lineDiff.equals = function (left, right, options) { + // If we're ignoring whitespace, we need to normalise lines by stripping + // whitespace before checking equality. (This has an annoying interaction + // with newlineIsToken that requires special handling: if newlines get their + // own token, then we DON'T want to trim the *newline* tokens down to empty + // strings, since this would cause us to treat whitespace-only line content + // as equal to a separator between lines, which would be weird and + // inconsistent with the documented behavior of the options.) + if (options.ignoreWhitespace) { + if (!options.newlineIsToken || !left.includes('\n')) { + left = left.trim(); + } + if (!options.newlineIsToken || !right.includes('\n')) { + right = right.trim(); + } + } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) { + if (left.endsWith('\n')) { + left = left.slice(0, -1); + } + if (right.endsWith('\n')) { + right = right.slice(0, -1); + } + } + return Diff.prototype.equals.call(this, left, right, options); +}; +function diffLines(oldStr, newStr, callback) { + return lineDiff.diff(oldStr, newStr, callback); +} + +// Kept for backwards compatibility. This is a rather arbitrary wrapper method +// that just calls `diffLines` with `ignoreWhitespace: true`. It's confusing to +// have two ways to do exactly the same thing in the API, so we no longer +// document this one (library users should explicitly use `diffLines` with +// `ignoreWhitespace: true` instead) but we keep it around to maintain +// compatibility with code that used old versions. +function diffTrimmedLines(oldStr, newStr, callback) { + var options = generateOptions(callback, { + ignoreWhitespace: true + }); + return lineDiff.diff(oldStr, newStr, options); +} + +var sentenceDiff = new Diff(); +sentenceDiff.tokenize = function (value) { + return value.split(/(\S.+?[.!?])(?=\s+|$)/); +}; +function diffSentences(oldStr, newStr, callback) { + return sentenceDiff.diff(oldStr, newStr, callback); +} + +var cssDiff = new Diff(); +cssDiff.tokenize = function (value) { + return value.split(/([{}:;,]|\s+)/); +}; +function diffCss(oldStr, newStr, callback) { + return cssDiff.diff(oldStr, newStr, callback); +} + +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); + } + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; +} +function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; +} +function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); +} +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 _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); +} +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); +} +function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); +} +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; +} +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +var jsonDiff = new Diff(); +// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a +// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: +jsonDiff.useLongestToken = true; +jsonDiff.tokenize = lineDiff.tokenize; +jsonDiff.castInput = function (value, options) { + var undefinedReplacement = options.undefinedReplacement, + _options$stringifyRep = options.stringifyReplacer, + stringifyReplacer = _options$stringifyRep === void 0 ? function (k, v) { + return typeof v === 'undefined' ? undefinedReplacement : v; + } : _options$stringifyRep; + return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); +}; +jsonDiff.equals = function (left, right, options) { + return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options); +}; +function diffJson(oldObj, newObj, options) { + return jsonDiff.diff(oldObj, newObj, options); +} + +// This function handles the presence of circular references by bailing out when encountering an +// object that is already on the "stack" of items being processed. Accepts an optional replacer +function canonicalize(obj, stack, replacementStack, replacer, key) { + stack = stack || []; + replacementStack = replacementStack || []; + if (replacer) { + obj = replacer(key, obj); + } + var i; + for (i = 0; i < stack.length; i += 1) { + if (stack[i] === obj) { + return replacementStack[i]; + } + } + var canonicalizedObj; + if ('[object Array]' === Object.prototype.toString.call(obj)) { + stack.push(obj); + canonicalizedObj = new Array(obj.length); + replacementStack.push(canonicalizedObj); + for (i = 0; i < obj.length; i += 1) { + canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); + } + stack.pop(); + replacementStack.pop(); + return canonicalizedObj; + } + if (obj && obj.toJSON) { + obj = obj.toJSON(); + } + if (_typeof(obj) === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + replacementStack.push(canonicalizedObj); + var sortedKeys = [], + _key; + for (_key in obj) { + /* istanbul ignore else */ + if (Object.prototype.hasOwnProperty.call(obj, _key)) { + sortedKeys.push(_key); + } + } + sortedKeys.sort(); + for (i = 0; i < sortedKeys.length; i += 1) { + _key = sortedKeys[i]; + canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); + } + stack.pop(); + replacementStack.pop(); + } else { + canonicalizedObj = obj; + } + return canonicalizedObj; +} + +var arrayDiff = new Diff(); +arrayDiff.tokenize = function (value) { + return value.slice(); +}; +arrayDiff.join = arrayDiff.removeEmpty = function (value) { + return value; +}; +function diffArrays(oldArr, newArr, callback) { + return arrayDiff.diff(oldArr, newArr, callback); +} + +function unixToWin(patch) { + if (Array.isArray(patch)) { + return patch.map(unixToWin); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line, i) { + var _hunk$lines; + return line.startsWith('\\') || line.endsWith('\r') || (_hunk$lines = hunk.lines[i + 1]) !== null && _hunk$lines !== void 0 && _hunk$lines.startsWith('\\') ? line : line + '\r'; + }) + }); + }) + }); +} +function winToUnix(patch) { + if (Array.isArray(patch)) { + return patch.map(winToUnix); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line) { + return line.endsWith('\r') ? line.substring(0, line.length - 1) : line; + }) + }); + }) + }); +} + +/** + * Returns true if the patch consistently uses Unix line endings (or only involves one line and has + * no line endings). + */ +function isUnix(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return !patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return !line.startsWith('\\') && line.endsWith('\r'); + }); + }); + }); +} + +/** + * Returns true if the patch uses Windows line endings and only Windows line endings. + */ +function isWin(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return line.endsWith('\r'); + }); + }); + }) && patch.every(function (index) { + return index.hunks.every(function (hunk) { + return hunk.lines.every(function (line, i) { + var _hunk$lines2; + return line.startsWith('\\') || line.endsWith('\r') || ((_hunk$lines2 = hunk.lines[i + 1]) === null || _hunk$lines2 === void 0 ? void 0 : _hunk$lines2.startsWith('\\')); + }); + }); + }); +} + +function parsePatch(uniDiff) { + var diffstr = uniDiff.split(/\n/), + list = [], + i = 0; + function parseIndex() { + var index = {}; + list.push(index); + + // Parse diff metadata + while (i < diffstr.length) { + var line = diffstr[i]; + + // File header found, end parsing diff metadata + if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { + break; + } + + // Diff index + var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); + if (header) { + index.index = header[1]; + } + i++; + } + + // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + parseFileHeader(index); + parseFileHeader(index); + + // Parse hunks + index.hunks = []; + while (i < diffstr.length) { + var _line = diffstr[i]; + if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) { + break; + } else if (/^@@/.test(_line)) { + index.hunks.push(parseHunk()); + } else if (_line) { + throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); + } else { + i++; + } + } + } + + // Parses the --- and +++ headers, if none are found, no lines + // are consumed. + function parseFileHeader(index) { + var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]); + if (fileHeader) { + var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; + var data = fileHeader[2].split('\t', 2); + var fileName = data[0].replace(/\\\\/g, '\\'); + if (/^".*"$/.test(fileName)) { + fileName = fileName.substr(1, fileName.length - 2); + } + index[keyPrefix + 'FileName'] = fileName; + index[keyPrefix + 'Header'] = (data[1] || '').trim(); + i++; + } + } + + // Parses a hunk + // This assumes that we are at the start of a hunk. + function parseHunk() { + var chunkHeaderIndex = i, + chunkHeaderLine = diffstr[i++], + chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); + var hunk = { + oldStart: +chunkHeader[1], + oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2], + newStart: +chunkHeader[3], + newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4], + lines: [] + }; + + // Unified Diff Format quirk: If the chunk size is 0, + // the first number is one lower than one would expect. + // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 + if (hunk.oldLines === 0) { + hunk.oldStart += 1; + } + if (hunk.newLines === 0) { + hunk.newStart += 1; + } + var addCount = 0, + removeCount = 0; + for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || (_diffstr$i = diffstr[i]) !== null && _diffstr$i !== void 0 && _diffstr$i.startsWith('\\')); i++) { + var _diffstr$i; + var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; + if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { + hunk.lines.push(diffstr[i]); + if (operation === '+') { + addCount++; + } else if (operation === '-') { + removeCount++; + } else if (operation === ' ') { + addCount++; + removeCount++; + } + } else { + throw new Error("Hunk at line ".concat(chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i])); + } + } + + // Handle the empty block count case + if (!addCount && hunk.newLines === 1) { + hunk.newLines = 0; + } + if (!removeCount && hunk.oldLines === 1) { + hunk.oldLines = 0; + } + + // Perform sanity checking + if (addCount !== hunk.newLines) { + throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + if (removeCount !== hunk.oldLines) { + throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + return hunk; + } + while (i < diffstr.length) { + parseIndex(); + } + return list; +} + +// Iterator that traverses in the range of [min, max], stepping +// by distance from a given start position. I.e. for [0, 4], with +// start of 2, this will iterate 2, 3, 1, 4, 0. +function distanceIterator (start, minLine, maxLine) { + var wantForward = true, + backwardExhausted = false, + forwardExhausted = false, + localOffset = 1; + return function iterator() { + if (wantForward && !forwardExhausted) { + if (backwardExhausted) { + localOffset++; + } else { + wantForward = false; + } + + // Check if trying to fit beyond text length, and if not, check it fits + // after offset location (or desired location on first iteration) + if (start + localOffset <= maxLine) { + return start + localOffset; + } + forwardExhausted = true; + } + if (!backwardExhausted) { + if (!forwardExhausted) { + wantForward = true; + } + + // Check if trying to fit before text beginning, and if not, check it fits + // before offset location + if (minLine <= start - localOffset) { + return start - localOffset++; + } + backwardExhausted = true; + return iterator(); + } + + // We tried to fit hunk before text beginning and beyond text length, then + // hunk can't fit on the text. Return undefined + }; +} + +function applyPatch(source, uniDiff) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } + if (Array.isArray(uniDiff)) { + if (uniDiff.length > 1) { + throw new Error('applyPatch only works with a single input.'); + } + uniDiff = uniDiff[0]; + } + if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) { + if (hasOnlyWinLineEndings(source) && isUnix(uniDiff)) { + uniDiff = unixToWin(uniDiff); + } else if (hasOnlyUnixLineEndings(source) && isWin(uniDiff)) { + uniDiff = winToUnix(uniDiff); + } + } + + // Apply the diff to the input + var lines = source.split('\n'), + hunks = uniDiff.hunks, + compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { + return line === patchContent; + }, + fuzzFactor = options.fuzzFactor || 0, + minLine = 0; + if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) { + throw new Error('fuzzFactor must be a non-negative integer'); + } + + // Special case for empty patch. + if (!hunks.length) { + return source; + } + + // Before anything else, handle EOFNL insertion/removal. If the patch tells us to make a change + // to the EOFNL that is redundant/impossible - i.e. to remove a newline that's not there, or add a + // newline that already exists - then we either return false and fail to apply the patch (if + // fuzzFactor is 0) or simply ignore the problem and do nothing (if fuzzFactor is >0). + // If we do need to remove/add a newline at EOF, this will always be in the final hunk: + var prevLine = '', + removeEOFNL = false, + addEOFNL = false; + for (var i = 0; i < hunks[hunks.length - 1].lines.length; i++) { + var line = hunks[hunks.length - 1].lines[i]; + if (line[0] == '\\') { + if (prevLine[0] == '+') { + removeEOFNL = true; + } else if (prevLine[0] == '-') { + addEOFNL = true; + } + } + prevLine = line; + } + if (removeEOFNL) { + if (addEOFNL) { + // This means the final line gets changed but doesn't have a trailing newline in either the + // original or patched version. In that case, we do nothing if fuzzFactor > 0, and if + // fuzzFactor is 0, we simply validate that the source file has no trailing newline. + if (!fuzzFactor && lines[lines.length - 1] == '') { + return false; + } + } else if (lines[lines.length - 1] == '') { + lines.pop(); + } else if (!fuzzFactor) { + return false; + } + } else if (addEOFNL) { + if (lines[lines.length - 1] != '') { + lines.push(''); + } else if (!fuzzFactor) { + return false; + } + } + + /** + * Checks if the hunk can be made to fit at the provided location with at most `maxErrors` + * insertions, substitutions, or deletions, while ensuring also that: + * - lines deleted in the hunk match exactly, and + * - wherever an insertion operation or block of insertion operations appears in the hunk, the + * immediately preceding and following lines of context match exactly + * + * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0]. + * + * If the hunk can be applied, returns an object with properties `oldLineLastI` and + * `replacementLines`. Otherwise, returns null. + */ + function applyHunk(hunkLines, toPos, maxErrors) { + var hunkLinesI = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var lastContextLineMatched = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var patchedLines = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : []; + var patchedLinesLength = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; + var nConsecutiveOldContextLines = 0; + var nextContextLineMustMatch = false; + for (; hunkLinesI < hunkLines.length; hunkLinesI++) { + var hunkLine = hunkLines[hunkLinesI], + operation = hunkLine.length > 0 ? hunkLine[0] : ' ', + content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine; + if (operation === '-') { + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + toPos++; + nConsecutiveOldContextLines = 0; + } else { + if (!maxErrors || lines[toPos] == null) { + return null; + } + patchedLines[patchedLinesLength] = lines[toPos]; + return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1); + } + } + if (operation === '+') { + if (!lastContextLineMatched) { + return null; + } + patchedLines[patchedLinesLength] = content; + patchedLinesLength++; + nConsecutiveOldContextLines = 0; + nextContextLineMustMatch = true; + } + if (operation === ' ') { + nConsecutiveOldContextLines++; + patchedLines[patchedLinesLength] = lines[toPos]; + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + patchedLinesLength++; + lastContextLineMatched = true; + nextContextLineMustMatch = false; + toPos++; + } else { + if (nextContextLineMustMatch || !maxErrors) { + return null; + } + + // Consider 3 possibilities in sequence: + // 1. lines contains a *substitution* not included in the patch context, or + // 2. lines contains an *insertion* not included in the patch context, or + // 3. lines contains a *deletion* not included in the patch context + // The first two options are of course only possible if the line from lines is non-null - + // i.e. only option 3 is possible if we've overrun the end of the old file. + return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength); + } + } + } + + // Before returning, trim any unmodified context lines off the end of patchedLines and reduce + // toPos (and thus oldLineLastI) accordingly. This allows later hunks to be applied to a region + // that starts in this hunk's trailing context. + patchedLinesLength -= nConsecutiveOldContextLines; + toPos -= nConsecutiveOldContextLines; + patchedLines.length = patchedLinesLength; + return { + patchedLines: patchedLines, + oldLineLastI: toPos - 1 + }; + } + var resultLines = []; + + // Search best fit offsets for each hunk based on the previous ones + var prevHunkOffset = 0; + for (var _i = 0; _i < hunks.length; _i++) { + var hunk = hunks[_i]; + var hunkResult = void 0; + var maxLine = lines.length - hunk.oldLines + fuzzFactor; + var toPos = void 0; + for (var maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) { + toPos = hunk.oldStart + prevHunkOffset - 1; + var iterator = distanceIterator(toPos, minLine, maxLine); + for (; toPos !== undefined; toPos = iterator()) { + hunkResult = applyHunk(hunk.lines, toPos, maxErrors); + if (hunkResult) { + break; + } + } + if (hunkResult) { + break; + } + } + if (!hunkResult) { + return false; + } + + // Copy everything from the end of where we applied the last hunk to the start of this hunk + for (var _i2 = minLine; _i2 < toPos; _i2++) { + resultLines.push(lines[_i2]); + } + + // Add the lines produced by applying the hunk: + for (var _i3 = 0; _i3 < hunkResult.patchedLines.length; _i3++) { + var _line = hunkResult.patchedLines[_i3]; + resultLines.push(_line); + } + + // Set lower text limit to end of the current hunk, so next ones don't try + // to fit over already patched text + minLine = hunkResult.oldLineLastI + 1; + + // Note the offset between where the patch said the hunk should've applied and where we + // applied it, so we can adjust future hunks accordingly: + prevHunkOffset = toPos + 1 - hunk.oldStart; + } + + // Copy over the rest of the lines from the old text + for (var _i4 = minLine; _i4 < lines.length; _i4++) { + resultLines.push(lines[_i4]); + } + return resultLines.join('\n'); +} + +// Wrapper that supports multiple file patches via callbacks. +function applyPatches(uniDiff, options) { + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } + var currentIndex = 0; + function processIndex() { + var index = uniDiff[currentIndex++]; + if (!index) { + return options.complete(); + } + options.loadFile(index, function (err, data) { + if (err) { + return options.complete(err); + } + var updatedContent = applyPatch(data, index, options); + options.patched(index, updatedContent, function (err) { + if (err) { + return options.complete(err); + } + processIndex(); + }); + }); + } + processIndex(); +} + +function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + if (!options) { + options = {}; + } + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (typeof options.context === 'undefined') { + options.context = 4; + } + if (options.newlineIsToken) { + throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions'); + } + if (!options.callback) { + return diffLinesResultToPatch(diffLines(oldStr, newStr, options)); + } else { + var _options = options, + _callback = _options.callback; + diffLines(oldStr, newStr, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(diff) { + var patch = diffLinesResultToPatch(diff); + _callback(patch); + } + })); + } + function diffLinesResultToPatch(diff) { + // STEP 1: Build up the patch with no "\ No newline at end of file" lines and with the arrays + // of lines containing trailing newline characters. We'll tidy up later... + + if (!diff) { + return; + } + diff.push({ + value: '', + lines: [] + }); // Append an empty value to make cleanup easier + + function contextLines(lines) { + return lines.map(function (entry) { + return ' ' + entry; + }); + } + var hunks = []; + var oldRangeStart = 0, + newRangeStart = 0, + curRange = [], + oldLine = 1, + newLine = 1; + var _loop = function _loop() { + var current = diff[i], + lines = current.lines || splitLines(current.value); + current.lines = lines; + if (current.added || current.removed) { + var _curRange; + // If we have previous context, start with that + if (!oldRangeStart) { + var prev = diff[i - 1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + if (prev) { + curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } + } + + // Output our changes + (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { + return (current.added ? '+' : '-') + entry; + }))); + + // Track the updated file position + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } + } else { + // Identical context lines. Track line changes + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= options.context * 2 && i < diff.length - 2) { + var _curRange2; + // Overlapping + (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); + } else { + var _curRange3; + // end the range and output + var contextSize = Math.min(lines.length, options.context); + (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); + var _hunk = { + oldStart: oldRangeStart, + oldLines: oldLine - oldRangeStart + contextSize, + newStart: newRangeStart, + newLines: newLine - newRangeStart + contextSize, + lines: curRange + }; + hunks.push(_hunk); + oldRangeStart = 0; + newRangeStart = 0; + curRange = []; + } + } + oldLine += lines.length; + newLine += lines.length; + } + }; + for (var i = 0; i < diff.length; i++) { + _loop(); + } + + // Step 2: eliminate the trailing `\n` from each line of each hunk, and, where needed, add + // "\ No newline at end of file". + for (var _i = 0, _hunks = hunks; _i < _hunks.length; _i++) { + var hunk = _hunks[_i]; + for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) { + if (hunk.lines[_i2].endsWith('\n')) { + hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1); + } else { + hunk.lines.splice(_i2 + 1, 0, '\\ No newline at end of file'); + _i2++; // Skip the line we just added, then continue iterating + } + } + } + return { + oldFileName: oldFileName, + newFileName: newFileName, + oldHeader: oldHeader, + newHeader: newHeader, + hunks: hunks + }; + } +} +function formatPatch(diff) { + if (Array.isArray(diff)) { + return diff.map(formatPatch).join('\n'); + } + var ret = []; + if (diff.oldFileName == diff.newFileName) { + ret.push('Index: ' + diff.oldFileName); + } + ret.push('==================================================================='); + ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); + ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); + for (var i = 0; i < diff.hunks.length; i++) { + var hunk = diff.hunks[i]; + // Unified Diff Format quirk: If the chunk size is 0, + // the first number is one lower than one would expect. + // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 + if (hunk.oldLines === 0) { + hunk.oldStart -= 1; + } + if (hunk.newLines === 0) { + hunk.newStart -= 1; + } + ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); + ret.push.apply(ret, hunk.lines); + } + return ret.join('\n') + '\n'; +} +function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + var _options2; + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (!((_options2 = options) !== null && _options2 !== void 0 && _options2.callback)) { + var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + if (!patchObj) { + return; + } + return formatPatch(patchObj); + } else { + var _options3 = options, + _callback2 = _options3.callback; + structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(patchObj) { + if (!patchObj) { + _callback2(); + } else { + _callback2(formatPatch(patchObj)); + } + } + })); + } +} +function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { + return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); +} + +/** + * Split `text` into an array of lines, including the trailing newline character (where present) + */ +function splitLines(text) { + var hasTrailingNl = text.endsWith('\n'); + var result = text.split('\n').map(function (line) { + return line + '\n'; + }); + if (hasTrailingNl) { + result.pop(); + } else { + result.push(result.pop().slice(0, -1)); + } + return result; +} + +function arrayEqual(a, b) { + if (a.length !== b.length) { + return false; + } + return arrayStartsWith(a, b); +} +function arrayStartsWith(array, start) { + if (start.length > array.length) { + return false; + } + for (var i = 0; i < start.length; i++) { + if (start[i] !== array[i]) { + return false; + } + } + return true; +} + +function calcLineCount(hunk) { + var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), + oldLines = _calcOldNewLineCount.oldLines, + newLines = _calcOldNewLineCount.newLines; + if (oldLines !== undefined) { + hunk.oldLines = oldLines; + } else { + delete hunk.oldLines; + } + if (newLines !== undefined) { + hunk.newLines = newLines; + } else { + delete hunk.newLines; + } +} +function merge(mine, theirs, base) { + mine = loadPatch(mine, base); + theirs = loadPatch(theirs, base); + var ret = {}; + + // For index we just let it pass through as it doesn't have any necessary meaning. + // Leaving sanity checks on this to the API consumer that may know more about the + // meaning in their own context. + if (mine.index || theirs.index) { + ret.index = mine.index || theirs.index; + } + if (mine.newFileName || theirs.newFileName) { + if (!fileNameChanged(mine)) { + // No header or no change in ours, use theirs (and ours if theirs does not exist) + ret.oldFileName = theirs.oldFileName || mine.oldFileName; + ret.newFileName = theirs.newFileName || mine.newFileName; + ret.oldHeader = theirs.oldHeader || mine.oldHeader; + ret.newHeader = theirs.newHeader || mine.newHeader; + } else if (!fileNameChanged(theirs)) { + // No header or no change in theirs, use ours + ret.oldFileName = mine.oldFileName; + ret.newFileName = mine.newFileName; + ret.oldHeader = mine.oldHeader; + ret.newHeader = mine.newHeader; + } else { + // Both changed... figure it out + ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); + ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); + ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); + ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); + } + } + ret.hunks = []; + var mineIndex = 0, + theirsIndex = 0, + mineOffset = 0, + theirsOffset = 0; + while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { + var mineCurrent = mine.hunks[mineIndex] || { + oldStart: Infinity + }, + theirsCurrent = theirs.hunks[theirsIndex] || { + oldStart: Infinity + }; + if (hunkBefore(mineCurrent, theirsCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); + mineIndex++; + theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; + } else if (hunkBefore(theirsCurrent, mineCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); + theirsIndex++; + mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; + } else { + // Overlap, merge as best we can + var mergedHunk = { + oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), + oldLines: 0, + newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), + newLines: 0, + lines: [] + }; + mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); + theirsIndex++; + mineIndex++; + ret.hunks.push(mergedHunk); + } + } + return ret; +} +function loadPatch(param, base) { + if (typeof param === 'string') { + if (/^@@/m.test(param) || /^Index:/m.test(param)) { + return parsePatch(param)[0]; + } + if (!base) { + throw new Error('Must provide a base reference or pass in a patch'); + } + return structuredPatch(undefined, undefined, base, param); + } + return param; +} +function fileNameChanged(patch) { + return patch.newFileName && patch.newFileName !== patch.oldFileName; +} +function selectField(index, mine, theirs) { + if (mine === theirs) { + return mine; + } else { + index.conflict = true; + return { + mine: mine, + theirs: theirs + }; + } +} +function hunkBefore(test, check) { + return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; +} +function cloneHunk(hunk, offset) { + return { + oldStart: hunk.oldStart, + oldLines: hunk.oldLines, + newStart: hunk.newStart + offset, + newLines: hunk.newLines, + lines: hunk.lines + }; +} +function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { + // This will generally result in a conflicted hunk, but there are cases where the context + // is the only overlap where we can successfully merge the content here. + var mine = { + offset: mineOffset, + lines: mineLines, + index: 0 + }, + their = { + offset: theirOffset, + lines: theirLines, + index: 0 + }; + + // Handle any leading content + insertLeading(hunk, mine, their); + insertLeading(hunk, their, mine); + + // Now in the overlap content. Scan through and select the best changes from each. + while (mine.index < mine.lines.length && their.index < their.lines.length) { + var mineCurrent = mine.lines[mine.index], + theirCurrent = their.lines[their.index]; + if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { + // Both modified ... + mutualChange(hunk, mine, their); + } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { + var _hunk$lines; + // Mine inserted + (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); + } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { + var _hunk$lines2; + // Theirs inserted + (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); + } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { + // Mine removed or edited + removal(hunk, mine, their); + } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { + // Their removed or edited + removal(hunk, their, mine, true); + } else if (mineCurrent === theirCurrent) { + // Context identity + hunk.lines.push(mineCurrent); + mine.index++; + their.index++; + } else { + // Context mismatch + conflict(hunk, collectChange(mine), collectChange(their)); + } + } + + // Now push anything that may be remaining + insertTrailing(hunk, mine); + insertTrailing(hunk, their); + calcLineCount(hunk); +} +function mutualChange(hunk, mine, their) { + var myChanges = collectChange(mine), + theirChanges = collectChange(their); + if (allRemoves(myChanges) && allRemoves(theirChanges)) { + // Special case for remove changes that are supersets of one another + if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { + var _hunk$lines3; + (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); + return; + } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { + var _hunk$lines4; + (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); + return; + } + } else if (arrayEqual(myChanges, theirChanges)) { + var _hunk$lines5; + (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); + return; + } + conflict(hunk, myChanges, theirChanges); +} +function removal(hunk, mine, their, swap) { + var myChanges = collectChange(mine), + theirChanges = collectContext(their, myChanges); + if (theirChanges.merged) { + var _hunk$lines6; + (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); + } else { + conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); + } +} +function conflict(hunk, mine, their) { + hunk.conflict = true; + hunk.lines.push({ + conflict: true, + mine: mine, + theirs: their + }); +} +function insertLeading(hunk, insert, their) { + while (insert.offset < their.offset && insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + insert.offset++; + } +} +function insertTrailing(hunk, insert) { + while (insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + } +} +function collectChange(state) { + var ret = [], + operation = state.lines[state.index][0]; + while (state.index < state.lines.length) { + var line = state.lines[state.index]; + + // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. + if (operation === '-' && line[0] === '+') { + operation = '+'; + } + if (operation === line[0]) { + ret.push(line); + state.index++; + } else { + break; + } + } + return ret; +} +function collectContext(state, matchChanges) { + var changes = [], + merged = [], + matchIndex = 0, + contextChanges = false, + conflicted = false; + while (matchIndex < matchChanges.length && state.index < state.lines.length) { + var change = state.lines[state.index], + match = matchChanges[matchIndex]; + + // Once we've hit our add, then we are done + if (match[0] === '+') { + break; + } + contextChanges = contextChanges || change[0] !== ' '; + merged.push(match); + matchIndex++; + + // Consume any additions in the other block as a conflict to attempt + // to pull in the remaining context after this + if (change[0] === '+') { + conflicted = true; + while (change[0] === '+') { + changes.push(change); + change = state.lines[++state.index]; + } + } + if (match.substr(1) === change.substr(1)) { + changes.push(change); + state.index++; + } else { + conflicted = true; + } + } + if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { + conflicted = true; + } + if (conflicted) { + return changes; + } + while (matchIndex < matchChanges.length) { + merged.push(matchChanges[matchIndex++]); + } + return { + merged: merged, + changes: changes + }; +} +function allRemoves(changes) { + return changes.reduce(function (prev, change) { + return prev && change[0] === '-'; + }, true); +} +function skipRemoveSuperset(state, removeChanges, delta) { + for (var i = 0; i < delta; i++) { + var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); + if (state.lines[state.index + i] !== ' ' + changeContent) { + return false; + } + } + state.index += delta; + return true; +} +function calcOldNewLineCount(lines) { + var oldLines = 0; + var newLines = 0; + lines.forEach(function (line) { + if (typeof line !== 'string') { + var myCount = calcOldNewLineCount(line.mine); + var theirCount = calcOldNewLineCount(line.theirs); + if (oldLines !== undefined) { + if (myCount.oldLines === theirCount.oldLines) { + oldLines += myCount.oldLines; + } else { + oldLines = undefined; + } + } + if (newLines !== undefined) { + if (myCount.newLines === theirCount.newLines) { + newLines += myCount.newLines; + } else { + newLines = undefined; + } + } + } else { + if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { + newLines++; + } + if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { + oldLines++; + } + } + }); + return { + oldLines: oldLines, + newLines: newLines + }; +} + +function reversePatch(structuredPatch) { + if (Array.isArray(structuredPatch)) { + return structuredPatch.map(reversePatch).reverse(); + } + return _objectSpread2(_objectSpread2({}, structuredPatch), {}, { + oldFileName: structuredPatch.newFileName, + oldHeader: structuredPatch.newHeader, + newFileName: structuredPatch.oldFileName, + newHeader: structuredPatch.oldHeader, + hunks: structuredPatch.hunks.map(function (hunk) { + return { + oldLines: hunk.newLines, + oldStart: hunk.newStart, + newLines: hunk.oldLines, + newStart: hunk.oldStart, + lines: hunk.lines.map(function (l) { + if (l.startsWith('-')) { + return "+".concat(l.slice(1)); + } + if (l.startsWith('+')) { + return "-".concat(l.slice(1)); + } + return l; + }) + }; + }) + }); +} + +// See: http://code.google.com/p/google-diff-match-patch/wiki/API +function convertChangesToDMP(changes) { + var ret = [], + change, + operation; + for (var i = 0; i < changes.length; i++) { + change = changes[i]; + if (change.added) { + operation = 1; + } else if (change.removed) { + operation = -1; + } else { + operation = 0; + } + ret.push([operation, change.value]); + } + return ret; +} + +function convertChangesToXML(changes) { + var ret = []; + for (var i = 0; i < changes.length; i++) { + var change = changes[i]; + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + ret.push(escapeHTML(change.value)); + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + } + return ret.join(''); +} +function escapeHTML(s) { + var n = s; + n = n.replace(/&/g, '&'); + n = n.replace(//g, '>'); + n = n.replace(/"/g, '"'); + return n; +} + +export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, formatPatch, merge, parsePatch, reversePatch, structuredPatch }; diff --git a/node_modules/npm/node_modules/diff/lib/index.js b/node_modules/npm/node_modules/diff/lib/index.js new file mode 100644 index 00000000..518b3dee --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/index.js @@ -0,0 +1,217 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Diff", { + enumerable: true, + get: function get() { + return _base["default"]; + } +}); +Object.defineProperty(exports, "applyPatch", { + enumerable: true, + get: function get() { + return _apply.applyPatch; + } +}); +Object.defineProperty(exports, "applyPatches", { + enumerable: true, + get: function get() { + return _apply.applyPatches; + } +}); +Object.defineProperty(exports, "canonicalize", { + enumerable: true, + get: function get() { + return _json.canonicalize; + } +}); +Object.defineProperty(exports, "convertChangesToDMP", { + enumerable: true, + get: function get() { + return _dmp.convertChangesToDMP; + } +}); +Object.defineProperty(exports, "convertChangesToXML", { + enumerable: true, + get: function get() { + return _xml.convertChangesToXML; + } +}); +Object.defineProperty(exports, "createPatch", { + enumerable: true, + get: function get() { + return _create.createPatch; + } +}); +Object.defineProperty(exports, "createTwoFilesPatch", { + enumerable: true, + get: function get() { + return _create.createTwoFilesPatch; + } +}); +Object.defineProperty(exports, "diffArrays", { + enumerable: true, + get: function get() { + return _array.diffArrays; + } +}); +Object.defineProperty(exports, "diffChars", { + enumerable: true, + get: function get() { + return _character.diffChars; + } +}); +Object.defineProperty(exports, "diffCss", { + enumerable: true, + get: function get() { + return _css.diffCss; + } +}); +Object.defineProperty(exports, "diffJson", { + enumerable: true, + get: function get() { + return _json.diffJson; + } +}); +Object.defineProperty(exports, "diffLines", { + enumerable: true, + get: function get() { + return _line.diffLines; + } +}); +Object.defineProperty(exports, "diffSentences", { + enumerable: true, + get: function get() { + return _sentence.diffSentences; + } +}); +Object.defineProperty(exports, "diffTrimmedLines", { + enumerable: true, + get: function get() { + return _line.diffTrimmedLines; + } +}); +Object.defineProperty(exports, "diffWords", { + enumerable: true, + get: function get() { + return _word.diffWords; + } +}); +Object.defineProperty(exports, "diffWordsWithSpace", { + enumerable: true, + get: function get() { + return _word.diffWordsWithSpace; + } +}); +Object.defineProperty(exports, "formatPatch", { + enumerable: true, + get: function get() { + return _create.formatPatch; + } +}); +Object.defineProperty(exports, "merge", { + enumerable: true, + get: function get() { + return _merge.merge; + } +}); +Object.defineProperty(exports, "parsePatch", { + enumerable: true, + get: function get() { + return _parse.parsePatch; + } +}); +Object.defineProperty(exports, "reversePatch", { + enumerable: true, + get: function get() { + return _reverse.reversePatch; + } +}); +Object.defineProperty(exports, "structuredPatch", { + enumerable: true, + get: function get() { + return _create.structuredPatch; + } +}); +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_base = _interopRequireDefault(require("./diff/base")) +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_character = require("./diff/character") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_word = require("./diff/word") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_line = require("./diff/line") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_sentence = require("./diff/sentence") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_css = require("./diff/css") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_json = require("./diff/json") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_array = require("./diff/array") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_apply = require("./patch/apply") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_parse = require("./patch/parse") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_merge = require("./patch/merge") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_reverse = require("./patch/reverse") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_create = require("./patch/create") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_dmp = require("./convert/dmp") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_xml = require("./convert/xml") +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/*istanbul ignore end*/ +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfYmFzZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwiX2NoYXJhY3RlciIsIl93b3JkIiwiX2xpbmUiLCJfc2VudGVuY2UiLCJfY3NzIiwiX2pzb24iLCJfYXJyYXkiLCJfYXBwbHkiLCJfcGFyc2UiLCJfbWVyZ2UiLCJfcmV2ZXJzZSIsIl9jcmVhdGUiLCJfZG1wIiwiX3htbCIsIm9iaiIsIl9fZXNNb2R1bGUiXSwic291cmNlcyI6WyIuLi9zcmMvaW5kZXguanMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogU2VlIExJQ0VOU0UgZmlsZSBmb3IgdGVybXMgb2YgdXNlICovXG5cbi8qXG4gKiBUZXh0IGRpZmYgaW1wbGVtZW50YXRpb24uXG4gKlxuICogVGhpcyBsaWJyYXJ5IHN1cHBvcnRzIHRoZSBmb2xsb3dpbmcgQVBJczpcbiAqIERpZmYuZGlmZkNoYXJzOiBDaGFyYWN0ZXIgYnkgY2hhcmFjdGVyIGRpZmZcbiAqIERpZmYuZGlmZldvcmRzOiBXb3JkIChhcyBkZWZpbmVkIGJ5IFxcYiByZWdleCkgZGlmZiB3aGljaCBpZ25vcmVzIHdoaXRlc3BhY2VcbiAqIERpZmYuZGlmZkxpbmVzOiBMaW5lIGJhc2VkIGRpZmZcbiAqXG4gKiBEaWZmLmR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lib/index.mjs b/node_modules/npm/node_modules/diff/lib/index.mjs new file mode 100644 index 00000000..6e872723 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/index.mjs @@ -0,0 +1,2041 @@ +function Diff() {} +Diff.prototype = { + diff: function diff(oldString, newString) { + var _options$timeout; + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var callback = options.callback; + if (typeof options === 'function') { + callback = options; + options = {}; + } + var self = this; + function done(value) { + value = self.postProcess(value, options); + if (callback) { + setTimeout(function () { + callback(value); + }, 0); + return true; + } else { + return value; + } + } + + // Allow subclasses to massage the input prior to running + oldString = this.castInput(oldString, options); + newString = this.castInput(newString, options); + oldString = this.removeEmpty(this.tokenize(oldString, options)); + newString = this.removeEmpty(this.tokenize(newString, options)); + var newLen = newString.length, + oldLen = oldString.length; + var editLength = 1; + var maxEditLength = newLen + oldLen; + if (options.maxEditLength != null) { + maxEditLength = Math.min(maxEditLength, options.maxEditLength); + } + var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity; + var abortAfterTimestamp = Date.now() + maxExecutionTime; + var bestPath = [{ + oldPos: -1, + lastComponent: undefined + }]; + + // Seed editLength = 0, i.e. the content starts with the same values + var newPos = this.extractCommon(bestPath[0], newString, oldString, 0, options); + if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // Identity per the equality and tokenizer + return done(buildValues(self, bestPath[0].lastComponent, newString, oldString, self.useLongestToken)); + } + + // Once we hit the right edge of the edit graph on some diagonal k, we can + // definitely reach the end of the edit graph in no more than k edits, so + // there's no point in considering any moves to diagonal k+1 any more (from + // which we're guaranteed to need at least k+1 more edits). + // Similarly, once we've reached the bottom of the edit graph, there's no + // point considering moves to lower diagonals. + // We record this fact by setting minDiagonalToConsider and + // maxDiagonalToConsider to some finite value once we've hit the edge of + // the edit graph. + // This optimization is not faithful to the original algorithm presented in + // Myers's paper, which instead pointlessly extends D-paths off the end of + // the edit graph - see page 7 of Myers's paper which notes this point + // explicitly and illustrates it with a diagram. This has major performance + // implications for some common scenarios. For instance, to compute a diff + // where the new text simply appends d characters on the end of the + // original text of length n, the true Myers algorithm will take O(n+d^2) + // time while this optimization needs only O(n+d) time. + var minDiagonalToConsider = -Infinity, + maxDiagonalToConsider = Infinity; + + // Main worker method. checks all permutations of a given edit length for acceptance. + function execEditLength() { + for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { + var basePath = void 0; + var removePath = bestPath[diagonalPath - 1], + addPath = bestPath[diagonalPath + 1]; + if (removePath) { + // No one else is going to attempt to use this value, clear it + bestPath[diagonalPath - 1] = undefined; + } + var canAdd = false; + if (addPath) { + // what newPos will be after we do an insertion: + var addPathNewPos = addPath.oldPos - diagonalPath; + canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; + } + var canRemove = removePath && removePath.oldPos + 1 < oldLen; + if (!canAdd && !canRemove) { + // If this path is a terminal then prune + bestPath[diagonalPath] = undefined; + continue; + } + + // Select the diagonal that we want to branch from. We select the prior + // path whose position in the old string is the farthest from the origin + // and does not pass the bounds of the diff graph + if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) { + basePath = self.addToPath(addPath, true, false, 0, options); + } else { + basePath = self.addToPath(removePath, false, true, 1, options); + } + newPos = self.extractCommon(basePath, newString, oldString, diagonalPath, options); + if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { + // If we have hit the end of both strings, then we are done + return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); + } else { + bestPath[diagonalPath] = basePath; + if (basePath.oldPos + 1 >= oldLen) { + maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); + } + if (newPos + 1 >= newLen) { + minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); + } + } + } + editLength++; + } + + // Performs the length of edit iteration. Is a bit fugly as this has to support the + // sync and async mode which is never fun. Loops over execEditLength until a value + // is produced, or until the edit length exceeds options.maxEditLength (if given), + // in which case it will return undefined. + if (callback) { + (function exec() { + setTimeout(function () { + if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { + return callback(); + } + if (!execEditLength()) { + exec(); + } + }, 0); + })(); + } else { + while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { + var ret = execEditLength(); + if (ret) { + return ret; + } + } + } + }, + addToPath: function addToPath(path, added, removed, oldPosInc, options) { + var last = path.lastComponent; + if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) { + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: last.count + 1, + added: added, + removed: removed, + previousComponent: last.previousComponent + } + }; + } else { + return { + oldPos: path.oldPos + oldPosInc, + lastComponent: { + count: 1, + added: added, + removed: removed, + previousComponent: last + } + }; + } + }, + extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath, options) { + var newLen = newString.length, + oldLen = oldString.length, + oldPos = basePath.oldPos, + newPos = oldPos - diagonalPath, + commonCount = 0; + while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldString[oldPos + 1], newString[newPos + 1], options)) { + newPos++; + oldPos++; + commonCount++; + if (options.oneChangePerToken) { + basePath.lastComponent = { + count: 1, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } + } + if (commonCount && !options.oneChangePerToken) { + basePath.lastComponent = { + count: commonCount, + previousComponent: basePath.lastComponent, + added: false, + removed: false + }; + } + basePath.oldPos = oldPos; + return newPos; + }, + equals: function equals(left, right, options) { + if (options.comparator) { + return options.comparator(left, right); + } else { + return left === right || options.ignoreCase && left.toLowerCase() === right.toLowerCase(); + } + }, + removeEmpty: function removeEmpty(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + if (array[i]) { + ret.push(array[i]); + } + } + return ret; + }, + castInput: function castInput(value) { + return value; + }, + tokenize: function tokenize(value) { + return Array.from(value); + }, + join: function join(chars) { + return chars.join(''); + }, + postProcess: function postProcess(changeObjects) { + return changeObjects; + } +}; +function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { + // First we convert our linked list of components in reverse order to an + // array in the right order: + var components = []; + var nextComponent; + while (lastComponent) { + components.push(lastComponent); + nextComponent = lastComponent.previousComponent; + delete lastComponent.previousComponent; + lastComponent = nextComponent; + } + components.reverse(); + var componentPos = 0, + componentLen = components.length, + newPos = 0, + oldPos = 0; + for (; componentPos < componentLen; componentPos++) { + var component = components[componentPos]; + if (!component.removed) { + if (!component.added && useLongestToken) { + var value = newString.slice(newPos, newPos + component.count); + value = value.map(function (value, i) { + var oldValue = oldString[oldPos + i]; + return oldValue.length > value.length ? oldValue : value; + }); + component.value = diff.join(value); + } else { + component.value = diff.join(newString.slice(newPos, newPos + component.count)); + } + newPos += component.count; + + // Common case + if (!component.added) { + oldPos += component.count; + } + } else { + component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); + oldPos += component.count; + } + } + return components; +} + +var characterDiff = new Diff(); +function diffChars(oldStr, newStr, options) { + return characterDiff.diff(oldStr, newStr, options); +} + +function longestCommonPrefix(str1, str2) { + var i; + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[i] != str2[i]) { + return str1.slice(0, i); + } + } + return str1.slice(0, i); +} +function longestCommonSuffix(str1, str2) { + var i; + + // Unlike longestCommonPrefix, we need a special case to handle all scenarios + // where we return the empty string since str1.slice(-0) will return the + // entire string. + if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) { + return ''; + } + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) { + return str1.slice(-i); + } + } + return str1.slice(-i); +} +function replacePrefix(string, oldPrefix, newPrefix) { + if (string.slice(0, oldPrefix.length) != oldPrefix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug")); + } + return newPrefix + string.slice(oldPrefix.length); +} +function replaceSuffix(string, oldSuffix, newSuffix) { + if (!oldSuffix) { + return string + newSuffix; + } + if (string.slice(-oldSuffix.length) != oldSuffix) { + throw Error("string ".concat(JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug")); + } + return string.slice(0, -oldSuffix.length) + newSuffix; +} +function removePrefix(string, oldPrefix) { + return replacePrefix(string, oldPrefix, ''); +} +function removeSuffix(string, oldSuffix) { + return replaceSuffix(string, oldSuffix, ''); +} +function maximumOverlap(string1, string2) { + return string2.slice(0, overlapCount(string1, string2)); +} + +// Nicked from https://stackoverflow.com/a/60422853/1709587 +function overlapCount(a, b) { + // Deal with cases where the strings differ in length + var startA = 0; + if (a.length > b.length) { + startA = a.length - b.length; + } + var endB = b.length; + if (a.length < b.length) { + endB = a.length; + } + // Create a back-reference for each index + // that should be followed in case of a mismatch. + // We only need B to make these references: + var map = Array(endB); + var k = 0; // Index that lags behind j + map[0] = 0; + for (var j = 1; j < endB; j++) { + if (b[j] == b[k]) { + map[j] = map[k]; // skip over the same character (optional optimisation) + } else { + map[j] = k; + } + while (k > 0 && b[j] != b[k]) { + k = map[k]; + } + if (b[j] == b[k]) { + k++; + } + } + // Phase 2: use these references while iterating over A + k = 0; + for (var i = startA; i < a.length; i++) { + while (k > 0 && a[i] != b[k]) { + k = map[k]; + } + if (a[i] == b[k]) { + k++; + } + } + return k; +} + +/** + * Returns true if the string consistently uses Windows line endings. + */ +function hasOnlyWinLineEndings(string) { + return string.includes('\r\n') && !string.startsWith('\n') && !string.match(/[^\r]\n/); +} + +/** + * Returns true if the string consistently uses Unix line endings. + */ +function hasOnlyUnixLineEndings(string) { + return !string.includes('\r\n') && string.includes('\n'); +} + +// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode +// +// Ranges and exceptions: +// Latin-1 Supplement, 0080–00FF +// - U+00D7 × Multiplication sign +// - U+00F7 ÷ Division sign +// Latin Extended-A, 0100–017F +// Latin Extended-B, 0180–024F +// IPA Extensions, 0250–02AF +// Spacing Modifier Letters, 02B0–02FF +// - U+02C7 ˇ ˇ Caron +// - U+02D8 ˘ ˘ Breve +// - U+02D9 ˙ ˙ Dot Above +// - U+02DA ˚ ˚ Ring Above +// - U+02DB ˛ ˛ Ogonek +// - U+02DC ˜ ˜ Small Tilde +// - U+02DD ˝ ˝ Double Acute Accent +// Latin Extended Additional, 1E00–1EFF +var extendedWordChars = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}"; + +// Each token is one of the following: +// - A punctuation mark plus the surrounding whitespace +// - A word plus the surrounding whitespace +// - Pure whitespace (but only in the special case where this the entire text +// is just whitespace) +// +// We have to include surrounding whitespace in the tokens because the two +// alternative approaches produce horribly broken results: +// * If we just discard the whitespace, we can't fully reproduce the original +// text from the sequence of tokens and any attempt to render the diff will +// get the whitespace wrong. +// * If we have separate tokens for whitespace, then in a typical text every +// second token will be a single space character. But this often results in +// the optimal diff between two texts being a perverse one that preserves +// the spaces between words but deletes and reinserts actual common words. +// See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640 +// for an example. +// +// Keeping the surrounding whitespace of course has implications for .equals +// and .join, not just .tokenize. + +// This regex does NOT fully implement the tokenization rules described above. +// Instead, it gives runs of whitespace their own "token". The tokenize method +// then handles stitching whitespace tokens onto adjacent word or punctuation +// tokens. +var tokenizeIncludingWhitespace = new RegExp("[".concat(extendedWordChars, "]+|\\s+|[^").concat(extendedWordChars, "]"), 'ug'); +var wordDiff = new Diff(); +wordDiff.equals = function (left, right, options) { + if (options.ignoreCase) { + left = left.toLowerCase(); + right = right.toLowerCase(); + } + return left.trim() === right.trim(); +}; +wordDiff.tokenize = function (value) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var parts; + if (options.intlSegmenter) { + if (options.intlSegmenter.resolvedOptions().granularity != 'word') { + throw new Error('The segmenter passed must have a granularity of "word"'); + } + parts = Array.from(options.intlSegmenter.segment(value), function (segment) { + return segment.segment; + }); + } else { + parts = value.match(tokenizeIncludingWhitespace) || []; + } + var tokens = []; + var prevPart = null; + parts.forEach(function (part) { + if (/\s/.test(part)) { + if (prevPart == null) { + tokens.push(part); + } else { + tokens.push(tokens.pop() + part); + } + } else if (/\s/.test(prevPart)) { + if (tokens[tokens.length - 1] == prevPart) { + tokens.push(tokens.pop() + part); + } else { + tokens.push(prevPart + part); + } + } else { + tokens.push(part); + } + prevPart = part; + }); + return tokens; +}; +wordDiff.join = function (tokens) { + // Tokens being joined here will always have appeared consecutively in the + // same text, so we can simply strip off the leading whitespace from all the + // tokens except the first (and except any whitespace-only tokens - but such + // a token will always be the first and only token anyway) and then join them + // and the whitespace around words and punctuation will end up correct. + return tokens.map(function (token, i) { + if (i == 0) { + return token; + } else { + return token.replace(/^\s+/, ''); + } + }).join(''); +}; +wordDiff.postProcess = function (changes, options) { + if (!changes || options.oneChangePerToken) { + return changes; + } + var lastKeep = null; + // Change objects representing any insertion or deletion since the last + // "keep" change object. There can be at most one of each. + var insertion = null; + var deletion = null; + changes.forEach(function (change) { + if (change.added) { + insertion = change; + } else if (change.removed) { + deletion = change; + } else { + if (insertion || deletion) { + // May be false at start of text + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change); + } + lastKeep = change; + insertion = null; + deletion = null; + } + }); + if (insertion || deletion) { + dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null); + } + return changes; +}; +function diffWords(oldStr, newStr, options) { + // This option has never been documented and never will be (it's clearer to + // just call `diffWordsWithSpace` directly if you need that behavior), but + // has existed in jsdiff for a long time, so we retain support for it here + // for the sake of backwards compatibility. + if ((options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace) { + return diffWordsWithSpace(oldStr, newStr, options); + } + return wordDiff.diff(oldStr, newStr, options); +} +function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) { + // Before returning, we tidy up the leading and trailing whitespace of the + // change objects to eliminate cases where trailing whitespace in one object + // is repeated as leading whitespace in the next. + // Below are examples of the outcomes we want here to explain the code. + // I=insert, K=keep, D=delete + // 1. diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want: K:'foo ' D:'bar ' K:'baz' + // + // 2. Diffing 'foo bar baz' vs 'foo qux baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz' + // After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz' + // + // 3. Diffing 'foo\nbar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:'\nbar ' K:' baz' + // After cleanup, we want K'foo' D:'\nbar' K:' baz' + // + // 4. Diffing 'foo baz' vs 'foo\nbar baz' + // Prior to cleanup, we have K:'foo\n' I:'\nbar ' K:' baz' + // After cleanup, we ideally want K'foo' I:'\nbar' K:' baz' + // but don't actually manage this currently (the pre-cleanup change + // objects don't contain enough information to make it possible). + // + // 5. Diffing 'foo bar baz' vs 'foo baz' + // Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz' + // After cleanup, we want K:'foo ' D:' bar ' K:'baz' + // + // Our handling is unavoidably imperfect in the case where there's a single + // indel between keeps and the whitespace has changed. For instance, consider + // diffing 'foo\tbar\nbaz' vs 'foo baz'. Unless we create an extra change + // object to represent the insertion of the space character (which isn't even + // a token), we have no way to avoid losing information about the texts' + // original whitespace in the result we return. Still, we do our best to + // output something that will look sensible if we e.g. print it with + // insertions in green and deletions in red. + + // Between two "keep" change objects (or before the first or after the last + // change object), we can have either: + // * A "delete" followed by an "insert" + // * Just an "insert" + // * Just a "delete" + // We handle the three cases separately. + if (deletion && insertion) { + var oldWsPrefix = deletion.value.match(/^\s*/)[0]; + var oldWsSuffix = deletion.value.match(/\s*$/)[0]; + var newWsPrefix = insertion.value.match(/^\s*/)[0]; + var newWsSuffix = insertion.value.match(/\s*$/)[0]; + if (startKeep) { + var commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix); + startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix); + deletion.value = removePrefix(deletion.value, commonWsPrefix); + insertion.value = removePrefix(insertion.value, commonWsPrefix); + } + if (endKeep) { + var commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix); + endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix); + deletion.value = removeSuffix(deletion.value, commonWsSuffix); + insertion.value = removeSuffix(insertion.value, commonWsSuffix); + } + } else if (insertion) { + // The whitespaces all reflect what was in the new text rather than + // the old, so we essentially have no information about whitespace + // insertion or deletion. We just want to dedupe the whitespace. + // We do that by having each change object keep its trailing + // whitespace and deleting duplicate leading whitespace where + // present. + if (startKeep) { + insertion.value = insertion.value.replace(/^\s*/, ''); + } + if (endKeep) { + endKeep.value = endKeep.value.replace(/^\s*/, ''); + } + // otherwise we've got a deletion and no insertion + } else if (startKeep && endKeep) { + var newWsFull = endKeep.value.match(/^\s*/)[0], + delWsStart = deletion.value.match(/^\s*/)[0], + delWsEnd = deletion.value.match(/\s*$/)[0]; + + // Any whitespace that comes straight after startKeep in both the old and + // new texts, assign to startKeep and remove from the deletion. + var newWsStart = longestCommonPrefix(newWsFull, delWsStart); + deletion.value = removePrefix(deletion.value, newWsStart); + + // Any whitespace that comes straight before endKeep in both the old and + // new texts, and hasn't already been assigned to startKeep, assign to + // endKeep and remove from the deletion. + var newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd); + deletion.value = removeSuffix(deletion.value, newWsEnd); + endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd); + + // If there's any whitespace from the new text that HASN'T already been + // assigned, assign it to the start: + startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length)); + } else if (endKeep) { + // We are at the start of the text. Preserve all the whitespace on + // endKeep, and just remove whitespace from the end of deletion to the + // extent that it overlaps with the start of endKeep. + var endKeepWsPrefix = endKeep.value.match(/^\s*/)[0]; + var deletionWsSuffix = deletion.value.match(/\s*$/)[0]; + var overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix); + deletion.value = removeSuffix(deletion.value, overlap); + } else if (startKeep) { + // We are at the END of the text. Preserve all the whitespace on + // startKeep, and just remove whitespace from the start of deletion to + // the extent that it overlaps with the end of startKeep. + var startKeepWsSuffix = startKeep.value.match(/\s*$/)[0]; + var deletionWsPrefix = deletion.value.match(/^\s*/)[0]; + var _overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix); + deletion.value = removePrefix(deletion.value, _overlap); + } +} +var wordWithSpaceDiff = new Diff(); +wordWithSpaceDiff.tokenize = function (value) { + // Slightly different to the tokenizeIncludingWhitespace regex used above in + // that this one treats each individual newline as a distinct tokens, rather + // than merging them into other surrounding whitespace. This was requested + // in https://github.com/kpdecker/jsdiff/issues/180 & + // https://github.com/kpdecker/jsdiff/issues/211 + var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), 'ug'); + return value.match(regex) || []; +}; +function diffWordsWithSpace(oldStr, newStr, options) { + return wordWithSpaceDiff.diff(oldStr, newStr, options); +} + +function generateOptions(options, defaults) { + if (typeof options === 'function') { + defaults.callback = options; + } else if (options) { + for (var name in options) { + /* istanbul ignore else */ + if (options.hasOwnProperty(name)) { + defaults[name] = options[name]; + } + } + } + return defaults; +} + +var lineDiff = new Diff(); +lineDiff.tokenize = function (value, options) { + if (options.stripTrailingCr) { + // remove one \r before \n to match GNU diff's --strip-trailing-cr behavior + value = value.replace(/\r\n/g, '\n'); + } + var retLines = [], + linesAndNewlines = value.split(/(\n|\r\n)/); + + // Ignore the final empty token that occurs if the string ends with a new line + if (!linesAndNewlines[linesAndNewlines.length - 1]) { + linesAndNewlines.pop(); + } + + // Merge the content and line separators into single tokens + for (var i = 0; i < linesAndNewlines.length; i++) { + var line = linesAndNewlines[i]; + if (i % 2 && !options.newlineIsToken) { + retLines[retLines.length - 1] += line; + } else { + retLines.push(line); + } + } + return retLines; +}; +lineDiff.equals = function (left, right, options) { + // If we're ignoring whitespace, we need to normalise lines by stripping + // whitespace before checking equality. (This has an annoying interaction + // with newlineIsToken that requires special handling: if newlines get their + // own token, then we DON'T want to trim the *newline* tokens down to empty + // strings, since this would cause us to treat whitespace-only line content + // as equal to a separator between lines, which would be weird and + // inconsistent with the documented behavior of the options.) + if (options.ignoreWhitespace) { + if (!options.newlineIsToken || !left.includes('\n')) { + left = left.trim(); + } + if (!options.newlineIsToken || !right.includes('\n')) { + right = right.trim(); + } + } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) { + if (left.endsWith('\n')) { + left = left.slice(0, -1); + } + if (right.endsWith('\n')) { + right = right.slice(0, -1); + } + } + return Diff.prototype.equals.call(this, left, right, options); +}; +function diffLines(oldStr, newStr, callback) { + return lineDiff.diff(oldStr, newStr, callback); +} + +// Kept for backwards compatibility. This is a rather arbitrary wrapper method +// that just calls `diffLines` with `ignoreWhitespace: true`. It's confusing to +// have two ways to do exactly the same thing in the API, so we no longer +// document this one (library users should explicitly use `diffLines` with +// `ignoreWhitespace: true` instead) but we keep it around to maintain +// compatibility with code that used old versions. +function diffTrimmedLines(oldStr, newStr, callback) { + var options = generateOptions(callback, { + ignoreWhitespace: true + }); + return lineDiff.diff(oldStr, newStr, options); +} + +var sentenceDiff = new Diff(); +sentenceDiff.tokenize = function (value) { + return value.split(/(\S.+?[.!?])(?=\s+|$)/); +}; +function diffSentences(oldStr, newStr, callback) { + return sentenceDiff.diff(oldStr, newStr, callback); +} + +var cssDiff = new Diff(); +cssDiff.tokenize = function (value) { + return value.split(/([{}:;,]|\s+)/); +}; +function diffCss(oldStr, newStr, callback) { + return cssDiff.diff(oldStr, newStr, callback); +} + +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); + } + return t; +} +function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; +} +function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; +} +function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); +} +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 _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); +} +function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); +} +function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); +} +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; +} +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +var jsonDiff = new Diff(); +// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a +// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: +jsonDiff.useLongestToken = true; +jsonDiff.tokenize = lineDiff.tokenize; +jsonDiff.castInput = function (value, options) { + var undefinedReplacement = options.undefinedReplacement, + _options$stringifyRep = options.stringifyReplacer, + stringifyReplacer = _options$stringifyRep === void 0 ? function (k, v) { + return typeof v === 'undefined' ? undefinedReplacement : v; + } : _options$stringifyRep; + return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' '); +}; +jsonDiff.equals = function (left, right, options) { + return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options); +}; +function diffJson(oldObj, newObj, options) { + return jsonDiff.diff(oldObj, newObj, options); +} + +// This function handles the presence of circular references by bailing out when encountering an +// object that is already on the "stack" of items being processed. Accepts an optional replacer +function canonicalize(obj, stack, replacementStack, replacer, key) { + stack = stack || []; + replacementStack = replacementStack || []; + if (replacer) { + obj = replacer(key, obj); + } + var i; + for (i = 0; i < stack.length; i += 1) { + if (stack[i] === obj) { + return replacementStack[i]; + } + } + var canonicalizedObj; + if ('[object Array]' === Object.prototype.toString.call(obj)) { + stack.push(obj); + canonicalizedObj = new Array(obj.length); + replacementStack.push(canonicalizedObj); + for (i = 0; i < obj.length; i += 1) { + canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key); + } + stack.pop(); + replacementStack.pop(); + return canonicalizedObj; + } + if (obj && obj.toJSON) { + obj = obj.toJSON(); + } + if (_typeof(obj) === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + replacementStack.push(canonicalizedObj); + var sortedKeys = [], + _key; + for (_key in obj) { + /* istanbul ignore else */ + if (Object.prototype.hasOwnProperty.call(obj, _key)) { + sortedKeys.push(_key); + } + } + sortedKeys.sort(); + for (i = 0; i < sortedKeys.length; i += 1) { + _key = sortedKeys[i]; + canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key); + } + stack.pop(); + replacementStack.pop(); + } else { + canonicalizedObj = obj; + } + return canonicalizedObj; +} + +var arrayDiff = new Diff(); +arrayDiff.tokenize = function (value) { + return value.slice(); +}; +arrayDiff.join = arrayDiff.removeEmpty = function (value) { + return value; +}; +function diffArrays(oldArr, newArr, callback) { + return arrayDiff.diff(oldArr, newArr, callback); +} + +function unixToWin(patch) { + if (Array.isArray(patch)) { + return patch.map(unixToWin); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line, i) { + var _hunk$lines; + return line.startsWith('\\') || line.endsWith('\r') || (_hunk$lines = hunk.lines[i + 1]) !== null && _hunk$lines !== void 0 && _hunk$lines.startsWith('\\') ? line : line + '\r'; + }) + }); + }) + }); +} +function winToUnix(patch) { + if (Array.isArray(patch)) { + return patch.map(winToUnix); + } + return _objectSpread2(_objectSpread2({}, patch), {}, { + hunks: patch.hunks.map(function (hunk) { + return _objectSpread2(_objectSpread2({}, hunk), {}, { + lines: hunk.lines.map(function (line) { + return line.endsWith('\r') ? line.substring(0, line.length - 1) : line; + }) + }); + }) + }); +} + +/** + * Returns true if the patch consistently uses Unix line endings (or only involves one line and has + * no line endings). + */ +function isUnix(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return !patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return !line.startsWith('\\') && line.endsWith('\r'); + }); + }); + }); +} + +/** + * Returns true if the patch uses Windows line endings and only Windows line endings. + */ +function isWin(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return patch.some(function (index) { + return index.hunks.some(function (hunk) { + return hunk.lines.some(function (line) { + return line.endsWith('\r'); + }); + }); + }) && patch.every(function (index) { + return index.hunks.every(function (hunk) { + return hunk.lines.every(function (line, i) { + var _hunk$lines2; + return line.startsWith('\\') || line.endsWith('\r') || ((_hunk$lines2 = hunk.lines[i + 1]) === null || _hunk$lines2 === void 0 ? void 0 : _hunk$lines2.startsWith('\\')); + }); + }); + }); +} + +function parsePatch(uniDiff) { + var diffstr = uniDiff.split(/\n/), + list = [], + i = 0; + function parseIndex() { + var index = {}; + list.push(index); + + // Parse diff metadata + while (i < diffstr.length) { + var line = diffstr[i]; + + // File header found, end parsing diff metadata + if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { + break; + } + + // Diff index + var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); + if (header) { + index.index = header[1]; + } + i++; + } + + // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + parseFileHeader(index); + parseFileHeader(index); + + // Parse hunks + index.hunks = []; + while (i < diffstr.length) { + var _line = diffstr[i]; + if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) { + break; + } else if (/^@@/.test(_line)) { + index.hunks.push(parseHunk()); + } else if (_line) { + throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); + } else { + i++; + } + } + } + + // Parses the --- and +++ headers, if none are found, no lines + // are consumed. + function parseFileHeader(index) { + var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]); + if (fileHeader) { + var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; + var data = fileHeader[2].split('\t', 2); + var fileName = data[0].replace(/\\\\/g, '\\'); + if (/^".*"$/.test(fileName)) { + fileName = fileName.substr(1, fileName.length - 2); + } + index[keyPrefix + 'FileName'] = fileName; + index[keyPrefix + 'Header'] = (data[1] || '').trim(); + i++; + } + } + + // Parses a hunk + // This assumes that we are at the start of a hunk. + function parseHunk() { + var chunkHeaderIndex = i, + chunkHeaderLine = diffstr[i++], + chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); + var hunk = { + oldStart: +chunkHeader[1], + oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2], + newStart: +chunkHeader[3], + newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4], + lines: [] + }; + + // Unified Diff Format quirk: If the chunk size is 0, + // the first number is one lower than one would expect. + // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 + if (hunk.oldLines === 0) { + hunk.oldStart += 1; + } + if (hunk.newLines === 0) { + hunk.newStart += 1; + } + var addCount = 0, + removeCount = 0; + for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || (_diffstr$i = diffstr[i]) !== null && _diffstr$i !== void 0 && _diffstr$i.startsWith('\\')); i++) { + var _diffstr$i; + var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; + if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { + hunk.lines.push(diffstr[i]); + if (operation === '+') { + addCount++; + } else if (operation === '-') { + removeCount++; + } else if (operation === ' ') { + addCount++; + removeCount++; + } + } else { + throw new Error("Hunk at line ".concat(chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i])); + } + } + + // Handle the empty block count case + if (!addCount && hunk.newLines === 1) { + hunk.newLines = 0; + } + if (!removeCount && hunk.oldLines === 1) { + hunk.oldLines = 0; + } + + // Perform sanity checking + if (addCount !== hunk.newLines) { + throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + if (removeCount !== hunk.oldLines) { + throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + return hunk; + } + while (i < diffstr.length) { + parseIndex(); + } + return list; +} + +// Iterator that traverses in the range of [min, max], stepping +// by distance from a given start position. I.e. for [0, 4], with +// start of 2, this will iterate 2, 3, 1, 4, 0. +function distanceIterator (start, minLine, maxLine) { + var wantForward = true, + backwardExhausted = false, + forwardExhausted = false, + localOffset = 1; + return function iterator() { + if (wantForward && !forwardExhausted) { + if (backwardExhausted) { + localOffset++; + } else { + wantForward = false; + } + + // Check if trying to fit beyond text length, and if not, check it fits + // after offset location (or desired location on first iteration) + if (start + localOffset <= maxLine) { + return start + localOffset; + } + forwardExhausted = true; + } + if (!backwardExhausted) { + if (!forwardExhausted) { + wantForward = true; + } + + // Check if trying to fit before text beginning, and if not, check it fits + // before offset location + if (minLine <= start - localOffset) { + return start - localOffset++; + } + backwardExhausted = true; + return iterator(); + } + + // We tried to fit hunk before text beginning and beyond text length, then + // hunk can't fit on the text. Return undefined + }; +} + +function applyPatch(source, uniDiff) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } + if (Array.isArray(uniDiff)) { + if (uniDiff.length > 1) { + throw new Error('applyPatch only works with a single input.'); + } + uniDiff = uniDiff[0]; + } + if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) { + if (hasOnlyWinLineEndings(source) && isUnix(uniDiff)) { + uniDiff = unixToWin(uniDiff); + } else if (hasOnlyUnixLineEndings(source) && isWin(uniDiff)) { + uniDiff = winToUnix(uniDiff); + } + } + + // Apply the diff to the input + var lines = source.split('\n'), + hunks = uniDiff.hunks, + compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { + return line === patchContent; + }, + fuzzFactor = options.fuzzFactor || 0, + minLine = 0; + if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) { + throw new Error('fuzzFactor must be a non-negative integer'); + } + + // Special case for empty patch. + if (!hunks.length) { + return source; + } + + // Before anything else, handle EOFNL insertion/removal. If the patch tells us to make a change + // to the EOFNL that is redundant/impossible - i.e. to remove a newline that's not there, or add a + // newline that already exists - then we either return false and fail to apply the patch (if + // fuzzFactor is 0) or simply ignore the problem and do nothing (if fuzzFactor is >0). + // If we do need to remove/add a newline at EOF, this will always be in the final hunk: + var prevLine = '', + removeEOFNL = false, + addEOFNL = false; + for (var i = 0; i < hunks[hunks.length - 1].lines.length; i++) { + var line = hunks[hunks.length - 1].lines[i]; + if (line[0] == '\\') { + if (prevLine[0] == '+') { + removeEOFNL = true; + } else if (prevLine[0] == '-') { + addEOFNL = true; + } + } + prevLine = line; + } + if (removeEOFNL) { + if (addEOFNL) { + // This means the final line gets changed but doesn't have a trailing newline in either the + // original or patched version. In that case, we do nothing if fuzzFactor > 0, and if + // fuzzFactor is 0, we simply validate that the source file has no trailing newline. + if (!fuzzFactor && lines[lines.length - 1] == '') { + return false; + } + } else if (lines[lines.length - 1] == '') { + lines.pop(); + } else if (!fuzzFactor) { + return false; + } + } else if (addEOFNL) { + if (lines[lines.length - 1] != '') { + lines.push(''); + } else if (!fuzzFactor) { + return false; + } + } + + /** + * Checks if the hunk can be made to fit at the provided location with at most `maxErrors` + * insertions, substitutions, or deletions, while ensuring also that: + * - lines deleted in the hunk match exactly, and + * - wherever an insertion operation or block of insertion operations appears in the hunk, the + * immediately preceding and following lines of context match exactly + * + * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0]. + * + * If the hunk can be applied, returns an object with properties `oldLineLastI` and + * `replacementLines`. Otherwise, returns null. + */ + function applyHunk(hunkLines, toPos, maxErrors) { + var hunkLinesI = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var lastContextLineMatched = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + var patchedLines = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : []; + var patchedLinesLength = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; + var nConsecutiveOldContextLines = 0; + var nextContextLineMustMatch = false; + for (; hunkLinesI < hunkLines.length; hunkLinesI++) { + var hunkLine = hunkLines[hunkLinesI], + operation = hunkLine.length > 0 ? hunkLine[0] : ' ', + content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine; + if (operation === '-') { + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + toPos++; + nConsecutiveOldContextLines = 0; + } else { + if (!maxErrors || lines[toPos] == null) { + return null; + } + patchedLines[patchedLinesLength] = lines[toPos]; + return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1); + } + } + if (operation === '+') { + if (!lastContextLineMatched) { + return null; + } + patchedLines[patchedLinesLength] = content; + patchedLinesLength++; + nConsecutiveOldContextLines = 0; + nextContextLineMustMatch = true; + } + if (operation === ' ') { + nConsecutiveOldContextLines++; + patchedLines[patchedLinesLength] = lines[toPos]; + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + patchedLinesLength++; + lastContextLineMatched = true; + nextContextLineMustMatch = false; + toPos++; + } else { + if (nextContextLineMustMatch || !maxErrors) { + return null; + } + + // Consider 3 possibilities in sequence: + // 1. lines contains a *substitution* not included in the patch context, or + // 2. lines contains an *insertion* not included in the patch context, or + // 3. lines contains a *deletion* not included in the patch context + // The first two options are of course only possible if the line from lines is non-null - + // i.e. only option 3 is possible if we've overrun the end of the old file. + return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength); + } + } + } + + // Before returning, trim any unmodified context lines off the end of patchedLines and reduce + // toPos (and thus oldLineLastI) accordingly. This allows later hunks to be applied to a region + // that starts in this hunk's trailing context. + patchedLinesLength -= nConsecutiveOldContextLines; + toPos -= nConsecutiveOldContextLines; + patchedLines.length = patchedLinesLength; + return { + patchedLines: patchedLines, + oldLineLastI: toPos - 1 + }; + } + var resultLines = []; + + // Search best fit offsets for each hunk based on the previous ones + var prevHunkOffset = 0; + for (var _i = 0; _i < hunks.length; _i++) { + var hunk = hunks[_i]; + var hunkResult = void 0; + var maxLine = lines.length - hunk.oldLines + fuzzFactor; + var toPos = void 0; + for (var maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) { + toPos = hunk.oldStart + prevHunkOffset - 1; + var iterator = distanceIterator(toPos, minLine, maxLine); + for (; toPos !== undefined; toPos = iterator()) { + hunkResult = applyHunk(hunk.lines, toPos, maxErrors); + if (hunkResult) { + break; + } + } + if (hunkResult) { + break; + } + } + if (!hunkResult) { + return false; + } + + // Copy everything from the end of where we applied the last hunk to the start of this hunk + for (var _i2 = minLine; _i2 < toPos; _i2++) { + resultLines.push(lines[_i2]); + } + + // Add the lines produced by applying the hunk: + for (var _i3 = 0; _i3 < hunkResult.patchedLines.length; _i3++) { + var _line = hunkResult.patchedLines[_i3]; + resultLines.push(_line); + } + + // Set lower text limit to end of the current hunk, so next ones don't try + // to fit over already patched text + minLine = hunkResult.oldLineLastI + 1; + + // Note the offset between where the patch said the hunk should've applied and where we + // applied it, so we can adjust future hunks accordingly: + prevHunkOffset = toPos + 1 - hunk.oldStart; + } + + // Copy over the rest of the lines from the old text + for (var _i4 = minLine; _i4 < lines.length; _i4++) { + resultLines.push(lines[_i4]); + } + return resultLines.join('\n'); +} + +// Wrapper that supports multiple file patches via callbacks. +function applyPatches(uniDiff, options) { + if (typeof uniDiff === 'string') { + uniDiff = parsePatch(uniDiff); + } + var currentIndex = 0; + function processIndex() { + var index = uniDiff[currentIndex++]; + if (!index) { + return options.complete(); + } + options.loadFile(index, function (err, data) { + if (err) { + return options.complete(err); + } + var updatedContent = applyPatch(data, index, options); + options.patched(index, updatedContent, function (err) { + if (err) { + return options.complete(err); + } + processIndex(); + }); + }); + } + processIndex(); +} + +function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + if (!options) { + options = {}; + } + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (typeof options.context === 'undefined') { + options.context = 4; + } + if (options.newlineIsToken) { + throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions'); + } + if (!options.callback) { + return diffLinesResultToPatch(diffLines(oldStr, newStr, options)); + } else { + var _options = options, + _callback = _options.callback; + diffLines(oldStr, newStr, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(diff) { + var patch = diffLinesResultToPatch(diff); + _callback(patch); + } + })); + } + function diffLinesResultToPatch(diff) { + // STEP 1: Build up the patch with no "\ No newline at end of file" lines and with the arrays + // of lines containing trailing newline characters. We'll tidy up later... + + if (!diff) { + return; + } + diff.push({ + value: '', + lines: [] + }); // Append an empty value to make cleanup easier + + function contextLines(lines) { + return lines.map(function (entry) { + return ' ' + entry; + }); + } + var hunks = []; + var oldRangeStart = 0, + newRangeStart = 0, + curRange = [], + oldLine = 1, + newLine = 1; + var _loop = function _loop() { + var current = diff[i], + lines = current.lines || splitLines(current.value); + current.lines = lines; + if (current.added || current.removed) { + var _curRange; + // If we have previous context, start with that + if (!oldRangeStart) { + var prev = diff[i - 1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + if (prev) { + curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } + } + + // Output our changes + (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { + return (current.added ? '+' : '-') + entry; + }))); + + // Track the updated file position + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } + } else { + // Identical context lines. Track line changes + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= options.context * 2 && i < diff.length - 2) { + var _curRange2; + // Overlapping + (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); + } else { + var _curRange3; + // end the range and output + var contextSize = Math.min(lines.length, options.context); + (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); + var _hunk = { + oldStart: oldRangeStart, + oldLines: oldLine - oldRangeStart + contextSize, + newStart: newRangeStart, + newLines: newLine - newRangeStart + contextSize, + lines: curRange + }; + hunks.push(_hunk); + oldRangeStart = 0; + newRangeStart = 0; + curRange = []; + } + } + oldLine += lines.length; + newLine += lines.length; + } + }; + for (var i = 0; i < diff.length; i++) { + _loop(); + } + + // Step 2: eliminate the trailing `\n` from each line of each hunk, and, where needed, add + // "\ No newline at end of file". + for (var _i = 0, _hunks = hunks; _i < _hunks.length; _i++) { + var hunk = _hunks[_i]; + for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) { + if (hunk.lines[_i2].endsWith('\n')) { + hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1); + } else { + hunk.lines.splice(_i2 + 1, 0, '\\ No newline at end of file'); + _i2++; // Skip the line we just added, then continue iterating + } + } + } + return { + oldFileName: oldFileName, + newFileName: newFileName, + oldHeader: oldHeader, + newHeader: newHeader, + hunks: hunks + }; + } +} +function formatPatch(diff) { + if (Array.isArray(diff)) { + return diff.map(formatPatch).join('\n'); + } + var ret = []; + if (diff.oldFileName == diff.newFileName) { + ret.push('Index: ' + diff.oldFileName); + } + ret.push('==================================================================='); + ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); + ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); + for (var i = 0; i < diff.hunks.length; i++) { + var hunk = diff.hunks[i]; + // Unified Diff Format quirk: If the chunk size is 0, + // the first number is one lower than one would expect. + // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 + if (hunk.oldLines === 0) { + hunk.oldStart -= 1; + } + if (hunk.newLines === 0) { + hunk.newStart -= 1; + } + ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); + ret.push.apply(ret, hunk.lines); + } + return ret.join('\n') + '\n'; +} +function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + var _options2; + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (!((_options2 = options) !== null && _options2 !== void 0 && _options2.callback)) { + var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + if (!patchObj) { + return; + } + return formatPatch(patchObj); + } else { + var _options3 = options, + _callback2 = _options3.callback; + structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, _objectSpread2(_objectSpread2({}, options), {}, { + callback: function callback(patchObj) { + if (!patchObj) { + _callback2(); + } else { + _callback2(formatPatch(patchObj)); + } + } + })); + } +} +function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { + return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); +} + +/** + * Split `text` into an array of lines, including the trailing newline character (where present) + */ +function splitLines(text) { + var hasTrailingNl = text.endsWith('\n'); + var result = text.split('\n').map(function (line) { + return line + '\n'; + }); + if (hasTrailingNl) { + result.pop(); + } else { + result.push(result.pop().slice(0, -1)); + } + return result; +} + +function arrayEqual(a, b) { + if (a.length !== b.length) { + return false; + } + return arrayStartsWith(a, b); +} +function arrayStartsWith(array, start) { + if (start.length > array.length) { + return false; + } + for (var i = 0; i < start.length; i++) { + if (start[i] !== array[i]) { + return false; + } + } + return true; +} + +function calcLineCount(hunk) { + var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines), + oldLines = _calcOldNewLineCount.oldLines, + newLines = _calcOldNewLineCount.newLines; + if (oldLines !== undefined) { + hunk.oldLines = oldLines; + } else { + delete hunk.oldLines; + } + if (newLines !== undefined) { + hunk.newLines = newLines; + } else { + delete hunk.newLines; + } +} +function merge(mine, theirs, base) { + mine = loadPatch(mine, base); + theirs = loadPatch(theirs, base); + var ret = {}; + + // For index we just let it pass through as it doesn't have any necessary meaning. + // Leaving sanity checks on this to the API consumer that may know more about the + // meaning in their own context. + if (mine.index || theirs.index) { + ret.index = mine.index || theirs.index; + } + if (mine.newFileName || theirs.newFileName) { + if (!fileNameChanged(mine)) { + // No header or no change in ours, use theirs (and ours if theirs does not exist) + ret.oldFileName = theirs.oldFileName || mine.oldFileName; + ret.newFileName = theirs.newFileName || mine.newFileName; + ret.oldHeader = theirs.oldHeader || mine.oldHeader; + ret.newHeader = theirs.newHeader || mine.newHeader; + } else if (!fileNameChanged(theirs)) { + // No header or no change in theirs, use ours + ret.oldFileName = mine.oldFileName; + ret.newFileName = mine.newFileName; + ret.oldHeader = mine.oldHeader; + ret.newHeader = mine.newHeader; + } else { + // Both changed... figure it out + ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); + ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); + ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); + ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); + } + } + ret.hunks = []; + var mineIndex = 0, + theirsIndex = 0, + mineOffset = 0, + theirsOffset = 0; + while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { + var mineCurrent = mine.hunks[mineIndex] || { + oldStart: Infinity + }, + theirsCurrent = theirs.hunks[theirsIndex] || { + oldStart: Infinity + }; + if (hunkBefore(mineCurrent, theirsCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); + mineIndex++; + theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; + } else if (hunkBefore(theirsCurrent, mineCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); + theirsIndex++; + mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; + } else { + // Overlap, merge as best we can + var mergedHunk = { + oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), + oldLines: 0, + newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), + newLines: 0, + lines: [] + }; + mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); + theirsIndex++; + mineIndex++; + ret.hunks.push(mergedHunk); + } + } + return ret; +} +function loadPatch(param, base) { + if (typeof param === 'string') { + if (/^@@/m.test(param) || /^Index:/m.test(param)) { + return parsePatch(param)[0]; + } + if (!base) { + throw new Error('Must provide a base reference or pass in a patch'); + } + return structuredPatch(undefined, undefined, base, param); + } + return param; +} +function fileNameChanged(patch) { + return patch.newFileName && patch.newFileName !== patch.oldFileName; +} +function selectField(index, mine, theirs) { + if (mine === theirs) { + return mine; + } else { + index.conflict = true; + return { + mine: mine, + theirs: theirs + }; + } +} +function hunkBefore(test, check) { + return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; +} +function cloneHunk(hunk, offset) { + return { + oldStart: hunk.oldStart, + oldLines: hunk.oldLines, + newStart: hunk.newStart + offset, + newLines: hunk.newLines, + lines: hunk.lines + }; +} +function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { + // This will generally result in a conflicted hunk, but there are cases where the context + // is the only overlap where we can successfully merge the content here. + var mine = { + offset: mineOffset, + lines: mineLines, + index: 0 + }, + their = { + offset: theirOffset, + lines: theirLines, + index: 0 + }; + + // Handle any leading content + insertLeading(hunk, mine, their); + insertLeading(hunk, their, mine); + + // Now in the overlap content. Scan through and select the best changes from each. + while (mine.index < mine.lines.length && their.index < their.lines.length) { + var mineCurrent = mine.lines[mine.index], + theirCurrent = their.lines[their.index]; + if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { + // Both modified ... + mutualChange(hunk, mine, their); + } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { + var _hunk$lines; + // Mine inserted + (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray(collectChange(mine))); + } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { + var _hunk$lines2; + // Theirs inserted + (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray(collectChange(their))); + } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { + // Mine removed or edited + removal(hunk, mine, their); + } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { + // Their removed or edited + removal(hunk, their, mine, true); + } else if (mineCurrent === theirCurrent) { + // Context identity + hunk.lines.push(mineCurrent); + mine.index++; + their.index++; + } else { + // Context mismatch + conflict(hunk, collectChange(mine), collectChange(their)); + } + } + + // Now push anything that may be remaining + insertTrailing(hunk, mine); + insertTrailing(hunk, their); + calcLineCount(hunk); +} +function mutualChange(hunk, mine, their) { + var myChanges = collectChange(mine), + theirChanges = collectChange(their); + if (allRemoves(myChanges) && allRemoves(theirChanges)) { + // Special case for remove changes that are supersets of one another + if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { + var _hunk$lines3; + (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray(myChanges)); + return; + } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { + var _hunk$lines4; + (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray(theirChanges)); + return; + } + } else if (arrayEqual(myChanges, theirChanges)) { + var _hunk$lines5; + (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray(myChanges)); + return; + } + conflict(hunk, myChanges, theirChanges); +} +function removal(hunk, mine, their, swap) { + var myChanges = collectChange(mine), + theirChanges = collectContext(their, myChanges); + if (theirChanges.merged) { + var _hunk$lines6; + (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray(theirChanges.merged)); + } else { + conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); + } +} +function conflict(hunk, mine, their) { + hunk.conflict = true; + hunk.lines.push({ + conflict: true, + mine: mine, + theirs: their + }); +} +function insertLeading(hunk, insert, their) { + while (insert.offset < their.offset && insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + insert.offset++; + } +} +function insertTrailing(hunk, insert) { + while (insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + } +} +function collectChange(state) { + var ret = [], + operation = state.lines[state.index][0]; + while (state.index < state.lines.length) { + var line = state.lines[state.index]; + + // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. + if (operation === '-' && line[0] === '+') { + operation = '+'; + } + if (operation === line[0]) { + ret.push(line); + state.index++; + } else { + break; + } + } + return ret; +} +function collectContext(state, matchChanges) { + var changes = [], + merged = [], + matchIndex = 0, + contextChanges = false, + conflicted = false; + while (matchIndex < matchChanges.length && state.index < state.lines.length) { + var change = state.lines[state.index], + match = matchChanges[matchIndex]; + + // Once we've hit our add, then we are done + if (match[0] === '+') { + break; + } + contextChanges = contextChanges || change[0] !== ' '; + merged.push(match); + matchIndex++; + + // Consume any additions in the other block as a conflict to attempt + // to pull in the remaining context after this + if (change[0] === '+') { + conflicted = true; + while (change[0] === '+') { + changes.push(change); + change = state.lines[++state.index]; + } + } + if (match.substr(1) === change.substr(1)) { + changes.push(change); + state.index++; + } else { + conflicted = true; + } + } + if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { + conflicted = true; + } + if (conflicted) { + return changes; + } + while (matchIndex < matchChanges.length) { + merged.push(matchChanges[matchIndex++]); + } + return { + merged: merged, + changes: changes + }; +} +function allRemoves(changes) { + return changes.reduce(function (prev, change) { + return prev && change[0] === '-'; + }, true); +} +function skipRemoveSuperset(state, removeChanges, delta) { + for (var i = 0; i < delta; i++) { + var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); + if (state.lines[state.index + i] !== ' ' + changeContent) { + return false; + } + } + state.index += delta; + return true; +} +function calcOldNewLineCount(lines) { + var oldLines = 0; + var newLines = 0; + lines.forEach(function (line) { + if (typeof line !== 'string') { + var myCount = calcOldNewLineCount(line.mine); + var theirCount = calcOldNewLineCount(line.theirs); + if (oldLines !== undefined) { + if (myCount.oldLines === theirCount.oldLines) { + oldLines += myCount.oldLines; + } else { + oldLines = undefined; + } + } + if (newLines !== undefined) { + if (myCount.newLines === theirCount.newLines) { + newLines += myCount.newLines; + } else { + newLines = undefined; + } + } + } else { + if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { + newLines++; + } + if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { + oldLines++; + } + } + }); + return { + oldLines: oldLines, + newLines: newLines + }; +} + +function reversePatch(structuredPatch) { + if (Array.isArray(structuredPatch)) { + return structuredPatch.map(reversePatch).reverse(); + } + return _objectSpread2(_objectSpread2({}, structuredPatch), {}, { + oldFileName: structuredPatch.newFileName, + oldHeader: structuredPatch.newHeader, + newFileName: structuredPatch.oldFileName, + newHeader: structuredPatch.oldHeader, + hunks: structuredPatch.hunks.map(function (hunk) { + return { + oldLines: hunk.newLines, + oldStart: hunk.newStart, + newLines: hunk.oldLines, + newStart: hunk.oldStart, + lines: hunk.lines.map(function (l) { + if (l.startsWith('-')) { + return "+".concat(l.slice(1)); + } + if (l.startsWith('+')) { + return "-".concat(l.slice(1)); + } + return l; + }) + }; + }) + }); +} + +// See: http://code.google.com/p/google-diff-match-patch/wiki/API +function convertChangesToDMP(changes) { + var ret = [], + change, + operation; + for (var i = 0; i < changes.length; i++) { + change = changes[i]; + if (change.added) { + operation = 1; + } else if (change.removed) { + operation = -1; + } else { + operation = 0; + } + ret.push([operation, change.value]); + } + return ret; +} + +function convertChangesToXML(changes) { + var ret = []; + for (var i = 0; i < changes.length; i++) { + var change = changes[i]; + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + ret.push(escapeHTML(change.value)); + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + } + return ret.join(''); +} +function escapeHTML(s) { + var n = s; + n = n.replace(/&/g, '&'); + n = n.replace(//g, '>'); + n = n.replace(/"/g, '"'); + return n; +} + +export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, formatPatch, merge, parsePatch, reversePatch, structuredPatch }; diff --git a/node_modules/npm/node_modules/diff/lib/patch/apply.js b/node_modules/npm/node_modules/diff/lib/patch/apply.js new file mode 100644 index 00000000..619def1f --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/patch/apply.js @@ -0,0 +1,393 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.applyPatch = applyPatch; +exports.applyPatches = applyPatches; +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_string = require("../util/string") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_lineEndings = require("./line-endings") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_parse = require("./parse") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_distanceIterator = _interopRequireDefault(require("../util/distance-iterator")) +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/*istanbul ignore end*/ +function applyPatch(source, uniDiff) { + /*istanbul ignore start*/ + var + /*istanbul ignore end*/ + options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + if (typeof uniDiff === 'string') { + uniDiff = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _parse + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + parsePatch) + /*istanbul ignore end*/ + (uniDiff); + } + if (Array.isArray(uniDiff)) { + if (uniDiff.length > 1) { + throw new Error('applyPatch only works with a single input.'); + } + uniDiff = uniDiff[0]; + } + if (options.autoConvertLineEndings || options.autoConvertLineEndings == null) { + if ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + hasOnlyWinLineEndings) + /*istanbul ignore end*/ + (source) && + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _lineEndings + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + isUnix) + /*istanbul ignore end*/ + (uniDiff)) { + uniDiff = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _lineEndings + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + unixToWin) + /*istanbul ignore end*/ + (uniDiff); + } else if ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _string + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + hasOnlyUnixLineEndings) + /*istanbul ignore end*/ + (source) && + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _lineEndings + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + isWin) + /*istanbul ignore end*/ + (uniDiff)) { + uniDiff = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _lineEndings + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + winToUnix) + /*istanbul ignore end*/ + (uniDiff); + } + } + + // Apply the diff to the input + var lines = source.split('\n'), + hunks = uniDiff.hunks, + compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + line === patchContent + ); + }, + fuzzFactor = options.fuzzFactor || 0, + minLine = 0; + if (fuzzFactor < 0 || !Number.isInteger(fuzzFactor)) { + throw new Error('fuzzFactor must be a non-negative integer'); + } + + // Special case for empty patch. + if (!hunks.length) { + return source; + } + + // Before anything else, handle EOFNL insertion/removal. If the patch tells us to make a change + // to the EOFNL that is redundant/impossible - i.e. to remove a newline that's not there, or add a + // newline that already exists - then we either return false and fail to apply the patch (if + // fuzzFactor is 0) or simply ignore the problem and do nothing (if fuzzFactor is >0). + // If we do need to remove/add a newline at EOF, this will always be in the final hunk: + var prevLine = '', + removeEOFNL = false, + addEOFNL = false; + for (var i = 0; i < hunks[hunks.length - 1].lines.length; i++) { + var line = hunks[hunks.length - 1].lines[i]; + if (line[0] == '\\') { + if (prevLine[0] == '+') { + removeEOFNL = true; + } else if (prevLine[0] == '-') { + addEOFNL = true; + } + } + prevLine = line; + } + if (removeEOFNL) { + if (addEOFNL) { + // This means the final line gets changed but doesn't have a trailing newline in either the + // original or patched version. In that case, we do nothing if fuzzFactor > 0, and if + // fuzzFactor is 0, we simply validate that the source file has no trailing newline. + if (!fuzzFactor && lines[lines.length - 1] == '') { + return false; + } + } else if (lines[lines.length - 1] == '') { + lines.pop(); + } else if (!fuzzFactor) { + return false; + } + } else if (addEOFNL) { + if (lines[lines.length - 1] != '') { + lines.push(''); + } else if (!fuzzFactor) { + return false; + } + } + + /** + * Checks if the hunk can be made to fit at the provided location with at most `maxErrors` + * insertions, substitutions, or deletions, while ensuring also that: + * - lines deleted in the hunk match exactly, and + * - wherever an insertion operation or block of insertion operations appears in the hunk, the + * immediately preceding and following lines of context match exactly + * + * `toPos` should be set such that lines[toPos] is meant to match hunkLines[0]. + * + * If the hunk can be applied, returns an object with properties `oldLineLastI` and + * `replacementLines`. Otherwise, returns null. + */ + function applyHunk(hunkLines, toPos, maxErrors) { + /*istanbul ignore start*/ + var + /*istanbul ignore end*/ + hunkLinesI = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + /*istanbul ignore start*/ + var + /*istanbul ignore end*/ + lastContextLineMatched = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; + /*istanbul ignore start*/ + var + /*istanbul ignore end*/ + patchedLines = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : []; + /*istanbul ignore start*/ + var + /*istanbul ignore end*/ + patchedLinesLength = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0; + var nConsecutiveOldContextLines = 0; + var nextContextLineMustMatch = false; + for (; hunkLinesI < hunkLines.length; hunkLinesI++) { + var hunkLine = hunkLines[hunkLinesI], + operation = hunkLine.length > 0 ? hunkLine[0] : ' ', + content = hunkLine.length > 0 ? hunkLine.substr(1) : hunkLine; + if (operation === '-') { + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + toPos++; + nConsecutiveOldContextLines = 0; + } else { + if (!maxErrors || lines[toPos] == null) { + return null; + } + patchedLines[patchedLinesLength] = lines[toPos]; + return applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1); + } + } + if (operation === '+') { + if (!lastContextLineMatched) { + return null; + } + patchedLines[patchedLinesLength] = content; + patchedLinesLength++; + nConsecutiveOldContextLines = 0; + nextContextLineMustMatch = true; + } + if (operation === ' ') { + nConsecutiveOldContextLines++; + patchedLines[patchedLinesLength] = lines[toPos]; + if (compareLine(toPos + 1, lines[toPos], operation, content)) { + patchedLinesLength++; + lastContextLineMatched = true; + nextContextLineMustMatch = false; + toPos++; + } else { + if (nextContextLineMustMatch || !maxErrors) { + return null; + } + + // Consider 3 possibilities in sequence: + // 1. lines contains a *substitution* not included in the patch context, or + // 2. lines contains an *insertion* not included in the patch context, or + // 3. lines contains a *deletion* not included in the patch context + // The first two options are of course only possible if the line from lines is non-null - + // i.e. only option 3 is possible if we've overrun the end of the old file. + return lines[toPos] && (applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength + 1) || applyHunk(hunkLines, toPos + 1, maxErrors - 1, hunkLinesI, false, patchedLines, patchedLinesLength + 1)) || applyHunk(hunkLines, toPos, maxErrors - 1, hunkLinesI + 1, false, patchedLines, patchedLinesLength); + } + } + } + + // Before returning, trim any unmodified context lines off the end of patchedLines and reduce + // toPos (and thus oldLineLastI) accordingly. This allows later hunks to be applied to a region + // that starts in this hunk's trailing context. + patchedLinesLength -= nConsecutiveOldContextLines; + toPos -= nConsecutiveOldContextLines; + patchedLines.length = patchedLinesLength; + return { + patchedLines: patchedLines, + oldLineLastI: toPos - 1 + }; + } + var resultLines = []; + + // Search best fit offsets for each hunk based on the previous ones + var prevHunkOffset = 0; + for (var _i = 0; _i < hunks.length; _i++) { + var hunk = hunks[_i]; + var hunkResult = + /*istanbul ignore start*/ + void 0 + /*istanbul ignore end*/ + ; + var maxLine = lines.length - hunk.oldLines + fuzzFactor; + var toPos = + /*istanbul ignore start*/ + void 0 + /*istanbul ignore end*/ + ; + for (var maxErrors = 0; maxErrors <= fuzzFactor; maxErrors++) { + toPos = hunk.oldStart + prevHunkOffset - 1; + var iterator = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _distanceIterator + /*istanbul ignore end*/ + [ + /*istanbul ignore start*/ + "default" + /*istanbul ignore end*/ + ])(toPos, minLine, maxLine); + for (; toPos !== undefined; toPos = iterator()) { + hunkResult = applyHunk(hunk.lines, toPos, maxErrors); + if (hunkResult) { + break; + } + } + if (hunkResult) { + break; + } + } + if (!hunkResult) { + return false; + } + + // Copy everything from the end of where we applied the last hunk to the start of this hunk + for (var _i2 = minLine; _i2 < toPos; _i2++) { + resultLines.push(lines[_i2]); + } + + // Add the lines produced by applying the hunk: + for (var _i3 = 0; _i3 < hunkResult.patchedLines.length; _i3++) { + var _line = hunkResult.patchedLines[_i3]; + resultLines.push(_line); + } + + // Set lower text limit to end of the current hunk, so next ones don't try + // to fit over already patched text + minLine = hunkResult.oldLineLastI + 1; + + // Note the offset between where the patch said the hunk should've applied and where we + // applied it, so we can adjust future hunks accordingly: + prevHunkOffset = toPos + 1 - hunk.oldStart; + } + + // Copy over the rest of the lines from the old text + for (var _i4 = minLine; _i4 < lines.length; _i4++) { + resultLines.push(lines[_i4]); + } + return resultLines.join('\n'); +} + +// Wrapper that supports multiple file patches via callbacks. +function applyPatches(uniDiff, options) { + if (typeof uniDiff === 'string') { + uniDiff = + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _parse + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + parsePatch) + /*istanbul ignore end*/ + (uniDiff); + } + var currentIndex = 0; + function processIndex() { + var index = uniDiff[currentIndex++]; + if (!index) { + return options.complete(); + } + options.loadFile(index, function (err, data) { + if (err) { + return options.complete(err); + } + var updatedContent = applyPatch(data, index, options); + options.patched(index, updatedContent, function (err) { + if (err) { + return options.complete(err); + } + processIndex(); + }); + }); + } + processIndex(); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfc3RyaW5nIiwicmVxdWlyZSIsIl9saW5lRW5kaW5ncyIsIl9wYXJzZSIsIl9kaXN0YW5jZUl0ZXJhdG9yIiwiX2ludGVyb3BSZXF1aXJlRGVmYXVsdCIsIm9iaiIsIl9fZXNNb2R1bGUiLCJhcHBseVBhdGNoIiwic291cmNlIiwidW5pRGlmZiIsIm9wdGlvbnMiLCJhcmd1bWVudHMiLCJsZW5ndGgiLCJ1bmRlZmluZWQiLCJwYXJzZVBhdGNoIiwiQXJyYXkiLCJpc0FycmF5IiwiRXJyb3IiLCJhdXRvQ29udmVydExpbmVFbmRpbmdzIiwiaGFzT25seVdpbkxpbmVFbmRpbmdzIiwiaXNVbml4IiwidW5peFRvV2luIiwiaGFzT25seVVuaXhMaW5lRW5kaW5ncyIsImlzV2luIiwid2luVG9Vbml4IiwibGluZXMiLCJzcGxpdCIsImh1bmtzIiwiY29tcGFyZUxpbmUiLCJsaW5lTnVtYmVyIiwibGluZSIsIm9wZXJhdGlvbiIsInBhdGNoQ29udGVudCIsImZ1enpGYWN0b3IiLCJtaW5MaW5lIiwiTnVtYmVyIiwiaXNJbnRlZ2VyIiwicHJldkxpbmUiLCJyZW1vdmVFT0ZOTCIsImFkZEVPRk5MIiwiaSIsInBvcCIsInB1c2giLCJhcHBseUh1bmsiLCJodW5rTGluZXMiLCJ0b1BvcyIsIm1heEVycm9ycyIsImh1bmtMaW5lc0kiLCJsYXN0Q29udGV4dExpbmVNYXRjaGVkIiwicGF0Y2hlZExpbmVzIiwicGF0Y2hlZExpbmVzTGVuZ3RoIiw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kID0gdHJ1ZSxcbiAgICBwYXRjaGVkTGluZXMgPSBbXSxcbiAgICBwYXRjaGVkTGluZXNMZW5ndGggPSAwLFxuICApIHtcbiAgICBsZXQgbkNvbnNlY3V0aXZlT2xkQ29udGV4dExpbmVzID0gMDtcbiAgICBsZXQgbmV4dENvbnRleHRMaW5lTXVzdE1hdGNoID0gZmFsc2U7XG4gICAgZm9yICg7IGh1bmtMaW5lc0kgPCBodW5rTGluZXMubGVuZ3RoOyBodW5rTGluZXNJKyspIHtcbiAgICAgIGxldCBodW5rTGluZSA9IGh1bmtMaW5lc1todW5rTGluZXNJXSxcbiAgICAgICAgICBvcGVyYXRpb24gPSAoaHVua0xpbmUubGVuZ3RoID4gMCA/IGh1bmtMaW5lWzBdIDogJyAnKSxcbiAgICAgICAgICBjb250ZW50ID0gKGh1bmtMaW5lLmxlbmd0aCA+IDAgPyBodW5rTGluZS5zdWJzdHIoMSkgOiBodW5rTGluZSk7XG5cbiAgICAgIGlmIChvcGVyYXRpb24gPT09ICctJykge1xuICAgICAgICBpZiAoY29tcGFyZUxpbmUodG9Qb3MgKyAxLCBsaW5lc1t0b1Bvc10sIG9wZXJhdGlvbiwgY29udGVudCkpIHtcbiAgICAgICAgICB0b1BvcysrO1xuICAgICAgICAgIG5Db25zZWN1dGl2ZU9sZENvbnRleHRMaW5lcyA9IDA7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgaWYgKCFtYXhFcnJvcnMgfHwgbGluZXNbdG9Qb3NdID09IG51bGwpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICAgIH1cbiAgICAgICAgICBwYXRjaGVkTGluZXNbcGF0Y2hlZExpbmVzTGVuZ3RoXSA9IGxpbmVzW3RvUG9zXTtcbiAgICAgICAgICByZXR1cm4gYXBwbHlIdW5rKFxuICAgICAgICAgICAgaHVua0xpbmVzLFxuICAgICAgICAgICAgdG9Qb3MgKyAxLFxuICAgICAgICAgICAgbWF4RXJyb3JzIC0gMS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XhFcnJvcnMpIHtcbiAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIC8vIENvbnNpZGVyIDMgcG9zc2liaWxpdGllcyBpbiBzZXF1ZW5jZTpcbiAgICAgICAgICAvLyAxLiBsaW5lcyBjb250YWlucyBhICpzdWJzdGl0dXRpb24qIG5vdCBpbmNsdWRlZCBpbiB0aGUgcGF0Y2ggY29udGV4dCwgb3JcbiAgICAgICAgICAvLyAyLiBsaW5lcyBjb250YWlucyBhbiAqaW5zZXJ0aW9uKiBub3QgaW5jbHVkZWQgaW4gdGhlIHBhdGNoIGNvbnRleHQsIG9yXG4gICAgICAgICAgLy8gMy4gbGluZXMgY29udGFpbnMgYSAqZGVsZXRpb24qIG5vdCBpbmNsdWRlZCBpbiB0aGUgcGF0Y2ggY29udGV4dFxuICAgICAgICAgIC8vIFRoZSBmaXJzdCB0d28gb3B0aW9ucyBhcmUgb2YgY291cnNlIG9ubHkgcG9zc2libGUgaWYgdGhlIGxpbmUgZnJvbSBsaW5lcyBpcyBub24tbnVsbCAtXG4gICAgICAgICAgLy8gaS5lLiBvbmx5IG9wdGlvbiAzIGlzIHBvc3NpYmxlIGlmIHdlJ3ZlIG92ZXJydW4gdGhlIGVuZCBvZiB0aGUgb2xkIGZpbGUuXG4gICAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgIGxpbmVzW3RvUG9zXSAmJiAoXG4gICAgICAgICAgICAgIGFwcGx5SHVuayhcbiAgICAgICAgICAgICAgICBodW5rTGluZXMsXG4gICAgICAgICAgICAgICAgdG9Qb3MgKyAxLFxuICAgICAgICAgICAgICAgIG1heEVycm9ycyAtIDEsXG4gICAgICAgICAgICAgICAgaHVua0xpbmVzSSArIDEsXG4gICAgICAgICAgICAgICAgZmFsc2UsXG4gICAgICAgICAgICAgICAgcGF0Y2hlZExpbmVzLFxuICAgICAgICAgICAgICAgIHBhdGNoZWRMaW5lc0xlbmd0aCArIDFcbiAgICAgICAgICAgICAgKSB8fCBhcHBseUh1bmsoXG4gICAgICAgICAgICAgICAgaHVua0xpbmVzLFxuICAgICAgICAgICAgICAgIHRvUG9zICsgMSxcbiAgICAgICAgICAgICAgICBtYXhFcnJvcnMgLSAxLFxuICAgICAgICAgICAgICAgIGh1bmtMaW5lc0ksXG4gICAgICAgICAgICAgICAgZmFsc2UsXG4gICAgICAgICAgICAgICAgcGF0Y2hlZExpbmVzLFxuICAgICAgICAgICAgICAgIHBhdGNoZWRMaW5lc0xlbmd0aCArIDFcbiAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKSB8fCBhcHBseUh1bmsoXG4gICAgICAgICAgICAgIGh1bmtMaW5lcyxcbiAgICAgICAgICAgICAgdG9Qb3MsXG4gICAgICAgICAgICAgIG1heEVycm9ycyAtIDEsXG4gICAgICAgICAgICAgIGh1bmtMaW5lc0kgKyAxLFxuICAgICAgICAgICAgICBmYWxzZSxcbiAgICAgICAgICAgICAgcGF0Y2hlZExpbmVzLFxuICAgICAgICAgICAgICBwYXRjaGVkTGluZXNMZW5ndGhcbiAgICAgICAgICAgIClcbiAgICAgICAgICApO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgLy8gQmVmb3JlIHJldHVybmluZywgdHJpbSBhbnkgdW5tb2RpZmllZCBjb250ZXh0IGxpbmVzIG9mZiB0aGUgZW5kIG9mIHBhdGNoZWRMaW5lcyBhbmQgcmVkdWNlXG4gICAgLy8gdG9Qb3MgKGFuZCB0aHVzIG9sZExpbmVMYXN0SSkgYWNjb3JkaW5nbHkuIFRoaXMgYWxsb3dzIGxhdGVyIGh1bmtzIHRvIGJlIGFwcGxpZWQgdG8gYSByZWdpb25cbiAgICAvLyB0aGF0IHN0YXJ0cyBpbiB0aGlzIGh1bmsncyB0cmFpbGluZyBjb250ZXh0LlxuICAgIHBhdGNoZWRMaW5lc0xlbmd0aCAtPSBuQ29uc2VjdXRpdmVPbGRDb250ZXh0TGluZXM7XG4gICAgdG9Qb3MgLT0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Q2tFLE9BQU8sQ0FBQ04sS0FBSyxFQUFFSyxjQUFjLEVBQUUsVUFBU0YsR0FBRyxFQUFFO1FBQ25ELElBQUlBLEdBQUcsRUFBRTtVQUNQLE9BQU8vRCxPQUFPLENBQUM2RCxRQUFRLENBQUNFLEdBQUcsQ0FBQztRQUM5QjtRQUVBSixZQUFZLENBQUMsQ0FBQztNQUNoQixDQUFDLENBQUM7SUFDSixDQUFDLENBQUM7RUFDSjtFQUNBQSxZQUFZLENBQUMsQ0FBQztBQUNoQiIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/node_modules/npm/node_modules/diff/lib/patch/create.js b/node_modules/npm/node_modules/diff/lib/patch/create.js new file mode 100644 index 00000000..10ec2d46 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/patch/create.js @@ -0,0 +1,369 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createPatch = createPatch; +exports.createTwoFilesPatch = createTwoFilesPatch; +exports.formatPatch = formatPatch; +exports.structuredPatch = structuredPatch; +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_line = require("../diff/line") +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +/*istanbul ignore end*/ +function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + if (!options) { + options = {}; + } + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (typeof options.context === 'undefined') { + options.context = 4; + } + if (options.newlineIsToken) { + throw new Error('newlineIsToken may not be used with patch-generation functions, only with diffing functions'); + } + if (!options.callback) { + return diffLinesResultToPatch( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _line + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + diffLines) + /*istanbul ignore end*/ + (oldStr, newStr, options)); + } else { + var + /*istanbul ignore start*/ + _options = + /*istanbul ignore end*/ + options, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + _callback = _options.callback; + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _line + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + diffLines) + /*istanbul ignore end*/ + (oldStr, newStr, + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + options), {}, { + callback: function + /*istanbul ignore start*/ + callback + /*istanbul ignore end*/ + (diff) { + var patch = diffLinesResultToPatch(diff); + _callback(patch); + } + })); + } + function diffLinesResultToPatch(diff) { + // STEP 1: Build up the patch with no "\ No newline at end of file" lines and with the arrays + // of lines containing trailing newline characters. We'll tidy up later... + + if (!diff) { + return; + } + diff.push({ + value: '', + lines: [] + }); // Append an empty value to make cleanup easier + + function contextLines(lines) { + return lines.map(function (entry) { + return ' ' + entry; + }); + } + var hunks = []; + var oldRangeStart = 0, + newRangeStart = 0, + curRange = [], + oldLine = 1, + newLine = 1; + /*istanbul ignore start*/ + var _loop = function _loop() + /*istanbul ignore end*/ + { + var current = diff[i], + lines = current.lines || splitLines(current.value); + current.lines = lines; + if (current.added || current.removed) { + /*istanbul ignore start*/ + var _curRange; + /*istanbul ignore end*/ + // If we have previous context, start with that + if (!oldRangeStart) { + var prev = diff[i - 1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + if (prev) { + curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } + } + + // Output our changes + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_curRange = + /*istanbul ignore end*/ + curRange).push.apply( + /*istanbul ignore start*/ + _curRange + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + lines.map(function (entry) { + return (current.added ? '+' : '-') + entry; + }))); + + // Track the updated file position + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } + } else { + // Identical context lines. Track line changes + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= options.context * 2 && i < diff.length - 2) { + /*istanbul ignore start*/ + var _curRange2; + /*istanbul ignore end*/ + // Overlapping + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_curRange2 = + /*istanbul ignore end*/ + curRange).push.apply( + /*istanbul ignore start*/ + _curRange2 + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + contextLines(lines))); + } else { + /*istanbul ignore start*/ + var _curRange3; + /*istanbul ignore end*/ + // end the range and output + var contextSize = Math.min(lines.length, options.context); + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_curRange3 = + /*istanbul ignore end*/ + curRange).push.apply( + /*istanbul ignore start*/ + _curRange3 + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + contextLines(lines.slice(0, contextSize)))); + var _hunk = { + oldStart: oldRangeStart, + oldLines: oldLine - oldRangeStart + contextSize, + newStart: newRangeStart, + newLines: newLine - newRangeStart + contextSize, + lines: curRange + }; + hunks.push(_hunk); + oldRangeStart = 0; + newRangeStart = 0; + curRange = []; + } + } + oldLine += lines.length; + newLine += lines.length; + } + }; + for (var i = 0; i < diff.length; i++) + /*istanbul ignore start*/ + { + _loop(); + } + + // Step 2: eliminate the trailing `\n` from each line of each hunk, and, where needed, add + // "\ No newline at end of file". + /*istanbul ignore end*/ + for ( + /*istanbul ignore start*/ + var _i = 0, _hunks = + /*istanbul ignore end*/ + hunks; + /*istanbul ignore start*/ + _i < _hunks.length + /*istanbul ignore end*/ + ; + /*istanbul ignore start*/ + _i++ + /*istanbul ignore end*/ + ) { + var hunk = + /*istanbul ignore start*/ + _hunks[_i] + /*istanbul ignore end*/ + ; + for (var _i2 = 0; _i2 < hunk.lines.length; _i2++) { + if (hunk.lines[_i2].endsWith('\n')) { + hunk.lines[_i2] = hunk.lines[_i2].slice(0, -1); + } else { + hunk.lines.splice(_i2 + 1, 0, '\\ No newline at end of file'); + _i2++; // Skip the line we just added, then continue iterating + } + } + } + return { + oldFileName: oldFileName, + newFileName: newFileName, + oldHeader: oldHeader, + newHeader: newHeader, + hunks: hunks + }; + } +} +function formatPatch(diff) { + if (Array.isArray(diff)) { + return diff.map(formatPatch).join('\n'); + } + var ret = []; + if (diff.oldFileName == diff.newFileName) { + ret.push('Index: ' + diff.oldFileName); + } + ret.push('==================================================================='); + ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); + ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); + for (var i = 0; i < diff.hunks.length; i++) { + var hunk = diff.hunks[i]; + // Unified Diff Format quirk: If the chunk size is 0, + // the first number is one lower than one would expect. + // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 + if (hunk.oldLines === 0) { + hunk.oldStart -= 1; + } + if (hunk.newLines === 0) { + hunk.newStart -= 1; + } + ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); + ret.push.apply(ret, hunk.lines); + } + return ret.join('\n') + '\n'; +} +function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { + /*istanbul ignore start*/ + var _options2; + /*istanbul ignore end*/ + if (typeof options === 'function') { + options = { + callback: options + }; + } + if (! + /*istanbul ignore start*/ + ((_options2 = + /*istanbul ignore end*/ + options) !== null && _options2 !== void 0 && + /*istanbul ignore start*/ + _options2 + /*istanbul ignore end*/ + .callback)) { + var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); + if (!patchObj) { + return; + } + return formatPatch(patchObj); + } else { + var + /*istanbul ignore start*/ + _options3 = + /*istanbul ignore end*/ + options, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + _callback2 = _options3.callback; + structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + options), {}, { + callback: function + /*istanbul ignore start*/ + callback + /*istanbul ignore end*/ + (patchObj) { + if (!patchObj) { + _callback2(); + } else { + _callback2(formatPatch(patchObj)); + } + } + })); + } +} +function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { + return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); +} + +/** + * Split `text` into an array of lines, including the trailing newline character (where present) + */ +function splitLines(text) { + var hasTrailingNl = text.endsWith('\n'); + var result = text.split('\n').map(function (line) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + line + '\n' + ); + }); + if (hasTrailingNl) { + result.pop(); + } else { + result.push(result.pop().slice(0, -1)); + } + return result; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfbGluZSIsInJlcXVpcmUiLCJfdHlwZW9mIiwibyIsIlN5bWJvbCIsIml0ZXJhdG9yIiwiY29uc3RydWN0b3IiLCJwcm90b3R5cGUiLCJfdG9Db25zdW1hYmxlQXJyYXkiLCJhcnIiLCJfYXJyYXlXaXRob3V0SG9sZXMiLCJfaXRlcmFibGVUb0FycmF5IiwiX3Vuc3VwcG9ydGVkSXRlcmFibGVUb0FycmF5IiwiX25vbkl0ZXJhYmxlU3ByZWFkIiwiVHlwZUVycm9yIiwibWluTGVuIiwiX2FycmF5TGlrZVRvQXJy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PSBNYXRoLm1pbihsaW5lcy5sZW5ndGgsIG9wdGlvbnMuY29udGV4dCk7XG4gICAgICAgICAgICBjdXJSYW5nZS5wdXNoKC4uLiBjb250ZXh0TGluZXMobGluZXMuc2xpY2UoMCwgY29udGV4dFNpemUpKSk7XG5cbiAgICAgICAgICAgIGxldCBodW5rID0ge1xuICAgICAgICAgICAgICBvbGRTdGFydDogb2xkUmFuZ2VTdGFydCxcbiAgICAgICAgICAgICAgb2xkTGluZXM6IChvbGRMaW5lIC0gb2xkUmFuZ2VTdGFydCArIGNvbnRleHRTaXplKSxcbiAgICAgICAgICAgICAgbmV3U3RhcnQ6IG5ld1JhbmdlU3RhcnQsXG4gICAgICAgICAgICAgIG5ld0xpbmVzOiAobmV3TGluZSAtIG5ld1JhbmdlU3RhcnQgKyBjb250ZXh0U2l6ZSksXG4gICAgICAgICAgICAgIGxpbmVzOiBjdXJSYW5nZVxuICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIGh1bmtzLnB1c2goaHVuayk7XG5cbiAgICAgICAgICAgIG9sZFJhbmdlU3RhcnQgPSAwO1xuICAgICAgICAgICAgbmV3UmFuZ2VTdGFydCA9IDA7XG4gICAgICAgICAgICBjdXJSYW5nZSA9IFtdO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBvbGRMaW5lICs9IGxpbmVzLmxlbmd0aDtcbiAgICAgICAgbmV3TGluZSArPSBsaW5lcy5sZW5ndGg7XG4gICAgICB9XG4gICAgfVxuXG4gICAgLy8gU3RlcCAyOiBlbGltaW5hdGUgdGhlIHRyYWlsaW5nIGBcXG5gIGZyb20gZWFjaCBsaW5lIG9mIGVhY2ggaHVuaywgYW5kLCB3aGVyZSBuZWVkZWQsIGFkZFxuICAgIC8vICAgICAgICAgXCJcXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBmaWxlXCIuXG4gICAgZm9yIChjb25zdCBodW5rIG9mIGh1bmtzKSB7XG4gICAgICBmb3IgKGxldCBpID0gMDsgaSA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QixVQUFVQSxDQUFDNEIsSUFBSSxFQUFFO0VBQ3hCLElBQU1DLGFBQWEsR0FBR0QsSUFBSSxDQUFDWCxRQUFRLENBQUMsSUFBSSxDQUFDO0VBQ3pDLElBQU1hLE1BQU0sR0FBR0YsSUFBSSxDQUFDRyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUN6QyxHQUFHLENBQUMsVUFBQTBDLElBQUk7RUFBQTtFQUFBO0lBQUE7TUFBQTtNQUFJQSxJQUFJLEdBQUc7SUFBSTtFQUFBLEVBQUM7RUFDeEQsSUFBSUgsYUFBYSxFQUFFO0lBQ2pCQyxNQUFNLENBQUNHLEdBQUcsQ0FBQyxDQUFDO0VBQ2QsQ0FBQyxNQUFNO0lBQ0xILE1BQU0sQ0FBQzlFLElBQUksQ0FBQzhFLE1BQU0sQ0FBQ0csR0FBRyxDQUFDLENBQUMsQ0FBQ3JHLEtBQUssQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQztFQUN4QztFQUNBLE9BQU9rRyxNQUFNO0FBQ2YiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/node_modules/npm/node_modules/diff/lib/patch/line-endings.js b/node_modules/npm/node_modules/diff/lib/patch/line-endings.js new file mode 100644 index 00000000..8d00bd22 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/patch/line-endings.js @@ -0,0 +1,176 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isUnix = isUnix; +exports.isWin = isWin; +exports.unixToWin = unixToWin; +exports.winToUnix = winToUnix; +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +/*istanbul ignore end*/ +function unixToWin(patch) { + if (Array.isArray(patch)) { + return patch.map(unixToWin); + } + return ( + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + patch), {}, { + hunks: patch.hunks.map(function (hunk) + /*istanbul ignore start*/ + { + return _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + hunk), {}, { + lines: hunk.lines.map(function (line, i) + /*istanbul ignore start*/ + { + var _hunk$lines; + return ( + /*istanbul ignore end*/ + line.startsWith('\\') || line.endsWith('\r') || + /*istanbul ignore start*/ + (_hunk$lines = + /*istanbul ignore end*/ + hunk.lines[i + 1]) !== null && _hunk$lines !== void 0 && + /*istanbul ignore start*/ + _hunk$lines + /*istanbul ignore end*/ + .startsWith('\\') ? line : line + '\r' + ); + }) + }); + }) + }) + ); +} +function winToUnix(patch) { + if (Array.isArray(patch)) { + return patch.map(winToUnix); + } + return ( + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + patch), {}, { + hunks: patch.hunks.map(function (hunk) + /*istanbul ignore start*/ + { + return _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + hunk), {}, { + lines: hunk.lines.map(function (line) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + line.endsWith('\r') ? line.substring(0, line.length - 1) : line + ); + }) + }); + }) + }) + ); +} + +/** + * Returns true if the patch consistently uses Unix line endings (or only involves one line and has + * no line endings). + */ +function isUnix(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return !patch.some(function (index) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + index.hunks.some(function (hunk) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + hunk.lines.some(function (line) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + !line.startsWith('\\') && line.endsWith('\r') + ); + }) + ); + }) + ); + }); +} + +/** + * Returns true if the patch uses Windows line endings and only Windows line endings. + */ +function isWin(patch) { + if (!Array.isArray(patch)) { + patch = [patch]; + } + return patch.some(function (index) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + index.hunks.some(function (hunk) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + hunk.lines.some(function (line) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + line.endsWith('\r') + ); + }) + ); + }) + ); + }) && patch.every(function (index) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + index.hunks.every(function (hunk) + /*istanbul ignore start*/ + { + return ( + /*istanbul ignore end*/ + hunk.lines.every(function (line, i) + /*istanbul ignore start*/ + { + var _hunk$lines2; + return ( + /*istanbul ignore end*/ + line.startsWith('\\') || line.endsWith('\r') || + /*istanbul ignore start*/ + ((_hunk$lines2 = + /*istanbul ignore end*/ + hunk.lines[i + 1]) === null || _hunk$lines2 === void 0 ? void 0 : + /*istanbul ignore start*/ + _hunk$lines2 + /*istanbul ignore end*/ + .startsWith('\\')) + ); + }) + ); + }) + ); + }); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJ1bml4VG9XaW4iLCJwYXRjaCIsIkFycmF5IiwiaXNBcnJheSIsIm1hcCIsIl9vYmplY3RTcHJlYWQiLCJodW5rcyIsImh1bmsiLCJsaW5lcyIsImxpbmUiLCJpIiwiX2h1bmskbGluZXMiLCJzdGFydHNXaXRoIiwiZW5kc1dpdGgiLCJ3aW5Ub1VuaXgiLCJzdWJzdHJpbmciLCJsZW5ndGgiLCJpc1VuaXgiLCJzb21lIiwiaW5kZXgiLCJpc1dpbiIsImV2ZXJ5IiwiX2h1bmskbGluZXMyIl0sInNvdXJjZXMiOlsiLi4vLi4vc3JjL3BhdGNoL2xpbmUtZW5kaW5ncy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gdW5peFRvV2luKHBhdGNoKSB7XG4gIGlmIChBcnJheS5pc0FycmF5KHBhdGNoKSkge1xuICAgIHJldHVybiBwYXRjaC5tYXAodW5peFRvV2luKTtcbiAgfVxuXG4gIHJldHVybiB7XG4gICAgLi4ucGF0Y2gsXG4gICAgaHVua3M6IHBhdGNoLmh1bmtzLm1hcChodW5rID0+ICh7XG4gICAgICAuLi5odW5rLFxuICAgICAgbGluZXM6IGh1bmsubGluZXMubWFwKFxuICAgICAgICAobGluZSwgaSkgPT5cbiAgICAgICAgICAobGluZS5zdGFydHNXaXRoKCdcXFxcJykgfHwgbGluZS5lbmRzV2l0aCgnXFxyJykgfHwgaHVuay5saW5lc1tpICsgMV0/LnN0YXJ0c1dpdGgoJ1xcXFwnKSlcbiAgICAgICAgICAgID8gbGluZVxuICAgICAgICAgICAgOiBsaW5lICsgJ1xccidcbiAgICAgIClcbiAgICB9KSlcbiAgfTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIHdpblRvVW5peChwYXRjaCkge1x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ElBQUk7TUFBQTtNQUFBO1FBQUE7VUFBQTtVQUFJQSxJQUFJLENBQUNDLEtBQUssQ0FBQ1UsSUFBSSxDQUFDLFVBQUFULElBQUk7VUFBQTtVQUFBO1lBQUE7Y0FBQTtjQUFJQSxJQUFJLENBQUNJLFFBQVEsQ0FBQyxJQUFJO1lBQUM7VUFBQTtRQUFDO01BQUE7SUFBQztFQUFBLEVBQUMsSUFDN0ZaLEtBQUssQ0FBQ29CLEtBQUssQ0FDWixVQUFBRixLQUFLO0VBQUE7RUFBQTtJQUFBO01BQUE7TUFBSUEsS0FBSyxDQUFDYixLQUFLLENBQUNlLEtBQUssQ0FDeEIsVUFBQWQsSUFBSTtNQUFBO01BQUE7UUFBQTtVQUFBO1VBQUlBLElBQUksQ0FBQ0MsS0FBSyxDQUFDYSxLQUFLLENBQ3RCLFVBQUNaLElBQUksRUFBRUMsQ0FBQztVQUFBO1VBQUE7WUFBQSxJQUFBWSxZQUFBO1lBQUE7Y0FBQTtjQUFLYixJQUFJLENBQUNHLFVBQVUsQ0FBQyxJQUFJLENBQUMsSUFBSUgsSUFBSSxDQUFDSSxRQUFRLENBQUMsSUFBSSxDQUFDO2NBQUE7Y0FBQSxFQUFBUyxZQUFBO2NBQUE7Y0FBSWYsSUFBSSxDQUFDQyxLQUFLLENBQUNFLENBQUMsR0FBRyxDQUFDLENBQUMsY0FBQVksWUFBQTtjQUFqQjtjQUFBQTtjQUFBO2NBQUEsQ0FBbUJWLFVBQVUsQ0FBQyxJQUFJLENBQUM7WUFBQTtVQUFBLENBQ2xHO1FBQUM7TUFBQSxDQUNIO0lBQUM7RUFBQSxDQUNILENBQUM7QUFDTCIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/node_modules/npm/node_modules/diff/lib/patch/merge.js b/node_modules/npm/node_modules/diff/lib/patch/merge.js new file mode 100644 index 00000000..fead4e01 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/patch/merge.js @@ -0,0 +1,535 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.calcLineCount = calcLineCount; +exports.merge = merge; +/*istanbul ignore end*/ +var +/*istanbul ignore start*/ +_create = require("./create") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_parse = require("./parse") +/*istanbul ignore end*/ +; +var +/*istanbul ignore start*/ +_array = require("../util/array") +/*istanbul ignore end*/ +; +/*istanbul ignore start*/ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } +/*istanbul ignore end*/ +function calcLineCount(hunk) { + var + /*istanbul ignore start*/ + _calcOldNewLineCount = + /*istanbul ignore end*/ + calcOldNewLineCount(hunk.lines), + /*istanbul ignore start*/ + /*istanbul ignore end*/ + oldLines = _calcOldNewLineCount.oldLines, + /*istanbul ignore start*/ + /*istanbul ignore end*/ + newLines = _calcOldNewLineCount.newLines; + if (oldLines !== undefined) { + hunk.oldLines = oldLines; + } else { + delete hunk.oldLines; + } + if (newLines !== undefined) { + hunk.newLines = newLines; + } else { + delete hunk.newLines; + } +} +function merge(mine, theirs, base) { + mine = loadPatch(mine, base); + theirs = loadPatch(theirs, base); + var ret = {}; + + // For index we just let it pass through as it doesn't have any necessary meaning. + // Leaving sanity checks on this to the API consumer that may know more about the + // meaning in their own context. + if (mine.index || theirs.index) { + ret.index = mine.index || theirs.index; + } + if (mine.newFileName || theirs.newFileName) { + if (!fileNameChanged(mine)) { + // No header or no change in ours, use theirs (and ours if theirs does not exist) + ret.oldFileName = theirs.oldFileName || mine.oldFileName; + ret.newFileName = theirs.newFileName || mine.newFileName; + ret.oldHeader = theirs.oldHeader || mine.oldHeader; + ret.newHeader = theirs.newHeader || mine.newHeader; + } else if (!fileNameChanged(theirs)) { + // No header or no change in theirs, use ours + ret.oldFileName = mine.oldFileName; + ret.newFileName = mine.newFileName; + ret.oldHeader = mine.oldHeader; + ret.newHeader = mine.newHeader; + } else { + // Both changed... figure it out + ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName); + ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName); + ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader); + ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader); + } + } + ret.hunks = []; + var mineIndex = 0, + theirsIndex = 0, + mineOffset = 0, + theirsOffset = 0; + while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) { + var mineCurrent = mine.hunks[mineIndex] || { + oldStart: Infinity + }, + theirsCurrent = theirs.hunks[theirsIndex] || { + oldStart: Infinity + }; + if (hunkBefore(mineCurrent, theirsCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(mineCurrent, mineOffset)); + mineIndex++; + theirsOffset += mineCurrent.newLines - mineCurrent.oldLines; + } else if (hunkBefore(theirsCurrent, mineCurrent)) { + // This patch does not overlap with any of the others, yay. + ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset)); + theirsIndex++; + mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines; + } else { + // Overlap, merge as best we can + var mergedHunk = { + oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart), + oldLines: 0, + newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset), + newLines: 0, + lines: [] + }; + mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines); + theirsIndex++; + mineIndex++; + ret.hunks.push(mergedHunk); + } + } + return ret; +} +function loadPatch(param, base) { + if (typeof param === 'string') { + if (/^@@/m.test(param) || /^Index:/m.test(param)) { + return ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _parse + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + parsePatch) + /*istanbul ignore end*/ + (param)[0] + ); + } + if (!base) { + throw new Error('Must provide a base reference or pass in a patch'); + } + return ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _create + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + structuredPatch) + /*istanbul ignore end*/ + (undefined, undefined, base, param) + ); + } + return param; +} +function fileNameChanged(patch) { + return patch.newFileName && patch.newFileName !== patch.oldFileName; +} +function selectField(index, mine, theirs) { + if (mine === theirs) { + return mine; + } else { + index.conflict = true; + return { + mine: mine, + theirs: theirs + }; + } +} +function hunkBefore(test, check) { + return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart; +} +function cloneHunk(hunk, offset) { + return { + oldStart: hunk.oldStart, + oldLines: hunk.oldLines, + newStart: hunk.newStart + offset, + newLines: hunk.newLines, + lines: hunk.lines + }; +} +function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) { + // This will generally result in a conflicted hunk, but there are cases where the context + // is the only overlap where we can successfully merge the content here. + var mine = { + offset: mineOffset, + lines: mineLines, + index: 0 + }, + their = { + offset: theirOffset, + lines: theirLines, + index: 0 + }; + + // Handle any leading content + insertLeading(hunk, mine, their); + insertLeading(hunk, their, mine); + + // Now in the overlap content. Scan through and select the best changes from each. + while (mine.index < mine.lines.length && their.index < their.lines.length) { + var mineCurrent = mine.lines[mine.index], + theirCurrent = their.lines[their.index]; + if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) { + // Both modified ... + mutualChange(hunk, mine, their); + } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') { + /*istanbul ignore start*/ + var _hunk$lines; + /*istanbul ignore end*/ + // Mine inserted + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_hunk$lines = + /*istanbul ignore end*/ + hunk.lines).push.apply( + /*istanbul ignore start*/ + _hunk$lines + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + collectChange(mine))); + } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') { + /*istanbul ignore start*/ + var _hunk$lines2; + /*istanbul ignore end*/ + // Theirs inserted + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_hunk$lines2 = + /*istanbul ignore end*/ + hunk.lines).push.apply( + /*istanbul ignore start*/ + _hunk$lines2 + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + collectChange(their))); + } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') { + // Mine removed or edited + removal(hunk, mine, their); + } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') { + // Their removed or edited + removal(hunk, their, mine, true); + } else if (mineCurrent === theirCurrent) { + // Context identity + hunk.lines.push(mineCurrent); + mine.index++; + their.index++; + } else { + // Context mismatch + conflict(hunk, collectChange(mine), collectChange(their)); + } + } + + // Now push anything that may be remaining + insertTrailing(hunk, mine); + insertTrailing(hunk, their); + calcLineCount(hunk); +} +function mutualChange(hunk, mine, their) { + var myChanges = collectChange(mine), + theirChanges = collectChange(their); + if (allRemoves(myChanges) && allRemoves(theirChanges)) { + // Special case for remove changes that are supersets of one another + if ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _array + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + arrayStartsWith) + /*istanbul ignore end*/ + (myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) { + /*istanbul ignore start*/ + var _hunk$lines3; + /*istanbul ignore end*/ + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_hunk$lines3 = + /*istanbul ignore end*/ + hunk.lines).push.apply( + /*istanbul ignore start*/ + _hunk$lines3 + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + myChanges)); + return; + } else if ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _array + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + arrayStartsWith) + /*istanbul ignore end*/ + (theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) { + /*istanbul ignore start*/ + var _hunk$lines4; + /*istanbul ignore end*/ + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_hunk$lines4 = + /*istanbul ignore end*/ + hunk.lines).push.apply( + /*istanbul ignore start*/ + _hunk$lines4 + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + theirChanges)); + return; + } + } else if ( + /*istanbul ignore start*/ + (0, + /*istanbul ignore end*/ + /*istanbul ignore start*/ + _array + /*istanbul ignore end*/ + . + /*istanbul ignore start*/ + arrayEqual) + /*istanbul ignore end*/ + (myChanges, theirChanges)) { + /*istanbul ignore start*/ + var _hunk$lines5; + /*istanbul ignore end*/ + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_hunk$lines5 = + /*istanbul ignore end*/ + hunk.lines).push.apply( + /*istanbul ignore start*/ + _hunk$lines5 + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + myChanges)); + return; + } + conflict(hunk, myChanges, theirChanges); +} +function removal(hunk, mine, their, swap) { + var myChanges = collectChange(mine), + theirChanges = collectContext(their, myChanges); + if (theirChanges.merged) { + /*istanbul ignore start*/ + var _hunk$lines6; + /*istanbul ignore end*/ + /*istanbul ignore start*/ + /*istanbul ignore end*/ + /*istanbul ignore start*/ + (_hunk$lines6 = + /*istanbul ignore end*/ + hunk.lines).push.apply( + /*istanbul ignore start*/ + _hunk$lines6 + /*istanbul ignore end*/ + , + /*istanbul ignore start*/ + _toConsumableArray( + /*istanbul ignore end*/ + theirChanges.merged)); + } else { + conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges); + } +} +function conflict(hunk, mine, their) { + hunk.conflict = true; + hunk.lines.push({ + conflict: true, + mine: mine, + theirs: their + }); +} +function insertLeading(hunk, insert, their) { + while (insert.offset < their.offset && insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + insert.offset++; + } +} +function insertTrailing(hunk, insert) { + while (insert.index < insert.lines.length) { + var line = insert.lines[insert.index++]; + hunk.lines.push(line); + } +} +function collectChange(state) { + var ret = [], + operation = state.lines[state.index][0]; + while (state.index < state.lines.length) { + var line = state.lines[state.index]; + + // Group additions that are immediately after subtractions and treat them as one "atomic" modify change. + if (operation === '-' && line[0] === '+') { + operation = '+'; + } + if (operation === line[0]) { + ret.push(line); + state.index++; + } else { + break; + } + } + return ret; +} +function collectContext(state, matchChanges) { + var changes = [], + merged = [], + matchIndex = 0, + contextChanges = false, + conflicted = false; + while (matchIndex < matchChanges.length && state.index < state.lines.length) { + var change = state.lines[state.index], + match = matchChanges[matchIndex]; + + // Once we've hit our add, then we are done + if (match[0] === '+') { + break; + } + contextChanges = contextChanges || change[0] !== ' '; + merged.push(match); + matchIndex++; + + // Consume any additions in the other block as a conflict to attempt + // to pull in the remaining context after this + if (change[0] === '+') { + conflicted = true; + while (change[0] === '+') { + changes.push(change); + change = state.lines[++state.index]; + } + } + if (match.substr(1) === change.substr(1)) { + changes.push(change); + state.index++; + } else { + conflicted = true; + } + } + if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) { + conflicted = true; + } + if (conflicted) { + return changes; + } + while (matchIndex < matchChanges.length) { + merged.push(matchChanges[matchIndex++]); + } + return { + merged: merged, + changes: changes + }; +} +function allRemoves(changes) { + return changes.reduce(function (prev, change) { + return prev && change[0] === '-'; + }, true); +} +function skipRemoveSuperset(state, removeChanges, delta) { + for (var i = 0; i < delta; i++) { + var changeContent = removeChanges[removeChanges.length - delta + i].substr(1); + if (state.lines[state.index + i] !== ' ' + changeContent) { + return false; + } + } + state.index += delta; + return true; +} +function calcOldNewLineCount(lines) { + var oldLines = 0; + var newLines = 0; + lines.forEach(function (line) { + if (typeof line !== 'string') { + var myCount = calcOldNewLineCount(line.mine); + var theirCount = calcOldNewLineCount(line.theirs); + if (oldLines !== undefined) { + if (myCount.oldLines === theirCount.oldLines) { + oldLines += myCount.oldLines; + } else { + oldLines = undefined; + } + } + if (newLines !== undefined) { + if (myCount.newLines === theirCount.newLines) { + newLines += myCount.newLines; + } else { + newLines = undefined; + } + } + } else { + if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) { + newLines++; + } + if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) { + oldLines++; + } + } + }); + return { + oldLines: oldLines, + newLines: newLines + }; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfY3JlYXRlIiwicmVxdWlyZSIsIl9wYXJzZSIsIl9hcnJheSIsIl90b0NvbnN1bWFibGVBcnJheSIsImFyciIsIl9hcnJheVdpdGhvdXRIb2xlcyIsIl9pdGVyYWJsZVRvQXJyYXkiLCJfdW5zdXBwb3J0ZWRJdGVyYWJsZVRvQXJyYXkiLCJfbm9uSXRlcmFibGVTcHJlYWQiLCJUeXBlRXJyb3IiLCJvIiwibWluTGV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0FBQyxDQUFDLENBQUMsS0FBSyxHQUFHLElBQUlBLElBQUksQ0FBQyxDQUFDLENBQUMsS0FBSyxHQUFHLENBQUMsRUFBRTtRQUNsRXBFLFFBQVEsRUFBRTtNQUNaO0lBQ0Y7RUFDRixDQUFDLENBQUM7RUFFRixPQUFPO0lBQUNBLFFBQVEsRUFBUkEsUUFBUTtJQUFFQyxRQUFRLEVBQVJBO0VBQVEsQ0FBQztBQUM3QiIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/node_modules/npm/node_modules/diff/lib/patch/parse.js b/node_modules/npm/node_modules/diff/lib/patch/parse.js new file mode 100644 index 00000000..15acdd9a --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/patch/parse.js @@ -0,0 +1,151 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.parsePatch = parsePatch; +/*istanbul ignore end*/ +function parsePatch(uniDiff) { + var diffstr = uniDiff.split(/\n/), + list = [], + i = 0; + function parseIndex() { + var index = {}; + list.push(index); + + // Parse diff metadata + while (i < diffstr.length) { + var line = diffstr[i]; + + // File header found, end parsing diff metadata + if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { + break; + } + + // Diff index + var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); + if (header) { + index.index = header[1]; + } + i++; + } + + // Parse file headers if they are defined. Unified diff requires them, but + // there's no technical issues to have an isolated hunk without file header + parseFileHeader(index); + parseFileHeader(index); + + // Parse hunks + index.hunks = []; + while (i < diffstr.length) { + var _line = diffstr[i]; + if (/^(Index:\s|diff\s|\-\-\-\s|\+\+\+\s|===================================================================)/.test(_line)) { + break; + } else if (/^@@/.test(_line)) { + index.hunks.push(parseHunk()); + } else if (_line) { + throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line)); + } else { + i++; + } + } + } + + // Parses the --- and +++ headers, if none are found, no lines + // are consumed. + function parseFileHeader(index) { + var fileHeader = /^(---|\+\+\+)\s+(.*)\r?$/.exec(diffstr[i]); + if (fileHeader) { + var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; + var data = fileHeader[2].split('\t', 2); + var fileName = data[0].replace(/\\\\/g, '\\'); + if (/^".*"$/.test(fileName)) { + fileName = fileName.substr(1, fileName.length - 2); + } + index[keyPrefix + 'FileName'] = fileName; + index[keyPrefix + 'Header'] = (data[1] || '').trim(); + i++; + } + } + + // Parses a hunk + // This assumes that we are at the start of a hunk. + function parseHunk() { + var chunkHeaderIndex = i, + chunkHeaderLine = diffstr[i++], + chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); + var hunk = { + oldStart: +chunkHeader[1], + oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2], + newStart: +chunkHeader[3], + newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4], + lines: [] + }; + + // Unified Diff Format quirk: If the chunk size is 0, + // the first number is one lower than one would expect. + // https://www.artima.com/weblogs/viewpost.jsp?thread=164293 + if (hunk.oldLines === 0) { + hunk.oldStart += 1; + } + if (hunk.newLines === 0) { + hunk.newStart += 1; + } + var addCount = 0, + removeCount = 0; + for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || + /*istanbul ignore start*/ + (_diffstr$i = + /*istanbul ignore end*/ + diffstr[i]) !== null && _diffstr$i !== void 0 && + /*istanbul ignore start*/ + _diffstr$i + /*istanbul ignore end*/ + .startsWith('\\')); i++) { + /*istanbul ignore start*/ + var _diffstr$i; + /*istanbul ignore end*/ + var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0]; + if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { + hunk.lines.push(diffstr[i]); + if (operation === '+') { + addCount++; + } else if (operation === '-') { + removeCount++; + } else if (operation === ' ') { + addCount++; + removeCount++; + } + } else { + throw new Error( + /*istanbul ignore start*/ + "Hunk at line ".concat( + /*istanbul ignore end*/ + chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i])); + } + } + + // Handle the empty block count case + if (!addCount && hunk.newLines === 1) { + hunk.newLines = 0; + } + if (!removeCount && hunk.oldLines === 1) { + hunk.oldLines = 0; + } + + // Perform sanity checking + if (addCount !== hunk.newLines) { + throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + if (removeCount !== hunk.oldLines) { + throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); + } + return hunk; + } + while (i < diffstr.length) { + parseIndex(); + } + return list; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJwYXJzZVBhdGNoIiwidW5pRGlmZiIsImRpZmZzdHIiLCJzcGxpdCIsImxpc3QiLCJpIiwicGFyc2VJbmRleCIsImluZGV4IiwicHVzaCIsImxlbmd0aCIsImxpbmUiLCJ0ZXN0IiwiaGVhZGVyIiwiZXhlYyIsInBhcnNlRmlsZUhlYWRlciIsImh1bmtzIiwicGFyc2VIdW5rIiwiRXJyb3IiLCJKU09OIiwic3RyaW5naWZ5IiwiZmlsZUhlYWRlciIsImtleVByZWZpeCIsImRhdGEiLCJmaWxlTmFtZSIsInJlcGxhY2UiLCJzdWJzdHIiLCJ0cmltIiwiY2h1bmtIZWFkZXJJbmRleCIsImNodW5rSGVhZGVyTGluZSIsImNodW5rSGVhZGVyIiwiaHVuayIsIm9sZFN0YXJ0Iiwib2xkTGluZXMiLCJuZXdTdGFydCIsIm5ld0xpbmVzIiwibGluZXMiLCJhZGRDb3VudCIsInJlbW92ZUNvdW50IiwiX2RpZmZzdHIkaSIsInN0YXJ0c1dpdGgiLCJvcGVyYXRpb24iLCJjb25jYXQiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvcGF0Y2gvcGFyc2UuanMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGZ1bmN0aW9uIHBhcnNlUGF0Y2godW5pRGlmZ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csQ0FBQyw4QkFBQWMsTUFBQSxDQUEyQnZDLE9BQU8sQ0FBQ0csQ0FBQyxDQUFDLENBQUUsQ0FBQztNQUM5RjtJQUNGOztJQUVBO0lBQ0EsSUFBSSxDQUFDK0IsUUFBUSxJQUFJTixJQUFJLENBQUNJLFFBQVEsS0FBSyxDQUFDLEVBQUU7TUFDcENKLElBQUksQ0FBQ0ksUUFBUSxHQUFHLENBQUM7SUFDbkI7SUFDQSxJQUFJLENBQUNHLFdBQVcsSUFBSVAsSUFBSSxDQUFDRSxRQUFRLEtBQUssQ0FBQyxFQUFFO01BQ3ZDRixJQUFJLENBQUNFLFFBQVEsR0FBRyxDQUFDO0lBQ25COztJQUVBO0lBQ0EsSUFBSUksUUFBUSxLQUFLTixJQUFJLENBQUNJLFFBQVEsRUFBRTtNQUM5QixNQUFNLElBQUlqQixLQUFLLENBQUMsa0RBQWtELElBQUlVLGdCQUFnQixHQUFHLENBQUMsQ0FBQyxDQUFDO0lBQzlGO0lBQ0EsSUFBSVUsV0FBVyxLQUFLUCxJQUFJLENBQUNFLFFBQVEsRUFBRTtNQUNqQyxNQUFNLElBQUlmLEtBQUssQ0FBQyxvREFBb0QsSUFBSVUsZ0JBQWdCLEdBQUcsQ0FBQyxDQUFDLENBQUM7SUFDaEc7SUFFQSxPQUFPRyxJQUFJO0VBQ2I7RUFFQSxPQUFPekIsQ0FBQyxHQUFHSCxPQUFPLENBQUNPLE1BQU0sRUFBRTtJQUN6QkgsVUFBVSxDQUFDLENBQUM7RUFDZDtFQUVBLE9BQU9GLElBQUk7QUFDYiIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/node_modules/npm/node_modules/diff/lib/patch/reverse.js b/node_modules/npm/node_modules/diff/lib/patch/reverse.js new file mode 100644 index 00000000..3c8723e4 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/patch/reverse.js @@ -0,0 +1,58 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.reversePatch = reversePatch; +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +/*istanbul ignore end*/ +function reversePatch(structuredPatch) { + if (Array.isArray(structuredPatch)) { + return structuredPatch.map(reversePatch).reverse(); + } + return ( + /*istanbul ignore start*/ + _objectSpread(_objectSpread({}, + /*istanbul ignore end*/ + structuredPatch), {}, { + oldFileName: structuredPatch.newFileName, + oldHeader: structuredPatch.newHeader, + newFileName: structuredPatch.oldFileName, + newHeader: structuredPatch.oldHeader, + hunks: structuredPatch.hunks.map(function (hunk) { + return { + oldLines: hunk.newLines, + oldStart: hunk.newStart, + newLines: hunk.oldLines, + newStart: hunk.oldStart, + lines: hunk.lines.map(function (l) { + if (l.startsWith('-')) { + return ( + /*istanbul ignore start*/ + "+".concat( + /*istanbul ignore end*/ + l.slice(1)) + ); + } + if (l.startsWith('+')) { + return ( + /*istanbul ignore start*/ + "-".concat( + /*istanbul ignore end*/ + l.slice(1)) + ); + } + return l; + }) + }; + }) + }) + ); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJyZXZlcnNlUGF0Y2giLCJzdHJ1Y3R1cmVkUGF0Y2giLCJBcnJheSIsImlzQXJyYXkiLCJtYXAiLCJyZXZlcnNlIiwiX29iamVjdFNwcmVhZCIsIm9sZEZpbGVOYW1lIiwibmV3RmlsZU5hbWUiLCJvbGRIZWFkZXIiLCJuZXdIZWFkZXIiLCJodW5rcyIsImh1bmsiLCJvbGRMaW5lcyIsIm5ld0xpbmVzIiwib2xkU3RhcnQiLCJuZXdTdGFydCIsImxpbmVzIiwibCIsInN0YXJ0c1dpdGgiLCJjb25jYXQiLCJzbGljZSJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9yZXZlcnNlLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiByZXZlcnNlUGF0Y2goc3RydWN0dXJlZFBhdGNoKSB7XG4gIGlmIChBcnJheS5pc0FycmF5KHN0cnVjdHVyZWRQYXRjaCkpIHtcbiAgICByZXR1cm4gc3RydWN0dXJlZFBhdGNoLm1hcChyZXZlcnNlUGF0Y2gpLnJldmVyc2UoKTtcbiAgfVxuXG4gIHJldHVybiB7XG4gICAgLi4uc3RydWN0dXJlZFBhdGNoLFxuICAgIG9sZEZpbGVOYW1lOiBzdHJ1Y3R1cmVkUGF0Y2gubmV3RmlsZU5hbWUsXG4gICAgb2xkSGVhZGVyOiBzdHJ1Y3R1cmVkUGF0Y2gubmV3SGVhZGVyLF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BQUVSLGVBQWUsQ0FBQ1MsU0FBUztNQUNwQ0YsV0FBVyxFQUFFUCxlQUFlLENBQUNNLFdBQVc7TUFDeENHLFNBQVMsRUFBRVQsZUFBZSxDQUFDUSxTQUFTO01BQ3BDRSxLQUFLLEVBQUVWLGVBQWUsQ0FBQ1UsS0FBSyxDQUFDUCxHQUFHLENBQUMsVUFBQVEsSUFBSSxFQUFJO1FBQ3ZDLE9BQU87VUFDTEMsUUFBUSxFQUFFRCxJQUFJLENBQUNFLFFBQVE7VUFDdkJDLFFBQVEsRUFBRUgsSUFBSSxDQUFDSSxRQUFRO1VBQ3ZCRixRQUFRLEVBQUVGLElBQUksQ0FBQ0MsUUFBUTtVQUN2QkcsUUFBUSxFQUFFSixJQUFJLENBQUNHLFFBQVE7VUFDdkJFLEtBQUssRUFBRUwsSUFBSSxDQUFDSyxLQUFLLENBQUNiLEdBQUcsQ0FBQyxVQUFBYyxDQUFDLEVBQUk7WUFDekIsSUFBSUEsQ0FBQyxDQUFDQyxVQUFVLENBQUMsR0FBRyxDQUFDLEVBQUU7Y0FBRTtnQkFBQTtnQkFBQSxJQUFBQyxNQUFBO2dCQUFBO2dCQUFXRixDQUFDLENBQUNHLEtBQUssQ0FBQyxDQUFDLENBQUM7Y0FBQTtZQUFJO1lBQ2xELElBQUlILENBQUMsQ0FBQ0MsVUFBVSxDQUFDLEdBQUcsQ0FBQyxFQUFFO2NBQUU7Z0JBQUE7Z0JBQUEsSUFBQUMsTUFBQTtnQkFBQTtnQkFBV0YsQ0FBQyxDQUFDRyxLQUFLLENBQUMsQ0FBQyxDQUFDO2NBQUE7WUFBSTtZQUNsRCxPQUFPSCxDQUFDO1VBQ1YsQ0FBQztRQUNILENBQUM7TUFDSCxDQUFDO0lBQUM7RUFBQTtBQUVOIiwiaWdub3JlTGlzdCI6W119 diff --git a/node_modules/npm/node_modules/diff/lib/util/array.js b/node_modules/npm/node_modules/diff/lib/util/array.js new file mode 100644 index 00000000..af10977a --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/util/array.js @@ -0,0 +1,27 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.arrayEqual = arrayEqual; +exports.arrayStartsWith = arrayStartsWith; +/*istanbul ignore end*/ +function arrayEqual(a, b) { + if (a.length !== b.length) { + return false; + } + return arrayStartsWith(a, b); +} +function arrayStartsWith(array, start) { + if (start.length > array.length) { + return false; + } + for (var i = 0; i < start.length; i++) { + if (start[i] !== array[i]) { + return false; + } + } + return true; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJhcnJheUVxdWFsIiwiYSIsImIiLCJsZW5ndGgiLCJhcnJheVN0YXJ0c1dpdGgiLCJhcnJheSIsInN0YXJ0IiwiaSJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2FycmF5LmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBhcnJheUVxdWFsKGEsIGIpIHtcbiAgaWYgKGEubGVuZ3RoICE9PSBiLmxlbmd0aCkge1xuICAgIHJldHVybiBmYWxzZTtcbiAgfVxuXG4gIHJldHVybiBhcnJheVN0YXJ0c1dpdGgoYSwgYik7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBhcnJheVN0YXJ0c1dpdGgoYXJyYXksIHN0YXJ0KSB7XG4gIGlmIChzdGFydC5sZW5ndGggPiBhcnJheS5sZW5ndGgpIHtcbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cblxuICBmb3IgKGxldCBpID0gMDsgaSA8IHN0YXJ0Lmxlbmd0aDsgaSsrKSB7XG4gICAgaWYgKHN0YXJ0W2ldICE9PSBhcnJheVtpXSkge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cbiAgfVxuXG4gIHJldHVybiB0cnVlO1xufVxuIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBTyxTQUFTQSxVQUFVQSxDQUFDQyxDQUFDLEVBQUVDLENBQUMsRUFBRTtFQUMvQixJQUFJRCxDQUFDLENBQUNFLE1BQU0sS0FBS0QsQ0FBQyxDQUFDQyxNQUFNLEVBQUU7SUFDekIsT0FBTyxLQUFLO0VBQ2Q7RUFFQSxPQUFPQyxlQUFlLENBQUNILENBQUMsRUFBRUMsQ0FBQyxDQUFDO0FBQzlCO0FBRU8sU0FBU0UsZUFBZUEsQ0FBQ0MsS0FBSyxFQUFFQyxLQUFLLEVBQUU7RUFDNUMsSUFBSUEsS0FBSyxDQUFDSCxNQUFNLEdBQUdFLEtBQUssQ0FBQ0YsTUFBTSxFQUFFO0lBQy9CLE9BQU8sS0FBSztFQUNkO0VBRUEsS0FBSyxJQUFJSSxDQUFDLEdBQUcsQ0FBQyxFQUFFQSxDQUFDLEdBQUdELEtBQUssQ0FBQ0gsTUFBTSxFQUFFSSxDQUFDLEVBQUUsRUFBRTtJQUNyQyxJQUFJRCxLQUFLLENBQUNDLENBQUMsQ0FBQyxLQUFLRixLQUFLLENBQUNFLENBQUMsQ0FBQyxFQUFFO01BQ3pCLE9BQU8sS0FBSztJQUNkO0VBQ0Y7RUFFQSxPQUFPLElBQUk7QUFDYiIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/node_modules/npm/node_modules/diff/lib/util/distance-iterator.js b/node_modules/npm/node_modules/diff/lib/util/distance-iterator.js new file mode 100644 index 00000000..63893731 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/util/distance-iterator.js @@ -0,0 +1,54 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = _default; +/*istanbul ignore end*/ +// Iterator that traverses in the range of [min, max], stepping +// by distance from a given start position. I.e. for [0, 4], with +// start of 2, this will iterate 2, 3, 1, 4, 0. +function +/*istanbul ignore start*/ +_default +/*istanbul ignore end*/ +(start, minLine, maxLine) { + var wantForward = true, + backwardExhausted = false, + forwardExhausted = false, + localOffset = 1; + return function iterator() { + if (wantForward && !forwardExhausted) { + if (backwardExhausted) { + localOffset++; + } else { + wantForward = false; + } + + // Check if trying to fit beyond text length, and if not, check it fits + // after offset location (or desired location on first iteration) + if (start + localOffset <= maxLine) { + return start + localOffset; + } + forwardExhausted = true; + } + if (!backwardExhausted) { + if (!forwardExhausted) { + wantForward = true; + } + + // Check if trying to fit before text beginning, and if not, check it fits + // before offset location + if (minLine <= start - localOffset) { + return start - localOffset++; + } + backwardExhausted = true; + return iterator(); + } + + // We tried to fit hunk before text beginning and beyond text length, then + // hunk can't fit on the text. Return undefined + }; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfZGVmYXVsdCIsInN0YXJ0IiwibWluTGluZSIsIm1heExpbmUiLCJ3YW50Rm9yd2FyZCIsImJhY2t3YXJkRXhoYXVzdGVkIiwiZm9yd2FyZEV4aGF1c3RlZCIsImxvY2FsT2Zmc2V0IiwiaXRlcmF0b3IiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbC9kaXN0YW5jZS1pdGVyYXRvci5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBJdGVyYXRvciB0aGF0IHRyYXZlcnNlcyBpbiB0aGUgcmFuZ2Ugb2YgW21pbiwgbWF4XSwgc3RlcHBpbmdcbi8vIGJ5IGRpc3RhbmNlIGZyb20gYSBnaXZlbiBzdGFydCBwb3NpdGlvbi4gSS5lLiBmb3IgWzAsIDRdLCB3aXRoXG4vLyBzdGFydCBvZiAyLCB0aGlzIHdpbGwgaXRlcmF0ZSAyLCAzLCAxLCA0LCAwLlxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24oc3RhcnQsIG1pbkxpbmUsIG1heExpbmUpIHtcbiAgbGV0IHdhbnRGb3J3YXJkID0gdHJ1ZSxcbiAgICAgIGJhY2t3YXJkRXhoYXVzdGVkID0gZmFsc2UsXG4gICAgICBmb3J3YXJkRXhoYXVzdGVkID0gZmFsc2U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ElBQUlELEtBQUssR0FBR00sV0FBVyxFQUFFO1FBQ2xDLE9BQU9OLEtBQUssR0FBR00sV0FBVyxFQUFFO01BQzlCO01BRUFGLGlCQUFpQixHQUFHLElBQUk7TUFDeEIsT0FBT0csUUFBUSxDQUFDLENBQUM7SUFDbkI7O0lBRUE7SUFDQTtFQUNGLENBQUM7QUFDSCIsImlnbm9yZUxpc3QiOltdfQ== diff --git a/node_modules/npm/node_modules/diff/lib/util/params.js b/node_modules/npm/node_modules/diff/lib/util/params.js new file mode 100644 index 00000000..283c2472 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/util/params.js @@ -0,0 +1,22 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.generateOptions = generateOptions; +/*istanbul ignore end*/ +function generateOptions(options, defaults) { + if (typeof options === 'function') { + defaults.callback = options; + } else if (options) { + for (var name in options) { + /* istanbul ignore else */ + if (options.hasOwnProperty(name)) { + defaults[name] = options[name]; + } + } + } + return defaults; +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJnZW5lcmF0ZU9wdGlvbnMiLCJvcHRpb25zIiwiZGVmYXVsdHMiLCJjYWxsYmFjayIsIm5hbWUiLCJoYXNPd25Qcm9wZXJ0eSJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3BhcmFtcy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gZ2VuZXJhdGVPcHRpb25zKG9wdGlvbnMsIGRlZmF1bHRzKSB7XG4gIGlmICh0eXBlb2Ygb3B0aW9ucyA9PT0gJ2Z1bmN0aW9uJykge1xuICAgIGRlZmF1bHRzLmNhbGxiYWNrID0gb3B0aW9ucztcbiAgfSBlbHNlIGlmIChvcHRpb25zKSB7XG4gICAgZm9yIChsZXQgbmFtZSBpbiBvcHRpb25zKSB7XG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgaWYgKG9wdGlvbnMuaGFzT3duUHJvcGVydHkobmFtZSkpIHtcbiAgICAgICAgZGVmYXVsdHNbbmFtZV0gPSBvcHRpb25zW25hbWVdO1xuICAgICAgfVxuICAgIH1cbiAgfVxuICByZXR1cm4gZGVmYXVsdHM7XG59XG4iXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBQU8sU0FBU0EsZUFBZUEsQ0FBQ0MsT0FBTyxFQUFFQyxRQUFRLEVBQUU7RUFDakQsSUFBSSxPQUFPRCxPQUFPLEtBQUssVUFBVSxFQUFFO0lBQ2pDQyxRQUFRLENBQUNDLFFBQVEsR0FBR0YsT0FBTztFQUM3QixDQUFDLE1BQU0sSUFBSUEsT0FBTyxFQUFFO0lBQ2xCLEtBQUssSUFBSUcsSUFBSSxJQUFJSCxPQUFPLEVBQUU7TUFDeEI7TUFDQSxJQUFJQSxPQUFPLENBQUNJLGNBQWMsQ0FBQ0QsSUFBSSxDQUFDLEVBQUU7UUFDaENGLFFBQVEsQ0FBQ0UsSUFBSSxDQUFDLEdBQUdILE9BQU8sQ0FBQ0csSUFBSSxDQUFDO01BQ2hDO0lBQ0Y7RUFDRjtFQUNBLE9BQU9GLFFBQVE7QUFDakIiLCJpZ25vcmVMaXN0IjpbXX0= diff --git a/node_modules/npm/node_modules/diff/lib/util/string.js b/node_modules/npm/node_modules/diff/lib/util/string.js new file mode 100644 index 00000000..f81c6827 --- /dev/null +++ b/node_modules/npm/node_modules/diff/lib/util/string.js @@ -0,0 +1,131 @@ +/*istanbul ignore start*/ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.hasOnlyUnixLineEndings = hasOnlyUnixLineEndings; +exports.hasOnlyWinLineEndings = hasOnlyWinLineEndings; +exports.longestCommonPrefix = longestCommonPrefix; +exports.longestCommonSuffix = longestCommonSuffix; +exports.maximumOverlap = maximumOverlap; +exports.removePrefix = removePrefix; +exports.removeSuffix = removeSuffix; +exports.replacePrefix = replacePrefix; +exports.replaceSuffix = replaceSuffix; +/*istanbul ignore end*/ +function longestCommonPrefix(str1, str2) { + var i; + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[i] != str2[i]) { + return str1.slice(0, i); + } + } + return str1.slice(0, i); +} +function longestCommonSuffix(str1, str2) { + var i; + + // Unlike longestCommonPrefix, we need a special case to handle all scenarios + // where we return the empty string since str1.slice(-0) will return the + // entire string. + if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) { + return ''; + } + for (i = 0; i < str1.length && i < str2.length; i++) { + if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) { + return str1.slice(-i); + } + } + return str1.slice(-i); +} +function replacePrefix(string, oldPrefix, newPrefix) { + if (string.slice(0, oldPrefix.length) != oldPrefix) { + throw Error( + /*istanbul ignore start*/ + "string ".concat( + /*istanbul ignore end*/ + JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug")); + } + return newPrefix + string.slice(oldPrefix.length); +} +function replaceSuffix(string, oldSuffix, newSuffix) { + if (!oldSuffix) { + return string + newSuffix; + } + if (string.slice(-oldSuffix.length) != oldSuffix) { + throw Error( + /*istanbul ignore start*/ + "string ".concat( + /*istanbul ignore end*/ + JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug")); + } + return string.slice(0, -oldSuffix.length) + newSuffix; +} +function removePrefix(string, oldPrefix) { + return replacePrefix(string, oldPrefix, ''); +} +function removeSuffix(string, oldSuffix) { + return replaceSuffix(string, oldSuffix, ''); +} +function maximumOverlap(string1, string2) { + return string2.slice(0, overlapCount(string1, string2)); +} + +// Nicked from https://stackoverflow.com/a/60422853/1709587 +function overlapCount(a, b) { + // Deal with cases where the strings differ in length + var startA = 0; + if (a.length > b.length) { + startA = a.length - b.length; + } + var endB = b.length; + if (a.length < b.length) { + endB = a.length; + } + // Create a back-reference for each index + // that should be followed in case of a mismatch. + // We only need B to make these references: + var map = Array(endB); + var k = 0; // Index that lags behind j + map[0] = 0; + for (var j = 1; j < endB; j++) { + if (b[j] == b[k]) { + map[j] = map[k]; // skip over the same character (optional optimisation) + } else { + map[j] = k; + } + while (k > 0 && b[j] != b[k]) { + k = map[k]; + } + if (b[j] == b[k]) { + k++; + } + } + // Phase 2: use these references while iterating over A + k = 0; + for (var i = startA; i < a.length; i++) { + while (k > 0 && a[i] != b[k]) { + k = map[k]; + } + if (a[i] == b[k]) { + k++; + } + } + return k; +} + +/** + * Returns true if the string consistently uses Windows line endings. + */ +function hasOnlyWinLineEndings(string) { + return string.includes('\r\n') && !string.startsWith('\n') && !string.match(/[^\r]\n/); +} + +/** + * Returns true if the string consistently uses Unix line endings. + */ +function hasOnlyUnixLineEndings(string) { + return !string.includes('\r\n') && string.includes('\n'); +} +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJsb25nZXN0Q29tbW9uUHJlZml4Iiwic3RyMSIsInN0cjIiLCJpIiwibGVuZ3RoIiwic2xpY2UiLCJsb25nZXN0Q29tbW9uU3VmZml4IiwicmVwbGFjZVByZWZpeCIsInN0cmluZyIsIm9sZFByZWZpeCIsIm5ld1ByZWZpeCIsIkVycm9yIiwiY29uY2F0IiwiSlNPTiIsInN0cmluZ2lmeSIsInJlcGxhY2VTdWZmaXgiLCJvbGRTdWZmaXgiLCJuZXdTdWZmaXgiLCJyZW1vdmVQcmVmaXgiLCJyZW1vdmVTdWZmaXgiLCJtYXhpbXVtT3ZlcmxhcCIsInN0cmluZzEiLCJzdHJpbmcyIiwib3ZlcmxhcENvdW50IiwiYSIsImIiLCJzdGFydEEiLCJlbmRCIiwibWFwIiwiQXJyYXkiLCJrIiwiaiIsImhhc09ubHlXaW5MaW5lRW5kaW5ncyIsImluY2x1ZGVzIiwic3RhcnRzV2l0aCIsIm1hdGNoIiwiaGFzT25seVVuaXhMaW5lRW5kaW5ncyJdLCJzb3VyY2VzIjpbIi4uLy4uL3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json new file mode 100644 index 00000000..400c8dd8 --- /dev/null +++ b/node_modules/npm/node_modules/diff/package.json @@ -0,0 +1,88 @@ +{ + "name": "diff", + "version": "7.0.0", + "description": "A JavaScript text diff implementation.", + "keywords": [ + "diff", + "jsdiff", + "compare", + "patch", + "text", + "json", + "css", + "javascript" + ], + "maintainers": [ + "Kevin Decker (http://incaseofstairs.com)", + "Mark Amery " + ], + "bugs": { + "email": "kpdecker@gmail.com", + "url": "http://github.com/kpdecker/jsdiff/issues" + }, + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "git://github.com/kpdecker/jsdiff.git" + }, + "engines": { + "node": ">=0.3.1" + }, + "main": "./lib/index.js", + "module": "./lib/index.es6.js", + "browser": "./dist/diff.js", + "unpkg": "./dist/diff.js", + "exports": { + ".": { + "import": "./lib/index.mjs", + "require": "./lib/index.js" + }, + "./package.json": "./package.json", + "./": "./", + "./*": "./*" + }, + "scripts": { + "clean": "rm -rf lib/ dist/", + "build:node": "yarn babel --out-dir lib --source-maps=inline src", + "test": "grunt" + }, + "devDependencies": { + "@babel/cli": "^7.24.1", + "@babel/core": "^7.24.1", + "@babel/plugin-transform-modules-commonjs": "^7.24.1", + "@babel/preset-env": "^7.24.1", + "@babel/register": "^7.23.7", + "@colors/colors": "^1.6.0", + "babel-eslint": "^10.0.1", + "babel-loader": "^9.1.3", + "chai": "^4.2.0", + "eslint": "^5.12.0", + "grunt": "^1.6.1", + "grunt-babel": "^8.0.0", + "grunt-cli": "^1.4.3", + "grunt-contrib-clean": "^2.0.1", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-uglify": "^5.2.2", + "grunt-contrib-watch": "^1.1.0", + "grunt-eslint": "^24.3.0", + "grunt-exec": "^3.0.0", + "grunt-karma": "^4.0.2", + "grunt-mocha-istanbul": "^5.0.2", + "grunt-mocha-test": "^0.13.3", + "grunt-webpack": "^6.0.0", + "istanbul": "github:kpdecker/istanbul", + "karma": "^6.4.3", + "karma-chrome-launcher": "^3.2.0", + "karma-mocha": "^2.0.1", + "karma-mocha-reporter": "^2.2.5", + "karma-sourcemap-loader": "^0.4.0", + "karma-webpack": "^5.0.1", + "mocha": "^7.0.0", + "rollup": "^4.13.0", + "rollup-plugin-babel": "^4.2.0", + "semver": "^7.6.0", + "webpack": "^5.90.3", + "webpack-dev-server": "^5.0.3" + }, + "optionalDependencies": {} +} diff --git a/node_modules/npm/node_modules/diff/release-notes.md b/node_modules/npm/node_modules/diff/release-notes.md new file mode 100644 index 00000000..21b5d41d --- /dev/null +++ b/node_modules/npm/node_modules/diff/release-notes.md @@ -0,0 +1,361 @@ +# Release Notes + +## 7.0.0 + +Just a single (breaking) bugfix, undoing a behaviour change introduced accidentally in 6.0.0: + +- [#554](https://github.com/kpdecker/jsdiff/pull/554) **`diffWords` treats numbers and underscores as word characters again.** This behaviour was broken in v6.0.0. + +## 6.0.0 + +This is a release containing many, *many* breaking changes. The objective of this release was to carry out a mass fix, in one go, of all the open bugs and design problems that required breaking changes to fix. A substantial, but exhaustive, changelog is below. + +[Commits](https://github.com/kpdecker/jsdiff/compare/v5.2.0...v6.0.0) + +- [#497](https://github.com/kpdecker/jsdiff/pull/497) **`diffWords` behavior has been radically changed.** Previously, even with `ignoreWhitespace: true`, runs of whitespace were tokens, which led to unhelpful and unintuitive diffing behavior in typical texts. Specifically, even when two texts contained overlapping passages, `diffWords` would sometimes choose to delete all the words from the old text and insert them anew in their new positions in order to avoid having to delete or insert whitespace tokens. Whitespace sequences are no longer tokens as of this release, which affects both the generated diffs and the `count`s. + + Runs of whitespace are still tokens in `diffWordsWithSpace`. + + As part of the changes to `diffWords`, **a new `.postProcess` method has been added on the base `Diff` type**, which can be overridden in custom `Diff` implementations. + + **`diffLines` with `ignoreWhitespace: true` will no longer ignore the insertion or deletion of entire extra lines of whitespace at the end of the text**. Previously, these would not show up as insertions or deletions, as a side effect of a hack in the base diffing algorithm meant to help ignore whitespace in `diffWords`. More generally, **the undocumented special handling in the core algorithm for ignored terminals has been removed entirely.** (This special case behavior used to rewrite the final two change objects in a scenario where the final change object was an addition or deletion and its `value` was treated as equal to the empty string when compared using the diff object's `.equals` method.) + +- [#500](https://github.com/kpdecker/jsdiff/pull/500) **`diffChars` now diffs Unicode code points** instead of UTF-16 code units. +- [#508](https://github.com/kpdecker/jsdiff/pull/508) **`parsePatch` now always runs in what was previously "strict" mode; the undocumented `strict` option has been removed.** Previously, by default, `parsePatch` (and other patch functions that use it under the hood to parse patches) would accept a patch where the line counts in the headers were inconsistent with the actual patch content - e.g. where a hunk started with the header `@@ -1,3 +1,6 @@`, indicating that the content below spanned 3 lines in the old file and 6 lines in the new file, but then the actual content below the header consisted of some different number of lines, say 10 lines of context, 5 deletions, and 1 insertion. Actually trying to work with these patches using `applyPatch` or `merge`, however, would produce incorrect results instead of just ignoring the incorrect headers, making this "feature" more of a trap than something actually useful. It's been ripped out, and now we are always "strict" and will reject patches where the line counts in the headers aren't consistent with the actual patch content. +- [#435](https://github.com/kpdecker/jsdiff/pull/435) **Fix `parsePatch` handling of control characters.** `parsePatch` used to interpret various unusual control characters - namely vertical tabs, form feeds, lone carriage returns without a line feed, and EBCDIC NELs - as line breaks when parsing a patch file. This was inconsistent with the behavior of both JsDiff's own `diffLines` method and also the Unix `diff` and `patch` utils, which all simply treat those control characters as ordinary characters. The result of this discrepancy was that some well-formed patches - produced either by `diff` or by JsDiff itself and handled properly by the `patch` util - would be wrongly parsed by `parsePatch`, with the effect that it would disregard the remainder of a hunk after encountering one of these control characters. +- [#439](https://github.com/kpdecker/jsdiff/pull/439) **Prefer diffs that order deletions before insertions.** When faced with a choice between two diffs with an equal total edit distance, the Myers diff algorithm generally prefers one that does deletions before insertions rather than insertions before deletions. For instance, when diffing `abcd` against `acbd`, it will prefer a diff that says to delete the `b` and then insert a new `b` after the `c`, over a diff that says to insert a `c` before the `b` and then delete the existing `c`. JsDiff deviated from the published Myers algorithm in a way that led to it having the opposite preference in many cases, including that example. This is now fixed, meaning diffs output by JsDiff will more accurately reflect what the published Myers diff algorithm would output. +- [#455](https://github.com/kpdecker/jsdiff/pull/455) **The `added` and `removed` properties of change objects are now guaranteed to be set to a boolean value.** (Previously, they would be set to `undefined` or omitted entirely instead of setting them to false.) +- [#464](https://github.com/kpdecker/jsdiff/pull/464) Specifying `{maxEditLength: 0}` now sets a max edit length of 0 instead of no maximum. +- [#460](https://github.com/kpdecker/jsdiff/pull/460) **Added `oneChangePerToken` option.** +- [#467](https://github.com/kpdecker/jsdiff/pull/467) **Consistent ordering of arguments to `comparator(left, right)`.** Values from the old array will now consistently be passed as the first argument (`left`) and values from the new array as the second argument (`right`). Previously this was almost (but not quite) always the other way round. +- [#480](https://github.com/kpdecker/jsdiff/pull/480) **Passing `maxEditLength` to `createPatch` & `createTwoFilesPatch` now works properly** (i.e. returns undefined if the max edit distance is exceeded; previous behavior was to crash with a `TypeError` if the edit distance was exceeded). +- [#486](https://github.com/kpdecker/jsdiff/pull/486) **The `ignoreWhitespace` option of `diffLines` behaves more sensibly now.** `value`s in returned change objects now include leading/trailing whitespace even when `ignoreWhitespace` is used, just like how with `ignoreCase` the `value`s still reflect the case of one of the original texts instead of being all-lowercase. `ignoreWhitespace` is also now compatible with `newlineIsToken`. Finally, **`diffTrimmedLines` is deprecated** (and removed from the docs) in favour of using `diffLines` with `ignoreWhitespace: true`; the two are, and always have been, equivalent. +- [#490](https://github.com/kpdecker/jsdiff/pull/490) **When calling diffing functions in async mode by passing a `callback` option, the diff result will now be passed as the *first* argument to the callback instead of the second.** (Previously, the first argument was never used at all and would always have value `undefined`.) +- [#489](github.com/kpdecker/jsdiff/pull/489) **`this.options` no longer exists on `Diff` objects.** Instead, `options` is now passed as an argument to methods that rely on options, like `equals(left, right, options)`. This fixes a race condition in async mode, where diffing behaviour could be changed mid-execution if a concurrent usage of the same `Diff` instances overwrote its `options`. +- [#518](https://github.com/kpdecker/jsdiff/pull/518) **`linedelimiters` no longer exists** on patch objects; instead, when a patch with Windows-style CRLF line endings is parsed, **the lines in `lines` will end with `\r`**. There is now a **new `autoConvertLineEndings` option, on by default**, which makes it so that when a patch with Windows-style line endings is applied to a source file with Unix style line endings, the patch gets autoconverted to use Unix-style line endings, and when a patch with Unix-style line endings is applied to a source file with Windows-style line endings, it gets autoconverted to use Windows-style line endings. +- [#521](https://github.com/kpdecker/jsdiff/pull/521) **the `callback` option is now supported by `structuredPatch`, `createPatch +- [#529](https://github.com/kpdecker/jsdiff/pull/529) **`parsePatch` can now parse patches where lines starting with `--` or `++` are deleted/inserted**; previously, there were edge cases where the parser would choke on valid patches or give wrong results. +- [#530](https://github.com/kpdecker/jsdiff/pull/530) **Added `ignoreNewlineAtEof` option` to `diffLines`** +- [#533](https://github.com/kpdecker/jsdiff/pull/533) **`applyPatch` uses an entirely new algorithm for fuzzy matching.** Differences between the old and new algorithm are as follows: + * The `fuzzFactor` now indicates the maximum [*Levenshtein* distance](https://en.wikipedia.org/wiki/Levenshtein_distance) that there can be between the context shown in a hunk and the actual file content at a location where we try to apply the hunk. (Previously, it represented a maximum [*Hamming* distance](https://en.wikipedia.org/wiki/Hamming_distance), meaning that a single insertion or deletion in the source file could stop a hunk from applying even with a high `fuzzFactor`.) + * A hunk containing a deletion can now only be applied in a context where the line to be deleted actually appears verbatim. (Previously, as long as enough context lines in the hunk matched, `applyPatch` would apply the hunk anyway and delete a completely different line.) + * The context line immediately before and immediately after an insertion must match exactly between the hunk and the file for a hunk to apply. (Previously this was not required.) +- [#535](https://github.com/kpdecker/jsdiff/pull/535) **A bug in patch generation functions is now fixed** that would sometimes previously cause `\ No newline at end of file` to appear in the wrong place in the generated patch, resulting in the patch being invalid. +- [#535](https://github.com/kpdecker/jsdiff/pull/535) **Passing `newlineIsToken: true` to *patch*-generation functions is no longer allowed.** (Passing it to `diffLines` is still supported - it's only functions like `createPatch` where passing `newlineIsToken` is now an error.) Allowing it to be passed never really made sense, since in cases where the option had any effect on the output at all, the effect tended to be causing a garbled patch to be created that couldn't actually be applied to the source file. +- [#539](https://github.com/kpdecker/jsdiff/pull/539) **`diffWords` now takes an optional `intlSegmenter` option** which should be an `Intl.Segmenter` with word-level granularity. This provides better tokenization of text into words than the default behaviour, even for English but especially for some other languages for which the default behaviour is poor. + +## v5.2.0 + +[Commits](https://github.com/kpdecker/jsdiff/compare/v5.1.0...v5.2.0) + +- [#411](https://github.com/kpdecker/jsdiff/pull/411) Big performance improvement. Previously an O(n) array-copying operation inside the innermost loop of jsdiff's base diffing code increased the overall worst-case time complexity of computing a diff from O(n²) to O(n³). This is now fixed, bringing the worst-case time complexity down to what it theoretically should be for a Myers diff implementation. +- [#448](https://github.com/kpdecker/jsdiff/pull/411) Performance improvement. Diagonals whose furthest-reaching D-path would go off the edge of the edit graph are now skipped, rather than being pointlessly considered as called for by the original Myers diff algorithm. This dramatically speeds up computing diffs where the new text just appends or truncates content at the end of the old text. +- [#351](https://github.com/kpdecker/jsdiff/issues/351) Importing from the lib folder - e.g. `require("diff/lib/diff/word.js")` - will work again now. This had been broken for users on the latest version of Node since Node 17.5.0, which changed how Node interprets the `exports` property in jsdiff's `package.json` file. +- [#344](https://github.com/kpdecker/jsdiff/issues/344) `diffLines`, `createTwoFilesPatch`, and other patch-creation methods now take an optional `stripTrailingCr: true` option which causes Windows-style `\r\n` line endings to be replaced with Unix-style `\n` line endings before calculating the diff, just like GNU `diff`'s `--strip-trailing-cr` flag. +- [#451](https://github.com/kpdecker/jsdiff/pull/451) Added `diff.formatPatch`. +- [#450](https://github.com/kpdecker/jsdiff/pull/450) Added `diff.reversePatch`. +- [#478](https://github.com/kpdecker/jsdiff/pull/478) Added `timeout` option. + +## v5.1.0 + +- [#365](https://github.com/kpdecker/jsdiff/issues/365) Allow early termination to limit execution time with degenerate cases + +[Commits](https://github.com/kpdecker/jsdiff/compare/v5.0.0...v5.1.0) + +## v5.0.0 + +- Breaking: UMD export renamed from `JsDiff` to `Diff`. +- Breaking: Newlines separated into separate tokens for word diff. +- Breaking: Unified diffs now match ["quirks"](https://www.artima.com/weblogs/viewpost.jsp?thread=164293) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v4.0.1...v5.0.0) + +## v4.0.1 - January 6th, 2019 + +- Fix main reference path - b826104 + +[Commits](https://github.com/kpdecker/jsdiff/compare/v4.0.0...v4.0.1) + +## v4.0.0 - January 5th, 2019 + +- [#94](https://github.com/kpdecker/jsdiff/issues/94) - Missing "No newline at end of file" when comparing two texts that do not end in newlines ([@federicotdn](https://api.github.com/users/federicotdn)) +- [#227](https://github.com/kpdecker/jsdiff/issues/227) - Licence +- [#199](https://github.com/kpdecker/jsdiff/issues/199) - Import statement for jsdiff +- [#159](https://github.com/kpdecker/jsdiff/issues/159) - applyPatch affecting wrong line number with with new lines +- [#8](https://github.com/kpdecker/jsdiff/issues/8) - A new state "replace" +- Drop ie9 from karma targets - 79c31bd +- Upgrade deps. Convert from webpack to rollup - 2c1a29c +- Make ()[]"' as word boundaries between each other - f27b899 +- jsdiff: Replaced phantomJS by chrome - ec3114e +- Add yarn.lock to .npmignore - 29466d8 + +Compatibility notes: + +- Bower and Component packages no longer supported + +[Commits](https://github.com/kpdecker/jsdiff/compare/v3.5.0...v4.0.0) + +## v3.5.0 - March 4th, 2018 + +- Omit redundant slice in join method of diffArrays - 1023590 +- Support patches with empty lines - fb0f208 +- Accept a custom JSON replacer function for JSON diffing - 69c7f0a +- Optimize parch header parser - 2aec429 +- Fix typos - e89c832 + +[Commits](https://github.com/kpdecker/jsdiff/compare/v3.4.0...v3.5.0) + +## v3.4.0 - October 7th, 2017 + +- [#183](https://github.com/kpdecker/jsdiff/issues/183) - Feature request: ability to specify a custom equality checker for `diffArrays` +- [#173](https://github.com/kpdecker/jsdiff/issues/173) - Bug: diffArrays gives wrong result on array of booleans +- [#158](https://github.com/kpdecker/jsdiff/issues/158) - diffArrays will not compare the empty string in array? +- comparator for custom equality checks - 30e141e +- count oldLines and newLines when there are conflicts - 53bf384 +- Fix: diffArrays can compare falsey items - 9e24284 +- Docs: Replace grunt with npm test - 00e2f94 + +[Commits](https://github.com/kpdecker/jsdiff/compare/v3.3.1...v3.4.0) + +## v3.3.1 - September 3rd, 2017 + +- [#141](https://github.com/kpdecker/jsdiff/issues/141) - Cannot apply patch because my file delimiter is "/r/n" instead of "/n" +- [#192](https://github.com/kpdecker/jsdiff/pull/192) - Fix: Bad merge when adding new files (#189) +- correct spelling mistake - 21fa478 + +[Commits](https://github.com/kpdecker/jsdiff/compare/v3.3.0...v3.3.1) + +## v3.3.0 - July 5th, 2017 + +- [#114](https://github.com/kpdecker/jsdiff/issues/114) - /patch/merge not exported +- Gracefully accept invalid newStart in hunks, same as patch(1) does. - d8a3635 +- Use regex rather than starts/ends with for parsePatch - 6cab62c +- Add browser flag - e64f674 +- refactor: simplified code a bit more - 8f8e0f2 +- refactor: simplified code a bit - b094a6f +- fix: some corrections re ignoreCase option - 3c78fd0 +- ignoreCase option - 3cbfbb5 +- Sanitize filename while parsing patches - 2fe8129 +- Added better installation methods - aced50b +- Simple export of functionality - 8690f31 + +[Commits](https://github.com/kpdecker/jsdiff/compare/v3.2.0...v3.3.0) + +## v3.2.0 - December 26th, 2016 + +- [#156](https://github.com/kpdecker/jsdiff/pull/156) - Add `undefinedReplacement` option to `diffJson` ([@ewnd9](https://api.github.com/users/ewnd9)) +- [#154](https://github.com/kpdecker/jsdiff/pull/154) - Add `examples` and `images` to `.npmignore`. ([@wtgtybhertgeghgtwtg](https://api.github.com/users/wtgtybhertgeghgtwtg)) +- [#153](https://github.com/kpdecker/jsdiff/pull/153) - feat(structuredPatch): Pass options to diffLines ([@Kiougar](https://api.github.com/users/Kiougar)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v3.1.0...v3.2.0) + +## v3.1.0 - November 27th, 2016 + +- [#146](https://github.com/kpdecker/jsdiff/pull/146) - JsDiff.diffArrays to compare arrays ([@wvanderdeijl](https://api.github.com/users/wvanderdeijl)) +- [#144](https://github.com/kpdecker/jsdiff/pull/144) - Split file using all possible line delimiter instead of hard-coded "/n" and join lines back using the original delimiters ([@soulbeing](https://api.github.com/users/soulbeing)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v3.0.1...v3.1.0) + +## v3.0.1 - October 9th, 2016 + +- [#139](https://github.com/kpdecker/jsdiff/pull/139) - Make README.md look nicer in npmjs.com ([@takenspc](https://api.github.com/users/takenspc)) +- [#135](https://github.com/kpdecker/jsdiff/issues/135) - parsePatch combines patches from multiple files into a single IUniDiff when there is no "Index" line ([@ramya-rao-a](https://api.github.com/users/ramya-rao-a)) +- [#124](https://github.com/kpdecker/jsdiff/issues/124) - IE7/IE8 failure since 2.0.0 ([@boneskull](https://api.github.com/users/boneskull)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v3.0.0...v3.0.1) + +## v3.0.0 - August 23rd, 2016 + +- [#130](https://github.com/kpdecker/jsdiff/pull/130) - Add callback argument to applyPatches `patched` option ([@piranna](https://api.github.com/users/piranna)) +- [#120](https://github.com/kpdecker/jsdiff/pull/120) - Correctly handle file names containing spaces ([@adius](https://api.github.com/users/adius)) +- [#119](https://github.com/kpdecker/jsdiff/pull/119) - Do single reflow ([@wifiextender](https://api.github.com/users/wifiextender)) +- [#117](https://github.com/kpdecker/jsdiff/pull/117) - Make more usable with long strings. ([@abnbgist](https://api.github.com/users/abnbgist)) + +Compatibility notes: + +- applyPatches patch callback now is async and requires the callback be called to continue operation + +[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.3...v3.0.0) + +## v2.2.3 - May 31st, 2016 + +- [#118](https://github.com/kpdecker/jsdiff/pull/118) - Add a fix for applying 0-length destination patches ([@chaaz](https://api.github.com/users/chaaz)) +- [#115](https://github.com/kpdecker/jsdiff/pull/115) - Fixed grammar in README ([@krizalys](https://api.github.com/users/krizalys)) +- [#113](https://github.com/kpdecker/jsdiff/pull/113) - fix typo ([@vmazare](https://api.github.com/users/vmazare)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.2...v2.2.3) + +## v2.2.2 - March 13th, 2016 + +- [#102](https://github.com/kpdecker/jsdiff/issues/102) - diffJson with dates, returns empty curly braces ([@dr-dimitru](https://api.github.com/users/dr-dimitru)) +- [#97](https://github.com/kpdecker/jsdiff/issues/97) - Whitespaces & diffWords ([@faiwer](https://api.github.com/users/faiwer)) +- [#92](https://github.com/kpdecker/jsdiff/pull/92) - Fixes typo in the readme ([@bg451](https://api.github.com/users/bg451)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.1...v2.2.2) + +## v2.2.1 - November 12th, 2015 + +- [#89](https://github.com/kpdecker/jsdiff/pull/89) - add in display selector to readme ([@FranDias](https://api.github.com/users/FranDias)) +- [#88](https://github.com/kpdecker/jsdiff/pull/88) - Split diffs based on file headers instead of 'Index:' metadata ([@piranna](https://api.github.com/users/piranna)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.0...v2.2.1) + +## v2.2.0 - October 29th, 2015 + +- [#80](https://github.com/kpdecker/jsdiff/pull/80) - Fix a typo: applyPath -> applyPatch ([@fluxxu](https://api.github.com/users/fluxxu)) +- [#83](https://github.com/kpdecker/jsdiff/pull/83) - Add basic fuzzy matching to applyPatch ([@piranna](https://github.com/piranna)) + [Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.0...v2.2.0) + +## v2.2.0 - October 29th, 2015 + +- [#80](https://github.com/kpdecker/jsdiff/pull/80) - Fix a typo: applyPath -> applyPatch ([@fluxxu](https://api.github.com/users/fluxxu)) +- [#83](https://github.com/kpdecker/jsdiff/pull/83) - Add basic fuzzy matching to applyPatch ([@piranna](https://github.com/piranna)) + [Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.3...v2.2.0) + +## v2.1.3 - September 30th, 2015 + +- [#78](https://github.com/kpdecker/jsdiff/pull/78) - fix: error throwing when apply patch to empty string ([@21paradox](https://api.github.com/users/21paradox)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.2...v2.1.3) + +## v2.1.2 - September 23rd, 2015 + +- [#76](https://github.com/kpdecker/jsdiff/issues/76) - diff headers give error ([@piranna](https://api.github.com/users/piranna)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.1...v2.1.2) + +## v2.1.1 - September 9th, 2015 + +- [#73](https://github.com/kpdecker/jsdiff/issues/73) - Is applyPatches() exposed in the API? ([@davidparsson](https://api.github.com/users/davidparsson)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.0...v2.1.1) + +## v2.1.0 - August 27th, 2015 + +- [#72](https://github.com/kpdecker/jsdiff/issues/72) - Consider using options object API for flag permutations ([@kpdecker](https://api.github.com/users/kpdecker)) +- [#70](https://github.com/kpdecker/jsdiff/issues/70) - diffWords treats \n at the end as significant whitespace ([@nesQuick](https://api.github.com/users/nesQuick)) +- [#69](https://github.com/kpdecker/jsdiff/issues/69) - Missing count ([@wfalkwallace](https://api.github.com/users/wfalkwallace)) +- [#68](https://github.com/kpdecker/jsdiff/issues/68) - diffLines seems broken ([@wfalkwallace](https://api.github.com/users/wfalkwallace)) +- [#60](https://github.com/kpdecker/jsdiff/issues/60) - Support multiple diff hunks ([@piranna](https://api.github.com/users/piranna)) +- [#54](https://github.com/kpdecker/jsdiff/issues/54) - Feature Request: 3-way merge ([@mog422](https://api.github.com/users/mog422)) +- [#42](https://github.com/kpdecker/jsdiff/issues/42) - Fuzz factor for applyPatch ([@stuartpb](https://api.github.com/users/stuartpb)) +- Move whitespace ignore out of equals method - 542063c +- Include source maps in babel output - 7f7ab21 +- Merge diff/line and diff/patch implementations - 1597705 +- Drop map utility method - 1ddc939 +- Documentation for parsePatch and applyPatches - 27c4b77 + +Compatibility notes: + +- The undocumented ignoreWhitespace flag has been removed from the Diff equality check directly. This implementation may be copied to diff utilities if dependencies existed on this functionality. + +[Commits](https://github.com/kpdecker/jsdiff/compare/v2.0.2...v2.1.0) + +## v2.0.2 - August 8th, 2015 + +- [#67](https://github.com/kpdecker/jsdiff/issues/67) - cannot require from npm module in node ([@commenthol](https://api.github.com/users/commenthol)) +- Convert to chai since we don’t support IE8 - a96bbad + +[Commits](https://github.com/kpdecker/jsdiff/compare/v2.0.1...v2.0.2) + +## v2.0.1 - August 7th, 2015 + +- Add release build at proper step - 57542fd + +[Commits](https://github.com/kpdecker/jsdiff/compare/v2.0.0...v2.0.1) + +## v2.0.0 - August 7th, 2015 + +- [#66](https://github.com/kpdecker/jsdiff/issues/66) - Add karma and sauce tests ([@kpdecker](https://api.github.com/users/kpdecker)) +- [#65](https://github.com/kpdecker/jsdiff/issues/65) - Create component repository for bower ([@kpdecker](https://api.github.com/users/kpdecker)) +- [#64](https://github.com/kpdecker/jsdiff/issues/64) - Automatically call removeEmpty for all tokenizer calls ([@kpdecker](https://api.github.com/users/kpdecker)) +- [#62](https://github.com/kpdecker/jsdiff/pull/62) - Allow access to structured object representation of patch data ([@bittrance](https://api.github.com/users/bittrance)) +- [#61](https://github.com/kpdecker/jsdiff/pull/61) - Use svg instead of png to get better image quality ([@PeterDaveHello](https://api.github.com/users/PeterDaveHello)) +- [#29](https://github.com/kpdecker/jsdiff/issues/29) - word tokenizer works only for 7 bit ascii ([@plasmagunman](https://api.github.com/users/plasmagunman)) + +Compatibility notes: + +- `this.removeEmpty` is now called automatically for all instances. If this is not desired, this may be overridden on a per instance basis. +- The library has been refactored to use some ES6 features. The external APIs should remain the same, but bower projects that directly referenced the repository will now have to point to the [components/jsdiff](https://github.com/components/jsdiff) repository. + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.4.0...v2.0.0) + +## v1.4.0 - May 6th, 2015 + +- [#57](https://github.com/kpdecker/jsdiff/issues/57) - createPatch -> applyPatch failed. ([@mog422](https://api.github.com/users/mog422)) +- [#56](https://github.com/kpdecker/jsdiff/pull/56) - Two files patch ([@rgeissert](https://api.github.com/users/rgeissert)) +- [#14](https://github.com/kpdecker/jsdiff/issues/14) - Flip added and removed order? ([@jakesandlund](https://api.github.com/users/jakesandlund)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.3.2...v1.4.0) + +## v1.3.2 - March 30th, 2015 + +- [#53](https://github.com/kpdecker/jsdiff/pull/53) - Updated README.MD with Bower installation instructions ([@ofbriggs](https://api.github.com/users/ofbriggs)) +- [#49](https://github.com/kpdecker/jsdiff/issues/49) - Cannot read property 'oldlines' of undefined ([@nwtn](https://api.github.com/users/nwtn)) +- [#44](https://github.com/kpdecker/jsdiff/issues/44) - invalid-meta jsdiff is missing "main" entry in bower.json + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.3.1...v1.3.2) + +## v1.3.1 - March 13th, 2015 + +- [#52](https://github.com/kpdecker/jsdiff/pull/52) - Fix for #51 Wrong result of JsDiff.diffLines ([@felicienfrancois](https://api.github.com/users/felicienfrancois)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.3.0...v1.3.1) + +## v1.3.0 - March 2nd, 2015 + +- [#47](https://github.com/kpdecker/jsdiff/pull/47) - Adding Diff Trimmed Lines ([@JamesGould123](https://api.github.com/users/JamesGould123)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.2.2...v1.3.0) + +## v1.2.2 - January 26th, 2015 + +- [#45](https://github.com/kpdecker/jsdiff/pull/45) - Fix AMD module loading ([@pedrocarrico](https://api.github.com/users/pedrocarrico)) +- [#43](https://github.com/kpdecker/jsdiff/pull/43) - added a bower file ([@nbrustein](https://api.github.com/users/nbrustein)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.2.1...v1.2.2) + +## v1.2.1 - December 26th, 2014 + +- [#41](https://github.com/kpdecker/jsdiff/pull/41) - change condition of using node export system. ([@ironhee](https://api.github.com/users/ironhee)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.2.0...v1.2.1) + +## v1.2.0 - November 29th, 2014 + +- [#37](https://github.com/kpdecker/jsdiff/pull/37) - Add support for sentences. ([@vmariano](https://api.github.com/users/vmariano)) +- [#28](https://github.com/kpdecker/jsdiff/pull/28) - Implemented diffJson ([@papandreou](https://api.github.com/users/papandreou)) +- [#27](https://github.com/kpdecker/jsdiff/issues/27) - Slow to execute over diffs with a large number of changes ([@termi](https://api.github.com/users/termi)) +- Allow for optional async diffing - 19385b9 +- Fix diffChars implementation - eaa44ed + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.1.0...v1.2.0) + +## v1.1.0 - November 25th, 2014 + +- [#33](https://github.com/kpdecker/jsdiff/pull/33) - AMD and global exports ([@ovcharik](https://api.github.com/users/ovcharik)) +- [#32](https://github.com/kpdecker/jsdiff/pull/32) - Add support for component ([@vmariano](https://api.github.com/users/vmariano)) +- [#31](https://github.com/kpdecker/jsdiff/pull/31) - Don't rely on Array.prototype.map ([@papandreou](https://api.github.com/users/papandreou)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.8...v1.1.0) + +## v1.0.8 - December 22nd, 2013 + +- [#24](https://github.com/kpdecker/jsdiff/pull/24) - Handle windows newlines on non windows machines. ([@benogle](https://api.github.com/users/benogle)) +- [#23](https://github.com/kpdecker/jsdiff/pull/23) - Prettied up the API formatting a little, and added basic node and web examples ([@airportyh](https://api.github.com/users/airportyh)) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.7...v1.0.8) + +## v1.0.7 - September 11th, 2013 + +- [#22](https://github.com/kpdecker/jsdiff/pull/22) - Added variant of WordDiff that doesn't ignore whitespace differences ([@papandreou](https://api.github.com/users/papandreou) + +- Add 0.10 to travis tests - 243a526 + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.6...v1.0.7) + +## v1.0.6 - August 30th, 2013 + +- [#19](https://github.com/kpdecker/jsdiff/pull/19) - Explicitly define contents of npm package ([@sindresorhus](https://api.github.com/users/sindresorhus) + +[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.5...v1.0.6) diff --git a/node_modules/npm/node_modules/diff/runtime.js b/node_modules/npm/node_modules/diff/runtime.js new file mode 100644 index 00000000..82ea7e69 --- /dev/null +++ b/node_modules/npm/node_modules/diff/runtime.js @@ -0,0 +1,3 @@ +require('@babel/register')({ + ignore: ['lib', 'node_modules'] +}); diff --git a/node_modules/npm/node_modules/eastasianwidth/eastasianwidth.js b/node_modules/npm/node_modules/eastasianwidth/eastasianwidth.js new file mode 100644 index 00000000..7d0aa0f6 --- /dev/null +++ b/node_modules/npm/node_modules/eastasianwidth/eastasianwidth.js @@ -0,0 +1,311 @@ +var eaw = {}; + +if ('undefined' == typeof module) { + window.eastasianwidth = eaw; +} else { + module.exports = eaw; +} + +eaw.eastAsianWidth = function(character) { + var x = character.charCodeAt(0); + var y = (character.length == 2) ? character.charCodeAt(1) : 0; + var codePoint = x; + if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) { + x &= 0x3FF; + y &= 0x3FF; + codePoint = (x << 10) | y; + codePoint += 0x10000; + } + + if ((0x3000 == codePoint) || + (0xFF01 <= codePoint && codePoint <= 0xFF60) || + (0xFFE0 <= codePoint && codePoint <= 0xFFE6)) { + return 'F'; + } + if ((0x20A9 == codePoint) || + (0xFF61 <= codePoint && codePoint <= 0xFFBE) || + (0xFFC2 <= codePoint && codePoint <= 0xFFC7) || + (0xFFCA <= codePoint && codePoint <= 0xFFCF) || + (0xFFD2 <= codePoint && codePoint <= 0xFFD7) || + (0xFFDA <= codePoint && codePoint <= 0xFFDC) || + (0xFFE8 <= codePoint && codePoint <= 0xFFEE)) { + return 'H'; + } + if ((0x1100 <= codePoint && codePoint <= 0x115F) || + (0x11A3 <= codePoint && codePoint <= 0x11A7) || + (0x11FA <= codePoint && codePoint <= 0x11FF) || + (0x2329 <= codePoint && codePoint <= 0x232A) || + (0x2E80 <= codePoint && codePoint <= 0x2E99) || + (0x2E9B <= codePoint && codePoint <= 0x2EF3) || + (0x2F00 <= codePoint && codePoint <= 0x2FD5) || + (0x2FF0 <= codePoint && codePoint <= 0x2FFB) || + (0x3001 <= codePoint && codePoint <= 0x303E) || + (0x3041 <= codePoint && codePoint <= 0x3096) || + (0x3099 <= codePoint && codePoint <= 0x30FF) || + (0x3105 <= codePoint && codePoint <= 0x312D) || + (0x3131 <= codePoint && codePoint <= 0x318E) || + (0x3190 <= codePoint && codePoint <= 0x31BA) || + (0x31C0 <= codePoint && codePoint <= 0x31E3) || + (0x31F0 <= codePoint && codePoint <= 0x321E) || + (0x3220 <= codePoint && codePoint <= 0x3247) || + (0x3250 <= codePoint && codePoint <= 0x32FE) || + (0x3300 <= codePoint && codePoint <= 0x4DBF) || + (0x4E00 <= codePoint && codePoint <= 0xA48C) || + (0xA490 <= codePoint && codePoint <= 0xA4C6) || + (0xA960 <= codePoint && codePoint <= 0xA97C) || + (0xAC00 <= codePoint && codePoint <= 0xD7A3) || + (0xD7B0 <= codePoint && codePoint <= 0xD7C6) || + (0xD7CB <= codePoint && codePoint <= 0xD7FB) || + (0xF900 <= codePoint && codePoint <= 0xFAFF) || + (0xFE10 <= codePoint && codePoint <= 0xFE19) || + (0xFE30 <= codePoint && codePoint <= 0xFE52) || + (0xFE54 <= codePoint && codePoint <= 0xFE66) || + (0xFE68 <= codePoint && codePoint <= 0xFE6B) || + (0x1B000 <= codePoint && codePoint <= 0x1B001) || + (0x1F200 <= codePoint && codePoint <= 0x1F202) || + (0x1F210 <= codePoint && codePoint <= 0x1F23A) || + (0x1F240 <= codePoint && codePoint <= 0x1F248) || + (0x1F250 <= codePoint && codePoint <= 0x1F251) || + (0x20000 <= codePoint && codePoint <= 0x2F73F) || + (0x2B740 <= codePoint && codePoint <= 0x2FFFD) || + (0x30000 <= codePoint && codePoint <= 0x3FFFD)) { + return 'W'; + } + if ((0x0020 <= codePoint && codePoint <= 0x007E) || + (0x00A2 <= codePoint && codePoint <= 0x00A3) || + (0x00A5 <= codePoint && codePoint <= 0x00A6) || + (0x00AC == codePoint) || + (0x00AF == codePoint) || + (0x27E6 <= codePoint && codePoint <= 0x27ED) || + (0x2985 <= codePoint && codePoint <= 0x2986)) { + return 'Na'; + } + if ((0x00A1 == codePoint) || + (0x00A4 == codePoint) || + (0x00A7 <= codePoint && codePoint <= 0x00A8) || + (0x00AA == codePoint) || + (0x00AD <= codePoint && codePoint <= 0x00AE) || + (0x00B0 <= codePoint && codePoint <= 0x00B4) || + (0x00B6 <= codePoint && codePoint <= 0x00BA) || + (0x00BC <= codePoint && codePoint <= 0x00BF) || + (0x00C6 == codePoint) || + (0x00D0 == codePoint) || + (0x00D7 <= codePoint && codePoint <= 0x00D8) || + (0x00DE <= codePoint && codePoint <= 0x00E1) || + (0x00E6 == codePoint) || + (0x00E8 <= codePoint && codePoint <= 0x00EA) || + (0x00EC <= codePoint && codePoint <= 0x00ED) || + (0x00F0 == codePoint) || + (0x00F2 <= codePoint && codePoint <= 0x00F3) || + (0x00F7 <= codePoint && codePoint <= 0x00FA) || + (0x00FC == codePoint) || + (0x00FE == codePoint) || + (0x0101 == codePoint) || + (0x0111 == codePoint) || + (0x0113 == codePoint) || + (0x011B == codePoint) || + (0x0126 <= codePoint && codePoint <= 0x0127) || + (0x012B == codePoint) || + (0x0131 <= codePoint && codePoint <= 0x0133) || + (0x0138 == codePoint) || + (0x013F <= codePoint && codePoint <= 0x0142) || + (0x0144 == codePoint) || + (0x0148 <= codePoint && codePoint <= 0x014B) || + (0x014D == codePoint) || + (0x0152 <= codePoint && codePoint <= 0x0153) || + (0x0166 <= codePoint && codePoint <= 0x0167) || + (0x016B == codePoint) || + (0x01CE == codePoint) || + (0x01D0 == codePoint) || + (0x01D2 == codePoint) || + (0x01D4 == codePoint) || + (0x01D6 == codePoint) || + (0x01D8 == codePoint) || + (0x01DA == codePoint) || + (0x01DC == codePoint) || + (0x0251 == codePoint) || + (0x0261 == codePoint) || + (0x02C4 == codePoint) || + (0x02C7 == codePoint) || + (0x02C9 <= codePoint && codePoint <= 0x02CB) || + (0x02CD == codePoint) || + (0x02D0 == codePoint) || + (0x02D8 <= codePoint && codePoint <= 0x02DB) || + (0x02DD == codePoint) || + (0x02DF == codePoint) || + (0x0300 <= codePoint && codePoint <= 0x036F) || + (0x0391 <= codePoint && codePoint <= 0x03A1) || + (0x03A3 <= codePoint && codePoint <= 0x03A9) || + (0x03B1 <= codePoint && codePoint <= 0x03C1) || + (0x03C3 <= codePoint && codePoint <= 0x03C9) || + (0x0401 == codePoint) || + (0x0410 <= codePoint && codePoint <= 0x044F) || + (0x0451 == codePoint) || + (0x2010 == codePoint) || + (0x2013 <= codePoint && codePoint <= 0x2016) || + (0x2018 <= codePoint && codePoint <= 0x2019) || + (0x201C <= codePoint && codePoint <= 0x201D) || + (0x2020 <= codePoint && codePoint <= 0x2022) || + (0x2024 <= codePoint && codePoint <= 0x2027) || + (0x2030 == codePoint) || + (0x2032 <= codePoint && codePoint <= 0x2033) || + (0x2035 == codePoint) || + (0x203B == codePoint) || + (0x203E == codePoint) || + (0x2074 == codePoint) || + (0x207F == codePoint) || + (0x2081 <= codePoint && codePoint <= 0x2084) || + (0x20AC == codePoint) || + (0x2103 == codePoint) || + (0x2105 == codePoint) || + (0x2109 == codePoint) || + (0x2113 == codePoint) || + (0x2116 == codePoint) || + (0x2121 <= codePoint && codePoint <= 0x2122) || + (0x2126 == codePoint) || + (0x212B == codePoint) || + (0x2153 <= codePoint && codePoint <= 0x2154) || + (0x215B <= codePoint && codePoint <= 0x215E) || + (0x2160 <= codePoint && codePoint <= 0x216B) || + (0x2170 <= codePoint && codePoint <= 0x2179) || + (0x2189 == codePoint) || + (0x2190 <= codePoint && codePoint <= 0x2199) || + (0x21B8 <= codePoint && codePoint <= 0x21B9) || + (0x21D2 == codePoint) || + (0x21D4 == codePoint) || + (0x21E7 == codePoint) || + (0x2200 == codePoint) || + (0x2202 <= codePoint && codePoint <= 0x2203) || + (0x2207 <= codePoint && codePoint <= 0x2208) || + (0x220B == codePoint) || + (0x220F == codePoint) || + (0x2211 == codePoint) || + (0x2215 == codePoint) || + (0x221A == codePoint) || + (0x221D <= codePoint && codePoint <= 0x2220) || + (0x2223 == codePoint) || + (0x2225 == codePoint) || + (0x2227 <= codePoint && codePoint <= 0x222C) || + (0x222E == codePoint) || + (0x2234 <= codePoint && codePoint <= 0x2237) || + (0x223C <= codePoint && codePoint <= 0x223D) || + (0x2248 == codePoint) || + (0x224C == codePoint) || + (0x2252 == codePoint) || + (0x2260 <= codePoint && codePoint <= 0x2261) || + (0x2264 <= codePoint && codePoint <= 0x2267) || + (0x226A <= codePoint && codePoint <= 0x226B) || + (0x226E <= codePoint && codePoint <= 0x226F) || + (0x2282 <= codePoint && codePoint <= 0x2283) || + (0x2286 <= codePoint && codePoint <= 0x2287) || + (0x2295 == codePoint) || + (0x2299 == codePoint) || + (0x22A5 == codePoint) || + (0x22BF == codePoint) || + (0x2312 == codePoint) || + (0x2460 <= codePoint && codePoint <= 0x24E9) || + (0x24EB <= codePoint && codePoint <= 0x254B) || + (0x2550 <= codePoint && codePoint <= 0x2573) || + (0x2580 <= codePoint && codePoint <= 0x258F) || + (0x2592 <= codePoint && codePoint <= 0x2595) || + (0x25A0 <= codePoint && codePoint <= 0x25A1) || + (0x25A3 <= codePoint && codePoint <= 0x25A9) || + (0x25B2 <= codePoint && codePoint <= 0x25B3) || + (0x25B6 <= codePoint && codePoint <= 0x25B7) || + (0x25BC <= codePoint && codePoint <= 0x25BD) || + (0x25C0 <= codePoint && codePoint <= 0x25C1) || + (0x25C6 <= codePoint && codePoint <= 0x25C8) || + (0x25CB == codePoint) || + (0x25CE <= codePoint && codePoint <= 0x25D1) || + (0x25E2 <= codePoint && codePoint <= 0x25E5) || + (0x25EF == codePoint) || + (0x2605 <= codePoint && codePoint <= 0x2606) || + (0x2609 == codePoint) || + (0x260E <= codePoint && codePoint <= 0x260F) || + (0x2614 <= codePoint && codePoint <= 0x2615) || + (0x261C == codePoint) || + (0x261E == codePoint) || + (0x2640 == codePoint) || + (0x2642 == codePoint) || + (0x2660 <= codePoint && codePoint <= 0x2661) || + (0x2663 <= codePoint && codePoint <= 0x2665) || + (0x2667 <= codePoint && codePoint <= 0x266A) || + (0x266C <= codePoint && codePoint <= 0x266D) || + (0x266F == codePoint) || + (0x269E <= codePoint && codePoint <= 0x269F) || + (0x26BE <= codePoint && codePoint <= 0x26BF) || + (0x26C4 <= codePoint && codePoint <= 0x26CD) || + (0x26CF <= codePoint && codePoint <= 0x26E1) || + (0x26E3 == codePoint) || + (0x26E8 <= codePoint && codePoint <= 0x26FF) || + (0x273D == codePoint) || + (0x2757 == codePoint) || + (0x2776 <= codePoint && codePoint <= 0x277F) || + (0x2B55 <= codePoint && codePoint <= 0x2B59) || + (0x3248 <= codePoint && codePoint <= 0x324F) || + (0xE000 <= codePoint && codePoint <= 0xF8FF) || + (0xFE00 <= codePoint && codePoint <= 0xFE0F) || + (0xFFFD == codePoint) || + (0x1F100 <= codePoint && codePoint <= 0x1F10A) || + (0x1F110 <= codePoint && codePoint <= 0x1F12D) || + (0x1F130 <= codePoint && codePoint <= 0x1F169) || + (0x1F170 <= codePoint && codePoint <= 0x1F19A) || + (0xE0100 <= codePoint && codePoint <= 0xE01EF) || + (0xF0000 <= codePoint && codePoint <= 0xFFFFD) || + (0x100000 <= codePoint && codePoint <= 0x10FFFD)) { + return 'A'; + } + + return 'N'; +}; + +eaw.characterLength = function(character) { + var code = this.eastAsianWidth(character); + if (code == 'F' || code == 'W' || code == 'A') { + return 2; + } else { + return 1; + } +}; + +// Split a string considering surrogate-pairs. +function stringToArray(string) { + return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || []; +} + +eaw.length = function(string) { + var characters = stringToArray(string); + var len = 0; + for (var i = 0; i < characters.length; i++) { + len = len + this.characterLength(characters[i]); + } + return len; +}; + +eaw.slice = function(text, start, end) { + textLen = eaw.length(text) + start = start ? start : 0; + end = end ? end : 1; + if (start < 0) { + start = textLen + start; + } + if (end < 0) { + end = textLen + end; + } + var result = ''; + var eawLen = 0; + var chars = stringToArray(text); + for (var i = 0; i < chars.length; i++) { + var char = chars[i]; + var charLen = eaw.length(char); + if (eawLen >= start - (charLen == 2 ? 1 : 0)) { + if (eawLen + charLen <= end) { + result += char; + } else { + break; + } + } + eawLen += charLen; + } + return result; +}; diff --git a/node_modules/npm/node_modules/eastasianwidth/package.json b/node_modules/npm/node_modules/eastasianwidth/package.json new file mode 100644 index 00000000..cb7ac6ab --- /dev/null +++ b/node_modules/npm/node_modules/eastasianwidth/package.json @@ -0,0 +1,18 @@ +{ + "name": "eastasianwidth", + "version": "0.2.0", + "description": "Get East Asian Width from a character.", + "main": "eastasianwidth.js", + "files": [ + "eastasianwidth.js" + ], + "scripts": { + "test": "mocha" + }, + "repository": "git://github.com/komagata/eastasianwidth.git", + "author": "Masaki Komagata", + "license": "MIT", + "devDependencies": { + "mocha": "~1.9.0" + } +} diff --git a/node_modules/npm/node_modules/emoji-regex/LICENSE-MIT.txt b/node_modules/npm/node_modules/emoji-regex/LICENSE-MIT.txt new file mode 100644 index 00000000..a41e0a7e --- /dev/null +++ b/node_modules/npm/node_modules/emoji-regex/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +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/npm/node_modules/emoji-regex/es2015/index.js b/node_modules/npm/node_modules/emoji-regex/es2015/index.js new file mode 100644 index 00000000..b4cf3dcd --- /dev/null +++ b/node_modules/npm/node_modules/emoji-regex/es2015/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F}|\u{1F468}(?:\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}\u{1F3FB}|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|[\u{1F3FB}-\u{1F3FF}])|(?:\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F469})\u{1F3FB}|\u{1F9D1}(?:\u{1F3FF}\u200D\u{1F91D}\u200D\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u200D\u{1F91D}\u200D\u{1F9D1})|(?:\u{1F9D1}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}\u{1F3FC}]|\u{1F469}(?:\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FB}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|(?:\u{1F9D1}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}-\u{1F3FD}]|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}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EC}\u{1F1F2}\u{1F1F3}\u{1F1F8}\u{1F1FE}\u{1F1FF}]|\u{1F1EE}[\u{1F1E8}-\u{1F1EA}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}]|\u{1F1EF}[\u{1F1EA}\u{1F1F2}\u{1F1F4}\u{1F1F5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]\uFE0F|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; +}; diff --git a/node_modules/npm/node_modules/emoji-regex/es2015/text.js b/node_modules/npm/node_modules/emoji-regex/es2015/text.js new file mode 100644 index 00000000..780309df --- /dev/null +++ b/node_modules/npm/node_modules/emoji-regex/es2015/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F}|\u{1F468}(?:\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}\u{1F3FB}|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|[\u{1F3FB}-\u{1F3FF}])|(?:\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F469})\u{1F3FB}|\u{1F9D1}(?:\u{1F3FF}\u200D\u{1F91D}\u200D\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u200D\u{1F91D}\u200D\u{1F9D1})|(?:\u{1F9D1}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}\u{1F3FC}]|\u{1F469}(?:\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FB}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|(?:\u{1F9D1}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}-\u{1F3FD}]|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}](?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\u{1F3F4}\u200D\u2620)\uFE0F|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F415}\u200D\u{1F9BA}|\u{1F469}\u200D\u{1F466}|\u{1F469}\u200D\u{1F467}|\u{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F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270A-\u270D\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]\uFE0F?|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; +}; diff --git a/node_modules/npm/node_modules/emoji-regex/index.js b/node_modules/npm/node_modules/emoji-regex/index.js new file mode 100644 index 00000000..d993a3a9 --- /dev/null +++ b/node_modules/npm/node_modules/emoji-regex/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD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(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; +}; diff --git a/node_modules/npm/node_modules/emoji-regex/package.json b/node_modules/npm/node_modules/emoji-regex/package.json new file mode 100644 index 00000000..6d323528 --- /dev/null +++ b/node_modules/npm/node_modules/emoji-regex/package.json @@ -0,0 +1,50 @@ +{ + "name": "emoji-regex", + "version": "8.0.0", + "description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.", + "homepage": "https://mths.be/emoji-regex", + "main": "index.js", + "types": "index.d.ts", + "keywords": [ + "unicode", + "regex", + "regexp", + "regular expressions", + "code points", + "symbols", + "characters", + "emoji" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "repository": { + "type": "git", + "url": "https://github.com/mathiasbynens/emoji-regex.git" + }, + "bugs": "https://github.com/mathiasbynens/emoji-regex/issues", + "files": [ + "LICENSE-MIT.txt", + "index.js", + "index.d.ts", + "text.js", + "es2015/index.js", + "es2015/text.js" + ], + "scripts": { + "build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src -d ./es2015; node script/inject-sequences.js", + "test": "mocha", + "test:watch": "npm run test -- --watch" + }, + "devDependencies": { + "@babel/cli": "^7.2.3", + "@babel/core": "^7.3.4", + "@babel/plugin-proposal-unicode-property-regex": "^7.2.0", + "@babel/preset-env": "^7.3.4", + "mocha": "^6.0.2", + "regexgen": "^1.3.0", + "unicode-12.0.0": "^0.7.9" + } +} diff --git a/node_modules/npm/node_modules/emoji-regex/text.js b/node_modules/npm/node_modules/emoji-regex/text.js new file mode 100644 index 00000000..0a55ce2f --- /dev/null +++ b/node_modules/npm/node_modules/emoji-regex/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDD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DFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uD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_modules/encoding/LICENSE b/node_modules/npm/node_modules/encoding/LICENSE new file mode 100644 index 00000000..33f5a9a3 --- /dev/null +++ b/node_modules/npm/node_modules/encoding/LICENSE @@ -0,0 +1,16 @@ +Copyright (c) 2012-2014 Andris Reinman + +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 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/npm/node_modules/encoding/lib/encoding.js b/node_modules/npm/node_modules/encoding/lib/encoding.js new file mode 100644 index 00000000..865c24bc --- /dev/null +++ b/node_modules/npm/node_modules/encoding/lib/encoding.js @@ -0,0 +1,83 @@ +'use strict'; + +var iconvLite = require('iconv-lite'); + +// Expose to the world +module.exports.convert = convert; + +/** + * Convert encoding of an UTF-8 string or a buffer + * + * @param {String|Buffer} str String to be converted + * @param {String} to Encoding to be converted to + * @param {String} [from='UTF-8'] Encoding to be converted from + * @return {Buffer} Encoded string + */ +function convert(str, to, from) { + from = checkEncoding(from || 'UTF-8'); + to = checkEncoding(to || 'UTF-8'); + str = str || ''; + + var result; + + if (from !== 'UTF-8' && typeof str === 'string') { + str = Buffer.from(str, 'binary'); + } + + if (from === to) { + if (typeof str === 'string') { + result = Buffer.from(str); + } else { + result = str; + } + } else { + try { + result = convertIconvLite(str, to, from); + } catch (E) { + console.error(E); + result = str; + } + } + + if (typeof result === 'string') { + result = Buffer.from(result, 'utf-8'); + } + + return result; +} + +/** + * Convert encoding of astring with iconv-lite + * + * @param {String|Buffer} str String to be converted + * @param {String} to Encoding to be converted to + * @param {String} [from='UTF-8'] Encoding to be converted from + * @return {Buffer} Encoded string + */ +function convertIconvLite(str, to, from) { + if (to === 'UTF-8') { + return iconvLite.decode(str, from); + } else if (from === 'UTF-8') { + return iconvLite.encode(str, to); + } else { + return iconvLite.encode(iconvLite.decode(str, from), to); + } +} + +/** + * Converts charset name if needed + * + * @param {String} name Character set + * @return {String} Character set name + */ +function checkEncoding(name) { + return (name || '') + .toString() + .trim() + .replace(/^latin[\-_]?(\d+)$/i, 'ISO-8859-$1') + .replace(/^win(?:dows)?[\-_]?(\d+)$/i, 'WINDOWS-$1') + .replace(/^utf[\-_]?(\d+)$/i, 'UTF-$1') + .replace(/^ks_c_5601\-1987$/i, 'CP949') + .replace(/^us[\-_]?ascii$/i, 'ASCII') + .toUpperCase(); +} diff --git a/node_modules/npm/node_modules/encoding/package.json b/node_modules/npm/node_modules/encoding/package.json new file mode 100644 index 00000000..773a9438 --- /dev/null +++ b/node_modules/npm/node_modules/encoding/package.json @@ -0,0 +1,18 @@ +{ + "name": "encoding", + "version": "0.1.13", + "description": "Convert encodings, uses iconv-lite", + "main": "lib/encoding.js", + "scripts": { + "test": "nodeunit test" + }, + "repository": "https://github.com/andris9/encoding.git", + "author": "Andris Reinman", + "license": "MIT", + "dependencies": { + "iconv-lite": "^0.6.2" + }, + "devDependencies": { + "nodeunit": "0.11.3" + } +} diff --git a/node_modules/npm/node_modules/encoding/test/test.js b/node_modules/npm/node_modules/encoding/test/test.js new file mode 100644 index 00000000..3a7dfee9 --- /dev/null +++ b/node_modules/npm/node_modules/encoding/test/test.js @@ -0,0 +1,49 @@ +'use strict'; + +var encoding = require('../lib/encoding'); + +exports['General tests'] = { + 'From UTF-8 to Latin_1': function (test) { + var input = 'ÕÄÖÜ', + expected = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc]); + test.deepEqual(encoding.convert(input, 'latin1'), expected); + test.done(); + }, + + 'From Latin_1 to UTF-8': function (test) { + var input = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc]), + expected = 'ÕÄÖÜ'; + test.deepEqual(encoding.convert(input, 'utf-8', 'latin1').toString(), expected); + test.done(); + }, + + 'From UTF-8 to UTF-8': function (test) { + var input = 'ÕÄÖÜ', + expected = Buffer.from('ÕÄÖÜ'); + test.deepEqual(encoding.convert(input, 'utf-8', 'utf-8'), expected); + test.done(); + }, + + 'From Latin_13 to Latin_15': function (test) { + var input = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc, 0xd0]), + expected = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc, 0xa6]); + test.deepEqual(encoding.convert(input, 'latin_15', 'latin13'), expected); + test.done(); + } + + /* + // ISO-2022-JP is not supported by iconv-lite + "From ISO-2022-JP to UTF-8 with Iconv": function (test) { + var input = Buffer.from( + "GyRCM1g5OzU7PVEwdzgmPSQ4IUYkMnFKczlwGyhC", + "base64" + ), + expected = Buffer.from( + "5a2m5qCh5oqA6KGT5ZOh56CU5L+u5qSc6KiO5Lya5aCx5ZGK", + "base64" + ); + test.deepEqual(encoding.convert(input, "utf-8", "ISO-2022-JP"), expected); + test.done(); + }, + */ +}; diff --git a/node_modules/npm/node_modules/env-paths/index.js b/node_modules/npm/node_modules/env-paths/index.js new file mode 100644 index 00000000..7e7b50ba --- /dev/null +++ b/node_modules/npm/node_modules/env-paths/index.js @@ -0,0 +1,74 @@ +'use strict'; +const path = require('path'); +const os = require('os'); + +const homedir = os.homedir(); +const tmpdir = os.tmpdir(); +const {env} = process; + +const macos = name => { + const library = path.join(homedir, 'Library'); + + return { + data: path.join(library, 'Application Support', name), + config: path.join(library, 'Preferences', name), + cache: path.join(library, 'Caches', name), + log: path.join(library, 'Logs', name), + temp: path.join(tmpdir, name) + }; +}; + +const windows = name => { + const appData = env.APPDATA || path.join(homedir, 'AppData', 'Roaming'); + const localAppData = env.LOCALAPPDATA || path.join(homedir, 'AppData', 'Local'); + + return { + // Data/config/cache/log are invented by me as Windows isn't opinionated about this + data: path.join(localAppData, name, 'Data'), + config: path.join(appData, name, 'Config'), + cache: path.join(localAppData, name, 'Cache'), + log: path.join(localAppData, name, 'Log'), + temp: path.join(tmpdir, name) + }; +}; + +// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +const linux = name => { + const username = path.basename(homedir); + + return { + data: path.join(env.XDG_DATA_HOME || path.join(homedir, '.local', 'share'), name), + config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, '.config'), name), + cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, '.cache'), name), + // https://wiki.debian.org/XDGBaseDirectorySpecification#state + log: path.join(env.XDG_STATE_HOME || path.join(homedir, '.local', 'state'), name), + temp: path.join(tmpdir, username, name) + }; +}; + +const envPaths = (name, options) => { + if (typeof name !== 'string') { + throw new TypeError(`Expected string, got ${typeof name}`); + } + + options = Object.assign({suffix: 'nodejs'}, options); + + if (options.suffix) { + // Add suffix to prevent possible conflict with native apps + name += `-${options.suffix}`; + } + + if (process.platform === 'darwin') { + return macos(name); + } + + if (process.platform === 'win32') { + return windows(name); + } + + return linux(name); +}; + +module.exports = envPaths; +// TODO: Remove this for the next major release +module.exports.default = envPaths; diff --git a/node_modules/npm/node_modules/env-paths/license b/node_modules/npm/node_modules/env-paths/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/npm/node_modules/env-paths/license @@ -0,0 +1,9 @@ +MIT License + +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/npm/node_modules/env-paths/package.json b/node_modules/npm/node_modules/env-paths/package.json new file mode 100644 index 00000000..fae4ebcf --- /dev/null +++ b/node_modules/npm/node_modules/env-paths/package.json @@ -0,0 +1,45 @@ +{ + "name": "env-paths", + "version": "2.2.1", + "description": "Get paths for storing things like data, config, cache, etc", + "license": "MIT", + "repository": "sindresorhus/env-paths", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=6" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "common", + "user", + "paths", + "env", + "environment", + "directory", + "dir", + "appdir", + "path", + "data", + "config", + "cache", + "logs", + "temp", + "linux", + "unix" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" + } +} diff --git a/node_modules/npm/node_modules/err-code/bower.json b/node_modules/npm/node_modules/err-code/bower.json new file mode 100644 index 00000000..a39cb702 --- /dev/null +++ b/node_modules/npm/node_modules/err-code/bower.json @@ -0,0 +1,30 @@ +{ + "name": "err-code", + "version": "1.1.1", + "description": "Create new error instances with a code and additional properties", + "main": "index.umd.js", + "homepage": "https://github.com/IndigoUnited/js-err-code", + "authors": [ + "IndigoUnited (http://indigounited.com)" + ], + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "error", + "err", + "code", + "properties", + "property" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/node_modules/npm/node_modules/err-code/index.js b/node_modules/npm/node_modules/err-code/index.js new file mode 100644 index 00000000..9ff3e9c5 --- /dev/null +++ b/node_modules/npm/node_modules/err-code/index.js @@ -0,0 +1,47 @@ +'use strict'; + +function assign(obj, props) { + for (const key in props) { + Object.defineProperty(obj, key, { + value: props[key], + enumerable: true, + configurable: true, + }); + } + + return obj; +} + +function createError(err, code, props) { + if (!err || typeof err === 'string') { + throw new TypeError('Please pass an Error to err-code'); + } + + if (!props) { + props = {}; + } + + if (typeof code === 'object') { + props = code; + code = undefined; + } + + if (code != null) { + props.code = code; + } + + try { + return assign(err, props); + } catch (_) { + props.message = err.message; + props.stack = err.stack; + + const ErrClass = function () {}; + + ErrClass.prototype = Object.create(Object.getPrototypeOf(err)); + + return assign(new ErrClass(), props); + } +} + +module.exports = createError; diff --git a/node_modules/npm/node_modules/err-code/index.umd.js b/node_modules/npm/node_modules/err-code/index.umd.js new file mode 100644 index 00000000..41007269 --- /dev/null +++ b/node_modules/npm/node_modules/err-code/index.umd.js @@ -0,0 +1,51 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.errCode = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i index.umd.js" + }, + "bugs": { + "url": "https://github.com/IndigoUnited/js-err-code/issues/" + }, + "repository": { + "type": "git", + "url": "git://github.com/IndigoUnited/js-err-code.git" + }, + "keywords": [ + "error", + "err", + "code", + "properties", + "property" + ], + "author": "IndigoUnited (http://indigounited.com)", + "license": "MIT", + "devDependencies": { + "@satazor/eslint-config": "^3.0.0", + "browserify": "^16.5.1", + "eslint": "^7.2.0", + "expect.js": "^0.3.1", + "mocha": "^8.0.1" + } +} diff --git a/node_modules/npm/node_modules/err-code/test/test.js b/node_modules/npm/node_modules/err-code/test/test.js new file mode 100644 index 00000000..22ba0a8a --- /dev/null +++ b/node_modules/npm/node_modules/err-code/test/test.js @@ -0,0 +1,159 @@ +'use strict'; + +const errcode = require('../index'); +const expect = require('expect.js'); + +describe('errcode', () => { + describe('string as first argument', () => { + it('should throw an error', () => { + expect(() => { errcode('my message'); }).to.throwError((err) => { + expect(err).to.be.a(TypeError); + }); + }); + }); + + describe('error as first argument', () => { + it('should accept an error and do nothing', () => { + const myErr = new Error('my message'); + const err = errcode(myErr); + + expect(err).to.be(myErr); + expect(err.hasOwnProperty(err.code)).to.be(false); + }); + + it('should accept an error and add a code', () => { + const myErr = new Error('my message'); + const err = errcode(myErr, 'ESOME'); + + expect(err).to.be(myErr); + expect(err.code).to.be('ESOME'); + }); + + it('should accept an error object and add code & properties', () => { + const myErr = new Error('my message'); + const err = errcode(myErr, 'ESOME', { foo: 'bar', bar: 'foo' }); + + expect(err).to.be.an(Error); + expect(err.code).to.be('ESOME'); + expect(err.foo).to.be('bar'); + expect(err.bar).to.be('foo'); + }); + + it('should create an error object without code but with properties', () => { + const myErr = new Error('my message'); + const err = errcode(myErr, { foo: 'bar', bar: 'foo' }); + + expect(err).to.be.an(Error); + expect(err.code).to.be(undefined); + expect(err.foo).to.be('bar'); + expect(err.bar).to.be('foo'); + }); + + it('should set a non-writable field', () => { + const myErr = new Error('my message'); + + Object.defineProperty(myErr, 'code', { + value: 'derp', + writable: false, + }); + const err = errcode(myErr, 'ERR_WAT'); + + expect(err).to.be.an(Error); + expect(err.stack).to.equal(myErr.stack); + expect(err.code).to.be('ERR_WAT'); + }); + + it('should add a code to frozen object', () => { + const myErr = new Error('my message'); + const err = errcode(Object.freeze(myErr), 'ERR_WAT'); + + expect(err).to.be.an(Error); + expect(err.stack).to.equal(myErr.stack); + expect(err.code).to.be('ERR_WAT'); + }); + + it('should to set a field that throws at assignment time', () => { + const myErr = new Error('my message'); + + Object.defineProperty(myErr, 'code', { + enumerable: true, + set() { + throw new Error('Nope!'); + }, + get() { + return 'derp'; + }, + }); + const err = errcode(myErr, 'ERR_WAT'); + + expect(err).to.be.an(Error); + expect(err.stack).to.equal(myErr.stack); + expect(err.code).to.be('ERR_WAT'); + }); + + it('should retain error type', () => { + const myErr = new TypeError('my message'); + + Object.defineProperty(myErr, 'code', { + value: 'derp', + writable: false, + }); + const err = errcode(myErr, 'ERR_WAT'); + + expect(err).to.be.a(TypeError); + expect(err.stack).to.equal(myErr.stack); + expect(err.code).to.be('ERR_WAT'); + }); + + it('should add a code to a class that extends Error', () => { + class CustomError extends Error { + set code(val) { + throw new Error('Nope!'); + } + } + + const myErr = new CustomError('my message'); + + Object.defineProperty(myErr, 'code', { + value: 'derp', + writable: false, + configurable: false, + }); + const err = errcode(myErr, 'ERR_WAT'); + + expect(err).to.be.a(CustomError); + expect(err.stack).to.equal(myErr.stack); + expect(err.code).to.be('ERR_WAT'); + + // original prototype chain should be intact + expect(() => { + const otherErr = new CustomError('my message'); + + otherErr.code = 'derp'; + }).to.throwError(); + }); + + it('should support errors that are not Errors', () => { + const err = errcode({ + message: 'Oh noes!', + }, 'ERR_WAT'); + + expect(err.message).to.be('Oh noes!'); + expect(err.code).to.be('ERR_WAT'); + }); + }); + + describe('falsy first arguments', () => { + it('should not allow passing null as the first argument', () => { + expect(() => { errcode(null); }).to.throwError((err) => { + expect(err).to.be.a(TypeError); + }); + }); + + it('should not allow passing undefined as the first argument', () => { + expect(() => { errcode(undefined); }).to.throwError((err) => { + expect(err).to.be.a(TypeError); + }); + }); + }); +}); diff --git a/node_modules/npm/node_modules/exponential-backoff/LICENSE b/node_modules/npm/node_modules/exponential-backoff/LICENSE new file mode 100644 index 00000000..7a4a3ea2 --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/dist/backoff.js b/node_modules/npm/node_modules/exponential-backoff/dist/backoff.js new file mode 100644 index 00000000..a0aa0dc3 --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/dist/backoff.js @@ -0,0 +1,118 @@ +"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 __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var options_1 = require("./options"); +var delay_factory_1 = require("./delay/delay.factory"); +function backOff(request, options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + var sanitizedOptions, backOff; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + sanitizedOptions = options_1.getSanitizedOptions(options); + backOff = new BackOff(request, sanitizedOptions); + return [4 /*yield*/, backOff.execute()]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); +} +exports.backOff = backOff; +var BackOff = /** @class */ (function () { + function BackOff(request, options) { + this.request = request; + this.options = options; + this.attemptNumber = 0; + } + BackOff.prototype.execute = function () { + return __awaiter(this, void 0, void 0, function () { + var e_1, shouldRetry; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!!this.attemptLimitReached) return [3 /*break*/, 7]; + _a.label = 1; + case 1: + _a.trys.push([1, 4, , 6]); + return [4 /*yield*/, this.applyDelay()]; + case 2: + _a.sent(); + return [4 /*yield*/, this.request()]; + case 3: return [2 /*return*/, _a.sent()]; + case 4: + e_1 = _a.sent(); + this.attemptNumber++; + return [4 /*yield*/, this.options.retry(e_1, this.attemptNumber)]; + case 5: + shouldRetry = _a.sent(); + if (!shouldRetry || this.attemptLimitReached) { + throw e_1; + } + return [3 /*break*/, 6]; + case 6: return [3 /*break*/, 0]; + case 7: throw new Error("Something went wrong."); + } + }); + }); + }; + Object.defineProperty(BackOff.prototype, "attemptLimitReached", { + get: function () { + return this.attemptNumber >= this.options.numOfAttempts; + }, + enumerable: true, + configurable: true + }); + BackOff.prototype.applyDelay = function () { + return __awaiter(this, void 0, void 0, function () { + var delay; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + delay = delay_factory_1.DelayFactory(this.options, this.attemptNumber); + return [4 /*yield*/, delay.apply()]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + return BackOff; +}()); +//# sourceMappingURL=backoff.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/dist/delay/always/always.delay.js b/node_modules/npm/node_modules/exponential-backoff/dist/delay/always/always.delay.js new file mode 100644 index 00000000..40e34071 --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/dist/delay/always/always.delay.js @@ -0,0 +1,25 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var delay_base_1 = require("../delay.base"); +var AlwaysDelay = /** @class */ (function (_super) { + __extends(AlwaysDelay, _super); + function AlwaysDelay() { + return _super !== null && _super.apply(this, arguments) || this; + } + return AlwaysDelay; +}(delay_base_1.Delay)); +exports.AlwaysDelay = AlwaysDelay; +//# sourceMappingURL=always.delay.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.base.js b/node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.base.js new file mode 100644 index 00000000..b146c2fa --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.base.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var jitter_factory_1 = require("../jitter/jitter.factory"); +var Delay = /** @class */ (function () { + function Delay(options) { + this.options = options; + this.attempt = 0; + } + Delay.prototype.apply = function () { + var _this = this; + return new Promise(function (resolve) { return setTimeout(resolve, _this.jitteredDelay); }); + }; + Delay.prototype.setAttemptNumber = function (attempt) { + this.attempt = attempt; + }; + Object.defineProperty(Delay.prototype, "jitteredDelay", { + get: function () { + var jitter = jitter_factory_1.JitterFactory(this.options); + return jitter(this.delay); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Delay.prototype, "delay", { + get: function () { + var constant = this.options.startingDelay; + var base = this.options.timeMultiple; + var power = this.numOfDelayedAttempts; + var delay = constant * Math.pow(base, power); + return Math.min(delay, this.options.maxDelay); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Delay.prototype, "numOfDelayedAttempts", { + get: function () { + return this.attempt; + }, + enumerable: true, + configurable: true + }); + return Delay; +}()); +exports.Delay = Delay; +//# sourceMappingURL=delay.base.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.factory.js b/node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.factory.js new file mode 100644 index 00000000..33008dbf --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.factory.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var skip_first_delay_1 = require("./skip-first/skip-first.delay"); +var always_delay_1 = require("./always/always.delay"); +function DelayFactory(options, attempt) { + var delay = initDelayClass(options); + delay.setAttemptNumber(attempt); + return delay; +} +exports.DelayFactory = DelayFactory; +function initDelayClass(options) { + if (!options.delayFirstAttempt) { + return new skip_first_delay_1.SkipFirstDelay(options); + } + return new always_delay_1.AlwaysDelay(options); +} +//# sourceMappingURL=delay.factory.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.interface.js b/node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.interface.js new file mode 100644 index 00000000..6fe2a5a0 --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/dist/delay/delay.interface.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=delay.interface.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/dist/delay/skip-first/skip-first.delay.js b/node_modules/npm/node_modules/exponential-backoff/dist/delay/skip-first/skip-first.delay.js new file mode 100644 index 00000000..73f8841d --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/dist/delay/skip-first/skip-first.delay.js @@ -0,0 +1,82 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +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 __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var delay_base_1 = require("../delay.base"); +var SkipFirstDelay = /** @class */ (function (_super) { + __extends(SkipFirstDelay, _super); + function SkipFirstDelay() { + return _super !== null && _super.apply(this, arguments) || this; + } + SkipFirstDelay.prototype.apply = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.isFirstAttempt ? true : _super.prototype.apply.call(this)]; + }); + }); + }; + Object.defineProperty(SkipFirstDelay.prototype, "isFirstAttempt", { + get: function () { + return this.attempt === 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SkipFirstDelay.prototype, "numOfDelayedAttempts", { + get: function () { + return this.attempt - 1; + }, + enumerable: true, + configurable: true + }); + return SkipFirstDelay; +}(delay_base_1.Delay)); +exports.SkipFirstDelay = SkipFirstDelay; +//# sourceMappingURL=skip-first.delay.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/dist/jitter/full/full.jitter.js b/node_modules/npm/node_modules/exponential-backoff/dist/jitter/full/full.jitter.js new file mode 100644 index 00000000..16cee36b --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/dist/jitter/full/full.jitter.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function fullJitter(delay) { + var jitteredDelay = Math.random() * delay; + return Math.round(jitteredDelay); +} +exports.fullJitter = fullJitter; +//# sourceMappingURL=full.jitter.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/dist/jitter/jitter.factory.js b/node_modules/npm/node_modules/exponential-backoff/dist/jitter/jitter.factory.js new file mode 100644 index 00000000..8aafe45f --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/dist/jitter/jitter.factory.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var full_jitter_1 = require("./full/full.jitter"); +var no_jitter_1 = require("./no/no.jitter"); +function JitterFactory(options) { + switch (options.jitter) { + case "full": + return full_jitter_1.fullJitter; + case "none": + default: + return no_jitter_1.noJitter; + } +} +exports.JitterFactory = JitterFactory; +//# sourceMappingURL=jitter.factory.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/dist/jitter/no/no.jitter.js b/node_modules/npm/node_modules/exponential-backoff/dist/jitter/no/no.jitter.js new file mode 100644 index 00000000..15a40bb2 --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/dist/jitter/no/no.jitter.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function noJitter(delay) { + return delay; +} +exports.noJitter = noJitter; +//# sourceMappingURL=no.jitter.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/dist/options.js b/node_modules/npm/node_modules/exponential-backoff/dist/options.js new file mode 100644 index 00000000..1d2ca170 --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/dist/options.js @@ -0,0 +1,31 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var defaultOptions = { + delayFirstAttempt: false, + jitter: "none", + maxDelay: Infinity, + numOfAttempts: 10, + retry: function () { return true; }, + startingDelay: 100, + timeMultiple: 2 +}; +function getSanitizedOptions(options) { + var sanitized = __assign(__assign({}, defaultOptions), options); + if (sanitized.numOfAttempts < 1) { + sanitized.numOfAttempts = 1; + } + return sanitized; +} +exports.getSanitizedOptions = getSanitizedOptions; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/exponential-backoff/package.json b/node_modules/npm/node_modules/exponential-backoff/package.json new file mode 100644 index 00000000..23232a0d --- /dev/null +++ b/node_modules/npm/node_modules/exponential-backoff/package.json @@ -0,0 +1,61 @@ +{ + "name": "exponential-backoff", + "version": "3.1.1", + "description": "A utility that allows retrying a function with an exponential delay between attempts.", + "files": [ + "dist/" + ], + "main": "dist/backoff.js", + "types": "dist/backoff.d.ts", + "scripts": { + "build": "tsc", + "test": "jest", + "test:watch": "jest --watch" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.{ts,json,md}": [ + "prettier --write", + "git add" + ] + }, + "jest": { + "transform": { + "^.+\\.ts$": "ts-jest" + }, + "testRegex": "\\.spec\\.ts$", + "moduleFileExtensions": [ + "ts", + "js" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/coveo/exponential-backoff.git" + }, + "keywords": [ + "exponential", + "backoff", + "retry" + ], + "author": "Sami Sayegh", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/coveo/exponential-backoff/issues" + }, + "homepage": "https://github.com/coveo/exponential-backoff#readme", + "devDependencies": { + "@types/jest": "^24.0.18", + "@types/node": "^10.14.21", + "husky": "^3.0.9", + "jest": "^24.9.0", + "lint-staged": "^9.4.2", + "prettier": "^1.18.2", + "ts-jest": "^24.1.0", + "typescript": "^3.6.4" + } +} diff --git a/node_modules/npm/node_modules/fastest-levenshtein/LICENSE.md b/node_modules/npm/node_modules/fastest-levenshtein/LICENSE.md new file mode 100644 index 00000000..0e62da30 --- /dev/null +++ b/node_modules/npm/node_modules/fastest-levenshtein/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Kasper Unn Weihe + +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. \ No newline at end of file diff --git a/node_modules/npm/node_modules/fastest-levenshtein/bench.js b/node_modules/npm/node_modules/fastest-levenshtein/bench.js new file mode 100644 index 00000000..1fd420bd --- /dev/null +++ b/node_modules/npm/node_modules/fastest-levenshtein/bench.js @@ -0,0 +1,96 @@ +"use strict"; +exports.__esModule = true; +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable no-console */ +var Benchmark = require("benchmark"); +var mod_js_1 = require("./mod.js"); +var fast_levenshtein_1 = require("fast-levenshtein"); +var fs = require("fs"); +var jslevenshtein = require("js-levenshtein"); +var leven = require("leven"); +var levenshteinEditDistance = require("levenshtein-edit-distance"); +var suite = new Benchmark.Suite(); +var randomstring = function (length) { + var result = ""; + var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + var charactersLength = characters.length; + for (var i = 0; i < length; i++) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + } + return result; +}; +var randomstringArr = function (stringSize, arraySize) { + var i = 0; + var arr = []; + for (i = 0; i < arraySize; i++) { + arr.push(randomstring(stringSize)); + } + return arr; +}; +var arrSize = 1000; +if (!fs.existsSync("data.json")) { + var data_1 = [ + randomstringArr(4, arrSize), + randomstringArr(8, arrSize), + randomstringArr(16, arrSize), + randomstringArr(32, arrSize), + randomstringArr(64, arrSize), + randomstringArr(128, arrSize), + randomstringArr(256, arrSize), + randomstringArr(512, arrSize), + randomstringArr(1024, arrSize), + ]; + fs.writeFileSync("data.json", JSON.stringify(data_1)); +} +var data = JSON.parse(fs.readFileSync("data.json", "utf8")); +var _loop_1 = function (i) { + var datapick = data[i]; + if (process.argv[2] !== "no") { + suite + .add("".concat(i, " - js-levenshtein"), function () { + for (var j = 0; j < arrSize - 1; j += 2) { + jslevenshtein(datapick[j], datapick[j + 1]); + } + }) + .add("".concat(i, " - leven"), function () { + for (var j = 0; j < arrSize - 1; j += 2) { + leven(datapick[j], datapick[j + 1]); + } + }) + .add("".concat(i, " - fast-levenshtein"), function () { + for (var j = 0; j < arrSize - 1; j += 2) { + (0, fast_levenshtein_1.get)(datapick[j], datapick[j + 1]); + } + }) + .add("".concat(i, " - levenshtein-edit-distance"), function () { + for (var j = 0; j < arrSize - 1; j += 2) { + levenshteinEditDistance(datapick[j], datapick[j + 1]); + } + }); + } + suite.add("".concat(i, " - fastest-levenshtein"), function () { + for (var j = 0; j < arrSize - 1; j += 2) { + (0, mod_js_1.distance)(datapick[j], datapick[j + 1]); + } + }); +}; +// BENCHMARKS +for (var i = 0; i < 9; i++) { + _loop_1(i); +} +var results = new Map(); +suite + .on("cycle", function (event) { + console.log(String(event.target)); + if (results.has(event.target.name[0])) { + results.get(event.target.name[0]).push(event.target.hz); + } + else { + results.set(event.target.name[0], [event.target.hz]); + } +}) + .on("complete", function () { + console.log(results); +}) + // run async + .run({ async: true }); diff --git a/node_modules/npm/node_modules/fastest-levenshtein/esm/mod.js b/node_modules/npm/node_modules/fastest-levenshtein/esm/mod.js new file mode 100644 index 00000000..719f2b8f --- /dev/null +++ b/node_modules/npm/node_modules/fastest-levenshtein/esm/mod.js @@ -0,0 +1,138 @@ +const peq = new Uint32Array(0x10000); +const myers_32 = (a, b) => { + const n = a.length; + const m = b.length; + const lst = 1 << (n - 1); + let pv = -1; + let mv = 0; + let sc = n; + let i = n; + while (i--) { + peq[a.charCodeAt(i)] |= 1 << i; + } + for (i = 0; i < m; i++) { + let eq = peq[b.charCodeAt(i)]; + const xv = eq | mv; + eq |= ((eq & pv) + pv) ^ pv; + mv |= ~(eq | pv); + pv &= eq; + if (mv & lst) { + sc++; + } + if (pv & lst) { + sc--; + } + mv = (mv << 1) | 1; + pv = (pv << 1) | ~(xv | mv); + mv &= xv; + } + i = n; + while (i--) { + peq[a.charCodeAt(i)] = 0; + } + return sc; +}; +const myers_x = (b, a) => { + const n = a.length; + const m = b.length; + const mhc = []; + const phc = []; + const hsize = Math.ceil(n / 32); + const vsize = Math.ceil(m / 32); + for (let i = 0; i < hsize; i++) { + phc[i] = -1; + mhc[i] = 0; + } + let j = 0; + for (; j < vsize - 1; j++) { + let mv = 0; + let pv = -1; + const start = j * 32; + const vlen = Math.min(32, m) + start; + for (let k = start; k < vlen; k++) { + peq[b.charCodeAt(k)] |= 1 << k; + } + for (let i = 0; i < n; i++) { + const eq = peq[a.charCodeAt(i)]; + const pb = (phc[(i / 32) | 0] >>> i) & 1; + const mb = (mhc[(i / 32) | 0] >>> i) & 1; + const xv = eq | mv; + const xh = ((((eq | mb) & pv) + pv) ^ pv) | eq | mb; + let ph = mv | ~(xh | pv); + let mh = pv & xh; + if ((ph >>> 31) ^ pb) { + phc[(i / 32) | 0] ^= 1 << i; + } + if ((mh >>> 31) ^ mb) { + mhc[(i / 32) | 0] ^= 1 << i; + } + ph = (ph << 1) | pb; + mh = (mh << 1) | mb; + pv = mh | ~(xv | ph); + mv = ph & xv; + } + for (let k = start; k < vlen; k++) { + peq[b.charCodeAt(k)] = 0; + } + } + let mv = 0; + let pv = -1; + const start = j * 32; + const vlen = Math.min(32, m - start) + start; + for (let k = start; k < vlen; k++) { + peq[b.charCodeAt(k)] |= 1 << k; + } + let score = m; + for (let i = 0; i < n; i++) { + const eq = peq[a.charCodeAt(i)]; + const pb = (phc[(i / 32) | 0] >>> i) & 1; + const mb = (mhc[(i / 32) | 0] >>> i) & 1; + const xv = eq | mv; + const xh = ((((eq | mb) & pv) + pv) ^ pv) | eq | mb; + let ph = mv | ~(xh | pv); + let mh = pv & xh; + score += (ph >>> (m - 1)) & 1; + score -= (mh >>> (m - 1)) & 1; + if ((ph >>> 31) ^ pb) { + phc[(i / 32) | 0] ^= 1 << i; + } + if ((mh >>> 31) ^ mb) { + mhc[(i / 32) | 0] ^= 1 << i; + } + ph = (ph << 1) | pb; + mh = (mh << 1) | mb; + pv = mh | ~(xv | ph); + mv = ph & xv; + } + for (let k = start; k < vlen; k++) { + peq[b.charCodeAt(k)] = 0; + } + return score; +}; +const distance = (a, b) => { + if (a.length < b.length) { + const tmp = b; + b = a; + a = tmp; + } + if (b.length === 0) { + return a.length; + } + if (a.length <= 32) { + return myers_32(a, b); + } + return myers_x(a, b); +}; +const closest = (str, arr) => { + let min_distance = Infinity; + let min_index = 0; + for (let i = 0; i < arr.length; i++) { + const dist = distance(str, arr[i]); + if (dist < min_distance) { + min_distance = dist; + min_index = i; + } + } + return arr[min_index]; +}; +export { closest, distance }; diff --git a/node_modules/npm/node_modules/fastest-levenshtein/mod.js b/node_modules/npm/node_modules/fastest-levenshtein/mod.js new file mode 100644 index 00000000..6bc27459 --- /dev/null +++ b/node_modules/npm/node_modules/fastest-levenshtein/mod.js @@ -0,0 +1,142 @@ +"use strict"; +exports.__esModule = true; +exports.distance = exports.closest = void 0; +var peq = new Uint32Array(0x10000); +var myers_32 = function (a, b) { + var n = a.length; + var m = b.length; + var lst = 1 << (n - 1); + var pv = -1; + var mv = 0; + var sc = n; + var i = n; + while (i--) { + peq[a.charCodeAt(i)] |= 1 << i; + } + for (i = 0; i < m; i++) { + var eq = peq[b.charCodeAt(i)]; + var xv = eq | mv; + eq |= ((eq & pv) + pv) ^ pv; + mv |= ~(eq | pv); + pv &= eq; + if (mv & lst) { + sc++; + } + if (pv & lst) { + sc--; + } + mv = (mv << 1) | 1; + pv = (pv << 1) | ~(xv | mv); + mv &= xv; + } + i = n; + while (i--) { + peq[a.charCodeAt(i)] = 0; + } + return sc; +}; +var myers_x = function (b, a) { + var n = a.length; + var m = b.length; + var mhc = []; + var phc = []; + var hsize = Math.ceil(n / 32); + var vsize = Math.ceil(m / 32); + for (var i = 0; i < hsize; i++) { + phc[i] = -1; + mhc[i] = 0; + } + var j = 0; + for (; j < vsize - 1; j++) { + var mv_1 = 0; + var pv_1 = -1; + var start_1 = j * 32; + var vlen_1 = Math.min(32, m) + start_1; + for (var k = start_1; k < vlen_1; k++) { + peq[b.charCodeAt(k)] |= 1 << k; + } + for (var i = 0; i < n; i++) { + var eq = peq[a.charCodeAt(i)]; + var pb = (phc[(i / 32) | 0] >>> i) & 1; + var mb = (mhc[(i / 32) | 0] >>> i) & 1; + var xv = eq | mv_1; + var xh = ((((eq | mb) & pv_1) + pv_1) ^ pv_1) | eq | mb; + var ph = mv_1 | ~(xh | pv_1); + var mh = pv_1 & xh; + if ((ph >>> 31) ^ pb) { + phc[(i / 32) | 0] ^= 1 << i; + } + if ((mh >>> 31) ^ mb) { + mhc[(i / 32) | 0] ^= 1 << i; + } + ph = (ph << 1) | pb; + mh = (mh << 1) | mb; + pv_1 = mh | ~(xv | ph); + mv_1 = ph & xv; + } + for (var k = start_1; k < vlen_1; k++) { + peq[b.charCodeAt(k)] = 0; + } + } + var mv = 0; + var pv = -1; + var start = j * 32; + var vlen = Math.min(32, m - start) + start; + for (var k = start; k < vlen; k++) { + peq[b.charCodeAt(k)] |= 1 << k; + } + var score = m; + for (var i = 0; i < n; i++) { + var eq = peq[a.charCodeAt(i)]; + var pb = (phc[(i / 32) | 0] >>> i) & 1; + var mb = (mhc[(i / 32) | 0] >>> i) & 1; + var xv = eq | mv; + var xh = ((((eq | mb) & pv) + pv) ^ pv) | eq | mb; + var ph = mv | ~(xh | pv); + var mh = pv & xh; + score += (ph >>> (m - 1)) & 1; + score -= (mh >>> (m - 1)) & 1; + if ((ph >>> 31) ^ pb) { + phc[(i / 32) | 0] ^= 1 << i; + } + if ((mh >>> 31) ^ mb) { + mhc[(i / 32) | 0] ^= 1 << i; + } + ph = (ph << 1) | pb; + mh = (mh << 1) | mb; + pv = mh | ~(xv | ph); + mv = ph & xv; + } + for (var k = start; k < vlen; k++) { + peq[b.charCodeAt(k)] = 0; + } + return score; +}; +var distance = function (a, b) { + if (a.length < b.length) { + var tmp = b; + b = a; + a = tmp; + } + if (b.length === 0) { + return a.length; + } + if (a.length <= 32) { + return myers_32(a, b); + } + return myers_x(a, b); +}; +exports.distance = distance; +var closest = function (str, arr) { + var min_distance = Infinity; + var min_index = 0; + for (var i = 0; i < arr.length; i++) { + var dist = distance(str, arr[i]); + if (dist < min_distance) { + min_distance = dist; + min_index = i; + } + } + return arr[min_index]; +}; +exports.closest = closest; diff --git a/node_modules/npm/node_modules/fastest-levenshtein/package.json b/node_modules/npm/node_modules/fastest-levenshtein/package.json new file mode 100644 index 00000000..c395b852 --- /dev/null +++ b/node_modules/npm/node_modules/fastest-levenshtein/package.json @@ -0,0 +1,72 @@ +{ + "name": "fastest-levenshtein", + "version": "1.0.16", + "description": "Fastest Levenshtein distance implementation in JS.", + "main": "mod.js", + "types": "mod.d.ts", + "module": "./esm/mod.js", + "repository": { + "type": "git", + "url": "git+https://github.com/ka-weihe/fastest-levenshtein.git" + }, + "keywords": [ + "levenshtein", + "distance", + "fast", + "fastest", + "edit", + "string", + "similarity", + "algorithm", + "match", + "comparison", + "fuzzy", + "search", + "string", + "matching", + "similar", + "node", + "difference" + ], + "author": "Kasper U. Weihe", + "license": "MIT", + "bugs": { + "url": "https://github.com/ka-weihe/fastest-levenshtein/issues" + }, + "homepage": "https://github.com/ka-weihe/fastest-levenshtein#README", + "scripts": { + "build": "tsc mod.ts --declaration", + "build:esm": "tsc --declaration -p tsconfig.esm.json", + "prepare": "npm run build && npm run build:esm", + "bench": "npm run build && tsc bench.ts && node bench.js", + "test": "npm run build && tsc test.ts && jest test.js", + "test:coverage": "npm run build && jest --coverage", + "test:coveralls": "npm run build && jest --coverage --coverageReporters=text-lcov | coveralls" + }, + "devDependencies": { + "@types/benchmark": "^1.0.33", + "@types/jest": "^26.0.15", + "@typescript-eslint/eslint-plugin": "^4.7.0", + "@typescript-eslint/parser": "^4.7.0", + "benchmark": "^2.1.4", + "coveralls": "^3.1.0", + "eslint": "^7.13.0", + "eslint-config-node": "^4.1.0", + "eslint-config-prettier": "^6.15.0", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^3.1.4", + "fast-levenshtein": "^2.0.6", + "jest": "^26.6.3", + "js-levenshtein": "^1.1.6", + "leven": "^3.1.0", + "levenshtein-edit-distance": "^2.0.5", + "natural": "^2.1.5", + "prettier": "^2.1.2", + "talisman": "^1.1.3", + "typescript": "^4.0.5" + }, + "engines": { + "node": ">= 4.9.1" + } +} diff --git a/node_modules/npm/node_modules/fastest-levenshtein/test.js b/node_modules/npm/node_modules/fastest-levenshtein/test.js new file mode 100644 index 00000000..47506339 --- /dev/null +++ b/node_modules/npm/node_modules/fastest-levenshtein/test.js @@ -0,0 +1,55 @@ +var _a = require("./mod.js"), closest = _a.closest, distance = _a.distance; +var levenshtein = function (a, b) { + if (a.length === 0) { + return b.length; + } + if (b.length === 0) { + return a.length; + } + if (a.length > b.length) { + var tmp = a; + a = b; + b = tmp; + } + var row = []; + for (var i = 0; i <= a.length; i++) { + row[i] = i; + } + for (var i = 1; i <= b.length; i++) { + var prev = i; + for (var j = 1; j <= a.length; j++) { + var val = 0; + if (b.charAt(i - 1) === a.charAt(j - 1)) { + val = row[j - 1]; + } + else { + val = Math.min(row[j - 1] + 1, prev + 1, row[j] + 1); + } + row[j - 1] = prev; + prev = val; + } + row[a.length] = prev; + } + return row[a.length]; +}; +var makeid = function (length) { + var result = ""; + var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + var charactersLength = characters.length; + for (var i = 0; i < length; i++) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + } + return result; +}; +for (var i = 0; i < 10000; i++) { + var rnd_num1 = (Math.random() * 1000) | 0; + var rnd_num2 = (Math.random() * 1000) | 0; + var rnd_string1 = makeid(rnd_num1); + var rnd_string2 = makeid(rnd_num2); + var actual = distance(rnd_string1, rnd_string2); + var expected = levenshtein(rnd_string1, rnd_string2); + console.log(i); + if (actual !== expected) { + console.log("fail"); + } +} diff --git a/node_modules/npm/node_modules/foreground-child/LICENSE b/node_modules/npm/node_modules/foreground-child/LICENSE new file mode 100644 index 00000000..2d80720f --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2015-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/npm/node_modules/foreground-child/dist/commonjs/all-signals.js b/node_modules/npm/node_modules/foreground-child/dist/commonjs/all-signals.js new file mode 100644 index 00000000..1692af01 --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/dist/commonjs/all-signals.js @@ -0,0 +1,58 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.allSignals = void 0; +const node_constants_1 = __importDefault(require("node:constants")); +exports.allSignals = +// this is the full list of signals that Node will let us do anything with +Object.keys(node_constants_1.default).filter(k => k.startsWith('SIG') && + // https://github.com/tapjs/signal-exit/issues/21 + k !== 'SIGPROF' && + // no sense trying to listen for SIGKILL, it's impossible + k !== 'SIGKILL'); +// These are some obscure signals that are reported by kill -l +// on macOS, Linux, or Windows, but which don't have any mapping +// in Node.js. No sense trying if they're just going to throw +// every time on every platform. +// +// 'SIGEMT', +// 'SIGLOST', +// 'SIGPOLL', +// 'SIGRTMAX', +// 'SIGRTMAX-1', +// 'SIGRTMAX-10', +// 'SIGRTMAX-11', +// 'SIGRTMAX-12', +// 'SIGRTMAX-13', +// 'SIGRTMAX-14', +// 'SIGRTMAX-15', +// 'SIGRTMAX-2', +// 'SIGRTMAX-3', +// 'SIGRTMAX-4', +// 'SIGRTMAX-5', +// 'SIGRTMAX-6', +// 'SIGRTMAX-7', +// 'SIGRTMAX-8', +// 'SIGRTMAX-9', +// 'SIGRTMIN', +// 'SIGRTMIN+1', +// 'SIGRTMIN+10', +// 'SIGRTMIN+11', +// 'SIGRTMIN+12', +// 'SIGRTMIN+13', +// 'SIGRTMIN+14', +// 'SIGRTMIN+15', +// 'SIGRTMIN+16', +// 'SIGRTMIN+2', +// 'SIGRTMIN+3', +// 'SIGRTMIN+4', +// 'SIGRTMIN+5', +// 'SIGRTMIN+6', +// 'SIGRTMIN+7', +// 'SIGRTMIN+8', +// 'SIGRTMIN+9', +// 'SIGSTKFLT', +// 'SIGUNUSED', +//# sourceMappingURL=all-signals.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/foreground-child/dist/commonjs/index.js b/node_modules/npm/node_modules/foreground-child/dist/commonjs/index.js new file mode 100644 index 00000000..07a01c58 --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/dist/commonjs/index.js @@ -0,0 +1,123 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foregroundChild = exports.normalizeFgArgs = void 0; +const child_process_1 = require("child_process"); +const cross_spawn_1 = __importDefault(require("cross-spawn")); +const signal_exit_1 = require("signal-exit"); +const proxy_signals_js_1 = require("./proxy-signals.js"); +const watchdog_js_1 = require("./watchdog.js"); +/* c8 ignore start */ +const spawn = process?.platform === 'win32' ? cross_spawn_1.default : child_process_1.spawn; +/** + * Normalizes the arguments passed to `foregroundChild`. + * + * Exposed for testing. + * + * @internal + */ +const normalizeFgArgs = (fgArgs) => { + let [program, args = [], spawnOpts = {}, cleanup = () => { }] = fgArgs; + if (typeof args === 'function') { + cleanup = args; + spawnOpts = {}; + args = []; + } + else if (!!args && typeof args === 'object' && !Array.isArray(args)) { + if (typeof spawnOpts === 'function') + cleanup = spawnOpts; + spawnOpts = args; + args = []; + } + else if (typeof spawnOpts === 'function') { + cleanup = spawnOpts; + spawnOpts = {}; + } + if (Array.isArray(program)) { + const [pp, ...pa] = program; + program = pp; + args = pa; + } + return [program, args, { ...spawnOpts }, cleanup]; +}; +exports.normalizeFgArgs = normalizeFgArgs; +function foregroundChild(...fgArgs) { + const [program, args, spawnOpts, cleanup] = (0, exports.normalizeFgArgs)(fgArgs); + spawnOpts.stdio = [0, 1, 2]; + if (process.send) { + spawnOpts.stdio.push('ipc'); + } + const child = spawn(program, args, spawnOpts); + const childHangup = () => { + try { + child.kill('SIGHUP'); + /* c8 ignore start */ + } + catch (_) { + // SIGHUP is weird on windows + child.kill('SIGTERM'); + } + /* c8 ignore stop */ + }; + const removeOnExit = (0, signal_exit_1.onExit)(childHangup); + (0, proxy_signals_js_1.proxySignals)(child); + const dog = (0, watchdog_js_1.watchdog)(child); + let done = false; + child.on('close', async (code, signal) => { + /* c8 ignore start */ + if (done) + return; + /* c8 ignore stop */ + done = true; + const result = cleanup(code, signal, { + watchdogPid: dog.pid, + }); + const res = isPromise(result) ? await result : result; + removeOnExit(); + if (res === false) + return; + else if (typeof res === 'string') { + signal = res; + code = null; + } + else if (typeof res === 'number') { + code = res; + signal = null; + } + if (signal) { + // If there is nothing else keeping the event loop alive, + // then there's a race between a graceful exit and getting + // the signal to this process. Put this timeout here to + // make sure we're still alive to get the signal, and thus + // exit with the intended signal code. + /* istanbul ignore next */ + setTimeout(() => { }, 2000); + try { + process.kill(process.pid, signal); + /* c8 ignore start */ + } + catch (_) { + process.kill(process.pid, 'SIGTERM'); + } + /* c8 ignore stop */ + } + else { + process.exit(code || 0); + } + }); + if (process.send) { + process.removeAllListeners('message'); + child.on('message', (message, sendHandle) => { + process.send?.(message, sendHandle); + }); + process.on('message', (message, sendHandle) => { + child.send(message, sendHandle); + }); + } + return child; +} +exports.foregroundChild = foregroundChild; +const isPromise = (o) => !!o && typeof o === 'object' && typeof o.then === 'function'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/foreground-child/dist/commonjs/package.json b/node_modules/npm/node_modules/foreground-child/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/foreground-child/dist/commonjs/proxy-signals.js b/node_modules/npm/node_modules/foreground-child/dist/commonjs/proxy-signals.js new file mode 100644 index 00000000..3913e7b4 --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/dist/commonjs/proxy-signals.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.proxySignals = void 0; +const all_signals_js_1 = require("./all-signals.js"); +/** + * Starts forwarding signals to `child` through `parent`. + */ +const proxySignals = (child) => { + const listeners = new Map(); + for (const sig of all_signals_js_1.allSignals) { + const listener = () => { + // some signals can only be received, not sent + try { + child.kill(sig); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + }; + try { + // if it's a signal this system doesn't recognize, skip it + process.on(sig, listener); + listeners.set(sig, listener); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + } + const unproxy = () => { + for (const [sig, listener] of listeners) { + process.removeListener(sig, listener); + } + }; + child.on('exit', unproxy); + return unproxy; +}; +exports.proxySignals = proxySignals; +//# sourceMappingURL=proxy-signals.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/foreground-child/dist/commonjs/watchdog.js b/node_modules/npm/node_modules/foreground-child/dist/commonjs/watchdog.js new file mode 100644 index 00000000..514e234c --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/dist/commonjs/watchdog.js @@ -0,0 +1,50 @@ +"use strict"; +// this spawns a child process that listens for SIGHUP when the +// parent process exits, and after 200ms, sends a SIGKILL to the +// child, in case it did not terminate. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.watchdog = void 0; +const child_process_1 = require("child_process"); +const watchdogCode = String.raw ` +const pid = parseInt(process.argv[1], 10) +process.title = 'node (foreground-child watchdog pid=' + pid + ')' +if (!isNaN(pid)) { + let barked = false + // keepalive + const interval = setInterval(() => {}, 60000) + const bark = () => { + clearInterval(interval) + if (barked) return + barked = true + process.removeListener('SIGHUP', bark) + setTimeout(() => { + try { + process.kill(pid, 'SIGKILL') + setTimeout(() => process.exit(), 200) + } catch (_) {} + }, 500) + }) + process.on('SIGHUP', bark) +} +`; +/** + * Pass in a ChildProcess, and this will spawn a watchdog process that + * will make sure it exits if the parent does, thus preventing any + * dangling detached zombie processes. + * + * If the child ends before the parent, then the watchdog will terminate. + */ +const watchdog = (child) => { + let dogExited = false; + const dog = (0, child_process_1.spawn)(process.execPath, ['-e', watchdogCode, String(child.pid)], { + stdio: 'ignore', + }); + dog.on('exit', () => (dogExited = true)); + child.on('exit', () => { + if (!dogExited) + dog.kill('SIGKILL'); + }); + return dog; +}; +exports.watchdog = watchdog; +//# sourceMappingURL=watchdog.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/foreground-child/dist/esm/all-signals.js b/node_modules/npm/node_modules/foreground-child/dist/esm/all-signals.js new file mode 100644 index 00000000..7e8d54d5 --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/dist/esm/all-signals.js @@ -0,0 +1,52 @@ +import constants from 'node:constants'; +export const allSignals = +// this is the full list of signals that Node will let us do anything with +Object.keys(constants).filter(k => k.startsWith('SIG') && + // https://github.com/tapjs/signal-exit/issues/21 + k !== 'SIGPROF' && + // no sense trying to listen for SIGKILL, it's impossible + k !== 'SIGKILL'); +// These are some obscure signals that are reported by kill -l +// on macOS, Linux, or Windows, but which don't have any mapping +// in Node.js. No sense trying if they're just going to throw +// every time on every platform. +// +// 'SIGEMT', +// 'SIGLOST', +// 'SIGPOLL', +// 'SIGRTMAX', +// 'SIGRTMAX-1', +// 'SIGRTMAX-10', +// 'SIGRTMAX-11', +// 'SIGRTMAX-12', +// 'SIGRTMAX-13', +// 'SIGRTMAX-14', +// 'SIGRTMAX-15', +// 'SIGRTMAX-2', +// 'SIGRTMAX-3', +// 'SIGRTMAX-4', +// 'SIGRTMAX-5', +// 'SIGRTMAX-6', +// 'SIGRTMAX-7', +// 'SIGRTMAX-8', +// 'SIGRTMAX-9', +// 'SIGRTMIN', +// 'SIGRTMIN+1', +// 'SIGRTMIN+10', +// 'SIGRTMIN+11', +// 'SIGRTMIN+12', +// 'SIGRTMIN+13', +// 'SIGRTMIN+14', +// 'SIGRTMIN+15', +// 'SIGRTMIN+16', +// 'SIGRTMIN+2', +// 'SIGRTMIN+3', +// 'SIGRTMIN+4', +// 'SIGRTMIN+5', +// 'SIGRTMIN+6', +// 'SIGRTMIN+7', +// 'SIGRTMIN+8', +// 'SIGRTMIN+9', +// 'SIGSTKFLT', +// 'SIGUNUSED', +//# sourceMappingURL=all-signals.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/foreground-child/dist/esm/index.js b/node_modules/npm/node_modules/foreground-child/dist/esm/index.js new file mode 100644 index 00000000..6266b584 --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/dist/esm/index.js @@ -0,0 +1,115 @@ +import { spawn as nodeSpawn, } from 'child_process'; +import crossSpawn from 'cross-spawn'; +import { onExit } from 'signal-exit'; +import { proxySignals } from './proxy-signals.js'; +import { watchdog } from './watchdog.js'; +/* c8 ignore start */ +const spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn; +/** + * Normalizes the arguments passed to `foregroundChild`. + * + * Exposed for testing. + * + * @internal + */ +export const normalizeFgArgs = (fgArgs) => { + let [program, args = [], spawnOpts = {}, cleanup = () => { }] = fgArgs; + if (typeof args === 'function') { + cleanup = args; + spawnOpts = {}; + args = []; + } + else if (!!args && typeof args === 'object' && !Array.isArray(args)) { + if (typeof spawnOpts === 'function') + cleanup = spawnOpts; + spawnOpts = args; + args = []; + } + else if (typeof spawnOpts === 'function') { + cleanup = spawnOpts; + spawnOpts = {}; + } + if (Array.isArray(program)) { + const [pp, ...pa] = program; + program = pp; + args = pa; + } + return [program, args, { ...spawnOpts }, cleanup]; +}; +export function foregroundChild(...fgArgs) { + const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs); + spawnOpts.stdio = [0, 1, 2]; + if (process.send) { + spawnOpts.stdio.push('ipc'); + } + const child = spawn(program, args, spawnOpts); + const childHangup = () => { + try { + child.kill('SIGHUP'); + /* c8 ignore start */ + } + catch (_) { + // SIGHUP is weird on windows + child.kill('SIGTERM'); + } + /* c8 ignore stop */ + }; + const removeOnExit = onExit(childHangup); + proxySignals(child); + const dog = watchdog(child); + let done = false; + child.on('close', async (code, signal) => { + /* c8 ignore start */ + if (done) + return; + /* c8 ignore stop */ + done = true; + const result = cleanup(code, signal, { + watchdogPid: dog.pid, + }); + const res = isPromise(result) ? await result : result; + removeOnExit(); + if (res === false) + return; + else if (typeof res === 'string') { + signal = res; + code = null; + } + else if (typeof res === 'number') { + code = res; + signal = null; + } + if (signal) { + // If there is nothing else keeping the event loop alive, + // then there's a race between a graceful exit and getting + // the signal to this process. Put this timeout here to + // make sure we're still alive to get the signal, and thus + // exit with the intended signal code. + /* istanbul ignore next */ + setTimeout(() => { }, 2000); + try { + process.kill(process.pid, signal); + /* c8 ignore start */ + } + catch (_) { + process.kill(process.pid, 'SIGTERM'); + } + /* c8 ignore stop */ + } + else { + process.exit(code || 0); + } + }); + if (process.send) { + process.removeAllListeners('message'); + child.on('message', (message, sendHandle) => { + process.send?.(message, sendHandle); + }); + process.on('message', (message, sendHandle) => { + child.send(message, sendHandle); + }); + } + return child; +} +const isPromise = (o) => !!o && typeof o === 'object' && typeof o.then === 'function'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/foreground-child/dist/esm/package.json b/node_modules/npm/node_modules/foreground-child/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/foreground-child/dist/esm/proxy-signals.js b/node_modules/npm/node_modules/foreground-child/dist/esm/proxy-signals.js new file mode 100644 index 00000000..8e1efe3e --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/dist/esm/proxy-signals.js @@ -0,0 +1,34 @@ +import { allSignals } from './all-signals.js'; +/** + * Starts forwarding signals to `child` through `parent`. + */ +export const proxySignals = (child) => { + const listeners = new Map(); + for (const sig of allSignals) { + const listener = () => { + // some signals can only be received, not sent + try { + child.kill(sig); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + }; + try { + // if it's a signal this system doesn't recognize, skip it + process.on(sig, listener); + listeners.set(sig, listener); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + } + const unproxy = () => { + for (const [sig, listener] of listeners) { + process.removeListener(sig, listener); + } + }; + child.on('exit', unproxy); + return unproxy; +}; +//# sourceMappingURL=proxy-signals.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/foreground-child/dist/esm/watchdog.js b/node_modules/npm/node_modules/foreground-child/dist/esm/watchdog.js new file mode 100644 index 00000000..7aa184ed --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/dist/esm/watchdog.js @@ -0,0 +1,46 @@ +// this spawns a child process that listens for SIGHUP when the +// parent process exits, and after 200ms, sends a SIGKILL to the +// child, in case it did not terminate. +import { spawn } from 'child_process'; +const watchdogCode = String.raw ` +const pid = parseInt(process.argv[1], 10) +process.title = 'node (foreground-child watchdog pid=' + pid + ')' +if (!isNaN(pid)) { + let barked = false + // keepalive + const interval = setInterval(() => {}, 60000) + const bark = () => { + clearInterval(interval) + if (barked) return + barked = true + process.removeListener('SIGHUP', bark) + setTimeout(() => { + try { + process.kill(pid, 'SIGKILL') + setTimeout(() => process.exit(), 200) + } catch (_) {} + }, 500) + }) + process.on('SIGHUP', bark) +} +`; +/** + * Pass in a ChildProcess, and this will spawn a watchdog process that + * will make sure it exits if the parent does, thus preventing any + * dangling detached zombie processes. + * + * If the child ends before the parent, then the watchdog will terminate. + */ +export const watchdog = (child) => { + let dogExited = false; + const dog = spawn(process.execPath, ['-e', watchdogCode, String(child.pid)], { + stdio: 'ignore', + }); + dog.on('exit', () => (dogExited = true)); + child.on('exit', () => { + if (!dogExited) + dog.kill('SIGKILL'); + }); + return dog; +}; +//# sourceMappingURL=watchdog.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/foreground-child/package.json b/node_modules/npm/node_modules/foreground-child/package.json new file mode 100644 index 00000000..980b7e85 --- /dev/null +++ b/node_modules/npm/node_modules/foreground-child/package.json @@ -0,0 +1,111 @@ +{ + "name": "foreground-child", + "version": "3.3.0", + "description": "Run a child as if it's the foreground process. Give it stdio. Exit when it exits.", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "exports": { + "./watchdog": { + "import": { + "source": "./src/watchdog.ts", + "types": "./dist/esm/watchdog.d.ts", + "default": "./dist/esm/watchdog.js" + }, + "require": { + "source": "./src/watchdog.ts", + "types": "./dist/commonjs/watchdog.d.ts", + "default": "./dist/commonjs/watchdog.js" + } + }, + "./proxy-signals": { + "import": { + "source": "./src/proxy-signals.ts", + "types": "./dist/esm/proxy-signals.d.ts", + "default": "./dist/esm/proxy-signals.js" + }, + "require": { + "source": "./src/proxy-signals.ts", + "types": "./dist/commonjs/proxy-signals.d.ts", + "default": "./dist/commonjs/proxy-signals.js" + } + }, + "./package.json": "./package.json", + ".": { + "import": { + "source": "./src/index.ts", + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "source": "./src/index.ts", + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "files": [ + "dist" + ], + "engines": { + "node": ">=14" + }, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "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 . --log-level warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "prettier": { + "experimentalTernaries": true, + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "tap": { + "typecheck": true + }, + "repository": { + "type": "git", + "url": "git+https://github.com/tapjs/foreground-child.git" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "devDependencies": { + "@types/cross-spawn": "^6.0.2", + "@types/node": "^18.15.11", + "@types/tap": "^15.0.8", + "prettier": "^3.3.2", + "tap": "^19.2.5", + "tshy": "^1.15.1", + "typedoc": "^0.24.2", + "typescript": "^5.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "tshy": { + "exports": { + "./watchdog": "./src/watchdog.ts", + "./proxy-signals": "./src/proxy-signals.ts", + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "type": "module" +} diff --git a/node_modules/npm/node_modules/fs-minipass/LICENSE b/node_modules/npm/node_modules/fs-minipass/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/fs-minipass/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/fs-minipass/lib/index.js b/node_modules/npm/node_modules/fs-minipass/lib/index.js new file mode 100644 index 00000000..3b84ff66 --- /dev/null +++ b/node_modules/npm/node_modules/fs-minipass/lib/index.js @@ -0,0 +1,443 @@ +'use strict' +const { Minipass } = require('minipass') +const EE = require('events').EventEmitter +const fs = require('fs') + +const writev = fs.writev + +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, b) => + this[_onread](er, br, b)) + } + } + + [_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) + if (!this[_writing]) { + 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 { + // ok error + } + } + } + } +} + +exports.ReadStream = ReadStream +exports.ReadStreamSync = ReadStreamSync + +exports.WriteStream = WriteStream +exports.WriteStreamSync = WriteStreamSync diff --git a/node_modules/npm/node_modules/fs-minipass/package.json b/node_modules/npm/node_modules/fs-minipass/package.json new file mode 100644 index 00000000..e501e647 --- /dev/null +++ b/node_modules/npm/node_modules/fs-minipass/package.json @@ -0,0 +1,54 @@ +{ + "name": "fs-minipass", + "version": "3.0.3", + "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", + "snap": "tap", + "posttest": "npm run lint" + }, + "keywords": [], + "author": "GitHub Inc.", + "license": "ISC", + "repository": { + "type": "git", + "url": "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": "^7.0.3" + }, + "devDependencies": { + "@npmcli/eslint-config": "^4.0.1", + "@npmcli/template-oss": "4.18.0", + "mutate-fs": "^2.1.1", + "tap": "^16.3.2" + }, + "files": [ + "bin/", + "lib/" + ], + "tap": { + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.18.0", + "publish": "true" + } +} diff --git a/node_modules/npm/node_modules/glob/LICENSE b/node_modules/npm/node_modules/glob/LICENSE new file mode 100644 index 00000000..ec7df933 --- /dev/null +++ b/node_modules/npm/node_modules/glob/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2009-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/npm/node_modules/glob/README.md b/node_modules/npm/node_modules/glob/README.md new file mode 100644 index 00000000..023cd779 --- /dev/null +++ b/node_modules/npm/node_modules/glob/README.md @@ -0,0 +1,1265 @@ +# Glob + +Match files using the patterns the shell uses. + +The most correct and second fastest glob implementation in +JavaScript. (See **Comparison to Other JavaScript Glob +Implementations** at the bottom of this readme.) + +![a fun cartoon logo made of glob characters](https://github.com/isaacs/node-glob/raw/main/logo/glob.png) + +## Usage + +Install with npm + +``` +npm i glob +``` + +**Note** the npm package name is _not_ `node-glob` that's a +different thing that was abandoned years ago. Just `glob`. + +```js +// load using import +import { glob, globSync, globStream, globStreamSync, Glob } from 'glob' +// or using commonjs, that's fine, too +const { + glob, + globSync, + globStream, + globStreamSync, + Glob, +} = require('glob') + +// the main glob() and globSync() resolve/return array of filenames + +// all js files, but don't look in node_modules +const jsfiles = await glob('**/*.js', { ignore: 'node_modules/**' }) + +// pass in a signal to cancel the glob walk +const stopAfter100ms = await glob('**/*.css', { + signal: AbortSignal.timeout(100), +}) + +// multiple patterns supported as well +const images = await glob(['css/*.{png,jpeg}', 'public/*.{png,jpeg}']) + +// but of course you can do that with the glob pattern also +// the sync function is the same, just returns a string[] instead +// of Promise +const imagesAlt = globSync('{css,public}/*.{png,jpeg}') + +// you can also stream them, this is a Minipass stream +const filesStream = globStream(['**/*.dat', 'logs/**/*.log']) + +// construct a Glob object if you wanna do it that way, which +// allows for much faster walks if you have to look in the same +// folder multiple times. +const g = new Glob('**/foo', {}) +// glob objects are async iterators, can also do globIterate() or +// g.iterate(), same deal +for await (const file of g) { + console.log('found a foo file:', file) +} +// pass a glob as the glob options to reuse its settings and caches +const g2 = new Glob('**/bar', g) +// sync iteration works as well +for (const file of g2) { + console.log('found a bar file:', file) +} + +// you can also pass withFileTypes: true to get Path objects +// these are like a Dirent, but with some more added powers +// check out http://npm.im/path-scurry for more info on their API +const g3 = new Glob('**/baz/**', { withFileTypes: true }) +g3.stream().on('data', path => { + console.log( + 'got a path object', + path.fullpath(), + path.isDirectory(), + path.readdirSync().map(e => e.name), + ) +}) + +// if you use stat:true and withFileTypes, you can sort results +// by things like modified time, filter by permission mode, etc. +// All Stats fields will be available in that case. Slightly +// slower, though. +// For example: +const results = await glob('**', { stat: true, withFileTypes: true }) + +const timeSortedFiles = results + .sort((a, b) => a.mtimeMs - b.mtimeMs) + .map(path => path.fullpath()) + +const groupReadableFiles = results + .filter(path => path.mode & 0o040) + .map(path => path.fullpath()) + +// custom ignores can be done like this, for example by saying +// you'll ignore all markdown files, and all folders named 'docs' +const customIgnoreResults = await glob('**', { + ignore: { + ignored: p => /\.md$/.test(p.name), + childrenIgnored: p => p.isNamed('docs'), + }, +}) + +// another fun use case, only return files with the same name as +// their parent folder, plus either `.ts` or `.js` +const folderNamedModules = await glob('**/*.{ts,js}', { + ignore: { + ignored: p => { + const pp = p.parent + return !(p.isNamed(pp.name + '.ts') || p.isNamed(pp.name + '.js')) + }, + }, +}) + +// find all files edited in the last hour, to do this, we ignore +// all of them that are more than an hour old +const newFiles = await glob('**', { + // need stat so we have mtime + stat: true, + // only want the files, not the dirs + nodir: true, + ignore: { + ignored: p => { + return new Date() - p.mtime > 60 * 60 * 1000 + }, + // could add similar childrenIgnored here as well, but + // directory mtime is inconsistent across platforms, so + // probably better not to, unless you know the system + // tracks this reliably. + }, +}) +``` + +**Note** Glob patterns should always use `/` as a path separator, +even on Windows systems, as `\` is used to escape glob +characters. If you wish to use `\` as a path separator _instead +of_ using it as an escape character on Windows platforms, you may +set `windowsPathsNoEscape:true` in the options. In this mode, +special glob characters cannot be escaped, making it impossible +to match a literal `*` `?` and so on in filenames. + +## Command Line Interface + +``` +$ glob -h + +Usage: + glob [options] [ [ ...]] + +Expand the positional glob expression arguments into any matching file system +paths found. + + -c --cmd= + Run the command provided, passing the glob expression + matches as arguments. + + -A --all 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. + + -a --absolute Expand to absolute paths + -d --dot-relative Prepend './' on relative matches + -m --mark Append a / on any directories matched + -x --posix 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'. + + -f --follow Follow symlinked directories when expanding '**' + -R --realpath 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. + + -s --stat Call 'fs.lstat' on all entries, whether required or not + to determine if it's a valid match. + + -b --match-base 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 Allow patterns to match files/directories that start + with '.', even if the pattern does not start with '.' + + --nobrace Do not expand {...} patterns + --nocase 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 Do not match directories, only files. + + Note: to *only* match directories, append a '/' at the + end of the pattern. + + --noext Do not expand extglob patterns, such as '+(a|b)' + --noglobstar Do not expand '**' against multiple path portions. Ie, + treat it as a normal '*' instead. + + --windows-path-no-escape + Use '\' as a path separator *only*, and *never* as an + escape character. If set, all '\' characters are + replaced with '/' in the pattern. + + -D --max-depth= Maximum depth to traverse from the current working + directory + + -C --cwd= Current working directory to execute/match in + -r --root= 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= Defaults to the value of 'process.platform' if + available, or 'linux' if not. Setting --platform=win32 + on non-Windows systems may cause strange behavior! + + -i --ignore= + Glob patterns to ignore Can be set multiple times + -v --debug Output a huge amount of noisy debug information about + patterns as they are parsed and used to match files. + + -h --help Show this usage information +``` + +## `glob(pattern: string | string[], options?: GlobOptions) => Promise` + +Perform an asynchronous glob search for the pattern(s) specified. +Returns +[Path](https://isaacs.github.io/path-scurry/classes/PathBase) +objects if the `withFileTypes` option is set to `true`. See below +for full options field desciptions. + +## `globSync(pattern: string | string[], options?: GlobOptions) => string[] | Path[]` + +Synchronous form of `glob()`. + +Alias: `glob.sync()` + +## `globIterate(pattern: string | string[], options?: GlobOptions) => AsyncGenerator` + +Return an async iterator for walking glob pattern matches. + +Alias: `glob.iterate()` + +## `globIterateSync(pattern: string | string[], options?: GlobOptions) => Generator` + +Return a sync iterator for walking glob pattern matches. + +Alias: `glob.iterate.sync()`, `glob.sync.iterate()` + +## `globStream(pattern: string | string[], options?: GlobOptions) => Minipass` + +Return a stream that emits all the strings or `Path` objects and +then emits `end` when completed. + +Alias: `glob.stream()` + +## `globStreamSync(pattern: string | string[], options?: GlobOptions) => Minipass` + +Syncronous form of `globStream()`. Will read all the matches as +fast as you consume them, even all in a single tick if you +consume them immediately, but will still respond to backpressure +if they're not consumed immediately. + +Alias: `glob.stream.sync()`, `glob.sync.stream()` + +## `hasMagic(pattern: string | string[], options?: GlobOptions) => boolean` + +Returns `true` if the provided pattern contains 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. + +## `escape(pattern: string, options?: GlobOptions) => string` + +Escape all magic characters in a glob pattern, so that it will +only ever match literal strings + +If the `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. + +Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot +be escaped or unescaped. + +## `unescape(pattern: string, options?: GlobOptions) => string` + +Un-escape a glob string that may contain some escaped characters. + +If the `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 `'*'`, because `\` 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. + +## Class `Glob` + +An object that can perform glob pattern traversals. + +### `const g = new Glob(pattern: string | string[], options: GlobOptions)` + +Options object is required. + +See full options descriptions below. + +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. + +### `g.stream()` + +Stream results asynchronously, + +### `g.streamSync()` + +Stream results synchronously. + +### `g.iterate()` + +Default async iteration function. Returns an AsyncGenerator that +iterates over the results. + +### `g.iterateSync()` + +Default sync iteration function. Returns a Generator that +iterates over the results. + +### `g.walk()` + +Returns a Promise that resolves to the results array. + +### `g.walkSync()` + +Returns a results array. + +### Properties + +All options are stored as properties on the `Glob` object. + +- `opts` The options provided to the constructor. +- `patterns` An array of parsed immutable `Pattern` objects. + +## Options + +Exported as `GlobOptions` TypeScript interface. A `GlobOptions` +object may be provided to any of the exported methods, and must +be provided to the `Glob` constructor. + +All options are optional, boolean, and false by default, unless +otherwise noted. + +All resolved options are added to the Glob object as properties. + +If you are running many `glob` operations, you can pass a Glob +object as the `options` argument to a subsequent operation to +share the previously loaded cache. + +- `cwd` String path or `file://` string or URL object. The + current working directory in which to search. Defaults to + `process.cwd()`. See also: "Windows, CWDs, Drive Letters, and + UNC Paths", below. + + This option may be either a string path or a `file://` URL + object or string. + +- `root` A string path resolved against the `cwd` option, 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 be matched in the `cwd`. For example, the + pattern `/../*` with `{root:'/some/path'}` will return all + files in `/some`, not all files in `/some/path`. The pattern + `*` with `{root:'/some/path'}` will return all the entries in + the cwd, not the entries in `/some/path`. + + To start absolute and non-absolute patterns in the same + path, you can use `{root:''}`. 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. + +- `windowsPathsNoEscape` Use `\\` as a path separator _only_, and + _never_ as an escape character. If set, all `\\` characters are + replaced with `/` in the pattern. + + Note that this makes it **impossible** to match against paths + containing literal glob pattern characters, but allows matching + with patterns constructed using `path.join()` and + `path.resolve()` on Windows platforms, mimicking the (buggy!) + behavior of Glob v7 and before on Windows. Please use with + caution, and be mindful of [the caveat below about Windows + paths](#windows). (For legacy reasons, this is also set if + `allowWindowsEscape` is set to the exact value `false`.) + +- `dot` Include `.dot` files in normal matches and `globstar` + matches. Note that an explicit dot in a portion of the pattern + will always match dot files. + +- `magicalBraces` Treat brace expansion like `{a,b}` as a "magic" + pattern. Has no effect if {@link nobrace} is set. + + Only has effect on the {@link hasMagic} function, no effect on + glob pattern matching itself. + +- `dotRelative` Prepend all relative path strings with `./` (or + `.\` on Windows). + + Without this option, returned relative paths are "bare", so + instead of returning `'./foo/bar'`, they are returned as + `'foo/bar'`. + + Relative patterns starting with `'../'` are not prepended with + `./`, even if this option is set. + +- `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. + +- `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. + +- `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) + +- `noext` Do not match "extglob" patterns such as `+(a|b)`. + +- `nocase` Perform a case-insensitive match. This defaults to + `true` on macOS and Windows systems, 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-sensitive file + systems, or `false` on case-insensitive file systems, then the + walk may return more or less results than expected. + +- `maxDepth` Specify a number to limit the depth of the directory + traversal to this many levels below the `cwd`. + +- `matchBase` 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 all js files in + all directories. + +- `nodir` Do not match directories, only files. (Note: to match + _only_ directories, put a `/` at the end of the pattern.) + + Note: when `follow` and `nodir` are both set, then symbolic + links to directories are also omitted. + +- `stat` Call `lstat()` on all entries, whether required or not + to determine whether it's a valid match. When used with + `withFileTypes`, this means that matches will include data such + as modified time, permissions, and so on. Note that this will + incur a performance cost due to the added system calls. + +- `ignore` string or string[], or an object with `ignore` and + `ignoreChildren` methods. + + If a string or string[] is provided, then this is treated as a + glob pattern or array of glob patterns to exclude from matches. + To ignore all children within a directory, as well as the entry + itself, append `'/**'` to the ignore pattern. + + **Note** `ignore` patterns are _always_ in `dot:true` mode, + regardless of any other settings. + + If an object is provided that has `ignored(path)` and/or + `childrenIgnored(path)` methods, then these methods will be + called to determine whether any Path is a match or if its + children should be traversed, respectively. + +- `follow` Follow symlinked directories when expanding `**` + patterns. This can result in a lot of duplicate references in + the presence of cyclic links, and make performance quite bad. + + By default, a `**` in a pattern will follow 1 symbolic link if + it is not the first item in the pattern, or none if it is the + first item in the pattern, following the same behavior as Bash. + + Note: when `follow` and `nodir` are both set, then symbolic + links to directories are also omitted. + +- `realpath` Set to true to 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. + +- `absolute` Set to true to always receive absolute paths for + matched files. Set to `false` to always receive relative paths + for matched files. + + By default, when this option is not set, absolute paths are + returned for patterns that are absolute, and otherwise paths + are returned that are relative to the `cwd` setting. + + This does _not_ make an extra system call to get the realpath, + it only does string path resolution. + + `absolute` may not be used along with `withFileTypes`. + +- `posix` Set to true to use `/` as the path separator in + returned results. On posix systems, this has no effect. On + Windows systems, this will return `/` delimited path results, + and absolute paths will be returned in their full resolved UNC + path form, eg insted of `'C:\\foo\\bar'`, it will return + `//?/C:/foo/bar`. + +- `platform` Defaults to value of `process.platform` if + available, or `'linux'` if not. Setting `platform:'win32'` on + non-Windows systems may cause strange behavior. + +- `withFileTypes` Return [PathScurry](http://npm.im/path-scurry) + `Path` objects instead of strings. These are similar to a + NodeJS `Dirent` object, but with additional methods and + properties. + + `withFileTypes` may not be used along with `absolute`. + +- `signal` An AbortSignal which will cancel the Glob walk when + triggered. + +- `fs` An override object to pass in custom filesystem methods. + See [PathScurry docs](http://npm.im/path-scurry) for what can + be overridden. + +- `scurry` A [PathScurry](http://npm.im/path-scurry) object used + to traverse the file system. If the `nocase` option is set + explicitly, then any provided `scurry` object must match this + setting. + +- `includeChildMatches` boolean, default `true`. Do not match any + children of any matches. For example, the pattern `**\/foo` + would match `a/foo`, but not `a/foo/b/foo` in this mode. + + This is especially useful for cases like "find all + `node_modules` folders, but not the ones in `node_modules`". + + In order to support this, the `Ignore` implementation must + support an `add(pattern: string)` method. If using the default + `Ignore` class, then this is fine, but if this is set to + `false`, and a custom `Ignore` is provided that does not have + an `add()` method, then it will throw an error. + + **Caveat** It _only_ ignores matches that would be a descendant + of a previous match, and only if that descendant is matched + _after_ the ancestor is encountered. Since the file system walk + happens in indeterminate order, it's possible that a match will + already be added before its ancestor, if multiple or braced + patterns are used. + + For example: + + ```js + const results = await glob( + [ + // likely to match first, since it's just a stat + 'a/b/c/d/e/f', + + // this pattern is more complicated! It must to various readdir() + // calls and test the results against a regular expression, and that + // is certainly going to take a little bit longer. + // + // So, later on, it encounters a match at 'a/b/c/d/e', but it's too + // late to ignore a/b/c/d/e/f, because it's already been emitted. + 'a/[bdf]/?/[a-z]/*', + ], + { includeChildMatches: false }, + ) + ``` + + It's best to only set this to `false` if you can be reasonably + sure that no components of the pattern will potentially match + one another's file system descendants, or if the occasional + included child entry will not cause problems. + +## Glob Primer + +Much more information about glob pattern expansion can be found +by running `man bash` and searching for `Pattern Matching`. + +"Globs" are the patterns you type when you do stuff like `ls +*.js` on the command line, or put `build/*` in a `.gitignore` +file. + +Before parsing the path part patterns, braced sections are +expanded into a set. Braced sections start with `{` and end with +`}`, with 2 or more comma-delimited sections within. Braced +sections may contain slash characters, so `a{/b/c,bcd}` would +expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in +a path portion. With the exception of `**`, none of these match +path separators (ie, `/` on all platforms, and `\` on Windows). + +- `*` Matches 0 or more characters in a single path portion. + When alone in a path portion, it must match at least 1 + character. If `dot:true` is not specified, then `*` will not + match against a `.` character at the start of a path portion. +- `?` Matches 1 character. If `dot:true` is not specified, then + `?` will not match against a `.` character at the start of a + path portion. +- `[...]` Matches a range of characters, similar to a RegExp + range. If the first character of the range is `!` or `^` then + it matches any character not in the range. If the first + character is `]`, then it will be considered the same as `\]`, + rather than the end of the character class. +- `!(pattern|pattern|pattern)` Matches anything that does not + match any of the patterns provided. May _not_ contain `/` + characters. Similar to `*`, if alone in a path portion, then + the path portion must have at least one character. +- `?(pattern|pattern|pattern)` Matches zero or one occurrence of + the patterns provided. May _not_ contain `/` characters. +- `+(pattern|pattern|pattern)` Matches one or more occurrences of + the patterns provided. May _not_ contain `/` characters. +- `*(a|b|c)` Matches zero or more occurrences of the patterns + provided. May _not_ contain `/` characters. +- `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided. May _not_ contain `/` characters. +- `**` If a "globstar" is alone in a path portion, then it + matches zero or more directories and subdirectories searching + for matches. It does not crawl symlinked directories, unless + `{follow:true}` is passed in the options object. A pattern + like `a/b/**` will only match `a/b` if it is a directory. + Follows 1 symbolic link if not the first item in the pattern, + or 0 if it is the first item, unless `follow:true` is set, in + which case it follows all symbolic links. + +`[:class:]` patterns are supported by this implementation, but +`[=c=]` and `[.symbol.]` style class patterns are not. + +### Dots + +If a file or directory path portion has a `.` as the first +character, then it will not match any glob pattern unless that +pattern's corresponding path part also has a `.` as its first +character. + +For example, the pattern `a/.*/c` would match the file at +`a/.b/c`. However the pattern `a/*/c` would not, because `*` does +not start with a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has +no slashes in it, then it will seek for any file anywhere in the +tree with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Empty Sets + +If no matching files are found, then an empty array is returned. +This differs from the shell, where the pattern itself is +returned. For example: + +```sh +$ echo a*s*d*f +a*s*d*f +``` + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a +worthwhile goal, some discrepancies exist between node-glob and +other implementations, and are intentional. + +The double-star character `**` is supported by default, unless +the `noglobstar` flag is set. This is supported in the manner of +bsdglob and bash 5, where `**` only has special significance if +it is the only thing in a path part. That is, `a/**/b` will match +`a/x/y/b`, but `a/**b` will not. + +Note that symlinked directories are not traversed as part of a +`**`, though their contents may match against subsequent portions +of the pattern. This prevents infinite loops and duplicates and +the like. You can force glob to traverse symlinks with `**` by +setting `{follow:true}` in the options. + +There is no equivalent of the `nonull` option. A pattern that +does not find any matches simply resolves to nothing. (An empty +array, immediately ended stream, etc.) + +If brace expansion is not disabled, then it is performed before +any other interpretation of the glob pattern. Thus, a pattern +like `+(a|{b),c)}`, which would not be valid in bash or zsh, is +expanded **first** into the set of `+(a|b)` and `+(a|c)`, and +those patterns are checked for validity. Since those two are +valid, matching proceeds. + +The character class patterns `[:class:]` (posix standard named +classes) style class patterns are supported and unicode-aware, +but `[=c=]` (locale-specific character collation weight), and +`[.symbol.]` (collating symbol), are not. + +### Repeated Slashes + +Unlike Bash and zsh, repeated `/` are always coalesced into a +single path separator. + +### Comments and Negation + +Previously, this module let you mark a pattern as a "comment" if +it started with a `#` character, or a "negated" pattern if it +started with a `!` character. + +These options were deprecated in version 5, and removed in +version 6. + +To specify things that should not match, use the `ignore` option. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only +`/` characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will +always be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto +the root setting using `path.join`. On windows, this will by +default result in `/foo/*` matching `C:\foo\bar.txt`. + +To automatically coerce all `\` characters to `/` in pattern +strings, **thus making it impossible to escape literal glob +characters**, you may set the `windowsPathsNoEscape` option to +`true`. + +### Windows, CWDs, Drive Letters, and UNC Paths + +On posix systems, when a pattern starts with `/`, any `cwd` +option is ignored, and the traversal starts at `/`, plus any +non-magic path portions specified in the pattern. + +On Windows systems, the behavior is similar, but the concept of +an "absolute path" is somewhat more involved. + +#### UNC Paths + +A UNC path may be used as the start of a pattern on Windows +platforms. For example, a pattern like: `//?/x:/*` will return +all file entries in the root of the `x:` drive. A pattern like +`//ComputerName/Share/*` will return all files in the associated +share. + +UNC path roots are always compared case insensitively. + +#### Drive Letters + +A pattern starting with a drive letter, like `c:/*`, will search +in that drive, regardless of any `cwd` option provided. + +If the pattern starts with `/`, and is not a UNC path, and there +is an explicit `cwd` option set with a drive letter, then the +drive letter in the `cwd` is used as the root of the directory +traversal. + +For example, `glob('/tmp', { cwd: 'c:/any/thing' })` will return +`['c:/tmp']` as the result. + +If an explicit `cwd` option is not provided, and the pattern +starts with `/`, then the traversal will run on the root of the +drive provided as the `cwd` option. (That is, it is the result of +`path.resolve('/')`.) + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race +conditions, since it relies on directory walking. + +As a result, it is possible that a file that exists when glob +looks for it may have been deleted or modified by the time it +returns the result. + +By design, this implementation caches all readdir calls that it +makes, in order to cut down on system overhead. However, this +also makes it even more susceptible to races, especially if the +cache object is reused between glob calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast +majority of operations, this is never a problem. + +### See Also: + +- `man sh` +- `man bash` [Pattern + Matching](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) +- `man 3 fnmatch` +- `man 5 gitignore` +- [minimatch documentation](https://github.com/isaacs/minimatch) + +## Glob Logo + +Glob's logo was created by [Tanya +Brassie](http://tanyabrassie.com/). Logo files can be found +[here](https://github.com/isaacs/node-glob/tree/master/logo). + +The logo is licensed under a [Creative Commons +Attribution-ShareAlike 4.0 International +License](https://creativecommons.org/licenses/by-sa/4.0/). + +## Contributing + +Any change to behavior (including bugfixes) must come with a +test. + +Patches that fail tests or reduce performance will be rejected. + +```sh +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# run the benchmarks +npm run bench + +# to profile javascript +npm run prof +``` + +## Comparison to Other JavaScript Glob Implementations + +**tl;dr** + +- If you want glob matching that is as faithful as possible to + Bash pattern expansion semantics, and as fast as possible + within that constraint, _use this module_. +- If you are reasonably sure that the patterns you will encounter + are relatively simple, and want the absolutely fastest glob + matcher out there, _use [fast-glob](http://npm.im/fast-glob)_. +- If you are reasonably sure that the patterns you will encounter + are relatively simple, and want the convenience of + automatically respecting `.gitignore` files, _use + [globby](http://npm.im/globby)_. + +There are some other glob matcher libraries on npm, but these +three are (in my opinion, as of 2023) the best. + +--- + +**full explanation** + +Every library reflects a set of opinions and priorities in the +trade-offs it makes. Other than this library, I can personally +recommend both [globby](http://npm.im/globby) and +[fast-glob](http://npm.im/fast-glob), though they differ in their +benefits and drawbacks. + +Both have very nice APIs and are reasonably fast. + +`fast-glob` is, as far as I am aware, the fastest glob +implementation in JavaScript today. However, there are many +cases where the choices that `fast-glob` makes in pursuit of +speed mean that its results differ from the results returned by +Bash and other sh-like shells, which may be surprising. + +In my testing, `fast-glob` is around 10-20% faster than this +module when walking over 200k files nested 4 directories +deep[1](#fn-webscale). However, there are some inconsistencies +with Bash matching behavior that this module does not suffer +from: + +- `**` only matches files, not directories +- `..` path portions are not handled unless they appear at the + start of the pattern +- `./!()` will not match any files that _start_ with + ``, even if they do not match ``. For + example, `!(9).txt` will not match `9999.txt`. +- Some brace patterns in the middle of a pattern will result in + failing to find certain matches. +- Extglob patterns are allowed to contain `/` characters. + +Globby exhibits all of the same pattern semantics as fast-glob, +(as it is a wrapper around fast-glob) and is slightly slower than +node-glob (by about 10-20% in the benchmark test set, or in other +words, anywhere from 20-50% slower than fast-glob). However, it +adds some API conveniences that may be worth the costs. + +- Support for `.gitignore` and other ignore files. +- Support for negated globs (ie, patterns starting with `!` + rather than using a separate `ignore` option). + +The priority of this module is "correctness" in the sense of +performing a glob pattern expansion as faithfully as possible to +the behavior of Bash and other sh-like shells, with as much speed +as possible. + +Note that prior versions of `node-glob` are _not_ on this list. +Former versions of this module are far too slow for any cases +where performance matters at all, and were designed with APIs +that are extremely dated by current JavaScript standards. + +--- + +[1]: In the cases where this module +returns results and `fast-glob` doesn't, it's even faster, of +course. + +![lumpy space princess saying 'oh my GLOB'](https://github.com/isaacs/node-glob/raw/main/oh-my-glob.gif) + +### Benchmark Results + +First number is time, smaller is better. + +Second number is the count of results returned. + +``` +--- pattern: '**' --- +~~ sync ~~ +node fast-glob sync 0m0.598s 200364 +node globby sync 0m0.765s 200364 +node current globSync mjs 0m0.683s 222656 +node current glob syncStream 0m0.649s 222656 +~~ async ~~ +node fast-glob async 0m0.350s 200364 +node globby async 0m0.509s 200364 +node current glob async mjs 0m0.463s 222656 +node current glob stream 0m0.411s 222656 + +--- pattern: '**/..' --- +~~ sync ~~ +node fast-glob sync 0m0.486s 0 +node globby sync 0m0.769s 200364 +node current globSync mjs 0m0.564s 2242 +node current glob syncStream 0m0.583s 2242 +~~ async ~~ +node fast-glob async 0m0.283s 0 +node globby async 0m0.512s 200364 +node current glob async mjs 0m0.299s 2242 +node current glob stream 0m0.312s 2242 + +--- pattern: './**/0/**/0/**/0/**/0/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.490s 10 +node globby sync 0m0.517s 10 +node current globSync mjs 0m0.540s 10 +node current glob syncStream 0m0.550s 10 +~~ async ~~ +node fast-glob async 0m0.290s 10 +node globby async 0m0.296s 10 +node current glob async mjs 0m0.278s 10 +node current glob stream 0m0.302s 10 + +--- pattern: './**/[01]/**/[12]/**/[23]/**/[45]/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.500s 160 +node globby sync 0m0.528s 160 +node current globSync mjs 0m0.556s 160 +node current glob syncStream 0m0.573s 160 +~~ async ~~ +node fast-glob async 0m0.283s 160 +node globby async 0m0.301s 160 +node current glob async mjs 0m0.306s 160 +node current glob stream 0m0.322s 160 + +--- pattern: './**/0/**/0/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.502s 5230 +node globby sync 0m0.527s 5230 +node current globSync mjs 0m0.544s 5230 +node current glob syncStream 0m0.557s 5230 +~~ async ~~ +node fast-glob async 0m0.285s 5230 +node globby async 0m0.305s 5230 +node current glob async mjs 0m0.304s 5230 +node current glob stream 0m0.310s 5230 + +--- pattern: '**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.580s 200023 +node globby sync 0m0.771s 200023 +node current globSync mjs 0m0.685s 200023 +node current glob syncStream 0m0.649s 200023 +~~ async ~~ +node fast-glob async 0m0.349s 200023 +node globby async 0m0.509s 200023 +node current glob async mjs 0m0.427s 200023 +node current glob stream 0m0.388s 200023 + +--- pattern: '{**/*.txt,**/?/**/*.txt,**/?/**/?/**/*.txt,**/?/**/?/**/?/**/*.txt,**/?/**/?/**/?/**/?/**/*.txt}' --- +~~ sync ~~ +node fast-glob sync 0m0.589s 200023 +node globby sync 0m0.771s 200023 +node current globSync mjs 0m0.716s 200023 +node current glob syncStream 0m0.684s 200023 +~~ async ~~ +node fast-glob async 0m0.351s 200023 +node globby async 0m0.518s 200023 +node current glob async mjs 0m0.462s 200023 +node current glob stream 0m0.468s 200023 + +--- pattern: '**/5555/0000/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.496s 1000 +node globby sync 0m0.519s 1000 +node current globSync mjs 0m0.539s 1000 +node current glob syncStream 0m0.567s 1000 +~~ async ~~ +node fast-glob async 0m0.285s 1000 +node globby async 0m0.299s 1000 +node current glob async mjs 0m0.305s 1000 +node current glob stream 0m0.301s 1000 + +--- pattern: './**/0/**/../[01]/**/0/../**/0/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.484s 0 +node globby sync 0m0.507s 0 +node current globSync mjs 0m0.577s 4880 +node current glob syncStream 0m0.586s 4880 +~~ async ~~ +node fast-glob async 0m0.280s 0 +node globby async 0m0.298s 0 +node current glob async mjs 0m0.327s 4880 +node current glob stream 0m0.324s 4880 + +--- pattern: '**/????/????/????/????/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.547s 100000 +node globby sync 0m0.673s 100000 +node current globSync mjs 0m0.626s 100000 +node current glob syncStream 0m0.618s 100000 +~~ async ~~ +node fast-glob async 0m0.315s 100000 +node globby async 0m0.414s 100000 +node current glob async mjs 0m0.366s 100000 +node current glob stream 0m0.345s 100000 + +--- pattern: './{**/?{/**/?{/**/?{/**/?,,,,},,,,},,,,},,,}/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.588s 100000 +node globby sync 0m0.670s 100000 +node current globSync mjs 0m0.717s 200023 +node current glob syncStream 0m0.687s 200023 +~~ async ~~ +node fast-glob async 0m0.343s 100000 +node globby async 0m0.418s 100000 +node current glob async mjs 0m0.519s 200023 +node current glob stream 0m0.451s 200023 + +--- pattern: '**/!(0|9).txt' --- +~~ sync ~~ +node fast-glob sync 0m0.573s 160023 +node globby sync 0m0.731s 160023 +node current globSync mjs 0m0.680s 180023 +node current glob syncStream 0m0.659s 180023 +~~ async ~~ +node fast-glob async 0m0.345s 160023 +node globby async 0m0.476s 160023 +node current glob async mjs 0m0.427s 180023 +node current glob stream 0m0.388s 180023 + +--- pattern: './{*/**/../{*/**/../{*/**/../{*/**/../{*/**,,,,},,,,},,,,},,,,},,,,}/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.483s 0 +node globby sync 0m0.512s 0 +node current globSync mjs 0m0.811s 200023 +node current glob syncStream 0m0.773s 200023 +~~ async ~~ +node fast-glob async 0m0.280s 0 +node globby async 0m0.299s 0 +node current glob async mjs 0m0.617s 200023 +node current glob stream 0m0.568s 200023 + +--- pattern: './*/**/../*/**/../*/**/../*/**/../*/**/../*/**/../*/**/../*/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.485s 0 +node globby sync 0m0.507s 0 +node current globSync mjs 0m0.759s 200023 +node current glob syncStream 0m0.740s 200023 +~~ async ~~ +node fast-glob async 0m0.281s 0 +node globby async 0m0.297s 0 +node current glob async mjs 0m0.544s 200023 +node current glob stream 0m0.464s 200023 + +--- pattern: './*/**/../*/**/../*/**/../*/**/../*/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.486s 0 +node globby sync 0m0.513s 0 +node current globSync mjs 0m0.734s 200023 +node current glob syncStream 0m0.696s 200023 +~~ async ~~ +node fast-glob async 0m0.286s 0 +node globby async 0m0.296s 0 +node current glob async mjs 0m0.506s 200023 +node current glob stream 0m0.483s 200023 + +--- pattern: './0/**/../1/**/../2/**/../3/**/../4/**/../5/**/../6/**/../7/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.060s 0 +node globby sync 0m0.074s 0 +node current globSync mjs 0m0.067s 0 +node current glob syncStream 0m0.066s 0 +~~ async ~~ +node fast-glob async 0m0.060s 0 +node globby async 0m0.075s 0 +node current glob async mjs 0m0.066s 0 +node current glob stream 0m0.067s 0 + +--- pattern: './**/?/**/?/**/?/**/?/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.568s 100000 +node globby sync 0m0.651s 100000 +node current globSync mjs 0m0.619s 100000 +node current glob syncStream 0m0.617s 100000 +~~ async ~~ +node fast-glob async 0m0.332s 100000 +node globby async 0m0.409s 100000 +node current glob async mjs 0m0.372s 100000 +node current glob stream 0m0.351s 100000 + +--- pattern: '**/*/**/*/**/*/**/*/**' --- +~~ sync ~~ +node fast-glob sync 0m0.603s 200113 +node globby sync 0m0.798s 200113 +node current globSync mjs 0m0.730s 222137 +node current glob syncStream 0m0.693s 222137 +~~ async ~~ +node fast-glob async 0m0.356s 200113 +node globby async 0m0.525s 200113 +node current glob async mjs 0m0.508s 222137 +node current glob stream 0m0.455s 222137 + +--- pattern: './**/*/**/*/**/*/**/*/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.622s 200000 +node globby sync 0m0.792s 200000 +node current globSync mjs 0m0.722s 200000 +node current glob syncStream 0m0.695s 200000 +~~ async ~~ +node fast-glob async 0m0.369s 200000 +node globby async 0m0.527s 200000 +node current glob async mjs 0m0.502s 200000 +node current glob stream 0m0.481s 200000 + +--- pattern: '**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.588s 200023 +node globby sync 0m0.771s 200023 +node current globSync mjs 0m0.684s 200023 +node current glob syncStream 0m0.658s 200023 +~~ async ~~ +node fast-glob async 0m0.352s 200023 +node globby async 0m0.516s 200023 +node current glob async mjs 0m0.432s 200023 +node current glob stream 0m0.384s 200023 + +--- pattern: './**/**/**/**/**/**/**/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.589s 200023 +node globby sync 0m0.766s 200023 +node current globSync mjs 0m0.682s 200023 +node current glob syncStream 0m0.652s 200023 +~~ async ~~ +node fast-glob async 0m0.352s 200023 +node globby async 0m0.523s 200023 +node current glob async mjs 0m0.436s 200023 +node current glob stream 0m0.380s 200023 + +--- pattern: '**/*/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.592s 200023 +node globby sync 0m0.776s 200023 +node current globSync mjs 0m0.691s 200023 +node current glob syncStream 0m0.659s 200023 +~~ async ~~ +node fast-glob async 0m0.357s 200023 +node globby async 0m0.513s 200023 +node current glob async mjs 0m0.471s 200023 +node current glob stream 0m0.424s 200023 + +--- pattern: '**/*/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.585s 200023 +node globby sync 0m0.766s 200023 +node current globSync mjs 0m0.694s 200023 +node current glob syncStream 0m0.664s 200023 +~~ async ~~ +node fast-glob async 0m0.350s 200023 +node globby async 0m0.514s 200023 +node current glob async mjs 0m0.472s 200023 +node current glob stream 0m0.424s 200023 + +--- pattern: '**/[0-9]/**/*.txt' --- +~~ sync ~~ +node fast-glob sync 0m0.544s 100000 +node globby sync 0m0.636s 100000 +node current globSync mjs 0m0.626s 100000 +node current glob syncStream 0m0.621s 100000 +~~ async ~~ +node fast-glob async 0m0.322s 100000 +node globby async 0m0.404s 100000 +node current glob async mjs 0m0.360s 100000 +node current glob stream 0m0.352s 100000 +``` diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/glob.d.ts b/node_modules/npm/node_modules/glob/dist/commonjs/glob.d.ts new file mode 100644 index 00000000..25262b3d --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/glob.d.ts @@ -0,0 +1,388 @@ +import { Minimatch } from 'minimatch'; +import { Minipass } from 'minipass'; +import { FSOption, Path, PathScurry } from 'path-scurry'; +import { IgnoreLike } from './ignore.js'; +import { Pattern } from './pattern.js'; +export type MatchSet = Minimatch['set']; +export type GlobParts = Exclude; +/** + * A `GlobOptions` object may be provided to any of the exported methods, and + * must be provided to the `Glob` constructor. + * + * All options are optional, boolean, and false by default, unless otherwise + * noted. + * + * All resolved options are added to the Glob object as properties. + * + * If you are running many `glob` operations, you can pass a Glob object as the + * `options` argument to a subsequent operation to share the previously loaded + * cache. + */ +export interface GlobOptions { + /** + * Set to `true` to always receive absolute paths for + * matched files. Set to `false` to always return relative paths. + * + * When this option is not set, absolute paths are returned for patterns + * that are absolute, and otherwise paths are returned that are relative + * to the `cwd` setting. + * + * This does _not_ make an extra system call to get + * the realpath, it only does string path resolution. + * + * Conflicts with {@link withFileTypes} + */ + absolute?: boolean; + /** + * Set to false to enable {@link windowsPathsNoEscape} + * + * @deprecated + */ + allowWindowsEscape?: boolean; + /** + * The current working directory in which to search. Defaults to + * `process.cwd()`. + * + * May be eiher a string path or a `file://` URL object or string. + */ + cwd?: string | URL; + /** + * Include `.dot` files in normal matches and `globstar` + * matches. Note that an explicit dot in a portion of the pattern + * will always match dot files. + */ + dot?: boolean; + /** + * Prepend all relative path strings with `./` (or `.\` on Windows). + * + * Without this option, returned relative paths are "bare", so instead of + * returning `'./foo/bar'`, they are returned as `'foo/bar'`. + * + * Relative patterns starting with `'../'` are not prepended with `./`, even + * if this option is set. + */ + dotRelative?: boolean; + /** + * Follow symlinked directories when expanding `**` + * patterns. This can result in a lot of duplicate references in + * the presence of cyclic links, and make performance quite bad. + * + * By default, a `**` in a pattern will follow 1 symbolic link if + * it is not the first item in the pattern, or none if it is the + * first item in the pattern, following the same behavior as Bash. + */ + follow?: boolean; + /** + * string or string[], or an object with `ignore` and `ignoreChildren` + * methods. + * + * If a string or string[] is provided, then this is treated as a glob + * pattern or array of glob patterns to exclude from matches. To ignore all + * children within a directory, as well as the entry itself, append `'/**'` + * to the ignore pattern. + * + * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of + * any other settings. + * + * If an object is provided that has `ignored(path)` and/or + * `childrenIgnored(path)` methods, then these methods will be called to + * determine whether any Path is a match or if its children should be + * traversed, respectively. + */ + ignore?: string | string[] | IgnoreLike; + /** + * Treat brace expansion like `{a,b}` as a "magic" pattern. Has no + * effect if {@link nobrace} is set. + * + * Only has effect on the {@link hasMagic} function. + */ + magicalBraces?: boolean; + /** + * Add a `/` character to directory matches. Note that this requires + * additional stat calls in some cases. + */ + mark?: boolean; + /** + * 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 all js files in all directories. + */ + matchBase?: boolean; + /** + * Limit the directory traversal to a given depth below the cwd. + * Note that this does NOT prevent traversal to sibling folders, + * root patterns, and so on. It only limits the maximum folder depth + * that the walk will descend, relative to the cwd. + */ + maxDepth?: number; + /** + * Do not expand `{a,b}` and `{1..3}` brace sets. + */ + nobrace?: boolean; + /** + * Perform a case-insensitive match. This defaults to `true` on macOS and + * Windows systems, 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-sensitive file + * systems, or `false` on case-insensitive file systems, then the + * walk may return more or less results than expected. + */ + nocase?: boolean; + /** + * Do not match directories, only files. (Note: to match + * _only_ directories, put a `/` at the end of the pattern.) + */ + nodir?: boolean; + /** + * Do not match "extglob" patterns such as `+(a|b)`. + */ + noext?: boolean; + /** + * Do not match `**` against multiple filenames. (Ie, treat it as a normal + * `*` instead.) + * + * Conflicts with {@link matchBase} + */ + noglobstar?: boolean; + /** + * Defaults to value of `process.platform` if available, or `'linux'` if + * not. Setting `platform:'win32'` on non-Windows systems may cause strange + * behavior. + */ + platform?: NodeJS.Platform; + /** + * Set to true to 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. + */ + realpath?: boolean; + /** + * + * A string path resolved against the `cwd` option, 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 be matched in the `cwd`. For example, the + * pattern `/../*` with `{root:'/some/path'}` will return all + * files in `/some`, not all files in `/some/path`. The pattern + * `*` with `{root:'/some/path'}` will return all the entries in + * the cwd, not the entries in `/some/path`. + * + * To start absolute and non-absolute patterns in the same + * path, you can use `{root:''}`. 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. + */ + root?: string; + /** + * A [PathScurry](http://npm.im/path-scurry) object used + * to traverse the file system. If the `nocase` option is set + * explicitly, then any provided `scurry` object must match this + * setting. + */ + scurry?: PathScurry; + /** + * Call `lstat()` on all entries, whether required or not to determine + * if it's a valid match. When used with {@link withFileTypes}, this means + * that matches will include data such as modified time, permissions, and + * so on. Note that this will incur a performance cost due to the added + * system calls. + */ + stat?: boolean; + /** + * An AbortSignal which will cancel the Glob walk when + * triggered. + */ + signal?: AbortSignal; + /** + * Use `\\` as a path separator _only_, and + * _never_ as an escape character. If set, all `\\` characters are + * replaced with `/` in the pattern. + * + * Note that this makes it **impossible** to match against paths + * containing literal glob pattern characters, but allows matching + * with patterns constructed using `path.join()` and + * `path.resolve()` on Windows platforms, mimicking the (buggy!) + * behavior of Glob v7 and before on Windows. Please use with + * caution, and be mindful of [the caveat below about Windows + * paths](#windows). (For legacy reasons, this is also set if + * `allowWindowsEscape` is set to the exact value `false`.) + */ + windowsPathsNoEscape?: boolean; + /** + * Return [PathScurry](http://npm.im/path-scurry) + * `Path` objects instead of strings. These are similar to a + * NodeJS `Dirent` object, but with additional methods and + * properties. + * + * Conflicts with {@link absolute} + */ + withFileTypes?: boolean; + /** + * An fs implementation to override some or all of the defaults. See + * http://npm.im/path-scurry for details about what can be overridden. + */ + fs?: FSOption; + /** + * Just passed along to Minimatch. Note that this makes all pattern + * matching operations slower and *extremely* noisy. + */ + debug?: boolean; + /** + * Return `/` delimited paths, even on Windows. + * + * On posix systems, this has no effect. But, on Windows, it means that + * paths will be `/` delimited, and absolute paths will be their full + * resolved UNC forms, eg instead of `'C:\\foo\\bar'`, it would return + * `'//?/C:/foo/bar'` + */ + posix?: boolean; + /** + * Do not match any children of any matches. For example, the pattern + * `**\/foo` would match `a/foo`, but not `a/foo/b/foo` in this mode. + * + * This is especially useful for cases like "find all `node_modules` + * folders, but not the ones in `node_modules`". + * + * In order to support this, the `Ignore` implementation must support an + * `add(pattern: string)` method. If using the default `Ignore` class, then + * this is fine, but if this is set to `false`, and a custom `Ignore` is + * provided that does not have an `add()` method, then it will throw an + * error. + * + * **Caveat** It *only* ignores matches that would be a descendant of a + * previous match, and only if that descendant is matched *after* the + * ancestor is encountered. Since the file system walk happens in + * indeterminate order, it's possible that a match will already be added + * before its ancestor, if multiple or braced patterns are used. + * + * For example: + * + * ```ts + * const results = await glob([ + * // likely to match first, since it's just a stat + * 'a/b/c/d/e/f', + * + * // this pattern is more complicated! It must to various readdir() + * // calls and test the results against a regular expression, and that + * // is certainly going to take a little bit longer. + * // + * // So, later on, it encounters a match at 'a/b/c/d/e', but it's too + * // late to ignore a/b/c/d/e/f, because it's already been emitted. + * 'a/[bdf]/?/[a-z]/*', + * ], { includeChildMatches: false }) + * ``` + * + * It's best to only set this to `false` if you can be reasonably sure that + * no components of the pattern will potentially match one another's file + * system descendants, or if the occasional included child entry will not + * cause problems. + * + * @default true + */ + includeChildMatches?: boolean; +} +export type GlobOptionsWithFileTypesTrue = GlobOptions & { + withFileTypes: true; + absolute?: undefined; + mark?: undefined; + posix?: undefined; +}; +export type GlobOptionsWithFileTypesFalse = GlobOptions & { + withFileTypes?: false; +}; +export type GlobOptionsWithFileTypesUnset = GlobOptions & { + withFileTypes?: undefined; +}; +export type Result = Opts extends GlobOptionsWithFileTypesTrue ? Path : Opts extends GlobOptionsWithFileTypesFalse ? string : Opts extends GlobOptionsWithFileTypesUnset ? string : string | Path; +export type Results = Result[]; +export type FileTypes = Opts extends GlobOptionsWithFileTypesTrue ? true : Opts extends GlobOptionsWithFileTypesFalse ? false : Opts extends GlobOptionsWithFileTypesUnset ? false : boolean; +/** + * An object that can perform glob pattern traversals. + */ +export declare class Glob implements GlobOptions { + absolute?: boolean; + cwd: string; + root?: string; + dot: boolean; + dotRelative: boolean; + follow: boolean; + ignore?: string | string[] | IgnoreLike; + magicalBraces: boolean; + mark?: boolean; + matchBase: boolean; + maxDepth: number; + nobrace: boolean; + nocase: boolean; + nodir: boolean; + noext: boolean; + noglobstar: boolean; + pattern: string[]; + platform: NodeJS.Platform; + realpath: boolean; + scurry: PathScurry; + stat: boolean; + signal?: AbortSignal; + windowsPathsNoEscape: boolean; + withFileTypes: FileTypes; + includeChildMatches: boolean; + /** + * The options provided to the constructor. + */ + opts: Opts; + /** + * An array of parsed immutable {@link Pattern} objects. + */ + patterns: Pattern[]; + /** + * 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: string | string[], opts: Opts); + /** + * Returns a Promise that resolves to the results array. + */ + walk(): Promise>; + /** + * synchronous {@link Glob.walk} + */ + walkSync(): Results; + /** + * Stream results asynchronously. + */ + stream(): Minipass, Result>; + /** + * Stream results synchronously. + */ + streamSync(): Minipass, Result>; + /** + * Default sync iteration function. Returns a Generator that + * iterates over the results. + */ + iterateSync(): Generator, void, void>; + [Symbol.iterator](): Generator, void, void>; + /** + * Default async iteration function. Returns an AsyncGenerator that + * iterates over the results. + */ + iterate(): AsyncGenerator, void, void>; + [Symbol.asyncIterator](): AsyncGenerator, void, void>; +} +//# sourceMappingURL=glob.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/glob.d.ts.map b/node_modules/npm/node_modules/glob/dist/commonjs/glob.d.ts.map new file mode 100644 index 00000000..c32dc74c --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/glob.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,UAAU,EAIX,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;AACvC,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,CAAA;AAalE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAE5B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;IAElB;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,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AW,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAGlD,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIjB;;;OAGG;IACH,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAGnD,CAAC,MAAM,CAAC,aAAa,CAAC;CAGvB"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/glob.js b/node_modules/npm/node_modules/glob/dist/commonjs/glob.js new file mode 100644 index 00000000..e1339bbb --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/glob.js @@ -0,0 +1,247 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Glob = void 0; +const minimatch_1 = require("minimatch"); +const node_url_1 = require("node:url"); +const path_scurry_1 = require("path-scurry"); +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; + includeChildMatches; + /** + * 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, node_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.includeChildMatches = opts.includeChildMatches !== false; + 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) => { + const g = globParts[i]; + /* c8 ignore start */ + if (!g) + throw new Error('invalid pattern object'); + /* c8 ignore stop */ + return new pattern_js_1.Pattern(set, g, 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, + includeChildMatches: this.includeChildMatches, + }).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, + includeChildMatches: this.includeChildMatches, + }).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, + includeChildMatches: this.includeChildMatches, + }).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, + includeChildMatches: this.includeChildMatches, + }).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/npm/node_modules/glob/dist/commonjs/glob.js.map b/node_modules/npm/node_modules/glob/dist/commonjs/glob.js.map new file mode 100644 index 00000000..ddab4197 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/glob.js.map @@ -0,0 +1 @@ +{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":";;;AAAA,yCAAuD;AAEvD,uCAAwC;AACxC,6CAOoB;AAEpB,6CAAsC;AACtC,2CAAoD;AAKpD,4CAA4C;AAC5C,gDAAgD;AAChD,MAAM,eAAe,GACnB,CACE,OAAO,OAAO,KAAK,QAAQ;IAC3B,OAAO;IACP,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CACrC,CAAC,CAAC;IACD,OAAO,CAAC,QAAQ;IAClB,CAAC,CAAC,OAAO,CAAA;AAyVX;;GAEG;AACH,MAAa,IAAI;IACf,QAAQ,CAAU;IAClB,GAAG,CAAQ;IACX,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,WAAW,CAAS;IACpB,MAAM,CAAS;IACf,MAAM,CAAiC;IACvC,aAAa,CAAS;IACtB,IAAI,CAAU;IACd,SAAS,CAAS;IAClB,QAAQ,CAAQ;IAChB,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,KAA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AAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;SAC9C,CAAC,CAAC,UAAU,EAAE,CAAA;IACjB,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;IAC7C,CAAC;IACD,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;IAC9C,CAAC;IACD,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF;AA7QD,oBA6QC","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport { fileURLToPath } from 'node:url'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n (\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ) ?\n process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n\n /**\n * Do not match any children of any matches. For example, the pattern\n * `**\\/foo` would match `a/foo`, but not `a/foo/b/foo` in this mode.\n *\n * This is especially useful for cases like \"find all `node_modules`\n * folders, but not the ones in `node_modules`\".\n *\n * In order to support this, the `Ignore` implementation must support an\n * `add(pattern: string)` method. If using the default `Ignore` class, then\n * this is fine, but if this is set to `false`, and a custom `Ignore` is\n * provided that does not have an `add()` method, then it will throw an\n * error.\n *\n * **Caveat** It *only* ignores matches that would be a descendant of a\n * previous match, and only if that descendant is matched *after* the\n * ancestor is encountered. Since the file system walk happens in\n * indeterminate order, it's possible that a match will already be added\n * before its ancestor, if multiple or braced patterns are used.\n *\n * For example:\n *\n * ```ts\n * const results = await glob([\n * // likely to match first, since it's just a stat\n * 'a/b/c/d/e/f',\n *\n * // this pattern is more complicated! It must to various readdir()\n * // calls and test the results against a regular expression, and that\n * // is certainly going to take a little bit longer.\n * //\n * // So, later on, it encounters a match at 'a/b/c/d/e', but it's too\n * // late to ignore a/b/c/d/e/f, because it's already been emitted.\n * 'a/[bdf]/?/[a-z]/*',\n * ], { includeChildMatches: false })\n * ```\n *\n * It's best to only set this to `false` if you can be reasonably sure that\n * no components of the pattern will potentially match one another's file\n * system descendants, or if the occasional included child entry will not\n * cause problems.\n *\n * @default true\n */\n includeChildMatches?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result =\n Opts extends GlobOptionsWithFileTypesTrue ? Path\n : Opts extends GlobOptionsWithFileTypesFalse ? string\n : Opts extends GlobOptionsWithFileTypesUnset ? string\n : string | Path\nexport type Results = Result[]\n\nexport type FileTypes =\n Opts extends GlobOptionsWithFileTypesTrue ? true\n : Opts extends GlobOptionsWithFileTypesFalse ? false\n : Opts extends GlobOptionsWithFileTypesUnset ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes\n includeChildMatches: boolean\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n /* c8 ignore start */\n if (!opts) throw new TypeError('glob options required')\n /* c8 ignore stop */\n this.withFileTypes = !!opts.withFileTypes as FileTypes\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n this.includeChildMatches = opts.includeChildMatches !== false\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as { allowWindowsEscape?: boolean }).allowWindowsEscape ===\n false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32' ? PathScurryWin32\n : opts.platform === 'darwin' ? PathScurryDarwin\n : opts.platform ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n // If you do nocase:true on a case-sensitive file system, then\n // we need to use regexps instead of strings for non-magic\n // path portions, because statting `aBc` won't return results\n // for the file `AbC` for example.\n const nocaseMagicOnly =\n this.platform === 'darwin' || this.platform === 'win32'\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []],\n )\n this.patterns = matchSet.map((set, i) => {\n const g = globParts[i]\n /* c8 ignore start */\n if (!g) throw new Error('invalid pattern object')\n /* c8 ignore stop */\n return new Pattern(set, g, 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity ?\n this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n includeChildMatches: this.includeChildMatches,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity ?\n this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n includeChildMatches: this.includeChildMatches,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass, Result>\n stream(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity ?\n this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n includeChildMatches: this.includeChildMatches,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass, Result>\n streamSync(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity ?\n this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n includeChildMatches: this.includeChildMatches,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.d.ts b/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.d.ts new file mode 100644 index 00000000..8aec3bd9 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.d.ts @@ -0,0 +1,14 @@ +import { GlobOptions } from './glob.js'; +/** + * 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 declare const hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean; +//# sourceMappingURL=has-magic.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.d.ts.map b/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.d.ts.map new file mode 100644 index 00000000..b24dd4ec --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"has-magic.d.ts","sourceRoot":"","sources":["../../src/has-magic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,YACV,MAAM,GAAG,MAAM,EAAE,YACjB,WAAW,KACnB,OAQF,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.js b/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.js new file mode 100644 index 00000000..0918bd57 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.js @@ -0,0 +1,27 @@ +"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/npm/node_modules/glob/dist/commonjs/has-magic.js.map b/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.js.map new file mode 100644 index 00000000..44deab29 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/has-magic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"has-magic.js","sourceRoot":"","sources":["../../src/has-magic.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AAGrC;;;;;;;;;;GAUG;AACI,MAAM,QAAQ,GAAG,CACtB,OAA0B,EAC1B,UAAuB,EAAE,EAChB,EAAE;IACX,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,IAAI,qBAAS,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE;YAAE,OAAO,IAAI,CAAA;IACvD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAXY,QAAA,QAAQ,YAWpB","sourcesContent":["import { Minimatch } from 'minimatch'\nimport { GlobOptions } from './glob.js'\n\n/**\n * Return true if the patterns provided contain any magic glob characters,\n * given the options provided.\n *\n * Brace expansion is not considered \"magic\" unless the `magicalBraces` option\n * is set, as brace expansion just turns one string into an array of strings.\n * So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and\n * `'xby'` both do not contain any magic glob characters, and it's treated the\n * same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`\n * is in the options, brace expansion _is_ treated as a pattern having magic.\n */\nexport const hasMagic = (\n pattern: string | string[],\n options: GlobOptions = {},\n): boolean => {\n if (!Array.isArray(pattern)) {\n pattern = [pattern]\n }\n for (const p of pattern) {\n if (new Minimatch(p, options).hasMagic()) return true\n }\n return false\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/ignore.d.ts b/node_modules/npm/node_modules/glob/dist/commonjs/ignore.d.ts new file mode 100644 index 00000000..1893b16d --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/ignore.d.ts @@ -0,0 +1,24 @@ +import { Minimatch, MinimatchOptions } from 'minimatch'; +import { Path } from 'path-scurry'; +import { GlobWalkerOpts } from './walker.js'; +export interface IgnoreLike { + ignored?: (p: Path) => boolean; + childrenIgnored?: (p: Path) => boolean; + add?: (ignore: string) => void; +} +/** + * Class used to process ignored patterns + */ +export declare class Ignore implements IgnoreLike { + relative: Minimatch[]; + relativeChildren: Minimatch[]; + absolute: Minimatch[]; + absoluteChildren: Minimatch[]; + platform: NodeJS.Platform; + mmopts: MinimatchOptions; + constructor(ignored: string[], { nobrace, nocase, noext, noglobstar, platform, }: GlobWalkerOpts); + add(ign: string): void; + ignored(p: Path): boolean; + childrenIgnored(p: Path): boolean; +} +//# sourceMappingURL=ignore.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/ignore.d.ts.map b/node_modules/npm/node_modules/glob/dist/commonjs/ignore.d.ts.map new file mode 100644 index 00000000..57d6ab61 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/ignore.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../../src/ignore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAA;IAC9B,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAA;IACtC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B;AAWD;;GAEG;AACH,qBAAa,MAAO,YAAW,UAAU;IACvC,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,gBAAgB,EAAE,SAAS,EAAE,CAAA;IAC7B,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,gBAAgB,EAAE,SAAS,EAAE,CAAA;IAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAA;IACzB,MAAM,EAAE,gBAAgB,CAAA;gBAGtB,OAAO,EAAE,MAAM,EAAE,EACjB,EACE,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,QAA0B,GAC3B,EAAE,cAAc;IAqBnB,GAAG,CAAC,GAAG,EAAE,MAAM;IAyCf,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,OAAO;IAczB,eAAe,CAAC,CAAC,EAAE,IAAI,GAAG,OAAO;CAWlC"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/ignore.js b/node_modules/npm/node_modules/glob/dist/commonjs/ignore.js new file mode 100644 index 00000000..5f1fde06 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/ignore.js @@ -0,0 +1,119 @@ +"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; + platform; + mmopts; + constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform, }) { + this.relative = []; + this.absolute = []; + this.relativeChildren = []; + this.absoluteChildren = []; + this.platform = platform; + this.mmopts = { + dot: true, + nobrace, + nocase, + noext, + noglobstar, + optimizationLevel: 2, + platform, + nocomment: true, + nonegate: true, + }; + for (const ign of ignored) + this.add(ign); + } + add(ign) { + // 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. + const mm = new minimatch_1.Minimatch(ign, this.mmopts); + for (let i = 0; i < mm.set.length; i++) { + const parsed = mm.set[i]; + const globParts = mm.globParts[i]; + /* c8 ignore start */ + if (!parsed || !globParts) { + throw new Error('invalid pattern object'); + } + // strip off leading ./ portions + // https://github.com/isaacs/node-glob/issues/570 + while (parsed[0] === '.' && globParts[0] === '.') { + parsed.shift(); + globParts.shift(); + } + /* c8 ignore stop */ + const p = new pattern_js_1.Pattern(parsed, globParts, 0, this.platform); + const m = new minimatch_1.Minimatch(p.globString(), this.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)) + return true; + } + return false; + } +} +exports.Ignore = Ignore; +//# sourceMappingURL=ignore.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/ignore.js.map b/node_modules/npm/node_modules/glob/dist/commonjs/ignore.js.map new file mode 100644 index 00000000..d9dfdfa3 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/ignore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ignore.js","sourceRoot":"","sources":["../../src/ignore.ts"],"names":[],"mappings":";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gB,EAAE,CAAC;YACtC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;gBAAE,OAAO,IAAI,CAAA;QACpC,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAvGD,wBAuGC","sourcesContent":["// give it a pattern, and it'll be able to tell you if\n// a given path should be ignored.\n// Ignoring a path ignores its children if the pattern ends in /**\n// Ignores are always parsed in dot:true mode\n\nimport { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Path } from 'path-scurry'\nimport { Pattern } from './pattern.js'\nimport { GlobWalkerOpts } from './walker.js'\n\nexport interface IgnoreLike {\n ignored?: (p: Path) => boolean\n childrenIgnored?: (p: Path) => boolean\n add?: (ignore: string) => void\n}\n\nconst defaultPlatform: NodeJS.Platform =\n (\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ) ?\n process.platform\n : 'linux'\n\n/**\n * Class used to process ignored patterns\n */\nexport class Ignore implements IgnoreLike {\n relative: Minimatch[]\n relativeChildren: Minimatch[]\n absolute: Minimatch[]\n absoluteChildren: Minimatch[]\n platform: NodeJS.Platform\n mmopts: MinimatchOptions\n\n constructor(\n ignored: string[],\n {\n nobrace,\n nocase,\n noext,\n noglobstar,\n platform = defaultPlatform,\n }: GlobWalkerOpts,\n ) {\n this.relative = []\n this.absolute = []\n this.relativeChildren = []\n this.absoluteChildren = []\n this.platform = platform\n this.mmopts = {\n dot: true,\n nobrace,\n nocase,\n noext,\n noglobstar,\n optimizationLevel: 2,\n platform,\n nocomment: true,\n nonegate: true,\n }\n for (const ign of ignored) this.add(ign)\n }\n\n add(ign: string) {\n // this is a little weird, but it gives us a clean set of optimized\n // minimatch matchers, without getting tripped up if one of them\n // ends in /** inside a brace section, and it's only inefficient at\n // the start of the walk, not along it.\n // It'd be nice if the Pattern class just had a .test() method, but\n // handling globstars is a bit of a pita, and that code already lives\n // in minimatch anyway.\n // Another way would be if maybe Minimatch could take its set/globParts\n // as an option, and then we could at least just use Pattern to test\n // for absolute-ness.\n // Yet another way, Minimatch could take an array of glob strings, and\n // a cwd option, and do the right thing.\n const mm = new Minimatch(ign, this.mmopts)\n for (let i = 0; i < mm.set.length; i++) {\n const parsed = mm.set[i]\n const globParts = mm.globParts[i]\n /* c8 ignore start */\n if (!parsed || !globParts) {\n throw new Error('invalid pattern object')\n }\n // strip off leading ./ portions\n // https://github.com/isaacs/node-glob/issues/570\n while (parsed[0] === '.' && globParts[0] === '.') {\n parsed.shift()\n globParts.shift()\n }\n /* c8 ignore stop */\n const p = new Pattern(parsed, globParts, 0, this.platform)\n const m = new Minimatch(p.globString(), this.mmopts)\n const children = globParts[globParts.length - 1] === '**'\n const absolute = p.isAbsolute()\n if (absolute) this.absolute.push(m)\n else this.relative.push(m)\n if (children) {\n if (absolute) this.absoluteChildren.push(m)\n else this.relativeChildren.push(m)\n }\n }\n }\n\n ignored(p: Path): boolean {\n const fullpath = p.fullpath()\n const fullpaths = `${fullpath}/`\n const relative = p.relative() || '.'\n const relatives = `${relative}/`\n for (const m of this.relative) {\n if (m.match(relative) || m.match(relatives)) return true\n }\n for (const m of this.absolute) {\n if (m.match(fullpath) || m.match(fullpaths)) return true\n }\n return false\n }\n\n childrenIgnored(p: Path): boolean {\n const fullpath = p.fullpath() + '/'\n const relative = (p.relative() || '.') + '/'\n for (const m of this.relativeChildren) {\n if (m.match(relative)) return true\n }\n for (const m of this.absoluteChildren) {\n if (m.match(fullpath)) return true\n }\n return false\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/index.d.ts b/node_modules/npm/node_modules/glob/dist/commonjs/index.d.ts new file mode 100644 index 00000000..9c326ddc --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/index.d.ts @@ -0,0 +1,97 @@ +import { Minipass } from 'minipass'; +import { Path } from 'path-scurry'; +import type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset } from './glob.js'; +import { Glob } from './glob.js'; +export { escape, unescape } from 'minimatch'; +export type { FSOption, Path, WalkOptions, WalkOptionsWithFileTypesTrue, WalkOptionsWithFileTypesUnset, } from 'path-scurry'; +export { Glob } from './glob.js'; +export type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, } from './glob.js'; +export { hasMagic } from './has-magic.js'; +export { Ignore } from './ignore.js'; +export type { IgnoreLike } from './ignore.js'; +export type { MatchStream } from './walker.js'; +/** + * Syncronous form of {@link globStream}. Will read all the matches as fast as + * you consume them, even all in a single tick if you consume them immediately, + * but will still respond to backpressure if they're not consumed immediately. + */ +export declare function globStreamSync(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass; +export declare function globStreamSync(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass; +export declare function globStreamSync(pattern: string | string[], options: GlobOptionsWithFileTypesUnset): Minipass; +export declare function globStreamSync(pattern: string | string[], options: GlobOptions): Minipass | Minipass; +/** + * Return a stream that emits all the strings or `Path` objects and + * then emits `end` when completed. + */ +export declare function globStream(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass; +export declare function globStream(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass; +export declare function globStream(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): Minipass; +export declare function globStream(pattern: string | string[], options: GlobOptions): Minipass | Minipass; +/** + * Synchronous form of {@link glob} + */ +export declare function globSync(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): string[]; +export declare function globSync(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Path[]; +export declare function globSync(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): string[]; +export declare function globSync(pattern: string | string[], options: GlobOptions): Path[] | string[]; +/** + * Perform an asynchronous glob search for the pattern(s) specified. Returns + * [Path](https://isaacs.github.io/path-scurry/classes/PathBase) objects if the + * {@link withFileTypes} option is set to `true`. See {@link GlobOptions} for + * full option descriptions. + */ +declare function glob_(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): Promise; +declare function glob_(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Promise; +declare function glob_(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Promise; +declare function glob_(pattern: string | string[], options: GlobOptions): Promise; +/** + * Return a sync iterator for walking glob pattern matches. + */ +export declare function globIterateSync(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): Generator; +export declare function globIterateSync(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Generator; +export declare function globIterateSync(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Generator; +export declare function globIterateSync(pattern: string | string[], options: GlobOptions): Generator | Generator; +/** + * Return an async iterator for walking glob pattern matches. + */ +export declare function globIterate(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): AsyncGenerator; +export declare function globIterate(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): AsyncGenerator; +export declare function globIterate(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): AsyncGenerator; +export declare function globIterate(pattern: string | string[], options: GlobOptions): AsyncGenerator | AsyncGenerator; +export declare const streamSync: typeof globStreamSync; +export declare const stream: typeof globStream & { + sync: typeof globStreamSync; +}; +export declare const iterateSync: typeof globIterateSync; +export declare const iterate: typeof globIterate & { + sync: typeof globIterateSync; +}; +export declare const sync: typeof globSync & { + stream: typeof globStreamSync; + iterate: typeof globIterateSync; +}; +export declare const glob: typeof glob_ & { + glob: typeof glob_; + globSync: typeof globSync; + sync: typeof globSync & { + stream: typeof globStreamSync; + iterate: typeof globIterateSync; + }; + globStream: typeof globStream; + stream: typeof globStream & { + sync: typeof globStreamSync; + }; + globStreamSync: typeof globStreamSync; + streamSync: typeof globStreamSync; + globIterate: typeof globIterate; + iterate: typeof globIterate & { + sync: typeof globIterateSync; + }; + globIterateSync: typeof globIterateSync; + iterateSync: typeof globIterateSync; + Glob: typeof Glob; + hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean; + escape: (s: string, { windowsPathsNoEscape, }?: Pick) => string; + unescape: (s: string, { windowsPathsNoEscape, }?: Pick) => string; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/index.d.ts.map b/node_modules/npm/node_modules/glob/dist/commonjs/index.d.ts.map new file mode 100644 index 00000000..5fb32252 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,KAAK,EACV,WAAW,EACX,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC5C,YAAY,EACV,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,YAAY,EACV,WAAW,EACX,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,EAAE,4BAA4B,GACpC,QAAQ,CAAC,IAAI,E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AAC1C,eAAO,MAAM,OAAO;;CAElB,CAAA;AACF,eAAO,MAAM,IAAI;;;CAGf,CAAA;AAEF,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;CAgBf,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/index.js b/node_modules/npm/node_modules/glob/dist/commonjs/index.js new file mode 100644 index 00000000..151495d1 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/index.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.glob = exports.sync = exports.iterate = exports.iterateSync = exports.stream = exports.streamSync = exports.Ignore = exports.hasMagic = exports.Glob = exports.unescape = exports.escape = void 0; +exports.globStreamSync = globStreamSync; +exports.globStream = globStream; +exports.globSync = globSync; +exports.globIterateSync = globIterateSync; +exports.globIterate = globIterate; +const minimatch_1 = require("minimatch"); +const glob_js_1 = require("./glob.js"); +const has_magic_js_1 = require("./has-magic.js"); +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; } }); +var ignore_js_1 = require("./ignore.js"); +Object.defineProperty(exports, "Ignore", { enumerable: true, get: function () { return ignore_js_1.Ignore; } }); +function globStreamSync(pattern, options = {}) { + return new glob_js_1.Glob(pattern, options).streamSync(); +} +function globStream(pattern, options = {}) { + return new glob_js_1.Glob(pattern, options).stream(); +} +function globSync(pattern, options = {}) { + return new glob_js_1.Glob(pattern, options).walkSync(); +} +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(); +} +function globIterate(pattern, options = {}) { + return new glob_js_1.Glob(pattern, options).iterate(); +} +// 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, +}); +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/npm/node_modules/glob/dist/commonjs/index.js.map b/node_modules/npm/node_modules/glob/dist/commonjs/index.js.map new file mode 100644 index 00000000..e648b1d0 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAqDA,wCAKC;AAsBD,gCAKC;AAqBD,4BAKC;AAkDD,0CAKC;AAqBD,kCAKC;AAhMD,yCAA4C;AAS5C,uCAAgC;AAChC,iDAAyC;AAEzC,uCAA4C;AAAnC,mGAAA,MAAM,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAQzB,qCAAgC;AAAvB,+FAAA,IAAI,OAAA;AAOb,+CAAyC;AAAhC,wGAAA,QAAQ,OAAA;AACjB,yCAAoC;AAA3B,mGAAA,MAAM,OAAA;AAyBf,SAAgB,cAAc,CAC5B,OAA0B,EAC1B,UAAuB,EAAE;IAEzB,OAAO,IAAI,cAAI,CAAC,OAAO,EAAE,OAAO,CAAC,C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,MAAM,CAAC,KAAK,EAAE;IACvC,IAAI,EAAE,KAAK;IACX,QAAQ;IACR,IAAI,EAAJ,YAAI;IACJ,UAAU;IACV,MAAM,EAAN,cAAM;IACN,cAAc;IACd,UAAU,EAAV,kBAAU;IACV,WAAW;IACX,OAAO,EAAP,eAAO;IACP,eAAe;IACf,WAAW,EAAX,mBAAW;IACX,IAAI,EAAJ,cAAI;IACJ,QAAQ,EAAR,uBAAQ;IACR,MAAM,EAAN,kBAAM;IACN,QAAQ,EAAR,oBAAQ;CACT,CAAC,CAAA;AACF,YAAI,CAAC,IAAI,GAAG,YAAI,CAAA","sourcesContent":["import { escape, unescape } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport { Path } from 'path-scurry'\nimport type {\n GlobOptions,\n GlobOptionsWithFileTypesFalse,\n GlobOptionsWithFileTypesTrue,\n GlobOptionsWithFileTypesUnset,\n} from './glob.js'\nimport { Glob } from './glob.js'\nimport { hasMagic } from './has-magic.js'\n\nexport { escape, unescape } from 'minimatch'\nexport type {\n FSOption,\n Path,\n WalkOptions,\n WalkOptionsWithFileTypesTrue,\n WalkOptionsWithFileTypesUnset,\n} from 'path-scurry'\nexport { Glob } from './glob.js'\nexport type {\n GlobOptions,\n GlobOptionsWithFileTypesFalse,\n GlobOptionsWithFileTypesTrue,\n GlobOptionsWithFileTypesUnset,\n} from './glob.js'\nexport { hasMagic } from './has-magic.js'\nexport { Ignore } from './ignore.js'\nexport type { IgnoreLike } from './ignore.js'\nexport type { MatchStream } from './walker.js'\n\n/**\n * Syncronous form of {@link globStream}. Will read all the matches as fast as\n * you consume them, even all in a single tick if you consume them immediately,\n * but will still respond to backpressure if they're not consumed immediately.\n */\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): Minipass\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): Minipass\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesUnset,\n): Minipass\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptions,\n): Minipass | Minipass\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).streamSync()\n}\n\n/**\n * Return a stream that emits all the strings or `Path` objects and\n * then emits `end` when completed.\n */\nexport function globStream(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): Minipass\nexport function globStream(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): Minipass\nexport function globStream(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined,\n): Minipass\nexport function globStream(\n pattern: string | string[],\n options: GlobOptions,\n): Minipass | Minipass\nexport function globStream(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).stream()\n}\n\n/**\n * Synchronous form of {@link glob}\n */\nexport function globSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): string[]\nexport function globSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): Path[]\nexport function globSync(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined,\n): string[]\nexport function globSync(\n pattern: string | string[],\n options: GlobOptions,\n): Path[] | string[]\nexport function globSync(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).walkSync()\n}\n\n/**\n * Perform an asynchronous glob search for the pattern(s) specified. Returns\n * [Path](https://isaacs.github.io/path-scurry/classes/PathBase) objects if the\n * {@link withFileTypes} option is set to `true`. See {@link GlobOptions} for\n * full option descriptions.\n */\nasync function glob_(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined,\n): Promise\nasync function glob_(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): Promise\nasync function glob_(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): Promise\nasync function glob_(\n pattern: string | string[],\n options: GlobOptions,\n): Promise\nasync function glob_(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).walk()\n}\n\n/**\n * Return a sync iterator for walking glob pattern matches.\n */\nexport function globIterateSync(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined,\n): Generator\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): Generator\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): Generator\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptions,\n): Generator | Generator\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).iterateSync()\n}\n\n/**\n * Return an async iterator for walking glob pattern matches.\n */\nexport function globIterate(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined,\n): AsyncGenerator\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): AsyncGenerator\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): AsyncGenerator\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptions,\n): AsyncGenerator | AsyncGenerator\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).iterate()\n}\n\n// aliases: glob.sync.stream() glob.stream.sync() glob.sync() etc\nexport const streamSync = globStreamSync\nexport const stream = Object.assign(globStream, { sync: globStreamSync })\nexport const iterateSync = globIterateSync\nexport const iterate = Object.assign(globIterate, {\n sync: globIterateSync,\n})\nexport const sync = Object.assign(globSync, {\n stream: globStreamSync,\n iterate: globIterateSync,\n})\n\nexport const glob = Object.assign(glob_, {\n glob: glob_,\n globSync,\n sync,\n globStream,\n stream,\n globStreamSync,\n streamSync,\n globIterate,\n iterate,\n globIterateSync,\n iterateSync,\n Glob,\n hasMagic,\n escape,\n unescape,\n})\nglob.glob = glob\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/package.json b/node_modules/npm/node_modules/glob/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/pattern.d.ts b/node_modules/npm/node_modules/glob/dist/commonjs/pattern.d.ts new file mode 100644 index 00000000..9636df3b --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/pattern.d.ts @@ -0,0 +1,76 @@ +import { GLOBSTAR } from 'minimatch'; +export type MMPattern = string | RegExp | typeof GLOBSTAR; +export type PatternList = [p: MMPattern, ...rest: MMPattern[]]; +export type UNCPatternList = [ + p0: '', + p1: '', + p2: string, + p3: string, + ...rest: MMPattern[] +]; +export type DrivePatternList = [p0: string, ...rest: MMPattern[]]; +export type AbsolutePatternList = [p0: '', ...rest: MMPattern[]]; +export type GlobList = [p: string, ...rest: string[]]; +/** + * An immutable-ish view on an array of glob parts and their parsed + * results + */ +export declare class Pattern { + #private; + readonly length: number; + constructor(patternList: MMPattern[], globList: string[], index: number, platform: NodeJS.Platform); + /** + * The first entry in the parsed list of patterns + */ + pattern(): MMPattern; + /** + * true of if pattern() returns a string + */ + isString(): boolean; + /** + * true of if pattern() returns GLOBSTAR + */ + isGlobstar(): boolean; + /** + * true if pattern() returns a regexp + */ + isRegExp(): boolean; + /** + * The /-joined set of glob parts that make up this pattern + */ + globString(): string; + /** + * true if there are more pattern parts after this one + */ + hasMore(): boolean; + /** + * The rest of the pattern after this part, or null if this is the end + */ + rest(): Pattern | null; + /** + * true if the pattern represents a //unc/path/ on windows + */ + isUNC(): boolean; + /** + * True if the pattern starts with a drive letter on Windows + */ + isDrive(): boolean; + /** + * True if the pattern is rooted on an absolute path + */ + isAbsolute(): boolean; + /** + * consume the root of the pattern, and return it + */ + root(): string; + /** + * Check to see if the current globstar pattern is allowed to follow + * a symbolic link. + */ + checkFollowGlobstar(): boolean; + /** + * Mark that the current globstar pattern is following a symbolic link + */ + markFollowGlobstar(): boolean; +} +//# sourceMappingURL=pattern.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/pattern.d.ts.map b/node_modules/npm/node_modules/glob/dist/commonjs/pattern.d.ts.map new file mode 100644 index 00000000..cdf32234 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/pattern.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/pattern.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,QAAQ,CAAA;AAGzD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAC9D,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,GAAG,IAAI,EAAE,SAAS,EAAE;CACrB,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AACjE,MAAM,MAAM,mBAAmB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAChE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;AAMrD;;;GAGG;AACH,qBAAa,OAAO;;IAIlB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;gBAUrB,WAAW,EAAE,SAAS,EAAE,EACxB,QAAQ,EAAE,MAAM,EAAE,EAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;IA6D3B;;OAEG;IACH,OAAO,IAAI,SAAS;IAIpB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAGnB;;OAEG;IACH,UAAU,IAAI,OAAO;IAGrB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,UAAU,IAAI,MAAM;IAUpB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,IAAI,IAAI,OAAO,GAAG,IAAI;IAetB;;OAEG;IACH,KAAK,IAAI,OAAO;IAoBhB;;OAEG;IACH,OAAO,IAAI,OAAO;IAelB;;OAEG;IACH,UAAU,IAAI,OAAO;IAUrB;;OAEG;IACH,IAAI,IAAI,MAAM;IASd;;;OAGG;IACH,mBAAmB,IAAI,OAAO;IAQ9B;;OAEG;IACH,kBAAkB,IAAI,OAAO;CAM9B"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/pattern.js b/node_modules/npm/node_modules/glob/dist/commonjs/pattern.js new file mode 100644 index 00000000..f0de35fb --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/pattern.js @@ -0,0 +1,219 @@ +"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/npm/node_modules/glob/dist/commonjs/pattern.js.map b/node_modules/npm/node_modules/glob/dist/commonjs/pattern.js.map new file mode 100644 index 00000000..fc10ea5d --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/pattern.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../src/pattern.ts"],"names":[],"mappings":";AAAA,yEAAyE;;;AAEzE,yCAAoC;AAgBpC,MAAM,aAAa,GAAG,CAAC,EAAe,EAAqB,EAAE,CAC3D,EAAE,CAAC,MAAM,IAAI,CAAC,CAAA;AAChB,MAAM,UAAU,GAAG,CAAC,EAAY,EAAkB,EAAE,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,CAAA;AAEnE;;;GAGG;AACH,MAAa,OAAO;IACT,YAAY,CAAa;IACzB,SAAS,CAAU;IACnB,MAAM,CAAQ;IACd,MAAM,CAAQ;IACd,SAAS,CAAiB;IACnC,KAAK,CAAiB;IACtB,WAAW,CAAS;IACpB,QAAQ,CAAU;IAClB,MAAM,CAAU;IAChB,WAAW,CAAU;IACrB,eAAe,GAAY,IAAI,CAAA;IAE/B,YACE,WAAwB,EACxB,QAAkB,EAClB,KAAa,EACb,QAAyB;QAEzB,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,SAAS,CAAC,oBAAoB,CAAC,CAAA;QAC3C,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;QACxC,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,EAAE,CAAC;YAC3C,MAAM,IAAI,SAAS,CAAC,+CAA+C,CAAC,CAAA;QACtE,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAA;QAChC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,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,UAAU;QACR,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,CAAA;QAC5B,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC;YACnC,IAAI,CAAC,WAAW;YAClB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW;gBACf,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;oBAC/B,IAAI,CAAC,OAAO,EAAE;oBACd,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,IAAI;QACF,MAAM,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;QAC9B,OAAO,CACH,OAAO,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAChE,CAAC,CAAC;YACD,CAAC;YACH,CAAC,CAAC,EAAE,CAAA;IACR,CAAC;IAED;;;OAGG;IACH,mBAAmB;QACjB,OAAO,CAAC,CACN,IAAI,CAAC,MAAM,KAAK,CAAC;YACjB,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,CAAC,IAAI,CAAC,eAAe,CACtB,CAAA;IACH,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe;YAClE,OAAO,KAAK,CAAA;QACd,IAAI,CAAC,eAAe,GAAG,KAAK,CAAA;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AArOD,0BAqOC","sourcesContent":["// this is just a very light wrapper around 2 arrays with an offset index\n\nimport { GLOBSTAR } from 'minimatch'\nexport type MMPattern = string | RegExp | typeof GLOBSTAR\n\n// an array of length >= 1\nexport type PatternList = [p: MMPattern, ...rest: MMPattern[]]\nexport type UNCPatternList = [\n p0: '',\n p1: '',\n p2: string,\n p3: string,\n ...rest: MMPattern[],\n]\nexport type DrivePatternList = [p0: string, ...rest: MMPattern[]]\nexport type AbsolutePatternList = [p0: '', ...rest: MMPattern[]]\nexport type GlobList = [p: string, ...rest: string[]]\n\nconst isPatternList = (pl: MMPattern[]): pl is PatternList =>\n pl.length >= 1\nconst isGlobList = (gl: string[]): gl is GlobList => gl.length >= 1\n\n/**\n * An immutable-ish view on an array of glob parts and their parsed\n * results\n */\nexport class Pattern {\n readonly #patternList: PatternList\n readonly #globList: GlobList\n readonly #index: number\n readonly length: number\n readonly #platform: NodeJS.Platform\n #rest?: Pattern | null\n #globString?: string\n #isDrive?: boolean\n #isUNC?: boolean\n #isAbsolute?: boolean\n #followGlobstar: boolean = true\n\n constructor(\n patternList: MMPattern[],\n globList: string[],\n index: number,\n platform: NodeJS.Platform,\n ) {\n if (!isPatternList(patternList)) {\n throw new TypeError('empty pattern list')\n }\n if (!isGlobList(globList)) {\n throw new TypeError('empty glob list')\n }\n if (globList.length !== patternList.length) {\n throw new TypeError('mismatched pattern list and glob list lengths')\n }\n this.length = patternList.length\n if (index < 0 || index >= this.length) {\n throw new TypeError('index out of range')\n }\n this.#patternList = patternList\n this.#globList = globList\n this.#index = index\n this.#platform = platform\n\n // normalize root entries of absolute patterns on initial creation.\n if (this.#index === 0) {\n // c: => ['c:/']\n // C:/ => ['C:/']\n // C:/x => ['C:/', 'x']\n // //host/share => ['//host/share/']\n // //host/share/ => ['//host/share/']\n // //host/share/x => ['//host/share/', 'x']\n // /etc => ['/', 'etc']\n // / => ['/']\n if (this.isUNC()) {\n // '' / '' / 'host' / 'share'\n const [p0, p1, p2, p3, ...prest] = this.#patternList\n const [g0, g1, g2, g3, ...grest] = this.#globList\n if (prest[0] === '') {\n // ends in /\n prest.shift()\n grest.shift()\n }\n const p = [p0, p1, p2, p3, ''].join('/')\n const g = [g0, g1, g2, g3, ''].join('/')\n this.#patternList = [p, ...prest]\n this.#globList = [g, ...grest]\n this.length = this.#patternList.length\n } else if (this.isDrive() || this.isAbsolute()) {\n const [p1, ...prest] = this.#patternList\n const [g1, ...grest] = this.#globList\n if (prest[0] === '') {\n // ends in /\n prest.shift()\n grest.shift()\n }\n const p = (p1 as string) + '/'\n const g = g1 + '/'\n this.#patternList = [p, ...prest]\n this.#globList = [g, ...grest]\n this.length = this.#patternList.length\n }\n }\n }\n\n /**\n * The first entry in the parsed list of patterns\n */\n pattern(): MMPattern {\n return this.#patternList[this.#index] as MMPattern\n }\n\n /**\n * true of if pattern() returns a string\n */\n isString(): boolean {\n return typeof this.#patternList[this.#index] === 'string'\n }\n /**\n * true of if pattern() returns GLOBSTAR\n */\n isGlobstar(): boolean {\n return this.#patternList[this.#index] === GLOBSTAR\n }\n /**\n * true if pattern() returns a regexp\n */\n isRegExp(): boolean {\n return this.#patternList[this.#index] instanceof RegExp\n }\n\n /**\n * The /-joined set of glob parts that make up this pattern\n */\n globString(): string {\n return (this.#globString =\n this.#globString ||\n (this.#index === 0 ?\n this.isAbsolute() ?\n this.#globList[0] + this.#globList.slice(1).join('/')\n : this.#globList.join('/')\n : this.#globList.slice(this.#index).join('/')))\n }\n\n /**\n * true if there are more pattern parts after this one\n */\n hasMore(): boolean {\n return this.length > this.#index + 1\n }\n\n /**\n * The rest of the pattern after this part, or null if this is the end\n */\n rest(): Pattern | null {\n if (this.#rest !== undefined) return this.#rest\n if (!this.hasMore()) return (this.#rest = null)\n this.#rest = new Pattern(\n this.#patternList,\n this.#globList,\n this.#index + 1,\n this.#platform,\n )\n this.#rest.#isAbsolute = this.#isAbsolute\n this.#rest.#isUNC = this.#isUNC\n this.#rest.#isDrive = this.#isDrive\n return this.#rest\n }\n\n /**\n * true if the pattern represents a //unc/path/ on windows\n */\n isUNC(): boolean {\n const pl = this.#patternList\n return this.#isUNC !== undefined ?\n this.#isUNC\n : (this.#isUNC =\n this.#platform === 'win32' &&\n this.#index === 0 &&\n pl[0] === '' &&\n pl[1] === '' &&\n typeof pl[2] === 'string' &&\n !!pl[2] &&\n typeof pl[3] === 'string' &&\n !!pl[3])\n }\n\n // pattern like C:/...\n // split = ['C:', ...]\n // XXX: would be nice to handle patterns like `c:*` to test the cwd\n // in c: for *, but I don't know of a way to even figure out what that\n // cwd is without actually chdir'ing into it?\n /**\n * True if the pattern starts with a drive letter on Windows\n */\n isDrive(): boolean {\n const pl = this.#patternList\n return this.#isDrive !== undefined ?\n this.#isDrive\n : (this.#isDrive =\n this.#platform === 'win32' &&\n this.#index === 0 &&\n this.length > 1 &&\n typeof pl[0] === 'string' &&\n /^[a-z]:$/i.test(pl[0]))\n }\n\n // pattern = '/' or '/...' or '/x/...'\n // split = ['', ''] or ['', ...] or ['', 'x', ...]\n // Drive and UNC both considered absolute on windows\n /**\n * True if the pattern is rooted on an absolute path\n */\n isAbsolute(): boolean {\n const pl = this.#patternList\n return this.#isAbsolute !== undefined ?\n this.#isAbsolute\n : (this.#isAbsolute =\n (pl[0] === '' && pl.length > 1) ||\n this.isDrive() ||\n this.isUNC())\n }\n\n /**\n * consume the root of the pattern, and return it\n */\n root(): string {\n const p = this.#patternList[0]\n return (\n typeof p === 'string' && this.isAbsolute() && this.#index === 0\n ) ?\n p\n : ''\n }\n\n /**\n * Check to see if the current globstar pattern is allowed to follow\n * a symbolic link.\n */\n checkFollowGlobstar(): boolean {\n return !(\n this.#index === 0 ||\n !this.isGlobstar() ||\n !this.#followGlobstar\n )\n }\n\n /**\n * Mark that the current globstar pattern is following a symbolic link\n */\n markFollowGlobstar(): boolean {\n if (this.#index === 0 || !this.isGlobstar() || !this.#followGlobstar)\n return false\n this.#followGlobstar = false\n return true\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/processor.d.ts b/node_modules/npm/node_modules/glob/dist/commonjs/processor.d.ts new file mode 100644 index 00000000..ccedfbf2 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/processor.d.ts @@ -0,0 +1,59 @@ +import { MMRegExp } from 'minimatch'; +import { Path } from 'path-scurry'; +import { Pattern } from './pattern.js'; +import { GlobWalkerOpts } from './walker.js'; +/** + * A cache of which patterns have been processed for a given Path + */ +export declare class HasWalkedCache { + store: Map>; + constructor(store?: Map>); + copy(): HasWalkedCache; + hasWalked(target: Path, pattern: Pattern): boolean | undefined; + storeWalked(target: Path, pattern: Pattern): void; +} +/** + * 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 declare class MatchRecord { + store: Map; + add(target: Path, absolute: boolean, ifDir: boolean): void; + entries(): [Path, boolean, boolean][]; +} +/** + * A collection of patterns that must be processed in a subsequent step + * for a given path. + */ +export declare class SubWalks { + store: Map; + add(target: Path, pattern: Pattern): void; + get(target: Path): Pattern[]; + entries(): [Path, Pattern[]][]; + keys(): Path[]; +} +/** + * 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 declare class Processor { + hasWalkedCache: HasWalkedCache; + matches: MatchRecord; + subwalks: SubWalks; + patterns?: Pattern[]; + follow: boolean; + dot: boolean; + opts: GlobWalkerOpts; + constructor(opts: GlobWalkerOpts, hasWalkedCache?: HasWalkedCache); + processPatterns(target: Path, patterns: Pattern[]): this; + subwalkTargets(): Path[]; + child(): Processor; + filterEntries(parent: Path, entries: Path[]): Processor; + testGlobstar(e: Path, pattern: Pattern, rest: Pattern | null, absolute: boolean): void; + testRegExp(e: Path, p: MMRegExp, rest: Pattern | null, absolute: boolean): void; + testString(e: Path, p: string, rest: Pattern | null, absolute: boolean): void; +} +//# sourceMappingURL=processor.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/processor.d.ts.map b/node_modules/npm/node_modules/glob/dist/commonjs/processor.d.ts.map new file mode 100644 index 00000000..aa266fee --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/processor.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../src/processor.ts"],"names":[],"mappings":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CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,EAAE,OAAO,CAAA;IACZ,IAAI,EAAE,cAAc,CAAA;gBAER,IAAI,EAAE,cAAc,EAAE,cAAc,CAAC,EAAE,cAAc;IAQjE,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE;IAmGjD,cAAc,IAAI,IAAI,EAAE;IAIxB,KAAK;IAQL,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS;IAqBvD,YAAY,CACV,CAAC,EAAE,IAAI,EACP,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,OAAO,GAAG,IAAI,EACpB,QAAQ,EAAE,OAAO;IA8CnB,UAAU,CACR,CAAC,EAAE,IAAI,EACP,CAAC,EAAE,QAAQ,EACX,IAAI,EAAE,OAAO,GAAG,IAAI,EACpB,QAAQ,EAAE,OAAO;IAUnB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO;CASvE"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/processor.js b/node_modules/npm/node_modules/glob/dist/commonjs/processor.js new file mode 100644 index 00000000..ee3bb439 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/processor.js @@ -0,0 +1,301 @@ +"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); + 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 not be final entry, otherwise we would have + // concatenated it earlier. + const ifDir = p === '..' || p === '' || p === '.'; + this.matches.add(t.resolve(p), absolute, ifDir); + 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/npm/node_modules/glob/dist/commonjs/processor.js.map b/node_modules/npm/node_modules/glob/dist/commonjs/processor.js.map new file mode 100644 index 00000000..58a70882 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/processor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"processor.js","sourceRoot":"","sources":["../../src/processor.ts"],"names":[],"mappings":";AAAA,qEAAqE;;;AAErE,yCAA8C;AAK9C;;GAEG;AACH,MAAa,cAAc;IACzB,KAAK,CAA0B;IAC/B,YAAY,QAAkC,IAAI,GAAG,EAAE;QACrD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IACD,IAAI;QACF,OAAO,IAAI,cAAc,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAChD,CAAC;IACD,SAAS,CAAC,MAAY,EAAE,OAAgB;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IACrE,CAAC;IACD,WAAW,CAAC,MAAY,EAAE,OAAgB;QACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACvC,IAAI,MAAM;YAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;;YACvC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAA;IAChE,CAAC;CACF;AAjBD,wCAiBC;AAED;;;;GAIG;AACH,MAAa,WAAW;IACtB,KAAK,GAAsB,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CACF;AA9ND,8BA8NC","sourcesContent":["// synchronous utility for filtering entries and calculating subwalks\n\nimport { GLOBSTAR, MMRegExp } from 'minimatch'\nimport { Path } from 'path-scurry'\nimport { MMPattern, Pattern } from './pattern.js'\nimport { GlobWalkerOpts } from './walker.js'\n\n/**\n * A cache of which patterns have been processed for a given Path\n */\nexport class HasWalkedCache {\n store: Map>\n constructor(store: Map> = new Map()) {\n this.store = store\n }\n copy() {\n return new HasWalkedCache(new Map(this.store))\n }\n hasWalked(target: Path, pattern: Pattern) {\n return this.store.get(target.fullpath())?.has(pattern.globString())\n }\n storeWalked(target: Path, pattern: Pattern) {\n const fullpath = target.fullpath()\n const cached = this.store.get(fullpath)\n if (cached) cached.add(pattern.globString())\n else this.store.set(fullpath, new Set([pattern.globString()]))\n }\n}\n\n/**\n * A record of which paths have been matched in a given walk step,\n * and whether they only are considered a match if they are a directory,\n * and whether their absolute or relative path should be returned.\n */\nexport class MatchRecord {\n store: Map = new Map()\n add(target: Path, absolute: boolean, ifDir: boolean) {\n const n = (absolute ? 2 : 0) | (ifDir ? 1 : 0)\n const current = this.store.get(target)\n this.store.set(target, current === undefined ? n : n & current)\n }\n // match, absolute, ifdir\n entries(): [Path, boolean, boolean][] {\n return [...this.store.entries()].map(([path, n]) => [\n path,\n !!(n & 2),\n !!(n & 1),\n ])\n }\n}\n\n/**\n * A collection of patterns that must be processed in a subsequent step\n * for a given path.\n */\nexport class SubWalks {\n store: Map = new Map()\n add(target: Path, pattern: Pattern) {\n if (!target.canReaddir()) {\n return\n }\n const subs = this.store.get(target)\n if (subs) {\n if (!subs.find(p => p.globString() === pattern.globString())) {\n subs.push(pattern)\n }\n } else this.store.set(target, [pattern])\n }\n get(target: Path): Pattern[] {\n const subs = this.store.get(target)\n /* c8 ignore start */\n if (!subs) {\n throw new Error('attempting to walk unknown path')\n }\n /* c8 ignore stop */\n return subs\n }\n entries(): [Path, Pattern[]][] {\n return this.keys().map(k => [k, this.store.get(k) as Pattern[]])\n }\n keys(): Path[] {\n return [...this.store.keys()].filter(t => t.canReaddir())\n }\n}\n\n/**\n * The class that processes patterns for a given path.\n *\n * Handles child entry filtering, and determining whether a path's\n * directory contents must be read.\n */\nexport class Processor {\n hasWalkedCache: HasWalkedCache\n matches = new MatchRecord()\n subwalks = new SubWalks()\n patterns?: Pattern[]\n follow: boolean\n dot: boolean\n opts: GlobWalkerOpts\n\n constructor(opts: GlobWalkerOpts, hasWalkedCache?: HasWalkedCache) {\n this.opts = opts\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.hasWalkedCache =\n hasWalkedCache ? hasWalkedCache.copy() : new HasWalkedCache()\n }\n\n processPatterns(target: Path, patterns: Pattern[]) {\n this.patterns = patterns\n const processingSet: [Path, Pattern][] = patterns.map(p => [target, p])\n\n // map of paths to the magic-starting subwalks they need to walk\n // first item in patterns is the filter\n\n for (let [t, pattern] of processingSet) {\n this.hasWalkedCache.storeWalked(t, pattern)\n\n const root = pattern.root()\n const absolute = pattern.isAbsolute() && this.opts.absolute !== false\n\n // start absolute patterns at root\n if (root) {\n t = t.resolve(\n root === '/' && this.opts.root !== undefined ?\n this.opts.root\n : root,\n )\n const rest = pattern.rest()\n if (!rest) {\n this.matches.add(t, true, false)\n continue\n } else {\n pattern = rest\n }\n }\n\n if (t.isENOENT()) continue\n\n let p: MMPattern\n let rest: Pattern | null\n let changed = false\n while (\n typeof (p = pattern.pattern()) === 'string' &&\n (rest = pattern.rest())\n ) {\n const c = t.resolve(p)\n t = c\n pattern = rest\n changed = true\n }\n p = pattern.pattern()\n rest = pattern.rest()\n if (changed) {\n if (this.hasWalkedCache.hasWalked(t, pattern)) continue\n this.hasWalkedCache.storeWalked(t, pattern)\n }\n\n // now we have either a final string for a known entry,\n // more strings for an unknown entry,\n // or a pattern starting with magic, mounted on t.\n if (typeof p === 'string') {\n // must not be final entry, otherwise we would have\n // concatenated it earlier.\n const ifDir = p === '..' || p === '' || p === '.'\n this.matches.add(t.resolve(p), absolute, ifDir)\n continue\n } else if (p === GLOBSTAR) {\n // if no rest, match and subwalk pattern\n // if rest, process rest and subwalk pattern\n // if it's a symlink, but we didn't get here by way of a\n // globstar match (meaning it's the first time THIS globstar\n // has traversed a symlink), then we follow it. Otherwise, stop.\n if (\n !t.isSymbolicLink() ||\n this.follow ||\n pattern.checkFollowGlobstar()\n ) {\n this.subwalks.add(t, pattern)\n }\n const rp = rest?.pattern()\n const rrest = rest?.rest()\n if (!rest || ((rp === '' || rp === '.') && !rrest)) {\n // only HAS to be a dir if it ends in **/ or **/.\n // but ending in ** will match files as well.\n this.matches.add(t, absolute, rp === '' || rp === '.')\n } else {\n if (rp === '..') {\n // this would mean you're matching **/.. at the fs root,\n // and no thanks, I'm not gonna test that specific case.\n /* c8 ignore start */\n const tp = t.parent || t\n /* c8 ignore stop */\n if (!rrest) this.matches.add(tp, absolute, true)\n else if (!this.hasWalkedCache.hasWalked(tp, rrest)) {\n this.subwalks.add(tp, rrest)\n }\n }\n }\n } else if (p instanceof RegExp) {\n this.subwalks.add(t, pattern)\n }\n }\n\n return this\n }\n\n subwalkTargets(): Path[] {\n return this.subwalks.keys()\n }\n\n child() {\n return new Processor(this.opts, this.hasWalkedCache)\n }\n\n // return a new Processor containing the subwalks for each\n // child entry, and a set of matches, and\n // a hasWalkedCache that's a copy of this one\n // then we're going to call\n filterEntries(parent: Path, entries: Path[]): Processor {\n const patterns = this.subwalks.get(parent)\n // put matches and entry walks into the results processor\n const results = this.child()\n for (const e of entries) {\n for (const pattern of patterns) {\n const absolute = pattern.isAbsolute()\n const p = pattern.pattern()\n const rest = pattern.rest()\n if (p === GLOBSTAR) {\n results.testGlobstar(e, pattern, rest, absolute)\n } else if (p instanceof RegExp) {\n results.testRegExp(e, p, rest, absolute)\n } else {\n results.testString(e, p, rest, absolute)\n }\n }\n }\n return results\n }\n\n testGlobstar(\n e: Path,\n pattern: Pattern,\n rest: Pattern | null,\n absolute: boolean,\n ) {\n if (this.dot || !e.name.startsWith('.')) {\n if (!pattern.hasMore()) {\n this.matches.add(e, absolute, false)\n }\n if (e.canReaddir()) {\n // if we're in follow mode or it's not a symlink, just keep\n // testing the same pattern. If there's more after the globstar,\n // then this symlink consumes the globstar. If not, then we can\n // follow at most ONE symlink along the way, so we mark it, which\n // also checks to ensure that it wasn't already marked.\n if (this.follow || !e.isSymbolicLink()) {\n this.subwalks.add(e, pattern)\n } else if (e.isSymbolicLink()) {\n if (rest && pattern.checkFollowGlobstar()) {\n this.subwalks.add(e, rest)\n } else if (pattern.markFollowGlobstar()) {\n this.subwalks.add(e, pattern)\n }\n }\n }\n }\n // if the NEXT thing matches this entry, then also add\n // the rest.\n if (rest) {\n const rp = rest.pattern()\n if (\n typeof rp === 'string' &&\n // dots and empty were handled already\n rp !== '..' &&\n rp !== '' &&\n rp !== '.'\n ) {\n this.testString(e, rp, rest.rest(), absolute)\n } else if (rp === '..') {\n /* c8 ignore start */\n const ep = e.parent || e\n /* c8 ignore stop */\n this.subwalks.add(ep, rest)\n } else if (rp instanceof RegExp) {\n this.testRegExp(e, rp, rest.rest(), absolute)\n }\n }\n }\n\n testRegExp(\n e: Path,\n p: MMRegExp,\n rest: Pattern | null,\n absolute: boolean,\n ) {\n if (!p.test(e.name)) return\n if (!rest) {\n this.matches.add(e, absolute, false)\n } else {\n this.subwalks.add(e, rest)\n }\n }\n\n testString(e: Path, p: string, rest: Pattern | null, absolute: boolean) {\n // should never happen?\n if (!e.isNamed(p)) return\n if (!rest) {\n this.matches.add(e, absolute, false)\n } else {\n this.subwalks.add(e, rest)\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/walker.d.ts b/node_modules/npm/node_modules/glob/dist/commonjs/walker.d.ts new file mode 100644 index 00000000..499c8f49 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/walker.d.ts @@ -0,0 +1,97 @@ +/** + * Single-use utility classes to provide functionality to the {@link Glob} + * methods. + * + * @module + */ +import { Minipass } from 'minipass'; +import { Path } from 'path-scurry'; +import { IgnoreLike } from './ignore.js'; +import { Pattern } from './pattern.js'; +import { Processor } from './processor.js'; +export interface GlobWalkerOpts { + absolute?: boolean; + allowWindowsEscape?: boolean; + cwd?: string | URL; + dot?: boolean; + dotRelative?: boolean; + follow?: boolean; + ignore?: string | string[] | IgnoreLike; + mark?: boolean; + matchBase?: boolean; + maxDepth?: number; + nobrace?: boolean; + nocase?: boolean; + nodir?: boolean; + noext?: boolean; + noglobstar?: boolean; + platform?: NodeJS.Platform; + posix?: boolean; + realpath?: boolean; + root?: string; + stat?: boolean; + signal?: AbortSignal; + windowsPathsNoEscape?: boolean; + withFileTypes?: boolean; + includeChildMatches?: boolean; +} +export type GWOFileTypesTrue = GlobWalkerOpts & { + withFileTypes: true; +}; +export type GWOFileTypesFalse = GlobWalkerOpts & { + withFileTypes: false; +}; +export type GWOFileTypesUnset = GlobWalkerOpts & { + withFileTypes?: undefined; +}; +export type Result = O extends GWOFileTypesTrue ? Path : O extends GWOFileTypesFalse ? string : O extends GWOFileTypesUnset ? string : Path | string; +export type Matches = O extends GWOFileTypesTrue ? Set : O extends GWOFileTypesFalse ? Set : O extends GWOFileTypesUnset ? Set : Set; +export type MatchStream = Minipass, Result>; +/** + * basic walking utilities that all the glob walker types use + */ +export declare abstract class GlobUtil { + #private; + path: Path; + patterns: Pattern[]; + opts: O; + seen: Set; + paused: boolean; + aborted: boolean; + signal?: AbortSignal; + maxDepth: number; + includeChildMatches: boolean; + constructor(patterns: Pattern[], path: Path, opts: O); + pause(): void; + resume(): void; + onResume(fn: () => any): void; + matchCheck(e: Path, ifDir: boolean): Promise; + matchCheckTest(e: Path | undefined, ifDir: boolean): Path | undefined; + matchCheckSync(e: Path, ifDir: boolean): Path | undefined; + abstract matchEmit(p: Result): void; + abstract matchEmit(p: string | Path): void; + matchFinish(e: Path, absolute: boolean): void; + match(e: Path, absolute: boolean, ifDir: boolean): Promise; + matchSync(e: Path, absolute: boolean, ifDir: boolean): void; + walkCB(target: Path, patterns: Pattern[], cb: () => any): void; + walkCB2(target: Path, patterns: Pattern[], processor: Processor, cb: () => any): any; + walkCB3(target: Path, entries: Path[], processor: Processor, cb: () => any): void; + walkCBSync(target: Path, patterns: Pattern[], cb: () => any): void; + walkCB2Sync(target: Path, patterns: Pattern[], processor: Processor, cb: () => any): any; + walkCB3Sync(target: Path, entries: Path[], processor: Processor, cb: () => any): void; +} +export declare class GlobWalker extends GlobUtil { + matches: Set>; + constructor(patterns: Pattern[], path: Path, opts: O); + matchEmit(e: Result): void; + walk(): Promise>>; + walkSync(): Set>; +} +export declare class GlobStream extends GlobUtil { + results: Minipass, Result>; + constructor(patterns: Pattern[], path: Path, opts: O); + matchEmit(e: Result): void; + stream(): MatchStream; + streamSync(): MatchStream; +} +//# sourceMappingURL=walker.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/walker.d.ts.map b/node_modules/npm/node_modules/glob/dist/commonjs/walker.d.ts.map new file mode 100644 index 00000000..769957bd --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/walker.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"walker.d.ts","sourceRoot":"","sources":["../../src/walker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAU,UAAU,EAAE,MAAM,aAAa,CAAA;AAOhD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;IAClB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,WAAW,CAAC,EAAE,OAAO,CAAA;IAC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AI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAIpD,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI;IAIvB,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAiBrC,QAAQ,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAW3B;AAED,qBAAa,UAAU,CACrB,CAAC,SAAS,cAAc,GAAG,cAAc,CACzC,SAAQ,QAAQ,CAAC,CAAC,CAAC;IACnB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;gBAE3B,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAUpD,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI;IAK7B,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC;IAYxB,UAAU,IAAI,WAAW,CAAC,CAAC,CAAC;CAO7B"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/commonjs/walker.js b/node_modules/npm/node_modules/glob/dist/commonjs/walker.js new file mode 100644 index 00000000..cb15946d --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/walker.js @@ -0,0 +1,387 @@ +"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; + includeChildMatches; + constructor(patterns, path, opts) { + this.patterns = patterns; + this.path = path; + this.opts = opts; + this.#sep = !opts.posix && opts.platform === 'win32' ? '\\' : '/'; + this.includeChildMatches = opts.includeChildMatches !== false; + if (opts.ignore || !this.includeChildMatches) { + this.#ignore = makeIgnore(opts.ignore ?? [], opts); + if (!this.includeChildMatches && + typeof this.#ignore.add !== 'function') { + const m = 'cannot ignore child matches, ignore lacks add() method.'; + throw new Error(m); + } + } + // 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; + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + /* c8 ignore start */ + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + /* c8 ignore stop */ + } + return this.matchCheckTest(s, ifDir); + } + matchCheckTest(e, ifDir) { + return (e && + (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && + (!ifDir || e.canReaddir()) && + (!this.opts.nodir || !e.isDirectory()) && + (!this.opts.nodir || + !this.opts.follow || + !e.isSymbolicLink() || + !e.realpathCached()?.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; + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); + } + matchFinish(e, absolute) { + if (this.#ignored(e)) + return; + // we know we have an ignore if this is false, but TS doesn't + if (!this.includeChildMatches && this.#ignore?.add) { + const ign = `${e.relativePosix()}/**`; + this.#ignore.add(ign); + } + 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 = new Set(); + constructor(patterns, path, opts) { + super(patterns, path, opts); + } + 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/npm/node_modules/glob/dist/commonjs/walker.js.map b/node_modules/npm/node_modules/glob/dist/commonjs/walker.js.map new file mode 100644 index 00000000..49b01386 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/commonjs/walker.js.map @@ -0,0 +1 @@ +{"version":3,"file":"walker.js","sourceRoot":"","sources":["../../src/walker.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,uCAAmC;AAEnC,2CAAgD;AAQhD,iDAA0C;AA0D1C,MAAM,UAAU,GAAG,CACjB,MAAsC,EACtC,IAAoB,EACR,EAAE,CACd,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,kBAAM,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC;IACvD,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,kBAAM,CAAC,MAAM,EAAE,IAAI,CAAC;QAClD,CAAC,CAAC,MAAM,CAAA;AAEV;;GAEG;AACH,MAAsB,QAAQ;IAC5B,IAAI,CAAM;IACV,QAAQ,CAAW;IACnB,IAAI,CAAG;IACP,IAAI,GAAc,IAAI,GAAG,EAAQ,CAAA;IACjC,MAAM,GAAY,KAAK,CAAA;IACvB,OAAO,GAAY,KAAK,CAAA;IACxB,SAAS,GAAkB,EAAE,CAAA;IAC7B,OAAO,CAAa;IACpB,IAAI,CAAY;IAChB,MAAM,CAAc;IACpB,QAAQ,CAAQ;IAChB,mBAAmB,CAAS;IAG5B,YAAY,QAAmB,EAAE,IAAU,EAAE,IAAO;QAClD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,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O,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,UAAU;QACR,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAA;QACvB,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QACnE,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AAvCD,gCAuCC","sourcesContent":["/**\n * Single-use utility classes to provide functionality to the {@link Glob}\n * methods.\n *\n * @module\n */\nimport { Minipass } from 'minipass'\nimport { Path } from 'path-scurry'\nimport { Ignore, IgnoreLike } from './ignore.js'\n\n// XXX can we somehow make it so that it NEVER processes a given path more than\n// once, enough that the match set tracking is no longer needed? that'd speed\n// things up a lot. Or maybe bring back nounique, and skip it in that case?\n\n// a single minimatch set entry with 1 or more parts\nimport { Pattern } from './pattern.js'\nimport { Processor } from './processor.js'\n\nexport interface GlobWalkerOpts {\n absolute?: boolean\n allowWindowsEscape?: boolean\n cwd?: string | URL\n dot?: boolean\n dotRelative?: boolean\n follow?: boolean\n ignore?: string | string[] | IgnoreLike\n mark?: boolean\n matchBase?: boolean\n // Note: maxDepth here means \"maximum actual Path.depth()\",\n // not \"maximum depth beyond cwd\"\n maxDepth?: number\n nobrace?: boolean\n nocase?: boolean\n nodir?: boolean\n noext?: boolean\n noglobstar?: boolean\n platform?: NodeJS.Platform\n posix?: boolean\n realpath?: boolean\n root?: string\n stat?: boolean\n signal?: AbortSignal\n windowsPathsNoEscape?: boolean\n withFileTypes?: boolean\n includeChildMatches?: boolean\n}\n\nexport type GWOFileTypesTrue = GlobWalkerOpts & {\n withFileTypes: true\n}\nexport type GWOFileTypesFalse = GlobWalkerOpts & {\n withFileTypes: false\n}\nexport type GWOFileTypesUnset = GlobWalkerOpts & {\n withFileTypes?: undefined\n}\n\nexport type Result =\n O extends GWOFileTypesTrue ? Path\n : O extends GWOFileTypesFalse ? string\n : O extends GWOFileTypesUnset ? string\n : Path | string\n\nexport type Matches =\n O extends GWOFileTypesTrue ? Set\n : O extends GWOFileTypesFalse ? Set\n : O extends GWOFileTypesUnset ? Set\n : Set\n\nexport type MatchStream = Minipass<\n Result,\n Result\n>\n\nconst makeIgnore = (\n ignore: string | string[] | IgnoreLike,\n opts: GlobWalkerOpts,\n): IgnoreLike =>\n typeof ignore === 'string' ? new Ignore([ignore], opts)\n : Array.isArray(ignore) ? new Ignore(ignore, opts)\n : ignore\n\n/**\n * basic walking utilities that all the glob walker types use\n */\nexport abstract class GlobUtil {\n path: Path\n patterns: Pattern[]\n opts: O\n seen: Set = new Set()\n paused: boolean = false\n aborted: boolean = false\n #onResume: (() => any)[] = []\n #ignore?: IgnoreLike\n #sep: '\\\\' | '/'\n signal?: AbortSignal\n maxDepth: number\n includeChildMatches: boolean\n\n constructor(patterns: Pattern[], path: Path, opts: O)\n constructor(patterns: Pattern[], path: Path, opts: O) {\n this.patterns = patterns\n this.path = path\n this.opts = opts\n this.#sep = !opts.posix && opts.platform === 'win32' ? '\\\\' : '/'\n this.includeChildMatches = opts.includeChildMatches !== false\n if (opts.ignore || !this.includeChildMatches) {\n this.#ignore = makeIgnore(opts.ignore ?? [], opts)\n if (\n !this.includeChildMatches &&\n typeof this.#ignore.add !== 'function'\n ) {\n const m = 'cannot ignore child matches, ignore lacks add() method.'\n throw new Error(m)\n }\n }\n // ignore, always set with maxDepth, but it's optional on the\n // GlobOptions type\n /* c8 ignore start */\n this.maxDepth = opts.maxDepth || Infinity\n /* c8 ignore stop */\n if (opts.signal) {\n this.signal = opts.signal\n this.signal.addEventListener('abort', () => {\n this.#onResume.length = 0\n })\n }\n }\n\n #ignored(path: Path): boolean {\n return this.seen.has(path) || !!this.#ignore?.ignored?.(path)\n }\n #childrenIgnored(path: Path): boolean {\n return !!this.#ignore?.childrenIgnored?.(path)\n }\n\n // backpressure mechanism\n pause() {\n this.paused = true\n }\n resume() {\n /* c8 ignore start */\n if (this.signal?.aborted) return\n /* c8 ignore stop */\n this.paused = false\n let fn: (() => any) | undefined = undefined\n while (!this.paused && (fn = this.#onResume.shift())) {\n fn()\n }\n }\n onResume(fn: () => any) {\n if (this.signal?.aborted) return\n /* c8 ignore start */\n if (!this.paused) {\n fn()\n } else {\n /* c8 ignore stop */\n this.#onResume.push(fn)\n }\n }\n\n // do the requisite realpath/stat checking, and return the path\n // to add or undefined to filter it out.\n async matchCheck(e: Path, ifDir: boolean): Promise {\n if (ifDir && this.opts.nodir) return undefined\n let rpc: Path | undefined\n if (this.opts.realpath) {\n rpc = e.realpathCached() || (await e.realpath())\n if (!rpc) return undefined\n e = rpc\n }\n const needStat = e.isUnknown() || this.opts.stat\n const s = needStat ? await e.lstat() : e\n if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {\n const target = await s.realpath()\n /* c8 ignore start */\n if (target && (target.isUnknown() || this.opts.stat)) {\n await target.lstat()\n }\n /* c8 ignore stop */\n }\n return this.matchCheckTest(s, ifDir)\n }\n\n matchCheckTest(e: Path | undefined, ifDir: boolean): Path | undefined {\n return (\n e &&\n (this.maxDepth === Infinity || e.depth() <= this.maxDepth) &&\n (!ifDir || e.canReaddir()) &&\n (!this.opts.nodir || !e.isDirectory()) &&\n (!this.opts.nodir ||\n !this.opts.follow ||\n !e.isSymbolicLink() ||\n !e.realpathCached()?.isDirectory()) &&\n !this.#ignored(e)\n ) ?\n e\n : undefined\n }\n\n matchCheckSync(e: Path, ifDir: boolean): Path | undefined {\n if (ifDir && this.opts.nodir) return undefined\n let rpc: Path | undefined\n if (this.opts.realpath) {\n rpc = e.realpathCached() || e.realpathSync()\n if (!rpc) return undefined\n e = rpc\n }\n const needStat = e.isUnknown() || this.opts.stat\n const s = needStat ? e.lstatSync() : e\n if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {\n const target = s.realpathSync()\n if (target && (target?.isUnknown() || this.opts.stat)) {\n target.lstatSync()\n }\n }\n return this.matchCheckTest(s, ifDir)\n }\n\n abstract matchEmit(p: Result): void\n abstract matchEmit(p: string | Path): void\n\n matchFinish(e: Path, absolute: boolean) {\n if (this.#ignored(e)) return\n // we know we have an ignore if this is false, but TS doesn't\n if (!this.includeChildMatches && this.#ignore?.add) {\n const ign = `${e.relativePosix()}/**`\n this.#ignore.add(ign)\n }\n const abs =\n this.opts.absolute === undefined ? absolute : this.opts.absolute\n this.seen.add(e)\n const mark = this.opts.mark && e.isDirectory() ? this.#sep : ''\n // ok, we have what we need!\n if (this.opts.withFileTypes) {\n this.matchEmit(e)\n } else if (abs) {\n const abs = this.opts.posix ? e.fullpathPosix() : e.fullpath()\n this.matchEmit(abs + mark)\n } else {\n const rel = this.opts.posix ? e.relativePosix() : e.relative()\n const pre =\n this.opts.dotRelative && !rel.startsWith('..' + this.#sep) ?\n '.' + this.#sep\n : ''\n this.matchEmit(!rel ? '.' + mark : pre + rel + mark)\n }\n }\n\n async match(e: Path, absolute: boolean, ifDir: boolean): Promise {\n const p = await this.matchCheck(e, ifDir)\n if (p) this.matchFinish(p, absolute)\n }\n\n matchSync(e: Path, absolute: boolean, ifDir: boolean): void {\n const p = this.matchCheckSync(e, ifDir)\n if (p) this.matchFinish(p, absolute)\n }\n\n walkCB(target: Path, patterns: Pattern[], cb: () => any) {\n /* c8 ignore start */\n if (this.signal?.aborted) cb()\n /* c8 ignore stop */\n this.walkCB2(target, patterns, new Processor(this.opts), cb)\n }\n\n walkCB2(\n target: Path,\n patterns: Pattern[],\n processor: Processor,\n cb: () => any,\n ) {\n if (this.#childrenIgnored(target)) return cb()\n if (this.signal?.aborted) cb()\n if (this.paused) {\n this.onResume(() => this.walkCB2(target, patterns, processor, cb))\n return\n }\n processor.processPatterns(target, patterns)\n\n // done processing. all of the above is sync, can be abstracted out.\n // subwalks is a map of paths to the entry filters they need\n // matches is a map of paths to [absolute, ifDir] tuples.\n let tasks = 1\n const next = () => {\n if (--tasks === 0) cb()\n }\n\n for (const [m, absolute, ifDir] of processor.matches.entries()) {\n if (this.#ignored(m)) continue\n tasks++\n this.match(m, absolute, ifDir).then(() => next())\n }\n\n for (const t of processor.subwalkTargets()) {\n if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {\n continue\n }\n tasks++\n const childrenCached = t.readdirCached()\n if (t.calledReaddir())\n this.walkCB3(t, childrenCached, processor, next)\n else {\n t.readdirCB(\n (_, entries) => this.walkCB3(t, entries, processor, next),\n true,\n )\n }\n }\n\n next()\n }\n\n walkCB3(\n target: Path,\n entries: Path[],\n processor: Processor,\n cb: () => any,\n ) {\n processor = processor.filterEntries(target, entries)\n\n let tasks = 1\n const next = () => {\n if (--tasks === 0) cb()\n }\n\n for (const [m, absolute, ifDir] of processor.matches.entries()) {\n if (this.#ignored(m)) continue\n tasks++\n this.match(m, absolute, ifDir).then(() => next())\n }\n for (const [target, patterns] of processor.subwalks.entries()) {\n tasks++\n this.walkCB2(target, patterns, processor.child(), next)\n }\n\n next()\n }\n\n walkCBSync(target: Path, patterns: Pattern[], cb: () => any) {\n /* c8 ignore start */\n if (this.signal?.aborted) cb()\n /* c8 ignore stop */\n this.walkCB2Sync(target, patterns, new Processor(this.opts), cb)\n }\n\n walkCB2Sync(\n target: Path,\n patterns: Pattern[],\n processor: Processor,\n cb: () => any,\n ) {\n if (this.#childrenIgnored(target)) return cb()\n if (this.signal?.aborted) cb()\n if (this.paused) {\n this.onResume(() =>\n this.walkCB2Sync(target, patterns, processor, cb),\n )\n return\n }\n processor.processPatterns(target, patterns)\n\n // done processing. all of the above is sync, can be abstracted out.\n // subwalks is a map of paths to the entry filters they need\n // matches is a map of paths to [absolute, ifDir] tuples.\n let tasks = 1\n const next = () => {\n if (--tasks === 0) cb()\n }\n\n for (const [m, absolute, ifDir] of processor.matches.entries()) {\n if (this.#ignored(m)) continue\n this.matchSync(m, absolute, ifDir)\n }\n\n for (const t of processor.subwalkTargets()) {\n if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {\n continue\n }\n tasks++\n const children = t.readdirSync()\n this.walkCB3Sync(t, children, processor, next)\n }\n\n next()\n }\n\n walkCB3Sync(\n target: Path,\n entries: Path[],\n processor: Processor,\n cb: () => any,\n ) {\n processor = processor.filterEntries(target, entries)\n\n let tasks = 1\n const next = () => {\n if (--tasks === 0) cb()\n }\n\n for (const [m, absolute, ifDir] of processor.matches.entries()) {\n if (this.#ignored(m)) continue\n this.matchSync(m, absolute, ifDir)\n }\n for (const [target, patterns] of processor.subwalks.entries()) {\n tasks++\n this.walkCB2Sync(target, patterns, processor.child(), next)\n }\n\n next()\n }\n}\n\nexport class GlobWalker<\n O extends GlobWalkerOpts = GlobWalkerOpts,\n> extends GlobUtil {\n matches = new Set>()\n\n constructor(patterns: Pattern[], path: Path, opts: O) {\n super(patterns, path, opts)\n }\n\n matchEmit(e: Result): void {\n this.matches.add(e)\n }\n\n async walk(): Promise>> {\n if (this.signal?.aborted) throw this.signal.reason\n if (this.path.isUnknown()) {\n await this.path.lstat()\n }\n await new Promise((res, rej) => {\n this.walkCB(this.path, this.patterns, () => {\n if (this.signal?.aborted) {\n rej(this.signal.reason)\n } else {\n res(this.matches)\n }\n })\n })\n return this.matches\n }\n\n walkSync(): Set> {\n if (this.signal?.aborted) throw this.signal.reason\n if (this.path.isUnknown()) {\n this.path.lstatSync()\n }\n // nothing for the callback to do, because this never pauses\n this.walkCBSync(this.path, this.patterns, () => {\n if (this.signal?.aborted) throw this.signal.reason\n })\n return this.matches\n }\n}\n\nexport class GlobStream<\n O extends GlobWalkerOpts = GlobWalkerOpts,\n> extends GlobUtil {\n results: Minipass, Result>\n\n constructor(patterns: Pattern[], path: Path, opts: O) {\n super(patterns, path, opts)\n this.results = new Minipass, Result>({\n signal: this.signal,\n objectMode: true,\n })\n this.results.on('drain', () => this.resume())\n this.results.on('resume', () => this.resume())\n }\n\n matchEmit(e: Result): void {\n this.results.write(e)\n if (!this.results.flowing) this.pause()\n }\n\n stream(): MatchStream {\n const target = this.path\n if (target.isUnknown()) {\n target.lstat().then(() => {\n this.walkCB(target, this.patterns, () => this.results.end())\n })\n } else {\n this.walkCB(target, this.patterns, () => this.results.end())\n }\n return this.results\n }\n\n streamSync(): MatchStream {\n if (this.path.isUnknown()) {\n this.path.lstatSync()\n }\n this.walkCBSync(this.path, this.patterns, () => this.results.end())\n return this.results\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/bin.d.mts b/node_modules/npm/node_modules/glob/dist/esm/bin.d.mts new file mode 100644 index 00000000..77298e47 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/bin.d.mts @@ -0,0 +1,3 @@ +#!/usr/bin/env node +export {}; +//# sourceMappingURL=bin.d.mts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/bin.d.mts.map b/node_modules/npm/node_modules/glob/dist/esm/bin.d.mts.map new file mode 100644 index 00000000..ec64bdda --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/bin.d.mts.map @@ -0,0 +1 @@ +{"version":3,"file":"bin.d.mts","sourceRoot":"","sources":["../../src/bin.mts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/bin.mjs b/node_modules/npm/node_modules/glob/dist/esm/bin.mjs new file mode 100755 index 00000000..5c7bf1e9 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/bin.mjs @@ -0,0 +1,270 @@ +#!/usr/bin/env node +import { foregroundChild } from 'foreground-child'; +import { existsSync } from 'fs'; +import { jack } from 'jackspeak'; +import { loadPackageJson } from 'package-json-from-dist'; +import { join } from 'path'; +import { globStream } from './index.js'; +const { version } = loadPackageJson(import.meta.url, '../package.json'); +const j = jack({ + usage: 'glob [options] [ [ ...]]', +}) + .description(` + Glob v${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!`, + validOptions: [ + 'aix', + 'android', + 'darwin', + 'freebsd', + 'haiku', + 'linux', + 'openbsd', + 'sunos', + 'win32', + 'cygwin', + 'netbsd', + ], + }, +}) + .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 => !existsSync(p)); + const matches = values.all ? + [] + : positionals.filter(p => existsSync(p)).map(p => join(p)); + const stream = 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', () => 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.mjs.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/bin.mjs.map b/node_modules/npm/node_modules/glob/dist/esm/bin.mjs.map new file mode 100644 index 00000000..67247d5b --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/bin.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"bin.mjs","sourceRoot":"","sources":["../../src/bin.mts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,MA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AAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { foregroundChild } from 'foreground-child'\nimport { existsSync } from 'fs'\nimport { jack } from 'jackspeak'\nimport { loadPackageJson } from 'package-json-from-dist'\nimport { join } from 'path'\nimport { globStream } from './index.js'\n\nconst { version } = loadPackageJson(import.meta.url, '../package.json')\n\nconst j = jack({\n usage: 'glob [options] [ [ ...]]',\n})\n .description(\n `\n Glob v${version}\n\n Expand the positional glob expression arguments into any matching file\n system paths found.\n `,\n )\n .opt({\n cmd: {\n short: 'c',\n hint: 'command',\n description: `Run the command provided, passing the glob expression\n matches as arguments.`,\n },\n })\n .opt({\n default: {\n short: 'p',\n hint: 'pattern',\n description: `If no positional arguments are provided, glob will use\n this pattern`,\n },\n })\n .flag({\n all: {\n short: 'A',\n description: `By default, the glob cli command will not expand any\n arguments that are an exact match to a file on disk.\n\n This prevents double-expanding, in case the shell expands\n an argument whose filename is a glob expression.\n\n For example, if 'app/*.ts' would match 'app/[id].ts', then\n on Windows powershell or cmd.exe, 'glob app/*.ts' will\n expand to 'app/[id].ts', as expected. However, in posix\n shells such as bash or zsh, the shell will first expand\n 'app/*.ts' to a list of filenames. Then glob will look\n for a file matching 'app/[id].ts' (ie, 'app/i.ts' or\n 'app/d.ts'), which is unexpected.\n\n Setting '--all' prevents this behavior, causing glob\n to treat ALL patterns as glob expressions to be expanded,\n even if they are an exact match to a file on disk.\n\n When setting this option, be sure to enquote arguments\n so that the shell will not expand them prior to passing\n them to the glob command process.\n `,\n },\n absolute: {\n short: 'a',\n description: 'Expand to absolute paths',\n },\n 'dot-relative': {\n short: 'd',\n description: `Prepend './' on relative matches`,\n },\n mark: {\n short: 'm',\n description: `Append a / on any directories matched`,\n },\n posix: {\n short: 'x',\n description: `Always resolve to posix style paths, using '/' as the\n directory separator, even on Windows. Drive letter\n absolute matches on Windows will be expanded to their\n full resolved UNC maths, eg instead of 'C:\\\\foo\\\\bar',\n it will expand to '//?/C:/foo/bar'.\n `,\n },\n\n follow: {\n short: 'f',\n description: `Follow symlinked directories when expanding '**'`,\n },\n realpath: {\n short: 'R',\n description: `Call 'fs.realpath' on all of the results. In the case\n of an entry that cannot be resolved, the entry is\n omitted. This incurs a slight performance penalty, of\n course, because of the added system calls.`,\n },\n stat: {\n short: 's',\n description: `Call 'fs.lstat' on all entries, whether required or not\n to determine if it's a valid match.`,\n },\n 'match-base': {\n short: 'b',\n description: `Perform a basename-only match if the pattern does not\n contain any slash characters. That is, '*.js' would be\n treated as equivalent to '**/*.js', matching js files\n in all directories.\n `,\n },\n\n dot: {\n description: `Allow patterns to match files/directories that start\n with '.', even if the pattern does not start with '.'\n `,\n },\n nobrace: {\n description: 'Do not expand {...} patterns',\n },\n nocase: {\n description: `Perform a case-insensitive match. This defaults to\n 'true' on macOS and Windows platforms, and false on\n all others.\n\n Note: 'nocase' should only be explicitly set when it is\n known that the filesystem's case sensitivity differs\n from the platform default. If set 'true' on\n case-insensitive file systems, then the walk may return\n more or less results than expected.\n `,\n },\n nodir: {\n description: `Do not match directories, only files.\n\n Note: to *only* match directories, append a '/' at the\n end of the pattern.\n `,\n },\n noext: {\n description: `Do not expand extglob patterns, such as '+(a|b)'`,\n },\n noglobstar: {\n description: `Do not expand '**' against multiple path portions.\n Ie, treat it as a normal '*' instead.`,\n },\n 'windows-path-no-escape': {\n description: `Use '\\\\' as a path separator *only*, and *never* as an\n escape character. If set, all '\\\\' characters are\n replaced with '/' in the pattern.`,\n },\n })\n .num({\n 'max-depth': {\n short: 'D',\n description: `Maximum depth to traverse from the current\n working directory`,\n },\n })\n .opt({\n cwd: {\n short: 'C',\n description: 'Current working directory to execute/match in',\n default: process.cwd(),\n },\n root: {\n short: 'r',\n description: `A string path resolved against the 'cwd', which is\n used as the starting point for absolute patterns that\n start with '/' (but not drive letters or UNC paths\n on Windows).\n\n Note that this *doesn't* necessarily limit the walk to\n the 'root' directory, and doesn't affect the cwd\n starting point for non-absolute patterns. A pattern\n containing '..' will still be able to traverse out of\n the root directory, if it is not an actual root directory\n on the filesystem, and any non-absolute patterns will\n still be matched in the 'cwd'.\n\n To start absolute and non-absolute patterns in the same\n path, you can use '--root=' to set it to the empty\n string. However, be aware that on Windows systems, a\n pattern like 'x:/*' or '//host/share/*' will *always*\n start in the 'x:/' or '//host/share/' directory,\n regardless of the --root setting.\n `,\n },\n platform: {\n description: `Defaults to the value of 'process.platform' if\n available, or 'linux' if not. Setting --platform=win32\n on non-Windows systems may cause strange behavior!`,\n validOptions: [\n 'aix',\n 'android',\n 'darwin',\n 'freebsd',\n 'haiku',\n 'linux',\n 'openbsd',\n 'sunos',\n 'win32',\n 'cygwin',\n 'netbsd',\n ],\n },\n })\n .optList({\n ignore: {\n short: 'i',\n description: `Glob patterns to ignore`,\n },\n })\n .flag({\n debug: {\n short: 'v',\n description: `Output a huge amount of noisy debug information about\n patterns as they are parsed and used to match files.`,\n },\n })\n .flag({\n help: {\n short: 'h',\n description: 'Show this usage information',\n },\n })\n\ntry {\n const { positionals, values } = j.parse()\n if (values.help) {\n console.log(j.usage())\n process.exit(0)\n }\n if (positionals.length === 0 && !values.default)\n throw 'No patterns provided'\n if (positionals.length === 0 && values.default)\n positionals.push(values.default)\n const patterns =\n values.all ? positionals : positionals.filter(p => !existsSync(p))\n const matches =\n values.all ?\n []\n : positionals.filter(p => existsSync(p)).map(p => join(p))\n const stream = globStream(patterns, {\n absolute: values.absolute,\n cwd: values.cwd,\n dot: values.dot,\n dotRelative: values['dot-relative'],\n follow: values.follow,\n ignore: values.ignore,\n mark: values.mark,\n matchBase: values['match-base'],\n maxDepth: values['max-depth'],\n nobrace: values.nobrace,\n nocase: values.nocase,\n nodir: values.nodir,\n noext: values.noext,\n noglobstar: values.noglobstar,\n platform: values.platform as undefined | NodeJS.Platform,\n realpath: values.realpath,\n root: values.root,\n stat: values.stat,\n debug: values.debug,\n posix: values.posix,\n })\n\n const cmd = values.cmd\n if (!cmd) {\n matches.forEach(m => console.log(m))\n stream.on('data', f => console.log(f))\n } else {\n stream.on('data', f => matches.push(f))\n stream.on('end', () => foregroundChild(cmd, matches, { shell: true }))\n }\n} catch (e) {\n console.error(j.usage())\n console.error(e instanceof Error ? e.message : String(e))\n process.exit(1)\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/glob.d.ts b/node_modules/npm/node_modules/glob/dist/esm/glob.d.ts new file mode 100644 index 00000000..25262b3d --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/glob.d.ts @@ -0,0 +1,388 @@ +import { Minimatch } from 'minimatch'; +import { Minipass } from 'minipass'; +import { FSOption, Path, PathScurry } from 'path-scurry'; +import { IgnoreLike } from './ignore.js'; +import { Pattern } from './pattern.js'; +export type MatchSet = Minimatch['set']; +export type GlobParts = Exclude; +/** + * A `GlobOptions` object may be provided to any of the exported methods, and + * must be provided to the `Glob` constructor. + * + * All options are optional, boolean, and false by default, unless otherwise + * noted. + * + * All resolved options are added to the Glob object as properties. + * + * If you are running many `glob` operations, you can pass a Glob object as the + * `options` argument to a subsequent operation to share the previously loaded + * cache. + */ +export interface GlobOptions { + /** + * Set to `true` to always receive absolute paths for + * matched files. Set to `false` to always return relative paths. + * + * When this option is not set, absolute paths are returned for patterns + * that are absolute, and otherwise paths are returned that are relative + * to the `cwd` setting. + * + * This does _not_ make an extra system call to get + * the realpath, it only does string path resolution. + * + * Conflicts with {@link withFileTypes} + */ + absolute?: boolean; + /** + * Set to false to enable {@link windowsPathsNoEscape} + * + * @deprecated + */ + allowWindowsEscape?: boolean; + /** + * The current working directory in which to search. Defaults to + * `process.cwd()`. + * + * May be eiher a string path or a `file://` URL object or string. + */ + cwd?: string | URL; + /** + * Include `.dot` files in normal matches and `globstar` + * matches. Note that an explicit dot in a portion of the pattern + * will always match dot files. + */ + dot?: boolean; + /** + * Prepend all relative path strings with `./` (or `.\` on Windows). + * + * Without this option, returned relative paths are "bare", so instead of + * returning `'./foo/bar'`, they are returned as `'foo/bar'`. + * + * Relative patterns starting with `'../'` are not prepended with `./`, even + * if this option is set. + */ + dotRelative?: boolean; + /** + * Follow symlinked directories when expanding `**` + * patterns. This can result in a lot of duplicate references in + * the presence of cyclic links, and make performance quite bad. + * + * By default, a `**` in a pattern will follow 1 symbolic link if + * it is not the first item in the pattern, or none if it is the + * first item in the pattern, following the same behavior as Bash. + */ + follow?: boolean; + /** + * string or string[], or an object with `ignore` and `ignoreChildren` + * methods. + * + * If a string or string[] is provided, then this is treated as a glob + * pattern or array of glob patterns to exclude from matches. To ignore all + * children within a directory, as well as the entry itself, append `'/**'` + * to the ignore pattern. + * + * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of + * any other settings. + * + * If an object is provided that has `ignored(path)` and/or + * `childrenIgnored(path)` methods, then these methods will be called to + * determine whether any Path is a match or if its children should be + * traversed, respectively. + */ + ignore?: string | string[] | IgnoreLike; + /** + * Treat brace expansion like `{a,b}` as a "magic" pattern. Has no + * effect if {@link nobrace} is set. + * + * Only has effect on the {@link hasMagic} function. + */ + magicalBraces?: boolean; + /** + * Add a `/` character to directory matches. Note that this requires + * additional stat calls in some cases. + */ + mark?: boolean; + /** + * 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 all js files in all directories. + */ + matchBase?: boolean; + /** + * Limit the directory traversal to a given depth below the cwd. + * Note that this does NOT prevent traversal to sibling folders, + * root patterns, and so on. It only limits the maximum folder depth + * that the walk will descend, relative to the cwd. + */ + maxDepth?: number; + /** + * Do not expand `{a,b}` and `{1..3}` brace sets. + */ + nobrace?: boolean; + /** + * Perform a case-insensitive match. This defaults to `true` on macOS and + * Windows systems, 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-sensitive file + * systems, or `false` on case-insensitive file systems, then the + * walk may return more or less results than expected. + */ + nocase?: boolean; + /** + * Do not match directories, only files. (Note: to match + * _only_ directories, put a `/` at the end of the pattern.) + */ + nodir?: boolean; + /** + * Do not match "extglob" patterns such as `+(a|b)`. + */ + noext?: boolean; + /** + * Do not match `**` against multiple filenames. (Ie, treat it as a normal + * `*` instead.) + * + * Conflicts with {@link matchBase} + */ + noglobstar?: boolean; + /** + * Defaults to value of `process.platform` if available, or `'linux'` if + * not. Setting `platform:'win32'` on non-Windows systems may cause strange + * behavior. + */ + platform?: NodeJS.Platform; + /** + * Set to true to 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. + */ + realpath?: boolean; + /** + * + * A string path resolved against the `cwd` option, 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 be matched in the `cwd`. For example, the + * pattern `/../*` with `{root:'/some/path'}` will return all + * files in `/some`, not all files in `/some/path`. The pattern + * `*` with `{root:'/some/path'}` will return all the entries in + * the cwd, not the entries in `/some/path`. + * + * To start absolute and non-absolute patterns in the same + * path, you can use `{root:''}`. 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. + */ + root?: string; + /** + * A [PathScurry](http://npm.im/path-scurry) object used + * to traverse the file system. If the `nocase` option is set + * explicitly, then any provided `scurry` object must match this + * setting. + */ + scurry?: PathScurry; + /** + * Call `lstat()` on all entries, whether required or not to determine + * if it's a valid match. When used with {@link withFileTypes}, this means + * that matches will include data such as modified time, permissions, and + * so on. Note that this will incur a performance cost due to the added + * system calls. + */ + stat?: boolean; + /** + * An AbortSignal which will cancel the Glob walk when + * triggered. + */ + signal?: AbortSignal; + /** + * Use `\\` as a path separator _only_, and + * _never_ as an escape character. If set, all `\\` characters are + * replaced with `/` in the pattern. + * + * Note that this makes it **impossible** to match against paths + * containing literal glob pattern characters, but allows matching + * with patterns constructed using `path.join()` and + * `path.resolve()` on Windows platforms, mimicking the (buggy!) + * behavior of Glob v7 and before on Windows. Please use with + * caution, and be mindful of [the caveat below about Windows + * paths](#windows). (For legacy reasons, this is also set if + * `allowWindowsEscape` is set to the exact value `false`.) + */ + windowsPathsNoEscape?: boolean; + /** + * Return [PathScurry](http://npm.im/path-scurry) + * `Path` objects instead of strings. These are similar to a + * NodeJS `Dirent` object, but with additional methods and + * properties. + * + * Conflicts with {@link absolute} + */ + withFileTypes?: boolean; + /** + * An fs implementation to override some or all of the defaults. See + * http://npm.im/path-scurry for details about what can be overridden. + */ + fs?: FSOption; + /** + * Just passed along to Minimatch. Note that this makes all pattern + * matching operations slower and *extremely* noisy. + */ + debug?: boolean; + /** + * Return `/` delimited paths, even on Windows. + * + * On posix systems, this has no effect. But, on Windows, it means that + * paths will be `/` delimited, and absolute paths will be their full + * resolved UNC forms, eg instead of `'C:\\foo\\bar'`, it would return + * `'//?/C:/foo/bar'` + */ + posix?: boolean; + /** + * Do not match any children of any matches. For example, the pattern + * `**\/foo` would match `a/foo`, but not `a/foo/b/foo` in this mode. + * + * This is especially useful for cases like "find all `node_modules` + * folders, but not the ones in `node_modules`". + * + * In order to support this, the `Ignore` implementation must support an + * `add(pattern: string)` method. If using the default `Ignore` class, then + * this is fine, but if this is set to `false`, and a custom `Ignore` is + * provided that does not have an `add()` method, then it will throw an + * error. + * + * **Caveat** It *only* ignores matches that would be a descendant of a + * previous match, and only if that descendant is matched *after* the + * ancestor is encountered. Since the file system walk happens in + * indeterminate order, it's possible that a match will already be added + * before its ancestor, if multiple or braced patterns are used. + * + * For example: + * + * ```ts + * const results = await glob([ + * // likely to match first, since it's just a stat + * 'a/b/c/d/e/f', + * + * // this pattern is more complicated! It must to various readdir() + * // calls and test the results against a regular expression, and that + * // is certainly going to take a little bit longer. + * // + * // So, later on, it encounters a match at 'a/b/c/d/e', but it's too + * // late to ignore a/b/c/d/e/f, because it's already been emitted. + * 'a/[bdf]/?/[a-z]/*', + * ], { includeChildMatches: false }) + * ``` + * + * It's best to only set this to `false` if you can be reasonably sure that + * no components of the pattern will potentially match one another's file + * system descendants, or if the occasional included child entry will not + * cause problems. + * + * @default true + */ + includeChildMatches?: boolean; +} +export type GlobOptionsWithFileTypesTrue = GlobOptions & { + withFileTypes: true; + absolute?: undefined; + mark?: undefined; + posix?: undefined; +}; +export type GlobOptionsWithFileTypesFalse = GlobOptions & { + withFileTypes?: false; +}; +export type GlobOptionsWithFileTypesUnset = GlobOptions & { + withFileTypes?: undefined; +}; +export type Result = Opts extends GlobOptionsWithFileTypesTrue ? Path : Opts extends GlobOptionsWithFileTypesFalse ? string : Opts extends GlobOptionsWithFileTypesUnset ? string : string | Path; +export type Results = Result[]; +export type FileTypes = Opts extends GlobOptionsWithFileTypesTrue ? true : Opts extends GlobOptionsWithFileTypesFalse ? false : Opts extends GlobOptionsWithFileTypesUnset ? false : boolean; +/** + * An object that can perform glob pattern traversals. + */ +export declare class Glob implements GlobOptions { + absolute?: boolean; + cwd: string; + root?: string; + dot: boolean; + dotRelative: boolean; + follow: boolean; + ignore?: string | string[] | IgnoreLike; + magicalBraces: boolean; + mark?: boolean; + matchBase: boolean; + maxDepth: number; + nobrace: boolean; + nocase: boolean; + nodir: boolean; + noext: boolean; + noglobstar: boolean; + pattern: string[]; + platform: NodeJS.Platform; + realpath: boolean; + scurry: PathScurry; + stat: boolean; + signal?: AbortSignal; + windowsPathsNoEscape: boolean; + withFileTypes: FileTypes; + includeChildMatches: boolean; + /** + * The options provided to the constructor. + */ + opts: Opts; + /** + * An array of parsed immutable {@link Pattern} objects. + */ + patterns: Pattern[]; + /** + * 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: string | string[], opts: Opts); + /** + * Returns a Promise that resolves to the results array. + */ + walk(): Promise>; + /** + * synchronous {@link Glob.walk} + */ + walkSync(): Results; + /** + * Stream results asynchronously. + */ + stream(): Minipass, Result>; + /** + * Stream results synchronously. + */ + streamSync(): Minipass, Result>; + /** + * Default sync iteration function. Returns a Generator that + * iterates over the results. + */ + iterateSync(): Generator, void, void>; + [Symbol.iterator](): Generator, void, void>; + /** + * Default async iteration function. Returns an AsyncGenerator that + * iterates over the results. + */ + iterate(): AsyncGenerator, void, void>; + [Symbol.asyncIterator](): AsyncGenerator, void, void>; +} +//# sourceMappingURL=glob.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/glob.d.ts.map b/node_modules/npm/node_modules/glob/dist/esm/glob.d.ts.map new file mode 100644 index 00000000..c32dc74c --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/glob.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,UAAU,EAIX,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;AACvC,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,CAAA;AAalE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;OAIG;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C,IAAI,CAAC,CAAC;IAc9C;;OAEG;IACH,UAAU,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAclD;;;OAGG;IACH,WAAW,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAGlD,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIjB;;;OAGG;IACH,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAGnD,CAAC,MAAM,CAAC,aAAa,CAAC;CAGvB"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/glob.js b/node_modules/npm/node_modules/glob/dist/esm/glob.js new file mode 100644 index 00000000..c9ff3b00 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/glob.js @@ -0,0 +1,243 @@ +import { Minimatch } from 'minimatch'; +import { fileURLToPath } from 'node:url'; +import { PathScurry, PathScurryDarwin, PathScurryPosix, PathScurryWin32, } from 'path-scurry'; +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; + includeChildMatches; + /** + * 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.includeChildMatches = opts.includeChildMatches !== false; + 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) => { + const g = globParts[i]; + /* c8 ignore start */ + if (!g) + throw new Error('invalid pattern object'); + /* c8 ignore stop */ + return new Pattern(set, g, 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, + includeChildMatches: this.includeChildMatches, + }).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, + includeChildMatches: this.includeChildMatches, + }).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, + includeChildMatches: this.includeChildMatches, + }).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, + includeChildMatches: this.includeChildMatches, + }).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/npm/node_modules/glob/dist/esm/glob.js.map b/node_modules/npm/node_modules/glob/dist/esm/glob.js.map new file mode 100644 index 00000000..a62c3239 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/glob.js.map @@ -0,0 +1 @@ +{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,WAAW,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAGL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKpD,4CAA4C;AAC5C,gDAAgD;AAChD,MAAM,eAAe,GACnB,CACE,OAAO,OAAO,KAAK,QAAQ;IAC3B,OAAO;IACP,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CACrC,CAAC,CAAC;IACD,OAAO,CAAC,QAAQ;IAClB,CAAC,CAAC,OAAO,CAAA;AAyVX;;GAEG;AACH,MAAM,OAAO,IAAI;IACf,QAAQ,CAAU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AAI;YACZ,QAAQ,EACN,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;gBAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;gBACzC,CAAC,CAAC,QAAQ;YACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;SAC9C,CAAC,CAAC,UAAU,EAAE,CAAA;IACjB,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;IAC7C,CAAC;IACD,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;IAC9C,CAAC;IACD,CAAC,MAAM,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;IACvB,CAAC;CACF","sourcesContent":["import { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport { fileURLToPath } from 'node:url'\nimport {\n FSOption,\n Path,\n PathScurry,\n PathScurryDarwin,\n PathScurryPosix,\n PathScurryWin32,\n} from 'path-scurry'\nimport { IgnoreLike } from './ignore.js'\nimport { Pattern } from './pattern.js'\nimport { GlobStream, GlobWalker } from './walker.js'\n\nexport type MatchSet = Minimatch['set']\nexport type GlobParts = Exclude\n\n// if no process global, just call it linux.\n// so we default to case-sensitive, / separators\nconst defaultPlatform: NodeJS.Platform =\n (\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ) ?\n process.platform\n : 'linux'\n\n/**\n * A `GlobOptions` object may be provided to any of the exported methods, and\n * must be provided to the `Glob` constructor.\n *\n * All options are optional, boolean, and false by default, unless otherwise\n * noted.\n *\n * All resolved options are added to the Glob object as properties.\n *\n * If you are running many `glob` operations, you can pass a Glob object as the\n * `options` argument to a subsequent operation to share the previously loaded\n * cache.\n */\nexport interface GlobOptions {\n /**\n * Set to `true` to always receive absolute paths for\n * matched files. Set to `false` to always return relative paths.\n *\n * When this option is not set, absolute paths are returned for patterns\n * that are absolute, and otherwise paths are returned that are relative\n * to the `cwd` setting.\n *\n * This does _not_ make an extra system call to get\n * the realpath, it only does string path resolution.\n *\n * Conflicts with {@link withFileTypes}\n */\n absolute?: boolean\n\n /**\n * Set to false to enable {@link windowsPathsNoEscape}\n *\n * @deprecated\n */\n allowWindowsEscape?: boolean\n\n /**\n * The current working directory in which to search. Defaults to\n * `process.cwd()`.\n *\n * May be eiher a string path or a `file://` URL object or string.\n */\n cwd?: string | URL\n\n /**\n * Include `.dot` files in normal matches and `globstar`\n * matches. Note that an explicit dot in a portion of the pattern\n * will always match dot files.\n */\n dot?: boolean\n\n /**\n * Prepend all relative path strings with `./` (or `.\\` on Windows).\n *\n * Without this option, returned relative paths are \"bare\", so instead of\n * returning `'./foo/bar'`, they are returned as `'foo/bar'`.\n *\n * Relative patterns starting with `'../'` are not prepended with `./`, even\n * if this option is set.\n */\n dotRelative?: boolean\n\n /**\n * Follow symlinked directories when expanding `**`\n * patterns. This can result in a lot of duplicate references in\n * the presence of cyclic links, and make performance quite bad.\n *\n * By default, a `**` in a pattern will follow 1 symbolic link if\n * it is not the first item in the pattern, or none if it is the\n * first item in the pattern, following the same behavior as Bash.\n */\n follow?: boolean\n\n /**\n * string or string[], or an object with `ignore` and `ignoreChildren`\n * methods.\n *\n * If a string or string[] is provided, then this is treated as a glob\n * pattern or array of glob patterns to exclude from matches. To ignore all\n * children within a directory, as well as the entry itself, append `'/**'`\n * to the ignore pattern.\n *\n * **Note** `ignore` patterns are _always_ in `dot:true` mode, regardless of\n * any other settings.\n *\n * If an object is provided that has `ignored(path)` and/or\n * `childrenIgnored(path)` methods, then these methods will be called to\n * determine whether any Path is a match or if its children should be\n * traversed, respectively.\n */\n ignore?: string | string[] | IgnoreLike\n\n /**\n * Treat brace expansion like `{a,b}` as a \"magic\" pattern. Has no\n * effect if {@link nobrace} is set.\n *\n * Only has effect on the {@link hasMagic} function.\n */\n magicalBraces?: boolean\n\n /**\n * Add a `/` character to directory matches. Note that this requires\n * additional stat calls in some cases.\n */\n mark?: boolean\n\n /**\n * Perform a basename-only match if the pattern does not contain any slash\n * characters. That is, `*.js` would be treated as equivalent to\n * `**\\/*.js`, matching all js files in all directories.\n */\n matchBase?: boolean\n\n /**\n * Limit the directory traversal to a given depth below the cwd.\n * Note that this does NOT prevent traversal to sibling folders,\n * root patterns, and so on. It only limits the maximum folder depth\n * that the walk will descend, relative to the cwd.\n */\n maxDepth?: number\n\n /**\n * Do not expand `{a,b}` and `{1..3}` brace sets.\n */\n nobrace?: boolean\n\n /**\n * Perform a case-insensitive match. This defaults to `true` on macOS and\n * Windows systems, and `false` on all others.\n *\n * **Note** `nocase` should only be explicitly set when it is\n * known that the filesystem's case sensitivity differs from the\n * platform default. If set `true` on case-sensitive file\n * systems, or `false` on case-insensitive file systems, then the\n * walk may return more or less results than expected.\n */\n nocase?: boolean\n\n /**\n * Do not match directories, only files. (Note: to match\n * _only_ directories, put a `/` at the end of the pattern.)\n */\n nodir?: boolean\n\n /**\n * Do not match \"extglob\" patterns such as `+(a|b)`.\n */\n noext?: boolean\n\n /**\n * Do not match `**` against multiple filenames. (Ie, treat it as a normal\n * `*` instead.)\n *\n * Conflicts with {@link matchBase}\n */\n noglobstar?: boolean\n\n /**\n * Defaults to value of `process.platform` if available, or `'linux'` if\n * not. Setting `platform:'win32'` on non-Windows systems may cause strange\n * behavior.\n */\n platform?: NodeJS.Platform\n\n /**\n * Set to true to call `fs.realpath` on all of the\n * results. In the case of an entry that cannot be resolved, the\n * entry is omitted. This incurs a slight performance penalty, of\n * course, because of the added system calls.\n */\n realpath?: boolean\n\n /**\n *\n * A string path resolved against the `cwd` option, which\n * is used as the starting point for absolute patterns that start\n * with `/`, (but not drive letters or UNC paths on Windows).\n *\n * Note that this _doesn't_ necessarily limit the walk to the\n * `root` directory, and doesn't affect the cwd starting point for\n * non-absolute patterns. A pattern containing `..` will still be\n * able to traverse out of the root directory, if it is not an\n * actual root directory on the filesystem, and any non-absolute\n * patterns will be matched in the `cwd`. For example, the\n * pattern `/../*` with `{root:'/some/path'}` will return all\n * files in `/some`, not all files in `/some/path`. The pattern\n * `*` with `{root:'/some/path'}` will return all the entries in\n * the cwd, not the entries in `/some/path`.\n *\n * To start absolute and non-absolute patterns in the same\n * path, you can use `{root:''}`. However, be aware that on\n * Windows systems, a pattern like `x:/*` or `//host/share/*` will\n * _always_ start in the `x:/` or `//host/share` directory,\n * regardless of the `root` setting.\n */\n root?: string\n\n /**\n * A [PathScurry](http://npm.im/path-scurry) object used\n * to traverse the file system. If the `nocase` option is set\n * explicitly, then any provided `scurry` object must match this\n * setting.\n */\n scurry?: PathScurry\n\n /**\n * Call `lstat()` on all entries, whether required or not to determine\n * if it's a valid match. When used with {@link withFileTypes}, this means\n * that matches will include data such as modified time, permissions, and\n * so on. Note that this will incur a performance cost due to the added\n * system calls.\n */\n stat?: boolean\n\n /**\n * An AbortSignal which will cancel the Glob walk when\n * triggered.\n */\n signal?: AbortSignal\n\n /**\n * Use `\\\\` as a path separator _only_, and\n * _never_ as an escape character. If set, all `\\\\` characters are\n * replaced with `/` in the pattern.\n *\n * Note that this makes it **impossible** to match against paths\n * containing literal glob pattern characters, but allows matching\n * with patterns constructed using `path.join()` and\n * `path.resolve()` on Windows platforms, mimicking the (buggy!)\n * behavior of Glob v7 and before on Windows. Please use with\n * caution, and be mindful of [the caveat below about Windows\n * paths](#windows). (For legacy reasons, this is also set if\n * `allowWindowsEscape` is set to the exact value `false`.)\n */\n windowsPathsNoEscape?: boolean\n\n /**\n * Return [PathScurry](http://npm.im/path-scurry)\n * `Path` objects instead of strings. These are similar to a\n * NodeJS `Dirent` object, but with additional methods and\n * properties.\n *\n * Conflicts with {@link absolute}\n */\n withFileTypes?: boolean\n\n /**\n * An fs implementation to override some or all of the defaults. See\n * http://npm.im/path-scurry for details about what can be overridden.\n */\n fs?: FSOption\n\n /**\n * Just passed along to Minimatch. Note that this makes all pattern\n * matching operations slower and *extremely* noisy.\n */\n debug?: boolean\n\n /**\n * Return `/` delimited paths, even on Windows.\n *\n * On posix systems, this has no effect. But, on Windows, it means that\n * paths will be `/` delimited, and absolute paths will be their full\n * resolved UNC forms, eg instead of `'C:\\\\foo\\\\bar'`, it would return\n * `'//?/C:/foo/bar'`\n */\n posix?: boolean\n\n /**\n * Do not match any children of any matches. For example, the pattern\n * `**\\/foo` would match `a/foo`, but not `a/foo/b/foo` in this mode.\n *\n * This is especially useful for cases like \"find all `node_modules`\n * folders, but not the ones in `node_modules`\".\n *\n * In order to support this, the `Ignore` implementation must support an\n * `add(pattern: string)` method. If using the default `Ignore` class, then\n * this is fine, but if this is set to `false`, and a custom `Ignore` is\n * provided that does not have an `add()` method, then it will throw an\n * error.\n *\n * **Caveat** It *only* ignores matches that would be a descendant of a\n * previous match, and only if that descendant is matched *after* the\n * ancestor is encountered. Since the file system walk happens in\n * indeterminate order, it's possible that a match will already be added\n * before its ancestor, if multiple or braced patterns are used.\n *\n * For example:\n *\n * ```ts\n * const results = await glob([\n * // likely to match first, since it's just a stat\n * 'a/b/c/d/e/f',\n *\n * // this pattern is more complicated! It must to various readdir()\n * // calls and test the results against a regular expression, and that\n * // is certainly going to take a little bit longer.\n * //\n * // So, later on, it encounters a match at 'a/b/c/d/e', but it's too\n * // late to ignore a/b/c/d/e/f, because it's already been emitted.\n * 'a/[bdf]/?/[a-z]/*',\n * ], { includeChildMatches: false })\n * ```\n *\n * It's best to only set this to `false` if you can be reasonably sure that\n * no components of the pattern will potentially match one another's file\n * system descendants, or if the occasional included child entry will not\n * cause problems.\n *\n * @default true\n */\n includeChildMatches?: boolean\n}\n\nexport type GlobOptionsWithFileTypesTrue = GlobOptions & {\n withFileTypes: true\n // string options not relevant if returning Path objects.\n absolute?: undefined\n mark?: undefined\n posix?: undefined\n}\n\nexport type GlobOptionsWithFileTypesFalse = GlobOptions & {\n withFileTypes?: false\n}\n\nexport type GlobOptionsWithFileTypesUnset = GlobOptions & {\n withFileTypes?: undefined\n}\n\nexport type Result =\n Opts extends GlobOptionsWithFileTypesTrue ? Path\n : Opts extends GlobOptionsWithFileTypesFalse ? string\n : Opts extends GlobOptionsWithFileTypesUnset ? string\n : string | Path\nexport type Results = Result[]\n\nexport type FileTypes =\n Opts extends GlobOptionsWithFileTypesTrue ? true\n : Opts extends GlobOptionsWithFileTypesFalse ? false\n : Opts extends GlobOptionsWithFileTypesUnset ? false\n : boolean\n\n/**\n * An object that can perform glob pattern traversals.\n */\nexport class Glob implements GlobOptions {\n absolute?: boolean\n cwd: string\n root?: string\n dot: boolean\n dotRelative: boolean\n follow: boolean\n ignore?: string | string[] | IgnoreLike\n magicalBraces: boolean\n mark?: boolean\n matchBase: boolean\n maxDepth: number\n nobrace: boolean\n nocase: boolean\n nodir: boolean\n noext: boolean\n noglobstar: boolean\n pattern: string[]\n platform: NodeJS.Platform\n realpath: boolean\n scurry: PathScurry\n stat: boolean\n signal?: AbortSignal\n windowsPathsNoEscape: boolean\n withFileTypes: FileTypes\n includeChildMatches: boolean\n\n /**\n * The options provided to the constructor.\n */\n opts: Opts\n\n /**\n * An array of parsed immutable {@link Pattern} objects.\n */\n patterns: Pattern[]\n\n /**\n * All options are stored as properties on the `Glob` object.\n *\n * See {@link GlobOptions} for full options descriptions.\n *\n * Note that a previous `Glob` object can be passed as the\n * `GlobOptions` to another `Glob` instantiation to re-use settings\n * and caches with a new pattern.\n *\n * Traversal functions can be called multiple times to run the walk\n * again.\n */\n constructor(pattern: string | string[], opts: Opts) {\n /* c8 ignore start */\n if (!opts) throw new TypeError('glob options required')\n /* c8 ignore stop */\n this.withFileTypes = !!opts.withFileTypes as FileTypes\n this.signal = opts.signal\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.dotRelative = !!opts.dotRelative\n this.nodir = !!opts.nodir\n this.mark = !!opts.mark\n if (!opts.cwd) {\n this.cwd = ''\n } else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {\n opts.cwd = fileURLToPath(opts.cwd)\n }\n this.cwd = opts.cwd || ''\n this.root = opts.root\n this.magicalBraces = !!opts.magicalBraces\n this.nobrace = !!opts.nobrace\n this.noext = !!opts.noext\n this.realpath = !!opts.realpath\n this.absolute = opts.absolute\n this.includeChildMatches = opts.includeChildMatches !== false\n\n this.noglobstar = !!opts.noglobstar\n this.matchBase = !!opts.matchBase\n this.maxDepth =\n typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity\n this.stat = !!opts.stat\n this.ignore = opts.ignore\n\n if (this.withFileTypes && this.absolute !== undefined) {\n throw new Error('cannot set absolute and withFileTypes:true')\n }\n\n if (typeof pattern === 'string') {\n pattern = [pattern]\n }\n\n this.windowsPathsNoEscape =\n !!opts.windowsPathsNoEscape ||\n (opts as { allowWindowsEscape?: boolean }).allowWindowsEscape ===\n false\n\n if (this.windowsPathsNoEscape) {\n pattern = pattern.map(p => p.replace(/\\\\/g, '/'))\n }\n\n if (this.matchBase) {\n if (opts.noglobstar) {\n throw new TypeError('base matching requires globstar')\n }\n pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`))\n }\n\n this.pattern = pattern\n\n this.platform = opts.platform || defaultPlatform\n this.opts = { ...opts, platform: this.platform }\n if (opts.scurry) {\n this.scurry = opts.scurry\n if (\n opts.nocase !== undefined &&\n opts.nocase !== opts.scurry.nocase\n ) {\n throw new Error('nocase option contradicts provided scurry option')\n }\n } else {\n const Scurry =\n opts.platform === 'win32' ? PathScurryWin32\n : opts.platform === 'darwin' ? PathScurryDarwin\n : opts.platform ? PathScurryPosix\n : PathScurry\n this.scurry = new Scurry(this.cwd, {\n nocase: opts.nocase,\n fs: opts.fs,\n })\n }\n this.nocase = this.scurry.nocase\n\n // If you do nocase:true on a case-sensitive file system, then\n // we need to use regexps instead of strings for non-magic\n // path portions, because statting `aBc` won't return results\n // for the file `AbC` for example.\n const nocaseMagicOnly =\n this.platform === 'darwin' || this.platform === 'win32'\n\n const mmo: MinimatchOptions = {\n // default nocase based on platform\n ...opts,\n dot: this.dot,\n matchBase: this.matchBase,\n nobrace: this.nobrace,\n nocase: this.nocase,\n nocaseMagicOnly,\n nocomment: true,\n noext: this.noext,\n nonegate: true,\n optimizationLevel: 2,\n platform: this.platform,\n windowsPathsNoEscape: this.windowsPathsNoEscape,\n debug: !!this.opts.debug,\n }\n\n const mms = this.pattern.map(p => new Minimatch(p, mmo))\n const [matchSet, globParts] = mms.reduce(\n (set: [MatchSet, GlobParts], m) => {\n set[0].push(...m.set)\n set[1].push(...m.globParts)\n return set\n },\n [[], []],\n )\n this.patterns = matchSet.map((set, i) => {\n const g = globParts[i]\n /* c8 ignore start */\n if (!g) throw new Error('invalid pattern object')\n /* c8 ignore stop */\n return new Pattern(set, g, 0, this.platform)\n })\n }\n\n /**\n * Returns a Promise that resolves to the results array.\n */\n async walk(): Promise>\n async walk(): Promise<(string | Path)[]> {\n // Walkers always return array of Path objects, so we just have to\n // coerce them into the right shape. It will have already called\n // realpath() if the option was set to do so, so we know that's cached.\n // start out knowing the cwd, at least\n return [\n ...(await new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity ?\n this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n includeChildMatches: this.includeChildMatches,\n }).walk()),\n ]\n }\n\n /**\n * synchronous {@link Glob.walk}\n */\n walkSync(): Results\n walkSync(): (string | Path)[] {\n return [\n ...new GlobWalker(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity ?\n this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n includeChildMatches: this.includeChildMatches,\n }).walkSync(),\n ]\n }\n\n /**\n * Stream results asynchronously.\n */\n stream(): Minipass, Result>\n stream(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity ?\n this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n includeChildMatches: this.includeChildMatches,\n }).stream()\n }\n\n /**\n * Stream results synchronously.\n */\n streamSync(): Minipass, Result>\n streamSync(): Minipass {\n return new GlobStream(this.patterns, this.scurry.cwd, {\n ...this.opts,\n maxDepth:\n this.maxDepth !== Infinity ?\n this.maxDepth + this.scurry.cwd.depth()\n : Infinity,\n platform: this.platform,\n nocase: this.nocase,\n includeChildMatches: this.includeChildMatches,\n }).streamSync()\n }\n\n /**\n * Default sync iteration function. Returns a Generator that\n * iterates over the results.\n */\n iterateSync(): Generator, void, void> {\n return this.streamSync()[Symbol.iterator]()\n }\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n /**\n * Default async iteration function. Returns an AsyncGenerator that\n * iterates over the results.\n */\n iterate(): AsyncGenerator, void, void> {\n return this.stream()[Symbol.asyncIterator]()\n }\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/has-magic.d.ts b/node_modules/npm/node_modules/glob/dist/esm/has-magic.d.ts new file mode 100644 index 00000000..8aec3bd9 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/has-magic.d.ts @@ -0,0 +1,14 @@ +import { GlobOptions } from './glob.js'; +/** + * 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 declare const hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean; +//# sourceMappingURL=has-magic.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/has-magic.d.ts.map b/node_modules/npm/node_modules/glob/dist/esm/has-magic.d.ts.map new file mode 100644 index 00000000..b24dd4ec --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/has-magic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"has-magic.d.ts","sourceRoot":"","sources":["../../src/has-magic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,YACV,MAAM,GAAG,MAAM,EAAE,YACjB,WAAW,KACnB,OAQF,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/has-magic.js b/node_modules/npm/node_modules/glob/dist/esm/has-magic.js new file mode 100644 index 00000000..ba2321ab --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/has-magic.js @@ -0,0 +1,23 @@ +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/npm/node_modules/glob/dist/esm/has-magic.js.map b/node_modules/npm/node_modules/glob/dist/esm/has-magic.js.map new file mode 100644 index 00000000..a20f5aa2 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/has-magic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"has-magic.js","sourceRoot":"","sources":["../../src/has-magic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAGrC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,OAA0B,EAC1B,UAAuB,EAAE,EAChB,EAAE;IACX,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,IAAI,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE;YAAE,OAAO,IAAI,CAAA;IACvD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { Minimatch } from 'minimatch'\nimport { GlobOptions } from './glob.js'\n\n/**\n * Return true if the patterns provided contain any magic glob characters,\n * given the options provided.\n *\n * Brace expansion is not considered \"magic\" unless the `magicalBraces` option\n * is set, as brace expansion just turns one string into an array of strings.\n * So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and\n * `'xby'` both do not contain any magic glob characters, and it's treated the\n * same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`\n * is in the options, brace expansion _is_ treated as a pattern having magic.\n */\nexport const hasMagic = (\n pattern: string | string[],\n options: GlobOptions = {},\n): boolean => {\n if (!Array.isArray(pattern)) {\n pattern = [pattern]\n }\n for (const p of pattern) {\n if (new Minimatch(p, options).hasMagic()) return true\n }\n return false\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/ignore.d.ts b/node_modules/npm/node_modules/glob/dist/esm/ignore.d.ts new file mode 100644 index 00000000..1893b16d --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/ignore.d.ts @@ -0,0 +1,24 @@ +import { Minimatch, MinimatchOptions } from 'minimatch'; +import { Path } from 'path-scurry'; +import { GlobWalkerOpts } from './walker.js'; +export interface IgnoreLike { + ignored?: (p: Path) => boolean; + childrenIgnored?: (p: Path) => boolean; + add?: (ignore: string) => void; +} +/** + * Class used to process ignored patterns + */ +export declare class Ignore implements IgnoreLike { + relative: Minimatch[]; + relativeChildren: Minimatch[]; + absolute: Minimatch[]; + absoluteChildren: Minimatch[]; + platform: NodeJS.Platform; + mmopts: MinimatchOptions; + constructor(ignored: string[], { nobrace, nocase, noext, noglobstar, platform, }: GlobWalkerOpts); + add(ign: string): void; + ignored(p: Path): boolean; + childrenIgnored(p: Path): boolean; +} +//# sourceMappingURL=ignore.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/ignore.d.ts.map b/node_modules/npm/node_modules/glob/dist/esm/ignore.d.ts.map new file mode 100644 index 00000000..57d6ab61 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/ignore.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../../src/ignore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAA;IAC9B,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAA;IACtC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B;AAWD;;GAEG;AACH,qBAAa,MAAO,YAAW,UAAU;IACvC,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,gBAAgB,EAAE,SAAS,EAAE,CAAA;IAC7B,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,gBAAgB,EAAE,SAAS,EAAE,CAAA;IAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAA;IACzB,MAAM,EAAE,gBAAgB,CAAA;gBAGtB,OAAO,EAAE,MAAM,EAAE,EACjB,EACE,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,QAA0B,GAC3B,EAAE,cAAc;IAqBnB,GAAG,CAAC,GAAG,EAAE,MAAM;IAyCf,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,OAAO;IAczB,eAAe,CAAC,CAAC,EAAE,IAAI,GAAG,OAAO;CAWlC"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/ignore.js b/node_modules/npm/node_modules/glob/dist/esm/ignore.js new file mode 100644 index 00000000..539c4a4f --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/ignore.js @@ -0,0 +1,115 @@ +// 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; + platform; + mmopts; + constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform, }) { + this.relative = []; + this.absolute = []; + this.relativeChildren = []; + this.absoluteChildren = []; + this.platform = platform; + this.mmopts = { + dot: true, + nobrace, + nocase, + noext, + noglobstar, + optimizationLevel: 2, + platform, + nocomment: true, + nonegate: true, + }; + for (const ign of ignored) + this.add(ign); + } + add(ign) { + // 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. + const mm = new Minimatch(ign, this.mmopts); + for (let i = 0; i < mm.set.length; i++) { + const parsed = mm.set[i]; + const globParts = mm.globParts[i]; + /* c8 ignore start */ + if (!parsed || !globParts) { + throw new Error('invalid pattern object'); + } + // strip off leading ./ portions + // https://github.com/isaacs/node-glob/issues/570 + while (parsed[0] === '.' && globParts[0] === '.') { + parsed.shift(); + globParts.shift(); + } + /* c8 ignore stop */ + const p = new Pattern(parsed, globParts, 0, this.platform); + const m = new Minimatch(p.globString(), this.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)) + return true; + } + return false; + } +} +//# sourceMappingURL=ignore.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/ignore.js.map b/node_modules/npm/node_modules/glob/dist/esm/ignore.js.map new file mode 100644 index 00000000..2cddba2e --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/ignore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ignore.js","sourceRoot":"","sources":["../../src/ignore.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,kCAAkC;AAClC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MAAM,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC;gBAAE,OAAO,IAAI,CAAA;QACpC,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF","sourcesContent":["// give it a pattern, and it'll be able to tell you if\n// a given path should be ignored.\n// Ignoring a path ignores its children if the pattern ends in /**\n// Ignores are always parsed in dot:true mode\n\nimport { Minimatch, MinimatchOptions } from 'minimatch'\nimport { Path } from 'path-scurry'\nimport { Pattern } from './pattern.js'\nimport { GlobWalkerOpts } from './walker.js'\n\nexport interface IgnoreLike {\n ignored?: (p: Path) => boolean\n childrenIgnored?: (p: Path) => boolean\n add?: (ignore: string) => void\n}\n\nconst defaultPlatform: NodeJS.Platform =\n (\n typeof process === 'object' &&\n process &&\n typeof process.platform === 'string'\n ) ?\n process.platform\n : 'linux'\n\n/**\n * Class used to process ignored patterns\n */\nexport class Ignore implements IgnoreLike {\n relative: Minimatch[]\n relativeChildren: Minimatch[]\n absolute: Minimatch[]\n absoluteChildren: Minimatch[]\n platform: NodeJS.Platform\n mmopts: MinimatchOptions\n\n constructor(\n ignored: string[],\n {\n nobrace,\n nocase,\n noext,\n noglobstar,\n platform = defaultPlatform,\n }: GlobWalkerOpts,\n ) {\n this.relative = []\n this.absolute = []\n this.relativeChildren = []\n this.absoluteChildren = []\n this.platform = platform\n this.mmopts = {\n dot: true,\n nobrace,\n nocase,\n noext,\n noglobstar,\n optimizationLevel: 2,\n platform,\n nocomment: true,\n nonegate: true,\n }\n for (const ign of ignored) this.add(ign)\n }\n\n add(ign: string) {\n // this is a little weird, but it gives us a clean set of optimized\n // minimatch matchers, without getting tripped up if one of them\n // ends in /** inside a brace section, and it's only inefficient at\n // the start of the walk, not along it.\n // It'd be nice if the Pattern class just had a .test() method, but\n // handling globstars is a bit of a pita, and that code already lives\n // in minimatch anyway.\n // Another way would be if maybe Minimatch could take its set/globParts\n // as an option, and then we could at least just use Pattern to test\n // for absolute-ness.\n // Yet another way, Minimatch could take an array of glob strings, and\n // a cwd option, and do the right thing.\n const mm = new Minimatch(ign, this.mmopts)\n for (let i = 0; i < mm.set.length; i++) {\n const parsed = mm.set[i]\n const globParts = mm.globParts[i]\n /* c8 ignore start */\n if (!parsed || !globParts) {\n throw new Error('invalid pattern object')\n }\n // strip off leading ./ portions\n // https://github.com/isaacs/node-glob/issues/570\n while (parsed[0] === '.' && globParts[0] === '.') {\n parsed.shift()\n globParts.shift()\n }\n /* c8 ignore stop */\n const p = new Pattern(parsed, globParts, 0, this.platform)\n const m = new Minimatch(p.globString(), this.mmopts)\n const children = globParts[globParts.length - 1] === '**'\n const absolute = p.isAbsolute()\n if (absolute) this.absolute.push(m)\n else this.relative.push(m)\n if (children) {\n if (absolute) this.absoluteChildren.push(m)\n else this.relativeChildren.push(m)\n }\n }\n }\n\n ignored(p: Path): boolean {\n const fullpath = p.fullpath()\n const fullpaths = `${fullpath}/`\n const relative = p.relative() || '.'\n const relatives = `${relative}/`\n for (const m of this.relative) {\n if (m.match(relative) || m.match(relatives)) return true\n }\n for (const m of this.absolute) {\n if (m.match(fullpath) || m.match(fullpaths)) return true\n }\n return false\n }\n\n childrenIgnored(p: Path): boolean {\n const fullpath = p.fullpath() + '/'\n const relative = (p.relative() || '.') + '/'\n for (const m of this.relativeChildren) {\n if (m.match(relative)) return true\n }\n for (const m of this.absoluteChildren) {\n if (m.match(fullpath)) return true\n }\n return false\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/index.d.ts b/node_modules/npm/node_modules/glob/dist/esm/index.d.ts new file mode 100644 index 00000000..9c326ddc --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/index.d.ts @@ -0,0 +1,97 @@ +import { Minipass } from 'minipass'; +import { Path } from 'path-scurry'; +import type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset } from './glob.js'; +import { Glob } from './glob.js'; +export { escape, unescape } from 'minimatch'; +export type { FSOption, Path, WalkOptions, WalkOptionsWithFileTypesTrue, WalkOptionsWithFileTypesUnset, } from 'path-scurry'; +export { Glob } from './glob.js'; +export type { GlobOptions, GlobOptionsWithFileTypesFalse, GlobOptionsWithFileTypesTrue, GlobOptionsWithFileTypesUnset, } from './glob.js'; +export { hasMagic } from './has-magic.js'; +export { Ignore } from './ignore.js'; +export type { IgnoreLike } from './ignore.js'; +export type { MatchStream } from './walker.js'; +/** + * Syncronous form of {@link globStream}. Will read all the matches as fast as + * you consume them, even all in a single tick if you consume them immediately, + * but will still respond to backpressure if they're not consumed immediately. + */ +export declare function globStreamSync(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass; +export declare function globStreamSync(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass; +export declare function globStreamSync(pattern: string | string[], options: GlobOptionsWithFileTypesUnset): Minipass; +export declare function globStreamSync(pattern: string | string[], options: GlobOptions): Minipass | Minipass; +/** + * Return a stream that emits all the strings or `Path` objects and + * then emits `end` when completed. + */ +export declare function globStream(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Minipass; +export declare function globStream(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Minipass; +export declare function globStream(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): Minipass; +export declare function globStream(pattern: string | string[], options: GlobOptions): Minipass | Minipass; +/** + * Synchronous form of {@link glob} + */ +export declare function globSync(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): string[]; +export declare function globSync(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Path[]; +export declare function globSync(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): string[]; +export declare function globSync(pattern: string | string[], options: GlobOptions): Path[] | string[]; +/** + * Perform an asynchronous glob search for the pattern(s) specified. Returns + * [Path](https://isaacs.github.io/path-scurry/classes/PathBase) objects if the + * {@link withFileTypes} option is set to `true`. See {@link GlobOptions} for + * full option descriptions. + */ +declare function glob_(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): Promise; +declare function glob_(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Promise; +declare function glob_(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Promise; +declare function glob_(pattern: string | string[], options: GlobOptions): Promise; +/** + * Return a sync iterator for walking glob pattern matches. + */ +export declare function globIterateSync(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): Generator; +export declare function globIterateSync(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): Generator; +export declare function globIterateSync(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): Generator; +export declare function globIterateSync(pattern: string | string[], options: GlobOptions): Generator | Generator; +/** + * Return an async iterator for walking glob pattern matches. + */ +export declare function globIterate(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): AsyncGenerator; +export declare function globIterate(pattern: string | string[], options: GlobOptionsWithFileTypesTrue): AsyncGenerator; +export declare function globIterate(pattern: string | string[], options: GlobOptionsWithFileTypesFalse): AsyncGenerator; +export declare function globIterate(pattern: string | string[], options: GlobOptions): AsyncGenerator | AsyncGenerator; +export declare const streamSync: typeof globStreamSync; +export declare const stream: typeof globStream & { + sync: typeof globStreamSync; +}; +export declare const iterateSync: typeof globIterateSync; +export declare const iterate: typeof globIterate & { + sync: typeof globIterateSync; +}; +export declare const sync: typeof globSync & { + stream: typeof globStreamSync; + iterate: typeof globIterateSync; +}; +export declare const glob: typeof glob_ & { + glob: typeof glob_; + globSync: typeof globSync; + sync: typeof globSync & { + stream: typeof globStreamSync; + iterate: typeof globIterateSync; + }; + globStream: typeof globStream; + stream: typeof globStream & { + sync: typeof globStreamSync; + }; + globStreamSync: typeof globStreamSync; + streamSync: typeof globStreamSync; + globIterate: typeof globIterate; + iterate: typeof globIterate & { + sync: typeof globIterateSync; + }; + globIterateSync: typeof globIterateSync; + iterateSync: typeof globIterateSync; + Glob: typeof Glob; + hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean; + escape: (s: string, { windowsPathsNoEscape, }?: Pick) => string; + unescape: (s: string, { windowsPathsNoEscape, }?: Pick) => string; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/index.d.ts.map b/node_modules/npm/node_modules/glob/dist/esm/index.d.ts.map new file mode 100644 index 00000000..5fb32252 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,KAAK,EACV,WAAW,EACX,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC5C,YAAY,EACV,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,YAAY,EACV,WAAW,EACX,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,EAAE,4BAA4B,GACpC,QAAQ,CAAC,IA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AAA;AAC1C,eAAO,MAAM,OAAO;;CAElB,CAAA;AACF,eAAO,MAAM,IAAI;;;CAGf,CAAA;AAEF,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;CAgBf,CAAA"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/index.js b/node_modules/npm/node_modules/glob/dist/esm/index.js new file mode 100644 index 00000000..e15c1f9c --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/index.js @@ -0,0 +1,55 @@ +import { escape, unescape } from 'minimatch'; +import { Glob } from './glob.js'; +import { hasMagic } from './has-magic.js'; +export { escape, unescape } from 'minimatch'; +export { Glob } from './glob.js'; +export { hasMagic } from './has-magic.js'; +export { Ignore } from './ignore.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, +}); +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/npm/node_modules/glob/dist/esm/index.js.map b/node_modules/npm/node_modules/glob/dist/esm/index.js.map new file mode 100644 index 00000000..a4f93dd0 --- /dev/null +++ b/node_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AACjD,CAAC;AAqBD,MAAM,UAAU,WAAW,CACzB,OAA0B,EAC1B,UAAuB,EAAE;IAEzB,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,CAAA;AAC7C,CAAC;AAED,iEAAiE;AACjE,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAA;AACxC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAA;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAA;AAC1C,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;IAChD,IAAI,EAAE,eAAe;CACtB,CAAC,CAAA;AACF,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;IAC1C,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,eAAe;CACzB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;IACvC,IAAI,EAAE,KAAK;IACX,QAAQ;IACR,IAAI;IACJ,UAAU;IACV,MAAM;IACN,cAAc;IACd,UAAU;IACV,WAAW;IACX,OAAO;IACP,eAAe;IACf,WAAW;IACX,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,QAAQ;CACT,CAAC,CAAA;AACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA","sourcesContent":["import { escape, unescape } from 'minimatch'\nimport { Minipass } from 'minipass'\nimport { Path } from 'path-scurry'\nimport type {\n GlobOptions,\n GlobOptionsWithFileTypesFalse,\n GlobOptionsWithFileTypesTrue,\n GlobOptionsWithFileTypesUnset,\n} from './glob.js'\nimport { Glob } from './glob.js'\nimport { hasMagic } from './has-magic.js'\n\nexport { escape, unescape } from 'minimatch'\nexport type {\n FSOption,\n Path,\n WalkOptions,\n WalkOptionsWithFileTypesTrue,\n WalkOptionsWithFileTypesUnset,\n} from 'path-scurry'\nexport { Glob } from './glob.js'\nexport type {\n GlobOptions,\n GlobOptionsWithFileTypesFalse,\n GlobOptionsWithFileTypesTrue,\n GlobOptionsWithFileTypesUnset,\n} from './glob.js'\nexport { hasMagic } from './has-magic.js'\nexport { Ignore } from './ignore.js'\nexport type { IgnoreLike } from './ignore.js'\nexport type { MatchStream } from './walker.js'\n\n/**\n * Syncronous form of {@link globStream}. Will read all the matches as fast as\n * you consume them, even all in a single tick if you consume them immediately,\n * but will still respond to backpressure if they're not consumed immediately.\n */\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): Minipass\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): Minipass\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesUnset,\n): Minipass\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptions,\n): Minipass | Minipass\nexport function globStreamSync(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).streamSync()\n}\n\n/**\n * Return a stream that emits all the strings or `Path` objects and\n * then emits `end` when completed.\n */\nexport function globStream(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): Minipass\nexport function globStream(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): Minipass\nexport function globStream(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined,\n): Minipass\nexport function globStream(\n pattern: string | string[],\n options: GlobOptions,\n): Minipass | Minipass\nexport function globStream(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).stream()\n}\n\n/**\n * Synchronous form of {@link glob}\n */\nexport function globSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): string[]\nexport function globSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): Path[]\nexport function globSync(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined,\n): string[]\nexport function globSync(\n pattern: string | string[],\n options: GlobOptions,\n): Path[] | string[]\nexport function globSync(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).walkSync()\n}\n\n/**\n * Perform an asynchronous glob search for the pattern(s) specified. Returns\n * [Path](https://isaacs.github.io/path-scurry/classes/PathBase) objects if the\n * {@link withFileTypes} option is set to `true`. See {@link GlobOptions} for\n * full option descriptions.\n */\nasync function glob_(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined,\n): Promise\nasync function glob_(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): Promise\nasync function glob_(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): Promise\nasync function glob_(\n pattern: string | string[],\n options: GlobOptions,\n): Promise\nasync function glob_(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).walk()\n}\n\n/**\n * Return a sync iterator for walking glob pattern matches.\n */\nexport function globIterateSync(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined,\n): Generator\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): Generator\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): Generator\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptions,\n): Generator | Generator\nexport function globIterateSync(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).iterateSync()\n}\n\n/**\n * Return an async iterator for walking glob pattern matches.\n */\nexport function globIterate(\n pattern: string | string[],\n options?: GlobOptionsWithFileTypesUnset | undefined,\n): AsyncGenerator\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesTrue,\n): AsyncGenerator\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptionsWithFileTypesFalse,\n): AsyncGenerator\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptions,\n): AsyncGenerator | AsyncGenerator\nexport function globIterate(\n pattern: string | string[],\n options: GlobOptions = {},\n) {\n return new Glob(pattern, options).iterate()\n}\n\n// aliases: glob.sync.stream() glob.stream.sync() glob.sync() etc\nexport const streamSync = globStreamSync\nexport const stream = Object.assign(globStream, { sync: globStreamSync })\nexport const iterateSync = globIterateSync\nexport const iterate = Object.assign(globIterate, {\n sync: globIterateSync,\n})\nexport const sync = Object.assign(globSync, {\n stream: globStreamSync,\n iterate: globIterateSync,\n})\n\nexport const glob = Object.assign(glob_, {\n glob: glob_,\n globSync,\n sync,\n globStream,\n stream,\n globStreamSync,\n streamSync,\n globIterate,\n iterate,\n globIterateSync,\n iterateSync,\n Glob,\n hasMagic,\n escape,\n unescape,\n})\nglob.glob = glob\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/package.json b/node_modules/npm/node_modules/glob/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/glob/dist/esm/pattern.d.ts b/node_modules/npm/node_modules/glob/dist/esm/pattern.d.ts new file mode 100644 index 00000000..9636df3b --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/pattern.d.ts @@ -0,0 +1,76 @@ +import { GLOBSTAR } from 'minimatch'; +export type MMPattern = string | RegExp | typeof GLOBSTAR; +export type PatternList = [p: MMPattern, ...rest: MMPattern[]]; +export type UNCPatternList = [ + p0: '', + p1: '', + p2: string, + p3: string, + ...rest: MMPattern[] +]; +export type DrivePatternList = [p0: string, ...rest: MMPattern[]]; +export type AbsolutePatternList = [p0: '', ...rest: MMPattern[]]; +export type GlobList = [p: string, ...rest: string[]]; +/** + * An immutable-ish view on an array of glob parts and their parsed + * results + */ +export declare class Pattern { + #private; + readonly length: number; + constructor(patternList: MMPattern[], globList: string[], index: number, platform: NodeJS.Platform); + /** + * The first entry in the parsed list of patterns + */ + pattern(): MMPattern; + /** + * true of if pattern() returns a string + */ + isString(): boolean; + /** + * true of if pattern() returns GLOBSTAR + */ + isGlobstar(): boolean; + /** + * true if pattern() returns a regexp + */ + isRegExp(): boolean; + /** + * The /-joined set of glob parts that make up this pattern + */ + globString(): string; + /** + * true if there are more pattern parts after this one + */ + hasMore(): boolean; + /** + * The rest of the pattern after this part, or null if this is the end + */ + rest(): Pattern | null; + /** + * true if the pattern represents a //unc/path/ on windows + */ + isUNC(): boolean; + /** + * True if the pattern starts with a drive letter on Windows + */ + isDrive(): boolean; + /** + * True if the pattern is rooted on an absolute path + */ + isAbsolute(): boolean; + /** + * consume the root of the pattern, and return it + */ + root(): string; + /** + * Check to see if the current globstar pattern is allowed to follow + * a symbolic link. + */ + checkFollowGlobstar(): boolean; + /** + * Mark that the current globstar pattern is following a symbolic link + */ + markFollowGlobstar(): boolean; +} +//# sourceMappingURL=pattern.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/pattern.d.ts.map b/node_modules/npm/node_modules/glob/dist/esm/pattern.d.ts.map new file mode 100644 index 00000000..cdf32234 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/pattern.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/pattern.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,QAAQ,CAAA;AAGzD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAC9D,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,GAAG,IAAI,EAAE,SAAS,EAAE;CACrB,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AACjE,MAAM,MAAM,mBAAmB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAChE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;AAMrD;;;GAGG;AACH,qBAAa,OAAO;;IAIlB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;gBAUrB,WAAW,EAAE,SAAS,EAAE,EACxB,QAAQ,EAAE,MAAM,EAAE,EAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;IA6D3B;;OAEG;IACH,OAAO,IAAI,SAAS;IAIpB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAGnB;;OAEG;IACH,UAAU,IAAI,OAAO;IAGrB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;OAEG;IACH,UAAU,IAAI,MAAM;IAUpB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,IAAI,IAAI,OAAO,GAAG,IAAI;IAetB;;OAEG;IACH,KAAK,IAAI,OAAO;IAoBhB;;OAEG;IACH,OAAO,IAAI,OAAO;IAelB;;OAEG;IACH,UAAU,IAAI,OAAO;IAUrB;;OAEG;IACH,IAAI,IAAI,MAAM;IASd;;;OAGG;IACH,mBAAmB,IAAI,OAAO;IAQ9B;;OAEG;IACH,kBAAkB,IAAI,OAAO;CAM9B"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/pattern.js b/node_modules/npm/node_modules/glob/dist/esm/pattern.js new file mode 100644 index 00000000..b41defa1 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/pattern.js @@ -0,0 +1,215 @@ +// 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/npm/node_modules/glob/dist/esm/pattern.js.map b/node_modules/npm/node_modules/glob/dist/esm/pattern.js.map new file mode 100644 index 00000000..566a306a --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/pattern.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../src/pattern.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAgBpC,MAAM,aAAa,GAAG,CAAC,EAAe,EAAqB,EAAE,CAC3D,EAAE,CAAC,MAAM,IAAI,CAAC,CAAA;AAChB,MAAM,UAAU,GAAG,CAAC,EAAY,EAAkB,EAAE,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,CAAA;AAEnE;;;GAGG;AACH,MAAM,OAAO,OAAO;IACT,YAAY,CAAa;IACzB,SAAS,CAAU;IACnB,MAAM,CAAQ;IACd,MAAM,CAAQ;IACd,SAAS,CAAiB;IACnC,KAAK,CAAiB;IACtB,WAAW,CAAS;IACpB,QAAQ,CAAU;IAClB,MAAM,CAAU;IAChB,WAAW,CAAU;IACrB,eAAe,GAAY,IAAI,CAAA;IAE/B,YACE,WAAwB,EACxB,QAAkB,EAClB,KAAa,EACb,QAAy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,CAAC,IAAI,CAAC,eAAe,CACtB,CAAA;IACH,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe;YAClE,OAAO,KAAK,CAAA;QACd,IAAI,CAAC,eAAe,GAAG,KAAK,CAAA;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["// this is just a very light wrapper around 2 arrays with an offset index\n\nimport { GLOBSTAR } from 'minimatch'\nexport type MMPattern = string | RegExp | typeof GLOBSTAR\n\n// an array of length >= 1\nexport type PatternList = [p: MMPattern, ...rest: MMPattern[]]\nexport type UNCPatternList = [\n p0: '',\n p1: '',\n p2: string,\n p3: string,\n ...rest: MMPattern[],\n]\nexport type DrivePatternList = [p0: string, ...rest: MMPattern[]]\nexport type AbsolutePatternList = [p0: '', ...rest: MMPattern[]]\nexport type GlobList = [p: string, ...rest: string[]]\n\nconst isPatternList = (pl: MMPattern[]): pl is PatternList =>\n pl.length >= 1\nconst isGlobList = (gl: string[]): gl is GlobList => gl.length >= 1\n\n/**\n * An immutable-ish view on an array of glob parts and their parsed\n * results\n */\nexport class Pattern {\n readonly #patternList: PatternList\n readonly #globList: GlobList\n readonly #index: number\n readonly length: number\n readonly #platform: NodeJS.Platform\n #rest?: Pattern | null\n #globString?: string\n #isDrive?: boolean\n #isUNC?: boolean\n #isAbsolute?: boolean\n #followGlobstar: boolean = true\n\n constructor(\n patternList: MMPattern[],\n globList: string[],\n index: number,\n platform: NodeJS.Platform,\n ) {\n if (!isPatternList(patternList)) {\n throw new TypeError('empty pattern list')\n }\n if (!isGlobList(globList)) {\n throw new TypeError('empty glob list')\n }\n if (globList.length !== patternList.length) {\n throw new TypeError('mismatched pattern list and glob list lengths')\n }\n this.length = patternList.length\n if (index < 0 || index >= this.length) {\n throw new TypeError('index out of range')\n }\n this.#patternList = patternList\n this.#globList = globList\n this.#index = index\n this.#platform = platform\n\n // normalize root entries of absolute patterns on initial creation.\n if (this.#index === 0) {\n // c: => ['c:/']\n // C:/ => ['C:/']\n // C:/x => ['C:/', 'x']\n // //host/share => ['//host/share/']\n // //host/share/ => ['//host/share/']\n // //host/share/x => ['//host/share/', 'x']\n // /etc => ['/', 'etc']\n // / => ['/']\n if (this.isUNC()) {\n // '' / '' / 'host' / 'share'\n const [p0, p1, p2, p3, ...prest] = this.#patternList\n const [g0, g1, g2, g3, ...grest] = this.#globList\n if (prest[0] === '') {\n // ends in /\n prest.shift()\n grest.shift()\n }\n const p = [p0, p1, p2, p3, ''].join('/')\n const g = [g0, g1, g2, g3, ''].join('/')\n this.#patternList = [p, ...prest]\n this.#globList = [g, ...grest]\n this.length = this.#patternList.length\n } else if (this.isDrive() || this.isAbsolute()) {\n const [p1, ...prest] = this.#patternList\n const [g1, ...grest] = this.#globList\n if (prest[0] === '') {\n // ends in /\n prest.shift()\n grest.shift()\n }\n const p = (p1 as string) + '/'\n const g = g1 + '/'\n this.#patternList = [p, ...prest]\n this.#globList = [g, ...grest]\n this.length = this.#patternList.length\n }\n }\n }\n\n /**\n * The first entry in the parsed list of patterns\n */\n pattern(): MMPattern {\n return this.#patternList[this.#index] as MMPattern\n }\n\n /**\n * true of if pattern() returns a string\n */\n isString(): boolean {\n return typeof this.#patternList[this.#index] === 'string'\n }\n /**\n * true of if pattern() returns GLOBSTAR\n */\n isGlobstar(): boolean {\n return this.#patternList[this.#index] === GLOBSTAR\n }\n /**\n * true if pattern() returns a regexp\n */\n isRegExp(): boolean {\n return this.#patternList[this.#index] instanceof RegExp\n }\n\n /**\n * The /-joined set of glob parts that make up this pattern\n */\n globString(): string {\n return (this.#globString =\n this.#globString ||\n (this.#index === 0 ?\n this.isAbsolute() ?\n this.#globList[0] + this.#globList.slice(1).join('/')\n : this.#globList.join('/')\n : this.#globList.slice(this.#index).join('/')))\n }\n\n /**\n * true if there are more pattern parts after this one\n */\n hasMore(): boolean {\n return this.length > this.#index + 1\n }\n\n /**\n * The rest of the pattern after this part, or null if this is the end\n */\n rest(): Pattern | null {\n if (this.#rest !== undefined) return this.#rest\n if (!this.hasMore()) return (this.#rest = null)\n this.#rest = new Pattern(\n this.#patternList,\n this.#globList,\n this.#index + 1,\n this.#platform,\n )\n this.#rest.#isAbsolute = this.#isAbsolute\n this.#rest.#isUNC = this.#isUNC\n this.#rest.#isDrive = this.#isDrive\n return this.#rest\n }\n\n /**\n * true if the pattern represents a //unc/path/ on windows\n */\n isUNC(): boolean {\n const pl = this.#patternList\n return this.#isUNC !== undefined ?\n this.#isUNC\n : (this.#isUNC =\n this.#platform === 'win32' &&\n this.#index === 0 &&\n pl[0] === '' &&\n pl[1] === '' &&\n typeof pl[2] === 'string' &&\n !!pl[2] &&\n typeof pl[3] === 'string' &&\n !!pl[3])\n }\n\n // pattern like C:/...\n // split = ['C:', ...]\n // XXX: would be nice to handle patterns like `c:*` to test the cwd\n // in c: for *, but I don't know of a way to even figure out what that\n // cwd is without actually chdir'ing into it?\n /**\n * True if the pattern starts with a drive letter on Windows\n */\n isDrive(): boolean {\n const pl = this.#patternList\n return this.#isDrive !== undefined ?\n this.#isDrive\n : (this.#isDrive =\n this.#platform === 'win32' &&\n this.#index === 0 &&\n this.length > 1 &&\n typeof pl[0] === 'string' &&\n /^[a-z]:$/i.test(pl[0]))\n }\n\n // pattern = '/' or '/...' or '/x/...'\n // split = ['', ''] or ['', ...] or ['', 'x', ...]\n // Drive and UNC both considered absolute on windows\n /**\n * True if the pattern is rooted on an absolute path\n */\n isAbsolute(): boolean {\n const pl = this.#patternList\n return this.#isAbsolute !== undefined ?\n this.#isAbsolute\n : (this.#isAbsolute =\n (pl[0] === '' && pl.length > 1) ||\n this.isDrive() ||\n this.isUNC())\n }\n\n /**\n * consume the root of the pattern, and return it\n */\n root(): string {\n const p = this.#patternList[0]\n return (\n typeof p === 'string' && this.isAbsolute() && this.#index === 0\n ) ?\n p\n : ''\n }\n\n /**\n * Check to see if the current globstar pattern is allowed to follow\n * a symbolic link.\n */\n checkFollowGlobstar(): boolean {\n return !(\n this.#index === 0 ||\n !this.isGlobstar() ||\n !this.#followGlobstar\n )\n }\n\n /**\n * Mark that the current globstar pattern is following a symbolic link\n */\n markFollowGlobstar(): boolean {\n if (this.#index === 0 || !this.isGlobstar() || !this.#followGlobstar)\n return false\n this.#followGlobstar = false\n return true\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/processor.d.ts b/node_modules/npm/node_modules/glob/dist/esm/processor.d.ts new file mode 100644 index 00000000..ccedfbf2 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/processor.d.ts @@ -0,0 +1,59 @@ +import { MMRegExp } from 'minimatch'; +import { Path } from 'path-scurry'; +import { Pattern } from './pattern.js'; +import { GlobWalkerOpts } from './walker.js'; +/** + * A cache of which patterns have been processed for a given Path + */ +export declare class HasWalkedCache { + store: Map>; + constructor(store?: Map>); + copy(): HasWalkedCache; + hasWalked(target: Path, pattern: Pattern): boolean | undefined; + storeWalked(target: Path, pattern: Pattern): void; +} +/** + * 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 declare class MatchRecord { + store: Map; + add(target: Path, absolute: boolean, ifDir: boolean): void; + entries(): [Path, boolean, boolean][]; +} +/** + * A collection of patterns that must be processed in a subsequent step + * for a given path. + */ +export declare class SubWalks { + store: Map; + add(target: Path, pattern: Pattern): void; + get(target: Path): Pattern[]; + entries(): [Path, Pattern[]][]; + keys(): Path[]; +} +/** + * 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 declare class Processor { + hasWalkedCache: HasWalkedCache; + matches: MatchRecord; + subwalks: SubWalks; + patterns?: Pattern[]; + follow: boolean; + dot: boolean; + opts: GlobWalkerOpts; + constructor(opts: GlobWalkerOpts, hasWalkedCache?: HasWalkedCache); + processPatterns(target: Path, patterns: Pattern[]): this; + subwalkTargets(): Path[]; + child(): Processor; + filterEntries(parent: Path, entries: Path[]): Processor; + testGlobstar(e: Path, pattern: Pattern, rest: Pattern | null, absolute: boolean): void; + testRegExp(e: Path, p: MMRegExp, rest: Pattern | null, absolute: boolean): void; + testString(e: Path, p: string, rest: Pattern | null, absolute: boolean): void; +} +//# sourceMappingURL=processor.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/processor.d.ts.map b/node_modules/npm/node_modules/glob/dist/esm/processor.d.ts.map new file mode 100644 index 00000000..aa266fee --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/processor.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../src/processor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAa,OAAO,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C;;GAEG;AACH,qBAAa,cAAc;IACzB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;gBACnB,KAAK,GAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAa;IAGvD,IAAI;IAGJ,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO;IAGxC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO;CAM3C;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACtB,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAY;IACpC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO;IAMnD,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE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_modules/npm/node_modules/glob/dist/esm/processor.js new file mode 100644 index 00000000..f874892f --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/processor.js @@ -0,0 +1,294 @@ +// 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); + 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 not be final entry, otherwise we would have + // concatenated it earlier. + const ifDir = p === '..' || p === '' || p === '.'; + this.matches.add(t.resolve(p), absolute, ifDir); + 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/npm/node_modules/glob/dist/esm/processor.js.map b/node_modules/npm/node_modules/glob/dist/esm/processor.js.map new file mode 100644 index 00000000..05a83242 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/processor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"processor.js","sourceRoot":"","sources":["../../src/processor.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAY,MAAM,WAAW,CAAA;AAK9C;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB,KAAK,CAA0B;IAC/B,YAAY,QAAkC,IAAI,GAAG,EAAE;QACrD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IACD,IAAI;QACF,OAAO,IAAI,cAAc,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAChD,CAAC;IACD,SAAS,CAAC,MAAY,EAAE,OAAgB;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IACrE,CAAC;IACD,WAAW,CAAC,MAAY,EAAE,OAAgB;QACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAA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AAO,CAAC,CAAC,CAAC;YAAE,OAAM;QACzB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;QACtC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC;CACF","sourcesContent":["// synchronous utility for filtering entries and calculating subwalks\n\nimport { GLOBSTAR, MMRegExp } from 'minimatch'\nimport { Path } from 'path-scurry'\nimport { MMPattern, Pattern } from './pattern.js'\nimport { GlobWalkerOpts } from './walker.js'\n\n/**\n * A cache of which patterns have been processed for a given Path\n */\nexport class HasWalkedCache {\n store: Map>\n constructor(store: Map> = new Map()) {\n this.store = store\n }\n copy() {\n return new HasWalkedCache(new Map(this.store))\n }\n hasWalked(target: Path, pattern: Pattern) {\n return this.store.get(target.fullpath())?.has(pattern.globString())\n }\n storeWalked(target: Path, pattern: Pattern) {\n const fullpath = target.fullpath()\n const cached = this.store.get(fullpath)\n if (cached) cached.add(pattern.globString())\n else this.store.set(fullpath, new Set([pattern.globString()]))\n }\n}\n\n/**\n * A record of which paths have been matched in a given walk step,\n * and whether they only are considered a match if they are a directory,\n * and whether their absolute or relative path should be returned.\n */\nexport class MatchRecord {\n store: Map = new Map()\n add(target: Path, absolute: boolean, ifDir: boolean) {\n const n = (absolute ? 2 : 0) | (ifDir ? 1 : 0)\n const current = this.store.get(target)\n this.store.set(target, current === undefined ? n : n & current)\n }\n // match, absolute, ifdir\n entries(): [Path, boolean, boolean][] {\n return [...this.store.entries()].map(([path, n]) => [\n path,\n !!(n & 2),\n !!(n & 1),\n ])\n }\n}\n\n/**\n * A collection of patterns that must be processed in a subsequent step\n * for a given path.\n */\nexport class SubWalks {\n store: Map = new Map()\n add(target: Path, pattern: Pattern) {\n if (!target.canReaddir()) {\n return\n }\n const subs = this.store.get(target)\n if (subs) {\n if (!subs.find(p => p.globString() === pattern.globString())) {\n subs.push(pattern)\n }\n } else this.store.set(target, [pattern])\n }\n get(target: Path): Pattern[] {\n const subs = this.store.get(target)\n /* c8 ignore start */\n if (!subs) {\n throw new Error('attempting to walk unknown path')\n }\n /* c8 ignore stop */\n return subs\n }\n entries(): [Path, Pattern[]][] {\n return this.keys().map(k => [k, this.store.get(k) as Pattern[]])\n }\n keys(): Path[] {\n return [...this.store.keys()].filter(t => t.canReaddir())\n }\n}\n\n/**\n * The class that processes patterns for a given path.\n *\n * Handles child entry filtering, and determining whether a path's\n * directory contents must be read.\n */\nexport class Processor {\n hasWalkedCache: HasWalkedCache\n matches = new MatchRecord()\n subwalks = new SubWalks()\n patterns?: Pattern[]\n follow: boolean\n dot: boolean\n opts: GlobWalkerOpts\n\n constructor(opts: GlobWalkerOpts, hasWalkedCache?: HasWalkedCache) {\n this.opts = opts\n this.follow = !!opts.follow\n this.dot = !!opts.dot\n this.hasWalkedCache =\n hasWalkedCache ? hasWalkedCache.copy() : new HasWalkedCache()\n }\n\n processPatterns(target: Path, patterns: Pattern[]) {\n this.patterns = patterns\n const processingSet: [Path, Pattern][] = patterns.map(p => [target, p])\n\n // map of paths to the magic-starting subwalks they need to walk\n // first item in patterns is the filter\n\n for (let [t, pattern] of processingSet) {\n this.hasWalkedCache.storeWalked(t, pattern)\n\n const root = pattern.root()\n const absolute = pattern.isAbsolute() && this.opts.absolute !== false\n\n // start absolute patterns at root\n if (root) {\n t = t.resolve(\n root === '/' && this.opts.root !== undefined ?\n this.opts.root\n : root,\n )\n const rest = pattern.rest()\n if (!rest) {\n this.matches.add(t, true, false)\n continue\n } else {\n pattern = rest\n }\n }\n\n if (t.isENOENT()) continue\n\n let p: MMPattern\n let rest: Pattern | null\n let changed = false\n while (\n typeof (p = pattern.pattern()) === 'string' &&\n (rest = pattern.rest())\n ) {\n const c = t.resolve(p)\n t = c\n pattern = rest\n changed = true\n }\n p = pattern.pattern()\n rest = pattern.rest()\n if (changed) {\n if (this.hasWalkedCache.hasWalked(t, pattern)) continue\n this.hasWalkedCache.storeWalked(t, pattern)\n }\n\n // now we have either a final string for a known entry,\n // more strings for an unknown entry,\n // or a pattern starting with magic, mounted on t.\n if (typeof p === 'string') {\n // must not be final entry, otherwise we would have\n // concatenated it earlier.\n const ifDir = p === '..' || p === '' || p === '.'\n this.matches.add(t.resolve(p), absolute, ifDir)\n continue\n } else if (p === GLOBSTAR) {\n // if no rest, match and subwalk pattern\n // if rest, process rest and subwalk pattern\n // if it's a symlink, but we didn't get here by way of a\n // globstar match (meaning it's the first time THIS globstar\n // has traversed a symlink), then we follow it. Otherwise, stop.\n if (\n !t.isSymbolicLink() ||\n this.follow ||\n pattern.checkFollowGlobstar()\n ) {\n this.subwalks.add(t, pattern)\n }\n const rp = rest?.pattern()\n const rrest = rest?.rest()\n if (!rest || ((rp === '' || rp === '.') && !rrest)) {\n // only HAS to be a dir if it ends in **/ or **/.\n // but ending in ** will match files as well.\n this.matches.add(t, absolute, rp === '' || rp === '.')\n } else {\n if (rp === '..') {\n // this would mean you're matching **/.. at the fs root,\n // and no thanks, I'm not gonna test that specific case.\n /* c8 ignore start */\n const tp = t.parent || t\n /* c8 ignore stop */\n if (!rrest) this.matches.add(tp, absolute, true)\n else if (!this.hasWalkedCache.hasWalked(tp, rrest)) {\n this.subwalks.add(tp, rrest)\n }\n }\n }\n } else if (p instanceof RegExp) {\n this.subwalks.add(t, pattern)\n }\n }\n\n return this\n }\n\n subwalkTargets(): Path[] {\n return this.subwalks.keys()\n }\n\n child() {\n return new Processor(this.opts, this.hasWalkedCache)\n }\n\n // return a new Processor containing the subwalks for each\n // child entry, and a set of matches, and\n // a hasWalkedCache that's a copy of this one\n // then we're going to call\n filterEntries(parent: Path, entries: Path[]): Processor {\n const patterns = this.subwalks.get(parent)\n // put matches and entry walks into the results processor\n const results = this.child()\n for (const e of entries) {\n for (const pattern of patterns) {\n const absolute = pattern.isAbsolute()\n const p = pattern.pattern()\n const rest = pattern.rest()\n if (p === GLOBSTAR) {\n results.testGlobstar(e, pattern, rest, absolute)\n } else if (p instanceof RegExp) {\n results.testRegExp(e, p, rest, absolute)\n } else {\n results.testString(e, p, rest, absolute)\n }\n }\n }\n return results\n }\n\n testGlobstar(\n e: Path,\n pattern: Pattern,\n rest: Pattern | null,\n absolute: boolean,\n ) {\n if (this.dot || !e.name.startsWith('.')) {\n if (!pattern.hasMore()) {\n this.matches.add(e, absolute, false)\n }\n if (e.canReaddir()) {\n // if we're in follow mode or it's not a symlink, just keep\n // testing the same pattern. If there's more after the globstar,\n // then this symlink consumes the globstar. If not, then we can\n // follow at most ONE symlink along the way, so we mark it, which\n // also checks to ensure that it wasn't already marked.\n if (this.follow || !e.isSymbolicLink()) {\n this.subwalks.add(e, pattern)\n } else if (e.isSymbolicLink()) {\n if (rest && pattern.checkFollowGlobstar()) {\n this.subwalks.add(e, rest)\n } else if (pattern.markFollowGlobstar()) {\n this.subwalks.add(e, pattern)\n }\n }\n }\n }\n // if the NEXT thing matches this entry, then also add\n // the rest.\n if (rest) {\n const rp = rest.pattern()\n if (\n typeof rp === 'string' &&\n // dots and empty were handled already\n rp !== '..' &&\n rp !== '' &&\n rp !== '.'\n ) {\n this.testString(e, rp, rest.rest(), absolute)\n } else if (rp === '..') {\n /* c8 ignore start */\n const ep = e.parent || e\n /* c8 ignore stop */\n this.subwalks.add(ep, rest)\n } else if (rp instanceof RegExp) {\n this.testRegExp(e, rp, rest.rest(), absolute)\n }\n }\n }\n\n testRegExp(\n e: Path,\n p: MMRegExp,\n rest: Pattern | null,\n absolute: boolean,\n ) {\n if (!p.test(e.name)) return\n if (!rest) {\n this.matches.add(e, absolute, false)\n } else {\n this.subwalks.add(e, rest)\n }\n }\n\n testString(e: Path, p: string, rest: Pattern | null, absolute: boolean) {\n // should never happen?\n if (!e.isNamed(p)) return\n if (!rest) {\n this.matches.add(e, absolute, false)\n } else {\n this.subwalks.add(e, rest)\n }\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/walker.d.ts b/node_modules/npm/node_modules/glob/dist/esm/walker.d.ts new file mode 100644 index 00000000..499c8f49 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/walker.d.ts @@ -0,0 +1,97 @@ +/** + * Single-use utility classes to provide functionality to the {@link Glob} + * methods. + * + * @module + */ +import { Minipass } from 'minipass'; +import { Path } from 'path-scurry'; +import { IgnoreLike } from './ignore.js'; +import { Pattern } from './pattern.js'; +import { Processor } from './processor.js'; +export interface GlobWalkerOpts { + absolute?: boolean; + allowWindowsEscape?: boolean; + cwd?: string | URL; + dot?: boolean; + dotRelative?: boolean; + follow?: boolean; + ignore?: string | string[] | IgnoreLike; + mark?: boolean; + matchBase?: boolean; + maxDepth?: number; + nobrace?: boolean; + nocase?: boolean; + nodir?: boolean; + noext?: boolean; + noglobstar?: boolean; + platform?: NodeJS.Platform; + posix?: boolean; + realpath?: boolean; + root?: string; + stat?: boolean; + signal?: AbortSignal; + windowsPathsNoEscape?: boolean; + withFileTypes?: boolean; + includeChildMatches?: boolean; +} +export type GWOFileTypesTrue = GlobWalkerOpts & { + withFileTypes: true; +}; +export type GWOFileTypesFalse = GlobWalkerOpts & { + withFileTypes: false; +}; +export type GWOFileTypesUnset = GlobWalkerOpts & { + withFileTypes?: undefined; +}; +export type Result = O extends GWOFileTypesTrue ? Path : O extends GWOFileTypesFalse ? string : O extends GWOFileTypesUnset ? string : Path | string; +export type Matches = O extends GWOFileTypesTrue ? Set : O extends GWOFileTypesFalse ? Set : O extends GWOFileTypesUnset ? Set : Set; +export type MatchStream = Minipass, Result>; +/** + * basic walking utilities that all the glob walker types use + */ +export declare abstract class GlobUtil { + #private; + path: Path; + patterns: Pattern[]; + opts: O; + seen: Set; + paused: boolean; + aborted: boolean; + signal?: AbortSignal; + maxDepth: number; + includeChildMatches: boolean; + constructor(patterns: Pattern[], path: Path, opts: O); + pause(): void; + resume(): void; + onResume(fn: () => any): void; + matchCheck(e: Path, ifDir: boolean): Promise; + matchCheckTest(e: Path | undefined, ifDir: boolean): Path | undefined; + matchCheckSync(e: Path, ifDir: boolean): Path | undefined; + abstract matchEmit(p: Result): void; + abstract matchEmit(p: string | Path): void; + matchFinish(e: Path, absolute: boolean): void; + match(e: Path, absolute: boolean, ifDir: boolean): Promise; + matchSync(e: Path, absolute: boolean, ifDir: boolean): void; + walkCB(target: Path, patterns: Pattern[], cb: () => any): void; + walkCB2(target: Path, patterns: Pattern[], processor: Processor, cb: () => any): any; + walkCB3(target: Path, entries: Path[], processor: Processor, cb: () => any): void; + walkCBSync(target: Path, patterns: Pattern[], cb: () => any): void; + walkCB2Sync(target: Path, patterns: Pattern[], processor: Processor, cb: () => any): any; + walkCB3Sync(target: Path, entries: Path[], processor: Processor, cb: () => any): void; +} +export declare class GlobWalker extends GlobUtil { + matches: Set>; + constructor(patterns: Pattern[], path: Path, opts: O); + matchEmit(e: Result): void; + walk(): Promise>>; + walkSync(): Set>; +} +export declare class GlobStream extends GlobUtil { + results: Minipass, Result>; + constructor(patterns: Pattern[], path: Path, opts: O); + matchEmit(e: Result): void; + stream(): MatchStream; + streamSync(): MatchStream; +} +//# sourceMappingURL=walker.d.ts.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/walker.d.ts.map b/node_modules/npm/node_modules/glob/dist/esm/walker.d.ts.map new file mode 100644 index 00000000..769957bd --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/walker.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"walker.d.ts","sourceRoot":"","sources":["../../src/walker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAU,UAAU,EAAE,MAAM,aAAa,CAAA;AAOhD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,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EACZ,OAAO,EAAE,IAAI,EAAE,EACf,SAAS,EAAE,SAAS,EACpB,EAAE,EAAE,MAAM,GAAG;CAoBhB;AAED,qBAAa,UAAU,CACrB,CAAC,SAAS,cAAc,GAAG,cAAc,CACzC,SAAQ,QAAQ,CAAC,CAAC,CAAC;IACnB,OAAO,iBAAuB;gBAElB,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAIpD,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI;IAIvB,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAiBrC,QAAQ,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAW3B;AAED,qBAAa,UAAU,CACrB,CAAC,SAAS,cAAc,GAAG,cAAc,CACzC,SAAQ,QAAQ,CAAC,CAAC,CAAC;IACnB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;gBAE3B,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAUpD,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI;IAK7B,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC;IAYxB,UAAU,IAAI,WAAW,CAAC,CAAC,CAAC;CAO7B"} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/dist/esm/walker.js b/node_modules/npm/node_modules/glob/dist/esm/walker.js new file mode 100644 index 00000000..3d68196c --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/walker.js @@ -0,0 +1,381 @@ +/** + * 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; + includeChildMatches; + constructor(patterns, path, opts) { + this.patterns = patterns; + this.path = path; + this.opts = opts; + this.#sep = !opts.posix && opts.platform === 'win32' ? '\\' : '/'; + this.includeChildMatches = opts.includeChildMatches !== false; + if (opts.ignore || !this.includeChildMatches) { + this.#ignore = makeIgnore(opts.ignore ?? [], opts); + if (!this.includeChildMatches && + typeof this.#ignore.add !== 'function') { + const m = 'cannot ignore child matches, ignore lacks add() method.'; + throw new Error(m); + } + } + // 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; + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + /* c8 ignore start */ + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + /* c8 ignore stop */ + } + return this.matchCheckTest(s, ifDir); + } + matchCheckTest(e, ifDir) { + return (e && + (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && + (!ifDir || e.canReaddir()) && + (!this.opts.nodir || !e.isDirectory()) && + (!this.opts.nodir || + !this.opts.follow || + !e.isSymbolicLink() || + !e.realpathCached()?.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; + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); + } + matchFinish(e, absolute) { + if (this.#ignored(e)) + return; + // we know we have an ignore if this is false, but TS doesn't + if (!this.includeChildMatches && this.#ignore?.add) { + const ign = `${e.relativePosix()}/**`; + this.#ignore.add(ign); + } + 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 = new Set(); + constructor(patterns, path, opts) { + super(patterns, path, opts); + } + 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/npm/node_modules/glob/dist/esm/walker.js.map b/node_modules/npm/node_modules/glob/dist/esm/walker.js.map new file mode 100644 index 00000000..daeeda67 --- /dev/null +++ b/node_modules/npm/node_modules/glob/dist/esm/walker.js.map @@ -0,0 +1 @@ +{"version":3,"file":"walker.js","sourceRoot":"","sources":["../../src/walker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEnC,OAAO,EAAE,MAAM,EAAc,MAAM,aAAa,CAAA;AAQhD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AA0D1C,MAAM,UAAU,GAAG,CACjB,MAAsC,EACtC,IAAoB,EACR,EAAE,CACd,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC;IACvD,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;QAClD,CAAC,CAAC,MAAM,CAAA;AAEV;;GAEG;AACH,MAAM,OAAgB,QAAQ;IAC5B,IAAI,CAAM;IACV,QAAQ,CAAW;IACnB,IAAI,CAAG;IACP,IAAI,GAAc,IAAI,GAAG,EAAQ,CAAA;IACjC,MAAM,GAAY,KAAK,CAAA;IACvB,OAAO,GAAY,KAAK,CAAA;IACxB,SAAS,GAAkB,EAAE,CAAA;IAC7B,OAAO,CAAa;IACpB,IAAI,CAAY;IAChB,MAAM,CAAc;IACpB,QAAQ,CAAQ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AAM,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QAC9D,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,UAAU;QACR,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAA;QACvB,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;QACnE,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF","sourcesContent":["/**\n * Single-use utility classes to provide functionality to the {@link Glob}\n * methods.\n *\n * @module\n */\nimport { Minipass } from 'minipass'\nimport { Path } from 'path-scurry'\nimport { Ignore, IgnoreLike } from './ignore.js'\n\n// XXX can we somehow make it so that it NEVER processes a given path more than\n// once, enough that the match set tracking is no longer needed? that'd speed\n// things up a lot. Or maybe bring back nounique, and skip it in that case?\n\n// a single minimatch set entry with 1 or more parts\nimport { Pattern } from './pattern.js'\nimport { Processor } from './processor.js'\n\nexport interface GlobWalkerOpts {\n absolute?: boolean\n allowWindowsEscape?: boolean\n cwd?: string | URL\n dot?: boolean\n dotRelative?: boolean\n follow?: boolean\n ignore?: string | string[] | IgnoreLike\n mark?: boolean\n matchBase?: boolean\n // Note: maxDepth here means \"maximum actual Path.depth()\",\n // not \"maximum depth beyond cwd\"\n maxDepth?: number\n nobrace?: boolean\n nocase?: boolean\n nodir?: boolean\n noext?: boolean\n noglobstar?: boolean\n platform?: NodeJS.Platform\n posix?: boolean\n realpath?: boolean\n root?: string\n stat?: boolean\n signal?: AbortSignal\n windowsPathsNoEscape?: boolean\n withFileTypes?: boolean\n includeChildMatches?: boolean\n}\n\nexport type GWOFileTypesTrue = GlobWalkerOpts & {\n withFileTypes: true\n}\nexport type GWOFileTypesFalse = GlobWalkerOpts & {\n withFileTypes: false\n}\nexport type GWOFileTypesUnset = GlobWalkerOpts & {\n withFileTypes?: undefined\n}\n\nexport type Result =\n O extends GWOFileTypesTrue ? Path\n : O extends GWOFileTypesFalse ? string\n : O extends GWOFileTypesUnset ? string\n : Path | string\n\nexport type Matches =\n O extends GWOFileTypesTrue ? Set\n : O extends GWOFileTypesFalse ? Set\n : O extends GWOFileTypesUnset ? Set\n : Set\n\nexport type MatchStream = Minipass<\n Result,\n Result\n>\n\nconst makeIgnore = (\n ignore: string | string[] | IgnoreLike,\n opts: GlobWalkerOpts,\n): IgnoreLike =>\n typeof ignore === 'string' ? new Ignore([ignore], opts)\n : Array.isArray(ignore) ? new Ignore(ignore, opts)\n : ignore\n\n/**\n * basic walking utilities that all the glob walker types use\n */\nexport abstract class GlobUtil {\n path: Path\n patterns: Pattern[]\n opts: O\n seen: Set = new Set()\n paused: boolean = false\n aborted: boolean = false\n #onResume: (() => any)[] = []\n #ignore?: IgnoreLike\n #sep: '\\\\' | '/'\n signal?: AbortSignal\n maxDepth: number\n includeChildMatches: boolean\n\n constructor(patterns: Pattern[], path: Path, opts: O)\n constructor(patterns: Pattern[], path: Path, opts: O) {\n this.patterns = patterns\n this.path = path\n this.opts = opts\n this.#sep = !opts.posix && opts.platform === 'win32' ? '\\\\' : '/'\n this.includeChildMatches = opts.includeChildMatches !== false\n if (opts.ignore || !this.includeChildMatches) {\n this.#ignore = makeIgnore(opts.ignore ?? [], opts)\n if (\n !this.includeChildMatches &&\n typeof this.#ignore.add !== 'function'\n ) {\n const m = 'cannot ignore child matches, ignore lacks add() method.'\n throw new Error(m)\n }\n }\n // ignore, always set with maxDepth, but it's optional on the\n // GlobOptions type\n /* c8 ignore start */\n this.maxDepth = opts.maxDepth || Infinity\n /* c8 ignore stop */\n if (opts.signal) {\n this.signal = opts.signal\n this.signal.addEventListener('abort', () => {\n this.#onResume.length = 0\n })\n }\n }\n\n #ignored(path: Path): boolean {\n return this.seen.has(path) || !!this.#ignore?.ignored?.(path)\n }\n #childrenIgnored(path: Path): boolean {\n return !!this.#ignore?.childrenIgnored?.(path)\n }\n\n // backpressure mechanism\n pause() {\n this.paused = true\n }\n resume() {\n /* c8 ignore start */\n if (this.signal?.aborted) return\n /* c8 ignore stop */\n this.paused = false\n let fn: (() => any) | undefined = undefined\n while (!this.paused && (fn = this.#onResume.shift())) {\n fn()\n }\n }\n onResume(fn: () => any) {\n if (this.signal?.aborted) return\n /* c8 ignore start */\n if (!this.paused) {\n fn()\n } else {\n /* c8 ignore stop */\n this.#onResume.push(fn)\n }\n }\n\n // do the requisite realpath/stat checking, and return the path\n // to add or undefined to filter it out.\n async matchCheck(e: Path, ifDir: boolean): Promise {\n if (ifDir && this.opts.nodir) return undefined\n let rpc: Path | undefined\n if (this.opts.realpath) {\n rpc = e.realpathCached() || (await e.realpath())\n if (!rpc) return undefined\n e = rpc\n }\n const needStat = e.isUnknown() || this.opts.stat\n const s = needStat ? await e.lstat() : e\n if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {\n const target = await s.realpath()\n /* c8 ignore start */\n if (target && (target.isUnknown() || this.opts.stat)) {\n await target.lstat()\n }\n /* c8 ignore stop */\n }\n return this.matchCheckTest(s, ifDir)\n }\n\n matchCheckTest(e: Path | undefined, ifDir: boolean): Path | undefined {\n return (\n e &&\n (this.maxDepth === Infinity || e.depth() <= this.maxDepth) &&\n (!ifDir || e.canReaddir()) &&\n (!this.opts.nodir || !e.isDirectory()) &&\n (!this.opts.nodir ||\n !this.opts.follow ||\n !e.isSymbolicLink() ||\n !e.realpathCached()?.isDirectory()) &&\n !this.#ignored(e)\n ) ?\n e\n : undefined\n }\n\n matchCheckSync(e: Path, ifDir: boolean): Path | undefined {\n if (ifDir && this.opts.nodir) return undefined\n let rpc: Path | undefined\n if (this.opts.realpath) {\n rpc = e.realpathCached() || e.realpathSync()\n if (!rpc) return undefined\n e = rpc\n }\n const needStat = e.isUnknown() || this.opts.stat\n const s = needStat ? e.lstatSync() : e\n if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {\n const target = s.realpathSync()\n if (target && (target?.isUnknown() || this.opts.stat)) {\n target.lstatSync()\n }\n }\n return this.matchCheckTest(s, ifDir)\n }\n\n abstract matchEmit(p: Result): void\n abstract matchEmit(p: string | Path): void\n\n matchFinish(e: Path, absolute: boolean) {\n if (this.#ignored(e)) return\n // we know we have an ignore if this is false, but TS doesn't\n if (!this.includeChildMatches && this.#ignore?.add) {\n const ign = `${e.relativePosix()}/**`\n this.#ignore.add(ign)\n }\n const abs =\n this.opts.absolute === undefined ? absolute : this.opts.absolute\n this.seen.add(e)\n const mark = this.opts.mark && e.isDirectory() ? this.#sep : ''\n // ok, we have what we need!\n if (this.opts.withFileTypes) {\n this.matchEmit(e)\n } else if (abs) {\n const abs = this.opts.posix ? e.fullpathPosix() : e.fullpath()\n this.matchEmit(abs + mark)\n } else {\n const rel = this.opts.posix ? e.relativePosix() : e.relative()\n const pre =\n this.opts.dotRelative && !rel.startsWith('..' + this.#sep) ?\n '.' + this.#sep\n : ''\n this.matchEmit(!rel ? '.' + mark : pre + rel + mark)\n }\n }\n\n async match(e: Path, absolute: boolean, ifDir: boolean): Promise {\n const p = await this.matchCheck(e, ifDir)\n if (p) this.matchFinish(p, absolute)\n }\n\n matchSync(e: Path, absolute: boolean, ifDir: boolean): void {\n const p = this.matchCheckSync(e, ifDir)\n if (p) this.matchFinish(p, absolute)\n }\n\n walkCB(target: Path, patterns: Pattern[], cb: () => any) {\n /* c8 ignore start */\n if (this.signal?.aborted) cb()\n /* c8 ignore stop */\n this.walkCB2(target, patterns, new Processor(this.opts), cb)\n }\n\n walkCB2(\n target: Path,\n patterns: Pattern[],\n processor: Processor,\n cb: () => any,\n ) {\n if (this.#childrenIgnored(target)) return cb()\n if (this.signal?.aborted) cb()\n if (this.paused) {\n this.onResume(() => this.walkCB2(target, patterns, processor, cb))\n return\n }\n processor.processPatterns(target, patterns)\n\n // done processing. all of the above is sync, can be abstracted out.\n // subwalks is a map of paths to the entry filters they need\n // matches is a map of paths to [absolute, ifDir] tuples.\n let tasks = 1\n const next = () => {\n if (--tasks === 0) cb()\n }\n\n for (const [m, absolute, ifDir] of processor.matches.entries()) {\n if (this.#ignored(m)) continue\n tasks++\n this.match(m, absolute, ifDir).then(() => next())\n }\n\n for (const t of processor.subwalkTargets()) {\n if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {\n continue\n }\n tasks++\n const childrenCached = t.readdirCached()\n if (t.calledReaddir())\n this.walkCB3(t, childrenCached, processor, next)\n else {\n t.readdirCB(\n (_, entries) => this.walkCB3(t, entries, processor, next),\n true,\n )\n }\n }\n\n next()\n }\n\n walkCB3(\n target: Path,\n entries: Path[],\n processor: Processor,\n cb: () => any,\n ) {\n processor = processor.filterEntries(target, entries)\n\n let tasks = 1\n const next = () => {\n if (--tasks === 0) cb()\n }\n\n for (const [m, absolute, ifDir] of processor.matches.entries()) {\n if (this.#ignored(m)) continue\n tasks++\n this.match(m, absolute, ifDir).then(() => next())\n }\n for (const [target, patterns] of processor.subwalks.entries()) {\n tasks++\n this.walkCB2(target, patterns, processor.child(), next)\n }\n\n next()\n }\n\n walkCBSync(target: Path, patterns: Pattern[], cb: () => any) {\n /* c8 ignore start */\n if (this.signal?.aborted) cb()\n /* c8 ignore stop */\n this.walkCB2Sync(target, patterns, new Processor(this.opts), cb)\n }\n\n walkCB2Sync(\n target: Path,\n patterns: Pattern[],\n processor: Processor,\n cb: () => any,\n ) {\n if (this.#childrenIgnored(target)) return cb()\n if (this.signal?.aborted) cb()\n if (this.paused) {\n this.onResume(() =>\n this.walkCB2Sync(target, patterns, processor, cb),\n )\n return\n }\n processor.processPatterns(target, patterns)\n\n // done processing. all of the above is sync, can be abstracted out.\n // subwalks is a map of paths to the entry filters they need\n // matches is a map of paths to [absolute, ifDir] tuples.\n let tasks = 1\n const next = () => {\n if (--tasks === 0) cb()\n }\n\n for (const [m, absolute, ifDir] of processor.matches.entries()) {\n if (this.#ignored(m)) continue\n this.matchSync(m, absolute, ifDir)\n }\n\n for (const t of processor.subwalkTargets()) {\n if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) {\n continue\n }\n tasks++\n const children = t.readdirSync()\n this.walkCB3Sync(t, children, processor, next)\n }\n\n next()\n }\n\n walkCB3Sync(\n target: Path,\n entries: Path[],\n processor: Processor,\n cb: () => any,\n ) {\n processor = processor.filterEntries(target, entries)\n\n let tasks = 1\n const next = () => {\n if (--tasks === 0) cb()\n }\n\n for (const [m, absolute, ifDir] of processor.matches.entries()) {\n if (this.#ignored(m)) continue\n this.matchSync(m, absolute, ifDir)\n }\n for (const [target, patterns] of processor.subwalks.entries()) {\n tasks++\n this.walkCB2Sync(target, patterns, processor.child(), next)\n }\n\n next()\n }\n}\n\nexport class GlobWalker<\n O extends GlobWalkerOpts = GlobWalkerOpts,\n> extends GlobUtil {\n matches = new Set>()\n\n constructor(patterns: Pattern[], path: Path, opts: O) {\n super(patterns, path, opts)\n }\n\n matchEmit(e: Result): void {\n this.matches.add(e)\n }\n\n async walk(): Promise>> {\n if (this.signal?.aborted) throw this.signal.reason\n if (this.path.isUnknown()) {\n await this.path.lstat()\n }\n await new Promise((res, rej) => {\n this.walkCB(this.path, this.patterns, () => {\n if (this.signal?.aborted) {\n rej(this.signal.reason)\n } else {\n res(this.matches)\n }\n })\n })\n return this.matches\n }\n\n walkSync(): Set> {\n if (this.signal?.aborted) throw this.signal.reason\n if (this.path.isUnknown()) {\n this.path.lstatSync()\n }\n // nothing for the callback to do, because this never pauses\n this.walkCBSync(this.path, this.patterns, () => {\n if (this.signal?.aborted) throw this.signal.reason\n })\n return this.matches\n }\n}\n\nexport class GlobStream<\n O extends GlobWalkerOpts = GlobWalkerOpts,\n> extends GlobUtil {\n results: Minipass, Result>\n\n constructor(patterns: Pattern[], path: Path, opts: O) {\n super(patterns, path, opts)\n this.results = new Minipass, Result>({\n signal: this.signal,\n objectMode: true,\n })\n this.results.on('drain', () => this.resume())\n this.results.on('resume', () => this.resume())\n }\n\n matchEmit(e: Result): void {\n this.results.write(e)\n if (!this.results.flowing) this.pause()\n }\n\n stream(): MatchStream {\n const target = this.path\n if (target.isUnknown()) {\n target.lstat().then(() => {\n this.walkCB(target, this.patterns, () => this.results.end())\n })\n } else {\n this.walkCB(target, this.patterns, () => this.results.end())\n }\n return this.results\n }\n\n streamSync(): MatchStream {\n if (this.path.isUnknown()) {\n this.path.lstatSync()\n }\n this.walkCBSync(this.path, this.patterns, () => this.results.end())\n return this.results\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/glob/package.json b/node_modules/npm/node_modules/glob/package.json new file mode 100644 index 00000000..6d4893b5 --- /dev/null +++ b/node_modules/npm/node_modules/glob/package.json @@ -0,0 +1,99 @@ +{ + "author": "Isaac Z. Schlueter (https://blog.izs.me/)", + "publishConfig": { + "tag": "legacy-v10" + }, + "name": "glob", + "description": "the most correct and second fastest glob implementation in JavaScript", + "version": "10.4.5", + "type": "module", + "tshy": { + "main": true, + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "bin": "./dist/esm/bin.mjs", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.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" + } + } + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "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 . --log-level warn", + "typedoc": "typedoc --tsconfig .tshy/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.cjs" + }, + "prettier": { + "experimentalTernaries": true, + "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": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "devDependencies": { + "@types/node": "^20.11.30", + "memfs": "^3.4.13", + "mkdirp": "^3.0.1", + "prettier": "^3.2.5", + "rimraf": "^5.0.7", + "sync-content": "^1.0.2", + "tap": "^19.0.0", + "tshy": "^1.14.0", + "typedoc": "^0.25.12" + }, + "tap": { + "before": "test/00-setup.ts" + }, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "module": "./dist/esm/index.js" +} diff --git a/node_modules/npm/node_modules/graceful-fs/LICENSE b/node_modules/npm/node_modules/graceful-fs/LICENSE new file mode 100644 index 00000000..e906a25a --- /dev/null +++ b/node_modules/npm/node_modules/graceful-fs/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, 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/npm/node_modules/graceful-fs/clone.js b/node_modules/npm/node_modules/graceful-fs/clone.js new file mode 100644 index 00000000..dff3cc8c --- /dev/null +++ b/node_modules/npm/node_modules/graceful-fs/clone.js @@ -0,0 +1,23 @@ +'use strict' + +module.exports = clone + +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ +} + +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj + + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) } + else + var copy = Object.create(null) + + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) + + return copy +} diff --git a/node_modules/npm/node_modules/graceful-fs/graceful-fs.js b/node_modules/npm/node_modules/graceful-fs/graceful-fs.js new file mode 100644 index 00000000..8d5b89e4 --- /dev/null +++ b/node_modules/npm/node_modules/graceful-fs/graceful-fs.js @@ -0,0 +1,448 @@ +var fs = require('fs') +var polyfills = require('./polyfills.js') +var legacy = require('./legacy-streams.js') +var clone = require('./clone.js') + +var util = require('util') + +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol + +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' +} + +function noop () {} + +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} + +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } + +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) + + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + resetQueue() + } + + if (typeof cb === 'function') + cb.apply(this, arguments) + }) + } + + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) + + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) + resetQueue() + } + + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) + + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(fs[gracefulQueue]) + require('assert').equal(fs[gracefulQueue].length, 0) + }) + } +} + +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} + +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; +} + +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch + + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readFile(path, options, cb) + + function go$readFile (path, options, cb, startTime) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$writeFile(path, data, options, cb) + + function go$writeFile (path, data, options, cb, startTime) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$appendFile(path, data, options, cb) + + function go$appendFile (path, data, options, cb, startTime) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.copyFile = copyFile + function copyFile (src, dest, flags, cb) { + if (typeof flags === 'function') { + cb = flags + flags = 0 + } + return go$copyFile(src, dest, flags, cb) + + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$readdir = fs.readdir + fs.readdir = readdir + var noReaddirOptionVersions = /^v[0-5]\./ + function readdir (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + var go$readdir = noReaddirOptionVersions.test(process.version) + ? function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, fs$readdirCallback( + path, options, cb, startTime + )) + } + : function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, fs$readdirCallback( + path, options, cb, startTime + )) + } + + return go$readdir(path, options, cb) + + function fs$readdirCallback (path, options, cb, startTime) { + return function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([ + go$readdir, + [path, options, cb], + err, + startTime || Date.now(), + Date.now() + ]) + else { + if (files && files.sort) + files.sort() + + if (typeof cb === 'function') + cb.call(this, err, files) + } + } + } + } + + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } + + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } + + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } + + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) + + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) + + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } + + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() + + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } + + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } + + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } + + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } + + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } + + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null + + return go$open(path, flags, mode, cb) + + function go$open (path, flags, mode, cb, startTime) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + return fs +} + +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + fs[gracefulQueue].push(elem) + retry() +} + +// keep track of the timeout between retry() calls +var retryTimer + +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime + } + } + // call retry to make sure we're actively processing the queue + retry() +} + +function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined + + if (fs[gracefulQueue].length === 0) + return + + var elem = fs[gracefulQueue].shift() + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] + + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) + } + } + + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) + } +} diff --git a/node_modules/npm/node_modules/graceful-fs/legacy-streams.js b/node_modules/npm/node_modules/graceful-fs/legacy-streams.js new file mode 100644 index 00000000..d617b50f --- /dev/null +++ b/node_modules/npm/node_modules/graceful-fs/legacy-streams.js @@ -0,0 +1,118 @@ +var Stream = require('stream').Stream + +module.exports = legacy + +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } + + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + + Stream.call(this); + + var self = this; + + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.encoding) this.setEncoding(this.encoding); + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; + } + + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } + + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } + + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + + Stream.call(this); + + this.path = path; + this.fd = null; + this.writable = true; + + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } + + this.pos = this.start; + } + + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } + } +} diff --git a/node_modules/npm/node_modules/graceful-fs/package.json b/node_modules/npm/node_modules/graceful-fs/package.json new file mode 100644 index 00000000..87babf02 --- /dev/null +++ b/node_modules/npm/node_modules/graceful-fs/package.json @@ -0,0 +1,53 @@ +{ + "name": "graceful-fs", + "description": "A drop-in replacement for fs, making various improvements.", + "version": "4.2.11", + "repository": { + "type": "git", + "url": "https://github.com/isaacs/node-graceful-fs" + }, + "main": "graceful-fs.js", + "directories": { + "test": "test" + }, + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags", + "test": "nyc --silent node test.js | tap -c -", + "posttest": "nyc report" + }, + "keywords": [ + "fs", + "module", + "reading", + "retry", + "retries", + "queue", + "error", + "errors", + "handling", + "EMFILE", + "EAGAIN", + "EINVAL", + "EPERM", + "EACCESS" + ], + "license": "ISC", + "devDependencies": { + "import-fresh": "^2.0.0", + "mkdirp": "^0.5.0", + "rimraf": "^2.2.8", + "tap": "^16.3.4" + }, + "files": [ + "fs.js", + "graceful-fs.js", + "legacy-streams.js", + "polyfills.js", + "clone.js" + ], + "tap": { + "reporter": "classic" + } +} diff --git a/node_modules/npm/node_modules/graceful-fs/polyfills.js b/node_modules/npm/node_modules/graceful-fs/polyfills.js new file mode 100644 index 00000000..453f1a9e --- /dev/null +++ b/node_modules/npm/node_modules/graceful-fs/polyfills.js @@ -0,0 +1,355 @@ +var constants = require('constants') + +var origCwd = process.cwd +var cwd = null + +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} + +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) +} + +module.exports = patch + +function patch (fs) { + // (re-)implement some things that are known busted or missing. + + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } + + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. + + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) + + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) + + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) + + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) + + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) + + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + + // if lchmod/lchown do not exist, then make them no-ops + if (fs.chmod && !fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (fs.chown && !fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } + + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = typeof fs.rename !== 'function' ? fs.rename + : (function (fs$rename) { + function rename (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) + return rename + })(fs.rename) + } + + // if read() returns EAGAIN, then just try it again. + fs.read = typeof fs.read !== 'function' ? fs.read + : (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + + // This ensures `util.promisify` works as it does for native `fs.read`. + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) + return read + })(fs.read) + + fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync + : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) + + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } + + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + + } else if (fs.futimes) { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } + + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } + + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + return stats; + } + } + + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true + + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false + } +} diff --git a/node_modules/npm/node_modules/hosted-git-info/LICENSE b/node_modules/npm/node_modules/hosted-git-info/LICENSE new file mode 100644 index 00000000..45055763 --- /dev/null +++ b/node_modules/npm/node_modules/hosted-git-info/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015, Rebecca Turner + +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/npm/node_modules/hosted-git-info/lib/from-url.js b/node_modules/npm/node_modules/hosted-git-info/lib/from-url.js new file mode 100644 index 00000000..efc1247d --- /dev/null +++ b/node_modules/npm/node_modules/hosted-git-info/lib/from-url.js @@ -0,0 +1,122 @@ +'use strict' + +const parseUrl = require('./parse-url') + +// look for github shorthand inputs, such as npm/cli +const isGitHubShorthand = (arg) => { + // it cannot contain whitespace before the first # + // it cannot start with a / because that's probably an absolute file path + // but it must include a slash since repos are username/repository + // it cannot start with a . because that's probably a relative file path + // it cannot start with an @ because that's a scoped package if it passes the other tests + // it cannot contain a : before a # because that tells us that there's a protocol + // a second / may not exist before a # + const firstHash = arg.indexOf('#') + const firstSlash = arg.indexOf('/') + const secondSlash = arg.indexOf('/', firstSlash + 1) + const firstColon = arg.indexOf(':') + const firstSpace = /\s/.exec(arg) + const firstAt = arg.indexOf('@') + + const spaceOnlyAfterHash = !firstSpace || (firstHash > -1 && firstSpace.index > firstHash) + const atOnlyAfterHash = firstAt === -1 || (firstHash > -1 && firstAt > firstHash) + const colonOnlyAfterHash = firstColon === -1 || (firstHash > -1 && firstColon > firstHash) + const secondSlashOnlyAfterHash = secondSlash === -1 || (firstHash > -1 && secondSlash > firstHash) + const hasSlash = firstSlash > 0 + // if a # is found, what we really want to know is that the character + // immediately before # is not a / + const doesNotEndWithSlash = firstHash > -1 ? arg[firstHash - 1] !== '/' : !arg.endsWith('/') + const doesNotStartWithDot = !arg.startsWith('.') + + return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && + doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && + secondSlashOnlyAfterHash +} + +module.exports = (giturl, opts, { gitHosts, protocols }) => { + if (!giturl) { + return + } + + const correctedUrl = isGitHubShorthand(giturl) ? `github:${giturl}` : giturl + const parsed = parseUrl(correctedUrl, protocols) + if (!parsed) { + return + } + + const gitHostShortcut = gitHosts.byShortcut[parsed.protocol] + const gitHostDomain = gitHosts.byDomain[parsed.hostname.startsWith('www.') + ? parsed.hostname.slice(4) + : parsed.hostname] + const gitHostName = gitHostShortcut || gitHostDomain + if (!gitHostName) { + return + } + + const gitHostInfo = gitHosts[gitHostShortcut || gitHostDomain] + let auth = null + if (protocols[parsed.protocol]?.auth && (parsed.username || parsed.password)) { + auth = `${parsed.username}${parsed.password ? ':' + parsed.password : ''}` + } + + let committish = null + let user = null + let project = null + let defaultRepresentation = null + + try { + if (gitHostShortcut) { + let pathname = parsed.pathname.startsWith('/') ? parsed.pathname.slice(1) : parsed.pathname + const firstAt = pathname.indexOf('@') + // we ignore auth for shortcuts, so just trim it out + if (firstAt > -1) { + pathname = pathname.slice(firstAt + 1) + } + + const lastSlash = pathname.lastIndexOf('/') + if (lastSlash > -1) { + user = decodeURIComponent(pathname.slice(0, lastSlash)) + // we want nulls only, never empty strings + if (!user) { + user = null + } + project = decodeURIComponent(pathname.slice(lastSlash + 1)) + } else { + project = decodeURIComponent(pathname) + } + + if (project.endsWith('.git')) { + project = project.slice(0, -4) + } + + if (parsed.hash) { + committish = decodeURIComponent(parsed.hash.slice(1)) + } + + defaultRepresentation = 'shortcut' + } else { + if (!gitHostInfo.protocols.includes(parsed.protocol)) { + return + } + + const segments = gitHostInfo.extract(parsed) + if (!segments) { + return + } + + user = segments.user && decodeURIComponent(segments.user) + project = decodeURIComponent(segments.project) + committish = decodeURIComponent(segments.committish) + defaultRepresentation = protocols[parsed.protocol]?.name || parsed.protocol.slice(0, -1) + } + } catch (err) { + /* istanbul ignore else */ + if (err instanceof URIError) { + return + } else { + throw err + } + } + + return [gitHostName, user, auth, project, committish, defaultRepresentation, opts] +} diff --git a/node_modules/npm/node_modules/hosted-git-info/lib/hosts.js b/node_modules/npm/node_modules/hosted-git-info/lib/hosts.js new file mode 100644 index 00000000..2a88e959 --- /dev/null +++ b/node_modules/npm/node_modules/hosted-git-info/lib/hosts.js @@ -0,0 +1,231 @@ +/* eslint-disable max-len */ + +'use strict' + +const maybeJoin = (...args) => args.every(arg => arg) ? args.join('') : '' +const maybeEncode = (arg) => arg ? encodeURIComponent(arg) : '' +const formatHashFragment = (f) => f.toLowerCase() + .replace(/^\W+/g, '') // strip leading non-characters + .replace(/(? + `git@${domain}:${user}/${project}.git${maybeJoin('#', committish)}`, + sshurltemplate: ({ domain, user, project, committish }) => + `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin('#', committish)}`, + edittemplate: ({ domain, user, project, committish, editpath, path }) => + `https://${domain}/${user}/${project}${maybeJoin('/', editpath, '/', maybeEncode(committish || 'HEAD'), '/', path)}`, + browsetemplate: ({ domain, user, project, committish, treepath }) => + `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}`, + browsetreetemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => + `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'HEAD')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`, + browseblobtemplate: ({ domain, user, project, committish, blobpath, path, fragment, hashformat }) => + `https://${domain}/${user}/${project}/${blobpath}/${maybeEncode(committish || 'HEAD')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`, + docstemplate: ({ domain, user, project, treepath, committish }) => + `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`, + httpstemplate: ({ auth, domain, user, project, committish }) => + `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`, + filetemplate: ({ domain, user, project, committish, path }) => + `https://${domain}/${user}/${project}/raw/${maybeEncode(committish || 'HEAD')}/${path}`, + shortcuttemplate: ({ type, user, project, committish }) => + `${type}:${user}/${project}${maybeJoin('#', committish)}`, + pathtemplate: ({ user, project, committish }) => + `${user}/${project}${maybeJoin('#', committish)}`, + bugstemplate: ({ domain, user, project }) => + `https://${domain}/${user}/${project}/issues`, + hashformat: formatHashFragment, +} + +const hosts = {} +hosts.github = { + // First two are insecure and generally shouldn't be used any more, but + // they are still supported. + protocols: ['git:', 'http:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'], + domain: 'github.com', + treepath: 'tree', + blobpath: 'blob', + editpath: 'edit', + filetemplate: ({ auth, user, project, committish, path }) => + `https://${maybeJoin(auth, '@')}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish || 'HEAD')}/${path}`, + gittemplate: ({ auth, domain, user, project, committish }) => + `git://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`, + tarballtemplate: ({ domain, user, project, committish }) => + `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish || 'HEAD')}`, + extract: (url) => { + let [, user, project, type, committish] = url.pathname.split('/', 5) + if (type && type !== 'tree') { + return + } + + if (!type) { + committish = url.hash.slice(1) + } + + if (project && project.endsWith('.git')) { + project = project.slice(0, -4) + } + + if (!user || !project) { + return + } + + return { user, project, committish } + }, +} + +hosts.bitbucket = { + protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'], + domain: 'bitbucket.org', + treepath: 'src', + blobpath: 'src', + editpath: '?mode=edit', + edittemplate: ({ domain, user, project, committish, treepath, path, editpath }) => + `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish || 'HEAD'), '/', path, editpath)}`, + tarballtemplate: ({ domain, user, project, committish }) => + `https://${domain}/${user}/${project}/get/${maybeEncode(committish || 'HEAD')}.tar.gz`, + extract: (url) => { + let [, user, project, aux] = url.pathname.split('/', 4) + if (['get'].includes(aux)) { + return + } + + if (project && project.endsWith('.git')) { + project = project.slice(0, -4) + } + + if (!user || !project) { + return + } + + return { user, project, committish: url.hash.slice(1) } + }, +} + +hosts.gitlab = { + protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'], + domain: 'gitlab.com', + treepath: 'tree', + blobpath: 'tree', + editpath: '-/edit', + httpstemplate: ({ auth, domain, user, project, committish }) => + `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`, + tarballtemplate: ({ domain, user, project, committish }) => + `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish || 'HEAD')}`, + extract: (url) => { + const path = url.pathname.slice(1) + if (path.includes('/-/') || path.includes('/archive.tar.gz')) { + return + } + + const segments = path.split('/') + let project = segments.pop() + if (project.endsWith('.git')) { + project = project.slice(0, -4) + } + + const user = segments.join('/') + if (!user || !project) { + return + } + + return { user, project, committish: url.hash.slice(1) } + }, +} + +hosts.gist = { + protocols: ['git:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'], + domain: 'gist.github.com', + editpath: 'edit', + sshtemplate: ({ domain, project, committish }) => + `git@${domain}:${project}.git${maybeJoin('#', committish)}`, + sshurltemplate: ({ domain, project, committish }) => + `git+ssh://git@${domain}/${project}.git${maybeJoin('#', committish)}`, + edittemplate: ({ domain, user, project, committish, editpath }) => + `https://${domain}/${user}/${project}${maybeJoin('/', maybeEncode(committish))}/${editpath}`, + browsetemplate: ({ domain, project, committish }) => + `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`, + browsetreetemplate: ({ domain, project, committish, path, hashformat }) => + `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}${maybeJoin('#', hashformat(path))}`, + browseblobtemplate: ({ domain, project, committish, path, hashformat }) => + `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}${maybeJoin('#', hashformat(path))}`, + docstemplate: ({ domain, project, committish }) => + `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`, + httpstemplate: ({ domain, project, committish }) => + `git+https://${domain}/${project}.git${maybeJoin('#', committish)}`, + filetemplate: ({ user, project, committish, path }) => + `https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin('/', maybeEncode(committish))}/${path}`, + shortcuttemplate: ({ type, project, committish }) => + `${type}:${project}${maybeJoin('#', committish)}`, + pathtemplate: ({ project, committish }) => + `${project}${maybeJoin('#', committish)}`, + bugstemplate: ({ domain, project }) => + `https://${domain}/${project}`, + gittemplate: ({ domain, project, committish }) => + `git://${domain}/${project}.git${maybeJoin('#', committish)}`, + tarballtemplate: ({ project, committish }) => + `https://codeload.github.com/gist/${project}/tar.gz/${maybeEncode(committish || 'HEAD')}`, + extract: (url) => { + let [, user, project, aux] = url.pathname.split('/', 4) + if (aux === 'raw') { + return + } + + if (!project) { + if (!user) { + return + } + + project = user + user = null + } + + if (project.endsWith('.git')) { + project = project.slice(0, -4) + } + + return { user, project, committish: url.hash.slice(1) } + }, + hashformat: function (fragment) { + return fragment && 'file-' + formatHashFragment(fragment) + }, +} + +hosts.sourcehut = { + protocols: ['git+ssh:', 'https:'], + domain: 'git.sr.ht', + treepath: 'tree', + blobpath: 'tree', + filetemplate: ({ domain, user, project, committish, path }) => + `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'HEAD'}/${path}`, + httpstemplate: ({ domain, user, project, committish }) => + `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`, + tarballtemplate: ({ domain, user, project, committish }) => + `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'HEAD'}.tar.gz`, + bugstemplate: () => null, + extract: (url) => { + let [, user, project, aux] = url.pathname.split('/', 4) + + // tarball url + if (['archive'].includes(aux)) { + return + } + + if (project && project.endsWith('.git')) { + project = project.slice(0, -4) + } + + if (!user || !project) { + return + } + + return { user, project, committish: url.hash.slice(1) } + }, +} + +for (const [name, host] of Object.entries(hosts)) { + hosts[name] = Object.assign({}, defaults, host) +} + +module.exports = hosts diff --git a/node_modules/npm/node_modules/hosted-git-info/lib/index.js b/node_modules/npm/node_modules/hosted-git-info/lib/index.js new file mode 100644 index 00000000..0c9d0b08 --- /dev/null +++ b/node_modules/npm/node_modules/hosted-git-info/lib/index.js @@ -0,0 +1,179 @@ +'use strict' + +const { LRUCache } = require('lru-cache') +const hosts = require('./hosts.js') +const fromUrl = require('./from-url.js') +const parseUrl = require('./parse-url.js') + +const cache = new LRUCache({ max: 1000 }) + +class GitHost { + constructor (type, user, auth, project, committish, defaultRepresentation, opts = {}) { + Object.assign(this, GitHost.#gitHosts[type], { + type, + user, + auth, + project, + committish, + default: defaultRepresentation, + opts, + }) + } + + static #gitHosts = { byShortcut: {}, byDomain: {} } + static #protocols = { + 'git+ssh:': { name: 'sshurl' }, + 'ssh:': { name: 'sshurl' }, + 'git+https:': { name: 'https', auth: true }, + 'git:': { auth: true }, + 'http:': { auth: true }, + 'https:': { auth: true }, + 'git+http:': { auth: true }, + } + + static addHost (name, host) { + GitHost.#gitHosts[name] = host + GitHost.#gitHosts.byDomain[host.domain] = name + GitHost.#gitHosts.byShortcut[`${name}:`] = name + GitHost.#protocols[`${name}:`] = { name } + } + + static fromUrl (giturl, opts) { + if (typeof giturl !== 'string') { + return + } + + const key = giturl + JSON.stringify(opts || {}) + + if (!cache.has(key)) { + const hostArgs = fromUrl(giturl, opts, { + gitHosts: GitHost.#gitHosts, + protocols: GitHost.#protocols, + }) + cache.set(key, hostArgs ? new GitHost(...hostArgs) : undefined) + } + + return cache.get(key) + } + + static parseUrl (url) { + return parseUrl(url) + } + + #fill (template, opts) { + if (typeof template !== 'function') { + return null + } + + const options = { ...this, ...this.opts, ...opts } + + // the path should always be set so we don't end up with 'undefined' in urls + if (!options.path) { + options.path = '' + } + + // template functions will insert the leading slash themselves + if (options.path.startsWith('/')) { + options.path = options.path.slice(1) + } + + if (options.noCommittish) { + options.committish = null + } + + const result = template(options) + return options.noGitPlus && result.startsWith('git+') ? result.slice(4) : result + } + + hash () { + return this.committish ? `#${this.committish}` : '' + } + + ssh (opts) { + return this.#fill(this.sshtemplate, opts) + } + + sshurl (opts) { + return this.#fill(this.sshurltemplate, opts) + } + + browse (path, ...args) { + // not a string, treat path as opts + if (typeof path !== 'string') { + return this.#fill(this.browsetemplate, path) + } + + if (typeof args[0] !== 'string') { + return this.#fill(this.browsetreetemplate, { ...args[0], path }) + } + + return this.#fill(this.browsetreetemplate, { ...args[1], fragment: args[0], path }) + } + + // If the path is known to be a file, then browseFile should be used. For some hosts + // the url is the same as browse, but for others like GitHub a file can use both `/tree/` + // and `/blob/` in the path. When using a default committish of `HEAD` then the `/tree/` + // path will redirect to a specific commit. Using the `/blob/` path avoids this and + // does not redirect to a different commit. + browseFile (path, ...args) { + if (typeof args[0] !== 'string') { + return this.#fill(this.browseblobtemplate, { ...args[0], path }) + } + + return this.#fill(this.browseblobtemplate, { ...args[1], fragment: args[0], path }) + } + + docs (opts) { + return this.#fill(this.docstemplate, opts) + } + + bugs (opts) { + return this.#fill(this.bugstemplate, opts) + } + + https (opts) { + return this.#fill(this.httpstemplate, opts) + } + + git (opts) { + return this.#fill(this.gittemplate, opts) + } + + shortcut (opts) { + return this.#fill(this.shortcuttemplate, opts) + } + + path (opts) { + return this.#fill(this.pathtemplate, opts) + } + + tarball (opts) { + return this.#fill(this.tarballtemplate, { ...opts, noCommittish: false }) + } + + file (path, opts) { + return this.#fill(this.filetemplate, { ...opts, path }) + } + + edit (path, opts) { + return this.#fill(this.edittemplate, { ...opts, path }) + } + + getDefaultRepresentation () { + return this.default + } + + toString (opts) { + if (this.default && typeof this[this.default] === 'function') { + return this[this.default](opts) + } + + return this.sshurl(opts) + } +} + +for (const [name, host] of Object.entries(hosts)) { + GitHost.addHost(name, host) +} + +module.exports = GitHost diff --git a/node_modules/npm/node_modules/hosted-git-info/lib/parse-url.js b/node_modules/npm/node_modules/hosted-git-info/lib/parse-url.js new file mode 100644 index 00000000..7d5489c0 --- /dev/null +++ b/node_modules/npm/node_modules/hosted-git-info/lib/parse-url.js @@ -0,0 +1,78 @@ +const url = require('url') + +const lastIndexOfBefore = (str, char, beforeChar) => { + const startPosition = str.indexOf(beforeChar) + return str.lastIndexOf(char, startPosition > -1 ? startPosition : Infinity) +} + +const safeUrl = (u) => { + try { + return new url.URL(u) + } catch { + // this fn should never throw + } +} + +// accepts input like git:github.com:user/repo and inserts the // after the first : +const correctProtocol = (arg, protocols) => { + const firstColon = arg.indexOf(':') + const proto = arg.slice(0, firstColon + 1) + if (Object.prototype.hasOwnProperty.call(protocols, proto)) { + return arg + } + + const firstAt = arg.indexOf('@') + if (firstAt > -1) { + if (firstAt > firstColon) { + return `git+ssh://${arg}` + } else { + return arg + } + } + + const doubleSlash = arg.indexOf('//') + if (doubleSlash === firstColon + 1) { + return arg + } + + return `${arg.slice(0, firstColon + 1)}//${arg.slice(firstColon + 1)}` +} + +// attempt to correct an scp style url so that it will parse with `new URL()` +const correctUrl = (giturl) => { + // ignore @ that come after the first hash since the denotes the start + // of a committish which can contain @ characters + const firstAt = lastIndexOfBefore(giturl, '@', '#') + // ignore colons that come after the hash since that could include colons such as: + // git@github.com:user/package-2#semver:^1.0.0 + const lastColonBeforeHash = lastIndexOfBefore(giturl, ':', '#') + + if (lastColonBeforeHash > firstAt) { + // the last : comes after the first @ (or there is no @) + // like it would in: + // proto://hostname.com:user/repo + // username@hostname.com:user/repo + // :password@hostname.com:user/repo + // username:password@hostname.com:user/repo + // proto://username@hostname.com:user/repo + // proto://:password@hostname.com:user/repo + // proto://username:password@hostname.com:user/repo + // then we replace the last : with a / to create a valid path + giturl = giturl.slice(0, lastColonBeforeHash) + '/' + giturl.slice(lastColonBeforeHash + 1) + } + + if (lastIndexOfBefore(giturl, ':', '#') === -1 && giturl.indexOf('//') === -1) { + // we have no : at all + // as it would be in: + // username@hostname.com/user/repo + // then we prepend a protocol + giturl = `git+ssh://${giturl}` + } + + return giturl +} + +module.exports = (giturl, protocols) => { + const withProtocol = protocols ? correctProtocol(giturl, protocols) : giturl + return safeUrl(withProtocol) || safeUrl(correctUrl(withProtocol)) +} diff --git a/node_modules/npm/node_modules/hosted-git-info/package.json b/node_modules/npm/node_modules/hosted-git-info/package.json new file mode 100644 index 00000000..78356159 --- /dev/null +++ b/node_modules/npm/node_modules/hosted-git-info/package.json @@ -0,0 +1,61 @@ +{ + "name": "hosted-git-info", + "version": "8.0.2", + "description": "Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab", + "main": "./lib/index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/hosted-git-info.git" + }, + "keywords": [ + "git", + "github", + "bitbucket", + "gitlab" + ], + "author": "GitHub Inc.", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/hosted-git-info/issues" + }, + "homepage": "https://github.com/npm/hosted-git-info", + "scripts": { + "posttest": "npm run lint", + "snap": "tap", + "test": "tap", + "test:coverage": "tap --coverage-report=html", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "dependencies": { + "lru-cache": "^10.0.1" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.4", + "tap": "^16.0.1" + }, + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "tap": { + "color": 1, + "coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.4", + "publish": "true" + } +} diff --git a/node_modules/npm/node_modules/http-cache-semantics/LICENSE b/node_modules/npm/node_modules/http-cache-semantics/LICENSE new file mode 100644 index 00000000..493d2ea2 --- /dev/null +++ b/node_modules/npm/node_modules/http-cache-semantics/LICENSE @@ -0,0 +1,9 @@ +Copyright 2016-2018 Kornel Lesiński + +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/npm/node_modules/http-cache-semantics/index.js b/node_modules/npm/node_modules/http-cache-semantics/index.js new file mode 100644 index 00000000..31fba486 --- /dev/null +++ b/node_modules/npm/node_modules/http-cache-semantics/index.js @@ -0,0 +1,674 @@ +'use strict'; +// rfc7231 6.1 +const statusCodeCacheableByDefault = new Set([ + 200, + 203, + 204, + 206, + 300, + 301, + 308, + 404, + 405, + 410, + 414, + 501, +]); + +// This implementation does not understand partial responses (206) +const understoodStatuses = new Set([ + 200, + 203, + 204, + 300, + 301, + 302, + 303, + 307, + 308, + 404, + 405, + 410, + 414, + 501, +]); + +const errorStatusCodes = new Set([ + 500, + 502, + 503, + 504, +]); + +const hopByHopHeaders = { + date: true, // included, because we add Age update Date + connection: true, + 'keep-alive': true, + 'proxy-authenticate': true, + 'proxy-authorization': true, + te: true, + trailer: true, + 'transfer-encoding': true, + upgrade: true, +}; + +const excludedFromRevalidationUpdate = { + // Since the old body is reused, it doesn't make sense to change properties of the body + 'content-length': true, + 'content-encoding': true, + 'transfer-encoding': true, + 'content-range': true, +}; + +function toNumberOrZero(s) { + const n = parseInt(s, 10); + return isFinite(n) ? n : 0; +} + +// RFC 5861 +function isErrorResponse(response) { + // consider undefined response as faulty + if(!response) { + return true + } + return errorStatusCodes.has(response.status); +} + +function parseCacheControl(header) { + const cc = {}; + if (!header) return cc; + + // TODO: When there is more than one value present for a given directive (e.g., two Expires header fields, multiple Cache-Control: max-age directives), + // the directive's value is considered invalid. Caches are encouraged to consider responses that have invalid freshness information to be stale + const parts = header.trim().split(/,/); + for (const part of parts) { + const [k, v] = part.split(/=/, 2); + cc[k.trim()] = v === undefined ? true : v.trim().replace(/^"|"$/g, ''); + } + + return cc; +} + +function formatCacheControl(cc) { + let parts = []; + for (const k in cc) { + const v = cc[k]; + parts.push(v === true ? k : k + '=' + v); + } + if (!parts.length) { + return undefined; + } + return parts.join(', '); +} + +module.exports = class CachePolicy { + constructor( + req, + res, + { + shared, + cacheHeuristic, + immutableMinTimeToLive, + ignoreCargoCult, + _fromObject, + } = {} + ) { + if (_fromObject) { + this._fromObject(_fromObject); + return; + } + + if (!res || !res.headers) { + throw Error('Response headers missing'); + } + this._assertRequestHasHeaders(req); + + this._responseTime = this.now(); + this._isShared = shared !== false; + this._cacheHeuristic = + undefined !== cacheHeuristic ? cacheHeuristic : 0.1; // 10% matches IE + this._immutableMinTtl = + undefined !== immutableMinTimeToLive + ? immutableMinTimeToLive + : 24 * 3600 * 1000; + + this._status = 'status' in res ? res.status : 200; + this._resHeaders = res.headers; + this._rescc = parseCacheControl(res.headers['cache-control']); + this._method = 'method' in req ? req.method : 'GET'; + this._url = req.url; + this._host = req.headers.host; + this._noAuthorization = !req.headers.authorization; + this._reqHeaders = res.headers.vary ? req.headers : null; // Don't keep all request headers if they won't be used + this._reqcc = parseCacheControl(req.headers['cache-control']); + + // Assume that if someone uses legacy, non-standard uncecessary options they don't understand caching, + // so there's no point stricly adhering to the blindly copy&pasted directives. + if ( + ignoreCargoCult && + 'pre-check' in this._rescc && + 'post-check' in this._rescc + ) { + delete this._rescc['pre-check']; + delete this._rescc['post-check']; + delete this._rescc['no-cache']; + delete this._rescc['no-store']; + delete this._rescc['must-revalidate']; + this._resHeaders = Object.assign({}, this._resHeaders, { + 'cache-control': formatCacheControl(this._rescc), + }); + delete this._resHeaders.expires; + delete this._resHeaders.pragma; + } + + // When the Cache-Control header field is not present in a request, caches MUST consider the no-cache request pragma-directive + // as having the same effect as if "Cache-Control: no-cache" were present (see Section 5.2.1). + if ( + res.headers['cache-control'] == null && + /no-cache/.test(res.headers.pragma) + ) { + this._rescc['no-cache'] = true; + } + } + + now() { + return Date.now(); + } + + storable() { + // The "no-store" request directive indicates that a cache MUST NOT store any part of either this request or any response to it. + return !!( + !this._reqcc['no-store'] && + // A cache MUST NOT store a response to any request, unless: + // The request method is understood by the cache and defined as being cacheable, and + ('GET' === this._method || + 'HEAD' === this._method || + ('POST' === this._method && this._hasExplicitExpiration())) && + // the response status code is understood by the cache, and + understoodStatuses.has(this._status) && + // the "no-store" cache directive does not appear in request or response header fields, and + !this._rescc['no-store'] && + // the "private" response directive does not appear in the response, if the cache is shared, and + (!this._isShared || !this._rescc.private) && + // the Authorization header field does not appear in the request, if the cache is shared, + (!this._isShared || + this._noAuthorization || + this._allowsStoringAuthenticated()) && + // the response either: + // contains an Expires header field, or + (this._resHeaders.expires || + // contains a max-age response directive, or + // contains a s-maxage response directive and the cache is shared, or + // contains a public response directive. + this._rescc['max-age'] || + (this._isShared && this._rescc['s-maxage']) || + this._rescc.public || + // has a status code that is defined as cacheable by default + statusCodeCacheableByDefault.has(this._status)) + ); + } + + _hasExplicitExpiration() { + // 4.2.1 Calculating Freshness Lifetime + return ( + (this._isShared && this._rescc['s-maxage']) || + this._rescc['max-age'] || + this._resHeaders.expires + ); + } + + _assertRequestHasHeaders(req) { + if (!req || !req.headers) { + throw Error('Request headers missing'); + } + } + + satisfiesWithoutRevalidation(req) { + this._assertRequestHasHeaders(req); + + // When presented with a request, a cache MUST NOT reuse a stored response, unless: + // the presented request does not contain the no-cache pragma (Section 5.4), nor the no-cache cache directive, + // unless the stored response is successfully validated (Section 4.3), and + const requestCC = parseCacheControl(req.headers['cache-control']); + if (requestCC['no-cache'] || /no-cache/.test(req.headers.pragma)) { + return false; + } + + if (requestCC['max-age'] && this.age() > requestCC['max-age']) { + return false; + } + + if ( + requestCC['min-fresh'] && + this.timeToLive() < 1000 * requestCC['min-fresh'] + ) { + return false; + } + + // the stored response is either: + // fresh, or allowed to be served stale + if (this.stale()) { + const allowsStale = + requestCC['max-stale'] && + !this._rescc['must-revalidate'] && + (true === requestCC['max-stale'] || + requestCC['max-stale'] > this.age() - this.maxAge()); + if (!allowsStale) { + return false; + } + } + + return this._requestMatches(req, false); + } + + _requestMatches(req, allowHeadMethod) { + // The presented effective request URI and that of the stored response match, and + return ( + (!this._url || this._url === req.url) && + this._host === req.headers.host && + // the request method associated with the stored response allows it to be used for the presented request, and + (!req.method || + this._method === req.method || + (allowHeadMethod && 'HEAD' === req.method)) && + // selecting header fields nominated by the stored response (if any) match those presented, and + this._varyMatches(req) + ); + } + + _allowsStoringAuthenticated() { + // following Cache-Control response directives (Section 5.2.2) have such an effect: must-revalidate, public, and s-maxage. + return ( + this._rescc['must-revalidate'] || + this._rescc.public || + this._rescc['s-maxage'] + ); + } + + _varyMatches(req) { + if (!this._resHeaders.vary) { + return true; + } + + // A Vary header field-value of "*" always fails to match + if (this._resHeaders.vary === '*') { + return false; + } + + const fields = this._resHeaders.vary + .trim() + .toLowerCase() + .split(/\s*,\s*/); + for (const name of fields) { + if (req.headers[name] !== this._reqHeaders[name]) return false; + } + return true; + } + + _copyWithoutHopByHopHeaders(inHeaders) { + const headers = {}; + for (const name in inHeaders) { + if (hopByHopHeaders[name]) continue; + headers[name] = inHeaders[name]; + } + // 9.1. Connection + if (inHeaders.connection) { + const tokens = inHeaders.connection.trim().split(/\s*,\s*/); + for (const name of tokens) { + delete headers[name]; + } + } + if (headers.warning) { + const warnings = headers.warning.split(/,/).filter(warning => { + return !/^\s*1[0-9][0-9]/.test(warning); + }); + if (!warnings.length) { + delete headers.warning; + } else { + headers.warning = warnings.join(',').trim(); + } + } + return headers; + } + + responseHeaders() { + const headers = this._copyWithoutHopByHopHeaders(this._resHeaders); + const age = this.age(); + + // A cache SHOULD generate 113 warning if it heuristically chose a freshness + // lifetime greater than 24 hours and the response's age is greater than 24 hours. + if ( + age > 3600 * 24 && + !this._hasExplicitExpiration() && + this.maxAge() > 3600 * 24 + ) { + headers.warning = + (headers.warning ? `${headers.warning}, ` : '') + + '113 - "rfc7234 5.5.4"'; + } + headers.age = `${Math.round(age)}`; + headers.date = new Date(this.now()).toUTCString(); + return headers; + } + + /** + * Value of the Date response header or current time if Date was invalid + * @return timestamp + */ + date() { + const serverDate = Date.parse(this._resHeaders.date); + if (isFinite(serverDate)) { + return serverDate; + } + return this._responseTime; + } + + /** + * Value of the Age header, in seconds, updated for the current time. + * May be fractional. + * + * @return Number + */ + age() { + let age = this._ageValue(); + + const residentTime = (this.now() - this._responseTime) / 1000; + return age + residentTime; + } + + _ageValue() { + return toNumberOrZero(this._resHeaders.age); + } + + /** + * Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`. + * + * For an up-to-date value, see `timeToLive()`. + * + * @return Number + */ + maxAge() { + if (!this.storable() || this._rescc['no-cache']) { + return 0; + } + + // Shared responses with cookies are cacheable according to the RFC, but IMHO it'd be unwise to do so by default + // so this implementation requires explicit opt-in via public header + if ( + this._isShared && + (this._resHeaders['set-cookie'] && + !this._rescc.public && + !this._rescc.immutable) + ) { + return 0; + } + + if (this._resHeaders.vary === '*') { + return 0; + } + + if (this._isShared) { + if (this._rescc['proxy-revalidate']) { + return 0; + } + // if a response includes the s-maxage directive, a shared cache recipient MUST ignore the Expires field. + if (this._rescc['s-maxage']) { + return toNumberOrZero(this._rescc['s-maxage']); + } + } + + // If a response includes a Cache-Control field with the max-age directive, a recipient MUST ignore the Expires field. + if (this._rescc['max-age']) { + return toNumberOrZero(this._rescc['max-age']); + } + + const defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0; + + const serverDate = this.date(); + if (this._resHeaders.expires) { + const expires = Date.parse(this._resHeaders.expires); + // A cache recipient MUST interpret invalid date formats, especially the value "0", as representing a time in the past (i.e., "already expired"). + if (Number.isNaN(expires) || expires < serverDate) { + return 0; + } + return Math.max(defaultMinTtl, (expires - serverDate) / 1000); + } + + if (this._resHeaders['last-modified']) { + const lastModified = Date.parse(this._resHeaders['last-modified']); + if (isFinite(lastModified) && serverDate > lastModified) { + return Math.max( + defaultMinTtl, + ((serverDate - lastModified) / 1000) * this._cacheHeuristic + ); + } + } + + return defaultMinTtl; + } + + timeToLive() { + const age = this.maxAge() - this.age(); + const staleIfErrorAge = age + toNumberOrZero(this._rescc['stale-if-error']); + const staleWhileRevalidateAge = age + toNumberOrZero(this._rescc['stale-while-revalidate']); + return Math.max(0, age, staleIfErrorAge, staleWhileRevalidateAge) * 1000; + } + + stale() { + return this.maxAge() <= this.age(); + } + + _useStaleIfError() { + return this.maxAge() + toNumberOrZero(this._rescc['stale-if-error']) > this.age(); + } + + useStaleWhileRevalidate() { + return this.maxAge() + toNumberOrZero(this._rescc['stale-while-revalidate']) > this.age(); + } + + static fromObject(obj) { + return new this(undefined, undefined, { _fromObject: obj }); + } + + _fromObject(obj) { + if (this._responseTime) throw Error('Reinitialized'); + if (!obj || obj.v !== 1) throw Error('Invalid serialization'); + + this._responseTime = obj.t; + this._isShared = obj.sh; + this._cacheHeuristic = obj.ch; + this._immutableMinTtl = + obj.imm !== undefined ? obj.imm : 24 * 3600 * 1000; + this._status = obj.st; + this._resHeaders = obj.resh; + this._rescc = obj.rescc; + this._method = obj.m; + this._url = obj.u; + this._host = obj.h; + this._noAuthorization = obj.a; + this._reqHeaders = obj.reqh; + this._reqcc = obj.reqcc; + } + + toObject() { + return { + v: 1, + t: this._responseTime, + sh: this._isShared, + ch: this._cacheHeuristic, + imm: this._immutableMinTtl, + st: this._status, + resh: this._resHeaders, + rescc: this._rescc, + m: this._method, + u: this._url, + h: this._host, + a: this._noAuthorization, + reqh: this._reqHeaders, + reqcc: this._reqcc, + }; + } + + /** + * Headers for sending to the origin server to revalidate stale response. + * Allows server to return 304 to allow reuse of the previous response. + * + * Hop by hop headers are always stripped. + * Revalidation headers may be added or removed, depending on request. + */ + revalidationHeaders(incomingReq) { + this._assertRequestHasHeaders(incomingReq); + const headers = this._copyWithoutHopByHopHeaders(incomingReq.headers); + + // This implementation does not understand range requests + delete headers['if-range']; + + if (!this._requestMatches(incomingReq, true) || !this.storable()) { + // revalidation allowed via HEAD + // not for the same resource, or wasn't allowed to be cached anyway + delete headers['if-none-match']; + delete headers['if-modified-since']; + return headers; + } + + /* MUST send that entity-tag in any cache validation request (using If-Match or If-None-Match) if an entity-tag has been provided by the origin server. */ + if (this._resHeaders.etag) { + headers['if-none-match'] = headers['if-none-match'] + ? `${headers['if-none-match']}, ${this._resHeaders.etag}` + : this._resHeaders.etag; + } + + // Clients MAY issue simple (non-subrange) GET requests with either weak validators or strong validators. Clients MUST NOT use weak validators in other forms of request. + const forbidsWeakValidators = + headers['accept-ranges'] || + headers['if-match'] || + headers['if-unmodified-since'] || + (this._method && this._method != 'GET'); + + /* SHOULD send the Last-Modified value in non-subrange cache validation requests (using If-Modified-Since) if only a Last-Modified value has been provided by the origin server. + Note: This implementation does not understand partial responses (206) */ + if (forbidsWeakValidators) { + delete headers['if-modified-since']; + + if (headers['if-none-match']) { + const etags = headers['if-none-match'] + .split(/,/) + .filter(etag => { + return !/^\s*W\//.test(etag); + }); + if (!etags.length) { + delete headers['if-none-match']; + } else { + headers['if-none-match'] = etags.join(',').trim(); + } + } + } else if ( + this._resHeaders['last-modified'] && + !headers['if-modified-since'] + ) { + headers['if-modified-since'] = this._resHeaders['last-modified']; + } + + return headers; + } + + /** + * Creates new CachePolicy with information combined from the previews response, + * and the new revalidation response. + * + * Returns {policy, modified} where modified is a boolean indicating + * whether the response body has been modified, and old cached body can't be used. + * + * @return {Object} {policy: CachePolicy, modified: Boolean} + */ + revalidatedPolicy(request, response) { + this._assertRequestHasHeaders(request); + if(this._useStaleIfError() && isErrorResponse(response)) { // I consider the revalidation request unsuccessful + return { + modified: false, + matches: false, + policy: this, + }; + } + if (!response || !response.headers) { + throw Error('Response headers missing'); + } + + // These aren't going to be supported exactly, since one CachePolicy object + // doesn't know about all the other cached objects. + let matches = false; + if (response.status !== undefined && response.status != 304) { + matches = false; + } else if ( + response.headers.etag && + !/^\s*W\//.test(response.headers.etag) + ) { + // "All of the stored responses with the same strong validator are selected. + // If none of the stored responses contain the same strong validator, + // then the cache MUST NOT use the new response to update any stored responses." + matches = + this._resHeaders.etag && + this._resHeaders.etag.replace(/^\s*W\//, '') === + response.headers.etag; + } else if (this._resHeaders.etag && response.headers.etag) { + // "If the new response contains a weak validator and that validator corresponds + // to one of the cache's stored responses, + // then the most recent of those matching stored responses is selected for update." + matches = + this._resHeaders.etag.replace(/^\s*W\//, '') === + response.headers.etag.replace(/^\s*W\//, ''); + } else if (this._resHeaders['last-modified']) { + matches = + this._resHeaders['last-modified'] === + response.headers['last-modified']; + } else { + // If the new response does not include any form of validator (such as in the case where + // a client generates an If-Modified-Since request from a source other than the Last-Modified + // response header field), and there is only one stored response, and that stored response also + // lacks a validator, then that stored response is selected for update. + if ( + !this._resHeaders.etag && + !this._resHeaders['last-modified'] && + !response.headers.etag && + !response.headers['last-modified'] + ) { + matches = true; + } + } + + if (!matches) { + return { + policy: new this.constructor(request, response), + // Client receiving 304 without body, even if it's invalid/mismatched has no option + // but to reuse a cached body. We don't have a good way to tell clients to do + // error recovery in such case. + modified: response.status != 304, + matches: false, + }; + } + + // use other header fields provided in the 304 (Not Modified) response to replace all instances + // of the corresponding header fields in the stored response. + const headers = {}; + for (const k in this._resHeaders) { + headers[k] = + k in response.headers && !excludedFromRevalidationUpdate[k] + ? response.headers[k] + : this._resHeaders[k]; + } + + const newResponse = Object.assign({}, response, { + status: this._status, + method: this._method, + headers, + }); + return { + policy: new this.constructor(request, newResponse, { + shared: this._isShared, + cacheHeuristic: this._cacheHeuristic, + immutableMinTimeToLive: this._immutableMinTtl, + }), + modified: false, + matches: true, + }; + } +}; diff --git a/node_modules/npm/node_modules/http-cache-semantics/package.json b/node_modules/npm/node_modules/http-cache-semantics/package.json new file mode 100644 index 00000000..defbb045 --- /dev/null +++ b/node_modules/npm/node_modules/http-cache-semantics/package.json @@ -0,0 +1,18 @@ +{ + "name": "http-cache-semantics", + "version": "4.1.1", + "description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies", + "repository": "https://github.com/kornelski/http-cache-semantics.git", + "main": "index.js", + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "author": "Kornel Lesiński (https://kornel.ski/)", + "license": "BSD-2-Clause", + "devDependencies": { + "mocha": "^10.0" + } +} diff --git a/node_modules/npm/node_modules/http-proxy-agent/LICENSE b/node_modules/npm/node_modules/http-proxy-agent/LICENSE new file mode 100644 index 00000000..7ddd1e9b --- /dev/null +++ b/node_modules/npm/node_modules/http-proxy-agent/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2013 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/npm/node_modules/http-proxy-agent/dist/index.js b/node_modules/npm/node_modules/http-proxy-agent/dist/index.js new file mode 100644 index 00000000..fb2751c2 --- /dev/null +++ b/node_modules/npm/node_modules/http-proxy-agent/dist/index.js @@ -0,0 +1,148 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.HttpProxyAgent = void 0; +const net = __importStar(require("net")); +const tls = __importStar(require("tls")); +const debug_1 = __importDefault(require("debug")); +const events_1 = require("events"); +const agent_base_1 = require("agent-base"); +const url_1 = require("url"); +const debug = (0, debug_1.default)('http-proxy-agent'); +/** + * The `HttpProxyAgent` implements an HTTP Agent subclass that connects + * to the specified "HTTP proxy server" in order to proxy HTTP requests. + */ +class HttpProxyAgent extends agent_base_1.Agent { + constructor(proxy, opts) { + super(opts); + this.proxy = typeof proxy === 'string' ? new url_1.URL(proxy) : proxy; + this.proxyHeaders = opts?.headers ?? {}; + debug('Creating new HttpProxyAgent instance: %o', this.proxy.href); + // Trim off the brackets from IPv6 addresses + const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, ''); + const port = this.proxy.port + ? parseInt(this.proxy.port, 10) + : this.proxy.protocol === 'https:' + ? 443 + : 80; + this.connectOpts = { + ...(opts ? omit(opts, 'headers') : null), + host, + port, + }; + } + addRequest(req, opts) { + req._header = null; + this.setRequestProps(req, opts); + // @ts-expect-error `addRequest()` isn't defined in `@types/node` + super.addRequest(req, opts); + } + setRequestProps(req, opts) { + const { proxy } = this; + const protocol = opts.secureEndpoint ? 'https:' : 'http:'; + const hostname = req.getHeader('host') || 'localhost'; + const base = `${protocol}//${hostname}`; + const url = new url_1.URL(req.path, base); + if (opts.port !== 80) { + url.port = String(opts.port); + } + // Change the `http.ClientRequest` instance's "path" field + // to the absolute path of the URL that will be requested. + req.path = String(url); + // Inject the `Proxy-Authorization` header if necessary. + const headers = typeof this.proxyHeaders === 'function' + ? this.proxyHeaders() + : { ...this.proxyHeaders }; + if (proxy.username || proxy.password) { + const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`; + headers['Proxy-Authorization'] = `Basic ${Buffer.from(auth).toString('base64')}`; + } + if (!headers['Proxy-Connection']) { + headers['Proxy-Connection'] = this.keepAlive + ? 'Keep-Alive' + : 'close'; + } + for (const name of Object.keys(headers)) { + const value = headers[name]; + if (value) { + req.setHeader(name, value); + } + } + } + async connect(req, opts) { + req._header = null; + if (!req.path.includes('://')) { + this.setRequestProps(req, opts); + } + // 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`. + let first; + let endOfHeaders; + debug('Regenerating stored HTTP header string for request'); + req._implicitHeader(); + if (req.outputData && req.outputData.length > 0) { + 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); + } + // Create a socket connection to the proxy server. + let socket; + if (this.proxy.protocol === 'https:') { + debug('Creating `tls.Socket`: %o', this.connectOpts); + socket = tls.connect(this.connectOpts); + } + else { + debug('Creating `net.Socket`: %o', this.connectOpts); + socket = net.connect(this.connectOpts); + } + // 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. + await (0, events_1.once)(socket, 'connect'); + return socket; + } +} +HttpProxyAgent.protocols = ['http', 'https']; +exports.HttpProxyAgent = HttpProxyAgent; +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/npm/node_modules/http-proxy-agent/package.json b/node_modules/npm/node_modules/http-proxy-agent/package.json new file mode 100644 index 00000000..a53940a3 --- /dev/null +++ b/node_modules/npm/node_modules/http-proxy-agent/package.json @@ -0,0 +1,47 @@ +{ + "name": "http-proxy-agent", + "version": "7.0.2", + "description": "An HTTP(s) proxy `http.Agent` implementation for HTTP", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "repository": { + "type": "git", + "url": "https://github.com/TooTallNate/proxy-agents.git", + "directory": "packages/http-proxy-agent" + }, + "keywords": [ + "http", + "proxy", + "endpoint", + "agent" + ], + "author": "Nathan Rajlich (http://n8.io/)", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "devDependencies": { + "@types/debug": "^4.1.7", + "@types/jest": "^29.5.1", + "@types/node": "^14.18.45", + "async-listen": "^3.0.0", + "jest": "^29.5.0", + "ts-jest": "^29.1.0", + "typescript": "^5.0.4", + "proxy": "2.1.1", + "tsconfig": "0.0.0" + }, + "engines": { + "node": ">= 14" + }, + "scripts": { + "build": "tsc", + "test": "jest --env node --verbose --bail", + "lint": "eslint . --ext .ts", + "pack": "node ../../scripts/pack.mjs" + } +} \ No newline at end of file diff --git a/node_modules/npm/node_modules/https-proxy-agent/LICENSE b/node_modules/npm/node_modules/https-proxy-agent/LICENSE new file mode 100644 index 00000000..008728cb --- /dev/null +++ b/node_modules/npm/node_modules/https-proxy-agent/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2013 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. \ No newline at end of file diff --git a/node_modules/npm/node_modules/https-proxy-agent/dist/index.js b/node_modules/npm/node_modules/https-proxy-agent/dist/index.js new file mode 100644 index 00000000..1857f464 --- /dev/null +++ b/node_modules/npm/node_modules/https-proxy-agent/dist/index.js @@ -0,0 +1,180 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.HttpsProxyAgent = void 0; +const net = __importStar(require("net")); +const tls = __importStar(require("tls")); +const assert_1 = __importDefault(require("assert")); +const debug_1 = __importDefault(require("debug")); +const agent_base_1 = require("agent-base"); +const url_1 = require("url"); +const parse_proxy_response_1 = require("./parse-proxy-response"); +const debug = (0, debug_1.default)('https-proxy-agent'); +const setServernameFromNonIpHost = (options) => { + if (options.servername === undefined && + options.host && + !net.isIP(options.host)) { + return { + ...options, + servername: options.host, + }; + } + return options; +}; +/** + * 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. + */ +class HttpsProxyAgent extends agent_base_1.Agent { + constructor(proxy, opts) { + super(opts); + this.options = { path: undefined }; + this.proxy = typeof proxy === 'string' ? new url_1.URL(proxy) : proxy; + this.proxyHeaders = opts?.headers ?? {}; + debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href); + // Trim off the brackets from IPv6 addresses + const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, ''); + const port = this.proxy.port + ? parseInt(this.proxy.port, 10) + : this.proxy.protocol === 'https:' + ? 443 + : 80; + this.connectOpts = { + // Attempt to negotiate http/1.1 for proxy servers that support http/2 + ALPNProtocols: ['http/1.1'], + ...(opts ? omit(opts, 'headers') : null), + host, + port, + }; + } + /** + * Called when the node-core HTTP client library is creating a + * new HTTP request. + */ + async connect(req, opts) { + const { proxy } = this; + if (!opts.host) { + throw new TypeError('No "host" provided'); + } + // Create a socket connection to the proxy server. + let socket; + if (proxy.protocol === 'https:') { + debug('Creating `tls.Socket`: %o', this.connectOpts); + socket = tls.connect(setServernameFromNonIpHost(this.connectOpts)); + } + else { + debug('Creating `net.Socket`: %o', this.connectOpts); + socket = net.connect(this.connectOpts); + } + const headers = typeof this.proxyHeaders === 'function' + ? this.proxyHeaders() + : { ...this.proxyHeaders }; + const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host; + let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r\n`; + // Inject the `Proxy-Authorization` header if necessary. + if (proxy.username || proxy.password) { + const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`; + headers['Proxy-Authorization'] = `Basic ${Buffer.from(auth).toString('base64')}`; + } + headers.Host = `${host}:${opts.port}`; + if (!headers['Proxy-Connection']) { + headers['Proxy-Connection'] = this.keepAlive + ? 'Keep-Alive' + : 'close'; + } + for (const name of Object.keys(headers)) { + payload += `${name}: ${headers[name]}\r\n`; + } + const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket); + socket.write(`${payload}\r\n`); + const { connect, buffered } = await proxyResponsePromise; + req.emit('proxyConnect', connect); + this.emit('proxyConnect', connect, req); + if (connect.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'); + return tls.connect({ + ...omit(setServernameFromNonIpHost(opts), 'host', 'path', 'port'), + socket, + }); + } + 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.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'); + (0, 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; + } +} +HttpsProxyAgent.protocols = ['http', 'https']; +exports.HttpsProxyAgent = HttpsProxyAgent; +function resume(socket) { + socket.resume(); +} +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/npm/node_modules/https-proxy-agent/dist/parse-proxy-response.js b/node_modules/npm/node_modules/https-proxy-agent/dist/parse-proxy-response.js new file mode 100644 index 00000000..d3f506f9 --- /dev/null +++ b/node_modules/npm/node_modules/https-proxy-agent/dist/parse-proxy-response.js @@ -0,0 +1,101 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseProxyResponse = void 0; +const debug_1 = __importDefault(require("debug")); +const debug = (0, 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('readable', read); + } + function onend() { + cleanup(); + debug('onend'); + reject(new Error('Proxy connection ended before receiving CONNECT response')); + } + 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 headerParts = buffered + .slice(0, endOfHeaders) + .toString('ascii') + .split('\r\n'); + const firstLine = headerParts.shift(); + if (!firstLine) { + socket.destroy(); + return reject(new Error('No header received from proxy CONNECT response')); + } + const firstLineParts = firstLine.split(' '); + const statusCode = +firstLineParts[1]; + const statusText = firstLineParts.slice(2).join(' '); + const headers = {}; + for (const header of headerParts) { + if (!header) + continue; + const firstColon = header.indexOf(':'); + if (firstColon === -1) { + socket.destroy(); + return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`)); + } + const key = header.slice(0, firstColon).toLowerCase(); + const value = header.slice(firstColon + 1).trimStart(); + const current = headers[key]; + if (typeof current === 'string') { + headers[key] = [current, value]; + } + else if (Array.isArray(current)) { + current.push(value); + } + else { + headers[key] = value; + } + } + debug('got proxy server response: %o %o', firstLine, headers); + cleanup(); + resolve({ + connect: { + statusCode, + statusText, + headers, + }, + buffered, + }); + } + socket.on('error', onerror); + socket.on('end', onend); + read(); + }); +} +exports.parseProxyResponse = parseProxyResponse; +//# sourceMappingURL=parse-proxy-response.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/https-proxy-agent/package.json b/node_modules/npm/node_modules/https-proxy-agent/package.json new file mode 100644 index 00000000..51b7e117 --- /dev/null +++ b/node_modules/npm/node_modules/https-proxy-agent/package.json @@ -0,0 +1,50 @@ +{ + "name": "https-proxy-agent", + "version": "7.0.6", + "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "repository": { + "type": "git", + "url": "https://github.com/TooTallNate/proxy-agents.git", + "directory": "packages/https-proxy-agent" + }, + "keywords": [ + "https", + "proxy", + "endpoint", + "agent" + ], + "author": "Nathan Rajlich (http://n8.io/)", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "devDependencies": { + "@types/async-retry": "^1.4.5", + "@types/debug": "4", + "@types/jest": "^29.5.1", + "@types/node": "^14.18.45", + "async-listen": "^3.0.0", + "async-retry": "^1.3.3", + "jest": "^29.5.0", + "ts-jest": "^29.1.0", + "typescript": "^5.0.4", + "proxy": "2.2.0", + "tsconfig": "0.0.0" + }, + "engines": { + "node": ">= 14" + }, + "scripts": { + "build": "tsc", + "test": "jest --env node --verbose --bail test/test.ts", + "test-e2e": "jest --env node --verbose --bail test/e2e.test.ts", + "lint": "eslint --ext .ts", + "pack": "node ../../scripts/pack.mjs" + } +} \ No newline at end of file diff --git a/node_modules/npm/node_modules/iconv-lite/LICENSE b/node_modules/npm/node_modules/iconv-lite/LICENSE new file mode 100644 index 00000000..d518d837 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2011 Alexander Shtuchkin + +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/npm/node_modules/iconv-lite/encodings/dbcs-codec.js b/node_modules/npm/node_modules/iconv-lite/encodings/dbcs-codec.js new file mode 100644 index 00000000..fa839170 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/dbcs-codec.js @@ -0,0 +1,597 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Multibyte codec. In this scheme, a character is represented by 1 or more bytes. +// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences. +// To save memory and loading time, we read table files only when requested. + +exports._dbcs = DBCSCodec; + +var UNASSIGNED = -1, + GB18030_CODE = -2, + SEQ_START = -10, + NODE_START = -1000, + UNASSIGNED_NODE = new Array(0x100), + DEF_CHAR = -1; + +for (var i = 0; i < 0x100; i++) + UNASSIGNED_NODE[i] = UNASSIGNED; + + +// Class DBCSCodec reads and initializes mapping tables. +function DBCSCodec(codecOptions, iconv) { + this.encodingName = codecOptions.encodingName; + if (!codecOptions) + throw new Error("DBCS codec is called without the data.") + if (!codecOptions.table) + throw new Error("Encoding '" + this.encodingName + "' has no data."); + + // Load tables. + var mappingTable = codecOptions.table(); + + + // Decode tables: MBCS -> Unicode. + + // decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256. + // Trie root is decodeTables[0]. + // Values: >= 0 -> unicode character code. can be > 0xFFFF + // == UNASSIGNED -> unknown/unassigned sequence. + // == GB18030_CODE -> this is the end of a GB18030 4-byte sequence. + // <= NODE_START -> index of the next node in our trie to process next byte. + // <= SEQ_START -> index of the start of a character code sequence, in decodeTableSeq. + this.decodeTables = []; + this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node. + + // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here. + this.decodeTableSeq = []; + + // Actual mapping tables consist of chunks. Use them to fill up decode tables. + for (var i = 0; i < mappingTable.length; i++) + this._addDecodeChunk(mappingTable[i]); + + // Load & create GB18030 tables when needed. + if (typeof codecOptions.gb18030 === 'function') { + this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges. + + // Add GB18030 common decode nodes. + var commonThirdByteNodeIdx = this.decodeTables.length; + this.decodeTables.push(UNASSIGNED_NODE.slice(0)); + + var commonFourthByteNodeIdx = this.decodeTables.length; + this.decodeTables.push(UNASSIGNED_NODE.slice(0)); + + // Fill out the tree + var firstByteNode = this.decodeTables[0]; + for (var i = 0x81; i <= 0xFE; i++) { + var secondByteNode = this.decodeTables[NODE_START - firstByteNode[i]]; + for (var j = 0x30; j <= 0x39; j++) { + if (secondByteNode[j] === UNASSIGNED) { + secondByteNode[j] = NODE_START - commonThirdByteNodeIdx; + } else if (secondByteNode[j] > NODE_START) { + throw new Error("gb18030 decode tables conflict at byte 2"); + } + + var thirdByteNode = this.decodeTables[NODE_START - secondByteNode[j]]; + for (var k = 0x81; k <= 0xFE; k++) { + if (thirdByteNode[k] === UNASSIGNED) { + thirdByteNode[k] = NODE_START - commonFourthByteNodeIdx; + } else if (thirdByteNode[k] === NODE_START - commonFourthByteNodeIdx) { + continue; + } else if (thirdByteNode[k] > NODE_START) { + throw new Error("gb18030 decode tables conflict at byte 3"); + } + + var fourthByteNode = this.decodeTables[NODE_START - thirdByteNode[k]]; + for (var l = 0x30; l <= 0x39; l++) { + if (fourthByteNode[l] === UNASSIGNED) + fourthByteNode[l] = GB18030_CODE; + } + } + } + } + } + + this.defaultCharUnicode = iconv.defaultCharUnicode; + + + // Encode tables: Unicode -> DBCS. + + // `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance. + // Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null. + // Values: >= 0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.). + // == UNASSIGNED -> no conversion found. Output a default char. + // <= SEQ_START -> it's an index in encodeTableSeq, see below. The character starts a sequence. + this.encodeTable = []; + + // `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of + // objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key + // means end of sequence (needed when one sequence is a strict subsequence of another). + // Objects are kept separately from encodeTable to increase performance. + this.encodeTableSeq = []; + + // Some chars can be decoded, but need not be encoded. + var skipEncodeChars = {}; + if (codecOptions.encodeSkipVals) + for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) { + var val = codecOptions.encodeSkipVals[i]; + if (typeof val === 'number') + skipEncodeChars[val] = true; + else + for (var j = val.from; j <= val.to; j++) + skipEncodeChars[j] = true; + } + + // Use decode trie to recursively fill out encode tables. + this._fillEncodeTable(0, 0, skipEncodeChars); + + // Add more encoding pairs when needed. + if (codecOptions.encodeAdd) { + for (var uChar in codecOptions.encodeAdd) + if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar)) + this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]); + } + + this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)]; + if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?']; + if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0); +} + +DBCSCodec.prototype.encoder = DBCSEncoder; +DBCSCodec.prototype.decoder = DBCSDecoder; + +// Decoder helpers +DBCSCodec.prototype._getDecodeTrieNode = function(addr) { + var bytes = []; + for (; addr > 0; addr >>>= 8) + bytes.push(addr & 0xFF); + if (bytes.length == 0) + bytes.push(0); + + var node = this.decodeTables[0]; + for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie. + var val = node[bytes[i]]; + + if (val == UNASSIGNED) { // Create new node. + node[bytes[i]] = NODE_START - this.decodeTables.length; + this.decodeTables.push(node = UNASSIGNED_NODE.slice(0)); + } + else if (val <= NODE_START) { // Existing node. + node = this.decodeTables[NODE_START - val]; + } + else + throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16)); + } + return node; +} + + +DBCSCodec.prototype._addDecodeChunk = function(chunk) { + // First element of chunk is the hex mbcs code where we start. + var curAddr = parseInt(chunk[0], 16); + + // Choose the decoding node where we'll write our chars. + var writeTable = this._getDecodeTrieNode(curAddr); + curAddr = curAddr & 0xFF; + + // Write all other elements of the chunk to the table. + for (var k = 1; k < chunk.length; k++) { + var part = chunk[k]; + if (typeof part === "string") { // String, write as-is. + for (var l = 0; l < part.length;) { + var code = part.charCodeAt(l++); + if (0xD800 <= code && code < 0xDC00) { // Decode surrogate + var codeTrail = part.charCodeAt(l++); + if (0xDC00 <= codeTrail && codeTrail < 0xE000) + writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00); + else + throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]); + } + else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used) + var len = 0xFFF - code + 2; + var seq = []; + for (var m = 0; m < len; m++) + seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq. + + writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length; + this.decodeTableSeq.push(seq); + } + else + writeTable[curAddr++] = code; // Basic char + } + } + else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character. + var charCode = writeTable[curAddr - 1] + 1; + for (var l = 0; l < part; l++) + writeTable[curAddr++] = charCode++; + } + else + throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]); + } + if (curAddr > 0xFF) + throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr); +} + +// Encoder helpers +DBCSCodec.prototype._getEncodeBucket = function(uCode) { + var high = uCode >> 8; // This could be > 0xFF because of astral characters. + if (this.encodeTable[high] === undefined) + this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand. + return this.encodeTable[high]; +} + +DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) { + var bucket = this._getEncodeBucket(uCode); + var low = uCode & 0xFF; + if (bucket[low] <= SEQ_START) + this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it. + else if (bucket[low] == UNASSIGNED) + bucket[low] = dbcsCode; +} + +DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) { + + // Get the root of character tree according to first character of the sequence. + var uCode = seq[0]; + var bucket = this._getEncodeBucket(uCode); + var low = uCode & 0xFF; + + var node; + if (bucket[low] <= SEQ_START) { + // There's already a sequence with - use it. + node = this.encodeTableSeq[SEQ_START-bucket[low]]; + } + else { + // There was no sequence object - allocate a new one. + node = {}; + if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence. + bucket[low] = SEQ_START - this.encodeTableSeq.length; + this.encodeTableSeq.push(node); + } + + // Traverse the character tree, allocating new nodes as needed. + for (var j = 1; j < seq.length-1; j++) { + var oldVal = node[uCode]; + if (typeof oldVal === 'object') + node = oldVal; + else { + node = node[uCode] = {} + if (oldVal !== undefined) + node[DEF_CHAR] = oldVal + } + } + + // Set the leaf to given dbcsCode. + uCode = seq[seq.length-1]; + node[uCode] = dbcsCode; +} + +DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) { + var node = this.decodeTables[nodeIdx]; + var hasValues = false; + var subNodeEmpty = {}; + for (var i = 0; i < 0x100; i++) { + var uCode = node[i]; + var mbCode = prefix + i; + if (skipEncodeChars[mbCode]) + continue; + + if (uCode >= 0) { + this._setEncodeChar(uCode, mbCode); + hasValues = true; + } else if (uCode <= NODE_START) { + var subNodeIdx = NODE_START - uCode; + if (!subNodeEmpty[subNodeIdx]) { // Skip empty subtrees (they are too large in gb18030). + var newPrefix = (mbCode << 8) >>> 0; // NOTE: '>>> 0' keeps 32-bit num positive. + if (this._fillEncodeTable(subNodeIdx, newPrefix, skipEncodeChars)) + hasValues = true; + else + subNodeEmpty[subNodeIdx] = true; + } + } else if (uCode <= SEQ_START) { + this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode); + hasValues = true; + } + } + return hasValues; +} + + + +// == Encoder ================================================================== + +function DBCSEncoder(options, codec) { + // Encoder state + this.leadSurrogate = -1; + this.seqObj = undefined; + + // Static data + this.encodeTable = codec.encodeTable; + this.encodeTableSeq = codec.encodeTableSeq; + this.defaultCharSingleByte = codec.defCharSB; + this.gb18030 = codec.gb18030; +} + +DBCSEncoder.prototype.write = function(str) { + var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)), + leadSurrogate = this.leadSurrogate, + seqObj = this.seqObj, nextChar = -1, + i = 0, j = 0; + + while (true) { + // 0. Get next character. + if (nextChar === -1) { + if (i == str.length) break; + var uCode = str.charCodeAt(i++); + } + else { + var uCode = nextChar; + nextChar = -1; + } + + // 1. Handle surrogates. + if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates. + if (uCode < 0xDC00) { // We've got lead surrogate. + if (leadSurrogate === -1) { + leadSurrogate = uCode; + continue; + } else { + leadSurrogate = uCode; + // Double lead surrogate found. + uCode = UNASSIGNED; + } + } else { // We've got trail surrogate. + if (leadSurrogate !== -1) { + uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00); + leadSurrogate = -1; + } else { + // Incomplete surrogate pair - only trail surrogate found. + uCode = UNASSIGNED; + } + + } + } + else if (leadSurrogate !== -1) { + // Incomplete surrogate pair - only lead surrogate found. + nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char. + leadSurrogate = -1; + } + + // 2. Convert uCode character. + var dbcsCode = UNASSIGNED; + if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence + var resCode = seqObj[uCode]; + if (typeof resCode === 'object') { // Sequence continues. + seqObj = resCode; + continue; + + } else if (typeof resCode == 'number') { // Sequence finished. Write it. + dbcsCode = resCode; + + } else if (resCode == undefined) { // Current character is not part of the sequence. + + // Try default character for this sequence + resCode = seqObj[DEF_CHAR]; + if (resCode !== undefined) { + dbcsCode = resCode; // Found. Write it. + nextChar = uCode; // Current character will be written too in the next iteration. + + } else { + // TODO: What if we have no default? (resCode == undefined) + // Then, we should write first char of the sequence as-is and try the rest recursively. + // Didn't do it for now because no encoding has this situation yet. + // Currently, just skip the sequence and write current char. + } + } + seqObj = undefined; + } + else if (uCode >= 0) { // Regular character + var subtable = this.encodeTable[uCode >> 8]; + if (subtable !== undefined) + dbcsCode = subtable[uCode & 0xFF]; + + if (dbcsCode <= SEQ_START) { // Sequence start + seqObj = this.encodeTableSeq[SEQ_START-dbcsCode]; + continue; + } + + if (dbcsCode == UNASSIGNED && this.gb18030) { + // Use GB18030 algorithm to find character(s) to write. + var idx = findIdx(this.gb18030.uChars, uCode); + if (idx != -1) { + var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]); + newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600; + newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260; + newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10; + newBuf[j++] = 0x30 + dbcsCode; + continue; + } + } + } + + // 3. Write dbcsCode character. + if (dbcsCode === UNASSIGNED) + dbcsCode = this.defaultCharSingleByte; + + if (dbcsCode < 0x100) { + newBuf[j++] = dbcsCode; + } + else if (dbcsCode < 0x10000) { + newBuf[j++] = dbcsCode >> 8; // high byte + newBuf[j++] = dbcsCode & 0xFF; // low byte + } + else if (dbcsCode < 0x1000000) { + newBuf[j++] = dbcsCode >> 16; + newBuf[j++] = (dbcsCode >> 8) & 0xFF; + newBuf[j++] = dbcsCode & 0xFF; + } else { + newBuf[j++] = dbcsCode >>> 24; + newBuf[j++] = (dbcsCode >>> 16) & 0xFF; + newBuf[j++] = (dbcsCode >>> 8) & 0xFF; + newBuf[j++] = dbcsCode & 0xFF; + } + } + + this.seqObj = seqObj; + this.leadSurrogate = leadSurrogate; + return newBuf.slice(0, j); +} + +DBCSEncoder.prototype.end = function() { + if (this.leadSurrogate === -1 && this.seqObj === undefined) + return; // All clean. Most often case. + + var newBuf = Buffer.alloc(10), j = 0; + + if (this.seqObj) { // We're in the sequence. + var dbcsCode = this.seqObj[DEF_CHAR]; + if (dbcsCode !== undefined) { // Write beginning of the sequence. + if (dbcsCode < 0x100) { + newBuf[j++] = dbcsCode; + } + else { + newBuf[j++] = dbcsCode >> 8; // high byte + newBuf[j++] = dbcsCode & 0xFF; // low byte + } + } else { + // See todo above. + } + this.seqObj = undefined; + } + + if (this.leadSurrogate !== -1) { + // Incomplete surrogate pair - only lead surrogate found. + newBuf[j++] = this.defaultCharSingleByte; + this.leadSurrogate = -1; + } + + return newBuf.slice(0, j); +} + +// Export for testing +DBCSEncoder.prototype.findIdx = findIdx; + + +// == Decoder ================================================================== + +function DBCSDecoder(options, codec) { + // Decoder state + this.nodeIdx = 0; + this.prevBytes = []; + + // Static data + this.decodeTables = codec.decodeTables; + this.decodeTableSeq = codec.decodeTableSeq; + this.defaultCharUnicode = codec.defaultCharUnicode; + this.gb18030 = codec.gb18030; +} + +DBCSDecoder.prototype.write = function(buf) { + var newBuf = Buffer.alloc(buf.length*2), + nodeIdx = this.nodeIdx, + prevBytes = this.prevBytes, prevOffset = this.prevBytes.length, + seqStart = -this.prevBytes.length, // idx of the start of current parsed sequence. + uCode; + + for (var i = 0, j = 0; i < buf.length; i++) { + var curByte = (i >= 0) ? buf[i] : prevBytes[i + prevOffset]; + + // Lookup in current trie node. + var uCode = this.decodeTables[nodeIdx][curByte]; + + if (uCode >= 0) { + // Normal character, just use it. + } + else if (uCode === UNASSIGNED) { // Unknown char. + // TODO: Callback with seq. + uCode = this.defaultCharUnicode.charCodeAt(0); + i = seqStart; // Skip one byte ('i' will be incremented by the for loop) and try to parse again. + } + else if (uCode === GB18030_CODE) { + if (i >= 3) { + var ptr = (buf[i-3]-0x81)*12600 + (buf[i-2]-0x30)*1260 + (buf[i-1]-0x81)*10 + (curByte-0x30); + } else { + var ptr = (prevBytes[i-3+prevOffset]-0x81)*12600 + + (((i-2 >= 0) ? buf[i-2] : prevBytes[i-2+prevOffset])-0x30)*1260 + + (((i-1 >= 0) ? buf[i-1] : prevBytes[i-1+prevOffset])-0x81)*10 + + (curByte-0x30); + } + var idx = findIdx(this.gb18030.gbChars, ptr); + uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx]; + } + else if (uCode <= NODE_START) { // Go to next trie node. + nodeIdx = NODE_START - uCode; + continue; + } + else if (uCode <= SEQ_START) { // Output a sequence of chars. + var seq = this.decodeTableSeq[SEQ_START - uCode]; + for (var k = 0; k < seq.length - 1; k++) { + uCode = seq[k]; + newBuf[j++] = uCode & 0xFF; + newBuf[j++] = uCode >> 8; + } + uCode = seq[seq.length-1]; + } + else + throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte); + + // Write the character to buffer, handling higher planes using surrogate pair. + if (uCode >= 0x10000) { + uCode -= 0x10000; + var uCodeLead = 0xD800 | (uCode >> 10); + newBuf[j++] = uCodeLead & 0xFF; + newBuf[j++] = uCodeLead >> 8; + + uCode = 0xDC00 | (uCode & 0x3FF); + } + newBuf[j++] = uCode & 0xFF; + newBuf[j++] = uCode >> 8; + + // Reset trie node. + nodeIdx = 0; seqStart = i+1; + } + + this.nodeIdx = nodeIdx; + this.prevBytes = (seqStart >= 0) + ? Array.prototype.slice.call(buf, seqStart) + : prevBytes.slice(seqStart + prevOffset).concat(Array.prototype.slice.call(buf)); + + return newBuf.slice(0, j).toString('ucs2'); +} + +DBCSDecoder.prototype.end = function() { + var ret = ''; + + // Try to parse all remaining chars. + while (this.prevBytes.length > 0) { + // Skip 1 character in the buffer. + ret += this.defaultCharUnicode; + var bytesArr = this.prevBytes.slice(1); + + // Parse remaining as usual. + this.prevBytes = []; + this.nodeIdx = 0; + if (bytesArr.length > 0) + ret += this.write(bytesArr); + } + + this.prevBytes = []; + this.nodeIdx = 0; + return ret; +} + +// Binary search for GB18030. Returns largest i such that table[i] <= val. +function findIdx(table, val) { + if (table[0] > val) + return -1; + + var l = 0, r = table.length; + while (l < r-1) { // always table[l] <= val < table[r] + var mid = l + ((r-l+1) >> 1); + if (table[mid] <= val) + l = mid; + else + r = mid; + } + return l; +} + diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/dbcs-data.js b/node_modules/npm/node_modules/iconv-lite/encodings/dbcs-data.js new file mode 100644 index 00000000..0d17e582 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/dbcs-data.js @@ -0,0 +1,188 @@ +"use strict"; + +// Description of supported double byte encodings and aliases. +// Tables are not require()-d until they are needed to speed up library load. +// require()-s are direct to support Browserify. + +module.exports = { + + // == Japanese/ShiftJIS ==================================================== + // All japanese encodings are based on JIS X set of standards: + // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF. + // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes. + // Has several variations in 1978, 1983, 1990 and 1997. + // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead. + // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233. + // 2 planes, first is superset of 0208, second - revised 0212. + // Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx) + + // Byte encodings are: + // * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte + // encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC. + // Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI. + // * EUC-JP: Up to 3 bytes per character. Used mostly on *nixes. + // 0x00-0x7F - lower part of 0201 + // 0x8E, 0xA1-0xDF - upper part of 0201 + // (0xA1-0xFE)x2 - 0208 plane (94x94). + // 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94). + // * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon. + // Used as-is in ISO2022 family. + // * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII, + // 0201-1976 Roman, 0208-1978, 0208-1983. + // * ISO2022-JP-1: Adds esc seq for 0212-1990. + // * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7. + // * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2. + // * ISO2022-JP-2004: Adds 0213-2004 Plane 1. + // + // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes. + // + // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html + + 'shiftjis': { + type: '_dbcs', + table: function() { return require('./tables/shiftjis.json') }, + encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, + encodeSkipVals: [{from: 0xED40, to: 0xF940}], + }, + 'csshiftjis': 'shiftjis', + 'mskanji': 'shiftjis', + 'sjis': 'shiftjis', + 'windows31j': 'shiftjis', + 'ms31j': 'shiftjis', + 'xsjis': 'shiftjis', + 'windows932': 'shiftjis', + 'ms932': 'shiftjis', + '932': 'shiftjis', + 'cp932': 'shiftjis', + + 'eucjp': { + type: '_dbcs', + table: function() { return require('./tables/eucjp.json') }, + encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, + }, + + // TODO: KDDI extension to Shift_JIS + // TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes. + // TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars. + + + // == Chinese/GBK ========================================================== + // http://en.wikipedia.org/wiki/GBK + // We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder + + // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936 + 'gb2312': 'cp936', + 'gb231280': 'cp936', + 'gb23121980': 'cp936', + 'csgb2312': 'cp936', + 'csiso58gb231280': 'cp936', + 'euccn': 'cp936', + + // Microsoft's CP936 is a subset and approximation of GBK. + 'windows936': 'cp936', + 'ms936': 'cp936', + '936': 'cp936', + 'cp936': { + type: '_dbcs', + table: function() { return require('./tables/cp936.json') }, + }, + + // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other. + 'gbk': { + type: '_dbcs', + table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) }, + }, + 'xgbk': 'gbk', + 'isoir58': 'gbk', + + // GB18030 is an algorithmic extension of GBK. + // Main source: https://www.w3.org/TR/encoding/#gbk-encoder + // http://icu-project.org/docs/papers/gb18030.html + // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml + // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0 + 'gb18030': { + type: '_dbcs', + table: function() { return require('./tables/cp936.json').concat(require('./tables/gbk-added.json')) }, + gb18030: function() { return require('./tables/gb18030-ranges.json') }, + encodeSkipVals: [0x80], + encodeAdd: {'€': 0xA2E3}, + }, + + 'chinese': 'gb18030', + + + // == Korean =============================================================== + // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same. + 'windows949': 'cp949', + 'ms949': 'cp949', + '949': 'cp949', + 'cp949': { + type: '_dbcs', + table: function() { return require('./tables/cp949.json') }, + }, + + 'cseuckr': 'cp949', + 'csksc56011987': 'cp949', + 'euckr': 'cp949', + 'isoir149': 'cp949', + 'korean': 'cp949', + 'ksc56011987': 'cp949', + 'ksc56011989': 'cp949', + 'ksc5601': 'cp949', + + + // == Big5/Taiwan/Hong Kong ================================================ + // There are lots of tables for Big5 and cp950. Please see the following links for history: + // http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html + // Variations, in roughly number of defined chars: + // * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT + // * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/ + // * Big5-2003 (Taiwan standard) almost superset of cp950. + // * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers. + // * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard. + // many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years. + // Plus, it has 4 combining sequences. + // Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299 + // because big5-hkscs is the only encoding to include astral characters in non-algorithmic way. + // Implementations are not consistent within browsers; sometimes labeled as just big5. + // MS Internet Explorer switches from big5 to big5-hkscs when a patch applied. + // Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31 + // In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s. + // Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt + // http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt + // + // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder + // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong. + + 'windows950': 'cp950', + 'ms950': 'cp950', + '950': 'cp950', + 'cp950': { + type: '_dbcs', + table: function() { return require('./tables/cp950.json') }, + }, + + // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus. + 'big5': 'big5hkscs', + 'big5hkscs': { + type: '_dbcs', + table: function() { return require('./tables/cp950.json').concat(require('./tables/big5-added.json')) }, + encodeSkipVals: [ + // Although Encoding Standard says we should avoid encoding to HKSCS area (See Step 1 of + // https://encoding.spec.whatwg.org/#index-big5-pointer), we still do it to increase compatibility with ICU. + // But if a single unicode point can be encoded both as HKSCS and regular Big5, we prefer the latter. + 0x8e69, 0x8e6f, 0x8e7e, 0x8eab, 0x8eb4, 0x8ecd, 0x8ed0, 0x8f57, 0x8f69, 0x8f6e, 0x8fcb, 0x8ffe, + 0x906d, 0x907a, 0x90c4, 0x90dc, 0x90f1, 0x91bf, 0x92af, 0x92b0, 0x92b1, 0x92b2, 0x92d1, 0x9447, 0x94ca, + 0x95d9, 0x96fc, 0x9975, 0x9b76, 0x9b78, 0x9b7b, 0x9bc6, 0x9bde, 0x9bec, 0x9bf6, 0x9c42, 0x9c53, 0x9c62, + 0x9c68, 0x9c6b, 0x9c77, 0x9cbc, 0x9cbd, 0x9cd0, 0x9d57, 0x9d5a, 0x9dc4, 0x9def, 0x9dfb, 0x9ea9, 0x9eef, + 0x9efd, 0x9f60, 0x9fcb, 0xa077, 0xa0dc, 0xa0df, 0x8fcc, 0x92c8, 0x9644, 0x96ed, + + // Step 2 of https://encoding.spec.whatwg.org/#index-big5-pointer: Use last pointer for U+2550, U+255E, U+2561, U+256A, U+5341, or U+5345 + 0xa2a4, 0xa2a5, 0xa2a7, 0xa2a6, 0xa2cc, 0xa2ce, + ], + }, + + 'cnbig5': 'big5hkscs', + 'csbig5': 'big5hkscs', + 'xxbig5': 'big5hkscs', +}; diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/index.js b/node_modules/npm/node_modules/iconv-lite/encodings/index.js new file mode 100644 index 00000000..d95c2441 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/index.js @@ -0,0 +1,23 @@ +"use strict"; + +// Update this array if you add/rename/remove files in this directory. +// We support Browserify by skipping automatic module discovery and requiring modules directly. +var modules = [ + require("./internal"), + require("./utf32"), + require("./utf16"), + require("./utf7"), + require("./sbcs-codec"), + require("./sbcs-data"), + require("./sbcs-data-generated"), + require("./dbcs-codec"), + require("./dbcs-data"), +]; + +// Put all encoding/alias/codec definitions to single object and export it. +for (var i = 0; i < modules.length; i++) { + var module = modules[i]; + for (var enc in module) + if (Object.prototype.hasOwnProperty.call(module, enc)) + exports[enc] = module[enc]; +} diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/internal.js b/node_modules/npm/node_modules/iconv-lite/encodings/internal.js new file mode 100644 index 00000000..dc1074f0 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/internal.js @@ -0,0 +1,198 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Export Node.js internal encodings. + +module.exports = { + // Encodings + utf8: { type: "_internal", bomAware: true}, + cesu8: { type: "_internal", bomAware: true}, + unicode11utf8: "utf8", + + ucs2: { type: "_internal", bomAware: true}, + utf16le: "ucs2", + + binary: { type: "_internal" }, + base64: { type: "_internal" }, + hex: { type: "_internal" }, + + // Codec. + _internal: InternalCodec, +}; + +//------------------------------------------------------------------------------ + +function InternalCodec(codecOptions, iconv) { + this.enc = codecOptions.encodingName; + this.bomAware = codecOptions.bomAware; + + if (this.enc === "base64") + this.encoder = InternalEncoderBase64; + else if (this.enc === "cesu8") { + this.enc = "utf8"; // Use utf8 for decoding. + this.encoder = InternalEncoderCesu8; + + // Add decoder for versions of Node not supporting CESU-8 + if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '💩') { + this.decoder = InternalDecoderCesu8; + this.defaultCharUnicode = iconv.defaultCharUnicode; + } + } +} + +InternalCodec.prototype.encoder = InternalEncoder; +InternalCodec.prototype.decoder = InternalDecoder; + +//------------------------------------------------------------------------------ + +// We use node.js internal decoder. Its signature is the same as ours. +var StringDecoder = require('string_decoder').StringDecoder; + +if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method. + StringDecoder.prototype.end = function() {}; + + +function InternalDecoder(options, codec) { + this.decoder = new StringDecoder(codec.enc); +} + +InternalDecoder.prototype.write = function(buf) { + if (!Buffer.isBuffer(buf)) { + buf = Buffer.from(buf); + } + + return this.decoder.write(buf); +} + +InternalDecoder.prototype.end = function() { + return this.decoder.end(); +} + + +//------------------------------------------------------------------------------ +// Encoder is mostly trivial + +function InternalEncoder(options, codec) { + this.enc = codec.enc; +} + +InternalEncoder.prototype.write = function(str) { + return Buffer.from(str, this.enc); +} + +InternalEncoder.prototype.end = function() { +} + + +//------------------------------------------------------------------------------ +// Except base64 encoder, which must keep its state. + +function InternalEncoderBase64(options, codec) { + this.prevStr = ''; +} + +InternalEncoderBase64.prototype.write = function(str) { + str = this.prevStr + str; + var completeQuads = str.length - (str.length % 4); + this.prevStr = str.slice(completeQuads); + str = str.slice(0, completeQuads); + + return Buffer.from(str, "base64"); +} + +InternalEncoderBase64.prototype.end = function() { + return Buffer.from(this.prevStr, "base64"); +} + + +//------------------------------------------------------------------------------ +// CESU-8 encoder is also special. + +function InternalEncoderCesu8(options, codec) { +} + +InternalEncoderCesu8.prototype.write = function(str) { + var buf = Buffer.alloc(str.length * 3), bufIdx = 0; + for (var i = 0; i < str.length; i++) { + var charCode = str.charCodeAt(i); + // Naive implementation, but it works because CESU-8 is especially easy + // to convert from UTF-16 (which all JS strings are encoded in). + if (charCode < 0x80) + buf[bufIdx++] = charCode; + else if (charCode < 0x800) { + buf[bufIdx++] = 0xC0 + (charCode >>> 6); + buf[bufIdx++] = 0x80 + (charCode & 0x3f); + } + else { // charCode will always be < 0x10000 in javascript. + buf[bufIdx++] = 0xE0 + (charCode >>> 12); + buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f); + buf[bufIdx++] = 0x80 + (charCode & 0x3f); + } + } + return buf.slice(0, bufIdx); +} + +InternalEncoderCesu8.prototype.end = function() { +} + +//------------------------------------------------------------------------------ +// CESU-8 decoder is not implemented in Node v4.0+ + +function InternalDecoderCesu8(options, codec) { + this.acc = 0; + this.contBytes = 0; + this.accBytes = 0; + this.defaultCharUnicode = codec.defaultCharUnicode; +} + +InternalDecoderCesu8.prototype.write = function(buf) { + var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, + res = ''; + for (var i = 0; i < buf.length; i++) { + var curByte = buf[i]; + if ((curByte & 0xC0) !== 0x80) { // Leading byte + if (contBytes > 0) { // Previous code is invalid + res += this.defaultCharUnicode; + contBytes = 0; + } + + if (curByte < 0x80) { // Single-byte code + res += String.fromCharCode(curByte); + } else if (curByte < 0xE0) { // Two-byte code + acc = curByte & 0x1F; + contBytes = 1; accBytes = 1; + } else if (curByte < 0xF0) { // Three-byte code + acc = curByte & 0x0F; + contBytes = 2; accBytes = 1; + } else { // Four or more are not supported for CESU-8. + res += this.defaultCharUnicode; + } + } else { // Continuation byte + if (contBytes > 0) { // We're waiting for it. + acc = (acc << 6) | (curByte & 0x3f); + contBytes--; accBytes++; + if (contBytes === 0) { + // Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80) + if (accBytes === 2 && acc < 0x80 && acc > 0) + res += this.defaultCharUnicode; + else if (accBytes === 3 && acc < 0x800) + res += this.defaultCharUnicode; + else + // Actually add character. + res += String.fromCharCode(acc); + } + } else { // Unexpected continuation byte + res += this.defaultCharUnicode; + } + } + } + this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes; + return res; +} + +InternalDecoderCesu8.prototype.end = function() { + var res = 0; + if (this.contBytes > 0) + res += this.defaultCharUnicode; + return res; +} diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/sbcs-codec.js b/node_modules/npm/node_modules/iconv-lite/encodings/sbcs-codec.js new file mode 100644 index 00000000..abac5ffa --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/sbcs-codec.js @@ -0,0 +1,72 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that +// correspond to encoded bytes (if 128 - then lower half is ASCII). + +exports._sbcs = SBCSCodec; +function SBCSCodec(codecOptions, iconv) { + if (!codecOptions) + throw new Error("SBCS codec is called without the data.") + + // Prepare char buffer for decoding. + if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256)) + throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)"); + + if (codecOptions.chars.length === 128) { + var asciiString = ""; + for (var i = 0; i < 128; i++) + asciiString += String.fromCharCode(i); + codecOptions.chars = asciiString + codecOptions.chars; + } + + this.decodeBuf = Buffer.from(codecOptions.chars, 'ucs2'); + + // Encoding buffer. + var encodeBuf = Buffer.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0)); + + for (var i = 0; i < codecOptions.chars.length; i++) + encodeBuf[codecOptions.chars.charCodeAt(i)] = i; + + this.encodeBuf = encodeBuf; +} + +SBCSCodec.prototype.encoder = SBCSEncoder; +SBCSCodec.prototype.decoder = SBCSDecoder; + + +function SBCSEncoder(options, codec) { + this.encodeBuf = codec.encodeBuf; +} + +SBCSEncoder.prototype.write = function(str) { + var buf = Buffer.alloc(str.length); + for (var i = 0; i < str.length; i++) + buf[i] = this.encodeBuf[str.charCodeAt(i)]; + + return buf; +} + +SBCSEncoder.prototype.end = function() { +} + + +function SBCSDecoder(options, codec) { + this.decodeBuf = codec.decodeBuf; +} + +SBCSDecoder.prototype.write = function(buf) { + // Strings are immutable in JS -> we use ucs2 buffer to speed up computations. + var decodeBuf = this.decodeBuf; + var newBuf = Buffer.alloc(buf.length*2); + var idx1 = 0, idx2 = 0; + for (var i = 0; i < buf.length; i++) { + idx1 = buf[i]*2; idx2 = i*2; + newBuf[idx2] = decodeBuf[idx1]; + newBuf[idx2+1] = decodeBuf[idx1+1]; + } + return newBuf.toString('ucs2'); +} + +SBCSDecoder.prototype.end = function() { +} diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/sbcs-data-generated.js b/node_modules/npm/node_modules/iconv-lite/encodings/sbcs-data-generated.js new file mode 100644 index 00000000..9b482360 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/sbcs-data-generated.js @@ -0,0 +1,451 @@ +"use strict"; + +// Generated data for sbcs codec. Don't edit manually. Regenerate using generation/gen-sbcs.js script. +module.exports = { + "437": "cp437", + "737": "cp737", + "775": "cp775", + "850": "cp850", + "852": "cp852", + "855": "cp855", + "856": "cp856", + "857": "cp857", + "858": "cp858", + "860": "cp860", + "861": "cp861", + "862": "cp862", + "863": "cp863", + "864": "cp864", + "865": "cp865", + "866": "cp866", + "869": "cp869", + "874": "windows874", + "922": "cp922", + "1046": "cp1046", + "1124": "cp1124", + "1125": "cp1125", + "1129": "cp1129", + "1133": "cp1133", + "1161": "cp1161", + "1162": "cp1162", + "1163": "cp1163", + "1250": "windows1250", + "1251": "windows1251", + "1252": "windows1252", + "1253": "windows1253", + "1254": "windows1254", + "1255": "windows1255", + "1256": "windows1256", + "1257": "windows1257", + "1258": "windows1258", + "28591": "iso88591", + "28592": "iso88592", + "28593": "iso88593", + "28594": "iso88594", + "28595": "iso88595", + "28596": "iso88596", + "28597": "iso88597", + "28598": "iso88598", + "28599": "iso88599", + "28600": "iso885910", + "28601": "iso885911", + "28603": "iso885913", + "28604": "iso885914", + "28605": "iso885915", + "28606": "iso885916", + "windows874": { + "type": "_sbcs", + "chars": "€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "win874": "windows874", + "cp874": "windows874", + "windows1250": { + "type": "_sbcs", + "chars": "€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬­®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" + }, + "win1250": "windows1250", + "cp1250": "windows1250", + "windows1251": { + "type": "_sbcs", + "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬­®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "win1251": "windows1251", + "cp1251": "windows1251", + "windows1252": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "win1252": "windows1252", + "cp1252": "windows1252", + "windows1253": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬­®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" + }, + "win1253": "windows1253", + "cp1253": "windows1253", + "windows1254": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖרÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" + }, + "win1254": "windows1254", + "cp1254": "windows1254", + "windows1255": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹֺֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" + }, + "win1255": "windows1255", + "cp1255": "windows1255", + "windows1256": { + "type": "_sbcs", + "chars": "€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œ‌‍ں ،¢£¤¥¦§¨©ھ«¬­®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûü‎‏ے" + }, + "win1256": "windows1256", + "cp1256": "windows1256", + "windows1257": { + "type": "_sbcs", + "chars": "€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬­®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙" + }, + "win1257": "windows1257", + "cp1257": "windows1257", + "windows1258": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "win1258": "windows1258", + "cp1258": "windows1258", + "iso88591": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28591": "iso88591", + "iso88592": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" + }, + "cp28592": "iso88592", + "iso88593": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ħ˘£¤�Ĥ§¨İŞĞĴ­�ݰħ²³´µĥ·¸ışğĵ½�żÀÁÂ�ÄĊĈÇÈÉÊËÌÍÎÏ�ÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâ�äċĉçèéêëìíîï�ñòóôġö÷ĝùúûüŭŝ˙" + }, + "cp28593": "iso88593", + "iso88594": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĸŖ¤Ĩϧ¨ŠĒĢŦ­Ž¯°ą˛ŗ´ĩšēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖרŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙" + }, + "cp28594": "iso88594", + "iso88595": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂЃЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ" + }, + "cp28595": "iso88595", + "iso88596": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ���¤�������،­�������������؛���؟�ءآأؤإئابةتثجحخدذرزسشصضطظعغ�����ـفقكلمنهوىيًٌٍَُِّْ�������������" + }, + "cp28596": "iso88596", + "iso88597": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ‘’£€₯¦§¨©ͺ«¬­�―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" + }, + "cp28597": "iso88597", + "iso88598": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �¢£¤¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾��������������������������������‗אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" + }, + "cp28598": "iso88598", + "iso88599": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖרÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" + }, + "cp28599": "iso88599", + "iso885910": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĒĢĪĨͧĻĐŠŦŽ­ŪŊ°ąēģīĩķ·ļđšŧž―ūŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎÏÐŅŌÓÔÕÖŨØŲÚÛÜÝÞßāáâãäåæįčéęëėíîïðņōóôõöũøųúûüýþĸ" + }, + "cp28600": "iso885910", + "iso885911": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "cp28601": "iso885911", + "iso885913": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ”¢£¤„¦§Ø©Ŗ«¬­®Æ°±²³“µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž’" + }, + "cp28603": "iso885913", + "iso885914": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ­®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ" + }, + "cp28604": "iso885914", + "iso885915": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28605": "iso885915", + "iso885916": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄąŁ€„Чš©Ș«Ź­źŻ°±ČłŽ”¶·žčș»ŒœŸżÀÁÂĂÄĆÆÇÈÉÊËÌÍÎÏĐŃÒÓÔŐÖŚŰÙÚÛÜĘȚßàáâăäćæçèéêëìíîïđńòóôőöśűùúûüęțÿ" + }, + "cp28606": "iso885916", + "cp437": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm437": "cp437", + "csibm437": "cp437", + "cp737": { + "type": "_sbcs", + "chars": "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ " + }, + "ibm737": "cp737", + "csibm737": "cp737", + "cp775": { + "type": "_sbcs", + "chars": "ĆüéāäģåćłēŖŗīŹÄÅÉæÆōöĢ¢ŚśÖÜø£Ø×¤ĀĪóŻżź”¦©®¬½¼Ł«»░▒▓│┤ĄČĘĖ╣║╗╝ĮŠ┐└┴┬├─┼ŲŪ╚╔╩╦╠═╬Žąčęėįšųūž┘┌█▄▌▐▀ÓßŌŃõÕµńĶķĻļņĒŅ’­±“¾¶§÷„°∙·¹³²■ " + }, + "ibm775": "cp775", + "csibm775": "cp775", + "cp850": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm850": "cp850", + "csibm850": "cp850", + "cp852": { + "type": "_sbcs", + "chars": "ÇüéâäůćçłëŐőîŹÄĆÉĹĺôöĽľŚśÖÜŤťŁ×čáíóúĄąŽžĘ꬟Ⱥ«»░▒▓│┤ÁÂĚŞ╣║╗╝Żż┐└┴┬├─┼Ăă╚╔╩╦╠═╬¤đĐĎËďŇÍÎě┘┌█▄ŢŮ▀ÓßÔŃńňŠšŔÚŕŰýÝţ´­˝˛ˇ˘§÷¸°¨˙űŘř■ " + }, + "ibm852": "cp852", + "csibm852": "cp852", + "cp855": { + "type": "_sbcs", + "chars": "ђЂѓЃёЁєЄѕЅіІїЇјЈљЉњЊћЋќЌўЎџЏюЮъЪаАбБцЦдДеЕфФгГ«»░▒▓│┤хХиИ╣║╗╝йЙ┐└┴┬├─┼кК╚╔╩╦╠═╬¤лЛмМнНоОп┘┌█▄Пя▀ЯрРсСтТуУжЖвВьЬ№­ыЫзЗшШэЭщЩчЧ§■ " + }, + "ibm855": "cp855", + "csibm855": "cp855", + "cp856": { + "type": "_sbcs", + "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת�£�×����������®¬½¼�«»░▒▓│┤���©╣║╗╝¢¥┐└┴┬├─┼��╚╔╩╦╠═╬¤���������┘┌█▄¦�▀������µ�������¯´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm856": "cp856", + "csibm856": "cp856", + "cp857": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîıÄÅÉæÆôöòûùİÖÜø£ØŞşáíóúñÑĞ𿮬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ºªÊËÈ�ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµ�×ÚÛÙìÿ¯´­±�¾¶§÷¸°¨·¹³²■ " + }, + "ibm857": "cp857", + "csibm857": "cp857", + "cp858": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈ€ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm858": "cp858", + "csibm858": "cp858", + "cp860": { + "type": "_sbcs", + "chars": "ÇüéâãàÁçêÊèÍÔìÃÂÉÀÈôõòÚùÌÕÜ¢£Ù₧ÓáíóúñѪº¿Ò¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm860": "cp860", + "csibm860": "cp860", + "cp861": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèÐðÞÄÅÉæÆôöþûÝýÖÜø£Ø₧ƒáíóúÁÍÓÚ¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm861": "cp861", + "csibm861": "cp861", + "cp862": { + "type": "_sbcs", + "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm862": "cp862", + "csibm862": "cp862", + "cp863": { + "type": "_sbcs", + "chars": "ÇüéâÂà¶çêëèïî‗À§ÉÈÊôËÏûù¤ÔÜ¢£ÙÛƒ¦´óú¨¸³¯Î⌐¬½¼¾«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm863": "cp863", + "csibm863": "cp863", + "cp864": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�" + }, + "ibm864": "cp864", + "csibm864": "cp864", + "cp865": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm865": "cp865", + "csibm865": "cp865", + "cp866": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ " + }, + "ibm866": "cp866", + "csibm866": "cp866", + "cp869": { + "type": "_sbcs", + "chars": "������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ■ " + }, + "ibm869": "cp869", + "csibm869": "cp869", + "cp922": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®‾°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖרÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ" + }, + "ibm922": "cp922", + "csibm922": "cp922", + "cp1046": { + "type": "_sbcs", + "chars": "ﺈ×÷ﹱˆ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�" + }, + "ibm1046": "cp1046", + "csibm1046": "cp1046", + "cp1124": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ" + }, + "ibm1124": "cp1124", + "csibm1124": "cp1124", + "cp1125": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ " + }, + "ibm1125": "cp1125", + "csibm1125": "cp1125", + "cp1129": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "ibm1129": "cp1129", + "csibm1129": "cp1129", + "cp1133": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�" + }, + "ibm1133": "cp1133", + "csibm1133": "cp1133", + "cp1161": { + "type": "_sbcs", + "chars": "��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ " + }, + "ibm1161": "cp1161", + "csibm1161": "cp1161", + "cp1162": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "ibm1162": "cp1162", + "csibm1162": "cp1162", + "cp1163": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "ibm1163": "cp1163", + "csibm1163": "cp1163", + "maccroatian": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊�©⁄¤‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ" + }, + "maccyrillic": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°¢£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµ∂ЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" + }, + "macgreek": { + "type": "_sbcs", + "chars": "Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦­ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ�" + }, + "maciceland": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macroman": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macromania": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂŞ∞±≤≥¥µ∂∑∏π∫ªºΩăş¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›Ţţ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macthai": { + "type": "_sbcs", + "chars": "«»…“”�•‘’� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู​–—฿เแโใไๅๆ็่้๊๋์ํ™๏๐๑๒๓๔๕๖๗๘๙®©����" + }, + "macturkish": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙ�ˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macukraine": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" + }, + "koi8r": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8u": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґ╝╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪Ґ╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8ru": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґў╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪ҐЎ©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8t": { + "type": "_sbcs", + "chars": "қғ‚Ғ„…†‡�‰ҳ‹ҲҷҶ�Қ‘’“”•–—�™�›�����ӯӮё¤ӣ¦§���«¬­®�°±²Ё�Ӣ¶·�№�»���©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "armscii8": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �և։)(»«—.՝,-֊…՜՛՞ԱաԲբԳգԴդԵեԶզԷէԸըԹթԺժԻիԼլԽխԾծԿկՀհՁձՂղՃճՄմՅյՆնՇշՈոՉչՊպՋջՌռՍսՎվՏտՐրՑցՒւՓփՔքՕօՖֆ՚�" + }, + "rk1048": { + "type": "_sbcs", + "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊҚҺЏђ‘’“”•–—�™љ›њқһџ ҰұӘ¤Ө¦§Ё©Ғ«¬­®Ү°±Ііөµ¶·ё№ғ»әҢңүАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "tcvn": { + "type": "_sbcs", + "chars": "\u0000ÚỤ\u0003ỪỬỮ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010ỨỰỲỶỸÝỴ\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ" + }, + "georgianacademy": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "georgianps": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "pt154": { + "type": "_sbcs", + "chars": "ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө¶·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "viscii": { + "type": "_sbcs", + "chars": "\u0000\u0001Ẳ\u0003\u0004ẴẪ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013Ỷ\u0015\u0016\u0017\u0018Ỹ\u001a\u001b\u001c\u001dỴ\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ" + }, + "iso646cn": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" + }, + "iso646jp": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" + }, + "hproman8": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�" + }, + "macintosh": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "ascii": { + "type": "_sbcs", + "chars": "��������������������������������������������������������������������������������������������������������������������������������" + }, + "tis620": { + "type": "_sbcs", + "chars": "���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + } +} \ No newline at end of file diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/sbcs-data.js b/node_modules/npm/node_modules/iconv-lite/encodings/sbcs-data.js new file mode 100644 index 00000000..066f904e --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/sbcs-data.js @@ -0,0 +1,179 @@ +"use strict"; + +// Manually added data to be used by sbcs codec in addition to generated one. + +module.exports = { + // Not supported by iconv, not sure why. + "10029": "maccenteuro", + "maccenteuro": { + "type": "_sbcs", + "chars": "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ" + }, + + "808": "cp808", + "ibm808": "cp808", + "cp808": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ " + }, + + "mik": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + + "cp720": { + "type": "_sbcs", + "chars": "\x80\x81éâ\x84à\x86çêëèïî\x8d\x8e\x8f\x90\u0651\u0652ô¤ـûùءآأؤ£إئابةتثجحخدذرزسشص«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ضطظعغفµقكلمنهوىي≡\u064b\u064c\u064d\u064e\u064f\u0650≈°∙·√ⁿ²■\u00a0" + }, + + // Aliases of generated encodings. + "ascii8bit": "ascii", + "usascii": "ascii", + "ansix34": "ascii", + "ansix341968": "ascii", + "ansix341986": "ascii", + "csascii": "ascii", + "cp367": "ascii", + "ibm367": "ascii", + "isoir6": "ascii", + "iso646us": "ascii", + "iso646irv": "ascii", + "us": "ascii", + + "latin1": "iso88591", + "latin2": "iso88592", + "latin3": "iso88593", + "latin4": "iso88594", + "latin5": "iso88599", + "latin6": "iso885910", + "latin7": "iso885913", + "latin8": "iso885914", + "latin9": "iso885915", + "latin10": "iso885916", + + "csisolatin1": "iso88591", + "csisolatin2": "iso88592", + "csisolatin3": "iso88593", + "csisolatin4": "iso88594", + "csisolatincyrillic": "iso88595", + "csisolatinarabic": "iso88596", + "csisolatingreek" : "iso88597", + "csisolatinhebrew": "iso88598", + "csisolatin5": "iso88599", + "csisolatin6": "iso885910", + + "l1": "iso88591", + "l2": "iso88592", + "l3": "iso88593", + "l4": "iso88594", + "l5": "iso88599", + "l6": "iso885910", + "l7": "iso885913", + "l8": "iso885914", + "l9": "iso885915", + "l10": "iso885916", + + "isoir14": "iso646jp", + "isoir57": "iso646cn", + "isoir100": "iso88591", + "isoir101": "iso88592", + "isoir109": "iso88593", + "isoir110": "iso88594", + "isoir144": "iso88595", + "isoir127": "iso88596", + "isoir126": "iso88597", + "isoir138": "iso88598", + "isoir148": "iso88599", + "isoir157": "iso885910", + "isoir166": "tis620", + "isoir179": "iso885913", + "isoir199": "iso885914", + "isoir203": "iso885915", + "isoir226": "iso885916", + + "cp819": "iso88591", + "ibm819": "iso88591", + + "cyrillic": "iso88595", + + "arabic": "iso88596", + "arabic8": "iso88596", + "ecma114": "iso88596", + "asmo708": "iso88596", + + "greek" : "iso88597", + "greek8" : "iso88597", + "ecma118" : "iso88597", + "elot928" : "iso88597", + + "hebrew": "iso88598", + "hebrew8": "iso88598", + + "turkish": "iso88599", + "turkish8": "iso88599", + + "thai": "iso885911", + "thai8": "iso885911", + + "celtic": "iso885914", + "celtic8": "iso885914", + "isoceltic": "iso885914", + + "tis6200": "tis620", + "tis62025291": "tis620", + "tis62025330": "tis620", + + "10000": "macroman", + "10006": "macgreek", + "10007": "maccyrillic", + "10079": "maciceland", + "10081": "macturkish", + + "cspc8codepage437": "cp437", + "cspc775baltic": "cp775", + "cspc850multilingual": "cp850", + "cspcp852": "cp852", + "cspc862latinhebrew": "cp862", + "cpgr": "cp869", + + "msee": "cp1250", + "mscyrl": "cp1251", + "msansi": "cp1252", + "msgreek": "cp1253", + "msturk": "cp1254", + "mshebr": "cp1255", + "msarab": "cp1256", + "winbaltrim": "cp1257", + + "cp20866": "koi8r", + "20866": "koi8r", + "ibm878": "koi8r", + "cskoi8r": "koi8r", + + "cp21866": "koi8u", + "21866": "koi8u", + "ibm1168": "koi8u", + + "strk10482002": "rk1048", + + "tcvn5712": "tcvn", + "tcvn57121": "tcvn", + + "gb198880": "iso646cn", + "cn": "iso646cn", + + "csiso14jisc6220ro": "iso646jp", + "jisc62201969ro": "iso646jp", + "jp": "iso646jp", + + "cshproman8": "hproman8", + "r8": "hproman8", + "roman8": "hproman8", + "xroman8": "hproman8", + "ibm1051": "hproman8", + + "mac": "macintosh", + "csmacintosh": "macintosh", +}; + diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/tables/big5-added.json b/node_modules/npm/node_modules/iconv-lite/encodings/tables/big5-added.json new file mode 100644 index 00000000..3c3d3c2f --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/tables/big5-added.json @@ -0,0 +1,122 @@ +[ +["8740","䏰䰲䘃䖦䕸𧉧䵷䖳𧲱䳢𧳅㮕䜶䝄䱇䱀𤊿𣘗𧍒𦺋𧃒䱗𪍑䝏䗚䲅𧱬䴇䪤䚡𦬣爥𥩔𡩣𣸆𣽡晍囻"], +["8767","綕夝𨮹㷴霴𧯯寛𡵞媤㘥𩺰嫑宷峼杮薓𩥅瑡璝㡵𡵓𣚞𦀡㻬"], +["87a1","𥣞㫵竼龗𤅡𨤍𣇪𠪊𣉞䌊蒄龖鐯䤰蘓墖靊鈘秐稲晠権袝瑌篅枂稬剏遆㓦珄𥶹瓆鿇垳䤯呌䄱𣚎堘穲𧭥讏䚮𦺈䆁𥶙箮𢒼鿈𢓁𢓉𢓌鿉蔄𣖻䂴鿊䓡𪷿拁灮鿋"], +["8840","㇀",4,"𠄌㇅𠃑𠃍㇆㇇𠃋𡿨㇈𠃊㇉㇊㇋㇌𠄎㇍㇎ĀÁǍÀĒÉĚÈŌÓǑÒ࿿Ê̄Ế࿿Ê̌ỀÊāáǎàɑēéěèīíǐìōóǒòūúǔùǖǘǚ"], +["88a1","ǜü࿿ê̄ế࿿ê̌ềêɡ⏚⏛"], +["8940","𪎩𡅅"], +["8943","攊"], +["8946","丽滝鵎釟"], +["894c","𧜵撑会伨侨兖兴农凤务动医华发变团声处备夲头学实実岚庆总斉柾栄桥济炼电纤纬纺织经统缆缷艺苏药视设询车轧轮"], +["89a1","琑糼緍楆竉刧"], +["89ab","醌碸酞肼"], +["89b0","贋胶𠧧"], +["89b5","肟黇䳍鷉鸌䰾𩷶𧀎鸊𪄳㗁"], +["89c1","溚舾甙"], +["89c5","䤑马骏龙禇𨑬𡷊𠗐𢫦两亁亀亇亿仫伷㑌侽㹈倃傈㑽㒓㒥円夅凛凼刅争剹劐匧㗇厩㕑厰㕓参吣㕭㕲㚁咓咣咴咹哐哯唘唣唨㖘唿㖥㖿嗗㗅"], +["8a40","𧶄唥"], +["8a43","𠱂𠴕𥄫喐𢳆㧬𠍁蹆𤶸𩓥䁓𨂾睺𢰸㨴䟕𨅝𦧲𤷪擝𠵼𠾴𠳕𡃴撍蹾𠺖𠰋𠽤𢲩𨉖𤓓"], +["8a64","𠵆𩩍𨃩䟴𤺧𢳂骲㩧𩗴㿭㔆𥋇𩟔𧣈𢵄鵮頕"], +["8a76","䏙𦂥撴哣𢵌𢯊𡁷㧻𡁯"], +["8aa1","𦛚𦜖𧦠擪𥁒𠱃蹨𢆡𨭌𠜱"], +["8aac","䠋𠆩㿺塳𢶍"], +["8ab2","𤗈𠓼𦂗𠽌𠶖啹䂻䎺"], +["8abb","䪴𢩦𡂝膪飵𠶜捹㧾𢝵跀嚡摼㹃"], +["8ac9","𪘁𠸉𢫏𢳉"], +["8ace","𡃈𣧂㦒㨆𨊛㕸𥹉𢃇噒𠼱𢲲𩜠㒼氽𤸻"], +["8adf","𧕴𢺋𢈈𪙛𨳍𠹺𠰴𦠜羓𡃏𢠃𢤹㗻𥇣𠺌𠾍𠺪㾓𠼰𠵇𡅏𠹌"], +["8af6","𠺫𠮩𠵈𡃀𡄽㿹𢚖搲𠾭"], +["8b40","𣏴𧘹𢯎𠵾𠵿𢱑𢱕㨘𠺘𡃇𠼮𪘲𦭐𨳒𨶙𨳊閪哌苄喹"], +["8b55","𩻃鰦骶𧝞𢷮煀腭胬尜𦕲脴㞗卟𨂽醶𠻺𠸏𠹷𠻻㗝𤷫㘉𠳖嚯𢞵𡃉𠸐𠹸𡁸𡅈𨈇𡑕𠹹𤹐𢶤婔𡀝𡀞𡃵𡃶垜𠸑"], +["8ba1","𧚔𨋍𠾵𠹻𥅾㜃𠾶𡆀𥋘𪊽𤧚𡠺𤅷𨉼墙剨㘚𥜽箲孨䠀䬬鼧䧧鰟鮍𥭴𣄽嗻㗲嚉丨夂𡯁屮靑𠂆乛亻㔾尣彑忄㣺扌攵歺氵氺灬爫丬犭𤣩罒礻糹罓𦉪㓁"], +["8bde","𦍋耂肀𦘒𦥑卝衤见𧢲讠贝钅镸长门𨸏韦页风飞饣𩠐鱼鸟黄歯龜丷𠂇阝户钢"], +["8c40","倻淾𩱳龦㷉袏𤅎灷峵䬠𥇍㕙𥴰愢𨨲辧釶熑朙玺𣊁𪄇㲋𡦀䬐磤琂冮𨜏䀉橣𪊺䈣蘏𠩯稪𩥇𨫪靕灍匤𢁾鏴盙𨧣龧矝亣俰傼丯众龨吴綋墒壐𡶶庒庙忂𢜒斋"], +["8ca1","𣏹椙橃𣱣泿"], +["8ca7","爀𤔅玌㻛𤨓嬕璹讃𥲤𥚕窓篬糃繬苸薗龩袐龪躹龫迏蕟駠鈡龬𨶹𡐿䁱䊢娚"], +["8cc9","顨杫䉶圽"], +["8cce","藖𤥻芿𧄍䲁𦵴嵻𦬕𦾾龭龮宖龯曧繛湗秊㶈䓃𣉖𢞖䎚䔶"], +["8ce6","峕𣬚諹屸㴒𣕑嵸龲煗䕘𤃬𡸣䱷㥸㑊𠆤𦱁諌侴𠈹妿腬顖𩣺弻"], +["8d40","𠮟"], +["8d42","𢇁𨥭䄂䚻𩁹㼇龳𪆵䃸㟖䛷𦱆䅼𨚲𧏿䕭㣔𥒚䕡䔛䶉䱻䵶䗪㿈𤬏㙡䓞䒽䇭崾嵈嵖㷼㠏嶤嶹㠠㠸幂庽弥徃㤈㤔㤿㥍惗愽峥㦉憷憹懏㦸戬抐拥挘㧸嚱"], +["8da1","㨃揢揻搇摚㩋擀崕嘡龟㪗斆㪽旿晓㫲暒㬢朖㭂枤栀㭘桊梄㭲㭱㭻椉楃牜楤榟榅㮼槖㯝橥橴橱檂㯬檙㯲檫檵櫔櫶殁毁毪汵沪㳋洂洆洦涁㳯涤涱渕渘温溆𨧀溻滢滚齿滨滩漤漴㵆𣽁澁澾㵪㵵熷岙㶊瀬㶑灐灔灯灿炉𠌥䏁㗱𠻘"], +["8e40","𣻗垾𦻓焾𥟠㙎榢𨯩孴穉𥣡𩓙穥穽𥦬窻窰竂竃燑𦒍䇊竚竝竪䇯咲𥰁笋筕笩𥌎𥳾箢筯莜𥮴𦱿篐萡箒箸𥴠㶭𥱥蒒篺簆簵𥳁籄粃𤢂粦晽𤕸糉糇糦籴糳糵糎"], +["8ea1","繧䔝𦹄絝𦻖璍綉綫焵綳緒𤁗𦀩緤㴓緵𡟹緥𨍭縝𦄡𦅚繮纒䌫鑬縧罀罁罇礶𦋐駡羗𦍑羣𡙡𠁨䕜𣝦䔃𨌺翺𦒉者耈耝耨耯𪂇𦳃耻耼聡𢜔䦉𦘦𣷣𦛨朥肧𨩈脇脚墰𢛶汿𦒘𤾸擧𡒊舘𡡞橓𤩥𤪕䑺舩𠬍𦩒𣵾俹𡓽蓢荢𦬊𤦧𣔰𡝳𣷸芪椛芳䇛"], +["8f40","蕋苐茚𠸖𡞴㛁𣅽𣕚艻苢茘𣺋𦶣𦬅𦮗𣗎㶿茝嗬莅䔋𦶥莬菁菓㑾𦻔橗蕚㒖𦹂𢻯葘𥯤葱㷓䓤檧葊𣲵祘蒨𦮖𦹷𦹃蓞萏莑䒠蒓蓤𥲑䉀𥳀䕃蔴嫲𦺙䔧蕳䔖枿蘖"], +["8fa1","𨘥𨘻藁𧂈蘂𡖂𧃍䕫䕪蘨㙈𡢢号𧎚虾蝱𪃸蟮𢰧螱蟚蠏噡虬桖䘏衅衆𧗠𣶹𧗤衞袜䙛袴袵揁装睷𧜏覇覊覦覩覧覼𨨥觧𧤤𧪽誜瞓釾誐𧩙竩𧬺𣾏䜓𧬸煼謌謟𥐰𥕥謿譌譍誩𤩺讐讛誯𡛟䘕衏貛𧵔𧶏貫㜥𧵓賖𧶘𧶽贒贃𡤐賛灜贑𤳉㻐起"], +["9040","趩𨀂𡀔𤦊㭼𨆼𧄌竧躭躶軃鋔輙輭𨍥𨐒辥錃𪊟𠩐辳䤪𨧞𨔽𣶻廸𣉢迹𪀔𨚼𨔁𢌥㦀𦻗逷𨔼𧪾遡𨕬𨘋邨𨜓郄𨛦邮都酧㫰醩釄粬𨤳𡺉鈎沟鉁鉢𥖹銹𨫆𣲛𨬌𥗛"], +["90a1","𠴱錬鍫𨫡𨯫炏嫃𨫢𨫥䥥鉄𨯬𨰹𨯿鍳鑛躼閅閦鐦閠濶䊹𢙺𨛘𡉼𣸮䧟氜陻隖䅬隣𦻕懚隶磵𨫠隽双䦡𦲸𠉴𦐐𩂯𩃥𤫑𡤕𣌊霱虂霶䨏䔽䖅𤫩灵孁霛靜𩇕靗孊𩇫靟鐥僐𣂷𣂼鞉鞟鞱鞾韀韒韠𥑬韮琜𩐳響韵𩐝𧥺䫑頴頳顋顦㬎𧅵㵑𠘰𤅜"], +["9140","𥜆飊颷飈飇䫿𦴧𡛓喰飡飦飬鍸餹𤨩䭲𩡗𩤅駵騌騻騐驘𥜥㛄𩂱𩯕髠髢𩬅髴䰎鬔鬭𨘀倴鬴𦦨㣃𣁽魐魀𩴾婅𡡣鮎𤉋鰂鯿鰌𩹨鷔𩾷𪆒𪆫𪃡𪄣𪇟鵾鶃𪄴鸎梈"], +["91a1","鷄𢅛𪆓𪈠𡤻𪈳鴹𪂹𪊴麐麕麞麢䴴麪麯𤍤黁㭠㧥㴝伲㞾𨰫鼂鼈䮖鐤𦶢鼗鼖鼹嚟嚊齅馸𩂋韲葿齢齩竜龎爖䮾𤥵𤦻煷𤧸𤍈𤩑玞𨯚𡣺禟𨥾𨸶鍩鏳𨩄鋬鎁鏋𨥬𤒹爗㻫睲穃烐𤑳𤏸煾𡟯炣𡢾𣖙㻇𡢅𥐯𡟸㜢𡛻𡠹㛡𡝴𡣑𥽋㜣𡛀坛𤨥𡏾𡊨"], +["9240","𡏆𡒶蔃𣚦蔃葕𤦔𧅥𣸱𥕜𣻻𧁒䓴𣛮𩦝𦼦柹㜳㰕㷧塬𡤢栐䁗𣜿𤃡𤂋𤄏𦰡哋嚞𦚱嚒𠿟𠮨𠸍鏆𨬓鎜仸儫㠙𤐶亼𠑥𠍿佋侊𥙑婨𠆫𠏋㦙𠌊𠐔㐵伩𠋀𨺳𠉵諚𠈌亘"], +["92a1","働儍侢伃𤨎𣺊佂倮偬傁俌俥偘僼兙兛兝兞湶𣖕𣸹𣺿浲𡢄𣺉冨凃𠗠䓝𠒣𠒒𠒑赺𨪜𠜎剙劤𠡳勡鍮䙺熌𤎌𠰠𤦬𡃤槑𠸝瑹㻞璙琔瑖玘䮎𤪼𤂍叐㖄爏𤃉喴𠍅响𠯆圝鉝雴鍦埝垍坿㘾壋媙𨩆𡛺𡝯𡜐娬妸銏婾嫏娒𥥆𡧳𡡡𤊕㛵洅瑃娡𥺃"], +["9340","媁𨯗𠐓鏠璌𡌃焅䥲鐈𨧻鎽㞠尞岞幞幈𡦖𡥼𣫮廍孏𡤃𡤄㜁𡢠㛝𡛾㛓脪𨩇𡶺𣑲𨦨弌弎𡤧𡞫婫𡜻孄蘔𧗽衠恾𢡠𢘫忛㺸𢖯𢖾𩂈𦽳懀𠀾𠁆𢘛憙憘恵𢲛𢴇𤛔𩅍"], +["93a1","摱𤙥𢭪㨩𢬢𣑐𩣪𢹸挷𪑛撶挱揑𤧣𢵧护𢲡搻敫楲㯴𣂎𣊭𤦉𣊫唍𣋠𡣙𩐿曎𣊉𣆳㫠䆐𥖄𨬢𥖏𡛼𥕛𥐥磮𣄃𡠪𣈴㑤𣈏𣆂𤋉暎𦴤晫䮓昰𧡰𡷫晣𣋒𣋡昞𥡲㣑𣠺𣞼㮙𣞢𣏾瓐㮖枏𤘪梶栞㯄檾㡣𣟕𤒇樳橒櫉欅𡤒攑梘橌㯗橺歗𣿀𣲚鎠鋲𨯪𨫋"], +["9440","銉𨀞𨧜鑧涥漋𤧬浧𣽿㶏渄𤀼娽渊塇洤硂焻𤌚𤉶烱牐犇犔𤞏𤜥兹𤪤𠗫瑺𣻸𣙟𤩊𤤗𥿡㼆㺱𤫟𨰣𣼵悧㻳瓌琼鎇琷䒟𦷪䕑疃㽣𤳙𤴆㽘畕癳𪗆㬙瑨𨫌𤦫𤦎㫻"], +["94a1","㷍𤩎㻿𤧅𤣳釺圲鍂𨫣𡡤僟𥈡𥇧睸𣈲眎眏睻𤚗𣞁㩞𤣰琸璛㺿𤪺𤫇䃈𤪖𦆮錇𥖁砞碍碈磒珐祙𧝁𥛣䄎禛蒖禥樭𣻺稺秴䅮𡛦䄲鈵秱𠵌𤦌𠊙𣶺𡝮㖗啫㕰㚪𠇔𠰍竢婙𢛵𥪯𥪜娍𠉛磰娪𥯆竾䇹籝籭䈑𥮳𥺼𥺦糍𤧹𡞰粎籼粮檲緜縇緓罎𦉡"], +["9540","𦅜𧭈綗𥺂䉪𦭵𠤖柖𠁎𣗏埄𦐒𦏸𤥢翝笧𠠬𥫩𥵃笌𥸎駦虅驣樜𣐿㧢𤧷𦖭騟𦖠蒀𧄧𦳑䓪脷䐂胆脉腂𦞴飃𦩂艢艥𦩑葓𦶧蘐𧈛媆䅿𡡀嬫𡢡嫤𡣘蚠蜨𣶏蠭𧐢娂"], +["95a1","衮佅袇袿裦襥襍𥚃襔𧞅𧞄𨯵𨯙𨮜𨧹㺭蒣䛵䛏㟲訽訜𩑈彍鈫𤊄旔焩烄𡡅鵭貟賩𧷜妚矃姰䍮㛔踪躧𤰉輰轊䋴汘澻𢌡䢛潹溋𡟚鯩㚵𤤯邻邗啱䤆醻鐄𨩋䁢𨫼鐧𨰝𨰻蓥訫閙閧閗閖𨴴瑅㻂𤣿𤩂𤏪㻧𣈥随𨻧𨹦𨹥㻌𤧭𤩸𣿮琒瑫㻼靁𩂰"], +["9640","桇䨝𩂓𥟟靝鍨𨦉𨰦𨬯𦎾銺嬑譩䤼珹𤈛鞛靱餸𠼦巁𨯅𤪲頟𩓚鋶𩗗釥䓀𨭐𤩧𨭤飜𨩅㼀鈪䤥萔餻饍𧬆㷽馛䭯馪驜𨭥𥣈檏騡嫾騯𩣱䮐𩥈馼䮽䮗鍽塲𡌂堢𤦸"], +["96a1","𡓨硄𢜟𣶸棅㵽鑘㤧慐𢞁𢥫愇鱏鱓鱻鰵鰐魿鯏𩸭鮟𪇵𪃾鴡䲮𤄄鸘䲰鴌𪆴𪃭𪃳𩤯鶥蒽𦸒𦿟𦮂藼䔳𦶤𦺄𦷰萠藮𦸀𣟗𦁤秢𣖜𣙀䤭𤧞㵢鏛銾鍈𠊿碹鉷鑍俤㑀遤𥕝砽硔碶硋𡝗𣇉𤥁㚚佲濚濙瀞瀞吔𤆵垻壳垊鴖埗焴㒯𤆬燫𦱀𤾗嬨𡞵𨩉"], +["9740","愌嫎娋䊼𤒈㜬䭻𨧼鎻鎸𡣖𠼝葲𦳀𡐓𤋺𢰦𤏁妔𣶷𦝁綨𦅛𦂤𤦹𤦋𨧺鋥珢㻩璴𨭣𡢟㻡𤪳櫘珳珻㻖𤨾𤪔𡟙𤩦𠎧𡐤𤧥瑈𤤖炥𤥶銄珦鍟𠓾錱𨫎𨨖鎆𨯧𥗕䤵𨪂煫"], +["97a1","𤥃𠳿嚤𠘚𠯫𠲸唂秄𡟺緾𡛂𤩐𡡒䔮鐁㜊𨫀𤦭妰𡢿𡢃𧒄媡㛢𣵛㚰鉟婹𨪁𡡢鍴㳍𠪴䪖㦊僴㵩㵌𡎜煵䋻𨈘渏𩃤䓫浗𧹏灧沯㳖𣿭𣸭渂漌㵯𠏵畑㚼㓈䚀㻚䡱姄鉮䤾轁𨰜𦯀堒埈㛖𡑒烾𤍢𤩱𢿣𡊰𢎽梹楧𡎘𣓥𧯴𣛟𨪃𣟖𣏺𤲟樚𣚭𦲷萾䓟䓎"], +["9840","𦴦𦵑𦲂𦿞漗𧄉茽𡜺菭𦲀𧁓𡟛妉媂𡞳婡婱𡤅𤇼㜭姯𡜼㛇熎鎐暚𤊥婮娫𤊓樫𣻹𧜶𤑛𤋊焝𤉙𨧡侰𦴨峂𤓎𧹍𤎽樌𤉖𡌄炦焳𤏩㶥泟勇𤩏繥姫崯㷳彜𤩝𡟟綤萦"], +["98a1","咅𣫺𣌀𠈔坾𠣕𠘙㿥𡾞𪊶瀃𩅛嵰玏糓𨩙𩐠俈翧狍猐𧫴猸猹𥛶獁獈㺩𧬘遬燵𤣲珡臶㻊県㻑沢国琙琞琟㻢㻰㻴㻺瓓㼎㽓畂畭畲疍㽼痈痜㿀癍㿗癴㿜発𤽜熈嘣覀塩䀝睃䀹条䁅㗛瞘䁪䁯属瞾矋売砘点砜䂨砹硇硑硦葈𥔵礳栃礲䄃"], +["9940","䄉禑禙辻稆込䅧窑䆲窼艹䇄竏竛䇏両筢筬筻簒簛䉠䉺类粜䊌粸䊔糭输烀𠳏総緔緐緽羮羴犟䎗耠耥笹耮耱联㷌垴炠肷胩䏭脌猪脎脒畠脔䐁㬹腖腙腚"], +["99a1","䐓堺腼膄䐥膓䐭膥埯臁臤艔䒏芦艶苊苘苿䒰荗险榊萅烵葤惣蒈䔄蒾蓡蓸蔐蔸蕒䔻蕯蕰藠䕷虲蚒蚲蛯际螋䘆䘗袮裿褤襇覑𧥧訩訸誔誴豑賔賲贜䞘塟跃䟭仮踺嗘坔蹱嗵躰䠷軎転軤軭軲辷迁迊迌逳駄䢭飠鈓䤞鈨鉘鉫銱銮銿"], +["9a40","鋣鋫鋳鋴鋽鍃鎄鎭䥅䥑麿鐗匁鐝鐭鐾䥪鑔鑹锭関䦧间阳䧥枠䨤靀䨵鞲韂噔䫤惨颹䬙飱塄餎餙冴餜餷饂饝饢䭰駅䮝騼鬏窃魩鮁鯝鯱鯴䱭鰠㝯𡯂鵉鰺"], +["9aa1","黾噐鶓鶽鷀鷼银辶鹻麬麱麽黆铜黢黱黸竈齄𠂔𠊷𠎠椚铃妬𠓗塀铁㞹𠗕𠘕𠙶𡚺块煳𠫂𠫍𠮿呪吆𠯋咞𠯻𠰻𠱓𠱥𠱼惧𠲍噺𠲵𠳝𠳭𠵯𠶲𠷈楕鰯螥𠸄𠸎𠻗𠾐𠼭𠹳尠𠾼帋𡁜𡁏𡁶朞𡁻𡂈𡂖㙇𡂿𡃓𡄯𡄻卤蒭𡋣𡍵𡌶讁𡕷𡘙𡟃𡟇乸炻𡠭𡥪"], +["9b40","𡨭𡩅𡰪𡱰𡲬𡻈拃𡻕𡼕熘桕𢁅槩㛈𢉼𢏗𢏺𢜪𢡱𢥏苽𢥧𢦓𢫕覥𢫨辠𢬎鞸𢬿顇骽𢱌"], +["9b62","𢲈𢲷𥯨𢴈𢴒𢶷𢶕𢹂𢽴𢿌𣀳𣁦𣌟𣏞徱晈暿𧩹𣕧𣗳爁𤦺矗𣘚𣜖纇𠍆墵朎"], +["9ba1","椘𣪧𧙗𥿢𣸑𣺹𧗾𢂚䣐䪸𤄙𨪚𤋮𤌍𤀻𤌴𤎖𤩅𠗊凒𠘑妟𡺨㮾𣳿𤐄𤓖垈𤙴㦛𤜯𨗨𩧉㝢𢇃譞𨭎駖𤠒𤣻𤨕爉𤫀𠱸奥𤺥𤾆𠝹軚𥀬劏圿煱𥊙𥐙𣽊𤪧喼𥑆𥑮𦭒釔㑳𥔿𧘲𥕞䜘𥕢𥕦𥟇𤤿𥡝偦㓻𣏌惞𥤃䝼𨥈𥪮𥮉𥰆𡶐垡煑澶𦄂𧰒遖𦆲𤾚譢𦐂𦑊"], +["9c40","嵛𦯷輶𦒄𡤜諪𤧶𦒈𣿯𦔒䯀𦖿𦚵𢜛鑥𥟡憕娧晉侻嚹𤔡𦛼乪𤤴陖涏𦲽㘘襷𦞙𦡮𦐑𦡞營𦣇筂𩃀𠨑𦤦鄄𦤹穅鷰𦧺騦𦨭㙟𦑩𠀡禃𦨴𦭛崬𣔙菏𦮝䛐𦲤画补𦶮墶"], +["9ca1","㜜𢖍𧁋𧇍㱔𧊀𧊅銁𢅺𧊋錰𧋦𤧐氹钟𧑐𠻸蠧裵𢤦𨑳𡞱溸𤨪𡠠㦤㚹尐秣䔿暶𩲭𩢤襃𧟌𧡘囖䃟𡘊㦡𣜯𨃨𡏅熭荦𧧝𩆨婧䲷𧂯𨦫𧧽𧨊𧬋𧵦𤅺筃祾𨀉澵𪋟樃𨌘厢𦸇鎿栶靝𨅯𨀣𦦵𡏭𣈯𨁈嶅𨰰𨂃圕頣𨥉嶫𤦈斾槕叒𤪥𣾁㰑朶𨂐𨃴𨄮𡾡𨅏"], +["9d40","𨆉𨆯𨈚𨌆𨌯𨎊㗊𨑨𨚪䣺揦𨥖砈鉕𨦸䏲𨧧䏟𨧨𨭆𨯔姸𨰉輋𨿅𩃬筑𩄐𩄼㷷𩅞𤫊运犏嚋𩓧𩗩𩖰𩖸𩜲𩣑𩥉𩥪𩧃𩨨𩬎𩵚𩶛纟𩻸𩼣䲤镇𪊓熢𪋿䶑递𪗋䶜𠲜达嗁"], +["9da1","辺𢒰边𤪓䔉繿潖檱仪㓤𨬬𧢝㜺躀𡟵𨀤𨭬𨮙𧨾𦚯㷫𧙕𣲷𥘵𥥖亚𥺁𦉘嚿𠹭踎孭𣺈𤲞揞拐𡟶𡡻攰嘭𥱊吚𥌑㷆𩶘䱽嘢嘞罉𥻘奵𣵀蝰东𠿪𠵉𣚺脗鵞贘瘻鱅癎瞹鍅吲腈苷嘥脲萘肽嗪祢噃吖𠺝㗎嘅嗱曱𨋢㘭甴嗰喺咗啲𠱁𠲖廐𥅈𠹶𢱢"], +["9e40","𠺢麫絚嗞𡁵抝靭咔賍燶酶揼掹揾啩𢭃鱲𢺳冚㓟𠶧冧呍唞唓癦踭𦢊疱肶蠄螆裇膶萜𡃁䓬猄𤜆宐茋𦢓噻𢛴𧴯𤆣𧵳𦻐𧊶酰𡇙鈈𣳼𪚩𠺬𠻹牦𡲢䝎𤿂𧿹𠿫䃺"], +["9ea1","鱝攟𢶠䣳𤟠𩵼𠿬𠸊恢𧖣𠿭"], +["9ead","𦁈𡆇熣纎鵐业丄㕷嬍沲卧㚬㧜卽㚥𤘘墚𤭮舭呋垪𥪕𠥹"], +["9ec5","㩒𢑥獴𩺬䴉鯭𣳾𩼰䱛𤾩𩖞𩿞葜𣶶𧊲𦞳𣜠挮紥𣻷𣸬㨪逈勌㹴㙺䗩𠒎癀嫰𠺶硺𧼮墧䂿噼鮋嵴癔𪐴麅䳡痹㟻愙𣃚𤏲"], +["9ef5","噝𡊩垧𤥣𩸆刴𧂮㖭汊鵼"], +["9f40","籖鬹埞𡝬屓擓𩓐𦌵𧅤蚭𠴨𦴢𤫢𠵱"], +["9f4f","凾𡼏嶎霃𡷑麁遌笟鬂峑箣扨挵髿篏鬪籾鬮籂粆鰕篼鬉鼗鰛𤤾齚啳寃俽麘俲剠㸆勑坧偖妷帒韈鶫轜呩鞴饀鞺匬愰"], +["9fa1","椬叚鰊鴂䰻陁榀傦畆𡝭駚剳"], +["9fae","酙隁酜"], +["9fb2","酑𨺗捿𦴣櫊嘑醎畺抅𠏼獏籰𥰡𣳽"], +["9fc1","𤤙盖鮝个𠳔莾衂"], +["9fc9","届槀僭坺刟巵从氱𠇲伹咜哚劚趂㗾弌㗳"], +["9fdb","歒酼龥鮗頮颴骺麨麄煺笔"], +["9fe7","毺蠘罸"], +["9feb","嘠𪙊蹷齓"], +["9ff0","跔蹏鸜踁抂𨍽踨蹵竓𤩷稾磘泪詧瘇"], +["a040","𨩚鼦泎蟖痃𪊲硓咢贌狢獱謭猂瓱賫𤪻蘯徺袠䒷"], +["a055","𡠻𦸅"], +["a058","詾𢔛"], +["a05b","惽癧髗鵄鍮鮏蟵"], +["a063","蠏賷猬霡鮰㗖犲䰇籑饊𦅙慙䰄麖慽"], +["a073","坟慯抦戹拎㩜懢厪𣏵捤栂㗒"], +["a0a1","嵗𨯂迚𨸹"], +["a0a6","僙𡵆礆匲阸𠼻䁥"], +["a0ae","矾"], +["a0b0","糂𥼚糚稭聦聣絍甅瓲覔舚朌聢𧒆聛瓰脃眤覉𦟌畓𦻑螩蟎臈螌詉貭譃眫瓸蓚㘵榲趦"], +["a0d4","覩瑨涹蟁𤀑瓧㷛煶悤憜㳑煢恷"], +["a0e2","罱𨬭牐惩䭾删㰘𣳇𥻗𧙖𥔱𡥄𡋾𩤃𦷜𧂭峁𦆭𨨏𣙷𠃮𦡆𤼎䕢嬟𦍌齐麦𦉫"], +["a3c0","␀",31,"␡"], +["c6a1","①",9,"⑴",9,"ⅰ",9,"丶丿亅亠冂冖冫勹匸卩厶夊宀巛⼳广廴彐彡攴无疒癶辵隶¨ˆヽヾゝゞ〃仝々〆〇ー[]✽ぁ",23], +["c740","す",58,"ァアィイ"], +["c7a1","ゥ",81,"А",5,"ЁЖ",4], +["c840","Л",26,"ёж",25,"⇧↸↹㇏𠃌乚𠂊刂䒑"], +["c8a1","龰冈龱𧘇"], +["c8cd","¬¦'"㈱№℡゛゜⺀⺄⺆⺇⺈⺊⺌⺍⺕⺜⺝⺥⺧⺪⺬⺮⺶⺼⺾⻆⻊⻌⻍⻏⻖⻗⻞⻣"], +["c8f5","ʃɐɛɔɵœøŋʊɪ"], +["f9fe","■"], +["fa40","𠕇鋛𠗟𣿅蕌䊵珯况㙉𤥂𨧤鍄𡧛苮𣳈砼杄拟𤤳𨦪𠊠𦮳𡌅侫𢓭倈𦴩𧪄𣘀𤪱𢔓倩𠍾徤𠎀𠍇滛𠐟偽儁㑺儎顬㝃萖𤦤𠒇兠𣎴兪𠯿𢃼𠋥𢔰𠖎𣈳𡦃宂蝽𠖳𣲙冲冸"], +["faa1","鴴凉减凑㳜凓𤪦决凢卂凭菍椾𣜭彻刋刦刼劵剗劔効勅簕蕂勠蘍𦬓包𨫞啉滙𣾀𠥔𣿬匳卄𠯢泋𡜦栛珕恊㺪㣌𡛨燝䒢卭却𨚫卾卿𡖖𡘓矦厓𨪛厠厫厮玧𥝲㽙玜叁叅汉义埾叙㪫𠮏叠𣿫𢶣叶𠱷吓灹唫晗浛呭𦭓𠵴啝咏咤䞦𡜍𠻝㶴𠵍"], +["fb40","𨦼𢚘啇䳭启琗喆喩嘅𡣗𤀺䕒𤐵暳𡂴嘷曍𣊊暤暭噍噏磱囱鞇叾圀囯园𨭦㘣𡉏坆𤆥汮炋坂㚱𦱾埦𡐖堃𡑔𤍣堦𤯵塜墪㕡壠壜𡈼壻寿坃𪅐𤉸鏓㖡够梦㛃湙"], +["fba1","𡘾娤啓𡚒蔅姉𠵎𦲁𦴪𡟜姙𡟻𡞲𦶦浱𡠨𡛕姹𦹅媫婣㛦𤦩婷㜈媖瑥嫓𦾡𢕔㶅𡤑㜲𡚸広勐孶斈孼𧨎䀄䡝𠈄寕慠𡨴𥧌𠖥寳宝䴐尅𡭄尓珎尔𡲥𦬨屉䣝岅峩峯嶋𡷹𡸷崐崘嵆𡺤岺巗苼㠭𤤁𢁉𢅳芇㠶㯂帮檊幵幺𤒼𠳓厦亷廐厨𡝱帉廴𨒂"], +["fc40","廹廻㢠廼栾鐛弍𠇁弢㫞䢮𡌺强𦢈𢏐彘𢑱彣鞽𦹮彲鍀𨨶徧嶶㵟𥉐𡽪𧃸𢙨釖𠊞𨨩怱暅𡡷㥣㷇㘹垐𢞴祱㹀悞悤悳𤦂𤦏𧩓璤僡媠慤萤慂慈𦻒憁凴𠙖憇宪𣾷"], +["fca1","𢡟懓𨮝𩥝懐㤲𢦀𢣁怣慜攞掋𠄘担𡝰拕𢸍捬𤧟㨗搸揸𡎎𡟼撐澊𢸶頔𤂌𥜝擡擥鑻㩦携㩗敍漖𤨨𤨣斅敭敟𣁾斵𤥀䬷旑䃘𡠩无旣忟𣐀昘𣇷𣇸晄𣆤𣆥晋𠹵晧𥇦晳晴𡸽𣈱𨗴𣇈𥌓矅𢣷馤朂𤎜𤨡㬫槺𣟂杞杧杢𤇍𩃭柗䓩栢湐鈼栁𣏦𦶠桝"], +["fd40","𣑯槡樋𨫟楳棃𣗍椁椀㴲㨁𣘼㮀枬楡𨩊䋼椶榘㮡𠏉荣傐槹𣙙𢄪橅𣜃檝㯳枱櫈𩆜㰍欝𠤣惞欵歴𢟍溵𣫛𠎵𡥘㝀吡𣭚毡𣻼毜氷𢒋𤣱𦭑汚舦汹𣶼䓅𣶽𤆤𤤌𤤀"], +["fda1","𣳉㛥㳫𠴲鮃𣇹𢒑羏样𦴥𦶡𦷫涖浜湼漄𤥿𤂅𦹲蔳𦽴凇沜渝萮𨬡港𣸯瑓𣾂秌湏媑𣁋濸㜍澝𣸰滺𡒗𤀽䕕鏰潄潜㵎潴𩅰㴻澟𤅄濓𤂑𤅕𤀹𣿰𣾴𤄿凟𤅖𤅗𤅀𦇝灋灾炧炁烌烕烖烟䄄㷨熴熖𤉷焫煅媈煊煮岜𤍥煏鍢𤋁焬𤑚𤨧𤨢熺𨯨炽爎"], +["fe40","鑂爕夑鑃爤鍁𥘅爮牀𤥴梽牕牗㹕𣁄栍漽犂猪猫𤠣𨠫䣭𨠄猨献珏玪𠰺𦨮珉瑉𤇢𡛧𤨤昣㛅𤦷𤦍𤧻珷琕椃𤨦琹𠗃㻗瑜𢢭瑠𨺲瑇珤瑶莹瑬㜰瑴鏱樬璂䥓𤪌"], +["fea1","𤅟𤩹𨮏孆𨰃𡢞瓈𡦈甎瓩甞𨻙𡩋寗𨺬鎅畍畊畧畮𤾂㼄𤴓疎瑝疞疴瘂瘬癑癏癯癶𦏵皐臯㟸𦤑𦤎皡皥皷盌𦾟葢𥂝𥅽𡸜眞眦着撯𥈠睘𣊬瞯𨥤𨥨𡛁矴砉𡍶𤨒棊碯磇磓隥礮𥗠磗礴碱𧘌辸袄𨬫𦂃𢘜禆褀椂禀𥡗禝𧬹礼禩渪𧄦㺨秆𩄍秔"] +] diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/tables/cp936.json b/node_modules/npm/node_modules/iconv-lite/encodings/tables/cp936.json new file mode 100644 index 00000000..49ddb9a1 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/tables/cp936.json @@ -0,0 +1,264 @@ +[ +["0","\u0000",127,"€"], +["8140","丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱丳丵丷丼乀乁乂乄乆乊乑乕乗乚乛乢乣乤乥乧乨乪",5,"乲乴",9,"乿",6,"亇亊"], +["8180","亐亖亗亙亜亝亞亣亪亯亰亱亴亶亷亸亹亼亽亾仈仌仏仐仒仚仛仜仠仢仦仧仩仭仮仯仱仴仸仹仺仼仾伀伂",6,"伋伌伒",4,"伜伝伡伣伨伩伬伭伮伱伳伵伷伹伻伾",4,"佄佅佇",5,"佒佔佖佡佢佦佨佪佫佭佮佱佲併佷佸佹佺佽侀侁侂侅來侇侊侌侎侐侒侓侕侖侘侙侚侜侞侟価侢"], +["8240","侤侫侭侰",4,"侶",8,"俀俁係俆俇俈俉俋俌俍俒",4,"俙俛俠俢俤俥俧俫俬俰俲俴俵俶俷俹俻俼俽俿",11], +["8280","個倎倐們倓倕倖倗倛倝倞倠倢倣値倧倫倯",10,"倻倽倿偀偁偂偄偅偆偉偊偋偍偐",4,"偖偗偘偙偛偝",7,"偦",5,"偭",8,"偸偹偺偼偽傁傂傃傄傆傇傉傊傋傌傎",20,"傤傦傪傫傭",4,"傳",6,"傼"], +["8340","傽",17,"僐",5,"僗僘僙僛",10,"僨僩僪僫僯僰僱僲僴僶",4,"僼",9,"儈"], +["8380","儉儊儌",5,"儓",13,"儢",28,"兂兇兊兌兎兏児兒兓兗兘兙兛兝",4,"兣兤兦內兩兪兯兲兺兾兿冃冄円冇冊冋冎冏冐冑冓冔冘冚冝冞冟冡冣冦",4,"冭冮冴冸冹冺冾冿凁凂凃凅凈凊凍凎凐凒",5], +["8440","凘凙凚凜凞凟凢凣凥",5,"凬凮凱凲凴凷凾刄刅刉刋刌刏刐刓刔刕刜刞刟刡刢刣別刦刧刪刬刯刱刲刴刵刼刾剄",5,"剋剎剏剒剓剕剗剘"], +["8480","剙剚剛剝剟剠剢剣剤剦剨剫剬剭剮剰剱剳",9,"剾劀劃",4,"劉",6,"劑劒劔",6,"劜劤劥劦劧劮劯劰労",9,"勀勁勂勄勅勆勈勊勌勍勎勏勑勓勔動勗務",5,"勠勡勢勣勥",10,"勱",7,"勻勼勽匁匂匃匄匇匉匊匋匌匎"], +["8540","匑匒匓匔匘匛匜匞匟匢匤匥匧匨匩匫匬匭匯",9,"匼匽區卂卄卆卋卌卍卐協単卙卛卝卥卨卪卬卭卲卶卹卻卼卽卾厀厁厃厇厈厊厎厏"], +["8580","厐",4,"厖厗厙厛厜厞厠厡厤厧厪厫厬厭厯",6,"厷厸厹厺厼厽厾叀參",4,"収叏叐叒叓叕叚叜叝叞叡叢叧叴叺叾叿吀吂吅吇吋吔吘吙吚吜吢吤吥吪吰吳吶吷吺吽吿呁呂呄呅呇呉呌呍呎呏呑呚呝",4,"呣呥呧呩",7,"呴呹呺呾呿咁咃咅咇咈咉咊咍咑咓咗咘咜咞咟咠咡"], +["8640","咢咥咮咰咲咵咶咷咹咺咼咾哃哅哊哋哖哘哛哠",4,"哫哬哯哰哱哴",5,"哻哾唀唂唃唄唅唈唊",4,"唒唓唕",5,"唜唝唞唟唡唥唦"], +["8680","唨唩唫唭唲唴唵唶唸唹唺唻唽啀啂啅啇啈啋",4,"啑啒啓啔啗",4,"啝啞啟啠啢啣啨啩啫啯",5,"啹啺啽啿喅喆喌喍喎喐喒喓喕喖喗喚喛喞喠",6,"喨",8,"喲喴営喸喺喼喿",4,"嗆嗇嗈嗊嗋嗎嗏嗐嗕嗗",4,"嗞嗠嗢嗧嗩嗭嗮嗰嗱嗴嗶嗸",4,"嗿嘂嘃嘄嘅"], +["8740","嘆嘇嘊嘋嘍嘐",7,"嘙嘚嘜嘝嘠嘡嘢嘥嘦嘨嘩嘪嘫嘮嘯嘰嘳嘵嘷嘸嘺嘼嘽嘾噀",11,"噏",4,"噕噖噚噛噝",4], +["8780","噣噥噦噧噭噮噯噰噲噳噴噵噷噸噹噺噽",7,"嚇",6,"嚐嚑嚒嚔",14,"嚤",10,"嚰",6,"嚸嚹嚺嚻嚽",12,"囋",8,"囕囖囘囙囜団囥",5,"囬囮囯囲図囶囷囸囻囼圀圁圂圅圇國",6], +["8840","園",9,"圝圞圠圡圢圤圥圦圧圫圱圲圴",4,"圼圽圿坁坃坄坅坆坈坉坋坒",4,"坘坙坢坣坥坧坬坮坰坱坲坴坵坸坹坺坽坾坿垀"], +["8880","垁垇垈垉垊垍",4,"垔",6,"垜垝垞垟垥垨垪垬垯垰垱垳垵垶垷垹",8,"埄",6,"埌埍埐埑埓埖埗埛埜埞埡埢埣埥",7,"埮埰埱埲埳埵埶執埻埼埾埿堁堃堄堅堈堉堊堌堎堏堐堒堓堔堖堗堘堚堛堜堝堟堢堣堥",4,"堫",4,"報堲堳場堶",7], +["8940","堾",5,"塅",6,"塎塏塐塒塓塕塖塗塙",4,"塟",5,"塦",4,"塭",16,"塿墂墄墆墇墈墊墋墌"], +["8980","墍",4,"墔",4,"墛墜墝墠",7,"墪",17,"墽墾墿壀壂壃壄壆",10,"壒壓壔壖",13,"壥",5,"壭壯壱売壴壵壷壸壺",7,"夃夅夆夈",4,"夎夐夑夒夓夗夘夛夝夞夠夡夢夣夦夨夬夰夲夳夵夶夻"], +["8a40","夽夾夿奀奃奅奆奊奌奍奐奒奓奙奛",4,"奡奣奤奦",12,"奵奷奺奻奼奾奿妀妅妉妋妌妎妏妐妑妔妕妘妚妛妜妝妟妠妡妢妦"], +["8a80","妧妬妭妰妱妳",5,"妺妼妽妿",6,"姇姈姉姌姍姎姏姕姖姙姛姞",4,"姤姦姧姩姪姫姭",11,"姺姼姽姾娀娂娊娋娍娎娏娐娒娔娕娖娗娙娚娛娝娞娡娢娤娦娧娨娪",6,"娳娵娷",4,"娽娾娿婁",4,"婇婈婋",9,"婖婗婘婙婛",5], +["8b40","婡婣婤婥婦婨婩婫",8,"婸婹婻婼婽婾媀",17,"媓",6,"媜",13,"媫媬"], +["8b80","媭",4,"媴媶媷媹",4,"媿嫀嫃",5,"嫊嫋嫍",4,"嫓嫕嫗嫙嫚嫛嫝嫞嫟嫢嫤嫥嫧嫨嫪嫬",4,"嫲",22,"嬊",11,"嬘",25,"嬳嬵嬶嬸",7,"孁",6], +["8c40","孈",7,"孒孖孞孠孡孧孨孫孭孮孯孲孴孶孷學孹孻孼孾孿宂宆宊宍宎宐宑宒宔宖実宧宨宩宬宭宮宯宱宲宷宺宻宼寀寁寃寈寉寊寋寍寎寏"], +["8c80","寑寔",8,"寠寢寣實寧審",4,"寯寱",6,"寽対尀専尃尅將專尋尌對導尐尒尓尗尙尛尞尟尠尡尣尦尨尩尪尫尭尮尯尰尲尳尵尶尷屃屄屆屇屌屍屒屓屔屖屗屘屚屛屜屝屟屢層屧",6,"屰屲",6,"屻屼屽屾岀岃",4,"岉岊岋岎岏岒岓岕岝",4,"岤",4], +["8d40","岪岮岯岰岲岴岶岹岺岻岼岾峀峂峃峅",5,"峌",5,"峓",5,"峚",6,"峢峣峧峩峫峬峮峯峱",9,"峼",4], +["8d80","崁崄崅崈",5,"崏",4,"崕崗崘崙崚崜崝崟",4,"崥崨崪崫崬崯",4,"崵",7,"崿",7,"嵈嵉嵍",10,"嵙嵚嵜嵞",10,"嵪嵭嵮嵰嵱嵲嵳嵵",12,"嶃",21,"嶚嶛嶜嶞嶟嶠"], +["8e40","嶡",21,"嶸",12,"巆",6,"巎",12,"巜巟巠巣巤巪巬巭"], +["8e80","巰巵巶巸",4,"巿帀帄帇帉帊帋帍帎帒帓帗帞",7,"帨",4,"帯帰帲",4,"帹帺帾帿幀幁幃幆",5,"幍",6,"幖",4,"幜幝幟幠幣",14,"幵幷幹幾庁庂広庅庈庉庌庍庎庒庘庛庝庡庢庣庤庨",4,"庮",4,"庴庺庻庼庽庿",6], +["8f40","廆廇廈廋",5,"廔廕廗廘廙廚廜",11,"廩廫",8,"廵廸廹廻廼廽弅弆弇弉弌弍弎弐弒弔弖弙弚弜弝弞弡弢弣弤"], +["8f80","弨弫弬弮弰弲",6,"弻弽弾弿彁",14,"彑彔彙彚彛彜彞彟彠彣彥彧彨彫彮彯彲彴彵彶彸彺彽彾彿徃徆徍徎徏徑従徔徖徚徛徝從徟徠徢",5,"復徫徬徯",5,"徶徸徹徺徻徾",4,"忇忈忊忋忎忓忔忕忚忛応忞忟忢忣忥忦忨忩忬忯忰忲忳忴忶忷忹忺忼怇"], +["9040","怈怉怋怌怐怑怓怗怘怚怞怟怢怣怤怬怭怮怰",4,"怶",4,"怽怾恀恄",6,"恌恎恏恑恓恔恖恗恘恛恜恞恟恠恡恥恦恮恱恲恴恵恷恾悀"], +["9080","悁悂悅悆悇悈悊悋悎悏悐悑悓悕悗悘悙悜悞悡悢悤悥悧悩悪悮悰悳悵悶悷悹悺悽",7,"惇惈惉惌",4,"惒惓惔惖惗惙惛惞惡",4,"惪惱惲惵惷惸惻",4,"愂愃愄愅愇愊愋愌愐",4,"愖愗愘愙愛愜愝愞愡愢愥愨愩愪愬",18,"慀",6], +["9140","慇慉態慍慏慐慒慓慔慖",6,"慞慟慠慡慣慤慥慦慩",6,"慱慲慳慴慶慸",18,"憌憍憏",4,"憕"], +["9180","憖",6,"憞",8,"憪憫憭",9,"憸",5,"憿懀懁懃",4,"應懌",4,"懓懕",16,"懧",13,"懶",8,"戀",5,"戇戉戓戔戙戜戝戞戠戣戦戧戨戩戫戭戯戰戱戲戵戶戸",4,"扂扄扅扆扊"], +["9240","扏扐払扖扗扙扚扜",6,"扤扥扨扱扲扴扵扷扸扺扻扽抁抂抃抅抆抇抈抋",5,"抔抙抜抝択抣抦抧抩抪抭抮抯抰抲抳抴抶抷抸抺抾拀拁"], +["9280","拃拋拏拑拕拝拞拠拡拤拪拫拰拲拵拸拹拺拻挀挃挄挅挆挊挋挌挍挏挐挒挓挔挕挗挘挙挜挦挧挩挬挭挮挰挱挳",5,"挻挼挾挿捀捁捄捇捈捊捑捒捓捔捖",7,"捠捤捥捦捨捪捫捬捯捰捲捳捴捵捸捹捼捽捾捿掁掃掄掅掆掋掍掑掓掔掕掗掙",6,"採掤掦掫掯掱掲掵掶掹掻掽掿揀"], +["9340","揁揂揃揅揇揈揊揋揌揑揓揔揕揗",6,"揟揢揤",4,"揫揬揮揯揰揱揳揵揷揹揺揻揼揾搃搄搆",4,"損搎搑搒搕",5,"搝搟搢搣搤"], +["9380","搥搧搨搩搫搮",5,"搵",4,"搻搼搾摀摂摃摉摋",6,"摓摕摖摗摙",4,"摟",7,"摨摪摫摬摮",9,"摻",6,"撃撆撈",8,"撓撔撗撘撚撛撜撝撟",4,"撥撦撧撨撪撫撯撱撲撳撴撶撹撻撽撾撿擁擃擄擆",6,"擏擑擓擔擕擖擙據"], +["9440","擛擜擝擟擠擡擣擥擧",24,"攁",7,"攊",7,"攓",4,"攙",8], +["9480","攢攣攤攦",4,"攬攭攰攱攲攳攷攺攼攽敀",4,"敆敇敊敋敍敎敐敒敓敔敗敘敚敜敟敠敡敤敥敧敨敩敪敭敮敯敱敳敵敶數",14,"斈斉斊斍斎斏斒斔斕斖斘斚斝斞斠斢斣斦斨斪斬斮斱",7,"斺斻斾斿旀旂旇旈旉旊旍旐旑旓旔旕旘",7,"旡旣旤旪旫"], +["9540","旲旳旴旵旸旹旻",4,"昁昄昅昇昈昉昋昍昐昑昒昖昗昘昚昛昜昞昡昢昣昤昦昩昪昫昬昮昰昲昳昷",4,"昽昿晀時晄",6,"晍晎晐晑晘"], +["9580","晙晛晜晝晞晠晢晣晥晧晩",4,"晱晲晳晵晸晹晻晼晽晿暀暁暃暅暆暈暉暊暋暍暎暏暐暒暓暔暕暘",4,"暞",8,"暩",4,"暯",4,"暵暶暷暸暺暻暼暽暿",25,"曚曞",7,"曧曨曪",5,"曱曵曶書曺曻曽朁朂會"], +["9640","朄朅朆朇朌朎朏朑朒朓朖朘朙朚朜朞朠",5,"朧朩朮朰朲朳朶朷朸朹朻朼朾朿杁杄杅杇杊杋杍杒杔杕杗",4,"杝杢杣杤杦杧杫杬杮東杴杶"], +["9680","杸杹杺杻杽枀枂枃枅枆枈枊枌枍枎枏枑枒枓枔枖枙枛枟枠枡枤枦枩枬枮枱枲枴枹",7,"柂柅",9,"柕柖柗柛柟柡柣柤柦柧柨柪柫柭柮柲柵",7,"柾栁栂栃栄栆栍栐栒栔栕栘",4,"栞栟栠栢",6,"栫",6,"栴栵栶栺栻栿桇桋桍桏桒桖",5], +["9740","桜桝桞桟桪桬",7,"桵桸",8,"梂梄梇",7,"梐梑梒梔梕梖梘",9,"梣梤梥梩梪梫梬梮梱梲梴梶梷梸"], +["9780","梹",6,"棁棃",5,"棊棌棎棏棐棑棓棔棖棗棙棛",4,"棡棢棤",9,"棯棲棳棴棶棷棸棻棽棾棿椀椂椃椄椆",4,"椌椏椑椓",11,"椡椢椣椥",7,"椮椯椱椲椳椵椶椷椸椺椻椼椾楀楁楃",16,"楕楖楘楙楛楜楟"], +["9840","楡楢楤楥楧楨楩楪楬業楯楰楲",4,"楺楻楽楾楿榁榃榅榊榋榌榎",5,"榖榗榙榚榝",9,"榩榪榬榮榯榰榲榳榵榶榸榹榺榼榽"], +["9880","榾榿槀槂",7,"構槍槏槑槒槓槕",5,"槜槝槞槡",11,"槮槯槰槱槳",9,"槾樀",9,"樋",11,"標",5,"樠樢",5,"権樫樬樭樮樰樲樳樴樶",6,"樿",4,"橅橆橈",7,"橑",6,"橚"], +["9940","橜",4,"橢橣橤橦",10,"橲",6,"橺橻橽橾橿檁檂檃檅",8,"檏檒",4,"檘",7,"檡",5], +["9980","檧檨檪檭",114,"欥欦欨",6], +["9a40","欯欰欱欳欴欵欶欸欻欼欽欿歀歁歂歄歅歈歊歋歍",11,"歚",7,"歨歩歫",13,"歺歽歾歿殀殅殈"], +["9a80","殌殎殏殐殑殔殕殗殘殙殜",4,"殢",7,"殫",7,"殶殸",6,"毀毃毄毆",4,"毌毎毐毑毘毚毜",4,"毢",7,"毬毭毮毰毱毲毴毶毷毸毺毻毼毾",6,"氈",4,"氎氒気氜氝氞氠氣氥氫氬氭氱氳氶氷氹氺氻氼氾氿汃汄汅汈汋",4,"汑汒汓汖汘"], +["9b40","汙汚汢汣汥汦汧汫",4,"汱汳汵汷汸決汻汼汿沀沄沇沊沋沍沎沑沒沕沖沗沘沚沜沝沞沠沢沨沬沯沰沴沵沶沷沺泀況泂泃泆泇泈泋泍泎泏泑泒泘"], +["9b80","泙泚泜泝泟泤泦泧泩泬泭泲泴泹泿洀洂洃洅洆洈洉洊洍洏洐洑洓洔洕洖洘洜洝洟",5,"洦洨洩洬洭洯洰洴洶洷洸洺洿浀浂浄浉浌浐浕浖浗浘浛浝浟浡浢浤浥浧浨浫浬浭浰浱浲浳浵浶浹浺浻浽",4,"涃涄涆涇涊涋涍涏涐涒涖",4,"涜涢涥涬涭涰涱涳涴涶涷涹",5,"淁淂淃淈淉淊"], +["9c40","淍淎淏淐淒淓淔淕淗淚淛淜淟淢淣淥淧淨淩淪淭淯淰淲淴淵淶淸淺淽",7,"渆渇済渉渋渏渒渓渕渘渙減渜渞渟渢渦渧渨渪測渮渰渱渳渵"], +["9c80","渶渷渹渻",7,"湅",7,"湏湐湑湒湕湗湙湚湜湝湞湠",10,"湬湭湯",14,"満溁溂溄溇溈溊",4,"溑",6,"溙溚溛溝溞溠溡溣溤溦溨溩溫溬溭溮溰溳溵溸溹溼溾溿滀滃滄滅滆滈滉滊滌滍滎滐滒滖滘滙滛滜滝滣滧滪",5], +["9d40","滰滱滲滳滵滶滷滸滺",7,"漃漄漅漇漈漊",4,"漐漑漒漖",9,"漡漢漣漥漦漧漨漬漮漰漲漴漵漷",6,"漿潀潁潂"], +["9d80","潃潄潅潈潉潊潌潎",9,"潙潚潛潝潟潠潡潣潤潥潧",5,"潯潰潱潳潵潶潷潹潻潽",6,"澅澆澇澊澋澏",12,"澝澞澟澠澢",4,"澨",10,"澴澵澷澸澺",5,"濁濃",5,"濊",6,"濓",10,"濟濢濣濤濥"], +["9e40","濦",7,"濰",32,"瀒",7,"瀜",6,"瀤",6], +["9e80","瀫",9,"瀶瀷瀸瀺",17,"灍灎灐",13,"灟",11,"灮灱灲灳灴灷灹灺灻災炁炂炃炄炆炇炈炋炌炍炏炐炑炓炗炘炚炛炞",12,"炰炲炴炵炶為炾炿烄烅烆烇烉烋",12,"烚"], +["9f40","烜烝烞烠烡烢烣烥烪烮烰",6,"烸烺烻烼烾",10,"焋",4,"焑焒焔焗焛",10,"焧",7,"焲焳焴"], +["9f80","焵焷",13,"煆煇煈煉煋煍煏",12,"煝煟",4,"煥煩",4,"煯煰煱煴煵煶煷煹煻煼煾",5,"熅",4,"熋熌熍熎熐熑熒熓熕熖熗熚",4,"熡",6,"熩熪熫熭",5,"熴熶熷熸熺",8,"燄",9,"燏",4], +["a040","燖",9,"燡燢燣燤燦燨",5,"燯",9,"燺",11,"爇",19], +["a080","爛爜爞",9,"爩爫爭爮爯爲爳爴爺爼爾牀",6,"牉牊牋牎牏牐牑牓牔牕牗牘牚牜牞牠牣牤牥牨牪牫牬牭牰牱牳牴牶牷牸牻牼牽犂犃犅",4,"犌犎犐犑犓",11,"犠",11,"犮犱犲犳犵犺",6,"狅狆狇狉狊狋狌狏狑狓狔狕狖狘狚狛"], +["a1a1"," 、。·ˉˇ¨〃々—~‖…‘’“”〔〕〈",7,"〖〗【】±×÷∶∧∨∑∏∪∩∈∷√⊥∥∠⌒⊙∫∮≡≌≈∽∝≠≮≯≤≥∞∵∴♂♀°′″℃$¤¢£‰§№☆★○●◎◇◆□■△▲※→←↑↓〓"], +["a2a1","ⅰ",9], +["a2b1","⒈",19,"⑴",19,"①",9], +["a2e5","㈠",9], +["a2f1","Ⅰ",11], +["a3a1","!"#¥%",88," ̄"], +["a4a1","ぁ",82], +["a5a1","ァ",85], +["a6a1","Α",16,"Σ",6], +["a6c1","α",16,"σ",6], +["a6e0","︵︶︹︺︿﹀︽︾﹁﹂﹃﹄"], +["a6ee","︻︼︷︸︱"], +["a6f4","︳︴"], +["a7a1","А",5,"ЁЖ",25], +["a7d1","а",5,"ёж",25], +["a840","ˊˋ˙–―‥‵℅℉↖↗↘↙∕∟∣≒≦≧⊿═",35,"▁",6], +["a880","█",7,"▓▔▕▼▽◢◣◤◥☉⊕〒〝〞"], +["a8a1","āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜüêɑ"], +["a8bd","ńň"], +["a8c0","ɡ"], +["a8c5","ㄅ",36], +["a940","〡",8,"㊣㎎㎏㎜㎝㎞㎡㏄㏎㏑㏒㏕︰¬¦"], +["a959","℡㈱"], +["a95c","‐"], +["a960","ー゛゜ヽヾ〆ゝゞ﹉",9,"﹔﹕﹖﹗﹙",8], +["a980","﹢",4,"﹨﹩﹪﹫"], +["a996","〇"], +["a9a4","─",75], +["aa40","狜狝狟狢",5,"狪狫狵狶狹狽狾狿猀猂猄",5,"猋猌猍猏猐猑猒猔猘猙猚猟猠猣猤猦猧猨猭猯猰猲猳猵猶猺猻猼猽獀",8], +["aa80","獉獊獋獌獎獏獑獓獔獕獖獘",7,"獡",10,"獮獰獱"], +["ab40","獲",11,"獿",4,"玅玆玈玊玌玍玏玐玒玓玔玕玗玘玙玚玜玝玞玠玡玣",5,"玪玬玭玱玴玵玶玸玹玼玽玾玿珁珃",4], +["ab80","珋珌珎珒",6,"珚珛珜珝珟珡珢珣珤珦珨珪珫珬珮珯珰珱珳",4], +["ac40","珸",10,"琄琇琈琋琌琍琎琑",8,"琜",5,"琣琤琧琩琫琭琯琱琲琷",4,"琽琾琿瑀瑂",11], +["ac80","瑎",6,"瑖瑘瑝瑠",12,"瑮瑯瑱",4,"瑸瑹瑺"], +["ad40","瑻瑼瑽瑿璂璄璅璆璈璉璊璌璍璏璑",10,"璝璟",7,"璪",15,"璻",12], +["ad80","瓈",9,"瓓",8,"瓝瓟瓡瓥瓧",6,"瓰瓱瓲"], +["ae40","瓳瓵瓸",6,"甀甁甂甃甅",7,"甎甐甒甔甕甖甗甛甝甞甠",4,"甦甧甪甮甴甶甹甼甽甿畁畂畃畄畆畇畉畊畍畐畑畒畓畕畖畗畘"], +["ae80","畝",7,"畧畨畩畫",6,"畳畵當畷畺",4,"疀疁疂疄疅疇"], +["af40","疈疉疊疌疍疎疐疓疕疘疛疜疞疢疦",4,"疭疶疷疺疻疿痀痁痆痋痌痎痏痐痑痓痗痙痚痜痝痟痠痡痥痩痬痭痮痯痲痳痵痶痷痸痺痻痽痾瘂瘄瘆瘇"], +["af80","瘈瘉瘋瘍瘎瘏瘑瘒瘓瘔瘖瘚瘜瘝瘞瘡瘣瘧瘨瘬瘮瘯瘱瘲瘶瘷瘹瘺瘻瘽癁療癄"], +["b040","癅",6,"癎",5,"癕癗",4,"癝癟癠癡癢癤",6,"癬癭癮癰",7,"癹発發癿皀皁皃皅皉皊皌皍皏皐皒皔皕皗皘皚皛"], +["b080","皜",7,"皥",8,"皯皰皳皵",9,"盀盁盃啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺案肮昂盎凹敖熬翱袄傲奥懊澳芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸白柏百摆佰败拜稗斑班搬扳般颁板版扮拌伴瓣半办绊邦帮梆榜膀绑棒磅蚌镑傍谤苞胞包褒剥"], +["b140","盄盇盉盋盌盓盕盙盚盜盝盞盠",4,"盦",7,"盰盳盵盶盷盺盻盽盿眀眂眃眅眆眊県眎",10,"眛眜眝眞眡眣眤眥眧眪眫"], +["b180","眬眮眰",4,"眹眻眽眾眿睂睄睅睆睈",7,"睒",7,"睜薄雹保堡饱宝抱报暴豹鲍爆杯碑悲卑北辈背贝钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛鞭边编贬扁便变卞辨辩辫遍标彪膘表鳖憋别瘪彬斌濒滨宾摈兵冰柄丙秉饼炳"], +["b240","睝睞睟睠睤睧睩睪睭",11,"睺睻睼瞁瞂瞃瞆",5,"瞏瞐瞓",11,"瞡瞣瞤瞦瞨瞫瞭瞮瞯瞱瞲瞴瞶",4], +["b280","瞼瞾矀",12,"矎",8,"矘矙矚矝",4,"矤病并玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳捕卜哺补埠不布步簿部怖擦猜裁材才财睬踩采彩菜蔡餐参蚕残惭惨灿苍舱仓沧藏操糙槽曹草厕策侧册测层蹭插叉茬茶查碴搽察岔差诧拆柴豺搀掺蝉馋谗缠铲产阐颤昌猖"], +["b340","矦矨矪矯矰矱矲矴矵矷矹矺矻矼砃",5,"砊砋砎砏砐砓砕砙砛砞砠砡砢砤砨砪砫砮砯砱砲砳砵砶砽砿硁硂硃硄硆硈硉硊硋硍硏硑硓硔硘硙硚"], +["b380","硛硜硞",11,"硯",7,"硸硹硺硻硽",6,"场尝常长偿肠厂敞畅唱倡超抄钞朝嘲潮巢吵炒车扯撤掣彻澈郴臣辰尘晨忱沉陈趁衬撑称城橙成呈乘程惩澄诚承逞骋秤吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽充冲虫崇宠抽酬畴踌稠愁筹仇绸瞅丑臭初出橱厨躇锄雏滁除楚"], +["b440","碄碅碆碈碊碋碏碐碒碔碕碖碙碝碞碠碢碤碦碨",7,"碵碶碷碸確碻碼碽碿磀磂磃磄磆磇磈磌磍磎磏磑磒磓磖磗磘磚",9], +["b480","磤磥磦磧磩磪磫磭",4,"磳磵磶磸磹磻",5,"礂礃礄礆",6,"础储矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤垂春椿醇唇淳纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆从丛凑粗醋簇促蹿篡窜摧崔催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣戴带殆代贷袋待逮"], +["b540","礍",5,"礔",9,"礟",4,"礥",14,"礵",4,"礽礿祂祃祄祅祇祊",8,"祔祕祘祙祡祣"], +["b580","祤祦祩祪祫祬祮祰",6,"祹祻",4,"禂禃禆禇禈禉禋禌禍禎禐禑禒怠耽担丹单郸掸胆旦氮但惮淡诞弹蛋当挡党荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳邓堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼雕凋刁掉吊钓调跌爹碟蝶迭谍叠"], +["b640","禓",6,"禛",11,"禨",10,"禴",4,"禼禿秂秄秅秇秈秊秌秎秏秐秓秔秖秗秙",5,"秠秡秢秥秨秪"], +["b680","秬秮秱",6,"秹秺秼秾秿稁稄稅稇稈稉稊稌稏",4,"稕稖稘稙稛稜丁盯叮钉顶鼎锭定订丢东冬董懂动栋侗恫冻洞兜抖斗陡豆逗痘都督毒犊独读堵睹赌杜镀肚度渡妒端短锻段断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅俄额讹娥恶厄扼遏鄂饿恩而儿耳尔饵洱二"], +["b740","稝稟稡稢稤",14,"稴稵稶稸稺稾穀",5,"穇",9,"穒",4,"穘",16], +["b780","穩",6,"穱穲穳穵穻穼穽穾窂窅窇窉窊窋窌窎窏窐窓窔窙窚窛窞窡窢贰发罚筏伐乏阀法珐藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛坊芳方肪房防妨仿访纺放菲非啡飞肥匪诽吠肺废沸费芬酚吩氛分纷坟焚汾粉奋份忿愤粪丰封枫蜂峰锋风疯烽逢冯缝讽奉凤佛否夫敷肤孵扶拂辐幅氟符伏俘服"], +["b840","窣窤窧窩窪窫窮",4,"窴",10,"竀",10,"竌",9,"竗竘竚竛竜竝竡竢竤竧",5,"竮竰竱竲竳"], +["b880","竴",4,"竻竼竾笀笁笂笅笇笉笌笍笎笐笒笓笖笗笘笚笜笝笟笡笢笣笧笩笭浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐噶嘎该改概钙盖溉干甘杆柑竿肝赶感秆敢赣冈刚钢缸肛纲岗港杠篙皋高膏羔糕搞镐稿告哥歌搁戈鸽胳疙割革葛格蛤阁隔铬个各给根跟耕更庚羹"], +["b940","笯笰笲笴笵笶笷笹笻笽笿",5,"筆筈筊筍筎筓筕筗筙筜筞筟筡筣",10,"筯筰筳筴筶筸筺筼筽筿箁箂箃箄箆",6,"箎箏"], +["b980","箑箒箓箖箘箙箚箛箞箟箠箣箤箥箮箯箰箲箳箵箶箷箹",7,"篂篃範埂耿梗工攻功恭龚供躬公宫弓巩汞拱贡共钩勾沟苟狗垢构购够辜菇咕箍估沽孤姑鼓古蛊骨谷股故顾固雇刮瓜剐寡挂褂乖拐怪棺关官冠观管馆罐惯灌贯光广逛瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽辊滚棍锅郭国果裹过哈"], +["ba40","篅篈築篊篋篍篎篏篐篒篔",4,"篛篜篞篟篠篢篣篤篧篨篩篫篬篭篯篰篲",4,"篸篹篺篻篽篿",7,"簈簉簊簍簎簐",5,"簗簘簙"], +["ba80","簚",4,"簠",5,"簨簩簫",12,"簹",5,"籂骸孩海氦亥害骇酣憨邯韩含涵寒函喊罕翰撼捍旱憾悍焊汗汉夯杭航壕嚎豪毫郝好耗号浩呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺嘿黑痕很狠恨哼亨横衡恒轰哄烘虹鸿洪宏弘红喉侯猴吼厚候后呼乎忽瑚壶葫胡蝴狐糊湖"], +["bb40","籃",9,"籎",36,"籵",5,"籾",9], +["bb80","粈粊",6,"粓粔粖粙粚粛粠粡粣粦粧粨粩粫粬粭粯粰粴",4,"粺粻弧虎唬护互沪户花哗华猾滑画划化话槐徊怀淮坏欢环桓还缓换患唤痪豢焕涣宦幻荒慌黄磺蝗簧皇凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑霍货祸击圾基机畸稽积箕"], +["bc40","粿糀糂糃糄糆糉糋糎",6,"糘糚糛糝糞糡",6,"糩",5,"糰",7,"糹糺糼",13,"紋",5], +["bc80","紑",14,"紡紣紤紥紦紨紩紪紬紭紮細",6,"肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件"], +["bd40","紷",54,"絯",7], +["bd80","絸",32,"健舰剑饯渐溅涧建僵姜将浆江疆蒋桨奖讲匠酱降蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸"], +["be40","継",12,"綧",6,"綯",42], +["be80","線",32,"尽劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎就疚鞠拘狙疽居驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻"], +["bf40","緻",62], +["bf80","縺縼",4,"繂",4,"繈",21,"俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看康慷糠扛抗亢炕考拷烤靠坷苛柯棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭空恐孔控抠口扣寇枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款匡筐狂框矿眶旷况亏盔岿窥葵奎魁傀"], +["c040","繞",35,"纃",23,"纜纝纞"], +["c080","纮纴纻纼绖绤绬绹缊缐缞缷缹缻",6,"罃罆",9,"罒罓馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊辣啦莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊郎朗浪捞劳牢老佬姥酪烙涝勒乐雷镭蕾磊累儡垒擂肋类泪棱楞冷厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐"], +["c140","罖罙罛罜罝罞罠罣",4,"罫罬罭罯罰罳罵罶罷罸罺罻罼罽罿羀羂",7,"羋羍羏",4,"羕",4,"羛羜羠羢羣羥羦羨",6,"羱"], +["c180","羳",4,"羺羻羾翀翂翃翄翆翇翈翉翋翍翏",4,"翖翗翙",5,"翢翣痢立粒沥隶力璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉梁粱良两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣廖料列裂烈劣猎琳林磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚凌灵陵岭领另令溜琉榴硫馏留刘瘤流柳六龙聋咙笼窿"], +["c240","翤翧翨翪翫翬翭翯翲翴",6,"翽翾翿耂耇耈耉耊耎耏耑耓耚耛耝耞耟耡耣耤耫",5,"耲耴耹耺耼耾聀聁聄聅聇聈聉聎聏聐聑聓聕聖聗"], +["c280","聙聛",13,"聫",5,"聲",11,"隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮驴吕铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落洛骆络妈麻玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓曼慢漫"], +["c340","聾肁肂肅肈肊肍",5,"肔肕肗肙肞肣肦肧肨肬肰肳肵肶肸肹肻胅胇",4,"胏",6,"胘胟胠胢胣胦胮胵胷胹胻胾胿脀脁脃脄脅脇脈脋"], +["c380","脌脕脗脙脛脜脝脟",12,"脭脮脰脳脴脵脷脹",4,"脿谩芒茫盲氓忙莽猫茅锚毛矛铆卯茂冒帽貌贸么玫枚梅酶霉煤没眉媒镁每美昧寐妹媚门闷们萌蒙檬盟锰猛梦孟眯醚靡糜迷谜弥米秘觅泌蜜密幂棉眠绵冕免勉娩缅面苗描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽明螟鸣铭名命谬摸"], +["c440","腀",5,"腇腉腍腎腏腒腖腗腘腛",4,"腡腢腣腤腦腨腪腫腬腯腲腳腵腶腷腸膁膃",4,"膉膋膌膍膎膐膒",5,"膙膚膞",4,"膤膥"], +["c480","膧膩膫",7,"膴",5,"膼膽膾膿臄臅臇臈臉臋臍",6,"摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谋牟某拇牡亩姆母墓暮幕募慕木目睦牧穆拿哪呐钠那娜纳氖乃奶耐奈南男难囊挠脑恼闹淖呢馁内嫩能妮霓倪泥尼拟你匿腻逆溺蔫拈年碾撵捻念娘酿鸟尿捏聂孽啮镊镍涅您柠狞凝宁"], +["c540","臔",14,"臤臥臦臨臩臫臮",4,"臵",5,"臽臿舃與",4,"舎舏舑舓舕",5,"舝舠舤舥舦舧舩舮舲舺舼舽舿"], +["c580","艀艁艂艃艅艆艈艊艌艍艎艐",7,"艙艛艜艝艞艠",7,"艩拧泞牛扭钮纽脓浓农弄奴努怒女暖虐疟挪懦糯诺哦欧鸥殴藕呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀潘盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培裴赔陪配佩沛喷盆砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗"], +["c640","艪艫艬艭艱艵艶艷艸艻艼芀芁芃芅芆芇芉芌芐芓芔芕芖芚芛芞芠芢芣芧芲芵芶芺芻芼芿苀苂苃苅苆苉苐苖苙苚苝苢苧苨苩苪苬苭苮苰苲苳苵苶苸"], +["c680","苺苼",4,"茊茋茍茐茒茓茖茘茙茝",9,"茩茪茮茰茲茷茻茽啤脾疲皮匹痞僻屁譬篇偏片骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍平凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣讫掐"], +["c740","茾茿荁荂荄荅荈荊",4,"荓荕",4,"荝荢荰",6,"荹荺荾",6,"莇莈莊莋莌莍莏莐莑莔莕莖莗莙莚莝莟莡",6,"莬莭莮"], +["c780","莯莵莻莾莿菂菃菄菆菈菉菋菍菎菐菑菒菓菕菗菙菚菛菞菢菣菤菦菧菨菫菬菭恰洽牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷强抢橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍切茄且怯窃钦侵亲秦琴勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷秋丘邱球求囚酋泅趋区蛆曲躯屈驱渠"], +["c840","菮華菳",4,"菺菻菼菾菿萀萂萅萇萈萉萊萐萒",5,"萙萚萛萞",5,"萩",7,"萲",5,"萹萺萻萾",7,"葇葈葉"], +["c880","葊",6,"葒",4,"葘葝葞葟葠葢葤",4,"葪葮葯葰葲葴葷葹葻葼取娶龋趣去圈颧权醛泉全痊拳犬券劝缺炔瘸却鹊榷确雀裙群然燃冉染瓤壤攘嚷让饶扰绕惹热壬仁人忍韧任认刃妊纫扔仍日戎茸蓉荣融熔溶容绒冗揉柔肉茹蠕儒孺如辱乳汝入褥软阮蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁"], +["c940","葽",4,"蒃蒄蒅蒆蒊蒍蒏",7,"蒘蒚蒛蒝蒞蒟蒠蒢",12,"蒰蒱蒳蒵蒶蒷蒻蒼蒾蓀蓂蓃蓅蓆蓇蓈蓋蓌蓎蓏蓒蓔蓕蓗"], +["c980","蓘",4,"蓞蓡蓢蓤蓧",4,"蓭蓮蓯蓱",10,"蓽蓾蔀蔁蔂伞散桑嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹沙纱傻啥煞筛晒珊苫杉山删煽衫闪陕擅赡膳善汕扇缮墒伤商赏晌上尚裳梢捎稍烧芍勺韶少哨邵绍奢赊蛇舌舍赦摄射慑涉社设砷申呻伸身深娠绅神沈审婶甚肾慎渗声生甥牲升绳"], +["ca40","蔃",8,"蔍蔎蔏蔐蔒蔔蔕蔖蔘蔙蔛蔜蔝蔞蔠蔢",8,"蔭",9,"蔾",4,"蕄蕅蕆蕇蕋",10], +["ca80","蕗蕘蕚蕛蕜蕝蕟",4,"蕥蕦蕧蕩",8,"蕳蕵蕶蕷蕸蕼蕽蕿薀薁省盛剩胜圣师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试收手首守寿授售受瘦兽蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱"], +["cb40","薂薃薆薈",6,"薐",10,"薝",6,"薥薦薧薩薫薬薭薱",5,"薸薺",6,"藂",6,"藊",4,"藑藒"], +["cb80","藔藖",5,"藝",6,"藥藦藧藨藪",14,"恕刷耍摔衰甩帅栓拴霜双爽谁水睡税吮瞬顺舜说硕朔烁斯撕嘶思私司丝死肆寺嗣四伺似饲巳松耸怂颂送宋讼诵搜艘擞嗽苏酥俗素速粟僳塑溯宿诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟孙损笋蓑梭唆缩琐索锁所塌他它她塔"], +["cc40","藹藺藼藽藾蘀",4,"蘆",10,"蘒蘓蘔蘕蘗",15,"蘨蘪",13,"蘹蘺蘻蘽蘾蘿虀"], +["cc80","虁",11,"虒虓處",4,"虛虜虝號虠虡虣",7,"獭挞蹋踏胎苔抬台泰酞太态汰坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭汤塘搪堂棠膛唐糖倘躺淌趟烫掏涛滔绦萄桃逃淘陶讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填田甜恬舔腆挑条迢眺跳贴铁帖厅听烃"], +["cd40","虭虯虰虲",6,"蚃",6,"蚎",4,"蚔蚖",5,"蚞",4,"蚥蚦蚫蚭蚮蚲蚳蚷蚸蚹蚻",4,"蛁蛂蛃蛅蛈蛌蛍蛒蛓蛕蛖蛗蛚蛜"], +["cd80","蛝蛠蛡蛢蛣蛥蛦蛧蛨蛪蛫蛬蛯蛵蛶蛷蛺蛻蛼蛽蛿蜁蜄蜅蜆蜋蜌蜎蜏蜐蜑蜔蜖汀廷停亭庭挺艇通桐酮瞳同铜彤童桶捅筒统痛偷投头透凸秃突图徒途涂屠土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥拓唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完碗挽晚皖惋宛婉万腕汪王亡枉网往旺望忘妄威"], +["ce40","蜙蜛蜝蜟蜠蜤蜦蜧蜨蜪蜫蜬蜭蜯蜰蜲蜳蜵蜶蜸蜹蜺蜼蜽蝀",6,"蝊蝋蝍蝏蝐蝑蝒蝔蝕蝖蝘蝚",5,"蝡蝢蝦",7,"蝯蝱蝲蝳蝵"], +["ce80","蝷蝸蝹蝺蝿螀螁螄螆螇螉螊螌螎",4,"螔螕螖螘",6,"螠",4,"巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫瘟温蚊文闻纹吻稳紊问嗡翁瓮挝蜗涡窝我斡卧握沃巫呜钨乌污诬屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误昔熙析西硒矽晰嘻吸锡牺"], +["cf40","螥螦螧螩螪螮螰螱螲螴螶螷螸螹螻螼螾螿蟁",4,"蟇蟈蟉蟌",4,"蟔",6,"蟜蟝蟞蟟蟡蟢蟣蟤蟦蟧蟨蟩蟫蟬蟭蟯",9], +["cf80","蟺蟻蟼蟽蟿蠀蠁蠂蠄",5,"蠋",7,"蠔蠗蠘蠙蠚蠜",4,"蠣稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦夏吓掀锨先仙鲜纤咸贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象萧硝霄削哮嚣销消宵淆晓"], +["d040","蠤",13,"蠳",5,"蠺蠻蠽蠾蠿衁衂衃衆",5,"衎",5,"衕衖衘衚",6,"衦衧衪衭衯衱衳衴衵衶衸衹衺"], +["d080","衻衼袀袃袆袇袉袊袌袎袏袐袑袓袔袕袗",4,"袝",4,"袣袥",5,"小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑薪芯锌欣辛新忻心信衅星腥猩惺兴刑型形邢行醒幸杏性姓兄凶胸匈汹雄熊休修羞朽嗅锈秀袖绣墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续轩喧宣悬旋玄"], +["d140","袬袮袯袰袲",4,"袸袹袺袻袽袾袿裀裃裄裇裈裊裋裌裍裏裐裑裓裖裗裚",4,"裠裡裦裧裩",6,"裲裵裶裷裺裻製裿褀褁褃",5], +["d180","褉褋",4,"褑褔",4,"褜",4,"褢褣褤褦褧褨褩褬褭褮褯褱褲褳褵褷选癣眩绚靴薛学穴雪血勋熏循旬询寻驯巡殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾邀腰妖瑶"], +["d240","褸",8,"襂襃襅",24,"襠",5,"襧",19,"襼"], +["d280","襽襾覀覂覄覅覇",26,"摇尧遥窑谣姚咬舀药要耀椰噎耶爷野冶也页掖业叶曳腋夜液一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎茵荫因殷音阴姻吟银淫寅饮尹引隐"], +["d340","覢",30,"觃觍觓觔觕觗觘觙觛觝觟觠觡觢觤觧觨觩觪觬觭觮觰觱觲觴",6], +["d380","觻",4,"訁",5,"計",21,"印英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸雍踊蛹咏泳涌永恿勇用幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼迂淤于盂榆虞愚舆余俞逾鱼愉渝渔隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉"], +["d440","訞",31,"訿",8,"詉",21], +["d480","詟",25,"詺",6,"浴寓裕预豫驭鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院曰约越跃钥岳粤月悦阅耘云郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾宰载再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎曾赠扎喳渣札轧"], +["d540","誁",7,"誋",7,"誔",46], +["d580","諃",32,"铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽樟章彰漳张掌涨杖丈帐账仗胀瘴障招昭找沼赵照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真甄砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯正政"], +["d640","諤",34,"謈",27], +["d680","謤謥謧",30,"帧症郑证芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠钟衷终种肿重仲众舟周州洲诌粥轴肘帚咒皱宙昼骤珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑"], +["d740","譆",31,"譧",4,"譭",25], +["d780","讇",24,"讬讱讻诇诐诪谉谞住注祝驻抓爪拽专砖转撰赚篆桩庄装妆撞壮状椎锥追赘坠缀谆准捉拙卓桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓子自渍字鬃棕踪宗综总纵邹走奏揍租足卒族祖诅阻组钻纂嘴醉最罪尊遵昨左佐柞做作坐座"], +["d840","谸",8,"豂豃豄豅豈豊豋豍",7,"豖豗豘豙豛",5,"豣",6,"豬",6,"豴豵豶豷豻",6,"貃貄貆貇"], +["d880","貈貋貍",6,"貕貖貗貙",20,"亍丌兀丐廿卅丕亘丞鬲孬噩丨禺丿匕乇夭爻卮氐囟胤馗毓睾鼗丶亟鼐乜乩亓芈孛啬嘏仄厍厝厣厥厮靥赝匚叵匦匮匾赜卦卣刂刈刎刭刳刿剀剌剞剡剜蒯剽劂劁劐劓冂罔亻仃仉仂仨仡仫仞伛仳伢佤仵伥伧伉伫佞佧攸佚佝"], +["d940","貮",62], +["d980","賭",32,"佟佗伲伽佶佴侑侉侃侏佾佻侪佼侬侔俦俨俪俅俚俣俜俑俟俸倩偌俳倬倏倮倭俾倜倌倥倨偾偃偕偈偎偬偻傥傧傩傺僖儆僭僬僦僮儇儋仝氽佘佥俎龠汆籴兮巽黉馘冁夔勹匍訇匐凫夙兕亠兖亳衮袤亵脔裒禀嬴蠃羸冫冱冽冼"], +["da40","贎",14,"贠赑赒赗赟赥赨赩赪赬赮赯赱赲赸",8,"趂趃趆趇趈趉趌",4,"趒趓趕",9,"趠趡"], +["da80","趢趤",12,"趲趶趷趹趻趽跀跁跂跅跇跈跉跊跍跐跒跓跔凇冖冢冥讠讦讧讪讴讵讷诂诃诋诏诎诒诓诔诖诘诙诜诟诠诤诨诩诮诰诳诶诹诼诿谀谂谄谇谌谏谑谒谔谕谖谙谛谘谝谟谠谡谥谧谪谫谮谯谲谳谵谶卩卺阝阢阡阱阪阽阼陂陉陔陟陧陬陲陴隈隍隗隰邗邛邝邙邬邡邴邳邶邺"], +["db40","跕跘跙跜跠跡跢跥跦跧跩跭跮跰跱跲跴跶跼跾",6,"踆踇踈踋踍踎踐踑踒踓踕",7,"踠踡踤",4,"踫踭踰踲踳踴踶踷踸踻踼踾"], +["db80","踿蹃蹅蹆蹌",4,"蹓",5,"蹚",11,"蹧蹨蹪蹫蹮蹱邸邰郏郅邾郐郄郇郓郦郢郜郗郛郫郯郾鄄鄢鄞鄣鄱鄯鄹酃酆刍奂劢劬劭劾哿勐勖勰叟燮矍廴凵凼鬯厶弁畚巯坌垩垡塾墼壅壑圩圬圪圳圹圮圯坜圻坂坩垅坫垆坼坻坨坭坶坳垭垤垌垲埏垧垴垓垠埕埘埚埙埒垸埴埯埸埤埝"], +["dc40","蹳蹵蹷",4,"蹽蹾躀躂躃躄躆躈",6,"躑躒躓躕",6,"躝躟",11,"躭躮躰躱躳",6,"躻",7], +["dc80","軃",10,"軏",21,"堋堍埽埭堀堞堙塄堠塥塬墁墉墚墀馨鼙懿艹艽艿芏芊芨芄芎芑芗芙芫芸芾芰苈苊苣芘芷芮苋苌苁芩芴芡芪芟苄苎芤苡茉苷苤茏茇苜苴苒苘茌苻苓茑茚茆茔茕苠苕茜荑荛荜茈莒茼茴茱莛荞茯荏荇荃荟荀茗荠茭茺茳荦荥"], +["dd40","軥",62], +["dd80","輤",32,"荨茛荩荬荪荭荮莰荸莳莴莠莪莓莜莅荼莶莩荽莸荻莘莞莨莺莼菁萁菥菘堇萘萋菝菽菖萜萸萑萆菔菟萏萃菸菹菪菅菀萦菰菡葜葑葚葙葳蒇蒈葺蒉葸萼葆葩葶蒌蒎萱葭蓁蓍蓐蓦蒽蓓蓊蒿蒺蓠蒡蒹蒴蒗蓥蓣蔌甍蔸蓰蔹蔟蔺"], +["de40","轅",32,"轪辀辌辒辝辠辡辢辤辥辦辧辪辬辭辮辯農辳辴辵辷辸辺辻込辿迀迃迆"], +["de80","迉",4,"迏迒迖迗迚迠迡迣迧迬迯迱迲迴迵迶迺迻迼迾迿逇逈逌逎逓逕逘蕖蔻蓿蓼蕙蕈蕨蕤蕞蕺瞢蕃蕲蕻薤薨薇薏蕹薮薜薅薹薷薰藓藁藜藿蘧蘅蘩蘖蘼廾弈夼奁耷奕奚奘匏尢尥尬尴扌扪抟抻拊拚拗拮挢拶挹捋捃掭揶捱捺掎掴捭掬掊捩掮掼揲揸揠揿揄揞揎摒揆掾摅摁搋搛搠搌搦搡摞撄摭撖"], +["df40","這逜連逤逥逧",5,"逰",4,"逷逹逺逽逿遀遃遅遆遈",4,"過達違遖遙遚遜",5,"遤遦遧適遪遫遬遯",4,"遶",6,"遾邁"], +["df80","還邅邆邇邉邊邌",4,"邒邔邖邘邚邜邞邟邠邤邥邧邨邩邫邭邲邷邼邽邿郀摺撷撸撙撺擀擐擗擤擢攉攥攮弋忒甙弑卟叱叽叩叨叻吒吖吆呋呒呓呔呖呃吡呗呙吣吲咂咔呷呱呤咚咛咄呶呦咝哐咭哂咴哒咧咦哓哔呲咣哕咻咿哌哙哚哜咩咪咤哝哏哞唛哧唠哽唔哳唢唣唏唑唧唪啧喏喵啉啭啁啕唿啐唼"], +["e040","郂郃郆郈郉郋郌郍郒郔郕郖郘郙郚郞郟郠郣郤郥郩郪郬郮郰郱郲郳郵郶郷郹郺郻郼郿鄀鄁鄃鄅",19,"鄚鄛鄜"], +["e080","鄝鄟鄠鄡鄤",10,"鄰鄲",6,"鄺",8,"酄唷啖啵啶啷唳唰啜喋嗒喃喱喹喈喁喟啾嗖喑啻嗟喽喾喔喙嗪嗷嗉嘟嗑嗫嗬嗔嗦嗝嗄嗯嗥嗲嗳嗌嗍嗨嗵嗤辔嘞嘈嘌嘁嘤嘣嗾嘀嘧嘭噘嘹噗嘬噍噢噙噜噌噔嚆噤噱噫噻噼嚅嚓嚯囔囗囝囡囵囫囹囿圄圊圉圜帏帙帔帑帱帻帼"], +["e140","酅酇酈酑酓酔酕酖酘酙酛酜酟酠酦酧酨酫酭酳酺酻酼醀",4,"醆醈醊醎醏醓",6,"醜",5,"醤",5,"醫醬醰醱醲醳醶醷醸醹醻"], +["e180","醼",10,"釈釋釐釒",9,"針",8,"帷幄幔幛幞幡岌屺岍岐岖岈岘岙岑岚岜岵岢岽岬岫岱岣峁岷峄峒峤峋峥崂崃崧崦崮崤崞崆崛嵘崾崴崽嵬嵛嵯嵝嵫嵋嵊嵩嵴嶂嶙嶝豳嶷巅彳彷徂徇徉後徕徙徜徨徭徵徼衢彡犭犰犴犷犸狃狁狎狍狒狨狯狩狲狴狷猁狳猃狺"], +["e240","釦",62], +["e280","鈥",32,"狻猗猓猡猊猞猝猕猢猹猥猬猸猱獐獍獗獠獬獯獾舛夥飧夤夂饣饧",5,"饴饷饽馀馄馇馊馍馐馑馓馔馕庀庑庋庖庥庠庹庵庾庳赓廒廑廛廨廪膺忄忉忖忏怃忮怄忡忤忾怅怆忪忭忸怙怵怦怛怏怍怩怫怊怿怡恸恹恻恺恂"], +["e340","鉆",45,"鉵",16], +["e380","銆",7,"銏",24,"恪恽悖悚悭悝悃悒悌悛惬悻悱惝惘惆惚悴愠愦愕愣惴愀愎愫慊慵憬憔憧憷懔懵忝隳闩闫闱闳闵闶闼闾阃阄阆阈阊阋阌阍阏阒阕阖阗阙阚丬爿戕氵汔汜汊沣沅沐沔沌汨汩汴汶沆沩泐泔沭泷泸泱泗沲泠泖泺泫泮沱泓泯泾"], +["e440","銨",5,"銯",24,"鋉",31], +["e480","鋩",32,"洹洧洌浃浈洇洄洙洎洫浍洮洵洚浏浒浔洳涑浯涞涠浞涓涔浜浠浼浣渚淇淅淞渎涿淠渑淦淝淙渖涫渌涮渫湮湎湫溲湟溆湓湔渲渥湄滟溱溘滠漭滢溥溧溽溻溷滗溴滏溏滂溟潢潆潇漤漕滹漯漶潋潴漪漉漩澉澍澌潸潲潼潺濑"], +["e540","錊",51,"錿",10], +["e580","鍊",31,"鍫濉澧澹澶濂濡濮濞濠濯瀚瀣瀛瀹瀵灏灞宀宄宕宓宥宸甯骞搴寤寮褰寰蹇謇辶迓迕迥迮迤迩迦迳迨逅逄逋逦逑逍逖逡逵逶逭逯遄遑遒遐遨遘遢遛暹遴遽邂邈邃邋彐彗彖彘尻咫屐屙孱屣屦羼弪弩弭艴弼鬻屮妁妃妍妩妪妣"], +["e640","鍬",34,"鎐",27], +["e680","鎬",29,"鏋鏌鏍妗姊妫妞妤姒妲妯姗妾娅娆姝娈姣姘姹娌娉娲娴娑娣娓婀婧婊婕娼婢婵胬媪媛婷婺媾嫫媲嫒嫔媸嫠嫣嫱嫖嫦嫘嫜嬉嬗嬖嬲嬷孀尕尜孚孥孳孑孓孢驵驷驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟纡纣纥纨纩"], +["e740","鏎",7,"鏗",54], +["e780","鐎",32,"纭纰纾绀绁绂绉绋绌绐绔绗绛绠绡绨绫绮绯绱绲缍绶绺绻绾缁缂缃缇缈缋缌缏缑缒缗缙缜缛缟缡",6,"缪缫缬缭缯",4,"缵幺畿巛甾邕玎玑玮玢玟珏珂珑玷玳珀珉珈珥珙顼琊珩珧珞玺珲琏琪瑛琦琥琨琰琮琬"], +["e840","鐯",14,"鐿",43,"鑬鑭鑮鑯"], +["e880","鑰",20,"钑钖钘铇铏铓铔铚铦铻锜锠琛琚瑁瑜瑗瑕瑙瑷瑭瑾璜璎璀璁璇璋璞璨璩璐璧瓒璺韪韫韬杌杓杞杈杩枥枇杪杳枘枧杵枨枞枭枋杷杼柰栉柘栊柩枰栌柙枵柚枳柝栀柃枸柢栎柁柽栲栳桠桡桎桢桄桤梃栝桕桦桁桧桀栾桊桉栩梵梏桴桷梓桫棂楮棼椟椠棹"], +["e940","锧锳锽镃镈镋镕镚镠镮镴镵長",7,"門",42], +["e980","閫",32,"椤棰椋椁楗棣椐楱椹楠楂楝榄楫榀榘楸椴槌榇榈槎榉楦楣楹榛榧榻榫榭槔榱槁槊槟榕槠榍槿樯槭樗樘橥槲橄樾檠橐橛樵檎橹樽樨橘橼檑檐檩檗檫猷獒殁殂殇殄殒殓殍殚殛殡殪轫轭轱轲轳轵轶轸轷轹轺轼轾辁辂辄辇辋"], +["ea40","闌",27,"闬闿阇阓阘阛阞阠阣",6,"阫阬阭阯阰阷阸阹阺阾陁陃陊陎陏陑陒陓陖陗"], +["ea80","陘陙陚陜陝陞陠陣陥陦陫陭",4,"陳陸",12,"隇隉隊辍辎辏辘辚軎戋戗戛戟戢戡戥戤戬臧瓯瓴瓿甏甑甓攴旮旯旰昊昙杲昃昕昀炅曷昝昴昱昶昵耆晟晔晁晏晖晡晗晷暄暌暧暝暾曛曜曦曩贲贳贶贻贽赀赅赆赈赉赇赍赕赙觇觊觋觌觎觏觐觑牮犟牝牦牯牾牿犄犋犍犏犒挈挲掰"], +["eb40","隌階隑隒隓隕隖隚際隝",9,"隨",7,"隱隲隴隵隷隸隺隻隿雂雃雈雊雋雐雑雓雔雖",9,"雡",6,"雫"], +["eb80","雬雭雮雰雱雲雴雵雸雺電雼雽雿霂霃霅霊霋霌霐霑霒霔霕霗",4,"霝霟霠搿擘耄毪毳毽毵毹氅氇氆氍氕氘氙氚氡氩氤氪氲攵敕敫牍牒牖爰虢刖肟肜肓肼朊肽肱肫肭肴肷胧胨胩胪胛胂胄胙胍胗朐胝胫胱胴胭脍脎胲胼朕脒豚脶脞脬脘脲腈腌腓腴腙腚腱腠腩腼腽腭腧塍媵膈膂膑滕膣膪臌朦臊膻"], +["ec40","霡",8,"霫霬霮霯霱霳",4,"霺霻霼霽霿",18,"靔靕靗靘靚靜靝靟靣靤靦靧靨靪",7], +["ec80","靲靵靷",4,"靽",7,"鞆",4,"鞌鞎鞏鞐鞓鞕鞖鞗鞙",4,"臁膦欤欷欹歃歆歙飑飒飓飕飙飚殳彀毂觳斐齑斓於旆旄旃旌旎旒旖炀炜炖炝炻烀炷炫炱烨烊焐焓焖焯焱煳煜煨煅煲煊煸煺熘熳熵熨熠燠燔燧燹爝爨灬焘煦熹戾戽扃扈扉礻祀祆祉祛祜祓祚祢祗祠祯祧祺禅禊禚禧禳忑忐"], +["ed40","鞞鞟鞡鞢鞤",6,"鞬鞮鞰鞱鞳鞵",46], +["ed80","韤韥韨韮",4,"韴韷",23,"怼恝恚恧恁恙恣悫愆愍慝憩憝懋懑戆肀聿沓泶淼矶矸砀砉砗砘砑斫砭砜砝砹砺砻砟砼砥砬砣砩硎硭硖硗砦硐硇硌硪碛碓碚碇碜碡碣碲碹碥磔磙磉磬磲礅磴礓礤礞礴龛黹黻黼盱眄眍盹眇眈眚眢眙眭眦眵眸睐睑睇睃睚睨"], +["ee40","頏",62], +["ee80","顎",32,"睢睥睿瞍睽瞀瞌瞑瞟瞠瞰瞵瞽町畀畎畋畈畛畲畹疃罘罡罟詈罨罴罱罹羁罾盍盥蠲钅钆钇钋钊钌钍钏钐钔钗钕钚钛钜钣钤钫钪钭钬钯钰钲钴钶",4,"钼钽钿铄铈",6,"铐铑铒铕铖铗铙铘铛铞铟铠铢铤铥铧铨铪"], +["ef40","顯",5,"颋颎颒颕颙颣風",37,"飏飐飔飖飗飛飜飝飠",4], +["ef80","飥飦飩",30,"铩铫铮铯铳铴铵铷铹铼铽铿锃锂锆锇锉锊锍锎锏锒",4,"锘锛锝锞锟锢锪锫锩锬锱锲锴锶锷锸锼锾锿镂锵镄镅镆镉镌镎镏镒镓镔镖镗镘镙镛镞镟镝镡镢镤",8,"镯镱镲镳锺矧矬雉秕秭秣秫稆嵇稃稂稞稔"], +["f040","餈",4,"餎餏餑",28,"餯",26], +["f080","饊",9,"饖",12,"饤饦饳饸饹饻饾馂馃馉稹稷穑黏馥穰皈皎皓皙皤瓞瓠甬鸠鸢鸨",4,"鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦",6,"鹱鹭鹳疒疔疖疠疝疬疣疳疴疸痄疱疰痃痂痖痍痣痨痦痤痫痧瘃痱痼痿瘐瘀瘅瘌瘗瘊瘥瘘瘕瘙"], +["f140","馌馎馚",10,"馦馧馩",47], +["f180","駙",32,"瘛瘼瘢瘠癀瘭瘰瘿瘵癃瘾瘳癍癞癔癜癖癫癯翊竦穸穹窀窆窈窕窦窠窬窨窭窳衤衩衲衽衿袂袢裆袷袼裉裢裎裣裥裱褚裼裨裾裰褡褙褓褛褊褴褫褶襁襦襻疋胥皲皴矜耒耔耖耜耠耢耥耦耧耩耨耱耋耵聃聆聍聒聩聱覃顸颀颃"], +["f240","駺",62], +["f280","騹",32,"颉颌颍颏颔颚颛颞颟颡颢颥颦虍虔虬虮虿虺虼虻蚨蚍蚋蚬蚝蚧蚣蚪蚓蚩蚶蛄蚵蛎蚰蚺蚱蚯蛉蛏蚴蛩蛱蛲蛭蛳蛐蜓蛞蛴蛟蛘蛑蜃蜇蛸蜈蜊蜍蜉蜣蜻蜞蜥蜮蜚蜾蝈蜴蜱蜩蜷蜿螂蜢蝽蝾蝻蝠蝰蝌蝮螋蝓蝣蝼蝤蝙蝥螓螯螨蟒"], +["f340","驚",17,"驲骃骉骍骎骔骕骙骦骩",6,"骲骳骴骵骹骻骽骾骿髃髄髆",4,"髍髎髏髐髒體髕髖髗髙髚髛髜"], +["f380","髝髞髠髢髣髤髥髧髨髩髪髬髮髰",8,"髺髼",6,"鬄鬅鬆蟆螈螅螭螗螃螫蟥螬螵螳蟋蟓螽蟑蟀蟊蟛蟪蟠蟮蠖蠓蟾蠊蠛蠡蠹蠼缶罂罄罅舐竺竽笈笃笄笕笊笫笏筇笸笪笙笮笱笠笥笤笳笾笞筘筚筅筵筌筝筠筮筻筢筲筱箐箦箧箸箬箝箨箅箪箜箢箫箴篑篁篌篝篚篥篦篪簌篾篼簏簖簋"], +["f440","鬇鬉",5,"鬐鬑鬒鬔",10,"鬠鬡鬢鬤",10,"鬰鬱鬳",7,"鬽鬾鬿魀魆魊魋魌魎魐魒魓魕",5], +["f480","魛",32,"簟簪簦簸籁籀臾舁舂舄臬衄舡舢舣舭舯舨舫舸舻舳舴舾艄艉艋艏艚艟艨衾袅袈裘裟襞羝羟羧羯羰羲籼敉粑粝粜粞粢粲粼粽糁糇糌糍糈糅糗糨艮暨羿翎翕翥翡翦翩翮翳糸絷綦綮繇纛麸麴赳趄趔趑趱赧赭豇豉酊酐酎酏酤"], +["f540","魼",62], +["f580","鮻",32,"酢酡酰酩酯酽酾酲酴酹醌醅醐醍醑醢醣醪醭醮醯醵醴醺豕鹾趸跫踅蹙蹩趵趿趼趺跄跖跗跚跞跎跏跛跆跬跷跸跣跹跻跤踉跽踔踝踟踬踮踣踯踺蹀踹踵踽踱蹉蹁蹂蹑蹒蹊蹰蹶蹼蹯蹴躅躏躔躐躜躞豸貂貊貅貘貔斛觖觞觚觜"], +["f640","鯜",62], +["f680","鰛",32,"觥觫觯訾謦靓雩雳雯霆霁霈霏霎霪霭霰霾龀龃龅",5,"龌黾鼋鼍隹隼隽雎雒瞿雠銎銮鋈錾鍪鏊鎏鐾鑫鱿鲂鲅鲆鲇鲈稣鲋鲎鲐鲑鲒鲔鲕鲚鲛鲞",5,"鲥",4,"鲫鲭鲮鲰",7,"鲺鲻鲼鲽鳄鳅鳆鳇鳊鳋"], +["f740","鰼",62], +["f780","鱻鱽鱾鲀鲃鲄鲉鲊鲌鲏鲓鲖鲗鲘鲙鲝鲪鲬鲯鲹鲾",4,"鳈鳉鳑鳒鳚鳛鳠鳡鳌",4,"鳓鳔鳕鳗鳘鳙鳜鳝鳟鳢靼鞅鞑鞒鞔鞯鞫鞣鞲鞴骱骰骷鹘骶骺骼髁髀髅髂髋髌髑魅魃魇魉魈魍魑飨餍餮饕饔髟髡髦髯髫髻髭髹鬈鬏鬓鬟鬣麽麾縻麂麇麈麋麒鏖麝麟黛黜黝黠黟黢黩黧黥黪黯鼢鼬鼯鼹鼷鼽鼾齄"], +["f840","鳣",62], +["f880","鴢",32], +["f940","鵃",62], +["f980","鶂",32], +["fa40","鶣",62], +["fa80","鷢",32], +["fb40","鸃",27,"鸤鸧鸮鸰鸴鸻鸼鹀鹍鹐鹒鹓鹔鹖鹙鹝鹟鹠鹡鹢鹥鹮鹯鹲鹴",9,"麀"], +["fb80","麁麃麄麅麆麉麊麌",5,"麔",8,"麞麠",5,"麧麨麩麪"], +["fc40","麫",8,"麵麶麷麹麺麼麿",4,"黅黆黇黈黊黋黌黐黒黓黕黖黗黙黚點黡黣黤黦黨黫黬黭黮黰",8,"黺黽黿",6], +["fc80","鼆",4,"鼌鼏鼑鼒鼔鼕鼖鼘鼚",5,"鼡鼣",8,"鼭鼮鼰鼱"], +["fd40","鼲",4,"鼸鼺鼼鼿",4,"齅",10,"齒",38], +["fd80","齹",5,"龁龂龍",11,"龜龝龞龡",4,"郎凉秊裏隣"], +["fe40","兀嗀﨎﨏﨑﨓﨔礼﨟蘒﨡﨣﨤﨧﨨﨩"] +] diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/tables/cp949.json b/node_modules/npm/node_modules/iconv-lite/encodings/tables/cp949.json new file mode 100644 index 00000000..2022a007 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/tables/cp949.json @@ -0,0 +1,273 @@ +[ +["0","\u0000",127], +["8141","갂갃갅갆갋",4,"갘갞갟갡갢갣갥",6,"갮갲갳갴"], +["8161","갵갶갷갺갻갽갾갿걁",9,"걌걎",5,"걕"], +["8181","걖걗걙걚걛걝",18,"걲걳걵걶걹걻",4,"겂겇겈겍겎겏겑겒겓겕",6,"겞겢",5,"겫겭겮겱",6,"겺겾겿곀곂곃곅곆곇곉곊곋곍",7,"곖곘",7,"곢곣곥곦곩곫곭곮곲곴곷",4,"곾곿괁괂괃괅괇",4,"괎괐괒괓"], +["8241","괔괕괖괗괙괚괛괝괞괟괡",7,"괪괫괮",5], +["8261","괶괷괹괺괻괽",6,"굆굈굊",5,"굑굒굓굕굖굗"], +["8281","굙",7,"굢굤",7,"굮굯굱굲굷굸굹굺굾궀궃",4,"궊궋궍궎궏궑",10,"궞",5,"궥",17,"궸",7,"귂귃귅귆귇귉",6,"귒귔",7,"귝귞귟귡귢귣귥",18], +["8341","귺귻귽귾긂",5,"긊긌긎",5,"긕",7], +["8361","긝",18,"긲긳긵긶긹긻긼"], +["8381","긽긾긿깂깄깇깈깉깋깏깑깒깓깕깗",4,"깞깢깣깤깦깧깪깫깭깮깯깱",6,"깺깾",5,"꺆",5,"꺍",46,"꺿껁껂껃껅",6,"껎껒",5,"껚껛껝",8], +["8441","껦껧껩껪껬껮",5,"껵껶껷껹껺껻껽",8], +["8461","꼆꼉꼊꼋꼌꼎꼏꼑",18], +["8481","꼤",7,"꼮꼯꼱꼳꼵",6,"꼾꽀꽄꽅꽆꽇꽊",5,"꽑",10,"꽞",5,"꽦",18,"꽺",5,"꾁꾂꾃꾅꾆꾇꾉",6,"꾒꾓꾔꾖",5,"꾝",26,"꾺꾻꾽꾾"], +["8541","꾿꿁",5,"꿊꿌꿏",4,"꿕",6,"꿝",4], +["8561","꿢",5,"꿪",5,"꿲꿳꿵꿶꿷꿹",6,"뀂뀃"], +["8581","뀅",6,"뀍뀎뀏뀑뀒뀓뀕",6,"뀞",9,"뀩",26,"끆끇끉끋끍끏끐끑끒끖끘끚끛끜끞",29,"끾끿낁낂낃낅",6,"낎낐낒",5,"낛낝낞낣낤"], +["8641","낥낦낧낪낰낲낶낷낹낺낻낽",6,"냆냊",5,"냒"], +["8661","냓냕냖냗냙",6,"냡냢냣냤냦",10], +["8681","냱",22,"넊넍넎넏넑넔넕넖넗넚넞",4,"넦넧넩넪넫넭",6,"넶넺",5,"녂녃녅녆녇녉",6,"녒녓녖녗녙녚녛녝녞녟녡",22,"녺녻녽녾녿놁놃",4,"놊놌놎놏놐놑놕놖놗놙놚놛놝"], +["8741","놞",9,"놩",15], +["8761","놹",18,"뇍뇎뇏뇑뇒뇓뇕"], +["8781","뇖",5,"뇞뇠",7,"뇪뇫뇭뇮뇯뇱",7,"뇺뇼뇾",5,"눆눇눉눊눍",6,"눖눘눚",5,"눡",18,"눵",6,"눽",26,"뉙뉚뉛뉝뉞뉟뉡",6,"뉪",4], +["8841","뉯",4,"뉶",5,"뉽",6,"늆늇늈늊",4], +["8861","늏늒늓늕늖늗늛",4,"늢늤늧늨늩늫늭늮늯늱늲늳늵늶늷"], +["8881","늸",15,"닊닋닍닎닏닑닓",4,"닚닜닞닟닠닡닣닧닩닪닰닱닲닶닼닽닾댂댃댅댆댇댉",6,"댒댖",5,"댝",54,"덗덙덚덝덠덡덢덣"], +["8941","덦덨덪덬덭덯덲덳덵덶덷덹",6,"뎂뎆",5,"뎍"], +["8961","뎎뎏뎑뎒뎓뎕",10,"뎢",5,"뎩뎪뎫뎭"], +["8981","뎮",21,"돆돇돉돊돍돏돑돒돓돖돘돚돜돞돟돡돢돣돥돦돧돩",18,"돽",18,"됑",6,"됙됚됛됝됞됟됡",6,"됪됬",7,"됵",15], +["8a41","둅",10,"둒둓둕둖둗둙",6,"둢둤둦"], +["8a61","둧",4,"둭",18,"뒁뒂"], +["8a81","뒃",4,"뒉",19,"뒞",5,"뒥뒦뒧뒩뒪뒫뒭",7,"뒶뒸뒺",5,"듁듂듃듅듆듇듉",6,"듑듒듓듔듖",5,"듞듟듡듢듥듧",4,"듮듰듲",5,"듹",26,"딖딗딙딚딝"], +["8b41","딞",5,"딦딫",4,"딲딳딵딶딷딹",6,"땂땆"], +["8b61","땇땈땉땊땎땏땑땒땓땕",6,"땞땢",8], +["8b81","땫",52,"떢떣떥떦떧떩떬떭떮떯떲떶",4,"떾떿뗁뗂뗃뗅",6,"뗎뗒",5,"뗙",18,"뗭",18], +["8c41","똀",15,"똒똓똕똖똗똙",4], +["8c61","똞",6,"똦",5,"똭",6,"똵",5], +["8c81","똻",12,"뙉",26,"뙥뙦뙧뙩",50,"뚞뚟뚡뚢뚣뚥",5,"뚭뚮뚯뚰뚲",16], +["8d41","뛃",16,"뛕",8], +["8d61","뛞",17,"뛱뛲뛳뛵뛶뛷뛹뛺"], +["8d81","뛻",4,"뜂뜃뜄뜆",33,"뜪뜫뜭뜮뜱",6,"뜺뜼",7,"띅띆띇띉띊띋띍",6,"띖",9,"띡띢띣띥띦띧띩",6,"띲띴띶",5,"띾띿랁랂랃랅",6,"랎랓랔랕랚랛랝랞"], +["8e41","랟랡",6,"랪랮",5,"랶랷랹",8], +["8e61","럂",4,"럈럊",19], +["8e81","럞",13,"럮럯럱럲럳럵",6,"럾렂",4,"렊렋렍렎렏렑",6,"렚렜렞",5,"렦렧렩렪렫렭",6,"렶렺",5,"롁롂롃롅",11,"롒롔",7,"롞롟롡롢롣롥",6,"롮롰롲",5,"롹롺롻롽",7], +["8f41","뢅",7,"뢎",17], +["8f61","뢠",7,"뢩",6,"뢱뢲뢳뢵뢶뢷뢹",4], +["8f81","뢾뢿룂룄룆",5,"룍룎룏룑룒룓룕",7,"룞룠룢",5,"룪룫룭룮룯룱",6,"룺룼룾",5,"뤅",18,"뤙",6,"뤡",26,"뤾뤿륁륂륃륅",6,"륍륎륐륒",5], +["9041","륚륛륝륞륟륡",6,"륪륬륮",5,"륶륷륹륺륻륽"], +["9061","륾",5,"릆릈릋릌릏",15], +["9081","릟",12,"릮릯릱릲릳릵",6,"릾맀맂",5,"맊맋맍맓",4,"맚맜맟맠맢맦맧맩맪맫맭",6,"맶맻",4,"먂",5,"먉",11,"먖",33,"먺먻먽먾먿멁멃멄멅멆"], +["9141","멇멊멌멏멐멑멒멖멗멙멚멛멝",6,"멦멪",5], +["9161","멲멳멵멶멷멹",9,"몆몈몉몊몋몍",5], +["9181","몓",20,"몪몭몮몯몱몳",4,"몺몼몾",5,"뫅뫆뫇뫉",14,"뫚",33,"뫽뫾뫿묁묂묃묅",7,"묎묐묒",5,"묙묚묛묝묞묟묡",6], +["9241","묨묪묬",7,"묷묹묺묿",4,"뭆뭈뭊뭋뭌뭎뭑뭒"], +["9261","뭓뭕뭖뭗뭙",7,"뭢뭤",7,"뭭",4], +["9281","뭲",21,"뮉뮊뮋뮍뮎뮏뮑",18,"뮥뮦뮧뮩뮪뮫뮭",6,"뮵뮶뮸",7,"믁믂믃믅믆믇믉",6,"믑믒믔",35,"믺믻믽믾밁"], +["9341","밃",4,"밊밎밐밒밓밙밚밠밡밢밣밦밨밪밫밬밮밯밲밳밵"], +["9361","밶밷밹",6,"뱂뱆뱇뱈뱊뱋뱎뱏뱑",8], +["9381","뱚뱛뱜뱞",37,"벆벇벉벊벍벏",4,"벖벘벛",4,"벢벣벥벦벩",6,"벲벶",5,"벾벿볁볂볃볅",7,"볎볒볓볔볖볗볙볚볛볝",22,"볷볹볺볻볽"], +["9441","볾",5,"봆봈봊",5,"봑봒봓봕",8], +["9461","봞",5,"봥",6,"봭",12], +["9481","봺",5,"뵁",6,"뵊뵋뵍뵎뵏뵑",6,"뵚",9,"뵥뵦뵧뵩",22,"붂붃붅붆붋",4,"붒붔붖붗붘붛붝",6,"붥",10,"붱",6,"붹",24], +["9541","뷒뷓뷖뷗뷙뷚뷛뷝",11,"뷪",5,"뷱"], +["9561","뷲뷳뷵뷶뷷뷹",6,"븁븂븄븆",5,"븎븏븑븒븓"], +["9581","븕",6,"븞븠",35,"빆빇빉빊빋빍빏",4,"빖빘빜빝빞빟빢빣빥빦빧빩빫",4,"빲빶",4,"빾빿뺁뺂뺃뺅",6,"뺎뺒",5,"뺚",13,"뺩",14], +["9641","뺸",23,"뻒뻓"], +["9661","뻕뻖뻙",6,"뻡뻢뻦",5,"뻭",8], +["9681","뻶",10,"뼂",5,"뼊",13,"뼚뼞",33,"뽂뽃뽅뽆뽇뽉",6,"뽒뽓뽔뽖",44], +["9741","뾃",16,"뾕",8], +["9761","뾞",17,"뾱",7], +["9781","뾹",11,"뿆",5,"뿎뿏뿑뿒뿓뿕",6,"뿝뿞뿠뿢",89,"쀽쀾쀿"], +["9841","쁀",16,"쁒",5,"쁙쁚쁛"], +["9861","쁝쁞쁟쁡",6,"쁪",15], +["9881","쁺",21,"삒삓삕삖삗삙",6,"삢삤삦",5,"삮삱삲삷",4,"삾샂샃샄샆샇샊샋샍샎샏샑",6,"샚샞",5,"샦샧샩샪샫샭",6,"샶샸샺",5,"섁섂섃섅섆섇섉",6,"섑섒섓섔섖",5,"섡섢섥섨섩섪섫섮"], +["9941","섲섳섴섵섷섺섻섽섾섿셁",6,"셊셎",5,"셖셗"], +["9961","셙셚셛셝",6,"셦셪",5,"셱셲셳셵셶셷셹셺셻"], +["9981","셼",8,"솆",5,"솏솑솒솓솕솗",4,"솞솠솢솣솤솦솧솪솫솭솮솯솱",11,"솾",5,"쇅쇆쇇쇉쇊쇋쇍",6,"쇕쇖쇙",6,"쇡쇢쇣쇥쇦쇧쇩",6,"쇲쇴",7,"쇾쇿숁숂숃숅",6,"숎숐숒",5,"숚숛숝숞숡숢숣"], +["9a41","숤숥숦숧숪숬숮숰숳숵",16], +["9a61","쉆쉇쉉",6,"쉒쉓쉕쉖쉗쉙",6,"쉡쉢쉣쉤쉦"], +["9a81","쉧",4,"쉮쉯쉱쉲쉳쉵",6,"쉾슀슂",5,"슊",5,"슑",6,"슙슚슜슞",5,"슦슧슩슪슫슮",5,"슶슸슺",33,"싞싟싡싢싥",5,"싮싰싲싳싴싵싷싺싽싾싿쌁",6,"쌊쌋쌎쌏"], +["9b41","쌐쌑쌒쌖쌗쌙쌚쌛쌝",6,"쌦쌧쌪",8], +["9b61","쌳",17,"썆",7], +["9b81","썎",25,"썪썫썭썮썯썱썳",4,"썺썻썾",5,"쎅쎆쎇쎉쎊쎋쎍",50,"쏁",22,"쏚"], +["9c41","쏛쏝쏞쏡쏣",4,"쏪쏫쏬쏮",5,"쏶쏷쏹",5], +["9c61","쏿",8,"쐉",6,"쐑",9], +["9c81","쐛",8,"쐥",6,"쐭쐮쐯쐱쐲쐳쐵",6,"쐾",9,"쑉",26,"쑦쑧쑩쑪쑫쑭",6,"쑶쑷쑸쑺",5,"쒁",18,"쒕",6,"쒝",12], +["9d41","쒪",13,"쒹쒺쒻쒽",8], +["9d61","쓆",25], +["9d81","쓠",8,"쓪",5,"쓲쓳쓵쓶쓷쓹쓻쓼쓽쓾씂",9,"씍씎씏씑씒씓씕",6,"씝",10,"씪씫씭씮씯씱",6,"씺씼씾",5,"앆앇앋앏앐앑앒앖앚앛앜앟앢앣앥앦앧앩",6,"앲앶",5,"앾앿얁얂얃얅얆얈얉얊얋얎얐얒얓얔"], +["9e41","얖얙얚얛얝얞얟얡",7,"얪",9,"얶"], +["9e61","얷얺얿",4,"엋엍엏엒엓엕엖엗엙",6,"엢엤엦엧"], +["9e81","엨엩엪엫엯엱엲엳엵엸엹엺엻옂옃옄옉옊옋옍옎옏옑",6,"옚옝",6,"옦옧옩옪옫옯옱옲옶옸옺옼옽옾옿왂왃왅왆왇왉",6,"왒왖",5,"왞왟왡",10,"왭왮왰왲",5,"왺왻왽왾왿욁",6,"욊욌욎",5,"욖욗욙욚욛욝",6,"욦"], +["9f41","욨욪",5,"욲욳욵욶욷욻",4,"웂웄웆",5,"웎"], +["9f61","웏웑웒웓웕",6,"웞웟웢",5,"웪웫웭웮웯웱웲"], +["9f81","웳",4,"웺웻웼웾",5,"윆윇윉윊윋윍",6,"윖윘윚",5,"윢윣윥윦윧윩",6,"윲윴윶윸윹윺윻윾윿읁읂읃읅",4,"읋읎읐읙읚읛읝읞읟읡",6,"읩읪읬",7,"읶읷읹읺읻읿잀잁잂잆잋잌잍잏잒잓잕잙잛",4,"잢잧",4,"잮잯잱잲잳잵잶잷"], +["a041","잸잹잺잻잾쟂",5,"쟊쟋쟍쟏쟑",6,"쟙쟚쟛쟜"], +["a061","쟞",5,"쟥쟦쟧쟩쟪쟫쟭",13], +["a081","쟻",4,"젂젃젅젆젇젉젋",4,"젒젔젗",4,"젞젟젡젢젣젥",6,"젮젰젲",5,"젹젺젻젽젾젿졁",6,"졊졋졎",5,"졕",26,"졲졳졵졶졷졹졻",4,"좂좄좈좉좊좎",5,"좕",7,"좞좠좢좣좤"], +["a141","좥좦좧좩",18,"좾좿죀죁"], +["a161","죂죃죅죆죇죉죊죋죍",6,"죖죘죚",5,"죢죣죥"], +["a181","죦",14,"죶",5,"죾죿줁줂줃줇",4,"줎 、。·‥…¨〃­―∥\∼‘’“”〔〕〈",9,"±×÷≠≤≥∞∴°′″℃Å¢£¥♂♀∠⊥⌒∂∇≡≒§※☆★○●◎◇◆□■△▲▽▼→←↑↓↔〓≪≫√∽∝∵∫∬∈∋⊆⊇⊂⊃∪∩∧∨¬"], +["a241","줐줒",5,"줙",18], +["a261","줭",6,"줵",18], +["a281","쥈",7,"쥒쥓쥕쥖쥗쥙",6,"쥢쥤",7,"쥭쥮쥯⇒⇔∀∃´~ˇ˘˝˚˙¸˛¡¿ː∮∑∏¤℉‰◁◀▷▶♤♠♡♥♧♣⊙◈▣◐◑▒▤▥▨▧▦▩♨☏☎☜☞¶†‡↕↗↙↖↘♭♩♪♬㉿㈜№㏇™㏂㏘℡€®"], +["a341","쥱쥲쥳쥵",6,"쥽",10,"즊즋즍즎즏"], +["a361","즑",6,"즚즜즞",16], +["a381","즯",16,"짂짃짅짆짉짋",4,"짒짔짗짘짛!",58,"₩]",32," ̄"], +["a441","짞짟짡짣짥짦짨짩짪짫짮짲",5,"짺짻짽짾짿쨁쨂쨃쨄"], +["a461","쨅쨆쨇쨊쨎",5,"쨕쨖쨗쨙",12], +["a481","쨦쨧쨨쨪",28,"ㄱ",93], +["a541","쩇",4,"쩎쩏쩑쩒쩓쩕",6,"쩞쩢",5,"쩩쩪"], +["a561","쩫",17,"쩾",5,"쪅쪆"], +["a581","쪇",16,"쪙",14,"ⅰ",9], +["a5b0","Ⅰ",9], +["a5c1","Α",16,"Σ",6], +["a5e1","α",16,"σ",6], +["a641","쪨",19,"쪾쪿쫁쫂쫃쫅"], +["a661","쫆",5,"쫎쫐쫒쫔쫕쫖쫗쫚",5,"쫡",6], +["a681","쫨쫩쫪쫫쫭",6,"쫵",18,"쬉쬊─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂┒┑┚┙┖┕┎┍┞┟┡┢┦┧┩┪┭┮┱┲┵┶┹┺┽┾╀╁╃",7], +["a741","쬋",4,"쬑쬒쬓쬕쬖쬗쬙",6,"쬢",7], +["a761","쬪",22,"쭂쭃쭄"], +["a781","쭅쭆쭇쭊쭋쭍쭎쭏쭑",6,"쭚쭛쭜쭞",5,"쭥",7,"㎕㎖㎗ℓ㎘㏄㎣㎤㎥㎦㎙",9,"㏊㎍㎎㎏㏏㎈㎉㏈㎧㎨㎰",9,"㎀",4,"㎺",5,"㎐",4,"Ω㏀㏁㎊㎋㎌㏖㏅㎭㎮㎯㏛㎩㎪㎫㎬㏝㏐㏓㏃㏉㏜㏆"], +["a841","쭭",10,"쭺",14], +["a861","쮉",18,"쮝",6], +["a881","쮤",19,"쮹",11,"ÆÐªĦ"], +["a8a6","IJ"], +["a8a8","ĿŁØŒºÞŦŊ"], +["a8b1","㉠",27,"ⓐ",25,"①",14,"½⅓⅔¼¾⅛⅜⅝⅞"], +["a941","쯅",14,"쯕",10], +["a961","쯠쯡쯢쯣쯥쯦쯨쯪",18], +["a981","쯽",14,"찎찏찑찒찓찕",6,"찞찟찠찣찤æđðħıijĸŀłøœßþŧŋʼn㈀",27,"⒜",25,"⑴",14,"¹²³⁴ⁿ₁₂₃₄"], +["aa41","찥찦찪찫찭찯찱",6,"찺찿",4,"챆챇챉챊챋챍챎"], +["aa61","챏",4,"챖챚",5,"챡챢챣챥챧챩",6,"챱챲"], +["aa81","챳챴챶",29,"ぁ",82], +["ab41","첔첕첖첗첚첛첝첞첟첡",6,"첪첮",5,"첶첷첹"], +["ab61","첺첻첽",6,"쳆쳈쳊",5,"쳑쳒쳓쳕",5], +["ab81","쳛",8,"쳥",6,"쳭쳮쳯쳱",12,"ァ",85], +["ac41","쳾쳿촀촂",5,"촊촋촍촎촏촑",6,"촚촜촞촟촠"], +["ac61","촡촢촣촥촦촧촩촪촫촭",11,"촺",4], +["ac81","촿",28,"쵝쵞쵟А",5,"ЁЖ",25], +["acd1","а",5,"ёж",25], +["ad41","쵡쵢쵣쵥",6,"쵮쵰쵲",5,"쵹",7], +["ad61","춁",6,"춉",10,"춖춗춙춚춛춝춞춟"], +["ad81","춠춡춢춣춦춨춪",5,"춱",18,"췅"], +["ae41","췆",5,"췍췎췏췑",16], +["ae61","췢",5,"췩췪췫췭췮췯췱",6,"췺췼췾",4], +["ae81","츃츅츆츇츉츊츋츍",6,"츕츖츗츘츚",5,"츢츣츥츦츧츩츪츫"], +["af41","츬츭츮츯츲츴츶",19], +["af61","칊",13,"칚칛칝칞칢",5,"칪칬"], +["af81","칮",5,"칶칷칹칺칻칽",6,"캆캈캊",5,"캒캓캕캖캗캙"], +["b041","캚",5,"캢캦",5,"캮",12], +["b061","캻",5,"컂",19], +["b081","컖",13,"컦컧컩컪컭",6,"컶컺",5,"가각간갇갈갉갊감",7,"같",4,"갠갤갬갭갯갰갱갸갹갼걀걋걍걔걘걜거걱건걷걸걺검겁것겄겅겆겉겊겋게겐겔겜겝겟겠겡겨격겪견겯결겸겹겻겼경곁계곈곌곕곗고곡곤곧골곪곬곯곰곱곳공곶과곽관괄괆"], +["b141","켂켃켅켆켇켉",6,"켒켔켖",5,"켝켞켟켡켢켣"], +["b161","켥",6,"켮켲",5,"켹",11], +["b181","콅",14,"콖콗콙콚콛콝",6,"콦콨콪콫콬괌괍괏광괘괜괠괩괬괭괴괵괸괼굄굅굇굉교굔굘굡굣구국군굳굴굵굶굻굼굽굿궁궂궈궉권궐궜궝궤궷귀귁귄귈귐귑귓규균귤그극근귿글긁금급긋긍긔기긱긴긷길긺김깁깃깅깆깊까깍깎깐깔깖깜깝깟깠깡깥깨깩깬깰깸"], +["b241","콭콮콯콲콳콵콶콷콹",6,"쾁쾂쾃쾄쾆",5,"쾍"], +["b261","쾎",18,"쾢",5,"쾩"], +["b281","쾪",5,"쾱",18,"쿅",6,"깹깻깼깽꺄꺅꺌꺼꺽꺾껀껄껌껍껏껐껑께껙껜껨껫껭껴껸껼꼇꼈꼍꼐꼬꼭꼰꼲꼴꼼꼽꼿꽁꽂꽃꽈꽉꽐꽜꽝꽤꽥꽹꾀꾄꾈꾐꾑꾕꾜꾸꾹꾼꿀꿇꿈꿉꿋꿍꿎꿔꿜꿨꿩꿰꿱꿴꿸뀀뀁뀄뀌뀐뀔뀜뀝뀨끄끅끈끊끌끎끓끔끕끗끙"], +["b341","쿌",19,"쿢쿣쿥쿦쿧쿩"], +["b361","쿪",5,"쿲쿴쿶",5,"쿽쿾쿿퀁퀂퀃퀅",5], +["b381","퀋",5,"퀒",5,"퀙",19,"끝끼끽낀낄낌낍낏낑나낙낚난낟날낡낢남납낫",4,"낱낳내낵낸낼냄냅냇냈냉냐냑냔냘냠냥너넉넋넌널넒넓넘넙넛넜넝넣네넥넨넬넴넵넷넸넹녀녁년녈념녑녔녕녘녜녠노녹논놀놂놈놉놋농높놓놔놘놜놨뇌뇐뇔뇜뇝"], +["b441","퀮",5,"퀶퀷퀹퀺퀻퀽",6,"큆큈큊",5], +["b461","큑큒큓큕큖큗큙",6,"큡",10,"큮큯"], +["b481","큱큲큳큵",6,"큾큿킀킂",18,"뇟뇨뇩뇬뇰뇹뇻뇽누눅눈눋눌눔눕눗눙눠눴눼뉘뉜뉠뉨뉩뉴뉵뉼늄늅늉느늑는늘늙늚늠늡늣능늦늪늬늰늴니닉닌닐닒님닙닛닝닢다닥닦단닫",4,"닳담답닷",4,"닿대댁댄댈댐댑댓댔댕댜더덕덖던덛덜덞덟덤덥"], +["b541","킕",14,"킦킧킩킪킫킭",5], +["b561","킳킶킸킺",5,"탂탃탅탆탇탊",5,"탒탖",4], +["b581","탛탞탟탡탢탣탥",6,"탮탲",5,"탹",11,"덧덩덫덮데덱덴델뎀뎁뎃뎄뎅뎌뎐뎔뎠뎡뎨뎬도독돈돋돌돎돐돔돕돗동돛돝돠돤돨돼됐되된될됨됩됫됴두둑둔둘둠둡둣둥둬뒀뒈뒝뒤뒨뒬뒵뒷뒹듀듄듈듐듕드득든듣들듦듬듭듯등듸디딕딘딛딜딤딥딧딨딩딪따딱딴딸"], +["b641","턅",7,"턎",17], +["b661","턠",15,"턲턳턵턶턷턹턻턼턽턾"], +["b681","턿텂텆",5,"텎텏텑텒텓텕",6,"텞텠텢",5,"텩텪텫텭땀땁땃땄땅땋때땍땐땔땜땝땟땠땡떠떡떤떨떪떫떰떱떳떴떵떻떼떽뗀뗄뗌뗍뗏뗐뗑뗘뗬또똑똔똘똥똬똴뙈뙤뙨뚜뚝뚠뚤뚫뚬뚱뛔뛰뛴뛸뜀뜁뜅뜨뜩뜬뜯뜰뜸뜹뜻띄띈띌띔띕띠띤띨띰띱띳띵라락란랄람랍랏랐랑랒랖랗"], +["b741","텮",13,"텽",6,"톅톆톇톉톊"], +["b761","톋",20,"톢톣톥톦톧"], +["b781","톩",6,"톲톴톶톷톸톹톻톽톾톿퇁",14,"래랙랜랠램랩랫랬랭랴략랸럇량러럭런럴럼럽럿렀렁렇레렉렌렐렘렙렛렝려력련렬렴렵렷렸령례롄롑롓로록론롤롬롭롯롱롸롼뢍뢨뢰뢴뢸룀룁룃룅료룐룔룝룟룡루룩룬룰룸룹룻룽뤄뤘뤠뤼뤽륀륄륌륏륑류륙륜률륨륩"], +["b841","퇐",7,"퇙",17], +["b861","퇫",8,"퇵퇶퇷퇹",13], +["b881","툈툊",5,"툑",24,"륫륭르륵른를름릅릇릉릊릍릎리릭린릴림립릿링마막만많",4,"맘맙맛망맞맡맣매맥맨맬맴맵맷맸맹맺먀먁먈먕머먹먼멀멂멈멉멋멍멎멓메멕멘멜멤멥멧멨멩며멱면멸몃몄명몇몌모목몫몬몰몲몸몹못몽뫄뫈뫘뫙뫼"], +["b941","툪툫툮툯툱툲툳툵",6,"툾퉀퉂",5,"퉉퉊퉋퉌"], +["b961","퉍",14,"퉝",6,"퉥퉦퉧퉨"], +["b981","퉩",22,"튂튃튅튆튇튉튊튋튌묀묄묍묏묑묘묜묠묩묫무묵묶문묻물묽묾뭄뭅뭇뭉뭍뭏뭐뭔뭘뭡뭣뭬뮈뮌뮐뮤뮨뮬뮴뮷므믄믈믐믓미믹민믿밀밂밈밉밋밌밍및밑바",4,"받",4,"밤밥밧방밭배백밴밸뱀뱁뱃뱄뱅뱉뱌뱍뱐뱝버벅번벋벌벎범법벗"], +["ba41","튍튎튏튒튓튔튖",5,"튝튞튟튡튢튣튥",6,"튭"], +["ba61","튮튯튰튲",5,"튺튻튽튾틁틃",4,"틊틌",5], +["ba81","틒틓틕틖틗틙틚틛틝",6,"틦",9,"틲틳틵틶틷틹틺벙벚베벡벤벧벨벰벱벳벴벵벼벽변별볍볏볐병볕볘볜보복볶본볼봄봅봇봉봐봔봤봬뵀뵈뵉뵌뵐뵘뵙뵤뵨부북분붇불붉붊붐붑붓붕붙붚붜붤붰붸뷔뷕뷘뷜뷩뷰뷴뷸븀븃븅브븍븐블븜븝븟비빅빈빌빎빔빕빗빙빚빛빠빡빤"], +["bb41","틻",4,"팂팄팆",5,"팏팑팒팓팕팗",4,"팞팢팣"], +["bb61","팤팦팧팪팫팭팮팯팱",6,"팺팾",5,"퍆퍇퍈퍉"], +["bb81","퍊",31,"빨빪빰빱빳빴빵빻빼빽뺀뺄뺌뺍뺏뺐뺑뺘뺙뺨뻐뻑뻔뻗뻘뻠뻣뻤뻥뻬뼁뼈뼉뼘뼙뼛뼜뼝뽀뽁뽄뽈뽐뽑뽕뾔뾰뿅뿌뿍뿐뿔뿜뿟뿡쀼쁑쁘쁜쁠쁨쁩삐삑삔삘삠삡삣삥사삭삯산삳살삵삶삼삽삿샀상샅새색샌샐샘샙샛샜생샤"], +["bc41","퍪",17,"퍾퍿펁펂펃펅펆펇"], +["bc61","펈펉펊펋펎펒",5,"펚펛펝펞펟펡",6,"펪펬펮"], +["bc81","펯",4,"펵펶펷펹펺펻펽",6,"폆폇폊",5,"폑",5,"샥샨샬샴샵샷샹섀섄섈섐섕서",4,"섣설섦섧섬섭섯섰성섶세섹센셀셈셉셋셌셍셔셕션셜셤셥셧셨셩셰셴셸솅소속솎손솔솖솜솝솟송솥솨솩솬솰솽쇄쇈쇌쇔쇗쇘쇠쇤쇨쇰쇱쇳쇼쇽숀숄숌숍숏숑수숙순숟술숨숩숫숭"], +["bd41","폗폙",7,"폢폤",7,"폮폯폱폲폳폵폶폷"], +["bd61","폸폹폺폻폾퐀퐂",5,"퐉",13], +["bd81","퐗",5,"퐞",25,"숯숱숲숴쉈쉐쉑쉔쉘쉠쉥쉬쉭쉰쉴쉼쉽쉿슁슈슉슐슘슛슝스슥슨슬슭슴습슷승시식신싣실싫심십싯싱싶싸싹싻싼쌀쌈쌉쌌쌍쌓쌔쌕쌘쌜쌤쌥쌨쌩썅써썩썬썰썲썸썹썼썽쎄쎈쎌쏀쏘쏙쏜쏟쏠쏢쏨쏩쏭쏴쏵쏸쐈쐐쐤쐬쐰"], +["be41","퐸",7,"푁푂푃푅",14], +["be61","푔",7,"푝푞푟푡푢푣푥",7,"푮푰푱푲"], +["be81","푳",4,"푺푻푽푾풁풃",4,"풊풌풎",5,"풕",8,"쐴쐼쐽쑈쑤쑥쑨쑬쑴쑵쑹쒀쒔쒜쒸쒼쓩쓰쓱쓴쓸쓺쓿씀씁씌씐씔씜씨씩씬씰씸씹씻씽아악안앉않알앍앎앓암압앗았앙앝앞애액앤앨앰앱앳앴앵야약얀얄얇얌얍얏양얕얗얘얜얠얩어억언얹얻얼얽얾엄",6,"엌엎"], +["bf41","풞",10,"풪",14], +["bf61","풹",18,"퓍퓎퓏퓑퓒퓓퓕"], +["bf81","퓖",5,"퓝퓞퓠",7,"퓩퓪퓫퓭퓮퓯퓱",6,"퓹퓺퓼에엑엔엘엠엡엣엥여역엮연열엶엷염",5,"옅옆옇예옌옐옘옙옛옜오옥온올옭옮옰옳옴옵옷옹옻와왁완왈왐왑왓왔왕왜왝왠왬왯왱외왹왼욀욈욉욋욍요욕욘욜욤욥욧용우욱운울욹욺움웁웃웅워웍원월웜웝웠웡웨"], +["c041","퓾",5,"픅픆픇픉픊픋픍",6,"픖픘",5], +["c061","픞",25], +["c081","픸픹픺픻픾픿핁핂핃핅",6,"핎핐핒",5,"핚핛핝핞핟핡핢핣웩웬웰웸웹웽위윅윈윌윔윕윗윙유육윤율윰윱윳융윷으윽은을읊음읍읏응",7,"읜읠읨읫이익인일읽읾잃임입잇있잉잊잎자작잔잖잗잘잚잠잡잣잤장잦재잭잰잴잼잽잿쟀쟁쟈쟉쟌쟎쟐쟘쟝쟤쟨쟬저적전절젊"], +["c141","핤핦핧핪핬핮",5,"핶핷핹핺핻핽",6,"햆햊햋"], +["c161","햌햍햎햏햑",19,"햦햧"], +["c181","햨",31,"점접젓정젖제젝젠젤젬젭젯젱져젼졀졈졉졌졍졔조족존졸졺좀좁좃종좆좇좋좌좍좔좝좟좡좨좼좽죄죈죌죔죕죗죙죠죡죤죵주죽준줄줅줆줌줍줏중줘줬줴쥐쥑쥔쥘쥠쥡쥣쥬쥰쥴쥼즈즉즌즐즘즙즛증지직진짇질짊짐집짓"], +["c241","헊헋헍헎헏헑헓",4,"헚헜헞",5,"헦헧헩헪헫헭헮"], +["c261","헯",4,"헶헸헺",5,"혂혃혅혆혇혉",6,"혒"], +["c281","혖",5,"혝혞혟혡혢혣혥",7,"혮",9,"혺혻징짖짙짚짜짝짠짢짤짧짬짭짯짰짱째짹짼쨀쨈쨉쨋쨌쨍쨔쨘쨩쩌쩍쩐쩔쩜쩝쩟쩠쩡쩨쩽쪄쪘쪼쪽쫀쫄쫌쫍쫏쫑쫓쫘쫙쫠쫬쫴쬈쬐쬔쬘쬠쬡쭁쭈쭉쭌쭐쭘쭙쭝쭤쭸쭹쮜쮸쯔쯤쯧쯩찌찍찐찔찜찝찡찢찧차착찬찮찰참찹찻"], +["c341","혽혾혿홁홂홃홄홆홇홊홌홎홏홐홒홓홖홗홙홚홛홝",4], +["c361","홢",4,"홨홪",5,"홲홳홵",11], +["c381","횁횂횄횆",5,"횎횏횑횒횓횕",7,"횞횠횢",5,"횩횪찼창찾채책챈챌챔챕챗챘챙챠챤챦챨챰챵처척천철첨첩첫첬청체첵첸첼쳄쳅쳇쳉쳐쳔쳤쳬쳰촁초촉촌촐촘촙촛총촤촨촬촹최쵠쵤쵬쵭쵯쵱쵸춈추축춘출춤춥춧충춰췄췌췐취췬췰췸췹췻췽츄츈츌츔츙츠측츤츨츰츱츳층"], +["c441","횫횭횮횯횱",7,"횺횼",7,"훆훇훉훊훋"], +["c461","훍훎훏훐훒훓훕훖훘훚",5,"훡훢훣훥훦훧훩",4], +["c481","훮훯훱훲훳훴훶",5,"훾훿휁휂휃휅",11,"휒휓휔치칙친칟칠칡침칩칫칭카칵칸칼캄캅캇캉캐캑캔캘캠캡캣캤캥캬캭컁커컥컨컫컬컴컵컷컸컹케켁켄켈켐켑켓켕켜켠켤켬켭켯켰켱켸코콕콘콜콤콥콧콩콰콱콴콸쾀쾅쾌쾡쾨쾰쿄쿠쿡쿤쿨쿰쿱쿳쿵쿼퀀퀄퀑퀘퀭퀴퀵퀸퀼"], +["c541","휕휖휗휚휛휝휞휟휡",6,"휪휬휮",5,"휶휷휹"], +["c561","휺휻휽",6,"흅흆흈흊",5,"흒흓흕흚",4], +["c581","흟흢흤흦흧흨흪흫흭흮흯흱흲흳흵",6,"흾흿힀힂",5,"힊힋큄큅큇큉큐큔큘큠크큭큰클큼큽킁키킥킨킬킴킵킷킹타탁탄탈탉탐탑탓탔탕태택탠탤탬탭탯탰탱탸턍터턱턴털턺텀텁텃텄텅테텍텐텔템텝텟텡텨텬텼톄톈토톡톤톨톰톱톳통톺톼퇀퇘퇴퇸툇툉툐투툭툰툴툼툽툿퉁퉈퉜"], +["c641","힍힎힏힑",6,"힚힜힞",5], +["c6a1","퉤튀튁튄튈튐튑튕튜튠튤튬튱트특튼튿틀틂틈틉틋틔틘틜틤틥티틱틴틸팀팁팃팅파팍팎판팔팖팜팝팟팠팡팥패팩팬팰팸팹팻팼팽퍄퍅퍼퍽펀펄펌펍펏펐펑페펙펜펠펨펩펫펭펴편펼폄폅폈평폐폘폡폣포폭폰폴폼폽폿퐁"], +["c7a1","퐈퐝푀푄표푠푤푭푯푸푹푼푿풀풂품풉풋풍풔풩퓌퓐퓔퓜퓟퓨퓬퓰퓸퓻퓽프픈플픔픕픗피픽핀필핌핍핏핑하학한할핥함합핫항해핵핸핼햄햅햇했행햐향허헉헌헐헒험헙헛헝헤헥헨헬헴헵헷헹혀혁현혈혐협혓혔형혜혠"], +["c8a1","혤혭호혹혼홀홅홈홉홋홍홑화확환활홧황홰홱홴횃횅회획횐횔횝횟횡효횬횰횹횻후훅훈훌훑훔훗훙훠훤훨훰훵훼훽휀휄휑휘휙휜휠휨휩휫휭휴휵휸휼흄흇흉흐흑흔흖흗흘흙흠흡흣흥흩희흰흴흼흽힁히힉힌힐힘힙힛힝"], +["caa1","伽佳假價加可呵哥嘉嫁家暇架枷柯歌珂痂稼苛茄街袈訶賈跏軻迦駕刻却各恪慤殼珏脚覺角閣侃刊墾奸姦干幹懇揀杆柬桿澗癎看磵稈竿簡肝艮艱諫間乫喝曷渴碣竭葛褐蝎鞨勘坎堪嵌感憾戡敢柑橄減甘疳監瞰紺邯鑑鑒龕"], +["cba1","匣岬甲胛鉀閘剛堈姜岡崗康强彊慷江畺疆糠絳綱羌腔舡薑襁講鋼降鱇介价個凱塏愷愾慨改槪漑疥皆盖箇芥蓋豈鎧開喀客坑更粳羹醵倨去居巨拒据據擧渠炬祛距踞車遽鉅鋸乾件健巾建愆楗腱虔蹇鍵騫乞傑杰桀儉劍劒檢"], +["cca1","瞼鈐黔劫怯迲偈憩揭擊格檄激膈覡隔堅牽犬甄絹繭肩見譴遣鵑抉決潔結缺訣兼慊箝謙鉗鎌京俓倞傾儆勁勍卿坰境庚徑慶憬擎敬景暻更梗涇炅烱璟璥瓊痙硬磬竟競絅經耕耿脛莖警輕逕鏡頃頸驚鯨係啓堺契季屆悸戒桂械"], +["cda1","棨溪界癸磎稽系繫繼計誡谿階鷄古叩告呱固姑孤尻庫拷攷故敲暠枯槁沽痼皐睾稿羔考股膏苦苽菰藁蠱袴誥賈辜錮雇顧高鼓哭斛曲梏穀谷鵠困坤崑昆梱棍滾琨袞鯤汨滑骨供公共功孔工恐恭拱控攻珙空蚣貢鞏串寡戈果瓜"], +["cea1","科菓誇課跨過鍋顆廓槨藿郭串冠官寬慣棺款灌琯瓘管罐菅觀貫關館刮恝括适侊光匡壙廣曠洸炚狂珖筐胱鑛卦掛罫乖傀塊壞怪愧拐槐魁宏紘肱轟交僑咬喬嬌嶠巧攪敎校橋狡皎矯絞翹膠蕎蛟較轎郊餃驕鮫丘久九仇俱具勾"], +["cfa1","區口句咎嘔坵垢寇嶇廐懼拘救枸柩構歐毆毬求溝灸狗玖球瞿矩究絿耉臼舅舊苟衢謳購軀逑邱鉤銶駒驅鳩鷗龜國局菊鞠鞫麴君窘群裙軍郡堀屈掘窟宮弓穹窮芎躬倦券勸卷圈拳捲權淃眷厥獗蕨蹶闕机櫃潰詭軌饋句晷歸貴"], +["d0a1","鬼龜叫圭奎揆槻珪硅窺竅糾葵規赳逵閨勻均畇筠菌鈞龜橘克剋劇戟棘極隙僅劤勤懃斤根槿瑾筋芹菫覲謹近饉契今妗擒昑檎琴禁禽芩衾衿襟金錦伋及急扱汲級給亘兢矜肯企伎其冀嗜器圻基埼夔奇妓寄岐崎己幾忌技旗旣"], +["d1a1","朞期杞棋棄機欺氣汽沂淇玘琦琪璂璣畸畿碁磯祁祇祈祺箕紀綺羈耆耭肌記譏豈起錡錤飢饑騎騏驥麒緊佶吉拮桔金喫儺喇奈娜懦懶拏拿癩",5,"那樂",4,"諾酪駱亂卵暖欄煖爛蘭難鸞捏捺南嵐枏楠湳濫男藍襤拉"], +["d2a1","納臘蠟衲囊娘廊",4,"乃來內奈柰耐冷女年撚秊念恬拈捻寧寗努勞奴弩怒擄櫓爐瑙盧",5,"駑魯",10,"濃籠聾膿農惱牢磊腦賂雷尿壘",7,"嫩訥杻紐勒",5,"能菱陵尼泥匿溺多茶"], +["d3a1","丹亶但單團壇彖斷旦檀段湍短端簞緞蛋袒鄲鍛撻澾獺疸達啖坍憺擔曇淡湛潭澹痰聃膽蕁覃談譚錟沓畓答踏遝唐堂塘幢戇撞棠當糖螳黨代垈坮大對岱帶待戴擡玳臺袋貸隊黛宅德悳倒刀到圖堵塗導屠島嶋度徒悼挑掉搗桃"], +["d4a1","棹櫂淘渡滔濤燾盜睹禱稻萄覩賭跳蹈逃途道都鍍陶韜毒瀆牘犢獨督禿篤纛讀墩惇敦旽暾沌焞燉豚頓乭突仝冬凍動同憧東桐棟洞潼疼瞳童胴董銅兜斗杜枓痘竇荳讀豆逗頭屯臀芚遁遯鈍得嶝橙燈登等藤謄鄧騰喇懶拏癩羅"], +["d5a1","蘿螺裸邏樂洛烙珞絡落諾酪駱丹亂卵欄欒瀾爛蘭鸞剌辣嵐擥攬欖濫籃纜藍襤覽拉臘蠟廊朗浪狼琅瑯螂郞來崍徠萊冷掠略亮倆兩凉梁樑粮粱糧良諒輛量侶儷勵呂廬慮戾旅櫚濾礪藜蠣閭驢驪麗黎力曆歷瀝礫轢靂憐戀攣漣"], +["d6a1","煉璉練聯蓮輦連鍊冽列劣洌烈裂廉斂殮濂簾獵令伶囹寧岺嶺怜玲笭羚翎聆逞鈴零靈領齡例澧禮醴隷勞怒撈擄櫓潞瀘爐盧老蘆虜路輅露魯鷺鹵碌祿綠菉錄鹿麓論壟弄朧瀧瓏籠聾儡瀨牢磊賂賚賴雷了僚寮廖料燎療瞭聊蓼"], +["d7a1","遼鬧龍壘婁屢樓淚漏瘻累縷蔞褸鏤陋劉旒柳榴流溜瀏琉瑠留瘤硫謬類六戮陸侖倫崙淪綸輪律慄栗率隆勒肋凜凌楞稜綾菱陵俚利厘吏唎履悧李梨浬犁狸理璃異痢籬罹羸莉裏裡里釐離鯉吝潾燐璘藺躪隣鱗麟林淋琳臨霖砬"], +["d8a1","立笠粒摩瑪痲碼磨馬魔麻寞幕漠膜莫邈万卍娩巒彎慢挽晩曼滿漫灣瞞萬蔓蠻輓饅鰻唜抹末沫茉襪靺亡妄忘忙望網罔芒茫莽輞邙埋妹媒寐昧枚梅每煤罵買賣邁魅脈貊陌驀麥孟氓猛盲盟萌冪覓免冕勉棉沔眄眠綿緬面麵滅"], +["d9a1","蔑冥名命明暝椧溟皿瞑茗蓂螟酩銘鳴袂侮冒募姆帽慕摸摹暮某模母毛牟牡瑁眸矛耗芼茅謀謨貌木沐牧目睦穆鶩歿沒夢朦蒙卯墓妙廟描昴杳渺猫竗苗錨務巫憮懋戊拇撫无楙武毋無珷畝繆舞茂蕪誣貿霧鵡墨默們刎吻問文"], +["daa1","汶紊紋聞蚊門雯勿沕物味媚尾嵋彌微未梶楣渼湄眉米美薇謎迷靡黴岷悶愍憫敏旻旼民泯玟珉緡閔密蜜謐剝博拍搏撲朴樸泊珀璞箔粕縛膊舶薄迫雹駁伴半反叛拌搬攀斑槃泮潘班畔瘢盤盼磐磻礬絆般蟠返頒飯勃拔撥渤潑"], +["dba1","發跋醱鉢髮魃倣傍坊妨尨幇彷房放方旁昉枋榜滂磅紡肪膀舫芳蒡蚌訪謗邦防龐倍俳北培徘拜排杯湃焙盃背胚裴裵褙賠輩配陪伯佰帛柏栢白百魄幡樊煩燔番磻繁蕃藩飜伐筏罰閥凡帆梵氾汎泛犯範范法琺僻劈壁擘檗璧癖"], +["dca1","碧蘗闢霹便卞弁變辨辯邊別瞥鱉鼈丙倂兵屛幷昞昺柄棅炳甁病秉竝輧餠騈保堡報寶普步洑湺潽珤甫菩補褓譜輔伏僕匐卜宓復服福腹茯蔔複覆輹輻馥鰒本乶俸奉封峯峰捧棒烽熢琫縫蓬蜂逢鋒鳳不付俯傅剖副否咐埠夫婦"], +["dda1","孚孵富府復扶敷斧浮溥父符簿缶腐腑膚艀芙莩訃負賦賻赴趺部釜阜附駙鳧北分吩噴墳奔奮忿憤扮昐汾焚盆粉糞紛芬賁雰不佛弗彿拂崩朋棚硼繃鵬丕備匕匪卑妃婢庇悲憊扉批斐枇榧比毖毗毘沸泌琵痺砒碑秕秘粃緋翡肥"], +["dea1","脾臂菲蜚裨誹譬費鄙非飛鼻嚬嬪彬斌檳殯浜濱瀕牝玭貧賓頻憑氷聘騁乍事些仕伺似使俟僿史司唆嗣四士奢娑寫寺射巳師徙思捨斜斯柶査梭死沙泗渣瀉獅砂社祀祠私篩紗絲肆舍莎蓑蛇裟詐詞謝賜赦辭邪飼駟麝削數朔索"], +["dfa1","傘刪山散汕珊産疝算蒜酸霰乷撒殺煞薩三參杉森渗芟蔘衫揷澁鈒颯上傷像償商喪嘗孀尙峠常床庠廂想桑橡湘爽牀狀相祥箱翔裳觴詳象賞霜塞璽賽嗇塞穡索色牲生甥省笙墅壻嶼序庶徐恕抒捿敍暑曙書栖棲犀瑞筮絮緖署"], +["e0a1","胥舒薯西誓逝鋤黍鼠夕奭席惜昔晳析汐淅潟石碩蓆釋錫仙僊先善嬋宣扇敾旋渲煽琁瑄璇璿癬禪線繕羨腺膳船蘚蟬詵跣選銑鐥饍鮮卨屑楔泄洩渫舌薛褻設說雪齧剡暹殲纖蟾贍閃陝攝涉燮葉城姓宬性惺成星晟猩珹盛省筬"], +["e1a1","聖聲腥誠醒世勢歲洗稅笹細說貰召嘯塑宵小少巢所掃搔昭梳沼消溯瀟炤燒甦疏疎瘙笑篠簫素紹蔬蕭蘇訴逍遡邵銷韶騷俗屬束涑粟續謖贖速孫巽損蓀遜飡率宋悚松淞訟誦送頌刷殺灑碎鎖衰釗修受嗽囚垂壽嫂守岫峀帥愁"], +["e2a1","戍手授搜收數樹殊水洙漱燧狩獸琇璲瘦睡秀穗竪粹綏綬繡羞脩茱蒐蓚藪袖誰讐輸遂邃酬銖銹隋隧隨雖需須首髓鬚叔塾夙孰宿淑潚熟琡璹肅菽巡徇循恂旬栒楯橓殉洵淳珣盾瞬筍純脣舜荀蓴蕣詢諄醇錞順馴戌術述鉥崇崧"], +["e3a1","嵩瑟膝蝨濕拾習褶襲丞乘僧勝升承昇繩蠅陞侍匙嘶始媤尸屎屍市弑恃施是時枾柴猜矢示翅蒔蓍視試詩諡豕豺埴寔式息拭植殖湜熄篒蝕識軾食飾伸侁信呻娠宸愼新晨燼申神紳腎臣莘薪藎蜃訊身辛辰迅失室實悉審尋心沁"], +["e4a1","沈深瀋甚芯諶什十拾雙氏亞俄兒啞娥峨我牙芽莪蛾衙訝阿雅餓鴉鵝堊岳嶽幄惡愕握樂渥鄂鍔顎鰐齷安岸按晏案眼雁鞍顔鮟斡謁軋閼唵岩巖庵暗癌菴闇壓押狎鴨仰央怏昻殃秧鴦厓哀埃崖愛曖涯碍艾隘靄厄扼掖液縊腋額"], +["e5a1","櫻罌鶯鸚也倻冶夜惹揶椰爺耶若野弱掠略約若葯蒻藥躍亮佯兩凉壤孃恙揚攘敭暘梁楊樣洋瀁煬痒瘍禳穰糧羊良襄諒讓釀陽量養圄御於漁瘀禦語馭魚齬億憶抑檍臆偃堰彦焉言諺孼蘖俺儼嚴奄掩淹嶪業円予余勵呂女如廬"], +["e6a1","旅歟汝濾璵礖礪與艅茹輿轝閭餘驪麗黎亦力域役易曆歷疫繹譯轢逆驛嚥堧姸娟宴年延憐戀捐挻撚椽沇沿涎涓淵演漣烟然煙煉燃燕璉硏硯秊筵緣練縯聯衍軟輦蓮連鉛鍊鳶列劣咽悅涅烈熱裂說閱厭廉念捻染殮炎焰琰艶苒"], +["e7a1","簾閻髥鹽曄獵燁葉令囹塋寧嶺嶸影怜映暎楹榮永泳渶潁濚瀛瀯煐營獰玲瑛瑩瓔盈穎纓羚聆英詠迎鈴鍈零霙靈領乂倪例刈叡曳汭濊猊睿穢芮藝蘂禮裔詣譽豫醴銳隸霓預五伍俉傲午吾吳嗚塢墺奧娛寤悟惡懊敖旿晤梧汚澳"], +["e8a1","烏熬獒筽蜈誤鰲鼇屋沃獄玉鈺溫瑥瘟穩縕蘊兀壅擁瓮甕癰翁邕雍饔渦瓦窩窪臥蛙蝸訛婉完宛梡椀浣玩琓琬碗緩翫脘腕莞豌阮頑曰往旺枉汪王倭娃歪矮外嵬巍猥畏了僚僥凹堯夭妖姚寥寮尿嶢拗搖撓擾料曜樂橈燎燿瑤療"], +["e9a1","窈窯繇繞耀腰蓼蟯要謠遙遼邀饒慾欲浴縟褥辱俑傭冗勇埇墉容庸慂榕涌湧溶熔瑢用甬聳茸蓉踊鎔鏞龍于佑偶優又友右宇寓尤愚憂旴牛玗瑀盂祐禑禹紆羽芋藕虞迂遇郵釪隅雨雩勖彧旭昱栯煜稶郁頊云暈橒殞澐熉耘芸蕓"], +["eaa1","運隕雲韻蔚鬱亐熊雄元原員圓園垣媛嫄寃怨愿援沅洹湲源爰猿瑗苑袁轅遠阮院願鴛月越鉞位偉僞危圍委威尉慰暐渭爲瑋緯胃萎葦蔿蝟衛褘謂違韋魏乳侑儒兪劉唯喩孺宥幼幽庾悠惟愈愉揄攸有杻柔柚柳楡楢油洧流游溜"], +["eba1","濡猶猷琉瑜由留癒硫紐維臾萸裕誘諛諭踰蹂遊逾遺酉釉鍮類六堉戮毓肉育陸倫允奫尹崙淪潤玧胤贇輪鈗閏律慄栗率聿戎瀜絨融隆垠恩慇殷誾銀隱乙吟淫蔭陰音飮揖泣邑凝應膺鷹依倚儀宜意懿擬椅毅疑矣義艤薏蟻衣誼"], +["eca1","議醫二以伊利吏夷姨履已弛彛怡易李梨泥爾珥理異痍痢移罹而耳肄苡荑裏裡貽貳邇里離飴餌匿溺瀷益翊翌翼謚人仁刃印吝咽因姻寅引忍湮燐璘絪茵藺蚓認隣靭靷鱗麟一佚佾壹日溢逸鎰馹任壬妊姙恁林淋稔臨荏賃入卄"], +["eda1","立笠粒仍剩孕芿仔刺咨姉姿子字孜恣慈滋炙煮玆瓷疵磁紫者自茨蔗藉諮資雌作勺嚼斫昨灼炸爵綽芍酌雀鵲孱棧殘潺盞岑暫潛箴簪蠶雜丈仗匠場墻壯奬將帳庄張掌暲杖樟檣欌漿牆狀獐璋章粧腸臟臧莊葬蔣薔藏裝贓醬長"], +["eea1","障再哉在宰才材栽梓渽滓災縡裁財載齋齎爭箏諍錚佇低儲咀姐底抵杵楮樗沮渚狙猪疽箸紵苧菹著藷詛貯躇這邸雎齟勣吊嫡寂摘敵滴狄炙的積笛籍績翟荻謫賊赤跡蹟迪迹適鏑佃佺傳全典前剪塡塼奠專展廛悛戰栓殿氈澱"], +["efa1","煎琠田甸畑癲筌箋箭篆纏詮輾轉鈿銓錢鐫電顚顫餞切截折浙癤竊節絶占岾店漸点粘霑鮎點接摺蝶丁井亭停偵呈姃定幀庭廷征情挺政整旌晶晸柾楨檉正汀淀淨渟湞瀞炡玎珽町睛碇禎程穽精綎艇訂諪貞鄭酊釘鉦鋌錠霆靖"], +["f0a1","靜頂鼎制劑啼堤帝弟悌提梯濟祭第臍薺製諸蹄醍除際霽題齊俎兆凋助嘲弔彫措操早晁曺曹朝條棗槽漕潮照燥爪璪眺祖祚租稠窕粗糟組繰肇藻蚤詔調趙躁造遭釣阻雕鳥族簇足鏃存尊卒拙猝倧宗從悰慫棕淙琮種終綜縱腫"], +["f1a1","踪踵鍾鐘佐坐左座挫罪主住侏做姝胄呪周嗾奏宙州廚晝朱柱株注洲湊澍炷珠疇籌紂紬綢舟蛛註誅走躊輳週酎酒鑄駐竹粥俊儁准埈寯峻晙樽浚準濬焌畯竣蠢逡遵雋駿茁中仲衆重卽櫛楫汁葺增憎曾拯烝甑症繒蒸證贈之只"], +["f2a1","咫地址志持指摯支旨智枝枳止池沚漬知砥祉祗紙肢脂至芝芷蜘誌識贄趾遲直稙稷織職唇嗔塵振搢晉晋桭榛殄津溱珍瑨璡畛疹盡眞瞋秦縉縝臻蔯袗診賑軫辰進鎭陣陳震侄叱姪嫉帙桎瓆疾秩窒膣蛭質跌迭斟朕什執潗緝輯"], +["f3a1","鏶集徵懲澄且侘借叉嗟嵯差次此磋箚茶蹉車遮捉搾着窄錯鑿齪撰澯燦璨瓚竄簒纂粲纘讚贊鑽餐饌刹察擦札紮僭參塹慘慙懺斬站讒讖倉倡創唱娼廠彰愴敞昌昶暢槍滄漲猖瘡窓脹艙菖蒼債埰寀寨彩採砦綵菜蔡采釵冊柵策"], +["f4a1","責凄妻悽處倜刺剔尺慽戚拓擲斥滌瘠脊蹠陟隻仟千喘天川擅泉淺玔穿舛薦賤踐遷釧闡阡韆凸哲喆徹撤澈綴輟轍鐵僉尖沾添甛瞻簽籤詹諂堞妾帖捷牒疊睫諜貼輒廳晴淸聽菁請靑鯖切剃替涕滯締諦逮遞體初剿哨憔抄招梢"], +["f5a1","椒楚樵炒焦硝礁礎秒稍肖艸苕草蕉貂超酢醋醮促囑燭矗蜀觸寸忖村邨叢塚寵悤憁摠總聰蔥銃撮催崔最墜抽推椎楸樞湫皺秋芻萩諏趨追鄒酋醜錐錘鎚雛騶鰍丑畜祝竺筑築縮蓄蹙蹴軸逐春椿瑃出朮黜充忠沖蟲衝衷悴膵萃"], +["f6a1","贅取吹嘴娶就炊翠聚脆臭趣醉驟鷲側仄厠惻測層侈値嗤峙幟恥梔治淄熾痔痴癡稚穉緇緻置致蚩輜雉馳齒則勅飭親七柒漆侵寢枕沈浸琛砧針鍼蟄秤稱快他咤唾墮妥惰打拖朶楕舵陀馱駝倬卓啄坼度托拓擢晫柝濁濯琢琸託"], +["f7a1","鐸呑嘆坦彈憚歎灘炭綻誕奪脫探眈耽貪塔搭榻宕帑湯糖蕩兌台太怠態殆汰泰笞胎苔跆邰颱宅擇澤撑攄兎吐土討慟桶洞痛筒統通堆槌腿褪退頹偸套妬投透鬪慝特闖坡婆巴把播擺杷波派爬琶破罷芭跛頗判坂板版瓣販辦鈑"], +["f8a1","阪八叭捌佩唄悖敗沛浿牌狽稗覇貝彭澎烹膨愎便偏扁片篇編翩遍鞭騙貶坪平枰萍評吠嬖幣廢弊斃肺蔽閉陛佈包匍匏咆哺圃布怖抛抱捕暴泡浦疱砲胞脯苞葡蒲袍褒逋鋪飽鮑幅暴曝瀑爆輻俵剽彪慓杓標漂瓢票表豹飇飄驃"], +["f9a1","品稟楓諷豊風馮彼披疲皮被避陂匹弼必泌珌畢疋筆苾馝乏逼下何厦夏廈昰河瑕荷蝦賀遐霞鰕壑學虐謔鶴寒恨悍旱汗漢澣瀚罕翰閑閒限韓割轄函含咸啣喊檻涵緘艦銜陷鹹合哈盒蛤閤闔陜亢伉姮嫦巷恒抗杭桁沆港缸肛航"], +["faa1","行降項亥偕咳垓奚孩害懈楷海瀣蟹解該諧邂駭骸劾核倖幸杏荇行享向嚮珦鄕響餉饗香噓墟虛許憲櫶獻軒歇險驗奕爀赫革俔峴弦懸晛泫炫玄玹現眩睍絃絢縣舷衒見賢鉉顯孑穴血頁嫌俠協夾峽挾浹狹脅脇莢鋏頰亨兄刑型"], +["fba1","形泂滎瀅灐炯熒珩瑩荊螢衡逈邢鎣馨兮彗惠慧暳蕙蹊醯鞋乎互呼壕壺好岵弧戶扈昊晧毫浩淏湖滸澔濠濩灝狐琥瑚瓠皓祜糊縞胡芦葫蒿虎號蝴護豪鎬頀顥惑或酷婚昏混渾琿魂忽惚笏哄弘汞泓洪烘紅虹訌鴻化和嬅樺火畵"], +["fca1","禍禾花華話譁貨靴廓擴攫確碻穫丸喚奐宦幻患換歡晥桓渙煥環紈還驩鰥活滑猾豁闊凰幌徨恍惶愰慌晃晄榥況湟滉潢煌璜皇篁簧荒蝗遑隍黃匯回廻徊恢悔懷晦會檜淮澮灰獪繪膾茴蛔誨賄劃獲宖橫鐄哮嚆孝效斅曉梟涍淆"], +["fda1","爻肴酵驍侯候厚后吼喉嗅帿後朽煦珝逅勛勳塤壎焄熏燻薰訓暈薨喧暄煊萱卉喙毁彙徽揮暉煇諱輝麾休携烋畦虧恤譎鷸兇凶匈洶胸黑昕欣炘痕吃屹紇訖欠欽歆吸恰洽翕興僖凞喜噫囍姬嬉希憙憘戱晞曦熙熹熺犧禧稀羲詰"] +] diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/tables/cp950.json b/node_modules/npm/node_modules/iconv-lite/encodings/tables/cp950.json new file mode 100644 index 00000000..d8bc8717 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/tables/cp950.json @@ -0,0 +1,177 @@ +[ +["0","\u0000",127], +["a140"," ,、。.‧;:?!︰…‥﹐﹑﹒·﹔﹕﹖﹗|–︱—︳╴︴﹏()︵︶{}︷︸〔〕︹︺【】︻︼《》︽︾〈〉︿﹀「」﹁﹂『』﹃﹄﹙﹚"], +["a1a1","﹛﹜﹝﹞‘’“”〝〞‵′#&*※§〃○●△▲◎☆★◇◆□■▽▼㊣℅¯ ̄_ˍ﹉﹊﹍﹎﹋﹌﹟﹠﹡+-×÷±√<>=≦≧≠∞≒≡﹢",4,"~∩∪⊥∠∟⊿㏒㏑∫∮∵∴♀♂⊕⊙↑↓←→↖↗↙↘∥∣/"], +["a240","\∕﹨$¥〒¢£%@℃℉﹩﹪﹫㏕㎜㎝㎞㏎㎡㎎㎏㏄°兙兛兞兝兡兣嗧瓩糎▁",7,"▏▎▍▌▋▊▉┼┴┬┤├▔─│▕┌┐└┘╭"], +["a2a1","╮╰╯═╞╪╡◢◣◥◤╱╲╳0",9,"Ⅰ",9,"〡",8,"十卄卅A",25,"a",21], +["a340","wxyzΑ",16,"Σ",6,"α",16,"σ",6,"ㄅ",10], +["a3a1","ㄐ",25,"˙ˉˊˇˋ"], +["a3e1","€"], +["a440","一乙丁七乃九了二人儿入八几刀刁力匕十卜又三下丈上丫丸凡久么也乞于亡兀刃勺千叉口土士夕大女子孑孓寸小尢尸山川工己已巳巾干廾弋弓才"], +["a4a1","丑丐不中丰丹之尹予云井互五亢仁什仃仆仇仍今介仄元允內六兮公冗凶分切刈勻勾勿化匹午升卅卞厄友及反壬天夫太夭孔少尤尺屯巴幻廿弔引心戈戶手扎支文斗斤方日曰月木欠止歹毋比毛氏水火爪父爻片牙牛犬王丙"], +["a540","世丕且丘主乍乏乎以付仔仕他仗代令仙仞充兄冉冊冬凹出凸刊加功包匆北匝仟半卉卡占卯卮去可古右召叮叩叨叼司叵叫另只史叱台句叭叻四囚外"], +["a5a1","央失奴奶孕它尼巨巧左市布平幼弁弘弗必戊打扔扒扑斥旦朮本未末札正母民氐永汁汀氾犯玄玉瓜瓦甘生用甩田由甲申疋白皮皿目矛矢石示禾穴立丞丟乒乓乩亙交亦亥仿伉伙伊伕伍伐休伏仲件任仰仳份企伋光兇兆先全"], +["a640","共再冰列刑划刎刖劣匈匡匠印危吉吏同吊吐吁吋各向名合吃后吆吒因回囝圳地在圭圬圯圩夙多夷夸妄奸妃好她如妁字存宇守宅安寺尖屹州帆并年"], +["a6a1","式弛忙忖戎戌戍成扣扛托收早旨旬旭曲曳有朽朴朱朵次此死氖汝汗汙江池汐汕污汛汍汎灰牟牝百竹米糸缶羊羽老考而耒耳聿肉肋肌臣自至臼舌舛舟艮色艾虫血行衣西阡串亨位住佇佗佞伴佛何估佐佑伽伺伸佃佔似但佣"], +["a740","作你伯低伶余佝佈佚兌克免兵冶冷別判利刪刨劫助努劬匣即卵吝吭吞吾否呎吧呆呃吳呈呂君吩告吹吻吸吮吵吶吠吼呀吱含吟听囪困囤囫坊坑址坍"], +["a7a1","均坎圾坐坏圻壯夾妝妒妨妞妣妙妖妍妤妓妊妥孝孜孚孛完宋宏尬局屁尿尾岐岑岔岌巫希序庇床廷弄弟彤形彷役忘忌志忍忱快忸忪戒我抄抗抖技扶抉扭把扼找批扳抒扯折扮投抓抑抆改攻攸旱更束李杏材村杜杖杞杉杆杠"], +["a840","杓杗步每求汞沙沁沈沉沅沛汪決沐汰沌汨沖沒汽沃汲汾汴沆汶沍沔沘沂灶灼災灸牢牡牠狄狂玖甬甫男甸皂盯矣私秀禿究系罕肖肓肝肘肛肚育良芒"], +["a8a1","芋芍見角言谷豆豕貝赤走足身車辛辰迂迆迅迄巡邑邢邪邦那酉釆里防阮阱阪阬並乖乳事些亞享京佯依侍佳使佬供例來侃佰併侈佩佻侖佾侏侑佺兔兒兕兩具其典冽函刻券刷刺到刮制剁劾劻卒協卓卑卦卷卸卹取叔受味呵"], +["a940","咖呸咕咀呻呷咄咒咆呼咐呱呶和咚呢周咋命咎固垃坷坪坩坡坦坤坼夜奉奇奈奄奔妾妻委妹妮姑姆姐姍始姓姊妯妳姒姅孟孤季宗定官宜宙宛尚屈居"], +["a9a1","屆岷岡岸岩岫岱岳帘帚帖帕帛帑幸庚店府底庖延弦弧弩往征彿彼忝忠忽念忿怏怔怯怵怖怪怕怡性怩怫怛或戕房戾所承拉拌拄抿拂抹拒招披拓拔拋拈抨抽押拐拙拇拍抵拚抱拘拖拗拆抬拎放斧於旺昔易昌昆昂明昀昏昕昊"], +["aa40","昇服朋杭枋枕東果杳杷枇枝林杯杰板枉松析杵枚枓杼杪杲欣武歧歿氓氛泣注泳沱泌泥河沽沾沼波沫法泓沸泄油況沮泗泅泱沿治泡泛泊沬泯泜泖泠"], +["aaa1","炕炎炒炊炙爬爭爸版牧物狀狎狙狗狐玩玨玟玫玥甽疝疙疚的盂盲直知矽社祀祁秉秈空穹竺糾罔羌羋者肺肥肢肱股肫肩肴肪肯臥臾舍芳芝芙芭芽芟芹花芬芥芯芸芣芰芾芷虎虱初表軋迎返近邵邸邱邶采金長門阜陀阿阻附"], +["ab40","陂隹雨青非亟亭亮信侵侯便俠俑俏保促侶俘俟俊俗侮俐俄係俚俎俞侷兗冒冑冠剎剃削前剌剋則勇勉勃勁匍南卻厚叛咬哀咨哎哉咸咦咳哇哂咽咪品"], +["aba1","哄哈咯咫咱咻咩咧咿囿垂型垠垣垢城垮垓奕契奏奎奐姜姘姿姣姨娃姥姪姚姦威姻孩宣宦室客宥封屎屏屍屋峙峒巷帝帥帟幽庠度建弈弭彥很待徊律徇後徉怒思怠急怎怨恍恰恨恢恆恃恬恫恪恤扁拜挖按拼拭持拮拽指拱拷"], +["ac40","拯括拾拴挑挂政故斫施既春昭映昧是星昨昱昤曷柿染柱柔某柬架枯柵柩柯柄柑枴柚查枸柏柞柳枰柙柢柝柒歪殃殆段毒毗氟泉洋洲洪流津洌洱洞洗"], +["aca1","活洽派洶洛泵洹洧洸洩洮洵洎洫炫為炳炬炯炭炸炮炤爰牲牯牴狩狠狡玷珊玻玲珍珀玳甚甭畏界畎畋疫疤疥疢疣癸皆皇皈盈盆盃盅省盹相眉看盾盼眇矜砂研砌砍祆祉祈祇禹禺科秒秋穿突竿竽籽紂紅紀紉紇約紆缸美羿耄"], +["ad40","耐耍耑耶胖胥胚胃胄背胡胛胎胞胤胝致舢苧范茅苣苛苦茄若茂茉苒苗英茁苜苔苑苞苓苟苯茆虐虹虻虺衍衫要觔計訂訃貞負赴赳趴軍軌述迦迢迪迥"], +["ada1","迭迫迤迨郊郎郁郃酋酊重閂限陋陌降面革韋韭音頁風飛食首香乘亳倌倍倣俯倦倥俸倩倖倆值借倚倒們俺倀倔倨俱倡個候倘俳修倭倪俾倫倉兼冤冥冢凍凌准凋剖剜剔剛剝匪卿原厝叟哨唐唁唷哼哥哲唆哺唔哩哭員唉哮哪"], +["ae40","哦唧唇哽唏圃圄埂埔埋埃堉夏套奘奚娑娘娜娟娛娓姬娠娣娩娥娌娉孫屘宰害家宴宮宵容宸射屑展屐峭峽峻峪峨峰島崁峴差席師庫庭座弱徒徑徐恙"], +["aea1","恣恥恐恕恭恩息悄悟悚悍悔悌悅悖扇拳挈拿捎挾振捕捂捆捏捉挺捐挽挪挫挨捍捌效敉料旁旅時晉晏晃晒晌晅晁書朔朕朗校核案框桓根桂桔栩梳栗桌桑栽柴桐桀格桃株桅栓栘桁殊殉殷氣氧氨氦氤泰浪涕消涇浦浸海浙涓"], +["af40","浬涉浮浚浴浩涌涊浹涅浥涔烊烘烤烙烈烏爹特狼狹狽狸狷玆班琉珮珠珪珞畔畝畜畚留疾病症疲疳疽疼疹痂疸皋皰益盍盎眩真眠眨矩砰砧砸砝破砷"], +["afa1","砥砭砠砟砲祕祐祠祟祖神祝祗祚秤秣秧租秦秩秘窄窈站笆笑粉紡紗紋紊素索純紐紕級紜納紙紛缺罟羔翅翁耆耘耕耙耗耽耿胱脂胰脅胭胴脆胸胳脈能脊胼胯臭臬舀舐航舫舨般芻茫荒荔荊茸荐草茵茴荏茲茹茶茗荀茱茨荃"], +["b040","虔蚊蚪蚓蚤蚩蚌蚣蚜衰衷袁袂衽衹記訐討訌訕訊託訓訖訏訑豈豺豹財貢起躬軒軔軏辱送逆迷退迺迴逃追逅迸邕郡郝郢酒配酌釘針釗釜釙閃院陣陡"], +["b0a1","陛陝除陘陞隻飢馬骨高鬥鬲鬼乾偺偽停假偃偌做偉健偶偎偕偵側偷偏倏偯偭兜冕凰剪副勒務勘動匐匏匙匿區匾參曼商啪啦啄啞啡啃啊唱啖問啕唯啤唸售啜唬啣唳啁啗圈國圉域堅堊堆埠埤基堂堵執培夠奢娶婁婉婦婪婀"], +["b140","娼婢婚婆婊孰寇寅寄寂宿密尉專將屠屜屝崇崆崎崛崖崢崑崩崔崙崤崧崗巢常帶帳帷康庸庶庵庾張強彗彬彩彫得徙從徘御徠徜恿患悉悠您惋悴惦悽"], +["b1a1","情悻悵惜悼惘惕惆惟悸惚惇戚戛扈掠控捲掖探接捷捧掘措捱掩掉掃掛捫推掄授掙採掬排掏掀捻捩捨捺敝敖救教敗啟敏敘敕敔斜斛斬族旋旌旎晝晚晤晨晦晞曹勗望梁梯梢梓梵桿桶梱梧梗械梃棄梭梆梅梔條梨梟梡梂欲殺"], +["b240","毫毬氫涎涼淳淙液淡淌淤添淺清淇淋涯淑涮淞淹涸混淵淅淒渚涵淚淫淘淪深淮淨淆淄涪淬涿淦烹焉焊烽烯爽牽犁猜猛猖猓猙率琅琊球理現琍瓠瓶"], +["b2a1","瓷甜產略畦畢異疏痔痕疵痊痍皎盔盒盛眷眾眼眶眸眺硫硃硎祥票祭移窒窕笠笨笛第符笙笞笮粒粗粕絆絃統紮紹紼絀細紳組累終紲紱缽羞羚翌翎習耜聊聆脯脖脣脫脩脰脤舂舵舷舶船莎莞莘荸莢莖莽莫莒莊莓莉莠荷荻荼"], +["b340","莆莧處彪蛇蛀蚶蛄蚵蛆蛋蚱蚯蛉術袞袈被袒袖袍袋覓規訪訝訣訥許設訟訛訢豉豚販責貫貨貪貧赧赦趾趺軛軟這逍通逗連速逝逐逕逞造透逢逖逛途"], +["b3a1","部郭都酗野釵釦釣釧釭釩閉陪陵陳陸陰陴陶陷陬雀雪雩章竟頂頃魚鳥鹵鹿麥麻傢傍傅備傑傀傖傘傚最凱割剴創剩勞勝勛博厥啻喀喧啼喊喝喘喂喜喪喔喇喋喃喳單喟唾喲喚喻喬喱啾喉喫喙圍堯堪場堤堰報堡堝堠壹壺奠"], +["b440","婷媚婿媒媛媧孳孱寒富寓寐尊尋就嵌嵐崴嵇巽幅帽幀幃幾廊廁廂廄弼彭復循徨惑惡悲悶惠愜愣惺愕惰惻惴慨惱愎惶愉愀愒戟扉掣掌描揀揩揉揆揍"], +["b4a1","插揣提握揖揭揮捶援揪換摒揚揹敞敦敢散斑斐斯普晰晴晶景暑智晾晷曾替期朝棺棕棠棘棗椅棟棵森棧棹棒棲棣棋棍植椒椎棉棚楮棻款欺欽殘殖殼毯氮氯氬港游湔渡渲湧湊渠渥渣減湛湘渤湖湮渭渦湯渴湍渺測湃渝渾滋"], +["b540","溉渙湎湣湄湲湩湟焙焚焦焰無然煮焜牌犄犀猶猥猴猩琺琪琳琢琥琵琶琴琯琛琦琨甥甦畫番痢痛痣痙痘痞痠登發皖皓皴盜睏短硝硬硯稍稈程稅稀窘"], +["b5a1","窗窖童竣等策筆筐筒答筍筋筏筑粟粥絞結絨絕紫絮絲絡給絢絰絳善翔翕耋聒肅腕腔腋腑腎脹腆脾腌腓腴舒舜菩萃菸萍菠菅萋菁華菱菴著萊菰萌菌菽菲菊萸萎萄菜萇菔菟虛蛟蛙蛭蛔蛛蛤蛐蛞街裁裂袱覃視註詠評詞証詁"], +["b640","詔詛詐詆訴診訶詖象貂貯貼貳貽賁費賀貴買貶貿貸越超趁跎距跋跚跑跌跛跆軻軸軼辜逮逵週逸進逶鄂郵鄉郾酣酥量鈔鈕鈣鈉鈞鈍鈐鈇鈑閔閏開閑"], +["b6a1","間閒閎隊階隋陽隅隆隍陲隄雁雅雄集雇雯雲韌項順須飧飪飯飩飲飭馮馭黃黍黑亂傭債傲傳僅傾催傷傻傯僇剿剷剽募勦勤勢勣匯嗟嗨嗓嗦嗎嗜嗇嗑嗣嗤嗯嗚嗡嗅嗆嗥嗉園圓塞塑塘塗塚塔填塌塭塊塢塒塋奧嫁嫉嫌媾媽媼"], +["b740","媳嫂媲嵩嵯幌幹廉廈弒彙徬微愚意慈感想愛惹愁愈慎慌慄慍愾愴愧愍愆愷戡戢搓搾搞搪搭搽搬搏搜搔損搶搖搗搆敬斟新暗暉暇暈暖暄暘暍會榔業"], +["b7a1","楚楷楠楔極椰概楊楨楫楞楓楹榆楝楣楛歇歲毀殿毓毽溢溯滓溶滂源溝滇滅溥溘溼溺溫滑準溜滄滔溪溧溴煎煙煩煤煉照煜煬煦煌煥煞煆煨煖爺牒猷獅猿猾瑯瑚瑕瑟瑞瑁琿瑙瑛瑜當畸瘀痰瘁痲痱痺痿痴痳盞盟睛睫睦睞督"], +["b840","睹睪睬睜睥睨睢矮碎碰碗碘碌碉硼碑碓硿祺祿禁萬禽稜稚稠稔稟稞窟窠筷節筠筮筧粱粳粵經絹綑綁綏絛置罩罪署義羨群聖聘肆肄腱腰腸腥腮腳腫"], +["b8a1","腹腺腦舅艇蒂葷落萱葵葦葫葉葬葛萼萵葡董葩葭葆虞虜號蛹蜓蜈蜇蜀蛾蛻蜂蜃蜆蜊衙裟裔裙補裘裝裡裊裕裒覜解詫該詳試詩詰誇詼詣誠話誅詭詢詮詬詹詻訾詨豢貊貉賊資賈賄貲賃賂賅跡跟跨路跳跺跪跤跦躲較載軾輊"], +["b940","辟農運遊道遂達逼違遐遇遏過遍遑逾遁鄒鄗酬酪酩釉鈷鉗鈸鈽鉀鈾鉛鉋鉤鉑鈴鉉鉍鉅鈹鈿鉚閘隘隔隕雍雋雉雊雷電雹零靖靴靶預頑頓頊頒頌飼飴"], +["b9a1","飽飾馳馱馴髡鳩麂鼎鼓鼠僧僮僥僖僭僚僕像僑僱僎僩兢凳劃劂匱厭嗾嘀嘛嘗嗽嘔嘆嘉嘍嘎嗷嘖嘟嘈嘐嗶團圖塵塾境墓墊塹墅塽壽夥夢夤奪奩嫡嫦嫩嫗嫖嫘嫣孵寞寧寡寥實寨寢寤察對屢嶄嶇幛幣幕幗幔廓廖弊彆彰徹慇"], +["ba40","愿態慷慢慣慟慚慘慵截撇摘摔撤摸摟摺摑摧搴摭摻敲斡旗旖暢暨暝榜榨榕槁榮槓構榛榷榻榫榴槐槍榭槌榦槃榣歉歌氳漳演滾漓滴漩漾漠漬漏漂漢"], +["baa1","滿滯漆漱漸漲漣漕漫漯澈漪滬漁滲滌滷熔熙煽熊熄熒爾犒犖獄獐瑤瑣瑪瑰瑭甄疑瘧瘍瘋瘉瘓盡監瞄睽睿睡磁碟碧碳碩碣禎福禍種稱窪窩竭端管箕箋筵算箝箔箏箸箇箄粹粽精綻綰綜綽綾綠緊綴網綱綺綢綿綵綸維緒緇綬"], +["bb40","罰翠翡翟聞聚肇腐膀膏膈膊腿膂臧臺與舔舞艋蓉蒿蓆蓄蒙蒞蒲蒜蓋蒸蓀蓓蒐蒼蓑蓊蜿蜜蜻蜢蜥蜴蜘蝕蜷蜩裳褂裴裹裸製裨褚裯誦誌語誣認誡誓誤"], +["bba1","說誥誨誘誑誚誧豪貍貌賓賑賒赫趙趕跼輔輒輕輓辣遠遘遜遣遙遞遢遝遛鄙鄘鄞酵酸酷酴鉸銀銅銘銖鉻銓銜銨鉼銑閡閨閩閣閥閤隙障際雌雒需靼鞅韶頗領颯颱餃餅餌餉駁骯骰髦魁魂鳴鳶鳳麼鼻齊億儀僻僵價儂儈儉儅凜"], +["bc40","劇劈劉劍劊勰厲嘮嘻嘹嘲嘿嘴嘩噓噎噗噴嘶嘯嘰墀墟增墳墜墮墩墦奭嬉嫻嬋嫵嬌嬈寮寬審寫層履嶝嶔幢幟幡廢廚廟廝廣廠彈影德徵慶慧慮慝慕憂"], +["bca1","慼慰慫慾憧憐憫憎憬憚憤憔憮戮摩摯摹撞撲撈撐撰撥撓撕撩撒撮播撫撚撬撙撢撳敵敷數暮暫暴暱樣樟槨樁樞標槽模樓樊槳樂樅槭樑歐歎殤毅毆漿潼澄潑潦潔澆潭潛潸潮澎潺潰潤澗潘滕潯潠潟熟熬熱熨牖犛獎獗瑩璋璃"], +["bd40","瑾璀畿瘠瘩瘟瘤瘦瘡瘢皚皺盤瞎瞇瞌瞑瞋磋磅確磊碾磕碼磐稿稼穀稽稷稻窯窮箭箱範箴篆篇篁箠篌糊締練緯緻緘緬緝編緣線緞緩綞緙緲緹罵罷羯"], +["bda1","翩耦膛膜膝膠膚膘蔗蔽蔚蓮蔬蔭蔓蔑蔣蔡蔔蓬蔥蓿蔆螂蝴蝶蝠蝦蝸蝨蝙蝗蝌蝓衛衝褐複褒褓褕褊誼諒談諄誕請諸課諉諂調誰論諍誶誹諛豌豎豬賠賞賦賤賬賭賢賣賜質賡赭趟趣踫踐踝踢踏踩踟踡踞躺輝輛輟輩輦輪輜輞"], +["be40","輥適遮遨遭遷鄰鄭鄧鄱醇醉醋醃鋅銻銷鋪銬鋤鋁銳銼鋒鋇鋰銲閭閱霄霆震霉靠鞍鞋鞏頡頫頜颳養餓餒餘駝駐駟駛駑駕駒駙骷髮髯鬧魅魄魷魯鴆鴉"], +["bea1","鴃麩麾黎墨齒儒儘儔儐儕冀冪凝劑劓勳噙噫噹噩噤噸噪器噥噱噯噬噢噶壁墾壇壅奮嬝嬴學寰導彊憲憑憩憊懍憶憾懊懈戰擅擁擋撻撼據擄擇擂操撿擒擔撾整曆曉暹曄曇暸樽樸樺橙橫橘樹橄橢橡橋橇樵機橈歙歷氅濂澱澡"], +["bf40","濃澤濁澧澳激澹澶澦澠澴熾燉燐燒燈燕熹燎燙燜燃燄獨璜璣璘璟璞瓢甌甍瘴瘸瘺盧盥瞠瞞瞟瞥磨磚磬磧禦積穎穆穌穋窺篙簑築篤篛篡篩篦糕糖縊"], +["bfa1","縑縈縛縣縞縝縉縐罹羲翰翱翮耨膳膩膨臻興艘艙蕊蕙蕈蕨蕩蕃蕉蕭蕪蕞螃螟螞螢融衡褪褲褥褫褡親覦諦諺諫諱謀諜諧諮諾謁謂諷諭諳諶諼豫豭貓賴蹄踱踴蹂踹踵輻輯輸輳辨辦遵遴選遲遼遺鄴醒錠錶鋸錳錯錢鋼錫錄錚"], +["c040","錐錦錡錕錮錙閻隧隨險雕霎霑霖霍霓霏靛靜靦鞘頰頸頻頷頭頹頤餐館餞餛餡餚駭駢駱骸骼髻髭鬨鮑鴕鴣鴦鴨鴒鴛默黔龍龜優償儡儲勵嚎嚀嚐嚅嚇"], +["c0a1","嚏壕壓壑壎嬰嬪嬤孺尷屨嶼嶺嶽嶸幫彌徽應懂懇懦懋戲戴擎擊擘擠擰擦擬擱擢擭斂斃曙曖檀檔檄檢檜櫛檣橾檗檐檠歜殮毚氈濘濱濟濠濛濤濫濯澀濬濡濩濕濮濰燧營燮燦燥燭燬燴燠爵牆獰獲璩環璦璨癆療癌盪瞳瞪瞰瞬"], +["c140","瞧瞭矯磷磺磴磯礁禧禪穗窿簇簍篾篷簌篠糠糜糞糢糟糙糝縮績繆縷縲繃縫總縱繅繁縴縹繈縵縿縯罄翳翼聱聲聰聯聳臆臃膺臂臀膿膽臉膾臨舉艱薪"], +["c1a1","薄蕾薜薑薔薯薛薇薨薊虧蟀蟑螳蟒蟆螫螻螺蟈蟋褻褶襄褸褽覬謎謗謙講謊謠謝謄謐豁谿豳賺賽購賸賻趨蹉蹋蹈蹊轄輾轂轅輿避遽還邁邂邀鄹醣醞醜鍍鎂錨鍵鍊鍥鍋錘鍾鍬鍛鍰鍚鍔闊闋闌闈闆隱隸雖霜霞鞠韓顆颶餵騁"], +["c240","駿鮮鮫鮪鮭鴻鴿麋黏點黜黝黛鼾齋叢嚕嚮壙壘嬸彝懣戳擴擲擾攆擺擻擷斷曜朦檳檬櫃檻檸櫂檮檯歟歸殯瀉瀋濾瀆濺瀑瀏燻燼燾燸獷獵璧璿甕癖癘"], +["c2a1","癒瞽瞿瞻瞼礎禮穡穢穠竄竅簫簧簪簞簣簡糧織繕繞繚繡繒繙罈翹翻職聶臍臏舊藏薩藍藐藉薰薺薹薦蟯蟬蟲蟠覆覲觴謨謹謬謫豐贅蹙蹣蹦蹤蹟蹕軀轉轍邇邃邈醫醬釐鎔鎊鎖鎢鎳鎮鎬鎰鎘鎚鎗闔闖闐闕離雜雙雛雞霤鞣鞦"], +["c340","鞭韹額顏題顎顓颺餾餿餽餮馥騎髁鬃鬆魏魎魍鯊鯉鯽鯈鯀鵑鵝鵠黠鼕鼬儳嚥壞壟壢寵龐廬懲懷懶懵攀攏曠曝櫥櫝櫚櫓瀛瀟瀨瀚瀝瀕瀘爆爍牘犢獸"], +["c3a1","獺璽瓊瓣疇疆癟癡矇礙禱穫穩簾簿簸簽簷籀繫繭繹繩繪羅繳羶羹羸臘藩藝藪藕藤藥藷蟻蠅蠍蟹蟾襠襟襖襞譁譜識證譚譎譏譆譙贈贊蹼蹲躇蹶蹬蹺蹴轔轎辭邊邋醱醮鏡鏑鏟鏃鏈鏜鏝鏖鏢鏍鏘鏤鏗鏨關隴難霪霧靡韜韻類"], +["c440","願顛颼饅饉騖騙鬍鯨鯧鯖鯛鶉鵡鵲鵪鵬麒麗麓麴勸嚨嚷嚶嚴嚼壤孀孃孽寶巉懸懺攘攔攙曦朧櫬瀾瀰瀲爐獻瓏癢癥礦礪礬礫竇競籌籃籍糯糰辮繽繼"], +["c4a1","纂罌耀臚艦藻藹蘑藺蘆蘋蘇蘊蠔蠕襤覺觸議譬警譯譟譫贏贍躉躁躅躂醴釋鐘鐃鏽闡霰飄饒饑馨騫騰騷騵鰓鰍鹹麵黨鼯齟齣齡儷儸囁囀囂夔屬巍懼懾攝攜斕曩櫻欄櫺殲灌爛犧瓖瓔癩矓籐纏續羼蘗蘭蘚蠣蠢蠡蠟襪襬覽譴"], +["c540","護譽贓躊躍躋轟辯醺鐮鐳鐵鐺鐸鐲鐫闢霸霹露響顧顥饗驅驃驀騾髏魔魑鰭鰥鶯鶴鷂鶸麝黯鼙齜齦齧儼儻囈囊囉孿巔巒彎懿攤權歡灑灘玀瓤疊癮癬"], +["c5a1","禳籠籟聾聽臟襲襯觼讀贖贗躑躓轡酈鑄鑑鑒霽霾韃韁顫饕驕驍髒鬚鱉鰱鰾鰻鷓鷗鼴齬齪龔囌巖戀攣攫攪曬欐瓚竊籤籣籥纓纖纔臢蘸蘿蠱變邐邏鑣鑠鑤靨顯饜驚驛驗髓體髑鱔鱗鱖鷥麟黴囑壩攬灞癱癲矗罐羈蠶蠹衢讓讒"], +["c640","讖艷贛釀鑪靂靈靄韆顰驟鬢魘鱟鷹鷺鹼鹽鼇齷齲廳欖灣籬籮蠻觀躡釁鑲鑰顱饞髖鬣黌灤矚讚鑷韉驢驥纜讜躪釅鑽鑾鑼鱷鱸黷豔鑿鸚爨驪鬱鸛鸞籲"], +["c940","乂乜凵匚厂万丌乇亍囗兀屮彳丏冇与丮亓仂仉仈冘勼卬厹圠夃夬尐巿旡殳毌气爿丱丼仨仜仩仡仝仚刌匜卌圢圣夗夯宁宄尒尻屴屳帄庀庂忉戉扐氕"], +["c9a1","氶汃氿氻犮犰玊禸肊阞伎优伬仵伔仱伀价伈伝伂伅伢伓伄仴伒冱刓刉刐劦匢匟卍厊吇囡囟圮圪圴夼妀奼妅奻奾奷奿孖尕尥屼屺屻屾巟幵庄异弚彴忕忔忏扜扞扤扡扦扢扙扠扚扥旯旮朾朹朸朻机朿朼朳氘汆汒汜汏汊汔汋"], +["ca40","汌灱牞犴犵玎甪癿穵网艸艼芀艽艿虍襾邙邗邘邛邔阢阤阠阣佖伻佢佉体佤伾佧佒佟佁佘伭伳伿佡冏冹刜刞刡劭劮匉卣卲厎厏吰吷吪呔呅吙吜吥吘"], +["caa1","吽呏呁吨吤呇囮囧囥坁坅坌坉坋坒夆奀妦妘妠妗妎妢妐妏妧妡宎宒尨尪岍岏岈岋岉岒岊岆岓岕巠帊帎庋庉庌庈庍弅弝彸彶忒忑忐忭忨忮忳忡忤忣忺忯忷忻怀忴戺抃抌抎抏抔抇扱扻扺扰抁抈扷扽扲扴攷旰旴旳旲旵杅杇"], +["cb40","杙杕杌杈杝杍杚杋毐氙氚汸汧汫沄沋沏汱汯汩沚汭沇沕沜汦汳汥汻沎灴灺牣犿犽狃狆狁犺狅玕玗玓玔玒町甹疔疕皁礽耴肕肙肐肒肜芐芏芅芎芑芓"], +["cba1","芊芃芄豸迉辿邟邡邥邞邧邠阰阨阯阭丳侘佼侅佽侀侇佶佴侉侄佷佌侗佪侚佹侁佸侐侜侔侞侒侂侕佫佮冞冼冾刵刲刳剆刱劼匊匋匼厒厔咇呿咁咑咂咈呫呺呾呥呬呴呦咍呯呡呠咘呣呧呤囷囹坯坲坭坫坱坰坶垀坵坻坳坴坢"], +["cc40","坨坽夌奅妵妺姏姎妲姌姁妶妼姃姖妱妽姀姈妴姇孢孥宓宕屄屇岮岤岠岵岯岨岬岟岣岭岢岪岧岝岥岶岰岦帗帔帙弨弢弣弤彔徂彾彽忞忥怭怦怙怲怋"], +["cca1","怴怊怗怳怚怞怬怢怍怐怮怓怑怌怉怜戔戽抭抴拑抾抪抶拊抮抳抯抻抩抰抸攽斨斻昉旼昄昒昈旻昃昋昍昅旽昑昐曶朊枅杬枎枒杶杻枘枆构杴枍枌杺枟枑枙枃杽极杸杹枔欥殀歾毞氝沓泬泫泮泙沶泔沭泧沷泐泂沺泃泆泭泲"], +["cd40","泒泝沴沊沝沀泞泀洰泍泇沰泹泏泩泑炔炘炅炓炆炄炑炖炂炚炃牪狖狋狘狉狜狒狔狚狌狑玤玡玭玦玢玠玬玝瓝瓨甿畀甾疌疘皯盳盱盰盵矸矼矹矻矺"], +["cda1","矷祂礿秅穸穻竻籵糽耵肏肮肣肸肵肭舠芠苀芫芚芘芛芵芧芮芼芞芺芴芨芡芩苂芤苃芶芢虰虯虭虮豖迒迋迓迍迖迕迗邲邴邯邳邰阹阽阼阺陃俍俅俓侲俉俋俁俔俜俙侻侳俛俇俖侺俀侹俬剄剉勀勂匽卼厗厖厙厘咺咡咭咥哏"], +["ce40","哃茍咷咮哖咶哅哆咠呰咼咢咾呲哞咰垵垞垟垤垌垗垝垛垔垘垏垙垥垚垕壴复奓姡姞姮娀姱姝姺姽姼姶姤姲姷姛姩姳姵姠姾姴姭宨屌峐峘峌峗峋峛"], +["cea1","峞峚峉峇峊峖峓峔峏峈峆峎峟峸巹帡帢帣帠帤庰庤庢庛庣庥弇弮彖徆怷怹恔恲恞恅恓恇恉恛恌恀恂恟怤恄恘恦恮扂扃拏挍挋拵挎挃拫拹挏挌拸拶挀挓挔拺挕拻拰敁敃斪斿昶昡昲昵昜昦昢昳昫昺昝昴昹昮朏朐柁柲柈枺"], +["cf40","柜枻柸柘柀枷柅柫柤柟枵柍枳柷柶柮柣柂枹柎柧柰枲柼柆柭柌枮柦柛柺柉柊柃柪柋欨殂殄殶毖毘毠氠氡洨洴洭洟洼洿洒洊泚洳洄洙洺洚洑洀洝浂"], +["cfa1","洁洘洷洃洏浀洇洠洬洈洢洉洐炷炟炾炱炰炡炴炵炩牁牉牊牬牰牳牮狊狤狨狫狟狪狦狣玅珌珂珈珅玹玶玵玴珫玿珇玾珃珆玸珋瓬瓮甮畇畈疧疪癹盄眈眃眄眅眊盷盻盺矧矨砆砑砒砅砐砏砎砉砃砓祊祌祋祅祄秕种秏秖秎窀"], +["d040","穾竑笀笁籺籸籹籿粀粁紃紈紁罘羑羍羾耇耎耏耔耷胘胇胠胑胈胂胐胅胣胙胜胊胕胉胏胗胦胍臿舡芔苙苾苹茇苨茀苕茺苫苖苴苬苡苲苵茌苻苶苰苪"], +["d0a1","苤苠苺苳苭虷虴虼虳衁衎衧衪衩觓訄訇赲迣迡迮迠郱邽邿郕郅邾郇郋郈釔釓陔陏陑陓陊陎倞倅倇倓倢倰倛俵俴倳倷倬俶俷倗倜倠倧倵倯倱倎党冔冓凊凄凅凈凎剡剚剒剞剟剕剢勍匎厞唦哢唗唒哧哳哤唚哿唄唈哫唑唅哱"], +["d140","唊哻哷哸哠唎唃唋圁圂埌堲埕埒垺埆垽垼垸垶垿埇埐垹埁夎奊娙娖娭娮娕娏娗娊娞娳孬宧宭宬尃屖屔峬峿峮峱峷崀峹帩帨庨庮庪庬弳弰彧恝恚恧"], +["d1a1","恁悢悈悀悒悁悝悃悕悛悗悇悜悎戙扆拲挐捖挬捄捅挶捃揤挹捋捊挼挩捁挴捘捔捙挭捇挳捚捑挸捗捀捈敊敆旆旃旄旂晊晟晇晑朒朓栟栚桉栲栳栻桋桏栖栱栜栵栫栭栯桎桄栴栝栒栔栦栨栮桍栺栥栠欬欯欭欱欴歭肂殈毦毤"], +["d240","毨毣毢毧氥浺浣浤浶洍浡涒浘浢浭浯涑涍淯浿涆浞浧浠涗浰浼浟涂涘洯浨涋浾涀涄洖涃浻浽浵涐烜烓烑烝烋缹烢烗烒烞烠烔烍烅烆烇烚烎烡牂牸"], +["d2a1","牷牶猀狺狴狾狶狳狻猁珓珙珥珖玼珧珣珩珜珒珛珔珝珚珗珘珨瓞瓟瓴瓵甡畛畟疰痁疻痄痀疿疶疺皊盉眝眛眐眓眒眣眑眕眙眚眢眧砣砬砢砵砯砨砮砫砡砩砳砪砱祔祛祏祜祓祒祑秫秬秠秮秭秪秜秞秝窆窉窅窋窌窊窇竘笐"], +["d340","笄笓笅笏笈笊笎笉笒粄粑粊粌粈粍粅紞紝紑紎紘紖紓紟紒紏紌罜罡罞罠罝罛羖羒翃翂翀耖耾耹胺胲胹胵脁胻脀舁舯舥茳茭荄茙荑茥荖茿荁茦茜茢"], +["d3a1","荂荎茛茪茈茼荍茖茤茠茷茯茩荇荅荌荓茞茬荋茧荈虓虒蚢蚨蚖蚍蚑蚞蚇蚗蚆蚋蚚蚅蚥蚙蚡蚧蚕蚘蚎蚝蚐蚔衃衄衭衵衶衲袀衱衿衯袃衾衴衼訒豇豗豻貤貣赶赸趵趷趶軑軓迾迵适迿迻逄迼迶郖郠郙郚郣郟郥郘郛郗郜郤酐"], +["d440","酎酏釕釢釚陜陟隼飣髟鬯乿偰偪偡偞偠偓偋偝偲偈偍偁偛偊偢倕偅偟偩偫偣偤偆偀偮偳偗偑凐剫剭剬剮勖勓匭厜啵啶唼啍啐唴唪啑啢唶唵唰啒啅"], +["d4a1","唌唲啥啎唹啈唭唻啀啋圊圇埻堔埢埶埜埴堀埭埽堈埸堋埳埏堇埮埣埲埥埬埡堎埼堐埧堁堌埱埩埰堍堄奜婠婘婕婧婞娸娵婭婐婟婥婬婓婤婗婃婝婒婄婛婈媎娾婍娹婌婰婩婇婑婖婂婜孲孮寁寀屙崞崋崝崚崠崌崨崍崦崥崏"], +["d540","崰崒崣崟崮帾帴庱庴庹庲庳弶弸徛徖徟悊悐悆悾悰悺惓惔惏惤惙惝惈悱惛悷惊悿惃惍惀挲捥掊掂捽掽掞掭掝掗掫掎捯掇掐据掯捵掜捭掮捼掤挻掟"], +["d5a1","捸掅掁掑掍捰敓旍晥晡晛晙晜晢朘桹梇梐梜桭桮梮梫楖桯梣梬梩桵桴梲梏桷梒桼桫桲梪梀桱桾梛梖梋梠梉梤桸桻梑梌梊桽欶欳欷欸殑殏殍殎殌氪淀涫涴涳湴涬淩淢涷淶淔渀淈淠淟淖涾淥淜淝淛淴淊涽淭淰涺淕淂淏淉"], +["d640","淐淲淓淽淗淍淣涻烺焍烷焗烴焌烰焄烳焐烼烿焆焓焀烸烶焋焂焎牾牻牼牿猝猗猇猑猘猊猈狿猏猞玈珶珸珵琄琁珽琇琀珺珼珿琌琋珴琈畤畣痎痒痏"], +["d6a1","痋痌痑痐皏皉盓眹眯眭眱眲眴眳眽眥眻眵硈硒硉硍硊硌砦硅硐祤祧祩祪祣祫祡离秺秸秶秷窏窔窐笵筇笴笥笰笢笤笳笘笪笝笱笫笭笯笲笸笚笣粔粘粖粣紵紽紸紶紺絅紬紩絁絇紾紿絊紻紨罣羕羜羝羛翊翋翍翐翑翇翏翉耟"], +["d740","耞耛聇聃聈脘脥脙脛脭脟脬脞脡脕脧脝脢舑舸舳舺舴舲艴莐莣莨莍荺荳莤荴莏莁莕莙荵莔莩荽莃莌莝莛莪莋荾莥莯莈莗莰荿莦莇莮荶莚虙虖蚿蚷"], +["d7a1","蛂蛁蛅蚺蚰蛈蚹蚳蚸蛌蚴蚻蚼蛃蚽蚾衒袉袕袨袢袪袚袑袡袟袘袧袙袛袗袤袬袌袓袎覂觖觙觕訰訧訬訞谹谻豜豝豽貥赽赻赹趼跂趹趿跁軘軞軝軜軗軠軡逤逋逑逜逌逡郯郪郰郴郲郳郔郫郬郩酖酘酚酓酕釬釴釱釳釸釤釹釪"], +["d840","釫釷釨釮镺閆閈陼陭陫陱陯隿靪頄飥馗傛傕傔傞傋傣傃傌傎傝偨傜傒傂傇兟凔匒匑厤厧喑喨喥喭啷噅喢喓喈喏喵喁喣喒喤啽喌喦啿喕喡喎圌堩堷"], +["d8a1","堙堞堧堣堨埵塈堥堜堛堳堿堶堮堹堸堭堬堻奡媯媔媟婺媢媞婸媦婼媥媬媕媮娷媄媊媗媃媋媩婻婽媌媜媏媓媝寪寍寋寔寑寊寎尌尰崷嵃嵫嵁嵋崿崵嵑嵎嵕崳崺嵒崽崱嵙嵂崹嵉崸崼崲崶嵀嵅幄幁彘徦徥徫惉悹惌惢惎惄愔"], +["d940","惲愊愖愅惵愓惸惼惾惁愃愘愝愐惿愄愋扊掔掱掰揎揥揨揯揃撝揳揊揠揶揕揲揵摡揟掾揝揜揄揘揓揂揇揌揋揈揰揗揙攲敧敪敤敜敨敥斌斝斞斮旐旒"], +["d9a1","晼晬晻暀晱晹晪晲朁椌棓椄棜椪棬棪棱椏棖棷棫棤棶椓椐棳棡椇棌椈楰梴椑棯棆椔棸棐棽棼棨椋椊椗棎棈棝棞棦棴棑椆棔棩椕椥棇欹欻欿欼殔殗殙殕殽毰毲毳氰淼湆湇渟湉溈渼渽湅湢渫渿湁湝湳渜渳湋湀湑渻渃渮湞"], +["da40","湨湜湡渱渨湠湱湫渹渢渰湓湥渧湸湤湷湕湹湒湦渵渶湚焠焞焯烻焮焱焣焥焢焲焟焨焺焛牋牚犈犉犆犅犋猒猋猰猢猱猳猧猲猭猦猣猵猌琮琬琰琫琖"], +["daa1","琚琡琭琱琤琣琝琩琠琲瓻甯畯畬痧痚痡痦痝痟痤痗皕皒盚睆睇睄睍睅睊睎睋睌矞矬硠硤硥硜硭硱硪确硰硩硨硞硢祴祳祲祰稂稊稃稌稄窙竦竤筊笻筄筈筌筎筀筘筅粢粞粨粡絘絯絣絓絖絧絪絏絭絜絫絒絔絩絑絟絎缾缿罥"], +["db40","罦羢羠羡翗聑聏聐胾胔腃腊腒腏腇脽腍脺臦臮臷臸臹舄舼舽舿艵茻菏菹萣菀菨萒菧菤菼菶萐菆菈菫菣莿萁菝菥菘菿菡菋菎菖菵菉萉萏菞萑萆菂菳"], +["dba1","菕菺菇菑菪萓菃菬菮菄菻菗菢萛菛菾蛘蛢蛦蛓蛣蛚蛪蛝蛫蛜蛬蛩蛗蛨蛑衈衖衕袺裗袹袸裀袾袶袼袷袽袲褁裉覕覘覗觝觚觛詎詍訹詙詀詗詘詄詅詒詈詑詊詌詏豟貁貀貺貾貰貹貵趄趀趉跘跓跍跇跖跜跏跕跙跈跗跅軯軷軺"], +["dc40","軹軦軮軥軵軧軨軶軫軱軬軴軩逭逴逯鄆鄬鄄郿郼鄈郹郻鄁鄀鄇鄅鄃酡酤酟酢酠鈁鈊鈥鈃鈚鈦鈏鈌鈀鈒釿釽鈆鈄鈧鈂鈜鈤鈙鈗鈅鈖镻閍閌閐隇陾隈"], +["dca1","隉隃隀雂雈雃雱雰靬靰靮頇颩飫鳦黹亃亄亶傽傿僆傮僄僊傴僈僂傰僁傺傱僋僉傶傸凗剺剸剻剼嗃嗛嗌嗐嗋嗊嗝嗀嗔嗄嗩喿嗒喍嗏嗕嗢嗖嗈嗲嗍嗙嗂圔塓塨塤塏塍塉塯塕塎塝塙塥塛堽塣塱壼嫇嫄嫋媺媸媱媵媰媿嫈媻嫆"], +["dd40","媷嫀嫊媴媶嫍媹媐寖寘寙尟尳嵱嵣嵊嵥嵲嵬嵞嵨嵧嵢巰幏幎幊幍幋廅廌廆廋廇彀徯徭惷慉慊愫慅愶愲愮慆愯慏愩慀戠酨戣戥戤揅揱揫搐搒搉搠搤"], +["dda1","搳摃搟搕搘搹搷搢搣搌搦搰搨摁搵搯搊搚摀搥搧搋揧搛搮搡搎敯斒旓暆暌暕暐暋暊暙暔晸朠楦楟椸楎楢楱椿楅楪椹楂楗楙楺楈楉椵楬椳椽楥棰楸椴楩楀楯楄楶楘楁楴楌椻楋椷楜楏楑椲楒椯楻椼歆歅歃歂歈歁殛嗀毻毼"], +["de40","毹毷毸溛滖滈溏滀溟溓溔溠溱溹滆滒溽滁溞滉溷溰滍溦滏溲溾滃滜滘溙溒溎溍溤溡溿溳滐滊溗溮溣煇煔煒煣煠煁煝煢煲煸煪煡煂煘煃煋煰煟煐煓"], +["dea1","煄煍煚牏犍犌犑犐犎猼獂猻猺獀獊獉瑄瑊瑋瑒瑑瑗瑀瑏瑐瑎瑂瑆瑍瑔瓡瓿瓾瓽甝畹畷榃痯瘏瘃痷痾痼痹痸瘐痻痶痭痵痽皙皵盝睕睟睠睒睖睚睩睧睔睙睭矠碇碚碔碏碄碕碅碆碡碃硹碙碀碖硻祼禂祽祹稑稘稙稒稗稕稢稓"], +["df40","稛稐窣窢窞竫筦筤筭筴筩筲筥筳筱筰筡筸筶筣粲粴粯綈綆綀綍絿綅絺綎絻綃絼綌綔綄絽綒罭罫罧罨罬羦羥羧翛翜耡腤腠腷腜腩腛腢腲朡腞腶腧腯"], +["dfa1","腄腡舝艉艄艀艂艅蓱萿葖葶葹蒏蒍葥葑葀蒆葧萰葍葽葚葙葴葳葝蔇葞萷萺萴葺葃葸萲葅萩菙葋萯葂萭葟葰萹葎葌葒葯蓅蒎萻葇萶萳葨葾葄萫葠葔葮葐蜋蜄蛷蜌蛺蛖蛵蝍蛸蜎蜉蜁蛶蜍蜅裖裋裍裎裞裛裚裌裐覅覛觟觥觤"], +["e040","觡觠觢觜触詶誆詿詡訿詷誂誄詵誃誁詴詺谼豋豊豥豤豦貆貄貅賌赨赩趑趌趎趏趍趓趔趐趒跰跠跬跱跮跐跩跣跢跧跲跫跴輆軿輁輀輅輇輈輂輋遒逿"], +["e0a1","遄遉逽鄐鄍鄏鄑鄖鄔鄋鄎酮酯鉈鉒鈰鈺鉦鈳鉥鉞銃鈮鉊鉆鉭鉬鉏鉠鉧鉯鈶鉡鉰鈱鉔鉣鉐鉲鉎鉓鉌鉖鈲閟閜閞閛隒隓隑隗雎雺雽雸雵靳靷靸靲頏頍頎颬飶飹馯馲馰馵骭骫魛鳪鳭鳧麀黽僦僔僗僨僳僛僪僝僤僓僬僰僯僣僠"], +["e140","凘劀劁勩勫匰厬嘧嘕嘌嘒嗼嘏嘜嘁嘓嘂嗺嘝嘄嗿嗹墉塼墐墘墆墁塿塴墋塺墇墑墎塶墂墈塻墔墏壾奫嫜嫮嫥嫕嫪嫚嫭嫫嫳嫢嫠嫛嫬嫞嫝嫙嫨嫟孷寠"], +["e1a1","寣屣嶂嶀嵽嶆嵺嶁嵷嶊嶉嶈嵾嵼嶍嵹嵿幘幙幓廘廑廗廎廜廕廙廒廔彄彃彯徶愬愨慁慞慱慳慒慓慲慬憀慴慔慺慛慥愻慪慡慖戩戧戫搫摍摛摝摴摶摲摳摽摵摦撦摎撂摞摜摋摓摠摐摿搿摬摫摙摥摷敳斠暡暠暟朅朄朢榱榶槉"], +["e240","榠槎榖榰榬榼榑榙榎榧榍榩榾榯榿槄榽榤槔榹槊榚槏榳榓榪榡榞槙榗榐槂榵榥槆歊歍歋殞殟殠毃毄毾滎滵滱漃漥滸漷滻漮漉潎漙漚漧漘漻漒滭漊"], +["e2a1","漶潳滹滮漭潀漰漼漵滫漇漎潃漅滽滶漹漜滼漺漟漍漞漈漡熇熐熉熀熅熂熏煻熆熁熗牄牓犗犕犓獃獍獑獌瑢瑳瑱瑵瑲瑧瑮甀甂甃畽疐瘖瘈瘌瘕瘑瘊瘔皸瞁睼瞅瞂睮瞀睯睾瞃碲碪碴碭碨硾碫碞碥碠碬碢碤禘禊禋禖禕禔禓"], +["e340","禗禈禒禐稫穊稰稯稨稦窨窫窬竮箈箜箊箑箐箖箍箌箛箎箅箘劄箙箤箂粻粿粼粺綧綷緂綣綪緁緀緅綝緎緄緆緋緌綯綹綖綼綟綦綮綩綡緉罳翢翣翥翞"], +["e3a1","耤聝聜膉膆膃膇膍膌膋舕蒗蒤蒡蒟蒺蓎蓂蒬蒮蒫蒹蒴蓁蓍蒪蒚蒱蓐蒝蒧蒻蒢蒔蓇蓌蒛蒩蒯蒨蓖蒘蒶蓏蒠蓗蓔蓒蓛蒰蒑虡蜳蜣蜨蝫蝀蜮蜞蜡蜙蜛蝃蜬蝁蜾蝆蜠蜲蜪蜭蜼蜒蜺蜱蜵蝂蜦蜧蜸蜤蜚蜰蜑裷裧裱裲裺裾裮裼裶裻"], +["e440","裰裬裫覝覡覟覞觩觫觨誫誙誋誒誏誖谽豨豩賕賏賗趖踉踂跿踍跽踊踃踇踆踅跾踀踄輐輑輎輍鄣鄜鄠鄢鄟鄝鄚鄤鄡鄛酺酲酹酳銥銤鉶銛鉺銠銔銪銍"], +["e4a1","銦銚銫鉹銗鉿銣鋮銎銂銕銢鉽銈銡銊銆銌銙銧鉾銇銩銝銋鈭隞隡雿靘靽靺靾鞃鞀鞂靻鞄鞁靿韎韍頖颭颮餂餀餇馝馜駃馹馻馺駂馽駇骱髣髧鬾鬿魠魡魟鳱鳲鳵麧僿儃儰僸儆儇僶僾儋儌僽儊劋劌勱勯噈噂噌嘵噁噊噉噆噘"], +["e540","噚噀嘳嘽嘬嘾嘸嘪嘺圚墫墝墱墠墣墯墬墥墡壿嫿嫴嫽嫷嫶嬃嫸嬂嫹嬁嬇嬅嬏屧嶙嶗嶟嶒嶢嶓嶕嶠嶜嶡嶚嶞幩幝幠幜緳廛廞廡彉徲憋憃慹憱憰憢憉"], +["e5a1","憛憓憯憭憟憒憪憡憍慦憳戭摮摰撖撠撅撗撜撏撋撊撌撣撟摨撱撘敶敺敹敻斲斳暵暰暩暲暷暪暯樀樆樗槥槸樕槱槤樠槿槬槢樛樝槾樧槲槮樔槷槧橀樈槦槻樍槼槫樉樄樘樥樏槶樦樇槴樖歑殥殣殢殦氁氀毿氂潁漦潾澇濆澒"], +["e640","澍澉澌潢潏澅潚澖潶潬澂潕潲潒潐潗澔澓潝漀潡潫潽潧澐潓澋潩潿澕潣潷潪潻熲熯熛熰熠熚熩熵熝熥熞熤熡熪熜熧熳犘犚獘獒獞獟獠獝獛獡獚獙"], +["e6a1","獢璇璉璊璆璁瑽璅璈瑼瑹甈甇畾瘥瘞瘙瘝瘜瘣瘚瘨瘛皜皝皞皛瞍瞏瞉瞈磍碻磏磌磑磎磔磈磃磄磉禚禡禠禜禢禛歶稹窲窴窳箷篋箾箬篎箯箹篊箵糅糈糌糋緷緛緪緧緗緡縃緺緦緶緱緰緮緟罶羬羰羭翭翫翪翬翦翨聤聧膣膟"], +["e740","膞膕膢膙膗舖艏艓艒艐艎艑蔤蔻蔏蔀蔩蔎蔉蔍蔟蔊蔧蔜蓻蔫蓺蔈蔌蓴蔪蓲蔕蓷蓫蓳蓼蔒蓪蓩蔖蓾蔨蔝蔮蔂蓽蔞蓶蔱蔦蓧蓨蓰蓯蓹蔘蔠蔰蔋蔙蔯虢"], +["e7a1","蝖蝣蝤蝷蟡蝳蝘蝔蝛蝒蝡蝚蝑蝞蝭蝪蝐蝎蝟蝝蝯蝬蝺蝮蝜蝥蝏蝻蝵蝢蝧蝩衚褅褌褔褋褗褘褙褆褖褑褎褉覢覤覣觭觰觬諏諆誸諓諑諔諕誻諗誾諀諅諘諃誺誽諙谾豍貏賥賟賙賨賚賝賧趠趜趡趛踠踣踥踤踮踕踛踖踑踙踦踧"], +["e840","踔踒踘踓踜踗踚輬輤輘輚輠輣輖輗遳遰遯遧遫鄯鄫鄩鄪鄲鄦鄮醅醆醊醁醂醄醀鋐鋃鋄鋀鋙銶鋏鋱鋟鋘鋩鋗鋝鋌鋯鋂鋨鋊鋈鋎鋦鋍鋕鋉鋠鋞鋧鋑鋓"], +["e8a1","銵鋡鋆銴镼閬閫閮閰隤隢雓霅霈霂靚鞊鞎鞈韐韏頞頝頦頩頨頠頛頧颲餈飺餑餔餖餗餕駜駍駏駓駔駎駉駖駘駋駗駌骳髬髫髳髲髱魆魃魧魴魱魦魶魵魰魨魤魬鳼鳺鳽鳿鳷鴇鴀鳹鳻鴈鴅鴄麃黓鼏鼐儜儓儗儚儑凞匴叡噰噠噮"], +["e940","噳噦噣噭噲噞噷圜圛壈墽壉墿墺壂墼壆嬗嬙嬛嬡嬔嬓嬐嬖嬨嬚嬠嬞寯嶬嶱嶩嶧嶵嶰嶮嶪嶨嶲嶭嶯嶴幧幨幦幯廩廧廦廨廥彋徼憝憨憖懅憴懆懁懌憺"], +["e9a1","憿憸憌擗擖擐擏擉撽撉擃擛擳擙攳敿敼斢曈暾曀曊曋曏暽暻暺曌朣樴橦橉橧樲橨樾橝橭橶橛橑樨橚樻樿橁橪橤橐橏橔橯橩橠樼橞橖橕橍橎橆歕歔歖殧殪殫毈毇氄氃氆澭濋澣濇澼濎濈潞濄澽澞濊澨瀄澥澮澺澬澪濏澿澸"], +["ea40","澢濉澫濍澯澲澰燅燂熿熸燖燀燁燋燔燊燇燏熽燘熼燆燚燛犝犞獩獦獧獬獥獫獪瑿璚璠璔璒璕璡甋疀瘯瘭瘱瘽瘳瘼瘵瘲瘰皻盦瞚瞝瞡瞜瞛瞢瞣瞕瞙"], +["eaa1","瞗磝磩磥磪磞磣磛磡磢磭磟磠禤穄穈穇窶窸窵窱窷篞篣篧篝篕篥篚篨篹篔篪篢篜篫篘篟糒糔糗糐糑縒縡縗縌縟縠縓縎縜縕縚縢縋縏縖縍縔縥縤罃罻罼罺羱翯耪耩聬膱膦膮膹膵膫膰膬膴膲膷膧臲艕艖艗蕖蕅蕫蕍蕓蕡蕘"], +["eb40","蕀蕆蕤蕁蕢蕄蕑蕇蕣蔾蕛蕱蕎蕮蕵蕕蕧蕠薌蕦蕝蕔蕥蕬虣虥虤螛螏螗螓螒螈螁螖螘蝹螇螣螅螐螑螝螄螔螜螚螉褞褦褰褭褮褧褱褢褩褣褯褬褟觱諠"], +["eba1","諢諲諴諵諝謔諤諟諰諈諞諡諨諿諯諻貑貒貐賵賮賱賰賳赬赮趥趧踳踾踸蹀蹅踶踼踽蹁踰踿躽輶輮輵輲輹輷輴遶遹遻邆郺鄳鄵鄶醓醐醑醍醏錧錞錈錟錆錏鍺錸錼錛錣錒錁鍆錭錎錍鋋錝鋺錥錓鋹鋷錴錂錤鋿錩錹錵錪錔錌"], +["ec40","錋鋾錉錀鋻錖閼闍閾閹閺閶閿閵閽隩雔霋霒霐鞙鞗鞔韰韸頵頯頲餤餟餧餩馞駮駬駥駤駰駣駪駩駧骹骿骴骻髶髺髹髷鬳鮀鮅鮇魼魾魻鮂鮓鮒鮐魺鮕"], +["eca1","魽鮈鴥鴗鴠鴞鴔鴩鴝鴘鴢鴐鴙鴟麈麆麇麮麭黕黖黺鼒鼽儦儥儢儤儠儩勴嚓嚌嚍嚆嚄嚃噾嚂噿嚁壖壔壏壒嬭嬥嬲嬣嬬嬧嬦嬯嬮孻寱寲嶷幬幪徾徻懃憵憼懧懠懥懤懨懞擯擩擣擫擤擨斁斀斶旚曒檍檖檁檥檉檟檛檡檞檇檓檎"], +["ed40","檕檃檨檤檑橿檦檚檅檌檒歛殭氉濌澩濴濔濣濜濭濧濦濞濲濝濢濨燡燱燨燲燤燰燢獳獮獯璗璲璫璐璪璭璱璥璯甐甑甒甏疄癃癈癉癇皤盩瞵瞫瞲瞷瞶"], +["eda1","瞴瞱瞨矰磳磽礂磻磼磲礅磹磾礄禫禨穜穛穖穘穔穚窾竀竁簅簏篲簀篿篻簎篴簋篳簂簉簃簁篸篽簆篰篱簐簊糨縭縼繂縳顈縸縪繉繀繇縩繌縰縻縶繄縺罅罿罾罽翴翲耬膻臄臌臊臅臇膼臩艛艚艜薃薀薏薧薕薠薋薣蕻薤薚薞"], +["ee40","蕷蕼薉薡蕺蕸蕗薎薖薆薍薙薝薁薢薂薈薅蕹蕶薘薐薟虨螾螪螭蟅螰螬螹螵螼螮蟉蟃蟂蟌螷螯蟄蟊螴螶螿螸螽蟞螲褵褳褼褾襁襒褷襂覭覯覮觲觳謞"], +["eea1","謘謖謑謅謋謢謏謒謕謇謍謈謆謜謓謚豏豰豲豱豯貕貔賹赯蹎蹍蹓蹐蹌蹇轃轀邅遾鄸醚醢醛醙醟醡醝醠鎡鎃鎯鍤鍖鍇鍼鍘鍜鍶鍉鍐鍑鍠鍭鎏鍌鍪鍹鍗鍕鍒鍏鍱鍷鍻鍡鍞鍣鍧鎀鍎鍙闇闀闉闃闅閷隮隰隬霠霟霘霝霙鞚鞡鞜"], +["ef40","鞞鞝韕韔韱顁顄顊顉顅顃餥餫餬餪餳餲餯餭餱餰馘馣馡騂駺駴駷駹駸駶駻駽駾駼騃骾髾髽鬁髼魈鮚鮨鮞鮛鮦鮡鮥鮤鮆鮢鮠鮯鴳鵁鵧鴶鴮鴯鴱鴸鴰"], +["efa1","鵅鵂鵃鴾鴷鵀鴽翵鴭麊麉麍麰黈黚黻黿鼤鼣鼢齔龠儱儭儮嚘嚜嚗嚚嚝嚙奰嬼屩屪巀幭幮懘懟懭懮懱懪懰懫懖懩擿攄擽擸攁攃擼斔旛曚曛曘櫅檹檽櫡櫆檺檶檷櫇檴檭歞毉氋瀇瀌瀍瀁瀅瀔瀎濿瀀濻瀦濼濷瀊爁燿燹爃燽獶"], +["f040","璸瓀璵瓁璾璶璻瓂甔甓癜癤癙癐癓癗癚皦皽盬矂瞺磿礌礓礔礉礐礒礑禭禬穟簜簩簙簠簟簭簝簦簨簢簥簰繜繐繖繣繘繢繟繑繠繗繓羵羳翷翸聵臑臒"], +["f0a1","臐艟艞薴藆藀藃藂薳薵薽藇藄薿藋藎藈藅薱薶藒蘤薸薷薾虩蟧蟦蟢蟛蟫蟪蟥蟟蟳蟤蟔蟜蟓蟭蟘蟣螤蟗蟙蠁蟴蟨蟝襓襋襏襌襆襐襑襉謪謧謣謳謰謵譇謯謼謾謱謥謷謦謶謮謤謻謽謺豂豵貙貘貗賾贄贂贀蹜蹢蹠蹗蹖蹞蹥蹧"], +["f140","蹛蹚蹡蹝蹩蹔轆轇轈轋鄨鄺鄻鄾醨醥醧醯醪鎵鎌鎒鎷鎛鎝鎉鎧鎎鎪鎞鎦鎕鎈鎙鎟鎍鎱鎑鎲鎤鎨鎴鎣鎥闒闓闑隳雗雚巂雟雘雝霣霢霥鞬鞮鞨鞫鞤鞪"], +["f1a1","鞢鞥韗韙韖韘韺顐顑顒颸饁餼餺騏騋騉騍騄騑騊騅騇騆髀髜鬈鬄鬅鬩鬵魊魌魋鯇鯆鯃鮿鯁鮵鮸鯓鮶鯄鮹鮽鵜鵓鵏鵊鵛鵋鵙鵖鵌鵗鵒鵔鵟鵘鵚麎麌黟鼁鼀鼖鼥鼫鼪鼩鼨齌齕儴儵劖勷厴嚫嚭嚦嚧嚪嚬壚壝壛夒嬽嬾嬿巃幰"], +["f240","徿懻攇攐攍攉攌攎斄旞旝曞櫧櫠櫌櫑櫙櫋櫟櫜櫐櫫櫏櫍櫞歠殰氌瀙瀧瀠瀖瀫瀡瀢瀣瀩瀗瀤瀜瀪爌爊爇爂爅犥犦犤犣犡瓋瓅璷瓃甖癠矉矊矄矱礝礛"], +["f2a1","礡礜礗礞禰穧穨簳簼簹簬簻糬糪繶繵繸繰繷繯繺繲繴繨罋罊羃羆羷翽翾聸臗臕艤艡艣藫藱藭藙藡藨藚藗藬藲藸藘藟藣藜藑藰藦藯藞藢蠀蟺蠃蟶蟷蠉蠌蠋蠆蟼蠈蟿蠊蠂襢襚襛襗襡襜襘襝襙覈覷覶觶譐譈譊譀譓譖譔譋譕"], +["f340","譑譂譒譗豃豷豶貚贆贇贉趬趪趭趫蹭蹸蹳蹪蹯蹻軂轒轑轏轐轓辴酀鄿醰醭鏞鏇鏏鏂鏚鏐鏹鏬鏌鏙鎩鏦鏊鏔鏮鏣鏕鏄鏎鏀鏒鏧镽闚闛雡霩霫霬霨霦"], +["f3a1","鞳鞷鞶韝韞韟顜顙顝顗颿颽颻颾饈饇饃馦馧騚騕騥騝騤騛騢騠騧騣騞騜騔髂鬋鬊鬎鬌鬷鯪鯫鯠鯞鯤鯦鯢鯰鯔鯗鯬鯜鯙鯥鯕鯡鯚鵷鶁鶊鶄鶈鵱鶀鵸鶆鶋鶌鵽鵫鵴鵵鵰鵩鶅鵳鵻鶂鵯鵹鵿鶇鵨麔麑黀黼鼭齀齁齍齖齗齘匷嚲"], +["f440","嚵嚳壣孅巆巇廮廯忀忁懹攗攖攕攓旟曨曣曤櫳櫰櫪櫨櫹櫱櫮櫯瀼瀵瀯瀷瀴瀱灂瀸瀿瀺瀹灀瀻瀳灁爓爔犨獽獼璺皫皪皾盭矌矎矏矍矲礥礣礧礨礤礩"], +["f4a1","禲穮穬穭竷籉籈籊籇籅糮繻繾纁纀羺翿聹臛臙舋艨艩蘢藿蘁藾蘛蘀藶蘄蘉蘅蘌藽蠙蠐蠑蠗蠓蠖襣襦覹觷譠譪譝譨譣譥譧譭趮躆躈躄轙轖轗轕轘轚邍酃酁醷醵醲醳鐋鐓鏻鐠鐏鐔鏾鐕鐐鐨鐙鐍鏵鐀鏷鐇鐎鐖鐒鏺鐉鏸鐊鏿"], +["f540","鏼鐌鏶鐑鐆闞闠闟霮霯鞹鞻韽韾顠顢顣顟飁飂饐饎饙饌饋饓騲騴騱騬騪騶騩騮騸騭髇髊髆鬐鬒鬑鰋鰈鯷鰅鰒鯸鱀鰇鰎鰆鰗鰔鰉鶟鶙鶤鶝鶒鶘鶐鶛"], +["f5a1","鶠鶔鶜鶪鶗鶡鶚鶢鶨鶞鶣鶿鶩鶖鶦鶧麙麛麚黥黤黧黦鼰鼮齛齠齞齝齙龑儺儹劘劗囃嚽嚾孈孇巋巏廱懽攛欂櫼欃櫸欀灃灄灊灈灉灅灆爝爚爙獾甗癪矐礭礱礯籔籓糲纊纇纈纋纆纍罍羻耰臝蘘蘪蘦蘟蘣蘜蘙蘧蘮蘡蘠蘩蘞蘥"], +["f640","蠩蠝蠛蠠蠤蠜蠫衊襭襩襮襫觺譹譸譅譺譻贐贔趯躎躌轞轛轝酆酄酅醹鐿鐻鐶鐩鐽鐼鐰鐹鐪鐷鐬鑀鐱闥闤闣霵霺鞿韡顤飉飆飀饘饖騹騽驆驄驂驁騺"], +["f6a1","騿髍鬕鬗鬘鬖鬺魒鰫鰝鰜鰬鰣鰨鰩鰤鰡鶷鶶鶼鷁鷇鷊鷏鶾鷅鷃鶻鶵鷎鶹鶺鶬鷈鶱鶭鷌鶳鷍鶲鹺麜黫黮黭鼛鼘鼚鼱齎齥齤龒亹囆囅囋奱孋孌巕巑廲攡攠攦攢欋欈欉氍灕灖灗灒爞爟犩獿瓘瓕瓙瓗癭皭礵禴穰穱籗籜籙籛籚"], +["f740","糴糱纑罏羇臞艫蘴蘵蘳蘬蘲蘶蠬蠨蠦蠪蠥襱覿覾觻譾讄讂讆讅譿贕躕躔躚躒躐躖躗轠轢酇鑌鑐鑊鑋鑏鑇鑅鑈鑉鑆霿韣顪顩飋饔饛驎驓驔驌驏驈驊"], +["f7a1","驉驒驐髐鬙鬫鬻魖魕鱆鱈鰿鱄鰹鰳鱁鰼鰷鰴鰲鰽鰶鷛鷒鷞鷚鷋鷐鷜鷑鷟鷩鷙鷘鷖鷵鷕鷝麶黰鼵鼳鼲齂齫龕龢儽劙壨壧奲孍巘蠯彏戁戃戄攩攥斖曫欑欒欏毊灛灚爢玂玁玃癰矔籧籦纕艬蘺虀蘹蘼蘱蘻蘾蠰蠲蠮蠳襶襴襳觾"], +["f840","讌讎讋讈豅贙躘轤轣醼鑢鑕鑝鑗鑞韄韅頀驖驙鬞鬟鬠鱒鱘鱐鱊鱍鱋鱕鱙鱌鱎鷻鷷鷯鷣鷫鷸鷤鷶鷡鷮鷦鷲鷰鷢鷬鷴鷳鷨鷭黂黐黲黳鼆鼜鼸鼷鼶齃齏"], +["f8a1","齱齰齮齯囓囍孎屭攭曭曮欓灟灡灝灠爣瓛瓥矕礸禷禶籪纗羉艭虃蠸蠷蠵衋讔讕躞躟躠躝醾醽釂鑫鑨鑩雥靆靃靇韇韥驞髕魙鱣鱧鱦鱢鱞鱠鸂鷾鸇鸃鸆鸅鸀鸁鸉鷿鷽鸄麠鼞齆齴齵齶囔攮斸欘欙欗欚灢爦犪矘矙礹籩籫糶纚"], +["f940","纘纛纙臠臡虆虇虈襹襺襼襻觿讘讙躥躤躣鑮鑭鑯鑱鑳靉顲饟鱨鱮鱭鸋鸍鸐鸏鸒鸑麡黵鼉齇齸齻齺齹圞灦籯蠼趲躦釃鑴鑸鑶鑵驠鱴鱳鱱鱵鸔鸓黶鼊"], +["f9a1","龤灨灥糷虪蠾蠽蠿讞貜躩軉靋顳顴飌饡馫驤驦驧鬤鸕鸗齈戇欞爧虌躨钂钀钁驩驨鬮鸙爩虋讟钃鱹麷癵驫鱺鸝灩灪麤齾齉龘碁銹裏墻恒粧嫺╔╦╗╠╬╣╚╩╝╒╤╕╞╪╡╘╧╛╓╥╖╟╫╢╙╨╜║═╭╮╰╯▓"] +] diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/tables/eucjp.json b/node_modules/npm/node_modules/iconv-lite/encodings/tables/eucjp.json new file mode 100644 index 00000000..4fa61ca1 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/tables/eucjp.json @@ -0,0 +1,182 @@ +[ +["0","\u0000",127], +["8ea1","。",62], +["a1a1"," 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",9,"+-±×÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇"], +["a2a1","◆□■△▲▽▼※〒→←↑↓〓"], +["a2ba","∈∋⊆⊇⊂⊃∪∩"], +["a2ca","∧∨¬⇒⇔∀∃"], +["a2dc","∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"], +["a2f2","ʼn♯♭♪†‡¶"], +["a2fe","◯"], +["a3b0","0",9], +["a3c1","A",25], +["a3e1","a",25], +["a4a1","ぁ",82], +["a5a1","ァ",85], +["a6a1","Α",16,"Σ",6], +["a6c1","α",16,"σ",6], +["a7a1","А",5,"ЁЖ",25], +["a7d1","а",5,"ёж",25], +["a8a1","─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"], +["ada1","①",19,"Ⅰ",9], +["adc0","㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"], +["addf","㍻〝〟№㏍℡㊤",4,"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"], +["b0a1","亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"], +["b1a1","院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応"], +["b2a1","押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"], +["b3a1","魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱"], +["b4a1","粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"], +["b5a1","機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京"], +["b6a1","供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"], +["b7a1","掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲"], +["b8a1","検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"], +["b9a1","后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込"], +["baa1","此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"], +["bba1","察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時"], +["bca1","次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"], +["bda1","宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償"], +["bea1","勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"], +["bfa1","拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾"], +["c0a1","澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"], +["c1a1","繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎"], +["c2a1","臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"], +["c3a1","叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵"], +["c4a1","帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"], +["c5a1","邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到"], +["c6a1","董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"], +["c7a1","如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦"], +["c8a1","函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"], +["c9a1","鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服"], +["caa1","福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"], +["cba1","法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満"], +["cca1","漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"], +["cda1","諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃"], +["cea1","痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"], +["cfa1","蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"], +["d0a1","弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"], +["d1a1","僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨"], +["d2a1","辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"], +["d3a1","咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉"], +["d4a1","圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"], +["d5a1","奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓"], +["d6a1","屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"], +["d7a1","廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚"], +["d8a1","悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"], +["d9a1","戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼"], +["daa1","據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"], +["dba1","曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍"], +["dca1","棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"], +["dda1","檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾"], +["dea1","沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"], +["dfa1","漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼"], +["e0a1","燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"], +["e1a1","瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰"], +["e2a1","癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"], +["e3a1","磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐"], +["e4a1","筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"], +["e5a1","紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺"], +["e6a1","罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"], +["e7a1","隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙"], +["e8a1","茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"], +["e9a1","蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙"], +["eaa1","蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"], +["eba1","襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫"], +["eca1","譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"], +["eda1","蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸"], +["eea1","遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"], +["efa1","錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞"], +["f0a1","陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"], +["f1a1","顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷"], +["f2a1","髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"], +["f3a1","鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠"], +["f4a1","堯槇遙瑤凜熙"], +["f9a1","纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德"], +["faa1","忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"], +["fba1","犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚"], +["fca1","釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"], +["fcf1","ⅰ",9,"¬¦'""], +["8fa2af","˘ˇ¸˙˝¯˛˚~΄΅"], +["8fa2c2","¡¦¿"], +["8fa2eb","ºª©®™¤№"], +["8fa6e1","ΆΈΉΊΪ"], +["8fa6e7","Ό"], +["8fa6e9","ΎΫ"], +["8fa6ec","Ώ"], +["8fa6f1","άέήίϊΐόςύϋΰώ"], +["8fa7c2","Ђ",10,"ЎЏ"], +["8fa7f2","ђ",10,"ўџ"], +["8fa9a1","ÆĐ"], +["8fa9a4","Ħ"], +["8fa9a6","IJ"], +["8fa9a8","ŁĿ"], +["8fa9ab","ŊØŒ"], +["8fa9af","ŦÞ"], +["8fa9c1","æđðħıijĸłŀʼnŋøœßŧþ"], +["8faaa1","ÁÀÄÂĂǍĀĄÅÃĆĈČÇĊĎÉÈËÊĚĖĒĘ"], +["8faaba","ĜĞĢĠĤÍÌÏÎǏİĪĮĨĴĶĹĽĻŃŇŅÑÓÒÖÔǑŐŌÕŔŘŖŚŜŠŞŤŢÚÙÜÛŬǓŰŪŲŮŨǗǛǙǕŴÝŸŶŹŽŻ"], +["8faba1","áàäâăǎāąåãćĉčçċďéèëêěėēęǵĝğ"], +["8fabbd","ġĥíìïîǐ"], +["8fabc5","īįĩĵķĺľļńňņñóòöôǒőōõŕřŗśŝšşťţúùüûŭǔűūųůũǘǜǚǖŵýÿŷźžż"], +["8fb0a1","丂丄丅丌丒丟丣两丨丫丮丯丰丵乀乁乄乇乑乚乜乣乨乩乴乵乹乿亍亖亗亝亯亹仃仐仚仛仠仡仢仨仯仱仳仵份仾仿伀伂伃伈伋伌伒伕伖众伙伮伱你伳伵伷伹伻伾佀佂佈佉佋佌佒佔佖佘佟佣佪佬佮佱佷佸佹佺佽佾侁侂侄"], +["8fb1a1","侅侉侊侌侎侐侒侓侔侗侙侚侞侟侲侷侹侻侼侽侾俀俁俅俆俈俉俋俌俍俏俒俜俠俢俰俲俼俽俿倀倁倄倇倊倌倎倐倓倗倘倛倜倝倞倢倧倮倰倲倳倵偀偁偂偅偆偊偌偎偑偒偓偗偙偟偠偢偣偦偧偪偭偰偱倻傁傃傄傆傊傎傏傐"], +["8fb2a1","傒傓傔傖傛傜傞",4,"傪傯傰傹傺傽僀僃僄僇僌僎僐僓僔僘僜僝僟僢僤僦僨僩僯僱僶僺僾儃儆儇儈儋儌儍儎僲儐儗儙儛儜儝儞儣儧儨儬儭儯儱儳儴儵儸儹兂兊兏兓兕兗兘兟兤兦兾冃冄冋冎冘冝冡冣冭冸冺冼冾冿凂"], +["8fb3a1","凈减凑凒凓凕凘凞凢凥凮凲凳凴凷刁刂刅划刓刕刖刘刢刨刱刲刵刼剅剉剕剗剘剚剜剟剠剡剦剮剷剸剹劀劂劅劊劌劓劕劖劗劘劚劜劤劥劦劧劯劰劶劷劸劺劻劽勀勄勆勈勌勏勑勔勖勛勜勡勥勨勩勪勬勰勱勴勶勷匀匃匊匋"], +["8fb4a1","匌匑匓匘匛匜匞匟匥匧匨匩匫匬匭匰匲匵匼匽匾卂卌卋卙卛卡卣卥卬卭卲卹卾厃厇厈厎厓厔厙厝厡厤厪厫厯厲厴厵厷厸厺厽叀叅叏叒叓叕叚叝叞叠另叧叵吂吓吚吡吧吨吪启吱吴吵呃呄呇呍呏呞呢呤呦呧呩呫呭呮呴呿"], +["8fb5a1","咁咃咅咈咉咍咑咕咖咜咟咡咦咧咩咪咭咮咱咷咹咺咻咿哆哊响哎哠哪哬哯哶哼哾哿唀唁唅唈唉唌唍唎唕唪唫唲唵唶唻唼唽啁啇啉啊啍啐啑啘啚啛啞啠啡啤啦啿喁喂喆喈喎喏喑喒喓喔喗喣喤喭喲喿嗁嗃嗆嗉嗋嗌嗎嗑嗒"], +["8fb6a1","嗓嗗嗘嗛嗞嗢嗩嗶嗿嘅嘈嘊嘍",5,"嘙嘬嘰嘳嘵嘷嘹嘻嘼嘽嘿噀噁噃噄噆噉噋噍噏噔噞噠噡噢噣噦噩噭噯噱噲噵嚄嚅嚈嚋嚌嚕嚙嚚嚝嚞嚟嚦嚧嚨嚩嚫嚬嚭嚱嚳嚷嚾囅囉囊囋囏囐囌囍囙囜囝囟囡囤",4,"囱囫园"], +["8fb7a1","囶囷圁圂圇圊圌圑圕圚圛圝圠圢圣圤圥圩圪圬圮圯圳圴圽圾圿坅坆坌坍坒坢坥坧坨坫坭",4,"坳坴坵坷坹坺坻坼坾垁垃垌垔垗垙垚垜垝垞垟垡垕垧垨垩垬垸垽埇埈埌埏埕埝埞埤埦埧埩埭埰埵埶埸埽埾埿堃堄堈堉埡"], +["8fb8a1","堌堍堛堞堟堠堦堧堭堲堹堿塉塌塍塏塐塕塟塡塤塧塨塸塼塿墀墁墇墈墉墊墌墍墏墐墔墖墝墠墡墢墦墩墱墲壄墼壂壈壍壎壐壒壔壖壚壝壡壢壩壳夅夆夋夌夒夓夔虁夝夡夣夤夨夯夰夳夵夶夿奃奆奒奓奙奛奝奞奟奡奣奫奭"], +["8fb9a1","奯奲奵奶她奻奼妋妌妎妒妕妗妟妤妧妭妮妯妰妳妷妺妼姁姃姄姈姊姍姒姝姞姟姣姤姧姮姯姱姲姴姷娀娄娌娍娎娒娓娞娣娤娧娨娪娭娰婄婅婇婈婌婐婕婞婣婥婧婭婷婺婻婾媋媐媓媖媙媜媞媟媠媢媧媬媱媲媳媵媸媺媻媿"], +["8fbaa1","嫄嫆嫈嫏嫚嫜嫠嫥嫪嫮嫵嫶嫽嬀嬁嬈嬗嬴嬙嬛嬝嬡嬥嬭嬸孁孋孌孒孖孞孨孮孯孼孽孾孿宁宄宆宊宎宐宑宓宔宖宨宩宬宭宯宱宲宷宺宼寀寁寍寏寖",4,"寠寯寱寴寽尌尗尞尟尣尦尩尫尬尮尰尲尵尶屙屚屜屢屣屧屨屩"], +["8fbba1","屭屰屴屵屺屻屼屽岇岈岊岏岒岝岟岠岢岣岦岪岲岴岵岺峉峋峒峝峗峮峱峲峴崁崆崍崒崫崣崤崦崧崱崴崹崽崿嵂嵃嵆嵈嵕嵑嵙嵊嵟嵠嵡嵢嵤嵪嵭嵰嵹嵺嵾嵿嶁嶃嶈嶊嶒嶓嶔嶕嶙嶛嶟嶠嶧嶫嶰嶴嶸嶹巃巇巋巐巎巘巙巠巤"], +["8fbca1","巩巸巹帀帇帍帒帔帕帘帟帠帮帨帲帵帾幋幐幉幑幖幘幛幜幞幨幪",4,"幰庀庋庎庢庤庥庨庪庬庱庳庽庾庿廆廌廋廎廑廒廔廕廜廞廥廫异弆弇弈弎弙弜弝弡弢弣弤弨弫弬弮弰弴弶弻弽弿彀彄彅彇彍彐彔彘彛彠彣彤彧"], +["8fbda1","彯彲彴彵彸彺彽彾徉徍徏徖徜徝徢徧徫徤徬徯徰徱徸忄忇忈忉忋忐",4,"忞忡忢忨忩忪忬忭忮忯忲忳忶忺忼怇怊怍怓怔怗怘怚怟怤怭怳怵恀恇恈恉恌恑恔恖恗恝恡恧恱恾恿悂悆悈悊悎悑悓悕悘悝悞悢悤悥您悰悱悷"], +["8fbea1","悻悾惂惄惈惉惊惋惎惏惔惕惙惛惝惞惢惥惲惵惸惼惽愂愇愊愌愐",4,"愖愗愙愜愞愢愪愫愰愱愵愶愷愹慁慅慆慉慞慠慬慲慸慻慼慿憀憁憃憄憋憍憒憓憗憘憜憝憟憠憥憨憪憭憸憹憼懀懁懂懎懏懕懜懝懞懟懡懢懧懩懥"], +["8fbfa1","懬懭懯戁戃戄戇戓戕戜戠戢戣戧戩戫戹戽扂扃扄扆扌扐扑扒扔扖扚扜扤扭扯扳扺扽抍抎抏抐抦抨抳抶抷抺抾抿拄拎拕拖拚拪拲拴拼拽挃挄挊挋挍挐挓挖挘挩挪挭挵挶挹挼捁捂捃捄捆捊捋捎捒捓捔捘捛捥捦捬捭捱捴捵"], +["8fc0a1","捸捼捽捿掂掄掇掊掐掔掕掙掚掞掤掦掭掮掯掽揁揅揈揎揑揓揔揕揜揠揥揪揬揲揳揵揸揹搉搊搐搒搔搘搞搠搢搤搥搩搪搯搰搵搽搿摋摏摑摒摓摔摚摛摜摝摟摠摡摣摭摳摴摻摽撅撇撏撐撑撘撙撛撝撟撡撣撦撨撬撳撽撾撿"], +["8fc1a1","擄擉擊擋擌擎擐擑擕擗擤擥擩擪擭擰擵擷擻擿攁攄攈攉攊攏攓攔攖攙攛攞攟攢攦攩攮攱攺攼攽敃敇敉敐敒敔敟敠敧敫敺敽斁斅斊斒斕斘斝斠斣斦斮斲斳斴斿旂旈旉旎旐旔旖旘旟旰旲旴旵旹旾旿昀昄昈昉昍昑昒昕昖昝"], +["8fc2a1","昞昡昢昣昤昦昩昪昫昬昮昰昱昳昹昷晀晅晆晊晌晑晎晗晘晙晛晜晠晡曻晪晫晬晾晳晵晿晷晸晹晻暀晼暋暌暍暐暒暙暚暛暜暟暠暤暭暱暲暵暻暿曀曂曃曈曌曎曏曔曛曟曨曫曬曮曺朅朇朎朓朙朜朠朢朳朾杅杇杈杌杔杕杝"], +["8fc3a1","杦杬杮杴杶杻极构枎枏枑枓枖枘枙枛枰枱枲枵枻枼枽柹柀柂柃柅柈柉柒柗柙柜柡柦柰柲柶柷桒栔栙栝栟栨栧栬栭栯栰栱栳栻栿桄桅桊桌桕桗桘桛桫桮",4,"桵桹桺桻桼梂梄梆梈梖梘梚梜梡梣梥梩梪梮梲梻棅棈棌棏"], +["8fc4a1","棐棑棓棖棙棜棝棥棨棪棫棬棭棰棱棵棶棻棼棽椆椉椊椐椑椓椖椗椱椳椵椸椻楂楅楉楎楗楛楣楤楥楦楨楩楬楰楱楲楺楻楿榀榍榒榖榘榡榥榦榨榫榭榯榷榸榺榼槅槈槑槖槗槢槥槮槯槱槳槵槾樀樁樃樏樑樕樚樝樠樤樨樰樲"], +["8fc5a1","樴樷樻樾樿橅橆橉橊橎橐橑橒橕橖橛橤橧橪橱橳橾檁檃檆檇檉檋檑檛檝檞檟檥檫檯檰檱檴檽檾檿櫆櫉櫈櫌櫐櫔櫕櫖櫜櫝櫤櫧櫬櫰櫱櫲櫼櫽欂欃欆欇欉欏欐欑欗欛欞欤欨欫欬欯欵欶欻欿歆歊歍歒歖歘歝歠歧歫歮歰歵歽"], +["8fc6a1","歾殂殅殗殛殟殠殢殣殨殩殬殭殮殰殸殹殽殾毃毄毉毌毖毚毡毣毦毧毮毱毷毹毿氂氄氅氉氍氎氐氒氙氟氦氧氨氬氮氳氵氶氺氻氿汊汋汍汏汒汔汙汛汜汫汭汯汴汶汸汹汻沅沆沇沉沔沕沗沘沜沟沰沲沴泂泆泍泏泐泑泒泔泖"], +["8fc7a1","泚泜泠泧泩泫泬泮泲泴洄洇洊洎洏洑洓洚洦洧洨汧洮洯洱洹洼洿浗浞浟浡浥浧浯浰浼涂涇涑涒涔涖涗涘涪涬涴涷涹涽涿淄淈淊淎淏淖淛淝淟淠淢淥淩淯淰淴淶淼渀渄渞渢渧渲渶渹渻渼湄湅湈湉湋湏湑湒湓湔湗湜湝湞"], +["8fc8a1","湢湣湨湳湻湽溍溓溙溠溧溭溮溱溳溻溿滀滁滃滇滈滊滍滎滏滫滭滮滹滻滽漄漈漊漌漍漖漘漚漛漦漩漪漯漰漳漶漻漼漭潏潑潒潓潗潙潚潝潞潡潢潨潬潽潾澃澇澈澋澌澍澐澒澓澔澖澚澟澠澥澦澧澨澮澯澰澵澶澼濅濇濈濊"], +["8fc9a1","濚濞濨濩濰濵濹濼濽瀀瀅瀆瀇瀍瀗瀠瀣瀯瀴瀷瀹瀼灃灄灈灉灊灋灔灕灝灞灎灤灥灬灮灵灶灾炁炅炆炔",4,"炛炤炫炰炱炴炷烊烑烓烔烕烖烘烜烤烺焃",4,"焋焌焏焞焠焫焭焯焰焱焸煁煅煆煇煊煋煐煒煗煚煜煞煠"], +["8fcaa1","煨煹熀熅熇熌熒熚熛熠熢熯熰熲熳熺熿燀燁燄燋燌燓燖燙燚燜燸燾爀爇爈爉爓爗爚爝爟爤爫爯爴爸爹牁牂牃牅牎牏牐牓牕牖牚牜牞牠牣牨牫牮牯牱牷牸牻牼牿犄犉犍犎犓犛犨犭犮犱犴犾狁狇狉狌狕狖狘狟狥狳狴狺狻"], +["8fcba1","狾猂猄猅猇猋猍猒猓猘猙猞猢猤猧猨猬猱猲猵猺猻猽獃獍獐獒獖獘獝獞獟獠獦獧獩獫獬獮獯獱獷獹獼玀玁玃玅玆玎玐玓玕玗玘玜玞玟玠玢玥玦玪玫玭玵玷玹玼玽玿珅珆珉珋珌珏珒珓珖珙珝珡珣珦珧珩珴珵珷珹珺珻珽"], +["8fcca1","珿琀琁琄琇琊琑琚琛琤琦琨",9,"琹瑀瑃瑄瑆瑇瑋瑍瑑瑒瑗瑝瑢瑦瑧瑨瑫瑭瑮瑱瑲璀璁璅璆璇璉璏璐璑璒璘璙璚璜璟璠璡璣璦璨璩璪璫璮璯璱璲璵璹璻璿瓈瓉瓌瓐瓓瓘瓚瓛瓞瓟瓤瓨瓪瓫瓯瓴瓺瓻瓼瓿甆"], +["8fcda1","甒甖甗甠甡甤甧甩甪甯甶甹甽甾甿畀畃畇畈畎畐畒畗畞畟畡畯畱畹",5,"疁疅疐疒疓疕疙疜疢疤疴疺疿痀痁痄痆痌痎痏痗痜痟痠痡痤痧痬痮痯痱痹瘀瘂瘃瘄瘇瘈瘊瘌瘏瘒瘓瘕瘖瘙瘛瘜瘝瘞瘣瘥瘦瘩瘭瘲瘳瘵瘸瘹"], +["8fcea1","瘺瘼癊癀癁癃癄癅癉癋癕癙癟癤癥癭癮癯癱癴皁皅皌皍皕皛皜皝皟皠皢",6,"皪皭皽盁盅盉盋盌盎盔盙盠盦盨盬盰盱盶盹盼眀眆眊眎眒眔眕眗眙眚眜眢眨眭眮眯眴眵眶眹眽眾睂睅睆睊睍睎睏睒睖睗睜睞睟睠睢"], +["8fcfa1","睤睧睪睬睰睲睳睴睺睽瞀瞄瞌瞍瞔瞕瞖瞚瞟瞢瞧瞪瞮瞯瞱瞵瞾矃矉矑矒矕矙矞矟矠矤矦矪矬矰矱矴矸矻砅砆砉砍砎砑砝砡砢砣砭砮砰砵砷硃硄硇硈硌硎硒硜硞硠硡硣硤硨硪确硺硾碊碏碔碘碡碝碞碟碤碨碬碭碰碱碲碳"], +["8fd0a1","碻碽碿磇磈磉磌磎磒磓磕磖磤磛磟磠磡磦磪磲磳礀磶磷磺磻磿礆礌礐礚礜礞礟礠礥礧礩礭礱礴礵礻礽礿祄祅祆祊祋祏祑祔祘祛祜祧祩祫祲祹祻祼祾禋禌禑禓禔禕禖禘禛禜禡禨禩禫禯禱禴禸离秂秄秇秈秊秏秔秖秚秝秞"], +["8fd1a1","秠秢秥秪秫秭秱秸秼稂稃稇稉稊稌稑稕稛稞稡稧稫稭稯稰稴稵稸稹稺穄穅穇穈穌穕穖穙穜穝穟穠穥穧穪穭穵穸穾窀窂窅窆窊窋窐窑窔窞窠窣窬窳窵窹窻窼竆竉竌竎竑竛竨竩竫竬竱竴竻竽竾笇笔笟笣笧笩笪笫笭笮笯笰"], +["8fd2a1","笱笴笽笿筀筁筇筎筕筠筤筦筩筪筭筯筲筳筷箄箉箎箐箑箖箛箞箠箥箬箯箰箲箵箶箺箻箼箽篂篅篈篊篔篖篗篙篚篛篨篪篲篴篵篸篹篺篼篾簁簂簃簄簆簉簋簌簎簏簙簛簠簥簦簨簬簱簳簴簶簹簺籆籊籕籑籒籓籙",5], +["8fd3a1","籡籣籧籩籭籮籰籲籹籼籽粆粇粏粔粞粠粦粰粶粷粺粻粼粿糄糇糈糉糍糏糓糔糕糗糙糚糝糦糩糫糵紃紇紈紉紏紑紒紓紖紝紞紣紦紪紭紱紼紽紾絀絁絇絈絍絑絓絗絙絚絜絝絥絧絪絰絸絺絻絿綁綂綃綅綆綈綋綌綍綑綖綗綝"], +["8fd4a1","綞綦綧綪綳綶綷綹緂",4,"緌緍緎緗緙縀緢緥緦緪緫緭緱緵緶緹緺縈縐縑縕縗縜縝縠縧縨縬縭縯縳縶縿繄繅繇繎繐繒繘繟繡繢繥繫繮繯繳繸繾纁纆纇纊纍纑纕纘纚纝纞缼缻缽缾缿罃罄罇罏罒罓罛罜罝罡罣罤罥罦罭"], +["8fd5a1","罱罽罾罿羀羋羍羏羐羑羖羗羜羡羢羦羪羭羴羼羿翀翃翈翎翏翛翟翣翥翨翬翮翯翲翺翽翾翿耇耈耊耍耎耏耑耓耔耖耝耞耟耠耤耦耬耮耰耴耵耷耹耺耼耾聀聄聠聤聦聭聱聵肁肈肎肜肞肦肧肫肸肹胈胍胏胒胔胕胗胘胠胭胮"], +["8fd6a1","胰胲胳胶胹胺胾脃脋脖脗脘脜脞脠脤脧脬脰脵脺脼腅腇腊腌腒腗腠腡腧腨腩腭腯腷膁膐膄膅膆膋膎膖膘膛膞膢膮膲膴膻臋臃臅臊臎臏臕臗臛臝臞臡臤臫臬臰臱臲臵臶臸臹臽臿舀舃舏舓舔舙舚舝舡舢舨舲舴舺艃艄艅艆"], +["8fd7a1","艋艎艏艑艖艜艠艣艧艭艴艻艽艿芀芁芃芄芇芉芊芎芑芔芖芘芚芛芠芡芣芤芧芨芩芪芮芰芲芴芷芺芼芾芿苆苐苕苚苠苢苤苨苪苭苯苶苷苽苾茀茁茇茈茊茋荔茛茝茞茟茡茢茬茭茮茰茳茷茺茼茽荂荃荄荇荍荎荑荕荖荗荰荸"], +["8fd8a1","荽荿莀莂莄莆莍莒莔莕莘莙莛莜莝莦莧莩莬莾莿菀菇菉菏菐菑菔菝荓菨菪菶菸菹菼萁萆萊萏萑萕萙莭萯萹葅葇葈葊葍葏葑葒葖葘葙葚葜葠葤葥葧葪葰葳葴葶葸葼葽蒁蒅蒒蒓蒕蒞蒦蒨蒩蒪蒯蒱蒴蒺蒽蒾蓀蓂蓇蓈蓌蓏蓓"], +["8fd9a1","蓜蓧蓪蓯蓰蓱蓲蓷蔲蓺蓻蓽蔂蔃蔇蔌蔎蔐蔜蔞蔢蔣蔤蔥蔧蔪蔫蔯蔳蔴蔶蔿蕆蕏",4,"蕖蕙蕜",6,"蕤蕫蕯蕹蕺蕻蕽蕿薁薅薆薉薋薌薏薓薘薝薟薠薢薥薧薴薶薷薸薼薽薾薿藂藇藊藋藎薭藘藚藟藠藦藨藭藳藶藼"], +["8fdaa1","藿蘀蘄蘅蘍蘎蘐蘑蘒蘘蘙蘛蘞蘡蘧蘩蘶蘸蘺蘼蘽虀虂虆虒虓虖虗虘虙虝虠",4,"虩虬虯虵虶虷虺蚍蚑蚖蚘蚚蚜蚡蚦蚧蚨蚭蚱蚳蚴蚵蚷蚸蚹蚿蛀蛁蛃蛅蛑蛒蛕蛗蛚蛜蛠蛣蛥蛧蚈蛺蛼蛽蜄蜅蜇蜋蜎蜏蜐蜓蜔蜙蜞蜟蜡蜣"], +["8fdba1","蜨蜮蜯蜱蜲蜹蜺蜼蜽蜾蝀蝃蝅蝍蝘蝝蝡蝤蝥蝯蝱蝲蝻螃",6,"螋螌螐螓螕螗螘螙螞螠螣螧螬螭螮螱螵螾螿蟁蟈蟉蟊蟎蟕蟖蟙蟚蟜蟟蟢蟣蟤蟪蟫蟭蟱蟳蟸蟺蟿蠁蠃蠆蠉蠊蠋蠐蠙蠒蠓蠔蠘蠚蠛蠜蠞蠟蠨蠭蠮蠰蠲蠵"], +["8fdca1","蠺蠼衁衃衅衈衉衊衋衎衑衕衖衘衚衜衟衠衤衩衱衹衻袀袘袚袛袜袟袠袨袪袺袽袾裀裊",4,"裑裒裓裛裞裧裯裰裱裵裷褁褆褍褎褏褕褖褘褙褚褜褠褦褧褨褰褱褲褵褹褺褾襀襂襅襆襉襏襒襗襚襛襜襡襢襣襫襮襰襳襵襺"], +["8fdda1","襻襼襽覉覍覐覔覕覛覜覟覠覥覰覴覵覶覷覼觔",4,"觥觩觫觭觱觳觶觹觽觿訄訅訇訏訑訒訔訕訞訠訢訤訦訫訬訯訵訷訽訾詀詃詅詇詉詍詎詓詖詗詘詜詝詡詥詧詵詶詷詹詺詻詾詿誀誃誆誋誏誐誒誖誗誙誟誧誩誮誯誳"], +["8fdea1","誶誷誻誾諃諆諈諉諊諑諓諔諕諗諝諟諬諰諴諵諶諼諿謅謆謋謑謜謞謟謊謭謰謷謼譂",4,"譈譒譓譔譙譍譞譣譭譶譸譹譼譾讁讄讅讋讍讏讔讕讜讞讟谸谹谽谾豅豇豉豋豏豑豓豔豗豘豛豝豙豣豤豦豨豩豭豳豵豶豻豾貆"], +["8fdfa1","貇貋貐貒貓貙貛貜貤貹貺賅賆賉賋賏賖賕賙賝賡賨賬賯賰賲賵賷賸賾賿贁贃贉贒贗贛赥赩赬赮赿趂趄趈趍趐趑趕趞趟趠趦趫趬趯趲趵趷趹趻跀跅跆跇跈跊跎跑跔跕跗跙跤跥跧跬跰趼跱跲跴跽踁踄踅踆踋踑踔踖踠踡踢"], +["8fe0a1","踣踦踧踱踳踶踷踸踹踽蹀蹁蹋蹍蹎蹏蹔蹛蹜蹝蹞蹡蹢蹩蹬蹭蹯蹰蹱蹹蹺蹻躂躃躉躐躒躕躚躛躝躞躢躧躩躭躮躳躵躺躻軀軁軃軄軇軏軑軔軜軨軮軰軱軷軹軺軭輀輂輇輈輏輐輖輗輘輞輠輡輣輥輧輨輬輭輮輴輵輶輷輺轀轁"], +["8fe1a1","轃轇轏轑",4,"轘轝轞轥辝辠辡辤辥辦辵辶辸达迀迁迆迊迋迍运迒迓迕迠迣迤迨迮迱迵迶迻迾适逄逈逌逘逛逨逩逯逪逬逭逳逴逷逿遃遄遌遛遝遢遦遧遬遰遴遹邅邈邋邌邎邐邕邗邘邙邛邠邡邢邥邰邲邳邴邶邽郌邾郃"], +["8fe2a1","郄郅郇郈郕郗郘郙郜郝郟郥郒郶郫郯郰郴郾郿鄀鄄鄅鄆鄈鄍鄐鄔鄖鄗鄘鄚鄜鄞鄠鄥鄢鄣鄧鄩鄮鄯鄱鄴鄶鄷鄹鄺鄼鄽酃酇酈酏酓酗酙酚酛酡酤酧酭酴酹酺酻醁醃醅醆醊醎醑醓醔醕醘醞醡醦醨醬醭醮醰醱醲醳醶醻醼醽醿"], +["8fe3a1","釂釃釅釓釔釗釙釚釞釤釥釩釪釬",5,"釷釹釻釽鈀鈁鈄鈅鈆鈇鈉鈊鈌鈐鈒鈓鈖鈘鈜鈝鈣鈤鈥鈦鈨鈮鈯鈰鈳鈵鈶鈸鈹鈺鈼鈾鉀鉂鉃鉆鉇鉊鉍鉎鉏鉑鉘鉙鉜鉝鉠鉡鉥鉧鉨鉩鉮鉯鉰鉵",4,"鉻鉼鉽鉿銈銉銊銍銎銒銗"], +["8fe4a1","銙銟銠銤銥銧銨銫銯銲銶銸銺銻銼銽銿",4,"鋅鋆鋇鋈鋋鋌鋍鋎鋐鋓鋕鋗鋘鋙鋜鋝鋟鋠鋡鋣鋥鋧鋨鋬鋮鋰鋹鋻鋿錀錂錈錍錑錔錕錜錝錞錟錡錤錥錧錩錪錳錴錶錷鍇鍈鍉鍐鍑鍒鍕鍗鍘鍚鍞鍤鍥鍧鍩鍪鍭鍯鍰鍱鍳鍴鍶"], +["8fe5a1","鍺鍽鍿鎀鎁鎂鎈鎊鎋鎍鎏鎒鎕鎘鎛鎞鎡鎣鎤鎦鎨鎫鎴鎵鎶鎺鎩鏁鏄鏅鏆鏇鏉",4,"鏓鏙鏜鏞鏟鏢鏦鏧鏹鏷鏸鏺鏻鏽鐁鐂鐄鐈鐉鐍鐎鐏鐕鐖鐗鐟鐮鐯鐱鐲鐳鐴鐻鐿鐽鑃鑅鑈鑊鑌鑕鑙鑜鑟鑡鑣鑨鑫鑭鑮鑯鑱鑲钄钃镸镹"], +["8fe6a1","镾閄閈閌閍閎閝閞閟閡閦閩閫閬閴閶閺閽閿闆闈闉闋闐闑闒闓闙闚闝闞闟闠闤闦阝阞阢阤阥阦阬阱阳阷阸阹阺阼阽陁陒陔陖陗陘陡陮陴陻陼陾陿隁隂隃隄隉隑隖隚隝隟隤隥隦隩隮隯隳隺雊雒嶲雘雚雝雞雟雩雯雱雺霂"], +["8fe7a1","霃霅霉霚霛霝霡霢霣霨霱霳靁靃靊靎靏靕靗靘靚靛靣靧靪靮靳靶靷靸靻靽靿鞀鞉鞕鞖鞗鞙鞚鞞鞟鞢鞬鞮鞱鞲鞵鞶鞸鞹鞺鞼鞾鞿韁韄韅韇韉韊韌韍韎韐韑韔韗韘韙韝韞韠韛韡韤韯韱韴韷韸韺頇頊頙頍頎頔頖頜頞頠頣頦"], +["8fe8a1","頫頮頯頰頲頳頵頥頾顄顇顊顑顒顓顖顗顙顚顢顣顥顦顪顬颫颭颮颰颴颷颸颺颻颿飂飅飈飌飡飣飥飦飧飪飳飶餂餇餈餑餕餖餗餚餛餜餟餢餦餧餫餱",4,"餹餺餻餼饀饁饆饇饈饍饎饔饘饙饛饜饞饟饠馛馝馟馦馰馱馲馵"], +["8fe9a1","馹馺馽馿駃駉駓駔駙駚駜駞駧駪駫駬駰駴駵駹駽駾騂騃騄騋騌騐騑騖騞騠騢騣騤騧騭騮騳騵騶騸驇驁驄驊驋驌驎驑驔驖驝骪骬骮骯骲骴骵骶骹骻骾骿髁髃髆髈髎髐髒髕髖髗髛髜髠髤髥髧髩髬髲髳髵髹髺髽髿",4], +["8feaa1","鬄鬅鬈鬉鬋鬌鬍鬎鬐鬒鬖鬙鬛鬜鬠鬦鬫鬭鬳鬴鬵鬷鬹鬺鬽魈魋魌魕魖魗魛魞魡魣魥魦魨魪",4,"魳魵魷魸魹魿鮀鮄鮅鮆鮇鮉鮊鮋鮍鮏鮐鮔鮚鮝鮞鮦鮧鮩鮬鮰鮱鮲鮷鮸鮻鮼鮾鮿鯁鯇鯈鯎鯐鯗鯘鯝鯟鯥鯧鯪鯫鯯鯳鯷鯸"], +["8feba1","鯹鯺鯽鯿鰀鰂鰋鰏鰑鰖鰘鰙鰚鰜鰞鰢鰣鰦",4,"鰱鰵鰶鰷鰽鱁鱃鱄鱅鱉鱊鱎鱏鱐鱓鱔鱖鱘鱛鱝鱞鱟鱣鱩鱪鱜鱫鱨鱮鱰鱲鱵鱷鱻鳦鳲鳷鳹鴋鴂鴑鴗鴘鴜鴝鴞鴯鴰鴲鴳鴴鴺鴼鵅鴽鵂鵃鵇鵊鵓鵔鵟鵣鵢鵥鵩鵪鵫鵰鵶鵷鵻"], +["8feca1","鵼鵾鶃鶄鶆鶊鶍鶎鶒鶓鶕鶖鶗鶘鶡鶪鶬鶮鶱鶵鶹鶼鶿鷃鷇鷉鷊鷔鷕鷖鷗鷚鷞鷟鷠鷥鷧鷩鷫鷮鷰鷳鷴鷾鸊鸂鸇鸎鸐鸑鸒鸕鸖鸙鸜鸝鹺鹻鹼麀麂麃麄麅麇麎麏麖麘麛麞麤麨麬麮麯麰麳麴麵黆黈黋黕黟黤黧黬黭黮黰黱黲黵"], +["8feda1","黸黿鼂鼃鼉鼏鼐鼑鼒鼔鼖鼗鼙鼚鼛鼟鼢鼦鼪鼫鼯鼱鼲鼴鼷鼹鼺鼼鼽鼿齁齃",4,"齓齕齖齗齘齚齝齞齨齩齭",4,"齳齵齺齽龏龐龑龒龔龖龗龞龡龢龣龥"] +] diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json b/node_modules/npm/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json new file mode 100644 index 00000000..85c69347 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json @@ -0,0 +1 @@ +{"uChars":[128,165,169,178,184,216,226,235,238,244,248,251,253,258,276,284,300,325,329,334,364,463,465,467,469,471,473,475,477,506,594,610,712,716,730,930,938,962,970,1026,1104,1106,8209,8215,8218,8222,8231,8241,8244,8246,8252,8365,8452,8454,8458,8471,8482,8556,8570,8596,8602,8713,8720,8722,8726,8731,8737,8740,8742,8748,8751,8760,8766,8777,8781,8787,8802,8808,8816,8854,8858,8870,8896,8979,9322,9372,9548,9588,9616,9622,9634,9652,9662,9672,9676,9680,9702,9735,9738,9793,9795,11906,11909,11913,11917,11928,11944,11947,11951,11956,11960,11964,11979,12284,12292,12312,12319,12330,12351,12436,12447,12535,12543,12586,12842,12850,12964,13200,13215,13218,13253,13263,13267,13270,13384,13428,13727,13839,13851,14617,14703,14801,14816,14964,15183,15471,15585,16471,16736,17208,17325,17330,17374,17623,17997,18018,18212,18218,18301,18318,18760,18811,18814,18820,18823,18844,18848,18872,19576,19620,19738,19887,40870,59244,59336,59367,59413,59417,59423,59431,59437,59443,59452,59460,59478,59493,63789,63866,63894,63976,63986,64016,64018,64021,64025,64034,64037,64042,65074,65093,65107,65112,65127,65132,65375,65510,65536],"gbChars":[0,36,38,45,50,81,89,95,96,100,103,104,105,109,126,133,148,172,175,179,208,306,307,308,309,310,311,312,313,341,428,443,544,545,558,741,742,749,750,805,819,820,7922,7924,7925,7927,7934,7943,7944,7945,7950,8062,8148,8149,8152,8164,8174,8236,8240,8262,8264,8374,8380,8381,8384,8388,8390,8392,8393,8394,8396,8401,8406,8416,8419,8424,8437,8439,8445,8482,8485,8496,8521,8603,8936,8946,9046,9050,9063,9066,9076,9092,9100,9108,9111,9113,9131,9162,9164,9218,9219,11329,11331,11334,11336,11346,11361,11363,11366,11370,11372,11375,11389,11682,11686,11687,11692,11694,11714,11716,11723,11725,11730,11736,11982,11989,12102,12336,12348,12350,12384,12393,12395,12397,12510,12553,12851,12962,12973,13738,13823,13919,13933,14080,14298,14585,14698,15583,15847,16318,16434,16438,16481,16729,17102,17122,17315,17320,17402,17418,17859,17909,17911,17915,17916,17936,17939,17961,18664,18703,18814,18962,19043,33469,33470,33471,33484,33485,33490,33497,33501,33505,33513,33520,33536,33550,37845,37921,37948,38029,38038,38064,38065,38066,38069,38075,38076,38078,39108,39109,39113,39114,39115,39116,39265,39394,189000]} \ No newline at end of file diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/tables/gbk-added.json b/node_modules/npm/node_modules/iconv-lite/encodings/tables/gbk-added.json new file mode 100644 index 00000000..b742e368 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/tables/gbk-added.json @@ -0,0 +1,56 @@ +[ +["a140","",62], +["a180","",32], +["a240","",62], +["a280","",32], +["a2ab","",5], +["a2e3","€"], +["a2ef",""], +["a2fd",""], +["a340","",62], +["a380","",31," "], +["a440","",62], +["a480","",32], +["a4f4","",10], +["a540","",62], +["a580","",32], +["a5f7","",7], +["a640","",62], +["a680","",32], +["a6b9","",7], +["a6d9","",6], +["a6ec",""], +["a6f3",""], +["a6f6","",8], +["a740","",62], +["a780","",32], +["a7c2","",14], +["a7f2","",12], +["a896","",10], +["a8bc","ḿ"], +["a8bf","ǹ"], +["a8c1",""], +["a8ea","",20], +["a958",""], +["a95b",""], +["a95d",""], +["a989","〾⿰",11], +["a997","",12], +["a9f0","",14], +["aaa1","",93], +["aba1","",93], +["aca1","",93], +["ada1","",93], +["aea1","",93], +["afa1","",93], +["d7fa","",4], +["f8a1","",93], +["f9a1","",93], +["faa1","",93], +["fba1","",93], +["fca1","",93], +["fda1","",93], +["fe50","⺁⺄㑳㑇⺈⺋㖞㘚㘎⺌⺗㥮㤘㧏㧟㩳㧐㭎㱮㳠⺧⺪䁖䅟⺮䌷⺳⺶⺷䎱䎬⺻䏝䓖䙡䙌"], +["fe80","䜣䜩䝼䞍⻊䥇䥺䥽䦂䦃䦅䦆䦟䦛䦷䦶䲣䲟䲠䲡䱷䲢䴓",6,"䶮",93], +["8135f437",""] +] diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/tables/shiftjis.json b/node_modules/npm/node_modules/iconv-lite/encodings/tables/shiftjis.json new file mode 100644 index 00000000..5a3a43cf --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/tables/shiftjis.json @@ -0,0 +1,125 @@ +[ +["0","\u0000",128], +["a1","。",62], +["8140"," 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈",9,"+-±×"], +["8180","÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇◆□■△▲▽▼※〒→←↑↓〓"], +["81b8","∈∋⊆⊇⊂⊃∪∩"], +["81c8","∧∨¬⇒⇔∀∃"], +["81da","∠⊥⌒∂∇≡≒≪≫√∽∝∵∫∬"], +["81f0","ʼn♯♭♪†‡¶"], +["81fc","◯"], +["824f","0",9], +["8260","A",25], +["8281","a",25], +["829f","ぁ",82], +["8340","ァ",62], +["8380","ム",22], +["839f","Α",16,"Σ",6], +["83bf","α",16,"σ",6], +["8440","А",5,"ЁЖ",25], +["8470","а",5,"ёж",7], +["8480","о",17], +["849f","─│┌┐┘└├┬┤┴┼━┃┏┓┛┗┣┳┫┻╋┠┯┨┷┿┝┰┥┸╂"], +["8740","①",19,"Ⅰ",9], +["875f","㍉㌔㌢㍍㌘㌧㌃㌶㍑㍗㌍㌦㌣㌫㍊㌻㎜㎝㎞㎎㎏㏄㎡"], +["877e","㍻"], +["8780","〝〟№㏍℡㊤",4,"㈱㈲㈹㍾㍽㍼≒≡∫∮∑√⊥∠∟⊿∵∩∪"], +["889f","亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭"], +["8940","院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓臼渦嘘唄欝蔚鰻姥厩浦瓜閏噂云運雲荏餌叡営嬰影映曳栄永泳洩瑛盈穎頴英衛詠鋭液疫益駅悦謁越閲榎厭円"], +["8980","園堰奄宴延怨掩援沿演炎焔煙燕猿縁艶苑薗遠鉛鴛塩於汚甥凹央奥往応押旺横欧殴王翁襖鴬鴎黄岡沖荻億屋憶臆桶牡乙俺卸恩温穏音下化仮何伽価佳加可嘉夏嫁家寡科暇果架歌河火珂禍禾稼箇花苛茄荷華菓蝦課嘩貨迦過霞蚊俄峨我牙画臥芽蛾賀雅餓駕介会解回塊壊廻快怪悔恢懐戒拐改"], +["8a40","魁晦械海灰界皆絵芥蟹開階貝凱劾外咳害崖慨概涯碍蓋街該鎧骸浬馨蛙垣柿蛎鈎劃嚇各廓拡撹格核殻獲確穫覚角赫較郭閣隔革学岳楽額顎掛笠樫"], +["8a80","橿梶鰍潟割喝恰括活渇滑葛褐轄且鰹叶椛樺鞄株兜竃蒲釜鎌噛鴨栢茅萱粥刈苅瓦乾侃冠寒刊勘勧巻喚堪姦完官寛干幹患感慣憾換敢柑桓棺款歓汗漢澗潅環甘監看竿管簡緩缶翰肝艦莞観諌貫還鑑間閑関陥韓館舘丸含岸巌玩癌眼岩翫贋雁頑顔願企伎危喜器基奇嬉寄岐希幾忌揮机旗既期棋棄"], +["8b40","機帰毅気汽畿祈季稀紀徽規記貴起軌輝飢騎鬼亀偽儀妓宜戯技擬欺犠疑祇義蟻誼議掬菊鞠吉吃喫桔橘詰砧杵黍却客脚虐逆丘久仇休及吸宮弓急救"], +["8b80","朽求汲泣灸球究窮笈級糾給旧牛去居巨拒拠挙渠虚許距鋸漁禦魚亨享京供侠僑兇競共凶協匡卿叫喬境峡強彊怯恐恭挟教橋況狂狭矯胸脅興蕎郷鏡響饗驚仰凝尭暁業局曲極玉桐粁僅勤均巾錦斤欣欽琴禁禽筋緊芹菌衿襟謹近金吟銀九倶句区狗玖矩苦躯駆駈駒具愚虞喰空偶寓遇隅串櫛釧屑屈"], +["8c40","掘窟沓靴轡窪熊隈粂栗繰桑鍬勲君薫訓群軍郡卦袈祁係傾刑兄啓圭珪型契形径恵慶慧憩掲携敬景桂渓畦稽系経継繋罫茎荊蛍計詣警軽頚鶏芸迎鯨"], +["8c80","劇戟撃激隙桁傑欠決潔穴結血訣月件倹倦健兼券剣喧圏堅嫌建憲懸拳捲検権牽犬献研硯絹県肩見謙賢軒遣鍵険顕験鹸元原厳幻弦減源玄現絃舷言諺限乎個古呼固姑孤己庫弧戸故枯湖狐糊袴股胡菰虎誇跨鈷雇顧鼓五互伍午呉吾娯後御悟梧檎瑚碁語誤護醐乞鯉交佼侯候倖光公功効勾厚口向"], +["8d40","后喉坑垢好孔孝宏工巧巷幸広庚康弘恒慌抗拘控攻昂晃更杭校梗構江洪浩港溝甲皇硬稿糠紅紘絞綱耕考肯肱腔膏航荒行衡講貢購郊酵鉱砿鋼閤降"], +["8d80","項香高鴻剛劫号合壕拷濠豪轟麹克刻告国穀酷鵠黒獄漉腰甑忽惚骨狛込此頃今困坤墾婚恨懇昏昆根梱混痕紺艮魂些佐叉唆嵯左差査沙瑳砂詐鎖裟坐座挫債催再最哉塞妻宰彩才採栽歳済災采犀砕砦祭斎細菜裁載際剤在材罪財冴坂阪堺榊肴咲崎埼碕鷺作削咋搾昨朔柵窄策索錯桜鮭笹匙冊刷"], +["8e40","察拶撮擦札殺薩雑皐鯖捌錆鮫皿晒三傘参山惨撒散桟燦珊産算纂蚕讃賛酸餐斬暫残仕仔伺使刺司史嗣四士始姉姿子屍市師志思指支孜斯施旨枝止"], +["8e80","死氏獅祉私糸紙紫肢脂至視詞詩試誌諮資賜雌飼歯事似侍児字寺慈持時次滋治爾璽痔磁示而耳自蒔辞汐鹿式識鴫竺軸宍雫七叱執失嫉室悉湿漆疾質実蔀篠偲柴芝屡蕊縞舎写射捨赦斜煮社紗者謝車遮蛇邪借勺尺杓灼爵酌釈錫若寂弱惹主取守手朱殊狩珠種腫趣酒首儒受呪寿授樹綬需囚収周"], +["8f40","宗就州修愁拾洲秀秋終繍習臭舟蒐衆襲讐蹴輯週酋酬集醜什住充十従戎柔汁渋獣縦重銃叔夙宿淑祝縮粛塾熟出術述俊峻春瞬竣舜駿准循旬楯殉淳"], +["8f80","準潤盾純巡遵醇順処初所暑曙渚庶緒署書薯藷諸助叙女序徐恕鋤除傷償勝匠升召哨商唱嘗奨妾娼宵将小少尚庄床廠彰承抄招掌捷昇昌昭晶松梢樟樵沼消渉湘焼焦照症省硝礁祥称章笑粧紹肖菖蒋蕉衝裳訟証詔詳象賞醤鉦鍾鐘障鞘上丈丞乗冗剰城場壌嬢常情擾条杖浄状畳穣蒸譲醸錠嘱埴飾"], +["9040","拭植殖燭織職色触食蝕辱尻伸信侵唇娠寝審心慎振新晋森榛浸深申疹真神秦紳臣芯薪親診身辛進針震人仁刃塵壬尋甚尽腎訊迅陣靭笥諏須酢図厨"], +["9080","逗吹垂帥推水炊睡粋翠衰遂酔錐錘随瑞髄崇嵩数枢趨雛据杉椙菅頗雀裾澄摺寸世瀬畝是凄制勢姓征性成政整星晴棲栖正清牲生盛精聖声製西誠誓請逝醒青静斉税脆隻席惜戚斥昔析石積籍績脊責赤跡蹟碩切拙接摂折設窃節説雪絶舌蝉仙先千占宣専尖川戦扇撰栓栴泉浅洗染潜煎煽旋穿箭線"], +["9140","繊羨腺舛船薦詮賎践選遷銭銑閃鮮前善漸然全禅繕膳糎噌塑岨措曾曽楚狙疏疎礎祖租粗素組蘇訴阻遡鼠僧創双叢倉喪壮奏爽宋層匝惣想捜掃挿掻"], +["9180","操早曹巣槍槽漕燥争痩相窓糟総綜聡草荘葬蒼藻装走送遭鎗霜騒像増憎臓蔵贈造促側則即息捉束測足速俗属賊族続卒袖其揃存孫尊損村遜他多太汰詑唾堕妥惰打柁舵楕陀駄騨体堆対耐岱帯待怠態戴替泰滞胎腿苔袋貸退逮隊黛鯛代台大第醍題鷹滝瀧卓啄宅托択拓沢濯琢託鐸濁諾茸凧蛸只"], +["9240","叩但達辰奪脱巽竪辿棚谷狸鱈樽誰丹単嘆坦担探旦歎淡湛炭短端箪綻耽胆蛋誕鍛団壇弾断暖檀段男談値知地弛恥智池痴稚置致蜘遅馳築畜竹筑蓄"], +["9280","逐秩窒茶嫡着中仲宙忠抽昼柱注虫衷註酎鋳駐樗瀦猪苧著貯丁兆凋喋寵帖帳庁弔張彫徴懲挑暢朝潮牒町眺聴脹腸蝶調諜超跳銚長頂鳥勅捗直朕沈珍賃鎮陳津墜椎槌追鎚痛通塚栂掴槻佃漬柘辻蔦綴鍔椿潰坪壷嬬紬爪吊釣鶴亭低停偵剃貞呈堤定帝底庭廷弟悌抵挺提梯汀碇禎程締艇訂諦蹄逓"], +["9340","邸鄭釘鼎泥摘擢敵滴的笛適鏑溺哲徹撤轍迭鉄典填天展店添纏甜貼転顛点伝殿澱田電兎吐堵塗妬屠徒斗杜渡登菟賭途都鍍砥砺努度土奴怒倒党冬"], +["9380","凍刀唐塔塘套宕島嶋悼投搭東桃梼棟盗淘湯涛灯燈当痘祷等答筒糖統到董蕩藤討謄豆踏逃透鐙陶頭騰闘働動同堂導憧撞洞瞳童胴萄道銅峠鴇匿得徳涜特督禿篤毒独読栃橡凸突椴届鳶苫寅酉瀞噸屯惇敦沌豚遁頓呑曇鈍奈那内乍凪薙謎灘捺鍋楢馴縄畷南楠軟難汝二尼弐迩匂賑肉虹廿日乳入"], +["9440","如尿韮任妊忍認濡禰祢寧葱猫熱年念捻撚燃粘乃廼之埜嚢悩濃納能脳膿農覗蚤巴把播覇杷波派琶破婆罵芭馬俳廃拝排敗杯盃牌背肺輩配倍培媒梅"], +["9480","楳煤狽買売賠陪這蝿秤矧萩伯剥博拍柏泊白箔粕舶薄迫曝漠爆縛莫駁麦函箱硲箸肇筈櫨幡肌畑畠八鉢溌発醗髪伐罰抜筏閥鳩噺塙蛤隼伴判半反叛帆搬斑板氾汎版犯班畔繁般藩販範釆煩頒飯挽晩番盤磐蕃蛮匪卑否妃庇彼悲扉批披斐比泌疲皮碑秘緋罷肥被誹費避非飛樋簸備尾微枇毘琵眉美"], +["9540","鼻柊稗匹疋髭彦膝菱肘弼必畢筆逼桧姫媛紐百謬俵彪標氷漂瓢票表評豹廟描病秒苗錨鋲蒜蛭鰭品彬斌浜瀕貧賓頻敏瓶不付埠夫婦富冨布府怖扶敷"], +["9580","斧普浮父符腐膚芙譜負賦赴阜附侮撫武舞葡蕪部封楓風葺蕗伏副復幅服福腹複覆淵弗払沸仏物鮒分吻噴墳憤扮焚奮粉糞紛雰文聞丙併兵塀幣平弊柄並蔽閉陛米頁僻壁癖碧別瞥蔑箆偏変片篇編辺返遍便勉娩弁鞭保舗鋪圃捕歩甫補輔穂募墓慕戊暮母簿菩倣俸包呆報奉宝峰峯崩庖抱捧放方朋"], +["9640","法泡烹砲縫胞芳萌蓬蜂褒訪豊邦鋒飽鳳鵬乏亡傍剖坊妨帽忘忙房暴望某棒冒紡肪膨謀貌貿鉾防吠頬北僕卜墨撲朴牧睦穆釦勃没殆堀幌奔本翻凡盆"], +["9680","摩磨魔麻埋妹昧枚毎哩槙幕膜枕鮪柾鱒桝亦俣又抹末沫迄侭繭麿万慢満漫蔓味未魅巳箕岬密蜜湊蓑稔脈妙粍民眠務夢無牟矛霧鵡椋婿娘冥名命明盟迷銘鳴姪牝滅免棉綿緬面麺摸模茂妄孟毛猛盲網耗蒙儲木黙目杢勿餅尤戻籾貰問悶紋門匁也冶夜爺耶野弥矢厄役約薬訳躍靖柳薮鑓愉愈油癒"], +["9740","諭輸唯佑優勇友宥幽悠憂揖有柚湧涌猶猷由祐裕誘遊邑郵雄融夕予余与誉輿預傭幼妖容庸揚揺擁曜楊様洋溶熔用窯羊耀葉蓉要謡踊遥陽養慾抑欲"], +["9780","沃浴翌翼淀羅螺裸来莱頼雷洛絡落酪乱卵嵐欄濫藍蘭覧利吏履李梨理璃痢裏裡里離陸律率立葎掠略劉流溜琉留硫粒隆竜龍侶慮旅虜了亮僚両凌寮料梁涼猟療瞭稜糧良諒遼量陵領力緑倫厘林淋燐琳臨輪隣鱗麟瑠塁涙累類令伶例冷励嶺怜玲礼苓鈴隷零霊麗齢暦歴列劣烈裂廉恋憐漣煉簾練聯"], +["9840","蓮連錬呂魯櫓炉賂路露労婁廊弄朗楼榔浪漏牢狼篭老聾蝋郎六麓禄肋録論倭和話歪賄脇惑枠鷲亙亘鰐詫藁蕨椀湾碗腕"], +["989f","弌丐丕个丱丶丼丿乂乖乘亂亅豫亊舒弍于亞亟亠亢亰亳亶从仍仄仆仂仗仞仭仟价伉佚估佛佝佗佇佶侈侏侘佻佩佰侑佯來侖儘俔俟俎俘俛俑俚俐俤俥倚倨倔倪倥倅伜俶倡倩倬俾俯們倆偃假會偕偐偈做偖偬偸傀傚傅傴傲"], +["9940","僉僊傳僂僖僞僥僭僣僮價僵儉儁儂儖儕儔儚儡儺儷儼儻儿兀兒兌兔兢竸兩兪兮冀冂囘册冉冏冑冓冕冖冤冦冢冩冪冫决冱冲冰况冽凅凉凛几處凩凭"], +["9980","凰凵凾刄刋刔刎刧刪刮刳刹剏剄剋剌剞剔剪剴剩剳剿剽劍劔劒剱劈劑辨辧劬劭劼劵勁勍勗勞勣勦飭勠勳勵勸勹匆匈甸匍匐匏匕匚匣匯匱匳匸區卆卅丗卉卍凖卞卩卮夘卻卷厂厖厠厦厥厮厰厶參簒雙叟曼燮叮叨叭叺吁吽呀听吭吼吮吶吩吝呎咏呵咎呟呱呷呰咒呻咀呶咄咐咆哇咢咸咥咬哄哈咨"], +["9a40","咫哂咤咾咼哘哥哦唏唔哽哮哭哺哢唹啀啣啌售啜啅啖啗唸唳啝喙喀咯喊喟啻啾喘喞單啼喃喩喇喨嗚嗅嗟嗄嗜嗤嗔嘔嗷嘖嗾嗽嘛嗹噎噐營嘴嘶嘲嘸"], +["9a80","噫噤嘯噬噪嚆嚀嚊嚠嚔嚏嚥嚮嚶嚴囂嚼囁囃囀囈囎囑囓囗囮囹圀囿圄圉圈國圍圓團圖嗇圜圦圷圸坎圻址坏坩埀垈坡坿垉垓垠垳垤垪垰埃埆埔埒埓堊埖埣堋堙堝塲堡塢塋塰毀塒堽塹墅墹墟墫墺壞墻墸墮壅壓壑壗壙壘壥壜壤壟壯壺壹壻壼壽夂夊夐夛梦夥夬夭夲夸夾竒奕奐奎奚奘奢奠奧奬奩"], +["9b40","奸妁妝佞侫妣妲姆姨姜妍姙姚娥娟娑娜娉娚婀婬婉娵娶婢婪媚媼媾嫋嫂媽嫣嫗嫦嫩嫖嫺嫻嬌嬋嬖嬲嫐嬪嬶嬾孃孅孀孑孕孚孛孥孩孰孳孵學斈孺宀"], +["9b80","它宦宸寃寇寉寔寐寤實寢寞寥寫寰寶寳尅將專對尓尠尢尨尸尹屁屆屎屓屐屏孱屬屮乢屶屹岌岑岔妛岫岻岶岼岷峅岾峇峙峩峽峺峭嶌峪崋崕崗嵜崟崛崑崔崢崚崙崘嵌嵒嵎嵋嵬嵳嵶嶇嶄嶂嶢嶝嶬嶮嶽嶐嶷嶼巉巍巓巒巖巛巫已巵帋帚帙帑帛帶帷幄幃幀幎幗幔幟幢幤幇幵并幺麼广庠廁廂廈廐廏"], +["9c40","廖廣廝廚廛廢廡廨廩廬廱廳廰廴廸廾弃弉彝彜弋弑弖弩弭弸彁彈彌彎弯彑彖彗彙彡彭彳彷徃徂彿徊很徑徇從徙徘徠徨徭徼忖忻忤忸忱忝悳忿怡恠"], +["9c80","怙怐怩怎怱怛怕怫怦怏怺恚恁恪恷恟恊恆恍恣恃恤恂恬恫恙悁悍惧悃悚悄悛悖悗悒悧悋惡悸惠惓悴忰悽惆悵惘慍愕愆惶惷愀惴惺愃愡惻惱愍愎慇愾愨愧慊愿愼愬愴愽慂慄慳慷慘慙慚慫慴慯慥慱慟慝慓慵憙憖憇憬憔憚憊憑憫憮懌懊應懷懈懃懆憺懋罹懍懦懣懶懺懴懿懽懼懾戀戈戉戍戌戔戛"], +["9d40","戞戡截戮戰戲戳扁扎扞扣扛扠扨扼抂抉找抒抓抖拔抃抔拗拑抻拏拿拆擔拈拜拌拊拂拇抛拉挌拮拱挧挂挈拯拵捐挾捍搜捏掖掎掀掫捶掣掏掉掟掵捫"], +["9d80","捩掾揩揀揆揣揉插揶揄搖搴搆搓搦搶攝搗搨搏摧摯摶摎攪撕撓撥撩撈撼據擒擅擇撻擘擂擱擧舉擠擡抬擣擯攬擶擴擲擺攀擽攘攜攅攤攣攫攴攵攷收攸畋效敖敕敍敘敞敝敲數斂斃變斛斟斫斷旃旆旁旄旌旒旛旙无旡旱杲昊昃旻杳昵昶昴昜晏晄晉晁晞晝晤晧晨晟晢晰暃暈暎暉暄暘暝曁暹曉暾暼"], +["9e40","曄暸曖曚曠昿曦曩曰曵曷朏朖朞朦朧霸朮朿朶杁朸朷杆杞杠杙杣杤枉杰枩杼杪枌枋枦枡枅枷柯枴柬枳柩枸柤柞柝柢柮枹柎柆柧檜栞框栩桀桍栲桎"], +["9e80","梳栫桙档桷桿梟梏梭梔條梛梃檮梹桴梵梠梺椏梍桾椁棊椈棘椢椦棡椌棍棔棧棕椶椒椄棗棣椥棹棠棯椨椪椚椣椡棆楹楷楜楸楫楔楾楮椹楴椽楙椰楡楞楝榁楪榲榮槐榿槁槓榾槎寨槊槝榻槃榧樮榑榠榜榕榴槞槨樂樛槿權槹槲槧樅榱樞槭樔槫樊樒櫁樣樓橄樌橲樶橸橇橢橙橦橈樸樢檐檍檠檄檢檣"], +["9f40","檗蘗檻櫃櫂檸檳檬櫞櫑櫟檪櫚櫪櫻欅蘖櫺欒欖鬱欟欸欷盜欹飮歇歃歉歐歙歔歛歟歡歸歹歿殀殄殃殍殘殕殞殤殪殫殯殲殱殳殷殼毆毋毓毟毬毫毳毯"], +["9f80","麾氈氓气氛氤氣汞汕汢汪沂沍沚沁沛汾汨汳沒沐泄泱泓沽泗泅泝沮沱沾沺泛泯泙泪洟衍洶洫洽洸洙洵洳洒洌浣涓浤浚浹浙涎涕濤涅淹渕渊涵淇淦涸淆淬淞淌淨淒淅淺淙淤淕淪淮渭湮渮渙湲湟渾渣湫渫湶湍渟湃渺湎渤滿渝游溂溪溘滉溷滓溽溯滄溲滔滕溏溥滂溟潁漑灌滬滸滾漿滲漱滯漲滌"], +["e040","漾漓滷澆潺潸澁澀潯潛濳潭澂潼潘澎澑濂潦澳澣澡澤澹濆澪濟濕濬濔濘濱濮濛瀉瀋濺瀑瀁瀏濾瀛瀚潴瀝瀘瀟瀰瀾瀲灑灣炙炒炯烱炬炸炳炮烟烋烝"], +["e080","烙焉烽焜焙煥煕熈煦煢煌煖煬熏燻熄熕熨熬燗熹熾燒燉燔燎燠燬燧燵燼燹燿爍爐爛爨爭爬爰爲爻爼爿牀牆牋牘牴牾犂犁犇犒犖犢犧犹犲狃狆狄狎狒狢狠狡狹狷倏猗猊猜猖猝猴猯猩猥猾獎獏默獗獪獨獰獸獵獻獺珈玳珎玻珀珥珮珞璢琅瑯琥珸琲琺瑕琿瑟瑙瑁瑜瑩瑰瑣瑪瑶瑾璋璞璧瓊瓏瓔珱"], +["e140","瓠瓣瓧瓩瓮瓲瓰瓱瓸瓷甄甃甅甌甎甍甕甓甞甦甬甼畄畍畊畉畛畆畚畩畤畧畫畭畸當疆疇畴疊疉疂疔疚疝疥疣痂疳痃疵疽疸疼疱痍痊痒痙痣痞痾痿"], +["e180","痼瘁痰痺痲痳瘋瘍瘉瘟瘧瘠瘡瘢瘤瘴瘰瘻癇癈癆癜癘癡癢癨癩癪癧癬癰癲癶癸發皀皃皈皋皎皖皓皙皚皰皴皸皹皺盂盍盖盒盞盡盥盧盪蘯盻眈眇眄眩眤眞眥眦眛眷眸睇睚睨睫睛睥睿睾睹瞎瞋瞑瞠瞞瞰瞶瞹瞿瞼瞽瞻矇矍矗矚矜矣矮矼砌砒礦砠礪硅碎硴碆硼碚碌碣碵碪碯磑磆磋磔碾碼磅磊磬"], +["e240","磧磚磽磴礇礒礑礙礬礫祀祠祗祟祚祕祓祺祿禊禝禧齋禪禮禳禹禺秉秕秧秬秡秣稈稍稘稙稠稟禀稱稻稾稷穃穗穉穡穢穩龝穰穹穽窈窗窕窘窖窩竈窰"], +["e280","窶竅竄窿邃竇竊竍竏竕竓站竚竝竡竢竦竭竰笂笏笊笆笳笘笙笞笵笨笶筐筺笄筍笋筌筅筵筥筴筧筰筱筬筮箝箘箟箍箜箚箋箒箏筝箙篋篁篌篏箴篆篝篩簑簔篦篥籠簀簇簓篳篷簗簍篶簣簧簪簟簷簫簽籌籃籔籏籀籐籘籟籤籖籥籬籵粃粐粤粭粢粫粡粨粳粲粱粮粹粽糀糅糂糘糒糜糢鬻糯糲糴糶糺紆"], +["e340","紂紜紕紊絅絋紮紲紿紵絆絳絖絎絲絨絮絏絣經綉絛綏絽綛綺綮綣綵緇綽綫總綢綯緜綸綟綰緘緝緤緞緻緲緡縅縊縣縡縒縱縟縉縋縢繆繦縻縵縹繃縷"], +["e380","縲縺繧繝繖繞繙繚繹繪繩繼繻纃緕繽辮繿纈纉續纒纐纓纔纖纎纛纜缸缺罅罌罍罎罐网罕罔罘罟罠罨罩罧罸羂羆羃羈羇羌羔羞羝羚羣羯羲羹羮羶羸譱翅翆翊翕翔翡翦翩翳翹飜耆耄耋耒耘耙耜耡耨耿耻聊聆聒聘聚聟聢聨聳聲聰聶聹聽聿肄肆肅肛肓肚肭冐肬胛胥胙胝胄胚胖脉胯胱脛脩脣脯腋"], +["e440","隋腆脾腓腑胼腱腮腥腦腴膃膈膊膀膂膠膕膤膣腟膓膩膰膵膾膸膽臀臂膺臉臍臑臙臘臈臚臟臠臧臺臻臾舁舂舅與舊舍舐舖舩舫舸舳艀艙艘艝艚艟艤"], +["e480","艢艨艪艫舮艱艷艸艾芍芒芫芟芻芬苡苣苟苒苴苳苺莓范苻苹苞茆苜茉苙茵茴茖茲茱荀茹荐荅茯茫茗茘莅莚莪莟莢莖茣莎莇莊荼莵荳荵莠莉莨菴萓菫菎菽萃菘萋菁菷萇菠菲萍萢萠莽萸蔆菻葭萪萼蕚蒄葷葫蒭葮蒂葩葆萬葯葹萵蓊葢蒹蒿蒟蓙蓍蒻蓚蓐蓁蓆蓖蒡蔡蓿蓴蔗蔘蔬蔟蔕蔔蓼蕀蕣蕘蕈"], +["e540","蕁蘂蕋蕕薀薤薈薑薊薨蕭薔薛藪薇薜蕷蕾薐藉薺藏薹藐藕藝藥藜藹蘊蘓蘋藾藺蘆蘢蘚蘰蘿虍乕虔號虧虱蚓蚣蚩蚪蚋蚌蚶蚯蛄蛆蚰蛉蠣蚫蛔蛞蛩蛬"], +["e580","蛟蛛蛯蜒蜆蜈蜀蜃蛻蜑蜉蜍蛹蜊蜴蜿蜷蜻蜥蜩蜚蝠蝟蝸蝌蝎蝴蝗蝨蝮蝙蝓蝣蝪蠅螢螟螂螯蟋螽蟀蟐雖螫蟄螳蟇蟆螻蟯蟲蟠蠏蠍蟾蟶蟷蠎蟒蠑蠖蠕蠢蠡蠱蠶蠹蠧蠻衄衂衒衙衞衢衫袁衾袞衵衽袵衲袂袗袒袮袙袢袍袤袰袿袱裃裄裔裘裙裝裹褂裼裴裨裲褄褌褊褓襃褞褥褪褫襁襄褻褶褸襌褝襠襞"], +["e640","襦襤襭襪襯襴襷襾覃覈覊覓覘覡覩覦覬覯覲覺覽覿觀觚觜觝觧觴觸訃訖訐訌訛訝訥訶詁詛詒詆詈詼詭詬詢誅誂誄誨誡誑誥誦誚誣諄諍諂諚諫諳諧"], +["e680","諤諱謔諠諢諷諞諛謌謇謚諡謖謐謗謠謳鞫謦謫謾謨譁譌譏譎證譖譛譚譫譟譬譯譴譽讀讌讎讒讓讖讙讚谺豁谿豈豌豎豐豕豢豬豸豺貂貉貅貊貍貎貔豼貘戝貭貪貽貲貳貮貶賈賁賤賣賚賽賺賻贄贅贊贇贏贍贐齎贓賍贔贖赧赭赱赳趁趙跂趾趺跏跚跖跌跛跋跪跫跟跣跼踈踉跿踝踞踐踟蹂踵踰踴蹊"], +["e740","蹇蹉蹌蹐蹈蹙蹤蹠踪蹣蹕蹶蹲蹼躁躇躅躄躋躊躓躑躔躙躪躡躬躰軆躱躾軅軈軋軛軣軼軻軫軾輊輅輕輒輙輓輜輟輛輌輦輳輻輹轅轂輾轌轉轆轎轗轜"], +["e780","轢轣轤辜辟辣辭辯辷迚迥迢迪迯邇迴逅迹迺逑逕逡逍逞逖逋逧逶逵逹迸遏遐遑遒逎遉逾遖遘遞遨遯遶隨遲邂遽邁邀邊邉邏邨邯邱邵郢郤扈郛鄂鄒鄙鄲鄰酊酖酘酣酥酩酳酲醋醉醂醢醫醯醪醵醴醺釀釁釉釋釐釖釟釡釛釼釵釶鈞釿鈔鈬鈕鈑鉞鉗鉅鉉鉤鉈銕鈿鉋鉐銜銖銓銛鉚鋏銹銷鋩錏鋺鍄錮"], +["e840","錙錢錚錣錺錵錻鍜鍠鍼鍮鍖鎰鎬鎭鎔鎹鏖鏗鏨鏥鏘鏃鏝鏐鏈鏤鐚鐔鐓鐃鐇鐐鐶鐫鐵鐡鐺鑁鑒鑄鑛鑠鑢鑞鑪鈩鑰鑵鑷鑽鑚鑼鑾钁鑿閂閇閊閔閖閘閙"], +["e880","閠閨閧閭閼閻閹閾闊濶闃闍闌闕闔闖關闡闥闢阡阨阮阯陂陌陏陋陷陜陞陝陟陦陲陬隍隘隕隗險隧隱隲隰隴隶隸隹雎雋雉雍襍雜霍雕雹霄霆霈霓霎霑霏霖霙霤霪霰霹霽霾靄靆靈靂靉靜靠靤靦靨勒靫靱靹鞅靼鞁靺鞆鞋鞏鞐鞜鞨鞦鞣鞳鞴韃韆韈韋韜韭齏韲竟韶韵頏頌頸頤頡頷頽顆顏顋顫顯顰"], +["e940","顱顴顳颪颯颱颶飄飃飆飩飫餃餉餒餔餘餡餝餞餤餠餬餮餽餾饂饉饅饐饋饑饒饌饕馗馘馥馭馮馼駟駛駝駘駑駭駮駱駲駻駸騁騏騅駢騙騫騷驅驂驀驃"], +["e980","騾驕驍驛驗驟驢驥驤驩驫驪骭骰骼髀髏髑髓體髞髟髢髣髦髯髫髮髴髱髷髻鬆鬘鬚鬟鬢鬣鬥鬧鬨鬩鬪鬮鬯鬲魄魃魏魍魎魑魘魴鮓鮃鮑鮖鮗鮟鮠鮨鮴鯀鯊鮹鯆鯏鯑鯒鯣鯢鯤鯔鯡鰺鯲鯱鯰鰕鰔鰉鰓鰌鰆鰈鰒鰊鰄鰮鰛鰥鰤鰡鰰鱇鰲鱆鰾鱚鱠鱧鱶鱸鳧鳬鳰鴉鴈鳫鴃鴆鴪鴦鶯鴣鴟鵄鴕鴒鵁鴿鴾鵆鵈"], +["ea40","鵝鵞鵤鵑鵐鵙鵲鶉鶇鶫鵯鵺鶚鶤鶩鶲鷄鷁鶻鶸鶺鷆鷏鷂鷙鷓鷸鷦鷭鷯鷽鸚鸛鸞鹵鹹鹽麁麈麋麌麒麕麑麝麥麩麸麪麭靡黌黎黏黐黔黜點黝黠黥黨黯"], +["ea80","黴黶黷黹黻黼黽鼇鼈皷鼕鼡鼬鼾齊齒齔齣齟齠齡齦齧齬齪齷齲齶龕龜龠堯槇遙瑤凜熙"], +["ed40","纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏"], +["ed80","塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱"], +["ee40","犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙"], +["ee80","蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"], +["eeef","ⅰ",9,"¬¦'""], +["f040","",62], +["f080","",124], +["f140","",62], +["f180","",124], +["f240","",62], +["f280","",124], +["f340","",62], +["f380","",124], +["f440","",62], +["f480","",124], +["f540","",62], +["f580","",124], +["f640","",62], +["f680","",124], +["f740","",62], +["f780","",124], +["f840","",62], +["f880","",124], +["f940",""], +["fa40","ⅰ",9,"Ⅰ",9,"¬¦'"㈱№℡∵纊褜鍈銈蓜俉炻昱棈鋹曻彅丨仡仼伀伃伹佖侒侊侚侔俍偀倢俿倞偆偰偂傔僴僘兊"], +["fa80","兤冝冾凬刕劜劦勀勛匀匇匤卲厓厲叝﨎咜咊咩哿喆坙坥垬埈埇﨏塚增墲夋奓奛奝奣妤妺孖寀甯寘寬尞岦岺峵崧嵓﨑嵂嵭嶸嶹巐弡弴彧德忞恝悅悊惞惕愠惲愑愷愰憘戓抦揵摠撝擎敎昀昕昻昉昮昞昤晥晗晙晴晳暙暠暲暿曺朎朗杦枻桒柀栁桄棏﨓楨﨔榘槢樰橫橆橳橾櫢櫤毖氿汜沆汯泚洄涇浯"], +["fb40","涖涬淏淸淲淼渹湜渧渼溿澈澵濵瀅瀇瀨炅炫焏焄煜煆煇凞燁燾犱犾猤猪獷玽珉珖珣珒琇珵琦琪琩琮瑢璉璟甁畯皂皜皞皛皦益睆劯砡硎硤硺礰礼神"], +["fb80","祥禔福禛竑竧靖竫箞精絈絜綷綠緖繒罇羡羽茁荢荿菇菶葈蒴蕓蕙蕫﨟薰蘒﨡蠇裵訒訷詹誧誾諟諸諶譓譿賰賴贒赶﨣軏﨤逸遧郞都鄕鄧釚釗釞釭釮釤釥鈆鈐鈊鈺鉀鈼鉎鉙鉑鈹鉧銧鉷鉸鋧鋗鋙鋐﨧鋕鋠鋓錥錡鋻﨨錞鋿錝錂鍰鍗鎤鏆鏞鏸鐱鑅鑈閒隆﨩隝隯霳霻靃靍靏靑靕顗顥飯飼餧館馞驎髙"], +["fc40","髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"] +] diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/utf16.js b/node_modules/npm/node_modules/iconv-lite/encodings/utf16.js new file mode 100644 index 00000000..97d06692 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/utf16.js @@ -0,0 +1,197 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js + +// == UTF16-BE codec. ========================================================== + +exports.utf16be = Utf16BECodec; +function Utf16BECodec() { +} + +Utf16BECodec.prototype.encoder = Utf16BEEncoder; +Utf16BECodec.prototype.decoder = Utf16BEDecoder; +Utf16BECodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf16BEEncoder() { +} + +Utf16BEEncoder.prototype.write = function(str) { + var buf = Buffer.from(str, 'ucs2'); + for (var i = 0; i < buf.length; i += 2) { + var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp; + } + return buf; +} + +Utf16BEEncoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf16BEDecoder() { + this.overflowByte = -1; +} + +Utf16BEDecoder.prototype.write = function(buf) { + if (buf.length == 0) + return ''; + + var buf2 = Buffer.alloc(buf.length + 1), + i = 0, j = 0; + + if (this.overflowByte !== -1) { + buf2[0] = buf[0]; + buf2[1] = this.overflowByte; + i = 1; j = 2; + } + + for (; i < buf.length-1; i += 2, j+= 2) { + buf2[j] = buf[i+1]; + buf2[j+1] = buf[i]; + } + + this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1; + + return buf2.slice(0, j).toString('ucs2'); +} + +Utf16BEDecoder.prototype.end = function() { + this.overflowByte = -1; +} + + +// == UTF-16 codec ============================================================= +// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic. +// Defaults to UTF-16LE, as it's prevalent and default in Node. +// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le +// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'}); + +// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false). + +exports.utf16 = Utf16Codec; +function Utf16Codec(codecOptions, iconv) { + this.iconv = iconv; +} + +Utf16Codec.prototype.encoder = Utf16Encoder; +Utf16Codec.prototype.decoder = Utf16Decoder; + + +// -- Encoding (pass-through) + +function Utf16Encoder(options, codec) { + options = options || {}; + if (options.addBOM === undefined) + options.addBOM = true; + this.encoder = codec.iconv.getEncoder('utf-16le', options); +} + +Utf16Encoder.prototype.write = function(str) { + return this.encoder.write(str); +} + +Utf16Encoder.prototype.end = function() { + return this.encoder.end(); +} + + +// -- Decoding + +function Utf16Decoder(options, codec) { + this.decoder = null; + this.initialBufs = []; + this.initialBufsLen = 0; + + this.options = options || {}; + this.iconv = codec.iconv; +} + +Utf16Decoder.prototype.write = function(buf) { + if (!this.decoder) { + // Codec is not chosen yet. Accumulate initial bytes. + this.initialBufs.push(buf); + this.initialBufsLen += buf.length; + + if (this.initialBufsLen < 16) // We need more bytes to use space heuristic (see below) + return ''; + + // We have enough bytes -> detect endianness. + var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var resStr = ''; + for (var i = 0; i < this.initialBufs.length; i++) + resStr += this.decoder.write(this.initialBufs[i]); + + this.initialBufs.length = this.initialBufsLen = 0; + return resStr; + } + + return this.decoder.write(buf); +} + +Utf16Decoder.prototype.end = function() { + if (!this.decoder) { + var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var resStr = ''; + for (var i = 0; i < this.initialBufs.length; i++) + resStr += this.decoder.write(this.initialBufs[i]); + + var trail = this.decoder.end(); + if (trail) + resStr += trail; + + this.initialBufs.length = this.initialBufsLen = 0; + return resStr; + } + return this.decoder.end(); +} + +function detectEncoding(bufs, defaultEncoding) { + var b = []; + var charsProcessed = 0; + var asciiCharsLE = 0, asciiCharsBE = 0; // Number of ASCII chars when decoded as LE or BE. + + outer_loop: + for (var i = 0; i < bufs.length; i++) { + var buf = bufs[i]; + for (var j = 0; j < buf.length; j++) { + b.push(buf[j]); + if (b.length === 2) { + if (charsProcessed === 0) { + // Check BOM first. + if (b[0] === 0xFF && b[1] === 0xFE) return 'utf-16le'; + if (b[0] === 0xFE && b[1] === 0xFF) return 'utf-16be'; + } + + if (b[0] === 0 && b[1] !== 0) asciiCharsBE++; + if (b[0] !== 0 && b[1] === 0) asciiCharsLE++; + + b.length = 0; + charsProcessed++; + + if (charsProcessed >= 100) { + break outer_loop; + } + } + } + } + + // Make decisions. + // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon. + // So, we count ASCII as if it was LE or BE, and decide from that. + if (asciiCharsBE > asciiCharsLE) return 'utf-16be'; + if (asciiCharsBE < asciiCharsLE) return 'utf-16le'; + + // Couldn't decide (likely all zeros or not enough data). + return defaultEncoding || 'utf-16le'; +} + + diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/utf32.js b/node_modules/npm/node_modules/iconv-lite/encodings/utf32.js new file mode 100644 index 00000000..2fa900a1 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/utf32.js @@ -0,0 +1,319 @@ +'use strict'; + +var Buffer = require('safer-buffer').Buffer; + +// == UTF32-LE/BE codec. ========================================================== + +exports._utf32 = Utf32Codec; + +function Utf32Codec(codecOptions, iconv) { + this.iconv = iconv; + this.bomAware = true; + this.isLE = codecOptions.isLE; +} + +exports.utf32le = { type: '_utf32', isLE: true }; +exports.utf32be = { type: '_utf32', isLE: false }; + +// Aliases +exports.ucs4le = 'utf32le'; +exports.ucs4be = 'utf32be'; + +Utf32Codec.prototype.encoder = Utf32Encoder; +Utf32Codec.prototype.decoder = Utf32Decoder; + +// -- Encoding + +function Utf32Encoder(options, codec) { + this.isLE = codec.isLE; + this.highSurrogate = 0; +} + +Utf32Encoder.prototype.write = function(str) { + var src = Buffer.from(str, 'ucs2'); + var dst = Buffer.alloc(src.length * 2); + var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE; + var offset = 0; + + for (var i = 0; i < src.length; i += 2) { + var code = src.readUInt16LE(i); + var isHighSurrogate = (0xD800 <= code && code < 0xDC00); + var isLowSurrogate = (0xDC00 <= code && code < 0xE000); + + if (this.highSurrogate) { + if (isHighSurrogate || !isLowSurrogate) { + // There shouldn't be two high surrogates in a row, nor a high surrogate which isn't followed by a low + // surrogate. If this happens, keep the pending high surrogate as a stand-alone semi-invalid character + // (technically wrong, but expected by some applications, like Windows file names). + write32.call(dst, this.highSurrogate, offset); + offset += 4; + } + else { + // Create 32-bit value from high and low surrogates; + var codepoint = (((this.highSurrogate - 0xD800) << 10) | (code - 0xDC00)) + 0x10000; + + write32.call(dst, codepoint, offset); + offset += 4; + this.highSurrogate = 0; + + continue; + } + } + + if (isHighSurrogate) + this.highSurrogate = code; + else { + // Even if the current character is a low surrogate, with no previous high surrogate, we'll + // encode it as a semi-invalid stand-alone character for the same reasons expressed above for + // unpaired high surrogates. + write32.call(dst, code, offset); + offset += 4; + this.highSurrogate = 0; + } + } + + if (offset < dst.length) + dst = dst.slice(0, offset); + + return dst; +}; + +Utf32Encoder.prototype.end = function() { + // Treat any leftover high surrogate as a semi-valid independent character. + if (!this.highSurrogate) + return; + + var buf = Buffer.alloc(4); + + if (this.isLE) + buf.writeUInt32LE(this.highSurrogate, 0); + else + buf.writeUInt32BE(this.highSurrogate, 0); + + this.highSurrogate = 0; + + return buf; +}; + +// -- Decoding + +function Utf32Decoder(options, codec) { + this.isLE = codec.isLE; + this.badChar = codec.iconv.defaultCharUnicode.charCodeAt(0); + this.overflow = []; +} + +Utf32Decoder.prototype.write = function(src) { + if (src.length === 0) + return ''; + + var i = 0; + var codepoint = 0; + var dst = Buffer.alloc(src.length + 4); + var offset = 0; + var isLE = this.isLE; + var overflow = this.overflow; + var badChar = this.badChar; + + if (overflow.length > 0) { + for (; i < src.length && overflow.length < 4; i++) + overflow.push(src[i]); + + if (overflow.length === 4) { + // NOTE: codepoint is a signed int32 and can be negative. + // NOTE: We copied this block from below to help V8 optimize it (it works with array, not buffer). + if (isLE) { + codepoint = overflow[i] | (overflow[i+1] << 8) | (overflow[i+2] << 16) | (overflow[i+3] << 24); + } else { + codepoint = overflow[i+3] | (overflow[i+2] << 8) | (overflow[i+1] << 16) | (overflow[i] << 24); + } + overflow.length = 0; + + offset = _writeCodepoint(dst, offset, codepoint, badChar); + } + } + + // Main loop. Should be as optimized as possible. + for (; i < src.length - 3; i += 4) { + // NOTE: codepoint is a signed int32 and can be negative. + if (isLE) { + codepoint = src[i] | (src[i+1] << 8) | (src[i+2] << 16) | (src[i+3] << 24); + } else { + codepoint = src[i+3] | (src[i+2] << 8) | (src[i+1] << 16) | (src[i] << 24); + } + offset = _writeCodepoint(dst, offset, codepoint, badChar); + } + + // Keep overflowing bytes. + for (; i < src.length; i++) { + overflow.push(src[i]); + } + + return dst.slice(0, offset).toString('ucs2'); +}; + +function _writeCodepoint(dst, offset, codepoint, badChar) { + // NOTE: codepoint is signed int32 and can be negative. We keep it that way to help V8 with optimizations. + if (codepoint < 0 || codepoint > 0x10FFFF) { + // Not a valid Unicode codepoint + codepoint = badChar; + } + + // Ephemeral Planes: Write high surrogate. + if (codepoint >= 0x10000) { + codepoint -= 0x10000; + + var high = 0xD800 | (codepoint >> 10); + dst[offset++] = high & 0xff; + dst[offset++] = high >> 8; + + // Low surrogate is written below. + var codepoint = 0xDC00 | (codepoint & 0x3FF); + } + + // Write BMP char or low surrogate. + dst[offset++] = codepoint & 0xff; + dst[offset++] = codepoint >> 8; + + return offset; +}; + +Utf32Decoder.prototype.end = function() { + this.overflow.length = 0; +}; + +// == UTF-32 Auto codec ============================================================= +// Decoder chooses automatically from UTF-32LE and UTF-32BE using BOM and space-based heuristic. +// Defaults to UTF-32LE. http://en.wikipedia.org/wiki/UTF-32 +// Encoder/decoder default can be changed: iconv.decode(buf, 'utf32', {defaultEncoding: 'utf-32be'}); + +// Encoder prepends BOM (which can be overridden with (addBOM: false}). + +exports.utf32 = Utf32AutoCodec; +exports.ucs4 = 'utf32'; + +function Utf32AutoCodec(options, iconv) { + this.iconv = iconv; +} + +Utf32AutoCodec.prototype.encoder = Utf32AutoEncoder; +Utf32AutoCodec.prototype.decoder = Utf32AutoDecoder; + +// -- Encoding + +function Utf32AutoEncoder(options, codec) { + options = options || {}; + + if (options.addBOM === undefined) + options.addBOM = true; + + this.encoder = codec.iconv.getEncoder(options.defaultEncoding || 'utf-32le', options); +} + +Utf32AutoEncoder.prototype.write = function(str) { + return this.encoder.write(str); +}; + +Utf32AutoEncoder.prototype.end = function() { + return this.encoder.end(); +}; + +// -- Decoding + +function Utf32AutoDecoder(options, codec) { + this.decoder = null; + this.initialBufs = []; + this.initialBufsLen = 0; + this.options = options || {}; + this.iconv = codec.iconv; +} + +Utf32AutoDecoder.prototype.write = function(buf) { + if (!this.decoder) { + // Codec is not chosen yet. Accumulate initial bytes. + this.initialBufs.push(buf); + this.initialBufsLen += buf.length; + + if (this.initialBufsLen < 32) // We need more bytes to use space heuristic (see below) + return ''; + + // We have enough bytes -> detect endianness. + var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var resStr = ''; + for (var i = 0; i < this.initialBufs.length; i++) + resStr += this.decoder.write(this.initialBufs[i]); + + this.initialBufs.length = this.initialBufsLen = 0; + return resStr; + } + + return this.decoder.write(buf); +}; + +Utf32AutoDecoder.prototype.end = function() { + if (!this.decoder) { + var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var resStr = ''; + for (var i = 0; i < this.initialBufs.length; i++) + resStr += this.decoder.write(this.initialBufs[i]); + + var trail = this.decoder.end(); + if (trail) + resStr += trail; + + this.initialBufs.length = this.initialBufsLen = 0; + return resStr; + } + + return this.decoder.end(); +}; + +function detectEncoding(bufs, defaultEncoding) { + var b = []; + var charsProcessed = 0; + var invalidLE = 0, invalidBE = 0; // Number of invalid chars when decoded as LE or BE. + var bmpCharsLE = 0, bmpCharsBE = 0; // Number of BMP chars when decoded as LE or BE. + + outer_loop: + for (var i = 0; i < bufs.length; i++) { + var buf = bufs[i]; + for (var j = 0; j < buf.length; j++) { + b.push(buf[j]); + if (b.length === 4) { + if (charsProcessed === 0) { + // Check BOM first. + if (b[0] === 0xFF && b[1] === 0xFE && b[2] === 0 && b[3] === 0) { + return 'utf-32le'; + } + if (b[0] === 0 && b[1] === 0 && b[2] === 0xFE && b[3] === 0xFF) { + return 'utf-32be'; + } + } + + if (b[0] !== 0 || b[1] > 0x10) invalidBE++; + if (b[3] !== 0 || b[2] > 0x10) invalidLE++; + + if (b[0] === 0 && b[1] === 0 && (b[2] !== 0 || b[3] !== 0)) bmpCharsBE++; + if ((b[0] !== 0 || b[1] !== 0) && b[2] === 0 && b[3] === 0) bmpCharsLE++; + + b.length = 0; + charsProcessed++; + + if (charsProcessed >= 100) { + break outer_loop; + } + } + } + } + + // Make decisions. + if (bmpCharsBE - invalidBE > bmpCharsLE - invalidLE) return 'utf-32be'; + if (bmpCharsBE - invalidBE < bmpCharsLE - invalidLE) return 'utf-32le'; + + // Couldn't decide (likely all zeros or not enough data). + return defaultEncoding || 'utf-32le'; +} diff --git a/node_modules/npm/node_modules/iconv-lite/encodings/utf7.js b/node_modules/npm/node_modules/iconv-lite/encodings/utf7.js new file mode 100644 index 00000000..eacae34d --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/encodings/utf7.js @@ -0,0 +1,290 @@ +"use strict"; +var Buffer = require("safer-buffer").Buffer; + +// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152 +// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3 + +exports.utf7 = Utf7Codec; +exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7 +function Utf7Codec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7Codec.prototype.encoder = Utf7Encoder; +Utf7Codec.prototype.decoder = Utf7Decoder; +Utf7Codec.prototype.bomAware = true; + + +// -- Encoding + +var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g; + +function Utf7Encoder(options, codec) { + this.iconv = codec.iconv; +} + +Utf7Encoder.prototype.write = function(str) { + // Naive implementation. + // Non-direct chars are encoded as "+-"; single "+" char is encoded as "+-". + return Buffer.from(str.replace(nonDirectChars, function(chunk) { + return "+" + (chunk === '+' ? '' : + this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) + + "-"; + }.bind(this))); +} + +Utf7Encoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf7Decoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64Regex = /[A-Za-z0-9\/+]/; +var base64Chars = []; +for (var i = 0; i < 256; i++) + base64Chars[i] = base64Regex.test(String.fromCharCode(i)); + +var plusChar = '+'.charCodeAt(0), + minusChar = '-'.charCodeAt(0), + andChar = '&'.charCodeAt(0); + +Utf7Decoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '+' + if (buf[i] == plusChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64Chars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) {// "+-" -> "+" + res += "+"; + } else { + var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i), "ascii"); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus is absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii"); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7Decoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + +// UTF-7-IMAP codec. +// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3) +// Differences: +// * Base64 part is started by "&" instead of "+" +// * Direct characters are 0x20-0x7E, except "&" (0x26) +// * In Base64, "," is used instead of "/" +// * Base64 must not be used to represent direct characters. +// * No implicit shift back from Base64 (should always end with '-') +// * String must end in non-shifted position. +// * "-&" while in base64 is not allowed. + + +exports.utf7imap = Utf7IMAPCodec; +function Utf7IMAPCodec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder; +Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder; +Utf7IMAPCodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf7IMAPEncoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = Buffer.alloc(6); + this.base64AccumIdx = 0; +} + +Utf7IMAPEncoder.prototype.write = function(str) { + var inBase64 = this.inBase64, + base64Accum = this.base64Accum, + base64AccumIdx = this.base64AccumIdx, + buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0; + + for (var i = 0; i < str.length; i++) { + var uChar = str.charCodeAt(i); + if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'. + if (inBase64) { + if (base64AccumIdx > 0) { + bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + inBase64 = false; + } + + if (!inBase64) { + buf[bufIdx++] = uChar; // Write direct character + + if (uChar === andChar) // Ampersand -> '&-' + buf[bufIdx++] = minusChar; + } + + } else { // Non-direct character + if (!inBase64) { + buf[bufIdx++] = andChar; // Write '&', then go to base64 mode. + inBase64 = true; + } + if (inBase64) { + base64Accum[base64AccumIdx++] = uChar >> 8; + base64Accum[base64AccumIdx++] = uChar & 0xFF; + + if (base64AccumIdx == base64Accum.length) { + bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx); + base64AccumIdx = 0; + } + } + } + } + + this.inBase64 = inBase64; + this.base64AccumIdx = base64AccumIdx; + + return buf.slice(0, bufIdx); +} + +Utf7IMAPEncoder.prototype.end = function() { + var buf = Buffer.alloc(10), bufIdx = 0; + if (this.inBase64) { + if (this.base64AccumIdx > 0) { + bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + this.base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + this.inBase64 = false; + } + + return buf.slice(0, bufIdx); +} + + +// -- Decoding + +function Utf7IMAPDecoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64IMAPChars = base64Chars.slice(); +base64IMAPChars[','.charCodeAt(0)] = true; + +Utf7IMAPDecoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + // It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end). + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '&' + if (buf[i] == andChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64IMAPChars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) { // "&-" -> "&" + res += "&"; + } else { + var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i), "ascii").replace(/,/g, '/'); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus may be absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii").replace(/,/g, '/'); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7IMAPDecoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + diff --git a/node_modules/npm/node_modules/iconv-lite/lib/bom-handling.js b/node_modules/npm/node_modules/iconv-lite/lib/bom-handling.js new file mode 100644 index 00000000..10508723 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/lib/bom-handling.js @@ -0,0 +1,52 @@ +"use strict"; + +var BOMChar = '\uFEFF'; + +exports.PrependBOM = PrependBOMWrapper +function PrependBOMWrapper(encoder, options) { + this.encoder = encoder; + this.addBOM = true; +} + +PrependBOMWrapper.prototype.write = function(str) { + if (this.addBOM) { + str = BOMChar + str; + this.addBOM = false; + } + + return this.encoder.write(str); +} + +PrependBOMWrapper.prototype.end = function() { + return this.encoder.end(); +} + + +//------------------------------------------------------------------------------ + +exports.StripBOM = StripBOMWrapper; +function StripBOMWrapper(decoder, options) { + this.decoder = decoder; + this.pass = false; + this.options = options || {}; +} + +StripBOMWrapper.prototype.write = function(buf) { + var res = this.decoder.write(buf); + if (this.pass || !res) + return res; + + if (res[0] === BOMChar) { + res = res.slice(1); + if (typeof this.options.stripBOM === 'function') + this.options.stripBOM(); + } + + this.pass = true; + return res; +} + +StripBOMWrapper.prototype.end = function() { + return this.decoder.end(); +} + diff --git a/node_modules/npm/node_modules/iconv-lite/lib/index.js b/node_modules/npm/node_modules/iconv-lite/lib/index.js new file mode 100644 index 00000000..657701c3 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/lib/index.js @@ -0,0 +1,180 @@ +"use strict"; + +var Buffer = require("safer-buffer").Buffer; + +var bomHandling = require("./bom-handling"), + iconv = module.exports; + +// All codecs and aliases are kept here, keyed by encoding name/alias. +// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`. +iconv.encodings = null; + +// Characters emitted in case of error. +iconv.defaultCharUnicode = '�'; +iconv.defaultCharSingleByte = '?'; + +// Public API. +iconv.encode = function encode(str, encoding, options) { + str = "" + (str || ""); // Ensure string. + + var encoder = iconv.getEncoder(encoding, options); + + var res = encoder.write(str); + var trail = encoder.end(); + + return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res; +} + +iconv.decode = function decode(buf, encoding, options) { + if (typeof buf === 'string') { + if (!iconv.skipDecodeWarning) { + console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding'); + iconv.skipDecodeWarning = true; + } + + buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer. + } + + var decoder = iconv.getDecoder(encoding, options); + + var res = decoder.write(buf); + var trail = decoder.end(); + + return trail ? (res + trail) : res; +} + +iconv.encodingExists = function encodingExists(enc) { + try { + iconv.getCodec(enc); + return true; + } catch (e) { + return false; + } +} + +// Legacy aliases to convert functions +iconv.toEncoding = iconv.encode; +iconv.fromEncoding = iconv.decode; + +// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache. +iconv._codecDataCache = {}; +iconv.getCodec = function getCodec(encoding) { + if (!iconv.encodings) + iconv.encodings = require("../encodings"); // Lazy load all encoding definitions. + + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + var enc = iconv._canonicalizeEncoding(encoding); + + // Traverse iconv.encodings to find actual codec. + var codecOptions = {}; + while (true) { + var codec = iconv._codecDataCache[enc]; + if (codec) + return codec; + + var codecDef = iconv.encodings[enc]; + + switch (typeof codecDef) { + case "string": // Direct alias to other encoding. + enc = codecDef; + break; + + case "object": // Alias with options. Can be layered. + for (var key in codecDef) + codecOptions[key] = codecDef[key]; + + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + enc = codecDef.type; + break; + + case "function": // Codec itself. + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + // The codec function must load all tables and return object with .encoder and .decoder methods. + // It'll be called only once (for each different options object). + codec = new codecDef(codecOptions, iconv); + + iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later. + return codec; + + default: + throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')"); + } + } +} + +iconv._canonicalizeEncoding = function(encoding) { + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, ""); +} + +iconv.getEncoder = function getEncoder(encoding, options) { + var codec = iconv.getCodec(encoding), + encoder = new codec.encoder(options, codec); + + if (codec.bomAware && options && options.addBOM) + encoder = new bomHandling.PrependBOM(encoder, options); + + return encoder; +} + +iconv.getDecoder = function getDecoder(encoding, options) { + var codec = iconv.getCodec(encoding), + decoder = new codec.decoder(options, codec); + + if (codec.bomAware && !(options && options.stripBOM === false)) + decoder = new bomHandling.StripBOM(decoder, options); + + return decoder; +} + +// Streaming API +// NOTE: Streaming API naturally depends on 'stream' module from Node.js. Unfortunately in browser environments this module can add +// up to 100Kb to the output bundle. To avoid unnecessary code bloat, we don't enable Streaming API in browser by default. +// If you would like to enable it explicitly, please add the following code to your app: +// > iconv.enableStreamingAPI(require('stream')); +iconv.enableStreamingAPI = function enableStreamingAPI(stream_module) { + if (iconv.supportsStreams) + return; + + // Dependency-inject stream module to create IconvLite stream classes. + var streams = require("./streams")(stream_module); + + // Not public API yet, but expose the stream classes. + iconv.IconvLiteEncoderStream = streams.IconvLiteEncoderStream; + iconv.IconvLiteDecoderStream = streams.IconvLiteDecoderStream; + + // Streaming API. + iconv.encodeStream = function encodeStream(encoding, options) { + return new iconv.IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options); + } + + iconv.decodeStream = function decodeStream(encoding, options) { + return new iconv.IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options); + } + + iconv.supportsStreams = true; +} + +// Enable Streaming API automatically if 'stream' module is available and non-empty (the majority of environments). +var stream_module; +try { + stream_module = require("stream"); +} catch (e) {} + +if (stream_module && stream_module.Transform) { + iconv.enableStreamingAPI(stream_module); + +} else { + // In rare cases where 'stream' module is not available by default, throw a helpful exception. + iconv.encodeStream = iconv.decodeStream = function() { + throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it."); + }; +} + +if ("Ā" != "\u0100") { + console.error("iconv-lite warning: js files use non-utf8 encoding. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info."); +} diff --git a/node_modules/npm/node_modules/iconv-lite/lib/streams.js b/node_modules/npm/node_modules/iconv-lite/lib/streams.js new file mode 100644 index 00000000..a1506482 --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/lib/streams.js @@ -0,0 +1,109 @@ +"use strict"; + +var Buffer = require("safer-buffer").Buffer; + +// NOTE: Due to 'stream' module being pretty large (~100Kb, significant in browser environments), +// we opt to dependency-inject it instead of creating a hard dependency. +module.exports = function(stream_module) { + var Transform = stream_module.Transform; + + // == Encoder stream ======================================================= + + function IconvLiteEncoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.decodeStrings = false; // We accept only strings, so we don't need to decode them. + Transform.call(this, options); + } + + IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteEncoderStream } + }); + + IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) { + if (typeof chunk != 'string') + return done(new Error("Iconv encoding stream needs strings as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } + } + + IconvLiteEncoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } + } + + IconvLiteEncoderStream.prototype.collect = function(cb) { + var chunks = []; + this.on('error', cb); + this.on('data', function(chunk) { chunks.push(chunk); }); + this.on('end', function() { + cb(null, Buffer.concat(chunks)); + }); + return this; + } + + + // == Decoder stream ======================================================= + + function IconvLiteDecoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.encoding = this.encoding = 'utf8'; // We output strings. + Transform.call(this, options); + } + + IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteDecoderStream } + }); + + IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) { + if (!Buffer.isBuffer(chunk) && !(chunk instanceof Uint8Array)) + return done(new Error("Iconv decoding stream needs buffers as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } + } + + IconvLiteDecoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } + } + + IconvLiteDecoderStream.prototype.collect = function(cb) { + var res = ''; + this.on('error', cb); + this.on('data', function(chunk) { res += chunk; }); + this.on('end', function() { + cb(null, res); + }); + return this; + } + + return { + IconvLiteEncoderStream: IconvLiteEncoderStream, + IconvLiteDecoderStream: IconvLiteDecoderStream, + }; +}; diff --git a/node_modules/npm/node_modules/iconv-lite/package.json b/node_modules/npm/node_modules/iconv-lite/package.json new file mode 100644 index 00000000..d351115a --- /dev/null +++ b/node_modules/npm/node_modules/iconv-lite/package.json @@ -0,0 +1,44 @@ +{ + "name": "iconv-lite", + "description": "Convert character encodings in pure javascript.", + "version": "0.6.3", + "license": "MIT", + "keywords": [ + "iconv", + "convert", + "charset", + "icu" + ], + "author": "Alexander Shtuchkin ", + "main": "./lib/index.js", + "typings": "./lib/index.d.ts", + "homepage": "https://github.com/ashtuchkin/iconv-lite", + "bugs": "https://github.com/ashtuchkin/iconv-lite/issues", + "repository": { + "type": "git", + "url": "git://github.com/ashtuchkin/iconv-lite.git" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "coverage": "c8 _mocha --grep .", + "test": "mocha --reporter spec --grep ." + }, + "browser": { + "stream": false + }, + "devDependencies": { + "async": "^3.2.0", + "c8": "^7.2.0", + "errto": "^0.2.1", + "iconv": "^2.3.5", + "mocha": "^3.5.3", + "request": "^2.88.2", + "semver": "^6.3.0", + "unorm": "^1.6.0" + }, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } +} diff --git a/node_modules/npm/node_modules/ignore-walk/LICENSE b/node_modules/npm/node_modules/ignore-walk/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/ignore-walk/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/ignore-walk/lib/index.js b/node_modules/npm/node_modules/ignore-walk/lib/index.js new file mode 100644 index 00000000..366d95e2 --- /dev/null +++ b/node_modules/npm/node_modules/ignore-walk/lib/index.js @@ -0,0 +1,310 @@ +'use strict' + +const fs = require('fs') +const path = require('path') +const EE = require('events').EventEmitter +const Minimatch = require('minimatch').Minimatch + +class Walker extends EE { + constructor (opts) { + opts = opts || {} + super(opts) + // set to true if this.path is a symlink, whether follow is true or not + this.isSymbolicLink = opts.isSymbolicLink + this.path = opts.path || process.cwd() + this.basename = path.basename(this.path) + this.ignoreFiles = opts.ignoreFiles || ['.ignore'] + this.ignoreRules = {} + this.parent = opts.parent || null + this.includeEmpty = !!opts.includeEmpty + this.root = this.parent ? this.parent.root : this.path + this.follow = !!opts.follow + this.result = this.parent ? this.parent.result : new Set() + this.entries = null + this.sawError = false + this.exact = opts.exact + } + + sort (a, b) { + return a.localeCompare(b, 'en') + } + + emit (ev, data) { + let ret = false + if (!(this.sawError && ev === 'error')) { + if (ev === 'error') { + this.sawError = true + } else if (ev === 'done' && !this.parent) { + data = Array.from(data) + .map(e => /^@/.test(e) ? `./${e}` : e).sort(this.sort) + this.result = data + } + + if (ev === 'error' && this.parent) { + ret = this.parent.emit('error', data) + } else { + ret = super.emit(ev, data) + } + } + return ret + } + + start () { + fs.readdir(this.path, (er, entries) => + er ? this.emit('error', er) : this.onReaddir(entries)) + return this + } + + isIgnoreFile (e) { + return e !== '.' && + e !== '..' && + this.ignoreFiles.indexOf(e) !== -1 + } + + onReaddir (entries) { + this.entries = entries + if (entries.length === 0) { + if (this.includeEmpty) { + this.result.add(this.path.slice(this.root.length + 1)) + } + this.emit('done', this.result) + } else { + const hasIg = this.entries.some(e => + this.isIgnoreFile(e)) + + if (hasIg) { + this.addIgnoreFiles() + } else { + this.filterEntries() + } + } + } + + addIgnoreFiles () { + const newIg = this.entries + .filter(e => this.isIgnoreFile(e)) + + let igCount = newIg.length + const then = () => { + if (--igCount === 0) { + this.filterEntries() + } + } + + newIg.forEach(e => this.addIgnoreFile(e, then)) + } + + addIgnoreFile (file, then) { + const ig = path.resolve(this.path, file) + fs.readFile(ig, 'utf8', (er, data) => + er ? this.emit('error', er) : this.onReadIgnoreFile(file, data, then)) + } + + onReadIgnoreFile (file, data, then) { + const mmopt = { + matchBase: true, + dot: true, + flipNegate: true, + nocase: true, + } + const rules = data.split(/\r?\n/) + .filter(line => !/^#|^$/.test(line.trim())) + .map(rule => { + return new Minimatch(rule.trim(), mmopt) + }) + + this.ignoreRules[file] = rules + + then() + } + + filterEntries () { + // at this point we either have ignore rules, or just inheriting + // this exclusion is at the point where we know the list of + // entries in the dir, but don't know what they are. since + // some of them *might* be directories, we have to run the + // match in dir-mode as well, so that we'll pick up partials + // of files that will be included later. Anything included + // at this point will be checked again later once we know + // what it is. + const filtered = this.entries.map(entry => { + // at this point, we don't know if it's a dir or not. + const passFile = this.filterEntry(entry) + const passDir = this.filterEntry(entry, true) + return (passFile || passDir) ? [entry, passFile, passDir] : false + }).filter(e => e) + + // now we stat them all + // if it's a dir, and passes as a dir, then recurse + // if it's not a dir, but passes as a file, add to set + let entryCount = filtered.length + if (entryCount === 0) { + this.emit('done', this.result) + } else { + const then = () => { + if (--entryCount === 0) { + this.emit('done', this.result) + } + } + filtered.forEach(filt => { + const entry = filt[0] + const file = filt[1] + const dir = filt[2] + this.stat({ entry, file, dir }, then) + }) + } + } + + onstat ({ st, entry, file, dir, isSymbolicLink }, then) { + const abs = this.path + '/' + entry + if (!st.isDirectory()) { + if (file) { + this.result.add(abs.slice(this.root.length + 1)) + } + then() + } else { + // is a directory + if (dir) { + this.walker(entry, { isSymbolicLink, exact: file || this.filterEntry(entry + '/') }, then) + } else { + then() + } + } + } + + stat ({ entry, file, dir }, then) { + const abs = this.path + '/' + entry + fs.lstat(abs, (lstatErr, lstatResult) => { + if (lstatErr) { + this.emit('error', lstatErr) + } else { + const isSymbolicLink = lstatResult.isSymbolicLink() + if (this.follow && isSymbolicLink) { + fs.stat(abs, (statErr, statResult) => { + if (statErr) { + this.emit('error', statErr) + } else { + this.onstat({ st: statResult, entry, file, dir, isSymbolicLink }, then) + } + }) + } else { + this.onstat({ st: lstatResult, entry, file, dir, isSymbolicLink }, then) + } + } + }) + } + + walkerOpt (entry, opts) { + return { + path: this.path + '/' + entry, + parent: this, + ignoreFiles: this.ignoreFiles, + follow: this.follow, + includeEmpty: this.includeEmpty, + ...opts, + } + } + + walker (entry, opts, then) { + new Walker(this.walkerOpt(entry, opts)).on('done', then).start() + } + + filterEntry (entry, partial, entryBasename) { + let included = true + + // this = /a/b/c + // entry = d + // parent /a/b sees c/d + if (this.parent && this.parent.filterEntry) { + const parentEntry = this.basename + '/' + entry + const parentBasename = entryBasename || entry + included = this.parent.filterEntry(parentEntry, partial, parentBasename) + if (!included && !this.exact) { + return false + } + } + + this.ignoreFiles.forEach(f => { + if (this.ignoreRules[f]) { + this.ignoreRules[f].forEach(rule => { + // negation means inclusion + // so if it's negated, and already included, no need to check + // likewise if it's neither negated nor included + if (rule.negate !== included) { + const isRelativeRule = entryBasename && rule.globParts.some(part => + part.length <= (part.slice(-1)[0] ? 1 : 2) + ) + + // first, match against /foo/bar + // then, against foo/bar + // then, in the case of partials, match with a / + // then, if also the rule is relative, match against basename + const match = rule.match('/' + entry) || + rule.match(entry) || + !!partial && ( + rule.match('/' + entry + '/') || + rule.match(entry + '/') || + rule.negate && ( + rule.match('/' + entry, true) || + rule.match(entry, true)) || + isRelativeRule && ( + rule.match('/' + entryBasename + '/') || + rule.match(entryBasename + '/') || + rule.negate && ( + rule.match('/' + entryBasename, true) || + rule.match(entryBasename, true)))) + + if (match) { + included = rule.negate + } + } + }) + } + }) + + return included + } +} + +class WalkerSync extends Walker { + start () { + this.onReaddir(fs.readdirSync(this.path)) + return this + } + + addIgnoreFile (file, then) { + const ig = path.resolve(this.path, file) + this.onReadIgnoreFile(file, fs.readFileSync(ig, 'utf8'), then) + } + + stat ({ entry, file, dir }, then) { + const abs = this.path + '/' + entry + let st = fs.lstatSync(abs) + const isSymbolicLink = st.isSymbolicLink() + if (this.follow && isSymbolicLink) { + st = fs.statSync(abs) + } + + // console.error('STAT SYNC', {st, entry, file, dir, isSymbolicLink, then}) + this.onstat({ st, entry, file, dir, isSymbolicLink }, then) + } + + walker (entry, opts, then) { + new WalkerSync(this.walkerOpt(entry, opts)).start() + then() + } +} + +const walk = (opts, callback) => { + const p = new Promise((resolve, reject) => { + new Walker(opts).on('done', resolve).on('error', reject).start() + }) + return callback ? p.then(res => callback(null, res), callback) : p +} + +const walkSync = opts => new WalkerSync(opts).start().result + +module.exports = walk +walk.sync = walkSync +walk.Walker = Walker +walk.WalkerSync = WalkerSync diff --git a/node_modules/npm/node_modules/ignore-walk/package.json b/node_modules/npm/node_modules/ignore-walk/package.json new file mode 100644 index 00000000..125fc071 --- /dev/null +++ b/node_modules/npm/node_modules/ignore-walk/package.json @@ -0,0 +1,64 @@ +{ + "name": "ignore-walk", + "version": "7.0.0", + "description": "Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.", + "main": "lib/index.js", + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "mutate-fs": "^2.1.1", + "tap": "^16.0.1" + }, + "scripts": { + "test": "tap", + "posttest": "npm run lint", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "test:windows-coverage": "npm pkg set tap.statements=99 --json && npm pkg set tap.branches=98 --json && npm pkg set tap.lines=99 --json", + "snap": "tap", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "keywords": [ + "ignorefile", + "ignore", + "file", + ".gitignore", + ".npmignore", + "glob" + ], + "author": "GitHub Inc.", + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/ignore-walk.git" + }, + "files": [ + "bin/", + "lib/" + ], + "dependencies": { + "minimatch": "^9.0.0" + }, + "tap": { + "test-env": "LC_ALL=sk", + "before": "test/00-setup.js", + "after": "test/zz-cleanup.js", + "timeout": 600, + "jobs": 1, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "content": "scripts/template-oss", + "publish": "true" + } +} diff --git a/node_modules/npm/node_modules/imurmurhash/imurmurhash.js b/node_modules/npm/node_modules/imurmurhash/imurmurhash.js new file mode 100644 index 00000000..e63146a2 --- /dev/null +++ b/node_modules/npm/node_modules/imurmurhash/imurmurhash.js @@ -0,0 +1,138 @@ +/** + * @preserve + * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) + * + * @author Jens Taylor + * @see http://github.com/homebrewing/brauhaus-diff + * @author Gary Court + * @see http://github.com/garycourt/murmurhash-js + * @author Austin Appleby + * @see http://sites.google.com/site/murmurhash/ + */ +(function(){ + var cache; + + // Call this function without `new` to use the cached object (good for + // single-threaded environments), or with `new` to create a new object. + // + // @param {string} key A UTF-16 or ASCII string + // @param {number} seed An optional positive integer + // @return {object} A MurmurHash3 object for incremental hashing + function MurmurHash3(key, seed) { + var m = this instanceof MurmurHash3 ? this : cache; + m.reset(seed) + if (typeof key === 'string' && key.length > 0) { + m.hash(key); + } + + if (m !== this) { + return m; + } + }; + + // Incrementally add a string to this hash + // + // @param {string} key A UTF-16 or ASCII string + // @return {object} this + MurmurHash3.prototype.hash = function(key) { + var h1, k1, i, top, len; + + len = key.length; + this.len += len; + + k1 = this.k1; + i = 0; + switch (this.rem) { + case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0; + case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0; + case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0; + case 3: + k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0; + k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0; + } + + this.rem = (len + this.rem) & 3; // & 3 is same as % 4 + len -= this.rem; + if (len > 0) { + h1 = this.h1; + while (1) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + + h1 ^= k1; + h1 = (h1 << 13) | (h1 >>> 19); + h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff; + + if (i >= len) { + break; + } + + k1 = ((key.charCodeAt(i++) & 0xffff)) ^ + ((key.charCodeAt(i++) & 0xffff) << 8) ^ + ((key.charCodeAt(i++) & 0xffff) << 16); + top = key.charCodeAt(i++); + k1 ^= ((top & 0xff) << 24) ^ + ((top & 0xff00) >> 8); + } + + k1 = 0; + switch (this.rem) { + case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16; + case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8; + case 1: k1 ^= (key.charCodeAt(i) & 0xffff); + } + + this.h1 = h1; + } + + this.k1 = k1; + return this; + }; + + // Get the result of this hash + // + // @return {number} The 32-bit hash + MurmurHash3.prototype.result = function() { + var k1, h1; + + k1 = this.k1; + h1 = this.h1; + + if (k1 > 0) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + h1 ^= k1; + } + + h1 ^= this.len; + + h1 ^= h1 >>> 16; + h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff; + h1 ^= h1 >>> 13; + h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff; + h1 ^= h1 >>> 16; + + return h1 >>> 0; + }; + + // Reset the hash object for reuse + // + // @param {number} seed An optional positive integer + MurmurHash3.prototype.reset = function(seed) { + this.h1 = typeof seed === 'number' ? seed : 0; + this.rem = this.k1 = this.len = 0; + return this; + }; + + // A cached object to use. This can be safely used if you're in a single- + // threaded environment, otherwise you need to create new hashes to use. + cache = new MurmurHash3(); + + if (typeof(module) != 'undefined') { + module.exports = MurmurHash3; + } else { + this.MurmurHash3 = MurmurHash3; + } +}()); diff --git a/node_modules/npm/node_modules/imurmurhash/imurmurhash.min.js b/node_modules/npm/node_modules/imurmurhash/imurmurhash.min.js new file mode 100644 index 00000000..dc0ee88d --- /dev/null +++ b/node_modules/npm/node_modules/imurmurhash/imurmurhash.min.js @@ -0,0 +1,12 @@ +/** + * @preserve + * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) + * + * @author Jens Taylor + * @see http://github.com/homebrewing/brauhaus-diff + * @author Gary Court + * @see http://github.com/garycourt/murmurhash-js + * @author Austin Appleby + * @see http://sites.google.com/site/murmurhash/ + */ +!function(){function t(h,r){var s=this instanceof t?this:e;return s.reset(r),"string"==typeof h&&h.length>0&&s.hash(h),s!==this?s:void 0}var e;t.prototype.hash=function(t){var e,h,r,s,i;switch(i=t.length,this.len+=i,h=this.k1,r=0,this.rem){case 0:h^=i>r?65535&t.charCodeAt(r++):0;case 1:h^=i>r?(65535&t.charCodeAt(r++))<<8:0;case 2:h^=i>r?(65535&t.charCodeAt(r++))<<16:0;case 3:h^=i>r?(255&t.charCodeAt(r))<<24:0,h^=i>r?(65280&t.charCodeAt(r++))>>8:0}if(this.rem=3&i+this.rem,i-=this.rem,i>0){for(e=this.h1;;){if(h=4294967295&11601*h+3432906752*(65535&h),h=h<<15|h>>>17,h=4294967295&13715*h+461832192*(65535&h),e^=h,e=e<<13|e>>>19,e=4294967295&5*e+3864292196,r>=i)break;h=65535&t.charCodeAt(r++)^(65535&t.charCodeAt(r++))<<8^(65535&t.charCodeAt(r++))<<16,s=t.charCodeAt(r++),h^=(255&s)<<24^(65280&s)>>8}switch(h=0,this.rem){case 3:h^=(65535&t.charCodeAt(r+2))<<16;case 2:h^=(65535&t.charCodeAt(r+1))<<8;case 1:h^=65535&t.charCodeAt(r)}this.h1=e}return this.k1=h,this},t.prototype.result=function(){var t,e;return t=this.k1,e=this.h1,t>0&&(t=4294967295&11601*t+3432906752*(65535&t),t=t<<15|t>>>17,t=4294967295&13715*t+461832192*(65535&t),e^=t),e^=this.len,e^=e>>>16,e=4294967295&51819*e+2246770688*(65535&e),e^=e>>>13,e=4294967295&44597*e+3266445312*(65535&e),e^=e>>>16,e>>>0},t.prototype.reset=function(t){return this.h1="number"==typeof t?t:0,this.rem=this.k1=this.len=0,this},e=new t,"undefined"!=typeof module?module.exports=t:this.MurmurHash3=t}(); \ No newline at end of file diff --git a/node_modules/npm/node_modules/imurmurhash/package.json b/node_modules/npm/node_modules/imurmurhash/package.json new file mode 100644 index 00000000..8a93edb5 --- /dev/null +++ b/node_modules/npm/node_modules/imurmurhash/package.json @@ -0,0 +1,40 @@ +{ + "name": "imurmurhash", + "version": "0.1.4", + "description": "An incremental implementation of MurmurHash3", + "homepage": "https://github.com/jensyt/imurmurhash-js", + "main": "imurmurhash.js", + "files": [ + "imurmurhash.js", + "imurmurhash.min.js", + "package.json", + "README.md" + ], + "repository": { + "type": "git", + "url": "https://github.com/jensyt/imurmurhash-js" + }, + "bugs": { + "url": "https://github.com/jensyt/imurmurhash-js/issues" + }, + "keywords": [ + "murmur", + "murmurhash", + "murmurhash3", + "hash", + "incremental" + ], + "author": { + "name": "Jens Taylor", + "email": "jensyt@gmail.com", + "url": "https://github.com/homebrewing" + }, + "license": "MIT", + "dependencies": { + }, + "devDependencies": { + }, + "engines": { + "node": ">=0.8.19" + } +} diff --git a/node_modules/npm/node_modules/ini/LICENSE b/node_modules/npm/node_modules/ini/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/ini/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/ini/lib/ini.js b/node_modules/npm/node_modules/ini/lib/ini.js new file mode 100644 index 00000000..beb390d0 --- /dev/null +++ b/node_modules/npm/node_modules/ini/lib/ini.js @@ -0,0 +1,280 @@ +const { hasOwnProperty } = Object.prototype + +const encode = (obj, opt = {}) => { + if (typeof opt === 'string') { + opt = { section: opt } + } + opt.align = opt.align === true + opt.newline = opt.newline === true + opt.sort = opt.sort === true + opt.whitespace = opt.whitespace === true || opt.align === true + // The `typeof` check is required because accessing the `process` directly fails on browsers. + /* istanbul ignore next */ + opt.platform = opt.platform || (typeof process !== 'undefined' && process.platform) + opt.bracketedArray = opt.bracketedArray !== false + + /* istanbul ignore next */ + const eol = opt.platform === 'win32' ? '\r\n' : '\n' + const separator = opt.whitespace ? ' = ' : '=' + const children = [] + + const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj) + + let padToChars = 0 + // If aligning on the separator, then padToChars is determined as follows: + // 1. Get the keys + // 2. Exclude keys pointing to objects unless the value is null or an array + // 3. Add `[]` to array keys + // 4. Ensure non empty set of keys + // 5. Reduce the set to the longest `safe` key + // 6. Get the `safe` length + if (opt.align) { + padToChars = safe( + ( + keys + .filter(k => obj[k] === null || Array.isArray(obj[k]) || typeof obj[k] !== 'object') + .map(k => Array.isArray(obj[k]) ? `${k}[]` : k) + ) + .concat(['']) + .reduce((a, b) => safe(a).length >= safe(b).length ? a : b) + ).length + } + + let out = '' + const arraySuffix = opt.bracketedArray ? '[]' : '' + + for (const k of keys) { + const val = obj[k] + if (val && Array.isArray(val)) { + for (const item of val) { + out += safe(`${k}${arraySuffix}`).padEnd(padToChars, ' ') + separator + safe(item) + eol + } + } else if (val && typeof val === 'object') { + children.push(k) + } else { + out += safe(k).padEnd(padToChars, ' ') + separator + safe(val) + eol + } + } + + if (opt.section && out.length) { + out = '[' + safe(opt.section) + ']' + (opt.newline ? eol + eol : eol) + out + } + + for (const k of children) { + const nk = splitSections(k, '.').join('\\.') + const section = (opt.section ? opt.section + '.' : '') + nk + const child = encode(obj[k], { + ...opt, + section, + }) + if (out.length && child.length) { + out += eol + } + + out += child + } + + return out +} + +function splitSections (str, separator) { + var lastMatchIndex = 0 + var lastSeparatorIndex = 0 + var nextIndex = 0 + var sections = [] + + do { + nextIndex = str.indexOf(separator, lastMatchIndex) + + if (nextIndex !== -1) { + lastMatchIndex = nextIndex + separator.length + + if (nextIndex > 0 && str[nextIndex - 1] === '\\') { + continue + } + + sections.push(str.slice(lastSeparatorIndex, nextIndex)) + lastSeparatorIndex = nextIndex + separator.length + } + } while (nextIndex !== -1) + + sections.push(str.slice(lastSeparatorIndex)) + + return sections +} + +const decode = (str, opt = {}) => { + opt.bracketedArray = opt.bracketedArray !== false + const out = Object.create(null) + let p = out + let section = null + // section |key = value + const re = /^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i + const lines = str.split(/[\r\n]+/g) + const duplicates = {} + + for (const line of lines) { + if (!line || line.match(/^\s*[;#]/) || line.match(/^\s*$/)) { + continue + } + const match = line.match(re) + if (!match) { + continue + } + if (match[1] !== undefined) { + section = unsafe(match[1]) + if (section === '__proto__') { + // not allowed + // keep parsing the section, but don't attach it. + p = Object.create(null) + continue + } + p = out[section] = out[section] || Object.create(null) + continue + } + const keyRaw = unsafe(match[2]) + let isArray + if (opt.bracketedArray) { + isArray = keyRaw.length > 2 && keyRaw.slice(-2) === '[]' + } else { + duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1 + isArray = duplicates[keyRaw] > 1 + } + const key = isArray && keyRaw.endsWith('[]') + ? keyRaw.slice(0, -2) : keyRaw + + if (key === '__proto__') { + continue + } + const valueRaw = match[3] ? unsafe(match[4]) : true + const value = valueRaw === 'true' || + valueRaw === 'false' || + valueRaw === 'null' ? JSON.parse(valueRaw) + : valueRaw + + // Convert keys with '[]' suffix to an array + if (isArray) { + if (!hasOwnProperty.call(p, key)) { + p[key] = [] + } else if (!Array.isArray(p[key])) { + p[key] = [p[key]] + } + } + + // safeguard against resetting a previously defined + // array by accidentally forgetting the brackets + if (Array.isArray(p[key])) { + p[key].push(value) + } else { + p[key] = value + } + } + + // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}} + // use a filter to return the keys that have to be deleted. + const remove = [] + for (const k of Object.keys(out)) { + if (!hasOwnProperty.call(out, k) || + typeof out[k] !== 'object' || + Array.isArray(out[k])) { + continue + } + + // see if the parent section is also an object. + // if so, add it to that, and mark this one for deletion + const parts = splitSections(k, '.') + p = out + const l = parts.pop() + const nl = l.replace(/\\\./g, '.') + for (const part of parts) { + if (part === '__proto__') { + continue + } + if (!hasOwnProperty.call(p, part) || typeof p[part] !== 'object') { + p[part] = Object.create(null) + } + p = p[part] + } + if (p === out && nl === l) { + continue + } + + p[nl] = out[k] + remove.push(k) + } + for (const del of remove) { + delete out[del] + } + + return out +} + +const isQuoted = val => { + return (val.startsWith('"') && val.endsWith('"')) || + (val.startsWith("'") && val.endsWith("'")) +} + +const safe = val => { + if ( + typeof val !== 'string' || + val.match(/[=\r\n]/) || + val.match(/^\[/) || + (val.length > 1 && isQuoted(val)) || + val !== val.trim() + ) { + return JSON.stringify(val) + } + return val.split(';').join('\\;').split('#').join('\\#') +} + +const unsafe = val => { + val = (val || '').trim() + if (isQuoted(val)) { + // remove the single quotes before calling JSON.parse + if (val.charAt(0) === "'") { + val = val.slice(1, -1) + } + try { + val = JSON.parse(val) + } catch { + // ignore errors + } + } else { + // walk the val to find the first not-escaped ; character + let esc = false + let unesc = '' + for (let i = 0, l = val.length; i < l; i++) { + const c = val.charAt(i) + if (esc) { + if ('\\;#'.indexOf(c) !== -1) { + unesc += c + } else { + unesc += '\\' + c + } + + esc = false + } else if (';#'.indexOf(c) !== -1) { + break + } else if (c === '\\') { + esc = true + } else { + unesc += c + } + } + if (esc) { + unesc += '\\' + } + + return unesc.trim() + } + return val +} + +module.exports = { + parse: decode, + decode, + stringify: encode, + encode, + safe, + unsafe, +} diff --git a/node_modules/npm/node_modules/ini/package.json b/node_modules/npm/node_modules/ini/package.json new file mode 100644 index 00000000..6a3995f1 --- /dev/null +++ b/node_modules/npm/node_modules/ini/package.json @@ -0,0 +1,45 @@ +{ + "author": "GitHub Inc.", + "name": "ini", + "description": "An ini encoder/decoder for node", + "version": "5.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/ini.git" + }, + "main": "lib/ini.js", + "scripts": { + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "test": "tap", + "snap": "tap", + "posttest": "npm run lint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.0.1" + }, + "license": "ISC", + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": "true" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/init-package-json/LICENSE.md b/node_modules/npm/node_modules/init-package-json/LICENSE.md new file mode 100644 index 00000000..845be76f --- /dev/null +++ b/node_modules/npm/node_modules/init-package-json/LICENSE.md @@ -0,0 +1,18 @@ +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/npm/node_modules/init-package-json/lib/default-input.js b/node_modules/npm/node_modules/init-package-json/lib/default-input.js new file mode 100644 index 00000000..3b38c776 --- /dev/null +++ b/node_modules/npm/node_modules/init-package-json/lib/default-input.js @@ -0,0 +1,268 @@ +/* globals config, dirname, package, basename, yes, prompt */ + +const fs = require('fs/promises') +const path = require('path') +const validateLicense = require('validate-npm-package-license') +const validateName = require('validate-npm-package-name') +const npa = require('npm-package-arg') +const semver = require('semver') + +// more popular packages should go here, maybe? +const isTestPkg = (p) => !!p.match(/^(expresso|mocha|tap|coffee-script|coco|streamline)$/) + +const invalid = (msg) => Object.assign(new Error(msg), { notValid: true }) + +const readDeps = (test, excluded) => async () => { + const dirs = await fs.readdir('node_modules').catch(() => null) + + if (!dirs) { + return + } + + const deps = {} + for (const dir of dirs) { + if (dir.match(/^\./) || test !== isTestPkg(dir) || excluded[dir]) { + continue + } + + const dp = path.join(dirname, 'node_modules', dir, 'package.json') + const p = await fs.readFile(dp, 'utf8').then((d) => JSON.parse(d)).catch(() => null) + + if (!p || !p.version || p?._requiredBy?.some((r) => r === '#USER')) { + continue + } + + deps[dir] = config.get('save-exact') ? p.version : config.get('save-prefix') + p.version + } + + return deps +} + +const getConfig = (key) => { + // dots take precedence over dashes + const def = config?.defaults?.[`init.${key}`] + const val = config.get(`init.${key}`) + return (val !== def && val) ? val : config.get(`init-${key.replace(/\./g, '-')}`) +} + +const getName = () => { + const rawName = package.name || basename + let name = rawName + .replace(/^node-|[.-]js$/g, '') + .replace(/\s+/g, ' ') + .replace(/ /g, '-') + .toLowerCase() + + let spec + try { + spec = npa(name) + } catch { + spec = {} + } + + let scope = config.get('scope') + + if (scope) { + if (scope.charAt(0) !== '@') { + scope = '@' + scope + } + if (spec.scope) { + name = scope + '/' + spec.name.split('/')[1] + } else { + name = scope + '/' + name + } + } + + return name +} + +const name = getName() +exports.name = yes ? name : prompt('package name', name, (data) => { + const its = validateName(data) + if (its.validForNewPackages) { + return data + } + const errors = (its.errors || []).concat(its.warnings || []) + return invalid(`Sorry, ${errors.join(' and ')}.`) +}) + +const version = package.version || getConfig('version') || '1.0.0' +exports.version = yes ? version : prompt('version', version, (v) => { + if (semver.valid(v)) { + return v + } + return invalid(`Invalid version: "${v}"`) +}) + +if (!package.description) { + exports.description = yes ? '' : prompt('description') +} + +if (!package.main) { + exports.main = async () => { + const files = await fs.readdir(dirname) + .then(list => list.filter((f) => f.match(/\.js$/))) + .catch(() => []) + + let index + if (files.includes('index.js')) { + index = 'index.js' + } else if (files.includes('main.js')) { + index = 'main.js' + } else if (files.includes(basename + '.js')) { + index = basename + '.js' + } else { + index = files[0] || 'index.js' + } + + return yes ? index : prompt('entry point', index) + } +} + +if (!package.bin) { + exports.bin = async () => { + try { + const d = await fs.readdir(path.resolve(dirname, 'bin')) + // just take the first js file we find there, or nada + let r = d.find(f => f.match(/\.js$/)) + if (r) { + r = `bin/${r}` + } + return r + } catch { + // no bins + } + } +} + +exports.directories = async () => { + const dirs = await fs.readdir(dirname) + + const res = dirs.reduce((acc, d) => { + if (/^examples?$/.test(d)) { + acc.example = d + } else if (/^tests?$/.test(d)) { + acc.test = d + } else if (/^docs?$/.test(d)) { + acc.doc = d + } else if (d === 'man') { + acc.man = d + } else if (d === 'lib') { + acc.lib = d + } + + return acc + }, {}) + + return Object.keys(res).length === 0 ? undefined : res +} + +if (!package.dependencies) { + exports.dependencies = readDeps(false, package.devDependencies || {}) +} + +if (!package.devDependencies) { + exports.devDependencies = readDeps(true, package.dependencies || {}) +} + +// MUST have a test script! +if (!package.scripts) { + const scripts = package.scripts || {} + const notest = 'echo "Error: no test specified" && exit 1' + exports.scripts = async () => { + const d = await fs.readdir(path.join(dirname, 'node_modules')).catch(() => []) + + // check to see what framework is in use, if any + let command + if (!scripts.test || scripts.test === notest) { + const commands = { + tap: 'tap test/*.js', + expresso: 'expresso test', + mocha: 'mocha', + } + for (const [k, v] of Object.entries(commands)) { + if (d.includes(k)) { + command = v + } + } + } + + const promptArgs = ['test command', (t) => t || notest] + if (command) { + promptArgs.splice(1, 0, command) + } + scripts.test = yes ? command || notest : prompt(...promptArgs) + + return scripts + } +} + +if (!package.repository) { + exports.repository = async () => { + const gitConfigPath = path.resolve(dirname, '.git', 'config') + const gconf = await fs.readFile(gitConfigPath, 'utf8').catch(() => '') + const lines = gconf.split(/\r?\n/) + + let url + const i = lines.indexOf('[remote "origin"]') + + if (i !== -1) { + url = lines[i + 1] + if (!url.match(/^\s*url =/)) { + url = lines[i + 2] + } + if (!url.match(/^\s*url =/)) { + url = null + } else { + url = url.replace(/^\s*url = /, '') + } + } + + if (url && url.match(/^git@github.com:/)) { + url = url.replace(/^git@github.com:/, 'https://github.com/') + } + + return yes ? url || '' : prompt('git repository', url || undefined) + } +} + +if (!package.keywords) { + exports.keywords = yes ? '' : prompt('keywords', (data) => { + if (!data) { + return + } + if (Array.isArray(data)) { + data = data.join(' ') + } + if (typeof data !== 'string') { + return data + } + return data.split(/[\s,]+/) + }) +} + +if (!package.author) { + const authorName = getConfig('author.name') + exports.author = authorName + ? { + name: authorName, + email: getConfig('author.email'), + url: getConfig('author.url'), + } + : yes ? '' : prompt('author') +} + +const license = package.license || getConfig('license') || 'ISC' +exports.license = yes ? license : prompt('license', license, (data) => { + const its = validateLicense(data) + if (its.validForNewPackages) { + return data + } + const errors = (its.errors || []).concat(its.warnings || []) + return invalid(`Sorry, ${errors.join(' and ')}.`) +}) + +const type = package.type || getConfig('type') || 'commonjs' +exports.type = yes ? type : prompt('type', type, (data) => { + return data +}) diff --git a/node_modules/npm/node_modules/init-package-json/lib/init-package-json.js b/node_modules/npm/node_modules/init-package-json/lib/init-package-json.js new file mode 100644 index 00000000..b67ae418 --- /dev/null +++ b/node_modules/npm/node_modules/init-package-json/lib/init-package-json.js @@ -0,0 +1,147 @@ + +const promzard = require('promzard') +const path = require('path') +const semver = require('semver') +const { read } = require('read') +const util = require('util') +const PackageJson = require('@npmcli/package-json') + +const def = require.resolve('./default-input.js') + +const extras = [ + 'bundleDependencies', + 'gypfile', + 'serverjs', + 'scriptpath', + 'readme', + 'bin', + 'githead', + 'fillTypes', + 'normalizeData', +] + +const isYes = (c) => !!(c.get('yes') || c.get('y') || c.get('force') || c.get('f')) + +const getConfig = (c) => { + // accept either a plain-jane object, or a config object with a "get" method. + if (typeof c.get !== 'function') { + const data = c + return { + get: (k) => data[k], + toJSON: () => data, + } + } + return c +} + +// Coverage disabled because this is just walking back the fixPeople +// normalization from the normalizeData step and we don't need to re-test all +// of those paths. +/* istanbul ignore next */ +const stringifyPerson = (p) => { + const { name, url, web, email, mail } = p + const u = url || web + const e = email || mail + return `${name}${e ? ` <${e}>` : ''}${u ? ` (${u})` : ''}` +} +async function init (dir, + // TODO test for non-default definitions + /* istanbul ignore next */ + input = def, + c = {}) { + const config = getConfig(c) + const yes = isYes(config) + const packageFile = path.resolve(dir, 'package.json') + + // read what's already there to inform our prompts + const pkg = await PackageJson.load(dir, { create: true }) + await pkg.normalize() + + if (!semver.valid(pkg.content.version)) { + delete pkg.content.version + } + + // make sure that the input is valid. if not, use the default + const pzData = await promzard(path.resolve(input), { + yes, + config, + filename: packageFile, + dirname: dir, + basename: path.basename(dir), + package: pkg.content, + }, { backupFile: def }) + + for (const [k, v] of Object.entries(pzData)) { + if (v != null) { + pkg.content[k] = v + } + } + + await pkg.normalize({ steps: extras }) + + // turn the objects back into somewhat more humane strings. + // "normalizeData" does this and there isn't a way to choose which of those steps happen + if (pkg.content.author) { + pkg.content.author = stringifyPerson(pkg.content.author) + } + + // no need for the readme now. + delete pkg.content.readme + delete pkg.content.readmeFilename + + // really don't want to have this lying around in the file + delete pkg.content._id + + // ditto + delete pkg.content.gitHead + + // if the repo is empty, remove it. + if (!pkg.content.repository) { + delete pkg.content.repository + } + + // readJson filters out empty descriptions, but init-package-json + // traditionally leaves them alone + if (!pkg.content.description) { + pkg.content.description = pzData.description + } + + // optionalDependencies don't need to be repeated in two places + if (pkg.content.dependencies) { + if (pkg.content.optionalDependencies) { + for (const name of Object.keys(pkg.content.optionalDependencies)) { + delete pkg.content.dependencies[name] + } + } + if (Object.keys(pkg.content.dependencies).length === 0) { + delete pkg.content.dependencies + } + } + + const stringified = JSON.stringify(pkg.content, null, 2) + '\n' + const msg = util.format('%s:\n\n%s\n', packageFile, stringified) + + if (yes) { + await pkg.save() + if (!config.get('silent')) { + // eslint-disable-next-line no-console + console.log(`Wrote to ${msg}`) + } + return pkg.content + } + + // eslint-disable-next-line no-console + console.log(`About to write to ${msg}`) + const ok = await read({ prompt: 'Is this OK? ', default: 'yes' }) + if (!ok || !ok.toLowerCase().startsWith('y')) { + // eslint-disable-next-line no-console + console.log('Aborted.') + return + } + + await pkg.save({ sort: true }) + return pkg.content +} + +module.exports = init +module.exports.yes = isYes diff --git a/node_modules/npm/node_modules/init-package-json/package.json b/node_modules/npm/node_modules/init-package-json/package.json new file mode 100644 index 00000000..c264eb44 --- /dev/null +++ b/node_modules/npm/node_modules/init-package-json/package.json @@ -0,0 +1,67 @@ +{ + "name": "init-package-json", + "version": "8.0.0", + "main": "lib/init-package-json.js", + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/init-package-json.git" + }, + "author": "GitHub Inc.", + "license": "ISC", + "description": "A node module to get your node module started", + "dependencies": { + "@npmcli/package-json": "^6.1.0", + "npm-package-arg": "^12.0.0", + "promzard": "^2.0.0", + "read": "^4.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4", + "validate-npm-package-name": "^6.0.0" + }, + "devDependencies": { + "@npmcli/config": "^9.0.0", + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.4", + "tap": "^16.0.1" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "tap": { + "test-ignore": "fixtures/", + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ], + "timeout": 300 + }, + "keywords": [ + "init", + "package.json", + "package", + "helper", + "wizard", + "wizerd", + "prompt", + "start" + ], + "files": [ + "bin/", + "lib/" + ], + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.4", + "publish": true + } +} diff --git a/node_modules/npm/node_modules/ip-address/LICENSE b/node_modules/npm/node_modules/ip-address/LICENSE new file mode 100644 index 00000000..ec79adb0 --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/LICENSE @@ -0,0 +1,19 @@ +Copyright (C) 2011 by Beau Gunderson + +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/npm/node_modules/ip-address/dist/address-error.js b/node_modules/npm/node_modules/ip-address/dist/address-error.js new file mode 100644 index 00000000..4fcade3b --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/dist/address-error.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AddressError = void 0; +class AddressError extends Error { + constructor(message, parseMessage) { + super(message); + this.name = 'AddressError'; + if (parseMessage !== null) { + this.parseMessage = parseMessage; + } + } +} +exports.AddressError = AddressError; +//# sourceMappingURL=address-error.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/ip-address/dist/common.js b/node_modules/npm/node_modules/ip-address/dist/common.js new file mode 100644 index 00000000..4d10c9a4 --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/dist/common.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isCorrect = exports.isInSubnet = void 0; +function isInSubnet(address) { + if (this.subnetMask < address.subnetMask) { + return false; + } + if (this.mask(address.subnetMask) === address.mask()) { + return true; + } + return false; +} +exports.isInSubnet = isInSubnet; +function isCorrect(defaultBits) { + return function () { + if (this.addressMinusSuffix !== this.correctForm()) { + return false; + } + if (this.subnetMask === defaultBits && !this.parsedSubnet) { + return true; + } + return this.parsedSubnet === String(this.subnetMask); + }; +} +exports.isCorrect = isCorrect; +//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/ip-address/dist/ip-address.js b/node_modules/npm/node_modules/ip-address/dist/ip-address.js new file mode 100644 index 00000000..553c005a --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/dist/ip-address.js @@ -0,0 +1,35 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.v6 = exports.AddressError = exports.Address6 = exports.Address4 = void 0; +const ipv4_1 = require("./ipv4"); +Object.defineProperty(exports, "Address4", { enumerable: true, get: function () { return ipv4_1.Address4; } }); +const ipv6_1 = require("./ipv6"); +Object.defineProperty(exports, "Address6", { enumerable: true, get: function () { return ipv6_1.Address6; } }); +const address_error_1 = require("./address-error"); +Object.defineProperty(exports, "AddressError", { enumerable: true, get: function () { return address_error_1.AddressError; } }); +const helpers = __importStar(require("./v6/helpers")); +exports.v6 = { helpers }; +//# sourceMappingURL=ip-address.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/ip-address/dist/ipv4.js b/node_modules/npm/node_modules/ip-address/dist/ipv4.js new file mode 100644 index 00000000..22a81b50 --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/dist/ipv4.js @@ -0,0 +1,326 @@ +"use strict"; +/* eslint-disable no-param-reassign */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Address4 = void 0; +const common = __importStar(require("./common")); +const constants = __importStar(require("./v4/constants")); +const address_error_1 = require("./address-error"); +const jsbn_1 = require("jsbn"); +const sprintf_js_1 = require("sprintf-js"); +/** + * Represents an IPv4 address + * @class Address4 + * @param {string} address - An IPv4 address string + */ +class Address4 { + constructor(address) { + this.groups = constants.GROUPS; + this.parsedAddress = []; + this.parsedSubnet = ''; + this.subnet = '/32'; + this.subnetMask = 32; + this.v4 = true; + /** + * Returns true if the address is correct, false otherwise + * @memberof Address4 + * @instance + * @returns {Boolean} + */ + this.isCorrect = common.isCorrect(constants.BITS); + /** + * Returns true if the given address is in the subnet of the current address + * @memberof Address4 + * @instance + * @returns {boolean} + */ + this.isInSubnet = common.isInSubnet; + this.address = address; + const subnet = constants.RE_SUBNET_STRING.exec(address); + if (subnet) { + this.parsedSubnet = subnet[0].replace('/', ''); + this.subnetMask = parseInt(this.parsedSubnet, 10); + this.subnet = `/${this.subnetMask}`; + if (this.subnetMask < 0 || this.subnetMask > constants.BITS) { + throw new address_error_1.AddressError('Invalid subnet mask.'); + } + address = address.replace(constants.RE_SUBNET_STRING, ''); + } + this.addressMinusSuffix = address; + this.parsedAddress = this.parse(address); + } + static isValid(address) { + try { + // eslint-disable-next-line no-new + new Address4(address); + return true; + } + catch (e) { + return false; + } + } + /* + * Parses a v4 address + */ + parse(address) { + const groups = address.split('.'); + if (!address.match(constants.RE_ADDRESS)) { + throw new address_error_1.AddressError('Invalid IPv4 address.'); + } + return groups; + } + /** + * Returns the correct form of an address + * @memberof Address4 + * @instance + * @returns {String} + */ + correctForm() { + return this.parsedAddress.map((part) => parseInt(part, 10)).join('.'); + } + /** + * Converts a hex string to an IPv4 address object + * @memberof Address4 + * @static + * @param {string} hex - a hex string to convert + * @returns {Address4} + */ + static fromHex(hex) { + const padded = hex.replace(/:/g, '').padStart(8, '0'); + const groups = []; + let i; + for (i = 0; i < 8; i += 2) { + const h = padded.slice(i, i + 2); + groups.push(parseInt(h, 16)); + } + return new Address4(groups.join('.')); + } + /** + * Converts an integer into a IPv4 address object + * @memberof Address4 + * @static + * @param {integer} integer - a number to convert + * @returns {Address4} + */ + static fromInteger(integer) { + return Address4.fromHex(integer.toString(16)); + } + /** + * Return an address from in-addr.arpa form + * @memberof Address4 + * @static + * @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address + * @returns {Adress4} + * @example + * var address = Address4.fromArpa(42.2.0.192.in-addr.arpa.) + * address.correctForm(); // '192.0.2.42' + */ + static fromArpa(arpaFormAddress) { + // remove ending ".in-addr.arpa." or just "." + const leader = arpaFormAddress.replace(/(\.in-addr\.arpa)?\.$/, ''); + const address = leader.split('.').reverse().join('.'); + return new Address4(address); + } + /** + * Converts an IPv4 address object to a hex string + * @memberof Address4 + * @instance + * @returns {String} + */ + toHex() { + return this.parsedAddress.map((part) => (0, sprintf_js_1.sprintf)('%02x', parseInt(part, 10))).join(':'); + } + /** + * Converts an IPv4 address object to an array of bytes + * @memberof Address4 + * @instance + * @returns {Array} + */ + toArray() { + return this.parsedAddress.map((part) => parseInt(part, 10)); + } + /** + * Converts an IPv4 address object to an IPv6 address group + * @memberof Address4 + * @instance + * @returns {String} + */ + toGroup6() { + const output = []; + let i; + for (i = 0; i < constants.GROUPS; i += 2) { + const hex = (0, sprintf_js_1.sprintf)('%02x%02x', parseInt(this.parsedAddress[i], 10), parseInt(this.parsedAddress[i + 1], 10)); + output.push((0, sprintf_js_1.sprintf)('%x', parseInt(hex, 16))); + } + return output.join(':'); + } + /** + * Returns the address as a BigInteger + * @memberof Address4 + * @instance + * @returns {BigInteger} + */ + bigInteger() { + return new jsbn_1.BigInteger(this.parsedAddress.map((n) => (0, sprintf_js_1.sprintf)('%02x', parseInt(n, 10))).join(''), 16); + } + /** + * Helper function getting start address. + * @memberof Address4 + * @instance + * @returns {BigInteger} + */ + _startAddress() { + return new jsbn_1.BigInteger(this.mask() + '0'.repeat(constants.BITS - this.subnetMask), 2); + } + /** + * The first address in the range given by this address' subnet. + * Often referred to as the Network Address. + * @memberof Address4 + * @instance + * @returns {Address4} + */ + startAddress() { + return Address4.fromBigInteger(this._startAddress()); + } + /** + * The first host address in the range given by this address's subnet ie + * the first address after the Network Address + * @memberof Address4 + * @instance + * @returns {Address4} + */ + startAddressExclusive() { + const adjust = new jsbn_1.BigInteger('1'); + return Address4.fromBigInteger(this._startAddress().add(adjust)); + } + /** + * Helper function getting end address. + * @memberof Address4 + * @instance + * @returns {BigInteger} + */ + _endAddress() { + return new jsbn_1.BigInteger(this.mask() + '1'.repeat(constants.BITS - this.subnetMask), 2); + } + /** + * The last address in the range given by this address' subnet + * Often referred to as the Broadcast + * @memberof Address4 + * @instance + * @returns {Address4} + */ + endAddress() { + return Address4.fromBigInteger(this._endAddress()); + } + /** + * The last host address in the range given by this address's subnet ie + * the last address prior to the Broadcast Address + * @memberof Address4 + * @instance + * @returns {Address4} + */ + endAddressExclusive() { + const adjust = new jsbn_1.BigInteger('1'); + return Address4.fromBigInteger(this._endAddress().subtract(adjust)); + } + /** + * Converts a BigInteger to a v4 address object + * @memberof Address4 + * @static + * @param {BigInteger} bigInteger - a BigInteger to convert + * @returns {Address4} + */ + static fromBigInteger(bigInteger) { + return Address4.fromInteger(parseInt(bigInteger.toString(), 10)); + } + /** + * Returns the first n bits of the address, defaulting to the + * subnet mask + * @memberof Address4 + * @instance + * @returns {String} + */ + mask(mask) { + if (mask === undefined) { + mask = this.subnetMask; + } + return this.getBitsBase2(0, mask); + } + /** + * Returns the bits in the given range as a base-2 string + * @memberof Address4 + * @instance + * @returns {string} + */ + getBitsBase2(start, end) { + return this.binaryZeroPad().slice(start, end); + } + /** + * Return the reversed ip6.arpa form of the address + * @memberof Address4 + * @param {Object} options + * @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix + * @instance + * @returns {String} + */ + reverseForm(options) { + if (!options) { + options = {}; + } + const reversed = this.correctForm().split('.').reverse().join('.'); + if (options.omitSuffix) { + return reversed; + } + return (0, sprintf_js_1.sprintf)('%s.in-addr.arpa.', reversed); + } + /** + * Returns true if the given address is a multicast address + * @memberof Address4 + * @instance + * @returns {boolean} + */ + isMulticast() { + return this.isInSubnet(new Address4('224.0.0.0/4')); + } + /** + * Returns a zero-padded base-2 string representation of the address + * @memberof Address4 + * @instance + * @returns {string} + */ + binaryZeroPad() { + return this.bigInteger().toString(2).padStart(constants.BITS, '0'); + } + /** + * Groups an IPv4 address for inclusion at the end of an IPv6 address + * @returns {String} + */ + groupForV6() { + const segments = this.parsedAddress; + return this.address.replace(constants.RE_ADDRESS, (0, sprintf_js_1.sprintf)('%s.%s', segments.slice(0, 2).join('.'), segments.slice(2, 4).join('.'))); + } +} +exports.Address4 = Address4; +//# sourceMappingURL=ipv4.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/ip-address/dist/ipv6.js b/node_modules/npm/node_modules/ip-address/dist/ipv6.js new file mode 100644 index 00000000..c88ab84b --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/dist/ipv6.js @@ -0,0 +1,998 @@ +"use strict"; +/* eslint-disable prefer-destructuring */ +/* eslint-disable no-param-reassign */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Address6 = void 0; +const common = __importStar(require("./common")); +const constants4 = __importStar(require("./v4/constants")); +const constants6 = __importStar(require("./v6/constants")); +const helpers = __importStar(require("./v6/helpers")); +const ipv4_1 = require("./ipv4"); +const regular_expressions_1 = require("./v6/regular-expressions"); +const address_error_1 = require("./address-error"); +const jsbn_1 = require("jsbn"); +const sprintf_js_1 = require("sprintf-js"); +function assert(condition) { + if (!condition) { + throw new Error('Assertion failed.'); + } +} +function addCommas(number) { + const r = /(\d+)(\d{3})/; + while (r.test(number)) { + number = number.replace(r, '$1,$2'); + } + return number; +} +function spanLeadingZeroes4(n) { + n = n.replace(/^(0{1,})([1-9]+)$/, '$1$2'); + n = n.replace(/^(0{1,})(0)$/, '$1$2'); + return n; +} +/* + * A helper function to compact an array + */ +function compact(address, slice) { + const s1 = []; + const s2 = []; + let i; + for (i = 0; i < address.length; i++) { + if (i < slice[0]) { + s1.push(address[i]); + } + else if (i > slice[1]) { + s2.push(address[i]); + } + } + return s1.concat(['compact']).concat(s2); +} +function paddedHex(octet) { + return (0, sprintf_js_1.sprintf)('%04x', parseInt(octet, 16)); +} +function unsignByte(b) { + // eslint-disable-next-line no-bitwise + return b & 0xff; +} +/** + * Represents an IPv6 address + * @class Address6 + * @param {string} address - An IPv6 address string + * @param {number} [groups=8] - How many octets to parse + * @example + * var address = new Address6('2001::/32'); + */ +class Address6 { + constructor(address, optionalGroups) { + this.addressMinusSuffix = ''; + this.parsedSubnet = ''; + this.subnet = '/128'; + this.subnetMask = 128; + this.v4 = false; + this.zone = ''; + // #region Attributes + /** + * Returns true if the given address is in the subnet of the current address + * @memberof Address6 + * @instance + * @returns {boolean} + */ + this.isInSubnet = common.isInSubnet; + /** + * Returns true if the address is correct, false otherwise + * @memberof Address6 + * @instance + * @returns {boolean} + */ + this.isCorrect = common.isCorrect(constants6.BITS); + if (optionalGroups === undefined) { + this.groups = constants6.GROUPS; + } + else { + this.groups = optionalGroups; + } + this.address = address; + const subnet = constants6.RE_SUBNET_STRING.exec(address); + if (subnet) { + this.parsedSubnet = subnet[0].replace('/', ''); + this.subnetMask = parseInt(this.parsedSubnet, 10); + this.subnet = `/${this.subnetMask}`; + if (Number.isNaN(this.subnetMask) || + this.subnetMask < 0 || + this.subnetMask > constants6.BITS) { + throw new address_error_1.AddressError('Invalid subnet mask.'); + } + address = address.replace(constants6.RE_SUBNET_STRING, ''); + } + else if (/\//.test(address)) { + throw new address_error_1.AddressError('Invalid subnet mask.'); + } + const zone = constants6.RE_ZONE_STRING.exec(address); + if (zone) { + this.zone = zone[0]; + address = address.replace(constants6.RE_ZONE_STRING, ''); + } + this.addressMinusSuffix = address; + this.parsedAddress = this.parse(this.addressMinusSuffix); + } + static isValid(address) { + try { + // eslint-disable-next-line no-new + new Address6(address); + return true; + } + catch (e) { + return false; + } + } + /** + * Convert a BigInteger to a v6 address object + * @memberof Address6 + * @static + * @param {BigInteger} bigInteger - a BigInteger to convert + * @returns {Address6} + * @example + * var bigInteger = new BigInteger('1000000000000'); + * var address = Address6.fromBigInteger(bigInteger); + * address.correctForm(); // '::e8:d4a5:1000' + */ + static fromBigInteger(bigInteger) { + const hex = bigInteger.toString(16).padStart(32, '0'); + const groups = []; + let i; + for (i = 0; i < constants6.GROUPS; i++) { + groups.push(hex.slice(i * 4, (i + 1) * 4)); + } + return new Address6(groups.join(':')); + } + /** + * Convert a URL (with optional port number) to an address object + * @memberof Address6 + * @static + * @param {string} url - a URL with optional port number + * @example + * var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/'); + * addressAndPort.address.correctForm(); // 'ffff::' + * addressAndPort.port; // 8080 + */ + static fromURL(url) { + let host; + let port = null; + let result; + // If we have brackets parse them and find a port + if (url.indexOf('[') !== -1 && url.indexOf(']:') !== -1) { + result = constants6.RE_URL_WITH_PORT.exec(url); + if (result === null) { + return { + error: 'failed to parse address with port', + address: null, + port: null, + }; + } + host = result[1]; + port = result[2]; + // If there's a URL extract the address + } + else if (url.indexOf('/') !== -1) { + // Remove the protocol prefix + url = url.replace(/^[a-z0-9]+:\/\//, ''); + // Parse the address + result = constants6.RE_URL.exec(url); + if (result === null) { + return { + error: 'failed to parse address from URL', + address: null, + port: null, + }; + } + host = result[1]; + // Otherwise just assign the URL to the host and let the library parse it + } + else { + host = url; + } + // If there's a port convert it to an integer + if (port) { + port = parseInt(port, 10); + // squelch out of range ports + if (port < 0 || port > 65536) { + port = null; + } + } + else { + // Standardize `undefined` to `null` + port = null; + } + return { + address: new Address6(host), + port, + }; + } + /** + * Create an IPv6-mapped address given an IPv4 address + * @memberof Address6 + * @static + * @param {string} address - An IPv4 address string + * @returns {Address6} + * @example + * var address = Address6.fromAddress4('192.168.0.1'); + * address.correctForm(); // '::ffff:c0a8:1' + * address.to4in6(); // '::ffff:192.168.0.1' + */ + static fromAddress4(address) { + const address4 = new ipv4_1.Address4(address); + const mask6 = constants6.BITS - (constants4.BITS - address4.subnetMask); + return new Address6(`::ffff:${address4.correctForm()}/${mask6}`); + } + /** + * Return an address from ip6.arpa form + * @memberof Address6 + * @static + * @param {string} arpaFormAddress - an 'ip6.arpa' form address + * @returns {Adress6} + * @example + * var address = Address6.fromArpa(e.f.f.f.3.c.2.6.f.f.f.e.6.6.8.e.1.0.6.7.9.4.e.c.0.0.0.0.1.0.0.2.ip6.arpa.) + * address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe' + */ + static fromArpa(arpaFormAddress) { + // remove ending ".ip6.arpa." or just "." + let address = arpaFormAddress.replace(/(\.ip6\.arpa)?\.$/, ''); + const semicolonAmount = 7; + // correct ip6.arpa form with ending removed will be 63 characters + if (address.length !== 63) { + throw new address_error_1.AddressError("Invalid 'ip6.arpa' form."); + } + const parts = address.split('.').reverse(); + for (let i = semicolonAmount; i > 0; i--) { + const insertIndex = i * 4; + parts.splice(insertIndex, 0, ':'); + } + address = parts.join(''); + return new Address6(address); + } + /** + * Return the Microsoft UNC transcription of the address + * @memberof Address6 + * @instance + * @returns {String} the Microsoft UNC transcription of the address + */ + microsoftTranscription() { + return (0, sprintf_js_1.sprintf)('%s.ipv6-literal.net', this.correctForm().replace(/:/g, '-')); + } + /** + * Return the first n bits of the address, defaulting to the subnet mask + * @memberof Address6 + * @instance + * @param {number} [mask=subnet] - the number of bits to mask + * @returns {String} the first n bits of the address as a string + */ + mask(mask = this.subnetMask) { + return this.getBitsBase2(0, mask); + } + /** + * Return the number of possible subnets of a given size in the address + * @memberof Address6 + * @instance + * @param {number} [size=128] - the subnet size + * @returns {String} + */ + // TODO: probably useful to have a numeric version of this too + possibleSubnets(subnetSize = 128) { + const availableBits = constants6.BITS - this.subnetMask; + const subnetBits = Math.abs(subnetSize - constants6.BITS); + const subnetPowers = availableBits - subnetBits; + if (subnetPowers < 0) { + return '0'; + } + return addCommas(new jsbn_1.BigInteger('2', 10).pow(subnetPowers).toString(10)); + } + /** + * Helper function getting start address. + * @memberof Address6 + * @instance + * @returns {BigInteger} + */ + _startAddress() { + return new jsbn_1.BigInteger(this.mask() + '0'.repeat(constants6.BITS - this.subnetMask), 2); + } + /** + * The first address in the range given by this address' subnet + * Often referred to as the Network Address. + * @memberof Address6 + * @instance + * @returns {Address6} + */ + startAddress() { + return Address6.fromBigInteger(this._startAddress()); + } + /** + * The first host address in the range given by this address's subnet ie + * the first address after the Network Address + * @memberof Address6 + * @instance + * @returns {Address6} + */ + startAddressExclusive() { + const adjust = new jsbn_1.BigInteger('1'); + return Address6.fromBigInteger(this._startAddress().add(adjust)); + } + /** + * Helper function getting end address. + * @memberof Address6 + * @instance + * @returns {BigInteger} + */ + _endAddress() { + return new jsbn_1.BigInteger(this.mask() + '1'.repeat(constants6.BITS - this.subnetMask), 2); + } + /** + * The last address in the range given by this address' subnet + * Often referred to as the Broadcast + * @memberof Address6 + * @instance + * @returns {Address6} + */ + endAddress() { + return Address6.fromBigInteger(this._endAddress()); + } + /** + * The last host address in the range given by this address's subnet ie + * the last address prior to the Broadcast Address + * @memberof Address6 + * @instance + * @returns {Address6} + */ + endAddressExclusive() { + const adjust = new jsbn_1.BigInteger('1'); + return Address6.fromBigInteger(this._endAddress().subtract(adjust)); + } + /** + * Return the scope of the address + * @memberof Address6 + * @instance + * @returns {String} + */ + getScope() { + let scope = constants6.SCOPES[this.getBits(12, 16).intValue()]; + if (this.getType() === 'Global unicast' && scope !== 'Link local') { + scope = 'Global'; + } + return scope || 'Unknown'; + } + /** + * Return the type of the address + * @memberof Address6 + * @instance + * @returns {String} + */ + getType() { + for (const subnet of Object.keys(constants6.TYPES)) { + if (this.isInSubnet(new Address6(subnet))) { + return constants6.TYPES[subnet]; + } + } + return 'Global unicast'; + } + /** + * Return the bits in the given range as a BigInteger + * @memberof Address6 + * @instance + * @returns {BigInteger} + */ + getBits(start, end) { + return new jsbn_1.BigInteger(this.getBitsBase2(start, end), 2); + } + /** + * Return the bits in the given range as a base-2 string + * @memberof Address6 + * @instance + * @returns {String} + */ + getBitsBase2(start, end) { + return this.binaryZeroPad().slice(start, end); + } + /** + * Return the bits in the given range as a base-16 string + * @memberof Address6 + * @instance + * @returns {String} + */ + getBitsBase16(start, end) { + const length = end - start; + if (length % 4 !== 0) { + throw new Error('Length of bits to retrieve must be divisible by four'); + } + return this.getBits(start, end) + .toString(16) + .padStart(length / 4, '0'); + } + /** + * Return the bits that are set past the subnet mask length + * @memberof Address6 + * @instance + * @returns {String} + */ + getBitsPastSubnet() { + return this.getBitsBase2(this.subnetMask, constants6.BITS); + } + /** + * Return the reversed ip6.arpa form of the address + * @memberof Address6 + * @param {Object} options + * @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix + * @instance + * @returns {String} + */ + reverseForm(options) { + if (!options) { + options = {}; + } + const characters = Math.floor(this.subnetMask / 4); + const reversed = this.canonicalForm() + .replace(/:/g, '') + .split('') + .slice(0, characters) + .reverse() + .join('.'); + if (characters > 0) { + if (options.omitSuffix) { + return reversed; + } + return (0, sprintf_js_1.sprintf)('%s.ip6.arpa.', reversed); + } + if (options.omitSuffix) { + return ''; + } + return 'ip6.arpa.'; + } + /** + * Return the correct form of the address + * @memberof Address6 + * @instance + * @returns {String} + */ + correctForm() { + let i; + let groups = []; + let zeroCounter = 0; + const zeroes = []; + for (i = 0; i < this.parsedAddress.length; i++) { + const value = parseInt(this.parsedAddress[i], 16); + if (value === 0) { + zeroCounter++; + } + if (value !== 0 && zeroCounter > 0) { + if (zeroCounter > 1) { + zeroes.push([i - zeroCounter, i - 1]); + } + zeroCounter = 0; + } + } + // Do we end with a string of zeroes? + if (zeroCounter > 1) { + zeroes.push([this.parsedAddress.length - zeroCounter, this.parsedAddress.length - 1]); + } + const zeroLengths = zeroes.map((n) => n[1] - n[0] + 1); + if (zeroes.length > 0) { + const index = zeroLengths.indexOf(Math.max(...zeroLengths)); + groups = compact(this.parsedAddress, zeroes[index]); + } + else { + groups = this.parsedAddress; + } + for (i = 0; i < groups.length; i++) { + if (groups[i] !== 'compact') { + groups[i] = parseInt(groups[i], 16).toString(16); + } + } + let correct = groups.join(':'); + correct = correct.replace(/^compact$/, '::'); + correct = correct.replace(/^compact|compact$/, ':'); + correct = correct.replace(/compact/, ''); + return correct; + } + /** + * Return a zero-padded base-2 string representation of the address + * @memberof Address6 + * @instance + * @returns {String} + * @example + * var address = new Address6('2001:4860:4001:803::1011'); + * address.binaryZeroPad(); + * // '0010000000000001010010000110000001000000000000010000100000000011 + * // 0000000000000000000000000000000000000000000000000001000000010001' + */ + binaryZeroPad() { + return this.bigInteger().toString(2).padStart(constants6.BITS, '0'); + } + // TODO: Improve the semantics of this helper function + parse4in6(address) { + const groups = address.split(':'); + const lastGroup = groups.slice(-1)[0]; + const address4 = lastGroup.match(constants4.RE_ADDRESS); + if (address4) { + this.parsedAddress4 = address4[0]; + this.address4 = new ipv4_1.Address4(this.parsedAddress4); + for (let i = 0; i < this.address4.groups; i++) { + if (/^0[0-9]+/.test(this.address4.parsedAddress[i])) { + throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.", address.replace(constants4.RE_ADDRESS, this.address4.parsedAddress.map(spanLeadingZeroes4).join('.'))); + } + } + this.v4 = true; + groups[groups.length - 1] = this.address4.toGroup6(); + address = groups.join(':'); + } + return address; + } + // TODO: Make private? + parse(address) { + address = this.parse4in6(address); + const badCharacters = address.match(constants6.RE_BAD_CHARACTERS); + if (badCharacters) { + throw new address_error_1.AddressError((0, sprintf_js_1.sprintf)('Bad character%s detected in address: %s', badCharacters.length > 1 ? 's' : '', badCharacters.join('')), address.replace(constants6.RE_BAD_CHARACTERS, '$1')); + } + const badAddress = address.match(constants6.RE_BAD_ADDRESS); + if (badAddress) { + throw new address_error_1.AddressError((0, sprintf_js_1.sprintf)('Address failed regex: %s', badAddress.join('')), address.replace(constants6.RE_BAD_ADDRESS, '$1')); + } + let groups = []; + const halves = address.split('::'); + if (halves.length === 2) { + let first = halves[0].split(':'); + let last = halves[1].split(':'); + if (first.length === 1 && first[0] === '') { + first = []; + } + if (last.length === 1 && last[0] === '') { + last = []; + } + const remaining = this.groups - (first.length + last.length); + if (!remaining) { + throw new address_error_1.AddressError('Error parsing groups'); + } + this.elidedGroups = remaining; + this.elisionBegin = first.length; + this.elisionEnd = first.length + this.elidedGroups; + groups = groups.concat(first); + for (let i = 0; i < remaining; i++) { + groups.push('0'); + } + groups = groups.concat(last); + } + else if (halves.length === 1) { + groups = address.split(':'); + this.elidedGroups = 0; + } + else { + throw new address_error_1.AddressError('Too many :: groups found'); + } + groups = groups.map((group) => (0, sprintf_js_1.sprintf)('%x', parseInt(group, 16))); + if (groups.length !== this.groups) { + throw new address_error_1.AddressError('Incorrect number of groups found'); + } + return groups; + } + /** + * Return the canonical form of the address + * @memberof Address6 + * @instance + * @returns {String} + */ + canonicalForm() { + return this.parsedAddress.map(paddedHex).join(':'); + } + /** + * Return the decimal form of the address + * @memberof Address6 + * @instance + * @returns {String} + */ + decimal() { + return this.parsedAddress.map((n) => (0, sprintf_js_1.sprintf)('%05d', parseInt(n, 16))).join(':'); + } + /** + * Return the address as a BigInteger + * @memberof Address6 + * @instance + * @returns {BigInteger} + */ + bigInteger() { + return new jsbn_1.BigInteger(this.parsedAddress.map(paddedHex).join(''), 16); + } + /** + * Return the last two groups of this address as an IPv4 address string + * @memberof Address6 + * @instance + * @returns {Address4} + * @example + * var address = new Address6('2001:4860:4001::1825:bf11'); + * address.to4().correctForm(); // '24.37.191.17' + */ + to4() { + const binary = this.binaryZeroPad().split(''); + return ipv4_1.Address4.fromHex(new jsbn_1.BigInteger(binary.slice(96, 128).join(''), 2).toString(16)); + } + /** + * Return the v4-in-v6 form of the address + * @memberof Address6 + * @instance + * @returns {String} + */ + to4in6() { + const address4 = this.to4(); + const address6 = new Address6(this.parsedAddress.slice(0, 6).join(':'), 6); + const correct = address6.correctForm(); + let infix = ''; + if (!/:$/.test(correct)) { + infix = ':'; + } + return correct + infix + address4.address; + } + /** + * Return an object containing the Teredo properties of the address + * @memberof Address6 + * @instance + * @returns {Object} + */ + inspectTeredo() { + /* + - Bits 0 to 31 are set to the Teredo prefix (normally 2001:0000::/32). + - Bits 32 to 63 embed the primary IPv4 address of the Teredo server that + is used. + - Bits 64 to 79 can be used to define some flags. Currently only the + higher order bit is used; it is set to 1 if the Teredo client is + located behind a cone NAT, 0 otherwise. For Microsoft's Windows Vista + and Windows Server 2008 implementations, more bits are used. In those + implementations, the format for these 16 bits is "CRAAAAUG AAAAAAAA", + where "C" remains the "Cone" flag. The "R" bit is reserved for future + use. The "U" bit is for the Universal/Local flag (set to 0). The "G" bit + is Individual/Group flag (set to 0). The A bits are set to a 12-bit + randomly generated number chosen by the Teredo client to introduce + additional protection for the Teredo node against IPv6-based scanning + attacks. + - Bits 80 to 95 contains the obfuscated UDP port number. This is the + port number that is mapped by the NAT to the Teredo client with all + bits inverted. + - Bits 96 to 127 contains the obfuscated IPv4 address. This is the + public IPv4 address of the NAT with all bits inverted. + */ + const prefix = this.getBitsBase16(0, 32); + const udpPort = this.getBits(80, 96).xor(new jsbn_1.BigInteger('ffff', 16)).toString(); + const server4 = ipv4_1.Address4.fromHex(this.getBitsBase16(32, 64)); + const client4 = ipv4_1.Address4.fromHex(this.getBits(96, 128).xor(new jsbn_1.BigInteger('ffffffff', 16)).toString(16)); + const flags = this.getBits(64, 80); + const flagsBase2 = this.getBitsBase2(64, 80); + const coneNat = flags.testBit(15); + const reserved = flags.testBit(14); + const groupIndividual = flags.testBit(8); + const universalLocal = flags.testBit(9); + const nonce = new jsbn_1.BigInteger(flagsBase2.slice(2, 6) + flagsBase2.slice(8, 16), 2).toString(10); + return { + prefix: (0, sprintf_js_1.sprintf)('%s:%s', prefix.slice(0, 4), prefix.slice(4, 8)), + server4: server4.address, + client4: client4.address, + flags: flagsBase2, + coneNat, + microsoft: { + reserved, + universalLocal, + groupIndividual, + nonce, + }, + udpPort, + }; + } + /** + * Return an object containing the 6to4 properties of the address + * @memberof Address6 + * @instance + * @returns {Object} + */ + inspect6to4() { + /* + - Bits 0 to 15 are set to the 6to4 prefix (2002::/16). + - Bits 16 to 48 embed the IPv4 address of the 6to4 gateway that is used. + */ + const prefix = this.getBitsBase16(0, 16); + const gateway = ipv4_1.Address4.fromHex(this.getBitsBase16(16, 48)); + return { + prefix: (0, sprintf_js_1.sprintf)('%s', prefix.slice(0, 4)), + gateway: gateway.address, + }; + } + /** + * Return a v6 6to4 address from a v6 v4inv6 address + * @memberof Address6 + * @instance + * @returns {Address6} + */ + to6to4() { + if (!this.is4()) { + return null; + } + const addr6to4 = [ + '2002', + this.getBitsBase16(96, 112), + this.getBitsBase16(112, 128), + '', + '/16', + ].join(':'); + return new Address6(addr6to4); + } + /** + * Return a byte array + * @memberof Address6 + * @instance + * @returns {Array} + */ + toByteArray() { + const byteArray = this.bigInteger().toByteArray(); + // work around issue where `toByteArray` returns a leading 0 element + if (byteArray.length === 17 && byteArray[0] === 0) { + return byteArray.slice(1); + } + return byteArray; + } + /** + * Return an unsigned byte array + * @memberof Address6 + * @instance + * @returns {Array} + */ + toUnsignedByteArray() { + return this.toByteArray().map(unsignByte); + } + /** + * Convert a byte array to an Address6 object + * @memberof Address6 + * @static + * @returns {Address6} + */ + static fromByteArray(bytes) { + return this.fromUnsignedByteArray(bytes.map(unsignByte)); + } + /** + * Convert an unsigned byte array to an Address6 object + * @memberof Address6 + * @static + * @returns {Address6} + */ + static fromUnsignedByteArray(bytes) { + const BYTE_MAX = new jsbn_1.BigInteger('256', 10); + let result = new jsbn_1.BigInteger('0', 10); + let multiplier = new jsbn_1.BigInteger('1', 10); + for (let i = bytes.length - 1; i >= 0; i--) { + result = result.add(multiplier.multiply(new jsbn_1.BigInteger(bytes[i].toString(10), 10))); + multiplier = multiplier.multiply(BYTE_MAX); + } + return Address6.fromBigInteger(result); + } + /** + * Returns true if the address is in the canonical form, false otherwise + * @memberof Address6 + * @instance + * @returns {boolean} + */ + isCanonical() { + return this.addressMinusSuffix === this.canonicalForm(); + } + /** + * Returns true if the address is a link local address, false otherwise + * @memberof Address6 + * @instance + * @returns {boolean} + */ + isLinkLocal() { + // Zeroes are required, i.e. we can't check isInSubnet with 'fe80::/10' + if (this.getBitsBase2(0, 64) === + '1111111010000000000000000000000000000000000000000000000000000000') { + return true; + } + return false; + } + /** + * Returns true if the address is a multicast address, false otherwise + * @memberof Address6 + * @instance + * @returns {boolean} + */ + isMulticast() { + return this.getType() === 'Multicast'; + } + /** + * Returns true if the address is a v4-in-v6 address, false otherwise + * @memberof Address6 + * @instance + * @returns {boolean} + */ + is4() { + return this.v4; + } + /** + * Returns true if the address is a Teredo address, false otherwise + * @memberof Address6 + * @instance + * @returns {boolean} + */ + isTeredo() { + return this.isInSubnet(new Address6('2001::/32')); + } + /** + * Returns true if the address is a 6to4 address, false otherwise + * @memberof Address6 + * @instance + * @returns {boolean} + */ + is6to4() { + return this.isInSubnet(new Address6('2002::/16')); + } + /** + * Returns true if the address is a loopback address, false otherwise + * @memberof Address6 + * @instance + * @returns {boolean} + */ + isLoopback() { + return this.getType() === 'Loopback'; + } + // #endregion + // #region HTML + /** + * @returns {String} the address in link form with a default port of 80 + */ + href(optionalPort) { + if (optionalPort === undefined) { + optionalPort = ''; + } + else { + optionalPort = (0, sprintf_js_1.sprintf)(':%s', optionalPort); + } + return (0, sprintf_js_1.sprintf)('http://[%s]%s/', this.correctForm(), optionalPort); + } + /** + * @returns {String} a link suitable for conveying the address via a URL hash + */ + link(options) { + if (!options) { + options = {}; + } + if (options.className === undefined) { + options.className = ''; + } + if (options.prefix === undefined) { + options.prefix = '/#address='; + } + if (options.v4 === undefined) { + options.v4 = false; + } + let formFunction = this.correctForm; + if (options.v4) { + formFunction = this.to4in6; + } + if (options.className) { + return (0, sprintf_js_1.sprintf)('%2$s', options.prefix, formFunction.call(this), options.className); + } + return (0, sprintf_js_1.sprintf)('%2$s', options.prefix, formFunction.call(this)); + } + /** + * Groups an address + * @returns {String} + */ + group() { + if (this.elidedGroups === 0) { + // The simple case + return helpers.simpleGroup(this.address).join(':'); + } + assert(typeof this.elidedGroups === 'number'); + assert(typeof this.elisionBegin === 'number'); + // The elided case + const output = []; + const [left, right] = this.address.split('::'); + if (left.length) { + output.push(...helpers.simpleGroup(left)); + } + else { + output.push(''); + } + const classes = ['hover-group']; + for (let i = this.elisionBegin; i < this.elisionBegin + this.elidedGroups; i++) { + classes.push((0, sprintf_js_1.sprintf)('group-%d', i)); + } + output.push((0, sprintf_js_1.sprintf)('', classes.join(' '))); + if (right.length) { + output.push(...helpers.simpleGroup(right, this.elisionEnd)); + } + else { + output.push(''); + } + if (this.is4()) { + assert(this.address4 instanceof ipv4_1.Address4); + output.pop(); + output.push(this.address4.groupForV6()); + } + return output.join(':'); + } + // #endregion + // #region Regular expressions + /** + * Generate a regular expression string that can be used to find or validate + * all variations of this address + * @memberof Address6 + * @instance + * @param {boolean} substringSearch + * @returns {string} + */ + regularExpressionString(substringSearch = false) { + let output = []; + // TODO: revisit why this is necessary + const address6 = new Address6(this.correctForm()); + if (address6.elidedGroups === 0) { + // The simple case + output.push((0, regular_expressions_1.simpleRegularExpression)(address6.parsedAddress)); + } + else if (address6.elidedGroups === constants6.GROUPS) { + // A completely elided address + output.push((0, regular_expressions_1.possibleElisions)(constants6.GROUPS)); + } + else { + // A partially elided address + const halves = address6.address.split('::'); + if (halves[0].length) { + output.push((0, regular_expressions_1.simpleRegularExpression)(halves[0].split(':'))); + } + assert(typeof address6.elidedGroups === 'number'); + output.push((0, regular_expressions_1.possibleElisions)(address6.elidedGroups, halves[0].length !== 0, halves[1].length !== 0)); + if (halves[1].length) { + output.push((0, regular_expressions_1.simpleRegularExpression)(halves[1].split(':'))); + } + output = [output.join(':')]; + } + if (!substringSearch) { + output = [ + '(?=^|', + regular_expressions_1.ADDRESS_BOUNDARY, + '|[^\\w\\:])(', + ...output, + ')(?=[^\\w\\:]|', + regular_expressions_1.ADDRESS_BOUNDARY, + '|$)', + ]; + } + return output.join(''); + } + /** + * Generate a regular expression that can be used to find or validate all + * variations of this address. + * @memberof Address6 + * @instance + * @param {boolean} substringSearch + * @returns {RegExp} + */ + regularExpression(substringSearch = false) { + return new RegExp(this.regularExpressionString(substringSearch), 'i'); + } +} +exports.Address6 = Address6; +//# sourceMappingURL=ipv6.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/ip-address/dist/v4/constants.js b/node_modules/npm/node_modules/ip-address/dist/v4/constants.js new file mode 100644 index 00000000..6fa2518f --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/dist/v4/constants.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RE_SUBNET_STRING = exports.RE_ADDRESS = exports.GROUPS = exports.BITS = void 0; +exports.BITS = 32; +exports.GROUPS = 4; +exports.RE_ADDRESS = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g; +exports.RE_SUBNET_STRING = /\/\d{1,2}$/; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/ip-address/dist/v6/constants.js b/node_modules/npm/node_modules/ip-address/dist/v6/constants.js new file mode 100644 index 00000000..e316bb0d --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/dist/v6/constants.js @@ -0,0 +1,76 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RE_URL_WITH_PORT = exports.RE_URL = exports.RE_ZONE_STRING = exports.RE_SUBNET_STRING = exports.RE_BAD_ADDRESS = exports.RE_BAD_CHARACTERS = exports.TYPES = exports.SCOPES = exports.GROUPS = exports.BITS = void 0; +exports.BITS = 128; +exports.GROUPS = 8; +/** + * Represents IPv6 address scopes + * @memberof Address6 + * @static + */ +exports.SCOPES = { + 0: 'Reserved', + 1: 'Interface local', + 2: 'Link local', + 4: 'Admin local', + 5: 'Site local', + 8: 'Organization local', + 14: 'Global', + 15: 'Reserved', +}; +/** + * Represents IPv6 address types + * @memberof Address6 + * @static + */ +exports.TYPES = { + 'ff01::1/128': 'Multicast (All nodes on this interface)', + 'ff01::2/128': 'Multicast (All routers on this interface)', + 'ff02::1/128': 'Multicast (All nodes on this link)', + 'ff02::2/128': 'Multicast (All routers on this link)', + 'ff05::2/128': 'Multicast (All routers in this site)', + 'ff02::5/128': 'Multicast (OSPFv3 AllSPF routers)', + 'ff02::6/128': 'Multicast (OSPFv3 AllDR routers)', + 'ff02::9/128': 'Multicast (RIP routers)', + 'ff02::a/128': 'Multicast (EIGRP routers)', + 'ff02::d/128': 'Multicast (PIM routers)', + 'ff02::16/128': 'Multicast (MLDv2 reports)', + 'ff01::fb/128': 'Multicast (mDNSv6)', + 'ff02::fb/128': 'Multicast (mDNSv6)', + 'ff05::fb/128': 'Multicast (mDNSv6)', + 'ff02::1:2/128': 'Multicast (All DHCP servers and relay agents on this link)', + 'ff05::1:2/128': 'Multicast (All DHCP servers and relay agents in this site)', + 'ff02::1:3/128': 'Multicast (All DHCP servers on this link)', + 'ff05::1:3/128': 'Multicast (All DHCP servers in this site)', + '::/128': 'Unspecified', + '::1/128': 'Loopback', + 'ff00::/8': 'Multicast', + 'fe80::/10': 'Link-local unicast', +}; +/** + * A regular expression that matches bad characters in an IPv6 address + * @memberof Address6 + * @static + */ +exports.RE_BAD_CHARACTERS = /([^0-9a-f:/%])/gi; +/** + * A regular expression that matches an incorrect IPv6 address + * @memberof Address6 + * @static + */ +exports.RE_BAD_ADDRESS = /([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi; +/** + * A regular expression that matches an IPv6 subnet + * @memberof Address6 + * @static + */ +exports.RE_SUBNET_STRING = /\/\d{1,3}(?=%|$)/; +/** + * A regular expression that matches an IPv6 zone + * @memberof Address6 + * @static + */ +exports.RE_ZONE_STRING = /%.*$/; +exports.RE_URL = new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/); +exports.RE_URL_WITH_PORT = new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/ip-address/dist/v6/helpers.js b/node_modules/npm/node_modules/ip-address/dist/v6/helpers.js new file mode 100644 index 00000000..918aaa58 --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/dist/v6/helpers.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.simpleGroup = exports.spanLeadingZeroes = exports.spanAll = exports.spanAllZeroes = void 0; +const sprintf_js_1 = require("sprintf-js"); +/** + * @returns {String} the string with all zeroes contained in a + */ +function spanAllZeroes(s) { + return s.replace(/(0+)/g, '$1'); +} +exports.spanAllZeroes = spanAllZeroes; +/** + * @returns {String} the string with each character contained in a + */ +function spanAll(s, offset = 0) { + const letters = s.split(''); + return letters + .map((n, i) => (0, sprintf_js_1.sprintf)('%s', n, i + offset, spanAllZeroes(n)) // XXX Use #base-2 .value-0 instead? + ) + .join(''); +} +exports.spanAll = spanAll; +function spanLeadingZeroesSimple(group) { + return group.replace(/^(0+)/, '$1'); +} +/** + * @returns {String} the string with leading zeroes contained in a + */ +function spanLeadingZeroes(address) { + const groups = address.split(':'); + return groups.map((g) => spanLeadingZeroesSimple(g)).join(':'); +} +exports.spanLeadingZeroes = spanLeadingZeroes; +/** + * Groups an address + * @returns {String} a grouped address + */ +function simpleGroup(addressString, offset = 0) { + const groups = addressString.split(':'); + return groups.map((g, i) => { + if (/group-v4/.test(g)) { + return g; + } + return (0, sprintf_js_1.sprintf)('%s', i + offset, spanLeadingZeroesSimple(g)); + }); +} +exports.simpleGroup = simpleGroup; +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/ip-address/dist/v6/regular-expressions.js b/node_modules/npm/node_modules/ip-address/dist/v6/regular-expressions.js new file mode 100644 index 00000000..616550a8 --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/dist/v6/regular-expressions.js @@ -0,0 +1,96 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.possibleElisions = exports.simpleRegularExpression = exports.ADDRESS_BOUNDARY = exports.padGroup = exports.groupPossibilities = void 0; +const v6 = __importStar(require("./constants")); +const sprintf_js_1 = require("sprintf-js"); +function groupPossibilities(possibilities) { + return (0, sprintf_js_1.sprintf)('(%s)', possibilities.join('|')); +} +exports.groupPossibilities = groupPossibilities; +function padGroup(group) { + if (group.length < 4) { + return (0, sprintf_js_1.sprintf)('0{0,%d}%s', 4 - group.length, group); + } + return group; +} +exports.padGroup = padGroup; +exports.ADDRESS_BOUNDARY = '[^A-Fa-f0-9:]'; +function simpleRegularExpression(groups) { + const zeroIndexes = []; + groups.forEach((group, i) => { + const groupInteger = parseInt(group, 16); + if (groupInteger === 0) { + zeroIndexes.push(i); + } + }); + // You can technically elide a single 0, this creates the regular expressions + // to match that eventuality + const possibilities = zeroIndexes.map((zeroIndex) => groups + .map((group, i) => { + if (i === zeroIndex) { + const elision = i === 0 || i === v6.GROUPS - 1 ? ':' : ''; + return groupPossibilities([padGroup(group), elision]); + } + return padGroup(group); + }) + .join(':')); + // The simplest case + possibilities.push(groups.map(padGroup).join(':')); + return groupPossibilities(possibilities); +} +exports.simpleRegularExpression = simpleRegularExpression; +function possibleElisions(elidedGroups, moreLeft, moreRight) { + const left = moreLeft ? '' : ':'; + const right = moreRight ? '' : ':'; + const possibilities = []; + // 1. elision of everything (::) + if (!moreLeft && !moreRight) { + possibilities.push('::'); + } + // 2. complete elision of the middle + if (moreLeft && moreRight) { + possibilities.push(''); + } + if ((moreRight && !moreLeft) || (!moreRight && moreLeft)) { + // 3. complete elision of one side + possibilities.push(':'); + } + // 4. elision from the left side + possibilities.push((0, sprintf_js_1.sprintf)('%s(:0{1,4}){1,%d}', left, elidedGroups - 1)); + // 5. elision from the right side + possibilities.push((0, sprintf_js_1.sprintf)('(0{1,4}:){1,%d}%s', elidedGroups - 1, right)); + // 6. no elision + possibilities.push((0, sprintf_js_1.sprintf)('(0{1,4}:){%d}0{1,4}', elidedGroups - 1)); + // 7. elision (including sloppy elision) from the middle + for (let groups = 1; groups < elidedGroups - 1; groups++) { + for (let position = 1; position < elidedGroups - groups; position++) { + possibilities.push((0, sprintf_js_1.sprintf)('(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}', position, elidedGroups - position - groups - 1)); + } + } + return groupPossibilities(possibilities); +} +exports.possibleElisions = possibleElisions; +//# sourceMappingURL=regular-expressions.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/ip-address/package.json b/node_modules/npm/node_modules/ip-address/package.json new file mode 100644 index 00000000..0543fc41 --- /dev/null +++ b/node_modules/npm/node_modules/ip-address/package.json @@ -0,0 +1,87 @@ +{ + "name": "ip-address", + "description": "A library for parsing IPv4 and IPv6 IP addresses in node and the browser.", + "keywords": [ + "ipv6", + "ipv4", + "browser", + "validation" + ], + "version": "9.0.5", + "author": "Beau Gunderson (https://beaugunderson.com/)", + "license": "MIT", + "main": "dist/ip-address.js", + "types": "dist/ip-address.d.ts", + "scripts": { + "docs": "documentation build --github --output docs --format html ./ip-address.js", + "build": "rm -rf dist; mkdir dist; tsc", + "prepack": "npm run build", + "release": "release-it", + "test-ci": "nyc mocha", + "test": "mocha", + "watch": "mocha --watch" + }, + "nyc": { + "extension": [ + ".ts" + ], + "exclude": [ + "**/*.d.ts", + ".eslintrc.js", + "coverage/", + "dist/", + "test/", + "tmp/" + ], + "reporter": [ + "html", + "lcov", + "text" + ], + "all": true + }, + "engines": { + "node": ">= 12" + }, + "files": [ + "src", + "dist" + ], + "repository": { + "type": "git", + "url": "git://github.com/beaugunderson/ip-address.git" + }, + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "devDependencies": { + "@types/chai": "^4.2.18", + "@types/jsbn": "^1.2.31", + "@types/mocha": "^10.0.1", + "@types/sprintf-js": "^1.1.2", + "@typescript-eslint/eslint-plugin": "^6.7.2", + "@typescript-eslint/parser": "^6.7.2", + "browserify": "^17.0.0", + "chai": "^4.3.4", + "codecov": "^3.8.2", + "documentation": "^14.0.2", + "eslint": "^8.50.0", + "eslint-config-airbnb": "^19.0.4", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-filenames": "^1.3.2", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsx-a11y": "^6.4.1", + "eslint-plugin-prettier": "^5.0.0", + "eslint-plugin-react": "^7.24.0", + "eslint-plugin-react-hooks": "^4.2.0", + "eslint-plugin-sort-imports-es6-autofix": "^0.6.0", + "mocha": "^10.2.0", + "nyc": "^15.1.0", + "prettier": "^3.0.3", + "release-it": "^16.2.0", + "source-map-support": "^0.5.19", + "ts-node": "^10.0.0", + "typescript": "^5.2.2" + } +} diff --git a/node_modules/npm/node_modules/ip-regex/index.js b/node_modules/npm/node_modules/ip-regex/index.js new file mode 100644 index 00000000..1fe723cb --- /dev/null +++ b/node_modules/npm/node_modules/ip-regex/index.js @@ -0,0 +1,36 @@ +const word = '[a-fA-F\\d:]'; + +const boundry = options => options && options.includeBoundaries + ? `(?:(?<=\\s|^)(?=${word})|(?<=${word})(?=\\s|$))` + : ''; + +const v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}'; + +const v6segment = '[a-fA-F\\d]{1,4}'; + +const v6 = ` +(?: +(?:${v6segment}:){7}(?:${v6segment}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8 +(?:${v6segment}:){6}(?:${v4}|:${v6segment}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4 +(?:${v6segment}:){5}(?::${v4}|(?::${v6segment}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4 +(?:${v6segment}:){4}(?:(?::${v6segment}){0,1}:${v4}|(?::${v6segment}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4 +(?:${v6segment}:){3}(?:(?::${v6segment}){0,2}:${v4}|(?::${v6segment}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4 +(?:${v6segment}:){2}(?:(?::${v6segment}){0,3}:${v4}|(?::${v6segment}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4 +(?:${v6segment}:){1}(?:(?::${v6segment}){0,4}:${v4}|(?::${v6segment}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4 +(?::(?:(?::${v6segment}){0,5}:${v4}|(?::${v6segment}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4 +)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1 +`.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim(); + +// Pre-compile only the exact regexes because adding a global flag make regexes stateful +const v46Exact = new RegExp(`(?:^${v4}$)|(?:^${v6}$)`); +const v4exact = new RegExp(`^${v4}$`); +const v6exact = new RegExp(`^${v6}$`); + +const ipRegex = options => options && options.exact + ? v46Exact + : new RegExp(`(?:${boundry(options)}${v4}${boundry(options)})|(?:${boundry(options)}${v6}${boundry(options)})`, 'g'); + +ipRegex.v4 = options => options && options.exact ? v4exact : new RegExp(`${boundry(options)}${v4}${boundry(options)}`, 'g'); +ipRegex.v6 = options => options && options.exact ? v6exact : new RegExp(`${boundry(options)}${v6}${boundry(options)}`, 'g'); + +export default ipRegex; diff --git a/node_modules/npm/node_modules/ip-regex/license b/node_modules/npm/node_modules/ip-regex/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/ip-regex/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/ip-regex/package.json b/node_modules/npm/node_modules/ip-regex/package.json new file mode 100644 index 00000000..1f82fd59 --- /dev/null +++ b/node_modules/npm/node_modules/ip-regex/package.json @@ -0,0 +1,47 @@ +{ + "name": "ip-regex", + "version": "5.0.0", + "description": "Regular expression for matching IP addresses (IPv4 & IPv6)", + "license": "MIT", + "repository": "sindresorhus/ip-regex", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ip", + "ipv6", + "ipv4", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "text", + "pattern", + "internet", + "protocol", + "address", + "validate" + ], + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.19.1", + "xo": "^0.47.0" + } +} diff --git a/node_modules/npm/node_modules/is-cidr/dist/index.js b/node_modules/npm/node_modules/is-cidr/dist/index.js new file mode 100644 index 00000000..35fba31c --- /dev/null +++ b/node_modules/npm/node_modules/is-cidr/dist/index.js @@ -0,0 +1,11 @@ +import { v4 as v4$1, v6 as v6$1 } from "cidr-regex"; +const re4 = v4$1({ exact: true }); +const re6 = v6$1({ exact: true }); +const isCidr = (str) => re4.test(str) ? 4 : re6.test(str) ? 6 : 0; +const v4 = isCidr.v4 = (str) => re4.test(str); +const v6 = isCidr.v6 = (str) => re6.test(str); +export { + isCidr as default, + v4, + v6 +}; diff --git a/node_modules/npm/node_modules/is-cidr/package.json b/node_modules/npm/node_modules/is-cidr/package.json new file mode 100644 index 00000000..4b0e95b9 --- /dev/null +++ b/node_modules/npm/node_modules/is-cidr/package.json @@ -0,0 +1,40 @@ +{ + "name": "is-cidr", + "version": "5.1.0", + "description": "Check if a string is an IP address in CIDR notation", + "author": "silverwind ", + "contributors": [ + "Felipe Apostol (http://flipjs.io/)" + ], + "repository": "silverwind/is-cidr", + "license": "BSD-2-Clause", + "type": "module", + "sideEffects": false, + "main": "./dist/index.js", + "exports": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "engines": { + "node": ">=14" + }, + "dependencies": { + "cidr-regex": "^4.1.1" + }, + "devDependencies": { + "@types/node": "20.12.12", + "eslint": "8.57.0", + "eslint-config-silverwind": "85.1.4", + "eslint-config-silverwind-typescript": "3.2.7", + "typescript": "5.4.5", + "typescript-config-silverwind": "4.3.2", + "updates": "16.1.1", + "versions": "12.0.2", + "vite": "5.2.11", + "vite-config-silverwind": "1.1.2", + "vite-plugin-dts": "3.9.1", + "vitest": "1.6.0", + "vitest-config-silverwind": "9.0.6" + } +} diff --git a/node_modules/npm/node_modules/is-fullwidth-code-point/index.js b/node_modules/npm/node_modules/is-fullwidth-code-point/index.js new file mode 100644 index 00000000..671f97f7 --- /dev/null +++ b/node_modules/npm/node_modules/is-fullwidth-code-point/index.js @@ -0,0 +1,50 @@ +/* eslint-disable yoda */ +'use strict'; + +const isFullwidthCodePoint = codePoint => { + if (Number.isNaN(codePoint)) { + return false; + } + + // Code points are derived from: + // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt + if ( + codePoint >= 0x1100 && ( + codePoint <= 0x115F || // Hangul Jamo + codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET + codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + (0x3250 <= codePoint && codePoint <= 0x4DBF) || + // CJK Unified Ideographs .. Yi Radicals + (0x4E00 <= codePoint && codePoint <= 0xA4C6) || + // Hangul Jamo Extended-A + (0xA960 <= codePoint && codePoint <= 0xA97C) || + // Hangul Syllables + (0xAC00 <= codePoint && codePoint <= 0xD7A3) || + // CJK Compatibility Ideographs + (0xF900 <= codePoint && codePoint <= 0xFAFF) || + // Vertical Forms + (0xFE10 <= codePoint && codePoint <= 0xFE19) || + // CJK Compatibility Forms .. Small Form Variants + (0xFE30 <= codePoint && codePoint <= 0xFE6B) || + // Halfwidth and Fullwidth Forms + (0xFF01 <= codePoint && codePoint <= 0xFF60) || + (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || + // Kana Supplement + (0x1B000 <= codePoint && codePoint <= 0x1B001) || + // Enclosed Ideographic Supplement + (0x1F200 <= codePoint && codePoint <= 0x1F251) || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + (0x20000 <= codePoint && codePoint <= 0x3FFFD) + ) + ) { + return true; + } + + return false; +}; + +module.exports = isFullwidthCodePoint; +module.exports.default = isFullwidthCodePoint; diff --git a/node_modules/npm/node_modules/is-fullwidth-code-point/license b/node_modules/npm/node_modules/is-fullwidth-code-point/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/npm/node_modules/is-fullwidth-code-point/license @@ -0,0 +1,9 @@ +MIT License + +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/npm/node_modules/is-fullwidth-code-point/package.json b/node_modules/npm/node_modules/is-fullwidth-code-point/package.json new file mode 100644 index 00000000..2137e888 --- /dev/null +++ b/node_modules/npm/node_modules/is-fullwidth-code-point/package.json @@ -0,0 +1,42 @@ +{ + "name": "is-fullwidth-code-point", + "version": "3.0.0", + "description": "Check if the character represented by a given Unicode code point is fullwidth", + "license": "MIT", + "repository": "sindresorhus/is-fullwidth-code-point", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd-check" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "fullwidth", + "full-width", + "full", + "width", + "unicode", + "character", + "string", + "codepoint", + "code", + "point", + "is", + "detect", + "check" + ], + "devDependencies": { + "ava": "^1.3.1", + "tsd-check": "^0.5.0", + "xo": "^0.24.0" + } +} diff --git a/node_modules/npm/node_modules/isexe/LICENSE b/node_modules/npm/node_modules/isexe/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/isexe/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/isexe/index.js b/node_modules/npm/node_modules/isexe/index.js new file mode 100644 index 00000000..553fb32b --- /dev/null +++ b/node_modules/npm/node_modules/isexe/index.js @@ -0,0 +1,57 @@ +var fs = require('fs') +var core +if (process.platform === 'win32' || global.TESTING_WINDOWS) { + core = require('./windows.js') +} else { + core = require('./mode.js') +} + +module.exports = isexe +isexe.sync = sync + +function isexe (path, options, cb) { + if (typeof options === 'function') { + cb = options + options = {} + } + + if (!cb) { + if (typeof Promise !== 'function') { + throw new TypeError('callback not provided') + } + + return new Promise(function (resolve, reject) { + isexe(path, options || {}, function (er, is) { + if (er) { + reject(er) + } else { + resolve(is) + } + }) + }) + } + + core(path, options || {}, function (er, is) { + // ignore EACCES because that just means we aren't allowed to run it + if (er) { + if (er.code === 'EACCES' || options && options.ignoreErrors) { + er = null + is = false + } + } + cb(er, is) + }) +} + +function sync (path, options) { + // my kingdom for a filtered catch + try { + return core.sync(path, options || {}) + } catch (er) { + if (options && options.ignoreErrors || er.code === 'EACCES') { + return false + } else { + throw er + } + } +} diff --git a/node_modules/npm/node_modules/isexe/mode.js b/node_modules/npm/node_modules/isexe/mode.js new file mode 100644 index 00000000..1995ea4a --- /dev/null +++ b/node_modules/npm/node_modules/isexe/mode.js @@ -0,0 +1,41 @@ +module.exports = isexe +isexe.sync = sync + +var fs = require('fs') + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), options) +} + +function checkStat (stat, options) { + return stat.isFile() && checkMode(stat, options) +} + +function checkMode (stat, options) { + var mod = stat.mode + var uid = stat.uid + var gid = stat.gid + + var myUid = options.uid !== undefined ? + options.uid : process.getuid && process.getuid() + var myGid = options.gid !== undefined ? + options.gid : process.getgid && process.getgid() + + var u = parseInt('100', 8) + var g = parseInt('010', 8) + var o = parseInt('001', 8) + var ug = u | g + + var ret = (mod & o) || + (mod & g) && gid === myGid || + (mod & u) && uid === myUid || + (mod & ug) && myUid === 0 + + return ret +} diff --git a/node_modules/npm/node_modules/isexe/package.json b/node_modules/npm/node_modules/isexe/package.json new file mode 100644 index 00000000..e4526894 --- /dev/null +++ b/node_modules/npm/node_modules/isexe/package.json @@ -0,0 +1,31 @@ +{ + "name": "isexe", + "version": "2.0.0", + "description": "Minimal module to check if a file is executable.", + "main": "index.js", + "directories": { + "test": "test" + }, + "devDependencies": { + "mkdirp": "^0.5.1", + "rimraf": "^2.5.0", + "tap": "^10.3.0" + }, + "scripts": { + "test": "tap test/*.js --100", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/isexe.git" + }, + "keywords": [], + "bugs": { + "url": "https://github.com/isaacs/isexe/issues" + }, + "homepage": "https://github.com/isaacs/isexe#readme" +} diff --git a/node_modules/npm/node_modules/isexe/test/basic.js b/node_modules/npm/node_modules/isexe/test/basic.js new file mode 100644 index 00000000..d926df64 --- /dev/null +++ b/node_modules/npm/node_modules/isexe/test/basic.js @@ -0,0 +1,221 @@ +var t = require('tap') +var fs = require('fs') +var path = require('path') +var fixture = path.resolve(__dirname, 'fixtures') +var meow = fixture + '/meow.cat' +var mine = fixture + '/mine.cat' +var ours = fixture + '/ours.cat' +var fail = fixture + '/fail.false' +var noent = fixture + '/enoent.exe' +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') + +var isWindows = process.platform === 'win32' +var hasAccess = typeof fs.access === 'function' +var winSkip = isWindows && 'windows' +var accessSkip = !hasAccess && 'no fs.access function' +var hasPromise = typeof Promise === 'function' +var promiseSkip = !hasPromise && 'no global Promise' + +function reset () { + delete require.cache[require.resolve('../')] + return require('../') +} + +t.test('setup fixtures', function (t) { + rimraf.sync(fixture) + mkdirp.sync(fixture) + fs.writeFileSync(meow, '#!/usr/bin/env cat\nmeow\n') + fs.chmodSync(meow, parseInt('0755', 8)) + fs.writeFileSync(fail, '#!/usr/bin/env false\n') + fs.chmodSync(fail, parseInt('0644', 8)) + fs.writeFileSync(mine, '#!/usr/bin/env cat\nmine\n') + fs.chmodSync(mine, parseInt('0744', 8)) + fs.writeFileSync(ours, '#!/usr/bin/env cat\nours\n') + fs.chmodSync(ours, parseInt('0754', 8)) + t.end() +}) + +t.test('promise', { skip: promiseSkip }, function (t) { + var isexe = reset() + t.test('meow async', function (t) { + isexe(meow).then(function (is) { + t.ok(is) + t.end() + }) + }) + t.test('fail async', function (t) { + isexe(fail).then(function (is) { + t.notOk(is) + t.end() + }) + }) + t.test('noent async', function (t) { + isexe(noent).catch(function (er) { + t.ok(er) + t.end() + }) + }) + t.test('noent ignore async', function (t) { + isexe(noent, { ignoreErrors: true }).then(function (is) { + t.notOk(is) + t.end() + }) + }) + t.end() +}) + +t.test('no promise', function (t) { + global.Promise = null + var isexe = reset() + t.throws('try to meow a promise', function () { + isexe(meow) + }) + t.end() +}) + +t.test('access', { skip: accessSkip || winSkip }, function (t) { + runTest(t) +}) + +t.test('mode', { skip: winSkip }, function (t) { + delete fs.access + delete fs.accessSync + var isexe = reset() + t.ok(isexe.sync(ours, { uid: 0, gid: 0 })) + t.ok(isexe.sync(mine, { uid: 0, gid: 0 })) + runTest(t) +}) + +t.test('windows', function (t) { + global.TESTING_WINDOWS = true + var pathExt = '.EXE;.CAT;.CMD;.COM' + t.test('pathExt option', function (t) { + runTest(t, { pathExt: '.EXE;.CAT;.CMD;.COM' }) + }) + t.test('pathExt env', function (t) { + process.env.PATHEXT = pathExt + runTest(t) + }) + t.test('no pathExt', function (t) { + // with a pathExt of '', any filename is fine. + // so the "fail" one would still pass. + runTest(t, { pathExt: '', skipFail: true }) + }) + t.test('pathext with empty entry', function (t) { + // with a pathExt of '', any filename is fine. + // so the "fail" one would still pass. + runTest(t, { pathExt: ';' + pathExt, skipFail: true }) + }) + t.end() +}) + +t.test('cleanup', function (t) { + rimraf.sync(fixture) + t.end() +}) + +function runTest (t, options) { + var isexe = reset() + + var optionsIgnore = Object.create(options || {}) + optionsIgnore.ignoreErrors = true + + if (!options || !options.skipFail) { + t.notOk(isexe.sync(fail, options)) + } + t.notOk(isexe.sync(noent, optionsIgnore)) + if (!options) { + t.ok(isexe.sync(meow)) + } else { + t.ok(isexe.sync(meow, options)) + } + + t.ok(isexe.sync(mine, options)) + t.ok(isexe.sync(ours, options)) + t.throws(function () { + isexe.sync(noent, options) + }) + + t.test('meow async', function (t) { + if (!options) { + isexe(meow, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + } else { + isexe(meow, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + } + }) + + t.test('mine async', function (t) { + isexe(mine, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + }) + + t.test('ours async', function (t) { + isexe(ours, options, function (er, is) { + if (er) { + throw er + } + t.ok(is) + t.end() + }) + }) + + if (!options || !options.skipFail) { + t.test('fail async', function (t) { + isexe(fail, options, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + } + + t.test('noent async', function (t) { + isexe(noent, options, function (er, is) { + t.ok(er) + t.notOk(is) + t.end() + }) + }) + + t.test('noent ignore async', function (t) { + isexe(noent, optionsIgnore, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + + t.test('directory is not executable', function (t) { + isexe(__dirname, options, function (er, is) { + if (er) { + throw er + } + t.notOk(is) + t.end() + }) + }) + + t.end() +} diff --git a/node_modules/npm/node_modules/isexe/windows.js b/node_modules/npm/node_modules/isexe/windows.js new file mode 100644 index 00000000..34996734 --- /dev/null +++ b/node_modules/npm/node_modules/isexe/windows.js @@ -0,0 +1,42 @@ +module.exports = isexe +isexe.sync = sync + +var fs = require('fs') + +function checkPathExt (path, options) { + var pathext = options.pathExt !== undefined ? + options.pathExt : process.env.PATHEXT + + if (!pathext) { + return true + } + + pathext = pathext.split(';') + if (pathext.indexOf('') !== -1) { + return true + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase() + if (p && path.substr(-p.length).toLowerCase() === p) { + return true + } + } + return false +} + +function checkStat (stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false + } + return checkPathExt(path, options) +} + +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, path, options)) + }) +} + +function sync (path, options) { + return checkStat(fs.statSync(path), path, options) +} diff --git a/node_modules/npm/node_modules/jackspeak/LICENSE.md b/node_modules/npm/node_modules/jackspeak/LICENSE.md new file mode 100644 index 00000000..8cb5cc6e --- /dev/null +++ b/node_modules/npm/node_modules/jackspeak/LICENSE.md @@ -0,0 +1,55 @@ +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +**_As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim._** diff --git a/node_modules/npm/node_modules/jackspeak/dist/commonjs/index.js b/node_modules/npm/node_modules/jackspeak/dist/commonjs/index.js new file mode 100644 index 00000000..f7fc9cb6 --- /dev/null +++ b/node_modules/npm/node_modules/jackspeak/dist/commonjs/index.js @@ -0,0 +1,1010 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.jack = exports.Jack = exports.isConfigOption = exports.isConfigType = void 0; +const node_util_1 = require("node:util"); +const parse_args_js_1 = require("./parse-args.js"); +// it's a tiny API, just cast it inline, it's fine +//@ts-ignore +const cliui_1 = __importDefault(require("@isaacs/cliui")); +const node_path_1 = require("node:path"); +const width = Math.min((process && process.stdout && process.stdout.columns) || 80, 80); +// indentation spaces from heading level +const indent = (n) => (n - 1) * 2; +const toEnvKey = (pref, key) => { + return [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')] + .join(' ') + .trim() + .toUpperCase() + .replace(/ /g, '_'); +}; +const toEnvVal = (value, delim = '\n') => { + const str = typeof value === 'string' ? value + : typeof value === 'boolean' ? + value ? '1' + : '0' + : typeof value === 'number' ? String(value) + : Array.isArray(value) ? + value.map((v) => toEnvVal(v)).join(delim) + : /* c8 ignore start */ undefined; + if (typeof str !== 'string') { + throw new Error(`could not serialize value to environment: ${JSON.stringify(value)}`); + } + /* c8 ignore stop */ + return str; +}; +const fromEnvVal = (env, type, multiple, delim = '\n') => (multiple ? + env ? env.split(delim).map(v => fromEnvVal(v, type, false)) + : [] + : type === 'string' ? env + : type === 'boolean' ? env === '1' + : +env.trim()); +const isConfigType = (t) => typeof t === 'string' && + (t === 'string' || t === 'number' || t === 'boolean'); +exports.isConfigType = isConfigType; +const undefOrType = (v, t) => v === undefined || typeof v === t; +const undefOrTypeArray = (v, t) => v === undefined || (Array.isArray(v) && v.every(x => typeof x === t)); +const isValidOption = (v, vo) => Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v); +// print the value type, for error message reporting +const valueType = (v) => typeof v === 'string' ? 'string' + : typeof v === 'boolean' ? 'boolean' + : typeof v === 'number' ? 'number' + : Array.isArray(v) ? + joinTypes([...new Set(v.map(v => valueType(v)))]) + '[]' + : `${v.type}${v.multiple ? '[]' : ''}`; +const joinTypes = (types) => types.length === 1 && typeof types[0] === 'string' ? + types[0] + : `(${types.join('|')})`; +const isValidValue = (v, type, multi) => { + if (multi) { + if (!Array.isArray(v)) + return false; + return !v.some((v) => !isValidValue(v, type, false)); + } + if (Array.isArray(v)) + return false; + return typeof v === type; +}; +const isConfigOption = (o, type, multi) => !!o && + typeof o === 'object' && + (0, exports.isConfigType)(o.type) && + o.type === type && + undefOrType(o.short, 'string') && + undefOrType(o.description, 'string') && + undefOrType(o.hint, 'string') && + undefOrType(o.validate, 'function') && + (o.type === 'boolean' ? + o.validOptions === undefined + : undefOrTypeArray(o.validOptions, o.type)) && + (o.default === undefined || isValidValue(o.default, type, multi)) && + !!o.multiple === multi; +exports.isConfigOption = isConfigOption; +function num(o = {}) { + const { default: def, validate: val, validOptions, ...rest } = o; + if (def !== undefined && !isValidValue(def, 'number', false)) { + throw new TypeError('invalid default value', { + cause: { + found: def, + wanted: 'number', + }, + }); + } + if (!undefOrTypeArray(validOptions, 'number')) { + throw new TypeError('invalid validOptions', { + cause: { + found: validOptions, + wanted: 'number[]', + }, + }); + } + const validate = val ? + val + : undefined; + return { + ...rest, + default: def, + validate, + validOptions, + type: 'number', + multiple: false, + }; +} +function numList(o = {}) { + const { default: def, validate: val, validOptions, ...rest } = o; + if (def !== undefined && !isValidValue(def, 'number', true)) { + throw new TypeError('invalid default value', { + cause: { + found: def, + wanted: 'number[]', + }, + }); + } + if (!undefOrTypeArray(validOptions, 'number')) { + throw new TypeError('invalid validOptions', { + cause: { + found: validOptions, + wanted: 'number[]', + }, + }); + } + const validate = val ? + val + : undefined; + return { + ...rest, + default: def, + validate, + validOptions, + type: 'number', + multiple: true, + }; +} +function opt(o = {}) { + const { default: def, validate: val, validOptions, ...rest } = o; + if (def !== undefined && !isValidValue(def, 'string', false)) { + throw new TypeError('invalid default value', { + cause: { + found: def, + wanted: 'string', + }, + }); + } + if (!undefOrTypeArray(validOptions, 'string')) { + throw new TypeError('invalid validOptions', { + cause: { + found: validOptions, + wanted: 'string[]', + }, + }); + } + const validate = val ? + val + : undefined; + return { + ...rest, + default: def, + validate, + validOptions, + type: 'string', + multiple: false, + }; +} +function optList(o = {}) { + const { default: def, validate: val, validOptions, ...rest } = o; + if (def !== undefined && !isValidValue(def, 'string', true)) { + throw new TypeError('invalid default value', { + cause: { + found: def, + wanted: 'string[]', + }, + }); + } + if (!undefOrTypeArray(validOptions, 'string')) { + throw new TypeError('invalid validOptions', { + cause: { + found: validOptions, + wanted: 'string[]', + }, + }); + } + const validate = val ? + val + : undefined; + return { + ...rest, + default: def, + validate, + validOptions, + type: 'string', + multiple: true, + }; +} +function flag(o = {}) { + const { hint, default: def, validate: val, ...rest } = o; + delete rest.validOptions; + if (def !== undefined && !isValidValue(def, 'boolean', false)) { + throw new TypeError('invalid default value'); + } + const validate = val ? + val + : undefined; + if (hint !== undefined) { + throw new TypeError('cannot provide hint for flag'); + } + return { + ...rest, + default: def, + validate, + type: 'boolean', + multiple: false, + }; +} +function flagList(o = {}) { + const { hint, default: def, validate: val, ...rest } = o; + delete rest.validOptions; + if (def !== undefined && !isValidValue(def, 'boolean', true)) { + throw new TypeError('invalid default value'); + } + const validate = val ? + val + : undefined; + if (hint !== undefined) { + throw new TypeError('cannot provide hint for flag list'); + } + return { + ...rest, + default: def, + validate, + type: 'boolean', + multiple: true, + }; +} +const toParseArgsOptionsConfig = (options) => { + const c = {}; + for (const longOption in options) { + const config = options[longOption]; + /* c8 ignore start */ + if (!config) { + throw new Error('config must be an object: ' + longOption); + } + /* c8 ignore start */ + if ((0, exports.isConfigOption)(config, 'number', true)) { + c[longOption] = { + type: 'string', + multiple: true, + default: config.default?.map(c => String(c)), + }; + } + else if ((0, exports.isConfigOption)(config, 'number', false)) { + c[longOption] = { + type: 'string', + multiple: false, + default: config.default === undefined ? + undefined + : String(config.default), + }; + } + else { + const conf = config; + c[longOption] = { + type: conf.type, + multiple: !!conf.multiple, + default: conf.default, + }; + } + const clo = c[longOption]; + if (typeof config.short === 'string') { + clo.short = config.short; + } + if (config.type === 'boolean' && + !longOption.startsWith('no-') && + !options[`no-${longOption}`]) { + c[`no-${longOption}`] = { + type: 'boolean', + multiple: config.multiple, + }; + } + } + return c; +}; +const isHeading = (r) => r.type === 'heading'; +const isDescription = (r) => r.type === 'description'; +/** + * Class returned by the {@link jack} function and all configuration + * definition methods. This is what gets chained together. + */ +class Jack { + #configSet; + #shorts; + #options; + #fields = []; + #env; + #envPrefix; + #allowPositionals; + #usage; + #usageMarkdown; + constructor(options = {}) { + this.#options = options; + this.#allowPositionals = options.allowPositionals !== false; + this.#env = + this.#options.env === undefined ? process.env : this.#options.env; + this.#envPrefix = options.envPrefix; + // We need to fib a little, because it's always the same object, but it + // starts out as having an empty config set. Then each method that adds + // fields returns `this as Jack` + this.#configSet = Object.create(null); + this.#shorts = Object.create(null); + } + /** + * Set the default value (which will still be overridden by env or cli) + * as if from a parsed config file. The optional `source` param, if + * provided, will be included in error messages if a value is invalid or + * unknown. + */ + setConfigValues(values, source = '') { + try { + this.validate(values); + } + catch (er) { + const e = er; + if (source && e && typeof e === 'object') { + if (e.cause && typeof e.cause === 'object') { + Object.assign(e.cause, { path: source }); + } + else { + e.cause = { path: source }; + } + } + throw e; + } + for (const [field, value] of Object.entries(values)) { + const my = this.#configSet[field]; + // already validated, just for TS's benefit + /* c8 ignore start */ + if (!my) { + throw new Error('unexpected field in config set: ' + field, { + cause: { found: field }, + }); + } + /* c8 ignore stop */ + my.default = value; + } + return this; + } + /** + * Parse a string of arguments, and return the resulting + * `{ values, positionals }` object. + * + * If an {@link JackOptions#envPrefix} is set, then it will read default + * values from the environment, and write the resulting values back + * to the environment as well. + * + * Environment values always take precedence over any other value, except + * an explicit CLI setting. + */ + parse(args = process.argv) { + this.loadEnvDefaults(); + const p = this.parseRaw(args); + this.applyDefaults(p); + this.writeEnv(p); + return p; + } + loadEnvDefaults() { + if (this.#envPrefix) { + for (const [field, my] of Object.entries(this.#configSet)) { + const ek = toEnvKey(this.#envPrefix, field); + const env = this.#env[ek]; + if (env !== undefined) { + my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim); + } + } + } + } + applyDefaults(p) { + for (const [field, c] of Object.entries(this.#configSet)) { + if (c.default !== undefined && !(field in p.values)) { + //@ts-ignore + p.values[field] = c.default; + } + } + } + /** + * Only parse the command line arguments passed in. + * Does not strip off the `node script.js` bits, so it must be just the + * arguments you wish to have parsed. + * Does not read from or write to the environment, or set defaults. + */ + parseRaw(args) { + if (args === process.argv) { + args = args.slice(process._eval !== undefined ? 1 : 2); + } + const options = toParseArgsOptionsConfig(this.#configSet); + const result = (0, parse_args_js_1.parseArgs)({ + args, + options, + // always strict, but using our own logic + strict: false, + allowPositionals: this.#allowPositionals, + tokens: true, + }); + const p = { + values: {}, + positionals: [], + }; + for (const token of result.tokens) { + if (token.kind === 'positional') { + p.positionals.push(token.value); + if (this.#options.stopAtPositional || + this.#options.stopAtPositionalTest?.(token.value)) { + p.positionals.push(...args.slice(token.index + 1)); + break; + } + } + else if (token.kind === 'option') { + let value = undefined; + if (token.name.startsWith('no-')) { + const my = this.#configSet[token.name]; + const pname = token.name.substring('no-'.length); + const pos = this.#configSet[pname]; + if (pos && + pos.type === 'boolean' && + (!my || + (my.type === 'boolean' && !!my.multiple === !!pos.multiple))) { + value = false; + token.name = pname; + } + } + const my = this.#configSet[token.name]; + if (!my) { + throw new Error(`Unknown option '${token.rawName}'. ` + + `To specify a positional argument starting with a '-', ` + + `place it at the end of the command after '--', as in ` + + `'-- ${token.rawName}'`, { + cause: { + found: token.rawName + (token.value ? `=${token.value}` : ''), + }, + }); + } + if (value === undefined) { + if (token.value === undefined) { + if (my.type !== 'boolean') { + throw new Error(`No value provided for ${token.rawName}, expected ${my.type}`, { + cause: { + name: token.rawName, + wanted: valueType(my), + }, + }); + } + value = true; + } + else { + if (my.type === 'boolean') { + throw new Error(`Flag ${token.rawName} does not take a value, received '${token.value}'`, { cause: { found: token } }); + } + if (my.type === 'string') { + value = token.value; + } + else { + value = +token.value; + if (value !== value) { + throw new Error(`Invalid value '${token.value}' provided for ` + + `'${token.rawName}' option, expected number`, { + cause: { + name: token.rawName, + found: token.value, + wanted: 'number', + }, + }); + } + } + } + } + if (my.multiple) { + const pv = p.values; + const tn = pv[token.name] ?? []; + pv[token.name] = tn; + tn.push(value); + } + else { + const pv = p.values; + pv[token.name] = value; + } + } + } + for (const [field, value] of Object.entries(p.values)) { + const valid = this.#configSet[field]?.validate; + const validOptions = this.#configSet[field]?.validOptions; + let cause; + if (validOptions && !isValidOption(value, validOptions)) { + cause = { name: field, found: value, validOptions: validOptions }; + } + if (valid && !valid(value)) { + cause = cause || { name: field, found: value }; + } + if (cause) { + throw new Error(`Invalid value provided for --${field}: ${JSON.stringify(value)}`, { cause }); + } + } + return p; + } + /** + * do not set fields as 'no-foo' if 'foo' exists and both are bools + * just set foo. + */ + #noNoFields(f, val, s = f) { + if (!f.startsWith('no-') || typeof val !== 'boolean') + return; + const yes = f.substring('no-'.length); + // recurse so we get the core config key we care about. + this.#noNoFields(yes, val, s); + if (this.#configSet[yes]?.type === 'boolean') { + throw new Error(`do not set '${s}', instead set '${yes}' as desired.`, { cause: { found: s, wanted: yes } }); + } + } + /** + * Validate that any arbitrary object is a valid configuration `values` + * object. Useful when loading config files or other sources. + */ + validate(o) { + if (!o || typeof o !== 'object') { + throw new Error('Invalid config: not an object', { + cause: { found: o }, + }); + } + const opts = o; + for (const field in o) { + const value = opts[field]; + /* c8 ignore next - for TS */ + if (value === undefined) + continue; + this.#noNoFields(field, value); + const config = this.#configSet[field]; + if (!config) { + throw new Error(`Unknown config option: ${field}`, { + cause: { found: field }, + }); + } + if (!isValidValue(value, config.type, !!config.multiple)) { + throw new Error(`Invalid value ${valueType(value)} for ${field}, expected ${valueType(config)}`, { + cause: { + name: field, + found: value, + wanted: valueType(config), + }, + }); + } + let cause; + if (config.validOptions && + !isValidOption(value, config.validOptions)) { + cause = { + name: field, + found: value, + validOptions: config.validOptions, + }; + } + if (config.validate && !config.validate(value)) { + cause = cause || { name: field, found: value }; + } + if (cause) { + throw new Error(`Invalid config value for ${field}: ${value}`, { + cause, + }); + } + } + } + writeEnv(p) { + if (!this.#env || !this.#envPrefix) + return; + for (const [field, value] of Object.entries(p.values)) { + const my = this.#configSet[field]; + this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my?.delim); + } + } + /** + * Add a heading to the usage output banner + */ + heading(text, level, { pre = false } = {}) { + if (level === undefined) { + level = this.#fields.some(r => isHeading(r)) ? 2 : 1; + } + this.#fields.push({ type: 'heading', text, level, pre }); + return this; + } + /** + * Add a long-form description to the usage output at this position. + */ + description(text, { pre } = {}) { + this.#fields.push({ type: 'description', text, pre }); + return this; + } + /** + * Add one or more number fields. + */ + num(fields) { + return this.#addFields(fields, num); + } + /** + * Add one or more multiple number fields. + */ + numList(fields) { + return this.#addFields(fields, numList); + } + /** + * Add one or more string option fields. + */ + opt(fields) { + return this.#addFields(fields, opt); + } + /** + * Add one or more multiple string option fields. + */ + optList(fields) { + return this.#addFields(fields, optList); + } + /** + * Add one or more flag fields. + */ + flag(fields) { + return this.#addFields(fields, flag); + } + /** + * Add one or more multiple flag fields. + */ + flagList(fields) { + return this.#addFields(fields, flagList); + } + /** + * Generic field definition method. Similar to flag/flagList/number/etc, + * but you must specify the `type` (and optionally `multiple` and `delim`) + * fields on each one, or Jack won't know how to define them. + */ + addFields(fields) { + const next = this; + for (const [name, field] of Object.entries(fields)) { + this.#validateName(name, field); + next.#fields.push({ + type: 'config', + name, + value: field, + }); + } + Object.assign(next.#configSet, fields); + return next; + } + #addFields(fields, fn) { + const next = this; + Object.assign(next.#configSet, Object.fromEntries(Object.entries(fields).map(([name, field]) => { + this.#validateName(name, field); + const option = fn(field); + next.#fields.push({ + type: 'config', + name, + value: option, + }); + return [name, option]; + }))); + return next; + } + #validateName(name, field) { + if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) { + throw new TypeError(`Invalid option name: ${name}, ` + + `must be '-' delimited ASCII alphanumeric`); + } + if (this.#configSet[name]) { + throw new TypeError(`Cannot redefine option ${field}`); + } + if (this.#shorts[name]) { + throw new TypeError(`Cannot redefine option ${name}, already ` + + `in use for ${this.#shorts[name]}`); + } + if (field.short) { + if (!/^[a-zA-Z0-9]$/.test(field.short)) { + throw new TypeError(`Invalid ${name} short option: ${field.short}, ` + + 'must be 1 ASCII alphanumeric character'); + } + if (this.#shorts[field.short]) { + throw new TypeError(`Invalid ${name} short option: ${field.short}, ` + + `already in use for ${this.#shorts[field.short]}`); + } + this.#shorts[field.short] = name; + this.#shorts[name] = name; + } + } + /** + * Return the usage banner for the given configuration + */ + usage() { + if (this.#usage) + return this.#usage; + let headingLevel = 1; + const ui = (0, cliui_1.default)({ width }); + const first = this.#fields[0]; + let start = first?.type === 'heading' ? 1 : 0; + if (first?.type === 'heading') { + ui.div({ + padding: [0, 0, 0, 0], + text: normalize(first.text), + }); + } + ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' }); + if (this.#options.usage) { + ui.div({ + text: this.#options.usage, + padding: [0, 0, 0, 2], + }); + } + else { + const cmd = (0, node_path_1.basename)(String(process.argv[1])); + const shortFlags = []; + const shorts = []; + const flags = []; + const opts = []; + for (const [field, config] of Object.entries(this.#configSet)) { + if (config.short) { + if (config.type === 'boolean') + shortFlags.push(config.short); + else + shorts.push([config.short, config.hint || field]); + } + else { + if (config.type === 'boolean') + flags.push(field); + else + opts.push([field, config.hint || field]); + } + } + const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''; + const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const lf = flags.map(k => ` --${k}`).join(''); + const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const usage = `${cmd}${sf}${so}${lf}${lo}`.trim(); + ui.div({ + text: usage, + padding: [0, 0, 0, 2], + }); + } + ui.div({ padding: [0, 0, 0, 0], text: '' }); + const maybeDesc = this.#fields[start]; + if (maybeDesc && isDescription(maybeDesc)) { + const print = normalize(maybeDesc.text, maybeDesc.pre); + start++; + ui.div({ padding: [0, 0, 0, 0], text: print }); + ui.div({ padding: [0, 0, 0, 0], text: '' }); + } + const { rows, maxWidth } = this.#usageRows(start); + // every heading/description after the first gets indented by 2 + // extra spaces. + for (const row of rows) { + if (row.left) { + // If the row is too long, don't wrap it + // Bump the right-hand side down a line to make room + const configIndent = indent(Math.max(headingLevel, 2)); + if (row.left.length > maxWidth - 3) { + ui.div({ text: row.left, padding: [0, 0, 0, configIndent] }); + ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] }); + } + else { + ui.div({ + text: row.left, + padding: [0, 1, 0, configIndent], + width: maxWidth, + }, { padding: [0, 0, 0, 0], text: row.text }); + } + if (row.skipLine) { + ui.div({ padding: [0, 0, 0, 0], text: '' }); + } + } + else { + if (isHeading(row)) { + const { level } = row; + headingLevel = level; + // only h1 and h2 have bottom padding + // h3-h6 do not + const b = level <= 2 ? 1 : 0; + ui.div({ ...row, padding: [0, 0, b, indent(level)] }); + } + else { + ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] }); + } + } + } + return (this.#usage = ui.toString()); + } + /** + * Return the usage banner markdown for the given configuration + */ + usageMarkdown() { + if (this.#usageMarkdown) + return this.#usageMarkdown; + const out = []; + let headingLevel = 1; + const first = this.#fields[0]; + let start = first?.type === 'heading' ? 1 : 0; + if (first?.type === 'heading') { + out.push(`# ${normalizeOneLine(first.text)}`); + } + out.push('Usage:'); + if (this.#options.usage) { + out.push(normalizeMarkdown(this.#options.usage, true)); + } + else { + const cmd = (0, node_path_1.basename)(String(process.argv[1])); + const shortFlags = []; + const shorts = []; + const flags = []; + const opts = []; + for (const [field, config] of Object.entries(this.#configSet)) { + if (config.short) { + if (config.type === 'boolean') + shortFlags.push(config.short); + else + shorts.push([config.short, config.hint || field]); + } + else { + if (config.type === 'boolean') + flags.push(field); + else + opts.push([field, config.hint || field]); + } + } + const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''; + const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const lf = flags.map(k => ` --${k}`).join(''); + const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const usage = `${cmd}${sf}${so}${lf}${lo}`.trim(); + out.push(normalizeMarkdown(usage, true)); + } + const maybeDesc = this.#fields[start]; + if (maybeDesc && isDescription(maybeDesc)) { + out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre)); + start++; + } + const { rows } = this.#usageRows(start); + // heading level in markdown is number of # ahead of text + for (const row of rows) { + if (row.left) { + out.push('#'.repeat(headingLevel + 1) + + ' ' + + normalizeOneLine(row.left, true)); + if (row.text) + out.push(normalizeMarkdown(row.text)); + } + else if (isHeading(row)) { + const { level } = row; + headingLevel = level; + out.push(`${'#'.repeat(headingLevel)} ${normalizeOneLine(row.text, row.pre)}`); + } + else { + out.push(normalizeMarkdown(row.text, !!row.pre)); + } + } + return (this.#usageMarkdown = out.join('\n\n') + '\n'); + } + #usageRows(start) { + // turn each config type into a row, and figure out the width of the + // left hand indentation for the option descriptions. + let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3))); + let maxWidth = 8; + let prev = undefined; + const rows = []; + for (const field of this.#fields.slice(start)) { + if (field.type !== 'config') { + if (prev?.type === 'config') + prev.skipLine = true; + prev = undefined; + field.text = normalize(field.text, !!field.pre); + rows.push(field); + continue; + } + const { value } = field; + const desc = value.description || ''; + const mult = value.multiple ? 'Can be set multiple times' : ''; + const opts = value.validOptions?.length ? + `Valid options:${value.validOptions.map(v => ` ${JSON.stringify(v)}`)}` + : ''; + const dmDelim = desc.includes('\n') ? '\n\n' : '\n'; + const extra = [opts, mult].join(dmDelim).trim(); + const text = (normalize(desc) + dmDelim + extra).trim(); + const hint = value.hint || + (value.type === 'number' ? 'n' + : value.type === 'string' ? field.name + : undefined); + const short = !value.short ? '' + : value.type === 'boolean' ? `-${value.short} ` + : `-${value.short}<${hint}> `; + const left = value.type === 'boolean' ? + `${short}--${field.name}` + : `${short}--${field.name}=<${hint}>`; + const row = { text, left, type: 'config' }; + if (text.length > width - maxMax) { + row.skipLine = true; + } + if (prev && left.length > maxMax) + prev.skipLine = true; + prev = row; + const len = left.length + 4; + if (len > maxWidth && len < maxMax) { + maxWidth = len; + } + rows.push(row); + } + return { rows, maxWidth }; + } + /** + * Return the configuration options as a plain object + */ + toJSON() { + return Object.fromEntries(Object.entries(this.#configSet).map(([field, def]) => [ + field, + { + type: def.type, + ...(def.multiple ? { multiple: true } : {}), + ...(def.delim ? { delim: def.delim } : {}), + ...(def.short ? { short: def.short } : {}), + ...(def.description ? + { description: normalize(def.description) } + : {}), + ...(def.validate ? { validate: def.validate } : {}), + ...(def.validOptions ? { validOptions: def.validOptions } : {}), + ...(def.default !== undefined ? { default: def.default } : {}), + ...(def.hint ? { hint: def.hint } : {}), + }, + ])); + } + /** + * Custom printer for `util.inspect` + */ + [node_util_1.inspect.custom](_, options) { + return `Jack ${(0, node_util_1.inspect)(this.toJSON(), options)}`; + } +} +exports.Jack = Jack; +// Unwrap and un-indent, so we can wrap description +// strings however makes them look nice in the code. +const normalize = (s, pre = false) => { + if (pre) + // prepend a ZWSP to each line so cliui doesn't strip it. + return s + .split('\n') + .map(l => `\u200b${l}`) + .join('\n'); + return s + .split(/^\s*```\s*$/gm) + .map((s, i) => { + if (i % 2 === 1) { + if (!s.trim()) { + return `\`\`\`\n\`\`\`\n`; + } + // outdent the ``` blocks, but preserve whitespace otherwise. + const split = s.split('\n'); + // throw out the \n at the start and end + split.pop(); + split.shift(); + const si = split.reduce((shortest, l) => { + /* c8 ignore next */ + const ind = l.match(/^\s*/)?.[0] ?? ''; + if (ind.length) + return Math.min(ind.length, shortest); + else + return shortest; + }, Infinity); + /* c8 ignore next */ + const i = isFinite(si) ? si : 0; + return ('\n```\n' + + split.map(s => `\u200b${s.substring(i)}`).join('\n') + + '\n```\n'); + } + return (s + // remove single line breaks, except for lists + .replace(/([^\n])\n[ \t]*([^\n])/g, (_, $1, $2) => !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\n${$2}`) + // normalize mid-line whitespace + .replace(/([^\n])[ \t]+([^\n])/g, '$1 $2') + // two line breaks are enough + .replace(/\n{3,}/g, '\n\n') + // remove any spaces at the start of a line + .replace(/\n[ \t]+/g, '\n') + .trim()); + }) + .join('\n'); +}; +// normalize for markdown printing, remove leading spaces on lines +const normalizeMarkdown = (s, pre = false) => { + const n = normalize(s, pre).replace(/\\/g, '\\\\'); + return pre ? + `\`\`\`\n${n.replace(/\u200b/g, '')}\n\`\`\`` + : n.replace(/\n +/g, '\n').trim(); +}; +const normalizeOneLine = (s, pre = false) => { + const n = normalize(s, pre) + .replace(/[\s\u200b]+/g, ' ') + .trim(); + return pre ? `\`${n}\`` : n; +}; +/** + * Main entry point. Create and return a {@link Jack} object. + */ +const jack = (options = {}) => new Jack(options); +exports.jack = jack; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/jackspeak/dist/commonjs/package.json b/node_modules/npm/node_modules/jackspeak/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/jackspeak/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/jackspeak/dist/commonjs/parse-args.js b/node_modules/npm/node_modules/jackspeak/dist/commonjs/parse-args.js new file mode 100644 index 00000000..fc918a41 --- /dev/null +++ b/node_modules/npm/node_modules/jackspeak/dist/commonjs/parse-args.js @@ -0,0 +1,50 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseArgs = void 0; +const util = __importStar(require("util")); +const pv = (typeof process === 'object' && + !!process && + typeof process.version === 'string') ? + process.version + : 'v0.0.0'; +const pvs = pv + .replace(/^v/, '') + .split('.') + .map(s => parseInt(s, 10)); +/* c8 ignore start */ +const [major = 0, minor = 0] = pvs; +/* c8 ignore stop */ +let { parseArgs: pa } = util; +/* c8 ignore start */ +if (!pa || + major < 16 || + (major === 18 && minor < 11) || + (major === 16 && minor < 19)) { + /* c8 ignore stop */ + pa = require('@pkgjs/parseargs').parseArgs; +} +exports.parseArgs = pa; +//# sourceMappingURL=parse-args-cjs.cjs.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/jackspeak/dist/esm/index.js b/node_modules/npm/node_modules/jackspeak/dist/esm/index.js new file mode 100644 index 00000000..78fdfa81 --- /dev/null +++ b/node_modules/npm/node_modules/jackspeak/dist/esm/index.js @@ -0,0 +1,1000 @@ +import { inspect } from 'node:util'; +import { parseArgs } from './parse-args.js'; +// it's a tiny API, just cast it inline, it's fine +//@ts-ignore +import cliui from '@isaacs/cliui'; +import { basename } from 'node:path'; +const width = Math.min((process && process.stdout && process.stdout.columns) || 80, 80); +// indentation spaces from heading level +const indent = (n) => (n - 1) * 2; +const toEnvKey = (pref, key) => { + return [pref, key.replace(/[^a-zA-Z0-9]+/g, ' ')] + .join(' ') + .trim() + .toUpperCase() + .replace(/ /g, '_'); +}; +const toEnvVal = (value, delim = '\n') => { + const str = typeof value === 'string' ? value + : typeof value === 'boolean' ? + value ? '1' + : '0' + : typeof value === 'number' ? String(value) + : Array.isArray(value) ? + value.map((v) => toEnvVal(v)).join(delim) + : /* c8 ignore start */ undefined; + if (typeof str !== 'string') { + throw new Error(`could not serialize value to environment: ${JSON.stringify(value)}`); + } + /* c8 ignore stop */ + return str; +}; +const fromEnvVal = (env, type, multiple, delim = '\n') => (multiple ? + env ? env.split(delim).map(v => fromEnvVal(v, type, false)) + : [] + : type === 'string' ? env + : type === 'boolean' ? env === '1' + : +env.trim()); +export const isConfigType = (t) => typeof t === 'string' && + (t === 'string' || t === 'number' || t === 'boolean'); +const undefOrType = (v, t) => v === undefined || typeof v === t; +const undefOrTypeArray = (v, t) => v === undefined || (Array.isArray(v) && v.every(x => typeof x === t)); +const isValidOption = (v, vo) => Array.isArray(v) ? v.every(x => isValidOption(x, vo)) : vo.includes(v); +// print the value type, for error message reporting +const valueType = (v) => typeof v === 'string' ? 'string' + : typeof v === 'boolean' ? 'boolean' + : typeof v === 'number' ? 'number' + : Array.isArray(v) ? + joinTypes([...new Set(v.map(v => valueType(v)))]) + '[]' + : `${v.type}${v.multiple ? '[]' : ''}`; +const joinTypes = (types) => types.length === 1 && typeof types[0] === 'string' ? + types[0] + : `(${types.join('|')})`; +const isValidValue = (v, type, multi) => { + if (multi) { + if (!Array.isArray(v)) + return false; + return !v.some((v) => !isValidValue(v, type, false)); + } + if (Array.isArray(v)) + return false; + return typeof v === type; +}; +export const isConfigOption = (o, type, multi) => !!o && + typeof o === 'object' && + isConfigType(o.type) && + o.type === type && + undefOrType(o.short, 'string') && + undefOrType(o.description, 'string') && + undefOrType(o.hint, 'string') && + undefOrType(o.validate, 'function') && + (o.type === 'boolean' ? + o.validOptions === undefined + : undefOrTypeArray(o.validOptions, o.type)) && + (o.default === undefined || isValidValue(o.default, type, multi)) && + !!o.multiple === multi; +function num(o = {}) { + const { default: def, validate: val, validOptions, ...rest } = o; + if (def !== undefined && !isValidValue(def, 'number', false)) { + throw new TypeError('invalid default value', { + cause: { + found: def, + wanted: 'number', + }, + }); + } + if (!undefOrTypeArray(validOptions, 'number')) { + throw new TypeError('invalid validOptions', { + cause: { + found: validOptions, + wanted: 'number[]', + }, + }); + } + const validate = val ? + val + : undefined; + return { + ...rest, + default: def, + validate, + validOptions, + type: 'number', + multiple: false, + }; +} +function numList(o = {}) { + const { default: def, validate: val, validOptions, ...rest } = o; + if (def !== undefined && !isValidValue(def, 'number', true)) { + throw new TypeError('invalid default value', { + cause: { + found: def, + wanted: 'number[]', + }, + }); + } + if (!undefOrTypeArray(validOptions, 'number')) { + throw new TypeError('invalid validOptions', { + cause: { + found: validOptions, + wanted: 'number[]', + }, + }); + } + const validate = val ? + val + : undefined; + return { + ...rest, + default: def, + validate, + validOptions, + type: 'number', + multiple: true, + }; +} +function opt(o = {}) { + const { default: def, validate: val, validOptions, ...rest } = o; + if (def !== undefined && !isValidValue(def, 'string', false)) { + throw new TypeError('invalid default value', { + cause: { + found: def, + wanted: 'string', + }, + }); + } + if (!undefOrTypeArray(validOptions, 'string')) { + throw new TypeError('invalid validOptions', { + cause: { + found: validOptions, + wanted: 'string[]', + }, + }); + } + const validate = val ? + val + : undefined; + return { + ...rest, + default: def, + validate, + validOptions, + type: 'string', + multiple: false, + }; +} +function optList(o = {}) { + const { default: def, validate: val, validOptions, ...rest } = o; + if (def !== undefined && !isValidValue(def, 'string', true)) { + throw new TypeError('invalid default value', { + cause: { + found: def, + wanted: 'string[]', + }, + }); + } + if (!undefOrTypeArray(validOptions, 'string')) { + throw new TypeError('invalid validOptions', { + cause: { + found: validOptions, + wanted: 'string[]', + }, + }); + } + const validate = val ? + val + : undefined; + return { + ...rest, + default: def, + validate, + validOptions, + type: 'string', + multiple: true, + }; +} +function flag(o = {}) { + const { hint, default: def, validate: val, ...rest } = o; + delete rest.validOptions; + if (def !== undefined && !isValidValue(def, 'boolean', false)) { + throw new TypeError('invalid default value'); + } + const validate = val ? + val + : undefined; + if (hint !== undefined) { + throw new TypeError('cannot provide hint for flag'); + } + return { + ...rest, + default: def, + validate, + type: 'boolean', + multiple: false, + }; +} +function flagList(o = {}) { + const { hint, default: def, validate: val, ...rest } = o; + delete rest.validOptions; + if (def !== undefined && !isValidValue(def, 'boolean', true)) { + throw new TypeError('invalid default value'); + } + const validate = val ? + val + : undefined; + if (hint !== undefined) { + throw new TypeError('cannot provide hint for flag list'); + } + return { + ...rest, + default: def, + validate, + type: 'boolean', + multiple: true, + }; +} +const toParseArgsOptionsConfig = (options) => { + const c = {}; + for (const longOption in options) { + const config = options[longOption]; + /* c8 ignore start */ + if (!config) { + throw new Error('config must be an object: ' + longOption); + } + /* c8 ignore start */ + if (isConfigOption(config, 'number', true)) { + c[longOption] = { + type: 'string', + multiple: true, + default: config.default?.map(c => String(c)), + }; + } + else if (isConfigOption(config, 'number', false)) { + c[longOption] = { + type: 'string', + multiple: false, + default: config.default === undefined ? + undefined + : String(config.default), + }; + } + else { + const conf = config; + c[longOption] = { + type: conf.type, + multiple: !!conf.multiple, + default: conf.default, + }; + } + const clo = c[longOption]; + if (typeof config.short === 'string') { + clo.short = config.short; + } + if (config.type === 'boolean' && + !longOption.startsWith('no-') && + !options[`no-${longOption}`]) { + c[`no-${longOption}`] = { + type: 'boolean', + multiple: config.multiple, + }; + } + } + return c; +}; +const isHeading = (r) => r.type === 'heading'; +const isDescription = (r) => r.type === 'description'; +/** + * Class returned by the {@link jack} function and all configuration + * definition methods. This is what gets chained together. + */ +export class Jack { + #configSet; + #shorts; + #options; + #fields = []; + #env; + #envPrefix; + #allowPositionals; + #usage; + #usageMarkdown; + constructor(options = {}) { + this.#options = options; + this.#allowPositionals = options.allowPositionals !== false; + this.#env = + this.#options.env === undefined ? process.env : this.#options.env; + this.#envPrefix = options.envPrefix; + // We need to fib a little, because it's always the same object, but it + // starts out as having an empty config set. Then each method that adds + // fields returns `this as Jack` + this.#configSet = Object.create(null); + this.#shorts = Object.create(null); + } + /** + * Set the default value (which will still be overridden by env or cli) + * as if from a parsed config file. The optional `source` param, if + * provided, will be included in error messages if a value is invalid or + * unknown. + */ + setConfigValues(values, source = '') { + try { + this.validate(values); + } + catch (er) { + const e = er; + if (source && e && typeof e === 'object') { + if (e.cause && typeof e.cause === 'object') { + Object.assign(e.cause, { path: source }); + } + else { + e.cause = { path: source }; + } + } + throw e; + } + for (const [field, value] of Object.entries(values)) { + const my = this.#configSet[field]; + // already validated, just for TS's benefit + /* c8 ignore start */ + if (!my) { + throw new Error('unexpected field in config set: ' + field, { + cause: { found: field }, + }); + } + /* c8 ignore stop */ + my.default = value; + } + return this; + } + /** + * Parse a string of arguments, and return the resulting + * `{ values, positionals }` object. + * + * If an {@link JackOptions#envPrefix} is set, then it will read default + * values from the environment, and write the resulting values back + * to the environment as well. + * + * Environment values always take precedence over any other value, except + * an explicit CLI setting. + */ + parse(args = process.argv) { + this.loadEnvDefaults(); + const p = this.parseRaw(args); + this.applyDefaults(p); + this.writeEnv(p); + return p; + } + loadEnvDefaults() { + if (this.#envPrefix) { + for (const [field, my] of Object.entries(this.#configSet)) { + const ek = toEnvKey(this.#envPrefix, field); + const env = this.#env[ek]; + if (env !== undefined) { + my.default = fromEnvVal(env, my.type, !!my.multiple, my.delim); + } + } + } + } + applyDefaults(p) { + for (const [field, c] of Object.entries(this.#configSet)) { + if (c.default !== undefined && !(field in p.values)) { + //@ts-ignore + p.values[field] = c.default; + } + } + } + /** + * Only parse the command line arguments passed in. + * Does not strip off the `node script.js` bits, so it must be just the + * arguments you wish to have parsed. + * Does not read from or write to the environment, or set defaults. + */ + parseRaw(args) { + if (args === process.argv) { + args = args.slice(process._eval !== undefined ? 1 : 2); + } + const options = toParseArgsOptionsConfig(this.#configSet); + const result = parseArgs({ + args, + options, + // always strict, but using our own logic + strict: false, + allowPositionals: this.#allowPositionals, + tokens: true, + }); + const p = { + values: {}, + positionals: [], + }; + for (const token of result.tokens) { + if (token.kind === 'positional') { + p.positionals.push(token.value); + if (this.#options.stopAtPositional || + this.#options.stopAtPositionalTest?.(token.value)) { + p.positionals.push(...args.slice(token.index + 1)); + break; + } + } + else if (token.kind === 'option') { + let value = undefined; + if (token.name.startsWith('no-')) { + const my = this.#configSet[token.name]; + const pname = token.name.substring('no-'.length); + const pos = this.#configSet[pname]; + if (pos && + pos.type === 'boolean' && + (!my || + (my.type === 'boolean' && !!my.multiple === !!pos.multiple))) { + value = false; + token.name = pname; + } + } + const my = this.#configSet[token.name]; + if (!my) { + throw new Error(`Unknown option '${token.rawName}'. ` + + `To specify a positional argument starting with a '-', ` + + `place it at the end of the command after '--', as in ` + + `'-- ${token.rawName}'`, { + cause: { + found: token.rawName + (token.value ? `=${token.value}` : ''), + }, + }); + } + if (value === undefined) { + if (token.value === undefined) { + if (my.type !== 'boolean') { + throw new Error(`No value provided for ${token.rawName}, expected ${my.type}`, { + cause: { + name: token.rawName, + wanted: valueType(my), + }, + }); + } + value = true; + } + else { + if (my.type === 'boolean') { + throw new Error(`Flag ${token.rawName} does not take a value, received '${token.value}'`, { cause: { found: token } }); + } + if (my.type === 'string') { + value = token.value; + } + else { + value = +token.value; + if (value !== value) { + throw new Error(`Invalid value '${token.value}' provided for ` + + `'${token.rawName}' option, expected number`, { + cause: { + name: token.rawName, + found: token.value, + wanted: 'number', + }, + }); + } + } + } + } + if (my.multiple) { + const pv = p.values; + const tn = pv[token.name] ?? []; + pv[token.name] = tn; + tn.push(value); + } + else { + const pv = p.values; + pv[token.name] = value; + } + } + } + for (const [field, value] of Object.entries(p.values)) { + const valid = this.#configSet[field]?.validate; + const validOptions = this.#configSet[field]?.validOptions; + let cause; + if (validOptions && !isValidOption(value, validOptions)) { + cause = { name: field, found: value, validOptions: validOptions }; + } + if (valid && !valid(value)) { + cause = cause || { name: field, found: value }; + } + if (cause) { + throw new Error(`Invalid value provided for --${field}: ${JSON.stringify(value)}`, { cause }); + } + } + return p; + } + /** + * do not set fields as 'no-foo' if 'foo' exists and both are bools + * just set foo. + */ + #noNoFields(f, val, s = f) { + if (!f.startsWith('no-') || typeof val !== 'boolean') + return; + const yes = f.substring('no-'.length); + // recurse so we get the core config key we care about. + this.#noNoFields(yes, val, s); + if (this.#configSet[yes]?.type === 'boolean') { + throw new Error(`do not set '${s}', instead set '${yes}' as desired.`, { cause: { found: s, wanted: yes } }); + } + } + /** + * Validate that any arbitrary object is a valid configuration `values` + * object. Useful when loading config files or other sources. + */ + validate(o) { + if (!o || typeof o !== 'object') { + throw new Error('Invalid config: not an object', { + cause: { found: o }, + }); + } + const opts = o; + for (const field in o) { + const value = opts[field]; + /* c8 ignore next - for TS */ + if (value === undefined) + continue; + this.#noNoFields(field, value); + const config = this.#configSet[field]; + if (!config) { + throw new Error(`Unknown config option: ${field}`, { + cause: { found: field }, + }); + } + if (!isValidValue(value, config.type, !!config.multiple)) { + throw new Error(`Invalid value ${valueType(value)} for ${field}, expected ${valueType(config)}`, { + cause: { + name: field, + found: value, + wanted: valueType(config), + }, + }); + } + let cause; + if (config.validOptions && + !isValidOption(value, config.validOptions)) { + cause = { + name: field, + found: value, + validOptions: config.validOptions, + }; + } + if (config.validate && !config.validate(value)) { + cause = cause || { name: field, found: value }; + } + if (cause) { + throw new Error(`Invalid config value for ${field}: ${value}`, { + cause, + }); + } + } + } + writeEnv(p) { + if (!this.#env || !this.#envPrefix) + return; + for (const [field, value] of Object.entries(p.values)) { + const my = this.#configSet[field]; + this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my?.delim); + } + } + /** + * Add a heading to the usage output banner + */ + heading(text, level, { pre = false } = {}) { + if (level === undefined) { + level = this.#fields.some(r => isHeading(r)) ? 2 : 1; + } + this.#fields.push({ type: 'heading', text, level, pre }); + return this; + } + /** + * Add a long-form description to the usage output at this position. + */ + description(text, { pre } = {}) { + this.#fields.push({ type: 'description', text, pre }); + return this; + } + /** + * Add one or more number fields. + */ + num(fields) { + return this.#addFields(fields, num); + } + /** + * Add one or more multiple number fields. + */ + numList(fields) { + return this.#addFields(fields, numList); + } + /** + * Add one or more string option fields. + */ + opt(fields) { + return this.#addFields(fields, opt); + } + /** + * Add one or more multiple string option fields. + */ + optList(fields) { + return this.#addFields(fields, optList); + } + /** + * Add one or more flag fields. + */ + flag(fields) { + return this.#addFields(fields, flag); + } + /** + * Add one or more multiple flag fields. + */ + flagList(fields) { + return this.#addFields(fields, flagList); + } + /** + * Generic field definition method. Similar to flag/flagList/number/etc, + * but you must specify the `type` (and optionally `multiple` and `delim`) + * fields on each one, or Jack won't know how to define them. + */ + addFields(fields) { + const next = this; + for (const [name, field] of Object.entries(fields)) { + this.#validateName(name, field); + next.#fields.push({ + type: 'config', + name, + value: field, + }); + } + Object.assign(next.#configSet, fields); + return next; + } + #addFields(fields, fn) { + const next = this; + Object.assign(next.#configSet, Object.fromEntries(Object.entries(fields).map(([name, field]) => { + this.#validateName(name, field); + const option = fn(field); + next.#fields.push({ + type: 'config', + name, + value: option, + }); + return [name, option]; + }))); + return next; + } + #validateName(name, field) { + if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) { + throw new TypeError(`Invalid option name: ${name}, ` + + `must be '-' delimited ASCII alphanumeric`); + } + if (this.#configSet[name]) { + throw new TypeError(`Cannot redefine option ${field}`); + } + if (this.#shorts[name]) { + throw new TypeError(`Cannot redefine option ${name}, already ` + + `in use for ${this.#shorts[name]}`); + } + if (field.short) { + if (!/^[a-zA-Z0-9]$/.test(field.short)) { + throw new TypeError(`Invalid ${name} short option: ${field.short}, ` + + 'must be 1 ASCII alphanumeric character'); + } + if (this.#shorts[field.short]) { + throw new TypeError(`Invalid ${name} short option: ${field.short}, ` + + `already in use for ${this.#shorts[field.short]}`); + } + this.#shorts[field.short] = name; + this.#shorts[name] = name; + } + } + /** + * Return the usage banner for the given configuration + */ + usage() { + if (this.#usage) + return this.#usage; + let headingLevel = 1; + const ui = cliui({ width }); + const first = this.#fields[0]; + let start = first?.type === 'heading' ? 1 : 0; + if (first?.type === 'heading') { + ui.div({ + padding: [0, 0, 0, 0], + text: normalize(first.text), + }); + } + ui.div({ padding: [0, 0, 0, 0], text: 'Usage:' }); + if (this.#options.usage) { + ui.div({ + text: this.#options.usage, + padding: [0, 0, 0, 2], + }); + } + else { + const cmd = basename(String(process.argv[1])); + const shortFlags = []; + const shorts = []; + const flags = []; + const opts = []; + for (const [field, config] of Object.entries(this.#configSet)) { + if (config.short) { + if (config.type === 'boolean') + shortFlags.push(config.short); + else + shorts.push([config.short, config.hint || field]); + } + else { + if (config.type === 'boolean') + flags.push(field); + else + opts.push([field, config.hint || field]); + } + } + const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''; + const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const lf = flags.map(k => ` --${k}`).join(''); + const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const usage = `${cmd}${sf}${so}${lf}${lo}`.trim(); + ui.div({ + text: usage, + padding: [0, 0, 0, 2], + }); + } + ui.div({ padding: [0, 0, 0, 0], text: '' }); + const maybeDesc = this.#fields[start]; + if (maybeDesc && isDescription(maybeDesc)) { + const print = normalize(maybeDesc.text, maybeDesc.pre); + start++; + ui.div({ padding: [0, 0, 0, 0], text: print }); + ui.div({ padding: [0, 0, 0, 0], text: '' }); + } + const { rows, maxWidth } = this.#usageRows(start); + // every heading/description after the first gets indented by 2 + // extra spaces. + for (const row of rows) { + if (row.left) { + // If the row is too long, don't wrap it + // Bump the right-hand side down a line to make room + const configIndent = indent(Math.max(headingLevel, 2)); + if (row.left.length > maxWidth - 3) { + ui.div({ text: row.left, padding: [0, 0, 0, configIndent] }); + ui.div({ text: row.text, padding: [0, 0, 0, maxWidth] }); + } + else { + ui.div({ + text: row.left, + padding: [0, 1, 0, configIndent], + width: maxWidth, + }, { padding: [0, 0, 0, 0], text: row.text }); + } + if (row.skipLine) { + ui.div({ padding: [0, 0, 0, 0], text: '' }); + } + } + else { + if (isHeading(row)) { + const { level } = row; + headingLevel = level; + // only h1 and h2 have bottom padding + // h3-h6 do not + const b = level <= 2 ? 1 : 0; + ui.div({ ...row, padding: [0, 0, b, indent(level)] }); + } + else { + ui.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] }); + } + } + } + return (this.#usage = ui.toString()); + } + /** + * Return the usage banner markdown for the given configuration + */ + usageMarkdown() { + if (this.#usageMarkdown) + return this.#usageMarkdown; + const out = []; + let headingLevel = 1; + const first = this.#fields[0]; + let start = first?.type === 'heading' ? 1 : 0; + if (first?.type === 'heading') { + out.push(`# ${normalizeOneLine(first.text)}`); + } + out.push('Usage:'); + if (this.#options.usage) { + out.push(normalizeMarkdown(this.#options.usage, true)); + } + else { + const cmd = basename(String(process.argv[1])); + const shortFlags = []; + const shorts = []; + const flags = []; + const opts = []; + for (const [field, config] of Object.entries(this.#configSet)) { + if (config.short) { + if (config.type === 'boolean') + shortFlags.push(config.short); + else + shorts.push([config.short, config.hint || field]); + } + else { + if (config.type === 'boolean') + flags.push(field); + else + opts.push([field, config.hint || field]); + } + } + const sf = shortFlags.length ? ' -' + shortFlags.join('') : ''; + const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const lf = flags.map(k => ` --${k}`).join(''); + const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join(''); + const usage = `${cmd}${sf}${so}${lf}${lo}`.trim(); + out.push(normalizeMarkdown(usage, true)); + } + const maybeDesc = this.#fields[start]; + if (maybeDesc && isDescription(maybeDesc)) { + out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre)); + start++; + } + const { rows } = this.#usageRows(start); + // heading level in markdown is number of # ahead of text + for (const row of rows) { + if (row.left) { + out.push('#'.repeat(headingLevel + 1) + + ' ' + + normalizeOneLine(row.left, true)); + if (row.text) + out.push(normalizeMarkdown(row.text)); + } + else if (isHeading(row)) { + const { level } = row; + headingLevel = level; + out.push(`${'#'.repeat(headingLevel)} ${normalizeOneLine(row.text, row.pre)}`); + } + else { + out.push(normalizeMarkdown(row.text, !!row.pre)); + } + } + return (this.#usageMarkdown = out.join('\n\n') + '\n'); + } + #usageRows(start) { + // turn each config type into a row, and figure out the width of the + // left hand indentation for the option descriptions. + let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3))); + let maxWidth = 8; + let prev = undefined; + const rows = []; + for (const field of this.#fields.slice(start)) { + if (field.type !== 'config') { + if (prev?.type === 'config') + prev.skipLine = true; + prev = undefined; + field.text = normalize(field.text, !!field.pre); + rows.push(field); + continue; + } + const { value } = field; + const desc = value.description || ''; + const mult = value.multiple ? 'Can be set multiple times' : ''; + const opts = value.validOptions?.length ? + `Valid options:${value.validOptions.map(v => ` ${JSON.stringify(v)}`)}` + : ''; + const dmDelim = desc.includes('\n') ? '\n\n' : '\n'; + const extra = [opts, mult].join(dmDelim).trim(); + const text = (normalize(desc) + dmDelim + extra).trim(); + const hint = value.hint || + (value.type === 'number' ? 'n' + : value.type === 'string' ? field.name + : undefined); + const short = !value.short ? '' + : value.type === 'boolean' ? `-${value.short} ` + : `-${value.short}<${hint}> `; + const left = value.type === 'boolean' ? + `${short}--${field.name}` + : `${short}--${field.name}=<${hint}>`; + const row = { text, left, type: 'config' }; + if (text.length > width - maxMax) { + row.skipLine = true; + } + if (prev && left.length > maxMax) + prev.skipLine = true; + prev = row; + const len = left.length + 4; + if (len > maxWidth && len < maxMax) { + maxWidth = len; + } + rows.push(row); + } + return { rows, maxWidth }; + } + /** + * Return the configuration options as a plain object + */ + toJSON() { + return Object.fromEntries(Object.entries(this.#configSet).map(([field, def]) => [ + field, + { + type: def.type, + ...(def.multiple ? { multiple: true } : {}), + ...(def.delim ? { delim: def.delim } : {}), + ...(def.short ? { short: def.short } : {}), + ...(def.description ? + { description: normalize(def.description) } + : {}), + ...(def.validate ? { validate: def.validate } : {}), + ...(def.validOptions ? { validOptions: def.validOptions } : {}), + ...(def.default !== undefined ? { default: def.default } : {}), + ...(def.hint ? { hint: def.hint } : {}), + }, + ])); + } + /** + * Custom printer for `util.inspect` + */ + [inspect.custom](_, options) { + return `Jack ${inspect(this.toJSON(), options)}`; + } +} +// Unwrap and un-indent, so we can wrap description +// strings however makes them look nice in the code. +const normalize = (s, pre = false) => { + if (pre) + // prepend a ZWSP to each line so cliui doesn't strip it. + return s + .split('\n') + .map(l => `\u200b${l}`) + .join('\n'); + return s + .split(/^\s*```\s*$/gm) + .map((s, i) => { + if (i % 2 === 1) { + if (!s.trim()) { + return `\`\`\`\n\`\`\`\n`; + } + // outdent the ``` blocks, but preserve whitespace otherwise. + const split = s.split('\n'); + // throw out the \n at the start and end + split.pop(); + split.shift(); + const si = split.reduce((shortest, l) => { + /* c8 ignore next */ + const ind = l.match(/^\s*/)?.[0] ?? ''; + if (ind.length) + return Math.min(ind.length, shortest); + else + return shortest; + }, Infinity); + /* c8 ignore next */ + const i = isFinite(si) ? si : 0; + return ('\n```\n' + + split.map(s => `\u200b${s.substring(i)}`).join('\n') + + '\n```\n'); + } + return (s + // remove single line breaks, except for lists + .replace(/([^\n])\n[ \t]*([^\n])/g, (_, $1, $2) => !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}\n${$2}`) + // normalize mid-line whitespace + .replace(/([^\n])[ \t]+([^\n])/g, '$1 $2') + // two line breaks are enough + .replace(/\n{3,}/g, '\n\n') + // remove any spaces at the start of a line + .replace(/\n[ \t]+/g, '\n') + .trim()); + }) + .join('\n'); +}; +// normalize for markdown printing, remove leading spaces on lines +const normalizeMarkdown = (s, pre = false) => { + const n = normalize(s, pre).replace(/\\/g, '\\\\'); + return pre ? + `\`\`\`\n${n.replace(/\u200b/g, '')}\n\`\`\`` + : n.replace(/\n +/g, '\n').trim(); +}; +const normalizeOneLine = (s, pre = false) => { + const n = normalize(s, pre) + .replace(/[\s\u200b]+/g, ' ') + .trim(); + return pre ? `\`${n}\`` : n; +}; +/** + * Main entry point. Create and return a {@link Jack} object. + */ +export const jack = (options = {}) => new Jack(options); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/jackspeak/dist/esm/package.json b/node_modules/npm/node_modules/jackspeak/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/jackspeak/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/jackspeak/dist/esm/parse-args.js b/node_modules/npm/node_modules/jackspeak/dist/esm/parse-args.js new file mode 100644 index 00000000..a4be7153 --- /dev/null +++ b/node_modules/npm/node_modules/jackspeak/dist/esm/parse-args.js @@ -0,0 +1,26 @@ +import * as util from 'util'; +const pv = (typeof process === 'object' && + !!process && + typeof process.version === 'string') ? + process.version + : 'v0.0.0'; +const pvs = pv + .replace(/^v/, '') + .split('.') + .map(s => parseInt(s, 10)); +/* c8 ignore start */ +const [major = 0, minor = 0] = pvs; +/* c8 ignore stop */ +let { parseArgs: pa, } = util; +/* c8 ignore start - version specific */ +if (!pa || + major < 16 || + (major === 18 && minor < 11) || + (major === 16 && minor < 19)) { + // Ignore because we will clobber it for commonjs + //@ts-ignore + pa = (await import('@pkgjs/parseargs')).parseArgs; +} +/* c8 ignore stop */ +export const parseArgs = pa; +//# sourceMappingURL=parse-args.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/jackspeak/package.json b/node_modules/npm/node_modules/jackspeak/package.json new file mode 100644 index 00000000..51eaabdf --- /dev/null +++ b/node_modules/npm/node_modules/jackspeak/package.json @@ -0,0 +1,95 @@ +{ + "name": "jackspeak", + "publishConfig": { + "tag": "v3-legacy" + }, + "version": "3.4.3", + "description": "A very strict and proper argument parser.", + "tshy": { + "main": true, + "exports": { + "./package.json": "./package.json", + ".": "./src/index.js" + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "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": { + "build-examples": "for i in examples/*.js ; do node $i -h > ${i/.js/.txt}; done", + "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 . --log-level warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "license": "BlueOak-1.0.0", + "prettier": { + "experimentalTernaries": true, + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "devDependencies": { + "@types/node": "^20.7.0", + "@types/pkgjs__parseargs": "^0.10.1", + "prettier": "^3.2.5", + "tap": "^18.8.0", + "tshy": "^1.14.0", + "typedoc": "^0.25.1", + "typescript": "^5.2.2" + }, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/jackspeak.git" + }, + "keywords": [ + "argument", + "parser", + "args", + "option", + "flag", + "cli", + "command", + "line", + "parse", + "parsing" + ], + "author": "Isaac Z. Schlueter ", + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } +} diff --git a/node_modules/npm/node_modules/jsbn/LICENSE b/node_modules/npm/node_modules/jsbn/LICENSE new file mode 100644 index 00000000..24502a9c --- /dev/null +++ b/node_modules/npm/node_modules/jsbn/LICENSE @@ -0,0 +1,40 @@ +Licensing +--------- + +This software is covered under the following copyright: + +/* + * Copyright (c) 2003-2005 Tom Wu + * 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" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following condition applies: + * + * All redistributions must retain an intact copy of this copyright notice + * and disclaimer. + */ + +Address all questions regarding this license to: + + Tom Wu + tjw@cs.Stanford.EDU diff --git a/node_modules/npm/node_modules/jsbn/example.html b/node_modules/npm/node_modules/jsbn/example.html new file mode 100644 index 00000000..1c0489b1 --- /dev/null +++ b/node_modules/npm/node_modules/jsbn/example.html @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/node_modules/npm/node_modules/jsbn/example.js b/node_modules/npm/node_modules/jsbn/example.js new file mode 100644 index 00000000..85979909 --- /dev/null +++ b/node_modules/npm/node_modules/jsbn/example.js @@ -0,0 +1,5 @@ +(function () { + var BigInteger = jsbn.BigInteger; + var a = new BigInteger('91823918239182398123'); + console.log(a.bitLength()); +}()); diff --git a/node_modules/npm/node_modules/jsbn/index.js b/node_modules/npm/node_modules/jsbn/index.js new file mode 100644 index 00000000..e9eb697b --- /dev/null +++ b/node_modules/npm/node_modules/jsbn/index.js @@ -0,0 +1,1361 @@ +(function(){ + + // Copyright (c) 2005 Tom Wu + // All Rights Reserved. + // See "LICENSE" for details. + + // Basic JavaScript BN library - subset useful for RSA encryption. + + // Bits per digit + var dbits; + + // JavaScript engine analysis + var canary = 0xdeadbeefcafe; + var j_lm = ((canary&0xffffff)==0xefcafe); + + // (public) Constructor + function BigInteger(a,b,c) { + if(a != null) + if("number" == typeof a) this.fromNumber(a,b,c); + else if(b == null && "string" != typeof a) this.fromString(a,256); + else this.fromString(a,b); + } + + // return new, unset BigInteger + function nbi() { return new BigInteger(null); } + + // am: Compute w_j += (x*this_i), propagate carries, + // c is initial carry, returns final carry. + // c < 3*dvalue, x < 2*dvalue, this_i < dvalue + // We need to select the fastest one that works in this environment. + + // am1: use a single mult and divide to get the high bits, + // max digit bits should be 26 because + // max internal value = 2*dvalue^2-2*dvalue (< 2^53) + function am1(i,x,w,j,c,n) { + while(--n >= 0) { + var v = x*this[i++]+w[j]+c; + c = Math.floor(v/0x4000000); + w[j++] = v&0x3ffffff; + } + return c; + } + // am2 avoids a big mult-and-extract completely. + // Max digit bits should be <= 30 because we do bitwise ops + // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) + function am2(i,x,w,j,c,n) { + var xl = x&0x7fff, xh = x>>15; + while(--n >= 0) { + var l = this[i]&0x7fff; + var h = this[i++]>>15; + var m = xh*l+h*xl; + l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); + c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); + w[j++] = l&0x3fffffff; + } + return c; + } + // Alternately, set max digit bits to 28 since some + // browsers slow down when dealing with 32-bit numbers. + function am3(i,x,w,j,c,n) { + var xl = x&0x3fff, xh = x>>14; + while(--n >= 0) { + var l = this[i]&0x3fff; + var h = this[i++]>>14; + var m = xh*l+h*xl; + l = xl*l+((m&0x3fff)<<14)+w[j]+c; + c = (l>>28)+(m>>14)+xh*h; + w[j++] = l&0xfffffff; + } + return c; + } + var inBrowser = typeof navigator !== "undefined"; + if(inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) { + BigInteger.prototype.am = am2; + dbits = 30; + } + else if(inBrowser && j_lm && (navigator.appName != "Netscape")) { + BigInteger.prototype.am = am1; + dbits = 26; + } + else { // Mozilla/Netscape seems to prefer am3 + BigInteger.prototype.am = am3; + dbits = 28; + } + + BigInteger.prototype.DB = dbits; + BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i]; + r.t = this.t; + r.s = this.s; + } + + // (protected) set from integer value x, -DV <= x < DV + function bnpFromInt(x) { + this.t = 1; + this.s = (x<0)?-1:0; + if(x > 0) this[0] = x; + else if(x < -1) this[0] = x+this.DV; + else this.t = 0; + } + + // return bigint initialized to value + function nbv(i) { var r = nbi(); r.fromInt(i); return r; } + + // (protected) set from string and radix + function bnpFromString(s,b) { + var k; + if(b == 16) k = 4; + else if(b == 8) k = 3; + else if(b == 256) k = 8; // byte array + else if(b == 2) k = 1; + else if(b == 32) k = 5; + else if(b == 4) k = 2; + else { this.fromRadix(s,b); return; } + this.t = 0; + this.s = 0; + var i = s.length, mi = false, sh = 0; + while(--i >= 0) { + var x = (k==8)?s[i]&0xff:intAt(s,i); + if(x < 0) { + if(s.charAt(i) == "-") mi = true; + continue; + } + mi = false; + if(sh == 0) + this[this.t++] = x; + else if(sh+k > this.DB) { + this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); + } + else + this[this.t-1] |= x<= this.DB) sh -= this.DB; + } + if(k == 8 && (s[0]&0x80) != 0) { + this.s = -1; + if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t; + } + + // (public) return string representation in given radix + function bnToString(b) { + if(this.s < 0) return "-"+this.negate().toString(b); + var k; + if(b == 16) k = 4; + else if(b == 8) k = 3; + else if(b == 2) k = 1; + else if(b == 32) k = 5; + else if(b == 4) k = 2; + else return this.toRadix(b); + var km = (1< 0) { + if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); } + while(i >= 0) { + if(p < k) { + d = (this[i]&((1<>(p+=this.DB-k); + } + else { + d = (this[i]>>(p-=k))&km; + if(p <= 0) { p += this.DB; --i; } + } + if(d > 0) m = true; + if(m) r += int2char(d); + } + } + return m?r:"0"; + } + + // (public) -this + function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } + + // (public) |this| + function bnAbs() { return (this.s<0)?this.negate():this; } + + // (public) return + if this > a, - if this < a, 0 if equal + function bnCompareTo(a) { + var r = this.s-a.s; + if(r != 0) return r; + var i = this.t; + r = i-a.t; + if(r != 0) return (this.s<0)?-r:r; + while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; + return 0; + } + + // returns bit length of the integer x + function nbits(x) { + var r = 1, t; + if((t=x>>>16) != 0) { x = t; r += 16; } + if((t=x>>8) != 0) { x = t; r += 8; } + if((t=x>>4) != 0) { x = t; r += 4; } + if((t=x>>2) != 0) { x = t; r += 2; } + if((t=x>>1) != 0) { x = t; r += 1; } + return r; + } + + // (public) return the number of bits in "this" + function bnBitLength() { + if(this.t <= 0) return 0; + return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); + } + + // (protected) r = this << n*DB + function bnpDLShiftTo(n,r) { + var i; + for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; + for(i = n-1; i >= 0; --i) r[i] = 0; + r.t = this.t+n; + r.s = this.s; + } + + // (protected) r = this >> n*DB + function bnpDRShiftTo(n,r) { + for(var i = n; i < this.t; ++i) r[i-n] = this[i]; + r.t = Math.max(this.t-n,0); + r.s = this.s; + } + + // (protected) r = this << n + function bnpLShiftTo(n,r) { + var bs = n%this.DB; + var cbs = this.DB-bs; + var bm = (1<= 0; --i) { + r[i+ds+1] = (this[i]>>cbs)|c; + c = (this[i]&bm)<= 0; --i) r[i] = 0; + r[ds] = c; + r.t = this.t+ds+1; + r.s = this.s; + r.clamp(); + } + + // (protected) r = this >> n + function bnpRShiftTo(n,r) { + r.s = this.s; + var ds = Math.floor(n/this.DB); + if(ds >= this.t) { r.t = 0; return; } + var bs = n%this.DB; + var cbs = this.DB-bs; + var bm = (1<>bs; + for(var i = ds+1; i < this.t; ++i) { + r[i-ds-1] |= (this[i]&bm)<>bs; + } + if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB; + } + if(a.t < this.t) { + c -= a.s; + while(i < this.t) { + c += this[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while(i < a.t) { + c -= a[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c -= a.s; + } + r.s = (c<0)?-1:0; + if(c < -1) r[i++] = this.DV+c; + else if(c > 0) r[i++] = c; + r.t = i; + r.clamp(); + } + + // (protected) r = this * a, r != this,a (HAC 14.12) + // "this" should be the larger one if appropriate. + function bnpMultiplyTo(a,r) { + var x = this.abs(), y = a.abs(); + var i = x.t; + r.t = i+y.t; + while(--i >= 0) r[i] = 0; + for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); + r.s = 0; + r.clamp(); + if(this.s != a.s) BigInteger.ZERO.subTo(r,r); + } + + // (protected) r = this^2, r != this (HAC 14.16) + function bnpSquareTo(r) { + var x = this.abs(); + var i = r.t = 2*x.t; + while(--i >= 0) r[i] = 0; + for(i = 0; i < x.t-1; ++i) { + var c = x.am(i,x[i],r,2*i,0,1); + if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { + r[i+x.t] -= x.DV; + r[i+x.t+1] = 1; + } + } + if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); + r.s = 0; + r.clamp(); + } + + // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) + // r != q, this != m. q or r may be null. + function bnpDivRemTo(m,q,r) { + var pm = m.abs(); + if(pm.t <= 0) return; + var pt = this.abs(); + if(pt.t < pm.t) { + if(q != null) q.fromInt(0); + if(r != null) this.copyTo(r); + return; + } + if(r == null) r = nbi(); + var y = nbi(), ts = this.s, ms = m.s; + var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus + if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } + else { pm.copyTo(y); pt.copyTo(r); } + var ys = y.t; + var y0 = y[ys-1]; + if(y0 == 0) return; + var yt = y0*(1<1)?y[ys-2]>>this.F2:0); + var d1 = this.FV/yt, d2 = (1<= 0) { + r[r.t++] = 1; + r.subTo(t,r); + } + BigInteger.ONE.dlShiftTo(ys,t); + t.subTo(y,y); // "negative" y so we can replace sub with am later + while(y.t < ys) y[y.t++] = 0; + while(--j >= 0) { + // Estimate quotient digit + var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); + if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out + y.dlShiftTo(j,t); + r.subTo(t,r); + while(r[i] < --qd) r.subTo(t,r); + } + } + if(q != null) { + r.drShiftTo(ys,q); + if(ts != ms) BigInteger.ZERO.subTo(q,q); + } + r.t = ys; + r.clamp(); + if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder + if(ts < 0) BigInteger.ZERO.subTo(r,r); + } + + // (public) this mod a + function bnMod(a) { + var r = nbi(); + this.abs().divRemTo(a,null,r); + if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); + return r; + } + + // Modular reduction using "classic" algorithm + function Classic(m) { this.m = m; } + function cConvert(x) { + if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); + else return x; + } + function cRevert(x) { return x; } + function cReduce(x) { x.divRemTo(this.m,null,x); } + function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + + Classic.prototype.convert = cConvert; + Classic.prototype.revert = cRevert; + Classic.prototype.reduce = cReduce; + Classic.prototype.mulTo = cMulTo; + Classic.prototype.sqrTo = cSqrTo; + + // (protected) return "-1/this % 2^DB"; useful for Mont. reduction + // justification: + // xy == 1 (mod m) + // xy = 1+km + // xy(2-xy) = (1+km)(1-km) + // x[y(2-xy)] = 1-k^2m^2 + // x[y(2-xy)] == 1 (mod m^2) + // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 + // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. + // JS multiply "overflows" differently from C/C++, so care is needed here. + function bnpInvDigit() { + if(this.t < 1) return 0; + var x = this[0]; + if((x&1) == 0) return 0; + var y = x&3; // y == 1/x mod 2^2 + y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 + y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 + y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 + // last step - calculate inverse mod DV directly; + // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints + y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits + // we really want the negative inverse, and -DV < y < DV + return (y>0)?this.DV-y:-y; + } + + // Montgomery reduction + function Montgomery(m) { + this.m = m; + this.mp = m.invDigit(); + this.mpl = this.mp&0x7fff; + this.mph = this.mp>>15; + this.um = (1<<(m.DB-15))-1; + this.mt2 = 2*m.t; + } + + // xR mod m + function montConvert(x) { + var r = nbi(); + x.abs().dlShiftTo(this.m.t,r); + r.divRemTo(this.m,null,r); + if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); + return r; + } + + // x/R mod m + function montRevert(x) { + var r = nbi(); + x.copyTo(r); + this.reduce(r); + return r; + } + + // x = x/R mod m (HAC 14.32) + function montReduce(x) { + while(x.t <= this.mt2) // pad x so am has enough room later + x[x.t++] = 0; + for(var i = 0; i < this.m.t; ++i) { + // faster way of calculating u0 = x[i]*mp mod DV + var j = x[i]&0x7fff; + var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; + // use am to combine the multiply-shift-add into one call + j = i+this.m.t; + x[j] += this.m.am(0,u0,x,i,0,this.m.t); + // propagate carry + while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } + } + x.clamp(); + x.drShiftTo(this.m.t,x); + if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); + } + + // r = "x^2/R mod m"; x != r + function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + + // r = "xy/R mod m"; x,y != r + function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + + Montgomery.prototype.convert = montConvert; + Montgomery.prototype.revert = montRevert; + Montgomery.prototype.reduce = montReduce; + Montgomery.prototype.mulTo = montMulTo; + Montgomery.prototype.sqrTo = montSqrTo; + + // (protected) true iff this is even + function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } + + // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) + function bnpExp(e,z) { + if(e > 0xffffffff || e < 1) return BigInteger.ONE; + var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; + g.copyTo(r); + while(--i >= 0) { + z.sqrTo(r,r2); + if((e&(1< 0) z.mulTo(r2,g,r); + else { var t = r; r = r2; r2 = t; } + } + return z.revert(r); + } + + // (public) this^e % m, 0 <= e < 2^32 + function bnModPowInt(e,m) { + var z; + if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); + return this.exp(e,z); + } + + // protected + BigInteger.prototype.copyTo = bnpCopyTo; + BigInteger.prototype.fromInt = bnpFromInt; + BigInteger.prototype.fromString = bnpFromString; + BigInteger.prototype.clamp = bnpClamp; + BigInteger.prototype.dlShiftTo = bnpDLShiftTo; + BigInteger.prototype.drShiftTo = bnpDRShiftTo; + BigInteger.prototype.lShiftTo = bnpLShiftTo; + BigInteger.prototype.rShiftTo = bnpRShiftTo; + BigInteger.prototype.subTo = bnpSubTo; + BigInteger.prototype.multiplyTo = bnpMultiplyTo; + BigInteger.prototype.squareTo = bnpSquareTo; + BigInteger.prototype.divRemTo = bnpDivRemTo; + BigInteger.prototype.invDigit = bnpInvDigit; + BigInteger.prototype.isEven = bnpIsEven; + BigInteger.prototype.exp = bnpExp; + + // public + BigInteger.prototype.toString = bnToString; + BigInteger.prototype.negate = bnNegate; + BigInteger.prototype.abs = bnAbs; + BigInteger.prototype.compareTo = bnCompareTo; + BigInteger.prototype.bitLength = bnBitLength; + BigInteger.prototype.mod = bnMod; + BigInteger.prototype.modPowInt = bnModPowInt; + + // "constants" + BigInteger.ZERO = nbv(0); + BigInteger.ONE = nbv(1); + + // Copyright (c) 2005-2009 Tom Wu + // All Rights Reserved. + // See "LICENSE" for details. + + // Extended JavaScript BN functions, required for RSA private ops. + + // Version 1.1: new BigInteger("0", 10) returns "proper" zero + // Version 1.2: square() API, isProbablePrime fix + + // (public) + function bnClone() { var r = nbi(); this.copyTo(r); return r; } + + // (public) return value as integer + function bnIntValue() { + if(this.s < 0) { + if(this.t == 1) return this[0]-this.DV; + else if(this.t == 0) return -1; + } + else if(this.t == 1) return this[0]; + else if(this.t == 0) return 0; + // assumes 16 < DB < 32 + return ((this[1]&((1<<(32-this.DB))-1))<>24; } + + // (public) return value as short (assumes DB>=16) + function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; } + + // (protected) return x s.t. r^x < DV + function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } + + // (public) 0 if this == 0, 1 if this > 0 + function bnSigNum() { + if(this.s < 0) return -1; + else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; + else return 1; + } + + // (protected) convert to radix string + function bnpToRadix(b) { + if(b == null) b = 10; + if(this.signum() == 0 || b < 2 || b > 36) return "0"; + var cs = this.chunkSize(b); + var a = Math.pow(b,cs); + var d = nbv(a), y = nbi(), z = nbi(), r = ""; + this.divRemTo(d,y,z); + while(y.signum() > 0) { + r = (a+z.intValue()).toString(b).substr(1) + r; + y.divRemTo(d,y,z); + } + return z.intValue().toString(b) + r; + } + + // (protected) convert from radix string + function bnpFromRadix(s,b) { + this.fromInt(0); + if(b == null) b = 10; + var cs = this.chunkSize(b); + var d = Math.pow(b,cs), mi = false, j = 0, w = 0; + for(var i = 0; i < s.length; ++i) { + var x = intAt(s,i); + if(x < 0) { + if(s.charAt(i) == "-" && this.signum() == 0) mi = true; + continue; + } + w = b*w+x; + if(++j >= cs) { + this.dMultiply(d); + this.dAddOffset(w,0); + j = 0; + w = 0; + } + } + if(j > 0) { + this.dMultiply(Math.pow(b,j)); + this.dAddOffset(w,0); + } + if(mi) BigInteger.ZERO.subTo(this,this); + } + + // (protected) alternate constructor + function bnpFromNumber(a,b,c) { + if("number" == typeof b) { + // new BigInteger(int,int,RNG) + if(a < 2) this.fromInt(1); + else { + this.fromNumber(a,c); + if(!this.testBit(a-1)) // force MSB set + this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); + if(this.isEven()) this.dAddOffset(1,0); // force odd + while(!this.isProbablePrime(b)) { + this.dAddOffset(2,0); + if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); + } + } + } + else { + // new BigInteger(int,RNG) + var x = new Array(), t = a&7; + x.length = (a>>3)+1; + b.nextBytes(x); + if(t > 0) x[0] &= ((1< 0) { + if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p) + r[k++] = d|(this.s<<(this.DB-p)); + while(i >= 0) { + if(p < 8) { + d = (this[i]&((1<>(p+=this.DB-8); + } + else { + d = (this[i]>>(p-=8))&0xff; + if(p <= 0) { p += this.DB; --i; } + } + if((d&0x80) != 0) d |= -256; + if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; + if(k > 0 || d != this.s) r[k++] = d; + } + } + return r; + } + + function bnEquals(a) { return(this.compareTo(a)==0); } + function bnMin(a) { return(this.compareTo(a)<0)?this:a; } + function bnMax(a) { return(this.compareTo(a)>0)?this:a; } + + // (protected) r = this op a (bitwise) + function bnpBitwiseTo(a,op,r) { + var i, f, m = Math.min(a.t,this.t); + for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]); + if(a.t < this.t) { + f = a.s&this.DM; + for(i = m; i < this.t; ++i) r[i] = op(this[i],f); + r.t = this.t; + } + else { + f = this.s&this.DM; + for(i = m; i < a.t; ++i) r[i] = op(f,a[i]); + r.t = a.t; + } + r.s = op(this.s,a.s); + r.clamp(); + } + + // (public) this & a + function op_and(x,y) { return x&y; } + function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } + + // (public) this | a + function op_or(x,y) { return x|y; } + function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } + + // (public) this ^ a + function op_xor(x,y) { return x^y; } + function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } + + // (public) this & ~a + function op_andnot(x,y) { return x&~y; } + function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } + + // (public) ~this + function bnNot() { + var r = nbi(); + for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i]; + r.t = this.t; + r.s = ~this.s; + return r; + } + + // (public) this << n + function bnShiftLeft(n) { + var r = nbi(); + if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); + return r; + } + + // (public) this >> n + function bnShiftRight(n) { + var r = nbi(); + if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); + return r; + } + + // return index of lowest 1-bit in x, x < 2^31 + function lbit(x) { + if(x == 0) return -1; + var r = 0; + if((x&0xffff) == 0) { x >>= 16; r += 16; } + if((x&0xff) == 0) { x >>= 8; r += 8; } + if((x&0xf) == 0) { x >>= 4; r += 4; } + if((x&3) == 0) { x >>= 2; r += 2; } + if((x&1) == 0) ++r; + return r; + } + + // (public) returns index of lowest 1-bit (or -1 if none) + function bnGetLowestSetBit() { + for(var i = 0; i < this.t; ++i) + if(this[i] != 0) return i*this.DB+lbit(this[i]); + if(this.s < 0) return this.t*this.DB; + return -1; + } + + // return number of 1 bits in x + function cbit(x) { + var r = 0; + while(x != 0) { x &= x-1; ++r; } + return r; + } + + // (public) return number of set bits + function bnBitCount() { + var r = 0, x = this.s&this.DM; + for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x); + return r; + } + + // (public) true iff nth bit is set + function bnTestBit(n) { + var j = Math.floor(n/this.DB); + if(j >= this.t) return(this.s!=0); + return((this[j]&(1<<(n%this.DB)))!=0); + } + + // (protected) this op (1<>= this.DB; + } + if(a.t < this.t) { + c += a.s; + while(i < this.t) { + c += this[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while(i < a.t) { + c += a[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += a.s; + } + r.s = (c<0)?-1:0; + if(c > 0) r[i++] = c; + else if(c < -1) r[i++] = this.DV+c; + r.t = i; + r.clamp(); + } + + // (public) this + a + function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } + + // (public) this - a + function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } + + // (public) this * a + function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } + + // (public) this^2 + function bnSquare() { var r = nbi(); this.squareTo(r); return r; } + + // (public) this / a + function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } + + // (public) this % a + function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } + + // (public) [this/a,this%a] + function bnDivideAndRemainder(a) { + var q = nbi(), r = nbi(); + this.divRemTo(a,q,r); + return new Array(q,r); + } + + // (protected) this *= n, this >= 0, 1 < n < DV + function bnpDMultiply(n) { + this[this.t] = this.am(0,n-1,this,0,0,this.t); + ++this.t; + this.clamp(); + } + + // (protected) this += n << w words, this >= 0 + function bnpDAddOffset(n,w) { + if(n == 0) return; + while(this.t <= w) this[this.t++] = 0; + this[w] += n; + while(this[w] >= this.DV) { + this[w] -= this.DV; + if(++w >= this.t) this[this.t++] = 0; + ++this[w]; + } + } + + // A "null" reducer + function NullExp() {} + function nNop(x) { return x; } + function nMulTo(x,y,r) { x.multiplyTo(y,r); } + function nSqrTo(x,r) { x.squareTo(r); } + + NullExp.prototype.convert = nNop; + NullExp.prototype.revert = nNop; + NullExp.prototype.mulTo = nMulTo; + NullExp.prototype.sqrTo = nSqrTo; + + // (public) this^e + function bnPow(e) { return this.exp(e,new NullExp()); } + + // (protected) r = lower n words of "this * a", a.t <= n + // "this" should be the larger one if appropriate. + function bnpMultiplyLowerTo(a,n,r) { + var i = Math.min(this.t+a.t,n); + r.s = 0; // assumes a,this >= 0 + r.t = i; + while(i > 0) r[--i] = 0; + var j; + for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t); + for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i); + r.clamp(); + } + + // (protected) r = "this * a" without lower n words, n > 0 + // "this" should be the larger one if appropriate. + function bnpMultiplyUpperTo(a,n,r) { + --n; + var i = r.t = this.t+a.t-n; + r.s = 0; // assumes a,this >= 0 + while(--i >= 0) r[i] = 0; + for(i = Math.max(n-this.t,0); i < a.t; ++i) + r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n); + r.clamp(); + r.drShiftTo(1,r); + } + + // Barrett modular reduction + function Barrett(m) { + // setup Barrett + this.r2 = nbi(); + this.q3 = nbi(); + BigInteger.ONE.dlShiftTo(2*m.t,this.r2); + this.mu = this.r2.divide(m); + this.m = m; + } + + function barrettConvert(x) { + if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); + else if(x.compareTo(this.m) < 0) return x; + else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } + } + + function barrettRevert(x) { return x; } + + // x = x mod m (HAC 14.42) + function barrettReduce(x) { + x.drShiftTo(this.m.t-1,this.r2); + if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } + this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); + this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); + while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); + x.subTo(this.r2,x); + while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); + } + + // r = x^2 mod m; x != r + function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + + // r = x*y mod m; x,y != r + function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + + Barrett.prototype.convert = barrettConvert; + Barrett.prototype.revert = barrettRevert; + Barrett.prototype.reduce = barrettReduce; + Barrett.prototype.mulTo = barrettMulTo; + Barrett.prototype.sqrTo = barrettSqrTo; + + // (public) this^e % m (HAC 14.85) + function bnModPow(e,m) { + var i = e.bitLength(), k, r = nbv(1), z; + if(i <= 0) return r; + else if(i < 18) k = 1; + else if(i < 48) k = 3; + else if(i < 144) k = 4; + else if(i < 768) k = 5; + else k = 6; + if(i < 8) + z = new Classic(m); + else if(m.isEven()) + z = new Barrett(m); + else + z = new Montgomery(m); + + // precomputation + var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { + var g2 = nbi(); + z.sqrTo(g[1],g2); + while(n <= km) { + g[n] = nbi(); + z.mulTo(g2,g[n-2],g[n]); + n += 2; + } + } + + var j = e.t-1, w, is1 = true, r2 = nbi(), t; + i = nbits(e[j])-1; + while(j >= 0) { + if(i >= k1) w = (e[j]>>(i-k1))&km; + else { + w = (e[j]&((1<<(i+1))-1))<<(k1-i); + if(j > 0) w |= e[j-1]>>(this.DB+i-k1); + } + + n = k; + while((w&1) == 0) { w >>= 1; --n; } + if((i -= n) < 0) { i += this.DB; --j; } + if(is1) { // ret == 1, don't bother squaring or multiplying it + g[w].copyTo(r); + is1 = false; + } + else { + while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } + if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } + z.mulTo(r2,g[w],r); + } + + while(j >= 0 && (e[j]&(1< 0) { + x.rShiftTo(g,x); + y.rShiftTo(g,y); + } + while(x.signum() > 0) { + if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); + if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); + if(x.compareTo(y) >= 0) { + x.subTo(y,x); + x.rShiftTo(1,x); + } + else { + y.subTo(x,y); + y.rShiftTo(1,y); + } + } + if(g > 0) y.lShiftTo(g,y); + return y; + } + + // (protected) this % n, n < 2^26 + function bnpModInt(n) { + if(n <= 0) return 0; + var d = this.DV%n, r = (this.s<0)?n-1:0; + if(this.t > 0) + if(d == 0) r = this[0]%n; + else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n; + return r; + } + + // (public) 1/this % m (HAC 14.61) + function bnModInverse(m) { + var ac = m.isEven(); + if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; + var u = m.clone(), v = this.clone(); + var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); + while(u.signum() != 0) { + while(u.isEven()) { + u.rShiftTo(1,u); + if(ac) { + if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } + a.rShiftTo(1,a); + } + else if(!b.isEven()) b.subTo(m,b); + b.rShiftTo(1,b); + } + while(v.isEven()) { + v.rShiftTo(1,v); + if(ac) { + if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } + c.rShiftTo(1,c); + } + else if(!d.isEven()) d.subTo(m,d); + d.rShiftTo(1,d); + } + if(u.compareTo(v) >= 0) { + u.subTo(v,u); + if(ac) a.subTo(c,a); + b.subTo(d,b); + } + else { + v.subTo(u,v); + if(ac) c.subTo(a,c); + d.subTo(b,d); + } + } + if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; + if(d.compareTo(m) >= 0) return d.subtract(m); + if(d.signum() < 0) d.addTo(m,d); else return d; + if(d.signum() < 0) return d.add(m); else return d; + } + + var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]; + var lplim = (1<<26)/lowprimes[lowprimes.length-1]; + + // (public) test primality with certainty >= 1-.5^t + function bnIsProbablePrime(t) { + var i, x = this.abs(); + if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) { + for(i = 0; i < lowprimes.length; ++i) + if(x[0] == lowprimes[i]) return true; + return false; + } + if(x.isEven()) return false; + i = 1; + while(i < lowprimes.length) { + var m = lowprimes[i], j = i+1; + while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; + m = x.modInt(m); + while(i < j) if(m%lowprimes[i++] == 0) return false; + } + return x.millerRabin(t); + } + + // (protected) true if probably prime (HAC 4.24, Miller-Rabin) + function bnpMillerRabin(t) { + var n1 = this.subtract(BigInteger.ONE); + var k = n1.getLowestSetBit(); + if(k <= 0) return false; + var r = n1.shiftRight(k); + t = (t+1)>>1; + if(t > lowprimes.length) t = lowprimes.length; + var a = nbi(); + for(var i = 0; i < t; ++i) { + //Pick bases at random, instead of starting at 2 + a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]); + var y = a.modPow(r,this); + if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { + var j = 1; + while(j++ < k && y.compareTo(n1) != 0) { + y = y.modPowInt(2,this); + if(y.compareTo(BigInteger.ONE) == 0) return false; + } + if(y.compareTo(n1) != 0) return false; + } + } + return true; + } + + // protected + BigInteger.prototype.chunkSize = bnpChunkSize; + BigInteger.prototype.toRadix = bnpToRadix; + BigInteger.prototype.fromRadix = bnpFromRadix; + BigInteger.prototype.fromNumber = bnpFromNumber; + BigInteger.prototype.bitwiseTo = bnpBitwiseTo; + BigInteger.prototype.changeBit = bnpChangeBit; + BigInteger.prototype.addTo = bnpAddTo; + BigInteger.prototype.dMultiply = bnpDMultiply; + BigInteger.prototype.dAddOffset = bnpDAddOffset; + BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; + BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; + BigInteger.prototype.modInt = bnpModInt; + BigInteger.prototype.millerRabin = bnpMillerRabin; + + // public + BigInteger.prototype.clone = bnClone; + BigInteger.prototype.intValue = bnIntValue; + BigInteger.prototype.byteValue = bnByteValue; + BigInteger.prototype.shortValue = bnShortValue; + BigInteger.prototype.signum = bnSigNum; + BigInteger.prototype.toByteArray = bnToByteArray; + BigInteger.prototype.equals = bnEquals; + BigInteger.prototype.min = bnMin; + BigInteger.prototype.max = bnMax; + BigInteger.prototype.and = bnAnd; + BigInteger.prototype.or = bnOr; + BigInteger.prototype.xor = bnXor; + BigInteger.prototype.andNot = bnAndNot; + BigInteger.prototype.not = bnNot; + BigInteger.prototype.shiftLeft = bnShiftLeft; + BigInteger.prototype.shiftRight = bnShiftRight; + BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; + BigInteger.prototype.bitCount = bnBitCount; + BigInteger.prototype.testBit = bnTestBit; + BigInteger.prototype.setBit = bnSetBit; + BigInteger.prototype.clearBit = bnClearBit; + BigInteger.prototype.flipBit = bnFlipBit; + BigInteger.prototype.add = bnAdd; + BigInteger.prototype.subtract = bnSubtract; + BigInteger.prototype.multiply = bnMultiply; + BigInteger.prototype.divide = bnDivide; + BigInteger.prototype.remainder = bnRemainder; + BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; + BigInteger.prototype.modPow = bnModPow; + BigInteger.prototype.modInverse = bnModInverse; + BigInteger.prototype.pow = bnPow; + BigInteger.prototype.gcd = bnGCD; + BigInteger.prototype.isProbablePrime = bnIsProbablePrime; + + // JSBN-specific extension + BigInteger.prototype.square = bnSquare; + + // Expose the Barrett function + BigInteger.prototype.Barrett = Barrett + + // BigInteger interfaces not implemented in jsbn: + + // BigInteger(int signum, byte[] magnitude) + // double doubleValue() + // float floatValue() + // int hashCode() + // long longValue() + // static BigInteger valueOf(long val) + + // Random number generator - requires a PRNG backend, e.g. prng4.js + + // For best results, put code like + // + // in your main HTML document. + + var rng_state; + var rng_pool; + var rng_pptr; + + // Mix in a 32-bit integer into the pool + function rng_seed_int(x) { + rng_pool[rng_pptr++] ^= x & 255; + rng_pool[rng_pptr++] ^= (x >> 8) & 255; + rng_pool[rng_pptr++] ^= (x >> 16) & 255; + rng_pool[rng_pptr++] ^= (x >> 24) & 255; + if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; + } + + // Mix in the current time (w/milliseconds) into the pool + function rng_seed_time() { + rng_seed_int(new Date().getTime()); + } + + // Initialize the pool with junk if needed. + if(rng_pool == null) { + rng_pool = new Array(); + rng_pptr = 0; + var t; + if(typeof window !== "undefined" && window.crypto) { + if (window.crypto.getRandomValues) { + // Use webcrypto if available + var ua = new Uint8Array(32); + window.crypto.getRandomValues(ua); + for(t = 0; t < 32; ++t) + rng_pool[rng_pptr++] = ua[t]; + } + else if(navigator.appName == "Netscape" && navigator.appVersion < "5") { + // Extract entropy (256 bits) from NS4 RNG if available + var z = window.crypto.random(32); + for(t = 0; t < z.length; ++t) + rng_pool[rng_pptr++] = z.charCodeAt(t) & 255; + } + } + while(rng_pptr < rng_psize) { // extract some randomness from Math.random() + t = Math.floor(65536 * Math.random()); + rng_pool[rng_pptr++] = t >>> 8; + rng_pool[rng_pptr++] = t & 255; + } + rng_pptr = 0; + rng_seed_time(); + //rng_seed_int(window.screenX); + //rng_seed_int(window.screenY); + } + + function rng_get_byte() { + if(rng_state == null) { + rng_seed_time(); + rng_state = prng_newstate(); + rng_state.init(rng_pool); + for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) + rng_pool[rng_pptr] = 0; + rng_pptr = 0; + //rng_pool = null; + } + // TODO: allow reseeding after first request + return rng_state.next(); + } + + function rng_get_bytes(ba) { + var i; + for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); + } + + function SecureRandom() {} + + SecureRandom.prototype.nextBytes = rng_get_bytes; + + // prng4.js - uses Arcfour as a PRNG + + function Arcfour() { + this.i = 0; + this.j = 0; + this.S = new Array(); + } + + // Initialize arcfour context from key, an array of ints, each from [0..255] + function ARC4init(key) { + var i, j, t; + for(i = 0; i < 256; ++i) + this.S[i] = i; + j = 0; + for(i = 0; i < 256; ++i) { + j = (j + this.S[i] + key[i % key.length]) & 255; + t = this.S[i]; + this.S[i] = this.S[j]; + this.S[j] = t; + } + this.i = 0; + this.j = 0; + } + + function ARC4next() { + var t; + this.i = (this.i + 1) & 255; + this.j = (this.j + this.S[this.i]) & 255; + t = this.S[this.i]; + this.S[this.i] = this.S[this.j]; + this.S[this.j] = t; + return this.S[(t + this.S[this.i]) & 255]; + } + + Arcfour.prototype.init = ARC4init; + Arcfour.prototype.next = ARC4next; + + // Plug in your RNG constructor here + function prng_newstate() { + return new Arcfour(); + } + + // Pool size must be a multiple of 4 and greater than 32. + // An array of bytes the size of the pool will be passed to init() + var rng_psize = 256; + + if (typeof exports !== 'undefined') { + exports = module.exports = { + default: BigInteger, + BigInteger: BigInteger, + SecureRandom: SecureRandom, + }; + } else { + this.jsbn = { + BigInteger: BigInteger, + SecureRandom: SecureRandom + }; + } + +}).call(this); diff --git a/node_modules/npm/node_modules/jsbn/package.json b/node_modules/npm/node_modules/jsbn/package.json new file mode 100644 index 00000000..97b137c2 --- /dev/null +++ b/node_modules/npm/node_modules/jsbn/package.json @@ -0,0 +1,21 @@ +{ + "name": "jsbn", + "version": "1.1.0", + "description": "The jsbn library is a fast, portable implementation of large-number math in pure JavaScript, enabling public-key crypto and other applications on desktop and mobile browsers.", + "main": "index.js", + "scripts": { + "test": "mocha test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/andyperlitch/jsbn.git" + }, + "keywords": [ + "biginteger", + "bignumber", + "big", + "integer" + ], + "author": "Tom Wu", + "license": "MIT" +} diff --git a/node_modules/npm/node_modules/jsbn/test/es6-import.js b/node_modules/npm/node_modules/jsbn/test/es6-import.js new file mode 100644 index 00000000..668cbdfd --- /dev/null +++ b/node_modules/npm/node_modules/jsbn/test/es6-import.js @@ -0,0 +1,3 @@ +import {BigInteger} from '../'; + +console.log(typeof BigInteger) diff --git a/node_modules/npm/node_modules/json-parse-even-better-errors/LICENSE.md b/node_modules/npm/node_modules/json-parse-even-better-errors/LICENSE.md new file mode 100644 index 00000000..6991b7cb --- /dev/null +++ b/node_modules/npm/node_modules/json-parse-even-better-errors/LICENSE.md @@ -0,0 +1,25 @@ +Copyright 2017 Kat Marchán +Copyright 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. + +--- + +This library is a fork of 'better-json-errors' by Kat Marchán, extended and +distributed under the terms of the MIT license above. diff --git a/node_modules/npm/node_modules/json-parse-even-better-errors/lib/index.js b/node_modules/npm/node_modules/json-parse-even-better-errors/lib/index.js new file mode 100644 index 00000000..3ffdaac9 --- /dev/null +++ b/node_modules/npm/node_modules/json-parse-even-better-errors/lib/index.js @@ -0,0 +1,137 @@ +'use strict' + +const INDENT = Symbol.for('indent') +const NEWLINE = Symbol.for('newline') + +const DEFAULT_NEWLINE = '\n' +const DEFAULT_INDENT = ' ' +const BOM = /^\uFEFF/ + +// only respect indentation if we got a line break, otherwise squash it +// things other than objects and arrays aren't indented, so ignore those +// Important: in both of these regexps, the $1 capture group is the newline +// or undefined, and the $2 capture group is the indent, or undefined. +const FORMAT = /^\s*[{[]((?:\r?\n)+)([\s\t]*)/ +const EMPTY = /^(?:\{\}|\[\])((?:\r?\n)+)?$/ + +// Node 20 puts single quotes around the token and a comma after it +const UNEXPECTED_TOKEN = /^Unexpected token '?(.)'?(,)? /i + +const hexify = (char) => { + const h = char.charCodeAt(0).toString(16).toUpperCase() + return `0x${h.length % 2 ? '0' : ''}${h}` +} + +// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) +// because the buffer-to-string conversion in `fs.readFileSync()` +// translates it to FEFF, the UTF-16 BOM. +const stripBOM = (txt) => String(txt).replace(BOM, '') + +const makeParsedError = (msg, parsing, position = 0) => ({ + message: `${msg} while parsing ${parsing}`, + position, +}) + +const parseError = (e, txt, context = 20) => { + let msg = e.message + + if (!txt) { + return makeParsedError(msg, 'empty string') + } + + const badTokenMatch = msg.match(UNEXPECTED_TOKEN) + const badIndexMatch = msg.match(/ position\s+(\d+)/i) + + if (badTokenMatch) { + msg = msg.replace( + UNEXPECTED_TOKEN, + `Unexpected token ${JSON.stringify(badTokenMatch[1])} (${hexify(badTokenMatch[1])})$2 ` + ) + } + + let errIdx + if (badIndexMatch) { + errIdx = +badIndexMatch[1] + } else /* istanbul ignore next - doesnt happen in Node 22 */ if ( + msg.match(/^Unexpected end of JSON.*/i) + ) { + errIdx = txt.length - 1 + } + + if (errIdx == null) { + return makeParsedError(msg, `'${txt.slice(0, context * 2)}'`) + } + + const start = errIdx <= context ? 0 : errIdx - context + const end = errIdx + context >= txt.length ? txt.length : errIdx + context + const slice = `${start ? '...' : ''}${txt.slice(start, end)}${end === txt.length ? '' : '...'}` + + return makeParsedError( + msg, + `${txt === slice ? '' : 'near '}${JSON.stringify(slice)}`, + errIdx + ) +} + +class JSONParseError extends SyntaxError { + constructor (er, txt, context, caller) { + const metadata = parseError(er, txt, context) + super(metadata.message) + Object.assign(this, metadata) + this.code = 'EJSONPARSE' + this.systemError = er + Error.captureStackTrace(this, caller || this.constructor) + } + + get name () { + return this.constructor.name + } + + set name (n) {} + + get [Symbol.toStringTag] () { + return this.constructor.name + } +} + +const parseJson = (txt, reviver) => { + const result = JSON.parse(txt, reviver) + if (result && typeof result === 'object') { + // get the indentation so that we can save it back nicely + // if the file starts with {" then we have an indent of '', ie, none + // otherwise, pick the indentation of the next line after the first \n If the + // pattern doesn't match, then it means no indentation. JSON.stringify ignores + // symbols, so this is reasonably safe. if the string is '{}' or '[]', then + // use the default 2-space indent. + const match = txt.match(EMPTY) || txt.match(FORMAT) || [null, '', ''] + result[NEWLINE] = match[1] ?? DEFAULT_NEWLINE + result[INDENT] = match[2] ?? DEFAULT_INDENT + } + return result +} + +const parseJsonError = (raw, reviver, context) => { + const txt = stripBOM(raw) + try { + return parseJson(txt, reviver) + } catch (e) { + if (typeof raw !== 'string' && !Buffer.isBuffer(raw)) { + const msg = Array.isArray(raw) && raw.length === 0 ? 'an empty array' : String(raw) + throw Object.assign( + new TypeError(`Cannot parse ${msg}`), + { code: 'EJSONPARSE', systemError: e } + ) + } + throw new JSONParseError(e, txt, context, parseJsonError) + } +} + +module.exports = parseJsonError +parseJsonError.JSONParseError = JSONParseError +parseJsonError.noExceptions = (raw, reviver) => { + try { + return parseJson(stripBOM(raw), reviver) + } catch { + // no exceptions + } +} diff --git a/node_modules/npm/node_modules/json-parse-even-better-errors/package.json b/node_modules/npm/node_modules/json-parse-even-better-errors/package.json new file mode 100644 index 00000000..193f0d9d --- /dev/null +++ b/node_modules/npm/node_modules/json-parse-even-better-errors/package.json @@ -0,0 +1,50 @@ +{ + "name": "json-parse-even-better-errors", + "version": "4.0.0", + "description": "JSON.parse with context information on error", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/json-parse-even-better-errors.git" + }, + "keywords": [ + "JSON", + "parser" + ], + "author": "GitHub Inc.", + "license": "MIT", + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.3.0" + }, + "tap": { + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + } +} diff --git a/node_modules/npm/node_modules/json-stringify-nice/LICENSE b/node_modules/npm/node_modules/json-stringify-nice/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/json-stringify-nice/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/json-stringify-nice/index.js b/node_modules/npm/node_modules/json-stringify-nice/index.js new file mode 100644 index 00000000..36557bb0 --- /dev/null +++ b/node_modules/npm/node_modules/json-stringify-nice/index.js @@ -0,0 +1,38 @@ +const isObj = val => !!val && !Array.isArray(val) && typeof val === 'object' + +const compare = (ak, bk, prefKeys) => + prefKeys.includes(ak) && !prefKeys.includes(bk) ? -1 + : prefKeys.includes(bk) && !prefKeys.includes(ak) ? 1 + : prefKeys.includes(ak) && prefKeys.includes(bk) + ? prefKeys.indexOf(ak) - prefKeys.indexOf(bk) + : ak.localeCompare(bk, 'en') + +const sort = (replacer, seen) => (key, val) => { + const prefKeys = Array.isArray(replacer) ? replacer : [] + + if (typeof replacer === 'function') + val = replacer(key, val) + + if (!isObj(val)) + return val + + if (seen.has(val)) + return seen.get(val) + + const ret = Object.entries(val).sort( + ([ak, av], [bk, bv]) => + isObj(av) === isObj(bv) ? compare(ak, bk, prefKeys) + : isObj(av) ? 1 + : -1 + ).reduce((set, [k, v]) => { + set[k] = v + return set + }, {}) + + seen.set(val, ret) + return ret +} + +module.exports = (obj, replacer, space = 2) => + JSON.stringify(obj, sort(replacer, new Map()), space) + + (space ? '\n' : '') diff --git a/node_modules/npm/node_modules/json-stringify-nice/package.json b/node_modules/npm/node_modules/json-stringify-nice/package.json new file mode 100644 index 00000000..c9663290 --- /dev/null +++ b/node_modules/npm/node_modules/json-stringify-nice/package.json @@ -0,0 +1,40 @@ +{ + "name": "json-stringify-nice", + "version": "1.1.4", + "description": "Stringify an object sorting scalars before objects, and defaulting to 2-space indent", + "author": "Isaac Z. Schlueter (https://izs.me)", + "license": "ISC", + "scripts": { + "test": "tap", + "posttest": "npm run lint", + "snap": "tap", + "postsnap": "npm run lintfix", + "eslint": "eslint", + "lint": "npm run eslint -- index.js test/**/*.js", + "lintfix": "npm run lint -- --fix", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags" + }, + "tap": { + "test-env": [ + "LC_ALL=sk" + ], + "check-coverage": true + }, + "devDependencies": { + "eslint": "^7.25.0", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^5.1.0", + "eslint-plugin-standard": "^5.0.0", + "tap": "^15.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "repository": "https://github.com/isaacs/json-stringify-nice", + "files": [ + "index.js" + ] +} diff --git a/node_modules/npm/node_modules/jsonparse/LICENSE b/node_modules/npm/node_modules/jsonparse/LICENSE new file mode 100644 index 00000000..6dc24be5 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/LICENSE @@ -0,0 +1,24 @@ +The MIT License + +Copyright (c) 2012 Tim Caswell + +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/npm/node_modules/jsonparse/bench.js b/node_modules/npm/node_modules/jsonparse/bench.js new file mode 100644 index 00000000..b36d92f7 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/bench.js @@ -0,0 +1,26 @@ +var fs = require('fs'), + Parser = require('./jsonparse'); + + +var json = fs.readFileSync("samplejson/basic.json"); + + +while (true) { + var start = Date.now(); + for (var i = 0; i < 1000; i++) { + JSON.parse(json); + } + var first = Date.now() - start; + + start = Date.now(); + var p = new Parser(); + for (var i = 0; i < 1000; i++) { + p.write(json); + } + var second = Date.now() - start; + + + console.log("JSON.parse took %s", first); + console.log("streaming parser took %s", second); + console.log("streaming is %s times slower", second / first); +} diff --git a/node_modules/npm/node_modules/jsonparse/examples/twitterfeed.js b/node_modules/npm/node_modules/jsonparse/examples/twitterfeed.js new file mode 100644 index 00000000..10210d47 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/examples/twitterfeed.js @@ -0,0 +1,30 @@ +var Parser = require('../jsonparse'); +var Http = require('http'); +require('./colors'); +var p = new Parser(); +var cred = require('./credentials'); +var client = Http.createClient(80, "stream.twitter.com"); +var request = client.request("GET", "/1/statuses/sample.json", { + "Host": "stream.twitter.com", + "Authorization": (new Buffer(cred.username + ":" + cred.password)).toString("base64") +}); +request.on('response', function (response) { + console.log(response.statusCode); + console.dir(response.headers); + response.on('data', function (chunk) { + p.write(chunk); + }); + response.on('end', function () { + console.log("END"); + }); +}); +request.end(); +var text = "", name = ""; +p.onValue = function (value) { + if (this.stack.length === 1 && this.key === 'text') { text = value; } + if (this.stack.length === 2 && this.key === 'name' && this.stack[1].key === 'user') { name = value; } + if (this.stack.length === 0) { + console.log(text.blue + " - " + name.yellow); + text = name = ""; + } +}; diff --git a/node_modules/npm/node_modules/jsonparse/jsonparse.js b/node_modules/npm/node_modules/jsonparse/jsonparse.js new file mode 100644 index 00000000..39910608 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/jsonparse.js @@ -0,0 +1,413 @@ +/*global Buffer*/ +// Named constants with unique integer values +var C = {}; +// Tokens +var LEFT_BRACE = C.LEFT_BRACE = 0x1; +var RIGHT_BRACE = C.RIGHT_BRACE = 0x2; +var LEFT_BRACKET = C.LEFT_BRACKET = 0x3; +var RIGHT_BRACKET = C.RIGHT_BRACKET = 0x4; +var COLON = C.COLON = 0x5; +var COMMA = C.COMMA = 0x6; +var TRUE = C.TRUE = 0x7; +var FALSE = C.FALSE = 0x8; +var NULL = C.NULL = 0x9; +var STRING = C.STRING = 0xa; +var NUMBER = C.NUMBER = 0xb; +// Tokenizer States +var START = C.START = 0x11; +var STOP = C.STOP = 0x12; +var TRUE1 = C.TRUE1 = 0x21; +var TRUE2 = C.TRUE2 = 0x22; +var TRUE3 = C.TRUE3 = 0x23; +var FALSE1 = C.FALSE1 = 0x31; +var FALSE2 = C.FALSE2 = 0x32; +var FALSE3 = C.FALSE3 = 0x33; +var FALSE4 = C.FALSE4 = 0x34; +var NULL1 = C.NULL1 = 0x41; +var NULL2 = C.NULL2 = 0x42; +var NULL3 = C.NULL3 = 0x43; +var NUMBER1 = C.NUMBER1 = 0x51; +var NUMBER3 = C.NUMBER3 = 0x53; +var STRING1 = C.STRING1 = 0x61; +var STRING2 = C.STRING2 = 0x62; +var STRING3 = C.STRING3 = 0x63; +var STRING4 = C.STRING4 = 0x64; +var STRING5 = C.STRING5 = 0x65; +var STRING6 = C.STRING6 = 0x66; +// Parser States +var VALUE = C.VALUE = 0x71; +var KEY = C.KEY = 0x72; +// Parser Modes +var OBJECT = C.OBJECT = 0x81; +var ARRAY = C.ARRAY = 0x82; +// Character constants +var BACK_SLASH = "\\".charCodeAt(0); +var FORWARD_SLASH = "\/".charCodeAt(0); +var BACKSPACE = "\b".charCodeAt(0); +var FORM_FEED = "\f".charCodeAt(0); +var NEWLINE = "\n".charCodeAt(0); +var CARRIAGE_RETURN = "\r".charCodeAt(0); +var TAB = "\t".charCodeAt(0); + +var STRING_BUFFER_SIZE = 64 * 1024; + +function Parser() { + this.tState = START; + this.value = undefined; + + this.string = undefined; // string data + this.stringBuffer = Buffer.alloc ? Buffer.alloc(STRING_BUFFER_SIZE) : new Buffer(STRING_BUFFER_SIZE); + this.stringBufferOffset = 0; + this.unicode = undefined; // unicode escapes + this.highSurrogate = undefined; + + this.key = undefined; + this.mode = undefined; + this.stack = []; + this.state = VALUE; + this.bytes_remaining = 0; // number of bytes remaining in multi byte utf8 char to read after split boundary + this.bytes_in_sequence = 0; // bytes in multi byte utf8 char to read + this.temp_buffs = { "2": new Buffer(2), "3": new Buffer(3), "4": new Buffer(4) }; // for rebuilding chars split before boundary is reached + + // Stream offset + this.offset = -1; +} + +// Slow code to string converter (only used when throwing syntax errors) +Parser.toknam = function (code) { + var keys = Object.keys(C); + for (var i = 0, l = keys.length; i < l; i++) { + var key = keys[i]; + if (C[key] === code) { return key; } + } + return code && ("0x" + code.toString(16)); +}; + +var proto = Parser.prototype; +proto.onError = function (err) { throw err; }; +proto.charError = function (buffer, i) { + this.tState = STOP; + this.onError(new Error("Unexpected " + JSON.stringify(String.fromCharCode(buffer[i])) + " at position " + i + " in state " + Parser.toknam(this.tState))); +}; +proto.appendStringChar = function (char) { + if (this.stringBufferOffset >= STRING_BUFFER_SIZE) { + this.string += this.stringBuffer.toString('utf8'); + this.stringBufferOffset = 0; + } + + this.stringBuffer[this.stringBufferOffset++] = char; +}; +proto.appendStringBuf = function (buf, start, end) { + var size = buf.length; + if (typeof start === 'number') { + if (typeof end === 'number') { + if (end < 0) { + // adding a negative end decreeses the size + size = buf.length - start + end; + } else { + size = end - start; + } + } else { + size = buf.length - start; + } + } + + if (size < 0) { + size = 0; + } + + if (this.stringBufferOffset + size > STRING_BUFFER_SIZE) { + this.string += this.stringBuffer.toString('utf8', 0, this.stringBufferOffset); + this.stringBufferOffset = 0; + } + + buf.copy(this.stringBuffer, this.stringBufferOffset, start, end); + this.stringBufferOffset += size; +}; +proto.write = function (buffer) { + if (typeof buffer === "string") buffer = new Buffer(buffer); + var n; + for (var i = 0, l = buffer.length; i < l; i++) { + if (this.tState === START){ + n = buffer[i]; + this.offset++; + if(n === 0x7b){ this.onToken(LEFT_BRACE, "{"); // { + }else if(n === 0x7d){ this.onToken(RIGHT_BRACE, "}"); // } + }else if(n === 0x5b){ this.onToken(LEFT_BRACKET, "["); // [ + }else if(n === 0x5d){ this.onToken(RIGHT_BRACKET, "]"); // ] + }else if(n === 0x3a){ this.onToken(COLON, ":"); // : + }else if(n === 0x2c){ this.onToken(COMMA, ","); // , + }else if(n === 0x74){ this.tState = TRUE1; // t + }else if(n === 0x66){ this.tState = FALSE1; // f + }else if(n === 0x6e){ this.tState = NULL1; // n + }else if(n === 0x22){ // " + this.string = ""; + this.stringBufferOffset = 0; + this.tState = STRING1; + }else if(n === 0x2d){ this.string = "-"; this.tState = NUMBER1; // - + }else{ + if (n >= 0x30 && n < 0x40) { // 1-9 + this.string = String.fromCharCode(n); this.tState = NUMBER3; + } else if (n === 0x20 || n === 0x09 || n === 0x0a || n === 0x0d) { + // whitespace + } else { + return this.charError(buffer, i); + } + } + }else if (this.tState === STRING1){ // After open quote + n = buffer[i]; // get current byte from buffer + // check for carry over of a multi byte char split between data chunks + // & fill temp buffer it with start of this data chunk up to the boundary limit set in the last iteration + if (this.bytes_remaining > 0) { + for (var j = 0; j < this.bytes_remaining; j++) { + this.temp_buffs[this.bytes_in_sequence][this.bytes_in_sequence - this.bytes_remaining + j] = buffer[j]; + } + + this.appendStringBuf(this.temp_buffs[this.bytes_in_sequence]); + this.bytes_in_sequence = this.bytes_remaining = 0; + i = i + j - 1; + } else if (this.bytes_remaining === 0 && n >= 128) { // else if no remainder bytes carried over, parse multi byte (>=128) chars one at a time + if (n <= 193 || n > 244) { + return this.onError(new Error("Invalid UTF-8 character at position " + i + " in state " + Parser.toknam(this.tState))); + } + if ((n >= 194) && (n <= 223)) this.bytes_in_sequence = 2; + if ((n >= 224) && (n <= 239)) this.bytes_in_sequence = 3; + if ((n >= 240) && (n <= 244)) this.bytes_in_sequence = 4; + if ((this.bytes_in_sequence + i) > buffer.length) { // if bytes needed to complete char fall outside buffer length, we have a boundary split + for (var k = 0; k <= (buffer.length - 1 - i); k++) { + this.temp_buffs[this.bytes_in_sequence][k] = buffer[i + k]; // fill temp buffer of correct size with bytes available in this chunk + } + this.bytes_remaining = (i + this.bytes_in_sequence) - buffer.length; + i = buffer.length - 1; + } else { + this.appendStringBuf(buffer, i, i + this.bytes_in_sequence); + i = i + this.bytes_in_sequence - 1; + } + } else if (n === 0x22) { + this.tState = START; + this.string += this.stringBuffer.toString('utf8', 0, this.stringBufferOffset); + this.stringBufferOffset = 0; + this.onToken(STRING, this.string); + this.offset += Buffer.byteLength(this.string, 'utf8') + 1; + this.string = undefined; + } + else if (n === 0x5c) { + this.tState = STRING2; + } + else if (n >= 0x20) { this.appendStringChar(n); } + else { + return this.charError(buffer, i); + } + }else if (this.tState === STRING2){ // After backslash + n = buffer[i]; + if(n === 0x22){ this.appendStringChar(n); this.tState = STRING1; + }else if(n === 0x5c){ this.appendStringChar(BACK_SLASH); this.tState = STRING1; + }else if(n === 0x2f){ this.appendStringChar(FORWARD_SLASH); this.tState = STRING1; + }else if(n === 0x62){ this.appendStringChar(BACKSPACE); this.tState = STRING1; + }else if(n === 0x66){ this.appendStringChar(FORM_FEED); this.tState = STRING1; + }else if(n === 0x6e){ this.appendStringChar(NEWLINE); this.tState = STRING1; + }else if(n === 0x72){ this.appendStringChar(CARRIAGE_RETURN); this.tState = STRING1; + }else if(n === 0x74){ this.appendStringChar(TAB); this.tState = STRING1; + }else if(n === 0x75){ this.unicode = ""; this.tState = STRING3; + }else{ + return this.charError(buffer, i); + } + }else if (this.tState === STRING3 || this.tState === STRING4 || this.tState === STRING5 || this.tState === STRING6){ // unicode hex codes + n = buffer[i]; + // 0-9 A-F a-f + if ((n >= 0x30 && n < 0x40) || (n > 0x40 && n <= 0x46) || (n > 0x60 && n <= 0x66)) { + this.unicode += String.fromCharCode(n); + if (this.tState++ === STRING6) { + var intVal = parseInt(this.unicode, 16); + this.unicode = undefined; + if (this.highSurrogate !== undefined && intVal >= 0xDC00 && intVal < (0xDFFF + 1)) { //<56320,57343> - lowSurrogate + this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate, intVal))); + this.highSurrogate = undefined; + } else if (this.highSurrogate === undefined && intVal >= 0xD800 && intVal < (0xDBFF + 1)) { //<55296,56319> - highSurrogate + this.highSurrogate = intVal; + } else { + if (this.highSurrogate !== undefined) { + this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate))); + this.highSurrogate = undefined; + } + this.appendStringBuf(new Buffer(String.fromCharCode(intVal))); + } + this.tState = STRING1; + } + } else { + return this.charError(buffer, i); + } + } else if (this.tState === NUMBER1 || this.tState === NUMBER3) { + n = buffer[i]; + + switch (n) { + case 0x30: // 0 + case 0x31: // 1 + case 0x32: // 2 + case 0x33: // 3 + case 0x34: // 4 + case 0x35: // 5 + case 0x36: // 6 + case 0x37: // 7 + case 0x38: // 8 + case 0x39: // 9 + case 0x2e: // . + case 0x65: // e + case 0x45: // E + case 0x2b: // + + case 0x2d: // - + this.string += String.fromCharCode(n); + this.tState = NUMBER3; + break; + default: + this.tState = START; + var result = Number(this.string); + + if (isNaN(result)){ + return this.charError(buffer, i); + } + + if ((this.string.match(/[0-9]+/) == this.string) && (result.toString() != this.string)) { + // Long string of digits which is an ID string and not valid and/or safe JavaScript integer Number + this.onToken(STRING, this.string); + } else { + this.onToken(NUMBER, result); + } + + this.offset += this.string.length - 1; + this.string = undefined; + i--; + break; + } + }else if (this.tState === TRUE1){ // r + if (buffer[i] === 0x72) { this.tState = TRUE2; } + else { return this.charError(buffer, i); } + }else if (this.tState === TRUE2){ // u + if (buffer[i] === 0x75) { this.tState = TRUE3; } + else { return this.charError(buffer, i); } + }else if (this.tState === TRUE3){ // e + if (buffer[i] === 0x65) { this.tState = START; this.onToken(TRUE, true); this.offset+= 3; } + else { return this.charError(buffer, i); } + }else if (this.tState === FALSE1){ // a + if (buffer[i] === 0x61) { this.tState = FALSE2; } + else { return this.charError(buffer, i); } + }else if (this.tState === FALSE2){ // l + if (buffer[i] === 0x6c) { this.tState = FALSE3; } + else { return this.charError(buffer, i); } + }else if (this.tState === FALSE3){ // s + if (buffer[i] === 0x73) { this.tState = FALSE4; } + else { return this.charError(buffer, i); } + }else if (this.tState === FALSE4){ // e + if (buffer[i] === 0x65) { this.tState = START; this.onToken(FALSE, false); this.offset+= 4; } + else { return this.charError(buffer, i); } + }else if (this.tState === NULL1){ // u + if (buffer[i] === 0x75) { this.tState = NULL2; } + else { return this.charError(buffer, i); } + }else if (this.tState === NULL2){ // l + if (buffer[i] === 0x6c) { this.tState = NULL3; } + else { return this.charError(buffer, i); } + }else if (this.tState === NULL3){ // l + if (buffer[i] === 0x6c) { this.tState = START; this.onToken(NULL, null); this.offset += 3; } + else { return this.charError(buffer, i); } + } + } +}; +proto.onToken = function (token, value) { + // Override this to get events +}; + +proto.parseError = function (token, value) { + this.tState = STOP; + this.onError(new Error("Unexpected " + Parser.toknam(token) + (value ? ("(" + JSON.stringify(value) + ")") : "") + " in state " + Parser.toknam(this.state))); +}; +proto.push = function () { + this.stack.push({value: this.value, key: this.key, mode: this.mode}); +}; +proto.pop = function () { + var value = this.value; + var parent = this.stack.pop(); + this.value = parent.value; + this.key = parent.key; + this.mode = parent.mode; + this.emit(value); + if (!this.mode) { this.state = VALUE; } +}; +proto.emit = function (value) { + if (this.mode) { this.state = COMMA; } + this.onValue(value); +}; +proto.onValue = function (value) { + // Override me +}; +proto.onToken = function (token, value) { + if(this.state === VALUE){ + if(token === STRING || token === NUMBER || token === TRUE || token === FALSE || token === NULL){ + if (this.value) { + this.value[this.key] = value; + } + this.emit(value); + }else if(token === LEFT_BRACE){ + this.push(); + if (this.value) { + this.value = this.value[this.key] = {}; + } else { + this.value = {}; + } + this.key = undefined; + this.state = KEY; + this.mode = OBJECT; + }else if(token === LEFT_BRACKET){ + this.push(); + if (this.value) { + this.value = this.value[this.key] = []; + } else { + this.value = []; + } + this.key = 0; + this.mode = ARRAY; + this.state = VALUE; + }else if(token === RIGHT_BRACE){ + if (this.mode === OBJECT) { + this.pop(); + } else { + return this.parseError(token, value); + } + }else if(token === RIGHT_BRACKET){ + if (this.mode === ARRAY) { + this.pop(); + } else { + return this.parseError(token, value); + } + }else{ + return this.parseError(token, value); + } + }else if(this.state === KEY){ + if (token === STRING) { + this.key = value; + this.state = COLON; + } else if (token === RIGHT_BRACE) { + this.pop(); + } else { + return this.parseError(token, value); + } + }else if(this.state === COLON){ + if (token === COLON) { this.state = VALUE; } + else { return this.parseError(token, value); } + }else if(this.state === COMMA){ + if (token === COMMA) { + if (this.mode === ARRAY) { this.key++; this.state = VALUE; } + else if (this.mode === OBJECT) { this.state = KEY; } + + } else if (token === RIGHT_BRACKET && this.mode === ARRAY || token === RIGHT_BRACE && this.mode === OBJECT) { + this.pop(); + } else { + return this.parseError(token, value); + } + }else{ + return this.parseError(token, value); + } +}; + +Parser.C = C; + +module.exports = Parser; diff --git a/node_modules/npm/node_modules/jsonparse/package.json b/node_modules/npm/node_modules/jsonparse/package.json new file mode 100644 index 00000000..a2312ee0 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/package.json @@ -0,0 +1,22 @@ +{ + "name": "jsonparse", + "description": "This is a pure-js JSON streaming parser for node.js", + "tags": ["json", "stream"], + "version": "1.3.1", + "author": "Tim Caswell ", + "repository": { + "type": "git", + "url": "http://github.com/creationix/jsonparse.git" + }, + "devDependencies": { + "tape": "~0.1.1", + "tap": "~0.3.3" + }, + "scripts": { + "test": "tap test/*.js" + }, + "bugs": "http://github.com/creationix/jsonparse/issues", + "engines": ["node >= 0.2.0"], + "license": "MIT", + "main": "jsonparse.js" +} diff --git a/node_modules/npm/node_modules/jsonparse/samplejson/basic.json b/node_modules/npm/node_modules/jsonparse/samplejson/basic.json new file mode 100644 index 00000000..950dff9e --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/samplejson/basic.json @@ -0,0 +1,167 @@ +[ + { + }, + { + "image": [ + {"shape": "rect", "fill": "#333", "stroke": "#999", "x": 0.5e+1, "y": 0.5, "z": 0.8e-0, "w": 0.5e5, "u": 2E10, "foo": 2E+1, "bar": 2E-0, "width": 47, "height": 47} + ], + "jumpable": 3, + "solid": { + "1": [2,4], + "2": [], + "3": [2,6], + "4": [], + "5": [2,8,1,3,7,9,4,6], + "6": [], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": true,"3": true,"7": true,"9": true} + }, + { + "image": [ + {"shape": "polygon", "fill": "#248", "stroke": "#48f", "points": [[0.5,47.5],[47.5,47.5],[47.5,0.5]]} + ], + "solid": { + "1": [2,4], + "2": [1], + "3": [2], + "4": [], + "5": [2,8,1,3,7,9,4,6], + "6": [], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": true,"3": true,"7": false,"9": true} + }, + { + "image": [ + {"shape": "polygon", "fill": "#248", "stroke": "#48f", "points": [[0.5,0.5],[47.5,47.5],[0.5,47.5]]} + ], + "solid": { + "1": [2], + "2": [3], + "3": [2,6], + "4": [], + "5": [2,8,1,3,7,9,4,6], + "6": [], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": true,"3": true,"7": true,"9": false} + }, + { + "image": [ + {"shape": "polygon", "fill": "#333", "stroke": "#999", "points": [[0.5,0.5],[47.5,47.5],[47.5,0.5]]} + ], + "jumpable": 3, + "solid": { + "1": [2,4], + "2": [], + "3": [2,6], + "4": [], + "5": [2,8,1,3,7,9,4,6], + "6": [3], + "7": [4,8], + "8": [7], + "9": [6,8] + }, + "corners": {"1": false,"3": true,"7": true,"9": true} + }, + { + "image": [ + {"shape": "polygon", "fill": "#333", "stroke": "#999", "points": [[0.5,0.5],[0.5,47.5],[47.5,0.5]]} + ], + "jumpable": 3, + "solid": { + "1": [2,4], + "2": [], + "3": [2,6], + "4": [1], + "5": [2,8,1,3,7,9,4,6], + "6": [], + "7": [4,8], + "8": [9], + "9": [6,8] + }, + "corners": {"1": true,"3": false,"7": true,"9": true} + }, + { + "image": [ + {"shape": "polygon", "fill": "#482", "stroke": "#8f4", "points": [[0.5,47.5],[0.5,23.5],[24.5,23.5],[24.5,0.5],[47.5,0.5],[47.5,47.5]]} + ], + "jumpable": 3, + "solid": { + "1": [2,4], + "2": [], + "3": [6,2], + "4": [], + "5": [2,8,1,3,7,9,4,6], + "6": [9], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": true,"3": true,"7": false,"9": true} + }, + { + "image": [ + {"shape": "polygon", "fill": "#482", "stroke": "#8f4", "points": [[0.5,0.5],[23.5,0.5],[23.5,24.5],[47.5,24.5],[47.5,47.5],[0.5,47.5]]} + ], + "jumpable": 3, + "solid": { + "1": [4,2], + "2": [], + "3": [2,6], + "4": [7], + "5": [2,8,1,3,7,9,4,6], + "6": [], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": true,"3": true,"7": true,"9": false} + }, + { + "image": [ + {"shape": "circle", "fill": "#ff0", "stroke": "#ff8", "cx": 24, "cy": 24, "r": 18} + ], + "item": true + }, + { + "image": [ + {"shape": "polygon", "fill": "#842", "stroke": "#f84", "points": [[4.5,0.5],[14.5,0.5],[14.5,17.5],[34,17.5],[33.5,0.5],[43.5,0.5],[43.5,47.5],[33.5,47.5],[33.5,30.5],[14.5,30.5],[14.5,47.5],[4.5,47.5]]} + ], + "jumpable": 3 + }, + { + "image": [ + {"shape": "polygon", "fill": "#333", "stroke": "#999", "points": [[0.5,0.5],[47.5,0.5],[24,47.5]]} + ], + "jumpable": 3, + "solid": { + "1": [2,4], + "2": [], + "3": [2,6], + "4": [1], + "5": [2,8,1,3,7,9,4,6], + "6": [3], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": false,"3": false,"7": true,"9": true} + }, + { + "image": [ + {"shape": "rect", "fill": "#114acb", "x": 0.5, "y": 0.5, "width": 47, "height": 47}, + {"shape": "polygon", "fill": "rgba(255,255,255,0.30)", "points": [[0.5,0.5],[47.5,0.5],[40,8],[8,8],[8,40],[0.5,47.5]]}, + {"shape": "polygon", "fill": "rgba(0,0,0,0.30)", "points": [[47.5,0.5],[48,48],[0.5,47.5],[8,40],[40,40],[40,8]]}, + {"shape": "polygon", "fill": "rgb(255,255,0)", "stroke": "rgba(255,255,0,0.5)", "points": [[24,9],[35,20],[26,29],[26,33],[22,33],[22,27],[29,20],[24,15],[16,23],[13,20]]}, + {"shape": "rect", "fill": "rgb(255,255,0)", "stroke": "rgba(255,255,0,0.5)", "x": 22, "y":35, "width": 4, "height": 4} + ] + } +] diff --git a/node_modules/npm/node_modules/jsonparse/samplejson/basic2.json b/node_modules/npm/node_modules/jsonparse/samplejson/basic2.json new file mode 100644 index 00000000..3a6919b2 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/samplejson/basic2.json @@ -0,0 +1,180 @@ +[ + { + }, + { + "image": [ + {"shape": "rect", "fill": "#333", "stroke": "#999", "x": 0.5, "y": 0.5, "width": 47, "height": 47} + ], + "jumpable": 3, + "solid": { + "1": [2,4], + "2": [], + "3": [2,6], + "4": [], + "5": [2,8,1,3,7,9,4,6], + "6": [], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": true,"3": true,"7": true,"9": true} + }, + { + "image": [ + {"shape": "polygon", "fill": "#248", "stroke": "#48f", "points": [[0.5,47.5],[47.5,47.5],[47.5,0.5]]} + ], + "solid": { + "1": [2,4], + "2": [1], + "3": [2], + "4": [], + "5": [2,8,1,3,7,9,4,6], + "6": [], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": true,"3": true,"7": false,"9": true} + }, + { + "image": [ + {"shape": "polygon", "fill": "#248", "stroke": "#48f", "points": [[0.5,0.5],[47.5,47.5],[0.5,47.5]]} + ], + "solid": { + "1": [2], + "2": [3], + "3": [2,6], + "4": [], + "5": [2,8,1,3,7,9,4,6], + "6": [], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": true,"3": true,"7": true,"9": false} + }, + { + "image": [ + {"shape": "polygon", "fill": "#333", "stroke": "#999", "points": [[0.5,0.5],[47.5,47.5],[47.5,0.5]]} + ], + "jumpable": 3, + "solid": { + "1": [2,4], + "2": [], + "3": [2,6], + "4": [], + "5": [2,8,1,3,7,9,4,6], + "6": [3], + "7": [4,8], + "8": [7], + "9": [6,8] + }, + "corners": {"1": false,"3": true,"7": true,"9": true} + }, + { + "image": [ + {"shape": "polygon", "fill": "#333", "stroke": "#999", "points": [[0.5,0.5],[0.5,47.5],[47.5,0.5]]} + ], + "jumpable": 3, + "solid": { + "1": [2,4], + "2": [], + "3": [2,6], + "4": [1], + "5": [2,8,1,3,7,9,4,6], + "6": [], + "7": [4,8], + "8": [9], + "9": [6,8] + }, + "corners": {"1": true,"3": false,"7": true,"9": true} + }, + { + "image": [ + {"shape": "polygon", "fill": "#482", "stroke": "#8f4", "points": [[0.5,47.5],[0.5,23.5],[24.5,23.5],[24.5,0.5],[47.5,0.5],[47.5,47.5]]} + ], + "jumpable": 3, + "solid": { + "1": [2,4], + "2": [], + "3": [6,2], + "4": [], + "5": [2,8,1,3,7,9,4,6], + "6": [9], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": true,"3": true,"7": false,"9": true} + }, + { + "image": [ + {"shape": "polygon", "fill": "#482", "stroke": "#8f4", "points": [[0.5,0.5],[23.5,0.5],[23.5,24.5],[47.5,24.5],[47.5,47.5],[0.5,47.5]]} + ], + "jumpable": 3, + "solid": { + "1": [4,2], + "2": [], + "3": [2,6], + "4": [7], + "5": [2,8,1,3,7,9,4,6], + "6": [], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": true,"3": true,"7": true,"9": false} + }, + { + "image": [ + {"shape": "circle", "fill": "#ff0", "stroke": "#ff8", "cx": 24, "cy": 24, "r": 18} + ], + "item": true + }, + { + "image": [ + {"shape": "polygon", "fill": "#842", "stroke": "#f84", "points": [[4.5,0.5],[14.5,0.5],[14.5,17.5],[34,17.5],[33.5,0.5],[43.5,0.5],[43.5,47.5],[33.5,47.5],[33.5,30.5],[14.5,30.5],[14.5,47.5],[4.5,47.5]]} + ], + "jumpable": 3 + }, + { + "image": [ + {"shape": "polygon", "fill": "#333", "stroke": "#999", "points": [[0.5,0.5],[47.5,0.5],[24,47.5]]} + ], + "jumpable": 3, + "solid": { + "1": [2,4], + "2": [], + "3": [2,6], + "4": [1], + "5": [2,8,1,3,7,9,4,6], + "6": [3], + "7": [4,8], + "8": [], + "9": [6,8] + }, + "corners": {"1": false,"3": false,"7": true,"9": true} + }, + { + "image": [ + {"shape": "rect", "fill": "#114acb", "x": 0.5, "y": 0.5, "width": 47, "height": 47}, + {"shape": "polygon", "fill": "rgba(255,255,255,0.30)", "points": [[0.5,0.5],[47.5,0.5],[40,8],[8,8],[8,40],[0.5,47.5]]}, + {"shape": "polygon", "fill": "rgba(0,0,0,0.30)", "points": [[47.5,0.5],[48,48],[0.5,47.5],[8,40],[40,40],[40,8]]}, + {"shape": "polygon", "fill": "rgb(255,255,0)", "stroke": "rgba(255,255,0,0.5)", "points": [[24,9],[35,20],[26,29],[26,33],[22,33],[22,27],[29,20],[24,15],[16,23],[13,20]]}, + {"shape": "rect", "fill": "rgb(255,255,0)", "stroke": "rgba(255,255,0,0.5)", "x": 22, "y":35, "width": 4, "height": 4} + ], + "item": true + }, + { + "image": [ + {"shape": "circle", "fill": "#80f", "stroke": "#88f", "cx": 24, "cy": 24, "r": 18} + ], + "item": true + }, + { + "image": [ + {"shape": "circle", "fill": "#4f4", "stroke": "#8f8", "cx": 24, "cy": 24, "r": 18} + ], + "item": true + } +] diff --git a/node_modules/npm/node_modules/jsonparse/test/big-token.js b/node_modules/npm/node_modules/jsonparse/test/big-token.js new file mode 100644 index 00000000..36046317 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/test/big-token.js @@ -0,0 +1,24 @@ +var stream = require('stream'); +var JsonParse = require('../jsonparse'); +var test = require('tape'); + +test('can handle large tokens without running out of memory', function (t) { + var parser = new JsonParse(); + var chunkSize = 1024; + var chunks = 1024 * 200; // 200mb + var quote = Buffer.from ? Buffer.from('"') : new Buffer('"'); + t.plan(1); + + parser.onToken = function (type, value) { + t.equal(value.length, chunkSize * chunks, 'token should be size of input json'); + t.end(); + }; + + parser.write(quote); + for (var i = 0; i < chunks; ++i) { + var buf = Buffer.alloc ? Buffer.alloc(chunkSize) : new Buffer(chunkSize); + buf.fill('a'); + parser.write(buf); + } + parser.write(quote); +}); diff --git a/node_modules/npm/node_modules/jsonparse/test/boundary.js b/node_modules/npm/node_modules/jsonparse/test/boundary.js new file mode 100644 index 00000000..6671f5f9 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/test/boundary.js @@ -0,0 +1,110 @@ +var test = require('tape'); +var Parser = require('../'); + +test('2 byte utf8 \'De\' character: д', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, 'д'); + }; + + var de_buffer = new Buffer([0xd0, 0xb4]); + + p.write('"'); + p.write(de_buffer); + p.write('"'); + +}); + +test('3 byte utf8 \'Han\' character: 我', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, '我'); + }; + + var han_buffer = new Buffer([0xe6, 0x88, 0x91]); + p.write('"'); + p.write(han_buffer); + p.write('"'); +}); + +test('4 byte utf8 character (unicode scalar U+2070E): 𠜎', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, '𠜎'); + }; + + var Ux2070E_buffer = new Buffer([0xf0, 0xa0, 0x9c, 0x8e]); + p.write('"'); + p.write(Ux2070E_buffer); + p.write('"'); +}); + +test('3 byte utf8 \'Han\' character chunked inbetween 2nd and 3rd byte: 我', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, '我'); + }; + + var han_buffer_first = new Buffer([0xe6, 0x88]); + var han_buffer_second = new Buffer([0x91]); + p.write('"'); + p.write(han_buffer_first); + p.write(han_buffer_second); + p.write('"'); +}); + +test('4 byte utf8 character (unicode scalar U+2070E) chunked inbetween 2nd and 3rd byte: 𠜎', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, '𠜎'); + }; + + var Ux2070E_buffer_first = new Buffer([0xf0, 0xa0]); + var Ux2070E_buffer_second = new Buffer([0x9c, 0x8e]); + p.write('"'); + p.write(Ux2070E_buffer_first); + p.write(Ux2070E_buffer_second); + p.write('"'); +}); + +test('1-4 byte utf8 character string chunked inbetween random bytes: Aж文𠜱B', function (t) { + t.plan(1); + +var p = new Parser(); + p.onValue = function (value) { + t.equal(value, 'Aж文𠜱B'); + }; + + var eclectic_buffer = new Buffer([0x41, // A + 0xd0, 0xb6, // ж + 0xe6, 0x96, 0x87, // 文 + 0xf0, 0xa0, 0x9c, 0xb1, // 𠜱 + 0x42]); // B + + var rand_chunk = Math.floor(Math.random() * (eclectic_buffer.length)); + var first_buffer = eclectic_buffer.slice(0, rand_chunk); + var second_buffer = eclectic_buffer.slice(rand_chunk); + + //console.log('eclectic_buffer: ' + eclectic_buffer) + //console.log('sliced from 0 to ' + rand_chunk); + //console.log(first_buffer); + //console.log('then sliced from ' + rand_chunk + ' to the end'); + //console.log(second_buffer); + + console.log('chunked after offset ' + rand_chunk); + p.write('"'); + p.write(first_buffer); + p.write(second_buffer); + p.write('"'); + +}); \ No newline at end of file diff --git a/node_modules/npm/node_modules/jsonparse/test/offset.js b/node_modules/npm/node_modules/jsonparse/test/offset.js new file mode 100644 index 00000000..9a552ab0 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/test/offset.js @@ -0,0 +1,67 @@ +var test = require('tape'); +var Parser = require('../'); + +var input = '{\n "string": "value",\n "number": 3,\n "object"'; +var input2 = ': {\n "key": "vд"\n },\n "array": [\n -1,\n 12\n ]\n '; +var input3 = '"null": null, "true": true, "false": false, "frac": 3.14 }'; + +var offsets = [ + [ 0, Parser.C.LEFT_BRACE ], + [ 4, Parser.C.STRING ], + [ 12, Parser.C.COLON ], + [ 14, Parser.C.STRING ], + [ 21, Parser.C.COMMA ], + [ 25, Parser.C.STRING ], + [ 33, Parser.C.COLON ], + [ 35, Parser.C.NUMBER ], + [ 36, Parser.C.COMMA ], + [ 40, Parser.C.STRING ], + [ 48, Parser.C.COLON ], + [ 50, Parser.C.LEFT_BRACE ], + [ 54, Parser.C.STRING ], + [ 59, Parser.C.COLON ], + [ 61, Parser.C.STRING ], + [ 69, Parser.C.RIGHT_BRACE ], + [ 70, Parser.C.COMMA ], + [ 74, Parser.C.STRING ], + [ 81, Parser.C.COLON ], + [ 83, Parser.C.LEFT_BRACKET ], + [ 87, Parser.C.NUMBER ], + [ 89, Parser.C.COMMA ], + [ 93, Parser.C.NUMBER ], + [ 98, Parser.C.RIGHT_BRACKET ], + [ 102, Parser.C.STRING ], + [ 108, Parser.C.COLON ], + [ 110, Parser.C.NULL ], + [ 114, Parser.C.COMMA ], + [ 116, Parser.C.STRING ], + [ 122, Parser.C.COLON ], + [ 124, Parser.C.TRUE ], + [ 128, Parser.C.COMMA ], + [ 130, Parser.C.STRING ], + [ 137, Parser.C.COLON ], + [ 139, Parser.C.FALSE ], + [ 144, Parser.C.COMMA ], + [ 146, Parser.C.STRING ], + [ 152, Parser.C.COLON ], + [ 154, Parser.C.NUMBER ], + [ 159, Parser.C.RIGHT_BRACE ] +]; + +test('offset', function(t) { + t.plan(offsets.length * 2 + 1); + + var p = new Parser(); + var i = 0; + p.onToken = function (token) { + t.equal(p.offset, offsets[i][0]); + t.equal(token, offsets[i][1]); + i++; + }; + + p.write(input); + p.write(input2); + p.write(input3); + + t.equal(i, offsets.length); +}); diff --git a/node_modules/npm/node_modules/jsonparse/test/primitives.js b/node_modules/npm/node_modules/jsonparse/test/primitives.js new file mode 100644 index 00000000..33cae169 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/test/primitives.js @@ -0,0 +1,57 @@ +var test = require('tape'); +var Parser = require('../'); + +var expected = [ + [ [], '' ], + [ [], 'Hello' ], + [ [], 'This"is' ], + [ [], '\r\n\f\t\\/"' ], + [ [], 'Λάμβδα' ], + [ [], '\\' ], + [ [], '/' ], + [ [], '"' ], + [ [ 0 ], 0 ], + [ [ 1 ], 1 ], + [ [ 2 ], -1 ], + [ [], [ 0, 1, -1 ] ], + [ [ 0 ], 1 ], + [ [ 1 ], 1.1 ], + [ [ 2 ], -1.1 ], + [ [ 3 ], -1 ], + [ [], [ 1, 1.1, -1.1, -1 ] ], + [ [ 0 ], -1 ], + [ [], [ -1 ] ], + [ [ 0 ], -0.1 ], + [ [], [ -0.1 ] ], + [ [ 0 ], 6.02e+23 ], + [ [], [ 6.02e+23 ] ], + [ [ 0 ], '7161093205057351174' ], + [ [], [ '7161093205057351174'] ] +]; + +test('primitives', function (t) { + t.plan(25); + + var p = new Parser(); + p.onValue = function (value) { + var keys = this.stack + .slice(1) + .map(function (item) { return item.key }) + .concat(this.key !== undefined ? this.key : []) + ; + t.deepEqual( + [ keys, value ], + expected.shift() + ); + }; + + p.write('"""Hello""This\\"is""\\r\\n\\f\\t\\\\\\/\\""'); + p.write('"\\u039b\\u03ac\\u03bc\\u03b2\\u03b4\\u03b1"'); + p.write('"\\\\"'); + p.write('"\\/"'); + p.write('"\\""'); + p.write('[0,1,-1]'); + p.write('[1.0,1.1,-1.1,-1.0][-1][-0.1]'); + p.write('[6.02e23]'); + p.write('[7161093205057351174]'); +}); diff --git a/node_modules/npm/node_modules/jsonparse/test/surrogate.js b/node_modules/npm/node_modules/jsonparse/test/surrogate.js new file mode 100644 index 00000000..c048f370 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/test/surrogate.js @@ -0,0 +1,26 @@ +var test = require('tape'); +var Parser = require('../'); + +test('parse surrogate pair', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, '😋'); + }; + + p.write('"\\uD83D\\uDE0B"'); +}); + +test('parse chunked surrogate pair', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, '😋'); + }; + + p.write('"\\uD83D'); + p.write('\\uDE0B"'); +}); + diff --git a/node_modules/npm/node_modules/jsonparse/test/unvalid.js b/node_modules/npm/node_modules/jsonparse/test/unvalid.js new file mode 100644 index 00000000..7715cc0e --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/test/unvalid.js @@ -0,0 +1,15 @@ +var test = require('tape'); +var Parser = require('../'); + +test('unvalid', function (t) { + var count = 0; + + var p = new Parser(); + p.onError = function (value) { + count++; + t.equal(1, count); + t.end(); + }; + + p.write('{"test": eer['); +}); diff --git a/node_modules/npm/node_modules/jsonparse/test/utf8.js b/node_modules/npm/node_modules/jsonparse/test/utf8.js new file mode 100644 index 00000000..6cb842f3 --- /dev/null +++ b/node_modules/npm/node_modules/jsonparse/test/utf8.js @@ -0,0 +1,38 @@ +var test = require('tape'); +var Parser = require('../'); + +test('3 bytes of utf8', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, '├──'); + }; + + p.write('"├──"'); +}); + +test('utf8 snowman', function (t) { + t.plan(1); + + var p = new Parser(); + p.onValue = function (value) { + t.equal(value, '☃'); + }; + + p.write('"☃"'); +}); + +test('utf8 with regular ascii', function (t) { + t.plan(4); + + var p = new Parser(); + var expected = [ "snow: ☃!", "xyz", "¡que!" ]; + expected.push(expected.slice()); + + p.onValue = function (value) { + t.deepEqual(value, expected.shift()); + }; + + p.write('["snow: ☃!","xyz","¡que!"]'); +}); diff --git a/node_modules/npm/node_modules/just-diff-apply/LICENSE b/node_modules/npm/node_modules/just-diff-apply/LICENSE new file mode 100644 index 00000000..5d2c6e57 --- /dev/null +++ b/node_modules/npm/node_modules/just-diff-apply/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 angus croll + +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/npm/node_modules/just-diff-apply/index.cjs b/node_modules/npm/node_modules/just-diff-apply/index.cjs new file mode 100644 index 00000000..c5d2c326 --- /dev/null +++ b/node_modules/npm/node_modules/just-diff-apply/index.cjs @@ -0,0 +1,161 @@ +module.exports = { + diffApply: diffApply, + jsonPatchPathConverter: jsonPatchPathConverter, +}; + +/* + const obj1 = {a: 3, b: 5}; + diffApply(obj1, + [ + { "op": "remove", "path": ['b'] }, + { "op": "replace", "path": ['a'], "value": 4 }, + { "op": "add", "path": ['c'], "value": 5 } + ] + ); + obj1; // {a: 4, c: 5} + + // using converter to apply jsPatch standard paths + // see http://jsonpatch.com + import {diff, jsonPatchPathConverter} from 'just-diff' + const obj2 = {a: 3, b: 5}; + diffApply(obj2, [ + { "op": "remove", "path": '/b' }, + { "op": "replace", "path": '/a', "value": 4 } + { "op": "add", "path": '/c', "value": 5 } + ], jsonPatchPathConverter); + obj2; // {a: 4, c: 5} + + // arrays + const obj3 = {a: 4, b: [1, 2, 3]}; + diffApply(obj3, [ + { "op": "replace", "path": ['a'], "value": 3 } + { "op": "replace", "path": ['b', 2], "value": 4 } + { "op": "add", "path": ['b', 3], "value": 9 } + ]); + obj3; // {a: 3, b: [1, 2, 4, 9]} + + // nested paths + const obj4 = {a: 4, b: {c: 3}}; + diffApply(obj4, [ + { "op": "replace", "path": ['a'], "value": 5 } + { "op": "remove", "path": ['b', 'c']} + { "op": "add", "path": ['b', 'd'], "value": 4 } + ]); + obj4; // {a: 5, b: {d: 4}} +*/ + +var REMOVE = 'remove'; +var REPLACE = 'replace'; +var ADD = 'add'; +var MOVE = 'move'; + +function diffApply(obj, diff, pathConverter) { + if (!obj || typeof obj != 'object') { + throw new Error('base object must be an object or an array'); + } + + if (!Array.isArray(diff)) { + throw new Error('diff must be an array'); + } + + var diffLength = diff.length; + for (var i = 0; i < diffLength; i++) { + var thisDiff = diff[i]; + var subObject = obj; + var thisOp = thisDiff.op; + + var thisPath = transformPath(pathConverter, thisDiff.path); + var thisFromPath = thisDiff.from && transformPath(pathConverter, thisDiff.from); + var toPath, toPathCopy, lastToProp, subToObject, valueToMove; + + if (thisFromPath) { + // MOVE only, "fromPath" is effectively path and "path" is toPath + toPath = thisPath; + thisPath = thisFromPath; + + toPathCopy = toPath.slice(); + lastToProp = toPathCopy.pop(); + prototypeCheck(lastToProp); + if (lastToProp == null) { + return false; + } + + var thisToProp; + while (((thisToProp = toPathCopy.shift())) != null) { + prototypeCheck(thisToProp); + if (!(thisToProp in subToObject)) { + subToObject[thisToProp] = {}; + } + subToObject = subToObject[thisToProp]; + } + } + + var pathCopy = thisPath.slice(); + var lastProp = pathCopy.pop(); + prototypeCheck(lastProp); + if (lastProp == null) { + return false; + } + + var thisProp; + while (((thisProp = pathCopy.shift())) != null) { + prototypeCheck(thisProp); + if (!(thisProp in subObject)) { + subObject[thisProp] = {}; + } + subObject = subObject[thisProp]; + } + if (thisOp === REMOVE || thisOp === REPLACE || thisOp === MOVE) { + var path = thisOp === MOVE ? thisDiff.from : thisDiff.path; + if (!subObject.hasOwnProperty(lastProp)) { + throw new Error(['expected to find property', path, 'in object', obj].join(' ')); + } + } + if (thisOp === REMOVE || thisOp === MOVE) { + if (thisOp === MOVE) { + valueToMove = subObject[lastProp]; + } + Array.isArray(subObject) ? subObject.splice(lastProp, 1) : delete subObject[lastProp]; + } + if (thisOp === REPLACE || thisOp === ADD) { + subObject[lastProp] = thisDiff.value; + } + + if (thisOp === MOVE) { + subObject[lastToProp] = valueToMove; + } + } + return subObject; +} + +function transformPath(pathConverter, thisPath) { + if(pathConverter) { + thisPath = pathConverter(thisPath); + if(!Array.isArray(thisPath)) { + throw new Error([ + 'pathConverter must return an array, returned:', + thisPath, + ].join(' ')); + } + } else { + if(!Array.isArray(thisPath)) { + throw new Error([ + 'diff path', + thisPath, + 'must be an array, consider supplying a path converter'] + .join(' ')); + } + } + return thisPath; +} + +function jsonPatchPathConverter(stringPath) { + return stringPath.split('/').slice(1); +} + +function prototypeCheck(prop) { + // coercion is intentional to catch prop values like `['__proto__']` + if (prop == '__proto__' || prop == 'constructor' || prop == 'prototype') { + throw new Error('setting of prototype values not supported'); + } +} diff --git a/node_modules/npm/node_modules/just-diff-apply/index.mjs b/node_modules/npm/node_modules/just-diff-apply/index.mjs new file mode 100644 index 00000000..adc5f46e --- /dev/null +++ b/node_modules/npm/node_modules/just-diff-apply/index.mjs @@ -0,0 +1,158 @@ +/* + const obj1 = {a: 3, b: 5}; + diffApply(obj1, + [ + { "op": "remove", "path": ['b'] }, + { "op": "replace", "path": ['a'], "value": 4 }, + { "op": "add", "path": ['c'], "value": 5 } + ] + ); + obj1; // {a: 4, c: 5} + + // using converter to apply jsPatch standard paths + // see http://jsonpatch.com + import {diff, jsonPatchPathConverter} from 'just-diff' + const obj2 = {a: 3, b: 5}; + diffApply(obj2, [ + { "op": "remove", "path": '/b' }, + { "op": "replace", "path": '/a', "value": 4 } + { "op": "add", "path": '/c', "value": 5 } + ], jsonPatchPathConverter); + obj2; // {a: 4, c: 5} + + // arrays + const obj3 = {a: 4, b: [1, 2, 3]}; + diffApply(obj3, [ + { "op": "replace", "path": ['a'], "value": 3 } + { "op": "replace", "path": ['b', 2], "value": 4 } + { "op": "add", "path": ['b', 3], "value": 9 } + ]); + obj3; // {a: 3, b: [1, 2, 4, 9]} + + // nested paths + const obj4 = {a: 4, b: {c: 3}}; + diffApply(obj4, [ + { "op": "replace", "path": ['a'], "value": 5 } + { "op": "remove", "path": ['b', 'c']} + { "op": "add", "path": ['b', 'd'], "value": 4 } + ]); + obj4; // {a: 5, b: {d: 4}} +*/ + +var REMOVE = 'remove'; +var REPLACE = 'replace'; +var ADD = 'add'; +var MOVE = 'move'; + +function diffApply(obj, diff, pathConverter) { + if (!obj || typeof obj != 'object') { + throw new Error('base object must be an object or an array'); + } + + if (!Array.isArray(diff)) { + throw new Error('diff must be an array'); + } + + var diffLength = diff.length; + for (var i = 0; i < diffLength; i++) { + var thisDiff = diff[i]; + var subObject = obj; + var thisOp = thisDiff.op; + + var thisPath = transformPath(pathConverter, thisDiff.path); + var thisFromPath = thisDiff.from && transformPath(pathConverter, thisDiff.from); + var toPath, toPathCopy, lastToProp, subToObject, valueToMove; + + if (thisFromPath) { + // MOVE only, "fromPath" is effectively path and "path" is toPath + toPath = thisPath; + thisPath = thisFromPath; + + toPathCopy = toPath.slice(); + lastToProp = toPathCopy.pop(); + prototypeCheck(lastToProp); + if (lastToProp == null) { + return false; + } + + var thisToProp; + while (((thisToProp = toPathCopy.shift())) != null) { + prototypeCheck(thisToProp); + if (!(thisToProp in subToObject)) { + subToObject[thisToProp] = {}; + } + subToObject = subToObject[thisToProp]; + } + } + + var pathCopy = thisPath.slice(); + var lastProp = pathCopy.pop(); + prototypeCheck(lastProp); + if (lastProp == null) { + return false; + } + + var thisProp; + while (((thisProp = pathCopy.shift())) != null) { + prototypeCheck(thisProp); + if (!(thisProp in subObject)) { + subObject[thisProp] = {}; + } + subObject = subObject[thisProp]; + } + if (thisOp === REMOVE || thisOp === REPLACE || thisOp === MOVE) { + var path = thisOp === MOVE ? thisDiff.from : thisDiff.path; + if (!subObject.hasOwnProperty(lastProp)) { + throw new Error(['expected to find property', path, 'in object', obj].join(' ')); + } + } + if (thisOp === REMOVE || thisOp === MOVE) { + if (thisOp === MOVE) { + valueToMove = subObject[lastProp]; + } + Array.isArray(subObject) ? subObject.splice(lastProp, 1) : delete subObject[lastProp]; + } + if (thisOp === REPLACE || thisOp === ADD) { + subObject[lastProp] = thisDiff.value; + } + + if (thisOp === MOVE) { + subObject[lastToProp] = valueToMove; + } + } + return subObject; +} + +function transformPath(pathConverter, thisPath) { + if(pathConverter) { + thisPath = pathConverter(thisPath); + if(!Array.isArray(thisPath)) { + throw new Error([ + 'pathConverter must return an array, returned:', + thisPath, + ].join(' ')); + } + } else { + if(!Array.isArray(thisPath)) { + throw new Error([ + 'diff path', + thisPath, + 'must be an array, consider supplying a path converter'] + .join(' ')); + } + } + return thisPath; +} + +function jsonPatchPathConverter(stringPath) { + return stringPath.split('/').slice(1); +} + +function prototypeCheck(prop) { + // coercion is intentional to catch prop values like `['__proto__']` + if (prop == '__proto__' || prop == 'constructor' || prop == 'prototype') { + throw new Error('setting of prototype values not supported'); + } +} + +export {diffApply, jsonPatchPathConverter}; diff --git a/node_modules/npm/node_modules/just-diff-apply/package.json b/node_modules/npm/node_modules/just-diff-apply/package.json new file mode 100644 index 00000000..be2879aa --- /dev/null +++ b/node_modules/npm/node_modules/just-diff-apply/package.json @@ -0,0 +1,34 @@ +{ + "name": "just-diff-apply", + "version": "5.5.0", + "description": "Apply a diff to an object. Optionally supports jsonPatch protocol", + "type": "module", + "exports": { + ".": { + "types": "./index.d.ts", + "require": "./index.cjs", + "import": "./index.mjs" + }, + "./package.json": "./package.json" + }, + "main": "index.cjs", + "types": "index.d.ts", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "rollup -c" + }, + "repository": "https://github.com/angus-c/just", + "keywords": [ + "object", + "diff", + "apply", + "jsonPatch", + "no-dependencies", + "just" + ], + "author": "Angus Croll", + "license": "MIT", + "bugs": { + "url": "https://github.com/angus-c/just/issues" + } +} \ No newline at end of file diff --git a/node_modules/npm/node_modules/just-diff-apply/rollup.config.js b/node_modules/npm/node_modules/just-diff-apply/rollup.config.js new file mode 100644 index 00000000..fb9d24a3 --- /dev/null +++ b/node_modules/npm/node_modules/just-diff-apply/rollup.config.js @@ -0,0 +1,3 @@ +const createRollupConfig = require('../../config/createRollupConfig'); + +module.exports = createRollupConfig(__dirname); diff --git a/node_modules/npm/node_modules/just-diff/LICENSE b/node_modules/npm/node_modules/just-diff/LICENSE new file mode 100644 index 00000000..5d2c6e57 --- /dev/null +++ b/node_modules/npm/node_modules/just-diff/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 angus croll + +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/npm/node_modules/just-diff/index.cjs b/node_modules/npm/node_modules/just-diff/index.cjs new file mode 100644 index 00000000..b74099de --- /dev/null +++ b/node_modules/npm/node_modules/just-diff/index.cjs @@ -0,0 +1,230 @@ +module.exports = { + diff: diff, + jsonPatchPathConverter: jsonPatchPathConverter, +}; + +/* + const obj1 = {a: 4, b: 5}; + const obj2 = {a: 3, b: 5}; + const obj3 = {a: 4, c: 5}; + + diff(obj1, obj2); + [ + { "op": "replace", "path": ['a'], "value": 3 } + ] + + diff(obj2, obj3); + [ + { "op": "remove", "path": ['b'] }, + { "op": "replace", "path": ['a'], "value": 4 } + { "op": "add", "path": ['c'], "value": 5 } + ] + + // using converter to generate jsPatch standard paths + // see http://jsonpatch.com + import {diff, jsonPatchPathConverter} from 'just-diff' + diff(obj1, obj2, jsonPatchPathConverter); + [ + { "op": "replace", "path": '/a', "value": 3 } + ] + + diff(obj2, obj3, jsonPatchPathConverter); + [ + { "op": "remove", "path": '/b' }, + { "op": "replace", "path": '/a', "value": 4 } + { "op": "add", "path": '/c', "value": 5 } + ] + + // arrays + const obj4 = {a: 4, b: [1, 2, 3]}; + const obj5 = {a: 3, b: [1, 2, 4]}; + const obj6 = {a: 3, b: [1, 2, 4, 5]}; + + diff(obj4, obj5); + [ + { "op": "replace", "path": ['a'], "value": 3 } + { "op": "replace", "path": ['b', 2], "value": 4 } + ] + + diff(obj5, obj6); + [ + { "op": "add", "path": ['b', 3], "value": 5 } + ] + + // nested paths + const obj7 = {a: 4, b: {c: 3}}; + const obj8 = {a: 4, b: {c: 4}}; + const obj9 = {a: 5, b: {d: 4}}; + + diff(obj7, obj8); + [ + { "op": "replace", "path": ['b', 'c'], "value": 4 } + ] + + diff(obj8, obj9); + [ + { "op": "replace", "path": ['a'], "value": 5 } + { "op": "remove", "path": ['b', 'c']} + { "op": "add", "path": ['b', 'd'], "value": 4 } + ] +*/ + +function diff(obj1, obj2, pathConverter) { + if (!obj1 || typeof obj1 != 'object' || !obj2 || typeof obj2 != 'object') { + throw new Error('both arguments must be objects or arrays'); + } + + pathConverter || + (pathConverter = function(arr) { + return arr; + }); + + function getDiff({obj1, obj2, basePath, basePathForRemoves, diffs}) { + var obj1Keys = Object.keys(obj1); + var obj1KeysLength = obj1Keys.length; + var obj2Keys = Object.keys(obj2); + var obj2KeysLength = obj2Keys.length; + var path; + + var lengthDelta = obj1.length - obj2.length; + + if (trimFromRight(obj1, obj2)) { + for (var i = 0; i < obj1KeysLength; i++) { + var key = Array.isArray(obj1) ? Number(obj1Keys[i]) : obj1Keys[i]; + if (!(key in obj2)) { + path = basePathForRemoves.concat(key); + diffs.remove.push({ + op: 'remove', + path: pathConverter(path), + }); + } + } + + for (var i = 0; i < obj2KeysLength; i++) { + var key = Array.isArray(obj2) ? Number(obj2Keys[i]) : obj2Keys[i]; + pushReplaces({ + key, + obj1, + obj2, + path: basePath.concat(key), + pathForRemoves: basePath.concat(key), + diffs, + }); + } + } else { + // trim from left, objects are both arrays + for (var i = 0; i < lengthDelta; i++) { + path = basePathForRemoves.concat(i); + diffs.remove.push({ + op: 'remove', + path: pathConverter(path), + }); + } + + // now make a copy of obj1 with excess elements left trimmed and see if there any replaces + var obj1Trimmed = obj1.slice(lengthDelta);; + for (var i = 0; i < obj2KeysLength; i++) { + pushReplaces({ + key: i, + obj1: obj1Trimmed, + obj2, + path: basePath.concat(i), + // since list of removes are reversed before presenting result, + // we need to ignore existing parent removes when doing nested removes + pathForRemoves: basePath.concat(i + lengthDelta), + diffs, + }); + } + } + } + + var diffs = {remove: [], replace: [], add: []}; + getDiff({ + obj1, + obj2, + basePath: [], + basePathForRemoves: [], + diffs, + }); + + // reverse removes since we want to maintain indexes + return diffs.remove + .reverse() + .concat(diffs.replace) + .concat(diffs.add); + + function pushReplaces({key, obj1, obj2, path, pathForRemoves, diffs}) { + var obj1AtKey = obj1[key]; + var obj2AtKey = obj2[key]; + + if(!(key in obj1) && (key in obj2)) { + var obj2Value = obj2AtKey; + diffs.add.push({ + op: 'add', + path: pathConverter(path), + value: obj2Value, + }); + } else if(obj1AtKey !== obj2AtKey) { + if(Object(obj1AtKey) !== obj1AtKey || + Object(obj2AtKey) !== obj2AtKey || differentTypes(obj1AtKey, obj2AtKey) + ) { + pushReplace(path, diffs, obj2AtKey); + } else { + if(!Object.keys(obj1AtKey).length && + !Object.keys(obj2AtKey).length && + String(obj1AtKey) != String(obj2AtKey)) { + pushReplace(path, diffs, obj2AtKey); + } else { + getDiff({ + obj1: obj1[key], + obj2: obj2[key], + basePath: path, + basePathForRemoves: pathForRemoves, + diffs}); + } + } + } + } + + function pushReplace(path, diffs, newValue) { + diffs.replace.push({ + op: 'replace', + path: pathConverter(path), + value: newValue, + }); + } +} + +function jsonPatchPathConverter(arrayPath) { + return [''].concat(arrayPath).join('/'); +} + +function differentTypes(a, b) { + return Object.prototype.toString.call(a) != Object.prototype.toString.call(b); +} + +function trimFromRight(obj1, obj2) { + var lengthDelta = obj1.length - obj2.length; + if (Array.isArray(obj1) && Array.isArray(obj2) && lengthDelta > 0) { + var leftMatches = 0; + var rightMatches = 0; + for (var i = 0; i < obj2.length; i++) { + if (String(obj1[i]) === String(obj2[i])) { + leftMatches++; + } else { + break; + } + } + for (var j = obj2.length; j > 0; j--) { + if (String(obj1[j + lengthDelta]) === String(obj2[j])) { + rightMatches++; + } else { + break; + } + } + + // bias to trim right becase it requires less index shifting + return leftMatches >= rightMatches; + } + return true; +} diff --git a/node_modules/npm/node_modules/just-diff/index.mjs b/node_modules/npm/node_modules/just-diff/index.mjs new file mode 100644 index 00000000..4a847874 --- /dev/null +++ b/node_modules/npm/node_modules/just-diff/index.mjs @@ -0,0 +1,227 @@ +/* + const obj1 = {a: 4, b: 5}; + const obj2 = {a: 3, b: 5}; + const obj3 = {a: 4, c: 5}; + + diff(obj1, obj2); + [ + { "op": "replace", "path": ['a'], "value": 3 } + ] + + diff(obj2, obj3); + [ + { "op": "remove", "path": ['b'] }, + { "op": "replace", "path": ['a'], "value": 4 } + { "op": "add", "path": ['c'], "value": 5 } + ] + + // using converter to generate jsPatch standard paths + // see http://jsonpatch.com + import {diff, jsonPatchPathConverter} from 'just-diff' + diff(obj1, obj2, jsonPatchPathConverter); + [ + { "op": "replace", "path": '/a', "value": 3 } + ] + + diff(obj2, obj3, jsonPatchPathConverter); + [ + { "op": "remove", "path": '/b' }, + { "op": "replace", "path": '/a', "value": 4 } + { "op": "add", "path": '/c', "value": 5 } + ] + + // arrays + const obj4 = {a: 4, b: [1, 2, 3]}; + const obj5 = {a: 3, b: [1, 2, 4]}; + const obj6 = {a: 3, b: [1, 2, 4, 5]}; + + diff(obj4, obj5); + [ + { "op": "replace", "path": ['a'], "value": 3 } + { "op": "replace", "path": ['b', 2], "value": 4 } + ] + + diff(obj5, obj6); + [ + { "op": "add", "path": ['b', 3], "value": 5 } + ] + + // nested paths + const obj7 = {a: 4, b: {c: 3}}; + const obj8 = {a: 4, b: {c: 4}}; + const obj9 = {a: 5, b: {d: 4}}; + + diff(obj7, obj8); + [ + { "op": "replace", "path": ['b', 'c'], "value": 4 } + ] + + diff(obj8, obj9); + [ + { "op": "replace", "path": ['a'], "value": 5 } + { "op": "remove", "path": ['b', 'c']} + { "op": "add", "path": ['b', 'd'], "value": 4 } + ] +*/ + +function diff(obj1, obj2, pathConverter) { + if (!obj1 || typeof obj1 != 'object' || !obj2 || typeof obj2 != 'object') { + throw new Error('both arguments must be objects or arrays'); + } + + pathConverter || + (pathConverter = function(arr) { + return arr; + }); + + function getDiff({obj1, obj2, basePath, basePathForRemoves, diffs}) { + var obj1Keys = Object.keys(obj1); + var obj1KeysLength = obj1Keys.length; + var obj2Keys = Object.keys(obj2); + var obj2KeysLength = obj2Keys.length; + var path; + + var lengthDelta = obj1.length - obj2.length; + + if (trimFromRight(obj1, obj2)) { + for (var i = 0; i < obj1KeysLength; i++) { + var key = Array.isArray(obj1) ? Number(obj1Keys[i]) : obj1Keys[i]; + if (!(key in obj2)) { + path = basePathForRemoves.concat(key); + diffs.remove.push({ + op: 'remove', + path: pathConverter(path), + }); + } + } + + for (var i = 0; i < obj2KeysLength; i++) { + var key = Array.isArray(obj2) ? Number(obj2Keys[i]) : obj2Keys[i]; + pushReplaces({ + key, + obj1, + obj2, + path: basePath.concat(key), + pathForRemoves: basePath.concat(key), + diffs, + }); + } + } else { + // trim from left, objects are both arrays + for (var i = 0; i < lengthDelta; i++) { + path = basePathForRemoves.concat(i); + diffs.remove.push({ + op: 'remove', + path: pathConverter(path), + }); + } + + // now make a copy of obj1 with excess elements left trimmed and see if there any replaces + var obj1Trimmed = obj1.slice(lengthDelta);; + for (var i = 0; i < obj2KeysLength; i++) { + pushReplaces({ + key: i, + obj1: obj1Trimmed, + obj2, + path: basePath.concat(i), + // since list of removes are reversed before presenting result, + // we need to ignore existing parent removes when doing nested removes + pathForRemoves: basePath.concat(i + lengthDelta), + diffs, + }); + } + } + } + + var diffs = {remove: [], replace: [], add: []}; + getDiff({ + obj1, + obj2, + basePath: [], + basePathForRemoves: [], + diffs, + }); + + // reverse removes since we want to maintain indexes + return diffs.remove + .reverse() + .concat(diffs.replace) + .concat(diffs.add); + + function pushReplaces({key, obj1, obj2, path, pathForRemoves, diffs}) { + var obj1AtKey = obj1[key]; + var obj2AtKey = obj2[key]; + + if(!(key in obj1) && (key in obj2)) { + var obj2Value = obj2AtKey; + diffs.add.push({ + op: 'add', + path: pathConverter(path), + value: obj2Value, + }); + } else if(obj1AtKey !== obj2AtKey) { + if(Object(obj1AtKey) !== obj1AtKey || + Object(obj2AtKey) !== obj2AtKey || differentTypes(obj1AtKey, obj2AtKey) + ) { + pushReplace(path, diffs, obj2AtKey); + } else { + if(!Object.keys(obj1AtKey).length && + !Object.keys(obj2AtKey).length && + String(obj1AtKey) != String(obj2AtKey)) { + pushReplace(path, diffs, obj2AtKey); + } else { + getDiff({ + obj1: obj1[key], + obj2: obj2[key], + basePath: path, + basePathForRemoves: pathForRemoves, + diffs}); + } + } + } + } + + function pushReplace(path, diffs, newValue) { + diffs.replace.push({ + op: 'replace', + path: pathConverter(path), + value: newValue, + }); + } +} + +function jsonPatchPathConverter(arrayPath) { + return [''].concat(arrayPath).join('/'); +} + +function differentTypes(a, b) { + return Object.prototype.toString.call(a) != Object.prototype.toString.call(b); +} + +function trimFromRight(obj1, obj2) { + var lengthDelta = obj1.length - obj2.length; + if (Array.isArray(obj1) && Array.isArray(obj2) && lengthDelta > 0) { + var leftMatches = 0; + var rightMatches = 0; + for (var i = 0; i < obj2.length; i++) { + if (String(obj1[i]) === String(obj2[i])) { + leftMatches++; + } else { + break; + } + } + for (var j = obj2.length; j > 0; j--) { + if (String(obj1[j + lengthDelta]) === String(obj2[j])) { + rightMatches++; + } else { + break; + } + } + + // bias to trim right becase it requires less index shifting + return leftMatches >= rightMatches; + } + return true; +} + +export {diff, jsonPatchPathConverter}; diff --git a/node_modules/npm/node_modules/just-diff/package.json b/node_modules/npm/node_modules/just-diff/package.json new file mode 100644 index 00000000..0403b04c --- /dev/null +++ b/node_modules/npm/node_modules/just-diff/package.json @@ -0,0 +1,33 @@ +{ + "name": "just-diff", + "version": "6.0.2", + "description": "Return an object representing the diffs between two objects. Supports jsonPatch protocol", + "type": "module", + "exports": { + ".": { + "types": "./index.d.ts", + "require": "./index.cjs", + "import": "./index.mjs" + }, + "./package.json": "./package.json" + }, + "main": "index.cjs", + "types": "index.d.ts", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "rollup -c" + }, + "repository": "https://github.com/angus-c/just", + "keywords": [ + "object", + "diff", + "jsonPatch", + "no-dependencies", + "just" + ], + "author": "Angus Croll", + "license": "MIT", + "bugs": { + "url": "https://github.com/angus-c/just/issues" + } +} \ No newline at end of file diff --git a/node_modules/npm/node_modules/just-diff/rollup.config.js b/node_modules/npm/node_modules/just-diff/rollup.config.js new file mode 100644 index 00000000..fb9d24a3 --- /dev/null +++ b/node_modules/npm/node_modules/just-diff/rollup.config.js @@ -0,0 +1,3 @@ +const createRollupConfig = require('../../config/createRollupConfig'); + +module.exports = createRollupConfig(__dirname); diff --git a/node_modules/npm/node_modules/libnpmaccess/LICENSE b/node_modules/npm/node_modules/libnpmaccess/LICENSE new file mode 100644 index 00000000..209e4477 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmaccess/LICENSE @@ -0,0 +1,13 @@ +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/npm/node_modules/libnpmaccess/README.md b/node_modules/npm/node_modules/libnpmaccess/README.md new file mode 100644 index 00000000..060016bc --- /dev/null +++ b/node_modules/npm/node_modules/libnpmaccess/README.md @@ -0,0 +1,93 @@ +# libnpmaccess + +[![npm version](https://img.shields.io/npm/v/libnpmaccess.svg)](https://npm.im/libnpmaccess) +[![license](https://img.shields.io/npm/l/libnpmaccess.svg)](https://npm.im/libnpmaccess) +[![CI - libnpmaccess](https://github.com/npm/cli/actions/workflows/ci-libnpmaccess.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmaccess.yml) + +[`libnpmaccess`](https://github.com/npm/libnpmaccess) is a Node.js +library that provides programmatic access to the guts of the npm CLI's `npm +access` command. This includes managing account mfa settings, listing +packages and permissions, looking at package collaborators, and defining +package permissions for users, orgs, and teams. + +## Example + +```javascript +const access = require('libnpmaccess') +const opts = { '//registry.npmjs.org/:_authToken: 'npm_token } + +// List all packages @zkat has access to on the npm registry. +console.log(Object.keys(await access.getPackages('zkat', opts))) +``` + +### API + +#### `opts` for all `libnpmaccess` commands + +`libnpmaccess` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch). + +All options are passed through directly to that library, so please refer +to [its own `opts` +documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options) +for options that can be passed in. + +#### `spec` parameter for all `libnpmaccess` commands + +`spec` must be an [`npm-package-arg`](https://npm.im/npm-package-arg)-compatible +registry spec. + +#### `access.getCollaborators(spec, opts) -> Promise` + +Gets collaborators for a given package + +#### `access.getPackages(user|scope|team, opts) -> Promise` + +Gets all packages for a given user, scope, or team. + +Teams should be in the format `scope:team` or `@scope:team` + +Users and scopes can be in the format `@scope` or `scope` + +#### `access.getVisibility(spec, opts) -> Promise` + +Gets the visibility of a given package + +#### `access.removePermissions(team, spec, opts) -> Promise` + +Removes the access for a given team to a package. + +Teams should be in the format `scope:team` or `@scope:team` + +#### `access.setAccess(package, access, opts) -> Promise` + +Sets access level for package described by `spec`. + +The npm registry accepts the following `access` levels: + +`public`: package is public +`private`: package is private + +The npm registry also only allows scoped packages to have their access +level set. + +#### access.setMfa(spec, level, opts) -> Promise` + +Sets the publishing mfa requirements for a given package. Level must be one of the +following + +`none`: mfa is not required to publish this package. +`publish`: mfa is required to publish this package, automation tokens +cannot be used to publish. +`automation`: mfa is required to publish this package, automation tokens +may also be used for publishing from continuous integration workflows. + +#### access.setPermissions(team, spec, permssions, opts) -> Promise` + +Sets permissions levels for a given team to a package. + +Teams should be in the format `scope:team` or `@scope:team` + +The npm registry accepts the following `permissions`: + +`read-only`: Read only permissions +`read-write`: Read and write (aka publish) permissions diff --git a/node_modules/npm/node_modules/libnpmaccess/lib/index.js b/node_modules/npm/node_modules/libnpmaccess/lib/index.js new file mode 100644 index 00000000..fca0e472 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmaccess/lib/index.js @@ -0,0 +1,140 @@ +'use strict' + +const npa = require('npm-package-arg') +const npmFetch = require('npm-registry-fetch') + +const npar = (spec) => { + spec = npa(spec) + if (!spec.registry) { + throw new Error('must use package name only') + } + return spec +} + +const parseTeam = (scopeTeam) => { + let slice = 0 + if (scopeTeam.startsWith('@')) { + slice = 1 + } + const [scope, team] = scopeTeam.slice(slice).split(':').map(encodeURIComponent) + return { scope, team } +} + +const getPackages = async (scopeTeam, opts) => { + const { scope, team } = parseTeam(scopeTeam) + + let uri + if (team) { + uri = `/-/team/${scope}/${team}/package` + } else { + uri = `/-/org/${scope}/package` + } + try { + return await npmFetch.json(uri, opts) + } catch (err) { + if (err.code === 'E404') { + uri = `/-/user/${scope}/package` + return npmFetch.json(uri, opts) + } + throw err + } +} + +const getCollaborators = async (pkg, opts) => { + const spec = npar(pkg) + const uri = `/-/package/${spec.escapedName}/collaborators` + return npmFetch.json(uri, opts) +} + +const getVisibility = async (pkg, opts) => { + const spec = npar(pkg) + const uri = `/-/package/${spec.escapedName}/visibility` + return npmFetch.json(uri, opts) +} + +const setAccess = async (pkg, access, opts) => { + const spec = npar(pkg) + const uri = `/-/package/${spec.escapedName}/access` + await npmFetch(uri, { + ...opts, + method: 'POST', + body: { access }, + spec, + ignoreBody: true, + }) + return true +} + +const setMfa = async (pkg, level, opts) => { + const spec = npar(pkg) + const body = {} + switch (level) { + case 'none': + body.publish_requires_tfa = false + break + case 'publish': + // tfa is required, automation tokens can not override tfa + body.publish_requires_tfa = true + body.automation_token_overrides_tfa = false + break + case 'automation': + // tfa is required, automation tokens can override tfa + body.publish_requires_tfa = true + body.automation_token_overrides_tfa = true + break + default: + throw new Error(`Invalid mfa setting ${level}`) + } + const uri = `/-/package/${spec.escapedName}/access` + await npmFetch(uri, { + ...opts, + method: 'POST', + body, + spec, + ignoreBody: true, + }) + return true +} + +const setPermissions = async (scopeTeam, pkg, permissions, opts) => { + const spec = npar(pkg) + const { scope, team } = parseTeam(scopeTeam) + if (!scope || !team) { + throw new Error('team must be in format `scope:team`') + } + const uri = `/-/team/${scope}/${team}/package` + await npmFetch(uri, { + ...opts, + method: 'PUT', + body: { package: spec.name, permissions }, + scope, + spec, + ignoreBody: true, + }) + return true +} + +const removePermissions = async (scopeTeam, pkg, opts) => { + const spec = npar(pkg) + const { scope, team } = parseTeam(scopeTeam) + const uri = `/-/team/${scope}/${team}/package` + await npmFetch(uri, { + ...opts, + method: 'DELETE', + body: { package: spec.name }, + scope, + spec, + ignoreBody: true, + }) + return true +} + +module.exports = { + getCollaborators, + getPackages, + getVisibility, + removePermissions, + setAccess, + setMfa, + setPermissions, +} diff --git a/node_modules/npm/node_modules/libnpmaccess/package.json b/node_modules/npm/node_modules/libnpmaccess/package.json new file mode 100644 index 00000000..ff63233c --- /dev/null +++ b/node_modules/npm/node_modules/libnpmaccess/package.json @@ -0,0 +1,53 @@ +{ + "name": "libnpmaccess", + "version": "10.0.0", + "description": "programmatic library for `npm access` commands", + "author": "GitHub Inc.", + "license": "ISC", + "main": "lib/index.js", + "scripts": { + "lint": "npm run eslint", + "test": "tap", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/mock-registry": "^1.0.0", + "@npmcli/template-oss": "4.23.6", + "tap": "^16.3.8" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmaccess" + }, + "bugs": "https://github.com/npm/libnpmaccess/issues", + "homepage": "https://npmjs.com/package/libnpmaccess", + "dependencies": { + "npm-package-arg": "^12.0.0", + "npm-registry-fetch": "^18.0.1" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "files": [ + "bin/", + "lib/" + ], + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/libnpmdiff/LICENSE b/node_modules/npm/node_modules/libnpmdiff/LICENSE new file mode 100644 index 00000000..d3a1cdfd --- /dev/null +++ b/node_modules/npm/node_modules/libnpmdiff/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) GitHub 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/npm/node_modules/libnpmdiff/README.md b/node_modules/npm/node_modules/libnpmdiff/README.md new file mode 100644 index 00000000..b8eb083b --- /dev/null +++ b/node_modules/npm/node_modules/libnpmdiff/README.md @@ -0,0 +1,96 @@ +# libnpmdiff + +[![npm version](https://img.shields.io/npm/v/libnpmdiff.svg)](https://npm.im/libnpmdiff) +[![license](https://img.shields.io/npm/l/libnpmdiff.svg)](https://npm.im/libnpmdiff) +[![CI - libnpmdiff](https://github.com/npm/cli/actions/workflows/ci-libnpmdiff.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmdiff.yml) +The registry diff lib. + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [Contributing](#contributing) +* [API](#api) +* [LICENSE](#license) + +## Example + +```js +const libdiff = require('libnpmdiff') + +const patch = await libdiff([ + 'abbrev@1.1.0', + 'abbrev@1.1.1' +]) +console.log( + patch +) +``` + +Returns: + +```patch +diff --git a/package.json b/package.json +index v1.1.0..v1.1.1 100644 +--- a/package.json ++++ b/package.json +@@ -1,6 +1,6 @@ + { + "name": "abbrev", +- "version": "1.1.0", ++ "version": "1.1.1", + "description": "Like ruby's abbrev module, but in js", + "author": "Isaac Z. Schlueter ", + "main": "abbrev.js", + +``` + +## Install + +`$ npm install libnpmdiff` + +### Contributing + +The npm team enthusiastically welcomes contributions and project participation! +There's a bunch of things you can do if you want to contribute! The +[Contributor Guide](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md) +outlines the process for community interaction and contribution. Please don't +hesitate to jump in if you'd like to, or even ask us questions if something +isn't clear. + +All participants and maintainers in this project are expected to follow the +[npm Code of Conduct](https://docs.npmjs.com/policies/conduct), and just +generally be excellent to each other. + +Please refer to the [Changelog](CHANGELOG.md) for project history details, too. + +Happy hacking! + +### API + +#### `> libnpmdif([ a, b ], [opts]) -> Promise` + +Fetches the registry tarballs and compare files between a spec `a` and spec `b`. **npm** spec types are usually described in `@` form but multiple other types are alsos supported, for more info on valid specs take a look at [`npm-package-arg`](https://github.com/npm/npm-package-arg). + +**Options**: + +- `color `: Should add ANSI colors to string output? Defaults to `false`. +- `tagVersionPrefix `: What prefix should be used to define version numbers. Defaults to `v` +- `diffUnified `: How many lines of code to print before/after each diff. Defaults to `3`. +- `diffFiles >`: If set only prints patches for the files listed in this array (also accepts globs). Defaults to `undefined`. +- `diffIgnoreAllSpace `: Whether or not should ignore changes in whitespace (very useful to avoid indentation changes extra diff lines). Defaults to `false`. +- `diffNameOnly `: Prints only file names and no patch diffs. Defaults to `false`. +- `diffNoPrefix `: If true then skips printing any prefixes in filenames. Defaults to `false`. +- `diffSrcPrefix `: Prefix to be used in the filenames from `a`. Defaults to `a/`. +- `diffDstPrefix `: Prefix to be used in the filenames from `b`. Defaults to `b/`. +- `diffText `: Should treat all files as text and try to print diff for binary files. Defaults to `false`. +- ...`cache`, `registry`, `where` and other common options accepted by [pacote](https://github.com/npm/pacote#options) + +Returns a `Promise` that fullfils with a `String` containing the resulting patch diffs. + +Throws an error if either `a` or `b` are missing or if trying to diff more than two specs. + +## LICENSE + +[ISC](./LICENSE) + diff --git a/node_modules/npm/node_modules/libnpmdiff/lib/format-diff.js b/node_modules/npm/node_modules/libnpmdiff/lib/format-diff.js new file mode 100644 index 00000000..f5073820 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmdiff/lib/format-diff.js @@ -0,0 +1,118 @@ +const jsDiff = require('diff') + +const shouldPrintPatch = require('./should-print-patch.js') + +const colors = { + // red + removed: { open: '\x1B[31m', close: '\x1B[39m' }, + // green + added: { open: '\x1B[32m', close: '\x1B[39m' }, + // blue + header: { open: '\x1B[34m', close: '\x1B[39m' }, + // cyan + section: { open: '\x1B[36m', close: '\x1B[39m' }, +} + +const color = (colorStr, colorId) => { + const { open, close } = colors[colorId] + // avoid highlighting the "\n" (would highlight till the end of the line) + return colorStr.replace(/[^\n\r]+/g, open + '$&' + close) +} + +const formatDiff = async ({ files, opts = {}, refs, versions }) => { + let res = '' + const srcPrefix = opts.diffNoPrefix ? '' : opts.diffSrcPrefix || 'a/' + const dstPrefix = opts.diffNoPrefix ? '' : opts.diffDstPrefix || 'b/' + + for (const filename of files.values()) { + const names = { + a: `${srcPrefix}${filename}`, + b: `${dstPrefix}${filename}`, + } + + let fileMode = '' + const filenames = { + a: refs.get(`a/${filename}`), + b: refs.get(`b/${filename}`), + } + const contents = { + a: filenames.a && filenames.a.content, + b: filenames.b && filenames.b.content, + } + const modes = { + a: filenames.a && filenames.a.mode, + b: filenames.b && filenames.b.mode, + } + + if (contents.a === contents.b && modes.a === modes.b) { + continue + } + + if (opts.diffNameOnly) { + res += `${filename}\n` + continue + } + + let patch = '' + let headerLength = 0 + const header = str => { + headerLength++ + patch += `${str}\n` + } + + // manually build a git diff-compatible header + header(`diff --git ${names.a} ${names.b}`) + if (modes.a === modes.b) { + fileMode = filenames.a.mode + } else { + if (modes.a && !modes.b) { + header(`deleted file mode ${modes.a}`) + } else if (!modes.a && modes.b) { + header(`new file mode ${modes.b}`) + } else { + header(`old mode ${modes.a}`) + header(`new mode ${modes.b}`) + } + } + /* eslint-disable-next-line max-len */ + header(`index ${opts.tagVersionPrefix || 'v'}${versions.a}..${opts.tagVersionPrefix || 'v'}${versions.b} ${fileMode}`) + + if (await shouldPrintPatch(filename)) { + patch += jsDiff.createTwoFilesPatch( + names.a, + names.b, + contents.a || '', + contents.b || '', + '', + '', + { + context: opts.diffUnified === 0 ? 0 : opts.diffUnified || 3, + ignoreWhitespace: opts.diffIgnoreAllSpace, + } + ).replace( + '===================================================================\n', + '' + ).replace(/\t\n/g, '\n') // strip trailing tabs + headerLength += 2 + } else { + header(`--- ${names.a}`) + header(`+++ ${names.b}`) + } + + if (opts.color) { + // this RegExp will include all the `\n` chars into the lines, easier to join + const lines = patch.split(/^/m) + res += color(lines.slice(0, headerLength).join(''), 'header') + res += lines.slice(headerLength).join('') + .replace(/^-.*/gm, color('$&', 'removed')) + .replace(/^\+.*/gm, color('$&', 'added')) + .replace(/^@@.+@@/gm, color('$&', 'section')) + } else { + res += patch + } + } + + return res.trim() +} + +module.exports = formatDiff diff --git a/node_modules/npm/node_modules/libnpmdiff/lib/index.js b/node_modules/npm/node_modules/libnpmdiff/lib/index.js new file mode 100644 index 00000000..10532c19 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmdiff/lib/index.js @@ -0,0 +1,62 @@ +const pacote = require('pacote') + +const formatDiff = require('./format-diff.js') +const getTarball = require('./tarball.js') +const untar = require('./untar.js') + +// TODO: we test this condition in the diff command +// so this error probably doesnt need to be here. Or +// if it does we should figure out a standard code +// so we can catch it in the cli and display it consistently +const argsError = () => + Object.assign( + new TypeError('libnpmdiff needs two arguments to compare'), + { code: 'EDIFFARGS' } + ) +const diff = async (specs, opts = {}) => { + if (specs.length !== 2) { + throw argsError() + } + + const [ + aManifest, + bManifest, + ] = + await Promise.all(specs.map(spec => pacote.manifest(spec, opts))) + + const versions = { + a: aManifest.version, + b: bManifest.version, + } + + // fetches tarball using pacote + const [a, b] = await Promise.all([ + getTarball(aManifest, opts), + getTarball(bManifest, opts), + ]) + + // read all files + // populates `files` and `refs` + const { + files, + refs, + } = await untar([ + { + prefix: 'a/', + item: a, + }, + { + prefix: 'b/', + item: b, + }, + ], opts) + + return formatDiff({ + files, + opts, + refs, + versions, + }) +} + +module.exports = diff diff --git a/node_modules/npm/node_modules/libnpmdiff/lib/should-print-patch.js b/node_modules/npm/node_modules/libnpmdiff/lib/should-print-patch.js new file mode 100644 index 00000000..c63cdee8 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmdiff/lib/should-print-patch.js @@ -0,0 +1,22 @@ +const { basename, extname } = require('node:path') + +// we should try to print patches as long as the +// extension is not identified as binary files +const shouldPrintPatch = async (path, opts = {}) => { + if (opts.diffText) { + return true + } + + const { default: binaryExtensions } = await import('binary-extensions') + + const filename = basename(path) + const extension = ( + filename.startsWith('.') + ? filename + : extname(filename) + ).slice(1) + + return !binaryExtensions.includes(extension) +} + +module.exports = shouldPrintPatch diff --git a/node_modules/npm/node_modules/libnpmdiff/lib/tarball.js b/node_modules/npm/node_modules/libnpmdiff/lib/tarball.js new file mode 100644 index 00000000..e2738b58 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmdiff/lib/tarball.js @@ -0,0 +1,38 @@ +const { relative } = require('node:path') + +const Arborist = require('@npmcli/arborist') +const npa = require('npm-package-arg') +const pkgContents = require('@npmcli/installed-package-contents') +const pacote = require('pacote') +const { tarCreateOptions } = pacote.DirFetcher +const tar = require('tar') + +// returns a simplified tarball when reading files from node_modules folder, +// thus avoiding running the prepare scripts and the extra logic from packlist +const nodeModulesTarball = (manifest) => + pkgContents({ path: manifest._resolved, depth: 1 }) + .then(files => + files.map(file => relative(manifest._resolved, file)) + ) + .then(files => + tar.c(tarCreateOptions(manifest), files).concat() + ) + +const tarball = (manifest, opts) => { + const resolved = manifest._resolved + const where = opts.where || process.cwd() + + const fromNodeModules = npa(resolved).type === 'directory' + && /node_modules[\\/](@[^\\/]+\/)?[^\\/]+[\\/]?$/.test(relative(where, resolved)) + + if (fromNodeModules) { + return nodeModulesTarball(manifest, opts) + } + + return pacote.tarball(manifest._resolved, { + ...opts, + Arborist, + }) +} + +module.exports = tarball diff --git a/node_modules/npm/node_modules/libnpmdiff/lib/untar.js b/node_modules/npm/node_modules/libnpmdiff/lib/untar.js new file mode 100644 index 00000000..341ae27d --- /dev/null +++ b/node_modules/npm/node_modules/libnpmdiff/lib/untar.js @@ -0,0 +1,96 @@ +const tar = require('tar') +const { minimatch } = require('minimatch') + +const normalizeMatch = str => str + .replace(/\\+/g, '/') + .replace(/^\.\/|^\./, '') + +// files and refs are mutating params +// filterFiles, item, prefix and opts are read-only options +const untar = ({ files, refs }, { filterFiles, item, prefix }) => { + tar.list({ + filter: (path, entry) => { + const fileMatch = () => + (!filterFiles.length || + filterFiles.some(f => { + const pattern = normalizeMatch(f) + return minimatch( + normalizeMatch(path), + `{package/,}${pattern}`, + { matchBase: pattern.startsWith('*') } + ) + })) + + // expands usage of simple path filters, e.g: lib or src/ + const folderMatch = () => + filterFiles.some(f => + normalizeMatch(path).startsWith(normalizeMatch(f)) || + normalizeMatch(path).startsWith(`package/${normalizeMatch(f)}`)) + + if ( + entry.type === 'File' && + (fileMatch() || folderMatch()) + ) { + const key = path.replace(/^[^/]+\/?/, '') + files.add(key) + + // should skip reading file when using --name-only option + let content + try { + entry.setEncoding('utf8') + content = entry.concat() + } catch (e) { + /* istanbul ignore next */ + throw Object.assign( + new Error('failed to read files'), + { code: 'EDIFFUNTAR' } + ) + } + + refs.set(`${prefix}${key}`, { + content, + mode: `100${entry.mode.toString(8)}`, + }) + return true + } + }, + }) + .on('error', /* istanbul ignore next */ e => { + throw e + }) + .end(item) +} + +const readTarballs = async (tarballs, opts = {}) => { + const files = new Set() + const refs = new Map() + const arr = [].concat(tarballs) + + const filterFiles = opts.diffFiles || [] + + for (const i of arr) { + untar({ + files, + refs, + }, { + item: i.item, + prefix: i.prefix, + filterFiles, + }) + } + + // await to read all content from included files + const allRefs = [...refs.values()] + const contents = await Promise.all(allRefs.map(async ref => ref.content)) + + contents.forEach((content, index) => { + allRefs[index].content = content + }) + + return { + files, + refs, + } +} + +module.exports = readTarballs diff --git a/node_modules/npm/node_modules/libnpmdiff/package.json b/node_modules/npm/node_modules/libnpmdiff/package.json new file mode 100644 index 00000000..48673c03 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmdiff/package.json @@ -0,0 +1,70 @@ +{ + "name": "libnpmdiff", + "version": "8.0.0", + "description": "The registry diff", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmdiff" + }, + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "keywords": [ + "npm", + "npmcli", + "libnpm", + "cli", + "diff" + ], + "author": "GitHub Inc.", + "contributors": [ + { + "name": "Ruy Adorno", + "url": "https://ruyadorno.com", + "twitter": "ruyadorno" + } + ], + "license": "ISC", + "scripts": { + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "test": "tap", + "posttest": "npm run lint", + "snap": "tap", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/template-oss": "4.23.6", + "tap": "^16.3.8" + }, + "dependencies": { + "@npmcli/arborist": "^9.0.0", + "@npmcli/installed-package-contents": "^3.0.0", + "binary-extensions": "^3.0.0", + "diff": "^7.0.0", + "minimatch": "^9.0.4", + "npm-package-arg": "^12.0.0", + "pacote": "^21.0.0", + "tar": "^6.2.1" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/libnpmexec/LICENSE b/node_modules/npm/node_modules/libnpmexec/LICENSE new file mode 100644 index 00000000..d3a1cdfd --- /dev/null +++ b/node_modules/npm/node_modules/libnpmexec/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) GitHub 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/npm/node_modules/libnpmexec/README.md b/node_modules/npm/node_modules/libnpmexec/README.md new file mode 100644 index 00000000..acd037c1 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmexec/README.md @@ -0,0 +1,47 @@ +# libnpmexec + +[![npm version](https://img.shields.io/npm/v/libnpmexec.svg)](https://npm.im/libnpmexec) +[![license](https://img.shields.io/npm/l/libnpmexec.svg)](https://npm.im/libnpmexec) +[![CI - libnpmexec](https://github.com/npm/cli/actions/workflows/ci-libnpmexec.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmexec.yml) + +The `npm exec` (`npx`) Programmatic API + +## Install + +`npm install libnpmexec` + +## Usage: + +```js +const libexec = require('libnpmexec') +await libexec({ + args: ['yosay', 'Bom dia!'], + cache: '~/.npm/_cacache', + npxCache: '~/.npm/_npx', + yes: true, +}) +``` + +## API: + +### `libexec(opts)` + +- `opts`: + - `args`: List of pkgs to execute **Array**, defaults to `[]` + - `call`: An alternative command to run when using `packages` option **String**, defaults to empty string. + - `cache`: The path location to where the npm cache folder is placed **String** + - `npxCache`: The path location to where the npx cache folder is placed **String** + - `chalk`: Chalk instance to use for colors? **Required** + - `localBin`: Location to the `node_modules/.bin` folder of the local project to start scanning for bin files **String**, defaults to `./node_modules/.bin`. **libexec** will walk up the directory structure looking for `node_modules/.bin` folders in parent folders that might satisfy the current `arg` and will use that bin if found. + - `locationMsg`: Overrides "at location" message when entering interactive mode **String** + - `globalBin`: Location to the global space bin folder, same as: `$(npm bin -g)` **String**, defaults to empty string. + - `packages`: A list of packages to be used (possibly fetch from the registry) **Array**, defaults to `[]` + - `path`: Location to where to read local project info (`package.json`) **String**, defaults to `.` + - `runPath`: Location to where to execute the script **String**, defaults to `.` + - `scriptShell`: Default shell to be used **String**, defaults to `sh` on POSIX systems, `process.env.ComSpec` OR `cmd` on Windows + - `yes`: Should skip download confirmation prompt when fetching missing packages from the registry? **Boolean** + - `registry`, `cache`, and more options that are forwarded to [@npmcli/arborist](https://github.com/npm/arborist/) and [pacote](https://github.com/npm/pacote/#options) **Object** + +## LICENSE + +[ISC](./LICENSE) diff --git a/node_modules/npm/node_modules/libnpmexec/lib/file-exists.js b/node_modules/npm/node_modules/libnpmexec/lib/file-exists.js new file mode 100644 index 00000000..8a1a88ad --- /dev/null +++ b/node_modules/npm/node_modules/libnpmexec/lib/file-exists.js @@ -0,0 +1,33 @@ +const { resolve } = require('node:path') +const { stat } = require('node:fs/promises') +const { walkUp } = require('walk-up-path') + +const fileExists = async (file) => { + try { + const res = await stat(file) + return res.isFile() + } catch { + return false + } +} + +const localFileExists = async (dir, binName, root) => { + for (const path of walkUp(dir)) { + const binDir = resolve(path, 'node_modules', '.bin') + + if (await fileExists(resolve(binDir, binName))) { + return binDir + } + + if (path.toLowerCase() === resolve(root).toLowerCase()) { + return false + } + } + + return false +} + +module.exports = { + fileExists, + localFileExists, +} diff --git a/node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js b/node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js new file mode 100644 index 00000000..8ebc0e7a --- /dev/null +++ b/node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js @@ -0,0 +1,22 @@ +const getBinFromManifest = (mani) => { + // if we have a bin matching (unscoped portion of) packagename, use that + // otherwise if there's 1 bin or all bin value is the same (alias), use + // that, otherwise fail + const bin = mani.bin || {} + if (new Set(Object.values(bin)).size === 1) { + return Object.keys(bin)[0] + } + + // XXX probably a util to parse this better? + const name = mani.name.replace(/^@[^/]+\//, '') + if (bin[name]) { + return name + } + + // XXX need better error message + throw Object.assign(new Error('could not determine executable to run'), { + pkgid: mani._id, + }) +} + +module.exports = getBinFromManifest diff --git a/node_modules/npm/node_modules/libnpmexec/lib/index.js b/node_modules/npm/node_modules/libnpmexec/lib/index.js new file mode 100644 index 00000000..78633a8c --- /dev/null +++ b/node_modules/npm/node_modules/libnpmexec/lib/index.js @@ -0,0 +1,301 @@ +'use strict' + +const { mkdir } = require('node:fs/promises') +const Arborist = require('@npmcli/arborist') +const ciInfo = require('ci-info') +const crypto = require('node:crypto') +const { log, input } = require('proc-log') +const npa = require('npm-package-arg') +const pacote = require('pacote') +const { read } = require('read') +const semver = require('semver') +const { fileExists, localFileExists } = require('./file-exists.js') +const getBinFromManifest = require('./get-bin-from-manifest.js') +const noTTY = require('./no-tty.js') +const runScript = require('./run-script.js') +const isWindows = require('./is-windows.js') +const { dirname, resolve } = require('node:path') + +const binPaths = [] + +// when checking the local tree we look up manifests, cache those results by +// spec.raw so we don't have to fetch again when we check npxCache +const manifests = new Map() + +const getManifest = async (spec, flatOptions) => { + if (!manifests.has(spec.raw)) { + const manifest = await pacote.manifest(spec, { ...flatOptions, preferOnline: true, Arborist }) + manifests.set(spec.raw, manifest) + } + return manifests.get(spec.raw) +} + +// Returns the required manifest if the spec is missing from the tree +// Returns the found node if it is in the tree +const missingFromTree = async ({ spec, tree, flatOptions, isNpxTree, shallow }) => { + // If asking for a spec by name only (spec.raw === spec.name): + // - In local or global mode go with anything in the tree that matches + // - If looking in the npx cache check if a newer version is available + const npxByNameOnly = isNpxTree && spec.name === spec.raw + if (spec.registry && spec.type !== 'tag' && !npxByNameOnly) { + // registry spec that is not a specific tag. + const nodesBySpec = tree.inventory.query('packageName', spec.name) + for (const node of nodesBySpec) { + // continue if node is not a top level node + if (shallow && node.depth) { + continue + } + if (spec.rawSpec === '*') { + return { node } + } + // package requested by specific version + if (spec.type === 'version' && (node.pkgid === spec.raw)) { + return { node } + } + // package requested by version range, only remaining registry type + if (semver.satisfies(node.package.version, spec.rawSpec)) { + return { node } + } + } + const manifest = await getManifest(spec, flatOptions) + return { manifest } + } else { + // non-registry spec, or a specific tag, or name only in npx tree. Look up + // manifest and check resolved to see if it's in the tree. + const manifest = await getManifest(spec, flatOptions) + if (spec.type === 'directory') { + return { manifest } + } + const nodesByManifest = tree.inventory.query('packageName', manifest.name) + for (const node of nodesByManifest) { + if (node.package.resolved === manifest._resolved) { + // we have a package by the same name and the same resolved destination, nothing to add. + return { node } + } + } + return { manifest } + } +} + +// see if the package.json at `path` has an entry that matches `cmd` +const hasPkgBin = (path, cmd, flatOptions) => + pacote.manifest(path, flatOptions) + .then(manifest => manifest?.bin?.[cmd]).catch(() => null) + +const exec = async (opts) => { + const { + args = [], + call = '', + localBin = resolve('./node_modules/.bin'), + locationMsg = undefined, + globalBin = '', + globalPath, + // dereference values because we manipulate it later + packages: [...packages] = [], + path = '.', + runPath = '.', + scriptShell = isWindows ? process.env.ComSpec || 'cmd' : 'sh', + ...flatOptions + } = opts + + let pkgPaths = opts.pkgPath + if (typeof pkgPaths === 'string') { + pkgPaths = [pkgPaths] + } + if (!pkgPaths) { + pkgPaths = ['.'] + } + let yes = opts.yes + const run = () => runScript({ + args, + call, + flatOptions, + locationMsg, + path, + binPaths, + runPath, + scriptShell, + }) + + // interactive mode + if (!call && !args.length && !packages.length) { + return run() + } + + // Look in the local tree too + pkgPaths.push(path) + + let needPackageCommandSwap = (args.length > 0) && (packages.length === 0) + // If they asked for a command w/o specifying a package, see if there is a + // bin that directly matches that name: + // - in any local packages (pkgPaths can have workspaces in them or just the root) + // - in the local tree (path) + // - globally + if (needPackageCommandSwap) { + // Local packages and local tree + for (const p of pkgPaths) { + if (await hasPkgBin(p, args[0], flatOptions)) { + // we have to install the local package into the npx cache so that its + // bin links get set up + flatOptions.installLinks = false + // args[0] will exist when the package is installed + packages.push(p) + yes = true + needPackageCommandSwap = false + break + } + } + if (needPackageCommandSwap) { + // no bin entry in local packages or in tree, now we look for binPaths + const dir = dirname(dirname(localBin)) + const localBinPath = await localFileExists(dir, args[0], '/') + if (localBinPath) { + binPaths.push(localBinPath) + return await run() + } else if (globalPath && await fileExists(`${globalBin}/${args[0]}`)) { + binPaths.push(globalBin) + return await run() + } + // We swap out args[0] with the bin from the manifest later + packages.push(args[0]) + } + } + + // Resolve any directory specs so that the npx directory is unique to the + // resolved directory, not the potentially relative one (i.e. "npx .") + for (const i in packages) { + const pkg = packages[i] + const spec = npa(pkg) + if (spec.type === 'directory') { + packages[i] = spec.fetchSpec + } + } + + const localArb = new Arborist({ ...flatOptions, path }) + const localTree = await localArb.loadActual() + + // Find anything that isn't installed locally + const needInstall = [] + let commandManifest + await Promise.all(packages.map(async (pkg, i) => { + const spec = npa(pkg, path) + const { manifest, node } = await missingFromTree({ spec, tree: localTree, flatOptions }) + if (manifest) { + // Package does not exist in the local tree + needInstall.push({ spec, manifest }) + if (i === 0) { + commandManifest = manifest + } + } else if (i === 0) { + // The node.package has enough to look up the bin + commandManifest = node.package + } + })) + + if (needPackageCommandSwap) { + const spec = npa(args[0]) + + if (spec.type === 'directory') { + yes = true + } + + args[0] = getBinFromManifest(commandManifest) + + if (needInstall.length > 0 && globalPath) { + // See if the package is installed globally. If it is, run the translated bin + const globalArb = new Arborist({ ...flatOptions, path: globalPath, global: true }) + const globalTree = await globalArb.loadActual().catch(() => { + log.verbose(`Could not read global path ${globalPath}, ignoring`) + return null + }) + if (globalTree) { + const { manifest: globalManifest } = + await missingFromTree({ spec, tree: globalTree, flatOptions, shallow: true }) + if (!globalManifest && await fileExists(`${globalBin}/${args[0]}`)) { + binPaths.push(globalBin) + return await run() + } + } + } + } + + const add = [] + if (needInstall.length > 0) { + // Install things to the npx cache, if needed + const { npxCache } = flatOptions + if (!npxCache) { + throw new Error('Must provide a valid npxCache path') + } + const hash = crypto.createHash('sha512') + .update(packages.map(p => { + // Keeps the npx directory unique to the resolved directory, not the + // potentially relative one (i.e. "npx .") + const spec = npa(p) + if (spec.type === 'directory') { + return spec.fetchSpec + } + return p + }).sort((a, b) => a.localeCompare(b, 'en')).join('\n')) + .digest('hex') + .slice(0, 16) + const installDir = resolve(npxCache, hash) + await mkdir(installDir, { recursive: true }) + const npxArb = new Arborist({ + ...flatOptions, + path: installDir, + }) + const npxTree = await npxArb.loadActual() + await Promise.all(needInstall.map(async ({ spec }) => { + const { manifest } = await missingFromTree({ + spec, + tree: npxTree, + flatOptions, + isNpxTree: true, + }) + if (manifest) { + // Manifest is not in npxCache, we need to install it there + if (!spec.registry) { + add.push(manifest._from) + } else { + add.push(manifest._id) + } + } + })) + + if (add.length) { + if (!yes) { + const addList = add.map(a => `${a.replace(/@$/, '')}`) + + // set -n to always say no + if (yes === false) { + // Error message lists missing package(s) when process is canceled + /* eslint-disable-next-line max-len */ + throw new Error(`npx canceled due to missing packages and no YES option: ${JSON.stringify(addList)}`) + } + + if (noTTY() || ciInfo.isCI) { + /* eslint-disable-next-line max-len */ + log.warn('exec', `The following package${add.length === 1 ? ' was' : 's were'} not found and will be installed: ${addList.join(', ')}`) + } else { + const confirm = await input.read(() => read({ + /* eslint-disable-next-line max-len */ + prompt: `Need to install the following packages:\n${addList.join('\n')}\nOk to proceed? `, + default: 'y', + })) + if (confirm.trim().toLowerCase().charAt(0) !== 'y') { + throw new Error('canceled') + } + } + } + await npxArb.reify({ + ...flatOptions, + add, + }) + } + binPaths.push(resolve(installDir, 'node_modules/.bin')) + } + + return await run() +} + +module.exports = exec diff --git a/node_modules/npm/node_modules/libnpmexec/lib/is-windows.js b/node_modules/npm/node_modules/libnpmexec/lib/is-windows.js new file mode 100644 index 00000000..fbece90a --- /dev/null +++ b/node_modules/npm/node_modules/libnpmexec/lib/is-windows.js @@ -0,0 +1 @@ +module.exports = process.platform === 'win32' diff --git a/node_modules/npm/node_modules/libnpmexec/lib/no-tty.js b/node_modules/npm/node_modules/libnpmexec/lib/no-tty.js new file mode 100644 index 00000000..601798d2 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmexec/lib/no-tty.js @@ -0,0 +1 @@ +module.exports = () => !process.stdin.isTTY diff --git a/node_modules/npm/node_modules/libnpmexec/lib/run-script.js b/node_modules/npm/node_modules/libnpmexec/lib/run-script.js new file mode 100644 index 00000000..1f621edc --- /dev/null +++ b/node_modules/npm/node_modules/libnpmexec/lib/run-script.js @@ -0,0 +1,61 @@ +const ciInfo = require('ci-info') +const runScript = require('@npmcli/run-script') +const readPackageJson = require('read-package-json-fast') +const { log, output } = require('proc-log') +const noTTY = require('./no-tty.js') + +const run = async ({ + args, + call, + flatOptions, + locationMsg, + path, + binPaths, + runPath, + scriptShell, +}) => { + // turn list of args into command string + const script = call || args.shift() || scriptShell + + // do the fakey runScript dance + // still should work if no package.json in cwd + const realPkg = await readPackageJson(`${path}/package.json`).catch(() => ({})) + const pkg = { + ...realPkg, + scripts: { + ...(realPkg.scripts || {}), + npx: script, + }, + } + + if (script === scriptShell) { + if (!noTTY()) { + if (ciInfo.isCI) { + return log.warn('exec', 'Interactive mode disabled in CI environment') + } + + const { chalk } = flatOptions + + output.standard(`${ + chalk.reset('\nEntering npm script environment') + }${ + chalk.reset(locationMsg || ` at location:\n${chalk.dim(runPath)}`) + }${ + chalk.bold('\nType \'exit\' or ^D when finished\n') + }`) + } + } + return runScript({ + ...flatOptions, + pkg, + // we always run in cwd, not --prefix + path: runPath, + binPaths, + event: 'npx', + args, + stdio: 'inherit', + scriptShell, + }) +} + +module.exports = run diff --git a/node_modules/npm/node_modules/libnpmexec/package.json b/node_modules/npm/node_modules/libnpmexec/package.json new file mode 100644 index 00000000..5009d76d --- /dev/null +++ b/node_modules/npm/node_modules/libnpmexec/package.json @@ -0,0 +1,79 @@ +{ + "name": "libnpmexec", + "version": "10.0.0", + "files": [ + "bin/", + "lib/" + ], + "main": "lib/index.js", + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "description": "npm exec (npx) programmatic API", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmexec" + }, + "keywords": [ + "npm", + "npmcli", + "libnpm", + "cli", + "workspaces", + "libnpmexec" + ], + "author": "GitHub Inc.", + "contributors": [ + { + "name": "Ruy Adorno", + "url": "https://ruyadorno.com", + "twitter": "ruyadorno" + } + ], + "license": "ISC", + "scripts": { + "lint": "npm run eslint", + "posttest": "npm run lint", + "test": "tap", + "snap": "tap", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "tap": { + "files": "test/*.js", + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/mock-registry": "^1.0.0", + "@npmcli/template-oss": "4.23.6", + "bin-links": "^5.0.0", + "chalk": "^5.2.0", + "just-extend": "^6.2.0", + "just-safe-set": "^4.2.1", + "tap": "^16.3.8" + }, + "dependencies": { + "@npmcli/arborist": "^9.0.0", + "@npmcli/run-script": "^9.0.1", + "ci-info": "^4.0.0", + "npm-package-arg": "^12.0.0", + "pacote": "^21.0.0", + "proc-log": "^5.0.0", + "read": "^4.0.0", + "read-package-json-fast": "^4.0.0", + "semver": "^7.3.7", + "walk-up-path": "^4.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + } +} diff --git a/node_modules/npm/node_modules/libnpmfund/LICENSE b/node_modules/npm/node_modules/libnpmfund/LICENSE new file mode 100644 index 00000000..dedcd7d2 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmfund/LICENSE @@ -0,0 +1,15 @@ +The 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 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/npm/node_modules/libnpmfund/README.md b/node_modules/npm/node_modules/libnpmfund/README.md new file mode 100644 index 00000000..6072b11d --- /dev/null +++ b/node_modules/npm/node_modules/libnpmfund/README.md @@ -0,0 +1,131 @@ +# libnpmfund + +[![npm version](https://img.shields.io/npm/v/libnpmfund.svg)](https://npm.im/libnpmfund) +[![license](https://img.shields.io/npm/l/libnpmfund.svg)](https://npm.im/libnpmfund) +[![CI - libnpmfund](https://github.com/npm/cli/actions/workflows/ci-libnpmfund.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmfund.yml) + +[`libnpmfund`](https://github.com/npm/libnpmfund) is a Node.js library for +retrieving **funding** information for packages installed using +[`arborist`](https://github.com/npm/arborist). + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [Contributing](#contributing) +* [API](#api) +* [LICENSE](#license) + +## Example + +```js +const { read } = require('libnpmfund') + +const fundingInfo = await read() +console.log( + JSON.stringify(fundingInfo, null, 2) +) +// => { + length: 2, + name: 'foo', + version: '1.0.0', + funding: { url: 'https://example.com' }, + dependencies: { + bar: { + version: '1.0.0', + funding: { url: 'http://collective.example.com' } + } + } +} +``` + +## Install + +`$ npm install libnpmfund` + +### Contributing + +The npm team enthusiastically welcomes contributions and project participation! +There's a bunch of things you can do if you want to contribute! The +[Contributor Guide](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md) +outlines the process for community interaction and contribution. Please don't +hesitate to jump in if you'd like to, or even ask us questions if something +isn't clear. + +All participants and maintainers in this project are expected to follow the +[npm Code of Conduct](https://www.npmjs.com/policies/conduct), and just +generally be excellent to each other. + +Please refer to the [Changelog](CHANGELOG.md) for project history details, too. + +Happy hacking! + +### API + +##### `> fund.read([opts]) -> Promise` + +Reads **funding** info from a npm install and returns a promise for a +tree object that only contains packages in which funding info is defined. + +Options: + +- `countOnly`: Uses the tree-traversal logic from **npm fund** but skips over +any obj definition and just returns an obj containing `{ length }` - useful for +things such as printing a `6 packages are looking for funding` msg. +- `workspaces`: `Array` List of workspaces names to filter for, +the result will only include a subset of the resulting tree that includes +only the nodes that are children of the listed workspaces names. +- `path`, `registry` and more [Arborist](https://github.com/npm/arborist/) options. + +##### `> fund.readTree(tree, [opts]) -> Promise` + +Reads **funding** info from a given install tree and returns a tree object +that only contains packages in which funding info is defined. + +- `tree`: An [`arborist`](https://github.com/npm/arborist) tree to be used, e.g: + +```js +const Arborist = require('@npmcli/arborist') +const { readTree } = require('libnpmfund') + +const arb = new Arborist({ path: process.cwd() }) +const tree = await arb.loadActual() + +return readTree(tree, { countOnly: false }) +``` + +Options: + +- `countOnly`: Uses the tree-traversal logic from **npm fund** but skips over +any obj definition and just returns an obj containing `{ length }` - useful for +things such as printing a `6 packages are looking for funding` msg. + +##### `> fund.normalizeFunding(funding) -> Object` + +From a `funding` ``, retrieves normalized funding objects +containing a `url` property. + +e.g: + +```js +normalizeFunding('http://example.com') +// => { + url: 'http://example.com' +} +``` + +##### `> fund.isValidFunding(funding) -> Boolean` + +Returns `` if `funding` is a valid funding object, e.g: + +```js +isValidFunding({ foo: 'not a valid funding obj' }) +// => false + +isValidFunding('http://example.com') +// => true +``` + +## LICENSE + +[ISC](./LICENSE) diff --git a/node_modules/npm/node_modules/libnpmfund/lib/index.js b/node_modules/npm/node_modules/libnpmfund/lib/index.js new file mode 100644 index 00000000..1616c88b --- /dev/null +++ b/node_modules/npm/node_modules/libnpmfund/lib/index.js @@ -0,0 +1,210 @@ +'use strict' + +const URL = require('node:url').URL +const Arborist = require('@npmcli/arborist') + +// supports object funding and string shorthand, or an array of these +// if original was an array, returns an array; else returns the lone item +function normalizeFunding (funding) { + const normalizeItem = item => + typeof item === 'string' ? { url: item } : item + const sources = [].concat(funding || []).map(normalizeItem) + return Array.isArray(funding) ? sources : sources[0] +} + +// Is the value of a `funding` property of a `package.json` +// a valid type+url for `npm fund` to display? +function isValidFunding (funding) { + if (!funding) { + return false + } + + if (Array.isArray(funding)) { + return funding.every(f => !Array.isArray(f) && isValidFunding(f)) + } + + try { + var parsed = new URL(funding.url || funding) + } catch (error) { + return false + } + + if ( + parsed.protocol !== 'https:' && + parsed.protocol !== 'http:' + ) { + return false + } + + return Boolean(parsed.host) +} + +const empty = () => Object.create(null) + +function readTree (tree, opts) { + let packageWithFundingCount = 0 + const seen = new Set() + const { countOnly } = opts || {} + const _trailingDependencies = Symbol('trailingDependencies') + + let filterSet + + if (opts && opts.workspaces && opts.workspaces.length) { + const arb = new Arborist(opts) + filterSet = arb.workspaceDependencySet(tree, opts.workspaces) + } + + function tracked (name, version) { + const key = String(name) + String(version) + if (seen.has(key)) { + return true + } + + seen.add(key) + } + + function retrieveDependencies (dependencies) { + const trailing = dependencies[_trailingDependencies] + + if (trailing) { + return Object.assign( + empty(), + dependencies, + trailing + ) + } + + return dependencies + } + + function hasDependencies (dependencies) { + return dependencies && ( + Object.keys(dependencies).length || + dependencies[_trailingDependencies] + ) + } + + function attachFundingInfo (target, funding) { + if (funding && isValidFunding(funding)) { + target.funding = normalizeFunding(funding) + packageWithFundingCount++ + } + } + + function getFundingDependencies (t) { + const edges = t && t.edgesOut && t.edgesOut.values() + if (!edges) { + return empty() + } + + const directDepsWithFunding = Array.from(edges).map(edge => { + if (!edge || !edge.to) { + return empty() + } + + const node = edge.to.target || edge.to + if (!node.package) { + return empty() + } + + if (filterSet && filterSet.size > 0 && !filterSet.has(node)) { + return empty() + } + + const { name, funding, version } = node.package + + // avoids duplicated items within the funding tree + if (tracked(name, version)) { + return empty() + } + + const fundingItem = {} + + if (version) { + fundingItem.version = version + } + + attachFundingInfo(fundingItem, funding) + + return { + node, + fundingItem, + } + }) + + return directDepsWithFunding.reduce( + (res, { node, fundingItem }) => { + if (!fundingItem || + fundingItem.length === 0 || + !node) { + return res + } + + // recurse + const transitiveDependencies = node.edgesOut && + node.edgesOut.size > 0 && + getFundingDependencies(node) + + // if we're only counting items there's no need + // to add all the data to the resulting object + if (countOnly) { + return null + } + + if (hasDependencies(transitiveDependencies)) { + fundingItem.dependencies = + retrieveDependencies(transitiveDependencies) + } + + if (isValidFunding(fundingItem.funding)) { + res[node.package.name] = fundingItem + } else if (hasDependencies(fundingItem.dependencies)) { + res[_trailingDependencies] = + Object.assign( + empty(), + res[_trailingDependencies], + fundingItem.dependencies + ) + } + + return res + }, countOnly ? null : empty()) + } + + const treeDependencies = getFundingDependencies(tree) + const result = { + length: packageWithFundingCount, + } + + if (!countOnly) { + const name = + (tree && tree.package && tree.package.name) || + (tree && tree.name) + result.name = name || (tree && tree.path) + + if (tree && tree.package && tree.package.version) { + result.version = tree.package.version + } + + if (tree && tree.package && tree.package.funding) { + result.funding = normalizeFunding(tree.package.funding) + } + + result.dependencies = retrieveDependencies(treeDependencies) + } + + return result +} + +async function read (opts) { + const arb = new Arborist(opts) + const tree = await arb.loadActual(opts) + return readTree(tree, opts) +} + +module.exports = { + read, + readTree, + normalizeFunding, + isValidFunding, +} diff --git a/node_modules/npm/node_modules/libnpmfund/package.json b/node_modules/npm/node_modules/libnpmfund/package.json new file mode 100644 index 00000000..8d458259 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmfund/package.json @@ -0,0 +1,65 @@ +{ + "name": "libnpmfund", + "version": "7.0.0", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "description": "Programmatic API for npm fund", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmfund" + }, + "keywords": [ + "npm", + "npmcli", + "libnpm", + "cli", + "git", + "fund", + "gitfund" + ], + "author": "GitHub Inc.", + "contributors": [ + { + "name": "Ruy Adorno", + "url": "https://ruyadorno.com", + "twitter": "ruyadorno" + } + ], + "license": "ISC", + "scripts": { + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "test": "tap", + "snap": "tap", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/template-oss": "4.23.6", + "tap": "^16.3.8" + }, + "dependencies": { + "@npmcli/arborist": "^9.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/libnpmorg/LICENSE b/node_modules/npm/node_modules/libnpmorg/LICENSE new file mode 100644 index 00000000..209e4477 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmorg/LICENSE @@ -0,0 +1,13 @@ +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/npm/node_modules/libnpmorg/README.md b/node_modules/npm/node_modules/libnpmorg/README.md new file mode 100644 index 00000000..d5165523 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmorg/README.md @@ -0,0 +1,148 @@ +# libnpmorg + +[![npm version](https://img.shields.io/npm/v/libnpmorg.svg)](https://npm.im/libnpmorg) +[![license](https://img.shields.io/npm/l/libnpmorg.svg)](https://npm.im/libnpmorg) +[![CI - libnpmorg](https://github.com/npm/cli/actions/workflows/ci-libnpmorg.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmorg.yml) + +[`libnpmorg`](https://github.com/npm/libnpmorg) is a Node.js library for +programmatically accessing the [npm Org membership +API](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#membership-detail). + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [Contributing](#contributing) +* [API](#api) + * [hook opts](#opts) + * [`set()`](#set) + * [`rm()`](#rm) + * [`ls()`](#ls) + * [`ls.stream()`](#ls-stream) + +## Example + +```js +const org = require('libnpmorg') + +console.log(await org.ls('myorg', {token: 'deadbeef'})) +=> +Roster { + zkat: 'developer', + iarna: 'admin', + isaacs: 'owner' +} +``` + +## Install + +`$ npm install libnpmorg` + +### API + +#### `opts` for `libnpmorg` commands + +`libnpmorg` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch). +All options are passed through directly to that library, so please refer to [its +own `opts` +documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options) +for options that can be passed in. + +A couple of options of note for those in a hurry: + +* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs. +* `opts.otp` - certain operations will require an OTP token to be passed in. If a `libnpmorg` command fails with `err.code === EOTP`, please retry the request with `{otp: <2fa token>}` + +#### `> org.set(org, user, [role], [opts]) -> Promise` + +The returned Promise resolves to a [Membership +Detail](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#membership-detail) +object. + +The `role` is optional and should be one of `admin`, `owner`, or `developer`. +`developer` is the default if no `role` is provided. + +`org` and `user` must be scope names for the org name and user name +respectively. They can optionally be prefixed with `@`. + +See also: [`PUT +/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-membership-replace) + +##### Example + +```javascript +await org.set('@myorg', '@myuser', 'admin', {token: 'deadbeef'}) +=> +MembershipDetail { + org: { + name: 'myorg', + size: 15 + }, + user: 'myuser', + role: 'admin' +} +``` + +#### `> org.rm(org, user, [opts]) -> Promise` + +The Promise resolves to `null` on success. + +`org` and `user` must be scope names for the org name and user name +respectively. They can optionally be prefixed with `@`. + +See also: [`DELETE +/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-membership-delete) + +##### Example + +```javascript +await org.rm('myorg', 'myuser', {token: 'deadbeef'}) +``` + +#### `> org.ls(org, [opts]) -> Promise` + +The Promise resolves to a +[Roster](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#roster) +object. + +`org` must be a scope name for an org, and can be optionally prefixed with `@`. + +See also: [`GET +/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-roster) + +##### Example + +```javascript +await org.ls('myorg', {token: 'deadbeef'}) +=> +Roster { + zkat: 'developer', + iarna: 'admin', + isaacs: 'owner' +} +``` + +#### `> org.ls.stream(org, [opts]) -> Stream` + +Returns a stream of entries for a +[Roster](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#roster), +with each emitted entry in `[key, value]` format. + +`org` must be a scope name for an org, and can be optionally prefixed with `@`. + +The returned stream is a valid `Symbol.asyncIterator`. + +See also: [`GET +/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-roster) + +##### Example + +```javascript +for await (let [user, role] of org.ls.stream('myorg', {token: 'deadbeef'})) { + console.log(`user: ${user} (${role})`) +} +=> +user: zkat (developer) +user: iarna (admin) +user: isaacs (owner) +``` diff --git a/node_modules/npm/node_modules/libnpmorg/lib/index.js b/node_modules/npm/node_modules/libnpmorg/lib/index.js new file mode 100644 index 00000000..f3d361b8 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmorg/lib/index.js @@ -0,0 +1,64 @@ +'use strict' + +const eu = encodeURIComponent +const npmFetch = require('npm-registry-fetch') +const validate = require('aproba') + +// From https://github.com/npm/registry/blob/master/docs/orgs/memberships.md +const cmd = module.exports + +class MembershipDetail {} +cmd.set = (org, user, role, opts = {}) => { + if ( + typeof role === 'object' && + Object.keys(opts).length === 0 + ) { + opts = role + role = undefined + } + validate('SSSO|SSZO', [org, user, role, opts]) + user = user.replace(/^@?/, '') + org = org.replace(/^@?/, '') + return npmFetch.json(`/-/org/${eu(org)}/user`, { + ...opts, + method: 'PUT', + body: { user, role }, + }).then(ret => Object.assign(new MembershipDetail(), ret)) +} + +cmd.rm = (org, user, opts = {}) => { + validate('SSO', [org, user, opts]) + user = user.replace(/^@?/, '') + org = org.replace(/^@?/, '') + return npmFetch(`/-/org/${eu(org)}/user`, { + ...opts, + method: 'DELETE', + body: { user }, + ignoreBody: true, + }).then(() => null) +} + +class Roster {} +cmd.ls = (org, opts = {}) => { + return cmd.ls.stream(org, opts) + .collect() + .then(data => data.reduce((acc, [key, val]) => { + if (!acc) { + acc = {} + } + acc[key] = val + return acc + }, null)) + .then(ret => Object.assign(new Roster(), ret)) +} + +cmd.ls.stream = (org, opts = {}) => { + validate('SO', [org, opts]) + org = org.replace(/^@?/, '') + return npmFetch.json.stream(`/-/org/${eu(org)}/user`, '*', { + ...opts, + mapJSON: (value, [key]) => { + return [key, value] + }, + }) +} diff --git a/node_modules/npm/node_modules/libnpmorg/package.json b/node_modules/npm/node_modules/libnpmorg/package.json new file mode 100644 index 00000000..aec1ef79 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmorg/package.json @@ -0,0 +1,62 @@ +{ + "name": "libnpmorg", + "version": "8.0.0", + "description": "Programmatic api for `npm org` commands", + "author": "GitHub Inc.", + "main": "lib/index.js", + "keywords": [ + "libnpm", + "npm", + "package manager", + "api", + "orgs", + "teams" + ], + "license": "ISC", + "scripts": { + "lint": "npm run eslint", + "test": "tap", + "posttest": "npm run lint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "files": [ + "bin/", + "lib/" + ], + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/template-oss": "4.23.6", + "minipass": "^7.1.1", + "nock": "^13.3.3", + "tap": "^16.3.8" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmorg" + }, + "bugs": "https://github.com/npm/libnpmorg/issues", + "homepage": "https://npmjs.com/package/libnpmorg", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^18.0.1" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/libnpmpack/LICENSE b/node_modules/npm/node_modules/libnpmpack/LICENSE new file mode 100644 index 00000000..209e4477 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpack/LICENSE @@ -0,0 +1,13 @@ +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/npm/node_modules/libnpmpack/README.md b/node_modules/npm/node_modules/libnpmpack/README.md new file mode 100644 index 00000000..e3ed416a --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpack/README.md @@ -0,0 +1,55 @@ +# libnpmpack + +[![npm version](https://img.shields.io/npm/v/libnpmpack.svg)](https://npm.im/libnpmpack) +[![license](https://img.shields.io/npm/l/libnpmpack.svg)](https://npm.im/libnpmpack) +[![CI - libnpmpack](https://github.com/npm/cli/actions/workflows/ci-libnpmpack.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmpack.yml) + +[`libnpmpack`](https://github.com/npm/libnpmpack) is a Node.js library for +programmatically packing tarballs from a local directory or from a registry or github spec. If packing from a local source, `libnpmpack` will also run the `prepack` and `postpack` lifecycles. + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [API](#api) + * [`pack()`](#pack) + +## Example + +```js +const pack = require('libnpmpack') +``` + +## Install + +`$ npm install libnpmpack` + +### API + +#### `> pack(spec, [opts]) -> Promise` + +Packs a tarball from a local directory or from a registry or github spec and returns a Promise that resolves to the tarball data Buffer, with from, resolved, and integrity fields attached. + +If no options are passed, the tarball file will be saved on the same directory from which `pack` was called in. + +`libnpmpack` uses [`pacote`](https://npm.im/pacote). +Most options are passed through directly to that library, so please refer to +[its own `opts` +documentation](https://www.npmjs.com/package/pacote#options) +for options that can be passed in. + +##### Examples + +```javascript +// packs from cwd +const tarball = await pack() + +// packs from a local directory +const localTar = await pack('/Users/claudiahdz/projects/my-cool-pkg') + +// packs from a registry spec +const registryTar = await pack('abbrev@1.0.3') + +// packs from a github spec +const githubTar = await pack('isaacs/rimraf#PR-192') +``` diff --git a/node_modules/npm/node_modules/libnpmpack/lib/index.js b/node_modules/npm/node_modules/libnpmpack/lib/index.js new file mode 100644 index 00000000..bd3e0c7b --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpack/lib/index.js @@ -0,0 +1,62 @@ +'use strict' + +const pacote = require('pacote') +const npa = require('npm-package-arg') +const runScript = require('@npmcli/run-script') +const path = require('node:path') +const Arborist = require('@npmcli/arborist') +const { writeFile } = require('node:fs/promises') + +module.exports = pack +async function pack (spec = 'file:.', opts = {}) { + // gets spec + spec = npa(spec) + + const manifest = await pacote.manifest(spec, { ...opts, Arborist }) + + const stdio = opts.foregroundScripts ? 'inherit' : 'pipe' + + if (spec.type === 'directory' && !opts.ignoreScripts) { + // prepack + await runScript({ + ...opts, + event: 'prepack', + path: spec.fetchSpec, + stdio, + pkg: manifest, + }) + } + + // packs tarball + const tarball = await pacote.tarball(manifest._resolved, { + ...opts, + Arborist, + integrity: manifest._integrity, + }) + + // check for explicit `false` so the default behavior is to skip writing to disk + if (opts.dryRun === false) { + const filename = `${manifest.name}-${manifest.version}.tgz` + .replace(/^@/, '').replace(/\//, '-') + const destination = path.resolve(opts.packDestination, filename) + await writeFile(destination, tarball) + } + + if (spec.type === 'directory' && !opts.ignoreScripts) { + // postpack + await runScript({ + ...opts, + event: 'postpack', + path: spec.fetchSpec, + stdio, + pkg: manifest, + env: { + npm_package_from: tarball.from, + npm_package_resolved: tarball.resolved, + npm_package_integrity: tarball.integrity, + }, + }) + } + + return tarball +} diff --git a/node_modules/npm/node_modules/libnpmpack/package.json b/node_modules/npm/node_modules/libnpmpack/package.json new file mode 100644 index 00000000..eba99bd3 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpack/package.json @@ -0,0 +1,59 @@ +{ + "name": "libnpmpack", + "version": "9.0.0", + "description": "Programmatic API for the bits behind npm pack", + "author": "GitHub Inc.", + "main": "lib/index.js", + "contributors": [ + "Claudia Hernández " + ], + "files": [ + "bin/", + "lib/" + ], + "license": "ISC", + "scripts": { + "lint": "npm run eslint", + "test": "tap", + "posttest": "npm run lint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/template-oss": "4.23.6", + "nock": "^13.3.3", + "spawk": "^1.7.1", + "tap": "^16.3.8" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmpack" + }, + "bugs": "https://github.com/npm/libnpmpack/issues", + "homepage": "https://npmjs.com/package/libnpmpack", + "dependencies": { + "@npmcli/arborist": "^9.0.0", + "@npmcli/run-script": "^9.0.1", + "npm-package-arg": "^12.0.0", + "pacote": "^21.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/libnpmpublish/LICENSE b/node_modules/npm/node_modules/libnpmpublish/LICENSE new file mode 100644 index 00000000..209e4477 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpublish/LICENSE @@ -0,0 +1,13 @@ +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/npm/node_modules/libnpmpublish/README.md b/node_modules/npm/node_modules/libnpmpublish/README.md new file mode 100644 index 00000000..90b1f7c6 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpublish/README.md @@ -0,0 +1,120 @@ +# libnpmpublish + +[![npm version](https://img.shields.io/npm/v/libnpmpublish.svg)](https://npm.im/libnpmpublish) +[![license](https://img.shields.io/npm/l/libnpmpublish.svg)](https://npm.im/libnpmpublish) +[![CI - libnpmpublish](https://github.com/npm/cli/actions/workflows/ci-libnpmpublish.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmpublish.yml) + +[`libnpmpublish`](https://github.com/npm/libnpmpublish) is a Node.js +library for programmatically publishing and unpublishing npm packages. Give +it a manifest as an object and a tarball as a Buffer, and it'll put them on +the registry for you. + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [API](#api) + * [publish/unpublish opts](#opts) + * [`publish()`](#publish) + * [`unpublish()`](#unpublish) + +## Example + +```js +const { publish, unpublish } = require('libnpmpublish') +``` + +## Install + +`$ npm install libnpmpublish` + +### API + +#### `opts` for `libnpmpublish` commands + +`libnpmpublish` uses +[`npm-registry-fetch`](https://npm.im/npm-registry-fetch). Most options +are passed through directly to that library, so please refer to [its own +`opts` documentation](http://npm.im/npm-registry-fetch#fetch-options) for +options that can be passed in. + +A couple of options of note: + +* `opts.defaultTag` - registers the published package with the given tag, + defaults to `latest`. + +* `opts.access` - tells the registry whether this package should be + published as `public` or `restricted`. Only applies to scoped + packages. Defaults to `public`. + +* `opts.token` - can be passed in and will be used as the authentication + token for the registry. For other ways to pass in auth details, see the + n-r-f docs. + +* `opts.provenance` - when running in a supported CI environment, will trigger + the generation of a signed provenance statement to be published alongside + the package. Mutually exclusive with the `provenanceFile` option. + +* `opts.provenanceFile` - specifies the path to an externally-generated + provenance statement to be published alongside the package. Mutually + exclusive with the `provenance` option. The specified file should be a + [Sigstore Bundle](https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_bundle.proto) + containing a [DSSE](https://github.com/secure-systems-lab/dsse)-packaged + provenance statement. + +#### `> libpub.publish(manifest, tarData, [opts]) -> Promise` + +Sends the package represented by the `manifest` and `tarData` to the +configured registry. + +`manifest` should be the parsed `package.json` for the package being +published (which can also be the manifest pulled from a packument, a git +repo, tarball, etc.) + +`tarData` is a `Buffer` of the tarball being published. + +If `opts.npmVersion` is passed in, it will be used as the `_npmVersion` +field in the outgoing packument. You may put your own user-agent string in +there to identify your publishes. + +If `opts.algorithms` is passed in, it should be an array of hashing +algorithms to generate `integrity` hashes for. The default is `['sha512']`, +which means you end up with `dist.integrity = 'sha512-deadbeefbadc0ffee'`. +Any algorithm supported by your current node version is allowed -- npm +clients that do not support those algorithms will simply ignore the +unsupported hashes. + +##### Example + +```js +// note that pacote.manifest() and pacote.tarball() can also take +// any spec that npm can install. a folder shown here, since that's +// far and away the most common use case. +const path = '/a/path/to/your/source/code' +const pacote = require('pacote') // see: http://npm.im/pacote +const manifest = await pacote.manifest(path) +const tarData = await pacote.tarball(path) +await libpub.publish(manifest, tarData, { + npmVersion: 'my-pub-script@1.0.2', + token: 'my-auth-token-here' +}, opts) +// Package has been published to the npm registry. +``` + +#### `> libpub.unpublish(spec, [opts]) -> Promise` + +Unpublishes `spec` from the appropriate registry. The registry in question may +have its own limitations on unpublishing. + +`spec` should be either a string, or a valid +[`npm-package-arg`](https://npm.im/npm-package-arg) parsed spec object. For +legacy compatibility reasons, only `tag` and `version` specs will work as +expected. `range` specs will fail silently in most cases. + +##### Example + +```js +await libpub.unpublish('lodash', { token: 'i-am-the-worst'}) +// +// `lodash` has now been unpublished, along with all its versions +``` diff --git a/node_modules/npm/node_modules/libnpmpublish/lib/index.js b/node_modules/npm/node_modules/libnpmpublish/lib/index.js new file mode 100644 index 00000000..35687e02 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpublish/lib/index.js @@ -0,0 +1,4 @@ +module.exports = { + publish: require('./publish.js'), + unpublish: require('./unpublish.js'), +} diff --git a/node_modules/npm/node_modules/libnpmpublish/lib/provenance.js b/node_modules/npm/node_modules/libnpmpublish/lib/provenance.js new file mode 100644 index 00000000..cead8da6 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpublish/lib/provenance.js @@ -0,0 +1,245 @@ +const sigstore = require('sigstore') +const { readFile } = require('node:fs/promises') +const ci = require('ci-info') +const { env } = process + +const INTOTO_PAYLOAD_TYPE = 'application/vnd.in-toto+json' +const INTOTO_STATEMENT_V01_TYPE = 'https://in-toto.io/Statement/v0.1' +const INTOTO_STATEMENT_V1_TYPE = 'https://in-toto.io/Statement/v1' +const SLSA_PREDICATE_V02_TYPE = 'https://slsa.dev/provenance/v0.2' +const SLSA_PREDICATE_V1_TYPE = 'https://slsa.dev/provenance/v1' + +const GITHUB_BUILDER_ID_PREFIX = 'https://github.com/actions/runner' +const GITHUB_BUILD_TYPE = 'https://slsa-framework.github.io/github-actions-buildtypes/workflow/v1' + +const GITLAB_BUILD_TYPE_PREFIX = 'https://github.com/npm/cli/gitlab' +const GITLAB_BUILD_TYPE_VERSION = 'v0alpha1' + +const generateProvenance = async (subject, opts) => { + let payload + if (ci.GITHUB_ACTIONS) { + /* istanbul ignore next - not covering missing env var case */ + const relativeRef = (env.GITHUB_WORKFLOW_REF || '').replace(env.GITHUB_REPOSITORY + '/', '') + const delimiterIndex = relativeRef.indexOf('@') + const workflowPath = relativeRef.slice(0, delimiterIndex) + const workflowRef = relativeRef.slice(delimiterIndex + 1) + + payload = { + _type: INTOTO_STATEMENT_V1_TYPE, + subject, + predicateType: SLSA_PREDICATE_V1_TYPE, + predicate: { + buildDefinition: { + buildType: GITHUB_BUILD_TYPE, + externalParameters: { + workflow: { + ref: workflowRef, + repository: `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}`, + path: workflowPath, + }, + }, + internalParameters: { + github: { + event_name: env.GITHUB_EVENT_NAME, + repository_id: env.GITHUB_REPOSITORY_ID, + repository_owner_id: env.GITHUB_REPOSITORY_OWNER_ID, + }, + }, + resolvedDependencies: [ + { + uri: `git+${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}@${env.GITHUB_REF}`, + digest: { + gitCommit: env.GITHUB_SHA, + }, + }, + ], + }, + runDetails: { + builder: { id: `${GITHUB_BUILDER_ID_PREFIX}/${env.RUNNER_ENVIRONMENT}` }, + metadata: { + /* eslint-disable-next-line max-len */ + invocationId: `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}/attempts/${env.GITHUB_RUN_ATTEMPT}`, + }, + }, + }, + } + } + if (ci.GITLAB) { + payload = { + _type: INTOTO_STATEMENT_V01_TYPE, + subject, + predicateType: SLSA_PREDICATE_V02_TYPE, + predicate: { + buildType: `${GITLAB_BUILD_TYPE_PREFIX}/${GITLAB_BUILD_TYPE_VERSION}`, + builder: { id: `${env.CI_PROJECT_URL}/-/runners/${env.CI_RUNNER_ID}` }, + invocation: { + configSource: { + uri: `git+${env.CI_PROJECT_URL}`, + digest: { + sha1: env.CI_COMMIT_SHA, + }, + entryPoint: env.CI_JOB_NAME, + }, + parameters: { + CI: env.CI, + CI_API_GRAPHQL_URL: env.CI_API_GRAPHQL_URL, + CI_API_V4_URL: env.CI_API_V4_URL, + CI_BUILD_BEFORE_SHA: env.CI_BUILD_BEFORE_SHA, + CI_BUILD_ID: env.CI_BUILD_ID, + CI_BUILD_NAME: env.CI_BUILD_NAME, + CI_BUILD_REF: env.CI_BUILD_REF, + CI_BUILD_REF_NAME: env.CI_BUILD_REF_NAME, + CI_BUILD_REF_SLUG: env.CI_BUILD_REF_SLUG, + CI_BUILD_STAGE: env.CI_BUILD_STAGE, + CI_COMMIT_BEFORE_SHA: env.CI_COMMIT_BEFORE_SHA, + CI_COMMIT_BRANCH: env.CI_COMMIT_BRANCH, + CI_COMMIT_REF_NAME: env.CI_COMMIT_REF_NAME, + CI_COMMIT_REF_PROTECTED: env.CI_COMMIT_REF_PROTECTED, + CI_COMMIT_REF_SLUG: env.CI_COMMIT_REF_SLUG, + CI_COMMIT_SHA: env.CI_COMMIT_SHA, + CI_COMMIT_SHORT_SHA: env.CI_COMMIT_SHORT_SHA, + CI_COMMIT_TIMESTAMP: env.CI_COMMIT_TIMESTAMP, + CI_COMMIT_TITLE: env.CI_COMMIT_TITLE, + CI_CONFIG_PATH: env.CI_CONFIG_PATH, + CI_DEFAULT_BRANCH: env.CI_DEFAULT_BRANCH, + CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX: + env.CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX, + CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX: env.CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX, + CI_DEPENDENCY_PROXY_SERVER: env.CI_DEPENDENCY_PROXY_SERVER, + CI_DEPENDENCY_PROXY_USER: env.CI_DEPENDENCY_PROXY_USER, + CI_JOB_ID: env.CI_JOB_ID, + CI_JOB_NAME: env.CI_JOB_NAME, + CI_JOB_NAME_SLUG: env.CI_JOB_NAME_SLUG, + CI_JOB_STAGE: env.CI_JOB_STAGE, + CI_JOB_STARTED_AT: env.CI_JOB_STARTED_AT, + CI_JOB_URL: env.CI_JOB_URL, + CI_NODE_TOTAL: env.CI_NODE_TOTAL, + CI_PAGES_DOMAIN: env.CI_PAGES_DOMAIN, + CI_PAGES_URL: env.CI_PAGES_URL, + CI_PIPELINE_CREATED_AT: env.CI_PIPELINE_CREATED_AT, + CI_PIPELINE_ID: env.CI_PIPELINE_ID, + CI_PIPELINE_IID: env.CI_PIPELINE_IID, + CI_PIPELINE_SOURCE: env.CI_PIPELINE_SOURCE, + CI_PIPELINE_URL: env.CI_PIPELINE_URL, + CI_PROJECT_CLASSIFICATION_LABEL: env.CI_PROJECT_CLASSIFICATION_LABEL, + CI_PROJECT_DESCRIPTION: env.CI_PROJECT_DESCRIPTION, + CI_PROJECT_ID: env.CI_PROJECT_ID, + CI_PROJECT_NAME: env.CI_PROJECT_NAME, + CI_PROJECT_NAMESPACE: env.CI_PROJECT_NAMESPACE, + CI_PROJECT_NAMESPACE_ID: env.CI_PROJECT_NAMESPACE_ID, + CI_PROJECT_PATH: env.CI_PROJECT_PATH, + CI_PROJECT_PATH_SLUG: env.CI_PROJECT_PATH_SLUG, + CI_PROJECT_REPOSITORY_LANGUAGES: env.CI_PROJECT_REPOSITORY_LANGUAGES, + CI_PROJECT_ROOT_NAMESPACE: env.CI_PROJECT_ROOT_NAMESPACE, + CI_PROJECT_TITLE: env.CI_PROJECT_TITLE, + CI_PROJECT_URL: env.CI_PROJECT_URL, + CI_PROJECT_VISIBILITY: env.CI_PROJECT_VISIBILITY, + CI_REGISTRY: env.CI_REGISTRY, + CI_REGISTRY_IMAGE: env.CI_REGISTRY_IMAGE, + CI_REGISTRY_USER: env.CI_REGISTRY_USER, + CI_RUNNER_DESCRIPTION: env.CI_RUNNER_DESCRIPTION, + CI_RUNNER_ID: env.CI_RUNNER_ID, + CI_RUNNER_TAGS: env.CI_RUNNER_TAGS, + CI_SERVER_HOST: env.CI_SERVER_HOST, + CI_SERVER_NAME: env.CI_SERVER_NAME, + CI_SERVER_PORT: env.CI_SERVER_PORT, + CI_SERVER_PROTOCOL: env.CI_SERVER_PROTOCOL, + CI_SERVER_REVISION: env.CI_SERVER_REVISION, + CI_SERVER_SHELL_SSH_HOST: env.CI_SERVER_SHELL_SSH_HOST, + CI_SERVER_SHELL_SSH_PORT: env.CI_SERVER_SHELL_SSH_PORT, + CI_SERVER_URL: env.CI_SERVER_URL, + CI_SERVER_VERSION: env.CI_SERVER_VERSION, + CI_SERVER_VERSION_MAJOR: env.CI_SERVER_VERSION_MAJOR, + CI_SERVER_VERSION_MINOR: env.CI_SERVER_VERSION_MINOR, + CI_SERVER_VERSION_PATCH: env.CI_SERVER_VERSION_PATCH, + CI_TEMPLATE_REGISTRY_HOST: env.CI_TEMPLATE_REGISTRY_HOST, + GITLAB_CI: env.GITLAB_CI, + GITLAB_FEATURES: env.GITLAB_FEATURES, + GITLAB_USER_ID: env.GITLAB_USER_ID, + GITLAB_USER_LOGIN: env.GITLAB_USER_LOGIN, + RUNNER_GENERATE_ARTIFACTS_METADATA: env.RUNNER_GENERATE_ARTIFACTS_METADATA, + }, + environment: { + name: env.CI_RUNNER_DESCRIPTION, + architecture: env.CI_RUNNER_EXECUTABLE_ARCH, + server: env.CI_SERVER_URL, + project: env.CI_PROJECT_PATH, + job: { + id: env.CI_JOB_ID, + }, + pipeline: { + id: env.CI_PIPELINE_ID, + ref: env.CI_CONFIG_PATH, + }, + }, + }, + metadata: { + buildInvocationId: `${env.CI_JOB_URL}`, + completeness: { + parameters: true, + environment: true, + materials: false, + }, + reproducible: false, + }, + materials: [ + { + uri: `git+${env.CI_PROJECT_URL}`, + digest: { + sha1: env.CI_COMMIT_SHA, + }, + }, + ], + }, + } + } + return sigstore.attest(Buffer.from(JSON.stringify(payload)), INTOTO_PAYLOAD_TYPE, opts) +} + +const verifyProvenance = async (subject, provenancePath) => { + let provenanceBundle + try { + provenanceBundle = JSON.parse(await readFile(provenancePath)) + } catch (err) { + err.message = `Invalid provenance provided: ${err.message}` + throw err + } + + const payload = extractProvenance(provenanceBundle) + if (!payload.subject || !payload.subject.length) { + throw new Error('No subject found in sigstore bundle payload') + } + if (payload.subject.length > 1) { + throw new Error('Found more than one subject in the sigstore bundle payload') + } + + const bundleSubject = payload.subject[0] + if (subject.name !== bundleSubject.name) { + throw new Error( + `Provenance subject ${bundleSubject.name} does not match the package: ${subject.name}` + ) + } + if (subject.digest.sha512 !== bundleSubject.digest.sha512) { + throw new Error('Provenance subject digest does not match the package') + } + + await sigstore.verify(provenanceBundle) + return provenanceBundle +} + +const extractProvenance = (bundle) => { + if (!bundle?.dsseEnvelope?.payload) { + throw new Error('No dsseEnvelope with payload found in sigstore bundle') + } + try { + return JSON.parse(Buffer.from(bundle.dsseEnvelope.payload, 'base64').toString('utf8')) + } catch (err) { + err.message = `Failed to parse payload from dsseEnvelope: ${err.message}` + throw err + } +} + +module.exports = { + generateProvenance, + verifyProvenance, +} diff --git a/node_modules/npm/node_modules/libnpmpublish/lib/publish.js b/node_modules/npm/node_modules/libnpmpublish/lib/publish.js new file mode 100644 index 00000000..93d546ef --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpublish/lib/publish.js @@ -0,0 +1,225 @@ +const { fixer } = require('normalize-package-data') +const npmFetch = require('npm-registry-fetch') +const npa = require('npm-package-arg') +const { log } = require('proc-log') +const semver = require('semver') +const { URL } = require('node:url') +const ssri = require('ssri') +const ciInfo = require('ci-info') + +const { generateProvenance, verifyProvenance } = require('./provenance') + +const TLOG_BASE_URL = 'https://search.sigstore.dev/' + +const publish = async (manifest, tarballData, opts) => { + if (manifest.private) { + throw Object.assign( + new Error(`This package has been marked as private +Remove the 'private' field from the package.json to publish it.`), + { code: 'EPRIVATE' } + ) + } + + // spec is used to pick the appropriate registry/auth combo + const spec = npa.resolve(manifest.name, manifest.version) + opts = { + access: 'public', + algorithms: ['sha512'], + defaultTag: 'latest', + ...opts, + spec, + } + + const reg = npmFetch.pickRegistry(spec, opts) + const pubManifest = patchManifest(manifest, opts) + + // registry-frontdoor cares about the access level, + // which is only configurable for scoped packages + if (!spec.scope && opts.access === 'restricted') { + throw Object.assign( + new Error("Can't restrict access to unscoped packages."), + { code: 'EUNSCOPED' } + ) + } + + const { metadata, transparencyLogUrl } = await buildMetadata( + reg, + pubManifest, + tarballData, + spec, + opts + ) + + const res = await npmFetch(spec.escapedName, { + ...opts, + method: 'PUT', + body: metadata, + ignoreBody: true, + }) + if (transparencyLogUrl) { + res.transparencyLogUrl = transparencyLogUrl + } + return res +} + +const patchManifest = (_manifest, opts) => { + const { npmVersion } = opts + // we only update top-level fields, so a shallow clone is fine + const manifest = { ..._manifest } + + manifest._nodeVersion = process.versions.node + if (npmVersion) { + manifest._npmVersion = npmVersion + } + + fixer.fixNameField(manifest, { strict: true, allowLegacyCase: true }) + const version = semver.clean(manifest.version) + if (!version) { + throw Object.assign( + new Error('invalid semver: ' + manifest.version), + { code: 'EBADSEMVER' } + ) + } + manifest.version = version + return manifest +} + +const buildMetadata = async (registry, manifest, tarballData, spec, opts) => { + const { access, defaultTag, algorithms, provenance, provenanceFile } = opts + const root = { + _id: manifest.name, + name: manifest.name, + description: manifest.description, + 'dist-tags': {}, + versions: {}, + access, + } + + root.versions[manifest.version] = manifest + const tag = manifest.tag || defaultTag + root['dist-tags'][tag] = manifest.version + + const tarballName = `${manifest.name}-${manifest.version}.tgz` + const provenanceBundleName = `${manifest.name}-${manifest.version}.sigstore` + const tarballURI = `${manifest.name}/-/${tarballName}` + const integrity = ssri.fromData(tarballData, { + algorithms: [...new Set(['sha1'].concat(algorithms))], + }) + + manifest._id = `${manifest.name}@${manifest.version}` + manifest.dist = { ...manifest.dist } + // Don't bother having sha1 in the actual integrity field + manifest.dist.integrity = integrity.sha512[0].toString() + // Legacy shasum support + manifest.dist.shasum = integrity.sha1[0].hexDigest() + + // NB: the CLI always fetches via HTTPS if the registry is HTTPS, + // regardless of what's here. This makes it so that installing + // from an HTTP-only mirror doesn't cause problems, though. + manifest.dist.tarball = new URL(tarballURI, registry).href + .replace(/^https:\/\//, 'http://') + + root._attachments = {} + root._attachments[tarballName] = { + content_type: 'application/octet-stream', + data: tarballData.toString('base64'), + length: tarballData.length, + } + + // Handle case where --provenance flag was set to true + let transparencyLogUrl + if (provenance === true || provenanceFile) { + let provenanceBundle + const subject = { + name: npa.toPurl(spec), + digest: { sha512: integrity.sha512[0].hexDigest() }, + } + + if (provenance === true) { + await ensureProvenanceGeneration(registry, spec, opts) + provenanceBundle = await generateProvenance([subject], opts) + + /* eslint-disable-next-line max-len */ + log.notice('publish', `Signed provenance statement with source and build information from ${ciInfo.name}`) + + const tlogEntry = provenanceBundle?.verificationMaterial?.tlogEntries[0] + /* istanbul ignore else */ + if (tlogEntry) { + transparencyLogUrl = `${TLOG_BASE_URL}?logIndex=${tlogEntry.logIndex}` + log.notice( + 'publish', + `Provenance statement published to transparency log: ${transparencyLogUrl}` + ) + } + } else { + provenanceBundle = await verifyProvenance(subject, provenanceFile) + } + + const serializedBundle = JSON.stringify(provenanceBundle) + root._attachments[provenanceBundleName] = { + content_type: provenanceBundle.mediaType, + data: serializedBundle, + length: serializedBundle.length, + } + } + + return { + metadata: root, + transparencyLogUrl, + } +} + +// Check that all the prereqs are met for provenance generation +const ensureProvenanceGeneration = async (registry, spec, opts) => { + if (ciInfo.GITHUB_ACTIONS) { + // Ensure that the GHA OIDC token is available + if (!process.env.ACTIONS_ID_TOKEN_REQUEST_URL) { + throw Object.assign( + /* eslint-disable-next-line max-len */ + new Error('Provenance generation in GitHub Actions requires "write" access to the "id-token" permission'), + { code: 'EUSAGE' } + ) + } + } else if (ciInfo.GITLAB) { + // Ensure that the Sigstore OIDC token is available + if (!process.env.SIGSTORE_ID_TOKEN) { + throw Object.assign( + /* eslint-disable-next-line max-len */ + new Error('Provenance generation in GitLab CI requires "SIGSTORE_ID_TOKEN" with "sigstore" audience to be present in "id_tokens". For more info see:\nhttps://docs.gitlab.com/ee/ci/secrets/id_token_authentication.html'), + { code: 'EUSAGE' } + ) + } + } else { + throw Object.assign( + new Error('Automatic provenance generation not supported for provider: ' + ciInfo.name), + { code: 'EUSAGE' } + ) + } + + // Some registries (e.g. GH packages) require auth to check visibility, + // and always return 404 when no auth is supplied. In this case we assume + // the package is always private and require `--access public` to publish + // with provenance. + let visibility = { public: false } + if (opts.access !== 'public') { + try { + const res = await npmFetch + .json(`${registry}/-/package/${spec.escapedName}/visibility`, opts) + visibility = res + } catch (err) { + if (err.code !== 'E404') { + throw err + } + } + } + + if (!visibility.public && opts.provenance === true && opts.access !== 'public') { + throw Object.assign( + /* eslint-disable-next-line max-len */ + new Error("Can't generate provenance for new or private package, you must set `access` to public."), + { code: 'EUSAGE' } + ) + } +} + +module.exports = publish diff --git a/node_modules/npm/node_modules/libnpmpublish/lib/unpublish.js b/node_modules/npm/node_modules/libnpmpublish/lib/unpublish.js new file mode 100644 index 00000000..983a5d2c --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpublish/lib/unpublish.js @@ -0,0 +1,119 @@ +'use strict' + +const { URL } = require('node:url') +const npa = require('npm-package-arg') +const npmFetch = require('npm-registry-fetch') +const semver = require('semver') + +// given a tarball url and a registry url, returns just the +// relevant pathname portion of it, so that it can be handled +// elegantly by npm-registry-fetch which only expects pathnames +// and handles the registry hostname via opts +const getPathname = (tarball, registry) => { + const registryUrl = new URL(registry).pathname.slice(1) + let tarballUrl = new URL(tarball).pathname.slice(1) + + // test the tarball url to see if it starts with a possible + // pathname from the registry url, in that case strips that portion + // of it so that we only return the post-registry-url pathname + if (registryUrl) { + tarballUrl = tarballUrl.slice(registryUrl.length) + } + return tarballUrl +} + +const unpublish = async (spec, opts) => { + spec = npa(spec) + // spec is used to pick the appropriate registry/auth combo. + opts = { + force: false, + ...opts, + spec, + } + + try { + const pkgUri = spec.escapedName + const pkg = await npmFetch.json(pkgUri, { + ...opts, + query: { write: true }, + }) + + const version = spec.rawSpec + const allVersions = pkg.versions || {} + const versionData = allVersions[version] + + const rawSpecs = (!spec.rawSpec || spec.rawSpec === '*') + const onlyVersion = Object.keys(allVersions).length === 1 + const noVersions = !Object.keys(allVersions).length + + // if missing specific version, + // assumed unpublished + if (!versionData && !rawSpecs && !noVersions) { + return true + } + + // unpublish all versions of a package: + // - no specs supplied "npm unpublish foo" + // - all specs ("*") "npm unpublish foo@*" + // - there was only one version + // - has no versions field on packument + if (rawSpecs || onlyVersion || noVersions) { + await npmFetch(`${pkgUri}/-rev/${pkg._rev}`, { + ...opts, + method: 'DELETE', + ignoreBody: true, + }) + return true + } else { + const dist = allVersions[version].dist + delete allVersions[version] + + const latestVer = pkg['dist-tags'].latest + + // deleting dist tags associated to version + Object.keys(pkg['dist-tags']).forEach(tag => { + if (pkg['dist-tags'][tag] === version) { + delete pkg['dist-tags'][tag] + } + }) + + if (latestVer === version) { + pkg['dist-tags'].latest = Object.keys( + allVersions + ).sort(semver.compareLoose).pop() + } + + delete pkg._revisions + delete pkg._attachments + + // Update packument with removed versions + await npmFetch(`${pkgUri}/-rev/${pkg._rev}`, { + ...opts, + method: 'PUT', + body: pkg, + ignoreBody: true, + }) + + // Remove the tarball itself + const { _rev } = await npmFetch.json(pkgUri, { + ...opts, + query: { write: true }, + }) + const tarballUrl = getPathname(dist.tarball, opts.registry) + await npmFetch(`${tarballUrl}/-rev/${_rev}`, { + ...opts, + method: 'DELETE', + ignoreBody: true, + }) + return true + } + } catch (err) { + if (err.code !== 'E404') { + throw err + } + + return true + } +} + +module.exports = unpublish diff --git a/node_modules/npm/node_modules/libnpmpublish/package.json b/node_modules/npm/node_modules/libnpmpublish/package.json new file mode 100644 index 00000000..87526bdd --- /dev/null +++ b/node_modules/npm/node_modules/libnpmpublish/package.json @@ -0,0 +1,64 @@ +{ + "name": "libnpmpublish", + "version": "11.0.0", + "description": "Programmatic API for the bits behind npm publish and unpublish", + "author": "GitHub Inc.", + "main": "lib/index.js", + "contributors": [ + "Kat Marchán ", + "Claudia Hernández " + ], + "files": [ + "bin/", + "lib/" + ], + "license": "ISC", + "scripts": { + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "test": "tap", + "posttest": "npm run lint", + "postlint": "template-oss-check", + "snap": "tap", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/mock-globals": "^1.0.0", + "@npmcli/mock-registry": "^1.0.0", + "@npmcli/template-oss": "4.23.6", + "tap": "^16.3.8" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmpublish" + }, + "bugs": "https://github.com/npm/cli/issues", + "homepage": "https://npmjs.com/package/libnpmpublish", + "dependencies": { + "ci-info": "^4.0.0", + "normalize-package-data": "^7.0.0", + "npm-package-arg": "^12.0.0", + "npm-registry-fetch": "^18.0.1", + "proc-log": "^5.0.0", + "semver": "^7.3.7", + "sigstore": "^3.0.0", + "ssri": "^12.0.0" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/libnpmsearch/LICENSE b/node_modules/npm/node_modules/libnpmsearch/LICENSE new file mode 100644 index 00000000..209e4477 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmsearch/LICENSE @@ -0,0 +1,13 @@ +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/npm/node_modules/libnpmsearch/README.md b/node_modules/npm/node_modules/libnpmsearch/README.md new file mode 100644 index 00000000..86d75b16 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmsearch/README.md @@ -0,0 +1,173 @@ +# libnpmsearch + +[![npm version](https://img.shields.io/npm/v/libnpmsearch.svg)](https://npm.im/libnpmsearch) +[![license](https://img.shields.io/npm/l/libnpmsearch.svg)](https://npm.im/libnpmsearch) +[![CI - libnpmsearch](https://github.com/npm/cli/actions/workflows/ci-libnpmsearch.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmsearch.yml) + +[`libnpmsearch`](https://github.com/npm/libnpmsearch) is a Node.js library for +programmatically accessing the npm search endpoint. It does **not** support +legacy search through `/-/all`. + +## Table of Contents + +* [Example](#example) +* [Install](#install) +* [Contributing](#contributing) +* [API](#api) + * [search opts](#opts) + * [`search()`](#search) + * [`search.stream()`](#search-stream) + +## Example + +```js +const search = require('libnpmsearch') + +console.log(await search('libnpm')) +=> +[ + { + name: 'libnpm', + description: 'programmatic npm API', + ...etc + }, + { + name: 'libnpmsearch', + description: 'Programmatic API for searching in npm and compatible registries', + ...etc + }, + ...more +] +``` + +## Install + +`$ npm install libnpmsearch` + +### API + +#### `opts` for `libnpmsearch` commands + +The following opts are used directly by `libnpmsearch` itself: + +* `opts.limit` - Number of results to limit the query to. Default: 20 +* `opts.from` - Offset number for results. Used with `opts.limit` for pagination. Default: 0 +* `opts.detailed` - If true, returns an object with `package`, `score`, and `searchScore` fields, with `package` being what would usually be returned, and the other two containing details about how that package scored. Useful for UIs. Default: false +* `opts.sortBy` - Used as a shorthand to set `opts.quality`, `opts.maintenance`, and `opts.popularity` with values that prioritize each one. Should be one of `'optimal'`, `'quality'`, `'maintenance'`, or `'popularity'`. Default: `'optimal'` +* `opts.maintenance` - Decimal number between `0` and `1` that defines the weight of `maintenance` metrics when scoring and sorting packages. Default: `0.65` (same as `opts.sortBy: 'optimal'`) +* `opts.popularity` - Decimal number between `0` and `1` that defines the weight of `popularity` metrics when scoring and sorting packages. Default: `0.98` (same as `opts.sortBy: 'optimal'`) +* `opts.quality` - Decimal number between `0` and `1` that defines the weight of `quality` metrics when scoring and sorting packages. Default: `0.5` (same as `opts.sortBy: 'optimal'`) + +`libnpmsearch` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch). +Most options are passed through directly to that library, so please refer to +[its own `opts` +documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options) +for options that can be passed in. + +A couple of options of note for those in a hurry: + +* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs. + +#### `> search(query, [opts]) -> Promise` + +`query` must be either a String or an Array of search terms. + +If `opts.limit` is provided, it will be sent to the API to constrain the number +of returned results. You may receive more, or fewer results, at the endpoint's +discretion. + +The returned Promise resolved to an Array of search results with the following +format: + +```js +{ + name: String, + version: SemverString, + description: String || null, + maintainers: [ + { + username: String, + email: String + }, + ...etc + ] || null, + keywords: [String] || null, + date: Date || null +} +``` + +If `opts.limit` is provided, it will be sent to the API to constrain the number +of returned results. You may receive more, or fewer results, at the endpoint's +discretion. + +For streamed results, see [`search.stream`](#search-stream). + +##### Example + +```javascript +await search('libnpm') +=> +[ + { + name: 'libnpm', + description: 'programmatic npm API', + ...etc + }, + { + name: 'libnpmsearch', + description: 'Programmatic API for searching in npm and compatible registries', + ...etc + }, + ...more +] +``` + +#### `> search.stream(query, [opts]) -> Stream` + +`query` must be either a String or an Array of search terms. + +If `opts.limit` is provided, it will be sent to the API to constrain the number +of returned results. You may receive more, or fewer results, at the endpoint's +discretion. + +The returned Stream emits one entry per search result, with each entry having +the following format: + +```js +{ + name: String, + version: SemverString, + description: String || null, + maintainers: [ + { + username: String, + email: String + }, + ...etc + ] || null, + keywords: [String] || null, + date: Date || null +} +``` + +For getting results in one chunk, see [`search`](#search-stream). + +##### Example + +```javascript +search.stream('libnpm').on('data', console.log) +=> +// entry 1 +{ + name: 'libnpm', + description: 'programmatic npm API', + ...etc +} +// entry 2 +{ + name: 'libnpmsearch', + description: 'Programmatic API for searching in npm and compatible registries', + ...etc +} +// etc +``` diff --git a/node_modules/npm/node_modules/libnpmsearch/lib/index.js b/node_modules/npm/node_modules/libnpmsearch/lib/index.js new file mode 100644 index 00000000..95905917 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmsearch/lib/index.js @@ -0,0 +1,71 @@ +'use strict' + +const npmFetch = require('npm-registry-fetch') + +module.exports = search +function search (query, opts) { + return search.stream(query, opts).collect() +} +search.stream = searchStream +function searchStream (query, opts = {}) { + opts = { + detailed: false, + limit: 20, + from: 0, + quality: 0.65, + popularity: 0.98, + maintenance: 0.5, + ...opts.opts, // this is to support the cli's --searchopts parameter + ...opts, + } + + switch (opts.sortBy) { + case 'optimal': { + opts.quality = 0.65 + opts.popularity = 0.98 + opts.maintenance = 0.5 + break + } + case 'quality': { + opts.quality = 1 + opts.popularity = 0 + opts.maintenance = 0 + break + } + case 'popularity': { + opts.quality = 0 + opts.popularity = 1 + opts.maintenance = 0 + break + } + case 'maintenance': { + opts.quality = 0 + opts.popularity = 0 + opts.maintenance = 1 + break + } + } + return npmFetch.json.stream('/-/v1/search', 'objects.*', + { + ...opts, + query: { + text: Array.isArray(query) ? query.join(' ') : query, + size: opts.limit, + from: opts.from, + quality: opts.quality, + popularity: opts.popularity, + maintenance: opts.maintenance, + }, + mapJSON: (obj) => { + if (obj.package.date) { + obj.package.date = new Date(obj.package.date) + } + if (opts.detailed) { + return obj + } else { + return obj.package + } + }, + } + ) +} diff --git a/node_modules/npm/node_modules/libnpmsearch/package.json b/node_modules/npm/node_modules/libnpmsearch/package.json new file mode 100644 index 00000000..ca021f24 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmsearch/package.json @@ -0,0 +1,58 @@ +{ + "name": "libnpmsearch", + "version": "9.0.0", + "description": "Programmatic API for searching in npm and compatible registries.", + "author": "GitHub Inc.", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "keywords": [ + "npm", + "search", + "api", + "libnpm" + ], + "license": "ISC", + "scripts": { + "posttest": "npm run lint", + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/template-oss": "4.23.6", + "nock": "^13.3.3", + "tap": "^16.3.8" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmsearch" + }, + "bugs": "https://github.com/npm/libnpmsearch/issues", + "homepage": "https://npmjs.com/package/libnpmsearch", + "dependencies": { + "npm-registry-fetch": "^18.0.1" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/libnpmteam/LICENSE b/node_modules/npm/node_modules/libnpmteam/LICENSE new file mode 100644 index 00000000..209e4477 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmteam/LICENSE @@ -0,0 +1,13 @@ +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/npm/node_modules/libnpmteam/README.md b/node_modules/npm/node_modules/libnpmteam/README.md new file mode 100644 index 00000000..97323f82 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmteam/README.md @@ -0,0 +1,188 @@ +# libnpmteam + +[![npm version](https://img.shields.io/npm/v/libnpmteam.svg)](https://npm.im/libnpmteam) +[![license](https://img.shields.io/npm/l/libnpmteam.svg)](https://npm.im/libnpmteam) +[![CI - libnpmteam](https://github.com/npm/cli/actions/workflows/ci-libnpmteam.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmteam.yml) + +[`libnpmteam`](https://github.com/npm/libnpmteam) is a Node.js +library that provides programmatic access to the guts of the npm CLI's `npm +team` command and its various subcommands. + +## Example + +```javascript +const team = require('libnpmteam') + +// List all teams for the @npm org. +console.log(await team.lsTeams('npm')) +``` + +## Publishing +1. Manually create CHANGELOG.md file +1. Commit changes to CHANGELOG.md + ```bash + $ git commit -m "chore: updated CHANGELOG.md" + ``` +1. Run `npm version {newVersion}` + ```bash + # Example + $ npm version patch + # 1. Runs `coverage` and `lint` scripts + # 2. Bumps package version; and **create commit/tag** + # 3. Runs `npm publish`; publishing directory with **unpushed commit** + # 4. Runs `git push origin --follow-tags` + ``` + +## Table of Contents + +* [Installing](#install) +* [Example](#example) +* [API](#api) + * [team opts](#opts) + * [`create()`](#create) + * [`destroy()`](#destroy) + * [`add()`](#add) + * [`rm()`](#rm) + * [`lsTeams()`](#ls-teams) + * [`lsTeams.stream()`](#ls-teams-stream) + * [`lsUsers()`](#ls-users) + * [`lsUsers.stream()`](#ls-users-stream) + +### Install + +`$ npm install libnpmteam` + +### API + +#### `opts` for `libnpmteam` commands + +`libnpmteam` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch). +All options are passed through directly to that library, so please refer to [its +own `opts` +documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options) +for options that can be passed in. + +A couple of options of note for those in a hurry: + +* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs. +* `opts.otp` - certain operations will require an OTP token to be passed in. If a `libnpmteam` command fails with `err.code === EOTP`, please retry the request with `{otp: <2fa token>}` + +#### `> team.create(team, [opts]) -> Promise` + +Creates a team named `team`. Team names use the format `@:`, with +the `@` being optional. + +Additionally, `opts.description` may be passed in to include a description. + +##### Example + +```javascript +await team.create('@npm:cli', {token: 'myregistrytoken'}) +// The @npm:cli team now exists. +``` + +#### `> team.destroy(team, [opts]) -> Promise` + +Destroys a team named `team`. Team names use the format `@:`, with +the `@` being optional. + +##### Example + +```javascript +await team.destroy('@npm:cli', {token: 'myregistrytoken'}) +// The @npm:cli team has been destroyed. +``` + +#### `> team.add(user, team, [opts]) -> Promise` + +Adds `user` to `team`. + +##### Example + +```javascript +await team.add('zkat', '@npm:cli', {token: 'myregistrytoken'}) +// @zkat now belongs to the @npm:cli team. +``` + +#### `> team.rm(user, team, [opts]) -> Promise` + +Removes `user` from `team`. + +##### Example + +```javascript +await team.rm('zkat', '@npm:cli', {token: 'myregistrytoken'}) +// @zkat is no longer part of the @npm:cli team. +``` + +#### `> team.lsTeams(scope, [opts]) -> Promise` + +Resolves to an array of team names belonging to `scope`. + +##### Example + +```javascript +await team.lsTeams('@npm', {token: 'myregistrytoken'}) +=> +[ + 'npm:cli', + 'npm:web', + 'npm:registry', + 'npm:developers' +] +``` + +#### `> team.lsTeams.stream(scope, [opts]) -> Stream` + +Returns a stream of teams belonging to `scope`. + +For a Promise-based version of these results, see [`team.lsTeams()`](#ls-teams). + +##### Example + +```javascript +for await (let team of team.lsTeams.stream('@npm', {token: 'myregistrytoken'})) { + console.log(team) +} + +// outputs +// npm:cli +// npm:web +// npm:registry +// npm:developers +``` + +#### `> team.lsUsers(team, [opts]) -> Promise` + +Resolves to an array of usernames belonging to `team`. + +For a streamed version of these results, see [`team.lsUsers.stream()`](#ls-users-stream). + +##### Example + +```javascript +await team.lsUsers('@npm:cli', {token: 'myregistrytoken'}) +=> +[ + 'iarna', + 'zkat' +] +``` + +#### `> team.lsUsers.stream(team, [opts]) -> Stream` + +Returns a stream of usernames belonging to `team`. + +For a Promise-based version of these results, see [`team.lsUsers()`](#ls-users). + +##### Example + +```javascript +for await (let user of team.lsUsers.stream('@npm:cli', {token: 'myregistrytoken'})) { + console.log(user) +} + +// outputs +// iarna +// zkat +``` diff --git a/node_modules/npm/node_modules/libnpmteam/lib/index.js b/node_modules/npm/node_modules/libnpmteam/lib/index.js new file mode 100644 index 00000000..9925d2c5 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmteam/lib/index.js @@ -0,0 +1,92 @@ +'use strict' + +const eu = encodeURIComponent +const npmFetch = require('npm-registry-fetch') +const validate = require('aproba') + +const cmd = module.exports + +cmd.create = (entity, opts = {}) => { + return Promise.resolve().then(() => { + const { scope, team } = splitEntity(entity) + validate('SSO', [scope, team, opts]) + const uri = `/-/org/${eu(scope)}/team` + return npmFetch.json(uri, { + ...opts, + method: 'PUT', + scope, + body: { name: team, description: opts.description }, + }) + }) +} + +cmd.destroy = async (entity, opts = {}) => { + const { scope, team } = splitEntity(entity) + validate('SSO', [scope, team, opts]) + const uri = `/-/team/${eu(scope)}/${eu(team)}` + await npmFetch(uri, { + ...opts, + method: 'DELETE', + scope, + ignoreBody: true, + }) + return true +} + +cmd.add = (user, entity, opts = {}) => { + const { scope, team } = splitEntity(entity) + validate('SSO', [scope, team, opts]) + const uri = `/-/team/${eu(scope)}/${eu(team)}/user` + return npmFetch.json(uri, { + ...opts, + method: 'PUT', + scope, + body: { user }, + }) +} + +cmd.rm = async (user, entity, opts = {}) => { + const { scope, team } = splitEntity(entity) + validate('SSO', [scope, team, opts]) + const uri = `/-/team/${eu(scope)}/${eu(team)}/user` + await npmFetch(uri, { + ...opts, + method: 'DELETE', + scope, + body: { user }, + ignoreBody: true, + }) + return true +} + +cmd.lsTeams = (...args) => cmd.lsTeams.stream(...args).collect() + +cmd.lsTeams.stream = (scope, opts = {}) => { + validate('SO', [scope, opts]) + const uri = `/-/org/${eu(scope)}/team` + return npmFetch.json.stream(uri, '.*', { + ...opts, + query: { format: 'cli' }, + }) +} + +cmd.lsUsers = (...args) => cmd.lsUsers.stream(...args).collect() + +cmd.lsUsers.stream = (entity, opts = {}) => { + const { scope, team } = splitEntity(entity) + validate('SSO', [scope, team, opts]) + const uri = `/-/team/${eu(scope)}/${eu(team)}/user` + return npmFetch.json.stream(uri, '.*', { + ...opts, + query: { format: 'cli' }, + }) +} + +cmd.edit = () => { + throw new Error('edit is not implemented yet') +} + +function splitEntity (entity = '') { + const [, scope, team] = entity.match(/^@?([^:]+):(.*)$/) || [] + return { scope, team } +} diff --git a/node_modules/npm/node_modules/libnpmteam/package.json b/node_modules/npm/node_modules/libnpmteam/package.json new file mode 100644 index 00000000..72858f25 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmteam/package.json @@ -0,0 +1,52 @@ +{ + "name": "libnpmteam", + "description": "npm Team management APIs", + "version": "8.0.0", + "author": "GitHub Inc.", + "license": "ISC", + "main": "lib/index.js", + "scripts": { + "lint": "npm run eslint", + "test": "tap", + "posttest": "npm run lint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/template-oss": "4.23.6", + "nock": "^13.3.3", + "tap": "^16.3.8" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmteam" + }, + "files": [ + "bin/", + "lib/" + ], + "homepage": "https://npmjs.com/package/libnpmteam", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^18.0.1" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/libnpmversion/LICENSE b/node_modules/npm/node_modules/libnpmversion/LICENSE new file mode 100644 index 00000000..05eeeb88 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/libnpmversion/README.md b/node_modules/npm/node_modules/libnpmversion/README.md new file mode 100644 index 00000000..857c4d52 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/README.md @@ -0,0 +1,163 @@ +# libnpmversion + +[![npm version](https://img.shields.io/npm/v/libnpmversion.svg)](https://npm.im/libnpmversion) +[![license](https://img.shields.io/npm/l/libnpmversion.svg)](https://npm.im/libnpmversion) +[![CI - libnpmversion](https://github.com/npm/cli/actions/workflows/ci-libnpmversion.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmversion.yml) + +Library to do the things that 'npm version' does. + +## USAGE + +```js +const npmVersion = require('libnpmversion') + +// argument can be one of: +// - any semver version string (set to that exact version) +// - 'major', 'minor', 'patch', 'pre{major,minor,patch}' (increment at +// that value) +// - 'from-git' (set to the latest semver-lookin git tag - this skips +// gitTagVersion, but will still sign if asked) +npmVersion(arg, { + path: '/path/to/my/pkg', // defaults to cwd + + allowSameVersion: false, // allow tagging/etc to the current version + preid: '', // when arg=='pre', define the prerelease string, like 'beta' etc. + tagVersionPrefix: 'v', // tag as 'v1.2.3' when versioning to 1.2.3 + commitHooks: true, // default true, run git commit hooks, default true + gitTagVersion: true, // default true, tag the version + signGitCommit: false, // default false, gpg sign the git commit + signGitTag: false, // default false, gpg sign the git tag + force: false, // push forward recklessly if any problems happen + ignoreScripts: false, // do not run pre/post/version lifecycle scripts + scriptShell: '/bin/bash', // shell to run lifecycle scripts in + message: 'v%s', // message for tag and commit, replace %s with the version +}).then(newVersion => { + console.error('version updated!', newVersion) +}) +``` + +## Description + +Run this in a package directory to bump the version and write the new data +back to `package.json`, `package-lock.json`, and, if present, +`npm-shrinkwrap.json`. + +The `newversion` argument should be a valid semver string, a valid second +argument to [semver.inc](https://github.com/npm/node-semver#functions) (one +of `patch`, `minor`, `major`, `prepatch`, `preminor`, `premajor`, +`prerelease`), or `from-git`. In the second case, the existing version will +be incremented by 1 in the specified field. `from-git` will try to read +the latest git tag, and use that as the new npm version. + +If run in a git repo, it will also create a version commit and tag. This +behavior is controlled by `gitTagVersion` (see below), and can be +disabled by setting `gitTagVersion: false` in the options. +It will fail if the working directory is not clean, unless `force: true` is +set. + +If supplied with a `message` string option, it will +use it as a commit message when creating a version commit. If the +`message` option contains `%s` then that will be replaced with the +resulting version number. + +If the `signGitTag` option is set, then the tag will be signed using +the `-s` flag to git. Note that you must have a default GPG key set up in +your git config for this to work properly. + +If `preversion`, `version`, or `postversion` are in the `scripts` property +of the package.json, they will be executed in the appropriate sequence. + +The exact order of execution is as follows: + +1. Check to make sure the git working directory is clean before we get + started. Your scripts may add files to the commit in future steps. + This step is skipped if the `force` flag is set. +2. Run the `preversion` script. These scripts have access to the old + `version` in package.json. A typical use would be running your full + test suite before deploying. Any files you want added to the commit + should be explicitly added using `git add`. +3. Bump `version` in `package.json` as requested (`patch`, `minor`, + `major`, explicit version number, etc). +4. Run the `version` script. These scripts have access to the new `version` + in package.json (so they can incorporate it into file headers in + generated files for example). Again, scripts should explicitly add + generated files to the commit using `git add`. +5. Commit and tag. +6. Run the `postversion` script. Use it to clean up the file system or + automatically push the commit and/or tag. + +Take the following example: + +```json +{ + "scripts": { + "preversion": "npm test", + "version": "npm run build && git add -A dist", + "postversion": "git push && git push --tags && rm -rf build/temp" + } +} +``` + +This runs all your tests, and proceeds only if they pass. Then runs your +`build` script, and adds everything in the `dist` directory to the commit. +After the commit, it pushes the new commit and tag up to the server, and +deletes the `build/temp` directory. + +## API + +### `npmVersion(newversion, options = {}) -> Promise` + +Do the things. Returns a promise that resolves to the new version if +all is well, or rejects if any errors are encountered. + +### Options + +#### `path` String + +The path to the package being versionified. Defaults to process.cwd(). + +#### `allowSameVersion` Boolean + +Allow setting the version to the current version in package.json. Default +`false`. + +#### `preid` String +When the `newversion` is pre, premajor, preminor, or prepatch, this +defines the prerelease string, like 'beta' etc. + +#### `tagVersionPrefix` String + +The prefix to add to the raw semver string for the tag name. Defaults to +`'v'`. (So, by default it tags as 'v1.2.3' when versioning to 1.2.3.) + +#### `commitHooks` Boolean + +Run git commit hooks. Default true. + +#### `gitTagVersion` Boolean + +Tag the version, default true. + +#### `signGitCommit` Boolean + +GPG sign the git commit. Default `false`. + +#### `signGitTag` Boolean + +GPG sign the git tag. Default `false`. + +#### `force` Boolean + +Push forward recklessly if any problems happen. Default `false`. + +#### `ignoreScripts` Boolean + +Do not run pre/post/version lifecycle scripts. Default `false`. + +#### `scriptShell` String + +Path to the shell, which should execute the lifecycle scripts. Defaults to `/bin/sh` on unix, or `cmd.exe` on windows. + +#### `message` String + +The message for the git commit and annotated git tag that are created. diff --git a/node_modules/npm/node_modules/libnpmversion/lib/commit.js b/node_modules/npm/node_modules/libnpmversion/lib/commit.js new file mode 100644 index 00000000..dec6edbe --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/lib/commit.js @@ -0,0 +1,17 @@ +const git = require('@npmcli/git') + +module.exports = (version, opts) => { + const { commitHooks, allowSameVersion, signGitCommit, message } = opts + const args = ['commit'] + if (commitHooks === false) { + args.push('-n') + } + if (allowSameVersion) { + args.push('--allow-empty') + } + if (signGitCommit) { + args.push('-S') + } + args.push('-m') + return git.spawn([...args, message.replace(/%s/g, version)], opts) +} diff --git a/node_modules/npm/node_modules/libnpmversion/lib/enforce-clean.js b/node_modules/npm/node_modules/libnpmversion/lib/enforce-clean.js new file mode 100644 index 00000000..25ebb559 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/lib/enforce-clean.js @@ -0,0 +1,32 @@ +const git = require('@npmcli/git') +const { log } = require('proc-log') + +// returns true if it's cool to do git stuff +// throws if it's unclean, and not forced. +module.exports = async opts => { + const { force } = opts + let hadError = false + const clean = await git.isClean(opts).catch(er => { + if (er.code === 'ENOGIT') { + log.warn( + 'version', + 'This is a Git checkout, but the git command was not found.', + 'npm could not create a Git tag for this release!' + ) + hadError = true + // how can merges be real if our git isn't real? + return true + } else { + throw er + } + }) + + if (!clean) { + if (!force) { + throw new Error('Git working directory not clean.') + } + log.warn('version', 'Git working directory not clean, proceeding forcefully.') + } + + return !hadError +} diff --git a/node_modules/npm/node_modules/libnpmversion/lib/index.js b/node_modules/npm/node_modules/libnpmversion/lib/index.js new file mode 100644 index 00000000..4d2fb459 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/lib/index.js @@ -0,0 +1,38 @@ +const readJson = require('./read-json.js') +const version = require('./version.js') + +module.exports = async (newversion, opts = {}) => { + const { + path = process.cwd(), + allowSameVersion = false, + tagVersionPrefix = 'v', + commitHooks = true, + gitTagVersion = true, + signGitCommit = false, + signGitTag = false, + force = false, + ignoreScripts = false, + scriptShell = undefined, + preid = null, + message = 'v%s', + } = opts + + const pkg = opts.pkg || await readJson(path + '/package.json') + + return version(newversion, { + path, + cwd: path, + allowSameVersion, + tagVersionPrefix, + commitHooks, + gitTagVersion, + signGitCommit, + signGitTag, + force, + ignoreScripts, + scriptShell, + preid, + pkg, + message, + }) +} diff --git a/node_modules/npm/node_modules/libnpmversion/lib/read-json.js b/node_modules/npm/node_modules/libnpmversion/lib/read-json.js new file mode 100644 index 00000000..d5d47565 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/lib/read-json.js @@ -0,0 +1,6 @@ +// can't use read-package-json-fast, because we want to ensure +// that we make as few changes as possible, even for safety issues. +const { readFile } = require('node:fs/promises') +const parse = require('json-parse-even-better-errors') + +module.exports = async path => parse(await readFile(path)) diff --git a/node_modules/npm/node_modules/libnpmversion/lib/retrieve-tag.js b/node_modules/npm/node_modules/libnpmversion/lib/retrieve-tag.js new file mode 100644 index 00000000..c5fb64e3 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/lib/retrieve-tag.js @@ -0,0 +1,13 @@ +const { spawn } = require('@npmcli/git') +const semver = require('semver') + +module.exports = async opts => { + const tag = (await spawn( + ['describe', '--tags', '--abbrev=0', '--match=*.*.*'], + opts)).stdout.trim() + const ver = semver.coerce(tag, { loose: true }) + if (ver) { + return ver.version + } + throw new Error(`Tag is not a valid version: ${JSON.stringify(tag)}`) +} diff --git a/node_modules/npm/node_modules/libnpmversion/lib/tag.js b/node_modules/npm/node_modules/libnpmversion/lib/tag.js new file mode 100644 index 00000000..095456b2 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/lib/tag.js @@ -0,0 +1,30 @@ +const git = require('@npmcli/git') + +module.exports = async (version, opts) => { + const { + signGitTag, + allowSameVersion, + tagVersionPrefix, + message, + } = opts + + const tag = `${tagVersionPrefix}${version}` + const flags = ['-'] + + if (signGitTag) { + flags.push('s') + } + + if (allowSameVersion) { + flags.push('f') + } + + flags.push('m') + + return git.spawn([ + 'tag', + flags.join(''), + message.replace(/%s/g, version), + tag, + ], opts) +} diff --git a/node_modules/npm/node_modules/libnpmversion/lib/version.js b/node_modules/npm/node_modules/libnpmversion/lib/version.js new file mode 100644 index 00000000..bfcd8a52 --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/lib/version.js @@ -0,0 +1,136 @@ +// called with all the options already set to their defaults + +const retrieveTag = require('./retrieve-tag.js') +const semver = require('semver') +const enforceClean = require('./enforce-clean.js') +const writeJson = require('./write-json.js') +const readJson = require('./read-json.js') +const git = require('@npmcli/git') +const commit = require('./commit.js') +const tag = require('./tag.js') +const { log } = require('proc-log') + +const runScript = require('@npmcli/run-script') + +module.exports = async (newversion, opts) => { + const { + path, + allowSameVersion, + gitTagVersion, + ignoreScripts, + preid, + pkg, + } = opts + + const { valid, clean, inc } = semver + const current = pkg.version || '0.0.0' + const currentClean = clean(current) + + let newV + if (valid(newversion, { loose: true })) { + newV = clean(newversion, { loose: true }) + } else if (newversion === 'from-git') { + newV = await retrieveTag(opts) + } else { + newV = inc(currentClean, newversion, { loose: true }, preid) + } + + if (!newV) { + throw Object.assign(new Error('Invalid version: ' + newversion), { + current, + requested: newversion, + }) + } + + if (newV === currentClean && !allowSameVersion) { + throw Object.assign(new Error('Version not changed'), { + current, + requested: newversion, + newVersion: newV, + }) + } + + const isGitDir = newversion === 'from-git' || await git.is(opts) + + // ok! now we know the new version, and the old version is in pkg + + // - check if git dir is clean + // returns false if we should not keep doing git stuff + const doGit = gitTagVersion && isGitDir && await enforceClean(opts) + + if (!ignoreScripts) { + await runScript({ + ...opts, + pkg, + stdio: 'inherit', + event: 'preversion', + env: { + npm_old_version: current, + npm_new_version: newV, + }, + }) + } + + // - update the files + pkg.version = newV + delete pkg._id + await writeJson(`${path}/package.json`, pkg) + + // try to update shrinkwrap, but ok if this fails + const locks = [`${path}/package-lock.json`, `${path}/npm-shrinkwrap.json`] + const haveLocks = [] + for (const lock of locks) { + try { + const sw = await readJson(lock) + sw.version = newV + if (sw.packages && sw.packages['']) { + sw.packages[''].version = newV + } + await writeJson(lock, sw) + haveLocks.push(lock) + } catch { + // ignore errors + } + } + + if (!ignoreScripts) { + await runScript({ + ...opts, + pkg, + stdio: 'inherit', + event: 'version', + env: { + npm_old_version: current, + npm_new_version: newV, + }, + }) + } + + if (doGit) { + // - git add, git commit, git tag + await git.spawn(['add', `${path}/package.json`], opts) + // sometimes people .gitignore their lockfiles + for (const lock of haveLocks) { + await git.spawn(['add', lock], opts).catch(() => {}) + } + await commit(newV, opts) + await tag(newV, opts) + } else { + log.verbose('version', 'Not tagging: not in a git repo or no git cmd') + } + + if (!ignoreScripts) { + await runScript({ + ...opts, + pkg, + stdio: 'inherit', + event: 'postversion', + env: { + npm_old_version: current, + npm_new_version: newV, + }, + }) + } + + return newV +} diff --git a/node_modules/npm/node_modules/libnpmversion/lib/write-json.js b/node_modules/npm/node_modules/libnpmversion/lib/write-json.js new file mode 100644 index 00000000..2f19953d --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/lib/write-json.js @@ -0,0 +1,15 @@ +// write the json back, preserving the line breaks and indent +const { writeFile } = require('node:fs/promises') +const kIndent = Symbol.for('indent') +const kNewline = Symbol.for('newline') + +module.exports = async (path, pkg) => { + const { + [kIndent]: indent = 2, + [kNewline]: newline = '\n', + } = pkg + delete pkg._id + const raw = JSON.stringify(pkg, null, indent) + '\n' + const data = newline === '\n' ? raw : raw.split('\n').join(newline) + return writeFile(path, data) +} diff --git a/node_modules/npm/node_modules/libnpmversion/package.json b/node_modules/npm/node_modules/libnpmversion/package.json new file mode 100644 index 00000000..b319156a --- /dev/null +++ b/node_modules/npm/node_modules/libnpmversion/package.json @@ -0,0 +1,55 @@ +{ + "name": "libnpmversion", + "version": "8.0.0", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "description": "library to do the things that 'npm version' does", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git", + "directory": "workspaces/libnpmversion" + }, + "author": "GitHub Inc.", + "license": "ISC", + "scripts": { + "lint": "npm run eslint", + "test": "tap", + "posttest": "npm run lint", + "snap": "tap", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "tap": { + "coverage-map": "map.js", + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/template-oss": "4.23.6", + "require-inject": "^1.4.4", + "tap": "^16.3.8" + }, + "dependencies": { + "@npmcli/git": "^6.0.1", + "@npmcli/run-script": "^9.0.1", + "json-parse-even-better-errors": "^4.0.0", + "proc-log": "^5.0.0", + "semver": "^7.3.7" + }, + "engines": { + "node": "^20.17.0 || >=22.9.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "../../scripts/template-oss/index.js" + } +} diff --git a/node_modules/npm/node_modules/lru-cache/LICENSE b/node_modules/npm/node_modules/lru-cache/LICENSE new file mode 100644 index 00000000..f785757c --- /dev/null +++ b/node_modules/npm/node_modules/lru-cache/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/lru-cache/dist/commonjs/index.js b/node_modules/npm/node_modules/lru-cache/dist/commonjs/index.js new file mode 100644 index 00000000..05892318 --- /dev/null +++ b/node_modules/npm/node_modules/lru-cache/dist/commonjs/index.js @@ -0,0 +1,1546 @@ +"use strict"; +/** + * @module LRUCache + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LRUCache = void 0; +const perf = typeof performance === 'object' && + performance && + typeof performance.now === 'function' + ? performance + : Date; +const warned = new Set(); +/* c8 ignore start */ +const PROCESS = (typeof process === 'object' && !!process ? process : {}); +/* c8 ignore start */ +const emitWarning = (msg, type, code, fn) => { + typeof PROCESS.emitWarning === 'function' + ? PROCESS.emitWarning(msg, type, code, fn) + : console.error(`[${code}] ${type}: ${msg}`); +}; +let AC = globalThis.AbortController; +let AS = globalThis.AbortSignal; +/* c8 ignore start */ +if (typeof AC === 'undefined') { + //@ts-ignore + AS = class AbortSignal { + onabort; + _onabort = []; + reason; + aborted = false; + addEventListener(_, fn) { + this._onabort.push(fn); + } + }; + //@ts-ignore + AC = class AbortController { + constructor() { + warnACPolyfill(); + } + signal = new AS(); + abort(reason) { + if (this.signal.aborted) + return; + //@ts-ignore + this.signal.reason = reason; + //@ts-ignore + this.signal.aborted = true; + //@ts-ignore + for (const fn of this.signal._onabort) { + fn(reason); + } + this.signal.onabort?.(reason); + } + }; + let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== '1'; + const warnACPolyfill = () => { + if (!printACPolyfillWarning) + return; + printACPolyfillWarning = false; + emitWarning('AbortController is not defined. If using lru-cache in ' + + 'node 14, load an AbortController polyfill from the ' + + '`node-abort-controller` package. A minimal polyfill is ' + + 'provided for use by LRUCache.fetch(), but it should not be ' + + 'relied upon in other contexts (eg, passing it to other APIs that ' + + 'use AbortController/AbortSignal might have undesirable effects). ' + + 'You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.', 'NO_ABORT_CONTROLLER', 'ENOTSUP', warnACPolyfill); + }; +} +/* c8 ignore stop */ +const shouldWarn = (code) => !warned.has(code); +const TYPE = Symbol('type'); +const isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n); +/* c8 ignore start */ +// 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; +/* c8 ignore stop */ +class ZeroArray extends Array { + constructor(size) { + super(size); + this.fill(0); + } +} +class Stack { + heap; + length; + // private constructor + static #constructing = false; + static create(max) { + const HeapCls = getUintArray(max); + if (!HeapCls) + return []; + Stack.#constructing = true; + const s = new Stack(max, HeapCls); + Stack.#constructing = false; + return s; + } + constructor(max, HeapCls) { + /* c8 ignore start */ + if (!Stack.#constructing) { + throw new TypeError('instantiate Stack using Stack.create(n)'); + } + /* c8 ignore stop */ + this.heap = new HeapCls(max); + this.length = 0; + } + push(n) { + this.heap[this.length++] = n; + } + pop() { + return this.heap[--this.length]; + } +} +/** + * Default export, the thing you're using this module to get. + * + * The `K` and `V` types define the key and value types, respectively. The + * optional `FC` type defines the type of the `context` object passed to + * `cache.fetch()` and `cache.memo()`. + * + * Keys and values **must not** be `null` or `undefined`. + * + * All properties from the options object (with the exception of `max`, + * `maxSize`, `fetchMethod`, `memoMethod`, `dispose` and `disposeAfter`) are + * added as normal public members. (The listed options are read-only getters.) + * + * Changing any of these will alter the defaults for subsequent method calls. + */ +class LRUCache { + // options that cannot be changed without disaster + #max; + #maxSize; + #dispose; + #disposeAfter; + #fetchMethod; + #memoMethod; + /** + * {@link LRUCache.OptionsBase.ttl} + */ + ttl; + /** + * {@link LRUCache.OptionsBase.ttlResolution} + */ + ttlResolution; + /** + * {@link LRUCache.OptionsBase.ttlAutopurge} + */ + ttlAutopurge; + /** + * {@link LRUCache.OptionsBase.updateAgeOnGet} + */ + updateAgeOnGet; + /** + * {@link LRUCache.OptionsBase.updateAgeOnHas} + */ + updateAgeOnHas; + /** + * {@link LRUCache.OptionsBase.allowStale} + */ + allowStale; + /** + * {@link LRUCache.OptionsBase.noDisposeOnSet} + */ + noDisposeOnSet; + /** + * {@link LRUCache.OptionsBase.noUpdateTTL} + */ + noUpdateTTL; + /** + * {@link LRUCache.OptionsBase.maxEntrySize} + */ + maxEntrySize; + /** + * {@link LRUCache.OptionsBase.sizeCalculation} + */ + sizeCalculation; + /** + * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection} + */ + noDeleteOnFetchRejection; + /** + * {@link LRUCache.OptionsBase.noDeleteOnStaleGet} + */ + noDeleteOnStaleGet; + /** + * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort} + */ + allowStaleOnFetchAbort; + /** + * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection} + */ + allowStaleOnFetchRejection; + /** + * {@link LRUCache.OptionsBase.ignoreFetchAbort} + */ + ignoreFetchAbort; + // computed properties + #size; + #calculatedSize; + #keyMap; + #keyList; + #valList; + #next; + #prev; + #head; + #tail; + #free; + #disposed; + #sizes; + #starts; + #ttls; + #hasDispose; + #hasFetchMethod; + #hasDisposeAfter; + /** + * Do not call this method unless you need to inspect the + * inner workings of the cache. If anything returned by this + * object is modified in any way, strange breakage may occur. + * + * These fields are private for a reason! + * + * @internal + */ + static unsafeExposeInternals(c) { + return { + // properties + starts: c.#starts, + ttls: c.#ttls, + sizes: c.#sizes, + keyMap: c.#keyMap, + keyList: c.#keyList, + valList: c.#valList, + next: c.#next, + prev: c.#prev, + get head() { + return c.#head; + }, + get tail() { + return c.#tail; + }, + free: c.#free, + // methods + isBackgroundFetch: (p) => c.#isBackgroundFetch(p), + backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context), + moveToTail: (index) => c.#moveToTail(index), + indexes: (options) => c.#indexes(options), + rindexes: (options) => c.#rindexes(options), + isStale: (index) => c.#isStale(index), + }; + } + // Protected read-only members + /** + * {@link LRUCache.OptionsBase.max} (read-only) + */ + get max() { + return this.#max; + } + /** + * {@link LRUCache.OptionsBase.maxSize} (read-only) + */ + get maxSize() { + return this.#maxSize; + } + /** + * The total computed size of items in the cache (read-only) + */ + get calculatedSize() { + return this.#calculatedSize; + } + /** + * The number of items stored in the cache (read-only) + */ + get size() { + return this.#size; + } + /** + * {@link LRUCache.OptionsBase.fetchMethod} (read-only) + */ + get fetchMethod() { + return this.#fetchMethod; + } + get memoMethod() { + return this.#memoMethod; + } + /** + * {@link LRUCache.OptionsBase.dispose} (read-only) + */ + get dispose() { + return this.#dispose; + } + /** + * {@link LRUCache.OptionsBase.disposeAfter} (read-only) + */ + get disposeAfter() { + return this.#disposeAfter; + } + constructor(options) { + const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, } = 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; + 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'); + } + } + if (memoMethod !== undefined && + typeof memoMethod !== 'function') { + throw new TypeError('memoMethod must be a function if defined'); + } + this.#memoMethod = memoMethod; + if (fetchMethod !== undefined && + typeof fetchMethod !== 'function') { + throw new TypeError('fetchMethod must be a function if specified'); + } + this.#fetchMethod = fetchMethod; + this.#hasFetchMethod = !!fetchMethod; + this.#keyMap = new Map(); + this.#keyList = new Array(max).fill(undefined); + this.#valList = new Array(max).fill(undefined); + this.#next = new UintArray(max); + this.#prev = new UintArray(max); + this.#head = 0; + this.#tail = 0; + this.#free = Stack.create(max); + this.#size = 0; + this.#calculatedSize = 0; + if (typeof dispose === 'function') { + this.#dispose = dispose; + } + if (typeof disposeAfter === 'function') { + this.#disposeAfter = disposeAfter; + this.#disposed = []; + } + else { + this.#disposeAfter = undefined; + this.#disposed = undefined; + } + this.#hasDispose = !!this.#dispose; + this.#hasDisposeAfter = !!this.#disposeAfter; + 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; + this.noDeleteOnStaleGet = !!noDeleteOnStaleGet; + this.updateAgeOnGet = !!updateAgeOnGet; + this.updateAgeOnHas = !!updateAgeOnHas; + this.ttlResolution = + isPosInt(ttlResolution) || ttlResolution === 0 + ? ttlResolution + : 1; + this.ttlAutopurge = !!ttlAutopurge; + this.ttl = ttl || 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); + } + } + } + /** + * Return the number of ms left in the item's TTL. If item is not in cache, + * returns `0`. Returns `Infinity` if item is in cache without a defined TTL. + */ + getRemainingTTL(key) { + return this.#keyMap.has(key) ? Infinity : 0; + } + #initializeTTLTracking() { + const ttls = new ZeroArray(this.#max); + const starts = new ZeroArray(this.#max); + this.#ttls = ttls; + this.#starts = starts; + this.#setItemTTL = (index, ttl, start = perf.now()) => { + starts[index] = ttl !== 0 ? start : 0; + ttls[index] = ttl; + if (ttl !== 0 && this.ttlAutopurge) { + const t = setTimeout(() => { + if (this.#isStale(index)) { + this.#delete(this.#keyList[index], 'expire'); + } + }, ttl + 1); + // unref() not supported on all platforms + /* c8 ignore start */ + if (t.unref) { + t.unref(); + } + /* c8 ignore stop */ + } + }; + this.#updateItemAge = index => { + starts[index] = ttls[index] !== 0 ? perf.now() : 0; + }; + this.#statusTTL = (status, index) => { + if (ttls[index]) { + const ttl = ttls[index]; + const start = starts[index]; + /* c8 ignore next */ + if (!ttl || !start) + return; + status.ttl = ttl; + status.start = start; + status.now = cachedNow || getNow(); + const age = status.now - start; + status.remainingTTL = ttl - age; + } + }; + // 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); + // not available on all platforms + /* c8 ignore start */ + if (t.unref) { + t.unref(); + } + /* c8 ignore stop */ + } + return n; + }; + this.getRemainingTTL = key => { + const index = this.#keyMap.get(key); + if (index === undefined) { + return 0; + } + const ttl = ttls[index]; + const start = starts[index]; + if (!ttl || !start) { + return Infinity; + } + const age = (cachedNow || getNow()) - start; + return ttl - age; + }; + this.#isStale = index => { + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; + }; + } + // conditionally set private methods related to TTL + #updateItemAge = () => { }; + #statusTTL = () => { }; + #setItemTTL = () => { }; + /* c8 ignore stop */ + #isStale = () => false; + #initializeSizeTracking() { + const sizes = new ZeroArray(this.#max); + this.#calculatedSize = 0; + this.#sizes = sizes; + this.#removeItemSize = index => { + this.#calculatedSize -= sizes[index]; + 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) => { + sizes[index] = size; + if (this.#maxSize) { + const maxSize = this.#maxSize - sizes[index]; + while (this.#calculatedSize > maxSize) { + this.#evict(true); + } + } + this.#calculatedSize += sizes[index]; + if (status) { + status.entrySize = size; + status.totalCalculatedSize = this.#calculatedSize; + } + }; + } + #removeItemSize = _i => { }; + #addItemSize = (_i, _s, _st) => { }; + #requireSize = (_k, _v, size, sizeCalculation) => { + if (size || sizeCalculation) { + throw new TypeError('cannot set size without setting maxSize or maxEntrySize on cache'); + } + return 0; + }; + *#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); + } + /** + * Return a generator yielding `[key, value]` pairs, + * in order from most recently used to least recently used. + */ + *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]]; + } + } + } + /** + * Inverse order version of {@link LRUCache.entries} + * + * Return a generator yielding `[key, value]` pairs, + * in order from least recently used to most recently used. + */ + *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]]; + } + } + } + /** + * Return a generator yielding the keys in the cache, + * in order from most recently used to least recently used. + */ + *keys() { + for (const i of this.#indexes()) { + const k = this.#keyList[i]; + if (k !== undefined && + !this.#isBackgroundFetch(this.#valList[i])) { + yield k; + } + } + } + /** + * Inverse order version of {@link LRUCache.keys} + * + * Return a generator yielding the keys in the cache, + * in order from least recently used to most recently used. + */ + *rkeys() { + for (const i of this.#rindexes()) { + const k = this.#keyList[i]; + if (k !== undefined && + !this.#isBackgroundFetch(this.#valList[i])) { + yield k; + } + } + } + /** + * Return a generator yielding the values in the cache, + * in order from most recently used to least recently used. + */ + *values() { + for (const i of this.#indexes()) { + const v = this.#valList[i]; + if (v !== undefined && + !this.#isBackgroundFetch(this.#valList[i])) { + yield this.#valList[i]; + } + } + } + /** + * Inverse order version of {@link LRUCache.values} + * + * Return a generator yielding the values in the cache, + * in order from least recently used to most recently used. + */ + *rvalues() { + for (const i of this.#rindexes()) { + const v = this.#valList[i]; + if (v !== undefined && + !this.#isBackgroundFetch(this.#valList[i])) { + yield this.#valList[i]; + } + } + } + /** + * Iterating over the cache itself yields the same results as + * {@link LRUCache.entries} + */ + [Symbol.iterator]() { + return this.entries(); + } + /** + * A String value that is used in the creation of the default string + * description of an object. Called by the built-in method + * `Object.prototype.toString`. + */ + [Symbol.toStringTag] = 'LRUCache'; + /** + * Find a value for which the supplied fn method returns a truthy value, + * similar to `Array.find()`. fn is called as `fn(value, key, cache)`. + */ + 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); + } + } + } + /** + * Call the supplied function on each item in the cache, in order from most + * recently used to least recently used. + * + * `fn` is called as `fn(value, key, cache)`. + * + * If `thisp` is provided, function will be called in the `this`-context of + * the provided object, or the cache if no `thisp` object is provided. + * + * Does not update age or recenty of use, or iterate over stale values. + */ + 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); + } + } + /** + * The same as {@link LRUCache.forEach} but items are iterated over in + * reverse order. (ie, less recently used items are iterated over first.) + */ + 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); + } + } + /** + * Delete any stale entries. Returns true if anything was removed, + * false otherwise. + */ + purgeStale() { + let deleted = false; + for (const i of this.#rindexes({ allowStale: true })) { + if (this.#isStale(i)) { + this.#delete(this.#keyList[i], 'expire'); + deleted = true; + } + } + return deleted; + } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Returns `undefined` if the key is not present. + * + * Unlike {@link LRUCache#dump}, which is designed to be portable and survive + * serialization, the `start` value is always the current timestamp, and the + * `ttl` is a calculated remaining time to live (negative if expired). + * + * Always returns stale values, if their info is found in the cache, so be + * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl}) + * if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === undefined) + return undefined; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) + ? v.__staleWhileFetching + : v; + if (value === undefined) + return undefined; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } + /** + * Return an array of [key, {@link LRUCache.Entry}] tuples which can be + * passed to {@link LRLUCache#load}. + * + * The `start` fields are calculated relative to a portable `Date.now()` + * timestamp, even if `performance.now()` is available. + * + * Stale entries are always included in the `dump`, even if + * {@link LRUCache.OptionsBase.allowStale} is false. + * + * Note: this returns an actual array, not a generator, so it can be more + * easily passed around. + */ + 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 || key === undefined) + continue; + const entry = { value }; + if (this.#ttls && this.#starts) { + 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; + } + /** + * Reset the cache and load in the items in entries in the order listed. + * + * The shape of the resulting cache may be different if the same options are + * not used in both caches. + * + * The `start` fields are assumed to be calculated relative to a portable + * `Date.now()` timestamp, even if `performance.now()` is available. + */ + 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, so that + // we get the intended remaining TTL, no matter how long it's + // been on ice. + // + // 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); + } + } + /** + * Add a value to the cache. + * + * Note: if `undefined` is specified as a value, this is an alias for + * {@link LRUCache#delete} + * + * Fields on the {@link LRUCache.SetOptions} options param will override + * their corresponding values in the constructor options for the scope + * of this single `set()` operation. + * + * If `start` is provided, then that will set the effective start + * time for the TTL calculation. Note that this must be a previous + * value of `performance.now()` if supported, or a previous value of + * `Date.now()` if not. + * + * Options object may also include `size`, which will prevent + * calling the `sizeCalculation` function and just use the specified + * number if it is a positive integer, and `noDisposeOnSet` which + * will prevent calling a `dispose` function in the case of + * overwrites. + * + * If the `size` (or return value of `sizeCalculation`) for a given + * entry is greater than `maxEntrySize`, then the item will not be + * added to the cache. + * + * Will update the recency of the entry. + * + * If the value is `undefined`, then this is an alias for + * `cache.delete(key)`. `undefined` is never stored in the cache. + */ + set(k, v, setOptions = {}) { + if (v === undefined) { + this.delete(k); + return this; + } + const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status, } = setOptions; + let { noUpdateTTL = this.noUpdateTTL } = setOptions; + const size = this.#requireSize(k, v, setOptions.size || 0, 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 something is there already. + this.#delete(k, 'set'); + return this; + } + let index = this.#size === 0 ? undefined : this.#keyMap.get(k); + if (index === undefined) { + // addition + index = (this.#size === 0 + ? this.#tail + : this.#free.length !== 0 + ? this.#free.pop() + : this.#size === this.#max + ? this.#evict(false) + : this.#size); + 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.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) { + oldVal.__abortController.abort(new Error('replaced')); + const { __staleWhileFetching: s } = oldVal; + if (s !== undefined && !noDisposeOnSet) { + if (this.#hasDispose) { + this.#dispose?.(s, k, 'set'); + } + if (this.#hasDisposeAfter) { + this.#disposed?.push([s, k, 'set']); + } + } + } + else if (!noDisposeOnSet) { + if (this.#hasDispose) { + this.#dispose?.(oldVal, k, 'set'); + } + if (this.#hasDisposeAfter) { + this.#disposed?.push([oldVal, k, 'set']); + } + } + this.#removeItemSize(index); + this.#addItemSize(index, size, status); + this.#valList[index] = v; + 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.#ttls) { + this.#initializeTTLTracking(); + } + if (this.#ttls) { + if (!noUpdateTTL) { + this.#setItemTTL(index, ttl, start); + } + if (status) + this.#statusTTL(status, index); + } + if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) { + const dt = this.#disposed; + let task; + while ((task = dt?.shift())) { + this.#disposeAfter?.(...task); + } + } + return this; + } + /** + * Evict the least recently used item, returning its value or + * `undefined` if cache is empty. + */ + pop() { + try { + while (this.#size) { + const val = this.#valList[this.#head]; + this.#evict(true); + if (this.#isBackgroundFetch(val)) { + if (val.__staleWhileFetching) { + return val.__staleWhileFetching; + } + } + else if (val !== undefined) { + return val; + } + } + } + finally { + if (this.#hasDisposeAfter && this.#disposed) { + const dt = this.#disposed; + let task; + while ((task = dt?.shift())) { + this.#disposeAfter?.(...task); + } + } + } + } + #evict(free) { + const head = this.#head; + const k = this.#keyList[head]; + const v = this.#valList[head]; + if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) { + v.__abortController.abort(new Error('evicted')); + } + else if (this.#hasDispose || this.#hasDisposeAfter) { + if (this.#hasDispose) { + this.#dispose?.(v, k, 'evict'); + } + if (this.#hasDisposeAfter) { + 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] = undefined; + this.#valList[head] = undefined; + this.#free.push(head); + } + if (this.#size === 1) { + this.#head = this.#tail = 0; + this.#free.length = 0; + } + else { + this.#head = this.#next[head]; + } + this.#keyMap.delete(k); + this.#size--; + return head; + } + /** + * Check if a key is in the cache, without updating the recency of use. + * Will return false if the item is stale, even though it is technically + * in the cache. + * + * Check if a key is in the cache, without updating the recency of + * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set + * to `true` in either the options or the constructor. + * + * Will return `false` if the item is stale, even though it is technically in + * the cache. The difference can be determined (if it matters) by using a + * `status` argument, and inspecting the `has` field. + * + * Will not update item age unless + * {@link LRUCache.OptionsBase.updateAgeOnHas} is set. + */ + has(k, hasOptions = {}) { + const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions; + const index = this.#keyMap.get(k); + if (index !== undefined) { + const v = this.#valList[index]; + if (this.#isBackgroundFetch(v) && + v.__staleWhileFetching === undefined) { + return false; + } + 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 {@link LRUCache#get} but doesn't update recency or delete stale + * items. + * + * Returns `undefined` if the item is stale, unless + * {@link LRUCache.OptionsBase.allowStale} is set. + */ + peek(k, peekOptions = {}) { + const { allowStale = this.allowStale } = peekOptions; + const index = this.#keyMap.get(k); + if (index === undefined || + (!allowStale && this.#isStale(index))) { + return; + } + 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(); + const { signal } = options; + // when/if our AC signals, then stop listening to theirs. + signal?.addEventListener('abort', () => ac.abort(signal.reason), { + signal: ac.signal, + }); + 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 + const bf = p; + if (this.#valList[index] === p) { + if (v === undefined) { + if (bf.__staleWhileFetching) { + this.#valList[index] = bf.__staleWhileFetching; + } + else { + this.#delete(k, 'fetch'); + } + } + 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; + const bf = p; + 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 || bf.__staleWhileFetching === undefined; + if (del) { + this.#delete(k, 'fetch'); + } + 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] = bf.__staleWhileFetching; + } + } + if (allowStale) { + if (options.status && bf.__staleWhileFetching !== undefined) { + options.status.returnedStale = true; + } + return bf.__staleWhileFetching; + } + else if (bf.__returned === bf) { + throw er; + } + }; + const pcall = (res, rej) => { + const fmp = this.#fetchMethod?.(k, v, fetchOpts); + if (fmp && fmp instanceof Promise) { + fmp.then(v => res(v === undefined ? undefined : 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(undefined); + // 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); + const bf = Object.assign(p, { + __abortController: ac, + __staleWhileFetching: v, + __returned: undefined, + }); + if (index === undefined) { + // internal, don't expose status. + this.set(k, bf, { ...fetchOpts.options, status: undefined }); + index = this.#keyMap.get(k); + } + else { + this.#valList[index] = bf; + } + return bf; + } + #isBackgroundFetch(p) { + if (!this.#hasFetchMethod) + return false; + const b = p; + return (!!b && + b instanceof Promise && + b.hasOwnProperty('__staleWhileFetching') && + b.__abortController instanceof AC); + } + async fetch(k, fetchOptions = {}) { + const { + // 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, context, forceRefresh = false, status, signal, } = fetchOptions; + if (!this.#hasFetchMethod) { + 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, context); + 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); + } + if (status) + 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, context); + const hasStale = p.__staleWhileFetching !== undefined; + const staleVal = hasStale && allowStale; + if (status) { + status.fetch = isStale ? 'stale' : 'refresh'; + if (staleVal && isStale) + status.returnedStale = true; + } + return staleVal ? p.__staleWhileFetching : (p.__returned = p); + } + } + async forceFetch(k, fetchOptions = {}) { + const v = await this.fetch(k, fetchOptions); + if (v === undefined) + throw new Error('fetch() returned undefined'); + return v; + } + memo(k, memoOptions = {}) { + const memoMethod = this.#memoMethod; + if (!memoMethod) { + throw new Error('no memoMethod provided to constructor'); + } + const { context, forceRefresh, ...options } = memoOptions; + const v = this.get(k, options); + if (!forceRefresh && v !== undefined) + return v; + const vv = memoMethod(k, v, { + options, + context, + }); + this.set(k, vv, options); + return vv; + } + /** + * Return a value from the cache. Will update the recency of the cache + * entry found. + * + * If the key is not found, get() will return `undefined`. + */ + get(k, getOptions = {}) { + const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status, } = getOptions; + const index = this.#keyMap.get(k); + if (index !== undefined) { + const value = this.#valList[index]; + const fetching = this.#isBackgroundFetch(value); + if (status) + 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, 'expire'); + } + if (status && allowStale) + status.returnedStale = true; + return allowStale ? value : undefined; + } + else { + if (status && + allowStale && + value.__staleWhileFetching !== undefined) { + status.returnedStale = true; + } + 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; + } + } + /** + * Deletes a key out of the cache. + * + * Returns true if the key was deleted, false otherwise. + */ + delete(k) { + return this.#delete(k, 'delete'); + } + #delete(k, reason) { + let deleted = false; + if (this.#size !== 0) { + const index = this.#keyMap.get(k); + if (index !== undefined) { + deleted = true; + if (this.#size === 1) { + this.#clear(reason); + } + else { + this.#removeItemSize(index); + const v = this.#valList[index]; + if (this.#isBackgroundFetch(v)) { + v.__abortController.abort(new Error('deleted')); + } + else if (this.#hasDispose || this.#hasDisposeAfter) { + if (this.#hasDispose) { + this.#dispose?.(v, k, reason); + } + if (this.#hasDisposeAfter) { + this.#disposed?.push([v, k, reason]); + } + } + this.#keyMap.delete(k); + this.#keyList[index] = undefined; + this.#valList[index] = undefined; + if (index === this.#tail) { + this.#tail = this.#prev[index]; + } + else if (index === this.#head) { + this.#head = this.#next[index]; + } + else { + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; + } + this.#size--; + this.#free.push(index); + } + } + } + if (this.#hasDisposeAfter && this.#disposed?.length) { + const dt = this.#disposed; + let task; + while ((task = dt?.shift())) { + this.#disposeAfter?.(...task); + } + } + return deleted; + } + /** + * Clear the cache entirely, throwing away all values. + */ + clear() { + return this.#clear('delete'); + } + #clear(reason) { + 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]; + if (this.#hasDispose) { + this.#dispose?.(v, k, reason); + } + if (this.#hasDisposeAfter) { + this.#disposed?.push([v, k, reason]); + } + } + } + this.#keyMap.clear(); + this.#valList.fill(undefined); + this.#keyList.fill(undefined); + if (this.#ttls && this.#starts) { + this.#ttls.fill(0); + this.#starts.fill(0); + } + if (this.#sizes) { + this.#sizes.fill(0); + } + this.#head = 0; + this.#tail = 0; + this.#free.length = 0; + this.#calculatedSize = 0; + this.#size = 0; + if (this.#hasDisposeAfter && this.#disposed) { + const dt = this.#disposed; + let task; + while ((task = dt?.shift())) { + this.#disposeAfter?.(...task); + } + } + } +} +exports.LRUCache = LRUCache; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/lru-cache/dist/commonjs/index.min.js b/node_modules/npm/node_modules/lru-cache/dist/commonjs/index.min.js new file mode 100644 index 00000000..ad643b0b --- /dev/null +++ b/node_modules/npm/node_modules/lru-cache/dist/commonjs/index.min.js @@ -0,0 +1,2 @@ +"use strict";var G=(l,t,e)=>{if(!t.has(l))throw TypeError("Cannot "+e)};var j=(l,t,e)=>(G(l,t,"read from private field"),e?e.call(l):t.get(l)),I=(l,t,e)=>{if(t.has(l))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(l):t.set(l,e)},x=(l,t,e,i)=>(G(l,t,"write to private field"),i?i.call(l,e):t.set(l,e),e);Object.defineProperty(exports,"__esModule",{value:!0});exports.LRUCache=void 0;var T=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,P=new Set,U=typeof process=="object"&&process?process:{},H=(l,t,e,i)=>{typeof U.emitWarning=="function"?U.emitWarning(l,t,e,i):console.error(`[${e}] ${t}: ${l}`)},D=globalThis.AbortController,N=globalThis.AbortSignal;if(typeof D>"u"){N=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,s){this._onabort.push(s)}},D=class{constructor(){t()}signal=new N;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i)}}};let l=U.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{l&&(l=!1,H("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var V=l=>!P.has(l),Y=Symbol("type"),A=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),k=l=>A(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?E:null:null,E=class extends Array{constructor(t){super(t),this.fill(0)}},v,O=class{heap;length;static create(t){let e=k(t);if(!e)return[];x(O,v,!0);let i=new O(t,e);return x(O,v,!1),i}constructor(t,e){if(!j(O,v))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},W=O;v=new WeakMap,I(W,v,!1);var C=class{#g;#f;#p;#w;#R;#W;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#S;#s;#i;#t;#l;#c;#o;#h;#_;#r;#b;#m;#u;#y;#E;#a;static unsafeExposeInternals(t){return{starts:t.#m,ttls:t.#u,sizes:t.#b,keyMap:t.#s,keyList:t.#i,valList:t.#t,next:t.#l,prev:t.#c,get head(){return t.#o},get tail(){return t.#h},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,n)=>t.#x(e,i,s,n),moveToTail:e=>t.#C(e),indexes:e=>t.#A(e),rindexes:e=>t.#F(e),isStale:e=>t.#d(e)}}get max(){return this.#g}get maxSize(){return this.#f}get calculatedSize(){return this.#S}get size(){return this.#n}get fetchMethod(){return this.#R}get memoMethod(){return this.#W}get dispose(){return this.#p}get disposeAfter(){return this.#w}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:h,updateAgeOnHas:o,allowStale:r,dispose:g,disposeAfter:b,noDisposeOnSet:f,noUpdateTTL:u,maxSize:c=0,maxEntrySize:F=0,sizeCalculation:d,fetchMethod:S,memoMethod:a,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:m,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:_,ignoreFetchAbort:z}=t;if(e!==0&&!A(e))throw new TypeError("max option must be a nonnegative integer");let y=e?k(e):Array;if(!y)throw new Error("invalid max value: "+e);if(this.#g=e,this.#f=c,this.maxEntrySize=F||this.#f,this.sizeCalculation=d,this.sizeCalculation){if(!this.#f&&!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")}if(a!==void 0&&typeof a!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#W=a,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#R=S,this.#E=!!S,this.#s=new Map,this.#i=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new y(e),this.#c=new y(e),this.#o=0,this.#h=0,this.#_=W.create(e),this.#n=0,this.#S=0,typeof g=="function"&&(this.#p=g),typeof b=="function"?(this.#w=b,this.#r=[]):(this.#w=void 0,this.#r=void 0),this.#y=!!this.#p,this.#a=!!this.#w,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!u,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!p,this.allowStaleOnFetchAbort=!!_,this.ignoreFetchAbort=!!z,this.maxEntrySize!==0){if(this.#f!==0&&!A(this.#f))throw new TypeError("maxSize must be a positive integer if specified");if(!A(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#P()}if(this.allowStale=!!r,this.noDeleteOnStaleGet=!!m,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!o,this.ttlResolution=A(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!A(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#U()}if(this.#g===0&&this.ttl===0&&this.#f===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#g&&!this.#f){let R="LRU_CACHE_UNBOUNDED";V(R)&&(P.add(R),H("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",R,C))}}getRemainingTTL(t){return this.#s.has(t)?1/0:0}#U(){let t=new E(this.#g),e=new E(this.#g);this.#u=t,this.#m=e,this.#M=(n,h,o=T.now())=>{if(e[n]=h!==0?o:0,t[n]=h,h!==0&&this.ttlAutopurge){let r=setTimeout(()=>{this.#d(n)&&this.#T(this.#i[n],"expire")},h+1);r.unref&&r.unref()}},this.#v=n=>{e[n]=t[n]!==0?T.now():0},this.#O=(n,h)=>{if(t[h]){let o=t[h],r=e[h];if(!o||!r)return;n.ttl=o,n.start=r,n.now=i||s();let g=n.now-r;n.remainingTTL=o-g}};let i=0,s=()=>{let n=T.now();if(this.ttlResolution>0){i=n;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref()}return n};this.getRemainingTTL=n=>{let h=this.#s.get(n);if(h===void 0)return 0;let o=t[h],r=e[h];if(!o||!r)return 1/0;let g=(i||s())-r;return o-g},this.#d=n=>{let h=e[n],o=t[n];return!!o&&!!h&&(i||s())-h>o}}#v=()=>{};#O=()=>{};#M=()=>{};#d=()=>!1;#P(){let t=new E(this.#g);this.#S=0,this.#b=t,this.#z=e=>{this.#S-=t[e],t[e]=0},this.#G=(e,i,s,n)=>{if(this.#e(i))return 0;if(!A(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,e),!A(s))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 s},this.#D=(e,i,s)=>{if(t[e]=i,this.#f){let n=this.#f-t[e];for(;this.#S>n;)this.#L(!0)}this.#S+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#S)}}#z=t=>{};#D=(t,e,i)=>{};#G=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#A({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#h;!(!this.#j(e)||((t||!this.#d(e))&&(yield e),e===this.#o));)e=this.#c[e]}*#F({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#o;!(!this.#j(e)||((t||!this.#d(e))&&(yield e),e===this.#h));)e=this.#l[e]}#j(t){return t!==void 0&&this.#s.get(this.#i[t])===t}*entries(){for(let t of this.#A())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*rentries(){for(let t of this.#F())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*keys(){for(let t of this.#A()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*rkeys(){for(let t of this.#F()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*values(){for(let t of this.#A())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}*rvalues(){for(let t of this.#F())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,this.#i[i],this))return this.get(this.#i[i],e)}}forEach(t,e=this){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}rforEach(t,e=this){for(let i of this.#F()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}purgeStale(){let t=!1;for(let e of this.#F({allowStale:!0}))this.#d(e)&&(this.#T(this.#i[e],"expire"),t=!0);return t}info(t){let e=this.#s.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#u&&this.#m){let h=this.#u[e],o=this.#m[e];if(h&&o){let r=h-(T.now()-o);n.ttl=r,n.start=Date.now()}}return this.#b&&(n.size=this.#b[e]),n}dump(){let t=[];for(let e of this.#A({allowStale:!0})){let i=this.#i[e],s=this.#t[e],n=this.#e(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let h={value:n};if(this.#u&&this.#m){h.ttl=this.#u[e];let o=T.now()-this.#m[e];h.start=Math.floor(Date.now()-o)}this.#b&&(h.size=this.#b[e]),t.unshift([i,h])}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=T.now()-s}this.set(e,i.value,i)}}set(t,e,i={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:r}=i,{noUpdateTTL:g=this.noUpdateTTL}=i,b=this.#G(t,e,i.size||0,o);if(this.maxEntrySize&&b>this.maxEntrySize)return r&&(r.set="miss",r.maxEntrySizeExceeded=!0),this.#T(t,"set"),this;let f=this.#n===0?void 0:this.#s.get(t);if(f===void 0)f=this.#n===0?this.#h:this.#_.length!==0?this.#_.pop():this.#n===this.#g?this.#L(!1):this.#n,this.#i[f]=t,this.#t[f]=e,this.#s.set(t,f),this.#l[this.#h]=f,this.#c[f]=this.#h,this.#h=f,this.#n++,this.#D(f,b,r),r&&(r.set="add"),g=!1;else{this.#C(f);let u=this.#t[f];if(e!==u){if(this.#E&&this.#e(u)){u.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:c}=u;c!==void 0&&!h&&(this.#y&&this.#p?.(c,t,"set"),this.#a&&this.#r?.push([c,t,"set"]))}else h||(this.#y&&this.#p?.(u,t,"set"),this.#a&&this.#r?.push([u,t,"set"]));if(this.#z(f),this.#D(f,b,r),this.#t[f]=e,r){r.set="replace";let c=u&&this.#e(u)?u.__staleWhileFetching:u;c!==void 0&&(r.oldValue=c)}}else r&&(r.set="update")}if(s!==0&&!this.#u&&this.#U(),this.#u&&(g||this.#M(f,s,n),r&&this.#O(r,f)),!h&&this.#a&&this.#r){let u=this.#r,c;for(;c=u?.shift();)this.#w?.(...c)}return this}pop(){try{for(;this.#n;){let t=this.#t[this.#o];if(this.#L(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#a&&this.#r){let t=this.#r,e;for(;e=t?.shift();)this.#w?.(...e)}}}#L(t){let e=this.#o,i=this.#i[e],s=this.#t[e];return this.#E&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#y||this.#a)&&(this.#y&&this.#p?.(s,i,"evict"),this.#a&&this.#r?.push([s,i,"evict"])),this.#z(e),t&&(this.#i[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#n===1?(this.#o=this.#h=0,this.#_.length=0):this.#o=this.#l[e],this.#s.delete(i),this.#n--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,n=this.#s.get(t);if(n!==void 0){let h=this.#t[n];if(this.#e(h)&&h.__staleWhileFetching===void 0)return!1;if(this.#d(n))s&&(s.has="stale",this.#O(s,n));else return i&&this.#v(n),s&&(s.has="hit",this.#O(s,n)),!0}else s&&(s.has="miss");return!1}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#s.get(t);if(s===void 0||!i&&this.#d(s))return;let n=this.#t[s];return this.#e(n)?n.__staleWhileFetching:n}#x(t,e,i,s){let n=e===void 0?void 0:this.#t[e];if(this.#e(n))return n;let h=new D,{signal:o}=i;o?.addEventListener("abort",()=>h.abort(o.reason),{signal:h.signal});let r={signal:h.signal,options:i,context:s},g=(d,S=!1)=>{let{aborted:a}=h.signal,w=i.ignoreFetchAbort&&d!==void 0;if(i.status&&(a&&!S?(i.status.fetchAborted=!0,i.status.fetchError=h.signal.reason,w&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),a&&!w&&!S)return f(h.signal.reason);let m=c;return this.#t[e]===c&&(d===void 0?m.__staleWhileFetching?this.#t[e]=m.__staleWhileFetching:this.#T(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,d,r.options))),d},b=d=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=d),f(d)),f=d=>{let{aborted:S}=h.signal,a=S&&i.allowStaleOnFetchAbort,w=a||i.allowStaleOnFetchRejection,m=w||i.noDeleteOnFetchRejection,p=c;if(this.#t[e]===c&&(!m||p.__staleWhileFetching===void 0?this.#T(t,"fetch"):a||(this.#t[e]=p.__staleWhileFetching)),w)return i.status&&p.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),p.__staleWhileFetching;if(p.__returned===p)throw d},u=(d,S)=>{let a=this.#R?.(t,n,r);a&&a instanceof Promise&&a.then(w=>d(w===void 0?void 0:w),S),h.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(d(void 0),i.allowStaleOnFetchAbort&&(d=w=>g(w,!0)))})};i.status&&(i.status.fetchDispatched=!0);let c=new Promise(u).then(g,b),F=Object.assign(c,{__abortController:h,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,F,{...r.options,status:void 0}),e=this.#s.get(t)):this.#t[e]=F,F}#e(t){if(!this.#E)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof D}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:r=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:b=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:c=this.ignoreFetchAbort,allowStaleOnFetchAbort:F=this.allowStaleOnFetchAbort,context:d,forceRefresh:S=!1,status:a,signal:w}=e;if(!this.#E)return a&&(a.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:a});let m={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:h,noDisposeOnSet:o,size:r,sizeCalculation:g,noUpdateTTL:b,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:F,ignoreFetchAbort:c,status:a,signal:w},p=this.#s.get(t);if(p===void 0){a&&(a.fetch="miss");let _=this.#x(t,p,m,d);return _.__returned=_}else{let _=this.#t[p];if(this.#e(_)){let M=i&&_.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",M&&(a.returnedStale=!0)),M?_.__staleWhileFetching:_.__returned=_}let z=this.#d(p);if(!S&&!z)return a&&(a.fetch="hit"),this.#C(p),s&&this.#v(p),a&&this.#O(a,p),_;let y=this.#x(t,p,m,d),L=y.__staleWhileFetching!==void 0&&i;return a&&(a.fetch=z?"stale":"refresh",L&&z&&(a.returnedStale=!0)),L?y.__staleWhileFetching:y.__returned=y}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#W;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...h}=e,o=this.get(t,h);if(!n&&o!==void 0)return o;let r=i(t,o,{options:h,context:s});return this.set(t,r,h),r}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:h}=e,o=this.#s.get(t);if(o!==void 0){let r=this.#t[o],g=this.#e(r);return h&&this.#O(h,o),this.#d(o)?(h&&(h.get="stale"),g?(h&&i&&r.__staleWhileFetching!==void 0&&(h.returnedStale=!0),i?r.__staleWhileFetching:void 0):(n||this.#T(t,"expire"),h&&i&&(h.returnedStale=!0),i?r:void 0)):(h&&(h.get="hit"),g?r.__staleWhileFetching:(this.#C(o),s&&this.#v(o),r))}else h&&(h.get="miss")}#I(t,e){this.#c[e]=t,this.#l[t]=e}#C(t){t!==this.#h&&(t===this.#o?this.#o=this.#l[t]:this.#I(this.#c[t],this.#l[t]),this.#I(this.#h,t),this.#h=t)}delete(t){return this.#T(t,"delete")}#T(t,e){let i=!1;if(this.#n!==0){let s=this.#s.get(t);if(s!==void 0)if(i=!0,this.#n===1)this.#N(e);else{this.#z(s);let n=this.#t[s];if(this.#e(n)?n.__abortController.abort(new Error("deleted")):(this.#y||this.#a)&&(this.#y&&this.#p?.(n,t,e),this.#a&&this.#r?.push([n,t,e])),this.#s.delete(t),this.#i[s]=void 0,this.#t[s]=void 0,s===this.#h)this.#h=this.#c[s];else if(s===this.#o)this.#o=this.#l[s];else{let h=this.#c[s];this.#l[h]=this.#l[s];let o=this.#l[s];this.#c[o]=this.#c[s]}this.#n--,this.#_.push(s)}}if(this.#a&&this.#r?.length){let s=this.#r,n;for(;n=s?.shift();)this.#w?.(...n)}return i}clear(){return this.#N("delete")}#N(t){for(let e of this.#F({allowStale:!0})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#i[e];this.#y&&this.#p?.(i,s,t),this.#a&&this.#r?.push([i,s,t])}}if(this.#s.clear(),this.#t.fill(void 0),this.#i.fill(void 0),this.#u&&this.#m&&(this.#u.fill(0),this.#m.fill(0)),this.#b&&this.#b.fill(0),this.#o=0,this.#h=0,this.#_.length=0,this.#S=0,this.#n=0,this.#a&&this.#r){let e=this.#r,i;for(;i=e?.shift();)this.#w?.(...i)}}};exports.LRUCache=C; +//# sourceMappingURL=index.min.js.map diff --git a/node_modules/npm/node_modules/lru-cache/dist/commonjs/package.json b/node_modules/npm/node_modules/lru-cache/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/lru-cache/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/lru-cache/dist/esm/index.js b/node_modules/npm/node_modules/lru-cache/dist/esm/index.js new file mode 100644 index 00000000..555654a5 --- /dev/null +++ b/node_modules/npm/node_modules/lru-cache/dist/esm/index.js @@ -0,0 +1,1542 @@ +/** + * @module LRUCache + */ +const perf = typeof performance === 'object' && + performance && + typeof performance.now === 'function' + ? performance + : Date; +const warned = new Set(); +/* c8 ignore start */ +const PROCESS = (typeof process === 'object' && !!process ? process : {}); +/* c8 ignore start */ +const emitWarning = (msg, type, code, fn) => { + typeof PROCESS.emitWarning === 'function' + ? PROCESS.emitWarning(msg, type, code, fn) + : console.error(`[${code}] ${type}: ${msg}`); +}; +let AC = globalThis.AbortController; +let AS = globalThis.AbortSignal; +/* c8 ignore start */ +if (typeof AC === 'undefined') { + //@ts-ignore + AS = class AbortSignal { + onabort; + _onabort = []; + reason; + aborted = false; + addEventListener(_, fn) { + this._onabort.push(fn); + } + }; + //@ts-ignore + AC = class AbortController { + constructor() { + warnACPolyfill(); + } + signal = new AS(); + abort(reason) { + if (this.signal.aborted) + return; + //@ts-ignore + this.signal.reason = reason; + //@ts-ignore + this.signal.aborted = true; + //@ts-ignore + for (const fn of this.signal._onabort) { + fn(reason); + } + this.signal.onabort?.(reason); + } + }; + let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== '1'; + const warnACPolyfill = () => { + if (!printACPolyfillWarning) + return; + printACPolyfillWarning = false; + emitWarning('AbortController is not defined. If using lru-cache in ' + + 'node 14, load an AbortController polyfill from the ' + + '`node-abort-controller` package. A minimal polyfill is ' + + 'provided for use by LRUCache.fetch(), but it should not be ' + + 'relied upon in other contexts (eg, passing it to other APIs that ' + + 'use AbortController/AbortSignal might have undesirable effects). ' + + 'You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.', 'NO_ABORT_CONTROLLER', 'ENOTSUP', warnACPolyfill); + }; +} +/* c8 ignore stop */ +const shouldWarn = (code) => !warned.has(code); +const TYPE = Symbol('type'); +const isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n); +/* c8 ignore start */ +// 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; +/* c8 ignore stop */ +class ZeroArray extends Array { + constructor(size) { + super(size); + this.fill(0); + } +} +class Stack { + heap; + length; + // private constructor + static #constructing = false; + static create(max) { + const HeapCls = getUintArray(max); + if (!HeapCls) + return []; + Stack.#constructing = true; + const s = new Stack(max, HeapCls); + Stack.#constructing = false; + return s; + } + constructor(max, HeapCls) { + /* c8 ignore start */ + if (!Stack.#constructing) { + throw new TypeError('instantiate Stack using Stack.create(n)'); + } + /* c8 ignore stop */ + this.heap = new HeapCls(max); + this.length = 0; + } + push(n) { + this.heap[this.length++] = n; + } + pop() { + return this.heap[--this.length]; + } +} +/** + * Default export, the thing you're using this module to get. + * + * The `K` and `V` types define the key and value types, respectively. The + * optional `FC` type defines the type of the `context` object passed to + * `cache.fetch()` and `cache.memo()`. + * + * Keys and values **must not** be `null` or `undefined`. + * + * All properties from the options object (with the exception of `max`, + * `maxSize`, `fetchMethod`, `memoMethod`, `dispose` and `disposeAfter`) are + * added as normal public members. (The listed options are read-only getters.) + * + * Changing any of these will alter the defaults for subsequent method calls. + */ +export class LRUCache { + // options that cannot be changed without disaster + #max; + #maxSize; + #dispose; + #disposeAfter; + #fetchMethod; + #memoMethod; + /** + * {@link LRUCache.OptionsBase.ttl} + */ + ttl; + /** + * {@link LRUCache.OptionsBase.ttlResolution} + */ + ttlResolution; + /** + * {@link LRUCache.OptionsBase.ttlAutopurge} + */ + ttlAutopurge; + /** + * {@link LRUCache.OptionsBase.updateAgeOnGet} + */ + updateAgeOnGet; + /** + * {@link LRUCache.OptionsBase.updateAgeOnHas} + */ + updateAgeOnHas; + /** + * {@link LRUCache.OptionsBase.allowStale} + */ + allowStale; + /** + * {@link LRUCache.OptionsBase.noDisposeOnSet} + */ + noDisposeOnSet; + /** + * {@link LRUCache.OptionsBase.noUpdateTTL} + */ + noUpdateTTL; + /** + * {@link LRUCache.OptionsBase.maxEntrySize} + */ + maxEntrySize; + /** + * {@link LRUCache.OptionsBase.sizeCalculation} + */ + sizeCalculation; + /** + * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection} + */ + noDeleteOnFetchRejection; + /** + * {@link LRUCache.OptionsBase.noDeleteOnStaleGet} + */ + noDeleteOnStaleGet; + /** + * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort} + */ + allowStaleOnFetchAbort; + /** + * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection} + */ + allowStaleOnFetchRejection; + /** + * {@link LRUCache.OptionsBase.ignoreFetchAbort} + */ + ignoreFetchAbort; + // computed properties + #size; + #calculatedSize; + #keyMap; + #keyList; + #valList; + #next; + #prev; + #head; + #tail; + #free; + #disposed; + #sizes; + #starts; + #ttls; + #hasDispose; + #hasFetchMethod; + #hasDisposeAfter; + /** + * Do not call this method unless you need to inspect the + * inner workings of the cache. If anything returned by this + * object is modified in any way, strange breakage may occur. + * + * These fields are private for a reason! + * + * @internal + */ + static unsafeExposeInternals(c) { + return { + // properties + starts: c.#starts, + ttls: c.#ttls, + sizes: c.#sizes, + keyMap: c.#keyMap, + keyList: c.#keyList, + valList: c.#valList, + next: c.#next, + prev: c.#prev, + get head() { + return c.#head; + }, + get tail() { + return c.#tail; + }, + free: c.#free, + // methods + isBackgroundFetch: (p) => c.#isBackgroundFetch(p), + backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context), + moveToTail: (index) => c.#moveToTail(index), + indexes: (options) => c.#indexes(options), + rindexes: (options) => c.#rindexes(options), + isStale: (index) => c.#isStale(index), + }; + } + // Protected read-only members + /** + * {@link LRUCache.OptionsBase.max} (read-only) + */ + get max() { + return this.#max; + } + /** + * {@link LRUCache.OptionsBase.maxSize} (read-only) + */ + get maxSize() { + return this.#maxSize; + } + /** + * The total computed size of items in the cache (read-only) + */ + get calculatedSize() { + return this.#calculatedSize; + } + /** + * The number of items stored in the cache (read-only) + */ + get size() { + return this.#size; + } + /** + * {@link LRUCache.OptionsBase.fetchMethod} (read-only) + */ + get fetchMethod() { + return this.#fetchMethod; + } + get memoMethod() { + return this.#memoMethod; + } + /** + * {@link LRUCache.OptionsBase.dispose} (read-only) + */ + get dispose() { + return this.#dispose; + } + /** + * {@link LRUCache.OptionsBase.disposeAfter} (read-only) + */ + get disposeAfter() { + return this.#disposeAfter; + } + constructor(options) { + const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, } = 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; + 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'); + } + } + if (memoMethod !== undefined && + typeof memoMethod !== 'function') { + throw new TypeError('memoMethod must be a function if defined'); + } + this.#memoMethod = memoMethod; + if (fetchMethod !== undefined && + typeof fetchMethod !== 'function') { + throw new TypeError('fetchMethod must be a function if specified'); + } + this.#fetchMethod = fetchMethod; + this.#hasFetchMethod = !!fetchMethod; + this.#keyMap = new Map(); + this.#keyList = new Array(max).fill(undefined); + this.#valList = new Array(max).fill(undefined); + this.#next = new UintArray(max); + this.#prev = new UintArray(max); + this.#head = 0; + this.#tail = 0; + this.#free = Stack.create(max); + this.#size = 0; + this.#calculatedSize = 0; + if (typeof dispose === 'function') { + this.#dispose = dispose; + } + if (typeof disposeAfter === 'function') { + this.#disposeAfter = disposeAfter; + this.#disposed = []; + } + else { + this.#disposeAfter = undefined; + this.#disposed = undefined; + } + this.#hasDispose = !!this.#dispose; + this.#hasDisposeAfter = !!this.#disposeAfter; + 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; + this.noDeleteOnStaleGet = !!noDeleteOnStaleGet; + this.updateAgeOnGet = !!updateAgeOnGet; + this.updateAgeOnHas = !!updateAgeOnHas; + this.ttlResolution = + isPosInt(ttlResolution) || ttlResolution === 0 + ? ttlResolution + : 1; + this.ttlAutopurge = !!ttlAutopurge; + this.ttl = ttl || 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); + } + } + } + /** + * Return the number of ms left in the item's TTL. If item is not in cache, + * returns `0`. Returns `Infinity` if item is in cache without a defined TTL. + */ + getRemainingTTL(key) { + return this.#keyMap.has(key) ? Infinity : 0; + } + #initializeTTLTracking() { + const ttls = new ZeroArray(this.#max); + const starts = new ZeroArray(this.#max); + this.#ttls = ttls; + this.#starts = starts; + this.#setItemTTL = (index, ttl, start = perf.now()) => { + starts[index] = ttl !== 0 ? start : 0; + ttls[index] = ttl; + if (ttl !== 0 && this.ttlAutopurge) { + const t = setTimeout(() => { + if (this.#isStale(index)) { + this.#delete(this.#keyList[index], 'expire'); + } + }, ttl + 1); + // unref() not supported on all platforms + /* c8 ignore start */ + if (t.unref) { + t.unref(); + } + /* c8 ignore stop */ + } + }; + this.#updateItemAge = index => { + starts[index] = ttls[index] !== 0 ? perf.now() : 0; + }; + this.#statusTTL = (status, index) => { + if (ttls[index]) { + const ttl = ttls[index]; + const start = starts[index]; + /* c8 ignore next */ + if (!ttl || !start) + return; + status.ttl = ttl; + status.start = start; + status.now = cachedNow || getNow(); + const age = status.now - start; + status.remainingTTL = ttl - age; + } + }; + // 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); + // not available on all platforms + /* c8 ignore start */ + if (t.unref) { + t.unref(); + } + /* c8 ignore stop */ + } + return n; + }; + this.getRemainingTTL = key => { + const index = this.#keyMap.get(key); + if (index === undefined) { + return 0; + } + const ttl = ttls[index]; + const start = starts[index]; + if (!ttl || !start) { + return Infinity; + } + const age = (cachedNow || getNow()) - start; + return ttl - age; + }; + this.#isStale = index => { + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; + }; + } + // conditionally set private methods related to TTL + #updateItemAge = () => { }; + #statusTTL = () => { }; + #setItemTTL = () => { }; + /* c8 ignore stop */ + #isStale = () => false; + #initializeSizeTracking() { + const sizes = new ZeroArray(this.#max); + this.#calculatedSize = 0; + this.#sizes = sizes; + this.#removeItemSize = index => { + this.#calculatedSize -= sizes[index]; + 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) => { + sizes[index] = size; + if (this.#maxSize) { + const maxSize = this.#maxSize - sizes[index]; + while (this.#calculatedSize > maxSize) { + this.#evict(true); + } + } + this.#calculatedSize += sizes[index]; + if (status) { + status.entrySize = size; + status.totalCalculatedSize = this.#calculatedSize; + } + }; + } + #removeItemSize = _i => { }; + #addItemSize = (_i, _s, _st) => { }; + #requireSize = (_k, _v, size, sizeCalculation) => { + if (size || sizeCalculation) { + throw new TypeError('cannot set size without setting maxSize or maxEntrySize on cache'); + } + return 0; + }; + *#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); + } + /** + * Return a generator yielding `[key, value]` pairs, + * in order from most recently used to least recently used. + */ + *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]]; + } + } + } + /** + * Inverse order version of {@link LRUCache.entries} + * + * Return a generator yielding `[key, value]` pairs, + * in order from least recently used to most recently used. + */ + *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]]; + } + } + } + /** + * Return a generator yielding the keys in the cache, + * in order from most recently used to least recently used. + */ + *keys() { + for (const i of this.#indexes()) { + const k = this.#keyList[i]; + if (k !== undefined && + !this.#isBackgroundFetch(this.#valList[i])) { + yield k; + } + } + } + /** + * Inverse order version of {@link LRUCache.keys} + * + * Return a generator yielding the keys in the cache, + * in order from least recently used to most recently used. + */ + *rkeys() { + for (const i of this.#rindexes()) { + const k = this.#keyList[i]; + if (k !== undefined && + !this.#isBackgroundFetch(this.#valList[i])) { + yield k; + } + } + } + /** + * Return a generator yielding the values in the cache, + * in order from most recently used to least recently used. + */ + *values() { + for (const i of this.#indexes()) { + const v = this.#valList[i]; + if (v !== undefined && + !this.#isBackgroundFetch(this.#valList[i])) { + yield this.#valList[i]; + } + } + } + /** + * Inverse order version of {@link LRUCache.values} + * + * Return a generator yielding the values in the cache, + * in order from least recently used to most recently used. + */ + *rvalues() { + for (const i of this.#rindexes()) { + const v = this.#valList[i]; + if (v !== undefined && + !this.#isBackgroundFetch(this.#valList[i])) { + yield this.#valList[i]; + } + } + } + /** + * Iterating over the cache itself yields the same results as + * {@link LRUCache.entries} + */ + [Symbol.iterator]() { + return this.entries(); + } + /** + * A String value that is used in the creation of the default string + * description of an object. Called by the built-in method + * `Object.prototype.toString`. + */ + [Symbol.toStringTag] = 'LRUCache'; + /** + * Find a value for which the supplied fn method returns a truthy value, + * similar to `Array.find()`. fn is called as `fn(value, key, cache)`. + */ + 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); + } + } + } + /** + * Call the supplied function on each item in the cache, in order from most + * recently used to least recently used. + * + * `fn` is called as `fn(value, key, cache)`. + * + * If `thisp` is provided, function will be called in the `this`-context of + * the provided object, or the cache if no `thisp` object is provided. + * + * Does not update age or recenty of use, or iterate over stale values. + */ + 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); + } + } + /** + * The same as {@link LRUCache.forEach} but items are iterated over in + * reverse order. (ie, less recently used items are iterated over first.) + */ + 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); + } + } + /** + * Delete any stale entries. Returns true if anything was removed, + * false otherwise. + */ + purgeStale() { + let deleted = false; + for (const i of this.#rindexes({ allowStale: true })) { + if (this.#isStale(i)) { + this.#delete(this.#keyList[i], 'expire'); + deleted = true; + } + } + return deleted; + } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Returns `undefined` if the key is not present. + * + * Unlike {@link LRUCache#dump}, which is designed to be portable and survive + * serialization, the `start` value is always the current timestamp, and the + * `ttl` is a calculated remaining time to live (negative if expired). + * + * Always returns stale values, if their info is found in the cache, so be + * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl}) + * if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === undefined) + return undefined; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) + ? v.__staleWhileFetching + : v; + if (value === undefined) + return undefined; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } + /** + * Return an array of [key, {@link LRUCache.Entry}] tuples which can be + * passed to {@link LRLUCache#load}. + * + * The `start` fields are calculated relative to a portable `Date.now()` + * timestamp, even if `performance.now()` is available. + * + * Stale entries are always included in the `dump`, even if + * {@link LRUCache.OptionsBase.allowStale} is false. + * + * Note: this returns an actual array, not a generator, so it can be more + * easily passed around. + */ + 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 || key === undefined) + continue; + const entry = { value }; + if (this.#ttls && this.#starts) { + 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; + } + /** + * Reset the cache and load in the items in entries in the order listed. + * + * The shape of the resulting cache may be different if the same options are + * not used in both caches. + * + * The `start` fields are assumed to be calculated relative to a portable + * `Date.now()` timestamp, even if `performance.now()` is available. + */ + 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, so that + // we get the intended remaining TTL, no matter how long it's + // been on ice. + // + // 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); + } + } + /** + * Add a value to the cache. + * + * Note: if `undefined` is specified as a value, this is an alias for + * {@link LRUCache#delete} + * + * Fields on the {@link LRUCache.SetOptions} options param will override + * their corresponding values in the constructor options for the scope + * of this single `set()` operation. + * + * If `start` is provided, then that will set the effective start + * time for the TTL calculation. Note that this must be a previous + * value of `performance.now()` if supported, or a previous value of + * `Date.now()` if not. + * + * Options object may also include `size`, which will prevent + * calling the `sizeCalculation` function and just use the specified + * number if it is a positive integer, and `noDisposeOnSet` which + * will prevent calling a `dispose` function in the case of + * overwrites. + * + * If the `size` (or return value of `sizeCalculation`) for a given + * entry is greater than `maxEntrySize`, then the item will not be + * added to the cache. + * + * Will update the recency of the entry. + * + * If the value is `undefined`, then this is an alias for + * `cache.delete(key)`. `undefined` is never stored in the cache. + */ + set(k, v, setOptions = {}) { + if (v === undefined) { + this.delete(k); + return this; + } + const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status, } = setOptions; + let { noUpdateTTL = this.noUpdateTTL } = setOptions; + const size = this.#requireSize(k, v, setOptions.size || 0, 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 something is there already. + this.#delete(k, 'set'); + return this; + } + let index = this.#size === 0 ? undefined : this.#keyMap.get(k); + if (index === undefined) { + // addition + index = (this.#size === 0 + ? this.#tail + : this.#free.length !== 0 + ? this.#free.pop() + : this.#size === this.#max + ? this.#evict(false) + : this.#size); + 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.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) { + oldVal.__abortController.abort(new Error('replaced')); + const { __staleWhileFetching: s } = oldVal; + if (s !== undefined && !noDisposeOnSet) { + if (this.#hasDispose) { + this.#dispose?.(s, k, 'set'); + } + if (this.#hasDisposeAfter) { + this.#disposed?.push([s, k, 'set']); + } + } + } + else if (!noDisposeOnSet) { + if (this.#hasDispose) { + this.#dispose?.(oldVal, k, 'set'); + } + if (this.#hasDisposeAfter) { + this.#disposed?.push([oldVal, k, 'set']); + } + } + this.#removeItemSize(index); + this.#addItemSize(index, size, status); + this.#valList[index] = v; + 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.#ttls) { + this.#initializeTTLTracking(); + } + if (this.#ttls) { + if (!noUpdateTTL) { + this.#setItemTTL(index, ttl, start); + } + if (status) + this.#statusTTL(status, index); + } + if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) { + const dt = this.#disposed; + let task; + while ((task = dt?.shift())) { + this.#disposeAfter?.(...task); + } + } + return this; + } + /** + * Evict the least recently used item, returning its value or + * `undefined` if cache is empty. + */ + pop() { + try { + while (this.#size) { + const val = this.#valList[this.#head]; + this.#evict(true); + if (this.#isBackgroundFetch(val)) { + if (val.__staleWhileFetching) { + return val.__staleWhileFetching; + } + } + else if (val !== undefined) { + return val; + } + } + } + finally { + if (this.#hasDisposeAfter && this.#disposed) { + const dt = this.#disposed; + let task; + while ((task = dt?.shift())) { + this.#disposeAfter?.(...task); + } + } + } + } + #evict(free) { + const head = this.#head; + const k = this.#keyList[head]; + const v = this.#valList[head]; + if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) { + v.__abortController.abort(new Error('evicted')); + } + else if (this.#hasDispose || this.#hasDisposeAfter) { + if (this.#hasDispose) { + this.#dispose?.(v, k, 'evict'); + } + if (this.#hasDisposeAfter) { + 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] = undefined; + this.#valList[head] = undefined; + this.#free.push(head); + } + if (this.#size === 1) { + this.#head = this.#tail = 0; + this.#free.length = 0; + } + else { + this.#head = this.#next[head]; + } + this.#keyMap.delete(k); + this.#size--; + return head; + } + /** + * Check if a key is in the cache, without updating the recency of use. + * Will return false if the item is stale, even though it is technically + * in the cache. + * + * Check if a key is in the cache, without updating the recency of + * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set + * to `true` in either the options or the constructor. + * + * Will return `false` if the item is stale, even though it is technically in + * the cache. The difference can be determined (if it matters) by using a + * `status` argument, and inspecting the `has` field. + * + * Will not update item age unless + * {@link LRUCache.OptionsBase.updateAgeOnHas} is set. + */ + has(k, hasOptions = {}) { + const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions; + const index = this.#keyMap.get(k); + if (index !== undefined) { + const v = this.#valList[index]; + if (this.#isBackgroundFetch(v) && + v.__staleWhileFetching === undefined) { + return false; + } + 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 {@link LRUCache#get} but doesn't update recency or delete stale + * items. + * + * Returns `undefined` if the item is stale, unless + * {@link LRUCache.OptionsBase.allowStale} is set. + */ + peek(k, peekOptions = {}) { + const { allowStale = this.allowStale } = peekOptions; + const index = this.#keyMap.get(k); + if (index === undefined || + (!allowStale && this.#isStale(index))) { + return; + } + 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(); + const { signal } = options; + // when/if our AC signals, then stop listening to theirs. + signal?.addEventListener('abort', () => ac.abort(signal.reason), { + signal: ac.signal, + }); + 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 + const bf = p; + if (this.#valList[index] === p) { + if (v === undefined) { + if (bf.__staleWhileFetching) { + this.#valList[index] = bf.__staleWhileFetching; + } + else { + this.#delete(k, 'fetch'); + } + } + 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; + const bf = p; + 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 || bf.__staleWhileFetching === undefined; + if (del) { + this.#delete(k, 'fetch'); + } + 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] = bf.__staleWhileFetching; + } + } + if (allowStale) { + if (options.status && bf.__staleWhileFetching !== undefined) { + options.status.returnedStale = true; + } + return bf.__staleWhileFetching; + } + else if (bf.__returned === bf) { + throw er; + } + }; + const pcall = (res, rej) => { + const fmp = this.#fetchMethod?.(k, v, fetchOpts); + if (fmp && fmp instanceof Promise) { + fmp.then(v => res(v === undefined ? undefined : 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(undefined); + // 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); + const bf = Object.assign(p, { + __abortController: ac, + __staleWhileFetching: v, + __returned: undefined, + }); + if (index === undefined) { + // internal, don't expose status. + this.set(k, bf, { ...fetchOpts.options, status: undefined }); + index = this.#keyMap.get(k); + } + else { + this.#valList[index] = bf; + } + return bf; + } + #isBackgroundFetch(p) { + if (!this.#hasFetchMethod) + return false; + const b = p; + return (!!b && + b instanceof Promise && + b.hasOwnProperty('__staleWhileFetching') && + b.__abortController instanceof AC); + } + async fetch(k, fetchOptions = {}) { + const { + // 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, context, forceRefresh = false, status, signal, } = fetchOptions; + if (!this.#hasFetchMethod) { + 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, context); + 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); + } + if (status) + 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, context); + const hasStale = p.__staleWhileFetching !== undefined; + const staleVal = hasStale && allowStale; + if (status) { + status.fetch = isStale ? 'stale' : 'refresh'; + if (staleVal && isStale) + status.returnedStale = true; + } + return staleVal ? p.__staleWhileFetching : (p.__returned = p); + } + } + async forceFetch(k, fetchOptions = {}) { + const v = await this.fetch(k, fetchOptions); + if (v === undefined) + throw new Error('fetch() returned undefined'); + return v; + } + memo(k, memoOptions = {}) { + const memoMethod = this.#memoMethod; + if (!memoMethod) { + throw new Error('no memoMethod provided to constructor'); + } + const { context, forceRefresh, ...options } = memoOptions; + const v = this.get(k, options); + if (!forceRefresh && v !== undefined) + return v; + const vv = memoMethod(k, v, { + options, + context, + }); + this.set(k, vv, options); + return vv; + } + /** + * Return a value from the cache. Will update the recency of the cache + * entry found. + * + * If the key is not found, get() will return `undefined`. + */ + get(k, getOptions = {}) { + const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status, } = getOptions; + const index = this.#keyMap.get(k); + if (index !== undefined) { + const value = this.#valList[index]; + const fetching = this.#isBackgroundFetch(value); + if (status) + 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, 'expire'); + } + if (status && allowStale) + status.returnedStale = true; + return allowStale ? value : undefined; + } + else { + if (status && + allowStale && + value.__staleWhileFetching !== undefined) { + status.returnedStale = true; + } + 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; + } + } + /** + * Deletes a key out of the cache. + * + * Returns true if the key was deleted, false otherwise. + */ + delete(k) { + return this.#delete(k, 'delete'); + } + #delete(k, reason) { + let deleted = false; + if (this.#size !== 0) { + const index = this.#keyMap.get(k); + if (index !== undefined) { + deleted = true; + if (this.#size === 1) { + this.#clear(reason); + } + else { + this.#removeItemSize(index); + const v = this.#valList[index]; + if (this.#isBackgroundFetch(v)) { + v.__abortController.abort(new Error('deleted')); + } + else if (this.#hasDispose || this.#hasDisposeAfter) { + if (this.#hasDispose) { + this.#dispose?.(v, k, reason); + } + if (this.#hasDisposeAfter) { + this.#disposed?.push([v, k, reason]); + } + } + this.#keyMap.delete(k); + this.#keyList[index] = undefined; + this.#valList[index] = undefined; + if (index === this.#tail) { + this.#tail = this.#prev[index]; + } + else if (index === this.#head) { + this.#head = this.#next[index]; + } + else { + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; + } + this.#size--; + this.#free.push(index); + } + } + } + if (this.#hasDisposeAfter && this.#disposed?.length) { + const dt = this.#disposed; + let task; + while ((task = dt?.shift())) { + this.#disposeAfter?.(...task); + } + } + return deleted; + } + /** + * Clear the cache entirely, throwing away all values. + */ + clear() { + return this.#clear('delete'); + } + #clear(reason) { + 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]; + if (this.#hasDispose) { + this.#dispose?.(v, k, reason); + } + if (this.#hasDisposeAfter) { + this.#disposed?.push([v, k, reason]); + } + } + } + this.#keyMap.clear(); + this.#valList.fill(undefined); + this.#keyList.fill(undefined); + if (this.#ttls && this.#starts) { + this.#ttls.fill(0); + this.#starts.fill(0); + } + if (this.#sizes) { + this.#sizes.fill(0); + } + this.#head = 0; + this.#tail = 0; + this.#free.length = 0; + this.#calculatedSize = 0; + this.#size = 0; + if (this.#hasDisposeAfter && this.#disposed) { + const dt = this.#disposed; + let task; + while ((task = dt?.shift())) { + this.#disposeAfter?.(...task); + } + } + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/lru-cache/dist/esm/index.min.js b/node_modules/npm/node_modules/lru-cache/dist/esm/index.min.js new file mode 100644 index 00000000..4571d025 --- /dev/null +++ b/node_modules/npm/node_modules/lru-cache/dist/esm/index.min.js @@ -0,0 +1,2 @@ +var G=(l,t,e)=>{if(!t.has(l))throw TypeError("Cannot "+e)};var I=(l,t,e)=>(G(l,t,"read from private field"),e?e.call(l):t.get(l)),j=(l,t,e)=>{if(t.has(l))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(l):t.set(l,e)},x=(l,t,e,i)=>(G(l,t,"write to private field"),i?i.call(l,e):t.set(l,e),e);var T=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,P=new Set,M=typeof process=="object"&&process?process:{},H=(l,t,e,i)=>{typeof M.emitWarning=="function"?M.emitWarning(l,t,e,i):console.error(`[${e}] ${t}: ${l}`)},W=globalThis.AbortController,N=globalThis.AbortSignal;if(typeof W>"u"){N=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,s){this._onabort.push(s)}},W=class{constructor(){t()}signal=new N;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i)}}};let l=M.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{l&&(l=!1,H("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var V=l=>!P.has(l),Y=Symbol("type"),A=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),k=l=>A(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?O:null:null,O=class extends Array{constructor(t){super(t),this.fill(0)}},z,E=class{heap;length;static create(t){let e=k(t);if(!e)return[];x(E,z,!0);let i=new E(t,e);return x(E,z,!1),i}constructor(t,e){if(!I(E,z))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},R=E;z=new WeakMap,j(R,z,!1);var D=class{#g;#f;#p;#w;#R;#W;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#S;#s;#i;#t;#l;#c;#o;#h;#_;#r;#m;#b;#u;#y;#O;#a;static unsafeExposeInternals(t){return{starts:t.#b,ttls:t.#u,sizes:t.#m,keyMap:t.#s,keyList:t.#i,valList:t.#t,next:t.#l,prev:t.#c,get head(){return t.#o},get tail(){return t.#h},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,n)=>t.#x(e,i,s,n),moveToTail:e=>t.#C(e),indexes:e=>t.#A(e),rindexes:e=>t.#F(e),isStale:e=>t.#d(e)}}get max(){return this.#g}get maxSize(){return this.#f}get calculatedSize(){return this.#S}get size(){return this.#n}get fetchMethod(){return this.#R}get memoMethod(){return this.#W}get dispose(){return this.#p}get disposeAfter(){return this.#w}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:h,updateAgeOnHas:o,allowStale:r,dispose:g,disposeAfter:m,noDisposeOnSet:f,noUpdateTTL:u,maxSize:c=0,maxEntrySize:F=0,sizeCalculation:d,fetchMethod:S,memoMethod:a,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:_,ignoreFetchAbort:v}=t;if(e!==0&&!A(e))throw new TypeError("max option must be a nonnegative integer");let y=e?k(e):Array;if(!y)throw new Error("invalid max value: "+e);if(this.#g=e,this.#f=c,this.maxEntrySize=F||this.#f,this.sizeCalculation=d,this.sizeCalculation){if(!this.#f&&!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")}if(a!==void 0&&typeof a!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#W=a,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#R=S,this.#O=!!S,this.#s=new Map,this.#i=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new y(e),this.#c=new y(e),this.#o=0,this.#h=0,this.#_=R.create(e),this.#n=0,this.#S=0,typeof g=="function"&&(this.#p=g),typeof m=="function"?(this.#w=m,this.#r=[]):(this.#w=void 0,this.#r=void 0),this.#y=!!this.#p,this.#a=!!this.#w,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!u,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!p,this.allowStaleOnFetchAbort=!!_,this.ignoreFetchAbort=!!v,this.maxEntrySize!==0){if(this.#f!==0&&!A(this.#f))throw new TypeError("maxSize must be a positive integer if specified");if(!A(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#P()}if(this.allowStale=!!r,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!o,this.ttlResolution=A(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!A(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#M()}if(this.#g===0&&this.ttl===0&&this.#f===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#g&&!this.#f){let C="LRU_CACHE_UNBOUNDED";V(C)&&(P.add(C),H("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",C,D))}}getRemainingTTL(t){return this.#s.has(t)?1/0:0}#M(){let t=new O(this.#g),e=new O(this.#g);this.#u=t,this.#b=e,this.#U=(n,h,o=T.now())=>{if(e[n]=h!==0?o:0,t[n]=h,h!==0&&this.ttlAutopurge){let r=setTimeout(()=>{this.#d(n)&&this.#T(this.#i[n],"expire")},h+1);r.unref&&r.unref()}},this.#z=n=>{e[n]=t[n]!==0?T.now():0},this.#E=(n,h)=>{if(t[h]){let o=t[h],r=e[h];if(!o||!r)return;n.ttl=o,n.start=r,n.now=i||s();let g=n.now-r;n.remainingTTL=o-g}};let i=0,s=()=>{let n=T.now();if(this.ttlResolution>0){i=n;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref()}return n};this.getRemainingTTL=n=>{let h=this.#s.get(n);if(h===void 0)return 0;let o=t[h],r=e[h];if(!o||!r)return 1/0;let g=(i||s())-r;return o-g},this.#d=n=>{let h=e[n],o=t[n];return!!o&&!!h&&(i||s())-h>o}}#z=()=>{};#E=()=>{};#U=()=>{};#d=()=>!1;#P(){let t=new O(this.#g);this.#S=0,this.#m=t,this.#v=e=>{this.#S-=t[e],t[e]=0},this.#G=(e,i,s,n)=>{if(this.#e(i))return 0;if(!A(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,e),!A(s))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 s},this.#D=(e,i,s)=>{if(t[e]=i,this.#f){let n=this.#f-t[e];for(;this.#S>n;)this.#L(!0)}this.#S+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#S)}}#v=t=>{};#D=(t,e,i)=>{};#G=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#A({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#h;!(!this.#I(e)||((t||!this.#d(e))&&(yield e),e===this.#o));)e=this.#c[e]}*#F({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#o;!(!this.#I(e)||((t||!this.#d(e))&&(yield e),e===this.#h));)e=this.#l[e]}#I(t){return t!==void 0&&this.#s.get(this.#i[t])===t}*entries(){for(let t of this.#A())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*rentries(){for(let t of this.#F())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*keys(){for(let t of this.#A()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*rkeys(){for(let t of this.#F()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*values(){for(let t of this.#A())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}*rvalues(){for(let t of this.#F())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,this.#i[i],this))return this.get(this.#i[i],e)}}forEach(t,e=this){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}rforEach(t,e=this){for(let i of this.#F()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}purgeStale(){let t=!1;for(let e of this.#F({allowStale:!0}))this.#d(e)&&(this.#T(this.#i[e],"expire"),t=!0);return t}info(t){let e=this.#s.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#u&&this.#b){let h=this.#u[e],o=this.#b[e];if(h&&o){let r=h-(T.now()-o);n.ttl=r,n.start=Date.now()}}return this.#m&&(n.size=this.#m[e]),n}dump(){let t=[];for(let e of this.#A({allowStale:!0})){let i=this.#i[e],s=this.#t[e],n=this.#e(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let h={value:n};if(this.#u&&this.#b){h.ttl=this.#u[e];let o=T.now()-this.#b[e];h.start=Math.floor(Date.now()-o)}this.#m&&(h.size=this.#m[e]),t.unshift([i,h])}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=T.now()-s}this.set(e,i.value,i)}}set(t,e,i={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:r}=i,{noUpdateTTL:g=this.noUpdateTTL}=i,m=this.#G(t,e,i.size||0,o);if(this.maxEntrySize&&m>this.maxEntrySize)return r&&(r.set="miss",r.maxEntrySizeExceeded=!0),this.#T(t,"set"),this;let f=this.#n===0?void 0:this.#s.get(t);if(f===void 0)f=this.#n===0?this.#h:this.#_.length!==0?this.#_.pop():this.#n===this.#g?this.#L(!1):this.#n,this.#i[f]=t,this.#t[f]=e,this.#s.set(t,f),this.#l[this.#h]=f,this.#c[f]=this.#h,this.#h=f,this.#n++,this.#D(f,m,r),r&&(r.set="add"),g=!1;else{this.#C(f);let u=this.#t[f];if(e!==u){if(this.#O&&this.#e(u)){u.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:c}=u;c!==void 0&&!h&&(this.#y&&this.#p?.(c,t,"set"),this.#a&&this.#r?.push([c,t,"set"]))}else h||(this.#y&&this.#p?.(u,t,"set"),this.#a&&this.#r?.push([u,t,"set"]));if(this.#v(f),this.#D(f,m,r),this.#t[f]=e,r){r.set="replace";let c=u&&this.#e(u)?u.__staleWhileFetching:u;c!==void 0&&(r.oldValue=c)}}else r&&(r.set="update")}if(s!==0&&!this.#u&&this.#M(),this.#u&&(g||this.#U(f,s,n),r&&this.#E(r,f)),!h&&this.#a&&this.#r){let u=this.#r,c;for(;c=u?.shift();)this.#w?.(...c)}return this}pop(){try{for(;this.#n;){let t=this.#t[this.#o];if(this.#L(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#a&&this.#r){let t=this.#r,e;for(;e=t?.shift();)this.#w?.(...e)}}}#L(t){let e=this.#o,i=this.#i[e],s=this.#t[e];return this.#O&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#y||this.#a)&&(this.#y&&this.#p?.(s,i,"evict"),this.#a&&this.#r?.push([s,i,"evict"])),this.#v(e),t&&(this.#i[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#n===1?(this.#o=this.#h=0,this.#_.length=0):this.#o=this.#l[e],this.#s.delete(i),this.#n--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,n=this.#s.get(t);if(n!==void 0){let h=this.#t[n];if(this.#e(h)&&h.__staleWhileFetching===void 0)return!1;if(this.#d(n))s&&(s.has="stale",this.#E(s,n));else return i&&this.#z(n),s&&(s.has="hit",this.#E(s,n)),!0}else s&&(s.has="miss");return!1}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#s.get(t);if(s===void 0||!i&&this.#d(s))return;let n=this.#t[s];return this.#e(n)?n.__staleWhileFetching:n}#x(t,e,i,s){let n=e===void 0?void 0:this.#t[e];if(this.#e(n))return n;let h=new W,{signal:o}=i;o?.addEventListener("abort",()=>h.abort(o.reason),{signal:h.signal});let r={signal:h.signal,options:i,context:s},g=(d,S=!1)=>{let{aborted:a}=h.signal,w=i.ignoreFetchAbort&&d!==void 0;if(i.status&&(a&&!S?(i.status.fetchAborted=!0,i.status.fetchError=h.signal.reason,w&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),a&&!w&&!S)return f(h.signal.reason);let b=c;return this.#t[e]===c&&(d===void 0?b.__staleWhileFetching?this.#t[e]=b.__staleWhileFetching:this.#T(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,d,r.options))),d},m=d=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=d),f(d)),f=d=>{let{aborted:S}=h.signal,a=S&&i.allowStaleOnFetchAbort,w=a||i.allowStaleOnFetchRejection,b=w||i.noDeleteOnFetchRejection,p=c;if(this.#t[e]===c&&(!b||p.__staleWhileFetching===void 0?this.#T(t,"fetch"):a||(this.#t[e]=p.__staleWhileFetching)),w)return i.status&&p.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),p.__staleWhileFetching;if(p.__returned===p)throw d},u=(d,S)=>{let a=this.#R?.(t,n,r);a&&a instanceof Promise&&a.then(w=>d(w===void 0?void 0:w),S),h.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(d(void 0),i.allowStaleOnFetchAbort&&(d=w=>g(w,!0)))})};i.status&&(i.status.fetchDispatched=!0);let c=new Promise(u).then(g,m),F=Object.assign(c,{__abortController:h,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,F,{...r.options,status:void 0}),e=this.#s.get(t)):this.#t[e]=F,F}#e(t){if(!this.#O)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof W}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:r=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:m=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:c=this.ignoreFetchAbort,allowStaleOnFetchAbort:F=this.allowStaleOnFetchAbort,context:d,forceRefresh:S=!1,status:a,signal:w}=e;if(!this.#O)return a&&(a.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:a});let b={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:h,noDisposeOnSet:o,size:r,sizeCalculation:g,noUpdateTTL:m,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:F,ignoreFetchAbort:c,status:a,signal:w},p=this.#s.get(t);if(p===void 0){a&&(a.fetch="miss");let _=this.#x(t,p,b,d);return _.__returned=_}else{let _=this.#t[p];if(this.#e(_)){let U=i&&_.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",U&&(a.returnedStale=!0)),U?_.__staleWhileFetching:_.__returned=_}let v=this.#d(p);if(!S&&!v)return a&&(a.fetch="hit"),this.#C(p),s&&this.#z(p),a&&this.#E(a,p),_;let y=this.#x(t,p,b,d),L=y.__staleWhileFetching!==void 0&&i;return a&&(a.fetch=v?"stale":"refresh",L&&v&&(a.returnedStale=!0)),L?y.__staleWhileFetching:y.__returned=y}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#W;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...h}=e,o=this.get(t,h);if(!n&&o!==void 0)return o;let r=i(t,o,{options:h,context:s});return this.set(t,r,h),r}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:h}=e,o=this.#s.get(t);if(o!==void 0){let r=this.#t[o],g=this.#e(r);return h&&this.#E(h,o),this.#d(o)?(h&&(h.get="stale"),g?(h&&i&&r.__staleWhileFetching!==void 0&&(h.returnedStale=!0),i?r.__staleWhileFetching:void 0):(n||this.#T(t,"expire"),h&&i&&(h.returnedStale=!0),i?r:void 0)):(h&&(h.get="hit"),g?r.__staleWhileFetching:(this.#C(o),s&&this.#z(o),r))}else h&&(h.get="miss")}#j(t,e){this.#c[e]=t,this.#l[t]=e}#C(t){t!==this.#h&&(t===this.#o?this.#o=this.#l[t]:this.#j(this.#c[t],this.#l[t]),this.#j(this.#h,t),this.#h=t)}delete(t){return this.#T(t,"delete")}#T(t,e){let i=!1;if(this.#n!==0){let s=this.#s.get(t);if(s!==void 0)if(i=!0,this.#n===1)this.#N(e);else{this.#v(s);let n=this.#t[s];if(this.#e(n)?n.__abortController.abort(new Error("deleted")):(this.#y||this.#a)&&(this.#y&&this.#p?.(n,t,e),this.#a&&this.#r?.push([n,t,e])),this.#s.delete(t),this.#i[s]=void 0,this.#t[s]=void 0,s===this.#h)this.#h=this.#c[s];else if(s===this.#o)this.#o=this.#l[s];else{let h=this.#c[s];this.#l[h]=this.#l[s];let o=this.#l[s];this.#c[o]=this.#c[s]}this.#n--,this.#_.push(s)}}if(this.#a&&this.#r?.length){let s=this.#r,n;for(;n=s?.shift();)this.#w?.(...n)}return i}clear(){return this.#N("delete")}#N(t){for(let e of this.#F({allowStale:!0})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#i[e];this.#y&&this.#p?.(i,s,t),this.#a&&this.#r?.push([i,s,t])}}if(this.#s.clear(),this.#t.fill(void 0),this.#i.fill(void 0),this.#u&&this.#b&&(this.#u.fill(0),this.#b.fill(0)),this.#m&&this.#m.fill(0),this.#o=0,this.#h=0,this.#_.length=0,this.#S=0,this.#n=0,this.#a&&this.#r){let e=this.#r,i;for(;i=e?.shift();)this.#w?.(...i)}}};export{D as LRUCache}; +//# sourceMappingURL=index.min.js.map diff --git a/node_modules/npm/node_modules/lru-cache/dist/esm/package.json b/node_modules/npm/node_modules/lru-cache/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/lru-cache/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/lru-cache/package.json b/node_modules/npm/node_modules/lru-cache/package.json new file mode 100644 index 00000000..f3cd4c0c --- /dev/null +++ b/node_modules/npm/node_modules/lru-cache/package.json @@ -0,0 +1,116 @@ +{ + "name": "lru-cache", + "publishConfig": { + "tag": "legacy-v10" + }, + "description": "A cache object that deletes the least-recently-used items.", + "version": "10.4.3", + "author": "Isaac Z. Schlueter ", + "keywords": [ + "mru", + "lru", + "cache" + ], + "sideEffects": false, + "scripts": { + "build": "npm run prepare", + "prepare": "tshy && bash fixup.sh", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "test": "tap", + "snap": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write .", + "typedoc": "typedoc --tsconfig ./.tshy/esm.json ./src/*.ts", + "benchmark-results-typedoc": "bash scripts/benchmark-results-typedoc.sh", + "prebenchmark": "npm run prepare", + "benchmark": "make -C benchmark", + "preprofile": "npm run prepare", + "profile": "make -C benchmark profile" + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "tshy": { + "exports": { + ".": "./src/index.ts", + "./min": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.min.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.min.js" + } + } + } + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-lru-cache.git" + }, + "devDependencies": { + "@types/node": "^20.2.5", + "@types/tap": "^15.0.6", + "benchmark": "^2.1.4", + "esbuild": "^0.17.11", + "eslint-config-prettier": "^8.5.0", + "marked": "^4.2.12", + "mkdirp": "^2.1.5", + "prettier": "^2.6.2", + "tap": "^20.0.3", + "tshy": "^2.0.0", + "tslib": "^2.4.0", + "typedoc": "^0.25.3", + "typescript": "^5.2.2" + }, + "license": "ISC", + "files": [ + "dist" + ], + "prettier": { + "semi": false, + "printWidth": 70, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "tap": { + "node-arg": [ + "--expose-gc" + ], + "plugin": [ + "@tapjs/clock" + ] + }, + "exports": { + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./min": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.min.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.min.js" + } + } + }, + "type": "module", + "module": "./dist/esm/index.js" +} diff --git a/node_modules/npm/node_modules/make-fetch-happen/LICENSE b/node_modules/npm/node_modules/make-fetch-happen/LICENSE new file mode 100644 index 00000000..1808eb28 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/LICENSE @@ -0,0 +1,16 @@ +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/npm/node_modules/make-fetch-happen/lib/cache/entry.js b/node_modules/npm/node_modules/make-fetch-happen/lib/cache/entry.js new file mode 100644 index 00000000..bfcfacbc --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/lib/cache/entry.js @@ -0,0 +1,471 @@ +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) + } + } + + for (const name of options.cacheAdditionalHeaders) { + 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 + }).catch((err) => { + body.emit('error', err) + }) + + 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] + } + } + + 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, + 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/npm/node_modules/make-fetch-happen/lib/cache/errors.js b/node_modules/npm/node_modules/make-fetch-happen/lib/cache/errors.js new file mode 100644 index 00000000..67a66573 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/lib/cache/errors.js @@ -0,0 +1,11 @@ +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/npm/node_modules/make-fetch-happen/lib/cache/index.js b/node_modules/npm/node_modules/make-fetch-happen/lib/cache/index.js new file mode 100644 index 00000000..0de49d23 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/lib/cache/index.js @@ -0,0 +1,49 @@ +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/npm/node_modules/make-fetch-happen/lib/cache/key.js b/node_modules/npm/node_modules/make-fetch-happen/lib/cache/key.js new file mode 100644 index 00000000..f7684d56 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/lib/cache/key.js @@ -0,0 +1,17 @@ +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/npm/node_modules/make-fetch-happen/lib/cache/policy.js b/node_modules/npm/node_modules/make-fetch-happen/lib/cache/policy.js new file mode 100644 index 00000000..ada3c860 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/lib/cache/policy.js @@ -0,0 +1,161 @@ +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/npm/node_modules/make-fetch-happen/lib/fetch.js b/node_modules/npm/node_modules/make-fetch-happen/lib/fetch.js new file mode 100644 index 00000000..233ba67e --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/lib/fetch.js @@ -0,0 +1,118 @@ +'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/npm/node_modules/make-fetch-happen/lib/index.js b/node_modules/npm/node_modules/make-fetch-happen/lib/index.js new file mode 100644 index 00000000..2f12e8e1 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/lib/index.js @@ -0,0 +1,41 @@ +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/npm/node_modules/make-fetch-happen/lib/options.js b/node_modules/npm/node_modules/make-fetch-happen/lib/options.js new file mode 100644 index 00000000..db51cc63 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/lib/options.js @@ -0,0 +1,59 @@ +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' + + if (strictSSL === undefined || strictSSL === null) { + options.rejectUnauthorized = process.env.NODE_TLS_REJECT_UNAUTHORIZED !== '0' + } else { + 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' + } + } + + 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) { + options.cachePath = options.cacheManager + } + + return options +} + +module.exports = configureOptions diff --git a/node_modules/npm/node_modules/make-fetch-happen/lib/pipeline.js b/node_modules/npm/node_modules/make-fetch-happen/lib/pipeline.js new file mode 100644 index 00000000..b1d221b2 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/lib/pipeline.js @@ -0,0 +1,41 @@ +'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/npm/node_modules/make-fetch-happen/lib/remote.js b/node_modules/npm/node_modules/make-fetch-happen/lib/remote.js new file mode 100644 index 00000000..1d640e53 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/lib/remote.js @@ -0,0 +1,132 @@ +const { Minipass } = require('minipass') +const fetch = require('minipass-fetch') +const promiseRetry = require('promise-retry') +const ssri = require('ssri') +const { log } = require('proc-log') + +const CachingMinipassPipeline = require('./pipeline.js') +const { getAgent } = require('@npmcli/agent') +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 + // from @npmcli/agent + 'ECONNECTIONTIMEOUT', + 'EIDLETIMEOUT', + 'ERESPONSETIMEOUT', + 'ETRANSFERTIMEOUT', + // Known codes we do NOT retry on: + // ENOTFOUND (getaddrinfo failure. Either bad hostname, or offline) + // EINVALIDPROXY // invalid protocol from @npmcli/agent + // EINVALIDRESPONSE // invalid status code from @npmcli/agent +] + +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) => { + // options.signal is intended for the fetch itself, not the agent. Attaching it to the agent will re-use that signal across multiple requests, which prevents any connections beyond the first one. + const agent = getAgent(request.url, { ...options, signal: undefined }) + 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) + } + + /* eslint-disable-next-line max-len */ + log.http('fetch', `${req.method} ${req.url} attempt ${attemptNum} failed with ${res.status}`) + 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) + } + + log.http('fetch', `${req.method} ${req.url} attempt ${attemptNum} failed with ${err.code}`) + 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/npm/node_modules/make-fetch-happen/node_modules/negotiator/HISTORY.md b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/HISTORY.md new file mode 100644 index 00000000..63d537d3 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/HISTORY.md @@ -0,0 +1,114 @@ +1.0.0 / 2024-08-31 +================== + + * Drop support for node <18 + * Added an option preferred encodings array #59 + +0.6.3 / 2022-01-22 +================== + + * Revert "Lazy-load modules from main entry point" + +0.6.2 / 2019-04-29 +================== + + * Fix sorting charset, encoding, and language with extra parameters + +0.6.1 / 2016-05-02 +================== + + * perf: improve `Accept` parsing speed + * perf: improve `Accept-Charset` parsing speed + * perf: improve `Accept-Encoding` parsing speed + * perf: improve `Accept-Language` parsing speed + +0.6.0 / 2015-09-29 +================== + + * Fix including type extensions in parameters in `Accept` parsing + * Fix parsing `Accept` parameters with quoted equals + * Fix parsing `Accept` parameters with quoted semicolons + * Lazy-load modules from main entry point + * perf: delay type concatenation until needed + * perf: enable strict mode + * perf: hoist regular expressions + * perf: remove closures getting spec properties + * perf: remove a closure from media type parsing + * perf: remove property delete from media type parsing + +0.5.3 / 2015-05-10 +================== + + * Fix media type parameter matching to be case-insensitive + +0.5.2 / 2015-05-06 +================== + + * Fix comparing media types with quoted values + * Fix splitting media types with quoted commas + +0.5.1 / 2015-02-14 +================== + + * Fix preference sorting to be stable for long acceptable lists + +0.5.0 / 2014-12-18 +================== + + * Fix list return order when large accepted list + * Fix missing identity encoding when q=0 exists + * Remove dynamic building of Negotiator class + +0.4.9 / 2014-10-14 +================== + + * Fix error when media type has invalid parameter + +0.4.8 / 2014-09-28 +================== + + * Fix all negotiations to be case-insensitive + * Stable sort preferences of same quality according to client order + * Support Node.js 0.6 + +0.4.7 / 2014-06-24 +================== + + * Handle invalid provided languages + * Handle invalid provided media types + +0.4.6 / 2014-06-11 +================== + + * Order by specificity when quality is the same + +0.4.5 / 2014-05-29 +================== + + * Fix regression in empty header handling + +0.4.4 / 2014-05-29 +================== + + * Fix behaviors when headers are not present + +0.4.3 / 2014-04-16 +================== + + * Handle slashes on media params correctly + +0.4.2 / 2014-02-28 +================== + + * Fix media type sorting + * Handle media types params strictly + +0.4.1 / 2014-01-16 +================== + + * Use most specific matches + +0.4.0 / 2014-01-09 +================== + + * Remove preferred prefix from methods diff --git a/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/LICENSE b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/LICENSE new file mode 100644 index 00000000..ea6b9e2e --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012-2014 Federico Romero +Copyright (c) 2012-2014 Isaac Z. Schlueter +Copyright (c) 2014-2015 Douglas Christopher Wilson + +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/npm/node_modules/make-fetch-happen/node_modules/negotiator/index.js b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/index.js new file mode 100644 index 00000000..4f51315d --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/index.js @@ -0,0 +1,83 @@ +/*! + * negotiator + * Copyright(c) 2012 Federico Romero + * Copyright(c) 2012-2014 Isaac Z. Schlueter + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +var preferredCharsets = require('./lib/charset') +var preferredEncodings = require('./lib/encoding') +var preferredLanguages = require('./lib/language') +var preferredMediaTypes = require('./lib/mediaType') + +/** + * Module exports. + * @public + */ + +module.exports = Negotiator; +module.exports.Negotiator = Negotiator; + +/** + * Create a Negotiator instance from a request. + * @param {object} request + * @public + */ + +function Negotiator(request) { + if (!(this instanceof Negotiator)) { + return new Negotiator(request); + } + + this.request = request; +} + +Negotiator.prototype.charset = function charset(available) { + var set = this.charsets(available); + return set && set[0]; +}; + +Negotiator.prototype.charsets = function charsets(available) { + return preferredCharsets(this.request.headers['accept-charset'], available); +}; + +Negotiator.prototype.encoding = function encoding(available, opts) { + var set = this.encodings(available, opts); + return set && set[0]; +}; + +Negotiator.prototype.encodings = function encodings(available, options) { + var opts = options || {}; + return preferredEncodings(this.request.headers['accept-encoding'], available, opts.preferred); +}; + +Negotiator.prototype.language = function language(available) { + var set = this.languages(available); + return set && set[0]; +}; + +Negotiator.prototype.languages = function languages(available) { + return preferredLanguages(this.request.headers['accept-language'], available); +}; + +Negotiator.prototype.mediaType = function mediaType(available) { + var set = this.mediaTypes(available); + return set && set[0]; +}; + +Negotiator.prototype.mediaTypes = function mediaTypes(available) { + return preferredMediaTypes(this.request.headers.accept, available); +}; + +// Backwards compatibility +Negotiator.prototype.preferredCharset = Negotiator.prototype.charset; +Negotiator.prototype.preferredCharsets = Negotiator.prototype.charsets; +Negotiator.prototype.preferredEncoding = Negotiator.prototype.encoding; +Negotiator.prototype.preferredEncodings = Negotiator.prototype.encodings; +Negotiator.prototype.preferredLanguage = Negotiator.prototype.language; +Negotiator.prototype.preferredLanguages = Negotiator.prototype.languages; +Negotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType; +Negotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes; diff --git a/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/charset.js b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/charset.js new file mode 100644 index 00000000..cdd01480 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/charset.js @@ -0,0 +1,169 @@ +/** + * negotiator + * Copyright(c) 2012 Isaac Z. Schlueter + * Copyright(c) 2014 Federico Romero + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = preferredCharsets; +module.exports.preferredCharsets = preferredCharsets; + +/** + * Module variables. + * @private + */ + +var simpleCharsetRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/; + +/** + * Parse the Accept-Charset header. + * @private + */ + +function parseAcceptCharset(accept) { + var accepts = accept.split(','); + + for (var i = 0, j = 0; i < accepts.length; i++) { + var charset = parseCharset(accepts[i].trim(), i); + + if (charset) { + accepts[j++] = charset; + } + } + + // trim accepts + accepts.length = j; + + return accepts; +} + +/** + * Parse a charset from the Accept-Charset header. + * @private + */ + +function parseCharset(str, i) { + var match = simpleCharsetRegExp.exec(str); + if (!match) return null; + + var charset = match[1]; + var q = 1; + if (match[2]) { + var params = match[2].split(';') + for (var j = 0; j < params.length; j++) { + var p = params[j].trim().split('='); + if (p[0] === 'q') { + q = parseFloat(p[1]); + break; + } + } + } + + return { + charset: charset, + q: q, + i: i + }; +} + +/** + * Get the priority of a charset. + * @private + */ + +function getCharsetPriority(charset, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + + for (var i = 0; i < accepted.length; i++) { + var spec = specify(charset, accepted[i], index); + + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + + return priority; +} + +/** + * Get the specificity of the charset. + * @private + */ + +function specify(charset, spec, index) { + var s = 0; + if(spec.charset.toLowerCase() === charset.toLowerCase()){ + s |= 1; + } else if (spec.charset !== '*' ) { + return null + } + + return { + i: index, + o: spec.i, + q: spec.q, + s: s + } +} + +/** + * Get the preferred charsets from an Accept-Charset header. + * @public + */ + +function preferredCharsets(accept, provided) { + // RFC 2616 sec 14.2: no header = * + var accepts = parseAcceptCharset(accept === undefined ? '*' : accept || ''); + + if (!provided) { + // sorted list of all charsets + return accepts + .filter(isQuality) + .sort(compareSpecs) + .map(getFullCharset); + } + + var priorities = provided.map(function getPriority(type, index) { + return getCharsetPriority(type, accepts, index); + }); + + // sorted list of accepted charsets + return priorities.filter(isQuality).sort(compareSpecs).map(function getCharset(priority) { + return provided[priorities.indexOf(priority)]; + }); +} + +/** + * Compare two specs. + * @private + */ + +function compareSpecs(a, b) { + return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0; +} + +/** + * Get full charset string. + * @private + */ + +function getFullCharset(spec) { + return spec.charset; +} + +/** + * Check if a spec has any quality. + * @private + */ + +function isQuality(spec) { + return spec.q > 0; +} diff --git a/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/encoding.js b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/encoding.js new file mode 100644 index 00000000..9ebb633d --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/encoding.js @@ -0,0 +1,205 @@ +/** + * negotiator + * Copyright(c) 2012 Isaac Z. Schlueter + * Copyright(c) 2014 Federico Romero + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = preferredEncodings; +module.exports.preferredEncodings = preferredEncodings; + +/** + * Module variables. + * @private + */ + +var simpleEncodingRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/; + +/** + * Parse the Accept-Encoding header. + * @private + */ + +function parseAcceptEncoding(accept) { + var accepts = accept.split(','); + var hasIdentity = false; + var minQuality = 1; + + for (var i = 0, j = 0; i < accepts.length; i++) { + var encoding = parseEncoding(accepts[i].trim(), i); + + if (encoding) { + accepts[j++] = encoding; + hasIdentity = hasIdentity || specify('identity', encoding); + minQuality = Math.min(minQuality, encoding.q || 1); + } + } + + if (!hasIdentity) { + /* + * If identity doesn't explicitly appear in the accept-encoding header, + * it's added to the list of acceptable encoding with the lowest q + */ + accepts[j++] = { + encoding: 'identity', + q: minQuality, + i: i + }; + } + + // trim accepts + accepts.length = j; + + return accepts; +} + +/** + * Parse an encoding from the Accept-Encoding header. + * @private + */ + +function parseEncoding(str, i) { + var match = simpleEncodingRegExp.exec(str); + if (!match) return null; + + var encoding = match[1]; + var q = 1; + if (match[2]) { + var params = match[2].split(';'); + for (var j = 0; j < params.length; j++) { + var p = params[j].trim().split('='); + if (p[0] === 'q') { + q = parseFloat(p[1]); + break; + } + } + } + + return { + encoding: encoding, + q: q, + i: i + }; +} + +/** + * Get the priority of an encoding. + * @private + */ + +function getEncodingPriority(encoding, accepted, index) { + var priority = {encoding: encoding, o: -1, q: 0, s: 0}; + + for (var i = 0; i < accepted.length; i++) { + var spec = specify(encoding, accepted[i], index); + + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + + return priority; +} + +/** + * Get the specificity of the encoding. + * @private + */ + +function specify(encoding, spec, index) { + var s = 0; + if(spec.encoding.toLowerCase() === encoding.toLowerCase()){ + s |= 1; + } else if (spec.encoding !== '*' ) { + return null + } + + return { + encoding: encoding, + i: index, + o: spec.i, + q: spec.q, + s: s + } +}; + +/** + * Get the preferred encodings from an Accept-Encoding header. + * @public + */ + +function preferredEncodings(accept, provided, preferred) { + var accepts = parseAcceptEncoding(accept || ''); + + var comparator = preferred ? function comparator (a, b) { + if (a.q !== b.q) { + return b.q - a.q // higher quality first + } + + var aPreferred = preferred.indexOf(a.encoding) + var bPreferred = preferred.indexOf(b.encoding) + + if (aPreferred === -1 && bPreferred === -1) { + // consider the original specifity/order + return (b.s - a.s) || (a.o - b.o) || (a.i - b.i) + } + + if (aPreferred !== -1 && bPreferred !== -1) { + return aPreferred - bPreferred // consider the preferred order + } + + return aPreferred === -1 ? 1 : -1 // preferred first + } : compareSpecs; + + if (!provided) { + // sorted list of all encodings + return accepts + .filter(isQuality) + .sort(comparator) + .map(getFullEncoding); + } + + var priorities = provided.map(function getPriority(type, index) { + return getEncodingPriority(type, accepts, index); + }); + + // sorted list of accepted encodings + return priorities.filter(isQuality).sort(comparator).map(function getEncoding(priority) { + return provided[priorities.indexOf(priority)]; + }); +} + +/** + * Compare two specs. + * @private + */ + +function compareSpecs(a, b) { + return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i); +} + +/** + * Get full encoding string. + * @private + */ + +function getFullEncoding(spec) { + return spec.encoding; +} + +/** + * Check if a spec has any quality. + * @private + */ + +function isQuality(spec) { + return spec.q > 0; +} diff --git a/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/language.js b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/language.js new file mode 100644 index 00000000..a2316725 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/language.js @@ -0,0 +1,179 @@ +/** + * negotiator + * Copyright(c) 2012 Isaac Z. Schlueter + * Copyright(c) 2014 Federico Romero + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = preferredLanguages; +module.exports.preferredLanguages = preferredLanguages; + +/** + * Module variables. + * @private + */ + +var simpleLanguageRegExp = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/; + +/** + * Parse the Accept-Language header. + * @private + */ + +function parseAcceptLanguage(accept) { + var accepts = accept.split(','); + + for (var i = 0, j = 0; i < accepts.length; i++) { + var language = parseLanguage(accepts[i].trim(), i); + + if (language) { + accepts[j++] = language; + } + } + + // trim accepts + accepts.length = j; + + return accepts; +} + +/** + * Parse a language from the Accept-Language header. + * @private + */ + +function parseLanguage(str, i) { + var match = simpleLanguageRegExp.exec(str); + if (!match) return null; + + var prefix = match[1] + var suffix = match[2] + var full = prefix + + if (suffix) full += "-" + suffix; + + var q = 1; + if (match[3]) { + var params = match[3].split(';') + for (var j = 0; j < params.length; j++) { + var p = params[j].split('='); + if (p[0] === 'q') q = parseFloat(p[1]); + } + } + + return { + prefix: prefix, + suffix: suffix, + q: q, + i: i, + full: full + }; +} + +/** + * Get the priority of a language. + * @private + */ + +function getLanguagePriority(language, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + + for (var i = 0; i < accepted.length; i++) { + var spec = specify(language, accepted[i], index); + + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + + return priority; +} + +/** + * Get the specificity of the language. + * @private + */ + +function specify(language, spec, index) { + var p = parseLanguage(language) + if (!p) return null; + var s = 0; + if(spec.full.toLowerCase() === p.full.toLowerCase()){ + s |= 4; + } else if (spec.prefix.toLowerCase() === p.full.toLowerCase()) { + s |= 2; + } else if (spec.full.toLowerCase() === p.prefix.toLowerCase()) { + s |= 1; + } else if (spec.full !== '*' ) { + return null + } + + return { + i: index, + o: spec.i, + q: spec.q, + s: s + } +}; + +/** + * Get the preferred languages from an Accept-Language header. + * @public + */ + +function preferredLanguages(accept, provided) { + // RFC 2616 sec 14.4: no header = * + var accepts = parseAcceptLanguage(accept === undefined ? '*' : accept || ''); + + if (!provided) { + // sorted list of all languages + return accepts + .filter(isQuality) + .sort(compareSpecs) + .map(getFullLanguage); + } + + var priorities = provided.map(function getPriority(type, index) { + return getLanguagePriority(type, accepts, index); + }); + + // sorted list of accepted languages + return priorities.filter(isQuality).sort(compareSpecs).map(function getLanguage(priority) { + return provided[priorities.indexOf(priority)]; + }); +} + +/** + * Compare two specs. + * @private + */ + +function compareSpecs(a, b) { + return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0; +} + +/** + * Get full language string. + * @private + */ + +function getFullLanguage(spec) { + return spec.full; +} + +/** + * Check if a spec has any quality. + * @private + */ + +function isQuality(spec) { + return spec.q > 0; +} diff --git a/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/mediaType.js b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/mediaType.js new file mode 100644 index 00000000..8e402ea8 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/lib/mediaType.js @@ -0,0 +1,294 @@ +/** + * negotiator + * Copyright(c) 2012 Isaac Z. Schlueter + * Copyright(c) 2014 Federico Romero + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = preferredMediaTypes; +module.exports.preferredMediaTypes = preferredMediaTypes; + +/** + * Module variables. + * @private + */ + +var simpleMediaTypeRegExp = /^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/; + +/** + * Parse the Accept header. + * @private + */ + +function parseAccept(accept) { + var accepts = splitMediaTypes(accept); + + for (var i = 0, j = 0; i < accepts.length; i++) { + var mediaType = parseMediaType(accepts[i].trim(), i); + + if (mediaType) { + accepts[j++] = mediaType; + } + } + + // trim accepts + accepts.length = j; + + return accepts; +} + +/** + * Parse a media type from the Accept header. + * @private + */ + +function parseMediaType(str, i) { + var match = simpleMediaTypeRegExp.exec(str); + if (!match) return null; + + var params = Object.create(null); + var q = 1; + var subtype = match[2]; + var type = match[1]; + + if (match[3]) { + var kvps = splitParameters(match[3]).map(splitKeyValuePair); + + for (var j = 0; j < kvps.length; j++) { + var pair = kvps[j]; + var key = pair[0].toLowerCase(); + var val = pair[1]; + + // get the value, unwrapping quotes + var value = val && val[0] === '"' && val[val.length - 1] === '"' + ? val.slice(1, -1) + : val; + + if (key === 'q') { + q = parseFloat(value); + break; + } + + // store parameter + params[key] = value; + } + } + + return { + type: type, + subtype: subtype, + params: params, + q: q, + i: i + }; +} + +/** + * Get the priority of a media type. + * @private + */ + +function getMediaTypePriority(type, accepted, index) { + var priority = {o: -1, q: 0, s: 0}; + + for (var i = 0; i < accepted.length; i++) { + var spec = specify(type, accepted[i], index); + + if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { + priority = spec; + } + } + + return priority; +} + +/** + * Get the specificity of the media type. + * @private + */ + +function specify(type, spec, index) { + var p = parseMediaType(type); + var s = 0; + + if (!p) { + return null; + } + + if(spec.type.toLowerCase() == p.type.toLowerCase()) { + s |= 4 + } else if(spec.type != '*') { + return null; + } + + if(spec.subtype.toLowerCase() == p.subtype.toLowerCase()) { + s |= 2 + } else if(spec.subtype != '*') { + return null; + } + + var keys = Object.keys(spec.params); + if (keys.length > 0) { + if (keys.every(function (k) { + return spec.params[k] == '*' || (spec.params[k] || '').toLowerCase() == (p.params[k] || '').toLowerCase(); + })) { + s |= 1 + } else { + return null + } + } + + return { + i: index, + o: spec.i, + q: spec.q, + s: s, + } +} + +/** + * Get the preferred media types from an Accept header. + * @public + */ + +function preferredMediaTypes(accept, provided) { + // RFC 2616 sec 14.2: no header = */* + var accepts = parseAccept(accept === undefined ? '*/*' : accept || ''); + + if (!provided) { + // sorted list of all types + return accepts + .filter(isQuality) + .sort(compareSpecs) + .map(getFullType); + } + + var priorities = provided.map(function getPriority(type, index) { + return getMediaTypePriority(type, accepts, index); + }); + + // sorted list of accepted types + return priorities.filter(isQuality).sort(compareSpecs).map(function getType(priority) { + return provided[priorities.indexOf(priority)]; + }); +} + +/** + * Compare two specs. + * @private + */ + +function compareSpecs(a, b) { + return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0; +} + +/** + * Get full type string. + * @private + */ + +function getFullType(spec) { + return spec.type + '/' + spec.subtype; +} + +/** + * Check if a spec has any quality. + * @private + */ + +function isQuality(spec) { + return spec.q > 0; +} + +/** + * Count the number of quotes in a string. + * @private + */ + +function quoteCount(string) { + var count = 0; + var index = 0; + + while ((index = string.indexOf('"', index)) !== -1) { + count++; + index++; + } + + return count; +} + +/** + * Split a key value pair. + * @private + */ + +function splitKeyValuePair(str) { + var index = str.indexOf('='); + var key; + var val; + + if (index === -1) { + key = str; + } else { + key = str.slice(0, index); + val = str.slice(index + 1); + } + + return [key, val]; +} + +/** + * Split an Accept header into media types. + * @private + */ + +function splitMediaTypes(accept) { + var accepts = accept.split(','); + + for (var i = 1, j = 0; i < accepts.length; i++) { + if (quoteCount(accepts[j]) % 2 == 0) { + accepts[++j] = accepts[i]; + } else { + accepts[j] += ',' + accepts[i]; + } + } + + // trim accepts + accepts.length = j + 1; + + return accepts; +} + +/** + * Split a string of parameters. + * @private + */ + +function splitParameters(str) { + var parameters = str.split(';'); + + for (var i = 1, j = 0; i < parameters.length; i++) { + if (quoteCount(parameters[j]) % 2 == 0) { + parameters[++j] = parameters[i]; + } else { + parameters[j] += ';' + parameters[i]; + } + } + + // trim parameters + parameters.length = j + 1; + + for (var i = 0; i < parameters.length; i++) { + parameters[i] = parameters[i].trim(); + } + + return parameters; +} diff --git a/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/package.json b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/package.json new file mode 100644 index 00000000..e4bdc1ef --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/node_modules/negotiator/package.json @@ -0,0 +1,43 @@ +{ + "name": "negotiator", + "description": "HTTP content negotiation", + "version": "1.0.0", + "contributors": [ + "Douglas Christopher Wilson ", + "Federico Romero ", + "Isaac Z. Schlueter (http://blog.izs.me/)" + ], + "license": "MIT", + "keywords": [ + "http", + "content negotiation", + "accept", + "accept-language", + "accept-encoding", + "accept-charset" + ], + "repository": "jshttp/negotiator", + "devDependencies": { + "eslint": "7.32.0", + "eslint-plugin-markdown": "2.2.1", + "mocha": "9.1.3", + "nyc": "15.1.0" + }, + "files": [ + "lib/", + "HISTORY.md", + "LICENSE", + "index.js", + "README.md" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec --check-leaks --bail test/", + "test:debug": "mocha --reporter spec --check-leaks --inspect --inspect-brk test/", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/node_modules/npm/node_modules/make-fetch-happen/package.json b/node_modules/npm/node_modules/make-fetch-happen/package.json new file mode 100644 index 00000000..054fe841 --- /dev/null +++ b/node_modules/npm/node_modules/make-fetch-happen/package.json @@ -0,0 +1,74 @@ +{ + "name": "make-fetch-happen", + "version": "14.0.3", + "description": "Opinionated, caching, retrying fetch client", + "main": "lib/index.js", + "files": [ + "bin/", + "lib/" + ], + "scripts": { + "test": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", + "lint": "npm run eslint", + "lintfix": "npm run eslint -- --fix", + "postlint": "template-oss-check", + "snap": "tap", + "template-oss-apply": "template-oss-apply --force" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/make-fetch-happen.git" + }, + "keywords": [ + "http", + "request", + "fetch", + "mean girls", + "caching", + "cache", + "subresource integrity" + ], + "author": "GitHub Inc.", + "license": "ISC", + "dependencies": { + "@npmcli/agent": "^3.0.0", + "cacache": "^19.0.1", + "http-cache-semantics": "^4.1.1", + "minipass": "^7.0.2", + "minipass-fetch": "^4.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^1.0.0", + "proc-log": "^5.0.0", + "promise-retry": "^2.0.1", + "ssri": "^12.0.0" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.4", + "nock": "^13.2.4", + "safe-buffer": "^5.2.1", + "standard-version": "^9.3.2", + "tap": "^16.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "tap": { + "color": 1, + "files": "test/*.js", + "check-coverage": true, + "timeout": 60, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.4", + "publish": "true" + } +} diff --git a/node_modules/npm/node_modules/minimatch/LICENSE b/node_modules/npm/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..1493534e --- /dev/null +++ b/node_modules/npm/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js b/node_modules/npm/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js new file mode 100644 index 00000000..5fc86bbd --- /dev/null +++ b/node_modules/npm/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js @@ -0,0 +1,14 @@ +"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/npm/node_modules/minimatch/dist/commonjs/ast.js b/node_modules/npm/node_modules/minimatch/dist/commonjs/ast.js new file mode 100644 index 00000000..7b210962 --- /dev/null +++ b/node_modules/npm/node_modules/minimatch/dist/commonjs/ast.js @@ -0,0 +1,592 @@ +"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, + }); + } + get options() { + return this.#options; + } + // 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/npm/node_modules/minimatch/dist/commonjs/brace-expressions.js b/node_modules/npm/node_modules/minimatch/dist/commonjs/brace-expressions.js new file mode 100644 index 00000000..0e13eefc --- /dev/null +++ b/node_modules/npm/node_modules/minimatch/dist/commonjs/brace-expressions.js @@ -0,0 +1,152 @@ +"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/npm/node_modules/minimatch/dist/commonjs/escape.js b/node_modules/npm/node_modules/minimatch/dist/commonjs/escape.js new file mode 100644 index 00000000..02a4f8a8 --- /dev/null +++ b/node_modules/npm/node_modules/minimatch/dist/commonjs/escape.js @@ -0,0 +1,22 @@ +"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/npm/node_modules/minimatch/dist/commonjs/index.js b/node_modules/npm/node_modules/minimatch/dist/commonjs/index.js new file mode 100644 index 00000000..64a0f1f8 --- /dev/null +++ b/node_modules/npm/node_modules/minimatch/dist/commonjs/index.js @@ -0,0 +1,1017 @@ +"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 { + // just collapse multiple ** portions into one + 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) {
    +                    globParts[i] = [];
    +                    globParts[j] = matched;
    +                    break;
    +                }
    +            }
    +        }
    +        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();
    +        if (fastTest && typeof re === 'object') {
    +            // Avoids overriding in frozen environments
    +            Reflect.defineProperty(re, 'test', { value: fastTest });
    +        }
    +        return 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/npm/node_modules/minimatch/dist/commonjs/package.json b/node_modules/npm/node_modules/minimatch/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minimatch/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/minimatch/dist/commonjs/unescape.js b/node_modules/npm/node_modules/minimatch/dist/commonjs/unescape.js
    new file mode 100644
    index 00000000..47c36bce
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minimatch/dist/commonjs/unescape.js
    @@ -0,0 +1,24 @@
    +"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/npm/node_modules/minimatch/dist/esm/assert-valid-pattern.js b/node_modules/npm/node_modules/minimatch/dist/esm/assert-valid-pattern.js
    new file mode 100644
    index 00000000..7b534fc3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minimatch/dist/esm/assert-valid-pattern.js
    @@ -0,0 +1,10 @@
    +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/npm/node_modules/minimatch/dist/esm/ast.js b/node_modules/npm/node_modules/minimatch/dist/esm/ast.js
    new file mode 100644
    index 00000000..2d2bced6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minimatch/dist/esm/ast.js
    @@ -0,0 +1,588 @@
    +// 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,
    +        });
    +    }
    +    get options() {
    +        return this.#options;
    +    }
    +    // 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/npm/node_modules/minimatch/dist/esm/brace-expressions.js b/node_modules/npm/node_modules/minimatch/dist/esm/brace-expressions.js
    new file mode 100644
    index 00000000..c629d6ae
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minimatch/dist/esm/brace-expressions.js
    @@ -0,0 +1,148 @@
    +// 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/npm/node_modules/minimatch/dist/esm/escape.js b/node_modules/npm/node_modules/minimatch/dist/esm/escape.js
    new file mode 100644
    index 00000000..16f7c8c7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minimatch/dist/esm/escape.js
    @@ -0,0 +1,18 @@
    +/**
    + * 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/npm/node_modules/minimatch/dist/esm/index.js b/node_modules/npm/node_modules/minimatch/dist/esm/index.js
    new file mode 100644
    index 00000000..84b577b0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minimatch/dist/esm/index.js
    @@ -0,0 +1,1001 @@
    +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 {
    +            // just collapse multiple ** portions into one
    +            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) {
    +                    globParts[i] = [];
    +                    globParts[j] = matched;
    +                    break;
    +                }
    +            }
    +        }
    +        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();
    +        if (fastTest && typeof re === 'object') {
    +            // Avoids overriding in frozen environments
    +            Reflect.defineProperty(re, 'test', { value: fastTest });
    +        }
    +        return 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/npm/node_modules/minimatch/dist/esm/package.json b/node_modules/npm/node_modules/minimatch/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minimatch/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/minimatch/dist/esm/unescape.js b/node_modules/npm/node_modules/minimatch/dist/esm/unescape.js
    new file mode 100644
    index 00000000..0faf9a2b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minimatch/dist/esm/unescape.js
    @@ -0,0 +1,20 @@
    +/**
    + * 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/npm/node_modules/minimatch/package.json b/node_modules/npm/node_modules/minimatch/package.json
    new file mode 100644
    index 00000000..01fc48ec
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minimatch/package.json
    @@ -0,0 +1,82 @@
    +{
    +  "author": "Isaac Z. Schlueter  (http://blog.izs.me)",
    +  "name": "minimatch",
    +  "description": "a glob matcher in javascript",
    +  "version": "9.0.5",
    +  "repository": {
    +    "type": "git",
    +    "url": "git://github.com/isaacs/minimatch.git"
    +  },
    +  "main": "./dist/commonjs/index.js",
    +  "types": "./dist/commonjs/index.d.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",
    +    "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",
    +    "eslint-config-prettier": "^8.6.0",
    +    "mkdirp": "1",
    +    "prettier": "^2.8.2",
    +    "tap": "^18.7.2",
    +    "ts-node": "^10.9.1",
    +    "tshy": "^1.12.0",
    +    "typedoc": "^0.23.21",
    +    "typescript": "^4.9.3"
    +  },
    +  "funding": {
    +    "url": "https://github.com/sponsors/isaacs"
    +  },
    +  "license": "ISC",
    +  "tshy": {
    +    "exports": {
    +      "./package.json": "./package.json",
    +      ".": "./src/index.ts"
    +    }
    +  },
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/minipass-collect/LICENSE b/node_modules/npm/node_modules/minipass-collect/LICENSE
    new file mode 100644
    index 00000000..8b8575ae
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-collect/LICENSE
    @@ -0,0 +1,15 @@
    +The ISC License
    +
    +Copyright (c) 2019-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/npm/node_modules/minipass-collect/index.js b/node_modules/npm/node_modules/minipass-collect/index.js
    new file mode 100644
    index 00000000..3497f55c
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-collect/index.js
    @@ -0,0 +1,71 @@
    +const { Minipass } = require('minipass')
    +const _data = Symbol('_data')
    +const _length = Symbol('_length')
    +class Collect extends Minipass {
    +  constructor (options) {
    +    super(options)
    +    this[_data] = []
    +    this[_length] = 0
    +  }
    +  write (chunk, encoding, cb) {
    +    if (typeof encoding === 'function')
    +      cb = encoding, encoding = 'utf8'
    +
    +    if (!encoding)
    +      encoding = 'utf8'
    +
    +    const c = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, encoding)
    +    this[_data].push(c)
    +    this[_length] += c.length
    +    if (cb)
    +      cb()
    +    return true
    +  }
    +  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)
    +    const result = Buffer.concat(this[_data], this[_length])
    +    super.write(result)
    +    return super.end(cb)
    +  }
    +}
    +module.exports = Collect
    +
    +// it would be possible to DRY this a bit by doing something like
    +// this.collector = new Collect() and listening on its data event,
    +// but it's not much code, and we may as well save the extra obj
    +class CollectPassThrough extends Minipass {
    +  constructor (options) {
    +    super(options)
    +    this[_data] = []
    +    this[_length] = 0
    +  }
    +  write (chunk, encoding, cb) {
    +    if (typeof encoding === 'function')
    +      cb = encoding, encoding = 'utf8'
    +
    +    if (!encoding)
    +      encoding = 'utf8'
    +
    +    const c = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, encoding)
    +    this[_data].push(c)
    +    this[_length] += c.length
    +    return super.write(chunk, encoding, cb)
    +  }
    +  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)
    +    const result = Buffer.concat(this[_data], this[_length])
    +    this.emit('collect', result)
    +    return super.end(cb)
    +  }
    +}
    +module.exports.PassThrough = CollectPassThrough
    diff --git a/node_modules/npm/node_modules/minipass-collect/package.json b/node_modules/npm/node_modules/minipass-collect/package.json
    new file mode 100644
    index 00000000..f9daa81b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-collect/package.json
    @@ -0,0 +1,30 @@
    +{
    +  "name": "minipass-collect",
    +  "version": "2.0.1",
    +  "description": "A Minipass stream that collects all the data into a single chunk",
    +  "author": "Isaac Z. Schlueter  (https://izs.me)",
    +  "license": "ISC",
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "prepublishOnly": "git push origin --follow-tags"
    +  },
    +  "tap": {
    +    "check-coverage": true
    +  },
    +  "devDependencies": {
    +    "tap": "^16.3.8"
    +  },
    +  "dependencies": {
    +    "minipass": "^7.0.3"
    +  },
    +  "files": [
    +    "index.js"
    +  ],
    +  "engines": {
    +    "node": ">=16 || 14 >=14.17"
    +  },
    +  "repository": "https://github.com/isaacs/minipass-collect"
    +}
    diff --git a/node_modules/npm/node_modules/minipass-fetch/LICENSE b/node_modules/npm/node_modules/minipass-fetch/LICENSE
    new file mode 100644
    index 00000000..3c3410cd
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/minipass-fetch/lib/abort-error.js b/node_modules/npm/node_modules/minipass-fetch/lib/abort-error.js
    new file mode 100644
    index 00000000..b18f6432
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/minipass-fetch/lib/blob.js b/node_modules/npm/node_modules/minipass-fetch/lib/blob.js
    new file mode 100644
    index 00000000..121b1730
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/minipass-fetch/lib/body.js b/node_modules/npm/node_modules/minipass-fetch/lib/body.js
    new file mode 100644
    index 00000000..62286bd1
    --- /dev/null
    +++ b/node_modules/npm/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) => {
    +      // 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/npm/node_modules/minipass-fetch/lib/headers.js b/node_modules/npm/node_modules/minipass-fetch/lib/headers.js
    new file mode 100644
    index 00000000..dd6e854d
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/minipass-fetch/lib/index.js b/node_modules/npm/node_modules/minipass-fetch/lib/index.js
    new file mode 100644
    index 00000000..da402161
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/lib/index.js
    @@ -0,0 +1,377 @@
    +'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', () => {
    +        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
    +        let locationURL = null
    +        try {
    +          locationURL = location === null ? null : new URL(location, request.url).toString()
    +        } catch {
    +          // error here can only be invalid URL in Location: header
    +          // do not throw when options.redirect == manual
    +          // let the user extract the errorneous redirect URL
    +          if (request.redirect !== 'manual') {
    +            /* eslint-disable-next-line max-len */
    +            reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'))
    +            finalize()
    +            return
    +          }
    +        }
    +
    +        // 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/npm/node_modules/minipass-fetch/lib/request.js b/node_modules/npm/node_modules/minipass-fetch/lib/request.js
    new file mode 100644
    index 00000000..054439e6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/lib/request.js
    @@ -0,0 +1,282 @@
    +'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,
    +      timeout: request.timeout,
    +    }
    +  }
    +}
    +
    +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/npm/node_modules/minipass-fetch/lib/response.js b/node_modules/npm/node_modules/minipass-fetch/lib/response.js
    new file mode 100644
    index 00000000..54cb52db
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/minipass-fetch/node_modules/minizlib/LICENSE b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/LICENSE
    new file mode 100644
    index 00000000..49f7efe4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/LICENSE
    @@ -0,0 +1,26 @@
    +Minizlib was created by Isaac Z. Schlueter.
    +It is a derivative work of the Node.js project.
    +
    +"""
    +Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors
    +Copyright (c) 2017-2023 Node.js contributors. All rights reserved.
    +Copyright (c) 2017-2023 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/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/constants.js b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/constants.js
    new file mode 100644
    index 00000000..dfc2c195
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/constants.js
    @@ -0,0 +1,123 @@
    +"use strict";
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.constants = void 0;
    +// Update with any zlib constants that are added or changed in the future.
    +// Node v6 didn't export this, so we just hard code the version and rely
    +// on all the other hard-coded values from zlib v4736.  When node v6
    +// support drops, we can just export the realZlibConstants object.
    +const zlib_1 = __importDefault(require("zlib"));
    +/* c8 ignore start */
    +const realZlibConstants = zlib_1.default.constants || { ZLIB_VERNUM: 4736 };
    +/* c8 ignore stop */
    +exports.constants = Object.freeze(Object.assign(Object.create(null), {
    +    Z_NO_FLUSH: 0,
    +    Z_PARTIAL_FLUSH: 1,
    +    Z_SYNC_FLUSH: 2,
    +    Z_FULL_FLUSH: 3,
    +    Z_FINISH: 4,
    +    Z_BLOCK: 5,
    +    Z_OK: 0,
    +    Z_STREAM_END: 1,
    +    Z_NEED_DICT: 2,
    +    Z_ERRNO: -1,
    +    Z_STREAM_ERROR: -2,
    +    Z_DATA_ERROR: -3,
    +    Z_MEM_ERROR: -4,
    +    Z_BUF_ERROR: -5,
    +    Z_VERSION_ERROR: -6,
    +    Z_NO_COMPRESSION: 0,
    +    Z_BEST_SPEED: 1,
    +    Z_BEST_COMPRESSION: 9,
    +    Z_DEFAULT_COMPRESSION: -1,
    +    Z_FILTERED: 1,
    +    Z_HUFFMAN_ONLY: 2,
    +    Z_RLE: 3,
    +    Z_FIXED: 4,
    +    Z_DEFAULT_STRATEGY: 0,
    +    DEFLATE: 1,
    +    INFLATE: 2,
    +    GZIP: 3,
    +    GUNZIP: 4,
    +    DEFLATERAW: 5,
    +    INFLATERAW: 6,
    +    UNZIP: 7,
    +    BROTLI_DECODE: 8,
    +    BROTLI_ENCODE: 9,
    +    Z_MIN_WINDOWBITS: 8,
    +    Z_MAX_WINDOWBITS: 15,
    +    Z_DEFAULT_WINDOWBITS: 15,
    +    Z_MIN_CHUNK: 64,
    +    Z_MAX_CHUNK: Infinity,
    +    Z_DEFAULT_CHUNK: 16384,
    +    Z_MIN_MEMLEVEL: 1,
    +    Z_MAX_MEMLEVEL: 9,
    +    Z_DEFAULT_MEMLEVEL: 8,
    +    Z_MIN_LEVEL: -1,
    +    Z_MAX_LEVEL: 9,
    +    Z_DEFAULT_LEVEL: -1,
    +    BROTLI_OPERATION_PROCESS: 0,
    +    BROTLI_OPERATION_FLUSH: 1,
    +    BROTLI_OPERATION_FINISH: 2,
    +    BROTLI_OPERATION_EMIT_METADATA: 3,
    +    BROTLI_MODE_GENERIC: 0,
    +    BROTLI_MODE_TEXT: 1,
    +    BROTLI_MODE_FONT: 2,
    +    BROTLI_DEFAULT_MODE: 0,
    +    BROTLI_MIN_QUALITY: 0,
    +    BROTLI_MAX_QUALITY: 11,
    +    BROTLI_DEFAULT_QUALITY: 11,
    +    BROTLI_MIN_WINDOW_BITS: 10,
    +    BROTLI_MAX_WINDOW_BITS: 24,
    +    BROTLI_LARGE_MAX_WINDOW_BITS: 30,
    +    BROTLI_DEFAULT_WINDOW: 22,
    +    BROTLI_MIN_INPUT_BLOCK_BITS: 16,
    +    BROTLI_MAX_INPUT_BLOCK_BITS: 24,
    +    BROTLI_PARAM_MODE: 0,
    +    BROTLI_PARAM_QUALITY: 1,
    +    BROTLI_PARAM_LGWIN: 2,
    +    BROTLI_PARAM_LGBLOCK: 3,
    +    BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
    +    BROTLI_PARAM_SIZE_HINT: 5,
    +    BROTLI_PARAM_LARGE_WINDOW: 6,
    +    BROTLI_PARAM_NPOSTFIX: 7,
    +    BROTLI_PARAM_NDIRECT: 8,
    +    BROTLI_DECODER_RESULT_ERROR: 0,
    +    BROTLI_DECODER_RESULT_SUCCESS: 1,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
    +    BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
    +    BROTLI_DECODER_NO_ERROR: 0,
    +    BROTLI_DECODER_SUCCESS: 1,
    +    BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
    +    BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
    +    BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
    +    BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
    +    BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
    +    BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
    +    BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
    +    BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
    +    BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
    +    BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
    +    BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
    +    BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
    +    BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
    +    BROTLI_DECODER_ERROR_UNREACHABLE: -31,
    +}, realZlibConstants));
    +//# sourceMappingURL=constants.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/index.js b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/index.js
    new file mode 100644
    index 00000000..ad65eef0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/index.js
    @@ -0,0 +1,352 @@
    +"use strict";
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.BrotliDecompress = exports.BrotliCompress = exports.Brotli = exports.Unzip = exports.InflateRaw = exports.DeflateRaw = exports.Gunzip = exports.Gzip = exports.Inflate = exports.Deflate = exports.Zlib = exports.ZlibError = exports.constants = void 0;
    +const assert_1 = __importDefault(require("assert"));
    +const buffer_1 = require("buffer");
    +const minipass_1 = require("minipass");
    +const zlib_1 = __importDefault(require("zlib"));
    +const constants_js_1 = require("./constants.js");
    +var constants_js_2 = require("./constants.js");
    +Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return constants_js_2.constants; } });
    +const OriginalBufferConcat = buffer_1.Buffer.concat;
    +const _superWrite = Symbol('_superWrite');
    +class ZlibError extends Error {
    +    code;
    +    errno;
    +    constructor(err) {
    +        super('zlib: ' + err.message);
    +        this.code = err.code;
    +        this.errno = err.errno;
    +        /* c8 ignore next */
    +        if (!this.code)
    +            this.code = 'ZLIB_ERROR';
    +        this.message = 'zlib: ' + err.message;
    +        Error.captureStackTrace(this, this.constructor);
    +    }
    +    get name() {
    +        return 'ZlibError';
    +    }
    +}
    +exports.ZlibError = ZlibError;
    +// the Zlib class they all inherit from
    +// This thing manages the queue of requests, and returns
    +// true or false if there is anything in the queue when
    +// you call the .write() method.
    +const _flushFlag = Symbol('flushFlag');
    +class ZlibBase extends minipass_1.Minipass {
    +    #sawError = false;
    +    #ended = false;
    +    #flushFlag;
    +    #finishFlushFlag;
    +    #fullFlushFlag;
    +    #handle;
    +    #onError;
    +    get sawError() {
    +        return this.#sawError;
    +    }
    +    get handle() {
    +        return this.#handle;
    +    }
    +    /* c8 ignore start */
    +    get flushFlag() {
    +        return this.#flushFlag;
    +    }
    +    /* c8 ignore stop */
    +    constructor(opts, mode) {
    +        if (!opts || typeof opts !== 'object')
    +            throw new TypeError('invalid options for ZlibBase constructor');
    +        //@ts-ignore
    +        super(opts);
    +        /* c8 ignore start */
    +        this.#flushFlag = opts.flush ?? 0;
    +        this.#finishFlushFlag = opts.finishFlush ?? 0;
    +        this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
    +        /* c8 ignore stop */
    +        // this will throw if any options are invalid for the class selected
    +        try {
    +            // @types/node doesn't know that it exports the classes, but they're there
    +            //@ts-ignore
    +            this.#handle = new zlib_1.default[mode](opts);
    +        }
    +        catch (er) {
    +            // make sure that all errors get decorated properly
    +            throw new ZlibError(er);
    +        }
    +        this.#onError = err => {
    +            // no sense raising multiple errors, since we abort on the first one.
    +            if (this.#sawError)
    +                return;
    +            this.#sawError = true;
    +            // there is no way to cleanly recover.
    +            // continuing only obscures problems.
    +            this.close();
    +            this.emit('error', err);
    +        };
    +        this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
    +        this.once('end', () => this.close);
    +    }
    +    close() {
    +        if (this.#handle) {
    +            this.#handle.close();
    +            this.#handle = undefined;
    +            this.emit('close');
    +        }
    +    }
    +    reset() {
    +        if (!this.#sawError) {
    +            (0, assert_1.default)(this.#handle, 'zlib binding closed');
    +            //@ts-ignore
    +            return this.#handle.reset?.();
    +        }
    +    }
    +    flush(flushFlag) {
    +        if (this.ended)
    +            return;
    +        if (typeof flushFlag !== 'number')
    +            flushFlag = this.#fullFlushFlag;
    +        this.write(Object.assign(buffer_1.Buffer.alloc(0), { [_flushFlag]: flushFlag }));
    +    }
    +    end(chunk, encoding, cb) {
    +        /* c8 ignore start */
    +        if (typeof chunk === 'function') {
    +            cb = chunk;
    +            encoding = undefined;
    +            chunk = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        /* c8 ignore stop */
    +        if (chunk) {
    +            if (encoding)
    +                this.write(chunk, encoding);
    +            else
    +                this.write(chunk);
    +        }
    +        this.flush(this.#finishFlushFlag);
    +        this.#ended = true;
    +        return super.end(cb);
    +    }
    +    get ended() {
    +        return this.#ended;
    +    }
    +    // overridden in the gzip classes to do portable writes
    +    [_superWrite](data) {
    +        return super.write(data);
    +    }
    +    write(chunk, encoding, cb) {
    +        // process the chunk using the sync process
    +        // then super.write() all the outputted chunks
    +        if (typeof encoding === 'function')
    +            (cb = encoding), (encoding = 'utf8');
    +        if (typeof chunk === 'string')
    +            chunk = buffer_1.Buffer.from(chunk, encoding);
    +        if (this.#sawError)
    +            return;
    +        (0, assert_1.default)(this.#handle, 'zlib binding closed');
    +        // _processChunk tries to .close() the native handle after it's done, so we
    +        // intercept that by temporarily making it a no-op.
    +        // diving into the node:zlib internals a bit here
    +        const nativeHandle = this.#handle
    +            ._handle;
    +        const originalNativeClose = nativeHandle.close;
    +        nativeHandle.close = () => { };
    +        const originalClose = this.#handle.close;
    +        this.#handle.close = () => { };
    +        // It also calls `Buffer.concat()` at the end, which may be convenient
    +        // for some, but which we are not interested in as it slows us down.
    +        buffer_1.Buffer.concat = args => args;
    +        let result = undefined;
    +        try {
    +            const flushFlag = typeof chunk[_flushFlag] === 'number'
    +                ? chunk[_flushFlag]
    +                : this.#flushFlag;
    +            result = this.#handle._processChunk(chunk, flushFlag);
    +            // if we don't throw, reset it back how it was
    +            buffer_1.Buffer.concat = OriginalBufferConcat;
    +        }
    +        catch (err) {
    +            // or if we do, put Buffer.concat() back before we emit error
    +            // Error events call into user code, which may call Buffer.concat()
    +            buffer_1.Buffer.concat = OriginalBufferConcat;
    +            this.#onError(new ZlibError(err));
    +        }
    +        finally {
    +            if (this.#handle) {
    +                // Core zlib resets `_handle` to null after attempting to close the
    +                // native handle. Our no-op handler prevented actual closure, but we
    +                // need to restore the `._handle` property.
    +                ;
    +                this.#handle._handle =
    +                    nativeHandle;
    +                nativeHandle.close = originalNativeClose;
    +                this.#handle.close = originalClose;
    +                // `_processChunk()` adds an 'error' listener. If we don't remove it
    +                // after each call, these handlers start piling up.
    +                this.#handle.removeAllListeners('error');
    +                // make sure OUR error listener is still attached tho
    +            }
    +        }
    +        if (this.#handle)
    +            this.#handle.on('error', er => this.#onError(new ZlibError(er)));
    +        let writeReturn;
    +        if (result) {
    +            if (Array.isArray(result) && result.length > 0) {
    +                const r = result[0];
    +                // The first buffer is always `handle._outBuffer`, which would be
    +                // re-used for later invocations; so, we always have to copy that one.
    +                writeReturn = this[_superWrite](buffer_1.Buffer.from(r));
    +                for (let i = 1; i < result.length; i++) {
    +                    writeReturn = this[_superWrite](result[i]);
    +                }
    +            }
    +            else {
    +                // either a single Buffer or an empty array
    +                writeReturn = this[_superWrite](buffer_1.Buffer.from(result));
    +            }
    +        }
    +        if (cb)
    +            cb();
    +        return writeReturn;
    +    }
    +}
    +class Zlib extends ZlibBase {
    +    #level;
    +    #strategy;
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants_js_1.constants.Z_NO_FLUSH;
    +        opts.finishFlush = opts.finishFlush || constants_js_1.constants.Z_FINISH;
    +        opts.fullFlushFlag = constants_js_1.constants.Z_FULL_FLUSH;
    +        super(opts, mode);
    +        this.#level = opts.level;
    +        this.#strategy = opts.strategy;
    +    }
    +    params(level, strategy) {
    +        if (this.sawError)
    +            return;
    +        if (!this.handle)
    +            throw new Error('cannot switch params when binding is closed');
    +        // no way to test this without also not supporting params at all
    +        /* c8 ignore start */
    +        if (!this.handle.params)
    +            throw new Error('not supported in this implementation');
    +        /* c8 ignore stop */
    +        if (this.#level !== level || this.#strategy !== strategy) {
    +            this.flush(constants_js_1.constants.Z_SYNC_FLUSH);
    +            (0, assert_1.default)(this.handle, 'zlib binding closed');
    +            // .params() calls .flush(), but the latter is always async in the
    +            // core zlib. We override .flush() temporarily to intercept that and
    +            // flush synchronously.
    +            const origFlush = this.handle.flush;
    +            this.handle.flush = (flushFlag, cb) => {
    +                /* c8 ignore start */
    +                if (typeof flushFlag === 'function') {
    +                    cb = flushFlag;
    +                    flushFlag = this.flushFlag;
    +                }
    +                /* c8 ignore stop */
    +                this.flush(flushFlag);
    +                cb?.();
    +            };
    +            try {
    +                ;
    +                this.handle.params(level, strategy);
    +            }
    +            finally {
    +                this.handle.flush = origFlush;
    +            }
    +            /* c8 ignore start */
    +            if (this.handle) {
    +                this.#level = level;
    +                this.#strategy = strategy;
    +            }
    +            /* c8 ignore stop */
    +        }
    +    }
    +}
    +exports.Zlib = Zlib;
    +// minimal 2-byte header
    +class Deflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Deflate');
    +    }
    +}
    +exports.Deflate = Deflate;
    +class Inflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Inflate');
    +    }
    +}
    +exports.Inflate = Inflate;
    +class Gzip extends Zlib {
    +    #portable;
    +    constructor(opts) {
    +        super(opts, 'Gzip');
    +        this.#portable = opts && !!opts.portable;
    +    }
    +    [_superWrite](data) {
    +        if (!this.#portable)
    +            return super[_superWrite](data);
    +        // we'll always get the header emitted in one first chunk
    +        // overwrite the OS indicator byte with 0xFF
    +        this.#portable = false;
    +        data[9] = 255;
    +        return super[_superWrite](data);
    +    }
    +}
    +exports.Gzip = Gzip;
    +class Gunzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Gunzip');
    +    }
    +}
    +exports.Gunzip = Gunzip;
    +// raw - no header
    +class DeflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'DeflateRaw');
    +    }
    +}
    +exports.DeflateRaw = DeflateRaw;
    +class InflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'InflateRaw');
    +    }
    +}
    +exports.InflateRaw = InflateRaw;
    +// auto-detect header.
    +class Unzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Unzip');
    +    }
    +}
    +exports.Unzip = Unzip;
    +class Brotli extends ZlibBase {
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants_js_1.constants.BROTLI_OPERATION_PROCESS;
    +        opts.finishFlush =
    +            opts.finishFlush || constants_js_1.constants.BROTLI_OPERATION_FINISH;
    +        opts.fullFlushFlag = constants_js_1.constants.BROTLI_OPERATION_FLUSH;
    +        super(opts, mode);
    +    }
    +}
    +exports.Brotli = Brotli;
    +class BrotliCompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliCompress');
    +    }
    +}
    +exports.BrotliCompress = BrotliCompress;
    +class BrotliDecompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliDecompress');
    +    }
    +}
    +exports.BrotliDecompress = BrotliDecompress;
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/package.json b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/constants.js b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/constants.js
    new file mode 100644
    index 00000000..7faf40be
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/constants.js
    @@ -0,0 +1,117 @@
    +// Update with any zlib constants that are added or changed in the future.
    +// Node v6 didn't export this, so we just hard code the version and rely
    +// on all the other hard-coded values from zlib v4736.  When node v6
    +// support drops, we can just export the realZlibConstants object.
    +import realZlib from 'zlib';
    +/* c8 ignore start */
    +const realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 };
    +/* c8 ignore stop */
    +export const constants = Object.freeze(Object.assign(Object.create(null), {
    +    Z_NO_FLUSH: 0,
    +    Z_PARTIAL_FLUSH: 1,
    +    Z_SYNC_FLUSH: 2,
    +    Z_FULL_FLUSH: 3,
    +    Z_FINISH: 4,
    +    Z_BLOCK: 5,
    +    Z_OK: 0,
    +    Z_STREAM_END: 1,
    +    Z_NEED_DICT: 2,
    +    Z_ERRNO: -1,
    +    Z_STREAM_ERROR: -2,
    +    Z_DATA_ERROR: -3,
    +    Z_MEM_ERROR: -4,
    +    Z_BUF_ERROR: -5,
    +    Z_VERSION_ERROR: -6,
    +    Z_NO_COMPRESSION: 0,
    +    Z_BEST_SPEED: 1,
    +    Z_BEST_COMPRESSION: 9,
    +    Z_DEFAULT_COMPRESSION: -1,
    +    Z_FILTERED: 1,
    +    Z_HUFFMAN_ONLY: 2,
    +    Z_RLE: 3,
    +    Z_FIXED: 4,
    +    Z_DEFAULT_STRATEGY: 0,
    +    DEFLATE: 1,
    +    INFLATE: 2,
    +    GZIP: 3,
    +    GUNZIP: 4,
    +    DEFLATERAW: 5,
    +    INFLATERAW: 6,
    +    UNZIP: 7,
    +    BROTLI_DECODE: 8,
    +    BROTLI_ENCODE: 9,
    +    Z_MIN_WINDOWBITS: 8,
    +    Z_MAX_WINDOWBITS: 15,
    +    Z_DEFAULT_WINDOWBITS: 15,
    +    Z_MIN_CHUNK: 64,
    +    Z_MAX_CHUNK: Infinity,
    +    Z_DEFAULT_CHUNK: 16384,
    +    Z_MIN_MEMLEVEL: 1,
    +    Z_MAX_MEMLEVEL: 9,
    +    Z_DEFAULT_MEMLEVEL: 8,
    +    Z_MIN_LEVEL: -1,
    +    Z_MAX_LEVEL: 9,
    +    Z_DEFAULT_LEVEL: -1,
    +    BROTLI_OPERATION_PROCESS: 0,
    +    BROTLI_OPERATION_FLUSH: 1,
    +    BROTLI_OPERATION_FINISH: 2,
    +    BROTLI_OPERATION_EMIT_METADATA: 3,
    +    BROTLI_MODE_GENERIC: 0,
    +    BROTLI_MODE_TEXT: 1,
    +    BROTLI_MODE_FONT: 2,
    +    BROTLI_DEFAULT_MODE: 0,
    +    BROTLI_MIN_QUALITY: 0,
    +    BROTLI_MAX_QUALITY: 11,
    +    BROTLI_DEFAULT_QUALITY: 11,
    +    BROTLI_MIN_WINDOW_BITS: 10,
    +    BROTLI_MAX_WINDOW_BITS: 24,
    +    BROTLI_LARGE_MAX_WINDOW_BITS: 30,
    +    BROTLI_DEFAULT_WINDOW: 22,
    +    BROTLI_MIN_INPUT_BLOCK_BITS: 16,
    +    BROTLI_MAX_INPUT_BLOCK_BITS: 24,
    +    BROTLI_PARAM_MODE: 0,
    +    BROTLI_PARAM_QUALITY: 1,
    +    BROTLI_PARAM_LGWIN: 2,
    +    BROTLI_PARAM_LGBLOCK: 3,
    +    BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
    +    BROTLI_PARAM_SIZE_HINT: 5,
    +    BROTLI_PARAM_LARGE_WINDOW: 6,
    +    BROTLI_PARAM_NPOSTFIX: 7,
    +    BROTLI_PARAM_NDIRECT: 8,
    +    BROTLI_DECODER_RESULT_ERROR: 0,
    +    BROTLI_DECODER_RESULT_SUCCESS: 1,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
    +    BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
    +    BROTLI_DECODER_NO_ERROR: 0,
    +    BROTLI_DECODER_SUCCESS: 1,
    +    BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
    +    BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
    +    BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
    +    BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
    +    BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
    +    BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
    +    BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
    +    BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
    +    BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
    +    BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
    +    BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
    +    BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
    +    BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
    +    BROTLI_DECODER_ERROR_UNREACHABLE: -31,
    +}, realZlibConstants));
    +//# sourceMappingURL=constants.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/index.js b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/index.js
    new file mode 100644
    index 00000000..a6269b50
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/index.js
    @@ -0,0 +1,333 @@
    +import assert from 'assert';
    +import { Buffer } from 'buffer';
    +import { Minipass } from 'minipass';
    +import realZlib from 'zlib';
    +import { constants } from './constants.js';
    +export { constants } from './constants.js';
    +const OriginalBufferConcat = Buffer.concat;
    +const _superWrite = Symbol('_superWrite');
    +export class ZlibError extends Error {
    +    code;
    +    errno;
    +    constructor(err) {
    +        super('zlib: ' + err.message);
    +        this.code = err.code;
    +        this.errno = err.errno;
    +        /* c8 ignore next */
    +        if (!this.code)
    +            this.code = 'ZLIB_ERROR';
    +        this.message = 'zlib: ' + err.message;
    +        Error.captureStackTrace(this, this.constructor);
    +    }
    +    get name() {
    +        return 'ZlibError';
    +    }
    +}
    +// the Zlib class they all inherit from
    +// This thing manages the queue of requests, and returns
    +// true or false if there is anything in the queue when
    +// you call the .write() method.
    +const _flushFlag = Symbol('flushFlag');
    +class ZlibBase extends Minipass {
    +    #sawError = false;
    +    #ended = false;
    +    #flushFlag;
    +    #finishFlushFlag;
    +    #fullFlushFlag;
    +    #handle;
    +    #onError;
    +    get sawError() {
    +        return this.#sawError;
    +    }
    +    get handle() {
    +        return this.#handle;
    +    }
    +    /* c8 ignore start */
    +    get flushFlag() {
    +        return this.#flushFlag;
    +    }
    +    /* c8 ignore stop */
    +    constructor(opts, mode) {
    +        if (!opts || typeof opts !== 'object')
    +            throw new TypeError('invalid options for ZlibBase constructor');
    +        //@ts-ignore
    +        super(opts);
    +        /* c8 ignore start */
    +        this.#flushFlag = opts.flush ?? 0;
    +        this.#finishFlushFlag = opts.finishFlush ?? 0;
    +        this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
    +        /* c8 ignore stop */
    +        // this will throw if any options are invalid for the class selected
    +        try {
    +            // @types/node doesn't know that it exports the classes, but they're there
    +            //@ts-ignore
    +            this.#handle = new realZlib[mode](opts);
    +        }
    +        catch (er) {
    +            // make sure that all errors get decorated properly
    +            throw new ZlibError(er);
    +        }
    +        this.#onError = err => {
    +            // no sense raising multiple errors, since we abort on the first one.
    +            if (this.#sawError)
    +                return;
    +            this.#sawError = true;
    +            // there is no way to cleanly recover.
    +            // continuing only obscures problems.
    +            this.close();
    +            this.emit('error', err);
    +        };
    +        this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
    +        this.once('end', () => this.close);
    +    }
    +    close() {
    +        if (this.#handle) {
    +            this.#handle.close();
    +            this.#handle = undefined;
    +            this.emit('close');
    +        }
    +    }
    +    reset() {
    +        if (!this.#sawError) {
    +            assert(this.#handle, 'zlib binding closed');
    +            //@ts-ignore
    +            return this.#handle.reset?.();
    +        }
    +    }
    +    flush(flushFlag) {
    +        if (this.ended)
    +            return;
    +        if (typeof flushFlag !== 'number')
    +            flushFlag = this.#fullFlushFlag;
    +        this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }));
    +    }
    +    end(chunk, encoding, cb) {
    +        /* c8 ignore start */
    +        if (typeof chunk === 'function') {
    +            cb = chunk;
    +            encoding = undefined;
    +            chunk = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        /* c8 ignore stop */
    +        if (chunk) {
    +            if (encoding)
    +                this.write(chunk, encoding);
    +            else
    +                this.write(chunk);
    +        }
    +        this.flush(this.#finishFlushFlag);
    +        this.#ended = true;
    +        return super.end(cb);
    +    }
    +    get ended() {
    +        return this.#ended;
    +    }
    +    // overridden in the gzip classes to do portable writes
    +    [_superWrite](data) {
    +        return super.write(data);
    +    }
    +    write(chunk, encoding, cb) {
    +        // process the chunk using the sync process
    +        // then super.write() all the outputted chunks
    +        if (typeof encoding === 'function')
    +            (cb = encoding), (encoding = 'utf8');
    +        if (typeof chunk === 'string')
    +            chunk = Buffer.from(chunk, encoding);
    +        if (this.#sawError)
    +            return;
    +        assert(this.#handle, 'zlib binding closed');
    +        // _processChunk tries to .close() the native handle after it's done, so we
    +        // intercept that by temporarily making it a no-op.
    +        // diving into the node:zlib internals a bit here
    +        const nativeHandle = this.#handle
    +            ._handle;
    +        const originalNativeClose = nativeHandle.close;
    +        nativeHandle.close = () => { };
    +        const originalClose = this.#handle.close;
    +        this.#handle.close = () => { };
    +        // It also calls `Buffer.concat()` at the end, which may be convenient
    +        // for some, but which we are not interested in as it slows us down.
    +        Buffer.concat = args => args;
    +        let result = undefined;
    +        try {
    +            const flushFlag = typeof chunk[_flushFlag] === 'number'
    +                ? chunk[_flushFlag]
    +                : this.#flushFlag;
    +            result = this.#handle._processChunk(chunk, flushFlag);
    +            // if we don't throw, reset it back how it was
    +            Buffer.concat = OriginalBufferConcat;
    +        }
    +        catch (err) {
    +            // or if we do, put Buffer.concat() back before we emit error
    +            // Error events call into user code, which may call Buffer.concat()
    +            Buffer.concat = OriginalBufferConcat;
    +            this.#onError(new ZlibError(err));
    +        }
    +        finally {
    +            if (this.#handle) {
    +                // Core zlib resets `_handle` to null after attempting to close the
    +                // native handle. Our no-op handler prevented actual closure, but we
    +                // need to restore the `._handle` property.
    +                ;
    +                this.#handle._handle =
    +                    nativeHandle;
    +                nativeHandle.close = originalNativeClose;
    +                this.#handle.close = originalClose;
    +                // `_processChunk()` adds an 'error' listener. If we don't remove it
    +                // after each call, these handlers start piling up.
    +                this.#handle.removeAllListeners('error');
    +                // make sure OUR error listener is still attached tho
    +            }
    +        }
    +        if (this.#handle)
    +            this.#handle.on('error', er => this.#onError(new ZlibError(er)));
    +        let writeReturn;
    +        if (result) {
    +            if (Array.isArray(result) && result.length > 0) {
    +                const r = result[0];
    +                // The first buffer is always `handle._outBuffer`, which would be
    +                // re-used for later invocations; so, we always have to copy that one.
    +                writeReturn = this[_superWrite](Buffer.from(r));
    +                for (let i = 1; i < result.length; i++) {
    +                    writeReturn = this[_superWrite](result[i]);
    +                }
    +            }
    +            else {
    +                // either a single Buffer or an empty array
    +                writeReturn = this[_superWrite](Buffer.from(result));
    +            }
    +        }
    +        if (cb)
    +            cb();
    +        return writeReturn;
    +    }
    +}
    +export class Zlib extends ZlibBase {
    +    #level;
    +    #strategy;
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants.Z_NO_FLUSH;
    +        opts.finishFlush = opts.finishFlush || constants.Z_FINISH;
    +        opts.fullFlushFlag = constants.Z_FULL_FLUSH;
    +        super(opts, mode);
    +        this.#level = opts.level;
    +        this.#strategy = opts.strategy;
    +    }
    +    params(level, strategy) {
    +        if (this.sawError)
    +            return;
    +        if (!this.handle)
    +            throw new Error('cannot switch params when binding is closed');
    +        // no way to test this without also not supporting params at all
    +        /* c8 ignore start */
    +        if (!this.handle.params)
    +            throw new Error('not supported in this implementation');
    +        /* c8 ignore stop */
    +        if (this.#level !== level || this.#strategy !== strategy) {
    +            this.flush(constants.Z_SYNC_FLUSH);
    +            assert(this.handle, 'zlib binding closed');
    +            // .params() calls .flush(), but the latter is always async in the
    +            // core zlib. We override .flush() temporarily to intercept that and
    +            // flush synchronously.
    +            const origFlush = this.handle.flush;
    +            this.handle.flush = (flushFlag, cb) => {
    +                /* c8 ignore start */
    +                if (typeof flushFlag === 'function') {
    +                    cb = flushFlag;
    +                    flushFlag = this.flushFlag;
    +                }
    +                /* c8 ignore stop */
    +                this.flush(flushFlag);
    +                cb?.();
    +            };
    +            try {
    +                ;
    +                this.handle.params(level, strategy);
    +            }
    +            finally {
    +                this.handle.flush = origFlush;
    +            }
    +            /* c8 ignore start */
    +            if (this.handle) {
    +                this.#level = level;
    +                this.#strategy = strategy;
    +            }
    +            /* c8 ignore stop */
    +        }
    +    }
    +}
    +// minimal 2-byte header
    +export class Deflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Deflate');
    +    }
    +}
    +export class Inflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Inflate');
    +    }
    +}
    +export class Gzip extends Zlib {
    +    #portable;
    +    constructor(opts) {
    +        super(opts, 'Gzip');
    +        this.#portable = opts && !!opts.portable;
    +    }
    +    [_superWrite](data) {
    +        if (!this.#portable)
    +            return super[_superWrite](data);
    +        // we'll always get the header emitted in one first chunk
    +        // overwrite the OS indicator byte with 0xFF
    +        this.#portable = false;
    +        data[9] = 255;
    +        return super[_superWrite](data);
    +    }
    +}
    +export class Gunzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Gunzip');
    +    }
    +}
    +// raw - no header
    +export class DeflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'DeflateRaw');
    +    }
    +}
    +export class InflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'InflateRaw');
    +    }
    +}
    +// auto-detect header.
    +export class Unzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Unzip');
    +    }
    +}
    +export class Brotli extends ZlibBase {
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS;
    +        opts.finishFlush =
    +            opts.finishFlush || constants.BROTLI_OPERATION_FINISH;
    +        opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH;
    +        super(opts, mode);
    +    }
    +}
    +export class BrotliCompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliCompress');
    +    }
    +}
    +export class BrotliDecompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliDecompress');
    +    }
    +}
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/package.json b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/package.json b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/package.json
    new file mode 100644
    index 00000000..e94623ff
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/node_modules/minizlib/package.json
    @@ -0,0 +1,81 @@
    +{
    +  "name": "minizlib",
    +  "version": "3.0.1",
    +  "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
    +  "main": "./dist/commonjs/index.js",
    +  "dependencies": {
    +    "minipass": "^7.0.4",
    +    "rimraf": "^5.0.5"
    +  },
    +  "scripts": {
    +    "prepare": "tshy",
    +    "pretest": "npm run prepare",
    +    "test": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "prepublishOnly": "git push origin --follow-tags",
    +    "format": "prettier --write . --loglevel warn",
    +    "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/isaacs/minizlib.git"
    +  },
    +  "keywords": [
    +    "zlib",
    +    "gzip",
    +    "gunzip",
    +    "deflate",
    +    "inflate",
    +    "compression",
    +    "zip",
    +    "unzip"
    +  ],
    +  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
    +  "license": "MIT",
    +  "devDependencies": {
    +    "@types/node": "^20.11.29",
    +    "mkdirp": "^3.0.1",
    +    "tap": "^18.7.1",
    +    "tshy": "^1.12.0",
    +    "typedoc": "^0.25.12"
    +  },
    +  "files": [
    +    "dist"
    +  ],
    +  "engines": {
    +    "node": ">= 18"
    +  },
    +  "tshy": {
    +    "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"
    +      }
    +    }
    +  },
    +  "types": "./dist/commonjs/index.d.ts",
    +  "type": "module",
    +  "prettier": {
    +    "semi": false,
    +    "printWidth": 75,
    +    "tabWidth": 2,
    +    "useTabs": false,
    +    "singleQuote": true,
    +    "jsxSingleQuote": false,
    +    "bracketSameLine": true,
    +    "arrowParens": "avoid",
    +    "endOfLine": "lf"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/minipass-fetch/package.json b/node_modules/npm/node_modules/minipass-fetch/package.json
    new file mode 100644
    index 00000000..6e248345
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-fetch/package.json
    @@ -0,0 +1,70 @@
    +{
    +  "name": "minipass-fetch",
    +  "version": "4.0.0",
    +  "description": "An implementation of window.fetch in Node.js using Minipass streams",
    +  "license": "MIT",
    +  "main": "lib/index.js",
    +  "scripts": {
    +    "test:tls-fixtures": "./test/fixtures/tls/setup.sh",
    +    "test": "tap",
    +    "snap": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "lintfix": "npm run eslint -- --fix",
    +    "posttest": "npm run lint",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "tap": {
    +    "coverage-map": "map.js",
    +    "check-coverage": true,
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "@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": "^7.0.3",
    +    "minipass-sized": "^1.0.3",
    +    "minizlib": "^3.0.1"
    +  },
    +  "optionalDependencies": {
    +    "encoding": "^0.1.13"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/minipass-fetch.git"
    +  },
    +  "keywords": [
    +    "fetch",
    +    "minipass",
    +    "node-fetch",
    +    "window.fetch"
    +  ],
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "author": "GitHub Inc.",
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": "true"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/minipass-flush/LICENSE b/node_modules/npm/node_modules/minipass-flush/LICENSE
    new file mode 100644
    index 00000000..19129e31
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-flush/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/minipass-flush/index.js b/node_modules/npm/node_modules/minipass-flush/index.js
    new file mode 100644
    index 00000000..cb2537fa
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-flush/index.js
    @@ -0,0 +1,39 @@
    +const Minipass = require('minipass')
    +const _flush = Symbol('_flush')
    +const _flushed = Symbol('_flushed')
    +const _flushing = Symbol('_flushing')
    +class Flush extends Minipass {
    +  constructor (opt = {}) {
    +    if (typeof opt === 'function')
    +      opt = { flush: opt }
    +
    +    super(opt)
    +
    +    // or extend this class and provide a 'flush' method in your subclass
    +    if (typeof opt.flush !== 'function' && typeof this.flush !== 'function')
    +      throw new TypeError('must provide flush function in options')
    +
    +    this[_flush] = opt.flush || this.flush
    +  }
    +
    +  emit (ev, ...data) {
    +    if ((ev !== 'end' && ev !== 'finish') || this[_flushed])
    +      return super.emit(ev, ...data)
    +
    +    if (this[_flushing])
    +      return
    +
    +    this[_flushing] = true
    +
    +    const afterFlush = er => {
    +      this[_flushed] = true
    +      er ? super.emit('error', er) : super.emit('end')
    +    }
    +
    +    const ret = this[_flush](afterFlush)
    +    if (ret && ret.then)
    +      ret.then(() => afterFlush(), er => afterFlush(er))
    +  }
    +}
    +
    +module.exports = Flush
    diff --git a/node_modules/npm/node_modules/minipass-flush/node_modules/minipass/LICENSE b/node_modules/npm/node_modules/minipass-flush/node_modules/minipass/LICENSE
    new file mode 100644
    index 00000000..bf1dece2
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-flush/node_modules/minipass/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/minipass-flush/node_modules/minipass/index.js b/node_modules/npm/node_modules/minipass-flush/node_modules/minipass/index.js
    new file mode 100644
    index 00000000..e8797aab
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-flush/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/npm/node_modules/minipass-flush/node_modules/minipass/package.json b/node_modules/npm/node_modules/minipass-flush/node_modules/minipass/package.json
    new file mode 100644
    index 00000000..548d03fa
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-flush/node_modules/minipass/package.json
    @@ -0,0 +1,56 @@
    +{
    +  "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/npm/node_modules/minipass-flush/package.json b/node_modules/npm/node_modules/minipass-flush/package.json
    new file mode 100644
    index 00000000..09127d0e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-flush/package.json
    @@ -0,0 +1,39 @@
    +{
    +  "name": "minipass-flush",
    +  "version": "1.0.5",
    +  "description": "A Minipass stream that calls a flush function before emitting 'end'",
    +  "author": "Isaac Z. Schlueter  (https://izs.me)",
    +  "license": "ISC",
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "postpublish": "git push origin --follow-tags"
    +  },
    +  "tap": {
    +    "check-coverage": true
    +  },
    +  "devDependencies": {
    +    "tap": "^14.6.9"
    +  },
    +  "dependencies": {
    +    "minipass": "^3.0.0"
    +  },
    +  "files": [
    +    "index.js"
    +  ],
    +  "main": "index.js",
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/isaacs/minipass-flush.git"
    +  },
    +  "keywords": [
    +    "minipass",
    +    "flush",
    +    "stream"
    +  ],
    +  "engines": {
    +    "node": ">= 8"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/minipass-pipeline/LICENSE b/node_modules/npm/node_modules/minipass-pipeline/LICENSE
    new file mode 100644
    index 00000000..19129e31
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-pipeline/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/minipass-pipeline/index.js b/node_modules/npm/node_modules/minipass-pipeline/index.js
    new file mode 100644
    index 00000000..b94ea14b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-pipeline/index.js
    @@ -0,0 +1,128 @@
    +const Minipass = require('minipass')
    +const EE = require('events')
    +const isStream = s => s && s instanceof EE && (
    +  typeof s.pipe === 'function' || // readable
    +  (typeof s.write === 'function' && typeof s.end === 'function') // writable
    +)
    +
    +const _head = Symbol('_head')
    +const _tail = Symbol('_tail')
    +const _linkStreams = Symbol('_linkStreams')
    +const _setHead = Symbol('_setHead')
    +const _setTail = Symbol('_setTail')
    +const _onError = Symbol('_onError')
    +const _onData = Symbol('_onData')
    +const _onEnd = Symbol('_onEnd')
    +const _onDrain = Symbol('_onDrain')
    +const _streams = Symbol('_streams')
    +class Pipeline extends Minipass {
    +  constructor (opts, ...streams) {
    +    if (isStream(opts)) {
    +      streams.unshift(opts)
    +      opts = {}
    +    }
    +
    +    super(opts)
    +    this[_streams] = []
    +    if (streams.length)
    +      this.push(...streams)
    +  }
    +
    +  [_linkStreams] (streams) {
    +    // reduce takes (left,right), and we return right to make it the
    +    // new left value.
    +    return streams.reduce((src, dest) => {
    +      src.on('error', er => dest.emit('error', er))
    +      src.pipe(dest)
    +      return dest
    +    })
    +  }
    +
    +  push (...streams) {
    +    this[_streams].push(...streams)
    +    if (this[_tail])
    +      streams.unshift(this[_tail])
    +
    +    const linkRet = this[_linkStreams](streams)
    +
    +    this[_setTail](linkRet)
    +    if (!this[_head])
    +      this[_setHead](streams[0])
    +  }
    +
    +  unshift (...streams) {
    +    this[_streams].unshift(...streams)
    +    if (this[_head])
    +      streams.push(this[_head])
    +
    +    const linkRet = this[_linkStreams](streams)
    +    this[_setHead](streams[0])
    +    if (!this[_tail])
    +      this[_setTail](linkRet)
    +  }
    +
    +  destroy (er) {
    +    // set fire to the whole thing.
    +    this[_streams].forEach(s =>
    +      typeof s.destroy === 'function' && s.destroy())
    +    return super.destroy(er)
    +  }
    +
    +  // readable interface -> tail
    +  [_setTail] (stream) {
    +    this[_tail] = stream
    +    stream.on('error', er => this[_onError](stream, er))
    +    stream.on('data', chunk => this[_onData](stream, chunk))
    +    stream.on('end', () => this[_onEnd](stream))
    +    stream.on('finish', () => this[_onEnd](stream))
    +  }
    +
    +  // errors proxied down the pipeline
    +  // they're considered part of the "read" interface
    +  [_onError] (stream, er) {
    +    if (stream === this[_tail])
    +      this.emit('error', er)
    +  }
    +  [_onData] (stream, chunk) {
    +    if (stream === this[_tail])
    +      super.write(chunk)
    +  }
    +  [_onEnd] (stream) {
    +    if (stream === this[_tail])
    +      super.end()
    +  }
    +  pause () {
    +    super.pause()
    +    return this[_tail] && this[_tail].pause && this[_tail].pause()
    +  }
    +
    +  // NB: Minipass calls its internal private [RESUME] method during
    +  // pipe drains, to avoid hazards where stream.resume() is overridden.
    +  // Thus, we need to listen to the resume *event*, not override the
    +  // resume() method, and proxy *that* to the tail.
    +  emit (ev, ...args) {
    +    if (ev === 'resume' && this[_tail] && this[_tail].resume)
    +      this[_tail].resume()
    +    return super.emit(ev, ...args)
    +  }
    +
    +  // writable interface -> head
    +  [_setHead] (stream) {
    +    this[_head] = stream
    +    stream.on('drain', () => this[_onDrain](stream))
    +  }
    +  [_onDrain] (stream) {
    +    if (stream === this[_head])
    +      this.emit('drain')
    +  }
    +  write (chunk, enc, cb) {
    +    return this[_head].write(chunk, enc, cb) &&
    +      (this.flowing || this.buffer.length === 0)
    +  }
    +  end (chunk, enc, cb) {
    +    this[_head].end(chunk, enc, cb)
    +    return this
    +  }
    +}
    +
    +module.exports = Pipeline
    diff --git a/node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass/LICENSE b/node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass/LICENSE
    new file mode 100644
    index 00000000..bf1dece2
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/minipass-pipeline/node_modules/minipass/index.js b/node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass/index.js
    new file mode 100644
    index 00000000..e8797aab
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-pipeline/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/npm/node_modules/minipass-pipeline/node_modules/minipass/package.json b/node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass/package.json
    new file mode 100644
    index 00000000..548d03fa
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass/package.json
    @@ -0,0 +1,56 @@
    +{
    +  "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/npm/node_modules/minipass-pipeline/package.json b/node_modules/npm/node_modules/minipass-pipeline/package.json
    new file mode 100644
    index 00000000..d608dc66
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-pipeline/package.json
    @@ -0,0 +1,29 @@
    +{
    +  "name": "minipass-pipeline",
    +  "version": "1.2.4",
    +  "description": "create a pipeline of streams using Minipass",
    +  "author": "Isaac Z. Schlueter  (https://izs.me)",
    +  "license": "ISC",
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "postpublish": "git push origin --follow-tags"
    +  },
    +  "tap": {
    +    "check-coverage": true
    +  },
    +  "devDependencies": {
    +    "tap": "^14.6.9"
    +  },
    +  "dependencies": {
    +    "minipass": "^3.0.0"
    +  },
    +  "files": [
    +    "index.js"
    +  ],
    +  "engines": {
    +    "node": ">=8"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/minipass-sized/LICENSE b/node_modules/npm/node_modules/minipass-sized/LICENSE
    new file mode 100644
    index 00000000..19129e31
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-sized/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/minipass-sized/index.js b/node_modules/npm/node_modules/minipass-sized/index.js
    new file mode 100644
    index 00000000..a0c8acde
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-sized/index.js
    @@ -0,0 +1,67 @@
    +const Minipass = require('minipass')
    +
    +class SizeError extends Error {
    +  constructor (found, expect) {
    +    super(`Bad data size: expected ${expect} bytes, but got ${found}`)
    +    this.expect = expect
    +    this.found = found
    +    this.code = 'EBADSIZE'
    +	  Error.captureStackTrace(this, this.constructor)
    +  }
    +  get name () {
    +    return 'SizeError'
    +  }
    +}
    +
    +class MinipassSized extends Minipass {
    +  constructor (options = {}) {
    +    super(options)
    +
    +    if (options.objectMode)
    +      throw new TypeError(`${
    +        this.constructor.name
    +      } streams only work with string and buffer data`)
    +
    +    this.found = 0
    +    this.expect = options.size
    +    if (typeof this.expect !== 'number' ||
    +        this.expect > Number.MAX_SAFE_INTEGER ||
    +        isNaN(this.expect) ||
    +        this.expect < 0 ||
    +        !isFinite(this.expect) ||
    +        this.expect !== Math.floor(this.expect))
    +      throw new Error('invalid expected size: ' + this.expect)
    +  }
    +
    +  write (chunk, encoding, cb) {
    +    const buffer = Buffer.isBuffer(chunk) ? chunk
    +      : typeof chunk === 'string' ?
    +        Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8')
    +      : chunk
    +
    +    if (!Buffer.isBuffer(buffer)) {
    +      this.emit('error', new TypeError(`${
    +        this.constructor.name
    +      } streams only work with string and buffer data`))
    +      return false
    +    }
    +
    +    this.found += buffer.length
    +    if (this.found > this.expect)
    +      this.emit('error', new SizeError(this.found, this.expect))
    +
    +    return super.write(chunk, encoding, cb)
    +  }
    +
    +  emit (ev, ...data) {
    +    if (ev === 'end') {
    +      if (this.found !== this.expect)
    +        this.emit('error', new SizeError(this.found, this.expect))
    +    }
    +    return super.emit(ev, ...data)
    +  }
    +}
    +
    +MinipassSized.SizeError = SizeError
    +
    +module.exports = MinipassSized
    diff --git a/node_modules/npm/node_modules/minipass-sized/node_modules/minipass/LICENSE b/node_modules/npm/node_modules/minipass-sized/node_modules/minipass/LICENSE
    new file mode 100644
    index 00000000..bf1dece2
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-sized/node_modules/minipass/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/minipass-sized/node_modules/minipass/index.js b/node_modules/npm/node_modules/minipass-sized/node_modules/minipass/index.js
    new file mode 100644
    index 00000000..e8797aab
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-sized/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/npm/node_modules/minipass-sized/node_modules/minipass/package.json b/node_modules/npm/node_modules/minipass-sized/node_modules/minipass/package.json
    new file mode 100644
    index 00000000..548d03fa
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-sized/node_modules/minipass/package.json
    @@ -0,0 +1,56 @@
    +{
    +  "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/npm/node_modules/minipass-sized/package.json b/node_modules/npm/node_modules/minipass-sized/package.json
    new file mode 100644
    index 00000000..a3257fd8
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-sized/package.json
    @@ -0,0 +1,39 @@
    +{
    +  "name": "minipass-sized",
    +  "version": "1.0.3",
    +  "description": "A Minipass stream that raises an error if you get a different number of bytes than expected",
    +  "author": "Isaac Z. Schlueter  (https://izs.me)",
    +  "license": "ISC",
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "postpublish": "git push origin --follow-tags"
    +  },
    +  "tap": {
    +    "check-coverage": true
    +  },
    +  "devDependencies": {
    +    "tap": "^14.6.4"
    +  },
    +  "dependencies": {
    +    "minipass": "^3.0.0"
    +  },
    +  "main": "index.js",
    +  "keywords": [
    +    "minipass",
    +    "size",
    +    "length"
    +  ],
    +  "directories": {
    +    "test": "test"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/isaacs/minipass-sized.git"
    +  },
    +  "engines": {
    +    "node": ">=8"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/minipass-sized/test/basic.js b/node_modules/npm/node_modules/minipass-sized/test/basic.js
    new file mode 100644
    index 00000000..bbdcadaa
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass-sized/test/basic.js
    @@ -0,0 +1,83 @@
    +const t = require('tap')
    +const MPS = require('../')
    +
    +t.test('ok if size checks out', t => {
    +  const mps = new MPS({ size: 4 })
    +
    +  mps.write(Buffer.from('a').toString('hex'), 'hex')
    +  mps.write(Buffer.from('sd'))
    +  mps.end('f')
    +  return mps.concat().then(data => t.equal(data.toString(), 'asdf'))
    +})
    +
    +t.test('error if size exceeded', t => {
    +  const mps = new MPS({ size: 1 })
    +  mps.on('error', er => {
    +    t.match(er, {
    +      message: 'Bad data size: expected 1 bytes, but got 4',
    +      found: 4,
    +      expect: 1,
    +      code: 'EBADSIZE',
    +      name: 'SizeError',
    +    })
    +    t.end()
    +  })
    +  mps.write('asdf')
    +})
    +
    +t.test('error if size is not met', t => {
    +  const mps = new MPS({ size: 999 })
    +  t.throws(() => mps.end(), {
    +    message: 'Bad data size: expected 999 bytes, but got 0',
    +    found: 0,
    +    name: 'SizeError',
    +    expect: 999,
    +    code: 'EBADSIZE',
    +  })
    +  t.end()
    +})
    +
    +t.test('error if non-string/buffer is written', t => {
    +  const mps = new MPS({size:1})
    +  mps.on('error', er => {
    +    t.match(er, {
    +      message: 'MinipassSized streams only work with string and buffer data'
    +    })
    +    t.end()
    +  })
    +  mps.write({some:'object'})
    +})
    +
    +t.test('projectiles', t => {
    +  t.throws(() => new MPS(), {
    +    message: 'invalid expected size: undefined'
    +  }, 'size is required')
    +  t.throws(() => new MPS({size: true}), {
    +    message: 'invalid expected size: true'
    +  }, 'size must be number')
    +  t.throws(() => new MPS({size: NaN}), {
    +    message: 'invalid expected size: NaN'
    +  }, 'size must not be NaN')
    +  t.throws(() => new MPS({size:1.2}), {
    +    message: 'invalid expected size: 1.2'
    +  }, 'size must be integer')
    +  t.throws(() => new MPS({size: Infinity}), {
    +    message: 'invalid expected size: Infinity'
    +  }, 'size must be finite')
    +  t.throws(() => new MPS({size: -1}), {
    +    message: 'invalid expected size: -1'
    +  }, 'size must be positive')
    +  t.throws(() => new MPS({objectMode: true}), {
    +    message: 'MinipassSized streams only work with string and buffer data'
    +  }, 'no objectMode')
    +  t.throws(() => new MPS({size: Number.MAX_SAFE_INTEGER + 1000000}), {
    +    message: 'invalid expected size: 9007199255740992'
    +  })
    +  t.end()
    +})
    +
    +t.test('exports SizeError class', t => {
    +  t.isa(MPS.SizeError, 'function')
    +  t.isa(MPS.SizeError.prototype, Error)
    +  t.end()
    +})
    diff --git a/node_modules/npm/node_modules/minipass/LICENSE b/node_modules/npm/node_modules/minipass/LICENSE
    new file mode 100644
    index 00000000..97f8e32e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass/LICENSE
    @@ -0,0 +1,15 @@
    +The ISC License
    +
    +Copyright (c) 2017-2023 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/npm/node_modules/minipass/dist/commonjs/index.js b/node_modules/npm/node_modules/minipass/dist/commonjs/index.js
    new file mode 100644
    index 00000000..068c095b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass/dist/commonjs/index.js
    @@ -0,0 +1,1028 @@
    +"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 node_events_1 = require("node:events");
    +const node_stream_1 = __importDefault(require("node:stream"));
    +const node_string_decoder_1 = require("node: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 node_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 node_events_1.EventEmitter &&
    +    typeof s.pipe === 'function' &&
    +    // node core Writable streams have a pipe() method, but it throws
    +    s.pipe !== node_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 node_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 node_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 node_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/npm/node_modules/minipass/dist/commonjs/package.json b/node_modules/npm/node_modules/minipass/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/minipass/dist/esm/index.js b/node_modules/npm/node_modules/minipass/dist/esm/index.js
    new file mode 100644
    index 00000000..b5fa4513
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass/dist/esm/index.js
    @@ -0,0 +1,1018 @@
    +const proc = typeof process === 'object' && process
    +    ? process
    +    : {
    +        stdout: null,
    +        stderr: null,
    +    };
    +import { EventEmitter } from 'node:events';
    +import Stream from 'node:stream';
    +import { StringDecoder } from 'node: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/npm/node_modules/minipass/dist/esm/package.json b/node_modules/npm/node_modules/minipass/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/minipass/package.json b/node_modules/npm/node_modules/minipass/package.json
    new file mode 100644
    index 00000000..771969b0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minipass/package.json
    @@ -0,0 +1,82 @@
    +{
    +  "name": "minipass",
    +  "version": "7.1.2",
    +  "description": "minimal implementation of a PassThrough stream",
    +  "main": "./dist/commonjs/index.js",
    +  "types": "./dist/commonjs/index.d.ts",
    +  "type": "module",
    +  "tshy": {
    +    "selfLink": false,
    +    "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",
    +    "tap": "^19.0.0",
    +    "through2": "^2.0.3",
    +    "tshy": "^1.14.0",
    +    "typedoc": "^0.25.1"
    +  },
    +  "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": {
    +    "typecheck": true,
    +    "include": [
    +      "test/*.ts"
    +    ]
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/minizlib/LICENSE b/node_modules/npm/node_modules/minizlib/LICENSE
    new file mode 100644
    index 00000000..ffce7383
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minizlib/LICENSE
    @@ -0,0 +1,26 @@
    +Minizlib was created by Isaac Z. Schlueter.
    +It is a derivative work of the Node.js project.
    +
    +"""
    +Copyright Isaac Z. Schlueter and Contributors
    +Copyright Node.js contributors. All rights reserved.
    +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/npm/node_modules/minizlib/constants.js b/node_modules/npm/node_modules/minizlib/constants.js
    new file mode 100644
    index 00000000..641ebc73
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minizlib/constants.js
    @@ -0,0 +1,115 @@
    +// Update with any zlib constants that are added or changed in the future.
    +// Node v6 didn't export this, so we just hard code the version and rely
    +// on all the other hard-coded values from zlib v4736.  When node v6
    +// support drops, we can just export the realZlibConstants object.
    +const realZlibConstants = require('zlib').constants ||
    +  /* istanbul ignore next */ { ZLIB_VERNUM: 4736 }
    +
    +module.exports = Object.freeze(Object.assign(Object.create(null), {
    +  Z_NO_FLUSH: 0,
    +  Z_PARTIAL_FLUSH: 1,
    +  Z_SYNC_FLUSH: 2,
    +  Z_FULL_FLUSH: 3,
    +  Z_FINISH: 4,
    +  Z_BLOCK: 5,
    +  Z_OK: 0,
    +  Z_STREAM_END: 1,
    +  Z_NEED_DICT: 2,
    +  Z_ERRNO: -1,
    +  Z_STREAM_ERROR: -2,
    +  Z_DATA_ERROR: -3,
    +  Z_MEM_ERROR: -4,
    +  Z_BUF_ERROR: -5,
    +  Z_VERSION_ERROR: -6,
    +  Z_NO_COMPRESSION: 0,
    +  Z_BEST_SPEED: 1,
    +  Z_BEST_COMPRESSION: 9,
    +  Z_DEFAULT_COMPRESSION: -1,
    +  Z_FILTERED: 1,
    +  Z_HUFFMAN_ONLY: 2,
    +  Z_RLE: 3,
    +  Z_FIXED: 4,
    +  Z_DEFAULT_STRATEGY: 0,
    +  DEFLATE: 1,
    +  INFLATE: 2,
    +  GZIP: 3,
    +  GUNZIP: 4,
    +  DEFLATERAW: 5,
    +  INFLATERAW: 6,
    +  UNZIP: 7,
    +  BROTLI_DECODE: 8,
    +  BROTLI_ENCODE: 9,
    +  Z_MIN_WINDOWBITS: 8,
    +  Z_MAX_WINDOWBITS: 15,
    +  Z_DEFAULT_WINDOWBITS: 15,
    +  Z_MIN_CHUNK: 64,
    +  Z_MAX_CHUNK: Infinity,
    +  Z_DEFAULT_CHUNK: 16384,
    +  Z_MIN_MEMLEVEL: 1,
    +  Z_MAX_MEMLEVEL: 9,
    +  Z_DEFAULT_MEMLEVEL: 8,
    +  Z_MIN_LEVEL: -1,
    +  Z_MAX_LEVEL: 9,
    +  Z_DEFAULT_LEVEL: -1,
    +  BROTLI_OPERATION_PROCESS: 0,
    +  BROTLI_OPERATION_FLUSH: 1,
    +  BROTLI_OPERATION_FINISH: 2,
    +  BROTLI_OPERATION_EMIT_METADATA: 3,
    +  BROTLI_MODE_GENERIC: 0,
    +  BROTLI_MODE_TEXT: 1,
    +  BROTLI_MODE_FONT: 2,
    +  BROTLI_DEFAULT_MODE: 0,
    +  BROTLI_MIN_QUALITY: 0,
    +  BROTLI_MAX_QUALITY: 11,
    +  BROTLI_DEFAULT_QUALITY: 11,
    +  BROTLI_MIN_WINDOW_BITS: 10,
    +  BROTLI_MAX_WINDOW_BITS: 24,
    +  BROTLI_LARGE_MAX_WINDOW_BITS: 30,
    +  BROTLI_DEFAULT_WINDOW: 22,
    +  BROTLI_MIN_INPUT_BLOCK_BITS: 16,
    +  BROTLI_MAX_INPUT_BLOCK_BITS: 24,
    +  BROTLI_PARAM_MODE: 0,
    +  BROTLI_PARAM_QUALITY: 1,
    +  BROTLI_PARAM_LGWIN: 2,
    +  BROTLI_PARAM_LGBLOCK: 3,
    +  BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
    +  BROTLI_PARAM_SIZE_HINT: 5,
    +  BROTLI_PARAM_LARGE_WINDOW: 6,
    +  BROTLI_PARAM_NPOSTFIX: 7,
    +  BROTLI_PARAM_NDIRECT: 8,
    +  BROTLI_DECODER_RESULT_ERROR: 0,
    +  BROTLI_DECODER_RESULT_SUCCESS: 1,
    +  BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
    +  BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
    +  BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
    +  BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
    +  BROTLI_DECODER_NO_ERROR: 0,
    +  BROTLI_DECODER_SUCCESS: 1,
    +  BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
    +  BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
    +  BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
    +  BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
    +  BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
    +  BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
    +  BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
    +  BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
    +  BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
    +  BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
    +  BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
    +  BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
    +  BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
    +  BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
    +  BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
    +  BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
    +  BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
    +  BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
    +  BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
    +  BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
    +  BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
    +  BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
    +  BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
    +  BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
    +  BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
    +  BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
    +  BROTLI_DECODER_ERROR_UNREACHABLE: -31,
    +}, realZlibConstants))
    diff --git a/node_modules/npm/node_modules/minizlib/index.js b/node_modules/npm/node_modules/minizlib/index.js
    new file mode 100644
    index 00000000..fbaf69e1
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minizlib/index.js
    @@ -0,0 +1,348 @@
    +'use strict'
    +
    +const assert = require('assert')
    +const Buffer = require('buffer').Buffer
    +const realZlib = require('zlib')
    +
    +const constants = exports.constants = require('./constants.js')
    +const Minipass = require('minipass')
    +
    +const OriginalBufferConcat = Buffer.concat
    +
    +const _superWrite = Symbol('_superWrite')
    +class ZlibError extends Error {
    +  constructor (err) {
    +    super('zlib: ' + err.message)
    +    this.code = err.code
    +    this.errno = err.errno
    +    /* istanbul ignore if */
    +    if (!this.code)
    +      this.code = 'ZLIB_ERROR'
    +
    +    this.message = 'zlib: ' + err.message
    +    Error.captureStackTrace(this, this.constructor)
    +  }
    +
    +  get name () {
    +    return 'ZlibError'
    +  }
    +}
    +
    +// the Zlib class they all inherit from
    +// This thing manages the queue of requests, and returns
    +// true or false if there is anything in the queue when
    +// you call the .write() method.
    +const _opts = Symbol('opts')
    +const _flushFlag = Symbol('flushFlag')
    +const _finishFlushFlag = Symbol('finishFlushFlag')
    +const _fullFlushFlag = Symbol('fullFlushFlag')
    +const _handle = Symbol('handle')
    +const _onError = Symbol('onError')
    +const _sawError = Symbol('sawError')
    +const _level = Symbol('level')
    +const _strategy = Symbol('strategy')
    +const _ended = Symbol('ended')
    +const _defaultFullFlush = Symbol('_defaultFullFlush')
    +
    +class ZlibBase extends Minipass {
    +  constructor (opts, mode) {
    +    if (!opts || typeof opts !== 'object')
    +      throw new TypeError('invalid options for ZlibBase constructor')
    +
    +    super(opts)
    +    this[_sawError] = false
    +    this[_ended] = false
    +    this[_opts] = opts
    +
    +    this[_flushFlag] = opts.flush
    +    this[_finishFlushFlag] = opts.finishFlush
    +    // this will throw if any options are invalid for the class selected
    +    try {
    +      this[_handle] = new realZlib[mode](opts)
    +    } catch (er) {
    +      // make sure that all errors get decorated properly
    +      throw new ZlibError(er)
    +    }
    +
    +    this[_onError] = (err) => {
    +      // no sense raising multiple errors, since we abort on the first one.
    +      if (this[_sawError])
    +        return
    +
    +      this[_sawError] = true
    +
    +      // there is no way to cleanly recover.
    +      // continuing only obscures problems.
    +      this.close()
    +      this.emit('error', err)
    +    }
    +
    +    this[_handle].on('error', er => this[_onError](new ZlibError(er)))
    +    this.once('end', () => this.close)
    +  }
    +
    +  close () {
    +    if (this[_handle]) {
    +      this[_handle].close()
    +      this[_handle] = null
    +      this.emit('close')
    +    }
    +  }
    +
    +  reset () {
    +    if (!this[_sawError]) {
    +      assert(this[_handle], 'zlib binding closed')
    +      return this[_handle].reset()
    +    }
    +  }
    +
    +  flush (flushFlag) {
    +    if (this.ended)
    +      return
    +
    +    if (typeof flushFlag !== 'number')
    +      flushFlag = this[_fullFlushFlag]
    +    this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }))
    +  }
    +
    +  end (chunk, encoding, cb) {
    +    if (chunk)
    +      this.write(chunk, encoding)
    +    this.flush(this[_finishFlushFlag])
    +    this[_ended] = true
    +    return super.end(null, null, cb)
    +  }
    +
    +  get ended () {
    +    return this[_ended]
    +  }
    +
    +  write (chunk, encoding, cb) {
    +    // process the chunk using the sync process
    +    // then super.write() all the outputted chunks
    +    if (typeof encoding === 'function')
    +      cb = encoding, encoding = 'utf8'
    +
    +    if (typeof chunk === 'string')
    +      chunk = Buffer.from(chunk, encoding)
    +
    +    if (this[_sawError])
    +      return
    +    assert(this[_handle], 'zlib binding closed')
    +
    +    // _processChunk tries to .close() the native handle after it's done, so we
    +    // intercept that by temporarily making it a no-op.
    +    const nativeHandle = this[_handle]._handle
    +    const originalNativeClose = nativeHandle.close
    +    nativeHandle.close = () => {}
    +    const originalClose = this[_handle].close
    +    this[_handle].close = () => {}
    +    // It also calls `Buffer.concat()` at the end, which may be convenient
    +    // for some, but which we are not interested in as it slows us down.
    +    Buffer.concat = (args) => args
    +    let result
    +    try {
    +      const flushFlag = typeof chunk[_flushFlag] === 'number'
    +        ? chunk[_flushFlag] : this[_flushFlag]
    +      result = this[_handle]._processChunk(chunk, flushFlag)
    +      // if we don't throw, reset it back how it was
    +      Buffer.concat = OriginalBufferConcat
    +    } catch (err) {
    +      // or if we do, put Buffer.concat() back before we emit error
    +      // Error events call into user code, which may call Buffer.concat()
    +      Buffer.concat = OriginalBufferConcat
    +      this[_onError](new ZlibError(err))
    +    } finally {
    +      if (this[_handle]) {
    +        // Core zlib resets `_handle` to null after attempting to close the
    +        // native handle. Our no-op handler prevented actual closure, but we
    +        // need to restore the `._handle` property.
    +        this[_handle]._handle = nativeHandle
    +        nativeHandle.close = originalNativeClose
    +        this[_handle].close = originalClose
    +        // `_processChunk()` adds an 'error' listener. If we don't remove it
    +        // after each call, these handlers start piling up.
    +        this[_handle].removeAllListeners('error')
    +        // make sure OUR error listener is still attached tho
    +      }
    +    }
    +
    +    if (this[_handle])
    +      this[_handle].on('error', er => this[_onError](new ZlibError(er)))
    +
    +    let writeReturn
    +    if (result) {
    +      if (Array.isArray(result) && result.length > 0) {
    +        // The first buffer is always `handle._outBuffer`, which would be
    +        // re-used for later invocations; so, we always have to copy that one.
    +        writeReturn = this[_superWrite](Buffer.from(result[0]))
    +        for (let i = 1; i < result.length; i++) {
    +          writeReturn = this[_superWrite](result[i])
    +        }
    +      } else {
    +        writeReturn = this[_superWrite](Buffer.from(result))
    +      }
    +    }
    +
    +    if (cb)
    +      cb()
    +    return writeReturn
    +  }
    +
    +  [_superWrite] (data) {
    +    return super.write(data)
    +  }
    +}
    +
    +class Zlib extends ZlibBase {
    +  constructor (opts, mode) {
    +    opts = opts || {}
    +
    +    opts.flush = opts.flush || constants.Z_NO_FLUSH
    +    opts.finishFlush = opts.finishFlush || constants.Z_FINISH
    +    super(opts, mode)
    +
    +    this[_fullFlushFlag] = constants.Z_FULL_FLUSH
    +    this[_level] = opts.level
    +    this[_strategy] = opts.strategy
    +  }
    +
    +  params (level, strategy) {
    +    if (this[_sawError])
    +      return
    +
    +    if (!this[_handle])
    +      throw new Error('cannot switch params when binding is closed')
    +
    +    // no way to test this without also not supporting params at all
    +    /* istanbul ignore if */
    +    if (!this[_handle].params)
    +      throw new Error('not supported in this implementation')
    +
    +    if (this[_level] !== level || this[_strategy] !== strategy) {
    +      this.flush(constants.Z_SYNC_FLUSH)
    +      assert(this[_handle], 'zlib binding closed')
    +      // .params() calls .flush(), but the latter is always async in the
    +      // core zlib. We override .flush() temporarily to intercept that and
    +      // flush synchronously.
    +      const origFlush = this[_handle].flush
    +      this[_handle].flush = (flushFlag, cb) => {
    +        this.flush(flushFlag)
    +        cb()
    +      }
    +      try {
    +        this[_handle].params(level, strategy)
    +      } finally {
    +        this[_handle].flush = origFlush
    +      }
    +      /* istanbul ignore else */
    +      if (this[_handle]) {
    +        this[_level] = level
    +        this[_strategy] = strategy
    +      }
    +    }
    +  }
    +}
    +
    +// minimal 2-byte header
    +class Deflate extends Zlib {
    +  constructor (opts) {
    +    super(opts, 'Deflate')
    +  }
    +}
    +
    +class Inflate extends Zlib {
    +  constructor (opts) {
    +    super(opts, 'Inflate')
    +  }
    +}
    +
    +// gzip - bigger header, same deflate compression
    +const _portable = Symbol('_portable')
    +class Gzip extends Zlib {
    +  constructor (opts) {
    +    super(opts, 'Gzip')
    +    this[_portable] = opts && !!opts.portable
    +  }
    +
    +  [_superWrite] (data) {
    +    if (!this[_portable])
    +      return super[_superWrite](data)
    +
    +    // we'll always get the header emitted in one first chunk
    +    // overwrite the OS indicator byte with 0xFF
    +    this[_portable] = false
    +    data[9] = 255
    +    return super[_superWrite](data)
    +  }
    +}
    +
    +class Gunzip extends Zlib {
    +  constructor (opts) {
    +    super(opts, 'Gunzip')
    +  }
    +}
    +
    +// raw - no header
    +class DeflateRaw extends Zlib {
    +  constructor (opts) {
    +    super(opts, 'DeflateRaw')
    +  }
    +}
    +
    +class InflateRaw extends Zlib {
    +  constructor (opts) {
    +    super(opts, 'InflateRaw')
    +  }
    +}
    +
    +// auto-detect header.
    +class Unzip extends Zlib {
    +  constructor (opts) {
    +    super(opts, 'Unzip')
    +  }
    +}
    +
    +class Brotli extends ZlibBase {
    +  constructor (opts, mode) {
    +    opts = opts || {}
    +
    +    opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS
    +    opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH
    +
    +    super(opts, mode)
    +
    +    this[_fullFlushFlag] = constants.BROTLI_OPERATION_FLUSH
    +  }
    +}
    +
    +class BrotliCompress extends Brotli {
    +  constructor (opts) {
    +    super(opts, 'BrotliCompress')
    +  }
    +}
    +
    +class BrotliDecompress extends Brotli {
    +  constructor (opts) {
    +    super(opts, 'BrotliDecompress')
    +  }
    +}
    +
    +exports.Deflate = Deflate
    +exports.Inflate = Inflate
    +exports.Gzip = Gzip
    +exports.Gunzip = Gunzip
    +exports.DeflateRaw = DeflateRaw
    +exports.InflateRaw = InflateRaw
    +exports.Unzip = Unzip
    +/* istanbul ignore else */
    +if (typeof realZlib.BrotliCompress === 'function') {
    +  exports.BrotliCompress = BrotliCompress
    +  exports.BrotliDecompress = BrotliDecompress
    +} else {
    +  exports.BrotliCompress = exports.BrotliDecompress = class {
    +    constructor () {
    +      throw new Error('Brotli is not supported in this version of Node.js')
    +    }
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/minizlib/node_modules/minipass/LICENSE b/node_modules/npm/node_modules/minizlib/node_modules/minipass/LICENSE
    new file mode 100644
    index 00000000..bf1dece2
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minizlib/node_modules/minipass/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/minizlib/node_modules/minipass/index.js b/node_modules/npm/node_modules/minizlib/node_modules/minipass/index.js
    new file mode 100644
    index 00000000..e8797aab
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minizlib/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/npm/node_modules/minizlib/node_modules/minipass/package.json b/node_modules/npm/node_modules/minizlib/node_modules/minipass/package.json
    new file mode 100644
    index 00000000..548d03fa
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minizlib/node_modules/minipass/package.json
    @@ -0,0 +1,56 @@
    +{
    +  "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/npm/node_modules/minizlib/package.json b/node_modules/npm/node_modules/minizlib/package.json
    new file mode 100644
    index 00000000..98825a54
    --- /dev/null
    +++ b/node_modules/npm/node_modules/minizlib/package.json
    @@ -0,0 +1,42 @@
    +{
    +  "name": "minizlib",
    +  "version": "2.1.2",
    +  "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
    +  "main": "index.js",
    +  "dependencies": {
    +    "minipass": "^3.0.0",
    +    "yallist": "^4.0.0"
    +  },
    +  "scripts": {
    +    "test": "tap test/*.js --100 -J",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "postpublish": "git push origin --all; git push origin --tags"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/isaacs/minizlib.git"
    +  },
    +  "keywords": [
    +    "zlib",
    +    "gzip",
    +    "gunzip",
    +    "deflate",
    +    "inflate",
    +    "compression",
    +    "zip",
    +    "unzip"
    +  ],
    +  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
    +  "license": "MIT",
    +  "devDependencies": {
    +    "tap": "^14.6.9"
    +  },
    +  "files": [
    +    "index.js",
    +    "constants.js"
    +  ],
    +  "engines": {
    +    "node": ">= 8"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/mkdirp/LICENSE b/node_modules/npm/node_modules/mkdirp/LICENSE
    new file mode 100644
    index 00000000..13fcd15f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/LICENSE
    @@ -0,0 +1,21 @@
    +Copyright James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me)
    +
    +This project is free software 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/npm/node_modules/mkdirp/bin/cmd.js b/node_modules/npm/node_modules/mkdirp/bin/cmd.js
    new file mode 100755
    index 00000000..6e0aa8dc
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/bin/cmd.js
    @@ -0,0 +1,68 @@
    +#!/usr/bin/env node
    +
    +const usage = () => `
    +usage: mkdirp [DIR1,DIR2..] {OPTIONS}
    +
    +  Create each supplied directory including any necessary parent directories
    +  that don't yet exist.
    +
    +  If the directory already exists, do nothing.
    +
    +OPTIONS are:
    +
    +  -m       If a directory needs to be created, set the mode as an octal
    +  --mode=  permission string.
    +
    +  -v --version   Print the mkdirp version number
    +
    +  -h --help      Print this helpful banner
    +
    +  -p --print     Print the first directories created for each path provided
    +
    +  --manual       Use manual implementation, even if native is available
    +`
    +
    +const dirs = []
    +const opts = {}
    +let print = false
    +let dashdash = false
    +let manual = false
    +for (const arg of process.argv.slice(2)) {
    +  if (dashdash)
    +    dirs.push(arg)
    +  else if (arg === '--')
    +    dashdash = true
    +  else if (arg === '--manual')
    +    manual = true
    +  else if (/^-h/.test(arg) || /^--help/.test(arg)) {
    +    console.log(usage())
    +    process.exit(0)
    +  } else if (arg === '-v' || arg === '--version') {
    +    console.log(require('../package.json').version)
    +    process.exit(0)
    +  } else if (arg === '-p' || arg === '--print') {
    +    print = true
    +  } else if (/^-m/.test(arg) || /^--mode=/.test(arg)) {
    +    const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8)
    +    if (isNaN(mode)) {
    +      console.error(`invalid mode argument: ${arg}\nMust be an octal number.`)
    +      process.exit(1)
    +    }
    +    opts.mode = mode
    +  } else
    +    dirs.push(arg)
    +}
    +
    +const mkdirp = require('../')
    +const impl = manual ? mkdirp.manual : mkdirp
    +if (dirs.length === 0)
    +  console.error(usage())
    +
    +Promise.all(dirs.map(dir => impl(dir, opts)))
    +  .then(made => print ? made.forEach(m => m && console.log(m)) : null)
    +  .catch(er => {
    +    console.error(er.message)
    +    if (er.code)
    +      console.error('  code: ' + er.code)
    +    process.exit(1)
    +  })
    diff --git a/node_modules/npm/node_modules/mkdirp/index.js b/node_modules/npm/node_modules/mkdirp/index.js
    new file mode 100644
    index 00000000..ad7a16c9
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/index.js
    @@ -0,0 +1,31 @@
    +const optsArg = require('./lib/opts-arg.js')
    +const pathArg = require('./lib/path-arg.js')
    +
    +const {mkdirpNative, mkdirpNativeSync} = require('./lib/mkdirp-native.js')
    +const {mkdirpManual, mkdirpManualSync} = require('./lib/mkdirp-manual.js')
    +const {useNative, useNativeSync} = require('./lib/use-native.js')
    +
    +
    +const mkdirp = (path, opts) => {
    +  path = pathArg(path)
    +  opts = optsArg(opts)
    +  return useNative(opts)
    +    ? mkdirpNative(path, opts)
    +    : mkdirpManual(path, opts)
    +}
    +
    +const mkdirpSync = (path, opts) => {
    +  path = pathArg(path)
    +  opts = optsArg(opts)
    +  return useNativeSync(opts)
    +    ? mkdirpNativeSync(path, opts)
    +    : mkdirpManualSync(path, opts)
    +}
    +
    +mkdirp.sync = mkdirpSync
    +mkdirp.native = (path, opts) => mkdirpNative(pathArg(path), optsArg(opts))
    +mkdirp.manual = (path, opts) => mkdirpManual(pathArg(path), optsArg(opts))
    +mkdirp.nativeSync = (path, opts) => mkdirpNativeSync(pathArg(path), optsArg(opts))
    +mkdirp.manualSync = (path, opts) => mkdirpManualSync(pathArg(path), optsArg(opts))
    +
    +module.exports = mkdirp
    diff --git a/node_modules/npm/node_modules/mkdirp/lib/find-made.js b/node_modules/npm/node_modules/mkdirp/lib/find-made.js
    new file mode 100644
    index 00000000..022e492c
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/lib/find-made.js
    @@ -0,0 +1,29 @@
    +const {dirname} = require('path')
    +
    +const findMade = (opts, parent, path = undefined) => {
    +  // we never want the 'made' return value to be a root directory
    +  if (path === parent)
    +    return Promise.resolve()
    +
    +  return opts.statAsync(parent).then(
    +    st => st.isDirectory() ? path : undefined, // will fail later
    +    er => er.code === 'ENOENT'
    +      ? findMade(opts, dirname(parent), parent)
    +      : undefined
    +  )
    +}
    +
    +const findMadeSync = (opts, parent, path = undefined) => {
    +  if (path === parent)
    +    return undefined
    +
    +  try {
    +    return opts.statSync(parent).isDirectory() ? path : undefined
    +  } catch (er) {
    +    return er.code === 'ENOENT'
    +      ? findMadeSync(opts, dirname(parent), parent)
    +      : undefined
    +  }
    +}
    +
    +module.exports = {findMade, findMadeSync}
    diff --git a/node_modules/npm/node_modules/mkdirp/lib/mkdirp-manual.js b/node_modules/npm/node_modules/mkdirp/lib/mkdirp-manual.js
    new file mode 100644
    index 00000000..2eb18cd6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/lib/mkdirp-manual.js
    @@ -0,0 +1,64 @@
    +const {dirname} = require('path')
    +
    +const mkdirpManual = (path, opts, made) => {
    +  opts.recursive = false
    +  const parent = dirname(path)
    +  if (parent === path) {
    +    return opts.mkdirAsync(path, opts).catch(er => {
    +      // swallowed by recursive implementation on posix systems
    +      // any other error is a failure
    +      if (er.code !== 'EISDIR')
    +        throw er
    +    })
    +  }
    +
    +  return opts.mkdirAsync(path, opts).then(() => made || path, er => {
    +    if (er.code === 'ENOENT')
    +      return mkdirpManual(parent, opts)
    +        .then(made => mkdirpManual(path, opts, made))
    +    if (er.code !== 'EEXIST' && er.code !== 'EROFS')
    +      throw er
    +    return opts.statAsync(path).then(st => {
    +      if (st.isDirectory())
    +        return made
    +      else
    +        throw er
    +    }, () => { throw er })
    +  })
    +}
    +
    +const mkdirpManualSync = (path, opts, made) => {
    +  const parent = dirname(path)
    +  opts.recursive = false
    +
    +  if (parent === path) {
    +    try {
    +      return opts.mkdirSync(path, opts)
    +    } catch (er) {
    +      // swallowed by recursive implementation on posix systems
    +      // any other error is a failure
    +      if (er.code !== 'EISDIR')
    +        throw er
    +      else
    +        return
    +    }
    +  }
    +
    +  try {
    +    opts.mkdirSync(path, opts)
    +    return made || path
    +  } catch (er) {
    +    if (er.code === 'ENOENT')
    +      return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))
    +    if (er.code !== 'EEXIST' && er.code !== 'EROFS')
    +      throw er
    +    try {
    +      if (!opts.statSync(path).isDirectory())
    +        throw er
    +    } catch (_) {
    +      throw er
    +    }
    +  }
    +}
    +
    +module.exports = {mkdirpManual, mkdirpManualSync}
    diff --git a/node_modules/npm/node_modules/mkdirp/lib/mkdirp-native.js b/node_modules/npm/node_modules/mkdirp/lib/mkdirp-native.js
    new file mode 100644
    index 00000000..c7a6b698
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/lib/mkdirp-native.js
    @@ -0,0 +1,39 @@
    +const {dirname} = require('path')
    +const {findMade, findMadeSync} = require('./find-made.js')
    +const {mkdirpManual, mkdirpManualSync} = require('./mkdirp-manual.js')
    +
    +const mkdirpNative = (path, opts) => {
    +  opts.recursive = true
    +  const parent = dirname(path)
    +  if (parent === path)
    +    return opts.mkdirAsync(path, opts)
    +
    +  return findMade(opts, path).then(made =>
    +    opts.mkdirAsync(path, opts).then(() => made)
    +    .catch(er => {
    +      if (er.code === 'ENOENT')
    +        return mkdirpManual(path, opts)
    +      else
    +        throw er
    +    }))
    +}
    +
    +const mkdirpNativeSync = (path, opts) => {
    +  opts.recursive = true
    +  const parent = dirname(path)
    +  if (parent === path)
    +    return opts.mkdirSync(path, opts)
    +
    +  const made = findMadeSync(opts, path)
    +  try {
    +    opts.mkdirSync(path, opts)
    +    return made
    +  } catch (er) {
    +    if (er.code === 'ENOENT')
    +      return mkdirpManualSync(path, opts)
    +    else
    +      throw er
    +  }
    +}
    +
    +module.exports = {mkdirpNative, mkdirpNativeSync}
    diff --git a/node_modules/npm/node_modules/mkdirp/lib/opts-arg.js b/node_modules/npm/node_modules/mkdirp/lib/opts-arg.js
    new file mode 100644
    index 00000000..2fa4833f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/lib/opts-arg.js
    @@ -0,0 +1,23 @@
    +const { promisify } = require('util')
    +const fs = require('fs')
    +const optsArg = opts => {
    +  if (!opts)
    +    opts = { mode: 0o777, fs }
    +  else if (typeof opts === 'object')
    +    opts = { mode: 0o777, fs, ...opts }
    +  else if (typeof opts === 'number')
    +    opts = { mode: opts, fs }
    +  else if (typeof opts === 'string')
    +    opts = { mode: parseInt(opts, 8), fs }
    +  else
    +    throw new TypeError('invalid options argument')
    +
    +  opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir
    +  opts.mkdirAsync = promisify(opts.mkdir)
    +  opts.stat = opts.stat || opts.fs.stat || fs.stat
    +  opts.statAsync = promisify(opts.stat)
    +  opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync
    +  opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync
    +  return opts
    +}
    +module.exports = optsArg
    diff --git a/node_modules/npm/node_modules/mkdirp/lib/path-arg.js b/node_modules/npm/node_modules/mkdirp/lib/path-arg.js
    new file mode 100644
    index 00000000..cc07de5a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/lib/path-arg.js
    @@ -0,0 +1,29 @@
    +const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform
    +const { resolve, parse } = require('path')
    +const pathArg = path => {
    +  if (/\0/.test(path)) {
    +    // simulate same failure that node raises
    +    throw Object.assign(
    +      new TypeError('path must be a string without null bytes'),
    +      {
    +        path,
    +        code: 'ERR_INVALID_ARG_VALUE',
    +      }
    +    )
    +  }
    +
    +  path = resolve(path)
    +  if (platform === 'win32') {
    +    const badWinChars = /[*|"<>?:]/
    +    const {root} = parse(path)
    +    if (badWinChars.test(path.substr(root.length))) {
    +      throw Object.assign(new Error('Illegal characters in path.'), {
    +        path,
    +        code: 'EINVAL',
    +      })
    +    }
    +  }
    +
    +  return path
    +}
    +module.exports = pathArg
    diff --git a/node_modules/npm/node_modules/mkdirp/lib/use-native.js b/node_modules/npm/node_modules/mkdirp/lib/use-native.js
    new file mode 100644
    index 00000000..079361de
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/lib/use-native.js
    @@ -0,0 +1,10 @@
    +const fs = require('fs')
    +
    +const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version
    +const versArr = version.replace(/^v/, '').split('.')
    +const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12
    +
    +const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir
    +const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync
    +
    +module.exports = {useNative, useNativeSync}
    diff --git a/node_modules/npm/node_modules/mkdirp/package.json b/node_modules/npm/node_modules/mkdirp/package.json
    new file mode 100644
    index 00000000..2913ed09
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/package.json
    @@ -0,0 +1,44 @@
    +{
    +  "name": "mkdirp",
    +  "description": "Recursively mkdir, like `mkdir -p`",
    +  "version": "1.0.4",
    +  "main": "index.js",
    +  "keywords": [
    +    "mkdir",
    +    "directory",
    +    "make dir",
    +    "make",
    +    "dir",
    +    "recursive",
    +    "native"
    +  ],
    +  "repository": {
    +    "type": "git",
    +    "url": "https://github.com/isaacs/node-mkdirp.git"
    +  },
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "postpublish": "git push origin --follow-tags"
    +  },
    +  "tap": {
    +    "check-coverage": true,
    +    "coverage-map": "map.js"
    +  },
    +  "devDependencies": {
    +    "require-inject": "^1.4.4",
    +    "tap": "^14.10.7"
    +  },
    +  "bin": "bin/cmd.js",
    +  "license": "MIT",
    +  "engines": {
    +    "node": ">=10"
    +  },
    +  "files": [
    +    "bin",
    +    "lib",
    +    "index.js"
    +  ]
    +}
    diff --git a/node_modules/npm/node_modules/mkdirp/readme.markdown b/node_modules/npm/node_modules/mkdirp/readme.markdown
    new file mode 100644
    index 00000000..827de590
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mkdirp/readme.markdown
    @@ -0,0 +1,266 @@
    +# mkdirp
    +
    +Like `mkdir -p`, but in Node.js!
    +
    +Now with a modern API and no\* bugs!
    +
    +\* may contain some bugs
    +
    +# example
    +
    +## pow.js
    +
    +```js
    +const mkdirp = require('mkdirp')
    +
    +// return value is a Promise resolving to the first directory created
    +mkdirp('/tmp/foo/bar/baz').then(made =>
    +  console.log(`made directories, starting with ${made}`))
    +```
    +
    +Output (where `/tmp/foo` already exists)
    +
    +```
    +made directories, starting with /tmp/foo/bar
    +```
    +
    +Or, if you don't have time to wait around for promises:
    +
    +```js
    +const mkdirp = require('mkdirp')
    +
    +// return value is the first directory created
    +const made = mkdirp.sync('/tmp/foo/bar/baz')
    +console.log(`made directories, starting with ${made}`)
    +```
    +
    +And now /tmp/foo/bar/baz exists, huzzah!
    +
    +# methods
    +
    +```js
    +const mkdirp = require('mkdirp')
    +```
    +
    +## mkdirp(dir, [opts]) -> Promise
    +
    +Create a new directory and any necessary subdirectories at `dir` with octal
    +permission string `opts.mode`. If `opts` is a string or number, it will be
    +treated as the `opts.mode`.
    +
    +If `opts.mode` isn't specified, it defaults to `0o777 &
    +(~process.umask())`.
    +
    +Promise resolves to first directory `made` that had to be created, or
    +`undefined` if everything already exists.  Promise rejects if any errors
    +are encountered.  Note that, in the case of promise rejection, some
    +directories _may_ have been created, as recursive directory creation is not
    +an atomic operation.
    +
    +You can optionally pass in an alternate `fs` implementation by passing in
    +`opts.fs`. Your implementation should have `opts.fs.mkdir(path, opts, cb)`
    +and `opts.fs.stat(path, cb)`.
    +
    +You can also override just one or the other of `mkdir` and `stat` by
    +passing in `opts.stat` or `opts.mkdir`, or providing an `fs` option that
    +only overrides one of these.
    +
    +## mkdirp.sync(dir, opts) -> String|null
    +
    +Synchronously create a new directory and any necessary subdirectories at
    +`dir` with octal permission string `opts.mode`. If `opts` is a string or
    +number, it will be treated as the `opts.mode`.
    +
    +If `opts.mode` isn't specified, it defaults to `0o777 &
    +(~process.umask())`.
    +
    +Returns the first directory that had to be created, or undefined if
    +everything already exists.
    +
    +You can optionally pass in an alternate `fs` implementation by passing in
    +`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)`
    +and `opts.fs.statSync(path)`.
    +
    +You can also override just one or the other of `mkdirSync` and `statSync`
    +by passing in `opts.statSync` or `opts.mkdirSync`, or providing an `fs`
    +option that only overrides one of these.
    +
    +## mkdirp.manual, mkdirp.manualSync
    +
    +Use the manual implementation (not the native one).  This is the default
    +when the native implementation is not available or the stat/mkdir
    +implementation is overridden.
    +
    +## mkdirp.native, mkdirp.nativeSync
    +
    +Use the native implementation (not the manual one).  This is the default
    +when the native implementation is available and stat/mkdir are not
    +overridden.
    +
    +# implementation
    +
    +On Node.js v10.12.0 and above, use the native `fs.mkdir(p,
    +{recursive:true})` option, unless `fs.mkdir`/`fs.mkdirSync` has been
    +overridden by an option.
    +
    +## native implementation
    +
    +- If the path is a root directory, then pass it to the underlying
    +  implementation and return the result/error.  (In this case, it'll either
    +  succeed or fail, but we aren't actually creating any dirs.)
    +- Walk up the path statting each directory, to find the first path that
    +  will be created, `made`.
    +- Call `fs.mkdir(path, { recursive: true })` (or `fs.mkdirSync`)
    +- If error, raise it to the caller.
    +- Return `made`.
    +
    +## manual implementation
    +
    +- Call underlying `fs.mkdir` implementation, with `recursive: false`
    +- If error:
    +  - If path is a root directory, raise to the caller and do not handle it
    +  - If ENOENT, mkdirp parent dir, store result as `made`
    +  - stat(path)
    +    - If error, raise original `mkdir` error
    +    - If directory, return `made`
    +    - Else, raise original `mkdir` error
    +- else
    +  - return `undefined` if a root dir, or `made` if set, or `path`
    +
    +## windows vs unix caveat
    +
    +On Windows file systems, attempts to create a root directory (ie, a drive
    +letter or root UNC path) will fail.  If the root directory exists, then it
    +will fail with `EPERM`.  If the root directory does not exist, then it will
    +fail with `ENOENT`.
    +
    +On posix file systems, attempts to create a root directory (in recursive
    +mode) will succeed silently, as it is treated like just another directory
    +that already exists.  (In non-recursive mode, of course, it fails with
    +`EEXIST`.)
    +
    +In order to preserve this system-specific behavior (and because it's not as
    +if we can create the parent of a root directory anyway), attempts to create
    +a root directory are passed directly to the `fs` implementation, and any
    +errors encountered are not handled.
    +
    +## native error caveat
    +
    +The native implementation (as of at least Node.js v13.4.0) does not provide
    +appropriate errors in some cases (see
    +[nodejs/node#31481](https://github.com/nodejs/node/issues/31481) and
    +[nodejs/node#28015](https://github.com/nodejs/node/issues/28015)).
    +
    +In order to work around this issue, the native implementation will fall
    +back to the manual implementation if an `ENOENT` error is encountered.
    +
    +# choosing a recursive mkdir implementation
    +
    +There are a few to choose from!  Use the one that suits your needs best :D
    +
    +## use `fs.mkdir(path, {recursive: true}, cb)` if:
    +
    +- You wish to optimize performance even at the expense of other factors.
    +- You don't need to know the first dir created.
    +- You are ok with getting `ENOENT` as the error when some other problem is
    +  the actual cause.
    +- You can limit your platforms to Node.js v10.12 and above.
    +- You're ok with using callbacks instead of promises.
    +- You don't need/want a CLI.
    +- You don't need to override the `fs` methods in use.
    +
    +## use this module (mkdirp 1.x) if:
    +
    +- You need to know the first directory that was created.
    +- You wish to use the native implementation if available, but fall back
    +  when it's not.
    +- You prefer promise-returning APIs to callback-taking APIs.
    +- You want more useful error messages than the native recursive mkdir
    +  provides (at least as of Node.js v13.4), and are ok with re-trying on
    +  `ENOENT` to achieve this.
    +- You need (or at least, are ok with) a CLI.
    +- You need to override the `fs` methods in use.
    +
    +## use [`make-dir`](http://npm.im/make-dir) if:
    +
    +- You do not need to know the first dir created (and wish to save a few
    +  `stat` calls when using the native implementation for this reason).
    +- You wish to use the native implementation if available, but fall back
    +  when it's not.
    +- You prefer promise-returning APIs to callback-taking APIs.
    +- You are ok with occasionally getting `ENOENT` errors for failures that
    +  are actually related to something other than a missing file system entry.
    +- You don't need/want a CLI.
    +- You need to override the `fs` methods in use.
    +
    +## use mkdirp 0.x if:
    +
    +- You need to know the first directory that was created.
    +- You need (or at least, are ok with) a CLI.
    +- You need to override the `fs` methods in use.
    +- You're ok with using callbacks instead of promises.
    +- You are not running on Windows, where the root-level ENOENT errors can
    +  lead to infinite regress.
    +- You think vinyl just sounds warmer and richer for some weird reason.
    +- You are supporting truly ancient Node.js versions, before even the advent
    +  of a `Promise` language primitive.  (Please don't.  You deserve better.)
    +
    +# cli
    +
    +This package also ships with a `mkdirp` command.
    +
    +```
    +$ mkdirp -h
    +
    +usage: mkdirp [DIR1,DIR2..] {OPTIONS}
    +
    +  Create each supplied directory including any necessary parent directories
    +  that don't yet exist.
    +
    +  If the directory already exists, do nothing.
    +
    +OPTIONS are:
    +
    +  -m       If a directory needs to be created, set the mode as an octal
    +  --mode=  permission string.
    +
    +  -v --version   Print the mkdirp version number
    +
    +  -h --help      Print this helpful banner
    +
    +  -p --print     Print the first directories created for each path provided
    +
    +  --manual       Use manual implementation, even if native is available
    +```
    +
    +# install
    +
    +With [npm](http://npmjs.org) do:
    +
    +```
    +npm install mkdirp
    +```
    +
    +to get the library locally, or
    +
    +```
    +npm install -g mkdirp
    +```
    +
    +to get the command everywhere, or
    +
    +```
    +npx mkdirp ...
    +```
    +
    +to run the command without installing it globally.
    +
    +# platform support
    +
    +This module works on node v8, but only v10 and above are officially
    +supported, as Node v8 reached its LTS end of life 2020-01-01, which is in
    +the past, as of this writing.
    +
    +# license
    +
    +MIT
    diff --git a/node_modules/npm/node_modules/ms/index.js b/node_modules/npm/node_modules/ms/index.js
    new file mode 100644
    index 00000000..ea734fb7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/ms/index.js
    @@ -0,0 +1,162 @@
    +/**
    + * Helpers.
    + */
    +
    +var s = 1000;
    +var m = s * 60;
    +var h = m * 60;
    +var d = h * 24;
    +var w = d * 7;
    +var y = d * 365.25;
    +
    +/**
    + * Parse or format the given `val`.
    + *
    + * Options:
    + *
    + *  - `long` verbose formatting [false]
    + *
    + * @param {String|Number} val
    + * @param {Object} [options]
    + * @throws {Error} throw an error if val is not a non-empty string or a number
    + * @return {String|Number}
    + * @api public
    + */
    +
    +module.exports = function (val, options) {
    +  options = options || {};
    +  var type = typeof val;
    +  if (type === 'string' && val.length > 0) {
    +    return parse(val);
    +  } else if (type === 'number' && isFinite(val)) {
    +    return options.long ? fmtLong(val) : fmtShort(val);
    +  }
    +  throw new Error(
    +    'val is not a non-empty string or a valid number. val=' +
    +      JSON.stringify(val)
    +  );
    +};
    +
    +/**
    + * Parse the given `str` and return milliseconds.
    + *
    + * @param {String} str
    + * @return {Number}
    + * @api private
    + */
    +
    +function parse(str) {
    +  str = String(str);
    +  if (str.length > 100) {
    +    return;
    +  }
    +  var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
    +    str
    +  );
    +  if (!match) {
    +    return;
    +  }
    +  var n = parseFloat(match[1]);
    +  var type = (match[2] || 'ms').toLowerCase();
    +  switch (type) {
    +    case 'years':
    +    case 'year':
    +    case 'yrs':
    +    case 'yr':
    +    case 'y':
    +      return n * y;
    +    case 'weeks':
    +    case 'week':
    +    case 'w':
    +      return n * w;
    +    case 'days':
    +    case 'day':
    +    case 'd':
    +      return n * d;
    +    case 'hours':
    +    case 'hour':
    +    case 'hrs':
    +    case 'hr':
    +    case 'h':
    +      return n * h;
    +    case 'minutes':
    +    case 'minute':
    +    case 'mins':
    +    case 'min':
    +    case 'm':
    +      return n * m;
    +    case 'seconds':
    +    case 'second':
    +    case 'secs':
    +    case 'sec':
    +    case 's':
    +      return n * s;
    +    case 'milliseconds':
    +    case 'millisecond':
    +    case 'msecs':
    +    case 'msec':
    +    case 'ms':
    +      return n;
    +    default:
    +      return undefined;
    +  }
    +}
    +
    +/**
    + * Short format for `ms`.
    + *
    + * @param {Number} ms
    + * @return {String}
    + * @api private
    + */
    +
    +function fmtShort(ms) {
    +  var msAbs = Math.abs(ms);
    +  if (msAbs >= d) {
    +    return Math.round(ms / d) + 'd';
    +  }
    +  if (msAbs >= h) {
    +    return Math.round(ms / h) + 'h';
    +  }
    +  if (msAbs >= m) {
    +    return Math.round(ms / m) + 'm';
    +  }
    +  if (msAbs >= s) {
    +    return Math.round(ms / s) + 's';
    +  }
    +  return ms + 'ms';
    +}
    +
    +/**
    + * Long format for `ms`.
    + *
    + * @param {Number} ms
    + * @return {String}
    + * @api private
    + */
    +
    +function fmtLong(ms) {
    +  var msAbs = Math.abs(ms);
    +  if (msAbs >= d) {
    +    return plural(ms, msAbs, d, 'day');
    +  }
    +  if (msAbs >= h) {
    +    return plural(ms, msAbs, h, 'hour');
    +  }
    +  if (msAbs >= m) {
    +    return plural(ms, msAbs, m, 'minute');
    +  }
    +  if (msAbs >= s) {
    +    return plural(ms, msAbs, s, 'second');
    +  }
    +  return ms + ' ms';
    +}
    +
    +/**
    + * Pluralization helper.
    + */
    +
    +function plural(ms, msAbs, n, name) {
    +  var isPlural = msAbs >= n * 1.5;
    +  return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
    +}
    diff --git a/node_modules/npm/node_modules/ms/license.md b/node_modules/npm/node_modules/ms/license.md
    new file mode 100644
    index 00000000..fa5d39b6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/ms/license.md
    @@ -0,0 +1,21 @@
    +The MIT License (MIT)
    +
    +Copyright (c) 2020 Vercel, 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/npm/node_modules/ms/package.json b/node_modules/npm/node_modules/ms/package.json
    new file mode 100644
    index 00000000..49971890
    --- /dev/null
    +++ b/node_modules/npm/node_modules/ms/package.json
    @@ -0,0 +1,38 @@
    +{
    +  "name": "ms",
    +  "version": "2.1.3",
    +  "description": "Tiny millisecond conversion utility",
    +  "repository": "vercel/ms",
    +  "main": "./index",
    +  "files": [
    +    "index.js"
    +  ],
    +  "scripts": {
    +    "precommit": "lint-staged",
    +    "lint": "eslint lib/* bin/*",
    +    "test": "mocha tests.js"
    +  },
    +  "eslintConfig": {
    +    "extends": "eslint:recommended",
    +    "env": {
    +      "node": true,
    +      "es6": true
    +    }
    +  },
    +  "lint-staged": {
    +    "*.js": [
    +      "npm run lint",
    +      "prettier --single-quote --write",
    +      "git add"
    +    ]
    +  },
    +  "license": "MIT",
    +  "devDependencies": {
    +    "eslint": "4.18.2",
    +    "expect.js": "0.3.1",
    +    "husky": "0.14.3",
    +    "lint-staged": "5.0.0",
    +    "mocha": "4.0.1",
    +    "prettier": "2.0.5"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/mute-stream/LICENSE b/node_modules/npm/node_modules/mute-stream/LICENSE
    new file mode 100644
    index 00000000..19129e31
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mute-stream/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/mute-stream/lib/index.js b/node_modules/npm/node_modules/mute-stream/lib/index.js
    new file mode 100644
    index 00000000..368f727e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mute-stream/lib/index.js
    @@ -0,0 +1,142 @@
    +const Stream = require('stream')
    +
    +class MuteStream extends Stream {
    +  #isTTY = null
    +
    +  constructor (opts = {}) {
    +    super(opts)
    +    this.writable = this.readable = true
    +    this.muted = false
    +    this.on('pipe', this._onpipe)
    +    this.replace = opts.replace
    +
    +    // For readline-type situations
    +    // This much at the start of a line being redrawn after a ctrl char
    +    // is seen (such as backspace) won't be redrawn as the replacement
    +    this._prompt = opts.prompt || null
    +    this._hadControl = false
    +  }
    +
    +  #destSrc (key, def) {
    +    if (this._dest) {
    +      return this._dest[key]
    +    }
    +    if (this._src) {
    +      return this._src[key]
    +    }
    +    return def
    +  }
    +
    +  #proxy (method, ...args) {
    +    if (typeof this._dest?.[method] === 'function') {
    +      this._dest[method](...args)
    +    }
    +    if (typeof this._src?.[method] === 'function') {
    +      this._src[method](...args)
    +    }
    +  }
    +
    +  get isTTY () {
    +    if (this.#isTTY !== null) {
    +      return this.#isTTY
    +    }
    +    return this.#destSrc('isTTY', false)
    +  }
    +
    +  // basically just get replace the getter/setter with a regular value
    +  set isTTY (val) {
    +    this.#isTTY = val
    +  }
    +
    +  get rows () {
    +    return this.#destSrc('rows')
    +  }
    +
    +  get columns () {
    +    return this.#destSrc('columns')
    +  }
    +
    +  mute () {
    +    this.muted = true
    +  }
    +
    +  unmute () {
    +    this.muted = false
    +  }
    +
    +  _onpipe (src) {
    +    this._src = src
    +  }
    +
    +  pipe (dest, options) {
    +    this._dest = dest
    +    return super.pipe(dest, options)
    +  }
    +
    +  pause () {
    +    if (this._src) {
    +      return this._src.pause()
    +    }
    +  }
    +
    +  resume () {
    +    if (this._src) {
    +      return this._src.resume()
    +    }
    +  }
    +
    +  write (c) {
    +    if (this.muted) {
    +      if (!this.replace) {
    +        return true
    +      }
    +      // eslint-disable-next-line no-control-regex
    +      if (c.match(/^\u001b/)) {
    +        if (c.indexOf(this._prompt) === 0) {
    +          c = c.slice(this._prompt.length)
    +          c = c.replace(/./g, this.replace)
    +          c = this._prompt + c
    +        }
    +        this._hadControl = true
    +        return this.emit('data', c)
    +      } else {
    +        if (this._prompt && this._hadControl &&
    +          c.indexOf(this._prompt) === 0) {
    +          this._hadControl = false
    +          this.emit('data', this._prompt)
    +          c = c.slice(this._prompt.length)
    +        }
    +        c = c.toString().replace(/./g, this.replace)
    +      }
    +    }
    +    this.emit('data', c)
    +  }
    +
    +  end (c) {
    +    if (this.muted) {
    +      if (c && this.replace) {
    +        c = c.toString().replace(/./g, this.replace)
    +      } else {
    +        c = null
    +      }
    +    }
    +    if (c) {
    +      this.emit('data', c)
    +    }
    +    this.emit('end')
    +  }
    +
    +  destroy (...args) {
    +    return this.#proxy('destroy', ...args)
    +  }
    +
    +  destroySoon (...args) {
    +    return this.#proxy('destroySoon', ...args)
    +  }
    +
    +  close (...args) {
    +    return this.#proxy('close', ...args)
    +  }
    +}
    +
    +module.exports = MuteStream
    diff --git a/node_modules/npm/node_modules/mute-stream/package.json b/node_modules/npm/node_modules/mute-stream/package.json
    new file mode 100644
    index 00000000..3725daf0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/mute-stream/package.json
    @@ -0,0 +1,54 @@
    +{
    +  "name": "mute-stream",
    +  "version": "2.0.0",
    +  "main": "lib/index.js",
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "tap": "^16.3.0"
    +  },
    +  "scripts": {
    +    "test": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "lintfix": "npm run eslint -- --fix",
    +    "snap": "tap",
    +    "posttest": "npm run lint",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/mute-stream.git"
    +  },
    +  "keywords": [
    +    "mute",
    +    "stream",
    +    "pipe"
    +  ],
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "description": "Bytes go in, but they don't come out (when muted).",
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "tap": {
    +    "statements": 70,
    +    "branches": 60,
    +    "functions": 81,
    +    "lines": 70,
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": true
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/.release-please-manifest.json b/node_modules/npm/node_modules/node-gyp/.release-please-manifest.json
    new file mode 100644
    index 00000000..26a3463a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/.release-please-manifest.json
    @@ -0,0 +1,3 @@
    +{
    +    ".": "11.0.0"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/CHANGELOG.md b/node_modules/npm/node_modules/node-gyp/CHANGELOG.md
    new file mode 100644
    index 00000000..8374a920
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/CHANGELOG.md
    @@ -0,0 +1,1003 @@
    +# Changelog
    +
    +## [11.0.0](https://github.com/nodejs/node-gyp/compare/v10.3.1...v11.0.0) (2024-12-03)
    +
    +
    +### ⚠ BREAKING CHANGES
    +
    +* drop node 16 support ([#3102](https://github.com/nodejs/node-gyp/issues/3102))
    +
    +### Features
    +
    +* drop node 16 support ([#3102](https://github.com/nodejs/node-gyp/issues/3102)) ([0e6b6f8](https://github.com/nodejs/node-gyp/commit/0e6b6f8bea615cf031d76ecff9102a38e5474c72))
    +
    +
    +### Miscellaneous
    +
    +* migrate from standard to neostandard ([#3103](https://github.com/nodejs/node-gyp/issues/3103)) ([a130178](https://github.com/nodejs/node-gyp/commit/a13017807d0ae7da8fa076b0bcf23153af7c60a6))
    +
    +## [10.3.1](https://github.com/nodejs/node-gyp/compare/v10.3.0...v10.3.1) (2024-12-02)
    +
    +
    +### Miscellaneous
    +
    +* fix npm-publish dependencies and add provenance ([#3099](https://github.com/nodejs/node-gyp/issues/3099)) ([6dded88](https://github.com/nodejs/node-gyp/commit/6dded88065872a32f44114e60731ba4b701ec057))
    +
    +## [10.3.0](https://github.com/nodejs/node-gyp/compare/v10.2.0...v10.3.0) (2024-11-29)
    +
    +
    +### Features
    +
    +* prohibit compiling with ClangCL on Windows ([#3098](https://github.com/nodejs/node-gyp/issues/3098)) ([88260bf](https://github.com/nodejs/node-gyp/commit/88260bf86aeb4c39959b78104a5edc3dc88d3aef))
    +
    +
    +### Bug Fixes
    +
    +* **ci:** use correct release-please-action domain after organization url was changed ([#3032](https://github.com/nodejs/node-gyp/issues/3032)) ([d1ed3d4](https://github.com/nodejs/node-gyp/commit/d1ed3d4dc3a53b8ccab4093d002e43945bbece0e))
    +
    +
    +### Miscellaneous
    +
    +* add links to Code of Conduct from root file ([#2196](https://github.com/nodejs/node-gyp/issues/2196)) ([d22e2eb](https://github.com/nodejs/node-gyp/commit/d22e2eb080807c6290533a67249c343a7605a989))
    +* publish to npm with release-please ([#3051](https://github.com/nodejs/node-gyp/issues/3051)) ([8319847](https://github.com/nodejs/node-gyp/commit/831984736393a3ea8417efec5255f95d53a70785))
    +
    +## [10.2.0](https://github.com/nodejs/node-gyp/compare/v10.1.0...v10.2.0) (2024-07-09)
    +
    +
    +### Features
    +
    +* allow VCINSTALLDIR to specify a portable instance ([#3036](https://github.com/nodejs/node-gyp/issues/3036)) ([d38af2e](https://github.com/nodejs/node-gyp/commit/d38af2e0c2a81b12cd221b1f8517fb89e609d62c))
    +* **gyp:** update gyp to v0.18.1 ([#3039](https://github.com/nodejs/node-gyp/issues/3039)) ([ea99fea](https://github.com/nodejs/node-gyp/commit/ea99fea83485dc5be04db01df9b2fdbe05319b8e))
    +* support `rebuild` and `build` for cross-compiling Node-API module to wasm on Windows ([#2974](https://github.com/nodejs/node-gyp/issues/2974)) ([6318d2b](https://github.com/nodejs/node-gyp/commit/6318d2b210224415ff5932c2863e6cc14d4583dc))
    +
    +
    +### Core
    +
    +* add an arch check to VS 2019 ([#3025](https://github.com/nodejs/node-gyp/issues/3025)) ([323957b](https://github.com/nodejs/node-gyp/commit/323957b74e9586fb3fbfb2acad5040379c778de6))
    +* **deps:** bump seanmiddleditch/gha-setup-ninja from 4 to 5 ([#3041](https://github.com/nodejs/node-gyp/issues/3041)) ([10f6730](https://github.com/nodejs/node-gyp/commit/10f6730be660e7a38be8a12111937e37fcf74834))
    +* proc-log@4.0.0 ([#3022](https://github.com/nodejs/node-gyp/issues/3022)) ([141aa6b](https://github.com/nodejs/node-gyp/commit/141aa6bf029e6f984be8ea98aaf985e5df894082))
    +* tar@6.2.1 ([#3021](https://github.com/nodejs/node-gyp/issues/3021)) ([b22d5ee](https://github.com/nodejs/node-gyp/commit/b22d5eef861892c968052ffc1c71b551f738163b))
    +
    +
    +### Doc
    +
    +* `node-pre-gyp` is no longer maintained ([#3015](https://github.com/nodejs/node-gyp/issues/3015)) ([93186f1](https://github.com/nodejs/node-gyp/commit/93186f10c966b4148fc500e48f8cbffacccdfa3c))
    +* add the way to configuring Python dependency for Windows PowerShell ([#2996](https://github.com/nodejs/node-gyp/issues/2996)) ([9fd7936](https://github.com/nodejs/node-gyp/commit/9fd7936f0d7232a8a79e6a7b6cbfb814d9042b13))
    +* Installation -- Python >= v3.12 requires `node-gyp` >= v10 ([#3010](https://github.com/nodejs/node-gyp/issues/3010)) ([a6b48fc](https://github.com/nodejs/node-gyp/commit/a6b48fca9993e54d757cd110f6b41f8200d99ca4))
    +
    +
    +### Miscellaneous
    +
    +* fix ruff command ([#3044](https://github.com/nodejs/node-gyp/issues/3044)) ([b3916d5](https://github.com/nodejs/node-gyp/commit/b3916d5b25704a53e89be16b500036a14bdc5060))
    +
    +## [10.1.0](https://github.com/nodejs/node-gyp/compare/v10.0.1...v10.1.0) (2024-03-13)
    +
    +
    +### Features
    +
    +* improve visual studio detection ([#2957](https://github.com/nodejs/node-gyp/issues/2957)) ([109e3d4](https://github.com/nodejs/node-gyp/commit/109e3d4245504a7b75c99f578e1203c0ef4b518e))
    +
    +
    +### Core
    +
    +* add support for locally installed headers ([#2964](https://github.com/nodejs/node-gyp/issues/2964)) ([3298731](https://github.com/nodejs/node-gyp/commit/329873141f0d3e3787d3c006801431da04e4ed0c))
    +* **deps:** bump actions/setup-python from 4 to 5 ([#2960](https://github.com/nodejs/node-gyp/issues/2960)) ([3f0df7e](https://github.com/nodejs/node-gyp/commit/3f0df7e9334e49e8c7f6fdbbb9e1e6c5a8cca53b))
    +* **deps:** bump google-github-actions/release-please-action ([#2961](https://github.com/nodejs/node-gyp/issues/2961)) ([b1f1808](https://github.com/nodejs/node-gyp/commit/b1f1808bfff0d51e6d3eb696ab6a5b89b7b9630c))
    +* print Python executable path using UTF-8 ([#2995](https://github.com/nodejs/node-gyp/issues/2995)) ([c472912](https://github.com/nodejs/node-gyp/commit/c4729129daa9bb5204246b857826fb391ac961e1))
    +* update supported vs versions ([#2959](https://github.com/nodejs/node-gyp/issues/2959)) ([391cc5b](https://github.com/nodejs/node-gyp/commit/391cc5b9b25cffe0cb2edcba3583414a771b4a15))
    +
    +
    +### Doc
    +
    +* npm is currently v10 ([#2970](https://github.com/nodejs/node-gyp/issues/2970)) ([7705a22](https://github.com/nodejs/node-gyp/commit/7705a22f31a62076e9f8429780a459f4ad71ea4c))
    +* remove outdated Node versions from readme ([#2955](https://github.com/nodejs/node-gyp/issues/2955)) ([ae8478e](https://github.com/nodejs/node-gyp/commit/ae8478ec32d9b2fa71b591ac22cdf867ef2e9a7d))
    +* remove outdated update engines.node reference in 10.0.0 changelog ([b42e796](https://github.com/nodejs/node-gyp/commit/b42e7966177f006f3d1aab1d27885d8372c8ed01))
    +
    +
    +### Miscellaneous
    +
    +* only run release please on push ([cff9ac2](https://github.com/nodejs/node-gyp/commit/cff9ac2c3083769a383e00bc60b91562f03116e3))
    +* upgrade release please action from v2 to v4 ([#2982](https://github.com/nodejs/node-gyp/issues/2982)) ([0035d8e](https://github.com/nodejs/node-gyp/commit/0035d8e9dc98b94f0bc8cd9023a6fa635003703e))
    +
    +### [10.0.1](https://www.github.com/nodejs/node-gyp/compare/v10.0.0...v10.0.1) (2023-11-02)
    +
    +
    +### Bug Fixes
    +
    +* use local `util` for `findAccessibleSync()` ([b39e681](https://www.github.com/nodejs/node-gyp/commit/b39e6819aa9e2c45107d6e60a4913ca036ebfbfd))
    +
    +
    +### Miscellaneous
    +
    +* add parallel test logging ([7de1f5f](https://www.github.com/nodejs/node-gyp/commit/7de1f5f32d550d26d48fe4f76aed5866744edcba))
    +* lint fixes ([4e0ed99](https://www.github.com/nodejs/node-gyp/commit/4e0ed992566f43abc6e988af091ad07fde04acbf))
    +* use platform specific timeouts in tests ([a68586a](https://www.github.com/nodejs/node-gyp/commit/a68586a67d0af238300662cc062422b42820044d))
    +
    +## [10.0.0](https://www.github.com/nodejs/node-gyp/compare/v9.4.0...v10.0.0) (2023-10-28)
    +
    +
    +### ⚠ BREAKING CHANGES
    +
    +* use .npmignore file to limit which files are published (#2921)
    +* the `Gyp` class exported is now created using ECMAScript classes and therefore might have small differences to classes that were previously created with `util.inherits`.
    +* All internal functions have been coverted to return promises and no longer accept callbacks. This is not a breaking change for users but may be breaking to consumers of `node-gyp` if you are requiring internal functions directly.
    +* `node-gyp` now supports node `^16.14.0 || >=18.0.0`
    +
    +### Features
    +
    +* convert all internal functions to async/await ([355622f](https://www.github.com/nodejs/node-gyp/commit/355622f4aac3bd3056b9e03aac5fa2f42a4b3576))
    +* convert internal classes from util.inherits to classes ([d52997e](https://www.github.com/nodejs/node-gyp/commit/d52997e975b9da6e0cea3d9b99873e9ddc768679))
    +* drop node 14 support ([#2929](https://www.github.com/nodejs/node-gyp/issues/2929)) ([1b3bd34](https://www.github.com/nodejs/node-gyp/commit/1b3bd341b40f384988d03207ce8187e93ba609bc))
    +* drop rimraf dependency ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))
    +* **gyp:** update gyp to v0.16.1 ([#2923](https://www.github.com/nodejs/node-gyp/issues/2923)) ([707927c](https://www.github.com/nodejs/node-gyp/commit/707927cd579205ef2b4b17e61c1cce24c056b452))
    +* replace npmlog with proc-log ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))
    +* update engines.node to ^14.17.0 || ^16.13.0 || >=18.0.0 ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))
    +* use .npmignore file to limit which files are published ([#2921](https://www.github.com/nodejs/node-gyp/issues/2921)) ([864a979](https://www.github.com/nodejs/node-gyp/commit/864a979930cf0ef5ad64bc887b901fa8955d058f))
    +
    +
    +### Bug Fixes
    +
    +* create Python symlink only during builds, and clean it up after ([#2721](https://www.github.com/nodejs/node-gyp/issues/2721)) ([0f1f667](https://www.github.com/nodejs/node-gyp/commit/0f1f667b737d21905e283df100a2cb639993562a))
    +* promisify build command ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))
    +* use fs/promises in favor of fs.promises ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))
    +
    +
    +### Tests
    +
    +* increase mocha timeout ([#2887](https://www.github.com/nodejs/node-gyp/issues/2887)) ([445c28f](https://www.github.com/nodejs/node-gyp/commit/445c28fabc5fbdf9c3bb3341fb70660a3530f6ad))
    +* update expired certs ([#2908](https://www.github.com/nodejs/node-gyp/issues/2908)) ([5746691](https://www.github.com/nodejs/node-gyp/commit/5746691a36f7b37019d4b8d4e9616aec43d20410))
    +
    +
    +### Doc
    +
    +* Add note about Python symlinks (PR 2362) to CHANGELOG.md for 9.1.0 ([#2783](https://www.github.com/nodejs/node-gyp/issues/2783)) ([b3d41ae](https://www.github.com/nodejs/node-gyp/commit/b3d41aeb737ddd54cc292f363abc561dcc0a614e))
    +* README.md Do not hardcode the supported versions of Python ([#2880](https://www.github.com/nodejs/node-gyp/issues/2880)) ([bb93b94](https://www.github.com/nodejs/node-gyp/commit/bb93b946a9c74934b59164deb52128cf913c97d5))
    +* update applicable GitHub links from master to main ([#2843](https://www.github.com/nodejs/node-gyp/issues/2843)) ([d644ce4](https://www.github.com/nodejs/node-gyp/commit/d644ce48311edf090d0e920ad449e5766c757933))
    +* Update windows installation instructions in README.md ([#2882](https://www.github.com/nodejs/node-gyp/issues/2882)) ([c9caa2e](https://www.github.com/nodejs/node-gyp/commit/c9caa2ecf3c7deae68444ce8fabb32d2dca651cd))
    +
    +
    +### Core
    +
    +* find python checks order changed on windows ([#2872](https://www.github.com/nodejs/node-gyp/issues/2872)) ([b030555](https://www.github.com/nodejs/node-gyp/commit/b030555cdb754d9c23906e7e707115cd077bbf76))
    +* glob@10.3.10 ([#2926](https://www.github.com/nodejs/node-gyp/issues/2926)) ([4bef1ec](https://www.github.com/nodejs/node-gyp/commit/4bef1ecc7554097d92beb397fbe1a546c5227545))
    +* glob@8.0.3 ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))
    +* make-fetch-happen@13.0.0 ([#2927](https://www.github.com/nodejs/node-gyp/issues/2927)) ([059bb6f](https://www.github.com/nodejs/node-gyp/commit/059bb6fd41bb50955a9efbd97887773d60d53221))
    +* nopt@^7.0.0 ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))
    +* standard@17.0.0 and fix linting errors ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))
    +* which@3.0.0 ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))
    +* which@4.0.0 ([#2928](https://www.github.com/nodejs/node-gyp/issues/2928)) ([e388255](https://www.github.com/nodejs/node-gyp/commit/e38825531403aabeae7abe58e76867f31b832f36))
    +
    +
    +### Miscellaneous
    +
    +* add check engines script to CI ([#2922](https://www.github.com/nodejs/node-gyp/issues/2922)) ([21a7249](https://www.github.com/nodejs/node-gyp/commit/21a7249b40d8f95e7721e450fd18764adb1648a7))
    +* empty commit to add changelog entries from [#2770](https://www.github.com/nodejs/node-gyp/issues/2770) ([4a50fe3](https://www.github.com/nodejs/node-gyp/commit/4a50fe31574217c4b2a798fc72b19947a64ceea1))
    +* GitHub Workflows security hardening ([#2740](https://www.github.com/nodejs/node-gyp/issues/2740)) ([26683e9](https://www.github.com/nodejs/node-gyp/commit/26683e993df038fb94d89f2276f3535e4522d79a))
    +* misc testing fixes ([#2930](https://www.github.com/nodejs/node-gyp/issues/2930)) ([4e493d4](https://www.github.com/nodejs/node-gyp/commit/4e493d4fb262d12ac52c84979071ccc79e666a1a))
    +* run tests after release please PR ([3032e10](https://www.github.com/nodejs/node-gyp/commit/3032e1061cc2b7b49f83c397d385bafddc6b0214))
    +
    +## [9.4.0](https://www.github.com/nodejs/node-gyp/compare/v9.3.1...v9.4.0) (2023-06-12)
    +
    +
    +### Features
    +
    +* add support for native windows arm64 build tools ([bb76021](https://www.github.com/nodejs/node-gyp/commit/bb76021d35964d2bb125bc6214286f35ae4e6cad))
    +* Upgrade Python linting from flake8 to ruff ([#2815](https://www.github.com/nodejs/node-gyp/issues/2815)) ([fc0ddc6](https://www.github.com/nodejs/node-gyp/commit/fc0ddc6523c62b10e5ca1257500b3ceac01450a7))
    +
    +
    +### Bug Fixes
    +
    +* extract tarball to temp directory on Windows ([#2846](https://www.github.com/nodejs/node-gyp/issues/2846)) ([aaa117c](https://www.github.com/nodejs/node-gyp/commit/aaa117c514430aa2c1e568b95df1b6ed1c1fd3b6))
    +* log statement is for devDir not nodedir ([#2840](https://www.github.com/nodejs/node-gyp/issues/2840)) ([55048f8](https://www.github.com/nodejs/node-gyp/commit/55048f8be5707c295fb0876306aded75638a8b63))
    +
    +
    +### Miscellaneous
    +
    +* get update-gyp.py to work with Python >= v3.5 ([#2826](https://www.github.com/nodejs/node-gyp/issues/2826)) ([337e8e6](https://www.github.com/nodejs/node-gyp/commit/337e8e68209bd2481cbb11dacce61234dc5c9419))
    +
    +
    +### Doc
    +
    +* docs/README.md add advise about deprecated node-sass ([#2828](https://www.github.com/nodejs/node-gyp/issues/2828)) ([6f3c2d3](https://www.github.com/nodejs/node-gyp/commit/6f3c2d3c6c0de0dbf8c7245f34c2e0b3eea53812))
    +* Update README.md ([#2822](https://www.github.com/nodejs/node-gyp/issues/2822)) ([c7927e2](https://www.github.com/nodejs/node-gyp/commit/c7927e228dfde059c93e08c26b54dd8026144583))
    +
    +
    +### Tests
    +
    +* remove deprecated Node.js and Python ([#2868](https://www.github.com/nodejs/node-gyp/issues/2868)) ([a0b3d1c](https://www.github.com/nodejs/node-gyp/commit/a0b3d1c3afed71a74501476fcbc6ee3fface4d13))
    +
    +### [9.3.1](https://www.github.com/nodejs/node-gyp/compare/v9.3.0...v9.3.1) (2022-12-16)
    +
    +
    +### Bug Fixes
    +
    +* increase node 12 support to ^12.13 ([#2771](https://www.github.com/nodejs/node-gyp/issues/2771)) ([888efb9](https://www.github.com/nodejs/node-gyp/commit/888efb9055857afee6a6b54550722cf9ae3ee323))
    +
    +
    +### Miscellaneous
    +
    +* update python test matrix ([#2774](https://www.github.com/nodejs/node-gyp/issues/2774)) ([38f01fa](https://www.github.com/nodejs/node-gyp/commit/38f01fa57d10fdb3db7697121d957bc2e0e96508))
    +
    +## [9.3.0](https://www.github.com/nodejs/node-gyp/compare/v9.2.0...v9.3.0) (2022-10-10)
    +
    +
    +### Features
    +
    +* **gyp:** update gyp to v0.14.0 ([#2749](https://www.github.com/nodejs/node-gyp/issues/2749)) ([713b8dc](https://www.github.com/nodejs/node-gyp/commit/713b8dcdbf44532ca9453a127da266386cc737f8))
    +* remove support for VS2015 in Node.js >=19 ([#2746](https://www.github.com/nodejs/node-gyp/issues/2746)) ([131d1a4](https://www.github.com/nodejs/node-gyp/commit/131d1a463baf034a04154bcda753a8295f112a34))
    +* support IBM Open XL C/C++ on z/OS ([#2743](https://www.github.com/nodejs/node-gyp/issues/2743)) ([7d0c83d](https://www.github.com/nodejs/node-gyp/commit/7d0c83d2a95aca743dff972826d0da26203acfc4))
    +
    +## [9.2.0](https://www.github.com/nodejs/node-gyp/compare/v9.1.0...v9.2.0) (2022-10-02)
    +
    +
    +### Features
    +
    +* Add proper support for IBM i ([a26494f](https://www.github.com/nodejs/node-gyp/commit/a26494fbb8883d9ef784503979e115dec3e2791e))
    +* **gyp:** update gyp to v0.13.0 ([3e2a532](https://www.github.com/nodejs/node-gyp/commit/3e2a5324f1c24f3a04bca04cf54fe23d5c4d5e50))
    +
    +
    +### Bug Fixes
    +
    +* node.js debugger adds stderr (but exit code is 0) -> shouldn't throw ([#2719](https://www.github.com/nodejs/node-gyp/issues/2719)) ([c379a74](https://www.github.com/nodejs/node-gyp/commit/c379a744c65c7ab07c2c3193d9c7e8f25ae1b05e))
    +
    +
    +### Core
    +
    +* enable support for zoslib on z/OS ([#2600](https://www.github.com/nodejs/node-gyp/issues/2600)) ([83c0a12](https://www.github.com/nodejs/node-gyp/commit/83c0a12bf23b4cbf3125d41f9e2d4201db76c9ae))
    +
    +
    +### Miscellaneous
    +
    +* update dependency - nopt@6.0.0 ([#2707](https://www.github.com/nodejs/node-gyp/issues/2707)) ([8958ecf](https://www.github.com/nodejs/node-gyp/commit/8958ecf2bb719227bbcbf155891c3186ee219a2e))
    +
    +## [9.1.0](https://www.github.com/nodejs/node-gyp/compare/v9.0.0...v9.1.0) (2022-07-13)
    +
    +
    +### Features
    +
    +* Update function getSDK() to support Windows 11 SDK ([#2565](https://www.github.com/nodejs/node-gyp/issues/2565)) ([ea8520e](https://www.github.com/nodejs/node-gyp/commit/ea8520e3855374bd15b6d001fe112d58a8d7d737))
    +
    +
    +### Bug Fixes
    +
    +* extend tap timeout length to allow for slow CI ([6f74c76](https://www.github.com/nodejs/node-gyp/commit/6f74c762fe3c19bdd20245cb5c02e2dfa65d9451))
    +* new ca & server certs, bundle in .js file and unpack for testing ([147e3d3](https://www.github.com/nodejs/node-gyp/commit/147e3d34f44a97deb7aa507207680cf0f4e662a2))
    +* re-label ([#2689](https://www.github.com/nodejs/node-gyp/issues/2689)) ([f0b7863](https://www.github.com/nodejs/node-gyp/commit/f0b7863dadfa365afc173025ae95351aec79abd9))
    +* typo on readme ([bf81cd4](https://www.github.com/nodejs/node-gyp/commit/bf81cd452b931dd4dfa82762c23dd530a075d992))
    +
    +
    +### Doc
    +
    +* update docs/README.md with latest version number ([62d2815](https://www.github.com/nodejs/node-gyp/commit/62d28151bf8266a34e1bcceeb25b4e6e2ae5ca5d))
    +
    +
    +### Core
    +
    +* update due to rename of primary branch ([ca1f068](https://www.github.com/nodejs/node-gyp/commit/ca1f0681a5567ca8cd51acebccd37a633f19bc6a))
    +* Add Python symlink to path (for non-Windows OSes only) ([#2362](https://github.com/nodejs/node-gyp/pull/2362)) ([b9ddcd5](https://github.com/nodejs/node-gyp/commit/b9ddcd5bbd93b05b03674836b6ebdae2c2e74c8c))
    +
    +
    +### Tests
    +
    +* Try msvs-version: [2016, 2019, 2022] ([#2700](https://www.github.com/nodejs/node-gyp/issues/2700)) ([68b5b5b](https://www.github.com/nodejs/node-gyp/commit/68b5b5be9c94ac20c55e88654ff6f55234d7130a))
    +* Upgrade GitHub Actions ([#2623](https://www.github.com/nodejs/node-gyp/issues/2623)) ([245cd5b](https://www.github.com/nodejs/node-gyp/commit/245cd5bbe4441d4f05e88f2fa20a86425419b6af))
    +* Upgrade GitHub Actions ([#2701](https://www.github.com/nodejs/node-gyp/issues/2701)) ([1c64ca7](https://www.github.com/nodejs/node-gyp/commit/1c64ca7f4702c6eb43ecd16fbd67b5d939041621))
    +
    +## [9.0.0](https://www.github.com/nodejs/node-gyp/compare/v8.4.1...v9.0.0) (2022-02-24)
    +
    +
    +### ⚠ BREAKING CHANGES
    +
    +* increase "engines" to "node" : "^12.22 || ^14.13 || >=16" (#2601)
    +
    +### Bug Fixes
    +
    +* _ in npm_config_ env variables ([eef4eef](https://www.github.com/nodejs/node-gyp/commit/eef4eefccb13ff6a32db862709ee5b2d4edf7e95))
    +* update make-fetch-happen to a minimum of 10.0.3 ([839e414](https://www.github.com/nodejs/node-gyp/commit/839e414b63790c815a4a370d0feee8f24a94d40f))
    +
    +
    +### Miscellaneous
    +
    +* add minimal SECURITY.md ([#2560](https://www.github.com/nodejs/node-gyp/issues/2560)) ([c2a1850](https://www.github.com/nodejs/node-gyp/commit/c2a185056e2e589b520fbc0bcc59c2935cd07ede))
    +
    +
    +### Doc
    +
    +* Add notes/disclaimers for upgrading the copy of node-gyp that npm uses ([#2585](https://www.github.com/nodejs/node-gyp/issues/2585)) ([faf6d48](https://www.github.com/nodejs/node-gyp/commit/faf6d48f8a77c08a313baf9332358c4b1231c73c))
    +* Rename and update Common-issues.md --> docs/README.md ([#2567](https://www.github.com/nodejs/node-gyp/issues/2567)) ([2ef5fb8](https://www.github.com/nodejs/node-gyp/commit/2ef5fb86277c4d81baffc0b9f642a8d86be1bfa5))
    +* rephrase explanation of which node-gyp is used by npm ([#2587](https://www.github.com/nodejs/node-gyp/issues/2587)) ([a2f2988](https://www.github.com/nodejs/node-gyp/commit/a2f298870692022302fa27a1d42363c4a72df407))
    +* title match content ([#2574](https://www.github.com/nodejs/node-gyp/issues/2574)) ([6e8f93b](https://www.github.com/nodejs/node-gyp/commit/6e8f93be0443f2649d4effa7bc773a9da06a33b4))
    +* Update Python versions ([#2571](https://www.github.com/nodejs/node-gyp/issues/2571)) ([e069f13](https://www.github.com/nodejs/node-gyp/commit/e069f13658a8bfb5fd60f74708cf8be0856d92e3))
    +
    +
    +### Core
    +
    +* add lib.target as path for searching libnode on z/OS ([1d499dd](https://www.github.com/nodejs/node-gyp/commit/1d499dd5606f39de2d34fa822fd0fa5ce17fbd06))
    +* increase "engines" to "node" : "^12.22 || ^14.13 || >=16" ([#2601](https://www.github.com/nodejs/node-gyp/issues/2601)) ([6562f92](https://www.github.com/nodejs/node-gyp/commit/6562f92a6f2e67aeae081ddf5272ff117f1fab07))
    +* make-fetch-happen@10.0.1 ([78f6660](https://www.github.com/nodejs/node-gyp/commit/78f66604e0df480d4f36a8fa4f3618c046a6fbdc))
    +
    +### [8.4.1](https://www.github.com/nodejs/node-gyp/compare/v8.4.0...v8.4.1) (2021-11-19)
    +
    +
    +### Bug Fixes
    +
    +* windows command missing space ([#2553](https://www.github.com/nodejs/node-gyp/issues/2553)) ([cc37b88](https://www.github.com/nodejs/node-gyp/commit/cc37b880690706d3c5d04d5a68c76c392a0a23ed))
    +
    +
    +### Doc
    +
    +* fix typo in powershell node-gyp update ([787cf7f](https://www.github.com/nodejs/node-gyp/commit/787cf7f8e5ddd5039e02b64ace6b7b15e06fe0a4))
    +
    +
    +### Core
    +
    +* npmlog@6.0.0 ([8083f6b](https://www.github.com/nodejs/node-gyp/commit/8083f6b855bd7f3326af04c5f5269fc28d7f2508))
    +
    +## [8.4.0](https://www.github.com/nodejs/node-gyp/compare/v8.3.0...v8.4.0) (2021-11-05)
    +
    +
    +### Features
    +
    +* build with config.gypi from node headers ([a27dc08](https://www.github.com/nodejs/node-gyp/commit/a27dc08696911c6d81e76cc228697243069103c1))
    +* support vs2022 ([#2533](https://www.github.com/nodejs/node-gyp/issues/2533)) ([5a00387](https://www.github.com/nodejs/node-gyp/commit/5a00387e5f8018264a1822f6c4d5dbf425f21cf6))
    +
    +## [8.3.0](https://www.github.com/nodejs/node-gyp/compare/v8.2.0...v8.3.0) (2021-10-11)
    +
    +
    +### Features
    +
    +* **gyp:** update gyp to v0.10.0 ([#2521](https://www.github.com/nodejs/node-gyp/issues/2521)) ([5585792](https://www.github.com/nodejs/node-gyp/commit/5585792922a97f0629f143c560efd74470eae87f))
    +
    +
    +### Tests
    +
    +* Python 3.10 was release on Oct. 4th ([#2504](https://www.github.com/nodejs/node-gyp/issues/2504)) ([0a67dcd](https://www.github.com/nodejs/node-gyp/commit/0a67dcd1307f3560495219253241eafcbf4e2a69))
    +
    +
    +### Miscellaneous
    +
    +* **deps:** bump make-fetch-happen from 8.0.14 to 9.1.0 ([b05b4fe](https://www.github.com/nodejs/node-gyp/commit/b05b4fe9891f718f40edf547e9b50e982826d48a))
    +* refactor the creation of config.gypi file ([f2ad87f](https://www.github.com/nodejs/node-gyp/commit/f2ad87ff65f98ad66daa7225ad59d99b759a2b07))
    +
    +## [8.2.0](https://www.github.com/nodejs/node-gyp/compare/v8.1.0...v8.2.0) (2021-08-23)
    +
    +
    +### Features
    +
    +* **gyp:** update gyp to v0.9.6 ([#2481](https://www.github.com/nodejs/node-gyp/issues/2481)) ([ed9a9ed](https://www.github.com/nodejs/node-gyp/commit/ed9a9ed653a17c84afa3c327161992d0da7d0cea))
    +
    +
    +### Bug Fixes
    +
    +* add error arg back into catch block for older Node.js users ([5cde818](https://www.github.com/nodejs/node-gyp/commit/5cde818aac715477e9e9747966bb6b4c4ed070a8))
    +* change default gyp update message ([#2420](https://www.github.com/nodejs/node-gyp/issues/2420)) ([cfd12ff](https://www.github.com/nodejs/node-gyp/commit/cfd12ff3bb0eb4525173413ef6a94b3cd8398cad))
    +* doc how to update node-gyp independently from npm ([c8c0af7](https://www.github.com/nodejs/node-gyp/commit/c8c0af72e78141a02b5da4cd4d704838333a90bd))
    +* missing spaces ([f0882b1](https://www.github.com/nodejs/node-gyp/commit/f0882b1264b2fa701adbc81a3be0b3cba80e333d))
    +
    +
    +### Core
    +
    +* deep-copy process.config during configure ([#2368](https://www.github.com/nodejs/node-gyp/issues/2368)) ([5f1a06c](https://www.github.com/nodejs/node-gyp/commit/5f1a06c50f3b0c3d292f64948f85a004cfcc5c87))
    +
    +
    +### Miscellaneous
    +
    +* **deps:** bump tar from 6.1.0 to 6.1.2 ([#2474](https://www.github.com/nodejs/node-gyp/issues/2474)) ([ec15a3e](https://www.github.com/nodejs/node-gyp/commit/ec15a3e5012004172713c11eebcc9d852d32d380))
    +* fix typos discovered by codespell ([#2442](https://www.github.com/nodejs/node-gyp/issues/2442)) ([2d0ce55](https://www.github.com/nodejs/node-gyp/commit/2d0ce5595e232a3fc7c562cdf39efb77e2312cc1))
    +* GitHub Actions Test on node: [12.x, 14.x, 16.x] ([#2439](https://www.github.com/nodejs/node-gyp/issues/2439)) ([b7bccdb](https://www.github.com/nodejs/node-gyp/commit/b7bccdb527d93b0bb0ce99713f083ce2985fe85c))
    +
    +
    +### Doc
    +
    +* correct link to "binding.gyp files out in the wild" ([#2483](https://www.github.com/nodejs/node-gyp/issues/2483)) ([660dd7b](https://www.github.com/nodejs/node-gyp/commit/660dd7b2a822c184be8027b300e68be67b366772))
    +* **wiki:** Add a link to the node-midi binding.gyp file. ([b354711](https://www.github.com/nodejs/node-gyp/commit/b3547115f6e356358138310e857c7f1ec627a8a7))
    +* **wiki:** add bcrypt ([e199cfa](https://www.github.com/nodejs/node-gyp/commit/e199cfa8fc6161492d2a6ade2190510d0ebf7c0f))
    +* **wiki:** Add helpful information ([4eda827](https://www.github.com/nodejs/node-gyp/commit/4eda8275c03dae6d2f5c40f3c1dbe930d84b0f2b))
    +* **wiki:** Add node-canvas ([13a9553](https://www.github.com/nodejs/node-gyp/commit/13a955317b39caf98fd1f412d8d3f41599e979fd))
    +* **wiki:** Add node-openvg-canvas and node-openvg. ([61f709e](https://www.github.com/nodejs/node-gyp/commit/61f709ec4d9f256a6467e9ff84430a48eeb629d1))
    +* **wiki:** add one more example ([77f3632](https://www.github.com/nodejs/node-gyp/commit/77f363272930d3d4d24fd3973be22e6237128fcc))
    +* **wiki:** add topcube, node-osmium, and node-osrm ([1a75d2b](https://www.github.com/nodejs/node-gyp/commit/1a75d2bf2f562ba50846893a516e111cfbb50885))
    +* **wiki:** Added details for properly fixing ([3d4d9d5](https://www.github.com/nodejs/node-gyp/commit/3d4d9d52d6b5b49de06bb0bb5b68e2686d2b7ebd))
    +* **wiki:** Added Ghostscript4JS ([bf4bed1](https://www.github.com/nodejs/node-gyp/commit/bf4bed1b96a7d22fba6f97f4552ad09f32ac3737))
    +* **wiki:** added levelup ([1575bce](https://www.github.com/nodejs/node-gyp/commit/1575bce3a53db628bfb023fd6f3258fdf98c3195))
    +* **wiki:** Added nk-mysql (nodamysql) ([5b4f2d0](https://www.github.com/nodejs/node-gyp/commit/5b4f2d0e1d5d3eadfd03aaf9c1668340f76c4bea))
    +* **wiki:** Added nk-xrm-installer .gyp references, including .py scripts for providing complete reference to examples of fetching source via http, extracting, and moving files (as opposed to copying) ([ceb3088](https://www.github.com/nodejs/node-gyp/commit/ceb30885b74f6789374ef52267b84767be93ebe4))
    +* **wiki:** Added tip about resolving frustrating LNK1181 error ([e64798d](https://www.github.com/nodejs/node-gyp/commit/e64798de8cac6031ad598a86d7599e81b4d20b17))
    +* **wiki:** ADDED: Node.js binding to OpenCV ([e2dc777](https://www.github.com/nodejs/node-gyp/commit/e2dc77730b09d7ee8682d7713a7603a2d7aacabd))
    +* **wiki:** Adding link to node-cryptopp's gyp file ([875adbe](https://www.github.com/nodejs/node-gyp/commit/875adbe2a4669fa5f2be0250ffbf98fb55e800fd))
    +* **wiki:** Adding the sharp library to the list ([9dce0e4](https://www.github.com/nodejs/node-gyp/commit/9dce0e41650c3fa973e6135a79632d022c662a1d))
    +* **wiki:** Adds node-fann ([23e3d48](https://www.github.com/nodejs/node-gyp/commit/23e3d485ed894ba7c631e9c062f5e366b50c416c))
    +* **wiki:** Adds node-inotify and v8-profiler ([b6e542f](https://www.github.com/nodejs/node-gyp/commit/b6e542f644dbbfe22b88524ec500696e06ee4af7))
    +* **wiki:** Bumping Python version from 2.3 to 2.7 as per the node-gyp readme ([55ebd6e](https://www.github.com/nodejs/node-gyp/commit/55ebd6ebacde975bf84f7bf4d8c66e64cc7cd0da))
    +* **wiki:** C++ build tools version upgraded ([5b899b7](https://www.github.com/nodejs/node-gyp/commit/5b899b70db729c392ced7c98e8e17590c6499fc3))
    +* **wiki:** change bcrypt url to binding.gyp file ([e11bdd8](https://www.github.com/nodejs/node-gyp/commit/e11bdd84de6144492d3eb327d67cbf2d62da1a76))
    +* **wiki:** Clarification + direct link to VS2010 ([531c724](https://www.github.com/nodejs/node-gyp/commit/531c724561d947b5d870de8d52dd8c3c51c5ec2d))
    +* **wiki:** Correcting the link to node-osmium ([fae7516](https://www.github.com/nodejs/node-gyp/commit/fae7516a1d2829b6e234eaded74fb112ebd79a05))
    +* **wiki:** Created "binding.gyp" files out in the wild (markdown) ([d4fd143](https://www.github.com/nodejs/node-gyp/commit/d4fd14355bbe57f229f082f47bb2b3670868203f))
    +* **wiki:** Created Common issues (markdown) ([a38299e](https://www.github.com/nodejs/node-gyp/commit/a38299ea340ceb0e732c6dc6a1b4760257644839))
    +* **wiki:** Created Error: "pre" versions of node cannot be installed (markdown) ([98bc80d](https://www.github.com/nodejs/node-gyp/commit/98bc80d7a62ba70c881f3c39d94f804322e57852))
    +* **wiki:** Created Linking to OpenSSL (markdown) ([c46d00d](https://www.github.com/nodejs/node-gyp/commit/c46d00d83bac5173dea8bbbb175a1a7de74fdaca))
    +* **wiki:** Created Updating npm's bundled node gyp (markdown) ([e0ac8d1](https://www.github.com/nodejs/node-gyp/commit/e0ac8d15af46aadd1c220599e63199b154a514e6))
    +* **wiki:** Created use of undeclared identifier 'TypedArray' (markdown) ([65ba711](https://www.github.com/nodejs/node-gyp/commit/65ba71139e9b7f64ac823e575ee9dbf17d937ce4))
    +* **wiki:** Created Visual Studio 2010 Setup (markdown) ([5b80e83](https://www.github.com/nodejs/node-gyp/commit/5b80e834c8f79dda9fb2770a876ff3cf649c06f3))
    +* **wiki:** Created Visual studio 2012 setup (markdown) ([becef31](https://www.github.com/nodejs/node-gyp/commit/becef316b6c46a33e783667720ee074a0141d1a5))
    +* **wiki:** Destroyed Visual Studio 2010 Setup (markdown) ([93423b4](https://www.github.com/nodejs/node-gyp/commit/93423b43606de9664aeb79635825f5e9941ec9bc))
    +* **wiki:** Destroyed Visual studio 2012 setup (markdown) ([3601508](https://www.github.com/nodejs/node-gyp/commit/3601508bb10fa05da0ddc7e70d57e4b4dd679657))
    +* **wiki:** Different commands for Windows npm v6 vs. v7 ([0fce46b](https://www.github.com/nodejs/node-gyp/commit/0fce46b53340c85e8091cde347d5ed23a443c82f))
    +* **wiki:** Drop  in favor of ([9285ff6](https://www.github.com/nodejs/node-gyp/commit/9285ff6e451c52c070a05f05f0a9602621d91d53))
    +* **wiki:** Explicit link to Visual C++ 2010 Express ([378c363](https://www.github.com/nodejs/node-gyp/commit/378c3632f02c096ed819ec8f2611c65bef0c0554))
    +* **wiki:** fix link to gyp file used to build libsqlite3 ([54db8d7](https://www.github.com/nodejs/node-gyp/commit/54db8d7ac33e3f98220960b5d86cfa18a75b53cb))
    +* **wiki:** Fix link to node-zipfile ([92e49a8](https://www.github.com/nodejs/node-gyp/commit/92e49a858ed69cb4847a26a5676ab56ef5e2de33))
    +* **wiki:** fixed node-serialport link ([954ee53](https://www.github.com/nodejs/node-gyp/commit/954ee530b3972d1db591fce32368e4e31b5a25d8))
    +* **wiki:** I highly missing it in common issue as every windows biggner face that issue ([d617fae](https://www.github.com/nodejs/node-gyp/commit/d617faee29c40871ca5c8f93efd0ce929a40d541))
    +* **wiki:** if ouns that the -h did not help. I founs on github that there was support for visual studio 2015, while i couldn't install node-red beacuse it kept telling me the key 2015 was missing. looking in he gyp python code i found the local file was bot up t dat with the github repo. updating took several efforts before i tried to drop the -g option. ([408b72f](https://www.github.com/nodejs/node-gyp/commit/408b72f561329408daeb17834436e381406efcc8))
    +* **wiki:** If permissions error, please try  and then the command. ([ee8e1c1](https://www.github.com/nodejs/node-gyp/commit/ee8e1c1e5334096d58e0d6bca6c006f2ee9c88cb))
    +* **wiki:** Improve Unix instructions ([c3e5487](https://www.github.com/nodejs/node-gyp/commit/c3e548736645b535ea5bce613d74ca3e98598243))
    +* **wiki:** link to docs/ from README ([b52e487](https://www.github.com/nodejs/node-gyp/commit/b52e487eac1eb421573d1e67114a242eeff45a00))
    +* **wiki:** Lower case L ([3aa2c6b](https://www.github.com/nodejs/node-gyp/commit/3aa2c6bdb07971b87505e32e32548d75264bd19f))
    +* **wiki:** Make changes discussed in https://github.com/nodejs/node-gyp/issues/2416 ([1dcad87](https://www.github.com/nodejs/node-gyp/commit/1dcad873539027511a5f0243baf770ea90f6f4e2))
    +* **wiki:** move wiki docs into doc/ ([f0a4835](https://www.github.com/nodejs/node-gyp/commit/f0a48355d86534ec3bdabcdb3ce3340fa2e17f39))
    +* **wiki:** node-sass in the wild ([d310a73](https://www.github.com/nodejs/node-gyp/commit/d310a73d64d0065050377baac7047472f7424a1b))
    +* **wiki:** node-srs was a 404 ([bbca21a](https://www.github.com/nodejs/node-gyp/commit/bbca21a1e1ede4c473aff365ca71989a5bda7b57))
    +* **wiki:** Note: VS2010 seems to be no longer available!  VS2013 or nothing! ([7b5dcaf](https://www.github.com/nodejs/node-gyp/commit/7b5dcafafccdceae4b8f2b53ac9081a694b6ade8))
    +* **wiki:** safer doc names, remove unnecessary TypedArray doc ([161c235](https://www.github.com/nodejs/node-gyp/commit/161c2353ef5b562f4acfb2fd77608fcbd0800fc0))
    +* **wiki:** sorry, forgot to mention a specific windows version. ([d69dffc](https://www.github.com/nodejs/node-gyp/commit/d69dffc16c2b1e3c60dcb5d1c35a49270ba22a35))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([7444b47](https://www.github.com/nodejs/node-gyp/commit/7444b47a7caac1e14d1da474a7fcfcf88d328017))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([d766b74](https://www.github.com/nodejs/node-gyp/commit/d766b7427851e6c2edc02e2504a7be9be7e330c0))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([d319b0e](https://www.github.com/nodejs/node-gyp/commit/d319b0e98c7085de8e51bc5595eba4264b99a7d5))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([3c6692d](https://www.github.com/nodejs/node-gyp/commit/3c6692d538f0ce973869aa237118b7d2483feccd))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([93392d5](https://www.github.com/nodejs/node-gyp/commit/93392d559ce6f250b9c7fe8177e6c88603809dc1))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([8841158](https://www.github.com/nodejs/node-gyp/commit/88411588f300e9b7c00fe516ecd977a1feeeb15c))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([81bfa1f](https://www.github.com/nodejs/node-gyp/commit/81bfa1f1b63d522a9f8a9ae9ca0c7ae90fe75140))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([d1cd237](https://www.github.com/nodejs/node-gyp/commit/d1cd237bad06fa507adb354b9e2181a14dc63d24))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([3de9e17](https://www.github.com/nodejs/node-gyp/commit/3de9e17e0b8a387eafe7bd18d0ec1e3191d118e8))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([a9b7096](https://www.github.com/nodejs/node-gyp/commit/a9b70968fb956eab3b95672048b94350e1565ca3))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([3236069](https://www.github.com/nodejs/node-gyp/commit/3236069689e7e0eb15b324fce74ab58158956f98))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([1462755](https://www.github.com/nodejs/node-gyp/commit/14627556966e5d513bdb8e5208f0e1300f68991f))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([7ab1337](https://www.github.com/nodejs/node-gyp/commit/7ab133752a6c402bb96dcd3d671d73e03e9487ad))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([640895d](https://www.github.com/nodejs/node-gyp/commit/640895d36b7448c646a3b850c1e159106f83c724))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([ced8c96](https://www.github.com/nodejs/node-gyp/commit/ced8c968457f285ab8989c291d28173d7730833c))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([27b883a](https://www.github.com/nodejs/node-gyp/commit/27b883a350ad0db6b9130d7b996f35855ec34c7a))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([d29fb13](https://www.github.com/nodejs/node-gyp/commit/d29fb134f1c4b9dd729ba95f2979e69e0934809f))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([2765891](https://www.github.com/nodejs/node-gyp/commit/27658913e6220cf0371b4b73e25a0e4ab11108a1))
    +* **wiki:** Updated "binding.gyp" files out in the wild (markdown) ([dc97766](https://www.github.com/nodejs/node-gyp/commit/dc9776648d432bca6775c176641f16da14522d4c))
    +* **wiki:** Updated Error: "pre" versions of node cannot be installed (markdown) ([e9f8b33](https://www.github.com/nodejs/node-gyp/commit/e9f8b33d1f87d04f22cb09a814d7c55d0fa38446))
    +* **wiki:** Updated Home (markdown) ([3407109](https://www.github.com/nodejs/node-gyp/commit/3407109325cf7ba1e925656b9eb75feffab0557c))
    +* **wiki:** Updated Home (markdown) ([6e392bc](https://www.github.com/nodejs/node-gyp/commit/6e392bcdd3dd1691773e6e16e1dffc35931b81e0))
    +* **wiki:** Updated Home (markdown) ([65efe32](https://www.github.com/nodejs/node-gyp/commit/65efe32ccb8d446ce569453364f922dd9d27c945))
    +* **wiki:** Updated Home (markdown) ([ea28f09](https://www.github.com/nodejs/node-gyp/commit/ea28f0947af91fa638be355143f5df89d2e431c8))
    +* **wiki:** Updated Home (markdown) ([0e37ff4](https://www.github.com/nodejs/node-gyp/commit/0e37ff48b306c12149661b375895741d3d710da7))
    +* **wiki:** Updated Home (markdown) ([b398ef4](https://www.github.com/nodejs/node-gyp/commit/b398ef46f660d2b1506508550dadfb4c35639e4b))
    +* **wiki:** Updated Linking to OpenSSL (markdown) ([8919028](https://www.github.com/nodejs/node-gyp/commit/8919028921fd304f08044098434f0dc6071fb7cf))
    +* **wiki:** Updated Linking to OpenSSL (markdown) ([c00eb77](https://www.github.com/nodejs/node-gyp/commit/c00eb778fc7dc27e4dab3a9219035ea20458b33b))
    +* **wiki:** Updated node-levelup to node-leveldown (broken links) ([59668bb](https://www.github.com/nodejs/node-gyp/commit/59668bb0b904feccf3c09afa2fd37378c77af967))
    +* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([d314854](https://www.github.com/nodejs/node-gyp/commit/d31485415ef69d46effa6090c95698341965de1b))
    +* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([11858b0](https://www.github.com/nodejs/node-gyp/commit/11858b0655d1eee00c62ad628e719d4378803d14))
    +* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([33561e9](https://www.github.com/nodejs/node-gyp/commit/33561e9cbf5f4eb46111318503c77df2c6eb484a))
    +* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([4a7f2d0](https://www.github.com/nodejs/node-gyp/commit/4a7f2d0d869a65c99a78504976567017edadf657))
    +* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([979a706](https://www.github.com/nodejs/node-gyp/commit/979a7063b950c088a7f4896fc3a48e1d00dfd231))
    +* **wiki:** Updated Updating npm's bundled node gyp (markdown) ([e50e04d](https://www.github.com/nodejs/node-gyp/commit/e50e04d7b6a3754ea0aa11fe8cef491b3bc5bdd4))
    +
    +## [8.1.0](https://www.github.com/nodejs/node-gyp/compare/v8.0.0...v8.1.0) (2021-05-28)
    +
    +
    +### Features
    +
    +* **gyp:** update gyp to v0.9.1 ([#2402](https://www.github.com/nodejs/node-gyp/issues/2402)) ([814b1b0](https://www.github.com/nodejs/node-gyp/commit/814b1b0eda102afb9fc87e81638a9cf5b650bb10))
    +
    +
    +### Miscellaneous
    +
    +* add `release-please-action` for automated releases ([#2395](https://www.github.com/nodejs/node-gyp/issues/2395)) ([07e9d7c](https://www.github.com/nodejs/node-gyp/commit/07e9d7c7ee80ba119ea760c635f72fd8e7efe198))
    +
    +
    +### Core
    +
    +* fail gracefully if we can't find the username ([#2375](https://www.github.com/nodejs/node-gyp/issues/2375)) ([fca4795](https://www.github.com/nodejs/node-gyp/commit/fca4795512c67dc8420aaa0d913b5b89a4b147f3))
    +* log as yes/no whether build dir was created ([#2370](https://www.github.com/nodejs/node-gyp/issues/2370)) ([245dee5](https://www.github.com/nodejs/node-gyp/commit/245dee5b62581309946872ae253226ea3a42c0e3))
    +
    +
    +### Doc
    +
    +* fix v8.0.0 release date ([4b83c3d](https://www.github.com/nodejs/node-gyp/commit/4b83c3de7300457919d53f26d96ea9ad6f6bedd8))
    +* remove redundant version info ([#2403](https://www.github.com/nodejs/node-gyp/issues/2403)) ([1423670](https://www.github.com/nodejs/node-gyp/commit/14236709de64b100a424396b91a5115639daa0ef))
    +* Update README.md Visual Studio Community page polski to auto ([#2371](https://www.github.com/nodejs/node-gyp/issues/2371)) ([1b4697a](https://www.github.com/nodejs/node-gyp/commit/1b4697abf69ef574a48faf832a7098f4c6c224a5))
    +
    +## v8.0.0 2021-04-03
    +
    +* [[`0d8a6f1b19`](https://github.com/nodejs/node-gyp/commit/0d8a6f1b19)] - **ci**: update actions/setup-node to v2 (#2302) (Sora Morimoto) [#2302](https://github.com/nodejs/node-gyp/pull/2302)
    +* [[`15a5c7d45b`](https://github.com/nodejs/node-gyp/commit/15a5c7d45b)] - **ci**: migrate deprecated grammar (#2285) (Jiawen Geng) [#2285](https://github.com/nodejs/node-gyp/pull/2285)
    +* [[`06ddde27f9`](https://github.com/nodejs/node-gyp/commit/06ddde27f9)] - **deps**: sync mutual dependencies with npm (DeeDeeG) [#2348](https://github.com/nodejs/node-gyp/pull/2348)
    +* [[`a5fd1f41e3`](https://github.com/nodejs/node-gyp/commit/a5fd1f41e3)] - **doc**: add downloads badge (#2352) (Jiawen Geng) [#2352](https://github.com/nodejs/node-gyp/pull/2352)
    +* [[`cc1cbce056`](https://github.com/nodejs/node-gyp/commit/cc1cbce056)] - **doc**: update macOS\_Catalina.md (#2293) (iMrLopez) [#2293](https://github.com/nodejs/node-gyp/pull/2293)
    +* [[`6287118fc4`](https://github.com/nodejs/node-gyp/commit/6287118fc4)] - **doc**: updated README.md to copy easily (#2281) (மனோஜ்குமார் பழனிச்சாமி) [#2281](https://github.com/nodejs/node-gyp/pull/2281)
    +* [[`66c0f04467`](https://github.com/nodejs/node-gyp/commit/66c0f04467)] - **doc**: add missing `sudo` to Catalina doc (Karl Horky) [#2244](https://github.com/nodejs/node-gyp/pull/2244)
    +* [[`0da2e0140d`](https://github.com/nodejs/node-gyp/commit/0da2e0140d)] - **gyp**: update gyp to v0.8.1 (#2355) (DeeDeeG) [#2355](https://github.com/nodejs/node-gyp/pull/2355)
    +* [[`0093ec8646`](https://github.com/nodejs/node-gyp/commit/0093ec8646)] - **gyp**: Improve our flake8 linting tests (Christian Clauss) [#2356](https://github.com/nodejs/node-gyp/pull/2356)
    +* [[`a78b584236`](https://github.com/nodejs/node-gyp/commit/a78b584236)] - **(SEMVER-MAJOR)** **gyp**: remove support for Python 2 (#2300) (Christian Clauss) [#2300](https://github.com/nodejs/node-gyp/pull/2300)
    +* [[`c3c510d89e`](https://github.com/nodejs/node-gyp/commit/c3c510d89e)] - **gyp**: update gyp to v0.8.0 (#2318) (Christian Clauss) [#2318](https://github.com/nodejs/node-gyp/pull/2318)
    +* [[`9e1397c52e`](https://github.com/nodejs/node-gyp/commit/9e1397c52e)] - **(SEMVER-MAJOR)** **gyp**: update gyp to v0.7.0 (#2284) (Jiawen Geng) [#2284](https://github.com/nodejs/node-gyp/pull/2284)
    +* [[`1bd18f3e77`](https://github.com/nodejs/node-gyp/commit/1bd18f3e77)] - **(SEMVER-MAJOR)** **lib**: drop Python 2 support in find-python.js (#2333) (DeeDeeG) [#2333](https://github.com/nodejs/node-gyp/pull/2333)
    +* [[`e81602ef55`](https://github.com/nodejs/node-gyp/commit/e81602ef55)] - **(SEMVER-MAJOR)** **lib**: migrate requests to fetch (#2220) (Matias Lopez) [#2220](https://github.com/nodejs/node-gyp/pull/2220)
    +* [[`392b7760b4`](https://github.com/nodejs/node-gyp/commit/392b7760b4)] - **lib**: avoid changing process.config (#2322) (Michaël Zasso) [#2322](https://github.com/nodejs/node-gyp/pull/2322)
    +
    +## v7.1.2 2020-10-17
    +
    +* [[`096e3aded5`](https://github.com/nodejs/node-gyp/commit/096e3aded5)] - **gyp**: update gyp to 0.6.2 (Myles Borins) [#2241](https://github.com/nodejs/node-gyp/pull/2241)
    +* [[`54f97cd243`](https://github.com/nodejs/node-gyp/commit/54f97cd243)] - **doc**: add cmd to reset `xcode-select` to initial state (Valera Rozuvan) [#2235](https://github.com/nodejs/node-gyp/pull/2235)
    +
    +## v7.1.1 2020-10-15
    +
    +This release restores the location of shared library builds to the pre-v7
    +location. In v7.0.0 until this release, shared library outputs were placed
    +in a lib.target subdirectory inside the build/{Release,Debug} directory for
    +builds using `make` (Linux, etc.). This is inconsistent with macOS (Xcode)
    +behavior and previous node-gyp behavior so has been reverted.
    +We consider this a bug-fix rather than semver-major change.
    +
    +* [[`18bf2d1d38`](https://github.com/nodejs/node-gyp/commit/18bf2d1d38)] - **deps**: update deps to match npm@7 (Rod Vagg) [#2240](https://github.com/nodejs/node-gyp/pull/2240)
    +* [[`ee6a837cb7`](https://github.com/nodejs/node-gyp/commit/ee6a837cb7)] - **gyp**: update gyp to 0.6.1 (Rod Vagg) [#2238](https://github.com/nodejs/node-gyp/pull/2238)
    +* [[`3e7f8ccafc`](https://github.com/nodejs/node-gyp/commit/3e7f8ccafc)] - **lib**: better log message when ps fails (Martin Midtgaard) [#2229](https://github.com/nodejs/node-gyp/pull/2229)
    +* [[`7fb314339f`](https://github.com/nodejs/node-gyp/commit/7fb314339f)] - **test**: GitHub Actions: Test on Python 3.9 (Christian Clauss) [#2230](https://github.com/nodejs/node-gyp/pull/2230)
    +* [[`754996b9ec`](https://github.com/nodejs/node-gyp/commit/754996b9ec)] - **doc**: replace status badges with new Actions badge (Rod Vagg) [#2218](https://github.com/nodejs/node-gyp/pull/2218)
    +* [[`2317dc400c`](https://github.com/nodejs/node-gyp/commit/2317dc400c)] - **ci**: switch to GitHub Actions (Shelley Vohr) [#2210](https://github.com/nodejs/node-gyp/pull/2210)
    +* [[`2cca9b74f7`](https://github.com/nodejs/node-gyp/commit/2cca9b74f7)] - **doc**: drop the --production flag for installing windows-build-tools (DeeDeeG) [#2206](https://github.com/nodejs/node-gyp/pull/2206)
    +
    +## v7.1.0 2020-08-12
    +
    +* [[`aaf33c3029`](https://github.com/nodejs/node-gyp/commit/aaf33c3029)] - **build**: add update-gyp script (Samuel Attard) [#2167](https://github.com/nodejs/node-gyp/pull/2167)
    +* * [[`3baa4e4172`](https://github.com/nodejs/node-gyp/commit/3baa4e4172)] - **(SEMVER-MINOR)** **gyp**: update gyp to 0.4.0 (Samuel Attard) [#2165](https://github.com/nodejs/node-gyp/pull/2165)
    +* * [[`f461d56c53`](https://github.com/nodejs/node-gyp/commit/f461d56c53)] - **(SEMVER-MINOR)** **build**: support apple silicon (arm64 darwin) builds (Samuel Attard) [#2165](https://github.com/nodejs/node-gyp/pull/2165)
    +* * [[`ee6fa7d3bc`](https://github.com/nodejs/node-gyp/commit/ee6fa7d3bc)] - **docs**: note that node-gyp@7 should solve Catalina CLT issues (Rod Vagg) [#2156](https://github.com/nodejs/node-gyp/pull/2156)
    +* * [[`4fc8ff179d`](https://github.com/nodejs/node-gyp/commit/4fc8ff179d)] - **doc**: silence curl for macOS Catalina acid test (Chia Wei Ong) [#2150](https://github.com/nodejs/node-gyp/pull/2150)
    +* * [[`7857cb2eb1`](https://github.com/nodejs/node-gyp/commit/7857cb2eb1)] - **deps**: increase "engines" to "node" : "\>= 10.12.0" (DeeDeeG) [#2153](https://github.com/nodejs/node-gyp/pull/2153)
    +
    +## v7.0.0 2020-06-03
    +
    +* [[`e18a61afc1`](https://github.com/nodejs/node-gyp/commit/e18a61afc1)] - **build**: shrink bloated addon binaries on windows (Shelley Vohr) [#2060](https://github.com/nodejs/node-gyp/pull/2060)
    +* [[`4937722cf5`](https://github.com/nodejs/node-gyp/commit/4937722cf5)] - **(SEMVER-MAJOR)** **deps**: replace mkdirp with {recursive} mkdir (Rod Vagg) [#2123](https://github.com/nodejs/node-gyp/pull/2123)
    +* [[`d45438a047`](https://github.com/nodejs/node-gyp/commit/d45438a047)] - **(SEMVER-MAJOR)** **deps**: update deps, match to npm@7 (Rod Vagg) [#2126](https://github.com/nodejs/node-gyp/pull/2126)
    +* [[`ba4f34b7d6`](https://github.com/nodejs/node-gyp/commit/ba4f34b7d6)] - **doc**: update catalina xcode clt download link (Dario Vladovic) [#2133](https://github.com/nodejs/node-gyp/pull/2133)
    +* [[`f7bfce96ed`](https://github.com/nodejs/node-gyp/commit/f7bfce96ed)] - **doc**: update acid test and introduce curl|bash test script (Dario Vladovic) [#2105](https://github.com/nodejs/node-gyp/pull/2105)
    +* [[`e529f3309d`](https://github.com/nodejs/node-gyp/commit/e529f3309d)] - **doc**: update README to reflect upgrade to gyp-next (Ujjwal Sharma) [#2092](https://github.com/nodejs/node-gyp/pull/2092)
    +* [[`9aed6286a3`](https://github.com/nodejs/node-gyp/commit/9aed6286a3)] - **doc**: give more attention to Catalina issues doc (Matheus Marchini) [#2134](https://github.com/nodejs/node-gyp/pull/2134)
    +* [[`963f2a7b48`](https://github.com/nodejs/node-gyp/commit/963f2a7b48)] - **doc**: improve Catalina discoverability for search engines (Matheus Marchini) [#2135](https://github.com/nodejs/node-gyp/pull/2135)
    +* [[`7b75af349b`](https://github.com/nodejs/node-gyp/commit/7b75af349b)] - **doc**: add macOS Catalina software update info (Karl Horky) [#2078](https://github.com/nodejs/node-gyp/pull/2078)
    +* [[`4f23c7bee2`](https://github.com/nodejs/node-gyp/commit/4f23c7bee2)] - **doc**: update link to the code of conduct (#2073) (Michaël Zasso) [#2073](https://github.com/nodejs/node-gyp/pull/2073)
    +* [[`473cfa283f`](https://github.com/nodejs/node-gyp/commit/473cfa283f)] - **doc**: note in README that Python 3.8 is supported (#2072) (Michaël Zasso) [#2072](https://github.com/nodejs/node-gyp/pull/2072)
    +* [[`e7402b4a7c`](https://github.com/nodejs/node-gyp/commit/e7402b4a7c)] - **doc**: update catalina xcode cli tools download link (#2044) (Dario Vladović) [#2044](https://github.com/nodejs/node-gyp/pull/2044)
    +* [[`35de45984f`](https://github.com/nodejs/node-gyp/commit/35de45984f)] - **doc**: update catalina xcode cli tools download link; formatting (Jonathan Hult) [#2034](https://github.com/nodejs/node-gyp/pull/2034)
    +* [[`48642191f5`](https://github.com/nodejs/node-gyp/commit/48642191f5)] - **doc**: add download link for Command Line Tools for Xcode (Przemysław Bitkowski) [#2029](https://github.com/nodejs/node-gyp/pull/2029)
    +* [[`ae5b150051`](https://github.com/nodejs/node-gyp/commit/ae5b150051)] - **doc**: Catalina suggestion: remove /Library/Developer/CommandLineTools (Christian Clauss) [#2022](https://github.com/nodejs/node-gyp/pull/2022)
    +* [[`d1dea13fe4`](https://github.com/nodejs/node-gyp/commit/d1dea13fe4)] - **doc**: fix changelog 6.1.0 release year to be 2020 (Quentin Vernot) [#2021](https://github.com/nodejs/node-gyp/pull/2021)
    +* [[`6356117b08`](https://github.com/nodejs/node-gyp/commit/6356117b08)] - **doc, bin**: stop suggesting opening  node-gyp issues (Bartosz Sosnowski) [#2096](https://github.com/nodejs/node-gyp/pull/2096)
    +* [[`a6b76a8b48`](https://github.com/nodejs/node-gyp/commit/a6b76a8b48)] - **gyp**: update gyp to 0.2.1 (Ujjwal Sharma) [#2092](https://github.com/nodejs/node-gyp/pull/2092)
    +* [[`ebc34ec823`](https://github.com/nodejs/node-gyp/commit/ebc34ec823)] - **gyp**: update gyp to 0.2.0 (Ujjwal Sharma) [#2092](https://github.com/nodejs/node-gyp/pull/2092)
    +* [[`972780bde7`](https://github.com/nodejs/node-gyp/commit/972780bde7)] - **(SEMVER-MAJOR)** **gyp**: sync code base with nodejs repo (#1975) (Michaël Zasso) [#1975](https://github.com/nodejs/node-gyp/pull/1975)
    +* [[`c255ffbf6a`](https://github.com/nodejs/node-gyp/commit/c255ffbf6a)] - **lib**: drop "-2" flag for "py.exe" launcher (DeeDeeG) [#2131](https://github.com/nodejs/node-gyp/pull/2131)
    +* [[`1f7e1e93b5`](https://github.com/nodejs/node-gyp/commit/1f7e1e93b5)] - **lib**: ignore VS instances that cause COMExceptions (Andrew Casey) [#2018](https://github.com/nodejs/node-gyp/pull/2018)
    +* [[`741ab096d5`](https://github.com/nodejs/node-gyp/commit/741ab096d5)] - **test**: remove support for EOL versions of Node.js (Shelley Vohr)
    +* [[`ca86ef2539`](https://github.com/nodejs/node-gyp/commit/ca86ef2539)] - **test**: bump actions/checkout from v1 to v2 (BSKY) [#2063](https://github.com/nodejs/node-gyp/pull/2063)
    +
    +## v6.1.0 2020-01-08
    +
    +* [[`9a7dd16b76`](https://github.com/nodejs/node-gyp/commit/9a7dd16b76)] - **doc**: remove backticks from Python version list (Rod Vagg) [#2011](https://github.com/nodejs/node-gyp/pull/2011)
    +* [[`26cd6eaea6`](https://github.com/nodejs/node-gyp/commit/26cd6eaea6)] - **doc**: add GitHub Actions badge (#1994) (Rod Vagg) [#1994](https://github.com/nodejs/node-gyp/pull/1994)
    +* [[`312c12ef4f`](https://github.com/nodejs/node-gyp/commit/312c12ef4f)] - **doc**: update macOS\_Catalina.md (#1992) (James Home) [#1992](https://github.com/nodejs/node-gyp/pull/1992)
    +* [[`f7b6b6b77b`](https://github.com/nodejs/node-gyp/commit/f7b6b6b77b)] - **doc**: fix typo in README.md (#1985) (Suraneti Rodsuwan) [#1985](https://github.com/nodejs/node-gyp/pull/1985)
    +* [[`6b8f2652dd`](https://github.com/nodejs/node-gyp/commit/6b8f2652dd)] - **doc**: add travis badge (Rod Vagg) [#1971](https://github.com/nodejs/node-gyp/pull/1971)
    +* [[`20aa0b44f7`](https://github.com/nodejs/node-gyp/commit/20aa0b44f7)] - **doc**: macOS Catalina add two commands (Christian Clauss) [#1962](https://github.com/nodejs/node-gyp/pull/1962)
    +* [[`14f2a07a39`](https://github.com/nodejs/node-gyp/commit/14f2a07a39)] - **gyp**: list(dict) so we can del dict(key) while iterating (Christian Clauss) [#2009](https://github.com/nodejs/node-gyp/pull/2009)
    +* [[`f242ce4d2c`](https://github.com/nodejs/node-gyp/commit/f242ce4d2c)] - **lib**: compatibility with semver ≥ 7 (`new` for semver.Range) (Xavier Guimard) [#2006](https://github.com/nodejs/node-gyp/pull/2006)
    +* [[`3bcba2a01a`](https://github.com/nodejs/node-gyp/commit/3bcba2a01a)] - **(SEMVER-MINOR)** **lib**: noproxy support, match proxy detection to `request` (Matias Lopez) [#1978](https://github.com/nodejs/node-gyp/pull/1978)
    +* [[`470cc2178e`](https://github.com/nodejs/node-gyp/commit/470cc2178e)] - **test**: remove old docker test harness (#1993) (Rod Vagg) [#1993](https://github.com/nodejs/node-gyp/pull/1993)
    +* [[`31ecc8421d`](https://github.com/nodejs/node-gyp/commit/31ecc8421d)] - **test**: add Windows to GitHub Actions testing (#1996) (Christian Clauss) [#1996](https://github.com/nodejs/node-gyp/pull/1996)
    +* [[`5a729e86ee`](https://github.com/nodejs/node-gyp/commit/5a729e86ee)] - **test**: fix typo in header download test (#2001) (Richard Lau) [#2001](https://github.com/nodejs/node-gyp/pull/2001)
    +* [[`345c70e56d`](https://github.com/nodejs/node-gyp/commit/345c70e56d)] - **test**: direct python invocation & simpler pyenv (Matias Lopez) [#1979](https://github.com/nodejs/node-gyp/pull/1979)
    +* [[`d6a7e0e1fb`](https://github.com/nodejs/node-gyp/commit/d6a7e0e1fb)] - **test**: fix macOS Travis on Python 2.7 & 3.7 (Christian Clauss) [#1979](https://github.com/nodejs/node-gyp/pull/1979)
    +* [[`5a64e9bd32`](https://github.com/nodejs/node-gyp/commit/5a64e9bd32)] - **test**: initial Github Actions with Ubuntu & macOS (Christian Clauss) [#1985](https://github.com/nodejs/node-gyp/pull/1985)
    +* [[`04da736d38`](https://github.com/nodejs/node-gyp/commit/04da736d38)] - **test**: fix Python unittests (cclauss) [#1961](https://github.com/nodejs/node-gyp/pull/1961)
    +* [[`0670e5189d`](https://github.com/nodejs/node-gyp/commit/0670e5189d)] - **test**: add header download test (Rod Vagg) [#1796](https://github.com/nodejs/node-gyp/pull/1796)
    +* [[`c506a6a150`](https://github.com/nodejs/node-gyp/commit/c506a6a150)] - **test**: configure proper devDir for invoking configure() (Rod Vagg) [#1796](https://github.com/nodejs/node-gyp/pull/1796)
    +
    +## v6.0.1 2019-11-01
    +
    +* [[`8ec2e681d5`](https://github.com/nodejs/node-gyp/commit/8ec2e681d5)] - **doc**: add macOS\_Catalina.md document (cclauss) [#1940](https://github.com/nodejs/node-gyp/pull/1940)
    +* [[`1b11be63cc`](https://github.com/nodejs/node-gyp/commit/1b11be63cc)] - **gyp**: python3 fixes: utf8 decode, use of 'None' in eval (Wilfried Goesgens) [#1925](https://github.com/nodejs/node-gyp/pull/1925)
    +* [[`c0282daa48`](https://github.com/nodejs/node-gyp/commit/c0282daa48)] - **gyp**: iteritems() -\> items() in compile\_commands\_json.py (cclauss) [#1947](https://github.com/nodejs/node-gyp/pull/1947)
    +* [[`d8e09a1b6a`](https://github.com/nodejs/node-gyp/commit/d8e09a1b6a)] - **gyp**: make cmake python3 compatible (gengjiawen) [#1944](https://github.com/nodejs/node-gyp/pull/1944)
    +* [[`9c0f3404f0`](https://github.com/nodejs/node-gyp/commit/9c0f3404f0)] - **gyp**: fix TypeError in XcodeVersion() (Christian Clauss) [#1939](https://github.com/nodejs/node-gyp/pull/1939)
    +* [[`bb2eb72a3f`](https://github.com/nodejs/node-gyp/commit/bb2eb72a3f)] - **gyp**: finish decode stdout on Python 3 (Christian Clauss) [#1937](https://github.com/nodejs/node-gyp/pull/1937)
    +* [[`f0693413d9`](https://github.com/nodejs/node-gyp/commit/f0693413d9)] - **src,win**: allow 403 errors for arm64 node.lib (Richard Lau) [#1934](https://github.com/nodejs/node-gyp/pull/1934)
    +* [[`c60c22de58`](https://github.com/nodejs/node-gyp/commit/c60c22de58)] - **deps**: update deps to roughly match current npm@6 (Rod Vagg) [#1920](https://github.com/nodejs/node-gyp/pull/1920)
    +* [[`b91718eefc`](https://github.com/nodejs/node-gyp/commit/b91718eefc)] - **test**: upgrade Linux Travis CI to Python 3.8 (Christian Clauss) [#1923](https://github.com/nodejs/node-gyp/pull/1923)
    +* [[`3538a317b6`](https://github.com/nodejs/node-gyp/commit/3538a317b6)] - **doc**: adjustments to the README.md for new users (Dan Pike) [#1919](https://github.com/nodejs/node-gyp/pull/1919)
    +* [[`4fff8458c0`](https://github.com/nodejs/node-gyp/commit/4fff8458c0)] - **travis**: ignore failed `brew upgrade npm`, update xcode (Christian Clauss) [#1932](https://github.com/nodejs/node-gyp/pull/1932)
    +* [[`60e4488f08`](https://github.com/nodejs/node-gyp/commit/60e4488f08)] - **build**: avoid bare exceptions in xcode\_emulation.py (Christian Clauss) [#1932](https://github.com/nodejs/node-gyp/pull/1932)
    +* [[`032db2a2d0`](https://github.com/nodejs/node-gyp/commit/032db2a2d0)] - **lib,install**: always download SHA sums on Windows (Sam Hughes) [#1926](https://github.com/nodejs/node-gyp/pull/1926)
    +* [[`5a83630c33`](https://github.com/nodejs/node-gyp/commit/5a83630c33)] - **travis**: add Windows + Python 3.8 to the mix (Rod Vagg) [#1921](https://github.com/nodejs/node-gyp/pull/1921)
    +
    +## v6.0.0 2019-10-04
    +
    +* [[`dd0e97ef0b`](https://github.com/nodejs/node-gyp/commit/dd0e97ef0b)] - **(SEMVER-MAJOR)** **lib**: try to find `python` after `python3` (Sam Roberts) [#1907](https://github.com/nodejs/node-gyp/pull/1907)
    +* [[`f60ed47d14`](https://github.com/nodejs/node-gyp/commit/f60ed47d14)] - **travis**: add Python 3.5 and 3.6 tests on Linux (Christian Clauss) [#1903](https://github.com/nodejs/node-gyp/pull/1903)
    +* [[`c763ca1838`](https://github.com/nodejs/node-gyp/commit/c763ca1838)] - **(SEMVER-MAJOR)** **doc**: Declare that node-gyp is Python 3 compatible (cclauss) [#1811](https://github.com/nodejs/node-gyp/pull/1811)
    +* [[`3d1c60ab81`](https://github.com/nodejs/node-gyp/commit/3d1c60ab81)] - **(SEMVER-MAJOR)** **lib**: accept Python 3 by default (João Reis) [#1844](https://github.com/nodejs/node-gyp/pull/1844)
    +* [[`c6e3b65a23`](https://github.com/nodejs/node-gyp/commit/c6e3b65a23)] - **(SEMVER-MAJOR)** **lib**: raise the minimum Python version from 2.6 to 2.7 (cclauss) [#1818](https://github.com/nodejs/node-gyp/pull/1818)
    +
    +## v5.1.1 2020-05-25
    +
    +* [[`bdd3a79abe`](https://github.com/nodejs/node-gyp/commit/bdd3a79abe)] - **build**: shrink bloated addon binaries on windows (Shelley Vohr) [#2060](https://github.com/nodejs/node-gyp/pull/2060)
    +* [[`1f2ba75bc0`](https://github.com/nodejs/node-gyp/commit/1f2ba75bc0)] - **doc**: add macOS Catalina software update info (Karl Horky) [#2078](https://github.com/nodejs/node-gyp/pull/2078)
    +* [[`c106d915f5`](https://github.com/nodejs/node-gyp/commit/c106d915f5)] - **doc**: update catalina xcode cli tools download link (#2044) (Dario Vladović) [#2044](https://github.com/nodejs/node-gyp/pull/2044)
    +* [[`9a6fea92e2`](https://github.com/nodejs/node-gyp/commit/9a6fea92e2)] - **doc**: update catalina xcode cli tools download link; formatting (Jonathan Hult) [#2034](https://github.com/nodejs/node-gyp/pull/2034)
    +* [[`59b0b1add8`](https://github.com/nodejs/node-gyp/commit/59b0b1add8)] - **doc**: add download link for Command Line Tools for Xcode (Przemysław Bitkowski) [#2029](https://github.com/nodejs/node-gyp/pull/2029)
    +* [[`bb8d0e7b10`](https://github.com/nodejs/node-gyp/commit/bb8d0e7b10)] - **doc**: Catalina suggestion: remove /Library/Developer/CommandLineTools (Christian Clauss) [#2022](https://github.com/nodejs/node-gyp/pull/2022)
    +* [[`fb2e80d4e3`](https://github.com/nodejs/node-gyp/commit/fb2e80d4e3)] - **doc**: update link to the code of conduct (#2073) (Michaël Zasso) [#2073](https://github.com/nodejs/node-gyp/pull/2073)
    +* [[`251d9c885c`](https://github.com/nodejs/node-gyp/commit/251d9c885c)] - **doc**: note in README that Python 3.8 is supported (#2072) (Michaël Zasso) [#2072](https://github.com/nodejs/node-gyp/pull/2072)
    +* [[`2b6fc3c8d6`](https://github.com/nodejs/node-gyp/commit/2b6fc3c8d6)] - **doc, bin**: stop suggesting opening  node-gyp issues (Bartosz Sosnowski) [#2096](https://github.com/nodejs/node-gyp/pull/2096)
    +* [[`a876ae58ad`](https://github.com/nodejs/node-gyp/commit/a876ae58ad)] - **test**: bump actions/checkout from v1 to v2 (BSKY) [#2063](https://github.com/nodejs/node-gyp/pull/2063)
    +
    +## v5.1.0 2020-02-05
    +
    +* [[`f37a8b40d0`](https://github.com/nodejs/node-gyp/commit/f37a8b40d0)] - **doc**: add GitHub Actions badge (#1994) (Rod Vagg) [#1994](https://github.com/nodejs/node-gyp/pull/1994)
    +* [[`cb3f6aae5e`](https://github.com/nodejs/node-gyp/commit/cb3f6aae5e)] - **doc**: update macOS\_Catalina.md (#1992) (James Home) [#1992](https://github.com/nodejs/node-gyp/pull/1992)
    +* [[`0607596a4c`](https://github.com/nodejs/node-gyp/commit/0607596a4c)] - **doc**: fix typo in README.md (#1985) (Suraneti Rodsuwan) [#1985](https://github.com/nodejs/node-gyp/pull/1985)
    +* [[`0d5a415a14`](https://github.com/nodejs/node-gyp/commit/0d5a415a14)] - **doc**: add travis badge (Rod Vagg) [#1971](https://github.com/nodejs/node-gyp/pull/1971)
    +* [[`103740cd95`](https://github.com/nodejs/node-gyp/commit/103740cd95)] - **gyp**: list(dict) so we can del dict(key) while iterating (Christian Clauss) [#2009](https://github.com/nodejs/node-gyp/pull/2009)
    +* [[`278dcddbdd`](https://github.com/nodejs/node-gyp/commit/278dcddbdd)] - **lib**: ignore VS instances that cause COMExceptions (Andrew Casey) [#2018](https://github.com/nodejs/node-gyp/pull/2018)
    +* [[`1694907bbf`](https://github.com/nodejs/node-gyp/commit/1694907bbf)] - **lib**: compatibility with semver ≥ 7 (`new` for semver.Range) (Xavier Guimard) [#2006](https://github.com/nodejs/node-gyp/pull/2006)
    +* [[`a3f1143514`](https://github.com/nodejs/node-gyp/commit/a3f1143514)] - **(SEMVER-MINOR)** **lib**: noproxy support, match proxy detection to `request` (Matias Lopez) [#1978](https://github.com/nodejs/node-gyp/pull/1978)
    +* [[`52365819c7`](https://github.com/nodejs/node-gyp/commit/52365819c7)] - **test**: remove old docker test harness (#1993) (Rod Vagg) [#1993](https://github.com/nodejs/node-gyp/pull/1993)
    +* [[`bc509c511d`](https://github.com/nodejs/node-gyp/commit/bc509c511d)] - **test**: add Windows to GitHub Actions testing (#1996) (Christian Clauss) [#1996](https://github.com/nodejs/node-gyp/pull/1996)
    +* [[`91ee26dd48`](https://github.com/nodejs/node-gyp/commit/91ee26dd48)] - **test**: fix typo in header download test (#2001) (Richard Lau) [#2001](https://github.com/nodejs/node-gyp/pull/2001)
    +* [[`0923f344c9`](https://github.com/nodejs/node-gyp/commit/0923f344c9)] - **test**: direct python invocation & simpler pyenv (Matias Lopez) [#1979](https://github.com/nodejs/node-gyp/pull/1979)
    +* [[`32c8744b34`](https://github.com/nodejs/node-gyp/commit/32c8744b34)] - **test**: fix macOS Travis on Python 2.7 & 3.7 (Christian Clauss) [#1979](https://github.com/nodejs/node-gyp/pull/1979)
    +* [[`fd4b1351e4`](https://github.com/nodejs/node-gyp/commit/fd4b1351e4)] - **test**: initial Github Actions with Ubuntu & macOS (Christian Clauss) [#1985](https://github.com/nodejs/node-gyp/pull/1985)
    +
    +## v5.0.7 2019-12-16
    +
    +Republish of v5.0.6 with unnecessary tarball removed from pack file.
    +
    +## v5.0.6 2019-12-16
    +
    +* [[`cdec00286f`](https://github.com/nodejs/node-gyp/commit/cdec00286f)] - **doc**: adjustments to the README.md for new users (Dan Pike) [#1919](https://github.com/nodejs/node-gyp/pull/1919)
    +* [[`b7c8233ef2`](https://github.com/nodejs/node-gyp/commit/b7c8233ef2)] - **test**: fix Python unittests (cclauss) [#1961](https://github.com/nodejs/node-gyp/pull/1961)
    +* [[`e12b00ab0a`](https://github.com/nodejs/node-gyp/commit/e12b00ab0a)] - **doc**: macOS Catalina add two commands (Christian Clauss) [#1962](https://github.com/nodejs/node-gyp/pull/1962)
    +* [[`70b9890c0d`](https://github.com/nodejs/node-gyp/commit/70b9890c0d)] - **test**: add header download test (Rod Vagg) [#1796](https://github.com/nodejs/node-gyp/pull/1796)
    +* [[`4029fa8629`](https://github.com/nodejs/node-gyp/commit/4029fa8629)] - **test**: configure proper devDir for invoking configure() (Rod Vagg) [#1796](https://github.com/nodejs/node-gyp/pull/1796)
    +* [[`fe8b02cc8b`](https://github.com/nodejs/node-gyp/commit/fe8b02cc8b)] - **doc**: add macOS\_Catalina.md document (cclauss) [#1940](https://github.com/nodejs/node-gyp/pull/1940)
    +* [[`8ea47ce365`](https://github.com/nodejs/node-gyp/commit/8ea47ce365)] - **gyp**: python3 fixes: utf8 decode, use of 'None' in eval (Wilfried Goesgens) [#1925](https://github.com/nodejs/node-gyp/pull/1925)
    +* [[`c7229716ba`](https://github.com/nodejs/node-gyp/commit/c7229716ba)] - **gyp**: iteritems() -\> items() in compile\_commands\_json.py (cclauss) [#1947](https://github.com/nodejs/node-gyp/pull/1947)
    +* [[`2a18b2a0f8`](https://github.com/nodejs/node-gyp/commit/2a18b2a0f8)] - **gyp**: make cmake python3 compatible (gengjiawen) [#1944](https://github.com/nodejs/node-gyp/pull/1944)
    +* [[`70f391e844`](https://github.com/nodejs/node-gyp/commit/70f391e844)] - **gyp**: fix TypeError in XcodeVersion() (Christian Clauss) [#1939](https://github.com/nodejs/node-gyp/pull/1939)
    +* [[`9f4f0fa34e`](https://github.com/nodejs/node-gyp/commit/9f4f0fa34e)] - **gyp**: finish decode stdout on Python 3 (Christian Clauss) [#1937](https://github.com/nodejs/node-gyp/pull/1937)
    +* [[`7cf507906d`](https://github.com/nodejs/node-gyp/commit/7cf507906d)] - **src,win**: allow 403 errors for arm64 node.lib (Richard Lau) [#1934](https://github.com/nodejs/node-gyp/pull/1934)
    +* [[`ad0d182c01`](https://github.com/nodejs/node-gyp/commit/ad0d182c01)] - **deps**: update deps to roughly match current npm@6 (Rod Vagg) [#1920](https://github.com/nodejs/node-gyp/pull/1920)
    +* [[`1553081ed6`](https://github.com/nodejs/node-gyp/commit/1553081ed6)] - **test**: upgrade Linux Travis CI to Python 3.8 (Christian Clauss) [#1923](https://github.com/nodejs/node-gyp/pull/1923)
    +* [[`0705cae9aa`](https://github.com/nodejs/node-gyp/commit/0705cae9aa)] - **travis**: ignore failed `brew upgrade npm`, update xcode (Christian Clauss) [#1932](https://github.com/nodejs/node-gyp/pull/1932)
    +* [[`7bfdb6f5bf`](https://github.com/nodejs/node-gyp/commit/7bfdb6f5bf)] - **build**: avoid bare exceptions in xcode\_emulation.py (Christian Clauss) [#1932](https://github.com/nodejs/node-gyp/pull/1932)
    +* [[`7edf7658fa`](https://github.com/nodejs/node-gyp/commit/7edf7658fa)] - **lib,install**: always download SHA sums on Windows (Sam Hughes) [#1926](https://github.com/nodejs/node-gyp/pull/1926)
    +* [[`69056d04fe`](https://github.com/nodejs/node-gyp/commit/69056d04fe)] - **travis**: add Windows + Python 3.8 to the mix (Rod Vagg) [#1921](https://github.com/nodejs/node-gyp/pull/1921)
    +
    +## v5.0.5 2019-10-04
    +
    +* [[`3891391746`](https://github.com/nodejs/node-gyp/commit/3891391746)] - **doc**: reconcile README with Python 3 compat changes (Rod Vagg) [#1911](https://github.com/nodejs/node-gyp/pull/1911)
    +* [[`07f81f1920`](https://github.com/nodejs/node-gyp/commit/07f81f1920)] - **lib**: accept Python 3 after Python 2 (Sam Roberts) [#1910](https://github.com/nodejs/node-gyp/pull/1910)
    +* [[`04ce59f4a2`](https://github.com/nodejs/node-gyp/commit/04ce59f4a2)] - **doc**: clarify Python configuration, etc (Sam Roberts) [#1908](https://github.com/nodejs/node-gyp/pull/1908)
    +* [[`01c46ee3df`](https://github.com/nodejs/node-gyp/commit/01c46ee3df)] - **gyp**: add \_\_lt\_\_ to MSVSSolutionEntry (João Reis) [#1904](https://github.com/nodejs/node-gyp/pull/1904)
    +* [[`735d961b99`](https://github.com/nodejs/node-gyp/commit/735d961b99)] - **win**: support VS 2017 Desktop Express (João Reis) [#1902](https://github.com/nodejs/node-gyp/pull/1902)
    +* [[`3834156a92`](https://github.com/nodejs/node-gyp/commit/3834156a92)] - **test**: add Python 3.5 and 3.6 tests on Linux (cclauss) [#1909](https://github.com/nodejs/node-gyp/pull/1909)
    +* [[`1196e990d8`](https://github.com/nodejs/node-gyp/commit/1196e990d8)] - **src**: update to standard@14 (Rod Vagg) [#1899](https://github.com/nodejs/node-gyp/pull/1899)
    +* [[`53ee7dfe89`](https://github.com/nodejs/node-gyp/commit/53ee7dfe89)] - **gyp**: fix undefined name: cflags --\> ldflags (Christian Clauss) [#1901](https://github.com/nodejs/node-gyp/pull/1901)
    +* [[`5871dcf6c9`](https://github.com/nodejs/node-gyp/commit/5871dcf6c9)] - **src,win**: add support for fetching arm64 node.lib (Richard Townsend) [#1875](https://github.com/nodejs/node-gyp/pull/1875)
    +
    +## v5.0.4 2019-09-27
    +
    +* [[`1236869ffc`](https://github.com/nodejs/node-gyp/commit/1236869ffc)] - **gyp**: modify XcodeVersion() to convert "4.2" to "0420" and "10.0" to "1000" (Christian Clauss) [#1895](https://github.com/nodejs/node-gyp/pull/1895)
    +* [[`36638afe48`](https://github.com/nodejs/node-gyp/commit/36638afe48)] - **gyp**: more decode stdout on Python 3 (cclauss) [#1894](https://github.com/nodejs/node-gyp/pull/1894)
    +* [[`f753c167c5`](https://github.com/nodejs/node-gyp/commit/f753c167c5)] - **gyp**: decode stdout on Python 3 (cclauss) [#1890](https://github.com/nodejs/node-gyp/pull/1890)
    +* [[`60a4083523`](https://github.com/nodejs/node-gyp/commit/60a4083523)] - **doc**: update xcode install instructions to match Node's BUILDING (Nhan Khong) [#1884](https://github.com/nodejs/node-gyp/pull/1884)
    +* [[`19dbc9ac32`](https://github.com/nodejs/node-gyp/commit/19dbc9ac32)] - **deps**: update tar to 4.4.12 (Matheus Marchini) [#1889](https://github.com/nodejs/node-gyp/pull/1889)
    +* [[`5f3ed92181`](https://github.com/nodejs/node-gyp/commit/5f3ed92181)] - **bin**: fix the usage instructions (Halit Ogunc) [#1888](https://github.com/nodejs/node-gyp/pull/1888)
    +* [[`aab118edf1`](https://github.com/nodejs/node-gyp/commit/aab118edf1)] - **lib**: adding keep-alive header to download requests (Milad Farazmand) [#1863](https://github.com/nodejs/node-gyp/pull/1863)
    +* [[`1186e89326`](https://github.com/nodejs/node-gyp/commit/1186e89326)] - **lib**: ignore non-critical os.userInfo() failures (Rod Vagg) [#1835](https://github.com/nodejs/node-gyp/pull/1835)
    +* [[`785e527c3d`](https://github.com/nodejs/node-gyp/commit/785e527c3d)] - **doc**: fix missing argument for setting python path (lagorsse) [#1802](https://github.com/nodejs/node-gyp/pull/1802)
    +* [[`a97615196c`](https://github.com/nodejs/node-gyp/commit/a97615196c)] - **gyp**: rm semicolons (Python != JavaScript) (MattIPv4) [#1858](https://github.com/nodejs/node-gyp/pull/1858)
    +* [[`06019bac24`](https://github.com/nodejs/node-gyp/commit/06019bac24)] - **gyp**: assorted typo fixes (XhmikosR) [#1853](https://github.com/nodejs/node-gyp/pull/1853)
    +* [[`3f4972c1ca`](https://github.com/nodejs/node-gyp/commit/3f4972c1ca)] - **gyp**: use "is" when comparing to None (Vladyslav Burzakovskyy) [#1860](https://github.com/nodejs/node-gyp/pull/1860)
    +* [[`1cb4708073`](https://github.com/nodejs/node-gyp/commit/1cb4708073)] - **src,win**: improve unmanaged handling (Peter Sabath) [#1852](https://github.com/nodejs/node-gyp/pull/1852)
    +* [[`5553cd910e`](https://github.com/nodejs/node-gyp/commit/5553cd910e)] - **gyp**: improve Windows+Cygwin compatibility (Jose Quijada) [#1817](https://github.com/nodejs/node-gyp/pull/1817)
    +* [[`8bcb1fbb43`](https://github.com/nodejs/node-gyp/commit/8bcb1fbb43)] - **gyp**: Python 3 Windows fixes (João Reis) [#1843](https://github.com/nodejs/node-gyp/pull/1843)
    +* [[`2e24d0a326`](https://github.com/nodejs/node-gyp/commit/2e24d0a326)] - **test**: accept Python 3 in test-find-python.js (João Reis) [#1843](https://github.com/nodejs/node-gyp/pull/1843)
    +* [[`1267b4dc1c`](https://github.com/nodejs/node-gyp/commit/1267b4dc1c)] - **build**: add test run Python 3.7 on macOS (Christian Clauss) [#1843](https://github.com/nodejs/node-gyp/pull/1843)
    +* [[`da1b031aa3`](https://github.com/nodejs/node-gyp/commit/da1b031aa3)] - **build**: import StringIO on Python 2 and Python 3 (Christian Clauss) [#1836](https://github.com/nodejs/node-gyp/pull/1836)
    +* [[`fa0ed4aa42`](https://github.com/nodejs/node-gyp/commit/fa0ed4aa42)] - **build**: more Python 3 compat, replace compile with ast (cclauss) [#1820](https://github.com/nodejs/node-gyp/pull/1820)
    +* [[`18d5c7c9d0`](https://github.com/nodejs/node-gyp/commit/18d5c7c9d0)] - **win,src**: update win\_delay\_load\_hook.cc to work with /clr (Ivan Petrovic) [#1819](https://github.com/nodejs/node-gyp/pull/1819)
    +
    +## v5.0.3 2019-07-17
    +
    +* [[`66ad305775`](https://github.com/nodejs/node-gyp/commit/66ad305775)] - **python**: accept Python 3 conditionally (João Reis) [#1815](https://github.com/nodejs/node-gyp/pull/1815)
    +* [[`7e7fce3fed`](https://github.com/nodejs/node-gyp/commit/7e7fce3fed)] - **python**: move Python detection to its own file (João Reis) [#1815](https://github.com/nodejs/node-gyp/pull/1815)
    +* [[`e40c99e283`](https://github.com/nodejs/node-gyp/commit/e40c99e283)] - **src**: implement standard.js linting (Rod Vagg) [#1794](https://github.com/nodejs/node-gyp/pull/1794)
    +* [[`bb92c761a9`](https://github.com/nodejs/node-gyp/commit/bb92c761a9)] - **test**: add Node.js 6 on Windows to Travis CI (João Reis) [#1812](https://github.com/nodejs/node-gyp/pull/1812)
    +* [[`7fd924079f`](https://github.com/nodejs/node-gyp/commit/7fd924079f)] - **test**: increase tap timeout (João Reis) [#1812](https://github.com/nodejs/node-gyp/pull/1812)
    +* [[`7e8127068f`](https://github.com/nodejs/node-gyp/commit/7e8127068f)] - **test**: cover supported node versions with travis (Rod Vagg) [#1809](https://github.com/nodejs/node-gyp/pull/1809)
    +* [[`24109148df`](https://github.com/nodejs/node-gyp/commit/24109148df)] - **test**: downgrade to tap@^12 for continued Node 6 support (Rod Vagg) [#1808](https://github.com/nodejs/node-gyp/pull/1808)
    +* [[`656117cc4a`](https://github.com/nodejs/node-gyp/commit/656117cc4a)] - **win**: make VS path match case-insensitive (João Reis) [#1806](https://github.com/nodejs/node-gyp/pull/1806)
    +
    +## v5.0.2 2019-06-27
    +
    +* [[`2761afbf73`](https://github.com/nodejs/node-gyp/commit/2761afbf73)] - **build,test**: add duplicate symbol test (Gabriel Schulhof) [#1689](https://github.com/nodejs/node-gyp/pull/1689)
    +* [[`82f129d6de`](https://github.com/nodejs/node-gyp/commit/82f129d6de)] - **gyp**: replace optparse to argparse (KiYugadgeter) [#1591](https://github.com/nodejs/node-gyp/pull/1591)
    +* [[`afaaa29c61`](https://github.com/nodejs/node-gyp/commit/afaaa29c61)] - **gyp**: remove from \_\_future\_\_ import with\_statement (cclauss) [#1799](https://github.com/nodejs/node-gyp/pull/1799)
    +* [[`a991f633d6`](https://github.com/nodejs/node-gyp/commit/a991f633d6)] - **gyp**: fix the remaining Python 3 issues (cclauss) [#1793](https://github.com/nodejs/node-gyp/pull/1793)
    +* [[`f952b08f84`](https://github.com/nodejs/node-gyp/commit/f952b08f84)] - **gyp**: move from \_\_future\_\_ import to the top of the file (cclauss) [#1789](https://github.com/nodejs/node-gyp/pull/1789)
    +* [[`4f4a677dfa`](https://github.com/nodejs/node-gyp/commit/4f4a677dfa)] - **gyp**: use different default compiler for z/OS (Shuowang (Wayne) Zhang) [#1768](https://github.com/nodejs/node-gyp/pull/1768)
    +* [[`03683f09d6`](https://github.com/nodejs/node-gyp/commit/03683f09d6)] - **lib**: code de-duplication (Pavel Medvedev) [#965](https://github.com/nodejs/node-gyp/pull/965)
    +* [[`611bc3c89f`](https://github.com/nodejs/node-gyp/commit/611bc3c89f)] - **lib**: add .json suffix for explicit require (Rod Vagg) [#1787](https://github.com/nodejs/node-gyp/pull/1787)
    +* [[`d3478d7b0b`](https://github.com/nodejs/node-gyp/commit/d3478d7b0b)] - **meta**: add to .gitignore (Refael Ackermann) [#1573](https://github.com/nodejs/node-gyp/pull/1573)
    +* [[`7a9a038e9e`](https://github.com/nodejs/node-gyp/commit/7a9a038e9e)] - **test**: add parallel test runs on macOS and Windows (cclauss) [#1800](https://github.com/nodejs/node-gyp/pull/1800)
    +* [[`7dd7f2b2a2`](https://github.com/nodejs/node-gyp/commit/7dd7f2b2a2)] - **test**: fix Python syntax error in test-adding.js (cclauss) [#1793](https://github.com/nodejs/node-gyp/pull/1793)
    +* [[`395f843de0`](https://github.com/nodejs/node-gyp/commit/395f843de0)] - **test**: replace self-signed cert with 'localhost' (Rod Vagg) [#1795](https://github.com/nodejs/node-gyp/pull/1795)
    +* [[`a52c6eb9e8`](https://github.com/nodejs/node-gyp/commit/a52c6eb9e8)] - **test**: migrate from tape to tap (Rod Vagg) [#1795](https://github.com/nodejs/node-gyp/pull/1795)
    +* [[`ec2eb44a30`](https://github.com/nodejs/node-gyp/commit/ec2eb44a30)] - **test**: use Nan in duplicate\_symbols (Gabriel Schulhof) [#1689](https://github.com/nodejs/node-gyp/pull/1689)
    +* [[`1597c84aad`](https://github.com/nodejs/node-gyp/commit/1597c84aad)] - **test**: use Travis CI to run tests on every pull request (cclauss) [#1752](https://github.com/nodejs/node-gyp/pull/1752)
    +* [[`dd9bf929ac`](https://github.com/nodejs/node-gyp/commit/dd9bf929ac)] - **zos**: update compiler options (Shuowang (Wayne) Zhang) [#1768](https://github.com/nodejs/node-gyp/pull/1768)
    +
    +## v5.0.1 2019-06-20
    +
    +* [[`e3861722ed`](https://github.com/nodejs/node-gyp/commit/e3861722ed)] - **doc**: document --jobs max (David Sanders) [#1770](https://github.com/nodejs/node-gyp/pull/1770)
    +* [[`1cfdb28886`](https://github.com/nodejs/node-gyp/commit/1cfdb28886)] - **lib**: reintroduce support for iojs file naming for releases \>= 1 && \< 4 (Samuel Attard) [#1777](https://github.com/nodejs/node-gyp/pull/1777)
    +
    +## v5.0.0 2019-06-13
    +
    +* [[`8a83972743`](https://github.com/nodejs/node-gyp/commit/8a83972743)] - **(SEMVER-MAJOR)** **bin**: follow XDG OS conventions for storing data (Selwyn) [#1570](https://github.com/nodejs/node-gyp/pull/1570)
    +* [[`9e46872ea3`](https://github.com/nodejs/node-gyp/commit/9e46872ea3)] - **bin,lib**: remove extra comments/lines/spaces (Jon Moss) [#1508](https://github.com/nodejs/node-gyp/pull/1508)
    +* [[`8098ebdeb4`](https://github.com/nodejs/node-gyp/commit/8098ebdeb4)] - **deps**: replace `osenv` dependency with native `os` (Selwyn)
    +* [[`f83b457e03`](https://github.com/nodejs/node-gyp/commit/f83b457e03)] - **deps**: bump request to 2.8.7, fixes heok/hawk issues (Rohit Hazra) [#1492](https://github.com/nodejs/node-gyp/pull/1492)
    +* [[`323cee7323`](https://github.com/nodejs/node-gyp/commit/323cee7323)] - **deps**: pin `request` version range (Refael Ackermann) [#1300](https://github.com/nodejs/node-gyp/pull/1300)
    +* [[`c515912d08`](https://github.com/nodejs/node-gyp/commit/c515912d08)] - **doc**: improve issue template (Bartosz Sosnowski) [#1618](https://github.com/nodejs/node-gyp/pull/1618)
    +* [[`cca2d66727`](https://github.com/nodejs/node-gyp/commit/cca2d66727)] - **doc**: python info needs own header (Taylor D. Lee) [#1245](https://github.com/nodejs/node-gyp/pull/1245)
    +* [[`3e64c780f5`](https://github.com/nodejs/node-gyp/commit/3e64c780f5)] - **doc**: lint README.md (Jon Moss) [#1498](https://github.com/nodejs/node-gyp/pull/1498)
    +* [[`a20faedc91`](https://github.com/nodejs/node-gyp/commit/a20faedc91)] - **(SEMVER-MAJOR)** **gyp**: enable MARMASM items only on new VS versions (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)
    +* [[`721eb691cf`](https://github.com/nodejs/node-gyp/commit/721eb691cf)] - **gyp**: teach MSVS generator about MARMASM Items (Jon Kunkee) [#1679](https://github.com/nodejs/node-gyp/pull/1679)
    +* [[`91744bfecc`](https://github.com/nodejs/node-gyp/commit/91744bfecc)] - **gyp**: add support for Windows on Arm (Richard Townsend) [#1739](https://github.com/nodejs/node-gyp/pull/1739)
    +* [[`a6e0a6c7ed`](https://github.com/nodejs/node-gyp/commit/a6e0a6c7ed)] - **gyp**: move compile\_commands\_json (Paul Maréchal) [#1661](https://github.com/nodejs/node-gyp/pull/1661)
    +* [[`92e8b52cee`](https://github.com/nodejs/node-gyp/commit/92e8b52cee)] - **gyp**: fix target --\> self.target (cclauss)
    +* [[`febdfa2137`](https://github.com/nodejs/node-gyp/commit/febdfa2137)] - **gyp**: fix sntex error (cclauss) [#1333](https://github.com/nodejs/node-gyp/pull/1333)
    +* [[`588d333c14`](https://github.com/nodejs/node-gyp/commit/588d333c14)] - **gyp**: \_winreg module was renamed to winreg in Python 3. (Craig Rodrigues)
    +* [[`98226d198c`](https://github.com/nodejs/node-gyp/commit/98226d198c)] - **gyp**: replace basestring with str, but only on Python 3. (Craig Rodrigues)
    +* [[`7535e4478e`](https://github.com/nodejs/node-gyp/commit/7535e4478e)] - **gyp**: replace deprecated functions (Craig Rodrigues)
    +* [[`2040cd21cc`](https://github.com/nodejs/node-gyp/commit/2040cd21cc)] - **gyp**: use print as a function, as specified in PEP 3105. (Craig Rodrigues)
    +* [[`abef93ded5`](https://github.com/nodejs/node-gyp/commit/abef93ded5)] - **gyp**: get ready for python 3 (cclauss)
    +* [[`43031fadcb`](https://github.com/nodejs/node-gyp/commit/43031fadcb)] - **python**: clean-up detection (João Reis) [#1582](https://github.com/nodejs/node-gyp/pull/1582)
    +* [[`49ab79d221`](https://github.com/nodejs/node-gyp/commit/49ab79d221)] - **python**: more informative error (Refael Ackermann) [#1269](https://github.com/nodejs/node-gyp/pull/1269)
    +* [[`997bc3c748`](https://github.com/nodejs/node-gyp/commit/997bc3c748)] - **readme**: add ARM64 info to MSVC setup instructions (Jon Kunkee) [#1655](https://github.com/nodejs/node-gyp/pull/1655)
    +* [[`788e767179`](https://github.com/nodejs/node-gyp/commit/788e767179)] - **test**: remove unused variable (João Reis)
    +* [[`6f5a408934`](https://github.com/nodejs/node-gyp/commit/6f5a408934)] - **tools**: fix usage of inherited -fPIC and -fPIE (Jens) [#1340](https://github.com/nodejs/node-gyp/pull/1340)
    +* [[`0efb8fb34b`](https://github.com/nodejs/node-gyp/commit/0efb8fb34b)] - **(SEMVER-MAJOR)** **win**: support running in VS Command Prompt (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)
    +* [[`360ddbdf3a`](https://github.com/nodejs/node-gyp/commit/360ddbdf3a)] - **(SEMVER-MAJOR)** **win**: add support for Visual Studio 2019 (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)
    +* [[`8f43f68275`](https://github.com/nodejs/node-gyp/commit/8f43f68275)] - **(SEMVER-MAJOR)** **win**: detect all VS versions in node-gyp (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)
    +* [[`7fe4095974`](https://github.com/nodejs/node-gyp/commit/7fe4095974)] - **(SEMVER-MAJOR)** **win**: generic Visual Studio 2017 detection (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)
    +* [[`7a71d68bce`](https://github.com/nodejs/node-gyp/commit/7a71d68bce)] - **win**: use msbuild from the configure stage (Bartosz Sosnowski) [#1654](https://github.com/nodejs/node-gyp/pull/1654)
    +* [[`d3b21220a0`](https://github.com/nodejs/node-gyp/commit/d3b21220a0)] - **win**: fix delay-load hook for electron 4 (Andy Dill)
    +* [[`81f3a92338`](https://github.com/nodejs/node-gyp/commit/81f3a92338)] - Update list of Node.js versions to test against. (Ben Noordhuis) [#1670](https://github.com/nodejs/node-gyp/pull/1670)
    +* [[`4748f6ab75`](https://github.com/nodejs/node-gyp/commit/4748f6ab75)] - Remove deprecated compatibility code. (Ben Noordhuis) [#1670](https://github.com/nodejs/node-gyp/pull/1670)
    +* [[`45e3221fd4`](https://github.com/nodejs/node-gyp/commit/45e3221fd4)] - Remove an outdated workaround for Python 2.4 (cclauss) [#1650](https://github.com/nodejs/node-gyp/pull/1650)
    +* [[`721dc7d314`](https://github.com/nodejs/node-gyp/commit/721dc7d314)] - Add ARM64 to MSBuild /Platform logic (Jon Kunkee) [#1655](https://github.com/nodejs/node-gyp/pull/1655)
    +* [[`a5b7410497`](https://github.com/nodejs/node-gyp/commit/a5b7410497)] - Add ESLint no-unused-vars rule (Jon Moss) [#1497](https://github.com/nodejs/node-gyp/pull/1497)
    +
    +## v4.0.0 2019-04-24
    +
    +* [[`ceed5cbe10`](https://github.com/nodejs/node-gyp/commit/ceed5cbe10)] - **deps**: updated tar package version to 4.4.8 (Pobegaylo Maksim) [#1713](https://github.com/nodejs/node-gyp/pull/1713)
    +* [[`374519e066`](https://github.com/nodejs/node-gyp/commit/374519e066)] - **(SEMVER-MAJOR)** Upgrade to tar v3 (isaacs) [#1212](https://github.com/nodejs/node-gyp/pull/1212)
    +* [[`e6699d13cd`](https://github.com/nodejs/node-gyp/commit/e6699d13cd)] - **test**: fix addon test for Node.js 12 and V8 7.4 (Richard Lau) [#1705](https://github.com/nodejs/node-gyp/pull/1705)
    +* [[`0c6bf530a0`](https://github.com/nodejs/node-gyp/commit/0c6bf530a0)] - **lib**: use print() for python version detection (GreenAddress) [#1534](https://github.com/nodejs/node-gyp/pull/1534)
    +
    +## v3.8.0 2018-08-09
    +
    +* [[`c5929cb4fe`](https://github.com/nodejs/node-gyp/commit/c5929cb4fe)] - **doc**: update Xcode preferences tab name. (Ivan Daniluk) [#1330](https://github.com/nodejs/node-gyp/pull/1330)
    +* [[`8b488da8b9`](https://github.com/nodejs/node-gyp/commit/8b488da8b9)] - **doc**: update link to commit guidelines (Jonas Hermsmeier) [#1456](https://github.com/nodejs/node-gyp/pull/1456)
    +* [[`b4fe8c16f9`](https://github.com/nodejs/node-gyp/commit/b4fe8c16f9)] - **doc**: fix visual studio links (Bartosz Sosnowski) [#1490](https://github.com/nodejs/node-gyp/pull/1490)
    +* [[`536759c7e9`](https://github.com/nodejs/node-gyp/commit/536759c7e9)] - **configure**: use sys.version\_info to get python version (Yang Guo) [#1504](https://github.com/nodejs/node-gyp/pull/1504)
    +* [[`94c39c604e`](https://github.com/nodejs/node-gyp/commit/94c39c604e)] - **gyp**: fix ninja build failure (GYP patch) (Daniel Bevenius) [nodejs/node#12484](https://github.com/nodejs/node/pull/12484)
    +* [[`e8ea74e0fa`](https://github.com/nodejs/node-gyp/commit/e8ea74e0fa)] - **tools**: patch gyp to avoid xcrun errors (Ujjwal Sharma) [nodejs/node#21520](https://github.com/nodejs/node/pull/21520)
    +* [[`ea9aff44f2`](https://github.com/nodejs/node-gyp/commit/ea9aff44f2)] - **tools**: fix "the the" typos in comments (Masashi Hirano) [nodejs/node#20716](https://github.com/nodejs/node/pull/20716)
    +* [[`207e5aa4fd`](https://github.com/nodejs/node-gyp/commit/207e5aa4fd)] - **gyp**: implement LD/LDXX for ninja and FIPS (Sam Roberts)
    +* [[`b416c5f4b7`](https://github.com/nodejs/node-gyp/commit/b416c5f4b7)] - **gyp**: enable cctest to use objects (gyp part) (Daniel Bevenius) [nodejs/node#12450](https://github.com/nodejs/node/pull/12450)
    +* [[`40692d016b`](https://github.com/nodejs/node-gyp/commit/40692d016b)] - **gyp**: add compile\_commands.json gyp generator (Ben Noordhuis) [nodejs/node#12450](https://github.com/nodejs/node/pull/12450)
    +* [[`fc3c4e2b10`](https://github.com/nodejs/node-gyp/commit/fc3c4e2b10)] - **gyp**: float gyp patch for long filenames (Anna Henningsen) [nodejs/node#7963](https://github.com/nodejs/node/pull/7963)
    +* [[`8aedbfdef6`](https://github.com/nodejs/node-gyp/commit/8aedbfdef6)] - **gyp**: backport GYP fix to fix AIX shared suffix (Stewart Addison)
    +* [[`6cd84b84fc`](https://github.com/nodejs/node-gyp/commit/6cd84b84fc)] - **test**: formatting and minor fixes for execFileSync replacement (Rod Vagg) [#1521](https://github.com/nodejs/node-gyp/pull/1521)
    +* [[`60e421363f`](https://github.com/nodejs/node-gyp/commit/60e421363f)] - **test**: added test/processExecSync.js for when execFileSync is not available. (Rohit Hazra) [#1492](https://github.com/nodejs/node-gyp/pull/1492)
    +* [[`969447c5bd`](https://github.com/nodejs/node-gyp/commit/969447c5bd)] - **deps**: bump request to 2.8.7, fixes heok/hawk issues (Rohit Hazra) [#1492](https://github.com/nodejs/node-gyp/pull/1492)
    +* [[`340403ccfe`](https://github.com/nodejs/node-gyp/commit/340403ccfe)] - **win**: improve parsing of SDK version (Alessandro Vergani) [#1516](https://github.com/nodejs/node-gyp/pull/1516)
    +
    +## v3.7.0 2018-06-08
    +
    +* [[`84cea7b30d`](https://github.com/nodejs/node-gyp/commit/84cea7b30d)] - Remove unused gyp test scripts. (Ben Noordhuis) [#1458](https://github.com/nodejs/node-gyp/pull/1458)
    +* [[`0540e4ec63`](https://github.com/nodejs/node-gyp/commit/0540e4ec63)] - **gyp**: escape spaces in filenames in make generator (Jeff Senn) [#1436](https://github.com/nodejs/node-gyp/pull/1436)
    +* [[`88fc6fa0ec`](https://github.com/nodejs/node-gyp/commit/88fc6fa0ec)] - Drop dependency on minimatch. (Brian Woodward) [#1158](https://github.com/nodejs/node-gyp/pull/1158)
    +* [[`1e203c5148`](https://github.com/nodejs/node-gyp/commit/1e203c5148)] - Fix include path when pointing to Node.js source (Richard Lau) [#1055](https://github.com/nodejs/node-gyp/pull/1055)
    +* [[`53d8cb967c`](https://github.com/nodejs/node-gyp/commit/53d8cb967c)] - Prefix build targets with /t: on Windows (Natalie Wolfe) [#1164](https://github.com/nodejs/node-gyp/pull/1164)
    +* [[`53a5f8ff38`](https://github.com/nodejs/node-gyp/commit/53a5f8ff38)] - **gyp**: add support for .mm files to msvs generator (Julien Racle) [#1167](https://github.com/nodejs/node-gyp/pull/1167)
    +* [[`dd8561e528`](https://github.com/nodejs/node-gyp/commit/dd8561e528)] - **zos**: don't use universal-new-lines mode (John Barboza) [#1451](https://github.com/nodejs/node-gyp/pull/1451)
    +* [[`e5a69010ed`](https://github.com/nodejs/node-gyp/commit/e5a69010ed)] - **zos**: add search locations for libnode.x (John Barboza) [#1451](https://github.com/nodejs/node-gyp/pull/1451)
    +* [[`79febace53`](https://github.com/nodejs/node-gyp/commit/79febace53)] - **doc**: update macOS information in README (Josh Parnham) [#1323](https://github.com/nodejs/node-gyp/pull/1323)
    +* [[`9425448945`](https://github.com/nodejs/node-gyp/commit/9425448945)] - **gyp**: don't print xcodebuild not found errors (Gibson Fahnestock) [#1370](https://github.com/nodejs/node-gyp/pull/1370)
    +* [[`6f1286f5b2`](https://github.com/nodejs/node-gyp/commit/6f1286f5b2)] - Fix infinite install loop. (Ben Noordhuis) [#1384](https://github.com/nodejs/node-gyp/pull/1384)
    +* [[`2580b9139e`](https://github.com/nodejs/node-gyp/commit/2580b9139e)] - Update `--nodedir` description in README. (Ben Noordhuis) [#1372](https://github.com/nodejs/node-gyp/pull/1372)
    +* [[`a61360391a`](https://github.com/nodejs/node-gyp/commit/a61360391a)] - Update README with another way to install on windows (JeffAtDeere) [#1352](https://github.com/nodejs/node-gyp/pull/1352)
    +* [[`47496bf6dc`](https://github.com/nodejs/node-gyp/commit/47496bf6dc)] - Fix IndexError when parsing GYP files. (Ben Noordhuis) [#1267](https://github.com/nodejs/node-gyp/pull/1267)
    +* [[`b2024dee7b`](https://github.com/nodejs/node-gyp/commit/b2024dee7b)] - **zos**: support platform (John Barboza) [#1276](https://github.com/nodejs/node-gyp/pull/1276)
    +* [[`90d86512f4`](https://github.com/nodejs/node-gyp/commit/90d86512f4)] - **win**: run PS with `-NoProfile` (Refael Ackermann) [#1292](https://github.com/nodejs/node-gyp/pull/1292)
    +* [[`2da5f86ef7`](https://github.com/nodejs/node-gyp/commit/2da5f86ef7)] - **doc**: add github PR and Issue templates (Gibson Fahnestock) [#1228](https://github.com/nodejs/node-gyp/pull/1228)
    +* [[`a46a770d68`](https://github.com/nodejs/node-gyp/commit/a46a770d68)] - **doc**: update proposed DCO and CoC (Mikeal Rogers) [#1229](https://github.com/nodejs/node-gyp/pull/1229)
    +* [[`7e803d58e0`](https://github.com/nodejs/node-gyp/commit/7e803d58e0)] - **doc**: headerify the Install instructions (Nick Schonning) [#1225](https://github.com/nodejs/node-gyp/pull/1225)
    +* [[`f27599193a`](https://github.com/nodejs/node-gyp/commit/f27599193a)] - **gyp**: update xml string encoding conversion (Liu Chao) [#1203](https://github.com/nodejs/node-gyp/pull/1203)
    +* [[`0a07e481f7`](https://github.com/nodejs/node-gyp/commit/0a07e481f7)] - **configure**: don't set ensure if tarball is set (Gibson Fahnestock) [#1220](https://github.com/nodejs/node-gyp/pull/1220)
    +
    +## v3.6.3 2018-06-08
    +
    +* [[`90cd2e8da9`](https://github.com/nodejs/node-gyp/commit/90cd2e8da9)] - **gyp**: fix regex to match multi-digit versions (Jonas Hermsmeier) [#1455](https://github.com/nodejs/node-gyp/pull/1455)
    +* [[`7900122337`](https://github.com/nodejs/node-gyp/commit/7900122337)] - deps: pin `request` version range (Refael Ackerman) [#1300](https://github.com/nodejs/node-gyp/pull/1300)
    +
    +## v3.6.2 2017-06-01
    +
    +* [[`72afdd62cd`](https://github.com/nodejs/node-gyp/commit/72afdd62cd)] - **build**: rename copyNodeLib() to doBuild() (Liu Chao) [#1206](https://github.com/nodejs/node-gyp/pull/1206)
    +* [[`bad903ac70`](https://github.com/nodejs/node-gyp/commit/bad903ac70)] - **win**: more robust parsing of SDK version (Refael Ackermann) [#1198](https://github.com/nodejs/node-gyp/pull/1198)
    +* [[`241752f381`](https://github.com/nodejs/node-gyp/commit/241752f381)] - Log dist-url. (Ben Noordhuis) [#1170](https://github.com/nodejs/node-gyp/pull/1170)
    +* [[`386746c7d1`](https://github.com/nodejs/node-gyp/commit/386746c7d1)] - **configure**: use full path in node_lib_file GYP var (Pavel Medvedev) [#964](https://github.com/nodejs/node-gyp/pull/964)
    +* [[`0913b2dd99`](https://github.com/nodejs/node-gyp/commit/0913b2dd99)] - **build, win**: use target_arch to link with node.lib (Pavel Medvedev) [#964](https://github.com/nodejs/node-gyp/pull/964)
    +* [[`c307b302f7`](https://github.com/nodejs/node-gyp/commit/c307b302f7)] - **doc**: blorb about setting `npm_config_OPTION_NAME` (Refael Ackermann) [#1185](https://github.com/nodejs/node-gyp/pull/1185)
    +
    +## v3.6.1 2017-04-30
    +
    +* [[`49801716c2`](https://github.com/nodejs/node-gyp/commit/49801716c2)] - **test**: fix test-find-python on v0.10.x buildbot. (Ben Noordhuis) [#1172](https://github.com/nodejs/node-gyp/pull/1172)
    +* [[`a83a3801fc`](https://github.com/nodejs/node-gyp/commit/a83a3801fc)] - **test**: fix test/test-configure-python on AIX (Richard Lau) [#1131](https://github.com/nodejs/node-gyp/pull/1131)
    +* [[`8a767145c9`](https://github.com/nodejs/node-gyp/commit/8a767145c9)] - **gyp**: Revert quote_cmd workaround (Kunal Pathak) [#1153](https://github.com/nodejs/node-gyp/pull/1153)
    +* [[`c09cf7671e`](https://github.com/nodejs/node-gyp/commit/c09cf7671e)] - **doc**: add a note for using `configure` on Windows (Vse Mozhet Byt) [#1152](https://github.com/nodejs/node-gyp/pull/1152)
    +* [[`da9cb5f411`](https://github.com/nodejs/node-gyp/commit/da9cb5f411)] - Delete superfluous .patch files. (Ben Noordhuis) [#1122](https://github.com/nodejs/node-gyp/pull/1122)
    +
    +## v3.6.0 2017-03-16
    +
    +* [[`ae141e1906`](https://github.com/nodejs/node-gyp/commit/ae141e1906)] - **win**: find and setup for VS2017 (Refael Ackermann) [#1130](https://github.com/nodejs/node-gyp/pull/1130)
    +* [[`ec5fc36a80`](https://github.com/nodejs/node-gyp/commit/ec5fc36a80)] - Add support to build node.js with chakracore for ARM. (Kunal Pathak) [#873](https://github.com/nodejs/node-gyp/pull/873)
    +* [[`a04ea3051a`](https://github.com/nodejs/node-gyp/commit/a04ea3051a)] - Add support to build node.js with chakracore. (Kunal Pathak) [#873](https://github.com/nodejs/node-gyp/pull/873)
    +* [[`93d7fa83c8`](https://github.com/nodejs/node-gyp/commit/93d7fa83c8)] - Upgrade semver dependency. (Ben Noordhuis) [#1107](https://github.com/nodejs/node-gyp/pull/1107)
    +* [[`ff9a6fadfd`](https://github.com/nodejs/node-gyp/commit/ff9a6fadfd)] - Update link of gyp as Google code is shutting down (Peter Dave Hello) [#1061](https://github.com/nodejs/node-gyp/pull/1061)
    +
    +## v3.5.0 2017-01-10
    +
    +* [[`762d19a39e`](https://github.com/nodejs/node-gyp/commit/762d19a39e)] - \[doc\] merge History.md and CHANGELOG.md (Rod Vagg)
    +* [[`80fc5c3d31`](https://github.com/nodejs/node-gyp/commit/80fc5c3d31)] - Fix deprecated dependency warning (Simone Primarosa) [#1069](https://github.com/nodejs/node-gyp/pull/1069)
    +* [[`05c44944fd`](https://github.com/nodejs/node-gyp/commit/05c44944fd)] - Open the build file with universal-newlines mode (Guy Margalit) [#1053](https://github.com/nodejs/node-gyp/pull/1053)
    +* [[`37ae7be114`](https://github.com/nodejs/node-gyp/commit/37ae7be114)] - Try python launcher when stock python is python 3. (Ben Noordhuis) [#992](https://github.com/nodejs/node-gyp/pull/992)
    +* [[`e3778d9907`](https://github.com/nodejs/node-gyp/commit/e3778d9907)] - Add lots of findPython() tests. (Ben Noordhuis) [#992](https://github.com/nodejs/node-gyp/pull/992)
    +* [[`afc766adf6`](https://github.com/nodejs/node-gyp/commit/afc766adf6)] - Unset executable bit for .bat files (Pavel Medvedev) [#969](https://github.com/nodejs/node-gyp/pull/969)
    +* [[`ddac348991`](https://github.com/nodejs/node-gyp/commit/ddac348991)] - Use push on PYTHONPATH and add tests (Michael Hart) [#990](https://github.com/nodejs/node-gyp/pull/990)
    +* [[`b182a19042`](https://github.com/nodejs/node-gyp/commit/b182a19042)] - ***Revert*** "add "path-array" dep" (Michael Hart) [#990](https://github.com/nodejs/node-gyp/pull/990)
    +* [[`7c08b85c5a`](https://github.com/nodejs/node-gyp/commit/7c08b85c5a)] - ***Revert*** "**configure**: use "path-array" for PYTHONPATH" (Michael Hart) [#990](https://github.com/nodejs/node-gyp/pull/990)
    +* [[`9c8d275526`](https://github.com/nodejs/node-gyp/commit/9c8d275526)] - Add --devdir flag. (Ben Noordhuis) [#916](https://github.com/nodejs/node-gyp/pull/916)
    +* [[`f6eab1f9e4`](https://github.com/nodejs/node-gyp/commit/f6eab1f9e4)] - **doc**: add windows-build-tools to readme (Felix Rieseberg) [#970](https://github.com/nodejs/node-gyp/pull/970)
    +
    +## v3.4.0 2016-06-28
    +
    +* [[`ce5fd04e94`](https://github.com/nodejs/node-gyp/commit/ce5fd04e94)] - **deps**: update minimatch version (delphiactual) [#961](https://github.com/nodejs/node-gyp/pull/961)
    +* [[`77383ddd85`](https://github.com/nodejs/node-gyp/commit/77383ddd85)] - Replace fs.accessSync call to fs.statSync (Richard Lau) [#955](https://github.com/nodejs/node-gyp/pull/955)
    +* [[`0dba4bda57`](https://github.com/nodejs/node-gyp/commit/0dba4bda57)] - **test**: add simple addon test (Richard Lau) [#955](https://github.com/nodejs/node-gyp/pull/955)
    +* [[`c4344b3889`](https://github.com/nodejs/node-gyp/commit/c4344b3889)] - **doc**: add --target option to README (Gibson Fahnestock) [#958](https://github.com/nodejs/node-gyp/pull/958)
    +* [[`cc778e9215`](https://github.com/nodejs/node-gyp/commit/cc778e9215)] - Override BUILDING_UV_SHARED, BUILDING_V8_SHARED. (Ben Noordhuis) [#915](https://github.com/nodejs/node-gyp/pull/915)
    +* [[`af35b2ad32`](https://github.com/nodejs/node-gyp/commit/af35b2ad32)] - Move VC++ Build Tools to Build Tools landing page. (Andrew Pardoe) [#953](https://github.com/nodejs/node-gyp/pull/953)
    +* [[`f31482e226`](https://github.com/nodejs/node-gyp/commit/f31482e226)] - **win**: work around __pfnDliNotifyHook2 type change (Alexis Campailla) [#952](https://github.com/nodejs/node-gyp/pull/952)
    +* [[`3df8222fa5`](https://github.com/nodejs/node-gyp/commit/3df8222fa5)] - Allow for npmlog@3.x (Rebecca Turner) [#950](https://github.com/nodejs/node-gyp/pull/950)
    +* [[`a4fa07b390`](https://github.com/nodejs/node-gyp/commit/a4fa07b390)] - More verbose error on locating msbuild.exe failure. (Mateusz Jaworski) [#930](https://github.com/nodejs/node-gyp/pull/930)
    +* [[`4ee31329e0`](https://github.com/nodejs/node-gyp/commit/4ee31329e0)] - **doc**: add command options to README.md (Gibson Fahnestock) [#937](https://github.com/nodejs/node-gyp/pull/937)
    +* [[`c8c7ca86b9`](https://github.com/nodejs/node-gyp/commit/c8c7ca86b9)] - Add --silent option for zero output. (Gibson Fahnestock) [#937](https://github.com/nodejs/node-gyp/pull/937)
    +* [[`ac29d23a7c`](https://github.com/nodejs/node-gyp/commit/ac29d23a7c)] - Upgrade to glob@7.0.3. (Ben Noordhuis) [#943](https://github.com/nodejs/node-gyp/pull/943)
    +* [[`15fd56be3d`](https://github.com/nodejs/node-gyp/commit/15fd56be3d)] - Enable V8 deprecation warnings for native modules (Matt Loring) [#920](https://github.com/nodejs/node-gyp/pull/920)
    +* [[`7f1c1b960c`](https://github.com/nodejs/node-gyp/commit/7f1c1b960c)] - **gyp**: improvements for android generator (Robert Chiras) [#935](https://github.com/nodejs/node-gyp/pull/935)
    +* [[`088082766c`](https://github.com/nodejs/node-gyp/commit/088082766c)] - Update Windows install instructions (Sara Itani) [#867](https://github.com/nodejs/node-gyp/pull/867)
    +* [[`625c1515f9`](https://github.com/nodejs/node-gyp/commit/625c1515f9)] - **gyp**: inherit CC/CXX for CC/CXX.host (Johan Bergström) [#908](https://github.com/nodejs/node-gyp/pull/908)
    +* [[`3bcb1720e4`](https://github.com/nodejs/node-gyp/commit/3bcb1720e4)] - Add support for the Python launcher on Windows (Patrick Westerhoff) [#894](https://github.com/nodejs/node-gyp/pull/894
    +
    +## v3.3.1 2016-03-04
    +
    +* [[`a981ef847a`](https://github.com/nodejs/node-gyp/commit/a981ef847a)] - **gyp**: fix android generator (Robert Chiras) [#889](https://github.com/nodejs/node-gyp/pull/889)
    +
    +## v3.3.0 2016-02-16
    +
    +* [[`818d854a4d`](https://github.com/nodejs/node-gyp/commit/818d854a4d)] - Introduce NODEJS_ORG_MIRROR and IOJS_ORG_MIRROR (Rod Vagg) [#878](https://github.com/nodejs/node-gyp/pull/878)
    +* [[`d1e4cc4b62`](https://github.com/nodejs/node-gyp/commit/d1e4cc4b62)] - **(SEMVER-MINOR)** Download headers tarball for ~0.12.10 || ~0.10.42 (Rod Vagg) [#877](https://github.com/nodejs/node-gyp/pull/877)
    +* [[`6e28ad1bea`](https://github.com/nodejs/node-gyp/commit/6e28ad1bea)] - Allow for npmlog@2.x (Rebecca Turner) [#861](https://github.com/nodejs/node-gyp/pull/861)
    +* [[`07371e5812`](https://github.com/nodejs/node-gyp/commit/07371e5812)] - Use -fPIC for NetBSD. (Marcin Cieślak) [#856](https://github.com/nodejs/node-gyp/pull/856)
    +* [[`8c4b0ffa50`](https://github.com/nodejs/node-gyp/commit/8c4b0ffa50)] - **(SEMVER-MINOR)** Add --cafile command line option. (Ben Noordhuis) [#837](https://github.com/nodejs/node-gyp/pull/837)
    +* [[`b3ad43498e`](https://github.com/nodejs/node-gyp/commit/b3ad43498e)] - **(SEMVER-MINOR)** Make download() function testable. (Ben Noordhuis) [#837](https://github.com/nodejs/node-gyp/pull/837)
    +
    +## v3.2.1 2015-12-03
    +
    +* [[`ab89b477c4`](https://github.com/nodejs/node-gyp/commit/ab89b477c4)] - Upgrade gyp to b3cef02. (Ben Noordhuis) [#831](https://github.com/nodejs/node-gyp/pull/831)
    +* [[`90078ecb17`](https://github.com/nodejs/node-gyp/commit/90078ecb17)] - Define WIN32_LEAN_AND_MEAN conditionally. (Ben Noordhuis) [#824](https://github.com/nodejs/node-gyp/pull/824)
    +
    +## v3.2.0 2015-11-25
    +
    +* [[`268f1ca4c7`](https://github.com/nodejs/node-gyp/commit/268f1ca4c7)] - Use result of `which` when searching for python. (Refael Ackermann) [#668](https://github.com/nodejs/node-gyp/pull/668)
    +* [[`817ed9bd78`](https://github.com/nodejs/node-gyp/commit/817ed9bd78)] - Add test for python executable search logic. (Ben Noordhuis) [#756](https://github.com/nodejs/node-gyp/pull/756)
    +* [[`0e2dfda1f3`](https://github.com/nodejs/node-gyp/commit/0e2dfda1f3)] - Fix test/test-options when run through `npm test`. (Ben Noordhuis) [#755](https://github.com/nodejs/node-gyp/pull/755)
    +* [[`9bfa0876b4`](https://github.com/nodejs/node-gyp/commit/9bfa0876b4)] - Add support for AIX (Michael Dawson) [#753](https://github.com/nodejs/node-gyp/pull/753)
    +* [[`a8d441a0a2`](https://github.com/nodejs/node-gyp/commit/a8d441a0a2)] - Update README for Windows 10 support. (Jason Williams) [#766](https://github.com/nodejs/node-gyp/pull/766)
    +* [[`d1d6015276`](https://github.com/nodejs/node-gyp/commit/d1d6015276)] - Update broken links and switch to HTTPS. (andrew morton)
    +
    +## v3.1.0 2015-11-14
    +
    +* [[`9049241f91`](https://github.com/nodejs/node-gyp/commit/9049241f91)] - **gyp**: don't use links at all, just copy the files instead (Nathan Zadoks)
    +* [[`8ef90348d1`](https://github.com/nodejs/node-gyp/commit/8ef90348d1)] - **gyp**: apply https://codereview.chromium.org/11361103/ (Nathan Rajlich)
    +* [[`a2ed0df84e`](https://github.com/nodejs/node-gyp/commit/a2ed0df84e)] - **gyp**: always install into $PRODUCT_DIR (Nathan Rajlich)
    +* [[`cc8b2fa83e`](https://github.com/nodejs/node-gyp/commit/cc8b2fa83e)] - Update gyp to b3cef02. (Imran Iqbal) [#781](https://github.com/nodejs/node-gyp/pull/781)
    +* [[`f5d86eb84e`](https://github.com/nodejs/node-gyp/commit/f5d86eb84e)] - Update to tar@2.0.0. (Edgar Muentes) [#797](https://github.com/nodejs/node-gyp/pull/797)
    +* [[`2ac7de02c4`](https://github.com/nodejs/node-gyp/commit/2ac7de02c4)] - Fix infinite loop with zero-length options. (Ben Noordhuis) [#745](https://github.com/nodejs/node-gyp/pull/745)
    +* [[`101bed639b`](https://github.com/nodejs/node-gyp/commit/101bed639b)] - This platform value came from debian package, and now the value (Jérémy Lal) [#738](https://github.com/nodejs/node-gyp/pull/738)
    +
    +## v3.0.3 2015-09-14
    +
    +* [[`ad827cda30`](https://github.com/nodejs/node-gyp/commit/ad827cda30)] - tarballUrl global and && when checking for iojs (Lars-Magnus Skog) [#729](https://github.com/nodejs/node-gyp/pull/729)
    +
    +## v3.0.2 2015-09-12
    +
    +* [[`6e8c3bf3c6`](https://github.com/nodejs/node-gyp/commit/6e8c3bf3c6)] - add back support for passing additional cmdline args (Rod Vagg) [#723](https://github.com/nodejs/node-gyp/pull/723)
    +* [[`ff82f2f3b9`](https://github.com/nodejs/node-gyp/commit/ff82f2f3b9)] - fixed broken link in docs to Visual Studio 2013 download (simon-p-r) [#722](https://github.com/nodejs/node-gyp/pull/722)
    +
    +## v3.0.1 2015-09-08
    +
    +* [[`846337e36b`](https://github.com/nodejs/node-gyp/commit/846337e36b)] - normalise versions for target == this comparison (Rod Vagg) [#716](https://github.com/nodejs/node-gyp/pull/716)
    +
    +## v3.0.0 2015-09-08
    +
    +* [[`9720d0373c`](https://github.com/nodejs/node-gyp/commit/9720d0373c)] - remove node_modules from tree (Rod Vagg) [#711](https://github.com/nodejs/node-gyp/pull/711)
    +* [[`6dcf220db7`](https://github.com/nodejs/node-gyp/commit/6dcf220db7)] - test version major directly, don't use semver.satisfies() (Rod Vagg) [#711](https://github.com/nodejs/node-gyp/pull/711)
    +* [[`938dd18d1c`](https://github.com/nodejs/node-gyp/commit/938dd18d1c)] - refactor for clarity, fix dist-url, add env var dist-url functionality (Rod Vagg) [#711](https://github.com/nodejs/node-gyp/pull/711)
    +* [[`9e9df66a06`](https://github.com/nodejs/node-gyp/commit/9e9df66a06)] - use process.release, make aware of io.js & node v4 differences (Rod Vagg) [#711](https://github.com/nodejs/node-gyp/pull/711)
    +* [[`1ea7ed01f4`](https://github.com/nodejs/node-gyp/commit/1ea7ed01f4)] - **deps**: update graceful-fs dependency to the latest (Sakthipriyan Vairamani) [#714](https://github.com/nodejs/node-gyp/pull/714)
    +* [[`0fbc387b35`](https://github.com/nodejs/node-gyp/commit/0fbc387b35)] - Update repository URLs. (Ben Noordhuis) [#715](https://github.com/nodejs/node-gyp/pull/715)
    +* [[`bbedb8868b`](https://github.com/nodejs/node-gyp/commit/bbedb8868b)] - **(SEMVER-MAJOR)** **win**: enable delay-load hook by default (Jeremiah Senkpiel) [#708](https://github.com/nodejs/node-gyp/pull/708)
    +* [[`85ed107565`](https://github.com/nodejs/node-gyp/commit/85ed107565)] - Merge pull request #664 from othiym23/othiym23/allow-semver-5 (Nathan Rajlich)
    +* [[`0c720d234c`](https://github.com/nodejs/node-gyp/commit/0c720d234c)] - allow semver@5 (Forrest L Norvell)
    +
    +## 2.0.2 / 2015-07-14
    +
    +  * Use HTTPS for dist url (#656, @SonicHedgehog)
    +  * Merge pull request #648 from nevosegal/master
    +  * Merge pull request #650 from magic890/patch-1
    +  * Updated Installation section on README
    +  * Updated link to gyp user documentation
    +  * Fix download error message spelling (#643, @tomxtobin)
    +  * Merge pull request #637 from lygstate/master
    +  * Set NODE_GYP_DIR for addon.gypi to setting absolute path for
    +    src/win_delay_load_hook.c, and fixes of the long relative path issue on Win32.
    +    Fixes #636 (#637, @lygstate).
    +
    +## 2.0.1 / 2015-05-28
    +
    +  * configure: try/catch the semver range.test() call
    +  * README: update for visual studio 2013 (#510, @samccone)
    +
    +## 2.0.0 / 2015-05-24
    +
    +  * configure: check for python2 executable by default, fallback to python
    +  * configure: don't clobber existing $PYTHONPATH
    +  * configure: use "path-array" for PYTHONPATH
    +  * gyp: fix for non-acsii userprofile name on Windows
    +  * gyp: always install into $PRODUCT_DIR
    +  * gyp: apply https://codereview.chromium.org/11361103/
    +  * gyp: don't use links at all, just copy the files instead
    +  * gyp: update gyp to e1c8fcf7
    +  * Updated README.md with updated Windows build info
    +  * Show URL when a download fails
    +  * package: add a "license" field
    +  * move HMODULE m declaration to top
    +  * Only add "-undefined dynamic_lookup" to loadable_module targets
    +  * win: optionally allow node.exe/iojs.exe to be renamed
    +  * Avoid downloading shasums if using tarPath
    +  * Add target name preprocessor define: `NODE_GYP_MODULE_NAME`
    +  * Show better error message in case of bad network settings
    diff --git a/node_modules/npm/node_modules/node-gyp/CODE_OF_CONDUCT.md b/node_modules/npm/node_modules/node-gyp/CODE_OF_CONDUCT.md
    new file mode 100644
    index 00000000..4c211405
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/CODE_OF_CONDUCT.md
    @@ -0,0 +1,4 @@
    +# Code of Conduct
    +
    +* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md)
    +* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/master/Moderation-Policy.md)
    diff --git a/node_modules/npm/node_modules/node-gyp/CONTRIBUTING.md b/node_modules/npm/node_modules/node-gyp/CONTRIBUTING.md
    new file mode 100644
    index 00000000..5b977898
    --- /dev/null
    +++ b/node_modules/npm/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/main/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/npm/node_modules/node-gyp/LICENSE b/node_modules/npm/node_modules/node-gyp/LICENSE
    new file mode 100644
    index 00000000..2ea4dc5e
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/README.md b/node_modules/npm/node_modules/node-gyp/README.md
    new file mode 100644
    index 00000000..474c59b4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/README.md
    @@ -0,0 +1,273 @@
    +# `node-gyp` - Node.js native addon build tool
    +
    +[![Build Status](https://github.com/nodejs/node-gyp/workflows/Tests/badge.svg?branch=main)](https://github.com/nodejs/node-gyp/actions?query=workflow%3ATests+branch%3Amain)
    +![npm](https://img.shields.io/npm/dm/node-gyp)
    +
    +`node-gyp` is a cross-platform command-line tool written in Node.js for
    +compiling native addon modules for Node.js. It contains a vendored copy of the
    +[gyp-next](https://github.com/nodejs/gyp-next) project that was previously used
    +by the Chromium team and extended to support the development of Node.js native
    +addons.
    +
    +Note that `node-gyp` is _not_ used to build Node.js itself.
    +
    +All current and LTS target versions of Node.js are supported. Depending on what version of Node.js is actually installed on your system
    +`node-gyp` downloads the necessary development files or headers for the target version. List of stable Node.js versions can be found on [Node.js website](https://nodejs.org/en/about/previous-releases).
    +
    +## Features
    +
    + * The same build commands work on any of the supported platforms
    + * Supports the targeting of different versions of Node.js
    +
    +## Installation
    +
    +> [!Important]
    +> Python >= v3.12 requires `node-gyp` >= v10
    +
    +You can install `node-gyp` using `npm`:
    +
    +``` bash
    +npm install -g node-gyp
    +```
    +
    +Depending on your operating system, you will need to install:
    +
    +### On Unix
    +
    +   * [A supported version of Python](https://devguide.python.org/versions/)
    +   * `make`
    +   * A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org)
    +
    +### On macOS
    +
    +   * [A supported version of Python](https://devguide.python.org/versions/)
    +   * `Xcode Command Line Tools` which will install `clang`, `clang++`, and `make`.
    +     * Install the `Xcode Command Line Tools` standalone by running `xcode-select --install`. -- OR --
    +     * Alternatively, if you already have the [full Xcode installed](https://developer.apple.com/xcode/download/), you can install the Command Line Tools under the menu `Xcode -> Open Developer Tool -> More Developer Tools...`.
    +
    +
    +### On Windows
    +
    +Install tools with [Chocolatey](https://chocolatey.org):
    +``` bash
    +choco install python visualstudio2022-workload-vctools -y
    +```
    +
    +Or install and configure Python and Visual Studio tools manually:
    +
    +  * Install the current [version of Python](https://devguide.python.org/versions/) from the
    +  [Microsoft Store](https://apps.microsoft.com/store/search?publisher=Python+Software+Foundation).
    +
    +   * Install Visual C++ Build Environment: For Visual Studio 2019 or later, use the `Desktop development with C++` workload from [Visual Studio Community](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community).  For a version older than Visual Studio 2019, install [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools) with the `Visual C++ build tools` option.
    +
    +   If the above steps didn't work for you, please visit [Microsoft's Node.js Guidelines for Windows](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules) for additional tips.
    +
    +   To target native ARM64 Node.js on Windows on ARM, add the components "Visual C++ compilers and libraries for ARM64" and "Visual C++ ATL for ARM64".
    +
    +   To use the native ARM64 C++ compiler on Windows on ARM, ensure that you have Visual Studio 2022 [17.4 or later](https://devblogs.microsoft.com/visualstudio/arm64-visual-studio-is-officially-here/) installed.
    +
    +It's advised to install following Powershell module: [VSSetup](https://github.com/microsoft/vssetup.powershell) using `Install-Module VSSetup -Scope CurrentUser`.
    +This will make Visual Studio detection logic to use more flexible and accessible method, avoiding Powershell's `ConstrainedLanguage` mode.
    +
    +### Configuring Python Dependency
    +
    +`node-gyp` requires that you have installed a [supported version of Python](https://devguide.python.org/versions/).
    +If you have multiple versions of Python installed, you can identify which version
    +`node-gyp` should use in one of the following ways:
    +
    +1. by setting the `--python` command-line option, e.g.:
    +
    +``` bash
    +node-gyp  --python /path/to/executable/python
    +```
    +
    +2. If `node-gyp` is called by way of `npm`, *and* you have multiple versions of
    +Python installed, then you can set the `npm_config_python` environment variable
    +to the appropriate path:
    +``` bash
    +export npm_config_python=/path/to/executable/python
    +```
    +    Or on Windows:
    +```console
    +py --list-paths  # To see the installed Python versions
    +set npm_config_python=C:\path\to\python.exe  # CMD
    +$Env:npm_config_python="C:\path\to\python.exe"  # PowerShell
    +```
    +
    +3. If the `PYTHON` environment variable is set to the path of a Python executable,
    +then that version will be used if it is a supported version.
    +
    +4. If the `NODE_GYP_FORCE_PYTHON` environment variable is set to the path of a
    +Python executable, it will be used instead of any of the other configured or
    +built-in Python search paths. If it's not a compatible version, no further
    +searching will be done.
    +
    +### Build for Third Party Node.js Runtimes
    +
    +When building modules for third-party Node.js runtimes like Electron, which have
    +different build configurations from the official Node.js distribution, you
    +should use `--dist-url` or `--nodedir` flags to specify the headers of the
    +runtime to build for.
    +
    +Also when `--dist-url` or `--nodedir` flags are passed, node-gyp will use the
    +`config.gypi` shipped in the headers distribution to generate build
    +configurations, which is different from the default mode that would use the
    +`process.config` object of the running Node.js instance.
    +
    +Some old versions of Electron shipped malformed `config.gypi` in their headers
    +distributions, and you might need to pass `--force-process-config` to node-gyp
    +to work around configuration errors.
    +
    +## How to Use
    +
    +To compile your native addon first go to its root directory:
    +
    +``` bash
    +cd my_node_addon
    +```
    +
    +The next step is to generate the appropriate project build files for the current
    +platform. Use `configure` for that:
    +
    +``` bash
    +node-gyp configure
    +```
    +
    +Auto-detection fails for Visual C++ Build Tools 2015, so `--msvs_version=2015`
    +needs to be added (not needed when run by npm as configured above):
    +``` bash
    +node-gyp configure --msvs_version=2015
    +```
    +
    +__Note__: The `configure` step looks for a `binding.gyp` file in the current
    +directory to process. See below for instructions on creating a `binding.gyp` file.
    +
    +Now you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file
    +(on Windows) in the `build/` directory. Next, invoke the `build` command:
    +
    +``` bash
    +node-gyp build
    +```
    +
    +Now you have your compiled `.node` bindings file! The compiled bindings end up
    +in `build/Debug/` or `build/Release/`, depending on the build mode. At this point,
    +you can require the `.node` file with Node.js and run your tests!
    +
    +__Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or
    +`-d`) switch when running either the `configure`, `build` or `rebuild` commands.
    +
    +## The `binding.gyp` file
    +
    +A `binding.gyp` file describes the configuration to build your module, in a
    +JSON-like format. This file gets placed in the root of your package, alongside
    +`package.json`.
    +
    +A barebones `gyp` file appropriate for building a Node.js addon could look like:
    +
    +```python
    +{
    +  "targets": [
    +    {
    +      "target_name": "binding",
    +      "sources": [ "src/binding.cc" ]
    +    }
    +  ]
    +}
    +```
    +
    +## Further reading
    +
    +The **[docs](./docs/)** directory contains additional documentation on specific node-gyp topics that may be useful if you are experiencing problems installing or building addons using node-gyp.
    +
    +Some additional resources for Node.js native addons and writing `gyp` configuration files:
    +
    + * ["Going Native" a nodeschool.io tutorial](http://nodeschool.io/#goingnative)
    + * ["Hello World" node addon example](https://github.com/nodejs/node/tree/main/test/addons/hello-world)
    + * [gyp user documentation](https://gyp.gsrc.io/docs/UserDocumentation.md)
    + * [gyp input format reference](https://gyp.gsrc.io/docs/InputFormatReference.md)
    + * [*"binding.gyp" files out in the wild* wiki page](./docs/binding.gyp-files-in-the-wild.md)
    +
    +## Commands
    +
    +`node-gyp` responds to the following commands:
    +
    +| **Command**   | **Description**
    +|:--------------|:---------------------------------------------------------------
    +| `help`        | Shows the help dialog
    +| `build`       | Invokes `make`/`msbuild.exe` and builds the native addon
    +| `clean`       | Removes the `build` directory if it exists
    +| `configure`   | Generates project build files for the current platform
    +| `rebuild`     | Runs `clean`, `configure` and `build` all in a row
    +| `install`     | Installs Node.js header files for the given version
    +| `list`        | Lists the currently installed Node.js header versions
    +| `remove`      | Removes the Node.js header files for the given version
    +
    +
    +## Command Options
    +
    +`node-gyp` accepts the following command options:
    +
    +| **Command**                       | **Description**
    +|:----------------------------------|:------------------------------------------
    +| `-j n`, `--jobs n`                | Run `make` in parallel. The value `max` will use all available CPU cores
    +| `--target=v6.2.1`                 | Node.js version to build for (default is `process.version`)
    +| `--silly`, `--loglevel=silly`     | Log all progress to console
    +| `--verbose`, `--loglevel=verbose` | Log most progress to console
    +| `--silent`, `--loglevel=silent`   | Don't log anything to console
    +| `debug`, `--debug`                | Make Debug build (default is `Release`)
    +| `--release`, `--no-debug`         | Make Release build
    +| `-C $dir`, `--directory=$dir`     | Run command in different directory
    +| `--make=$make`                    | Override `make` command (e.g. `gmake`)
    +| `--thin=yes`                      | Enable thin static libraries
    +| `--arch=$arch`                    | Set target architecture (e.g. ia32)
    +| `--tarball=$path`                 | Get headers from a local tarball
    +| `--devdir=$path`                  | SDK download directory (default is OS cache directory)
    +| `--ensure`                        | Don't reinstall headers if already present
    +| `--dist-url=$url`                 | Download header tarball from custom URL
    +| `--proxy=$url`                    | Set HTTP(S) proxy for downloading header tarball
    +| `--noproxy=$urls`                 | Set urls to ignore proxies when downloading header tarball
    +| `--cafile=$cafile`                | Override default CA chain (to download tarball)
    +| `--nodedir=$path`                 | Set the path to the node source code
    +| `--python=$path`                  | Set path to the Python binary
    +| `--msvs_version=$version`         | Set Visual Studio version (Windows only)
    +| `--solution=$solution`            | Set Visual Studio Solution version (Windows only)
    +| `--force-process-config`          | Force using runtime's `process.config` object to generate `config.gypi` file
    +
    +## Configuration
    +
    +### Environment variables
    +
    +Use the form `npm_config_OPTION_NAME` for any of the command options listed
    +above (dashes in option names should be replaced by underscores).
    +
    +For example, to set `devdir` equal to `/tmp/.gyp`, you would:
    +
    +Run this on Unix:
    +
    +```bash
    +export npm_config_devdir=/tmp/.gyp
    +```
    +
    +Or this on Windows:
    +
    +```console
    +set npm_config_devdir=c:\temp\.gyp
    +```
    +
    +### `npm` configuration for npm versions before v9
    +
    +Use the form `OPTION_NAME` for any of the command options listed above.
    +
    +For example, to set `devdir` equal to `/tmp/.gyp`, you would run:
    +
    +```bash
    +npm config set [--global] devdir /tmp/.gyp
    +```
    +
    +**Note:** Configuration set via `npm` will only be used when `node-gyp`
    +is run via `npm`, not when `node-gyp` is run directly.
    +
    +## License
    +
    +`node-gyp` is available under the MIT license. See the [LICENSE
    +file](LICENSE) for details.
    diff --git a/node_modules/npm/node_modules/node-gyp/SECURITY.md b/node_modules/npm/node_modules/node-gyp/SECURITY.md
    new file mode 100644
    index 00000000..1e168d76
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/addon.gypi b/node_modules/npm/node_modules/node-gyp/addon.gypi
    new file mode 100644
    index 00000000..b4ac369a
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/bin/node-gyp.js b/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
    new file mode 100755
    index 00000000..f8317b47
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
    @@ -0,0 +1,138 @@
    +#!/usr/bin/env node
    +
    +'use strict'
    +
    +process.title = 'node-gyp'
    +
    +const envPaths = require('env-paths')
    +const gyp = require('../')
    +const log = require('../lib/log')
    +const os = require('os')
    +
    +/**
    + * Process and execute the selected commands.
    + */
    +
    +const prog = gyp()
    +let completed = false
    +prog.parseArgv(process.argv)
    +prog.devDir = prog.opts.devdir
    +
    +const 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')) {
    +    log.stdout('v%s', prog.version)
    +  } else {
    +    log.stdout('%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.
    + */
    +
    +const dir = prog.opts.directory
    +if (dir) {
    +  const fs = require('fs')
    +  try {
    +    const 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)
    +    }
    +  }
    +}
    +
    +async function run () {
    +  const command = prog.todo.shift()
    +  if (!command) {
    +    // done!
    +    completed = true
    +    log.info('ok')
    +    return
    +  }
    +
    +  try {
    +    const args = await prog.commands[command.name](command.args) ?? []
    +
    +    if (command.name === 'list') {
    +      if (args.length) {
    +        args.forEach((version) => log.stdout(version))
    +      } else {
    +        log.stdout('No node development files installed. Use `node-gyp install` to install a version.')
    +      }
    +    } else if (args.length >= 1) {
    +      log.stdout(...args.slice(1))
    +    }
    +
    +    // now run the next command in the queue
    +    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) {
    +  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
    +  const 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/npm/node_modules/node-gyp/eslint.config.js b/node_modules/npm/node_modules/node-gyp/eslint.config.js
    new file mode 100644
    index 00000000..5212dc93
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/eslint.config.js
    @@ -0,0 +1,3 @@
    +'use strict'
    +
    +module.exports = require('neostandard')({})
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/.release-please-manifest.json b/node_modules/npm/node_modules/node-gyp/gyp/.release-please-manifest.json
    new file mode 100644
    index 00000000..cbd0ca06
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/.release-please-manifest.json
    @@ -0,0 +1,3 @@
    +{
    +    ".": "0.18.1"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/LICENSE b/node_modules/npm/node_modules/node-gyp/gyp/LICENSE
    new file mode 100644
    index 00000000..c6944c5e
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/data/ninja/build.ninja b/node_modules/npm/node_modules/node-gyp/gyp/data/ninja/build.ninja
    new file mode 100644
    index 00000000..2400dbb1
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/data/ninja/build.ninja
    @@ -0,0 +1,4 @@
    +rule cc
    +  command = cc $in $out
    +
    +build my.out: cc my.in
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc b/node_modules/npm/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc
    new file mode 100644
    index 00000000..8bca5108
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/docs/GypVsCMake.md b/node_modules/npm/node_modules/node-gyp/gyp/docs/GypVsCMake.md
    new file mode 100644
    index 00000000..6d659a61
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/docs/GypVsCMake.md
    @@ -0,0 +1,116 @@
    +# vs. CMake
    +
    +GYP was originally created to generate native IDE project files (Visual Studio, Xcode) for building [Chromium](http://www.chromim.org).
    +
    +The functionality of GYP is very similar to the [CMake](http://www.cmake.org)
    +build tool.  Bradley Nelson wrote up the following description of why the team
    +created GYP instead of using CMake.  The text below is copied from
    +http://www.mail-archive.com/webkit-dev@lists.webkit.org/msg11029.html
    +
    +```
    +
    +Re: [webkit-dev] CMake as a build system?
    +Bradley Nelson
    +Mon, 19 Apr 2010 22:38:30 -0700
    +
    +Here's the innards of an email with a laundry list of stuff I came up with a
    +while back on the gyp-developers list in response to Mike Craddick regarding
    +what motivated gyp's development, since we were aware of cmake at the time
    +(we'd even started a speculative port):
    +
    +
    +I did an exploratory port of portions of Chromium to cmake (I think I got as
    +far as net, base, sandbox, and part of webkit).
    +There were a number of motivations, not all of which would apply to other
    +projects. Also, some of the design of gyp was informed by experience at
    +Google with large projects built wholly from source, leading to features
    +absent from cmake, but not strictly required for Chromium.
    +
    +1. Ability to incrementally transition on Windows. It took us about 6 months
    +to switch fully to gyp. Previous attempts to move to scons had taken a long
    +time and failed, due to the requirement to transition while in flight. For a
    +substantial period of time, we had a hybrid of checked in vcproj and gyp generated
    +vcproj. To this day we still have a good number of GUIDs pinned in the gyp files,
    +because different parts of our release pipeline have leftover assumptions
    +regarding manipulating the raw sln/vcprojs. This transition occurred from
    +the bottom up, largely because modules like base were easier to convert, and
    +had a lower churn rate. During early stages of the transition, the majority
    +of the team wasn't even aware they were using gyp, as it integrated into
    +their existing workflow, and only affected modules that had been converted.
    +
    +2. Generation of a more 'normal' vcproj file. Gyp attempts, particularly on
    +Windows, to generate vcprojs which resemble hand generated projects. It
    +doesn't generate any Makefile type projects, but instead produces msvs
    +Custom Build Steps and Custom Build Rules. This makes the resulting projects
    +easier to understand from the IDE and avoids parts of the IDE that simply
    +don't function correctly if you use Makefile projects. Our early hope with
    +gyp was to support the least common denominator of features present in each
    +of the platform specific project file formats, rather than falling back on
    +generated Makefiles/shell scripts to emulate some common abstraction. CMake by
    +comparison makes a good faith attempt to use native project features, but
    +falls back on generated scripts in order to preserve the same semantics on
    +each platforms.
    +
    +3. Abstraction on the level of project settings, rather than command line
    +flags. In gyp's syntax you can add nearly any option present in a hand
    +generated xcode/vcproj file. This allows you to use abstractions built into
    +the IDEs rather than reverse engineering them possibly incorrectly for
    +things like: manifest generation, precompiled headers, bundle generation.
    +When somebody wants to use a particular menu option from msvs, I'm able to
    +do a web search on the name of the setting from the IDE and provide them
    +with a gyp stanza that does the equivalent. In many cases, not all project
    +file constructs correspond to command line flags.
    +
    +4. Strong notion of module public/private interface. Gyp allows targets to
    +publish a set of direct_dependent_settings, specifying things like
    +include_dirs, defines, platforms specific settings, etc. This means that
    +when module A depends on module B, it automatically acquires the right build
    +settings without module A being filled with assumptions/knowledge of exactly
    +how module B is built. Additionally, all of the transitive dependencies of
    +module B are pulled in. This avoids their being a single top level view of
    +the project, rather each gyp file expresses knowledge about its immediate
    +neighbors. This keep local knowledge local. CMake effectively has a large
    +shared global namespace.
    +
    +5. Cross platform generation. CMake is not able to generate all project
    +files on all platforms. For example xcode projects cannot be generated from
    +windows (cmake uses mac specific libraries to do project generation). This
    +means that for instance generating a tarball containing pregenerated
    +projects for all platforms is hard with Cmake (requires distribution to
    +several machine types).
    +
    +6. Gyp has rudimentary cross compile support. Currently we've added enough
    +functionality to gyp to support x86 -> arm cross compiles. Last I checked
    +this functionality wasn't present in cmake. (This occurred later).
    +
    +
    +That being said there are a number of drawbacks currently to gyp:
    +
    +1. Because platform specific settings are expressed at the project file
    +level (rather than the command line level). Settings which might otherwise
    +be shared in common between platforms (flags to gcc on mac/linux), end up
    +being repeated twice. Though in fairness there is actually less sharing here
    +than you'd think. include_dirs and defines actually represent 90% of what
    +can be typically shared.
    +
    +2. CMake may be more mature, having been applied to a broader range of
    +projects. There a number of 'tool modules' for cmake, which are shared in a
    +common community.
    +
    +3. gyp currently makes some nasty assumptions about the availability of
    +chromium's hermetic copy of cygwin on windows. This causes you to either
    +have to special case a number of rules, or swallow this copy of cygwin as a
    +build time dependency.
    +
    +4. CMake includes a fairly readable imperative language. Currently Gyp has a
    +somewhat poorly specified declarative language (variable expansion happens
    +in sometimes weird and counter-intuitive ways). In fairness though, gyp assumes
    +that external python scripts can be used as an escape hatch. Also gyp avoids
    +a lot of the things you'd need imperative code for, by having a nice target
    +settings publication mechanism.
    +
    +5. (Feature/drawback depending on personal preference). Gyp's syntax is
    +DEEPLY nested. It suffers from all of Lisp's advantages and drawbacks.
    +
    +-BradN
    +```
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/docs/Hacking.md b/node_modules/npm/node_modules/node-gyp/gyp/docs/Hacking.md
    new file mode 100644
    index 00000000..89b3b8be
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/docs/Hacking.md
    @@ -0,0 +1,46 @@
    +# Hacking
    +
    +## Getting the sources
    +
    +Git is required to hack on anything, you can set up a git clone of GYP
    +as follows:
    +
    +```
    +mkdir foo
    +cd foo
    +git clone git@github.com:nodejs/gyp-next.git
    +cd gyp
    +```
    +
    +(this will clone gyp underneath it into `foo/gyp`.
    +`foo` can be any directory name you want. Once you've done that,
    +you can use the repo like anything other Git repo.
    +
    +## Testing your change
    +
    +GYP has a suite of tests which you can run with the provided test driver
    +to make sure your changes aren't breaking anything important.
    +
    +You run the test driver with e.g.
    +
    +``` sh
    +$ python -m pip install --upgrade pip setuptools
    +$ pip install --editable ".[dev]"
    +$ python -m pytest
    +```
    +
    +See [Testing](Testing.md) for more details on the test framework.
    +
    +Note that it can be handy to look at the project files output by the tests
    +to diagnose problems. The easiest way to do that is by kindly asking the
    +test driver to leave the temporary directories it creates in-place.
    +This is done by setting the enviroment variable "PRESERVE", e.g.
    +
    +```
    +set PRESERVE=all     # On Windows
    +export PRESERVE=all  # On saner platforms.
    +```
    +
    +## Reviewing your change
    +
    +All changes to GYP must be code reviewed before submission.
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/docs/InputFormatReference.md b/node_modules/npm/node_modules/node-gyp/gyp/docs/InputFormatReference.md
    new file mode 100644
    index 00000000..2b2c180f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/docs/InputFormatReference.md
    @@ -0,0 +1,1080 @@
    +# Input Format Reference
    +
    +## Primitive Types
    +
    +The following primitive types are found within input files:
    +
    +  * String values, which may be represented by enclosing them in
    +    `'single quotes'` or `"double quotes"`.  By convention, single
    +    quotes are used.
    +  * Integer values, which are represented in decimal without any special
    +    decoration.  Integers are fairly rare in input files, but have a few
    +    applications in boolean contexts, where the convention is to
    +    represent true values with `1` and false with `0`.
    +  * Lists, which are represented as a sequence of items separated by
    +    commas (`,`) within square brackets (`[` and `]`).  A list may
    +    contain any other primitive types, including other lists.
    +    Generally, each item of a list must be of the same type as all other
    +    items in the list, but in some cases (such as within `conditions`
    +    sections), the list structure is more tightly specified.  A trailing
    +    comma is permitted.
    +
    +    This example list contains three string values.
    +
    +      ```
    +      [ 'Generate', 'Your', 'Projects', ]
    +      ```
    +
    +  * Dictionaries, which map keys to values.  All keys are strings.
    +    Values may be of any other primitive type, including other
    +    dictionaries.  A dictionary is enclosed within curly braces (`{` and
    +    `}`).  Keys precede values, separated by a colon (`:`).  Successive
    +    dictionary entries are separated by commas (`,`).  A trailing comma
    +    is permitted.  It is an error for keys to be duplicated within a
    +    single dictionary as written in an input file, although keys may
    +    replace other keys during [merging](#Merging).
    +
    +    This example dictionary maps each of three keys to different values.
    +
    +      ```
    +      {
    +        'inputs': ['version.c.in'],
    +        'outputs': ['version.c'],
    +        'process_outputs_as_sources': 1,
    +      }
    +      ```
    +
    +## Overall Structure
    +
    +A GYP input file is organized as structured data.  At the root scope of
    +each `.gyp` or `.gypi` (include) file is a dictionary.  The keys and
    +values of this dictionary, along with any descendants contained within
    +the values, provide the data contained within the file.  This data is
    +given meaning by interpreting specific key names and their associated
    +values in specific ways (see [Settings Keys](#Settings_Keys)).
    +
    +### Comments (#)
    +
    +Within an input file, a comment is introduced by a pound sign (`#`) not
    +within a string.  Any text following the pound sign, up until the end of
    +the line, is treated as a comment.
    +
    +#### Example
    +
    +```
    +{
    +  'school_supplies': [
    +    'Marble composition book',
    +    'Sharp #2 pencil',
    +    'Safety scissors',  # You still shouldn't run with these
    +  ],
    +}
    +```
    +
    +In this example, the # in `'Sharp #2 pencil'` is not taken as
    +introducing a comment because it occurs within a string, but the text
    +after `'Safety scissors'` is treated as a comment having no impact on
    +the data within the file.
    +
    +## Merging
    +
    +### Merge Basics (=, ?, +)
    +
    +Many operations on GYP input files occurs by merging dictionary and list
    +items together.  During merge operations, it is important to recognize
    +the distinction between source and destination values.  Items from the
    +source value are merged into the destination, which leaves the source
    +unchanged and the destination modified by the source.  A dictionary may
    +only be merged into another dictionary, and a list may only be merged
    +into another list.
    +
    +  * When merging a dictionary, for each key in the source:
    +    * If the key does not exist in the destination dictionary, insert it
    +      and copy the associated value directly.
    +    * If the key does exist:
    +      * If the associated value is a dictionary, perform the dictionary
    +        merging procedure using the source's and destination's value
    +        dictionaries.
    +      * If the associated value is a list, perform the list merging
    +        procedure using the source's and destination's value lists.
    +      * If the associated value is a string or integer, the destination
    +        value is replaced by the source value.
    +  * When merging a list, merge according to the suffix appended to the
    +    key name, if the list is a value within a dictionary.
    +    * If the key ends with an equals sign (`=`), the policy is for the
    +      source list to completely replace the destination list if it
    +      exists.  _Mnemonic: `=` for assignment._
    +    * If the key ends with a question mark (`?`), the policy is for the
    +      source list to be set as the destination list only if the key is
    +      not already present in the destination.  _Mnemonic: `?` for
    +      conditional assignment_.
    +    * If the key ends with a plus sign (`+`), the policy is for the
    +      source list contents to be prepended to the destination list.
    +      _Mnemonic: `+` for addition or concatenation._
    +    * If the list key is undecorated, the policy is for the source list
    +      contents to be appended to the destination list.  This is the
    +      default list merge policy.
    +
    +#### Example
    +
    +Source dictionary:
    +
    +```
    +{
    +  'include_dirs+': [
    +    'shared_stuff/public',
    +  ],
    +  'link_settings': {
    +    'libraries': [
    +      '-lshared_stuff',
    +    ],
    +  },
    +  'test': 1,
    +}
    +```
    +
    +Destination dictionary:
    +
    +```
    +{
    +  'target_name': 'hello',
    +  'sources': [
    +    'kitty.cc',
    +  ],
    +  'include_dirs': [
    +    'headers',
    +  ],
    +  'link_settings': {
    +    'libraries': [
    +      '-lm',
    +    ],
    +    'library_dirs': [
    +      '/usr/lib',
    +    ],
    +  },
    +  'test': 0,
    +}
    +```
    +
    +Merged dictionary:
    +
    +```
    +{
    +  'target_name': 'hello',
    +  'sources': [
    +    'kitty.cc',
    +  ],
    +  'include_dirs': [
    +    'shared_stuff/public',  # Merged, list item prepended due to include_dirs+
    +    'headers',
    +  ],
    +  'link_settings': {
    +    'libraries': [
    +      '-lm',
    +      '-lshared_stuff',  # Merged, list item appended
    +    ],
    +    'library_dirs': [
    +      '/usr/lib',
    +    ],
    +  },
    +  'test': 1,  # Merged, int value replaced
    +}
    +```
    +
    +## Pathname Relativization
    +
    +In a `.gyp` or `.gypi` file, many string values are treated as pathnames
    +relative to the file in which they are defined.
    +
    +String values associated with the following keys, or contained within
    +lists associated with the following keys, are treated as pathnames:
    +
    +  * destination
    +  * files
    +  * include\_dirs
    +  * inputs
    +  * libraries
    +  * outputs
    +  * sources
    +  * mac\_bundle\_resources
    +  * mac\_framework\_dirs
    +  * msvs\_cygwin\_dirs
    +  * msvs\_props
    +
    +Additionally, string values associated with keys ending in the following
    +suffixes, or contained within lists associated with keys ending in the
    +following suffixes, are treated as pathnames:
    +
    +  * `_dir`
    +  * `_dirs`
    +  * `_file`
    +  * `_files`
    +  * `_path`
    +  * `_paths`
    +
    +However, any string value beginning with any of these characters is
    +excluded from pathname relativization:
    +
    +  * `/` for identifying absolute paths.
    +  * `$` for introducing build system variable expansions.
    +  * `-` to support specifying such items as `-llib`, meaning “library
    +    `lib` in the library search path.”
    +  * `<`, `>`, and `!` for GYP expansions.
    +
    +When merging such relative pathnames, they are adjusted so that they can
    +remain valid relative pathnames, despite being relative to a new home.
    +
    +#### Example
    +
    +Source dictionary from `../build/common.gypi`:
    +
    +```
    +{
    +  'include_dirs': ['include'],  # Treated as relative to ../build
    +  'libraries': ['-lz'],  # Not treated as a pathname, begins with a dash
    +  'defines': ['NDEBUG'],  # defines does not contain pathnames
    +}
    +```
    +
    +Target dictionary, from `base.gyp`:
    +
    +```
    +{
    +  'sources': ['string_util.cc'],
    +}
    +```
    +
    +Merged dictionary:
    +
    +```
    +{
    +  'sources': ['string_util.cc'],
    +  'include_dirs': ['../build/include'],
    +  'libraries': ['-lz'],
    +  'defines': ['NDEBUG'],
    +}
    +```
    +
    +Because of pathname relativization, after the merge is complete, all of
    +the pathnames in the merged dictionary are valid relative to the
    +directory containing `base.gyp`.
    +
    +## List Singletons
    +
    +Some list items are treated as singletons, and the list merge process
    +will enforce special rules when merging them.  At present, any string
    +item in a list that does not begin with a dash (`-`) is treated as a
    +singleton, although **this is subject to change.**  When appending or
    +prepending a singleton to a list, if the item is already in the list,
    +only the earlier instance is retained in the merged list.
    +
    +#### Example
    +
    +Source dictionary:
    +
    +```
    +{
    +  'defines': [
    +    'EXPERIMENT=1',
    +    'NDEBUG',
    +  ],
    +}
    +```
    +
    +Destination dictionary:
    +
    +```
    +{
    +  'defines': [
    +    'NDEBUG',
    +    'USE_THREADS',
    +  ],
    +}
    +```
    +
    +Merged dictionary:
    +
    +```
    +{
    +  'defines': [
    +    'NDEBUG',
    +    'USE_THREADS',
    +    'EXPERIMENT=1',  # Note that NDEBUG is not appended after this.
    +  ],
    +}
    +```
    +
    +## Including Other Files
    +
    +If the `-I` (`--include`) argument was used to invoke GYP, any files
    +specified will be implicitly merged into the root dictionary of all
    +`.gyp` files.
    +
    +An [includes](#includes) section may be placed anywhere within a
    +`.gyp` or `.gypi` (include) file.  `includes` sections contain lists of
    +other files to include.  They are processed sequentially and merged into
    +the enclosing dictionary at the point that the `includes` section was
    +found.  `includes` sections at the root of a `.gyp` file dictionary are
    +merged after any `-I` includes from the command line.
    +
    +[includes](#includes) sections are processed immediately after a file is
    +loaded, even before [variable and conditional
    +processing](#Variables_and_Conditionals), so it is not possible to
    +include a file based on a [variable reference](#Variable_Expansions).
    +While it would be useful to be able to include files based on variable
    +expansions, it is most likely more useful to allow included files access
    +to variables set by the files that included them.
    +
    +An [includes](#includes) section may, however, be placed within a
    +[conditional](#Conditionals) section.  The included file itself will
    +be loaded unconditionally, but its dictionary will be discarded if the
    +associated condition is not true.
    +
    +## Variables and Conditionals
    +
    +### Variables
    +
    +There are three main types of variables within GYP.
    +
    +  * Predefined variables.  By convention, these are named with
    +    `CAPITAL_LETTERS`.  Predefined variables are set automatically by
    +    GYP.  They may be overridden, but it is not advisable to do so.  See
    +    [Predefined Variables](#Predefined_Variables) for a list of
    +    variables that GYP provides.
    +  * User-defined variables.  Within any dictionary, a key named
    +    `variables` can be provided, containing a mapping between variable
    +    names (keys) and their contents (values), which may be strings,
    +    integers, or lists of strings.  By convention, user-defined
    +    variables are named with `lowercase_letters`.
    +  * Automatic variables.  Within any dictionary, any key with a string
    +    value has a corresponding automatic variable whose name is the same
    +    as the key name with an underscore (`_`) prefixed.  For example, if
    +    your dictionary contains `type: 'static_library'`, an automatic
    +    variable named `_type` will be provided, and its value will be a
    +    string, `'static_library'`.
    +
    +Variables are inherited from enclosing scopes.
    +
    +### Providing Default Values for Variables (%)
    +
    +Within a `variables` section, keys named with percent sign (`%`)
    +suffixes mean that the variable should be set only if it is undefined at
    +the time it is processed.  This can be used to provide defaults for
    +variables that would otherwise be undefined, so that they may reliably
    +be used in [variable expansion or conditional
    +processing](#Variables_and_Conditionals).
    +
    +### Predefined Variables
    +
    +Each GYP generator module provides defaults for the following variables:
    +
    +  * `OS`: The name of the operating system that the generator produces
    +    output for.  Common values for values for `OS` are:
    +
    +    * `'linux'`
    +    * `'mac'`
    +    * `'win'`
    +
    +    But other values may be encountered and this list should not be
    +    considered exhaustive.  The `gypd` (debug) generator module does not
    +    provide a predefined value for `OS`.  When invoking GYP with the
    +    `gypd` module, if a value for `OS` is needed, it must be provided on
    +    the command line, such as `gyp -f gypd -DOS=mac`.
    +
    +    GYP generators also provide defaults for these variables.  They may
    +    be expressed in terms of variables used by the build system that
    +    they generate for, often in `$(VARIABLE)` format.  For example, the
    +    GYP `PRODUCT_DIR` variable maps to the Xcode `BUILT_PRODUCTS_DIR`
    +    variable, so `PRODUCT_DIR` is defined by the Xcode generator as
    +    `$(BUILT_PRODUCTS_DIR)`.
    +  * `EXECUTABLE_PREFIX`: A prefix, if any, applied to executable names.
    +    Usually this will be an empty string.
    +  * `EXECUTABLE_SUFFIX`: A suffix, if any, applied to executable names.
    +    On Windows, this will be `.exe`, elsewhere, it will usually be an
    +    empty string.
    +  * `INTERMEDIATE_DIR`: A directory that can be used to place
    +    intermediate build results in.  `INTERMEDIATE_DIR` is only
    +    guaranteed to be accessible within a single target (See targets).
    +    This variable is most useful within the context of rules and actions
    +    (See rules, See actions).  Compare with `SHARED_INTERMEDIATE_DIR`.
    +  * `PRODUCT_DIR`: The directory in which the primary output of each
    +    target, such as executables and libraries, is placed.
    +  * `RULE_INPUT_ROOT`: The base name for the input file (e.g. "`foo`").
    +    See Rules.
    +  * `RULE_INPUT_EXT`: The file extension for the input file (e.g.
    +    "`.cc`").  See Rules.
    +  * `RULE_INPUT_NAME`: Full name of the input file (e.g. "`foo.cc`").
    +    See Rules.
    +  * `RULE_INPUT_PATH`: Full path to the input file (e.g.
    +    "`/bar/foo.cc`").  See Rules.
    +  * `SHARED_INTERMEDIATE_DIR`: A directory that can be used to place
    +    intermediate build results in, and have them be accessible to other
    +    targets.  Unlike `INTERMEDIATE_DIR`, each target in a project,
    +    possibly spanning multiple `.gyp` files, shares the same
    +    `SHARED_INTERMEDIATE_DIR`.
    +
    +The following additional predefined variables may be available under
    +certain circumstances:
    +
    +  * `DEPTH`.  When GYP is invoked with a `--depth` argument, when
    +    processing any `.gyp` file, `DEPTH` will be a relative path from the
    +    `.gyp` file to the directory specified by the `--depth` argument.
    +
    +### User-Defined Variables
    +
    +A user-defined variable may be defined in terms of other variables, but
    +not other variables that have definitions provided in the same scope.
    +
    +### Variable Expansions (<, >, <@, >@)
    +
    +GYP provides two forms of variable expansions, “early” or “pre”
    +expansions, and “late,” “post,” or “target” expansions.  They have
    +similar syntax, differing only in the character used to introduce them.
    +
    +  * Early expansions are introduced by a less-than (`<`) character.
    +    _Mnemonic: the arrow points to the left, earlier on a timeline._
    +  * Late expansions are introduced by a less-than (`>`) character.
    +    _Mnemonic: the arrow points to the right, later on a timeline._
    +
    +The difference the two phases of expansion is described in [Early and
    +Late Phases](#Early_and_Late_Phases).
    +
    +These characters were chosen based upon the requirement that they not
    +conflict with the variable format used natively by build systems.  While
    +the dollar sign (`$`) is the most natural fit for variable expansions,
    +its use was ruled out because most build systems already use that
    +character for their own variable expansions.  Using different characters
    +means that no escaping mechanism was needed to differentiate between GYP
    +variables and build system variables, and writing build system variables
    +into GYP files is not cumbersome.
    +
    +Variables may contain lists or strings, and variable expansions may
    +occur in list or string context.  There are variant forms of variable
    +expansions that may be used to determine how each type of variable is to
    +be expanded in each context.
    +
    +  * When a variable is referenced by `<(VAR)` or `>(VAR)`:
    +    * If `VAR` is a string, the variable reference within the string is
    +      replaced by variable's string value.
    +    * If `VAR` is a list, the variable reference within the string is
    +      replaced by a string containing the concatenation of all of the
    +      variable’s list items.  Generally, the items are joined with
    +      spaces between each, but the specific behavior is
    +      generator-specific.  The precise encoding used by any generator
    +      should be one that would allow each list item to be treated as a
    +      separate argument when used as program arguments on the system
    +      that the generator produces output for.
    +  * When a variable is referenced by `<@(VAR)` or `>@(VAR)`:
    +    * The expansion must occur in list context.
    +    * The list item must be `'<@(VAR)'` or `'>@(VAR)'` exactly.
    +    * If `VAR` is a list, each of its elements are inserted into the
    +      list in which expansion is taking place, replacing the list item
    +      containing the variable reference.
    +    * If `VAR` is a string, the string is converted to a list which is
    +      inserted into the list in which expansion is taking place as
    +      above.  The conversion into a list is generator-specific, but
    +      generally, spaces in the string are taken as separators between
    +      list items.  The specific method of converting the string to a
    +      list should be the inverse of the encoding method used to expand
    +      list variables in string context, above.
    +
    +GYP treats references to undefined variables as errors.
    +
    +### Command Expansions (` form
    +    of [variable expansions](#Variable_Expansions),
    +    and on the `!` form of [command
    +    expansions](#Command_Expansions_(!,_!@)).
    +
    +These two phases are provided because there are some circumstances in
    +which each is desirable.
    +
    +The “early” phase is appropriate for most expansions and evaluations.
    +“Early” expansions and evaluations may be performed anywhere within any
    +`.gyp` or `.gypi` file.
    +
    +The “late” phase is appropriate when expansion or evaluation must be
    +deferred until a specific section has been merged into target context.
    +“Late” expansions and evaluations only occur within `targets` sections
    +and their descendants.  The typical use case for a late-phase expansion
    +is to provide, in some globally-included `.gypi` file, distinct
    +behaviors depending on the specifics of a target.
    +
    +#### Example
    +
    +Given this input:
    +
    +```
    +{
    +  'target_defaults': {
    +    'target_conditions': [
    +      ['_type=="shared_library"', {'cflags': ['-fPIC']}],
    +    ],
    +  },
    +  'targets': [
    +    {
    +      'target_name': 'sharing_is_caring',
    +      'type': 'shared_library',
    +    },
    +    {
    +      'target_name': 'static_in_the_attic',
    +      'type': 'static_library',
    +    },
    +  ]
    +}
    +```
    +
    +The conditional needs to be evaluated only in target context; it is
    +nonsense outside of target context because no `_type` variable is
    +defined.  [target\_conditions](#target_conditions) allows evaluation
    +to be deferred until after the [targets](#targets) sections are
    +merged into their copies of [target\_defaults](#target_defaults).
    +The resulting targets, after “late” phase processing:
    +
    +```
    +{
    +  'targets': [
    +    {
    +      'target_name': 'sharing_is_caring',
    +      'type': 'shared_library',
    +      'cflags': ['-fPIC'],
    +    },
    +    {
    +      'target_name': 'static_in_the_attic',
    +      'type': 'static_library',
    +    },
    +  ]
    +}
    +```
    +
    +### Expansion and Evaluation Performed Simultaneously
    +
    +During any expansion and evaluation phase, both expansion and evaluation
    +are performed simultaneously.  The process for handling variable
    +expansions and conditional evaluation within a dictionary is:
    +
    +  * Load [automatic variables](#Variables) (those with leading
    +    underscores).
    +  * If a [variables](#variables) section is present, recurse into its
    +    dictionary.  This allows [conditionals](#Conditionals) to be
    +    present within the `variables` dictionary.
    +  * Load [Variables user-defined variables](#User-Defined) from the
    +    [variables](#variables) section.
    +  * For each string value in the dictionary, perform [variable
    +    expansion](#Variable_Expansions) and, if operating
    +    during the “late” phase, [command
    +    expansions](#Command_Expansions).
    +  * Reload [automatic variables](#Variables) and [Variables
    +    user-defined variables](#User-Defined) because the variable
    +    expansion step may have resulted in changes to the automatic
    +    variables.
    +  * If a [conditions](#conditions) or
    +    [target\_conditions](#target_conditions) section (depending on
    +    phase) is present, recurse into its dictionary.  This is done after
    +    variable expansion so that conditionals may take advantage of
    +    expanded automatic variables.
    +  * Evaluate [conditionals](#Conditionals).
    +  * Reload [automatic variables](#Variables) and [Variables
    +    user-defined variables](#User-Defined) because the conditional
    +    evaluation step may have resulted in changes to the automatic
    +    variables.
    +  * Recurse into child dictionaries or lists that have not yet been
    +    processed.
    +
    +One quirk of this ordering is that you cannot expect a
    +[variables](#variables) section within a dictionary’s
    +[conditional](#Conditionals) to be effective in the dictionary
    +itself, but the added variables will be effective in any child
    +dictionaries or lists.  It is thought to be far more worthwhile to
    +provide resolved [automatic variables](#Variables) to
    +[conditional](#Conditionals) sections, though.  As a workaround, to
    +conditionalize variable values, place a [conditions](#conditions) or
    +[target\_conditions](#target_conditions) section within the
    +[variables](#variables) section.
    +
    +## Dependencies and Dependents
    +
    +In GYP, “dependents” are targets that rely on other targets, called
    +“dependencies.”  Dependents declare their reliance with a special
    +section within their target dictionary,
    +[dependencies](#dependencies).
    +
    +### Dependent Settings
    +
    +It is useful for targets to “advertise” settings to their dependents.
    +For example, a target might require that all of its dependents add
    +certain directories to their include paths, link against special
    +libraries, or define certain preprocessor macros.  GYP allows these
    +cases to be handled gracefully with “dependent settings” sections.
    +There are three types of such sections:
    +
    +  * [direct\_dependent\_settings](#direct_dependent_settings), which
    +    advertises settings to a target's direct dependents only.
    +  * [all\_dependent\_settings](#all_dependnet_settings), which
    +    advertises settings to all of a target's dependents, both direct and
    +    indirect.
    +  * [link\_settings](#link_settings), which contains settings that
    +    should be applied when a target’s object files are used as linker
    +    input.
    +
    +Furthermore, in some cases, a target needs to pass its dependencies’
    +settings on to its own dependents.  This might happen when a target’s
    +own public header files include header files provided by its dependency.
    +[export\_dependent\_settings](#export_dependent_settings) allows a
    +target to declare dependencies for which
    +[direct\_dependent\_settings](#direct_dependent_settings) should be
    +passed through to its own dependents.
    +
    +Dependent settings processing merges a copy of the relevant dependent
    +settings dictionary from a dependency into its relevant dependent
    +targets.
    +
    +In most instances,
    +[direct\_dependent\_settings](#direct_dependent_settings) will be
    +used.  There are very few cases where
    +[all\_dependent\_settings](#all_dependent_settings) is actually
    +correct; in most of the cases where it is tempting to use, it would be
    +preferable to declare
    +[export\_dependent\_settings](#export_dependent_settings).  Most
    +[libraries](#libraries) and [library\_dirs](#library_dirs)
    +sections should be placed within [link\_settings](#link_settings)
    +sections.
    +
    +#### Example
    +
    +Given:
    +
    +```
    +{
    +  'targets': [
    +    {
    +      'target_name': 'cruncher',
    +      'type': 'static_library',
    +      'sources': ['cruncher.cc'],
    +      'direct_dependent_settings': {
    +        'include_dirs': ['.'],  # dependents need to find cruncher.h.
    +      },
    +      'link_settings': {
    +        'libraries': ['-lm'],  # cruncher.cc does math.
    +      },
    +    },
    +    {
    +      'target_name': 'cruncher_test',
    +      'type': 'executable',
    +      'dependencies': ['cruncher'],
    +      'sources': ['cruncher_test.cc'],
    +    },
    +  ],
    +}
    +```
    +
    +After dependent settings processing, the dictionary for `cruncher_test`
    +will be:
    +
    +```
    +{
    +  'target_name': 'cruncher_test',
    +  'type': 'executable',
    +  'dependencies': ['cruncher'],  # implies linking against cruncher
    +  'sources': ['cruncher_test.cc'],
    +  'include_dirs': ['.']
    +  'libraries': ['-lm'],
    +},
    +```
    +
    +If `cruncher` was declared as a `shared_library` instead of a
    +`static_library`, the `cruncher_test` target would not contain `-lm`,
    +but instead, `cruncher` itself would link against `-lm`.
    +
    +## Linking Dependencies
    +
    +The precise meaning of a dependency relationship varies with the
    +[types](#type) of the [targets](#targets) at either end of the
    +relationship.  In GYP, a dependency relationship can indicate two things
    +about how targets relate to each other:
    +
    +  * Whether the dependent target needs to link against the dependency.
    +  * Whether the dependency target needs to be built prior to the
    +    dependent.  If the former case is true, this case must be true as
    +    well.
    +
    +The analysis of the first item is complicated by the differences between
    +static and shared libraries.
    +
    +  * Static libraries are simply collections of object files (`.o` or
    +    `.obj`) that are used as inputs to a linker (`ld` or `link.exe`).
    +    Static libraries don't link against other libraries, they’re
    +    collected together and used when eventually linking a shared library
    +    or executable.
    +  * Shared libraries are linker output and must undergo symbol
    +    resolution.  They must link against other libraries (static or
    +    shared) in order to facilitate symbol resolution.  They may be used
    +    as libraries in subsequent link steps.
    +  * Executables are also linker output, and also undergo symbol
    +    resolution.  Like shared libraries, they must link against static
    +    and shared libraries to facilitate symbol resolution.  They may not
    +    be reused as linker inputs in subsequent link steps.
    +
    +Accordingly, GYP performs an operation referred to as “static library
    +dependency adjustment,” in which it makes each linker output target
    +(shared libraries and executables) link against the static libraries it
    +depends on, either directly or indirectly.  Because the linkable targets
    +link against these static libraries, they are also made direct
    +dependents of the static libraries.
    +
    +As part of this process, GYP is also able to remove the direct
    +dependency relationships between two static library targets, as a
    +dependent static library does not actually need to link against a
    +dependency static library.  This removal facilitates speedier builds
    +under some build systems, as they are now free to build the two targets
    +in parallel.  The removal of this dependency is incorrect in some cases,
    +such as when the dependency target contains [rules](#rules) or
    +[actions](#actions) that generate header files required by the
    +dependent target.  In such cases, the dependency target, the one
    +providing the side-effect files, must declare itself as a
    +[hard\_dependency](#hard_dependency).  This setting instructs GYP to
    +not remove the dependency link between two static library targets in its
    +generated output.
    +
    +## Loading Files to Resolve Dependencies
    +
    +When GYP runs, it loads all `.gyp` files needed to resolve dependencies
    +found in [dependencies](#dependencies) sections.  These files are not
    +merged into the files that reference them, but they may contain special
    +sections that are merged into dependent target dictionaries.
    +
    +## Build Configurations
    +
    +Explain this.
    +
    +## List Filters
    +
    +GYP allows list items to be filtered by “exclusions” and “patterns.”
    +Any list containing string values in a dictionary may have this
    +filtering applied.  For the purposes of this section, a list modified by
    +exclusions or patterns is referred to as a “base list”, in contrast to
    +the “exclusion list” and “pattern list” that operates on it.
    +
    +  * For a base list identified by key name `key`, the `key!` list
    +    provides exclusions.
    +  * For a base list identified by key name `key`, the `key/` list
    +    provides regular expression pattern-based filtering.
    +
    +Both `key!` and `key/` may be present.  The `key!` exclusion list will
    +be processed first, followed by the `key/` pattern list.
    +
    +Exclusion lists are most powerful when used in conjunction with
    +[conditionals](#Conditionals).
    +
    +## Exclusion Lists (!)
    +
    +An exclusion list provides a way to remove items from the related list
    +based on exact matching.  Any item found in an exclusion list will be
    +removed from the corresponding base list.
    +
    +#### Example
    +
    +This example excludes files from the `sources` based on the setting of
    +the `OS` variable.
    +
    +```
    +{
    +  'sources:' [
    +    'mac_util.mm',
    +    'win_util.cc',
    +  ],
    +  'conditions': [
    +    ['OS=="mac"', {'sources!': ['win_util.cc']}],
    +    ['OS=="win"', {'sources!': ['mac_util.cc']}],
    +  ],
    +}
    +```
    +
    +## Pattern Lists (/)
    +
    +Pattern lists are similar to, but more powerful than, [exclusion
    +lists](#Exclusion_Lists_(!)).  Each item in a pattern list is itself
    +a two-element list.  The first item is a string, either `'include'` or
    +`'exclude'`, specifying the action to take.  The second item is a string
    +specifying a regular expression.  Any item in the base list matching the
    +regular expression pattern will either be included or excluded, based on
    +the action specified.
    +
    +Items in a pattern list are processed in sequence, and an excluded item
    +that is later included will not be removed from the list (unless it is
    +subsequently excluded again.)
    +
    +Pattern lists are processed after [exclusion
    +lists](#Exclusion_Lists_(!)), so it is possible for a pattern list to
    +re-include items previously excluded by an exclusion list.
    +
    +Nothing is actually removed from a base list until all items in an
    +[exclusion list](#Exclusion_Lists_(!)) and pattern list have been
    +evaluated.  This allows items to retain their correct position relative
    +to one another even after being excluded and subsequently included.
    +
    +#### Example
    +
    +In this example, a uniform naming scheme is adopted for
    +platform-specific files.
    +
    +```
    +{
    +  'sources': [
    +    'io_posix.cc',
    +    'io_win.cc',
    +    'launcher_mac.cc',
    +    'main.cc',
    +    'platform_util_linux.cc',
    +    'platform_util_mac.mm',
    +  ],
    +  'sources/': [
    +    ['exclude', '_win\\.cc$'],
    +  ],
    +  'conditions': [
    +    ['OS!="linux"', {'sources/': [['exclude', '_linux\\.cc$']]}],
    +    ['OS!="mac"', {'sources/': [['exclude', '_mac\\.cc|mm?$']]}],
    +    ['OS=="win"', {'sources/': [
    +      ['include', '_win\\.cc$'],
    +      ['exclude', '_posix\\.cc$'],
    +    ]}],
    +  ],
    +}
    +```
    +
    +After the pattern list is applied, `sources` will have the following
    +values, depending on the setting of `OS`:
    +
    +  * When `OS` is `linux`: `['io_posix.cc', 'main.cc',
    +    'platform_util_linux.cc']`
    +  * When `OS` is `mac`: `['io_posix.cc', 'launcher_mac.cc', 'main.cc',
    +    'platform_util_mac.mm']`
    +  * When `OS` is `win`: `['io_win.cc', 'main.cc',
    +    'platform_util_win.cc']`
    +
    +Note that when `OS` is `win`, the `include` for `_win.cc` files is
    +processed after the `exclude` matching the same pattern, because the
    +`sources/` list participates in [merging](#Merging) during
    +[conditional evaluation](#Conditonals) just like any other list
    +would.  This guarantees that the `_win.cc` files, previously
    +unconditionally excluded, will be re-included when `OS` is `win`.
    +
    +## Locating Excluded Items
    +
    +In some cases, a GYP generator needs to access to items that were
    +excluded by an [exclusion list](#Exclusion_Lists_(!)) or [pattern
    +list](#Pattern_Lists_(/)).  When GYP excludes items during processing
    +of either of these list types, it places the results in an `_excluded`
    +list.  In the example above, when `OS` is `mac`, `sources_excluded`
    +would be set to `['io_win.cc', 'platform_util_linux.cc']`.  Some GYP
    +generators use this feature to display excluded files in the project
    +files they generate for the convenience of users, who may wish to refer
    +to other implementations.
    +
    +## Processing Order
    +
    +GYP uses a defined and predictable order to execute the various steps
    +performed between loading files and generating output.
    +
    +  * Load files.
    +    * Load `.gyp` files.  Merge any [command-line
    +      includes](#Including_Other_Files) into each `.gyp` file’s root
    +      dictionary.  As [includes](#Including_Other_Files) are found,
    +      load them as well and [merge](#Merging) them into the scope in
    +      which the [includes](#includes) section was found.
    +    * Perform [“early” or “pre”](#Early_and_Late_Phases) [variable
    +      expansion and conditional
    +      evaluation](#Variables_and_Conditionals).
    +    * [Merge](#Merging) each [target’s](#targets) dictionary into
    +      the `.gyp` file’s root [target\_defaults](#target_defaults)
    +      dictionary.
    +    * Scan each [target](#targets) for
    +      [dependencies](#dependencies), and repeat the above steps for
    +      any newly-referenced `.gyp` files not yet loaded.
    +  * Scan each [target](#targets) for wildcard
    +    [dependencies](#dependencies), expanding the wildcards.
    +  * Process [dependent settings](#Dependent_Settings).  These
    +    sections are processed, in order:
    +    * [all\_dependent\_settings](#all_dependent_settings)
    +    * [direct\_dependent\_settings](#direct_dependent_settings)
    +    * [link\_dependent\_settings](#link_dependent_settings)
    +  * Perform [static library dependency
    +    adjustment](#Linking_Dependencies).
    +  * Perform [“late,” “post,” or “target”](#Early_and_Late_Phases)
    +    [variable expansion and conditional
    +    evaluation](#Variables_and_Conditionals) on [target](#targets)
    +    dictionaries.
    +  * Merge [target](#targets) settings into
    +    [configurations](#configurations) as appropriate.
    +  * Process [exclusion and pattern
    +    lists](#List_Exclusions_and_Patterns).
    +
    +## Settings Keys
    +
    +### Settings that may appear anywhere
    +
    +#### conditions
    +
    +_List of `condition` items_
    +
    +A `conditions` section introduces a subdictionary that is only merged
    +into the enclosing scope based on the evaluation of a conditional
    +expression.  Each `condition` within a `conditions` list is itself a
    +list of at least two items:
    +
    +  1. A string containing the conditional expression itself.  Conditional
    +  expressions may take the following forms:
    +    * For string values, `var=="value"` and `var!="value"` to test
    +      equality and inequality.  For example, `'OS=="linux"'` is true
    +      when the `OS` variable is set to `"linux"`.
    +    * For integer values, `var==value`, `var!=value`, `var=value`, and `var>value`, to test equality and
    +      several common forms of inequality.  For example,
    +      `'chromium_code==0'` is true when the `chromium_code` variable is
    +      set to `0`.
    +    * It is an error for a conditional expression to reference any
    +      undefined variable.
    +  1. A dictionary containing the subdictionary to be merged into the
    +  enclosing scope if the conditional expression evaluates to true.
    +
    +These two items can be followed by any number of similar two items that
    +will be evaluated if the previous conditional expression does not
    +evaluate to true.
    +
    +An additional optional dictionary can be appended to this sequence of
    +two items.  This optional dictionary will be merged into the enclosing
    +scope if none of the conditional expressions evaluate to true.
    +
    +Within a `conditions` section, each item is processed sequentially, so
    +it is possible to predict the order in which operations will occur.
    +
    +There is no restriction on nesting `conditions` sections.
    +
    +`conditions` sections are very similar to `target_conditions` sections.
    +See target\_conditions.
    +
    +#### Example
    +
    +```
    +{
    +  'sources': [
    +    'common.cc',
    +  ],
    +  'conditions': [
    +    ['OS=="mac"', {'sources': ['mac_util.mm']}],
    +    ['OS=="win"', {'sources': ['win_main.cc']}, {'sources': ['posix_main.cc']}],
    +    ['OS=="mac"', {'sources': ['mac_impl.mm']},
    +     'OS=="win"', {'sources': ['win_impl.cc']},
    +     {'sources': ['default_impl.cc']}
    +    ],
    +  ],
    +}
    +```
    +
    +Given this input, the `sources` list will take on different values based
    +on the `OS` variable.
    +
    +  * If `OS` is `"mac"`, `sources` will contain `['common.cc',
    +    'mac_util.mm', 'posix_main.cc', 'mac_impl.mm']`.
    +  * If `OS` is `"win"`, `sources` will contain `['common.cc',
    +    'win_main.cc', 'win_impl.cc']`.
    +  * If `OS` is any other value such as `"linux"`, `sources` will contain
    +    `['common.cc', 'posix_main.cc', 'default_impl.cc']`.
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/docs/LanguageSpecification.md b/node_modules/npm/node_modules/node-gyp/gyp/docs/LanguageSpecification.md
    new file mode 100644
    index 00000000..178b8c83
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/docs/LanguageSpecification.md
    @@ -0,0 +1,430 @@
    +# Language Specification
    +
    +## Objective
    +
    +Create a tool for the Chromium project that generates native Visual Studio,
    +Xcode and SCons and/or make build files from a platform-independent input
    +format.  Make the input format as reasonably general as possible without
    +spending extra time trying to "get everything right," except where not doing so
    +would likely lead Chromium to an eventual dead end.  When in doubt, do what
    +Chromium needs and don't worry about generalizing the solution.
    +
    +## Background
    +
    +Numerous other projects, both inside and outside Google, have tried to
    +create a simple, universal cross-platform build representation that
    +still allows sufficient per-platform flexibility to accommodate
    +irreconcilable differences.  The fact that no obvious working candidate
    +exists that meets Chromium's requirements indicates this is probably a
    +tougher problem than it appears at first glance.  We aim to succeed by
    +creating a tool that is highly specific to Chromium's specific use case,
    +not to the general case of design a completely platform-independent tool
    +for expressing any possible build.
    +
    +The Mac has the most sophisticated model for application development
    +through an IDE.  Consequently, we will use the Xcode model as the
    +starting point (the input file format must handle Chromium's use of
    +Xcode seamlessly) and adapt the design as necessary for the other
    +platforms.
    +
    +## Overview
    +
    +The overall design has the following characteristics:
    +
    +  * Input configurations are specified in files with the suffix `.gyp`.
    +  * Each `.gyp` file specifies how to build the targets for the
    +    "component" defined by that file.
    +  * Each `.gyp` file generates one or more output files appropriate to
    +    the platform:
    +    * On Mac, a `.gyp` file generates one Xcode .xcodeproj bundle with
    +      information about how its targets are built.
    +    * On Windows, a `.gyp` file generates one Visual Studio .sln file,
    +      and one Visual Studio .vcproj file per target.
    +    * On Linux, a `.gyp` file generates one SCons file and/or one
    +      Makefile per target
    +  * The `.gyp` file syntax is a Python data structure.
    +  * Use of arbitrary Python in `.gyp` files is forbidden.
    +    * Use of eval() with restricted globals and locals on `.gyp` file
    +      contents restricts the input to an evaluated expression, not
    +      arbitrary Python statements.
    +    * All input is expected to comply with JSON, with two exceptions:
    +      the # character (not inside strings) begins a comment that lasts
    +      until the end of the line, and trailing commas are permitted at
    +      the end of list and dict contents.
    +  * Input data is a dictionary of keywords and values.
    +  * "Invalid" keywords on any given data structure are not illegal,
    +    they're just ignored.
    +    * TODO:  providing warnings on use of illegal keywords would help
    +      users catch typos.  Figure out something nice to do with this.
    +
    +## Detailed Design
    +
    +Some up-front design principles/thoughts/TODOs:
    +
    +  * Re-use keywords consistently.
    +  * Keywords that allow configuration of a platform-specific concept get
    +    prefixed appropriately:
    +    * Examples:  `msvs_disabled_warnings`, `xcode_framework_dirs`
    +  * The input syntax is declarative and data-driven.
    +    * This gets enforced by using Python `eval()` (which only evaluates
    +      an expression) instead of `exec` (which executes arbitrary python)
    +  * Semantic meanings of specific keyword values get deferred until all
    +    are read and the configuration is being evaluated to spit out the
    +    appropriate file(s)
    +  * Source file lists:
    +    * Are flat lists.  Any imposed ordering within the `.gyp` file (e.g.
    +      alphabetically) is purely by convention and for developer
    +      convenience.  When source files are linked or archived together,
    +      it is expected that this will occur in the order that files are
    +      listed in the `.gyp` file.
    +    * Source file lists contain no mechanism for by-hand folder
    +      configuration (`Filter` tags in Visual Studio, `Groups` in Xcode)
    +    * A folder hierarchy is created automatically that mirrors the file
    +      system
    +
    +### Example
    +
    +```
    +{
    +  'target_defaults': {
    +    'defines': [
    +      'U_STATIC_IMPLEMENTATION',
    +      ['LOGFILE', 'foo.log',],
    +    ],
    +    'include_dirs': [
    +      '..',
    +    ],
    +  },
    +  'targets': [
    +    {
    +      'target_name': 'foo',
    +      'type': 'static_library',
    +      'sources': [
    +        'foo/src/foo.cc',
    +        'foo/src/foo_main.cc',
    +      ],
    +      'include_dirs': [
    +         'foo',
    +         'foo/include',
    +      ],
    +      'conditions': [
    +         [ 'OS==mac', { 'sources': [ 'platform_test_mac.mm' ] } ]
    +      ],
    +      'direct_dependent_settings': {
    +        'defines': [
    +          'UNIT_TEST',
    +        ],
    +        'include_dirs': [
    +          'foo',
    +          'foo/include',
    +        ],
    +      },
    +    },
    +  ],
    +}
    +```
    +
    +### Structural Elements
    +
    +### Top-level Dictionary
    +
    +This is the single dictionary in the `.gyp` file that defines the
    +targets and how they're to be built.
    +
    +The following keywords are meaningful within the top-level dictionary
    +definition:
    +
    +| *Keyword*         | *Description*     |
    +|:------------------|:------------------|
    +| `conditions`      | A conditional section that may contain other items that can be present in a top-level dictionary, on a conditional basis.  See the "Conditionals" section below. |
    +| `includes`        | A list of `.gypi` files to be included in the top-level dictionary. |
    +| `target_defaults` | A dictionary of default settings to be inherited by all targets in the top-level dictionary.  See the "Settings keywords" section below. |
    +| `targets`         | A list of target specifications.  See the "targets" below. |
    +| `variables`       | A dictionary containing variable definitions.  Each key in this dictionary is the name of a variable, and each value must be a string value that the variable is to be set to. |
    +
    +### targets
    +
    +A list of dictionaries defining targets to be built by the files
    +generated from this `.gyp` file.
    +
    +Targets may contain `includes`, `conditions`, and `variables` sections
    +as permitted in the root dictionary. The following additional keywords
    +have structural meaning for target definitions:
    +
    +| *Keyword*         | *Description*     |
    +|:---------------------------- |:------------------------------------------|
    +| `actions`                    | A list of special custom actions to perform on a specific input file, or files, to produce output files.  See the "Actions" section below. |
    +| `all_dependent_settings`     | A dictionary of settings to be applied to all dependents of the target, transitively.  This includes direct dependents and the entire set of their dependents, and so on.  This section may contain anything found within a `target` dictionary, except `configurations`, `target_name`, and `type` sections.  Compare `direct_dependent_settings` and `link_settings`. |
    +| `configurations`             | A list of dictionaries defining build configurations for the target.  See the "Configurations" section below.  |
    +| `copies`                     | A list of copy actions to perform. See the "Copies" section below. |
    +| `defines`                    | A list of preprocesor definitions to be passed on the command line to the C/C++ compiler (via `-D` or `/D` options). |
    +| `dependencies`               | A list of targets on which this target depends.  Targets in other `.gyp` files are specified as `../path/to/other.gyp:target_we_want`. |
    +| `direct_dependent_settings`  | A dictionary of settings to be applied to other targets that depend on this target.  These settings will only be applied to direct dependents.  This section may contain anything found within a `target` dictionary, except `configurations`, `target_name`, and `type` sections.  Compare with `all_dependent_settings` and `link_settings`. |
    +| `include_dirs`               | A list of include directories to be passed on the command line to the C/C++ compiler (via `-I` or `/I` options). |
    +| `libraries`                  | A list of list of libraries (and/or frameworks) on which this target depends. |
    +| `link_settings`              | A dictionary of settings to be applied to targets in which this target's contents are linked.  `executable` and `shared_library` targets are linkable, so if they depend on a non-linkable target such as a `static_library`, they will adopt its `link_settings`.  This section can contain anything found within a `target` dictionary, except `configurations`, `target_name`, and `type` sections.  Compare `all_dependent_settings` and `direct_dependent_settings`. |
    +| `rules`                      | A special custom action to perform on a list of input files, to produce output files.  See the "Rules" section below. |
    +| `sources`                    | A list of source files that are used to build this target or which should otherwise show up in the IDE for this target.  In practice, we expect this list to be a union of all files necessary to build the target on all platforms, as well as other related files that aren't actually used for building, like README files. |
    +| `target_conditions`          | Like `conditions`, but evaluation is delayed until the settings have been merged into an actual target.  `target_conditions` may be used to place conditionals into a `target_defaults` section but have them still depend on specific target settings. |
    +| `target_name`                | The name of a target being defined. |
    +| `type`                       | The type of target being defined. This field currently supports `executable`, `static_library`, `shared_library`, and `none`.  The `none` target type is useful when producing output which is not linked. For example, converting raw translation files into resources or documentation into platform specific help files. |
    +| `msvs_props`                 | A list of Visual Studio property sheets (`.vsprops` files) to be used to build the target. |
    +| `xcode_config_file`          | An Xcode configuration (`.xcconfig` file) to be used to build the target. |
    +| `xcode_framework_dirs`       | A list of framework directories be used to build the target. |
    +
    +You can affect the way that lists/dictionaries are merged together (for
    +example the way a list in target\_defaults interacts with the same named
    +list in the target itself) with a couple of special characters, which
    +are covered in [Merge
    +Basics](InputFormatReference#Merge_Basics_(=,_?,_+).md) and [List
    +Filters](InputFormatReference#List_Filters.md) on the
    +InputFormatReference page.
    +
    +### configurations
    +
    +`configurations` sections may be found within `targets` or
    +`target_defaults` sections.  The `configurations` section is a list of
    +dictionaries specifying different build configurations.  Because
    +configurations are implemented as lists, it is not currently possible to
    +override aspects of configurations that are imported into a target from
    +a `target_defaults` section.
    +
    +NOTE: It is extremely important that each target within a project define
    +the same set of configurations.  This continues to apply even when a
    +project spans across multiple `.gyp` files.
    +
    +A configuration dictionary may contain anything that can be found within
    +a target dictionary, except for `actions`, `all_dependent_settings`,
    +`configurations`, `dependencies`, `direct_dependent_settings`,
    +`libraries`, `link_settings`, `sources`, `target_name`, and `type`.
    +
    +Configuration dictionaries may also contain these elements:
    +
    +| *Keyword*            | *Description*                                       |
    +|:---------------------|:----------------------------------------------------|
    +| `configuration_name` | Required attribute.  The name of the configuration. |
    +
    +### Conditionals
    +
    +Conditionals may appear within any dictionary in a `.gyp` file.  There
    +are two tpes of conditionals, which differ only in the timing of their
    +processing.  `conditons` sections are processed shortly after loading
    +`.gyp` files, and `target_conditons` sections are processed after all
    +dependencies have been computed.
    +
    +A conditional section is introduced with a `conditions` or
    +`target_conditions` dictionary keyword, and is composed of a list.  Each
    +list contains two or three elements.  The first two elements, which are
    +always required, are the conditional expression to evaluate and a
    +dictionary containing settings to merge into the dictionary containing
    +the `conditions` or `target_conditions` section if the expression
    +evaluates to true.  The third, optional, list element is a dictionary to
    +merge if the expression evaluates to false.
    +
    +The `eval()` of the expression string takes place in the context of
    +global and/or local dictionaries that constructed from the `.gyp` input
    +data, and overrides the `__builtin__` dictionary, to prevent the
    +execution of arbitrary Python code.
    +
    +### Actions
    +
    +An `actions` section provides a list of custom build actions to perform
    +on inputs, producing outputs.  The `actions` section is organized as a
    +list.  Each item in the list is a dictionary having the following form:
    +
    +| *Keyword*     | *Type* | *Description*                |
    +|:--------------|:-------|:-----------------------------|
    +| `action_name` | string | The name of the action.  Depending on how actions are implemented in the various generators, some may desire or require this property to be set to a unique name; others may ignore this property entirely. |
    +| `inputs`      | list   | A list of pathnames treated as inputs to the custom action. |
    +| `outputs`     | list   | A list of pathnames that the custom action produces. |
    +| `action`      | list   | A command line invocation used to produce `outputs` from `inputs`.  For maximum cross-platform compatibility, invocations that require a Python interpreter should be specified with a first element `"python"`.  This will enable generators for environments with specialized Python installations to be able to perform the action in an appropriate Python environment. |
    +| `message`     | string | A message to be displayed to the user by the build system when the action is run. |
    +
    +Build environments will compare `inputs` and `outputs`.  If any `output`
    +is missing or is outdated relative to any `input`, the custom action
    +will be invoked.  If all `outputs` are present and newer than all
    +`inputs`, the `outputs` are considered up-to-date and the action need
    +not be invoked.
    +
    +Actions are implemented in Xcode as shell script build phases performed
    +prior to the compilation phase.  In the Visual Studio generator, actions
    +appear files with a `FileConfiguration` containing a custom
    +`VCCustomBuildTool` specifying the remainder of the inputs, the outputs,
    +and the action.
    +
    +Combined with variable expansions, actions can be quite powerful.  Here
    +is an example action that leverages variable expansions to minimize
    +duplication of pathnames:
    +
    +```
    +      'sources': [
    +        # libraries.cc is generated by the js2c action below.
    +        '<(INTERMEDIATE_DIR)/libraries.cc',
    +      ],
    +      'actions': [
    +        {
    +          'variables': {
    +            'core_library_files': [
    +              'src/runtime.js',
    +              'src/v8natives.js',
    +              'src/macros.py',
    +            ],
    +          },
    +          'action_name': 'js2c',
    +          'inputs': [
    +            'tools/js2c.py',
    +            '<@(core_library_files)',
    +          ],
    +          'outputs': [
    +            '<(INTERMEDIATE_DIR)/libraries.cc',
    +            '<(INTERMEDIATE_DIR)/libraries-empty.cc',
    +          ],
    +          'action': ['python', 'tools/js2c.py', '<@(_outputs)', 'CORE', '<@(core_library_files)'],
    +        },
    +      ],
    +```
    +
    +### Rules
    +
    +A `rules` section provides custom build action to perform on inputs, producing
    +outputs.  The `rules` section is organized as a list.  Each item in the list is
    +a dictionary having the following form:
    +
    +| *Keyword*   | *Type* | *Description*                            |
    +|:------------|:-------|:-----------------------------------------|
    +| `rule_name` | string | The name of the rule.  Depending on how Rules are implemented in the various generators, some may desire or require this property to be set to a unique name; others may ignore this property entirely. |
    +| `extension` | string | All source files of the current target with the given extension will be treated successively as inputs to the rule. |
    +| `inputs`    | list   | Additional dependencies of the rule. |
    +| `outputs`   | list   | A list of pathnames that the rule produces. Has access to `RULE_INPUT_` variables (see below). |
    +| `action`    | list   | A command line invocation used to produce `outputs` from `inputs`.  For maximum cross-platform compatibility, invocations that require a Python interpreter should be specified with a first element `"python"`.  This will enable generators for environments with specialized Python installations to be able to perform the action in an appropriate Python environment. Has access to `RULE_INPUT_` variables (see below). |
    +| `message`   | string | A message to be displayed to the user by the build system when the action is run. Has access to `RULE_INPUT_` variables (see below). |
    +
    +There are several variables available to `outputs`, `action`, and `message`.
    +
    +|  *Variable*          | *Description*                       |
    +|:---------------------|:------------------------------------|
    +| `RULE_INPUT_PATH`    | The full path to the current input. |
    +| `RULE_INPUT_DIRNAME` | The directory of the current input. |
    +| `RULE_INPUT_NAME`    | The file name of the current input. |
    +| `RULE_INPUT_ROOT`    | The file name of the current input without extension. |
    +| `RULE_INPUT_EXT`     | The file name extension of the current input. |
    +
    +Rules can be thought of as Action generators. For each source selected
    +by `extension` an special action is created. This action starts out with
    +the same `inputs`, `outputs`, `action`, and `message` as the rule. The
    +source is added to the action's `inputs`. The `outputs`, `action`, and
    +`message` are then handled the same but with the additional variables.
    +If the `_output` variable is used in the `action` or `message` the
    +`RULE_INPUT_` variables in `output` will be expanded for the current
    +source.
    +
    +### Copies
    +
    +A `copies` section provides a simple means of copying files.  The
    +`copies` section is organized as a list.  Each item in the list is a
    +dictionary having the following form:
    +
    +| *Keyword*     | *Type* | *Description*                 |
    +|:--------------|:-------|:------------------------------|
    +| `destination` | string | The directory into which the `files` will be copied. |
    +| `files`       | list   | A list of files to be copied. |
    +
    +The copies will be created in `destination` and have the same file name
    +as the file they are copied from. Even if the `files` are from multiple
    +directories they will all be copied into the `destination` directory.
    +Each `destination` file has an implicit build dependency on the file it
    +is copied from.
    +
    +### Generated Xcode .pbxproj Files
    +
    +We derive the following things in a `project.pbxproj` plist file within
    +an `.xcodeproj` bundle from the above input file formats as follows:
    +
    +  * `Group hierarchy`: This is generated in a fixed format with contents
    +    derived from the input files. There is no provision for the user to
    +    specify additional groups or create a custom hierarchy.
    +    * `Configuration group`: This will be used with the
    +      `xcode_config_file` property above, if needed.
    +    * `Source group`: The union of the `sources` lists of all `targets`
    +      after applying appropriate `conditions`.  The resulting list is
    +      sorted and put into a group hierarchy that matches the layout of
    +      the directory tree on disk, with a root of // (the top of the
    +      hierarchy).
    +    * `Frameworks group`: Taken directly from `libraries` value for the
    +      target, after applying appropriate conditions.
    +    * `Projects group`: References to other `.xcodeproj` bundles that
    +      are needed by the `.xcodeproj` in which the group is contained.
    +    * `Products group`: Output from the various targets.
    +  * `Project References`:
    +  * `Project Configurations`:
    +    * Per-`.xcodeproj` file settings are not supported, all settings are
    +      applied at the target level.
    +  * `Targets`:
    +    * `Phases`: Copy sources, link with libraries/frameworks, ...
    +    * `Target Configurations`: Specified by input.
    +    * `Dependencies`: (local and remote)
    +
    +### Generated Visual Studio .vcproj Files
    +
    +We derive the following sections in a `.vcproj` file from the above
    +input file formats as follows:
    +
    +  * `VisualStudioProject`:
    +    * `Platforms`:
    +    * `ToolFiles`:
    +    * `Configurations`:
    +      * `Configuration`:
    +    * `References`:
    +    * `Files`:
    +      * `Filter`:
    +      * `File`:
    +        * `FileConfiguration`:
    +          * `Tool`:
    +    * `Globals`:
    +
    +### Generated Visual Studio .sln Files
    +
    +We derive the following sections in a `.sln` file from the above input
    +file formats as follows:
    +
    +  * `Projects`:
    +    * `WebsiteProperties`:
    +    * `ProjectDependencies`:
    +  * `Global`:
    +    * `SolutionConfigurationPlatforms`:
    +    * `ProjectConfigurationPlatforms`:
    +    * `SolutionProperties`:
    +    * `NestedProjects`:
    +
    +## Caveats
    +
    +Notes/Question from very first prototype draft of the language.
    +Make sure these issues are addressed somewhere before deleting.
    +
    +  * Libraries are easy, application abstraction is harder
    +    * Applications involves resource compilation
    +    * Applications involve many inputs
    +    * Applications include transitive closure of dependencies
    +  * Specific use cases like cc\_library
    +    * Mac compiles more than just .c/.cpp files (specifically, .m and .mm
    +      files)
    +    * Compiler options vary by:
    +      * File type
    +      * Target type
    +      * Individual file
    +    * Files may have custom settings per file per platform, but we probably
    +      don't care or need to support this in gyp.
    +  * Will all linked non-Chromium projects always use the same versions of every
    +    subsystem?
    +  * Variants are difficult.  We've identified the following variants (some
    +    specific to Chromium, some typical of other projects in the same ballpark):
    +    * Target platform
    +    * V8 vs. JSC
    +    * Debug vs. Release
    +    * Toolchain (VS version, gcc, version)
    +    * Host platform
    +    * L10N
    +    * Vendor
    +    * Purify / Valgrind
    +  * Will everyone upgrade VS at once?
    +  * What does a dylib dependency mean?
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/docs/README.md b/node_modules/npm/node_modules/node-gyp/gyp/docs/README.md
    new file mode 100644
    index 00000000..5f9b6a59
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/docs/README.md
    @@ -0,0 +1,27 @@
    +# Generate Your Projects (gyp-next)
    +
    +GYP is a Meta-Build system: a build system that generates other build systems.
    +
    +* [User documentation](./UserDocumentation.md)
    +* [Input Format Reference](./InputFormatReference.md)
    +* [Language specification](./LanguageSpecification.md)
    +* [Hacking](./Hacking.md)
    +* [Testing](./Testing.md)
    +* [GYP vs. CMake](./GypVsCMake.md)
    +
    +GYP is intended to support large projects that need to be built on multiple
    +platforms (e.g., Mac, Windows, Linux), and where it is important that
    +the project can be built using the IDEs that are popular on each platform
    +as if the project is a "native" one.
    +
    +It can be used to generate XCode projects, Visual Studio projects, Ninja
    +build files, and Makefiles. In each case GYP's goal is to replicate as
    +closely as possible the way one would set up a native build of the project
    +using the IDE.
    +
    +GYP can also be used to generate "hybrid" projects that provide the IDE
    +scaffolding for a nice user experience but call out to Ninja to do the actual
    +building (which is usually much faster than the native build systems of the
    +IDEs).
    +
    +For more information on GYP, click on the links above.
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/docs/Testing.md b/node_modules/npm/node_modules/node-gyp/gyp/docs/Testing.md
    new file mode 100644
    index 00000000..baeb65f9
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/docs/Testing.md
    @@ -0,0 +1,450 @@
    +# Testing
    +
    +NOTE: this document is outdated and needs to be updated. Read with your own discretion.
    +
    +## Introduction
    +
    +This document describes the GYP testing infrastructure,
    +as provided by the `TestGyp.py` module.
    +
    +These tests emphasize testing the _behavior_ of the
    +various GYP-generated build configurations:
    +Visual Studio, Xcode, SCons, Make, etc.
    +The goal is _not_ to test the output of the GYP generators by,
    +for example, comparing a GYP-generated Makefile
    +against a set of known "golden" Makefiles
    +(although the testing infrastructure could
    +be used to write those kinds of tests).
    +The idea is that the generated build configuration files
    +could be completely written to add a feature or fix a bug
    +so long as they continue to support the functional behaviors
    +defined by the tests:  building programs, shared libraries, etc.
    +
    +## "Hello, world!" GYP test configuration
    +
    +Here is an actual test configuration,
    +a simple build of a C program to print `"Hello, world!"`.
    +
    +```
    +  $ ls -l test/hello
    +  total 20
    +  -rw-r--r-- 1 knight knight 312 Jul 30 20:22 gyptest-all.py
    +  -rw-r--r-- 1 knight knight 307 Jul 30 20:22 gyptest-default.py
    +  -rwxr-xr-x 1 knight knight 326 Jul 30 20:22 gyptest-target.py
    +  -rw-r--r-- 1 knight knight  98 Jul 30 20:22 hello.c
    +  -rw-r--r-- 1 knight knight 142 Jul 30 20:22 hello.gyp
    +  $
    +```
    +
    +The `gyptest-*.py` files are three separate tests (test scripts)
    +that use this configuration.  The first one, `gyptest-all.py`,
    +looks like this:
    +
    +```
    +  #!/usr/bin/env python
    +
    +  """
    +  Verifies simplest-possible build of a "Hello, world!" program
    +  using an explicit build target of 'all'.
    +  """
    +
    +  import TestGyp
    +
    +  test = TestGyp.TestGyp()
    +
    +  test.run_gyp('hello.gyp')
    +
    +  test.build_all('hello.gyp')
    +
    +  test.run_built_executable('hello', stdout="Hello, world!\n")
    +
    +  test.pass_test()
    +```
    +
    +The test script above runs GYP against the specified input file
    +(`hello.gyp`) to generate a build configuration.
    +It then tries to build the `'all'` target
    +(or its equivalent) using the generated build configuration.
    +Last, it verifies that the build worked as expected
    +by running the executable program (`hello`)
    +that was just presumably built by the generated configuration,
    +and verifies that the output from the program
    +matches the expected `stdout` string (`"Hello, world!\n"`).
    +
    +Which configuration is generated
    +(i.e., which build tool to test)
    +is specified when the test is run;
    +see the next section.
    +
    +Surrounding the functional parts of the test
    +described above are the header,
    +which should be basically the same for each test
    +(modulo a different description in the docstring):
    +
    +```
    +  #!/usr/bin/env python
    +
    +  """
    +  Verifies simplest-possible build of a "Hello, world!" program
    +  using an explicit build target of 'all'.
    +  """
    +
    +  import TestGyp
    +
    +  test = TestGyp.TestGyp()
    +```
    +
    +Similarly, the footer should be the same in every test:
    +
    +```
    +  test.pass_test()
    +```
    +
    +## Running tests
    +
    +Test scripts are run by the `gyptest.py` script.
    +You can specify (an) explicit test script(s) to run:
    +
    +```
    +  $ python gyptest.py test/hello/gyptest-all.py
    +  PYTHONPATH=/home/knight/src/gyp/trunk/test/lib
    +  TESTGYP_FORMAT=scons
    +  /usr/bin/python test/hello/gyptest-all.py
    +  PASSED
    +  $
    +```
    +
    +If you specify a directory, all test scripts
    +(scripts prefixed with `gyptest-`) underneath
    +the directory will be run:
    +
    +```
    +  $ python gyptest.py test/hello
    +  PYTHONPATH=/home/knight/src/gyp/trunk/test/lib
    +  TESTGYP_FORMAT=scons
    +  /usr/bin/python test/hello/gyptest-all.py
    +  PASSED
    +  /usr/bin/python test/hello/gyptest-default.py
    +  PASSED
    +  /usr/bin/python test/hello/gyptest-target.py
    +  PASSED
    +  $
    +```
    +
    +Or you can specify the `-a` option to run all scripts
    +in the tree:
    +
    +```
    +  $ python gyptest.py -a
    +  PYTHONPATH=/home/knight/src/gyp/trunk/test/lib
    +  TESTGYP_FORMAT=scons
    +  /usr/bin/python test/configurations/gyptest-configurations.py
    +  PASSED
    +  /usr/bin/python test/defines/gyptest-defines.py
    +  PASSED
    +      .
    +      .
    +      .
    +      .
    +  /usr/bin/python test/variables/gyptest-commands.py
    +  PASSED
    +  $
    +```
    +
    +If any tests fail during the run,
    +the `gyptest.py` script will report them in a
    +summary at the end.
    +
    +## Debugging tests
    +
    +Tests that create intermediate output do so under the gyp/out/testworkarea
    +directory. On test completion, intermediate output is cleaned up. To preserve
    +this output, set the environment variable PRESERVE=1. This can be handy to
    +inspect intermediate data when debugging a test.
    +
    +You can also set PRESERVE\_PASS=1, PRESERVE\_FAIL=1 or PRESERVE\_NO\_RESULT=1
    +to preserve output for tests that fall into one of those categories.
    +
    +# Specifying the format (build tool) to use
    +
    +By default, the `gyptest.py` script will generate configurations for
    +the "primary" supported build tool for the platform you're on:
    +Visual Studio on Windows,
    +Xcode on Mac,
    +and (currently) SCons on Linux.
    +An alternate format (build tool) may be specified
    +using the `-f` option:
    +
    +```
    +  $ python gyptest.py -f make test/hello/gyptest-all.py
    +  PYTHONPATH=/home/knight/src/gyp/trunk/test/lib
    +  TESTGYP_FORMAT=make
    +  /usr/bin/python test/hello/gyptest-all.py
    +  PASSED
    +  $
    +```
    +
    +Multiple tools may be specified in a single pass as
    +a comma-separated list:
    +
    +```
    +  $ python gyptest.py -f make,scons test/hello/gyptest-all.py
    +  PYTHONPATH=/home/knight/src/gyp/trunk/test/lib
    +  TESTGYP_FORMAT=make
    +  /usr/bin/python test/hello/gyptest-all.py
    +  PASSED
    +  TESTGYP_FORMAT=scons
    +  /usr/bin/python test/hello/gyptest-all.py
    +  PASSED
    +  $
    +```
    +
    +## Test script functions and methods
    +
    +The `TestGyp` class contains a lot of functionality
    +intended to make it easy to write tests.
    +This section describes the most useful pieces for GYP testing.
    +
    +(The `TestGyp` class is actually a subclass of more generic
    +`TestCommon` and `TestCmd` base classes
    +that contain even more functionality than is
    +described here.)
    +
    +### Initialization
    +
    +The standard initialization formula is:
    +
    +```
    +  import TestGyp
    +  test = TestGyp.TestGyp()
    +```
    +
    +This copies the contents of the directory tree in which
    +the test script lives to a temporary directory for execution,
    +and arranges for the temporary directory's removal on exit.
    +
    +By default, any comparisons of output or file contents
    +must be exact matches for the test to pass.
    +If you need to use regular expressions for matches,
    +a useful alternative initialization is:
    +
    +```
    +  import TestGyp
    +  test = TestGyp.TestGyp(match = TestGyp.match_re,
    +                         diff = TestGyp.diff_re)`
    +```
    +
    +### Running GYP
    +
    +The canonical invocation is to simply specify the `.gyp` file to be executed:
    +
    +```
    +  test.run_gyp('file.gyp')
    +```
    +
    +Additional GYP arguments may be specified:
    +
    +```
    +  test.run_gyp('file.gyp', arguments=['arg1', 'arg2', ...])
    +```
    +
    +To execute GYP from a subdirectory (where, presumably, the specified file
    +lives):
    +
    +```
    +  test.run_gyp('file.gyp', chdir='subdir')
    +```
    +
    +### Running the build tool
    +
    +Running the build tool requires passing in a `.gyp` file, which may be used to
    +calculate the name of a specific build configuration file (such as a MSVS
    +solution file corresponding to the `.gyp` file).
    +
    +There are several different `.build_*()` methods for invoking different types
    +of builds.
    +
    +To invoke a build tool with an explicit `all` target (or equivalent):
    +
    +```
    +  test.build_all('file.gyp')
    +```
    +
    +To invoke a build tool with its default behavior (for example, executing `make`
    +with no targets specified):
    +
    +```
    +  test.build_default('file.gyp')
    +```
    +
    +To invoke a build tool with an explicit specified target:
    +
    +```
    +  test.build_target('file.gyp', 'target')
    +```
    +
    +### Running executables
    +
    +The most useful method executes a program built by the GYP-generated
    +configuration:
    +
    +```
    +  test.run_built_executable('program')
    +```
    +
    +The `.run_built_executable()` method will account for the actual built target
    +output location for the build tool being tested, as well as tack on any
    +necessary executable file suffix for the platform (for example `.exe` on
    +Windows).
    +
    +`stdout=` and `stderr=` keyword arguments specify expected standard output and
    +error output, respectively.  Failure to match these (if specified) will cause
    +the test to fail.  An explicit `None` value will suppress that verification:
    +
    +```
    +  test.run_built_executable('program',
    +                            stdout="expect this output\n",
    +							stderr=None)
    +```
    +
    +Note that the default values are `stdout=None` and `stderr=''` (that is, no
    +check for standard output, and error output must be empty).
    +
    +Arbitrary executables (not necessarily those built by GYP) can be executed with
    +the lower-level `.run()` method:
    +
    +```
    +  test.run('program')
    +```
    +
    +The program must be in the local directory (that is, the temporary directory
    +for test execution) or be an absolute path name.
    +
    +### Fetching command output
    +
    +```
    +  test.stdout()
    +```
    +
    +Returns the standard output from the most recent executed command (including
    +`.run_gyp()`, `.build_*()`, or `.run*()` methods).
    +
    +```
    +  test.stderr()
    +```
    +
    +Returns the error output from the most recent executed command (including
    +`.run_gyp()`, `.build_*()`, or `.run*()` methods).
    +
    +### Verifying existence or non-existence of files or directories
    +
    +```
    +  test.must_exist('file_or_dir')
    +```
    +
    +Verifies that the specified file or directory exists, and fails the test if it
    +doesn't.
    +
    +```
    +  test.must_not_exist('file_or_dir')
    +```
    +
    +Verifies that the specified file or directory does not exist, and fails the
    +test if it does.
    +
    +### Verifying file contents
    +
    +```
    +  test.must_match('file', 'expected content\n')
    +```
    +
    +Verifies that the content of the specified file match the expected string, and
    +fails the test if it does not.  By default, the match must be exact, but
    +line-by-line regular expressions may be used if the `TestGyp` object was
    +initialized with `TestGyp.match_re`.
    +
    +```
    +  test.must_not_match('file', 'expected content\n')
    +```
    +
    +Verifies that the content of the specified file does _not_ match the expected
    +string, and fails the test if it does.  By default, the match must be exact,
    +but line-by-line regular expressions may be used if the `TestGyp` object was
    +initialized with `TestGyp.match_re`.
    +
    +```
    +  test.must_contain('file', 'substring')
    +```
    +
    +Verifies that the specified file contains the specified substring, and fails
    +the test if it does not.
    +
    +```
    +  test.must_not_contain('file', 'substring')
    +```
    +
    +Verifies that the specified file does not contain the specified substring, and
    +fails the test if it does.
    +
    +```
    +  test.must_contain_all_lines(output, lines)
    +```
    +
    +Verifies that the output string contains all of the "lines" in the specified
    +list of lines.  In practice, the lines can be any substring and need not be
    +`\n`-terminaed lines per se.  If any line is missing, the test fails.
    +
    +```
    +  test.must_not_contain_any_lines(output, lines)
    +```
    +
    +Verifies that the output string does _not_ contain any of the "lines" in the
    +specified list of lines.  In practice, the lines can be any substring and need
    +not be `\n`-terminaed lines per se.  If any line exists in the output string,
    +the test fails.
    +
    +```
    +  test.must_contain_any_line(output, lines)
    +```
    +
    +Verifies that the output string contains at least one of the "lines" in the
    +specified list of lines.  In practice, the lines can be any substring and need
    +not be `\n`-terminaed lines per se.  If none of the specified lines is present,
    +the test fails.
    +
    +### Reading file contents
    +
    +```
    +  test.read('file')
    +```
    +
    +Returns the contents of the specified file.  Directory elements contained in a
    +list will be joined:
    +
    +```
    +  test.read(['subdir', 'file'])
    +```
    +
    +### Test success or failure
    +
    +```
    +  test.fail_test()
    +```
    +
    +Fails the test, reporting `FAILED` on standard output and exiting with an exit
    +status of `1`.
    +
    +```
    +  test.pass_test()
    +```
    +
    +Passes the test, reporting `PASSED` on standard output and exiting with an exit
    +status of `0`.
    +
    +```
    +  test.no_result()
    +```
    +
    +Indicates the test had no valid result (i.e., the conditions could not be
    +tested because of an external factor like a full file system).  Reports `NO
    +RESULT` on standard output and exits with a status of `2`.
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/docs/UserDocumentation.md b/node_modules/npm/node_modules/node-gyp/gyp/docs/UserDocumentation.md
    new file mode 100644
    index 00000000..808f37a1
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/docs/UserDocumentation.md
    @@ -0,0 +1,965 @@
    +# User Documentation
    +
    +## Introduction
    +
    +This document is intended to provide a user-level guide to GYP.  The
    +emphasis here is on how to use GYP to accomplish specific tasks, not on
    +the complete technical language specification.  (For that, see the
    +[LanguageSpecification](LanguageSpecification.md).)
    +
    +The document below starts with some overviews to provide context: an
    +overview of the structure of a `.gyp` file itself, an overview of a
    +typical executable-program target in a `.gyp` file, an an overview of a
    +typical library target in a `.gyp` file.
    +
    +After the overviews, there are examples of `gyp` patterns for different
    +common use cases.
    +
    +## Skeleton of a typical Chromium .gyp file
    +
    +Here is the skeleton of a typical `.gyp` file in the Chromium tree:
    +
    +```
    +  {
    +    'variables': {
    +      .
    +      .
    +      .
    +    },
    +    'includes': [
    +      '../build/common.gypi',
    +    ],
    +    'target_defaults': {
    +      .
    +      .
    +      .
    +    },
    +    'targets': [
    +      {
    +        'target_name': 'target_1',
    +          .
    +          .
    +          .
    +      },
    +      {
    +        'target_name': 'target_2',
    +          .
    +          .
    +          .
    +      },
    +    ],
    +    'conditions': [
    +      ['OS=="linux"', {
    +        'targets': [
    +          {
    +            'target_name': 'linux_target_3',
    +              .
    +              .
    +              .
    +          },
    +        ],
    +      }],
    +      ['OS=="win"', {
    +        'targets': [
    +          {
    +            'target_name': 'windows_target_4',
    +              .
    +              .
    +              .
    +          },
    +        ],
    +      }, { # OS != "win"
    +        'targets': [
    +          {
    +            'target_name': 'non_windows_target_5',
    +              .
    +              .
    +              .
    +          },
    +      }],
    +    ],
    +  }
    +```
    +
    +The entire file just contains a Python dictionary.  (It's actually JSON,
    +with two small Pythonic deviations: comments are introduced with `#`,
    +and a `,` (comma)) is legal after the last element in a list or
    +dictionary.)
    +
    +The top-level pieces in the `.gyp` file are as follows:
    +
    +`'variables'`:  Definitions of variables that can be interpolated and
    +used in various other parts of the file.
    +
    +`'includes'`:  A list of of other files that will be included in this
    +file.  By convention, included files have the suffix `.gypi` (gyp
    +include).
    +
    +`'target_defaults'`:  Settings that will apply to _all_ of the targets
    +defined in this `.gyp` file.
    +
    +`'targets'`:  The list of targets for which this `.gyp` file can
    +generate builds.  Each target is a dictionary that contains settings
    +describing all the information necessary to build the target.
    +
    +`'conditions'`:  A list of condition specifications that can modify the
    +contents of the items in the global dictionary defined by this `.gyp`
    +file based on the values of different variablwes.  As implied by the
    +above example, the most common use of a `conditions` section in the
    +top-level dictionary is to add platform-specific targets to the
    +`targets` list.
    +
    +## Skeleton of a typical executable target in a .gyp file
    +
    +The most straightforward target is probably a simple executable program.
    +Here is an example `executable` target that demonstrates the features
    +that should cover most simple uses of gyp:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'foo',
    +        'type': 'executable',
    +        'msvs_guid': '5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65',
    +        'dependencies': [
    +          'xyzzy',
    +          '../bar/bar.gyp:bar',
    +        ],
    +        'defines': [
    +          'DEFINE_FOO',
    +          'DEFINE_A_VALUE=value',
    +        ],
    +        'include_dirs': [
    +          '..',
    +        ],
    +        'sources': [
    +          'file1.cc',
    +          'file2.cc',
    +        ],
    +        'conditions': [
    +          ['OS=="linux"', {
    +            'defines': [
    +              'LINUX_DEFINE',
    +            ],
    +            'include_dirs': [
    +              'include/linux',
    +            ],
    +          }],
    +          ['OS=="win"', {
    +            'defines': [
    +              'WINDOWS_SPECIFIC_DEFINE',
    +            ],
    +          }, { # OS != "win",
    +            'defines': [
    +              'NON_WINDOWS_DEFINE',
    +            ],
    +          }]
    +        ],
    +      },
    +    ],
    +  }
    +```
    +
    +The top-level settings in the target include:
    +
    +`'target_name'`: The name by which the target should be known, which
    +should be unique across all `.gyp` files.  This name will be used as the
    +project name in the generated Visual Studio solution, as the target name
    +in the generated XCode configuration, and as the alias for building this
    +target from the command line of the generated SCons configuration.
    +
    +`'type'`: Set to `executable`, logically enough.
    +
    +`'msvs_guid'`: THIS IS ONLY TRANSITIONAL.  This is a hard-coded GUID
    +values that will be used in the generated Visual Studio solution
    +file(s).  This allows us to check in a `chrome.sln` file that
    +interoperates with gyp-generated project files.  Once everything in
    +Chromium is being generated by gyp, it will no longer be important that
    +the GUIDs stay constant across invocations, and we'll likely get rid of
    +these settings,
    +
    +`'dependencies'`: This lists other targets that this target depends on.
    +The gyp-generated files will guarantee that the other targets are built
    +before this target.  Any library targets in the `dependencies` list will
    +be linked with this target.  The various settings (`defines`,
    +`include_dirs`, etc.) listed in the `direct_dependent_settings` sections
    +of the targets in this list will be applied to how _this_ target is
    +built and linked.  See the more complete discussion of
    +`direct_dependent_settings`, below.
    +
    +`'defines'`: The C preprocessor definitions that will be passed in on
    +compilation command lines (using `-D` or `/D` options).
    +
    +`'include_dirs'`: The directories in which included header files live.
    +These will be passed in on compilation command lines (using `-I` or `/I`
    +options).
    +
    +`'sources'`: The source files for this target.
    +
    +`'conditions'`: A block of conditions that will be evaluated to update
    +the different settings in the target dictionary.
    +
    +## Skeleton of a typical library target in a .gyp file
    +
    +The vast majority of targets are libraries.  Here is an example of a
    +library target including the additional features that should cover most
    +needs of libraries:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'foo',
    +        'type': '<(library)'
    +        'msvs_guid': '5ECEC9E5-8F23-47B6-93E0-C3B328B3BE65',
    +        'dependencies': [
    +          'xyzzy',
    +          '../bar/bar.gyp:bar',
    +        ],
    +        'defines': [
    +          'DEFINE_FOO',
    +          'DEFINE_A_VALUE=value',
    +        ],
    +        'include_dirs': [
    +          '..',
    +        ],
    +        'direct_dependent_settings': {
    +          'defines': [
    +            'DEFINE_FOO',
    +            'DEFINE_ADDITIONAL',
    +          ],
    +          'linkflags': [
    +          ],
    +        },
    +        'export_dependent_settings': [
    +          '../bar/bar.gyp:bar',
    +        ],
    +        'sources': [
    +          'file1.cc',
    +          'file2.cc',
    +        ],
    +        'conditions': [
    +          ['OS=="linux"', {
    +            'defines': [
    +              'LINUX_DEFINE',
    +            ],
    +            'include_dirs': [
    +              'include/linux',
    +            ],
    +          ],
    +          ['OS=="win"', {
    +            'defines': [
    +              'WINDOWS_SPECIFIC_DEFINE',
    +            ],
    +          }, { # OS != "win",
    +            'defines': [
    +              'NON_WINDOWS_DEFINE',
    +            ],
    +          }]
    +        ],
    +    ],
    +  }
    +```
    +
    +The possible entries in a library target are largely the same as those
    +that can be specified for an executable target (`defines`,
    +`include_dirs`, etc.).  The differences include:
    +
    +`'type'`: This should almost always be set to '<(library)', which allows
    +the user to define at gyp time whether libraries are to be built static
    +or shared.  (On Linux, at least, linking with shared libraries saves
    +significant link time.) If it's necessary to pin down the type of
    +library to be built, the `type` can be set explicitly to
    +`static_library` or `shared_library`.
    +
    +`'direct_dependent_settings'`: This defines the settings that will be
    +applied to other targets that _directly depend_ on this target--that is,
    +that list _this_ target in their `'dependencies'` setting.  This is
    +where you list the `defines`, `include_dirs`, `cflags` and `linkflags`
    +that other targets that compile or link against this target need to
    +build consistently.
    +
    +`'export_dependent_settings'`: This lists the targets whose
    +`direct_dependent_settings` should be "passed on" to other targets that
    +use (depend on) this target.  `TODO:  expand on this description.`
    +
    +## Use Cases
    +
    +These use cases are intended to cover the most common actions performed
    +by developers using GYP.
    +
    +Note that these examples are _not_ fully-functioning, self-contained
    +examples (or else they'd be way too long).  Each example mostly contains
    +just the keywords and settings relevant to the example, with perhaps a
    +few extra keywords for context.  The intent is to try to show the
    +specific pieces you need to pay attention to when doing something.
    +[NOTE:  if practical use shows that these examples are confusing without
    +additional context, please add what's necessary to clarify things.]
    +
    +### Add new source files
    +
    +There are similar but slightly different patterns for adding a
    +platform-independent source file vs. adding a source file that only
    +builds on some of the supported platforms.
    +
    +#### Add a source file that builds on all platforms
    +
    +**Simplest possible case**: You are adding a file(s) that builds on all
    +platforms.
    +
    +Just add the file(s) to the `sources` list of the appropriate dictionary
    +in the `targets` list:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'my_target',
    +        'type': 'executable',
    +        'sources': [
    +          '../other/file_1.cc',
    +          'new_file.cc',
    +          'subdir/file3.cc',
    +        ],
    +      },
    +    ],
    +  },
    +```
    +
    +File path names are relative to the directory in which the `.gyp` file lives.
    +
    +Keep the list sorted alphabetically (unless there's a really, really,
    +_really_ good reason not to).
    +
    +#### Add a platform-specific source file
    +
    +##### Your platform-specific file is named `*_linux.{ext}`, `*_mac.{ext}`, `*_posix.{ext}` or `*_win.{ext}`
    +
    +The simplest way to add a platform-specific source file, assuming you're
    +adding a completely new file and get to name it, is to use one of the
    +following standard suffixes:
    +
    +  * `_linux`  (e.g. `foo_linux.cc`)
    +  * `_mac`    (e.g. `foo_mac.cc`)
    +  * `_posix`  (e.g. `foo_posix.cc`)
    +  * `_win`    (e.g. `foo_win.cc`)
    +
    +Simply add the file to the `sources` list of the appropriate dict within
    +the `targets` list, like you would any other source file.
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'foo',
    +        'type': 'executable',
    +        'sources': [
    +          'independent.cc',
    +          'specific_win.cc',
    +        ],
    +      },
    +    ],
    +  },
    +```
    +
    +The Chromium `.gyp` files all have appropriate `conditions` entries to
    +filter out the files that aren't appropriate for the current platform.
    +In the above example, the `specific_win.cc` file will be removed
    +automatically from the source-list on non-Windows builds.
    +
    +##### Your platform-specific file does not use an already-defined pattern
    +
    +If your platform-specific file does not contain a
    +`*_{linux,mac,posix,win}` substring (or some other pattern that's
    +already in the `conditions` for the target), and you can't change the
    +file name, there are two patterns that can be used.
    +
    +**Prefererred**:  Add the file to the `sources` list of the appropriate
    +dictionary within the `targets` list.  Add an appropriate `conditions`
    +section to exclude the specific files name:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'foo',
    +        'type': 'executable',
    +        'sources': [
    +          'linux_specific.cc',
    +        ],
    +        'conditions': [
    +          ['OS != "linux"', {
    +            'sources!': [
    +              # Linux-only; exclude on other platforms.
    +              'linux_specific.cc',
    +            ]
    +          }[,
    +        ],
    +      },
    +    ],
    +  },
    +```
    +
    +Despite the duplicate listing, the above is generally preferred because
    +the `sources` list contains a useful global list of all sources on all
    +platforms with consistent sorting on all platforms.
    +
    +**Non-preferred**: In some situations, however, it might make sense to
    +list a platform-specific file only in a `conditions` section that
    +specifically _includes_ it in the `sources` list:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'foo',
    +        'type': 'executable',
    +        'sources': [],
    +        ['OS == "linux"', {
    +          'sources': [
    +            # Only add to sources list on Linux.
    +            'linux_specific.cc',
    +          ]
    +        }],
    +      },
    +    ],
    +  },
    +```
    +
    +The above two examples end up generating equivalent builds, with the
    +small exception that the `sources` lists will list the files in
    +different orders.  (The first example defines explicitly where
    +`linux_specific.cc` appears in the list--perhaps in in the
    +middle--whereas the second example will always tack it on to the end of
    +the list.)
    +
    +**Including or excluding files using patterns**: There are more
    +complicated ways to construct a `sources` list based on patterns.  See
    +`TODO` below.
    +
    +### Add a new executable
    +
    +An executable program is probably the most straightforward type of
    +target, since all it typically needs is a list of source files, some
    +compiler/linker settings (probably varied by platform), and some library
    +targets on which it depends and which must be used in the final link.
    +
    +#### Add an executable that builds on all platforms
    +
    +Add a dictionary defining the new executable target to the `targets`
    +list in the appropriate `.gyp` file.  Example:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'new_unit_tests',
    +        'type': 'executable',
    +        'defines': [
    +          'FOO',
    +        ],
    +        'include_dirs': [
    +          '..',
    +        ],
    +        'dependencies': [
    +          'other_target_in_this_file',
    +          'other_gyp2:target_in_other_gyp2',
    +        ],
    +        'sources': [
    +          'new_additional_source.cc',
    +          'new_unit_tests.cc',
    +        ],
    +      },
    +    ],
    +  }
    +```
    +
    +#### Add a platform-specific executable
    +
    +Add a dictionary defining the new executable target to the `targets`
    +list within an appropriate `conditions` block for the platform.  The
    +`conditions` block should be a sibling to the top-level `targets` list:
    +
    +```
    +  {
    +    'targets': [
    +    ],
    +    'conditions': [
    +      ['OS=="win"', {
    +        'targets': [
    +          {
    +            'target_name': 'new_unit_tests',
    +            'type': 'executable',
    +            'defines': [
    +              'FOO',
    +            ],
    +            'include_dirs': [
    +              '..',
    +            ],
    +            'dependencies': [
    +              'other_target_in_this_file',
    +              'other_gyp2:target_in_other_gyp2',
    +            ],
    +            'sources': [
    +              'new_additional_source.cc',
    +              'new_unit_tests.cc',
    +            ],
    +          },
    +        ],
    +      }],
    +    ],
    +  }
    +```
    +
    +### Add settings to a target
    +
    +There are several different types of settings that can be defined for
    +any given target.
    +
    +#### Add new preprocessor definitions (`-D` or `/D` flags)
    +
    +New preprocessor definitions are added by the `defines` setting:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'existing_target',
    +        'defines': [
    +          'FOO',
    +          'BAR=some_value',
    +        ],
    +      },
    +    ],
    +  },
    +```
    +
    +These may be specified directly in a target's settings, as in the above
    +example, or in a `conditions` section.
    +
    +#### Add a new include directory (`-I` or `/I` flags)
    +
    +New include directories are added by the `include_dirs` setting:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'existing_target',
    +        'include_dirs': [
    +          '..',
    +          'include',
    +        ],
    +      },
    +    ],
    +  },
    +```
    +
    +These may be specified directly in a target's settings, as in the above
    +example, or in a `conditions` section.
    +
    +#### Add new compiler flags
    +
    +Specific compiler flags can be added with the `cflags` setting:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'existing_target',
    +        'conditions': [
    +          ['OS=="win"', {
    +            'cflags': [
    +              '/WX',
    +            ],
    +          }, { # OS != "win"
    +            'cflags': [
    +              '-Werror',
    +            ],
    +          }],
    +        ],
    +      },
    +    ],
    +  },
    +```
    +
    +Because these flags will be specific to the actual compiler involved,
    +they will almost always be only set within a `conditions` section.
    +
    +#### Add new linker flags
    +
    +Setting linker flags is OS-specific. On linux and most non-mac posix
    +systems, they can be added with the `ldflags` setting:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'existing_target',
    +        'conditions': [
    +          ['OS=="linux"', {
    +            'ldflags': [
    +              '-pthread',
    +            ],
    +          }],
    +        ],
    +      },
    +    ],
    +  },
    +```
    +
    +Because these flags will be specific to the actual linker involved,
    +they will almost always be only set within a `conditions` section.
    +
    +On OS X, linker settings are set via `xcode_settings`, on Windows via
    +`msvs_settings`.
    +
    +#### Exclude settings on a platform
    +
    +Any given settings keyword (`defines`, `include_dirs`, etc.) has a
    +corresponding form with a trailing `!` (exclamation point) to remove
    +values from a setting.  One useful example of this is to remove the
    +Linux `-Werror` flag from the global settings defined in
    +`build/common.gypi`:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'third_party_target',
    +        'conditions': [
    +          ['OS=="linux"', {
    +            'cflags!': [
    +              '-Werror',
    +            ],
    +          }],
    +        ],
    +      },
    +    ],
    +  },
    +```
    +
    +### Cross-compiling
    +
    +GYP has some (relatively limited) support for cross-compiling.
    +
    +If the variable `GYP_CROSSCOMPILE` or one of the toolchain-related
    +variables (like `CC_host` or `CC_target`) is set, GYP will think that
    +you wish to do a cross-compile.
    +
    +When cross-compiling, each target can be part of a "host" build, a
    +"target" build, or both. By default, the target is assumed to be (only)
    +part of the "target" build. The 'toolsets' property can be set on a
    +target to change the default.
    +
    +A target's dependencies are assumed to match the build type (so, if A
    +depends on B, by default that means that a target build of A depends on
    +a target build of B). You can explicitly depend on targets across
    +toolchains by specifying "#host" or "#target" in the dependencies list.
    +If GYP is not doing a cross-compile, the "#host" and "#target" will be
    +stripped as needed, so nothing breaks.
    +
    +### Add a new library
    +
    +TODO:  write intro
    +
    +#### Add a library that builds on all platforms
    +
    +Add the a dictionary defining the new library target to the `targets`
    +list in the appropriate `.gyp` file.  Example:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'new_library',
    +        'type': '<(library)',
    +        'defines': [
    +          'FOO',
    +          'BAR=some_value',
    +        ],
    +        'include_dirs': [
    +          '..',
    +        ],
    +        'dependencies': [
    +          'other_target_in_this_file',
    +          'other_gyp2:target_in_other_gyp2',
    +        ],
    +        'direct_dependent_settings': {
    +          'include_dirs': '.',
    +        },
    +        'export_dependent_settings': [
    +          'other_target_in_this_file',
    +        ],
    +        'sources': [
    +          'new_additional_source.cc',
    +          'new_library.cc',
    +        ],
    +      },
    +    ],
    +  }
    +```
    +
    +The use of the `<(library)` variable above should be the default `type`
    +setting for most library targets, as it allows the developer to choose,
    +at `gyp` time, whether to build with static or shared libraries.
    +(Building with shared libraries saves a _lot_ of link time on Linux.)
    +
    +It may be necessary to build a specific library as a fixed type.  Is so,
    +the `type` field can be hard-wired appropriately.  For a static library:
    +
    +```
    +        'type': 'static_library',
    +```
    +
    +For a shared library:
    +
    +```
    +        'type': 'shared_library',
    +```
    +
    +#### Add a platform-specific library
    +
    +Add a dictionary defining the new library target to the `targets` list
    +within a `conditions` block that's a sibling to the top-level `targets`
    +list:
    +
    +```
    +  {
    +    'targets': [
    +    ],
    +    'conditions': [
    +      ['OS=="win"', {
    +        'targets': [
    +          {
    +            'target_name': 'new_library',
    +            'type': '<(library)',
    +            'defines': [
    +              'FOO',
    +              'BAR=some_value',
    +            ],
    +            'include_dirs': [
    +              '..',
    +            ],
    +            'dependencies': [
    +              'other_target_in_this_file',
    +              'other_gyp2:target_in_other_gyp2',
    +            ],
    +            'direct_dependent_settings': {
    +              'include_dirs': '.',
    +            },
    +            'export_dependent_settings': [
    +              'other_target_in_this_file',
    +            ],
    +            'sources': [
    +              'new_additional_source.cc',
    +              'new_library.cc',
    +            ],
    +          },
    +        ],
    +      }],
    +    ],
    +  }
    +```
    +
    +### Dependencies between targets
    +
    +GYP provides useful primitives for establishing dependencies between
    +targets, which need to be configured in the following situations.
    +
    +#### Linking with another library target
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'foo',
    +        'dependencies': [
    +          'libbar',
    +        ],
    +      },
    +      {
    +        'target_name': 'libbar',
    +        'type': '<(library)',
    +        'sources': [
    +        ],
    +      },
    +    ],
    +  }
    +```
    +
    +Note that if the library target is in a different `.gyp` file, you have
    +to specify the path to other `.gyp` file, relative to this `.gyp` file's
    +directory:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'foo',
    +        'dependencies': [
    +          '../bar/bar.gyp:libbar',
    +        ],
    +      },
    +    ],
    +  }
    +```
    +
    +Adding a library often involves updating multiple `.gyp` files, adding
    +the target to the approprate `.gyp` file (possibly a newly-added `.gyp`
    +file), and updating targets in the other `.gyp` files that depend on
    +(link with) the new library.
    +
    +#### Compiling with necessary flags for a library target dependency
    +
    +We need to build a library (often a third-party library) with specific
    +preprocessor definitions or command-line flags, and need to ensure that
    +targets that depend on the library build with the same settings.  This
    +situation is handled by a `direct_dependent_settings` block:
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'foo',
    +        'type': 'executable',
    +        'dependencies': [
    +          'libbar',
    +        ],
    +      },
    +      {
    +        'target_name': 'libbar',
    +        'type': '<(library)',
    +        'defines': [
    +          'LOCAL_DEFINE_FOR_LIBBAR',
    +          'DEFINE_TO_USE_LIBBAR',
    +        ],
    +        'include_dirs': [
    +          '..',
    +          'include/libbar',
    +        ],
    +        'direct_dependent_settings': {
    +          'defines': [
    +            'DEFINE_TO_USE_LIBBAR',
    +          ],
    +          'include_dirs': [
    +            'include/libbar',
    +          ],
    +        },
    +      },
    +    ],
    +  }
    +```
    +
    +In the above example, the sources of the `foo` executable will be
    +compiled with the options `-DDEFINE_TO_USE_LIBBAR -Iinclude/libbar`,
    +because of those settings' being listed in the
    +`direct_dependent_settings` block.
    +
    +Note that these settings will likely need to be replicated in the
    +settings for the library target itsef, so that the library will build
    +with the same options.  This does not prevent the target from defining
    +additional options for its "internal" use when compiling its own source
    +files.  (In the above example, these are the `LOCAL_DEFINE_FOR_LIBBAR`
    +define, and the `..` entry in the `include_dirs` list.)
    +
    +#### When a library depends on an additional library at final link time
    +
    +```
    +  {
    +    'targets': [
    +      {
    +        'target_name': 'foo',
    +        'type': 'executable',
    +        'dependencies': [
    +          'libbar',
    +        ],
    +      },
    +      {
    +        'target_name': 'libbar',
    +        'type': '<(library)',
    +        'dependencies': [
    +          'libother'
    +        ],
    +        'export_dependent_settings': [
    +          'libother'
    +        ],
    +      },
    +      {
    +        'target_name': 'libother',
    +        'type': '<(library)',
    +        'direct_dependent_settings': {
    +          'defines': [
    +            'DEFINE_FOR_LIBOTHER',
    +          ],
    +          'include_dirs': [
    +            'include/libother',
    +          ],
    +        },
    +      },
    +    ],
    +  }
    +```
    +
    +### Support for Mac OS X bundles
    +
    +gyp supports building bundles on OS X (.app, .framework, .bundle, etc).
    +Here is an example of this:
    +
    +```
    +    {
    +      'target_name': 'test_app',
    +      'product_name': 'Test App Gyp',
    +      'type': 'executable',
    +      'mac_bundle': 1,
    +      'sources': [
    +        'main.m',
    +        'TestAppAppDelegate.h',
    +        'TestAppAppDelegate.m',
    +      ],
    +      'mac_bundle_resources': [
    +        'TestApp/English.lproj/InfoPlist.strings',
    +        'TestApp/English.lproj/MainMenu.xib',
    +      ],
    +      'link_settings': {
    +        'libraries': [
    +          '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework',
    +        ],
    +      },
    +      'xcode_settings': {
    +        'INFOPLIST_FILE': 'TestApp/TestApp-Info.plist',
    +      },
    +    },
    +```
    +
    +The `mac_bundle` key tells gyp that this target should be a bundle.
    +`executable` targets get extension `.app` by default, `shared_library`
    +targets get `.framework` – but you can change the bundle extensions by
    +setting `product_extension` if you want. Files listed in
    +`mac_bundle_resources` will be copied to the bundle's `Resource` folder
    +of the bundle. You can also set
    +`process_outputs_as_mac_bundle_resources` to 1 in actions and rules to
    +let the output of actions and rules be added to that folder (similar to
    +`process_outputs_as_sources`). If `product_name` is not set, the bundle
    +will be named after `target_name`as usual.
    +
    +### Move files (refactoring)
    +
    +TODO
    +
    +### Custom build steps
    +
    +TODO
    +
    +#### Adding an explicit build step to generate specific files
    +
    +TODO
    +
    +#### Adding a rule to handle files with a new suffix
    +
    +TODO
    +
    +### Build flavors
    +
    +TODO
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/gyp b/node_modules/npm/node_modules/node-gyp/gyp/gyp
    new file mode 100755
    index 00000000..1b8b9bdf
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/gyp.bat b/node_modules/npm/node_modules/node-gyp/gyp/gyp.bat
    new file mode 100755
    index 00000000..c0b4ca24
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/gyp_main.py b/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py
    new file mode 100755
    index 00000000..f23dcdf8
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py
    new file mode 100644
    index 00000000..bc0e93d0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py
    @@ -0,0 +1,365 @@
    +# 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) 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")
    +
    +        # 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/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py
    new file mode 100644
    index 00000000..629f3f61
    --- /dev/null
    +++ b/node_modules/npm/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 = {}
    +
    +    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/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py
    new file mode 100644
    index 00000000..ac87f572
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py
    @@ -0,0 +1,1272 @@
    +# 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 not in {"true", "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, "LanguageStandard", _string)
    +_MSBuildOnly(_compile, "LanguageStandard_C", _string)
    +_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/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py
    new file mode 100755
    index 00000000..6ca09687
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py
    new file mode 100644
    index 00000000..2e5c811b
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py
    new file mode 100644
    index 00000000..e580c00f
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py
    new file mode 100644
    index 00000000..36bb782b
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
    new file mode 100644
    index 00000000..8d7f21e8
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py
    new file mode 100755
    index 00000000..d6cc0130
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py
    @@ -0,0 +1,692 @@
    +#!/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.get("build_type", "default")
    +            ),
    +        )
    +    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:
    +        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/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py
    new file mode 100644
    index 00000000..762ae021
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py
    @@ -0,0 +1,711 @@
    +# 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
    +import shlex
    +
    +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).
    +    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" 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)
    +    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)
    +
    +    quote = '"' if _quote.search(argument) else ""
    +
    +    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 GetCrossCompilerPredefines():  # -> dict
    +    cmd = []
    +
    +    # shlex.split() will eat '\' in posix mode, but
    +    # setting posix=False will preserve extra '"' cause CreateProcess fail on Windows
    +    # this makes '\' in %CC_target% and %CFLAGS% work
    +    def replace_sep(s):
    +        return s.replace(os.sep, "/") if os.sep != "/" else s
    +
    +    if CC := os.environ.get("CC_target") or os.environ.get("CC"):
    +        cmd += shlex.split(replace_sep(CC))
    +        if CFLAGS := os.environ.get("CFLAGS"):
    +            cmd += shlex.split(replace_sep(CFLAGS))
    +    elif CXX := os.environ.get("CXX_target") or os.environ.get("CXX"):
    +        cmd += shlex.split(replace_sep(CXX))
    +        if CXXFLAGS := os.environ.get("CXXFLAGS"):
    +            cmd += shlex.split(replace_sep(CXXFLAGS))
    +    else:
    +        return {}
    +
    +    if sys.platform == "win32":
    +        fd, input = tempfile.mkstemp(suffix=".c")
    +        real_cmd = [*cmd, "-dM", "-E", "-x", "c", input]
    +        try:
    +            os.close(fd)
    +            stdout = subprocess.run(
    +                real_cmd, shell=True,
    +                capture_output=True, check=True
    +            ).stdout
    +        finally:
    +            os.unlink(input)
    +    else:
    +        input = "/dev/null"
    +        real_cmd = [*cmd, "-dM", "-E", "-x", "c", input]
    +        stdout = subprocess.run(
    +            real_cmd, shell=False,
    +            capture_output=True, check=True
    +        ).stdout
    +
    +    defines = {}
    +    lines = stdout.decode("utf-8").replace("\r\n", "\n").split("\n")
    +    for line in lines:
    +        if (line or "").startswith("#define "):
    +            _, key, *value = line.split(" ")
    +            defines[key] = " ".join(value)
    +    return defines
    +
    +def GetFlavorByPlatform():
    +    """Returns |params.flavor| if it's set, the system's default flavor else."""
    +    flavors = {
    +        "cygwin": "win",
    +        "win32": "win",
    +        "darwin": "mac",
    +    }
    +
    +    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 GetFlavor(params):
    +    if "flavor" in params:
    +        return params["flavor"]
    +
    +    defines = GetCrossCompilerPredefines()
    +    if "__EMSCRIPTEN__" in defines:
    +        return "emscripten"
    +    if "__wasm__" in defines:
    +        return "wasi" if "__wasi__" in defines else "wasm"
    +
    +    return GetFlavorByPlatform()
    +
    +
    +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/npm/node_modules/node-gyp/gyp/pylib/gyp/common_test.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common_test.py
    new file mode 100755
    index 00000000..b6c4cccc
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common_test.py
    @@ -0,0 +1,171 @@
    +#!/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
    +import os
    +from unittest.mock import patch, MagicMock
    +
    +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])
    +
    +        assert 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
    +        assert 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"})
    +
    +    class MockCommunicate:
    +        def __init__(self, stdout):
    +            self.stdout = stdout
    +
    +        def decode(self, encoding):
    +            return self.stdout
    +
    +    @patch("os.close")
    +    @patch("os.unlink")
    +    @patch("tempfile.mkstemp")
    +    def test_GetCrossCompilerPredefines(self, mock_mkstemp, mock_unlink, mock_close):
    +        mock_close.return_value = None
    +        mock_unlink.return_value = None
    +        mock_mkstemp.return_value = (0, "temp.c")
    +
    +        def mock_run(env, defines_stdout, expected_cmd):
    +            with patch("subprocess.run") as mock_run:
    +                mock_process = MagicMock()
    +                mock_process.returncode = 0
    +                mock_process.stdout = TestGetFlavor.MockCommunicate(defines_stdout)
    +                mock_run.return_value = mock_process
    +                expected_input = "temp.c" if sys.platform == "win32" else "/dev/null"
    +                with patch.dict(os.environ, env):
    +                    defines = gyp.common.GetCrossCompilerPredefines()
    +                    flavor = gyp.common.GetFlavor({})
    +                if env.get("CC_target"):
    +                    mock_run.assert_called_with(
    +                        [
    +                            *expected_cmd,
    +                            "-dM", "-E", "-x", "c", expected_input
    +                        ],
    +                        shell=sys.platform == "win32",
    +                        capture_output=True, check=True)
    +                return [defines, flavor]
    +
    +        [defines1, _] = mock_run({}, "", [])
    +        assert {} == defines1
    +
    +        [defines2, flavor2] = mock_run(
    +            { "CC_target": "/opt/wasi-sdk/bin/clang" },
    +            "#define __wasm__ 1\n#define __wasi__ 1\n",
    +            ["/opt/wasi-sdk/bin/clang"]
    +        )
    +        assert { "__wasm__": "1", "__wasi__": "1" } == defines2
    +        assert flavor2 == "wasi"
    +
    +        [defines3, flavor3] = mock_run(
    +            { "CC_target": "/opt/wasi-sdk/bin/clang --target=wasm32" },
    +            "#define __wasm__ 1\n",
    +            ["/opt/wasi-sdk/bin/clang", "--target=wasm32"]
    +        )
    +        assert { "__wasm__": "1" } == defines3
    +        assert flavor3 == "wasm"
    +
    +        [defines4, flavor4] = mock_run(
    +            { "CC_target": "/emsdk/upstream/emscripten/emcc" },
    +            "#define __EMSCRIPTEN__ 1\n",
    +            ["/emsdk/upstream/emscripten/emcc"]
    +        )
    +        assert { "__EMSCRIPTEN__": "1" } == defines4
    +        assert flavor4 == "emscripten"
    +
    +        # Test path which include white space
    +        [defines5, flavor5] = mock_run(
    +            {
    +                "CC_target": "\"/Users/Toyo Li/wasi-sdk/bin/clang\" -O3",
    +                "CFLAGS": "--target=wasm32-wasi-threads -pthread"
    +            },
    +            "#define __wasm__ 1\n#define __wasi__ 1\n#define _REENTRANT 1\n",
    +            [
    +                "/Users/Toyo Li/wasi-sdk/bin/clang",
    +                "-O3",
    +                "--target=wasm32-wasi-threads",
    +                "-pthread"
    +            ]
    +        )
    +        assert {
    +            "__wasm__": "1",
    +            "__wasi__": "1",
    +            "_REENTRANT": "1"
    +        } == defines5
    +        assert flavor5 == "wasi"
    +
    +        original_sep = os.sep
    +        os.sep = "\\"
    +        [defines6, flavor6] = mock_run(
    +            { "CC_target": "\"C:\\Program Files\\wasi-sdk\\clang.exe\"" },
    +            "#define __wasm__ 1\n#define __wasi__ 1\n",
    +            ["C:/Program Files/wasi-sdk/clang.exe"]
    +        )
    +        os.sep = original_sep
    +        assert { "__wasm__": "1", "__wasi__": "1" } == defines6
    +        assert flavor6 == "wasi"
    +
    +if __name__ == "__main__":
    +    unittest.main()
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py
    new file mode 100644
    index 00000000..02567b25
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py
    @@ -0,0 +1,169 @@
    +# 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")
    +
    +    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)
    +
    +    # 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/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py
    new file mode 100755
    index 00000000..2d9b1521
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py
    @@ -0,0 +1,113 @@
    +#!/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"
    +            "SpectreLoadCF"
    +            "14.36.32532"
    +            ""
    +            ""
    +        )
    +
    +        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"],
    +                    ["SpectreMitigation", "SpectreLoadCF"],
    +                    ["VCToolsVersion", "14.36.32532"],
    +                ],
    +            ]
    +        )
    +        self.assertEqual(xml, target)
    +
    +
    +if __name__ == "__main__":
    +    unittest.main()
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py
    new file mode 100755
    index 00000000..0754aff2
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py
    new file mode 100644
    index 00000000..e69de29b
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py
    new file mode 100644
    index 00000000..1334f2fc
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py
    @@ -0,0 +1,804 @@
    +# 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 in {"executable", "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:
    +        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, list(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 in {MATCH_STATUS_MATCHES,
    +                                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 = list(set(test_targets_no_all) | set(self._root_targets))
    +        else:
    +            test_targets = list(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 = list(
    +                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 = list(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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py
    new file mode 100644
    index 00000000..2a63f412
    --- /dev/null
    +++ b/node_modules/npm/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 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")
    +            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 = (
    +                    f"$(call intermediates-dir-for,{self.android_class},"
    +                    f"{self.android_module},,,$(GYP_VAR_PREFIX))"
    +                )
    +
    +        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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py
    new file mode 100644
    index 00000000..320a891a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py
    @@ -0,0 +1,1318 @@
    +# 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")
    +        product_ext = "." + product_ext if product_ext else 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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py
    new file mode 100644
    index 00000000..5d7f14da
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py
    @@ -0,0 +1,127 @@
    +# 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 gyp.common.GetFlavor(params) == "mac"
    +
    +
    +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({"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 = None
    +    try:
    +        # generator_output can be `None` on Windows machines, or even not
    +        # defined in other cases
    +        output_dir = params.get("options").generator_output
    +    except AttributeError:
    +        pass
    +    output_dir = output_dir or 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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py
    new file mode 100644
    index 00000000..99d5c1fd
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py
    new file mode 100644
    index 00000000..52aeae60
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py
    @@ -0,0 +1,461 @@
    +# 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]
    +            val = cpp_line_parts[2] if len(cpp_line_parts) >= 3 else "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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py new file mode 100644 index 00000000..4171704c --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py new file mode 100644 index 00000000..8dfb1f16 --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py @@ -0,0 +1,57 @@ +# 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 = ( + f"Python {sys.version} on {sys.platform}\nlocals.keys() = " + f"{sorted(locals.keys())!r}\ngypsh" + ) + + code.interact(banner, local=locals) diff --git a/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py new file mode 100644 index 00000000..392d9009 --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py @@ -0,0 +1,2745 @@ +# 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 sys +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.target)s +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).""" + + (r""" +sed -e "s|^$(notdir $@)|$@|" -re 's/\\\\([^$$])/\/\1/g' $(depfile).raw >> $(depfile)""" + if sys.platform == 'win32' else r""" +sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)""") + + r""" +# 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 's/\\\\\\\\/\\//g' -e 'y| |\\n|' $(depfile).raw |\\""" + if sys.platform == 'win32' else """ +sed -e 's|\\\\||' -e 'y| |\\n|' $(depfile).raw |\\""") + + r""" + 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).""" + return any(res for res in (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 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 replace_sep(string): + if sys.platform == 'win32': + string = string.replace('\\\\', '/').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: + # 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 = replace_sep(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" + % replace_sep(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 in {"zos", "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 mac, 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.alias not in (self.output, 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 = [replace_sep(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": replace_sep( + " ".join(SourceifyAndQuoteSpaces(bf) for bf in build_files) + ), + "cmd": replace_sep(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 = replace_sep(gyp.common.RelativePath(srcdir, options.generator_output)) + srcdir_prefix = "$(srcdir)/" + + flock_command = "flock" + copy_archive_arguments = "-af" + makedep_arguments = "-MMD" + + # wasm-ld doesn't support --start-group/--end-group + link_commands = LINK_COMMANDS_LINUX + if flavor in ["wasi", "wasm"]: + link_commands = link_commands.replace(' -Wl,--start-group', '').replace( + ' -Wl,--end-group', '' + ) + + CC_target = replace_sep(GetEnvironFallback(("CC_target", "CC"), "$(CC)")) + AR_target = replace_sep(GetEnvironFallback(("AR_target", "AR"), "$(AR)")) + CXX_target = replace_sep(GetEnvironFallback(("CXX_target", "CXX"), "$(CXX)")) + LINK_target = replace_sep(GetEnvironFallback(("LINK_target", "LINK"), "$(LINK)")) + PLI_target = replace_sep(GetEnvironFallback(("PLI_target", "PLI"), "pli")) + CC_host = replace_sep(GetEnvironFallback(("CC_host", "CC"), "gcc")) + AR_host = replace_sep(GetEnvironFallback(("AR_host", "AR"), "ar")) + CXX_host = replace_sep(GetEnvironFallback(("CXX_host", "CXX"), "g++")) + LINK_host = replace_sep(GetEnvironFallback(("LINK_host", "LINK"), "$(CXX.host)")) + PLI_host = replace_sep(GetEnvironFallback(("PLI_host", "PLI"), "pli")) + + header_params = { + "default_target": default_target, + "builddir": builddir_name, + "default_configuration": default_configuration, + "flock": flock_command, + "flock_index": 1, + "link_commands": link_commands, + "extra_commands": "", + "srcdir": srcdir, + "copy_archive_args": copy_archive_arguments, + "makedep_args": makedep_arguments, + "CC.target": CC_target, + "AR.target": AR_target, + "CXX.target": CXX_target, + "LINK.target": LINK_target, + "PLI.target": PLI_target, + "CC.host": CC_host, + "AR.host": AR_host, + "CXX.host": CXX_host, + "LINK.host": LINK_host, + "PLI.host": PLI_host, + } + 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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py new file mode 100644 index 00000000..6b5b24ac --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py @@ -0,0 +1,3976 @@ +# 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 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] = {} + tool = tools[tool_name] + if setting == "CompileAsWinRT": + 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. + 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 + # 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 + command[1] = '"%s"' % command[1] + 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(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: + 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. + """ + 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 = {} + # 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", []): + fd = "=".join([str(dpart) for dpart in d]) if isinstance(d, list) else 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 + excluded_idl = [i for i in sources if i.endswith(".idl")] if using_idl else [] + 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 = ( + f'mkdir {full_dst} 2>nul & cd "{_FixPath(base_dir)}" ' + f'&& xcopy /e /f /y "{outer_dir}" {full_dst}' + ) + copies.append( + ( + [src], + ["dummy_copies", dst], + cmd, + f"Copying {src} to {fixed_dst}", + ) + ) + else: + fix_dst = _FixPath(cpy["destination"]) + cmd = ( + f'mkdir "{fix_dst}" 2>nul & set ERRORLEVEL=0 & ' + f'copy /Y "{_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] = {} + 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)) + base_name = _ConfigBaseName(config_name, _ConfigPlatform(c)) + fixed_config_fullname = f"{base_name}|{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") + 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 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) + + +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]) + 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 + + +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 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 + + +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"], + } + char = " " if name in exceptions.get(tool_name, []) else ";" + 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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py new file mode 100755 index 00000000..e80b57f0 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py new file mode 100644 index 00000000..0146c499 --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py @@ -0,0 +1,2964 @@ +# 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 shutil +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") + extension = "." + extension if extension else 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", {}) + generate_compile_commands = generator_flags.get("compile_commands", False) + + # 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"}, + 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() + + if generate_compile_commands: + compile_db = GenerateCompileDBWithNinja(toplevel_build) + compile_db_file = OpenOutput( + os.path.join(toplevel_build, "compile_commands.json") + ) + compile_db_file.write(json.dumps(compile_db, indent=2)) + compile_db_file.close() + + +def GenerateCompileDBWithNinja(path, targets=["all"]): + """Generates a compile database using ninja. + + Args: + path: The build directory to generate a compile database for. + targets: Additional targets to pass to ninja. + + Returns: + List of the contents of the compile database. + """ + ninja_path = shutil.which("ninja") + if ninja_path is None: + raise Exception("ninja not found in PATH") + json_compile_db = subprocess.check_output( + [ninja_path, "-C", path] + + targets + + ["-t", "compdb", "cc", "cxx", "objc", "objcxx"] + ) + return json.loads(json_compile_db) + + +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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py new file mode 100644 index 00000000..15cddfdf --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py @@ -0,0 +1,67 @@ +#!/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. """ + +from pathlib import Path +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") + ) + + def test_GenerateCompileDBWithNinja(self): + build_dir = ( + Path(__file__).resolve().parent.parent.parent.parent / "data" / "ninja" + ) + compile_db = ninja.GenerateCompileDBWithNinja(build_dir) + assert len(compile_db) == 1 + assert compile_db[0]["directory"] == str(build_dir) + assert compile_db[0]["command"] == "cc my.in my.out" + assert compile_db[0]["file"] == "my.in" + assert compile_db[0]["output"] == "my.out" + + +if __name__ == "__main__": + unittest.main() diff --git a/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py new file mode 100644 index 00000000..1ac672c3 --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py @@ -0,0 +1,1391 @@ +# 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: + 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 + ): + bol = "" if concrete_output_index == 0 else " " + 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/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py new file mode 100644 index 00000000..49772d1f --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py new file mode 100644 index 00000000..7150269c --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py @@ -0,0 +1,3115 @@ +# 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 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 = [ + "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: + 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) + + 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( + f"{conditions_key} {cond_expr} must be followed by a dictionary, " + f"not {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( + f"{conditions_key} {cond_expr} has " + f"{len(condition) - i} unexpected trailing items" + ) + 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": Version} + 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 not in {"*", dependency_target_name} + ): + continue + dependency_target_toolset = dependency_target_dict["toolset"] + if ( + dependency_toolset not in {"*", 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 and ( + 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. + 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 + # 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:] + 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) + + # 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: + 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:] + 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"]: + configuration_dict = target_dict["configurations"][configuration] + for key in configuration_dict: + 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(): + if not key: + continue + operation = key[-1] + if operation not in {"!", "/"}: + 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/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py new file mode 100755 index 00000000..a18f72e9 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py new file mode 100755 index 00000000..59647c9a --- /dev/null +++ b/node_modules/npm/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, 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, 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, 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) + 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"] + ) + 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="") + + safeseh_default = "true" if self.GetArch(config) == "x86" else 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" + ) + + level = execution_level_map[execution_level] + inner = f""" + + + + + + +""" + 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.""" + 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", []) + ) + + 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/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py new file mode 100644 index 00000000..0e3e86c7 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py new file mode 100644 index 00000000..729cec06 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py new file mode 100755 index 00000000..171d7295 --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py @@ -0,0 +1,373 @@ +#!/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, 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/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py new file mode 100644 index 00000000..5f2c097f --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py @@ -0,0 +1,1938 @@ +# 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") + cflags.append(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") + cflags.append(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/") + + 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: + 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") + ldflags.append(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") + ldflags.append("-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"] + # Avoid quoting the space between -arch and the arch name + ldflags.append("-arch") + ldflags.append(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") + ldflags.append(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") + ldflags.append("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") + ldflags.append("_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) + l_flag = "-l" + m.group(1) if m else 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/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py new file mode 100644 index 00000000..98b02320 --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 + +"""Unit tests for the xcode_emulation.py file.""" + +from gyp.xcode_emulation import XcodeSettings +import sys +import unittest + + +class TestXcodeSettings(unittest.TestCase): + def setUp(self): + if sys.platform != "darwin": + self.skipTest("This test only runs on macOS") + + def test_GetCflags(self): + target = { + "type": "static_library", + "configurations": { + "Release": {}, + }, + } + configuration_name = "Release" + xcode_settings = XcodeSettings(target) + cflags = xcode_settings.GetCflags(configuration_name, "arm64") + + # Do not quote `-arch arm64` with spaces in one string. + self.assertEqual( + cflags, + ["-fasm-blocks", "-mpascal-strings", "-Os", "-gdwarf-2", "-arch", "arm64"], + ) + + def GypToBuildPath(self, path): + return path + + def test_GetLdflags(self): + target = { + "type": "static_library", + "configurations": { + "Release": {}, + }, + } + configuration_name = "Release" + xcode_settings = XcodeSettings(target) + ldflags = xcode_settings.GetLdflags( + configuration_name, "PRODUCT_DIR", self.GypToBuildPath, "arm64" + ) + + # Do not quote `-arch arm64` with spaces in one string. + self.assertEqual(ldflags, ["-arch", "arm64", "-LPRODUCT_DIR"]) + + +if __name__ == "__main__": + unittest.main() diff --git a/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py new file mode 100644 index 00000000..bb74eacb --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py new file mode 100644 index 00000000..33c667c2 --- /dev/null +++ b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py @@ -0,0 +1,3198 @@ +# 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 not in ("", path): + 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 and "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"] 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. + # 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, + PBXSourcesBuildPhase, + 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, 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"] in { + shared_library_type, + 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/npm/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py new file mode 100644 index 00000000..53019636 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/LICENSE b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/LICENSE new file mode 100644 index 00000000..6f62d44e --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE new file mode 100644 index 00000000..f433b1a5 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD new file mode 100644 index 00000000..42ce7b75 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/__init__.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/__init__.py new file mode 100644 index 00000000..5fd91838 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py new file mode 100644 index 00000000..6fb19b30 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py new file mode 100644 index 00000000..3705d50d --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py new file mode 100644 index 00000000..86419df9 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/_parser.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_parser.py new file mode 100644 index 00000000..4576981c --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/_structures.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_structures.py new file mode 100644 index 00000000..90a6465f --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py new file mode 100644 index 00000000..dd0d648d --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/markers.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/markers.py new file mode 100644 index 00000000..8b98fca7 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/metadata.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/metadata.py new file mode 100644 index 00000000..fb274930 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/py.typed b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/requirements.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/requirements.py new file mode 100644 index 00000000..0c00eba3 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py new file mode 100644 index 00000000..94448327 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/tags.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/tags.py new file mode 100644 index 00000000..37f33b1e --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/utils.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/utils.py new file mode 100644 index 00000000..c2c2f75a --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pylib/packaging/version.py b/node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/version.py new file mode 100644 index 00000000..5faab9bd --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/node-gyp/gyp/pyproject.toml b/node_modules/npm/node_modules/node-gyp/gyp/pyproject.toml
    new file mode 100644
    index 00000000..def9858e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/pyproject.toml
    @@ -0,0 +1,120 @@
    +[build-system]
    +requires = ["setuptools>=61.0"]
    +build-backend = "setuptools.build_meta"
    +
    +[project]
    +name = "gyp-next"
    +version = "0.18.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.8"
    +dependencies = ["packaging>=24.0", "setuptools>=69.5.1"]
    +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.8",
    +    "Programming Language :: Python :: 3.9",
    +    "Programming Language :: Python :: 3.10",
    +    "Programming Language :: Python :: 3.11",
    +]
    +
    +[project.optional-dependencies]
    +dev = ["pytest", "ruff"]
    +
    +[project.scripts]
    +gyp = "gyp:script_main"
    +
    +[project.urls]
    +"Homepage" = "https://github.com/nodejs/gyp-next"
    +
    +[tool.ruff]
    +extend-exclude = ["pylib/packaging"]
    +line-length = 88
    +target-version = "py37"
    +
    +[tool.ruff.lint]
    +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",
    +]
    +
    +[tool.ruff.lint.mccabe]
    +max-complexity = 101
    +
    +[tool.ruff.lint.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/npm/node_modules/node-gyp/gyp/release-please-config.json b/node_modules/npm/node_modules/node-gyp/gyp/release-please-config.json
    new file mode 100644
    index 00000000..b6cad32a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/gyp/release-please-config.json
    @@ -0,0 +1,11 @@
    +{
    +    "last-release-sha": "78756421b0d7bb335992a9c7d26ba3cc8b619708",
    +    "packages": {
    +        ".": {
    +          "release-type": "python",
    +          "package-name": "gyp-next",
    +          "bump-minor-pre-major": true,
    +          "include-component-in-tag": false
    +        }
    +    }
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/gyp/test_gyp.py b/node_modules/npm/node_modules/node-gyp/gyp/test_gyp.py
    new file mode 100755
    index 00000000..b7bb956b
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/lib/Find-VisualStudio.cs b/node_modules/npm/node_modules/node-gyp/lib/Find-VisualStudio.cs
    new file mode 100644
    index 00000000..d2e45a76
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/lib/build.js b/node_modules/npm/node_modules/node-gyp/lib/build.js
    new file mode 100644
    index 00000000..e1f49bb6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/build.js
    @@ -0,0 +1,227 @@
    +'use strict'
    +
    +const gracefulFs = require('graceful-fs')
    +const fs = gracefulFs.promises
    +const path = require('path')
    +const { glob } = require('glob')
    +const log = require('./log')
    +const which = require('which')
    +const win = process.platform === 'win32'
    +
    +async function build (gyp, argv) {
    +  let 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
    +    })
    +  }
    +
    +  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
    +
    +  await loadConfigGypi()
    +
    +  /**
    +   * Load the "config.gypi" file that was generated during "configure".
    +   */
    +
    +  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
    +    python = config.variables.python
    +
    +    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)
    +    log.verbose('python', python)
    +
    +    if (win) {
    +      await findSolutionFile()
    +    } else {
    +      await doWhich()
    +    }
    +  }
    +
    +  /**
    +   * On Windows, find the first build/*.sln file.
    +   */
    +
    +  async function findSolutionFile () {
    +    const files = await glob('build/*.sln')
    +    if (files.length === 0) {
    +      if (gracefulFs.existsSync('build/Makefile') || (await glob('build/*.mk')).length !== 0) {
    +        command = makeCommand
    +        await doWhich(false)
    +        return
    +      } else {
    +        throw new Error('Could not find *.sln file or Makefile. Did you run "configure"?')
    +      }
    +    }
    +    guessedSolution = files[0]
    +    log.verbose('found first Solution file', guessedSolution)
    +    await doWhich(true)
    +  }
    +
    +  /**
    +   * Uses node-which to locate the msbuild / make executable.
    +   */
    +
    +  async function doWhich (msvs) {
    +    // On Windows use msbuild provided by node-gyp configure
    +    if (msvs) {
    +      if (!config.variables.msbuild_path) {
    +        throw new Error('MSBuild is not set, please run `node-gyp configure`.')
    +      }
    +      command = config.variables.msbuild_path
    +      log.verbose('using MSBuild:', command)
    +      await doBuild(msvs)
    +      return
    +    }
    +
    +    // First make sure we have the build command in the PATH
    +    const execPath = await which(command)
    +    log.verbose('`which` succeeded for `' + command + '`', execPath)
    +    await doBuild(msvs)
    +  }
    +
    +  /**
    +   * Actually spawn the process and compile the module.
    +   */
    +
    +  async function doBuild (msvs) {
    +    // Enable Verbose build
    +    const verbose = log.logger.isVisible('verbose')
    +    let j
    +
    +    if (!msvs && verbose) {
    +      argv.push('V=1')
    +    }
    +
    +    if (msvs && !verbose) {
    +      argv.push('/clp:Verbosity=minimal')
    +    }
    +
    +    if (msvs) {
    +      // Turn off the Microsoft logo on Windows
    +      argv.push('/nologo')
    +    }
    +
    +    // Specify the build type, Release by default
    +    if (msvs) {
    +      // 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.
    +      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)
    +        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 (msvs) {
    +      // did the user specify their own .sln file?
    +      const 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
    +      buildBinsDir = path.resolve('build', 'node_gyp_bins')
    +      process.env.PATH = `${buildBinsDir}:${process.env.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`)
    +    }
    +
    +    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 })
    +      }
    +
    +      if (code !== 0) {
    +        return reject(new Error('`' + command + '` failed with exit code: ' + code))
    +      }
    +      if (signal) {
    +        return reject(new Error('`' + command + '` got signal: ' + signal))
    +      }
    +      resolve()
    +    }))
    +  }
    +}
    +
    +module.exports = build
    +module.exports.usage = 'Invokes `' + (win ? 'msbuild' : 'make') + '` and builds the module'
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/clean.js b/node_modules/npm/node_modules/node-gyp/lib/clean.js
    new file mode 100644
    index 00000000..523f8016
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/clean.js
    @@ -0,0 +1,15 @@
    +'use strict'
    +
    +const fs = require('graceful-fs').promises
    +const log = require('./log')
    +
    +async function clean (gyp, argv) {
    +  // Remove the 'build' dir
    +  const buildDir = 'build'
    +
    +  log.verbose('clean', 'removing "%s" directory', buildDir)
    +  await fs.rm(buildDir, { recursive: true, force: true })
    +}
    +
    +module.exports = clean
    +module.exports.usage = 'Removes any generated build files and the "out" dir'
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/configure.js b/node_modules/npm/node_modules/node-gyp/lib/configure.js
    new file mode 100644
    index 00000000..ee672cfb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/configure.js
    @@ -0,0 +1,328 @@
    +'use strict'
    +
    +const { promises: fs, readFileSync } = require('graceful-fs')
    +const path = require('path')
    +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 { format: msgFormat } = require('util')
    +const { findAccessibleSync } = require('./util')
    +const { findPython } = require('./find-python')
    +const { findVisualStudio } = win ? require('./find-visualstudio') : {}
    +
    +const majorRe = /^#define NODE_MAJOR_VERSION (\d+)/m
    +const minorRe = /^#define NODE_MINOR_VERSION (\d+)/m
    +const patchRe = /^#define NODE_PATCH_VERSION (\d+)/m
    +
    +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 &&
    +        process.config.variables.use_prefix_to_find_headers) {
    +      // check if the headers can be found using the prefix specified
    +      // at build time. Use them if they match the version expected
    +      const prefix = process.config.variables.node_prefix
    +      let availVersion
    +      try {
    +        const nodeVersionH = readFileSync(path.join(prefix,
    +          'include', 'node', 'node_version.h'), { encoding: 'utf8' })
    +        const major = nodeVersionH.match(majorRe)[1]
    +        const minor = nodeVersionH.match(minorRe)[1]
    +        const patch = nodeVersionH.match(patchRe)[1]
    +        availVersion = major + '.' + minor + '.' + patch
    +      } catch {}
    +      if (availVersion === release.version) {
    +        // ok version matches, use the headers
    +        gyp.opts.nodedir = prefix
    +        log.verbose('using local node headers based on prefix',
    +          'setting nodedir to ' + gyp.opts.nodedir)
    +      }
    +    }
    +
    +    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)
    +    } 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
    +        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
    +
    +      await gyp.commands.install([release.version])
    +
    +      log.verbose('get node dir', 'target node version installed:', release.versionDir)
    +      nodeDir = path.resolve(gyp.devDir, release.versionDir)
    +    }
    +
    +    return createBuildDir()
    +  }
    +
    +  async function createBuildDir () {
    +    log.verbose('build dir', 'attempting to create "build" dir: %s', buildDir)
    +
    +    const isNew = await fs.mkdir(buildDir, { recursive: true })
    +    log.verbose(
    +      'build dir', '"build" dir needed to be created?', isNew ? 'Yes' : 'No'
    +    )
    +    if (win) {
    +      let usingMakeGenerator = false
    +      for (let i = argv.length - 1; i >= 0; --i) {
    +        const arg = argv[i]
    +        if (arg === '-f' || arg === '--format') {
    +          const format = argv[i + 1]
    +          if (typeof format === 'string' && format.startsWith('make')) {
    +            usingMakeGenerator = true
    +            break
    +          }
    +        } else if (arg.startsWith('--format=make')) {
    +          usingMakeGenerator = true
    +          break
    +        }
    +      }
    +      let vsInfo = {}
    +      if (!usingMakeGenerator) {
    +        vsInfo = await findVisualStudio(release.semver, gyp.opts['msvs-version'])
    +      }
    +      return createConfigFile(vsInfo)
    +    }
    +    return createConfigFile(null)
    +  }
    +
    +  async function createConfigFile (vsInfo) {
    +    if (win) {
    +      process.env.GYP_MSVS_VERSION = Math.min(vsInfo.versionYear, 2015)
    +      process.env.GYP_MSVS_OVERRIDE_PATH = vsInfo.path
    +    }
    +    const configPath = await createConfigGypi({ gyp, buildDir, nodeDir, vsInfo, python })
    +    configs.push(configPath)
    +    return findConfigs()
    +  }
    +
    +  async function findConfigs () {
    +    const name = configNames.shift()
    +    if (!name) {
    +      return runGyp()
    +    }
    +
    +    const fullPath = path.resolve(name)
    +    log.verbose(name, 'checking for gypi file: %s', fullPath)
    +    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
    +      }
    +    }
    +
    +    return findConfigs()
    +  }
    +
    +  async function runGyp () {
    +    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.
    +    let nodeExpFile
    +    let nodeRootDir
    +    let candidates
    +    let logprefix = 'find exports file'
    +    if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') {
    +      const ext = process.platform === 'os390' ? 'x' : 'exp'
    +      nodeRootDir = findNodeDirectory()
    +
    +      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
    +        })
    +      }
    +
    +      nodeExpFile = findAccessibleSync(logprefix, nodeRootDir, candidates)
    +      if (nodeExpFile !== undefined) {
    +        log.verbose(logprefix, 'Found exports file: %s', nodeExpFile)
    +      } else {
    +        const msg = msgFormat('Could not find node.%s file in %s', ext, nodeRootDir)
    +        log.error(logprefix, 'Could not find exports file')
    +        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.
    +    let zoslibIncDir
    +    if (process.platform === 'os390') {
    +      logprefix = "find zoslib's zos-base.h:"
    +      let msg
    +      let 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)
    +        throw new Error(msg)
    +      }
    +    }
    +
    +    // this logic ported from the old `gyp_addon` python file
    +    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')
    +    }
    +
    +    let outputDir = 'build'
    +    if (win) {
    +      // Windows expects an absolute path
    +      outputDir = buildDir
    +    }
    +    const nodeGypDir = path.resolve(__dirname, '..')
    +
    +    let 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
    +    const pypath = [path.join(__dirname, '..', 'gyp', 'pylib')]
    +    if (process.env.PYTHONPATH) {
    +      pypath.push(process.env.PYTHONPATH)
    +    }
    +    process.env.PYTHONPATH = pypath.join(win ? ';' : ':')
    +
    +    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()
    +        }
    +      })
    +    })
    +  }
    +}
    +
    +module.exports = configure
    +module.exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module'
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/create-config-gypi.js b/node_modules/npm/node_modules/node-gyp/lib/create-config-gypi.js
    new file mode 100644
    index 00000000..01a820e9
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/create-config-gypi.js
    @@ -0,0 +1,153 @@
    +'use strict'
    +
    +const fs = require('graceful-fs').promises
    +const log = require('./log')
    +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.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, python }) {
    +  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
    +
    +  // set the configured Python path
    +  variables.python = python
    +
    +  // 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
    +    if (config.variables.clang === 1) {
    +      config.variables.clang = 0
    +    }
    +  }
    +
    +  // 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, 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, python })
    +
    +  // 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.writeFile(configPath, [prefix, json, ''].join('\n'))
    +
    +  return configPath
    +}
    +
    +module.exports = {
    +  createConfigGypi,
    +  parseConfigGypi,
    +  getCurrentConfigGypi
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/download.js b/node_modules/npm/node_modules/node-gyp/lib/download.js
    new file mode 100644
    index 00000000..ed0aa37f
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/lib/find-node-directory.js b/node_modules/npm/node_modules/node-gyp/lib/find-node-directory.js
    new file mode 100644
    index 00000000..8838b81d
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/find-node-directory.js
    @@ -0,0 +1,63 @@
    +'use strict'
    +
    +const path = require('path')
    +const log = require('./log')
    +
    +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
    +  const npmParentDirectory = path.join(scriptLocation, '../../../..')
    +  log.verbose('node-gyp root', 'npm_parent_directory is ' +
    +              path.basename(npmParentDirectory))
    +  let 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
    +    const nodeDir = path.dirname(processObj.execPath)
    +    const 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/npm/node_modules/node-gyp/lib/find-python.js b/node_modules/npm/node_modules/node-gyp/lib/find-python.js
    new file mode 100644
    index 00000000..a71c00c2
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/find-python.js
    @@ -0,0 +1,310 @@
    +'use strict'
    +
    +const log = require('./log')
    +const semver = require('semver')
    +const { execFile } = require('./util')
    +const win = process.platform === 'win32'
    +
    +function getOsUserInfo () {
    +  try {
    +    return require('os').userInfo().username
    +  } catch {}
    +}
    +
    +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 ['311', '310', '39', '38']) {
    +  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`
    +    )
    +  }
    +}
    +
    +class PythonFinder {
    +  static findPython = (...args) => new PythonFinder(...args).findPython()
    +
    +  log = log.withPrefix('find Python')
    +  argsExecutable = ['-c', 'import sys; sys.stdout.buffer.write(sys.executable.encode(\'utf-8\'));']
    +  argsVersion = ['-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);']
    +  semverRange = '>=3.6.0'
    +
    +  // These can be overridden for testing:
    +  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 (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.
    +  async findPython () {
    +    const SKIP = 0
    +    const FAIL = 1
    +    const toCheck = (() => {
    +      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(this.env.NODE_GYP_FORCE_PYTHON)
    +        }]
    +      }
    +
    +      const 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(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(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('python3')
    +        },
    +        {
    +          before: () => { this.addLog('checking if "python" can be used') },
    +          check: () => this.checkCommand('python')
    +        }
    +      ])
    +
    +      if (this.win) {
    +        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(location)
    +          })
    +        }
    +      }
    +
    +      return checks
    +    })()
    +
    +    for (const check of toCheck) {
    +      const before = check.before()
    +      if (before === SKIP) {
    +        continue
    +      }
    +      if (before === FAIL) {
    +        return this.fail()
    +      }
    +      try {
    +        return await check.check()
    +      } catch (err) {
    +        this.log.silly('runChecks: err = %j', (err && err.stack) || err)
    +      }
    +    }
    +
    +    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.
    +  async checkCommand (command) {
    +    let exec = command
    +    let args = this.argsExecutable
    +    let 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`)
    +    // 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}"`)
    +      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.
    +  // 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.
    +  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.
    +  async checkExecPath (execPath) {
    +    this.log.verbose(`- executing "${execPath}" to get 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
    +    try {
    +      const version = await this.run(execPath, this.argsVersion, false)
    +      this.addLog(`- version is "${version}"`)
    +
    +      const range = new semver.Range(this.semverRange)
    +      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?')
    +        throw err
    +      }
    +      if (!valid) {
    +        this.addLog(`- version is ${version} - should be ${this.semverRange}`)
    +        this.addLog('- THIS VERSION OF PYTHON IS NOT SUPPORTED')
    +        throw new Error(`Found unsupported Python version ${version}`)
    +      }
    +      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.
    +  async run (exec, args, shell) {
    +    const env = Object.assign({}, this.env)
    +    env.TERM = 'dumb'
    +    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 {
    +      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)
    +      return stdout.trim()
    +    } catch (err) {
    +      this.log.silly('execFile: threw:\n%s', err.stack)
    +      throw err
    +    }
    +  }
    +
    +  succeed (execPath, version) {
    +    this.log.info(`using Python version ${version} found at "${execPath}"`)
    +    return execPath
    +  }
    +
    +  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`)
    +    throw new Error('Could not find any Python installation to use')
    +  }
    +}
    +
    +module.exports = PythonFinder
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/find-visualstudio.js b/node_modules/npm/node_modules/node-gyp/lib/find-visualstudio.js
    new file mode 100644
    index 00000000..2dc1930f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/find-visualstudio.js
    @@ -0,0 +1,590 @@
    +'use strict'
    +
    +const log = require('./log')
    +const { existsSync } = require('fs')
    +const { win32: path } = require('path')
    +const { regSearchKeys, execFile } = require('./util')
    +
    +class VisualStudioFinder {
    +  static findVisualStudio = (...args) => new VisualStudioFinder(...args).findVisualStudio()
    +
    +  log = log.withPrefix('find VS')
    +
    +  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 (message) {
    +    this.log.verbose(message)
    +    this.errorLog.push(message)
    +  }
    +
    +  async 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')
    +    }
    +
    +    const checks = [
    +      () => this.findVisualStudio2019OrNewerFromSpecifiedLocation(),
    +      () => this.findVisualStudio2019OrNewerUsingSetupModule(),
    +      () => this.findVisualStudio2019OrNewer(),
    +      () => this.findVisualStudio2017FromSpecifiedLocation(),
    +      () => this.findVisualStudio2017UsingSetupModule(),
    +      () => this.findVisualStudio2017(),
    +      () => this.findVisualStudio2015(),
    +      () => this.findVisualStudio2013()
    +    ]
    +
    +    for (const check of checks) {
    +      const info = await check()
    +      if (info) {
    +        return this.succeed(info)
    +      }
    +    }
    +
    +    return this.fail()
    +  }
    +
    +  succeed (info) {
    +    this.log.info(`using VS${info.versionYear} (${info.version}) found at:` +
    +                  `\n"${info.path}"` +
    +                  '\nrun with --verbose for detailed information')
    +    return info
    +  }
    +
    +  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`)
    +    throw new Error('Could not find any Visual Studio installation to use')
    +  }
    +
    +  async findVisualStudio2019OrNewerFromSpecifiedLocation () {
    +    return this.findVSFromSpecifiedLocation([2019, 2022])
    +  }
    +
    +  async findVisualStudio2017FromSpecifiedLocation () {
    +    if (this.nodeSemver.major >= 22) {
    +      this.addLog(
    +        'not looking for VS2017 as it is only supported up to Node.js 21')
    +      return null
    +    }
    +    return this.findVSFromSpecifiedLocation([2017])
    +  }
    +
    +  async findVSFromSpecifiedLocation (supportedYears) {
    +    if (!this.envVcInstallDir) {
    +      return null
    +    }
    +    const info = {
    +      path: path.resolve(this.envVcInstallDir),
    +      // Assume the version specified by the user is correct.
    +      // Since Visual Studio 2015, the Developer Command Prompt sets the
    +      // VSCMD_VER environment variable which contains the version information
    +      // for Visual Studio.
    +      // https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022
    +      version: process.env.VSCMD_VER,
    +      packages: [
    +        'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
    +        // Assume MSBuild exists. It will be checked in processing.
    +        'Microsoft.VisualStudio.VC.MSBuild.Base'
    +      ]
    +    }
    +
    +    // Is there a better way to get SDK information?
    +    const envWindowsSDKVersion = process.env.WindowsSDKVersion
    +    const sdkVersionMatched = envWindowsSDKVersion?.match(/^(\d+)\.(\d+)\.(\d+)\..*/)
    +    if (sdkVersionMatched) {
    +      info.packages.push(`Microsoft.VisualStudio.Component.Windows10SDK.${sdkVersionMatched[3]}.Desktop`)
    +    }
    +    // pass for further processing
    +    return this.processData([info], supportedYears)
    +  }
    +
    +  async findVisualStudio2019OrNewerUsingSetupModule () {
    +    return this.findNewVSUsingSetupModule([2019, 2022])
    +  }
    +
    +  async findVisualStudio2017UsingSetupModule () {
    +    if (this.nodeSemver.major >= 22) {
    +      this.addLog(
    +        'not looking for VS2017 as it is only supported up to Node.js 21')
    +      return null
    +    }
    +    return this.findNewVSUsingSetupModule([2017])
    +  }
    +
    +  async findNewVSUsingSetupModule (supportedYears) {
    +    const ps = path.join(process.env.SystemRoot, 'System32',
    +      'WindowsPowerShell', 'v1.0', 'powershell.exe')
    +    const vcInstallDir = this.envVcInstallDir
    +
    +    const checkModuleArgs = [
    +      '-NoProfile',
    +      '-Command',
    +      '&{@(Get-Module -ListAvailable -Name VSSetup).Version.ToString()}'
    +    ]
    +    this.log.silly('Running', ps, checkModuleArgs)
    +    const [cErr] = await this.execFile(ps, checkModuleArgs)
    +    if (cErr) {
    +      this.addLog('VSSetup module doesn\'t seem to exist. You can install it via: "Install-Module VSSetup -Scope CurrentUser"')
    +      this.log.silly('VSSetup error = %j', cErr && (cErr.stack || cErr))
    +      return null
    +    }
    +    const filterArg = vcInstallDir !== undefined ? `| where {$_.InstallationPath -eq '${vcInstallDir}' }` : ''
    +    const psArgs = [
    +      '-NoProfile',
    +      '-Command',
    +      `&{Get-VSSetupInstance ${filterArg} | ConvertTo-Json -Depth 3}`
    +    ]
    +
    +    this.log.silly('Running', ps, psArgs)
    +    const [err, stdout, stderr] = await this.execFile(ps, psArgs)
    +    let parsedData = this.parseData(err, stdout, stderr)
    +    if (parsedData === null) {
    +      return null
    +    }
    +    this.log.silly('Parsed data', parsedData)
    +    if (!Array.isArray(parsedData)) {
    +      // if there are only 1 result, then Powershell will output non-array
    +      parsedData = [parsedData]
    +    }
    +    // normalize output
    +    parsedData = parsedData.map((info) => {
    +      info.path = info.InstallationPath
    +      info.version = `${info.InstallationVersion.Major}.${info.InstallationVersion.Minor}.${info.InstallationVersion.Build}.${info.InstallationVersion.Revision}`
    +      info.packages = info.Packages.map((p) => p.Id)
    +      return info
    +    })
    +    // pass for further processing
    +    return this.processData(parsedData, supportedYears)
    +  }
    +
    +  // Invoke the PowerShell script to get information about Visual Studio 2019
    +  // or newer installations
    +  async findVisualStudio2019OrNewer () {
    +    return this.findNewVS([2019, 2022])
    +  }
    +
    +  // Invoke the PowerShell script to get information about Visual Studio 2017
    +  async findVisualStudio2017 () {
    +    if (this.nodeSemver.major >= 22) {
    +      this.addLog(
    +        'not looking for VS2017 as it is only supported up to Node.js 21')
    +      return null
    +    }
    +    return this.findNewVS([2017])
    +  }
    +
    +  // Invoke the PowerShell script to get information about Visual Studio 2017
    +  // or newer installations
    +  async findNewVS (supportedYears) {
    +    const ps = path.join(process.env.SystemRoot, 'System32',
    +      'WindowsPowerShell', 'v1.0', 'powershell.exe')
    +    const csFile = path.join(__dirname, 'Find-VisualStudio.cs')
    +    const psArgs = [
    +      '-ExecutionPolicy',
    +      'Unrestricted',
    +      '-NoProfile',
    +      '-Command',
    +      '&{Add-Type -Path \'' + csFile + '\';' + '[VisualStudioConfiguration.Main]::PrintJson()}'
    +    ]
    +
    +    this.log.silly('Running', ps, psArgs)
    +    const [err, stdout, stderr] = await this.execFile(ps, psArgs)
    +    const parsedData = this.parseData(err, stdout, stderr, { checkIsArray: true })
    +    if (parsedData === null) {
    +      return null
    +    }
    +    return this.processData(parsedData, supportedYears)
    +  }
    +
    +  // Parse the output of the PowerShell script, make sanity checks
    +  parseData (err, stdout, stderr, sanityCheckOptions) {
    +    const defaultOptions = {
    +      checkIsArray: false
    +    }
    +
    +    // Merging provided options with the default options
    +    const sanityOptions = { ...defaultOptions, ...sanityCheckOptions }
    +
    +    this.log.silly('PS stderr = %j', stderr)
    +
    +    const failPowershell = (failureDetails) => {
    +      this.addLog(
    +        `could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details. \n
    +        Failure details: ${failureDetails}`)
    +      return null
    +    }
    +
    +    if (err) {
    +      this.log.silly('PS err = %j', err && (err.stack || err))
    +      return failPowershell(`${err}`.substring(0, 40))
    +    }
    +
    +    let vsInfo
    +    try {
    +      vsInfo = JSON.parse(stdout)
    +    } catch (e) {
    +      this.log.silly('PS stdout = %j', stdout)
    +      this.log.silly(e)
    +      return failPowershell()
    +    }
    +
    +    if (sanityOptions.checkIsArray && !Array.isArray(vsInfo)) {
    +      this.log.silly('PS stdout = %j', stdout)
    +      return failPowershell('Expected array as output of the PS script')
    +    }
    +    return vsInfo
    +  }
    +
    +  // Process parsed data containing information about VS installations
    +  // Look for the required parts, extract and output them back
    +  processData (vsInfo, supportedYears) {
    +    vsInfo = vsInfo.map((info) => {
    +      this.log.silly(`processing installation: "${info.path}"`)
    +      info.path = path.resolve(info.path)
    +      const 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
    +    // Also remove any unsupported versions
    +    vsInfo = vsInfo.filter((info) => {
    +      if (info.versionYear && supportedYears.indexOf(info.versionYear) !== -1) {
    +        return true
    +      }
    +      this.addLog(`${info.versionYear ? 'unsupported' : '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 (let 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 info
    +    }
    +
    +    this.addLog(
    +      'could not find a version of Visual Studio 2017 or newer to use')
    +    return null
    +  }
    +
    +  // Helper - process version information
    +  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)
    +    const 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 (path) {
    +    return existsSync(path)
    +  }
    +
    +  // Helper - process MSBuild information
    +  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) {
    +        if (process.arch === 'arm64' && this.msBuildPathExists(msbuildPathArm64)) {
    +          return msbuildPathArm64
    +        } else {
    +          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 (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 (info) {
    +    const win8SDK = 'Microsoft.VisualStudio.Component.Windows81SDK'
    +    const win10SDKPrefix = 'Microsoft.VisualStudio.Component.Windows10SDK.'
    +    const win11SDKPrefix = 'Microsoft.VisualStudio.Component.Windows11SDK.'
    +
    +    let 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
    +  async findVisualStudio2015 () {
    +    if (this.nodeSemver.major >= 19) {
    +      this.addLog(
    +        'not looking for VS2015 as it is only supported up to Node.js 18')
    +      return null
    +    }
    +    return this.findOldVS({
    +      version: '14.0',
    +      versionMajor: 14,
    +      versionMinor: 0,
    +      versionYear: 2015,
    +      toolset: 'v140'
    +    })
    +  }
    +
    +  // Find an installation of Visual Studio 2013 to use
    +  async findVisualStudio2013 () {
    +    if (this.nodeSemver.major >= 9) {
    +      this.addLog(
    +        'not looking for VS2013 as it is only supported up to Node.js 8')
    +      return null
    +    }
    +    return this.findOldVS({
    +      version: '12.0',
    +      versionMajor: 12,
    +      versionMinor: 0,
    +      versionYear: 2013,
    +      toolset: 'v120'
    +    })
    +  }
    +
    +  // Helper - common code for VS2013 and VS2015
    +  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}`)
    +    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']
    +
    +      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 (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
    +  }
    +
    +  async execFile (exec, args) {
    +    return await execFile(exec, args, { encoding: 'utf8' })
    +  }
    +}
    +
    +module.exports = VisualStudioFinder
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/install.js b/node_modules/npm/node_modules/node-gyp/lib/install.js
    new file mode 100644
    index 00000000..7196a316
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/install.js
    @@ -0,0 +1,415 @@
    +'use strict'
    +
    +const { createWriteStream, promises: fs } = require('graceful-fs')
    +const os = require('os')
    +const { backOff } = require('exponential-backoff')
    +const tar = require('tar')
    +const path = require('path')
    +const { Transform, promises: { pipeline } } = require('stream')
    +const crypto = require('crypto')
    +const log = require('./log')
    +const semver = require('semver')
    +const { download } = require('./download')
    +const processRelease = require('./process-release')
    +
    +const win = process.platform === 'win32'
    +
    +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') : ''
    +  // 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.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.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.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.stat(src)
    +    } catch {
    +      throw new Error(`Missing source directory for copy: ${src}`)
    +    }
    +    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))
    +      } 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.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.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.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.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 pipeline(
    +              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.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 fs.rm(tarExtractDir, { recursive: true })
    +        } 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.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 pipeline(
    +        res.body,
    +        new ShaSum((_, checksum) => {
    +          contentShasums[libPath] = checksum
    +          log.verbose('content checksum', libPath, checksum)
    +        }),
    +        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 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 gyp.commands.install([noretry].concat(argv))
    +  }
    +}
    +
    +class ShaSum extends 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()
    +  }
    +}
    +
    +module.exports = install
    +module.exports.usage = 'Install node development files for the specified node version.'
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/list.js b/node_modules/npm/node_modules/node-gyp/lib/list.js
    new file mode 100644
    index 00000000..36889ad4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/list.js
    @@ -0,0 +1,26 @@
    +'use strict'
    +
    +const fs = require('graceful-fs').promises
    +const log = require('./log')
    +
    +async function list (gyp, args) {
    +  const devDir = gyp.devDir
    +  log.verbose('list', 'using node-gyp dir:', devDir)
    +
    +  let versions = []
    +  try {
    +    const dir = await fs.readdir(devDir)
    +    if (Array.isArray(dir)) {
    +      versions = dir.filter((v) => v !== 'current')
    +    }
    +  } catch (err) {
    +    if (err && err.code !== 'ENOENT') {
    +      throw err
    +    }
    +  }
    +
    +  return versions
    +}
    +
    +module.exports = list
    +module.exports.usage = 'Prints a listing of the currently installed node development files'
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/log.js b/node_modules/npm/node_modules/node-gyp/lib/log.js
    new file mode 100644
    index 00000000..36fa2487
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/log.js
    @@ -0,0 +1,168 @@
    +'use strict'
    +
    +const { log } = require('proc-log')
    +const { format } = require('util')
    +
    +// helper to emit log messages with a predefined prefix
    +const withPrefix = (prefix) => log.LEVELS.reduce((acc, level) => {
    +  acc[level] = (...args) => log[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
    +    log.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,
    +  ...log
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js b/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js
    new file mode 100644
    index 00000000..5e25bf99
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js
    @@ -0,0 +1,188 @@
    +'use strict'
    +
    +const path = require('path')
    +const nopt = require('nopt')
    +const log = require('./log')
    +const childProcess = require('child_process')
    +const { EventEmitter } = require('events')
    +
    +const commands = [
    +  // Module build commands
    +  'build',
    +  'clean',
    +  'configure',
    +  'rebuild',
    +  // Development Header File management commands
    +  'install',
    +  'list',
    +  'remove'
    +]
    +
    +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'
    +  }
    +
    +  /**
    +   * nopt shorthands
    +   */
    +  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.
    +   */
    +  aliases = {
    +    ls: 'list',
    +    rm: 'remove'
    +  }
    +
    +  constructor (...args) {
    +    super(...args)
    +
    +    this.devDir = ''
    +
    +    this.commands = commands.reduce((acc, command) => {
    +      acc[command] = (argv) => require('./' + command)(this, argv)
    +      return acc
    +    }, {})
    +
    +    Object.defineProperty(this, 'version', {
    +      enumerable: true,
    +      get: function () { return this.package.version }
    +    })
    +  }
    +
    +  /**
    +   * 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()
    +
    +    const commands = this.todo = []
    +
    +    // 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
    +    })
    +
    +    // 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: [] })
    +      }
    +    })
    +    if (commands.length > 0) {
    +      commands[commands.length - 1].args = argv.splice(0)
    +    }
    +
    +    // 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) {
    +        // convert names like force_process_config to force-process-config
    +          if (name.includes('_')) {
    +            name = name.replace(/_/g, '-')
    +          }
    +          this.opts[name] = val
    +        }
    +      }
    +    })
    +
    +    if (this.opts.loglevel) {
    +      log.logger.level = this.opts.loglevel
    +    }
    +    log.resume()
    +  }
    +
    +  /**
    +   * 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
    +  }
    +
    +  /**
    +   * 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')
    +  }
    +}
    +
    +module.exports = () => new Gyp()
    +module.exports.Gyp = Gyp
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/process-release.js b/node_modules/npm/node_modules/node-gyp/lib/process-release.js
    new file mode 100644
    index 00000000..c9a319df
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/process-release.js
    @@ -0,0 +1,146 @@
    +/* eslint-disable n/no-deprecated-api */
    +
    +'use strict'
    +
    +const semver = require('semver')
    +const url = require('url')
    +const path = require('path')
    +const log = require('./log')
    +
    +// 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) {
    +  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 }
    +  }
    +  // flatten version into String
    +  version = versionSemver.version
    +
    +  // defaultVersion should come from process.version so ought to be valid semver
    +  const 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,
    +    semver: versionSemver,
    +    name,
    +    baseUrl,
    +    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) {
    +  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
    +    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/npm/node_modules/node-gyp/lib/rebuild.js b/node_modules/npm/node_modules/node-gyp/lib/rebuild.js
    new file mode 100644
    index 00000000..60981766
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/rebuild.js
    @@ -0,0 +1,12 @@
    +'use strict'
    +
    +async function rebuild (gyp, argv) {
    +  gyp.todo.push(
    +    { name: 'clean', args: [] }
    +    , { name: 'configure', args: argv }
    +    , { name: 'build', args: [] }
    +  )
    +}
    +
    +module.exports = rebuild
    +module.exports.usage = 'Runs "clean", "configure" and "build" all at once'
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/remove.js b/node_modules/npm/node_modules/node-gyp/lib/remove.js
    new file mode 100644
    index 00000000..7efdb01a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/remove.js
    @@ -0,0 +1,43 @@
    +'use strict'
    +
    +const fs = require('graceful-fs').promises
    +const path = require('path')
    +const log = require('./log')
    +const semver = require('semver')
    +
    +async function remove (gyp, argv) {
    +  const devDir = gyp.devDir
    +  log.verbose('remove', 'using node-gyp dir:', devDir)
    +
    +  // get the user-specified version to remove
    +  let version = argv[0] || gyp.opts.target
    +  log.verbose('remove', 'removing target version:', version)
    +
    +  if (!version) {
    +    throw new Error('You must specify a version number to remove. Ex: "' + process.version + '"')
    +  }
    +
    +  const versionSemver = semver.parse(version)
    +  if (versionSemver) {
    +    // flatten the version Array into a String
    +    version = versionSemver.version
    +  }
    +
    +  const versionPath = path.resolve(gyp.devDir, version)
    +  log.verbose('remove', 'removing development files for version:', version)
    +
    +  // first check if its even installed
    +  try {
    +    await fs.stat(versionPath)
    +  } catch (err) {
    +    if (err.code === 'ENOENT') {
    +      return 'version was already uninstalled: ' + version
    +    }
    +    throw err
    +  }
    +
    +  await fs.rm(versionPath, { recursive: true, force: true })
    +}
    +
    +module.exports = remove
    +module.exports.usage = 'Removes the node development files for the specified version'
    diff --git a/node_modules/npm/node_modules/node-gyp/lib/util.js b/node_modules/npm/node_modules/node-gyp/lib/util.js
    new file mode 100644
    index 00000000..3f6aeeb7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/lib/util.js
    @@ -0,0 +1,81 @@
    +'use strict'
    +
    +const cp = require('child_process')
    +const path = require('path')
    +const { openSync, closeSync } = require('graceful-fs')
    +const log = require('./log')
    +
    +const execFile = async (...args) => new Promise((resolve) => {
    +  const child = cp.execFile(...args, (...a) => resolve(a))
    +  child.stdin.end()
    +})
    +
    +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 [err, stdout, stderr] = await execFile(reg, regArgs, { encoding: 'utf8' })
    +
    +  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
    +    }
    +  }
    +}
    +
    +/**
    + * 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
    +  }
    +
    +  return undefined
    +}
    +
    +module.exports = {
    +  execFile,
    +  regGetValue,
    +  regSearchKeys,
    +  findAccessibleSync
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh b/node_modules/npm/node_modules/node-gyp/macOS_Catalina_acid_test.sh
    new file mode 100644
    index 00000000..e1e98941
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/node-gyp/node_modules/chownr/LICENSE.md b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/LICENSE.md
    new file mode 100644
    index 00000000..881248b6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/LICENSE.md
    @@ -0,0 +1,63 @@
    +All packages under `src/` are licensed according to the terms in
    +their respective `LICENSE` or `LICENSE.md` files.
    +
    +The remainder of this project is licensed under the Blue Oak
    +Model License, as follows:
    +
    +-----
    +
    +# Blue Oak Model License
    +
    +Version 1.0.0
    +
    +## Purpose
    +
    +This license gives everyone as much permission to work with
    +this software as possible, while protecting contributors
    +from liability.
    +
    +## Acceptance
    +
    +In order to receive this license, you must agree to its
    +rules.  The rules of this license are both obligations
    +under that agreement and conditions to your license.
    +You must not do anything with this software that triggers
    +a rule that you cannot or will not follow.
    +
    +## Copyright
    +
    +Each contributor licenses you to do everything with this
    +software that would otherwise infringe that contributor's
    +copyright in it.
    +
    +## Notices
    +
    +You must ensure that everyone who gets a copy of
    +any part of this software from you, with or without
    +changes, also gets the text of this license or a link to
    +.
    +
    +## Excuse
    +
    +If anyone notifies you in writing that you have not
    +complied with [Notices](#notices), you can keep your
    +license by taking all practical steps to comply within 30
    +days after the notice.  If you do not do so, your license
    +ends immediately.
    +
    +## Patent
    +
    +Each contributor licenses you to do everything with this
    +software that would otherwise infringe any patent claims
    +they can license or become able to license.
    +
    +## Reliability
    +
    +No contributor can revoke this license.
    +
    +## No Liability
    +
    +***As far as the law allows, this software comes as is,
    +without any warranty or condition, and no contributor
    +will be liable to anyone for any damages related to this
    +software or this license, under any kind of legal claim.***
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/commonjs/index.js b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/commonjs/index.js
    new file mode 100644
    index 00000000..6a7b68d5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/commonjs/index.js
    @@ -0,0 +1,93 @@
    +"use strict";
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.chownrSync = exports.chownr = void 0;
    +const node_fs_1 = __importDefault(require("node:fs"));
    +const node_path_1 = __importDefault(require("node:path"));
    +const lchownSync = (path, uid, gid) => {
    +    try {
    +        return node_fs_1.default.lchownSync(path, uid, gid);
    +    }
    +    catch (er) {
    +        if (er?.code !== 'ENOENT')
    +            throw er;
    +    }
    +};
    +const chown = (cpath, uid, gid, cb) => {
    +    node_fs_1.default.lchown(cpath, uid, gid, er => {
    +        // Skip ENOENT error
    +        cb(er && er?.code !== 'ENOENT' ? er : null);
    +    });
    +};
    +const chownrKid = (p, child, uid, gid, cb) => {
    +    if (child.isDirectory()) {
    +        (0, exports.chownr)(node_path_1.default.resolve(p, child.name), uid, gid, (er) => {
    +            if (er)
    +                return cb(er);
    +            const cpath = node_path_1.default.resolve(p, child.name);
    +            chown(cpath, uid, gid, cb);
    +        });
    +    }
    +    else {
    +        const cpath = node_path_1.default.resolve(p, child.name);
    +        chown(cpath, uid, gid, cb);
    +    }
    +};
    +const chownr = (p, uid, gid, cb) => {
    +    node_fs_1.default.readdir(p, { withFileTypes: true }, (er, children) => {
    +        // any error other than ENOTDIR or ENOTSUP means it's not readable,
    +        // or doesn't exist.  give up.
    +        if (er) {
    +            if (er.code === 'ENOENT')
    +                return cb();
    +            else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')
    +                return cb(er);
    +        }
    +        if (er || !children.length)
    +            return chown(p, uid, gid, cb);
    +        let len = children.length;
    +        let errState = null;
    +        const then = (er) => {
    +            /* c8 ignore start */
    +            if (errState)
    +                return;
    +            /* c8 ignore stop */
    +            if (er)
    +                return cb((errState = er));
    +            if (--len === 0)
    +                return chown(p, uid, gid, cb);
    +        };
    +        for (const child of children) {
    +            chownrKid(p, child, uid, gid, then);
    +        }
    +    });
    +};
    +exports.chownr = chownr;
    +const chownrKidSync = (p, child, uid, gid) => {
    +    if (child.isDirectory())
    +        (0, exports.chownrSync)(node_path_1.default.resolve(p, child.name), uid, gid);
    +    lchownSync(node_path_1.default.resolve(p, child.name), uid, gid);
    +};
    +const chownrSync = (p, uid, gid) => {
    +    let children;
    +    try {
    +        children = node_fs_1.default.readdirSync(p, { withFileTypes: true });
    +    }
    +    catch (er) {
    +        const e = er;
    +        if (e?.code === 'ENOENT')
    +            return;
    +        else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP')
    +            return lchownSync(p, uid, gid);
    +        else
    +            throw e;
    +    }
    +    for (const child of children) {
    +        chownrKidSync(p, child, uid, gid);
    +    }
    +    return lchownSync(p, uid, gid);
    +};
    +exports.chownrSync = chownrSync;
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/commonjs/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/esm/index.js b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/esm/index.js
    new file mode 100644
    index 00000000..5c281529
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/esm/index.js
    @@ -0,0 +1,85 @@
    +import fs from 'node:fs';
    +import path from 'node:path';
    +const lchownSync = (path, uid, gid) => {
    +    try {
    +        return fs.lchownSync(path, uid, gid);
    +    }
    +    catch (er) {
    +        if (er?.code !== 'ENOENT')
    +            throw er;
    +    }
    +};
    +const chown = (cpath, uid, gid, cb) => {
    +    fs.lchown(cpath, uid, gid, er => {
    +        // Skip ENOENT error
    +        cb(er && er?.code !== 'ENOENT' ? er : null);
    +    });
    +};
    +const chownrKid = (p, child, uid, gid, cb) => {
    +    if (child.isDirectory()) {
    +        chownr(path.resolve(p, child.name), uid, gid, (er) => {
    +            if (er)
    +                return cb(er);
    +            const cpath = path.resolve(p, child.name);
    +            chown(cpath, uid, gid, cb);
    +        });
    +    }
    +    else {
    +        const cpath = path.resolve(p, child.name);
    +        chown(cpath, uid, gid, cb);
    +    }
    +};
    +export const chownr = (p, uid, gid, cb) => {
    +    fs.readdir(p, { withFileTypes: true }, (er, children) => {
    +        // any error other than ENOTDIR or ENOTSUP means it's not readable,
    +        // or doesn't exist.  give up.
    +        if (er) {
    +            if (er.code === 'ENOENT')
    +                return cb();
    +            else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')
    +                return cb(er);
    +        }
    +        if (er || !children.length)
    +            return chown(p, uid, gid, cb);
    +        let len = children.length;
    +        let errState = null;
    +        const then = (er) => {
    +            /* c8 ignore start */
    +            if (errState)
    +                return;
    +            /* c8 ignore stop */
    +            if (er)
    +                return cb((errState = er));
    +            if (--len === 0)
    +                return chown(p, uid, gid, cb);
    +        };
    +        for (const child of children) {
    +            chownrKid(p, child, uid, gid, then);
    +        }
    +    });
    +};
    +const chownrKidSync = (p, child, uid, gid) => {
    +    if (child.isDirectory())
    +        chownrSync(path.resolve(p, child.name), uid, gid);
    +    lchownSync(path.resolve(p, child.name), uid, gid);
    +};
    +export const chownrSync = (p, uid, gid) => {
    +    let children;
    +    try {
    +        children = fs.readdirSync(p, { withFileTypes: true });
    +    }
    +    catch (er) {
    +        const e = er;
    +        if (e?.code === 'ENOENT')
    +            return;
    +        else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP')
    +            return lchownSync(p, uid, gid);
    +        else
    +            throw e;
    +    }
    +    for (const child of children) {
    +        chownrKidSync(p, child, uid, gid);
    +    }
    +    return lchownSync(p, uid, gid);
    +};
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/esm/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/chownr/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/package.json
    new file mode 100644
    index 00000000..09aa6b2e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/chownr/package.json
    @@ -0,0 +1,69 @@
    +{
    +  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
    +  "name": "chownr",
    +  "description": "like `chown -R`",
    +  "version": "3.0.0",
    +  "repository": {
    +    "type": "git",
    +    "url": "git://github.com/isaacs/chownr.git"
    +  },
    +  "files": [
    +    "dist"
    +  ],
    +  "devDependencies": {
    +    "@types/node": "^20.12.5",
    +    "mkdirp": "^3.0.1",
    +    "prettier": "^3.2.5",
    +    "rimraf": "^5.0.5",
    +    "tap": "^18.7.2",
    +    "tshy": "^1.13.1",
    +    "typedoc": "^0.25.12"
    +  },
    +  "scripts": {
    +    "prepare": "tshy",
    +    "pretest": "npm run prepare",
    +    "test": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "prepublishOnly": "git push origin --follow-tags",
    +    "format": "prettier --write . --loglevel warn",
    +    "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
    +  },
    +  "license": "BlueOak-1.0.0",
    +  "engines": {
    +    "node": ">=18"
    +  },
    +  "tshy": {
    +    "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"
    +      }
    +    }
    +  },
    +  "main": "./dist/commonjs/index.js",
    +  "types": "./dist/commonjs/index.d.ts",
    +  "type": "module",
    +  "prettier": {
    +    "semi": false,
    +    "printWidth": 75,
    +    "tabWidth": 2,
    +    "useTabs": false,
    +    "singleQuote": true,
    +    "jsxSingleQuote": false,
    +    "bracketSameLine": true,
    +    "arrowParens": "avoid",
    +    "endOfLine": "lf"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/LICENSE b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/LICENSE
    new file mode 100644
    index 00000000..49f7efe4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/LICENSE
    @@ -0,0 +1,26 @@
    +Minizlib was created by Isaac Z. Schlueter.
    +It is a derivative work of the Node.js project.
    +
    +"""
    +Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors
    +Copyright (c) 2017-2023 Node.js contributors. All rights reserved.
    +Copyright (c) 2017-2023 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/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/constants.js b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/constants.js
    new file mode 100644
    index 00000000..dfc2c195
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/constants.js
    @@ -0,0 +1,123 @@
    +"use strict";
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.constants = void 0;
    +// Update with any zlib constants that are added or changed in the future.
    +// Node v6 didn't export this, so we just hard code the version and rely
    +// on all the other hard-coded values from zlib v4736.  When node v6
    +// support drops, we can just export the realZlibConstants object.
    +const zlib_1 = __importDefault(require("zlib"));
    +/* c8 ignore start */
    +const realZlibConstants = zlib_1.default.constants || { ZLIB_VERNUM: 4736 };
    +/* c8 ignore stop */
    +exports.constants = Object.freeze(Object.assign(Object.create(null), {
    +    Z_NO_FLUSH: 0,
    +    Z_PARTIAL_FLUSH: 1,
    +    Z_SYNC_FLUSH: 2,
    +    Z_FULL_FLUSH: 3,
    +    Z_FINISH: 4,
    +    Z_BLOCK: 5,
    +    Z_OK: 0,
    +    Z_STREAM_END: 1,
    +    Z_NEED_DICT: 2,
    +    Z_ERRNO: -1,
    +    Z_STREAM_ERROR: -2,
    +    Z_DATA_ERROR: -3,
    +    Z_MEM_ERROR: -4,
    +    Z_BUF_ERROR: -5,
    +    Z_VERSION_ERROR: -6,
    +    Z_NO_COMPRESSION: 0,
    +    Z_BEST_SPEED: 1,
    +    Z_BEST_COMPRESSION: 9,
    +    Z_DEFAULT_COMPRESSION: -1,
    +    Z_FILTERED: 1,
    +    Z_HUFFMAN_ONLY: 2,
    +    Z_RLE: 3,
    +    Z_FIXED: 4,
    +    Z_DEFAULT_STRATEGY: 0,
    +    DEFLATE: 1,
    +    INFLATE: 2,
    +    GZIP: 3,
    +    GUNZIP: 4,
    +    DEFLATERAW: 5,
    +    INFLATERAW: 6,
    +    UNZIP: 7,
    +    BROTLI_DECODE: 8,
    +    BROTLI_ENCODE: 9,
    +    Z_MIN_WINDOWBITS: 8,
    +    Z_MAX_WINDOWBITS: 15,
    +    Z_DEFAULT_WINDOWBITS: 15,
    +    Z_MIN_CHUNK: 64,
    +    Z_MAX_CHUNK: Infinity,
    +    Z_DEFAULT_CHUNK: 16384,
    +    Z_MIN_MEMLEVEL: 1,
    +    Z_MAX_MEMLEVEL: 9,
    +    Z_DEFAULT_MEMLEVEL: 8,
    +    Z_MIN_LEVEL: -1,
    +    Z_MAX_LEVEL: 9,
    +    Z_DEFAULT_LEVEL: -1,
    +    BROTLI_OPERATION_PROCESS: 0,
    +    BROTLI_OPERATION_FLUSH: 1,
    +    BROTLI_OPERATION_FINISH: 2,
    +    BROTLI_OPERATION_EMIT_METADATA: 3,
    +    BROTLI_MODE_GENERIC: 0,
    +    BROTLI_MODE_TEXT: 1,
    +    BROTLI_MODE_FONT: 2,
    +    BROTLI_DEFAULT_MODE: 0,
    +    BROTLI_MIN_QUALITY: 0,
    +    BROTLI_MAX_QUALITY: 11,
    +    BROTLI_DEFAULT_QUALITY: 11,
    +    BROTLI_MIN_WINDOW_BITS: 10,
    +    BROTLI_MAX_WINDOW_BITS: 24,
    +    BROTLI_LARGE_MAX_WINDOW_BITS: 30,
    +    BROTLI_DEFAULT_WINDOW: 22,
    +    BROTLI_MIN_INPUT_BLOCK_BITS: 16,
    +    BROTLI_MAX_INPUT_BLOCK_BITS: 24,
    +    BROTLI_PARAM_MODE: 0,
    +    BROTLI_PARAM_QUALITY: 1,
    +    BROTLI_PARAM_LGWIN: 2,
    +    BROTLI_PARAM_LGBLOCK: 3,
    +    BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
    +    BROTLI_PARAM_SIZE_HINT: 5,
    +    BROTLI_PARAM_LARGE_WINDOW: 6,
    +    BROTLI_PARAM_NPOSTFIX: 7,
    +    BROTLI_PARAM_NDIRECT: 8,
    +    BROTLI_DECODER_RESULT_ERROR: 0,
    +    BROTLI_DECODER_RESULT_SUCCESS: 1,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
    +    BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
    +    BROTLI_DECODER_NO_ERROR: 0,
    +    BROTLI_DECODER_SUCCESS: 1,
    +    BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
    +    BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
    +    BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
    +    BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
    +    BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
    +    BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
    +    BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
    +    BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
    +    BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
    +    BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
    +    BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
    +    BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
    +    BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
    +    BROTLI_DECODER_ERROR_UNREACHABLE: -31,
    +}, realZlibConstants));
    +//# sourceMappingURL=constants.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/index.js b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/index.js
    new file mode 100644
    index 00000000..ad65eef0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/index.js
    @@ -0,0 +1,352 @@
    +"use strict";
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.BrotliDecompress = exports.BrotliCompress = exports.Brotli = exports.Unzip = exports.InflateRaw = exports.DeflateRaw = exports.Gunzip = exports.Gzip = exports.Inflate = exports.Deflate = exports.Zlib = exports.ZlibError = exports.constants = void 0;
    +const assert_1 = __importDefault(require("assert"));
    +const buffer_1 = require("buffer");
    +const minipass_1 = require("minipass");
    +const zlib_1 = __importDefault(require("zlib"));
    +const constants_js_1 = require("./constants.js");
    +var constants_js_2 = require("./constants.js");
    +Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return constants_js_2.constants; } });
    +const OriginalBufferConcat = buffer_1.Buffer.concat;
    +const _superWrite = Symbol('_superWrite');
    +class ZlibError extends Error {
    +    code;
    +    errno;
    +    constructor(err) {
    +        super('zlib: ' + err.message);
    +        this.code = err.code;
    +        this.errno = err.errno;
    +        /* c8 ignore next */
    +        if (!this.code)
    +            this.code = 'ZLIB_ERROR';
    +        this.message = 'zlib: ' + err.message;
    +        Error.captureStackTrace(this, this.constructor);
    +    }
    +    get name() {
    +        return 'ZlibError';
    +    }
    +}
    +exports.ZlibError = ZlibError;
    +// the Zlib class they all inherit from
    +// This thing manages the queue of requests, and returns
    +// true or false if there is anything in the queue when
    +// you call the .write() method.
    +const _flushFlag = Symbol('flushFlag');
    +class ZlibBase extends minipass_1.Minipass {
    +    #sawError = false;
    +    #ended = false;
    +    #flushFlag;
    +    #finishFlushFlag;
    +    #fullFlushFlag;
    +    #handle;
    +    #onError;
    +    get sawError() {
    +        return this.#sawError;
    +    }
    +    get handle() {
    +        return this.#handle;
    +    }
    +    /* c8 ignore start */
    +    get flushFlag() {
    +        return this.#flushFlag;
    +    }
    +    /* c8 ignore stop */
    +    constructor(opts, mode) {
    +        if (!opts || typeof opts !== 'object')
    +            throw new TypeError('invalid options for ZlibBase constructor');
    +        //@ts-ignore
    +        super(opts);
    +        /* c8 ignore start */
    +        this.#flushFlag = opts.flush ?? 0;
    +        this.#finishFlushFlag = opts.finishFlush ?? 0;
    +        this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
    +        /* c8 ignore stop */
    +        // this will throw if any options are invalid for the class selected
    +        try {
    +            // @types/node doesn't know that it exports the classes, but they're there
    +            //@ts-ignore
    +            this.#handle = new zlib_1.default[mode](opts);
    +        }
    +        catch (er) {
    +            // make sure that all errors get decorated properly
    +            throw new ZlibError(er);
    +        }
    +        this.#onError = err => {
    +            // no sense raising multiple errors, since we abort on the first one.
    +            if (this.#sawError)
    +                return;
    +            this.#sawError = true;
    +            // there is no way to cleanly recover.
    +            // continuing only obscures problems.
    +            this.close();
    +            this.emit('error', err);
    +        };
    +        this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
    +        this.once('end', () => this.close);
    +    }
    +    close() {
    +        if (this.#handle) {
    +            this.#handle.close();
    +            this.#handle = undefined;
    +            this.emit('close');
    +        }
    +    }
    +    reset() {
    +        if (!this.#sawError) {
    +            (0, assert_1.default)(this.#handle, 'zlib binding closed');
    +            //@ts-ignore
    +            return this.#handle.reset?.();
    +        }
    +    }
    +    flush(flushFlag) {
    +        if (this.ended)
    +            return;
    +        if (typeof flushFlag !== 'number')
    +            flushFlag = this.#fullFlushFlag;
    +        this.write(Object.assign(buffer_1.Buffer.alloc(0), { [_flushFlag]: flushFlag }));
    +    }
    +    end(chunk, encoding, cb) {
    +        /* c8 ignore start */
    +        if (typeof chunk === 'function') {
    +            cb = chunk;
    +            encoding = undefined;
    +            chunk = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        /* c8 ignore stop */
    +        if (chunk) {
    +            if (encoding)
    +                this.write(chunk, encoding);
    +            else
    +                this.write(chunk);
    +        }
    +        this.flush(this.#finishFlushFlag);
    +        this.#ended = true;
    +        return super.end(cb);
    +    }
    +    get ended() {
    +        return this.#ended;
    +    }
    +    // overridden in the gzip classes to do portable writes
    +    [_superWrite](data) {
    +        return super.write(data);
    +    }
    +    write(chunk, encoding, cb) {
    +        // process the chunk using the sync process
    +        // then super.write() all the outputted chunks
    +        if (typeof encoding === 'function')
    +            (cb = encoding), (encoding = 'utf8');
    +        if (typeof chunk === 'string')
    +            chunk = buffer_1.Buffer.from(chunk, encoding);
    +        if (this.#sawError)
    +            return;
    +        (0, assert_1.default)(this.#handle, 'zlib binding closed');
    +        // _processChunk tries to .close() the native handle after it's done, so we
    +        // intercept that by temporarily making it a no-op.
    +        // diving into the node:zlib internals a bit here
    +        const nativeHandle = this.#handle
    +            ._handle;
    +        const originalNativeClose = nativeHandle.close;
    +        nativeHandle.close = () => { };
    +        const originalClose = this.#handle.close;
    +        this.#handle.close = () => { };
    +        // It also calls `Buffer.concat()` at the end, which may be convenient
    +        // for some, but which we are not interested in as it slows us down.
    +        buffer_1.Buffer.concat = args => args;
    +        let result = undefined;
    +        try {
    +            const flushFlag = typeof chunk[_flushFlag] === 'number'
    +                ? chunk[_flushFlag]
    +                : this.#flushFlag;
    +            result = this.#handle._processChunk(chunk, flushFlag);
    +            // if we don't throw, reset it back how it was
    +            buffer_1.Buffer.concat = OriginalBufferConcat;
    +        }
    +        catch (err) {
    +            // or if we do, put Buffer.concat() back before we emit error
    +            // Error events call into user code, which may call Buffer.concat()
    +            buffer_1.Buffer.concat = OriginalBufferConcat;
    +            this.#onError(new ZlibError(err));
    +        }
    +        finally {
    +            if (this.#handle) {
    +                // Core zlib resets `_handle` to null after attempting to close the
    +                // native handle. Our no-op handler prevented actual closure, but we
    +                // need to restore the `._handle` property.
    +                ;
    +                this.#handle._handle =
    +                    nativeHandle;
    +                nativeHandle.close = originalNativeClose;
    +                this.#handle.close = originalClose;
    +                // `_processChunk()` adds an 'error' listener. If we don't remove it
    +                // after each call, these handlers start piling up.
    +                this.#handle.removeAllListeners('error');
    +                // make sure OUR error listener is still attached tho
    +            }
    +        }
    +        if (this.#handle)
    +            this.#handle.on('error', er => this.#onError(new ZlibError(er)));
    +        let writeReturn;
    +        if (result) {
    +            if (Array.isArray(result) && result.length > 0) {
    +                const r = result[0];
    +                // The first buffer is always `handle._outBuffer`, which would be
    +                // re-used for later invocations; so, we always have to copy that one.
    +                writeReturn = this[_superWrite](buffer_1.Buffer.from(r));
    +                for (let i = 1; i < result.length; i++) {
    +                    writeReturn = this[_superWrite](result[i]);
    +                }
    +            }
    +            else {
    +                // either a single Buffer or an empty array
    +                writeReturn = this[_superWrite](buffer_1.Buffer.from(result));
    +            }
    +        }
    +        if (cb)
    +            cb();
    +        return writeReturn;
    +    }
    +}
    +class Zlib extends ZlibBase {
    +    #level;
    +    #strategy;
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants_js_1.constants.Z_NO_FLUSH;
    +        opts.finishFlush = opts.finishFlush || constants_js_1.constants.Z_FINISH;
    +        opts.fullFlushFlag = constants_js_1.constants.Z_FULL_FLUSH;
    +        super(opts, mode);
    +        this.#level = opts.level;
    +        this.#strategy = opts.strategy;
    +    }
    +    params(level, strategy) {
    +        if (this.sawError)
    +            return;
    +        if (!this.handle)
    +            throw new Error('cannot switch params when binding is closed');
    +        // no way to test this without also not supporting params at all
    +        /* c8 ignore start */
    +        if (!this.handle.params)
    +            throw new Error('not supported in this implementation');
    +        /* c8 ignore stop */
    +        if (this.#level !== level || this.#strategy !== strategy) {
    +            this.flush(constants_js_1.constants.Z_SYNC_FLUSH);
    +            (0, assert_1.default)(this.handle, 'zlib binding closed');
    +            // .params() calls .flush(), but the latter is always async in the
    +            // core zlib. We override .flush() temporarily to intercept that and
    +            // flush synchronously.
    +            const origFlush = this.handle.flush;
    +            this.handle.flush = (flushFlag, cb) => {
    +                /* c8 ignore start */
    +                if (typeof flushFlag === 'function') {
    +                    cb = flushFlag;
    +                    flushFlag = this.flushFlag;
    +                }
    +                /* c8 ignore stop */
    +                this.flush(flushFlag);
    +                cb?.();
    +            };
    +            try {
    +                ;
    +                this.handle.params(level, strategy);
    +            }
    +            finally {
    +                this.handle.flush = origFlush;
    +            }
    +            /* c8 ignore start */
    +            if (this.handle) {
    +                this.#level = level;
    +                this.#strategy = strategy;
    +            }
    +            /* c8 ignore stop */
    +        }
    +    }
    +}
    +exports.Zlib = Zlib;
    +// minimal 2-byte header
    +class Deflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Deflate');
    +    }
    +}
    +exports.Deflate = Deflate;
    +class Inflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Inflate');
    +    }
    +}
    +exports.Inflate = Inflate;
    +class Gzip extends Zlib {
    +    #portable;
    +    constructor(opts) {
    +        super(opts, 'Gzip');
    +        this.#portable = opts && !!opts.portable;
    +    }
    +    [_superWrite](data) {
    +        if (!this.#portable)
    +            return super[_superWrite](data);
    +        // we'll always get the header emitted in one first chunk
    +        // overwrite the OS indicator byte with 0xFF
    +        this.#portable = false;
    +        data[9] = 255;
    +        return super[_superWrite](data);
    +    }
    +}
    +exports.Gzip = Gzip;
    +class Gunzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Gunzip');
    +    }
    +}
    +exports.Gunzip = Gunzip;
    +// raw - no header
    +class DeflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'DeflateRaw');
    +    }
    +}
    +exports.DeflateRaw = DeflateRaw;
    +class InflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'InflateRaw');
    +    }
    +}
    +exports.InflateRaw = InflateRaw;
    +// auto-detect header.
    +class Unzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Unzip');
    +    }
    +}
    +exports.Unzip = Unzip;
    +class Brotli extends ZlibBase {
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants_js_1.constants.BROTLI_OPERATION_PROCESS;
    +        opts.finishFlush =
    +            opts.finishFlush || constants_js_1.constants.BROTLI_OPERATION_FINISH;
    +        opts.fullFlushFlag = constants_js_1.constants.BROTLI_OPERATION_FLUSH;
    +        super(opts, mode);
    +    }
    +}
    +exports.Brotli = Brotli;
    +class BrotliCompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliCompress');
    +    }
    +}
    +exports.BrotliCompress = BrotliCompress;
    +class BrotliDecompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliDecompress');
    +    }
    +}
    +exports.BrotliDecompress = BrotliDecompress;
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/constants.js b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/constants.js
    new file mode 100644
    index 00000000..7faf40be
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/constants.js
    @@ -0,0 +1,117 @@
    +// Update with any zlib constants that are added or changed in the future.
    +// Node v6 didn't export this, so we just hard code the version and rely
    +// on all the other hard-coded values from zlib v4736.  When node v6
    +// support drops, we can just export the realZlibConstants object.
    +import realZlib from 'zlib';
    +/* c8 ignore start */
    +const realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 };
    +/* c8 ignore stop */
    +export const constants = Object.freeze(Object.assign(Object.create(null), {
    +    Z_NO_FLUSH: 0,
    +    Z_PARTIAL_FLUSH: 1,
    +    Z_SYNC_FLUSH: 2,
    +    Z_FULL_FLUSH: 3,
    +    Z_FINISH: 4,
    +    Z_BLOCK: 5,
    +    Z_OK: 0,
    +    Z_STREAM_END: 1,
    +    Z_NEED_DICT: 2,
    +    Z_ERRNO: -1,
    +    Z_STREAM_ERROR: -2,
    +    Z_DATA_ERROR: -3,
    +    Z_MEM_ERROR: -4,
    +    Z_BUF_ERROR: -5,
    +    Z_VERSION_ERROR: -6,
    +    Z_NO_COMPRESSION: 0,
    +    Z_BEST_SPEED: 1,
    +    Z_BEST_COMPRESSION: 9,
    +    Z_DEFAULT_COMPRESSION: -1,
    +    Z_FILTERED: 1,
    +    Z_HUFFMAN_ONLY: 2,
    +    Z_RLE: 3,
    +    Z_FIXED: 4,
    +    Z_DEFAULT_STRATEGY: 0,
    +    DEFLATE: 1,
    +    INFLATE: 2,
    +    GZIP: 3,
    +    GUNZIP: 4,
    +    DEFLATERAW: 5,
    +    INFLATERAW: 6,
    +    UNZIP: 7,
    +    BROTLI_DECODE: 8,
    +    BROTLI_ENCODE: 9,
    +    Z_MIN_WINDOWBITS: 8,
    +    Z_MAX_WINDOWBITS: 15,
    +    Z_DEFAULT_WINDOWBITS: 15,
    +    Z_MIN_CHUNK: 64,
    +    Z_MAX_CHUNK: Infinity,
    +    Z_DEFAULT_CHUNK: 16384,
    +    Z_MIN_MEMLEVEL: 1,
    +    Z_MAX_MEMLEVEL: 9,
    +    Z_DEFAULT_MEMLEVEL: 8,
    +    Z_MIN_LEVEL: -1,
    +    Z_MAX_LEVEL: 9,
    +    Z_DEFAULT_LEVEL: -1,
    +    BROTLI_OPERATION_PROCESS: 0,
    +    BROTLI_OPERATION_FLUSH: 1,
    +    BROTLI_OPERATION_FINISH: 2,
    +    BROTLI_OPERATION_EMIT_METADATA: 3,
    +    BROTLI_MODE_GENERIC: 0,
    +    BROTLI_MODE_TEXT: 1,
    +    BROTLI_MODE_FONT: 2,
    +    BROTLI_DEFAULT_MODE: 0,
    +    BROTLI_MIN_QUALITY: 0,
    +    BROTLI_MAX_QUALITY: 11,
    +    BROTLI_DEFAULT_QUALITY: 11,
    +    BROTLI_MIN_WINDOW_BITS: 10,
    +    BROTLI_MAX_WINDOW_BITS: 24,
    +    BROTLI_LARGE_MAX_WINDOW_BITS: 30,
    +    BROTLI_DEFAULT_WINDOW: 22,
    +    BROTLI_MIN_INPUT_BLOCK_BITS: 16,
    +    BROTLI_MAX_INPUT_BLOCK_BITS: 24,
    +    BROTLI_PARAM_MODE: 0,
    +    BROTLI_PARAM_QUALITY: 1,
    +    BROTLI_PARAM_LGWIN: 2,
    +    BROTLI_PARAM_LGBLOCK: 3,
    +    BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
    +    BROTLI_PARAM_SIZE_HINT: 5,
    +    BROTLI_PARAM_LARGE_WINDOW: 6,
    +    BROTLI_PARAM_NPOSTFIX: 7,
    +    BROTLI_PARAM_NDIRECT: 8,
    +    BROTLI_DECODER_RESULT_ERROR: 0,
    +    BROTLI_DECODER_RESULT_SUCCESS: 1,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
    +    BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
    +    BROTLI_DECODER_NO_ERROR: 0,
    +    BROTLI_DECODER_SUCCESS: 1,
    +    BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
    +    BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
    +    BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
    +    BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
    +    BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
    +    BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
    +    BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
    +    BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
    +    BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
    +    BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
    +    BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
    +    BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
    +    BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
    +    BROTLI_DECODER_ERROR_UNREACHABLE: -31,
    +}, realZlibConstants));
    +//# sourceMappingURL=constants.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/index.js b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/index.js
    new file mode 100644
    index 00000000..a6269b50
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/index.js
    @@ -0,0 +1,333 @@
    +import assert from 'assert';
    +import { Buffer } from 'buffer';
    +import { Minipass } from 'minipass';
    +import realZlib from 'zlib';
    +import { constants } from './constants.js';
    +export { constants } from './constants.js';
    +const OriginalBufferConcat = Buffer.concat;
    +const _superWrite = Symbol('_superWrite');
    +export class ZlibError extends Error {
    +    code;
    +    errno;
    +    constructor(err) {
    +        super('zlib: ' + err.message);
    +        this.code = err.code;
    +        this.errno = err.errno;
    +        /* c8 ignore next */
    +        if (!this.code)
    +            this.code = 'ZLIB_ERROR';
    +        this.message = 'zlib: ' + err.message;
    +        Error.captureStackTrace(this, this.constructor);
    +    }
    +    get name() {
    +        return 'ZlibError';
    +    }
    +}
    +// the Zlib class they all inherit from
    +// This thing manages the queue of requests, and returns
    +// true or false if there is anything in the queue when
    +// you call the .write() method.
    +const _flushFlag = Symbol('flushFlag');
    +class ZlibBase extends Minipass {
    +    #sawError = false;
    +    #ended = false;
    +    #flushFlag;
    +    #finishFlushFlag;
    +    #fullFlushFlag;
    +    #handle;
    +    #onError;
    +    get sawError() {
    +        return this.#sawError;
    +    }
    +    get handle() {
    +        return this.#handle;
    +    }
    +    /* c8 ignore start */
    +    get flushFlag() {
    +        return this.#flushFlag;
    +    }
    +    /* c8 ignore stop */
    +    constructor(opts, mode) {
    +        if (!opts || typeof opts !== 'object')
    +            throw new TypeError('invalid options for ZlibBase constructor');
    +        //@ts-ignore
    +        super(opts);
    +        /* c8 ignore start */
    +        this.#flushFlag = opts.flush ?? 0;
    +        this.#finishFlushFlag = opts.finishFlush ?? 0;
    +        this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
    +        /* c8 ignore stop */
    +        // this will throw if any options are invalid for the class selected
    +        try {
    +            // @types/node doesn't know that it exports the classes, but they're there
    +            //@ts-ignore
    +            this.#handle = new realZlib[mode](opts);
    +        }
    +        catch (er) {
    +            // make sure that all errors get decorated properly
    +            throw new ZlibError(er);
    +        }
    +        this.#onError = err => {
    +            // no sense raising multiple errors, since we abort on the first one.
    +            if (this.#sawError)
    +                return;
    +            this.#sawError = true;
    +            // there is no way to cleanly recover.
    +            // continuing only obscures problems.
    +            this.close();
    +            this.emit('error', err);
    +        };
    +        this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
    +        this.once('end', () => this.close);
    +    }
    +    close() {
    +        if (this.#handle) {
    +            this.#handle.close();
    +            this.#handle = undefined;
    +            this.emit('close');
    +        }
    +    }
    +    reset() {
    +        if (!this.#sawError) {
    +            assert(this.#handle, 'zlib binding closed');
    +            //@ts-ignore
    +            return this.#handle.reset?.();
    +        }
    +    }
    +    flush(flushFlag) {
    +        if (this.ended)
    +            return;
    +        if (typeof flushFlag !== 'number')
    +            flushFlag = this.#fullFlushFlag;
    +        this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }));
    +    }
    +    end(chunk, encoding, cb) {
    +        /* c8 ignore start */
    +        if (typeof chunk === 'function') {
    +            cb = chunk;
    +            encoding = undefined;
    +            chunk = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        /* c8 ignore stop */
    +        if (chunk) {
    +            if (encoding)
    +                this.write(chunk, encoding);
    +            else
    +                this.write(chunk);
    +        }
    +        this.flush(this.#finishFlushFlag);
    +        this.#ended = true;
    +        return super.end(cb);
    +    }
    +    get ended() {
    +        return this.#ended;
    +    }
    +    // overridden in the gzip classes to do portable writes
    +    [_superWrite](data) {
    +        return super.write(data);
    +    }
    +    write(chunk, encoding, cb) {
    +        // process the chunk using the sync process
    +        // then super.write() all the outputted chunks
    +        if (typeof encoding === 'function')
    +            (cb = encoding), (encoding = 'utf8');
    +        if (typeof chunk === 'string')
    +            chunk = Buffer.from(chunk, encoding);
    +        if (this.#sawError)
    +            return;
    +        assert(this.#handle, 'zlib binding closed');
    +        // _processChunk tries to .close() the native handle after it's done, so we
    +        // intercept that by temporarily making it a no-op.
    +        // diving into the node:zlib internals a bit here
    +        const nativeHandle = this.#handle
    +            ._handle;
    +        const originalNativeClose = nativeHandle.close;
    +        nativeHandle.close = () => { };
    +        const originalClose = this.#handle.close;
    +        this.#handle.close = () => { };
    +        // It also calls `Buffer.concat()` at the end, which may be convenient
    +        // for some, but which we are not interested in as it slows us down.
    +        Buffer.concat = args => args;
    +        let result = undefined;
    +        try {
    +            const flushFlag = typeof chunk[_flushFlag] === 'number'
    +                ? chunk[_flushFlag]
    +                : this.#flushFlag;
    +            result = this.#handle._processChunk(chunk, flushFlag);
    +            // if we don't throw, reset it back how it was
    +            Buffer.concat = OriginalBufferConcat;
    +        }
    +        catch (err) {
    +            // or if we do, put Buffer.concat() back before we emit error
    +            // Error events call into user code, which may call Buffer.concat()
    +            Buffer.concat = OriginalBufferConcat;
    +            this.#onError(new ZlibError(err));
    +        }
    +        finally {
    +            if (this.#handle) {
    +                // Core zlib resets `_handle` to null after attempting to close the
    +                // native handle. Our no-op handler prevented actual closure, but we
    +                // need to restore the `._handle` property.
    +                ;
    +                this.#handle._handle =
    +                    nativeHandle;
    +                nativeHandle.close = originalNativeClose;
    +                this.#handle.close = originalClose;
    +                // `_processChunk()` adds an 'error' listener. If we don't remove it
    +                // after each call, these handlers start piling up.
    +                this.#handle.removeAllListeners('error');
    +                // make sure OUR error listener is still attached tho
    +            }
    +        }
    +        if (this.#handle)
    +            this.#handle.on('error', er => this.#onError(new ZlibError(er)));
    +        let writeReturn;
    +        if (result) {
    +            if (Array.isArray(result) && result.length > 0) {
    +                const r = result[0];
    +                // The first buffer is always `handle._outBuffer`, which would be
    +                // re-used for later invocations; so, we always have to copy that one.
    +                writeReturn = this[_superWrite](Buffer.from(r));
    +                for (let i = 1; i < result.length; i++) {
    +                    writeReturn = this[_superWrite](result[i]);
    +                }
    +            }
    +            else {
    +                // either a single Buffer or an empty array
    +                writeReturn = this[_superWrite](Buffer.from(result));
    +            }
    +        }
    +        if (cb)
    +            cb();
    +        return writeReturn;
    +    }
    +}
    +export class Zlib extends ZlibBase {
    +    #level;
    +    #strategy;
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants.Z_NO_FLUSH;
    +        opts.finishFlush = opts.finishFlush || constants.Z_FINISH;
    +        opts.fullFlushFlag = constants.Z_FULL_FLUSH;
    +        super(opts, mode);
    +        this.#level = opts.level;
    +        this.#strategy = opts.strategy;
    +    }
    +    params(level, strategy) {
    +        if (this.sawError)
    +            return;
    +        if (!this.handle)
    +            throw new Error('cannot switch params when binding is closed');
    +        // no way to test this without also not supporting params at all
    +        /* c8 ignore start */
    +        if (!this.handle.params)
    +            throw new Error('not supported in this implementation');
    +        /* c8 ignore stop */
    +        if (this.#level !== level || this.#strategy !== strategy) {
    +            this.flush(constants.Z_SYNC_FLUSH);
    +            assert(this.handle, 'zlib binding closed');
    +            // .params() calls .flush(), but the latter is always async in the
    +            // core zlib. We override .flush() temporarily to intercept that and
    +            // flush synchronously.
    +            const origFlush = this.handle.flush;
    +            this.handle.flush = (flushFlag, cb) => {
    +                /* c8 ignore start */
    +                if (typeof flushFlag === 'function') {
    +                    cb = flushFlag;
    +                    flushFlag = this.flushFlag;
    +                }
    +                /* c8 ignore stop */
    +                this.flush(flushFlag);
    +                cb?.();
    +            };
    +            try {
    +                ;
    +                this.handle.params(level, strategy);
    +            }
    +            finally {
    +                this.handle.flush = origFlush;
    +            }
    +            /* c8 ignore start */
    +            if (this.handle) {
    +                this.#level = level;
    +                this.#strategy = strategy;
    +            }
    +            /* c8 ignore stop */
    +        }
    +    }
    +}
    +// minimal 2-byte header
    +export class Deflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Deflate');
    +    }
    +}
    +export class Inflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Inflate');
    +    }
    +}
    +export class Gzip extends Zlib {
    +    #portable;
    +    constructor(opts) {
    +        super(opts, 'Gzip');
    +        this.#portable = opts && !!opts.portable;
    +    }
    +    [_superWrite](data) {
    +        if (!this.#portable)
    +            return super[_superWrite](data);
    +        // we'll always get the header emitted in one first chunk
    +        // overwrite the OS indicator byte with 0xFF
    +        this.#portable = false;
    +        data[9] = 255;
    +        return super[_superWrite](data);
    +    }
    +}
    +export class Gunzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Gunzip');
    +    }
    +}
    +// raw - no header
    +export class DeflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'DeflateRaw');
    +    }
    +}
    +export class InflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'InflateRaw');
    +    }
    +}
    +// auto-detect header.
    +export class Unzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Unzip');
    +    }
    +}
    +export class Brotli extends ZlibBase {
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS;
    +        opts.finishFlush =
    +            opts.finishFlush || constants.BROTLI_OPERATION_FINISH;
    +        opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH;
    +        super(opts, mode);
    +    }
    +}
    +export class BrotliCompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliCompress');
    +    }
    +}
    +export class BrotliDecompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliDecompress');
    +    }
    +}
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/package.json
    new file mode 100644
    index 00000000..e94623ff
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/minizlib/package.json
    @@ -0,0 +1,81 @@
    +{
    +  "name": "minizlib",
    +  "version": "3.0.1",
    +  "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
    +  "main": "./dist/commonjs/index.js",
    +  "dependencies": {
    +    "minipass": "^7.0.4",
    +    "rimraf": "^5.0.5"
    +  },
    +  "scripts": {
    +    "prepare": "tshy",
    +    "pretest": "npm run prepare",
    +    "test": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "prepublishOnly": "git push origin --follow-tags",
    +    "format": "prettier --write . --loglevel warn",
    +    "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/isaacs/minizlib.git"
    +  },
    +  "keywords": [
    +    "zlib",
    +    "gzip",
    +    "gunzip",
    +    "deflate",
    +    "inflate",
    +    "compression",
    +    "zip",
    +    "unzip"
    +  ],
    +  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
    +  "license": "MIT",
    +  "devDependencies": {
    +    "@types/node": "^20.11.29",
    +    "mkdirp": "^3.0.1",
    +    "tap": "^18.7.1",
    +    "tshy": "^1.12.0",
    +    "typedoc": "^0.25.12"
    +  },
    +  "files": [
    +    "dist"
    +  ],
    +  "engines": {
    +    "node": ">= 18"
    +  },
    +  "tshy": {
    +    "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"
    +      }
    +    }
    +  },
    +  "types": "./dist/commonjs/index.d.ts",
    +  "type": "module",
    +  "prettier": {
    +    "semi": false,
    +    "printWidth": 75,
    +    "tabWidth": 2,
    +    "useTabs": false,
    +    "singleQuote": true,
    +    "jsxSingleQuote": false,
    +    "bracketSameLine": true,
    +    "arrowParens": "avoid",
    +    "endOfLine": "lf"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/LICENSE b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/LICENSE
    new file mode 100644
    index 00000000..0a034db7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/LICENSE
    @@ -0,0 +1,21 @@
    +Copyright (c) 2011-2023 James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me)
    +
    +This project is free software 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/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/package.json
    new file mode 100644
    index 00000000..9d04a66e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/package.json
    @@ -0,0 +1,91 @@
    +{
    +    "name": "mkdirp",
    +    "description": "Recursively mkdir, like `mkdir -p`",
    +    "version": "3.0.1",
    +    "keywords": [
    +        "mkdir",
    +        "directory",
    +        "make dir",
    +        "make",
    +        "dir",
    +        "recursive",
    +        "native"
    +    ],
    +    "bin": "./dist/cjs/src/bin.js",
    +    "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",
    +        "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"
    +    },
    +    "devDependencies": {
    +        "@types/brace-expansion": "^1.1.0",
    +        "@types/node": "^18.11.9",
    +        "@types/tap": "^15.0.7",
    +        "c8": "^7.12.0",
    +        "eslint-config-prettier": "^8.6.0",
    +        "prettier": "^2.8.2",
    +        "tap": "^16.3.3",
    +        "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"
    +    },
    +    "repository": {
    +        "type": "git",
    +        "url": "https://github.com/isaacs/node-mkdirp.git"
    +    },
    +    "license": "MIT",
    +    "engines": {
    +        "node": ">=10"
    +    }
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.d.ts
    new file mode 100644
    index 00000000..34e00522
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.d.ts
    @@ -0,0 +1,3 @@
    +#!/usr/bin/env node
    +export {};
    +//# sourceMappingURL=bin.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.d.ts.map
    new file mode 100644
    index 00000000..c10c656e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../src/bin.ts"],"names":[],"mappings":""}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.js
    new file mode 100755
    index 00000000..757aae1f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.js
    @@ -0,0 +1,80 @@
    +#!/usr/bin/env node
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +const package_json_1 = require("../package.json");
    +const usage = () => `
    +usage: mkdirp [DIR1,DIR2..] {OPTIONS}
    +
    +  Create each supplied directory including any necessary parent directories
    +  that don't yet exist.
    +
    +  If the directory already exists, do nothing.
    +
    +OPTIONS are:
    +
    +  -m       If a directory needs to be created, set the mode as an octal
    +  --mode=  permission string.
    +
    +  -v --version   Print the mkdirp version number
    +
    +  -h --help      Print this helpful banner
    +
    +  -p --print     Print the first directories created for each path provided
    +
    +  --manual       Use manual implementation, even if native is available
    +`;
    +const dirs = [];
    +const opts = {};
    +let doPrint = false;
    +let dashdash = false;
    +let manual = false;
    +for (const arg of process.argv.slice(2)) {
    +    if (dashdash)
    +        dirs.push(arg);
    +    else if (arg === '--')
    +        dashdash = true;
    +    else if (arg === '--manual')
    +        manual = true;
    +    else if (/^-h/.test(arg) || /^--help/.test(arg)) {
    +        console.log(usage());
    +        process.exit(0);
    +    }
    +    else if (arg === '-v' || arg === '--version') {
    +        console.log(package_json_1.version);
    +        process.exit(0);
    +    }
    +    else if (arg === '-p' || arg === '--print') {
    +        doPrint = true;
    +    }
    +    else if (/^-m/.test(arg) || /^--mode=/.test(arg)) {
    +        // these don't get covered in CI, but work locally
    +        // weird because the tests below show as passing in the output.
    +        /* c8 ignore start */
    +        const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8);
    +        if (isNaN(mode)) {
    +            console.error(`invalid mode argument: ${arg}\nMust be an octal number.`);
    +            process.exit(1);
    +        }
    +        /* c8 ignore stop */
    +        opts.mode = mode;
    +    }
    +    else
    +        dirs.push(arg);
    +}
    +const index_js_1 = require("./index.js");
    +const impl = manual ? index_js_1.mkdirp.manual : index_js_1.mkdirp;
    +if (dirs.length === 0) {
    +    console.error(usage());
    +}
    +// these don't get covered in CI, but work locally
    +/* c8 ignore start */
    +Promise.all(dirs.map(dir => impl(dir, opts)))
    +    .then(made => (doPrint ? made.forEach(m => m && console.log(m)) : null))
    +    .catch(er => {
    +    console.error(er.message);
    +    if (er.code)
    +        console.error('  code: ' + er.code);
    +    process.exit(1);
    +});
    +/* c8 ignore stop */
    +//# sourceMappingURL=bin.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.js.map
    new file mode 100644
    index 00000000..d9929530
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/bin.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../../src/bin.ts"],"names":[],"mappings":";;;AAEA,kDAAyC;AAGzC,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;CAoBnB,CAAA;AAED,MAAM,IAAI,GAAa,EAAE,CAAA;AACzB,MAAM,IAAI,GAAkB,EAAE,CAAA;AAC9B,IAAI,OAAO,GAAY,KAAK,CAAA;AA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AoB;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;KACjB;;QAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;CACtB;AAED,yCAAmC;AACnC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,iBAAM,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAM,CAAA;AAC5C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;CACvB;AAED,kDAAkD;AAClD,qBAAqB;AACrB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;KAC1C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KACvE,KAAK,CAAC,EAAE,CAAC,EAAE;IACV,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;IACzB,IAAI,EAAE,CAAC,IAAI;QAAE,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;IAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA;AACJ,oBAAoB","sourcesContent":["#!/usr/bin/env node\n\nimport { version } from '../package.json'\nimport { MkdirpOptions } from './opts-arg.js'\n\nconst usage = () => `\nusage: mkdirp [DIR1,DIR2..] {OPTIONS}\n\n  Create each supplied directory including any necessary parent directories\n  that don't yet exist.\n\n  If the directory already exists, do nothing.\n\nOPTIONS are:\n\n  -m       If a directory needs to be created, set the mode as an octal\n  --mode=  permission string.\n\n  -v --version   Print the mkdirp version number\n\n  -h --help      Print this helpful banner\n\n  -p --print     Print the first directories created for each path provided\n\n  --manual       Use manual implementation, even if native is available\n`\n\nconst dirs: string[] = []\nconst opts: MkdirpOptions = {}\nlet doPrint: boolean = false\nlet dashdash = false\nlet manual = false\nfor (const arg of process.argv.slice(2)) {\n  if (dashdash) dirs.push(arg)\n  else if (arg === '--') dashdash = true\n  else if (arg === '--manual') manual = true\n  else if (/^-h/.test(arg) || /^--help/.test(arg)) {\n    console.log(usage())\n    process.exit(0)\n  } else if (arg === '-v' || arg === '--version') {\n    console.log(version)\n    process.exit(0)\n  } else if (arg === '-p' || arg === '--print') {\n    doPrint = true\n  } else if (/^-m/.test(arg) || /^--mode=/.test(arg)) {\n    // these don't get covered in CI, but work locally\n    // weird because the tests below show as passing in the output.\n    /* c8 ignore start */\n    const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8)\n    if (isNaN(mode)) {\n      console.error(`invalid mode argument: ${arg}\\nMust be an octal number.`)\n      process.exit(1)\n    }\n    /* c8 ignore stop */\n    opts.mode = mode\n  } else dirs.push(arg)\n}\n\nimport { mkdirp } from './index.js'\nconst impl = manual ? mkdirp.manual : mkdirp\nif (dirs.length === 0) {\n  console.error(usage())\n}\n\n// these don't get covered in CI, but work locally\n/* c8 ignore start */\nPromise.all(dirs.map(dir => impl(dir, opts)))\n  .then(made => (doPrint ? made.forEach(m => m && console.log(m)) : null))\n  .catch(er => {\n    console.error(er.message)\n    if (er.code) console.error('  code: ' + er.code)\n    process.exit(1)\n  })\n/* c8 ignore stop */\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.d.ts
    new file mode 100644
    index 00000000..e47794b3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.d.ts
    @@ -0,0 +1,4 @@
    +import { MkdirpOptionsResolved } from './opts-arg.js';
    +export declare const findMade: (opts: MkdirpOptionsResolved, parent: string, path?: string) => Promise;
    +export declare const findMadeSync: (opts: MkdirpOptionsResolved, parent: string, path?: string) => undefined | string;
    +//# sourceMappingURL=find-made.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.d.ts.map
    new file mode 100644
    index 00000000..00d5d1a4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"find-made.d.ts","sourceRoot":"","sources":["../../../src/find-made.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAErD,eAAO,MAAM,QAAQ,SACb,qBAAqB,UACnB,MAAM,SACP,MAAM,KACZ,QAAQ,SAAS,GAAG,MAAM,CAe5B,CAAA;AAED,eAAO,MAAM,YAAY,SACjB,qBAAqB,UACnB,MAAM,SACP,MAAM,KACZ,SAAS,GAAG,MAad,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.js
    new file mode 100644
    index 00000000..e831ef27
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.js
    @@ -0,0 +1,35 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.findMadeSync = exports.findMade = void 0;
    +const path_1 = require("path");
    +const findMade = async (opts, parent, path) => {
    +    // we never want the 'made' return value to be a root directory
    +    if (path === parent) {
    +        return;
    +    }
    +    return opts.statAsync(parent).then(st => (st.isDirectory() ? path : undefined), // will fail later
    +    // will fail later
    +    er => {
    +        const fer = er;
    +        return fer && fer.code === 'ENOENT'
    +            ? (0, exports.findMade)(opts, (0, path_1.dirname)(parent), parent)
    +            : undefined;
    +    });
    +};
    +exports.findMade = findMade;
    +const findMadeSync = (opts, parent, path) => {
    +    if (path === parent) {
    +        return undefined;
    +    }
    +    try {
    +        return opts.statSync(parent).isDirectory() ? path : undefined;
    +    }
    +    catch (er) {
    +        const fer = er;
    +        return fer && fer.code === 'ENOENT'
    +            ? (0, exports.findMadeSync)(opts, (0, path_1.dirname)(parent), parent)
    +            : undefined;
    +    }
    +};
    +exports.findMadeSync = findMadeSync;
    +//# sourceMappingURL=find-made.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.js.map
    new file mode 100644
    index 00000000..30a0d663
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/find-made.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"find-made.js","sourceRoot":"","sources":["../../../src/find-made.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAGvB,MAAM,QAAQ,GAAG,KAAK,EAC3B,IAA2B,EAC3B,MAAc,EACd,IAAa,EACgB,EAAE;IAC/B,+DAA+D;IAC/D,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,OAAM;KACP;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAChC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,kBAAkB;IAC/D,AAD6C,kBAAkB;IAC/D,EAAE,CAAC,EAAE;QACH,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;YACjC,CAAC,CAAC,IAAA,gBAAQ,EAAC,IAAI,EAAE,IAAA,cAAO,EAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YACzC,CAAC,CAAC,SAAS,CAAA;IACf,CAAC,CACF,CAAA;AACH,CAAC,CAAA;AAnBY,QAAA,QAAQ,YAmBpB;AAEM,MAAM,YAAY,GAAG,CAC1B,IAA2B,EAC3B,MAAc,EACd,IAAa,EACO,EAAE;IACtB,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,OAAO,SAAS,CAAA;KACjB;IAED,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;KAC9D;IAAC,OAAO,EAAE,EAAE;QACX,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;YACjC,CAAC,CAAC,IAAA,oBAAY,EAAC,IAAI,EAAE,IAAA,cAAO,EAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAC7C,CAAC,CAAC,SAAS,CAAA;KACd;AACH,CAAC,CAAA;AAjBY,QAAA,YAAY,gBAiBxB","sourcesContent":["import { dirname } from 'path'\nimport { MkdirpOptionsResolved } from './opts-arg.js'\n\nexport const findMade = async (\n  opts: MkdirpOptionsResolved,\n  parent: string,\n  path?: string\n): Promise => {\n  // we never want the 'made' return value to be a root directory\n  if (path === parent) {\n    return\n  }\n\n  return opts.statAsync(parent).then(\n    st => (st.isDirectory() ? path : undefined), // will fail later\n    er => {\n      const fer = er as NodeJS.ErrnoException\n      return fer && fer.code === 'ENOENT'\n        ? findMade(opts, dirname(parent), parent)\n        : undefined\n    }\n  )\n}\n\nexport const findMadeSync = (\n  opts: MkdirpOptionsResolved,\n  parent: string,\n  path?: string\n): undefined | string => {\n  if (path === parent) {\n    return undefined\n  }\n\n  try {\n    return opts.statSync(parent).isDirectory() ? path : undefined\n  } catch (er) {\n    const fer = er as NodeJS.ErrnoException\n    return fer && fer.code === 'ENOENT'\n      ? findMadeSync(opts, dirname(parent), parent)\n      : undefined\n  }\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.d.ts
    new file mode 100644
    index 00000000..fc9e43b3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.d.ts
    @@ -0,0 +1,39 @@
    +import { MkdirpOptions } from './opts-arg.js';
    +export { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js';
    +export { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js';
    +export { useNative, useNativeSync } from './use-native.js';
    +export declare const mkdirpSync: (path: string, opts?: MkdirpOptions) => string | void;
    +export declare const sync: (path: string, opts?: MkdirpOptions) => string | void;
    +export declare const manual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & {
    +    sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +};
    +export declare const manualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +export declare const native: ((path: string, options?: MkdirpOptions | undefined) => Promise) & {
    +    sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +};
    +export declare const nativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +export declare const mkdirp: ((path: string, opts?: MkdirpOptions) => Promise) & {
    +    mkdirpSync: (path: string, opts?: MkdirpOptions) => string | void;
    +    mkdirpNative: ((path: string, options?: MkdirpOptions | undefined) => Promise) & {
    +        sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +    };
    +    mkdirpNativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +    mkdirpManual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & {
    +        sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +    };
    +    mkdirpManualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +    sync: (path: string, opts?: MkdirpOptions) => string | void;
    +    native: ((path: string, options?: MkdirpOptions | undefined) => Promise) & {
    +        sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +    };
    +    nativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +    manual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & {
    +        sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +    };
    +    manualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +    useNative: ((opts?: MkdirpOptions | undefined) => boolean) & {
    +        sync: (opts?: MkdirpOptions | undefined) => boolean;
    +    };
    +    useNativeSync: (opts?: MkdirpOptions | undefined) => boolean;
    +};
    +//# sourceMappingURL=index.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.d.ts.map
    new file mode 100644
    index 00000000..0e915bbc
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAItD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG1D,eAAO,MAAM,UAAU,SAAU,MAAM,SAAS,aAAa,kBAM5D,CAAA;AAED,eAAO,MAAM,IAAI,SARgB,MAAM,SAAS,aAAa,kBAQ/B,CAAA;AAC9B,eAAO,MAAM,MAAM;;CAAe,CAAA;AAClC,eAAO,MAAM,UAAU,oHAAmB,CAAA;AAC1C,eAAO,MAAM,MAAM;;CAAe,CAAA;AAClC,eAAO,MAAM,UAAU,kFAAmB,CAAA;AAC1C,eAAO,MAAM,MAAM,UACJ,MAAM,SAAS,aAAa;uBAdV,MAAM,SAAS,aAAa;;;;;;;;;iBAA5B,MAAM,SAAS,aAAa;;;;;;;;;;;;;CAoC5D,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.js
    new file mode 100644
    index 00000000..ab9dc62c
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.js
    @@ -0,0 +1,53 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.mkdirp = exports.nativeSync = exports.native = exports.manualSync = exports.manual = exports.sync = exports.mkdirpSync = exports.useNativeSync = exports.useNative = exports.mkdirpNativeSync = exports.mkdirpNative = exports.mkdirpManualSync = exports.mkdirpManual = void 0;
    +const mkdirp_manual_js_1 = require("./mkdirp-manual.js");
    +const mkdirp_native_js_1 = require("./mkdirp-native.js");
    +const opts_arg_js_1 = require("./opts-arg.js");
    +const path_arg_js_1 = require("./path-arg.js");
    +const use_native_js_1 = require("./use-native.js");
    +/* c8 ignore start */
    +var mkdirp_manual_js_2 = require("./mkdirp-manual.js");
    +Object.defineProperty(exports, "mkdirpManual", { enumerable: true, get: function () { return mkdirp_manual_js_2.mkdirpManual; } });
    +Object.defineProperty(exports, "mkdirpManualSync", { enumerable: true, get: function () { return mkdirp_manual_js_2.mkdirpManualSync; } });
    +var mkdirp_native_js_2 = require("./mkdirp-native.js");
    +Object.defineProperty(exports, "mkdirpNative", { enumerable: true, get: function () { return mkdirp_native_js_2.mkdirpNative; } });
    +Object.defineProperty(exports, "mkdirpNativeSync", { enumerable: true, get: function () { return mkdirp_native_js_2.mkdirpNativeSync; } });
    +var use_native_js_2 = require("./use-native.js");
    +Object.defineProperty(exports, "useNative", { enumerable: true, get: function () { return use_native_js_2.useNative; } });
    +Object.defineProperty(exports, "useNativeSync", { enumerable: true, get: function () { return use_native_js_2.useNativeSync; } });
    +/* c8 ignore stop */
    +const mkdirpSync = (path, opts) => {
    +    path = (0, path_arg_js_1.pathArg)(path);
    +    const resolved = (0, opts_arg_js_1.optsArg)(opts);
    +    return (0, use_native_js_1.useNativeSync)(resolved)
    +        ? (0, mkdirp_native_js_1.mkdirpNativeSync)(path, resolved)
    +        : (0, mkdirp_manual_js_1.mkdirpManualSync)(path, resolved);
    +};
    +exports.mkdirpSync = mkdirpSync;
    +exports.sync = exports.mkdirpSync;
    +exports.manual = mkdirp_manual_js_1.mkdirpManual;
    +exports.manualSync = mkdirp_manual_js_1.mkdirpManualSync;
    +exports.native = mkdirp_native_js_1.mkdirpNative;
    +exports.nativeSync = mkdirp_native_js_1.mkdirpNativeSync;
    +exports.mkdirp = Object.assign(async (path, opts) => {
    +    path = (0, path_arg_js_1.pathArg)(path);
    +    const resolved = (0, opts_arg_js_1.optsArg)(opts);
    +    return (0, use_native_js_1.useNative)(resolved)
    +        ? (0, mkdirp_native_js_1.mkdirpNative)(path, resolved)
    +        : (0, mkdirp_manual_js_1.mkdirpManual)(path, resolved);
    +}, {
    +    mkdirpSync: exports.mkdirpSync,
    +    mkdirpNative: mkdirp_native_js_1.mkdirpNative,
    +    mkdirpNativeSync: mkdirp_native_js_1.mkdirpNativeSync,
    +    mkdirpManual: mkdirp_manual_js_1.mkdirpManual,
    +    mkdirpManualSync: mkdirp_manual_js_1.mkdirpManualSync,
    +    sync: exports.mkdirpSync,
    +    native: mkdirp_native_js_1.mkdirpNative,
    +    nativeSync: mkdirp_native_js_1.mkdirpNativeSync,
    +    manual: mkdirp_manual_js_1.mkdirpManual,
    +    manualSync: mkdirp_manual_js_1.mkdirpManualSync,
    +    useNative: use_native_js_1.useNative,
    +    useNativeSync: use_native_js_1.useNativeSync,
    +});
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.js.map
    new file mode 100644
    index 00000000..fdb57267
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/index.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAAmE;AACnE,yDAAmE;AACnE,+CAAsD;AACtD,+CAAuC;AACvC,mDAA0D;AAC1D,qBAAqB;AACrB,uDAAmE;AAA1D,gHAAA,YAAY,OAAA;AAAE,oHAAA,gBAAgB,OAAA;AACvC,uDAAmE;AAA1D,gHAAA,YAAY,OAAA;AAAE,oHAAA,gBAAgB,OAAA;AACvC,iDAA0D;AAAjD,0GAAA,SAAS,OAAA;AAAE,8GAAA,aAAa,OAAA;AACjC,oBAAoB;AAEb,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,IAAoB,EAAE,EAAE;IAC/D,IAAI,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAA;IACpB,MAAM,QAAQ,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAA;IAC9B,OAAO,IAAA,6BAAa,EAAC,QAAQ,CAAC;QAC5B,CAAC,CAAC,IAAA,mCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC;QAClC,CAAC,CAAC,IAAA,mCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AACtC,CAAC,CAAA;AANY,QAAA,UAAU,cAMtB;AAEY,QAAA,IAAI,GAAG,kBAAU,CAAA;AACjB,QAAA,MAAM,GAAG,+BAAY,CAAA;AACrB,QAAA,UAAU,GAAG,mCAAgB,CAAA;AAC7B,QAAA,MAAM,GAAG,+BAAY,CAAA;AACrB,QAAA,UAAU,GAAG,mCAAgB,CAAA;AAC7B,QAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CACjC,KAAK,EAAE,IAAY,EAAE,IAAoB,EAAE,EAAE;IAC3C,IAAI,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAA;IACpB,MAAM,QAAQ,GAAG,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAA;IAC9B,OAAO,IAAA,yBAAS,EAAC,QAAQ,CAAC;QACxB,CAAC,CAAC,IAAA,+BAAY,EAAC,IAAI,EAAE,QAAQ,CAAC;QAC9B,CAAC,CAAC,IAAA,+BAAY,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAClC,CAAC,EACD;IACE,UAAU,EAAV,kBAAU;IACV,YAAY,EAAZ,+BAAY;IACZ,gBAAgB,EAAhB,mCAAgB;IAChB,YAAY,EAAZ,+BAAY;IACZ,gBAAgB,EAAhB,mCAAgB;IAEhB,IAAI,EAAE,kBAAU;IAChB,MAAM,EAAE,+BAAY;IACpB,UAAU,EAAE,mCAAgB;IAC5B,MAAM,EAAE,+BAAY;IACpB,UAAU,EAAE,mCAAgB;IAC5B,SAAS,EAAT,yBAAS;IACT,aAAa,EAAb,6BAAa;CACd,CACF,CAAA","sourcesContent":["import { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nimport { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\nimport { pathArg } from './path-arg.js'\nimport { useNative, useNativeSync } from './use-native.js'\n/* c8 ignore start */\nexport { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nexport { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'\nexport { useNative, useNativeSync } from './use-native.js'\n/* c8 ignore stop */\n\nexport const mkdirpSync = (path: string, opts?: MkdirpOptions) => {\n  path = pathArg(path)\n  const resolved = optsArg(opts)\n  return useNativeSync(resolved)\n    ? mkdirpNativeSync(path, resolved)\n    : mkdirpManualSync(path, resolved)\n}\n\nexport const sync = mkdirpSync\nexport const manual = mkdirpManual\nexport const manualSync = mkdirpManualSync\nexport const native = mkdirpNative\nexport const nativeSync = mkdirpNativeSync\nexport const mkdirp = Object.assign(\n  async (path: string, opts?: MkdirpOptions) => {\n    path = pathArg(path)\n    const resolved = optsArg(opts)\n    return useNative(resolved)\n      ? mkdirpNative(path, resolved)\n      : mkdirpManual(path, resolved)\n  },\n  {\n    mkdirpSync,\n    mkdirpNative,\n    mkdirpNativeSync,\n    mkdirpManual,\n    mkdirpManualSync,\n\n    sync: mkdirpSync,\n    native: mkdirpNative,\n    nativeSync: mkdirpNativeSync,\n    manual: mkdirpManual,\n    manualSync: mkdirpManualSync,\n    useNative,\n    useNativeSync,\n  }\n)\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts
    new file mode 100644
    index 00000000..e49cdf9f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts
    @@ -0,0 +1,6 @@
    +import { MkdirpOptions } from './opts-arg.js';
    +export declare const mkdirpManualSync: (path: string, options?: MkdirpOptions, made?: string | undefined | void) => string | undefined | void;
    +export declare const mkdirpManual: ((path: string, options?: MkdirpOptions, made?: string | undefined | void) => Promise) & {
    +    sync: (path: string, options?: MkdirpOptions, made?: string | undefined | void) => string | undefined | void;
    +};
    +//# sourceMappingURL=mkdirp-manual.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts.map
    new file mode 100644
    index 00000000..9301bab1
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"mkdirp-manual.d.ts","sourceRoot":"","sources":["../../../src/mkdirp-manual.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,gBAAgB,SACrB,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,MAAM,GAAG,SAAS,GAAG,IAmCvB,CAAA;AAED,eAAO,MAAM,YAAY,UAEf,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;iBA7C/B,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,MAAM,GAAG,SAAS,GAAG,IAAI;CAqF3B,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js
    new file mode 100644
    index 00000000..d9bd1d8b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js
    @@ -0,0 +1,79 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.mkdirpManual = exports.mkdirpManualSync = void 0;
    +const path_1 = require("path");
    +const opts_arg_js_1 = require("./opts-arg.js");
    +const mkdirpManualSync = (path, options, made) => {
    +    const parent = (0, path_1.dirname)(path);
    +    const opts = { ...(0, opts_arg_js_1.optsArg)(options), recursive: false };
    +    if (parent === path) {
    +        try {
    +            return opts.mkdirSync(path, opts);
    +        }
    +        catch (er) {
    +            // swallowed by recursive implementation on posix systems
    +            // any other error is a failure
    +            const fer = er;
    +            if (fer && fer.code !== 'EISDIR') {
    +                throw er;
    +            }
    +            return;
    +        }
    +    }
    +    try {
    +        opts.mkdirSync(path, opts);
    +        return made || path;
    +    }
    +    catch (er) {
    +        const fer = er;
    +        if (fer && fer.code === 'ENOENT') {
    +            return (0, exports.mkdirpManualSync)(path, opts, (0, exports.mkdirpManualSync)(parent, opts, made));
    +        }
    +        if (fer && fer.code !== 'EEXIST' && fer && fer.code !== 'EROFS') {
    +            throw er;
    +        }
    +        try {
    +            if (!opts.statSync(path).isDirectory())
    +                throw er;
    +        }
    +        catch (_) {
    +            throw er;
    +        }
    +    }
    +};
    +exports.mkdirpManualSync = mkdirpManualSync;
    +exports.mkdirpManual = Object.assign(async (path, options, made) => {
    +    const opts = (0, opts_arg_js_1.optsArg)(options);
    +    opts.recursive = false;
    +    const parent = (0, path_1.dirname)(path);
    +    if (parent === path) {
    +        return opts.mkdirAsync(path, opts).catch(er => {
    +            // swallowed by recursive implementation on posix systems
    +            // any other error is a failure
    +            const fer = er;
    +            if (fer && fer.code !== 'EISDIR') {
    +                throw er;
    +            }
    +        });
    +    }
    +    return opts.mkdirAsync(path, opts).then(() => made || path, async (er) => {
    +        const fer = er;
    +        if (fer && fer.code === 'ENOENT') {
    +            return (0, exports.mkdirpManual)(parent, opts).then((made) => (0, exports.mkdirpManual)(path, opts, made));
    +        }
    +        if (fer && fer.code !== 'EEXIST' && fer.code !== 'EROFS') {
    +            throw er;
    +        }
    +        return opts.statAsync(path).then(st => {
    +            if (st.isDirectory()) {
    +                return made;
    +            }
    +            else {
    +                throw er;
    +            }
    +        }, () => {
    +            throw er;
    +        });
    +    });
    +}, { sync: exports.mkdirpManualSync });
    +//# sourceMappingURL=mkdirp-manual.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js.map
    new file mode 100644
    index 00000000..ff7ba24d
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"mkdirp-manual.js","sourceRoot":"","sources":["../../../src/mkdirp-manual.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAC9B,+CAAsD;AAE/C,MAAM,gBAAgB,GAAG,CAC9B,IAAY,EACZ,OAAuB,EACvB,IAAgC,EACL,EAAE;IAC7B,MAAM,MAAM,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,CAAA;IAC5B,MAAM,IAAI,GAAG,EAAE,GAAG,IAAA,qBAAO,EAAC,OAAO,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;IAEtD,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,IAAI;YACF,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SAClC;QAAC,OAAO,EAAE,EAAE;YACX,yDAAyD;YACzD,+BAA+B;YAC/B,MAAM,GAAG,GAAG,EAA2B,CAAA;YACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAChC,MAAM,EAAE,CAAA;aACT;YACD,OAAM;SACP;KACF;IAED,IAAI;QACF,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAC1B,OAAO,IAAI,IAAI,IAAI,CAAA;KACpB;IAAC,OAAO,EAAE,EAAE;QACX,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;YAChC,OAAO,IAAA,wBAAgB,EAAC,IAAI,EAAE,IAAI,EAAE,IAAA,wBAAgB,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,C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AC,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,CACpC,CAAC,IAAgC,EAAE,EAAE,CAAC,IAAA,oBAAY,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CACrE,CAAA;SACF;QACD,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE;YACxD,MAAM,EAAE,CAAA;SACT;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAC9B,EAAE,CAAC,EAAE;YACH,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;gBACpB,OAAO,IAAI,CAAA;aACZ;iBAAM;gBACL,MAAM,EAAE,CAAA;aACT;QACH,CAAC,EACD,GAAG,EAAE;YACH,MAAM,EAAE,CAAA;QACV,CAAC,CACF,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC,EACD,EAAE,IAAI,EAAE,wBAAgB,EAAE,CAC3B,CAAA","sourcesContent":["import { dirname } from 'path'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nexport const mkdirpManualSync = (\n  path: string,\n  options?: MkdirpOptions,\n  made?: string | undefined | void\n): string | undefined | void => {\n  const parent = dirname(path)\n  const opts = { ...optsArg(options), recursive: false }\n\n  if (parent === path) {\n    try {\n      return opts.mkdirSync(path, opts)\n    } catch (er) {\n      // swallowed by recursive implementation on posix systems\n      // any other error is a failure\n      const fer = er as NodeJS.ErrnoException\n      if (fer && fer.code !== 'EISDIR') {\n        throw er\n      }\n      return\n    }\n  }\n\n  try {\n    opts.mkdirSync(path, opts)\n    return made || path\n  } catch (er) {\n    const fer = er as NodeJS.ErrnoException\n    if (fer && fer.code === 'ENOENT') {\n      return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))\n    }\n    if (fer && fer.code !== 'EEXIST' && fer && fer.code !== 'EROFS') {\n      throw er\n    }\n    try {\n      if (!opts.statSync(path).isDirectory()) throw er\n    } catch (_) {\n      throw er\n    }\n  }\n}\n\nexport const mkdirpManual = Object.assign(\n  async (\n    path: string,\n    options?: MkdirpOptions,\n    made?: string | undefined | void\n  ): Promise => {\n    const opts = optsArg(options)\n    opts.recursive = false\n    const parent = dirname(path)\n    if (parent === path) {\n      return opts.mkdirAsync(path, opts).catch(er => {\n        // swallowed by recursive implementation on posix systems\n        // any other error is a failure\n        const fer = er as NodeJS.ErrnoException\n        if (fer && fer.code !== 'EISDIR') {\n          throw er\n        }\n      })\n    }\n\n    return opts.mkdirAsync(path, opts).then(\n      () => made || path,\n      async er => {\n        const fer = er as NodeJS.ErrnoException\n        if (fer && fer.code === 'ENOENT') {\n          return mkdirpManual(parent, opts).then(\n            (made?: string | undefined | void) => mkdirpManual(path, opts, made)\n          )\n        }\n        if (fer && fer.code !== 'EEXIST' && fer.code !== 'EROFS') {\n          throw er\n        }\n        return opts.statAsync(path).then(\n          st => {\n            if (st.isDirectory()) {\n              return made\n            } else {\n              throw er\n            }\n          },\n          () => {\n            throw er\n          }\n        )\n      }\n    )\n  },\n  { sync: mkdirpManualSync }\n)\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts
    new file mode 100644
    index 00000000..28b64814
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts
    @@ -0,0 +1,6 @@
    +import { MkdirpOptions } from './opts-arg.js';
    +export declare const mkdirpNativeSync: (path: string, options?: MkdirpOptions) => string | void | undefined;
    +export declare const mkdirpNative: ((path: string, options?: MkdirpOptions) => Promise) & {
    +    sync: (path: string, options?: MkdirpOptions) => string | void | undefined;
    +};
    +//# sourceMappingURL=mkdirp-native.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts.map
    new file mode 100644
    index 00000000..379c0f65
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"mkdirp-native.d.ts","sourceRoot":"","sources":["../../../src/mkdirp-native.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,gBAAgB,SACrB,MAAM,YACF,aAAa,KACtB,MAAM,GAAG,IAAI,GAAG,SAoBlB,CAAA;AAED,eAAO,MAAM,YAAY,UAEf,MAAM,YACF,aAAa,KACtB,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;iBA5B/B,MAAM,YACF,aAAa,KACtB,MAAM,GAAG,IAAI,GAAG,SAAS;CAgD3B,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js
    new file mode 100644
    index 00000000..9f00567d
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js
    @@ -0,0 +1,50 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.mkdirpNative = exports.mkdirpNativeSync = void 0;
    +const path_1 = require("path");
    +const find_made_js_1 = require("./find-made.js");
    +const mkdirp_manual_js_1 = require("./mkdirp-manual.js");
    +const opts_arg_js_1 = require("./opts-arg.js");
    +const mkdirpNativeSync = (path, options) => {
    +    const opts = (0, opts_arg_js_1.optsArg)(options);
    +    opts.recursive = true;
    +    const parent = (0, path_1.dirname)(path);
    +    if (parent === path) {
    +        return opts.mkdirSync(path, opts);
    +    }
    +    const made = (0, find_made_js_1.findMadeSync)(opts, path);
    +    try {
    +        opts.mkdirSync(path, opts);
    +        return made;
    +    }
    +    catch (er) {
    +        const fer = er;
    +        if (fer && fer.code === 'ENOENT') {
    +            return (0, mkdirp_manual_js_1.mkdirpManualSync)(path, opts);
    +        }
    +        else {
    +            throw er;
    +        }
    +    }
    +};
    +exports.mkdirpNativeSync = mkdirpNativeSync;
    +exports.mkdirpNative = Object.assign(async (path, options) => {
    +    const opts = { ...(0, opts_arg_js_1.optsArg)(options), recursive: true };
    +    const parent = (0, path_1.dirname)(path);
    +    if (parent === path) {
    +        return await opts.mkdirAsync(path, opts);
    +    }
    +    return (0, find_made_js_1.findMade)(opts, path).then((made) => opts
    +        .mkdirAsync(path, opts)
    +        .then(m => made || m)
    +        .catch(er => {
    +        const fer = er;
    +        if (fer && fer.code === 'ENOENT') {
    +            return (0, mkdirp_manual_js_1.mkdirpManual)(path, opts);
    +        }
    +        else {
    +            throw er;
    +        }
    +    }));
    +}, { sync: exports.mkdirpNativeSync });
    +//# sourceMappingURL=mkdirp-native.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js.map
    new file mode 100644
    index 00000000..1f889ee9
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"mkdirp-native.js","sourceRoot":"","sources":["../../../src/mkdirp-native.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAC9B,iDAAuD;AACvD,yDAAmE;AACnE,+CAAsD;AAE/C,MAAM,gBAAgB,GAAG,CAC9B,IAAY,EACZ,OAAuB,EACI,EAAE;IAC7B,MAAM,IAAI,GAAG,IAAA,qBAAO,EAAC,OAAO,CAAC,CAAA;IAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;I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AAC,EAAE;QACV,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;YAChC,OAAO,IAAA,+BAAY,EAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SAChC;aAAM;YACL,MAAM,EAAE,CAAA;SACT;IACH,CAAC,CAAC,CACL,CAAA;AACH,CAAC,EACD,EAAE,IAAI,EAAE,wBAAgB,EAAE,CAC3B,CAAA","sourcesContent":["import { dirname } from 'path'\nimport { findMade, findMadeSync } from './find-made.js'\nimport { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nexport const mkdirpNativeSync = (\n  path: string,\n  options?: MkdirpOptions\n): string | void | undefined => {\n  const opts = optsArg(options)\n  opts.recursive = true\n  const parent = dirname(path)\n  if (parent === path) {\n    return opts.mkdirSync(path, opts)\n  }\n\n  const made = findMadeSync(opts, path)\n  try {\n    opts.mkdirSync(path, opts)\n    return made\n  } catch (er) {\n    const fer = er as NodeJS.ErrnoException\n    if (fer && fer.code === 'ENOENT') {\n      return mkdirpManualSync(path, opts)\n    } else {\n      throw er\n    }\n  }\n}\n\nexport const mkdirpNative = Object.assign(\n  async (\n    path: string,\n    options?: MkdirpOptions\n  ): Promise => {\n    const opts = { ...optsArg(options), recursive: true }\n    const parent = dirname(path)\n    if (parent === path) {\n      return await opts.mkdirAsync(path, opts)\n    }\n\n    return findMade(opts, path).then((made?: string | undefined) =>\n      opts\n        .mkdirAsync(path, opts)\n        .then(m => made || m)\n        .catch(er => {\n          const fer = er as NodeJS.ErrnoException\n          if (fer && fer.code === 'ENOENT') {\n            return mkdirpManual(path, opts)\n          } else {\n            throw er\n          }\n        })\n    )\n  },\n  { sync: mkdirpNativeSync }\n)\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts
    new file mode 100644
    index 00000000..73d076b3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts
    @@ -0,0 +1,42 @@
    +/// 
    +/// 
    +import { MakeDirectoryOptions, Stats } from 'fs';
    +export interface FsProvider {
    +    stat?: (path: string, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any) => any;
    +    mkdir?: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }, callback: (err: NodeJS.ErrnoException | null, made?: string) => any) => any;
    +    statSync?: (path: string) => Stats;
    +    mkdirSync?: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }) => string | undefined;
    +}
    +interface Options extends FsProvider {
    +    mode?: number | string;
    +    fs?: FsProvider;
    +    mkdirAsync?: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }) => Promise;
    +    statAsync?: (path: string) => Promise;
    +}
    +export type MkdirpOptions = Options | number | string;
    +export interface MkdirpOptionsResolved {
    +    mode: number;
    +    fs: FsProvider;
    +    mkdirAsync: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }) => Promise;
    +    statAsync: (path: string) => Promise;
    +    stat: (path: string, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any) => any;
    +    mkdir: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }, callback: (err: NodeJS.ErrnoException | null, made?: string) => any) => any;
    +    statSync: (path: string) => Stats;
    +    mkdirSync: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }) => string | undefined;
    +    recursive?: boolean;
    +}
    +export declare const optsArg: (opts?: MkdirpOptions) => MkdirpOptionsResolved;
    +export {};
    +//# sourceMappingURL=opts-arg.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts.map
    new file mode 100644
    index 00000000..e5751617
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"opts-arg.d.ts","sourceRoot":"","sources":["../../../src/opts-arg.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,oBAAoB,EAIpB,KAAK,EAEN,MAAM,IAAI,CAAA;AAEX,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,CACL,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,GAAG,KAC/D,GAAG,CAAA;IACR,KAAK,CAAC,EAAE,CACN,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,EACpD,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,KAChE,GAAG,CAAA;IACR,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAA;IAClC,SAAS,CAAC,EAAE,CACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KACjD,MAAM,GAAG,SAAS,CAAA;CACxB;AAED,UAAU,OAAQ,SAAQ,UAAU;IAClC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,EAAE,CAAC,EAAE,UAAU,CAAA;IACf,UAAU,CAAC,EAAE,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KACjD,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CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.js
    new file mode 100644
    index 00000000..e8f486c0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.js
    @@ -0,0 +1,38 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.optsArg = void 0;
    +const fs_1 = require("fs");
    +const optsArg = (opts) => {
    +    if (!opts) {
    +        opts = { mode: 0o777 };
    +    }
    +    else if (typeof opts === 'object') {
    +        opts = { mode: 0o777, ...opts };
    +    }
    +    else if (typeof opts === 'number') {
    +        opts = { mode: opts };
    +    }
    +    else if (typeof opts === 'string') {
    +        opts = { mode: parseInt(opts, 8) };
    +    }
    +    else {
    +        throw new TypeError('invalid options argument');
    +    }
    +    const resolved = opts;
    +    const optsFs = opts.fs || {};
    +    opts.mkdir = opts.mkdir || optsFs.mkdir || fs_1.mkdir;
    +    opts.mkdirAsync = opts.mkdirAsync
    +        ? opts.mkdirAsync
    +        : async (path, options) => {
    +            return new Promise((res, rej) => resolved.mkdir(path, options, (er, made) => er ? rej(er) : res(made)));
    +        };
    +    opts.stat = opts.stat || optsFs.stat || fs_1.stat;
    +    opts.statAsync = opts.statAsync
    +        ? opts.statAsync
    +        : async (path) => new Promise((res, rej) => resolved.stat(path, (err, stats) => (err ? rej(err) : res(stats))));
    +    opts.statSync = opts.statSync || optsFs.statSync || fs_1.statSync;
    +    opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || fs_1.mkdirSync;
    +    return resolved;
    +};
    +exports.optsArg = optsArg;
    +//# sourceMappingURL=opts-arg.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.js.map
    new file mode 100644
    index 00000000..fd5590f4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/opts-arg.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"opts-arg.js","sourceRoot":"","sources":["../../../src/opts-arg.ts"],"names":[],"mappings":";;;AAAA,2BAOW;AAwDJ,MAAM,OAAO,GAAG,CAAC,IAAoB,EAAyB,EAAE;IACrE,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;KACvB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,IAAI,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,CAAA;KAChC;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;KACtB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,IAAI,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAA;KACnC;SAAM;QACL,MAAM,IAAI,SAAS,CAAC,0BAA0B,CAAC,CAAA;KAChD;IAED,MAAM,QAAQ,GAAG,IAA6B,CAAA;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;IAE5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,UAAK,CAAA;IAEhD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU;QAC/B,CAAC,CAAC,IAAI,CAAC,UAAU;QACjB,CAAC,CAAC,KAAK,EACH,IAAY,EACZ,OAAuD,EAC1B,EAAE;YAC/B,OAAO,IAAI,OAAO,CAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAClD,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CACzC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CACzB,CACF,CAAA;QACH,CAAC,CAAA;IAEL,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,IAAI,SAAI,CAAA;IAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS;QAC7B,CAAC,CAAC,IAAI,CAAC,SAAS;QAChB,CAAC,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE,CACrB,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CACvB,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CACnE,CAAA;IAEP,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,aAAQ,CAAA;IAC5D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,IAAI,cAAS,CAAA;IAEhE,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AA3CY,QAAA,OAAO,WA2CnB","sourcesContent":["import {\n  MakeDirectoryOptions,\n  mkdir,\n  mkdirSync,\n  stat,\n  Stats,\n  statSync,\n} from 'fs'\n\nexport interface FsProvider {\n  stat?: (\n    path: string,\n    callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any\n  ) => any\n  mkdir?: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean },\n    callback: (err: NodeJS.ErrnoException | null, made?: string) => any\n  ) => any\n  statSync?: (path: string) => Stats\n  mkdirSync?: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean }\n  ) => string | undefined\n}\n\ninterface Options extends FsProvider {\n  mode?: number | string\n  fs?: FsProvider\n  mkdirAsync?: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean }\n  ) => Promise\n  statAsync?: (path: string) => Promise\n}\n\nexport type MkdirpOptions = Options | number | string\n\nexport interface MkdirpOptionsResolved {\n  mode: number\n  fs: FsProvider\n  mkdirAsync: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean }\n  ) => Promise\n  statAsync: (path: string) => Promise\n  stat: (\n    path: string,\n    callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any\n  ) => any\n  mkdir: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean },\n    callback: (err: NodeJS.ErrnoException | null, made?: string) => any\n  ) => any\n  statSync: (path: string) => Stats\n  mkdirSync: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean }\n  ) => string | undefined\n  recursive?: boolean\n}\n\nexport const optsArg = (opts?: MkdirpOptions): MkdirpOptionsResolved => {\n  if (!opts) {\n    opts = { mode: 0o777 }\n  } else if (typeof opts === 'object') {\n    opts = { mode: 0o777, ...opts }\n  } else if (typeof opts === 'number') {\n    opts = { mode: opts }\n  } else if (typeof opts === 'string') {\n    opts = { mode: parseInt(opts, 8) }\n  } else {\n    throw new TypeError('invalid options argument')\n  }\n\n  const resolved = opts as MkdirpOptionsResolved\n  const optsFs = opts.fs || {}\n\n  opts.mkdir = opts.mkdir || optsFs.mkdir || mkdir\n\n  opts.mkdirAsync = opts.mkdirAsync\n    ? opts.mkdirAsync\n    : async (\n        path: string,\n        options: MakeDirectoryOptions & { recursive?: boolean }\n      ): Promise => {\n        return new Promise((res, rej) =>\n          resolved.mkdir(path, options, (er, made) =>\n            er ? rej(er) : res(made)\n          )\n        )\n      }\n\n  opts.stat = opts.stat || optsFs.stat || stat\n  opts.statAsync = opts.statAsync\n    ? opts.statAsync\n    : async (path: string) =>\n        new Promise((res, rej) =>\n          resolved.stat(path, (err, stats) => (err ? rej(err) : res(stats)))\n        )\n\n  opts.statSync = opts.statSync || optsFs.statSync || statSync\n  opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || mkdirSync\n\n  return resolved\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts
    new file mode 100644
    index 00000000..ad0ccfc4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts
    @@ -0,0 +1,2 @@
    +export declare const pathArg: (path: string) => string;
    +//# sourceMappingURL=path-arg.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts.map
    new file mode 100644
    index 00000000..3b52b077
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"path-arg.d.ts","sourceRoot":"","sources":["../../../src/path-arg.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,SAAU,MAAM,WAyBnC,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.js
    new file mode 100644
    index 00000000..a6b457f6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.js
    @@ -0,0 +1,28 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.pathArg = void 0;
    +const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform;
    +const path_1 = require("path");
    +const pathArg = (path) => {
    +    if (/\0/.test(path)) {
    +        // simulate same failure that node raises
    +        throw Object.assign(new TypeError('path must be a string without null bytes'), {
    +            path,
    +            code: 'ERR_INVALID_ARG_VALUE',
    +        });
    +    }
    +    path = (0, path_1.resolve)(path);
    +    if (platform === 'win32') {
    +        const badWinChars = /[*|"<>?:]/;
    +        const { root } = (0, path_1.parse)(path);
    +        if (badWinChars.test(path.substring(root.length))) {
    +            throw Object.assign(new Error('Illegal characters in path.'), {
    +                path,
    +                code: 'EINVAL',
    +            });
    +        }
    +    }
    +    return path;
    +};
    +exports.pathArg = pathArg;
    +//# sourceMappingURL=path-arg.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.js.map
    new file mode 100644
    index 00000000..ad3b5d38
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/path-arg.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"path-arg.js","sourceRoot":"","sources":["../../../src/path-arg.ts"],"names":[],"mappings":";;;AAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,OAAO,CAAC,QAAQ,CAAA;AAC5E,+BAAqC;AAC9B,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;IACtC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACnB,yCAAyC;QACzC,MAAM,MAAM,CAAC,MAAM,CACjB,IAAI,SAAS,CAAC,0CAA0C,CAAC,EACzD;YACE,IAAI;YACJ,IAAI,EAAE,uBAAuB;SAC9B,CACF,CAAA;KACF;IAED,IAAI,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,CAAA;IACpB,IAAI,QAAQ,KAAK,OAAO,EAAE;QACxB,MAAM,WAAW,GAAG,WAAW,CAAA;QAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,YAAK,EAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE;YACjD,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,EAAE;gBAC5D,IAAI;gBACJ,IAAI,EAAE,QAAQ;aACf,CAAC,CAAA;SACH;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAzBY,QAAA,OAAO,WAyBnB","sourcesContent":["const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform\nimport { parse, resolve } from 'path'\nexport const pathArg = (path: string) => {\n  if (/\\0/.test(path)) {\n    // simulate same failure that node raises\n    throw Object.assign(\n      new TypeError('path must be a string without null bytes'),\n      {\n        path,\n        code: 'ERR_INVALID_ARG_VALUE',\n      }\n    )\n  }\n\n  path = resolve(path)\n  if (platform === 'win32') {\n    const badWinChars = /[*|\"<>?:]/\n    const { root } = parse(path)\n    if (badWinChars.test(path.substring(root.length))) {\n      throw Object.assign(new Error('Illegal characters in path.'), {\n        path,\n        code: 'EINVAL',\n      })\n    }\n  }\n\n  return path\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.d.ts
    new file mode 100644
    index 00000000..1c6cb619
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.d.ts
    @@ -0,0 +1,6 @@
    +import { MkdirpOptions } from './opts-arg.js';
    +export declare const useNativeSync: (opts?: MkdirpOptions) => boolean;
    +export declare const useNative: ((opts?: MkdirpOptions) => boolean) & {
    +    sync: (opts?: MkdirpOptions) => boolean;
    +};
    +//# sourceMappingURL=use-native.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.d.ts.map
    new file mode 100644
    index 00000000..7dc275e3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"use-native.d.ts","sourceRoot":"","sources":["../../../src/use-native.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAMtD,eAAO,MAAM,aAAa,UAEd,aAAa,YAA0C,CAAA;AAEnE,eAAO,MAAM,SAAS,WAGR,aAAa;kBALf,aAAa;CASxB,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.js
    new file mode 100644
    index 00000000..550b3452
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.js
    @@ -0,0 +1,17 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.useNative = exports.useNativeSync = void 0;
    +const fs_1 = require("fs");
    +const opts_arg_js_1 = require("./opts-arg.js");
    +const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version;
    +const versArr = version.replace(/^v/, '').split('.');
    +const hasNative = +versArr[0] > 10 || (+versArr[0] === 10 && +versArr[1] >= 12);
    +exports.useNativeSync = !hasNative
    +    ? () => false
    +    : (opts) => (0, opts_arg_js_1.optsArg)(opts).mkdirSync === fs_1.mkdirSync;
    +exports.useNative = Object.assign(!hasNative
    +    ? () => false
    +    : (opts) => (0, opts_arg_js_1.optsArg)(opts).mkdir === fs_1.mkdir, {
    +    sync: exports.useNativeSync,
    +});
    +//# sourceMappingURL=use-native.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.js.map
    new file mode 100644
    index 00000000..9a15efeb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/cjs/src/use-native.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"use-native.js","sourceRoot":"","sources":["../../../src/use-native.ts"],"names":[],"mappings":";;;AAAA,2BAAqC;AACrC,+CAAsD;AAEtD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,OAAO,CAAC,OAAO,CAAA;AAC9E,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACpD,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAElE,QAAA,aAAa,GAAG,CAAC,SAAS;IACrC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK;IACb,CAAC,CAAC,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,SAAS,KAAK,cAAS,CAAA;AAEtD,QAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CACpC,CAAC,SAAS;IACR,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK;IACb,CAAC,CAAC,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAA,qBAAO,EAAC,IAAI,CAAC,CAAC,KAAK,KAAK,UAAK,EAC3D;IACE,IAAI,EAAE,qBAAa;CACpB,CACF,CAAA","sourcesContent":["import { mkdir, mkdirSync } from 'fs'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nconst version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version\nconst versArr = version.replace(/^v/, '').split('.')\nconst hasNative = +versArr[0] > 10 || (+versArr[0] === 10 && +versArr[1] >= 12)\n\nexport const useNativeSync = !hasNative\n  ? () => false\n  : (opts?: MkdirpOptions) => optsArg(opts).mkdirSync === mkdirSync\n\nexport const useNative = Object.assign(\n  !hasNative\n    ? () => false\n    : (opts?: MkdirpOptions) => optsArg(opts).mkdir === mkdir,\n  {\n    sync: useNativeSync,\n  }\n)\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.d.ts
    new file mode 100644
    index 00000000..e47794b3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.d.ts
    @@ -0,0 +1,4 @@
    +import { MkdirpOptionsResolved } from './opts-arg.js';
    +export declare const findMade: (opts: MkdirpOptionsResolved, parent: string, path?: string) => Promise;
    +export declare const findMadeSync: (opts: MkdirpOptionsResolved, parent: string, path?: string) => undefined | string;
    +//# sourceMappingURL=find-made.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.d.ts.map
    new file mode 100644
    index 00000000..411aad14
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"find-made.d.ts","sourceRoot":"","sources":["../../src/find-made.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAErD,eAAO,MAAM,QAAQ,SACb,qBAAqB,UACnB,MAAM,SACP,MAAM,KACZ,QAAQ,SAAS,GAAG,MAAM,CAe5B,CAAA;AAED,eAAO,MAAM,YAAY,SACjB,qBAAqB,UACnB,MAAM,SACP,MAAM,KACZ,SAAS,GAAG,MAad,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.js
    new file mode 100644
    index 00000000..3e72fd59
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.js
    @@ -0,0 +1,30 @@
    +import { dirname } from 'path';
    +export const findMade = async (opts, parent, path) => {
    +    // we never want the 'made' return value to be a root directory
    +    if (path === parent) {
    +        return;
    +    }
    +    return opts.statAsync(parent).then(st => (st.isDirectory() ? path : undefined), // will fail later
    +    // will fail later
    +    er => {
    +        const fer = er;
    +        return fer && fer.code === 'ENOENT'
    +            ? findMade(opts, dirname(parent), parent)
    +            : undefined;
    +    });
    +};
    +export const findMadeSync = (opts, parent, path) => {
    +    if (path === parent) {
    +        return undefined;
    +    }
    +    try {
    +        return opts.statSync(parent).isDirectory() ? path : undefined;
    +    }
    +    catch (er) {
    +        const fer = er;
    +        return fer && fer.code === 'ENOENT'
    +            ? findMadeSync(opts, dirname(parent), parent)
    +            : undefined;
    +    }
    +};
    +//# sourceMappingURL=find-made.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.js.map
    new file mode 100644
    index 00000000..7b58089c
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/find-made.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"find-made.js","sourceRoot":"","sources":["../../src/find-made.ts"],"names":[],"mappings":"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AA","sourcesContent":["import { dirname } from 'path'\nimport { MkdirpOptionsResolved } from './opts-arg.js'\n\nexport const findMade = async (\n  opts: MkdirpOptionsResolved,\n  parent: string,\n  path?: string\n): Promise => {\n  // we never want the 'made' return value to be a root directory\n  if (path === parent) {\n    return\n  }\n\n  return opts.statAsync(parent).then(\n    st => (st.isDirectory() ? path : undefined), // will fail later\n    er => {\n      const fer = er as NodeJS.ErrnoException\n      return fer && fer.code === 'ENOENT'\n        ? findMade(opts, dirname(parent), parent)\n        : undefined\n    }\n  )\n}\n\nexport const findMadeSync = (\n  opts: MkdirpOptionsResolved,\n  parent: string,\n  path?: string\n): undefined | string => {\n  if (path === parent) {\n    return undefined\n  }\n\n  try {\n    return opts.statSync(parent).isDirectory() ? path : undefined\n  } catch (er) {\n    const fer = er as NodeJS.ErrnoException\n    return fer && fer.code === 'ENOENT'\n      ? findMadeSync(opts, dirname(parent), parent)\n      : undefined\n  }\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.d.ts
    new file mode 100644
    index 00000000..fc9e43b3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.d.ts
    @@ -0,0 +1,39 @@
    +import { MkdirpOptions } from './opts-arg.js';
    +export { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js';
    +export { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js';
    +export { useNative, useNativeSync } from './use-native.js';
    +export declare const mkdirpSync: (path: string, opts?: MkdirpOptions) => string | void;
    +export declare const sync: (path: string, opts?: MkdirpOptions) => string | void;
    +export declare const manual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & {
    +    sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +};
    +export declare const manualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +export declare const native: ((path: string, options?: MkdirpOptions | undefined) => Promise) & {
    +    sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +};
    +export declare const nativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +export declare const mkdirp: ((path: string, opts?: MkdirpOptions) => Promise) & {
    +    mkdirpSync: (path: string, opts?: MkdirpOptions) => string | void;
    +    mkdirpNative: ((path: string, options?: MkdirpOptions | undefined) => Promise) & {
    +        sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +    };
    +    mkdirpNativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +    mkdirpManual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & {
    +        sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +    };
    +    mkdirpManualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +    sync: (path: string, opts?: MkdirpOptions) => string | void;
    +    native: ((path: string, options?: MkdirpOptions | undefined) => Promise) & {
    +        sync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +    };
    +    nativeSync: (path: string, options?: MkdirpOptions | undefined) => string | void | undefined;
    +    manual: ((path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => Promise) & {
    +        sync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +    };
    +    manualSync: (path: string, options?: MkdirpOptions | undefined, made?: string | void | undefined) => string | void | undefined;
    +    useNative: ((opts?: MkdirpOptions | undefined) => boolean) & {
    +        sync: (opts?: MkdirpOptions | undefined) => boolean;
    +    };
    +    useNativeSync: (opts?: MkdirpOptions | undefined) => boolean;
    +};
    +//# sourceMappingURL=index.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.d.ts.map
    new file mode 100644
    index 00000000..cfcc7808
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAItD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG1D,eAAO,MAAM,UAAU,SAAU,MAAM,SAAS,aAAa,kBAM5D,CAAA;AAED,eAAO,MAAM,IAAI,SARgB,MAAM,SAAS,aAAa,kBAQ/B,CAAA;AAC9B,eAAO,MAAM,MAAM;;CAAe,CAAA;AAClC,eAAO,MAAM,UAAU,oHAAmB,CAAA;AAC1C,eAAO,MAAM,MAAM;;CAAe,CAAA;AAClC,eAAO,MAAM,UAAU,kFAAmB,CAAA;AAC1C,eAAO,MAAM,MAAM,UACJ,MAAM,SAAS,aAAa;uBAdV,MAAM,SAAS,aAAa;;;;;;;;;iBAA5B,MAAM,SAAS,aAAa;;;;;;;;;;;;;CAoC5D,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.js
    new file mode 100644
    index 00000000..0217ecc8
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.js
    @@ -0,0 +1,43 @@
    +import { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js';
    +import { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js';
    +import { optsArg } from './opts-arg.js';
    +import { pathArg } from './path-arg.js';
    +import { useNative, useNativeSync } from './use-native.js';
    +/* c8 ignore start */
    +export { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js';
    +export { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js';
    +export { useNative, useNativeSync } from './use-native.js';
    +/* c8 ignore stop */
    +export const mkdirpSync = (path, opts) => {
    +    path = pathArg(path);
    +    const resolved = optsArg(opts);
    +    return useNativeSync(resolved)
    +        ? mkdirpNativeSync(path, resolved)
    +        : mkdirpManualSync(path, resolved);
    +};
    +export const sync = mkdirpSync;
    +export const manual = mkdirpManual;
    +export const manualSync = mkdirpManualSync;
    +export const native = mkdirpNative;
    +export const nativeSync = mkdirpNativeSync;
    +export const mkdirp = Object.assign(async (path, opts) => {
    +    path = pathArg(path);
    +    const resolved = optsArg(opts);
    +    return useNative(resolved)
    +        ? mkdirpNative(path, resolved)
    +        : mkdirpManual(path, resolved);
    +}, {
    +    mkdirpSync,
    +    mkdirpNative,
    +    mkdirpNativeSync,
    +    mkdirpManual,
    +    mkdirpManualSync,
    +    sync: mkdirpSync,
    +    native: mkdirpNative,
    +    nativeSync: mkdirpNativeSync,
    +    manual: mkdirpManual,
    +    manualSync: mkdirpManualSync,
    +    useNative,
    +    useNativeSync,
    +});
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.js.map
    new file mode 100644
    index 00000000..47a8133a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/index.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO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CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC;QAC9B,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAClC,CAAC,EACD;IACE,UAAU;IACV,YAAY;IACZ,gBAAgB;IAChB,YAAY;IACZ,gBAAgB;IAEhB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,YAAY;IACpB,UAAU,EAAE,gBAAgB;IAC5B,SAAS;IACT,aAAa;CACd,CACF,CAAA","sourcesContent":["import { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nimport { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\nimport { pathArg } from './path-arg.js'\nimport { useNative, useNativeSync } from './use-native.js'\n/* c8 ignore start */\nexport { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nexport { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'\nexport { useNative, useNativeSync } from './use-native.js'\n/* c8 ignore stop */\n\nexport const mkdirpSync = (path: string, opts?: MkdirpOptions) => {\n  path = pathArg(path)\n  const resolved = optsArg(opts)\n  return useNativeSync(resolved)\n    ? mkdirpNativeSync(path, resolved)\n    : mkdirpManualSync(path, resolved)\n}\n\nexport const sync = mkdirpSync\nexport const manual = mkdirpManual\nexport const manualSync = mkdirpManualSync\nexport const native = mkdirpNative\nexport const nativeSync = mkdirpNativeSync\nexport const mkdirp = Object.assign(\n  async (path: string, opts?: MkdirpOptions) => {\n    path = pathArg(path)\n    const resolved = optsArg(opts)\n    return useNative(resolved)\n      ? mkdirpNative(path, resolved)\n      : mkdirpManual(path, resolved)\n  },\n  {\n    mkdirpSync,\n    mkdirpNative,\n    mkdirpNativeSync,\n    mkdirpManual,\n    mkdirpManualSync,\n\n    sync: mkdirpSync,\n    native: mkdirpNative,\n    nativeSync: mkdirpNativeSync,\n    manual: mkdirpManual,\n    manualSync: mkdirpManualSync,\n    useNative,\n    useNativeSync,\n  }\n)\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts
    new file mode 100644
    index 00000000..e49cdf9f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts
    @@ -0,0 +1,6 @@
    +import { MkdirpOptions } from './opts-arg.js';
    +export declare const mkdirpManualSync: (path: string, options?: MkdirpOptions, made?: string | undefined | void) => string | undefined | void;
    +export declare const mkdirpManual: ((path: string, options?: MkdirpOptions, made?: string | undefined | void) => Promise) & {
    +    sync: (path: string, options?: MkdirpOptions, made?: string | undefined | void) => string | undefined | void;
    +};
    +//# sourceMappingURL=mkdirp-manual.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts.map
    new file mode 100644
    index 00000000..ae7f243d
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"mkdirp-manual.d.ts","sourceRoot":"","sources":["../../src/mkdirp-manual.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,gBAAgB,SACrB,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,MAAM,GAAG,SAAS,GAAG,IAmCvB,CAAA;AAED,eAAO,MAAM,YAAY,UAEf,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;iBA7C/B,MAAM,YACF,aAAa,SAChB,MAAM,GAAG,SAAS,GAAG,IAAI,KAC/B,MAAM,GAAG,SAAS,GAAG,IAAI;CAqF3B,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.js
    new file mode 100644
    index 00000000..a4d044e0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.js
    @@ -0,0 +1,75 @@
    +import { dirname } from 'path';
    +import { optsArg } from './opts-arg.js';
    +export const mkdirpManualSync = (path, options, made) => {
    +    const parent = dirname(path);
    +    const opts = { ...optsArg(options), recursive: false };
    +    if (parent === path) {
    +        try {
    +            return opts.mkdirSync(path, opts);
    +        }
    +        catch (er) {
    +            // swallowed by recursive implementation on posix systems
    +            // any other error is a failure
    +            const fer = er;
    +            if (fer && fer.code !== 'EISDIR') {
    +                throw er;
    +            }
    +            return;
    +        }
    +    }
    +    try {
    +        opts.mkdirSync(path, opts);
    +        return made || path;
    +    }
    +    catch (er) {
    +        const fer = er;
    +        if (fer && fer.code === 'ENOENT') {
    +            return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made));
    +        }
    +        if (fer && fer.code !== 'EEXIST' && fer && fer.code !== 'EROFS') {
    +            throw er;
    +        }
    +        try {
    +            if (!opts.statSync(path).isDirectory())
    +                throw er;
    +        }
    +        catch (_) {
    +            throw er;
    +        }
    +    }
    +};
    +export const mkdirpManual = Object.assign(async (path, options, made) => {
    +    const opts = optsArg(options);
    +    opts.recursive = false;
    +    const parent = dirname(path);
    +    if (parent === path) {
    +        return opts.mkdirAsync(path, opts).catch(er => {
    +            // swallowed by recursive implementation on posix systems
    +            // any other error is a failure
    +            const fer = er;
    +            if (fer && fer.code !== 'EISDIR') {
    +                throw er;
    +            }
    +        });
    +    }
    +    return opts.mkdirAsync(path, opts).then(() => made || path, async (er) => {
    +        const fer = er;
    +        if (fer && fer.code === 'ENOENT') {
    +            return mkdirpManual(parent, opts).then((made) => mkdirpManual(path, opts, made));
    +        }
    +        if (fer && fer.code !== 'EEXIST' && fer.code !== 'EROFS') {
    +            throw er;
    +        }
    +        return opts.statAsync(path).then(st => {
    +            if (st.isDirectory()) {
    +                return made;
    +            }
    +            else {
    +                throw er;
    +            }
    +        }, () => {
    +            throw er;
    +        });
    +    });
    +}, { sync: mkdirpManualSync });
    +//# sourceMappingURL=mkdirp-manual.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.js.map
    new file mode 100644
    index 00000000..29eab250
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-manual.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"mkdirp-manual.js","sourceRoot":"","sources":["../../src/mkdirp-manual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAiB,OAAO,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,IAAY,EACZ,OAAuB,EACvB,IAAgC,EACL,EAAE;IAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;IAEtD,IAAI,MAAM,KAAK,IAAI,EAAE;QACnB,IAAI;YACF,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SAClC;QAAC,OAAO,EAAE,EAAE;YACX,yDAAyD;YACzD,+BAA+B;YAC/B,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AAyD;YACzD,+BAA+B;YAC/B,MAAM,GAAG,GAAG,EAA2B,CAAA;YACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAChC,MAAM,EAAE,CAAA;aACT;QACH,CAAC,CAAC,CAAA;KACH;IAED,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CACrC,GAAG,EAAE,CAAC,IAAI,IAAI,IAAI,EAClB,KAAK,EAAC,EAAE,EAAC,EAAE;QACT,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;YAChC,OAAO,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,CACpC,CAAC,IAAgC,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CACrE,CAAA;SACF;QACD,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE;YACxD,MAAM,EAAE,CAAA;SACT;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAC9B,EAAE,CAAC,EAAE;YACH,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;gBACpB,OAAO,IAAI,CAAA;aACZ;iBAAM;gBACL,MAAM,EAAE,CAAA;aACT;QACH,CAAC,EACD,GAAG,EAAE;YACH,MAAM,EAAE,CAAA;QACV,CAAC,CACF,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC,EACD,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAC3B,CAAA","sourcesContent":["import { dirname } from 'path'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nexport const mkdirpManualSync = (\n  path: string,\n  options?: MkdirpOptions,\n  made?: string | undefined | void\n): string | undefined | void => {\n  const parent = dirname(path)\n  const opts = { ...optsArg(options), recursive: false }\n\n  if (parent === path) {\n    try {\n      return opts.mkdirSync(path, opts)\n    } catch (er) {\n      // swallowed by recursive implementation on posix systems\n      // any other error is a failure\n      const fer = er as NodeJS.ErrnoException\n      if (fer && fer.code !== 'EISDIR') {\n        throw er\n      }\n      return\n    }\n  }\n\n  try {\n    opts.mkdirSync(path, opts)\n    return made || path\n  } catch (er) {\n    const fer = er as NodeJS.ErrnoException\n    if (fer && fer.code === 'ENOENT') {\n      return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))\n    }\n    if (fer && fer.code !== 'EEXIST' && fer && fer.code !== 'EROFS') {\n      throw er\n    }\n    try {\n      if (!opts.statSync(path).isDirectory()) throw er\n    } catch (_) {\n      throw er\n    }\n  }\n}\n\nexport const mkdirpManual = Object.assign(\n  async (\n    path: string,\n    options?: MkdirpOptions,\n    made?: string | undefined | void\n  ): Promise => {\n    const opts = optsArg(options)\n    opts.recursive = false\n    const parent = dirname(path)\n    if (parent === path) {\n      return opts.mkdirAsync(path, opts).catch(er => {\n        // swallowed by recursive implementation on posix systems\n        // any other error is a failure\n        const fer = er as NodeJS.ErrnoException\n        if (fer && fer.code !== 'EISDIR') {\n          throw er\n        }\n      })\n    }\n\n    return opts.mkdirAsync(path, opts).then(\n      () => made || path,\n      async er => {\n        const fer = er as NodeJS.ErrnoException\n        if (fer && fer.code === 'ENOENT') {\n          return mkdirpManual(parent, opts).then(\n            (made?: string | undefined | void) => mkdirpManual(path, opts, made)\n          )\n        }\n        if (fer && fer.code !== 'EEXIST' && fer.code !== 'EROFS') {\n          throw er\n        }\n        return opts.statAsync(path).then(\n          st => {\n            if (st.isDirectory()) {\n              return made\n            } else {\n              throw er\n            }\n          },\n          () => {\n            throw er\n          }\n        )\n      }\n    )\n  },\n  { sync: mkdirpManualSync }\n)\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts
    new file mode 100644
    index 00000000..28b64814
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts
    @@ -0,0 +1,6 @@
    +import { MkdirpOptions } from './opts-arg.js';
    +export declare const mkdirpNativeSync: (path: string, options?: MkdirpOptions) => string | void | undefined;
    +export declare const mkdirpNative: ((path: string, options?: MkdirpOptions) => Promise) & {
    +    sync: (path: string, options?: MkdirpOptions) => string | void | undefined;
    +};
    +//# sourceMappingURL=mkdirp-native.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts.map
    new file mode 100644
    index 00000000..517dfabe
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"mkdirp-native.d.ts","sourceRoot":"","sources":["../../src/mkdirp-native.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,gBAAgB,SACrB,MAAM,YACF,aAAa,KACtB,MAAM,GAAG,IAAI,GAAG,SAoBlB,CAAA;AAED,eAAO,MAAM,YAAY,UAEf,MAAM,YACF,aAAa,KACtB,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;iBA5B/B,MAAM,YACF,aAAa,KACtB,MAAM,GAAG,IAAI,GAAG,SAAS;CAgD3B,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.js
    new file mode 100644
    index 00000000..99d10a54
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.js
    @@ -0,0 +1,46 @@
    +import { dirname } from 'path';
    +import { findMade, findMadeSync } from './find-made.js';
    +import { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js';
    +import { optsArg } from './opts-arg.js';
    +export const mkdirpNativeSync = (path, options) => {
    +    const opts = optsArg(options);
    +    opts.recursive = true;
    +    const parent = dirname(path);
    +    if (parent === path) {
    +        return opts.mkdirSync(path, opts);
    +    }
    +    const made = findMadeSync(opts, path);
    +    try {
    +        opts.mkdirSync(path, opts);
    +        return made;
    +    }
    +    catch (er) {
    +        const fer = er;
    +        if (fer && fer.code === 'ENOENT') {
    +            return mkdirpManualSync(path, opts);
    +        }
    +        else {
    +            throw er;
    +        }
    +    }
    +};
    +export const mkdirpNative = Object.assign(async (path, options) => {
    +    const opts = { ...optsArg(options), recursive: true };
    +    const parent = dirname(path);
    +    if (parent === path) {
    +        return await opts.mkdirAsync(path, opts);
    +    }
    +    return findMade(opts, path).then((made) => opts
    +        .mkdirAsync(path, opts)
    +        .then(m => made || m)
    +        .catch(er => {
    +        const fer = er;
    +        if (fer && fer.code === 'ENOENT') {
    +            return mkdirpManual(path, opts);
    +        }
    +        else {
    +            throw er;
    +        }
    +    }));
    +}, { sync: mkdirpNativeSync });
    +//# sourceMappingURL=mkdirp-native.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.js.map
    new file mode 100644
    index 00000000..27de32d9
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/mkdirp-native.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"mkdirp-native.js","sourceRoot":"","sources":["../../src/mkdirp-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAC9B,OAAO,EAAE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AAC,IAAI,EAAE,IAAI,CAAC,CAAA;KACzC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAyB,EAAE,EAAE,CAC7D,IAAI;SACD,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC;SACtB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC;SACpB,KAAK,CAAC,EAAE,CAAC,EAAE;QACV,MAAM,GAAG,GAAG,EAA2B,CAAA;QACvC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;YAChC,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;SAChC;aAAM;YACL,MAAM,EAAE,CAAA;SACT;IACH,CAAC,CAAC,CACL,CAAA;AACH,CAAC,EACD,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAC3B,CAAA","sourcesContent":["import { dirname } from 'path'\nimport { findMade, findMadeSync } from './find-made.js'\nimport { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nexport const mkdirpNativeSync = (\n  path: string,\n  options?: MkdirpOptions\n): string | void | undefined => {\n  const opts = optsArg(options)\n  opts.recursive = true\n  const parent = dirname(path)\n  if (parent === path) {\n    return opts.mkdirSync(path, opts)\n  }\n\n  const made = findMadeSync(opts, path)\n  try {\n    opts.mkdirSync(path, opts)\n    return made\n  } catch (er) {\n    const fer = er as NodeJS.ErrnoException\n    if (fer && fer.code === 'ENOENT') {\n      return mkdirpManualSync(path, opts)\n    } else {\n      throw er\n    }\n  }\n}\n\nexport const mkdirpNative = Object.assign(\n  async (\n    path: string,\n    options?: MkdirpOptions\n  ): Promise => {\n    const opts = { ...optsArg(options), recursive: true }\n    const parent = dirname(path)\n    if (parent === path) {\n      return await opts.mkdirAsync(path, opts)\n    }\n\n    return findMade(opts, path).then((made?: string | undefined) =>\n      opts\n        .mkdirAsync(path, opts)\n        .then(m => made || m)\n        .catch(er => {\n          const fer = er as NodeJS.ErrnoException\n          if (fer && fer.code === 'ENOENT') {\n            return mkdirpManual(path, opts)\n          } else {\n            throw er\n          }\n        })\n    )\n  },\n  { sync: mkdirpNativeSync }\n)\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.d.ts
    new file mode 100644
    index 00000000..73d076b3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.d.ts
    @@ -0,0 +1,42 @@
    +/// 
    +/// 
    +import { MakeDirectoryOptions, Stats } from 'fs';
    +export interface FsProvider {
    +    stat?: (path: string, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any) => any;
    +    mkdir?: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }, callback: (err: NodeJS.ErrnoException | null, made?: string) => any) => any;
    +    statSync?: (path: string) => Stats;
    +    mkdirSync?: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }) => string | undefined;
    +}
    +interface Options extends FsProvider {
    +    mode?: number | string;
    +    fs?: FsProvider;
    +    mkdirAsync?: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }) => Promise;
    +    statAsync?: (path: string) => Promise;
    +}
    +export type MkdirpOptions = Options | number | string;
    +export interface MkdirpOptionsResolved {
    +    mode: number;
    +    fs: FsProvider;
    +    mkdirAsync: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }) => Promise;
    +    statAsync: (path: string) => Promise;
    +    stat: (path: string, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any) => any;
    +    mkdir: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }, callback: (err: NodeJS.ErrnoException | null, made?: string) => any) => any;
    +    statSync: (path: string) => Stats;
    +    mkdirSync: (path: string, opts: MakeDirectoryOptions & {
    +        recursive?: boolean;
    +    }) => string | undefined;
    +    recursive?: boolean;
    +}
    +export declare const optsArg: (opts?: MkdirpOptions) => MkdirpOptionsResolved;
    +export {};
    +//# sourceMappingURL=opts-arg.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.d.ts.map
    new file mode 100644
    index 00000000..717deb5f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"opts-arg.d.ts","sourceRoot":"","sources":["../../src/opts-arg.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,oBAAoB,EAIpB,KAAK,EAEN,MAAM,IAAI,CAAA;AAEX,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,CACL,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,GAAG,KAC/D,GAAG,CAAA;IACR,KAAK,CAAC,EAAE,CACN,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,EACpD,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,KAChE,GAAG,CAAA;IACR,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAA;IAClC,SAAS,CAAC,EAAE,CACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KACjD,MAAM,GAAG,SAA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KAAK,KAAK,CAAA;IACjC,SAAS,EAAE,CACT,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,GAAG;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KACjD,MAAM,GAAG,SAAS,CAAA;IACvB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,OAAO,UAAW,aAAa,KAAG,qBA2C9C,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.js
    new file mode 100644
    index 00000000..d47e2927
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.js
    @@ -0,0 +1,34 @@
    +import { mkdir, mkdirSync, stat, statSync, } from 'fs';
    +export const optsArg = (opts) => {
    +    if (!opts) {
    +        opts = { mode: 0o777 };
    +    }
    +    else if (typeof opts === 'object') {
    +        opts = { mode: 0o777, ...opts };
    +    }
    +    else if (typeof opts === 'number') {
    +        opts = { mode: opts };
    +    }
    +    else if (typeof opts === 'string') {
    +        opts = { mode: parseInt(opts, 8) };
    +    }
    +    else {
    +        throw new TypeError('invalid options argument');
    +    }
    +    const resolved = opts;
    +    const optsFs = opts.fs || {};
    +    opts.mkdir = opts.mkdir || optsFs.mkdir || mkdir;
    +    opts.mkdirAsync = opts.mkdirAsync
    +        ? opts.mkdirAsync
    +        : async (path, options) => {
    +            return new Promise((res, rej) => resolved.mkdir(path, options, (er, made) => er ? rej(er) : res(made)));
    +        };
    +    opts.stat = opts.stat || optsFs.stat || stat;
    +    opts.statAsync = opts.statAsync
    +        ? opts.statAsync
    +        : async (path) => new Promise((res, rej) => resolved.stat(path, (err, stats) => (err ? rej(err) : res(stats))));
    +    opts.statSync = opts.statSync || optsFs.statSync || statSync;
    +    opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || mkdirSync;
    +    return resolved;
    +};
    +//# sourceMappingURL=opts-arg.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.js.map
    new file mode 100644
    index 00000000..663286dc
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/opts-arg.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"opts-arg.js","sourceRoot":"","sources":["../../src/opts-arg.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,SAAS,EACT,IAAI,EAEJ,QAAQ,GACT,MAAM,IAAI,CAAA;AAwDX,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAoB,EAAyB,EAAE;IACrE,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;KACvB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,IAAI,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,CAAA;KAChC;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;KACtB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACnC,IAAI,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAA;KACnC;SAAM;QACL,MAAM,IAAI,SAAS,CAAC,0BAA0B,CAAC,CAAA;KAChD;IAED,MAAM,QAAQ,GAAG,IAA6B,CAAA;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;IAE5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,KAAK,CAAA;IAEhD,IAAI,CAAC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nexport interface FsProvider {\n  stat?: (\n    path: string,\n    callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any\n  ) => any\n  mkdir?: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean },\n    callback: (err: NodeJS.ErrnoException | null, made?: string) => any\n  ) => any\n  statSync?: (path: string) => Stats\n  mkdirSync?: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean }\n  ) => string | undefined\n}\n\ninterface Options extends FsProvider {\n  mode?: number | string\n  fs?: FsProvider\n  mkdirAsync?: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean }\n  ) => Promise\n  statAsync?: (path: string) => Promise\n}\n\nexport type MkdirpOptions = Options | number | string\n\nexport interface MkdirpOptionsResolved {\n  mode: number\n  fs: FsProvider\n  mkdirAsync: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean }\n  ) => Promise\n  statAsync: (path: string) => Promise\n  stat: (\n    path: string,\n    callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any\n  ) => any\n  mkdir: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean },\n    callback: (err: NodeJS.ErrnoException | null, made?: string) => any\n  ) => any\n  statSync: (path: string) => Stats\n  mkdirSync: (\n    path: string,\n    opts: MakeDirectoryOptions & { recursive?: boolean }\n  ) => string | undefined\n  recursive?: boolean\n}\n\nexport const optsArg = (opts?: MkdirpOptions): MkdirpOptionsResolved => {\n  if (!opts) {\n    opts = { mode: 0o777 }\n  } else if (typeof opts === 'object') {\n    opts = { mode: 0o777, ...opts }\n  } else if (typeof opts === 'number') {\n    opts = { mode: opts }\n  } else if (typeof opts === 'string') {\n    opts = { mode: parseInt(opts, 8) }\n  } else {\n    throw new TypeError('invalid options argument')\n  }\n\n  const resolved = opts as MkdirpOptionsResolved\n  const optsFs = opts.fs || {}\n\n  opts.mkdir = opts.mkdir || optsFs.mkdir || mkdir\n\n  opts.mkdirAsync = opts.mkdirAsync\n    ? opts.mkdirAsync\n    : async (\n        path: string,\n        options: MakeDirectoryOptions & { recursive?: boolean }\n      ): Promise => {\n        return new Promise((res, rej) =>\n          resolved.mkdir(path, options, (er, made) =>\n            er ? rej(er) : res(made)\n          )\n        )\n      }\n\n  opts.stat = opts.stat || optsFs.stat || stat\n  opts.statAsync = opts.statAsync\n    ? opts.statAsync\n    : async (path: string) =>\n        new Promise((res, rej) =>\n          resolved.stat(path, (err, stats) => (err ? rej(err) : res(stats)))\n        )\n\n  opts.statSync = opts.statSync || optsFs.statSync || statSync\n  opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || mkdirSync\n\n  return resolved\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.d.ts
    new file mode 100644
    index 00000000..ad0ccfc4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.d.ts
    @@ -0,0 +1,2 @@
    +export declare const pathArg: (path: string) => string;
    +//# sourceMappingURL=path-arg.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.d.ts.map
    new file mode 100644
    index 00000000..801799e7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"path-arg.d.ts","sourceRoot":"","sources":["../../src/path-arg.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,SAAU,MAAM,WAyBnC,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.js
    new file mode 100644
    index 00000000..03539cc5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.js
    @@ -0,0 +1,24 @@
    +const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform;
    +import { parse, resolve } from 'path';
    +export const pathArg = (path) => {
    +    if (/\0/.test(path)) {
    +        // simulate same failure that node raises
    +        throw Object.assign(new TypeError('path must be a string without null bytes'), {
    +            path,
    +            code: 'ERR_INVALID_ARG_VALUE',
    +        });
    +    }
    +    path = resolve(path);
    +    if (platform === 'win32') {
    +        const badWinChars = /[*|"<>?:]/;
    +        const { root } = parse(path);
    +        if (badWinChars.test(path.substring(root.length))) {
    +            throw Object.assign(new Error('Illegal characters in path.'), {
    +                path,
    +                code: 'EINVAL',
    +            });
    +        }
    +    }
    +    return path;
    +};
    +//# sourceMappingURL=path-arg.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.js.map
    new file mode 100644
    index 00000000..43efe1e3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/path-arg.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"path-arg.js","sourceRoot":"","sources":["../../src/path-arg.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,OAAO,CAAC,QAAQ,CAAA;AAC5E,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACrC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE;IACtC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACnB,yCAAyC;QACzC,MAAM,MAAM,CAAC,MAAM,CACjB,IAAI,SAAS,CAAC,0CAA0C,CAAC,EACzD;YACE,IAAI;YACJ,IAAI,EAAE,uBAAuB;SAC9B,CACF,CAAA;KACF;IAED,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpB,IAAI,QAAQ,KAAK,OAAO,EAAE;QACxB,MAAM,WAAW,GAAG,WAAW,CAAA;QAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE;YACjD,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,EAAE;gBAC5D,IAAI;gBACJ,IAAI,EAAE,QAAQ;aACf,CAAC,CAAA;SACH;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA","sourcesContent":["const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform\nimport { parse, resolve } from 'path'\nexport const pathArg = (path: string) => {\n  if (/\\0/.test(path)) {\n    // simulate same failure that node raises\n    throw Object.assign(\n      new TypeError('path must be a string without null bytes'),\n      {\n        path,\n        code: 'ERR_INVALID_ARG_VALUE',\n      }\n    )\n  }\n\n  path = resolve(path)\n  if (platform === 'win32') {\n    const badWinChars = /[*|\"<>?:]/\n    const { root } = parse(path)\n    if (badWinChars.test(path.substring(root.length))) {\n      throw Object.assign(new Error('Illegal characters in path.'), {\n        path,\n        code: 'EINVAL',\n      })\n    }\n  }\n\n  return path\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.d.ts b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.d.ts
    new file mode 100644
    index 00000000..1c6cb619
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.d.ts
    @@ -0,0 +1,6 @@
    +import { MkdirpOptions } from './opts-arg.js';
    +export declare const useNativeSync: (opts?: MkdirpOptions) => boolean;
    +export declare const useNative: ((opts?: MkdirpOptions) => boolean) & {
    +    sync: (opts?: MkdirpOptions) => boolean;
    +};
    +//# sourceMappingURL=use-native.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.d.ts.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.d.ts.map
    new file mode 100644
    index 00000000..e2484228
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"use-native.d.ts","sourceRoot":"","sources":["../../src/use-native.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAW,MAAM,eAAe,CAAA;AAMtD,eAAO,MAAM,aAAa,UAEd,aAAa,YAA0C,CAAA;AAEnE,eAAO,MAAM,SAAS,WAGR,aAAa;kBALf,aAAa;CASxB,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.js b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.js
    new file mode 100644
    index 00000000..ad209386
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.js
    @@ -0,0 +1,14 @@
    +import { mkdir, mkdirSync } from 'fs';
    +import { optsArg } from './opts-arg.js';
    +const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version;
    +const versArr = version.replace(/^v/, '').split('.');
    +const hasNative = +versArr[0] > 10 || (+versArr[0] === 10 && +versArr[1] >= 12);
    +export const useNativeSync = !hasNative
    +    ? () => false
    +    : (opts) => optsArg(opts).mkdirSync === mkdirSync;
    +export const useNative = Object.assign(!hasNative
    +    ? () => false
    +    : (opts) => optsArg(opts).mkdir === mkdir, {
    +    sync: useNativeSync,
    +});
    +//# sourceMappingURL=use-native.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.js.map b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.js.map
    new file mode 100644
    index 00000000..08c616d3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/dist/mjs/use-native.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"use-native.js","sourceRoot":"","sources":["../../src/use-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AACrC,OAAO,EAAiB,OAAO,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,OAAO,CAAC,OAAO,CAAA;AAC9E,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACpD,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS;IACrC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK;IACb,CAAC,CAAC,CAAC,IAAoB,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,CAAA;AAEnE,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CACpC,CAAC,SAAS;IACR,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK;IACb,CAAC,CAAC,CAAC,IAAoB,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,EAC3D;IACE,IAAI,EAAE,aAAa;CACpB,CACF,CAAA","sourcesContent":["import { mkdir, mkdirSync } from 'fs'\nimport { MkdirpOptions, optsArg } from './opts-arg.js'\n\nconst version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version\nconst versArr = version.replace(/^v/, '').split('.')\nconst hasNative = +versArr[0] > 10 || (+versArr[0] === 10 && +versArr[1] >= 12)\n\nexport const useNativeSync = !hasNative\n  ? () => false\n  : (opts?: MkdirpOptions) => optsArg(opts).mkdirSync === mkdirSync\n\nexport const useNative = Object.assign(\n  !hasNative\n    ? () => false\n    : (opts?: MkdirpOptions) => optsArg(opts).mkdir === mkdir,\n  {\n    sync: useNativeSync,\n  }\n)\n"]}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/package.json
    new file mode 100644
    index 00000000..f31ac331
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/package.json
    @@ -0,0 +1,91 @@
    +{
    +  "name": "mkdirp",
    +  "description": "Recursively mkdir, like `mkdir -p`",
    +  "version": "3.0.1",
    +  "keywords": [
    +    "mkdir",
    +    "directory",
    +    "make dir",
    +    "make",
    +    "dir",
    +    "recursive",
    +    "native"
    +  ],
    +  "bin": "./dist/cjs/src/bin.js",
    +  "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",
    +    "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"
    +  },
    +  "devDependencies": {
    +    "@types/brace-expansion": "^1.1.0",
    +    "@types/node": "^18.11.9",
    +    "@types/tap": "^15.0.7",
    +    "c8": "^7.12.0",
    +    "eslint-config-prettier": "^8.6.0",
    +    "prettier": "^2.8.2",
    +    "tap": "^16.3.3",
    +    "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"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "https://github.com/isaacs/node-mkdirp.git"
    +  },
    +  "license": "MIT",
    +  "engines": {
    +    "node": ">=10"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/readme.markdown b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/readme.markdown
    new file mode 100644
    index 00000000..df654b80
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/mkdirp/readme.markdown
    @@ -0,0 +1,281 @@
    +# mkdirp
    +
    +Like `mkdir -p`, but in Node.js!
    +
    +Now with a modern API and no\* bugs!
    +
    +\* may contain some bugs
    +
    +# example
    +
    +## pow.js
    +
    +```js
    +// hybrid module, import or require() both work
    +import { mkdirp } from 'mkdirp'
    +// or:
    +const { mkdirp } = require('mkdirp')
    +
    +// return value is a Promise resolving to the first directory created
    +mkdirp('/tmp/foo/bar/baz').then(made =>
    +  console.log(`made directories, starting with ${made}`)
    +)
    +```
    +
    +Output (where `/tmp/foo` already exists)
    +
    +```
    +made directories, starting with /tmp/foo/bar
    +```
    +
    +Or, if you don't have time to wait around for promises:
    +
    +```js
    +import { mkdirp } from 'mkdirp'
    +
    +// return value is the first directory created
    +const made = mkdirp.sync('/tmp/foo/bar/baz')
    +console.log(`made directories, starting with ${made}`)
    +```
    +
    +And now /tmp/foo/bar/baz exists, huzzah!
    +
    +# methods
    +
    +```js
    +import { mkdirp } from 'mkdirp'
    +```
    +
    +## `mkdirp(dir: string, opts?: MkdirpOptions) => Promise`
    +
    +Create a new directory and any necessary subdirectories at `dir`
    +with octal permission string `opts.mode`. If `opts` is a string
    +or number, it will be treated as the `opts.mode`.
    +
    +If `opts.mode` isn't specified, it defaults to `0o777`.
    +
    +Promise resolves to first directory `made` that had to be
    +created, or `undefined` if everything already exists. Promise
    +rejects if any errors are encountered. Note that, in the case of
    +promise rejection, some directories _may_ have been created, as
    +recursive directory creation is not an atomic operation.
    +
    +You can optionally pass in an alternate `fs` implementation by
    +passing in `opts.fs`. Your implementation should have
    +`opts.fs.mkdir(path, opts, cb)` and `opts.fs.stat(path, cb)`.
    +
    +You can also override just one or the other of `mkdir` and `stat`
    +by passing in `opts.stat` or `opts.mkdir`, or providing an `fs`
    +option that only overrides one of these.
    +
    +## `mkdirp.sync(dir: string, opts: MkdirpOptions) => string|undefined`
    +
    +Synchronously create a new directory and any necessary
    +subdirectories at `dir` with octal permission string `opts.mode`.
    +If `opts` is a string or number, it will be treated as the
    +`opts.mode`.
    +
    +If `opts.mode` isn't specified, it defaults to `0o777`.
    +
    +Returns the first directory that had to be created, or undefined
    +if everything already exists.
    +
    +You can optionally pass in an alternate `fs` implementation by
    +passing in `opts.fs`. Your implementation should have
    +`opts.fs.mkdirSync(path, mode)` and `opts.fs.statSync(path)`.
    +
    +You can also override just one or the other of `mkdirSync` and
    +`statSync` by passing in `opts.statSync` or `opts.mkdirSync`, or
    +providing an `fs` option that only overrides one of these.
    +
    +## `mkdirp.manual`, `mkdirp.manualSync`
    +
    +Use the manual implementation (not the native one). This is the
    +default when the native implementation is not available or the
    +stat/mkdir implementation is overridden.
    +
    +## `mkdirp.native`, `mkdirp.nativeSync`
    +
    +Use the native implementation (not the manual one). This is the
    +default when the native implementation is available and
    +stat/mkdir are not overridden.
    +
    +# implementation
    +
    +On Node.js v10.12.0 and above, use the native `fs.mkdir(p,
    +{recursive:true})` option, unless `fs.mkdir`/`fs.mkdirSync` has
    +been overridden by an option.
    +
    +## native implementation
    +
    +- If the path is a root directory, then pass it to the underlying
    +  implementation and return the result/error. (In this case,
    +  it'll either succeed or fail, but we aren't actually creating
    +  any dirs.)
    +- Walk up the path statting each directory, to find the first
    +  path that will be created, `made`.
    +- Call `fs.mkdir(path, { recursive: true })` (or `fs.mkdirSync`)
    +- If error, raise it to the caller.
    +- Return `made`.
    +
    +## manual implementation
    +
    +- Call underlying `fs.mkdir` implementation, with `recursive:
    +false`
    +- If error:
    +  - If path is a root directory, raise to the caller and do not
    +    handle it
    +  - If ENOENT, mkdirp parent dir, store result as `made`
    +  - stat(path)
    +    - If error, raise original `mkdir` error
    +    - If directory, return `made`
    +    - Else, raise original `mkdir` error
    +- else
    +  - return `undefined` if a root dir, or `made` if set, or `path`
    +
    +## windows vs unix caveat
    +
    +On Windows file systems, attempts to create a root directory (ie,
    +a drive letter or root UNC path) will fail. If the root
    +directory exists, then it will fail with `EPERM`. If the root
    +directory does not exist, then it will fail with `ENOENT`.
    +
    +On posix file systems, attempts to create a root directory (in
    +recursive mode) will succeed silently, as it is treated like just
    +another directory that already exists. (In non-recursive mode,
    +of course, it fails with `EEXIST`.)
    +
    +In order to preserve this system-specific behavior (and because
    +it's not as if we can create the parent of a root directory
    +anyway), attempts to create a root directory are passed directly
    +to the `fs` implementation, and any errors encountered are not
    +handled.
    +
    +## native error caveat
    +
    +The native implementation (as of at least Node.js v13.4.0) does
    +not provide appropriate errors in some cases (see
    +[nodejs/node#31481](https://github.com/nodejs/node/issues/31481)
    +and
    +[nodejs/node#28015](https://github.com/nodejs/node/issues/28015)).
    +
    +In order to work around this issue, the native implementation
    +will fall back to the manual implementation if an `ENOENT` error
    +is encountered.
    +
    +# choosing a recursive mkdir implementation
    +
    +There are a few to choose from! Use the one that suits your
    +needs best :D
    +
    +## use `fs.mkdir(path, {recursive: true}, cb)` if:
    +
    +- You wish to optimize performance even at the expense of other
    +  factors.
    +- You don't need to know the first dir created.
    +- You are ok with getting `ENOENT` as the error when some other
    +  problem is the actual cause.
    +- You can limit your platforms to Node.js v10.12 and above.
    +- You're ok with using callbacks instead of promises.
    +- You don't need/want a CLI.
    +- You don't need to override the `fs` methods in use.
    +
    +## use this module (mkdirp 1.x or 2.x) if:
    +
    +- You need to know the first directory that was created.
    +- You wish to use the native implementation if available, but
    +  fall back when it's not.
    +- You prefer promise-returning APIs to callback-taking APIs.
    +- You want more useful error messages than the native recursive
    +  mkdir provides (at least as of Node.js v13.4), and are ok with
    +  re-trying on `ENOENT` to achieve this.
    +- You need (or at least, are ok with) a CLI.
    +- You need to override the `fs` methods in use.
    +
    +## use [`make-dir`](http://npm.im/make-dir) if:
    +
    +- You do not need to know the first dir created (and wish to save
    +  a few `stat` calls when using the native implementation for
    +  this reason).
    +- You wish to use the native implementation if available, but
    +  fall back when it's not.
    +- You prefer promise-returning APIs to callback-taking APIs.
    +- You are ok with occasionally getting `ENOENT` errors for
    +  failures that are actually related to something other than a
    +  missing file system entry.
    +- You don't need/want a CLI.
    +- You need to override the `fs` methods in use.
    +
    +## use mkdirp 0.x if:
    +
    +- You need to know the first directory that was created.
    +- You need (or at least, are ok with) a CLI.
    +- You need to override the `fs` methods in use.
    +- You're ok with using callbacks instead of promises.
    +- You are not running on Windows, where the root-level ENOENT
    +  errors can lead to infinite regress.
    +- You think vinyl just sounds warmer and richer for some weird
    +  reason.
    +- You are supporting truly ancient Node.js versions, before even
    +  the advent of a `Promise` language primitive. (Please don't.
    +  You deserve better.)
    +
    +# cli
    +
    +This package also ships with a `mkdirp` command.
    +
    +```
    +$ mkdirp -h
    +
    +usage: mkdirp [DIR1,DIR2..] {OPTIONS}
    +
    +  Create each supplied directory including any necessary parent directories
    +  that don't yet exist.
    +
    +  If the directory already exists, do nothing.
    +
    +OPTIONS are:
    +
    +  -m       If a directory needs to be created, set the mode as an octal
    +  --mode=  permission string.
    +
    +  -v --version   Print the mkdirp version number
    +
    +  -h --help      Print this helpful banner
    +
    +  -p --print     Print the first directories created for each path provided
    +
    +  --manual       Use manual implementation, even if native is available
    +```
    +
    +# install
    +
    +With [npm](http://npmjs.org) do:
    +
    +```
    +npm install mkdirp
    +```
    +
    +to get the library locally, or
    +
    +```
    +npm install -g mkdirp
    +```
    +
    +to get the command everywhere, or
    +
    +```
    +npx mkdirp ...
    +```
    +
    +to run the command without installing it globally.
    +
    +# platform support
    +
    +This module works on node v8, but only v10 and above are officially
    +supported, as Node v8 reached its LTS end of life 2020-01-01, which is in
    +the past, as of this writing.
    +
    +# license
    +
    +MIT
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/LICENSE b/node_modules/npm/node_modules/node-gyp/node_modules/tar/LICENSE
    new file mode 100644
    index 00000000..19129e31
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/create.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/create.js
    new file mode 100644
    index 00000000..3190afc4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/create.js
    @@ -0,0 +1,83 @@
    +"use strict";
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.create = void 0;
    +const fs_minipass_1 = require("@isaacs/fs-minipass");
    +const node_path_1 = __importDefault(require("node:path"));
    +const list_js_1 = require("./list.js");
    +const make_command_js_1 = require("./make-command.js");
    +const pack_js_1 = require("./pack.js");
    +const createFileSync = (opt, files) => {
    +    const p = new pack_js_1.PackSync(opt);
    +    const stream = new fs_minipass_1.WriteStreamSync(opt.file, {
    +        mode: opt.mode || 0o666,
    +    });
    +    p.pipe(stream);
    +    addFilesSync(p, files);
    +};
    +const createFile = (opt, files) => {
    +    const p = new pack_js_1.Pack(opt);
    +    const stream = new fs_minipass_1.WriteStream(opt.file, {
    +        mode: opt.mode || 0o666,
    +    });
    +    p.pipe(stream);
    +    const promise = new Promise((res, rej) => {
    +        stream.on('error', rej);
    +        stream.on('close', res);
    +        p.on('error', rej);
    +    });
    +    addFilesAsync(p, files);
    +    return promise;
    +};
    +const addFilesSync = (p, files) => {
    +    files.forEach(file => {
    +        if (file.charAt(0) === '@') {
    +            (0, list_js_1.list)({
    +                file: node_path_1.default.resolve(p.cwd, file.slice(1)),
    +                sync: true,
    +                noResume: true,
    +                onReadEntry: entry => p.add(entry),
    +            });
    +        }
    +        else {
    +            p.add(file);
    +        }
    +    });
    +    p.end();
    +};
    +const addFilesAsync = async (p, files) => {
    +    for (let i = 0; i < files.length; i++) {
    +        const file = String(files[i]);
    +        if (file.charAt(0) === '@') {
    +            await (0, list_js_1.list)({
    +                file: node_path_1.default.resolve(String(p.cwd), file.slice(1)),
    +                noResume: true,
    +                onReadEntry: entry => {
    +                    p.add(entry);
    +                },
    +            });
    +        }
    +        else {
    +            p.add(file);
    +        }
    +    }
    +    p.end();
    +};
    +const createSync = (opt, files) => {
    +    const p = new pack_js_1.PackSync(opt);
    +    addFilesSync(p, files);
    +    return p;
    +};
    +const createAsync = (opt, files) => {
    +    const p = new pack_js_1.Pack(opt);
    +    addFilesAsync(p, files);
    +    return p;
    +};
    +exports.create = (0, make_command_js_1.makeCommand)(createFileSync, createFile, createSync, createAsync, (_opt, files) => {
    +    if (!files?.length) {
    +        throw new TypeError('no paths specified to add to archive');
    +    }
    +});
    +//# sourceMappingURL=create.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/cwd-error.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/cwd-error.js
    new file mode 100644
    index 00000000..d703a777
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/cwd-error.js
    @@ -0,0 +1,18 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.CwdError = void 0;
    +class CwdError extends Error {
    +    path;
    +    code;
    +    syscall = 'chdir';
    +    constructor(path, code) {
    +        super(`${code}: Cannot cd into '${path}'`);
    +        this.path = path;
    +        this.code = code;
    +    }
    +    get name() {
    +        return 'CwdError';
    +    }
    +}
    +exports.CwdError = CwdError;
    +//# sourceMappingURL=cwd-error.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/extract.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/extract.js
    new file mode 100644
    index 00000000..f848cbcb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/extract.js
    @@ -0,0 +1,78 @@
    +"use strict";
    +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    var desc = Object.getOwnPropertyDescriptor(m, k);
    +    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
    +      desc = { enumerable: true, get: function() { return m[k]; } };
    +    }
    +    Object.defineProperty(o, k2, desc);
    +}) : (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    o[k2] = m[k];
    +}));
    +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    +    Object.defineProperty(o, "default", { enumerable: true, value: v });
    +}) : function(o, v) {
    +    o["default"] = v;
    +});
    +var __importStar = (this && this.__importStar) || function (mod) {
    +    if (mod && mod.__esModule) return mod;
    +    var result = {};
    +    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    +    __setModuleDefault(result, mod);
    +    return result;
    +};
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.extract = void 0;
    +// tar -x
    +const fsm = __importStar(require("@isaacs/fs-minipass"));
    +const node_fs_1 = __importDefault(require("node:fs"));
    +const list_js_1 = require("./list.js");
    +const make_command_js_1 = require("./make-command.js");
    +const unpack_js_1 = require("./unpack.js");
    +const extractFileSync = (opt) => {
    +    const u = new unpack_js_1.UnpackSync(opt);
    +    const file = opt.file;
    +    const stat = node_fs_1.default.statSync(file);
    +    // This trades a zero-byte read() syscall for a stat
    +    // However, it will usually result in less memory allocation
    +    const readSize = opt.maxReadSize || 16 * 1024 * 1024;
    +    const stream = new fsm.ReadStreamSync(file, {
    +        readSize: readSize,
    +        size: stat.size,
    +    });
    +    stream.pipe(u);
    +};
    +const extractFile = (opt, _) => {
    +    const u = new unpack_js_1.Unpack(opt);
    +    const readSize = opt.maxReadSize || 16 * 1024 * 1024;
    +    const file = opt.file;
    +    const p = new Promise((resolve, reject) => {
    +        u.on('error', reject);
    +        u.on('close', resolve);
    +        // This trades a zero-byte read() syscall for a stat
    +        // However, it will usually result in less memory allocation
    +        node_fs_1.default.stat(file, (er, stat) => {
    +            if (er) {
    +                reject(er);
    +            }
    +            else {
    +                const stream = new fsm.ReadStream(file, {
    +                    readSize: readSize,
    +                    size: stat.size,
    +                });
    +                stream.on('error', reject);
    +                stream.pipe(u);
    +            }
    +        });
    +    });
    +    return p;
    +};
    +exports.extract = (0, make_command_js_1.makeCommand)(extractFileSync, extractFile, opt => new unpack_js_1.UnpackSync(opt), opt => new unpack_js_1.Unpack(opt), (opt, files) => {
    +    if (files?.length)
    +        (0, list_js_1.filesFilter)(opt, files);
    +});
    +//# sourceMappingURL=extract.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/get-write-flag.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/get-write-flag.js
    new file mode 100644
    index 00000000..94add8f6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/get-write-flag.js
    @@ -0,0 +1,29 @@
    +"use strict";
    +// Get the appropriate flag to use for creating files
    +// We use fmap on Windows platforms for files less than
    +// 512kb.  This is a fairly low limit, but avoids making
    +// things slower in some cases.  Since most of what this
    +// library is used for is extracting tarballs of many
    +// relatively small files in npm packages and the like,
    +// it can be a big boost on Windows platforms.
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.getWriteFlag = void 0;
    +const fs_1 = __importDefault(require("fs"));
    +const platform = process.env.__FAKE_PLATFORM__ || process.platform;
    +const isWindows = platform === 'win32';
    +/* c8 ignore start */
    +const { O_CREAT, O_TRUNC, O_WRONLY } = fs_1.default.constants;
    +const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) ||
    +    fs_1.default.constants.UV_FS_O_FILEMAP ||
    +    0;
    +/* c8 ignore stop */
    +const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP;
    +const fMapLimit = 512 * 1024;
    +const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY;
    +exports.getWriteFlag = !fMapEnabled ?
    +    () => 'w'
    +    : (size) => (size < fMapLimit ? fMapFlag : 'w');
    +//# sourceMappingURL=get-write-flag.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/header.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/header.js
    new file mode 100644
    index 00000000..b3a48037
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/header.js
    @@ -0,0 +1,306 @@
    +"use strict";
    +// parse a 512-byte header block to a data object, or vice-versa
    +// encode returns `true` if a pax extended header is needed, because
    +// the data could not be faithfully encoded in a simple header.
    +// (Also, check header.needPax to see if it needs a pax header.)
    +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    var desc = Object.getOwnPropertyDescriptor(m, k);
    +    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
    +      desc = { enumerable: true, get: function() { return m[k]; } };
    +    }
    +    Object.defineProperty(o, k2, desc);
    +}) : (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    o[k2] = m[k];
    +}));
    +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    +    Object.defineProperty(o, "default", { enumerable: true, value: v });
    +}) : function(o, v) {
    +    o["default"] = v;
    +});
    +var __importStar = (this && this.__importStar) || function (mod) {
    +    if (mod && mod.__esModule) return mod;
    +    var result = {};
    +    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    +    __setModuleDefault(result, mod);
    +    return result;
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.Header = void 0;
    +const node_path_1 = require("node:path");
    +const large = __importStar(require("./large-numbers.js"));
    +const types = __importStar(require("./types.js"));
    +class Header {
    +    cksumValid = false;
    +    needPax = false;
    +    nullBlock = false;
    +    block;
    +    path;
    +    mode;
    +    uid;
    +    gid;
    +    size;
    +    cksum;
    +    #type = 'Unsupported';
    +    linkpath;
    +    uname;
    +    gname;
    +    devmaj = 0;
    +    devmin = 0;
    +    atime;
    +    ctime;
    +    mtime;
    +    charset;
    +    comment;
    +    constructor(data, off = 0, ex, gex) {
    +        if (Buffer.isBuffer(data)) {
    +            this.decode(data, off || 0, ex, gex);
    +        }
    +        else if (data) {
    +            this.#slurp(data);
    +        }
    +    }
    +    decode(buf, off, ex, gex) {
    +        if (!off) {
    +            off = 0;
    +        }
    +        if (!buf || !(buf.length >= off + 512)) {
    +            throw new Error('need 512 bytes for header');
    +        }
    +        this.path = decString(buf, off, 100);
    +        this.mode = decNumber(buf, off + 100, 8);
    +        this.uid = decNumber(buf, off + 108, 8);
    +        this.gid = decNumber(buf, off + 116, 8);
    +        this.size = decNumber(buf, off + 124, 12);
    +        this.mtime = decDate(buf, off + 136, 12);
    +        this.cksum = decNumber(buf, off + 148, 12);
    +        // if we have extended or global extended headers, apply them now
    +        // See https://github.com/npm/node-tar/pull/187
    +        // Apply global before local, so it overrides
    +        if (gex)
    +            this.#slurp(gex, true);
    +        if (ex)
    +            this.#slurp(ex);
    +        // old tar versions marked dirs as a file with a trailing /
    +        const t = decString(buf, off + 156, 1);
    +        if (types.isCode(t)) {
    +            this.#type = t || '0';
    +        }
    +        if (this.#type === '0' && this.path.slice(-1) === '/') {
    +            this.#type = '5';
    +        }
    +        // tar implementations sometimes incorrectly put the stat(dir).size
    +        // as the size in the tarball, even though Directory entries are
    +        // not able to have any body at all.  In the very rare chance that
    +        // it actually DOES have a body, we weren't going to do anything with
    +        // it anyway, and it'll just be a warning about an invalid header.
    +        if (this.#type === '5') {
    +            this.size = 0;
    +        }
    +        this.linkpath = decString(buf, off + 157, 100);
    +        if (buf.subarray(off + 257, off + 265).toString() ===
    +            'ustar\u000000') {
    +            this.uname = decString(buf, off + 265, 32);
    +            this.gname = decString(buf, off + 297, 32);
    +            /* c8 ignore start */
    +            this.devmaj = decNumber(buf, off + 329, 8) ?? 0;
    +            this.devmin = decNumber(buf, off + 337, 8) ?? 0;
    +            /* c8 ignore stop */
    +            if (buf[off + 475] !== 0) {
    +                // definitely a prefix, definitely >130 chars.
    +                const prefix = decString(buf, off + 345, 155);
    +                this.path = prefix + '/' + this.path;
    +            }
    +            else {
    +                const prefix = decString(buf, off + 345, 130);
    +                if (prefix) {
    +                    this.path = prefix + '/' + this.path;
    +                }
    +                this.atime = decDate(buf, off + 476, 12);
    +                this.ctime = decDate(buf, off + 488, 12);
    +            }
    +        }
    +        let sum = 8 * 0x20;
    +        for (let i = off; i < off + 148; i++) {
    +            sum += buf[i];
    +        }
    +        for (let i = off + 156; i < off + 512; i++) {
    +            sum += buf[i];
    +        }
    +        this.cksumValid = sum === this.cksum;
    +        if (this.cksum === undefined && sum === 8 * 0x20) {
    +            this.nullBlock = true;
    +        }
    +    }
    +    #slurp(ex, gex = false) {
    +        Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
    +            // we slurp in everything except for the path attribute in
    +            // a global extended header, because that's weird. Also, any
    +            // null/undefined values are ignored.
    +            return !(v === null ||
    +                v === undefined ||
    +                (k === 'path' && gex) ||
    +                (k === 'linkpath' && gex) ||
    +                k === 'global');
    +        })));
    +    }
    +    encode(buf, off = 0) {
    +        if (!buf) {
    +            buf = this.block = Buffer.alloc(512);
    +        }
    +        if (this.#type === 'Unsupported') {
    +            this.#type = '0';
    +        }
    +        if (!(buf.length >= off + 512)) {
    +            throw new Error('need 512 bytes for header');
    +        }
    +        const prefixSize = this.ctime || this.atime ? 130 : 155;
    +        const split = splitPrefix(this.path || '', prefixSize);
    +        const path = split[0];
    +        const prefix = split[1];
    +        this.needPax = !!split[2];
    +        this.needPax = encString(buf, off, 100, path) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 100, 8, this.mode) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 108, 8, this.uid) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 116, 8, this.gid) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 124, 12, this.size) || this.needPax;
    +        this.needPax =
    +            encDate(buf, off + 136, 12, this.mtime) || this.needPax;
    +        buf[off + 156] = this.#type.charCodeAt(0);
    +        this.needPax =
    +            encString(buf, off + 157, 100, this.linkpath) || this.needPax;
    +        buf.write('ustar\u000000', off + 257, 8);
    +        this.needPax =
    +            encString(buf, off + 265, 32, this.uname) || this.needPax;
    +        this.needPax =
    +            encString(buf, off + 297, 32, this.gname) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 329, 8, this.devmaj) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 337, 8, this.devmin) || this.needPax;
    +        this.needPax =
    +            encString(buf, off + 345, prefixSize, prefix) || this.needPax;
    +        if (buf[off + 475] !== 0) {
    +            this.needPax =
    +                encString(buf, off + 345, 155, prefix) || this.needPax;
    +        }
    +        else {
    +            this.needPax =
    +                encString(buf, off + 345, 130, prefix) || this.needPax;
    +            this.needPax =
    +                encDate(buf, off + 476, 12, this.atime) || this.needPax;
    +            this.needPax =
    +                encDate(buf, off + 488, 12, this.ctime) || this.needPax;
    +        }
    +        let sum = 8 * 0x20;
    +        for (let i = off; i < off + 148; i++) {
    +            sum += buf[i];
    +        }
    +        for (let i = off + 156; i < off + 512; i++) {
    +            sum += buf[i];
    +        }
    +        this.cksum = sum;
    +        encNumber(buf, off + 148, 8, this.cksum);
    +        this.cksumValid = true;
    +        return this.needPax;
    +    }
    +    get type() {
    +        return (this.#type === 'Unsupported' ?
    +            this.#type
    +            : types.name.get(this.#type));
    +    }
    +    get typeKey() {
    +        return this.#type;
    +    }
    +    set type(type) {
    +        const c = String(types.code.get(type));
    +        if (types.isCode(c) || c === 'Unsupported') {
    +            this.#type = c;
    +        }
    +        else if (types.isCode(type)) {
    +            this.#type = type;
    +        }
    +        else {
    +            throw new TypeError('invalid entry type: ' + type);
    +        }
    +    }
    +}
    +exports.Header = Header;
    +const splitPrefix = (p, prefixSize) => {
    +    const pathSize = 100;
    +    let pp = p;
    +    let prefix = '';
    +    let ret = undefined;
    +    const root = node_path_1.posix.parse(p).root || '.';
    +    if (Buffer.byteLength(pp) < pathSize) {
    +        ret = [pp, prefix, false];
    +    }
    +    else {
    +        // first set prefix to the dir, and path to the base
    +        prefix = node_path_1.posix.dirname(pp);
    +        pp = node_path_1.posix.basename(pp);
    +        do {
    +            if (Buffer.byteLength(pp) <= pathSize &&
    +                Buffer.byteLength(prefix) <= prefixSize) {
    +                // both fit!
    +                ret = [pp, prefix, false];
    +            }
    +            else if (Buffer.byteLength(pp) > pathSize &&
    +                Buffer.byteLength(prefix) <= prefixSize) {
    +                // prefix fits in prefix, but path doesn't fit in path
    +                ret = [pp.slice(0, pathSize - 1), prefix, true];
    +            }
    +            else {
    +                // make path take a bit from prefix
    +                pp = node_path_1.posix.join(node_path_1.posix.basename(prefix), pp);
    +                prefix = node_path_1.posix.dirname(prefix);
    +            }
    +        } while (prefix !== root && ret === undefined);
    +        // at this point, found no resolution, just truncate
    +        if (!ret) {
    +            ret = [p.slice(0, pathSize - 1), '', true];
    +        }
    +    }
    +    return ret;
    +};
    +const decString = (buf, off, size) => buf
    +    .subarray(off, off + size)
    +    .toString('utf8')
    +    .replace(/\0.*/, '');
    +const decDate = (buf, off, size) => numToDate(decNumber(buf, off, size));
    +const numToDate = (num) => num === undefined ? undefined : new Date(num * 1000);
    +const decNumber = (buf, off, size) => Number(buf[off]) & 0x80 ?
    +    large.parse(buf.subarray(off, off + size))
    +    : decSmallNumber(buf, off, size);
    +const nanUndef = (value) => (isNaN(value) ? undefined : value);
    +const decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf
    +    .subarray(off, off + size)
    +    .toString('utf8')
    +    .replace(/\0.*$/, '')
    +    .trim(), 8));
    +// the maximum encodable as a null-terminated octal, by field size
    +const MAXNUM = {
    +    12: 0o77777777777,
    +    8: 0o7777777,
    +};
    +const encNumber = (buf, off, size, num) => num === undefined ? false
    +    : num > MAXNUM[size] || num < 0 ?
    +        (large.encode(num, buf.subarray(off, off + size)), true)
    +        : (encSmallNumber(buf, off, size, num), false);
    +const encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, 'ascii');
    +const octalString = (num, size) => padOctal(Math.floor(num).toString(8), size);
    +const padOctal = (str, size) => (str.length === size - 1 ?
    +    str
    +    : new Array(size - str.length - 1).join('0') + str + ' ') + '\0';
    +const encDate = (buf, off, size, date) => date === undefined ? false : (encNumber(buf, off, size, date.getTime() / 1000));
    +// enough to fill the longest string we've got
    +const NULLS = new Array(156).join('\0');
    +// pad with nulls, return true if it's longer or non-ascii
    +const encString = (buf, off, size, str) => str === undefined ? false : ((buf.write(str + NULLS, off, size, 'utf8'),
    +    str.length !== Buffer.byteLength(str) || str.length > size));
    +//# sourceMappingURL=header.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/index.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/index.js
    new file mode 100644
    index 00000000..e93ed5ad
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/index.js
    @@ -0,0 +1,54 @@
    +"use strict";
    +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    var desc = Object.getOwnPropertyDescriptor(m, k);
    +    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
    +      desc = { enumerable: true, get: function() { return m[k]; } };
    +    }
    +    Object.defineProperty(o, k2, desc);
    +}) : (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    o[k2] = m[k];
    +}));
    +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    +    Object.defineProperty(o, "default", { enumerable: true, value: v });
    +}) : function(o, v) {
    +    o["default"] = v;
    +});
    +var __exportStar = (this && this.__exportStar) || function(m, exports) {
    +    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
    +};
    +var __importStar = (this && this.__importStar) || function (mod) {
    +    if (mod && mod.__esModule) return mod;
    +    var result = {};
    +    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    +    __setModuleDefault(result, mod);
    +    return result;
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.u = exports.types = exports.r = exports.t = exports.x = exports.c = void 0;
    +__exportStar(require("./create.js"), exports);
    +var create_js_1 = require("./create.js");
    +Object.defineProperty(exports, "c", { enumerable: true, get: function () { return create_js_1.create; } });
    +__exportStar(require("./extract.js"), exports);
    +var extract_js_1 = require("./extract.js");
    +Object.defineProperty(exports, "x", { enumerable: true, get: function () { return extract_js_1.extract; } });
    +__exportStar(require("./header.js"), exports);
    +__exportStar(require("./list.js"), exports);
    +var list_js_1 = require("./list.js");
    +Object.defineProperty(exports, "t", { enumerable: true, get: function () { return list_js_1.list; } });
    +// classes
    +__exportStar(require("./pack.js"), exports);
    +__exportStar(require("./parse.js"), exports);
    +__exportStar(require("./pax.js"), exports);
    +__exportStar(require("./read-entry.js"), exports);
    +__exportStar(require("./replace.js"), exports);
    +var replace_js_1 = require("./replace.js");
    +Object.defineProperty(exports, "r", { enumerable: true, get: function () { return replace_js_1.replace; } });
    +exports.types = __importStar(require("./types.js"));
    +__exportStar(require("./unpack.js"), exports);
    +__exportStar(require("./update.js"), exports);
    +var update_js_1 = require("./update.js");
    +Object.defineProperty(exports, "u", { enumerable: true, get: function () { return update_js_1.update; } });
    +__exportStar(require("./write-entry.js"), exports);
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/large-numbers.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/large-numbers.js
    new file mode 100644
    index 00000000..5b07aa7f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/large-numbers.js
    @@ -0,0 +1,99 @@
    +"use strict";
    +// Tar can encode large and negative numbers using a leading byte of
    +// 0xff for negative, and 0x80 for positive.
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.parse = exports.encode = void 0;
    +const encode = (num, buf) => {
    +    if (!Number.isSafeInteger(num)) {
    +        // The number is so large that javascript cannot represent it with integer
    +        // precision.
    +        throw Error('cannot encode number outside of javascript safe integer range');
    +    }
    +    else if (num < 0) {
    +        encodeNegative(num, buf);
    +    }
    +    else {
    +        encodePositive(num, buf);
    +    }
    +    return buf;
    +};
    +exports.encode = encode;
    +const encodePositive = (num, buf) => {
    +    buf[0] = 0x80;
    +    for (var i = buf.length; i > 1; i--) {
    +        buf[i - 1] = num & 0xff;
    +        num = Math.floor(num / 0x100);
    +    }
    +};
    +const encodeNegative = (num, buf) => {
    +    buf[0] = 0xff;
    +    var flipped = false;
    +    num = num * -1;
    +    for (var i = buf.length; i > 1; i--) {
    +        var byte = num & 0xff;
    +        num = Math.floor(num / 0x100);
    +        if (flipped) {
    +            buf[i - 1] = onesComp(byte);
    +        }
    +        else if (byte === 0) {
    +            buf[i - 1] = 0;
    +        }
    +        else {
    +            flipped = true;
    +            buf[i - 1] = twosComp(byte);
    +        }
    +    }
    +};
    +const parse = (buf) => {
    +    const pre = buf[0];
    +    const value = pre === 0x80 ? pos(buf.subarray(1, buf.length))
    +        : pre === 0xff ? twos(buf)
    +            : null;
    +    if (value === null) {
    +        throw Error('invalid base256 encoding');
    +    }
    +    if (!Number.isSafeInteger(value)) {
    +        // The number is so large that javascript cannot represent it with integer
    +        // precision.
    +        throw Error('parsed number outside of javascript safe integer range');
    +    }
    +    return value;
    +};
    +exports.parse = parse;
    +const twos = (buf) => {
    +    var len = buf.length;
    +    var sum = 0;
    +    var flipped = false;
    +    for (var i = len - 1; i > -1; i--) {
    +        var byte = Number(buf[i]);
    +        var f;
    +        if (flipped) {
    +            f = onesComp(byte);
    +        }
    +        else if (byte === 0) {
    +            f = byte;
    +        }
    +        else {
    +            flipped = true;
    +            f = twosComp(byte);
    +        }
    +        if (f !== 0) {
    +            sum -= f * Math.pow(256, len - i - 1);
    +        }
    +    }
    +    return sum;
    +};
    +const pos = (buf) => {
    +    var len = buf.length;
    +    var sum = 0;
    +    for (var i = len - 1; i > -1; i--) {
    +        var byte = Number(buf[i]);
    +        if (byte !== 0) {
    +            sum += byte * Math.pow(256, len - i - 1);
    +        }
    +    }
    +    return sum;
    +};
    +const onesComp = (byte) => (0xff ^ byte) & 0xff;
    +const twosComp = (byte) => ((0xff ^ byte) + 1) & 0xff;
    +//# sourceMappingURL=large-numbers.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/list.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/list.js
    new file mode 100644
    index 00000000..3cd34bb4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/list.js
    @@ -0,0 +1,136 @@
    +"use strict";
    +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    var desc = Object.getOwnPropertyDescriptor(m, k);
    +    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
    +      desc = { enumerable: true, get: function() { return m[k]; } };
    +    }
    +    Object.defineProperty(o, k2, desc);
    +}) : (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    o[k2] = m[k];
    +}));
    +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    +    Object.defineProperty(o, "default", { enumerable: true, value: v });
    +}) : function(o, v) {
    +    o["default"] = v;
    +});
    +var __importStar = (this && this.__importStar) || function (mod) {
    +    if (mod && mod.__esModule) return mod;
    +    var result = {};
    +    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    +    __setModuleDefault(result, mod);
    +    return result;
    +};
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.list = exports.filesFilter = void 0;
    +// tar -t
    +const fsm = __importStar(require("@isaacs/fs-minipass"));
    +const node_fs_1 = __importDefault(require("node:fs"));
    +const path_1 = require("path");
    +const make_command_js_1 = require("./make-command.js");
    +const parse_js_1 = require("./parse.js");
    +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js");
    +const onReadEntryFunction = (opt) => {
    +    const onReadEntry = opt.onReadEntry;
    +    opt.onReadEntry =
    +        onReadEntry ?
    +            e => {
    +                onReadEntry(e);
    +                e.resume();
    +            }
    +            : e => e.resume();
    +};
    +// construct a filter that limits the file entries listed
    +// include child entries if a dir is included
    +const filesFilter = (opt, files) => {
    +    const map = new Map(files.map(f => [(0, strip_trailing_slashes_js_1.stripTrailingSlashes)(f), true]));
    +    const filter = opt.filter;
    +    const mapHas = (file, r = '') => {
    +        const root = r || (0, path_1.parse)(file).root || '.';
    +        let ret;
    +        if (file === root)
    +            ret = false;
    +        else {
    +            const m = map.get(file);
    +            if (m !== undefined) {
    +                ret = m;
    +            }
    +            else {
    +                ret = mapHas((0, path_1.dirname)(file), root);
    +            }
    +        }
    +        map.set(file, ret);
    +        return ret;
    +    };
    +    opt.filter =
    +        filter ?
    +            (file, entry) => filter(file, entry) && mapHas((0, strip_trailing_slashes_js_1.stripTrailingSlashes)(file))
    +            : file => mapHas((0, strip_trailing_slashes_js_1.stripTrailingSlashes)(file));
    +};
    +exports.filesFilter = filesFilter;
    +const listFileSync = (opt) => {
    +    const p = new parse_js_1.Parser(opt);
    +    const file = opt.file;
    +    let fd;
    +    try {
    +        const stat = node_fs_1.default.statSync(file);
    +        const readSize = opt.maxReadSize || 16 * 1024 * 1024;
    +        if (stat.size < readSize) {
    +            p.end(node_fs_1.default.readFileSync(file));
    +        }
    +        else {
    +            let pos = 0;
    +            const buf = Buffer.allocUnsafe(readSize);
    +            fd = node_fs_1.default.openSync(file, 'r');
    +            while (pos < stat.size) {
    +                const bytesRead = node_fs_1.default.readSync(fd, buf, 0, readSize, pos);
    +                pos += bytesRead;
    +                p.write(buf.subarray(0, bytesRead));
    +            }
    +            p.end();
    +        }
    +    }
    +    finally {
    +        if (typeof fd === 'number') {
    +            try {
    +                node_fs_1.default.closeSync(fd);
    +                /* c8 ignore next */
    +            }
    +            catch (er) { }
    +        }
    +    }
    +};
    +const listFile = (opt, _files) => {
    +    const parse = new parse_js_1.Parser(opt);
    +    const readSize = opt.maxReadSize || 16 * 1024 * 1024;
    +    const file = opt.file;
    +    const p = new Promise((resolve, reject) => {
    +        parse.on('error', reject);
    +        parse.on('end', resolve);
    +        node_fs_1.default.stat(file, (er, stat) => {
    +            if (er) {
    +                reject(er);
    +            }
    +            else {
    +                const stream = new fsm.ReadStream(file, {
    +                    readSize: readSize,
    +                    size: stat.size,
    +                });
    +                stream.on('error', reject);
    +                stream.pipe(parse);
    +            }
    +        });
    +    });
    +    return p;
    +};
    +exports.list = (0, make_command_js_1.makeCommand)(listFileSync, listFile, opt => new parse_js_1.Parser(opt), opt => new parse_js_1.Parser(opt), (opt, files) => {
    +    if (files?.length)
    +        (0, exports.filesFilter)(opt, files);
    +    if (!opt.noResume)
    +        onReadEntryFunction(opt);
    +});
    +//# sourceMappingURL=list.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/make-command.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/make-command.js
    new file mode 100644
    index 00000000..1814319e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/make-command.js
    @@ -0,0 +1,61 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.makeCommand = void 0;
    +const options_js_1 = require("./options.js");
    +const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => {
    +    return Object.assign((opt_ = [], entries, cb) => {
    +        if (Array.isArray(opt_)) {
    +            entries = opt_;
    +            opt_ = {};
    +        }
    +        if (typeof entries === 'function') {
    +            cb = entries;
    +            entries = undefined;
    +        }
    +        if (!entries) {
    +            entries = [];
    +        }
    +        else {
    +            entries = Array.from(entries);
    +        }
    +        const opt = (0, options_js_1.dealias)(opt_);
    +        validate?.(opt, entries);
    +        if ((0, options_js_1.isSyncFile)(opt)) {
    +            if (typeof cb === 'function') {
    +                throw new TypeError('callback not supported for sync tar functions');
    +            }
    +            return syncFile(opt, entries);
    +        }
    +        else if ((0, options_js_1.isAsyncFile)(opt)) {
    +            const p = asyncFile(opt, entries);
    +            // weirdness to make TS happy
    +            const c = cb ? cb : undefined;
    +            return c ? p.then(() => c(), c) : p;
    +        }
    +        else if ((0, options_js_1.isSyncNoFile)(opt)) {
    +            if (typeof cb === 'function') {
    +                throw new TypeError('callback not supported for sync tar functions');
    +            }
    +            return syncNoFile(opt, entries);
    +        }
    +        else if ((0, options_js_1.isAsyncNoFile)(opt)) {
    +            if (typeof cb === 'function') {
    +                throw new TypeError('callback only supported with file option');
    +            }
    +            return asyncNoFile(opt, entries);
    +            /* c8 ignore start */
    +        }
    +        else {
    +            throw new Error('impossible options??');
    +        }
    +        /* c8 ignore stop */
    +    }, {
    +        syncFile,
    +        asyncFile,
    +        syncNoFile,
    +        asyncNoFile,
    +        validate,
    +    });
    +};
    +exports.makeCommand = makeCommand;
    +//# sourceMappingURL=make-command.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/mkdir.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/mkdir.js
    new file mode 100644
    index 00000000..2b13ecba
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/mkdir.js
    @@ -0,0 +1,209 @@
    +"use strict";
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.mkdirSync = exports.mkdir = void 0;
    +const chownr_1 = require("chownr");
    +const fs_1 = __importDefault(require("fs"));
    +const mkdirp_1 = require("mkdirp");
    +const node_path_1 = __importDefault(require("node:path"));
    +const cwd_error_js_1 = require("./cwd-error.js");
    +const normalize_windows_path_js_1 = require("./normalize-windows-path.js");
    +const symlink_error_js_1 = require("./symlink-error.js");
    +const cGet = (cache, key) => cache.get((0, normalize_windows_path_js_1.normalizeWindowsPath)(key));
    +const cSet = (cache, key, val) => cache.set((0, normalize_windows_path_js_1.normalizeWindowsPath)(key), val);
    +const checkCwd = (dir, cb) => {
    +    fs_1.default.stat(dir, (er, st) => {
    +        if (er || !st.isDirectory()) {
    +            er = new cwd_error_js_1.CwdError(dir, er?.code || 'ENOTDIR');
    +        }
    +        cb(er);
    +    });
    +};
    +/**
    + * Wrapper around mkdirp for tar's needs.
    + *
    + * The main purpose is to avoid creating directories if we know that
    + * they already exist (and track which ones exist for this purpose),
    + * and prevent entries from being extracted into symlinked folders,
    + * if `preservePaths` is not set.
    + */
    +const mkdir = (dir, opt, cb) => {
    +    dir = (0, normalize_windows_path_js_1.normalizeWindowsPath)(dir);
    +    // if there's any overlap between mask and mode,
    +    // then we'll need an explicit chmod
    +    /* c8 ignore next */
    +    const umask = opt.umask ?? 0o22;
    +    const mode = opt.mode | 0o0700;
    +    const needChmod = (mode & umask) !== 0;
    +    const uid = opt.uid;
    +    const gid = opt.gid;
    +    const doChown = typeof uid === 'number' &&
    +        typeof gid === 'number' &&
    +        (uid !== opt.processUid || gid !== opt.processGid);
    +    const preserve = opt.preserve;
    +    const unlink = opt.unlink;
    +    const cache = opt.cache;
    +    const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd);
    +    const done = (er, created) => {
    +        if (er) {
    +            cb(er);
    +        }
    +        else {
    +            cSet(cache, dir, true);
    +            if (created && doChown) {
    +                (0, chownr_1.chownr)(created, uid, gid, er => done(er));
    +            }
    +            else if (needChmod) {
    +                fs_1.default.chmod(dir, mode, cb);
    +            }
    +            else {
    +                cb();
    +            }
    +        }
    +    };
    +    if (cache && cGet(cache, dir) === true) {
    +        return done();
    +    }
    +    if (dir === cwd) {
    +        return checkCwd(dir, done);
    +    }
    +    if (preserve) {
    +        return (0, mkdirp_1.mkdirp)(dir, { mode }).then(made => done(null, made ?? undefined), // oh, ts
    +        done);
    +    }
    +    const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir));
    +    const parts = sub.split('/');
    +    mkdir_(cwd, parts, mode, cache, unlink, cwd, undefined, done);
    +};
    +exports.mkdir = mkdir;
    +const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => {
    +    if (!parts.length) {
    +        return cb(null, created);
    +    }
    +    const p = parts.shift();
    +    const part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(base + '/' + p));
    +    if (cGet(cache, part)) {
    +        return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb);
    +    }
    +    fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb));
    +};
    +const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => {
    +    if (er) {
    +        fs_1.default.lstat(part, (statEr, st) => {
    +            if (statEr) {
    +                statEr.path =
    +                    statEr.path && (0, normalize_windows_path_js_1.normalizeWindowsPath)(statEr.path);
    +                cb(statEr);
    +            }
    +            else if (st.isDirectory()) {
    +                mkdir_(part, parts, mode, cache, unlink, cwd, created, cb);
    +            }
    +            else if (unlink) {
    +                fs_1.default.unlink(part, er => {
    +                    if (er) {
    +                        return cb(er);
    +                    }
    +                    fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb));
    +                });
    +            }
    +            else if (st.isSymbolicLink()) {
    +                return cb(new symlink_error_js_1.SymlinkError(part, part + '/' + parts.join('/')));
    +            }
    +            else {
    +                cb(er);
    +            }
    +        });
    +    }
    +    else {
    +        created = created || part;
    +        mkdir_(part, parts, mode, cache, unlink, cwd, created, cb);
    +    }
    +};
    +const checkCwdSync = (dir) => {
    +    let ok = false;
    +    let code = undefined;
    +    try {
    +        ok = fs_1.default.statSync(dir).isDirectory();
    +    }
    +    catch (er) {
    +        code = er?.code;
    +    }
    +    finally {
    +        if (!ok) {
    +            throw new cwd_error_js_1.CwdError(dir, code ?? 'ENOTDIR');
    +        }
    +    }
    +};
    +const mkdirSync = (dir, opt) => {
    +    dir = (0, normalize_windows_path_js_1.normalizeWindowsPath)(dir);
    +    // if there's any overlap between mask and mode,
    +    // then we'll need an explicit chmod
    +    /* c8 ignore next */
    +    const umask = opt.umask ?? 0o22;
    +    const mode = opt.mode | 0o700;
    +    const needChmod = (mode & umask) !== 0;
    +    const uid = opt.uid;
    +    const gid = opt.gid;
    +    const doChown = typeof uid === 'number' &&
    +        typeof gid === 'number' &&
    +        (uid !== opt.processUid || gid !== opt.processGid);
    +    const preserve = opt.preserve;
    +    const unlink = opt.unlink;
    +    const cache = opt.cache;
    +    const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd);
    +    const done = (created) => {
    +        cSet(cache, dir, true);
    +        if (created && doChown) {
    +            (0, chownr_1.chownrSync)(created, uid, gid);
    +        }
    +        if (needChmod) {
    +            fs_1.default.chmodSync(dir, mode);
    +        }
    +    };
    +    if (cache && cGet(cache, dir) === true) {
    +        return done();
    +    }
    +    if (dir === cwd) {
    +        checkCwdSync(cwd);
    +        return done();
    +    }
    +    if (preserve) {
    +        return done((0, mkdirp_1.mkdirpSync)(dir, mode) ?? undefined);
    +    }
    +    const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir));
    +    const parts = sub.split('/');
    +    let created = undefined;
    +    for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) {
    +        part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(part));
    +        if (cGet(cache, part)) {
    +            continue;
    +        }
    +        try {
    +            fs_1.default.mkdirSync(part, mode);
    +            created = created || part;
    +            cSet(cache, part, true);
    +        }
    +        catch (er) {
    +            const st = fs_1.default.lstatSync(part);
    +            if (st.isDirectory()) {
    +                cSet(cache, part, true);
    +                continue;
    +            }
    +            else if (unlink) {
    +                fs_1.default.unlinkSync(part);
    +                fs_1.default.mkdirSync(part, mode);
    +                created = created || part;
    +                cSet(cache, part, true);
    +                continue;
    +            }
    +            else if (st.isSymbolicLink()) {
    +                return new symlink_error_js_1.SymlinkError(part, part + '/' + parts.join('/'));
    +            }
    +        }
    +    }
    +    return done(created);
    +};
    +exports.mkdirSync = mkdirSync;
    +//# sourceMappingURL=mkdir.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/mode-fix.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/mode-fix.js
    new file mode 100644
    index 00000000..49dd7279
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/mode-fix.js
    @@ -0,0 +1,29 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.modeFix = void 0;
    +const modeFix = (mode, isDir, portable) => {
    +    mode &= 0o7777;
    +    // in portable mode, use the minimum reasonable umask
    +    // if this system creates files with 0o664 by default
    +    // (as some linux distros do), then we'll write the
    +    // archive with 0o644 instead.  Also, don't ever create
    +    // a file that is not readable/writable by the owner.
    +    if (portable) {
    +        mode = (mode | 0o600) & ~0o22;
    +    }
    +    // if dirs are readable, then they should be listable
    +    if (isDir) {
    +        if (mode & 0o400) {
    +            mode |= 0o100;
    +        }
    +        if (mode & 0o40) {
    +            mode |= 0o10;
    +        }
    +        if (mode & 0o4) {
    +            mode |= 0o1;
    +        }
    +    }
    +    return mode;
    +};
    +exports.modeFix = modeFix;
    +//# sourceMappingURL=mode-fix.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-unicode.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-unicode.js
    new file mode 100644
    index 00000000..2f08ce46
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-unicode.js
    @@ -0,0 +1,17 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.normalizeUnicode = void 0;
    +// warning: extremely hot code path.
    +// This has been meticulously optimized for use
    +// within npm install on large package trees.
    +// Do not edit without careful benchmarking.
    +const normalizeCache = Object.create(null);
    +const { hasOwnProperty } = Object.prototype;
    +const normalizeUnicode = (s) => {
    +    if (!hasOwnProperty.call(normalizeCache, s)) {
    +        normalizeCache[s] = s.normalize('NFD');
    +    }
    +    return normalizeCache[s];
    +};
    +exports.normalizeUnicode = normalizeUnicode;
    +//# sourceMappingURL=normalize-unicode.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-windows-path.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-windows-path.js
    new file mode 100644
    index 00000000..b0c7aaa9
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-windows-path.js
    @@ -0,0 +1,12 @@
    +"use strict";
    +// on windows, either \ or / are valid directory separators.
    +// on unix, \ is a valid character in filenames.
    +// so, on windows, and only on windows, we replace all \ chars with /,
    +// so that we can use / as our one and only directory separator char.
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.normalizeWindowsPath = void 0;
    +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
    +exports.normalizeWindowsPath = platform !== 'win32' ?
    +    (p) => p
    +    : (p) => p && p.replace(/\\/g, '/');
    +//# sourceMappingURL=normalize-windows-path.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/options.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/options.js
    new file mode 100644
    index 00000000..4cd06505
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/options.js
    @@ -0,0 +1,66 @@
    +"use strict";
    +// turn tar(1) style args like `C` into the more verbose things like `cwd`
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.dealias = exports.isNoFile = exports.isFile = exports.isAsync = exports.isSync = exports.isAsyncNoFile = exports.isSyncNoFile = exports.isAsyncFile = exports.isSyncFile = void 0;
    +const argmap = new Map([
    +    ['C', 'cwd'],
    +    ['f', 'file'],
    +    ['z', 'gzip'],
    +    ['P', 'preservePaths'],
    +    ['U', 'unlink'],
    +    ['strip-components', 'strip'],
    +    ['stripComponents', 'strip'],
    +    ['keep-newer', 'newer'],
    +    ['keepNewer', 'newer'],
    +    ['keep-newer-files', 'newer'],
    +    ['keepNewerFiles', 'newer'],
    +    ['k', 'keep'],
    +    ['keep-existing', 'keep'],
    +    ['keepExisting', 'keep'],
    +    ['m', 'noMtime'],
    +    ['no-mtime', 'noMtime'],
    +    ['p', 'preserveOwner'],
    +    ['L', 'follow'],
    +    ['h', 'follow'],
    +    ['onentry', 'onReadEntry'],
    +]);
    +const isSyncFile = (o) => !!o.sync && !!o.file;
    +exports.isSyncFile = isSyncFile;
    +const isAsyncFile = (o) => !o.sync && !!o.file;
    +exports.isAsyncFile = isAsyncFile;
    +const isSyncNoFile = (o) => !!o.sync && !o.file;
    +exports.isSyncNoFile = isSyncNoFile;
    +const isAsyncNoFile = (o) => !o.sync && !o.file;
    +exports.isAsyncNoFile = isAsyncNoFile;
    +const isSync = (o) => !!o.sync;
    +exports.isSync = isSync;
    +const isAsync = (o) => !o.sync;
    +exports.isAsync = isAsync;
    +const isFile = (o) => !!o.file;
    +exports.isFile = isFile;
    +const isNoFile = (o) => !o.file;
    +exports.isNoFile = isNoFile;
    +const dealiasKey = (k) => {
    +    const d = argmap.get(k);
    +    if (d)
    +        return d;
    +    return k;
    +};
    +const dealias = (opt = {}) => {
    +    if (!opt)
    +        return {};
    +    const result = {};
    +    for (const [key, v] of Object.entries(opt)) {
    +        // TS doesn't know that aliases are going to always be the same type
    +        const k = dealiasKey(key);
    +        result[k] = v;
    +    }
    +    // affordance for deprecated noChmod -> chmod
    +    if (result.chmod === undefined && result.noChmod === false) {
    +        result.chmod = true;
    +    }
    +    delete result.noChmod;
    +    return result;
    +};
    +exports.dealias = dealias;
    +//# sourceMappingURL=options.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/pack.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/pack.js
    new file mode 100644
    index 00000000..303e9306
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/pack.js
    @@ -0,0 +1,477 @@
    +"use strict";
    +// A readable tar stream creator
    +// Technically, this is a transform stream that you write paths into,
    +// and tar format comes out of.
    +// The `add()` method is like `write()` but returns this,
    +// and end() return `this` as well, so you can
    +// do `new Pack(opt).add('files').add('dir').end().pipe(output)
    +// You could also do something like:
    +// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))
    +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    var desc = Object.getOwnPropertyDescriptor(m, k);
    +    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
    +      desc = { enumerable: true, get: function() { return m[k]; } };
    +    }
    +    Object.defineProperty(o, k2, desc);
    +}) : (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    o[k2] = m[k];
    +}));
    +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    +    Object.defineProperty(o, "default", { enumerable: true, value: v });
    +}) : function(o, v) {
    +    o["default"] = v;
    +});
    +var __importStar = (this && this.__importStar) || function (mod) {
    +    if (mod && mod.__esModule) return mod;
    +    var result = {};
    +    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    +    __setModuleDefault(result, mod);
    +    return result;
    +};
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.PackSync = exports.Pack = exports.PackJob = void 0;
    +const fs_1 = __importDefault(require("fs"));
    +const write_entry_js_1 = require("./write-entry.js");
    +class PackJob {
    +    path;
    +    absolute;
    +    entry;
    +    stat;
    +    readdir;
    +    pending = false;
    +    ignore = false;
    +    piped = false;
    +    constructor(path, absolute) {
    +        this.path = path || './';
    +        this.absolute = absolute;
    +    }
    +}
    +exports.PackJob = PackJob;
    +const minipass_1 = require("minipass");
    +const zlib = __importStar(require("minizlib"));
    +const yallist_1 = require("yallist");
    +const read_entry_js_1 = require("./read-entry.js");
    +const warn_method_js_1 = require("./warn-method.js");
    +const EOF = Buffer.alloc(1024);
    +const ONSTAT = Symbol('onStat');
    +const ENDED = Symbol('ended');
    +const QUEUE = Symbol('queue');
    +const CURRENT = Symbol('current');
    +const PROCESS = Symbol('process');
    +const PROCESSING = Symbol('processing');
    +const PROCESSJOB = Symbol('processJob');
    +const JOBS = Symbol('jobs');
    +const JOBDONE = Symbol('jobDone');
    +const ADDFSENTRY = Symbol('addFSEntry');
    +const ADDTARENTRY = Symbol('addTarEntry');
    +const STAT = Symbol('stat');
    +const READDIR = Symbol('readdir');
    +const ONREADDIR = Symbol('onreaddir');
    +const PIPE = Symbol('pipe');
    +const ENTRY = Symbol('entry');
    +const ENTRYOPT = Symbol('entryOpt');
    +const WRITEENTRYCLASS = Symbol('writeEntryClass');
    +const WRITE = Symbol('write');
    +const ONDRAIN = Symbol('ondrain');
    +const path_1 = __importDefault(require("path"));
    +const normalize_windows_path_js_1 = require("./normalize-windows-path.js");
    +class Pack extends minipass_1.Minipass {
    +    opt;
    +    cwd;
    +    maxReadSize;
    +    preservePaths;
    +    strict;
    +    noPax;
    +    prefix;
    +    linkCache;
    +    statCache;
    +    file;
    +    portable;
    +    zip;
    +    readdirCache;
    +    noDirRecurse;
    +    follow;
    +    noMtime;
    +    mtime;
    +    filter;
    +    jobs;
    +    [WRITEENTRYCLASS];
    +    onWriteEntry;
    +    [QUEUE];
    +    [JOBS] = 0;
    +    [PROCESSING] = false;
    +    [ENDED] = false;
    +    constructor(opt = {}) {
    +        //@ts-ignore
    +        super();
    +        this.opt = opt;
    +        this.file = opt.file || '';
    +        this.cwd = opt.cwd || process.cwd();
    +        this.maxReadSize = opt.maxReadSize;
    +        this.preservePaths = !!opt.preservePaths;
    +        this.strict = !!opt.strict;
    +        this.noPax = !!opt.noPax;
    +        this.prefix = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.prefix || '');
    +        this.linkCache = opt.linkCache || new Map();
    +        this.statCache = opt.statCache || new Map();
    +        this.readdirCache = opt.readdirCache || new Map();
    +        this.onWriteEntry = opt.onWriteEntry;
    +        this[WRITEENTRYCLASS] = write_entry_js_1.WriteEntry;
    +        if (typeof opt.onwarn === 'function') {
    +            this.on('warn', opt.onwarn);
    +        }
    +        this.portable = !!opt.portable;
    +        if (opt.gzip || opt.brotli) {
    +            if (opt.gzip && opt.brotli) {
    +                throw new TypeError('gzip and brotli are mutually exclusive');
    +            }
    +            if (opt.gzip) {
    +                if (typeof opt.gzip !== 'object') {
    +                    opt.gzip = {};
    +                }
    +                if (this.portable) {
    +                    opt.gzip.portable = true;
    +                }
    +                this.zip = new zlib.Gzip(opt.gzip);
    +            }
    +            if (opt.brotli) {
    +                if (typeof opt.brotli !== 'object') {
    +                    opt.brotli = {};
    +                }
    +                this.zip = new zlib.BrotliCompress(opt.brotli);
    +            }
    +            /* c8 ignore next */
    +            if (!this.zip)
    +                throw new Error('impossible');
    +            const zip = this.zip;
    +            zip.on('data', chunk => super.write(chunk));
    +            zip.on('end', () => super.end());
    +            zip.on('drain', () => this[ONDRAIN]());
    +            this.on('resume', () => zip.resume());
    +        }
    +        else {
    +            this.on('drain', this[ONDRAIN]);
    +        }
    +        this.noDirRecurse = !!opt.noDirRecurse;
    +        this.follow = !!opt.follow;
    +        this.noMtime = !!opt.noMtime;
    +        if (opt.mtime)
    +            this.mtime = opt.mtime;
    +        this.filter =
    +            typeof opt.filter === 'function' ? opt.filter : () => true;
    +        this[QUEUE] = new yallist_1.Yallist();
    +        this[JOBS] = 0;
    +        this.jobs = Number(opt.jobs) || 4;
    +        this[PROCESSING] = false;
    +        this[ENDED] = false;
    +    }
    +    [WRITE](chunk) {
    +        return super.write(chunk);
    +    }
    +    add(path) {
    +        this.write(path);
    +        return this;
    +    }
    +    end(path, encoding, cb) {
    +        /* c8 ignore start */
    +        if (typeof path === 'function') {
    +            cb = path;
    +            path = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        /* c8 ignore stop */
    +        if (path) {
    +            this.add(path);
    +        }
    +        this[ENDED] = true;
    +        this[PROCESS]();
    +        /* c8 ignore next */
    +        if (cb)
    +            cb();
    +        return this;
    +    }
    +    write(path) {
    +        if (this[ENDED]) {
    +            throw new Error('write after end');
    +        }
    +        if (path instanceof read_entry_js_1.ReadEntry) {
    +            this[ADDTARENTRY](path);
    +        }
    +        else {
    +            this[ADDFSENTRY](path);
    +        }
    +        return this.flowing;
    +    }
    +    [ADDTARENTRY](p) {
    +        const absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.resolve(this.cwd, p.path));
    +        // in this case, we don't have to wait for the stat
    +        if (!this.filter(p.path, p)) {
    +            p.resume();
    +        }
    +        else {
    +            const job = new PackJob(p.path, absolute);
    +            job.entry = new write_entry_js_1.WriteEntryTar(p, this[ENTRYOPT](job));
    +            job.entry.on('end', () => this[JOBDONE](job));
    +            this[JOBS] += 1;
    +            this[QUEUE].push(job);
    +        }
    +        this[PROCESS]();
    +    }
    +    [ADDFSENTRY](p) {
    +        const absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.resolve(this.cwd, p));
    +        this[QUEUE].push(new PackJob(p, absolute));
    +        this[PROCESS]();
    +    }
    +    [STAT](job) {
    +        job.pending = true;
    +        this[JOBS] += 1;
    +        const stat = this.follow ? 'stat' : 'lstat';
    +        fs_1.default[stat](job.absolute, (er, stat) => {
    +            job.pending = false;
    +            this[JOBS] -= 1;
    +            if (er) {
    +                this.emit('error', er);
    +            }
    +            else {
    +                this[ONSTAT](job, stat);
    +            }
    +        });
    +    }
    +    [ONSTAT](job, stat) {
    +        this.statCache.set(job.absolute, stat);
    +        job.stat = stat;
    +        // now we have the stat, we can filter it.
    +        if (!this.filter(job.path, stat)) {
    +            job.ignore = true;
    +        }
    +        this[PROCESS]();
    +    }
    +    [READDIR](job) {
    +        job.pending = true;
    +        this[JOBS] += 1;
    +        fs_1.default.readdir(job.absolute, (er, entries) => {
    +            job.pending = false;
    +            this[JOBS] -= 1;
    +            if (er) {
    +                return this.emit('error', er);
    +            }
    +            this[ONREADDIR](job, entries);
    +        });
    +    }
    +    [ONREADDIR](job, entries) {
    +        this.readdirCache.set(job.absolute, entries);
    +        job.readdir = entries;
    +        this[PROCESS]();
    +    }
    +    [PROCESS]() {
    +        if (this[PROCESSING]) {
    +            return;
    +        }
    +        this[PROCESSING] = true;
    +        for (let w = this[QUEUE].head; !!w && this[JOBS] < this.jobs; w = w.next) {
    +            this[PROCESSJOB](w.value);
    +            if (w.value.ignore) {
    +                const p = w.next;
    +                this[QUEUE].removeNode(w);
    +                w.next = p;
    +            }
    +        }
    +        this[PROCESSING] = false;
    +        if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) {
    +            if (this.zip) {
    +                this.zip.end(EOF);
    +            }
    +            else {
    +                super.write(EOF);
    +                super.end();
    +            }
    +        }
    +    }
    +    get [CURRENT]() {
    +        return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value;
    +    }
    +    [JOBDONE](_job) {
    +        this[QUEUE].shift();
    +        this[JOBS] -= 1;
    +        this[PROCESS]();
    +    }
    +    [PROCESSJOB](job) {
    +        if (job.pending) {
    +            return;
    +        }
    +        if (job.entry) {
    +            if (job === this[CURRENT] && !job.piped) {
    +                this[PIPE](job);
    +            }
    +            return;
    +        }
    +        if (!job.stat) {
    +            const sc = this.statCache.get(job.absolute);
    +            if (sc) {
    +                this[ONSTAT](job, sc);
    +            }
    +            else {
    +                this[STAT](job);
    +            }
    +        }
    +        if (!job.stat) {
    +            return;
    +        }
    +        // filtered out!
    +        if (job.ignore) {
    +            return;
    +        }
    +        if (!this.noDirRecurse &&
    +            job.stat.isDirectory() &&
    +            !job.readdir) {
    +            const rc = this.readdirCache.get(job.absolute);
    +            if (rc) {
    +                this[ONREADDIR](job, rc);
    +            }
    +            else {
    +                this[READDIR](job);
    +            }
    +            if (!job.readdir) {
    +                return;
    +            }
    +        }
    +        // we know it doesn't have an entry, because that got checked above
    +        job.entry = this[ENTRY](job);
    +        if (!job.entry) {
    +            job.ignore = true;
    +            return;
    +        }
    +        if (job === this[CURRENT] && !job.piped) {
    +            this[PIPE](job);
    +        }
    +    }
    +    [ENTRYOPT](job) {
    +        return {
    +            onwarn: (code, msg, data) => this.warn(code, msg, data),
    +            noPax: this.noPax,
    +            cwd: this.cwd,
    +            absolute: job.absolute,
    +            preservePaths: this.preservePaths,
    +            maxReadSize: this.maxReadSize,
    +            strict: this.strict,
    +            portable: this.portable,
    +            linkCache: this.linkCache,
    +            statCache: this.statCache,
    +            noMtime: this.noMtime,
    +            mtime: this.mtime,
    +            prefix: this.prefix,
    +            onWriteEntry: this.onWriteEntry,
    +        };
    +    }
    +    [ENTRY](job) {
    +        this[JOBS] += 1;
    +        try {
    +            const e = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job));
    +            return e
    +                .on('end', () => this[JOBDONE](job))
    +                .on('error', er => this.emit('error', er));
    +        }
    +        catch (er) {
    +            this.emit('error', er);
    +        }
    +    }
    +    [ONDRAIN]() {
    +        if (this[CURRENT] && this[CURRENT].entry) {
    +            this[CURRENT].entry.resume();
    +        }
    +    }
    +    // like .pipe() but using super, because our write() is special
    +    [PIPE](job) {
    +        job.piped = true;
    +        if (job.readdir) {
    +            job.readdir.forEach(entry => {
    +                const p = job.path;
    +                const base = p === './' ? '' : p.replace(/\/*$/, '/');
    +                this[ADDFSENTRY](base + entry);
    +            });
    +        }
    +        const source = job.entry;
    +        const zip = this.zip;
    +        /* c8 ignore start */
    +        if (!source)
    +            throw new Error('cannot pipe without source');
    +        /* c8 ignore stop */
    +        if (zip) {
    +            source.on('data', chunk => {
    +                if (!zip.write(chunk)) {
    +                    source.pause();
    +                }
    +            });
    +        }
    +        else {
    +            source.on('data', chunk => {
    +                if (!super.write(chunk)) {
    +                    source.pause();
    +                }
    +            });
    +        }
    +    }
    +    pause() {
    +        if (this.zip) {
    +            this.zip.pause();
    +        }
    +        return super.pause();
    +    }
    +    warn(code, message, data = {}) {
    +        (0, warn_method_js_1.warnMethod)(this, code, message, data);
    +    }
    +}
    +exports.Pack = Pack;
    +class PackSync extends Pack {
    +    sync = true;
    +    constructor(opt) {
    +        super(opt);
    +        this[WRITEENTRYCLASS] = write_entry_js_1.WriteEntrySync;
    +    }
    +    // pause/resume are no-ops in sync streams.
    +    pause() { }
    +    resume() { }
    +    [STAT](job) {
    +        const stat = this.follow ? 'statSync' : 'lstatSync';
    +        this[ONSTAT](job, fs_1.default[stat](job.absolute));
    +    }
    +    [READDIR](job) {
    +        this[ONREADDIR](job, fs_1.default.readdirSync(job.absolute));
    +    }
    +    // gotta get it all in this tick
    +    [PIPE](job) {
    +        const source = job.entry;
    +        const zip = this.zip;
    +        if (job.readdir) {
    +            job.readdir.forEach(entry => {
    +                const p = job.path;
    +                const base = p === './' ? '' : p.replace(/\/*$/, '/');
    +                this[ADDFSENTRY](base + entry);
    +            });
    +        }
    +        /* c8 ignore start */
    +        if (!source)
    +            throw new Error('Cannot pipe without source');
    +        /* c8 ignore stop */
    +        if (zip) {
    +            source.on('data', chunk => {
    +                zip.write(chunk);
    +            });
    +        }
    +        else {
    +            source.on('data', chunk => {
    +                super[WRITE](chunk);
    +            });
    +        }
    +    }
    +}
    +exports.PackSync = PackSync;
    +//# sourceMappingURL=pack.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/parse.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/parse.js
    new file mode 100644
    index 00000000..9746a258
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/parse.js
    @@ -0,0 +1,599 @@
    +"use strict";
    +// this[BUFFER] is the remainder of a chunk if we're waiting for
    +// the full 512 bytes of a header to come in.  We will Buffer.concat()
    +// it to the next write(), which is a mem copy, but a small one.
    +//
    +// this[QUEUE] is a Yallist of entries that haven't been emitted
    +// yet this can only get filled up if the user keeps write()ing after
    +// a write() returns false, or does a write() with more than one entry
    +//
    +// We don't buffer chunks, we always parse them and either create an
    +// entry, or push it into the active entry.  The ReadEntry class knows
    +// to throw data away if .ignore=true
    +//
    +// Shift entry off the buffer when it emits 'end', and emit 'entry' for
    +// the next one in the list.
    +//
    +// At any time, we're pushing body chunks into the entry at WRITEENTRY,
    +// and waiting for 'end' on the entry at READENTRY
    +//
    +// ignored entries get .resume() called on them straight away
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.Parser = void 0;
    +const events_1 = require("events");
    +const minizlib_1 = require("minizlib");
    +const yallist_1 = require("yallist");
    +const header_js_1 = require("./header.js");
    +const pax_js_1 = require("./pax.js");
    +const read_entry_js_1 = require("./read-entry.js");
    +const warn_method_js_1 = require("./warn-method.js");
    +const maxMetaEntrySize = 1024 * 1024;
    +const gzipHeader = Buffer.from([0x1f, 0x8b]);
    +const STATE = Symbol('state');
    +const WRITEENTRY = Symbol('writeEntry');
    +const READENTRY = Symbol('readEntry');
    +const NEXTENTRY = Symbol('nextEntry');
    +const PROCESSENTRY = Symbol('processEntry');
    +const EX = Symbol('extendedHeader');
    +const GEX = Symbol('globalExtendedHeader');
    +const META = Symbol('meta');
    +const EMITMETA = Symbol('emitMeta');
    +const BUFFER = Symbol('buffer');
    +const QUEUE = Symbol('queue');
    +const ENDED = Symbol('ended');
    +const EMITTEDEND = Symbol('emittedEnd');
    +const EMIT = Symbol('emit');
    +const UNZIP = Symbol('unzip');
    +const CONSUMECHUNK = Symbol('consumeChunk');
    +const CONSUMECHUNKSUB = Symbol('consumeChunkSub');
    +const CONSUMEBODY = Symbol('consumeBody');
    +const CONSUMEMETA = Symbol('consumeMeta');
    +const CONSUMEHEADER = Symbol('consumeHeader');
    +const CONSUMING = Symbol('consuming');
    +const BUFFERCONCAT = Symbol('bufferConcat');
    +const MAYBEEND = Symbol('maybeEnd');
    +const WRITING = Symbol('writing');
    +const ABORTED = Symbol('aborted');
    +const DONE = Symbol('onDone');
    +const SAW_VALID_ENTRY = Symbol('sawValidEntry');
    +const SAW_NULL_BLOCK = Symbol('sawNullBlock');
    +const SAW_EOF = Symbol('sawEOF');
    +const CLOSESTREAM = Symbol('closeStream');
    +const noop = () => true;
    +class Parser extends events_1.EventEmitter {
    +    file;
    +    strict;
    +    maxMetaEntrySize;
    +    filter;
    +    brotli;
    +    writable = true;
    +    readable = false;
    +    [QUEUE] = new yallist_1.Yallist();
    +    [BUFFER];
    +    [READENTRY];
    +    [WRITEENTRY];
    +    [STATE] = 'begin';
    +    [META] = '';
    +    [EX];
    +    [GEX];
    +    [ENDED] = false;
    +    [UNZIP];
    +    [ABORTED] = false;
    +    [SAW_VALID_ENTRY];
    +    [SAW_NULL_BLOCK] = false;
    +    [SAW_EOF] = false;
    +    [WRITING] = false;
    +    [CONSUMING] = false;
    +    [EMITTEDEND] = false;
    +    constructor(opt = {}) {
    +        super();
    +        this.file = opt.file || '';
    +        // these BADARCHIVE errors can't be detected early. listen on DONE.
    +        this.on(DONE, () => {
    +            if (this[STATE] === 'begin' ||
    +                this[SAW_VALID_ENTRY] === false) {
    +                // either less than 1 block of data, or all entries were invalid.
    +                // Either way, probably not even a tarball.
    +                this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format');
    +            }
    +        });
    +        if (opt.ondone) {
    +            this.on(DONE, opt.ondone);
    +        }
    +        else {
    +            this.on(DONE, () => {
    +                this.emit('prefinish');
    +                this.emit('finish');
    +                this.emit('end');
    +            });
    +        }
    +        this.strict = !!opt.strict;
    +        this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize;
    +        this.filter = typeof opt.filter === 'function' ? opt.filter : noop;
    +        // Unlike gzip, brotli doesn't have any magic bytes to identify it
    +        // Users need to explicitly tell us they're extracting a brotli file
    +        // Or we infer from the file extension
    +        const isTBR = opt.file &&
    +            (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr'));
    +        // if it's a tbr file it MIGHT be brotli, but we don't know until
    +        // we look at it and verify it's not a valid tar file.
    +        this.brotli =
    +            !opt.gzip && opt.brotli !== undefined ? opt.brotli
    +                : isTBR ? undefined
    +                    : false;
    +        // have to set this so that streams are ok piping into it
    +        this.on('end', () => this[CLOSESTREAM]());
    +        if (typeof opt.onwarn === 'function') {
    +            this.on('warn', opt.onwarn);
    +        }
    +        if (typeof opt.onReadEntry === 'function') {
    +            this.on('entry', opt.onReadEntry);
    +        }
    +    }
    +    warn(code, message, data = {}) {
    +        (0, warn_method_js_1.warnMethod)(this, code, message, data);
    +    }
    +    [CONSUMEHEADER](chunk, position) {
    +        if (this[SAW_VALID_ENTRY] === undefined) {
    +            this[SAW_VALID_ENTRY] = false;
    +        }
    +        let header;
    +        try {
    +            header = new header_js_1.Header(chunk, position, this[EX], this[GEX]);
    +        }
    +        catch (er) {
    +            return this.warn('TAR_ENTRY_INVALID', er);
    +        }
    +        if (header.nullBlock) {
    +            if (this[SAW_NULL_BLOCK]) {
    +                this[SAW_EOF] = true;
    +                // ending an archive with no entries.  pointless, but legal.
    +                if (this[STATE] === 'begin') {
    +                    this[STATE] = 'header';
    +                }
    +                this[EMIT]('eof');
    +            }
    +            else {
    +                this[SAW_NULL_BLOCK] = true;
    +                this[EMIT]('nullBlock');
    +            }
    +        }
    +        else {
    +            this[SAW_NULL_BLOCK] = false;
    +            if (!header.cksumValid) {
    +                this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header });
    +            }
    +            else if (!header.path) {
    +                this.warn('TAR_ENTRY_INVALID', 'path is required', { header });
    +            }
    +            else {
    +                const type = header.type;
    +                if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) {
    +                    this.warn('TAR_ENTRY_INVALID', 'linkpath required', {
    +                        header,
    +                    });
    +                }
    +                else if (!/^(Symbolic)?Link$/.test(type) &&
    +                    !/^(Global)?ExtendedHeader$/.test(type) &&
    +                    header.linkpath) {
    +                    this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', {
    +                        header,
    +                    });
    +                }
    +                else {
    +                    const entry = (this[WRITEENTRY] = new read_entry_js_1.ReadEntry(header, this[EX], this[GEX]));
    +                    // we do this for meta & ignored entries as well, because they
    +                    // are still valid tar, or else we wouldn't know to ignore them
    +                    if (!this[SAW_VALID_ENTRY]) {
    +                        if (entry.remain) {
    +                            // this might be the one!
    +                            const onend = () => {
    +                                if (!entry.invalid) {
    +                                    this[SAW_VALID_ENTRY] = true;
    +                                }
    +                            };
    +                            entry.on('end', onend);
    +                        }
    +                        else {
    +                            this[SAW_VALID_ENTRY] = true;
    +                        }
    +                    }
    +                    if (entry.meta) {
    +                        if (entry.size > this.maxMetaEntrySize) {
    +                            entry.ignore = true;
    +                            this[EMIT]('ignoredEntry', entry);
    +                            this[STATE] = 'ignore';
    +                            entry.resume();
    +                        }
    +                        else if (entry.size > 0) {
    +                            this[META] = '';
    +                            entry.on('data', c => (this[META] += c));
    +                            this[STATE] = 'meta';
    +                        }
    +                    }
    +                    else {
    +                        this[EX] = undefined;
    +                        entry.ignore =
    +                            entry.ignore || !this.filter(entry.path, entry);
    +                        if (entry.ignore) {
    +                            // probably valid, just not something we care about
    +                            this[EMIT]('ignoredEntry', entry);
    +                            this[STATE] = entry.remain ? 'ignore' : 'header';
    +                            entry.resume();
    +                        }
    +                        else {
    +                            if (entry.remain) {
    +                                this[STATE] = 'body';
    +                            }
    +                            else {
    +                                this[STATE] = 'header';
    +                                entry.end();
    +                            }
    +                            if (!this[READENTRY]) {
    +                                this[QUEUE].push(entry);
    +                                this[NEXTENTRY]();
    +                            }
    +                            else {
    +                                this[QUEUE].push(entry);
    +                            }
    +                        }
    +                    }
    +                }
    +            }
    +        }
    +    }
    +    [CLOSESTREAM]() {
    +        queueMicrotask(() => this.emit('close'));
    +    }
    +    [PROCESSENTRY](entry) {
    +        let go = true;
    +        if (!entry) {
    +            this[READENTRY] = undefined;
    +            go = false;
    +        }
    +        else if (Array.isArray(entry)) {
    +            const [ev, ...args] = entry;
    +            this.emit(ev, ...args);
    +        }
    +        else {
    +            this[READENTRY] = entry;
    +            this.emit('entry', entry);
    +            if (!entry.emittedEnd) {
    +                entry.on('end', () => this[NEXTENTRY]());
    +                go = false;
    +            }
    +        }
    +        return go;
    +    }
    +    [NEXTENTRY]() {
    +        do { } while (this[PROCESSENTRY](this[QUEUE].shift()));
    +        if (!this[QUEUE].length) {
    +            // At this point, there's nothing in the queue, but we may have an
    +            // entry which is being consumed (readEntry).
    +            // If we don't, then we definitely can handle more data.
    +            // If we do, and either it's flowing, or it has never had any data
    +            // written to it, then it needs more.
    +            // The only other possibility is that it has returned false from a
    +            // write() call, so we wait for the next drain to continue.
    +            const re = this[READENTRY];
    +            const drainNow = !re || re.flowing || re.size === re.remain;
    +            if (drainNow) {
    +                if (!this[WRITING]) {
    +                    this.emit('drain');
    +                }
    +            }
    +            else {
    +                re.once('drain', () => this.emit('drain'));
    +            }
    +        }
    +    }
    +    [CONSUMEBODY](chunk, position) {
    +        // write up to but no  more than writeEntry.blockRemain
    +        const entry = this[WRITEENTRY];
    +        /* c8 ignore start */
    +        if (!entry) {
    +            throw new Error('attempt to consume body without entry??');
    +        }
    +        const br = entry.blockRemain ?? 0;
    +        /* c8 ignore stop */
    +        const c = br >= chunk.length && position === 0 ?
    +            chunk
    +            : chunk.subarray(position, position + br);
    +        entry.write(c);
    +        if (!entry.blockRemain) {
    +            this[STATE] = 'header';
    +            this[WRITEENTRY] = undefined;
    +            entry.end();
    +        }
    +        return c.length;
    +    }
    +    [CONSUMEMETA](chunk, position) {
    +        const entry = this[WRITEENTRY];
    +        const ret = this[CONSUMEBODY](chunk, position);
    +        // if we finished, then the entry is reset
    +        if (!this[WRITEENTRY] && entry) {
    +            this[EMITMETA](entry);
    +        }
    +        return ret;
    +    }
    +    [EMIT](ev, data, extra) {
    +        if (!this[QUEUE].length && !this[READENTRY]) {
    +            this.emit(ev, data, extra);
    +        }
    +        else {
    +            this[QUEUE].push([ev, data, extra]);
    +        }
    +    }
    +    [EMITMETA](entry) {
    +        this[EMIT]('meta', this[META]);
    +        switch (entry.type) {
    +            case 'ExtendedHeader':
    +            case 'OldExtendedHeader':
    +                this[EX] = pax_js_1.Pax.parse(this[META], this[EX], false);
    +                break;
    +            case 'GlobalExtendedHeader':
    +                this[GEX] = pax_js_1.Pax.parse(this[META], this[GEX], true);
    +                break;
    +            case 'NextFileHasLongPath':
    +            case 'OldGnuLongPath': {
    +                const ex = this[EX] ?? Object.create(null);
    +                this[EX] = ex;
    +                ex.path = this[META].replace(/\0.*/, '');
    +                break;
    +            }
    +            case 'NextFileHasLongLinkpath': {
    +                const ex = this[EX] || Object.create(null);
    +                this[EX] = ex;
    +                ex.linkpath = this[META].replace(/\0.*/, '');
    +                break;
    +            }
    +            /* c8 ignore start */
    +            default:
    +                throw new Error('unknown meta: ' + entry.type);
    +            /* c8 ignore stop */
    +        }
    +    }
    +    abort(error) {
    +        this[ABORTED] = true;
    +        this.emit('abort', error);
    +        // always throws, even in non-strict mode
    +        this.warn('TAR_ABORT', error, { recoverable: false });
    +    }
    +    write(chunk, encoding, cb) {
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        if (typeof chunk === 'string') {
    +            chunk = Buffer.from(chunk, 
    +            /* c8 ignore next */
    +            typeof encoding === 'string' ? encoding : 'utf8');
    +        }
    +        if (this[ABORTED]) {
    +            /* c8 ignore next */
    +            cb?.();
    +            return false;
    +        }
    +        // first write, might be gzipped
    +        const needSniff = this[UNZIP] === undefined ||
    +            (this.brotli === undefined && this[UNZIP] === false);
    +        if (needSniff && chunk) {
    +            if (this[BUFFER]) {
    +                chunk = Buffer.concat([this[BUFFER], chunk]);
    +                this[BUFFER] = undefined;
    +            }
    +            if (chunk.length < gzipHeader.length) {
    +                this[BUFFER] = chunk;
    +                /* c8 ignore next */
    +                cb?.();
    +                return true;
    +            }
    +            // look for gzip header
    +            for (let i = 0; this[UNZIP] === undefined && i < gzipHeader.length; i++) {
    +                if (chunk[i] !== gzipHeader[i]) {
    +                    this[UNZIP] = false;
    +                }
    +            }
    +            const maybeBrotli = this.brotli === undefined;
    +            if (this[UNZIP] === false && maybeBrotli) {
    +                // read the first header to see if it's a valid tar file. If so,
    +                // we can safely assume that it's not actually brotli, despite the
    +                // .tbr or .tar.br file extension.
    +                // if we ended before getting a full chunk, yes, def brotli
    +                if (chunk.length < 512) {
    +                    if (this[ENDED]) {
    +                        this.brotli = true;
    +                    }
    +                    else {
    +                        this[BUFFER] = chunk;
    +                        /* c8 ignore next */
    +                        cb?.();
    +                        return true;
    +                    }
    +                }
    +                else {
    +                    // if it's tar, it's pretty reliably not brotli, chances of
    +                    // that happening are astronomical.
    +                    try {
    +                        new header_js_1.Header(chunk.subarray(0, 512));
    +                        this.brotli = false;
    +                    }
    +                    catch (_) {
    +                        this.brotli = true;
    +                    }
    +                }
    +            }
    +            if (this[UNZIP] === undefined ||
    +                (this[UNZIP] === false && this.brotli)) {
    +                const ended = this[ENDED];
    +                this[ENDED] = false;
    +                this[UNZIP] =
    +                    this[UNZIP] === undefined ?
    +                        new minizlib_1.Unzip({})
    +                        : new minizlib_1.BrotliDecompress({});
    +                this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk));
    +                this[UNZIP].on('error', er => this.abort(er));
    +                this[UNZIP].on('end', () => {
    +                    this[ENDED] = true;
    +                    this[CONSUMECHUNK]();
    +                });
    +                this[WRITING] = true;
    +                const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk);
    +                this[WRITING] = false;
    +                cb?.();
    +                return ret;
    +            }
    +        }
    +        this[WRITING] = true;
    +        if (this[UNZIP]) {
    +            this[UNZIP].write(chunk);
    +        }
    +        else {
    +            this[CONSUMECHUNK](chunk);
    +        }
    +        this[WRITING] = false;
    +        // return false if there's a queue, or if the current entry isn't flowing
    +        const ret = this[QUEUE].length ? false
    +            : this[READENTRY] ? this[READENTRY].flowing
    +                : true;
    +        // if we have no queue, then that means a clogged READENTRY
    +        if (!ret && !this[QUEUE].length) {
    +            this[READENTRY]?.once('drain', () => this.emit('drain'));
    +        }
    +        /* c8 ignore next */
    +        cb?.();
    +        return ret;
    +    }
    +    [BUFFERCONCAT](c) {
    +        if (c && !this[ABORTED]) {
    +            this[BUFFER] =
    +                this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c;
    +        }
    +    }
    +    [MAYBEEND]() {
    +        if (this[ENDED] &&
    +            !this[EMITTEDEND] &&
    +            !this[ABORTED] &&
    +            !this[CONSUMING]) {
    +            this[EMITTEDEND] = true;
    +            const entry = this[WRITEENTRY];
    +            if (entry && entry.blockRemain) {
    +                // truncated, likely a damaged file
    +                const have = this[BUFFER] ? this[BUFFER].length : 0;
    +                this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry });
    +                if (this[BUFFER]) {
    +                    entry.write(this[BUFFER]);
    +                }
    +                entry.end();
    +            }
    +            this[EMIT](DONE);
    +        }
    +    }
    +    [CONSUMECHUNK](chunk) {
    +        if (this[CONSUMING] && chunk) {
    +            this[BUFFERCONCAT](chunk);
    +        }
    +        else if (!chunk && !this[BUFFER]) {
    +            this[MAYBEEND]();
    +        }
    +        else if (chunk) {
    +            this[CONSUMING] = true;
    +            if (this[BUFFER]) {
    +                this[BUFFERCONCAT](chunk);
    +                const c = this[BUFFER];
    +                this[BUFFER] = undefined;
    +                this[CONSUMECHUNKSUB](c);
    +            }
    +            else {
    +                this[CONSUMECHUNKSUB](chunk);
    +            }
    +            while (this[BUFFER] &&
    +                this[BUFFER]?.length >= 512 &&
    +                !this[ABORTED] &&
    +                !this[SAW_EOF]) {
    +                const c = this[BUFFER];
    +                this[BUFFER] = undefined;
    +                this[CONSUMECHUNKSUB](c);
    +            }
    +            this[CONSUMING] = false;
    +        }
    +        if (!this[BUFFER] || this[ENDED]) {
    +            this[MAYBEEND]();
    +        }
    +    }
    +    [CONSUMECHUNKSUB](chunk) {
    +        // we know that we are in CONSUMING mode, so anything written goes into
    +        // the buffer.  Advance the position and put any remainder in the buffer.
    +        let position = 0;
    +        const length = chunk.length;
    +        while (position + 512 <= length &&
    +            !this[ABORTED] &&
    +            !this[SAW_EOF]) {
    +            switch (this[STATE]) {
    +                case 'begin':
    +                case 'header':
    +                    this[CONSUMEHEADER](chunk, position);
    +                    position += 512;
    +                    break;
    +                case 'ignore':
    +                case 'body':
    +                    position += this[CONSUMEBODY](chunk, position);
    +                    break;
    +                case 'meta':
    +                    position += this[CONSUMEMETA](chunk, position);
    +                    break;
    +                /* c8 ignore start */
    +                default:
    +                    throw new Error('invalid state: ' + this[STATE]);
    +                /* c8 ignore stop */
    +            }
    +        }
    +        if (position < length) {
    +            if (this[BUFFER]) {
    +                this[BUFFER] = Buffer.concat([
    +                    chunk.subarray(position),
    +                    this[BUFFER],
    +                ]);
    +            }
    +            else {
    +                this[BUFFER] = chunk.subarray(position);
    +            }
    +        }
    +    }
    +    end(chunk, encoding, cb) {
    +        if (typeof chunk === 'function') {
    +            cb = chunk;
    +            encoding = undefined;
    +            chunk = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        if (typeof chunk === 'string') {
    +            chunk = Buffer.from(chunk, encoding);
    +        }
    +        if (cb)
    +            this.once('finish', cb);
    +        if (!this[ABORTED]) {
    +            if (this[UNZIP]) {
    +                /* c8 ignore start */
    +                if (chunk)
    +                    this[UNZIP].write(chunk);
    +                /* c8 ignore stop */
    +                this[UNZIP].end();
    +            }
    +            else {
    +                this[ENDED] = true;
    +                if (this.brotli === undefined)
    +                    chunk = chunk || Buffer.alloc(0);
    +                if (chunk)
    +                    this.write(chunk);
    +                this[MAYBEEND]();
    +            }
    +        }
    +        return this;
    +    }
    +}
    +exports.Parser = Parser;
    +//# sourceMappingURL=parse.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/path-reservations.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/path-reservations.js
    new file mode 100644
    index 00000000..9ff391c4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/path-reservations.js
    @@ -0,0 +1,170 @@
    +"use strict";
    +// A path exclusive reservation system
    +// reserve([list, of, paths], fn)
    +// When the fn is first in line for all its paths, it
    +// is called with a cb that clears the reservation.
    +//
    +// Used by async unpack to avoid clobbering paths in use,
    +// while still allowing maximal safe parallelization.
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.PathReservations = void 0;
    +const node_path_1 = require("node:path");
    +const normalize_unicode_js_1 = require("./normalize-unicode.js");
    +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js");
    +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
    +const isWindows = platform === 'win32';
    +// return a set of parent dirs for a given path
    +// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d']
    +const getDirs = (path) => {
    +    const dirs = path
    +        .split('/')
    +        .slice(0, -1)
    +        .reduce((set, path) => {
    +        const s = set[set.length - 1];
    +        if (s !== undefined) {
    +            path = (0, node_path_1.join)(s, path);
    +        }
    +        set.push(path || '/');
    +        return set;
    +    }, []);
    +    return dirs;
    +};
    +class PathReservations {
    +    // path => [function or Set]
    +    // A Set object means a directory reservation
    +    // A fn is a direct reservation on that path
    +    #queues = new Map();
    +    // fn => {paths:[path,...], dirs:[path, ...]}
    +    #reservations = new Map();
    +    // functions currently running
    +    #running = new Set();
    +    reserve(paths, fn) {
    +        paths =
    +            isWindows ?
    +                ['win32 parallelization disabled']
    +                : paths.map(p => {
    +                    // don't need normPath, because we skip this entirely for windows
    +                    return (0, strip_trailing_slashes_js_1.stripTrailingSlashes)((0, node_path_1.join)((0, normalize_unicode_js_1.normalizeUnicode)(p))).toLowerCase();
    +                });
    +        const dirs = new Set(paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b)));
    +        this.#reservations.set(fn, { dirs, paths });
    +        for (const p of paths) {
    +            const q = this.#queues.get(p);
    +            if (!q) {
    +                this.#queues.set(p, [fn]);
    +            }
    +            else {
    +                q.push(fn);
    +            }
    +        }
    +        for (const dir of dirs) {
    +            const q = this.#queues.get(dir);
    +            if (!q) {
    +                this.#queues.set(dir, [new Set([fn])]);
    +            }
    +            else {
    +                const l = q[q.length - 1];
    +                if (l instanceof Set) {
    +                    l.add(fn);
    +                }
    +                else {
    +                    q.push(new Set([fn]));
    +                }
    +            }
    +        }
    +        return this.#run(fn);
    +    }
    +    // return the queues for each path the function cares about
    +    // fn => {paths, dirs}
    +    #getQueues(fn) {
    +        const res = this.#reservations.get(fn);
    +        /* c8 ignore start */
    +        if (!res) {
    +            throw new Error('function does not have any path reservations');
    +        }
    +        /* c8 ignore stop */
    +        return {
    +            paths: res.paths.map((path) => this.#queues.get(path)),
    +            dirs: [...res.dirs].map(path => this.#queues.get(path)),
    +        };
    +    }
    +    // check if fn is first in line for all its paths, and is
    +    // included in the first set for all its dir queues
    +    check(fn) {
    +        const { paths, dirs } = this.#getQueues(fn);
    +        return (paths.every(q => q && q[0] === fn) &&
    +            dirs.every(q => q && q[0] instanceof Set && q[0].has(fn)));
    +    }
    +    // run the function if it's first in line and not already running
    +    #run(fn) {
    +        if (this.#running.has(fn) || !this.check(fn)) {
    +            return false;
    +        }
    +        this.#running.add(fn);
    +        fn(() => this.#clear(fn));
    +        return true;
    +    }
    +    #clear(fn) {
    +        if (!this.#running.has(fn)) {
    +            return false;
    +        }
    +        const res = this.#reservations.get(fn);
    +        /* c8 ignore start */
    +        if (!res) {
    +            throw new Error('invalid reservation');
    +        }
    +        /* c8 ignore stop */
    +        const { paths, dirs } = res;
    +        const next = new Set();
    +        for (const path of paths) {
    +            const q = this.#queues.get(path);
    +            /* c8 ignore start */
    +            if (!q || q?.[0] !== fn) {
    +                continue;
    +            }
    +            /* c8 ignore stop */
    +            const q0 = q[1];
    +            if (!q0) {
    +                this.#queues.delete(path);
    +                continue;
    +            }
    +            q.shift();
    +            if (typeof q0 === 'function') {
    +                next.add(q0);
    +            }
    +            else {
    +                for (const f of q0) {
    +                    next.add(f);
    +                }
    +            }
    +        }
    +        for (const dir of dirs) {
    +            const q = this.#queues.get(dir);
    +            const q0 = q?.[0];
    +            /* c8 ignore next - type safety only */
    +            if (!q || !(q0 instanceof Set))
    +                continue;
    +            if (q0.size === 1 && q.length === 1) {
    +                this.#queues.delete(dir);
    +                continue;
    +            }
    +            else if (q0.size === 1) {
    +                q.shift();
    +                // next one must be a function,
    +                // or else the Set would've been reused
    +                const n = q[0];
    +                if (typeof n === 'function') {
    +                    next.add(n);
    +                }
    +            }
    +            else {
    +                q0.delete(fn);
    +            }
    +        }
    +        this.#running.delete(fn);
    +        next.forEach(fn => this.#run(fn));
    +        return true;
    +    }
    +}
    +exports.PathReservations = PathReservations;
    +//# sourceMappingURL=path-reservations.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/pax.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/pax.js
    new file mode 100644
    index 00000000..d30c0f3e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/pax.js
    @@ -0,0 +1,158 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.Pax = void 0;
    +const node_path_1 = require("node:path");
    +const header_js_1 = require("./header.js");
    +class Pax {
    +    atime;
    +    mtime;
    +    ctime;
    +    charset;
    +    comment;
    +    gid;
    +    uid;
    +    gname;
    +    uname;
    +    linkpath;
    +    dev;
    +    ino;
    +    nlink;
    +    path;
    +    size;
    +    mode;
    +    global;
    +    constructor(obj, global = false) {
    +        this.atime = obj.atime;
    +        this.charset = obj.charset;
    +        this.comment = obj.comment;
    +        this.ctime = obj.ctime;
    +        this.dev = obj.dev;
    +        this.gid = obj.gid;
    +        this.global = global;
    +        this.gname = obj.gname;
    +        this.ino = obj.ino;
    +        this.linkpath = obj.linkpath;
    +        this.mtime = obj.mtime;
    +        this.nlink = obj.nlink;
    +        this.path = obj.path;
    +        this.size = obj.size;
    +        this.uid = obj.uid;
    +        this.uname = obj.uname;
    +    }
    +    encode() {
    +        const body = this.encodeBody();
    +        if (body === '') {
    +            return Buffer.allocUnsafe(0);
    +        }
    +        const bodyLen = Buffer.byteLength(body);
    +        // round up to 512 bytes
    +        // add 512 for header
    +        const bufLen = 512 * Math.ceil(1 + bodyLen / 512);
    +        const buf = Buffer.allocUnsafe(bufLen);
    +        // 0-fill the header section, it might not hit every field
    +        for (let i = 0; i < 512; i++) {
    +            buf[i] = 0;
    +        }
    +        new header_js_1.Header({
    +            // XXX split the path
    +            // then the path should be PaxHeader + basename, but less than 99,
    +            // prepend with the dirname
    +            /* c8 ignore start */
    +            path: ('PaxHeader/' + (0, node_path_1.basename)(this.path ?? '')).slice(0, 99),
    +            /* c8 ignore stop */
    +            mode: this.mode || 0o644,
    +            uid: this.uid,
    +            gid: this.gid,
    +            size: bodyLen,
    +            mtime: this.mtime,
    +            type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',
    +            linkpath: '',
    +            uname: this.uname || '',
    +            gname: this.gname || '',
    +            devmaj: 0,
    +            devmin: 0,
    +            atime: this.atime,
    +            ctime: this.ctime,
    +        }).encode(buf);
    +        buf.write(body, 512, bodyLen, 'utf8');
    +        // null pad after the body
    +        for (let i = bodyLen + 512; i < buf.length; i++) {
    +            buf[i] = 0;
    +        }
    +        return buf;
    +    }
    +    encodeBody() {
    +        return (this.encodeField('path') +
    +            this.encodeField('ctime') +
    +            this.encodeField('atime') +
    +            this.encodeField('dev') +
    +            this.encodeField('ino') +
    +            this.encodeField('nlink') +
    +            this.encodeField('charset') +
    +            this.encodeField('comment') +
    +            this.encodeField('gid') +
    +            this.encodeField('gname') +
    +            this.encodeField('linkpath') +
    +            this.encodeField('mtime') +
    +            this.encodeField('size') +
    +            this.encodeField('uid') +
    +            this.encodeField('uname'));
    +    }
    +    encodeField(field) {
    +        if (this[field] === undefined) {
    +            return '';
    +        }
    +        const r = this[field];
    +        const v = r instanceof Date ? r.getTime() / 1000 : r;
    +        const s = ' ' +
    +            (field === 'dev' || field === 'ino' || field === 'nlink' ?
    +                'SCHILY.'
    +                : '') +
    +            field +
    +            '=' +
    +            v +
    +            '\n';
    +        const byteLen = Buffer.byteLength(s);
    +        // the digits includes the length of the digits in ascii base-10
    +        // so if it's 9 characters, then adding 1 for the 9 makes it 10
    +        // which makes it 11 chars.
    +        let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1;
    +        if (byteLen + digits >= Math.pow(10, digits)) {
    +            digits += 1;
    +        }
    +        const len = digits + byteLen;
    +        return len + s;
    +    }
    +    static parse(str, ex, g = false) {
    +        return new Pax(merge(parseKV(str), ex), g);
    +    }
    +}
    +exports.Pax = Pax;
    +const merge = (a, b) => b ? Object.assign({}, b, a) : a;
    +const parseKV = (str) => str
    +    .replace(/\n$/, '')
    +    .split('\n')
    +    .reduce(parseKVLine, Object.create(null));
    +const parseKVLine = (set, line) => {
    +    const n = parseInt(line, 10);
    +    // XXX Values with \n in them will fail this.
    +    // Refactor to not be a naive line-by-line parse.
    +    if (n !== Buffer.byteLength(line) + 1) {
    +        return set;
    +    }
    +    line = line.slice((n + ' ').length);
    +    const kv = line.split('=');
    +    const r = kv.shift();
    +    if (!r) {
    +        return set;
    +    }
    +    const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1');
    +    const v = kv.join('=');
    +    set[k] =
    +        /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ?
    +            new Date(Number(v) * 1000)
    +            : /^[0-9]+$/.test(v) ? +v
    +                : v;
    +    return set;
    +};
    +//# sourceMappingURL=pax.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/read-entry.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/read-entry.js
    new file mode 100644
    index 00000000..15e2d55c
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/read-entry.js
    @@ -0,0 +1,140 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.ReadEntry = void 0;
    +const minipass_1 = require("minipass");
    +const normalize_windows_path_js_1 = require("./normalize-windows-path.js");
    +class ReadEntry extends minipass_1.Minipass {
    +    extended;
    +    globalExtended;
    +    header;
    +    startBlockSize;
    +    blockRemain;
    +    remain;
    +    type;
    +    meta = false;
    +    ignore = false;
    +    path;
    +    mode;
    +    uid;
    +    gid;
    +    uname;
    +    gname;
    +    size = 0;
    +    mtime;
    +    atime;
    +    ctime;
    +    linkpath;
    +    dev;
    +    ino;
    +    nlink;
    +    invalid = false;
    +    absolute;
    +    unsupported = false;
    +    constructor(header, ex, gex) {
    +        super({});
    +        // read entries always start life paused.  this is to avoid the
    +        // situation where Minipass's auto-ending empty streams results
    +        // in an entry ending before we're ready for it.
    +        this.pause();
    +        this.extended = ex;
    +        this.globalExtended = gex;
    +        this.header = header;
    +        /* c8 ignore start */
    +        this.remain = header.size ?? 0;
    +        /* c8 ignore stop */
    +        this.startBlockSize = 512 * Math.ceil(this.remain / 512);
    +        this.blockRemain = this.startBlockSize;
    +        this.type = header.type;
    +        switch (this.type) {
    +            case 'File':
    +            case 'OldFile':
    +            case 'Link':
    +            case 'SymbolicLink':
    +            case 'CharacterDevice':
    +            case 'BlockDevice':
    +            case 'Directory':
    +            case 'FIFO':
    +            case 'ContiguousFile':
    +            case 'GNUDumpDir':
    +                break;
    +            case 'NextFileHasLongLinkpath':
    +            case 'NextFileHasLongPath':
    +            case 'OldGnuLongPath':
    +            case 'GlobalExtendedHeader':
    +            case 'ExtendedHeader':
    +            case 'OldExtendedHeader':
    +                this.meta = true;
    +                break;
    +            // NOTE: gnutar and bsdtar treat unrecognized types as 'File'
    +            // it may be worth doing the same, but with a warning.
    +            default:
    +                this.ignore = true;
    +        }
    +        /* c8 ignore start */
    +        if (!header.path) {
    +            throw new Error('no path provided for tar.ReadEntry');
    +        }
    +        /* c8 ignore stop */
    +        this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(header.path);
    +        this.mode = header.mode;
    +        if (this.mode) {
    +            this.mode = this.mode & 0o7777;
    +        }
    +        this.uid = header.uid;
    +        this.gid = header.gid;
    +        this.uname = header.uname;
    +        this.gname = header.gname;
    +        this.size = this.remain;
    +        this.mtime = header.mtime;
    +        this.atime = header.atime;
    +        this.ctime = header.ctime;
    +        /* c8 ignore start */
    +        this.linkpath =
    +            header.linkpath ?
    +                (0, normalize_windows_path_js_1.normalizeWindowsPath)(header.linkpath)
    +                : undefined;
    +        /* c8 ignore stop */
    +        this.uname = header.uname;
    +        this.gname = header.gname;
    +        if (ex) {
    +            this.#slurp(ex);
    +        }
    +        if (gex) {
    +            this.#slurp(gex, true);
    +        }
    +    }
    +    write(data) {
    +        const writeLen = data.length;
    +        if (writeLen > this.blockRemain) {
    +            throw new Error('writing more to entry than is appropriate');
    +        }
    +        const r = this.remain;
    +        const br = this.blockRemain;
    +        this.remain = Math.max(0, r - writeLen);
    +        this.blockRemain = Math.max(0, br - writeLen);
    +        if (this.ignore) {
    +            return true;
    +        }
    +        if (r >= writeLen) {
    +            return super.write(data);
    +        }
    +        // r < writeLen
    +        return super.write(data.subarray(0, r));
    +    }
    +    #slurp(ex, gex = false) {
    +        if (ex.path)
    +            ex.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(ex.path);
    +        if (ex.linkpath)
    +            ex.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(ex.linkpath);
    +        Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
    +            // we slurp in everything except for the path attribute in
    +            // a global extended header, because that's weird. Also, any
    +            // null/undefined values are ignored.
    +            return !(v === null ||
    +                v === undefined ||
    +                (k === 'path' && gex));
    +        })));
    +    }
    +}
    +exports.ReadEntry = ReadEntry;
    +//# sourceMappingURL=read-entry.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/replace.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/replace.js
    new file mode 100644
    index 00000000..262deecd
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/replace.js
    @@ -0,0 +1,231 @@
    +"use strict";
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.replace = void 0;
    +// tar -r
    +const fs_minipass_1 = require("@isaacs/fs-minipass");
    +const node_fs_1 = __importDefault(require("node:fs"));
    +const node_path_1 = __importDefault(require("node:path"));
    +const header_js_1 = require("./header.js");
    +const list_js_1 = require("./list.js");
    +const make_command_js_1 = require("./make-command.js");
    +const options_js_1 = require("./options.js");
    +const pack_js_1 = require("./pack.js");
    +// starting at the head of the file, read a Header
    +// If the checksum is invalid, that's our position to start writing
    +// If it is, jump forward by the specified size (round up to 512)
    +// and try again.
    +// Write the new Pack stream starting there.
    +const replaceSync = (opt, files) => {
    +    const p = new pack_js_1.PackSync(opt);
    +    let threw = true;
    +    let fd;
    +    let position;
    +    try {
    +        try {
    +            fd = node_fs_1.default.openSync(opt.file, 'r+');
    +        }
    +        catch (er) {
    +            if (er?.code === 'ENOENT') {
    +                fd = node_fs_1.default.openSync(opt.file, 'w+');
    +            }
    +            else {
    +                throw er;
    +            }
    +        }
    +        const st = node_fs_1.default.fstatSync(fd);
    +        const headBuf = Buffer.alloc(512);
    +        POSITION: for (position = 0; position < st.size; position += 512) {
    +            for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {
    +                bytes = node_fs_1.default.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos);
    +                if (position === 0 &&
    +                    headBuf[0] === 0x1f &&
    +                    headBuf[1] === 0x8b) {
    +                    throw new Error('cannot append to compressed archives');
    +                }
    +                if (!bytes) {
    +                    break POSITION;
    +                }
    +            }
    +            const h = new header_js_1.Header(headBuf);
    +            if (!h.cksumValid) {
    +                break;
    +            }
    +            const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512);
    +            if (position + entryBlockSize + 512 > st.size) {
    +                break;
    +            }
    +            // the 512 for the header we just parsed will be added as well
    +            // also jump ahead all the blocks for the body
    +            position += entryBlockSize;
    +            if (opt.mtimeCache && h.mtime) {
    +                opt.mtimeCache.set(String(h.path), h.mtime);
    +            }
    +        }
    +        threw = false;
    +        streamSync(opt, p, position, fd, files);
    +    }
    +    finally {
    +        if (threw) {
    +            try {
    +                node_fs_1.default.closeSync(fd);
    +            }
    +            catch (er) { }
    +        }
    +    }
    +};
    +const streamSync = (opt, p, position, fd, files) => {
    +    const stream = new fs_minipass_1.WriteStreamSync(opt.file, {
    +        fd: fd,
    +        start: position,
    +    });
    +    p.pipe(stream);
    +    addFilesSync(p, files);
    +};
    +const replaceAsync = (opt, files) => {
    +    files = Array.from(files);
    +    const p = new pack_js_1.Pack(opt);
    +    const getPos = (fd, size, cb_) => {
    +        const cb = (er, pos) => {
    +            if (er) {
    +                node_fs_1.default.close(fd, _ => cb_(er));
    +            }
    +            else {
    +                cb_(null, pos);
    +            }
    +        };
    +        let position = 0;
    +        if (size === 0) {
    +            return cb(null, 0);
    +        }
    +        let bufPos = 0;
    +        const headBuf = Buffer.alloc(512);
    +        const onread = (er, bytes) => {
    +            if (er || typeof bytes === 'undefined') {
    +                return cb(er);
    +            }
    +            bufPos += bytes;
    +            if (bufPos < 512 && bytes) {
    +                return node_fs_1.default.read(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos, onread);
    +            }
    +            if (position === 0 &&
    +                headBuf[0] === 0x1f &&
    +                headBuf[1] === 0x8b) {
    +                return cb(new Error('cannot append to compressed archives'));
    +            }
    +            // truncated header
    +            if (bufPos < 512) {
    +                return cb(null, position);
    +            }
    +            const h = new header_js_1.Header(headBuf);
    +            if (!h.cksumValid) {
    +                return cb(null, position);
    +            }
    +            /* c8 ignore next */
    +            const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512);
    +            if (position + entryBlockSize + 512 > size) {
    +                return cb(null, position);
    +            }
    +            position += entryBlockSize + 512;
    +            if (position >= size) {
    +                return cb(null, position);
    +            }
    +            if (opt.mtimeCache && h.mtime) {
    +                opt.mtimeCache.set(String(h.path), h.mtime);
    +            }
    +            bufPos = 0;
    +            node_fs_1.default.read(fd, headBuf, 0, 512, position, onread);
    +        };
    +        node_fs_1.default.read(fd, headBuf, 0, 512, position, onread);
    +    };
    +    const promise = new Promise((resolve, reject) => {
    +        p.on('error', reject);
    +        let flag = 'r+';
    +        const onopen = (er, fd) => {
    +            if (er && er.code === 'ENOENT' && flag === 'r+') {
    +                flag = 'w+';
    +                return node_fs_1.default.open(opt.file, flag, onopen);
    +            }
    +            if (er || !fd) {
    +                return reject(er);
    +            }
    +            node_fs_1.default.fstat(fd, (er, st) => {
    +                if (er) {
    +                    return node_fs_1.default.close(fd, () => reject(er));
    +                }
    +                getPos(fd, st.size, (er, position) => {
    +                    if (er) {
    +                        return reject(er);
    +                    }
    +                    const stream = new fs_minipass_1.WriteStream(opt.file, {
    +                        fd: fd,
    +                        start: position,
    +                    });
    +                    p.pipe(stream);
    +                    stream.on('error', reject);
    +                    stream.on('close', resolve);
    +                    addFilesAsync(p, files);
    +                });
    +            });
    +        };
    +        node_fs_1.default.open(opt.file, flag, onopen);
    +    });
    +    return promise;
    +};
    +const addFilesSync = (p, files) => {
    +    files.forEach(file => {
    +        if (file.charAt(0) === '@') {
    +            (0, list_js_1.list)({
    +                file: node_path_1.default.resolve(p.cwd, file.slice(1)),
    +                sync: true,
    +                noResume: true,
    +                onReadEntry: entry => p.add(entry),
    +            });
    +        }
    +        else {
    +            p.add(file);
    +        }
    +    });
    +    p.end();
    +};
    +const addFilesAsync = async (p, files) => {
    +    for (let i = 0; i < files.length; i++) {
    +        const file = String(files[i]);
    +        if (file.charAt(0) === '@') {
    +            await (0, list_js_1.list)({
    +                file: node_path_1.default.resolve(String(p.cwd), file.slice(1)),
    +                noResume: true,
    +                onReadEntry: entry => p.add(entry),
    +            });
    +        }
    +        else {
    +            p.add(file);
    +        }
    +    }
    +    p.end();
    +};
    +exports.replace = (0, make_command_js_1.makeCommand)(replaceSync, replaceAsync, 
    +/* c8 ignore start */
    +() => {
    +    throw new TypeError('file is required');
    +}, () => {
    +    throw new TypeError('file is required');
    +}, 
    +/* c8 ignore stop */
    +(opt, entries) => {
    +    if (!(0, options_js_1.isFile)(opt)) {
    +        throw new TypeError('file is required');
    +    }
    +    if (opt.gzip ||
    +        opt.brotli ||
    +        opt.file.endsWith('.br') ||
    +        opt.file.endsWith('.tbr')) {
    +        throw new TypeError('cannot append to compressed archives');
    +    }
    +    if (!entries?.length) {
    +        throw new TypeError('no paths specified to add/replace');
    +    }
    +});
    +//# sourceMappingURL=replace.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-absolute-path.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-absolute-path.js
    new file mode 100644
    index 00000000..bb7639c3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-absolute-path.js
    @@ -0,0 +1,29 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.stripAbsolutePath = void 0;
    +// unix absolute paths are also absolute on win32, so we use this for both
    +const node_path_1 = require("node:path");
    +const { isAbsolute, parse } = node_path_1.win32;
    +// returns [root, stripped]
    +// Note that windows will think that //x/y/z/a has a "root" of //x/y, and in
    +// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip /
    +// explicitly if it's the first character.
    +// drive-specific relative paths on Windows get their root stripped off even
    +// though they are not absolute, so `c:../foo` becomes ['c:', '../foo']
    +const stripAbsolutePath = (path) => {
    +    let r = '';
    +    let parsed = parse(path);
    +    while (isAbsolute(path) || parsed.root) {
    +        // windows will think that //x/y/z has a "root" of //x/y/
    +        // but strip the //?/C:/ off of //?/C:/path
    +        const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ?
    +            '/'
    +            : parsed.root;
    +        path = path.slice(root.length);
    +        r += root;
    +        parsed = parse(path);
    +    }
    +    return [r, path];
    +};
    +exports.stripAbsolutePath = stripAbsolutePath;
    +//# sourceMappingURL=strip-absolute-path.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-trailing-slashes.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-trailing-slashes.js
    new file mode 100644
    index 00000000..6fa74ad6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-trailing-slashes.js
    @@ -0,0 +1,18 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.stripTrailingSlashes = void 0;
    +// warning: extremely hot code path.
    +// This has been meticulously optimized for use
    +// within npm install on large package trees.
    +// Do not edit without careful benchmarking.
    +const stripTrailingSlashes = (str) => {
    +    let i = str.length - 1;
    +    let slashesStart = -1;
    +    while (i > -1 && str.charAt(i) === '/') {
    +        slashesStart = i;
    +        i--;
    +    }
    +    return slashesStart === -1 ? str : str.slice(0, slashesStart);
    +};
    +exports.stripTrailingSlashes = stripTrailingSlashes;
    +//# sourceMappingURL=strip-trailing-slashes.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/symlink-error.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/symlink-error.js
    new file mode 100644
    index 00000000..cc19ac1a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/symlink-error.js
    @@ -0,0 +1,19 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.SymlinkError = void 0;
    +class SymlinkError extends Error {
    +    path;
    +    symlink;
    +    syscall = 'symlink';
    +    code = 'TAR_SYMLINK_ERROR';
    +    constructor(symlink, path) {
    +        super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link');
    +        this.symlink = symlink;
    +        this.path = path;
    +    }
    +    get name() {
    +        return 'SymlinkError';
    +    }
    +}
    +exports.SymlinkError = SymlinkError;
    +//# sourceMappingURL=symlink-error.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/types.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/types.js
    new file mode 100644
    index 00000000..cb9b684e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/types.js
    @@ -0,0 +1,50 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.code = exports.name = exports.isName = exports.isCode = void 0;
    +const isCode = (c) => exports.name.has(c);
    +exports.isCode = isCode;
    +const isName = (c) => exports.code.has(c);
    +exports.isName = isName;
    +// map types from key to human-friendly name
    +exports.name = new Map([
    +    ['0', 'File'],
    +    // same as File
    +    ['', 'OldFile'],
    +    ['1', 'Link'],
    +    ['2', 'SymbolicLink'],
    +    // Devices and FIFOs aren't fully supported
    +    // they are parsed, but skipped when unpacking
    +    ['3', 'CharacterDevice'],
    +    ['4', 'BlockDevice'],
    +    ['5', 'Directory'],
    +    ['6', 'FIFO'],
    +    // same as File
    +    ['7', 'ContiguousFile'],
    +    // pax headers
    +    ['g', 'GlobalExtendedHeader'],
    +    ['x', 'ExtendedHeader'],
    +    // vendor-specific stuff
    +    // skip
    +    ['A', 'SolarisACL'],
    +    // like 5, but with data, which should be skipped
    +    ['D', 'GNUDumpDir'],
    +    // metadata only, skip
    +    ['I', 'Inode'],
    +    // data = link path of next file
    +    ['K', 'NextFileHasLongLinkpath'],
    +    // data = path of next file
    +    ['L', 'NextFileHasLongPath'],
    +    // skip
    +    ['M', 'ContinuationFile'],
    +    // like L
    +    ['N', 'OldGnuLongPath'],
    +    // skip
    +    ['S', 'SparseFile'],
    +    // skip
    +    ['V', 'TapeVolumeHeader'],
    +    // like x
    +    ['X', 'OldExtendedHeader'],
    +]);
    +// map the other direction
    +exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]]));
    +//# sourceMappingURL=types.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/unpack.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/unpack.js
    new file mode 100644
    index 00000000..edf8acbb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/unpack.js
    @@ -0,0 +1,919 @@
    +"use strict";
    +// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet.
    +// but the path reservations are required to avoid race conditions where
    +// parallelized unpack ops may mess with one another, due to dependencies
    +// (like a Link depending on its target) or destructive operations (like
    +// clobbering an fs object to create one of a different type.)
    +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    var desc = Object.getOwnPropertyDescriptor(m, k);
    +    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
    +      desc = { enumerable: true, get: function() { return m[k]; } };
    +    }
    +    Object.defineProperty(o, k2, desc);
    +}) : (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    o[k2] = m[k];
    +}));
    +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    +    Object.defineProperty(o, "default", { enumerable: true, value: v });
    +}) : function(o, v) {
    +    o["default"] = v;
    +});
    +var __importStar = (this && this.__importStar) || function (mod) {
    +    if (mod && mod.__esModule) return mod;
    +    var result = {};
    +    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    +    __setModuleDefault(result, mod);
    +    return result;
    +};
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.UnpackSync = exports.Unpack = void 0;
    +const fsm = __importStar(require("@isaacs/fs-minipass"));
    +const node_assert_1 = __importDefault(require("node:assert"));
    +const node_crypto_1 = require("node:crypto");
    +const node_fs_1 = __importDefault(require("node:fs"));
    +const node_path_1 = __importDefault(require("node:path"));
    +const get_write_flag_js_1 = require("./get-write-flag.js");
    +const mkdir_js_1 = require("./mkdir.js");
    +const normalize_unicode_js_1 = require("./normalize-unicode.js");
    +const normalize_windows_path_js_1 = require("./normalize-windows-path.js");
    +const parse_js_1 = require("./parse.js");
    +const strip_absolute_path_js_1 = require("./strip-absolute-path.js");
    +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js");
    +const wc = __importStar(require("./winchars.js"));
    +const path_reservations_js_1 = require("./path-reservations.js");
    +const ONENTRY = Symbol('onEntry');
    +const CHECKFS = Symbol('checkFs');
    +const CHECKFS2 = Symbol('checkFs2');
    +const PRUNECACHE = Symbol('pruneCache');
    +const ISREUSABLE = Symbol('isReusable');
    +const MAKEFS = Symbol('makeFs');
    +const FILE = Symbol('file');
    +const DIRECTORY = Symbol('directory');
    +const LINK = Symbol('link');
    +const SYMLINK = Symbol('symlink');
    +const HARDLINK = Symbol('hardlink');
    +const UNSUPPORTED = Symbol('unsupported');
    +const CHECKPATH = Symbol('checkPath');
    +const MKDIR = Symbol('mkdir');
    +const ONERROR = Symbol('onError');
    +const PENDING = Symbol('pending');
    +const PEND = Symbol('pend');
    +const UNPEND = Symbol('unpend');
    +const ENDED = Symbol('ended');
    +const MAYBECLOSE = Symbol('maybeClose');
    +const SKIP = Symbol('skip');
    +const DOCHOWN = Symbol('doChown');
    +const UID = Symbol('uid');
    +const GID = Symbol('gid');
    +const CHECKED_CWD = Symbol('checkedCwd');
    +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
    +const isWindows = platform === 'win32';
    +const DEFAULT_MAX_DEPTH = 1024;
    +// Unlinks on Windows are not atomic.
    +//
    +// This means that if you have a file entry, followed by another
    +// file entry with an identical name, and you cannot re-use the file
    +// (because it's a hardlink, or because unlink:true is set, or it's
    +// Windows, which does not have useful nlink values), then the unlink
    +// will be committed to the disk AFTER the new file has been written
    +// over the old one, deleting the new file.
    +//
    +// To work around this, on Windows systems, we rename the file and then
    +// delete the renamed file.  It's a sloppy kludge, but frankly, I do not
    +// know of a better way to do this, given windows' non-atomic unlink
    +// semantics.
    +//
    +// See: https://github.com/npm/node-tar/issues/183
    +/* c8 ignore start */
    +const unlinkFile = (path, cb) => {
    +    if (!isWindows) {
    +        return node_fs_1.default.unlink(path, cb);
    +    }
    +    const name = path + '.DELETE.' + (0, node_crypto_1.randomBytes)(16).toString('hex');
    +    node_fs_1.default.rename(path, name, er => {
    +        if (er) {
    +            return cb(er);
    +        }
    +        node_fs_1.default.unlink(name, cb);
    +    });
    +};
    +/* c8 ignore stop */
    +/* c8 ignore start */
    +const unlinkFileSync = (path) => {
    +    if (!isWindows) {
    +        return node_fs_1.default.unlinkSync(path);
    +    }
    +    const name = path + '.DELETE.' + (0, node_crypto_1.randomBytes)(16).toString('hex');
    +    node_fs_1.default.renameSync(path, name);
    +    node_fs_1.default.unlinkSync(name);
    +};
    +/* c8 ignore stop */
    +// this.gid, entry.gid, this.processUid
    +const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a
    +    : b !== undefined && b === b >>> 0 ? b
    +        : c;
    +// clear the cache if it's a case-insensitive unicode-squashing match.
    +// we can't know if the current file system is case-sensitive or supports
    +// unicode fully, so we check for similarity on the maximally compatible
    +// representation.  Err on the side of pruning, since all it's doing is
    +// preventing lstats, and it's not the end of the world if we get a false
    +// positive.
    +// Note that on windows, we always drop the entire cache whenever a
    +// symbolic link is encountered, because 8.3 filenames are impossible
    +// to reason about, and collisions are hazards rather than just failures.
    +const cacheKeyNormalize = (path) => (0, strip_trailing_slashes_js_1.stripTrailingSlashes)((0, normalize_windows_path_js_1.normalizeWindowsPath)((0, normalize_unicode_js_1.normalizeUnicode)(path))).toLowerCase();
    +// remove all cache entries matching ${abs}/**
    +const pruneCache = (cache, abs) => {
    +    abs = cacheKeyNormalize(abs);
    +    for (const path of cache.keys()) {
    +        const pnorm = cacheKeyNormalize(path);
    +        if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) {
    +            cache.delete(path);
    +        }
    +    }
    +};
    +const dropCache = (cache) => {
    +    for (const key of cache.keys()) {
    +        cache.delete(key);
    +    }
    +};
    +class Unpack extends parse_js_1.Parser {
    +    [ENDED] = false;
    +    [CHECKED_CWD] = false;
    +    [PENDING] = 0;
    +    reservations = new path_reservations_js_1.PathReservations();
    +    transform;
    +    writable = true;
    +    readable = false;
    +    dirCache;
    +    uid;
    +    gid;
    +    setOwner;
    +    preserveOwner;
    +    processGid;
    +    processUid;
    +    maxDepth;
    +    forceChown;
    +    win32;
    +    newer;
    +    keep;
    +    noMtime;
    +    preservePaths;
    +    unlink;
    +    cwd;
    +    strip;
    +    processUmask;
    +    umask;
    +    dmode;
    +    fmode;
    +    chmod;
    +    constructor(opt = {}) {
    +        opt.ondone = () => {
    +            this[ENDED] = true;
    +            this[MAYBECLOSE]();
    +        };
    +        super(opt);
    +        this.transform = opt.transform;
    +        this.dirCache = opt.dirCache || new Map();
    +        this.chmod = !!opt.chmod;
    +        if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {
    +            // need both or neither
    +            if (typeof opt.uid !== 'number' ||
    +                typeof opt.gid !== 'number') {
    +                throw new TypeError('cannot set owner without number uid and gid');
    +            }
    +            if (opt.preserveOwner) {
    +                throw new TypeError('cannot preserve owner in archive and also set owner explicitly');
    +            }
    +            this.uid = opt.uid;
    +            this.gid = opt.gid;
    +            this.setOwner = true;
    +        }
    +        else {
    +            this.uid = undefined;
    +            this.gid = undefined;
    +            this.setOwner = false;
    +        }
    +        // default true for root
    +        if (opt.preserveOwner === undefined &&
    +            typeof opt.uid !== 'number') {
    +            this.preserveOwner = !!(process.getuid && process.getuid() === 0);
    +        }
    +        else {
    +            this.preserveOwner = !!opt.preserveOwner;
    +        }
    +        this.processUid =
    +            (this.preserveOwner || this.setOwner) && process.getuid ?
    +                process.getuid()
    +                : undefined;
    +        this.processGid =
    +            (this.preserveOwner || this.setOwner) && process.getgid ?
    +                process.getgid()
    +                : undefined;
    +        // prevent excessively deep nesting of subfolders
    +        // set to `Infinity` to remove this restriction
    +        this.maxDepth =
    +            typeof opt.maxDepth === 'number' ?
    +                opt.maxDepth
    +                : DEFAULT_MAX_DEPTH;
    +        // mostly just for testing, but useful in some cases.
    +        // Forcibly trigger a chown on every entry, no matter what
    +        this.forceChown = opt.forceChown === true;
    +        // turn > this[ONENTRY](entry));
    +    }
    +    // a bad or damaged archive is a warning for Parser, but an error
    +    // when extracting.  Mark those errors as unrecoverable, because
    +    // the Unpack contract cannot be met.
    +    warn(code, msg, data = {}) {
    +        if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') {
    +            data.recoverable = false;
    +        }
    +        return super.warn(code, msg, data);
    +    }
    +    [MAYBECLOSE]() {
    +        if (this[ENDED] && this[PENDING] === 0) {
    +            this.emit('prefinish');
    +            this.emit('finish');
    +            this.emit('end');
    +        }
    +    }
    +    [CHECKPATH](entry) {
    +        const p = (0, normalize_windows_path_js_1.normalizeWindowsPath)(entry.path);
    +        const parts = p.split('/');
    +        if (this.strip) {
    +            if (parts.length < this.strip) {
    +                return false;
    +            }
    +            if (entry.type === 'Link') {
    +                const linkparts = (0, normalize_windows_path_js_1.normalizeWindowsPath)(String(entry.linkpath)).split('/');
    +                if (linkparts.length >= this.strip) {
    +                    entry.linkpath = linkparts.slice(this.strip).join('/');
    +                }
    +                else {
    +                    return false;
    +                }
    +            }
    +            parts.splice(0, this.strip);
    +            entry.path = parts.join('/');
    +        }
    +        if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {
    +            this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {
    +                entry,
    +                path: p,
    +                depth: parts.length,
    +                maxDepth: this.maxDepth,
    +            });
    +            return false;
    +        }
    +        if (!this.preservePaths) {
    +            if (parts.includes('..') ||
    +                /* c8 ignore next */
    +                (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) {
    +                this.warn('TAR_ENTRY_ERROR', `path contains '..'`, {
    +                    entry,
    +                    path: p,
    +                });
    +                return false;
    +            }
    +            // strip off the root
    +            const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(p);
    +            if (root) {
    +                entry.path = String(stripped);
    +                this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, {
    +                    entry,
    +                    path: p,
    +                });
    +            }
    +        }
    +        if (node_path_1.default.isAbsolute(entry.path)) {
    +            entry.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(entry.path));
    +        }
    +        else {
    +            entry.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(this.cwd, entry.path));
    +        }
    +        // if we somehow ended up with a path that escapes the cwd, and we are
    +        // not in preservePaths mode, then something is fishy!  This should have
    +        // been prevented above, so ignore this for coverage.
    +        /* c8 ignore start - defense in depth */
    +        if (!this.preservePaths &&
    +            typeof entry.absolute === 'string' &&
    +            entry.absolute.indexOf(this.cwd + '/') !== 0 &&
    +            entry.absolute !== this.cwd) {
    +            this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {
    +                entry,
    +                path: (0, normalize_windows_path_js_1.normalizeWindowsPath)(entry.path),
    +                resolvedPath: entry.absolute,
    +                cwd: this.cwd,
    +            });
    +            return false;
    +        }
    +        /* c8 ignore stop */
    +        // an archive can set properties on the extraction directory, but it
    +        // may not replace the cwd with a different kind of thing entirely.
    +        if (entry.absolute === this.cwd &&
    +            entry.type !== 'Directory' &&
    +            entry.type !== 'GNUDumpDir') {
    +            return false;
    +        }
    +        // only encode : chars that aren't drive letter indicators
    +        if (this.win32) {
    +            const { root: aRoot } = node_path_1.default.win32.parse(String(entry.absolute));
    +            entry.absolute =
    +                aRoot + wc.encode(String(entry.absolute).slice(aRoot.length));
    +            const { root: pRoot } = node_path_1.default.win32.parse(entry.path);
    +            entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length));
    +        }
    +        return true;
    +    }
    +    [ONENTRY](entry) {
    +        if (!this[CHECKPATH](entry)) {
    +            return entry.resume();
    +        }
    +        node_assert_1.default.equal(typeof entry.absolute, 'string');
    +        switch (entry.type) {
    +            case 'Directory':
    +            case 'GNUDumpDir':
    +                if (entry.mode) {
    +                    entry.mode = entry.mode | 0o700;
    +                }
    +            // eslint-disable-next-line no-fallthrough
    +            case 'File':
    +            case 'OldFile':
    +            case 'ContiguousFile':
    +            case 'Link':
    +            case 'SymbolicLink':
    +                return this[CHECKFS](entry);
    +            case 'CharacterDevice':
    +            case 'BlockDevice':
    +            case 'FIFO':
    +            default:
    +                return this[UNSUPPORTED](entry);
    +        }
    +    }
    +    [ONERROR](er, entry) {
    +        // Cwd has to exist, or else nothing works. That's serious.
    +        // Other errors are warnings, which raise the error in strict
    +        // mode, but otherwise continue on.
    +        if (er.name === 'CwdError') {
    +            this.emit('error', er);
    +        }
    +        else {
    +            this.warn('TAR_ENTRY_ERROR', er, { entry });
    +            this[UNPEND]();
    +            entry.resume();
    +        }
    +    }
    +    [MKDIR](dir, mode, cb) {
    +        (0, mkdir_js_1.mkdir)((0, normalize_windows_path_js_1.normalizeWindowsPath)(dir), {
    +            uid: this.uid,
    +            gid: this.gid,
    +            processUid: this.processUid,
    +            processGid: this.processGid,
    +            umask: this.processUmask,
    +            preserve: this.preservePaths,
    +            unlink: this.unlink,
    +            cache: this.dirCache,
    +            cwd: this.cwd,
    +            mode: mode,
    +        }, cb);
    +    }
    +    [DOCHOWN](entry) {
    +        // in preserve owner mode, chown if the entry doesn't match process
    +        // in set owner mode, chown if setting doesn't match process
    +        return (this.forceChown ||
    +            (this.preserveOwner &&
    +                ((typeof entry.uid === 'number' &&
    +                    entry.uid !== this.processUid) ||
    +                    (typeof entry.gid === 'number' &&
    +                        entry.gid !== this.processGid))) ||
    +            (typeof this.uid === 'number' &&
    +                this.uid !== this.processUid) ||
    +            (typeof this.gid === 'number' && this.gid !== this.processGid));
    +    }
    +    [UID](entry) {
    +        return uint32(this.uid, entry.uid, this.processUid);
    +    }
    +    [GID](entry) {
    +        return uint32(this.gid, entry.gid, this.processGid);
    +    }
    +    [FILE](entry, fullyDone) {
    +        const mode = typeof entry.mode === 'number' ?
    +            entry.mode & 0o7777
    +            : this.fmode;
    +        const stream = new fsm.WriteStream(String(entry.absolute), {
    +            // slight lie, but it can be numeric flags
    +            flags: (0, get_write_flag_js_1.getWriteFlag)(entry.size),
    +            mode: mode,
    +            autoClose: false,
    +        });
    +        stream.on('error', (er) => {
    +            if (stream.fd) {
    +                node_fs_1.default.close(stream.fd, () => { });
    +            }
    +            // flush all the data out so that we aren't left hanging
    +            // if the error wasn't actually fatal.  otherwise the parse
    +            // is blocked, and we never proceed.
    +            stream.write = () => true;
    +            this[ONERROR](er, entry);
    +            fullyDone();
    +        });
    +        let actions = 1;
    +        const done = (er) => {
    +            if (er) {
    +                /* c8 ignore start - we should always have a fd by now */
    +                if (stream.fd) {
    +                    node_fs_1.default.close(stream.fd, () => { });
    +                }
    +                /* c8 ignore stop */
    +                this[ONERROR](er, entry);
    +                fullyDone();
    +                return;
    +            }
    +            if (--actions === 0) {
    +                if (stream.fd !== undefined) {
    +                    node_fs_1.default.close(stream.fd, er => {
    +                        if (er) {
    +                            this[ONERROR](er, entry);
    +                        }
    +                        else {
    +                            this[UNPEND]();
    +                        }
    +                        fullyDone();
    +                    });
    +                }
    +            }
    +        };
    +        stream.on('finish', () => {
    +            // if futimes fails, try utimes
    +            // if utimes fails, fail with the original error
    +            // same for fchown/chown
    +            const abs = String(entry.absolute);
    +            const fd = stream.fd;
    +            if (typeof fd === 'number' && entry.mtime && !this.noMtime) {
    +                actions++;
    +                const atime = entry.atime || new Date();
    +                const mtime = entry.mtime;
    +                node_fs_1.default.futimes(fd, atime, mtime, er => er ?
    +                    node_fs_1.default.utimes(abs, atime, mtime, er2 => done(er2 && er))
    +                    : done());
    +            }
    +            if (typeof fd === 'number' && this[DOCHOWN](entry)) {
    +                actions++;
    +                const uid = this[UID](entry);
    +                const gid = this[GID](entry);
    +                if (typeof uid === 'number' && typeof gid === 'number') {
    +                    node_fs_1.default.fchown(fd, uid, gid, er => er ?
    +                        node_fs_1.default.chown(abs, uid, gid, er2 => done(er2 && er))
    +                        : done());
    +                }
    +            }
    +            done();
    +        });
    +        const tx = this.transform ? this.transform(entry) || entry : entry;
    +        if (tx !== entry) {
    +            tx.on('error', (er) => {
    +                this[ONERROR](er, entry);
    +                fullyDone();
    +            });
    +            entry.pipe(tx);
    +        }
    +        tx.pipe(stream);
    +    }
    +    [DIRECTORY](entry, fullyDone) {
    +        const mode = typeof entry.mode === 'number' ?
    +            entry.mode & 0o7777
    +            : this.dmode;
    +        this[MKDIR](String(entry.absolute), mode, er => {
    +            if (er) {
    +                this[ONERROR](er, entry);
    +                fullyDone();
    +                return;
    +            }
    +            let actions = 1;
    +            const done = () => {
    +                if (--actions === 0) {
    +                    fullyDone();
    +                    this[UNPEND]();
    +                    entry.resume();
    +                }
    +            };
    +            if (entry.mtime && !this.noMtime) {
    +                actions++;
    +                node_fs_1.default.utimes(String(entry.absolute), entry.atime || new Date(), entry.mtime, done);
    +            }
    +            if (this[DOCHOWN](entry)) {
    +                actions++;
    +                node_fs_1.default.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done);
    +            }
    +            done();
    +        });
    +    }
    +    [UNSUPPORTED](entry) {
    +        entry.unsupported = true;
    +        this.warn('TAR_ENTRY_UNSUPPORTED', `unsupported entry type: ${entry.type}`, { entry });
    +        entry.resume();
    +    }
    +    [SYMLINK](entry, done) {
    +        this[LINK](entry, String(entry.linkpath), 'symlink', done);
    +    }
    +    [HARDLINK](entry, done) {
    +        const linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(this.cwd, String(entry.linkpath)));
    +        this[LINK](entry, linkpath, 'link', done);
    +    }
    +    [PEND]() {
    +        this[PENDING]++;
    +    }
    +    [UNPEND]() {
    +        this[PENDING]--;
    +        this[MAYBECLOSE]();
    +    }
    +    [SKIP](entry) {
    +        this[UNPEND]();
    +        entry.resume();
    +    }
    +    // Check if we can reuse an existing filesystem entry safely and
    +    // overwrite it, rather than unlinking and recreating
    +    // Windows doesn't report a useful nlink, so we just never reuse entries
    +    [ISREUSABLE](entry, st) {
    +        return (entry.type === 'File' &&
    +            !this.unlink &&
    +            st.isFile() &&
    +            st.nlink <= 1 &&
    +            !isWindows);
    +    }
    +    // check if a thing is there, and if so, try to clobber it
    +    [CHECKFS](entry) {
    +        this[PEND]();
    +        const paths = [entry.path];
    +        if (entry.linkpath) {
    +            paths.push(entry.linkpath);
    +        }
    +        this.reservations.reserve(paths, done => this[CHECKFS2](entry, done));
    +    }
    +    [PRUNECACHE](entry) {
    +        // if we are not creating a directory, and the path is in the dirCache,
    +        // then that means we are about to delete the directory we created
    +        // previously, and it is no longer going to be a directory, and neither
    +        // is any of its children.
    +        // If a symbolic link is encountered, all bets are off.  There is no
    +        // reasonable way to sanitize the cache in such a way we will be able to
    +        // avoid having filesystem collisions.  If this happens with a non-symlink
    +        // entry, it'll just fail to unpack, but a symlink to a directory, using an
    +        // 8.3 shortname or certain unicode attacks, can evade detection and lead
    +        // to arbitrary writes to anywhere on the system.
    +        if (entry.type === 'SymbolicLink') {
    +            dropCache(this.dirCache);
    +        }
    +        else if (entry.type !== 'Directory') {
    +            pruneCache(this.dirCache, String(entry.absolute));
    +        }
    +    }
    +    [CHECKFS2](entry, fullyDone) {
    +        this[PRUNECACHE](entry);
    +        const done = (er) => {
    +            this[PRUNECACHE](entry);
    +            fullyDone(er);
    +        };
    +        const checkCwd = () => {
    +            this[MKDIR](this.cwd, this.dmode, er => {
    +                if (er) {
    +                    this[ONERROR](er, entry);
    +                    done();
    +                    return;
    +                }
    +                this[CHECKED_CWD] = true;
    +                start();
    +            });
    +        };
    +        const start = () => {
    +            if (entry.absolute !== this.cwd) {
    +                const parent = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.dirname(String(entry.absolute)));
    +                if (parent !== this.cwd) {
    +                    return this[MKDIR](parent, this.dmode, er => {
    +                        if (er) {
    +                            this[ONERROR](er, entry);
    +                            done();
    +                            return;
    +                        }
    +                        afterMakeParent();
    +                    });
    +                }
    +            }
    +            afterMakeParent();
    +        };
    +        const afterMakeParent = () => {
    +            node_fs_1.default.lstat(String(entry.absolute), (lstatEr, st) => {
    +                if (st &&
    +                    (this.keep ||
    +                        /* c8 ignore next */
    +                        (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) {
    +                    this[SKIP](entry);
    +                    done();
    +                    return;
    +                }
    +                if (lstatEr || this[ISREUSABLE](entry, st)) {
    +                    return this[MAKEFS](null, entry, done);
    +                }
    +                if (st.isDirectory()) {
    +                    if (entry.type === 'Directory') {
    +                        const needChmod = this.chmod &&
    +                            entry.mode &&
    +                            (st.mode & 0o7777) !== entry.mode;
    +                        const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done);
    +                        if (!needChmod) {
    +                            return afterChmod();
    +                        }
    +                        return node_fs_1.default.chmod(String(entry.absolute), Number(entry.mode), afterChmod);
    +                    }
    +                    // Not a dir entry, have to remove it.
    +                    // NB: the only way to end up with an entry that is the cwd
    +                    // itself, in such a way that == does not detect, is a
    +                    // tricky windows absolute path with UNC or 8.3 parts (and
    +                    // preservePaths:true, or else it will have been stripped).
    +                    // In that case, the user has opted out of path protections
    +                    // explicitly, so if they blow away the cwd, c'est la vie.
    +                    if (entry.absolute !== this.cwd) {
    +                        return node_fs_1.default.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done));
    +                    }
    +                }
    +                // not a dir, and not reusable
    +                // don't remove if the cwd, we want that error
    +                if (entry.absolute === this.cwd) {
    +                    return this[MAKEFS](null, entry, done);
    +                }
    +                unlinkFile(String(entry.absolute), er => this[MAKEFS](er ?? null, entry, done));
    +            });
    +        };
    +        if (this[CHECKED_CWD]) {
    +            start();
    +        }
    +        else {
    +            checkCwd();
    +        }
    +    }
    +    [MAKEFS](er, entry, done) {
    +        if (er) {
    +            this[ONERROR](er, entry);
    +            done();
    +            return;
    +        }
    +        switch (entry.type) {
    +            case 'File':
    +            case 'OldFile':
    +            case 'ContiguousFile':
    +                return this[FILE](entry, done);
    +            case 'Link':
    +                return this[HARDLINK](entry, done);
    +            case 'SymbolicLink':
    +                return this[SYMLINK](entry, done);
    +            case 'Directory':
    +            case 'GNUDumpDir':
    +                return this[DIRECTORY](entry, done);
    +        }
    +    }
    +    [LINK](entry, linkpath, link, done) {
    +        // XXX: get the type ('symlink' or 'junction') for windows
    +        node_fs_1.default[link](linkpath, String(entry.absolute), er => {
    +            if (er) {
    +                this[ONERROR](er, entry);
    +            }
    +            else {
    +                this[UNPEND]();
    +                entry.resume();
    +            }
    +            done();
    +        });
    +    }
    +}
    +exports.Unpack = Unpack;
    +const callSync = (fn) => {
    +    try {
    +        return [null, fn()];
    +    }
    +    catch (er) {
    +        return [er, null];
    +    }
    +};
    +class UnpackSync extends Unpack {
    +    sync = true;
    +    [MAKEFS](er, entry) {
    +        return super[MAKEFS](er, entry, () => { });
    +    }
    +    [CHECKFS](entry) {
    +        this[PRUNECACHE](entry);
    +        if (!this[CHECKED_CWD]) {
    +            const er = this[MKDIR](this.cwd, this.dmode);
    +            if (er) {
    +                return this[ONERROR](er, entry);
    +            }
    +            this[CHECKED_CWD] = true;
    +        }
    +        // don't bother to make the parent if the current entry is the cwd,
    +        // we've already checked it.
    +        if (entry.absolute !== this.cwd) {
    +            const parent = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.dirname(String(entry.absolute)));
    +            if (parent !== this.cwd) {
    +                const mkParent = this[MKDIR](parent, this.dmode);
    +                if (mkParent) {
    +                    return this[ONERROR](mkParent, entry);
    +                }
    +            }
    +        }
    +        const [lstatEr, st] = callSync(() => node_fs_1.default.lstatSync(String(entry.absolute)));
    +        if (st &&
    +            (this.keep ||
    +                /* c8 ignore next */
    +                (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) {
    +            return this[SKIP](entry);
    +        }
    +        if (lstatEr || this[ISREUSABLE](entry, st)) {
    +            return this[MAKEFS](null, entry);
    +        }
    +        if (st.isDirectory()) {
    +            if (entry.type === 'Directory') {
    +                const needChmod = this.chmod &&
    +                    entry.mode &&
    +                    (st.mode & 0o7777) !== entry.mode;
    +                const [er] = needChmod ?
    +                    callSync(() => {
    +                        node_fs_1.default.chmodSync(String(entry.absolute), Number(entry.mode));
    +                    })
    +                    : [];
    +                return this[MAKEFS](er, entry);
    +            }
    +            // not a dir entry, have to remove it
    +            const [er] = callSync(() => node_fs_1.default.rmdirSync(String(entry.absolute)));
    +            this[MAKEFS](er, entry);
    +        }
    +        // not a dir, and not reusable.
    +        // don't remove if it's the cwd, since we want that error.
    +        const [er] = entry.absolute === this.cwd ?
    +            []
    +            : callSync(() => unlinkFileSync(String(entry.absolute)));
    +        this[MAKEFS](er, entry);
    +    }
    +    [FILE](entry, done) {
    +        const mode = typeof entry.mode === 'number' ?
    +            entry.mode & 0o7777
    +            : this.fmode;
    +        const oner = (er) => {
    +            let closeError;
    +            try {
    +                node_fs_1.default.closeSync(fd);
    +            }
    +            catch (e) {
    +                closeError = e;
    +            }
    +            if (er || closeError) {
    +                this[ONERROR](er || closeError, entry);
    +            }
    +            done();
    +        };
    +        let fd;
    +        try {
    +            fd = node_fs_1.default.openSync(String(entry.absolute), (0, get_write_flag_js_1.getWriteFlag)(entry.size), mode);
    +        }
    +        catch (er) {
    +            return oner(er);
    +        }
    +        const tx = this.transform ? this.transform(entry) || entry : entry;
    +        if (tx !== entry) {
    +            tx.on('error', (er) => this[ONERROR](er, entry));
    +            entry.pipe(tx);
    +        }
    +        tx.on('data', (chunk) => {
    +            try {
    +                node_fs_1.default.writeSync(fd, chunk, 0, chunk.length);
    +            }
    +            catch (er) {
    +                oner(er);
    +            }
    +        });
    +        tx.on('end', () => {
    +            let er = null;
    +            // try both, falling futimes back to utimes
    +            // if either fails, handle the first error
    +            if (entry.mtime && !this.noMtime) {
    +                const atime = entry.atime || new Date();
    +                const mtime = entry.mtime;
    +                try {
    +                    node_fs_1.default.futimesSync(fd, atime, mtime);
    +                }
    +                catch (futimeser) {
    +                    try {
    +                        node_fs_1.default.utimesSync(String(entry.absolute), atime, mtime);
    +                    }
    +                    catch (utimeser) {
    +                        er = futimeser;
    +                    }
    +                }
    +            }
    +            if (this[DOCHOWN](entry)) {
    +                const uid = this[UID](entry);
    +                const gid = this[GID](entry);
    +                try {
    +                    node_fs_1.default.fchownSync(fd, Number(uid), Number(gid));
    +                }
    +                catch (fchowner) {
    +                    try {
    +                        node_fs_1.default.chownSync(String(entry.absolute), Number(uid), Number(gid));
    +                    }
    +                    catch (chowner) {
    +                        er = er || fchowner;
    +                    }
    +                }
    +            }
    +            oner(er);
    +        });
    +    }
    +    [DIRECTORY](entry, done) {
    +        const mode = typeof entry.mode === 'number' ?
    +            entry.mode & 0o7777
    +            : this.dmode;
    +        const er = this[MKDIR](String(entry.absolute), mode);
    +        if (er) {
    +            this[ONERROR](er, entry);
    +            done();
    +            return;
    +        }
    +        if (entry.mtime && !this.noMtime) {
    +            try {
    +                node_fs_1.default.utimesSync(String(entry.absolute), entry.atime || new Date(), entry.mtime);
    +                /* c8 ignore next */
    +            }
    +            catch (er) { }
    +        }
    +        if (this[DOCHOWN](entry)) {
    +            try {
    +                node_fs_1.default.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)));
    +            }
    +            catch (er) { }
    +        }
    +        done();
    +        entry.resume();
    +    }
    +    [MKDIR](dir, mode) {
    +        try {
    +            return (0, mkdir_js_1.mkdirSync)((0, normalize_windows_path_js_1.normalizeWindowsPath)(dir), {
    +                uid: this.uid,
    +                gid: this.gid,
    +                processUid: this.processUid,
    +                processGid: this.processGid,
    +                umask: this.processUmask,
    +                preserve: this.preservePaths,
    +                unlink: this.unlink,
    +                cache: this.dirCache,
    +                cwd: this.cwd,
    +                mode: mode,
    +            });
    +        }
    +        catch (er) {
    +            return er;
    +        }
    +    }
    +    [LINK](entry, linkpath, link, done) {
    +        const ls = `${link}Sync`;
    +        try {
    +            node_fs_1.default[ls](linkpath, String(entry.absolute));
    +            done();
    +            entry.resume();
    +        }
    +        catch (er) {
    +            return this[ONERROR](er, entry);
    +        }
    +    }
    +}
    +exports.UnpackSync = UnpackSync;
    +//# sourceMappingURL=unpack.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/update.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/update.js
    new file mode 100644
    index 00000000..7687896f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/update.js
    @@ -0,0 +1,33 @@
    +"use strict";
    +// tar -u
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.update = void 0;
    +const make_command_js_1 = require("./make-command.js");
    +const replace_js_1 = require("./replace.js");
    +// just call tar.r with the filter and mtimeCache
    +exports.update = (0, make_command_js_1.makeCommand)(replace_js_1.replace.syncFile, replace_js_1.replace.asyncFile, replace_js_1.replace.syncNoFile, replace_js_1.replace.asyncNoFile, (opt, entries = []) => {
    +    replace_js_1.replace.validate?.(opt, entries);
    +    mtimeFilter(opt);
    +});
    +const mtimeFilter = (opt) => {
    +    const filter = opt.filter;
    +    if (!opt.mtimeCache) {
    +        opt.mtimeCache = new Map();
    +    }
    +    opt.filter =
    +        filter ?
    +            (path, stat) => filter(path, stat) &&
    +                !(
    +                /* c8 ignore start */
    +                ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >
    +                    (stat.mtime ?? 0))
    +                /* c8 ignore stop */
    +                )
    +            : (path, stat) => !(
    +            /* c8 ignore start */
    +            ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >
    +                (stat.mtime ?? 0))
    +            /* c8 ignore stop */
    +            );
    +};
    +//# sourceMappingURL=update.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/warn-method.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/warn-method.js
    new file mode 100644
    index 00000000..f2550277
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/warn-method.js
    @@ -0,0 +1,31 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.warnMethod = void 0;
    +const warnMethod = (self, code, message, data = {}) => {
    +    if (self.file) {
    +        data.file = self.file;
    +    }
    +    if (self.cwd) {
    +        data.cwd = self.cwd;
    +    }
    +    data.code =
    +        (message instanceof Error &&
    +            message.code) ||
    +            code;
    +    data.tarCode = code;
    +    if (!self.strict && data.recoverable !== false) {
    +        if (message instanceof Error) {
    +            data = Object.assign(message, data);
    +            message = message.message;
    +        }
    +        self.emit('warn', code, message, data);
    +    }
    +    else if (message instanceof Error) {
    +        self.emit('error', Object.assign(message, data));
    +    }
    +    else {
    +        self.emit('error', Object.assign(new Error(`${code}: ${message}`), data));
    +    }
    +};
    +exports.warnMethod = warnMethod;
    +//# sourceMappingURL=warn-method.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/winchars.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/winchars.js
    new file mode 100644
    index 00000000..c0a44058
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/winchars.js
    @@ -0,0 +1,14 @@
    +"use strict";
    +// When writing files on Windows, translate the characters to their
    +// 0xf000 higher-encoded versions.
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.decode = exports.encode = void 0;
    +const raw = ['|', '<', '>', '?', ':'];
    +const win = raw.map(char => String.fromCharCode(0xf000 + char.charCodeAt(0)));
    +const toWin = new Map(raw.map((char, i) => [char, win[i]]));
    +const toRaw = new Map(win.map((char, i) => [char, raw[i]]));
    +const encode = (s) => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s);
    +exports.encode = encode;
    +const decode = (s) => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s);
    +exports.decode = decode;
    +//# sourceMappingURL=winchars.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/write-entry.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/write-entry.js
    new file mode 100644
    index 00000000..45b7efeb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/commonjs/write-entry.js
    @@ -0,0 +1,689 @@
    +"use strict";
    +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    var desc = Object.getOwnPropertyDescriptor(m, k);
    +    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
    +      desc = { enumerable: true, get: function() { return m[k]; } };
    +    }
    +    Object.defineProperty(o, k2, desc);
    +}) : (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    o[k2] = m[k];
    +}));
    +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    +    Object.defineProperty(o, "default", { enumerable: true, value: v });
    +}) : function(o, v) {
    +    o["default"] = v;
    +});
    +var __importStar = (this && this.__importStar) || function (mod) {
    +    if (mod && mod.__esModule) return mod;
    +    var result = {};
    +    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    +    __setModuleDefault(result, mod);
    +    return result;
    +};
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.WriteEntryTar = exports.WriteEntrySync = exports.WriteEntry = void 0;
    +const fs_1 = __importDefault(require("fs"));
    +const minipass_1 = require("minipass");
    +const path_1 = __importDefault(require("path"));
    +const header_js_1 = require("./header.js");
    +const mode_fix_js_1 = require("./mode-fix.js");
    +const normalize_windows_path_js_1 = require("./normalize-windows-path.js");
    +const options_js_1 = require("./options.js");
    +const pax_js_1 = require("./pax.js");
    +const strip_absolute_path_js_1 = require("./strip-absolute-path.js");
    +const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js");
    +const warn_method_js_1 = require("./warn-method.js");
    +const winchars = __importStar(require("./winchars.js"));
    +const prefixPath = (path, prefix) => {
    +    if (!prefix) {
    +        return (0, normalize_windows_path_js_1.normalizeWindowsPath)(path);
    +    }
    +    path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path).replace(/^\.(\/|$)/, '');
    +    return (0, strip_trailing_slashes_js_1.stripTrailingSlashes)(prefix) + '/' + path;
    +};
    +const maxReadSize = 16 * 1024 * 1024;
    +const PROCESS = Symbol('process');
    +const FILE = Symbol('file');
    +const DIRECTORY = Symbol('directory');
    +const SYMLINK = Symbol('symlink');
    +const HARDLINK = Symbol('hardlink');
    +const HEADER = Symbol('header');
    +const READ = Symbol('read');
    +const LSTAT = Symbol('lstat');
    +const ONLSTAT = Symbol('onlstat');
    +const ONREAD = Symbol('onread');
    +const ONREADLINK = Symbol('onreadlink');
    +const OPENFILE = Symbol('openfile');
    +const ONOPENFILE = Symbol('onopenfile');
    +const CLOSE = Symbol('close');
    +const MODE = Symbol('mode');
    +const AWAITDRAIN = Symbol('awaitDrain');
    +const ONDRAIN = Symbol('ondrain');
    +const PREFIX = Symbol('prefix');
    +class WriteEntry extends minipass_1.Minipass {
    +    path;
    +    portable;
    +    myuid = (process.getuid && process.getuid()) || 0;
    +    // until node has builtin pwnam functions, this'll have to do
    +    myuser = process.env.USER || '';
    +    maxReadSize;
    +    linkCache;
    +    statCache;
    +    preservePaths;
    +    cwd;
    +    strict;
    +    mtime;
    +    noPax;
    +    noMtime;
    +    prefix;
    +    fd;
    +    blockLen = 0;
    +    blockRemain = 0;
    +    buf;
    +    pos = 0;
    +    remain = 0;
    +    length = 0;
    +    offset = 0;
    +    win32;
    +    absolute;
    +    header;
    +    type;
    +    linkpath;
    +    stat;
    +    onWriteEntry;
    +    #hadError = false;
    +    constructor(p, opt_ = {}) {
    +        const opt = (0, options_js_1.dealias)(opt_);
    +        super();
    +        this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(p);
    +        // suppress atime, ctime, uid, gid, uname, gname
    +        this.portable = !!opt.portable;
    +        this.maxReadSize = opt.maxReadSize || maxReadSize;
    +        this.linkCache = opt.linkCache || new Map();
    +        this.statCache = opt.statCache || new Map();
    +        this.preservePaths = !!opt.preservePaths;
    +        this.cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd || process.cwd());
    +        this.strict = !!opt.strict;
    +        this.noPax = !!opt.noPax;
    +        this.noMtime = !!opt.noMtime;
    +        this.mtime = opt.mtime;
    +        this.prefix =
    +            opt.prefix ? (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.prefix) : undefined;
    +        this.onWriteEntry = opt.onWriteEntry;
    +        if (typeof opt.onwarn === 'function') {
    +            this.on('warn', opt.onwarn);
    +        }
    +        let pathWarn = false;
    +        if (!this.preservePaths) {
    +            const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(this.path);
    +            if (root && typeof stripped === 'string') {
    +                this.path = stripped;
    +                pathWarn = root;
    +            }
    +        }
    +        this.win32 = !!opt.win32 || process.platform === 'win32';
    +        if (this.win32) {
    +            // force the \ to / normalization, since we might not *actually*
    +            // be on windows, but want \ to be considered a path separator.
    +            this.path = winchars.decode(this.path.replace(/\\/g, '/'));
    +            p = p.replace(/\\/g, '/');
    +        }
    +        this.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.absolute || path_1.default.resolve(this.cwd, p));
    +        if (this.path === '') {
    +            this.path = './';
    +        }
    +        if (pathWarn) {
    +            this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {
    +                entry: this,
    +                path: pathWarn + this.path,
    +            });
    +        }
    +        const cs = this.statCache.get(this.absolute);
    +        if (cs) {
    +            this[ONLSTAT](cs);
    +        }
    +        else {
    +            this[LSTAT]();
    +        }
    +    }
    +    warn(code, message, data = {}) {
    +        return (0, warn_method_js_1.warnMethod)(this, code, message, data);
    +    }
    +    emit(ev, ...data) {
    +        if (ev === 'error') {
    +            this.#hadError = true;
    +        }
    +        return super.emit(ev, ...data);
    +    }
    +    [LSTAT]() {
    +        fs_1.default.lstat(this.absolute, (er, stat) => {
    +            if (er) {
    +                return this.emit('error', er);
    +            }
    +            this[ONLSTAT](stat);
    +        });
    +    }
    +    [ONLSTAT](stat) {
    +        this.statCache.set(this.absolute, stat);
    +        this.stat = stat;
    +        if (!stat.isFile()) {
    +            stat.size = 0;
    +        }
    +        this.type = getType(stat);
    +        this.emit('stat', stat);
    +        this[PROCESS]();
    +    }
    +    [PROCESS]() {
    +        switch (this.type) {
    +            case 'File':
    +                return this[FILE]();
    +            case 'Directory':
    +                return this[DIRECTORY]();
    +            case 'SymbolicLink':
    +                return this[SYMLINK]();
    +            // unsupported types are ignored.
    +            default:
    +                return this.end();
    +        }
    +    }
    +    [MODE](mode) {
    +        return (0, mode_fix_js_1.modeFix)(mode, this.type === 'Directory', this.portable);
    +    }
    +    [PREFIX](path) {
    +        return prefixPath(path, this.prefix);
    +    }
    +    [HEADER]() {
    +        /* c8 ignore start */
    +        if (!this.stat) {
    +            throw new Error('cannot write header before stat');
    +        }
    +        /* c8 ignore stop */
    +        if (this.type === 'Directory' && this.portable) {
    +            this.noMtime = true;
    +        }
    +        this.onWriteEntry?.(this);
    +        this.header = new header_js_1.Header({
    +            path: this[PREFIX](this.path),
    +            // only apply the prefix to hard links.
    +            linkpath: this.type === 'Link' && this.linkpath !== undefined ?
    +                this[PREFIX](this.linkpath)
    +                : this.linkpath,
    +            // only the permissions and setuid/setgid/sticky bitflags
    +            // not the higher-order bits that specify file type
    +            mode: this[MODE](this.stat.mode),
    +            uid: this.portable ? undefined : this.stat.uid,
    +            gid: this.portable ? undefined : this.stat.gid,
    +            size: this.stat.size,
    +            mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime,
    +            /* c8 ignore next */
    +            type: this.type === 'Unsupported' ? undefined : this.type,
    +            uname: this.portable ? undefined
    +                : this.stat.uid === this.myuid ? this.myuser
    +                    : '',
    +            atime: this.portable ? undefined : this.stat.atime,
    +            ctime: this.portable ? undefined : this.stat.ctime,
    +        });
    +        if (this.header.encode() && !this.noPax) {
    +            super.write(new pax_js_1.Pax({
    +                atime: this.portable ? undefined : this.header.atime,
    +                ctime: this.portable ? undefined : this.header.ctime,
    +                gid: this.portable ? undefined : this.header.gid,
    +                mtime: this.noMtime ? undefined : (this.mtime || this.header.mtime),
    +                path: this[PREFIX](this.path),
    +                linkpath: this.type === 'Link' && this.linkpath !== undefined ?
    +                    this[PREFIX](this.linkpath)
    +                    : this.linkpath,
    +                size: this.header.size,
    +                uid: this.portable ? undefined : this.header.uid,
    +                uname: this.portable ? undefined : this.header.uname,
    +                dev: this.portable ? undefined : this.stat.dev,
    +                ino: this.portable ? undefined : this.stat.ino,
    +                nlink: this.portable ? undefined : this.stat.nlink,
    +            }).encode());
    +        }
    +        const block = this.header?.block;
    +        /* c8 ignore start */
    +        if (!block) {
    +            throw new Error('failed to encode header');
    +        }
    +        /* c8 ignore stop */
    +        super.write(block);
    +    }
    +    [DIRECTORY]() {
    +        /* c8 ignore start */
    +        if (!this.stat) {
    +            throw new Error('cannot create directory entry without stat');
    +        }
    +        /* c8 ignore stop */
    +        if (this.path.slice(-1) !== '/') {
    +            this.path += '/';
    +        }
    +        this.stat.size = 0;
    +        this[HEADER]();
    +        this.end();
    +    }
    +    [SYMLINK]() {
    +        fs_1.default.readlink(this.absolute, (er, linkpath) => {
    +            if (er) {
    +                return this.emit('error', er);
    +            }
    +            this[ONREADLINK](linkpath);
    +        });
    +    }
    +    [ONREADLINK](linkpath) {
    +        this.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(linkpath);
    +        this[HEADER]();
    +        this.end();
    +    }
    +    [HARDLINK](linkpath) {
    +        /* c8 ignore start */
    +        if (!this.stat) {
    +            throw new Error('cannot create link entry without stat');
    +        }
    +        /* c8 ignore stop */
    +        this.type = 'Link';
    +        this.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.relative(this.cwd, linkpath));
    +        this.stat.size = 0;
    +        this[HEADER]();
    +        this.end();
    +    }
    +    [FILE]() {
    +        /* c8 ignore start */
    +        if (!this.stat) {
    +            throw new Error('cannot create file entry without stat');
    +        }
    +        /* c8 ignore stop */
    +        if (this.stat.nlink > 1) {
    +            const linkKey = `${this.stat.dev}:${this.stat.ino}`;
    +            const linkpath = this.linkCache.get(linkKey);
    +            if (linkpath?.indexOf(this.cwd) === 0) {
    +                return this[HARDLINK](linkpath);
    +            }
    +            this.linkCache.set(linkKey, this.absolute);
    +        }
    +        this[HEADER]();
    +        if (this.stat.size === 0) {
    +            return this.end();
    +        }
    +        this[OPENFILE]();
    +    }
    +    [OPENFILE]() {
    +        fs_1.default.open(this.absolute, 'r', (er, fd) => {
    +            if (er) {
    +                return this.emit('error', er);
    +            }
    +            this[ONOPENFILE](fd);
    +        });
    +    }
    +    [ONOPENFILE](fd) {
    +        this.fd = fd;
    +        if (this.#hadError) {
    +            return this[CLOSE]();
    +        }
    +        /* c8 ignore start */
    +        if (!this.stat) {
    +            throw new Error('should stat before calling onopenfile');
    +        }
    +        /* c8 ignore start */
    +        this.blockLen = 512 * Math.ceil(this.stat.size / 512);
    +        this.blockRemain = this.blockLen;
    +        const bufLen = Math.min(this.blockLen, this.maxReadSize);
    +        this.buf = Buffer.allocUnsafe(bufLen);
    +        this.offset = 0;
    +        this.pos = 0;
    +        this.remain = this.stat.size;
    +        this.length = this.buf.length;
    +        this[READ]();
    +    }
    +    [READ]() {
    +        const { fd, buf, offset, length, pos } = this;
    +        if (fd === undefined || buf === undefined) {
    +            throw new Error('cannot read file without first opening');
    +        }
    +        fs_1.default.read(fd, buf, offset, length, pos, (er, bytesRead) => {
    +            if (er) {
    +                // ignoring the error from close(2) is a bad practice, but at
    +                // this point we already have an error, don't need another one
    +                return this[CLOSE](() => this.emit('error', er));
    +            }
    +            this[ONREAD](bytesRead);
    +        });
    +    }
    +    /* c8 ignore start */
    +    [CLOSE](cb = () => { }) {
    +        /* c8 ignore stop */
    +        if (this.fd !== undefined)
    +            fs_1.default.close(this.fd, cb);
    +    }
    +    [ONREAD](bytesRead) {
    +        if (bytesRead <= 0 && this.remain > 0) {
    +            const er = Object.assign(new Error('encountered unexpected EOF'), {
    +                path: this.absolute,
    +                syscall: 'read',
    +                code: 'EOF',
    +            });
    +            return this[CLOSE](() => this.emit('error', er));
    +        }
    +        if (bytesRead > this.remain) {
    +            const er = Object.assign(new Error('did not encounter expected EOF'), {
    +                path: this.absolute,
    +                syscall: 'read',
    +                code: 'EOF',
    +            });
    +            return this[CLOSE](() => this.emit('error', er));
    +        }
    +        /* c8 ignore start */
    +        if (!this.buf) {
    +            throw new Error('should have created buffer prior to reading');
    +        }
    +        /* c8 ignore stop */
    +        // null out the rest of the buffer, if we could fit the block padding
    +        // at the end of this loop, we've incremented bytesRead and this.remain
    +        // to be incremented up to the blockRemain level, as if we had expected
    +        // to get a null-padded file, and read it until the end.  then we will
    +        // decrement both remain and blockRemain by bytesRead, and know that we
    +        // reached the expected EOF, without any null buffer to append.
    +        if (bytesRead === this.remain) {
    +            for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) {
    +                this.buf[i + this.offset] = 0;
    +                bytesRead++;
    +                this.remain++;
    +            }
    +        }
    +        const chunk = this.offset === 0 && bytesRead === this.buf.length ?
    +            this.buf
    +            : this.buf.subarray(this.offset, this.offset + bytesRead);
    +        const flushed = this.write(chunk);
    +        if (!flushed) {
    +            this[AWAITDRAIN](() => this[ONDRAIN]());
    +        }
    +        else {
    +            this[ONDRAIN]();
    +        }
    +    }
    +    [AWAITDRAIN](cb) {
    +        this.once('drain', cb);
    +    }
    +    write(chunk, encoding, cb) {
    +        /* c8 ignore start - just junk to comply with NodeJS.WritableStream */
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        if (typeof chunk === 'string') {
    +            chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8');
    +        }
    +        /* c8 ignore stop */
    +        if (this.blockRemain < chunk.length) {
    +            const er = Object.assign(new Error('writing more data than expected'), {
    +                path: this.absolute,
    +            });
    +            return this.emit('error', er);
    +        }
    +        this.remain -= chunk.length;
    +        this.blockRemain -= chunk.length;
    +        this.pos += chunk.length;
    +        this.offset += chunk.length;
    +        return super.write(chunk, null, cb);
    +    }
    +    [ONDRAIN]() {
    +        if (!this.remain) {
    +            if (this.blockRemain) {
    +                super.write(Buffer.alloc(this.blockRemain));
    +            }
    +            return this[CLOSE](er => er ? this.emit('error', er) : this.end());
    +        }
    +        /* c8 ignore start */
    +        if (!this.buf) {
    +            throw new Error('buffer lost somehow in ONDRAIN');
    +        }
    +        /* c8 ignore stop */
    +        if (this.offset >= this.length) {
    +            // if we only have a smaller bit left to read, alloc a smaller buffer
    +            // otherwise, keep it the same length it was before.
    +            this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length));
    +            this.offset = 0;
    +        }
    +        this.length = this.buf.length - this.offset;
    +        this[READ]();
    +    }
    +}
    +exports.WriteEntry = WriteEntry;
    +class WriteEntrySync extends WriteEntry {
    +    sync = true;
    +    [LSTAT]() {
    +        this[ONLSTAT](fs_1.default.lstatSync(this.absolute));
    +    }
    +    [SYMLINK]() {
    +        this[ONREADLINK](fs_1.default.readlinkSync(this.absolute));
    +    }
    +    [OPENFILE]() {
    +        this[ONOPENFILE](fs_1.default.openSync(this.absolute, 'r'));
    +    }
    +    [READ]() {
    +        let threw = true;
    +        try {
    +            const { fd, buf, offset, length, pos } = this;
    +            /* c8 ignore start */
    +            if (fd === undefined || buf === undefined) {
    +                throw new Error('fd and buf must be set in READ method');
    +            }
    +            /* c8 ignore stop */
    +            const bytesRead = fs_1.default.readSync(fd, buf, offset, length, pos);
    +            this[ONREAD](bytesRead);
    +            threw = false;
    +        }
    +        finally {
    +            // ignoring the error from close(2) is a bad practice, but at
    +            // this point we already have an error, don't need another one
    +            if (threw) {
    +                try {
    +                    this[CLOSE](() => { });
    +                }
    +                catch (er) { }
    +            }
    +        }
    +    }
    +    [AWAITDRAIN](cb) {
    +        cb();
    +    }
    +    /* c8 ignore start */
    +    [CLOSE](cb = () => { }) {
    +        /* c8 ignore stop */
    +        if (this.fd !== undefined)
    +            fs_1.default.closeSync(this.fd);
    +        cb();
    +    }
    +}
    +exports.WriteEntrySync = WriteEntrySync;
    +class WriteEntryTar extends minipass_1.Minipass {
    +    blockLen = 0;
    +    blockRemain = 0;
    +    buf = 0;
    +    pos = 0;
    +    remain = 0;
    +    length = 0;
    +    preservePaths;
    +    portable;
    +    strict;
    +    noPax;
    +    noMtime;
    +    readEntry;
    +    type;
    +    prefix;
    +    path;
    +    mode;
    +    uid;
    +    gid;
    +    uname;
    +    gname;
    +    header;
    +    mtime;
    +    atime;
    +    ctime;
    +    linkpath;
    +    size;
    +    onWriteEntry;
    +    warn(code, message, data = {}) {
    +        return (0, warn_method_js_1.warnMethod)(this, code, message, data);
    +    }
    +    constructor(readEntry, opt_ = {}) {
    +        const opt = (0, options_js_1.dealias)(opt_);
    +        super();
    +        this.preservePaths = !!opt.preservePaths;
    +        this.portable = !!opt.portable;
    +        this.strict = !!opt.strict;
    +        this.noPax = !!opt.noPax;
    +        this.noMtime = !!opt.noMtime;
    +        this.onWriteEntry = opt.onWriteEntry;
    +        this.readEntry = readEntry;
    +        const { type } = readEntry;
    +        /* c8 ignore start */
    +        if (type === 'Unsupported') {
    +            throw new Error('writing entry that should be ignored');
    +        }
    +        /* c8 ignore stop */
    +        this.type = type;
    +        if (this.type === 'Directory' && this.portable) {
    +            this.noMtime = true;
    +        }
    +        this.prefix = opt.prefix;
    +        this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(readEntry.path);
    +        this.mode =
    +            readEntry.mode !== undefined ?
    +                this[MODE](readEntry.mode)
    +                : undefined;
    +        this.uid = this.portable ? undefined : readEntry.uid;
    +        this.gid = this.portable ? undefined : readEntry.gid;
    +        this.uname = this.portable ? undefined : readEntry.uname;
    +        this.gname = this.portable ? undefined : readEntry.gname;
    +        this.size = readEntry.size;
    +        this.mtime =
    +            this.noMtime ? undefined : opt.mtime || readEntry.mtime;
    +        this.atime = this.portable ? undefined : readEntry.atime;
    +        this.ctime = this.portable ? undefined : readEntry.ctime;
    +        this.linkpath =
    +            readEntry.linkpath !== undefined ?
    +                (0, normalize_windows_path_js_1.normalizeWindowsPath)(readEntry.linkpath)
    +                : undefined;
    +        if (typeof opt.onwarn === 'function') {
    +            this.on('warn', opt.onwarn);
    +        }
    +        let pathWarn = false;
    +        if (!this.preservePaths) {
    +            const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(this.path);
    +            if (root && typeof stripped === 'string') {
    +                this.path = stripped;
    +                pathWarn = root;
    +            }
    +        }
    +        this.remain = readEntry.size;
    +        this.blockRemain = readEntry.startBlockSize;
    +        this.onWriteEntry?.(this);
    +        this.header = new header_js_1.Header({
    +            path: this[PREFIX](this.path),
    +            linkpath: this.type === 'Link' && this.linkpath !== undefined ?
    +                this[PREFIX](this.linkpath)
    +                : this.linkpath,
    +            // only the permissions and setuid/setgid/sticky bitflags
    +            // not the higher-order bits that specify file type
    +            mode: this.mode,
    +            uid: this.portable ? undefined : this.uid,
    +            gid: this.portable ? undefined : this.gid,
    +            size: this.size,
    +            mtime: this.noMtime ? undefined : this.mtime,
    +            type: this.type,
    +            uname: this.portable ? undefined : this.uname,
    +            atime: this.portable ? undefined : this.atime,
    +            ctime: this.portable ? undefined : this.ctime,
    +        });
    +        if (pathWarn) {
    +            this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {
    +                entry: this,
    +                path: pathWarn + this.path,
    +            });
    +        }
    +        if (this.header.encode() && !this.noPax) {
    +            super.write(new pax_js_1.Pax({
    +                atime: this.portable ? undefined : this.atime,
    +                ctime: this.portable ? undefined : this.ctime,
    +                gid: this.portable ? undefined : this.gid,
    +                mtime: this.noMtime ? undefined : this.mtime,
    +                path: this[PREFIX](this.path),
    +                linkpath: this.type === 'Link' && this.linkpath !== undefined ?
    +                    this[PREFIX](this.linkpath)
    +                    : this.linkpath,
    +                size: this.size,
    +                uid: this.portable ? undefined : this.uid,
    +                uname: this.portable ? undefined : this.uname,
    +                dev: this.portable ? undefined : this.readEntry.dev,
    +                ino: this.portable ? undefined : this.readEntry.ino,
    +                nlink: this.portable ? undefined : this.readEntry.nlink,
    +            }).encode());
    +        }
    +        const b = this.header?.block;
    +        /* c8 ignore start */
    +        if (!b)
    +            throw new Error('failed to encode header');
    +        /* c8 ignore stop */
    +        super.write(b);
    +        readEntry.pipe(this);
    +    }
    +    [PREFIX](path) {
    +        return prefixPath(path, this.prefix);
    +    }
    +    [MODE](mode) {
    +        return (0, mode_fix_js_1.modeFix)(mode, this.type === 'Directory', this.portable);
    +    }
    +    write(chunk, encoding, cb) {
    +        /* c8 ignore start - just junk to comply with NodeJS.WritableStream */
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        if (typeof chunk === 'string') {
    +            chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8');
    +        }
    +        /* c8 ignore stop */
    +        const writeLen = chunk.length;
    +        if (writeLen > this.blockRemain) {
    +            throw new Error('writing more to entry than is appropriate');
    +        }
    +        this.blockRemain -= writeLen;
    +        return super.write(chunk, cb);
    +    }
    +    end(chunk, encoding, cb) {
    +        if (this.blockRemain) {
    +            super.write(Buffer.alloc(this.blockRemain));
    +        }
    +        /* c8 ignore start - just junk to comply with NodeJS.WritableStream */
    +        if (typeof chunk === 'function') {
    +            cb = chunk;
    +            encoding = undefined;
    +            chunk = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        if (typeof chunk === 'string') {
    +            chunk = Buffer.from(chunk, encoding ?? 'utf8');
    +        }
    +        if (cb)
    +            this.once('finish', cb);
    +        chunk ? super.end(chunk, cb) : super.end(cb);
    +        /* c8 ignore stop */
    +        return this;
    +    }
    +}
    +exports.WriteEntryTar = WriteEntryTar;
    +const getType = (stat) => stat.isFile() ? 'File'
    +    : stat.isDirectory() ? 'Directory'
    +        : stat.isSymbolicLink() ? 'SymbolicLink'
    +            : 'Unsupported';
    +//# sourceMappingURL=write-entry.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/create.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/create.js
    new file mode 100644
    index 00000000..512a9911
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/create.js
    @@ -0,0 +1,77 @@
    +import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass';
    +import path from 'node:path';
    +import { list } from './list.js';
    +import { makeCommand } from './make-command.js';
    +import { Pack, PackSync } from './pack.js';
    +const createFileSync = (opt, files) => {
    +    const p = new PackSync(opt);
    +    const stream = new WriteStreamSync(opt.file, {
    +        mode: opt.mode || 0o666,
    +    });
    +    p.pipe(stream);
    +    addFilesSync(p, files);
    +};
    +const createFile = (opt, files) => {
    +    const p = new Pack(opt);
    +    const stream = new WriteStream(opt.file, {
    +        mode: opt.mode || 0o666,
    +    });
    +    p.pipe(stream);
    +    const promise = new Promise((res, rej) => {
    +        stream.on('error', rej);
    +        stream.on('close', res);
    +        p.on('error', rej);
    +    });
    +    addFilesAsync(p, files);
    +    return promise;
    +};
    +const addFilesSync = (p, files) => {
    +    files.forEach(file => {
    +        if (file.charAt(0) === '@') {
    +            list({
    +                file: path.resolve(p.cwd, file.slice(1)),
    +                sync: true,
    +                noResume: true,
    +                onReadEntry: entry => p.add(entry),
    +            });
    +        }
    +        else {
    +            p.add(file);
    +        }
    +    });
    +    p.end();
    +};
    +const addFilesAsync = async (p, files) => {
    +    for (let i = 0; i < files.length; i++) {
    +        const file = String(files[i]);
    +        if (file.charAt(0) === '@') {
    +            await list({
    +                file: path.resolve(String(p.cwd), file.slice(1)),
    +                noResume: true,
    +                onReadEntry: entry => {
    +                    p.add(entry);
    +                },
    +            });
    +        }
    +        else {
    +            p.add(file);
    +        }
    +    }
    +    p.end();
    +};
    +const createSync = (opt, files) => {
    +    const p = new PackSync(opt);
    +    addFilesSync(p, files);
    +    return p;
    +};
    +const createAsync = (opt, files) => {
    +    const p = new Pack(opt);
    +    addFilesAsync(p, files);
    +    return p;
    +};
    +export const create = makeCommand(createFileSync, createFile, createSync, createAsync, (_opt, files) => {
    +    if (!files?.length) {
    +        throw new TypeError('no paths specified to add to archive');
    +    }
    +});
    +//# sourceMappingURL=create.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/cwd-error.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/cwd-error.js
    new file mode 100644
    index 00000000..289a066b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/cwd-error.js
    @@ -0,0 +1,14 @@
    +export class CwdError extends Error {
    +    path;
    +    code;
    +    syscall = 'chdir';
    +    constructor(path, code) {
    +        super(`${code}: Cannot cd into '${path}'`);
    +        this.path = path;
    +        this.code = code;
    +    }
    +    get name() {
    +        return 'CwdError';
    +    }
    +}
    +//# sourceMappingURL=cwd-error.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/extract.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/extract.js
    new file mode 100644
    index 00000000..2274feef
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/extract.js
    @@ -0,0 +1,49 @@
    +// tar -x
    +import * as fsm from '@isaacs/fs-minipass';
    +import fs from 'node:fs';
    +import { filesFilter } from './list.js';
    +import { makeCommand } from './make-command.js';
    +import { Unpack, UnpackSync } from './unpack.js';
    +const extractFileSync = (opt) => {
    +    const u = new UnpackSync(opt);
    +    const file = opt.file;
    +    const stat = fs.statSync(file);
    +    // This trades a zero-byte read() syscall for a stat
    +    // However, it will usually result in less memory allocation
    +    const readSize = opt.maxReadSize || 16 * 1024 * 1024;
    +    const stream = new fsm.ReadStreamSync(file, {
    +        readSize: readSize,
    +        size: stat.size,
    +    });
    +    stream.pipe(u);
    +};
    +const extractFile = (opt, _) => {
    +    const u = new Unpack(opt);
    +    const readSize = opt.maxReadSize || 16 * 1024 * 1024;
    +    const file = opt.file;
    +    const p = new Promise((resolve, reject) => {
    +        u.on('error', reject);
    +        u.on('close', resolve);
    +        // This trades a zero-byte read() syscall for a stat
    +        // However, it will usually result in less memory allocation
    +        fs.stat(file, (er, stat) => {
    +            if (er) {
    +                reject(er);
    +            }
    +            else {
    +                const stream = new fsm.ReadStream(file, {
    +                    readSize: readSize,
    +                    size: stat.size,
    +                });
    +                stream.on('error', reject);
    +                stream.pipe(u);
    +            }
    +        });
    +    });
    +    return p;
    +};
    +export const extract = makeCommand(extractFileSync, extractFile, opt => new UnpackSync(opt), opt => new Unpack(opt), (opt, files) => {
    +    if (files?.length)
    +        filesFilter(opt, files);
    +});
    +//# sourceMappingURL=extract.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/get-write-flag.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/get-write-flag.js
    new file mode 100644
    index 00000000..2c7f3e8b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/get-write-flag.js
    @@ -0,0 +1,23 @@
    +// Get the appropriate flag to use for creating files
    +// We use fmap on Windows platforms for files less than
    +// 512kb.  This is a fairly low limit, but avoids making
    +// things slower in some cases.  Since most of what this
    +// library is used for is extracting tarballs of many
    +// relatively small files in npm packages and the like,
    +// it can be a big boost on Windows platforms.
    +import fs from 'fs';
    +const platform = process.env.__FAKE_PLATFORM__ || process.platform;
    +const isWindows = platform === 'win32';
    +/* c8 ignore start */
    +const { O_CREAT, O_TRUNC, O_WRONLY } = fs.constants;
    +const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) ||
    +    fs.constants.UV_FS_O_FILEMAP ||
    +    0;
    +/* c8 ignore stop */
    +const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP;
    +const fMapLimit = 512 * 1024;
    +const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY;
    +export const getWriteFlag = !fMapEnabled ?
    +    () => 'w'
    +    : (size) => (size < fMapLimit ? fMapFlag : 'w');
    +//# sourceMappingURL=get-write-flag.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/header.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/header.js
    new file mode 100644
    index 00000000..e15192b1
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/header.js
    @@ -0,0 +1,279 @@
    +// parse a 512-byte header block to a data object, or vice-versa
    +// encode returns `true` if a pax extended header is needed, because
    +// the data could not be faithfully encoded in a simple header.
    +// (Also, check header.needPax to see if it needs a pax header.)
    +import { posix as pathModule } from 'node:path';
    +import * as large from './large-numbers.js';
    +import * as types from './types.js';
    +export class Header {
    +    cksumValid = false;
    +    needPax = false;
    +    nullBlock = false;
    +    block;
    +    path;
    +    mode;
    +    uid;
    +    gid;
    +    size;
    +    cksum;
    +    #type = 'Unsupported';
    +    linkpath;
    +    uname;
    +    gname;
    +    devmaj = 0;
    +    devmin = 0;
    +    atime;
    +    ctime;
    +    mtime;
    +    charset;
    +    comment;
    +    constructor(data, off = 0, ex, gex) {
    +        if (Buffer.isBuffer(data)) {
    +            this.decode(data, off || 0, ex, gex);
    +        }
    +        else if (data) {
    +            this.#slurp(data);
    +        }
    +    }
    +    decode(buf, off, ex, gex) {
    +        if (!off) {
    +            off = 0;
    +        }
    +        if (!buf || !(buf.length >= off + 512)) {
    +            throw new Error('need 512 bytes for header');
    +        }
    +        this.path = decString(buf, off, 100);
    +        this.mode = decNumber(buf, off + 100, 8);
    +        this.uid = decNumber(buf, off + 108, 8);
    +        this.gid = decNumber(buf, off + 116, 8);
    +        this.size = decNumber(buf, off + 124, 12);
    +        this.mtime = decDate(buf, off + 136, 12);
    +        this.cksum = decNumber(buf, off + 148, 12);
    +        // if we have extended or global extended headers, apply them now
    +        // See https://github.com/npm/node-tar/pull/187
    +        // Apply global before local, so it overrides
    +        if (gex)
    +            this.#slurp(gex, true);
    +        if (ex)
    +            this.#slurp(ex);
    +        // old tar versions marked dirs as a file with a trailing /
    +        const t = decString(buf, off + 156, 1);
    +        if (types.isCode(t)) {
    +            this.#type = t || '0';
    +        }
    +        if (this.#type === '0' && this.path.slice(-1) === '/') {
    +            this.#type = '5';
    +        }
    +        // tar implementations sometimes incorrectly put the stat(dir).size
    +        // as the size in the tarball, even though Directory entries are
    +        // not able to have any body at all.  In the very rare chance that
    +        // it actually DOES have a body, we weren't going to do anything with
    +        // it anyway, and it'll just be a warning about an invalid header.
    +        if (this.#type === '5') {
    +            this.size = 0;
    +        }
    +        this.linkpath = decString(buf, off + 157, 100);
    +        if (buf.subarray(off + 257, off + 265).toString() ===
    +            'ustar\u000000') {
    +            this.uname = decString(buf, off + 265, 32);
    +            this.gname = decString(buf, off + 297, 32);
    +            /* c8 ignore start */
    +            this.devmaj = decNumber(buf, off + 329, 8) ?? 0;
    +            this.devmin = decNumber(buf, off + 337, 8) ?? 0;
    +            /* c8 ignore stop */
    +            if (buf[off + 475] !== 0) {
    +                // definitely a prefix, definitely >130 chars.
    +                const prefix = decString(buf, off + 345, 155);
    +                this.path = prefix + '/' + this.path;
    +            }
    +            else {
    +                const prefix = decString(buf, off + 345, 130);
    +                if (prefix) {
    +                    this.path = prefix + '/' + this.path;
    +                }
    +                this.atime = decDate(buf, off + 476, 12);
    +                this.ctime = decDate(buf, off + 488, 12);
    +            }
    +        }
    +        let sum = 8 * 0x20;
    +        for (let i = off; i < off + 148; i++) {
    +            sum += buf[i];
    +        }
    +        for (let i = off + 156; i < off + 512; i++) {
    +            sum += buf[i];
    +        }
    +        this.cksumValid = sum === this.cksum;
    +        if (this.cksum === undefined && sum === 8 * 0x20) {
    +            this.nullBlock = true;
    +        }
    +    }
    +    #slurp(ex, gex = false) {
    +        Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
    +            // we slurp in everything except for the path attribute in
    +            // a global extended header, because that's weird. Also, any
    +            // null/undefined values are ignored.
    +            return !(v === null ||
    +                v === undefined ||
    +                (k === 'path' && gex) ||
    +                (k === 'linkpath' && gex) ||
    +                k === 'global');
    +        })));
    +    }
    +    encode(buf, off = 0) {
    +        if (!buf) {
    +            buf = this.block = Buffer.alloc(512);
    +        }
    +        if (this.#type === 'Unsupported') {
    +            this.#type = '0';
    +        }
    +        if (!(buf.length >= off + 512)) {
    +            throw new Error('need 512 bytes for header');
    +        }
    +        const prefixSize = this.ctime || this.atime ? 130 : 155;
    +        const split = splitPrefix(this.path || '', prefixSize);
    +        const path = split[0];
    +        const prefix = split[1];
    +        this.needPax = !!split[2];
    +        this.needPax = encString(buf, off, 100, path) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 100, 8, this.mode) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 108, 8, this.uid) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 116, 8, this.gid) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 124, 12, this.size) || this.needPax;
    +        this.needPax =
    +            encDate(buf, off + 136, 12, this.mtime) || this.needPax;
    +        buf[off + 156] = this.#type.charCodeAt(0);
    +        this.needPax =
    +            encString(buf, off + 157, 100, this.linkpath) || this.needPax;
    +        buf.write('ustar\u000000', off + 257, 8);
    +        this.needPax =
    +            encString(buf, off + 265, 32, this.uname) || this.needPax;
    +        this.needPax =
    +            encString(buf, off + 297, 32, this.gname) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 329, 8, this.devmaj) || this.needPax;
    +        this.needPax =
    +            encNumber(buf, off + 337, 8, this.devmin) || this.needPax;
    +        this.needPax =
    +            encString(buf, off + 345, prefixSize, prefix) || this.needPax;
    +        if (buf[off + 475] !== 0) {
    +            this.needPax =
    +                encString(buf, off + 345, 155, prefix) || this.needPax;
    +        }
    +        else {
    +            this.needPax =
    +                encString(buf, off + 345, 130, prefix) || this.needPax;
    +            this.needPax =
    +                encDate(buf, off + 476, 12, this.atime) || this.needPax;
    +            this.needPax =
    +                encDate(buf, off + 488, 12, this.ctime) || this.needPax;
    +        }
    +        let sum = 8 * 0x20;
    +        for (let i = off; i < off + 148; i++) {
    +            sum += buf[i];
    +        }
    +        for (let i = off + 156; i < off + 512; i++) {
    +            sum += buf[i];
    +        }
    +        this.cksum = sum;
    +        encNumber(buf, off + 148, 8, this.cksum);
    +        this.cksumValid = true;
    +        return this.needPax;
    +    }
    +    get type() {
    +        return (this.#type === 'Unsupported' ?
    +            this.#type
    +            : types.name.get(this.#type));
    +    }
    +    get typeKey() {
    +        return this.#type;
    +    }
    +    set type(type) {
    +        const c = String(types.code.get(type));
    +        if (types.isCode(c) || c === 'Unsupported') {
    +            this.#type = c;
    +        }
    +        else if (types.isCode(type)) {
    +            this.#type = type;
    +        }
    +        else {
    +            throw new TypeError('invalid entry type: ' + type);
    +        }
    +    }
    +}
    +const splitPrefix = (p, prefixSize) => {
    +    const pathSize = 100;
    +    let pp = p;
    +    let prefix = '';
    +    let ret = undefined;
    +    const root = pathModule.parse(p).root || '.';
    +    if (Buffer.byteLength(pp) < pathSize) {
    +        ret = [pp, prefix, false];
    +    }
    +    else {
    +        // first set prefix to the dir, and path to the base
    +        prefix = pathModule.dirname(pp);
    +        pp = pathModule.basename(pp);
    +        do {
    +            if (Buffer.byteLength(pp) <= pathSize &&
    +                Buffer.byteLength(prefix) <= prefixSize) {
    +                // both fit!
    +                ret = [pp, prefix, false];
    +            }
    +            else if (Buffer.byteLength(pp) > pathSize &&
    +                Buffer.byteLength(prefix) <= prefixSize) {
    +                // prefix fits in prefix, but path doesn't fit in path
    +                ret = [pp.slice(0, pathSize - 1), prefix, true];
    +            }
    +            else {
    +                // make path take a bit from prefix
    +                pp = pathModule.join(pathModule.basename(prefix), pp);
    +                prefix = pathModule.dirname(prefix);
    +            }
    +        } while (prefix !== root && ret === undefined);
    +        // at this point, found no resolution, just truncate
    +        if (!ret) {
    +            ret = [p.slice(0, pathSize - 1), '', true];
    +        }
    +    }
    +    return ret;
    +};
    +const decString = (buf, off, size) => buf
    +    .subarray(off, off + size)
    +    .toString('utf8')
    +    .replace(/\0.*/, '');
    +const decDate = (buf, off, size) => numToDate(decNumber(buf, off, size));
    +const numToDate = (num) => num === undefined ? undefined : new Date(num * 1000);
    +const decNumber = (buf, off, size) => Number(buf[off]) & 0x80 ?
    +    large.parse(buf.subarray(off, off + size))
    +    : decSmallNumber(buf, off, size);
    +const nanUndef = (value) => (isNaN(value) ? undefined : value);
    +const decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf
    +    .subarray(off, off + size)
    +    .toString('utf8')
    +    .replace(/\0.*$/, '')
    +    .trim(), 8));
    +// the maximum encodable as a null-terminated octal, by field size
    +const MAXNUM = {
    +    12: 0o77777777777,
    +    8: 0o7777777,
    +};
    +const encNumber = (buf, off, size, num) => num === undefined ? false
    +    : num > MAXNUM[size] || num < 0 ?
    +        (large.encode(num, buf.subarray(off, off + size)), true)
    +        : (encSmallNumber(buf, off, size, num), false);
    +const encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, 'ascii');
    +const octalString = (num, size) => padOctal(Math.floor(num).toString(8), size);
    +const padOctal = (str, size) => (str.length === size - 1 ?
    +    str
    +    : new Array(size - str.length - 1).join('0') + str + ' ') + '\0';
    +const encDate = (buf, off, size, date) => date === undefined ? false : (encNumber(buf, off, size, date.getTime() / 1000));
    +// enough to fill the longest string we've got
    +const NULLS = new Array(156).join('\0');
    +// pad with nulls, return true if it's longer or non-ascii
    +const encString = (buf, off, size, str) => str === undefined ? false : ((buf.write(str + NULLS, off, size, 'utf8'),
    +    str.length !== Buffer.byteLength(str) || str.length > size));
    +//# sourceMappingURL=header.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/index.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/index.js
    new file mode 100644
    index 00000000..1bac6415
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/index.js
    @@ -0,0 +1,20 @@
    +export * from './create.js';
    +export { create as c } from './create.js';
    +export * from './extract.js';
    +export { extract as x } from './extract.js';
    +export * from './header.js';
    +export * from './list.js';
    +export { list as t } from './list.js';
    +// classes
    +export * from './pack.js';
    +export * from './parse.js';
    +export * from './pax.js';
    +export * from './read-entry.js';
    +export * from './replace.js';
    +export { replace as r } from './replace.js';
    +export * as types from './types.js';
    +export * from './unpack.js';
    +export * from './update.js';
    +export { update as u } from './update.js';
    +export * from './write-entry.js';
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/large-numbers.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/large-numbers.js
    new file mode 100644
    index 00000000..4f2f7e5f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/large-numbers.js
    @@ -0,0 +1,94 @@
    +// Tar can encode large and negative numbers using a leading byte of
    +// 0xff for negative, and 0x80 for positive.
    +export const encode = (num, buf) => {
    +    if (!Number.isSafeInteger(num)) {
    +        // The number is so large that javascript cannot represent it with integer
    +        // precision.
    +        throw Error('cannot encode number outside of javascript safe integer range');
    +    }
    +    else if (num < 0) {
    +        encodeNegative(num, buf);
    +    }
    +    else {
    +        encodePositive(num, buf);
    +    }
    +    return buf;
    +};
    +const encodePositive = (num, buf) => {
    +    buf[0] = 0x80;
    +    for (var i = buf.length; i > 1; i--) {
    +        buf[i - 1] = num & 0xff;
    +        num = Math.floor(num / 0x100);
    +    }
    +};
    +const encodeNegative = (num, buf) => {
    +    buf[0] = 0xff;
    +    var flipped = false;
    +    num = num * -1;
    +    for (var i = buf.length; i > 1; i--) {
    +        var byte = num & 0xff;
    +        num = Math.floor(num / 0x100);
    +        if (flipped) {
    +            buf[i - 1] = onesComp(byte);
    +        }
    +        else if (byte === 0) {
    +            buf[i - 1] = 0;
    +        }
    +        else {
    +            flipped = true;
    +            buf[i - 1] = twosComp(byte);
    +        }
    +    }
    +};
    +export const parse = (buf) => {
    +    const pre = buf[0];
    +    const value = pre === 0x80 ? pos(buf.subarray(1, buf.length))
    +        : pre === 0xff ? twos(buf)
    +            : null;
    +    if (value === null) {
    +        throw Error('invalid base256 encoding');
    +    }
    +    if (!Number.isSafeInteger(value)) {
    +        // The number is so large that javascript cannot represent it with integer
    +        // precision.
    +        throw Error('parsed number outside of javascript safe integer range');
    +    }
    +    return value;
    +};
    +const twos = (buf) => {
    +    var len = buf.length;
    +    var sum = 0;
    +    var flipped = false;
    +    for (var i = len - 1; i > -1; i--) {
    +        var byte = Number(buf[i]);
    +        var f;
    +        if (flipped) {
    +            f = onesComp(byte);
    +        }
    +        else if (byte === 0) {
    +            f = byte;
    +        }
    +        else {
    +            flipped = true;
    +            f = twosComp(byte);
    +        }
    +        if (f !== 0) {
    +            sum -= f * Math.pow(256, len - i - 1);
    +        }
    +    }
    +    return sum;
    +};
    +const pos = (buf) => {
    +    var len = buf.length;
    +    var sum = 0;
    +    for (var i = len - 1; i > -1; i--) {
    +        var byte = Number(buf[i]);
    +        if (byte !== 0) {
    +            sum += byte * Math.pow(256, len - i - 1);
    +        }
    +    }
    +    return sum;
    +};
    +const onesComp = (byte) => (0xff ^ byte) & 0xff;
    +const twosComp = (byte) => ((0xff ^ byte) + 1) & 0xff;
    +//# sourceMappingURL=large-numbers.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/list.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/list.js
    new file mode 100644
    index 00000000..f4906840
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/list.js
    @@ -0,0 +1,106 @@
    +// tar -t
    +import * as fsm from '@isaacs/fs-minipass';
    +import fs from 'node:fs';
    +import { dirname, parse } from 'path';
    +import { makeCommand } from './make-command.js';
    +import { Parser } from './parse.js';
    +import { stripTrailingSlashes } from './strip-trailing-slashes.js';
    +const onReadEntryFunction = (opt) => {
    +    const onReadEntry = opt.onReadEntry;
    +    opt.onReadEntry =
    +        onReadEntry ?
    +            e => {
    +                onReadEntry(e);
    +                e.resume();
    +            }
    +            : e => e.resume();
    +};
    +// construct a filter that limits the file entries listed
    +// include child entries if a dir is included
    +export const filesFilter = (opt, files) => {
    +    const map = new Map(files.map(f => [stripTrailingSlashes(f), true]));
    +    const filter = opt.filter;
    +    const mapHas = (file, r = '') => {
    +        const root = r || parse(file).root || '.';
    +        let ret;
    +        if (file === root)
    +            ret = false;
    +        else {
    +            const m = map.get(file);
    +            if (m !== undefined) {
    +                ret = m;
    +            }
    +            else {
    +                ret = mapHas(dirname(file), root);
    +            }
    +        }
    +        map.set(file, ret);
    +        return ret;
    +    };
    +    opt.filter =
    +        filter ?
    +            (file, entry) => filter(file, entry) && mapHas(stripTrailingSlashes(file))
    +            : file => mapHas(stripTrailingSlashes(file));
    +};
    +const listFileSync = (opt) => {
    +    const p = new Parser(opt);
    +    const file = opt.file;
    +    let fd;
    +    try {
    +        const stat = fs.statSync(file);
    +        const readSize = opt.maxReadSize || 16 * 1024 * 1024;
    +        if (stat.size < readSize) {
    +            p.end(fs.readFileSync(file));
    +        }
    +        else {
    +            let pos = 0;
    +            const buf = Buffer.allocUnsafe(readSize);
    +            fd = fs.openSync(file, 'r');
    +            while (pos < stat.size) {
    +                const bytesRead = fs.readSync(fd, buf, 0, readSize, pos);
    +                pos += bytesRead;
    +                p.write(buf.subarray(0, bytesRead));
    +            }
    +            p.end();
    +        }
    +    }
    +    finally {
    +        if (typeof fd === 'number') {
    +            try {
    +                fs.closeSync(fd);
    +                /* c8 ignore next */
    +            }
    +            catch (er) { }
    +        }
    +    }
    +};
    +const listFile = (opt, _files) => {
    +    const parse = new Parser(opt);
    +    const readSize = opt.maxReadSize || 16 * 1024 * 1024;
    +    const file = opt.file;
    +    const p = new Promise((resolve, reject) => {
    +        parse.on('error', reject);
    +        parse.on('end', resolve);
    +        fs.stat(file, (er, stat) => {
    +            if (er) {
    +                reject(er);
    +            }
    +            else {
    +                const stream = new fsm.ReadStream(file, {
    +                    readSize: readSize,
    +                    size: stat.size,
    +                });
    +                stream.on('error', reject);
    +                stream.pipe(parse);
    +            }
    +        });
    +    });
    +    return p;
    +};
    +export const list = makeCommand(listFileSync, listFile, opt => new Parser(opt), opt => new Parser(opt), (opt, files) => {
    +    if (files?.length)
    +        filesFilter(opt, files);
    +    if (!opt.noResume)
    +        onReadEntryFunction(opt);
    +});
    +//# sourceMappingURL=list.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/make-command.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/make-command.js
    new file mode 100644
    index 00000000..f2f737bc
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/make-command.js
    @@ -0,0 +1,57 @@
    +import { dealias, isAsyncFile, isAsyncNoFile, isSyncFile, isSyncNoFile, } from './options.js';
    +export const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => {
    +    return Object.assign((opt_ = [], entries, cb) => {
    +        if (Array.isArray(opt_)) {
    +            entries = opt_;
    +            opt_ = {};
    +        }
    +        if (typeof entries === 'function') {
    +            cb = entries;
    +            entries = undefined;
    +        }
    +        if (!entries) {
    +            entries = [];
    +        }
    +        else {
    +            entries = Array.from(entries);
    +        }
    +        const opt = dealias(opt_);
    +        validate?.(opt, entries);
    +        if (isSyncFile(opt)) {
    +            if (typeof cb === 'function') {
    +                throw new TypeError('callback not supported for sync tar functions');
    +            }
    +            return syncFile(opt, entries);
    +        }
    +        else if (isAsyncFile(opt)) {
    +            const p = asyncFile(opt, entries);
    +            // weirdness to make TS happy
    +            const c = cb ? cb : undefined;
    +            return c ? p.then(() => c(), c) : p;
    +        }
    +        else if (isSyncNoFile(opt)) {
    +            if (typeof cb === 'function') {
    +                throw new TypeError('callback not supported for sync tar functions');
    +            }
    +            return syncNoFile(opt, entries);
    +        }
    +        else if (isAsyncNoFile(opt)) {
    +            if (typeof cb === 'function') {
    +                throw new TypeError('callback only supported with file option');
    +            }
    +            return asyncNoFile(opt, entries);
    +            /* c8 ignore start */
    +        }
    +        else {
    +            throw new Error('impossible options??');
    +        }
    +        /* c8 ignore stop */
    +    }, {
    +        syncFile,
    +        asyncFile,
    +        syncNoFile,
    +        asyncNoFile,
    +        validate,
    +    });
    +};
    +//# sourceMappingURL=make-command.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/mkdir.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/mkdir.js
    new file mode 100644
    index 00000000..13498ef0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/mkdir.js
    @@ -0,0 +1,201 @@
    +import { chownr, chownrSync } from 'chownr';
    +import fs from 'fs';
    +import { mkdirp, mkdirpSync } from 'mkdirp';
    +import path from 'node:path';
    +import { CwdError } from './cwd-error.js';
    +import { normalizeWindowsPath } from './normalize-windows-path.js';
    +import { SymlinkError } from './symlink-error.js';
    +const cGet = (cache, key) => cache.get(normalizeWindowsPath(key));
    +const cSet = (cache, key, val) => cache.set(normalizeWindowsPath(key), val);
    +const checkCwd = (dir, cb) => {
    +    fs.stat(dir, (er, st) => {
    +        if (er || !st.isDirectory()) {
    +            er = new CwdError(dir, er?.code || 'ENOTDIR');
    +        }
    +        cb(er);
    +    });
    +};
    +/**
    + * Wrapper around mkdirp for tar's needs.
    + *
    + * The main purpose is to avoid creating directories if we know that
    + * they already exist (and track which ones exist for this purpose),
    + * and prevent entries from being extracted into symlinked folders,
    + * if `preservePaths` is not set.
    + */
    +export const mkdir = (dir, opt, cb) => {
    +    dir = normalizeWindowsPath(dir);
    +    // if there's any overlap between mask and mode,
    +    // then we'll need an explicit chmod
    +    /* c8 ignore next */
    +    const umask = opt.umask ?? 0o22;
    +    const mode = opt.mode | 0o0700;
    +    const needChmod = (mode & umask) !== 0;
    +    const uid = opt.uid;
    +    const gid = opt.gid;
    +    const doChown = typeof uid === 'number' &&
    +        typeof gid === 'number' &&
    +        (uid !== opt.processUid || gid !== opt.processGid);
    +    const preserve = opt.preserve;
    +    const unlink = opt.unlink;
    +    const cache = opt.cache;
    +    const cwd = normalizeWindowsPath(opt.cwd);
    +    const done = (er, created) => {
    +        if (er) {
    +            cb(er);
    +        }
    +        else {
    +            cSet(cache, dir, true);
    +            if (created && doChown) {
    +                chownr(created, uid, gid, er => done(er));
    +            }
    +            else if (needChmod) {
    +                fs.chmod(dir, mode, cb);
    +            }
    +            else {
    +                cb();
    +            }
    +        }
    +    };
    +    if (cache && cGet(cache, dir) === true) {
    +        return done();
    +    }
    +    if (dir === cwd) {
    +        return checkCwd(dir, done);
    +    }
    +    if (preserve) {
    +        return mkdirp(dir, { mode }).then(made => done(null, made ?? undefined), // oh, ts
    +        done);
    +    }
    +    const sub = normalizeWindowsPath(path.relative(cwd, dir));
    +    const parts = sub.split('/');
    +    mkdir_(cwd, parts, mode, cache, unlink, cwd, undefined, done);
    +};
    +const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => {
    +    if (!parts.length) {
    +        return cb(null, created);
    +    }
    +    const p = parts.shift();
    +    const part = normalizeWindowsPath(path.resolve(base + '/' + p));
    +    if (cGet(cache, part)) {
    +        return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb);
    +    }
    +    fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb));
    +};
    +const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => {
    +    if (er) {
    +        fs.lstat(part, (statEr, st) => {
    +            if (statEr) {
    +                statEr.path =
    +                    statEr.path && normalizeWindowsPath(statEr.path);
    +                cb(statEr);
    +            }
    +            else if (st.isDirectory()) {
    +                mkdir_(part, parts, mode, cache, unlink, cwd, created, cb);
    +            }
    +            else if (unlink) {
    +                fs.unlink(part, er => {
    +                    if (er) {
    +                        return cb(er);
    +                    }
    +                    fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb));
    +                });
    +            }
    +            else if (st.isSymbolicLink()) {
    +                return cb(new SymlinkError(part, part + '/' + parts.join('/')));
    +            }
    +            else {
    +                cb(er);
    +            }
    +        });
    +    }
    +    else {
    +        created = created || part;
    +        mkdir_(part, parts, mode, cache, unlink, cwd, created, cb);
    +    }
    +};
    +const checkCwdSync = (dir) => {
    +    let ok = false;
    +    let code = undefined;
    +    try {
    +        ok = fs.statSync(dir).isDirectory();
    +    }
    +    catch (er) {
    +        code = er?.code;
    +    }
    +    finally {
    +        if (!ok) {
    +            throw new CwdError(dir, code ?? 'ENOTDIR');
    +        }
    +    }
    +};
    +export const mkdirSync = (dir, opt) => {
    +    dir = normalizeWindowsPath(dir);
    +    // if there's any overlap between mask and mode,
    +    // then we'll need an explicit chmod
    +    /* c8 ignore next */
    +    const umask = opt.umask ?? 0o22;
    +    const mode = opt.mode | 0o700;
    +    const needChmod = (mode & umask) !== 0;
    +    const uid = opt.uid;
    +    const gid = opt.gid;
    +    const doChown = typeof uid === 'number' &&
    +        typeof gid === 'number' &&
    +        (uid !== opt.processUid || gid !== opt.processGid);
    +    const preserve = opt.preserve;
    +    const unlink = opt.unlink;
    +    const cache = opt.cache;
    +    const cwd = normalizeWindowsPath(opt.cwd);
    +    const done = (created) => {
    +        cSet(cache, dir, true);
    +        if (created && doChown) {
    +            chownrSync(created, uid, gid);
    +        }
    +        if (needChmod) {
    +            fs.chmodSync(dir, mode);
    +        }
    +    };
    +    if (cache && cGet(cache, dir) === true) {
    +        return done();
    +    }
    +    if (dir === cwd) {
    +        checkCwdSync(cwd);
    +        return done();
    +    }
    +    if (preserve) {
    +        return done(mkdirpSync(dir, mode) ?? undefined);
    +    }
    +    const sub = normalizeWindowsPath(path.relative(cwd, dir));
    +    const parts = sub.split('/');
    +    let created = undefined;
    +    for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) {
    +        part = normalizeWindowsPath(path.resolve(part));
    +        if (cGet(cache, part)) {
    +            continue;
    +        }
    +        try {
    +            fs.mkdirSync(part, mode);
    +            created = created || part;
    +            cSet(cache, part, true);
    +        }
    +        catch (er) {
    +            const st = fs.lstatSync(part);
    +            if (st.isDirectory()) {
    +                cSet(cache, part, true);
    +                continue;
    +            }
    +            else if (unlink) {
    +                fs.unlinkSync(part);
    +                fs.mkdirSync(part, mode);
    +                created = created || part;
    +                cSet(cache, part, true);
    +                continue;
    +            }
    +            else if (st.isSymbolicLink()) {
    +                return new SymlinkError(part, part + '/' + parts.join('/'));
    +            }
    +        }
    +    }
    +    return done(created);
    +};
    +//# sourceMappingURL=mkdir.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/mode-fix.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/mode-fix.js
    new file mode 100644
    index 00000000..5fd3bb88
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/mode-fix.js
    @@ -0,0 +1,25 @@
    +export const modeFix = (mode, isDir, portable) => {
    +    mode &= 0o7777;
    +    // in portable mode, use the minimum reasonable umask
    +    // if this system creates files with 0o664 by default
    +    // (as some linux distros do), then we'll write the
    +    // archive with 0o644 instead.  Also, don't ever create
    +    // a file that is not readable/writable by the owner.
    +    if (portable) {
    +        mode = (mode | 0o600) & ~0o22;
    +    }
    +    // if dirs are readable, then they should be listable
    +    if (isDir) {
    +        if (mode & 0o400) {
    +            mode |= 0o100;
    +        }
    +        if (mode & 0o40) {
    +            mode |= 0o10;
    +        }
    +        if (mode & 0o4) {
    +            mode |= 0o1;
    +        }
    +    }
    +    return mode;
    +};
    +//# sourceMappingURL=mode-fix.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-unicode.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-unicode.js
    new file mode 100644
    index 00000000..94e50954
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-unicode.js
    @@ -0,0 +1,13 @@
    +// warning: extremely hot code path.
    +// This has been meticulously optimized for use
    +// within npm install on large package trees.
    +// Do not edit without careful benchmarking.
    +const normalizeCache = Object.create(null);
    +const { hasOwnProperty } = Object.prototype;
    +export const normalizeUnicode = (s) => {
    +    if (!hasOwnProperty.call(normalizeCache, s)) {
    +        normalizeCache[s] = s.normalize('NFD');
    +    }
    +    return normalizeCache[s];
    +};
    +//# sourceMappingURL=normalize-unicode.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-windows-path.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-windows-path.js
    new file mode 100644
    index 00000000..2d97d2b8
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-windows-path.js
    @@ -0,0 +1,9 @@
    +// on windows, either \ or / are valid directory separators.
    +// on unix, \ is a valid character in filenames.
    +// so, on windows, and only on windows, we replace all \ chars with /,
    +// so that we can use / as our one and only directory separator char.
    +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
    +export const normalizeWindowsPath = platform !== 'win32' ?
    +    (p) => p
    +    : (p) => p && p.replace(/\\/g, '/');
    +//# sourceMappingURL=normalize-windows-path.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/options.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/options.js
    new file mode 100644
    index 00000000..a006d36c
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/options.js
    @@ -0,0 +1,54 @@
    +// turn tar(1) style args like `C` into the more verbose things like `cwd`
    +const argmap = new Map([
    +    ['C', 'cwd'],
    +    ['f', 'file'],
    +    ['z', 'gzip'],
    +    ['P', 'preservePaths'],
    +    ['U', 'unlink'],
    +    ['strip-components', 'strip'],
    +    ['stripComponents', 'strip'],
    +    ['keep-newer', 'newer'],
    +    ['keepNewer', 'newer'],
    +    ['keep-newer-files', 'newer'],
    +    ['keepNewerFiles', 'newer'],
    +    ['k', 'keep'],
    +    ['keep-existing', 'keep'],
    +    ['keepExisting', 'keep'],
    +    ['m', 'noMtime'],
    +    ['no-mtime', 'noMtime'],
    +    ['p', 'preserveOwner'],
    +    ['L', 'follow'],
    +    ['h', 'follow'],
    +    ['onentry', 'onReadEntry'],
    +]);
    +export const isSyncFile = (o) => !!o.sync && !!o.file;
    +export const isAsyncFile = (o) => !o.sync && !!o.file;
    +export const isSyncNoFile = (o) => !!o.sync && !o.file;
    +export const isAsyncNoFile = (o) => !o.sync && !o.file;
    +export const isSync = (o) => !!o.sync;
    +export const isAsync = (o) => !o.sync;
    +export const isFile = (o) => !!o.file;
    +export const isNoFile = (o) => !o.file;
    +const dealiasKey = (k) => {
    +    const d = argmap.get(k);
    +    if (d)
    +        return d;
    +    return k;
    +};
    +export const dealias = (opt = {}) => {
    +    if (!opt)
    +        return {};
    +    const result = {};
    +    for (const [key, v] of Object.entries(opt)) {
    +        // TS doesn't know that aliases are going to always be the same type
    +        const k = dealiasKey(key);
    +        result[k] = v;
    +    }
    +    // affordance for deprecated noChmod -> chmod
    +    if (result.chmod === undefined && result.noChmod === false) {
    +        result.chmod = true;
    +    }
    +    delete result.noChmod;
    +    return result;
    +};
    +//# sourceMappingURL=options.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/pack.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/pack.js
    new file mode 100644
    index 00000000..f59f32f9
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/pack.js
    @@ -0,0 +1,445 @@
    +// A readable tar stream creator
    +// Technically, this is a transform stream that you write paths into,
    +// and tar format comes out of.
    +// The `add()` method is like `write()` but returns this,
    +// and end() return `this` as well, so you can
    +// do `new Pack(opt).add('files').add('dir').end().pipe(output)
    +// You could also do something like:
    +// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))
    +import fs from 'fs';
    +import { WriteEntry, WriteEntrySync, WriteEntryTar, } from './write-entry.js';
    +export class PackJob {
    +    path;
    +    absolute;
    +    entry;
    +    stat;
    +    readdir;
    +    pending = false;
    +    ignore = false;
    +    piped = false;
    +    constructor(path, absolute) {
    +        this.path = path || './';
    +        this.absolute = absolute;
    +    }
    +}
    +import { Minipass } from 'minipass';
    +import * as zlib from 'minizlib';
    +import { Yallist } from 'yallist';
    +import { ReadEntry } from './read-entry.js';
    +import { warnMethod, } from './warn-method.js';
    +const EOF = Buffer.alloc(1024);
    +const ONSTAT = Symbol('onStat');
    +const ENDED = Symbol('ended');
    +const QUEUE = Symbol('queue');
    +const CURRENT = Symbol('current');
    +const PROCESS = Symbol('process');
    +const PROCESSING = Symbol('processing');
    +const PROCESSJOB = Symbol('processJob');
    +const JOBS = Symbol('jobs');
    +const JOBDONE = Symbol('jobDone');
    +const ADDFSENTRY = Symbol('addFSEntry');
    +const ADDTARENTRY = Symbol('addTarEntry');
    +const STAT = Symbol('stat');
    +const READDIR = Symbol('readdir');
    +const ONREADDIR = Symbol('onreaddir');
    +const PIPE = Symbol('pipe');
    +const ENTRY = Symbol('entry');
    +const ENTRYOPT = Symbol('entryOpt');
    +const WRITEENTRYCLASS = Symbol('writeEntryClass');
    +const WRITE = Symbol('write');
    +const ONDRAIN = Symbol('ondrain');
    +import path from 'path';
    +import { normalizeWindowsPath } from './normalize-windows-path.js';
    +export class Pack extends Minipass {
    +    opt;
    +    cwd;
    +    maxReadSize;
    +    preservePaths;
    +    strict;
    +    noPax;
    +    prefix;
    +    linkCache;
    +    statCache;
    +    file;
    +    portable;
    +    zip;
    +    readdirCache;
    +    noDirRecurse;
    +    follow;
    +    noMtime;
    +    mtime;
    +    filter;
    +    jobs;
    +    [WRITEENTRYCLASS];
    +    onWriteEntry;
    +    [QUEUE];
    +    [JOBS] = 0;
    +    [PROCESSING] = false;
    +    [ENDED] = false;
    +    constructor(opt = {}) {
    +        //@ts-ignore
    +        super();
    +        this.opt = opt;
    +        this.file = opt.file || '';
    +        this.cwd = opt.cwd || process.cwd();
    +        this.maxReadSize = opt.maxReadSize;
    +        this.preservePaths = !!opt.preservePaths;
    +        this.strict = !!opt.strict;
    +        this.noPax = !!opt.noPax;
    +        this.prefix = normalizeWindowsPath(opt.prefix || '');
    +        this.linkCache = opt.linkCache || new Map();
    +        this.statCache = opt.statCache || new Map();
    +        this.readdirCache = opt.readdirCache || new Map();
    +        this.onWriteEntry = opt.onWriteEntry;
    +        this[WRITEENTRYCLASS] = WriteEntry;
    +        if (typeof opt.onwarn === 'function') {
    +            this.on('warn', opt.onwarn);
    +        }
    +        this.portable = !!opt.portable;
    +        if (opt.gzip || opt.brotli) {
    +            if (opt.gzip && opt.brotli) {
    +                throw new TypeError('gzip and brotli are mutually exclusive');
    +            }
    +            if (opt.gzip) {
    +                if (typeof opt.gzip !== 'object') {
    +                    opt.gzip = {};
    +                }
    +                if (this.portable) {
    +                    opt.gzip.portable = true;
    +                }
    +                this.zip = new zlib.Gzip(opt.gzip);
    +            }
    +            if (opt.brotli) {
    +                if (typeof opt.brotli !== 'object') {
    +                    opt.brotli = {};
    +                }
    +                this.zip = new zlib.BrotliCompress(opt.brotli);
    +            }
    +            /* c8 ignore next */
    +            if (!this.zip)
    +                throw new Error('impossible');
    +            const zip = this.zip;
    +            zip.on('data', chunk => super.write(chunk));
    +            zip.on('end', () => super.end());
    +            zip.on('drain', () => this[ONDRAIN]());
    +            this.on('resume', () => zip.resume());
    +        }
    +        else {
    +            this.on('drain', this[ONDRAIN]);
    +        }
    +        this.noDirRecurse = !!opt.noDirRecurse;
    +        this.follow = !!opt.follow;
    +        this.noMtime = !!opt.noMtime;
    +        if (opt.mtime)
    +            this.mtime = opt.mtime;
    +        this.filter =
    +            typeof opt.filter === 'function' ? opt.filter : () => true;
    +        this[QUEUE] = new Yallist();
    +        this[JOBS] = 0;
    +        this.jobs = Number(opt.jobs) || 4;
    +        this[PROCESSING] = false;
    +        this[ENDED] = false;
    +    }
    +    [WRITE](chunk) {
    +        return super.write(chunk);
    +    }
    +    add(path) {
    +        this.write(path);
    +        return this;
    +    }
    +    end(path, encoding, cb) {
    +        /* c8 ignore start */
    +        if (typeof path === 'function') {
    +            cb = path;
    +            path = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        /* c8 ignore stop */
    +        if (path) {
    +            this.add(path);
    +        }
    +        this[ENDED] = true;
    +        this[PROCESS]();
    +        /* c8 ignore next */
    +        if (cb)
    +            cb();
    +        return this;
    +    }
    +    write(path) {
    +        if (this[ENDED]) {
    +            throw new Error('write after end');
    +        }
    +        if (path instanceof ReadEntry) {
    +            this[ADDTARENTRY](path);
    +        }
    +        else {
    +            this[ADDFSENTRY](path);
    +        }
    +        return this.flowing;
    +    }
    +    [ADDTARENTRY](p) {
    +        const absolute = normalizeWindowsPath(path.resolve(this.cwd, p.path));
    +        // in this case, we don't have to wait for the stat
    +        if (!this.filter(p.path, p)) {
    +            p.resume();
    +        }
    +        else {
    +            const job = new PackJob(p.path, absolute);
    +            job.entry = new WriteEntryTar(p, this[ENTRYOPT](job));
    +            job.entry.on('end', () => this[JOBDONE](job));
    +            this[JOBS] += 1;
    +            this[QUEUE].push(job);
    +        }
    +        this[PROCESS]();
    +    }
    +    [ADDFSENTRY](p) {
    +        const absolute = normalizeWindowsPath(path.resolve(this.cwd, p));
    +        this[QUEUE].push(new PackJob(p, absolute));
    +        this[PROCESS]();
    +    }
    +    [STAT](job) {
    +        job.pending = true;
    +        this[JOBS] += 1;
    +        const stat = this.follow ? 'stat' : 'lstat';
    +        fs[stat](job.absolute, (er, stat) => {
    +            job.pending = false;
    +            this[JOBS] -= 1;
    +            if (er) {
    +                this.emit('error', er);
    +            }
    +            else {
    +                this[ONSTAT](job, stat);
    +            }
    +        });
    +    }
    +    [ONSTAT](job, stat) {
    +        this.statCache.set(job.absolute, stat);
    +        job.stat = stat;
    +        // now we have the stat, we can filter it.
    +        if (!this.filter(job.path, stat)) {
    +            job.ignore = true;
    +        }
    +        this[PROCESS]();
    +    }
    +    [READDIR](job) {
    +        job.pending = true;
    +        this[JOBS] += 1;
    +        fs.readdir(job.absolute, (er, entries) => {
    +            job.pending = false;
    +            this[JOBS] -= 1;
    +            if (er) {
    +                return this.emit('error', er);
    +            }
    +            this[ONREADDIR](job, entries);
    +        });
    +    }
    +    [ONREADDIR](job, entries) {
    +        this.readdirCache.set(job.absolute, entries);
    +        job.readdir = entries;
    +        this[PROCESS]();
    +    }
    +    [PROCESS]() {
    +        if (this[PROCESSING]) {
    +            return;
    +        }
    +        this[PROCESSING] = true;
    +        for (let w = this[QUEUE].head; !!w && this[JOBS] < this.jobs; w = w.next) {
    +            this[PROCESSJOB](w.value);
    +            if (w.value.ignore) {
    +                const p = w.next;
    +                this[QUEUE].removeNode(w);
    +                w.next = p;
    +            }
    +        }
    +        this[PROCESSING] = false;
    +        if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) {
    +            if (this.zip) {
    +                this.zip.end(EOF);
    +            }
    +            else {
    +                super.write(EOF);
    +                super.end();
    +            }
    +        }
    +    }
    +    get [CURRENT]() {
    +        return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value;
    +    }
    +    [JOBDONE](_job) {
    +        this[QUEUE].shift();
    +        this[JOBS] -= 1;
    +        this[PROCESS]();
    +    }
    +    [PROCESSJOB](job) {
    +        if (job.pending) {
    +            return;
    +        }
    +        if (job.entry) {
    +            if (job === this[CURRENT] && !job.piped) {
    +                this[PIPE](job);
    +            }
    +            return;
    +        }
    +        if (!job.stat) {
    +            const sc = this.statCache.get(job.absolute);
    +            if (sc) {
    +                this[ONSTAT](job, sc);
    +            }
    +            else {
    +                this[STAT](job);
    +            }
    +        }
    +        if (!job.stat) {
    +            return;
    +        }
    +        // filtered out!
    +        if (job.ignore) {
    +            return;
    +        }
    +        if (!this.noDirRecurse &&
    +            job.stat.isDirectory() &&
    +            !job.readdir) {
    +            const rc = this.readdirCache.get(job.absolute);
    +            if (rc) {
    +                this[ONREADDIR](job, rc);
    +            }
    +            else {
    +                this[READDIR](job);
    +            }
    +            if (!job.readdir) {
    +                return;
    +            }
    +        }
    +        // we know it doesn't have an entry, because that got checked above
    +        job.entry = this[ENTRY](job);
    +        if (!job.entry) {
    +            job.ignore = true;
    +            return;
    +        }
    +        if (job === this[CURRENT] && !job.piped) {
    +            this[PIPE](job);
    +        }
    +    }
    +    [ENTRYOPT](job) {
    +        return {
    +            onwarn: (code, msg, data) => this.warn(code, msg, data),
    +            noPax: this.noPax,
    +            cwd: this.cwd,
    +            absolute: job.absolute,
    +            preservePaths: this.preservePaths,
    +            maxReadSize: this.maxReadSize,
    +            strict: this.strict,
    +            portable: this.portable,
    +            linkCache: this.linkCache,
    +            statCache: this.statCache,
    +            noMtime: this.noMtime,
    +            mtime: this.mtime,
    +            prefix: this.prefix,
    +            onWriteEntry: this.onWriteEntry,
    +        };
    +    }
    +    [ENTRY](job) {
    +        this[JOBS] += 1;
    +        try {
    +            const e = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job));
    +            return e
    +                .on('end', () => this[JOBDONE](job))
    +                .on('error', er => this.emit('error', er));
    +        }
    +        catch (er) {
    +            this.emit('error', er);
    +        }
    +    }
    +    [ONDRAIN]() {
    +        if (this[CURRENT] && this[CURRENT].entry) {
    +            this[CURRENT].entry.resume();
    +        }
    +    }
    +    // like .pipe() but using super, because our write() is special
    +    [PIPE](job) {
    +        job.piped = true;
    +        if (job.readdir) {
    +            job.readdir.forEach(entry => {
    +                const p = job.path;
    +                const base = p === './' ? '' : p.replace(/\/*$/, '/');
    +                this[ADDFSENTRY](base + entry);
    +            });
    +        }
    +        const source = job.entry;
    +        const zip = this.zip;
    +        /* c8 ignore start */
    +        if (!source)
    +            throw new Error('cannot pipe without source');
    +        /* c8 ignore stop */
    +        if (zip) {
    +            source.on('data', chunk => {
    +                if (!zip.write(chunk)) {
    +                    source.pause();
    +                }
    +            });
    +        }
    +        else {
    +            source.on('data', chunk => {
    +                if (!super.write(chunk)) {
    +                    source.pause();
    +                }
    +            });
    +        }
    +    }
    +    pause() {
    +        if (this.zip) {
    +            this.zip.pause();
    +        }
    +        return super.pause();
    +    }
    +    warn(code, message, data = {}) {
    +        warnMethod(this, code, message, data);
    +    }
    +}
    +export class PackSync extends Pack {
    +    sync = true;
    +    constructor(opt) {
    +        super(opt);
    +        this[WRITEENTRYCLASS] = WriteEntrySync;
    +    }
    +    // pause/resume are no-ops in sync streams.
    +    pause() { }
    +    resume() { }
    +    [STAT](job) {
    +        const stat = this.follow ? 'statSync' : 'lstatSync';
    +        this[ONSTAT](job, fs[stat](job.absolute));
    +    }
    +    [READDIR](job) {
    +        this[ONREADDIR](job, fs.readdirSync(job.absolute));
    +    }
    +    // gotta get it all in this tick
    +    [PIPE](job) {
    +        const source = job.entry;
    +        const zip = this.zip;
    +        if (job.readdir) {
    +            job.readdir.forEach(entry => {
    +                const p = job.path;
    +                const base = p === './' ? '' : p.replace(/\/*$/, '/');
    +                this[ADDFSENTRY](base + entry);
    +            });
    +        }
    +        /* c8 ignore start */
    +        if (!source)
    +            throw new Error('Cannot pipe without source');
    +        /* c8 ignore stop */
    +        if (zip) {
    +            source.on('data', chunk => {
    +                zip.write(chunk);
    +            });
    +        }
    +        else {
    +            source.on('data', chunk => {
    +                super[WRITE](chunk);
    +            });
    +        }
    +    }
    +}
    +//# sourceMappingURL=pack.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/parse.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/parse.js
    new file mode 100644
    index 00000000..cce43047
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/parse.js
    @@ -0,0 +1,595 @@
    +// this[BUFFER] is the remainder of a chunk if we're waiting for
    +// the full 512 bytes of a header to come in.  We will Buffer.concat()
    +// it to the next write(), which is a mem copy, but a small one.
    +//
    +// this[QUEUE] is a Yallist of entries that haven't been emitted
    +// yet this can only get filled up if the user keeps write()ing after
    +// a write() returns false, or does a write() with more than one entry
    +//
    +// We don't buffer chunks, we always parse them and either create an
    +// entry, or push it into the active entry.  The ReadEntry class knows
    +// to throw data away if .ignore=true
    +//
    +// Shift entry off the buffer when it emits 'end', and emit 'entry' for
    +// the next one in the list.
    +//
    +// At any time, we're pushing body chunks into the entry at WRITEENTRY,
    +// and waiting for 'end' on the entry at READENTRY
    +//
    +// ignored entries get .resume() called on them straight away
    +import { EventEmitter as EE } from 'events';
    +import { BrotliDecompress, Unzip } from 'minizlib';
    +import { Yallist } from 'yallist';
    +import { Header } from './header.js';
    +import { Pax } from './pax.js';
    +import { ReadEntry } from './read-entry.js';
    +import { warnMethod, } from './warn-method.js';
    +const maxMetaEntrySize = 1024 * 1024;
    +const gzipHeader = Buffer.from([0x1f, 0x8b]);
    +const STATE = Symbol('state');
    +const WRITEENTRY = Symbol('writeEntry');
    +const READENTRY = Symbol('readEntry');
    +const NEXTENTRY = Symbol('nextEntry');
    +const PROCESSENTRY = Symbol('processEntry');
    +const EX = Symbol('extendedHeader');
    +const GEX = Symbol('globalExtendedHeader');
    +const META = Symbol('meta');
    +const EMITMETA = Symbol('emitMeta');
    +const BUFFER = Symbol('buffer');
    +const QUEUE = Symbol('queue');
    +const ENDED = Symbol('ended');
    +const EMITTEDEND = Symbol('emittedEnd');
    +const EMIT = Symbol('emit');
    +const UNZIP = Symbol('unzip');
    +const CONSUMECHUNK = Symbol('consumeChunk');
    +const CONSUMECHUNKSUB = Symbol('consumeChunkSub');
    +const CONSUMEBODY = Symbol('consumeBody');
    +const CONSUMEMETA = Symbol('consumeMeta');
    +const CONSUMEHEADER = Symbol('consumeHeader');
    +const CONSUMING = Symbol('consuming');
    +const BUFFERCONCAT = Symbol('bufferConcat');
    +const MAYBEEND = Symbol('maybeEnd');
    +const WRITING = Symbol('writing');
    +const ABORTED = Symbol('aborted');
    +const DONE = Symbol('onDone');
    +const SAW_VALID_ENTRY = Symbol('sawValidEntry');
    +const SAW_NULL_BLOCK = Symbol('sawNullBlock');
    +const SAW_EOF = Symbol('sawEOF');
    +const CLOSESTREAM = Symbol('closeStream');
    +const noop = () => true;
    +export class Parser extends EE {
    +    file;
    +    strict;
    +    maxMetaEntrySize;
    +    filter;
    +    brotli;
    +    writable = true;
    +    readable = false;
    +    [QUEUE] = new Yallist();
    +    [BUFFER];
    +    [READENTRY];
    +    [WRITEENTRY];
    +    [STATE] = 'begin';
    +    [META] = '';
    +    [EX];
    +    [GEX];
    +    [ENDED] = false;
    +    [UNZIP];
    +    [ABORTED] = false;
    +    [SAW_VALID_ENTRY];
    +    [SAW_NULL_BLOCK] = false;
    +    [SAW_EOF] = false;
    +    [WRITING] = false;
    +    [CONSUMING] = false;
    +    [EMITTEDEND] = false;
    +    constructor(opt = {}) {
    +        super();
    +        this.file = opt.file || '';
    +        // these BADARCHIVE errors can't be detected early. listen on DONE.
    +        this.on(DONE, () => {
    +            if (this[STATE] === 'begin' ||
    +                this[SAW_VALID_ENTRY] === false) {
    +                // either less than 1 block of data, or all entries were invalid.
    +                // Either way, probably not even a tarball.
    +                this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format');
    +            }
    +        });
    +        if (opt.ondone) {
    +            this.on(DONE, opt.ondone);
    +        }
    +        else {
    +            this.on(DONE, () => {
    +                this.emit('prefinish');
    +                this.emit('finish');
    +                this.emit('end');
    +            });
    +        }
    +        this.strict = !!opt.strict;
    +        this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize;
    +        this.filter = typeof opt.filter === 'function' ? opt.filter : noop;
    +        // Unlike gzip, brotli doesn't have any magic bytes to identify it
    +        // Users need to explicitly tell us they're extracting a brotli file
    +        // Or we infer from the file extension
    +        const isTBR = opt.file &&
    +            (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr'));
    +        // if it's a tbr file it MIGHT be brotli, but we don't know until
    +        // we look at it and verify it's not a valid tar file.
    +        this.brotli =
    +            !opt.gzip && opt.brotli !== undefined ? opt.brotli
    +                : isTBR ? undefined
    +                    : false;
    +        // have to set this so that streams are ok piping into it
    +        this.on('end', () => this[CLOSESTREAM]());
    +        if (typeof opt.onwarn === 'function') {
    +            this.on('warn', opt.onwarn);
    +        }
    +        if (typeof opt.onReadEntry === 'function') {
    +            this.on('entry', opt.onReadEntry);
    +        }
    +    }
    +    warn(code, message, data = {}) {
    +        warnMethod(this, code, message, data);
    +    }
    +    [CONSUMEHEADER](chunk, position) {
    +        if (this[SAW_VALID_ENTRY] === undefined) {
    +            this[SAW_VALID_ENTRY] = false;
    +        }
    +        let header;
    +        try {
    +            header = new Header(chunk, position, this[EX], this[GEX]);
    +        }
    +        catch (er) {
    +            return this.warn('TAR_ENTRY_INVALID', er);
    +        }
    +        if (header.nullBlock) {
    +            if (this[SAW_NULL_BLOCK]) {
    +                this[SAW_EOF] = true;
    +                // ending an archive with no entries.  pointless, but legal.
    +                if (this[STATE] === 'begin') {
    +                    this[STATE] = 'header';
    +                }
    +                this[EMIT]('eof');
    +            }
    +            else {
    +                this[SAW_NULL_BLOCK] = true;
    +                this[EMIT]('nullBlock');
    +            }
    +        }
    +        else {
    +            this[SAW_NULL_BLOCK] = false;
    +            if (!header.cksumValid) {
    +                this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header });
    +            }
    +            else if (!header.path) {
    +                this.warn('TAR_ENTRY_INVALID', 'path is required', { header });
    +            }
    +            else {
    +                const type = header.type;
    +                if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) {
    +                    this.warn('TAR_ENTRY_INVALID', 'linkpath required', {
    +                        header,
    +                    });
    +                }
    +                else if (!/^(Symbolic)?Link$/.test(type) &&
    +                    !/^(Global)?ExtendedHeader$/.test(type) &&
    +                    header.linkpath) {
    +                    this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', {
    +                        header,
    +                    });
    +                }
    +                else {
    +                    const entry = (this[WRITEENTRY] = new ReadEntry(header, this[EX], this[GEX]));
    +                    // we do this for meta & ignored entries as well, because they
    +                    // are still valid tar, or else we wouldn't know to ignore them
    +                    if (!this[SAW_VALID_ENTRY]) {
    +                        if (entry.remain) {
    +                            // this might be the one!
    +                            const onend = () => {
    +                                if (!entry.invalid) {
    +                                    this[SAW_VALID_ENTRY] = true;
    +                                }
    +                            };
    +                            entry.on('end', onend);
    +                        }
    +                        else {
    +                            this[SAW_VALID_ENTRY] = true;
    +                        }
    +                    }
    +                    if (entry.meta) {
    +                        if (entry.size > this.maxMetaEntrySize) {
    +                            entry.ignore = true;
    +                            this[EMIT]('ignoredEntry', entry);
    +                            this[STATE] = 'ignore';
    +                            entry.resume();
    +                        }
    +                        else if (entry.size > 0) {
    +                            this[META] = '';
    +                            entry.on('data', c => (this[META] += c));
    +                            this[STATE] = 'meta';
    +                        }
    +                    }
    +                    else {
    +                        this[EX] = undefined;
    +                        entry.ignore =
    +                            entry.ignore || !this.filter(entry.path, entry);
    +                        if (entry.ignore) {
    +                            // probably valid, just not something we care about
    +                            this[EMIT]('ignoredEntry', entry);
    +                            this[STATE] = entry.remain ? 'ignore' : 'header';
    +                            entry.resume();
    +                        }
    +                        else {
    +                            if (entry.remain) {
    +                                this[STATE] = 'body';
    +                            }
    +                            else {
    +                                this[STATE] = 'header';
    +                                entry.end();
    +                            }
    +                            if (!this[READENTRY]) {
    +                                this[QUEUE].push(entry);
    +                                this[NEXTENTRY]();
    +                            }
    +                            else {
    +                                this[QUEUE].push(entry);
    +                            }
    +                        }
    +                    }
    +                }
    +            }
    +        }
    +    }
    +    [CLOSESTREAM]() {
    +        queueMicrotask(() => this.emit('close'));
    +    }
    +    [PROCESSENTRY](entry) {
    +        let go = true;
    +        if (!entry) {
    +            this[READENTRY] = undefined;
    +            go = false;
    +        }
    +        else if (Array.isArray(entry)) {
    +            const [ev, ...args] = entry;
    +            this.emit(ev, ...args);
    +        }
    +        else {
    +            this[READENTRY] = entry;
    +            this.emit('entry', entry);
    +            if (!entry.emittedEnd) {
    +                entry.on('end', () => this[NEXTENTRY]());
    +                go = false;
    +            }
    +        }
    +        return go;
    +    }
    +    [NEXTENTRY]() {
    +        do { } while (this[PROCESSENTRY](this[QUEUE].shift()));
    +        if (!this[QUEUE].length) {
    +            // At this point, there's nothing in the queue, but we may have an
    +            // entry which is being consumed (readEntry).
    +            // If we don't, then we definitely can handle more data.
    +            // If we do, and either it's flowing, or it has never had any data
    +            // written to it, then it needs more.
    +            // The only other possibility is that it has returned false from a
    +            // write() call, so we wait for the next drain to continue.
    +            const re = this[READENTRY];
    +            const drainNow = !re || re.flowing || re.size === re.remain;
    +            if (drainNow) {
    +                if (!this[WRITING]) {
    +                    this.emit('drain');
    +                }
    +            }
    +            else {
    +                re.once('drain', () => this.emit('drain'));
    +            }
    +        }
    +    }
    +    [CONSUMEBODY](chunk, position) {
    +        // write up to but no  more than writeEntry.blockRemain
    +        const entry = this[WRITEENTRY];
    +        /* c8 ignore start */
    +        if (!entry) {
    +            throw new Error('attempt to consume body without entry??');
    +        }
    +        const br = entry.blockRemain ?? 0;
    +        /* c8 ignore stop */
    +        const c = br >= chunk.length && position === 0 ?
    +            chunk
    +            : chunk.subarray(position, position + br);
    +        entry.write(c);
    +        if (!entry.blockRemain) {
    +            this[STATE] = 'header';
    +            this[WRITEENTRY] = undefined;
    +            entry.end();
    +        }
    +        return c.length;
    +    }
    +    [CONSUMEMETA](chunk, position) {
    +        const entry = this[WRITEENTRY];
    +        const ret = this[CONSUMEBODY](chunk, position);
    +        // if we finished, then the entry is reset
    +        if (!this[WRITEENTRY] && entry) {
    +            this[EMITMETA](entry);
    +        }
    +        return ret;
    +    }
    +    [EMIT](ev, data, extra) {
    +        if (!this[QUEUE].length && !this[READENTRY]) {
    +            this.emit(ev, data, extra);
    +        }
    +        else {
    +            this[QUEUE].push([ev, data, extra]);
    +        }
    +    }
    +    [EMITMETA](entry) {
    +        this[EMIT]('meta', this[META]);
    +        switch (entry.type) {
    +            case 'ExtendedHeader':
    +            case 'OldExtendedHeader':
    +                this[EX] = Pax.parse(this[META], this[EX], false);
    +                break;
    +            case 'GlobalExtendedHeader':
    +                this[GEX] = Pax.parse(this[META], this[GEX], true);
    +                break;
    +            case 'NextFileHasLongPath':
    +            case 'OldGnuLongPath': {
    +                const ex = this[EX] ?? Object.create(null);
    +                this[EX] = ex;
    +                ex.path = this[META].replace(/\0.*/, '');
    +                break;
    +            }
    +            case 'NextFileHasLongLinkpath': {
    +                const ex = this[EX] || Object.create(null);
    +                this[EX] = ex;
    +                ex.linkpath = this[META].replace(/\0.*/, '');
    +                break;
    +            }
    +            /* c8 ignore start */
    +            default:
    +                throw new Error('unknown meta: ' + entry.type);
    +            /* c8 ignore stop */
    +        }
    +    }
    +    abort(error) {
    +        this[ABORTED] = true;
    +        this.emit('abort', error);
    +        // always throws, even in non-strict mode
    +        this.warn('TAR_ABORT', error, { recoverable: false });
    +    }
    +    write(chunk, encoding, cb) {
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        if (typeof chunk === 'string') {
    +            chunk = Buffer.from(chunk, 
    +            /* c8 ignore next */
    +            typeof encoding === 'string' ? encoding : 'utf8');
    +        }
    +        if (this[ABORTED]) {
    +            /* c8 ignore next */
    +            cb?.();
    +            return false;
    +        }
    +        // first write, might be gzipped
    +        const needSniff = this[UNZIP] === undefined ||
    +            (this.brotli === undefined && this[UNZIP] === false);
    +        if (needSniff && chunk) {
    +            if (this[BUFFER]) {
    +                chunk = Buffer.concat([this[BUFFER], chunk]);
    +                this[BUFFER] = undefined;
    +            }
    +            if (chunk.length < gzipHeader.length) {
    +                this[BUFFER] = chunk;
    +                /* c8 ignore next */
    +                cb?.();
    +                return true;
    +            }
    +            // look for gzip header
    +            for (let i = 0; this[UNZIP] === undefined && i < gzipHeader.length; i++) {
    +                if (chunk[i] !== gzipHeader[i]) {
    +                    this[UNZIP] = false;
    +                }
    +            }
    +            const maybeBrotli = this.brotli === undefined;
    +            if (this[UNZIP] === false && maybeBrotli) {
    +                // read the first header to see if it's a valid tar file. If so,
    +                // we can safely assume that it's not actually brotli, despite the
    +                // .tbr or .tar.br file extension.
    +                // if we ended before getting a full chunk, yes, def brotli
    +                if (chunk.length < 512) {
    +                    if (this[ENDED]) {
    +                        this.brotli = true;
    +                    }
    +                    else {
    +                        this[BUFFER] = chunk;
    +                        /* c8 ignore next */
    +                        cb?.();
    +                        return true;
    +                    }
    +                }
    +                else {
    +                    // if it's tar, it's pretty reliably not brotli, chances of
    +                    // that happening are astronomical.
    +                    try {
    +                        new Header(chunk.subarray(0, 512));
    +                        this.brotli = false;
    +                    }
    +                    catch (_) {
    +                        this.brotli = true;
    +                    }
    +                }
    +            }
    +            if (this[UNZIP] === undefined ||
    +                (this[UNZIP] === false && this.brotli)) {
    +                const ended = this[ENDED];
    +                this[ENDED] = false;
    +                this[UNZIP] =
    +                    this[UNZIP] === undefined ?
    +                        new Unzip({})
    +                        : new BrotliDecompress({});
    +                this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk));
    +                this[UNZIP].on('error', er => this.abort(er));
    +                this[UNZIP].on('end', () => {
    +                    this[ENDED] = true;
    +                    this[CONSUMECHUNK]();
    +                });
    +                this[WRITING] = true;
    +                const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk);
    +                this[WRITING] = false;
    +                cb?.();
    +                return ret;
    +            }
    +        }
    +        this[WRITING] = true;
    +        if (this[UNZIP]) {
    +            this[UNZIP].write(chunk);
    +        }
    +        else {
    +            this[CONSUMECHUNK](chunk);
    +        }
    +        this[WRITING] = false;
    +        // return false if there's a queue, or if the current entry isn't flowing
    +        const ret = this[QUEUE].length ? false
    +            : this[READENTRY] ? this[READENTRY].flowing
    +                : true;
    +        // if we have no queue, then that means a clogged READENTRY
    +        if (!ret && !this[QUEUE].length) {
    +            this[READENTRY]?.once('drain', () => this.emit('drain'));
    +        }
    +        /* c8 ignore next */
    +        cb?.();
    +        return ret;
    +    }
    +    [BUFFERCONCAT](c) {
    +        if (c && !this[ABORTED]) {
    +            this[BUFFER] =
    +                this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c;
    +        }
    +    }
    +    [MAYBEEND]() {
    +        if (this[ENDED] &&
    +            !this[EMITTEDEND] &&
    +            !this[ABORTED] &&
    +            !this[CONSUMING]) {
    +            this[EMITTEDEND] = true;
    +            const entry = this[WRITEENTRY];
    +            if (entry && entry.blockRemain) {
    +                // truncated, likely a damaged file
    +                const have = this[BUFFER] ? this[BUFFER].length : 0;
    +                this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry });
    +                if (this[BUFFER]) {
    +                    entry.write(this[BUFFER]);
    +                }
    +                entry.end();
    +            }
    +            this[EMIT](DONE);
    +        }
    +    }
    +    [CONSUMECHUNK](chunk) {
    +        if (this[CONSUMING] && chunk) {
    +            this[BUFFERCONCAT](chunk);
    +        }
    +        else if (!chunk && !this[BUFFER]) {
    +            this[MAYBEEND]();
    +        }
    +        else if (chunk) {
    +            this[CONSUMING] = true;
    +            if (this[BUFFER]) {
    +                this[BUFFERCONCAT](chunk);
    +                const c = this[BUFFER];
    +                this[BUFFER] = undefined;
    +                this[CONSUMECHUNKSUB](c);
    +            }
    +            else {
    +                this[CONSUMECHUNKSUB](chunk);
    +            }
    +            while (this[BUFFER] &&
    +                this[BUFFER]?.length >= 512 &&
    +                !this[ABORTED] &&
    +                !this[SAW_EOF]) {
    +                const c = this[BUFFER];
    +                this[BUFFER] = undefined;
    +                this[CONSUMECHUNKSUB](c);
    +            }
    +            this[CONSUMING] = false;
    +        }
    +        if (!this[BUFFER] || this[ENDED]) {
    +            this[MAYBEEND]();
    +        }
    +    }
    +    [CONSUMECHUNKSUB](chunk) {
    +        // we know that we are in CONSUMING mode, so anything written goes into
    +        // the buffer.  Advance the position and put any remainder in the buffer.
    +        let position = 0;
    +        const length = chunk.length;
    +        while (position + 512 <= length &&
    +            !this[ABORTED] &&
    +            !this[SAW_EOF]) {
    +            switch (this[STATE]) {
    +                case 'begin':
    +                case 'header':
    +                    this[CONSUMEHEADER](chunk, position);
    +                    position += 512;
    +                    break;
    +                case 'ignore':
    +                case 'body':
    +                    position += this[CONSUMEBODY](chunk, position);
    +                    break;
    +                case 'meta':
    +                    position += this[CONSUMEMETA](chunk, position);
    +                    break;
    +                /* c8 ignore start */
    +                default:
    +                    throw new Error('invalid state: ' + this[STATE]);
    +                /* c8 ignore stop */
    +            }
    +        }
    +        if (position < length) {
    +            if (this[BUFFER]) {
    +                this[BUFFER] = Buffer.concat([
    +                    chunk.subarray(position),
    +                    this[BUFFER],
    +                ]);
    +            }
    +            else {
    +                this[BUFFER] = chunk.subarray(position);
    +            }
    +        }
    +    }
    +    end(chunk, encoding, cb) {
    +        if (typeof chunk === 'function') {
    +            cb = chunk;
    +            encoding = undefined;
    +            chunk = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        if (typeof chunk === 'string') {
    +            chunk = Buffer.from(chunk, encoding);
    +        }
    +        if (cb)
    +            this.once('finish', cb);
    +        if (!this[ABORTED]) {
    +            if (this[UNZIP]) {
    +                /* c8 ignore start */
    +                if (chunk)
    +                    this[UNZIP].write(chunk);
    +                /* c8 ignore stop */
    +                this[UNZIP].end();
    +            }
    +            else {
    +                this[ENDED] = true;
    +                if (this.brotli === undefined)
    +                    chunk = chunk || Buffer.alloc(0);
    +                if (chunk)
    +                    this.write(chunk);
    +                this[MAYBEEND]();
    +            }
    +        }
    +        return this;
    +    }
    +}
    +//# sourceMappingURL=parse.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/path-reservations.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/path-reservations.js
    new file mode 100644
    index 00000000..e63b9c91
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/path-reservations.js
    @@ -0,0 +1,166 @@
    +// A path exclusive reservation system
    +// reserve([list, of, paths], fn)
    +// When the fn is first in line for all its paths, it
    +// is called with a cb that clears the reservation.
    +//
    +// Used by async unpack to avoid clobbering paths in use,
    +// while still allowing maximal safe parallelization.
    +import { join } from 'node:path';
    +import { normalizeUnicode } from './normalize-unicode.js';
    +import { stripTrailingSlashes } from './strip-trailing-slashes.js';
    +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
    +const isWindows = platform === 'win32';
    +// return a set of parent dirs for a given path
    +// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d']
    +const getDirs = (path) => {
    +    const dirs = path
    +        .split('/')
    +        .slice(0, -1)
    +        .reduce((set, path) => {
    +        const s = set[set.length - 1];
    +        if (s !== undefined) {
    +            path = join(s, path);
    +        }
    +        set.push(path || '/');
    +        return set;
    +    }, []);
    +    return dirs;
    +};
    +export class PathReservations {
    +    // path => [function or Set]
    +    // A Set object means a directory reservation
    +    // A fn is a direct reservation on that path
    +    #queues = new Map();
    +    // fn => {paths:[path,...], dirs:[path, ...]}
    +    #reservations = new Map();
    +    // functions currently running
    +    #running = new Set();
    +    reserve(paths, fn) {
    +        paths =
    +            isWindows ?
    +                ['win32 parallelization disabled']
    +                : paths.map(p => {
    +                    // don't need normPath, because we skip this entirely for windows
    +                    return stripTrailingSlashes(join(normalizeUnicode(p))).toLowerCase();
    +                });
    +        const dirs = new Set(paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b)));
    +        this.#reservations.set(fn, { dirs, paths });
    +        for (const p of paths) {
    +            const q = this.#queues.get(p);
    +            if (!q) {
    +                this.#queues.set(p, [fn]);
    +            }
    +            else {
    +                q.push(fn);
    +            }
    +        }
    +        for (const dir of dirs) {
    +            const q = this.#queues.get(dir);
    +            if (!q) {
    +                this.#queues.set(dir, [new Set([fn])]);
    +            }
    +            else {
    +                const l = q[q.length - 1];
    +                if (l instanceof Set) {
    +                    l.add(fn);
    +                }
    +                else {
    +                    q.push(new Set([fn]));
    +                }
    +            }
    +        }
    +        return this.#run(fn);
    +    }
    +    // return the queues for each path the function cares about
    +    // fn => {paths, dirs}
    +    #getQueues(fn) {
    +        const res = this.#reservations.get(fn);
    +        /* c8 ignore start */
    +        if (!res) {
    +            throw new Error('function does not have any path reservations');
    +        }
    +        /* c8 ignore stop */
    +        return {
    +            paths: res.paths.map((path) => this.#queues.get(path)),
    +            dirs: [...res.dirs].map(path => this.#queues.get(path)),
    +        };
    +    }
    +    // check if fn is first in line for all its paths, and is
    +    // included in the first set for all its dir queues
    +    check(fn) {
    +        const { paths, dirs } = this.#getQueues(fn);
    +        return (paths.every(q => q && q[0] === fn) &&
    +            dirs.every(q => q && q[0] instanceof Set && q[0].has(fn)));
    +    }
    +    // run the function if it's first in line and not already running
    +    #run(fn) {
    +        if (this.#running.has(fn) || !this.check(fn)) {
    +            return false;
    +        }
    +        this.#running.add(fn);
    +        fn(() => this.#clear(fn));
    +        return true;
    +    }
    +    #clear(fn) {
    +        if (!this.#running.has(fn)) {
    +            return false;
    +        }
    +        const res = this.#reservations.get(fn);
    +        /* c8 ignore start */
    +        if (!res) {
    +            throw new Error('invalid reservation');
    +        }
    +        /* c8 ignore stop */
    +        const { paths, dirs } = res;
    +        const next = new Set();
    +        for (const path of paths) {
    +            const q = this.#queues.get(path);
    +            /* c8 ignore start */
    +            if (!q || q?.[0] !== fn) {
    +                continue;
    +            }
    +            /* c8 ignore stop */
    +            const q0 = q[1];
    +            if (!q0) {
    +                this.#queues.delete(path);
    +                continue;
    +            }
    +            q.shift();
    +            if (typeof q0 === 'function') {
    +                next.add(q0);
    +            }
    +            else {
    +                for (const f of q0) {
    +                    next.add(f);
    +                }
    +            }
    +        }
    +        for (const dir of dirs) {
    +            const q = this.#queues.get(dir);
    +            const q0 = q?.[0];
    +            /* c8 ignore next - type safety only */
    +            if (!q || !(q0 instanceof Set))
    +                continue;
    +            if (q0.size === 1 && q.length === 1) {
    +                this.#queues.delete(dir);
    +                continue;
    +            }
    +            else if (q0.size === 1) {
    +                q.shift();
    +                // next one must be a function,
    +                // or else the Set would've been reused
    +                const n = q[0];
    +                if (typeof n === 'function') {
    +                    next.add(n);
    +                }
    +            }
    +            else {
    +                q0.delete(fn);
    +            }
    +        }
    +        this.#running.delete(fn);
    +        next.forEach(fn => this.#run(fn));
    +        return true;
    +    }
    +}
    +//# sourceMappingURL=path-reservations.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/pax.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/pax.js
    new file mode 100644
    index 00000000..832808f3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/pax.js
    @@ -0,0 +1,154 @@
    +import { basename } from 'node:path';
    +import { Header } from './header.js';
    +export class Pax {
    +    atime;
    +    mtime;
    +    ctime;
    +    charset;
    +    comment;
    +    gid;
    +    uid;
    +    gname;
    +    uname;
    +    linkpath;
    +    dev;
    +    ino;
    +    nlink;
    +    path;
    +    size;
    +    mode;
    +    global;
    +    constructor(obj, global = false) {
    +        this.atime = obj.atime;
    +        this.charset = obj.charset;
    +        this.comment = obj.comment;
    +        this.ctime = obj.ctime;
    +        this.dev = obj.dev;
    +        this.gid = obj.gid;
    +        this.global = global;
    +        this.gname = obj.gname;
    +        this.ino = obj.ino;
    +        this.linkpath = obj.linkpath;
    +        this.mtime = obj.mtime;
    +        this.nlink = obj.nlink;
    +        this.path = obj.path;
    +        this.size = obj.size;
    +        this.uid = obj.uid;
    +        this.uname = obj.uname;
    +    }
    +    encode() {
    +        const body = this.encodeBody();
    +        if (body === '') {
    +            return Buffer.allocUnsafe(0);
    +        }
    +        const bodyLen = Buffer.byteLength(body);
    +        // round up to 512 bytes
    +        // add 512 for header
    +        const bufLen = 512 * Math.ceil(1 + bodyLen / 512);
    +        const buf = Buffer.allocUnsafe(bufLen);
    +        // 0-fill the header section, it might not hit every field
    +        for (let i = 0; i < 512; i++) {
    +            buf[i] = 0;
    +        }
    +        new Header({
    +            // XXX split the path
    +            // then the path should be PaxHeader + basename, but less than 99,
    +            // prepend with the dirname
    +            /* c8 ignore start */
    +            path: ('PaxHeader/' + basename(this.path ?? '')).slice(0, 99),
    +            /* c8 ignore stop */
    +            mode: this.mode || 0o644,
    +            uid: this.uid,
    +            gid: this.gid,
    +            size: bodyLen,
    +            mtime: this.mtime,
    +            type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',
    +            linkpath: '',
    +            uname: this.uname || '',
    +            gname: this.gname || '',
    +            devmaj: 0,
    +            devmin: 0,
    +            atime: this.atime,
    +            ctime: this.ctime,
    +        }).encode(buf);
    +        buf.write(body, 512, bodyLen, 'utf8');
    +        // null pad after the body
    +        for (let i = bodyLen + 512; i < buf.length; i++) {
    +            buf[i] = 0;
    +        }
    +        return buf;
    +    }
    +    encodeBody() {
    +        return (this.encodeField('path') +
    +            this.encodeField('ctime') +
    +            this.encodeField('atime') +
    +            this.encodeField('dev') +
    +            this.encodeField('ino') +
    +            this.encodeField('nlink') +
    +            this.encodeField('charset') +
    +            this.encodeField('comment') +
    +            this.encodeField('gid') +
    +            this.encodeField('gname') +
    +            this.encodeField('linkpath') +
    +            this.encodeField('mtime') +
    +            this.encodeField('size') +
    +            this.encodeField('uid') +
    +            this.encodeField('uname'));
    +    }
    +    encodeField(field) {
    +        if (this[field] === undefined) {
    +            return '';
    +        }
    +        const r = this[field];
    +        const v = r instanceof Date ? r.getTime() / 1000 : r;
    +        const s = ' ' +
    +            (field === 'dev' || field === 'ino' || field === 'nlink' ?
    +                'SCHILY.'
    +                : '') +
    +            field +
    +            '=' +
    +            v +
    +            '\n';
    +        const byteLen = Buffer.byteLength(s);
    +        // the digits includes the length of the digits in ascii base-10
    +        // so if it's 9 characters, then adding 1 for the 9 makes it 10
    +        // which makes it 11 chars.
    +        let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1;
    +        if (byteLen + digits >= Math.pow(10, digits)) {
    +            digits += 1;
    +        }
    +        const len = digits + byteLen;
    +        return len + s;
    +    }
    +    static parse(str, ex, g = false) {
    +        return new Pax(merge(parseKV(str), ex), g);
    +    }
    +}
    +const merge = (a, b) => b ? Object.assign({}, b, a) : a;
    +const parseKV = (str) => str
    +    .replace(/\n$/, '')
    +    .split('\n')
    +    .reduce(parseKVLine, Object.create(null));
    +const parseKVLine = (set, line) => {
    +    const n = parseInt(line, 10);
    +    // XXX Values with \n in them will fail this.
    +    // Refactor to not be a naive line-by-line parse.
    +    if (n !== Buffer.byteLength(line) + 1) {
    +        return set;
    +    }
    +    line = line.slice((n + ' ').length);
    +    const kv = line.split('=');
    +    const r = kv.shift();
    +    if (!r) {
    +        return set;
    +    }
    +    const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1');
    +    const v = kv.join('=');
    +    set[k] =
    +        /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ?
    +            new Date(Number(v) * 1000)
    +            : /^[0-9]+$/.test(v) ? +v
    +                : v;
    +    return set;
    +};
    +//# sourceMappingURL=pax.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/read-entry.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/read-entry.js
    new file mode 100644
    index 00000000..23cc673e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/read-entry.js
    @@ -0,0 +1,136 @@
    +import { Minipass } from 'minipass';
    +import { normalizeWindowsPath } from './normalize-windows-path.js';
    +export class ReadEntry extends Minipass {
    +    extended;
    +    globalExtended;
    +    header;
    +    startBlockSize;
    +    blockRemain;
    +    remain;
    +    type;
    +    meta = false;
    +    ignore = false;
    +    path;
    +    mode;
    +    uid;
    +    gid;
    +    uname;
    +    gname;
    +    size = 0;
    +    mtime;
    +    atime;
    +    ctime;
    +    linkpath;
    +    dev;
    +    ino;
    +    nlink;
    +    invalid = false;
    +    absolute;
    +    unsupported = false;
    +    constructor(header, ex, gex) {
    +        super({});
    +        // read entries always start life paused.  this is to avoid the
    +        // situation where Minipass's auto-ending empty streams results
    +        // in an entry ending before we're ready for it.
    +        this.pause();
    +        this.extended = ex;
    +        this.globalExtended = gex;
    +        this.header = header;
    +        /* c8 ignore start */
    +        this.remain = header.size ?? 0;
    +        /* c8 ignore stop */
    +        this.startBlockSize = 512 * Math.ceil(this.remain / 512);
    +        this.blockRemain = this.startBlockSize;
    +        this.type = header.type;
    +        switch (this.type) {
    +            case 'File':
    +            case 'OldFile':
    +            case 'Link':
    +            case 'SymbolicLink':
    +            case 'CharacterDevice':
    +            case 'BlockDevice':
    +            case 'Directory':
    +            case 'FIFO':
    +            case 'ContiguousFile':
    +            case 'GNUDumpDir':
    +                break;
    +            case 'NextFileHasLongLinkpath':
    +            case 'NextFileHasLongPath':
    +            case 'OldGnuLongPath':
    +            case 'GlobalExtendedHeader':
    +            case 'ExtendedHeader':
    +            case 'OldExtendedHeader':
    +                this.meta = true;
    +                break;
    +            // NOTE: gnutar and bsdtar treat unrecognized types as 'File'
    +            // it may be worth doing the same, but with a warning.
    +            default:
    +                this.ignore = true;
    +        }
    +        /* c8 ignore start */
    +        if (!header.path) {
    +            throw new Error('no path provided for tar.ReadEntry');
    +        }
    +        /* c8 ignore stop */
    +        this.path = normalizeWindowsPath(header.path);
    +        this.mode = header.mode;
    +        if (this.mode) {
    +            this.mode = this.mode & 0o7777;
    +        }
    +        this.uid = header.uid;
    +        this.gid = header.gid;
    +        this.uname = header.uname;
    +        this.gname = header.gname;
    +        this.size = this.remain;
    +        this.mtime = header.mtime;
    +        this.atime = header.atime;
    +        this.ctime = header.ctime;
    +        /* c8 ignore start */
    +        this.linkpath =
    +            header.linkpath ?
    +                normalizeWindowsPath(header.linkpath)
    +                : undefined;
    +        /* c8 ignore stop */
    +        this.uname = header.uname;
    +        this.gname = header.gname;
    +        if (ex) {
    +            this.#slurp(ex);
    +        }
    +        if (gex) {
    +            this.#slurp(gex, true);
    +        }
    +    }
    +    write(data) {
    +        const writeLen = data.length;
    +        if (writeLen > this.blockRemain) {
    +            throw new Error('writing more to entry than is appropriate');
    +        }
    +        const r = this.remain;
    +        const br = this.blockRemain;
    +        this.remain = Math.max(0, r - writeLen);
    +        this.blockRemain = Math.max(0, br - writeLen);
    +        if (this.ignore) {
    +            return true;
    +        }
    +        if (r >= writeLen) {
    +            return super.write(data);
    +        }
    +        // r < writeLen
    +        return super.write(data.subarray(0, r));
    +    }
    +    #slurp(ex, gex = false) {
    +        if (ex.path)
    +            ex.path = normalizeWindowsPath(ex.path);
    +        if (ex.linkpath)
    +            ex.linkpath = normalizeWindowsPath(ex.linkpath);
    +        Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
    +            // we slurp in everything except for the path attribute in
    +            // a global extended header, because that's weird. Also, any
    +            // null/undefined values are ignored.
    +            return !(v === null ||
    +                v === undefined ||
    +                (k === 'path' && gex));
    +        })));
    +    }
    +}
    +//# sourceMappingURL=read-entry.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/replace.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/replace.js
    new file mode 100644
    index 00000000..bab622bf
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/replace.js
    @@ -0,0 +1,225 @@
    +// tar -r
    +import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass';
    +import fs from 'node:fs';
    +import path from 'node:path';
    +import { Header } from './header.js';
    +import { list } from './list.js';
    +import { makeCommand } from './make-command.js';
    +import { isFile, } from './options.js';
    +import { Pack, PackSync } from './pack.js';
    +// starting at the head of the file, read a Header
    +// If the checksum is invalid, that's our position to start writing
    +// If it is, jump forward by the specified size (round up to 512)
    +// and try again.
    +// Write the new Pack stream starting there.
    +const replaceSync = (opt, files) => {
    +    const p = new PackSync(opt);
    +    let threw = true;
    +    let fd;
    +    let position;
    +    try {
    +        try {
    +            fd = fs.openSync(opt.file, 'r+');
    +        }
    +        catch (er) {
    +            if (er?.code === 'ENOENT') {
    +                fd = fs.openSync(opt.file, 'w+');
    +            }
    +            else {
    +                throw er;
    +            }
    +        }
    +        const st = fs.fstatSync(fd);
    +        const headBuf = Buffer.alloc(512);
    +        POSITION: for (position = 0; position < st.size; position += 512) {
    +            for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {
    +                bytes = fs.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos);
    +                if (position === 0 &&
    +                    headBuf[0] === 0x1f &&
    +                    headBuf[1] === 0x8b) {
    +                    throw new Error('cannot append to compressed archives');
    +                }
    +                if (!bytes) {
    +                    break POSITION;
    +                }
    +            }
    +            const h = new Header(headBuf);
    +            if (!h.cksumValid) {
    +                break;
    +            }
    +            const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512);
    +            if (position + entryBlockSize + 512 > st.size) {
    +                break;
    +            }
    +            // the 512 for the header we just parsed will be added as well
    +            // also jump ahead all the blocks for the body
    +            position += entryBlockSize;
    +            if (opt.mtimeCache && h.mtime) {
    +                opt.mtimeCache.set(String(h.path), h.mtime);
    +            }
    +        }
    +        threw = false;
    +        streamSync(opt, p, position, fd, files);
    +    }
    +    finally {
    +        if (threw) {
    +            try {
    +                fs.closeSync(fd);
    +            }
    +            catch (er) { }
    +        }
    +    }
    +};
    +const streamSync = (opt, p, position, fd, files) => {
    +    const stream = new WriteStreamSync(opt.file, {
    +        fd: fd,
    +        start: position,
    +    });
    +    p.pipe(stream);
    +    addFilesSync(p, files);
    +};
    +const replaceAsync = (opt, files) => {
    +    files = Array.from(files);
    +    const p = new Pack(opt);
    +    const getPos = (fd, size, cb_) => {
    +        const cb = (er, pos) => {
    +            if (er) {
    +                fs.close(fd, _ => cb_(er));
    +            }
    +            else {
    +                cb_(null, pos);
    +            }
    +        };
    +        let position = 0;
    +        if (size === 0) {
    +            return cb(null, 0);
    +        }
    +        let bufPos = 0;
    +        const headBuf = Buffer.alloc(512);
    +        const onread = (er, bytes) => {
    +            if (er || typeof bytes === 'undefined') {
    +                return cb(er);
    +            }
    +            bufPos += bytes;
    +            if (bufPos < 512 && bytes) {
    +                return fs.read(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos, onread);
    +            }
    +            if (position === 0 &&
    +                headBuf[0] === 0x1f &&
    +                headBuf[1] === 0x8b) {
    +                return cb(new Error('cannot append to compressed archives'));
    +            }
    +            // truncated header
    +            if (bufPos < 512) {
    +                return cb(null, position);
    +            }
    +            const h = new Header(headBuf);
    +            if (!h.cksumValid) {
    +                return cb(null, position);
    +            }
    +            /* c8 ignore next */
    +            const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512);
    +            if (position + entryBlockSize + 512 > size) {
    +                return cb(null, position);
    +            }
    +            position += entryBlockSize + 512;
    +            if (position >= size) {
    +                return cb(null, position);
    +            }
    +            if (opt.mtimeCache && h.mtime) {
    +                opt.mtimeCache.set(String(h.path), h.mtime);
    +            }
    +            bufPos = 0;
    +            fs.read(fd, headBuf, 0, 512, position, onread);
    +        };
    +        fs.read(fd, headBuf, 0, 512, position, onread);
    +    };
    +    const promise = new Promise((resolve, reject) => {
    +        p.on('error', reject);
    +        let flag = 'r+';
    +        const onopen = (er, fd) => {
    +            if (er && er.code === 'ENOENT' && flag === 'r+') {
    +                flag = 'w+';
    +                return fs.open(opt.file, flag, onopen);
    +            }
    +            if (er || !fd) {
    +                return reject(er);
    +            }
    +            fs.fstat(fd, (er, st) => {
    +                if (er) {
    +                    return fs.close(fd, () => reject(er));
    +                }
    +                getPos(fd, st.size, (er, position) => {
    +                    if (er) {
    +                        return reject(er);
    +                    }
    +                    const stream = new WriteStream(opt.file, {
    +                        fd: fd,
    +                        start: position,
    +                    });
    +                    p.pipe(stream);
    +                    stream.on('error', reject);
    +                    stream.on('close', resolve);
    +                    addFilesAsync(p, files);
    +                });
    +            });
    +        };
    +        fs.open(opt.file, flag, onopen);
    +    });
    +    return promise;
    +};
    +const addFilesSync = (p, files) => {
    +    files.forEach(file => {
    +        if (file.charAt(0) === '@') {
    +            list({
    +                file: path.resolve(p.cwd, file.slice(1)),
    +                sync: true,
    +                noResume: true,
    +                onReadEntry: entry => p.add(entry),
    +            });
    +        }
    +        else {
    +            p.add(file);
    +        }
    +    });
    +    p.end();
    +};
    +const addFilesAsync = async (p, files) => {
    +    for (let i = 0; i < files.length; i++) {
    +        const file = String(files[i]);
    +        if (file.charAt(0) === '@') {
    +            await list({
    +                file: path.resolve(String(p.cwd), file.slice(1)),
    +                noResume: true,
    +                onReadEntry: entry => p.add(entry),
    +            });
    +        }
    +        else {
    +            p.add(file);
    +        }
    +    }
    +    p.end();
    +};
    +export const replace = makeCommand(replaceSync, replaceAsync, 
    +/* c8 ignore start */
    +() => {
    +    throw new TypeError('file is required');
    +}, () => {
    +    throw new TypeError('file is required');
    +}, 
    +/* c8 ignore stop */
    +(opt, entries) => {
    +    if (!isFile(opt)) {
    +        throw new TypeError('file is required');
    +    }
    +    if (opt.gzip ||
    +        opt.brotli ||
    +        opt.file.endsWith('.br') ||
    +        opt.file.endsWith('.tbr')) {
    +        throw new TypeError('cannot append to compressed archives');
    +    }
    +    if (!entries?.length) {
    +        throw new TypeError('no paths specified to add/replace');
    +    }
    +});
    +//# sourceMappingURL=replace.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/strip-absolute-path.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/strip-absolute-path.js
    new file mode 100644
    index 00000000..cce5ff80
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/strip-absolute-path.js
    @@ -0,0 +1,25 @@
    +// unix absolute paths are also absolute on win32, so we use this for both
    +import { win32 } from 'node:path';
    +const { isAbsolute, parse } = win32;
    +// returns [root, stripped]
    +// Note that windows will think that //x/y/z/a has a "root" of //x/y, and in
    +// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip /
    +// explicitly if it's the first character.
    +// drive-specific relative paths on Windows get their root stripped off even
    +// though they are not absolute, so `c:../foo` becomes ['c:', '../foo']
    +export const stripAbsolutePath = (path) => {
    +    let r = '';
    +    let parsed = parse(path);
    +    while (isAbsolute(path) || parsed.root) {
    +        // windows will think that //x/y/z has a "root" of //x/y/
    +        // but strip the //?/C:/ off of //?/C:/path
    +        const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ?
    +            '/'
    +            : parsed.root;
    +        path = path.slice(root.length);
    +        r += root;
    +        parsed = parse(path);
    +    }
    +    return [r, path];
    +};
    +//# sourceMappingURL=strip-absolute-path.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/strip-trailing-slashes.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/strip-trailing-slashes.js
    new file mode 100644
    index 00000000..ace4218a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/strip-trailing-slashes.js
    @@ -0,0 +1,14 @@
    +// warning: extremely hot code path.
    +// This has been meticulously optimized for use
    +// within npm install on large package trees.
    +// Do not edit without careful benchmarking.
    +export const stripTrailingSlashes = (str) => {
    +    let i = str.length - 1;
    +    let slashesStart = -1;
    +    while (i > -1 && str.charAt(i) === '/') {
    +        slashesStart = i;
    +        i--;
    +    }
    +    return slashesStart === -1 ? str : str.slice(0, slashesStart);
    +};
    +//# sourceMappingURL=strip-trailing-slashes.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/symlink-error.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/symlink-error.js
    new file mode 100644
    index 00000000..d31766e2
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/symlink-error.js
    @@ -0,0 +1,15 @@
    +export class SymlinkError extends Error {
    +    path;
    +    symlink;
    +    syscall = 'symlink';
    +    code = 'TAR_SYMLINK_ERROR';
    +    constructor(symlink, path) {
    +        super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link');
    +        this.symlink = symlink;
    +        this.path = path;
    +    }
    +    get name() {
    +        return 'SymlinkError';
    +    }
    +}
    +//# sourceMappingURL=symlink-error.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/types.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/types.js
    new file mode 100644
    index 00000000..27b982ae
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/types.js
    @@ -0,0 +1,45 @@
    +export const isCode = (c) => name.has(c);
    +export const isName = (c) => code.has(c);
    +// map types from key to human-friendly name
    +export const name = new Map([
    +    ['0', 'File'],
    +    // same as File
    +    ['', 'OldFile'],
    +    ['1', 'Link'],
    +    ['2', 'SymbolicLink'],
    +    // Devices and FIFOs aren't fully supported
    +    // they are parsed, but skipped when unpacking
    +    ['3', 'CharacterDevice'],
    +    ['4', 'BlockDevice'],
    +    ['5', 'Directory'],
    +    ['6', 'FIFO'],
    +    // same as File
    +    ['7', 'ContiguousFile'],
    +    // pax headers
    +    ['g', 'GlobalExtendedHeader'],
    +    ['x', 'ExtendedHeader'],
    +    // vendor-specific stuff
    +    // skip
    +    ['A', 'SolarisACL'],
    +    // like 5, but with data, which should be skipped
    +    ['D', 'GNUDumpDir'],
    +    // metadata only, skip
    +    ['I', 'Inode'],
    +    // data = link path of next file
    +    ['K', 'NextFileHasLongLinkpath'],
    +    // data = path of next file
    +    ['L', 'NextFileHasLongPath'],
    +    // skip
    +    ['M', 'ContinuationFile'],
    +    // like L
    +    ['N', 'OldGnuLongPath'],
    +    // skip
    +    ['S', 'SparseFile'],
    +    // skip
    +    ['V', 'TapeVolumeHeader'],
    +    // like x
    +    ['X', 'OldExtendedHeader'],
    +]);
    +// map the other direction
    +export const code = new Map(Array.from(name).map(kv => [kv[1], kv[0]]));
    +//# sourceMappingURL=types.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/unpack.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/unpack.js
    new file mode 100644
    index 00000000..6e744cfc
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/unpack.js
    @@ -0,0 +1,888 @@
    +// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet.
    +// but the path reservations are required to avoid race conditions where
    +// parallelized unpack ops may mess with one another, due to dependencies
    +// (like a Link depending on its target) or destructive operations (like
    +// clobbering an fs object to create one of a different type.)
    +import * as fsm from '@isaacs/fs-minipass';
    +import assert from 'node:assert';
    +import { randomBytes } from 'node:crypto';
    +import fs from 'node:fs';
    +import path from 'node:path';
    +import { getWriteFlag } from './get-write-flag.js';
    +import { mkdir, mkdirSync } from './mkdir.js';
    +import { normalizeUnicode } from './normalize-unicode.js';
    +import { normalizeWindowsPath } from './normalize-windows-path.js';
    +import { Parser } from './parse.js';
    +import { stripAbsolutePath } from './strip-absolute-path.js';
    +import { stripTrailingSlashes } from './strip-trailing-slashes.js';
    +import * as wc from './winchars.js';
    +import { PathReservations } from './path-reservations.js';
    +const ONENTRY = Symbol('onEntry');
    +const CHECKFS = Symbol('checkFs');
    +const CHECKFS2 = Symbol('checkFs2');
    +const PRUNECACHE = Symbol('pruneCache');
    +const ISREUSABLE = Symbol('isReusable');
    +const MAKEFS = Symbol('makeFs');
    +const FILE = Symbol('file');
    +const DIRECTORY = Symbol('directory');
    +const LINK = Symbol('link');
    +const SYMLINK = Symbol('symlink');
    +const HARDLINK = Symbol('hardlink');
    +const UNSUPPORTED = Symbol('unsupported');
    +const CHECKPATH = Symbol('checkPath');
    +const MKDIR = Symbol('mkdir');
    +const ONERROR = Symbol('onError');
    +const PENDING = Symbol('pending');
    +const PEND = Symbol('pend');
    +const UNPEND = Symbol('unpend');
    +const ENDED = Symbol('ended');
    +const MAYBECLOSE = Symbol('maybeClose');
    +const SKIP = Symbol('skip');
    +const DOCHOWN = Symbol('doChown');
    +const UID = Symbol('uid');
    +const GID = Symbol('gid');
    +const CHECKED_CWD = Symbol('checkedCwd');
    +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
    +const isWindows = platform === 'win32';
    +const DEFAULT_MAX_DEPTH = 1024;
    +// Unlinks on Windows are not atomic.
    +//
    +// This means that if you have a file entry, followed by another
    +// file entry with an identical name, and you cannot re-use the file
    +// (because it's a hardlink, or because unlink:true is set, or it's
    +// Windows, which does not have useful nlink values), then the unlink
    +// will be committed to the disk AFTER the new file has been written
    +// over the old one, deleting the new file.
    +//
    +// To work around this, on Windows systems, we rename the file and then
    +// delete the renamed file.  It's a sloppy kludge, but frankly, I do not
    +// know of a better way to do this, given windows' non-atomic unlink
    +// semantics.
    +//
    +// See: https://github.com/npm/node-tar/issues/183
    +/* c8 ignore start */
    +const unlinkFile = (path, cb) => {
    +    if (!isWindows) {
    +        return fs.unlink(path, cb);
    +    }
    +    const name = path + '.DELETE.' + randomBytes(16).toString('hex');
    +    fs.rename(path, name, er => {
    +        if (er) {
    +            return cb(er);
    +        }
    +        fs.unlink(name, cb);
    +    });
    +};
    +/* c8 ignore stop */
    +/* c8 ignore start */
    +const unlinkFileSync = (path) => {
    +    if (!isWindows) {
    +        return fs.unlinkSync(path);
    +    }
    +    const name = path + '.DELETE.' + randomBytes(16).toString('hex');
    +    fs.renameSync(path, name);
    +    fs.unlinkSync(name);
    +};
    +/* c8 ignore stop */
    +// this.gid, entry.gid, this.processUid
    +const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a
    +    : b !== undefined && b === b >>> 0 ? b
    +        : c;
    +// clear the cache if it's a case-insensitive unicode-squashing match.
    +// we can't know if the current file system is case-sensitive or supports
    +// unicode fully, so we check for similarity on the maximally compatible
    +// representation.  Err on the side of pruning, since all it's doing is
    +// preventing lstats, and it's not the end of the world if we get a false
    +// positive.
    +// Note that on windows, we always drop the entire cache whenever a
    +// symbolic link is encountered, because 8.3 filenames are impossible
    +// to reason about, and collisions are hazards rather than just failures.
    +const cacheKeyNormalize = (path) => stripTrailingSlashes(normalizeWindowsPath(normalizeUnicode(path))).toLowerCase();
    +// remove all cache entries matching ${abs}/**
    +const pruneCache = (cache, abs) => {
    +    abs = cacheKeyNormalize(abs);
    +    for (const path of cache.keys()) {
    +        const pnorm = cacheKeyNormalize(path);
    +        if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) {
    +            cache.delete(path);
    +        }
    +    }
    +};
    +const dropCache = (cache) => {
    +    for (const key of cache.keys()) {
    +        cache.delete(key);
    +    }
    +};
    +export class Unpack extends Parser {
    +    [ENDED] = false;
    +    [CHECKED_CWD] = false;
    +    [PENDING] = 0;
    +    reservations = new PathReservations();
    +    transform;
    +    writable = true;
    +    readable = false;
    +    dirCache;
    +    uid;
    +    gid;
    +    setOwner;
    +    preserveOwner;
    +    processGid;
    +    processUid;
    +    maxDepth;
    +    forceChown;
    +    win32;
    +    newer;
    +    keep;
    +    noMtime;
    +    preservePaths;
    +    unlink;
    +    cwd;
    +    strip;
    +    processUmask;
    +    umask;
    +    dmode;
    +    fmode;
    +    chmod;
    +    constructor(opt = {}) {
    +        opt.ondone = () => {
    +            this[ENDED] = true;
    +            this[MAYBECLOSE]();
    +        };
    +        super(opt);
    +        this.transform = opt.transform;
    +        this.dirCache = opt.dirCache || new Map();
    +        this.chmod = !!opt.chmod;
    +        if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {
    +            // need both or neither
    +            if (typeof opt.uid !== 'number' ||
    +                typeof opt.gid !== 'number') {
    +                throw new TypeError('cannot set owner without number uid and gid');
    +            }
    +            if (opt.preserveOwner) {
    +                throw new TypeError('cannot preserve owner in archive and also set owner explicitly');
    +            }
    +            this.uid = opt.uid;
    +            this.gid = opt.gid;
    +            this.setOwner = true;
    +        }
    +        else {
    +            this.uid = undefined;
    +            this.gid = undefined;
    +            this.setOwner = false;
    +        }
    +        // default true for root
    +        if (opt.preserveOwner === undefined &&
    +            typeof opt.uid !== 'number') {
    +            this.preserveOwner = !!(process.getuid && process.getuid() === 0);
    +        }
    +        else {
    +            this.preserveOwner = !!opt.preserveOwner;
    +        }
    +        this.processUid =
    +            (this.preserveOwner || this.setOwner) && process.getuid ?
    +                process.getuid()
    +                : undefined;
    +        this.processGid =
    +            (this.preserveOwner || this.setOwner) && process.getgid ?
    +                process.getgid()
    +                : undefined;
    +        // prevent excessively deep nesting of subfolders
    +        // set to `Infinity` to remove this restriction
    +        this.maxDepth =
    +            typeof opt.maxDepth === 'number' ?
    +                opt.maxDepth
    +                : DEFAULT_MAX_DEPTH;
    +        // mostly just for testing, but useful in some cases.
    +        // Forcibly trigger a chown on every entry, no matter what
    +        this.forceChown = opt.forceChown === true;
    +        // turn > this[ONENTRY](entry));
    +    }
    +    // a bad or damaged archive is a warning for Parser, but an error
    +    // when extracting.  Mark those errors as unrecoverable, because
    +    // the Unpack contract cannot be met.
    +    warn(code, msg, data = {}) {
    +        if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') {
    +            data.recoverable = false;
    +        }
    +        return super.warn(code, msg, data);
    +    }
    +    [MAYBECLOSE]() {
    +        if (this[ENDED] && this[PENDING] === 0) {
    +            this.emit('prefinish');
    +            this.emit('finish');
    +            this.emit('end');
    +        }
    +    }
    +    [CHECKPATH](entry) {
    +        const p = normalizeWindowsPath(entry.path);
    +        const parts = p.split('/');
    +        if (this.strip) {
    +            if (parts.length < this.strip) {
    +                return false;
    +            }
    +            if (entry.type === 'Link') {
    +                const linkparts = normalizeWindowsPath(String(entry.linkpath)).split('/');
    +                if (linkparts.length >= this.strip) {
    +                    entry.linkpath = linkparts.slice(this.strip).join('/');
    +                }
    +                else {
    +                    return false;
    +                }
    +            }
    +            parts.splice(0, this.strip);
    +            entry.path = parts.join('/');
    +        }
    +        if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {
    +            this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {
    +                entry,
    +                path: p,
    +                depth: parts.length,
    +                maxDepth: this.maxDepth,
    +            });
    +            return false;
    +        }
    +        if (!this.preservePaths) {
    +            if (parts.includes('..') ||
    +                /* c8 ignore next */
    +                (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) {
    +                this.warn('TAR_ENTRY_ERROR', `path contains '..'`, {
    +                    entry,
    +                    path: p,
    +                });
    +                return false;
    +            }
    +            // strip off the root
    +            const [root, stripped] = stripAbsolutePath(p);
    +            if (root) {
    +                entry.path = String(stripped);
    +                this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, {
    +                    entry,
    +                    path: p,
    +                });
    +            }
    +        }
    +        if (path.isAbsolute(entry.path)) {
    +            entry.absolute = normalizeWindowsPath(path.resolve(entry.path));
    +        }
    +        else {
    +            entry.absolute = normalizeWindowsPath(path.resolve(this.cwd, entry.path));
    +        }
    +        // if we somehow ended up with a path that escapes the cwd, and we are
    +        // not in preservePaths mode, then something is fishy!  This should have
    +        // been prevented above, so ignore this for coverage.
    +        /* c8 ignore start - defense in depth */
    +        if (!this.preservePaths &&
    +            typeof entry.absolute === 'string' &&
    +            entry.absolute.indexOf(this.cwd + '/') !== 0 &&
    +            entry.absolute !== this.cwd) {
    +            this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {
    +                entry,
    +                path: normalizeWindowsPath(entry.path),
    +                resolvedPath: entry.absolute,
    +                cwd: this.cwd,
    +            });
    +            return false;
    +        }
    +        /* c8 ignore stop */
    +        // an archive can set properties on the extraction directory, but it
    +        // may not replace the cwd with a different kind of thing entirely.
    +        if (entry.absolute === this.cwd &&
    +            entry.type !== 'Directory' &&
    +            entry.type !== 'GNUDumpDir') {
    +            return false;
    +        }
    +        // only encode : chars that aren't drive letter indicators
    +        if (this.win32) {
    +            const { root: aRoot } = path.win32.parse(String(entry.absolute));
    +            entry.absolute =
    +                aRoot + wc.encode(String(entry.absolute).slice(aRoot.length));
    +            const { root: pRoot } = path.win32.parse(entry.path);
    +            entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length));
    +        }
    +        return true;
    +    }
    +    [ONENTRY](entry) {
    +        if (!this[CHECKPATH](entry)) {
    +            return entry.resume();
    +        }
    +        assert.equal(typeof entry.absolute, 'string');
    +        switch (entry.type) {
    +            case 'Directory':
    +            case 'GNUDumpDir':
    +                if (entry.mode) {
    +                    entry.mode = entry.mode | 0o700;
    +                }
    +            // eslint-disable-next-line no-fallthrough
    +            case 'File':
    +            case 'OldFile':
    +            case 'ContiguousFile':
    +            case 'Link':
    +            case 'SymbolicLink':
    +                return this[CHECKFS](entry);
    +            case 'CharacterDevice':
    +            case 'BlockDevice':
    +            case 'FIFO':
    +            default:
    +                return this[UNSUPPORTED](entry);
    +        }
    +    }
    +    [ONERROR](er, entry) {
    +        // Cwd has to exist, or else nothing works. That's serious.
    +        // Other errors are warnings, which raise the error in strict
    +        // mode, but otherwise continue on.
    +        if (er.name === 'CwdError') {
    +            this.emit('error', er);
    +        }
    +        else {
    +            this.warn('TAR_ENTRY_ERROR', er, { entry });
    +            this[UNPEND]();
    +            entry.resume();
    +        }
    +    }
    +    [MKDIR](dir, mode, cb) {
    +        mkdir(normalizeWindowsPath(dir), {
    +            uid: this.uid,
    +            gid: this.gid,
    +            processUid: this.processUid,
    +            processGid: this.processGid,
    +            umask: this.processUmask,
    +            preserve: this.preservePaths,
    +            unlink: this.unlink,
    +            cache: this.dirCache,
    +            cwd: this.cwd,
    +            mode: mode,
    +        }, cb);
    +    }
    +    [DOCHOWN](entry) {
    +        // in preserve owner mode, chown if the entry doesn't match process
    +        // in set owner mode, chown if setting doesn't match process
    +        return (this.forceChown ||
    +            (this.preserveOwner &&
    +                ((typeof entry.uid === 'number' &&
    +                    entry.uid !== this.processUid) ||
    +                    (typeof entry.gid === 'number' &&
    +                        entry.gid !== this.processGid))) ||
    +            (typeof this.uid === 'number' &&
    +                this.uid !== this.processUid) ||
    +            (typeof this.gid === 'number' && this.gid !== this.processGid));
    +    }
    +    [UID](entry) {
    +        return uint32(this.uid, entry.uid, this.processUid);
    +    }
    +    [GID](entry) {
    +        return uint32(this.gid, entry.gid, this.processGid);
    +    }
    +    [FILE](entry, fullyDone) {
    +        const mode = typeof entry.mode === 'number' ?
    +            entry.mode & 0o7777
    +            : this.fmode;
    +        const stream = new fsm.WriteStream(String(entry.absolute), {
    +            // slight lie, but it can be numeric flags
    +            flags: getWriteFlag(entry.size),
    +            mode: mode,
    +            autoClose: false,
    +        });
    +        stream.on('error', (er) => {
    +            if (stream.fd) {
    +                fs.close(stream.fd, () => { });
    +            }
    +            // flush all the data out so that we aren't left hanging
    +            // if the error wasn't actually fatal.  otherwise the parse
    +            // is blocked, and we never proceed.
    +            stream.write = () => true;
    +            this[ONERROR](er, entry);
    +            fullyDone();
    +        });
    +        let actions = 1;
    +        const done = (er) => {
    +            if (er) {
    +                /* c8 ignore start - we should always have a fd by now */
    +                if (stream.fd) {
    +                    fs.close(stream.fd, () => { });
    +                }
    +                /* c8 ignore stop */
    +                this[ONERROR](er, entry);
    +                fullyDone();
    +                return;
    +            }
    +            if (--actions === 0) {
    +                if (stream.fd !== undefined) {
    +                    fs.close(stream.fd, er => {
    +                        if (er) {
    +                            this[ONERROR](er, entry);
    +                        }
    +                        else {
    +                            this[UNPEND]();
    +                        }
    +                        fullyDone();
    +                    });
    +                }
    +            }
    +        };
    +        stream.on('finish', () => {
    +            // if futimes fails, try utimes
    +            // if utimes fails, fail with the original error
    +            // same for fchown/chown
    +            const abs = String(entry.absolute);
    +            const fd = stream.fd;
    +            if (typeof fd === 'number' && entry.mtime && !this.noMtime) {
    +                actions++;
    +                const atime = entry.atime || new Date();
    +                const mtime = entry.mtime;
    +                fs.futimes(fd, atime, mtime, er => er ?
    +                    fs.utimes(abs, atime, mtime, er2 => done(er2 && er))
    +                    : done());
    +            }
    +            if (typeof fd === 'number' && this[DOCHOWN](entry)) {
    +                actions++;
    +                const uid = this[UID](entry);
    +                const gid = this[GID](entry);
    +                if (typeof uid === 'number' && typeof gid === 'number') {
    +                    fs.fchown(fd, uid, gid, er => er ?
    +                        fs.chown(abs, uid, gid, er2 => done(er2 && er))
    +                        : done());
    +                }
    +            }
    +            done();
    +        });
    +        const tx = this.transform ? this.transform(entry) || entry : entry;
    +        if (tx !== entry) {
    +            tx.on('error', (er) => {
    +                this[ONERROR](er, entry);
    +                fullyDone();
    +            });
    +            entry.pipe(tx);
    +        }
    +        tx.pipe(stream);
    +    }
    +    [DIRECTORY](entry, fullyDone) {
    +        const mode = typeof entry.mode === 'number' ?
    +            entry.mode & 0o7777
    +            : this.dmode;
    +        this[MKDIR](String(entry.absolute), mode, er => {
    +            if (er) {
    +                this[ONERROR](er, entry);
    +                fullyDone();
    +                return;
    +            }
    +            let actions = 1;
    +            const done = () => {
    +                if (--actions === 0) {
    +                    fullyDone();
    +                    this[UNPEND]();
    +                    entry.resume();
    +                }
    +            };
    +            if (entry.mtime && !this.noMtime) {
    +                actions++;
    +                fs.utimes(String(entry.absolute), entry.atime || new Date(), entry.mtime, done);
    +            }
    +            if (this[DOCHOWN](entry)) {
    +                actions++;
    +                fs.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done);
    +            }
    +            done();
    +        });
    +    }
    +    [UNSUPPORTED](entry) {
    +        entry.unsupported = true;
    +        this.warn('TAR_ENTRY_UNSUPPORTED', `unsupported entry type: ${entry.type}`, { entry });
    +        entry.resume();
    +    }
    +    [SYMLINK](entry, done) {
    +        this[LINK](entry, String(entry.linkpath), 'symlink', done);
    +    }
    +    [HARDLINK](entry, done) {
    +        const linkpath = normalizeWindowsPath(path.resolve(this.cwd, String(entry.linkpath)));
    +        this[LINK](entry, linkpath, 'link', done);
    +    }
    +    [PEND]() {
    +        this[PENDING]++;
    +    }
    +    [UNPEND]() {
    +        this[PENDING]--;
    +        this[MAYBECLOSE]();
    +    }
    +    [SKIP](entry) {
    +        this[UNPEND]();
    +        entry.resume();
    +    }
    +    // Check if we can reuse an existing filesystem entry safely and
    +    // overwrite it, rather than unlinking and recreating
    +    // Windows doesn't report a useful nlink, so we just never reuse entries
    +    [ISREUSABLE](entry, st) {
    +        return (entry.type === 'File' &&
    +            !this.unlink &&
    +            st.isFile() &&
    +            st.nlink <= 1 &&
    +            !isWindows);
    +    }
    +    // check if a thing is there, and if so, try to clobber it
    +    [CHECKFS](entry) {
    +        this[PEND]();
    +        const paths = [entry.path];
    +        if (entry.linkpath) {
    +            paths.push(entry.linkpath);
    +        }
    +        this.reservations.reserve(paths, done => this[CHECKFS2](entry, done));
    +    }
    +    [PRUNECACHE](entry) {
    +        // if we are not creating a directory, and the path is in the dirCache,
    +        // then that means we are about to delete the directory we created
    +        // previously, and it is no longer going to be a directory, and neither
    +        // is any of its children.
    +        // If a symbolic link is encountered, all bets are off.  There is no
    +        // reasonable way to sanitize the cache in such a way we will be able to
    +        // avoid having filesystem collisions.  If this happens with a non-symlink
    +        // entry, it'll just fail to unpack, but a symlink to a directory, using an
    +        // 8.3 shortname or certain unicode attacks, can evade detection and lead
    +        // to arbitrary writes to anywhere on the system.
    +        if (entry.type === 'SymbolicLink') {
    +            dropCache(this.dirCache);
    +        }
    +        else if (entry.type !== 'Directory') {
    +            pruneCache(this.dirCache, String(entry.absolute));
    +        }
    +    }
    +    [CHECKFS2](entry, fullyDone) {
    +        this[PRUNECACHE](entry);
    +        const done = (er) => {
    +            this[PRUNECACHE](entry);
    +            fullyDone(er);
    +        };
    +        const checkCwd = () => {
    +            this[MKDIR](this.cwd, this.dmode, er => {
    +                if (er) {
    +                    this[ONERROR](er, entry);
    +                    done();
    +                    return;
    +                }
    +                this[CHECKED_CWD] = true;
    +                start();
    +            });
    +        };
    +        const start = () => {
    +            if (entry.absolute !== this.cwd) {
    +                const parent = normalizeWindowsPath(path.dirname(String(entry.absolute)));
    +                if (parent !== this.cwd) {
    +                    return this[MKDIR](parent, this.dmode, er => {
    +                        if (er) {
    +                            this[ONERROR](er, entry);
    +                            done();
    +                            return;
    +                        }
    +                        afterMakeParent();
    +                    });
    +                }
    +            }
    +            afterMakeParent();
    +        };
    +        const afterMakeParent = () => {
    +            fs.lstat(String(entry.absolute), (lstatEr, st) => {
    +                if (st &&
    +                    (this.keep ||
    +                        /* c8 ignore next */
    +                        (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) {
    +                    this[SKIP](entry);
    +                    done();
    +                    return;
    +                }
    +                if (lstatEr || this[ISREUSABLE](entry, st)) {
    +                    return this[MAKEFS](null, entry, done);
    +                }
    +                if (st.isDirectory()) {
    +                    if (entry.type === 'Directory') {
    +                        const needChmod = this.chmod &&
    +                            entry.mode &&
    +                            (st.mode & 0o7777) !== entry.mode;
    +                        const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done);
    +                        if (!needChmod) {
    +                            return afterChmod();
    +                        }
    +                        return fs.chmod(String(entry.absolute), Number(entry.mode), afterChmod);
    +                    }
    +                    // Not a dir entry, have to remove it.
    +                    // NB: the only way to end up with an entry that is the cwd
    +                    // itself, in such a way that == does not detect, is a
    +                    // tricky windows absolute path with UNC or 8.3 parts (and
    +                    // preservePaths:true, or else it will have been stripped).
    +                    // In that case, the user has opted out of path protections
    +                    // explicitly, so if they blow away the cwd, c'est la vie.
    +                    if (entry.absolute !== this.cwd) {
    +                        return fs.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done));
    +                    }
    +                }
    +                // not a dir, and not reusable
    +                // don't remove if the cwd, we want that error
    +                if (entry.absolute === this.cwd) {
    +                    return this[MAKEFS](null, entry, done);
    +                }
    +                unlinkFile(String(entry.absolute), er => this[MAKEFS](er ?? null, entry, done));
    +            });
    +        };
    +        if (this[CHECKED_CWD]) {
    +            start();
    +        }
    +        else {
    +            checkCwd();
    +        }
    +    }
    +    [MAKEFS](er, entry, done) {
    +        if (er) {
    +            this[ONERROR](er, entry);
    +            done();
    +            return;
    +        }
    +        switch (entry.type) {
    +            case 'File':
    +            case 'OldFile':
    +            case 'ContiguousFile':
    +                return this[FILE](entry, done);
    +            case 'Link':
    +                return this[HARDLINK](entry, done);
    +            case 'SymbolicLink':
    +                return this[SYMLINK](entry, done);
    +            case 'Directory':
    +            case 'GNUDumpDir':
    +                return this[DIRECTORY](entry, done);
    +        }
    +    }
    +    [LINK](entry, linkpath, link, done) {
    +        // XXX: get the type ('symlink' or 'junction') for windows
    +        fs[link](linkpath, String(entry.absolute), er => {
    +            if (er) {
    +                this[ONERROR](er, entry);
    +            }
    +            else {
    +                this[UNPEND]();
    +                entry.resume();
    +            }
    +            done();
    +        });
    +    }
    +}
    +const callSync = (fn) => {
    +    try {
    +        return [null, fn()];
    +    }
    +    catch (er) {
    +        return [er, null];
    +    }
    +};
    +export class UnpackSync extends Unpack {
    +    sync = true;
    +    [MAKEFS](er, entry) {
    +        return super[MAKEFS](er, entry, () => { });
    +    }
    +    [CHECKFS](entry) {
    +        this[PRUNECACHE](entry);
    +        if (!this[CHECKED_CWD]) {
    +            const er = this[MKDIR](this.cwd, this.dmode);
    +            if (er) {
    +                return this[ONERROR](er, entry);
    +            }
    +            this[CHECKED_CWD] = true;
    +        }
    +        // don't bother to make the parent if the current entry is the cwd,
    +        // we've already checked it.
    +        if (entry.absolute !== this.cwd) {
    +            const parent = normalizeWindowsPath(path.dirname(String(entry.absolute)));
    +            if (parent !== this.cwd) {
    +                const mkParent = this[MKDIR](parent, this.dmode);
    +                if (mkParent) {
    +                    return this[ONERROR](mkParent, entry);
    +                }
    +            }
    +        }
    +        const [lstatEr, st] = callSync(() => fs.lstatSync(String(entry.absolute)));
    +        if (st &&
    +            (this.keep ||
    +                /* c8 ignore next */
    +                (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) {
    +            return this[SKIP](entry);
    +        }
    +        if (lstatEr || this[ISREUSABLE](entry, st)) {
    +            return this[MAKEFS](null, entry);
    +        }
    +        if (st.isDirectory()) {
    +            if (entry.type === 'Directory') {
    +                const needChmod = this.chmod &&
    +                    entry.mode &&
    +                    (st.mode & 0o7777) !== entry.mode;
    +                const [er] = needChmod ?
    +                    callSync(() => {
    +                        fs.chmodSync(String(entry.absolute), Number(entry.mode));
    +                    })
    +                    : [];
    +                return this[MAKEFS](er, entry);
    +            }
    +            // not a dir entry, have to remove it
    +            const [er] = callSync(() => fs.rmdirSync(String(entry.absolute)));
    +            this[MAKEFS](er, entry);
    +        }
    +        // not a dir, and not reusable.
    +        // don't remove if it's the cwd, since we want that error.
    +        const [er] = entry.absolute === this.cwd ?
    +            []
    +            : callSync(() => unlinkFileSync(String(entry.absolute)));
    +        this[MAKEFS](er, entry);
    +    }
    +    [FILE](entry, done) {
    +        const mode = typeof entry.mode === 'number' ?
    +            entry.mode & 0o7777
    +            : this.fmode;
    +        const oner = (er) => {
    +            let closeError;
    +            try {
    +                fs.closeSync(fd);
    +            }
    +            catch (e) {
    +                closeError = e;
    +            }
    +            if (er || closeError) {
    +                this[ONERROR](er || closeError, entry);
    +            }
    +            done();
    +        };
    +        let fd;
    +        try {
    +            fd = fs.openSync(String(entry.absolute), getWriteFlag(entry.size), mode);
    +        }
    +        catch (er) {
    +            return oner(er);
    +        }
    +        const tx = this.transform ? this.transform(entry) || entry : entry;
    +        if (tx !== entry) {
    +            tx.on('error', (er) => this[ONERROR](er, entry));
    +            entry.pipe(tx);
    +        }
    +        tx.on('data', (chunk) => {
    +            try {
    +                fs.writeSync(fd, chunk, 0, chunk.length);
    +            }
    +            catch (er) {
    +                oner(er);
    +            }
    +        });
    +        tx.on('end', () => {
    +            let er = null;
    +            // try both, falling futimes back to utimes
    +            // if either fails, handle the first error
    +            if (entry.mtime && !this.noMtime) {
    +                const atime = entry.atime || new Date();
    +                const mtime = entry.mtime;
    +                try {
    +                    fs.futimesSync(fd, atime, mtime);
    +                }
    +                catch (futimeser) {
    +                    try {
    +                        fs.utimesSync(String(entry.absolute), atime, mtime);
    +                    }
    +                    catch (utimeser) {
    +                        er = futimeser;
    +                    }
    +                }
    +            }
    +            if (this[DOCHOWN](entry)) {
    +                const uid = this[UID](entry);
    +                const gid = this[GID](entry);
    +                try {
    +                    fs.fchownSync(fd, Number(uid), Number(gid));
    +                }
    +                catch (fchowner) {
    +                    try {
    +                        fs.chownSync(String(entry.absolute), Number(uid), Number(gid));
    +                    }
    +                    catch (chowner) {
    +                        er = er || fchowner;
    +                    }
    +                }
    +            }
    +            oner(er);
    +        });
    +    }
    +    [DIRECTORY](entry, done) {
    +        const mode = typeof entry.mode === 'number' ?
    +            entry.mode & 0o7777
    +            : this.dmode;
    +        const er = this[MKDIR](String(entry.absolute), mode);
    +        if (er) {
    +            this[ONERROR](er, entry);
    +            done();
    +            return;
    +        }
    +        if (entry.mtime && !this.noMtime) {
    +            try {
    +                fs.utimesSync(String(entry.absolute), entry.atime || new Date(), entry.mtime);
    +                /* c8 ignore next */
    +            }
    +            catch (er) { }
    +        }
    +        if (this[DOCHOWN](entry)) {
    +            try {
    +                fs.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)));
    +            }
    +            catch (er) { }
    +        }
    +        done();
    +        entry.resume();
    +    }
    +    [MKDIR](dir, mode) {
    +        try {
    +            return mkdirSync(normalizeWindowsPath(dir), {
    +                uid: this.uid,
    +                gid: this.gid,
    +                processUid: this.processUid,
    +                processGid: this.processGid,
    +                umask: this.processUmask,
    +                preserve: this.preservePaths,
    +                unlink: this.unlink,
    +                cache: this.dirCache,
    +                cwd: this.cwd,
    +                mode: mode,
    +            });
    +        }
    +        catch (er) {
    +            return er;
    +        }
    +    }
    +    [LINK](entry, linkpath, link, done) {
    +        const ls = `${link}Sync`;
    +        try {
    +            fs[ls](linkpath, String(entry.absolute));
    +            done();
    +            entry.resume();
    +        }
    +        catch (er) {
    +            return this[ONERROR](er, entry);
    +        }
    +    }
    +}
    +//# sourceMappingURL=unpack.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/update.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/update.js
    new file mode 100644
    index 00000000..21398e97
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/update.js
    @@ -0,0 +1,30 @@
    +// tar -u
    +import { makeCommand } from './make-command.js';
    +import { replace as r } from './replace.js';
    +// just call tar.r with the filter and mtimeCache
    +export const update = makeCommand(r.syncFile, r.asyncFile, r.syncNoFile, r.asyncNoFile, (opt, entries = []) => {
    +    r.validate?.(opt, entries);
    +    mtimeFilter(opt);
    +});
    +const mtimeFilter = (opt) => {
    +    const filter = opt.filter;
    +    if (!opt.mtimeCache) {
    +        opt.mtimeCache = new Map();
    +    }
    +    opt.filter =
    +        filter ?
    +            (path, stat) => filter(path, stat) &&
    +                !(
    +                /* c8 ignore start */
    +                ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >
    +                    (stat.mtime ?? 0))
    +                /* c8 ignore stop */
    +                )
    +            : (path, stat) => !(
    +            /* c8 ignore start */
    +            ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) >
    +                (stat.mtime ?? 0))
    +            /* c8 ignore stop */
    +            );
    +};
    +//# sourceMappingURL=update.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/warn-method.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/warn-method.js
    new file mode 100644
    index 00000000..13e798af
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/warn-method.js
    @@ -0,0 +1,27 @@
    +export const warnMethod = (self, code, message, data = {}) => {
    +    if (self.file) {
    +        data.file = self.file;
    +    }
    +    if (self.cwd) {
    +        data.cwd = self.cwd;
    +    }
    +    data.code =
    +        (message instanceof Error &&
    +            message.code) ||
    +            code;
    +    data.tarCode = code;
    +    if (!self.strict && data.recoverable !== false) {
    +        if (message instanceof Error) {
    +            data = Object.assign(message, data);
    +            message = message.message;
    +        }
    +        self.emit('warn', code, message, data);
    +    }
    +    else if (message instanceof Error) {
    +        self.emit('error', Object.assign(message, data));
    +    }
    +    else {
    +        self.emit('error', Object.assign(new Error(`${code}: ${message}`), data));
    +    }
    +};
    +//# sourceMappingURL=warn-method.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/winchars.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/winchars.js
    new file mode 100644
    index 00000000..c41eb86d
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/winchars.js
    @@ -0,0 +1,9 @@
    +// When writing files on Windows, translate the characters to their
    +// 0xf000 higher-encoded versions.
    +const raw = ['|', '<', '>', '?', ':'];
    +const win = raw.map(char => String.fromCharCode(0xf000 + char.charCodeAt(0)));
    +const toWin = new Map(raw.map((char, i) => [char, win[i]]));
    +const toRaw = new Map(win.map((char, i) => [char, raw[i]]));
    +export const encode = (s) => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s);
    +export const decode = (s) => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s);
    +//# sourceMappingURL=winchars.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/write-entry.js b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/write-entry.js
    new file mode 100644
    index 00000000..9028cd67
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/dist/esm/write-entry.js
    @@ -0,0 +1,657 @@
    +import fs from 'fs';
    +import { Minipass } from 'minipass';
    +import path from 'path';
    +import { Header } from './header.js';
    +import { modeFix } from './mode-fix.js';
    +import { normalizeWindowsPath } from './normalize-windows-path.js';
    +import { dealias, } from './options.js';
    +import { Pax } from './pax.js';
    +import { stripAbsolutePath } from './strip-absolute-path.js';
    +import { stripTrailingSlashes } from './strip-trailing-slashes.js';
    +import { warnMethod, } from './warn-method.js';
    +import * as winchars from './winchars.js';
    +const prefixPath = (path, prefix) => {
    +    if (!prefix) {
    +        return normalizeWindowsPath(path);
    +    }
    +    path = normalizeWindowsPath(path).replace(/^\.(\/|$)/, '');
    +    return stripTrailingSlashes(prefix) + '/' + path;
    +};
    +const maxReadSize = 16 * 1024 * 1024;
    +const PROCESS = Symbol('process');
    +const FILE = Symbol('file');
    +const DIRECTORY = Symbol('directory');
    +const SYMLINK = Symbol('symlink');
    +const HARDLINK = Symbol('hardlink');
    +const HEADER = Symbol('header');
    +const READ = Symbol('read');
    +const LSTAT = Symbol('lstat');
    +const ONLSTAT = Symbol('onlstat');
    +const ONREAD = Symbol('onread');
    +const ONREADLINK = Symbol('onreadlink');
    +const OPENFILE = Symbol('openfile');
    +const ONOPENFILE = Symbol('onopenfile');
    +const CLOSE = Symbol('close');
    +const MODE = Symbol('mode');
    +const AWAITDRAIN = Symbol('awaitDrain');
    +const ONDRAIN = Symbol('ondrain');
    +const PREFIX = Symbol('prefix');
    +export class WriteEntry extends Minipass {
    +    path;
    +    portable;
    +    myuid = (process.getuid && process.getuid()) || 0;
    +    // until node has builtin pwnam functions, this'll have to do
    +    myuser = process.env.USER || '';
    +    maxReadSize;
    +    linkCache;
    +    statCache;
    +    preservePaths;
    +    cwd;
    +    strict;
    +    mtime;
    +    noPax;
    +    noMtime;
    +    prefix;
    +    fd;
    +    blockLen = 0;
    +    blockRemain = 0;
    +    buf;
    +    pos = 0;
    +    remain = 0;
    +    length = 0;
    +    offset = 0;
    +    win32;
    +    absolute;
    +    header;
    +    type;
    +    linkpath;
    +    stat;
    +    onWriteEntry;
    +    #hadError = false;
    +    constructor(p, opt_ = {}) {
    +        const opt = dealias(opt_);
    +        super();
    +        this.path = normalizeWindowsPath(p);
    +        // suppress atime, ctime, uid, gid, uname, gname
    +        this.portable = !!opt.portable;
    +        this.maxReadSize = opt.maxReadSize || maxReadSize;
    +        this.linkCache = opt.linkCache || new Map();
    +        this.statCache = opt.statCache || new Map();
    +        this.preservePaths = !!opt.preservePaths;
    +        this.cwd = normalizeWindowsPath(opt.cwd || process.cwd());
    +        this.strict = !!opt.strict;
    +        this.noPax = !!opt.noPax;
    +        this.noMtime = !!opt.noMtime;
    +        this.mtime = opt.mtime;
    +        this.prefix =
    +            opt.prefix ? normalizeWindowsPath(opt.prefix) : undefined;
    +        this.onWriteEntry = opt.onWriteEntry;
    +        if (typeof opt.onwarn === 'function') {
    +            this.on('warn', opt.onwarn);
    +        }
    +        let pathWarn = false;
    +        if (!this.preservePaths) {
    +            const [root, stripped] = stripAbsolutePath(this.path);
    +            if (root && typeof stripped === 'string') {
    +                this.path = stripped;
    +                pathWarn = root;
    +            }
    +        }
    +        this.win32 = !!opt.win32 || process.platform === 'win32';
    +        if (this.win32) {
    +            // force the \ to / normalization, since we might not *actually*
    +            // be on windows, but want \ to be considered a path separator.
    +            this.path = winchars.decode(this.path.replace(/\\/g, '/'));
    +            p = p.replace(/\\/g, '/');
    +        }
    +        this.absolute = normalizeWindowsPath(opt.absolute || path.resolve(this.cwd, p));
    +        if (this.path === '') {
    +            this.path = './';
    +        }
    +        if (pathWarn) {
    +            this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {
    +                entry: this,
    +                path: pathWarn + this.path,
    +            });
    +        }
    +        const cs = this.statCache.get(this.absolute);
    +        if (cs) {
    +            this[ONLSTAT](cs);
    +        }
    +        else {
    +            this[LSTAT]();
    +        }
    +    }
    +    warn(code, message, data = {}) {
    +        return warnMethod(this, code, message, data);
    +    }
    +    emit(ev, ...data) {
    +        if (ev === 'error') {
    +            this.#hadError = true;
    +        }
    +        return super.emit(ev, ...data);
    +    }
    +    [LSTAT]() {
    +        fs.lstat(this.absolute, (er, stat) => {
    +            if (er) {
    +                return this.emit('error', er);
    +            }
    +            this[ONLSTAT](stat);
    +        });
    +    }
    +    [ONLSTAT](stat) {
    +        this.statCache.set(this.absolute, stat);
    +        this.stat = stat;
    +        if (!stat.isFile()) {
    +            stat.size = 0;
    +        }
    +        this.type = getType(stat);
    +        this.emit('stat', stat);
    +        this[PROCESS]();
    +    }
    +    [PROCESS]() {
    +        switch (this.type) {
    +            case 'File':
    +                return this[FILE]();
    +            case 'Directory':
    +                return this[DIRECTORY]();
    +            case 'SymbolicLink':
    +                return this[SYMLINK]();
    +            // unsupported types are ignored.
    +            default:
    +                return this.end();
    +        }
    +    }
    +    [MODE](mode) {
    +        return modeFix(mode, this.type === 'Directory', this.portable);
    +    }
    +    [PREFIX](path) {
    +        return prefixPath(path, this.prefix);
    +    }
    +    [HEADER]() {
    +        /* c8 ignore start */
    +        if (!this.stat) {
    +            throw new Error('cannot write header before stat');
    +        }
    +        /* c8 ignore stop */
    +        if (this.type === 'Directory' && this.portable) {
    +            this.noMtime = true;
    +        }
    +        this.onWriteEntry?.(this);
    +        this.header = new Header({
    +            path: this[PREFIX](this.path),
    +            // only apply the prefix to hard links.
    +            linkpath: this.type === 'Link' && this.linkpath !== undefined ?
    +                this[PREFIX](this.linkpath)
    +                : this.linkpath,
    +            // only the permissions and setuid/setgid/sticky bitflags
    +            // not the higher-order bits that specify file type
    +            mode: this[MODE](this.stat.mode),
    +            uid: this.portable ? undefined : this.stat.uid,
    +            gid: this.portable ? undefined : this.stat.gid,
    +            size: this.stat.size,
    +            mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime,
    +            /* c8 ignore next */
    +            type: this.type === 'Unsupported' ? undefined : this.type,
    +            uname: this.portable ? undefined
    +                : this.stat.uid === this.myuid ? this.myuser
    +                    : '',
    +            atime: this.portable ? undefined : this.stat.atime,
    +            ctime: this.portable ? undefined : this.stat.ctime,
    +        });
    +        if (this.header.encode() && !this.noPax) {
    +            super.write(new Pax({
    +                atime: this.portable ? undefined : this.header.atime,
    +                ctime: this.portable ? undefined : this.header.ctime,
    +                gid: this.portable ? undefined : this.header.gid,
    +                mtime: this.noMtime ? undefined : (this.mtime || this.header.mtime),
    +                path: this[PREFIX](this.path),
    +                linkpath: this.type === 'Link' && this.linkpath !== undefined ?
    +                    this[PREFIX](this.linkpath)
    +                    : this.linkpath,
    +                size: this.header.size,
    +                uid: this.portable ? undefined : this.header.uid,
    +                uname: this.portable ? undefined : this.header.uname,
    +                dev: this.portable ? undefined : this.stat.dev,
    +                ino: this.portable ? undefined : this.stat.ino,
    +                nlink: this.portable ? undefined : this.stat.nlink,
    +            }).encode());
    +        }
    +        const block = this.header?.block;
    +        /* c8 ignore start */
    +        if (!block) {
    +            throw new Error('failed to encode header');
    +        }
    +        /* c8 ignore stop */
    +        super.write(block);
    +    }
    +    [DIRECTORY]() {
    +        /* c8 ignore start */
    +        if (!this.stat) {
    +            throw new Error('cannot create directory entry without stat');
    +        }
    +        /* c8 ignore stop */
    +        if (this.path.slice(-1) !== '/') {
    +            this.path += '/';
    +        }
    +        this.stat.size = 0;
    +        this[HEADER]();
    +        this.end();
    +    }
    +    [SYMLINK]() {
    +        fs.readlink(this.absolute, (er, linkpath) => {
    +            if (er) {
    +                return this.emit('error', er);
    +            }
    +            this[ONREADLINK](linkpath);
    +        });
    +    }
    +    [ONREADLINK](linkpath) {
    +        this.linkpath = normalizeWindowsPath(linkpath);
    +        this[HEADER]();
    +        this.end();
    +    }
    +    [HARDLINK](linkpath) {
    +        /* c8 ignore start */
    +        if (!this.stat) {
    +            throw new Error('cannot create link entry without stat');
    +        }
    +        /* c8 ignore stop */
    +        this.type = 'Link';
    +        this.linkpath = normalizeWindowsPath(path.relative(this.cwd, linkpath));
    +        this.stat.size = 0;
    +        this[HEADER]();
    +        this.end();
    +    }
    +    [FILE]() {
    +        /* c8 ignore start */
    +        if (!this.stat) {
    +            throw new Error('cannot create file entry without stat');
    +        }
    +        /* c8 ignore stop */
    +        if (this.stat.nlink > 1) {
    +            const linkKey = `${this.stat.dev}:${this.stat.ino}`;
    +            const linkpath = this.linkCache.get(linkKey);
    +            if (linkpath?.indexOf(this.cwd) === 0) {
    +                return this[HARDLINK](linkpath);
    +            }
    +            this.linkCache.set(linkKey, this.absolute);
    +        }
    +        this[HEADER]();
    +        if (this.stat.size === 0) {
    +            return this.end();
    +        }
    +        this[OPENFILE]();
    +    }
    +    [OPENFILE]() {
    +        fs.open(this.absolute, 'r', (er, fd) => {
    +            if (er) {
    +                return this.emit('error', er);
    +            }
    +            this[ONOPENFILE](fd);
    +        });
    +    }
    +    [ONOPENFILE](fd) {
    +        this.fd = fd;
    +        if (this.#hadError) {
    +            return this[CLOSE]();
    +        }
    +        /* c8 ignore start */
    +        if (!this.stat) {
    +            throw new Error('should stat before calling onopenfile');
    +        }
    +        /* c8 ignore start */
    +        this.blockLen = 512 * Math.ceil(this.stat.size / 512);
    +        this.blockRemain = this.blockLen;
    +        const bufLen = Math.min(this.blockLen, this.maxReadSize);
    +        this.buf = Buffer.allocUnsafe(bufLen);
    +        this.offset = 0;
    +        this.pos = 0;
    +        this.remain = this.stat.size;
    +        this.length = this.buf.length;
    +        this[READ]();
    +    }
    +    [READ]() {
    +        const { fd, buf, offset, length, pos } = this;
    +        if (fd === undefined || buf === undefined) {
    +            throw new Error('cannot read file without first opening');
    +        }
    +        fs.read(fd, buf, offset, length, pos, (er, bytesRead) => {
    +            if (er) {
    +                // ignoring the error from close(2) is a bad practice, but at
    +                // this point we already have an error, don't need another one
    +                return this[CLOSE](() => this.emit('error', er));
    +            }
    +            this[ONREAD](bytesRead);
    +        });
    +    }
    +    /* c8 ignore start */
    +    [CLOSE](cb = () => { }) {
    +        /* c8 ignore stop */
    +        if (this.fd !== undefined)
    +            fs.close(this.fd, cb);
    +    }
    +    [ONREAD](bytesRead) {
    +        if (bytesRead <= 0 && this.remain > 0) {
    +            const er = Object.assign(new Error('encountered unexpected EOF'), {
    +                path: this.absolute,
    +                syscall: 'read',
    +                code: 'EOF',
    +            });
    +            return this[CLOSE](() => this.emit('error', er));
    +        }
    +        if (bytesRead > this.remain) {
    +            const er = Object.assign(new Error('did not encounter expected EOF'), {
    +                path: this.absolute,
    +                syscall: 'read',
    +                code: 'EOF',
    +            });
    +            return this[CLOSE](() => this.emit('error', er));
    +        }
    +        /* c8 ignore start */
    +        if (!this.buf) {
    +            throw new Error('should have created buffer prior to reading');
    +        }
    +        /* c8 ignore stop */
    +        // null out the rest of the buffer, if we could fit the block padding
    +        // at the end of this loop, we've incremented bytesRead and this.remain
    +        // to be incremented up to the blockRemain level, as if we had expected
    +        // to get a null-padded file, and read it until the end.  then we will
    +        // decrement both remain and blockRemain by bytesRead, and know that we
    +        // reached the expected EOF, without any null buffer to append.
    +        if (bytesRead === this.remain) {
    +            for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) {
    +                this.buf[i + this.offset] = 0;
    +                bytesRead++;
    +                this.remain++;
    +            }
    +        }
    +        const chunk = this.offset === 0 && bytesRead === this.buf.length ?
    +            this.buf
    +            : this.buf.subarray(this.offset, this.offset + bytesRead);
    +        const flushed = this.write(chunk);
    +        if (!flushed) {
    +            this[AWAITDRAIN](() => this[ONDRAIN]());
    +        }
    +        else {
    +            this[ONDRAIN]();
    +        }
    +    }
    +    [AWAITDRAIN](cb) {
    +        this.once('drain', cb);
    +    }
    +    write(chunk, encoding, cb) {
    +        /* c8 ignore start - just junk to comply with NodeJS.WritableStream */
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        if (typeof chunk === 'string') {
    +            chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8');
    +        }
    +        /* c8 ignore stop */
    +        if (this.blockRemain < chunk.length) {
    +            const er = Object.assign(new Error('writing more data than expected'), {
    +                path: this.absolute,
    +            });
    +            return this.emit('error', er);
    +        }
    +        this.remain -= chunk.length;
    +        this.blockRemain -= chunk.length;
    +        this.pos += chunk.length;
    +        this.offset += chunk.length;
    +        return super.write(chunk, null, cb);
    +    }
    +    [ONDRAIN]() {
    +        if (!this.remain) {
    +            if (this.blockRemain) {
    +                super.write(Buffer.alloc(this.blockRemain));
    +            }
    +            return this[CLOSE](er => er ? this.emit('error', er) : this.end());
    +        }
    +        /* c8 ignore start */
    +        if (!this.buf) {
    +            throw new Error('buffer lost somehow in ONDRAIN');
    +        }
    +        /* c8 ignore stop */
    +        if (this.offset >= this.length) {
    +            // if we only have a smaller bit left to read, alloc a smaller buffer
    +            // otherwise, keep it the same length it was before.
    +            this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length));
    +            this.offset = 0;
    +        }
    +        this.length = this.buf.length - this.offset;
    +        this[READ]();
    +    }
    +}
    +export class WriteEntrySync extends WriteEntry {
    +    sync = true;
    +    [LSTAT]() {
    +        this[ONLSTAT](fs.lstatSync(this.absolute));
    +    }
    +    [SYMLINK]() {
    +        this[ONREADLINK](fs.readlinkSync(this.absolute));
    +    }
    +    [OPENFILE]() {
    +        this[ONOPENFILE](fs.openSync(this.absolute, 'r'));
    +    }
    +    [READ]() {
    +        let threw = true;
    +        try {
    +            const { fd, buf, offset, length, pos } = this;
    +            /* c8 ignore start */
    +            if (fd === undefined || buf === undefined) {
    +                throw new Error('fd and buf must be set in READ method');
    +            }
    +            /* c8 ignore stop */
    +            const bytesRead = fs.readSync(fd, buf, offset, length, pos);
    +            this[ONREAD](bytesRead);
    +            threw = false;
    +        }
    +        finally {
    +            // ignoring the error from close(2) is a bad practice, but at
    +            // this point we already have an error, don't need another one
    +            if (threw) {
    +                try {
    +                    this[CLOSE](() => { });
    +                }
    +                catch (er) { }
    +            }
    +        }
    +    }
    +    [AWAITDRAIN](cb) {
    +        cb();
    +    }
    +    /* c8 ignore start */
    +    [CLOSE](cb = () => { }) {
    +        /* c8 ignore stop */
    +        if (this.fd !== undefined)
    +            fs.closeSync(this.fd);
    +        cb();
    +    }
    +}
    +export class WriteEntryTar extends Minipass {
    +    blockLen = 0;
    +    blockRemain = 0;
    +    buf = 0;
    +    pos = 0;
    +    remain = 0;
    +    length = 0;
    +    preservePaths;
    +    portable;
    +    strict;
    +    noPax;
    +    noMtime;
    +    readEntry;
    +    type;
    +    prefix;
    +    path;
    +    mode;
    +    uid;
    +    gid;
    +    uname;
    +    gname;
    +    header;
    +    mtime;
    +    atime;
    +    ctime;
    +    linkpath;
    +    size;
    +    onWriteEntry;
    +    warn(code, message, data = {}) {
    +        return warnMethod(this, code, message, data);
    +    }
    +    constructor(readEntry, opt_ = {}) {
    +        const opt = dealias(opt_);
    +        super();
    +        this.preservePaths = !!opt.preservePaths;
    +        this.portable = !!opt.portable;
    +        this.strict = !!opt.strict;
    +        this.noPax = !!opt.noPax;
    +        this.noMtime = !!opt.noMtime;
    +        this.onWriteEntry = opt.onWriteEntry;
    +        this.readEntry = readEntry;
    +        const { type } = readEntry;
    +        /* c8 ignore start */
    +        if (type === 'Unsupported') {
    +            throw new Error('writing entry that should be ignored');
    +        }
    +        /* c8 ignore stop */
    +        this.type = type;
    +        if (this.type === 'Directory' && this.portable) {
    +            this.noMtime = true;
    +        }
    +        this.prefix = opt.prefix;
    +        this.path = normalizeWindowsPath(readEntry.path);
    +        this.mode =
    +            readEntry.mode !== undefined ?
    +                this[MODE](readEntry.mode)
    +                : undefined;
    +        this.uid = this.portable ? undefined : readEntry.uid;
    +        this.gid = this.portable ? undefined : readEntry.gid;
    +        this.uname = this.portable ? undefined : readEntry.uname;
    +        this.gname = this.portable ? undefined : readEntry.gname;
    +        this.size = readEntry.size;
    +        this.mtime =
    +            this.noMtime ? undefined : opt.mtime || readEntry.mtime;
    +        this.atime = this.portable ? undefined : readEntry.atime;
    +        this.ctime = this.portable ? undefined : readEntry.ctime;
    +        this.linkpath =
    +            readEntry.linkpath !== undefined ?
    +                normalizeWindowsPath(readEntry.linkpath)
    +                : undefined;
    +        if (typeof opt.onwarn === 'function') {
    +            this.on('warn', opt.onwarn);
    +        }
    +        let pathWarn = false;
    +        if (!this.preservePaths) {
    +            const [root, stripped] = stripAbsolutePath(this.path);
    +            if (root && typeof stripped === 'string') {
    +                this.path = stripped;
    +                pathWarn = root;
    +            }
    +        }
    +        this.remain = readEntry.size;
    +        this.blockRemain = readEntry.startBlockSize;
    +        this.onWriteEntry?.(this);
    +        this.header = new Header({
    +            path: this[PREFIX](this.path),
    +            linkpath: this.type === 'Link' && this.linkpath !== undefined ?
    +                this[PREFIX](this.linkpath)
    +                : this.linkpath,
    +            // only the permissions and setuid/setgid/sticky bitflags
    +            // not the higher-order bits that specify file type
    +            mode: this.mode,
    +            uid: this.portable ? undefined : this.uid,
    +            gid: this.portable ? undefined : this.gid,
    +            size: this.size,
    +            mtime: this.noMtime ? undefined : this.mtime,
    +            type: this.type,
    +            uname: this.portable ? undefined : this.uname,
    +            atime: this.portable ? undefined : this.atime,
    +            ctime: this.portable ? undefined : this.ctime,
    +        });
    +        if (pathWarn) {
    +            this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {
    +                entry: this,
    +                path: pathWarn + this.path,
    +            });
    +        }
    +        if (this.header.encode() && !this.noPax) {
    +            super.write(new Pax({
    +                atime: this.portable ? undefined : this.atime,
    +                ctime: this.portable ? undefined : this.ctime,
    +                gid: this.portable ? undefined : this.gid,
    +                mtime: this.noMtime ? undefined : this.mtime,
    +                path: this[PREFIX](this.path),
    +                linkpath: this.type === 'Link' && this.linkpath !== undefined ?
    +                    this[PREFIX](this.linkpath)
    +                    : this.linkpath,
    +                size: this.size,
    +                uid: this.portable ? undefined : this.uid,
    +                uname: this.portable ? undefined : this.uname,
    +                dev: this.portable ? undefined : this.readEntry.dev,
    +                ino: this.portable ? undefined : this.readEntry.ino,
    +                nlink: this.portable ? undefined : this.readEntry.nlink,
    +            }).encode());
    +        }
    +        const b = this.header?.block;
    +        /* c8 ignore start */
    +        if (!b)
    +            throw new Error('failed to encode header');
    +        /* c8 ignore stop */
    +        super.write(b);
    +        readEntry.pipe(this);
    +    }
    +    [PREFIX](path) {
    +        return prefixPath(path, this.prefix);
    +    }
    +    [MODE](mode) {
    +        return modeFix(mode, this.type === 'Directory', this.portable);
    +    }
    +    write(chunk, encoding, cb) {
    +        /* c8 ignore start - just junk to comply with NodeJS.WritableStream */
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        if (typeof chunk === 'string') {
    +            chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8');
    +        }
    +        /* c8 ignore stop */
    +        const writeLen = chunk.length;
    +        if (writeLen > this.blockRemain) {
    +            throw new Error('writing more to entry than is appropriate');
    +        }
    +        this.blockRemain -= writeLen;
    +        return super.write(chunk, cb);
    +    }
    +    end(chunk, encoding, cb) {
    +        if (this.blockRemain) {
    +            super.write(Buffer.alloc(this.blockRemain));
    +        }
    +        /* c8 ignore start - just junk to comply with NodeJS.WritableStream */
    +        if (typeof chunk === 'function') {
    +            cb = chunk;
    +            encoding = undefined;
    +            chunk = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        if (typeof chunk === 'string') {
    +            chunk = Buffer.from(chunk, encoding ?? 'utf8');
    +        }
    +        if (cb)
    +            this.once('finish', cb);
    +        chunk ? super.end(chunk, cb) : super.end(cb);
    +        /* c8 ignore stop */
    +        return this;
    +    }
    +}
    +const getType = (stat) => stat.isFile() ? 'File'
    +    : stat.isDirectory() ? 'Directory'
    +        : stat.isSymbolicLink() ? 'SymbolicLink'
    +            : 'Unsupported';
    +//# sourceMappingURL=write-entry.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/tar/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/tar/package.json
    new file mode 100644
    index 00000000..0283103e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/tar/package.json
    @@ -0,0 +1,325 @@
    +{
    +  "author": "Isaac Z. Schlueter",
    +  "name": "tar",
    +  "description": "tar for node",
    +  "version": "7.4.3",
    +  "repository": {
    +    "type": "git",
    +    "url": "https://github.com/isaacs/node-tar.git"
    +  },
    +  "scripts": {
    +    "genparse": "node scripts/generate-parse-fixtures.js",
    +    "snap": "tap",
    +    "test": "tap",
    +    "pretest": "npm run prepare",
    +    "presnap": "npm run prepare",
    +    "prepare": "tshy",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "prepublishOnly": "git push origin --follow-tags",
    +    "format": "prettier --write . --log-level warn",
    +    "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
    +  },
    +  "dependencies": {
    +    "@isaacs/fs-minipass": "^4.0.0",
    +    "chownr": "^3.0.0",
    +    "minipass": "^7.1.2",
    +    "minizlib": "^3.0.1",
    +    "mkdirp": "^3.0.1",
    +    "yallist": "^5.0.0"
    +  },
    +  "devDependencies": {
    +    "chmodr": "^1.2.0",
    +    "end-of-stream": "^1.4.3",
    +    "events-to-array": "^2.0.3",
    +    "mutate-fs": "^2.1.1",
    +    "nock": "^13.5.4",
    +    "prettier": "^3.2.5",
    +    "rimraf": "^5.0.5",
    +    "tap": "^18.7.2",
    +    "tshy": "^1.13.1",
    +    "typedoc": "^0.25.13"
    +  },
    +  "license": "ISC",
    +  "engines": {
    +    "node": ">=18"
    +  },
    +  "files": [
    +    "dist"
    +  ],
    +  "tap": {
    +    "coverage-map": "map.js",
    +    "timeout": 0,
    +    "typecheck": true
    +  },
    +  "prettier": {
    +    "experimentalTernaries": true,
    +    "semi": false,
    +    "printWidth": 70,
    +    "tabWidth": 2,
    +    "useTabs": false,
    +    "singleQuote": true,
    +    "jsxSingleQuote": false,
    +    "bracketSameLine": true,
    +    "arrowParens": "avoid",
    +    "endOfLine": "lf"
    +  },
    +  "tshy": {
    +    "exports": {
    +      "./package.json": "./package.json",
    +      ".": "./src/index.ts",
    +      "./c": "./src/create.ts",
    +      "./create": "./src/create.ts",
    +      "./replace": "./src/create.ts",
    +      "./r": "./src/create.ts",
    +      "./list": "./src/list.ts",
    +      "./t": "./src/list.ts",
    +      "./update": "./src/update.ts",
    +      "./u": "./src/update.ts",
    +      "./extract": "./src/extract.ts",
    +      "./x": "./src/extract.ts",
    +      "./pack": "./src/pack.ts",
    +      "./unpack": "./src/unpack.ts",
    +      "./parse": "./src/parse.ts",
    +      "./read-entry": "./src/read-entry.ts",
    +      "./write-entry": "./src/write-entry.ts",
    +      "./header": "./src/header.ts",
    +      "./pax": "./src/pax.ts",
    +      "./types": "./src/types.ts"
    +    }
    +  },
    +  "exports": {
    +    "./package.json": "./package.json",
    +    ".": {
    +      "import": {
    +        "source": "./src/index.ts",
    +        "types": "./dist/esm/index.d.ts",
    +        "default": "./dist/esm/index.js"
    +      },
    +      "require": {
    +        "source": "./src/index.ts",
    +        "types": "./dist/commonjs/index.d.ts",
    +        "default": "./dist/commonjs/index.js"
    +      }
    +    },
    +    "./c": {
    +      "import": {
    +        "source": "./src/create.ts",
    +        "types": "./dist/esm/create.d.ts",
    +        "default": "./dist/esm/create.js"
    +      },
    +      "require": {
    +        "source": "./src/create.ts",
    +        "types": "./dist/commonjs/create.d.ts",
    +        "default": "./dist/commonjs/create.js"
    +      }
    +    },
    +    "./create": {
    +      "import": {
    +        "source": "./src/create.ts",
    +        "types": "./dist/esm/create.d.ts",
    +        "default": "./dist/esm/create.js"
    +      },
    +      "require": {
    +        "source": "./src/create.ts",
    +        "types": "./dist/commonjs/create.d.ts",
    +        "default": "./dist/commonjs/create.js"
    +      }
    +    },
    +    "./replace": {
    +      "import": {
    +        "source": "./src/create.ts",
    +        "types": "./dist/esm/create.d.ts",
    +        "default": "./dist/esm/create.js"
    +      },
    +      "require": {
    +        "source": "./src/create.ts",
    +        "types": "./dist/commonjs/create.d.ts",
    +        "default": "./dist/commonjs/create.js"
    +      }
    +    },
    +    "./r": {
    +      "import": {
    +        "source": "./src/create.ts",
    +        "types": "./dist/esm/create.d.ts",
    +        "default": "./dist/esm/create.js"
    +      },
    +      "require": {
    +        "source": "./src/create.ts",
    +        "types": "./dist/commonjs/create.d.ts",
    +        "default": "./dist/commonjs/create.js"
    +      }
    +    },
    +    "./list": {
    +      "import": {
    +        "source": "./src/list.ts",
    +        "types": "./dist/esm/list.d.ts",
    +        "default": "./dist/esm/list.js"
    +      },
    +      "require": {
    +        "source": "./src/list.ts",
    +        "types": "./dist/commonjs/list.d.ts",
    +        "default": "./dist/commonjs/list.js"
    +      }
    +    },
    +    "./t": {
    +      "import": {
    +        "source": "./src/list.ts",
    +        "types": "./dist/esm/list.d.ts",
    +        "default": "./dist/esm/list.js"
    +      },
    +      "require": {
    +        "source": "./src/list.ts",
    +        "types": "./dist/commonjs/list.d.ts",
    +        "default": "./dist/commonjs/list.js"
    +      }
    +    },
    +    "./update": {
    +      "import": {
    +        "source": "./src/update.ts",
    +        "types": "./dist/esm/update.d.ts",
    +        "default": "./dist/esm/update.js"
    +      },
    +      "require": {
    +        "source": "./src/update.ts",
    +        "types": "./dist/commonjs/update.d.ts",
    +        "default": "./dist/commonjs/update.js"
    +      }
    +    },
    +    "./u": {
    +      "import": {
    +        "source": "./src/update.ts",
    +        "types": "./dist/esm/update.d.ts",
    +        "default": "./dist/esm/update.js"
    +      },
    +      "require": {
    +        "source": "./src/update.ts",
    +        "types": "./dist/commonjs/update.d.ts",
    +        "default": "./dist/commonjs/update.js"
    +      }
    +    },
    +    "./extract": {
    +      "import": {
    +        "source": "./src/extract.ts",
    +        "types": "./dist/esm/extract.d.ts",
    +        "default": "./dist/esm/extract.js"
    +      },
    +      "require": {
    +        "source": "./src/extract.ts",
    +        "types": "./dist/commonjs/extract.d.ts",
    +        "default": "./dist/commonjs/extract.js"
    +      }
    +    },
    +    "./x": {
    +      "import": {
    +        "source": "./src/extract.ts",
    +        "types": "./dist/esm/extract.d.ts",
    +        "default": "./dist/esm/extract.js"
    +      },
    +      "require": {
    +        "source": "./src/extract.ts",
    +        "types": "./dist/commonjs/extract.d.ts",
    +        "default": "./dist/commonjs/extract.js"
    +      }
    +    },
    +    "./pack": {
    +      "import": {
    +        "source": "./src/pack.ts",
    +        "types": "./dist/esm/pack.d.ts",
    +        "default": "./dist/esm/pack.js"
    +      },
    +      "require": {
    +        "source": "./src/pack.ts",
    +        "types": "./dist/commonjs/pack.d.ts",
    +        "default": "./dist/commonjs/pack.js"
    +      }
    +    },
    +    "./unpack": {
    +      "import": {
    +        "source": "./src/unpack.ts",
    +        "types": "./dist/esm/unpack.d.ts",
    +        "default": "./dist/esm/unpack.js"
    +      },
    +      "require": {
    +        "source": "./src/unpack.ts",
    +        "types": "./dist/commonjs/unpack.d.ts",
    +        "default": "./dist/commonjs/unpack.js"
    +      }
    +    },
    +    "./parse": {
    +      "import": {
    +        "source": "./src/parse.ts",
    +        "types": "./dist/esm/parse.d.ts",
    +        "default": "./dist/esm/parse.js"
    +      },
    +      "require": {
    +        "source": "./src/parse.ts",
    +        "types": "./dist/commonjs/parse.d.ts",
    +        "default": "./dist/commonjs/parse.js"
    +      }
    +    },
    +    "./read-entry": {
    +      "import": {
    +        "source": "./src/read-entry.ts",
    +        "types": "./dist/esm/read-entry.d.ts",
    +        "default": "./dist/esm/read-entry.js"
    +      },
    +      "require": {
    +        "source": "./src/read-entry.ts",
    +        "types": "./dist/commonjs/read-entry.d.ts",
    +        "default": "./dist/commonjs/read-entry.js"
    +      }
    +    },
    +    "./write-entry": {
    +      "import": {
    +        "source": "./src/write-entry.ts",
    +        "types": "./dist/esm/write-entry.d.ts",
    +        "default": "./dist/esm/write-entry.js"
    +      },
    +      "require": {
    +        "source": "./src/write-entry.ts",
    +        "types": "./dist/commonjs/write-entry.d.ts",
    +        "default": "./dist/commonjs/write-entry.js"
    +      }
    +    },
    +    "./header": {
    +      "import": {
    +        "source": "./src/header.ts",
    +        "types": "./dist/esm/header.d.ts",
    +        "default": "./dist/esm/header.js"
    +      },
    +      "require": {
    +        "source": "./src/header.ts",
    +        "types": "./dist/commonjs/header.d.ts",
    +        "default": "./dist/commonjs/header.js"
    +      }
    +    },
    +    "./pax": {
    +      "import": {
    +        "source": "./src/pax.ts",
    +        "types": "./dist/esm/pax.d.ts",
    +        "default": "./dist/esm/pax.js"
    +      },
    +      "require": {
    +        "source": "./src/pax.ts",
    +        "types": "./dist/commonjs/pax.d.ts",
    +        "default": "./dist/commonjs/pax.js"
    +      }
    +    },
    +    "./types": {
    +      "import": {
    +        "source": "./src/types.ts",
    +        "types": "./dist/esm/types.d.ts",
    +        "default": "./dist/esm/types.js"
    +      },
    +      "require": {
    +        "source": "./src/types.ts",
    +        "types": "./dist/commonjs/types.d.ts",
    +        "default": "./dist/commonjs/types.js"
    +      }
    +    }
    +  },
    +  "type": "module",
    +  "main": "./dist/commonjs/index.js",
    +  "types": "./dist/commonjs/index.d.ts"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/yallist/LICENSE.md b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/LICENSE.md
    new file mode 100644
    index 00000000..881248b6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/LICENSE.md
    @@ -0,0 +1,63 @@
    +All packages under `src/` are licensed according to the terms in
    +their respective `LICENSE` or `LICENSE.md` files.
    +
    +The remainder of this project is licensed under the Blue Oak
    +Model License, as follows:
    +
    +-----
    +
    +# Blue Oak Model License
    +
    +Version 1.0.0
    +
    +## Purpose
    +
    +This license gives everyone as much permission to work with
    +this software as possible, while protecting contributors
    +from liability.
    +
    +## Acceptance
    +
    +In order to receive this license, you must agree to its
    +rules.  The rules of this license are both obligations
    +under that agreement and conditions to your license.
    +You must not do anything with this software that triggers
    +a rule that you cannot or will not follow.
    +
    +## Copyright
    +
    +Each contributor licenses you to do everything with this
    +software that would otherwise infringe that contributor's
    +copyright in it.
    +
    +## Notices
    +
    +You must ensure that everyone who gets a copy of
    +any part of this software from you, with or without
    +changes, also gets the text of this license or a link to
    +.
    +
    +## Excuse
    +
    +If anyone notifies you in writing that you have not
    +complied with [Notices](#notices), you can keep your
    +license by taking all practical steps to comply within 30
    +days after the notice.  If you do not do so, your license
    +ends immediately.
    +
    +## Patent
    +
    +Each contributor licenses you to do everything with this
    +software that would otherwise infringe any patent claims
    +they can license or become able to license.
    +
    +## Reliability
    +
    +No contributor can revoke this license.
    +
    +## No Liability
    +
    +***As far as the law allows, this software comes as is,
    +without any warranty or condition, and no contributor
    +will be liable to anyone for any damages related to this
    +software or this license, under any kind of legal claim.***
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/commonjs/index.js b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/commonjs/index.js
    new file mode 100644
    index 00000000..c1e1e474
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/commonjs/index.js
    @@ -0,0 +1,384 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.Node = exports.Yallist = void 0;
    +class Yallist {
    +    tail;
    +    head;
    +    length = 0;
    +    static create(list = []) {
    +        return new Yallist(list);
    +    }
    +    constructor(list = []) {
    +        for (const item of list) {
    +            this.push(item);
    +        }
    +    }
    +    *[Symbol.iterator]() {
    +        for (let walker = this.head; walker; walker = walker.next) {
    +            yield walker.value;
    +        }
    +    }
    +    removeNode(node) {
    +        if (node.list !== this) {
    +            throw new Error('removing node which does not belong to this list');
    +        }
    +        const next = node.next;
    +        const prev = node.prev;
    +        if (next) {
    +            next.prev = prev;
    +        }
    +        if (prev) {
    +            prev.next = next;
    +        }
    +        if (node === this.head) {
    +            this.head = next;
    +        }
    +        if (node === this.tail) {
    +            this.tail = prev;
    +        }
    +        this.length--;
    +        node.next = undefined;
    +        node.prev = undefined;
    +        node.list = undefined;
    +        return next;
    +    }
    +    unshiftNode(node) {
    +        if (node === this.head) {
    +            return;
    +        }
    +        if (node.list) {
    +            node.list.removeNode(node);
    +        }
    +        const head = this.head;
    +        node.list = this;
    +        node.next = head;
    +        if (head) {
    +            head.prev = node;
    +        }
    +        this.head = node;
    +        if (!this.tail) {
    +            this.tail = node;
    +        }
    +        this.length++;
    +    }
    +    pushNode(node) {
    +        if (node === this.tail) {
    +            return;
    +        }
    +        if (node.list) {
    +            node.list.removeNode(node);
    +        }
    +        const tail = this.tail;
    +        node.list = this;
    +        node.prev = tail;
    +        if (tail) {
    +            tail.next = node;
    +        }
    +        this.tail = node;
    +        if (!this.head) {
    +            this.head = node;
    +        }
    +        this.length++;
    +    }
    +    push(...args) {
    +        for (let i = 0, l = args.length; i < l; i++) {
    +            push(this, args[i]);
    +        }
    +        return this.length;
    +    }
    +    unshift(...args) {
    +        for (var i = 0, l = args.length; i < l; i++) {
    +            unshift(this, args[i]);
    +        }
    +        return this.length;
    +    }
    +    pop() {
    +        if (!this.tail) {
    +            return undefined;
    +        }
    +        const res = this.tail.value;
    +        const t = this.tail;
    +        this.tail = this.tail.prev;
    +        if (this.tail) {
    +            this.tail.next = undefined;
    +        }
    +        else {
    +            this.head = undefined;
    +        }
    +        t.list = undefined;
    +        this.length--;
    +        return res;
    +    }
    +    shift() {
    +        if (!this.head) {
    +            return undefined;
    +        }
    +        const res = this.head.value;
    +        const h = this.head;
    +        this.head = this.head.next;
    +        if (this.head) {
    +            this.head.prev = undefined;
    +        }
    +        else {
    +            this.tail = undefined;
    +        }
    +        h.list = undefined;
    +        this.length--;
    +        return res;
    +    }
    +    forEach(fn, thisp) {
    +        thisp = thisp || this;
    +        for (let walker = this.head, i = 0; !!walker; i++) {
    +            fn.call(thisp, walker.value, i, this);
    +            walker = walker.next;
    +        }
    +    }
    +    forEachReverse(fn, thisp) {
    +        thisp = thisp || this;
    +        for (let walker = this.tail, i = this.length - 1; !!walker; i--) {
    +            fn.call(thisp, walker.value, i, this);
    +            walker = walker.prev;
    +        }
    +    }
    +    get(n) {
    +        let i = 0;
    +        let walker = this.head;
    +        for (; !!walker && i < n; i++) {
    +            walker = walker.next;
    +        }
    +        if (i === n && !!walker) {
    +            return walker.value;
    +        }
    +    }
    +    getReverse(n) {
    +        let i = 0;
    +        let walker = this.tail;
    +        for (; !!walker && i < n; i++) {
    +            // abort out of the list early if we hit a cycle
    +            walker = walker.prev;
    +        }
    +        if (i === n && !!walker) {
    +            return walker.value;
    +        }
    +    }
    +    map(fn, thisp) {
    +        thisp = thisp || this;
    +        const res = new Yallist();
    +        for (let walker = this.head; !!walker;) {
    +            res.push(fn.call(thisp, walker.value, this));
    +            walker = walker.next;
    +        }
    +        return res;
    +    }
    +    mapReverse(fn, thisp) {
    +        thisp = thisp || this;
    +        var res = new Yallist();
    +        for (let walker = this.tail; !!walker;) {
    +            res.push(fn.call(thisp, walker.value, this));
    +            walker = walker.prev;
    +        }
    +        return res;
    +    }
    +    reduce(fn, initial) {
    +        let acc;
    +        let walker = this.head;
    +        if (arguments.length > 1) {
    +            acc = initial;
    +        }
    +        else if (this.head) {
    +            walker = this.head.next;
    +            acc = this.head.value;
    +        }
    +        else {
    +            throw new TypeError('Reduce of empty list with no initial value');
    +        }
    +        for (var i = 0; !!walker; i++) {
    +            acc = fn(acc, walker.value, i);
    +            walker = walker.next;
    +        }
    +        return acc;
    +    }
    +    reduceReverse(fn, initial) {
    +        let acc;
    +        let walker = this.tail;
    +        if (arguments.length > 1) {
    +            acc = initial;
    +        }
    +        else if (this.tail) {
    +            walker = this.tail.prev;
    +            acc = this.tail.value;
    +        }
    +        else {
    +            throw new TypeError('Reduce of empty list with no initial value');
    +        }
    +        for (let i = this.length - 1; !!walker; i--) {
    +            acc = fn(acc, walker.value, i);
    +            walker = walker.prev;
    +        }
    +        return acc;
    +    }
    +    toArray() {
    +        const arr = new Array(this.length);
    +        for (let i = 0, walker = this.head; !!walker; i++) {
    +            arr[i] = walker.value;
    +            walker = walker.next;
    +        }
    +        return arr;
    +    }
    +    toArrayReverse() {
    +        const arr = new Array(this.length);
    +        for (let i = 0, walker = this.tail; !!walker; i++) {
    +            arr[i] = walker.value;
    +            walker = walker.prev;
    +        }
    +        return arr;
    +    }
    +    slice(from = 0, to = this.length) {
    +        if (to < 0) {
    +            to += this.length;
    +        }
    +        if (from < 0) {
    +            from += this.length;
    +        }
    +        const ret = new Yallist();
    +        if (to < from || to < 0) {
    +            return ret;
    +        }
    +        if (from < 0) {
    +            from = 0;
    +        }
    +        if (to > this.length) {
    +            to = this.length;
    +        }
    +        let walker = this.head;
    +        let i = 0;
    +        for (i = 0; !!walker && i < from; i++) {
    +            walker = walker.next;
    +        }
    +        for (; !!walker && i < to; i++, walker = walker.next) {
    +            ret.push(walker.value);
    +        }
    +        return ret;
    +    }
    +    sliceReverse(from = 0, to = this.length) {
    +        if (to < 0) {
    +            to += this.length;
    +        }
    +        if (from < 0) {
    +            from += this.length;
    +        }
    +        const ret = new Yallist();
    +        if (to < from || to < 0) {
    +            return ret;
    +        }
    +        if (from < 0) {
    +            from = 0;
    +        }
    +        if (to > this.length) {
    +            to = this.length;
    +        }
    +        let i = this.length;
    +        let walker = this.tail;
    +        for (; !!walker && i > to; i--) {
    +            walker = walker.prev;
    +        }
    +        for (; !!walker && i > from; i--, walker = walker.prev) {
    +            ret.push(walker.value);
    +        }
    +        return ret;
    +    }
    +    splice(start, deleteCount = 0, ...nodes) {
    +        if (start > this.length) {
    +            start = this.length - 1;
    +        }
    +        if (start < 0) {
    +            start = this.length + start;
    +        }
    +        let walker = this.head;
    +        for (let i = 0; !!walker && i < start; i++) {
    +            walker = walker.next;
    +        }
    +        const ret = [];
    +        for (let i = 0; !!walker && i < deleteCount; i++) {
    +            ret.push(walker.value);
    +            walker = this.removeNode(walker);
    +        }
    +        if (!walker) {
    +            walker = this.tail;
    +        }
    +        else if (walker !== this.tail) {
    +            walker = walker.prev;
    +        }
    +        for (const v of nodes) {
    +            walker = insertAfter(this, walker, v);
    +        }
    +        return ret;
    +    }
    +    reverse() {
    +        const head = this.head;
    +        const tail = this.tail;
    +        for (let walker = head; !!walker; walker = walker.prev) {
    +            const p = walker.prev;
    +            walker.prev = walker.next;
    +            walker.next = p;
    +        }
    +        this.head = tail;
    +        this.tail = head;
    +        return this;
    +    }
    +}
    +exports.Yallist = Yallist;
    +// insertAfter undefined means "make the node the new head of list"
    +function insertAfter(self, node, value) {
    +    const prev = node;
    +    const next = node ? node.next : self.head;
    +    const inserted = new Node(value, prev, next, self);
    +    if (inserted.next === undefined) {
    +        self.tail = inserted;
    +    }
    +    if (inserted.prev === undefined) {
    +        self.head = inserted;
    +    }
    +    self.length++;
    +    return inserted;
    +}
    +function push(self, item) {
    +    self.tail = new Node(item, self.tail, undefined, self);
    +    if (!self.head) {
    +        self.head = self.tail;
    +    }
    +    self.length++;
    +}
    +function unshift(self, item) {
    +    self.head = new Node(item, undefined, self.head, self);
    +    if (!self.tail) {
    +        self.tail = self.head;
    +    }
    +    self.length++;
    +}
    +class Node {
    +    list;
    +    next;
    +    prev;
    +    value;
    +    constructor(value, prev, next, list) {
    +        this.list = list;
    +        this.value = value;
    +        if (prev) {
    +            prev.next = this;
    +            this.prev = prev;
    +        }
    +        else {
    +            this.prev = undefined;
    +        }
    +        if (next) {
    +            next.prev = this;
    +            this.next = next;
    +        }
    +        else {
    +            this.next = undefined;
    +        }
    +    }
    +}
    +exports.Node = Node;
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/commonjs/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/esm/index.js b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/esm/index.js
    new file mode 100644
    index 00000000..3d81c511
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/esm/index.js
    @@ -0,0 +1,379 @@
    +export class Yallist {
    +    tail;
    +    head;
    +    length = 0;
    +    static create(list = []) {
    +        return new Yallist(list);
    +    }
    +    constructor(list = []) {
    +        for (const item of list) {
    +            this.push(item);
    +        }
    +    }
    +    *[Symbol.iterator]() {
    +        for (let walker = this.head; walker; walker = walker.next) {
    +            yield walker.value;
    +        }
    +    }
    +    removeNode(node) {
    +        if (node.list !== this) {
    +            throw new Error('removing node which does not belong to this list');
    +        }
    +        const next = node.next;
    +        const prev = node.prev;
    +        if (next) {
    +            next.prev = prev;
    +        }
    +        if (prev) {
    +            prev.next = next;
    +        }
    +        if (node === this.head) {
    +            this.head = next;
    +        }
    +        if (node === this.tail) {
    +            this.tail = prev;
    +        }
    +        this.length--;
    +        node.next = undefined;
    +        node.prev = undefined;
    +        node.list = undefined;
    +        return next;
    +    }
    +    unshiftNode(node) {
    +        if (node === this.head) {
    +            return;
    +        }
    +        if (node.list) {
    +            node.list.removeNode(node);
    +        }
    +        const head = this.head;
    +        node.list = this;
    +        node.next = head;
    +        if (head) {
    +            head.prev = node;
    +        }
    +        this.head = node;
    +        if (!this.tail) {
    +            this.tail = node;
    +        }
    +        this.length++;
    +    }
    +    pushNode(node) {
    +        if (node === this.tail) {
    +            return;
    +        }
    +        if (node.list) {
    +            node.list.removeNode(node);
    +        }
    +        const tail = this.tail;
    +        node.list = this;
    +        node.prev = tail;
    +        if (tail) {
    +            tail.next = node;
    +        }
    +        this.tail = node;
    +        if (!this.head) {
    +            this.head = node;
    +        }
    +        this.length++;
    +    }
    +    push(...args) {
    +        for (let i = 0, l = args.length; i < l; i++) {
    +            push(this, args[i]);
    +        }
    +        return this.length;
    +    }
    +    unshift(...args) {
    +        for (var i = 0, l = args.length; i < l; i++) {
    +            unshift(this, args[i]);
    +        }
    +        return this.length;
    +    }
    +    pop() {
    +        if (!this.tail) {
    +            return undefined;
    +        }
    +        const res = this.tail.value;
    +        const t = this.tail;
    +        this.tail = this.tail.prev;
    +        if (this.tail) {
    +            this.tail.next = undefined;
    +        }
    +        else {
    +            this.head = undefined;
    +        }
    +        t.list = undefined;
    +        this.length--;
    +        return res;
    +    }
    +    shift() {
    +        if (!this.head) {
    +            return undefined;
    +        }
    +        const res = this.head.value;
    +        const h = this.head;
    +        this.head = this.head.next;
    +        if (this.head) {
    +            this.head.prev = undefined;
    +        }
    +        else {
    +            this.tail = undefined;
    +        }
    +        h.list = undefined;
    +        this.length--;
    +        return res;
    +    }
    +    forEach(fn, thisp) {
    +        thisp = thisp || this;
    +        for (let walker = this.head, i = 0; !!walker; i++) {
    +            fn.call(thisp, walker.value, i, this);
    +            walker = walker.next;
    +        }
    +    }
    +    forEachReverse(fn, thisp) {
    +        thisp = thisp || this;
    +        for (let walker = this.tail, i = this.length - 1; !!walker; i--) {
    +            fn.call(thisp, walker.value, i, this);
    +            walker = walker.prev;
    +        }
    +    }
    +    get(n) {
    +        let i = 0;
    +        let walker = this.head;
    +        for (; !!walker && i < n; i++) {
    +            walker = walker.next;
    +        }
    +        if (i === n && !!walker) {
    +            return walker.value;
    +        }
    +    }
    +    getReverse(n) {
    +        let i = 0;
    +        let walker = this.tail;
    +        for (; !!walker && i < n; i++) {
    +            // abort out of the list early if we hit a cycle
    +            walker = walker.prev;
    +        }
    +        if (i === n && !!walker) {
    +            return walker.value;
    +        }
    +    }
    +    map(fn, thisp) {
    +        thisp = thisp || this;
    +        const res = new Yallist();
    +        for (let walker = this.head; !!walker;) {
    +            res.push(fn.call(thisp, walker.value, this));
    +            walker = walker.next;
    +        }
    +        return res;
    +    }
    +    mapReverse(fn, thisp) {
    +        thisp = thisp || this;
    +        var res = new Yallist();
    +        for (let walker = this.tail; !!walker;) {
    +            res.push(fn.call(thisp, walker.value, this));
    +            walker = walker.prev;
    +        }
    +        return res;
    +    }
    +    reduce(fn, initial) {
    +        let acc;
    +        let walker = this.head;
    +        if (arguments.length > 1) {
    +            acc = initial;
    +        }
    +        else if (this.head) {
    +            walker = this.head.next;
    +            acc = this.head.value;
    +        }
    +        else {
    +            throw new TypeError('Reduce of empty list with no initial value');
    +        }
    +        for (var i = 0; !!walker; i++) {
    +            acc = fn(acc, walker.value, i);
    +            walker = walker.next;
    +        }
    +        return acc;
    +    }
    +    reduceReverse(fn, initial) {
    +        let acc;
    +        let walker = this.tail;
    +        if (arguments.length > 1) {
    +            acc = initial;
    +        }
    +        else if (this.tail) {
    +            walker = this.tail.prev;
    +            acc = this.tail.value;
    +        }
    +        else {
    +            throw new TypeError('Reduce of empty list with no initial value');
    +        }
    +        for (let i = this.length - 1; !!walker; i--) {
    +            acc = fn(acc, walker.value, i);
    +            walker = walker.prev;
    +        }
    +        return acc;
    +    }
    +    toArray() {
    +        const arr = new Array(this.length);
    +        for (let i = 0, walker = this.head; !!walker; i++) {
    +            arr[i] = walker.value;
    +            walker = walker.next;
    +        }
    +        return arr;
    +    }
    +    toArrayReverse() {
    +        const arr = new Array(this.length);
    +        for (let i = 0, walker = this.tail; !!walker; i++) {
    +            arr[i] = walker.value;
    +            walker = walker.prev;
    +        }
    +        return arr;
    +    }
    +    slice(from = 0, to = this.length) {
    +        if (to < 0) {
    +            to += this.length;
    +        }
    +        if (from < 0) {
    +            from += this.length;
    +        }
    +        const ret = new Yallist();
    +        if (to < from || to < 0) {
    +            return ret;
    +        }
    +        if (from < 0) {
    +            from = 0;
    +        }
    +        if (to > this.length) {
    +            to = this.length;
    +        }
    +        let walker = this.head;
    +        let i = 0;
    +        for (i = 0; !!walker && i < from; i++) {
    +            walker = walker.next;
    +        }
    +        for (; !!walker && i < to; i++, walker = walker.next) {
    +            ret.push(walker.value);
    +        }
    +        return ret;
    +    }
    +    sliceReverse(from = 0, to = this.length) {
    +        if (to < 0) {
    +            to += this.length;
    +        }
    +        if (from < 0) {
    +            from += this.length;
    +        }
    +        const ret = new Yallist();
    +        if (to < from || to < 0) {
    +            return ret;
    +        }
    +        if (from < 0) {
    +            from = 0;
    +        }
    +        if (to > this.length) {
    +            to = this.length;
    +        }
    +        let i = this.length;
    +        let walker = this.tail;
    +        for (; !!walker && i > to; i--) {
    +            walker = walker.prev;
    +        }
    +        for (; !!walker && i > from; i--, walker = walker.prev) {
    +            ret.push(walker.value);
    +        }
    +        return ret;
    +    }
    +    splice(start, deleteCount = 0, ...nodes) {
    +        if (start > this.length) {
    +            start = this.length - 1;
    +        }
    +        if (start < 0) {
    +            start = this.length + start;
    +        }
    +        let walker = this.head;
    +        for (let i = 0; !!walker && i < start; i++) {
    +            walker = walker.next;
    +        }
    +        const ret = [];
    +        for (let i = 0; !!walker && i < deleteCount; i++) {
    +            ret.push(walker.value);
    +            walker = this.removeNode(walker);
    +        }
    +        if (!walker) {
    +            walker = this.tail;
    +        }
    +        else if (walker !== this.tail) {
    +            walker = walker.prev;
    +        }
    +        for (const v of nodes) {
    +            walker = insertAfter(this, walker, v);
    +        }
    +        return ret;
    +    }
    +    reverse() {
    +        const head = this.head;
    +        const tail = this.tail;
    +        for (let walker = head; !!walker; walker = walker.prev) {
    +            const p = walker.prev;
    +            walker.prev = walker.next;
    +            walker.next = p;
    +        }
    +        this.head = tail;
    +        this.tail = head;
    +        return this;
    +    }
    +}
    +// insertAfter undefined means "make the node the new head of list"
    +function insertAfter(self, node, value) {
    +    const prev = node;
    +    const next = node ? node.next : self.head;
    +    const inserted = new Node(value, prev, next, self);
    +    if (inserted.next === undefined) {
    +        self.tail = inserted;
    +    }
    +    if (inserted.prev === undefined) {
    +        self.head = inserted;
    +    }
    +    self.length++;
    +    return inserted;
    +}
    +function push(self, item) {
    +    self.tail = new Node(item, self.tail, undefined, self);
    +    if (!self.head) {
    +        self.head = self.tail;
    +    }
    +    self.length++;
    +}
    +function unshift(self, item) {
    +    self.head = new Node(item, undefined, self.head, self);
    +    if (!self.tail) {
    +        self.tail = self.head;
    +    }
    +    self.length++;
    +}
    +export class Node {
    +    list;
    +    next;
    +    prev;
    +    value;
    +    constructor(value, prev, next, list) {
    +        this.list = list;
    +        this.value = value;
    +        if (prev) {
    +            prev.next = this;
    +            this.prev = prev;
    +        }
    +        else {
    +            this.prev = undefined;
    +        }
    +        if (next) {
    +            next.prev = this;
    +            this.next = next;
    +        }
    +        else {
    +            this.next = undefined;
    +        }
    +    }
    +}
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/esm/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/node_modules/yallist/package.json b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/package.json
    new file mode 100644
    index 00000000..2f524780
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/node_modules/yallist/package.json
    @@ -0,0 +1,68 @@
    +{
    +  "name": "yallist",
    +  "version": "5.0.0",
    +  "description": "Yet Another Linked List",
    +  "files": [
    +    "dist"
    +  ],
    +  "devDependencies": {
    +    "prettier": "^3.2.5",
    +    "tap": "^18.7.2",
    +    "tshy": "^1.13.1",
    +    "typedoc": "^0.25.13"
    +  },
    +  "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 --ignore-path ../../.prettierignore --cache",
    +    "typedoc": "typedoc"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/isaacs/yallist.git"
    +  },
    +  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
    +  "license": "BlueOak-1.0.0",
    +  "tshy": {
    +    "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"
    +      }
    +    }
    +  },
    +  "main": "./dist/commonjs/index.js",
    +  "types": "./dist/commonjs/index.d.ts",
    +  "type": "module",
    +  "prettier": {
    +    "semi": false,
    +    "printWidth": 70,
    +    "tabWidth": 2,
    +    "useTabs": false,
    +    "singleQuote": true,
    +    "jsxSingleQuote": false,
    +    "bracketSameLine": true,
    +    "arrowParens": "avoid",
    +    "endOfLine": "lf"
    +  },
    +  "engines": {
    +    "node": ">=18"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/package.json b/node_modules/npm/node_modules/node-gyp/package.json
    new file mode 100644
    index 00000000..4a1cfb0e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/package.json
    @@ -0,0 +1,52 @@
    +{
    +  "name": "node-gyp",
    +  "description": "Node.js native addon build tool",
    +  "license": "MIT",
    +  "keywords": [
    +    "native",
    +    "addon",
    +    "module",
    +    "c",
    +    "c++",
    +    "bindings",
    +    "gyp"
    +  ],
    +  "version": "11.0.0",
    +  "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": "^10.3.10",
    +    "graceful-fs": "^4.2.6",
    +    "make-fetch-happen": "^14.0.3",
    +    "nopt": "^8.0.0",
    +    "proc-log": "^5.0.0",
    +    "semver": "^7.3.5",
    +    "tar": "^7.4.3",
    +    "which": "^5.0.0"
    +  },
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "devDependencies": {
    +    "bindings": "^1.5.0",
    +    "cross-env": "^7.0.3",
    +    "eslint": "^9.16.0",
    +    "mocha": "^11.0.1",
    +    "nan": "^2.14.2",
    +    "neostandard": "^0.11.9",
    +    "require-inject": "^1.4.4"
    +  },
    +  "scripts": {
    +    "lint": "eslint \"*/*.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/node_modules/npm/node_modules/node-gyp/release-please-config.json b/node_modules/npm/node_modules/node-gyp/release-please-config.json
    new file mode 100644
    index 00000000..94b8f811
    --- /dev/null
    +++ b/node_modules/npm/node_modules/node-gyp/release-please-config.json
    @@ -0,0 +1,40 @@
    +{
    +    "packages": {
    +        ".": {
    +            "include-component-in-tag": false,
    +            "release-type": "node",
    +            "changelog-sections": [
    +                { "type": "feat", "section": "Features", "hidden": false },
    +                { "type": "fix", "section": "Bug Fixes", "hidden": false },
    +                { "type": "bin", "section": "Core", "hidden": false },
    +                { "type": "gyp", "section": "Core", "hidden": false },
    +                { "type": "lib", "section": "Core", "hidden": false },
    +                { "type": "src", "section": "Core", "hidden": false },
    +                { "type": "test", "section": "Tests", "hidden": false },
    +                { "type": "build", "section": "Core", "hidden": false },
    +                { "type": "clean", "section": "Core", "hidden": false },
    +                { "type": "configure", "section": "Core", "hidden": false },
    +                { "type": "install", "section": "Core", "hidden": false },
    +                { "type": "list", "section": "Core", "hidden": false },
    +                { "type": "rebuild", "section": "Core", "hidden": false },
    +                { "type": "remove", "section": "Core", "hidden": false },
    +                { "type": "deps", "section": "Core", "hidden": false },
    +                { "type": "python", "section": "Core", "hidden": false },
    +                { "type": "lin", "section": "Core", "hidden": false },
    +                { "type": "linux", "section": "Core", "hidden": false },
    +                { "type": "mac", "section": "Core", "hidden": false },
    +                { "type": "macos", "section": "Core", "hidden": false },
    +                { "type": "win", "section": "Core", "hidden": false },
    +                { "type": "windows", "section": "Core", "hidden": false },
    +                { "type": "zos", "section": "Core", "hidden": false },
    +                { "type": "doc", "section": "Doc", "hidden": false },
    +                { "type": "docs", "section": "Doc", "hidden": false },
    +                { "type": "readme", "section": "Doc", "hidden": false },
    +                { "type": "chore", "section": "Miscellaneous", "hidden": false },
    +                { "type": "refactor", "section": "Miscellaneous", "hidden": false },
    +                { "type": "ci", "section": "Miscellaneous", "hidden": false },
    +                { "type": "meta", "section": "Miscellaneous", "hidden": false }
    +            ]
    +        }
    +    }
    +}
    diff --git a/node_modules/npm/node_modules/node-gyp/src/win_delay_load_hook.cc b/node_modules/npm/node_modules/node-gyp/src/win_delay_load_hook.cc
    new file mode 100644
    index 00000000..169f8029
    --- /dev/null
    +++ b/node_modules/npm/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/npm/node_modules/nopt/LICENSE b/node_modules/npm/node_modules/nopt/LICENSE
    new file mode 100644
    index 00000000..19129e31
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/nopt/README.md b/node_modules/npm/node_modules/nopt/README.md
    new file mode 100644
    index 00000000..a99531c0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/README.md
    @@ -0,0 +1,213 @@
    +If you want to write an option parser, and have it be good, there are
    +two ways to do it.  The Right Way, and the Wrong Way.
    +
    +The Wrong Way is to sit down and write an option parser.  We've all done
    +that.
    +
    +The Right Way is to write some complex configurable program with so many
    +options that you hit the limit of your frustration just trying to
    +manage them all, and defer it with duct-tape solutions until you see
    +exactly to the core of the problem, and finally snap and write an
    +awesome option parser.
    +
    +If you want to write an option parser, don't write an option parser.
    +Write a package manager, or a source control system, or a service
    +restarter, or an operating system.  You probably won't end up with a
    +good one of those, but if you don't give up, and you are relentless and
    +diligent enough in your procrastination, you may just end up with a very
    +nice option parser.
    +
    +## USAGE
    +
    +```javascript
    +// my-program.js
    +var nopt = require("nopt")
    +  , Stream = require("stream").Stream
    +  , path = require("path")
    +  , knownOpts = { "foo" : [String, null]
    +                , "bar" : [Stream, Number]
    +                , "baz" : path
    +                , "bloo" : [ "big", "medium", "small" ]
    +                , "flag" : Boolean
    +                , "pick" : Boolean
    +                , "many1" : [String, Array]
    +                , "many2" : [path, Array]
    +                }
    +  , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
    +                 , "b7" : ["--bar", "7"]
    +                 , "m" : ["--bloo", "medium"]
    +                 , "p" : ["--pick"]
    +                 , "f" : ["--flag"]
    +                 }
    +             // everything is optional.
    +             // knownOpts and shorthands default to {}
    +             // arg list defaults to process.argv
    +             // slice defaults to 2
    +  , parsed = nopt(knownOpts, shortHands, process.argv, 2)
    +console.log(parsed)
    +```
    +
    +This would give you support for any of the following:
    +
    +```console
    +$ node my-program.js --foo "blerp" --no-flag
    +{ "foo" : "blerp", "flag" : false }
    +
    +$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag
    +{ bar: 7, foo: "Mr. Hand", flag: true }
    +
    +$ node my-program.js --foo "blerp" -f -----p
    +{ foo: "blerp", flag: true, pick: true }
    +
    +$ node my-program.js -fp --foofoo
    +{ foo: "Mr. Foo", flag: true, pick: true }
    +
    +$ node my-program.js --foofoo -- -fp  # -- stops the flag parsing.
    +{ foo: "Mr. Foo", argv: { remain: ["-fp"] } }
    +
    +$ node my-program.js --blatzk -fp # unknown opts are ok.
    +{ blatzk: true, flag: true, pick: true }
    +
    +$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value
    +{ blatzk: 1000, flag: true, pick: true }
    +
    +$ node my-program.js --no-blatzk -fp # unless they start with "no-"
    +{ blatzk: false, flag: true, pick: true }
    +
    +$ node my-program.js --baz b/a/z # known paths are resolved.
    +{ baz: "/Users/isaacs/b/a/z" }
    +
    +# if Array is one of the types, then it can take many
    +# values, and will always be an array.  The other types provided
    +# specify what types are allowed in the list.
    +
    +$ node my-program.js --many1 5 --many1 null --many1 foo
    +{ many1: ["5", "null", "foo"] }
    +
    +$ node my-program.js --many2 foo --many2 bar
    +{ many2: ["/path/to/foo", "path/to/bar"] }
    +```
    +
    +Read the tests at the bottom of `lib/nopt.js` for more examples of
    +what this puppy can do.
    +
    +## Types
    +
    +The following types are supported, and defined on `nopt.typeDefs`
    +
    +* String: A normal string.  No parsing is done.
    +* path: A file system path.  Gets resolved against cwd if not absolute.
    +* url: A url.  If it doesn't parse, it isn't accepted.
    +* Number: Must be numeric.
    +* Date: Must parse as a date. If it does, and `Date` is one of the options,
    +  then it will return a Date object, not a string.
    +* Boolean: Must be either `true` or `false`.  If an option is a boolean,
    +  then it does not need a value, and its presence will imply `true` as
    +  the value.  To negate boolean flags, do `--no-whatever` or `--whatever
    +  false`
    +* NaN: Means that the option is strictly not allowed.  Any value will
    +  fail.
    +* Stream: An object matching the "Stream" class in node.  Valuable
    +  for use when validating programmatically.  (npm uses this to let you
    +  supply any WriteStream on the `outfd` and `logfd` config options.)
    +* Array: If `Array` is specified as one of the types, then the value
    +  will be parsed as a list of options.  This means that multiple values
    +  can be specified, and that the value will always be an array.
    +
    +If a type is an array of values not on this list, then those are
    +considered valid values.  For instance, in the example above, the
    +`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`,
    +and any other value will be rejected.
    +
    +When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be
    +interpreted as their JavaScript equivalents.
    +
    +You can also mix types and values, or multiple types, in a list.  For
    +instance `{ blah: [Number, null] }` would allow a value to be set to
    +either a Number or null.  When types are ordered, this implies a
    +preference, and the first type that can be used to properly interpret
    +the value will be used.
    +
    +To define a new type, add it to `nopt.typeDefs`.  Each item in that
    +hash is an object with a `type` member and a `validate` method.  The
    +`type` member is an object that matches what goes in the type list.  The
    +`validate` method is a function that gets called with `validate(data,
    +key, val)`.  Validate methods should assign `data[key]` to the valid
    +value of `val` if it can be handled properly, or return boolean
    +`false` if it cannot.
    +
    +You can also call `nopt.clean(data, types, typeDefs)` to clean up a
    +config object and remove its invalid properties.
    +
    +## Error Handling
    +
    +By default, nopt outputs a warning to standard error when invalid values for
    +known options are found.  You can change this behavior by assigning a method
    +to `nopt.invalidHandler`.  This method will be called with
    +the offending `nopt.invalidHandler(key, val, types)`.
    +
    +If no `nopt.invalidHandler` is assigned, then it will console.error
    +its whining.  If it is assigned to boolean `false` then the warning is
    +suppressed.
    +
    +## Abbreviations
    +
    +Yes, they are supported.  If you define options like this:
    +
    +```javascript
    +{ "foolhardyelephants" : Boolean
    +, "pileofmonkeys" : Boolean }
    +```
    +
    +Then this will work:
    +
    +```bash
    +node program.js --foolhar --pil
    +node program.js --no-f --pileofmon
    +# etc.
    +```
    +
    +## Shorthands
    +
    +Shorthands are a hash of shorter option names to a snippet of args that
    +they expand to.
    +
    +If multiple one-character shorthands are all combined, and the
    +combination does not unambiguously match any other option or shorthand,
    +then they will be broken up into their constituent parts.  For example:
    +
    +```json
    +{ "s" : ["--loglevel", "silent"]
    +, "g" : "--global"
    +, "f" : "--force"
    +, "p" : "--parseable"
    +, "l" : "--long"
    +}
    +```
    +
    +```bash
    +npm ls -sgflp
    +# just like doing this:
    +npm ls --loglevel silent --global --force --long --parseable
    +```
    +
    +## The Rest of the args
    +
    +The config object returned by nopt is given a special member called
    +`argv`, which is an object with the following fields:
    +
    +* `remain`: The remaining args after all the parsing has occurred.
    +* `original`: The args as they originally appeared.
    +* `cooked`: The args after flags and shorthands are expanded.
    +
    +## Slicing
    +
    +Node programs are called with more or less the exact argv as it appears
    +in C land, after the v8 and node-specific options have been plucked off.
    +As such, `argv[0]` is always `node` and `argv[1]` is always the
    +JavaScript program being run.
    +
    +That's usually not very useful to you.  So they're sliced off by
    +default.  If you want them, then you can pass in `0` as the last
    +argument, or any other number that you'd like to slice off the start of
    +the list.
    diff --git a/node_modules/npm/node_modules/nopt/bin/nopt.js b/node_modules/npm/node_modules/nopt/bin/nopt.js
    new file mode 100755
    index 00000000..6ed20820
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/bin/nopt.js
    @@ -0,0 +1,29 @@
    +#!/usr/bin/env node
    +const nopt = require('../lib/nopt')
    +const path = require('path')
    +console.log('parsed', nopt({
    +  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,
    +}, {
    +  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'],
    +}, process.argv, 2))
    diff --git a/node_modules/npm/node_modules/nopt/lib/debug.js b/node_modules/npm/node_modules/nopt/lib/debug.js
    new file mode 100644
    index 00000000..544ab382
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/lib/debug.js
    @@ -0,0 +1,5 @@
    +/* istanbul ignore next */
    +module.exports = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG
    +  // eslint-disable-next-line no-console
    +  ? (...a) => console.error(...a)
    +  : () => {}
    diff --git a/node_modules/npm/node_modules/nopt/lib/nopt-lib.js b/node_modules/npm/node_modules/nopt/lib/nopt-lib.js
    new file mode 100644
    index 00000000..d3d1de02
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/lib/nopt-lib.js
    @@ -0,0 +1,479 @@
    +const abbrev = require('abbrev')
    +const debug = require('./debug')
    +const defaultTypeDefs = require('./type-defs')
    +
    +const hasOwn = (o, k) => Object.prototype.hasOwnProperty.call(o, k)
    +
    +const getType = (k, { types, dynamicTypes }) => {
    +  let hasType = hasOwn(types, k)
    +  let type = types[k]
    +  if (!hasType && typeof dynamicTypes === 'function') {
    +    const matchedType = dynamicTypes(k)
    +    if (matchedType !== undefined) {
    +      type = matchedType
    +      hasType = true
    +    }
    +  }
    +  return [hasType, type]
    +}
    +
    +const isTypeDef = (type, def) => def && type === def
    +const hasTypeDef = (type, def) => def && type.indexOf(def) !== -1
    +const doesNotHaveTypeDef = (type, def) => def && !hasTypeDef(type, def)
    +
    +function nopt (args, {
    +  types,
    +  shorthands,
    +  typeDefs,
    +  invalidHandler,
    +  typeDefault,
    +  dynamicTypes,
    +} = {}) {
    +  debug(types, shorthands, args, typeDefs)
    +
    +  const data = {}
    +  const argv = {
    +    remain: [],
    +    cooked: args,
    +    original: args.slice(0),
    +  }
    +
    +  parse(args, data, argv.remain, { typeDefs, types, dynamicTypes, shorthands })
    +
    +  // now data is full
    +  clean(data, { types, dynamicTypes, typeDefs, invalidHandler, typeDefault })
    +  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 = {},
    +  dynamicTypes,
    +  invalidHandler,
    +  typeDefault,
    +} = {}) {
    +  const StringType = typeDefs.String?.type
    +  const NumberType = typeDefs.Number?.type
    +  const ArrayType = typeDefs.Array?.type
    +  const BooleanType = typeDefs.Boolean?.type
    +  const DateType = typeDefs.Date?.type
    +
    +  const hasTypeDefault = typeof typeDefault !== 'undefined'
    +  if (!hasTypeDefault) {
    +    typeDefault = [false, true, null]
    +    if (StringType) {
    +      typeDefault.push(StringType)
    +    }
    +    if (ArrayType) {
    +      typeDefault.push(ArrayType)
    +    }
    +  }
    +
    +  const remove = {}
    +
    +  Object.keys(data).forEach((k) => {
    +    if (k === 'argv') {
    +      return
    +    }
    +    let val = data[k]
    +    debug('val=%j', val)
    +    const isArray = Array.isArray(val)
    +    let [hasType, rawType] = getType(k, { types, dynamicTypes })
    +    let type = rawType
    +    if (!isArray) {
    +      val = [val]
    +    }
    +    if (!type) {
    +      type = typeDefault
    +    }
    +    if (isTypeDef(type, ArrayType)) {
    +      type = typeDefault.concat(ArrayType)
    +    }
    +    if (!Array.isArray(type)) {
    +      type = [type]
    +    }
    +
    +    debug('val=%j', val)
    +    debug('types=', type)
    +    val = val.map((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) || hasTypeDef(type, BooleanType)))
    +            || (v === 'false' &&
    +               (~type.indexOf(false) || hasTypeDef(type, BooleanType)))) {
    +          v = JSON.parse(v)
    +          debug('jsonable %j', v)
    +        } else if (hasTypeDef(type, NumberType) && !isNaN(v)) {
    +          debug('convert to number', v)
    +          v = +v
    +        } else if (hasTypeDef(type, DateType) && !isNaN(Date.parse(v))) {
    +          debug('convert to date', v)
    +          v = new Date(v)
    +        }
    +      }
    +
    +      if (!hasType) {
    +        if (!hasTypeDefault) {
    +          return v
    +        }
    +        // if the default type has been passed in then we want to validate the
    +        // unknown data key instead of bailing out earlier. we also set the raw
    +        // type which is passed to the invalid handler so that it can be
    +        // determined if during validation if it is unknown vs invalid
    +        rawType = typeDefault
    +      }
    +
    +      // allow `--no-blah` to set 'blah' to null if null is allowed
    +      if (v === false && ~type.indexOf(null) &&
    +          !(~type.indexOf(false) || hasTypeDef(type, BooleanType))) {
    +        v = null
    +      }
    +
    +      const d = {}
    +      d[k] = v
    +      debug('prevalidated val', d, v, rawType)
    +      if (!validate(d, k, v, rawType, { typeDefs })) {
    +        if (invalidHandler) {
    +          invalidHandler(k, v, rawType, data)
    +        } else if (invalidHandler !== false) {
    +          debug('invalid: ' + k + '=' + v, rawType)
    +        }
    +        return remove
    +      }
    +      debug('validated v', d, v, rawType)
    +      return d[k]
    +    }).filter((v) => 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 && doesNotHaveTypeDef(type, ArrayType)) {
    +      debug('VAL HAS NO LENGTH, DELETE IT', val, k, type.indexOf(ArrayType))
    +      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 validate (data, k, val, type, { typeDefs } = {}) {
    +  const ArrayType = typeDefs?.Array?.type
    +  // arrays are lists of types.
    +  if (Array.isArray(type)) {
    +    for (let i = 0, l = type.length; i < l; i++) {
    +      if (isTypeDef(type[i], ArrayType)) {
    +        continue
    +      }
    +      if (validate(data, k, val, type[i], { typeDefs })) {
    +        return true
    +      }
    +    }
    +    delete data[k]
    +    return false
    +  }
    +
    +  // an array of anything?
    +  if (isTypeDef(type, ArrayType)) {
    +    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)
    +    data[k] = val
    +    return true
    +  }
    +
    +  // now go through the list of typeDefs, validate against each one.
    +  let ok = false
    +  const types = Object.keys(typeDefs)
    +  for (let i = 0, l = types.length; i < l; i++) {
    +    debug('test type %j %j %j', k, val, types[i])
    +    const t = typeDefs[types[i]]
    +    if (t && (
    +      (type && type.name && t.type && t.type.name) ?
    +        (type.name === t.type.name) :
    +        (type === t.type)
    +    )) {
    +      const d = {}
    +      ok = t.validate(d, k, val) !== false
    +      val = d[k]
    +      if (ok) {
    +        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 = {},
    +  typeDefs = {},
    +  shorthands = {},
    +  dynamicTypes,
    +} = {}) {
    +  const StringType = typeDefs.String?.type
    +  const NumberType = typeDefs.Number?.type
    +  const ArrayType = typeDefs.Array?.type
    +  const BooleanType = typeDefs.Boolean?.type
    +
    +  debug('parse', args, data, remain)
    +
    +  const abbrevs = abbrev(Object.keys(types))
    +  debug('abbrevs=%j', abbrevs)
    +  const shortAbbr = abbrev(Object.keys(shorthands))
    +
    +  for (let i = 0; i < args.length; i++) {
    +    let 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
    +    }
    +    let hadEq = false
    +    if (arg.charAt(0) === '-' && arg.length > 1) {
    +      const at = arg.indexOf('=')
    +      if (at > -1) {
    +        hadEq = true
    +        const 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.
    +      const shRes = resolveShort(arg, shortAbbr, abbrevs, { shorthands })
    +      debug('arg=%j shRes=%j', arg, shRes)
    +      if (shRes) {
    +        args.splice.apply(args, [i, 1].concat(shRes))
    +        if (arg !== shRes[0]) {
    +          i--
    +          continue
    +        }
    +      }
    +      arg = arg.replace(/^-+/, '')
    +      let no = null
    +      while (arg.toLowerCase().indexOf('no-') === 0) {
    +        no = !no
    +        arg = arg.slice(3)
    +      }
    +
    +      if (abbrevs[arg]) {
    +        arg = abbrevs[arg]
    +      }
    +
    +      let [hasType, argType] = getType(arg, { types, dynamicTypes })
    +      let isTypeArray = Array.isArray(argType)
    +      if (isTypeArray && argType.length === 1) {
    +        isTypeArray = false
    +        argType = argType[0]
    +      }
    +
    +      let isArray = isTypeDef(argType, ArrayType) ||
    +        isTypeArray && hasTypeDef(argType, ArrayType)
    +
    +      // allow unknown things to be arrays if specified multiple times.
    +      if (!hasType && hasOwn(data, arg)) {
    +        if (!Array.isArray(data[arg])) {
    +          data[arg] = [data[arg]]
    +        }
    +        isArray = true
    +      }
    +
    +      let val
    +      let la = args[i + 1]
    +
    +      const isBool = typeof no === 'boolean' ||
    +        isTypeDef(argType, BooleanType) ||
    +        isTypeArray && hasTypeDef(argType, BooleanType) ||
    +        (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) &&
    +                      hasTypeDef(argType, NumberType)) {
    +            // number
    +            val = +la
    +            i++
    +          } else if (!la.match(/^-[^-]/) && hasTypeDef(argType, StringType)) {
    +            // string
    +            val = la
    +            i++
    +          }
    +        }
    +
    +        if (isArray) {
    +          (data[arg] = data[arg] || []).push(val)
    +        } else {
    +          data[arg] = val
    +        }
    +
    +        continue
    +      }
    +
    +      if (isTypeDef(argType, StringType)) {
    +        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)
    +  }
    +}
    +
    +const SINGLES = Symbol('singles')
    +const singleCharacters = (arg, shorthands) => {
    +  let singles = shorthands[SINGLES]
    +  if (!singles) {
    +    singles = Object.keys(shorthands).filter((s) => s.length === 1).reduce((l, r) => {
    +      l[r] = true
    +      return l
    +    }, {})
    +    shorthands[SINGLES] = singles
    +    debug('shorthand singles', singles)
    +  }
    +  const chrs = arg.split('').filter((c) => singles[c])
    +  return chrs.join('') === arg ? chrs : null
    +}
    +
    +function resolveShort (arg, ...rest) {
    +  const { types = {}, shorthands = {} } = rest.length ? rest.pop() : {}
    +  const shortAbbr = rest[0] ?? abbrev(Object.keys(shorthands))
    +  const abbrevs = rest[1] ?? abbrev(Object.keys(types))
    +
    +  // 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
    +  const chrs = singleCharacters(arg, shorthands)
    +  if (chrs) {
    +    return chrs.map((c) => shorthands[c]).reduce((l, r) => 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]
    +}
    +
    +module.exports = {
    +  nopt,
    +  clean,
    +  parse,
    +  validate,
    +  resolveShort,
    +  typeDefs: defaultTypeDefs,
    +}
    diff --git a/node_modules/npm/node_modules/nopt/lib/nopt.js b/node_modules/npm/node_modules/nopt/lib/nopt.js
    new file mode 100644
    index 00000000..37f01a08
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/lib/nopt.js
    @@ -0,0 +1,30 @@
    +const lib = require('./nopt-lib')
    +const defaultTypeDefs = require('./type-defs')
    +
    +// This is the version of nopt's API that requires setting typeDefs and invalidHandler
    +// on the required `nopt` object since it is a singleton. To not do a breaking change
    +// an API that requires all options be passed in is located in `nopt-lib.js` and
    +// exported here as lib.
    +// TODO(breaking): make API only work in non-singleton mode
    +
    +module.exports = exports = nopt
    +exports.clean = clean
    +exports.typeDefs = defaultTypeDefs
    +exports.lib = lib
    +
    +function nopt (types, shorthands, args = process.argv, slice = 2) {
    +  return lib.nopt(args.slice(slice), {
    +    types: types || {},
    +    shorthands: shorthands || {},
    +    typeDefs: exports.typeDefs,
    +    invalidHandler: exports.invalidHandler,
    +  })
    +}
    +
    +function clean (data, types, typeDefs = exports.typeDefs) {
    +  return lib.clean(data, {
    +    types: types || {},
    +    typeDefs,
    +    invalidHandler: exports.invalidHandler,
    +  })
    +}
    diff --git a/node_modules/npm/node_modules/nopt/lib/type-defs.js b/node_modules/npm/node_modules/nopt/lib/type-defs.js
    new file mode 100644
    index 00000000..608352ee
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/lib/type-defs.js
    @@ -0,0 +1,91 @@
    +const url = require('url')
    +const path = require('path')
    +const Stream = require('stream').Stream
    +const os = require('os')
    +const debug = require('./debug')
    +
    +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)
    +
    +  const isWin = process.platform === 'win32'
    +  const homePattern = isWin ? /^~(\/|\\)/ : /^~\//
    +  const 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) {
    +  const 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 (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
    +}
    +
    +module.exports = {
    +  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 },
    +  Array: { type: Array },
    +}
    diff --git a/node_modules/npm/node_modules/nopt/node_modules/abbrev/LICENSE b/node_modules/npm/node_modules/nopt/node_modules/abbrev/LICENSE
    new file mode 100644
    index 00000000..9bcfa9d7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/node_modules/abbrev/LICENSE
    @@ -0,0 +1,46 @@
    +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/npm/node_modules/nopt/node_modules/abbrev/lib/index.js b/node_modules/npm/node_modules/nopt/node_modules/abbrev/lib/index.js
    new file mode 100644
    index 00000000..9f48801f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/node_modules/abbrev/lib/index.js
    @@ -0,0 +1,50 @@
    +module.exports = abbrev
    +
    +function abbrev (...args) {
    +  let list = args.length === 1 || Array.isArray(args[0]) ? args[0] : args
    +
    +  for (let i = 0, l = list.length; i < l; i++) {
    +    list[i] = typeof list[i] === 'string' ? list[i] : String(list[i])
    +  }
    +
    +  // sort them lexicographically, so that they're next to their nearest kin
    +  list = list.sort(lexSort)
    +
    +  // walk through each, seeing how much it has in common with the next and previous
    +  const abbrevs = {}
    +  let prev = ''
    +  for (let ii = 0, ll = list.length; ii < ll; ii++) {
    +    const current = list[ii]
    +    const next = list[ii + 1] || ''
    +    let nextMatches = true
    +    let prevMatches = true
    +    if (current === next) {
    +      continue
    +    }
    +    let j = 0
    +    const cl = current.length
    +    for (; j < cl; j++) {
    +      const 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 (let a = current.slice(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/npm/node_modules/nopt/node_modules/abbrev/package.json b/node_modules/npm/node_modules/nopt/node_modules/abbrev/package.json
    new file mode 100644
    index 00000000..e2640044
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/node_modules/abbrev/package.json
    @@ -0,0 +1,43 @@
    +{
    +  "name": "abbrev",
    +  "version": "2.0.0",
    +  "description": "Like ruby's abbrev module, but in js",
    +  "author": "GitHub Inc.",
    +  "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",
    +    "snap": "tap",
    +    "posttest": "npm run lint"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "https://github.com/npm/abbrev-js.git"
    +  },
    +  "license": "ISC",
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^4.0.0",
    +    "@npmcli/template-oss": "4.8.0",
    +    "tap": "^16.3.0"
    +  },
    +  "tap": {
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "engines": {
    +    "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.8.0"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/nopt/package.json b/node_modules/npm/node_modules/nopt/package.json
    new file mode 100644
    index 00000000..508b8e28
    --- /dev/null
    +++ b/node_modules/npm/node_modules/nopt/package.json
    @@ -0,0 +1,52 @@
    +{
    +  "name": "nopt",
    +  "version": "8.0.0",
    +  "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.",
    +  "author": "GitHub Inc.",
    +  "main": "lib/nopt.js",
    +  "scripts": {
    +    "test": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "lintfix": "npm run eslint -- --fix",
    +    "snap": "tap",
    +    "posttest": "npm run lint",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/nopt.git"
    +  },
    +  "bin": {
    +    "nopt": "bin/nopt.js"
    +  },
    +  "license": "ISC",
    +  "dependencies": {
    +    "abbrev": "^2.0.0"
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "tap": "^16.3.0"
    +  },
    +  "tap": {
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "windowsCI": false,
    +    "version": "4.23.3",
    +    "publish": true
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/normalize-package-data/LICENSE b/node_modules/npm/node_modules/normalize-package-data/LICENSE
    new file mode 100644
    index 00000000..19d1364a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/normalize-package-data/LICENSE
    @@ -0,0 +1,15 @@
    +This package contains code originally written by Isaac Z. Schlueter.
    +Used with permission.
    +
    +Copyright (c) Meryn Stol ("Author")
    +All rights reserved.
    +
    +The BSD License
    +
    +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/npm/node_modules/normalize-package-data/lib/extract_description.js b/node_modules/npm/node_modules/normalize-package-data/lib/extract_description.js
    new file mode 100644
    index 00000000..631966b5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/normalize-package-data/lib/extract_description.js
    @@ -0,0 +1,24 @@
    +module.exports = extractDescription
    +
    +// Extracts description from contents of a readme file in markdown format
    +function extractDescription (d) {
    +  if (!d) {
    +    return
    +  }
    +  if (d === 'ERROR: No README data found!') {
    +    return
    +  }
    +  // the first block of text before the first heading
    +  // that isn't the first line heading
    +  d = d.trim().split('\n')
    +  let s = 0
    +  while (d[s] && d[s].trim().match(/^(#|$)/)) {
    +    s++
    +  }
    +  const l = d.length
    +  let e = s + 1
    +  while (e < l && d[e].trim()) {
    +    e++
    +  }
    +  return d.slice(s, e).join(' ').trim()
    +}
    diff --git a/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js b/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js
    new file mode 100644
    index 00000000..1c30cad6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js
    @@ -0,0 +1,475 @@
    +var isValidSemver = require('semver/functions/valid')
    +var cleanSemver = require('semver/functions/clean')
    +var validateLicense = require('validate-npm-package-license')
    +var hostedGitInfo = require('hosted-git-info')
    +var moduleBuiltin = require('node:module')
    +var depTypes = ['dependencies', 'devDependencies', 'optionalDependencies']
    +var extractDescription = require('./extract_description')
    +var url = require('url')
    +var typos = require('./typos.json')
    +
    +var isEmail = str => str.includes('@') && (str.indexOf('@') < str.lastIndexOf('.'))
    +
    +module.exports = {
    +  // default warning function
    +  warn: function () {},
    +
    +  fixRepositoryField: function (data) {
    +    if (data.repositories) {
    +      this.warn('repositories')
    +      data.repository = data.repositories[0]
    +    }
    +    if (!data.repository) {
    +      return this.warn('missingRepository')
    +    }
    +    if (typeof data.repository === 'string') {
    +      data.repository = {
    +        type: 'git',
    +        url: data.repository,
    +      }
    +    }
    +    var r = data.repository.url || ''
    +    if (r) {
    +      var hosted = hostedGitInfo.fromUrl(r)
    +      if (hosted) {
    +        r = data.repository.url
    +          = hosted.getDefaultRepresentation() === 'shortcut' ? hosted.https() : hosted.toString()
    +      }
    +    }
    +
    +    if (r.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)) {
    +      this.warn('brokenGitUrl', r)
    +    }
    +  },
    +
    +  fixTypos: function (data) {
    +    Object.keys(typos.topLevel).forEach(function (d) {
    +      if (Object.prototype.hasOwnProperty.call(data, d)) {
    +        this.warn('typo', d, typos.topLevel[d])
    +      }
    +    }, this)
    +  },
    +
    +  fixScriptsField: function (data) {
    +    if (!data.scripts) {
    +      return
    +    }
    +    if (typeof data.scripts !== 'object') {
    +      this.warn('nonObjectScripts')
    +      delete data.scripts
    +      return
    +    }
    +    Object.keys(data.scripts).forEach(function (k) {
    +      if (typeof data.scripts[k] !== 'string') {
    +        this.warn('nonStringScript')
    +        delete data.scripts[k]
    +      } else if (typos.script[k] && !data.scripts[typos.script[k]]) {
    +        this.warn('typo', k, typos.script[k], 'scripts')
    +      }
    +    }, this)
    +  },
    +
    +  fixFilesField: function (data) {
    +    var files = data.files
    +    if (files && !Array.isArray(files)) {
    +      this.warn('nonArrayFiles')
    +      delete data.files
    +    } else if (data.files) {
    +      data.files = data.files.filter(function (file) {
    +        if (!file || typeof file !== 'string') {
    +          this.warn('invalidFilename', file)
    +          return false
    +        } else {
    +          return true
    +        }
    +      }, this)
    +    }
    +  },
    +
    +  fixBinField: function (data) {
    +    if (!data.bin) {
    +      return
    +    }
    +    if (typeof data.bin === 'string') {
    +      var b = {}
    +      var match
    +      if (match = data.name.match(/^@[^/]+[/](.*)$/)) {
    +        b[match[1]] = data.bin
    +      } else {
    +        b[data.name] = data.bin
    +      }
    +      data.bin = b
    +    }
    +  },
    +
    +  fixManField: function (data) {
    +    if (!data.man) {
    +      return
    +    }
    +    if (typeof data.man === 'string') {
    +      data.man = [data.man]
    +    }
    +  },
    +  fixBundleDependenciesField: function (data) {
    +    var bdd = 'bundledDependencies'
    +    var bd = 'bundleDependencies'
    +    if (data[bdd] && !data[bd]) {
    +      data[bd] = data[bdd]
    +      delete data[bdd]
    +    }
    +    if (data[bd] && !Array.isArray(data[bd])) {
    +      this.warn('nonArrayBundleDependencies')
    +      delete data[bd]
    +    } else if (data[bd]) {
    +      data[bd] = data[bd].filter(function (filtered) {
    +        if (!filtered || typeof filtered !== 'string') {
    +          this.warn('nonStringBundleDependency', filtered)
    +          return false
    +        } else {
    +          if (!data.dependencies) {
    +            data.dependencies = {}
    +          }
    +          if (!Object.prototype.hasOwnProperty.call(data.dependencies, filtered)) {
    +            this.warn('nonDependencyBundleDependency', filtered)
    +            data.dependencies[filtered] = '*'
    +          }
    +          return true
    +        }
    +      }, this)
    +    }
    +  },
    +
    +  fixDependencies: function (data) {
    +    objectifyDeps(data, this.warn)
    +    addOptionalDepsToDeps(data, this.warn)
    +    this.fixBundleDependenciesField(data)
    +
    +    ;['dependencies', 'devDependencies'].forEach(function (deps) {
    +      if (!(deps in data)) {
    +        return
    +      }
    +      if (!data[deps] || typeof data[deps] !== 'object') {
    +        this.warn('nonObjectDependencies', deps)
    +        delete data[deps]
    +        return
    +      }
    +      Object.keys(data[deps]).forEach(function (d) {
    +        var r = data[deps][d]
    +        if (typeof r !== 'string') {
    +          this.warn('nonStringDependency', d, JSON.stringify(r))
    +          delete data[deps][d]
    +        }
    +        var hosted = hostedGitInfo.fromUrl(data[deps][d])
    +        if (hosted) {
    +          data[deps][d] = hosted.toString()
    +        }
    +      }, this)
    +    }, this)
    +  },
    +
    +  fixModulesField: function (data) {
    +    if (data.modules) {
    +      this.warn('deprecatedModules')
    +      delete data.modules
    +    }
    +  },
    +
    +  fixKeywordsField: function (data) {
    +    if (typeof data.keywords === 'string') {
    +      data.keywords = data.keywords.split(/,\s+/)
    +    }
    +    if (data.keywords && !Array.isArray(data.keywords)) {
    +      delete data.keywords
    +      this.warn('nonArrayKeywords')
    +    } else if (data.keywords) {
    +      data.keywords = data.keywords.filter(function (kw) {
    +        if (typeof kw !== 'string' || !kw) {
    +          this.warn('nonStringKeyword')
    +          return false
    +        } else {
    +          return true
    +        }
    +      }, this)
    +    }
    +  },
    +
    +  fixVersionField: function (data, strict) {
    +    // allow "loose" semver 1.0 versions in non-strict mode
    +    // enforce strict semver 2.0 compliance in strict mode
    +    var loose = !strict
    +    if (!data.version) {
    +      data.version = ''
    +      return true
    +    }
    +    if (!isValidSemver(data.version, loose)) {
    +      throw new Error('Invalid version: "' + data.version + '"')
    +    }
    +    data.version = cleanSemver(data.version, loose)
    +    return true
    +  },
    +
    +  fixPeople: function (data) {
    +    modifyPeople(data, unParsePerson)
    +    modifyPeople(data, parsePerson)
    +  },
    +
    +  fixNameField: function (data, options) {
    +    if (typeof options === 'boolean') {
    +      options = { strict: options }
    +    } else if (typeof options === 'undefined') {
    +      options = {}
    +    }
    +    var strict = options.strict
    +    if (!data.name && !strict) {
    +      data.name = ''
    +      return
    +    }
    +    if (typeof data.name !== 'string') {
    +      throw new Error('name field must be a string.')
    +    }
    +    if (!strict) {
    +      data.name = data.name.trim()
    +    }
    +    ensureValidName(data.name, strict, options.allowLegacyCase)
    +    if (moduleBuiltin.builtinModules.includes(data.name)) {
    +      this.warn('conflictingName', data.name)
    +    }
    +  },
    +
    +  fixDescriptionField: function (data) {
    +    if (data.description && typeof data.description !== 'string') {
    +      this.warn('nonStringDescription')
    +      delete data.description
    +    }
    +    if (data.readme && !data.description) {
    +      data.description = extractDescription(data.readme)
    +    }
    +    if (data.description === undefined) {
    +      delete data.description
    +    }
    +    if (!data.description) {
    +      this.warn('missingDescription')
    +    }
    +  },
    +
    +  fixReadmeField: function (data) {
    +    if (!data.readme) {
    +      this.warn('missingReadme')
    +      data.readme = 'ERROR: No README data found!'
    +    }
    +  },
    +
    +  fixBugsField: function (data) {
    +    if (!data.bugs && data.repository && data.repository.url) {
    +      var hosted = hostedGitInfo.fromUrl(data.repository.url)
    +      if (hosted && hosted.bugs()) {
    +        data.bugs = { url: hosted.bugs() }
    +      }
    +    } else if (data.bugs) {
    +      if (typeof data.bugs === 'string') {
    +        if (isEmail(data.bugs)) {
    +          data.bugs = { email: data.bugs }
    +        /* eslint-disable-next-line node/no-deprecated-api */
    +        } else if (url.parse(data.bugs).protocol) {
    +          data.bugs = { url: data.bugs }
    +        } else {
    +          this.warn('nonEmailUrlBugsString')
    +        }
    +      } else {
    +        bugsTypos(data.bugs, this.warn)
    +        var oldBugs = data.bugs
    +        data.bugs = {}
    +        if (oldBugs.url) {
    +          /* eslint-disable-next-line node/no-deprecated-api */
    +          if (typeof (oldBugs.url) === 'string' && url.parse(oldBugs.url).protocol) {
    +            data.bugs.url = oldBugs.url
    +          } else {
    +            this.warn('nonUrlBugsUrlField')
    +          }
    +        }
    +        if (oldBugs.email) {
    +          if (typeof (oldBugs.email) === 'string' && isEmail(oldBugs.email)) {
    +            data.bugs.email = oldBugs.email
    +          } else {
    +            this.warn('nonEmailBugsEmailField')
    +          }
    +        }
    +      }
    +      if (!data.bugs.email && !data.bugs.url) {
    +        delete data.bugs
    +        this.warn('emptyNormalizedBugs')
    +      }
    +    }
    +  },
    +
    +  fixHomepageField: function (data) {
    +    if (!data.homepage && data.repository && data.repository.url) {
    +      var hosted = hostedGitInfo.fromUrl(data.repository.url)
    +      if (hosted && hosted.docs()) {
    +        data.homepage = hosted.docs()
    +      }
    +    }
    +    if (!data.homepage) {
    +      return
    +    }
    +
    +    if (typeof data.homepage !== 'string') {
    +      this.warn('nonUrlHomepage')
    +      return delete data.homepage
    +    }
    +    /* eslint-disable-next-line node/no-deprecated-api */
    +    if (!url.parse(data.homepage).protocol) {
    +      data.homepage = 'http://' + data.homepage
    +    }
    +  },
    +
    +  fixLicenseField: function (data) {
    +    const license = data.license || data.licence
    +    if (!license) {
    +      return this.warn('missingLicense')
    +    }
    +    if (
    +      typeof (license) !== 'string' ||
    +      license.length < 1 ||
    +      license.trim() === ''
    +    ) {
    +      return this.warn('invalidLicense')
    +    }
    +    if (!validateLicense(license).validForNewPackages) {
    +      return this.warn('invalidLicense')
    +    }
    +  },
    +}
    +
    +function isValidScopedPackageName (spec) {
    +  if (spec.charAt(0) !== '@') {
    +    return false
    +  }
    +
    +  var rest = spec.slice(1).split('/')
    +  if (rest.length !== 2) {
    +    return false
    +  }
    +
    +  return rest[0] && rest[1] &&
    +    rest[0] === encodeURIComponent(rest[0]) &&
    +    rest[1] === encodeURIComponent(rest[1])
    +}
    +
    +function isCorrectlyEncodedName (spec) {
    +  return !spec.match(/[/@\s+%:]/) &&
    +    spec === encodeURIComponent(spec)
    +}
    +
    +function ensureValidName (name, strict, allowLegacyCase) {
    +  if (name.charAt(0) === '.' ||
    +      !(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) ||
    +      (strict && (!allowLegacyCase) && name !== name.toLowerCase()) ||
    +      name.toLowerCase() === 'node_modules' ||
    +      name.toLowerCase() === 'favicon.ico') {
    +    throw new Error('Invalid name: ' + JSON.stringify(name))
    +  }
    +}
    +
    +function modifyPeople (data, fn) {
    +  if (data.author) {
    +    data.author = fn(data.author)
    +  }['maintainers', 'contributors'].forEach(function (set) {
    +    if (!Array.isArray(data[set])) {
    +      return
    +    }
    +    data[set] = data[set].map(fn)
    +  })
    +  return data
    +}
    +
    +function unParsePerson (person) {
    +  if (typeof person === 'string') {
    +    return person
    +  }
    +  var name = person.name || ''
    +  var u = person.url || person.web
    +  var wrappedUrl = u ? (' (' + u + ')') : ''
    +  var e = person.email || person.mail
    +  var wrappedEmail = e ? (' <' + e + '>') : ''
    +  return name + wrappedEmail + wrappedUrl
    +}
    +
    +function parsePerson (person) {
    +  if (typeof person !== 'string') {
    +    return person
    +  }
    +  var matchedName = person.match(/^([^(<]+)/)
    +  var matchedUrl = person.match(/\(([^()]+)\)/)
    +  var matchedEmail = person.match(/<([^<>]+)>/)
    +  var obj = {}
    +  if (matchedName && matchedName[0].trim()) {
    +    obj.name = matchedName[0].trim()
    +  }
    +  if (matchedEmail) {
    +    obj.email = matchedEmail[1]
    +  }
    +  if (matchedUrl) {
    +    obj.url = matchedUrl[1]
    +  }
    +  return obj
    +}
    +
    +function addOptionalDepsToDeps (data) {
    +  var o = data.optionalDependencies
    +  if (!o) {
    +    return
    +  }
    +  var d = data.dependencies || {}
    +  Object.keys(o).forEach(function (k) {
    +    d[k] = o[k]
    +  })
    +  data.dependencies = d
    +}
    +
    +function depObjectify (deps, type, warn) {
    +  if (!deps) {
    +    return {}
    +  }
    +  if (typeof deps === 'string') {
    +    deps = deps.trim().split(/[\n\r\s\t ,]+/)
    +  }
    +  if (!Array.isArray(deps)) {
    +    return deps
    +  }
    +  warn('deprecatedArrayDependencies', type)
    +  var o = {}
    +  deps.filter(function (d) {
    +    return typeof d === 'string'
    +  }).forEach(function (d) {
    +    d = d.trim().split(/(:?[@\s><=])/)
    +    var dn = d.shift()
    +    var dv = d.join('')
    +    dv = dv.trim()
    +    dv = dv.replace(/^@/, '')
    +    o[dn] = dv
    +  })
    +  return o
    +}
    +
    +function objectifyDeps (data, warn) {
    +  depTypes.forEach(function (type) {
    +    if (!data[type]) {
    +      return
    +    }
    +    data[type] = depObjectify(data[type], type, warn)
    +  })
    +}
    +
    +function bugsTypos (bugs, warn) {
    +  if (!bugs) {
    +    return
    +  }
    +  Object.keys(bugs).forEach(function (k) {
    +    if (typos.bugs[k]) {
    +      warn('typo', k, typos.bugs[k], 'bugs')
    +      bugs[typos.bugs[k]] = bugs[k]
    +      delete bugs[k]
    +    }
    +  })
    +}
    diff --git a/node_modules/npm/node_modules/normalize-package-data/lib/make_warning.js b/node_modules/npm/node_modules/normalize-package-data/lib/make_warning.js
    new file mode 100644
    index 00000000..3be9c865
    --- /dev/null
    +++ b/node_modules/npm/node_modules/normalize-package-data/lib/make_warning.js
    @@ -0,0 +1,22 @@
    +var util = require('util')
    +var messages = require('./warning_messages.json')
    +
    +module.exports = function () {
    +  var args = Array.prototype.slice.call(arguments, 0)
    +  var warningName = args.shift()
    +  if (warningName === 'typo') {
    +    return makeTypoWarning.apply(null, args)
    +  } else {
    +    var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'"
    +    args.unshift(msgTemplate)
    +    return util.format.apply(null, args)
    +  }
    +}
    +
    +function makeTypoWarning (providedName, probableName, field) {
    +  if (field) {
    +    providedName = field + "['" + providedName + "']"
    +    probableName = field + "['" + probableName + "']"
    +  }
    +  return util.format(messages.typo, providedName, probableName)
    +}
    diff --git a/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js b/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js
    new file mode 100644
    index 00000000..e806f110
    --- /dev/null
    +++ b/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js
    @@ -0,0 +1,48 @@
    +module.exports = normalize
    +
    +var fixer = require('./fixer')
    +normalize.fixer = fixer
    +
    +var makeWarning = require('./make_warning')
    +
    +var fieldsToFix = ['name', 'version', 'description', 'repository', 'modules', 'scripts',
    +  'files', 'bin', 'man', 'bugs', 'keywords', 'readme', 'homepage', 'license']
    +var otherThingsToFix = ['dependencies', 'people', 'typos']
    +
    +var thingsToFix = fieldsToFix.map(function (fieldName) {
    +  return ucFirst(fieldName) + 'Field'
    +})
    +// two ways to do this in CoffeeScript on only one line, sub-70 chars:
    +// thingsToFix = fieldsToFix.map (name) -> ucFirst(name) + "Field"
    +// thingsToFix = (ucFirst(name) + "Field" for name in fieldsToFix)
    +thingsToFix = thingsToFix.concat(otherThingsToFix)
    +
    +function normalize (data, warn, strict) {
    +  if (warn === true) {
    +    warn = null
    +    strict = true
    +  }
    +  if (!strict) {
    +    strict = false
    +  }
    +  if (!warn || data.private) {
    +    warn = function () { /* noop */ }
    +  }
    +
    +  if (data.scripts &&
    +      data.scripts.install === 'node-gyp rebuild' &&
    +      !data.scripts.preinstall) {
    +    data.gypfile = true
    +  }
    +  fixer.warn = function () {
    +    warn(makeWarning.apply(null, arguments))
    +  }
    +  thingsToFix.forEach(function (thingName) {
    +    fixer['fix' + ucFirst(thingName)](data, strict)
    +  })
    +  data._id = data.name + '@' + data.version
    +}
    +
    +function ucFirst (string) {
    +  return string.charAt(0).toUpperCase() + string.slice(1)
    +}
    diff --git a/node_modules/npm/node_modules/normalize-package-data/lib/safe_format.js b/node_modules/npm/node_modules/normalize-package-data/lib/safe_format.js
    new file mode 100644
    index 00000000..5fc888e5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/normalize-package-data/lib/safe_format.js
    @@ -0,0 +1,11 @@
    +var util = require('util')
    +
    +module.exports = function () {
    +  var args = Array.prototype.slice.call(arguments, 0)
    +  args.forEach(function (arg) {
    +    if (!arg) {
    +      throw new TypeError('Bad arguments.')
    +    }
    +  })
    +  return util.format.apply(null, arguments)
    +}
    diff --git a/node_modules/npm/node_modules/normalize-package-data/lib/typos.json b/node_modules/npm/node_modules/normalize-package-data/lib/typos.json
    new file mode 100644
    index 00000000..7f9dd283
    --- /dev/null
    +++ b/node_modules/npm/node_modules/normalize-package-data/lib/typos.json
    @@ -0,0 +1,25 @@
    +{
    +  "topLevel": {
    +    "dependancies": "dependencies"
    +   ,"dependecies": "dependencies"
    +   ,"depdenencies": "dependencies"
    +   ,"devEependencies": "devDependencies"
    +   ,"depends": "dependencies"
    +   ,"dev-dependencies": "devDependencies"
    +   ,"devDependences": "devDependencies"
    +   ,"devDepenencies": "devDependencies"
    +   ,"devdependencies": "devDependencies"
    +   ,"repostitory": "repository"
    +   ,"repo": "repository"
    +   ,"prefereGlobal": "preferGlobal"
    +   ,"hompage": "homepage"
    +   ,"hampage": "homepage"
    +   ,"autohr": "author"
    +   ,"autor": "author"
    +   ,"contributers": "contributors"
    +   ,"publicationConfig": "publishConfig"
    +   ,"script": "scripts"
    +  },
    +  "bugs": { "web": "url", "name": "url" },
    +  "script": { "server": "start", "tests": "test" }
    +}
    diff --git a/node_modules/npm/node_modules/normalize-package-data/lib/warning_messages.json b/node_modules/npm/node_modules/normalize-package-data/lib/warning_messages.json
    new file mode 100644
    index 00000000..4890f506
    --- /dev/null
    +++ b/node_modules/npm/node_modules/normalize-package-data/lib/warning_messages.json
    @@ -0,0 +1,30 @@
    +{
    +  "repositories": "'repositories' (plural) Not supported. Please pick one as the 'repository' field"
    +  ,"missingRepository": "No repository field."
    +  ,"brokenGitUrl": "Probably broken git url: %s"
    +  ,"nonObjectScripts": "scripts must be an object"
    +  ,"nonStringScript": "script values must be string commands"
    +  ,"nonArrayFiles": "Invalid 'files' member"
    +  ,"invalidFilename": "Invalid filename in 'files' list: %s"
    +  ,"nonArrayBundleDependencies": "Invalid 'bundleDependencies' list. Must be array of package names"
    +  ,"nonStringBundleDependency": "Invalid bundleDependencies member: %s"
    +  ,"nonDependencyBundleDependency": "Non-dependency in bundleDependencies: %s"
    +  ,"nonObjectDependencies": "%s field must be an object"
    +  ,"nonStringDependency": "Invalid dependency: %s %s"
    +  ,"deprecatedArrayDependencies": "specifying %s as array is deprecated"
    +  ,"deprecatedModules": "modules field is deprecated"
    +  ,"nonArrayKeywords": "keywords should be an array of strings"
    +  ,"nonStringKeyword": "keywords should be an array of strings"
    +  ,"conflictingName": "%s is also the name of a node core module."
    +  ,"nonStringDescription": "'description' field should be a string"
    +  ,"missingDescription": "No description"
    +  ,"missingReadme": "No README data"
    +  ,"missingLicense": "No license field."
    +  ,"nonEmailUrlBugsString": "Bug string field must be url, email, or {email,url}"
    +  ,"nonUrlBugsUrlField": "bugs.url field must be a string url. Deleted."
    +  ,"nonEmailBugsEmailField": "bugs.email field must be a string email. Deleted."
    +  ,"emptyNormalizedBugs": "Normalized value of bugs field is an empty object. Deleted."
    +  ,"nonUrlHomepage": "homepage field must be a string url. Deleted."
    +  ,"invalidLicense": "license should be a valid SPDX license expression"
    +  ,"typo": "%s should probably be %s."
    +}
    diff --git a/node_modules/npm/node_modules/normalize-package-data/package.json b/node_modules/npm/node_modules/normalize-package-data/package.json
    new file mode 100644
    index 00000000..a849ea3a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/normalize-package-data/package.json
    @@ -0,0 +1,56 @@
    +{
    +  "name": "normalize-package-data",
    +  "version": "7.0.0",
    +  "author": "GitHub Inc.",
    +  "description": "Normalizes data that can be found in package.json files.",
    +  "license": "BSD-2-Clause",
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/normalize-package-data.git"
    +  },
    +  "main": "lib/normalize.js",
    +  "scripts": {
    +    "test": "tap",
    +    "npmclilint": "npmcli-lint",
    +    "lint": "npm run eslint",
    +    "lintfix": "npm run eslint -- --fix",
    +    "posttest": "npm run lint",
    +    "postsnap": "npm run lintfix --",
    +    "postlint": "template-oss-check",
    +    "snap": "tap",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "dependencies": {
    +    "hosted-git-info": "^8.0.0",
    +    "semver": "^7.3.5",
    +    "validate-npm-package-license": "^3.0.4"
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "tap": "^16.0.1"
    +  },
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": "true"
    +  },
    +  "tap": {
    +    "branches": 86,
    +    "functions": 92,
    +    "lines": 86,
    +    "statements": 86,
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-audit-report/LICENSE b/node_modules/npm/node_modules/npm-audit-report/LICENSE
    new file mode 100644
    index 00000000..8d28acf8
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-audit-report/LICENSE
    @@ -0,0 +1,16 @@
    +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/npm/node_modules/npm-audit-report/lib/colors.js b/node_modules/npm/node_modules/npm-audit-report/lib/colors.js
    new file mode 100644
    index 00000000..e6688f2f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-audit-report/lib/colors.js
    @@ -0,0 +1,22 @@
    +module.exports = (chalk) => {
    +  const green = s => chalk.green.bold(s)
    +  const red = s => chalk.red.bold(s)
    +  const magenta = s => chalk.magenta.bold(s)
    +  const yellow = s => chalk.yellow.bold(s)
    +  const white = s => chalk.bold(s)
    +  const severity = (sev, s) => sev.toLowerCase() === 'moderate' ? yellow(s || sev)
    +    : sev.toLowerCase() === 'high' ? red(s || sev)
    +    : sev.toLowerCase() === 'critical' ? magenta(s || sev)
    +    : white(s || sev)
    +  const dim = s => chalk.dim(s)
    +
    +  return {
    +    dim,
    +    green,
    +    red,
    +    magenta,
    +    yellow,
    +    white,
    +    severity,
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-audit-report/lib/exit-code.js b/node_modules/npm/node_modules/npm-audit-report/lib/exit-code.js
    new file mode 100644
    index 00000000..fcb580b5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-audit-report/lib/exit-code.js
    @@ -0,0 +1,14 @@
    +// return 1 if any vulns in the set are at or above the specified severity
    +const severities = new Map(Object.entries([
    +  'info',
    +  'low',
    +  'moderate',
    +  'high',
    +  'critical',
    +  'none',
    +]).map(s => s.reverse()))
    +
    +module.exports = (data, level) =>
    +  Object.entries(data.metadata.vulnerabilities)
    +    .some(([sev, count]) => count > 0 && severities.has(sev) &&
    +      severities.get(sev) >= severities.get(level)) ? 1 : 0
    diff --git a/node_modules/npm/node_modules/npm-audit-report/lib/index.js b/node_modules/npm/node_modules/npm-audit-report/lib/index.js
    new file mode 100644
    index 00000000..d0ced01e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-audit-report/lib/index.js
    @@ -0,0 +1,41 @@
    +'use strict'
    +
    +const reporters = {
    +  install: require('./reporters/install'),
    +  detail: require('./reporters/detail'),
    +  json: require('./reporters/json'),
    +  quiet: require('./reporters/quiet'),
    +}
    +
    +const exitCode = require('./exit-code.js')
    +
    +module.exports = Object.assign((data, options = {}) => {
    +  const {
    +    reporter = 'install',
    +    chalk,
    +    unicode = true,
    +    indent = 2,
    +  } = options
    +
    +  // CLI defaults this to `null` so the defaulting method above doesn't work
    +  const auditLevel = options.auditLevel || 'low'
    +
    +  if (!data) {
    +    throw Object.assign(
    +      new TypeError('ENOAUDITDATA'),
    +      {
    +        code: 'ENOAUDITDATA',
    +        message: 'missing audit data',
    +      }
    +    )
    +  }
    +
    +  if (typeof data.toJSON === 'function') {
    +    data = data.toJSON()
    +  }
    +
    +  return {
    +    report: reporters[reporter](data, { chalk, unicode, indent }),
    +    exitCode: exitCode(data, auditLevel),
    +  }
    +}, { reporters })
    diff --git a/node_modules/npm/node_modules/npm-audit-report/lib/reporters/detail.js b/node_modules/npm/node_modules/npm-audit-report/lib/reporters/detail.js
    new file mode 100644
    index 00000000..6dde8ec8
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-audit-report/lib/reporters/detail.js
    @@ -0,0 +1,86 @@
    +'use strict'
    +
    +const colors = require('../colors.js')
    +const install = require('./install.js')
    +
    +module.exports = (data, { chalk }) => {
    +  const summary = install.summary(data, { chalk })
    +  const none = data.metadata.vulnerabilities.total === 0
    +  return none ? summary : fullReport(data, { chalk, summary })
    +}
    +
    +const fullReport = (data, { chalk, summary }) => {
    +  const c = colors(chalk)
    +  const output = [c.white('# npm audit report'), '']
    +
    +  const printed = new Set()
    +  for (const [, vuln] of Object.entries(data.vulnerabilities)) {
    +    // only print starting from the top-level advisories
    +    if (vuln.via.filter(v => typeof v !== 'string').length !== 0) {
    +      output.push(printVuln(vuln, c, data.vulnerabilities, printed))
    +    }
    +  }
    +
    +  output.push(summary)
    +
    +  return output.join('\n')
    +}
    +
    +const printVuln = (vuln, c, vulnerabilities, printed, indent = '') => {
    +  if (printed.has(vuln)) {
    +    return null
    +  }
    +
    +  printed.add(vuln)
    +  const output = []
    +
    +  output.push(c.white(vuln.name) + '  ' + vuln.range)
    +
    +  if (indent === '' && (vuln.severity !== 'low' || vuln.severity === 'info')) {
    +    output.push(`Severity: ${c.severity(vuln.severity)}`)
    +  }
    +
    +  for (const via of vuln.via) {
    +    if (typeof via === 'string') {
    +      output.push(`Depends on vulnerable versions of ${c.white(via)}`)
    +    } else if (indent === '') {
    +      output.push(`${c.white(via.title)} - ${via.url}`)
    +    }
    +  }
    +
    +  if (indent === '') {
    +    const { fixAvailable: fa } = vuln
    +    if (fa === false) {
    +      output.push(c.red('No fix available'))
    +    } else if (fa === true) {
    +      output.push(c.green('fix available') + ' via `npm audit fix`')
    +    } else {
    +      /* istanbul ignore else - should be impossible, just being cautious */
    +      if (typeof fa === 'object' && indent === '') {
    +        output.push(
    +          `${c.yellow('fix available')} via \`npm audit fix --force\``,
    +          `Will install ${fa.name}@${fa.version}` +
    +          `, which is ${fa.isSemVerMajor ? 'a breaking change' :
    +            'outside the stated dependency range'}`
    +        )
    +      }
    +    }
    +  }
    +
    +  for (const path of vuln.nodes) {
    +    output.push(c.dim(path))
    +  }
    +
    +  for (const effect of vuln.effects) {
    +    const e = printVuln(vulnerabilities[effect], c, vulnerabilities, printed, '  ')
    +    if (e) {
    +      output.push(...e.split('\n'))
    +    }
    +  }
    +
    +  if (indent === '') {
    +    output.push('')
    +  }
    +
    +  return output.map(l => `${indent}${l}`).join('\n')
    +}
    diff --git a/node_modules/npm/node_modules/npm-audit-report/lib/reporters/install.js b/node_modules/npm/node_modules/npm-audit-report/lib/reporters/install.js
    new file mode 100644
    index 00000000..0a1e8253
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-audit-report/lib/reporters/install.js
    @@ -0,0 +1,75 @@
    +const colors = require('../colors.js')
    +
    +const calculate = (data, { chalk }) => {
    +  const c = colors(chalk)
    +  const output = []
    +  const { metadata: { vulnerabilities } } = data
    +  const vulnCount = vulnerabilities.total
    +
    +  let someFixable = false
    +  let someForceFixable = false
    +  let forceFixSemVerMajor = false
    +  let someUnfixable = false
    +
    +  if (vulnCount === 0) {
    +    output.push(`found ${c.green('0')} vulnerabilities`)
    +  } else {
    +    for (const [, vuln] of Object.entries(data.vulnerabilities)) {
    +      const { fixAvailable } = vuln
    +      someFixable = someFixable || fixAvailable === true
    +      someUnfixable = someUnfixable || fixAvailable === false
    +      if (typeof fixAvailable === 'object') {
    +        someForceFixable = true
    +        forceFixSemVerMajor = forceFixSemVerMajor || fixAvailable.isSemVerMajor
    +      }
    +    }
    +    const total = vulnerabilities.total
    +    const sevs = Object.entries(vulnerabilities).filter(([s, count]) => {
    +      return (s === 'low' || s === 'moderate' || s === 'high' || s === 'critical') &&
    +        count > 0
    +    })
    +
    +    if (sevs.length > 1) {
    +      const severities = sevs.map(([s, count]) => {
    +        return `${count} ${c.severity(s)}`
    +      }).join(', ')
    +      output.push(`${c.red(total)} vulnerabilities (${severities})`)
    +    } else {
    +      const [sev, count] = sevs[0]
    +      output.push(`${count} ${c.severity(sev)} severity vulnerabilit${count === 1 ? 'y' : 'ies'}`)
    +    }
    +
    +    // XXX use a different footer line if some aren't fixable easily.
    +    // just 'run `npm audit` for details' maybe?
    +
    +    if (someFixable) {
    +      output.push('', 'To address ' +
    +        (someForceFixable || someUnfixable ? 'issues that do not require attention'
    +        : 'all issues') + ', run:\n  npm audit fix')
    +    }
    +
    +    if (someForceFixable) {
    +      output.push('', 'To address all issues' +
    +        (someUnfixable ? ' possible' : '') +
    +        (forceFixSemVerMajor ? ' (including breaking changes)' : '') +
    +        ', run:\n  npm audit fix --force')
    +    }
    +
    +    if (someUnfixable) {
    +      output.push('',
    +        'Some issues need review, and may require choosing',
    +        'a different dependency.')
    +    }
    +  }
    +
    +  const summary = output.join('\n')
    +  return {
    +    summary,
    +    report: vulnCount > 0 ? `${summary}\n\nRun \`npm audit\` for details.`
    +    : summary,
    +  }
    +}
    +
    +module.exports = Object.assign((data, opt) => calculate(data, opt).report, {
    +  summary: (data, opt) => calculate(data, opt).summary,
    +})
    diff --git a/node_modules/npm/node_modules/npm-audit-report/lib/reporters/json.js b/node_modules/npm/node_modules/npm-audit-report/lib/reporters/json.js
    new file mode 100644
    index 00000000..6714720a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-audit-report/lib/reporters/json.js
    @@ -0,0 +1 @@
    +module.exports = (data, { indent }) => JSON.stringify(data, null, indent)
    diff --git a/node_modules/npm/node_modules/npm-audit-report/lib/reporters/quiet.js b/node_modules/npm/node_modules/npm-audit-report/lib/reporters/quiet.js
    new file mode 100644
    index 00000000..57517aae
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-audit-report/lib/reporters/quiet.js
    @@ -0,0 +1 @@
    +module.exports = () => ''
    diff --git a/node_modules/npm/node_modules/npm-audit-report/package.json b/node_modules/npm/node_modules/npm-audit-report/package.json
    new file mode 100644
    index 00000000..22b16099
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-audit-report/package.json
    @@ -0,0 +1,62 @@
    +{
    +  "name": "npm-audit-report",
    +  "version": "6.0.0",
    +  "description": "Given a response from the npm security api, render it into a variety of security reports",
    +  "main": "lib/index.js",
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "lintfix": "npm run eslint -- --fix",
    +    "posttest": "npm run lint",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "tap": {
    +    "check-coverage": true,
    +    "coverage-map": "map.js",
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "keywords": [
    +    "npm",
    +    "security",
    +    "report",
    +    "audit"
    +  ],
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "chalk": "^5.2.0",
    +    "tap": "^16.0.0"
    +  },
    +  "directories": {
    +    "lib": "lib",
    +    "test": "test"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/npm-audit-report.git"
    +  },
    +  "bugs": {
    +    "url": "https://github.com/npm/npm-audit-report/issues"
    +  },
    +  "homepage": "https://github.com/npm/npm-audit-report#readme",
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": true
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-bundled/LICENSE b/node_modules/npm/node_modules/npm-bundled/LICENSE
    new file mode 100644
    index 00000000..20a47625
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-bundled/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/npm/node_modules/npm-bundled/lib/index.js b/node_modules/npm/node_modules/npm-bundled/lib/index.js
    new file mode 100644
    index 00000000..f5ee0bb3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-bundled/lib/index.js
    @@ -0,0 +1,254 @@
    +'use strict'
    +
    +// walk the tree of deps starting from the top level list of bundled deps
    +// Any deps at the top level that are depended on by a bundled dep that
    +// does not have that dep in its own node_modules folder are considered
    +// bundled deps as well.  This list of names can be passed to npm-packlist
    +// as the "bundled" argument.  Additionally, packageJsonCache is shared so
    +// packlist doesn't have to re-read files already consumed in this pass
    +
    +const fs = require('fs')
    +const path = require('path')
    +const EE = require('events').EventEmitter
    +// we don't care about the package bins, but we share a pj cache
    +// with other modules that DO care about it, so keep it nice.
    +const normalizePackageBin = require('npm-normalize-package-bin')
    +
    +class BundleWalker extends EE {
    +  constructor (opt) {
    +    opt = opt || {}
    +    super(opt)
    +    this.path = path.resolve(opt.path || process.cwd())
    +
    +    this.parent = opt.parent || null
    +    if (this.parent) {
    +      this.result = this.parent.result
    +      // only collect results in node_modules folders at the top level
    +      // since the node_modules in a bundled dep is included always
    +      if (!this.parent.parent) {
    +        const base = path.basename(this.path)
    +        const scope = path.basename(path.dirname(this.path))
    +        this.result.add(/^@/.test(scope) ? scope + '/' + base : base)
    +      }
    +      this.root = this.parent.root
    +      this.packageJsonCache = this.parent.packageJsonCache
    +    } else {
    +      this.result = new Set()
    +      this.root = this.path
    +      this.packageJsonCache = opt.packageJsonCache || new Map()
    +    }
    +
    +    this.seen = new Set()
    +    this.didDone = false
    +    this.children = 0
    +    this.node_modules = []
    +    this.package = null
    +    this.bundle = null
    +  }
    +
    +  addListener (ev, fn) {
    +    return this.on(ev, fn)
    +  }
    +
    +  on (ev, fn) {
    +    const ret = super.on(ev, fn)
    +    if (ev === 'done' && this.didDone) {
    +      this.emit('done', this.result)
    +    }
    +    return ret
    +  }
    +
    +  done () {
    +    if (!this.didDone) {
    +      this.didDone = true
    +      if (!this.parent) {
    +        const res = Array.from(this.result)
    +        this.result = res
    +        this.emit('done', res)
    +      } else {
    +        this.emit('done')
    +      }
    +    }
    +  }
    +
    +  start () {
    +    const pj = path.resolve(this.path, 'package.json')
    +    if (this.packageJsonCache.has(pj)) {
    +      this.onPackage(this.packageJsonCache.get(pj))
    +    } else {
    +      this.readPackageJson(pj)
    +    }
    +    return this
    +  }
    +
    +  readPackageJson (pj) {
    +    fs.readFile(pj, (er, data) =>
    +      er ? this.done() : this.onPackageJson(pj, data))
    +  }
    +
    +  onPackageJson (pj, data) {
    +    try {
    +      this.package = normalizePackageBin(JSON.parse(data + ''))
    +    } catch (er) {
    +      return this.done()
    +    }
    +    this.packageJsonCache.set(pj, this.package)
    +    this.onPackage(this.package)
    +  }
    +
    +  allDepsBundled (pkg) {
    +    return Object.keys(pkg.dependencies || {}).concat(
    +      Object.keys(pkg.optionalDependencies || {}))
    +  }
    +
    +  onPackage (pkg) {
    +    // all deps are bundled if we got here as a child.
    +    // otherwise, only bundle bundledDeps
    +    // Get a unique-ified array with a short-lived Set
    +    const bdRaw = this.parent ? this.allDepsBundled(pkg)
    +      : pkg.bundleDependencies || pkg.bundledDependencies || []
    +
    +    const bd = Array.from(new Set(
    +      Array.isArray(bdRaw) ? bdRaw
    +      : bdRaw === true ? this.allDepsBundled(pkg)
    +      : Object.keys(bdRaw)))
    +
    +    if (!bd.length) {
    +      return this.done()
    +    }
    +
    +    this.bundle = bd
    +    this.readModules()
    +  }
    +
    +  readModules () {
    +    readdirNodeModules(this.path + '/node_modules', (er, nm) =>
    +      er ? this.onReaddir([]) : this.onReaddir(nm))
    +  }
    +
    +  onReaddir (nm) {
    +    // keep track of what we have, in case children need it
    +    this.node_modules = nm
    +
    +    this.bundle.forEach(dep => this.childDep(dep))
    +    if (this.children === 0) {
    +      this.done()
    +    }
    +  }
    +
    +  childDep (dep) {
    +    if (this.node_modules.indexOf(dep) !== -1) {
    +      if (!this.seen.has(dep)) {
    +        this.seen.add(dep)
    +        this.child(dep)
    +      }
    +    } else if (this.parent) {
    +      this.parent.childDep(dep)
    +    }
    +  }
    +
    +  child (dep) {
    +    const p = this.path + '/node_modules/' + dep
    +    this.children += 1
    +    const child = new BundleWalker({
    +      path: p,
    +      parent: this,
    +    })
    +    child.on('done', () => {
    +      if (--this.children === 0) {
    +        this.done()
    +      }
    +    })
    +    child.start()
    +  }
    +}
    +
    +class BundleWalkerSync extends BundleWalker {
    +  start () {
    +    super.start()
    +    this.done()
    +    return this
    +  }
    +
    +  readPackageJson (pj) {
    +    try {
    +      this.onPackageJson(pj, fs.readFileSync(pj))
    +    } catch {
    +      // empty catch
    +    }
    +    return this
    +  }
    +
    +  readModules () {
    +    try {
    +      this.onReaddir(readdirNodeModulesSync(this.path + '/node_modules'))
    +    } catch {
    +      this.onReaddir([])
    +    }
    +  }
    +
    +  child (dep) {
    +    new BundleWalkerSync({
    +      path: this.path + '/node_modules/' + dep,
    +      parent: this,
    +    }).start()
    +  }
    +}
    +
    +const readdirNodeModules = (nm, cb) => {
    +  fs.readdir(nm, (er, set) => {
    +    if (er) {
    +      cb(er)
    +    } else {
    +      const scopes = set.filter(f => /^@/.test(f))
    +      if (!scopes.length) {
    +        cb(null, set)
    +      } else {
    +        const unscoped = set.filter(f => !/^@/.test(f))
    +        let count = scopes.length
    +        scopes.forEach(scope => {
    +          fs.readdir(nm + '/' + scope, (readdirEr, pkgs) => {
    +            if (readdirEr || !pkgs.length) {
    +              unscoped.push(scope)
    +            } else {
    +              unscoped.push.apply(unscoped, pkgs.map(p => scope + '/' + p))
    +            }
    +            if (--count === 0) {
    +              cb(null, unscoped)
    +            }
    +          })
    +        })
    +      }
    +    }
    +  })
    +}
    +
    +const readdirNodeModulesSync = nm => {
    +  const set = fs.readdirSync(nm)
    +  const unscoped = set.filter(f => !/^@/.test(f))
    +  const scopes = set.filter(f => /^@/.test(f)).map(scope => {
    +    try {
    +      const pkgs = fs.readdirSync(nm + '/' + scope)
    +      return pkgs.length ? pkgs.map(p => scope + '/' + p) : [scope]
    +    } catch (er) {
    +      return [scope]
    +    }
    +  }).reduce((a, b) => a.concat(b), [])
    +  return unscoped.concat(scopes)
    +}
    +
    +const walk = (options, callback) => {
    +  const p = new Promise((resolve, reject) => {
    +    new BundleWalker(options).on('done', resolve).on('error', reject).start()
    +  })
    +  return callback ? p.then(res => callback(null, res), callback) : p
    +}
    +
    +const walkSync = options => {
    +  return new BundleWalkerSync(options).start().result
    +}
    +
    +module.exports = walk
    +walk.sync = walkSync
    +walk.BundleWalker = BundleWalker
    +walk.BundleWalkerSync = BundleWalkerSync
    diff --git a/node_modules/npm/node_modules/npm-bundled/package.json b/node_modules/npm/node_modules/npm-bundled/package.json
    new file mode 100644
    index 00000000..c5daf35d
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-bundled/package.json
    @@ -0,0 +1,49 @@
    +{
    +  "name": "npm-bundled",
    +  "version": "4.0.0",
    +  "description": "list things in node_modules that are bundledDependencies, or transitive dependencies thereof",
    +  "main": "lib/index.js",
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/npm-bundled.git"
    +  },
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "mutate-fs": "^2.1.1",
    +    "tap": "^16.3.0"
    +  },
    +  "scripts": {
    +    "test": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "lintfix": "npm run eslint -- --fix",
    +    "snap": "tap",
    +    "posttest": "npm run lint",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "dependencies": {
    +    "npm-normalize-package-bin": "^4.0.0"
    +  },
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": true
    +  },
    +  "tap": {
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-install-checks/LICENSE b/node_modules/npm/node_modules/npm-install-checks/LICENSE
    new file mode 100644
    index 00000000..3bed8320
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-install-checks/LICENSE
    @@ -0,0 +1,27 @@
    +Copyright (c) Robert Kowalski and Isaac Z. Schlueter ("Authors")
    +All rights reserved.
    +
    +The BSD License
    +
    +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 AUTHORS 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 AUTHORS 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/npm/node_modules/npm-install-checks/lib/current-env.js b/node_modules/npm/node_modules/npm-install-checks/lib/current-env.js
    new file mode 100644
    index 00000000..31f154aa
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-install-checks/lib/current-env.js
    @@ -0,0 +1,91 @@
    +const process = require('node:process')
    +const nodeOs = require('node:os')
    +const fs = require('node:fs')
    +
    +function isMusl (file) {
    +  return file.includes('libc.musl-') || file.includes('ld-musl-')
    +}
    +
    +function os () {
    +  return process.platform
    +}
    +
    +function cpu () {
    +  return process.arch
    +}
    +
    +const LDD_PATH = '/usr/bin/ldd'
    +function getFamilyFromFilesystem () {
    +  try {
    +    const content = fs.readFileSync(LDD_PATH, 'utf-8')
    +    if (content.includes('musl')) {
    +      return 'musl'
    +    }
    +    if (content.includes('GNU C Library')) {
    +      return 'glibc'
    +    }
    +    return null
    +  } catch {
    +    return undefined
    +  }
    +}
    +
    +function getFamilyFromReport () {
    +  const originalExclude = process.report.excludeNetwork
    +  process.report.excludeNetwork = true
    +  const report = process.report.getReport()
    +  process.report.excludeNetwork = originalExclude
    +  if (report.header?.glibcVersionRuntime) {
    +    family = 'glibc'
    +  } else if (Array.isArray(report.sharedObjects) && report.sharedObjects.some(isMusl)) {
    +    family = 'musl'
    +  } else {
    +    family = null
    +  }
    +  return family
    +}
    +
    +let family
    +function libc (osName) {
    +  if (osName !== 'linux') {
    +    return undefined
    +  }
    +  if (family === undefined) {
    +    family = getFamilyFromFilesystem()
    +    if (family === undefined) {
    +      family = getFamilyFromReport()
    +    }
    +  }
    +  return family
    +}
    +
    +function devEngines (env = {}) {
    +  const osName = env.os || os()
    +  return {
    +    cpu: {
    +      name: env.cpu || cpu(),
    +    },
    +    libc: {
    +      name: env.libc || libc(osName),
    +    },
    +    os: {
    +      name: osName,
    +      version: env.osVersion || nodeOs.release(),
    +    },
    +    packageManager: {
    +      name: 'npm',
    +      version: env.npmVersion,
    +    },
    +    runtime: {
    +      name: 'node',
    +      version: env.nodeVersion || process.version,
    +    },
    +  }
    +}
    +
    +module.exports = {
    +  cpu,
    +  libc,
    +  os,
    +  devEngines,
    +}
    diff --git a/node_modules/npm/node_modules/npm-install-checks/lib/dev-engines.js b/node_modules/npm/node_modules/npm-install-checks/lib/dev-engines.js
    new file mode 100644
    index 00000000..ac5a1823
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-install-checks/lib/dev-engines.js
    @@ -0,0 +1,145 @@
    +const satisfies = require('semver/functions/satisfies')
    +const validRange = require('semver/ranges/valid')
    +
    +const recognizedOnFail = [
    +  'ignore',
    +  'warn',
    +  'error',
    +  'download',
    +]
    +
    +const recognizedProperties = [
    +  'name',
    +  'version',
    +  'onFail',
    +]
    +
    +const recognizedEngines = [
    +  'packageManager',
    +  'runtime',
    +  'cpu',
    +  'libc',
    +  'os',
    +]
    +
    +/** checks a devEngine dependency */
    +function checkDependency (wanted, current, opts) {
    +  const { engine } = opts
    +
    +  if ((typeof wanted !== 'object' || wanted === null) || Array.isArray(wanted)) {
    +    throw new Error(`Invalid non-object value for "${engine}"`)
    +  }
    +
    +  const properties = Object.keys(wanted)
    +
    +  for (const prop of properties) {
    +    if (!recognizedProperties.includes(prop)) {
    +      throw new Error(`Invalid property "${prop}" for "${engine}"`)
    +    }
    +  }
    +
    +  if (!properties.includes('name')) {
    +    throw new Error(`Missing "name" property for "${engine}"`)
    +  }
    +
    +  if (typeof wanted.name !== 'string') {
    +    throw new Error(`Invalid non-string value for "name" within "${engine}"`)
    +  }
    +
    +  if (typeof current.name !== 'string' || current.name === '') {
    +    throw new Error(`Unable to determine "name" for "${engine}"`)
    +  }
    +
    +  if (properties.includes('onFail')) {
    +    if (typeof wanted.onFail !== 'string') {
    +      throw new Error(`Invalid non-string value for "onFail" within "${engine}"`)
    +    }
    +    if (!recognizedOnFail.includes(wanted.onFail)) {
    +      throw new Error(`Invalid onFail value "${wanted.onFail}" for "${engine}"`)
    +    }
    +  }
    +
    +  if (wanted.name !== current.name) {
    +    return new Error(
    +      `Invalid name "${wanted.name}" does not match "${current.name}" for "${engine}"`
    +    )
    +  }
    +
    +  if (properties.includes('version')) {
    +    if (typeof wanted.version !== 'string') {
    +      throw new Error(`Invalid non-string value for "version" within "${engine}"`)
    +    }
    +    if (typeof current.version !== 'string' || current.version === '') {
    +      throw new Error(`Unable to determine "version" for "${engine}" "${wanted.name}"`)
    +    }
    +    if (validRange(wanted.version)) {
    +      if (!satisfies(current.version, wanted.version, opts.semver)) {
    +        return new Error(
    +          // eslint-disable-next-line max-len
    +          `Invalid semver version "${wanted.version}" does not match "${current.version}" for "${engine}"`
    +        )
    +      }
    +    } else if (wanted.version !== current.version) {
    +      return new Error(
    +        `Invalid version "${wanted.version}" does not match "${current.version}" for "${engine}"`
    +      )
    +    }
    +  }
    +}
    +
    +/** checks devEngines package property and returns array of warnings / errors */
    +function checkDevEngines (wanted, current = {}, opts = {}) {
    +  if ((typeof wanted !== 'object' || wanted === null) || Array.isArray(wanted)) {
    +    throw new Error(`Invalid non-object value for devEngines`)
    +  }
    +
    +  const errors = []
    +
    +  for (const engine of Object.keys(wanted)) {
    +    if (!recognizedEngines.includes(engine)) {
    +      throw new Error(`Invalid property "${engine}"`)
    +    }
    +    const dependencyAsAuthored = wanted[engine]
    +    const dependencies = [dependencyAsAuthored].flat()
    +    const currentEngine = current[engine] || {}
    +
    +    // this accounts for empty array eg { runtime: [] } and ignores it
    +    if (dependencies.length === 0) {
    +      continue
    +    }
    +
    +    const depErrors = []
    +    for (const dep of dependencies) {
    +      const result = checkDependency(dep, currentEngine, { ...opts, engine })
    +      if (result) {
    +        depErrors.push(result)
    +      }
    +    }
    +
    +    const invalid = depErrors.length === dependencies.length
    +
    +    if (invalid) {
    +      const lastDependency = dependencies[dependencies.length - 1]
    +      let onFail = lastDependency.onFail || 'error'
    +      if (onFail === 'download') {
    +        onFail = 'error'
    +      }
    +
    +      const err = Object.assign(new Error(`Invalid engine "${engine}"`), {
    +        errors: depErrors,
    +        engine,
    +        isWarn: onFail === 'warn',
    +        isError: onFail === 'error',
    +        current: currentEngine,
    +        required: dependencyAsAuthored,
    +      })
    +
    +      errors.push(err)
    +    }
    +  }
    +  return errors
    +}
    +
    +module.exports = {
    +  checkDevEngines,
    +}
    diff --git a/node_modules/npm/node_modules/npm-install-checks/lib/index.js b/node_modules/npm/node_modules/npm-install-checks/lib/index.js
    new file mode 100644
    index 00000000..71702920
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-install-checks/lib/index.js
    @@ -0,0 +1,90 @@
    +const semver = require('semver')
    +const currentEnv = require('./current-env')
    +const { checkDevEngines } = require('./dev-engines')
    +
    +const checkEngine = (target, npmVer, nodeVer, force = false) => {
    +  const nodev = force ? null : nodeVer
    +  const eng = target.engines
    +  const opt = { includePrerelease: true }
    +  if (!eng) {
    +    return
    +  }
    +
    +  const nodeFail = nodev && eng.node && !semver.satisfies(nodev, eng.node, opt)
    +  const npmFail = npmVer && eng.npm && !semver.satisfies(npmVer, eng.npm, opt)
    +  if (nodeFail || npmFail) {
    +    throw Object.assign(new Error('Unsupported engine'), {
    +      pkgid: target._id,
    +      current: { node: nodeVer, npm: npmVer },
    +      required: eng,
    +      code: 'EBADENGINE',
    +    })
    +  }
    +}
    +
    +const checkPlatform = (target, force = false, environment = {}) => {
    +  if (force) {
    +    return
    +  }
    +
    +  const os = environment.os || currentEnv.os()
    +  const cpu = environment.cpu || currentEnv.cpu()
    +  const libc = environment.libc || currentEnv.libc(os)
    +
    +  const osOk = target.os ? checkList(os, target.os) : true
    +  const cpuOk = target.cpu ? checkList(cpu, target.cpu) : true
    +  let libcOk = target.libc ? checkList(libc, target.libc) : true
    +  if (target.libc && !libc) {
    +    libcOk = false
    +  }
    +
    +  if (!osOk || !cpuOk || !libcOk) {
    +    throw Object.assign(new Error('Unsupported platform'), {
    +      pkgid: target._id,
    +      current: {
    +        os,
    +        cpu,
    +        libc,
    +      },
    +      required: {
    +        os: target.os,
    +        cpu: target.cpu,
    +        libc: target.libc,
    +      },
    +      code: 'EBADPLATFORM',
    +    })
    +  }
    +}
    +
    +const checkList = (value, list) => {
    +  if (typeof list === 'string') {
    +    list = [list]
    +  }
    +  if (list.length === 1 && list[0] === 'any') {
    +    return true
    +  }
    +  // match none of the negated values, and at least one of the
    +  // non-negated values, if any are present.
    +  let negated = 0
    +  let match = false
    +  for (const entry of list) {
    +    const negate = entry.charAt(0) === '!'
    +    const test = negate ? entry.slice(1) : entry
    +    if (negate) {
    +      negated++
    +      if (value === test) {
    +        return false
    +      }
    +    } else {
    +      match = match || value === test
    +    }
    +  }
    +  return match || negated === list.length
    +}
    +
    +module.exports = {
    +  checkEngine,
    +  checkPlatform,
    +  checkDevEngines,
    +  currentEnv,
    +}
    diff --git a/node_modules/npm/node_modules/npm-install-checks/package.json b/node_modules/npm/node_modules/npm-install-checks/package.json
    new file mode 100644
    index 00000000..967f5f65
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-install-checks/package.json
    @@ -0,0 +1,52 @@
    +{
    +  "name": "npm-install-checks",
    +  "version": "7.1.1",
    +  "description": "Check the engines and platform fields in package.json",
    +  "main": "lib/index.js",
    +  "dependencies": {
    +    "semver": "^7.1.1"
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.4",
    +    "tap": "^16.0.1"
    +  },
    +  "scripts": {
    +    "test": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "lintfix": "npm run eslint -- --fix",
    +    "snap": "tap",
    +    "posttest": "npm run lint",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/npm-install-checks.git"
    +  },
    +  "keywords": [
    +    "npm,",
    +    "install"
    +  ],
    +  "license": "BSD-2-Clause",
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "author": "GitHub Inc.",
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.4",
    +    "publish": "true"
    +  },
    +  "tap": {
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-normalize-package-bin/LICENSE b/node_modules/npm/node_modules/npm-normalize-package-bin/LICENSE
    new file mode 100644
    index 00000000..19cec97b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-normalize-package-bin/LICENSE
    @@ -0,0 +1,15 @@
    +The 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 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/npm/node_modules/npm-normalize-package-bin/lib/index.js b/node_modules/npm/node_modules/npm-normalize-package-bin/lib/index.js
    new file mode 100644
    index 00000000..3cb8478c
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-normalize-package-bin/lib/index.js
    @@ -0,0 +1,64 @@
    +// pass in a manifest with a 'bin' field here, and it'll turn it
    +// into a properly santized bin object
    +const { join, basename } = require('path')
    +
    +const normalize = pkg =>
    +  !pkg.bin ? removeBin(pkg)
    +  : typeof pkg.bin === 'string' ? normalizeString(pkg)
    +  : Array.isArray(pkg.bin) ? normalizeArray(pkg)
    +  : typeof pkg.bin === 'object' ? normalizeObject(pkg)
    +  : removeBin(pkg)
    +
    +const normalizeString = pkg => {
    +  if (!pkg.name) {
    +    return removeBin(pkg)
    +  }
    +  pkg.bin = { [pkg.name]: pkg.bin }
    +  return normalizeObject(pkg)
    +}
    +
    +const normalizeArray = pkg => {
    +  pkg.bin = pkg.bin.reduce((acc, k) => {
    +    acc[basename(k)] = k
    +    return acc
    +  }, {})
    +  return normalizeObject(pkg)
    +}
    +
    +const removeBin = pkg => {
    +  delete pkg.bin
    +  return pkg
    +}
    +
    +const normalizeObject = pkg => {
    +  const orig = pkg.bin
    +  const clean = {}
    +  let hasBins = false
    +  Object.keys(orig).forEach(binKey => {
    +    const base = join('/', basename(binKey.replace(/\\|:/g, '/'))).slice(1)
    +
    +    if (typeof orig[binKey] !== 'string' || !base) {
    +      return
    +    }
    +
    +    const binTarget = join('/', orig[binKey].replace(/\\/g, '/'))
    +      .replace(/\\/g, '/').slice(1)
    +
    +    if (!binTarget) {
    +      return
    +    }
    +
    +    clean[base] = binTarget
    +    hasBins = true
    +  })
    +
    +  if (hasBins) {
    +    pkg.bin = clean
    +  } else {
    +    delete pkg.bin
    +  }
    +
    +  return pkg
    +}
    +
    +module.exports = normalize
    diff --git a/node_modules/npm/node_modules/npm-normalize-package-bin/package.json b/node_modules/npm/node_modules/npm-normalize-package-bin/package.json
    new file mode 100644
    index 00000000..a1aeef0e
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-normalize-package-bin/package.json
    @@ -0,0 +1,45 @@
    +{
    +  "name": "npm-normalize-package-bin",
    +  "version": "4.0.0",
    +  "description": "Turn any flavor of allowable package.json bin into a normalized object",
    +  "main": "lib/index.js",
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/npm-normalize-package-bin.git"
    +  },
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "lintfix": "npm run eslint -- --fix",
    +    "posttest": "npm run lint",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "tap": "^16.3.0"
    +  },
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": "true"
    +  },
    +  "tap": {
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-package-arg/LICENSE b/node_modules/npm/node_modules/npm-package-arg/LICENSE
    new file mode 100644
    index 00000000..19cec97b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-package-arg/LICENSE
    @@ -0,0 +1,15 @@
    +The 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 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/npm/node_modules/npm-package-arg/lib/npa.js b/node_modules/npm/node_modules/npm-package-arg/lib/npa.js
    new file mode 100644
    index 00000000..e9260581
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-package-arg/lib/npa.js
    @@ -0,0 +1,418 @@
    +'use strict'
    +module.exports = npa
    +module.exports.resolve = resolve
    +module.exports.toPurl = toPurl
    +module.exports.Result = Result
    +
    +const { URL } = require('url')
    +const HostedGit = require('hosted-git-info')
    +const semver = require('semver')
    +const path = global.FAKE_WINDOWS ? require('path').win32 : require('path')
    +const validatePackageName = require('validate-npm-package-name')
    +const { homedir } = require('os')
    +const { log } = require('proc-log')
    +
    +const isWindows = process.platform === 'win32' || global.FAKE_WINDOWS
    +const hasSlashes = isWindows ? /\\|[/]/ : /[/]/
    +const isURL = /^(?:git[+])?[a-z]+:/i
    +const isGit = /^[^@]+@[^:.]+\.[^:]+:.+$/i
    +const isFilename = /[.](?:tgz|tar.gz|tar)$/i
    +const isPortNumber = /:[0-9]+(\/|$)/i
    +
    +function npa (arg, where) {
    +  let name
    +  let spec
    +  if (typeof arg === 'object') {
    +    if (arg instanceof Result && (!where || where === arg.where)) {
    +      return arg
    +    } else if (arg.name && arg.rawSpec) {
    +      return npa.resolve(arg.name, arg.rawSpec, where || arg.where)
    +    } else {
    +      return npa(arg.raw, where || arg.where)
    +    }
    +  }
    +  const nameEndsAt = arg[0] === '@' ? arg.slice(1).indexOf('@') + 1 : arg.indexOf('@')
    +  const namePart = nameEndsAt > 0 ? arg.slice(0, nameEndsAt) : arg
    +  if (isURL.test(arg)) {
    +    spec = arg
    +  } else if (isGit.test(arg)) {
    +    spec = `git+ssh://${arg}`
    +  } else if (namePart[0] !== '@' && (hasSlashes.test(namePart) || isFilename.test(namePart))) {
    +    spec = arg
    +  } else if (nameEndsAt > 0) {
    +    name = namePart
    +    spec = arg.slice(nameEndsAt + 1) || '*'
    +  } else {
    +    const valid = validatePackageName(arg)
    +    if (valid.validForOldPackages) {
    +      name = arg
    +      spec = '*'
    +    } else {
    +      spec = arg
    +    }
    +  }
    +  return resolve(name, spec, where, arg)
    +}
    +
    +const isFilespec = isWindows ? /^(?:[.]|~[/]|[/\\]|[a-zA-Z]:)/ : /^(?:[.]|~[/]|[/]|[a-zA-Z]:)/
    +
    +function resolve (name, spec, where, arg) {
    +  const res = new Result({
    +    raw: arg,
    +    name: name,
    +    rawSpec: spec,
    +    fromArgument: arg != null,
    +  })
    +
    +  if (name) {
    +    res.setName(name)
    +  }
    +
    +  if (spec && (isFilespec.test(spec) || /^file:/i.test(spec))) {
    +    return fromFile(res, where)
    +  } else if (spec && /^npm:/i.test(spec)) {
    +    return fromAlias(res, where)
    +  }
    +
    +  const hosted = HostedGit.fromUrl(spec, {
    +    noGitPlus: true,
    +    noCommittish: true,
    +  })
    +  if (hosted) {
    +    return fromHostedGit(res, hosted)
    +  } else if (spec && isURL.test(spec)) {
    +    return fromURL(res)
    +  } else if (spec && (hasSlashes.test(spec) || isFilename.test(spec))) {
    +    return fromFile(res, where)
    +  } else {
    +    return fromRegistry(res)
    +  }
    +}
    +
    +const defaultRegistry = 'https://registry.npmjs.org'
    +
    +function toPurl (arg, reg = defaultRegistry) {
    +  const res = npa(arg)
    +
    +  if (res.type !== 'version') {
    +    throw invalidPurlType(res.type, res.raw)
    +  }
    +
    +  // URI-encode leading @ of scoped packages
    +  let purl = 'pkg:npm/' + res.name.replace(/^@/, '%40') + '@' + res.rawSpec
    +  if (reg !== defaultRegistry) {
    +    purl += '?repository_url=' + reg
    +  }
    +
    +  return purl
    +}
    +
    +function invalidPackageName (name, valid, raw) {
    +  // eslint-disable-next-line max-len
    +  const err = new Error(`Invalid package name "${name}" of package "${raw}": ${valid.errors.join('; ')}.`)
    +  err.code = 'EINVALIDPACKAGENAME'
    +  return err
    +}
    +
    +function invalidTagName (name, raw) {
    +  // eslint-disable-next-line max-len
    +  const err = new Error(`Invalid tag name "${name}" of package "${raw}": Tags may not have any characters that encodeURIComponent encodes.`)
    +  err.code = 'EINVALIDTAGNAME'
    +  return err
    +}
    +
    +function invalidPurlType (type, raw) {
    +  // eslint-disable-next-line max-len
    +  const err = new Error(`Invalid type "${type}" of package "${raw}": Purl can only be generated for "version" types.`)
    +  err.code = 'EINVALIDPURLTYPE'
    +  return err
    +}
    +
    +function Result (opts) {
    +  this.type = opts.type
    +  this.registry = opts.registry
    +  this.where = opts.where
    +  if (opts.raw == null) {
    +    this.raw = opts.name ? opts.name + '@' + opts.rawSpec : opts.rawSpec
    +  } else {
    +    this.raw = opts.raw
    +  }
    +
    +  this.name = undefined
    +  this.escapedName = undefined
    +  this.scope = undefined
    +  this.rawSpec = opts.rawSpec || ''
    +  this.saveSpec = opts.saveSpec
    +  this.fetchSpec = opts.fetchSpec
    +  if (opts.name) {
    +    this.setName(opts.name)
    +  }
    +  this.gitRange = opts.gitRange
    +  this.gitCommittish = opts.gitCommittish
    +  this.gitSubdir = opts.gitSubdir
    +  this.hosted = opts.hosted
    +}
    +
    +Result.prototype.setName = function (name) {
    +  const valid = validatePackageName(name)
    +  if (!valid.validForOldPackages) {
    +    throw invalidPackageName(name, valid, this.raw)
    +  }
    +
    +  this.name = name
    +  this.scope = name[0] === '@' ? name.slice(0, name.indexOf('/')) : undefined
    +  // scoped packages in couch must have slash url-encoded, e.g. @foo%2Fbar
    +  this.escapedName = name.replace('/', '%2f')
    +  return this
    +}
    +
    +Result.prototype.toString = function () {
    +  const full = []
    +  if (this.name != null && this.name !== '') {
    +    full.push(this.name)
    +  }
    +  const spec = this.saveSpec || this.fetchSpec || this.rawSpec
    +  if (spec != null && spec !== '') {
    +    full.push(spec)
    +  }
    +  return full.length ? full.join('@') : this.raw
    +}
    +
    +Result.prototype.toJSON = function () {
    +  const result = Object.assign({}, this)
    +  delete result.hosted
    +  return result
    +}
    +
    +// sets res.gitCommittish, res.gitRange, and res.gitSubdir
    +function setGitAttrs (res, committish) {
    +  if (!committish) {
    +    res.gitCommittish = null
    +    return
    +  }
    +
    +  // for each :: separated item:
    +  for (const part of committish.split('::')) {
    +    // if the item has no : the n it is a commit-ish
    +    if (!part.includes(':')) {
    +      if (res.gitRange) {
    +        throw new Error('cannot override existing semver range with a committish')
    +      }
    +      if (res.gitCommittish) {
    +        throw new Error('cannot override existing committish with a second committish')
    +      }
    +      res.gitCommittish = part
    +      continue
    +    }
    +    // split on name:value
    +    const [name, value] = part.split(':')
    +    // if name is semver do semver lookup of ref or tag
    +    if (name === 'semver') {
    +      if (res.gitCommittish) {
    +        throw new Error('cannot override existing committish with a semver range')
    +      }
    +      if (res.gitRange) {
    +        throw new Error('cannot override existing semver range with a second semver range')
    +      }
    +      res.gitRange = decodeURIComponent(value)
    +      continue
    +    }
    +    if (name === 'path') {
    +      if (res.gitSubdir) {
    +        throw new Error('cannot override existing path with a second path')
    +      }
    +      res.gitSubdir = `/${value}`
    +      continue
    +    }
    +    log.warn('npm-package-arg', `ignoring unknown key "${name}"`)
    +  }
    +}
    +
    +function fromFile (res, where) {
    +  if (!where) {
    +    where = process.cwd()
    +  }
    +  res.type = isFilename.test(res.rawSpec) ? 'file' : 'directory'
    +  res.where = where
    +
    +  // always put the '/' on where when resolving urls, or else
    +  // file:foo from /path/to/bar goes to /path/to/foo, when we want
    +  // it to be /path/to/bar/foo
    +
    +  let specUrl
    +  let resolvedUrl
    +  const prefix = (!/^file:/.test(res.rawSpec) ? 'file:' : '')
    +  const rawWithPrefix = prefix + res.rawSpec
    +  let rawNoPrefix = rawWithPrefix.replace(/^file:/, '')
    +  try {
    +    resolvedUrl = new URL(rawWithPrefix, `file://${path.resolve(where)}/`)
    +    specUrl = new URL(rawWithPrefix)
    +  } catch (originalError) {
    +    const er = new Error('Invalid file: URL, must comply with RFC 8089')
    +    throw Object.assign(er, {
    +      raw: res.rawSpec,
    +      spec: res,
    +      where,
    +      originalError,
    +    })
    +  }
    +
    +  // XXX backwards compatibility lack of compliance with RFC 8089
    +  if (resolvedUrl.host && resolvedUrl.host !== 'localhost') {
    +    const rawSpec = res.rawSpec.replace(/^file:\/\//, 'file:///')
    +    resolvedUrl = new URL(rawSpec, `file://${path.resolve(where)}/`)
    +    specUrl = new URL(rawSpec)
    +    rawNoPrefix = rawSpec.replace(/^file:/, '')
    +  }
    +  // turn file:/../foo into file:../foo
    +  // for 1, 2 or 3 leading slashes since we attempted
    +  // in the previous step to make it a file protocol url with a leading slash
    +  if (/^\/{1,3}\.\.?(\/|$)/.test(rawNoPrefix)) {
    +    const rawSpec = res.rawSpec.replace(/^file:\/{1,3}/, 'file:')
    +    resolvedUrl = new URL(rawSpec, `file://${path.resolve(where)}/`)
    +    specUrl = new URL(rawSpec)
    +    rawNoPrefix = rawSpec.replace(/^file:/, '')
    +  }
    +  // XXX end RFC 8089 violation backwards compatibility section
    +
    +  // turn /C:/blah into just C:/blah on windows
    +  let specPath = decodeURIComponent(specUrl.pathname)
    +  let resolvedPath = decodeURIComponent(resolvedUrl.pathname)
    +  if (isWindows) {
    +    specPath = specPath.replace(/^\/+([a-z]:\/)/i, '$1')
    +    resolvedPath = resolvedPath.replace(/^\/+([a-z]:\/)/i, '$1')
    +  }
    +
    +  // replace ~ with homedir, but keep the ~ in the saveSpec
    +  // otherwise, make it relative to where param
    +  if (/^\/~(\/|$)/.test(specPath)) {
    +    res.saveSpec = `file:${specPath.substr(1)}`
    +    resolvedPath = path.resolve(homedir(), specPath.substr(3))
    +  } else if (!path.isAbsolute(rawNoPrefix)) {
    +    res.saveSpec = `file:${path.relative(where, resolvedPath)}`
    +  } else {
    +    res.saveSpec = `file:${path.resolve(resolvedPath)}`
    +  }
    +
    +  res.fetchSpec = path.resolve(where, resolvedPath)
    +  return res
    +}
    +
    +function fromHostedGit (res, hosted) {
    +  res.type = 'git'
    +  res.hosted = hosted
    +  res.saveSpec = hosted.toString({ noGitPlus: false, noCommittish: false })
    +  res.fetchSpec = hosted.getDefaultRepresentation() === 'shortcut' ? null : hosted.toString()
    +  setGitAttrs(res, hosted.committish)
    +  return res
    +}
    +
    +function unsupportedURLType (protocol, spec) {
    +  const err = new Error(`Unsupported URL Type "${protocol}": ${spec}`)
    +  err.code = 'EUNSUPPORTEDPROTOCOL'
    +  return err
    +}
    +
    +function fromURL (res) {
    +  let rawSpec = res.rawSpec
    +  res.saveSpec = rawSpec
    +  if (rawSpec.startsWith('git+ssh:')) {
    +    // git ssh specifiers are overloaded to also use scp-style git
    +    // specifiers, so we have to parse those out and treat them special.
    +    // They are NOT true URIs, so we can't hand them to URL.
    +
    +    // This regex looks for things that look like:
    +    // git+ssh://git@my.custom.git.com:username/project.git#deadbeef
    +    // ...and various combinations. The username in the beginning is *required*.
    +    const matched = rawSpec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i)
    +    // Filter out all-number "usernames" which are really port numbers
    +    // They can either be :1234 :1234/ or :1234/path but not :12abc
    +    if (matched && !matched[1].match(isPortNumber)) {
    +      res.type = 'git'
    +      setGitAttrs(res, matched[2])
    +      res.fetchSpec = matched[1]
    +      return res
    +    }
    +  } else if (rawSpec.startsWith('git+file://')) {
    +    // URL can't handle windows paths
    +    rawSpec = rawSpec.replace(/\\/g, '/')
    +  }
    +  const parsedUrl = new URL(rawSpec)
    +  // check the protocol, and then see if it's git or not
    +  switch (parsedUrl.protocol) {
    +    case 'git:':
    +    case 'git+http:':
    +    case 'git+https:':
    +    case 'git+rsync:':
    +    case 'git+ftp:':
    +    case 'git+file:':
    +    case 'git+ssh:':
    +      res.type = 'git'
    +      setGitAttrs(res, parsedUrl.hash.slice(1))
    +      if (parsedUrl.protocol === 'git+file:' && /^git\+file:\/\/[a-z]:/i.test(rawSpec)) {
    +        // URL can't handle drive letters on windows file paths, the host can't contain a :
    +        res.fetchSpec = `git+file://${parsedUrl.host.toLowerCase()}:${parsedUrl.pathname}`
    +      } else {
    +        parsedUrl.hash = ''
    +        res.fetchSpec = parsedUrl.toString()
    +      }
    +      if (res.fetchSpec.startsWith('git+')) {
    +        res.fetchSpec = res.fetchSpec.slice(4)
    +      }
    +      break
    +    case 'http:':
    +    case 'https:':
    +      res.type = 'remote'
    +      res.fetchSpec = res.saveSpec
    +      break
    +
    +    default:
    +      throw unsupportedURLType(parsedUrl.protocol, rawSpec)
    +  }
    +
    +  return res
    +}
    +
    +function fromAlias (res, where) {
    +  const subSpec = npa(res.rawSpec.substr(4), where)
    +  if (subSpec.type === 'alias') {
    +    throw new Error('nested aliases not supported')
    +  }
    +
    +  if (!subSpec.registry) {
    +    throw new Error('aliases only work for registry deps')
    +  }
    +
    +  if (!subSpec.name) {
    +    throw new Error('aliases must have a name')
    +  }
    +
    +  res.subSpec = subSpec
    +  res.registry = true
    +  res.type = 'alias'
    +  res.saveSpec = null
    +  res.fetchSpec = null
    +  return res
    +}
    +
    +function fromRegistry (res) {
    +  res.registry = true
    +  const spec = res.rawSpec.trim()
    +  // no save spec for registry components as we save based on the fetched
    +  // version, not on the argument so this can't compute that.
    +  res.saveSpec = null
    +  res.fetchSpec = spec
    +  const version = semver.valid(spec, true)
    +  const range = semver.validRange(spec, true)
    +  if (version) {
    +    res.type = 'version'
    +  } else if (range) {
    +    res.type = 'range'
    +  } else {
    +    if (encodeURIComponent(spec) !== spec) {
    +      throw invalidTagName(spec, res.raw)
    +    }
    +    res.type = 'tag'
    +  }
    +  return res
    +}
    diff --git a/node_modules/npm/node_modules/npm-package-arg/package.json b/node_modules/npm/node_modules/npm-package-arg/package.json
    new file mode 100644
    index 00000000..ab285eb6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-package-arg/package.json
    @@ -0,0 +1,61 @@
    +{
    +  "name": "npm-package-arg",
    +  "version": "12.0.1",
    +  "description": "Parse the things that can be arguments to `npm install`",
    +  "main": "./lib/npa.js",
    +  "directories": {
    +    "test": "test"
    +  },
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "dependencies": {
    +    "hosted-git-info": "^8.0.0",
    +    "proc-log": "^5.0.0",
    +    "semver": "^7.3.5",
    +    "validate-npm-package-name": "^6.0.0"
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.4",
    +    "tap": "^16.0.1"
    +  },
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "npmclilint": "npmcli-lint",
    +    "lint": "npm run eslint",
    +    "lintfix": "npm run eslint -- --fix",
    +    "posttest": "npm run lint",
    +    "postsnap": "npm run lintfix --",
    +    "postlint": "template-oss-check",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/npm-package-arg.git"
    +  },
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "bugs": {
    +    "url": "https://github.com/npm/npm-package-arg/issues"
    +  },
    +  "homepage": "https://github.com/npm/npm-package-arg",
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "tap": {
    +    "branches": 97,
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.4",
    +    "publish": true
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-packlist/LICENSE b/node_modules/npm/node_modules/npm-packlist/LICENSE
    new file mode 100644
    index 00000000..19129e31
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-packlist/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/npm-packlist/lib/index.js b/node_modules/npm/node_modules/npm-packlist/lib/index.js
    new file mode 100644
    index 00000000..9e4e7db0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-packlist/lib/index.js
    @@ -0,0 +1,457 @@
    +'use strict'
    +
    +const { Walker: IgnoreWalker } = require('ignore-walk')
    +const { lstatSync: lstat, readFileSync: readFile } = require('fs')
    +const { basename, dirname, extname, join, relative, resolve, sep } = require('path')
    +
    +// symbols used to represent synthetic rule sets
    +const defaultRules = Symbol('npm-packlist.rules.default')
    +const strictRules = Symbol('npm-packlist.rules.strict')
    +
    +// There may be others, but :?|<> are handled by node-tar
    +const nameIsBadForWindows = file => /\*/.test(file)
    +
    +// these are the default rules that are applied to everything except for non-link bundled deps
    +const defaults = [
    +  '.npmignore',
    +  '.gitignore',
    +  '**/.git',
    +  '**/.svn',
    +  '**/.hg',
    +  '**/CVS',
    +  '**/.git/**',
    +  '**/.svn/**',
    +  '**/.hg/**',
    +  '**/CVS/**',
    +  '/.lock-wscript',
    +  '/.wafpickle-*',
    +  '/build/config.gypi',
    +  'npm-debug.log',
    +  '**/.npmrc',
    +  '.*.swp',
    +  '.DS_Store',
    +  '**/.DS_Store/**',
    +  '._*',
    +  '**/._*/**',
    +  '*.orig',
    +  '/archived-packages/**',
    +]
    +
    +const strictDefaults = [
    +  // these are forcibly excluded
    +  '/.git',
    +]
    +
    +const normalizePath = (path) => path.split('\\').join('/')
    +
    +const readOutOfTreeIgnoreFiles = (root, rel, result = []) => {
    +  for (const file of ['.npmignore', '.gitignore']) {
    +    try {
    +      const ignoreContent = readFile(join(root, file), { encoding: 'utf8' })
    +      result.push(ignoreContent)
    +      // break the loop immediately after reading, this allows us to prioritize
    +      // the .npmignore and discard the .gitignore if one is present
    +      break
    +    } catch (err) {
    +      // we ignore ENOENT errors completely because we don't care if the file doesn't exist
    +      // but we throw everything else because failing to read a file that does exist is
    +      // something that the user likely wants to know about
    +      // istanbul ignore next -- we do not need to test a thrown error
    +      if (err.code !== 'ENOENT') {
    +        throw err
    +      }
    +    }
    +  }
    +
    +  if (!rel) {
    +    return result
    +  }
    +
    +  const firstRel = rel.split(sep, 1)[0]
    +  const newRoot = join(root, firstRel)
    +  const newRel = relative(newRoot, join(root, rel))
    +
    +  return readOutOfTreeIgnoreFiles(newRoot, newRel, result)
    +}
    +
    +class PackWalker extends IgnoreWalker {
    +  constructor (tree, opts) {
    +    const options = {
    +      ...opts,
    +      includeEmpty: false,
    +      follow: false,
    +      // we path.resolve() here because ignore-walk doesn't do it and we want full paths
    +      path: resolve(opts?.path || tree.path).replace(/\\/g, '/'),
    +      ignoreFiles: opts?.ignoreFiles || [
    +        defaultRules,
    +        'package.json',
    +        '.npmignore',
    +        '.gitignore',
    +        strictRules,
    +      ],
    +    }
    +
    +    super(options)
    +    this.isPackage = options.isPackage
    +    this.seen = options.seen || new Set()
    +    this.tree = tree
    +    this.requiredFiles = options.requiredFiles || []
    +
    +    const additionalDefaults = []
    +    if (options.prefix && options.workspaces) {
    +      const path = normalizePath(options.path)
    +      const prefix = normalizePath(options.prefix)
    +      const workspaces = options.workspaces.map((ws) => normalizePath(ws))
    +
    +      // istanbul ignore else - this does nothing unless we need it to
    +      if (path !== prefix && workspaces.includes(path)) {
    +        // if path and prefix are not the same directory, and workspaces has path in it
    +        // then we know path is a workspace directory. in order to not drop ignore rules
    +        // from directories between the workspaces root (prefix) and the workspace itself
    +        // (path) we need to find and read those now
    +        const relpath = relative(options.prefix, dirname(options.path))
    +        additionalDefaults.push(...readOutOfTreeIgnoreFiles(options.prefix, relpath))
    +      } else if (path === prefix) {
    +        // on the other hand, if the path and prefix are the same, then we ignore workspaces
    +        // so that we don't pack a workspace as part of the root project. append them as
    +        // normalized relative paths from the root
    +        additionalDefaults.push(...workspaces.map((w) => normalizePath(relative(options.path, w))))
    +      }
    +    }
    +
    +    // go ahead and inject the default rules now
    +    this.injectRules(defaultRules, [...defaults, ...additionalDefaults])
    +
    +    if (!this.isPackage) {
    +      // if this instance is not a package, then place some strict default rules, and append
    +      // known required files for this directory
    +      this.injectRules(strictRules, [
    +        ...strictDefaults,
    +        ...this.requiredFiles.map((file) => `!${file}`),
    +      ])
    +    }
    +  }
    +
    +  // overridden method: we intercept the reading of the package.json file here so that we can
    +  // process it into both the package.json file rules as well as the strictRules synthetic rule set
    +  addIgnoreFile (file, callback) {
    +    // if we're adding anything other than package.json, then let ignore-walk handle it
    +    if (file !== 'package.json' || !this.isPackage) {
    +      return super.addIgnoreFile(file, callback)
    +    }
    +
    +    return this.processPackage(callback)
    +  }
    +
    +  // overridden method: if we're done, but we're a package, then we also need to evaluate bundles
    +  // before we actually emit our done event
    +  emit (ev, data) {
    +    if (ev !== 'done' || !this.isPackage) {
    +      return super.emit(ev, data)
    +    }
    +
    +    // we intentionally delay the done event while keeping the function sync here
    +    // eslint-disable-next-line promise/catch-or-return, promise/always-return
    +    this.gatherBundles().then(() => {
    +      super.emit('done', this.result)
    +    })
    +    return true
    +  }
    +
    +  // overridden method: before actually filtering, we make sure that we've removed the rules for
    +  // files that should no longer take effect due to our order of precedence
    +  filterEntries () {
    +    if (this.ignoreRules['package.json']) {
    +      // package.json means no .npmignore or .gitignore
    +      this.ignoreRules['.npmignore'] = null
    +      this.ignoreRules['.gitignore'] = null
    +    } else if (this.ignoreRules['.npmignore']) {
    +      // .npmignore means no .gitignore
    +      this.ignoreRules['.gitignore'] = null
    +    }
    +
    +    return super.filterEntries()
    +  }
    +
    +  // overridden method: we never want to include anything that isn't a file or directory
    +  onstat (opts, callback) {
    +    if (!opts.st.isFile() && !opts.st.isDirectory()) {
    +      return callback()
    +    }
    +
    +    return super.onstat(opts, callback)
    +  }
    +
    +  // overridden method: we want to refuse to pack files that are invalid, node-tar protects us from
    +  // a lot of them but not all
    +  stat (opts, callback) {
    +    if (nameIsBadForWindows(opts.entry)) {
    +      return callback()
    +    }
    +
    +    return super.stat(opts, callback)
    +  }
    +
    +  // overridden method: this is called to create options for a child walker when we step
    +  // in to a normal child directory (this will never be a bundle). the default method here
    +  // copies the root's `ignoreFiles` value, but we don't want to respect package.json for
    +  // subdirectories, so we override it with a list that intentionally omits package.json
    +  walkerOpt (entry, opts) {
    +    let ignoreFiles = null
    +
    +    // however, if we have a tree, and we have workspaces, and the directory we're about
    +    // to step into is a workspace, then we _do_ want to respect its package.json
    +    if (this.tree.workspaces) {
    +      const workspaceDirs = [...this.tree.workspaces.values()]
    +        .map((dir) => dir.replace(/\\/g, '/'))
    +
    +      const entryPath = join(this.path, entry).replace(/\\/g, '/')
    +      if (workspaceDirs.includes(entryPath)) {
    +        ignoreFiles = [
    +          defaultRules,
    +          'package.json',
    +          '.npmignore',
    +          '.gitignore',
    +          strictRules,
    +        ]
    +      }
    +    } else {
    +      ignoreFiles = [
    +        defaultRules,
    +        '.npmignore',
    +        '.gitignore',
    +        strictRules,
    +      ]
    +    }
    +
    +    return {
    +      ...super.walkerOpt(entry, opts),
    +      ignoreFiles,
    +      // we map over our own requiredFiles and pass ones that are within this entry
    +      requiredFiles: this.requiredFiles
    +        .map((file) => {
    +          if (relative(file, entry) === '..') {
    +            return relative(entry, file).replace(/\\/g, '/')
    +          }
    +          return false
    +        })
    +        .filter(Boolean),
    +    }
    +  }
    +
    +  // overridden method: we want child walkers to be instances of this class, not ignore-walk
    +  walker (entry, opts, callback) {
    +    new PackWalker(this.tree, this.walkerOpt(entry, opts)).on('done', callback).start()
    +  }
    +
    +  // overridden method: we use a custom sort method to help compressibility
    +  sort (a, b) {
    +    // optimize for compressibility
    +    // extname, then basename, then locale alphabetically
    +    // https://twitter.com/isntitvacant/status/1131094910923231232
    +    const exta = extname(a).toLowerCase()
    +    const extb = extname(b).toLowerCase()
    +    const basea = basename(a).toLowerCase()
    +    const baseb = basename(b).toLowerCase()
    +
    +    return exta.localeCompare(extb, 'en') ||
    +      basea.localeCompare(baseb, 'en') ||
    +      a.localeCompare(b, 'en')
    +  }
    +
    +  // convenience method: this joins the given rules with newlines, appends a trailing newline,
    +  // and calls the internal onReadIgnoreFile method
    +  injectRules (filename, rules, callback = () => {}) {
    +    this.onReadIgnoreFile(filename, `${rules.join('\n')}\n`, callback)
    +  }
    +
    +  // custom method: this is called by addIgnoreFile when we find a package.json, it uses the
    +  // arborist tree to pull both default rules and strict rules for the package
    +  processPackage (callback) {
    +    const {
    +      bin,
    +      browser,
    +      files,
    +      main,
    +    } = this.tree.package
    +
    +    // rules in these arrays are inverted since they are patterns we want to _not_ ignore
    +    const ignores = []
    +    const strict = [
    +      ...strictDefaults,
    +      '!/package.json',
    +      '!/readme{,.*[^~$]}',
    +      '!/copying{,.*[^~$]}',
    +      '!/license{,.*[^~$]}',
    +      '!/licence{,.*[^~$]}',
    +      '/.git',
    +      '/node_modules',
    +      '.npmrc',
    +      '/package-lock.json',
    +      '/yarn.lock',
    +      '/pnpm-lock.yaml',
    +      '/bun.lockb',
    +    ]
    +
    +    // if we have a files array in our package, we need to pull rules from it
    +    if (files) {
    +      for (let file of files) {
    +        // invert the rule because these are things we want to include
    +        if (file.startsWith('./')) {
    +          file = file.slice(1)
    +        }
    +        if (file.endsWith('/*')) {
    +          file += '*'
    +        }
    +        const inverse = `!${file}`
    +        try {
    +          // if an entry in the files array is a specific file, then we need to include it as a
    +          // strict requirement for this package. if it's a directory or a pattern, it's a default
    +          // pattern instead. this is ugly, but we have to stat to find out if it's a file
    +          const stat = lstat(join(this.path, file.replace(/^!+/, '')).replace(/\\/g, '/'))
    +          // if we have a file and we know that, it's strictly required
    +          if (stat.isFile()) {
    +            strict.unshift(inverse)
    +            this.requiredFiles.push(file.startsWith('/') ? file.slice(1) : file)
    +          } else if (stat.isDirectory()) {
    +            // otherwise, it's a default ignore, and since we got here we know it's not a pattern
    +            // so we include the directory contents
    +            ignores.push(inverse)
    +            ignores.push(`${inverse}/**`)
    +          }
    +          // if the thing exists, but is neither a file or a directory, we don't want it at all
    +        } catch (err) {
    +          // if lstat throws, then we assume we're looking at a pattern and treat it as a default
    +          ignores.push(inverse)
    +        }
    +      }
    +
    +      // we prepend a '*' to exclude everything, followed by our inverted file rules
    +      // which now mean to include those
    +      this.injectRules('package.json', ['*', ...ignores])
    +    }
    +
    +    // browser is required
    +    if (browser) {
    +      strict.push(`!/${browser}`)
    +    }
    +
    +    // main is required
    +    if (main) {
    +      strict.push(`!/${main}`)
    +    }
    +
    +    // each bin is required
    +    if (bin) {
    +      for (const key in bin) {
    +        strict.push(`!/${bin[key]}`)
    +      }
    +    }
    +
    +    // and now we add all of the strict rules to our synthetic file
    +    this.injectRules(strictRules, strict, callback)
    +  }
    +
    +  // custom method: after we've finished gathering the files for the root package, we call this
    +  // before emitting the 'done' event in order to gather all of the files for bundled deps
    +  async gatherBundles () {
    +    if (this.seen.has(this.tree)) {
    +      return
    +    }
    +
    +    // add this node to our seen tracker
    +    this.seen.add(this.tree)
    +
    +    // if we're the project root, then we look at our bundleDependencies, otherwise we got here
    +    // because we're a bundled dependency of the root, which means we need to include all prod
    +    // and optional dependencies in the bundle
    +    let toBundle
    +    if (this.tree.isProjectRoot) {
    +      const { bundleDependencies } = this.tree.package
    +      toBundle = bundleDependencies || []
    +    } else {
    +      const { dependencies, optionalDependencies } = this.tree.package
    +      toBundle = Object.keys(dependencies || {}).concat(Object.keys(optionalDependencies || {}))
    +    }
    +
    +    for (const dep of toBundle) {
    +      const edge = this.tree.edgesOut.get(dep)
    +      // no edgeOut = missing node, so skip it. we can't pack it if it's not here
    +      // we also refuse to pack peer dependencies and dev dependencies
    +      if (!edge || edge.peer || edge.dev) {
    +        continue
    +      }
    +
    +      // get a reference to the node we're bundling
    +      const node = this.tree.edgesOut.get(dep).to
    +      // if there's no node, this is most likely an optional dependency that hasn't been
    +      // installed. just skip it.
    +      if (!node) {
    +        continue
    +      }
    +      // we use node.path for the path because we want the location the node was linked to,
    +      // not where it actually lives on disk
    +      const path = node.path
    +      // but link nodes don't have edgesOut, so we need to pass in the target of the node
    +      // in order to make sure we correctly traverse its dependencies
    +      const tree = node.target
    +
    +      // and start building options to be passed to the walker for this package
    +      const walkerOpts = {
    +        path,
    +        isPackage: true,
    +        ignoreFiles: [],
    +        seen: this.seen, // pass through seen so we can prevent infinite circular loops
    +      }
    +
    +      // if our node is a link, we apply defaultRules. we don't do this for regular bundled
    +      // deps because their .npmignore and .gitignore files are excluded by default and may
    +      // override defaults
    +      if (node.isLink) {
    +        walkerOpts.ignoreFiles.push(defaultRules)
    +      }
    +
    +      // _all_ nodes will follow package.json rules from their package root
    +      walkerOpts.ignoreFiles.push('package.json')
    +
    +      // only link nodes will obey .npmignore or .gitignore
    +      if (node.isLink) {
    +        walkerOpts.ignoreFiles.push('.npmignore')
    +        walkerOpts.ignoreFiles.push('.gitignore')
    +      }
    +
    +      // _all_ nodes follow strict rules
    +      walkerOpts.ignoreFiles.push(strictRules)
    +
    +      // create a walker for this dependency and gather its results
    +      const walker = new PackWalker(tree, walkerOpts)
    +      const bundled = await new Promise((pResolve, pReject) => {
    +        walker.on('error', pReject)
    +        walker.on('done', pResolve)
    +        walker.start()
    +      })
    +
    +      // now we make sure we have our paths correct from the root, and accumulate everything into
    +      // our own result set to deduplicate
    +      const relativeFrom = relative(this.root, walker.path)
    +      for (const file of bundled) {
    +        this.result.add(join(relativeFrom, file).replace(/\\/g, '/'))
    +      }
    +    }
    +  }
    +}
    +
    +const walk = (tree, options, callback) => {
    +  if (typeof options === 'function') {
    +    callback = options
    +    options = {}
    +  }
    +  const p = new Promise((pResolve, pReject) => {
    +    new PackWalker(tree, { ...options, isPackage: true })
    +      .on('done', pResolve).on('error', pReject).start()
    +  })
    +  return callback ? p.then(res => callback(null, res), callback) : p
    +}
    +
    +module.exports = walk
    +walk.Walker = PackWalker
    diff --git a/node_modules/npm/node_modules/npm-packlist/package.json b/node_modules/npm/node_modules/npm-packlist/package.json
    new file mode 100644
    index 00000000..b2586461
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-packlist/package.json
    @@ -0,0 +1,61 @@
    +{
    +  "name": "npm-packlist",
    +  "version": "10.0.0",
    +  "description": "Get a list of the files to add from a folder into an npm package",
    +  "directories": {
    +    "test": "test"
    +  },
    +  "main": "lib/index.js",
    +  "dependencies": {
    +    "ignore-walk": "^7.0.0"
    +  },
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "devDependencies": {
    +    "@npmcli/arborist": "^8.0.0",
    +    "@npmcli/eslint-config": "^5.0.1",
    +    "@npmcli/template-oss": "4.23.4",
    +    "mutate-fs": "^2.1.1",
    +    "tap": "^16.0.1"
    +  },
    +  "scripts": {
    +    "test": "tap",
    +    "posttest": "npm run lint",
    +    "snap": "tap",
    +    "postsnap": "npm run lintfix --",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
    +    "lint": "npm run eslint",
    +    "lintfix": "npm run eslint -- --fix",
    +    "npmclilint": "npmcli-lint",
    +    "postlint": "template-oss-check",
    +    "template-oss-apply": "template-oss-apply --force"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/npm-packlist.git"
    +  },
    +  "tap": {
    +    "test-env": [
    +      "LC_ALL=sk"
    +    ],
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ],
    +    "files": [
    +      "test/*.js"
    +    ]
    +  },
    +  "engines": {
    +    "node": "^20.17.0 || >=22.9.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.4",
    +    "publish": true
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-pick-manifest/LICENSE.md b/node_modules/npm/node_modules/npm-pick-manifest/LICENSE.md
    new file mode 100644
    index 00000000..8d28acf8
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-pick-manifest/LICENSE.md
    @@ -0,0 +1,16 @@
    +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/npm/node_modules/npm-pick-manifest/lib/index.js b/node_modules/npm/node_modules/npm-pick-manifest/lib/index.js
    new file mode 100644
    index 00000000..82807971
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-pick-manifest/lib/index.js
    @@ -0,0 +1,224 @@
    +'use strict'
    +
    +const npa = require('npm-package-arg')
    +const semver = require('semver')
    +const { checkEngine } = require('npm-install-checks')
    +const normalizeBin = require('npm-normalize-package-bin')
    +
    +const engineOk = (manifest, npmVersion, nodeVersion) => {
    +  try {
    +    checkEngine(manifest, npmVersion, nodeVersion)
    +    return true
    +  } catch (_) {
    +    return false
    +  }
    +}
    +
    +const isBefore = (verTimes, ver, time) =>
    +  !verTimes || !verTimes[ver] || Date.parse(verTimes[ver]) <= time
    +
    +const avoidSemverOpt = { includePrerelease: true, loose: true }
    +const shouldAvoid = (ver, avoid) =>
    +  avoid && semver.satisfies(ver, avoid, avoidSemverOpt)
    +
    +const decorateAvoid = (result, avoid) =>
    +  result && shouldAvoid(result.version, avoid)
    +    ? { ...result, _shouldAvoid: true }
    +    : result
    +
    +const pickManifest = (packument, wanted, opts) => {
    +  const {
    +    defaultTag = 'latest',
    +    before = null,
    +    nodeVersion = process.version,
    +    npmVersion = null,
    +    includeStaged = false,
    +    avoid = null,
    +    avoidStrict = false,
    +  } = opts
    +
    +  const { name, time: verTimes } = packument
    +  const versions = packument.versions || {}
    +
    +  if (avoidStrict) {
    +    const looseOpts = {
    +      ...opts,
    +      avoidStrict: false,
    +    }
    +
    +    const result = pickManifest(packument, wanted, looseOpts)
    +    if (!result || !result._shouldAvoid) {
    +      return result
    +    }
    +
    +    const caret = pickManifest(packument, `^${result.version}`, looseOpts)
    +    if (!caret || !caret._shouldAvoid) {
    +      return {
    +        ...caret,
    +        _outsideDependencyRange: true,
    +        _isSemVerMajor: false,
    +      }
    +    }
    +
    +    const star = pickManifest(packument, '*', looseOpts)
    +    if (!star || !star._shouldAvoid) {
    +      return {
    +        ...star,
    +        _outsideDependencyRange: true,
    +        _isSemVerMajor: true,
    +      }
    +    }
    +
    +    throw Object.assign(new Error(`No avoidable versions for ${name}`), {
    +      code: 'ETARGET',
    +      name,
    +      wanted,
    +      avoid,
    +      before,
    +      versions: Object.keys(versions),
    +    })
    +  }
    +
    +  const staged = (includeStaged && packument.stagedVersions &&
    +    packument.stagedVersions.versions) || {}
    +  const restricted = (packument.policyRestrictions &&
    +    packument.policyRestrictions.versions) || {}
    +
    +  const time = before && verTimes ? +(new Date(before)) : Infinity
    +  const spec = npa.resolve(name, wanted || defaultTag)
    +  const type = spec.type
    +  const distTags = packument['dist-tags'] || {}
    +
    +  if (type !== 'tag' && type !== 'version' && type !== 'range') {
    +    throw new Error('Only tag, version, and range are supported')
    +  }
    +
    +  // if the type is 'tag', and not just the implicit default, then it must
    +  // be that exactly, or nothing else will do.
    +  if (wanted && type === 'tag') {
    +    const ver = distTags[wanted]
    +    // if the version in the dist-tags is before the before date, then
    +    // we use that.  Otherwise, we get the highest precedence version
    +    // prior to the dist-tag.
    +    if (isBefore(verTimes, ver, time)) {
    +      return decorateAvoid(versions[ver] || staged[ver] || restricted[ver], avoid)
    +    } else {
    +      return pickManifest(packument, `<=${ver}`, opts)
    +    }
    +  }
    +
    +  // similarly, if a specific version, then only that version will do
    +  if (wanted && type === 'version') {
    +    const ver = semver.clean(wanted, { loose: true })
    +    const mani = versions[ver] || staged[ver] || restricted[ver]
    +    return isBefore(verTimes, ver, time) ? decorateAvoid(mani, avoid) : null
    +  }
    +
    +  // ok, sort based on our heuristics, and pick the best fit
    +  const range = type === 'range' ? wanted : '*'
    +
    +  // if the range is *, then we prefer the 'latest' if available
    +  // but skip this if it should be avoided, in that case we have
    +  // to try a little harder.
    +  const defaultVer = distTags[defaultTag]
    +  if (defaultVer &&
    +      (range === '*' || semver.satisfies(defaultVer, range, { loose: true })) &&
    +      !restricted[defaultVer] &&
    +      !shouldAvoid(defaultVer, avoid)) {
    +    const mani = versions[defaultVer]
    +    const ok = mani &&
    +      isBefore(verTimes, defaultVer, time) &&
    +      engineOk(mani, npmVersion, nodeVersion) &&
    +      !mani.deprecated &&
    +      !staged[defaultVer]
    +    if (ok) {
    +      return mani
    +    }
    +  }
    +
    +  // ok, actually have to sort the list and take the winner
    +  const allEntries = Object.entries(versions)
    +    .concat(Object.entries(staged))
    +    .concat(Object.entries(restricted))
    +    .filter(([ver]) => isBefore(verTimes, ver, time))
    +
    +  if (!allEntries.length) {
    +    throw Object.assign(new Error(`No versions available for ${name}`), {
    +      code: 'ENOVERSIONS',
    +      name,
    +      type,
    +      wanted,
    +      before,
    +      versions: Object.keys(versions),
    +    })
    +  }
    +
    +  const sortSemverOpt = { loose: true }
    +  const entries = allEntries.filter(([ver]) =>
    +    semver.satisfies(ver, range, { loose: true }))
    +    .sort((a, b) => {
    +      const [vera, mania] = a
    +      const [verb, manib] = b
    +      const notavoida = !shouldAvoid(vera, avoid)
    +      const notavoidb = !shouldAvoid(verb, avoid)
    +      const notrestra = !restricted[vera]
    +      const notrestrb = !restricted[verb]
    +      const notstagea = !staged[vera]
    +      const notstageb = !staged[verb]
    +      const notdepra = !mania.deprecated
    +      const notdeprb = !manib.deprecated
    +      const enginea = engineOk(mania, npmVersion, nodeVersion)
    +      const engineb = engineOk(manib, npmVersion, nodeVersion)
    +      // sort by:
    +      // - not an avoided version
    +      // - not restricted
    +      // - not staged
    +      // - not deprecated and engine ok
    +      // - engine ok
    +      // - not deprecated
    +      // - semver
    +      return (notavoidb - notavoida) ||
    +        (notrestrb - notrestra) ||
    +        (notstageb - notstagea) ||
    +        ((notdeprb && engineb) - (notdepra && enginea)) ||
    +        (engineb - enginea) ||
    +        (notdeprb - notdepra) ||
    +        semver.rcompare(vera, verb, sortSemverOpt)
    +    })
    +
    +  return decorateAvoid(entries[0] && entries[0][1], avoid)
    +}
    +
    +module.exports = (packument, wanted, opts = {}) => {
    +  const mani = pickManifest(packument, wanted, opts)
    +  const picked = mani && normalizeBin(mani)
    +  const policyRestrictions = packument.policyRestrictions
    +  const restricted = (policyRestrictions && policyRestrictions.versions) || {}
    +
    +  if (picked && !restricted[picked.version]) {
    +    return picked
    +  }
    +
    +  const { before = null, defaultTag = 'latest' } = opts
    +  const bstr = before ? new Date(before).toLocaleString() : ''
    +  const { name } = packument
    +  const pckg = `${name}@${wanted}` +
    +    (before ? ` with a date before ${bstr}` : '')
    +
    +  const isForbidden = picked && !!restricted[picked.version]
    +  const polMsg = isForbidden ? policyRestrictions.message : ''
    +
    +  const msg = !isForbidden ? `No matching version found for ${pckg}.`
    +    : `Could not download ${pckg} due to policy violations:\n${polMsg}`
    +
    +  const code = isForbidden ? 'E403' : 'ETARGET'
    +  throw Object.assign(new Error(msg), {
    +    code,
    +    type: npa.resolve(packument.name, wanted).type,
    +    wanted,
    +    versions: Object.keys(packument.versions ?? {}),
    +    name,
    +    distTags: packument['dist-tags'],
    +    defaultTag,
    +  })
    +}
    diff --git a/node_modules/npm/node_modules/npm-pick-manifest/package.json b/node_modules/npm/node_modules/npm-pick-manifest/package.json
    new file mode 100644
    index 00000000..5763088c
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-pick-manifest/package.json
    @@ -0,0 +1,58 @@
    +{
    +  "name": "npm-pick-manifest",
    +  "version": "10.0.0",
    +  "description": "Resolves a matching manifest from a package metadata document according to standard npm semver resolution rules.",
    +  "main": "./lib",
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "scripts": {
    +    "coverage": "tap",
    +    "lint": "npm run eslint",
    +    "test": "tap",
    +    "posttest": "npm run lint",
    +    "postlint": "template-oss-check",
    +    "lintfix": "npm run eslint -- --fix",
    +    "snap": "tap",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/npm-pick-manifest.git"
    +  },
    +  "keywords": [
    +    "npm",
    +    "semver",
    +    "package manager"
    +  ],
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "dependencies": {
    +    "npm-install-checks": "^7.1.0",
    +    "npm-normalize-package-bin": "^4.0.0",
    +    "npm-package-arg": "^12.0.0",
    +    "semver": "^7.3.5"
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "tap": "^16.0.1"
    +  },
    +  "tap": {
    +    "check-coverage": true,
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": true
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-profile/LICENSE.md b/node_modules/npm/node_modules/npm-profile/LICENSE.md
    new file mode 100644
    index 00000000..5fc208ff
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-profile/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/npm/node_modules/npm-profile/lib/index.js b/node_modules/npm/node_modules/npm-profile/lib/index.js
    new file mode 100644
    index 00000000..83ab5e1b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-profile/lib/index.js
    @@ -0,0 +1,278 @@
    +const { URL } = require('node:url')
    +const timers = require('node:timers/promises')
    +const fetch = require('npm-registry-fetch')
    +const { HttpErrorBase } = require('npm-registry-fetch/lib/errors')
    +const { log } = require('proc-log')
    +
    +// try loginWeb, catch the "not supported" message and fall back to couch
    +const login = async (opener, prompter, opts = {}) => {
    +  try {
    +    return await loginWeb(opener, opts)
    +  } catch (er) {
    +    if (er instanceof WebLoginNotSupported) {
    +      log.verbose('web login', 'not supported, trying couch')
    +      const { username, password } = await prompter(opts.creds)
    +      return loginCouch(username, password, opts)
    +    }
    +    throw er
    +  }
    +}
    +
    +const adduser = async (opener, prompter, opts = {}) => {
    +  try {
    +    return await adduserWeb(opener, opts)
    +  } catch (er) {
    +    if (er instanceof WebLoginNotSupported) {
    +      log.verbose('web adduser', 'not supported, trying couch')
    +      const { username, email, password } = await prompter(opts.creds)
    +      return adduserCouch(username, email, password, opts)
    +    }
    +    throw er
    +  }
    +}
    +
    +const adduserWeb = (opener, opts = {}) => {
    +  log.verbose('web adduser', 'before first POST')
    +  return webAuth(opener, opts, { create: true })
    +}
    +
    +const loginWeb = (opener, opts = {}) => {
    +  log.verbose('web login', 'before first POST')
    +  return webAuth(opener, opts, {})
    +}
    +
    +const isValidUrl = u => {
    +  try {
    +    return /^https?:$/.test(new URL(u).protocol)
    +  } catch {
    +    return false
    +  }
    +}
    +
    +const webAuth = async (opener, opts, body) => {
    +  try {
    +    const res = await fetch('/-/v1/login', {
    +      ...opts,
    +      method: 'POST',
    +      body,
    +    })
    +
    +    const content = await res.json()
    +    log.verbose('web auth', 'got response', content)
    +
    +    const { doneUrl, loginUrl } = content
    +    if (!isValidUrl(doneUrl) || !isValidUrl(loginUrl)) {
    +      throw new WebLoginInvalidResponse('POST', res, content)
    +    }
    +
    +    return await webAuthOpener(opener, loginUrl, doneUrl, opts)
    +  } catch (er) {
    +    if ((er.statusCode >= 400 && er.statusCode <= 499) || er.statusCode === 500) {
    +      throw new WebLoginNotSupported('POST', {
    +        status: er.statusCode,
    +        headers: er.headers,
    +      }, er.body)
    +    }
    +    throw er
    +  }
    +}
    +
    +const webAuthOpener = async (opener, loginUrl, doneUrl, opts) => {
    +  const abortController = new AbortController()
    +  const { signal } = abortController
    +  try {
    +    log.verbose('web auth', 'opening url pair')
    +    const [, authResult] = await Promise.all([
    +      opener(loginUrl, { signal }).catch((err) => {
    +        if (err.name === 'AbortError') {
    +          abortController.abort()
    +          return
    +        }
    +        throw err
    +      }),
    +      webAuthCheckLogin(doneUrl, { ...opts, cache: false }, { signal }).then((r) => {
    +        log.verbose('web auth', 'done-check finished')
    +        abortController.abort()
    +        return r
    +      }),
    +    ])
    +    return authResult
    +  } catch (er) {
    +    abortController.abort()
    +    throw er
    +  }
    +}
    +
    +const webAuthCheckLogin = async (doneUrl, opts, { signal } = {}) => {
    +  signal?.throwIfAborted()
    +
    +  const res = await fetch(doneUrl, opts)
    +  const content = await res.json()
    +
    +  if (res.status === 200) {
    +    if (!content.token) {
    +      throw new WebLoginInvalidResponse('GET', res, content)
    +    }
    +    return content
    +  }
    +
    +  if (res.status === 202) {
    +    const retry = +res.headers.get('retry-after') * 1000
    +    if (retry > 0) {
    +      await timers.setTimeout(retry, null, { signal })
    +    }
    +    return webAuthCheckLogin(doneUrl, opts, { signal })
    +  }
    +
    +  throw new WebLoginInvalidResponse('GET', res, content)
    +}
    +
    +const couchEndpoint = (username) => `/-/user/org.couchdb.user:${encodeURIComponent(username)}`
    +
    +const putCouch = async (path, username, body, opts) => {
    +  const result = await fetch.json(`${couchEndpoint(username)}${path}`, {
    +    ...opts,
    +    method: 'PUT',
    +    body,
    +  })
    +  result.username = username
    +  return result
    +}
    +
    +const adduserCouch = async (username, email, password, opts = {}) => {
    +  const body = {
    +    _id: `org.couchdb.user:${username}`,
    +    name: username,
    +    password: password,
    +    email: email,
    +    type: 'user',
    +    roles: [],
    +    date: new Date().toISOString(),
    +  }
    +
    +  log.verbose('adduser', 'before first PUT', {
    +    ...body,
    +    password: 'XXXXX',
    +  })
    +
    +  return putCouch('', username, body, opts)
    +}
    +
    +const loginCouch = async (username, password, opts = {}) => {
    +  const body = {
    +    _id: `org.couchdb.user:${username}`,
    +    name: username,
    +    password: password,
    +    type: 'user',
    +    roles: [],
    +    date: new Date().toISOString(),
    +  }
    +
    +  log.verbose('login', 'before first PUT', {
    +    ...body,
    +    password: 'XXXXX',
    +  })
    +
    +  try {
    +    return await putCouch('', username, body, opts)
    +  } catch (err) {
    +    if (err.code === 'E400') {
    +      err.message = `There is no user with the username "${username}".`
    +      throw err
    +    }
    +
    +    if (err.code !== 'E409') {
    +      throw err
    +    }
    +  }
    +
    +  const result = await fetch.json(couchEndpoint(username), {
    +    ...opts,
    +    query: { write: true },
    +  })
    +
    +  for (const k of Object.keys(result)) {
    +    if (!body[k] || k === 'roles') {
    +      body[k] = result[k]
    +    }
    +  }
    +
    +  return putCouch(`/-rev/${body._rev}`, username, body, {
    +    ...opts,
    +    forceAuth: {
    +      username,
    +      password: Buffer.from(password, 'utf8').toString('base64'),
    +      otp: opts.otp,
    +    },
    +  })
    +}
    +
    +const get = (opts = {}) => fetch.json('/-/npm/v1/user', opts)
    +
    +const set = (profile, opts = {}) => fetch.json('/-/npm/v1/user', {
    +  ...opts,
    +  method: 'POST',
    +  // profile keys can't be empty strings, but they CAN be null
    +  body: Object.fromEntries(Object.entries(profile).map(([k, v]) => [k, v === '' ? null : v])),
    +})
    +
    +const paginate = async (href, opts, items = []) => {
    +  const result = await fetch.json(href, opts)
    +  items = items.concat(result.objects)
    +  if (result.urls.next) {
    +    return paginate(result.urls.next, opts, items)
    +  }
    +  return items
    +}
    +
    +const listTokens = (opts = {}) => paginate('/-/npm/v1/tokens', opts)
    +
    +const removeToken = async (tokenKey, opts = {}) => {
    +  await fetch(`/-/npm/v1/tokens/token/${tokenKey}`, {
    +    ...opts,
    +    method: 'DELETE',
    +    ignoreBody: true,
    +  })
    +  return null
    +}
    +
    +const createToken = (password, readonly, cidrs, opts = {}) => fetch.json('/-/npm/v1/tokens', {
    +  ...opts,
    +  method: 'POST',
    +  body: {
    +    password: password,
    +    readonly: readonly,
    +    cidr_whitelist: cidrs,
    +  },
    +})
    +
    +class WebLoginInvalidResponse extends HttpErrorBase {
    +  constructor (method, res, body) {
    +    super(method, res, body)
    +    this.message = 'Invalid response from web login endpoint'
    +  }
    +}
    +
    +class WebLoginNotSupported extends HttpErrorBase {
    +  constructor (method, res, body) {
    +    super(method, res, body)
    +    this.message = 'Web login not supported'
    +    this.code = 'ENYI'
    +  }
    +}
    +
    +module.exports = {
    +  adduserCouch,
    +  loginCouch,
    +  adduserWeb,
    +  loginWeb,
    +  login,
    +  adduser,
    +  get,
    +  set,
    +  listTokens,
    +  removeToken,
    +  createToken,
    +  webAuthCheckLogin,
    +  webAuthOpener,
    +}
    diff --git a/node_modules/npm/node_modules/npm-profile/package.json b/node_modules/npm/node_modules/npm-profile/package.json
    new file mode 100644
    index 00000000..72a19a08
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-profile/package.json
    @@ -0,0 +1,52 @@
    +{
    +  "name": "npm-profile",
    +  "version": "11.0.1",
    +  "description": "Library for updating an npmjs.com profile",
    +  "keywords": [],
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "dependencies": {
    +    "npm-registry-fetch": "^18.0.0",
    +    "proc-log": "^5.0.0"
    +  },
    +  "main": "./lib/index.js",
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/npm-profile.git"
    +  },
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "nock": "^13.2.4",
    +    "tap": "^16.0.1"
    +  },
    +  "scripts": {
    +    "posttest": "npm run lint",
    +    "test": "tap",
    +    "snap": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "lintfix": "npm run eslint -- --fix",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "tap": {
    +    "check-coverage": true,
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": true
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/LICENSE.md b/node_modules/npm/node_modules/npm-registry-fetch/LICENSE.md
    new file mode 100644
    index 00000000..5fc208ff
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/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/npm/node_modules/npm-registry-fetch/lib/auth.js b/node_modules/npm/node_modules/npm-registry-fetch/lib/auth.js
    new file mode 100644
    index 00000000..9270025f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/lib/auth.js
    @@ -0,0 +1,181 @@
    +'use strict'
    +const fs = require('fs')
    +const npa = require('npm-package-arg')
    +const { URL } = require('url')
    +
    +// Find the longest registry key that is used for some kind of auth
    +// in the options.  Returns the registry key and the auth config.
    +const regFromURI = (uri, opts) => {
    +  const parsed = new URL(uri)
    +  // try to find a config key indicating we have auth for this registry
    +  // can be one of :_authToken, :_auth, :_password and :username, or
    +  // :certfile and :keyfile
    +  // We walk up the "path" until we're left with just //[:],
    +  // stopping when we reach '//'.
    +  let regKey = `//${parsed.host}${parsed.pathname}`
    +  while (regKey.length > '//'.length) {
    +    const authKey = hasAuth(regKey, opts)
    +    // got some auth for this URI
    +    if (authKey) {
    +      return { regKey, authKey }
    +    }
    +
    +    // can be either //host/some/path/:_auth or //host/some/path:_auth
    +    // walk up by removing EITHER what's after the slash OR the slash itself
    +    regKey = regKey.replace(/([^/]+|\/)$/, '')
    +  }
    +  return { regKey: false, authKey: null }
    +}
    +
    +// Not only do we want to know if there is auth, but if we are calling `npm
    +// logout` we want to know what config value specifically provided it.  This is
    +// so we can look up where the config came from to delete it (i.e. user vs
    +// project)
    +const hasAuth = (regKey, opts) => {
    +  if (opts[`${regKey}:_authToken`]) {
    +    return '_authToken'
    +  }
    +  if (opts[`${regKey}:_auth`]) {
    +    return '_auth'
    +  }
    +  if (opts[`${regKey}:username`] && opts[`${regKey}:_password`]) {
    +    // 'password' can be inferred to also be present
    +    return 'username'
    +  }
    +  if (opts[`${regKey}:certfile`] && opts[`${regKey}:keyfile`]) {
    +    // 'keyfile' can be inferred to also be present
    +    return 'certfile'
    +  }
    +  return false
    +}
    +
    +const sameHost = (a, b) => {
    +  const parsedA = new URL(a)
    +  const parsedB = new URL(b)
    +  return parsedA.host === parsedB.host
    +}
    +
    +const getRegistry = opts => {
    +  const { spec } = opts
    +  const { scope: specScope, subSpec } = spec ? npa(spec) : {}
    +  const subSpecScope = subSpec && subSpec.scope
    +  const scope = subSpec ? subSpecScope : specScope
    +  const scopeReg = scope && opts[`${scope}:registry`]
    +  return scopeReg || opts.registry
    +}
    +
    +const maybeReadFile = file => {
    +  try {
    +    return fs.readFileSync(file, 'utf8')
    +  } catch (er) {
    +    if (er.code !== 'ENOENT') {
    +      throw er
    +    }
    +    return null
    +  }
    +}
    +
    +const getAuth = (uri, opts = {}) => {
    +  const { forceAuth } = opts
    +  if (!uri) {
    +    throw new Error('URI is required')
    +  }
    +  const { regKey, authKey } = regFromURI(uri, forceAuth || opts)
    +
    +  // we are only allowed to use what's in forceAuth if specified
    +  if (forceAuth && !regKey) {
    +    return new Auth({
    +      // if we force auth we don't want to refer back to anything in config
    +      regKey: false,
    +      authKey: null,
    +      scopeAuthKey: null,
    +      token: forceAuth._authToken || forceAuth.token,
    +      username: forceAuth.username,
    +      password: forceAuth._password || forceAuth.password,
    +      auth: forceAuth._auth || forceAuth.auth,
    +      certfile: forceAuth.certfile,
    +      keyfile: forceAuth.keyfile,
    +    })
    +  }
    +
    +  // no auth for this URI, but might have it for the registry
    +  if (!regKey) {
    +    const registry = getRegistry(opts)
    +    if (registry && uri !== registry && sameHost(uri, registry)) {
    +      return getAuth(registry, opts)
    +    } else if (registry !== opts.registry) {
    +      // If making a tarball request to a different base URI than the
    +      // registry where we logged in, but the same auth SHOULD be sent
    +      // to that artifact host, then we track where it was coming in from,
    +      // and warn the user if we get a 4xx error on it.
    +      const { regKey: scopeAuthKey, authKey: _authKey } = regFromURI(registry, opts)
    +      return new Auth({ scopeAuthKey, regKey: scopeAuthKey, authKey: _authKey })
    +    }
    +  }
    +
    +  const {
    +    [`${regKey}:_authToken`]: token,
    +    [`${regKey}:username`]: username,
    +    [`${regKey}:_password`]: password,
    +    [`${regKey}:_auth`]: auth,
    +    [`${regKey}:certfile`]: certfile,
    +    [`${regKey}:keyfile`]: keyfile,
    +  } = opts
    +
    +  return new Auth({
    +    scopeAuthKey: null,
    +    regKey,
    +    authKey,
    +    token,
    +    auth,
    +    username,
    +    password,
    +    certfile,
    +    keyfile,
    +  })
    +}
    +
    +class Auth {
    +  constructor ({
    +    token,
    +    auth,
    +    username,
    +    password,
    +    scopeAuthKey,
    +    certfile,
    +    keyfile,
    +    regKey,
    +    authKey,
    +  }) {
    +    // same as regKey but only present for scoped auth. Should have been named scopeRegKey
    +    this.scopeAuthKey = scopeAuthKey
    +    // `${regKey}:${authKey}` will get you back to the auth config that gave us auth
    +    this.regKey = regKey
    +    this.authKey = authKey
    +    this.token = null
    +    this.auth = null
    +    this.isBasicAuth = false
    +    this.cert = null
    +    this.key = null
    +    if (token) {
    +      this.token = token
    +    } else if (auth) {
    +      this.auth = auth
    +    } else if (username && password) {
    +      const p = Buffer.from(password, 'base64').toString('utf8')
    +      this.auth = Buffer.from(`${username}:${p}`, 'utf8').toString('base64')
    +      this.isBasicAuth = true
    +    }
    +    // mTLS may be used in conjunction with another auth method above
    +    if (certfile && keyfile) {
    +      const cert = maybeReadFile(certfile, 'utf-8')
    +      const key = maybeReadFile(keyfile, 'utf-8')
    +      if (cert && key) {
    +        this.cert = cert
    +        this.key = key
    +      }
    +    }
    +  }
    +}
    +
    +module.exports = getAuth
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js b/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js
    new file mode 100644
    index 00000000..2f183082
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js
    @@ -0,0 +1,108 @@
    +'use strict'
    +
    +const errors = require('./errors.js')
    +const { Response } = require('minipass-fetch')
    +const defaultOpts = require('./default-opts.js')
    +const { log } = require('proc-log')
    +const { redact: cleanUrl } = require('@npmcli/redact')
    +
    +/* eslint-disable-next-line max-len */
    +const moreInfoUrl = 'https://github.com/npm/cli/wiki/No-auth-for-URI,-but-auth-present-for-scoped-registry'
    +const checkResponse =
    +  async ({ method, uri, res, startTime, auth, opts }) => {
    +    opts = { ...defaultOpts, ...opts }
    +    if (res.headers.has('npm-notice') && !res.headers.has('x-local-cache')) {
    +      log.notice('', res.headers.get('npm-notice'))
    +    }
    +
    +    if (res.status >= 400) {
    +      logRequest(method, res, startTime)
    +      if (auth && auth.scopeAuthKey && !auth.token && !auth.auth) {
    +      // we didn't have auth for THIS request, but we do have auth for
    +      // requests to the registry indicated by the spec's scope value.
    +      // Warn the user.
    +        log.warn('registry', `No auth for URI, but auth present for scoped registry.
    +
    +URI: ${uri}
    +Scoped Registry Key: ${auth.scopeAuthKey}
    +
    +More info here: ${moreInfoUrl}`)
    +      }
    +      return checkErrors(method, res, startTime, opts)
    +    } else {
    +      res.body.on('end', () => logRequest(method, res, startTime, opts))
    +      if (opts.ignoreBody) {
    +        res.body.resume()
    +        return new Response(null, res)
    +      }
    +      return res
    +    }
    +  }
    +module.exports = checkResponse
    +
    +function logRequest (method, res, startTime) {
    +  const elapsedTime = Date.now() - startTime
    +  const attempt = res.headers.get('x-fetch-attempts')
    +  const attemptStr = attempt && attempt > 1 ? ` attempt #${attempt}` : ''
    +  const cacheStatus = res.headers.get('x-local-cache-status')
    +  const cacheStr = cacheStatus ? ` (cache ${cacheStatus})` : ''
    +  const urlStr = cleanUrl(res.url)
    +
    +  // If make-fetch-happen reports a cache hit, then there was no fetch
    +  if (cacheStatus === 'hit') {
    +    log.http(
    +      'cache',
    +      `${urlStr} ${elapsedTime}ms${attemptStr}${cacheStr}`
    +    )
    +  } else {
    +    log.http(
    +      'fetch',
    +      `${method.toUpperCase()} ${res.status} ${urlStr} ${elapsedTime}ms${attemptStr}${cacheStr}`
    +    )
    +  }
    +}
    +
    +function checkErrors (method, res, startTime, opts) {
    +  return res.buffer()
    +    .catch(() => null)
    +    .then(body => {
    +      let parsed = body
    +      try {
    +        parsed = JSON.parse(body.toString('utf8'))
    +      } catch {
    +        // ignore errors
    +      }
    +      if (res.status === 401 && res.headers.get('www-authenticate')) {
    +        const auth = res.headers.get('www-authenticate')
    +          .split(/,\s*/)
    +          .map(s => s.toLowerCase())
    +        if (auth.indexOf('ipaddress') !== -1) {
    +          throw new errors.HttpErrorAuthIPAddress(
    +            method, res, parsed, opts.spec
    +          )
    +        } else if (auth.indexOf('otp') !== -1) {
    +          throw new errors.HttpErrorAuthOTP(
    +            method, res, parsed, opts.spec
    +          )
    +        } else {
    +          throw new errors.HttpErrorAuthUnknown(
    +            method, res, parsed, opts.spec
    +          )
    +        }
    +      } else if (
    +        res.status === 401 &&
    +        body != null &&
    +        /one-time pass/.test(body.toString('utf8'))
    +      ) {
    +        // Heuristic for malformed OTP responses that don't include the
    +        // www-authenticate header.
    +        throw new errors.HttpErrorAuthOTP(
    +          method, res, parsed, opts.spec
    +        )
    +      } else {
    +        throw new errors.HttpErrorGeneral(
    +          method, res, parsed, opts.spec
    +        )
    +      }
    +    })
    +}
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/lib/default-opts.js b/node_modules/npm/node_modules/npm-registry-fetch/lib/default-opts.js
    new file mode 100644
    index 00000000..f0847f0b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/lib/default-opts.js
    @@ -0,0 +1,19 @@
    +const pkg = require('../package.json')
    +module.exports = {
    +  maxSockets: 12,
    +  method: 'GET',
    +  registry: 'https://registry.npmjs.org/',
    +  timeout: 5 * 60 * 1000, // 5 minutes
    +  strictSSL: true,
    +  noProxy: process.env.NOPROXY,
    +  userAgent: `${pkg.name
    +    }@${
    +      pkg.version
    +    }/node@${
    +      process.version
    +    }+${
    +      process.arch
    +    } (${
    +      process.platform
    +    })`,
    +}
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/lib/errors.js b/node_modules/npm/node_modules/npm-registry-fetch/lib/errors.js
    new file mode 100644
    index 00000000..5bf6b012
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/lib/errors.js
    @@ -0,0 +1,80 @@
    +'use strict'
    +
    +const { URL } = require('node:url')
    +
    +function packageName (href) {
    +  try {
    +    let basePath = new URL(href).pathname.slice(1)
    +    if (!basePath.match(/^-/)) {
    +      basePath = basePath.split('/')
    +      var index = basePath.indexOf('_rewrite')
    +      if (index === -1) {
    +        index = basePath.length - 1
    +      } else {
    +        index++
    +      }
    +      return decodeURIComponent(basePath[index])
    +    }
    +  } catch {
    +    // this is ok
    +  }
    +}
    +
    +class HttpErrorBase extends Error {
    +  constructor (method, res, body, spec) {
    +    super()
    +    this.name = this.constructor.name
    +    this.headers = typeof res.headers?.raw === 'function' ? res.headers.raw() : res.headers
    +    this.statusCode = res.status
    +    this.code = `E${res.status}`
    +    this.method = method
    +    this.uri = res.url
    +    this.body = body
    +    this.pkgid = spec ? spec.toString() : packageName(res.url)
    +    Error.captureStackTrace(this, this.constructor)
    +  }
    +}
    +
    +class HttpErrorGeneral extends HttpErrorBase {
    +  constructor (method, res, body, spec) {
    +    super(method, res, body, spec)
    +    this.message = `${res.status} ${res.statusText} - ${
    +      this.method.toUpperCase()
    +    } ${
    +      this.spec || this.uri
    +    }${
    +      (body && body.error) ? ' - ' + body.error : ''
    +    }`
    +  }
    +}
    +
    +class HttpErrorAuthOTP extends HttpErrorBase {
    +  constructor (method, res, body, spec) {
    +    super(method, res, body, spec)
    +    this.message = 'OTP required for authentication'
    +    this.code = 'EOTP'
    +  }
    +}
    +
    +class HttpErrorAuthIPAddress extends HttpErrorBase {
    +  constructor (method, res, body, spec) {
    +    super(method, res, body, spec)
    +    this.message = 'Login is not allowed from your IP address'
    +    this.code = 'EAUTHIP'
    +  }
    +}
    +
    +class HttpErrorAuthUnknown extends HttpErrorBase {
    +  constructor (method, res, body, spec) {
    +    super(method, res, body, spec)
    +    this.message = 'Unable to authenticate, need: ' + res.headers.get('www-authenticate')
    +  }
    +}
    +
    +module.exports = {
    +  HttpErrorBase,
    +  HttpErrorGeneral,
    +  HttpErrorAuthOTP,
    +  HttpErrorAuthIPAddress,
    +  HttpErrorAuthUnknown,
    +}
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/lib/index.js b/node_modules/npm/node_modules/npm-registry-fetch/lib/index.js
    new file mode 100644
    index 00000000..898c8125
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/lib/index.js
    @@ -0,0 +1,247 @@
    +'use strict'
    +
    +const { HttpErrorAuthOTP } = require('./errors.js')
    +const checkResponse = require('./check-response.js')
    +const getAuth = require('./auth.js')
    +const fetch = require('make-fetch-happen')
    +const JSONStream = require('./json-stream')
    +const npa = require('npm-package-arg')
    +const qs = require('querystring')
    +const url = require('url')
    +const zlib = require('minizlib')
    +const { Minipass } = require('minipass')
    +
    +const defaultOpts = require('./default-opts.js')
    +
    +// WhatWG URL throws if it's not fully resolved
    +const urlIsValid = u => {
    +  try {
    +    return !!new url.URL(u)
    +  } catch (_) {
    +    return false
    +  }
    +}
    +
    +module.exports = regFetch
    +function regFetch (uri, /* istanbul ignore next */ opts_ = {}) {
    +  const opts = {
    +    ...defaultOpts,
    +    ...opts_,
    +  }
    +
    +  // if we did not get a fully qualified URI, then we look at the registry
    +  // config or relevant scope to resolve it.
    +  const uriValid = urlIsValid(uri)
    +  let registry = opts.registry || defaultOpts.registry
    +  if (!uriValid) {
    +    registry = opts.registry = (
    +      (opts.spec && pickRegistry(opts.spec, opts)) ||
    +      opts.registry ||
    +      registry
    +    )
    +    uri = `${
    +      registry.trim().replace(/\/?$/g, '')
    +    }/${
    +      uri.trim().replace(/^\//, '')
    +    }`
    +    // asserts that this is now valid
    +    new url.URL(uri)
    +  }
    +
    +  const method = opts.method || 'GET'
    +
    +  // through that takes into account the scope, the prefix of `uri`, etc
    +  const startTime = Date.now()
    +  const auth = getAuth(uri, opts)
    +  const headers = getHeaders(uri, auth, opts)
    +  let body = opts.body
    +  const bodyIsStream = Minipass.isStream(body)
    +  const bodyIsPromise = body &&
    +    typeof body === 'object' &&
    +    typeof body.then === 'function'
    +
    +  if (
    +    body && !bodyIsStream && !bodyIsPromise && typeof body !== 'string' && !Buffer.isBuffer(body)
    +  ) {
    +    headers['content-type'] = headers['content-type'] || 'application/json'
    +    body = JSON.stringify(body)
    +  } else if (body && !headers['content-type']) {
    +    headers['content-type'] = 'application/octet-stream'
    +  }
    +
    +  if (opts.gzip) {
    +    headers['content-encoding'] = 'gzip'
    +    if (bodyIsStream) {
    +      const gz = new zlib.Gzip()
    +      body.on('error', /* istanbul ignore next: unlikely and hard to test */
    +        err => gz.emit('error', err))
    +      body = body.pipe(gz)
    +    } else if (!bodyIsPromise) {
    +      body = new zlib.Gzip().end(body).concat()
    +    }
    +  }
    +
    +  const parsed = new url.URL(uri)
    +
    +  if (opts.query) {
    +    const q = typeof opts.query === 'string' ? qs.parse(opts.query)
    +      : opts.query
    +
    +    Object.keys(q).forEach(key => {
    +      if (q[key] !== undefined) {
    +        parsed.searchParams.set(key, q[key])
    +      }
    +    })
    +    uri = url.format(parsed)
    +  }
    +
    +  if (parsed.searchParams.get('write') === 'true' && method === 'GET') {
    +    // do not cache, because this GET is fetching a rev that will be
    +    // used for a subsequent PUT or DELETE, so we need to conditionally
    +    // update cache.
    +    opts.offline = false
    +    opts.preferOffline = false
    +    opts.preferOnline = true
    +  }
    +
    +  const doFetch = async fetchBody => {
    +    const p = fetch(uri, {
    +      agent: opts.agent,
    +      algorithms: opts.algorithms,
    +      body: fetchBody,
    +      cache: getCacheMode(opts),
    +      cachePath: opts.cache,
    +      ca: opts.ca,
    +      cert: auth.cert || opts.cert,
    +      headers,
    +      integrity: opts.integrity,
    +      key: auth.key || opts.key,
    +      localAddress: opts.localAddress,
    +      maxSockets: opts.maxSockets,
    +      memoize: opts.memoize,
    +      method: method,
    +      noProxy: opts.noProxy,
    +      proxy: opts.httpsProxy || opts.proxy,
    +      retry: opts.retry ? opts.retry : {
    +        retries: opts.fetchRetries,
    +        factor: opts.fetchRetryFactor,
    +        minTimeout: opts.fetchRetryMintimeout,
    +        maxTimeout: opts.fetchRetryMaxtimeout,
    +      },
    +      strictSSL: opts.strictSSL,
    +      timeout: opts.timeout || 30 * 1000,
    +    }).then(res => checkResponse({
    +      method,
    +      uri,
    +      res,
    +      registry,
    +      startTime,
    +      auth,
    +      opts,
    +    }))
    +
    +    if (typeof opts.otpPrompt === 'function') {
    +      return p.catch(async er => {
    +        if (er instanceof HttpErrorAuthOTP) {
    +          let otp
    +          // if otp fails to complete, we fail with that failure
    +          try {
    +            otp = await opts.otpPrompt()
    +          } catch (_) {
    +            // ignore this error
    +          }
    +          // if no otp provided, or otpPrompt errored, throw the original HTTP error
    +          if (!otp) {
    +            throw er
    +          }
    +          return regFetch(uri, { ...opts, otp })
    +        }
    +        throw er
    +      })
    +    } else {
    +      return p
    +    }
    +  }
    +
    +  return Promise.resolve(body).then(doFetch)
    +}
    +
    +module.exports.getAuth = getAuth
    +
    +module.exports.json = fetchJSON
    +function fetchJSON (uri, opts) {
    +  return regFetch(uri, opts).then(res => res.json())
    +}
    +
    +module.exports.json.stream = fetchJSONStream
    +function fetchJSONStream (uri, jsonPath,
    +  /* istanbul ignore next */ opts_ = {}) {
    +  const opts = { ...defaultOpts, ...opts_ }
    +  const parser = JSONStream.parse(jsonPath, opts.mapJSON)
    +  regFetch(uri, opts).then(res =>
    +    res.body.on('error',
    +      /* istanbul ignore next: unlikely and difficult to test */
    +      er => parser.emit('error', er)).pipe(parser)
    +  ).catch(er => parser.emit('error', er))
    +  return parser
    +}
    +
    +module.exports.pickRegistry = pickRegistry
    +function pickRegistry (spec, opts = {}) {
    +  spec = npa(spec)
    +  let registry = spec.scope &&
    +    opts[spec.scope.replace(/^@?/, '@') + ':registry']
    +
    +  if (!registry && opts.scope) {
    +    registry = opts[opts.scope.replace(/^@?/, '@') + ':registry']
    +  }
    +
    +  if (!registry) {
    +    registry = opts.registry || defaultOpts.registry
    +  }
    +
    +  return registry
    +}
    +
    +function getCacheMode (opts) {
    +  return opts.offline ? 'only-if-cached'
    +    : opts.preferOffline ? 'force-cache'
    +    : opts.preferOnline ? 'no-cache'
    +    : 'default'
    +}
    +
    +function getHeaders (uri, auth, opts) {
    +  const headers = Object.assign({
    +    'user-agent': opts.userAgent,
    +  }, opts.headers || {})
    +
    +  if (opts.authType) {
    +    headers['npm-auth-type'] = opts.authType
    +  }
    +
    +  if (opts.scope) {
    +    headers['npm-scope'] = opts.scope
    +  }
    +
    +  if (opts.npmSession) {
    +    headers['npm-session'] = opts.npmSession
    +  }
    +
    +  if (opts.npmCommand) {
    +    headers['npm-command'] = opts.npmCommand
    +  }
    +
    +  // If a tarball is hosted on a different place than the manifest, only send
    +  // credentials on `alwaysAuth`
    +  if (auth.token) {
    +    headers.authorization = `Bearer ${auth.token}`
    +  } else if (auth.auth) {
    +    headers.authorization = `Basic ${auth.auth}`
    +  }
    +
    +  if (opts.otp) {
    +    headers['npm-otp'] = opts.otp
    +  }
    +
    +  return headers
    +}
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/lib/json-stream.js b/node_modules/npm/node_modules/npm-registry-fetch/lib/json-stream.js
    new file mode 100644
    index 00000000..36b05ad4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/lib/json-stream.js
    @@ -0,0 +1,223 @@
    +const Parser = require('jsonparse')
    +const { Minipass } = require('minipass')
    +
    +class JSONStreamError extends Error {
    +  constructor (err, caller) {
    +    super(err.message)
    +    Error.captureStackTrace(this, caller || this.constructor)
    +  }
    +
    +  get name () {
    +    return 'JSONStreamError'
    +  }
    +}
    +
    +const check = (x, y) =>
    +  typeof x === 'string' ? String(y) === x
    +  : x && typeof x.test === 'function' ? x.test(y)
    +  : typeof x === 'boolean' || typeof x === 'object' ? x
    +  : typeof x === 'function' ? x(y)
    +  : false
    +
    +class JSONStream extends Minipass {
    +  #count = 0
    +  #ending = false
    +  #footer = null
    +  #header = null
    +  #map = null
    +  #onTokenOriginal
    +  #parser
    +  #path = null
    +  #root = null
    +
    +  constructor (opts) {
    +    super({
    +      ...opts,
    +      objectMode: true,
    +    })
    +
    +    const parser = this.#parser = new Parser()
    +    parser.onValue = value => this.#onValue(value)
    +    this.#onTokenOriginal = parser.onToken
    +    parser.onToken = (token, value) => this.#onToken(token, value)
    +    parser.onError = er => this.#onError(er)
    +
    +    this.#path = typeof opts.path === 'string'
    +      ? opts.path.split('.').map(e =>
    +        e === '$*' ? { emitKey: true }
    +        : e === '*' ? true
    +        : e === '' ? { recurse: true }
    +        : e)
    +      : Array.isArray(opts.path) && opts.path.length ? opts.path
    +      : null
    +
    +    if (typeof opts.map === 'function') {
    +      this.#map = opts.map
    +    }
    +  }
    +
    +  #setHeaderFooter (key, value) {
    +    // header has not been emitted yet
    +    if (this.#header !== false) {
    +      this.#header = this.#header || {}
    +      this.#header[key] = value
    +    }
    +
    +    // footer has not been emitted yet but header has
    +    if (this.#footer !== false && this.#header === false) {
    +      this.#footer = this.#footer || {}
    +      this.#footer[key] = value
    +    }
    +  }
    +
    +  #onError (er) {
    +    // error will always happen during a write() call.
    +    const caller = this.#ending ? this.end : this.write
    +    this.#ending = false
    +    return this.emit('error', new JSONStreamError(er, caller))
    +  }
    +
    +  #onToken (token, value) {
    +    const parser = this.#parser
    +    this.#onTokenOriginal.call(this.#parser, token, value)
    +    if (parser.stack.length === 0) {
    +      if (this.#root) {
    +        const root = this.#root
    +        if (!this.#path) {
    +          super.write(root)
    +        }
    +        this.#root = null
    +        this.#count = 0
    +      }
    +    }
    +  }
    +
    +  #onValue (value) {
    +    const parser = this.#parser
    +    // the LAST onValue encountered is the root object.
    +    // just overwrite it each time.
    +    this.#root = value
    +
    +    if (!this.#path) {
    +      return
    +    }
    +
    +    let i = 0 // iterates on path
    +    let j = 0 // iterates on stack
    +    let emitKey = false
    +    while (i < this.#path.length) {
    +      const key = this.#path[i]
    +      j++
    +
    +      if (key && !key.recurse) {
    +        const c = (j === parser.stack.length) ? parser : parser.stack[j]
    +        if (!c) {
    +          return
    +        }
    +        if (!check(key, c.key)) {
    +          this.#setHeaderFooter(c.key, value)
    +          return
    +        }
    +        emitKey = !!key.emitKey
    +        i++
    +      } else {
    +        i++
    +        if (i >= this.#path.length) {
    +          return
    +        }
    +        const nextKey = this.#path[i]
    +        if (!nextKey) {
    +          return
    +        }
    +        while (true) {
    +          const c = (j === parser.stack.length) ? parser : parser.stack[j]
    +          if (!c) {
    +            return
    +          }
    +          if (check(nextKey, c.key)) {
    +            i++
    +            if (!Object.isFrozen(parser.stack[j])) {
    +              parser.stack[j].value = null
    +            }
    +            break
    +          } else {
    +            this.#setHeaderFooter(c.key, value)
    +          }
    +          j++
    +        }
    +      }
    +    }
    +
    +    // emit header
    +    if (this.#header) {
    +      const header = this.#header
    +      this.#header = false
    +      this.emit('header', header)
    +    }
    +    if (j !== parser.stack.length) {
    +      return
    +    }
    +
    +    this.#count++
    +    const actualPath = parser.stack.slice(1)
    +      .map(e => e.key).concat([parser.key])
    +    if (value !== null && value !== undefined) {
    +      const data = this.#map ? this.#map(value, actualPath) : value
    +      if (data !== null && data !== undefined) {
    +        const emit = emitKey ? { value: data } : data
    +        if (emitKey) {
    +          emit.key = parser.key
    +        }
    +        super.write(emit)
    +      }
    +    }
    +
    +    if (parser.value) {
    +      delete parser.value[parser.key]
    +    }
    +
    +    for (const k of parser.stack) {
    +      k.value = null
    +    }
    +  }
    +
    +  write (chunk, encoding) {
    +    if (typeof chunk === 'string') {
    +      chunk = Buffer.from(chunk, encoding)
    +    } else if (!Buffer.isBuffer(chunk)) {
    +      return this.emit('error', new TypeError(
    +        'Can only parse JSON from string or buffer input'))
    +    }
    +    this.#parser.write(chunk)
    +    return this.flowing
    +  }
    +
    +  end (chunk, encoding) {
    +    this.#ending = true
    +    if (chunk) {
    +      this.write(chunk, encoding)
    +    }
    +
    +    const h = this.#header
    +    this.#header = null
    +    const f = this.#footer
    +    this.#footer = null
    +    if (h) {
    +      this.emit('header', h)
    +    }
    +    if (f) {
    +      this.emit('footer', f)
    +    }
    +    return super.end()
    +  }
    +
    +  static get JSONStreamError () {
    +    return JSONStreamError
    +  }
    +
    +  static parse (path, map) {
    +    return new JSONStream({ path, map })
    +  }
    +}
    +
    +module.exports = JSONStream
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/LICENSE b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/LICENSE
    new file mode 100644
    index 00000000..49f7efe4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/LICENSE
    @@ -0,0 +1,26 @@
    +Minizlib was created by Isaac Z. Schlueter.
    +It is a derivative work of the Node.js project.
    +
    +"""
    +Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors
    +Copyright (c) 2017-2023 Node.js contributors. All rights reserved.
    +Copyright (c) 2017-2023 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/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/constants.js b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/constants.js
    new file mode 100644
    index 00000000..dfc2c195
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/constants.js
    @@ -0,0 +1,123 @@
    +"use strict";
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.constants = void 0;
    +// Update with any zlib constants that are added or changed in the future.
    +// Node v6 didn't export this, so we just hard code the version and rely
    +// on all the other hard-coded values from zlib v4736.  When node v6
    +// support drops, we can just export the realZlibConstants object.
    +const zlib_1 = __importDefault(require("zlib"));
    +/* c8 ignore start */
    +const realZlibConstants = zlib_1.default.constants || { ZLIB_VERNUM: 4736 };
    +/* c8 ignore stop */
    +exports.constants = Object.freeze(Object.assign(Object.create(null), {
    +    Z_NO_FLUSH: 0,
    +    Z_PARTIAL_FLUSH: 1,
    +    Z_SYNC_FLUSH: 2,
    +    Z_FULL_FLUSH: 3,
    +    Z_FINISH: 4,
    +    Z_BLOCK: 5,
    +    Z_OK: 0,
    +    Z_STREAM_END: 1,
    +    Z_NEED_DICT: 2,
    +    Z_ERRNO: -1,
    +    Z_STREAM_ERROR: -2,
    +    Z_DATA_ERROR: -3,
    +    Z_MEM_ERROR: -4,
    +    Z_BUF_ERROR: -5,
    +    Z_VERSION_ERROR: -6,
    +    Z_NO_COMPRESSION: 0,
    +    Z_BEST_SPEED: 1,
    +    Z_BEST_COMPRESSION: 9,
    +    Z_DEFAULT_COMPRESSION: -1,
    +    Z_FILTERED: 1,
    +    Z_HUFFMAN_ONLY: 2,
    +    Z_RLE: 3,
    +    Z_FIXED: 4,
    +    Z_DEFAULT_STRATEGY: 0,
    +    DEFLATE: 1,
    +    INFLATE: 2,
    +    GZIP: 3,
    +    GUNZIP: 4,
    +    DEFLATERAW: 5,
    +    INFLATERAW: 6,
    +    UNZIP: 7,
    +    BROTLI_DECODE: 8,
    +    BROTLI_ENCODE: 9,
    +    Z_MIN_WINDOWBITS: 8,
    +    Z_MAX_WINDOWBITS: 15,
    +    Z_DEFAULT_WINDOWBITS: 15,
    +    Z_MIN_CHUNK: 64,
    +    Z_MAX_CHUNK: Infinity,
    +    Z_DEFAULT_CHUNK: 16384,
    +    Z_MIN_MEMLEVEL: 1,
    +    Z_MAX_MEMLEVEL: 9,
    +    Z_DEFAULT_MEMLEVEL: 8,
    +    Z_MIN_LEVEL: -1,
    +    Z_MAX_LEVEL: 9,
    +    Z_DEFAULT_LEVEL: -1,
    +    BROTLI_OPERATION_PROCESS: 0,
    +    BROTLI_OPERATION_FLUSH: 1,
    +    BROTLI_OPERATION_FINISH: 2,
    +    BROTLI_OPERATION_EMIT_METADATA: 3,
    +    BROTLI_MODE_GENERIC: 0,
    +    BROTLI_MODE_TEXT: 1,
    +    BROTLI_MODE_FONT: 2,
    +    BROTLI_DEFAULT_MODE: 0,
    +    BROTLI_MIN_QUALITY: 0,
    +    BROTLI_MAX_QUALITY: 11,
    +    BROTLI_DEFAULT_QUALITY: 11,
    +    BROTLI_MIN_WINDOW_BITS: 10,
    +    BROTLI_MAX_WINDOW_BITS: 24,
    +    BROTLI_LARGE_MAX_WINDOW_BITS: 30,
    +    BROTLI_DEFAULT_WINDOW: 22,
    +    BROTLI_MIN_INPUT_BLOCK_BITS: 16,
    +    BROTLI_MAX_INPUT_BLOCK_BITS: 24,
    +    BROTLI_PARAM_MODE: 0,
    +    BROTLI_PARAM_QUALITY: 1,
    +    BROTLI_PARAM_LGWIN: 2,
    +    BROTLI_PARAM_LGBLOCK: 3,
    +    BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
    +    BROTLI_PARAM_SIZE_HINT: 5,
    +    BROTLI_PARAM_LARGE_WINDOW: 6,
    +    BROTLI_PARAM_NPOSTFIX: 7,
    +    BROTLI_PARAM_NDIRECT: 8,
    +    BROTLI_DECODER_RESULT_ERROR: 0,
    +    BROTLI_DECODER_RESULT_SUCCESS: 1,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
    +    BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
    +    BROTLI_DECODER_NO_ERROR: 0,
    +    BROTLI_DECODER_SUCCESS: 1,
    +    BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
    +    BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
    +    BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
    +    BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
    +    BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
    +    BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
    +    BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
    +    BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
    +    BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
    +    BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
    +    BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
    +    BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
    +    BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
    +    BROTLI_DECODER_ERROR_UNREACHABLE: -31,
    +}, realZlibConstants));
    +//# sourceMappingURL=constants.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/index.js b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/index.js
    new file mode 100644
    index 00000000..ad65eef0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/index.js
    @@ -0,0 +1,352 @@
    +"use strict";
    +var __importDefault = (this && this.__importDefault) || function (mod) {
    +    return (mod && mod.__esModule) ? mod : { "default": mod };
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.BrotliDecompress = exports.BrotliCompress = exports.Brotli = exports.Unzip = exports.InflateRaw = exports.DeflateRaw = exports.Gunzip = exports.Gzip = exports.Inflate = exports.Deflate = exports.Zlib = exports.ZlibError = exports.constants = void 0;
    +const assert_1 = __importDefault(require("assert"));
    +const buffer_1 = require("buffer");
    +const minipass_1 = require("minipass");
    +const zlib_1 = __importDefault(require("zlib"));
    +const constants_js_1 = require("./constants.js");
    +var constants_js_2 = require("./constants.js");
    +Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return constants_js_2.constants; } });
    +const OriginalBufferConcat = buffer_1.Buffer.concat;
    +const _superWrite = Symbol('_superWrite');
    +class ZlibError extends Error {
    +    code;
    +    errno;
    +    constructor(err) {
    +        super('zlib: ' + err.message);
    +        this.code = err.code;
    +        this.errno = err.errno;
    +        /* c8 ignore next */
    +        if (!this.code)
    +            this.code = 'ZLIB_ERROR';
    +        this.message = 'zlib: ' + err.message;
    +        Error.captureStackTrace(this, this.constructor);
    +    }
    +    get name() {
    +        return 'ZlibError';
    +    }
    +}
    +exports.ZlibError = ZlibError;
    +// the Zlib class they all inherit from
    +// This thing manages the queue of requests, and returns
    +// true or false if there is anything in the queue when
    +// you call the .write() method.
    +const _flushFlag = Symbol('flushFlag');
    +class ZlibBase extends minipass_1.Minipass {
    +    #sawError = false;
    +    #ended = false;
    +    #flushFlag;
    +    #finishFlushFlag;
    +    #fullFlushFlag;
    +    #handle;
    +    #onError;
    +    get sawError() {
    +        return this.#sawError;
    +    }
    +    get handle() {
    +        return this.#handle;
    +    }
    +    /* c8 ignore start */
    +    get flushFlag() {
    +        return this.#flushFlag;
    +    }
    +    /* c8 ignore stop */
    +    constructor(opts, mode) {
    +        if (!opts || typeof opts !== 'object')
    +            throw new TypeError('invalid options for ZlibBase constructor');
    +        //@ts-ignore
    +        super(opts);
    +        /* c8 ignore start */
    +        this.#flushFlag = opts.flush ?? 0;
    +        this.#finishFlushFlag = opts.finishFlush ?? 0;
    +        this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
    +        /* c8 ignore stop */
    +        // this will throw if any options are invalid for the class selected
    +        try {
    +            // @types/node doesn't know that it exports the classes, but they're there
    +            //@ts-ignore
    +            this.#handle = new zlib_1.default[mode](opts);
    +        }
    +        catch (er) {
    +            // make sure that all errors get decorated properly
    +            throw new ZlibError(er);
    +        }
    +        this.#onError = err => {
    +            // no sense raising multiple errors, since we abort on the first one.
    +            if (this.#sawError)
    +                return;
    +            this.#sawError = true;
    +            // there is no way to cleanly recover.
    +            // continuing only obscures problems.
    +            this.close();
    +            this.emit('error', err);
    +        };
    +        this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
    +        this.once('end', () => this.close);
    +    }
    +    close() {
    +        if (this.#handle) {
    +            this.#handle.close();
    +            this.#handle = undefined;
    +            this.emit('close');
    +        }
    +    }
    +    reset() {
    +        if (!this.#sawError) {
    +            (0, assert_1.default)(this.#handle, 'zlib binding closed');
    +            //@ts-ignore
    +            return this.#handle.reset?.();
    +        }
    +    }
    +    flush(flushFlag) {
    +        if (this.ended)
    +            return;
    +        if (typeof flushFlag !== 'number')
    +            flushFlag = this.#fullFlushFlag;
    +        this.write(Object.assign(buffer_1.Buffer.alloc(0), { [_flushFlag]: flushFlag }));
    +    }
    +    end(chunk, encoding, cb) {
    +        /* c8 ignore start */
    +        if (typeof chunk === 'function') {
    +            cb = chunk;
    +            encoding = undefined;
    +            chunk = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        /* c8 ignore stop */
    +        if (chunk) {
    +            if (encoding)
    +                this.write(chunk, encoding);
    +            else
    +                this.write(chunk);
    +        }
    +        this.flush(this.#finishFlushFlag);
    +        this.#ended = true;
    +        return super.end(cb);
    +    }
    +    get ended() {
    +        return this.#ended;
    +    }
    +    // overridden in the gzip classes to do portable writes
    +    [_superWrite](data) {
    +        return super.write(data);
    +    }
    +    write(chunk, encoding, cb) {
    +        // process the chunk using the sync process
    +        // then super.write() all the outputted chunks
    +        if (typeof encoding === 'function')
    +            (cb = encoding), (encoding = 'utf8');
    +        if (typeof chunk === 'string')
    +            chunk = buffer_1.Buffer.from(chunk, encoding);
    +        if (this.#sawError)
    +            return;
    +        (0, assert_1.default)(this.#handle, 'zlib binding closed');
    +        // _processChunk tries to .close() the native handle after it's done, so we
    +        // intercept that by temporarily making it a no-op.
    +        // diving into the node:zlib internals a bit here
    +        const nativeHandle = this.#handle
    +            ._handle;
    +        const originalNativeClose = nativeHandle.close;
    +        nativeHandle.close = () => { };
    +        const originalClose = this.#handle.close;
    +        this.#handle.close = () => { };
    +        // It also calls `Buffer.concat()` at the end, which may be convenient
    +        // for some, but which we are not interested in as it slows us down.
    +        buffer_1.Buffer.concat = args => args;
    +        let result = undefined;
    +        try {
    +            const flushFlag = typeof chunk[_flushFlag] === 'number'
    +                ? chunk[_flushFlag]
    +                : this.#flushFlag;
    +            result = this.#handle._processChunk(chunk, flushFlag);
    +            // if we don't throw, reset it back how it was
    +            buffer_1.Buffer.concat = OriginalBufferConcat;
    +        }
    +        catch (err) {
    +            // or if we do, put Buffer.concat() back before we emit error
    +            // Error events call into user code, which may call Buffer.concat()
    +            buffer_1.Buffer.concat = OriginalBufferConcat;
    +            this.#onError(new ZlibError(err));
    +        }
    +        finally {
    +            if (this.#handle) {
    +                // Core zlib resets `_handle` to null after attempting to close the
    +                // native handle. Our no-op handler prevented actual closure, but we
    +                // need to restore the `._handle` property.
    +                ;
    +                this.#handle._handle =
    +                    nativeHandle;
    +                nativeHandle.close = originalNativeClose;
    +                this.#handle.close = originalClose;
    +                // `_processChunk()` adds an 'error' listener. If we don't remove it
    +                // after each call, these handlers start piling up.
    +                this.#handle.removeAllListeners('error');
    +                // make sure OUR error listener is still attached tho
    +            }
    +        }
    +        if (this.#handle)
    +            this.#handle.on('error', er => this.#onError(new ZlibError(er)));
    +        let writeReturn;
    +        if (result) {
    +            if (Array.isArray(result) && result.length > 0) {
    +                const r = result[0];
    +                // The first buffer is always `handle._outBuffer`, which would be
    +                // re-used for later invocations; so, we always have to copy that one.
    +                writeReturn = this[_superWrite](buffer_1.Buffer.from(r));
    +                for (let i = 1; i < result.length; i++) {
    +                    writeReturn = this[_superWrite](result[i]);
    +                }
    +            }
    +            else {
    +                // either a single Buffer or an empty array
    +                writeReturn = this[_superWrite](buffer_1.Buffer.from(result));
    +            }
    +        }
    +        if (cb)
    +            cb();
    +        return writeReturn;
    +    }
    +}
    +class Zlib extends ZlibBase {
    +    #level;
    +    #strategy;
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants_js_1.constants.Z_NO_FLUSH;
    +        opts.finishFlush = opts.finishFlush || constants_js_1.constants.Z_FINISH;
    +        opts.fullFlushFlag = constants_js_1.constants.Z_FULL_FLUSH;
    +        super(opts, mode);
    +        this.#level = opts.level;
    +        this.#strategy = opts.strategy;
    +    }
    +    params(level, strategy) {
    +        if (this.sawError)
    +            return;
    +        if (!this.handle)
    +            throw new Error('cannot switch params when binding is closed');
    +        // no way to test this without also not supporting params at all
    +        /* c8 ignore start */
    +        if (!this.handle.params)
    +            throw new Error('not supported in this implementation');
    +        /* c8 ignore stop */
    +        if (this.#level !== level || this.#strategy !== strategy) {
    +            this.flush(constants_js_1.constants.Z_SYNC_FLUSH);
    +            (0, assert_1.default)(this.handle, 'zlib binding closed');
    +            // .params() calls .flush(), but the latter is always async in the
    +            // core zlib. We override .flush() temporarily to intercept that and
    +            // flush synchronously.
    +            const origFlush = this.handle.flush;
    +            this.handle.flush = (flushFlag, cb) => {
    +                /* c8 ignore start */
    +                if (typeof flushFlag === 'function') {
    +                    cb = flushFlag;
    +                    flushFlag = this.flushFlag;
    +                }
    +                /* c8 ignore stop */
    +                this.flush(flushFlag);
    +                cb?.();
    +            };
    +            try {
    +                ;
    +                this.handle.params(level, strategy);
    +            }
    +            finally {
    +                this.handle.flush = origFlush;
    +            }
    +            /* c8 ignore start */
    +            if (this.handle) {
    +                this.#level = level;
    +                this.#strategy = strategy;
    +            }
    +            /* c8 ignore stop */
    +        }
    +    }
    +}
    +exports.Zlib = Zlib;
    +// minimal 2-byte header
    +class Deflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Deflate');
    +    }
    +}
    +exports.Deflate = Deflate;
    +class Inflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Inflate');
    +    }
    +}
    +exports.Inflate = Inflate;
    +class Gzip extends Zlib {
    +    #portable;
    +    constructor(opts) {
    +        super(opts, 'Gzip');
    +        this.#portable = opts && !!opts.portable;
    +    }
    +    [_superWrite](data) {
    +        if (!this.#portable)
    +            return super[_superWrite](data);
    +        // we'll always get the header emitted in one first chunk
    +        // overwrite the OS indicator byte with 0xFF
    +        this.#portable = false;
    +        data[9] = 255;
    +        return super[_superWrite](data);
    +    }
    +}
    +exports.Gzip = Gzip;
    +class Gunzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Gunzip');
    +    }
    +}
    +exports.Gunzip = Gunzip;
    +// raw - no header
    +class DeflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'DeflateRaw');
    +    }
    +}
    +exports.DeflateRaw = DeflateRaw;
    +class InflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'InflateRaw');
    +    }
    +}
    +exports.InflateRaw = InflateRaw;
    +// auto-detect header.
    +class Unzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Unzip');
    +    }
    +}
    +exports.Unzip = Unzip;
    +class Brotli extends ZlibBase {
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants_js_1.constants.BROTLI_OPERATION_PROCESS;
    +        opts.finishFlush =
    +            opts.finishFlush || constants_js_1.constants.BROTLI_OPERATION_FINISH;
    +        opts.fullFlushFlag = constants_js_1.constants.BROTLI_OPERATION_FLUSH;
    +        super(opts, mode);
    +    }
    +}
    +exports.Brotli = Brotli;
    +class BrotliCompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliCompress');
    +    }
    +}
    +exports.BrotliCompress = BrotliCompress;
    +class BrotliDecompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliDecompress');
    +    }
    +}
    +exports.BrotliDecompress = BrotliDecompress;
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/package.json b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/constants.js b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/constants.js
    new file mode 100644
    index 00000000..7faf40be
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/constants.js
    @@ -0,0 +1,117 @@
    +// Update with any zlib constants that are added or changed in the future.
    +// Node v6 didn't export this, so we just hard code the version and rely
    +// on all the other hard-coded values from zlib v4736.  When node v6
    +// support drops, we can just export the realZlibConstants object.
    +import realZlib from 'zlib';
    +/* c8 ignore start */
    +const realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 };
    +/* c8 ignore stop */
    +export const constants = Object.freeze(Object.assign(Object.create(null), {
    +    Z_NO_FLUSH: 0,
    +    Z_PARTIAL_FLUSH: 1,
    +    Z_SYNC_FLUSH: 2,
    +    Z_FULL_FLUSH: 3,
    +    Z_FINISH: 4,
    +    Z_BLOCK: 5,
    +    Z_OK: 0,
    +    Z_STREAM_END: 1,
    +    Z_NEED_DICT: 2,
    +    Z_ERRNO: -1,
    +    Z_STREAM_ERROR: -2,
    +    Z_DATA_ERROR: -3,
    +    Z_MEM_ERROR: -4,
    +    Z_BUF_ERROR: -5,
    +    Z_VERSION_ERROR: -6,
    +    Z_NO_COMPRESSION: 0,
    +    Z_BEST_SPEED: 1,
    +    Z_BEST_COMPRESSION: 9,
    +    Z_DEFAULT_COMPRESSION: -1,
    +    Z_FILTERED: 1,
    +    Z_HUFFMAN_ONLY: 2,
    +    Z_RLE: 3,
    +    Z_FIXED: 4,
    +    Z_DEFAULT_STRATEGY: 0,
    +    DEFLATE: 1,
    +    INFLATE: 2,
    +    GZIP: 3,
    +    GUNZIP: 4,
    +    DEFLATERAW: 5,
    +    INFLATERAW: 6,
    +    UNZIP: 7,
    +    BROTLI_DECODE: 8,
    +    BROTLI_ENCODE: 9,
    +    Z_MIN_WINDOWBITS: 8,
    +    Z_MAX_WINDOWBITS: 15,
    +    Z_DEFAULT_WINDOWBITS: 15,
    +    Z_MIN_CHUNK: 64,
    +    Z_MAX_CHUNK: Infinity,
    +    Z_DEFAULT_CHUNK: 16384,
    +    Z_MIN_MEMLEVEL: 1,
    +    Z_MAX_MEMLEVEL: 9,
    +    Z_DEFAULT_MEMLEVEL: 8,
    +    Z_MIN_LEVEL: -1,
    +    Z_MAX_LEVEL: 9,
    +    Z_DEFAULT_LEVEL: -1,
    +    BROTLI_OPERATION_PROCESS: 0,
    +    BROTLI_OPERATION_FLUSH: 1,
    +    BROTLI_OPERATION_FINISH: 2,
    +    BROTLI_OPERATION_EMIT_METADATA: 3,
    +    BROTLI_MODE_GENERIC: 0,
    +    BROTLI_MODE_TEXT: 1,
    +    BROTLI_MODE_FONT: 2,
    +    BROTLI_DEFAULT_MODE: 0,
    +    BROTLI_MIN_QUALITY: 0,
    +    BROTLI_MAX_QUALITY: 11,
    +    BROTLI_DEFAULT_QUALITY: 11,
    +    BROTLI_MIN_WINDOW_BITS: 10,
    +    BROTLI_MAX_WINDOW_BITS: 24,
    +    BROTLI_LARGE_MAX_WINDOW_BITS: 30,
    +    BROTLI_DEFAULT_WINDOW: 22,
    +    BROTLI_MIN_INPUT_BLOCK_BITS: 16,
    +    BROTLI_MAX_INPUT_BLOCK_BITS: 24,
    +    BROTLI_PARAM_MODE: 0,
    +    BROTLI_PARAM_QUALITY: 1,
    +    BROTLI_PARAM_LGWIN: 2,
    +    BROTLI_PARAM_LGBLOCK: 3,
    +    BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
    +    BROTLI_PARAM_SIZE_HINT: 5,
    +    BROTLI_PARAM_LARGE_WINDOW: 6,
    +    BROTLI_PARAM_NPOSTFIX: 7,
    +    BROTLI_PARAM_NDIRECT: 8,
    +    BROTLI_DECODER_RESULT_ERROR: 0,
    +    BROTLI_DECODER_RESULT_SUCCESS: 1,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
    +    BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
    +    BROTLI_DECODER_NO_ERROR: 0,
    +    BROTLI_DECODER_SUCCESS: 1,
    +    BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
    +    BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
    +    BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
    +    BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
    +    BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
    +    BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
    +    BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
    +    BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
    +    BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
    +    BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
    +    BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
    +    BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
    +    BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
    +    BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
    +    BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
    +    BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
    +    BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
    +    BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
    +    BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
    +    BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
    +    BROTLI_DECODER_ERROR_UNREACHABLE: -31,
    +}, realZlibConstants));
    +//# sourceMappingURL=constants.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/index.js b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/index.js
    new file mode 100644
    index 00000000..a6269b50
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/index.js
    @@ -0,0 +1,333 @@
    +import assert from 'assert';
    +import { Buffer } from 'buffer';
    +import { Minipass } from 'minipass';
    +import realZlib from 'zlib';
    +import { constants } from './constants.js';
    +export { constants } from './constants.js';
    +const OriginalBufferConcat = Buffer.concat;
    +const _superWrite = Symbol('_superWrite');
    +export class ZlibError extends Error {
    +    code;
    +    errno;
    +    constructor(err) {
    +        super('zlib: ' + err.message);
    +        this.code = err.code;
    +        this.errno = err.errno;
    +        /* c8 ignore next */
    +        if (!this.code)
    +            this.code = 'ZLIB_ERROR';
    +        this.message = 'zlib: ' + err.message;
    +        Error.captureStackTrace(this, this.constructor);
    +    }
    +    get name() {
    +        return 'ZlibError';
    +    }
    +}
    +// the Zlib class they all inherit from
    +// This thing manages the queue of requests, and returns
    +// true or false if there is anything in the queue when
    +// you call the .write() method.
    +const _flushFlag = Symbol('flushFlag');
    +class ZlibBase extends Minipass {
    +    #sawError = false;
    +    #ended = false;
    +    #flushFlag;
    +    #finishFlushFlag;
    +    #fullFlushFlag;
    +    #handle;
    +    #onError;
    +    get sawError() {
    +        return this.#sawError;
    +    }
    +    get handle() {
    +        return this.#handle;
    +    }
    +    /* c8 ignore start */
    +    get flushFlag() {
    +        return this.#flushFlag;
    +    }
    +    /* c8 ignore stop */
    +    constructor(opts, mode) {
    +        if (!opts || typeof opts !== 'object')
    +            throw new TypeError('invalid options for ZlibBase constructor');
    +        //@ts-ignore
    +        super(opts);
    +        /* c8 ignore start */
    +        this.#flushFlag = opts.flush ?? 0;
    +        this.#finishFlushFlag = opts.finishFlush ?? 0;
    +        this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
    +        /* c8 ignore stop */
    +        // this will throw if any options are invalid for the class selected
    +        try {
    +            // @types/node doesn't know that it exports the classes, but they're there
    +            //@ts-ignore
    +            this.#handle = new realZlib[mode](opts);
    +        }
    +        catch (er) {
    +            // make sure that all errors get decorated properly
    +            throw new ZlibError(er);
    +        }
    +        this.#onError = err => {
    +            // no sense raising multiple errors, since we abort on the first one.
    +            if (this.#sawError)
    +                return;
    +            this.#sawError = true;
    +            // there is no way to cleanly recover.
    +            // continuing only obscures problems.
    +            this.close();
    +            this.emit('error', err);
    +        };
    +        this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
    +        this.once('end', () => this.close);
    +    }
    +    close() {
    +        if (this.#handle) {
    +            this.#handle.close();
    +            this.#handle = undefined;
    +            this.emit('close');
    +        }
    +    }
    +    reset() {
    +        if (!this.#sawError) {
    +            assert(this.#handle, 'zlib binding closed');
    +            //@ts-ignore
    +            return this.#handle.reset?.();
    +        }
    +    }
    +    flush(flushFlag) {
    +        if (this.ended)
    +            return;
    +        if (typeof flushFlag !== 'number')
    +            flushFlag = this.#fullFlushFlag;
    +        this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }));
    +    }
    +    end(chunk, encoding, cb) {
    +        /* c8 ignore start */
    +        if (typeof chunk === 'function') {
    +            cb = chunk;
    +            encoding = undefined;
    +            chunk = undefined;
    +        }
    +        if (typeof encoding === 'function') {
    +            cb = encoding;
    +            encoding = undefined;
    +        }
    +        /* c8 ignore stop */
    +        if (chunk) {
    +            if (encoding)
    +                this.write(chunk, encoding);
    +            else
    +                this.write(chunk);
    +        }
    +        this.flush(this.#finishFlushFlag);
    +        this.#ended = true;
    +        return super.end(cb);
    +    }
    +    get ended() {
    +        return this.#ended;
    +    }
    +    // overridden in the gzip classes to do portable writes
    +    [_superWrite](data) {
    +        return super.write(data);
    +    }
    +    write(chunk, encoding, cb) {
    +        // process the chunk using the sync process
    +        // then super.write() all the outputted chunks
    +        if (typeof encoding === 'function')
    +            (cb = encoding), (encoding = 'utf8');
    +        if (typeof chunk === 'string')
    +            chunk = Buffer.from(chunk, encoding);
    +        if (this.#sawError)
    +            return;
    +        assert(this.#handle, 'zlib binding closed');
    +        // _processChunk tries to .close() the native handle after it's done, so we
    +        // intercept that by temporarily making it a no-op.
    +        // diving into the node:zlib internals a bit here
    +        const nativeHandle = this.#handle
    +            ._handle;
    +        const originalNativeClose = nativeHandle.close;
    +        nativeHandle.close = () => { };
    +        const originalClose = this.#handle.close;
    +        this.#handle.close = () => { };
    +        // It also calls `Buffer.concat()` at the end, which may be convenient
    +        // for some, but which we are not interested in as it slows us down.
    +        Buffer.concat = args => args;
    +        let result = undefined;
    +        try {
    +            const flushFlag = typeof chunk[_flushFlag] === 'number'
    +                ? chunk[_flushFlag]
    +                : this.#flushFlag;
    +            result = this.#handle._processChunk(chunk, flushFlag);
    +            // if we don't throw, reset it back how it was
    +            Buffer.concat = OriginalBufferConcat;
    +        }
    +        catch (err) {
    +            // or if we do, put Buffer.concat() back before we emit error
    +            // Error events call into user code, which may call Buffer.concat()
    +            Buffer.concat = OriginalBufferConcat;
    +            this.#onError(new ZlibError(err));
    +        }
    +        finally {
    +            if (this.#handle) {
    +                // Core zlib resets `_handle` to null after attempting to close the
    +                // native handle. Our no-op handler prevented actual closure, but we
    +                // need to restore the `._handle` property.
    +                ;
    +                this.#handle._handle =
    +                    nativeHandle;
    +                nativeHandle.close = originalNativeClose;
    +                this.#handle.close = originalClose;
    +                // `_processChunk()` adds an 'error' listener. If we don't remove it
    +                // after each call, these handlers start piling up.
    +                this.#handle.removeAllListeners('error');
    +                // make sure OUR error listener is still attached tho
    +            }
    +        }
    +        if (this.#handle)
    +            this.#handle.on('error', er => this.#onError(new ZlibError(er)));
    +        let writeReturn;
    +        if (result) {
    +            if (Array.isArray(result) && result.length > 0) {
    +                const r = result[0];
    +                // The first buffer is always `handle._outBuffer`, which would be
    +                // re-used for later invocations; so, we always have to copy that one.
    +                writeReturn = this[_superWrite](Buffer.from(r));
    +                for (let i = 1; i < result.length; i++) {
    +                    writeReturn = this[_superWrite](result[i]);
    +                }
    +            }
    +            else {
    +                // either a single Buffer or an empty array
    +                writeReturn = this[_superWrite](Buffer.from(result));
    +            }
    +        }
    +        if (cb)
    +            cb();
    +        return writeReturn;
    +    }
    +}
    +export class Zlib extends ZlibBase {
    +    #level;
    +    #strategy;
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants.Z_NO_FLUSH;
    +        opts.finishFlush = opts.finishFlush || constants.Z_FINISH;
    +        opts.fullFlushFlag = constants.Z_FULL_FLUSH;
    +        super(opts, mode);
    +        this.#level = opts.level;
    +        this.#strategy = opts.strategy;
    +    }
    +    params(level, strategy) {
    +        if (this.sawError)
    +            return;
    +        if (!this.handle)
    +            throw new Error('cannot switch params when binding is closed');
    +        // no way to test this without also not supporting params at all
    +        /* c8 ignore start */
    +        if (!this.handle.params)
    +            throw new Error('not supported in this implementation');
    +        /* c8 ignore stop */
    +        if (this.#level !== level || this.#strategy !== strategy) {
    +            this.flush(constants.Z_SYNC_FLUSH);
    +            assert(this.handle, 'zlib binding closed');
    +            // .params() calls .flush(), but the latter is always async in the
    +            // core zlib. We override .flush() temporarily to intercept that and
    +            // flush synchronously.
    +            const origFlush = this.handle.flush;
    +            this.handle.flush = (flushFlag, cb) => {
    +                /* c8 ignore start */
    +                if (typeof flushFlag === 'function') {
    +                    cb = flushFlag;
    +                    flushFlag = this.flushFlag;
    +                }
    +                /* c8 ignore stop */
    +                this.flush(flushFlag);
    +                cb?.();
    +            };
    +            try {
    +                ;
    +                this.handle.params(level, strategy);
    +            }
    +            finally {
    +                this.handle.flush = origFlush;
    +            }
    +            /* c8 ignore start */
    +            if (this.handle) {
    +                this.#level = level;
    +                this.#strategy = strategy;
    +            }
    +            /* c8 ignore stop */
    +        }
    +    }
    +}
    +// minimal 2-byte header
    +export class Deflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Deflate');
    +    }
    +}
    +export class Inflate extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Inflate');
    +    }
    +}
    +export class Gzip extends Zlib {
    +    #portable;
    +    constructor(opts) {
    +        super(opts, 'Gzip');
    +        this.#portable = opts && !!opts.portable;
    +    }
    +    [_superWrite](data) {
    +        if (!this.#portable)
    +            return super[_superWrite](data);
    +        // we'll always get the header emitted in one first chunk
    +        // overwrite the OS indicator byte with 0xFF
    +        this.#portable = false;
    +        data[9] = 255;
    +        return super[_superWrite](data);
    +    }
    +}
    +export class Gunzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Gunzip');
    +    }
    +}
    +// raw - no header
    +export class DeflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'DeflateRaw');
    +    }
    +}
    +export class InflateRaw extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'InflateRaw');
    +    }
    +}
    +// auto-detect header.
    +export class Unzip extends Zlib {
    +    constructor(opts) {
    +        super(opts, 'Unzip');
    +    }
    +}
    +export class Brotli extends ZlibBase {
    +    constructor(opts, mode) {
    +        opts = opts || {};
    +        opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS;
    +        opts.finishFlush =
    +            opts.finishFlush || constants.BROTLI_OPERATION_FINISH;
    +        opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH;
    +        super(opts, mode);
    +    }
    +}
    +export class BrotliCompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliCompress');
    +    }
    +}
    +export class BrotliDecompress extends Brotli {
    +    constructor(opts) {
    +        super(opts, 'BrotliDecompress');
    +    }
    +}
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/package.json b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/package.json b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/package.json
    new file mode 100644
    index 00000000..e94623ff
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/node_modules/minizlib/package.json
    @@ -0,0 +1,81 @@
    +{
    +  "name": "minizlib",
    +  "version": "3.0.1",
    +  "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
    +  "main": "./dist/commonjs/index.js",
    +  "dependencies": {
    +    "minipass": "^7.0.4",
    +    "rimraf": "^5.0.5"
    +  },
    +  "scripts": {
    +    "prepare": "tshy",
    +    "pretest": "npm run prepare",
    +    "test": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "prepublishOnly": "git push origin --follow-tags",
    +    "format": "prettier --write . --loglevel warn",
    +    "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/isaacs/minizlib.git"
    +  },
    +  "keywords": [
    +    "zlib",
    +    "gzip",
    +    "gunzip",
    +    "deflate",
    +    "inflate",
    +    "compression",
    +    "zip",
    +    "unzip"
    +  ],
    +  "author": "Isaac Z. Schlueter  (http://blog.izs.me/)",
    +  "license": "MIT",
    +  "devDependencies": {
    +    "@types/node": "^20.11.29",
    +    "mkdirp": "^3.0.1",
    +    "tap": "^18.7.1",
    +    "tshy": "^1.12.0",
    +    "typedoc": "^0.25.12"
    +  },
    +  "files": [
    +    "dist"
    +  ],
    +  "engines": {
    +    "node": ">= 18"
    +  },
    +  "tshy": {
    +    "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"
    +      }
    +    }
    +  },
    +  "types": "./dist/commonjs/index.d.ts",
    +  "type": "module",
    +  "prettier": {
    +    "semi": false,
    +    "printWidth": 75,
    +    "tabWidth": 2,
    +    "useTabs": false,
    +    "singleQuote": true,
    +    "jsxSingleQuote": false,
    +    "bracketSameLine": true,
    +    "arrowParens": "avoid",
    +    "endOfLine": "lf"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-registry-fetch/package.json b/node_modules/npm/node_modules/npm-registry-fetch/package.json
    new file mode 100644
    index 00000000..bd7a79d3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-registry-fetch/package.json
    @@ -0,0 +1,68 @@
    +{
    +  "name": "npm-registry-fetch",
    +  "version": "18.0.2",
    +  "description": "Fetch-based http client for use with npm registry APIs",
    +  "main": "lib",
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "scripts": {
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
    +    "lint": "npm run eslint",
    +    "lintfix": "npm run eslint -- --fix",
    +    "test": "tap",
    +    "posttest": "npm run lint",
    +    "npmclilint": "npmcli-lint",
    +    "postsnap": "npm run lintfix --",
    +    "postlint": "template-oss-check",
    +    "snap": "tap",
    +    "template-oss-apply": "template-oss-apply --force"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/npm-registry-fetch.git"
    +  },
    +  "keywords": [
    +    "npm",
    +    "registry",
    +    "fetch"
    +  ],
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "dependencies": {
    +    "@npmcli/redact": "^3.0.0",
    +    "jsonparse": "^1.3.1",
    +    "make-fetch-happen": "^14.0.0",
    +    "minipass": "^7.0.2",
    +    "minipass-fetch": "^4.0.0",
    +    "minizlib": "^3.0.1",
    +    "npm-package-arg": "^12.0.0",
    +    "proc-log": "^5.0.0"
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.4",
    +    "cacache": "^19.0.1",
    +    "nock": "^13.2.4",
    +    "require-inject": "^1.4.4",
    +    "ssri": "^12.0.0",
    +    "tap": "^16.0.1"
    +  },
    +  "tap": {
    +    "check-coverage": true,
    +    "test-ignore": "test[\\\\/](util|cache)[\\\\/]",
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.4",
    +    "publish": "true"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/npm-user-validate/LICENSE b/node_modules/npm/node_modules/npm-user-validate/LICENSE
    new file mode 100644
    index 00000000..79128b23
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-user-validate/LICENSE
    @@ -0,0 +1,27 @@
    +Copyright (c) Robert Kowalski
    +All rights reserved.
    +
    +The BSD License
    +
    +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 AUTHOR 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 AUTHOR 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.
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/npm-user-validate/lib/index.js b/node_modules/npm/node_modules/npm-user-validate/lib/index.js
    new file mode 100644
    index 00000000..379a31d2
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-user-validate/lib/index.js
    @@ -0,0 +1,61 @@
    +exports.email = email
    +exports.pw = pw
    +exports.username = username
    +var requirements = exports.requirements = {
    +  username: {
    +    length: 'Name length must be less than or equal to 214 characters long',
    +    lowerCase: 'Name must be lowercase',
    +    urlSafe: 'Name may not contain non-url-safe chars',
    +    dot: 'Name may not start with "."',
    +    illegal: 'Name may not contain illegal character',
    +  },
    +  password: {},
    +  email: {
    +    length: 'Email length must be less then or equal to 254 characters long',
    +    valid: 'Email must be an email address',
    +  },
    +}
    +
    +var illegalCharacterRe = new RegExp('([' + [
    +  "'",
    +].join() + '])')
    +
    +function username (un) {
    +  if (un !== un.toLowerCase()) {
    +    return new Error(requirements.username.lowerCase)
    +  }
    +
    +  if (un !== encodeURIComponent(un)) {
    +    return new Error(requirements.username.urlSafe)
    +  }
    +
    +  if (un.charAt(0) === '.') {
    +    return new Error(requirements.username.dot)
    +  }
    +
    +  if (un.length > 214) {
    +    return new Error(requirements.username.length)
    +  }
    +
    +  var illegal = un.match(illegalCharacterRe)
    +  if (illegal) {
    +    return new Error(requirements.username.illegal + ' "' + illegal[0] + '"')
    +  }
    +
    +  return null
    +}
    +
    +function email (em) {
    +  if (em.length > 254) {
    +    return new Error(requirements.email.length)
    +  }
    +  if (!em.match(/^[^@]+@.+\..+$/)) {
    +    return new Error(requirements.email.valid)
    +  }
    +
    +  return null
    +}
    +
    +function pw () {
    +  return null
    +}
    diff --git a/node_modules/npm/node_modules/npm-user-validate/package.json b/node_modules/npm/node_modules/npm-user-validate/package.json
    new file mode 100644
    index 00000000..8c66f8f3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/npm-user-validate/package.json
    @@ -0,0 +1,50 @@
    +{
    +  "name": "npm-user-validate",
    +  "version": "3.0.0",
    +  "description": "User validations for npm",
    +  "main": "lib/index.js",
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "tap": "^16.3.2"
    +  },
    +  "scripts": {
    +    "test": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "lintfix": "npm run eslint -- --fix",
    +    "snap": "tap",
    +    "posttest": "npm run lint",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/npm-user-validate.git"
    +  },
    +  "keywords": [
    +    "npm",
    +    "validation",
    +    "registry"
    +  ],
    +  "author": "GitHub Inc.",
    +  "license": "BSD-2-Clause",
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": true
    +  },
    +  "tap": {
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/p-map/index.js b/node_modules/npm/node_modules/p-map/index.js
    new file mode 100644
    index 00000000..10558008
    --- /dev/null
    +++ b/node_modules/npm/node_modules/p-map/index.js
    @@ -0,0 +1,281 @@
    +export default async function pMap(
    +	iterable,
    +	mapper,
    +	{
    +		concurrency = Number.POSITIVE_INFINITY,
    +		stopOnError = true,
    +		signal,
    +	} = {},
    +) {
    +	return new Promise((resolve_, reject_) => {
    +		if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) {
    +			throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
    +		}
    +
    +		if (typeof mapper !== 'function') {
    +			throw new TypeError('Mapper function is required');
    +		}
    +
    +		if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) {
    +			throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
    +		}
    +
    +		const result = [];
    +		const errors = [];
    +		const skippedIndexesMap = new Map();
    +		let isRejected = false;
    +		let isResolved = false;
    +		let isIterableDone = false;
    +		let resolvingCount = 0;
    +		let currentIndex = 0;
    +		const iterator = iterable[Symbol.iterator] === undefined ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();
    +
    +		const signalListener = () => {
    +			reject(signal.reason);
    +		};
    +
    +		const cleanup = () => {
    +			signal?.removeEventListener('abort', signalListener);
    +		};
    +
    +		const resolve = value => {
    +			resolve_(value);
    +			cleanup();
    +		};
    +
    +		const reject = reason => {
    +			isRejected = true;
    +			isResolved = true;
    +			reject_(reason);
    +			cleanup();
    +		};
    +
    +		if (signal) {
    +			if (signal.aborted) {
    +				reject(signal.reason);
    +			}
    +
    +			signal.addEventListener('abort', signalListener, {once: true});
    +		}
    +
    +		const next = async () => {
    +			if (isResolved) {
    +				return;
    +			}
    +
    +			const nextItem = await iterator.next();
    +
    +			const index = currentIndex;
    +			currentIndex++;
    +
    +			// Note: `iterator.next()` can be called many times in parallel.
    +			// This can cause multiple calls to this `next()` function to
    +			// receive a `nextItem` with `done === true`.
    +			// The shutdown logic that rejects/resolves must be protected
    +			// so it runs only one time as the `skippedIndex` logic is
    +			// non-idempotent.
    +			if (nextItem.done) {
    +				isIterableDone = true;
    +
    +				if (resolvingCount === 0 && !isResolved) {
    +					if (!stopOnError && errors.length > 0) {
    +						reject(new AggregateError(errors)); // eslint-disable-line unicorn/error-message
    +						return;
    +					}
    +
    +					isResolved = true;
    +
    +					if (skippedIndexesMap.size === 0) {
    +						resolve(result);
    +						return;
    +					}
    +
    +					const pureResult = [];
    +
    +					// Support multiple `pMapSkip`'s.
    +					for (const [index, value] of result.entries()) {
    +						if (skippedIndexesMap.get(index) === pMapSkip) {
    +							continue;
    +						}
    +
    +						pureResult.push(value);
    +					}
    +
    +					resolve(pureResult);
    +				}
    +
    +				return;
    +			}
    +
    +			resolvingCount++;
    +
    +			// Intentionally detached
    +			(async () => {
    +				try {
    +					const element = await nextItem.value;
    +
    +					if (isResolved) {
    +						return;
    +					}
    +
    +					const value = await mapper(element, index);
    +
    +					// Use Map to stage the index of the element.
    +					if (value === pMapSkip) {
    +						skippedIndexesMap.set(index, value);
    +					}
    +
    +					result[index] = value;
    +
    +					resolvingCount--;
    +					await next();
    +				} catch (error) {
    +					if (stopOnError) {
    +						reject(error);
    +					} else {
    +						errors.push(error);
    +						resolvingCount--;
    +
    +						// In that case we can't really continue regardless of `stopOnError` state
    +						// since an iterable is likely to continue throwing after it throws once.
    +						// If we continue calling `next()` indefinitely we will likely end up
    +						// in an infinite loop of failed iteration.
    +						try {
    +							await next();
    +						} catch (error) {
    +							reject(error);
    +						}
    +					}
    +				}
    +			})();
    +		};
    +
    +		// Create the concurrent runners in a detached (non-awaited)
    +		// promise. We need this so we can await the `next()` calls
    +		// to stop creating runners before hitting the concurrency limit
    +		// if the iterable has already been marked as done.
    +		// NOTE: We *must* do this for async iterators otherwise we'll spin up
    +		// infinite `next()` calls by default and never start the event loop.
    +		(async () => {
    +			for (let index = 0; index < concurrency; index++) {
    +				try {
    +					// eslint-disable-next-line no-await-in-loop
    +					await next();
    +				} catch (error) {
    +					reject(error);
    +					break;
    +				}
    +
    +				if (isIterableDone || isRejected) {
    +					break;
    +				}
    +			}
    +		})();
    +	});
    +}
    +
    +export function pMapIterable(
    +	iterable,
    +	mapper,
    +	{
    +		concurrency = Number.POSITIVE_INFINITY,
    +		backpressure = concurrency,
    +	} = {},
    +) {
    +	if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) {
    +		throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
    +	}
    +
    +	if (typeof mapper !== 'function') {
    +		throw new TypeError('Mapper function is required');
    +	}
    +
    +	if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) {
    +		throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
    +	}
    +
    +	if (!((Number.isSafeInteger(backpressure) && backpressure >= concurrency) || backpressure === Number.POSITIVE_INFINITY)) {
    +		throw new TypeError(`Expected \`backpressure\` to be an integer from \`concurrency\` (${concurrency}) and up or \`Infinity\`, got \`${backpressure}\` (${typeof backpressure})`);
    +	}
    +
    +	return {
    +		async * [Symbol.asyncIterator]() {
    +			const iterator = iterable[Symbol.asyncIterator] === undefined ? iterable[Symbol.iterator]() : iterable[Symbol.asyncIterator]();
    +
    +			const promises = [];
    +			let runningMappersCount = 0;
    +			let isDone = false;
    +			let index = 0;
    +
    +			function trySpawn() {
    +				if (isDone || !(runningMappersCount < concurrency && promises.length < backpressure)) {
    +					return;
    +				}
    +
    +				const promise = (async () => {
    +					const {done, value} = await iterator.next();
    +
    +					if (done) {
    +						return {done: true};
    +					}
    +
    +					runningMappersCount++;
    +
    +					// Spawn if still below concurrency and backpressure limit
    +					trySpawn();
    +
    +					try {
    +						const returnValue = await mapper(await value, index++);
    +
    +						runningMappersCount--;
    +
    +						if (returnValue === pMapSkip) {
    +							const index = promises.indexOf(promise);
    +
    +							if (index > 0) {
    +								promises.splice(index, 1);
    +							}
    +						}
    +
    +						// Spawn if still below backpressure limit and just dropped below concurrency limit
    +						trySpawn();
    +
    +						return {done: false, value: returnValue};
    +					} catch (error) {
    +						isDone = true;
    +						return {error};
    +					}
    +				})();
    +
    +				promises.push(promise);
    +			}
    +
    +			trySpawn();
    +
    +			while (promises.length > 0) {
    +				const {error, done, value} = await promises[0]; // eslint-disable-line no-await-in-loop
    +
    +				promises.shift();
    +
    +				if (error) {
    +					throw error;
    +				}
    +
    +				if (done) {
    +					return;
    +				}
    +
    +				// Spawn if just dropped below backpressure limit and below the concurrency limit
    +				trySpawn();
    +
    +				if (value === pMapSkip) {
    +					continue;
    +				}
    +
    +				yield value;
    +			}
    +		},
    +	};
    +}
    +
    +export const pMapSkip = Symbol('skip');
    diff --git a/node_modules/npm/node_modules/p-map/license b/node_modules/npm/node_modules/p-map/license
    new file mode 100644
    index 00000000..fa7ceba3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/p-map/license
    @@ -0,0 +1,9 @@
    +MIT License
    +
    +Copyright (c) Sindre Sorhus  (https://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/npm/node_modules/p-map/package.json b/node_modules/npm/node_modules/p-map/package.json
    new file mode 100644
    index 00000000..b7b6594c
    --- /dev/null
    +++ b/node_modules/npm/node_modules/p-map/package.json
    @@ -0,0 +1,57 @@
    +{
    +	"name": "p-map",
    +	"version": "7.0.3",
    +	"description": "Map over promises concurrently",
    +	"license": "MIT",
    +	"repository": "sindresorhus/p-map",
    +	"funding": "https://github.com/sponsors/sindresorhus",
    +	"author": {
    +		"name": "Sindre Sorhus",
    +		"email": "sindresorhus@gmail.com",
    +		"url": "https://sindresorhus.com"
    +	},
    +	"type": "module",
    +	"exports": {
    +		"types": "./index.d.ts",
    +		"default": "./index.js"
    +	},
    +	"sideEffects": false,
    +	"engines": {
    +		"node": ">=18"
    +	},
    +	"scripts": {
    +		"test": "xo && ava && tsd"
    +	},
    +	"files": [
    +		"index.js",
    +		"index.d.ts"
    +	],
    +	"keywords": [
    +		"promise",
    +		"map",
    +		"resolved",
    +		"wait",
    +		"collection",
    +		"iterable",
    +		"iterator",
    +		"race",
    +		"fulfilled",
    +		"async",
    +		"await",
    +		"promises",
    +		"concurrently",
    +		"concurrency",
    +		"parallel",
    +		"bluebird"
    +	],
    +	"devDependencies": {
    +		"ava": "^5.2.0",
    +		"chalk": "^5.3.0",
    +		"delay": "^6.0.0",
    +		"in-range": "^3.0.0",
    +		"random-int": "^3.0.0",
    +		"time-span": "^5.1.0",
    +		"tsd": "^0.29.0",
    +		"xo": "^0.56.0"
    +	}
    +}
    diff --git a/node_modules/npm/node_modules/package-json-from-dist/LICENSE.md b/node_modules/npm/node_modules/package-json-from-dist/LICENSE.md
    new file mode 100644
    index 00000000..881248b6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/package-json-from-dist/LICENSE.md
    @@ -0,0 +1,63 @@
    +All packages under `src/` are licensed according to the terms in
    +their respective `LICENSE` or `LICENSE.md` files.
    +
    +The remainder of this project is licensed under the Blue Oak
    +Model License, as follows:
    +
    +-----
    +
    +# Blue Oak Model License
    +
    +Version 1.0.0
    +
    +## Purpose
    +
    +This license gives everyone as much permission to work with
    +this software as possible, while protecting contributors
    +from liability.
    +
    +## Acceptance
    +
    +In order to receive this license, you must agree to its
    +rules.  The rules of this license are both obligations
    +under that agreement and conditions to your license.
    +You must not do anything with this software that triggers
    +a rule that you cannot or will not follow.
    +
    +## Copyright
    +
    +Each contributor licenses you to do everything with this
    +software that would otherwise infringe that contributor's
    +copyright in it.
    +
    +## Notices
    +
    +You must ensure that everyone who gets a copy of
    +any part of this software from you, with or without
    +changes, also gets the text of this license or a link to
    +.
    +
    +## Excuse
    +
    +If anyone notifies you in writing that you have not
    +complied with [Notices](#notices), you can keep your
    +license by taking all practical steps to comply within 30
    +days after the notice.  If you do not do so, your license
    +ends immediately.
    +
    +## Patent
    +
    +Each contributor licenses you to do everything with this
    +software that would otherwise infringe any patent claims
    +they can license or become able to license.
    +
    +## Reliability
    +
    +No contributor can revoke this license.
    +
    +## No Liability
    +
    +***As far as the law allows, this software comes as is,
    +without any warranty or condition, and no contributor
    +will be liable to anyone for any damages related to this
    +software or this license, under any kind of legal claim.***
    diff --git a/node_modules/npm/node_modules/package-json-from-dist/dist/commonjs/index.js b/node_modules/npm/node_modules/package-json-from-dist/dist/commonjs/index.js
    new file mode 100644
    index 00000000..b966ac9f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/package-json-from-dist/dist/commonjs/index.js
    @@ -0,0 +1,134 @@
    +"use strict";
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.loadPackageJson = exports.findPackageJson = void 0;
    +const node_fs_1 = require("node:fs");
    +const node_path_1 = require("node:path");
    +const node_url_1 = require("node:url");
    +const NM = `${node_path_1.sep}node_modules${node_path_1.sep}`;
    +const STORE = `.store${node_path_1.sep}`;
    +const PKG = `${node_path_1.sep}package${node_path_1.sep}`;
    +const DIST = `${node_path_1.sep}dist${node_path_1.sep}`;
    +/**
    + * Find the package.json file, either from a TypeScript file somewhere not
    + * in a 'dist' folder, or a built and/or installed 'dist' folder.
    + *
    + * Note: this *only* works if you build your code into `'./dist'`, and that the
    + * source path does not also contain `'dist'`! If you don't build into
    + * `'./dist'`, or if you have files at `./src/dist/dist.ts`, then this will
    + * not work properly!
    + *
    + * The default `pathFromSrc` option assumes that the calling code lives one
    + * folder below the root of the package. Otherwise, it must be specified.
    + *
    + * Example:
    + *
    + * ```ts
    + * // src/index.ts
    + * import { findPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = findPackageJson(import.meta.url)
    + * console.log(`package.json found at ${pj}`)
    + * ```
    + *
    + * If the caller is deeper within the project source, then you must provide
    + * the appropriate fallback path:
    + *
    + * ```ts
    + * // src/components/something.ts
    + * import { findPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = findPackageJson(import.meta.url, '../../package.json')
    + * console.log(`package.json found at ${pj}`)
    + * ```
    + *
    + * When running from CommmonJS, use `__filename` instead of `import.meta.url`
    + *
    + * ```ts
    + * // src/index.cts
    + * import { findPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = findPackageJson(__filename)
    + * console.log(`package.json found at ${pj}`)
    + * ```
    + */
    +const findPackageJson = (from, pathFromSrc = '../package.json') => {
    +    const f = typeof from === 'object' || from.startsWith('file://') ?
    +        (0, node_url_1.fileURLToPath)(from)
    +        : from;
    +    const __dirname = (0, node_path_1.dirname)(f);
    +    const nms = __dirname.lastIndexOf(NM);
    +    if (nms !== -1) {
    +        // inside of node_modules. find the dist directly under package name.
    +        const nm = __dirname.substring(0, nms + NM.length);
    +        const pkgDir = __dirname.substring(nms + NM.length);
    +        // affordance for yarn berry, which puts package contents in
    +        // '.../node_modules/.store/${id}-${hash}/package/...'
    +        if (pkgDir.startsWith(STORE)) {
    +            const pkg = pkgDir.indexOf(PKG, STORE.length);
    +            if (pkg) {
    +                return (0, node_path_1.resolve)(nm, pkgDir.substring(0, pkg + PKG.length), 'package.json');
    +            }
    +        }
    +        const pkgName = pkgDir.startsWith('@') ?
    +            pkgDir.split(node_path_1.sep, 2).join(node_path_1.sep)
    +            : String(pkgDir.split(node_path_1.sep)[0]);
    +        return (0, node_path_1.resolve)(nm, pkgName, 'package.json');
    +    }
    +    else {
    +        // see if we are in a dist folder.
    +        const d = __dirname.lastIndexOf(DIST);
    +        if (d !== -1) {
    +            return (0, node_path_1.resolve)(__dirname.substring(0, d), 'package.json');
    +        }
    +        else {
    +            return (0, node_path_1.resolve)(__dirname, pathFromSrc);
    +        }
    +    }
    +};
    +exports.findPackageJson = findPackageJson;
    +/**
    + * Load the package.json file, either from a TypeScript file somewhere not
    + * in a 'dist' folder, or a built and/or installed 'dist' folder.
    + *
    + * Note: this *only* works if you build your code into `'./dist'`, and that the
    + * source path does not also contain `'dist'`! If you don't build into
    + * `'./dist'`, or if you have files at `./src/dist/dist.ts`, then this will
    + * not work properly!
    + *
    + * The default `pathFromSrc` option assumes that the calling code lives one
    + * folder below the root of the package. Otherwise, it must be specified.
    + *
    + * Example:
    + *
    + * ```ts
    + * // src/index.ts
    + * import { loadPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = loadPackageJson(import.meta.url)
    + * console.log(`Hello from ${pj.name}@${pj.version}`)
    + * ```
    + *
    + * If the caller is deeper within the project source, then you must provide
    + * the appropriate fallback path:
    + *
    + * ```ts
    + * // src/components/something.ts
    + * import { loadPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = loadPackageJson(import.meta.url, '../../package.json')
    + * console.log(`Hello from ${pj.name}@${pj.version}`)
    + * ```
    + *
    + * When running from CommmonJS, use `__filename` instead of `import.meta.url`
    + *
    + * ```ts
    + * // src/index.cts
    + * import { loadPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = loadPackageJson(__filename)
    + * console.log(`Hello from ${pj.name}@${pj.version}`)
    + * ```
    + */
    +const loadPackageJson = (from, pathFromSrc = '../package.json') => JSON.parse((0, node_fs_1.readFileSync)((0, exports.findPackageJson)(from, pathFromSrc), 'utf8'));
    +exports.loadPackageJson = loadPackageJson;
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/package-json-from-dist/dist/commonjs/package.json b/node_modules/npm/node_modules/package-json-from-dist/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/package-json-from-dist/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/package-json-from-dist/dist/esm/index.js b/node_modules/npm/node_modules/package-json-from-dist/dist/esm/index.js
    new file mode 100644
    index 00000000..426ad3c2
    --- /dev/null
    +++ b/node_modules/npm/node_modules/package-json-from-dist/dist/esm/index.js
    @@ -0,0 +1,129 @@
    +import { readFileSync } from 'node:fs';
    +import { dirname, resolve, sep } from 'node:path';
    +import { fileURLToPath } from 'node:url';
    +const NM = `${sep}node_modules${sep}`;
    +const STORE = `.store${sep}`;
    +const PKG = `${sep}package${sep}`;
    +const DIST = `${sep}dist${sep}`;
    +/**
    + * Find the package.json file, either from a TypeScript file somewhere not
    + * in a 'dist' folder, or a built and/or installed 'dist' folder.
    + *
    + * Note: this *only* works if you build your code into `'./dist'`, and that the
    + * source path does not also contain `'dist'`! If you don't build into
    + * `'./dist'`, or if you have files at `./src/dist/dist.ts`, then this will
    + * not work properly!
    + *
    + * The default `pathFromSrc` option assumes that the calling code lives one
    + * folder below the root of the package. Otherwise, it must be specified.
    + *
    + * Example:
    + *
    + * ```ts
    + * // src/index.ts
    + * import { findPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = findPackageJson(import.meta.url)
    + * console.log(`package.json found at ${pj}`)
    + * ```
    + *
    + * If the caller is deeper within the project source, then you must provide
    + * the appropriate fallback path:
    + *
    + * ```ts
    + * // src/components/something.ts
    + * import { findPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = findPackageJson(import.meta.url, '../../package.json')
    + * console.log(`package.json found at ${pj}`)
    + * ```
    + *
    + * When running from CommmonJS, use `__filename` instead of `import.meta.url`
    + *
    + * ```ts
    + * // src/index.cts
    + * import { findPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = findPackageJson(__filename)
    + * console.log(`package.json found at ${pj}`)
    + * ```
    + */
    +export const findPackageJson = (from, pathFromSrc = '../package.json') => {
    +    const f = typeof from === 'object' || from.startsWith('file://') ?
    +        fileURLToPath(from)
    +        : from;
    +    const __dirname = dirname(f);
    +    const nms = __dirname.lastIndexOf(NM);
    +    if (nms !== -1) {
    +        // inside of node_modules. find the dist directly under package name.
    +        const nm = __dirname.substring(0, nms + NM.length);
    +        const pkgDir = __dirname.substring(nms + NM.length);
    +        // affordance for yarn berry, which puts package contents in
    +        // '.../node_modules/.store/${id}-${hash}/package/...'
    +        if (pkgDir.startsWith(STORE)) {
    +            const pkg = pkgDir.indexOf(PKG, STORE.length);
    +            if (pkg) {
    +                return resolve(nm, pkgDir.substring(0, pkg + PKG.length), 'package.json');
    +            }
    +        }
    +        const pkgName = pkgDir.startsWith('@') ?
    +            pkgDir.split(sep, 2).join(sep)
    +            : String(pkgDir.split(sep)[0]);
    +        return resolve(nm, pkgName, 'package.json');
    +    }
    +    else {
    +        // see if we are in a dist folder.
    +        const d = __dirname.lastIndexOf(DIST);
    +        if (d !== -1) {
    +            return resolve(__dirname.substring(0, d), 'package.json');
    +        }
    +        else {
    +            return resolve(__dirname, pathFromSrc);
    +        }
    +    }
    +};
    +/**
    + * Load the package.json file, either from a TypeScript file somewhere not
    + * in a 'dist' folder, or a built and/or installed 'dist' folder.
    + *
    + * Note: this *only* works if you build your code into `'./dist'`, and that the
    + * source path does not also contain `'dist'`! If you don't build into
    + * `'./dist'`, or if you have files at `./src/dist/dist.ts`, then this will
    + * not work properly!
    + *
    + * The default `pathFromSrc` option assumes that the calling code lives one
    + * folder below the root of the package. Otherwise, it must be specified.
    + *
    + * Example:
    + *
    + * ```ts
    + * // src/index.ts
    + * import { loadPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = loadPackageJson(import.meta.url)
    + * console.log(`Hello from ${pj.name}@${pj.version}`)
    + * ```
    + *
    + * If the caller is deeper within the project source, then you must provide
    + * the appropriate fallback path:
    + *
    + * ```ts
    + * // src/components/something.ts
    + * import { loadPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = loadPackageJson(import.meta.url, '../../package.json')
    + * console.log(`Hello from ${pj.name}@${pj.version}`)
    + * ```
    + *
    + * When running from CommmonJS, use `__filename` instead of `import.meta.url`
    + *
    + * ```ts
    + * // src/index.cts
    + * import { loadPackageJson } from 'package-json-from-dist'
    + *
    + * const pj = loadPackageJson(__filename)
    + * console.log(`Hello from ${pj.name}@${pj.version}`)
    + * ```
    + */
    +export const loadPackageJson = (from, pathFromSrc = '../package.json') => JSON.parse(readFileSync(findPackageJson(from, pathFromSrc), 'utf8'));
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/package-json-from-dist/dist/esm/package.json b/node_modules/npm/node_modules/package-json-from-dist/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/package-json-from-dist/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/package-json-from-dist/package.json b/node_modules/npm/node_modules/package-json-from-dist/package.json
    new file mode 100644
    index 00000000..a2d03c32
    --- /dev/null
    +++ b/node_modules/npm/node_modules/package-json-from-dist/package.json
    @@ -0,0 +1,68 @@
    +{
    +  "name": "package-json-from-dist",
    +  "version": "1.0.1",
    +  "description": "Load the local package.json from either src or dist folder",
    +  "main": "./dist/commonjs/index.js",
    +  "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 . --log-level warn",
    +    "typedoc": "typedoc"
    +  },
    +  "author": "Isaac Z. Schlueter  (https://izs.me)",
    +  "license": "BlueOak-1.0.0",
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/isaacs/package-json-from-dist.git"
    +  },
    +  "devDependencies": {
    +    "@types/node": "^20.12.12",
    +    "prettier": "^3.2.5",
    +    "tap": "^18.5.3",
    +    "typedoc": "^0.24.8",
    +    "typescript": "^5.1.6",
    +    "tshy": "^1.14.0"
    +  },
    +  "prettier": {
    +    "semi": false,
    +    "printWidth": 70,
    +    "tabWidth": 2,
    +    "useTabs": false,
    +    "singleQuote": true,
    +    "jsxSingleQuote": false,
    +    "bracketSameLine": true,
    +    "arrowParens": "avoid",
    +    "endOfLine": "lf",
    +    "experimentalTernaries": true
    +  },
    +  "tshy": {
    +    "exports": {
    +      "./package.json": "./package.json",
    +      ".": "./src/index.ts"
    +    }
    +  },
    +  "types": "./dist/commonjs/index.d.ts",
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/pacote/LICENSE b/node_modules/npm/node_modules/pacote/LICENSE
    new file mode 100644
    index 00000000..a03cd0ed
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/LICENSE
    @@ -0,0 +1,15 @@
    +The ISC License
    +
    +Copyright (c) Isaac Z. Schlueter, Kat Marchán, 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/npm/node_modules/pacote/README.md b/node_modules/npm/node_modules/pacote/README.md
    new file mode 100644
    index 00000000..dbb0051d
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/README.md
    @@ -0,0 +1,283 @@
    +# pacote
    +
    +Fetches package manifests and tarballs from the npm registry.
    +
    +## USAGE
    +
    +```js
    +const pacote = require('pacote')
    +
    +// get a package manifest
    +pacote.manifest('foo@1.x').then(manifest => console.log('got it', manifest))
    +
    +// extract a package into a folder
    +pacote.extract('github:npm/cli', 'some/path', options)
    +  .then(({from, resolved, integrity}) => {
    +    console.log('extracted!', from, resolved, integrity)
    +  })
    +
    +pacote.tarball('https://server.com/package.tgz').then(data => {
    +  console.log('got ' + data.length + ' bytes of tarball data')
    +})
    +```
    +
    +`pacote` works with any kind of package specifier that npm can install.  If
    +you can pass it to the npm CLI, you can pass it to pacote.  (In fact, that's
    +exactly what the npm CLI does.)
    +
    +Anything that you can do with one kind of package, you can do with another.
    +
    +Data that isn't relevant (like a packument for a tarball) will be
    +simulated.
    +
    +`prepare` scripts will be run when generating tarballs from `git` and
    +`directory` locations, to simulate what _would_ be published to the
    +registry, so that you get a working package instead of just raw source
    +code that might need to be transpiled.
    +
    +## CLI
    +
    +This module exports a command line interface that can do most of what is
    +described below.  Run `pacote -h` to learn more.
    +
    +```
    +Pacote - The JavaScript Package Handler, v10.1.1
    +
    +Usage:
    +
    +  pacote resolve 
    +    Resolve a specifier and output the fully resolved target
    +    Returns integrity and from if '--long' flag is set.
    +
    +  pacote manifest 
    +    Fetch a manifest and print to stdout
    +
    +  pacote packument 
    +    Fetch a full packument and print to stdout
    +
    +  pacote tarball  []
    +    Fetch a package tarball and save to 
    +    If  is missing or '-', the tarball will be streamed to stdout.
    +
    +  pacote extract  
    +    Extract a package to the destination folder.
    +
    +Configuration values all match the names of configs passed to npm, or
    +options passed to Pacote.  Additional flags for this executable:
    +
    +  --long     Print an object from 'resolve', including integrity and spec.
    +  --json     Print result objects as JSON rather than node's default.
    +             (This is the default if stdout is not a TTY.)
    +  --help -h  Print this helpful text.
    +
    +For example '--cache=/path/to/folder' will use that folder as the cache.
    +```
    +
    +## API
    +
    +The `spec` refers to any kind of package specifier that npm can install.
    +If you can pass it to the npm CLI, you can pass it to pacote.  (In fact,
    +that's exactly what the npm CLI does.)
    +
    +See below for valid `opts` values.
    +
    +* `pacote.resolve(spec, opts)` Resolve a specifier like `foo@latest` or
    +  `github:user/project` all the way to a tarball url, tarball file, or git
    +  repo with commit hash.
    +
    +* `pacote.extract(spec, dest, opts)` Extract a package's tarball into a
    +  destination folder.  Returns a promise that resolves to the
    +  `{from,resolved,integrity}` of the extracted package.
    +
    +* `pacote.manifest(spec, opts)` Fetch (or simulate) a package's manifest
    +  (basically, the `package.json` file, plus a bit of metadata).
    +  See below for more on manifests and packuments.  Returns a Promise that
    +  resolves to the manifest object.
    +
    +* `pacote.packument(spec, opts)` Fetch (or simulate) a package's packument
    +  (basically, the top-level package document listing all the manifests that
    +  the registry returns).  See below for more on manifests and packuments.
    +  Returns a Promise that resolves to the packument object.
    +
    +* `pacote.tarball(spec, opts)`  Get a package tarball data as a buffer in
    +  memory.  Returns a Promise that resolves to the tarball data Buffer, with
    +  `from`, `resolved`, and `integrity` fields attached.
    +
    +* `pacote.tarball.file(spec, dest, opts)`  Save a package tarball data to
    +  a file on disk.  Returns a Promise that resolves to
    +  `{from,integrity,resolved}` of the fetched tarball.
    +
    +* `pacote.tarball.stream(spec, streamHandler, opts)`  Fetch a tarball and
    +  make the stream available to the `streamHandler` function.
    +
    +    This is mostly an internal function, but it is exposed because it does
    +    provide some functionality that may be difficult to achieve otherwise.
    +
    +    The `streamHandler` function MUST return a Promise that resolves when
    +    the stream (and all associated work) is ended, or rejects if the stream
    +    has an error.
    +
    +    The `streamHandler` function MAY be called multiple times, as Pacote
    +    retries requests in some scenarios, such as cache corruption or
    +    retriable network failures.
    +
    +### Options
    +
    +Options are passed to
    +[`npm-registry-fetch`](http://npm.im/npm-registry-fetch) and
    +[`cacache`](http://npm.im/cacache), so in addition to these, anything for
    +those modules can be given to pacote as well.
    +
    +Options object is cloned, and mutated along the way to add integrity,
    +resolved, and other properties, as they are determined.
    +
    +* `cache` Where to store cache entries and temp files.  Passed to
    +  [`cacache`](http://npm.im/cacache).  Defaults to the same cache directory
    +  that npm will use by default, based on platform and environment.
    +* `where` Base folder for resolving relative `file:` dependencies.
    +* `resolved` Shortcut for looking up resolved values.  Should be specified
    +  if known.
    +* `integrity` Expected integrity of fetched package tarball.  If specified,
    +  tarballs with mismatched integrity values will raise an `EINTEGRITY`
    +  error.
    +* `umask` Permission mode mask for extracted files and directories.
    +  Defaults to `0o22`.  See "Extracted File Modes" below.
    +* `fmode` Minimum permission mode for extracted files.  Defaults to
    +  `0o666`.  See "Extracted File Modes" below.
    +* `dmode` Minimum permission mode for extracted directories.  Defaults to
    +  `0o777`.  See "Extracted File Modes" below.
    +* `preferOnline` Prefer to revalidate cache entries, even when it would not
    +  be strictly necessary.  Default `false`.
    +* `before` When picking a manifest from a packument, only consider
    +  packages published before the specified date.  Default `null`.
    +* `defaultTag` The default `dist-tag` to use when choosing a manifest from a
    +  packument.  Defaults to `latest`.
    +* `registry` The npm registry to use by default.  Defaults to
    +  `https://registry.npmjs.org/`.
    +* `fullMetadata` Fetch the full metadata from the registry for packuments,
    +  including information not strictly required for installation (author,
    +  description, etc.)  Defaults to `true` when `before` is set, since the
    +  version publish time is part of the extended packument metadata.
    +* `fullReadJson` Use the slower `read-package-json` package insted of
    +  `read-package-json-fast` in order to include extra fields like "readme" in
    +  the manifest. Defaults to `false`.
    +* `packumentCache` For registry packuments only, you may provide a `Map`
    +  object which will be used to cache packument requests between pacote
    +  calls.  This allows you to easily avoid hitting the registry multiple
    +  times (even just to validate the cache) for a given packument, since it
    +  is unlikely to change in the span of a single command.
    +* `verifySignatures` A boolean that will make pacote verify the
    +    integrity signature of a manifest, if present.  There must be a
    +    configured `_keys` entry in the config that is scoped to the
    +    registry the manifest is being fetched from.
    +* `verifyAttestations` A boolean that will make pacote verify Sigstore
    +    attestations, if present. There must be a configured `_keys` entry in the
    +    config that is scoped to the registry the manifest is being fetched from.
    +* `tufCache` Where to store metadata/target files when retrieving the package
    +  attestation key material via TUF. Defaults to the same cache directory that
    +  npm will use by default, based on platform and environment.
    +
    +### Advanced API
    +
    +Each different type of fetcher is exposed for more advanced usage such as
    +using helper methods from this classes:
    +
    +* `DirFetcher`
    +* `FileFetcher`
    +* `GitFetcher`
    +* `RegistryFetcher`
    +* `RemoteFetcher`
    +
    +## Extracted File Modes
    +
    +Files are extracted with a mode matching the following formula:
    +
    +```
    +( (tarball entry mode value) | (minimum mode option) ) ~ (umask)
    +```
    +
    +This is in order to prevent unreadable files or unlistable directories from
    +cluttering a project's `node_modules` folder, even if the package tarball
    +specifies that the file should be inaccessible.
    +
    +It also prevents files from being group- or world-writable without explicit
    +opt-in by the user, because all file and directory modes are masked against
    +the `umask` value.
    +
    +So, a file which is `0o771` in the tarball, using the default `fmode` of
    +`0o666` and `umask` of `0o22`, will result in a file mode of `0o755`:
    +
    +```
    +(0o771 | 0o666) => 0o777
    +(0o777 ~ 0o22) => 0o755
    +```
    +
    +In almost every case, the defaults are appropriate.  To respect exactly
    +what is in the package tarball (even if this makes an unusable system), set
    +both `dmode` and `fmode` options to `0`.  Otherwise, the `umask` config
    +should be used in most cases where file mode modifications are required,
    +and this functions more or less the same as the `umask` value in most Unix
    +systems.
    +
    +## Extracted File Ownership
    +
    +When running as `root` on Unix systems, all extracted files and folders
    +will have their owning `uid` and `gid` values set to match the ownership
    +of the containing folder.
    +
    +This prevents `root`-owned files showing up in a project's `node_modules`
    +folder when a user runs `sudo npm install`.
    +
    +## Manifests
    +
    +A `manifest` is similar to a `package.json` file.  However, it has a few
    +pieces of extra metadata, and sometimes lacks metadata that is inessential
    +to package installation.
    +
    +In addition to the common `package.json` fields, manifests include:
    +
    +* `manifest._resolved` The tarball url or file path where the package
    +  artifact can be found.
    +* `manifest._from` A normalized form of the spec passed in as an argument.
    +* `manifest._integrity` The integrity value for the package artifact.
    +* `manifest._id` The canonical spec of this package version: name@version.
    +* `manifest.dist` Registry manifests (those included in a packument) have a
    +  `dist` object.  Only `tarball` is required, though at least one of
    +  `shasum` or `integrity` is almost always present.
    +
    +    * `tarball` The url to the associated package artifact.  (Copied by
    +      Pacote to `manifest._resolved`.)
    +    * `integrity` The integrity SRI string for the artifact.  This may not
    +      be present for older packages on the npm registry.  (Copied by Pacote
    +      to `manifest._integrity`.)
    +    * `shasum` Legacy integrity value.  Hexadecimal-encoded sha1 hash.
    +      (Converted to an SRI string and copied by Pacote to
    +      `manifest._integrity` when `dist.integrity` is not present.)
    +    * `fileCount` Number of files in the tarball.
    +    * `unpackedSize` Size on disk of the package when unpacked.
    +    * `signatures` Signatures of the shasum.  Includes the keyid that
    +        correlates to a [`key from the npm
    +        registry`](https://registry.npmjs.org/-/npm/v1/keys)
    +
    +## Packuments
    +
    +A packument is the top-level package document that lists the set of
    +manifests for available versions for a package.
    +
    +When a packument is fetched with `accept:
    +application/vnd.npm.install-v1+json` in the HTTP headers, only the most
    +minimum necessary metadata is returned.  Additional metadata is returned
    +when fetched with only `accept: application/json`.
    +
    +For Pacote's purposes, the following fields are relevant:
    +
    +* `versions` An object where each key is a version, and each value is the
    +  manifest for that version.
    +* `dist-tags` An object mapping dist-tags to version numbers.  This is how
    +  `foo@latest` gets turned into `foo@1.2.3`.
    +* `time` In the full packument, an object mapping version numbers to
    +  publication times, for the `opts.before` functionality.
    +
    +Pacote adds the following field, regardless of the accept header:
    +
    +* `_contentLength` The size of the packument.
    diff --git a/node_modules/npm/node_modules/pacote/bin/index.js b/node_modules/npm/node_modules/pacote/bin/index.js
    new file mode 100755
    index 00000000..f35b62ca
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/bin/index.js
    @@ -0,0 +1,158 @@
    +#!/usr/bin/env node
    +
    +const run = conf => {
    +  const pacote = require('../')
    +  switch (conf._[0]) {
    +    case 'resolve':
    +    case 'manifest':
    +    case 'packument':
    +      if (conf._[0] === 'resolve' && conf.long) {
    +        return pacote.manifest(conf._[1], conf).then(mani => ({
    +          resolved: mani._resolved,
    +          integrity: mani._integrity,
    +          from: mani._from,
    +        }))
    +      }
    +      return pacote[conf._[0]](conf._[1], conf)
    +
    +    case 'tarball':
    +      if (!conf._[2] || conf._[2] === '-') {
    +        return pacote.tarball.stream(conf._[1], stream => {
    +          stream.pipe(
    +            conf.testStdout ||
    +            /* istanbul ignore next */
    +            process.stdout
    +          )
    +          // make sure it resolves something falsey
    +          return stream.promise().then(() => {
    +            return false
    +          })
    +        }, conf)
    +      } else {
    +        return pacote.tarball.file(conf._[1], conf._[2], conf)
    +      }
    +
    +    case 'extract':
    +      return pacote.extract(conf._[1], conf._[2], conf)
    +
    +    default: /* istanbul ignore next */ {
    +      throw new Error(`bad command: ${conf._[0]}`)
    +    }
    +  }
    +}
    +
    +const version = require('../package.json').version
    +const usage = () =>
    +`Pacote - The JavaScript Package Handler, v${version}
    +
    +Usage:
    +
    +  pacote resolve 
    +    Resolve a specifier and output the fully resolved target
    +    Returns integrity and from if '--long' flag is set.
    +
    +  pacote manifest 
    +    Fetch a manifest and print to stdout
    +
    +  pacote packument 
    +    Fetch a full packument and print to stdout
    +
    +  pacote tarball  []
    +    Fetch a package tarball and save to 
    +    If  is missing or '-', the tarball will be streamed to stdout.
    +
    +  pacote extract  
    +    Extract a package to the destination folder.
    +
    +Configuration values all match the names of configs passed to npm, or
    +options passed to Pacote.  Additional flags for this executable:
    +
    +  --long     Print an object from 'resolve', including integrity and spec.
    +  --json     Print result objects as JSON rather than node's default.
    +             (This is the default if stdout is not a TTY.)
    +  --help -h  Print this helpful text.
    +
    +For example '--cache=/path/to/folder' will use that folder as the cache.
    +`
    +
    +const shouldJSON = (conf, result) =>
    +  conf.json ||
    +  !process.stdout.isTTY &&
    +  conf.json === undefined &&
    +  result &&
    +  typeof result === 'object'
    +
    +const pretty = (conf, result) =>
    +  shouldJSON(conf, result) ? JSON.stringify(result, 0, 2) : result
    +
    +let addedLogListener = false
    +const main = args => {
    +  const conf = parse(args)
    +  if (conf.help || conf.h) {
    +    return console.log(usage())
    +  }
    +
    +  if (!addedLogListener) {
    +    process.on('log', console.error)
    +    addedLogListener = true
    +  }
    +
    +  try {
    +    return run(conf)
    +      .then(result => result && console.log(pretty(conf, result)))
    +      .catch(er => {
    +        console.error(er)
    +        process.exit(1)
    +      })
    +  } catch (er) {
    +    console.error(er.message)
    +    console.error(usage())
    +  }
    +}
    +
    +const parseArg = arg => {
    +  const split = arg.slice(2).split('=')
    +  const k = split.shift()
    +  const v = split.join('=')
    +  const no = /^no-/.test(k) && !v
    +  const key = (no ? k.slice(3) : k)
    +    .replace(/^tag$/, 'defaultTag')
    +    .replace(/-([a-z])/g, (_, c) => c.toUpperCase())
    +  const value = v ? v.replace(/^~/, process.env.HOME) : !no
    +  return { key, value }
    +}
    +
    +const parse = args => {
    +  const conf = {
    +    _: [],
    +    cache: process.env.HOME + '/.npm/_cacache',
    +  }
    +  let dashdash = false
    +  args.forEach(arg => {
    +    if (dashdash) {
    +      conf._.push(arg)
    +    } else if (arg === '--') {
    +      dashdash = true
    +    } else if (arg === '-h') {
    +      conf.help = true
    +    } else if (/^--/.test(arg)) {
    +      const { key, value } = parseArg(arg)
    +      conf[key] = value
    +    } else {
    +      conf._.push(arg)
    +    }
    +  })
    +  return conf
    +}
    +
    +if (module === require.main) {
    +  main(process.argv.slice(2))
    +} else {
    +  module.exports = {
    +    main,
    +    run,
    +    usage,
    +    parseArg,
    +    parse,
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/pacote/lib/dir.js b/node_modules/npm/node_modules/pacote/lib/dir.js
    new file mode 100644
    index 00000000..04846eb8
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/dir.js
    @@ -0,0 +1,105 @@
    +const { resolve } = require('node:path')
    +const packlist = require('npm-packlist')
    +const runScript = require('@npmcli/run-script')
    +const tar = require('tar')
    +const { Minipass } = require('minipass')
    +const Fetcher = require('./fetcher.js')
    +const FileFetcher = require('./file.js')
    +const _ = require('./util/protected.js')
    +const tarCreateOptions = require('./util/tar-create-options.js')
    +
    +class DirFetcher extends Fetcher {
    +  constructor (spec, opts) {
    +    super(spec, opts)
    +    // just the fully resolved filename
    +    this.resolved = this.spec.fetchSpec
    +
    +    this.tree = opts.tree || null
    +    this.Arborist = opts.Arborist || null
    +  }
    +
    +  // exposes tarCreateOptions as public API
    +  static tarCreateOptions (manifest) {
    +    return tarCreateOptions(manifest)
    +  }
    +
    +  get types () {
    +    return ['directory']
    +  }
    +
    +  #prepareDir () {
    +    return this.manifest().then(mani => {
    +      if (!mani.scripts || !mani.scripts.prepare) {
    +        return
    +      }
    +      if (this.opts.ignoreScripts) {
    +        return
    +      }
    +
    +      // we *only* run prepare.
    +      // pre/post-pack is run by the npm CLI for publish and pack,
    +      // but this function is *also* run when installing git deps
    +      const stdio = this.opts.foregroundScripts ? 'inherit' : 'pipe'
    +
    +      return runScript({
    +        // this || undefined is because runScript will be unhappy with the default null value
    +        scriptShell: this.opts.scriptShell || undefined,
    +        pkg: mani,
    +        event: 'prepare',
    +        path: this.resolved,
    +        stdio,
    +        env: {
    +          npm_package_resolved: this.resolved,
    +          npm_package_integrity: this.integrity,
    +          npm_package_json: resolve(this.resolved, 'package.json'),
    +        },
    +      })
    +    })
    +  }
    +
    +  [_.tarballFromResolved] () {
    +    if (!this.tree && !this.Arborist) {
    +      throw new Error('DirFetcher requires either a tree or an Arborist constructor to pack')
    +    }
    +
    +    const stream = new Minipass()
    +    stream.resolved = this.resolved
    +    stream.integrity = this.integrity
    +
    +    const { prefix, workspaces } = this.opts
    +
    +    // run the prepare script, get the list of files, and tar it up
    +    // pipe to the stream, and proxy errors the chain.
    +    this.#prepareDir()
    +      .then(async () => {
    +        if (!this.tree) {
    +          const arb = new this.Arborist({ path: this.resolved })
    +          this.tree = await arb.loadActual()
    +        }
    +        return packlist(this.tree, { path: this.resolved, prefix, workspaces })
    +      })
    +      .then(files => tar.c(tarCreateOptions(this.package), files)
    +        .on('error', er => stream.emit('error', er)).pipe(stream))
    +      .catch(er => stream.emit('error', er))
    +    return stream
    +  }
    +
    +  manifest () {
    +    if (this.package) {
    +      return Promise.resolve(this.package)
    +    }
    +
    +    return this[_.readPackageJson](this.resolved)
    +      .then(mani => this.package = {
    +        ...mani,
    +        _integrity: this.integrity && String(this.integrity),
    +        _resolved: this.resolved,
    +        _from: this.from,
    +      })
    +  }
    +
    +  packument () {
    +    return FileFetcher.prototype.packument.apply(this)
    +  }
    +}
    +module.exports = DirFetcher
    diff --git a/node_modules/npm/node_modules/pacote/lib/fetcher.js b/node_modules/npm/node_modules/pacote/lib/fetcher.js
    new file mode 100644
    index 00000000..f2ac9761
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/fetcher.js
    @@ -0,0 +1,497 @@
    +// This is the base class that the other fetcher types in lib
    +// all descend from.
    +// It handles the unpacking and retry logic that is shared among
    +// all of the other Fetcher types.
    +
    +const { basename, dirname } = require('node:path')
    +const { rm, mkdir } = require('node:fs/promises')
    +const PackageJson = require('@npmcli/package-json')
    +const cacache = require('cacache')
    +const fsm = require('fs-minipass')
    +const getContents = require('@npmcli/installed-package-contents')
    +const npa = require('npm-package-arg')
    +const retry = require('promise-retry')
    +const ssri = require('ssri')
    +const tar = require('tar')
    +const { Minipass } = require('minipass')
    +const { log } = require('proc-log')
    +const _ = require('./util/protected.js')
    +const cacheDir = require('./util/cache-dir.js')
    +const isPackageBin = require('./util/is-package-bin.js')
    +const removeTrailingSlashes = require('./util/trailing-slashes.js')
    +
    +// Pacote is only concerned with the package.json contents
    +const packageJsonPrepare = (p) => PackageJson.prepare(p).then(pkg => pkg.content)
    +const packageJsonNormalize = (p) => PackageJson.normalize(p).then(pkg => pkg.content)
    +
    +class FetcherBase {
    +  constructor (spec, opts) {
    +    if (!opts || typeof opts !== 'object') {
    +      throw new TypeError('options object is required')
    +    }
    +    this.spec = npa(spec, opts.where)
    +
    +    this.allowGitIgnore = !!opts.allowGitIgnore
    +
    +    // a bit redundant because presumably the caller already knows this,
    +    // but it makes it easier to not have to keep track of the requested
    +    // spec when we're dispatching thousands of these at once, and normalizing
    +    // is nice.  saveSpec is preferred if set, because it turns stuff like
    +    // x/y#committish into github:x/y#committish.  use name@rawSpec for
    +    // registry deps so that we turn xyz and xyz@ -> xyz@
    +    this.from = this.spec.registry
    +      ? `${this.spec.name}@${this.spec.rawSpec}` : this.spec.saveSpec
    +
    +    this.#assertType()
    +    // clone the opts object so that others aren't upset when we mutate it
    +    // by adding/modifying the integrity value.
    +    this.opts = { ...opts }
    +
    +    this.cache = opts.cache || cacheDir().cacache
    +    this.tufCache = opts.tufCache || cacheDir().tufcache
    +    this.resolved = opts.resolved || null
    +
    +    // default to caching/verifying with sha512, that's what we usually have
    +    // need to change this default, or start overriding it, when sha512
    +    // is no longer strong enough.
    +    this.defaultIntegrityAlgorithm = opts.defaultIntegrityAlgorithm || 'sha512'
    +
    +    if (typeof opts.integrity === 'string') {
    +      this.opts.integrity = ssri.parse(opts.integrity)
    +    }
    +
    +    this.package = null
    +    this.type = this.constructor.name
    +    this.fmode = opts.fmode || 0o666
    +    this.dmode = opts.dmode || 0o777
    +    // we don't need a default umask, because we don't chmod files coming
    +    // out of package tarballs.  they're forced to have a mode that is
    +    // valid, regardless of what's in the tarball entry, and then we let
    +    // the process's umask setting do its job.  but if configured, we do
    +    // respect it.
    +    this.umask = opts.umask || 0
    +
    +    this.preferOnline = !!opts.preferOnline
    +    this.preferOffline = !!opts.preferOffline
    +    this.offline = !!opts.offline
    +
    +    this.before = opts.before
    +    this.fullMetadata = this.before ? true : !!opts.fullMetadata
    +    this.fullReadJson = !!opts.fullReadJson
    +    this[_.readPackageJson] = this.fullReadJson
    +      ? packageJsonPrepare
    +      : packageJsonNormalize
    +
    +    // rrh is a registry hostname or 'never' or 'always'
    +    // defaults to registry.npmjs.org
    +    this.replaceRegistryHost = (!opts.replaceRegistryHost || opts.replaceRegistryHost === 'npmjs') ?
    +      'registry.npmjs.org' : opts.replaceRegistryHost
    +
    +    this.defaultTag = opts.defaultTag || 'latest'
    +    this.registry = removeTrailingSlashes(opts.registry || 'https://registry.npmjs.org')
    +
    +    // command to run 'prepare' scripts on directories and git dirs
    +    // To use pacote with yarn, for example, set npmBin to 'yarn'
    +    // and npmCliConfig with yarn's equivalents.
    +    this.npmBin = opts.npmBin || 'npm'
    +
    +    // command to install deps for preparing
    +    this.npmInstallCmd = opts.npmInstallCmd || ['install', '--force']
    +
    +    // XXX fill more of this in based on what we know from this.opts
    +    // we explicitly DO NOT fill in --tag, though, since we are often
    +    // going to be packing in the context of a publish, which may set
    +    // a dist-tag, but certainly wants to keep defaulting to latest.
    +    this.npmCliConfig = opts.npmCliConfig || [
    +      `--cache=${dirname(this.cache)}`,
    +      `--prefer-offline=${!!this.preferOffline}`,
    +      `--prefer-online=${!!this.preferOnline}`,
    +      `--offline=${!!this.offline}`,
    +      ...(this.before ? [`--before=${this.before.toISOString()}`] : []),
    +      '--no-progress',
    +      '--no-save',
    +      '--no-audit',
    +      // override any omit settings from the environment
    +      '--include=dev',
    +      '--include=peer',
    +      '--include=optional',
    +      // we need the actual things, not just the lockfile
    +      '--no-package-lock-only',
    +      '--no-dry-run',
    +    ]
    +  }
    +
    +  get integrity () {
    +    return this.opts.integrity || null
    +  }
    +
    +  set integrity (i) {
    +    if (!i) {
    +      return
    +    }
    +
    +    i = ssri.parse(i)
    +    const current = this.opts.integrity
    +
    +    // do not ever update an existing hash value, but do
    +    // merge in NEW algos and hashes that we don't already have.
    +    if (current) {
    +      current.merge(i)
    +    } else {
    +      this.opts.integrity = i
    +    }
    +  }
    +
    +  get notImplementedError () {
    +    return new Error('not implemented in this fetcher type: ' + this.type)
    +  }
    +
    +  // override in child classes
    +  // Returns a Promise that resolves to this.resolved string value
    +  resolve () {
    +    return this.resolved ? Promise.resolve(this.resolved)
    +      : Promise.reject(this.notImplementedError)
    +  }
    +
    +  packument () {
    +    return Promise.reject(this.notImplementedError)
    +  }
    +
    +  // override in child class
    +  // returns a manifest containing:
    +  // - name
    +  // - version
    +  // - _resolved
    +  // - _integrity
    +  // - plus whatever else was in there (corgi, full metadata, or pj file)
    +  manifest () {
    +    return Promise.reject(this.notImplementedError)
    +  }
    +
    +  // private, should be overridden.
    +  // Note that they should *not* calculate or check integrity or cache,
    +  // but *just*  return the raw tarball data stream.
    +  [_.tarballFromResolved] () {
    +    throw this.notImplementedError
    +  }
    +
    +  // public, should not be overridden
    +  tarball () {
    +    return this.tarballStream(stream => stream.concat().then(data => {
    +      data.integrity = this.integrity && String(this.integrity)
    +      data.resolved = this.resolved
    +      data.from = this.from
    +      return data
    +    }))
    +  }
    +
    +  // private
    +  // Note: cacache will raise a EINTEGRITY error if the integrity doesn't match
    +  #tarballFromCache () {
    +    const startTime = Date.now()
    +    const stream = cacache.get.stream.byDigest(this.cache, this.integrity, this.opts)
    +    const elapsedTime = Date.now() - startTime
    +    // cache is good, so log it as a hit in particular since there was no fetch logged
    +    log.http(
    +      'cache',
    +      `${this.spec} ${elapsedTime}ms (cache hit)`
    +    )
    +    return stream
    +  }
    +
    +  get [_.cacheFetches] () {
    +    return true
    +  }
    +
    +  #istream (stream) {
    +    // if not caching this, just return it
    +    if (!this.opts.cache || !this[_.cacheFetches]) {
    +      // instead of creating a new integrity stream, we only piggyback on the
    +      // provided stream's events
    +      if (stream.hasIntegrityEmitter) {
    +        stream.on('integrity', i => this.integrity = i)
    +        return stream
    +      }
    +
    +      const istream = ssri.integrityStream(this.opts)
    +      istream.on('integrity', i => this.integrity = i)
    +      stream.on('error', err => istream.emit('error', err))
    +      return stream.pipe(istream)
    +    }
    +
    +    // we have to return a stream that gets ALL the data, and proxies errors,
    +    // but then pipe from the original tarball stream into the cache as well.
    +    // To do this without losing any data, and since the cacache put stream
    +    // is not a passthrough, we have to pipe from the original stream into
    +    // the cache AFTER we pipe into the middleStream.  Since the cache stream
    +    // has an asynchronous flush to write its contents to disk, we need to
    +    // defer the middleStream end until the cache stream ends.
    +    const middleStream = new Minipass()
    +    stream.on('error', err => middleStream.emit('error', err))
    +    stream.pipe(middleStream, { end: false })
    +    const cstream = cacache.put.stream(
    +      this.opts.cache,
    +      `pacote:tarball:${this.from}`,
    +      this.opts
    +    )
    +    cstream.on('integrity', i => this.integrity = i)
    +    cstream.on('error', err => stream.emit('error', err))
    +    stream.pipe(cstream)
    +
    +    // eslint-disable-next-line promise/catch-or-return
    +    cstream.promise().catch(() => {}).then(() => middleStream.end())
    +    return middleStream
    +  }
    +
    +  pickIntegrityAlgorithm () {
    +    return this.integrity ? this.integrity.pickAlgorithm(this.opts)
    +      : this.defaultIntegrityAlgorithm
    +  }
    +
    +  // TODO: check error class, once those are rolled out to our deps
    +  isDataCorruptionError (er) {
    +    return er.code === 'EINTEGRITY' || er.code === 'Z_DATA_ERROR'
    +  }
    +
    +  // override the types getter
    +  get types () {
    +    return false
    +  }
    +
    +  #assertType () {
    +    if (this.types && !this.types.includes(this.spec.type)) {
    +      throw new TypeError(`Wrong spec type (${
    +        this.spec.type
    +      }) for ${
    +        this.constructor.name
    +      }. Supported types: ${this.types.join(', ')}`)
    +    }
    +  }
    +
    +  // We allow ENOENTs from cacache, but not anywhere else.
    +  // An ENOENT trying to read a tgz file, for example, is Right Out.
    +  isRetriableError (er) {
    +    // TODO: check error class, once those are rolled out to our deps
    +    return this.isDataCorruptionError(er) ||
    +      er.code === 'ENOENT' ||
    +      er.code === 'EISDIR'
    +  }
    +
    +  // Mostly internal, but has some uses
    +  // Pass in a function which returns a promise
    +  // Function will be called 1 or more times with streams that may fail.
    +  // Retries:
    +  // Function MUST handle errors on the stream by rejecting the promise,
    +  // so that retry logic can pick it up and either retry or fail whatever
    +  // promise it was making (ie, failing extraction, etc.)
    +  //
    +  // The return value of this method is a Promise that resolves the same
    +  // as whatever the streamHandler resolves to.
    +  //
    +  // This should never be overridden by child classes, but it is public.
    +  tarballStream (streamHandler) {
    +    // Only short-circuit via cache if we have everything else we'll need,
    +    // and the user has not expressed a preference for checking online.
    +
    +    const fromCache = (
    +      !this.preferOnline &&
    +      this.integrity &&
    +      this.resolved
    +    ) ? streamHandler(this.#tarballFromCache()).catch(er => {
    +        if (this.isDataCorruptionError(er)) {
    +          log.warn('tarball', `cached data for ${
    +          this.spec
    +        } (${this.integrity}) seems to be corrupted. Refreshing cache.`)
    +          return this.cleanupCached().then(() => {
    +            throw er
    +          })
    +        } else {
    +          throw er
    +        }
    +      }) : null
    +
    +    const fromResolved = er => {
    +      if (er) {
    +        if (!this.isRetriableError(er)) {
    +          throw er
    +        }
    +        log.silly('tarball', `no local data for ${
    +          this.spec
    +        }. Extracting by manifest.`)
    +      }
    +      return this.resolve().then(() => retry(tryAgain =>
    +        streamHandler(this.#istream(this[_.tarballFromResolved]()))
    +          .catch(streamErr => {
    +          // Most likely data integrity.  A cache ENOENT error is unlikely
    +          // here, since we're definitely not reading from the cache, but it
    +          // IS possible that the fetch subsystem accessed the cache, and the
    +          // entry got blown away or something.  Try one more time to be sure.
    +            if (this.isRetriableError(streamErr)) {
    +              log.warn('tarball', `tarball data for ${
    +              this.spec
    +            } (${this.integrity}) seems to be corrupted. Trying again.`)
    +              return this.cleanupCached().then(() => tryAgain(streamErr))
    +            }
    +            throw streamErr
    +          }), { retries: 1, minTimeout: 0, maxTimeout: 0 }))
    +    }
    +
    +    return fromCache ? fromCache.catch(fromResolved) : fromResolved()
    +  }
    +
    +  cleanupCached () {
    +    return cacache.rm.content(this.cache, this.integrity, this.opts)
    +  }
    +
    +  #empty (path) {
    +    return getContents({ path, depth: 1 }).then(contents => Promise.all(
    +      contents.map(entry => rm(entry, { recursive: true, force: true }))))
    +  }
    +
    +  async #mkdir (dest) {
    +    await this.#empty(dest)
    +    return await mkdir(dest, { recursive: true })
    +  }
    +
    +  // extraction is always the same.  the only difference is where
    +  // the tarball comes from.
    +  async extract (dest) {
    +    await this.#mkdir(dest)
    +    return this.tarballStream((tarball) => this.#extract(dest, tarball))
    +  }
    +
    +  #toFile (dest) {
    +    return this.tarballStream(str => new Promise((res, rej) => {
    +      const writer = new fsm.WriteStream(dest)
    +      str.on('error', er => writer.emit('error', er))
    +      writer.on('error', er => rej(er))
    +      writer.on('close', () => res({
    +        integrity: this.integrity && String(this.integrity),
    +        resolved: this.resolved,
    +        from: this.from,
    +      }))
    +      str.pipe(writer)
    +    }))
    +  }
    +
    +  // don't use this.#mkdir because we don't want to rimraf anything
    +  async tarballFile (dest) {
    +    const dir = dirname(dest)
    +    await mkdir(dir, { recursive: true })
    +    return this.#toFile(dest)
    +  }
    +
    +  #extract (dest, tarball) {
    +    const extractor = tar.x(this.#tarxOptions({ cwd: dest }))
    +    const p = new Promise((resolve, reject) => {
    +      extractor.on('end', () => {
    +        resolve({
    +          resolved: this.resolved,
    +          integrity: this.integrity && String(this.integrity),
    +          from: this.from,
    +        })
    +      })
    +
    +      extractor.on('error', er => {
    +        log.warn('tar', er.message)
    +        log.silly('tar', er)
    +        reject(er)
    +      })
    +
    +      tarball.on('error', er => reject(er))
    +    })
    +
    +    tarball.pipe(extractor)
    +    return p
    +  }
    +
    +  // always ensure that entries are at least as permissive as our configured
    +  // dmode/fmode, but never more permissive than the umask allows.
    +  #entryMode (path, mode, type) {
    +    const m = /Directory|GNUDumpDir/.test(type) ? this.dmode
    +      : /File$/.test(type) ? this.fmode
    +      : /* istanbul ignore next - should never happen in a pkg */ 0
    +
    +    // make sure package bins are executable
    +    const exe = isPackageBin(this.package, path) ? 0o111 : 0
    +    // always ensure that files are read/writable by the owner
    +    return ((mode | m) & ~this.umask) | exe | 0o600
    +  }
    +
    +  #tarxOptions ({ cwd }) {
    +    const sawIgnores = new Set()
    +    return {
    +      cwd,
    +      noChmod: true,
    +      noMtime: true,
    +      filter: (name, entry) => {
    +        if (/Link$/.test(entry.type)) {
    +          return false
    +        }
    +        entry.mode = this.#entryMode(entry.path, entry.mode, entry.type)
    +        // this replicates the npm pack behavior where .gitignore files
    +        // are treated like .npmignore files, but only if a .npmignore
    +        // file is not present.
    +        if (/File$/.test(entry.type)) {
    +          const base = basename(entry.path)
    +          if (base === '.npmignore') {
    +            sawIgnores.add(entry.path)
    +          } else if (base === '.gitignore' && !this.allowGitIgnore) {
    +            // rename, but only if there's not already a .npmignore
    +            const ni = entry.path.replace(/\.gitignore$/, '.npmignore')
    +            if (sawIgnores.has(ni)) {
    +              return false
    +            }
    +            entry.path = ni
    +          }
    +          return true
    +        }
    +      },
    +      strip: 1,
    +      onwarn: /* istanbul ignore next - we can trust that tar logs */
    +      (code, msg, data) => {
    +        log.warn('tar', code, msg)
    +        log.silly('tar', code, msg, data)
    +      },
    +      umask: this.umask,
    +      // always ignore ownership info from tarball metadata
    +      preserveOwner: false,
    +    }
    +  }
    +}
    +
    +module.exports = FetcherBase
    +
    +// Child classes
    +const GitFetcher = require('./git.js')
    +const RegistryFetcher = require('./registry.js')
    +const FileFetcher = require('./file.js')
    +const DirFetcher = require('./dir.js')
    +const RemoteFetcher = require('./remote.js')
    +
    +// Get an appropriate fetcher object from a spec and options
    +FetcherBase.get = (rawSpec, opts = {}) => {
    +  const spec = npa(rawSpec, opts.where)
    +  switch (spec.type) {
    +    case 'git':
    +      return new GitFetcher(spec, opts)
    +
    +    case 'remote':
    +      return new RemoteFetcher(spec, opts)
    +
    +    case 'version':
    +    case 'range':
    +    case 'tag':
    +    case 'alias':
    +      return new RegistryFetcher(spec.subSpec || spec, opts)
    +
    +    case 'file':
    +      return new FileFetcher(spec, opts)
    +
    +    case 'directory':
    +      return new DirFetcher(spec, opts)
    +
    +    default:
    +      throw new TypeError('Unknown spec type: ' + spec.type)
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/pacote/lib/file.js b/node_modules/npm/node_modules/pacote/lib/file.js
    new file mode 100644
    index 00000000..20213250
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/file.js
    @@ -0,0 +1,94 @@
    +const { resolve } = require('node:path')
    +const { stat, chmod } = require('node:fs/promises')
    +const cacache = require('cacache')
    +const fsm = require('fs-minipass')
    +const Fetcher = require('./fetcher.js')
    +const _ = require('./util/protected.js')
    +
    +class FileFetcher extends Fetcher {
    +  constructor (spec, opts) {
    +    super(spec, opts)
    +    // just the fully resolved filename
    +    this.resolved = this.spec.fetchSpec
    +  }
    +
    +  get types () {
    +    return ['file']
    +  }
    +
    +  manifest () {
    +    if (this.package) {
    +      return Promise.resolve(this.package)
    +    }
    +
    +    // have to unpack the tarball for this.
    +    return cacache.tmp.withTmp(this.cache, this.opts, dir =>
    +      this.extract(dir)
    +        .then(() => this[_.readPackageJson](dir))
    +        .then(mani => this.package = {
    +          ...mani,
    +          _integrity: this.integrity && String(this.integrity),
    +          _resolved: this.resolved,
    +          _from: this.from,
    +        }))
    +  }
    +
    +  #exeBins (pkg, dest) {
    +    if (!pkg.bin) {
    +      return Promise.resolve()
    +    }
    +
    +    return Promise.all(Object.keys(pkg.bin).map(async k => {
    +      const script = resolve(dest, pkg.bin[k])
    +      // Best effort.  Ignore errors here, the only result is that
    +      // a bin script is not executable.  But if it's missing or
    +      // something, we just leave it for a later stage to trip over
    +      // when we can provide a more useful contextual error.
    +      try {
    +        const st = await stat(script)
    +        const mode = st.mode | 0o111
    +        if (mode === st.mode) {
    +          return
    +        }
    +        await chmod(script, mode)
    +      } catch {
    +        // Ignore errors here
    +      }
    +    }))
    +  }
    +
    +  extract (dest) {
    +    // if we've already loaded the manifest, then the super got it.
    +    // but if not, read the unpacked manifest and chmod properly.
    +    return super.extract(dest)
    +      .then(result => this.package ? result
    +      : this[_.readPackageJson](dest).then(pkg =>
    +        this.#exeBins(pkg, dest)).then(() => result))
    +  }
    +
    +  [_.tarballFromResolved] () {
    +    // create a read stream and return it
    +    return new fsm.ReadStream(this.resolved)
    +  }
    +
    +  packument () {
    +    // simulate based on manifest
    +    return this.manifest().then(mani => ({
    +      name: mani.name,
    +      'dist-tags': {
    +        [this.defaultTag]: mani.version,
    +      },
    +      versions: {
    +        [mani.version]: {
    +          ...mani,
    +          dist: {
    +            tarball: `file:${this.resolved}`,
    +            integrity: this.integrity && String(this.integrity),
    +          },
    +        },
    +      },
    +    }))
    +  }
    +}
    +
    +module.exports = FileFetcher
    diff --git a/node_modules/npm/node_modules/pacote/lib/git.js b/node_modules/npm/node_modules/pacote/lib/git.js
    new file mode 100644
    index 00000000..077193a8
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/git.js
    @@ -0,0 +1,317 @@
    +const cacache = require('cacache')
    +const git = require('@npmcli/git')
    +const npa = require('npm-package-arg')
    +const pickManifest = require('npm-pick-manifest')
    +const { Minipass } = require('minipass')
    +const { log } = require('proc-log')
    +const DirFetcher = require('./dir.js')
    +const Fetcher = require('./fetcher.js')
    +const FileFetcher = require('./file.js')
    +const RemoteFetcher = require('./remote.js')
    +const _ = require('./util/protected.js')
    +const addGitSha = require('./util/add-git-sha.js')
    +const npm = require('./util/npm.js')
    +
    +const hashre = /^[a-f0-9]{40}$/
    +
    +// get the repository url.
    +// prefer https if there's auth, since ssh will drop that.
    +// otherwise, prefer ssh if available (more secure).
    +// We have to add the git+ back because npa suppresses it.
    +const repoUrl = (h, opts) =>
    +  h.sshurl && !(h.https && h.auth) && addGitPlus(h.sshurl(opts)) ||
    +  h.https && addGitPlus(h.https(opts))
    +
    +// add git+ to the url, but only one time.
    +const addGitPlus = url => url && `git+${url}`.replace(/^(git\+)+/, 'git+')
    +
    +class GitFetcher extends Fetcher {
    +  constructor (spec, opts) {
    +    super(spec, opts)
    +
    +    // we never want to compare integrity for git dependencies: npm/rfcs#525
    +    if (this.opts.integrity) {
    +      delete this.opts.integrity
    +      log.warn(`skipping integrity check for git dependency ${this.spec.fetchSpec}`)
    +    }
    +
    +    this.resolvedRef = null
    +    if (this.spec.hosted) {
    +      this.from = this.spec.hosted.shortcut({ noCommittish: false })
    +    }
    +
    +    // shortcut: avoid full clone when we can go straight to the tgz
    +    // if we have the full sha and it's a hosted git platform
    +    if (this.spec.gitCommittish && hashre.test(this.spec.gitCommittish)) {
    +      this.resolvedSha = this.spec.gitCommittish
    +      // use hosted.tarball() when we shell to RemoteFetcher later
    +      this.resolved = this.spec.hosted
    +        ? repoUrl(this.spec.hosted, { noCommittish: false })
    +        : this.spec.rawSpec
    +    } else {
    +      this.resolvedSha = ''
    +    }
    +
    +    this.Arborist = opts.Arborist || null
    +  }
    +
    +  // just exposed to make it easier to test all the combinations
    +  static repoUrl (hosted, opts) {
    +    return repoUrl(hosted, opts)
    +  }
    +
    +  get types () {
    +    return ['git']
    +  }
    +
    +  resolve () {
    +    // likely a hosted git repo with a sha, so get the tarball url
    +    // but in general, no reason to resolve() more than necessary!
    +    if (this.resolved) {
    +      return super.resolve()
    +    }
    +
    +    // fetch the git repo and then look at the current hash
    +    const h = this.spec.hosted
    +    // try to use ssh, fall back to git.
    +    return h
    +      ? this.#resolvedFromHosted(h)
    +      : this.#resolvedFromRepo(this.spec.fetchSpec)
    +  }
    +
    +  // first try https, since that's faster and passphrase-less for
    +  // public repos, and supports private repos when auth is provided.
    +  // Fall back to SSH to support private repos
    +  // NB: we always store the https url in resolved field if auth
    +  // is present, otherwise ssh if the hosted type provides it
    +  #resolvedFromHosted (hosted) {
    +    return this.#resolvedFromRepo(hosted.https && hosted.https()).catch(er => {
    +      // Throw early since we know pathspec errors will fail again if retried
    +      if (er instanceof git.errors.GitPathspecError) {
    +        throw er
    +      }
    +      const ssh = hosted.sshurl && hosted.sshurl()
    +      // no fallthrough if we can't fall through or have https auth
    +      if (!ssh || hosted.auth) {
    +        throw er
    +      }
    +      return this.#resolvedFromRepo(ssh)
    +    })
    +  }
    +
    +  #resolvedFromRepo (gitRemote) {
    +    // XXX make this a custom error class
    +    if (!gitRemote) {
    +      return Promise.reject(new Error(`No git url for ${this.spec}`))
    +    }
    +    const gitRange = this.spec.gitRange
    +    const name = this.spec.name
    +    return git.revs(gitRemote, this.opts).then(remoteRefs => {
    +      return gitRange ? pickManifest({
    +        versions: remoteRefs.versions,
    +        'dist-tags': remoteRefs['dist-tags'],
    +        name,
    +      }, gitRange, this.opts)
    +        : this.spec.gitCommittish ?
    +          remoteRefs.refs[this.spec.gitCommittish] ||
    +          remoteRefs.refs[remoteRefs.shas[this.spec.gitCommittish]]
    +          : remoteRefs.refs.HEAD // no git committish, get default head
    +    }).then(revDoc => {
    +      // the committish provided isn't in the rev list
    +      // things like HEAD~3 or @yesterday can land here.
    +      if (!revDoc || !revDoc.sha) {
    +        return this.#resolvedFromClone()
    +      }
    +
    +      this.resolvedRef = revDoc
    +      this.resolvedSha = revDoc.sha
    +      this.#addGitSha(revDoc.sha)
    +      return this.resolved
    +    })
    +  }
    +
    +  #setResolvedWithSha (withSha) {
    +    // we haven't cloned, so a tgz download is still faster
    +    // of course, if it's not a known host, we can't do that.
    +    this.resolved = !this.spec.hosted ? withSha
    +      : repoUrl(npa(withSha).hosted, { noCommittish: false })
    +  }
    +
    +  // when we get the git sha, we affix it to our spec to build up
    +  // either a git url with a hash, or a tarball download URL
    +  #addGitSha (sha) {
    +    this.#setResolvedWithSha(addGitSha(this.spec, sha))
    +  }
    +
    +  #resolvedFromClone () {
    +    // do a full or shallow clone, then look at the HEAD
    +    // kind of wasteful, but no other option, really
    +    return this.#clone(() => this.resolved)
    +  }
    +
    +  #prepareDir (dir) {
    +    return this[_.readPackageJson](dir).then(mani => {
    +      // no need if we aren't going to do any preparation.
    +      const scripts = mani.scripts
    +      if (!mani.workspaces && (!scripts || !(
    +        scripts.postinstall ||
    +          scripts.build ||
    +          scripts.preinstall ||
    +          scripts.install ||
    +          scripts.prepack ||
    +          scripts.prepare))) {
    +        return
    +      }
    +
    +      // to avoid cases where we have an cycle of git deps that depend
    +      // on one another, we only ever do preparation for one instance
    +      // of a given git dep along the chain of installations.
    +      // Note that this does mean that a dependency MAY in theory end up
    +      // trying to run its prepare script using a dependency that has not
    +      // been properly prepared itself, but that edge case is smaller
    +      // and less hazardous than a fork bomb of npm and git commands.
    +      const noPrepare = !process.env._PACOTE_NO_PREPARE_ ? []
    +        : process.env._PACOTE_NO_PREPARE_.split('\n')
    +      if (noPrepare.includes(this.resolved)) {
    +        log.info('prepare', 'skip prepare, already seen', this.resolved)
    +        return
    +      }
    +      noPrepare.push(this.resolved)
    +
    +      // the DirFetcher will do its own preparation to run the prepare scripts
    +      // All we have to do is put the deps in place so that it can succeed.
    +      return npm(
    +        this.npmBin,
    +        [].concat(this.npmInstallCmd).concat(this.npmCliConfig),
    +        dir,
    +        { ...process.env, _PACOTE_NO_PREPARE_: noPrepare.join('\n') },
    +        { message: 'git dep preparation failed' }
    +      )
    +    })
    +  }
    +
    +  [_.tarballFromResolved] () {
    +    const stream = new Minipass()
    +    stream.resolved = this.resolved
    +    stream.from = this.from
    +
    +    // check it out and then shell out to the DirFetcher tarball packer
    +    this.#clone(dir => this.#prepareDir(dir)
    +      .then(() => new Promise((res, rej) => {
    +        if (!this.Arborist) {
    +          throw new Error('GitFetcher requires an Arborist constructor to pack a tarball')
    +        }
    +        const df = new DirFetcher(`file:${dir}`, {
    +          ...this.opts,
    +          Arborist: this.Arborist,
    +          resolved: null,
    +          integrity: null,
    +        })
    +        const dirStream = df[_.tarballFromResolved]()
    +        dirStream.on('error', rej)
    +        dirStream.on('end', res)
    +        dirStream.pipe(stream)
    +      }))).catch(
    +      /* istanbul ignore next: very unlikely and hard to test */
    +      er => stream.emit('error', er)
    +    )
    +    return stream
    +  }
    +
    +  // clone a git repo into a temp folder (or fetch and unpack if possible)
    +  // handler accepts a directory, and returns a promise that resolves
    +  // when we're done with it, at which point, cacache deletes it
    +  //
    +  // TODO: after cloning, create a tarball of the folder, and add to the cache
    +  // with cacache.put.stream(), using a key that's deterministic based on the
    +  // spec and repo, so that we don't ever clone the same thing multiple times.
    +  #clone (handler, tarballOk = true) {
    +    const o = { tmpPrefix: 'git-clone' }
    +    const ref = this.resolvedSha || this.spec.gitCommittish
    +    const h = this.spec.hosted
    +    const resolved = this.resolved
    +
    +    // can be set manually to false to fall back to actual git clone
    +    tarballOk = tarballOk &&
    +      h && resolved === repoUrl(h, { noCommittish: false }) && h.tarball
    +
    +    return cacache.tmp.withTmp(this.cache, o, async tmp => {
    +      // if we're resolved, and have a tarball url, shell out to RemoteFetcher
    +      if (tarballOk) {
    +        const nameat = this.spec.name ? `${this.spec.name}@` : ''
    +        return new RemoteFetcher(h.tarball({ noCommittish: false }), {
    +          ...this.opts,
    +          allowGitIgnore: true,
    +          pkgid: `git:${nameat}${this.resolved}`,
    +          resolved: this.resolved,
    +          integrity: null, // it'll always be different, if we have one
    +        }).extract(tmp).then(() => handler(tmp), er => {
    +          // fall back to ssh download if tarball fails
    +          if (er.constructor.name.match(/^Http/)) {
    +            return this.#clone(handler, false)
    +          } else {
    +            throw er
    +          }
    +        })
    +      }
    +
    +      const sha = await (
    +        h ? this.#cloneHosted(ref, tmp)
    +        : this.#cloneRepo(this.spec.fetchSpec, ref, tmp)
    +      )
    +      this.resolvedSha = sha
    +      if (!this.resolved) {
    +        await this.#addGitSha(sha)
    +      }
    +      return handler(tmp)
    +    })
    +  }
    +
    +  // first try https, since that's faster and passphrase-less for
    +  // public repos, and supports private repos when auth is provided.
    +  // Fall back to SSH to support private repos
    +  // NB: we always store the https url in resolved field if auth
    +  // is present, otherwise ssh if the hosted type provides it
    +  #cloneHosted (ref, tmp) {
    +    const hosted = this.spec.hosted
    +    return this.#cloneRepo(hosted.https({ noCommittish: true }), ref, tmp)
    +      .catch(er => {
    +        // Throw early since we know pathspec errors will fail again if retried
    +        if (er instanceof git.errors.GitPathspecError) {
    +          throw er
    +        }
    +        const ssh = hosted.sshurl && hosted.sshurl({ noCommittish: true })
    +        // no fallthrough if we can't fall through or have https auth
    +        if (!ssh || hosted.auth) {
    +          throw er
    +        }
    +        return this.#cloneRepo(ssh, ref, tmp)
    +      })
    +  }
    +
    +  #cloneRepo (repo, ref, tmp) {
    +    const { opts, spec } = this
    +    return git.clone(repo, ref, tmp, { ...opts, spec })
    +  }
    +
    +  manifest () {
    +    if (this.package) {
    +      return Promise.resolve(this.package)
    +    }
    +
    +    return this.spec.hosted && this.resolved
    +      ? FileFetcher.prototype.manifest.apply(this)
    +      : this.#clone(dir =>
    +        this[_.readPackageJson](dir)
    +          .then(mani => this.package = {
    +            ...mani,
    +            _resolved: this.resolved,
    +            _from: this.from,
    +          }))
    +  }
    +
    +  packument () {
    +    return FileFetcher.prototype.packument.apply(this)
    +  }
    +}
    +module.exports = GitFetcher
    diff --git a/node_modules/npm/node_modules/pacote/lib/index.js b/node_modules/npm/node_modules/pacote/lib/index.js
    new file mode 100644
    index 00000000..f35314d2
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/index.js
    @@ -0,0 +1,23 @@
    +const { get } = require('./fetcher.js')
    +const GitFetcher = require('./git.js')
    +const RegistryFetcher = require('./registry.js')
    +const FileFetcher = require('./file.js')
    +const DirFetcher = require('./dir.js')
    +const RemoteFetcher = require('./remote.js')
    +
    +const tarball = (spec, opts) => get(spec, opts).tarball()
    +tarball.stream = (spec, handler, opts) => get(spec, opts).tarballStream(handler)
    +tarball.file = (spec, dest, opts) => get(spec, opts).tarballFile(dest)
    +
    +module.exports = {
    +  GitFetcher,
    +  RegistryFetcher,
    +  FileFetcher,
    +  DirFetcher,
    +  RemoteFetcher,
    +  resolve: (spec, opts) => get(spec, opts).resolve(),
    +  extract: (spec, dest, opts) => get(spec, opts).extract(dest),
    +  manifest: (spec, opts) => get(spec, opts).manifest(),
    +  packument: (spec, opts) => get(spec, opts).packument(),
    +  tarball,
    +}
    diff --git a/node_modules/npm/node_modules/pacote/lib/registry.js b/node_modules/npm/node_modules/pacote/lib/registry.js
    new file mode 100644
    index 00000000..1ecf4ee1
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/registry.js
    @@ -0,0 +1,369 @@
    +const crypto = require('node:crypto')
    +const PackageJson = require('@npmcli/package-json')
    +const pickManifest = require('npm-pick-manifest')
    +const ssri = require('ssri')
    +const npa = require('npm-package-arg')
    +const sigstore = require('sigstore')
    +const fetch = require('npm-registry-fetch')
    +const Fetcher = require('./fetcher.js')
    +const RemoteFetcher = require('./remote.js')
    +const pacoteVersion = require('../package.json').version
    +const removeTrailingSlashes = require('./util/trailing-slashes.js')
    +const _ = require('./util/protected.js')
    +
    +// Corgis are cute. 🐕🐶
    +const corgiDoc = 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*'
    +const fullDoc = 'application/json'
    +
    +// Some really old packages have no time field in their packument so we need a
    +// cutoff date.
    +const MISSING_TIME_CUTOFF = '2015-01-01T00:00:00.000Z'
    +
    +class RegistryFetcher extends Fetcher {
    +  #cacheKey
    +  constructor (spec, opts) {
    +    super(spec, opts)
    +
    +    // you usually don't want to fetch the same packument multiple times in
    +    // the span of a given script or command, no matter how many pacote calls
    +    // are made, so this lets us avoid doing that.  It's only relevant for
    +    // registry fetchers, because other types simulate their packument from
    +    // the manifest, which they memoize on this.package, so it's very cheap
    +    // already.
    +    this.packumentCache = this.opts.packumentCache || null
    +
    +    this.registry = fetch.pickRegistry(spec, opts)
    +    this.packumentUrl = `${removeTrailingSlashes(this.registry)}/${this.spec.escapedName}`
    +    this.#cacheKey = `${this.fullMetadata ? 'full' : 'corgi'}:${this.packumentUrl}`
    +
    +    const parsed = new URL(this.registry)
    +    const regKey = `//${parsed.host}${parsed.pathname}`
    +    // unlike the nerf-darted auth keys, this one does *not* allow a mismatch
    +    // of trailing slashes.  It must match exactly.
    +    if (this.opts[`${regKey}:_keys`]) {
    +      this.registryKeys = this.opts[`${regKey}:_keys`]
    +    }
    +
    +    // XXX pacote <=9 has some logic to ignore opts.resolved if
    +    // the resolved URL doesn't go to the same registry.
    +    // Consider reproducing that here, to throw away this.resolved
    +    // in that case.
    +  }
    +
    +  async resolve () {
    +    // fetching the manifest sets resolved and (if present) integrity
    +    await this.manifest()
    +    if (!this.resolved) {
    +      throw Object.assign(
    +        new Error('Invalid package manifest: no `dist.tarball` field'),
    +        { package: this.spec.toString() }
    +      )
    +    }
    +    return this.resolved
    +  }
    +
    +  #headers () {
    +    return {
    +      // npm will override UA, but ensure that we always send *something*
    +      'user-agent': this.opts.userAgent ||
    +        `pacote/${pacoteVersion} node/${process.version}`,
    +      ...(this.opts.headers || {}),
    +      'pacote-version': pacoteVersion,
    +      'pacote-req-type': 'packument',
    +      'pacote-pkg-id': `registry:${this.spec.name}`,
    +      accept: this.fullMetadata ? fullDoc : corgiDoc,
    +    }
    +  }
    +
    +  async packument () {
    +    // note this might be either an in-flight promise for a request,
    +    // or the actual packument, but we never want to make more than
    +    // one request at a time for the same thing regardless.
    +    if (this.packumentCache?.has(this.#cacheKey)) {
    +      return this.packumentCache.get(this.#cacheKey)
    +    }
    +
    +    // npm-registry-fetch the packument
    +    // set the appropriate header for corgis if fullMetadata isn't set
    +    // return the res.json() promise
    +    try {
    +      const res = await fetch(this.packumentUrl, {
    +        ...this.opts,
    +        headers: this.#headers(),
    +        spec: this.spec,
    +
    +        // never check integrity for packuments themselves
    +        integrity: null,
    +      })
    +      const packument = await res.json()
    +      const contentLength = res.headers.get('content-length')
    +      if (contentLength) {
    +        packument._contentLength = Number(contentLength)
    +      }
    +      this.packumentCache?.set(this.#cacheKey, packument)
    +      return packument
    +    } catch (err) {
    +      this.packumentCache?.delete(this.#cacheKey)
    +      if (err.code !== 'E404' || this.fullMetadata) {
    +        throw err
    +      }
    +      // possible that corgis are not supported by this registry
    +      this.fullMetadata = true
    +      return this.packument()
    +    }
    +  }
    +
    +  async manifest () {
    +    if (this.package) {
    +      return this.package
    +    }
    +
    +    // When verifying signatures, we need to fetch the full/uncompressed
    +    // packument to get publish time as this is not included in the
    +    // corgi/compressed packument.
    +    if (this.opts.verifySignatures) {
    +      this.fullMetadata = true
    +    }
    +
    +    const packument = await this.packument()
    +    const steps = PackageJson.normalizeSteps.filter(s => s !== '_attributes')
    +    const mani = await new PackageJson().fromContent(pickManifest(packument, this.spec.fetchSpec, {
    +      ...this.opts,
    +      defaultTag: this.defaultTag,
    +      before: this.before,
    +    })).normalize({ steps }).then(p => p.content)
    +
    +    /* XXX add ETARGET and E403 revalidation of cached packuments here */
    +
    +    // add _time from packument if fetched with fullMetadata
    +    const time = packument.time?.[mani.version]
    +    if (time) {
    +      mani._time = time
    +    }
    +
    +    // add _resolved and _integrity from dist object
    +    const { dist } = mani
    +    if (dist) {
    +      this.resolved = mani._resolved = dist.tarball
    +      mani._from = this.from
    +      const distIntegrity = dist.integrity ? ssri.parse(dist.integrity)
    +        : dist.shasum ? ssri.fromHex(dist.shasum, 'sha1', { ...this.opts })
    +        : null
    +      if (distIntegrity) {
    +        if (this.integrity && !this.integrity.match(distIntegrity)) {
    +          // only bork if they have algos in common.
    +          // otherwise we end up breaking if we have saved a sha512
    +          // previously for the tarball, but the manifest only
    +          // provides a sha1, which is possible for older publishes.
    +          // Otherwise, this is almost certainly a case of holding it
    +          // wrong, and will result in weird or insecure behavior
    +          // later on when building package tree.
    +          for (const algo of Object.keys(this.integrity)) {
    +            if (distIntegrity[algo]) {
    +              throw Object.assign(new Error(
    +                `Integrity checksum failed when using ${algo}: ` +
    +                `wanted ${this.integrity} but got ${distIntegrity}.`
    +              ), { code: 'EINTEGRITY' })
    +            }
    +          }
    +        }
    +        // made it this far, the integrity is worthwhile.  accept it.
    +        // the setter here will take care of merging it into what we already
    +        // had.
    +        this.integrity = distIntegrity
    +      }
    +    }
    +    if (this.integrity) {
    +      mani._integrity = String(this.integrity)
    +      if (dist.signatures) {
    +        if (this.opts.verifySignatures) {
    +          // validate and throw on error, then set _signatures
    +          const message = `${mani._id}:${mani._integrity}`
    +          for (const signature of dist.signatures) {
    +            const publicKey = this.registryKeys &&
    +              this.registryKeys.filter(key => (key.keyid === signature.keyid))[0]
    +            if (!publicKey) {
    +              throw Object.assign(new Error(
    +                  `${mani._id} has a registry signature with keyid: ${signature.keyid} ` +
    +                  'but no corresponding public key can be found'
    +              ), { code: 'EMISSINGSIGNATUREKEY' })
    +            }
    +
    +            const publishedTime = Date.parse(mani._time || MISSING_TIME_CUTOFF)
    +            const validPublicKey = !publicKey.expires ||
    +              publishedTime < Date.parse(publicKey.expires)
    +            if (!validPublicKey) {
    +              throw Object.assign(new Error(
    +                  `${mani._id} has a registry signature with keyid: ${signature.keyid} ` +
    +                  `but the corresponding public key has expired ${publicKey.expires}`
    +              ), { code: 'EEXPIREDSIGNATUREKEY' })
    +            }
    +            const verifier = crypto.createVerify('SHA256')
    +            verifier.write(message)
    +            verifier.end()
    +            const valid = verifier.verify(
    +              publicKey.pemkey,
    +              signature.sig,
    +              'base64'
    +            )
    +            if (!valid) {
    +              throw Object.assign(new Error(
    +                  `${mani._id} has an invalid registry signature with ` +
    +                  `keyid: ${publicKey.keyid} and signature: ${signature.sig}`
    +              ), {
    +                code: 'EINTEGRITYSIGNATURE',
    +                keyid: publicKey.keyid,
    +                signature: signature.sig,
    +                resolved: mani._resolved,
    +                integrity: mani._integrity,
    +              })
    +            }
    +          }
    +          mani._signatures = dist.signatures
    +        } else {
    +          mani._signatures = dist.signatures
    +        }
    +      }
    +
    +      if (dist.attestations) {
    +        if (this.opts.verifyAttestations) {
    +          // Always fetch attestations from the current registry host
    +          const attestationsPath = new URL(dist.attestations.url).pathname
    +          const attestationsUrl = removeTrailingSlashes(this.registry) + attestationsPath
    +          const res = await fetch(attestationsUrl, {
    +            ...this.opts,
    +            // disable integrity check for attestations json payload, we check the
    +            // integrity in the verification steps below
    +            integrity: null,
    +          })
    +          const { attestations } = await res.json()
    +          const bundles = attestations.map(({ predicateType, bundle }) => {
    +            const statement = JSON.parse(
    +              Buffer.from(bundle.dsseEnvelope.payload, 'base64').toString('utf8')
    +            )
    +            const keyid = bundle.dsseEnvelope.signatures[0].keyid
    +            const signature = bundle.dsseEnvelope.signatures[0].sig
    +
    +            return {
    +              predicateType,
    +              bundle,
    +              statement,
    +              keyid,
    +              signature,
    +            }
    +          })
    +
    +          const attestationKeyIds = bundles.map((b) => b.keyid).filter((k) => !!k)
    +          const attestationRegistryKeys = (this.registryKeys || [])
    +            .filter(key => attestationKeyIds.includes(key.keyid))
    +          if (!attestationRegistryKeys.length) {
    +            throw Object.assign(new Error(
    +              `${mani._id} has attestations but no corresponding public key(s) can be found`
    +            ), { code: 'EMISSINGSIGNATUREKEY' })
    +          }
    +
    +          for (const { predicateType, bundle, keyid, signature, statement } of bundles) {
    +            const publicKey = attestationRegistryKeys.find(key => key.keyid === keyid)
    +            // Publish attestations have a keyid set and a valid public key must be found
    +            if (keyid) {
    +              if (!publicKey) {
    +                throw Object.assign(new Error(
    +                  `${mani._id} has attestations with keyid: ${keyid} ` +
    +                  'but no corresponding public key can be found'
    +                ), { code: 'EMISSINGSIGNATUREKEY' })
    +              }
    +
    +              const integratedTime = new Date(
    +                Number(
    +                  bundle.verificationMaterial.tlogEntries[0].integratedTime
    +                ) * 1000
    +              )
    +              const validPublicKey = !publicKey.expires ||
    +                (integratedTime < Date.parse(publicKey.expires))
    +              if (!validPublicKey) {
    +                throw Object.assign(new Error(
    +                  `${mani._id} has attestations with keyid: ${keyid} ` +
    +                  `but the corresponding public key has expired ${publicKey.expires}`
    +                ), { code: 'EEXPIREDSIGNATUREKEY' })
    +              }
    +            }
    +
    +            const subject = {
    +              name: statement.subject[0].name,
    +              sha512: statement.subject[0].digest.sha512,
    +            }
    +
    +            // Only type 'version' can be turned into a PURL
    +            const purl = this.spec.type === 'version' ? npa.toPurl(this.spec) : this.spec
    +            // Verify the statement subject matches the package, version
    +            if (subject.name !== purl) {
    +              throw Object.assign(new Error(
    +                `${mani._id} package name and version (PURL): ${purl} ` +
    +                `doesn't match what was signed: ${subject.name}`
    +              ), { code: 'EATTESTATIONSUBJECT' })
    +            }
    +
    +            // Verify the statement subject matches the tarball integrity
    +            const integrityHexDigest = ssri.parse(this.integrity).hexDigest()
    +            if (subject.sha512 !== integrityHexDigest) {
    +              throw Object.assign(new Error(
    +                `${mani._id} package integrity (hex digest): ` +
    +                `${integrityHexDigest} ` +
    +                `doesn't match what was signed: ${subject.sha512}`
    +              ), { code: 'EATTESTATIONSUBJECT' })
    +            }
    +
    +            try {
    +              // Provenance attestations are signed with a signing certificate
    +              // (including the key) so we don't need to return a public key.
    +              //
    +              // Publish attestations are signed with a keyid so we need to
    +              // specify a public key from the keys endpoint: `registry-host.tld/-/npm/v1/keys`
    +              const options = {
    +                tufCachePath: this.tufCache,
    +                tufForceCache: true,
    +                keySelector: publicKey ? () => publicKey.pemkey : undefined,
    +              }
    +              await sigstore.verify(bundle, options)
    +            } catch (e) {
    +              throw Object.assign(new Error(
    +                `${mani._id} failed to verify attestation: ${e.message}`
    +              ), {
    +                code: 'EATTESTATIONVERIFY',
    +                predicateType,
    +                keyid,
    +                signature,
    +                resolved: mani._resolved,
    +                integrity: mani._integrity,
    +              })
    +            }
    +          }
    +          mani._attestations = dist.attestations
    +        } else {
    +          mani._attestations = dist.attestations
    +        }
    +      }
    +    }
    +
    +    this.package = mani
    +    return this.package
    +  }
    +
    +  [_.tarballFromResolved] () {
    +    // we use a RemoteFetcher to get the actual tarball stream
    +    return new RemoteFetcher(this.resolved, {
    +      ...this.opts,
    +      resolved: this.resolved,
    +      pkgid: `registry:${this.spec.name}@${this.resolved}`,
    +    })[_.tarballFromResolved]()
    +  }
    +
    +  get types () {
    +    return [
    +      'tag',
    +      'version',
    +      'range',
    +    ]
    +  }
    +}
    +module.exports = RegistryFetcher
    diff --git a/node_modules/npm/node_modules/pacote/lib/remote.js b/node_modules/npm/node_modules/pacote/lib/remote.js
    new file mode 100644
    index 00000000..bd321e65
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/remote.js
    @@ -0,0 +1,89 @@
    +const fetch = require('npm-registry-fetch')
    +const { Minipass } = require('minipass')
    +const Fetcher = require('./fetcher.js')
    +const FileFetcher = require('./file.js')
    +const _ = require('./util/protected.js')
    +const pacoteVersion = require('../package.json').version
    +
    +class RemoteFetcher extends Fetcher {
    +  constructor (spec, opts) {
    +    super(spec, opts)
    +    this.resolved = this.spec.fetchSpec
    +    const resolvedURL = new URL(this.resolved)
    +    if (this.replaceRegistryHost !== 'never'
    +      && (this.replaceRegistryHost === 'always'
    +      || this.replaceRegistryHost === resolvedURL.host)) {
    +      this.resolved = new URL(resolvedURL.pathname, this.registry).href
    +    }
    +
    +    // nam is a fermented pork sausage that is good to eat
    +    const nameat = this.spec.name ? `${this.spec.name}@` : ''
    +    this.pkgid = opts.pkgid ? opts.pkgid : `remote:${nameat}${this.resolved}`
    +  }
    +
    +  // Don't need to cache tarball fetches in pacote, because make-fetch-happen
    +  // will write into cacache anyway.
    +  get [_.cacheFetches] () {
    +    return false
    +  }
    +
    +  [_.tarballFromResolved] () {
    +    const stream = new Minipass()
    +    stream.hasIntegrityEmitter = true
    +
    +    const fetchOpts = {
    +      ...this.opts,
    +      headers: this.#headers(),
    +      spec: this.spec,
    +      integrity: this.integrity,
    +      algorithms: [this.pickIntegrityAlgorithm()],
    +    }
    +
    +    // eslint-disable-next-line promise/always-return
    +    fetch(this.resolved, fetchOpts).then(res => {
    +      res.body.on('error',
    +        /* istanbul ignore next - exceedingly rare and hard to simulate */
    +        er => stream.emit('error', er)
    +      )
    +
    +      res.body.on('integrity', i => {
    +        this.integrity = i
    +        stream.emit('integrity', i)
    +      })
    +
    +      res.body.pipe(stream)
    +    }).catch(er => stream.emit('error', er))
    +
    +    return stream
    +  }
    +
    +  #headers () {
    +    return {
    +      // npm will override this, but ensure that we always send *something*
    +      'user-agent': this.opts.userAgent ||
    +        `pacote/${pacoteVersion} node/${process.version}`,
    +      ...(this.opts.headers || {}),
    +      'pacote-version': pacoteVersion,
    +      'pacote-req-type': 'tarball',
    +      'pacote-pkg-id': this.pkgid,
    +      ...(this.integrity ? { 'pacote-integrity': String(this.integrity) }
    +      : {}),
    +      ...(this.opts.headers || {}),
    +    }
    +  }
    +
    +  get types () {
    +    return ['remote']
    +  }
    +
    +  // getting a packument and/or manifest is the same as with a file: spec.
    +  // unpack the tarball stream, and then read from the package.json file.
    +  packument () {
    +    return FileFetcher.prototype.packument.apply(this)
    +  }
    +
    +  manifest () {
    +    return FileFetcher.prototype.manifest.apply(this)
    +  }
    +}
    +module.exports = RemoteFetcher
    diff --git a/node_modules/npm/node_modules/pacote/lib/util/add-git-sha.js b/node_modules/npm/node_modules/pacote/lib/util/add-git-sha.js
    new file mode 100644
    index 00000000..843fe5b6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/util/add-git-sha.js
    @@ -0,0 +1,15 @@
    +// add a sha to a git remote url spec
    +const addGitSha = (spec, sha) => {
    +  if (spec.hosted) {
    +    const h = spec.hosted
    +    const opt = { noCommittish: true }
    +    const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt)
    +
    +    return `${base}#${sha}`
    +  } else {
    +    // don't use new URL for this, because it doesn't handle scp urls
    +    return spec.rawSpec.replace(/#.*$/, '') + `#${sha}`
    +  }
    +}
    +
    +module.exports = addGitSha
    diff --git a/node_modules/npm/node_modules/pacote/lib/util/cache-dir.js b/node_modules/npm/node_modules/pacote/lib/util/cache-dir.js
    new file mode 100644
    index 00000000..ba5683a7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/util/cache-dir.js
    @@ -0,0 +1,15 @@
    +const { resolve } = require('node:path')
    +const { tmpdir, homedir } = require('node:os')
    +
    +module.exports = (fakePlatform = false) => {
    +  const temp = tmpdir()
    +  const uidOrPid = process.getuid ? process.getuid() : process.pid
    +  const home = homedir() || resolve(temp, 'npm-' + uidOrPid)
    +  const platform = fakePlatform || process.platform
    +  const cacheExtra = platform === 'win32' ? 'npm-cache' : '.npm'
    +  const cacheRoot = (platform === 'win32' && process.env.LOCALAPPDATA) || home
    +  return {
    +    cacache: resolve(cacheRoot, cacheExtra, '_cacache'),
    +    tufcache: resolve(cacheRoot, cacheExtra, '_tuf'),
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/pacote/lib/util/is-package-bin.js b/node_modules/npm/node_modules/pacote/lib/util/is-package-bin.js
    new file mode 100644
    index 00000000..49a3f73f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/util/is-package-bin.js
    @@ -0,0 +1,25 @@
    +// Function to determine whether a path is in the package.bin set.
    +// Used to prevent issues when people publish a package from a
    +// windows machine, and then install with --no-bin-links.
    +//
    +// Note: this is not possible in remote or file fetchers, since
    +// we don't have the manifest until AFTER we've unpacked.  But the
    +// main use case is registry fetching with git a distant second,
    +// so that's an acceptable edge case to not handle.
    +
    +const binObj = (name, bin) =>
    +  typeof bin === 'string' ? { [name]: bin } : bin
    +
    +const hasBin = (pkg, path) => {
    +  const bin = binObj(pkg.name, pkg.bin)
    +  const p = path.replace(/^[^\\/]*\//, '')
    +  for (const kv of Object.entries(bin)) {
    +    if (kv[1] === p) {
    +      return true
    +    }
    +  }
    +  return false
    +}
    +
    +module.exports = (pkg, path) =>
    +  pkg && pkg.bin ? hasBin(pkg, path) : false
    diff --git a/node_modules/npm/node_modules/pacote/lib/util/npm.js b/node_modules/npm/node_modules/pacote/lib/util/npm.js
    new file mode 100644
    index 00000000..a3005c25
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/util/npm.js
    @@ -0,0 +1,14 @@
    +// run an npm command
    +const spawn = require('@npmcli/promise-spawn')
    +
    +module.exports = (npmBin, npmCommand, cwd, env, extra) => {
    +  const isJS = npmBin.endsWith('.js')
    +  const cmd = isJS ? process.execPath : npmBin
    +  const args = (isJS ? [npmBin] : []).concat(npmCommand)
    +  // when installing to run the `prepare` script for a git dep, we need
    +  // to ensure that we don't run into a cycle of checking out packages
    +  // in temp directories.  this lets us link previously-seen repos that
    +  // are also being prepared.
    +
    +  return spawn(cmd, args, { cwd, env }, extra)
    +}
    diff --git a/node_modules/npm/node_modules/pacote/lib/util/protected.js b/node_modules/npm/node_modules/pacote/lib/util/protected.js
    new file mode 100644
    index 00000000..e05203b4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/util/protected.js
    @@ -0,0 +1,5 @@
    +module.exports = {
    +  cacheFetches: Symbol.for('pacote.Fetcher._cacheFetches'),
    +  readPackageJson: Symbol.for('package.Fetcher._readPackageJson'),
    +  tarballFromResolved: Symbol.for('pacote.Fetcher._tarballFromResolved'),
    +}
    diff --git a/node_modules/npm/node_modules/pacote/lib/util/tar-create-options.js b/node_modules/npm/node_modules/pacote/lib/util/tar-create-options.js
    new file mode 100644
    index 00000000..d070f0f7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/util/tar-create-options.js
    @@ -0,0 +1,31 @@
    +const isPackageBin = require('./is-package-bin.js')
    +
    +const tarCreateOptions = manifest => ({
    +  cwd: manifest._resolved,
    +  prefix: 'package/',
    +  portable: true,
    +  gzip: {
    +    // forcing the level to 9 seems to avoid some
    +    // platform specific optimizations that cause
    +    // integrity mismatch errors due to differing
    +    // end results after compression
    +    level: 9,
    +  },
    +
    +  // ensure that package bins are always executable
    +  // Note that npm-packlist is already filtering out
    +  // anything that is not a regular file, ignored by
    +  // .npmignore or package.json "files", etc.
    +  filter: (path, stat) => {
    +    if (isPackageBin(manifest, path)) {
    +      stat.mode |= 0o111
    +    }
    +    return true
    +  },
    +
    +  // Provide a specific date in the 1980s for the benefit of zip,
    +  // which is confounded by files dated at the Unix epoch 0.
    +  mtime: new Date('1985-10-26T08:15:00.000Z'),
    +})
    +
    +module.exports = tarCreateOptions
    diff --git a/node_modules/npm/node_modules/pacote/lib/util/trailing-slashes.js b/node_modules/npm/node_modules/pacote/lib/util/trailing-slashes.js
    new file mode 100644
    index 00000000..c50cb617
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/lib/util/trailing-slashes.js
    @@ -0,0 +1,10 @@
    +const removeTrailingSlashes = (input) => {
    +  // in order to avoid regexp redos detection
    +  let output = input
    +  while (output.endsWith('/')) {
    +    output = output.slice(0, -1)
    +  }
    +  return output
    +}
    +
    +module.exports = removeTrailingSlashes
    diff --git a/node_modules/npm/node_modules/pacote/package.json b/node_modules/npm/node_modules/pacote/package.json
    new file mode 100644
    index 00000000..422be5f5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/pacote/package.json
    @@ -0,0 +1,80 @@
    +{
    +  "name": "pacote",
    +  "version": "21.0.0",
    +  "description": "JavaScript package downloader",
    +  "author": "GitHub Inc.",
    +  "bin": {
    +    "pacote": "bin/index.js"
    +  },
    +  "license": "ISC",
    +  "main": "lib/index.js",
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "lintfix": "npm run eslint -- --fix",
    +    "posttest": "npm run lint",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "tap": {
    +    "timeout": 300,
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "devDependencies": {
    +    "@npmcli/arborist": "^8.0.0",
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.4",
    +    "hosted-git-info": "^8.0.0",
    +    "mutate-fs": "^2.1.1",
    +    "nock": "^13.2.4",
    +    "npm-registry-mock": "^1.3.2",
    +    "rimraf": "^6.0.1",
    +    "tap": "^16.0.1"
    +  },
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "keywords": [
    +    "packages",
    +    "npm",
    +    "git"
    +  ],
    +  "dependencies": {
    +    "@npmcli/git": "^6.0.0",
    +    "@npmcli/installed-package-contents": "^3.0.0",
    +    "@npmcli/package-json": "^6.0.0",
    +    "@npmcli/promise-spawn": "^8.0.0",
    +    "@npmcli/run-script": "^9.0.0",
    +    "cacache": "^19.0.0",
    +    "fs-minipass": "^3.0.0",
    +    "minipass": "^7.0.2",
    +    "npm-package-arg": "^12.0.0",
    +    "npm-packlist": "^10.0.0",
    +    "npm-pick-manifest": "^10.0.0",
    +    "npm-registry-fetch": "^18.0.0",
    +    "proc-log": "^5.0.0",
    +    "promise-retry": "^2.0.1",
    +    "sigstore": "^3.0.0",
    +    "ssri": "^12.0.0",
    +    "tar": "^6.1.11"
    +  },
    +  "engines": {
    +    "node": "^20.17.0 || >=22.9.0"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/pacote.git"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.4",
    +    "windowsCI": false,
    +    "publish": "true"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/parse-conflict-json/LICENSE.md b/node_modules/npm/node_modules/parse-conflict-json/LICENSE.md
    new file mode 100644
    index 00000000..5fc208ff
    --- /dev/null
    +++ b/node_modules/npm/node_modules/parse-conflict-json/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/npm/node_modules/parse-conflict-json/lib/index.js b/node_modules/npm/node_modules/parse-conflict-json/lib/index.js
    new file mode 100644
    index 00000000..21b295d0
    --- /dev/null
    +++ b/node_modules/npm/node_modules/parse-conflict-json/lib/index.js
    @@ -0,0 +1,104 @@
    +const parseJSON = require('json-parse-even-better-errors')
    +const { diff } = require('just-diff')
    +const { diffApply } = require('just-diff-apply')
    +
    +const globalObjectProperties = Object.getOwnPropertyNames(Object.prototype)
    +
    +const stripBOM = content => {
    +  content = content.toString()
    +  // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
    +  // because the buffer-to-string conversion in `fs.readFileSync()`
    +  // translates it to FEFF, the UTF-16 BOM.
    +  if (content.charCodeAt(0) === 0xFEFF) {
    +    content = content.slice(1)
    +  }
    +  return content
    +}
    +
    +const PARENT_RE = /\|{7,}/g
    +const OURS_RE = /<{7,}/g
    +const THEIRS_RE = /={7,}/g
    +const END_RE = />{7,}/g
    +
    +const isDiff = str =>
    +  str.match(OURS_RE) && str.match(THEIRS_RE) && str.match(END_RE)
    +
    +const parseConflictJSON = (str, reviver, prefer) => {
    +  prefer = prefer || 'ours'
    +  if (prefer !== 'theirs' && prefer !== 'ours') {
    +    throw new TypeError('prefer param must be "ours" or "theirs" if set')
    +  }
    +
    +  str = stripBOM(str)
    +
    +  if (!isDiff(str)) {
    +    return parseJSON(str)
    +  }
    +
    +  const pieces = str.split(/[\n\r]+/g).reduce((acc, line) => {
    +    if (line.match(PARENT_RE)) {
    +      acc.state = 'parent'
    +    } else if (line.match(OURS_RE)) {
    +      acc.state = 'ours'
    +    } else if (line.match(THEIRS_RE)) {
    +      acc.state = 'theirs'
    +    } else if (line.match(END_RE)) {
    +      acc.state = 'top'
    +    } else {
    +      if (acc.state === 'top' || acc.state === 'ours') {
    +        acc.ours += line
    +      }
    +      if (acc.state === 'top' || acc.state === 'theirs') {
    +        acc.theirs += line
    +      }
    +      if (acc.state === 'top' || acc.state === 'parent') {
    +        acc.parent += line
    +      }
    +    }
    +    return acc
    +  }, {
    +    state: 'top',
    +    ours: '',
    +    theirs: '',
    +    parent: '',
    +  })
    +
    +  // this will throw if either piece is not valid JSON, that's intended
    +  const parent = parseJSON(pieces.parent, reviver)
    +  const ours = parseJSON(pieces.ours, reviver)
    +  const theirs = parseJSON(pieces.theirs, reviver)
    +
    +  return prefer === 'ours'
    +    ? resolve(parent, ours, theirs)
    +    : resolve(parent, theirs, ours)
    +}
    +
    +const isObj = obj => obj && typeof obj === 'object'
    +
    +const copyPath = (to, from, path, i) => {
    +  const p = path[i]
    +  if (isObj(to[p]) && isObj(from[p]) &&
    +      Array.isArray(to[p]) === Array.isArray(from[p])) {
    +    return copyPath(to[p], from[p], path, i + 1)
    +  }
    +  to[p] = from[p]
    +}
    +
    +// get the diff from parent->ours and applying our changes on top of theirs.
    +// If they turned an object into a non-object, then put it back.
    +const resolve = (parent, ours, theirs) => {
    +  const dours = diff(parent, ours)
    +  for (let i = 0; i < dours.length; i++) {
    +    if (globalObjectProperties.find(prop => dours[i].path.includes(prop))) {
    +      continue
    +    }
    +    try {
    +      diffApply(theirs, [dours[i]])
    +    } catch (e) {
    +      copyPath(theirs, ours, dours[i].path, 0)
    +    }
    +  }
    +  return theirs
    +}
    +
    +module.exports = Object.assign(parseConflictJSON, { isDiff })
    diff --git a/node_modules/npm/node_modules/parse-conflict-json/package.json b/node_modules/npm/node_modules/parse-conflict-json/package.json
    new file mode 100644
    index 00000000..824ca8ed
    --- /dev/null
    +++ b/node_modules/npm/node_modules/parse-conflict-json/package.json
    @@ -0,0 +1,51 @@
    +{
    +  "name": "parse-conflict-json",
    +  "version": "4.0.0",
    +  "description": "Parse a JSON string that has git merge conflicts, resolving if possible",
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "main": "lib",
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "lintfix": "npm run eslint -- --fix",
    +    "posttest": "npm run lint",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "tap": {
    +    "check-coverage": true,
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "tap": "^16.0.1"
    +  },
    +  "dependencies": {
    +    "json-parse-even-better-errors": "^4.0.0",
    +    "just-diff": "^6.0.0",
    +    "just-diff-apply": "^5.2.0"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/parse-conflict-json.git"
    +  },
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": true
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/path-key/index.js b/node_modules/npm/node_modules/path-key/index.js
    new file mode 100644
    index 00000000..0cf6415d
    --- /dev/null
    +++ b/node_modules/npm/node_modules/path-key/index.js
    @@ -0,0 +1,16 @@
    +'use strict';
    +
    +const pathKey = (options = {}) => {
    +	const environment = options.env || process.env;
    +	const platform = options.platform || process.platform;
    +
    +	if (platform !== 'win32') {
    +		return 'PATH';
    +	}
    +
    +	return Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';
    +};
    +
    +module.exports = pathKey;
    +// TODO: Remove this for the next major release
    +module.exports.default = pathKey;
    diff --git a/node_modules/npm/node_modules/path-key/license b/node_modules/npm/node_modules/path-key/license
    new file mode 100644
    index 00000000..e7af2f77
    --- /dev/null
    +++ b/node_modules/npm/node_modules/path-key/license
    @@ -0,0 +1,9 @@
    +MIT License
    +
    +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/npm/node_modules/path-key/package.json b/node_modules/npm/node_modules/path-key/package.json
    new file mode 100644
    index 00000000..c8cbd383
    --- /dev/null
    +++ b/node_modules/npm/node_modules/path-key/package.json
    @@ -0,0 +1,39 @@
    +{
    +	"name": "path-key",
    +	"version": "3.1.1",
    +	"description": "Get the PATH environment variable key cross-platform",
    +	"license": "MIT",
    +	"repository": "sindresorhus/path-key",
    +	"author": {
    +		"name": "Sindre Sorhus",
    +		"email": "sindresorhus@gmail.com",
    +		"url": "sindresorhus.com"
    +	},
    +	"engines": {
    +		"node": ">=8"
    +	},
    +	"scripts": {
    +		"test": "xo && ava && tsd"
    +	},
    +	"files": [
    +		"index.js",
    +		"index.d.ts"
    +	],
    +	"keywords": [
    +		"path",
    +		"key",
    +		"environment",
    +		"env",
    +		"variable",
    +		"var",
    +		"get",
    +		"cross-platform",
    +		"windows"
    +	],
    +	"devDependencies": {
    +		"@types/node": "^11.13.0",
    +		"ava": "^1.4.1",
    +		"tsd": "^0.7.2",
    +		"xo": "^0.24.0"
    +	}
    +}
    diff --git a/node_modules/npm/node_modules/path-scurry/LICENSE.md b/node_modules/npm/node_modules/path-scurry/LICENSE.md
    new file mode 100644
    index 00000000..c5402b95
    --- /dev/null
    +++ b/node_modules/npm/node_modules/path-scurry/LICENSE.md
    @@ -0,0 +1,55 @@
    +# Blue Oak Model License
    +
    +Version 1.0.0
    +
    +## Purpose
    +
    +This license gives everyone as much permission to work with
    +this software as possible, while protecting contributors
    +from liability.
    +
    +## Acceptance
    +
    +In order to receive this license, you must agree to its
    +rules.  The rules of this license are both obligations
    +under that agreement and conditions to your license.
    +You must not do anything with this software that triggers
    +a rule that you cannot or will not follow.
    +
    +## Copyright
    +
    +Each contributor licenses you to do everything with this
    +software that would otherwise infringe that contributor's
    +copyright in it.
    +
    +## Notices
    +
    +You must ensure that everyone who gets a copy of
    +any part of this software from you, with or without
    +changes, also gets the text of this license or a link to
    +.
    +
    +## Excuse
    +
    +If anyone notifies you in writing that you have not
    +complied with [Notices](#notices), you can keep your
    +license by taking all practical steps to comply within 30
    +days after the notice.  If you do not do so, your license
    +ends immediately.
    +
    +## Patent
    +
    +Each contributor licenses you to do everything with this
    +software that would otherwise infringe any patent claims
    +they can license or become able to license.
    +
    +## Reliability
    +
    +No contributor can revoke this license.
    +
    +## No Liability
    +
    +***As far as the law allows, this software comes as is,
    +without any warranty or condition, and no contributor
    +will be liable to anyone for any damages related to this
    +software or this license, under any kind of legal claim.***
    diff --git a/node_modules/npm/node_modules/path-scurry/dist/commonjs/index.js b/node_modules/npm/node_modules/path-scurry/dist/commonjs/index.js
    new file mode 100644
    index 00000000..555de62f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/path-scurry/dist/commonjs/index.js
    @@ -0,0 +1,2014 @@
    +"use strict";
    +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    var desc = Object.getOwnPropertyDescriptor(m, k);
    +    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
    +      desc = { enumerable: true, get: function() { return m[k]; } };
    +    }
    +    Object.defineProperty(o, k2, desc);
    +}) : (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    o[k2] = m[k];
    +}));
    +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    +    Object.defineProperty(o, "default", { enumerable: true, value: v });
    +}) : function(o, v) {
    +    o["default"] = v;
    +});
    +var __importStar = (this && this.__importStar) || function (mod) {
    +    if (mod && mod.__esModule) return mod;
    +    var result = {};
    +    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    +    __setModuleDefault(result, mod);
    +    return result;
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.PathScurry = exports.Path = exports.PathScurryDarwin = exports.PathScurryPosix = exports.PathScurryWin32 = exports.PathScurryBase = exports.PathPosix = exports.PathWin32 = exports.PathBase = exports.ChildrenCache = exports.ResolveCache = void 0;
    +const lru_cache_1 = require("lru-cache");
    +const node_path_1 = require("node:path");
    +const node_url_1 = require("node:url");
    +const fs_1 = require("fs");
    +const actualFS = __importStar(require("node:fs"));
    +const realpathSync = fs_1.realpathSync.native;
    +// TODO: test perf of fs/promises realpath vs realpathCB,
    +// since the promises one uses realpath.native
    +const promises_1 = require("node:fs/promises");
    +const minipass_1 = require("minipass");
    +const defaultFS = {
    +    lstatSync: fs_1.lstatSync,
    +    readdir: fs_1.readdir,
    +    readdirSync: fs_1.readdirSync,
    +    readlinkSync: fs_1.readlinkSync,
    +    realpathSync,
    +    promises: {
    +        lstat: promises_1.lstat,
    +        readdir: promises_1.readdir,
    +        readlink: promises_1.readlink,
    +        realpath: promises_1.realpath,
    +    },
    +};
    +// if they just gave us require('fs') then use our default
    +const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === actualFS ?
    +    defaultFS
    +    : {
    +        ...defaultFS,
    +        ...fsOption,
    +        promises: {
    +            ...defaultFS.promises,
    +            ...(fsOption.promises || {}),
    +        },
    +    };
    +// turn something like //?/c:/ into c:\
    +const uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i;
    +const uncToDrive = (rootPath) => rootPath.replace(/\//g, '\\').replace(uncDriveRegexp, '$1\\');
    +// windows paths are separated by either / or \
    +const eitherSep = /[\\\/]/;
    +const UNKNOWN = 0; // may not even exist, for all we know
    +const IFIFO = 0b0001;
    +const IFCHR = 0b0010;
    +const IFDIR = 0b0100;
    +const IFBLK = 0b0110;
    +const IFREG = 0b1000;
    +const IFLNK = 0b1010;
    +const IFSOCK = 0b1100;
    +const IFMT = 0b1111;
    +// mask to unset low 4 bits
    +const IFMT_UNKNOWN = ~IFMT;
    +// set after successfully calling readdir() and getting entries.
    +const READDIR_CALLED = 0b0000_0001_0000;
    +// set after a successful lstat()
    +const LSTAT_CALLED = 0b0000_0010_0000;
    +// set if an entry (or one of its parents) is definitely not a dir
    +const ENOTDIR = 0b0000_0100_0000;
    +// set if an entry (or one of its parents) does not exist
    +// (can also be set on lstat errors like EACCES or ENAMETOOLONG)
    +const ENOENT = 0b0000_1000_0000;
    +// cannot have child entries -- also verify &IFMT is either IFDIR or IFLNK
    +// set if we fail to readlink
    +const ENOREADLINK = 0b0001_0000_0000;
    +// set if we know realpath() will fail
    +const ENOREALPATH = 0b0010_0000_0000;
    +const ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH;
    +const TYPEMASK = 0b0011_1111_1111;
    +const entToType = (s) => s.isFile() ? IFREG
    +    : s.isDirectory() ? IFDIR
    +        : s.isSymbolicLink() ? IFLNK
    +            : s.isCharacterDevice() ? IFCHR
    +                : s.isBlockDevice() ? IFBLK
    +                    : s.isSocket() ? IFSOCK
    +                        : s.isFIFO() ? IFIFO
    +                            : UNKNOWN;
    +// normalize unicode path names
    +const normalizeCache = new Map();
    +const normalize = (s) => {
    +    const c = normalizeCache.get(s);
    +    if (c)
    +        return c;
    +    const n = s.normalize('NFKD');
    +    normalizeCache.set(s, n);
    +    return n;
    +};
    +const normalizeNocaseCache = new Map();
    +const normalizeNocase = (s) => {
    +    const c = normalizeNocaseCache.get(s);
    +    if (c)
    +        return c;
    +    const n = normalize(s.toLowerCase());
    +    normalizeNocaseCache.set(s, n);
    +    return n;
    +};
    +/**
    + * An LRUCache for storing resolved path strings or Path objects.
    + * @internal
    + */
    +class ResolveCache extends lru_cache_1.LRUCache {
    +    constructor() {
    +        super({ max: 256 });
    +    }
    +}
    +exports.ResolveCache = ResolveCache;
    +// In order to prevent blowing out the js heap by allocating hundreds of
    +// thousands of Path entries when walking extremely large trees, the "children"
    +// in this tree are represented by storing an array of Path entries in an
    +// LRUCache, indexed by the parent.  At any time, Path.children() may return an
    +// empty array, indicating that it doesn't know about any of its children, and
    +// thus has to rebuild that cache.  This is fine, it just means that we don't
    +// benefit as much from having the cached entries, but huge directory walks
    +// don't blow out the stack, and smaller ones are still as fast as possible.
    +//
    +//It does impose some complexity when building up the readdir data, because we
    +//need to pass a reference to the children array that we started with.
    +/**
    + * an LRUCache for storing child entries.
    + * @internal
    + */
    +class ChildrenCache extends lru_cache_1.LRUCache {
    +    constructor(maxSize = 16 * 1024) {
    +        super({
    +            maxSize,
    +            // parent + children
    +            sizeCalculation: a => a.length + 1,
    +        });
    +    }
    +}
    +exports.ChildrenCache = ChildrenCache;
    +const setAsCwd = Symbol('PathScurry setAsCwd');
    +/**
    + * Path objects are sort of like a super-powered
    + * {@link https://nodejs.org/docs/latest/api/fs.html#class-fsdirent fs.Dirent}
    + *
    + * Each one represents a single filesystem entry on disk, which may or may not
    + * exist. It includes methods for reading various types of information via
    + * lstat, readlink, and readdir, and caches all information to the greatest
    + * degree possible.
    + *
    + * Note that fs operations that would normally throw will instead return an
    + * "empty" value. This is in order to prevent excessive overhead from error
    + * stack traces.
    + */
    +class PathBase {
    +    /**
    +     * the basename of this path
    +     *
    +     * **Important**: *always* test the path name against any test string
    +     * usingthe {@link isNamed} method, and not by directly comparing this
    +     * string. Otherwise, unicode path strings that the system sees as identical
    +     * will not be properly treated as the same path, leading to incorrect
    +     * behavior and possible security issues.
    +     */
    +    name;
    +    /**
    +     * the Path entry corresponding to the path root.
    +     *
    +     * @internal
    +     */
    +    root;
    +    /**
    +     * All roots found within the current PathScurry family
    +     *
    +     * @internal
    +     */
    +    roots;
    +    /**
    +     * a reference to the parent path, or undefined in the case of root entries
    +     *
    +     * @internal
    +     */
    +    parent;
    +    /**
    +     * boolean indicating whether paths are compared case-insensitively
    +     * @internal
    +     */
    +    nocase;
    +    /**
    +     * boolean indicating that this path is the current working directory
    +     * of the PathScurry collection that contains it.
    +     */
    +    isCWD = false;
    +    // potential default fs override
    +    #fs;
    +    // Stats fields
    +    #dev;
    +    get dev() {
    +        return this.#dev;
    +    }
    +    #mode;
    +    get mode() {
    +        return this.#mode;
    +    }
    +    #nlink;
    +    get nlink() {
    +        return this.#nlink;
    +    }
    +    #uid;
    +    get uid() {
    +        return this.#uid;
    +    }
    +    #gid;
    +    get gid() {
    +        return this.#gid;
    +    }
    +    #rdev;
    +    get rdev() {
    +        return this.#rdev;
    +    }
    +    #blksize;
    +    get blksize() {
    +        return this.#blksize;
    +    }
    +    #ino;
    +    get ino() {
    +        return this.#ino;
    +    }
    +    #size;
    +    get size() {
    +        return this.#size;
    +    }
    +    #blocks;
    +    get blocks() {
    +        return this.#blocks;
    +    }
    +    #atimeMs;
    +    get atimeMs() {
    +        return this.#atimeMs;
    +    }
    +    #mtimeMs;
    +    get mtimeMs() {
    +        return this.#mtimeMs;
    +    }
    +    #ctimeMs;
    +    get ctimeMs() {
    +        return this.#ctimeMs;
    +    }
    +    #birthtimeMs;
    +    get birthtimeMs() {
    +        return this.#birthtimeMs;
    +    }
    +    #atime;
    +    get atime() {
    +        return this.#atime;
    +    }
    +    #mtime;
    +    get mtime() {
    +        return this.#mtime;
    +    }
    +    #ctime;
    +    get ctime() {
    +        return this.#ctime;
    +    }
    +    #birthtime;
    +    get birthtime() {
    +        return this.#birthtime;
    +    }
    +    #matchName;
    +    #depth;
    +    #fullpath;
    +    #fullpathPosix;
    +    #relative;
    +    #relativePosix;
    +    #type;
    +    #children;
    +    #linkTarget;
    +    #realpath;
    +    /**
    +     * This property is for compatibility with the Dirent class as of
    +     * Node v20, where Dirent['parentPath'] refers to the path of the
    +     * directory that was passed to readdir. For root entries, it's the path
    +     * to the entry itself.
    +     */
    +    get parentPath() {
    +        return (this.parent || this).fullpath();
    +    }
    +    /**
    +     * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
    +     * this property refers to the *parent* path, not the path object itself.
    +     */
    +    get path() {
    +        return this.parentPath;
    +    }
    +    /**
    +     * Do not create new Path objects directly.  They should always be accessed
    +     * via the PathScurry class or other methods on the Path class.
    +     *
    +     * @internal
    +     */
    +    constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
    +        this.name = name;
    +        this.#matchName = nocase ? normalizeNocase(name) : normalize(name);
    +        this.#type = type & TYPEMASK;
    +        this.nocase = nocase;
    +        this.roots = roots;
    +        this.root = root || this;
    +        this.#children = children;
    +        this.#fullpath = opts.fullpath;
    +        this.#relative = opts.relative;
    +        this.#relativePosix = opts.relativePosix;
    +        this.parent = opts.parent;
    +        if (this.parent) {
    +            this.#fs = this.parent.#fs;
    +        }
    +        else {
    +            this.#fs = fsFromOption(opts.fs);
    +        }
    +    }
    +    /**
    +     * Returns the depth of the Path object from its root.
    +     *
    +     * For example, a path at `/foo/bar` would have a depth of 2.
    +     */
    +    depth() {
    +        if (this.#depth !== undefined)
    +            return this.#depth;
    +        if (!this.parent)
    +            return (this.#depth = 0);
    +        return (this.#depth = this.parent.depth() + 1);
    +    }
    +    /**
    +     * @internal
    +     */
    +    childrenCache() {
    +        return this.#children;
    +    }
    +    /**
    +     * Get the Path object referenced by the string path, resolved from this Path
    +     */
    +    resolve(path) {
    +        if (!path) {
    +            return this;
    +        }
    +        const rootPath = this.getRootString(path);
    +        const dir = path.substring(rootPath.length);
    +        const dirParts = dir.split(this.splitSep);
    +        const result = rootPath ?
    +            this.getRoot(rootPath).#resolveParts(dirParts)
    +            : this.#resolveParts(dirParts);
    +        return result;
    +    }
    +    #resolveParts(dirParts) {
    +        let p = this;
    +        for (const part of dirParts) {
    +            p = p.child(part);
    +        }
    +        return p;
    +    }
    +    /**
    +     * Returns the cached children Path objects, if still available.  If they
    +     * have fallen out of the cache, then returns an empty array, and resets the
    +     * READDIR_CALLED bit, so that future calls to readdir() will require an fs
    +     * lookup.
    +     *
    +     * @internal
    +     */
    +    children() {
    +        const cached = this.#children.get(this);
    +        if (cached) {
    +            return cached;
    +        }
    +        const children = Object.assign([], { provisional: 0 });
    +        this.#children.set(this, children);
    +        this.#type &= ~READDIR_CALLED;
    +        return children;
    +    }
    +    /**
    +     * Resolves a path portion and returns or creates the child Path.
    +     *
    +     * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is
    +     * `'..'`.
    +     *
    +     * This should not be called directly.  If `pathPart` contains any path
    +     * separators, it will lead to unsafe undefined behavior.
    +     *
    +     * Use `Path.resolve()` instead.
    +     *
    +     * @internal
    +     */
    +    child(pathPart, opts) {
    +        if (pathPart === '' || pathPart === '.') {
    +            return this;
    +        }
    +        if (pathPart === '..') {
    +            return this.parent || this;
    +        }
    +        // find the child
    +        const children = this.children();
    +        const name = this.nocase ? normalizeNocase(pathPart) : normalize(pathPart);
    +        for (const p of children) {
    +            if (p.#matchName === name) {
    +                return p;
    +            }
    +        }
    +        // didn't find it, create provisional child, since it might not
    +        // actually exist.  If we know the parent isn't a dir, then
    +        // in fact it CAN'T exist.
    +        const s = this.parent ? this.sep : '';
    +        const fullpath = this.#fullpath ? this.#fullpath + s + pathPart : undefined;
    +        const pchild = this.newChild(pathPart, UNKNOWN, {
    +            ...opts,
    +            parent: this,
    +            fullpath,
    +        });
    +        if (!this.canReaddir()) {
    +            pchild.#type |= ENOENT;
    +        }
    +        // don't have to update provisional, because if we have real children,
    +        // then provisional is set to children.length, otherwise a lower number
    +        children.push(pchild);
    +        return pchild;
    +    }
    +    /**
    +     * The relative path from the cwd. If it does not share an ancestor with
    +     * the cwd, then this ends up being equivalent to the fullpath()
    +     */
    +    relative() {
    +        if (this.isCWD)
    +            return '';
    +        if (this.#relative !== undefined) {
    +            return this.#relative;
    +        }
    +        const name = this.name;
    +        const p = this.parent;
    +        if (!p) {
    +            return (this.#relative = this.name);
    +        }
    +        const pv = p.relative();
    +        return pv + (!pv || !p.parent ? '' : this.sep) + name;
    +    }
    +    /**
    +     * The relative path from the cwd, using / as the path separator.
    +     * If it does not share an ancestor with
    +     * the cwd, then this ends up being equivalent to the fullpathPosix()
    +     * On posix systems, this is identical to relative().
    +     */
    +    relativePosix() {
    +        if (this.sep === '/')
    +            return this.relative();
    +        if (this.isCWD)
    +            return '';
    +        if (this.#relativePosix !== undefined)
    +            return this.#relativePosix;
    +        const name = this.name;
    +        const p = this.parent;
    +        if (!p) {
    +            return (this.#relativePosix = this.fullpathPosix());
    +        }
    +        const pv = p.relativePosix();
    +        return pv + (!pv || !p.parent ? '' : '/') + name;
    +    }
    +    /**
    +     * The fully resolved path string for this Path entry
    +     */
    +    fullpath() {
    +        if (this.#fullpath !== undefined) {
    +            return this.#fullpath;
    +        }
    +        const name = this.name;
    +        const p = this.parent;
    +        if (!p) {
    +            return (this.#fullpath = this.name);
    +        }
    +        const pv = p.fullpath();
    +        const fp = pv + (!p.parent ? '' : this.sep) + name;
    +        return (this.#fullpath = fp);
    +    }
    +    /**
    +     * On platforms other than windows, this is identical to fullpath.
    +     *
    +     * On windows, this is overridden to return the forward-slash form of the
    +     * full UNC path.
    +     */
    +    fullpathPosix() {
    +        if (this.#fullpathPosix !== undefined)
    +            return this.#fullpathPosix;
    +        if (this.sep === '/')
    +            return (this.#fullpathPosix = this.fullpath());
    +        if (!this.parent) {
    +            const p = this.fullpath().replace(/\\/g, '/');
    +            if (/^[a-z]:\//i.test(p)) {
    +                return (this.#fullpathPosix = `//?/${p}`);
    +            }
    +            else {
    +                return (this.#fullpathPosix = p);
    +            }
    +        }
    +        const p = this.parent;
    +        const pfpp = p.fullpathPosix();
    +        const fpp = pfpp + (!pfpp || !p.parent ? '' : '/') + this.name;
    +        return (this.#fullpathPosix = fpp);
    +    }
    +    /**
    +     * Is the Path of an unknown type?
    +     *
    +     * Note that we might know *something* about it if there has been a previous
    +     * filesystem operation, for example that it does not exist, or is not a
    +     * link, or whether it has child entries.
    +     */
    +    isUnknown() {
    +        return (this.#type & IFMT) === UNKNOWN;
    +    }
    +    isType(type) {
    +        return this[`is${type}`]();
    +    }
    +    getType() {
    +        return (this.isUnknown() ? 'Unknown'
    +            : this.isDirectory() ? 'Directory'
    +                : this.isFile() ? 'File'
    +                    : this.isSymbolicLink() ? 'SymbolicLink'
    +                        : this.isFIFO() ? 'FIFO'
    +                            : this.isCharacterDevice() ? 'CharacterDevice'
    +                                : this.isBlockDevice() ? 'BlockDevice'
    +                                    : /* c8 ignore start */ this.isSocket() ? 'Socket'
    +                                        : 'Unknown');
    +        /* c8 ignore stop */
    +    }
    +    /**
    +     * Is the Path a regular file?
    +     */
    +    isFile() {
    +        return (this.#type & IFMT) === IFREG;
    +    }
    +    /**
    +     * Is the Path a directory?
    +     */
    +    isDirectory() {
    +        return (this.#type & IFMT) === IFDIR;
    +    }
    +    /**
    +     * Is the path a character device?
    +     */
    +    isCharacterDevice() {
    +        return (this.#type & IFMT) === IFCHR;
    +    }
    +    /**
    +     * Is the path a block device?
    +     */
    +    isBlockDevice() {
    +        return (this.#type & IFMT) === IFBLK;
    +    }
    +    /**
    +     * Is the path a FIFO pipe?
    +     */
    +    isFIFO() {
    +        return (this.#type & IFMT) === IFIFO;
    +    }
    +    /**
    +     * Is the path a socket?
    +     */
    +    isSocket() {
    +        return (this.#type & IFMT) === IFSOCK;
    +    }
    +    /**
    +     * Is the path a symbolic link?
    +     */
    +    isSymbolicLink() {
    +        return (this.#type & IFLNK) === IFLNK;
    +    }
    +    /**
    +     * Return the entry if it has been subject of a successful lstat, or
    +     * undefined otherwise.
    +     *
    +     * Does not read the filesystem, so an undefined result *could* simply
    +     * mean that we haven't called lstat on it.
    +     */
    +    lstatCached() {
    +        return this.#type & LSTAT_CALLED ? this : undefined;
    +    }
    +    /**
    +     * Return the cached link target if the entry has been the subject of a
    +     * successful readlink, or undefined otherwise.
    +     *
    +     * Does not read the filesystem, so an undefined result *could* just mean we
    +     * don't have any cached data. Only use it if you are very sure that a
    +     * readlink() has been called at some point.
    +     */
    +    readlinkCached() {
    +        return this.#linkTarget;
    +    }
    +    /**
    +     * Returns the cached realpath target if the entry has been the subject
    +     * of a successful realpath, or undefined otherwise.
    +     *
    +     * Does not read the filesystem, so an undefined result *could* just mean we
    +     * don't have any cached data. Only use it if you are very sure that a
    +     * realpath() has been called at some point.
    +     */
    +    realpathCached() {
    +        return this.#realpath;
    +    }
    +    /**
    +     * Returns the cached child Path entries array if the entry has been the
    +     * subject of a successful readdir(), or [] otherwise.
    +     *
    +     * Does not read the filesystem, so an empty array *could* just mean we
    +     * don't have any cached data. Only use it if you are very sure that a
    +     * readdir() has been called recently enough to still be valid.
    +     */
    +    readdirCached() {
    +        const children = this.children();
    +        return children.slice(0, children.provisional);
    +    }
    +    /**
    +     * Return true if it's worth trying to readlink.  Ie, we don't (yet) have
    +     * any indication that readlink will definitely fail.
    +     *
    +     * Returns false if the path is known to not be a symlink, if a previous
    +     * readlink failed, or if the entry does not exist.
    +     */
    +    canReadlink() {
    +        if (this.#linkTarget)
    +            return true;
    +        if (!this.parent)
    +            return false;
    +        // cases where it cannot possibly succeed
    +        const ifmt = this.#type & IFMT;
    +        return !((ifmt !== UNKNOWN && ifmt !== IFLNK) ||
    +            this.#type & ENOREADLINK ||
    +            this.#type & ENOENT);
    +    }
    +    /**
    +     * Return true if readdir has previously been successfully called on this
    +     * path, indicating that cachedReaddir() is likely valid.
    +     */
    +    calledReaddir() {
    +        return !!(this.#type & READDIR_CALLED);
    +    }
    +    /**
    +     * Returns true if the path is known to not exist. That is, a previous lstat
    +     * or readdir failed to verify its existence when that would have been
    +     * expected, or a parent entry was marked either enoent or enotdir.
    +     */
    +    isENOENT() {
    +        return !!(this.#type & ENOENT);
    +    }
    +    /**
    +     * Return true if the path is a match for the given path name.  This handles
    +     * case sensitivity and unicode normalization.
    +     *
    +     * Note: even on case-sensitive systems, it is **not** safe to test the
    +     * equality of the `.name` property to determine whether a given pathname
    +     * matches, due to unicode normalization mismatches.
    +     *
    +     * Always use this method instead of testing the `path.name` property
    +     * directly.
    +     */
    +    isNamed(n) {
    +        return !this.nocase ?
    +            this.#matchName === normalize(n)
    +            : this.#matchName === normalizeNocase(n);
    +    }
    +    /**
    +     * Return the Path object corresponding to the target of a symbolic link.
    +     *
    +     * If the Path is not a symbolic link, or if the readlink call fails for any
    +     * reason, `undefined` is returned.
    +     *
    +     * Result is cached, and thus may be outdated if the filesystem is mutated.
    +     */
    +    async readlink() {
    +        const target = this.#linkTarget;
    +        if (target) {
    +            return target;
    +        }
    +        if (!this.canReadlink()) {
    +            return undefined;
    +        }
    +        /* c8 ignore start */
    +        // already covered by the canReadlink test, here for ts grumples
    +        if (!this.parent) {
    +            return undefined;
    +        }
    +        /* c8 ignore stop */
    +        try {
    +            const read = await this.#fs.promises.readlink(this.fullpath());
    +            const linkTarget = (await this.parent.realpath())?.resolve(read);
    +            if (linkTarget) {
    +                return (this.#linkTarget = linkTarget);
    +            }
    +        }
    +        catch (er) {
    +            this.#readlinkFail(er.code);
    +            return undefined;
    +        }
    +    }
    +    /**
    +     * Synchronous {@link PathBase.readlink}
    +     */
    +    readlinkSync() {
    +        const target = this.#linkTarget;
    +        if (target) {
    +            return target;
    +        }
    +        if (!this.canReadlink()) {
    +            return undefined;
    +        }
    +        /* c8 ignore start */
    +        // already covered by the canReadlink test, here for ts grumples
    +        if (!this.parent) {
    +            return undefined;
    +        }
    +        /* c8 ignore stop */
    +        try {
    +            const read = this.#fs.readlinkSync(this.fullpath());
    +            const linkTarget = this.parent.realpathSync()?.resolve(read);
    +            if (linkTarget) {
    +                return (this.#linkTarget = linkTarget);
    +            }
    +        }
    +        catch (er) {
    +            this.#readlinkFail(er.code);
    +            return undefined;
    +        }
    +    }
    +    #readdirSuccess(children) {
    +        // succeeded, mark readdir called bit
    +        this.#type |= READDIR_CALLED;
    +        // mark all remaining provisional children as ENOENT
    +        for (let p = children.provisional; p < children.length; p++) {
    +            const c = children[p];
    +            if (c)
    +                c.#markENOENT();
    +        }
    +    }
    +    #markENOENT() {
    +        // mark as UNKNOWN and ENOENT
    +        if (this.#type & ENOENT)
    +            return;
    +        this.#type = (this.#type | ENOENT) & IFMT_UNKNOWN;
    +        this.#markChildrenENOENT();
    +    }
    +    #markChildrenENOENT() {
    +        // all children are provisional and do not exist
    +        const children = this.children();
    +        children.provisional = 0;
    +        for (const p of children) {
    +            p.#markENOENT();
    +        }
    +    }
    +    #markENOREALPATH() {
    +        this.#type |= ENOREALPATH;
    +        this.#markENOTDIR();
    +    }
    +    // save the information when we know the entry is not a dir
    +    #markENOTDIR() {
    +        // entry is not a directory, so any children can't exist.
    +        // this *should* be impossible, since any children created
    +        // after it's been marked ENOTDIR should be marked ENOENT,
    +        // so it won't even get to this point.
    +        /* c8 ignore start */
    +        if (this.#type & ENOTDIR)
    +            return;
    +        /* c8 ignore stop */
    +        let t = this.#type;
    +        // this could happen if we stat a dir, then delete it,
    +        // then try to read it or one of its children.
    +        if ((t & IFMT) === IFDIR)
    +            t &= IFMT_UNKNOWN;
    +        this.#type = t | ENOTDIR;
    +        this.#markChildrenENOENT();
    +    }
    +    #readdirFail(code = '') {
    +        // markENOTDIR and markENOENT also set provisional=0
    +        if (code === 'ENOTDIR' || code === 'EPERM') {
    +            this.#markENOTDIR();
    +        }
    +        else if (code === 'ENOENT') {
    +            this.#markENOENT();
    +        }
    +        else {
    +            this.children().provisional = 0;
    +        }
    +    }
    +    #lstatFail(code = '') {
    +        // Windows just raises ENOENT in this case, disable for win CI
    +        /* c8 ignore start */
    +        if (code === 'ENOTDIR') {
    +            // already know it has a parent by this point
    +            const p = this.parent;
    +            p.#markENOTDIR();
    +        }
    +        else if (code === 'ENOENT') {
    +            /* c8 ignore stop */
    +            this.#markENOENT();
    +        }
    +    }
    +    #readlinkFail(code = '') {
    +        let ter = this.#type;
    +        ter |= ENOREADLINK;
    +        if (code === 'ENOENT')
    +            ter |= ENOENT;
    +        // windows gets a weird error when you try to readlink a file
    +        if (code === 'EINVAL' || code === 'UNKNOWN') {
    +            // exists, but not a symlink, we don't know WHAT it is, so remove
    +            // all IFMT bits.
    +            ter &= IFMT_UNKNOWN;
    +        }
    +        this.#type = ter;
    +        // windows just gets ENOENT in this case.  We do cover the case,
    +        // just disabled because it's impossible on Windows CI
    +        /* c8 ignore start */
    +        if (code === 'ENOTDIR' && this.parent) {
    +            this.parent.#markENOTDIR();
    +        }
    +        /* c8 ignore stop */
    +    }
    +    #readdirAddChild(e, c) {
    +        return (this.#readdirMaybePromoteChild(e, c) ||
    +            this.#readdirAddNewChild(e, c));
    +    }
    +    #readdirAddNewChild(e, c) {
    +        // alloc new entry at head, so it's never provisional
    +        const type = entToType(e);
    +        const child = this.newChild(e.name, type, { parent: this });
    +        const ifmt = child.#type & IFMT;
    +        if (ifmt !== IFDIR && ifmt !== IFLNK && ifmt !== UNKNOWN) {
    +            child.#type |= ENOTDIR;
    +        }
    +        c.unshift(child);
    +        c.provisional++;
    +        return child;
    +    }
    +    #readdirMaybePromoteChild(e, c) {
    +        for (let p = c.provisional; p < c.length; p++) {
    +            const pchild = c[p];
    +            const name = this.nocase ? normalizeNocase(e.name) : normalize(e.name);
    +            if (name !== pchild.#matchName) {
    +                continue;
    +            }
    +            return this.#readdirPromoteChild(e, pchild, p, c);
    +        }
    +    }
    +    #readdirPromoteChild(e, p, index, c) {
    +        const v = p.name;
    +        // retain any other flags, but set ifmt from dirent
    +        p.#type = (p.#type & IFMT_UNKNOWN) | entToType(e);
    +        // case sensitivity fixing when we learn the true name.
    +        if (v !== e.name)
    +            p.name = e.name;
    +        // just advance provisional index (potentially off the list),
    +        // otherwise we have to splice/pop it out and re-insert at head
    +        if (index !== c.provisional) {
    +            if (index === c.length - 1)
    +                c.pop();
    +            else
    +                c.splice(index, 1);
    +            c.unshift(p);
    +        }
    +        c.provisional++;
    +        return p;
    +    }
    +    /**
    +     * Call lstat() on this Path, and update all known information that can be
    +     * determined.
    +     *
    +     * Note that unlike `fs.lstat()`, the returned value does not contain some
    +     * information, such as `mode`, `dev`, `nlink`, and `ino`.  If that
    +     * information is required, you will need to call `fs.lstat` yourself.
    +     *
    +     * If the Path refers to a nonexistent file, or if the lstat call fails for
    +     * any reason, `undefined` is returned.  Otherwise the updated Path object is
    +     * returned.
    +     *
    +     * Results are cached, and thus may be out of date if the filesystem is
    +     * mutated.
    +     */
    +    async lstat() {
    +        if ((this.#type & ENOENT) === 0) {
    +            try {
    +                this.#applyStat(await this.#fs.promises.lstat(this.fullpath()));
    +                return this;
    +            }
    +            catch (er) {
    +                this.#lstatFail(er.code);
    +            }
    +        }
    +    }
    +    /**
    +     * synchronous {@link PathBase.lstat}
    +     */
    +    lstatSync() {
    +        if ((this.#type & ENOENT) === 0) {
    +            try {
    +                this.#applyStat(this.#fs.lstatSync(this.fullpath()));
    +                return this;
    +            }
    +            catch (er) {
    +                this.#lstatFail(er.code);
    +            }
    +        }
    +    }
    +    #applyStat(st) {
    +        const { atime, atimeMs, birthtime, birthtimeMs, blksize, blocks, ctime, ctimeMs, dev, gid, ino, mode, mtime, mtimeMs, nlink, rdev, size, uid, } = st;
    +        this.#atime = atime;
    +        this.#atimeMs = atimeMs;
    +        this.#birthtime = birthtime;
    +        this.#birthtimeMs = birthtimeMs;
    +        this.#blksize = blksize;
    +        this.#blocks = blocks;
    +        this.#ctime = ctime;
    +        this.#ctimeMs = ctimeMs;
    +        this.#dev = dev;
    +        this.#gid = gid;
    +        this.#ino = ino;
    +        this.#mode = mode;
    +        this.#mtime = mtime;
    +        this.#mtimeMs = mtimeMs;
    +        this.#nlink = nlink;
    +        this.#rdev = rdev;
    +        this.#size = size;
    +        this.#uid = uid;
    +        const ifmt = entToType(st);
    +        // retain any other flags, but set the ifmt
    +        this.#type = (this.#type & IFMT_UNKNOWN) | ifmt | LSTAT_CALLED;
    +        if (ifmt !== UNKNOWN && ifmt !== IFDIR && ifmt !== IFLNK) {
    +            this.#type |= ENOTDIR;
    +        }
    +    }
    +    #onReaddirCB = [];
    +    #readdirCBInFlight = false;
    +    #callOnReaddirCB(children) {
    +        this.#readdirCBInFlight = false;
    +        const cbs = this.#onReaddirCB.slice();
    +        this.#onReaddirCB.length = 0;
    +        cbs.forEach(cb => cb(null, children));
    +    }
    +    /**
    +     * Standard node-style callback interface to get list of directory entries.
    +     *
    +     * If the Path cannot or does not contain any children, then an empty array
    +     * is returned.
    +     *
    +     * Results are cached, and thus may be out of date if the filesystem is
    +     * mutated.
    +     *
    +     * @param cb The callback called with (er, entries).  Note that the `er`
    +     * param is somewhat extraneous, as all readdir() errors are handled and
    +     * simply result in an empty set of entries being returned.
    +     * @param allowZalgo Boolean indicating that immediately known results should
    +     * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release
    +     * zalgo at your peril, the dark pony lord is devious and unforgiving.
    +     */
    +    readdirCB(cb, allowZalgo = false) {
    +        if (!this.canReaddir()) {
    +            if (allowZalgo)
    +                cb(null, []);
    +            else
    +                queueMicrotask(() => cb(null, []));
    +            return;
    +        }
    +        const children = this.children();
    +        if (this.calledReaddir()) {
    +            const c = children.slice(0, children.provisional);
    +            if (allowZalgo)
    +                cb(null, c);
    +            else
    +                queueMicrotask(() => cb(null, c));
    +            return;
    +        }
    +        // don't have to worry about zalgo at this point.
    +        this.#onReaddirCB.push(cb);
    +        if (this.#readdirCBInFlight) {
    +            return;
    +        }
    +        this.#readdirCBInFlight = true;
    +        // else read the directory, fill up children
    +        // de-provisionalize any provisional children.
    +        const fullpath = this.fullpath();
    +        this.#fs.readdir(fullpath, { withFileTypes: true }, (er, entries) => {
    +            if (er) {
    +                this.#readdirFail(er.code);
    +                children.provisional = 0;
    +            }
    +            else {
    +                // if we didn't get an error, we always get entries.
    +                //@ts-ignore
    +                for (const e of entries) {
    +                    this.#readdirAddChild(e, children);
    +                }
    +                this.#readdirSuccess(children);
    +            }
    +            this.#callOnReaddirCB(children.slice(0, children.provisional));
    +            return;
    +        });
    +    }
    +    #asyncReaddirInFlight;
    +    /**
    +     * Return an array of known child entries.
    +     *
    +     * If the Path cannot or does not contain any children, then an empty array
    +     * is returned.
    +     *
    +     * Results are cached, and thus may be out of date if the filesystem is
    +     * mutated.
    +     */
    +    async readdir() {
    +        if (!this.canReaddir()) {
    +            return [];
    +        }
    +        const children = this.children();
    +        if (this.calledReaddir()) {
    +            return children.slice(0, children.provisional);
    +        }
    +        // else read the directory, fill up children
    +        // de-provisionalize any provisional children.
    +        const fullpath = this.fullpath();
    +        if (this.#asyncReaddirInFlight) {
    +            await this.#asyncReaddirInFlight;
    +        }
    +        else {
    +            /* c8 ignore start */
    +            let resolve = () => { };
    +            /* c8 ignore stop */
    +            this.#asyncReaddirInFlight = new Promise(res => (resolve = res));
    +            try {
    +                for (const e of await this.#fs.promises.readdir(fullpath, {
    +                    withFileTypes: true,
    +                })) {
    +                    this.#readdirAddChild(e, children);
    +                }
    +                this.#readdirSuccess(children);
    +            }
    +            catch (er) {
    +                this.#readdirFail(er.code);
    +                children.provisional = 0;
    +            }
    +            this.#asyncReaddirInFlight = undefined;
    +            resolve();
    +        }
    +        return children.slice(0, children.provisional);
    +    }
    +    /**
    +     * synchronous {@link PathBase.readdir}
    +     */
    +    readdirSync() {
    +        if (!this.canReaddir()) {
    +            return [];
    +        }
    +        const children = this.children();
    +        if (this.calledReaddir()) {
    +            return children.slice(0, children.provisional);
    +        }
    +        // else read the directory, fill up children
    +        // de-provisionalize any provisional children.
    +        const fullpath = this.fullpath();
    +        try {
    +            for (const e of this.#fs.readdirSync(fullpath, {
    +                withFileTypes: true,
    +            })) {
    +                this.#readdirAddChild(e, children);
    +            }
    +            this.#readdirSuccess(children);
    +        }
    +        catch (er) {
    +            this.#readdirFail(er.code);
    +            children.provisional = 0;
    +        }
    +        return children.slice(0, children.provisional);
    +    }
    +    canReaddir() {
    +        if (this.#type & ENOCHILD)
    +            return false;
    +        const ifmt = IFMT & this.#type;
    +        // we always set ENOTDIR when setting IFMT, so should be impossible
    +        /* c8 ignore start */
    +        if (!(ifmt === UNKNOWN || ifmt === IFDIR || ifmt === IFLNK)) {
    +            return false;
    +        }
    +        /* c8 ignore stop */
    +        return true;
    +    }
    +    shouldWalk(dirs, walkFilter) {
    +        return ((this.#type & IFDIR) === IFDIR &&
    +            !(this.#type & ENOCHILD) &&
    +            !dirs.has(this) &&
    +            (!walkFilter || walkFilter(this)));
    +    }
    +    /**
    +     * Return the Path object corresponding to path as resolved
    +     * by realpath(3).
    +     *
    +     * If the realpath call fails for any reason, `undefined` is returned.
    +     *
    +     * Result is cached, and thus may be outdated if the filesystem is mutated.
    +     * On success, returns a Path object.
    +     */
    +    async realpath() {
    +        if (this.#realpath)
    +            return this.#realpath;
    +        if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type)
    +            return undefined;
    +        try {
    +            const rp = await this.#fs.promises.realpath(this.fullpath());
    +            return (this.#realpath = this.resolve(rp));
    +        }
    +        catch (_) {
    +            this.#markENOREALPATH();
    +        }
    +    }
    +    /**
    +     * Synchronous {@link realpath}
    +     */
    +    realpathSync() {
    +        if (this.#realpath)
    +            return this.#realpath;
    +        if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type)
    +            return undefined;
    +        try {
    +            const rp = this.#fs.realpathSync(this.fullpath());
    +            return (this.#realpath = this.resolve(rp));
    +        }
    +        catch (_) {
    +            this.#markENOREALPATH();
    +        }
    +    }
    +    /**
    +     * Internal method to mark this Path object as the scurry cwd,
    +     * called by {@link PathScurry#chdir}
    +     *
    +     * @internal
    +     */
    +    [setAsCwd](oldCwd) {
    +        if (oldCwd === this)
    +            return;
    +        oldCwd.isCWD = false;
    +        this.isCWD = true;
    +        const changed = new Set([]);
    +        let rp = [];
    +        let p = this;
    +        while (p && p.parent) {
    +            changed.add(p);
    +            p.#relative = rp.join(this.sep);
    +            p.#relativePosix = rp.join('/');
    +            p = p.parent;
    +            rp.push('..');
    +        }
    +        // now un-memoize parents of old cwd
    +        p = oldCwd;
    +        while (p && p.parent && !changed.has(p)) {
    +            p.#relative = undefined;
    +            p.#relativePosix = undefined;
    +            p = p.parent;
    +        }
    +    }
    +}
    +exports.PathBase = PathBase;
    +/**
    + * Path class used on win32 systems
    + *
    + * Uses `'\\'` as the path separator for returned paths, either `'\\'` or `'/'`
    + * as the path separator for parsing paths.
    + */
    +class PathWin32 extends PathBase {
    +    /**
    +     * Separator for generating path strings.
    +     */
    +    sep = '\\';
    +    /**
    +     * Separator for parsing path strings.
    +     */
    +    splitSep = eitherSep;
    +    /**
    +     * Do not create new Path objects directly.  They should always be accessed
    +     * via the PathScurry class or other methods on the Path class.
    +     *
    +     * @internal
    +     */
    +    constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
    +        super(name, type, root, roots, nocase, children, opts);
    +    }
    +    /**
    +     * @internal
    +     */
    +    newChild(name, type = UNKNOWN, opts = {}) {
    +        return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
    +    }
    +    /**
    +     * @internal
    +     */
    +    getRootString(path) {
    +        return node_path_1.win32.parse(path).root;
    +    }
    +    /**
    +     * @internal
    +     */
    +    getRoot(rootPath) {
    +        rootPath = uncToDrive(rootPath.toUpperCase());
    +        if (rootPath === this.root.name) {
    +            return this.root;
    +        }
    +        // ok, not that one, check if it matches another we know about
    +        for (const [compare, root] of Object.entries(this.roots)) {
    +            if (this.sameRoot(rootPath, compare)) {
    +                return (this.roots[rootPath] = root);
    +            }
    +        }
    +        // otherwise, have to create a new one.
    +        return (this.roots[rootPath] = new PathScurryWin32(rootPath, this).root);
    +    }
    +    /**
    +     * @internal
    +     */
    +    sameRoot(rootPath, compare = this.root.name) {
    +        // windows can (rarely) have case-sensitive filesystem, but
    +        // UNC and drive letters are always case-insensitive, and canonically
    +        // represented uppercase.
    +        rootPath = rootPath
    +            .toUpperCase()
    +            .replace(/\//g, '\\')
    +            .replace(uncDriveRegexp, '$1\\');
    +        return rootPath === compare;
    +    }
    +}
    +exports.PathWin32 = PathWin32;
    +/**
    + * Path class used on all posix systems.
    + *
    + * Uses `'/'` as the path separator.
    + */
    +class PathPosix extends PathBase {
    +    /**
    +     * separator for parsing path strings
    +     */
    +    splitSep = '/';
    +    /**
    +     * separator for generating path strings
    +     */
    +    sep = '/';
    +    /**
    +     * Do not create new Path objects directly.  They should always be accessed
    +     * via the PathScurry class or other methods on the Path class.
    +     *
    +     * @internal
    +     */
    +    constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
    +        super(name, type, root, roots, nocase, children, opts);
    +    }
    +    /**
    +     * @internal
    +     */
    +    getRootString(path) {
    +        return path.startsWith('/') ? '/' : '';
    +    }
    +    /**
    +     * @internal
    +     */
    +    getRoot(_rootPath) {
    +        return this.root;
    +    }
    +    /**
    +     * @internal
    +     */
    +    newChild(name, type = UNKNOWN, opts = {}) {
    +        return new PathPosix(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
    +    }
    +}
    +exports.PathPosix = PathPosix;
    +/**
    + * The base class for all PathScurry classes, providing the interface for path
    + * resolution and filesystem operations.
    + *
    + * Typically, you should *not* instantiate this class directly, but rather one
    + * of the platform-specific classes, or the exported {@link PathScurry} which
    + * defaults to the current platform.
    + */
    +class PathScurryBase {
    +    /**
    +     * The root Path entry for the current working directory of this Scurry
    +     */
    +    root;
    +    /**
    +     * The string path for the root of this Scurry's current working directory
    +     */
    +    rootPath;
    +    /**
    +     * A collection of all roots encountered, referenced by rootPath
    +     */
    +    roots;
    +    /**
    +     * The Path entry corresponding to this PathScurry's current working directory.
    +     */
    +    cwd;
    +    #resolveCache;
    +    #resolvePosixCache;
    +    #children;
    +    /**
    +     * Perform path comparisons case-insensitively.
    +     *
    +     * Defaults true on Darwin and Windows systems, false elsewhere.
    +     */
    +    nocase;
    +    #fs;
    +    /**
    +     * This class should not be instantiated directly.
    +     *
    +     * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry
    +     *
    +     * @internal
    +     */
    +    constructor(cwd = process.cwd(), pathImpl, sep, { nocase, childrenCacheSize = 16 * 1024, fs = defaultFS, } = {}) {
    +        this.#fs = fsFromOption(fs);
    +        if (cwd instanceof URL || cwd.startsWith('file://')) {
    +            cwd = (0, node_url_1.fileURLToPath)(cwd);
    +        }
    +        // resolve and split root, and then add to the store.
    +        // this is the only time we call path.resolve()
    +        const cwdPath = pathImpl.resolve(cwd);
    +        this.roots = Object.create(null);
    +        this.rootPath = this.parseRootPath(cwdPath);
    +        this.#resolveCache = new ResolveCache();
    +        this.#resolvePosixCache = new ResolveCache();
    +        this.#children = new ChildrenCache(childrenCacheSize);
    +        const split = cwdPath.substring(this.rootPath.length).split(sep);
    +        // resolve('/') leaves '', splits to [''], we don't want that.
    +        if (split.length === 1 && !split[0]) {
    +            split.pop();
    +        }
    +        /* c8 ignore start */
    +        if (nocase === undefined) {
    +            throw new TypeError('must provide nocase setting to PathScurryBase ctor');
    +        }
    +        /* c8 ignore stop */
    +        this.nocase = nocase;
    +        this.root = this.newRoot(this.#fs);
    +        this.roots[this.rootPath] = this.root;
    +        let prev = this.root;
    +        let len = split.length - 1;
    +        const joinSep = pathImpl.sep;
    +        let abs = this.rootPath;
    +        let sawFirst = false;
    +        for (const part of split) {
    +            const l = len--;
    +            prev = prev.child(part, {
    +                relative: new Array(l).fill('..').join(joinSep),
    +                relativePosix: new Array(l).fill('..').join('/'),
    +                fullpath: (abs += (sawFirst ? '' : joinSep) + part),
    +            });
    +            sawFirst = true;
    +        }
    +        this.cwd = prev;
    +    }
    +    /**
    +     * Get the depth of a provided path, string, or the cwd
    +     */
    +    depth(path = this.cwd) {
    +        if (typeof path === 'string') {
    +            path = this.cwd.resolve(path);
    +        }
    +        return path.depth();
    +    }
    +    /**
    +     * Return the cache of child entries.  Exposed so subclasses can create
    +     * child Path objects in a platform-specific way.
    +     *
    +     * @internal
    +     */
    +    childrenCache() {
    +        return this.#children;
    +    }
    +    /**
    +     * Resolve one or more path strings to a resolved string
    +     *
    +     * Same interface as require('path').resolve.
    +     *
    +     * Much faster than path.resolve() when called multiple times for the same
    +     * path, because the resolved Path objects are cached.  Much slower
    +     * otherwise.
    +     */
    +    resolve(...paths) {
    +        // first figure out the minimum number of paths we have to test
    +        // we always start at cwd, but any absolutes will bump the start
    +        let r = '';
    +        for (let i = paths.length - 1; i >= 0; i--) {
    +            const p = paths[i];
    +            if (!p || p === '.')
    +                continue;
    +            r = r ? `${p}/${r}` : p;
    +            if (this.isAbsolute(p)) {
    +                break;
    +            }
    +        }
    +        const cached = this.#resolveCache.get(r);
    +        if (cached !== undefined) {
    +            return cached;
    +        }
    +        const result = this.cwd.resolve(r).fullpath();
    +        this.#resolveCache.set(r, result);
    +        return result;
    +    }
    +    /**
    +     * Resolve one or more path strings to a resolved string, returning
    +     * the posix path.  Identical to .resolve() on posix systems, but on
    +     * windows will return a forward-slash separated UNC path.
    +     *
    +     * Same interface as require('path').resolve.
    +     *
    +     * Much faster than path.resolve() when called multiple times for the same
    +     * path, because the resolved Path objects are cached.  Much slower
    +     * otherwise.
    +     */
    +    resolvePosix(...paths) {
    +        // first figure out the minimum number of paths we have to test
    +        // we always start at cwd, but any absolutes will bump the start
    +        let r = '';
    +        for (let i = paths.length - 1; i >= 0; i--) {
    +            const p = paths[i];
    +            if (!p || p === '.')
    +                continue;
    +            r = r ? `${p}/${r}` : p;
    +            if (this.isAbsolute(p)) {
    +                break;
    +            }
    +        }
    +        const cached = this.#resolvePosixCache.get(r);
    +        if (cached !== undefined) {
    +            return cached;
    +        }
    +        const result = this.cwd.resolve(r).fullpathPosix();
    +        this.#resolvePosixCache.set(r, result);
    +        return result;
    +    }
    +    /**
    +     * find the relative path from the cwd to the supplied path string or entry
    +     */
    +    relative(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return entry.relative();
    +    }
    +    /**
    +     * find the relative path from the cwd to the supplied path string or
    +     * entry, using / as the path delimiter, even on Windows.
    +     */
    +    relativePosix(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return entry.relativePosix();
    +    }
    +    /**
    +     * Return the basename for the provided string or Path object
    +     */
    +    basename(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return entry.name;
    +    }
    +    /**
    +     * Return the dirname for the provided string or Path object
    +     */
    +    dirname(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return (entry.parent || entry).fullpath();
    +    }
    +    async readdir(entry = this.cwd, opts = {
    +        withFileTypes: true,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes } = opts;
    +        if (!entry.canReaddir()) {
    +            return [];
    +        }
    +        else {
    +            const p = await entry.readdir();
    +            return withFileTypes ? p : p.map(e => e.name);
    +        }
    +    }
    +    readdirSync(entry = this.cwd, opts = {
    +        withFileTypes: true,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true } = opts;
    +        if (!entry.canReaddir()) {
    +            return [];
    +        }
    +        else if (withFileTypes) {
    +            return entry.readdirSync();
    +        }
    +        else {
    +            return entry.readdirSync().map(e => e.name);
    +        }
    +    }
    +    /**
    +     * Call lstat() on the string or Path object, and update all known
    +     * information that can be determined.
    +     *
    +     * Note that unlike `fs.lstat()`, the returned value does not contain some
    +     * information, such as `mode`, `dev`, `nlink`, and `ino`.  If that
    +     * information is required, you will need to call `fs.lstat` yourself.
    +     *
    +     * If the Path refers to a nonexistent file, or if the lstat call fails for
    +     * any reason, `undefined` is returned.  Otherwise the updated Path object is
    +     * returned.
    +     *
    +     * Results are cached, and thus may be out of date if the filesystem is
    +     * mutated.
    +     */
    +    async lstat(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return entry.lstat();
    +    }
    +    /**
    +     * synchronous {@link PathScurryBase.lstat}
    +     */
    +    lstatSync(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return entry.lstatSync();
    +    }
    +    async readlink(entry = this.cwd, { withFileTypes } = {
    +        withFileTypes: false,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            withFileTypes = entry.withFileTypes;
    +            entry = this.cwd;
    +        }
    +        const e = await entry.readlink();
    +        return withFileTypes ? e : e?.fullpath();
    +    }
    +    readlinkSync(entry = this.cwd, { withFileTypes } = {
    +        withFileTypes: false,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            withFileTypes = entry.withFileTypes;
    +            entry = this.cwd;
    +        }
    +        const e = entry.readlinkSync();
    +        return withFileTypes ? e : e?.fullpath();
    +    }
    +    async realpath(entry = this.cwd, { withFileTypes } = {
    +        withFileTypes: false,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            withFileTypes = entry.withFileTypes;
    +            entry = this.cwd;
    +        }
    +        const e = await entry.realpath();
    +        return withFileTypes ? e : e?.fullpath();
    +    }
    +    realpathSync(entry = this.cwd, { withFileTypes } = {
    +        withFileTypes: false,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            withFileTypes = entry.withFileTypes;
    +            entry = this.cwd;
    +        }
    +        const e = entry.realpathSync();
    +        return withFileTypes ? e : e?.fullpath();
    +    }
    +    async walk(entry = this.cwd, opts = {}) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true, follow = false, filter, walkFilter, } = opts;
    +        const results = [];
    +        if (!filter || filter(entry)) {
    +            results.push(withFileTypes ? entry : entry.fullpath());
    +        }
    +        const dirs = new Set();
    +        const walk = (dir, cb) => {
    +            dirs.add(dir);
    +            dir.readdirCB((er, entries) => {
    +                /* c8 ignore start */
    +                if (er) {
    +                    return cb(er);
    +                }
    +                /* c8 ignore stop */
    +                let len = entries.length;
    +                if (!len)
    +                    return cb();
    +                const next = () => {
    +                    if (--len === 0) {
    +                        cb();
    +                    }
    +                };
    +                for (const e of entries) {
    +                    if (!filter || filter(e)) {
    +                        results.push(withFileTypes ? e : e.fullpath());
    +                    }
    +                    if (follow && e.isSymbolicLink()) {
    +                        e.realpath()
    +                            .then(r => (r?.isUnknown() ? r.lstat() : r))
    +                            .then(r => r?.shouldWalk(dirs, walkFilter) ? walk(r, next) : next());
    +                    }
    +                    else {
    +                        if (e.shouldWalk(dirs, walkFilter)) {
    +                            walk(e, next);
    +                        }
    +                        else {
    +                            next();
    +                        }
    +                    }
    +                }
    +            }, true); // zalgooooooo
    +        };
    +        const start = entry;
    +        return new Promise((res, rej) => {
    +            walk(start, er => {
    +                /* c8 ignore start */
    +                if (er)
    +                    return rej(er);
    +                /* c8 ignore stop */
    +                res(results);
    +            });
    +        });
    +    }
    +    walkSync(entry = this.cwd, opts = {}) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true, follow = false, filter, walkFilter, } = opts;
    +        const results = [];
    +        if (!filter || filter(entry)) {
    +            results.push(withFileTypes ? entry : entry.fullpath());
    +        }
    +        const dirs = new Set([entry]);
    +        for (const dir of dirs) {
    +            const entries = dir.readdirSync();
    +            for (const e of entries) {
    +                if (!filter || filter(e)) {
    +                    results.push(withFileTypes ? e : e.fullpath());
    +                }
    +                let r = e;
    +                if (e.isSymbolicLink()) {
    +                    if (!(follow && (r = e.realpathSync())))
    +                        continue;
    +                    if (r.isUnknown())
    +                        r.lstatSync();
    +                }
    +                if (r.shouldWalk(dirs, walkFilter)) {
    +                    dirs.add(r);
    +                }
    +            }
    +        }
    +        return results;
    +    }
    +    /**
    +     * Support for `for await`
    +     *
    +     * Alias for {@link PathScurryBase.iterate}
    +     *
    +     * Note: As of Node 19, this is very slow, compared to other methods of
    +     * walking.  Consider using {@link PathScurryBase.stream} if memory overhead
    +     * and backpressure are concerns, or {@link PathScurryBase.walk} if not.
    +     */
    +    [Symbol.asyncIterator]() {
    +        return this.iterate();
    +    }
    +    iterate(entry = this.cwd, options = {}) {
    +        // iterating async over the stream is significantly more performant,
    +        // especially in the warm-cache scenario, because it buffers up directory
    +        // entries in the background instead of waiting for a yield for each one.
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            options = entry;
    +            entry = this.cwd;
    +        }
    +        return this.stream(entry, options)[Symbol.asyncIterator]();
    +    }
    +    /**
    +     * Iterating over a PathScurry performs a synchronous walk.
    +     *
    +     * Alias for {@link PathScurryBase.iterateSync}
    +     */
    +    [Symbol.iterator]() {
    +        return this.iterateSync();
    +    }
    +    *iterateSync(entry = this.cwd, opts = {}) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true, follow = false, filter, walkFilter, } = opts;
    +        if (!filter || filter(entry)) {
    +            yield withFileTypes ? entry : entry.fullpath();
    +        }
    +        const dirs = new Set([entry]);
    +        for (const dir of dirs) {
    +            const entries = dir.readdirSync();
    +            for (const e of entries) {
    +                if (!filter || filter(e)) {
    +                    yield withFileTypes ? e : e.fullpath();
    +                }
    +                let r = e;
    +                if (e.isSymbolicLink()) {
    +                    if (!(follow && (r = e.realpathSync())))
    +                        continue;
    +                    if (r.isUnknown())
    +                        r.lstatSync();
    +                }
    +                if (r.shouldWalk(dirs, walkFilter)) {
    +                    dirs.add(r);
    +                }
    +            }
    +        }
    +    }
    +    stream(entry = this.cwd, opts = {}) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true, follow = false, filter, walkFilter, } = opts;
    +        const results = new minipass_1.Minipass({ objectMode: true });
    +        if (!filter || filter(entry)) {
    +            results.write(withFileTypes ? entry : entry.fullpath());
    +        }
    +        const dirs = new Set();
    +        const queue = [entry];
    +        let processing = 0;
    +        const process = () => {
    +            let paused = false;
    +            while (!paused) {
    +                const dir = queue.shift();
    +                if (!dir) {
    +                    if (processing === 0)
    +                        results.end();
    +                    return;
    +                }
    +                processing++;
    +                dirs.add(dir);
    +                const onReaddir = (er, entries, didRealpaths = false) => {
    +                    /* c8 ignore start */
    +                    if (er)
    +                        return results.emit('error', er);
    +                    /* c8 ignore stop */
    +                    if (follow && !didRealpaths) {
    +                        const promises = [];
    +                        for (const e of entries) {
    +                            if (e.isSymbolicLink()) {
    +                                promises.push(e
    +                                    .realpath()
    +                                    .then((r) => r?.isUnknown() ? r.lstat() : r));
    +                            }
    +                        }
    +                        if (promises.length) {
    +                            Promise.all(promises).then(() => onReaddir(null, entries, true));
    +                            return;
    +                        }
    +                    }
    +                    for (const e of entries) {
    +                        if (e && (!filter || filter(e))) {
    +                            if (!results.write(withFileTypes ? e : e.fullpath())) {
    +                                paused = true;
    +                            }
    +                        }
    +                    }
    +                    processing--;
    +                    for (const e of entries) {
    +                        const r = e.realpathCached() || e;
    +                        if (r.shouldWalk(dirs, walkFilter)) {
    +                            queue.push(r);
    +                        }
    +                    }
    +                    if (paused && !results.flowing) {
    +                        results.once('drain', process);
    +                    }
    +                    else if (!sync) {
    +                        process();
    +                    }
    +                };
    +                // zalgo containment
    +                let sync = true;
    +                dir.readdirCB(onReaddir, true);
    +                sync = false;
    +            }
    +        };
    +        process();
    +        return results;
    +    }
    +    streamSync(entry = this.cwd, opts = {}) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true, follow = false, filter, walkFilter, } = opts;
    +        const results = new minipass_1.Minipass({ objectMode: true });
    +        const dirs = new Set();
    +        if (!filter || filter(entry)) {
    +            results.write(withFileTypes ? entry : entry.fullpath());
    +        }
    +        const queue = [entry];
    +        let processing = 0;
    +        const process = () => {
    +            let paused = false;
    +            while (!paused) {
    +                const dir = queue.shift();
    +                if (!dir) {
    +                    if (processing === 0)
    +                        results.end();
    +                    return;
    +                }
    +                processing++;
    +                dirs.add(dir);
    +                const entries = dir.readdirSync();
    +                for (const e of entries) {
    +                    if (!filter || filter(e)) {
    +                        if (!results.write(withFileTypes ? e : e.fullpath())) {
    +                            paused = true;
    +                        }
    +                    }
    +                }
    +                processing--;
    +                for (const e of entries) {
    +                    let r = e;
    +                    if (e.isSymbolicLink()) {
    +                        if (!(follow && (r = e.realpathSync())))
    +                            continue;
    +                        if (r.isUnknown())
    +                            r.lstatSync();
    +                    }
    +                    if (r.shouldWalk(dirs, walkFilter)) {
    +                        queue.push(r);
    +                    }
    +                }
    +            }
    +            if (paused && !results.flowing)
    +                results.once('drain', process);
    +        };
    +        process();
    +        return results;
    +    }
    +    chdir(path = this.cwd) {
    +        const oldCwd = this.cwd;
    +        this.cwd = typeof path === 'string' ? this.cwd.resolve(path) : path;
    +        this.cwd[setAsCwd](oldCwd);
    +    }
    +}
    +exports.PathScurryBase = PathScurryBase;
    +/**
    + * Windows implementation of {@link PathScurryBase}
    + *
    + * Defaults to case insensitve, uses `'\\'` to generate path strings.  Uses
    + * {@link PathWin32} for Path objects.
    + */
    +class PathScurryWin32 extends PathScurryBase {
    +    /**
    +     * separator for generating path strings
    +     */
    +    sep = '\\';
    +    constructor(cwd = process.cwd(), opts = {}) {
    +        const { nocase = true } = opts;
    +        super(cwd, node_path_1.win32, '\\', { ...opts, nocase });
    +        this.nocase = nocase;
    +        for (let p = this.cwd; p; p = p.parent) {
    +            p.nocase = this.nocase;
    +        }
    +    }
    +    /**
    +     * @internal
    +     */
    +    parseRootPath(dir) {
    +        // if the path starts with a single separator, it's not a UNC, and we'll
    +        // just get separator as the root, and driveFromUNC will return \
    +        // In that case, mount \ on the root from the cwd.
    +        return node_path_1.win32.parse(dir).root.toUpperCase();
    +    }
    +    /**
    +     * @internal
    +     */
    +    newRoot(fs) {
    +        return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs });
    +    }
    +    /**
    +     * Return true if the provided path string is an absolute path
    +     */
    +    isAbsolute(p) {
    +        return (p.startsWith('/') || p.startsWith('\\') || /^[a-z]:(\/|\\)/i.test(p));
    +    }
    +}
    +exports.PathScurryWin32 = PathScurryWin32;
    +/**
    + * {@link PathScurryBase} implementation for all posix systems other than Darwin.
    + *
    + * Defaults to case-sensitive matching, uses `'/'` to generate path strings.
    + *
    + * Uses {@link PathPosix} for Path objects.
    + */
    +class PathScurryPosix extends PathScurryBase {
    +    /**
    +     * separator for generating path strings
    +     */
    +    sep = '/';
    +    constructor(cwd = process.cwd(), opts = {}) {
    +        const { nocase = false } = opts;
    +        super(cwd, node_path_1.posix, '/', { ...opts, nocase });
    +        this.nocase = nocase;
    +    }
    +    /**
    +     * @internal
    +     */
    +    parseRootPath(_dir) {
    +        return '/';
    +    }
    +    /**
    +     * @internal
    +     */
    +    newRoot(fs) {
    +        return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs });
    +    }
    +    /**
    +     * Return true if the provided path string is an absolute path
    +     */
    +    isAbsolute(p) {
    +        return p.startsWith('/');
    +    }
    +}
    +exports.PathScurryPosix = PathScurryPosix;
    +/**
    + * {@link PathScurryBase} implementation for Darwin (macOS) systems.
    + *
    + * Defaults to case-insensitive matching, uses `'/'` for generating path
    + * strings.
    + *
    + * Uses {@link PathPosix} for Path objects.
    + */
    +class PathScurryDarwin extends PathScurryPosix {
    +    constructor(cwd = process.cwd(), opts = {}) {
    +        const { nocase = true } = opts;
    +        super(cwd, { ...opts, nocase });
    +    }
    +}
    +exports.PathScurryDarwin = PathScurryDarwin;
    +/**
    + * Default {@link PathBase} implementation for the current platform.
    + *
    + * {@link PathWin32} on Windows systems, {@link PathPosix} on all others.
    + */
    +exports.Path = process.platform === 'win32' ? PathWin32 : PathPosix;
    +/**
    + * Default {@link PathScurryBase} implementation for the current platform.
    + *
    + * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on
    + * Darwin (macOS) systems, {@link PathScurryPosix} on all others.
    + */
    +exports.PathScurry = process.platform === 'win32' ? PathScurryWin32
    +    : process.platform === 'darwin' ? PathScurryDarwin
    +        : PathScurryPosix;
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/path-scurry/dist/commonjs/package.json b/node_modules/npm/node_modules/path-scurry/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/path-scurry/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/path-scurry/dist/esm/index.js b/node_modules/npm/node_modules/path-scurry/dist/esm/index.js
    new file mode 100644
    index 00000000..3b11b819
    --- /dev/null
    +++ b/node_modules/npm/node_modules/path-scurry/dist/esm/index.js
    @@ -0,0 +1,1979 @@
    +import { LRUCache } from 'lru-cache';
    +import { posix, win32 } from 'node:path';
    +import { fileURLToPath } from 'node:url';
    +import { lstatSync, readdir as readdirCB, readdirSync, readlinkSync, realpathSync as rps, } from 'fs';
    +import * as actualFS from 'node:fs';
    +const realpathSync = rps.native;
    +// TODO: test perf of fs/promises realpath vs realpathCB,
    +// since the promises one uses realpath.native
    +import { lstat, readdir, readlink, realpath } from 'node:fs/promises';
    +import { Minipass } from 'minipass';
    +const defaultFS = {
    +    lstatSync,
    +    readdir: readdirCB,
    +    readdirSync,
    +    readlinkSync,
    +    realpathSync,
    +    promises: {
    +        lstat,
    +        readdir,
    +        readlink,
    +        realpath,
    +    },
    +};
    +// if they just gave us require('fs') then use our default
    +const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === actualFS ?
    +    defaultFS
    +    : {
    +        ...defaultFS,
    +        ...fsOption,
    +        promises: {
    +            ...defaultFS.promises,
    +            ...(fsOption.promises || {}),
    +        },
    +    };
    +// turn something like //?/c:/ into c:\
    +const uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i;
    +const uncToDrive = (rootPath) => rootPath.replace(/\//g, '\\').replace(uncDriveRegexp, '$1\\');
    +// windows paths are separated by either / or \
    +const eitherSep = /[\\\/]/;
    +const UNKNOWN = 0; // may not even exist, for all we know
    +const IFIFO = 0b0001;
    +const IFCHR = 0b0010;
    +const IFDIR = 0b0100;
    +const IFBLK = 0b0110;
    +const IFREG = 0b1000;
    +const IFLNK = 0b1010;
    +const IFSOCK = 0b1100;
    +const IFMT = 0b1111;
    +// mask to unset low 4 bits
    +const IFMT_UNKNOWN = ~IFMT;
    +// set after successfully calling readdir() and getting entries.
    +const READDIR_CALLED = 0b0000_0001_0000;
    +// set after a successful lstat()
    +const LSTAT_CALLED = 0b0000_0010_0000;
    +// set if an entry (or one of its parents) is definitely not a dir
    +const ENOTDIR = 0b0000_0100_0000;
    +// set if an entry (or one of its parents) does not exist
    +// (can also be set on lstat errors like EACCES or ENAMETOOLONG)
    +const ENOENT = 0b0000_1000_0000;
    +// cannot have child entries -- also verify &IFMT is either IFDIR or IFLNK
    +// set if we fail to readlink
    +const ENOREADLINK = 0b0001_0000_0000;
    +// set if we know realpath() will fail
    +const ENOREALPATH = 0b0010_0000_0000;
    +const ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH;
    +const TYPEMASK = 0b0011_1111_1111;
    +const entToType = (s) => s.isFile() ? IFREG
    +    : s.isDirectory() ? IFDIR
    +        : s.isSymbolicLink() ? IFLNK
    +            : s.isCharacterDevice() ? IFCHR
    +                : s.isBlockDevice() ? IFBLK
    +                    : s.isSocket() ? IFSOCK
    +                        : s.isFIFO() ? IFIFO
    +                            : UNKNOWN;
    +// normalize unicode path names
    +const normalizeCache = new Map();
    +const normalize = (s) => {
    +    const c = normalizeCache.get(s);
    +    if (c)
    +        return c;
    +    const n = s.normalize('NFKD');
    +    normalizeCache.set(s, n);
    +    return n;
    +};
    +const normalizeNocaseCache = new Map();
    +const normalizeNocase = (s) => {
    +    const c = normalizeNocaseCache.get(s);
    +    if (c)
    +        return c;
    +    const n = normalize(s.toLowerCase());
    +    normalizeNocaseCache.set(s, n);
    +    return n;
    +};
    +/**
    + * An LRUCache for storing resolved path strings or Path objects.
    + * @internal
    + */
    +export class ResolveCache extends LRUCache {
    +    constructor() {
    +        super({ max: 256 });
    +    }
    +}
    +// In order to prevent blowing out the js heap by allocating hundreds of
    +// thousands of Path entries when walking extremely large trees, the "children"
    +// in this tree are represented by storing an array of Path entries in an
    +// LRUCache, indexed by the parent.  At any time, Path.children() may return an
    +// empty array, indicating that it doesn't know about any of its children, and
    +// thus has to rebuild that cache.  This is fine, it just means that we don't
    +// benefit as much from having the cached entries, but huge directory walks
    +// don't blow out the stack, and smaller ones are still as fast as possible.
    +//
    +//It does impose some complexity when building up the readdir data, because we
    +//need to pass a reference to the children array that we started with.
    +/**
    + * an LRUCache for storing child entries.
    + * @internal
    + */
    +export class ChildrenCache extends LRUCache {
    +    constructor(maxSize = 16 * 1024) {
    +        super({
    +            maxSize,
    +            // parent + children
    +            sizeCalculation: a => a.length + 1,
    +        });
    +    }
    +}
    +const setAsCwd = Symbol('PathScurry setAsCwd');
    +/**
    + * Path objects are sort of like a super-powered
    + * {@link https://nodejs.org/docs/latest/api/fs.html#class-fsdirent fs.Dirent}
    + *
    + * Each one represents a single filesystem entry on disk, which may or may not
    + * exist. It includes methods for reading various types of information via
    + * lstat, readlink, and readdir, and caches all information to the greatest
    + * degree possible.
    + *
    + * Note that fs operations that would normally throw will instead return an
    + * "empty" value. This is in order to prevent excessive overhead from error
    + * stack traces.
    + */
    +export class PathBase {
    +    /**
    +     * the basename of this path
    +     *
    +     * **Important**: *always* test the path name against any test string
    +     * usingthe {@link isNamed} method, and not by directly comparing this
    +     * string. Otherwise, unicode path strings that the system sees as identical
    +     * will not be properly treated as the same path, leading to incorrect
    +     * behavior and possible security issues.
    +     */
    +    name;
    +    /**
    +     * the Path entry corresponding to the path root.
    +     *
    +     * @internal
    +     */
    +    root;
    +    /**
    +     * All roots found within the current PathScurry family
    +     *
    +     * @internal
    +     */
    +    roots;
    +    /**
    +     * a reference to the parent path, or undefined in the case of root entries
    +     *
    +     * @internal
    +     */
    +    parent;
    +    /**
    +     * boolean indicating whether paths are compared case-insensitively
    +     * @internal
    +     */
    +    nocase;
    +    /**
    +     * boolean indicating that this path is the current working directory
    +     * of the PathScurry collection that contains it.
    +     */
    +    isCWD = false;
    +    // potential default fs override
    +    #fs;
    +    // Stats fields
    +    #dev;
    +    get dev() {
    +        return this.#dev;
    +    }
    +    #mode;
    +    get mode() {
    +        return this.#mode;
    +    }
    +    #nlink;
    +    get nlink() {
    +        return this.#nlink;
    +    }
    +    #uid;
    +    get uid() {
    +        return this.#uid;
    +    }
    +    #gid;
    +    get gid() {
    +        return this.#gid;
    +    }
    +    #rdev;
    +    get rdev() {
    +        return this.#rdev;
    +    }
    +    #blksize;
    +    get blksize() {
    +        return this.#blksize;
    +    }
    +    #ino;
    +    get ino() {
    +        return this.#ino;
    +    }
    +    #size;
    +    get size() {
    +        return this.#size;
    +    }
    +    #blocks;
    +    get blocks() {
    +        return this.#blocks;
    +    }
    +    #atimeMs;
    +    get atimeMs() {
    +        return this.#atimeMs;
    +    }
    +    #mtimeMs;
    +    get mtimeMs() {
    +        return this.#mtimeMs;
    +    }
    +    #ctimeMs;
    +    get ctimeMs() {
    +        return this.#ctimeMs;
    +    }
    +    #birthtimeMs;
    +    get birthtimeMs() {
    +        return this.#birthtimeMs;
    +    }
    +    #atime;
    +    get atime() {
    +        return this.#atime;
    +    }
    +    #mtime;
    +    get mtime() {
    +        return this.#mtime;
    +    }
    +    #ctime;
    +    get ctime() {
    +        return this.#ctime;
    +    }
    +    #birthtime;
    +    get birthtime() {
    +        return this.#birthtime;
    +    }
    +    #matchName;
    +    #depth;
    +    #fullpath;
    +    #fullpathPosix;
    +    #relative;
    +    #relativePosix;
    +    #type;
    +    #children;
    +    #linkTarget;
    +    #realpath;
    +    /**
    +     * This property is for compatibility with the Dirent class as of
    +     * Node v20, where Dirent['parentPath'] refers to the path of the
    +     * directory that was passed to readdir. For root entries, it's the path
    +     * to the entry itself.
    +     */
    +    get parentPath() {
    +        return (this.parent || this).fullpath();
    +    }
    +    /**
    +     * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
    +     * this property refers to the *parent* path, not the path object itself.
    +     */
    +    get path() {
    +        return this.parentPath;
    +    }
    +    /**
    +     * Do not create new Path objects directly.  They should always be accessed
    +     * via the PathScurry class or other methods on the Path class.
    +     *
    +     * @internal
    +     */
    +    constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
    +        this.name = name;
    +        this.#matchName = nocase ? normalizeNocase(name) : normalize(name);
    +        this.#type = type & TYPEMASK;
    +        this.nocase = nocase;
    +        this.roots = roots;
    +        this.root = root || this;
    +        this.#children = children;
    +        this.#fullpath = opts.fullpath;
    +        this.#relative = opts.relative;
    +        this.#relativePosix = opts.relativePosix;
    +        this.parent = opts.parent;
    +        if (this.parent) {
    +            this.#fs = this.parent.#fs;
    +        }
    +        else {
    +            this.#fs = fsFromOption(opts.fs);
    +        }
    +    }
    +    /**
    +     * Returns the depth of the Path object from its root.
    +     *
    +     * For example, a path at `/foo/bar` would have a depth of 2.
    +     */
    +    depth() {
    +        if (this.#depth !== undefined)
    +            return this.#depth;
    +        if (!this.parent)
    +            return (this.#depth = 0);
    +        return (this.#depth = this.parent.depth() + 1);
    +    }
    +    /**
    +     * @internal
    +     */
    +    childrenCache() {
    +        return this.#children;
    +    }
    +    /**
    +     * Get the Path object referenced by the string path, resolved from this Path
    +     */
    +    resolve(path) {
    +        if (!path) {
    +            return this;
    +        }
    +        const rootPath = this.getRootString(path);
    +        const dir = path.substring(rootPath.length);
    +        const dirParts = dir.split(this.splitSep);
    +        const result = rootPath ?
    +            this.getRoot(rootPath).#resolveParts(dirParts)
    +            : this.#resolveParts(dirParts);
    +        return result;
    +    }
    +    #resolveParts(dirParts) {
    +        let p = this;
    +        for (const part of dirParts) {
    +            p = p.child(part);
    +        }
    +        return p;
    +    }
    +    /**
    +     * Returns the cached children Path objects, if still available.  If they
    +     * have fallen out of the cache, then returns an empty array, and resets the
    +     * READDIR_CALLED bit, so that future calls to readdir() will require an fs
    +     * lookup.
    +     *
    +     * @internal
    +     */
    +    children() {
    +        const cached = this.#children.get(this);
    +        if (cached) {
    +            return cached;
    +        }
    +        const children = Object.assign([], { provisional: 0 });
    +        this.#children.set(this, children);
    +        this.#type &= ~READDIR_CALLED;
    +        return children;
    +    }
    +    /**
    +     * Resolves a path portion and returns or creates the child Path.
    +     *
    +     * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is
    +     * `'..'`.
    +     *
    +     * This should not be called directly.  If `pathPart` contains any path
    +     * separators, it will lead to unsafe undefined behavior.
    +     *
    +     * Use `Path.resolve()` instead.
    +     *
    +     * @internal
    +     */
    +    child(pathPart, opts) {
    +        if (pathPart === '' || pathPart === '.') {
    +            return this;
    +        }
    +        if (pathPart === '..') {
    +            return this.parent || this;
    +        }
    +        // find the child
    +        const children = this.children();
    +        const name = this.nocase ? normalizeNocase(pathPart) : normalize(pathPart);
    +        for (const p of children) {
    +            if (p.#matchName === name) {
    +                return p;
    +            }
    +        }
    +        // didn't find it, create provisional child, since it might not
    +        // actually exist.  If we know the parent isn't a dir, then
    +        // in fact it CAN'T exist.
    +        const s = this.parent ? this.sep : '';
    +        const fullpath = this.#fullpath ? this.#fullpath + s + pathPart : undefined;
    +        const pchild = this.newChild(pathPart, UNKNOWN, {
    +            ...opts,
    +            parent: this,
    +            fullpath,
    +        });
    +        if (!this.canReaddir()) {
    +            pchild.#type |= ENOENT;
    +        }
    +        // don't have to update provisional, because if we have real children,
    +        // then provisional is set to children.length, otherwise a lower number
    +        children.push(pchild);
    +        return pchild;
    +    }
    +    /**
    +     * The relative path from the cwd. If it does not share an ancestor with
    +     * the cwd, then this ends up being equivalent to the fullpath()
    +     */
    +    relative() {
    +        if (this.isCWD)
    +            return '';
    +        if (this.#relative !== undefined) {
    +            return this.#relative;
    +        }
    +        const name = this.name;
    +        const p = this.parent;
    +        if (!p) {
    +            return (this.#relative = this.name);
    +        }
    +        const pv = p.relative();
    +        return pv + (!pv || !p.parent ? '' : this.sep) + name;
    +    }
    +    /**
    +     * The relative path from the cwd, using / as the path separator.
    +     * If it does not share an ancestor with
    +     * the cwd, then this ends up being equivalent to the fullpathPosix()
    +     * On posix systems, this is identical to relative().
    +     */
    +    relativePosix() {
    +        if (this.sep === '/')
    +            return this.relative();
    +        if (this.isCWD)
    +            return '';
    +        if (this.#relativePosix !== undefined)
    +            return this.#relativePosix;
    +        const name = this.name;
    +        const p = this.parent;
    +        if (!p) {
    +            return (this.#relativePosix = this.fullpathPosix());
    +        }
    +        const pv = p.relativePosix();
    +        return pv + (!pv || !p.parent ? '' : '/') + name;
    +    }
    +    /**
    +     * The fully resolved path string for this Path entry
    +     */
    +    fullpath() {
    +        if (this.#fullpath !== undefined) {
    +            return this.#fullpath;
    +        }
    +        const name = this.name;
    +        const p = this.parent;
    +        if (!p) {
    +            return (this.#fullpath = this.name);
    +        }
    +        const pv = p.fullpath();
    +        const fp = pv + (!p.parent ? '' : this.sep) + name;
    +        return (this.#fullpath = fp);
    +    }
    +    /**
    +     * On platforms other than windows, this is identical to fullpath.
    +     *
    +     * On windows, this is overridden to return the forward-slash form of the
    +     * full UNC path.
    +     */
    +    fullpathPosix() {
    +        if (this.#fullpathPosix !== undefined)
    +            return this.#fullpathPosix;
    +        if (this.sep === '/')
    +            return (this.#fullpathPosix = this.fullpath());
    +        if (!this.parent) {
    +            const p = this.fullpath().replace(/\\/g, '/');
    +            if (/^[a-z]:\//i.test(p)) {
    +                return (this.#fullpathPosix = `//?/${p}`);
    +            }
    +            else {
    +                return (this.#fullpathPosix = p);
    +            }
    +        }
    +        const p = this.parent;
    +        const pfpp = p.fullpathPosix();
    +        const fpp = pfpp + (!pfpp || !p.parent ? '' : '/') + this.name;
    +        return (this.#fullpathPosix = fpp);
    +    }
    +    /**
    +     * Is the Path of an unknown type?
    +     *
    +     * Note that we might know *something* about it if there has been a previous
    +     * filesystem operation, for example that it does not exist, or is not a
    +     * link, or whether it has child entries.
    +     */
    +    isUnknown() {
    +        return (this.#type & IFMT) === UNKNOWN;
    +    }
    +    isType(type) {
    +        return this[`is${type}`]();
    +    }
    +    getType() {
    +        return (this.isUnknown() ? 'Unknown'
    +            : this.isDirectory() ? 'Directory'
    +                : this.isFile() ? 'File'
    +                    : this.isSymbolicLink() ? 'SymbolicLink'
    +                        : this.isFIFO() ? 'FIFO'
    +                            : this.isCharacterDevice() ? 'CharacterDevice'
    +                                : this.isBlockDevice() ? 'BlockDevice'
    +                                    : /* c8 ignore start */ this.isSocket() ? 'Socket'
    +                                        : 'Unknown');
    +        /* c8 ignore stop */
    +    }
    +    /**
    +     * Is the Path a regular file?
    +     */
    +    isFile() {
    +        return (this.#type & IFMT) === IFREG;
    +    }
    +    /**
    +     * Is the Path a directory?
    +     */
    +    isDirectory() {
    +        return (this.#type & IFMT) === IFDIR;
    +    }
    +    /**
    +     * Is the path a character device?
    +     */
    +    isCharacterDevice() {
    +        return (this.#type & IFMT) === IFCHR;
    +    }
    +    /**
    +     * Is the path a block device?
    +     */
    +    isBlockDevice() {
    +        return (this.#type & IFMT) === IFBLK;
    +    }
    +    /**
    +     * Is the path a FIFO pipe?
    +     */
    +    isFIFO() {
    +        return (this.#type & IFMT) === IFIFO;
    +    }
    +    /**
    +     * Is the path a socket?
    +     */
    +    isSocket() {
    +        return (this.#type & IFMT) === IFSOCK;
    +    }
    +    /**
    +     * Is the path a symbolic link?
    +     */
    +    isSymbolicLink() {
    +        return (this.#type & IFLNK) === IFLNK;
    +    }
    +    /**
    +     * Return the entry if it has been subject of a successful lstat, or
    +     * undefined otherwise.
    +     *
    +     * Does not read the filesystem, so an undefined result *could* simply
    +     * mean that we haven't called lstat on it.
    +     */
    +    lstatCached() {
    +        return this.#type & LSTAT_CALLED ? this : undefined;
    +    }
    +    /**
    +     * Return the cached link target if the entry has been the subject of a
    +     * successful readlink, or undefined otherwise.
    +     *
    +     * Does not read the filesystem, so an undefined result *could* just mean we
    +     * don't have any cached data. Only use it if you are very sure that a
    +     * readlink() has been called at some point.
    +     */
    +    readlinkCached() {
    +        return this.#linkTarget;
    +    }
    +    /**
    +     * Returns the cached realpath target if the entry has been the subject
    +     * of a successful realpath, or undefined otherwise.
    +     *
    +     * Does not read the filesystem, so an undefined result *could* just mean we
    +     * don't have any cached data. Only use it if you are very sure that a
    +     * realpath() has been called at some point.
    +     */
    +    realpathCached() {
    +        return this.#realpath;
    +    }
    +    /**
    +     * Returns the cached child Path entries array if the entry has been the
    +     * subject of a successful readdir(), or [] otherwise.
    +     *
    +     * Does not read the filesystem, so an empty array *could* just mean we
    +     * don't have any cached data. Only use it if you are very sure that a
    +     * readdir() has been called recently enough to still be valid.
    +     */
    +    readdirCached() {
    +        const children = this.children();
    +        return children.slice(0, children.provisional);
    +    }
    +    /**
    +     * Return true if it's worth trying to readlink.  Ie, we don't (yet) have
    +     * any indication that readlink will definitely fail.
    +     *
    +     * Returns false if the path is known to not be a symlink, if a previous
    +     * readlink failed, or if the entry does not exist.
    +     */
    +    canReadlink() {
    +        if (this.#linkTarget)
    +            return true;
    +        if (!this.parent)
    +            return false;
    +        // cases where it cannot possibly succeed
    +        const ifmt = this.#type & IFMT;
    +        return !((ifmt !== UNKNOWN && ifmt !== IFLNK) ||
    +            this.#type & ENOREADLINK ||
    +            this.#type & ENOENT);
    +    }
    +    /**
    +     * Return true if readdir has previously been successfully called on this
    +     * path, indicating that cachedReaddir() is likely valid.
    +     */
    +    calledReaddir() {
    +        return !!(this.#type & READDIR_CALLED);
    +    }
    +    /**
    +     * Returns true if the path is known to not exist. That is, a previous lstat
    +     * or readdir failed to verify its existence when that would have been
    +     * expected, or a parent entry was marked either enoent or enotdir.
    +     */
    +    isENOENT() {
    +        return !!(this.#type & ENOENT);
    +    }
    +    /**
    +     * Return true if the path is a match for the given path name.  This handles
    +     * case sensitivity and unicode normalization.
    +     *
    +     * Note: even on case-sensitive systems, it is **not** safe to test the
    +     * equality of the `.name` property to determine whether a given pathname
    +     * matches, due to unicode normalization mismatches.
    +     *
    +     * Always use this method instead of testing the `path.name` property
    +     * directly.
    +     */
    +    isNamed(n) {
    +        return !this.nocase ?
    +            this.#matchName === normalize(n)
    +            : this.#matchName === normalizeNocase(n);
    +    }
    +    /**
    +     * Return the Path object corresponding to the target of a symbolic link.
    +     *
    +     * If the Path is not a symbolic link, or if the readlink call fails for any
    +     * reason, `undefined` is returned.
    +     *
    +     * Result is cached, and thus may be outdated if the filesystem is mutated.
    +     */
    +    async readlink() {
    +        const target = this.#linkTarget;
    +        if (target) {
    +            return target;
    +        }
    +        if (!this.canReadlink()) {
    +            return undefined;
    +        }
    +        /* c8 ignore start */
    +        // already covered by the canReadlink test, here for ts grumples
    +        if (!this.parent) {
    +            return undefined;
    +        }
    +        /* c8 ignore stop */
    +        try {
    +            const read = await this.#fs.promises.readlink(this.fullpath());
    +            const linkTarget = (await this.parent.realpath())?.resolve(read);
    +            if (linkTarget) {
    +                return (this.#linkTarget = linkTarget);
    +            }
    +        }
    +        catch (er) {
    +            this.#readlinkFail(er.code);
    +            return undefined;
    +        }
    +    }
    +    /**
    +     * Synchronous {@link PathBase.readlink}
    +     */
    +    readlinkSync() {
    +        const target = this.#linkTarget;
    +        if (target) {
    +            return target;
    +        }
    +        if (!this.canReadlink()) {
    +            return undefined;
    +        }
    +        /* c8 ignore start */
    +        // already covered by the canReadlink test, here for ts grumples
    +        if (!this.parent) {
    +            return undefined;
    +        }
    +        /* c8 ignore stop */
    +        try {
    +            const read = this.#fs.readlinkSync(this.fullpath());
    +            const linkTarget = this.parent.realpathSync()?.resolve(read);
    +            if (linkTarget) {
    +                return (this.#linkTarget = linkTarget);
    +            }
    +        }
    +        catch (er) {
    +            this.#readlinkFail(er.code);
    +            return undefined;
    +        }
    +    }
    +    #readdirSuccess(children) {
    +        // succeeded, mark readdir called bit
    +        this.#type |= READDIR_CALLED;
    +        // mark all remaining provisional children as ENOENT
    +        for (let p = children.provisional; p < children.length; p++) {
    +            const c = children[p];
    +            if (c)
    +                c.#markENOENT();
    +        }
    +    }
    +    #markENOENT() {
    +        // mark as UNKNOWN and ENOENT
    +        if (this.#type & ENOENT)
    +            return;
    +        this.#type = (this.#type | ENOENT) & IFMT_UNKNOWN;
    +        this.#markChildrenENOENT();
    +    }
    +    #markChildrenENOENT() {
    +        // all children are provisional and do not exist
    +        const children = this.children();
    +        children.provisional = 0;
    +        for (const p of children) {
    +            p.#markENOENT();
    +        }
    +    }
    +    #markENOREALPATH() {
    +        this.#type |= ENOREALPATH;
    +        this.#markENOTDIR();
    +    }
    +    // save the information when we know the entry is not a dir
    +    #markENOTDIR() {
    +        // entry is not a directory, so any children can't exist.
    +        // this *should* be impossible, since any children created
    +        // after it's been marked ENOTDIR should be marked ENOENT,
    +        // so it won't even get to this point.
    +        /* c8 ignore start */
    +        if (this.#type & ENOTDIR)
    +            return;
    +        /* c8 ignore stop */
    +        let t = this.#type;
    +        // this could happen if we stat a dir, then delete it,
    +        // then try to read it or one of its children.
    +        if ((t & IFMT) === IFDIR)
    +            t &= IFMT_UNKNOWN;
    +        this.#type = t | ENOTDIR;
    +        this.#markChildrenENOENT();
    +    }
    +    #readdirFail(code = '') {
    +        // markENOTDIR and markENOENT also set provisional=0
    +        if (code === 'ENOTDIR' || code === 'EPERM') {
    +            this.#markENOTDIR();
    +        }
    +        else if (code === 'ENOENT') {
    +            this.#markENOENT();
    +        }
    +        else {
    +            this.children().provisional = 0;
    +        }
    +    }
    +    #lstatFail(code = '') {
    +        // Windows just raises ENOENT in this case, disable for win CI
    +        /* c8 ignore start */
    +        if (code === 'ENOTDIR') {
    +            // already know it has a parent by this point
    +            const p = this.parent;
    +            p.#markENOTDIR();
    +        }
    +        else if (code === 'ENOENT') {
    +            /* c8 ignore stop */
    +            this.#markENOENT();
    +        }
    +    }
    +    #readlinkFail(code = '') {
    +        let ter = this.#type;
    +        ter |= ENOREADLINK;
    +        if (code === 'ENOENT')
    +            ter |= ENOENT;
    +        // windows gets a weird error when you try to readlink a file
    +        if (code === 'EINVAL' || code === 'UNKNOWN') {
    +            // exists, but not a symlink, we don't know WHAT it is, so remove
    +            // all IFMT bits.
    +            ter &= IFMT_UNKNOWN;
    +        }
    +        this.#type = ter;
    +        // windows just gets ENOENT in this case.  We do cover the case,
    +        // just disabled because it's impossible on Windows CI
    +        /* c8 ignore start */
    +        if (code === 'ENOTDIR' && this.parent) {
    +            this.parent.#markENOTDIR();
    +        }
    +        /* c8 ignore stop */
    +    }
    +    #readdirAddChild(e, c) {
    +        return (this.#readdirMaybePromoteChild(e, c) ||
    +            this.#readdirAddNewChild(e, c));
    +    }
    +    #readdirAddNewChild(e, c) {
    +        // alloc new entry at head, so it's never provisional
    +        const type = entToType(e);
    +        const child = this.newChild(e.name, type, { parent: this });
    +        const ifmt = child.#type & IFMT;
    +        if (ifmt !== IFDIR && ifmt !== IFLNK && ifmt !== UNKNOWN) {
    +            child.#type |= ENOTDIR;
    +        }
    +        c.unshift(child);
    +        c.provisional++;
    +        return child;
    +    }
    +    #readdirMaybePromoteChild(e, c) {
    +        for (let p = c.provisional; p < c.length; p++) {
    +            const pchild = c[p];
    +            const name = this.nocase ? normalizeNocase(e.name) : normalize(e.name);
    +            if (name !== pchild.#matchName) {
    +                continue;
    +            }
    +            return this.#readdirPromoteChild(e, pchild, p, c);
    +        }
    +    }
    +    #readdirPromoteChild(e, p, index, c) {
    +        const v = p.name;
    +        // retain any other flags, but set ifmt from dirent
    +        p.#type = (p.#type & IFMT_UNKNOWN) | entToType(e);
    +        // case sensitivity fixing when we learn the true name.
    +        if (v !== e.name)
    +            p.name = e.name;
    +        // just advance provisional index (potentially off the list),
    +        // otherwise we have to splice/pop it out and re-insert at head
    +        if (index !== c.provisional) {
    +            if (index === c.length - 1)
    +                c.pop();
    +            else
    +                c.splice(index, 1);
    +            c.unshift(p);
    +        }
    +        c.provisional++;
    +        return p;
    +    }
    +    /**
    +     * Call lstat() on this Path, and update all known information that can be
    +     * determined.
    +     *
    +     * Note that unlike `fs.lstat()`, the returned value does not contain some
    +     * information, such as `mode`, `dev`, `nlink`, and `ino`.  If that
    +     * information is required, you will need to call `fs.lstat` yourself.
    +     *
    +     * If the Path refers to a nonexistent file, or if the lstat call fails for
    +     * any reason, `undefined` is returned.  Otherwise the updated Path object is
    +     * returned.
    +     *
    +     * Results are cached, and thus may be out of date if the filesystem is
    +     * mutated.
    +     */
    +    async lstat() {
    +        if ((this.#type & ENOENT) === 0) {
    +            try {
    +                this.#applyStat(await this.#fs.promises.lstat(this.fullpath()));
    +                return this;
    +            }
    +            catch (er) {
    +                this.#lstatFail(er.code);
    +            }
    +        }
    +    }
    +    /**
    +     * synchronous {@link PathBase.lstat}
    +     */
    +    lstatSync() {
    +        if ((this.#type & ENOENT) === 0) {
    +            try {
    +                this.#applyStat(this.#fs.lstatSync(this.fullpath()));
    +                return this;
    +            }
    +            catch (er) {
    +                this.#lstatFail(er.code);
    +            }
    +        }
    +    }
    +    #applyStat(st) {
    +        const { atime, atimeMs, birthtime, birthtimeMs, blksize, blocks, ctime, ctimeMs, dev, gid, ino, mode, mtime, mtimeMs, nlink, rdev, size, uid, } = st;
    +        this.#atime = atime;
    +        this.#atimeMs = atimeMs;
    +        this.#birthtime = birthtime;
    +        this.#birthtimeMs = birthtimeMs;
    +        this.#blksize = blksize;
    +        this.#blocks = blocks;
    +        this.#ctime = ctime;
    +        this.#ctimeMs = ctimeMs;
    +        this.#dev = dev;
    +        this.#gid = gid;
    +        this.#ino = ino;
    +        this.#mode = mode;
    +        this.#mtime = mtime;
    +        this.#mtimeMs = mtimeMs;
    +        this.#nlink = nlink;
    +        this.#rdev = rdev;
    +        this.#size = size;
    +        this.#uid = uid;
    +        const ifmt = entToType(st);
    +        // retain any other flags, but set the ifmt
    +        this.#type = (this.#type & IFMT_UNKNOWN) | ifmt | LSTAT_CALLED;
    +        if (ifmt !== UNKNOWN && ifmt !== IFDIR && ifmt !== IFLNK) {
    +            this.#type |= ENOTDIR;
    +        }
    +    }
    +    #onReaddirCB = [];
    +    #readdirCBInFlight = false;
    +    #callOnReaddirCB(children) {
    +        this.#readdirCBInFlight = false;
    +        const cbs = this.#onReaddirCB.slice();
    +        this.#onReaddirCB.length = 0;
    +        cbs.forEach(cb => cb(null, children));
    +    }
    +    /**
    +     * Standard node-style callback interface to get list of directory entries.
    +     *
    +     * If the Path cannot or does not contain any children, then an empty array
    +     * is returned.
    +     *
    +     * Results are cached, and thus may be out of date if the filesystem is
    +     * mutated.
    +     *
    +     * @param cb The callback called with (er, entries).  Note that the `er`
    +     * param is somewhat extraneous, as all readdir() errors are handled and
    +     * simply result in an empty set of entries being returned.
    +     * @param allowZalgo Boolean indicating that immediately known results should
    +     * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release
    +     * zalgo at your peril, the dark pony lord is devious and unforgiving.
    +     */
    +    readdirCB(cb, allowZalgo = false) {
    +        if (!this.canReaddir()) {
    +            if (allowZalgo)
    +                cb(null, []);
    +            else
    +                queueMicrotask(() => cb(null, []));
    +            return;
    +        }
    +        const children = this.children();
    +        if (this.calledReaddir()) {
    +            const c = children.slice(0, children.provisional);
    +            if (allowZalgo)
    +                cb(null, c);
    +            else
    +                queueMicrotask(() => cb(null, c));
    +            return;
    +        }
    +        // don't have to worry about zalgo at this point.
    +        this.#onReaddirCB.push(cb);
    +        if (this.#readdirCBInFlight) {
    +            return;
    +        }
    +        this.#readdirCBInFlight = true;
    +        // else read the directory, fill up children
    +        // de-provisionalize any provisional children.
    +        const fullpath = this.fullpath();
    +        this.#fs.readdir(fullpath, { withFileTypes: true }, (er, entries) => {
    +            if (er) {
    +                this.#readdirFail(er.code);
    +                children.provisional = 0;
    +            }
    +            else {
    +                // if we didn't get an error, we always get entries.
    +                //@ts-ignore
    +                for (const e of entries) {
    +                    this.#readdirAddChild(e, children);
    +                }
    +                this.#readdirSuccess(children);
    +            }
    +            this.#callOnReaddirCB(children.slice(0, children.provisional));
    +            return;
    +        });
    +    }
    +    #asyncReaddirInFlight;
    +    /**
    +     * Return an array of known child entries.
    +     *
    +     * If the Path cannot or does not contain any children, then an empty array
    +     * is returned.
    +     *
    +     * Results are cached, and thus may be out of date if the filesystem is
    +     * mutated.
    +     */
    +    async readdir() {
    +        if (!this.canReaddir()) {
    +            return [];
    +        }
    +        const children = this.children();
    +        if (this.calledReaddir()) {
    +            return children.slice(0, children.provisional);
    +        }
    +        // else read the directory, fill up children
    +        // de-provisionalize any provisional children.
    +        const fullpath = this.fullpath();
    +        if (this.#asyncReaddirInFlight) {
    +            await this.#asyncReaddirInFlight;
    +        }
    +        else {
    +            /* c8 ignore start */
    +            let resolve = () => { };
    +            /* c8 ignore stop */
    +            this.#asyncReaddirInFlight = new Promise(res => (resolve = res));
    +            try {
    +                for (const e of await this.#fs.promises.readdir(fullpath, {
    +                    withFileTypes: true,
    +                })) {
    +                    this.#readdirAddChild(e, children);
    +                }
    +                this.#readdirSuccess(children);
    +            }
    +            catch (er) {
    +                this.#readdirFail(er.code);
    +                children.provisional = 0;
    +            }
    +            this.#asyncReaddirInFlight = undefined;
    +            resolve();
    +        }
    +        return children.slice(0, children.provisional);
    +    }
    +    /**
    +     * synchronous {@link PathBase.readdir}
    +     */
    +    readdirSync() {
    +        if (!this.canReaddir()) {
    +            return [];
    +        }
    +        const children = this.children();
    +        if (this.calledReaddir()) {
    +            return children.slice(0, children.provisional);
    +        }
    +        // else read the directory, fill up children
    +        // de-provisionalize any provisional children.
    +        const fullpath = this.fullpath();
    +        try {
    +            for (const e of this.#fs.readdirSync(fullpath, {
    +                withFileTypes: true,
    +            })) {
    +                this.#readdirAddChild(e, children);
    +            }
    +            this.#readdirSuccess(children);
    +        }
    +        catch (er) {
    +            this.#readdirFail(er.code);
    +            children.provisional = 0;
    +        }
    +        return children.slice(0, children.provisional);
    +    }
    +    canReaddir() {
    +        if (this.#type & ENOCHILD)
    +            return false;
    +        const ifmt = IFMT & this.#type;
    +        // we always set ENOTDIR when setting IFMT, so should be impossible
    +        /* c8 ignore start */
    +        if (!(ifmt === UNKNOWN || ifmt === IFDIR || ifmt === IFLNK)) {
    +            return false;
    +        }
    +        /* c8 ignore stop */
    +        return true;
    +    }
    +    shouldWalk(dirs, walkFilter) {
    +        return ((this.#type & IFDIR) === IFDIR &&
    +            !(this.#type & ENOCHILD) &&
    +            !dirs.has(this) &&
    +            (!walkFilter || walkFilter(this)));
    +    }
    +    /**
    +     * Return the Path object corresponding to path as resolved
    +     * by realpath(3).
    +     *
    +     * If the realpath call fails for any reason, `undefined` is returned.
    +     *
    +     * Result is cached, and thus may be outdated if the filesystem is mutated.
    +     * On success, returns a Path object.
    +     */
    +    async realpath() {
    +        if (this.#realpath)
    +            return this.#realpath;
    +        if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type)
    +            return undefined;
    +        try {
    +            const rp = await this.#fs.promises.realpath(this.fullpath());
    +            return (this.#realpath = this.resolve(rp));
    +        }
    +        catch (_) {
    +            this.#markENOREALPATH();
    +        }
    +    }
    +    /**
    +     * Synchronous {@link realpath}
    +     */
    +    realpathSync() {
    +        if (this.#realpath)
    +            return this.#realpath;
    +        if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type)
    +            return undefined;
    +        try {
    +            const rp = this.#fs.realpathSync(this.fullpath());
    +            return (this.#realpath = this.resolve(rp));
    +        }
    +        catch (_) {
    +            this.#markENOREALPATH();
    +        }
    +    }
    +    /**
    +     * Internal method to mark this Path object as the scurry cwd,
    +     * called by {@link PathScurry#chdir}
    +     *
    +     * @internal
    +     */
    +    [setAsCwd](oldCwd) {
    +        if (oldCwd === this)
    +            return;
    +        oldCwd.isCWD = false;
    +        this.isCWD = true;
    +        const changed = new Set([]);
    +        let rp = [];
    +        let p = this;
    +        while (p && p.parent) {
    +            changed.add(p);
    +            p.#relative = rp.join(this.sep);
    +            p.#relativePosix = rp.join('/');
    +            p = p.parent;
    +            rp.push('..');
    +        }
    +        // now un-memoize parents of old cwd
    +        p = oldCwd;
    +        while (p && p.parent && !changed.has(p)) {
    +            p.#relative = undefined;
    +            p.#relativePosix = undefined;
    +            p = p.parent;
    +        }
    +    }
    +}
    +/**
    + * Path class used on win32 systems
    + *
    + * Uses `'\\'` as the path separator for returned paths, either `'\\'` or `'/'`
    + * as the path separator for parsing paths.
    + */
    +export class PathWin32 extends PathBase {
    +    /**
    +     * Separator for generating path strings.
    +     */
    +    sep = '\\';
    +    /**
    +     * Separator for parsing path strings.
    +     */
    +    splitSep = eitherSep;
    +    /**
    +     * Do not create new Path objects directly.  They should always be accessed
    +     * via the PathScurry class or other methods on the Path class.
    +     *
    +     * @internal
    +     */
    +    constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
    +        super(name, type, root, roots, nocase, children, opts);
    +    }
    +    /**
    +     * @internal
    +     */
    +    newChild(name, type = UNKNOWN, opts = {}) {
    +        return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
    +    }
    +    /**
    +     * @internal
    +     */
    +    getRootString(path) {
    +        return win32.parse(path).root;
    +    }
    +    /**
    +     * @internal
    +     */
    +    getRoot(rootPath) {
    +        rootPath = uncToDrive(rootPath.toUpperCase());
    +        if (rootPath === this.root.name) {
    +            return this.root;
    +        }
    +        // ok, not that one, check if it matches another we know about
    +        for (const [compare, root] of Object.entries(this.roots)) {
    +            if (this.sameRoot(rootPath, compare)) {
    +                return (this.roots[rootPath] = root);
    +            }
    +        }
    +        // otherwise, have to create a new one.
    +        return (this.roots[rootPath] = new PathScurryWin32(rootPath, this).root);
    +    }
    +    /**
    +     * @internal
    +     */
    +    sameRoot(rootPath, compare = this.root.name) {
    +        // windows can (rarely) have case-sensitive filesystem, but
    +        // UNC and drive letters are always case-insensitive, and canonically
    +        // represented uppercase.
    +        rootPath = rootPath
    +            .toUpperCase()
    +            .replace(/\//g, '\\')
    +            .replace(uncDriveRegexp, '$1\\');
    +        return rootPath === compare;
    +    }
    +}
    +/**
    + * Path class used on all posix systems.
    + *
    + * Uses `'/'` as the path separator.
    + */
    +export class PathPosix extends PathBase {
    +    /**
    +     * separator for parsing path strings
    +     */
    +    splitSep = '/';
    +    /**
    +     * separator for generating path strings
    +     */
    +    sep = '/';
    +    /**
    +     * Do not create new Path objects directly.  They should always be accessed
    +     * via the PathScurry class or other methods on the Path class.
    +     *
    +     * @internal
    +     */
    +    constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) {
    +        super(name, type, root, roots, nocase, children, opts);
    +    }
    +    /**
    +     * @internal
    +     */
    +    getRootString(path) {
    +        return path.startsWith('/') ? '/' : '';
    +    }
    +    /**
    +     * @internal
    +     */
    +    getRoot(_rootPath) {
    +        return this.root;
    +    }
    +    /**
    +     * @internal
    +     */
    +    newChild(name, type = UNKNOWN, opts = {}) {
    +        return new PathPosix(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts);
    +    }
    +}
    +/**
    + * The base class for all PathScurry classes, providing the interface for path
    + * resolution and filesystem operations.
    + *
    + * Typically, you should *not* instantiate this class directly, but rather one
    + * of the platform-specific classes, or the exported {@link PathScurry} which
    + * defaults to the current platform.
    + */
    +export class PathScurryBase {
    +    /**
    +     * The root Path entry for the current working directory of this Scurry
    +     */
    +    root;
    +    /**
    +     * The string path for the root of this Scurry's current working directory
    +     */
    +    rootPath;
    +    /**
    +     * A collection of all roots encountered, referenced by rootPath
    +     */
    +    roots;
    +    /**
    +     * The Path entry corresponding to this PathScurry's current working directory.
    +     */
    +    cwd;
    +    #resolveCache;
    +    #resolvePosixCache;
    +    #children;
    +    /**
    +     * Perform path comparisons case-insensitively.
    +     *
    +     * Defaults true on Darwin and Windows systems, false elsewhere.
    +     */
    +    nocase;
    +    #fs;
    +    /**
    +     * This class should not be instantiated directly.
    +     *
    +     * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry
    +     *
    +     * @internal
    +     */
    +    constructor(cwd = process.cwd(), pathImpl, sep, { nocase, childrenCacheSize = 16 * 1024, fs = defaultFS, } = {}) {
    +        this.#fs = fsFromOption(fs);
    +        if (cwd instanceof URL || cwd.startsWith('file://')) {
    +            cwd = fileURLToPath(cwd);
    +        }
    +        // resolve and split root, and then add to the store.
    +        // this is the only time we call path.resolve()
    +        const cwdPath = pathImpl.resolve(cwd);
    +        this.roots = Object.create(null);
    +        this.rootPath = this.parseRootPath(cwdPath);
    +        this.#resolveCache = new ResolveCache();
    +        this.#resolvePosixCache = new ResolveCache();
    +        this.#children = new ChildrenCache(childrenCacheSize);
    +        const split = cwdPath.substring(this.rootPath.length).split(sep);
    +        // resolve('/') leaves '', splits to [''], we don't want that.
    +        if (split.length === 1 && !split[0]) {
    +            split.pop();
    +        }
    +        /* c8 ignore start */
    +        if (nocase === undefined) {
    +            throw new TypeError('must provide nocase setting to PathScurryBase ctor');
    +        }
    +        /* c8 ignore stop */
    +        this.nocase = nocase;
    +        this.root = this.newRoot(this.#fs);
    +        this.roots[this.rootPath] = this.root;
    +        let prev = this.root;
    +        let len = split.length - 1;
    +        const joinSep = pathImpl.sep;
    +        let abs = this.rootPath;
    +        let sawFirst = false;
    +        for (const part of split) {
    +            const l = len--;
    +            prev = prev.child(part, {
    +                relative: new Array(l).fill('..').join(joinSep),
    +                relativePosix: new Array(l).fill('..').join('/'),
    +                fullpath: (abs += (sawFirst ? '' : joinSep) + part),
    +            });
    +            sawFirst = true;
    +        }
    +        this.cwd = prev;
    +    }
    +    /**
    +     * Get the depth of a provided path, string, or the cwd
    +     */
    +    depth(path = this.cwd) {
    +        if (typeof path === 'string') {
    +            path = this.cwd.resolve(path);
    +        }
    +        return path.depth();
    +    }
    +    /**
    +     * Return the cache of child entries.  Exposed so subclasses can create
    +     * child Path objects in a platform-specific way.
    +     *
    +     * @internal
    +     */
    +    childrenCache() {
    +        return this.#children;
    +    }
    +    /**
    +     * Resolve one or more path strings to a resolved string
    +     *
    +     * Same interface as require('path').resolve.
    +     *
    +     * Much faster than path.resolve() when called multiple times for the same
    +     * path, because the resolved Path objects are cached.  Much slower
    +     * otherwise.
    +     */
    +    resolve(...paths) {
    +        // first figure out the minimum number of paths we have to test
    +        // we always start at cwd, but any absolutes will bump the start
    +        let r = '';
    +        for (let i = paths.length - 1; i >= 0; i--) {
    +            const p = paths[i];
    +            if (!p || p === '.')
    +                continue;
    +            r = r ? `${p}/${r}` : p;
    +            if (this.isAbsolute(p)) {
    +                break;
    +            }
    +        }
    +        const cached = this.#resolveCache.get(r);
    +        if (cached !== undefined) {
    +            return cached;
    +        }
    +        const result = this.cwd.resolve(r).fullpath();
    +        this.#resolveCache.set(r, result);
    +        return result;
    +    }
    +    /**
    +     * Resolve one or more path strings to a resolved string, returning
    +     * the posix path.  Identical to .resolve() on posix systems, but on
    +     * windows will return a forward-slash separated UNC path.
    +     *
    +     * Same interface as require('path').resolve.
    +     *
    +     * Much faster than path.resolve() when called multiple times for the same
    +     * path, because the resolved Path objects are cached.  Much slower
    +     * otherwise.
    +     */
    +    resolvePosix(...paths) {
    +        // first figure out the minimum number of paths we have to test
    +        // we always start at cwd, but any absolutes will bump the start
    +        let r = '';
    +        for (let i = paths.length - 1; i >= 0; i--) {
    +            const p = paths[i];
    +            if (!p || p === '.')
    +                continue;
    +            r = r ? `${p}/${r}` : p;
    +            if (this.isAbsolute(p)) {
    +                break;
    +            }
    +        }
    +        const cached = this.#resolvePosixCache.get(r);
    +        if (cached !== undefined) {
    +            return cached;
    +        }
    +        const result = this.cwd.resolve(r).fullpathPosix();
    +        this.#resolvePosixCache.set(r, result);
    +        return result;
    +    }
    +    /**
    +     * find the relative path from the cwd to the supplied path string or entry
    +     */
    +    relative(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return entry.relative();
    +    }
    +    /**
    +     * find the relative path from the cwd to the supplied path string or
    +     * entry, using / as the path delimiter, even on Windows.
    +     */
    +    relativePosix(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return entry.relativePosix();
    +    }
    +    /**
    +     * Return the basename for the provided string or Path object
    +     */
    +    basename(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return entry.name;
    +    }
    +    /**
    +     * Return the dirname for the provided string or Path object
    +     */
    +    dirname(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return (entry.parent || entry).fullpath();
    +    }
    +    async readdir(entry = this.cwd, opts = {
    +        withFileTypes: true,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes } = opts;
    +        if (!entry.canReaddir()) {
    +            return [];
    +        }
    +        else {
    +            const p = await entry.readdir();
    +            return withFileTypes ? p : p.map(e => e.name);
    +        }
    +    }
    +    readdirSync(entry = this.cwd, opts = {
    +        withFileTypes: true,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true } = opts;
    +        if (!entry.canReaddir()) {
    +            return [];
    +        }
    +        else if (withFileTypes) {
    +            return entry.readdirSync();
    +        }
    +        else {
    +            return entry.readdirSync().map(e => e.name);
    +        }
    +    }
    +    /**
    +     * Call lstat() on the string or Path object, and update all known
    +     * information that can be determined.
    +     *
    +     * Note that unlike `fs.lstat()`, the returned value does not contain some
    +     * information, such as `mode`, `dev`, `nlink`, and `ino`.  If that
    +     * information is required, you will need to call `fs.lstat` yourself.
    +     *
    +     * If the Path refers to a nonexistent file, or if the lstat call fails for
    +     * any reason, `undefined` is returned.  Otherwise the updated Path object is
    +     * returned.
    +     *
    +     * Results are cached, and thus may be out of date if the filesystem is
    +     * mutated.
    +     */
    +    async lstat(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return entry.lstat();
    +    }
    +    /**
    +     * synchronous {@link PathScurryBase.lstat}
    +     */
    +    lstatSync(entry = this.cwd) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        return entry.lstatSync();
    +    }
    +    async readlink(entry = this.cwd, { withFileTypes } = {
    +        withFileTypes: false,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            withFileTypes = entry.withFileTypes;
    +            entry = this.cwd;
    +        }
    +        const e = await entry.readlink();
    +        return withFileTypes ? e : e?.fullpath();
    +    }
    +    readlinkSync(entry = this.cwd, { withFileTypes } = {
    +        withFileTypes: false,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            withFileTypes = entry.withFileTypes;
    +            entry = this.cwd;
    +        }
    +        const e = entry.readlinkSync();
    +        return withFileTypes ? e : e?.fullpath();
    +    }
    +    async realpath(entry = this.cwd, { withFileTypes } = {
    +        withFileTypes: false,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            withFileTypes = entry.withFileTypes;
    +            entry = this.cwd;
    +        }
    +        const e = await entry.realpath();
    +        return withFileTypes ? e : e?.fullpath();
    +    }
    +    realpathSync(entry = this.cwd, { withFileTypes } = {
    +        withFileTypes: false,
    +    }) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            withFileTypes = entry.withFileTypes;
    +            entry = this.cwd;
    +        }
    +        const e = entry.realpathSync();
    +        return withFileTypes ? e : e?.fullpath();
    +    }
    +    async walk(entry = this.cwd, opts = {}) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true, follow = false, filter, walkFilter, } = opts;
    +        const results = [];
    +        if (!filter || filter(entry)) {
    +            results.push(withFileTypes ? entry : entry.fullpath());
    +        }
    +        const dirs = new Set();
    +        const walk = (dir, cb) => {
    +            dirs.add(dir);
    +            dir.readdirCB((er, entries) => {
    +                /* c8 ignore start */
    +                if (er) {
    +                    return cb(er);
    +                }
    +                /* c8 ignore stop */
    +                let len = entries.length;
    +                if (!len)
    +                    return cb();
    +                const next = () => {
    +                    if (--len === 0) {
    +                        cb();
    +                    }
    +                };
    +                for (const e of entries) {
    +                    if (!filter || filter(e)) {
    +                        results.push(withFileTypes ? e : e.fullpath());
    +                    }
    +                    if (follow && e.isSymbolicLink()) {
    +                        e.realpath()
    +                            .then(r => (r?.isUnknown() ? r.lstat() : r))
    +                            .then(r => r?.shouldWalk(dirs, walkFilter) ? walk(r, next) : next());
    +                    }
    +                    else {
    +                        if (e.shouldWalk(dirs, walkFilter)) {
    +                            walk(e, next);
    +                        }
    +                        else {
    +                            next();
    +                        }
    +                    }
    +                }
    +            }, true); // zalgooooooo
    +        };
    +        const start = entry;
    +        return new Promise((res, rej) => {
    +            walk(start, er => {
    +                /* c8 ignore start */
    +                if (er)
    +                    return rej(er);
    +                /* c8 ignore stop */
    +                res(results);
    +            });
    +        });
    +    }
    +    walkSync(entry = this.cwd, opts = {}) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true, follow = false, filter, walkFilter, } = opts;
    +        const results = [];
    +        if (!filter || filter(entry)) {
    +            results.push(withFileTypes ? entry : entry.fullpath());
    +        }
    +        const dirs = new Set([entry]);
    +        for (const dir of dirs) {
    +            const entries = dir.readdirSync();
    +            for (const e of entries) {
    +                if (!filter || filter(e)) {
    +                    results.push(withFileTypes ? e : e.fullpath());
    +                }
    +                let r = e;
    +                if (e.isSymbolicLink()) {
    +                    if (!(follow && (r = e.realpathSync())))
    +                        continue;
    +                    if (r.isUnknown())
    +                        r.lstatSync();
    +                }
    +                if (r.shouldWalk(dirs, walkFilter)) {
    +                    dirs.add(r);
    +                }
    +            }
    +        }
    +        return results;
    +    }
    +    /**
    +     * Support for `for await`
    +     *
    +     * Alias for {@link PathScurryBase.iterate}
    +     *
    +     * Note: As of Node 19, this is very slow, compared to other methods of
    +     * walking.  Consider using {@link PathScurryBase.stream} if memory overhead
    +     * and backpressure are concerns, or {@link PathScurryBase.walk} if not.
    +     */
    +    [Symbol.asyncIterator]() {
    +        return this.iterate();
    +    }
    +    iterate(entry = this.cwd, options = {}) {
    +        // iterating async over the stream is significantly more performant,
    +        // especially in the warm-cache scenario, because it buffers up directory
    +        // entries in the background instead of waiting for a yield for each one.
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            options = entry;
    +            entry = this.cwd;
    +        }
    +        return this.stream(entry, options)[Symbol.asyncIterator]();
    +    }
    +    /**
    +     * Iterating over a PathScurry performs a synchronous walk.
    +     *
    +     * Alias for {@link PathScurryBase.iterateSync}
    +     */
    +    [Symbol.iterator]() {
    +        return this.iterateSync();
    +    }
    +    *iterateSync(entry = this.cwd, opts = {}) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true, follow = false, filter, walkFilter, } = opts;
    +        if (!filter || filter(entry)) {
    +            yield withFileTypes ? entry : entry.fullpath();
    +        }
    +        const dirs = new Set([entry]);
    +        for (const dir of dirs) {
    +            const entries = dir.readdirSync();
    +            for (const e of entries) {
    +                if (!filter || filter(e)) {
    +                    yield withFileTypes ? e : e.fullpath();
    +                }
    +                let r = e;
    +                if (e.isSymbolicLink()) {
    +                    if (!(follow && (r = e.realpathSync())))
    +                        continue;
    +                    if (r.isUnknown())
    +                        r.lstatSync();
    +                }
    +                if (r.shouldWalk(dirs, walkFilter)) {
    +                    dirs.add(r);
    +                }
    +            }
    +        }
    +    }
    +    stream(entry = this.cwd, opts = {}) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true, follow = false, filter, walkFilter, } = opts;
    +        const results = new Minipass({ objectMode: true });
    +        if (!filter || filter(entry)) {
    +            results.write(withFileTypes ? entry : entry.fullpath());
    +        }
    +        const dirs = new Set();
    +        const queue = [entry];
    +        let processing = 0;
    +        const process = () => {
    +            let paused = false;
    +            while (!paused) {
    +                const dir = queue.shift();
    +                if (!dir) {
    +                    if (processing === 0)
    +                        results.end();
    +                    return;
    +                }
    +                processing++;
    +                dirs.add(dir);
    +                const onReaddir = (er, entries, didRealpaths = false) => {
    +                    /* c8 ignore start */
    +                    if (er)
    +                        return results.emit('error', er);
    +                    /* c8 ignore stop */
    +                    if (follow && !didRealpaths) {
    +                        const promises = [];
    +                        for (const e of entries) {
    +                            if (e.isSymbolicLink()) {
    +                                promises.push(e
    +                                    .realpath()
    +                                    .then((r) => r?.isUnknown() ? r.lstat() : r));
    +                            }
    +                        }
    +                        if (promises.length) {
    +                            Promise.all(promises).then(() => onReaddir(null, entries, true));
    +                            return;
    +                        }
    +                    }
    +                    for (const e of entries) {
    +                        if (e && (!filter || filter(e))) {
    +                            if (!results.write(withFileTypes ? e : e.fullpath())) {
    +                                paused = true;
    +                            }
    +                        }
    +                    }
    +                    processing--;
    +                    for (const e of entries) {
    +                        const r = e.realpathCached() || e;
    +                        if (r.shouldWalk(dirs, walkFilter)) {
    +                            queue.push(r);
    +                        }
    +                    }
    +                    if (paused && !results.flowing) {
    +                        results.once('drain', process);
    +                    }
    +                    else if (!sync) {
    +                        process();
    +                    }
    +                };
    +                // zalgo containment
    +                let sync = true;
    +                dir.readdirCB(onReaddir, true);
    +                sync = false;
    +            }
    +        };
    +        process();
    +        return results;
    +    }
    +    streamSync(entry = this.cwd, opts = {}) {
    +        if (typeof entry === 'string') {
    +            entry = this.cwd.resolve(entry);
    +        }
    +        else if (!(entry instanceof PathBase)) {
    +            opts = entry;
    +            entry = this.cwd;
    +        }
    +        const { withFileTypes = true, follow = false, filter, walkFilter, } = opts;
    +        const results = new Minipass({ objectMode: true });
    +        const dirs = new Set();
    +        if (!filter || filter(entry)) {
    +            results.write(withFileTypes ? entry : entry.fullpath());
    +        }
    +        const queue = [entry];
    +        let processing = 0;
    +        const process = () => {
    +            let paused = false;
    +            while (!paused) {
    +                const dir = queue.shift();
    +                if (!dir) {
    +                    if (processing === 0)
    +                        results.end();
    +                    return;
    +                }
    +                processing++;
    +                dirs.add(dir);
    +                const entries = dir.readdirSync();
    +                for (const e of entries) {
    +                    if (!filter || filter(e)) {
    +                        if (!results.write(withFileTypes ? e : e.fullpath())) {
    +                            paused = true;
    +                        }
    +                    }
    +                }
    +                processing--;
    +                for (const e of entries) {
    +                    let r = e;
    +                    if (e.isSymbolicLink()) {
    +                        if (!(follow && (r = e.realpathSync())))
    +                            continue;
    +                        if (r.isUnknown())
    +                            r.lstatSync();
    +                    }
    +                    if (r.shouldWalk(dirs, walkFilter)) {
    +                        queue.push(r);
    +                    }
    +                }
    +            }
    +            if (paused && !results.flowing)
    +                results.once('drain', process);
    +        };
    +        process();
    +        return results;
    +    }
    +    chdir(path = this.cwd) {
    +        const oldCwd = this.cwd;
    +        this.cwd = typeof path === 'string' ? this.cwd.resolve(path) : path;
    +        this.cwd[setAsCwd](oldCwd);
    +    }
    +}
    +/**
    + * Windows implementation of {@link PathScurryBase}
    + *
    + * Defaults to case insensitve, uses `'\\'` to generate path strings.  Uses
    + * {@link PathWin32} for Path objects.
    + */
    +export class PathScurryWin32 extends PathScurryBase {
    +    /**
    +     * separator for generating path strings
    +     */
    +    sep = '\\';
    +    constructor(cwd = process.cwd(), opts = {}) {
    +        const { nocase = true } = opts;
    +        super(cwd, win32, '\\', { ...opts, nocase });
    +        this.nocase = nocase;
    +        for (let p = this.cwd; p; p = p.parent) {
    +            p.nocase = this.nocase;
    +        }
    +    }
    +    /**
    +     * @internal
    +     */
    +    parseRootPath(dir) {
    +        // if the path starts with a single separator, it's not a UNC, and we'll
    +        // just get separator as the root, and driveFromUNC will return \
    +        // In that case, mount \ on the root from the cwd.
    +        return win32.parse(dir).root.toUpperCase();
    +    }
    +    /**
    +     * @internal
    +     */
    +    newRoot(fs) {
    +        return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs });
    +    }
    +    /**
    +     * Return true if the provided path string is an absolute path
    +     */
    +    isAbsolute(p) {
    +        return (p.startsWith('/') || p.startsWith('\\') || /^[a-z]:(\/|\\)/i.test(p));
    +    }
    +}
    +/**
    + * {@link PathScurryBase} implementation for all posix systems other than Darwin.
    + *
    + * Defaults to case-sensitive matching, uses `'/'` to generate path strings.
    + *
    + * Uses {@link PathPosix} for Path objects.
    + */
    +export class PathScurryPosix extends PathScurryBase {
    +    /**
    +     * separator for generating path strings
    +     */
    +    sep = '/';
    +    constructor(cwd = process.cwd(), opts = {}) {
    +        const { nocase = false } = opts;
    +        super(cwd, posix, '/', { ...opts, nocase });
    +        this.nocase = nocase;
    +    }
    +    /**
    +     * @internal
    +     */
    +    parseRootPath(_dir) {
    +        return '/';
    +    }
    +    /**
    +     * @internal
    +     */
    +    newRoot(fs) {
    +        return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs });
    +    }
    +    /**
    +     * Return true if the provided path string is an absolute path
    +     */
    +    isAbsolute(p) {
    +        return p.startsWith('/');
    +    }
    +}
    +/**
    + * {@link PathScurryBase} implementation for Darwin (macOS) systems.
    + *
    + * Defaults to case-insensitive matching, uses `'/'` for generating path
    + * strings.
    + *
    + * Uses {@link PathPosix} for Path objects.
    + */
    +export class PathScurryDarwin extends PathScurryPosix {
    +    constructor(cwd = process.cwd(), opts = {}) {
    +        const { nocase = true } = opts;
    +        super(cwd, { ...opts, nocase });
    +    }
    +}
    +/**
    + * Default {@link PathBase} implementation for the current platform.
    + *
    + * {@link PathWin32} on Windows systems, {@link PathPosix} on all others.
    + */
    +export const Path = process.platform === 'win32' ? PathWin32 : PathPosix;
    +/**
    + * Default {@link PathScurryBase} implementation for the current platform.
    + *
    + * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on
    + * Darwin (macOS) systems, {@link PathScurryPosix} on all others.
    + */
    +export const PathScurry = process.platform === 'win32' ? PathScurryWin32
    +    : process.platform === 'darwin' ? PathScurryDarwin
    +        : PathScurryPosix;
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/path-scurry/dist/esm/package.json b/node_modules/npm/node_modules/path-scurry/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/path-scurry/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/path-scurry/package.json b/node_modules/npm/node_modules/path-scurry/package.json
    new file mode 100644
    index 00000000..e1766157
    --- /dev/null
    +++ b/node_modules/npm/node_modules/path-scurry/package.json
    @@ -0,0 +1,89 @@
    +{
    +  "name": "path-scurry",
    +  "version": "1.11.1",
    +  "description": "walk paths fast and efficiently",
    +  "author": "Isaac Z. Schlueter  (https://blog.izs.me)",
    +  "main": "./dist/commonjs/index.js",
    +  "type": "module",
    +  "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"
    +  ],
    +  "license": "BlueOak-1.0.0",
    +  "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 tsconfig-esm.json ./src/*.ts",
    +    "bench": "bash ./scripts/bench.sh"
    +  },
    +  "prettier": {
    +    "experimentalTernaries": true,
    +    "semi": false,
    +    "printWidth": 75,
    +    "tabWidth": 2,
    +    "useTabs": false,
    +    "singleQuote": true,
    +    "jsxSingleQuote": false,
    +    "bracketSameLine": true,
    +    "arrowParens": "avoid",
    +    "endOfLine": "lf"
    +  },
    +  "devDependencies": {
    +    "@nodelib/fs.walk": "^1.2.8",
    +    "@types/node": "^20.12.11",
    +    "c8": "^7.12.0",
    +    "eslint-config-prettier": "^8.6.0",
    +    "mkdirp": "^3.0.0",
    +    "prettier": "^3.2.5",
    +    "rimraf": "^5.0.1",
    +    "tap": "^18.7.2",
    +    "ts-node": "^10.9.2",
    +    "tshy": "^1.14.0",
    +    "typedoc": "^0.25.12",
    +    "typescript": "^5.4.3"
    +  },
    +  "tap": {
    +    "typecheck": true
    +  },
    +  "engines": {
    +    "node": ">=16 || 14 >=14.18"
    +  },
    +  "funding": {
    +    "url": "https://github.com/sponsors/isaacs"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/isaacs/path-scurry"
    +  },
    +  "dependencies": {
    +    "lru-cache": "^10.2.0",
    +    "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
    +  },
    +  "tshy": {
    +    "selfLink": false,
    +    "exports": {
    +      "./package.json": "./package.json",
    +      ".": "./src/index.ts"
    +    }
    +  },
    +  "types": "./dist/commonjs/index.d.ts"
    +}
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/API.md b/node_modules/npm/node_modules/postcss-selector-parser/API.md
    new file mode 100644
    index 00000000..c8e55ee5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/API.md
    @@ -0,0 +1,872 @@
    +# API Documentation
    +
    +*Please use only this documented API when working with the parser. Methods
    +not documented here are subject to change at any point.*
    +
    +## `parser` function
    +
    +This is the module's main entry point.
    +
    +```js
    +const parser = require('postcss-selector-parser');
    +```
    +
    +### `parser([transform], [options])`
    +
    +Creates a new `processor` instance
    +
    +```js
    +const processor = parser();
    +```
    +
    +Or, with optional transform function
    +
    +```js
    +const transform = selectors => {
    +    selectors.walkUniversals(selector => {
    +        selector.remove();
    +    });
    +};
    +
    +const processor = parser(transform)
    +
    +// Example
    +const result = processor.processSync('*.class');
    +// => .class
    +```
    +
    +[See processor documentation](#processor)
    +
    +Arguments:
    +
    +* `transform (function)`: Provide a function to work with the parsed AST.
    +* `options (object)`: Provide default options for all calls on the returned `Processor`.
    +
    +### `parser.attribute([props])`
    +
    +Creates a new attribute selector.
    +
    +```js
    +parser.attribute({attribute: 'href'});
    +// => [href]
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +### `parser.className([props])`
    +
    +Creates a new class selector.
    +
    +```js
    +parser.className({value: 'button'});
    +// => .button
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +### `parser.combinator([props])`
    +
    +Creates a new selector combinator.
    +
    +```js
    +parser.combinator({value: '+'});
    +// => +
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +Notes:
    +* **Descendant Combinators** The value of descendant combinators created by the
    +  parser always just a single space (`" "`). For descendant selectors with no
    +  comments, additional space is now stored in `node.spaces.before`. Depending
    +  on the location of comments, additional spaces may be stored in
    +  `node.raws.spaces.before`, `node.raws.spaces.after`, or `node.raws.value`.
    +* **Named Combinators** Although, nonstandard and unlikely to ever become a standard,
    +  named combinators like `/deep/` and `/for/` are parsed as combinators. The
    +  `node.value` is name after being unescaped and normalized as lowercase. The
    +  original value for the combinator name is stored in `node.raws.value`.
    +
    +
    +### `parser.comment([props])`
    +
    +Creates a new comment.
    +
    +```js
    +parser.comment({value: '/* Affirmative, Dave. I read you. */'});
    +// => /* Affirmative, Dave. I read you. */
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +### `parser.id([props])`
    +
    +Creates a new id selector.
    +
    +```js
    +parser.id({value: 'search'});
    +// => #search
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +### `parser.nesting([props])`
    +
    +Creates a new nesting selector.
    +
    +```js
    +parser.nesting();
    +// => &
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +### `parser.pseudo([props])`
    +
    +Creates a new pseudo selector.
    +
    +```js
    +parser.pseudo({value: '::before'});
    +// => ::before
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +### `parser.root([props])`
    +
    +Creates a new root node.
    +
    +```js
    +parser.root();
    +// => (empty)
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +### `parser.selector([props])`
    +
    +Creates a new selector node.
    +
    +```js
    +parser.selector();
    +// => (empty)
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +### `parser.string([props])`
    +
    +Creates a new string node.
    +
    +```js
    +parser.string();
    +// => (empty)
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +### `parser.tag([props])`
    +
    +Creates a new tag selector.
    +
    +```js
    +parser.tag({value: 'button'});
    +// => button
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +### `parser.universal([props])`
    +
    +Creates a new universal selector.
    +
    +```js
    +parser.universal();
    +// => *
    +```
    +
    +Arguments:
    +
    +* `props (object)`: The new node's properties.
    +
    +## Node types
    +
    +### `node.type`
    +
    +A string representation of the selector type. It can be one of the following;
    +`attribute`, `class`, `combinator`, `comment`, `id`, `nesting`, `pseudo`,
    +`root`, `selector`, `string`, `tag`, or `universal`. Note that for convenience,
    +these constants are exposed on the main `parser` as uppercased keys. So for
    +example you can get `id` by querying `parser.ID`.
    +
    +```js
    +parser.attribute({attribute: 'href'}).type;
    +// => 'attribute'
    +```
    +
    +### `node.parent`
    +
    +Returns the parent node.
    +
    +```js
    +root.nodes[0].parent === root;
    +```
    +
    +### `node.toString()`, `String(node)`, or `'' + node`
    +
    +Returns a string representation of the node.
    +
    +```js
    +const id = parser.id({value: 'search'});
    +console.log(String(id));
    +// => #search
    +```
    +
    +### `node.next()` & `node.prev()`
    +
    +Returns the next/previous child of the parent node.
    +
    +```js
    +const next = id.next();
    +if (next && next.type !== 'combinator') {
    +    throw new Error('Qualified IDs are not allowed!');
    +}
    +```
    +
    +### `node.replaceWith(node)`
    +
    +Replace a node with another.
    +
    +```js
    +const attr = selectors.first.first;
    +const className = parser.className({value: 'test'});
    +attr.replaceWith(className);
    +```
    +
    +Arguments:
    +
    +* `node`: The node to substitute the original with.
    +
    +### `node.remove()`
    +
    +Removes the node from its parent node.
    +
    +```js
    +if (node.type === 'id') {
    +    node.remove();
    +}
    +```
    +
    +### `node.clone([opts])`
    +
    +Returns a copy of a node, detached from any parent containers that the
    +original might have had.
    +
    +```js
    +const cloned = node.clone();
    +```
    +
    +### `node.isAtPosition(line, column)`
    +
    +Return a `boolean` indicating whether this node includes the character at the
    +position of the given line and column. Returns `undefined` if the nodes lack
    +sufficient source metadata to determine the position.
    +
    +Arguments:
    +
    +* `line`: 1-index based line number relative to the start of the selector.
    +* `column`: 1-index based column number relative to the start of the selector.
    +
    +### `node.spaces`
    +
    +Extra whitespaces around the node will be moved into `node.spaces.before` and
    +`node.spaces.after`. So for example, these spaces will be moved as they have
    +no semantic meaning:
    +
    +```css
    +      h1     ,     h2   {}
    +```
    +
    +For descendent selectors, the value is always a single space.
    +
    +```css
    +h1        h2 {}
    +```
    +
    +Additional whitespace is found in either the `node.spaces.before` and `node.spaces.after` depending on the presence of comments or other whitespace characters. If the actual whitespace does not start or end with a single space, the node's raw value is set to the actual space(s) found in the source.
    +
    +### `node.source`
    +
    +An object describing the node's start/end, line/column source position.
    +
    +Within the following CSS, the `.bar` class node ...
    +
    +```css
    +.foo,
    +  .bar {}
    +```
    +
    +... will contain the following `source` object.
    +
    +```js
    +source: {
    +    start: {
    +        line: 2,
    +        column: 3
    +    },
    +    end: {
    +        line: 2,
    +        column: 6
    +    }
    +}
    +```
    +
    +### `node.sourceIndex`
    +
    +The zero-based index of the node within the original source string.
    +
    +Within the following CSS, the `.baz` class node will have a `sourceIndex` of `12`.
    +
    +```css
    +.foo, .bar, .baz {}
    +```
    +
    +## Container types
    +
    +The `root`, `selector`, and `pseudo` nodes have some helper methods for working
    +with their children.
    +
    +### `container.nodes`
    +
    +An array of the container's children.
    +
    +```js
    +// Input: h1 h2
    +selectors.at(0).nodes.length   // => 3
    +selectors.at(0).nodes[0].value // => 'h1'
    +selectors.at(0).nodes[1].value // => ' '
    +```
    +
    +### `container.first` & `container.last`
    +
    +The first/last child of the container.
    +
    +```js
    +selector.first === selector.nodes[0];
    +selector.last === selector.nodes[selector.nodes.length - 1];
    +```
    +
    +### `container.at(index)`
    +
    +Returns the node at position `index`.
    +
    +```js
    +selector.at(0) === selector.first;
    +selector.at(0) === selector.nodes[0];
    +```
    +
    +Arguments:
    +
    +* `index`: The index of the node to return.
    +
    +### `container.atPosition(line, column)`
    +
    +Returns the node at the source position `line` and `column`.
    +
    +```js
    +// Input: :not(.foo),\n#foo > :matches(ol, ul)
    +selector.atPosition(1, 1); // => :not(.foo)
    +selector.atPosition(2, 1); // => \n#foo
    +```
    +
    +Arguments:
    +
    +* `line`: The line number of the node to return.
    +* `column`: The column number of the node to return.
    +
    +### `container.index(node)`
    +
    +Return the index of the node within its container.
    +
    +```js
    +selector.index(selector.nodes[2]) // => 2
    +```
    +
    +Arguments:
    +
    +* `node`: A node within the current container.
    +
    +### `container.length`
    +
    +Proxy to the length of the container's nodes.
    +
    +```js
    +container.length === container.nodes.length
    +```
    +
    +### `container` Array iterators
    +
    +The container class provides proxies to certain Array methods; these are:
    +
    +* `container.map === container.nodes.map`
    +* `container.reduce === container.nodes.reduce`
    +* `container.every === container.nodes.every`
    +* `container.some === container.nodes.some`
    +* `container.filter === container.nodes.filter`
    +* `container.sort === container.nodes.sort`
    +
    +Note that these methods only work on a container's immediate children; recursive
    +iteration is provided by `container.walk`.
    +
    +### `container.each(callback)`
    +
    +Iterate the container's immediate children, calling `callback` for each child.
    +You may return `false` within the callback to break the iteration.
    +
    +```js
    +let className;
    +selectors.each((selector, index) => {
    +    if (selector.type === 'class') {
    +        className = selector.value;
    +        return false;
    +    }
    +});
    +```
    +
    +Note that unlike `Array#forEach()`, this iterator is safe to use whilst adding
    +or removing nodes from the container.
    +
    +Arguments:
    +
    +* `callback (function)`: A function to call for each node, which receives `node`
    +  and `index` arguments.
    +
    +### `container.walk(callback)`
    +
    +Like `container#each`, but will also iterate child nodes as long as they are
    +`container` types.
    +
    +```js
    +selectors.walk((selector, index) => {
    +    // all nodes
    +});
    +```
    +
    +Arguments:
    +
    +* `callback (function)`: A function to call for each node, which receives `node`
    +  and `index` arguments.
    +
    +This iterator is safe to use whilst mutating `container.nodes`,
    +like `container#each`.
    +
    +### `container.walk` proxies
    +
    +The container class provides proxy methods for iterating over types of nodes,
    +so that it is easier to write modules that target specific selectors. Those
    +methods are:
    +
    +* `container.walkAttributes`
    +* `container.walkClasses`
    +* `container.walkCombinators`
    +* `container.walkComments`
    +* `container.walkIds`
    +* `container.walkNesting`
    +* `container.walkPseudos`
    +* `container.walkTags`
    +* `container.walkUniversals`
    +
    +### `container.split(callback)`
    +
    +This method allows you to split a group of nodes by returning `true` from
    +a callback. It returns an array of arrays, where each inner array corresponds
    +to the groups that you created via the callback.
    +
    +```js
    +// (input) => h1 h2>>h3
    +const list = selectors.first.split(selector => {
    +    return selector.type === 'combinator';
    +});
    +
    +// (node values) => [['h1', ' '], ['h2', '>>'], ['h3']]
    +```
    +
    +Arguments:
    +
    +* `callback (function)`: A function to call for each node, which receives `node`
    +  as an argument.
    +
    +### `container.prepend(node)` & `container.append(node)`
    +
    +Add a node to the start/end of the container. Note that doing so will set
    +the parent property of the node to this container.
    +
    +```js
    +const id = parser.id({value: 'search'});
    +selector.append(id);
    +```
    +
    +Arguments:
    +
    +* `node`: The node to add.
    +
    +### `container.insertBefore(old, new)` & `container.insertAfter(old, new)`
    +
    +Add a node before or after an existing node in a container:
    +
    +```js
    +selectors.walk(selector => {
    +    if (selector.type !== 'class') {
    +        const className = parser.className({value: 'theme-name'});
    +        selector.parent.insertAfter(selector, className);
    +    }
    +});
    +```
    +
    +Arguments:
    +
    +* `old`: The existing node in the container.
    +* `new`: The new node to add before/after the existing node.
    +
    +### `container.removeChild(node)`
    +
    +Remove the node from the container. Note that you can also use
    +`node.remove()` if you would like to remove just a single node.
    +
    +```js
    +selector.length // => 2
    +selector.remove(id)
    +selector.length // => 1;
    +id.parent       // undefined
    +```
    +
    +Arguments:
    +
    +* `node`: The node to remove.
    +
    +### `container.removeAll()` or `container.empty()`
    +
    +Remove all children from the container.
    +
    +```js
    +selector.removeAll();
    +selector.length // => 0
    +```
    +
    +## Root nodes
    +
    +A root node represents a comma separated list of selectors. Indeed, all
    +a root's `toString()` method does is join its selector children with a ','.
    +Other than this, it has no special functionality and acts like a container.
    +
    +### `root.trailingComma`
    +
    +This will be set to `true` if the input has a trailing comma, in order to
    +support parsing of legacy CSS hacks.
    +
    +## Selector nodes
    +
    +A selector node represents a single complex selector. For example, this
    +selector string `h1 h2 h3, [href] > p`, is represented as two selector nodes.
    +It has no special functionality of its own.
    +
    +## Pseudo nodes
    +
    +A pseudo selector extends a container node; if it has any parameters of its
    +own (such as `h1:not(h2, h3)`), they will be its children. Note that the pseudo
    +`value` will always contain the colons preceding the pseudo identifier. This
    +is so that both `:before` and `::before` are properly represented in the AST.
    +
    +## Attribute nodes
    +
    +### `attribute.quoted`
    +
    +Returns `true` if the attribute's value is wrapped in quotation marks, false if it is not.
    +Remains `undefined` if there is no attribute value.
    +
    +```css
    +[href=foo] /* false */
    +[href='foo'] /* true */
    +[href="foo"] /* true */
    +[href] /* undefined */
    +```
    +
    +### `attribute.qualifiedAttribute`
    +
    +Returns the attribute name qualified with the namespace if one is given.
    +
    +### `attribute.offsetOf(part)`
    +
    + Returns the offset of the attribute part specified relative to the
    + start of the node of the output string. This is useful in raising
    + error messages about a specific part of the attribute, especially
    + in combination with `attribute.sourceIndex`.
    +
    + Returns `-1` if the name is invalid or the value doesn't exist in this
    + attribute.
    +
    + The legal values for `part` are:
    +
    + * `"ns"` - alias for "namespace"
    + * `"namespace"` - the namespace if it exists.
    + * `"attribute"` - the attribute name
    + * `"attributeNS"` - the start of the attribute or its namespace
    + * `"operator"` - the match operator of the attribute
    + * `"value"` - The value (string or identifier)
    + * `"insensitive"` - the case insensitivity flag
    +
    +### `attribute.raws.unquoted`
    +
    +Returns the unquoted content of the attribute's value.
    +Remains `undefined` if there is no attribute value.
    +
    +```css
    +[href=foo] /* foo */
    +[href='foo'] /* foo */
    +[href="foo"] /* foo */
    +[href] /* undefined */
    +```
    +
    +### `attribute.spaces`
    +
    +Like `node.spaces` with the `before` and `after` values containing the spaces
    +around the element, the parts of the attribute can also have spaces before
    +and after them. The for each of `attribute`, `operator`, `value` and
    +`insensitive` there is corresponding property of the same nam in
    +`node.spaces` that has an optional `before` or `after` string containing only
    +whitespace.
    +
    +Note that corresponding values in `attributes.raws.spaces` contain values
    +including any comments. If set, these values will override the
    +`attribute.spaces` value. Take care to remove them if changing
    +`attribute.spaces`.
    +
    +### `attribute.raws`
    +
    +The raws object stores comments and other information necessary to re-render
    +the node exactly as it was in the source.
    +
    +If a comment is embedded within the identifiers for the `namespace`, `attribute`
    +or `value` then a property is placed in the raws for that value containing the full source of the propery including comments.
    +
    +If a comment is embedded within the space between parts of the attribute
    +then the raw for that space is set accordingly.
    +
    +Setting an attribute's property `raws` value to be deleted.
    +
    +For now, changing the spaces required also updating or removing any of the
    +raws values that override them.
    +
    +Example: `[ /*before*/ href /* after-attr */ = /* after-operator */ te/*inside-value*/st/* wow */ /*omg*/i/*bbq*/ /*whodoesthis*/]` would parse as:
    +
    +```js
    +{
    +  attribute: "href",
    +  operator: "=",
    +  value: "test",
    +  spaces: {
    +    before: '',
    +    after: '',
    +    attribute: { before: '  ', after: '  ' },
    +    operator: { after: '  ' },
    +    value: { after: ' ' },
    +    insensitive: { after: ' ' }
    +  },
    +  raws: {
    +    spaces: {
    +      attribute: { before: ' /*before*/ ', after: ' /* after-attr */ ' },
    +      operator: { after: ' /* after-operator */ ' },
    +      value: { after: '/* wow */ /*omg*/' },
    +      insensitive: { after: '/*bbq*/ /*whodoesthis*/' }
    +    },
    +    unquoted: 'test',
    +    value: 'te/*inside-value*/st'
    +  }
    +}
    +```
    +
    +## `Processor`
    +
    +### `ProcessorOptions`
    +
    +* `lossless` - When `true`, whitespace is preserved. Defaults to `true`.
    +* `updateSelector` - When `true`, if any processor methods are passed a postcss
    +  `Rule` node instead of a string, then that Rule's selector is updated
    +  with the results of the processing. Defaults to `true`.
    +
    +### `process|processSync(selectors, [options])`
    +
    +Processes the `selectors`, returning a string from the result of processing.
    +
    +Note: when the `updateSelector` option is set, the rule's selector
    +will be updated with the resulting string.
    +
    +**Example:**
    +
    +```js
    +const parser = require("postcss-selector-parser");
    +const processor = parser();
    +
    +let result = processor.processSync(' .class');
    +console.log(result);
    +// =>  .class
    +
    +// Asynchronous operation
    +let promise = processor.process(' .class').then(result => {
    +    console.log(result)
    +    // => .class
    +});
    +
    +// To have the parser normalize whitespace values, utilize the options
    +result = processor.processSync('  .class  ', {lossless: false});
    +console.log(result);
    +// => .class
    +
    +// For better syntax errors, pass a PostCSS Rule node.
    +const postcss = require('postcss');
    +rule = postcss.rule({selector: ' #foo    > a,  .class  '});
    +processor.process(rule, {lossless: false, updateSelector: true}).then(result => {
    +    console.log(result);
    +    // => #foo>a,.class
    +    console.log("rule:", rule.selector);
    +    // => rule: #foo>a,.class
    +})
    +```
    +
    +Arguments:
    +
    +* `selectors (string|postcss.Rule)`: Either a selector string or a PostCSS Rule
    +  node.
    +* `[options] (object)`: Process options
    +
    +
    +### `ast|astSync(selectors, [options])`
    +
    +Like `process()` and `processSync()` but after
    +processing the `selectors` these methods return the `Root` node of the result
    +instead of a string.
    +
    +Note: when the `updateSelector` option is set, the rule's selector
    +will be updated with the resulting string.
    +
    +### `transform|transformSync(selectors, [options])`
    +
    +Like `process()` and `processSync()` but after
    +processing the `selectors` these methods return the value returned by the
    +processor callback.
    +
    +Note: when the `updateSelector` option is set, the rule's selector
    +will be updated with the resulting string.
    +
    +### Error Handling Within Selector Processors
    +
    +The root node passed to the selector processor callback
    +has a method `error(message, options)` that returns an
    +error object. This method should always be used to raise
    +errors relating to the syntax of selectors. The options
    +to this method are passed to postcss's error constructor
    +([documentation](http://postcss.org/api/#container-error)).
    +
    +#### Async Error Example
    +
    +```js
    +let processor = (root) => {
    +    return new Promise((resolve, reject) => {
    +        root.walkClasses((classNode) => {
    +            if (/^(.*)[-_]/.test(classNode.value)) {
    +                let msg = "classes may not have underscores or dashes in them";
    +                reject(root.error(msg, {
    +                    index: classNode.sourceIndex + RegExp.$1.length + 1,
    +                    word: classNode.value
    +                }));
    +            }
    +        });
    +        resolve();
    +    });
    +};
    +
    +const postcss = require("postcss");
    +const parser = require("postcss-selector-parser");
    +const selectorProcessor = parser(processor);
    +const plugin = postcss.plugin('classValidator', (options) => {
    +    return (root) => {
    +        let promises = [];
    +        root.walkRules(rule => {
    +            promises.push(selectorProcessor.process(rule));
    +        });
    +        return Promise.all(promises);
    +    };
    +});
    +postcss(plugin()).process(`
    +.foo-bar {
    +  color: red;
    +}
    +`.trim(), {from: 'test.css'}).catch((e) => console.error(e.toString()));
    +
    +// CssSyntaxError: classValidator: ./test.css:1:5: classes may not have underscores or dashes in them
    +//
    +// > 1 | .foo-bar {
    +//     |     ^
    +//   2 |   color: red;
    +//   3 | }
    +```
    +
    +#### Synchronous Error Example
    +
    +```js
    +let processor = (root) => {
    +    root.walkClasses((classNode) => {
    +        if (/.*[-_]/.test(classNode.value)) {
    +            let msg = "classes may not have underscores or dashes in them";
    +            throw root.error(msg, {
    +                index: classNode.sourceIndex,
    +                word: classNode.value
    +            });
    +        }
    +    });
    +};
    +
    +const postcss = require("postcss");
    +const parser = require("postcss-selector-parser");
    +const selectorProcessor = parser(processor);
    +const plugin = postcss.plugin('classValidator', (options) => {
    +    return (root) => {
    +        root.walkRules(rule => {
    +            selectorProcessor.processSync(rule);
    +        });
    +    };
    +});
    +postcss(plugin()).process(`
    +.foo-bar {
    +  color: red;
    +}
    +`.trim(), {from: 'test.css'}).catch((e) => console.error(e.toString()));
    +
    +// CssSyntaxError: classValidator: ./test.css:1:5: classes may not have underscores or dashes in them
    +//
    +// > 1 | .foo-bar {
    +//     |     ^
    +//   2 |   color: red;
    +//   3 | }
    +```
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/LICENSE-MIT b/node_modules/npm/node_modules/postcss-selector-parser/LICENSE-MIT
    new file mode 100644
    index 00000000..fd0e863a
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/LICENSE-MIT
    @@ -0,0 +1,22 @@
    +Copyright (c) Ben Briggs  (http://beneb.info)
    +
    +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/npm/node_modules/postcss-selector-parser/dist/index.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/index.js
    new file mode 100644
    index 00000000..995741a7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/index.js
    @@ -0,0 +1,17 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _processor = _interopRequireDefault(require("./processor"));
    +var selectors = _interopRequireWildcard(require("./selectors"));
    +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
    +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +var parser = function parser(processor) {
    +  return new _processor["default"](processor);
    +};
    +Object.assign(parser, selectors);
    +delete parser.__esModule;
    +var _default = parser;
    +exports["default"] = _default;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/parser.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/parser.js
    new file mode 100644
    index 00000000..ada61582
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/parser.js
    @@ -0,0 +1,1015 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _root = _interopRequireDefault(require("./selectors/root"));
    +var _selector = _interopRequireDefault(require("./selectors/selector"));
    +var _className = _interopRequireDefault(require("./selectors/className"));
    +var _comment = _interopRequireDefault(require("./selectors/comment"));
    +var _id = _interopRequireDefault(require("./selectors/id"));
    +var _tag = _interopRequireDefault(require("./selectors/tag"));
    +var _string = _interopRequireDefault(require("./selectors/string"));
    +var _pseudo = _interopRequireDefault(require("./selectors/pseudo"));
    +var _attribute = _interopRequireWildcard(require("./selectors/attribute"));
    +var _universal = _interopRequireDefault(require("./selectors/universal"));
    +var _combinator = _interopRequireDefault(require("./selectors/combinator"));
    +var _nesting = _interopRequireDefault(require("./selectors/nesting"));
    +var _sortAscending = _interopRequireDefault(require("./sortAscending"));
    +var _tokenize = _interopRequireWildcard(require("./tokenize"));
    +var tokens = _interopRequireWildcard(require("./tokenTypes"));
    +var types = _interopRequireWildcard(require("./selectors/types"));
    +var _util = require("./util");
    +var _WHITESPACE_TOKENS, _Object$assign;
    +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
    +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +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, 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; }
    +var WHITESPACE_TOKENS = (_WHITESPACE_TOKENS = {}, _WHITESPACE_TOKENS[tokens.space] = true, _WHITESPACE_TOKENS[tokens.cr] = true, _WHITESPACE_TOKENS[tokens.feed] = true, _WHITESPACE_TOKENS[tokens.newline] = true, _WHITESPACE_TOKENS[tokens.tab] = true, _WHITESPACE_TOKENS);
    +var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign));
    +function tokenStart(token) {
    +  return {
    +    line: token[_tokenize.FIELDS.START_LINE],
    +    column: token[_tokenize.FIELDS.START_COL]
    +  };
    +}
    +function tokenEnd(token) {
    +  return {
    +    line: token[_tokenize.FIELDS.END_LINE],
    +    column: token[_tokenize.FIELDS.END_COL]
    +  };
    +}
    +function getSource(startLine, startColumn, endLine, endColumn) {
    +  return {
    +    start: {
    +      line: startLine,
    +      column: startColumn
    +    },
    +    end: {
    +      line: endLine,
    +      column: endColumn
    +    }
    +  };
    +}
    +function getTokenSource(token) {
    +  return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]);
    +}
    +function getTokenSourceSpan(startToken, endToken) {
    +  if (!startToken) {
    +    return undefined;
    +  }
    +  return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]);
    +}
    +function unescapeProp(node, prop) {
    +  var value = node[prop];
    +  if (typeof value !== "string") {
    +    return;
    +  }
    +  if (value.indexOf("\\") !== -1) {
    +    (0, _util.ensureObject)(node, 'raws');
    +    node[prop] = (0, _util.unesc)(value);
    +    if (node.raws[prop] === undefined) {
    +      node.raws[prop] = value;
    +    }
    +  }
    +  return node;
    +}
    +function indexesOf(array, item) {
    +  var i = -1;
    +  var indexes = [];
    +  while ((i = array.indexOf(item, i + 1)) !== -1) {
    +    indexes.push(i);
    +  }
    +  return indexes;
    +}
    +function uniqs() {
    +  var list = Array.prototype.concat.apply([], arguments);
    +  return list.filter(function (item, i) {
    +    return i === list.indexOf(item);
    +  });
    +}
    +var Parser = /*#__PURE__*/function () {
    +  function Parser(rule, options) {
    +    if (options === void 0) {
    +      options = {};
    +    }
    +    this.rule = rule;
    +    this.options = Object.assign({
    +      lossy: false,
    +      safe: false
    +    }, options);
    +    this.position = 0;
    +    this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector;
    +    this.tokens = (0, _tokenize["default"])({
    +      css: this.css,
    +      error: this._errorGenerator(),
    +      safe: this.options.safe
    +    });
    +    var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]);
    +    this.root = new _root["default"]({
    +      source: rootSource
    +    });
    +    this.root.errorGenerator = this._errorGenerator();
    +    var selector = new _selector["default"]({
    +      source: {
    +        start: {
    +          line: 1,
    +          column: 1
    +        }
    +      },
    +      sourceIndex: 0
    +    });
    +    this.root.append(selector);
    +    this.current = selector;
    +    this.loop();
    +  }
    +  var _proto = Parser.prototype;
    +  _proto._errorGenerator = function _errorGenerator() {
    +    var _this = this;
    +    return function (message, errorOptions) {
    +      if (typeof _this.rule === 'string') {
    +        return new Error(message);
    +      }
    +      return _this.rule.error(message, errorOptions);
    +    };
    +  };
    +  _proto.attribute = function attribute() {
    +    var attr = [];
    +    var startingToken = this.currToken;
    +    this.position++;
    +    while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
    +      attr.push(this.currToken);
    +      this.position++;
    +    }
    +    if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) {
    +      return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
    +    }
    +    var len = attr.length;
    +    var node = {
    +      source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]),
    +      sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
    +    };
    +    if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) {
    +      return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]);
    +    }
    +    var pos = 0;
    +    var spaceBefore = '';
    +    var commentBefore = '';
    +    var lastAdded = null;
    +    var spaceAfterMeaningfulToken = false;
    +    while (pos < len) {
    +      var token = attr[pos];
    +      var content = this.content(token);
    +      var next = attr[pos + 1];
    +      switch (token[_tokenize.FIELDS.TYPE]) {
    +        case tokens.space:
    +          // if (
    +          //     len === 1 ||
    +          //     pos === 0 && this.content(next) === '|'
    +          // ) {
    +          //     return this.expected('attribute', token[TOKEN.START_POS], content);
    +          // }
    +          spaceAfterMeaningfulToken = true;
    +          if (this.options.lossy) {
    +            break;
    +          }
    +          if (lastAdded) {
    +            (0, _util.ensureObject)(node, 'spaces', lastAdded);
    +            var prevContent = node.spaces[lastAdded].after || '';
    +            node.spaces[lastAdded].after = prevContent + content;
    +            var existingComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null;
    +            if (existingComment) {
    +              node.raws.spaces[lastAdded].after = existingComment + content;
    +            }
    +          } else {
    +            spaceBefore = spaceBefore + content;
    +            commentBefore = commentBefore + content;
    +          }
    +          break;
    +        case tokens.asterisk:
    +          if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
    +            node.operator = content;
    +            lastAdded = 'operator';
    +          } else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) {
    +            if (spaceBefore) {
    +              (0, _util.ensureObject)(node, 'spaces', 'attribute');
    +              node.spaces.attribute.before = spaceBefore;
    +              spaceBefore = '';
    +            }
    +            if (commentBefore) {
    +              (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');
    +              node.raws.spaces.attribute.before = spaceBefore;
    +              commentBefore = '';
    +            }
    +            node.namespace = (node.namespace || "") + content;
    +            var rawValue = (0, _util.getProp)(node, 'raws', 'namespace') || null;
    +            if (rawValue) {
    +              node.raws.namespace += content;
    +            }
    +            lastAdded = 'namespace';
    +          }
    +          spaceAfterMeaningfulToken = false;
    +          break;
    +        case tokens.dollar:
    +          if (lastAdded === "value") {
    +            var oldRawValue = (0, _util.getProp)(node, 'raws', 'value');
    +            node.value += "$";
    +            if (oldRawValue) {
    +              node.raws.value = oldRawValue + "$";
    +            }
    +            break;
    +          }
    +        // Falls through
    +        case tokens.caret:
    +          if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
    +            node.operator = content;
    +            lastAdded = 'operator';
    +          }
    +          spaceAfterMeaningfulToken = false;
    +          break;
    +        case tokens.combinator:
    +          if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) {
    +            node.operator = content;
    +            lastAdded = 'operator';
    +          }
    +          if (content !== '|') {
    +            spaceAfterMeaningfulToken = false;
    +            break;
    +          }
    +          if (next[_tokenize.FIELDS.TYPE] === tokens.equals) {
    +            node.operator = content;
    +            lastAdded = 'operator';
    +          } else if (!node.namespace && !node.attribute) {
    +            node.namespace = true;
    +          }
    +          spaceAfterMeaningfulToken = false;
    +          break;
    +        case tokens.word:
    +          if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals &&
    +          // this look-ahead probably fails with comment nodes involved.
    +          !node.operator && !node.namespace) {
    +            node.namespace = content;
    +            lastAdded = 'namespace';
    +          } else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) {
    +            if (spaceBefore) {
    +              (0, _util.ensureObject)(node, 'spaces', 'attribute');
    +              node.spaces.attribute.before = spaceBefore;
    +              spaceBefore = '';
    +            }
    +            if (commentBefore) {
    +              (0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute');
    +              node.raws.spaces.attribute.before = commentBefore;
    +              commentBefore = '';
    +            }
    +            node.attribute = (node.attribute || "") + content;
    +            var _rawValue = (0, _util.getProp)(node, 'raws', 'attribute') || null;
    +            if (_rawValue) {
    +              node.raws.attribute += content;
    +            }
    +            lastAdded = 'attribute';
    +          } else if (!node.value && node.value !== "" || lastAdded === "value" && !(spaceAfterMeaningfulToken || node.quoteMark)) {
    +            var _unescaped = (0, _util.unesc)(content);
    +            var _oldRawValue = (0, _util.getProp)(node, 'raws', 'value') || '';
    +            var oldValue = node.value || '';
    +            node.value = oldValue + _unescaped;
    +            node.quoteMark = null;
    +            if (_unescaped !== content || _oldRawValue) {
    +              (0, _util.ensureObject)(node, 'raws');
    +              node.raws.value = (_oldRawValue || oldValue) + content;
    +            }
    +            lastAdded = 'value';
    +          } else {
    +            var insensitive = content === 'i' || content === "I";
    +            if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) {
    +              node.insensitive = insensitive;
    +              if (!insensitive || content === "I") {
    +                (0, _util.ensureObject)(node, 'raws');
    +                node.raws.insensitiveFlag = content;
    +              }
    +              lastAdded = 'insensitive';
    +              if (spaceBefore) {
    +                (0, _util.ensureObject)(node, 'spaces', 'insensitive');
    +                node.spaces.insensitive.before = spaceBefore;
    +                spaceBefore = '';
    +              }
    +              if (commentBefore) {
    +                (0, _util.ensureObject)(node, 'raws', 'spaces', 'insensitive');
    +                node.raws.spaces.insensitive.before = commentBefore;
    +                commentBefore = '';
    +              }
    +            } else if (node.value || node.value === '') {
    +              lastAdded = 'value';
    +              node.value += content;
    +              if (node.raws.value) {
    +                node.raws.value += content;
    +              }
    +            }
    +          }
    +          spaceAfterMeaningfulToken = false;
    +          break;
    +        case tokens.str:
    +          if (!node.attribute || !node.operator) {
    +            return this.error("Expected an attribute followed by an operator preceding the string.", {
    +              index: token[_tokenize.FIELDS.START_POS]
    +            });
    +          }
    +          var _unescapeValue = (0, _attribute.unescapeValue)(content),
    +            unescaped = _unescapeValue.unescaped,
    +            quoteMark = _unescapeValue.quoteMark;
    +          node.value = unescaped;
    +          node.quoteMark = quoteMark;
    +          lastAdded = 'value';
    +          (0, _util.ensureObject)(node, 'raws');
    +          node.raws.value = content;
    +          spaceAfterMeaningfulToken = false;
    +          break;
    +        case tokens.equals:
    +          if (!node.attribute) {
    +            return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content);
    +          }
    +          if (node.value) {
    +            return this.error('Unexpected "=" found; an operator was already defined.', {
    +              index: token[_tokenize.FIELDS.START_POS]
    +            });
    +          }
    +          node.operator = node.operator ? node.operator + content : content;
    +          lastAdded = 'operator';
    +          spaceAfterMeaningfulToken = false;
    +          break;
    +        case tokens.comment:
    +          if (lastAdded) {
    +            if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') {
    +              var lastComment = (0, _util.getProp)(node, 'spaces', lastAdded, 'after') || '';
    +              var rawLastComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment;
    +              (0, _util.ensureObject)(node, 'raws', 'spaces', lastAdded);
    +              node.raws.spaces[lastAdded].after = rawLastComment + content;
    +            } else {
    +              var lastValue = node[lastAdded] || '';
    +              var rawLastValue = (0, _util.getProp)(node, 'raws', lastAdded) || lastValue;
    +              (0, _util.ensureObject)(node, 'raws');
    +              node.raws[lastAdded] = rawLastValue + content;
    +            }
    +          } else {
    +            commentBefore = commentBefore + content;
    +          }
    +          break;
    +        default:
    +          return this.error("Unexpected \"" + content + "\" found.", {
    +            index: token[_tokenize.FIELDS.START_POS]
    +          });
    +      }
    +      pos++;
    +    }
    +    unescapeProp(node, "attribute");
    +    unescapeProp(node, "namespace");
    +    this.newNode(new _attribute["default"](node));
    +    this.position++;
    +  }
    +
    +  /**
    +   * return a node containing meaningless garbage up to (but not including) the specified token position.
    +   * if the token position is negative, all remaining tokens are consumed.
    +   *
    +   * This returns an array containing a single string node if all whitespace,
    +   * otherwise an array of comment nodes with space before and after.
    +   *
    +   * These tokens are not added to the current selector, the caller can add them or use them to amend
    +   * a previous node's space metadata.
    +   *
    +   * In lossy mode, this returns only comments.
    +   */;
    +  _proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) {
    +    if (stopPosition < 0) {
    +      stopPosition = this.tokens.length;
    +    }
    +    var startPosition = this.position;
    +    var nodes = [];
    +    var space = "";
    +    var lastComment = undefined;
    +    do {
    +      if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
    +        if (!this.options.lossy) {
    +          space += this.content();
    +        }
    +      } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) {
    +        var spaces = {};
    +        if (space) {
    +          spaces.before = space;
    +          space = "";
    +        }
    +        lastComment = new _comment["default"]({
    +          value: this.content(),
    +          source: getTokenSource(this.currToken),
    +          sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
    +          spaces: spaces
    +        });
    +        nodes.push(lastComment);
    +      }
    +    } while (++this.position < stopPosition);
    +    if (space) {
    +      if (lastComment) {
    +        lastComment.spaces.after = space;
    +      } else if (!this.options.lossy) {
    +        var firstToken = this.tokens[startPosition];
    +        var lastToken = this.tokens[this.position - 1];
    +        nodes.push(new _string["default"]({
    +          value: '',
    +          source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]),
    +          sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
    +          spaces: {
    +            before: space,
    +            after: ''
    +          }
    +        }));
    +      }
    +    }
    +    return nodes;
    +  }
    +
    +  /**
    +   *
    +   * @param {*} nodes
    +   */;
    +  _proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) {
    +    var _this2 = this;
    +    if (requiredSpace === void 0) {
    +      requiredSpace = false;
    +    }
    +    var space = "";
    +    var rawSpace = "";
    +    nodes.forEach(function (n) {
    +      var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace);
    +      var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace);
    +      space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0);
    +      rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0);
    +    });
    +    if (rawSpace === space) {
    +      rawSpace = undefined;
    +    }
    +    var result = {
    +      space: space,
    +      rawSpace: rawSpace
    +    };
    +    return result;
    +  };
    +  _proto.isNamedCombinator = function isNamedCombinator(position) {
    +    if (position === void 0) {
    +      position = this.position;
    +    }
    +    return this.tokens[position + 0] && this.tokens[position + 0][_tokenize.FIELDS.TYPE] === tokens.slash && this.tokens[position + 1] && this.tokens[position + 1][_tokenize.FIELDS.TYPE] === tokens.word && this.tokens[position + 2] && this.tokens[position + 2][_tokenize.FIELDS.TYPE] === tokens.slash;
    +  };
    +  _proto.namedCombinator = function namedCombinator() {
    +    if (this.isNamedCombinator()) {
    +      var nameRaw = this.content(this.tokens[this.position + 1]);
    +      var name = (0, _util.unesc)(nameRaw).toLowerCase();
    +      var raws = {};
    +      if (name !== nameRaw) {
    +        raws.value = "/" + nameRaw + "/";
    +      }
    +      var node = new _combinator["default"]({
    +        value: "/" + name + "/",
    +        source: getSource(this.currToken[_tokenize.FIELDS.START_LINE], this.currToken[_tokenize.FIELDS.START_COL], this.tokens[this.position + 2][_tokenize.FIELDS.END_LINE], this.tokens[this.position + 2][_tokenize.FIELDS.END_COL]),
    +        sourceIndex: this.currToken[_tokenize.FIELDS.START_POS],
    +        raws: raws
    +      });
    +      this.position = this.position + 3;
    +      return node;
    +    } else {
    +      this.unexpected();
    +    }
    +  };
    +  _proto.combinator = function combinator() {
    +    var _this3 = this;
    +    if (this.content() === '|') {
    +      return this.namespace();
    +    }
    +    // We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector.
    +    var nextSigTokenPos = this.locateNextMeaningfulToken(this.position);
    +    if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
    +      var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
    +      if (nodes.length > 0) {
    +        var last = this.current.last;
    +        if (last) {
    +          var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes),
    +            space = _this$convertWhitespa.space,
    +            rawSpace = _this$convertWhitespa.rawSpace;
    +          if (rawSpace !== undefined) {
    +            last.rawSpaceAfter += rawSpace;
    +          }
    +          last.spaces.after += space;
    +        } else {
    +          nodes.forEach(function (n) {
    +            return _this3.newNode(n);
    +          });
    +        }
    +      }
    +      return;
    +    }
    +    var firstToken = this.currToken;
    +    var spaceOrDescendantSelectorNodes = undefined;
    +    if (nextSigTokenPos > this.position) {
    +      spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos);
    +    }
    +    var node;
    +    if (this.isNamedCombinator()) {
    +      node = this.namedCombinator();
    +    } else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) {
    +      node = new _combinator["default"]({
    +        value: this.content(),
    +        source: getTokenSource(this.currToken),
    +        sourceIndex: this.currToken[_tokenize.FIELDS.START_POS]
    +      });
    +      this.position++;
    +    } else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) {
    +      // pass
    +    } else if (!spaceOrDescendantSelectorNodes) {
    +      this.unexpected();
    +    }
    +    if (node) {
    +      if (spaceOrDescendantSelectorNodes) {
    +        var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes),
    +          _space = _this$convertWhitespa2.space,
    +          _rawSpace = _this$convertWhitespa2.rawSpace;
    +        node.spaces.before = _space;
    +        node.rawSpaceBefore = _rawSpace;
    +      }
    +    } else {
    +      // descendant combinator
    +      var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true),
    +        _space2 = _this$convertWhitespa3.space,
    +        _rawSpace2 = _this$convertWhitespa3.rawSpace;
    +      if (!_rawSpace2) {
    +        _rawSpace2 = _space2;
    +      }
    +      var spaces = {};
    +      var raws = {
    +        spaces: {}
    +      };
    +      if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) {
    +        spaces.before = _space2.slice(0, _space2.length - 1);
    +        raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1);
    +      } else if (_space2.startsWith(' ') && _rawSpace2.startsWith(' ')) {
    +        spaces.after = _space2.slice(1);
    +        raws.spaces.after = _rawSpace2.slice(1);
    +      } else {
    +        raws.value = _rawSpace2;
    +      }
    +      node = new _combinator["default"]({
    +        value: ' ',
    +        source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]),
    +        sourceIndex: firstToken[_tokenize.FIELDS.START_POS],
    +        spaces: spaces,
    +        raws: raws
    +      });
    +    }
    +    if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) {
    +      node.spaces.after = this.optionalSpace(this.content());
    +      this.position++;
    +    }
    +    return this.newNode(node);
    +  };
    +  _proto.comma = function comma() {
    +    if (this.position === this.tokens.length - 1) {
    +      this.root.trailingComma = true;
    +      this.position++;
    +      return;
    +    }
    +    this.current._inferEndPosition();
    +    var selector = new _selector["default"]({
    +      source: {
    +        start: tokenStart(this.tokens[this.position + 1])
    +      },
    +      sourceIndex: this.tokens[this.position + 1][_tokenize.FIELDS.START_POS]
    +    });
    +    this.current.parent.append(selector);
    +    this.current = selector;
    +    this.position++;
    +  };
    +  _proto.comment = function comment() {
    +    var current = this.currToken;
    +    this.newNode(new _comment["default"]({
    +      value: this.content(),
    +      source: getTokenSource(current),
    +      sourceIndex: current[_tokenize.FIELDS.START_POS]
    +    }));
    +    this.position++;
    +  };
    +  _proto.error = function error(message, opts) {
    +    throw this.root.error(message, opts);
    +  };
    +  _proto.missingBackslash = function missingBackslash() {
    +    return this.error('Expected a backslash preceding the semicolon.', {
    +      index: this.currToken[_tokenize.FIELDS.START_POS]
    +    });
    +  };
    +  _proto.missingParenthesis = function missingParenthesis() {
    +    return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
    +  };
    +  _proto.missingSquareBracket = function missingSquareBracket() {
    +    return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]);
    +  };
    +  _proto.unexpected = function unexpected() {
    +    return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]);
    +  };
    +  _proto.unexpectedPipe = function unexpectedPipe() {
    +    return this.error("Unexpected '|'.", this.currToken[_tokenize.FIELDS.START_POS]);
    +  };
    +  _proto.namespace = function namespace() {
    +    var before = this.prevToken && this.content(this.prevToken) || true;
    +    if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) {
    +      this.position++;
    +      return this.word(before);
    +    } else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) {
    +      this.position++;
    +      return this.universal(before);
    +    }
    +    this.unexpectedPipe();
    +  };
    +  _proto.nesting = function nesting() {
    +    if (this.nextToken) {
    +      var nextContent = this.content(this.nextToken);
    +      if (nextContent === "|") {
    +        this.position++;
    +        return;
    +      }
    +    }
    +    var current = this.currToken;
    +    this.newNode(new _nesting["default"]({
    +      value: this.content(),
    +      source: getTokenSource(current),
    +      sourceIndex: current[_tokenize.FIELDS.START_POS]
    +    }));
    +    this.position++;
    +  };
    +  _proto.parentheses = function parentheses() {
    +    var last = this.current.last;
    +    var unbalanced = 1;
    +    this.position++;
    +    if (last && last.type === types.PSEUDO) {
    +      var selector = new _selector["default"]({
    +        source: {
    +          start: tokenStart(this.tokens[this.position])
    +        },
    +        sourceIndex: this.tokens[this.position][_tokenize.FIELDS.START_POS]
    +      });
    +      var cache = this.current;
    +      last.append(selector);
    +      this.current = selector;
    +      while (this.position < this.tokens.length && unbalanced) {
    +        if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
    +          unbalanced++;
    +        }
    +        if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
    +          unbalanced--;
    +        }
    +        if (unbalanced) {
    +          this.parse();
    +        } else {
    +          this.current.source.end = tokenEnd(this.currToken);
    +          this.current.parent.source.end = tokenEnd(this.currToken);
    +          this.position++;
    +        }
    +      }
    +      this.current = cache;
    +    } else {
    +      // I think this case should be an error. It's used to implement a basic parse of media queries
    +      // but I don't think it's a good idea.
    +      var parenStart = this.currToken;
    +      var parenValue = "(";
    +      var parenEnd;
    +      while (this.position < this.tokens.length && unbalanced) {
    +        if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
    +          unbalanced++;
    +        }
    +        if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
    +          unbalanced--;
    +        }
    +        parenEnd = this.currToken;
    +        parenValue += this.parseParenthesisToken(this.currToken);
    +        this.position++;
    +      }
    +      if (last) {
    +        last.appendToPropertyAndEscape("value", parenValue, parenValue);
    +      } else {
    +        this.newNode(new _string["default"]({
    +          value: parenValue,
    +          source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]),
    +          sourceIndex: parenStart[_tokenize.FIELDS.START_POS]
    +        }));
    +      }
    +    }
    +    if (unbalanced) {
    +      return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]);
    +    }
    +  };
    +  _proto.pseudo = function pseudo() {
    +    var _this4 = this;
    +    var pseudoStr = '';
    +    var startingToken = this.currToken;
    +    while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) {
    +      pseudoStr += this.content();
    +      this.position++;
    +    }
    +    if (!this.currToken) {
    +      return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1);
    +    }
    +    if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) {
    +      this.splitWord(false, function (first, length) {
    +        pseudoStr += first;
    +        _this4.newNode(new _pseudo["default"]({
    +          value: pseudoStr,
    +          source: getTokenSourceSpan(startingToken, _this4.currToken),
    +          sourceIndex: startingToken[_tokenize.FIELDS.START_POS]
    +        }));
    +        if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) {
    +          _this4.error('Misplaced parenthesis.', {
    +            index: _this4.nextToken[_tokenize.FIELDS.START_POS]
    +          });
    +        }
    +      });
    +    } else {
    +      return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]);
    +    }
    +  };
    +  _proto.space = function space() {
    +    var content = this.content();
    +    // Handle space before and after the selector
    +    if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) {
    +      return node.type === 'comment';
    +    })) {
    +      this.spaces = this.optionalSpace(content);
    +      this.position++;
    +    } else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) {
    +      this.current.last.spaces.after = this.optionalSpace(content);
    +      this.position++;
    +    } else {
    +      this.combinator();
    +    }
    +  };
    +  _proto.string = function string() {
    +    var current = this.currToken;
    +    this.newNode(new _string["default"]({
    +      value: this.content(),
    +      source: getTokenSource(current),
    +      sourceIndex: current[_tokenize.FIELDS.START_POS]
    +    }));
    +    this.position++;
    +  };
    +  _proto.universal = function universal(namespace) {
    +    var nextToken = this.nextToken;
    +    if (nextToken && this.content(nextToken) === '|') {
    +      this.position++;
    +      return this.namespace();
    +    }
    +    var current = this.currToken;
    +    this.newNode(new _universal["default"]({
    +      value: this.content(),
    +      source: getTokenSource(current),
    +      sourceIndex: current[_tokenize.FIELDS.START_POS]
    +    }), namespace);
    +    this.position++;
    +  };
    +  _proto.splitWord = function splitWord(namespace, firstCallback) {
    +    var _this5 = this;
    +    var nextToken = this.nextToken;
    +    var word = this.content();
    +    while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) {
    +      this.position++;
    +      var current = this.content();
    +      word += current;
    +      if (current.lastIndexOf('\\') === current.length - 1) {
    +        var next = this.nextToken;
    +        if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) {
    +          word += this.requiredSpace(this.content(next));
    +          this.position++;
    +        }
    +      }
    +      nextToken = this.nextToken;
    +    }
    +    var hasClass = indexesOf(word, '.').filter(function (i) {
    +      // Allow escaped dot within class name
    +      var escapedDot = word[i - 1] === '\\';
    +      // Allow decimal numbers percent in @keyframes
    +      var isKeyframesPercent = /^\d+\.\d+%$/.test(word);
    +      return !escapedDot && !isKeyframesPercent;
    +    });
    +    var hasId = indexesOf(word, '#').filter(function (i) {
    +      return word[i - 1] !== '\\';
    +    });
    +    // Eliminate Sass interpolations from the list of id indexes
    +    var interpolations = indexesOf(word, '#{');
    +    if (interpolations.length) {
    +      hasId = hasId.filter(function (hashIndex) {
    +        return !~interpolations.indexOf(hashIndex);
    +      });
    +    }
    +    var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId)));
    +    indices.forEach(function (ind, i) {
    +      var index = indices[i + 1] || word.length;
    +      var value = word.slice(ind, index);
    +      if (i === 0 && firstCallback) {
    +        return firstCallback.call(_this5, value, indices.length);
    +      }
    +      var node;
    +      var current = _this5.currToken;
    +      var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i];
    +      var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
    +      if (~hasClass.indexOf(ind)) {
    +        var classNameOpts = {
    +          value: value.slice(1),
    +          source: source,
    +          sourceIndex: sourceIndex
    +        };
    +        node = new _className["default"](unescapeProp(classNameOpts, "value"));
    +      } else if (~hasId.indexOf(ind)) {
    +        var idOpts = {
    +          value: value.slice(1),
    +          source: source,
    +          sourceIndex: sourceIndex
    +        };
    +        node = new _id["default"](unescapeProp(idOpts, "value"));
    +      } else {
    +        var tagOpts = {
    +          value: value,
    +          source: source,
    +          sourceIndex: sourceIndex
    +        };
    +        unescapeProp(tagOpts, "value");
    +        node = new _tag["default"](tagOpts);
    +      }
    +      _this5.newNode(node, namespace);
    +      // Ensure that the namespace is used only once
    +      namespace = null;
    +    });
    +    this.position++;
    +  };
    +  _proto.word = function word(namespace) {
    +    var nextToken = this.nextToken;
    +    if (nextToken && this.content(nextToken) === '|') {
    +      this.position++;
    +      return this.namespace();
    +    }
    +    return this.splitWord(namespace);
    +  };
    +  _proto.loop = function loop() {
    +    while (this.position < this.tokens.length) {
    +      this.parse(true);
    +    }
    +    this.current._inferEndPosition();
    +    return this.root;
    +  };
    +  _proto.parse = function parse(throwOnParenthesis) {
    +    switch (this.currToken[_tokenize.FIELDS.TYPE]) {
    +      case tokens.space:
    +        this.space();
    +        break;
    +      case tokens.comment:
    +        this.comment();
    +        break;
    +      case tokens.openParenthesis:
    +        this.parentheses();
    +        break;
    +      case tokens.closeParenthesis:
    +        if (throwOnParenthesis) {
    +          this.missingParenthesis();
    +        }
    +        break;
    +      case tokens.openSquare:
    +        this.attribute();
    +        break;
    +      case tokens.dollar:
    +      case tokens.caret:
    +      case tokens.equals:
    +      case tokens.word:
    +        this.word();
    +        break;
    +      case tokens.colon:
    +        this.pseudo();
    +        break;
    +      case tokens.comma:
    +        this.comma();
    +        break;
    +      case tokens.asterisk:
    +        this.universal();
    +        break;
    +      case tokens.ampersand:
    +        this.nesting();
    +        break;
    +      case tokens.slash:
    +      case tokens.combinator:
    +        this.combinator();
    +        break;
    +      case tokens.str:
    +        this.string();
    +        break;
    +      // These cases throw; no break needed.
    +      case tokens.closeSquare:
    +        this.missingSquareBracket();
    +      case tokens.semicolon:
    +        this.missingBackslash();
    +      default:
    +        this.unexpected();
    +    }
    +  }
    +
    +  /**
    +   * Helpers
    +   */;
    +  _proto.expected = function expected(description, index, found) {
    +    if (Array.isArray(description)) {
    +      var last = description.pop();
    +      description = description.join(', ') + " or " + last;
    +    }
    +    var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a';
    +    if (!found) {
    +      return this.error("Expected " + an + " " + description + ".", {
    +        index: index
    +      });
    +    }
    +    return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", {
    +      index: index
    +    });
    +  };
    +  _proto.requiredSpace = function requiredSpace(space) {
    +    return this.options.lossy ? ' ' : space;
    +  };
    +  _proto.optionalSpace = function optionalSpace(space) {
    +    return this.options.lossy ? '' : space;
    +  };
    +  _proto.lossySpace = function lossySpace(space, required) {
    +    if (this.options.lossy) {
    +      return required ? ' ' : '';
    +    } else {
    +      return space;
    +    }
    +  };
    +  _proto.parseParenthesisToken = function parseParenthesisToken(token) {
    +    var content = this.content(token);
    +    if (token[_tokenize.FIELDS.TYPE] === tokens.space) {
    +      return this.requiredSpace(content);
    +    } else {
    +      return content;
    +    }
    +  };
    +  _proto.newNode = function newNode(node, namespace) {
    +    if (namespace) {
    +      if (/^ +$/.test(namespace)) {
    +        if (!this.options.lossy) {
    +          this.spaces = (this.spaces || '') + namespace;
    +        }
    +        namespace = true;
    +      }
    +      node.namespace = namespace;
    +      unescapeProp(node, "namespace");
    +    }
    +    if (this.spaces) {
    +      node.spaces.before = this.spaces;
    +      this.spaces = '';
    +    }
    +    return this.current.append(node);
    +  };
    +  _proto.content = function content(token) {
    +    if (token === void 0) {
    +      token = this.currToken;
    +    }
    +    return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]);
    +  };
    +  /**
    +   * returns the index of the next non-whitespace, non-comment token.
    +   * returns -1 if no meaningful token is found.
    +   */
    +  _proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) {
    +    if (startPosition === void 0) {
    +      startPosition = this.position + 1;
    +    }
    +    var searchPosition = startPosition;
    +    while (searchPosition < this.tokens.length) {
    +      if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) {
    +        searchPosition++;
    +        continue;
    +      } else {
    +        return searchPosition;
    +      }
    +    }
    +    return -1;
    +  };
    +  _createClass(Parser, [{
    +    key: "currToken",
    +    get: function get() {
    +      return this.tokens[this.position];
    +    }
    +  }, {
    +    key: "nextToken",
    +    get: function get() {
    +      return this.tokens[this.position + 1];
    +    }
    +  }, {
    +    key: "prevToken",
    +    get: function get() {
    +      return this.tokens[this.position - 1];
    +    }
    +  }]);
    +  return Parser;
    +}();
    +exports["default"] = Parser;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/processor.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/processor.js
    new file mode 100644
    index 00000000..dbfa0918
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/processor.js
    @@ -0,0 +1,170 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _parser = _interopRequireDefault(require("./parser"));
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +var Processor = /*#__PURE__*/function () {
    +  function Processor(func, options) {
    +    this.func = func || function noop() {};
    +    this.funcRes = null;
    +    this.options = options;
    +  }
    +  var _proto = Processor.prototype;
    +  _proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
    +    if (options === void 0) {
    +      options = {};
    +    }
    +    var merged = Object.assign({}, this.options, options);
    +    if (merged.updateSelector === false) {
    +      return false;
    +    } else {
    +      return typeof rule !== "string";
    +    }
    +  };
    +  _proto._isLossy = function _isLossy(options) {
    +    if (options === void 0) {
    +      options = {};
    +    }
    +    var merged = Object.assign({}, this.options, options);
    +    if (merged.lossless === false) {
    +      return true;
    +    } else {
    +      return false;
    +    }
    +  };
    +  _proto._root = function _root(rule, options) {
    +    if (options === void 0) {
    +      options = {};
    +    }
    +    var parser = new _parser["default"](rule, this._parseOptions(options));
    +    return parser.root;
    +  };
    +  _proto._parseOptions = function _parseOptions(options) {
    +    return {
    +      lossy: this._isLossy(options)
    +    };
    +  };
    +  _proto._run = function _run(rule, options) {
    +    var _this = this;
    +    if (options === void 0) {
    +      options = {};
    +    }
    +    return new Promise(function (resolve, reject) {
    +      try {
    +        var root = _this._root(rule, options);
    +        Promise.resolve(_this.func(root)).then(function (transform) {
    +          var string = undefined;
    +          if (_this._shouldUpdateSelector(rule, options)) {
    +            string = root.toString();
    +            rule.selector = string;
    +          }
    +          return {
    +            transform: transform,
    +            root: root,
    +            string: string
    +          };
    +        }).then(resolve, reject);
    +      } catch (e) {
    +        reject(e);
    +        return;
    +      }
    +    });
    +  };
    +  _proto._runSync = function _runSync(rule, options) {
    +    if (options === void 0) {
    +      options = {};
    +    }
    +    var root = this._root(rule, options);
    +    var transform = this.func(root);
    +    if (transform && typeof transform.then === "function") {
    +      throw new Error("Selector processor returned a promise to a synchronous call.");
    +    }
    +    var string = undefined;
    +    if (options.updateSelector && typeof rule !== "string") {
    +      string = root.toString();
    +      rule.selector = string;
    +    }
    +    return {
    +      transform: transform,
    +      root: root,
    +      string: string
    +    };
    +  }
    +
    +  /**
    +   * Process rule into a selector AST.
    +   *
    +   * @param rule {postcss.Rule | string} The css selector to be processed
    +   * @param options The options for processing
    +   * @returns {Promise} The AST of the selector after processing it.
    +   */;
    +  _proto.ast = function ast(rule, options) {
    +    return this._run(rule, options).then(function (result) {
    +      return result.root;
    +    });
    +  }
    +
    +  /**
    +   * Process rule into a selector AST synchronously.
    +   *
    +   * @param rule {postcss.Rule | string} The css selector to be processed
    +   * @param options The options for processing
    +   * @returns {parser.Root} The AST of the selector after processing it.
    +   */;
    +  _proto.astSync = function astSync(rule, options) {
    +    return this._runSync(rule, options).root;
    +  }
    +
    +  /**
    +   * Process a selector into a transformed value asynchronously
    +   *
    +   * @param rule {postcss.Rule | string} The css selector to be processed
    +   * @param options The options for processing
    +   * @returns {Promise} The value returned by the processor.
    +   */;
    +  _proto.transform = function transform(rule, options) {
    +    return this._run(rule, options).then(function (result) {
    +      return result.transform;
    +    });
    +  }
    +
    +  /**
    +   * Process a selector into a transformed value synchronously.
    +   *
    +   * @param rule {postcss.Rule | string} The css selector to be processed
    +   * @param options The options for processing
    +   * @returns {any} The value returned by the processor.
    +   */;
    +  _proto.transformSync = function transformSync(rule, options) {
    +    return this._runSync(rule, options).transform;
    +  }
    +
    +  /**
    +   * Process a selector into a new selector string asynchronously.
    +   *
    +   * @param rule {postcss.Rule | string} The css selector to be processed
    +   * @param options The options for processing
    +   * @returns {string} the selector after processing.
    +   */;
    +  _proto.process = function process(rule, options) {
    +    return this._run(rule, options).then(function (result) {
    +      return result.string || result.root.toString();
    +    });
    +  }
    +
    +  /**
    +   * Process a selector into a new selector string synchronously.
    +   *
    +   * @param rule {postcss.Rule | string} The css selector to be processed
    +   * @param options The options for processing
    +   * @returns {string} the selector after processing.
    +   */;
    +  _proto.processSync = function processSync(rule, options) {
    +    var result = this._runSync(rule, options);
    +    return result.string || result.root.toString();
    +  };
    +  return Processor;
    +}();
    +exports["default"] = Processor;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/attribute.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/attribute.js
    new file mode 100644
    index 00000000..0351a22b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/attribute.js
    @@ -0,0 +1,448 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +exports.unescapeValue = unescapeValue;
    +var _cssesc = _interopRequireDefault(require("cssesc"));
    +var _unesc = _interopRequireDefault(require("../util/unesc"));
    +var _namespace = _interopRequireDefault(require("./namespace"));
    +var _types = require("./types");
    +var _CSSESC_QUOTE_OPTIONS;
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +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, 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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var deprecate = require("util-deprecate");
    +var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
    +var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
    +var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
    +var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
    +function unescapeValue(value) {
    +  var deprecatedUsage = false;
    +  var quoteMark = null;
    +  var unescaped = value;
    +  var m = unescaped.match(WRAPPED_IN_QUOTES);
    +  if (m) {
    +    quoteMark = m[1];
    +    unescaped = m[2];
    +  }
    +  unescaped = (0, _unesc["default"])(unescaped);
    +  if (unescaped !== value) {
    +    deprecatedUsage = true;
    +  }
    +  return {
    +    deprecatedUsage: deprecatedUsage,
    +    unescaped: unescaped,
    +    quoteMark: quoteMark
    +  };
    +}
    +function handleDeprecatedContructorOpts(opts) {
    +  if (opts.quoteMark !== undefined) {
    +    return opts;
    +  }
    +  if (opts.value === undefined) {
    +    return opts;
    +  }
    +  warnOfDeprecatedConstructor();
    +  var _unescapeValue = unescapeValue(opts.value),
    +    quoteMark = _unescapeValue.quoteMark,
    +    unescaped = _unescapeValue.unescaped;
    +  if (!opts.raws) {
    +    opts.raws = {};
    +  }
    +  if (opts.raws.value === undefined) {
    +    opts.raws.value = opts.value;
    +  }
    +  opts.value = unescaped;
    +  opts.quoteMark = quoteMark;
    +  return opts;
    +}
    +var Attribute = /*#__PURE__*/function (_Namespace) {
    +  _inheritsLoose(Attribute, _Namespace);
    +  function Attribute(opts) {
    +    var _this;
    +    if (opts === void 0) {
    +      opts = {};
    +    }
    +    _this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
    +    _this.type = _types.ATTRIBUTE;
    +    _this.raws = _this.raws || {};
    +    Object.defineProperty(_this.raws, 'unquoted', {
    +      get: deprecate(function () {
    +        return _this.value;
    +      }, "attr.raws.unquoted is deprecated. Call attr.value instead."),
    +      set: deprecate(function () {
    +        return _this.value;
    +      }, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
    +    });
    +    _this._constructed = true;
    +    return _this;
    +  }
    +
    +  /**
    +   * Returns the Attribute's value quoted such that it would be legal to use
    +   * in the value of a css file. The original value's quotation setting
    +   * used for stringification is left unchanged. See `setValue(value, options)`
    +   * if you want to control the quote settings of a new value for the attribute.
    +   *
    +   * You can also change the quotation used for the current value by setting quoteMark.
    +   *
    +   * Options:
    +   *   * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
    +   *     option is not set, the original value for quoteMark will be used. If
    +   *     indeterminate, a double quote is used. The legal values are:
    +   *     * `null` - the value will be unquoted and characters will be escaped as necessary.
    +   *     * `'` - the value will be quoted with a single quote and single quotes are escaped.
    +   *     * `"` - the value will be quoted with a double quote and double quotes are escaped.
    +   *   * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
    +   *     over the quoteMark option value.
    +   *   * smart {boolean} - if true, will select a quote mark based on the value
    +   *     and the other options specified here. See the `smartQuoteMark()`
    +   *     method.
    +   **/
    +  var _proto = Attribute.prototype;
    +  _proto.getQuotedValue = function getQuotedValue(options) {
    +    if (options === void 0) {
    +      options = {};
    +    }
    +    var quoteMark = this._determineQuoteMark(options);
    +    var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
    +    var escaped = (0, _cssesc["default"])(this._value, cssescopts);
    +    return escaped;
    +  };
    +  _proto._determineQuoteMark = function _determineQuoteMark(options) {
    +    return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
    +  }
    +
    +  /**
    +   * Set the unescaped value with the specified quotation options. The value
    +   * provided must not include any wrapping quote marks -- those quotes will
    +   * be interpreted as part of the value and escaped accordingly.
    +   */;
    +  _proto.setValue = function setValue(value, options) {
    +    if (options === void 0) {
    +      options = {};
    +    }
    +    this._value = value;
    +    this._quoteMark = this._determineQuoteMark(options);
    +    this._syncRawValue();
    +  }
    +
    +  /**
    +   * Intelligently select a quoteMark value based on the value's contents. If
    +   * the value is a legal CSS ident, it will not be quoted. Otherwise a quote
    +   * mark will be picked that minimizes the number of escapes.
    +   *
    +   * If there's no clear winner, the quote mark from these options is used,
    +   * then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
    +   * true). If the quoteMark is unspecified, a double quote is used.
    +   *
    +   * @param options This takes the quoteMark and preferCurrentQuoteMark options
    +   * from the quoteValue method.
    +   */;
    +  _proto.smartQuoteMark = function smartQuoteMark(options) {
    +    var v = this.value;
    +    var numSingleQuotes = v.replace(/[^']/g, '').length;
    +    var numDoubleQuotes = v.replace(/[^"]/g, '').length;
    +    if (numSingleQuotes + numDoubleQuotes === 0) {
    +      var escaped = (0, _cssesc["default"])(v, {
    +        isIdentifier: true
    +      });
    +      if (escaped === v) {
    +        return Attribute.NO_QUOTE;
    +      } else {
    +        var pref = this.preferredQuoteMark(options);
    +        if (pref === Attribute.NO_QUOTE) {
    +          // pick a quote mark that isn't none and see if it's smaller
    +          var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
    +          var opts = CSSESC_QUOTE_OPTIONS[quote];
    +          var quoteValue = (0, _cssesc["default"])(v, opts);
    +          if (quoteValue.length < escaped.length) {
    +            return quote;
    +          }
    +        }
    +        return pref;
    +      }
    +    } else if (numDoubleQuotes === numSingleQuotes) {
    +      return this.preferredQuoteMark(options);
    +    } else if (numDoubleQuotes < numSingleQuotes) {
    +      return Attribute.DOUBLE_QUOTE;
    +    } else {
    +      return Attribute.SINGLE_QUOTE;
    +    }
    +  }
    +
    +  /**
    +   * Selects the preferred quote mark based on the options and the current quote mark value.
    +   * If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
    +   * instead.
    +   */;
    +  _proto.preferredQuoteMark = function preferredQuoteMark(options) {
    +    var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
    +    if (quoteMark === undefined) {
    +      quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
    +    }
    +    if (quoteMark === undefined) {
    +      quoteMark = Attribute.DOUBLE_QUOTE;
    +    }
    +    return quoteMark;
    +  };
    +  _proto._syncRawValue = function _syncRawValue() {
    +    var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
    +    if (rawValue === this._value) {
    +      if (this.raws) {
    +        delete this.raws.value;
    +      }
    +    } else {
    +      this.raws.value = rawValue;
    +    }
    +  };
    +  _proto._handleEscapes = function _handleEscapes(prop, value) {
    +    if (this._constructed) {
    +      var escaped = (0, _cssesc["default"])(value, {
    +        isIdentifier: true
    +      });
    +      if (escaped !== value) {
    +        this.raws[prop] = escaped;
    +      } else {
    +        delete this.raws[prop];
    +      }
    +    }
    +  };
    +  _proto._spacesFor = function _spacesFor(name) {
    +    var attrSpaces = {
    +      before: '',
    +      after: ''
    +    };
    +    var spaces = this.spaces[name] || {};
    +    var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
    +    return Object.assign(attrSpaces, spaces, rawSpaces);
    +  };
    +  _proto._stringFor = function _stringFor(name, spaceName, concat) {
    +    if (spaceName === void 0) {
    +      spaceName = name;
    +    }
    +    if (concat === void 0) {
    +      concat = defaultAttrConcat;
    +    }
    +    var attrSpaces = this._spacesFor(spaceName);
    +    return concat(this.stringifyProperty(name), attrSpaces);
    +  }
    +
    +  /**
    +   * returns the offset of the attribute part specified relative to the
    +   * start of the node of the output string.
    +   *
    +   * * "ns" - alias for "namespace"
    +   * * "namespace" - the namespace if it exists.
    +   * * "attribute" - the attribute name
    +   * * "attributeNS" - the start of the attribute or its namespace
    +   * * "operator" - the match operator of the attribute
    +   * * "value" - The value (string or identifier)
    +   * * "insensitive" - the case insensitivity flag;
    +   * @param part One of the possible values inside an attribute.
    +   * @returns -1 if the name is invalid or the value doesn't exist in this attribute.
    +   */;
    +  _proto.offsetOf = function offsetOf(name) {
    +    var count = 1;
    +    var attributeSpaces = this._spacesFor("attribute");
    +    count += attributeSpaces.before.length;
    +    if (name === "namespace" || name === "ns") {
    +      return this.namespace ? count : -1;
    +    }
    +    if (name === "attributeNS") {
    +      return count;
    +    }
    +    count += this.namespaceString.length;
    +    if (this.namespace) {
    +      count += 1;
    +    }
    +    if (name === "attribute") {
    +      return count;
    +    }
    +    count += this.stringifyProperty("attribute").length;
    +    count += attributeSpaces.after.length;
    +    var operatorSpaces = this._spacesFor("operator");
    +    count += operatorSpaces.before.length;
    +    var operator = this.stringifyProperty("operator");
    +    if (name === "operator") {
    +      return operator ? count : -1;
    +    }
    +    count += operator.length;
    +    count += operatorSpaces.after.length;
    +    var valueSpaces = this._spacesFor("value");
    +    count += valueSpaces.before.length;
    +    var value = this.stringifyProperty("value");
    +    if (name === "value") {
    +      return value ? count : -1;
    +    }
    +    count += value.length;
    +    count += valueSpaces.after.length;
    +    var insensitiveSpaces = this._spacesFor("insensitive");
    +    count += insensitiveSpaces.before.length;
    +    if (name === "insensitive") {
    +      return this.insensitive ? count : -1;
    +    }
    +    return -1;
    +  };
    +  _proto.toString = function toString() {
    +    var _this2 = this;
    +    var selector = [this.rawSpaceBefore, '['];
    +    selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
    +    if (this.operator && (this.value || this.value === '')) {
    +      selector.push(this._stringFor('operator'));
    +      selector.push(this._stringFor('value'));
    +      selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
    +        if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
    +          attrSpaces.before = " ";
    +        }
    +        return defaultAttrConcat(attrValue, attrSpaces);
    +      }));
    +    }
    +    selector.push(']');
    +    selector.push(this.rawSpaceAfter);
    +    return selector.join('');
    +  };
    +  _createClass(Attribute, [{
    +    key: "quoted",
    +    get: function get() {
    +      var qm = this.quoteMark;
    +      return qm === "'" || qm === '"';
    +    },
    +    set: function set(value) {
    +      warnOfDeprecatedQuotedAssignment();
    +    }
    +
    +    /**
    +     * returns a single (`'`) or double (`"`) quote character if the value is quoted.
    +     * returns `null` if the value is not quoted.
    +     * returns `undefined` if the quotation state is unknown (this can happen when
    +     * the attribute is constructed without specifying a quote mark.)
    +     */
    +  }, {
    +    key: "quoteMark",
    +    get: function get() {
    +      return this._quoteMark;
    +    }
    +
    +    /**
    +     * Set the quote mark to be used by this attribute's value.
    +     * If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
    +     * value is updated accordingly.
    +     *
    +     * @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
    +     */,
    +    set: function set(quoteMark) {
    +      if (!this._constructed) {
    +        this._quoteMark = quoteMark;
    +        return;
    +      }
    +      if (this._quoteMark !== quoteMark) {
    +        this._quoteMark = quoteMark;
    +        this._syncRawValue();
    +      }
    +    }
    +  }, {
    +    key: "qualifiedAttribute",
    +    get: function get() {
    +      return this.qualifiedName(this.raws.attribute || this.attribute);
    +    }
    +  }, {
    +    key: "insensitiveFlag",
    +    get: function get() {
    +      return this.insensitive ? 'i' : '';
    +    }
    +  }, {
    +    key: "value",
    +    get: function get() {
    +      return this._value;
    +    },
    +    set:
    +    /**
    +     * Before 3.0, the value had to be set to an escaped value including any wrapped
    +     * quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
    +     * is unescaped during parsing and any quote marks are removed.
    +     *
    +     * Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
    +     * a deprecation warning is raised when the new value contains any characters that would
    +     * require escaping (including if it contains wrapped quotes).
    +     *
    +     * Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
    +     * how the new value is quoted.
    +     */
    +    function set(v) {
    +      if (this._constructed) {
    +        var _unescapeValue2 = unescapeValue(v),
    +          deprecatedUsage = _unescapeValue2.deprecatedUsage,
    +          unescaped = _unescapeValue2.unescaped,
    +          quoteMark = _unescapeValue2.quoteMark;
    +        if (deprecatedUsage) {
    +          warnOfDeprecatedValueAssignment();
    +        }
    +        if (unescaped === this._value && quoteMark === this._quoteMark) {
    +          return;
    +        }
    +        this._value = unescaped;
    +        this._quoteMark = quoteMark;
    +        this._syncRawValue();
    +      } else {
    +        this._value = v;
    +      }
    +    }
    +  }, {
    +    key: "insensitive",
    +    get: function get() {
    +      return this._insensitive;
    +    }
    +
    +    /**
    +     * Set the case insensitive flag.
    +     * If the case insensitive flag changes, the raw (escaped) value at `attr.raws.insensitiveFlag`
    +     * of the attribute is updated accordingly.
    +     *
    +     * @param {true | false} insensitive true if the attribute should match case-insensitively.
    +     */,
    +    set: function set(insensitive) {
    +      if (!insensitive) {
    +        this._insensitive = false;
    +
    +        // "i" and "I" can be used in "this.raws.insensitiveFlag" to store the original notation.
    +        // When setting `attr.insensitive = false` both should be erased to ensure correct serialization.
    +        if (this.raws && (this.raws.insensitiveFlag === 'I' || this.raws.insensitiveFlag === 'i')) {
    +          this.raws.insensitiveFlag = undefined;
    +        }
    +      }
    +      this._insensitive = insensitive;
    +    }
    +  }, {
    +    key: "attribute",
    +    get: function get() {
    +      return this._attribute;
    +    },
    +    set: function set(name) {
    +      this._handleEscapes("attribute", name);
    +      this._attribute = name;
    +    }
    +  }]);
    +  return Attribute;
    +}(_namespace["default"]);
    +exports["default"] = Attribute;
    +Attribute.NO_QUOTE = null;
    +Attribute.SINGLE_QUOTE = "'";
    +Attribute.DOUBLE_QUOTE = '"';
    +var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
    +  "'": {
    +    quotes: 'single',
    +    wrap: true
    +  },
    +  '"': {
    +    quotes: 'double',
    +    wrap: true
    +  }
    +}, _CSSESC_QUOTE_OPTIONS[null] = {
    +  isIdentifier: true
    +}, _CSSESC_QUOTE_OPTIONS);
    +function defaultAttrConcat(attrValue, attrSpaces) {
    +  return "" + attrSpaces.before + attrValue + attrSpaces.after;
    +}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/className.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/className.js
    new file mode 100644
    index 00000000..af325977
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/className.js
    @@ -0,0 +1,50 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _cssesc = _interopRequireDefault(require("cssesc"));
    +var _util = require("../util");
    +var _node = _interopRequireDefault(require("./node"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +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, 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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var ClassName = /*#__PURE__*/function (_Node) {
    +  _inheritsLoose(ClassName, _Node);
    +  function ClassName(opts) {
    +    var _this;
    +    _this = _Node.call(this, opts) || this;
    +    _this.type = _types.CLASS;
    +    _this._constructed = true;
    +    return _this;
    +  }
    +  var _proto = ClassName.prototype;
    +  _proto.valueToString = function valueToString() {
    +    return '.' + _Node.prototype.valueToString.call(this);
    +  };
    +  _createClass(ClassName, [{
    +    key: "value",
    +    get: function get() {
    +      return this._value;
    +    },
    +    set: function set(v) {
    +      if (this._constructed) {
    +        var escaped = (0, _cssesc["default"])(v, {
    +          isIdentifier: true
    +        });
    +        if (escaped !== v) {
    +          (0, _util.ensureObject)(this, "raws");
    +          this.raws.value = escaped;
    +        } else if (this.raws) {
    +          delete this.raws.value;
    +        }
    +      }
    +      this._value = v;
    +    }
    +  }]);
    +  return ClassName;
    +}(_node["default"]);
    +exports["default"] = ClassName;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/combinator.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/combinator.js
    new file mode 100644
    index 00000000..c6449f43
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/combinator.js
    @@ -0,0 +1,21 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _node = _interopRequireDefault(require("./node"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var Combinator = /*#__PURE__*/function (_Node) {
    +  _inheritsLoose(Combinator, _Node);
    +  function Combinator(opts) {
    +    var _this;
    +    _this = _Node.call(this, opts) || this;
    +    _this.type = _types.COMBINATOR;
    +    return _this;
    +  }
    +  return Combinator;
    +}(_node["default"]);
    +exports["default"] = Combinator;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/comment.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/comment.js
    new file mode 100644
    index 00000000..1709d5be
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/comment.js
    @@ -0,0 +1,21 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _node = _interopRequireDefault(require("./node"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var Comment = /*#__PURE__*/function (_Node) {
    +  _inheritsLoose(Comment, _Node);
    +  function Comment(opts) {
    +    var _this;
    +    _this = _Node.call(this, opts) || this;
    +    _this.type = _types.COMMENT;
    +    return _this;
    +  }
    +  return Comment;
    +}(_node["default"]);
    +exports["default"] = Comment;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/constructors.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/constructors.js
    new file mode 100644
    index 00000000..68825932
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/constructors.js
    @@ -0,0 +1,65 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports.universal = exports.tag = exports.string = exports.selector = exports.root = exports.pseudo = exports.nesting = exports.id = exports.comment = exports.combinator = exports.className = exports.attribute = void 0;
    +var _attribute = _interopRequireDefault(require("./attribute"));
    +var _className = _interopRequireDefault(require("./className"));
    +var _combinator = _interopRequireDefault(require("./combinator"));
    +var _comment = _interopRequireDefault(require("./comment"));
    +var _id = _interopRequireDefault(require("./id"));
    +var _nesting = _interopRequireDefault(require("./nesting"));
    +var _pseudo = _interopRequireDefault(require("./pseudo"));
    +var _root = _interopRequireDefault(require("./root"));
    +var _selector = _interopRequireDefault(require("./selector"));
    +var _string = _interopRequireDefault(require("./string"));
    +var _tag = _interopRequireDefault(require("./tag"));
    +var _universal = _interopRequireDefault(require("./universal"));
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +var attribute = function attribute(opts) {
    +  return new _attribute["default"](opts);
    +};
    +exports.attribute = attribute;
    +var className = function className(opts) {
    +  return new _className["default"](opts);
    +};
    +exports.className = className;
    +var combinator = function combinator(opts) {
    +  return new _combinator["default"](opts);
    +};
    +exports.combinator = combinator;
    +var comment = function comment(opts) {
    +  return new _comment["default"](opts);
    +};
    +exports.comment = comment;
    +var id = function id(opts) {
    +  return new _id["default"](opts);
    +};
    +exports.id = id;
    +var nesting = function nesting(opts) {
    +  return new _nesting["default"](opts);
    +};
    +exports.nesting = nesting;
    +var pseudo = function pseudo(opts) {
    +  return new _pseudo["default"](opts);
    +};
    +exports.pseudo = pseudo;
    +var root = function root(opts) {
    +  return new _root["default"](opts);
    +};
    +exports.root = root;
    +var selector = function selector(opts) {
    +  return new _selector["default"](opts);
    +};
    +exports.selector = selector;
    +var string = function string(opts) {
    +  return new _string["default"](opts);
    +};
    +exports.string = string;
    +var tag = function tag(opts) {
    +  return new _tag["default"](opts);
    +};
    +exports.tag = tag;
    +var universal = function universal(opts) {
    +  return new _universal["default"](opts);
    +};
    +exports.universal = universal;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/container.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/container.js
    new file mode 100644
    index 00000000..8600c544
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/container.js
    @@ -0,0 +1,308 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _node = _interopRequireDefault(require("./node"));
    +var types = _interopRequireWildcard(require("./types"));
    +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
    +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
    +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
    +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
    +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, 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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var Container = /*#__PURE__*/function (_Node) {
    +  _inheritsLoose(Container, _Node);
    +  function Container(opts) {
    +    var _this;
    +    _this = _Node.call(this, opts) || this;
    +    if (!_this.nodes) {
    +      _this.nodes = [];
    +    }
    +    return _this;
    +  }
    +  var _proto = Container.prototype;
    +  _proto.append = function append(selector) {
    +    selector.parent = this;
    +    this.nodes.push(selector);
    +    return this;
    +  };
    +  _proto.prepend = function prepend(selector) {
    +    selector.parent = this;
    +    this.nodes.unshift(selector);
    +    return this;
    +  };
    +  _proto.at = function at(index) {
    +    return this.nodes[index];
    +  };
    +  _proto.index = function index(child) {
    +    if (typeof child === 'number') {
    +      return child;
    +    }
    +    return this.nodes.indexOf(child);
    +  };
    +  _proto.removeChild = function removeChild(child) {
    +    child = this.index(child);
    +    this.at(child).parent = undefined;
    +    this.nodes.splice(child, 1);
    +    var index;
    +    for (var id in this.indexes) {
    +      index = this.indexes[id];
    +      if (index >= child) {
    +        this.indexes[id] = index - 1;
    +      }
    +    }
    +    return this;
    +  };
    +  _proto.removeAll = function removeAll() {
    +    for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
    +      var node = _step.value;
    +      node.parent = undefined;
    +    }
    +    this.nodes = [];
    +    return this;
    +  };
    +  _proto.empty = function empty() {
    +    return this.removeAll();
    +  };
    +  _proto.insertAfter = function insertAfter(oldNode, newNode) {
    +    newNode.parent = this;
    +    var oldIndex = this.index(oldNode);
    +    this.nodes.splice(oldIndex + 1, 0, newNode);
    +    newNode.parent = this;
    +    var index;
    +    for (var id in this.indexes) {
    +      index = this.indexes[id];
    +      if (oldIndex <= index) {
    +        this.indexes[id] = index + 1;
    +      }
    +    }
    +    return this;
    +  };
    +  _proto.insertBefore = function insertBefore(oldNode, newNode) {
    +    newNode.parent = this;
    +    var oldIndex = this.index(oldNode);
    +    this.nodes.splice(oldIndex, 0, newNode);
    +    newNode.parent = this;
    +    var index;
    +    for (var id in this.indexes) {
    +      index = this.indexes[id];
    +      if (index <= oldIndex) {
    +        this.indexes[id] = index + 1;
    +      }
    +    }
    +    return this;
    +  };
    +  _proto._findChildAtPosition = function _findChildAtPosition(line, col) {
    +    var found = undefined;
    +    this.each(function (node) {
    +      if (node.atPosition) {
    +        var foundChild = node.atPosition(line, col);
    +        if (foundChild) {
    +          found = foundChild;
    +          return false;
    +        }
    +      } else if (node.isAtPosition(line, col)) {
    +        found = node;
    +        return false;
    +      }
    +    });
    +    return found;
    +  }
    +
    +  /**
    +   * Return the most specific node at the line and column number given.
    +   * The source location is based on the original parsed location, locations aren't
    +   * updated as selector nodes are mutated.
    +   * 
    +   * Note that this location is relative to the location of the first character
    +   * of the selector, and not the location of the selector in the overall document
    +   * when used in conjunction with postcss.
    +   *
    +   * If not found, returns undefined.
    +   * @param {number} line The line number of the node to find. (1-based index)
    +   * @param {number} col  The column number of the node to find. (1-based index)
    +   */;
    +  _proto.atPosition = function atPosition(line, col) {
    +    if (this.isAtPosition(line, col)) {
    +      return this._findChildAtPosition(line, col) || this;
    +    } else {
    +      return undefined;
    +    }
    +  };
    +  _proto._inferEndPosition = function _inferEndPosition() {
    +    if (this.last && this.last.source && this.last.source.end) {
    +      this.source = this.source || {};
    +      this.source.end = this.source.end || {};
    +      Object.assign(this.source.end, this.last.source.end);
    +    }
    +  };
    +  _proto.each = function each(callback) {
    +    if (!this.lastEach) {
    +      this.lastEach = 0;
    +    }
    +    if (!this.indexes) {
    +      this.indexes = {};
    +    }
    +    this.lastEach++;
    +    var id = this.lastEach;
    +    this.indexes[id] = 0;
    +    if (!this.length) {
    +      return undefined;
    +    }
    +    var index, result;
    +    while (this.indexes[id] < this.length) {
    +      index = this.indexes[id];
    +      result = callback(this.at(index), index);
    +      if (result === false) {
    +        break;
    +      }
    +      this.indexes[id] += 1;
    +    }
    +    delete this.indexes[id];
    +    if (result === false) {
    +      return false;
    +    }
    +  };
    +  _proto.walk = function walk(callback) {
    +    return this.each(function (node, i) {
    +      var result = callback(node, i);
    +      if (result !== false && node.length) {
    +        result = node.walk(callback);
    +      }
    +      if (result === false) {
    +        return false;
    +      }
    +    });
    +  };
    +  _proto.walkAttributes = function walkAttributes(callback) {
    +    var _this2 = this;
    +    return this.walk(function (selector) {
    +      if (selector.type === types.ATTRIBUTE) {
    +        return callback.call(_this2, selector);
    +      }
    +    });
    +  };
    +  _proto.walkClasses = function walkClasses(callback) {
    +    var _this3 = this;
    +    return this.walk(function (selector) {
    +      if (selector.type === types.CLASS) {
    +        return callback.call(_this3, selector);
    +      }
    +    });
    +  };
    +  _proto.walkCombinators = function walkCombinators(callback) {
    +    var _this4 = this;
    +    return this.walk(function (selector) {
    +      if (selector.type === types.COMBINATOR) {
    +        return callback.call(_this4, selector);
    +      }
    +    });
    +  };
    +  _proto.walkComments = function walkComments(callback) {
    +    var _this5 = this;
    +    return this.walk(function (selector) {
    +      if (selector.type === types.COMMENT) {
    +        return callback.call(_this5, selector);
    +      }
    +    });
    +  };
    +  _proto.walkIds = function walkIds(callback) {
    +    var _this6 = this;
    +    return this.walk(function (selector) {
    +      if (selector.type === types.ID) {
    +        return callback.call(_this6, selector);
    +      }
    +    });
    +  };
    +  _proto.walkNesting = function walkNesting(callback) {
    +    var _this7 = this;
    +    return this.walk(function (selector) {
    +      if (selector.type === types.NESTING) {
    +        return callback.call(_this7, selector);
    +      }
    +    });
    +  };
    +  _proto.walkPseudos = function walkPseudos(callback) {
    +    var _this8 = this;
    +    return this.walk(function (selector) {
    +      if (selector.type === types.PSEUDO) {
    +        return callback.call(_this8, selector);
    +      }
    +    });
    +  };
    +  _proto.walkTags = function walkTags(callback) {
    +    var _this9 = this;
    +    return this.walk(function (selector) {
    +      if (selector.type === types.TAG) {
    +        return callback.call(_this9, selector);
    +      }
    +    });
    +  };
    +  _proto.walkUniversals = function walkUniversals(callback) {
    +    var _this10 = this;
    +    return this.walk(function (selector) {
    +      if (selector.type === types.UNIVERSAL) {
    +        return callback.call(_this10, selector);
    +      }
    +    });
    +  };
    +  _proto.split = function split(callback) {
    +    var _this11 = this;
    +    var current = [];
    +    return this.reduce(function (memo, node, index) {
    +      var split = callback.call(_this11, node);
    +      current.push(node);
    +      if (split) {
    +        memo.push(current);
    +        current = [];
    +      } else if (index === _this11.length - 1) {
    +        memo.push(current);
    +      }
    +      return memo;
    +    }, []);
    +  };
    +  _proto.map = function map(callback) {
    +    return this.nodes.map(callback);
    +  };
    +  _proto.reduce = function reduce(callback, memo) {
    +    return this.nodes.reduce(callback, memo);
    +  };
    +  _proto.every = function every(callback) {
    +    return this.nodes.every(callback);
    +  };
    +  _proto.some = function some(callback) {
    +    return this.nodes.some(callback);
    +  };
    +  _proto.filter = function filter(callback) {
    +    return this.nodes.filter(callback);
    +  };
    +  _proto.sort = function sort(callback) {
    +    return this.nodes.sort(callback);
    +  };
    +  _proto.toString = function toString() {
    +    return this.map(String).join('');
    +  };
    +  _createClass(Container, [{
    +    key: "first",
    +    get: function get() {
    +      return this.at(0);
    +    }
    +  }, {
    +    key: "last",
    +    get: function get() {
    +      return this.at(this.length - 1);
    +    }
    +  }, {
    +    key: "length",
    +    get: function get() {
    +      return this.nodes.length;
    +    }
    +  }]);
    +  return Container;
    +}(_node["default"]);
    +exports["default"] = Container;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/guards.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/guards.js
    new file mode 100644
    index 00000000..f06161e9
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/guards.js
    @@ -0,0 +1,58 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = void 0;
    +exports.isContainer = isContainer;
    +exports.isIdentifier = void 0;
    +exports.isNamespace = isNamespace;
    +exports.isNesting = void 0;
    +exports.isNode = isNode;
    +exports.isPseudo = void 0;
    +exports.isPseudoClass = isPseudoClass;
    +exports.isPseudoElement = isPseudoElement;
    +exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = void 0;
    +var _types = require("./types");
    +var _IS_TYPE;
    +var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types.ATTRIBUTE] = true, _IS_TYPE[_types.CLASS] = true, _IS_TYPE[_types.COMBINATOR] = true, _IS_TYPE[_types.COMMENT] = true, _IS_TYPE[_types.ID] = true, _IS_TYPE[_types.NESTING] = true, _IS_TYPE[_types.PSEUDO] = true, _IS_TYPE[_types.ROOT] = true, _IS_TYPE[_types.SELECTOR] = true, _IS_TYPE[_types.STRING] = true, _IS_TYPE[_types.TAG] = true, _IS_TYPE[_types.UNIVERSAL] = true, _IS_TYPE);
    +function isNode(node) {
    +  return typeof node === "object" && IS_TYPE[node.type];
    +}
    +function isNodeType(type, node) {
    +  return isNode(node) && node.type === type;
    +}
    +var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
    +exports.isAttribute = isAttribute;
    +var isClassName = isNodeType.bind(null, _types.CLASS);
    +exports.isClassName = isClassName;
    +var isCombinator = isNodeType.bind(null, _types.COMBINATOR);
    +exports.isCombinator = isCombinator;
    +var isComment = isNodeType.bind(null, _types.COMMENT);
    +exports.isComment = isComment;
    +var isIdentifier = isNodeType.bind(null, _types.ID);
    +exports.isIdentifier = isIdentifier;
    +var isNesting = isNodeType.bind(null, _types.NESTING);
    +exports.isNesting = isNesting;
    +var isPseudo = isNodeType.bind(null, _types.PSEUDO);
    +exports.isPseudo = isPseudo;
    +var isRoot = isNodeType.bind(null, _types.ROOT);
    +exports.isRoot = isRoot;
    +var isSelector = isNodeType.bind(null, _types.SELECTOR);
    +exports.isSelector = isSelector;
    +var isString = isNodeType.bind(null, _types.STRING);
    +exports.isString = isString;
    +var isTag = isNodeType.bind(null, _types.TAG);
    +exports.isTag = isTag;
    +var isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
    +exports.isUniversal = isUniversal;
    +function isPseudoElement(node) {
    +  return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after" || node.value.toLowerCase() === ":first-letter" || node.value.toLowerCase() === ":first-line");
    +}
    +function isPseudoClass(node) {
    +  return isPseudo(node) && !isPseudoElement(node);
    +}
    +function isContainer(node) {
    +  return !!(isNode(node) && node.walk);
    +}
    +function isNamespace(node) {
    +  return isAttribute(node) || isTag(node);
    +}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/id.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/id.js
    new file mode 100644
    index 00000000..8baef728
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/id.js
    @@ -0,0 +1,25 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _node = _interopRequireDefault(require("./node"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var ID = /*#__PURE__*/function (_Node) {
    +  _inheritsLoose(ID, _Node);
    +  function ID(opts) {
    +    var _this;
    +    _this = _Node.call(this, opts) || this;
    +    _this.type = _types.ID;
    +    return _this;
    +  }
    +  var _proto = ID.prototype;
    +  _proto.valueToString = function valueToString() {
    +    return '#' + _Node.prototype.valueToString.call(this);
    +  };
    +  return ID;
    +}(_node["default"]);
    +exports["default"] = ID;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/index.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/index.js
    new file mode 100644
    index 00000000..f1f6b7f5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/index.js
    @@ -0,0 +1,21 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +var _types = require("./types");
    +Object.keys(_types).forEach(function (key) {
    +  if (key === "default" || key === "__esModule") return;
    +  if (key in exports && exports[key] === _types[key]) return;
    +  exports[key] = _types[key];
    +});
    +var _constructors = require("./constructors");
    +Object.keys(_constructors).forEach(function (key) {
    +  if (key === "default" || key === "__esModule") return;
    +  if (key in exports && exports[key] === _constructors[key]) return;
    +  exports[key] = _constructors[key];
    +});
    +var _guards = require("./guards");
    +Object.keys(_guards).forEach(function (key) {
    +  if (key === "default" || key === "__esModule") return;
    +  if (key in exports && exports[key] === _guards[key]) return;
    +  exports[key] = _guards[key];
    +});
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/namespace.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/namespace.js
    new file mode 100644
    index 00000000..cc97647b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/namespace.js
    @@ -0,0 +1,80 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _cssesc = _interopRequireDefault(require("cssesc"));
    +var _util = require("../util");
    +var _node = _interopRequireDefault(require("./node"));
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +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, 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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var Namespace = /*#__PURE__*/function (_Node) {
    +  _inheritsLoose(Namespace, _Node);
    +  function Namespace() {
    +    return _Node.apply(this, arguments) || this;
    +  }
    +  var _proto = Namespace.prototype;
    +  _proto.qualifiedName = function qualifiedName(value) {
    +    if (this.namespace) {
    +      return this.namespaceString + "|" + value;
    +    } else {
    +      return value;
    +    }
    +  };
    +  _proto.valueToString = function valueToString() {
    +    return this.qualifiedName(_Node.prototype.valueToString.call(this));
    +  };
    +  _createClass(Namespace, [{
    +    key: "namespace",
    +    get: function get() {
    +      return this._namespace;
    +    },
    +    set: function set(namespace) {
    +      if (namespace === true || namespace === "*" || namespace === "&") {
    +        this._namespace = namespace;
    +        if (this.raws) {
    +          delete this.raws.namespace;
    +        }
    +        return;
    +      }
    +      var escaped = (0, _cssesc["default"])(namespace, {
    +        isIdentifier: true
    +      });
    +      this._namespace = namespace;
    +      if (escaped !== namespace) {
    +        (0, _util.ensureObject)(this, "raws");
    +        this.raws.namespace = escaped;
    +      } else if (this.raws) {
    +        delete this.raws.namespace;
    +      }
    +    }
    +  }, {
    +    key: "ns",
    +    get: function get() {
    +      return this._namespace;
    +    },
    +    set: function set(namespace) {
    +      this.namespace = namespace;
    +    }
    +  }, {
    +    key: "namespaceString",
    +    get: function get() {
    +      if (this.namespace) {
    +        var ns = this.stringifyProperty("namespace");
    +        if (ns === true) {
    +          return '';
    +        } else {
    +          return ns;
    +        }
    +      } else {
    +        return '';
    +      }
    +    }
    +  }]);
    +  return Namespace;
    +}(_node["default"]);
    +exports["default"] = Namespace;
    +;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/nesting.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/nesting.js
    new file mode 100644
    index 00000000..21899287
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/nesting.js
    @@ -0,0 +1,22 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _node = _interopRequireDefault(require("./node"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var Nesting = /*#__PURE__*/function (_Node) {
    +  _inheritsLoose(Nesting, _Node);
    +  function Nesting(opts) {
    +    var _this;
    +    _this = _Node.call(this, opts) || this;
    +    _this.type = _types.NESTING;
    +    _this.value = '&';
    +    return _this;
    +  }
    +  return Nesting;
    +}(_node["default"]);
    +exports["default"] = Nesting;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/node.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/node.js
    new file mode 100644
    index 00000000..9a829510
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/node.js
    @@ -0,0 +1,192 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _util = require("../util");
    +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, 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; }
    +var cloneNode = function cloneNode(obj, parent) {
    +  if (typeof obj !== 'object' || obj === null) {
    +    return obj;
    +  }
    +  var cloned = new obj.constructor();
    +  for (var i in obj) {
    +    if (!obj.hasOwnProperty(i)) {
    +      continue;
    +    }
    +    var value = obj[i];
    +    var type = typeof value;
    +    if (i === 'parent' && type === 'object') {
    +      if (parent) {
    +        cloned[i] = parent;
    +      }
    +    } else if (value instanceof Array) {
    +      cloned[i] = value.map(function (j) {
    +        return cloneNode(j, cloned);
    +      });
    +    } else {
    +      cloned[i] = cloneNode(value, cloned);
    +    }
    +  }
    +  return cloned;
    +};
    +var Node = /*#__PURE__*/function () {
    +  function Node(opts) {
    +    if (opts === void 0) {
    +      opts = {};
    +    }
    +    Object.assign(this, opts);
    +    this.spaces = this.spaces || {};
    +    this.spaces.before = this.spaces.before || '';
    +    this.spaces.after = this.spaces.after || '';
    +  }
    +  var _proto = Node.prototype;
    +  _proto.remove = function remove() {
    +    if (this.parent) {
    +      this.parent.removeChild(this);
    +    }
    +    this.parent = undefined;
    +    return this;
    +  };
    +  _proto.replaceWith = function replaceWith() {
    +    if (this.parent) {
    +      for (var index in arguments) {
    +        this.parent.insertBefore(this, arguments[index]);
    +      }
    +      this.remove();
    +    }
    +    return this;
    +  };
    +  _proto.next = function next() {
    +    return this.parent.at(this.parent.index(this) + 1);
    +  };
    +  _proto.prev = function prev() {
    +    return this.parent.at(this.parent.index(this) - 1);
    +  };
    +  _proto.clone = function clone(overrides) {
    +    if (overrides === void 0) {
    +      overrides = {};
    +    }
    +    var cloned = cloneNode(this);
    +    for (var name in overrides) {
    +      cloned[name] = overrides[name];
    +    }
    +    return cloned;
    +  }
    +
    +  /**
    +   * Some non-standard syntax doesn't follow normal escaping rules for css.
    +   * This allows non standard syntax to be appended to an existing property
    +   * by specifying the escaped value. By specifying the escaped value,
    +   * illegal characters are allowed to be directly inserted into css output.
    +   * @param {string} name the property to set
    +   * @param {any} value the unescaped value of the property
    +   * @param {string} valueEscaped optional. the escaped value of the property.
    +   */;
    +  _proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
    +    if (!this.raws) {
    +      this.raws = {};
    +    }
    +    var originalValue = this[name];
    +    var originalEscaped = this.raws[name];
    +    this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
    +    if (originalEscaped || valueEscaped !== value) {
    +      this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
    +    } else {
    +      delete this.raws[name]; // delete any escaped value that was created by the setter.
    +    }
    +  }
    +
    +  /**
    +   * Some non-standard syntax doesn't follow normal escaping rules for css.
    +   * This allows the escaped value to be specified directly, allowing illegal
    +   * characters to be directly inserted into css output.
    +   * @param {string} name the property to set
    +   * @param {any} value the unescaped value of the property
    +   * @param {string} valueEscaped the escaped value of the property.
    +   */;
    +  _proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
    +    if (!this.raws) {
    +      this.raws = {};
    +    }
    +    this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
    +    this.raws[name] = valueEscaped;
    +  }
    +
    +  /**
    +   * When you want a value to passed through to CSS directly. This method
    +   * deletes the corresponding raw value causing the stringifier to fallback
    +   * to the unescaped value.
    +   * @param {string} name the property to set.
    +   * @param {any} value The value that is both escaped and unescaped.
    +   */;
    +  _proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
    +    this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
    +    if (this.raws) {
    +      delete this.raws[name];
    +    }
    +  }
    +
    +  /**
    +   *
    +   * @param {number} line The number (starting with 1)
    +   * @param {number} column The column number (starting with 1)
    +   */;
    +  _proto.isAtPosition = function isAtPosition(line, column) {
    +    if (this.source && this.source.start && this.source.end) {
    +      if (this.source.start.line > line) {
    +        return false;
    +      }
    +      if (this.source.end.line < line) {
    +        return false;
    +      }
    +      if (this.source.start.line === line && this.source.start.column > column) {
    +        return false;
    +      }
    +      if (this.source.end.line === line && this.source.end.column < column) {
    +        return false;
    +      }
    +      return true;
    +    }
    +    return undefined;
    +  };
    +  _proto.stringifyProperty = function stringifyProperty(name) {
    +    return this.raws && this.raws[name] || this[name];
    +  };
    +  _proto.valueToString = function valueToString() {
    +    return String(this.stringifyProperty("value"));
    +  };
    +  _proto.toString = function toString() {
    +    return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
    +  };
    +  _createClass(Node, [{
    +    key: "rawSpaceBefore",
    +    get: function get() {
    +      var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
    +      if (rawSpace === undefined) {
    +        rawSpace = this.spaces && this.spaces.before;
    +      }
    +      return rawSpace || "";
    +    },
    +    set: function set(raw) {
    +      (0, _util.ensureObject)(this, "raws", "spaces");
    +      this.raws.spaces.before = raw;
    +    }
    +  }, {
    +    key: "rawSpaceAfter",
    +    get: function get() {
    +      var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
    +      if (rawSpace === undefined) {
    +        rawSpace = this.spaces.after;
    +      }
    +      return rawSpace || "";
    +    },
    +    set: function set(raw) {
    +      (0, _util.ensureObject)(this, "raws", "spaces");
    +      this.raws.spaces.after = raw;
    +    }
    +  }]);
    +  return Node;
    +}();
    +exports["default"] = Node;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/pseudo.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/pseudo.js
    new file mode 100644
    index 00000000..4371e590
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/pseudo.js
    @@ -0,0 +1,26 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _container = _interopRequireDefault(require("./container"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var Pseudo = /*#__PURE__*/function (_Container) {
    +  _inheritsLoose(Pseudo, _Container);
    +  function Pseudo(opts) {
    +    var _this;
    +    _this = _Container.call(this, opts) || this;
    +    _this.type = _types.PSEUDO;
    +    return _this;
    +  }
    +  var _proto = Pseudo.prototype;
    +  _proto.toString = function toString() {
    +    var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
    +    return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
    +  };
    +  return Pseudo;
    +}(_container["default"]);
    +exports["default"] = Pseudo;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/root.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/root.js
    new file mode 100644
    index 00000000..8c599d15
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/root.js
    @@ -0,0 +1,44 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _container = _interopRequireDefault(require("./container"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +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, 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 _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var Root = /*#__PURE__*/function (_Container) {
    +  _inheritsLoose(Root, _Container);
    +  function Root(opts) {
    +    var _this;
    +    _this = _Container.call(this, opts) || this;
    +    _this.type = _types.ROOT;
    +    return _this;
    +  }
    +  var _proto = Root.prototype;
    +  _proto.toString = function toString() {
    +    var str = this.reduce(function (memo, selector) {
    +      memo.push(String(selector));
    +      return memo;
    +    }, []).join(',');
    +    return this.trailingComma ? str + ',' : str;
    +  };
    +  _proto.error = function error(message, options) {
    +    if (this._error) {
    +      return this._error(message, options);
    +    } else {
    +      return new Error(message);
    +    }
    +  };
    +  _createClass(Root, [{
    +    key: "errorGenerator",
    +    set: function set(handler) {
    +      this._error = handler;
    +    }
    +  }]);
    +  return Root;
    +}(_container["default"]);
    +exports["default"] = Root;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/selector.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/selector.js
    new file mode 100644
    index 00000000..8cc4bc1c
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/selector.js
    @@ -0,0 +1,21 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _container = _interopRequireDefault(require("./container"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var Selector = /*#__PURE__*/function (_Container) {
    +  _inheritsLoose(Selector, _Container);
    +  function Selector(opts) {
    +    var _this;
    +    _this = _Container.call(this, opts) || this;
    +    _this.type = _types.SELECTOR;
    +    return _this;
    +  }
    +  return Selector;
    +}(_container["default"]);
    +exports["default"] = Selector;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/string.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/string.js
    new file mode 100644
    index 00000000..47497914
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/string.js
    @@ -0,0 +1,21 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _node = _interopRequireDefault(require("./node"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var String = /*#__PURE__*/function (_Node) {
    +  _inheritsLoose(String, _Node);
    +  function String(opts) {
    +    var _this;
    +    _this = _Node.call(this, opts) || this;
    +    _this.type = _types.STRING;
    +    return _this;
    +  }
    +  return String;
    +}(_node["default"]);
    +exports["default"] = String;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/tag.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/tag.js
    new file mode 100644
    index 00000000..224e74de
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/tag.js
    @@ -0,0 +1,21 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _namespace = _interopRequireDefault(require("./namespace"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var Tag = /*#__PURE__*/function (_Namespace) {
    +  _inheritsLoose(Tag, _Namespace);
    +  function Tag(opts) {
    +    var _this;
    +    _this = _Namespace.call(this, opts) || this;
    +    _this.type = _types.TAG;
    +    return _this;
    +  }
    +  return Tag;
    +}(_namespace["default"]);
    +exports["default"] = Tag;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/types.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/types.js
    new file mode 100644
    index 00000000..824cc0c7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/types.js
    @@ -0,0 +1,28 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports.UNIVERSAL = exports.TAG = exports.STRING = exports.SELECTOR = exports.ROOT = exports.PSEUDO = exports.NESTING = exports.ID = exports.COMMENT = exports.COMBINATOR = exports.CLASS = exports.ATTRIBUTE = void 0;
    +var TAG = 'tag';
    +exports.TAG = TAG;
    +var STRING = 'string';
    +exports.STRING = STRING;
    +var SELECTOR = 'selector';
    +exports.SELECTOR = SELECTOR;
    +var ROOT = 'root';
    +exports.ROOT = ROOT;
    +var PSEUDO = 'pseudo';
    +exports.PSEUDO = PSEUDO;
    +var NESTING = 'nesting';
    +exports.NESTING = NESTING;
    +var ID = 'id';
    +exports.ID = ID;
    +var COMMENT = 'comment';
    +exports.COMMENT = COMMENT;
    +var COMBINATOR = 'combinator';
    +exports.COMBINATOR = COMBINATOR;
    +var CLASS = 'class';
    +exports.CLASS = CLASS;
    +var ATTRIBUTE = 'attribute';
    +exports.ATTRIBUTE = ATTRIBUTE;
    +var UNIVERSAL = 'universal';
    +exports.UNIVERSAL = UNIVERSAL;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/universal.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/universal.js
    new file mode 100644
    index 00000000..5b587438
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/selectors/universal.js
    @@ -0,0 +1,22 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = void 0;
    +var _namespace = _interopRequireDefault(require("./namespace"));
    +var _types = require("./types");
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
    +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
    +var Universal = /*#__PURE__*/function (_Namespace) {
    +  _inheritsLoose(Universal, _Namespace);
    +  function Universal(opts) {
    +    var _this;
    +    _this = _Namespace.call(this, opts) || this;
    +    _this.type = _types.UNIVERSAL;
    +    _this.value = '*';
    +    return _this;
    +  }
    +  return Universal;
    +}(_namespace["default"]);
    +exports["default"] = Universal;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/sortAscending.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/sortAscending.js
    new file mode 100644
    index 00000000..5666d5dc
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/sortAscending.js
    @@ -0,0 +1,11 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = sortAscending;
    +function sortAscending(list) {
    +  return list.sort(function (a, b) {
    +    return a - b;
    +  });
    +}
    +;
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/tokenTypes.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/tokenTypes.js
    new file mode 100644
    index 00000000..59d8e6c6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/tokenTypes.js
    @@ -0,0 +1,70 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports.word = exports.tilde = exports.tab = exports.str = exports.space = exports.slash = exports.singleQuote = exports.semicolon = exports.plus = exports.pipe = exports.openSquare = exports.openParenthesis = exports.newline = exports.greaterThan = exports.feed = exports.equals = exports.doubleQuote = exports.dollar = exports.cr = exports.comment = exports.comma = exports.combinator = exports.colon = exports.closeSquare = exports.closeParenthesis = exports.caret = exports.bang = exports.backslash = exports.at = exports.asterisk = exports.ampersand = void 0;
    +var ampersand = 38; // `&`.charCodeAt(0);
    +exports.ampersand = ampersand;
    +var asterisk = 42; // `*`.charCodeAt(0);
    +exports.asterisk = asterisk;
    +var at = 64; // `@`.charCodeAt(0);
    +exports.at = at;
    +var comma = 44; // `,`.charCodeAt(0);
    +exports.comma = comma;
    +var colon = 58; // `:`.charCodeAt(0);
    +exports.colon = colon;
    +var semicolon = 59; // `;`.charCodeAt(0);
    +exports.semicolon = semicolon;
    +var openParenthesis = 40; // `(`.charCodeAt(0);
    +exports.openParenthesis = openParenthesis;
    +var closeParenthesis = 41; // `)`.charCodeAt(0);
    +exports.closeParenthesis = closeParenthesis;
    +var openSquare = 91; // `[`.charCodeAt(0);
    +exports.openSquare = openSquare;
    +var closeSquare = 93; // `]`.charCodeAt(0);
    +exports.closeSquare = closeSquare;
    +var dollar = 36; // `$`.charCodeAt(0);
    +exports.dollar = dollar;
    +var tilde = 126; // `~`.charCodeAt(0);
    +exports.tilde = tilde;
    +var caret = 94; // `^`.charCodeAt(0);
    +exports.caret = caret;
    +var plus = 43; // `+`.charCodeAt(0);
    +exports.plus = plus;
    +var equals = 61; // `=`.charCodeAt(0);
    +exports.equals = equals;
    +var pipe = 124; // `|`.charCodeAt(0);
    +exports.pipe = pipe;
    +var greaterThan = 62; // `>`.charCodeAt(0);
    +exports.greaterThan = greaterThan;
    +var space = 32; // ` `.charCodeAt(0);
    +exports.space = space;
    +var singleQuote = 39; // `'`.charCodeAt(0);
    +exports.singleQuote = singleQuote;
    +var doubleQuote = 34; // `"`.charCodeAt(0);
    +exports.doubleQuote = doubleQuote;
    +var slash = 47; // `/`.charCodeAt(0);
    +exports.slash = slash;
    +var bang = 33; // `!`.charCodeAt(0);
    +exports.bang = bang;
    +var backslash = 92; // '\\'.charCodeAt(0);
    +exports.backslash = backslash;
    +var cr = 13; // '\r'.charCodeAt(0);
    +exports.cr = cr;
    +var feed = 12; // '\f'.charCodeAt(0);
    +exports.feed = feed;
    +var newline = 10; // '\n'.charCodeAt(0);
    +exports.newline = newline;
    +var tab = 9; // '\t'.charCodeAt(0);
    +
    +// Expose aliases primarily for readability.
    +exports.tab = tab;
    +var str = singleQuote;
    +
    +// No good single character representation!
    +exports.str = str;
    +var comment = -1;
    +exports.comment = comment;
    +var word = -2;
    +exports.word = word;
    +var combinator = -3;
    +exports.combinator = combinator;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/tokenize.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/tokenize.js
    new file mode 100644
    index 00000000..bf61d261
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/tokenize.js
    @@ -0,0 +1,239 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports.FIELDS = void 0;
    +exports["default"] = tokenize;
    +var t = _interopRequireWildcard(require("./tokenTypes"));
    +var _unescapable, _wordDelimiters;
    +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
    +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
    +var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
    +var wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters);
    +var hex = {};
    +var hexChars = "0123456789abcdefABCDEF";
    +for (var i = 0; i < hexChars.length; i++) {
    +  hex[hexChars.charCodeAt(i)] = true;
    +}
    +
    +/**
    + *  Returns the last index of the bar css word
    + * @param {string} css The string in which the word begins
    + * @param {number} start The index into the string where word's first letter occurs
    + */
    +function consumeWord(css, start) {
    +  var next = start;
    +  var code;
    +  do {
    +    code = css.charCodeAt(next);
    +    if (wordDelimiters[code]) {
    +      return next - 1;
    +    } else if (code === t.backslash) {
    +      next = consumeEscape(css, next) + 1;
    +    } else {
    +      // All other characters are part of the word
    +      next++;
    +    }
    +  } while (next < css.length);
    +  return next - 1;
    +}
    +
    +/**
    + *  Returns the last index of the escape sequence
    + * @param {string} css The string in which the sequence begins
    + * @param {number} start The index into the string where escape character (`\`) occurs.
    + */
    +function consumeEscape(css, start) {
    +  var next = start;
    +  var code = css.charCodeAt(next + 1);
    +  if (unescapable[code]) {
    +    // just consume the escape char
    +  } else if (hex[code]) {
    +    var hexDigits = 0;
    +    // consume up to 6 hex chars
    +    do {
    +      next++;
    +      hexDigits++;
    +      code = css.charCodeAt(next + 1);
    +    } while (hex[code] && hexDigits < 6);
    +    // if fewer than 6 hex chars, a trailing space ends the escape
    +    if (hexDigits < 6 && code === t.space) {
    +      next++;
    +    }
    +  } else {
    +    // the next char is part of the current word
    +    next++;
    +  }
    +  return next;
    +}
    +var FIELDS = {
    +  TYPE: 0,
    +  START_LINE: 1,
    +  START_COL: 2,
    +  END_LINE: 3,
    +  END_COL: 4,
    +  START_POS: 5,
    +  END_POS: 6
    +};
    +exports.FIELDS = FIELDS;
    +function tokenize(input) {
    +  var tokens = [];
    +  var css = input.css.valueOf();
    +  var _css = css,
    +    length = _css.length;
    +  var offset = -1;
    +  var line = 1;
    +  var start = 0;
    +  var end = 0;
    +  var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
    +  function unclosed(what, fix) {
    +    if (input.safe) {
    +      // fyi: this is never set to true.
    +      css += fix;
    +      next = css.length - 1;
    +    } else {
    +      throw input.error('Unclosed ' + what, line, start - offset, start);
    +    }
    +  }
    +  while (start < length) {
    +    code = css.charCodeAt(start);
    +    if (code === t.newline) {
    +      offset = start;
    +      line += 1;
    +    }
    +    switch (code) {
    +      case t.space:
    +      case t.tab:
    +      case t.newline:
    +      case t.cr:
    +      case t.feed:
    +        next = start;
    +        do {
    +          next += 1;
    +          code = css.charCodeAt(next);
    +          if (code === t.newline) {
    +            offset = next;
    +            line += 1;
    +          }
    +        } while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
    +        tokenType = t.space;
    +        endLine = line;
    +        endColumn = next - offset - 1;
    +        end = next;
    +        break;
    +      case t.plus:
    +      case t.greaterThan:
    +      case t.tilde:
    +      case t.pipe:
    +        next = start;
    +        do {
    +          next += 1;
    +          code = css.charCodeAt(next);
    +        } while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
    +        tokenType = t.combinator;
    +        endLine = line;
    +        endColumn = start - offset;
    +        end = next;
    +        break;
    +
    +      // Consume these characters as single tokens.
    +      case t.asterisk:
    +      case t.ampersand:
    +      case t.bang:
    +      case t.comma:
    +      case t.equals:
    +      case t.dollar:
    +      case t.caret:
    +      case t.openSquare:
    +      case t.closeSquare:
    +      case t.colon:
    +      case t.semicolon:
    +      case t.openParenthesis:
    +      case t.closeParenthesis:
    +        next = start;
    +        tokenType = code;
    +        endLine = line;
    +        endColumn = start - offset;
    +        end = next + 1;
    +        break;
    +      case t.singleQuote:
    +      case t.doubleQuote:
    +        quote = code === t.singleQuote ? "'" : '"';
    +        next = start;
    +        do {
    +          escaped = false;
    +          next = css.indexOf(quote, next + 1);
    +          if (next === -1) {
    +            unclosed('quote', quote);
    +          }
    +          escapePos = next;
    +          while (css.charCodeAt(escapePos - 1) === t.backslash) {
    +            escapePos -= 1;
    +            escaped = !escaped;
    +          }
    +        } while (escaped);
    +        tokenType = t.str;
    +        endLine = line;
    +        endColumn = start - offset;
    +        end = next + 1;
    +        break;
    +      default:
    +        if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
    +          next = css.indexOf('*/', start + 2) + 1;
    +          if (next === 0) {
    +            unclosed('comment', '*/');
    +          }
    +          content = css.slice(start, next + 1);
    +          lines = content.split('\n');
    +          last = lines.length - 1;
    +          if (last > 0) {
    +            nextLine = line + last;
    +            nextOffset = next - lines[last].length;
    +          } else {
    +            nextLine = line;
    +            nextOffset = offset;
    +          }
    +          tokenType = t.comment;
    +          line = nextLine;
    +          endLine = nextLine;
    +          endColumn = next - nextOffset;
    +        } else if (code === t.slash) {
    +          next = start;
    +          tokenType = code;
    +          endLine = line;
    +          endColumn = start - offset;
    +          end = next + 1;
    +        } else {
    +          next = consumeWord(css, start);
    +          tokenType = t.word;
    +          endLine = line;
    +          endColumn = next - offset;
    +        }
    +        end = next + 1;
    +        break;
    +    }
    +
    +    // Ensure that the token structure remains consistent
    +    tokens.push([tokenType,
    +    // [0] Token type
    +    line,
    +    // [1] Starting line
    +    start - offset,
    +    // [2] Starting column
    +    endLine,
    +    // [3] Ending line
    +    endColumn,
    +    // [4] Ending column
    +    start,
    +    // [5] Start position / Source index
    +    end // [6] End position
    +    ]);
    +
    +    // Reset offset for the next token
    +    if (nextOffset) {
    +      offset = nextOffset;
    +      nextOffset = null;
    +    }
    +    start = end;
    +  }
    +  return tokens;
    +}
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/util/ensureObject.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/util/ensureObject.js
    new file mode 100644
    index 00000000..494941ad
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/util/ensureObject.js
    @@ -0,0 +1,17 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = ensureObject;
    +function ensureObject(obj) {
    +  for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    +    props[_key - 1] = arguments[_key];
    +  }
    +  while (props.length > 0) {
    +    var prop = props.shift();
    +    if (!obj[prop]) {
    +      obj[prop] = {};
    +    }
    +    obj = obj[prop];
    +  }
    +}
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/util/getProp.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/util/getProp.js
    new file mode 100644
    index 00000000..a2b7a073
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/util/getProp.js
    @@ -0,0 +1,18 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = getProp;
    +function getProp(obj) {
    +  for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    +    props[_key - 1] = arguments[_key];
    +  }
    +  while (props.length > 0) {
    +    var prop = props.shift();
    +    if (!obj[prop]) {
    +      return undefined;
    +    }
    +    obj = obj[prop];
    +  }
    +  return obj;
    +}
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/util/index.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/util/index.js
    new file mode 100644
    index 00000000..f96ec11b
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/util/index.js
    @@ -0,0 +1,13 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports.unesc = exports.stripComments = exports.getProp = exports.ensureObject = void 0;
    +var _unesc = _interopRequireDefault(require("./unesc"));
    +exports.unesc = _unesc["default"];
    +var _getProp = _interopRequireDefault(require("./getProp"));
    +exports.getProp = _getProp["default"];
    +var _ensureObject = _interopRequireDefault(require("./ensureObject"));
    +exports.ensureObject = _ensureObject["default"];
    +var _stripComments = _interopRequireDefault(require("./stripComments"));
    +exports.stripComments = _stripComments["default"];
    +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/util/stripComments.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/util/stripComments.js
    new file mode 100644
    index 00000000..0baa0e07
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/util/stripComments.js
    @@ -0,0 +1,21 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = stripComments;
    +function stripComments(str) {
    +  var s = "";
    +  var commentStart = str.indexOf("/*");
    +  var lastEnd = 0;
    +  while (commentStart >= 0) {
    +    s = s + str.slice(lastEnd, commentStart);
    +    var commentEnd = str.indexOf("*/", commentStart + 2);
    +    if (commentEnd < 0) {
    +      return s;
    +    }
    +    lastEnd = commentEnd + 2;
    +    commentStart = str.indexOf("/*", lastEnd);
    +  }
    +  s = s + str.slice(lastEnd);
    +  return s;
    +}
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/dist/util/unesc.js b/node_modules/npm/node_modules/postcss-selector-parser/dist/util/unesc.js
    new file mode 100644
    index 00000000..87396bee
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/dist/util/unesc.js
    @@ -0,0 +1,76 @@
    +"use strict";
    +
    +exports.__esModule = true;
    +exports["default"] = unesc;
    +// Many thanks for this post which made this migration much easier.
    +// https://mathiasbynens.be/notes/css-escapes
    +
    +/**
    + * 
    + * @param {string} str 
    + * @returns {[string, number]|undefined}
    + */
    +function gobbleHex(str) {
    +  var lower = str.toLowerCase();
    +  var hex = '';
    +  var spaceTerminated = false;
    +  for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
    +    var code = lower.charCodeAt(i);
    +    // check to see if we are dealing with a valid hex char [a-f|0-9]
    +    var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57;
    +    // https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
    +    spaceTerminated = code === 32;
    +    if (!valid) {
    +      break;
    +    }
    +    hex += lower[i];
    +  }
    +  if (hex.length === 0) {
    +    return undefined;
    +  }
    +  var codePoint = parseInt(hex, 16);
    +  var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF;
    +  // Add special case for
    +  // "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
    +  // https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
    +  if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
    +    return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
    +  }
    +  return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
    +}
    +var CONTAINS_ESCAPE = /\\/;
    +function unesc(str) {
    +  var needToProcess = CONTAINS_ESCAPE.test(str);
    +  if (!needToProcess) {
    +    return str;
    +  }
    +  var ret = "";
    +  for (var i = 0; i < str.length; i++) {
    +    if (str[i] === "\\") {
    +      var gobbled = gobbleHex(str.slice(i + 1, i + 7));
    +      if (gobbled !== undefined) {
    +        ret += gobbled[0];
    +        i += gobbled[1];
    +        continue;
    +      }
    +
    +      // Retain a pair of \\ if double escaped `\\\\`
    +      // https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
    +      if (str[i + 1] === "\\") {
    +        ret += "\\";
    +        i++;
    +        continue;
    +      }
    +
    +      // if \\ is at the end of the string retain it
    +      // https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
    +      if (str.length === i + 1) {
    +        ret += str[i];
    +      }
    +      continue;
    +    }
    +    ret += str[i];
    +  }
    +  return ret;
    +}
    +module.exports = exports.default;
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/postcss-selector-parser/package.json b/node_modules/npm/node_modules/postcss-selector-parser/package.json
    new file mode 100644
    index 00000000..0b074d0f
    --- /dev/null
    +++ b/node_modules/npm/node_modules/postcss-selector-parser/package.json
    @@ -0,0 +1,80 @@
    +{
    +  "name": "postcss-selector-parser",
    +  "version": "6.1.2",
    +  "devDependencies": {
    +    "@babel/cli": "^7.11.6",
    +    "@babel/core": "^7.11.6",
    +    "@babel/eslint-parser": "^7.11.5",
    +    "@babel/eslint-plugin": "^7.11.5",
    +    "@babel/plugin-proposal-class-properties": "^7.10.4",
    +    "@babel/preset-env": "^7.11.5",
    +    "@babel/register": "^7.11.5",
    +    "ava": "^5.1.0",
    +    "babel-plugin-add-module-exports": "^1.0.4",
    +    "coveralls": "^3.1.0",
    +    "del-cli": "^5.0.0",
    +    "eslint": "^8.28.0",
    +    "eslint-plugin-import": "^2.26.0",
    +    "glob": "^8.0.3",
    +    "minimist": "^1.2.5",
    +    "nyc": "^15.1.0",
    +    "postcss": "^8.4.31",
    +    "semver": "^7.3.2",
    +    "typescript": "^4.0.3"
    +  },
    +  "main": "dist/index.js",
    +  "types": "postcss-selector-parser.d.ts",
    +  "files": [
    +    "API.md",
    +    "CHANGELOG.md",
    +    "LICENSE-MIT",
    +    "dist",
    +    "postcss-selector-parser.d.ts",
    +    "!**/__tests__"
    +  ],
    +  "scripts": {
    +    "typecheck": "tsc --noEmit --strict postcss-selector-parser.d.ts postcss-selector-parser.test.ts",
    +    "pretest": "eslint src && npm run typecheck",
    +    "prepare": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
    +    "lintfix": "eslint --fix src",
    +    "report": "nyc report --reporter=html",
    +    "test": "nyc ava src/__tests__/*.mjs",
    +    "testone": "ava"
    +  },
    +  "dependencies": {
    +    "cssesc": "^3.0.0",
    +    "util-deprecate": "^1.0.2"
    +  },
    +  "license": "MIT",
    +  "engines": {
    +    "node": ">=4"
    +  },
    +  "homepage": "https://github.com/postcss/postcss-selector-parser",
    +  "contributors": [
    +    {
    +      "name": "Ben Briggs",
    +      "email": "beneb.info@gmail.com",
    +      "url": "http://beneb.info"
    +    },
    +    {
    +      "name": "Chris Eppstein",
    +      "email": "chris@eppsteins.net",
    +      "url": "http://twitter.com/chriseppstein"
    +    }
    +  ],
    +  "repository": "postcss/postcss-selector-parser",
    +  "ava": {
    +    "require": [
    +      "@babel/register"
    +    ],
    +    "concurrency": 5,
    +    "timeout": "25s",
    +    "nodeArguments": []
    +  },
    +  "nyc": {
    +    "exclude": [
    +      "node_modules",
    +      "**/__tests__"
    +    ]
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/proc-log/LICENSE b/node_modules/npm/node_modules/proc-log/LICENSE
    new file mode 100644
    index 00000000..83837797
    --- /dev/null
    +++ b/node_modules/npm/node_modules/proc-log/LICENSE
    @@ -0,0 +1,15 @@
    +The ISC License
    +
    +Copyright (c) GitHub, 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/npm/node_modules/proc-log/lib/index.js b/node_modules/npm/node_modules/proc-log/lib/index.js
    new file mode 100644
    index 00000000..86d90861
    --- /dev/null
    +++ b/node_modules/npm/node_modules/proc-log/lib/index.js
    @@ -0,0 +1,153 @@
    +const META = Symbol('proc-log.meta')
    +module.exports = {
    +  META: META,
    +  output: {
    +    LEVELS: [
    +      'standard',
    +      'error',
    +      'buffer',
    +      'flush',
    +    ],
    +    KEYS: {
    +      standard: 'standard',
    +      error: 'error',
    +      buffer: 'buffer',
    +      flush: 'flush',
    +    },
    +    standard: function (...args) {
    +      return process.emit('output', 'standard', ...args)
    +    },
    +    error: function (...args) {
    +      return process.emit('output', 'error', ...args)
    +    },
    +    buffer: function (...args) {
    +      return process.emit('output', 'buffer', ...args)
    +    },
    +    flush: function (...args) {
    +      return process.emit('output', 'flush', ...args)
    +    },
    +  },
    +  log: {
    +    LEVELS: [
    +      'notice',
    +      'error',
    +      'warn',
    +      'info',
    +      'verbose',
    +      'http',
    +      'silly',
    +      'timing',
    +      'pause',
    +      'resume',
    +    ],
    +    KEYS: {
    +      notice: 'notice',
    +      error: 'error',
    +      warn: 'warn',
    +      info: 'info',
    +      verbose: 'verbose',
    +      http: 'http',
    +      silly: 'silly',
    +      timing: 'timing',
    +      pause: 'pause',
    +      resume: 'resume',
    +    },
    +    error: function (...args) {
    +      return process.emit('log', 'error', ...args)
    +    },
    +    notice: function (...args) {
    +      return process.emit('log', 'notice', ...args)
    +    },
    +    warn: function (...args) {
    +      return process.emit('log', 'warn', ...args)
    +    },
    +    info: function (...args) {
    +      return process.emit('log', 'info', ...args)
    +    },
    +    verbose: function (...args) {
    +      return process.emit('log', 'verbose', ...args)
    +    },
    +    http: function (...args) {
    +      return process.emit('log', 'http', ...args)
    +    },
    +    silly: function (...args) {
    +      return process.emit('log', 'silly', ...args)
    +    },
    +    timing: function (...args) {
    +      return process.emit('log', 'timing', ...args)
    +    },
    +    pause: function () {
    +      return process.emit('log', 'pause')
    +    },
    +    resume: function () {
    +      return process.emit('log', 'resume')
    +    },
    +  },
    +  time: {
    +    LEVELS: [
    +      'start',
    +      'end',
    +    ],
    +    KEYS: {
    +      start: 'start',
    +      end: 'end',
    +    },
    +    start: function (name, fn) {
    +      process.emit('time', 'start', name)
    +      function end () {
    +        return process.emit('time', 'end', name)
    +      }
    +      if (typeof fn === 'function') {
    +        const res = fn()
    +        if (res && res.finally) {
    +          return res.finally(end)
    +        }
    +        end()
    +        return res
    +      }
    +      return end
    +    },
    +    end: function (name) {
    +      return process.emit('time', 'end', name)
    +    },
    +  },
    +  input: {
    +    LEVELS: [
    +      'start',
    +      'end',
    +      'read',
    +    ],
    +    KEYS: {
    +      start: 'start',
    +      end: 'end',
    +      read: 'read',
    +    },
    +    start: function (fn) {
    +      process.emit('input', 'start')
    +      function end () {
    +        return process.emit('input', 'end')
    +      }
    +      if (typeof fn === 'function') {
    +        const res = fn()
    +        if (res && res.finally) {
    +          return res.finally(end)
    +        }
    +        end()
    +        return res
    +      }
    +      return end
    +    },
    +    end: function () {
    +      return process.emit('input', 'end')
    +    },
    +    read: function (...args) {
    +      let resolve, reject
    +      const promise = new Promise((_resolve, _reject) => {
    +        resolve = _resolve
    +        reject = _reject
    +      })
    +      process.emit('input', 'read', resolve, reject, ...args)
    +      return promise
    +    },
    +  },
    +}
    diff --git a/node_modules/npm/node_modules/proc-log/package.json b/node_modules/npm/node_modules/proc-log/package.json
    new file mode 100644
    index 00000000..957209d3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/proc-log/package.json
    @@ -0,0 +1,46 @@
    +{
    +  "name": "proc-log",
    +  "version": "5.0.0",
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "main": "lib/index.js",
    +  "description": "just emit 'log' events on the process object",
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/proc-log.git"
    +  },
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "scripts": {
    +    "test": "tap",
    +    "snap": "tap",
    +    "posttest": "npm run lint",
    +    "postsnap": "eslint index.js test/*.js --fix",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "lintfix": "npm run eslint -- --fix",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "tap": "^16.0.1"
    +  },
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": true
    +  },
    +  "tap": {
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/proggy/LICENSE b/node_modules/npm/node_modules/proggy/LICENSE
    new file mode 100644
    index 00000000..83837797
    --- /dev/null
    +++ b/node_modules/npm/node_modules/proggy/LICENSE
    @@ -0,0 +1,15 @@
    +The ISC License
    +
    +Copyright (c) GitHub, 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/npm/node_modules/proggy/lib/client.js b/node_modules/npm/node_modules/proggy/lib/client.js
    new file mode 100644
    index 00000000..2eafb9c7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/proggy/lib/client.js
    @@ -0,0 +1,114 @@
    +const EE = require('events')
    +const onProgress = Symbol('onProgress')
    +const bars = Symbol('bars')
    +const listener = Symbol('listener')
    +const normData = Symbol('normData')
    +class Client extends EE {
    +  constructor ({ normalize = false, stopOnDone = false } = {}) {
    +    super()
    +    this.normalize = !!normalize
    +    this.stopOnDone = !!stopOnDone
    +    this[bars] = new Map()
    +    this[listener] = null
    +  }
    +
    +  get size () {
    +    return this[bars].size
    +  }
    +
    +  get listening () {
    +    return !!this[listener]
    +  }
    +
    +  addListener (...args) {
    +    return this.on(...args)
    +  }
    +
    +  on (ev, ...args) {
    +    if (ev === 'progress' && !this[listener]) {
    +      this.start()
    +    }
    +    return super.on(ev, ...args)
    +  }
    +
    +  off (ev, ...args) {
    +    return this.removeListener(ev, ...args)
    +  }
    +
    +  removeListener (ev, ...args) {
    +    const ret = super.removeListener(ev, ...args)
    +    if (ev === 'progress' && this.listeners(ev).length === 0) {
    +      this.stop()
    +    }
    +    return ret
    +  }
    +
    +  stop () {
    +    if (this[listener]) {
    +      process.removeListener('progress', this[listener])
    +      this[listener] = null
    +    }
    +  }
    +
    +  start () {
    +    if (!this[listener]) {
    +      this[listener] = (...args) => this[onProgress](...args)
    +      process.on('progress', this[listener])
    +    }
    +  }
    +
    +  [onProgress] (key, data) {
    +    data = this[normData](key, data)
    +    if (!this[bars].has(key)) {
    +      this.emit('bar', key, data)
    +    }
    +    this[bars].set(key, data)
    +    this.emit('progress', key, data)
    +    if (data.done) {
    +      this[bars].delete(key)
    +      this.emit('barDone', key, data)
    +      if (this.size === 0) {
    +        if (this.stopOnDone) {
    +          this.stop()
    +        }
    +        this.emit('done')
    +      }
    +    }
    +  }
    +
    +  [normData] (key, data) {
    +    const actualValue = data.value
    +    const actualTotal = data.total
    +    let value = actualValue
    +    let total = actualTotal
    +    const done = data.done || value >= total
    +    if (this.normalize) {
    +      const bar = this[bars].get(key)
    +      total = 100
    +      if (done) {
    +        value = 100
    +      } else {
    +        // show value as a portion of 100
    +        const pct = 100 * actualValue / actualTotal
    +        if (bar) {
    +          // don't ever go backwards, and don't stand still
    +          // move at least 1% of the remaining value if it wouldn't move.
    +          value = (pct > bar.value) ? pct
    +            : (100 - bar.value) / 100 + bar.value
    +        }
    +      }
    +    }
    +    // include the key
    +    return {
    +      ...data,
    +      key,
    +      name: data.name || key,
    +      value,
    +      total,
    +      actualValue,
    +      actualTotal,
    +      done,
    +    }
    +  }
    +}
    +module.exports = Client
    diff --git a/node_modules/npm/node_modules/proggy/lib/index.js b/node_modules/npm/node_modules/proggy/lib/index.js
    new file mode 100644
    index 00000000..834948b4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/proggy/lib/index.js
    @@ -0,0 +1,15 @@
    +exports.Client = require('./client.js')
    +exports.Tracker = require('./tracker.js')
    +
    +const trackers = new Map()
    +exports.createTracker = (name, key, total) => {
    +  const tracker = new exports.Tracker(name, key, total)
    +  if (trackers.has(tracker.key)) {
    +    const msg = `proggy: duplicate progress id ${JSON.stringify(tracker.key)}`
    +    throw new Error(msg)
    +  }
    +  trackers.set(tracker.key, tracker)
    +  tracker.on('done', () => trackers.delete(tracker.key))
    +  return tracker
    +}
    +exports.createClient = (options = {}) => new exports.Client(options)
    diff --git a/node_modules/npm/node_modules/proggy/lib/tracker.js b/node_modules/npm/node_modules/proggy/lib/tracker.js
    new file mode 100644
    index 00000000..56c78d94
    --- /dev/null
    +++ b/node_modules/npm/node_modules/proggy/lib/tracker.js
    @@ -0,0 +1,68 @@
    +// The tracker class is intentionally as naive as possible.  it is just
    +// an ergonomic wrapper around process.emit('progress', ...)
    +const EE = require('events')
    +class Tracker extends EE {
    +  constructor (name, key, total) {
    +    super()
    +    if (!name) {
    +      throw new Error('proggy: Tracker needs a name')
    +    }
    +
    +    if (typeof key === 'number' && !total) {
    +      total = key
    +      key = null
    +    }
    +
    +    if (!total) {
    +      total = 100
    +    }
    +
    +    if (!key) {
    +      key = name
    +    }
    +
    +    this.done = false
    +    this.name = name
    +    this.key = key
    +    this.value = 0
    +    this.total = total
    +  }
    +
    +  finish (metadata = {}) {
    +    this.update(this.total, this.total, metadata)
    +  }
    +
    +  update (value, total, metadata) {
    +    if (!metadata) {
    +      if (total && typeof total === 'object') {
    +        metadata = total
    +      } else {
    +        metadata = {}
    +      }
    +    }
    +    if (typeof total !== 'number') {
    +      total = this.total
    +    }
    +
    +    if (this.done) {
    +      const msg = `proggy: updating completed tracker: ${JSON.stringify(this.key)}`
    +      throw new Error(msg)
    +    }
    +    this.value = value
    +    this.total = total
    +    const done = this.value >= this.total
    +    process.emit('progress', this.key, {
    +      ...metadata,
    +      name: this.name,
    +      key: this.key,
    +      value,
    +      total,
    +      done,
    +    })
    +    if (done) {
    +      this.done = true
    +      this.emit('done')
    +    }
    +  }
    +}
    +module.exports = Tracker
    diff --git a/node_modules/npm/node_modules/proggy/package.json b/node_modules/npm/node_modules/proggy/package.json
    new file mode 100644
    index 00000000..01ac44b4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/proggy/package.json
    @@ -0,0 +1,50 @@
    +{
    +  "name": "proggy",
    +  "version": "3.0.0",
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "main": "lib/index.js",
    +  "description": "Progress bar updates at a distance",
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/npm/proggy.git"
    +  },
    +  "author": "GitHub Inc.",
    +  "license": "ISC",
    +  "scripts": {
    +    "test": "tap",
    +    "posttest": "npm run lint",
    +    "snap": "tap",
    +    "postsnap": "eslint lib test --fix",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "lintfix": "npm run eslint -- --fix",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "chalk": "^4.1.2",
    +    "cli-progress": "^3.10.0",
    +    "npmlog": "^7.0.0",
    +    "tap": "^16.0.1"
    +  },
    +  "tap": {
    +    "coverage-map": "map.js",
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  },
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": true
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/promise-all-reject-late/LICENSE b/node_modules/npm/node_modules/promise-all-reject-late/LICENSE
    new file mode 100644
    index 00000000..05eeeb88
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-all-reject-late/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/promise-all-reject-late/index.js b/node_modules/npm/node_modules/promise-all-reject-late/index.js
    new file mode 100644
    index 00000000..1425edce
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-all-reject-late/index.js
    @@ -0,0 +1,27 @@
    +const allSettled =
    +  Promise.allSettled ? promises => Promise.allSettled(promises)
    +  : promises => {
    +    const reflections = []
    +    for (let i = 0; i < promises.length; i++) {
    +      reflections[i] = Promise.resolve(promises[i]).then(value => ({
    +        status: 'fulfilled',
    +        value,
    +      }), reason => ({
    +        status: 'rejected',
    +        reason,
    +      }))
    +    }
    +    return Promise.all(reflections)
    +  }
    +
    +module.exports = promises => allSettled(promises).then(results => {
    +  let er = null
    +  const ret = new Array(results.length)
    +  results.forEach((result, i) => {
    +    if (result.status === 'rejected')
    +      throw result.reason
    +    else
    +      ret[i] = result.value
    +  })
    +  return ret
    +})
    diff --git a/node_modules/npm/node_modules/promise-all-reject-late/package.json b/node_modules/npm/node_modules/promise-all-reject-late/package.json
    new file mode 100644
    index 00000000..5e82f6a3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-all-reject-late/package.json
    @@ -0,0 +1,22 @@
    +{
    +  "name": "promise-all-reject-late",
    +  "version": "1.0.1",
    +  "description": "Like Promise.all, but save rejections until all promises are resolved",
    +  "author": "Isaac Z. Schlueter  (https://izs.me)",
    +  "license": "ISC",
    +  "scripts": {
    +    "test": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "prepublishOnly": "git push origin --follow-tags"
    +  },
    +  "tap": {
    +    "check-coverage": true
    +  },
    +  "devDependencies": {
    +    "tap": "^14.10.5"
    +  },
    +  "funding": {
    +    "url": "https://github.com/sponsors/isaacs"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/promise-all-reject-late/test/index.js b/node_modules/npm/node_modules/promise-all-reject-late/test/index.js
    new file mode 100644
    index 00000000..2d702541
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-all-reject-late/test/index.js
    @@ -0,0 +1,88 @@
    +const t = require('tap')
    +
    +const main = () => {
    +  if (process.argv[2] === 'polyfill-all-settled') {
    +    Promise.allSettled = null
    +    runTests()
    +  } else if (process.argv[2] === 'native-all-settled') {
    +    Promise.allSettled = Promise.allSettled || (
    +      promises => {
    +        const reflections = []
    +        for (let i = 0; i < promises.length; i++) {
    +          reflections[i] = Promise.resolve(promises[i]).then(value => ({
    +            status: 'fulfilled',
    +            value,
    +          }), reason => ({
    +            status: 'rejected',
    +            reason,
    +          }))
    +        }
    +        return Promise.all(reflections)
    +      }
    +    )
    +    runTests()
    +  } else {
    +    t.spawn(process.execPath, [__filename, 'polyfill-all-settled'])
    +    t.spawn(process.execPath, [__filename, 'native-all-settled'])
    +  }
    +}
    +
    +const runTests = () => {
    +  const lateFail = require('../')
    +
    +  t.test('fail only after all promises resolve', t => {
    +    let resolvedSlow = false
    +    const fast = () => Promise.reject('nope')
    +    const slow = () => new Promise(res => setTimeout(res, 100))
    +      .then(() => resolvedSlow = true)
    +
    +    // throw some holes and junk in the array to verify that we handle it
    +    return t.rejects(lateFail([fast(),,,,slow(), null, {not: 'a promise'},,,]))
    +      .then(() => t.equal(resolvedSlow, true, 'resolved slow before failure'))
    +  })
    +
    +  t.test('works just like Promise.all() otherwise', t => {
    +    const one = () => Promise.resolve(1)
    +    const two = () => Promise.resolve(2)
    +    const tre = () => Promise.resolve(3)
    +    const fur = () => Promise.resolve(4)
    +    const fiv = () => Promise.resolve(5)
    +    const six = () => Promise.resolve(6)
    +    const svn = () => Promise.resolve(7)
    +    const eit = () => Promise.resolve(8)
    +    const nin = () => Promise.resolve(9)
    +    const ten = () => Promise.resolve(10)
    +    const expect = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    +    const all = Promise.all([
    +      one(),
    +      two(),
    +      tre(),
    +      fur(),
    +      fiv(),
    +      six(),
    +      svn(),
    +      eit(),
    +      nin(),
    +      ten(),
    +    ])
    +    const late = lateFail([
    +      one(),
    +      two(),
    +      tre(),
    +      fur(),
    +      fiv(),
    +      six(),
    +      svn(),
    +      eit(),
    +      nin(),
    +      ten(),
    +    ])
    +
    +    return Promise.all([all, late]).then(([all, late]) => {
    +      t.strictSame(all, expect)
    +      t.strictSame(late, expect)
    +    })
    +  })
    +}
    +
    +main()
    diff --git a/node_modules/npm/node_modules/promise-call-limit/LICENSE b/node_modules/npm/node_modules/promise-call-limit/LICENSE
    new file mode 100644
    index 00000000..05eeeb88
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-call-limit/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/promise-call-limit/dist/commonjs/index.js b/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js
    new file mode 100644
    index 00000000..b32a85bb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js
    @@ -0,0 +1,87 @@
    +"use strict";
    +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    var desc = Object.getOwnPropertyDescriptor(m, k);
    +    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
    +      desc = { enumerable: true, get: function() { return m[k]; } };
    +    }
    +    Object.defineProperty(o, k2, desc);
    +}) : (function(o, m, k, k2) {
    +    if (k2 === undefined) k2 = k;
    +    o[k2] = m[k];
    +}));
    +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    +    Object.defineProperty(o, "default", { enumerable: true, value: v });
    +}) : function(o, v) {
    +    o["default"] = v;
    +});
    +var __importStar = (this && this.__importStar) || function (mod) {
    +    if (mod && mod.__esModule) return mod;
    +    var result = {};
    +    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    +    __setModuleDefault(result, mod);
    +    return result;
    +};
    +Object.defineProperty(exports, "__esModule", { value: true });
    +exports.callLimit = void 0;
    +const os = __importStar(require("node:os"));
    +// availableParallelism available only since node v19, for older versions use
    +// cpus() cpus() can return an empty list if /proc is not mounted, use 1 in
    +// this case
    +/* c8 ignore start */
    +const defLimit = 'availableParallelism' in os ?
    +    Math.max(1, os.availableParallelism() - 1)
    +    : Math.max(1, os.cpus().length - 1);
    +const callLimit = (queue, { limit = defLimit, rejectLate } = {}) => new Promise((res, rej) => {
    +    let active = 0;
    +    let current = 0;
    +    const results = [];
    +    // Whether or not we rejected, distinct from the rejection just in case the rejection itself is falsey
    +    let rejected = false;
    +    let rejection;
    +    const reject = (er) => {
    +        if (rejected)
    +            return;
    +        rejected = true;
    +        rejection ??= er;
    +        if (!rejectLate)
    +            rej(rejection);
    +    };
    +    let resolved = false;
    +    const resolve = () => {
    +        if (resolved || active > 0)
    +            return;
    +        resolved = true;
    +        res(results);
    +    };
    +    const run = () => {
    +        const c = current++;
    +        if (c >= queue.length)
    +            return rejected ? reject() : resolve();
    +        active++;
    +        const step = queue[c];
    +        /* c8 ignore start */
    +        if (!step)
    +            throw new Error('walked off queue');
    +        /* c8 ignore stop */
    +        results[c] = step()
    +            .then(result => {
    +            active--;
    +            results[c] = result;
    +            return result;
    +        }, er => {
    +            active--;
    +            reject(er);
    +        })
    +            .then(result => {
    +            if (rejected && active === 0)
    +                return rej(rejection);
    +            run();
    +            return result;
    +        });
    +    };
    +    for (let i = 0; i < limit; i++)
    +        run();
    +});
    +exports.callLimit = callLimit;
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/package.json b/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/npm/node_modules/promise-call-limit/dist/esm/index.js b/node_modules/npm/node_modules/promise-call-limit/dist/esm/index.js
    new file mode 100644
    index 00000000..fe709db7
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-call-limit/dist/esm/index.js
    @@ -0,0 +1,60 @@
    +import * as os from 'node:os';
    +// availableParallelism available only since node v19, for older versions use
    +// cpus() cpus() can return an empty list if /proc is not mounted, use 1 in
    +// this case
    +/* c8 ignore start */
    +const defLimit = 'availableParallelism' in os ?
    +    Math.max(1, os.availableParallelism() - 1)
    +    : Math.max(1, os.cpus().length - 1);
    +export const callLimit = (queue, { limit = defLimit, rejectLate } = {}) => new Promise((res, rej) => {
    +    let active = 0;
    +    let current = 0;
    +    const results = [];
    +    // Whether or not we rejected, distinct from the rejection just in case the rejection itself is falsey
    +    let rejected = false;
    +    let rejection;
    +    const reject = (er) => {
    +        if (rejected)
    +            return;
    +        rejected = true;
    +        rejection ??= er;
    +        if (!rejectLate)
    +            rej(rejection);
    +    };
    +    let resolved = false;
    +    const resolve = () => {
    +        if (resolved || active > 0)
    +            return;
    +        resolved = true;
    +        res(results);
    +    };
    +    const run = () => {
    +        const c = current++;
    +        if (c >= queue.length)
    +            return rejected ? reject() : resolve();
    +        active++;
    +        const step = queue[c];
    +        /* c8 ignore start */
    +        if (!step)
    +            throw new Error('walked off queue');
    +        /* c8 ignore stop */
    +        results[c] = step()
    +            .then(result => {
    +            active--;
    +            results[c] = result;
    +            return result;
    +        }, er => {
    +            active--;
    +            reject(er);
    +        })
    +            .then(result => {
    +            if (rejected && active === 0)
    +                return rej(rejection);
    +            run();
    +            return result;
    +        });
    +    };
    +    for (let i = 0; i < limit; i++)
    +        run();
    +});
    +//# sourceMappingURL=index.js.map
    \ No newline at end of file
    diff --git a/node_modules/npm/node_modules/promise-call-limit/dist/esm/package.json b/node_modules/npm/node_modules/promise-call-limit/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-call-limit/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/npm/node_modules/promise-call-limit/package.json b/node_modules/npm/node_modules/promise-call-limit/package.json
    new file mode 100644
    index 00000000..ab145953
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-call-limit/package.json
    @@ -0,0 +1,68 @@
    +{
    +  "name": "promise-call-limit",
    +  "version": "3.0.2",
    +  "files": [
    +    "dist"
    +  ],
    +  "description": "Call an array of promise-returning functions, restricting concurrency to a specified limit.",
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/isaacs/promise-call-limit"
    +  },
    +  "author": "Isaac Z. Schlueter  (https://izs.me)",
    +  "license": "ISC",
    +  "scripts": {
    +    "prepare": "tshy",
    +    "pretest": "npm run prepare",
    +    "snap": "tap",
    +    "test": "tap",
    +    "preversion": "npm test",
    +    "postversion": "npm publish",
    +    "prepublishOnly": "git push origin --follow-tags",
    +    "format": "prettier --write . --log-level warn --cache"
    +  },
    +  "devDependencies": {
    +    "prettier": "^3.3.3",
    +    "tap": "^21.0.1",
    +    "tshy": "^3.0.2",
    +    "typedoc": "^0.26.6"
    +  },
    +  "prettier": {
    +    "experimentalTernaries": true,
    +    "semi": false,
    +    "printWidth": 70,
    +    "tabWidth": 2,
    +    "useTabs": false,
    +    "singleQuote": true,
    +    "jsxSingleQuote": false,
    +    "bracketSameLine": true,
    +    "arrowParens": "avoid",
    +    "endOfLine": "lf"
    +  },
    +  "funding": {
    +    "url": "https://github.com/sponsors/isaacs"
    +  },
    +  "tshy": {
    +    "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"
    +      }
    +    }
    +  },
    +  "main": "./dist/commonjs/index.js",
    +  "types": "./dist/commonjs/index.d.ts",
    +  "type": "module",
    +  "module": "./dist/esm/index.js"
    +}
    diff --git a/node_modules/npm/node_modules/promise-inflight/LICENSE b/node_modules/npm/node_modules/promise-inflight/LICENSE
    new file mode 100644
    index 00000000..83e7c4c6
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-inflight/LICENSE
    @@ -0,0 +1,14 @@
    +Copyright (c) 2017, Rebecca Turner 
    +
    +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/npm/node_modules/promise-inflight/inflight.js b/node_modules/npm/node_modules/promise-inflight/inflight.js
    new file mode 100644
    index 00000000..ce054d34
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-inflight/inflight.js
    @@ -0,0 +1,36 @@
    +'use strict'
    +module.exports = inflight
    +
    +let Bluebird
    +try {
    +  Bluebird = require('bluebird')
    +} catch (_) {
    +  Bluebird = Promise
    +}
    +
    +const active = {}
    +inflight.active = active
    +function inflight (unique, doFly) {
    +  return Bluebird.all([unique, doFly]).then(function (args) {
    +    const unique = args[0]
    +    const doFly = args[1]
    +    if (Array.isArray(unique)) {
    +      return Bluebird.all(unique).then(function (uniqueArr) {
    +        return _inflight(uniqueArr.join(''), doFly)
    +      })
    +    } else {
    +      return _inflight(unique, doFly)
    +    }
    +  })
    +
    +  function _inflight (unique, doFly) {
    +    if (!active[unique]) {
    +      active[unique] = (new Bluebird(function (resolve) {
    +        return resolve(doFly())
    +      }))
    +      active[unique].then(cleanup, cleanup)
    +      function cleanup() { delete active[unique] }
    +    }
    +    return active[unique]
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/promise-inflight/package.json b/node_modules/npm/node_modules/promise-inflight/package.json
    new file mode 100644
    index 00000000..0d8930c5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-inflight/package.json
    @@ -0,0 +1,24 @@
    +{
    +  "name": "promise-inflight",
    +  "version": "1.0.1",
    +  "description": "One promise for multiple requests in flight to avoid async duplication",
    +  "main": "inflight.js",
    +  "files": [
    +    "inflight.js"
    +  ],
    +  "license": "ISC",
    +  "scripts": {
    +    "test": "echo \"Error: no test specified\" && exit 1"
    +  },
    +  "keywords": [],
    +  "author": "Rebecca Turner  (http://re-becca.org/)",
    +  "devDependencies": {},
    +  "repository": {
    +    "type": "git",
    +    "url": "git+https://github.com/iarna/promise-inflight.git"
    +  },
    +  "bugs": {
    +    "url": "https://github.com/iarna/promise-inflight/issues"
    +  },
    +  "homepage": "https://github.com/iarna/promise-inflight#readme"
    +}
    diff --git a/node_modules/npm/node_modules/promise-retry/LICENSE b/node_modules/npm/node_modules/promise-retry/LICENSE
    new file mode 100644
    index 00000000..db5e914d
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-retry/LICENSE
    @@ -0,0 +1,19 @@
    +Copyright (c) 2014 IndigoUnited
    +
    +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/npm/node_modules/promise-retry/index.js b/node_modules/npm/node_modules/promise-retry/index.js
    new file mode 100644
    index 00000000..5df48ae9
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-retry/index.js
    @@ -0,0 +1,52 @@
    +'use strict';
    +
    +var errcode = require('err-code');
    +var retry = require('retry');
    +
    +var hasOwn = Object.prototype.hasOwnProperty;
    +
    +function isRetryError(err) {
    +    return err && err.code === 'EPROMISERETRY' && hasOwn.call(err, 'retried');
    +}
    +
    +function promiseRetry(fn, options) {
    +    var temp;
    +    var operation;
    +
    +    if (typeof fn === 'object' && typeof options === 'function') {
    +        // Swap options and fn when using alternate signature (options, fn)
    +        temp = options;
    +        options = fn;
    +        fn = temp;
    +    }
    +
    +    operation = retry.operation(options);
    +
    +    return new Promise(function (resolve, reject) {
    +        operation.attempt(function (number) {
    +            Promise.resolve()
    +            .then(function () {
    +                return fn(function (err) {
    +                    if (isRetryError(err)) {
    +                        err = err.retried;
    +                    }
    +
    +                    throw errcode(new Error('Retrying'), 'EPROMISERETRY', { retried: err });
    +                }, number);
    +            })
    +            .then(resolve, function (err) {
    +                if (isRetryError(err)) {
    +                    err = err.retried;
    +
    +                    if (operation.retry(err || new Error())) {
    +                        return;
    +                    }
    +                }
    +
    +                reject(err);
    +            });
    +        });
    +    });
    +}
    +
    +module.exports = promiseRetry;
    diff --git a/node_modules/npm/node_modules/promise-retry/package.json b/node_modules/npm/node_modules/promise-retry/package.json
    new file mode 100644
    index 00000000..6842de82
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-retry/package.json
    @@ -0,0 +1,37 @@
    +{
    +  "name": "promise-retry",
    +  "version": "2.0.1",
    +  "description": "Retries a function that returns a promise, leveraging the power of the retry module.",
    +  "main": "index.js",
    +  "scripts": {
    +    "test": "mocha --bail -t 10000"
    +  },
    +  "bugs": {
    +    "url": "https://github.com/IndigoUnited/node-promise-retry/issues/"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "git://github.com/IndigoUnited/node-promise-retry.git"
    +  },
    +  "keywords": [
    +    "retry",
    +    "promise",
    +    "backoff",
    +    "repeat",
    +    "replay"
    +  ],
    +  "author": "IndigoUnited  (http://indigounited.com)",
    +  "license": "MIT",
    +  "devDependencies": {
    +    "expect.js": "^0.3.1",
    +    "mocha": "^8.0.1",
    +    "sleep-promise": "^8.0.1"
    +  },
    +  "dependencies": {
    +    "err-code": "^2.0.2",
    +    "retry": "^0.12.0"
    +  },
    +  "engines": {
    +    "node": ">=10"
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/promise-retry/test/test.js b/node_modules/npm/node_modules/promise-retry/test/test.js
    new file mode 100644
    index 00000000..466b0991
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promise-retry/test/test.js
    @@ -0,0 +1,263 @@
    +'use strict';
    +
    +var expect = require('expect.js');
    +var promiseRetry = require('../');
    +var promiseDelay = require('sleep-promise');
    +
    +describe('promise-retry', function () {
    +    it('should call fn again if retry was called', function () {
    +        var count = 0;
    +
    +        return promiseRetry(function (retry) {
    +            count += 1;
    +
    +            return promiseDelay(10)
    +            .then(function () {
    +                if (count <= 2) {
    +                    retry(new Error('foo'));
    +                }
    +
    +                return 'final';
    +            });
    +        }, { factor: 1 })
    +        .then(function (value) {
    +            expect(value).to.be('final');
    +            expect(count).to.be(3);
    +        }, function () {
    +            throw new Error('should not fail');
    +        });
    +    });
    +
    +    it('should call fn with the attempt number', function () {
    +        var count = 0;
    +
    +        return promiseRetry(function (retry, number) {
    +            count += 1;
    +            expect(count).to.equal(number);
    +
    +            return promiseDelay(10)
    +            .then(function () {
    +                if (count <= 2) {
    +                    retry(new Error('foo'));
    +                }
    +
    +                return 'final';
    +            });
    +        }, { factor: 1 })
    +        .then(function (value) {
    +            expect(value).to.be('final');
    +            expect(count).to.be(3);
    +        }, function () {
    +            throw new Error('should not fail');
    +        });
    +    });
    +
    +    it('should not retry on fulfillment if retry was not called', function () {
    +        var count = 0;
    +
    +        return promiseRetry(function () {
    +            count += 1;
    +
    +            return promiseDelay(10)
    +            .then(function () {
    +                return 'final';
    +            });
    +        })
    +        .then(function (value) {
    +            expect(value).to.be('final');
    +            expect(count).to.be(1);
    +        }, function () {
    +            throw new Error('should not fail');
    +        });
    +    });
    +
    +    it('should not retry on rejection if retry was not called', function () {
    +        var count = 0;
    +
    +        return promiseRetry(function () {
    +            count += 1;
    +
    +            return promiseDelay(10)
    +            .then(function () {
    +                throw new Error('foo');
    +            });
    +        })
    +        .then(function () {
    +            throw new Error('should not succeed');
    +        }, function (err) {
    +            expect(err.message).to.be('foo');
    +            expect(count).to.be(1);
    +        });
    +    });
    +
    +    it('should not retry on rejection if nr of retries is 0', function () {
    +        var count = 0;
    +
    +        return promiseRetry(function (retry) {
    +            count += 1;
    +
    +            return promiseDelay(10)
    +            .then(function () {
    +                throw new Error('foo');
    +            })
    +            .catch(retry);
    +        }, { retries : 0 })
    +        .then(function () {
    +            throw new Error('should not succeed');
    +        }, function (err) {
    +            expect(err.message).to.be('foo');
    +            expect(count).to.be(1);
    +        });
    +    });
    +
    +    it('should reject the promise if the retries were exceeded', function () {
    +        var count = 0;
    +
    +        return promiseRetry(function (retry) {
    +            count += 1;
    +
    +            return promiseDelay(10)
    +            .then(function () {
    +                throw new Error('foo');
    +            })
    +            .catch(retry);
    +        }, { retries: 2, factor: 1 })
    +        .then(function () {
    +            throw new Error('should not succeed');
    +        }, function (err) {
    +            expect(err.message).to.be('foo');
    +            expect(count).to.be(3);
    +        });
    +    });
    +
    +    it('should pass options to the underlying retry module', function () {
    +        var count = 0;
    +
    +        return promiseRetry(function (retry) {
    +            return promiseDelay(10)
    +            .then(function () {
    +                if (count < 2) {
    +                    count += 1;
    +                    retry(new Error('foo'));
    +                }
    +
    +                return 'final';
    +            });
    +        }, { retries: 1, factor: 1 })
    +        .then(function () {
    +            throw new Error('should not succeed');
    +        }, function (err) {
    +            expect(err.message).to.be('foo');
    +        });
    +    });
    +
    +    it('should convert direct fulfillments into promises', function () {
    +        return promiseRetry(function () {
    +            return 'final';
    +        }, { factor: 1 })
    +        .then(function (value) {
    +            expect(value).to.be('final');
    +        }, function () {
    +            throw new Error('should not fail');
    +        });
    +    });
    +
    +    it('should convert direct rejections into promises', function () {
    +        promiseRetry(function () {
    +            throw new Error('foo');
    +        }, { retries: 1, factor: 1 })
    +        .then(function () {
    +            throw new Error('should not succeed');
    +        }, function (err) {
    +            expect(err.message).to.be('foo');
    +        });
    +    });
    +
    +    it('should not crash on undefined rejections', function () {
    +        return promiseRetry(function () {
    +            throw undefined;
    +        }, { retries: 1, factor: 1 })
    +        .then(function () {
    +            throw new Error('should not succeed');
    +        }, function (err) {
    +            expect(err).to.be(undefined);
    +        })
    +        .then(function () {
    +            return promiseRetry(function (retry) {
    +                retry();
    +            }, { retries: 1, factor: 1 });
    +        })
    +        .then(function () {
    +            throw new Error('should not succeed');
    +        }, function (err) {
    +            expect(err).to.be(undefined);
    +        });
    +    });
    +
    +    it('should retry if retry() was called with undefined', function () {
    +        var count = 0;
    +
    +        return promiseRetry(function (retry) {
    +            count += 1;
    +
    +            return promiseDelay(10)
    +            .then(function () {
    +                if (count <= 2) {
    +                    retry();
    +                }
    +
    +                return 'final';
    +            });
    +        }, { factor: 1 })
    +        .then(function (value) {
    +            expect(value).to.be('final');
    +            expect(count).to.be(3);
    +        }, function () {
    +            throw new Error('should not fail');
    +        });
    +    });
    +
    +    it('should work with several retries in the same chain', function () {
    +        var count = 0;
    +
    +        return promiseRetry(function (retry) {
    +            count += 1;
    +
    +            return promiseDelay(10)
    +            .then(function () {
    +                retry(new Error('foo'));
    +            })
    +            .catch(function (err) {
    +                retry(err);
    +            });
    +        }, { retries: 1, factor: 1 })
    +        .then(function () {
    +            throw new Error('should not succeed');
    +        }, function (err) {
    +            expect(err.message).to.be('foo');
    +            expect(count).to.be(2);
    +        });
    +    });
    +
    +    it('should allow options to be passed first', function () {
    +        var count = 0;
    +
    +        return promiseRetry({ factor: 1 }, function (retry) {
    +            count += 1;
    +
    +            return promiseDelay(10)
    +                .then(function () {
    +                    if (count <= 2) {
    +                        retry(new Error('foo'));
    +                    }
    +
    +                    return 'final';
    +                });
    +        }).then(function (value) {
    +            expect(value).to.be('final');
    +            expect(count).to.be(3);
    +        }, function () {
    +            throw new Error('should not fail');
    +        });
    +    });
    +});
    diff --git a/node_modules/npm/node_modules/promzard/LICENSE b/node_modules/npm/node_modules/promzard/LICENSE
    new file mode 100644
    index 00000000..05eeeb88
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promzard/LICENSE
    @@ -0,0 +1,15 @@
    +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/npm/node_modules/promzard/lib/index.js b/node_modules/npm/node_modules/promzard/lib/index.js
    new file mode 100644
    index 00000000..130bb4e3
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promzard/lib/index.js
    @@ -0,0 +1,176 @@
    +const fs = require('fs/promises')
    +const { runInThisContext } = require('vm')
    +const { promisify } = require('util')
    +const { randomBytes } = require('crypto')
    +const { Module } = require('module')
    +const { dirname, basename } = require('path')
    +const { read } = require('read')
    +
    +const files = {}
    +
    +class PromZard {
    +  #file = null
    +  #backupFile = null
    +  #ctx = null
    +  #unique = randomBytes(8).toString('hex')
    +  #prompts = []
    +
    +  constructor (file, ctx = {}, options = {}) {
    +    this.#file = file
    +    this.#ctx = ctx
    +    this.#backupFile = options.backupFile
    +  }
    +
    +  static async promzard (file, ctx, options) {
    +    const pz = new PromZard(file, ctx, options)
    +    return pz.load()
    +  }
    +
    +  static async fromBuffer (buf, ctx, options) {
    +    let filename = 0
    +    do {
    +      filename = '\0' + Math.random()
    +    } while (files[filename])
    +    files[filename] = buf
    +    const ret = await PromZard.promzard(filename, ctx, options)
    +    delete files[filename]
    +    return ret
    +  }
    +
    +  async load () {
    +    if (files[this.#file]) {
    +      return this.#loaded()
    +    }
    +
    +    try {
    +      files[this.#file] = await fs.readFile(this.#file, 'utf8')
    +    } catch (er) {
    +      if (er && this.#backupFile) {
    +        this.#file = this.#backupFile
    +        this.#backupFile = null
    +        return this.load()
    +      }
    +      throw er
    +    }
    +
    +    return this.#loaded()
    +  }
    +
    +  async #loaded () {
    +    const mod = new Module(this.#file, module)
    +    mod.loaded = true
    +    mod.filename = this.#file
    +    mod.id = this.#file
    +    mod.paths = Module._nodeModulePaths(dirname(this.#file))
    +
    +    this.#ctx.prompt = this.#makePrompt()
    +    this.#ctx.__filename = this.#file
    +    this.#ctx.__dirname = dirname(this.#file)
    +    this.#ctx.__basename = basename(this.#file)
    +    this.#ctx.module = mod
    +    this.#ctx.require = (p) => mod.require(p)
    +    this.#ctx.require.resolve = (p) => Module._resolveFilename(p, mod)
    +    this.#ctx.exports = mod.exports
    +
    +    const body = `(function(${Object.keys(this.#ctx).join(', ')}) { ${files[this.#file]}\n })`
    +    runInThisContext(body, this.#file).apply(this.#ctx, Object.values(this.#ctx))
    +    this.#ctx.res = mod.exports
    +
    +    return this.#walk()
    +  }
    +
    +  #makePrompt () {
    +    return (...args) => {
    +      let p, d, t
    +      for (let i = 0; i < args.length; i++) {
    +        const a = args[i]
    +        if (typeof a === 'string') {
    +          if (p) {
    +            d = a
    +          } else {
    +            p = a
    +          }
    +        } else if (typeof a === 'function') {
    +          t = a
    +        } else if (a && typeof a === 'object') {
    +          p = a.prompt || p
    +          d = a.default || d
    +          t = a.transform || t
    +        }
    +      }
    +      try {
    +        return `${this.#unique}-${this.#prompts.length}`
    +      } finally {
    +        this.#prompts.push([p, d, t])
    +      }
    +    }
    +  }
    +
    +  async #walk (o = this.#ctx.res) {
    +    const keys = Object.keys(o)
    +
    +    const len = keys.length
    +    let i = 0
    +
    +    while (i < len) {
    +      const k = keys[i]
    +      const v = o[k]
    +      i++
    +
    +      if (v && typeof v === 'object') {
    +        o[k] = await this.#walk(v)
    +        continue
    +      }
    +
    +      if (v && typeof v === 'string' && v.startsWith(this.#unique)) {
    +        const n = +v.slice(this.#unique.length + 1)
    +
    +        // default to the key
    +        // default to the ctx value, if there is one
    +        const [prompt = k, def = this.#ctx[k], tx] = this.#prompts[n]
    +
    +        try {
    +          o[k] = await this.#prompt(prompt, def, tx)
    +        } catch (er) {
    +          if (er.notValid) {
    +            // eslint-disable-next-line no-console
    +            console.log(er.message)
    +            i--
    +          } else {
    +            throw er
    +          }
    +        }
    +        continue
    +      }
    +
    +      if (typeof v === 'function') {
    +        // XXX: remove v.length check to remove cb from functions
    +        // would be a breaking change for `npm init`
    +        // XXX: if cb is no longer an argument then this.#ctx should
    +        // be passed in to allow arrow fns to be used and still access ctx
    +        const fn = v.length ? promisify(v) : v
    +        o[k] = await fn.call(this.#ctx)
    +        // back up so that we process this one again.
    +        // this is because it might return a prompt() call in the cb.
    +        i--
    +        continue
    +      }
    +    }
    +
    +    return o
    +  }
    +
    +  async #prompt (prompt, def, tx) {
    +    const res = await read({ prompt: prompt + ':', default: def }).then((r) => tx ? tx(r) : r)
    +    // XXX: remove this to require throwing an error instead of
    +    // returning it. would be a breaking change for `npm init`
    +    if (res instanceof Error && res.notValid) {
    +      throw res
    +    }
    +    return res
    +  }
    +}
    +
    +module.exports = PromZard.promzard
    +module.exports.fromBuffer = PromZard.fromBuffer
    +module.exports.PromZard = PromZard
    diff --git a/node_modules/npm/node_modules/promzard/package.json b/node_modules/npm/node_modules/promzard/package.json
    new file mode 100644
    index 00000000..c224a4b4
    --- /dev/null
    +++ b/node_modules/npm/node_modules/promzard/package.json
    @@ -0,0 +1,50 @@
    +{
    +  "author": "GitHub Inc.",
    +  "name": "promzard",
    +  "description": "prompting wizardly",
    +  "version": "2.0.0",
    +  "repository": {
    +    "url": "git+https://github.com/npm/promzard.git",
    +    "type": "git"
    +  },
    +  "dependencies": {
    +    "read": "^4.0.0"
    +  },
    +  "devDependencies": {
    +    "@npmcli/eslint-config": "^5.0.0",
    +    "@npmcli/template-oss": "4.23.3",
    +    "tap": "^16.3.0"
    +  },
    +  "main": "lib/index.js",
    +  "scripts": {
    +    "test": "tap",
    +    "lint": "npm run eslint",
    +    "postlint": "template-oss-check",
    +    "template-oss-apply": "template-oss-apply --force",
    +    "lintfix": "npm run eslint -- --fix",
    +    "snap": "tap",
    +    "posttest": "npm run lint",
    +    "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
    +  },
    +  "license": "ISC",
    +  "files": [
    +    "bin/",
    +    "lib/"
    +  ],
    +  "engines": {
    +    "node": "^18.17.0 || >=20.5.0"
    +  },
    +  "templateOSS": {
    +    "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
    +    "version": "4.23.3",
    +    "publish": true
    +  },
    +  "tap": {
    +    "jobs": 1,
    +    "test-ignore": "fixtures/",
    +    "nyc-arg": [
    +      "--exclude",
    +      "tap-snapshots/**"
    +    ]
    +  }
    +}
    diff --git a/node_modules/npm/node_modules/qrcode-terminal/.travis.yml b/node_modules/npm/node_modules/qrcode-terminal/.travis.yml
    new file mode 100644
    index 00000000..6e5919de
    --- /dev/null
    +++ b/node_modules/npm/node_modules/qrcode-terminal/.travis.yml
    @@ -0,0 +1,3 @@
    +language: node_js
    +node_js:
    +  - "0.10"
    diff --git a/node_modules/npm/node_modules/qrcode-terminal/LICENSE b/node_modules/npm/node_modules/qrcode-terminal/LICENSE
    new file mode 100644
    index 00000000..07e74fd5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/qrcode-terminal/LICENSE
    @@ -0,0 +1,222 @@
    +
    +                                 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
    +
    +   APPENDIX: How to apply the Apache License to your work.
    +
    +      To apply the Apache License to your work, attach the following
    +      boilerplate notice, with the fields enclosed by brackets "[]"
    +      replaced with your own identifying information. (Don't include
    +      the brackets!)  The text should be enclosed in the appropriate
    +      comment syntax for the file format. We also recommend that a
    +      file or class name and description of purpose be included on the
    +      same "printed page" as the copyright notice for easier
    +      identification within third-party archives.
    +
    +   Copyright [yyyy] [name of copyright owner]
    +
    +   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.
    +
    +==============================================================
    +This product also include the following software:
    +==============================================================
    +
    + QRCode for JavaScript
    +
    + Copyright (c) 2009 Kazuhiko Arase
    +
    + URL: http://www.d-project.com/
    +
    + Licensed under the MIT license:
    +   http://www.opensource.org/licenses/mit-license.php
    +
    + The word "QR Code" is registered trademark of 
    + DENSO WAVE INCORPORATED
    +   http://www.denso-wave.com/qrcode/faqpatent-e.html
    +
    +Located in ./vendor/QRCode
    +- project has been modified to work in Node and some refactoring was done for code cleanup
    diff --git a/node_modules/npm/node_modules/qrcode-terminal/README.md b/node_modules/npm/node_modules/qrcode-terminal/README.md
    new file mode 100644
    index 00000000..f5c830f2
    --- /dev/null
    +++ b/node_modules/npm/node_modules/qrcode-terminal/README.md
    @@ -0,0 +1,82 @@
    +# QRCode Terminal Edition [![Build Status][travis-ci-img]][travis-ci-url]
    +
    +> Going where no QRCode has gone before.
    +
    +![Basic Example][basic-example-img]
    +
    +# Node Library
    +
    +## Install
    +
    +Can be installed with:
    +
    +    $ npm install qrcode-terminal
    +
    +and used:
    +
    +    var qrcode = require('qrcode-terminal');
    +
    +## Usage
    +
    +To display some data to the terminal just call:
    +
    +    qrcode.generate('This will be a QRCode, eh!');
    +
    +You can even specify the error level (default is 'L'):
    +    
    +    qrcode.setErrorLevel('Q');
    +    qrcode.generate('This will be a QRCode with error level Q!');
    +
    +If you don't want to display to the terminal but just want to string you can provide a callback:
    +
    +    qrcode.generate('http://github.com', function (qrcode) {
    +        console.log(qrcode);
    +    });
    +
    +If you want to display small output, provide `opts` with `small`:
    +
    +    qrcode.generate('This will be a small QRCode, eh!', {small: true});
    +
    +    qrcode.generate('This will be a small QRCode, eh!', {small: true}, function (qrcode) {
    +        console.log(qrcode)
    +    });
    +
    +# Command-Line
    +
    +## Install
    +
    +    $ npm install -g qrcode-terminal
    +
    +## Usage
    +
    +    $ qrcode-terminal --help
    +    $ qrcode-terminal 'http://github.com'
    +    $ echo 'http://github.com' | qrcode-terminal
    +
    +# Support
    +
    +- OS X
    +- Linux
    +- Windows
    +
    +# Server-side
    +
    +[node-qrcode][node-qrcode-url] is a popular server-side QRCode generator that
    +renders to a `canvas` object.
    +
    +# Developing
    +
    +To setup the development envrionment run `npm install`
    +
    +To run tests run `npm test`
    +
    +# Contributers
    +
    +    Gord Tanner 
    +    Micheal Brooks 
    +
    +[travis-ci-img]: https://travis-ci.org/gtanner/qrcode-terminal.png
    +[travis-ci-url]: https://travis-ci.org/gtanner/qrcode-terminal
    +[basic-example-img]: https://raw.github.com/gtanner/qrcode-terminal/master/example/basic.png
    +[node-qrcode-url]: https://github.com/soldair/node-qrcode
    +
    diff --git a/node_modules/npm/node_modules/qrcode-terminal/bin/qrcode-terminal.js b/node_modules/npm/node_modules/qrcode-terminal/bin/qrcode-terminal.js
    new file mode 100755
    index 00000000..64762879
    --- /dev/null
    +++ b/node_modules/npm/node_modules/qrcode-terminal/bin/qrcode-terminal.js
    @@ -0,0 +1,101 @@
    +#!/usr/bin/env node
    +
    +/*!
    + * Module dependencies.
    + */
    +
    +var qrcode = require('../lib/main'),
    +    path = require('path'),
    +    fs = require('fs');
    +
    +/*!
    + * Parse the process name
    + */
    +
    +var name = process.argv[1].replace(/^.*[\\\/]/, '').replace('.js', '');
    +
    +/*!
    + * Parse the input
    + */
    +
    +if (process.stdin.isTTY) {
    +    // called with input as argument, e.g.:
    +    // ./qrcode-terminal.js "INPUT"
    +
    +    var input = process.argv[2];
    +    handleInput(input);
    +} else {
    +    // called with piped input, e.g.:
    +    // echo "INPUT" | ./qrcode-terminal.js
    +
    +    var readline = require('readline');
    +
    +    var interface = readline.createInterface({
    +        input: process.stdin,
    +        output: process.stdout,
    +        terminal: false
    +    });
    +
    +    interface.on('line', function(line) {
    +        handleInput(line);
    +    });
    +}
    +
    +/*!
    + * Process the input
    + */
    +
    +function handleInput(input) {
    +
    +    /*!
    +     * Display help
    +     */
    +
    +    if (!input || input === '-h' || input === '--help') {
    +        help();
    +        process.exit();
    +    }
    +
    +    /*!
    +     * Display version
    +     */
    +
    +    if (input === '-v' || input === '--version') {
    +        version();
    +        process.exit();
    +    }
    +
    +    /*!
    +     * Render the QR Code
    +     */
    +
    +    qrcode.generate(input);
    +}
    +
    +/*!
    + * Helper functions
    + */
    +
    +function help() {
    +    console.log([
    +        '',
    +        'Usage: ' + name + ' ',
    +        '',
    +        'Options:',
    +        '  -h, --help           output usage information',
    +        '  -v, --version        output version number',
    +        '',
    +        'Examples:',
    +        '',
    +        '  $ ' + name + ' hello',
    +        '  $ ' + name + ' "hello world"',
    +        ''
    +    ].join('\n'));
    +}
    +
    +function version() {
    +    var packagePath = path.join(__dirname, '..', 'package.json'),
    +        packageJSON = JSON.parse(fs.readFileSync(packagePath), 'utf8');
    +
    +    console.log(packageJSON.version);
    +}
    diff --git a/node_modules/npm/node_modules/qrcode-terminal/example/basic.js b/node_modules/npm/node_modules/qrcode-terminal/example/basic.js
    new file mode 100644
    index 00000000..e1e306d5
    --- /dev/null
    +++ b/node_modules/npm/node_modules/qrcode-terminal/example/basic.js
    @@ -0,0 +1,2 @@
    +var qrcode = require('../lib/main');
    +qrcode.generate('this is the bomb');
    diff --git a/node_modules/npm/node_modules/qrcode-terminal/example/basic.png b/node_modules/npm/node_modules/qrcode-terminal/example/basic.png
    new file mode 100644
    index 0000000000000000000000000000000000000000..2ab5c226f4311f6892bd73a0f0f279257d5cafd5
    GIT binary patch
    literal 46426
    zcmaI7cRZW#+c&O5H@Yb;ZLQj+YLB*R?@f_du{S{wx@oPNQL{c)#YjbkAkkJ)VzgF7
    zjMfSgR3eCoJigEKyzb|7-@n)E_uner6`^!+aPVFA)zPsq)X}+V5f<#_8vx?qa5!D(2+^>e#?O+9)k9M8
    zx?XsVp=%05;Y;Xm_tRnZjuq!DFLGsCyfk=REn=Bb`cUGE>EqXT-iVY^gEZ+HLmM{^
    zVuwiKgNzw4Hg=;4KRNP*mjjC%U0yzQPMss;vqNjvEBUU@k>p2wM^CvPnR;;2z?$Xp
    zPwMsS0bkh==#8fV(VCVH2r|2zwIO71VSZ4+~sL;9YD*_$1n*Yr;c
    z$DWctaK0RNl|S=+@8H%b2gh#QEqyHo1-~1l2hwXhh?wW>SJgHh9prMW7wql?I%n=n
    zu7cOykM%9G;#s@wxW{_mAI7p;U;fTg6`LZQz@kg1FS4q=2G7$T6bfAQ0WqBbS8n)I
    zwwz}8`TZA<%8M^(aJ^}aV5L^geRD~@dG#rE)QQdd5K&IW*E8lBM$1xS1$_8xu0IN@XprE
    zT}KW+gFfbb{%D}?=IhqdzFQGE?Xb?}B%lX>uCB{+s2Mr(e4@&ocT257onS~L$5_NP
    z>Zh2`>ANRw9-Mskh3DrNo(D%zUykP;#9MtRJOMhmdFJt#0y8%zjZ^teY)Wi$>}!Fq
    zm|fu)q6xGIcTPRsMYJB+3icH}RMXFAAA2X)Z>j;5W{re*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s$7~pie4)^GZ|WHzZaA$Uhn<;4EDlq=Zq#QuZ4IYa^+LP8|MNQ7;SYG zv-a0*H3y+-VR=7qZZ4U79QXUS@E`WnY=gqE>W12)hK~M#rN3Tt z&U^`)+kffk3Lb|8t#vm=+yQUX)`8~rx{9WtR_lwq;OK?M>mw%qHVBN)0G<1c wC)vTfdEM*3d7o@^n+yR1e>3Zy7fY{EcysG6d^LLMPvA-ZB>iLVM`!-^e+b{uO8@`> literal 0 HcmV?d00001 diff --git a/node_modules/npm/node_modules/qrcode-terminal/example/callback.js b/node_modules/npm/node_modules/qrcode-terminal/example/callback.js new file mode 100644 index 00000000..5aa6814e --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/example/callback.js @@ -0,0 +1,4 @@ +var qrcode = require('../lib/main'); +qrcode.generate('someone sets it up', function (str) { + console.log(str); +}); diff --git a/node_modules/npm/node_modules/qrcode-terminal/example/small-qrcode.js b/node_modules/npm/node_modules/qrcode-terminal/example/small-qrcode.js new file mode 100644 index 00000000..f7d145d4 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/example/small-qrcode.js @@ -0,0 +1,6 @@ +var qrcode = require('../lib/main'), + url = 'https://google.com/'; + +qrcode.generate(url, { small: true }, function (qr) { + console.log(qr); +}); diff --git a/node_modules/npm/node_modules/qrcode-terminal/lib/main.js b/node_modules/npm/node_modules/qrcode-terminal/lib/main.js new file mode 100644 index 00000000..488cc1ae --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/lib/main.js @@ -0,0 +1,100 @@ +var QRCode = require('./../vendor/QRCode'), + QRErrorCorrectLevel = require('./../vendor/QRCode/QRErrorCorrectLevel'), + black = "\033[40m \033[0m", + white = "\033[47m \033[0m", + toCell = function (isBlack) { + return isBlack ? black : white; + }, + repeat = function (color) { + return { + times: function (count) { + return new Array(count).join(color); + } + }; + }, + fill = function(length, value) { + var arr = new Array(length); + for (var i = 0; i < length; i++) { + arr[i] = value; + } + return arr; + }; + +module.exports = { + + error: QRErrorCorrectLevel.L, + + generate: function (input, opts, cb) { + if (typeof opts === 'function') { + cb = opts; + opts = {}; + } + + var qrcode = new QRCode(-1, this.error); + qrcode.addData(input); + qrcode.make(); + + var output = ''; + if (opts && opts.small) { + var BLACK = true, WHITE = false; + var moduleCount = qrcode.getModuleCount(); + var moduleData = qrcode.modules.slice(); + + var oddRow = moduleCount % 2 === 1; + if (oddRow) { + moduleData.push(fill(moduleCount, WHITE)); + } + + var platte= { + WHITE_ALL: '\u2588', + WHITE_BLACK: '\u2580', + BLACK_WHITE: '\u2584', + BLACK_ALL: ' ', + }; + + var borderTop = repeat(platte.BLACK_WHITE).times(moduleCount + 3); + var borderBottom = repeat(platte.WHITE_BLACK).times(moduleCount + 3); + output += borderTop + '\n'; + + for (var row = 0; row < moduleCount; row += 2) { + output += platte.WHITE_ALL; + + for (var col = 0; col < moduleCount; col++) { + if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === WHITE) { + output += platte.WHITE_ALL; + } else if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === BLACK) { + output += platte.WHITE_BLACK; + } else if (moduleData[row][col] === BLACK && moduleData[row + 1][col] === WHITE) { + output += platte.BLACK_WHITE; + } else { + output += platte.BLACK_ALL; + } + } + + output += platte.WHITE_ALL + '\n'; + } + + if (!oddRow) { + output += borderBottom; + } + } else { + var border = repeat(white).times(qrcode.getModuleCount() + 3); + + output += border + '\n'; + qrcode.modules.forEach(function (row) { + output += white; + output += row.map(toCell).join(''); + output += white + '\n'; + }); + output += border; + } + + if (cb) cb(output); + else console.log(output); + }, + + setErrorLevel: function (error) { + this.error = QRErrorCorrectLevel[error] || this.error; + } + +}; diff --git a/node_modules/npm/node_modules/qrcode-terminal/package.json b/node_modules/npm/node_modules/qrcode-terminal/package.json new file mode 100644 index 00000000..9a6b9e78 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/package.json @@ -0,0 +1,37 @@ +{ + "name": "qrcode-terminal", + "keywords": ["ansi", "ascii", "qrcode", "console"], + "version" : "0.12.0", + "description" : "QRCodes, in the terminal", + "homepage": "https://github.com/gtanner/qrcode-terminal", + "repository": { + "type": "git", + "url": "https://github.com/gtanner/qrcode-terminal" + }, + "contributors": [{ + "name": "Gord Tanner", + "email": "gtanner@gmail.com", + "url": "http://github.com/gtanner" + }, { + "name": "Michael Brooks", + "email": "mikeywbrooks@gmail.com", + "url": "http://github.com/mwbrooks" + }], + "licenses": [{ + "type": "Apache 2.0" + }], + "main": "./lib/main", + "bin": { + "qrcode-terminal": "./bin/qrcode-terminal.js" + }, + "preferGlobal": false, + "devDependencies": { + "sinon": "*", + "mocha": "*", + "expect.js": "*", + "jshint": "*" + }, + "scripts": { + "test": "./node_modules/jshint/bin/jshint lib vendor && node example/basic.js && ./node_modules/mocha/bin/mocha -R nyan" + } +} diff --git a/node_modules/npm/node_modules/qrcode-terminal/test/main.js b/node_modules/npm/node_modules/qrcode-terminal/test/main.js new file mode 100644 index 00000000..71cf3f95 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/test/main.js @@ -0,0 +1,63 @@ +var expect = require('expect.js'), + qrcode = require('./../lib/main'), + sinon = require('sinon'); + +describe('in the main module', function() { + describe('the generate method', function () { + describe('when not providing a callback', function () { + beforeEach(function () { + sinon.stub(console, 'log'); + }); + + afterEach(function () { + sinon.sandbox.restore(); + console.log.reset(); + }); + + it('logs to the console', function () { + qrcode.generate('test'); + expect(console.log.called).to.be(true); + }); + }); + + describe('when providing a callback', function () { + it('will call the callback', function () { + var cb = sinon.spy(); + qrcode.generate('test', cb); + expect(cb.called).to.be(true); + }); + + it('will not call the console.log method', function () { + qrcode.generate('test', sinon.spy()); + expect(console.log.called).to.be(false); + }); + }); + + describe('the QR Code', function () { + it('should be a string', function (done) { + qrcode.generate('test', function(result) { + expect(result).to.be.a('string'); + done(); + }); + }); + + it('should not end with a newline', function (done) { + qrcode.generate('test', function(result) { + expect(result).not.to.match(/\n$/); + done(); + }); + }); + }); + + describe('the error level', function () { + it('should default to 1', function() { + expect(qrcode.error).to.be(1); + }); + + it('should not allow other levels', function() { + qrcode.setErrorLevel = 'something'; + expect(qrcode.error).to.be(1); + }); + }); + }); +}); diff --git a/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js new file mode 100644 index 00000000..94bf74f0 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js @@ -0,0 +1,22 @@ +var QRMode = require('./QRMode'); + +function QR8bitByte(data) { + this.mode = QRMode.MODE_8BIT_BYTE; + this.data = data; +} + +QR8bitByte.prototype = { + + getLength : function() { + return this.data.length; + }, + + write : function(buffer) { + for (var i = 0; i < this.data.length; i++) { + // not JIS ... + buffer.put(this.data.charCodeAt(i), 8); + } + } +}; + +module.exports = QR8bitByte; diff --git a/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js new file mode 100644 index 00000000..e2861f68 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js @@ -0,0 +1,38 @@ +function QRBitBuffer() { + this.buffer = []; + this.length = 0; +} + +QRBitBuffer.prototype = { + + get : function(index) { + var bufIndex = Math.floor(index / 8); + return ( (this.buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1; + }, + + put : function(num, length) { + for (var i = 0; i < length; i++) { + this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1); + } + }, + + getLengthInBits : function() { + return this.length; + }, + + putBit : function(bit) { + + var bufIndex = Math.floor(this.length / 8); + if (this.buffer.length <= bufIndex) { + this.buffer.push(0); + } + + if (bit) { + this.buffer[bufIndex] |= (0x80 >>> (this.length % 8) ); + } + + this.length++; + } +}; + +module.exports = QRBitBuffer; diff --git a/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js new file mode 100644 index 00000000..9b4b3009 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js @@ -0,0 +1,7 @@ +module.exports = { + L : 1, + M : 0, + Q : 3, + H : 2 +}; + diff --git a/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js new file mode 100644 index 00000000..f6fdeb53 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js @@ -0,0 +1,10 @@ +module.exports = { + PATTERN000 : 0, + PATTERN001 : 1, + PATTERN010 : 2, + PATTERN011 : 3, + PATTERN100 : 4, + PATTERN101 : 5, + PATTERN110 : 6, + PATTERN111 : 7 +}; diff --git a/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMath.js b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMath.js new file mode 100644 index 00000000..8f4a0370 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMath.js @@ -0,0 +1,44 @@ +var QRMath = { + + glog : function(n) { + + if (n < 1) { + throw new Error("glog(" + n + ")"); + } + + return QRMath.LOG_TABLE[n]; + }, + + gexp : function(n) { + + while (n < 0) { + n += 255; + } + + while (n >= 256) { + n -= 255; + } + + return QRMath.EXP_TABLE[n]; + }, + + EXP_TABLE : new Array(256), + + LOG_TABLE : new Array(256) + +}; + +for (var i = 0; i < 8; i++) { + QRMath.EXP_TABLE[i] = 1 << i; +} +for (var i = 8; i < 256; i++) { + QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] + ^ QRMath.EXP_TABLE[i - 5] + ^ QRMath.EXP_TABLE[i - 6] + ^ QRMath.EXP_TABLE[i - 8]; +} +for (var i = 0; i < 255; i++) { + QRMath.LOG_TABLE[QRMath.EXP_TABLE[i] ] = i; +} + +module.exports = QRMath; diff --git a/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMode.js b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMode.js new file mode 100644 index 00000000..050c8a30 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRMode.js @@ -0,0 +1,6 @@ +module.exports = { + MODE_NUMBER : 1 << 0, + MODE_ALPHA_NUM : 1 << 1, + MODE_8BIT_BYTE : 1 << 2, + MODE_KANJI : 1 << 3 +}; diff --git a/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js new file mode 100644 index 00000000..0c05f38e --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js @@ -0,0 +1,66 @@ +var QRMath = require('./QRMath'); + +function QRPolynomial(num, shift) { + if (num.length === undefined) { + throw new Error(num.length + "/" + shift); + } + + var offset = 0; + + while (offset < num.length && num[offset] === 0) { + offset++; + } + + this.num = new Array(num.length - offset + shift); + for (var i = 0; i < num.length - offset; i++) { + this.num[i] = num[i + offset]; + } +} + +QRPolynomial.prototype = { + + get : function(index) { + return this.num[index]; + }, + + getLength : function() { + return this.num.length; + }, + + multiply : function(e) { + + var num = new Array(this.getLength() + e.getLength() - 1); + + for (var i = 0; i < this.getLength(); i++) { + for (var j = 0; j < e.getLength(); j++) { + num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i) ) + QRMath.glog(e.get(j) ) ); + } + } + + return new QRPolynomial(num, 0); + }, + + mod : function(e) { + + if (this.getLength() - e.getLength() < 0) { + return this; + } + + var ratio = QRMath.glog(this.get(0) ) - QRMath.glog(e.get(0) ); + + var num = new Array(this.getLength() ); + + for (var i = 0; i < this.getLength(); i++) { + num[i] = this.get(i); + } + + for (var x = 0; x < e.getLength(); x++) { + num[x] ^= QRMath.gexp(QRMath.glog(e.get(x) ) + ratio); + } + + // recursive call + return new QRPolynomial(num, 0).mod(e); + } +}; + +module.exports = QRPolynomial; diff --git a/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js new file mode 100644 index 00000000..d150af17 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js @@ -0,0 +1,298 @@ +var QRErrorCorrectLevel = require('./QRErrorCorrectLevel'); + +function QRRSBlock(totalCount, dataCount) { + this.totalCount = totalCount; + this.dataCount = dataCount; +} + +QRRSBlock.RS_BLOCK_TABLE = [ + + // L + // M + // Q + // H + + // 1 + [1, 26, 19], + [1, 26, 16], + [1, 26, 13], + [1, 26, 9], + + // 2 + [1, 44, 34], + [1, 44, 28], + [1, 44, 22], + [1, 44, 16], + + // 3 + [1, 70, 55], + [1, 70, 44], + [2, 35, 17], + [2, 35, 13], + + // 4 + [1, 100, 80], + [2, 50, 32], + [2, 50, 24], + [4, 25, 9], + + // 5 + [1, 134, 108], + [2, 67, 43], + [2, 33, 15, 2, 34, 16], + [2, 33, 11, 2, 34, 12], + + // 6 + [2, 86, 68], + [4, 43, 27], + [4, 43, 19], + [4, 43, 15], + + // 7 + [2, 98, 78], + [4, 49, 31], + [2, 32, 14, 4, 33, 15], + [4, 39, 13, 1, 40, 14], + + // 8 + [2, 121, 97], + [2, 60, 38, 2, 61, 39], + [4, 40, 18, 2, 41, 19], + [4, 40, 14, 2, 41, 15], + + // 9 + [2, 146, 116], + [3, 58, 36, 2, 59, 37], + [4, 36, 16, 4, 37, 17], + [4, 36, 12, 4, 37, 13], + + // 10 + [2, 86, 68, 2, 87, 69], + [4, 69, 43, 1, 70, 44], + [6, 43, 19, 2, 44, 20], + [6, 43, 15, 2, 44, 16], + + // 11 + [4, 101, 81], + [1, 80, 50, 4, 81, 51], + [4, 50, 22, 4, 51, 23], + [3, 36, 12, 8, 37, 13], + + // 12 + [2, 116, 92, 2, 117, 93], + [6, 58, 36, 2, 59, 37], + [4, 46, 20, 6, 47, 21], + [7, 42, 14, 4, 43, 15], + + // 13 + [4, 133, 107], + [8, 59, 37, 1, 60, 38], + [8, 44, 20, 4, 45, 21], + [12, 33, 11, 4, 34, 12], + + // 14 + [3, 145, 115, 1, 146, 116], + [4, 64, 40, 5, 65, 41], + [11, 36, 16, 5, 37, 17], + [11, 36, 12, 5, 37, 13], + + // 15 + [5, 109, 87, 1, 110, 88], + [5, 65, 41, 5, 66, 42], + [5, 54, 24, 7, 55, 25], + [11, 36, 12], + + // 16 + [5, 122, 98, 1, 123, 99], + [7, 73, 45, 3, 74, 46], + [15, 43, 19, 2, 44, 20], + [3, 45, 15, 13, 46, 16], + + // 17 + [1, 135, 107, 5, 136, 108], + [10, 74, 46, 1, 75, 47], + [1, 50, 22, 15, 51, 23], + [2, 42, 14, 17, 43, 15], + + // 18 + [5, 150, 120, 1, 151, 121], + [9, 69, 43, 4, 70, 44], + [17, 50, 22, 1, 51, 23], + [2, 42, 14, 19, 43, 15], + + // 19 + [3, 141, 113, 4, 142, 114], + [3, 70, 44, 11, 71, 45], + [17, 47, 21, 4, 48, 22], + [9, 39, 13, 16, 40, 14], + + // 20 + [3, 135, 107, 5, 136, 108], + [3, 67, 41, 13, 68, 42], + [15, 54, 24, 5, 55, 25], + [15, 43, 15, 10, 44, 16], + + // 21 + [4, 144, 116, 4, 145, 117], + [17, 68, 42], + [17, 50, 22, 6, 51, 23], + [19, 46, 16, 6, 47, 17], + + // 22 + [2, 139, 111, 7, 140, 112], + [17, 74, 46], + [7, 54, 24, 16, 55, 25], + [34, 37, 13], + + // 23 + [4, 151, 121, 5, 152, 122], + [4, 75, 47, 14, 76, 48], + [11, 54, 24, 14, 55, 25], + [16, 45, 15, 14, 46, 16], + + // 24 + [6, 147, 117, 4, 148, 118], + [6, 73, 45, 14, 74, 46], + [11, 54, 24, 16, 55, 25], + [30, 46, 16, 2, 47, 17], + + // 25 + [8, 132, 106, 4, 133, 107], + [8, 75, 47, 13, 76, 48], + [7, 54, 24, 22, 55, 25], + [22, 45, 15, 13, 46, 16], + + // 26 + [10, 142, 114, 2, 143, 115], + [19, 74, 46, 4, 75, 47], + [28, 50, 22, 6, 51, 23], + [33, 46, 16, 4, 47, 17], + + // 27 + [8, 152, 122, 4, 153, 123], + [22, 73, 45, 3, 74, 46], + [8, 53, 23, 26, 54, 24], + [12, 45, 15, 28, 46, 16], + + // 28 + [3, 147, 117, 10, 148, 118], + [3, 73, 45, 23, 74, 46], + [4, 54, 24, 31, 55, 25], + [11, 45, 15, 31, 46, 16], + + // 29 + [7, 146, 116, 7, 147, 117], + [21, 73, 45, 7, 74, 46], + [1, 53, 23, 37, 54, 24], + [19, 45, 15, 26, 46, 16], + + // 30 + [5, 145, 115, 10, 146, 116], + [19, 75, 47, 10, 76, 48], + [15, 54, 24, 25, 55, 25], + [23, 45, 15, 25, 46, 16], + + // 31 + [13, 145, 115, 3, 146, 116], + [2, 74, 46, 29, 75, 47], + [42, 54, 24, 1, 55, 25], + [23, 45, 15, 28, 46, 16], + + // 32 + [17, 145, 115], + [10, 74, 46, 23, 75, 47], + [10, 54, 24, 35, 55, 25], + [19, 45, 15, 35, 46, 16], + + // 33 + [17, 145, 115, 1, 146, 116], + [14, 74, 46, 21, 75, 47], + [29, 54, 24, 19, 55, 25], + [11, 45, 15, 46, 46, 16], + + // 34 + [13, 145, 115, 6, 146, 116], + [14, 74, 46, 23, 75, 47], + [44, 54, 24, 7, 55, 25], + [59, 46, 16, 1, 47, 17], + + // 35 + [12, 151, 121, 7, 152, 122], + [12, 75, 47, 26, 76, 48], + [39, 54, 24, 14, 55, 25], + [22, 45, 15, 41, 46, 16], + + // 36 + [6, 151, 121, 14, 152, 122], + [6, 75, 47, 34, 76, 48], + [46, 54, 24, 10, 55, 25], + [2, 45, 15, 64, 46, 16], + + // 37 + [17, 152, 122, 4, 153, 123], + [29, 74, 46, 14, 75, 47], + [49, 54, 24, 10, 55, 25], + [24, 45, 15, 46, 46, 16], + + // 38 + [4, 152, 122, 18, 153, 123], + [13, 74, 46, 32, 75, 47], + [48, 54, 24, 14, 55, 25], + [42, 45, 15, 32, 46, 16], + + // 39 + [20, 147, 117, 4, 148, 118], + [40, 75, 47, 7, 76, 48], + [43, 54, 24, 22, 55, 25], + [10, 45, 15, 67, 46, 16], + + // 40 + [19, 148, 118, 6, 149, 119], + [18, 75, 47, 31, 76, 48], + [34, 54, 24, 34, 55, 25], + [20, 45, 15, 61, 46, 16] +]; + +QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) { + + var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); + + if (rsBlock === undefined) { + throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); + } + + var length = rsBlock.length / 3; + + var list = []; + + for (var i = 0; i < length; i++) { + + var count = rsBlock[i * 3 + 0]; + var totalCount = rsBlock[i * 3 + 1]; + var dataCount = rsBlock[i * 3 + 2]; + + for (var j = 0; j < count; j++) { + list.push(new QRRSBlock(totalCount, dataCount) ); + } + } + + return list; +}; + +QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) { + + switch(errorCorrectLevel) { + case QRErrorCorrectLevel.L : + return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; + case QRErrorCorrectLevel.M : + return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; + case QRErrorCorrectLevel.Q : + return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; + case QRErrorCorrectLevel.H : + return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; + default : + return undefined; + } +}; + +module.exports = QRRSBlock; diff --git a/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js new file mode 100644 index 00000000..e5b7d5b3 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js @@ -0,0 +1,272 @@ +var QRMode = require('./QRMode'); +var QRPolynomial = require('./QRPolynomial'); +var QRMath = require('./QRMath'); +var QRMaskPattern = require('./QRMaskPattern'); + +var QRUtil = { + + PATTERN_POSITION_TABLE : [ + [], + [6, 18], + [6, 22], + [6, 26], + [6, 30], + [6, 34], + [6, 22, 38], + [6, 24, 42], + [6, 26, 46], + [6, 28, 50], + [6, 30, 54], + [6, 32, 58], + [6, 34, 62], + [6, 26, 46, 66], + [6, 26, 48, 70], + [6, 26, 50, 74], + [6, 30, 54, 78], + [6, 30, 56, 82], + [6, 30, 58, 86], + [6, 34, 62, 90], + [6, 28, 50, 72, 94], + [6, 26, 50, 74, 98], + [6, 30, 54, 78, 102], + [6, 28, 54, 80, 106], + [6, 32, 58, 84, 110], + [6, 30, 58, 86, 114], + [6, 34, 62, 90, 118], + [6, 26, 50, 74, 98, 122], + [6, 30, 54, 78, 102, 126], + [6, 26, 52, 78, 104, 130], + [6, 30, 56, 82, 108, 134], + [6, 34, 60, 86, 112, 138], + [6, 30, 58, 86, 114, 142], + [6, 34, 62, 90, 118, 146], + [6, 30, 54, 78, 102, 126, 150], + [6, 24, 50, 76, 102, 128, 154], + [6, 28, 54, 80, 106, 132, 158], + [6, 32, 58, 84, 110, 136, 162], + [6, 26, 54, 82, 110, 138, 166], + [6, 30, 58, 86, 114, 142, 170] + ], + + G15 : (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), + G18 : (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), + G15_MASK : (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), + + getBCHTypeInfo : function(data) { + var d = data << 10; + while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { + d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) ) ); + } + return ( (data << 10) | d) ^ QRUtil.G15_MASK; + }, + + getBCHTypeNumber : function(data) { + var d = data << 12; + while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { + d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) ) ); + } + return (data << 12) | d; + }, + + getBCHDigit : function(data) { + + var digit = 0; + + while (data !== 0) { + digit++; + data >>>= 1; + } + + return digit; + }, + + getPatternPosition : function(typeNumber) { + return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; + }, + + getMask : function(maskPattern, i, j) { + + switch (maskPattern) { + + case QRMaskPattern.PATTERN000 : return (i + j) % 2 === 0; + case QRMaskPattern.PATTERN001 : return i % 2 === 0; + case QRMaskPattern.PATTERN010 : return j % 3 === 0; + case QRMaskPattern.PATTERN011 : return (i + j) % 3 === 0; + case QRMaskPattern.PATTERN100 : return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 === 0; + case QRMaskPattern.PATTERN101 : return (i * j) % 2 + (i * j) % 3 === 0; + case QRMaskPattern.PATTERN110 : return ( (i * j) % 2 + (i * j) % 3) % 2 === 0; + case QRMaskPattern.PATTERN111 : return ( (i * j) % 3 + (i + j) % 2) % 2 === 0; + + default : + throw new Error("bad maskPattern:" + maskPattern); + } + }, + + getErrorCorrectPolynomial : function(errorCorrectLength) { + + var a = new QRPolynomial([1], 0); + + for (var i = 0; i < errorCorrectLength; i++) { + a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0) ); + } + + return a; + }, + + getLengthInBits : function(mode, type) { + + if (1 <= type && type < 10) { + + // 1 - 9 + + switch(mode) { + case QRMode.MODE_NUMBER : return 10; + case QRMode.MODE_ALPHA_NUM : return 9; + case QRMode.MODE_8BIT_BYTE : return 8; + case QRMode.MODE_KANJI : return 8; + default : + throw new Error("mode:" + mode); + } + + } else if (type < 27) { + + // 10 - 26 + + switch(mode) { + case QRMode.MODE_NUMBER : return 12; + case QRMode.MODE_ALPHA_NUM : return 11; + case QRMode.MODE_8BIT_BYTE : return 16; + case QRMode.MODE_KANJI : return 10; + default : + throw new Error("mode:" + mode); + } + + } else if (type < 41) { + + // 27 - 40 + + switch(mode) { + case QRMode.MODE_NUMBER : return 14; + case QRMode.MODE_ALPHA_NUM : return 13; + case QRMode.MODE_8BIT_BYTE : return 16; + case QRMode.MODE_KANJI : return 12; + default : + throw new Error("mode:" + mode); + } + + } else { + throw new Error("type:" + type); + } + }, + + getLostPoint : function(qrCode) { + + var moduleCount = qrCode.getModuleCount(); + var lostPoint = 0; + var row = 0; + var col = 0; + + + // LEVEL1 + + for (row = 0; row < moduleCount; row++) { + + for (col = 0; col < moduleCount; col++) { + + var sameCount = 0; + var dark = qrCode.isDark(row, col); + + for (var r = -1; r <= 1; r++) { + + if (row + r < 0 || moduleCount <= row + r) { + continue; + } + + for (var c = -1; c <= 1; c++) { + + if (col + c < 0 || moduleCount <= col + c) { + continue; + } + + if (r === 0 && c === 0) { + continue; + } + + if (dark === qrCode.isDark(row + r, col + c) ) { + sameCount++; + } + } + } + + if (sameCount > 5) { + lostPoint += (3 + sameCount - 5); + } + } + } + + // LEVEL2 + + for (row = 0; row < moduleCount - 1; row++) { + for (col = 0; col < moduleCount - 1; col++) { + var count = 0; + if (qrCode.isDark(row, col ) ) count++; + if (qrCode.isDark(row + 1, col ) ) count++; + if (qrCode.isDark(row, col + 1) ) count++; + if (qrCode.isDark(row + 1, col + 1) ) count++; + if (count === 0 || count === 4) { + lostPoint += 3; + } + } + } + + // LEVEL3 + + for (row = 0; row < moduleCount; row++) { + for (col = 0; col < moduleCount - 6; col++) { + if (qrCode.isDark(row, col) && + !qrCode.isDark(row, col + 1) && + qrCode.isDark(row, col + 2) && + qrCode.isDark(row, col + 3) && + qrCode.isDark(row, col + 4) && + !qrCode.isDark(row, col + 5) && + qrCode.isDark(row, col + 6) ) { + lostPoint += 40; + } + } + } + + for (col = 0; col < moduleCount; col++) { + for (row = 0; row < moduleCount - 6; row++) { + if (qrCode.isDark(row, col) && + !qrCode.isDark(row + 1, col) && + qrCode.isDark(row + 2, col) && + qrCode.isDark(row + 3, col) && + qrCode.isDark(row + 4, col) && + !qrCode.isDark(row + 5, col) && + qrCode.isDark(row + 6, col) ) { + lostPoint += 40; + } + } + } + + // LEVEL4 + + var darkCount = 0; + + for (col = 0; col < moduleCount; col++) { + for (row = 0; row < moduleCount; row++) { + if (qrCode.isDark(row, col) ) { + darkCount++; + } + } + } + + var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; + lostPoint += ratio * 10; + + return lostPoint; + } + +}; + +module.exports = QRUtil; diff --git a/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/index.js b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/index.js new file mode 100644 index 00000000..10eb8eb0 --- /dev/null +++ b/node_modules/npm/node_modules/qrcode-terminal/vendor/QRCode/index.js @@ -0,0 +1,462 @@ +//--------------------------------------------------------------------- +// QRCode for JavaScript +// +// Copyright (c) 2009 Kazuhiko Arase +// +// URL: http://www.d-project.com/ +// +// Licensed under the MIT license: +// http://www.opensource.org/licenses/mit-license.php +// +// The word "QR Code" is registered trademark of +// DENSO WAVE INCORPORATED +// http://www.denso-wave.com/qrcode/faqpatent-e.html +// +//--------------------------------------------------------------------- +// Modified to work in node for this project (and some refactoring) +//--------------------------------------------------------------------- + +var QR8bitByte = require('./QR8bitByte'); +var QRUtil = require('./QRUtil'); +var QRPolynomial = require('./QRPolynomial'); +var QRRSBlock = require('./QRRSBlock'); +var QRBitBuffer = require('./QRBitBuffer'); + +function QRCode(typeNumber, errorCorrectLevel) { + this.typeNumber = typeNumber; + this.errorCorrectLevel = errorCorrectLevel; + this.modules = null; + this.moduleCount = 0; + this.dataCache = null; + this.dataList = []; +} + +QRCode.prototype = { + + addData : function(data) { + var newData = new QR8bitByte(data); + this.dataList.push(newData); + this.dataCache = null; + }, + + isDark : function(row, col) { + if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { + throw new Error(row + "," + col); + } + return this.modules[row][col]; + }, + + getModuleCount : function() { + return this.moduleCount; + }, + + make : function() { + // Calculate automatically typeNumber if provided is < 1 + if (this.typeNumber < 1 ){ + var typeNumber = 1; + for (typeNumber = 1; typeNumber < 40; typeNumber++) { + var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel); + + var buffer = new QRBitBuffer(); + var totalDataCount = 0; + for (var i = 0; i < rsBlocks.length; i++) { + totalDataCount += rsBlocks[i].dataCount; + } + + for (var x = 0; x < this.dataList.length; x++) { + var data = this.dataList[x]; + buffer.put(data.mode, 4); + buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) ); + data.write(buffer); + } + if (buffer.getLengthInBits() <= totalDataCount * 8) + break; + } + this.typeNumber = typeNumber; + } + this.makeImpl(false, this.getBestMaskPattern() ); + }, + + makeImpl : function(test, maskPattern) { + + this.moduleCount = this.typeNumber * 4 + 17; + this.modules = new Array(this.moduleCount); + + for (var row = 0; row < this.moduleCount; row++) { + + this.modules[row] = new Array(this.moduleCount); + + for (var col = 0; col < this.moduleCount; col++) { + this.modules[row][col] = null;//(col + row) % 3; + } + } + + this.setupPositionProbePattern(0, 0); + this.setupPositionProbePattern(this.moduleCount - 7, 0); + this.setupPositionProbePattern(0, this.moduleCount - 7); + this.setupPositionAdjustPattern(); + this.setupTimingPattern(); + this.setupTypeInfo(test, maskPattern); + + if (this.typeNumber >= 7) { + this.setupTypeNumber(test); + } + + if (this.dataCache === null) { + this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); + } + + this.mapData(this.dataCache, maskPattern); + }, + + setupPositionProbePattern : function(row, col) { + + for (var r = -1; r <= 7; r++) { + + if (row + r <= -1 || this.moduleCount <= row + r) continue; + + for (var c = -1; c <= 7; c++) { + + if (col + c <= -1 || this.moduleCount <= col + c) continue; + + if ( (0 <= r && r <= 6 && (c === 0 || c === 6) ) || + (0 <= c && c <= 6 && (r === 0 || r === 6) ) || + (2 <= r && r <= 4 && 2 <= c && c <= 4) ) { + this.modules[row + r][col + c] = true; + } else { + this.modules[row + r][col + c] = false; + } + } + } + }, + + getBestMaskPattern : function() { + + var minLostPoint = 0; + var pattern = 0; + + for (var i = 0; i < 8; i++) { + + this.makeImpl(true, i); + + var lostPoint = QRUtil.getLostPoint(this); + + if (i === 0 || minLostPoint > lostPoint) { + minLostPoint = lostPoint; + pattern = i; + } + } + + return pattern; + }, + + createMovieClip : function(target_mc, instance_name, depth) { + + var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); + var cs = 1; + + this.make(); + + for (var row = 0; row < this.modules.length; row++) { + + var y = row * cs; + + for (var col = 0; col < this.modules[row].length; col++) { + + var x = col * cs; + var dark = this.modules[row][col]; + + if (dark) { + qr_mc.beginFill(0, 100); + qr_mc.moveTo(x, y); + qr_mc.lineTo(x + cs, y); + qr_mc.lineTo(x + cs, y + cs); + qr_mc.lineTo(x, y + cs); + qr_mc.endFill(); + } + } + } + + return qr_mc; + }, + + setupTimingPattern : function() { + + for (var r = 8; r < this.moduleCount - 8; r++) { + if (this.modules[r][6] !== null) { + continue; + } + this.modules[r][6] = (r % 2 === 0); + } + + for (var c = 8; c < this.moduleCount - 8; c++) { + if (this.modules[6][c] !== null) { + continue; + } + this.modules[6][c] = (c % 2 === 0); + } + }, + + setupPositionAdjustPattern : function() { + + var pos = QRUtil.getPatternPosition(this.typeNumber); + + for (var i = 0; i < pos.length; i++) { + + for (var j = 0; j < pos.length; j++) { + + var row = pos[i]; + var col = pos[j]; + + if (this.modules[row][col] !== null) { + continue; + } + + for (var r = -2; r <= 2; r++) { + + for (var c = -2; c <= 2; c++) { + + if (Math.abs(r) === 2 || + Math.abs(c) === 2 || + (r === 0 && c === 0) ) { + this.modules[row + r][col + c] = true; + } else { + this.modules[row + r][col + c] = false; + } + } + } + } + } + }, + + setupTypeNumber : function(test) { + + var bits = QRUtil.getBCHTypeNumber(this.typeNumber); + var mod; + + for (var i = 0; i < 18; i++) { + mod = (!test && ( (bits >> i) & 1) === 1); + this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; + } + + for (var x = 0; x < 18; x++) { + mod = (!test && ( (bits >> x) & 1) === 1); + this.modules[x % 3 + this.moduleCount - 8 - 3][Math.floor(x / 3)] = mod; + } + }, + + setupTypeInfo : function(test, maskPattern) { + + var data = (this.errorCorrectLevel << 3) | maskPattern; + var bits = QRUtil.getBCHTypeInfo(data); + var mod; + + // vertical + for (var v = 0; v < 15; v++) { + + mod = (!test && ( (bits >> v) & 1) === 1); + + if (v < 6) { + this.modules[v][8] = mod; + } else if (v < 8) { + this.modules[v + 1][8] = mod; + } else { + this.modules[this.moduleCount - 15 + v][8] = mod; + } + } + + // horizontal + for (var h = 0; h < 15; h++) { + + mod = (!test && ( (bits >> h) & 1) === 1); + + if (h < 8) { + this.modules[8][this.moduleCount - h - 1] = mod; + } else if (h < 9) { + this.modules[8][15 - h - 1 + 1] = mod; + } else { + this.modules[8][15 - h - 1] = mod; + } + } + + // fixed module + this.modules[this.moduleCount - 8][8] = (!test); + + }, + + mapData : function(data, maskPattern) { + + var inc = -1; + var row = this.moduleCount - 1; + var bitIndex = 7; + var byteIndex = 0; + + for (var col = this.moduleCount - 1; col > 0; col -= 2) { + + if (col === 6) col--; + + while (true) { + + for (var c = 0; c < 2; c++) { + + if (this.modules[row][col - c] === null) { + + var dark = false; + + if (byteIndex < data.length) { + dark = ( ( (data[byteIndex] >>> bitIndex) & 1) === 1); + } + + var mask = QRUtil.getMask(maskPattern, row, col - c); + + if (mask) { + dark = !dark; + } + + this.modules[row][col - c] = dark; + bitIndex--; + + if (bitIndex === -1) { + byteIndex++; + bitIndex = 7; + } + } + } + + row += inc; + + if (row < 0 || this.moduleCount <= row) { + row -= inc; + inc = -inc; + break; + } + } + } + + } + +}; + +QRCode.PAD0 = 0xEC; +QRCode.PAD1 = 0x11; + +QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) { + + var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); + + var buffer = new QRBitBuffer(); + + for (var i = 0; i < dataList.length; i++) { + var data = dataList[i]; + buffer.put(data.mode, 4); + buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber) ); + data.write(buffer); + } + + // calc num max data. + var totalDataCount = 0; + for (var x = 0; x < rsBlocks.length; x++) { + totalDataCount += rsBlocks[x].dataCount; + } + + if (buffer.getLengthInBits() > totalDataCount * 8) { + throw new Error("code length overflow. (" + + buffer.getLengthInBits() + + ">" + + totalDataCount * 8 + + ")"); + } + + // end code + if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { + buffer.put(0, 4); + } + + // padding + while (buffer.getLengthInBits() % 8 !== 0) { + buffer.putBit(false); + } + + // padding + while (true) { + + if (buffer.getLengthInBits() >= totalDataCount * 8) { + break; + } + buffer.put(QRCode.PAD0, 8); + + if (buffer.getLengthInBits() >= totalDataCount * 8) { + break; + } + buffer.put(QRCode.PAD1, 8); + } + + return QRCode.createBytes(buffer, rsBlocks); +}; + +QRCode.createBytes = function(buffer, rsBlocks) { + + var offset = 0; + + var maxDcCount = 0; + var maxEcCount = 0; + + var dcdata = new Array(rsBlocks.length); + var ecdata = new Array(rsBlocks.length); + + for (var r = 0; r < rsBlocks.length; r++) { + + var dcCount = rsBlocks[r].dataCount; + var ecCount = rsBlocks[r].totalCount - dcCount; + + maxDcCount = Math.max(maxDcCount, dcCount); + maxEcCount = Math.max(maxEcCount, ecCount); + + dcdata[r] = new Array(dcCount); + + for (var i = 0; i < dcdata[r].length; i++) { + dcdata[r][i] = 0xff & buffer.buffer[i + offset]; + } + offset += dcCount; + + var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); + var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); + + var modPoly = rawPoly.mod(rsPoly); + ecdata[r] = new Array(rsPoly.getLength() - 1); + for (var x = 0; x < ecdata[r].length; x++) { + var modIndex = x + modPoly.getLength() - ecdata[r].length; + ecdata[r][x] = (modIndex >= 0)? modPoly.get(modIndex) : 0; + } + + } + + var totalCodeCount = 0; + for (var y = 0; y < rsBlocks.length; y++) { + totalCodeCount += rsBlocks[y].totalCount; + } + + var data = new Array(totalCodeCount); + var index = 0; + + for (var z = 0; z < maxDcCount; z++) { + for (var s = 0; s < rsBlocks.length; s++) { + if (z < dcdata[s].length) { + data[index++] = dcdata[s][z]; + } + } + } + + for (var xx = 0; xx < maxEcCount; xx++) { + for (var t = 0; t < rsBlocks.length; t++) { + if (xx < ecdata[t].length) { + data[index++] = ecdata[t][xx]; + } + } + } + + return data; + +}; + +module.exports = QRCode; diff --git a/node_modules/npm/node_modules/read-cmd-shim/LICENSE b/node_modules/npm/node_modules/read-cmd-shim/LICENSE new file mode 100644 index 00000000..f4be44d8 --- /dev/null +++ b/node_modules/npm/node_modules/read-cmd-shim/LICENSE @@ -0,0 +1,14 @@ +Copyright (c) 2015, Rebecca Turner + +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/npm/node_modules/read-cmd-shim/lib/index.js b/node_modules/npm/node_modules/read-cmd-shim/lib/index.js new file mode 100644 index 00000000..dafc8744 --- /dev/null +++ b/node_modules/npm/node_modules/read-cmd-shim/lib/index.js @@ -0,0 +1,75 @@ +const fs = require('fs') +const { promisify } = require('util') +const { readFileSync } = fs +const readFile = promisify(fs.readFile) + +const extractPath = (path, cmdshimContents) => { + if (/[.]cmd$/.test(path)) { + return extractPathFromCmd(cmdshimContents) + } else if (/[.]ps1$/.test(path)) { + return extractPathFromPowershell(cmdshimContents) + } else { + return extractPathFromCygwin(cmdshimContents) + } +} + +const extractPathFromPowershell = cmdshimContents => { + const matches = cmdshimContents.match(/"[$]basedir[/]([^"]+?)"\s+[$]args/) + return matches && matches[1] +} + +const extractPathFromCmd = cmdshimContents => { + const matches = cmdshimContents.match(/"%(?:~dp0|dp0%)\\([^"]+?)"\s+%[*]/) + return matches && matches[1] +} + +const extractPathFromCygwin = cmdshimContents => { + const matches = cmdshimContents.match(/"[$]basedir[/]([^"]+?)"\s+"[$]@"/) + return matches && matches[1] +} + +const wrapError = (thrown, newError) => { + newError.message = thrown.message + newError.code = thrown.code + newError.path = thrown.path + return newError +} + +const notaShim = (path, er) => { + if (!er) { + er = new Error() + Error.captureStackTrace(er, notaShim) + } + er.code = 'ENOTASHIM' + er.message = `Can't read shim path from '${path}', ` + + `it doesn't appear to be a cmd-shim` + return er +} + +const readCmdShim = path => { + // create a new error to capture the stack trace from this point, + // instead of getting some opaque stack into node's internals + const er = new Error() + Error.captureStackTrace(er, readCmdShim) + return readFile(path).then(contents => { + const destination = extractPath(path, contents.toString()) + if (destination) { + return destination + } + throw notaShim(path, er) + }, readFileEr => { + throw wrapError(readFileEr, er) + }) +} + +const readCmdShimSync = path => { + const contents = readFileSync(path) + const destination = extractPath(path, contents.toString()) + if (!destination) { + throw notaShim(path) + } + return destination +} + +readCmdShim.sync = readCmdShimSync +module.exports = readCmdShim diff --git a/node_modules/npm/node_modules/read-cmd-shim/package.json b/node_modules/npm/node_modules/read-cmd-shim/package.json new file mode 100644 index 00000000..3b16802d --- /dev/null +++ b/node_modules/npm/node_modules/read-cmd-shim/package.json @@ -0,0 +1,48 @@ +{ + "name": "read-cmd-shim", + "version": "5.0.0", + "description": "Figure out what a cmd-shim is pointing at. This acts as the equivalent of fs.readlink.", + "main": "lib/index.js", + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "cmd-shim": "^7.0.0", + "tap": "^16.0.1" + }, + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "tap": { + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/read-cmd-shim.git" + }, + "license": "ISC", + "homepage": "https://github.com/npm/read-cmd-shim#readme", + "files": [ + "bin/", + "lib/" + ], + "author": "GitHub Inc.", + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + } +} diff --git a/node_modules/npm/node_modules/read-package-json-fast/LICENSE b/node_modules/npm/node_modules/read-package-json-fast/LICENSE new file mode 100644 index 00000000..20a47625 --- /dev/null +++ b/node_modules/npm/node_modules/read-package-json-fast/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/npm/node_modules/read-package-json-fast/lib/index.js b/node_modules/npm/node_modules/read-package-json-fast/lib/index.js new file mode 100644 index 00000000..beb089db --- /dev/null +++ b/node_modules/npm/node_modules/read-package-json-fast/lib/index.js @@ -0,0 +1,141 @@ +const { readFile, lstat, readdir } = require('fs/promises') +const parse = require('json-parse-even-better-errors') +const normalizePackageBin = require('npm-normalize-package-bin') +const { resolve, dirname, join, relative } = require('path') + +const rpj = path => readFile(path, 'utf8') + .then(data => readBinDir(path, normalize(stripUnderscores(parse(data))))) + .catch(er => { + er.path = path + throw er + }) + +// load the directories.bin folder as a 'bin' object +const readBinDir = async (path, data) => { + if (data.bin) { + return data + } + + const m = data.directories && data.directories.bin + if (!m || typeof m !== 'string') { + return data + } + + // cut off any monkey business, like setting directories.bin + // to ../../../etc/passwd or /etc/passwd or something like that. + const root = dirname(path) + const dir = join('.', join('/', m)) + data.bin = await walkBinDir(root, dir, {}) + return data +} + +const walkBinDir = async (root, dir, obj) => { + const entries = await readdir(resolve(root, dir)).catch(() => []) + for (const entry of entries) { + if (entry.charAt(0) === '.') { + continue + } + const f = resolve(root, dir, entry) + // ignore stat errors, weird file types, symlinks, etc. + const st = await lstat(f).catch(() => null) + if (!st) { + continue + } else if (st.isFile()) { + obj[entry] = relative(root, f) + } else if (st.isDirectory()) { + await walkBinDir(root, join(dir, entry), obj) + } + } + return obj +} + +// do not preserve _fields set in files, they are sus +const stripUnderscores = data => { + for (const key of Object.keys(data).filter(k => /^_/.test(k))) { + delete data[key] + } + return data +} + +const normalize = data => { + addId(data) + fixBundled(data) + pruneRepeatedOptionals(data) + fixScripts(data) + fixFunding(data) + normalizePackageBin(data) + return data +} + +rpj.normalize = normalize + +const addId = data => { + if (data.name && data.version) { + data._id = `${data.name}@${data.version}` + } + return data +} + +// it was once common practice to list deps both in optionalDependencies +// and in dependencies, to support npm versions that did not know abbout +// optionalDependencies. This is no longer a relevant need, so duplicating +// the deps in two places is unnecessary and excessive. +const pruneRepeatedOptionals = data => { + const od = data.optionalDependencies + const dd = data.dependencies || {} + if (od && typeof od === 'object') { + for (const name of Object.keys(od)) { + delete dd[name] + } + } + if (Object.keys(dd).length === 0) { + delete data.dependencies + } + return data +} + +const fixBundled = data => { + const bdd = data.bundledDependencies + const bd = data.bundleDependencies === undefined ? bdd + : data.bundleDependencies + + if (bd === false) { + data.bundleDependencies = [] + } else if (bd === true) { + data.bundleDependencies = Object.keys(data.dependencies || {}) + } else if (bd && typeof bd === 'object') { + if (!Array.isArray(bd)) { + data.bundleDependencies = Object.keys(bd) + } else { + data.bundleDependencies = bd + } + } else { + delete data.bundleDependencies + } + + delete data.bundledDependencies + return data +} + +const fixScripts = data => { + if (!data.scripts || typeof data.scripts !== 'object') { + delete data.scripts + return data + } + + for (const [name, script] of Object.entries(data.scripts)) { + if (typeof script !== 'string') { + delete data.scripts[name] + } + } + return data +} + +const fixFunding = data => { + if (data.funding && typeof data.funding === 'string') { + data.funding = { url: data.funding } + } + return data +} + +module.exports = rpj diff --git a/node_modules/npm/node_modules/read-package-json-fast/package.json b/node_modules/npm/node_modules/read-package-json-fast/package.json new file mode 100644 index 00000000..20208329 --- /dev/null +++ b/node_modules/npm/node_modules/read-package-json-fast/package.json @@ -0,0 +1,49 @@ +{ + "name": "read-package-json-fast", + "version": "4.0.0", + "description": "Like read-package-json, but faster", + "main": "lib/index.js", + "author": "GitHub Inc.", + "license": "ISC", + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.3.0" + }, + "dependencies": { + "json-parse-even-better-errors": "^4.0.0", + "npm-normalize-package-bin": "^4.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/read-package-json-fast.git" + }, + "files": [ + "bin/", + "lib/" + ], + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/read/LICENSE b/node_modules/npm/node_modules/read/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/read/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/read/dist/commonjs/package.json b/node_modules/npm/node_modules/read/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/read/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/read/dist/commonjs/read.js b/node_modules/npm/node_modules/read/dist/commonjs/read.js new file mode 100644 index 00000000..c0600d2b --- /dev/null +++ b/node_modules/npm/node_modules/read/dist/commonjs/read.js @@ -0,0 +1,94 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.read = read; +const mute_stream_1 = __importDefault(require("mute-stream")); +const readline_1 = require("readline"); +async function read({ default: def, input = process.stdin, output = process.stdout, completer, prompt = '', silent, timeout, edit, terminal, replace, }) { + if (typeof def !== 'undefined' && + typeof def !== 'string' && + typeof def !== 'number') { + throw new Error('default value must be string or number'); + } + let editDef = false; + const defString = def?.toString(); + prompt = prompt.trim() + ' '; + terminal = !!(terminal || output.isTTY); + if (defString) { + if (silent) { + prompt += '( +## Overview + +- [Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x.](#variant-1) (*recommended*) +- [Variant 2: Use a polyfill](#variant-2) +- [Variant 3: manual detection, with safeguards](#variant-3) + +### Finding problematic bits of code using grep + +Just run `grep -nrE '[^a-zA-Z](Slow)?Buffer\s*\(' --exclude-dir node_modules`. + +It will find all the potentially unsafe places in your own code (with some considerably unlikely +exceptions). + +### Finding problematic bits of code using Node.js 8 + +If you’re using Node.js ≥ 8.0.0 (which is recommended), Node.js exposes multiple options that help with finding the relevant pieces of code: + +- `--trace-warnings` will make Node.js show a stack trace for this warning and other warnings that are printed by Node.js. +- `--trace-deprecation` does the same thing, but only for deprecation warnings. +- `--pending-deprecation` will show more types of deprecation warnings. In particular, it will show the `Buffer()` deprecation warning, even on Node.js 8. + +You can set these flags using an environment variable: + +```console +$ export NODE_OPTIONS='--trace-warnings --pending-deprecation' +$ cat example.js +'use strict'; +const foo = new Buffer('foo'); +$ node example.js +(node:7147) [DEP0005] DeprecationWarning: The Buffer() and new Buffer() constructors are not recommended for use due to security and usability concerns. Please use the new Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() construction methods instead. + at showFlaggedDeprecation (buffer.js:127:13) + at new Buffer (buffer.js:148:3) + at Object. (/path/to/example.js:2:13) + [... more stack trace lines ...] +``` + +### Finding problematic bits of code using linters + +Eslint rules [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) +or +[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) +also find calls to deprecated `Buffer()` API. Those rules are included in some pre-sets. + +There is a drawback, though, that it doesn't always +[work correctly](https://github.com/chalker/safer-buffer#why-not-safe-buffer) when `Buffer` is +overriden e.g. with a polyfill, so recommended is a combination of this and some other method +described above. + + +## Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x. + +This is the recommended solution nowadays that would imply only minimal overhead. + +The Node.js 5.x release line has been unsupported since July 2016, and the Node.js 4.x release line reaches its End of Life in April 2018 (→ [Schedule](https://github.com/nodejs/Release#release-schedule)). This means that these versions of Node.js will *not* receive any updates, even in case of security issues, so using these release lines should be avoided, if at all possible. + +What you would do in this case is to convert all `new Buffer()` or `Buffer()` calls to use `Buffer.alloc()` or `Buffer.from()`, in the following way: + +- For `new Buffer(number)`, replace it with `Buffer.alloc(number)`. +- For `new Buffer(string)` (or `new Buffer(string, encoding)`), replace it with `Buffer.from(string)` (or `Buffer.from(string, encoding)`). +- For all other combinations of arguments (these are much rarer), also replace `new Buffer(...arguments)` with `Buffer.from(...arguments)`. + +Note that `Buffer.alloc()` is also _faster_ on the current Node.js versions than +`new Buffer(size).fill(0)`, which is what you would otherwise need to ensure zero-filling. + +Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) +or +[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) +is recommended to avoid accidential unsafe Buffer API usage. + +There is also a [JSCodeshift codemod](https://github.com/joyeecheung/node-dep-codemod#dep005) +for automatically migrating Buffer constructors to `Buffer.alloc()` or `Buffer.from()`. +Note that it currently only works with cases where the arguments are literals or where the +constructor is invoked with two arguments. + +_If you currently support those older Node.js versions and dropping them would be a semver-major change +for you, or if you support older branches of your packages, consider using [Variant 2](#variant-2) +or [Variant 3](#variant-3) on older branches, so people using those older branches will also receive +the fix. That way, you will eradicate potential issues caused by unguarded Buffer API usage and +your users will not observe a runtime deprecation warning when running your code on Node.js 10._ + + +## Variant 2: Use a polyfill + +Utilize [safer-buffer](https://www.npmjs.com/package/safer-buffer) as a polyfill to support older +Node.js versions. + +You would take exacly the same steps as in [Variant 1](#variant-1), but with a polyfill +`const Buffer = require('safer-buffer').Buffer` in all files where you use the new `Buffer` api. + +Make sure that you do not use old `new Buffer` API — in any files where the line above is added, +using old `new Buffer()` API will _throw_. It will be easy to notice that in CI, though. + +Alternatively, you could use [buffer-from](https://www.npmjs.com/package/buffer-from) and/or +[buffer-alloc](https://www.npmjs.com/package/buffer-alloc) [ponyfills](https://ponyfill.com/) — +those are great, the only downsides being 4 deps in the tree and slightly more code changes to +migrate off them (as you would be using e.g. `Buffer.from` under a different name). If you need only +`Buffer.from` polyfilled — `buffer-from` alone which comes with no extra dependencies. + +_Alternatively, you could use [safe-buffer](https://www.npmjs.com/package/safe-buffer) — it also +provides a polyfill, but takes a different approach which has +[it's drawbacks](https://github.com/chalker/safer-buffer#why-not-safe-buffer). It will allow you +to also use the older `new Buffer()` API in your code, though — but that's arguably a benefit, as +it is problematic, can cause issues in your code, and will start emitting runtime deprecation +warnings starting with Node.js 10._ + +Note that in either case, it is important that you also remove all calls to the old Buffer +API manually — just throwing in `safe-buffer` doesn't fix the problem by itself, it just provides +a polyfill for the new API. I have seen people doing that mistake. + +Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) +or +[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) +is recommended. + +_Don't forget to drop the polyfill usage once you drop support for Node.js < 4.5.0._ + + +## Variant 3 — manual detection, with safeguards + +This is useful if you create Buffer instances in only a few places (e.g. one), or you have your own +wrapper around them. + +### Buffer(0) + +This special case for creating empty buffers can be safely replaced with `Buffer.concat([])`, which +returns the same result all the way down to Node.js 0.8.x. + +### Buffer(notNumber) + +Before: + +```js +var buf = new Buffer(notNumber, encoding); +``` + +After: + +```js +var buf; +if (Buffer.from && Buffer.from !== Uint8Array.from) { + buf = Buffer.from(notNumber, encoding); +} else { + if (typeof notNumber === 'number') + throw new Error('The "size" argument must be of type number.'); + buf = new Buffer(notNumber, encoding); +} +``` + +`encoding` is optional. + +Note that the `typeof notNumber` before `new Buffer` is required (for cases when `notNumber` argument is not +hard-coded) and _is not caused by the deprecation of Buffer constructor_ — it's exactly _why_ the +Buffer constructor is deprecated. Ecosystem packages lacking this type-check caused numereous +security issues — situations when unsanitized user input could end up in the `Buffer(arg)` create +problems ranging from DoS to leaking sensitive information to the attacker from the process memory. + +When `notNumber` argument is hardcoded (e.g. literal `"abc"` or `[0,1,2]`), the `typeof` check can +be omitted. + +Also note that using TypeScript does not fix this problem for you — when libs written in +`TypeScript` are used from JS, or when user input ends up there — it behaves exactly as pure JS, as +all type checks are translation-time only and are not present in the actual JS code which TS +compiles to. + +### Buffer(number) + +For Node.js 0.10.x (and below) support: + +```js +var buf; +if (Buffer.alloc) { + buf = Buffer.alloc(number); +} else { + buf = new Buffer(number); + buf.fill(0); +} +``` + +Otherwise (Node.js ≥ 0.12.x): + +```js +const buf = Buffer.alloc ? Buffer.alloc(number) : new Buffer(number).fill(0); +``` + +## Regarding Buffer.allocUnsafe + +Be extra cautious when using `Buffer.allocUnsafe`: + * Don't use it if you don't have a good reason to + * e.g. you probably won't ever see a performance difference for small buffers, in fact, those + might be even faster with `Buffer.alloc()`, + * if your code is not in the hot code path — you also probably won't notice a difference, + * keep in mind that zero-filling minimizes the potential risks. + * If you use it, make sure that you never return the buffer in a partially-filled state, + * if you are writing to it sequentially — always truncate it to the actuall written length + +Errors in handling buffers allocated with `Buffer.allocUnsafe` could result in various issues, +ranged from undefined behaviour of your code to sensitive data (user input, passwords, certs) +leaking to the remote attacker. + +_Note that the same applies to `new Buffer` usage without zero-filling, depending on the Node.js +version (and lacking type checks also adds DoS to the list of potential problems)._ + + +## FAQ + + +### What is wrong with the `Buffer` constructor? + +The `Buffer` constructor could be used to create a buffer in many different ways: + +- `new Buffer(42)` creates a `Buffer` of 42 bytes. Before Node.js 8, this buffer contained + *arbitrary memory* for performance reasons, which could include anything ranging from + program source code to passwords and encryption keys. +- `new Buffer('abc')` creates a `Buffer` that contains the UTF-8-encoded version of + the string `'abc'`. A second argument could specify another encoding: For example, + `new Buffer(string, 'base64')` could be used to convert a Base64 string into the original + sequence of bytes that it represents. +- There are several other combinations of arguments. + +This meant that, in code like `var buffer = new Buffer(foo);`, *it is not possible to tell +what exactly the contents of the generated buffer are* without knowing the type of `foo`. + +Sometimes, the value of `foo` comes from an external source. For example, this function +could be exposed as a service on a web server, converting a UTF-8 string into its Base64 form: + +``` +function stringToBase64(req, res) { + // The request body should have the format of `{ string: 'foobar' }` + const rawBytes = new Buffer(req.body.string) + const encoded = rawBytes.toString('base64') + res.end({ encoded: encoded }) +} +``` + +Note that this code does *not* validate the type of `req.body.string`: + +- `req.body.string` is expected to be a string. If this is the case, all goes well. +- `req.body.string` is controlled by the client that sends the request. +- If `req.body.string` is the *number* `50`, the `rawBytes` would be 50 bytes: + - Before Node.js 8, the content would be uninitialized + - After Node.js 8, the content would be `50` bytes with the value `0` + +Because of the missing type check, an attacker could intentionally send a number +as part of the request. Using this, they can either: + +- Read uninitialized memory. This **will** leak passwords, encryption keys and other + kinds of sensitive information. (Information leak) +- Force the program to allocate a large amount of memory. For example, when specifying + `500000000` as the input value, each request will allocate 500MB of memory. + This can be used to either exhaust the memory available of a program completely + and make it crash, or slow it down significantly. (Denial of Service) + +Both of these scenarios are considered serious security issues in a real-world +web server context. + +when using `Buffer.from(req.body.string)` instead, passing a number will always +throw an exception instead, giving a controlled behaviour that can always be +handled by the program. + + +### The `Buffer()` constructor has been deprecated for a while. Is this really an issue? + +Surveys of code in the `npm` ecosystem have shown that the `Buffer()` constructor is still +widely used. This includes new code, and overall usage of such code has actually been +*increasing*. diff --git a/node_modules/npm/node_modules/safer-buffer/dangerous.js b/node_modules/npm/node_modules/safer-buffer/dangerous.js new file mode 100644 index 00000000..ca41fdc5 --- /dev/null +++ b/node_modules/npm/node_modules/safer-buffer/dangerous.js @@ -0,0 +1,58 @@ +/* eslint-disable node/no-deprecated-api */ + +'use strict' + +var buffer = require('buffer') +var Buffer = buffer.Buffer +var safer = require('./safer.js') +var Safer = safer.Buffer + +var dangerous = {} + +var key + +for (key in safer) { + if (!safer.hasOwnProperty(key)) continue + dangerous[key] = safer[key] +} + +var Dangereous = dangerous.Buffer = {} + +// Copy Safer API +for (key in Safer) { + if (!Safer.hasOwnProperty(key)) continue + Dangereous[key] = Safer[key] +} + +// Copy those missing unsafe methods, if they are present +for (key in Buffer) { + if (!Buffer.hasOwnProperty(key)) continue + if (Dangereous.hasOwnProperty(key)) continue + Dangereous[key] = Buffer[key] +} + +if (!Dangereous.allocUnsafe) { + Dangereous.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + return Buffer(size) + } +} + +if (!Dangereous.allocUnsafeSlow) { + Dangereous.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + return buffer.SlowBuffer(size) + } +} + +module.exports = dangerous diff --git a/node_modules/npm/node_modules/safer-buffer/package.json b/node_modules/npm/node_modules/safer-buffer/package.json new file mode 100644 index 00000000..d452b04a --- /dev/null +++ b/node_modules/npm/node_modules/safer-buffer/package.json @@ -0,0 +1,34 @@ +{ + "name": "safer-buffer", + "version": "2.1.2", + "description": "Modern Buffer API polyfill without footguns", + "main": "safer.js", + "scripts": { + "browserify-test": "browserify --external tape tests.js > browserify-tests.js && tape browserify-tests.js", + "test": "standard && tape tests.js" + }, + "author": { + "name": "Nikita Skovoroda", + "email": "chalkerx@gmail.com", + "url": "https://github.com/ChALkeR" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ChALkeR/safer-buffer.git" + }, + "bugs": { + "url": "https://github.com/ChALkeR/safer-buffer/issues" + }, + "devDependencies": { + "standard": "^11.0.1", + "tape": "^4.9.0" + }, + "files": [ + "Porting-Buffer.md", + "Readme.md", + "tests.js", + "dangerous.js", + "safer.js" + ] +} diff --git a/node_modules/npm/node_modules/safer-buffer/safer.js b/node_modules/npm/node_modules/safer-buffer/safer.js new file mode 100644 index 00000000..37c7e1aa --- /dev/null +++ b/node_modules/npm/node_modules/safer-buffer/safer.js @@ -0,0 +1,77 @@ +/* eslint-disable node/no-deprecated-api */ + +'use strict' + +var buffer = require('buffer') +var Buffer = buffer.Buffer + +var safer = {} + +var key + +for (key in buffer) { + if (!buffer.hasOwnProperty(key)) continue + if (key === 'SlowBuffer' || key === 'Buffer') continue + safer[key] = buffer[key] +} + +var Safer = safer.Buffer = {} +for (key in Buffer) { + if (!Buffer.hasOwnProperty(key)) continue + if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue + Safer[key] = Buffer[key] +} + +safer.Buffer.prototype = Buffer.prototype + +if (!Safer.from || Safer.from === Uint8Array.from) { + Safer.from = function (value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) + } + if (value && typeof value.length === 'undefined') { + throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) + } + return Buffer(value, encodingOrOffset, length) + } +} + +if (!Safer.alloc) { + Safer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + var buf = Buffer(size) + if (!fill || fill.length === 0) { + buf.fill(0) + } else if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + return buf + } +} + +if (!safer.kStringMaxLength) { + try { + safer.kStringMaxLength = process.binding('buffer').kStringMaxLength + } catch (e) { + // we can't determine kStringMaxLength in environments where process.binding + // is unsupported, so let's not set it + } +} + +if (!safer.constants) { + safer.constants = { + MAX_LENGTH: safer.kMaxLength + } + if (safer.kStringMaxLength) { + safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength + } +} + +module.exports = safer diff --git a/node_modules/npm/node_modules/safer-buffer/tests.js b/node_modules/npm/node_modules/safer-buffer/tests.js new file mode 100644 index 00000000..7ed2777c --- /dev/null +++ b/node_modules/npm/node_modules/safer-buffer/tests.js @@ -0,0 +1,406 @@ +/* eslint-disable node/no-deprecated-api */ + +'use strict' + +var test = require('tape') + +var buffer = require('buffer') + +var index = require('./') +var safer = require('./safer') +var dangerous = require('./dangerous') + +/* Inheritance tests */ + +test('Default is Safer', function (t) { + t.equal(index, safer) + t.notEqual(safer, dangerous) + t.notEqual(index, dangerous) + t.end() +}) + +test('Is not a function', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(typeof impl, 'object') + t.equal(typeof impl.Buffer, 'object') + }); + [buffer].forEach(function (impl) { + t.equal(typeof impl, 'object') + t.equal(typeof impl.Buffer, 'function') + }) + t.end() +}) + +test('Constructor throws', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.throws(function () { impl.Buffer() }) + t.throws(function () { impl.Buffer(0) }) + t.throws(function () { impl.Buffer('a') }) + t.throws(function () { impl.Buffer('a', 'utf-8') }) + t.throws(function () { return new impl.Buffer() }) + t.throws(function () { return new impl.Buffer(0) }) + t.throws(function () { return new impl.Buffer('a') }) + t.throws(function () { return new impl.Buffer('a', 'utf-8') }) + }) + t.end() +}) + +test('Safe methods exist', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(typeof impl.Buffer.alloc, 'function', 'alloc') + t.equal(typeof impl.Buffer.from, 'function', 'from') + }) + t.end() +}) + +test('Unsafe methods exist only in Dangerous', function (t) { + [index, safer].forEach(function (impl) { + t.equal(typeof impl.Buffer.allocUnsafe, 'undefined') + t.equal(typeof impl.Buffer.allocUnsafeSlow, 'undefined') + }); + [dangerous].forEach(function (impl) { + t.equal(typeof impl.Buffer.allocUnsafe, 'function') + t.equal(typeof impl.Buffer.allocUnsafeSlow, 'function') + }) + t.end() +}) + +test('Generic methods/properties are defined and equal', function (t) { + ['poolSize', 'isBuffer', 'concat', 'byteLength'].forEach(function (method) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], buffer.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +test('Built-in buffer static methods/properties are inherited', function (t) { + Object.keys(buffer).forEach(function (method) { + if (method === 'SlowBuffer' || method === 'Buffer') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl[method], buffer[method], method) + t.notEqual(typeof impl[method], 'undefined', method) + }) + }) + t.end() +}) + +test('Built-in Buffer static methods/properties are inherited', function (t) { + Object.keys(buffer.Buffer).forEach(function (method) { + if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], buffer.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +test('.prototype property of Buffer is inherited', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer.prototype, buffer.Buffer.prototype, 'prototype') + t.notEqual(typeof impl.Buffer.prototype, 'undefined', 'prototype') + }) + t.end() +}) + +test('All Safer methods are present in Dangerous', function (t) { + Object.keys(safer).forEach(function (method) { + if (method === 'Buffer') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl[method], safer[method], method) + if (method !== 'kStringMaxLength') { + t.notEqual(typeof impl[method], 'undefined', method) + } + }) + }) + Object.keys(safer.Buffer).forEach(function (method) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], safer.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +test('Safe methods from Dangerous methods are present in Safer', function (t) { + Object.keys(dangerous).forEach(function (method) { + if (method === 'Buffer') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl[method], dangerous[method], method) + if (method !== 'kStringMaxLength') { + t.notEqual(typeof impl[method], 'undefined', method) + } + }) + }) + Object.keys(dangerous.Buffer).forEach(function (method) { + if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return; + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer[method], dangerous.Buffer[method], method) + t.notEqual(typeof impl.Buffer[method], 'undefined', method) + }) + }) + t.end() +}) + +/* Behaviour tests */ + +test('Methods return Buffers', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 10))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 'a'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10, 'x'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(9, 'ab'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(''))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string', 'utf-8'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([0, 42, 3]))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(new Uint8Array([0, 42, 3])))) + t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([]))) + }); + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](0))) + t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](10))) + }) + t.end() +}) + +test('Constructor is buffer.Buffer', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer.alloc(0).constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(0, 10).constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(0, 'a').constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(10).constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(10, 'x').constructor, buffer.Buffer) + t.equal(impl.Buffer.alloc(9, 'ab').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('string').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('string', 'utf-8').constructor, buffer.Buffer) + t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').constructor, buffer.Buffer) + t.equal(impl.Buffer.from([0, 42, 3]).constructor, buffer.Buffer) + t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).constructor, buffer.Buffer) + t.equal(impl.Buffer.from([]).constructor, buffer.Buffer) + }); + [0, 10, 100].forEach(function (arg) { + t.equal(dangerous.Buffer.allocUnsafe(arg).constructor, buffer.Buffer) + t.equal(dangerous.Buffer.allocUnsafeSlow(arg).constructor, buffer.SlowBuffer(0).constructor) + }) + t.end() +}) + +test('Invalid calls throw', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.throws(function () { impl.Buffer.from(0) }) + t.throws(function () { impl.Buffer.from(10) }) + t.throws(function () { impl.Buffer.from(10, 'utf-8') }) + t.throws(function () { impl.Buffer.from('string', 'invalid encoding') }) + t.throws(function () { impl.Buffer.from(-10) }) + t.throws(function () { impl.Buffer.from(1e90) }) + t.throws(function () { impl.Buffer.from(Infinity) }) + t.throws(function () { impl.Buffer.from(-Infinity) }) + t.throws(function () { impl.Buffer.from(NaN) }) + t.throws(function () { impl.Buffer.from(null) }) + t.throws(function () { impl.Buffer.from(undefined) }) + t.throws(function () { impl.Buffer.from() }) + t.throws(function () { impl.Buffer.from({}) }) + t.throws(function () { impl.Buffer.alloc('') }) + t.throws(function () { impl.Buffer.alloc('string') }) + t.throws(function () { impl.Buffer.alloc('string', 'utf-8') }) + t.throws(function () { impl.Buffer.alloc('b25ldHdvdGhyZWU=', 'base64') }) + t.throws(function () { impl.Buffer.alloc(-10) }) + t.throws(function () { impl.Buffer.alloc(1e90) }) + t.throws(function () { impl.Buffer.alloc(2 * (1 << 30)) }) + t.throws(function () { impl.Buffer.alloc(Infinity) }) + t.throws(function () { impl.Buffer.alloc(-Infinity) }) + t.throws(function () { impl.Buffer.alloc(null) }) + t.throws(function () { impl.Buffer.alloc(undefined) }) + t.throws(function () { impl.Buffer.alloc() }) + t.throws(function () { impl.Buffer.alloc([]) }) + t.throws(function () { impl.Buffer.alloc([0, 42, 3]) }) + t.throws(function () { impl.Buffer.alloc({}) }) + }); + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + t.throws(function () { dangerous.Buffer[method]('') }) + t.throws(function () { dangerous.Buffer[method]('string') }) + t.throws(function () { dangerous.Buffer[method]('string', 'utf-8') }) + t.throws(function () { dangerous.Buffer[method](2 * (1 << 30)) }) + t.throws(function () { dangerous.Buffer[method](Infinity) }) + if (dangerous.Buffer[method] === buffer.Buffer.allocUnsafe) { + t.skip('Skipping, older impl of allocUnsafe coerced negative sizes to 0') + } else { + t.throws(function () { dangerous.Buffer[method](-10) }) + t.throws(function () { dangerous.Buffer[method](-1e90) }) + t.throws(function () { dangerous.Buffer[method](-Infinity) }) + } + t.throws(function () { dangerous.Buffer[method](null) }) + t.throws(function () { dangerous.Buffer[method](undefined) }) + t.throws(function () { dangerous.Buffer[method]() }) + t.throws(function () { dangerous.Buffer[method]([]) }) + t.throws(function () { dangerous.Buffer[method]([0, 42, 3]) }) + t.throws(function () { dangerous.Buffer[method]({}) }) + }) + t.end() +}) + +test('Buffers have appropriate lengths', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.equal(impl.Buffer.alloc(0).length, 0) + t.equal(impl.Buffer.alloc(10).length, 10) + t.equal(impl.Buffer.from('').length, 0) + t.equal(impl.Buffer.from('string').length, 6) + t.equal(impl.Buffer.from('string', 'utf-8').length, 6) + t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').length, 11) + t.equal(impl.Buffer.from([0, 42, 3]).length, 3) + t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).length, 3) + t.equal(impl.Buffer.from([]).length, 0) + }); + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + t.equal(dangerous.Buffer[method](0).length, 0) + t.equal(dangerous.Buffer[method](10).length, 10) + }) + t.end() +}) + +test('Buffers have appropriate lengths (2)', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true; + [ safer.Buffer.alloc, + dangerous.Buffer.allocUnsafe, + dangerous.Buffer.allocUnsafeSlow + ].forEach(function (method) { + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 1e5) + var buf = method(length) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + } + }) + t.ok(ok) + t.end() +}) + +test('.alloc(size) is zero-filled and has correct length', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var buf = index.Buffer.alloc(length) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + var j + for (j = 0; j < length; j++) { + if (buf[j] !== 0) ok = false + } + buf.fill(1) + for (j = 0; j < length; j++) { + if (buf[j] !== 1) ok = false + } + } + t.ok(ok) + t.end() +}) + +test('.allocUnsafe / .allocUnsafeSlow are fillable and have correct lengths', function (t) { + ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var buf = dangerous.Buffer[method](length) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + buf.fill(0, 0, length) + var j + for (j = 0; j < length; j++) { + if (buf[j] !== 0) ok = false + } + buf.fill(1, 0, length) + for (j = 0; j < length; j++) { + if (buf[j] !== 1) ok = false + } + } + t.ok(ok, method) + }) + t.end() +}) + +test('.alloc(size, fill) is `fill`-filled', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var fill = Math.round(Math.random() * 255) + var buf = index.Buffer.alloc(length, fill) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + for (var j = 0; j < length; j++) { + if (buf[j] !== fill) ok = false + } + } + t.ok(ok) + t.end() +}) + +test('.alloc(size, fill) is `fill`-filled', function (t) { + t.equal(index.Buffer.alloc, safer.Buffer.alloc) + t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) + var ok = true + for (var i = 0; i < 1e2; i++) { + var length = Math.round(Math.random() * 2e6) + var fill = Math.round(Math.random() * 255) + var buf = index.Buffer.alloc(length, fill) + if (!buffer.Buffer.isBuffer(buf)) ok = false + if (buf.length !== length) ok = false + for (var j = 0; j < length; j++) { + if (buf[j] !== fill) ok = false + } + } + t.ok(ok) + t.deepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 97)) + t.notDeepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 98)) + + var tmp = new buffer.Buffer(2) + tmp.fill('ok') + if (tmp[1] === tmp[0]) { + // Outdated Node.js + t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('ooooo')) + } else { + t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('okoko')) + } + t.notDeepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('kokok')) + + t.end() +}) + +test('safer.Buffer.from returns results same as Buffer constructor', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.deepEqual(impl.Buffer.from(''), new buffer.Buffer('')) + t.deepEqual(impl.Buffer.from('string'), new buffer.Buffer('string')) + t.deepEqual(impl.Buffer.from('string', 'utf-8'), new buffer.Buffer('string', 'utf-8')) + t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), new buffer.Buffer('b25ldHdvdGhyZWU=', 'base64')) + t.deepEqual(impl.Buffer.from([0, 42, 3]), new buffer.Buffer([0, 42, 3])) + t.deepEqual(impl.Buffer.from(new Uint8Array([0, 42, 3])), new buffer.Buffer(new Uint8Array([0, 42, 3]))) + t.deepEqual(impl.Buffer.from([]), new buffer.Buffer([])) + }) + t.end() +}) + +test('safer.Buffer.from returns consistent results', function (t) { + [index, safer, dangerous].forEach(function (impl) { + t.deepEqual(impl.Buffer.from(''), impl.Buffer.alloc(0)) + t.deepEqual(impl.Buffer.from([]), impl.Buffer.alloc(0)) + t.deepEqual(impl.Buffer.from(new Uint8Array([])), impl.Buffer.alloc(0)) + t.deepEqual(impl.Buffer.from('string', 'utf-8'), impl.Buffer.from('string')) + t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from([115, 116, 114, 105, 110, 103])) + t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from(impl.Buffer.from('string'))) + t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), impl.Buffer.from('onetwothree')) + t.notDeepEqual(impl.Buffer.from('b25ldHdvdGhyZWU='), impl.Buffer.from('onetwothree')) + }) + t.end() +}) diff --git a/node_modules/npm/node_modules/semver/LICENSE b/node_modules/npm/node_modules/semver/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/semver/README.md b/node_modules/npm/node_modules/semver/README.md new file mode 100644 index 00000000..ede7b7d0 --- /dev/null +++ b/node_modules/npm/node_modules/semver/README.md @@ -0,0 +1,654 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +You can also just load the module for the function that you care about if +you'd like to minimize your footprint. + +```js +// load the whole API at once in a single object +const semver = require('semver') + +// or just load the bits you need +// all of them listed here, just pick and choose what you want + +// classes +const SemVer = require('semver/classes/semver') +const Comparator = require('semver/classes/comparator') +const Range = require('semver/classes/range') + +// functions for working with versions +const semverParse = require('semver/functions/parse') +const semverValid = require('semver/functions/valid') +const semverClean = require('semver/functions/clean') +const semverInc = require('semver/functions/inc') +const semverDiff = require('semver/functions/diff') +const semverMajor = require('semver/functions/major') +const semverMinor = require('semver/functions/minor') +const semverPatch = require('semver/functions/patch') +const semverPrerelease = require('semver/functions/prerelease') +const semverCompare = require('semver/functions/compare') +const semverRcompare = require('semver/functions/rcompare') +const semverCompareLoose = require('semver/functions/compare-loose') +const semverCompareBuild = require('semver/functions/compare-build') +const semverSort = require('semver/functions/sort') +const semverRsort = require('semver/functions/rsort') + +// low-level comparators between versions +const semverGt = require('semver/functions/gt') +const semverLt = require('semver/functions/lt') +const semverEq = require('semver/functions/eq') +const semverNeq = require('semver/functions/neq') +const semverGte = require('semver/functions/gte') +const semverLte = require('semver/functions/lte') +const semverCmp = require('semver/functions/cmp') +const semverCoerce = require('semver/functions/coerce') + +// working with ranges +const semverSatisfies = require('semver/functions/satisfies') +const semverMaxSatisfying = require('semver/ranges/max-satisfying') +const semverMinSatisfying = require('semver/ranges/min-satisfying') +const semverToComparators = require('semver/ranges/to-comparators') +const semverMinVersion = require('semver/ranges/min-version') +const semverValidRange = require('semver/ranges/valid') +const semverOutside = require('semver/ranges/outside') +const semverGtr = require('semver/ranges/gtr') +const semverLtr = require('semver/ranges/ltr') +const semverIntersects = require('semver/ranges/intersects') +const semverSimplifyRange = require('semver/ranges/simplify') +const semverRangeSubset = require('semver/ranges/subset') +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-n <0|1> + This is the base to be used for the prerelease identifier. + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` that specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. The comparator `>1` is equivalent to `>=2.0.0` and +would match the versions `2.0.0` and `3.1.0`, but not the versions +`1.0.1` or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. +Version `3.4.5` *would* satisfy the range because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose of this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range-matching +semantics. + +Second, a user who has opted into using a prerelease version has +indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for range-matching) +by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +#### Prerelease Identifier Base + +The method `.inc` takes an optional parameter 'identifierBase' string +that will let you let your prerelease number as zero-based or one-based. +Set to `false` to omit the prerelease number altogether. +If you do not specify this parameter, it will default to zero-based. + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta', '1') +// '1.2.4-beta.1' +``` + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta', false) +// '1.2.4-beta' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta -n 1 +1.2.4-beta.1 +``` + +```bash +$ semver 1.2.3 -i prerelease --preid beta -n false +1.2.4-beta +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0-0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0-0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless + `includePrerelease` is specified, in which case any version at all + satisfies) +* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0-0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0-0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0-0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero element in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0-0` +* `^0.2.3` := `>=0.2.3 <0.3.0-0` +* `^0.0.3` := `>=0.0.3 <0.0.4-0` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0-0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4-0` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0-0` +* `^0.0.x` := `>=0.0.0 <0.1.0-0` +* `^0.0` := `>=0.0.0 <0.1.0-0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0-0` +* `^0.x` := `>=0.0.0 <1.0.0-0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose`: Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease`: Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release, options, identifier, identifierBase)`: + Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, `prerelease` will work the + same as `prepatch`. It increments the patch version and then makes a + prerelease. If the input version is already a prerelease it simply + increments it. + * `identifier` can be used to prefix `premajor`, `preminor`, + `prepatch`, or `prerelease` version increments. `identifierBase` + is the base to be used for the `prerelease` identifier. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of `compare`. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions + are equal. Sorts in ascending order if passed to `Array.sort()`. +* `compareLoose(v1, v2)`: Short for `compare(v1, v2, { loose: true })`. +* `diff(v1, v2)`: Returns the difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Sorting + +* `sort(versions)`: Returns a sorted array of versions based on the `compareBuild` + function. +* `rsort(versions)`: The reverse of `sort`. Returns an array of versions based on + the `compareBuild` function in descending order. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can match + the given range. +* `gtr(version, range)`: Return `true` if the version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if the version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the range comparators intersect. +* `simplifyRange(versions, range)`: Return a "simplified" range that + matches the same items in the `versions` list as the range specified. Note + that it does *not* guarantee that it would match the same versions in all + cases, only for the set of versions provided. This is useful when + generating ranges by joining together multiple versions with `||` + programmatically, to provide the user with something a bit more + ergonomic. If the provided range is shorter in string-length than the + generated range, then that is returned. +* `subset(subRange, superRange)`: Return `true` if the `subRange` range is + entirely contained by the `superRange` range. + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version, options)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). + +If the `options.rtl` flag is set, then `coerce` will return the right-most +coercible tuple that does not share an ending index with a longer coercible +tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not +`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of +any other overlapping SemVer tuple. + +If the `options.includePrerelease` flag is set, then the `coerce` result will contain +prerelease and build parts of a version. For example, `1.2.3.4-rc.1+rev.2` +will preserve prerelease `rc.1` and build `rev.2` in the result. + +### Clean + +* `clean(version)`: Clean a string to be a valid semver if possible + +This will return a cleaned and trimmed semver version. If the provided +version is not valid a null will be returned. This does not work for +ranges. + +ex. +* `s.clean(' = v 2.1.5foo')`: `null` +* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean(' = v 2.1.5-foo')`: `null` +* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean('=v2.1.5')`: `'2.1.5'` +* `s.clean(' =v2.1.5')`: `'2.1.5'` +* `s.clean(' 2.1.5 ')`: `'2.1.5'` +* `s.clean('~1.0.0')`: `null` + +## Constants + +As a convenience, helper constants are exported to provide information about what `node-semver` supports: + +### `RELEASE_TYPES` + +- major +- premajor +- minor +- preminor +- patch +- prepatch +- prerelease + +``` +const semver = require('semver'); + +if (semver.RELEASE_TYPES.includes(arbitraryUserInput)) { + console.log('This is a valid release type!'); +} else { + console.warn('This is NOT a valid release type!'); +} +``` + +### `SEMVER_SPEC_VERSION` + +2.0.0 + +``` +const semver = require('semver'); + +console.log('We are currently using the semver specification version:', semver.SEMVER_SPEC_VERSION); +``` + +## Exported Modules + + + +You may pull in just the part of this semver utility that you need if you +are sensitive to packing and tree-shaking concerns. The main +`require('semver')` export uses getter functions to lazily load the parts +of the API that are used. + +The following modules are available: + +* `require('semver')` +* `require('semver/classes')` +* `require('semver/classes/comparator')` +* `require('semver/classes/range')` +* `require('semver/classes/semver')` +* `require('semver/functions/clean')` +* `require('semver/functions/cmp')` +* `require('semver/functions/coerce')` +* `require('semver/functions/compare')` +* `require('semver/functions/compare-build')` +* `require('semver/functions/compare-loose')` +* `require('semver/functions/diff')` +* `require('semver/functions/eq')` +* `require('semver/functions/gt')` +* `require('semver/functions/gte')` +* `require('semver/functions/inc')` +* `require('semver/functions/lt')` +* `require('semver/functions/lte')` +* `require('semver/functions/major')` +* `require('semver/functions/minor')` +* `require('semver/functions/neq')` +* `require('semver/functions/parse')` +* `require('semver/functions/patch')` +* `require('semver/functions/prerelease')` +* `require('semver/functions/rcompare')` +* `require('semver/functions/rsort')` +* `require('semver/functions/satisfies')` +* `require('semver/functions/sort')` +* `require('semver/functions/valid')` +* `require('semver/ranges/gtr')` +* `require('semver/ranges/intersects')` +* `require('semver/ranges/ltr')` +* `require('semver/ranges/max-satisfying')` +* `require('semver/ranges/min-satisfying')` +* `require('semver/ranges/min-version')` +* `require('semver/ranges/outside')` +* `require('semver/ranges/simplify')` +* `require('semver/ranges/subset')` +* `require('semver/ranges/to-comparators')` +* `require('semver/ranges/valid')` + diff --git a/node_modules/npm/node_modules/semver/bin/semver.js b/node_modules/npm/node_modules/semver/bin/semver.js new file mode 100755 index 00000000..f62b566f --- /dev/null +++ b/node_modules/npm/node_modules/semver/bin/semver.js @@ -0,0 +1,188 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +const argv = process.argv.slice(2) + +let versions = [] + +const range = [] + +let inc = null + +const version = require('../package.json').version + +let loose = false + +let includePrerelease = false + +let coerce = false + +let rtl = false + +let identifier + +let identifierBase + +const semver = require('../') +const parseOptions = require('../internal/parse-options') + +let reverse = false + +let options = {} + +const main = () => { + if (!argv.length) { + return help() + } + while (argv.length) { + let a = argv.shift() + const indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + const value = a.slice(indexOfEqualSign + 1) + a = a.slice(0, indexOfEqualSign) + argv.unshift(value) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-n': + identifierBase = argv.shift() + if (identifierBase === 'false') { + identifierBase = false + } + break + case '-c': case '--coerce': + coerce = true + break + case '--rtl': + rtl = true + break + case '--ltr': + rtl = false + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + options = parseOptions({ loose, includePrerelease, rtl }) + + versions = versions.map((v) => { + return coerce ? (semver.coerce(v, options) || { version: v }).version : v + }).filter((v) => { + return semver.valid(v) + }) + if (!versions.length) { + return fail() + } + if (inc && (versions.length !== 1 || range.length)) { + return failInc() + } + + for (let i = 0, l = range.length; i < l; i++) { + versions = versions.filter((v) => { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) { + return fail() + } + } + versions + .sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options)) + .map(v => semver.clean(v, options)) + .map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v) + .forEach(v => console.log(v)) +} + +const failInc = () => { + console.error('--inc can only be used on a single version with no range') + fail() +} + +const fail = () => process.exit(1) + +const help = () => console.log( +`SemVer ${version} + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +-n + Base number to be used for the prerelease identifier. + Can be either 0 or 1, or false to omit the number altogether. + Defaults to 0. + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them.`) + +main() diff --git a/node_modules/npm/node_modules/semver/classes/comparator.js b/node_modules/npm/node_modules/semver/classes/comparator.js new file mode 100644 index 00000000..3d39c0ee --- /dev/null +++ b/node_modules/npm/node_modules/semver/classes/comparator.js @@ -0,0 +1,141 @@ +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY + } + + constructor (comp, options) { + options = parseOptions(options) + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) + } + + parse (comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + const m = comp.match(r) + + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } + } + + toString () { + return this.value + } + + test (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) + } + + intersects (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (this.operator === '') { + if (this.value === '') { + return true + } + return new Range(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range(this.value, options).test(comp.semver) + } + + options = parseOptions(options) + + // Special cases where nothing can possibly be lower + if (options.includePrerelease && + (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) { + return false + } + if (!options.includePrerelease && + (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) { + return false + } + + // Same direction increasing (> or >=) + if (this.operator.startsWith('>') && comp.operator.startsWith('>')) { + return true + } + // Same direction decreasing (< or <=) + if (this.operator.startsWith('<') && comp.operator.startsWith('<')) { + return true + } + // same SemVer and both sides are inclusive (<= or >=) + if ( + (this.semver.version === comp.semver.version) && + this.operator.includes('=') && comp.operator.includes('=')) { + return true + } + // opposite directions less than + if (cmp(this.semver, '<', comp.semver, options) && + this.operator.startsWith('>') && comp.operator.startsWith('<')) { + return true + } + // opposite directions greater than + if (cmp(this.semver, '>', comp.semver, options) && + this.operator.startsWith('<') && comp.operator.startsWith('>')) { + return true + } + return false + } +} + +module.exports = Comparator + +const parseOptions = require('../internal/parse-options') +const { safeRe: re, t } = require('../internal/re') +const cmp = require('../functions/cmp') +const debug = require('../internal/debug') +const SemVer = require('./semver') +const Range = require('./range') diff --git a/node_modules/npm/node_modules/semver/classes/index.js b/node_modules/npm/node_modules/semver/classes/index.js new file mode 100644 index 00000000..5e3f5c9b --- /dev/null +++ b/node_modules/npm/node_modules/semver/classes/index.js @@ -0,0 +1,5 @@ +module.exports = { + SemVer: require('./semver.js'), + Range: require('./range.js'), + Comparator: require('./comparator.js'), +} diff --git a/node_modules/npm/node_modules/semver/classes/range.js b/node_modules/npm/node_modules/semver/classes/range.js new file mode 100644 index 00000000..ceee2314 --- /dev/null +++ b/node_modules/npm/node_modules/semver/classes/range.js @@ -0,0 +1,554 @@ +const SPACE_CHARACTERS = /\s+/g + +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + options = parseOptions(options) + + if (range instanceof Range) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + // just put it in the set and return + this.raw = range.value + this.set = [[range]] + this.formatted = undefined + return this + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range.trim().replace(SPACE_CHARACTERS, ' ') + + // First, split on || + this.set = this.raw + .split('||') + // map the range to a 2d array of comparators + .map(r => this.parseRange(r.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length) + + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${this.raw}`) + } + + // if we have any that are not the null set, throw out null sets. + if (this.set.length > 1) { + // keep the first one, in case they're all null sets + const first = this.set[0] + this.set = this.set.filter(c => !isNullSet(c[0])) + if (this.set.length === 0) { + this.set = [first] + } else if (this.set.length > 1) { + // if we have any that are *, then the range is just * + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c] + break + } + } + } + } + + this.formatted = undefined + } + + get range () { + if (this.formatted === undefined) { + this.formatted = '' + for (let i = 0; i < this.set.length; i++) { + if (i > 0) { + this.formatted += '||' + } + const comps = this.set[i] + for (let k = 0; k < comps.length; k++) { + if (k > 0) { + this.formatted += ' ' + } + this.formatted += comps[k].toString().trim() + } + } + } + return this.formatted + } + + format () { + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + // memoize range parsing for performance. + // this is a very hot path, and fully deterministic. + const memoOpts = + (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | + (this.options.loose && FLAG_LOOSE) + const memoKey = memoOpts + ':' + range + const cached = cache.get(memoKey) + if (cached) { + return cached + } + + const loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) + debug('hyphen replace', range) + + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + debug('tilde trim', range) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + debug('caret trim', range) + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + let rangeList = range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + // >=0.0.0 is equivalent to * + .map(comp => replaceGTE0(comp, this.options)) + + if (loose) { + // in loose mode, throw out any that are not valid comparators + rangeList = rangeList.filter(comp => { + debug('loose invalid filter', comp, this.options) + return !!comp.match(re[t.COMPARATORLOOSE]) + }) + } + debug('range list', rangeList) + + // if any comparators are the null set, then replace with JUST null set + // if more than one comparator, remove any * comparators + // also, don't include the same comparator more than once + const rangeMap = new Map() + const comparators = rangeList.map(comp => new Comparator(comp, this.options)) + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp] + } + rangeMap.set(comp.value, comp) + } + if (rangeMap.size > 1 && rangeMap.has('')) { + rangeMap.delete('') + } + + const result = [...rangeMap.values()] + cache.set(memoKey, result) + return result + } + + intersects (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) + } + + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false + } +} + +module.exports = Range + +const LRU = require('../internal/lrucache') +const cache = new LRU() + +const parseOptions = require('../internal/parse-options') +const Comparator = require('./comparator') +const debug = require('../internal/debug') +const SemVer = require('./semver') +const { + safeRe: re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace, +} = require('../internal/re') +const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants') + +const isNullSet = c => c.value === '<0.0.0-0' +const isAny = c => c.value === '' + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true + const remainingComparators = comparators.slice() + let testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +const isX = id => !id || id.toLowerCase() === 'x' || id === '*' + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 +// ~0.0.1 --> >=0.0.1 <0.1.0-0 +const replaceTildes = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceTilde(c, options)) + .join(' ') +} + +const replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, (_, M, m, p, pr) => { + debug('tilde', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0` + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0-0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` + } else if (pr) { + debug('replaceTilde pr', pr) + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } else { + // ~1.2.3 == >=1.2.3 <1.3.0-0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0-0` + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 +// ^1.2.3 --> >=1.2.3 <2.0.0-0 +// ^1.2.0 --> >=1.2.0 <2.0.0-0 +// ^0.0.1 --> >=0.0.1 <0.0.2-0 +// ^0.1.0 --> >=0.1.0 <0.2.0-0 +const replaceCarets = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceCaret(c, options)) + .join(' ') +} + +const replaceCaret = (comp, options) => { + debug('caret', comp, options) + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + const z = options.includePrerelease ? '-0' : '' + return comp.replace(r, (_, M, m, p, pr) => { + debug('caret', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0-0` + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + }${z} <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p + }${z} <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0-0` + } + } + + debug('caret return', ret) + return ret + }) +} + +const replaceXRanges = (comp, options) => { + debug('replaceXRanges', comp, options) + return comp + .split(/\s+/) + .map((c) => replaceXRange(c, options)) + .join(' ') +} + +const replaceXRange = (comp, options) => { + comp = comp.trim() + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + const xM = isX(M) + const xm = xM || isX(m) + const xp = xm || isX(p) + const anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + if (gtlt === '<') { + pr = '-0' + } + + ret = `${gtlt + M}.${m}.${p}${pr}` + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0-0` + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp + .trim() + .replace(re[t.STAR], '') +} + +const replaceGTE0 = (comp, options) => { + debug('replaceGTE0', comp, options) + return comp + .trim() + .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +// TODO build? +const hyphenReplace = incPr => ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr) => { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? '-0' : ''}` + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` + } else if (fpr) { + from = `>=${from}` + } else { + from = `>=${from}${incPr ? '-0' : ''}` + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0` + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0` + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}` + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0` + } else { + to = `<=${to}` + } + + return `${from} ${to}`.trim() +} + +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === Comparator.ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} diff --git a/node_modules/npm/node_modules/semver/classes/semver.js b/node_modules/npm/node_modules/semver/classes/semver.js new file mode 100644 index 00000000..13e66ce4 --- /dev/null +++ b/node_modules/npm/node_modules/semver/classes/semver.js @@ -0,0 +1,302 @@ +const debug = require('../internal/debug') +const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants') +const { safeRe: re, t } = require('../internal/re') + +const parseOptions = require('../internal/parse-options') +const { compareIdentifiers } = require('../internal/identifiers') +class SemVer { + constructor (version, options) { + options = parseOptions(options) + + if (version instanceof SemVer) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease + + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() + } + + format () { + this.version = `${this.major}.${this.minor}.${this.patch}` + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}` + } + return this.version + } + + toString () { + return this.version + } + + compare (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0 + } + other = new SemVer(other, this.options) + } + + if (other.version === this.version) { + return 0 + } + + return this.compareMain(other) || this.comparePre(other) + } + + compareMain (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } + + comparePre (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + let i = 0 + do { + const a = this.prerelease[i] + const b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + compareBuild (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + let i = 0 + do { + const a = this.build[i] + const b = other.build[i] + debug('build compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier, identifierBase) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier, identifierBase) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier, identifierBase) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier, identifierBase) + this.inc('pre', identifier, identifierBase) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier, identifierBase) + } + this.inc('pre', identifier, identifierBase) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if ( + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 + ) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': { + const base = Number(identifierBase) ? 1 : 0 + + if (!identifier && identifierBase === false) { + throw new Error('invalid increment argument: identifier is empty') + } + + if (this.prerelease.length === 0) { + this.prerelease = [base] + } else { + let i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + if (identifier === this.prerelease.join('.') && identifierBase === false) { + throw new Error('invalid increment argument: identifier already exists') + } + this.prerelease.push(base) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + let prerelease = [identifier, base] + if (identifierBase === false) { + prerelease = [identifier] + } + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = prerelease + } + } else { + this.prerelease = prerelease + } + } + break + } + default: + throw new Error(`invalid increment argument: ${release}`) + } + this.raw = this.format() + if (this.build.length) { + this.raw += `+${this.build.join('.')}` + } + return this + } +} + +module.exports = SemVer diff --git a/node_modules/npm/node_modules/semver/functions/clean.js b/node_modules/npm/node_modules/semver/functions/clean.js new file mode 100644 index 00000000..811fe6b8 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/clean.js @@ -0,0 +1,6 @@ +const parse = require('./parse') +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} +module.exports = clean diff --git a/node_modules/npm/node_modules/semver/functions/cmp.js b/node_modules/npm/node_modules/semver/functions/cmp.js new file mode 100644 index 00000000..40119094 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/cmp.js @@ -0,0 +1,52 @@ +const eq = require('./eq') +const neq = require('./neq') +const gt = require('./gt') +const gte = require('./gte') +const lt = require('./lt') +const lte = require('./lte') + +const cmp = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a === b + + case '!==': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError(`Invalid operator: ${op}`) + } +} +module.exports = cmp diff --git a/node_modules/npm/node_modules/semver/functions/coerce.js b/node_modules/npm/node_modules/semver/functions/coerce.js new file mode 100644 index 00000000..b378dcea --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/coerce.js @@ -0,0 +1,60 @@ +const SemVer = require('../classes/semver') +const parse = require('./parse') +const { safeRe: re, t } = require('../internal/re') + +const coerce = (version, options) => { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + let match = null + if (!options.rtl) { + match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL] + let next + while ((next = coerceRtlRegex.exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + coerceRtlRegex.lastIndex = -1 + } + + if (match === null) { + return null + } + + const major = match[2] + const minor = match[3] || '0' + const patch = match[4] || '0' + const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '' + const build = options.includePrerelease && match[6] ? `+${match[6]}` : '' + + return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options) +} +module.exports = coerce diff --git a/node_modules/npm/node_modules/semver/functions/compare-build.js b/node_modules/npm/node_modules/semver/functions/compare-build.js new file mode 100644 index 00000000..9eb881be --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/compare-build.js @@ -0,0 +1,7 @@ +const SemVer = require('../classes/semver') +const compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose) + const versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} +module.exports = compareBuild diff --git a/node_modules/npm/node_modules/semver/functions/compare-loose.js b/node_modules/npm/node_modules/semver/functions/compare-loose.js new file mode 100644 index 00000000..4881fbe0 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/compare-loose.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const compareLoose = (a, b) => compare(a, b, true) +module.exports = compareLoose diff --git a/node_modules/npm/node_modules/semver/functions/compare.js b/node_modules/npm/node_modules/semver/functions/compare.js new file mode 100644 index 00000000..748b7afa --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/compare.js @@ -0,0 +1,5 @@ +const SemVer = require('../classes/semver') +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) + +module.exports = compare diff --git a/node_modules/npm/node_modules/semver/functions/diff.js b/node_modules/npm/node_modules/semver/functions/diff.js new file mode 100644 index 00000000..fc224e30 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/diff.js @@ -0,0 +1,65 @@ +const parse = require('./parse.js') + +const diff = (version1, version2) => { + const v1 = parse(version1, null, true) + const v2 = parse(version2, null, true) + const comparison = v1.compare(v2) + + if (comparison === 0) { + return null + } + + const v1Higher = comparison > 0 + const highVersion = v1Higher ? v1 : v2 + const lowVersion = v1Higher ? v2 : v1 + const highHasPre = !!highVersion.prerelease.length + const lowHasPre = !!lowVersion.prerelease.length + + if (lowHasPre && !highHasPre) { + // Going from prerelease -> no prerelease requires some special casing + + // If the low version has only a major, then it will always be a major + // Some examples: + // 1.0.0-1 -> 1.0.0 + // 1.0.0-1 -> 1.1.1 + // 1.0.0-1 -> 2.0.0 + if (!lowVersion.patch && !lowVersion.minor) { + return 'major' + } + + // Otherwise it can be determined by checking the high version + + if (highVersion.patch) { + // anything higher than a patch bump would result in the wrong version + return 'patch' + } + + if (highVersion.minor) { + // anything higher than a minor bump would result in the wrong version + return 'minor' + } + + // bumping major/minor/patch all have same result + return 'major' + } + + // add the `pre` prefix if we are going to a prerelease version + const prefix = highHasPre ? 'pre' : '' + + if (v1.major !== v2.major) { + return prefix + 'major' + } + + if (v1.minor !== v2.minor) { + return prefix + 'minor' + } + + if (v1.patch !== v2.patch) { + return prefix + 'patch' + } + + // high and low are preleases + return 'prerelease' +} + +module.exports = diff diff --git a/node_modules/npm/node_modules/semver/functions/eq.js b/node_modules/npm/node_modules/semver/functions/eq.js new file mode 100644 index 00000000..271fed97 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/eq.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq diff --git a/node_modules/npm/node_modules/semver/functions/gt.js b/node_modules/npm/node_modules/semver/functions/gt.js new file mode 100644 index 00000000..d9b2156d --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/gt.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const gt = (a, b, loose) => compare(a, b, loose) > 0 +module.exports = gt diff --git a/node_modules/npm/node_modules/semver/functions/gte.js b/node_modules/npm/node_modules/semver/functions/gte.js new file mode 100644 index 00000000..5aeaa634 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/gte.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const gte = (a, b, loose) => compare(a, b, loose) >= 0 +module.exports = gte diff --git a/node_modules/npm/node_modules/semver/functions/inc.js b/node_modules/npm/node_modules/semver/functions/inc.js new file mode 100644 index 00000000..7670b1be --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/inc.js @@ -0,0 +1,19 @@ +const SemVer = require('../classes/semver') + +const inc = (version, release, options, identifier, identifierBase) => { + if (typeof (options) === 'string') { + identifierBase = identifier + identifier = options + options = undefined + } + + try { + return new SemVer( + version instanceof SemVer ? version.version : version, + options + ).inc(release, identifier, identifierBase).version + } catch (er) { + return null + } +} +module.exports = inc diff --git a/node_modules/npm/node_modules/semver/functions/lt.js b/node_modules/npm/node_modules/semver/functions/lt.js new file mode 100644 index 00000000..b440ab7d --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/lt.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const lt = (a, b, loose) => compare(a, b, loose) < 0 +module.exports = lt diff --git a/node_modules/npm/node_modules/semver/functions/lte.js b/node_modules/npm/node_modules/semver/functions/lte.js new file mode 100644 index 00000000..6dcc9565 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/lte.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const lte = (a, b, loose) => compare(a, b, loose) <= 0 +module.exports = lte diff --git a/node_modules/npm/node_modules/semver/functions/major.js b/node_modules/npm/node_modules/semver/functions/major.js new file mode 100644 index 00000000..4283165e --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/major.js @@ -0,0 +1,3 @@ +const SemVer = require('../classes/semver') +const major = (a, loose) => new SemVer(a, loose).major +module.exports = major diff --git a/node_modules/npm/node_modules/semver/functions/minor.js b/node_modules/npm/node_modules/semver/functions/minor.js new file mode 100644 index 00000000..57b3455f --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/minor.js @@ -0,0 +1,3 @@ +const SemVer = require('../classes/semver') +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor diff --git a/node_modules/npm/node_modules/semver/functions/neq.js b/node_modules/npm/node_modules/semver/functions/neq.js new file mode 100644 index 00000000..f944c015 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/neq.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const neq = (a, b, loose) => compare(a, b, loose) !== 0 +module.exports = neq diff --git a/node_modules/npm/node_modules/semver/functions/parse.js b/node_modules/npm/node_modules/semver/functions/parse.js new file mode 100644 index 00000000..459b3b17 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/parse.js @@ -0,0 +1,16 @@ +const SemVer = require('../classes/semver') +const parse = (version, options, throwErrors = false) => { + if (version instanceof SemVer) { + return version + } + try { + return new SemVer(version, options) + } catch (er) { + if (!throwErrors) { + return null + } + throw er + } +} + +module.exports = parse diff --git a/node_modules/npm/node_modules/semver/functions/patch.js b/node_modules/npm/node_modules/semver/functions/patch.js new file mode 100644 index 00000000..63afca25 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/patch.js @@ -0,0 +1,3 @@ +const SemVer = require('../classes/semver') +const patch = (a, loose) => new SemVer(a, loose).patch +module.exports = patch diff --git a/node_modules/npm/node_modules/semver/functions/prerelease.js b/node_modules/npm/node_modules/semver/functions/prerelease.js new file mode 100644 index 00000000..06aa1324 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/prerelease.js @@ -0,0 +1,6 @@ +const parse = require('./parse') +const prerelease = (version, options) => { + const parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} +module.exports = prerelease diff --git a/node_modules/npm/node_modules/semver/functions/rcompare.js b/node_modules/npm/node_modules/semver/functions/rcompare.js new file mode 100644 index 00000000..0ac509e7 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/rcompare.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare diff --git a/node_modules/npm/node_modules/semver/functions/rsort.js b/node_modules/npm/node_modules/semver/functions/rsort.js new file mode 100644 index 00000000..82404c5c --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/rsort.js @@ -0,0 +1,3 @@ +const compareBuild = require('./compare-build') +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) +module.exports = rsort diff --git a/node_modules/npm/node_modules/semver/functions/satisfies.js b/node_modules/npm/node_modules/semver/functions/satisfies.js new file mode 100644 index 00000000..50af1c19 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/satisfies.js @@ -0,0 +1,10 @@ +const Range = require('../classes/range') +const satisfies = (version, range, options) => { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} +module.exports = satisfies diff --git a/node_modules/npm/node_modules/semver/functions/sort.js b/node_modules/npm/node_modules/semver/functions/sort.js new file mode 100644 index 00000000..4d10917a --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/sort.js @@ -0,0 +1,3 @@ +const compareBuild = require('./compare-build') +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort diff --git a/node_modules/npm/node_modules/semver/functions/valid.js b/node_modules/npm/node_modules/semver/functions/valid.js new file mode 100644 index 00000000..f27bae10 --- /dev/null +++ b/node_modules/npm/node_modules/semver/functions/valid.js @@ -0,0 +1,6 @@ +const parse = require('./parse') +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null +} +module.exports = valid diff --git a/node_modules/npm/node_modules/semver/index.js b/node_modules/npm/node_modules/semver/index.js new file mode 100644 index 00000000..86d42ac1 --- /dev/null +++ b/node_modules/npm/node_modules/semver/index.js @@ -0,0 +1,89 @@ +// just pre-load all the stuff that index.js lazily exports +const internalRe = require('./internal/re') +const constants = require('./internal/constants') +const SemVer = require('./classes/semver') +const identifiers = require('./internal/identifiers') +const parse = require('./functions/parse') +const valid = require('./functions/valid') +const clean = require('./functions/clean') +const inc = require('./functions/inc') +const diff = require('./functions/diff') +const major = require('./functions/major') +const minor = require('./functions/minor') +const patch = require('./functions/patch') +const prerelease = require('./functions/prerelease') +const compare = require('./functions/compare') +const rcompare = require('./functions/rcompare') +const compareLoose = require('./functions/compare-loose') +const compareBuild = require('./functions/compare-build') +const sort = require('./functions/sort') +const rsort = require('./functions/rsort') +const gt = require('./functions/gt') +const lt = require('./functions/lt') +const eq = require('./functions/eq') +const neq = require('./functions/neq') +const gte = require('./functions/gte') +const lte = require('./functions/lte') +const cmp = require('./functions/cmp') +const coerce = require('./functions/coerce') +const Comparator = require('./classes/comparator') +const Range = require('./classes/range') +const satisfies = require('./functions/satisfies') +const toComparators = require('./ranges/to-comparators') +const maxSatisfying = require('./ranges/max-satisfying') +const minSatisfying = require('./ranges/min-satisfying') +const minVersion = require('./ranges/min-version') +const validRange = require('./ranges/valid') +const outside = require('./ranges/outside') +const gtr = require('./ranges/gtr') +const ltr = require('./ranges/ltr') +const intersects = require('./ranges/intersects') +const simplifyRange = require('./ranges/simplify') +const subset = require('./ranges/subset') +module.exports = { + parse, + valid, + clean, + inc, + diff, + major, + minor, + patch, + prerelease, + compare, + rcompare, + compareLoose, + compareBuild, + sort, + rsort, + gt, + lt, + eq, + neq, + gte, + lte, + cmp, + coerce, + Comparator, + Range, + satisfies, + toComparators, + maxSatisfying, + minSatisfying, + minVersion, + validRange, + outside, + gtr, + ltr, + intersects, + simplifyRange, + subset, + SemVer, + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, + RELEASE_TYPES: constants.RELEASE_TYPES, + compareIdentifiers: identifiers.compareIdentifiers, + rcompareIdentifiers: identifiers.rcompareIdentifiers, +} diff --git a/node_modules/npm/node_modules/semver/internal/constants.js b/node_modules/npm/node_modules/semver/internal/constants.js new file mode 100644 index 00000000..94be1c57 --- /dev/null +++ b/node_modules/npm/node_modules/semver/internal/constants.js @@ -0,0 +1,35 @@ +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' + +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || +/* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 + +// Max safe length for a build identifier. The max length minus 6 characters for +// the shortest version with a build 0.0.0+BUILD. +const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +const RELEASE_TYPES = [ + 'major', + 'premajor', + 'minor', + 'preminor', + 'patch', + 'prepatch', + 'prerelease', +] + +module.exports = { + MAX_LENGTH, + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_SAFE_INTEGER, + RELEASE_TYPES, + SEMVER_SPEC_VERSION, + FLAG_INCLUDE_PRERELEASE: 0b001, + FLAG_LOOSE: 0b010, +} diff --git a/node_modules/npm/node_modules/semver/internal/debug.js b/node_modules/npm/node_modules/semver/internal/debug.js new file mode 100644 index 00000000..1c00e136 --- /dev/null +++ b/node_modules/npm/node_modules/semver/internal/debug.js @@ -0,0 +1,9 @@ +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} + +module.exports = debug diff --git a/node_modules/npm/node_modules/semver/internal/identifiers.js b/node_modules/npm/node_modules/semver/internal/identifiers.js new file mode 100644 index 00000000..e612d0a3 --- /dev/null +++ b/node_modules/npm/node_modules/semver/internal/identifiers.js @@ -0,0 +1,23 @@ +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) + +module.exports = { + compareIdentifiers, + rcompareIdentifiers, +} diff --git a/node_modules/npm/node_modules/semver/internal/lrucache.js b/node_modules/npm/node_modules/semver/internal/lrucache.js new file mode 100644 index 00000000..6d89ec94 --- /dev/null +++ b/node_modules/npm/node_modules/semver/internal/lrucache.js @@ -0,0 +1,40 @@ +class LRUCache { + constructor () { + this.max = 1000 + this.map = new Map() + } + + get (key) { + const value = this.map.get(key) + if (value === undefined) { + return undefined + } else { + // Remove the key from the map and add it to the end + this.map.delete(key) + this.map.set(key, value) + return value + } + } + + delete (key) { + return this.map.delete(key) + } + + set (key, value) { + const deleted = this.delete(key) + + if (!deleted && value !== undefined) { + // If cache is full, delete the least recently used item + if (this.map.size >= this.max) { + const firstKey = this.map.keys().next().value + this.delete(firstKey) + } + + this.map.set(key, value) + } + + return this + } +} + +module.exports = LRUCache diff --git a/node_modules/npm/node_modules/semver/internal/parse-options.js b/node_modules/npm/node_modules/semver/internal/parse-options.js new file mode 100644 index 00000000..10d64ce0 --- /dev/null +++ b/node_modules/npm/node_modules/semver/internal/parse-options.js @@ -0,0 +1,15 @@ +// parse out just the options we care about +const looseOption = Object.freeze({ loose: true }) +const emptyOpts = Object.freeze({ }) +const parseOptions = options => { + if (!options) { + return emptyOpts + } + + if (typeof options !== 'object') { + return looseOption + } + + return options +} +module.exports = parseOptions diff --git a/node_modules/npm/node_modules/semver/internal/re.js b/node_modules/npm/node_modules/semver/internal/re.js new file mode 100644 index 00000000..fd8920e7 --- /dev/null +++ b/node_modules/npm/node_modules/semver/internal/re.js @@ -0,0 +1,217 @@ +const { + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_LENGTH, +} = require('./constants') +const debug = require('./debug') +exports = module.exports = {} + +// The actual regexps go on exports.re +const re = exports.re = [] +const safeRe = exports.safeRe = [] +const src = exports.src = [] +const t = exports.t = {} +let R = 0 + +const LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +const safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +const makeSafeRegex = (value) => { + for (const [token, max] of safeRegexReplacements) { + value = value + .split(`${token}*`).join(`${token}{0,${max}}`) + .split(`${token}+`).join(`${token}{1,${max}}`) + } + return value +} + +const createToken = (name, value, isGlobal) => { + const safe = makeSafeRegex(value) + const index = R++ + debug(name, index, value) + t[name] = index + src[index] = value + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) + safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined) +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '\\d+') + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`) + +// ## Main Version +// Three dot-separated numeric identifiers. + +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) + +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`) + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) + +createToken('FULL', `^${src[t.FULLPLAIN]}$`) + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) + +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + +createToken('GTLT', '((?:<|>)?=?)') + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCEPLAIN', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`) +createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`) +createToken('COERCEFULL', src[t.COERCEPLAIN] + + `(?:${src[t.PRERELEASE]})?` + + `(?:${src[t.BUILD]})?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) +createToken('COERCERTLFULL', src[t.COERCEFULL], true) + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') + +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' + +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') + +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' + +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) + +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) + +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') diff --git a/node_modules/npm/node_modules/semver/package.json b/node_modules/npm/node_modules/semver/package.json new file mode 100644 index 00000000..663d3701 --- /dev/null +++ b/node_modules/npm/node_modules/semver/package.json @@ -0,0 +1,77 @@ +{ + "name": "semver", + "version": "7.6.3", + "description": "The semantic version parser used by npm.", + "main": "index.js", + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", + "postlint": "template-oss-check", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force" + }, + "devDependencies": { + "@npmcli/eslint-config": "^4.0.0", + "@npmcli/template-oss": "4.22.0", + "benchmark": "^2.1.4", + "tap": "^16.0.0" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "bin/semver.js" + }, + "files": [ + "bin/", + "lib/", + "classes/", + "functions/", + "internal/", + "ranges/", + "index.js", + "preload.js", + "range.bnf" + ], + "tap": { + "timeout": 30, + "coverage-map": "map.js", + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": ">=10" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.22.0", + "engines": ">=10", + "distPaths": [ + "classes/", + "functions/", + "internal/", + "ranges/", + "index.js", + "preload.js", + "range.bnf" + ], + "allowPaths": [ + "/classes/", + "/functions/", + "/internal/", + "/ranges/", + "/index.js", + "/preload.js", + "/range.bnf", + "/benchmarks" + ], + "publish": "true" + } +} diff --git a/node_modules/npm/node_modules/semver/preload.js b/node_modules/npm/node_modules/semver/preload.js new file mode 100644 index 00000000..947cd4f7 --- /dev/null +++ b/node_modules/npm/node_modules/semver/preload.js @@ -0,0 +1,2 @@ +// XXX remove in v8 or beyond +module.exports = require('./index.js') diff --git a/node_modules/npm/node_modules/semver/range.bnf b/node_modules/npm/node_modules/semver/range.bnf new file mode 100644 index 00000000..d4c6ae0d --- /dev/null +++ b/node_modules/npm/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/node_modules/npm/node_modules/semver/ranges/gtr.js b/node_modules/npm/node_modules/semver/ranges/gtr.js new file mode 100644 index 00000000..db7e3559 --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/gtr.js @@ -0,0 +1,4 @@ +// Determine if version is greater than all the versions possible in the range. +const outside = require('./outside') +const gtr = (version, range, options) => outside(version, range, '>', options) +module.exports = gtr diff --git a/node_modules/npm/node_modules/semver/ranges/intersects.js b/node_modules/npm/node_modules/semver/ranges/intersects.js new file mode 100644 index 00000000..e0e9b7ce --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/intersects.js @@ -0,0 +1,7 @@ +const Range = require('../classes/range') +const intersects = (r1, r2, options) => { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2, options) +} +module.exports = intersects diff --git a/node_modules/npm/node_modules/semver/ranges/ltr.js b/node_modules/npm/node_modules/semver/ranges/ltr.js new file mode 100644 index 00000000..528a885e --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/ltr.js @@ -0,0 +1,4 @@ +const outside = require('./outside') +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr diff --git a/node_modules/npm/node_modules/semver/ranges/max-satisfying.js b/node_modules/npm/node_modules/semver/ranges/max-satisfying.js new file mode 100644 index 00000000..6e3d993c --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/max-satisfying.js @@ -0,0 +1,25 @@ +const SemVer = require('../classes/semver') +const Range = require('../classes/range') + +const maxSatisfying = (versions, range, options) => { + let max = null + let maxSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} +module.exports = maxSatisfying diff --git a/node_modules/npm/node_modules/semver/ranges/min-satisfying.js b/node_modules/npm/node_modules/semver/ranges/min-satisfying.js new file mode 100644 index 00000000..9b60974e --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/min-satisfying.js @@ -0,0 +1,24 @@ +const SemVer = require('../classes/semver') +const Range = require('../classes/range') +const minSatisfying = (versions, range, options) => { + let min = null + let minSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} +module.exports = minSatisfying diff --git a/node_modules/npm/node_modules/semver/ranges/min-version.js b/node_modules/npm/node_modules/semver/ranges/min-version.js new file mode 100644 index 00000000..350e1f78 --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/min-version.js @@ -0,0 +1,61 @@ +const SemVer = require('../classes/semver') +const Range = require('../classes/range') +const gt = require('../functions/gt') + +const minVersion = (range, loose) => { + range = new Range(range, loose) + + let minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let setMin = null + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!setMin || gt(compver, setMin)) { + setMin = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }) + if (setMin && (!minver || gt(minver, setMin))) { + minver = setMin + } + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} +module.exports = minVersion diff --git a/node_modules/npm/node_modules/semver/ranges/outside.js b/node_modules/npm/node_modules/semver/ranges/outside.js new file mode 100644 index 00000000..ae99b10a --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/outside.js @@ -0,0 +1,80 @@ +const SemVer = require('../classes/semver') +const Comparator = require('../classes/comparator') +const { ANY } = Comparator +const Range = require('../classes/range') +const satisfies = require('../functions/satisfies') +const gt = require('../functions/gt') +const lt = require('../functions/lt') +const lte = require('../functions/lte') +const gte = require('../functions/gte') + +const outside = (version, range, hilo, options) => { + version = new SemVer(version, options) + range = new Range(range, options) + + let gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisfies the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let high = null + let low = null + + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +module.exports = outside diff --git a/node_modules/npm/node_modules/semver/ranges/simplify.js b/node_modules/npm/node_modules/semver/ranges/simplify.js new file mode 100644 index 00000000..618d5b62 --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/simplify.js @@ -0,0 +1,47 @@ +// given a set of versions and a range, create a "simplified" range +// that includes the same versions that the original range does +// If the original range is shorter than the simplified one, return that. +const satisfies = require('../functions/satisfies.js') +const compare = require('../functions/compare.js') +module.exports = (versions, range, options) => { + const set = [] + let first = null + let prev = null + const v = versions.sort((a, b) => compare(a, b, options)) + for (const version of v) { + const included = satisfies(version, range, options) + if (included) { + prev = version + if (!first) { + first = version + } + } else { + if (prev) { + set.push([first, prev]) + } + prev = null + first = null + } + } + if (first) { + set.push([first, null]) + } + + const ranges = [] + for (const [min, max] of set) { + if (min === max) { + ranges.push(min) + } else if (!max && min === v[0]) { + ranges.push('*') + } else if (!max) { + ranges.push(`>=${min}`) + } else if (min === v[0]) { + ranges.push(`<=${max}`) + } else { + ranges.push(`${min} - ${max}`) + } + } + const simplified = ranges.join(' || ') + const original = typeof range.raw === 'string' ? range.raw : String(range) + return simplified.length < original.length ? simplified : range +} diff --git a/node_modules/npm/node_modules/semver/ranges/subset.js b/node_modules/npm/node_modules/semver/ranges/subset.js new file mode 100644 index 00000000..1e5c2683 --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/subset.js @@ -0,0 +1,247 @@ +const Range = require('../classes/range.js') +const Comparator = require('../classes/comparator.js') +const { ANY } = Comparator +const satisfies = require('../functions/satisfies.js') +const compare = require('../functions/compare.js') + +// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: +// - Every simple range `r1, r2, ...` is a null set, OR +// - Every simple range `r1, r2, ...` which is not a null set is a subset of +// some `R1, R2, ...` +// +// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: +// - If c is only the ANY comparator +// - If C is only the ANY comparator, return true +// - Else if in prerelease mode, return false +// - else replace c with `[>=0.0.0]` +// - If C is only the ANY comparator +// - if in prerelease mode, return true +// - else replace C with `[>=0.0.0]` +// - Let EQ be the set of = comparators in c +// - If EQ is more than one, return true (null set) +// - Let GT be the highest > or >= comparator in c +// - Let LT be the lowest < or <= comparator in c +// - If GT and LT, and GT.semver > LT.semver, return true (null set) +// - If any C is a = range, and GT or LT are set, return false +// - If EQ +// - If GT, and EQ does not satisfy GT, return true (null set) +// - If LT, and EQ does not satisfy LT, return true (null set) +// - If EQ satisfies every C, return true +// - Else return false +// - If GT +// - If GT.semver is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the GT.semver tuple, return false +// - If LT +// - If LT.semver is greater than any < or <= comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the LT.semver tuple, return false +// - Else return true + +const subset = (sub, dom, options = {}) => { + if (sub === dom) { + return true + } + + sub = new Range(sub, options) + dom = new Range(dom, options) + let sawNonNull = false + + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options) + sawNonNull = sawNonNull || isSub !== null + if (isSub) { + continue OUTER + } + } + // the null set is a subset of everything, but null simple ranges in + // a complex range should be ignored. so if we saw a non-null range, + // then we know this isn't a subset, but if EVERY simple range was null, + // then it is a subset. + if (sawNonNull) { + return false + } + } + return true +} + +const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')] +const minimumVersion = [new Comparator('>=0.0.0')] + +const simpleSubset = (sub, dom, options) => { + if (sub === dom) { + return true + } + + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true + } else if (options.includePrerelease) { + sub = minimumVersionWithPreRelease + } else { + sub = minimumVersion + } + } + + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true + } else { + dom = minimumVersion + } + } + + const eqSet = new Set() + let gt, lt + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') { + gt = higherGT(gt, c, options) + } else if (c.operator === '<' || c.operator === '<=') { + lt = lowerLT(lt, c, options) + } else { + eqSet.add(c.semver) + } + } + + if (eqSet.size > 1) { + return null + } + + let gtltComp + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options) + if (gtltComp > 0) { + return null + } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { + return null + } + } + + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) { + return null + } + + if (lt && !satisfies(eq, String(lt), options)) { + return null + } + + for (const c of dom) { + if (!satisfies(eq, String(c), options)) { + return false + } + } + + return true + } + + let higher, lower + let hasDomLT, hasDomGT + // if the subset has a prerelease, we need a comparator in the superset + // with the same tuple and a prerelease, or it's not a subset + let needDomLTPre = lt && + !options.includePrerelease && + lt.semver.prerelease.length ? lt.semver : false + let needDomGTPre = gt && + !options.includePrerelease && + gt.semver.prerelease.length ? gt.semver : false + // exception: <1.2.3-0 is the same as <1.2.3 + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && + lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false + } + + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomGTPre.major && + c.semver.minor === needDomGTPre.minor && + c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false + } + } + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c && higher !== gt) { + return false + } + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { + return false + } + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomLTPre.major && + c.semver.minor === needDomLTPre.minor && + c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false + } + } + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c && lower !== lt) { + return false + } + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { + return false + } + } + if (!c.operator && (lt || gt) && gtltComp !== 0) { + return false + } + } + + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) { + return false + } + + if (lt && hasDomGT && !gt && gtltComp !== 0) { + return false + } + + // we needed a prerelease range in a specific tuple, but didn't get one + // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, + // because it includes prereleases in the 1.2.3 tuple + if (needDomGTPre || needDomLTPre) { + return false + } + + return true +} + +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a +} + +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a +} + +module.exports = subset diff --git a/node_modules/npm/node_modules/semver/ranges/to-comparators.js b/node_modules/npm/node_modules/semver/ranges/to-comparators.js new file mode 100644 index 00000000..6c8bc7e6 --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/to-comparators.js @@ -0,0 +1,8 @@ +const Range = require('../classes/range') + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + +module.exports = toComparators diff --git a/node_modules/npm/node_modules/semver/ranges/valid.js b/node_modules/npm/node_modules/semver/ranges/valid.js new file mode 100644 index 00000000..365f3568 --- /dev/null +++ b/node_modules/npm/node_modules/semver/ranges/valid.js @@ -0,0 +1,11 @@ +const Range = require('../classes/range') +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} +module.exports = validRange diff --git a/node_modules/npm/node_modules/shebang-command/index.js b/node_modules/npm/node_modules/shebang-command/index.js new file mode 100644 index 00000000..f35db308 --- /dev/null +++ b/node_modules/npm/node_modules/shebang-command/index.js @@ -0,0 +1,19 @@ +'use strict'; +const shebangRegex = require('shebang-regex'); + +module.exports = (string = '') => { + const match = string.match(shebangRegex); + + if (!match) { + return null; + } + + const [path, argument] = match[0].replace(/#! ?/, '').split(' '); + const binary = path.split('/').pop(); + + if (binary === 'env') { + return argument; + } + + return argument ? `${binary} ${argument}` : binary; +}; diff --git a/node_modules/npm/node_modules/shebang-command/license b/node_modules/npm/node_modules/shebang-command/license new file mode 100644 index 00000000..db6bc32c --- /dev/null +++ b/node_modules/npm/node_modules/shebang-command/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Kevin Mårtensson (github.com/kevva) + +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/npm/node_modules/shebang-command/package.json b/node_modules/npm/node_modules/shebang-command/package.json new file mode 100644 index 00000000..18e3c046 --- /dev/null +++ b/node_modules/npm/node_modules/shebang-command/package.json @@ -0,0 +1,34 @@ +{ + "name": "shebang-command", + "version": "2.0.0", + "description": "Get the command from a shebang", + "license": "MIT", + "repository": "kevva/shebang-command", + "author": { + "name": "Kevin Mårtensson", + "email": "kevinmartensson@gmail.com", + "url": "github.com/kevva" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "cmd", + "command", + "parse", + "shebang" + ], + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "devDependencies": { + "ava": "^2.3.0", + "xo": "^0.24.0" + } +} diff --git a/node_modules/npm/node_modules/shebang-regex/index.js b/node_modules/npm/node_modules/shebang-regex/index.js new file mode 100644 index 00000000..63fc4a0b --- /dev/null +++ b/node_modules/npm/node_modules/shebang-regex/index.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = /^#!(.*)/; diff --git a/node_modules/npm/node_modules/shebang-regex/license b/node_modules/npm/node_modules/shebang-regex/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/npm/node_modules/shebang-regex/license @@ -0,0 +1,9 @@ +MIT License + +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/npm/node_modules/shebang-regex/package.json b/node_modules/npm/node_modules/shebang-regex/package.json new file mode 100644 index 00000000..00ab30fe --- /dev/null +++ b/node_modules/npm/node_modules/shebang-regex/package.json @@ -0,0 +1,35 @@ +{ + "name": "shebang-regex", + "version": "3.0.0", + "description": "Regular expression for matching a shebang line", + "license": "MIT", + "repository": "sindresorhus/shebang-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "regex", + "regexp", + "shebang", + "match", + "test", + "line" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/npm/node_modules/signal-exit/LICENSE.txt b/node_modules/npm/node_modules/signal-exit/LICENSE.txt new file mode 100644 index 00000000..954f2fa8 --- /dev/null +++ b/node_modules/npm/node_modules/signal-exit/LICENSE.txt @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) 2015-2023 Benjamin Coe, 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/npm/node_modules/signal-exit/dist/cjs/browser.js b/node_modules/npm/node_modules/signal-exit/dist/cjs/browser.js new file mode 100644 index 00000000..614fbf01 --- /dev/null +++ b/node_modules/npm/node_modules/signal-exit/dist/cjs/browser.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.unload = exports.load = exports.onExit = void 0; +const onExit = () => () => { }; +exports.onExit = onExit; +const load = () => { }; +exports.load = load; +const unload = () => { }; +exports.unload = unload; +//# sourceMappingURL=browser.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/signal-exit/dist/cjs/index.js b/node_modules/npm/node_modules/signal-exit/dist/cjs/index.js new file mode 100644 index 00000000..797e6743 --- /dev/null +++ b/node_modules/npm/node_modules/signal-exit/dist/cjs/index.js @@ -0,0 +1,279 @@ +"use strict"; +var _a; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.unload = exports.load = exports.onExit = exports.signals = void 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 +const signals_js_1 = require("./signals.js"); +Object.defineProperty(exports, "signals", { enumerable: true, get: function () { return signals_js_1.signals; } }); +const processOk = (process) => !!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'; +const kExitEmitter = Symbol.for('signal-exit emitter'); +const global = globalThis; +const ObjectDefineProperty = Object.defineProperty.bind(Object); +// teeny special purpose ee +class Emitter { + emitted = { + afterExit: false, + exit: false, + }; + listeners = { + afterExit: [], + exit: [], + }; + count = 0; + id = Math.random(); + constructor() { + if (global[kExitEmitter]) { + return global[kExitEmitter]; + } + ObjectDefineProperty(global, kExitEmitter, { + value: this, + writable: false, + enumerable: false, + configurable: false, + }); + } + on(ev, fn) { + this.listeners[ev].push(fn); + } + removeListener(ev, fn) { + const list = this.listeners[ev]; + const i = list.indexOf(fn); + /* c8 ignore start */ + if (i === -1) { + return; + } + /* c8 ignore stop */ + if (i === 0 && list.length === 1) { + list.length = 0; + } + else { + list.splice(i, 1); + } + } + emit(ev, code, signal) { + if (this.emitted[ev]) { + return false; + } + this.emitted[ev] = true; + let ret = false; + for (const fn of this.listeners[ev]) { + ret = fn(code, signal) === true || ret; + } + if (ev === 'exit') { + ret = this.emit('afterExit', code, signal) || ret; + } + return ret; + } +} +class SignalExitBase { +} +const signalExitWrap = (handler) => { + return { + onExit(cb, opts) { + return handler.onExit(cb, opts); + }, + load() { + return handler.load(); + }, + unload() { + return handler.unload(); + }, + }; +}; +class SignalExitFallback extends SignalExitBase { + onExit() { + return () => { }; + } + load() { } + unload() { } +} +class SignalExit extends SignalExitBase { + // "SIGHUP" throws an `ENOSYS` error on Windows, + // so use a supported signal instead + /* c8 ignore start */ + #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP'; + /* c8 ignore stop */ + #emitter = new Emitter(); + #process; + #originalProcessEmit; + #originalProcessReallyExit; + #sigListeners = {}; + #loaded = false; + constructor(process) { + super(); + this.#process = process; + // { : , ... } + this.#sigListeners = {}; + for (const sig of signals_js_1.signals) { + this.#sigListeners[sig] = () => { + // 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. + const listeners = this.#process.listeners(sig); + let { count } = this.#emitter; + // This is a workaround for the fact that signal-exit v3 and signal + // exit v4 are not aware of each other, and each will attempt to let + // the other handle it, so neither of them do. To correct this, we + // detect if we're the only handler *except* for previous versions + // of signal-exit, and increment by the count of listeners it has + // created. + /* c8 ignore start */ + const p = process; + if (typeof p.__signal_exit_emitter__ === 'object' && + typeof p.__signal_exit_emitter__.count === 'number') { + count += p.__signal_exit_emitter__.count; + } + /* c8 ignore stop */ + if (listeners.length === count) { + this.unload(); + const ret = this.#emitter.emit('exit', null, sig); + /* c8 ignore start */ + const s = sig === 'SIGHUP' ? this.#hupSig : sig; + if (!ret) + process.kill(process.pid, s); + /* c8 ignore stop */ + } + }; + } + this.#originalProcessReallyExit = process.reallyExit; + this.#originalProcessEmit = process.emit; + } + onExit(cb, opts) { + /* c8 ignore start */ + if (!processOk(this.#process)) { + return () => { }; + } + /* c8 ignore stop */ + if (this.#loaded === false) { + this.load(); + } + const ev = opts?.alwaysLast ? 'afterExit' : 'exit'; + this.#emitter.on(ev, cb); + return () => { + this.#emitter.removeListener(ev, cb); + if (this.#emitter.listeners['exit'].length === 0 && + this.#emitter.listeners['afterExit'].length === 0) { + this.unload(); + } + }; + } + load() { + if (this.#loaded) { + return; + } + this.#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. + this.#emitter.count += 1; + for (const sig of signals_js_1.signals) { + try { + const fn = this.#sigListeners[sig]; + if (fn) + this.#process.on(sig, fn); + } + catch (_) { } + } + this.#process.emit = (ev, ...a) => { + return this.#processEmit(ev, ...a); + }; + this.#process.reallyExit = (code) => { + return this.#processReallyExit(code); + }; + } + unload() { + if (!this.#loaded) { + return; + } + this.#loaded = false; + signals_js_1.signals.forEach(sig => { + const listener = this.#sigListeners[sig]; + /* c8 ignore start */ + if (!listener) { + throw new Error('Listener not defined for signal: ' + sig); + } + /* c8 ignore stop */ + try { + this.#process.removeListener(sig, listener); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + }); + this.#process.emit = this.#originalProcessEmit; + this.#process.reallyExit = this.#originalProcessReallyExit; + this.#emitter.count -= 1; + } + #processReallyExit(code) { + /* c8 ignore start */ + if (!processOk(this.#process)) { + return 0; + } + this.#process.exitCode = code || 0; + /* c8 ignore stop */ + this.#emitter.emit('exit', this.#process.exitCode, null); + return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode); + } + #processEmit(ev, ...args) { + const og = this.#originalProcessEmit; + if (ev === 'exit' && processOk(this.#process)) { + if (typeof args[0] === 'number') { + this.#process.exitCode = args[0]; + /* c8 ignore start */ + } + /* c8 ignore start */ + const ret = og.call(this.#process, ev, ...args); + /* c8 ignore start */ + this.#emitter.emit('exit', this.#process.exitCode, null); + /* c8 ignore stop */ + return ret; + } + else { + return og.call(this.#process, ev, ...args); + } + } +} +const process = globalThis.process; +// wrap so that we call the method on the actual handler, without +// exporting it directly. +_a = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback()), +/** + * Called when the process is exiting, whether via signal, explicit + * exit, or running out of stuff to do. + * + * If the global process object is not suitable for instrumentation, + * then this will be a no-op. + * + * Returns a function that may be used to unload signal-exit. + */ +exports.onExit = _a.onExit, +/** + * Load the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +exports.load = _a.load, +/** + * Unload the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +exports.unload = _a.unload; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/signal-exit/dist/cjs/package.json b/node_modules/npm/node_modules/signal-exit/dist/cjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/signal-exit/dist/cjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/signal-exit/dist/cjs/signals.js b/node_modules/npm/node_modules/signal-exit/dist/cjs/signals.js new file mode 100644 index 00000000..28afc502 --- /dev/null +++ b/node_modules/npm/node_modules/signal-exit/dist/cjs/signals.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.signals = void 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. + * + * Windows signals are a different set, since there are + * signals that terminate Windows processes, but don't + * terminate (or don't even exist) on Posix systems. + * + * 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. + */ +exports.signals = []; +exports.signals.push('SIGHUP', 'SIGINT', 'SIGTERM'); +if (process.platform !== 'win32') { + exports.signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT' + // should detect profiler and enable/disable accordingly. + // see #21 + // 'SIGPROF' + ); +} +if (process.platform === 'linux') { + exports.signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT'); +} +//# sourceMappingURL=signals.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/signal-exit/dist/mjs/browser.js b/node_modules/npm/node_modules/signal-exit/dist/mjs/browser.js new file mode 100644 index 00000000..9c5f9b9e --- /dev/null +++ b/node_modules/npm/node_modules/signal-exit/dist/mjs/browser.js @@ -0,0 +1,4 @@ +export const onExit = () => () => { }; +export const load = () => { }; +export const unload = () => { }; +//# sourceMappingURL=browser.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/signal-exit/dist/mjs/index.js b/node_modules/npm/node_modules/signal-exit/dist/mjs/index.js new file mode 100644 index 00000000..4a78bad8 --- /dev/null +++ b/node_modules/npm/node_modules/signal-exit/dist/mjs/index.js @@ -0,0 +1,275 @@ +// 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 +import { signals } from './signals.js'; +export { signals }; +const processOk = (process) => !!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'; +const kExitEmitter = Symbol.for('signal-exit emitter'); +const global = globalThis; +const ObjectDefineProperty = Object.defineProperty.bind(Object); +// teeny special purpose ee +class Emitter { + emitted = { + afterExit: false, + exit: false, + }; + listeners = { + afterExit: [], + exit: [], + }; + count = 0; + id = Math.random(); + constructor() { + if (global[kExitEmitter]) { + return global[kExitEmitter]; + } + ObjectDefineProperty(global, kExitEmitter, { + value: this, + writable: false, + enumerable: false, + configurable: false, + }); + } + on(ev, fn) { + this.listeners[ev].push(fn); + } + removeListener(ev, fn) { + const list = this.listeners[ev]; + const i = list.indexOf(fn); + /* c8 ignore start */ + if (i === -1) { + return; + } + /* c8 ignore stop */ + if (i === 0 && list.length === 1) { + list.length = 0; + } + else { + list.splice(i, 1); + } + } + emit(ev, code, signal) { + if (this.emitted[ev]) { + return false; + } + this.emitted[ev] = true; + let ret = false; + for (const fn of this.listeners[ev]) { + ret = fn(code, signal) === true || ret; + } + if (ev === 'exit') { + ret = this.emit('afterExit', code, signal) || ret; + } + return ret; + } +} +class SignalExitBase { +} +const signalExitWrap = (handler) => { + return { + onExit(cb, opts) { + return handler.onExit(cb, opts); + }, + load() { + return handler.load(); + }, + unload() { + return handler.unload(); + }, + }; +}; +class SignalExitFallback extends SignalExitBase { + onExit() { + return () => { }; + } + load() { } + unload() { } +} +class SignalExit extends SignalExitBase { + // "SIGHUP" throws an `ENOSYS` error on Windows, + // so use a supported signal instead + /* c8 ignore start */ + #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP'; + /* c8 ignore stop */ + #emitter = new Emitter(); + #process; + #originalProcessEmit; + #originalProcessReallyExit; + #sigListeners = {}; + #loaded = false; + constructor(process) { + super(); + this.#process = process; + // { : , ... } + this.#sigListeners = {}; + for (const sig of signals) { + this.#sigListeners[sig] = () => { + // 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. + const listeners = this.#process.listeners(sig); + let { count } = this.#emitter; + // This is a workaround for the fact that signal-exit v3 and signal + // exit v4 are not aware of each other, and each will attempt to let + // the other handle it, so neither of them do. To correct this, we + // detect if we're the only handler *except* for previous versions + // of signal-exit, and increment by the count of listeners it has + // created. + /* c8 ignore start */ + const p = process; + if (typeof p.__signal_exit_emitter__ === 'object' && + typeof p.__signal_exit_emitter__.count === 'number') { + count += p.__signal_exit_emitter__.count; + } + /* c8 ignore stop */ + if (listeners.length === count) { + this.unload(); + const ret = this.#emitter.emit('exit', null, sig); + /* c8 ignore start */ + const s = sig === 'SIGHUP' ? this.#hupSig : sig; + if (!ret) + process.kill(process.pid, s); + /* c8 ignore stop */ + } + }; + } + this.#originalProcessReallyExit = process.reallyExit; + this.#originalProcessEmit = process.emit; + } + onExit(cb, opts) { + /* c8 ignore start */ + if (!processOk(this.#process)) { + return () => { }; + } + /* c8 ignore stop */ + if (this.#loaded === false) { + this.load(); + } + const ev = opts?.alwaysLast ? 'afterExit' : 'exit'; + this.#emitter.on(ev, cb); + return () => { + this.#emitter.removeListener(ev, cb); + if (this.#emitter.listeners['exit'].length === 0 && + this.#emitter.listeners['afterExit'].length === 0) { + this.unload(); + } + }; + } + load() { + if (this.#loaded) { + return; + } + this.#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. + this.#emitter.count += 1; + for (const sig of signals) { + try { + const fn = this.#sigListeners[sig]; + if (fn) + this.#process.on(sig, fn); + } + catch (_) { } + } + this.#process.emit = (ev, ...a) => { + return this.#processEmit(ev, ...a); + }; + this.#process.reallyExit = (code) => { + return this.#processReallyExit(code); + }; + } + unload() { + if (!this.#loaded) { + return; + } + this.#loaded = false; + signals.forEach(sig => { + const listener = this.#sigListeners[sig]; + /* c8 ignore start */ + if (!listener) { + throw new Error('Listener not defined for signal: ' + sig); + } + /* c8 ignore stop */ + try { + this.#process.removeListener(sig, listener); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + }); + this.#process.emit = this.#originalProcessEmit; + this.#process.reallyExit = this.#originalProcessReallyExit; + this.#emitter.count -= 1; + } + #processReallyExit(code) { + /* c8 ignore start */ + if (!processOk(this.#process)) { + return 0; + } + this.#process.exitCode = code || 0; + /* c8 ignore stop */ + this.#emitter.emit('exit', this.#process.exitCode, null); + return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode); + } + #processEmit(ev, ...args) { + const og = this.#originalProcessEmit; + if (ev === 'exit' && processOk(this.#process)) { + if (typeof args[0] === 'number') { + this.#process.exitCode = args[0]; + /* c8 ignore start */ + } + /* c8 ignore start */ + const ret = og.call(this.#process, ev, ...args); + /* c8 ignore start */ + this.#emitter.emit('exit', this.#process.exitCode, null); + /* c8 ignore stop */ + return ret; + } + else { + return og.call(this.#process, ev, ...args); + } + } +} +const process = globalThis.process; +// wrap so that we call the method on the actual handler, without +// exporting it directly. +export const { +/** + * Called when the process is exiting, whether via signal, explicit + * exit, or running out of stuff to do. + * + * If the global process object is not suitable for instrumentation, + * then this will be a no-op. + * + * Returns a function that may be used to unload signal-exit. + */ +onExit, +/** + * Load the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +load, +/** + * Unload the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +unload, } = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback()); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/signal-exit/dist/mjs/package.json b/node_modules/npm/node_modules/signal-exit/dist/mjs/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/signal-exit/dist/mjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/signal-exit/dist/mjs/signals.js b/node_modules/npm/node_modules/signal-exit/dist/mjs/signals.js new file mode 100644 index 00000000..7dbf15a5 --- /dev/null +++ b/node_modules/npm/node_modules/signal-exit/dist/mjs/signals.js @@ -0,0 +1,39 @@ +/** + * 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. + * + * Windows signals are a different set, since there are + * signals that terminate Windows processes, but don't + * terminate (or don't even exist) on Posix systems. + * + * 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. + */ +export const signals = []; +signals.push('SIGHUP', 'SIGINT', 'SIGTERM'); +if (process.platform !== 'win32') { + signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT' + // should detect profiler and enable/disable accordingly. + // see #21 + // 'SIGPROF' + ); +} +if (process.platform === 'linux') { + signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT'); +} +//# sourceMappingURL=signals.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/signal-exit/package.json b/node_modules/npm/node_modules/signal-exit/package.json new file mode 100644 index 00000000..ac176cec --- /dev/null +++ b/node_modules/npm/node_modules/signal-exit/package.json @@ -0,0 +1,106 @@ +{ + "name": "signal-exit", + "version": "4.1.0", + "description": "when you want to fire an event no matter how a process exits.", + "main": "./dist/cjs/index.js", + "module": "./dist/mjs/index.js", + "browser": "./dist/mjs/browser.js", + "types": "./dist/mjs/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" + } + }, + "./signals": { + "import": { + "types": "./dist/mjs/signals.d.ts", + "default": "./dist/mjs/signals.js" + }, + "require": { + "types": "./dist/cjs/signals.d.ts", + "default": "./dist/cjs/signals.js" + } + }, + "./browser": { + "import": { + "types": "./dist/mjs/browser.d.ts", + "default": "./dist/mjs/browser.js" + }, + "require": { + "types": "./dist/cjs/browser.d.ts", + "default": "./dist/cjs/browser.js" + } + } + }, + "files": [ + "dist" + ], + "engines": { + "node": ">=14" + }, + "repository": { + "type": "git", + "url": "https://github.com/tapjs/signal-exit.git" + }, + "keywords": [ + "signal", + "exit" + ], + "author": "Ben Coe ", + "license": "ISC", + "devDependencies": { + "@types/cross-spawn": "^6.0.2", + "@types/node": "^18.15.11", + "@types/signal-exit": "^3.0.1", + "@types/tap": "^15.0.8", + "c8": "^7.13.0", + "prettier": "^2.8.6", + "tap": "^16.3.4", + "ts-node": "^10.9.1", + "typedoc": "^0.23.28", + "typescript": "^5.0.2" + }, + "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 ./scripts/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" + }, + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "tap": { + "coverage": false, + "jobs": 1, + "node-arg": [ + "--no-warnings", + "--loader", + "ts-node/esm" + ], + "ts": false + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } +} diff --git a/node_modules/npm/node_modules/sigstore/LICENSE b/node_modules/npm/node_modules/sigstore/LICENSE new file mode 100644 index 00000000..e9e7c167 --- /dev/null +++ b/node_modules/npm/node_modules/sigstore/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 The Sigstore Authors + + 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. diff --git a/node_modules/npm/node_modules/sigstore/dist/config.js b/node_modules/npm/node_modules/sigstore/dist/config.js new file mode 100644 index 00000000..e8b2392f --- /dev/null +++ b/node_modules/npm/node_modules/sigstore/dist/config.js @@ -0,0 +1,120 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DEFAULT_TIMEOUT = exports.DEFAULT_RETRY = void 0; +exports.createBundleBuilder = createBundleBuilder; +exports.createKeyFinder = createKeyFinder; +exports.createVerificationPolicy = createVerificationPolicy; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const core_1 = require("@sigstore/core"); +const sign_1 = require("@sigstore/sign"); +const verify_1 = require("@sigstore/verify"); +exports.DEFAULT_RETRY = { retries: 2 }; +exports.DEFAULT_TIMEOUT = 5000; +function createBundleBuilder(bundleType, options) { + const bundlerOptions = { + signer: initSigner(options), + witnesses: initWitnesses(options), + }; + switch (bundleType) { + case 'messageSignature': + return new sign_1.MessageSignatureBundleBuilder(bundlerOptions); + case 'dsseEnvelope': + return new sign_1.DSSEBundleBuilder({ + ...bundlerOptions, + certificateChain: options.legacyCompatibility, + }); + } +} +// Translates the public KeySelector type into the KeyFinderFunc type needed by +// the verifier. +function createKeyFinder(keySelector) { + return (hint) => { + const key = keySelector(hint); + if (!key) { + throw new verify_1.VerificationError({ + code: 'PUBLIC_KEY_ERROR', + message: `key not found: ${hint}`, + }); + } + return { + publicKey: core_1.crypto.createPublicKey(key), + validFor: () => true, + }; + }; +} +function createVerificationPolicy(options) { + const policy = {}; + const san = options.certificateIdentityEmail || options.certificateIdentityURI; + if (san) { + policy.subjectAlternativeName = san; + } + if (options.certificateIssuer) { + policy.extensions = { issuer: options.certificateIssuer }; + } + return policy; +} +// Instantiate the FulcioSigner based on the supplied options. +function initSigner(options) { + return new sign_1.FulcioSigner({ + fulcioBaseURL: options.fulcioURL, + identityProvider: options.identityProvider || initIdentityProvider(options), + retry: options.retry ?? exports.DEFAULT_RETRY, + timeout: options.timeout ?? exports.DEFAULT_TIMEOUT, + }); +} +// Instantiate an identity provider based on the supplied options. If an +// explicit identity token is provided, use that. Otherwise, use the CI +// context provider. +function initIdentityProvider(options) { + const token = options.identityToken; + if (token) { + /* istanbul ignore next */ + return { getToken: () => Promise.resolve(token) }; + } + else { + return new sign_1.CIContextProvider('sigstore'); + } +} +// Instantiate a collection of witnesses based on the supplied options. +function initWitnesses(options) { + const witnesses = []; + if (isRekorEnabled(options)) { + witnesses.push(new sign_1.RekorWitness({ + rekorBaseURL: options.rekorURL, + entryType: options.legacyCompatibility ? 'intoto' : 'dsse', + fetchOnConflict: false, + retry: options.retry ?? exports.DEFAULT_RETRY, + timeout: options.timeout ?? exports.DEFAULT_TIMEOUT, + })); + } + if (isTSAEnabled(options)) { + witnesses.push(new sign_1.TSAWitness({ + tsaBaseURL: options.tsaServerURL, + retry: options.retry ?? exports.DEFAULT_RETRY, + timeout: options.timeout ?? exports.DEFAULT_TIMEOUT, + })); + } + return witnesses; +} +// Type assertion to ensure that Rekor is enabled +function isRekorEnabled(options) { + return options.tlogUpload !== false; +} +// Type assertion to ensure that TSA is enabled +function isTSAEnabled(options) { + return options.tsaServerURL !== undefined; +} diff --git a/node_modules/npm/node_modules/sigstore/dist/index.js b/node_modules/npm/node_modules/sigstore/dist/index.js new file mode 100644 index 00000000..7f6a5cf8 --- /dev/null +++ b/node_modules/npm/node_modules/sigstore/dist/index.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verify = exports.sign = exports.createVerifier = exports.attest = exports.VerificationError = exports.PolicyError = exports.TUFError = exports.InternalError = exports.DEFAULT_REKOR_URL = exports.DEFAULT_FULCIO_URL = exports.ValidationError = void 0; +/* +Copyright 2022 The Sigstore Authors. + +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. +*/ +var bundle_1 = require("@sigstore/bundle"); +Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return bundle_1.ValidationError; } }); +var sign_1 = require("@sigstore/sign"); +Object.defineProperty(exports, "DEFAULT_FULCIO_URL", { enumerable: true, get: function () { return sign_1.DEFAULT_FULCIO_URL; } }); +Object.defineProperty(exports, "DEFAULT_REKOR_URL", { enumerable: true, get: function () { return sign_1.DEFAULT_REKOR_URL; } }); +Object.defineProperty(exports, "InternalError", { enumerable: true, get: function () { return sign_1.InternalError; } }); +var tuf_1 = require("@sigstore/tuf"); +Object.defineProperty(exports, "TUFError", { enumerable: true, get: function () { return tuf_1.TUFError; } }); +var verify_1 = require("@sigstore/verify"); +Object.defineProperty(exports, "PolicyError", { enumerable: true, get: function () { return verify_1.PolicyError; } }); +Object.defineProperty(exports, "VerificationError", { enumerable: true, get: function () { return verify_1.VerificationError; } }); +var sigstore_1 = require("./sigstore"); +Object.defineProperty(exports, "attest", { enumerable: true, get: function () { return sigstore_1.attest; } }); +Object.defineProperty(exports, "createVerifier", { enumerable: true, get: function () { return sigstore_1.createVerifier; } }); +Object.defineProperty(exports, "sign", { enumerable: true, get: function () { return sigstore_1.sign; } }); +Object.defineProperty(exports, "verify", { enumerable: true, get: function () { return sigstore_1.verify; } }); diff --git a/node_modules/npm/node_modules/sigstore/dist/sigstore.js b/node_modules/npm/node_modules/sigstore/dist/sigstore.js new file mode 100644 index 00000000..2b37ef46 --- /dev/null +++ b/node_modules/npm/node_modules/sigstore/dist/sigstore.js @@ -0,0 +1,102 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sign = sign; +exports.attest = attest; +exports.verify = verify; +exports.createVerifier = createVerifier; +/* +Copyright 2023 The Sigstore Authors. + +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. +*/ +const bundle_1 = require("@sigstore/bundle"); +const tuf = __importStar(require("@sigstore/tuf")); +const verify_1 = require("@sigstore/verify"); +const config = __importStar(require("./config")); +async function sign(payload, +/* istanbul ignore next */ +options = {}) { + const bundler = config.createBundleBuilder('messageSignature', options); + const bundle = await bundler.create({ data: payload }); + return (0, bundle_1.bundleToJSON)(bundle); +} +async function attest(payload, payloadType, +/* istanbul ignore next */ +options = {}) { + const bundler = config.createBundleBuilder('dsseEnvelope', options); + const bundle = await bundler.create({ data: payload, type: payloadType }); + return (0, bundle_1.bundleToJSON)(bundle); +} +async function verify(bundle, dataOrOptions, options) { + let data; + if (Buffer.isBuffer(dataOrOptions)) { + data = dataOrOptions; + } + else { + options = dataOrOptions; + } + return createVerifier(options).then((verifier) => verifier.verify(bundle, data)); +} +async function createVerifier( +/* istanbul ignore next */ +options = {}) { + const trustedRoot = await tuf.getTrustedRoot({ + mirrorURL: options.tufMirrorURL, + rootPath: options.tufRootPath, + cachePath: options.tufCachePath, + forceCache: options.tufForceCache, + retry: options.retry ?? config.DEFAULT_RETRY, + timeout: options.timeout ?? config.DEFAULT_TIMEOUT, + }); + const keyFinder = options.keySelector + ? config.createKeyFinder(options.keySelector) + : undefined; + const trustMaterial = (0, verify_1.toTrustMaterial)(trustedRoot, keyFinder); + const verifierOptions = { + ctlogThreshold: options.ctLogThreshold, + tlogThreshold: options.tlogThreshold, + }; + const verifier = new verify_1.Verifier(trustMaterial, verifierOptions); + const policy = config.createVerificationPolicy(options); + return { + verify: (bundle, payload) => { + const deserializedBundle = (0, bundle_1.bundleFromJSON)(bundle); + const signedEntity = (0, verify_1.toSignedEntity)(deserializedBundle, payload); + verifier.verify(signedEntity, policy); + return; + }, + }; +} diff --git a/node_modules/npm/node_modules/sigstore/package.json b/node_modules/npm/node_modules/sigstore/package.json new file mode 100644 index 00000000..0f798a26 --- /dev/null +++ b/node_modules/npm/node_modules/sigstore/package.json @@ -0,0 +1,47 @@ +{ + "name": "sigstore", + "version": "3.0.0", + "description": "code-signing for npm packages", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "clean": "shx rm -rf dist *.tsbuildinfo", + "build": "tsc --build", + "test": "jest" + }, + "files": [ + "dist", + "store" + ], + "author": "bdehamer@github.com", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/sigstore/sigstore-js.git" + }, + "bugs": { + "url": "https://github.com/sigstore/sigstore-js/issues" + }, + "homepage": "https://github.com/sigstore/sigstore-js/tree/main/packages/client#readme", + "publishConfig": { + "provenance": true + }, + "devDependencies": { + "@sigstore/rekor-types": "^3.0.0", + "@sigstore/jest": "^0.0.0", + "@sigstore/mock": "^0.8.0", + "@tufjs/repo-mock": "^3.0.1", + "@types/make-fetch-happen": "^10.0.4" + }, + "dependencies": { + "@sigstore/bundle": "^3.0.0", + "@sigstore/core": "^2.0.0", + "@sigstore/protobuf-specs": "^0.3.2", + "@sigstore/sign": "^3.0.0", + "@sigstore/tuf": "^3.0.0", + "@sigstore/verify": "^2.0.0" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } +} diff --git a/node_modules/npm/node_modules/smart-buffer/LICENSE b/node_modules/npm/node_modules/smart-buffer/LICENSE new file mode 100644 index 00000000..aab5771a --- /dev/null +++ b/node_modules/npm/node_modules/smart-buffer/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013-2017 Josh Glazebrook + +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/npm/node_modules/smart-buffer/build/smartbuffer.js b/node_modules/npm/node_modules/smart-buffer/build/smartbuffer.js new file mode 100644 index 00000000..5353ae11 --- /dev/null +++ b/node_modules/npm/node_modules/smart-buffer/build/smartbuffer.js @@ -0,0 +1,1233 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const utils_1 = require("./utils"); +// The default Buffer size if one is not provided. +const DEFAULT_SMARTBUFFER_SIZE = 4096; +// The default string encoding to use for reading/writing strings. +const DEFAULT_SMARTBUFFER_ENCODING = 'utf8'; +class SmartBuffer { + /** + * Creates a new SmartBuffer instance. + * + * @param options { SmartBufferOptions } The SmartBufferOptions to apply to this instance. + */ + constructor(options) { + this.length = 0; + this._encoding = DEFAULT_SMARTBUFFER_ENCODING; + this._writeOffset = 0; + this._readOffset = 0; + if (SmartBuffer.isSmartBufferOptions(options)) { + // Checks for encoding + if (options.encoding) { + utils_1.checkEncoding(options.encoding); + this._encoding = options.encoding; + } + // Checks for initial size length + if (options.size) { + if (utils_1.isFiniteInteger(options.size) && options.size > 0) { + this._buff = Buffer.allocUnsafe(options.size); + } + else { + throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_SIZE); + } + // Check for initial Buffer + } + else if (options.buff) { + if (Buffer.isBuffer(options.buff)) { + this._buff = options.buff; + this.length = options.buff.length; + } + else { + throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_BUFFER); + } + } + else { + this._buff = Buffer.allocUnsafe(DEFAULT_SMARTBUFFER_SIZE); + } + } + else { + // If something was passed but it's not a SmartBufferOptions object + if (typeof options !== 'undefined') { + throw new Error(utils_1.ERRORS.INVALID_SMARTBUFFER_OBJECT); + } + // Otherwise default to sane options + this._buff = Buffer.allocUnsafe(DEFAULT_SMARTBUFFER_SIZE); + } + } + /** + * Creates a new SmartBuffer instance with the provided internal Buffer size and optional encoding. + * + * @param size { Number } The size of the internal Buffer. + * @param encoding { String } The BufferEncoding to use for strings. + * + * @return { SmartBuffer } + */ + static fromSize(size, encoding) { + return new this({ + size: size, + encoding: encoding + }); + } + /** + * Creates a new SmartBuffer instance with the provided Buffer and optional encoding. + * + * @param buffer { Buffer } The Buffer to use as the internal Buffer value. + * @param encoding { String } The BufferEncoding to use for strings. + * + * @return { SmartBuffer } + */ + static fromBuffer(buff, encoding) { + return new this({ + buff: buff, + encoding: encoding + }); + } + /** + * Creates a new SmartBuffer instance with the provided SmartBufferOptions options. + * + * @param options { SmartBufferOptions } The options to use when creating the SmartBuffer instance. + */ + static fromOptions(options) { + return new this(options); + } + /** + * Type checking function that determines if an object is a SmartBufferOptions object. + */ + static isSmartBufferOptions(options) { + const castOptions = options; + return (castOptions && + (castOptions.encoding !== undefined || castOptions.size !== undefined || castOptions.buff !== undefined)); + } + // Signed integers + /** + * Reads an Int8 value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt8(offset) { + return this._readNumberValue(Buffer.prototype.readInt8, 1, offset); + } + /** + * Reads an Int16BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt16BE(offset) { + return this._readNumberValue(Buffer.prototype.readInt16BE, 2, offset); + } + /** + * Reads an Int16LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt16LE(offset) { + return this._readNumberValue(Buffer.prototype.readInt16LE, 2, offset); + } + /** + * Reads an Int32BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt32BE(offset) { + return this._readNumberValue(Buffer.prototype.readInt32BE, 4, offset); + } + /** + * Reads an Int32LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readInt32LE(offset) { + return this._readNumberValue(Buffer.prototype.readInt32LE, 4, offset); + } + /** + * Reads a BigInt64BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigInt64BE(offset) { + utils_1.bigIntAndBufferInt64Check('readBigInt64BE'); + return this._readNumberValue(Buffer.prototype.readBigInt64BE, 8, offset); + } + /** + * Reads a BigInt64LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigInt64LE(offset) { + utils_1.bigIntAndBufferInt64Check('readBigInt64LE'); + return this._readNumberValue(Buffer.prototype.readBigInt64LE, 8, offset); + } + /** + * Writes an Int8 value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt8(value, offset) { + this._writeNumberValue(Buffer.prototype.writeInt8, 1, value, offset); + return this; + } + /** + * Inserts an Int8 value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt8(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt8, 1, value, offset); + } + /** + * Writes an Int16BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt16BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt16BE, 2, value, offset); + } + /** + * Inserts an Int16BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt16BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt16BE, 2, value, offset); + } + /** + * Writes an Int16LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt16LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt16LE, 2, value, offset); + } + /** + * Inserts an Int16LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt16LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt16LE, 2, value, offset); + } + /** + * Writes an Int32BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt32BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt32BE, 4, value, offset); + } + /** + * Inserts an Int32BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt32BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt32BE, 4, value, offset); + } + /** + * Writes an Int32LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeInt32LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeInt32LE, 4, value, offset); + } + /** + * Inserts an Int32LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertInt32LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeInt32LE, 4, value, offset); + } + /** + * Writes a BigInt64BE value to the current write position (or at optional offset). + * + * @param value { BigInt } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeBigInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigInt64BE'); + return this._writeNumberValue(Buffer.prototype.writeBigInt64BE, 8, value, offset); + } + /** + * Inserts a BigInt64BE value at the given offset value. + * + * @param value { BigInt } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertBigInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigInt64BE'); + return this._insertNumberValue(Buffer.prototype.writeBigInt64BE, 8, value, offset); + } + /** + * Writes a BigInt64LE value to the current write position (or at optional offset). + * + * @param value { BigInt } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeBigInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigInt64LE'); + return this._writeNumberValue(Buffer.prototype.writeBigInt64LE, 8, value, offset); + } + /** + * Inserts a Int64LE value at the given offset value. + * + * @param value { BigInt } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertBigInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigInt64LE'); + return this._insertNumberValue(Buffer.prototype.writeBigInt64LE, 8, value, offset); + } + // Unsigned Integers + /** + * Reads an UInt8 value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt8(offset) { + return this._readNumberValue(Buffer.prototype.readUInt8, 1, offset); + } + /** + * Reads an UInt16BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt16BE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt16BE, 2, offset); + } + /** + * Reads an UInt16LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt16LE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt16LE, 2, offset); + } + /** + * Reads an UInt32BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt32BE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt32BE, 4, offset); + } + /** + * Reads an UInt32LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readUInt32LE(offset) { + return this._readNumberValue(Buffer.prototype.readUInt32LE, 4, offset); + } + /** + * Reads a BigUInt64BE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigUInt64BE(offset) { + utils_1.bigIntAndBufferInt64Check('readBigUInt64BE'); + return this._readNumberValue(Buffer.prototype.readBigUInt64BE, 8, offset); + } + /** + * Reads a BigUInt64LE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { BigInt } + */ + readBigUInt64LE(offset) { + utils_1.bigIntAndBufferInt64Check('readBigUInt64LE'); + return this._readNumberValue(Buffer.prototype.readBigUInt64LE, 8, offset); + } + /** + * Writes an UInt8 value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt8(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt8, 1, value, offset); + } + /** + * Inserts an UInt8 value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt8(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt8, 1, value, offset); + } + /** + * Writes an UInt16BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt16BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt16BE, 2, value, offset); + } + /** + * Inserts an UInt16BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt16BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt16BE, 2, value, offset); + } + /** + * Writes an UInt16LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt16LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt16LE, 2, value, offset); + } + /** + * Inserts an UInt16LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt16LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt16LE, 2, value, offset); + } + /** + * Writes an UInt32BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt32BE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt32BE, 4, value, offset); + } + /** + * Inserts an UInt32BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt32BE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt32BE, 4, value, offset); + } + /** + * Writes an UInt32LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeUInt32LE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeUInt32LE, 4, value, offset); + } + /** + * Inserts an UInt32LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertUInt32LE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeUInt32LE, 4, value, offset); + } + /** + * Writes a BigUInt64BE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeBigUInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigUInt64BE'); + return this._writeNumberValue(Buffer.prototype.writeBigUInt64BE, 8, value, offset); + } + /** + * Inserts a BigUInt64BE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertBigUInt64BE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigUInt64BE'); + return this._insertNumberValue(Buffer.prototype.writeBigUInt64BE, 8, value, offset); + } + /** + * Writes a BigUInt64LE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeBigUInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigUInt64LE'); + return this._writeNumberValue(Buffer.prototype.writeBigUInt64LE, 8, value, offset); + } + /** + * Inserts a BigUInt64LE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertBigUInt64LE(value, offset) { + utils_1.bigIntAndBufferInt64Check('writeBigUInt64LE'); + return this._insertNumberValue(Buffer.prototype.writeBigUInt64LE, 8, value, offset); + } + // Floating Point + /** + * Reads an FloatBE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readFloatBE(offset) { + return this._readNumberValue(Buffer.prototype.readFloatBE, 4, offset); + } + /** + * Reads an FloatLE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readFloatLE(offset) { + return this._readNumberValue(Buffer.prototype.readFloatLE, 4, offset); + } + /** + * Writes a FloatBE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeFloatBE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeFloatBE, 4, value, offset); + } + /** + * Inserts a FloatBE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertFloatBE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeFloatBE, 4, value, offset); + } + /** + * Writes a FloatLE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeFloatLE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeFloatLE, 4, value, offset); + } + /** + * Inserts a FloatLE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertFloatLE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeFloatLE, 4, value, offset); + } + // Double Floating Point + /** + * Reads an DoublEBE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readDoubleBE(offset) { + return this._readNumberValue(Buffer.prototype.readDoubleBE, 8, offset); + } + /** + * Reads an DoubleLE value from the current read position or an optionally provided offset. + * + * @param offset { Number } The offset to read data from (optional) + * @return { Number } + */ + readDoubleLE(offset) { + return this._readNumberValue(Buffer.prototype.readDoubleLE, 8, offset); + } + /** + * Writes a DoubleBE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeDoubleBE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeDoubleBE, 8, value, offset); + } + /** + * Inserts a DoubleBE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertDoubleBE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeDoubleBE, 8, value, offset); + } + /** + * Writes a DoubleLE value to the current write position (or at optional offset). + * + * @param value { Number } The value to write. + * @param offset { Number } The offset to write the value at. + * + * @return this + */ + writeDoubleLE(value, offset) { + return this._writeNumberValue(Buffer.prototype.writeDoubleLE, 8, value, offset); + } + /** + * Inserts a DoubleLE value at the given offset value. + * + * @param value { Number } The value to insert. + * @param offset { Number } The offset to insert the value at. + * + * @return this + */ + insertDoubleLE(value, offset) { + return this._insertNumberValue(Buffer.prototype.writeDoubleLE, 8, value, offset); + } + // Strings + /** + * Reads a String from the current read position. + * + * @param arg1 { Number | String } The number of bytes to read as a String, or the BufferEncoding to use for + * the string (Defaults to instance level encoding). + * @param encoding { String } The BufferEncoding to use for the string (Defaults to instance level encoding). + * + * @return { String } + */ + readString(arg1, encoding) { + let lengthVal; + // Length provided + if (typeof arg1 === 'number') { + utils_1.checkLengthValue(arg1); + lengthVal = Math.min(arg1, this.length - this._readOffset); + } + else { + encoding = arg1; + lengthVal = this.length - this._readOffset; + } + // Check encoding + if (typeof encoding !== 'undefined') { + utils_1.checkEncoding(encoding); + } + const value = this._buff.slice(this._readOffset, this._readOffset + lengthVal).toString(encoding || this._encoding); + this._readOffset += lengthVal; + return value; + } + /** + * Inserts a String + * + * @param value { String } The String value to insert. + * @param offset { Number } The offset to insert the string at. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + insertString(value, offset, encoding) { + utils_1.checkOffsetValue(offset); + return this._handleString(value, true, offset, encoding); + } + /** + * Writes a String + * + * @param value { String } The String value to write. + * @param arg2 { Number | String } The offset to write the string at, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + writeString(value, arg2, encoding) { + return this._handleString(value, false, arg2, encoding); + } + /** + * Reads a null-terminated String from the current read position. + * + * @param encoding { String } The BufferEncoding to use for the string (Defaults to instance level encoding). + * + * @return { String } + */ + readStringNT(encoding) { + if (typeof encoding !== 'undefined') { + utils_1.checkEncoding(encoding); + } + // Set null character position to the end SmartBuffer instance. + let nullPos = this.length; + // Find next null character (if one is not found, default from above is used) + for (let i = this._readOffset; i < this.length; i++) { + if (this._buff[i] === 0x00) { + nullPos = i; + break; + } + } + // Read string value + const value = this._buff.slice(this._readOffset, nullPos); + // Increment internal Buffer read offset + this._readOffset = nullPos + 1; + return value.toString(encoding || this._encoding); + } + /** + * Inserts a null-terminated String. + * + * @param value { String } The String value to write. + * @param arg2 { Number | String } The offset to write the string to, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + insertStringNT(value, offset, encoding) { + utils_1.checkOffsetValue(offset); + // Write Values + this.insertString(value, offset, encoding); + this.insertUInt8(0x00, offset + value.length); + return this; + } + /** + * Writes a null-terminated String. + * + * @param value { String } The String value to write. + * @param arg2 { Number | String } The offset to write the string to, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + * + * @return this + */ + writeStringNT(value, arg2, encoding) { + // Write Values + this.writeString(value, arg2, encoding); + this.writeUInt8(0x00, typeof arg2 === 'number' ? arg2 + value.length : this.writeOffset); + return this; + } + // Buffers + /** + * Reads a Buffer from the internal read position. + * + * @param length { Number } The length of data to read as a Buffer. + * + * @return { Buffer } + */ + readBuffer(length) { + if (typeof length !== 'undefined') { + utils_1.checkLengthValue(length); + } + const lengthVal = typeof length === 'number' ? length : this.length; + const endPoint = Math.min(this.length, this._readOffset + lengthVal); + // Read buffer value + const value = this._buff.slice(this._readOffset, endPoint); + // Increment internal Buffer read offset + this._readOffset = endPoint; + return value; + } + /** + * Writes a Buffer to the current write position. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + insertBuffer(value, offset) { + utils_1.checkOffsetValue(offset); + return this._handleBuffer(value, true, offset); + } + /** + * Writes a Buffer to the current write position. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + writeBuffer(value, offset) { + return this._handleBuffer(value, false, offset); + } + /** + * Reads a null-terminated Buffer from the current read poisiton. + * + * @return { Buffer } + */ + readBufferNT() { + // Set null character position to the end SmartBuffer instance. + let nullPos = this.length; + // Find next null character (if one is not found, default from above is used) + for (let i = this._readOffset; i < this.length; i++) { + if (this._buff[i] === 0x00) { + nullPos = i; + break; + } + } + // Read value + const value = this._buff.slice(this._readOffset, nullPos); + // Increment internal Buffer read offset + this._readOffset = nullPos + 1; + return value; + } + /** + * Inserts a null-terminated Buffer. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + insertBufferNT(value, offset) { + utils_1.checkOffsetValue(offset); + // Write Values + this.insertBuffer(value, offset); + this.insertUInt8(0x00, offset + value.length); + return this; + } + /** + * Writes a null-terminated Buffer. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + * + * @return this + */ + writeBufferNT(value, offset) { + // Checks for valid numberic value; + if (typeof offset !== 'undefined') { + utils_1.checkOffsetValue(offset); + } + // Write Values + this.writeBuffer(value, offset); + this.writeUInt8(0x00, typeof offset === 'number' ? offset + value.length : this._writeOffset); + return this; + } + /** + * Clears the SmartBuffer instance to its original empty state. + */ + clear() { + this._writeOffset = 0; + this._readOffset = 0; + this.length = 0; + return this; + } + /** + * Gets the remaining data left to be read from the SmartBuffer instance. + * + * @return { Number } + */ + remaining() { + return this.length - this._readOffset; + } + /** + * Gets the current read offset value of the SmartBuffer instance. + * + * @return { Number } + */ + get readOffset() { + return this._readOffset; + } + /** + * Sets the read offset value of the SmartBuffer instance. + * + * @param offset { Number } - The offset value to set. + */ + set readOffset(offset) { + utils_1.checkOffsetValue(offset); + // Check for bounds. + utils_1.checkTargetOffset(offset, this); + this._readOffset = offset; + } + /** + * Gets the current write offset value of the SmartBuffer instance. + * + * @return { Number } + */ + get writeOffset() { + return this._writeOffset; + } + /** + * Sets the write offset value of the SmartBuffer instance. + * + * @param offset { Number } - The offset value to set. + */ + set writeOffset(offset) { + utils_1.checkOffsetValue(offset); + // Check for bounds. + utils_1.checkTargetOffset(offset, this); + this._writeOffset = offset; + } + /** + * Gets the currently set string encoding of the SmartBuffer instance. + * + * @return { BufferEncoding } The string Buffer encoding currently set. + */ + get encoding() { + return this._encoding; + } + /** + * Sets the string encoding of the SmartBuffer instance. + * + * @param encoding { BufferEncoding } The string Buffer encoding to set. + */ + set encoding(encoding) { + utils_1.checkEncoding(encoding); + this._encoding = encoding; + } + /** + * Gets the underlying internal Buffer. (This includes unmanaged data in the Buffer) + * + * @return { Buffer } The Buffer value. + */ + get internalBuffer() { + return this._buff; + } + /** + * Gets the value of the internal managed Buffer (Includes managed data only) + * + * @param { Buffer } + */ + toBuffer() { + return this._buff.slice(0, this.length); + } + /** + * Gets the String value of the internal managed Buffer + * + * @param encoding { String } The BufferEncoding to display the Buffer as (defaults to instance level encoding). + */ + toString(encoding) { + const encodingVal = typeof encoding === 'string' ? encoding : this._encoding; + // Check for invalid encoding. + utils_1.checkEncoding(encodingVal); + return this._buff.toString(encodingVal, 0, this.length); + } + /** + * Destroys the SmartBuffer instance. + */ + destroy() { + this.clear(); + return this; + } + /** + * Handles inserting and writing strings. + * + * @param value { String } The String value to insert. + * @param isInsert { Boolean } True if inserting a string, false if writing. + * @param arg2 { Number | String } The offset to insert the string at, or the BufferEncoding to use. + * @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding). + */ + _handleString(value, isInsert, arg3, encoding) { + let offsetVal = this._writeOffset; + let encodingVal = this._encoding; + // Check for offset + if (typeof arg3 === 'number') { + offsetVal = arg3; + // Check for encoding + } + else if (typeof arg3 === 'string') { + utils_1.checkEncoding(arg3); + encodingVal = arg3; + } + // Check for encoding (third param) + if (typeof encoding === 'string') { + utils_1.checkEncoding(encoding); + encodingVal = encoding; + } + // Calculate bytelength of string. + const byteLength = Buffer.byteLength(value, encodingVal); + // Ensure there is enough internal Buffer capacity. + if (isInsert) { + this.ensureInsertable(byteLength, offsetVal); + } + else { + this._ensureWriteable(byteLength, offsetVal); + } + // Write value + this._buff.write(value, offsetVal, byteLength, encodingVal); + // Increment internal Buffer write offset; + if (isInsert) { + this._writeOffset += byteLength; + } + else { + // If an offset was given, check to see if we wrote beyond the current writeOffset. + if (typeof arg3 === 'number') { + this._writeOffset = Math.max(this._writeOffset, offsetVal + byteLength); + } + else { + // If no offset was given, we wrote to the end of the SmartBuffer so increment writeOffset. + this._writeOffset += byteLength; + } + } + return this; + } + /** + * Handles writing or insert of a Buffer. + * + * @param value { Buffer } The Buffer to write. + * @param offset { Number } The offset to write the Buffer to. + */ + _handleBuffer(value, isInsert, offset) { + const offsetVal = typeof offset === 'number' ? offset : this._writeOffset; + // Ensure there is enough internal Buffer capacity. + if (isInsert) { + this.ensureInsertable(value.length, offsetVal); + } + else { + this._ensureWriteable(value.length, offsetVal); + } + // Write buffer value + value.copy(this._buff, offsetVal); + // Increment internal Buffer write offset; + if (isInsert) { + this._writeOffset += value.length; + } + else { + // If an offset was given, check to see if we wrote beyond the current writeOffset. + if (typeof offset === 'number') { + this._writeOffset = Math.max(this._writeOffset, offsetVal + value.length); + } + else { + // If no offset was given, we wrote to the end of the SmartBuffer so increment writeOffset. + this._writeOffset += value.length; + } + } + return this; + } + /** + * Ensures that the internal Buffer is large enough to read data. + * + * @param length { Number } The length of the data that needs to be read. + * @param offset { Number } The offset of the data that needs to be read. + */ + ensureReadable(length, offset) { + // Offset value defaults to managed read offset. + let offsetVal = this._readOffset; + // If an offset was provided, use it. + if (typeof offset !== 'undefined') { + // Checks for valid numberic value; + utils_1.checkOffsetValue(offset); + // Overide with custom offset. + offsetVal = offset; + } + // Checks if offset is below zero, or the offset+length offset is beyond the total length of the managed data. + if (offsetVal < 0 || offsetVal + length > this.length) { + throw new Error(utils_1.ERRORS.INVALID_READ_BEYOND_BOUNDS); + } + } + /** + * Ensures that the internal Buffer is large enough to insert data. + * + * @param dataLength { Number } The length of the data that needs to be written. + * @param offset { Number } The offset of the data to be written. + */ + ensureInsertable(dataLength, offset) { + // Checks for valid numberic value; + utils_1.checkOffsetValue(offset); + // Ensure there is enough internal Buffer capacity. + this._ensureCapacity(this.length + dataLength); + // If an offset was provided and its not the very end of the buffer, copy data into appropriate location in regards to the offset. + if (offset < this.length) { + this._buff.copy(this._buff, offset + dataLength, offset, this._buff.length); + } + // Adjust tracked smart buffer length + if (offset + dataLength > this.length) { + this.length = offset + dataLength; + } + else { + this.length += dataLength; + } + } + /** + * Ensures that the internal Buffer is large enough to write data. + * + * @param dataLength { Number } The length of the data that needs to be written. + * @param offset { Number } The offset of the data to be written (defaults to writeOffset). + */ + _ensureWriteable(dataLength, offset) { + const offsetVal = typeof offset === 'number' ? offset : this._writeOffset; + // Ensure enough capacity to write data. + this._ensureCapacity(offsetVal + dataLength); + // Adjust SmartBuffer length (if offset + length is larger than managed length, adjust length) + if (offsetVal + dataLength > this.length) { + this.length = offsetVal + dataLength; + } + } + /** + * Ensures that the internal Buffer is large enough to write at least the given amount of data. + * + * @param minLength { Number } The minimum length of the data needs to be written. + */ + _ensureCapacity(minLength) { + const oldLength = this._buff.length; + if (minLength > oldLength) { + let data = this._buff; + let newLength = (oldLength * 3) / 2 + 1; + if (newLength < minLength) { + newLength = minLength; + } + this._buff = Buffer.allocUnsafe(newLength); + data.copy(this._buff, 0, 0, oldLength); + } + } + /** + * Reads a numeric number value using the provided function. + * + * @typeparam T { number | bigint } The type of the value to be read + * + * @param func { Function(offset: number) => number } The function to read data on the internal Buffer with. + * @param byteSize { Number } The number of bytes read. + * @param offset { Number } The offset to read from (optional). When this is not provided, the managed readOffset is used instead. + * + * @returns { T } the number value + */ + _readNumberValue(func, byteSize, offset) { + this.ensureReadable(byteSize, offset); + // Call Buffer.readXXXX(); + const value = func.call(this._buff, typeof offset === 'number' ? offset : this._readOffset); + // Adjust internal read offset if an optional read offset was not provided. + if (typeof offset === 'undefined') { + this._readOffset += byteSize; + } + return value; + } + /** + * Inserts a numeric number value based on the given offset and value. + * + * @typeparam T { number | bigint } The type of the value to be written + * + * @param func { Function(offset: T, offset?) => number} The function to write data on the internal Buffer with. + * @param byteSize { Number } The number of bytes written. + * @param value { T } The number value to write. + * @param offset { Number } the offset to write the number at (REQUIRED). + * + * @returns SmartBuffer this buffer + */ + _insertNumberValue(func, byteSize, value, offset) { + // Check for invalid offset values. + utils_1.checkOffsetValue(offset); + // Ensure there is enough internal Buffer capacity. (raw offset is passed) + this.ensureInsertable(byteSize, offset); + // Call buffer.writeXXXX(); + func.call(this._buff, value, offset); + // Adjusts internally managed write offset. + this._writeOffset += byteSize; + return this; + } + /** + * Writes a numeric number value based on the given offset and value. + * + * @typeparam T { number | bigint } The type of the value to be written + * + * @param func { Function(offset: T, offset?) => number} The function to write data on the internal Buffer with. + * @param byteSize { Number } The number of bytes written. + * @param value { T } The number value to write. + * @param offset { Number } the offset to write the number at (REQUIRED). + * + * @returns SmartBuffer this buffer + */ + _writeNumberValue(func, byteSize, value, offset) { + // If an offset was provided, validate it. + if (typeof offset === 'number') { + // Check if we're writing beyond the bounds of the managed data. + if (offset < 0) { + throw new Error(utils_1.ERRORS.INVALID_WRITE_BEYOND_BOUNDS); + } + utils_1.checkOffsetValue(offset); + } + // Default to writeOffset if no offset value was given. + const offsetVal = typeof offset === 'number' ? offset : this._writeOffset; + // Ensure there is enough internal Buffer capacity. (raw offset is passed) + this._ensureWriteable(byteSize, offsetVal); + func.call(this._buff, value, offsetVal); + // If an offset was given, check to see if we wrote beyond the current writeOffset. + if (typeof offset === 'number') { + this._writeOffset = Math.max(this._writeOffset, offsetVal + byteSize); + } + else { + // If no numeric offset was given, we wrote to the end of the SmartBuffer so increment writeOffset. + this._writeOffset += byteSize; + } + return this; + } +} +exports.SmartBuffer = SmartBuffer; +//# sourceMappingURL=smartbuffer.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/smart-buffer/build/utils.js b/node_modules/npm/node_modules/smart-buffer/build/utils.js new file mode 100644 index 00000000..6d559812 --- /dev/null +++ b/node_modules/npm/node_modules/smart-buffer/build/utils.js @@ -0,0 +1,108 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const buffer_1 = require("buffer"); +/** + * Error strings + */ +const ERRORS = { + INVALID_ENCODING: 'Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.', + INVALID_SMARTBUFFER_SIZE: 'Invalid size provided. Size must be a valid integer greater than zero.', + INVALID_SMARTBUFFER_BUFFER: 'Invalid Buffer provided in SmartBufferOptions.', + INVALID_SMARTBUFFER_OBJECT: 'Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.', + INVALID_OFFSET: 'An invalid offset value was provided.', + INVALID_OFFSET_NON_NUMBER: 'An invalid offset value was provided. A numeric value is required.', + INVALID_LENGTH: 'An invalid length value was provided.', + INVALID_LENGTH_NON_NUMBER: 'An invalid length value was provived. A numeric value is required.', + INVALID_TARGET_OFFSET: 'Target offset is beyond the bounds of the internal SmartBuffer data.', + INVALID_TARGET_LENGTH: 'Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.', + INVALID_READ_BEYOND_BOUNDS: 'Attempted to read beyond the bounds of the managed data.', + INVALID_WRITE_BEYOND_BOUNDS: 'Attempted to write beyond the bounds of the managed data.' +}; +exports.ERRORS = ERRORS; +/** + * Checks if a given encoding is a valid Buffer encoding. (Throws an exception if check fails) + * + * @param { String } encoding The encoding string to check. + */ +function checkEncoding(encoding) { + if (!buffer_1.Buffer.isEncoding(encoding)) { + throw new Error(ERRORS.INVALID_ENCODING); + } +} +exports.checkEncoding = checkEncoding; +/** + * Checks if a given number is a finite integer. (Throws an exception if check fails) + * + * @param { Number } value The number value to check. + */ +function isFiniteInteger(value) { + return typeof value === 'number' && isFinite(value) && isInteger(value); +} +exports.isFiniteInteger = isFiniteInteger; +/** + * Checks if an offset/length value is valid. (Throws an exception if check fails) + * + * @param value The value to check. + * @param offset True if checking an offset, false if checking a length. + */ +function checkOffsetOrLengthValue(value, offset) { + if (typeof value === 'number') { + // Check for non finite/non integers + if (!isFiniteInteger(value) || value < 0) { + throw new Error(offset ? ERRORS.INVALID_OFFSET : ERRORS.INVALID_LENGTH); + } + } + else { + throw new Error(offset ? ERRORS.INVALID_OFFSET_NON_NUMBER : ERRORS.INVALID_LENGTH_NON_NUMBER); + } +} +/** + * Checks if a length value is valid. (Throws an exception if check fails) + * + * @param { Number } length The value to check. + */ +function checkLengthValue(length) { + checkOffsetOrLengthValue(length, false); +} +exports.checkLengthValue = checkLengthValue; +/** + * Checks if a offset value is valid. (Throws an exception if check fails) + * + * @param { Number } offset The value to check. + */ +function checkOffsetValue(offset) { + checkOffsetOrLengthValue(offset, true); +} +exports.checkOffsetValue = checkOffsetValue; +/** + * Checks if a target offset value is out of bounds. (Throws an exception if check fails) + * + * @param { Number } offset The offset value to check. + * @param { SmartBuffer } buff The SmartBuffer instance to check against. + */ +function checkTargetOffset(offset, buff) { + if (offset < 0 || offset > buff.length) { + throw new Error(ERRORS.INVALID_TARGET_OFFSET); + } +} +exports.checkTargetOffset = checkTargetOffset; +/** + * Determines whether a given number is a integer. + * @param value The number to check. + */ +function isInteger(value) { + return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; +} +/** + * Throws if Node.js version is too low to support bigint + */ +function bigIntAndBufferInt64Check(bufferMethod) { + if (typeof BigInt === 'undefined') { + throw new Error('Platform does not support JS BigInt type.'); + } + if (typeof buffer_1.Buffer.prototype[bufferMethod] === 'undefined') { + throw new Error(`Platform does not support Buffer.prototype.${bufferMethod}.`); + } +} +exports.bigIntAndBufferInt64Check = bigIntAndBufferInt64Check; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/smart-buffer/docs/ROADMAP.md b/node_modules/npm/node_modules/smart-buffer/docs/ROADMAP.md new file mode 100644 index 00000000..e69de29b diff --git a/node_modules/npm/node_modules/smart-buffer/package.json b/node_modules/npm/node_modules/smart-buffer/package.json new file mode 100644 index 00000000..2f326f24 --- /dev/null +++ b/node_modules/npm/node_modules/smart-buffer/package.json @@ -0,0 +1,79 @@ +{ + "name": "smart-buffer", + "version": "4.2.0", + "description": "smart-buffer is a Buffer wrapper that adds automatic read & write offset tracking, string operations, data insertions, and more.", + "main": "build/smartbuffer.js", + "contributors": ["syvita"], + "homepage": "https://github.com/JoshGlazebrook/smart-buffer/", + "repository": { + "type": "git", + "url": "https://github.com/JoshGlazebrook/smart-buffer.git" + }, + "bugs": { + "url": "https://github.com/JoshGlazebrook/smart-buffer/issues" + }, + "keywords": [ + "buffer", + "smart", + "packet", + "serialize", + "network", + "cursor", + "simple" + ], + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + }, + "author": "Josh Glazebrook", + "license": "MIT", + "readmeFilename": "README.md", + "devDependencies": { + "@types/chai": "4.1.7", + "@types/mocha": "5.2.7", + "@types/node": "^12.0.0", + "chai": "4.2.0", + "coveralls": "3.0.5", + "istanbul": "^0.4.5", + "mocha": "6.2.0", + "mocha-lcov-reporter": "^1.3.0", + "nyc": "14.1.1", + "source-map-support": "0.5.12", + "ts-node": "8.3.0", + "tslint": "5.18.0", + "typescript": "^3.2.1" + }, + "typings": "typings/smartbuffer.d.ts", + "dependencies": {}, + "scripts": { + "prepublish": "npm install -g typescript && npm run build", + "test": "NODE_ENV=test mocha --recursive --require ts-node/register test/**/*.ts", + "coverage": "NODE_ENV=test nyc npm test", + "coveralls": "NODE_ENV=test nyc npm test && nyc report --reporter=text-lcov | coveralls", + "lint": "tslint --type-check --project tsconfig.json 'src/**/*.ts'", + "build": "tsc -p ./" + }, + "nyc": { + "extension": [ + ".ts", + ".tsx" + ], + "include": [ + "src/*.ts", + "src/**/*.ts" + ], + "exclude": [ + "**.*.d.ts", + "node_modules", + "typings" + ], + "require": [ + "ts-node/register" + ], + "reporter": [ + "json", + "html" + ], + "all": true + } +} diff --git a/node_modules/npm/node_modules/socks-proxy-agent/LICENSE b/node_modules/npm/node_modules/socks-proxy-agent/LICENSE new file mode 100644 index 00000000..008728cb --- /dev/null +++ b/node_modules/npm/node_modules/socks-proxy-agent/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2013 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. \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks-proxy-agent/dist/index.js b/node_modules/npm/node_modules/socks-proxy-agent/dist/index.js new file mode 100644 index 00000000..15e06e8f --- /dev/null +++ b/node_modules/npm/node_modules/socks-proxy-agent/dist/index.js @@ -0,0 +1,195 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +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 = __importStar(require("dns")); +const net = __importStar(require("net")); +const tls = __importStar(require("tls")); +const url_1 = require("url"); +const debug = (0, debug_1.default)('socks-proxy-agent'); +const setServernameFromNonIpHost = (options) => { + if (options.servername === undefined && + options.host && + !net.isIP(options.host)) { + return { + ...options, + servername: options.host, + }; + } + return options; +}; +function parseSocksURL(url) { + let lookup = false; + let type = 5; + const host = url.hostname; + // From RFC 1928, Section 3: https://tools.ietf.org/html/rfc1928#section-3 + // "The SOCKS service is conventionally located on TCP port 1080" + const port = parseInt(url.port, 10) || 1080; + // figure out if we want socks v4 or v5, based on the "protocol" used. + // Defaults to 5. + switch (url.protocol.replace(':', '')) { + case 'socks4': + lookup = true; + type = 4; + break; + // pass through + case 'socks4a': + type = 4; + break; + case 'socks5': + lookup = true; + type = 5; + break; + // pass through + case 'socks': // no version specified, default to 5h + type = 5; + break; + case 'socks5h': + type = 5; + break; + default: + throw new TypeError(`A "socks" protocol must be specified! Got: ${String(url.protocol)}`); + } + const proxy = { + host, + port, + type, + }; + if (url.username) { + Object.defineProperty(proxy, 'userId', { + value: decodeURIComponent(url.username), + enumerable: false, + }); + } + if (url.password != null) { + Object.defineProperty(proxy, 'password', { + value: decodeURIComponent(url.password), + enumerable: false, + }); + } + return { lookup, proxy }; +} +class SocksProxyAgent extends agent_base_1.Agent { + constructor(uri, opts) { + super(opts); + const url = typeof uri === 'string' ? new url_1.URL(uri) : uri; + const { proxy, lookup } = parseSocksURL(url); + this.shouldLookup = lookup; + this.proxy = proxy; + this.timeout = opts?.timeout ?? null; + this.socketOptions = opts?.socketOptions ?? null; + } + /** + * Initiates a SOCKS connection to the specified SOCKS proxy server, + * which in turn connects to the specified remote host and port. + */ + async connect(req, opts) { + const { shouldLookup, proxy, timeout } = this; + if (!opts.host) { + throw new Error('No `host` defined!'); + } + let { host } = opts; + const { port, lookup: lookupFn = dns.lookup } = opts; + if (shouldLookup) { + // Client-side DNS resolution for "4" and "5" socks proxy versions. + host = await new Promise((resolve, reject) => { + // Use the request's custom lookup, if one was configured: + lookupFn(host, {}, (err, res) => { + if (err) { + reject(err); + } + else { + resolve(res); + } + }); + }); + } + const socksOpts = { + proxy, + destination: { + host, + port: typeof port === 'number' ? port : parseInt(port, 10), + }, + command: 'connect', + timeout: timeout ?? undefined, + // @ts-expect-error the type supplied by socks for socket_options is wider + // than necessary since socks will always override the host and port + socket_options: this.socketOptions ?? undefined, + }; + const cleanup = (tlsSocket) => { + req.destroy(); + socket.destroy(); + if (tlsSocket) + tlsSocket.destroy(); + }; + debug('Creating socks proxy connection: %o', socksOpts); + const { socket } = await 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 tlsSocket = tls.connect({ + ...omit(setServernameFromNonIpHost(opts), 'host', 'path', 'port'), + socket, + }); + tlsSocket.once('error', (error) => { + debug('Socket TLS error', error.message); + cleanup(tlsSocket); + }); + return tlsSocket; + } + return socket; + } +} +SocksProxyAgent.protocols = [ + 'socks', + 'socks4', + 'socks4a', + 'socks5', + 'socks5h', +]; +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/npm/node_modules/socks-proxy-agent/package.json b/node_modules/npm/node_modules/socks-proxy-agent/package.json new file mode 100644 index 00000000..0f330a73 --- /dev/null +++ b/node_modules/npm/node_modules/socks-proxy-agent/package.json @@ -0,0 +1,142 @@ +{ + "name": "socks-proxy-agent", + "version": "8.0.5", + "description": "A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "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": "https://github.com/TooTallNate/proxy-agents.git", + "directory": "packages/socks-proxy-agent" + }, + "keywords": [ + "agent", + "http", + "https", + "proxy", + "socks", + "socks4", + "socks4a", + "socks5", + "socks5h" + ], + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "devDependencies": { + "@types/async-retry": "^1.4.5", + "@types/debug": "^4.1.7", + "@types/dns2": "^2.0.3", + "@types/jest": "^29.5.1", + "@types/node": "^14.18.45", + "async-listen": "^3.0.0", + "async-retry": "^1.3.3", + "cacheable-lookup": "^6.1.0", + "dns2": "^2.1.0", + "jest": "^29.5.0", + "socksv5": "github:TooTallNate/socksv5#fix/dstSock-close-event", + "ts-jest": "^29.1.0", + "typescript": "^5.0.4", + "proxy": "2.2.0", + "tsconfig": "0.0.0" + }, + "engines": { + "node": ">= 14" + }, + "license": "MIT", + "scripts": { + "build": "tsc", + "test": "jest --env node --verbose --bail test/test.ts", + "test-e2e": "jest --env node --verbose --bail test/e2e.test.ts", + "lint": "eslint . --ext .ts", + "pack": "node ../../scripts/pack.mjs" + } +} \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/LICENSE b/node_modules/npm/node_modules/socks/LICENSE new file mode 100644 index 00000000..b2442a9e --- /dev/null +++ b/node_modules/npm/node_modules/socks/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Josh Glazebrook + +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/npm/node_modules/socks/build/client/socksclient.js b/node_modules/npm/node_modules/socks/build/client/socksclient.js new file mode 100644 index 00000000..09b1f557 --- /dev/null +++ b/node_modules/npm/node_modules/socks/build/client/socksclient.js @@ -0,0 +1,793 @@ +"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()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SocksClientError = exports.SocksClient = void 0; +const events_1 = require("events"); +const net = require("net"); +const smart_buffer_1 = require("smart-buffer"); +const constants_1 = require("../common/constants"); +const helpers_1 = require("../common/helpers"); +const receivebuffer_1 = require("../common/receivebuffer"); +const util_1 = require("../common/util"); +Object.defineProperty(exports, "SocksClientError", { enumerable: true, get: function () { return util_1.SocksClientError; } }); +const ip_address_1 = require("ip-address"); +class SocksClient extends events_1.EventEmitter { + constructor(options) { + super(); + this.options = Object.assign({}, options); + // Validate SocksClientOptions + (0, helpers_1.validateSocksClientOptions)(options); + // Default state + this.setState(constants_1.SocksClientState.Created); + } + /** + * Creates a new SOCKS connection. + * + * Note: Supports callbacks and promises. Only supports the connect command. + * @param options { SocksClientOptions } Options. + * @param callback { Function } An optional callback function. + * @returns { Promise } + */ + static createConnection(options, callback) { + return new Promise((resolve, reject) => { + // Validate SocksClientOptions + try { + (0, helpers_1.validateSocksClientOptions)(options, ['connect']); + } + catch (err) { + if (typeof callback === 'function') { + callback(err); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return resolve(err); // Resolves pending promise (prevents memory leaks). + } + else { + return reject(err); + } + } + const client = new SocksClient(options); + client.connect(options.existing_socket); + client.once('established', (info) => { + client.removeAllListeners(); + if (typeof callback === 'function') { + callback(null, info); + resolve(info); // Resolves pending promise (prevents memory leaks). + } + else { + resolve(info); + } + }); + // Error occurred, failed to establish connection. + client.once('error', (err) => { + client.removeAllListeners(); + if (typeof callback === 'function') { + callback(err); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + resolve(err); // Resolves pending promise (prevents memory leaks). + } + else { + reject(err); + } + }); + }); + } + /** + * Creates a new SOCKS connection chain to a destination host through 2 or more SOCKS proxies. + * + * Note: Supports callbacks and promises. Only supports the connect method. + * Note: Implemented via createConnection() factory function. + * @param options { SocksClientChainOptions } Options + * @param callback { Function } An optional callback function. + * @returns { Promise } + */ + static createConnectionChain(options, callback) { + // eslint-disable-next-line no-async-promise-executor + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + // Validate SocksClientChainOptions + try { + (0, helpers_1.validateSocksClientChainOptions)(options); + } + catch (err) { + if (typeof callback === 'function') { + callback(err); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return resolve(err); // Resolves pending promise (prevents memory leaks). + } + else { + return reject(err); + } + } + // Shuffle proxies + if (options.randomizeChain) { + (0, util_1.shuffleArray)(options.proxies); + } + try { + let sock; + for (let i = 0; i < options.proxies.length; i++) { + const nextProxy = options.proxies[i]; + // If we've reached the last proxy in the chain, the destination is the actual destination, otherwise it's the next proxy. + const nextDestination = i === options.proxies.length - 1 + ? options.destination + : { + host: options.proxies[i + 1].host || + options.proxies[i + 1].ipaddress, + port: options.proxies[i + 1].port, + }; + // Creates the next connection in the chain. + const result = yield SocksClient.createConnection({ + command: 'connect', + proxy: nextProxy, + destination: nextDestination, + existing_socket: sock, + }); + // If sock is undefined, assign it here. + sock = sock || result.socket; + } + if (typeof callback === 'function') { + callback(null, { socket: sock }); + resolve({ socket: sock }); // Resolves pending promise (prevents memory leaks). + } + else { + resolve({ socket: sock }); + } + } + catch (err) { + if (typeof callback === 'function') { + callback(err); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + resolve(err); // Resolves pending promise (prevents memory leaks). + } + else { + reject(err); + } + } + })); + } + /** + * Creates a SOCKS UDP Frame. + * @param options + */ + static createUDPFrame(options) { + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt16BE(0); + buff.writeUInt8(options.frameNumber || 0); + // IPv4/IPv6/Hostname + if (net.isIPv4(options.remoteHost.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv4); + buff.writeUInt32BE((0, helpers_1.ipv4ToInt32)(options.remoteHost.host)); + } + else if (net.isIPv6(options.remoteHost.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv6); + buff.writeBuffer((0, helpers_1.ipToBuffer)(options.remoteHost.host)); + } + else { + buff.writeUInt8(constants_1.Socks5HostType.Hostname); + buff.writeUInt8(Buffer.byteLength(options.remoteHost.host)); + buff.writeString(options.remoteHost.host); + } + // Port + buff.writeUInt16BE(options.remoteHost.port); + // Data + buff.writeBuffer(options.data); + return buff.toBuffer(); + } + /** + * Parses a SOCKS UDP frame. + * @param data + */ + static parseUDPFrame(data) { + const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); + buff.readOffset = 2; + const frameNumber = buff.readUInt8(); + const hostType = buff.readUInt8(); + let remoteHost; + if (hostType === constants_1.Socks5HostType.IPv4) { + remoteHost = (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()); + } + else if (hostType === constants_1.Socks5HostType.IPv6) { + remoteHost = ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(); + } + else { + remoteHost = buff.readString(buff.readUInt8()); + } + const remotePort = buff.readUInt16BE(); + return { + frameNumber, + remoteHost: { + host: remoteHost, + port: remotePort, + }, + data: buff.readBuffer(), + }; + } + /** + * Internal state setter. If the SocksClient is in an error state, it cannot be changed to a non error state. + */ + setState(newState) { + if (this.state !== constants_1.SocksClientState.Error) { + this.state = newState; + } + } + /** + * Starts the connection establishment to the proxy and destination. + * @param existingSocket Connected socket to use instead of creating a new one (internal use). + */ + connect(existingSocket) { + this.onDataReceived = (data) => this.onDataReceivedHandler(data); + this.onClose = () => this.onCloseHandler(); + this.onError = (err) => this.onErrorHandler(err); + this.onConnect = () => this.onConnectHandler(); + // Start timeout timer (defaults to 30 seconds) + const timer = setTimeout(() => this.onEstablishedTimeout(), this.options.timeout || constants_1.DEFAULT_TIMEOUT); + // check whether unref is available as it differs from browser to NodeJS (#33) + if (timer.unref && typeof timer.unref === 'function') { + timer.unref(); + } + // If an existing socket is provided, use it to negotiate SOCKS handshake. Otherwise create a new Socket. + if (existingSocket) { + this.socket = existingSocket; + } + else { + this.socket = new net.Socket(); + } + // Attach Socket error handlers. + this.socket.once('close', this.onClose); + this.socket.once('error', this.onError); + this.socket.once('connect', this.onConnect); + this.socket.on('data', this.onDataReceived); + this.setState(constants_1.SocksClientState.Connecting); + this.receiveBuffer = new receivebuffer_1.ReceiveBuffer(); + if (existingSocket) { + this.socket.emit('connect'); + } + else { + this.socket.connect(this.getSocketOptions()); + if (this.options.set_tcp_nodelay !== undefined && + this.options.set_tcp_nodelay !== null) { + this.socket.setNoDelay(!!this.options.set_tcp_nodelay); + } + } + // Listen for established event so we can re-emit any excess data received during handshakes. + this.prependOnceListener('established', (info) => { + setImmediate(() => { + if (this.receiveBuffer.length > 0) { + const excessData = this.receiveBuffer.get(this.receiveBuffer.length); + info.socket.emit('data', excessData); + } + info.socket.resume(); + }); + }); + } + // Socket options (defaults host/port to options.proxy.host/options.proxy.port) + getSocketOptions() { + return Object.assign(Object.assign({}, this.options.socket_options), { host: this.options.proxy.host || this.options.proxy.ipaddress, port: this.options.proxy.port }); + } + /** + * Handles internal Socks timeout callback. + * Note: If the Socks client is not BoundWaitingForConnection or Established, the connection will be closed. + */ + onEstablishedTimeout() { + if (this.state !== constants_1.SocksClientState.Established && + this.state !== constants_1.SocksClientState.BoundWaitingForConnection) { + this.closeSocket(constants_1.ERRORS.ProxyConnectionTimedOut); + } + } + /** + * Handles Socket connect event. + */ + onConnectHandler() { + this.setState(constants_1.SocksClientState.Connected); + // Send initial handshake. + if (this.options.proxy.type === 4) { + this.sendSocks4InitialHandshake(); + } + else { + this.sendSocks5InitialHandshake(); + } + this.setState(constants_1.SocksClientState.SentInitialHandshake); + } + /** + * Handles Socket data event. + * @param data + */ + onDataReceivedHandler(data) { + /* + All received data is appended to a ReceiveBuffer. + This makes sure that all the data we need is received before we attempt to process it. + */ + this.receiveBuffer.append(data); + // Process data that we have. + this.processData(); + } + /** + * Handles processing of the data we have received. + */ + processData() { + // If we have enough data to process the next step in the SOCKS handshake, proceed. + while (this.state !== constants_1.SocksClientState.Established && + this.state !== constants_1.SocksClientState.Error && + this.receiveBuffer.length >= this.nextRequiredPacketBufferSize) { + // Sent initial handshake, waiting for response. + if (this.state === constants_1.SocksClientState.SentInitialHandshake) { + if (this.options.proxy.type === 4) { + // Socks v4 only has one handshake response. + this.handleSocks4FinalHandshakeResponse(); + } + else { + // Socks v5 has two handshakes, handle initial one here. + this.handleInitialSocks5HandshakeResponse(); + } + // Sent auth request for Socks v5, waiting for response. + } + else if (this.state === constants_1.SocksClientState.SentAuthentication) { + this.handleInitialSocks5AuthenticationHandshakeResponse(); + // Sent final Socks v5 handshake, waiting for final response. + } + else if (this.state === constants_1.SocksClientState.SentFinalHandshake) { + this.handleSocks5FinalHandshakeResponse(); + // Socks BIND established. Waiting for remote connection via proxy. + } + else if (this.state === constants_1.SocksClientState.BoundWaitingForConnection) { + if (this.options.proxy.type === 4) { + this.handleSocks4IncomingConnectionResponse(); + } + else { + this.handleSocks5IncomingConnectionResponse(); + } + } + else { + this.closeSocket(constants_1.ERRORS.InternalError); + break; + } + } + } + /** + * Handles Socket close event. + * @param had_error + */ + onCloseHandler() { + this.closeSocket(constants_1.ERRORS.SocketClosed); + } + /** + * Handles Socket error event. + * @param err + */ + onErrorHandler(err) { + this.closeSocket(err.message); + } + /** + * Removes internal event listeners on the underlying Socket. + */ + removeInternalSocketHandlers() { + // Pauses data flow of the socket (this is internally resumed after 'established' is emitted) + this.socket.pause(); + this.socket.removeListener('data', this.onDataReceived); + this.socket.removeListener('close', this.onClose); + this.socket.removeListener('error', this.onError); + this.socket.removeListener('connect', this.onConnect); + } + /** + * Closes and destroys the underlying Socket. Emits an error event. + * @param err { String } An error string to include in error event. + */ + closeSocket(err) { + // Make sure only one 'error' event is fired for the lifetime of this SocksClient instance. + if (this.state !== constants_1.SocksClientState.Error) { + // Set internal state to Error. + this.setState(constants_1.SocksClientState.Error); + // Destroy Socket + this.socket.destroy(); + // Remove internal listeners + this.removeInternalSocketHandlers(); + // Fire 'error' event. + this.emit('error', new util_1.SocksClientError(err, this.options)); + } + } + /** + * Sends initial Socks v4 handshake request. + */ + sendSocks4InitialHandshake() { + const userId = this.options.proxy.userId || ''; + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt8(0x04); + buff.writeUInt8(constants_1.SocksCommand[this.options.command]); + buff.writeUInt16BE(this.options.destination.port); + // Socks 4 (IPv4) + if (net.isIPv4(this.options.destination.host)) { + buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host)); + buff.writeStringNT(userId); + // Socks 4a (hostname) + } + else { + buff.writeUInt8(0x00); + buff.writeUInt8(0x00); + buff.writeUInt8(0x00); + buff.writeUInt8(0x01); + buff.writeStringNT(userId); + buff.writeStringNT(this.options.destination.host); + } + this.nextRequiredPacketBufferSize = + constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks4Response; + this.socket.write(buff.toBuffer()); + } + /** + * Handles Socks v4 handshake response. + * @param data + */ + handleSocks4FinalHandshakeResponse() { + const data = this.receiveBuffer.get(8); + if (data[1] !== constants_1.Socks4Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.Socks4ProxyRejectedConnection} - (${constants_1.Socks4Response[data[1]]})`); + } + else { + // Bind response + if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.bind) { + const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); + buff.readOffset = 2; + const remoteHost = { + port: buff.readUInt16BE(), + host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()), + }; + // If host is 0.0.0.0, set to proxy host. + if (remoteHost.host === '0.0.0.0') { + remoteHost.host = this.options.proxy.ipaddress; + } + this.setState(constants_1.SocksClientState.BoundWaitingForConnection); + this.emit('bound', { remoteHost, socket: this.socket }); + // Connect response + } + else { + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit('established', { socket: this.socket }); + } + } + } + /** + * Handles Socks v4 incoming connection request (BIND) + * @param data + */ + handleSocks4IncomingConnectionResponse() { + const data = this.receiveBuffer.get(8); + if (data[1] !== constants_1.Socks4Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.Socks4ProxyRejectedIncomingBoundConnection} - (${constants_1.Socks4Response[data[1]]})`); + } + else { + const buff = smart_buffer_1.SmartBuffer.fromBuffer(data); + buff.readOffset = 2; + const remoteHost = { + port: buff.readUInt16BE(), + host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()), + }; + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit('established', { remoteHost, socket: this.socket }); + } + } + /** + * Sends initial Socks v5 handshake request. + */ + sendSocks5InitialHandshake() { + const buff = new smart_buffer_1.SmartBuffer(); + // By default we always support no auth. + const supportedAuthMethods = [constants_1.Socks5Auth.NoAuth]; + // We should only tell the proxy we support user/pass auth if auth info is actually provided. + // Note: As of Tor v0.3.5.7+, if user/pass auth is an option from the client, by default it will always take priority. + if (this.options.proxy.userId || this.options.proxy.password) { + supportedAuthMethods.push(constants_1.Socks5Auth.UserPass); + } + // Custom auth method? + if (this.options.proxy.custom_auth_method !== undefined) { + supportedAuthMethods.push(this.options.proxy.custom_auth_method); + } + // Build handshake packet + buff.writeUInt8(0x05); + buff.writeUInt8(supportedAuthMethods.length); + for (const authMethod of supportedAuthMethods) { + buff.writeUInt8(authMethod); + } + this.nextRequiredPacketBufferSize = + constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5InitialHandshakeResponse; + this.socket.write(buff.toBuffer()); + this.setState(constants_1.SocksClientState.SentInitialHandshake); + } + /** + * Handles initial Socks v5 handshake response. + * @param data + */ + handleInitialSocks5HandshakeResponse() { + const data = this.receiveBuffer.get(2); + if (data[0] !== 0x05) { + this.closeSocket(constants_1.ERRORS.InvalidSocks5IntiailHandshakeSocksVersion); + } + else if (data[1] === constants_1.SOCKS5_NO_ACCEPTABLE_AUTH) { + this.closeSocket(constants_1.ERRORS.InvalidSocks5InitialHandshakeNoAcceptedAuthType); + } + else { + // If selected Socks v5 auth method is no auth, send final handshake request. + if (data[1] === constants_1.Socks5Auth.NoAuth) { + this.socks5ChosenAuthType = constants_1.Socks5Auth.NoAuth; + this.sendSocks5CommandRequest(); + // If selected Socks v5 auth method is user/password, send auth handshake. + } + else if (data[1] === constants_1.Socks5Auth.UserPass) { + this.socks5ChosenAuthType = constants_1.Socks5Auth.UserPass; + this.sendSocks5UserPassAuthentication(); + // If selected Socks v5 auth method is the custom_auth_method, send custom handshake. + } + else if (data[1] === this.options.proxy.custom_auth_method) { + this.socks5ChosenAuthType = this.options.proxy.custom_auth_method; + this.sendSocks5CustomAuthentication(); + } + else { + this.closeSocket(constants_1.ERRORS.InvalidSocks5InitialHandshakeUnknownAuthType); + } + } + } + /** + * Sends Socks v5 user & password auth handshake. + * + * Note: No auth and user/pass are currently supported. + */ + sendSocks5UserPassAuthentication() { + const userId = this.options.proxy.userId || ''; + const password = this.options.proxy.password || ''; + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt8(0x01); + buff.writeUInt8(Buffer.byteLength(userId)); + buff.writeString(userId); + buff.writeUInt8(Buffer.byteLength(password)); + buff.writeString(password); + this.nextRequiredPacketBufferSize = + constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5UserPassAuthenticationResponse; + this.socket.write(buff.toBuffer()); + this.setState(constants_1.SocksClientState.SentAuthentication); + } + sendSocks5CustomAuthentication() { + return __awaiter(this, void 0, void 0, function* () { + this.nextRequiredPacketBufferSize = + this.options.proxy.custom_auth_response_size; + this.socket.write(yield this.options.proxy.custom_auth_request_handler()); + this.setState(constants_1.SocksClientState.SentAuthentication); + }); + } + handleSocks5CustomAuthHandshakeResponse(data) { + return __awaiter(this, void 0, void 0, function* () { + return yield this.options.proxy.custom_auth_response_handler(data); + }); + } + handleSocks5AuthenticationNoAuthHandshakeResponse(data) { + return __awaiter(this, void 0, void 0, function* () { + return data[1] === 0x00; + }); + } + handleSocks5AuthenticationUserPassHandshakeResponse(data) { + return __awaiter(this, void 0, void 0, function* () { + return data[1] === 0x00; + }); + } + /** + * Handles Socks v5 auth handshake response. + * @param data + */ + handleInitialSocks5AuthenticationHandshakeResponse() { + return __awaiter(this, void 0, void 0, function* () { + this.setState(constants_1.SocksClientState.ReceivedAuthenticationResponse); + let authResult = false; + if (this.socks5ChosenAuthType === constants_1.Socks5Auth.NoAuth) { + authResult = yield this.handleSocks5AuthenticationNoAuthHandshakeResponse(this.receiveBuffer.get(2)); + } + else if (this.socks5ChosenAuthType === constants_1.Socks5Auth.UserPass) { + authResult = + yield this.handleSocks5AuthenticationUserPassHandshakeResponse(this.receiveBuffer.get(2)); + } + else if (this.socks5ChosenAuthType === this.options.proxy.custom_auth_method) { + authResult = yield this.handleSocks5CustomAuthHandshakeResponse(this.receiveBuffer.get(this.options.proxy.custom_auth_response_size)); + } + if (!authResult) { + this.closeSocket(constants_1.ERRORS.Socks5AuthenticationFailed); + } + else { + this.sendSocks5CommandRequest(); + } + }); + } + /** + * Sends Socks v5 final handshake request. + */ + sendSocks5CommandRequest() { + const buff = new smart_buffer_1.SmartBuffer(); + buff.writeUInt8(0x05); + buff.writeUInt8(constants_1.SocksCommand[this.options.command]); + buff.writeUInt8(0x00); + // ipv4, ipv6, domain? + if (net.isIPv4(this.options.destination.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv4); + buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host)); + } + else if (net.isIPv6(this.options.destination.host)) { + buff.writeUInt8(constants_1.Socks5HostType.IPv6); + buff.writeBuffer((0, helpers_1.ipToBuffer)(this.options.destination.host)); + } + else { + buff.writeUInt8(constants_1.Socks5HostType.Hostname); + buff.writeUInt8(this.options.destination.host.length); + buff.writeString(this.options.destination.host); + } + buff.writeUInt16BE(this.options.destination.port); + this.nextRequiredPacketBufferSize = + constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader; + this.socket.write(buff.toBuffer()); + this.setState(constants_1.SocksClientState.SentFinalHandshake); + } + /** + * Handles Socks v5 final handshake response. + * @param data + */ + handleSocks5FinalHandshakeResponse() { + // Peek at available data (we need at least 5 bytes to get the hostname length) + const header = this.receiveBuffer.peek(5); + if (header[0] !== 0x05 || header[1] !== constants_1.Socks5Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.InvalidSocks5FinalHandshakeRejected} - ${constants_1.Socks5Response[header[1]]}`); + } + else { + // Read address type + const addressType = header[3]; + let remoteHost; + let buff; + // IPv4 + if (addressType === constants_1.Socks5HostType.IPv4) { + // Check if data is available. + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()), + port: buff.readUInt16BE(), + }; + // If given host is 0.0.0.0, assume remote proxy ip instead. + if (remoteHost.host === '0.0.0.0') { + remoteHost.host = this.options.proxy.ipaddress; + } + // Hostname + } + else if (addressType === constants_1.Socks5HostType.Hostname) { + const hostLength = header[4]; + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(hostLength); // header + host length + host + port + // Check if data is available. + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(5)); + remoteHost = { + host: buff.readString(hostLength), + port: buff.readUInt16BE(), + }; + // IPv6 + } + else if (addressType === constants_1.Socks5HostType.IPv6) { + // Check if data is available. + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(), + port: buff.readUInt16BE(), + }; + } + // We have everything we need + this.setState(constants_1.SocksClientState.ReceivedFinalResponse); + // If using CONNECT, the client is now in the established state. + if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.connect) { + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit('established', { remoteHost, socket: this.socket }); + } + else if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.bind) { + /* If using BIND, the Socks client is now in BoundWaitingForConnection state. + This means that the remote proxy server is waiting for a remote connection to the bound port. */ + this.setState(constants_1.SocksClientState.BoundWaitingForConnection); + this.nextRequiredPacketBufferSize = + constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader; + this.emit('bound', { remoteHost, socket: this.socket }); + /* + If using Associate, the Socks client is now Established. And the proxy server is now accepting UDP packets at the + given bound port. This initial Socks TCP connection must remain open for the UDP relay to continue to work. + */ + } + else if (constants_1.SocksCommand[this.options.command] === constants_1.SocksCommand.associate) { + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit('established', { + remoteHost, + socket: this.socket, + }); + } + } + } + /** + * Handles Socks v5 incoming connection request (BIND). + */ + handleSocks5IncomingConnectionResponse() { + // Peek at available data (we need at least 5 bytes to get the hostname length) + const header = this.receiveBuffer.peek(5); + if (header[0] !== 0x05 || header[1] !== constants_1.Socks5Response.Granted) { + this.closeSocket(`${constants_1.ERRORS.Socks5ProxyRejectedIncomingBoundConnection} - ${constants_1.Socks5Response[header[1]]}`); + } + else { + // Read address type + const addressType = header[3]; + let remoteHost; + let buff; + // IPv4 + if (addressType === constants_1.Socks5HostType.IPv4) { + // Check if data is available. + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: (0, helpers_1.int32ToIpv4)(buff.readUInt32BE()), + port: buff.readUInt16BE(), + }; + // If given host is 0.0.0.0, assume remote proxy ip instead. + if (remoteHost.host === '0.0.0.0') { + remoteHost.host = this.options.proxy.ipaddress; + } + // Hostname + } + else if (addressType === constants_1.Socks5HostType.Hostname) { + const hostLength = header[4]; + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(hostLength); // header + host length + port + // Check if data is available. + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(5)); + remoteHost = { + host: buff.readString(hostLength), + port: buff.readUInt16BE(), + }; + // IPv6 + } + else if (addressType === constants_1.Socks5HostType.IPv6) { + // Check if data is available. + const dataNeeded = constants_1.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6; + if (this.receiveBuffer.length < dataNeeded) { + this.nextRequiredPacketBufferSize = dataNeeded; + return; + } + buff = smart_buffer_1.SmartBuffer.fromBuffer(this.receiveBuffer.get(dataNeeded).slice(4)); + remoteHost = { + host: ip_address_1.Address6.fromByteArray(Array.from(buff.readBuffer(16))).canonicalForm(), + port: buff.readUInt16BE(), + }; + } + this.setState(constants_1.SocksClientState.Established); + this.removeInternalSocketHandlers(); + this.emit('established', { remoteHost, socket: this.socket }); + } + } + get socksClientOptions() { + return Object.assign({}, this.options); + } +} +exports.SocksClient = SocksClient; +//# sourceMappingURL=socksclient.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/build/common/constants.js b/node_modules/npm/node_modules/socks/build/common/constants.js new file mode 100644 index 00000000..aaf16418 --- /dev/null +++ b/node_modules/npm/node_modules/socks/build/common/constants.js @@ -0,0 +1,108 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SOCKS5_NO_ACCEPTABLE_AUTH = exports.SOCKS5_CUSTOM_AUTH_END = exports.SOCKS5_CUSTOM_AUTH_START = exports.SOCKS_INCOMING_PACKET_SIZES = exports.SocksClientState = exports.Socks5Response = exports.Socks5HostType = exports.Socks5Auth = exports.Socks4Response = exports.SocksCommand = exports.ERRORS = exports.DEFAULT_TIMEOUT = void 0; +const DEFAULT_TIMEOUT = 30000; +exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT; +// prettier-ignore +const ERRORS = { + InvalidSocksCommand: 'An invalid SOCKS command was provided. Valid options are connect, bind, and associate.', + InvalidSocksCommandForOperation: 'An invalid SOCKS command was provided. Only a subset of commands are supported for this operation.', + InvalidSocksCommandChain: 'An invalid SOCKS command was provided. Chaining currently only supports the connect command.', + InvalidSocksClientOptionsDestination: 'An invalid destination host was provided.', + InvalidSocksClientOptionsExistingSocket: 'An invalid existing socket was provided. This should be an instance of stream.Duplex.', + InvalidSocksClientOptionsProxy: 'Invalid SOCKS proxy details were provided.', + InvalidSocksClientOptionsTimeout: 'An invalid timeout value was provided. Please enter a value above 0 (in ms).', + InvalidSocksClientOptionsProxiesLength: 'At least two socks proxies must be provided for chaining.', + InvalidSocksClientOptionsCustomAuthRange: 'Custom auth must be a value between 0x80 and 0xFE.', + InvalidSocksClientOptionsCustomAuthOptions: 'When a custom_auth_method is provided, custom_auth_request_handler, custom_auth_response_size, and custom_auth_response_handler must also be provided and valid.', + NegotiationError: 'Negotiation error', + SocketClosed: 'Socket closed', + ProxyConnectionTimedOut: 'Proxy connection timed out', + InternalError: 'SocksClient internal error (this should not happen)', + InvalidSocks4HandshakeResponse: 'Received invalid Socks4 handshake response', + Socks4ProxyRejectedConnection: 'Socks4 Proxy rejected connection', + InvalidSocks4IncomingConnectionResponse: 'Socks4 invalid incoming connection response', + Socks4ProxyRejectedIncomingBoundConnection: 'Socks4 Proxy rejected incoming bound connection', + InvalidSocks5InitialHandshakeResponse: 'Received invalid Socks5 initial handshake response', + InvalidSocks5IntiailHandshakeSocksVersion: 'Received invalid Socks5 initial handshake (invalid socks version)', + InvalidSocks5InitialHandshakeNoAcceptedAuthType: 'Received invalid Socks5 initial handshake (no accepted authentication type)', + InvalidSocks5InitialHandshakeUnknownAuthType: 'Received invalid Socks5 initial handshake (unknown authentication type)', + Socks5AuthenticationFailed: 'Socks5 Authentication failed', + InvalidSocks5FinalHandshake: 'Received invalid Socks5 final handshake response', + InvalidSocks5FinalHandshakeRejected: 'Socks5 proxy rejected connection', + InvalidSocks5IncomingConnectionResponse: 'Received invalid Socks5 incoming connection response', + Socks5ProxyRejectedIncomingBoundConnection: 'Socks5 Proxy rejected incoming bound connection', +}; +exports.ERRORS = ERRORS; +const SOCKS_INCOMING_PACKET_SIZES = { + Socks5InitialHandshakeResponse: 2, + Socks5UserPassAuthenticationResponse: 2, + // Command response + incoming connection (bind) + Socks5ResponseHeader: 5, // We need at least 5 to read the hostname length, then we wait for the address+port information. + Socks5ResponseIPv4: 10, // 4 header + 4 ip + 2 port + Socks5ResponseIPv6: 22, // 4 header + 16 ip + 2 port + Socks5ResponseHostname: (hostNameLength) => hostNameLength + 7, // 4 header + 1 host length + host + 2 port + // Command response + incoming connection (bind) + Socks4Response: 8, // 2 header + 2 port + 4 ip +}; +exports.SOCKS_INCOMING_PACKET_SIZES = SOCKS_INCOMING_PACKET_SIZES; +var SocksCommand; +(function (SocksCommand) { + SocksCommand[SocksCommand["connect"] = 1] = "connect"; + SocksCommand[SocksCommand["bind"] = 2] = "bind"; + SocksCommand[SocksCommand["associate"] = 3] = "associate"; +})(SocksCommand || (exports.SocksCommand = SocksCommand = {})); +var Socks4Response; +(function (Socks4Response) { + Socks4Response[Socks4Response["Granted"] = 90] = "Granted"; + Socks4Response[Socks4Response["Failed"] = 91] = "Failed"; + Socks4Response[Socks4Response["Rejected"] = 92] = "Rejected"; + Socks4Response[Socks4Response["RejectedIdent"] = 93] = "RejectedIdent"; +})(Socks4Response || (exports.Socks4Response = Socks4Response = {})); +var Socks5Auth; +(function (Socks5Auth) { + Socks5Auth[Socks5Auth["NoAuth"] = 0] = "NoAuth"; + Socks5Auth[Socks5Auth["GSSApi"] = 1] = "GSSApi"; + Socks5Auth[Socks5Auth["UserPass"] = 2] = "UserPass"; +})(Socks5Auth || (exports.Socks5Auth = Socks5Auth = {})); +const SOCKS5_CUSTOM_AUTH_START = 0x80; +exports.SOCKS5_CUSTOM_AUTH_START = SOCKS5_CUSTOM_AUTH_START; +const SOCKS5_CUSTOM_AUTH_END = 0xfe; +exports.SOCKS5_CUSTOM_AUTH_END = SOCKS5_CUSTOM_AUTH_END; +const SOCKS5_NO_ACCEPTABLE_AUTH = 0xff; +exports.SOCKS5_NO_ACCEPTABLE_AUTH = SOCKS5_NO_ACCEPTABLE_AUTH; +var Socks5Response; +(function (Socks5Response) { + Socks5Response[Socks5Response["Granted"] = 0] = "Granted"; + Socks5Response[Socks5Response["Failure"] = 1] = "Failure"; + Socks5Response[Socks5Response["NotAllowed"] = 2] = "NotAllowed"; + Socks5Response[Socks5Response["NetworkUnreachable"] = 3] = "NetworkUnreachable"; + Socks5Response[Socks5Response["HostUnreachable"] = 4] = "HostUnreachable"; + Socks5Response[Socks5Response["ConnectionRefused"] = 5] = "ConnectionRefused"; + Socks5Response[Socks5Response["TTLExpired"] = 6] = "TTLExpired"; + Socks5Response[Socks5Response["CommandNotSupported"] = 7] = "CommandNotSupported"; + Socks5Response[Socks5Response["AddressNotSupported"] = 8] = "AddressNotSupported"; +})(Socks5Response || (exports.Socks5Response = Socks5Response = {})); +var Socks5HostType; +(function (Socks5HostType) { + Socks5HostType[Socks5HostType["IPv4"] = 1] = "IPv4"; + Socks5HostType[Socks5HostType["Hostname"] = 3] = "Hostname"; + Socks5HostType[Socks5HostType["IPv6"] = 4] = "IPv6"; +})(Socks5HostType || (exports.Socks5HostType = Socks5HostType = {})); +var SocksClientState; +(function (SocksClientState) { + SocksClientState[SocksClientState["Created"] = 0] = "Created"; + SocksClientState[SocksClientState["Connecting"] = 1] = "Connecting"; + SocksClientState[SocksClientState["Connected"] = 2] = "Connected"; + SocksClientState[SocksClientState["SentInitialHandshake"] = 3] = "SentInitialHandshake"; + SocksClientState[SocksClientState["ReceivedInitialHandshakeResponse"] = 4] = "ReceivedInitialHandshakeResponse"; + SocksClientState[SocksClientState["SentAuthentication"] = 5] = "SentAuthentication"; + SocksClientState[SocksClientState["ReceivedAuthenticationResponse"] = 6] = "ReceivedAuthenticationResponse"; + SocksClientState[SocksClientState["SentFinalHandshake"] = 7] = "SentFinalHandshake"; + SocksClientState[SocksClientState["ReceivedFinalResponse"] = 8] = "ReceivedFinalResponse"; + SocksClientState[SocksClientState["BoundWaitingForConnection"] = 9] = "BoundWaitingForConnection"; + SocksClientState[SocksClientState["Established"] = 10] = "Established"; + SocksClientState[SocksClientState["Disconnected"] = 11] = "Disconnected"; + SocksClientState[SocksClientState["Error"] = 99] = "Error"; +})(SocksClientState || (exports.SocksClientState = SocksClientState = {})); +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/build/common/helpers.js b/node_modules/npm/node_modules/socks/build/common/helpers.js new file mode 100644 index 00000000..1ae44e41 --- /dev/null +++ b/node_modules/npm/node_modules/socks/build/common/helpers.js @@ -0,0 +1,166 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ipToBuffer = exports.int32ToIpv4 = exports.ipv4ToInt32 = exports.validateSocksClientChainOptions = exports.validateSocksClientOptions = void 0; +const util_1 = require("./util"); +const constants_1 = require("./constants"); +const stream = require("stream"); +const ip_address_1 = require("ip-address"); +const net = require("net"); +/** + * Validates the provided SocksClientOptions + * @param options { SocksClientOptions } + * @param acceptedCommands { string[] } A list of accepted SocksProxy commands. + */ +function validateSocksClientOptions(options, acceptedCommands = ['connect', 'bind', 'associate']) { + // Check SOCKs command option. + if (!constants_1.SocksCommand[options.command]) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommand, options); + } + // Check SocksCommand for acceptable command. + if (acceptedCommands.indexOf(options.command) === -1) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommandForOperation, options); + } + // Check destination + if (!isValidSocksRemoteHost(options.destination)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsDestination, options); + } + // Check SOCKS proxy to use + if (!isValidSocksProxy(options.proxy)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options); + } + // Validate custom auth (if set) + validateCustomProxyAuth(options.proxy, options); + // Check timeout + if (options.timeout && !isValidTimeoutValue(options.timeout)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsTimeout, options); + } + // Check existing_socket (if provided) + if (options.existing_socket && + !(options.existing_socket instanceof stream.Duplex)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsExistingSocket, options); + } +} +exports.validateSocksClientOptions = validateSocksClientOptions; +/** + * Validates the SocksClientChainOptions + * @param options { SocksClientChainOptions } + */ +function validateSocksClientChainOptions(options) { + // Only connect is supported when chaining. + if (options.command !== 'connect') { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksCommandChain, options); + } + // Check destination + if (!isValidSocksRemoteHost(options.destination)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsDestination, options); + } + // Validate proxies (length) + if (!(options.proxies && + Array.isArray(options.proxies) && + options.proxies.length >= 2)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxiesLength, options); + } + // Validate proxies + options.proxies.forEach((proxy) => { + if (!isValidSocksProxy(proxy)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options); + } + // Validate custom auth (if set) + validateCustomProxyAuth(proxy, options); + }); + // Check timeout + if (options.timeout && !isValidTimeoutValue(options.timeout)) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsTimeout, options); + } +} +exports.validateSocksClientChainOptions = validateSocksClientChainOptions; +function validateCustomProxyAuth(proxy, options) { + if (proxy.custom_auth_method !== undefined) { + // Invalid auth method range + if (proxy.custom_auth_method < constants_1.SOCKS5_CUSTOM_AUTH_START || + proxy.custom_auth_method > constants_1.SOCKS5_CUSTOM_AUTH_END) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthRange, options); + } + // Missing custom_auth_request_handler + if (proxy.custom_auth_request_handler === undefined || + typeof proxy.custom_auth_request_handler !== 'function') { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + } + // Missing custom_auth_response_size + if (proxy.custom_auth_response_size === undefined) { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + } + // Missing/invalid custom_auth_response_handler + if (proxy.custom_auth_response_handler === undefined || + typeof proxy.custom_auth_response_handler !== 'function') { + throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsCustomAuthOptions, options); + } + } +} +/** + * Validates a SocksRemoteHost + * @param remoteHost { SocksRemoteHost } + */ +function isValidSocksRemoteHost(remoteHost) { + return (remoteHost && + typeof remoteHost.host === 'string' && + typeof remoteHost.port === 'number' && + remoteHost.port >= 0 && + remoteHost.port <= 65535); +} +/** + * Validates a SocksProxy + * @param proxy { SocksProxy } + */ +function isValidSocksProxy(proxy) { + return (proxy && + (typeof proxy.host === 'string' || typeof proxy.ipaddress === 'string') && + typeof proxy.port === 'number' && + proxy.port >= 0 && + proxy.port <= 65535 && + (proxy.type === 4 || proxy.type === 5)); +} +/** + * Validates a timeout value. + * @param value { Number } + */ +function isValidTimeoutValue(value) { + return typeof value === 'number' && value > 0; +} +function ipv4ToInt32(ip) { + const address = new ip_address_1.Address4(ip); + // Convert the IPv4 address parts to an integer + return address.toArray().reduce((acc, part) => (acc << 8) + part, 0); +} +exports.ipv4ToInt32 = ipv4ToInt32; +function int32ToIpv4(int32) { + // Extract each byte (octet) from the 32-bit integer + const octet1 = (int32 >>> 24) & 0xff; + const octet2 = (int32 >>> 16) & 0xff; + const octet3 = (int32 >>> 8) & 0xff; + const octet4 = int32 & 0xff; + // Combine the octets into a string in IPv4 format + return [octet1, octet2, octet3, octet4].join('.'); +} +exports.int32ToIpv4 = int32ToIpv4; +function ipToBuffer(ip) { + if (net.isIPv4(ip)) { + // Handle IPv4 addresses + const address = new ip_address_1.Address4(ip); + return Buffer.from(address.toArray()); + } + else if (net.isIPv6(ip)) { + // Handle IPv6 addresses + const address = new ip_address_1.Address6(ip); + return Buffer.from(address + .canonicalForm() + .split(':') + .map((segment) => segment.padStart(4, '0')) + .join(''), 'hex'); + } + else { + throw new Error('Invalid IP address format'); + } +} +exports.ipToBuffer = ipToBuffer; +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/build/common/receivebuffer.js b/node_modules/npm/node_modules/socks/build/common/receivebuffer.js new file mode 100644 index 00000000..3dacbf9b --- /dev/null +++ b/node_modules/npm/node_modules/socks/build/common/receivebuffer.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReceiveBuffer = void 0; +class ReceiveBuffer { + constructor(size = 4096) { + this.buffer = Buffer.allocUnsafe(size); + this.offset = 0; + this.originalSize = size; + } + get length() { + return this.offset; + } + append(data) { + if (!Buffer.isBuffer(data)) { + throw new Error('Attempted to append a non-buffer instance to ReceiveBuffer.'); + } + if (this.offset + data.length >= this.buffer.length) { + const tmp = this.buffer; + this.buffer = Buffer.allocUnsafe(Math.max(this.buffer.length + this.originalSize, this.buffer.length + data.length)); + tmp.copy(this.buffer); + } + data.copy(this.buffer, this.offset); + return (this.offset += data.length); + } + peek(length) { + if (length > this.offset) { + throw new Error('Attempted to read beyond the bounds of the managed internal data.'); + } + return this.buffer.slice(0, length); + } + get(length) { + if (length > this.offset) { + throw new Error('Attempted to read beyond the bounds of the managed internal data.'); + } + const value = Buffer.allocUnsafe(length); + this.buffer.slice(0, length).copy(value); + this.buffer.copyWithin(0, length, length + this.offset - length); + this.offset -= length; + return value; + } +} +exports.ReceiveBuffer = ReceiveBuffer; +//# sourceMappingURL=receivebuffer.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/build/common/util.js b/node_modules/npm/node_modules/socks/build/common/util.js new file mode 100644 index 00000000..f66b72e4 --- /dev/null +++ b/node_modules/npm/node_modules/socks/build/common/util.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.shuffleArray = exports.SocksClientError = void 0; +/** + * Error wrapper for SocksClient + */ +class SocksClientError extends Error { + constructor(message, options) { + super(message); + this.options = options; + } +} +exports.SocksClientError = SocksClientError; +/** + * Shuffles a given array. + * @param array The array to shuffle. + */ +function shuffleArray(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [array[i], array[j]] = [array[j], array[i]]; + } +} +exports.shuffleArray = shuffleArray; +//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/build/index.js b/node_modules/npm/node_modules/socks/build/index.js new file mode 100644 index 00000000..05fbb1d9 --- /dev/null +++ b/node_modules/npm/node_modules/socks/build/index.js @@ -0,0 +1,18 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./client/socksclient"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/docs/examples/index.md b/node_modules/npm/node_modules/socks/docs/examples/index.md new file mode 100644 index 00000000..87bfe250 --- /dev/null +++ b/node_modules/npm/node_modules/socks/docs/examples/index.md @@ -0,0 +1,17 @@ +# socks examples + +## TypeScript Examples + +[Connect command](typescript/connectExample.md) + +[Bind command](typescript/bindExample.md) + +[Associate command](typescript/associateExample.md) + +## JavaScript Examples + +[Connect command](javascript/connectExample.md) + +[Bind command](javascript/bindExample.md) + +[Associate command](javascript/associateExample.md) \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/docs/examples/javascript/associateExample.md b/node_modules/npm/node_modules/socks/docs/examples/javascript/associateExample.md new file mode 100644 index 00000000..c2c7b17b --- /dev/null +++ b/node_modules/npm/node_modules/socks/docs/examples/javascript/associateExample.md @@ -0,0 +1,90 @@ +# socks examples + +## Example for SOCKS 'associate' command + +The associate command tells the SOCKS proxy server to establish a UDP relay. The server binds to a new UDP port and communicates the newly opened port back to the origin client. From here, any SOCKS UDP frame packets sent to this special UDP port on the Proxy server will be forwarded to the desired destination, and any responses will be forwarded back to the origin client (you). + +This can be used for things such as DNS queries, and other UDP communicates. + +**Connection Steps** + +1. Client -(associate)-> Proxy (Tells the proxy to create a UDP relay and bind on a new port) +2. Client <-(port)- Proxy (Tells the origin client which port it opened and is accepting UDP frame packets on) + +At this point the proxy is accepting UDP frames on the specified port. + +3. Client --(udp frame) -> Proxy -> Destination (The origin client sends a UDP frame to the proxy on the UDP port, and the proxy then forwards it to the destination specified in the UDP frame.) +4. Client <--(udp frame) <-- Proxy <-- Destination (The destination client responds to the udp packet sent in #3) + +## Usage + +The 'associate' command can only be used by creating a new SocksClient instance and listening for the 'established' event. + +**Note:** UDP packets relayed through the proxy servers are encompassed in a special Socks UDP frame format. SocksClient.createUDPFrame() and SocksClient.parseUDPFrame() create and parse these special UDP packets. + +```typescript +const dgram = require('dgram'); +const SocksClient = require('socks').SocksClient; + +// Create a local UDP socket for sending/receiving packets to/from the proxy. +const udpSocket = dgram.createSocket('udp4'); +udpSocket.bind(); + +// Listen for incoming UDP packets from the proxy server. +udpSocket.on('message', (message, rinfo) => { + console.log(SocksClient.parseUDPFrame(message)); + /* + { frameNumber: 0, + remoteHost: { host: '8.8.8.8', port: 53 }, // The remote host that replied with a UDP packet + data: // The data + } + */ +}); + +const options = { + proxy: { + host: '104.131.124.203', + port: 1081, + type: 5 + }, + + // This should be the ip and port of the expected client that will be sending UDP frames to the newly opened UDP port on the server. + // Most SOCKS servers accept 0.0.0.0 as a wildcard address to accept UDP frames from any source. + destination: { + host: '0.0.0.0', + port: 0 + }, + + command: 'associate' +}; + +const client = new SocksClient(options); + +// This event is fired when the SOCKS server has started listening on a new UDP port for UDP relaying. +client.on('established', info => { + console.log(info); + /* + { + socket: , + remoteHost: { // This is the remote port on the SOCKS proxy server to send UDP frame packets to. + host: '104.131.124.203', + port: 58232 + } + } + */ + + // Send a udp frame to 8.8.8.8 on port 53 through the proxy. + const packet = SocksClient.createUDPFrame({ + remoteHost: { host: '8.8.8.8', port: 53 }, + data: Buffer.from('hello') // A DNS lookup in the real world. + }); + + // Send packet. + udpSocket.send(packet, info.remoteHost.port, info.remoteHost.host); +}); + +// SOCKS proxy failed to bind. +client.on('error', () => { + // Handle errors +}); +``` diff --git a/node_modules/npm/node_modules/socks/docs/examples/javascript/bindExample.md b/node_modules/npm/node_modules/socks/docs/examples/javascript/bindExample.md new file mode 100644 index 00000000..be601d52 --- /dev/null +++ b/node_modules/npm/node_modules/socks/docs/examples/javascript/bindExample.md @@ -0,0 +1,83 @@ +# socks examples + +## Example for SOCKS 'bind' command + +The bind command tells the SOCKS proxy server to bind and listen on a new TCP port for an incoming connection. It communicates the newly opened port back to the origin client. Once a incoming connection is accepted by the SOCKS proxy server it then communicates the remote host that connected to the SOCKS proxy back through the same initial connection via the origin client. + +This can be used for things such as FTP clients which require incoming TCP connections, etc. + +**Connection Steps** + +1. Client -(bind)-> Proxy (Tells the proxy to bind to a new port) +2. Client <-(port)- Proxy (Tells the origin client which port it opened) +3. Client2 --> Proxy (Other client connects to the proxy on this port) +4. Client <--(client2's host info) (Proxy tells the origin client who connected to it) +5. Original connection to the proxy is now a full TCP stream between client (you) and client2. +6. Client <--> Proxy <--> Client2 + + +## Usage + +The 'bind' command can only be used by creating a new SocksClient instance and listening for 'bound' and 'established' events. + + +```typescript +const SocksClient = require('socks').SocksClient; + +const options = { + proxy: { + host: '104.131.124.203', + port: 1081, + type: 5 + }, + + // This should be the ip and port of the expected client that will connect to the SOCKS proxy server on the newly bound port. + // Most SOCKS servers accept 0.0.0.0 as a wildcard address to accept any client. + destination: { + host: '0.0.0.0', + port: 0 + }, + + command: 'bind' +}; + +const client = new SocksClient(options); + +// This event is fired when the SOCKS server has started listening on a new port for incoming connections. +client.on('bound', (info) => { + console.log(info); + /* + { + socket: , + remoteHost: { // This is the remote ip and port of the SOCKS proxy that is now accepting incoming connections. + host: '104.131.124.203', + port: 49928 + } + } + */ +}); + +// This event is fired when the SOCKS server has accepted an incoming connection on the newly bound port. +client.on('established', (info) => { + console.log(info); + /* + { + socket: , + remoteHost: { // This is the remote ip and port that connected to the SOCKS proxy on the newly bound port. + host: '1.2.3.4', + port: 58232 + } + } + */ + + // At this point info.socket is a regular net.Socket TCP connection between client and client2 (1.2.3.4) (the client which connected to the proxy on the newly bound port.) + + console.log(info.socket); + // (this is a raw net.Socket that is established to the destination host through the given proxy servers) +}); + +// SOCKS proxy failed to bind. +client.on('error', () => { + // Handle errors +}); +``` \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/docs/examples/javascript/connectExample.md b/node_modules/npm/node_modules/socks/docs/examples/javascript/connectExample.md new file mode 100644 index 00000000..66244c5b --- /dev/null +++ b/node_modules/npm/node_modules/socks/docs/examples/javascript/connectExample.md @@ -0,0 +1,258 @@ +# socks examples + +## Example for SOCKS 'connect' command + +The connect command is the most common use-case for a SOCKS proxy. This establishes a direct connection to a destination host through a proxy server. The destination host only has knowledge of the proxy server connecting to it and does not know about the origin client (you). + +**Origin Client (you) <-> Proxy Server <-> Destination Server** + +In this example, we are connecting to a web server on port 80, and sending a very basic HTTP request to receive a response. It's worth noting that there are many socks-http-agents that can be used with the node http module (and libraries such as request.js) to make this easier. This HTTP request is used as a simple example. + +The 'connect' command can be used via the SocksClient.createConnection() factory function as well as by creating a SocksClient instance and using event handlers. + +### Using createConnection with async/await + +Since SocksClient.createConnection returns a Promise, we can easily use async/await for flow control. + +```typescript +const SocksClient = require('socks').SocksClient; + +const options = { + proxy: { + host: '104.131.124.203', + port: 1081, + type: 5 + }, + + destination: { + host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5. + port: 80 + }, + + command: 'connect' +}; + +async function start() { + try { + const info = await SocksClient.createConnection(options); + + console.log(info.socket); + // (this is a raw net.Socket that is established to the destination host through the given proxy servers) + + info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n'); + info.socket.on('data', (data) => { + console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you). + /* + HTTP/1.1 200 OK + Access-Control-Allow-Origin: * + Content-Type: application/json; charset=utf-8 + Date: Sun, 24 Dec 2017 03:47:51 GMT + Content-Length: 300 + + { + "as":"AS14061 Digital Ocean, Inc.", + "city":"Clifton", + "country":"United States", + "countryCode":"US", + "isp":"Digital Ocean", + "lat":40.8326, + "lon":-74.1307, + "org":"Digital Ocean", + "query":"104.131.124.203", + "region":"NJ", + "regionName":"New Jersey", + "status":"success", + "timezone":"America/New_York", + "zip":"07014" + } + */ + } catch (err) { + // Handle errors + } +} + +start(); +``` + +### Using createConnection with Promises + +```typescript +const SocksClient = require('socks').SocksClient; + +const options = { + proxy: { + ipaddress: '104.131.124.203', + port: 1081, + type: 5 + }, + + destination: { + host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5. + port: 80 + }, + + command: 'connect' +}; + +SocksClient.createConnection(options) +.then(info => { + console.log(info.socket); + // (this is a raw net.Socket that is established to the destination host through the given proxy servers) + + info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n'); + info.socket.on('data', (data) => { + console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you). + /* + HTTP/1.1 200 OK + Access-Control-Allow-Origin: * + Content-Type: application/json; charset=utf-8 + Date: Sun, 24 Dec 2017 03:47:51 GMT + Content-Length: 300 + + { + "as":"AS14061 Digital Ocean, Inc.", + "city":"Clifton", + "country":"United States", + "countryCode":"US", + "isp":"Digital Ocean", + "lat":40.8326, + "lon":-74.1307, + "org":"Digital Ocean", + "query":"104.131.124.203", + "region":"NJ", + "regionName":"New Jersey", + "status":"success", + "timezone":"America/New_York", + "zip":"07014" + } + */ +}) +.catch(err => { + // handle errors +}); +``` + +### Using createConnection with callbacks + +SocksClient.createConnection() optionally accepts a callback function as a second parameter. + +**Note:** If a callback function is provided, a Promise is still returned from the function, but the promise will always resolve regardless of if there was en error. (tldr: Do not mix callbacks and Promises). + +```typescript +const SocksClient = require('socks').SocksClient; + +const options = { + proxy: { + ipaddress: '104.131.124.203', + port: 1081, + type: 5 + }, + + destination: { + host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5. + port: 80 + }, + + command: 'connect' +}; + +SocksClient.createConnection(options, (err, info) => { + if (err) { + // handle errors + } else { + console.log(info.socket); + // (this is a raw net.Socket that is established to the destination host through the given proxy servers) + + info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n'); + info.socket.on('data', (data) => { + console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you). + /* + HTTP/1.1 200 OK + Access-Control-Allow-Origin: * + Content-Type: application/json; charset=utf-8 + Date: Sun, 24 Dec 2017 03:47:51 GMT + Content-Length: 300 + + { + "as":"AS14061 Digital Ocean, Inc.", + "city":"Clifton", + "country":"United States", + "countryCode":"US", + "isp":"Digital Ocean", + "lat":40.8326, + "lon":-74.1307, + "org":"Digital Ocean", + "query":"104.131.124.203", + "region":"NJ", + "regionName":"New Jersey", + "status":"success", + "timezone":"America/New_York", + "zip":"07014" + } + */ + } +}) +``` + +### Using event handlers + +SocksClient also supports instance creation of a SocksClient. This allows for event based flow control. + +```typescript +const SocksClient = require('socks').SocksClient; + +const options = { + proxy: { + ipaddress: '104.131.124.203', + port: 1081, + type: 5 + }, + + destination: { + host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5. + port: 80 + }, + + command: 'connect' +}; + +const client = new SocksClient(options); + +client.on('established', (info) => { + console.log(info.socket); + // (this is a raw net.Socket that is established to the destination host through the given proxy servers) + + info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n'); + info.socket.on('data', (data) => { + console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you). + /* + HTTP/1.1 200 OK + Access-Control-Allow-Origin: * + Content-Type: application/json; charset=utf-8 + Date: Sun, 24 Dec 2017 03:47:51 GMT + Content-Length: 300 + + { + "as":"AS14061 Digital Ocean, Inc.", + "city":"Clifton", + "country":"United States", + "countryCode":"US", + "isp":"Digital Ocean", + "lat":40.8326, + "lon":-74.1307, + "org":"Digital Ocean", + "query":"104.131.124.203", + "region":"NJ", + "regionName":"New Jersey", + "status":"success", + "timezone":"America/New_York", + "zip":"07014" + } + */ +}); + +// Failed to establish proxy connection to destination. +client.on('error', () => { + // Handle errors +}); +``` \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/docs/examples/typescript/associateExample.md b/node_modules/npm/node_modules/socks/docs/examples/typescript/associateExample.md new file mode 100644 index 00000000..e8ca1934 --- /dev/null +++ b/node_modules/npm/node_modules/socks/docs/examples/typescript/associateExample.md @@ -0,0 +1,93 @@ +# socks examples + +## Example for SOCKS 'associate' command + +The associate command tells the SOCKS proxy server to establish a UDP relay. The server binds to a new UDP port and communicates the newly opened port back to the origin client. From here, any SOCKS UDP frame packets sent to this special UDP port on the Proxy server will be forwarded to the desired destination, and any responses will be forwarded back to the origin client (you). + +This can be used for things such as DNS queries, and other UDP communicates. + +**Connection Steps** + +1. Client -(associate)-> Proxy (Tells the proxy to create a UDP relay and bind on a new port) +2. Client <-(port)- Proxy (Tells the origin client which port it opened and is accepting UDP frame packets on) + +At this point the proxy is accepting UDP frames on the specified port. + +3. Client --(udp frame) -> Proxy -> Destination (The origin client sends a UDP frame to the proxy on the UDP port, and the proxy then forwards it to the destination specified in the UDP frame.) +4. Client <--(udp frame) <-- Proxy <-- Destination (The destination client responds to the udp packet sent in #3) + +## Usage + +The 'associate' command can only be used by creating a new SocksClient instance and listening for the 'established' event. + +**Note:** UDP packets relayed through the proxy servers are packaged in a special Socks UDP frame format. SocksClient.createUDPFrame() and SocksClient.parseUDPFrame() create and parse these special UDP packets. + +```typescript +import * as dgram from 'dgram'; +import { SocksClient, SocksClientOptions } from 'socks'; + +// Create a local UDP socket for sending/receiving packets to/from the proxy. +const udpSocket = dgram.createSocket('udp4'); +udpSocket.bind(); + +// Listen for incoming UDP packets from the proxy server. +udpSocket.on('message', (message, rinfo) => { + console.log(SocksClient.parseUDPFrame(message)); + /* + { frameNumber: 0, + remoteHost: { host: '8.8.8.8', port: 53 }, // The remote host that replied with a UDP packet + data: // The data + } + */ +}); + +const options: SocksClientOptions = { + proxy: { + host: '104.131.124.203', + port: 1081, + type: 5 + }, + + // This should be the ip and port of the expected client that will be sending UDP frames to the newly opened UDP port on the server. + // Most SOCKS servers accept 0.0.0.0 as a wildcard address to accept UDP frames from any source. + destination: { + host: '0.0.0.0', + port: 0 + }, + + command: 'associate' +}; + +const client = new SocksClient(options); + +// This event is fired when the SOCKS server has started listening on a new UDP port for UDP relaying. +client.on('established', info => { + console.log(info); + /* + { + socket: , + remoteHost: { // This is the remote port on the SOCKS proxy server to send UDP frame packets to. + host: '104.131.124.203', + port: 58232 + } + } + */ + + // Send a udp frame to 8.8.8.8 on port 53 through the proxy. + const packet = SocksClient.createUDPFrame({ + remoteHost: { host: '8.8.8.8', port: 53 }, + data: Buffer.from('hello') // A DNS lookup in the real world. + }); + + // Send packet. + udpSocket.send(packet, info.remoteHost.port, info.remoteHost.host); +}); + +// SOCKS proxy failed to bind. +client.on('error', () => { + // Handle errors +}); + +// Start connection +client.connect(); +``` diff --git a/node_modules/npm/node_modules/socks/docs/examples/typescript/bindExample.md b/node_modules/npm/node_modules/socks/docs/examples/typescript/bindExample.md new file mode 100644 index 00000000..6b7607df --- /dev/null +++ b/node_modules/npm/node_modules/socks/docs/examples/typescript/bindExample.md @@ -0,0 +1,86 @@ +# socks examples + +## Example for SOCKS 'bind' command + +The bind command tells the SOCKS proxy server to bind and listen on a new TCP port for an incoming connection. It communicates the newly opened port back to the origin client. Once a incoming connection is accepted by the SOCKS proxy server it then communicates the remote host that connected to the SOCKS proxy back through the same initial connection via the origin client. + +This can be used for things such as FTP clients which require incoming TCP connections, etc. + +**Connection Steps** + +1. Client -(bind)-> Proxy (Tells the proxy to bind to a new port) +2. Client <-(port)- Proxy (Tells the origin client which port it opened) +3. Client2 --> Proxy (Other client connects to the proxy on this port) +4. Client <--(client2's host info) (Proxy tells the origin client who connected to it) +5. Original connection to the proxy is now a full TCP stream between client (you) and client2. +6. Client <--> Proxy <--> Client2 + + +## Usage + +The 'bind' command can only be used by creating a new SocksClient instance and listening for 'bound' and 'established' events. + + +```typescript +import { SocksClient, SocksClientOptions } from 'socks'; + +const options: SocksClientOptions = { + proxy: { + host: '104.131.124.203', + port: 1081, + type: 5 + }, + + // This should be the ip and port of the expected client that will connect to the SOCKS proxy server on the newly bound port. + // Most SOCKS servers accept 0.0.0.0 as a wildcard address to accept any client. + destination: { + host: '0.0.0.0', + port: 0 + }, + + command: 'bind' +}; + +const client = new SocksClient(options); + +// This event is fired when the SOCKS server has started listening on a new port for incoming connections. +client.on('bound', (info) => { + console.log(info); + /* + { + socket: , + remoteHost: { // This is the remote ip and port of the SOCKS proxy that is now accepting incoming connections. + host: '104.131.124.203', + port: 49928 + } + } + */ +}); + +// This event is fired when the SOCKS server has accepted an incoming connection on the newly bound port. +client.on('established', (info) => { + console.log(info); + /* + { + socket: , + remoteHost: { // This is the remote ip and port that connected to the SOCKS proxy on the newly bound port. + host: '1.2.3.4', + port: 58232 + } + } + */ + + // At this point info.socket is a regular net.Socket TCP connection between client and client2 (1.2.3.4) (the client which connected to the proxy on the newly bound port.) + + console.log(info.socket); + // (this is a raw net.Socket that is established to the destination host through the given proxy servers) +}); + +// SOCKS proxy failed to bind. +client.on('error', () => { + // Handle errors +}); + +// Start connection +client.connect(); +``` \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/docs/examples/typescript/connectExample.md b/node_modules/npm/node_modules/socks/docs/examples/typescript/connectExample.md new file mode 100644 index 00000000..30606d0b --- /dev/null +++ b/node_modules/npm/node_modules/socks/docs/examples/typescript/connectExample.md @@ -0,0 +1,265 @@ +# socks examples + +## Example for SOCKS 'connect' command + +The connect command is the most common use-case for a SOCKS proxy. This establishes a direct connection to a destination host through a proxy server. The destination host only has knowledge of the proxy server connecting to it and does not know about the origin client (you). + +**Origin Client (you) <-> Proxy Server <-> Destination Server** + +In this example, we are connecting to a web server on port 80, and sending a very basic HTTP request to receive a response. It's worth noting that there are many socks-http-agents that can be used with the node http module (and libraries such as request.js) to make this easier. This HTTP request is used as a simple example. + +The 'connect' command can be used via the SocksClient.createConnection() factory function as well as by creating a SocksClient instance and using event handlers. + +### Using createConnection with async/await + +Since SocksClient.createConnection returns a Promise, we can easily use async/await for flow control. + +```typescript +import { SocksClient, SocksClientOptions } from 'socks'; + +const options: SocksClientOptions = { + proxy: { + host: '104.131.124.203', + port: 1081, + type: 5 + }, + + destination: { + host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5. + port: 80 + }, + + command: 'connect' +}; + +async function start() { + try { + const info = await SocksClient.createConnection(options); + + console.log(info.socket); + // (this is a raw net.Socket that is established to the destination host through the given proxy servers) + + info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n'); + info.socket.on('data', (data) => { + console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you). + /* + HTTP/1.1 200 OK + Access-Control-Allow-Origin: * + Content-Type: application/json; charset=utf-8 + Date: Sun, 24 Dec 2017 03:47:51 GMT + Content-Length: 300 + + { + "as":"AS14061 Digital Ocean, Inc.", + "city":"Clifton", + "country":"United States", + "countryCode":"US", + "isp":"Digital Ocean", + "lat":40.8326, + "lon":-74.1307, + "org":"Digital Ocean", + "query":"104.131.124.203", + "region":"NJ", + "regionName":"New Jersey", + "status":"success", + "timezone":"America/New_York", + "zip":"07014" + } + */ + }); + } catch (err) { + // Handle errors + } +} + +start(); +``` + +### Using createConnection with Promises + +```typescript +import { SocksClient, SocksClientOptions } from 'socks'; + +const options: SocksClientOptions = { + proxy: { + ipaddress: '104.131.124.203', + port: 1081, + type: 5 + }, + + destination: { + host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5. + port: 80 + }, + + command: 'connect' +}; + +SocksClient.createConnection(options) +.then(info => { + console.log(info.socket); + // (this is a raw net.Socket that is established to the destination host through the given proxy servers) + + info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n'); + info.socket.on('data', (data) => { + console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you). + /* + HTTP/1.1 200 OK + Access-Control-Allow-Origin: * + Content-Type: application/json; charset=utf-8 + Date: Sun, 24 Dec 2017 03:47:51 GMT + Content-Length: 300 + + { + "as":"AS14061 Digital Ocean, Inc.", + "city":"Clifton", + "country":"United States", + "countryCode":"US", + "isp":"Digital Ocean", + "lat":40.8326, + "lon":-74.1307, + "org":"Digital Ocean", + "query":"104.131.124.203", + "region":"NJ", + "regionName":"New Jersey", + "status":"success", + "timezone":"America/New_York", + "zip":"07014" + } + */ + }); +}) +.catch(err => { + // handle errors +}); +``` + +### Using createConnection with callbacks + +SocksClient.createConnection() optionally accepts a callback function as a second parameter. + +**Note:** If a callback function is provided, a Promise is still returned from the function, but the promise will always resolve regardless of if there was en error. (tldr: Do not mix callbacks and Promises). + +```typescript +import { SocksClient, SocksClientOptions } from 'socks'; + +const options: SocksClientOptions = { + proxy: { + ipaddress: '104.131.124.203', + port: 1081, + type: 5 + }, + + destination: { + host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5. + port: 80 + }, + + command: 'connect' +}; + +SocksClient.createConnection(options, (err, info) => { + if (err) { + // handle errors + } else { + console.log(info.socket); + // (this is a raw net.Socket that is established to the destination host through the given proxy servers) + + info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n'); + info.socket.on('data', (data) => { + console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you). + /* + HTTP/1.1 200 OK + Access-Control-Allow-Origin: * + Content-Type: application/json; charset=utf-8 + Date: Sun, 24 Dec 2017 03:47:51 GMT + Content-Length: 300 + + { + "as":"AS14061 Digital Ocean, Inc.", + "city":"Clifton", + "country":"United States", + "countryCode":"US", + "isp":"Digital Ocean", + "lat":40.8326, + "lon":-74.1307, + "org":"Digital Ocean", + "query":"104.131.124.203", + "region":"NJ", + "regionName":"New Jersey", + "status":"success", + "timezone":"America/New_York", + "zip":"07014" + } + */ + }); + } +}) +``` + +### Using event handlers + +SocksClient also supports instance creation of a SocksClient. This allows for event based flow control. + +```typescript +import { SocksClient, SocksClientOptions } from 'socks'; + +const options: SocksClientOptions = { + proxy: { + ipaddress: '104.131.124.203', + port: 1081, + type: 5 + }, + + destination: { + host: 'ip-api.com', // host names are supported with SOCKS v4a and SOCKS v5. + port: 80 + }, + + command: 'connect' +}; + +const client = new SocksClient(options); + +client.on('established', (info) => { + console.log(info.socket); + // (this is a raw net.Socket that is established to the destination host through the given proxy servers) + + info.socket.write('GET /json HTTP/1.1\nHost: ip-api.com\n\n'); + info.socket.on('data', (data) => { + console.log(data.toString()); // ip-api.com sees that the last proxy (104.131.124.203) is connected to it and not the origin client (you). + /* + HTTP/1.1 200 OK + Access-Control-Allow-Origin: * + Content-Type: application/json; charset=utf-8 + Date: Sun, 24 Dec 2017 03:47:51 GMT + Content-Length: 300 + + { + "as":"AS14061 Digital Ocean, Inc.", + "city":"Clifton", + "country":"United States", + "countryCode":"US", + "isp":"Digital Ocean", + "lat":40.8326, + "lon":-74.1307, + "org":"Digital Ocean", + "query":"104.131.124.203", + "region":"NJ", + "regionName":"New Jersey", + "status":"success", + "timezone":"America/New_York", + "zip":"07014" + } + */ + }); +}); + +// Failed to establish proxy connection to destination. +client.on('error', () => { + // Handle errors +}); + +// Start connection +client.connect(); +``` \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/docs/index.md b/node_modules/npm/node_modules/socks/docs/index.md new file mode 100644 index 00000000..3eb1d711 --- /dev/null +++ b/node_modules/npm/node_modules/socks/docs/index.md @@ -0,0 +1,5 @@ +# Documentation + +- [API Reference](https://github.com/JoshGlazebrook/socks#api-reference) + +- [Code Examples](./examples/index.md) \ No newline at end of file diff --git a/node_modules/npm/node_modules/socks/docs/migratingFromV1.md b/node_modules/npm/node_modules/socks/docs/migratingFromV1.md new file mode 100644 index 00000000..dd008384 --- /dev/null +++ b/node_modules/npm/node_modules/socks/docs/migratingFromV1.md @@ -0,0 +1,86 @@ +# socks + +## Migrating from v1 + +For the most part, migrating from v1 takes minimal effort as v2 still supports factory creation of proxy connections with callback support. + +### Notable breaking changes + +- In an options object, the proxy 'command' is now required and does not default to 'connect'. +- **In an options object, 'target' is now known as 'destination'.** +- Sockets are no longer paused after a SOCKS connection is made, so socket.resume() is no longer required. (Please be sure to attach data handlers immediately to the Socket to avoid losing data). +- In v2, only the 'connect' command is supported via the factory SocksClient.createConnection function. (BIND and ASSOCIATE must be used with a SocksClient instance via event handlers). +- In v2, the factory SocksClient.createConnection function callback is called with a single object rather than separate socket and info object. +- A SOCKS http/https agent is no longer bundled into the library. + +For informational purposes, here is the original getting started example from v1 converted to work with v2. + +### Before (v1) + +```javascript +var Socks = require('socks'); + +var options = { + proxy: { + ipaddress: "202.101.228.108", + port: 1080, + type: 5 + }, + target: { + host: "google.com", + port: 80 + }, + command: 'connect' +}; + +Socks.createConnection(options, function(err, socket, info) { + if (err) + console.log(err); + else { + socket.write("GET / HTTP/1.1\nHost: google.com\n\n"); + socket.on('data', function(data) { + console.log(data.length); + console.log(data); + }); + + // PLEASE NOTE: sockets need to be resumed before any data will come in or out as they are paused right before this callback is fired. + socket.resume(); + + // 569 + // = 10.0.0", + "npm": ">= 3.0.0" + }, + "author": "Josh Glazebrook", + "contributors": [ + "castorw" + ], + "license": "MIT", + "readmeFilename": "README.md", + "devDependencies": { + "@types/mocha": "^10.0.6", + "@types/node": "^20.11.17", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", + "eslint": "^8.20.0", + "mocha": "^10.0.0", + "prettier": "^3.2.5", + "ts-node": "^10.9.1", + "typescript": "^5.3.3" + }, + "dependencies": { + "ip-address": "^9.0.5", + "smart-buffer": "^4.2.0" + }, + "scripts": { + "prepublish": "npm install -g typescript && npm run build", + "test": "NODE_ENV=test mocha --recursive --require ts-node/register test/**/*.ts", + "prettier": "prettier --write ./src/**/*.ts --config .prettierrc.yaml", + "lint": "eslint 'src/**/*.ts'", + "build": "rm -rf build typings && prettier --write ./src/**/*.ts --config .prettierrc.yaml && tsc -p .", + "build-raw": "rm -rf build typings && tsc -p ." + } +} diff --git a/node_modules/npm/node_modules/spdx-correct/LICENSE b/node_modules/npm/node_modules/spdx-correct/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-correct/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/node_modules/npm/node_modules/spdx-correct/index.js b/node_modules/npm/node_modules/spdx-correct/index.js new file mode 100644 index 00000000..4d9037e0 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-correct/index.js @@ -0,0 +1,386 @@ +/* +Copyright spdx-correct.js contributors + +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. +*/ +var parse = require('spdx-expression-parse') +var spdxLicenseIds = require('spdx-license-ids') + +function valid (string) { + try { + parse(string) + return true + } catch (error) { + return false + } +} + +// Sorting function that orders the given array of transpositions such +// that a transposition with the longer pattern comes before a transposition +// with a shorter pattern. This is to prevent e.g. the transposition +// ["General Public License", "GPL"] from matching to "Lesser General Public License" +// before a longer and more accurate transposition ["Lesser General Public License", "LGPL"] +// has a chance to be recognized. +function sortTranspositions(a, b) { + var length = b[0].length - a[0].length + if (length !== 0) return length + return a[0].toUpperCase().localeCompare(b[0].toUpperCase()) +} + +// Common transpositions of license identifier acronyms +var transpositions = [ + ['APGL', 'AGPL'], + ['Gpl', 'GPL'], + ['GLP', 'GPL'], + ['APL', 'Apache'], + ['ISD', 'ISC'], + ['GLP', 'GPL'], + ['IST', 'ISC'], + ['Claude', 'Clause'], + [' or later', '+'], + [' International', ''], + ['GNU', 'GPL'], + ['GUN', 'GPL'], + ['+', ''], + ['GNU GPL', 'GPL'], + ['GNU LGPL', 'LGPL'], + ['GNU/GPL', 'GPL'], + ['GNU GLP', 'GPL'], + ['GNU LESSER GENERAL PUBLIC LICENSE', 'LGPL'], + ['GNU Lesser General Public License', 'LGPL'], + ['GNU LESSER GENERAL PUBLIC LICENSE', 'LGPL-2.1'], + ['GNU Lesser General Public License', 'LGPL-2.1'], + ['LESSER GENERAL PUBLIC LICENSE', 'LGPL'], + ['Lesser General Public License', 'LGPL'], + ['LESSER GENERAL PUBLIC LICENSE', 'LGPL-2.1'], + ['Lesser General Public License', 'LGPL-2.1'], + ['GNU General Public License', 'GPL'], + ['Gnu public license', 'GPL'], + ['GNU Public License', 'GPL'], + ['GNU GENERAL PUBLIC LICENSE', 'GPL'], + ['MTI', 'MIT'], + ['Mozilla Public License', 'MPL'], + ['Universal Permissive License', 'UPL'], + ['WTH', 'WTF'], + ['WTFGPL', 'WTFPL'], + ['-License', ''] +].sort(sortTranspositions) + +var TRANSPOSED = 0 +var CORRECT = 1 + +// Simple corrections to nearly valid identifiers. +var transforms = [ + // e.g. 'mit' + function (argument) { + return argument.toUpperCase() + }, + // e.g. 'MIT ' + function (argument) { + return argument.trim() + }, + // e.g. 'M.I.T.' + function (argument) { + return argument.replace(/\./g, '') + }, + // e.g. 'Apache- 2.0' + function (argument) { + return argument.replace(/\s+/g, '') + }, + // e.g. 'CC BY 4.0'' + function (argument) { + return argument.replace(/\s+/g, '-') + }, + // e.g. 'LGPLv2.1' + function (argument) { + return argument.replace('v', '-') + }, + // e.g. 'Apache 2.0' + function (argument) { + return argument.replace(/,?\s*(\d)/, '-$1') + }, + // e.g. 'GPL 2' + function (argument) { + return argument.replace(/,?\s*(\d)/, '-$1.0') + }, + // e.g. 'Apache Version 2.0' + function (argument) { + return argument + .replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2') + }, + // e.g. 'Apache Version 2' + function (argument) { + return argument + .replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/, '-$2.0') + }, + // e.g. 'ZLIB' + function (argument) { + return argument[0].toUpperCase() + argument.slice(1) + }, + // e.g. 'MPL/2.0' + function (argument) { + return argument.replace('/', '-') + }, + // e.g. 'Apache 2' + function (argument) { + return argument + .replace(/\s*V\s*(\d)/, '-$1') + .replace(/(\d)$/, '$1.0') + }, + // e.g. 'GPL-2.0', 'GPL-3.0' + function (argument) { + if (argument.indexOf('3.0') !== -1) { + return argument + '-or-later' + } else { + return argument + '-only' + } + }, + // e.g. 'GPL-2.0-' + function (argument) { + return argument + 'only' + }, + // e.g. 'GPL2' + function (argument) { + return argument.replace(/(\d)$/, '-$1.0') + }, + // e.g. 'BSD 3' + function (argument) { + return argument.replace(/(-| )?(\d)$/, '-$2-Clause') + }, + // e.g. 'BSD clause 3' + function (argument) { + return argument.replace(/(-| )clause(-| )(\d)/, '-$3-Clause') + }, + // e.g. 'New BSD license' + function (argument) { + return argument.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i, 'BSD-3-Clause') + }, + // e.g. 'Simplified BSD license' + function (argument) { + return argument.replace(/\bSimplified(-| )?BSD((-| )License)?/i, 'BSD-2-Clause') + }, + // e.g. 'Free BSD license' + function (argument) { + return argument.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i, 'BSD-2-Clause-$1BSD') + }, + // e.g. 'Clear BSD license' + function (argument) { + return argument.replace(/\bClear(-| )?BSD((-| )License)?/i, 'BSD-3-Clause-Clear') + }, + // e.g. 'Old BSD License' + function (argument) { + return argument.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i, 'BSD-4-Clause') + }, + // e.g. 'BY-NC-4.0' + function (argument) { + return 'CC-' + argument + }, + // e.g. 'BY-NC' + function (argument) { + return 'CC-' + argument + '-4.0' + }, + // e.g. 'Attribution-NonCommercial' + function (argument) { + return argument + .replace('Attribution', 'BY') + .replace('NonCommercial', 'NC') + .replace('NoDerivatives', 'ND') + .replace(/ (\d)/, '-$1') + .replace(/ ?International/, '') + }, + // e.g. 'Attribution-NonCommercial' + function (argument) { + return 'CC-' + + argument + .replace('Attribution', 'BY') + .replace('NonCommercial', 'NC') + .replace('NoDerivatives', 'ND') + .replace(/ (\d)/, '-$1') + .replace(/ ?International/, '') + + '-4.0' + } +] + +var licensesWithVersions = spdxLicenseIds + .map(function (id) { + var match = /^(.*)-\d+\.\d+$/.exec(id) + return match + ? [match[0], match[1]] + : [id, null] + }) + .reduce(function (objectMap, item) { + var key = item[1] + objectMap[key] = objectMap[key] || [] + objectMap[key].push(item[0]) + return objectMap + }, {}) + +var licensesWithOneVersion = Object.keys(licensesWithVersions) + .map(function makeEntries (key) { + return [key, licensesWithVersions[key]] + }) + .filter(function identifySoleVersions (item) { + return ( + // Licenses has just one valid version suffix. + item[1].length === 1 && + item[0] !== null && + // APL will be considered Apache, rather than APL-1.0 + item[0] !== 'APL' + ) + }) + .map(function createLastResorts (item) { + return [item[0], item[1][0]] + }) + +licensesWithVersions = undefined + +// If all else fails, guess that strings containing certain substrings +// meant to identify certain licenses. +var lastResorts = [ + ['UNLI', 'Unlicense'], + ['WTF', 'WTFPL'], + ['2 CLAUSE', 'BSD-2-Clause'], + ['2-CLAUSE', 'BSD-2-Clause'], + ['3 CLAUSE', 'BSD-3-Clause'], + ['3-CLAUSE', 'BSD-3-Clause'], + ['AFFERO', 'AGPL-3.0-or-later'], + ['AGPL', 'AGPL-3.0-or-later'], + ['APACHE', 'Apache-2.0'], + ['ARTISTIC', 'Artistic-2.0'], + ['Affero', 'AGPL-3.0-or-later'], + ['BEER', 'Beerware'], + ['BOOST', 'BSL-1.0'], + ['BSD', 'BSD-2-Clause'], + ['CDDL', 'CDDL-1.1'], + ['ECLIPSE', 'EPL-1.0'], + ['FUCK', 'WTFPL'], + ['GNU', 'GPL-3.0-or-later'], + ['LGPL', 'LGPL-3.0-or-later'], + ['GPLV1', 'GPL-1.0-only'], + ['GPL-1', 'GPL-1.0-only'], + ['GPLV2', 'GPL-2.0-only'], + ['GPL-2', 'GPL-2.0-only'], + ['GPL', 'GPL-3.0-or-later'], + ['MIT +NO-FALSE-ATTRIBS', 'MITNFA'], + ['MIT', 'MIT'], + ['MPL', 'MPL-2.0'], + ['X11', 'X11'], + ['ZLIB', 'Zlib'] +].concat(licensesWithOneVersion).sort(sortTranspositions) + +var SUBSTRING = 0 +var IDENTIFIER = 1 + +var validTransformation = function (identifier) { + for (var i = 0; i < transforms.length; i++) { + var transformed = transforms[i](identifier).trim() + if (transformed !== identifier && valid(transformed)) { + return transformed + } + } + return null +} + +var validLastResort = function (identifier) { + var upperCased = identifier.toUpperCase() + for (var i = 0; i < lastResorts.length; i++) { + var lastResort = lastResorts[i] + if (upperCased.indexOf(lastResort[SUBSTRING]) > -1) { + return lastResort[IDENTIFIER] + } + } + return null +} + +var anyCorrection = function (identifier, check) { + for (var i = 0; i < transpositions.length; i++) { + var transposition = transpositions[i] + var transposed = transposition[TRANSPOSED] + if (identifier.indexOf(transposed) > -1) { + var corrected = identifier.replace( + transposed, + transposition[CORRECT] + ) + var checked = check(corrected) + if (checked !== null) { + return checked + } + } + } + return null +} + +module.exports = function (identifier, options) { + options = options || {} + var upgrade = options.upgrade === undefined ? true : !!options.upgrade + function postprocess (value) { + return upgrade ? upgradeGPLs(value) : value + } + var validArugment = ( + typeof identifier === 'string' && + identifier.trim().length !== 0 + ) + if (!validArugment) { + throw Error('Invalid argument. Expected non-empty string.') + } + identifier = identifier.trim() + if (valid(identifier)) { + return postprocess(identifier) + } + var noPlus = identifier.replace(/\+$/, '').trim() + if (valid(noPlus)) { + return postprocess(noPlus) + } + var transformed = validTransformation(identifier) + if (transformed !== null) { + return postprocess(transformed) + } + transformed = anyCorrection(identifier, function (argument) { + if (valid(argument)) { + return argument + } + return validTransformation(argument) + }) + if (transformed !== null) { + return postprocess(transformed) + } + transformed = validLastResort(identifier) + if (transformed !== null) { + return postprocess(transformed) + } + transformed = anyCorrection(identifier, validLastResort) + if (transformed !== null) { + return postprocess(transformed) + } + return null +} + +function upgradeGPLs (value) { + if ([ + 'GPL-1.0', 'LGPL-1.0', 'AGPL-1.0', + 'GPL-2.0', 'LGPL-2.0', 'AGPL-2.0', + 'LGPL-2.1' + ].indexOf(value) !== -1) { + return value + '-only' + } else if ([ + 'GPL-1.0+', 'GPL-2.0+', 'GPL-3.0+', + 'LGPL-2.0+', 'LGPL-2.1+', 'LGPL-3.0+', + 'AGPL-1.0+', 'AGPL-3.0+' + ].indexOf(value) !== -1) { + return value.replace(/\+$/, '-or-later') + } else if (['GPL-3.0', 'LGPL-3.0', 'AGPL-3.0'].indexOf(value) !== -1) { + return value + '-or-later' + } else { + return value + } +} diff --git a/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/AUTHORS b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/AUTHORS new file mode 100644 index 00000000..257a76b9 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/AUTHORS @@ -0,0 +1,4 @@ +C. Scott Ananian (http://cscott.net) +Kyle E. Mitchell (https://kemitchell.com) +Shinnosuke Watanabe +Antoine Motet diff --git a/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/LICENSE b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/LICENSE new file mode 100644 index 00000000..831618ea --- /dev/null +++ b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/LICENSE @@ -0,0 +1,22 @@ +The MIT License + +Copyright (c) 2015 Kyle E. Mitchell & other authors listed in AUTHORS + +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/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/index.js b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/index.js new file mode 100644 index 00000000..52fab560 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/index.js @@ -0,0 +1,8 @@ +'use strict' + +var scan = require('./scan') +var parse = require('./parse') + +module.exports = function (source) { + return parse(scan(source)) +} diff --git a/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/package.json b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/package.json new file mode 100644 index 00000000..c9edc9f9 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/package.json @@ -0,0 +1,39 @@ +{ + "name": "spdx-expression-parse", + "description": "parse SPDX license expressions", + "version": "3.0.1", + "author": "Kyle E. Mitchell (https://kemitchell.com)", + "files": [ + "AUTHORS", + "index.js", + "parse.js", + "scan.js" + ], + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + }, + "devDependencies": { + "defence-cli": "^3.0.1", + "replace-require-self": "^1.0.0", + "standard": "^14.1.0" + }, + "keywords": [ + "SPDX", + "law", + "legal", + "license", + "metadata", + "package", + "package.json", + "standards" + ], + "license": "MIT", + "repository": "jslicense/spdx-expression-parse.js", + "scripts": { + "lint": "standard", + "test:readme": "defence -i javascript README.md | replace-require-self | node", + "test:suite": "node test.js", + "test": "npm run test:suite && npm run test:readme" + } +} diff --git a/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/parse.js b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/parse.js new file mode 100644 index 00000000..5a00b45c --- /dev/null +++ b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/parse.js @@ -0,0 +1,138 @@ +'use strict' + +// The ABNF grammar in the spec is totally ambiguous. +// +// This parser follows the operator precedence defined in the +// `Order of Precedence and Parentheses` section. + +module.exports = function (tokens) { + var index = 0 + + function hasMore () { + return index < tokens.length + } + + function token () { + return hasMore() ? tokens[index] : null + } + + function next () { + if (!hasMore()) { + throw new Error() + } + index++ + } + + function parseOperator (operator) { + var t = token() + if (t && t.type === 'OPERATOR' && operator === t.string) { + next() + return t.string + } + } + + function parseWith () { + if (parseOperator('WITH')) { + var t = token() + if (t && t.type === 'EXCEPTION') { + next() + return t.string + } + throw new Error('Expected exception after `WITH`') + } + } + + function parseLicenseRef () { + // TODO: Actually, everything is concatenated into one string + // for backward-compatibility but it could be better to return + // a nice structure. + var begin = index + var string = '' + var t = token() + if (t.type === 'DOCUMENTREF') { + next() + string += 'DocumentRef-' + t.string + ':' + if (!parseOperator(':')) { + throw new Error('Expected `:` after `DocumentRef-...`') + } + } + t = token() + if (t.type === 'LICENSEREF') { + next() + string += 'LicenseRef-' + t.string + return { license: string } + } + index = begin + } + + function parseLicense () { + var t = token() + if (t && t.type === 'LICENSE') { + next() + var node = { license: t.string } + if (parseOperator('+')) { + node.plus = true + } + var exception = parseWith() + if (exception) { + node.exception = exception + } + return node + } + } + + function parseParenthesizedExpression () { + var left = parseOperator('(') + if (!left) { + return + } + + var expr = parseExpression() + + if (!parseOperator(')')) { + throw new Error('Expected `)`') + } + + return expr + } + + function parseAtom () { + return ( + parseParenthesizedExpression() || + parseLicenseRef() || + parseLicense() + ) + } + + function makeBinaryOpParser (operator, nextParser) { + return function parseBinaryOp () { + var left = nextParser() + if (!left) { + return + } + + if (!parseOperator(operator)) { + return left + } + + var right = parseBinaryOp() + if (!right) { + throw new Error('Expected expression') + } + return { + left: left, + conjunction: operator.toLowerCase(), + right: right + } + } + } + + var parseAnd = makeBinaryOpParser('AND', parseAtom) + var parseExpression = makeBinaryOpParser('OR', parseAnd) + + var node = parseExpression() + if (!node || hasMore()) { + throw new Error('Syntax error') + } + return node +} diff --git a/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/scan.js b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/scan.js new file mode 100644 index 00000000..b74fce2e --- /dev/null +++ b/node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse/scan.js @@ -0,0 +1,131 @@ +'use strict' + +var licenses = [] + .concat(require('spdx-license-ids')) + .concat(require('spdx-license-ids/deprecated')) +var exceptions = require('spdx-exceptions') + +module.exports = function (source) { + var index = 0 + + function hasMore () { + return index < source.length + } + + // `value` can be a regexp or a string. + // If it is recognized, the matching source string is returned and + // the index is incremented. Otherwise `undefined` is returned. + function read (value) { + if (value instanceof RegExp) { + var chars = source.slice(index) + var match = chars.match(value) + if (match) { + index += match[0].length + return match[0] + } + } else { + if (source.indexOf(value, index) === index) { + index += value.length + return value + } + } + } + + function skipWhitespace () { + read(/[ ]*/) + } + + function operator () { + var string + var possibilities = ['WITH', 'AND', 'OR', '(', ')', ':', '+'] + for (var i = 0; i < possibilities.length; i++) { + string = read(possibilities[i]) + if (string) { + break + } + } + + if (string === '+' && index > 1 && source[index - 2] === ' ') { + throw new Error('Space before `+`') + } + + return string && { + type: 'OPERATOR', + string: string + } + } + + function idstring () { + return read(/[A-Za-z0-9-.]+/) + } + + function expectIdstring () { + var string = idstring() + if (!string) { + throw new Error('Expected idstring at offset ' + index) + } + return string + } + + function documentRef () { + if (read('DocumentRef-')) { + var string = expectIdstring() + return { type: 'DOCUMENTREF', string: string } + } + } + + function licenseRef () { + if (read('LicenseRef-')) { + var string = expectIdstring() + return { type: 'LICENSEREF', string: string } + } + } + + function identifier () { + var begin = index + var string = idstring() + + if (licenses.indexOf(string) !== -1) { + return { + type: 'LICENSE', + string: string + } + } else if (exceptions.indexOf(string) !== -1) { + return { + type: 'EXCEPTION', + string: string + } + } + + index = begin + } + + // Tries to read the next token. Returns `undefined` if no token is + // recognized. + function parseToken () { + // Ordering matters + return ( + operator() || + documentRef() || + licenseRef() || + identifier() + ) + } + + var tokens = [] + while (hasMore()) { + skipWhitespace() + if (!hasMore()) { + break + } + + var token = parseToken() + if (!token) { + throw new Error('Unexpected `' + source[index] + + '` at offset ' + index) + } + + tokens.push(token) + } + return tokens +} diff --git a/node_modules/npm/node_modules/spdx-correct/package.json b/node_modules/npm/node_modules/spdx-correct/package.json new file mode 100644 index 00000000..d7761563 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-correct/package.json @@ -0,0 +1,32 @@ +{ + "name": "spdx-correct", + "description": "correct invalid SPDX expressions", + "version": "3.2.0", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + }, + "devDependencies": { + "defence-cli": "^3.0.1", + "replace-require-self": "^1.0.0", + "standard": "^14.3.4", + "standard-markdown": "^6.0.0", + "tape": "^5.0.1" + }, + "files": [ + "index.js" + ], + "keywords": [ + "SPDX", + "law", + "legal", + "license", + "metadata" + ], + "license": "Apache-2.0", + "repository": "jslicense/spdx-correct.js", + "scripts": { + "lint": "standard && standard-markdown README.md", + "test": "defence README.md | replace-require-self | node && node test.js" + } +} diff --git a/node_modules/npm/node_modules/spdx-exceptions/deprecated.json b/node_modules/npm/node_modules/spdx-exceptions/deprecated.json new file mode 100644 index 00000000..cba7e2ba --- /dev/null +++ b/node_modules/npm/node_modules/spdx-exceptions/deprecated.json @@ -0,0 +1,3 @@ +[ + "Nokia-Qt-exception-1.1" +] diff --git a/node_modules/npm/node_modules/spdx-exceptions/index.json b/node_modules/npm/node_modules/spdx-exceptions/index.json new file mode 100644 index 00000000..d9549d3e --- /dev/null +++ b/node_modules/npm/node_modules/spdx-exceptions/index.json @@ -0,0 +1,68 @@ +[ + "389-exception", + "Asterisk-exception", + "Autoconf-exception-2.0", + "Autoconf-exception-3.0", + "Autoconf-exception-generic", + "Autoconf-exception-generic-3.0", + "Autoconf-exception-macro", + "Bison-exception-1.24", + "Bison-exception-2.2", + "Bootloader-exception", + "Classpath-exception-2.0", + "CLISP-exception-2.0", + "cryptsetup-OpenSSL-exception", + "DigiRule-FOSS-exception", + "eCos-exception-2.0", + "Fawkes-Runtime-exception", + "FLTK-exception", + "fmt-exception", + "Font-exception-2.0", + "freertos-exception-2.0", + "GCC-exception-2.0", + "GCC-exception-2.0-note", + "GCC-exception-3.1", + "Gmsh-exception", + "GNAT-exception", + "GNOME-examples-exception", + "GNU-compiler-exception", + "gnu-javamail-exception", + "GPL-3.0-interface-exception", + "GPL-3.0-linking-exception", + "GPL-3.0-linking-source-exception", + "GPL-CC-1.0", + "GStreamer-exception-2005", + "GStreamer-exception-2008", + "i2p-gpl-java-exception", + "KiCad-libraries-exception", + "LGPL-3.0-linking-exception", + "libpri-OpenH323-exception", + "Libtool-exception", + "Linux-syscall-note", + "LLGPL", + "LLVM-exception", + "LZMA-exception", + "mif-exception", + "OCaml-LGPL-linking-exception", + "OCCT-exception-1.0", + "OpenJDK-assembly-exception-1.0", + "openvpn-openssl-exception", + "PS-or-PDF-font-exception-20170817", + "QPL-1.0-INRIA-2004-exception", + "Qt-GPL-exception-1.0", + "Qt-LGPL-exception-1.1", + "Qwt-exception-1.0", + "SANE-exception", + "SHL-2.0", + "SHL-2.1", + "stunnel-exception", + "SWI-exception", + "Swift-exception", + "Texinfo-exception", + "u-boot-exception-2.0", + "UBDL-exception", + "Universal-FOSS-exception-1.0", + "vsftpd-openssl-exception", + "WxWindows-exception-3.1", + "x11vnc-openssl-exception" +] diff --git a/node_modules/npm/node_modules/spdx-exceptions/package.json b/node_modules/npm/node_modules/spdx-exceptions/package.json new file mode 100644 index 00000000..2f9a9504 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-exceptions/package.json @@ -0,0 +1,19 @@ +{ + "name": "spdx-exceptions", + "description": "list of SPDX standard license exceptions", + "version": "2.5.0", + "author": "The Linux Foundation", + "contributors": [ + "Kyle E. Mitchell (https://kemitchell.com/)" + ], + "license": "CC-BY-3.0", + "repository": "kemitchell/spdx-exceptions.json", + "files": [ + "index.json", + "deprecated.json" + ], + "scripts": { + "build": "node build.js", + "latest": "node latest.js" + } +} diff --git a/node_modules/npm/node_modules/spdx-expression-parse/AUTHORS b/node_modules/npm/node_modules/spdx-expression-parse/AUTHORS new file mode 100644 index 00000000..257a76b9 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-expression-parse/AUTHORS @@ -0,0 +1,4 @@ +C. Scott Ananian (http://cscott.net) +Kyle E. Mitchell (https://kemitchell.com) +Shinnosuke Watanabe +Antoine Motet diff --git a/node_modules/npm/node_modules/spdx-expression-parse/LICENSE b/node_modules/npm/node_modules/spdx-expression-parse/LICENSE new file mode 100644 index 00000000..831618ea --- /dev/null +++ b/node_modules/npm/node_modules/spdx-expression-parse/LICENSE @@ -0,0 +1,22 @@ +The MIT License + +Copyright (c) 2015 Kyle E. Mitchell & other authors listed in AUTHORS + +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/npm/node_modules/spdx-expression-parse/index.js b/node_modules/npm/node_modules/spdx-expression-parse/index.js new file mode 100644 index 00000000..52fab560 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-expression-parse/index.js @@ -0,0 +1,8 @@ +'use strict' + +var scan = require('./scan') +var parse = require('./parse') + +module.exports = function (source) { + return parse(scan(source)) +} diff --git a/node_modules/npm/node_modules/spdx-expression-parse/package.json b/node_modules/npm/node_modules/spdx-expression-parse/package.json new file mode 100644 index 00000000..c3a22afc --- /dev/null +++ b/node_modules/npm/node_modules/spdx-expression-parse/package.json @@ -0,0 +1,39 @@ +{ + "name": "spdx-expression-parse", + "description": "parse SPDX license expressions", + "version": "4.0.0", + "author": "Kyle E. Mitchell (https://kemitchell.com)", + "files": [ + "AUTHORS", + "index.js", + "parse.js", + "scan.js" + ], + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + }, + "devDependencies": { + "defence-cli": "^3.0.1", + "replace-require-self": "^1.0.0", + "standard": "^14.1.0" + }, + "keywords": [ + "SPDX", + "law", + "legal", + "license", + "metadata", + "package", + "package.json", + "standards" + ], + "license": "MIT", + "repository": "jslicense/spdx-expression-parse.js", + "scripts": { + "lint": "standard", + "test:readme": "defence -i javascript README.md | replace-require-self | node", + "test:suite": "node test.js", + "test": "npm run test:suite && npm run test:readme" + } +} diff --git a/node_modules/npm/node_modules/spdx-expression-parse/parse.js b/node_modules/npm/node_modules/spdx-expression-parse/parse.js new file mode 100644 index 00000000..5a00b45c --- /dev/null +++ b/node_modules/npm/node_modules/spdx-expression-parse/parse.js @@ -0,0 +1,138 @@ +'use strict' + +// The ABNF grammar in the spec is totally ambiguous. +// +// This parser follows the operator precedence defined in the +// `Order of Precedence and Parentheses` section. + +module.exports = function (tokens) { + var index = 0 + + function hasMore () { + return index < tokens.length + } + + function token () { + return hasMore() ? tokens[index] : null + } + + function next () { + if (!hasMore()) { + throw new Error() + } + index++ + } + + function parseOperator (operator) { + var t = token() + if (t && t.type === 'OPERATOR' && operator === t.string) { + next() + return t.string + } + } + + function parseWith () { + if (parseOperator('WITH')) { + var t = token() + if (t && t.type === 'EXCEPTION') { + next() + return t.string + } + throw new Error('Expected exception after `WITH`') + } + } + + function parseLicenseRef () { + // TODO: Actually, everything is concatenated into one string + // for backward-compatibility but it could be better to return + // a nice structure. + var begin = index + var string = '' + var t = token() + if (t.type === 'DOCUMENTREF') { + next() + string += 'DocumentRef-' + t.string + ':' + if (!parseOperator(':')) { + throw new Error('Expected `:` after `DocumentRef-...`') + } + } + t = token() + if (t.type === 'LICENSEREF') { + next() + string += 'LicenseRef-' + t.string + return { license: string } + } + index = begin + } + + function parseLicense () { + var t = token() + if (t && t.type === 'LICENSE') { + next() + var node = { license: t.string } + if (parseOperator('+')) { + node.plus = true + } + var exception = parseWith() + if (exception) { + node.exception = exception + } + return node + } + } + + function parseParenthesizedExpression () { + var left = parseOperator('(') + if (!left) { + return + } + + var expr = parseExpression() + + if (!parseOperator(')')) { + throw new Error('Expected `)`') + } + + return expr + } + + function parseAtom () { + return ( + parseParenthesizedExpression() || + parseLicenseRef() || + parseLicense() + ) + } + + function makeBinaryOpParser (operator, nextParser) { + return function parseBinaryOp () { + var left = nextParser() + if (!left) { + return + } + + if (!parseOperator(operator)) { + return left + } + + var right = parseBinaryOp() + if (!right) { + throw new Error('Expected expression') + } + return { + left: left, + conjunction: operator.toLowerCase(), + right: right + } + } + } + + var parseAnd = makeBinaryOpParser('AND', parseAtom) + var parseExpression = makeBinaryOpParser('OR', parseAnd) + + var node = parseExpression() + if (!node || hasMore()) { + throw new Error('Syntax error') + } + return node +} diff --git a/node_modules/npm/node_modules/spdx-expression-parse/scan.js b/node_modules/npm/node_modules/spdx-expression-parse/scan.js new file mode 100644 index 00000000..52852228 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-expression-parse/scan.js @@ -0,0 +1,131 @@ +'use strict' + +var licenses = [] + .concat(require('spdx-license-ids')) + .concat(require('spdx-license-ids/deprecated')) +var exceptions = require('spdx-exceptions') + +module.exports = function (source) { + var index = 0 + + function hasMore () { + return index < source.length + } + + // `value` can be a regexp or a string. + // If it is recognized, the matching source string is returned and + // the index is incremented. Otherwise `undefined` is returned. + function read (value) { + if (value instanceof RegExp) { + var chars = source.slice(index) + var match = chars.match(value) + if (match) { + index += match[0].length + return match[0] + } + } else { + if (source.indexOf(value, index) === index) { + index += value.length + return value + } + } + } + + function skipWhitespace () { + read(/[ ]*/) + } + + function operator () { + var string + var possibilities = [/^WITH/i, /^AND/i, /^OR/i, '(', ')', ':', '+'] + for (var i = 0; i < possibilities.length; i++) { + string = read(possibilities[i]) + if (string) { + break + } + } + + if (string === '+' && index > 1 && source[index - 2] === ' ') { + throw new Error('Space before `+`') + } + + return string && { + type: 'OPERATOR', + string: string.toUpperCase() + } + } + + function idstring () { + return read(/[A-Za-z0-9-.]+/) + } + + function expectIdstring () { + var string = idstring() + if (!string) { + throw new Error('Expected idstring at offset ' + index) + } + return string + } + + function documentRef () { + if (read('DocumentRef-')) { + var string = expectIdstring() + return { type: 'DOCUMENTREF', string: string } + } + } + + function licenseRef () { + if (read('LicenseRef-')) { + var string = expectIdstring() + return { type: 'LICENSEREF', string: string } + } + } + + function identifier () { + var begin = index + var string = idstring() + + if (licenses.indexOf(string) !== -1) { + return { + type: 'LICENSE', + string: string + } + } else if (exceptions.indexOf(string) !== -1) { + return { + type: 'EXCEPTION', + string: string + } + } + + index = begin + } + + // Tries to read the next token. Returns `undefined` if no token is + // recognized. + function parseToken () { + // Ordering matters + return ( + operator() || + documentRef() || + licenseRef() || + identifier() + ) + } + + var tokens = [] + while (hasMore()) { + skipWhitespace() + if (!hasMore()) { + break + } + + var token = parseToken() + if (!token) { + throw new Error('Unexpected `' + source[index] + + '` at offset ' + index) + } + + tokens.push(token) + } + return tokens +} diff --git a/node_modules/npm/node_modules/spdx-license-ids/deprecated.json b/node_modules/npm/node_modules/spdx-license-ids/deprecated.json new file mode 100644 index 00000000..4f70a14c --- /dev/null +++ b/node_modules/npm/node_modules/spdx-license-ids/deprecated.json @@ -0,0 +1,28 @@ +[ + "AGPL-1.0", + "AGPL-3.0", + "BSD-2-Clause-FreeBSD", + "BSD-2-Clause-NetBSD", + "GFDL-1.1", + "GFDL-1.2", + "GFDL-1.3", + "GPL-1.0", + "GPL-2.0", + "GPL-2.0-with-GCC-exception", + "GPL-2.0-with-autoconf-exception", + "GPL-2.0-with-bison-exception", + "GPL-2.0-with-classpath-exception", + "GPL-2.0-with-font-exception", + "GPL-3.0", + "GPL-3.0-with-GCC-exception", + "GPL-3.0-with-autoconf-exception", + "LGPL-2.0", + "LGPL-2.1", + "LGPL-3.0", + "Net-SNMP", + "Nunit", + "StandardML-NJ", + "bzip2-1.0.5", + "eCos-2.0", + "wxWindows" +] diff --git a/node_modules/npm/node_modules/spdx-license-ids/index.json b/node_modules/npm/node_modules/spdx-license-ids/index.json new file mode 100644 index 00000000..f43d5016 --- /dev/null +++ b/node_modules/npm/node_modules/spdx-license-ids/index.json @@ -0,0 +1,636 @@ +[ + "0BSD", + "3D-Slicer-1.0", + "AAL", + "ADSL", + "AFL-1.1", + "AFL-1.2", + "AFL-2.0", + "AFL-2.1", + "AFL-3.0", + "AGPL-1.0-only", + "AGPL-1.0-or-later", + "AGPL-3.0-only", + "AGPL-3.0-or-later", + "AMD-newlib", + "AMDPLPA", + "AML", + "AML-glslang", + "AMPAS", + "ANTLR-PD", + "ANTLR-PD-fallback", + "APAFML", + "APL-1.0", + "APSL-1.0", + "APSL-1.1", + "APSL-1.2", + "APSL-2.0", + "ASWF-Digital-Assets-1.0", + "ASWF-Digital-Assets-1.1", + "Abstyles", + "AdaCore-doc", + "Adobe-2006", + "Adobe-Display-PostScript", + "Adobe-Glyph", + "Adobe-Utopia", + "Afmparse", + "Aladdin", + "Apache-1.0", + "Apache-1.1", + "Apache-2.0", + "App-s2p", + "Arphic-1999", + "Artistic-1.0", + "Artistic-1.0-Perl", + "Artistic-1.0-cl8", + "Artistic-2.0", + "BSD-1-Clause", + "BSD-2-Clause", + "BSD-2-Clause-Darwin", + "BSD-2-Clause-Patent", + "BSD-2-Clause-Views", + "BSD-2-Clause-first-lines", + "BSD-3-Clause", + "BSD-3-Clause-Attribution", + "BSD-3-Clause-Clear", + "BSD-3-Clause-HP", + "BSD-3-Clause-LBNL", + "BSD-3-Clause-Modification", + "BSD-3-Clause-No-Military-License", + "BSD-3-Clause-No-Nuclear-License", + "BSD-3-Clause-No-Nuclear-License-2014", + "BSD-3-Clause-No-Nuclear-Warranty", + "BSD-3-Clause-Open-MPI", + "BSD-3-Clause-Sun", + "BSD-3-Clause-acpica", + "BSD-3-Clause-flex", + "BSD-4-Clause", + "BSD-4-Clause-Shortened", + "BSD-4-Clause-UC", + "BSD-4.3RENO", + "BSD-4.3TAHOE", + "BSD-Advertising-Acknowledgement", + "BSD-Attribution-HPND-disclaimer", + "BSD-Inferno-Nettverk", + "BSD-Protection", + "BSD-Source-Code", + "BSD-Source-beginning-file", + "BSD-Systemics", + "BSD-Systemics-W3Works", + "BSL-1.0", + "BUSL-1.1", + "Baekmuk", + "Bahyph", + "Barr", + "Beerware", + "BitTorrent-1.0", + "BitTorrent-1.1", + "Bitstream-Charter", + "Bitstream-Vera", + "BlueOak-1.0.0", + "Boehm-GC", + "Borceux", + "Brian-Gladman-2-Clause", + "Brian-Gladman-3-Clause", + "C-UDA-1.0", + "CAL-1.0", + "CAL-1.0-Combined-Work-Exception", + "CATOSL-1.1", + "CC-BY-1.0", + "CC-BY-2.0", + "CC-BY-2.5", + "CC-BY-2.5-AU", + "CC-BY-3.0", + "CC-BY-3.0-AT", + "CC-BY-3.0-AU", + "CC-BY-3.0-DE", + "CC-BY-3.0-IGO", + "CC-BY-3.0-NL", + "CC-BY-3.0-US", + "CC-BY-4.0", + "CC-BY-NC-1.0", + "CC-BY-NC-2.0", + "CC-BY-NC-2.5", + "CC-BY-NC-3.0", + "CC-BY-NC-3.0-DE", + "CC-BY-NC-4.0", + "CC-BY-NC-ND-1.0", + "CC-BY-NC-ND-2.0", + "CC-BY-NC-ND-2.5", + "CC-BY-NC-ND-3.0", + "CC-BY-NC-ND-3.0-DE", + "CC-BY-NC-ND-3.0-IGO", + "CC-BY-NC-ND-4.0", + "CC-BY-NC-SA-1.0", + "CC-BY-NC-SA-2.0", + "CC-BY-NC-SA-2.0-DE", + "CC-BY-NC-SA-2.0-FR", + "CC-BY-NC-SA-2.0-UK", + "CC-BY-NC-SA-2.5", + "CC-BY-NC-SA-3.0", + "CC-BY-NC-SA-3.0-DE", + "CC-BY-NC-SA-3.0-IGO", + "CC-BY-NC-SA-4.0", + "CC-BY-ND-1.0", + "CC-BY-ND-2.0", + "CC-BY-ND-2.5", + "CC-BY-ND-3.0", + "CC-BY-ND-3.0-DE", + "CC-BY-ND-4.0", + "CC-BY-SA-1.0", + "CC-BY-SA-2.0", + "CC-BY-SA-2.0-UK", + "CC-BY-SA-2.1-JP", + "CC-BY-SA-2.5", + "CC-BY-SA-3.0", + "CC-BY-SA-3.0-AT", + "CC-BY-SA-3.0-DE", + "CC-BY-SA-3.0-IGO", + "CC-BY-SA-4.0", + "CC-PDDC", + "CC0-1.0", + "CDDL-1.0", + "CDDL-1.1", + "CDL-1.0", + "CDLA-Permissive-1.0", + "CDLA-Permissive-2.0", + "CDLA-Sharing-1.0", + "CECILL-1.0", + "CECILL-1.1", + "CECILL-2.0", + "CECILL-2.1", + "CECILL-B", + "CECILL-C", + "CERN-OHL-1.1", + "CERN-OHL-1.2", + "CERN-OHL-P-2.0", + "CERN-OHL-S-2.0", + "CERN-OHL-W-2.0", + "CFITSIO", + "CMU-Mach", + "CMU-Mach-nodoc", + "CNRI-Jython", + "CNRI-Python", + "CNRI-Python-GPL-Compatible", + "COIL-1.0", + "CPAL-1.0", + "CPL-1.0", + "CPOL-1.02", + "CUA-OPL-1.0", + "Caldera", + "Caldera-no-preamble", + "Catharon", + "ClArtistic", + "Clips", + "Community-Spec-1.0", + "Condor-1.1", + "Cornell-Lossless-JPEG", + "Cronyx", + "Crossword", + "CrystalStacker", + "Cube", + "D-FSL-1.0", + "DEC-3-Clause", + "DL-DE-BY-2.0", + "DL-DE-ZERO-2.0", + "DOC", + "DRL-1.0", + "DRL-1.1", + "DSDP", + "DocBook-Schema", + "DocBook-XML", + "Dotseqn", + "ECL-1.0", + "ECL-2.0", + "EFL-1.0", + "EFL-2.0", + "EPICS", + "EPL-1.0", + "EPL-2.0", + "EUDatagrid", + "EUPL-1.0", + "EUPL-1.1", + "EUPL-1.2", + "Elastic-2.0", + "Entessa", + "ErlPL-1.1", + "Eurosym", + "FBM", + "FDK-AAC", + "FSFAP", + "FSFAP-no-warranty-disclaimer", + "FSFUL", + "FSFULLR", + "FSFULLRWD", + "FTL", + "Fair", + "Ferguson-Twofish", + "Frameworx-1.0", + "FreeBSD-DOC", + "FreeImage", + "Furuseth", + "GCR-docs", + "GD", + "GFDL-1.1-invariants-only", + "GFDL-1.1-invariants-or-later", + "GFDL-1.1-no-invariants-only", + "GFDL-1.1-no-invariants-or-later", + "GFDL-1.1-only", + "GFDL-1.1-or-later", + "GFDL-1.2-invariants-only", + "GFDL-1.2-invariants-or-later", + "GFDL-1.2-no-invariants-only", + "GFDL-1.2-no-invariants-or-later", + "GFDL-1.2-only", + "GFDL-1.2-or-later", + "GFDL-1.3-invariants-only", + "GFDL-1.3-invariants-or-later", + "GFDL-1.3-no-invariants-only", + "GFDL-1.3-no-invariants-or-later", + "GFDL-1.3-only", + "GFDL-1.3-or-later", + "GL2PS", + "GLWTPL", + "GPL-1.0-only", + "GPL-1.0-or-later", + "GPL-2.0-only", + "GPL-2.0-or-later", + "GPL-3.0-only", + "GPL-3.0-or-later", + "Giftware", + "Glide", + "Glulxe", + "Graphics-Gems", + "Gutmann", + "HIDAPI", + "HP-1986", + "HP-1989", + "HPND", + "HPND-DEC", + "HPND-Fenneberg-Livingston", + "HPND-INRIA-IMAG", + "HPND-Intel", + "HPND-Kevlin-Henney", + "HPND-MIT-disclaimer", + "HPND-Markus-Kuhn", + "HPND-Netrek", + "HPND-Pbmplus", + "HPND-UC", + "HPND-UC-export-US", + "HPND-doc", + "HPND-doc-sell", + "HPND-export-US", + "HPND-export-US-acknowledgement", + "HPND-export-US-modify", + "HPND-export2-US", + "HPND-merchantability-variant", + "HPND-sell-MIT-disclaimer-xserver", + "HPND-sell-regexpr", + "HPND-sell-variant", + "HPND-sell-variant-MIT-disclaimer", + "HPND-sell-variant-MIT-disclaimer-rev", + "HTMLTIDY", + "HaskellReport", + "Hippocratic-2.1", + "IBM-pibs", + "ICU", + "IEC-Code-Components-EULA", + "IJG", + "IJG-short", + "IPA", + "IPL-1.0", + "ISC", + "ISC-Veillard", + "ImageMagick", + "Imlib2", + "Info-ZIP", + "Inner-Net-2.0", + "Intel", + "Intel-ACPI", + "Interbase-1.0", + "JPL-image", + "JPNIC", + "JSON", + "Jam", + "JasPer-2.0", + "Kastrup", + "Kazlib", + "Knuth-CTAN", + "LAL-1.2", + "LAL-1.3", + "LGPL-2.0-only", + "LGPL-2.0-or-later", + "LGPL-2.1-only", + "LGPL-2.1-or-later", + "LGPL-3.0-only", + "LGPL-3.0-or-later", + "LGPLLR", + "LOOP", + "LPD-document", + "LPL-1.0", + "LPL-1.02", + "LPPL-1.0", + "LPPL-1.1", + "LPPL-1.2", + "LPPL-1.3a", + "LPPL-1.3c", + "LZMA-SDK-9.11-to-9.20", + "LZMA-SDK-9.22", + "Latex2e", + "Latex2e-translated-notice", + "Leptonica", + "LiLiQ-P-1.1", + "LiLiQ-R-1.1", + "LiLiQ-Rplus-1.1", + "Libpng", + "Linux-OpenIB", + "Linux-man-pages-1-para", + "Linux-man-pages-copyleft", + "Linux-man-pages-copyleft-2-para", + "Linux-man-pages-copyleft-var", + "Lucida-Bitmap-Fonts", + "MIT", + "MIT-0", + "MIT-CMU", + "MIT-Festival", + "MIT-Khronos-old", + "MIT-Modern-Variant", + "MIT-Wu", + "MIT-advertising", + "MIT-enna", + "MIT-feh", + "MIT-open-group", + "MIT-testregex", + "MITNFA", + "MMIXware", + "MPEG-SSG", + "MPL-1.0", + "MPL-1.1", + "MPL-2.0", + "MPL-2.0-no-copyleft-exception", + "MS-LPL", + "MS-PL", + "MS-RL", + "MTLL", + "Mackerras-3-Clause", + "Mackerras-3-Clause-acknowledgment", + "MakeIndex", + "Martin-Birgmeier", + "McPhee-slideshow", + "Minpack", + "MirOS", + "Motosoto", + "MulanPSL-1.0", + "MulanPSL-2.0", + "Multics", + "Mup", + "NAIST-2003", + "NASA-1.3", + "NBPL-1.0", + "NCBI-PD", + "NCGL-UK-2.0", + "NCL", + "NCSA", + "NGPL", + "NICTA-1.0", + "NIST-PD", + "NIST-PD-fallback", + "NIST-Software", + "NLOD-1.0", + "NLOD-2.0", + "NLPL", + "NOSL", + "NPL-1.0", + "NPL-1.1", + "NPOSL-3.0", + "NRL", + "NTP", + "NTP-0", + "Naumen", + "NetCDF", + "Newsletr", + "Nokia", + "Noweb", + "O-UDA-1.0", + "OAR", + "OCCT-PL", + "OCLC-2.0", + "ODC-By-1.0", + "ODbL-1.0", + "OFFIS", + "OFL-1.0", + "OFL-1.0-RFN", + "OFL-1.0-no-RFN", + "OFL-1.1", + "OFL-1.1-RFN", + "OFL-1.1-no-RFN", + "OGC-1.0", + "OGDL-Taiwan-1.0", + "OGL-Canada-2.0", + "OGL-UK-1.0", + "OGL-UK-2.0", + "OGL-UK-3.0", + "OGTSL", + "OLDAP-1.1", + "OLDAP-1.2", + "OLDAP-1.3", + "OLDAP-1.4", + "OLDAP-2.0", + "OLDAP-2.0.1", + "OLDAP-2.1", + "OLDAP-2.2", + "OLDAP-2.2.1", + "OLDAP-2.2.2", + "OLDAP-2.3", + "OLDAP-2.4", + "OLDAP-2.5", + "OLDAP-2.6", + "OLDAP-2.7", + "OLDAP-2.8", + "OLFL-1.3", + "OML", + "OPL-1.0", + "OPL-UK-3.0", + "OPUBL-1.0", + "OSET-PL-2.1", + "OSL-1.0", + "OSL-1.1", + "OSL-2.0", + "OSL-2.1", + "OSL-3.0", + "OpenPBS-2.3", + "OpenSSL", + "OpenSSL-standalone", + "OpenVision", + "PADL", + "PDDL-1.0", + "PHP-3.0", + "PHP-3.01", + "PPL", + "PSF-2.0", + "Parity-6.0.0", + "Parity-7.0.0", + "Pixar", + "Plexus", + "PolyForm-Noncommercial-1.0.0", + "PolyForm-Small-Business-1.0.0", + "PostgreSQL", + "Python-2.0", + "Python-2.0.1", + "QPL-1.0", + "QPL-1.0-INRIA-2004", + "Qhull", + "RHeCos-1.1", + "RPL-1.1", + "RPL-1.5", + "RPSL-1.0", + "RSA-MD", + "RSCPL", + "Rdisc", + "Ruby", + "Ruby-pty", + "SAX-PD", + "SAX-PD-2.0", + "SCEA", + "SGI-B-1.0", + "SGI-B-1.1", + "SGI-B-2.0", + "SGI-OpenGL", + "SGP4", + "SHL-0.5", + "SHL-0.51", + "SISSL", + "SISSL-1.2", + "SL", + "SMLNJ", + "SMPPL", + "SNIA", + "SPL-1.0", + "SSH-OpenSSH", + "SSH-short", + "SSLeay-standalone", + "SSPL-1.0", + "SWL", + "Saxpath", + "SchemeReport", + "Sendmail", + "Sendmail-8.23", + "SimPL-2.0", + "Sleepycat", + "Soundex", + "Spencer-86", + "Spencer-94", + "Spencer-99", + "SugarCRM-1.1.3", + "Sun-PPP", + "Sun-PPP-2000", + "SunPro", + "Symlinks", + "TAPR-OHL-1.0", + "TCL", + "TCP-wrappers", + "TGPPL-1.0", + "TMate", + "TORQUE-1.1", + "TOSL", + "TPDL", + "TPL-1.0", + "TTWL", + "TTYP0", + "TU-Berlin-1.0", + "TU-Berlin-2.0", + "TermReadKey", + "UCAR", + "UCL-1.0", + "UMich-Merit", + "UPL-1.0", + "URT-RLE", + "Ubuntu-font-1.0", + "Unicode-3.0", + "Unicode-DFS-2015", + "Unicode-DFS-2016", + "Unicode-TOU", + "UnixCrypt", + "Unlicense", + "VOSTROM", + "VSL-1.0", + "Vim", + "W3C", + "W3C-19980720", + "W3C-20150513", + "WTFPL", + "Watcom-1.0", + "Widget-Workshop", + "Wsuipa", + "X11", + "X11-distribute-modifications-variant", + "X11-swapped", + "XFree86-1.1", + "XSkat", + "Xdebug-1.03", + "Xerox", + "Xfig", + "Xnet", + "YPL-1.0", + "YPL-1.1", + "ZPL-1.1", + "ZPL-2.0", + "ZPL-2.1", + "Zed", + "Zeeff", + "Zend-2.0", + "Zimbra-1.3", + "Zimbra-1.4", + "Zlib", + "any-OSI", + "bcrypt-Solar-Designer", + "blessing", + "bzip2-1.0.6", + "check-cvs", + "checkmk", + "copyleft-next-0.3.0", + "copyleft-next-0.3.1", + "curl", + "cve-tou", + "diffmark", + "dtoa", + "dvipdfm", + "eGenix", + "etalab-2.0", + "fwlw", + "gSOAP-1.3b", + "gnuplot", + "gtkbook", + "hdparm", + "iMatix", + "libpng-2.0", + "libselinux-1.0", + "libtiff", + "libutil-David-Nugent", + "lsof", + "magaz", + "mailprio", + "metamail", + "mpi-permissive", + "mpich2", + "mplus", + "pkgconf", + "pnmstitch", + "psfrag", + "psutils", + "python-ldap", + "radvd", + "snprintf", + "softSurfer", + "ssh-keyscan", + "swrule", + "threeparttable", + "ulem", + "w3m", + "xinetd", + "xkeyboard-config-Zinoviev", + "xlock", + "xpp", + "xzoom", + "zlib-acknowledgement" +] diff --git a/node_modules/npm/node_modules/spdx-license-ids/package.json b/node_modules/npm/node_modules/spdx-license-ids/package.json new file mode 100644 index 00000000..7ab34aab --- /dev/null +++ b/node_modules/npm/node_modules/spdx-license-ids/package.json @@ -0,0 +1,39 @@ +{ + "name": "spdx-license-ids", + "version": "3.0.20", + "description": "A list of SPDX license identifiers", + "repository": "jslicense/spdx-license-ids", + "author": "Shinnosuke Watanabe (https://github.com/shinnn)", + "license": "CC0-1.0", + "scripts": { + "build": "node build.js", + "pretest": "eslint .", + "latest": "node latest.js", + "test": "node test.js" + }, + "files": [ + "deprecated.json", + "index.json" + ], + "keywords": [ + "spdx", + "license", + "licenses", + "id", + "identifier", + "identifiers", + "json", + "array", + "oss" + ], + "devDependencies": { + "@shinnn/eslint-config": "^7.0.0", + "eslint": "^8.49.0", + "eslint-formatter-codeframe": "^7.32.1", + "rmfr": "^2.0.0", + "tape": "^5.6.6" + }, + "eslintConfig": { + "extends": "@shinnn" + } +} diff --git a/node_modules/npm/node_modules/sprintf-js/CONTRIBUTORS.md b/node_modules/npm/node_modules/sprintf-js/CONTRIBUTORS.md new file mode 100644 index 00000000..a16608e9 --- /dev/null +++ b/node_modules/npm/node_modules/sprintf-js/CONTRIBUTORS.md @@ -0,0 +1,26 @@ +Alexander Rose [@arose](https://github.com/arose) +Alexandru Mărășteanu [@alexei](https://github.com/alexei) +Andras [@andrasq](https://github.com/andrasq) +Benoit Giannangeli [@giann](https://github.com/giann) +Branden Visser [@mrvisser](https://github.com/mrvisser) +David Baird +daurnimator [@daurnimator](https://github.com/daurnimator) +Doug Beck [@beck](https://github.com/beck) +Dzmitry Litskalau [@litmit](https://github.com/litmit) +Fred Ludlow [@fredludlow](https://github.com/fredludlow) +Hans Pufal +Henry [@alograg](https://github.com/alograg) +Johnny Shields [@johnnyshields](https://github.com/johnnyshields) +Kamal Abdali +Matt Simerson [@msimerson](https://github.com/msimerson) +Maxime Robert [@marob](https://github.com/marob) +MeriemKhelifi [@MeriemKhelifi](https://github.com/MeriemKhelifi) +Michael Schramm [@wodka](https://github.com/wodka) +Nazar Mokrynskyi [@nazar-pc](https://github.com/nazar-pc) +Oliver Salzburg [@oliversalzburg](https://github.com/oliversalzburg) +Pablo [@ppollono](https://github.com/ppollono) +Rabehaja Stevens [@RABEHAJA-STEVENS](https://github.com/RABEHAJA-STEVENS) +Raphael Pigulla [@pigulla](https://github.com/pigulla) +rebeccapeltz [@rebeccapeltz](https://github.com/rebeccapeltz) +Stefan Tingström [@stingstrom](https://github.com/stingstrom) +Tim Gates [@timgates42](https://github.com/timgates42) diff --git a/node_modules/npm/node_modules/sprintf-js/LICENSE b/node_modules/npm/node_modules/sprintf-js/LICENSE new file mode 100644 index 00000000..83f832a2 --- /dev/null +++ b/node_modules/npm/node_modules/sprintf-js/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2007-present, Alexandru Mărășteanu +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 this software 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 AUTHORS OR COPYRIGHT HOLDERS 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/npm/node_modules/sprintf-js/dist/.gitattributes b/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes new file mode 100644 index 00000000..d35bca01 --- /dev/null +++ b/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes @@ -0,0 +1,4 @@ +#ignore all generated files from diff +#also skip line ending check +*.js -diff -text +*.map -diff -text diff --git a/node_modules/npm/node_modules/sprintf-js/dist/angular-sprintf.min.js b/node_modules/npm/node_modules/sprintf-js/dist/angular-sprintf.min.js new file mode 100644 index 00000000..5dff8c54 --- /dev/null +++ b/node_modules/npm/node_modules/sprintf-js/dist/angular-sprintf.min.js @@ -0,0 +1,3 @@ +/*! sprintf-js v1.1.3 | Copyright (c) 2007-present, Alexandru Mărășteanu | BSD-3-Clause */ +!function(){"use strict";angular.module("sprintf",[]).filter("sprintf",function(){return function(){return sprintf.apply(null,arguments)}}).filter("fmt",["$filter",function(t){return t("sprintf")}]).filter("vsprintf",function(){return function(t,n){return vsprintf(t,n)}}).filter("vfmt",["$filter",function(t){return t("vsprintf")}])}(); +//# sourceMappingURL=angular-sprintf.min.js.map diff --git a/node_modules/npm/node_modules/sprintf-js/dist/sprintf.min.js b/node_modules/npm/node_modules/sprintf-js/dist/sprintf.min.js new file mode 100644 index 00000000..ed09637e --- /dev/null +++ b/node_modules/npm/node_modules/sprintf-js/dist/sprintf.min.js @@ -0,0 +1,3 @@ +/*! sprintf-js v1.1.3 | Copyright (c) 2007-present, Alexandru Mărășteanu | BSD-3-Clause */ +!function(){"use strict";var g={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function y(e){return function(e,t){var r,n,i,s,a,o,p,c,l,u=1,f=e.length,d="";for(n=0;n>>0).toString(8);break;case"s":r=String(r),r=s.precision?r.substring(0,s.precision):r;break;case"t":r=String(!!r),r=s.precision?r.substring(0,s.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=s.precision?r.substring(0,s.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=s.precision?r.substring(0,s.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}g.json.test(s.type)?d+=r:(!g.number.test(s.type)||c&&!s.sign?l="":(l=c?"+":"-",r=r.toString().replace(g.sign,"")),o=s.pad_char?"0"===s.pad_char?"0":s.pad_char.charAt(1):" ",p=s.width-(l+r).length,a=s.width&&0", + "main": "src/sprintf.js", + "scripts": { + "test": "mocha test/*.js", + "pretest": "npm run lint", + "lint": "eslint .", + "lint:fix": "eslint --fix ." + }, + "repository": { + "type": "git", + "url": "https://github.com/alexei/sprintf.js.git" + }, + "license": "BSD-3-Clause", + "readmeFilename": "README.md", + "devDependencies": { + "benchmark": "^2.1.4", + "eslint": "^5.10.0", + "gulp": "^3.9.1", + "gulp-benchmark": "^1.1.1", + "gulp-eslint": "^5.0.0", + "gulp-header": "^2.0.5", + "gulp-mocha": "^6.0.0", + "gulp-rename": "^1.4.0", + "gulp-sourcemaps": "^2.6.4", + "gulp-uglify": "^3.0.1", + "mocha": "^5.2.0" + }, + "overrides": { + "graceful-fs": "^4.2.11" + } +} diff --git a/node_modules/npm/node_modules/sprintf-js/src/angular-sprintf.js b/node_modules/npm/node_modules/sprintf-js/src/angular-sprintf.js new file mode 100644 index 00000000..dbfdd65a --- /dev/null +++ b/node_modules/npm/node_modules/sprintf-js/src/angular-sprintf.js @@ -0,0 +1,24 @@ +/* global angular, sprintf, vsprintf */ + +!function() { + 'use strict' + + angular. + module('sprintf', []). + filter('sprintf', function() { + return function() { + return sprintf.apply(null, arguments) + } + }). + filter('fmt', ['$filter', function($filter) { + return $filter('sprintf') + }]). + filter('vsprintf', function() { + return function(format, argv) { + return vsprintf(format, argv) + } + }). + filter('vfmt', ['$filter', function($filter) { + return $filter('vsprintf') + }]) +}(); // eslint-disable-line diff --git a/node_modules/npm/node_modules/sprintf-js/src/sprintf.js b/node_modules/npm/node_modules/sprintf-js/src/sprintf.js new file mode 100644 index 00000000..65d63246 --- /dev/null +++ b/node_modules/npm/node_modules/sprintf-js/src/sprintf.js @@ -0,0 +1,231 @@ +/* global window, exports, define */ + +!function() { + 'use strict' + + var re = { + not_string: /[^s]/, + not_bool: /[^t]/, + not_type: /[^T]/, + not_primitive: /[^v]/, + number: /[diefg]/, + numeric_arg: /[bcdiefguxX]/, + json: /[j]/, + not_json: /[^j]/, + text: /^[^\x25]+/, + modulo: /^\x25{2}/, + placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, + key: /^([a-z_][a-z_\d]*)/i, + key_access: /^\.([a-z_][a-z_\d]*)/i, + index_access: /^\[(\d+)\]/, + sign: /^[+-]/ + } + + function sprintf(key) { + // `arguments` is not an array, but should be fine for this call + return sprintf_format(sprintf_parse(key), arguments) + } + + function vsprintf(fmt, argv) { + return sprintf.apply(null, [fmt].concat(argv || [])) + } + + function sprintf_format(parse_tree, argv) { + var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign + for (i = 0; i < tree_length; i++) { + if (typeof parse_tree[i] === 'string') { + output += parse_tree[i] + } + else if (typeof parse_tree[i] === 'object') { + ph = parse_tree[i] // convenience purposes only + if (ph.keys) { // keyword argument + arg = argv[cursor] + for (k = 0; k < ph.keys.length; k++) { + if (arg == undefined) { + throw new Error(sprintf('[sprintf] Cannot access property "%s" of undefined value "%s"', ph.keys[k], ph.keys[k-1])) + } + arg = arg[ph.keys[k]] + } + } + else if (ph.param_no) { // positional argument (explicit) + arg = argv[ph.param_no] + } + else { // positional argument (implicit) + arg = argv[cursor++] + } + + if (re.not_type.test(ph.type) && re.not_primitive.test(ph.type) && arg instanceof Function) { + arg = arg() + } + + if (re.numeric_arg.test(ph.type) && (typeof arg !== 'number' && isNaN(arg))) { + throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg)) + } + + if (re.number.test(ph.type)) { + is_positive = arg >= 0 + } + + switch (ph.type) { + case 'b': + arg = parseInt(arg, 10).toString(2) + break + case 'c': + arg = String.fromCharCode(parseInt(arg, 10)) + break + case 'd': + case 'i': + arg = parseInt(arg, 10) + break + case 'j': + arg = JSON.stringify(arg, null, ph.width ? parseInt(ph.width) : 0) + break + case 'e': + arg = ph.precision ? parseFloat(arg).toExponential(ph.precision) : parseFloat(arg).toExponential() + break + case 'f': + arg = ph.precision ? parseFloat(arg).toFixed(ph.precision) : parseFloat(arg) + break + case 'g': + arg = ph.precision ? String(Number(arg.toPrecision(ph.precision))) : parseFloat(arg) + break + case 'o': + arg = (parseInt(arg, 10) >>> 0).toString(8) + break + case 's': + arg = String(arg) + arg = (ph.precision ? arg.substring(0, ph.precision) : arg) + break + case 't': + arg = String(!!arg) + arg = (ph.precision ? arg.substring(0, ph.precision) : arg) + break + case 'T': + arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase() + arg = (ph.precision ? arg.substring(0, ph.precision) : arg) + break + case 'u': + arg = parseInt(arg, 10) >>> 0 + break + case 'v': + arg = arg.valueOf() + arg = (ph.precision ? arg.substring(0, ph.precision) : arg) + break + case 'x': + arg = (parseInt(arg, 10) >>> 0).toString(16) + break + case 'X': + arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase() + break + } + if (re.json.test(ph.type)) { + output += arg + } + else { + if (re.number.test(ph.type) && (!is_positive || ph.sign)) { + sign = is_positive ? '+' : '-' + arg = arg.toString().replace(re.sign, '') + } + else { + sign = '' + } + pad_character = ph.pad_char ? ph.pad_char === '0' ? '0' : ph.pad_char.charAt(1) : ' ' + pad_length = ph.width - (sign + arg).length + pad = ph.width ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '' + output += ph.align ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg) + } + } + } + return output + } + + var sprintf_cache = Object.create(null) + + function sprintf_parse(fmt) { + if (sprintf_cache[fmt]) { + return sprintf_cache[fmt] + } + + var _fmt = fmt, match, parse_tree = [], arg_names = 0 + while (_fmt) { + if ((match = re.text.exec(_fmt)) !== null) { + parse_tree.push(match[0]) + } + else if ((match = re.modulo.exec(_fmt)) !== null) { + parse_tree.push('%') + } + else if ((match = re.placeholder.exec(_fmt)) !== null) { + if (match[2]) { + arg_names |= 1 + var field_list = [], replacement_field = match[2], field_match = [] + if ((field_match = re.key.exec(replacement_field)) !== null) { + field_list.push(field_match[1]) + while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { + if ((field_match = re.key_access.exec(replacement_field)) !== null) { + field_list.push(field_match[1]) + } + else if ((field_match = re.index_access.exec(replacement_field)) !== null) { + field_list.push(field_match[1]) + } + else { + throw new SyntaxError('[sprintf] failed to parse named argument key') + } + } + } + else { + throw new SyntaxError('[sprintf] failed to parse named argument key') + } + match[2] = field_list + } + else { + arg_names |= 2 + } + if (arg_names === 3) { + throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported') + } + + parse_tree.push( + { + placeholder: match[0], + param_no: match[1], + keys: match[2], + sign: match[3], + pad_char: match[4], + align: match[5], + width: match[6], + precision: match[7], + type: match[8] + } + ) + } + else { + throw new SyntaxError('[sprintf] unexpected placeholder') + } + _fmt = _fmt.substring(match[0].length) + } + return sprintf_cache[fmt] = parse_tree + } + + /** + * export to either browser or node.js + */ + /* eslint-disable quote-props */ + if (typeof exports !== 'undefined') { + exports['sprintf'] = sprintf + exports['vsprintf'] = vsprintf + } + if (typeof window !== 'undefined') { + window['sprintf'] = sprintf + window['vsprintf'] = vsprintf + + if (typeof define === 'function' && define['amd']) { + define(function() { + return { + 'sprintf': sprintf, + 'vsprintf': vsprintf + } + }) + } + } + /* eslint-enable quote-props */ +}(); // eslint-disable-line diff --git a/node_modules/npm/node_modules/ssri/LICENSE.md b/node_modules/npm/node_modules/ssri/LICENSE.md new file mode 100644 index 00000000..e3353888 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/ssri/lib/index.js b/node_modules/npm/node_modules/ssri/lib/index.js new file mode 100644 index 00000000..7d749ed4 --- /dev/null +++ b/node_modules/npm/node_modules/ssri/lib/index.js @@ -0,0 +1,580 @@ +'use strict' + +const crypto = require('crypto') +const { Minipass } = require('minipass') + +const SPEC_ALGORITHMS = ['sha512', 'sha384', 'sha256'] +const DEFAULT_ALGORITHMS = ['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 getOptString = options => options?.length ? `?${options.join('?')}` : '' + +class IntegrityStream extends Minipass { + #emittedIntegrity + #emittedSize + #emittedVerified + + 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. + if (opts?.algorithms) { + this.algorithms = [...opts.algorithms] + } else { + this.algorithms = [...DEFAULT_ALGORITHMS] + } + if (this.algorithm !== null && !this.algorithms.includes(this.algorithm)) { + this.algorithms.push(this.algorithm) + } + + this.hashes = this.algorithms.map(crypto.createHash) + } + + #getOptions () { + // For verification + this.sri = this.opts?.integrity ? parse(this.opts?.integrity, this.opts) : null + this.expectedSize = this.opts?.size + + if (!this.sri) { + this.algorithm = null + } else if (this.sri.isHash) { + this.goodSri = true + this.algorithm = this.sri.algorithm + } else { + this.goodSri = !this.sri.isEmpty() + this.algorithm = this.sri.pickAlgorithm(this.opts) + } + + this.digests = this.goodSri ? this.sri[this.algorithm] : null + this.optString = getOptString(this.opts?.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) { + 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.includes(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() + } + + match (integrity, opts) { + const other = parse(integrity, opts) + if (!other) { + return false + } + if (other.isIntegrity) { + const algo = other.pickAlgorithm(opts, [this.algorithm]) + + if (!algo) { + return false + } + + const foundHash = other[algo].find(hash => hash.digest === this.digest) + + if (foundHash) { + return foundHash + } + + return false + } + return other.digest === this.digest ? other : false + } + + toString (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.includes(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 '' + } + } + return `${this.algorithm}-${this.digest}${getOptString(this.options)}` + } +} + +function integrityHashToString (toString, sep, opts, hashes) { + const toStringIsNotEmpty = toString !== '' + + let shouldAddFirstSep = false + let complement = '' + + const lastIndex = hashes.length - 1 + + for (let i = 0; i < lastIndex; i++) { + const hashString = Hash.prototype.toString.call(hashes[i], opts) + + if (hashString) { + shouldAddFirstSep = true + + complement += hashString + complement += sep + } + } + + const finalHashString = Hash.prototype.toString.call(hashes[lastIndex], opts) + + if (finalHashString) { + shouldAddFirstSep = true + complement += finalHashString + } + + if (toStringIsNotEmpty && shouldAddFirstSep) { + return toString + sep + complement + } + + return toString + complement +} + +class Integrity { + get isIntegrity () { + return true + } + + toJSON () { + return this.toString() + } + + isEmpty () { + return Object.keys(this).length === 0 + } + + toString (opts) { + let sep = opts?.sep || ' ' + let toString = '' + + if (opts?.strict) { + // Entries must be separated by whitespace, according to spec. + sep = sep.replace(/\S+/g, ' ') + + for (const hash of SPEC_ALGORITHMS) { + if (this[hash]) { + toString = integrityHashToString(toString, sep, opts, this[hash]) + } + } + } else { + for (const hash of Object.keys(this)) { + toString = integrityHashToString(toString, sep, opts, this[hash]) + } + } + + return toString + } + + concat (integrity, 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) { + 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) { + const other = parse(integrity, opts) + if (!other) { + return false + } + const algo = other.pickAlgorithm(opts, Object.keys(this)) + return ( + !!algo && + this[algo] && + other[algo] && + this[algo].find(hash => + other[algo].find(otherhash => + hash.digest === otherhash.digest + ) + ) + ) || false + } + + // Pick the highest priority algorithm present, optionally also limited to a + // set of hashes found in another integrity. When limiting it may return + // nothing. + pickAlgorithm (opts, hashes) { + const pickAlgorithm = opts?.pickAlgorithm || getPrioritizedHash + const keys = Object.keys(this).filter(k => { + if (hashes?.length) { + return hashes.includes(k) + } + return true + }) + if (keys.length) { + return keys.reduce((acc, algo) => pickAlgorithm(acc, algo) || acc) + } + // no intersection between this and hashes, + return null + } +} + +module.exports.parse = parse +function parse (sri, opts) { + if (!sri) { + return null + } + 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) { + 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) { + const optString = getOptString(opts?.options) + return parse( + `${algorithm}-${ + Buffer.from(hexDigest, 'hex').toString('base64') + }${optString}`, opts + ) +} + +module.exports.fromData = fromData +function fromData (data, opts) { + const algorithms = opts?.algorithms || [...DEFAULT_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) { + 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.resume() + }) +} + +module.exports.checkData = checkData +function checkData (data, sri, 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) + opts = 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 = opts || Object.create(null) + 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.resume() + }) +} + +module.exports.integrityStream = integrityStream +function integrityStream (opts = Object.create(null)) { + return new IntegrityStream(opts) +} + +module.exports.create = createIntegrity +function createIntegrity (opts) { + const algorithms = opts?.algorithms || [...DEFAULT_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 () { + 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 = 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.includes(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/npm/node_modules/ssri/package.json b/node_modules/npm/node_modules/ssri/package.json new file mode 100644 index 00000000..83306cd0 --- /dev/null +++ b/node_modules/npm/node_modules/ssri/package.json @@ -0,0 +1,66 @@ +{ + "name": "ssri", + "version": "12.0.0", + "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", + "posttest": "npm run lint", + "test": "tap", + "coverage": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "tap": { + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "repository": { + "type": "git", + "url": "git+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": "^7.0.3" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": "true" + } +} diff --git a/node_modules/npm/node_modules/string-width-cjs/index.js b/node_modules/npm/node_modules/string-width-cjs/index.js new file mode 100644 index 00000000..f4d261a9 --- /dev/null +++ b/node_modules/npm/node_modules/string-width-cjs/index.js @@ -0,0 +1,47 @@ +'use strict'; +const stripAnsi = require('strip-ansi'); +const isFullwidthCodePoint = require('is-fullwidth-code-point'); +const emojiRegex = require('emoji-regex'); + +const stringWidth = string => { + if (typeof string !== 'string' || string.length === 0) { + return 0; + } + + string = stripAnsi(string); + + if (string.length === 0) { + return 0; + } + + string = string.replace(emojiRegex(), ' '); + + let width = 0; + + for (let i = 0; i < string.length; i++) { + const code = string.codePointAt(i); + + // Ignore control characters + if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { + continue; + } + + // Ignore combining characters + if (code >= 0x300 && code <= 0x36F) { + continue; + } + + // Surrogates + if (code > 0xFFFF) { + i++; + } + + width += isFullwidthCodePoint(code) ? 2 : 1; + } + + return width; +}; + +module.exports = stringWidth; +// TODO: remove this in the next major version +module.exports.default = stringWidth; diff --git a/node_modules/npm/node_modules/string-width-cjs/license b/node_modules/npm/node_modules/string-width-cjs/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/npm/node_modules/string-width-cjs/license @@ -0,0 +1,9 @@ +MIT License + +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/npm/node_modules/string-width-cjs/package.json b/node_modules/npm/node_modules/string-width-cjs/package.json new file mode 100644 index 00000000..28ba7b4c --- /dev/null +++ b/node_modules/npm/node_modules/string-width-cjs/package.json @@ -0,0 +1,56 @@ +{ + "name": "string-width", + "version": "4.2.3", + "description": "Get the visual width of a string - the number of columns required to display it", + "license": "MIT", + "repository": "sindresorhus/string-width", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "string", + "character", + "unicode", + "width", + "visual", + "column", + "columns", + "fullwidth", + "full-width", + "full", + "ansi", + "escape", + "codes", + "cli", + "command-line", + "terminal", + "console", + "cjk", + "chinese", + "japanese", + "korean", + "fixed-width" + ], + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" + } +} diff --git a/node_modules/npm/node_modules/string-width/index.js b/node_modules/npm/node_modules/string-width/index.js new file mode 100644 index 00000000..f4d261a9 --- /dev/null +++ b/node_modules/npm/node_modules/string-width/index.js @@ -0,0 +1,47 @@ +'use strict'; +const stripAnsi = require('strip-ansi'); +const isFullwidthCodePoint = require('is-fullwidth-code-point'); +const emojiRegex = require('emoji-regex'); + +const stringWidth = string => { + if (typeof string !== 'string' || string.length === 0) { + return 0; + } + + string = stripAnsi(string); + + if (string.length === 0) { + return 0; + } + + string = string.replace(emojiRegex(), ' '); + + let width = 0; + + for (let i = 0; i < string.length; i++) { + const code = string.codePointAt(i); + + // Ignore control characters + if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { + continue; + } + + // Ignore combining characters + if (code >= 0x300 && code <= 0x36F) { + continue; + } + + // Surrogates + if (code > 0xFFFF) { + i++; + } + + width += isFullwidthCodePoint(code) ? 2 : 1; + } + + return width; +}; + +module.exports = stringWidth; +// TODO: remove this in the next major version +module.exports.default = stringWidth; diff --git a/node_modules/npm/node_modules/string-width/license b/node_modules/npm/node_modules/string-width/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/npm/node_modules/string-width/license @@ -0,0 +1,9 @@ +MIT License + +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/npm/node_modules/string-width/package.json b/node_modules/npm/node_modules/string-width/package.json new file mode 100644 index 00000000..28ba7b4c --- /dev/null +++ b/node_modules/npm/node_modules/string-width/package.json @@ -0,0 +1,56 @@ +{ + "name": "string-width", + "version": "4.2.3", + "description": "Get the visual width of a string - the number of columns required to display it", + "license": "MIT", + "repository": "sindresorhus/string-width", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "string", + "character", + "unicode", + "width", + "visual", + "column", + "columns", + "fullwidth", + "full-width", + "full", + "ansi", + "escape", + "codes", + "cli", + "command-line", + "terminal", + "console", + "cjk", + "chinese", + "japanese", + "korean", + "fixed-width" + ], + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" + } +} diff --git a/node_modules/npm/node_modules/strip-ansi-cjs/index.js b/node_modules/npm/node_modules/strip-ansi-cjs/index.js new file mode 100644 index 00000000..9a593dfc --- /dev/null +++ b/node_modules/npm/node_modules/strip-ansi-cjs/index.js @@ -0,0 +1,4 @@ +'use strict'; +const ansiRegex = require('ansi-regex'); + +module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/node_modules/npm/node_modules/strip-ansi-cjs/license b/node_modules/npm/node_modules/strip-ansi-cjs/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/npm/node_modules/strip-ansi-cjs/license @@ -0,0 +1,9 @@ +MIT License + +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/npm/node_modules/strip-ansi-cjs/package.json b/node_modules/npm/node_modules/strip-ansi-cjs/package.json new file mode 100644 index 00000000..1a41108d --- /dev/null +++ b/node_modules/npm/node_modules/strip-ansi-cjs/package.json @@ -0,0 +1,54 @@ +{ + "name": "strip-ansi", + "version": "6.0.1", + "description": "Strip ANSI escape codes from a string", + "license": "MIT", + "repository": "chalk/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.10.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/npm/node_modules/strip-ansi/index.js b/node_modules/npm/node_modules/strip-ansi/index.js new file mode 100644 index 00000000..9a593dfc --- /dev/null +++ b/node_modules/npm/node_modules/strip-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +const ansiRegex = require('ansi-regex'); + +module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/node_modules/npm/node_modules/strip-ansi/license b/node_modules/npm/node_modules/strip-ansi/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/npm/node_modules/strip-ansi/license @@ -0,0 +1,9 @@ +MIT License + +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/npm/node_modules/strip-ansi/package.json b/node_modules/npm/node_modules/strip-ansi/package.json new file mode 100644 index 00000000..1a41108d --- /dev/null +++ b/node_modules/npm/node_modules/strip-ansi/package.json @@ -0,0 +1,54 @@ +{ + "name": "strip-ansi", + "version": "6.0.1", + "description": "Strip ANSI escape codes from a string", + "license": "MIT", + "repository": "chalk/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.10.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/npm/node_modules/supports-color/browser.js b/node_modules/npm/node_modules/supports-color/browser.js new file mode 100644 index 00000000..1ffde642 --- /dev/null +++ b/node_modules/npm/node_modules/supports-color/browser.js @@ -0,0 +1,30 @@ +/* eslint-env browser */ + +const level = (() => { + if (navigator.userAgentData) { + const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium'); + if (brand?.version > 93) { + return 3; + } + } + + if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) { + return 1; + } + + return 0; +})(); + +const colorSupport = level !== 0 && { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3, +}; + +const supportsColor = { + stdout: colorSupport, + stderr: colorSupport, +}; + +export default supportsColor; diff --git a/node_modules/npm/node_modules/supports-color/index.js b/node_modules/npm/node_modules/supports-color/index.js new file mode 100644 index 00000000..4ce0a2da --- /dev/null +++ b/node_modules/npm/node_modules/supports-color/index.js @@ -0,0 +1,182 @@ +import process from 'node:process'; +import os from 'node:os'; +import tty from 'node:tty'; + +// From: https://github.com/sindresorhus/has-flag/blob/main/index.js +/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) { +function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) { + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const position = argv.indexOf(prefix + flag); + const terminatorPosition = argv.indexOf('--'); + return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); +} + +const {env} = process; + +let flagForceColor; +if ( + hasFlag('no-color') + || hasFlag('no-colors') + || hasFlag('color=false') + || hasFlag('color=never') +) { + flagForceColor = 0; +} else if ( + hasFlag('color') + || hasFlag('colors') + || hasFlag('color=true') + || hasFlag('color=always') +) { + flagForceColor = 1; +} + +function envForceColor() { + if ('FORCE_COLOR' in env) { + if (env.FORCE_COLOR === 'true') { + return 1; + } + + if (env.FORCE_COLOR === 'false') { + return 0; + } + + return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3); + } +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3, + }; +} + +function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) { + const noFlagForceColor = envForceColor(); + if (noFlagForceColor !== undefined) { + flagForceColor = noFlagForceColor; + } + + const forceColor = sniffFlags ? flagForceColor : noFlagForceColor; + + if (forceColor === 0) { + return 0; + } + + if (sniffFlags) { + if (hasFlag('color=16m') + || hasFlag('color=full') + || hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + } + + // Check for Azure DevOps pipelines. + // Has to be above the `!streamIsTTY` check. + if ('TF_BUILD' in env && 'AGENT_NAME' in env) { + return 1; + } + + if (haveStream && !streamIsTTY && forceColor === undefined) { + return 0; + } + + const min = forceColor || 0; + + if (env.TERM === 'dumb') { + return min; + } + + if (process.platform === 'win32') { + // Windows 10 build 10586 is the first Windows release that supports 256 colors. + // Windows 10 build 14931 is the first release that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(osRelease[0]) >= 10 + && Number(osRelease[2]) >= 10_586 + ) { + return Number(osRelease[2]) >= 14_931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) { + return 3; + } + + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + + if (env.COLORTERM === 'truecolor') { + return 3; + } + + if (env.TERM === 'xterm-kitty') { + return 3; + } + + if ('TERM_PROGRAM' in env) { + const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': { + return version >= 3 ? 3 : 2; + } + + case 'Apple_Terminal': { + return 2; + } + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + return min; +} + +export function createSupportsColor(stream, options = {}) { + const level = _supportsColor(stream, { + streamIsTTY: stream && stream.isTTY, + ...options, + }); + + return translateLevel(level); +} + +const supportsColor = { + stdout: createSupportsColor({isTTY: tty.isatty(1)}), + stderr: createSupportsColor({isTTY: tty.isatty(2)}), +}; + +export default supportsColor; diff --git a/node_modules/npm/node_modules/supports-color/license b/node_modules/npm/node_modules/supports-color/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/supports-color/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/supports-color/package.json b/node_modules/npm/node_modules/supports-color/package.json new file mode 100644 index 00000000..73868472 --- /dev/null +++ b/node_modules/npm/node_modules/supports-color/package.json @@ -0,0 +1,60 @@ +{ + "name": "supports-color", + "version": "9.4.0", + "description": "Detect whether a terminal supports color", + "license": "MIT", + "repository": "chalk/supports-color", + "funding": "https://github.com/chalk/supports-color?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": { + "node": "./index.js", + "default": "./browser.js" + }, + "engines": { + "node": ">=12" + }, + "scripts": { + "//test": "xo && ava && tsd", + "test": "tsd" + }, + "files": [ + "index.js", + "index.d.ts", + "browser.js", + "browser.d.ts" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "ansi", + "styles", + "tty", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "support", + "supports", + "capability", + "detect", + "truecolor", + "16m" + ], + "devDependencies": { + "@types/node": "^20.3.2", + "ava": "^5.3.1", + "import-fresh": "^3.3.0", + "tsd": "^0.18.0", + "xo": "^0.54.2" + } +} diff --git a/node_modules/npm/node_modules/tar/LICENSE b/node_modules/npm/node_modules/tar/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/tar/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/tar/index.js b/node_modules/npm/node_modules/tar/index.js new file mode 100644 index 00000000..c9ae06e7 --- /dev/null +++ b/node_modules/npm/node_modules/tar/index.js @@ -0,0 +1,18 @@ +'use strict' + +// high-level commands +exports.c = exports.create = require('./lib/create.js') +exports.r = exports.replace = require('./lib/replace.js') +exports.t = exports.list = require('./lib/list.js') +exports.u = exports.update = require('./lib/update.js') +exports.x = exports.extract = require('./lib/extract.js') + +// classes +exports.Pack = require('./lib/pack.js') +exports.Unpack = require('./lib/unpack.js') +exports.Parse = require('./lib/parse.js') +exports.ReadEntry = require('./lib/read-entry.js') +exports.WriteEntry = require('./lib/write-entry.js') +exports.Header = require('./lib/header.js') +exports.Pax = require('./lib/pax.js') +exports.types = require('./lib/types.js') diff --git a/node_modules/npm/node_modules/tar/lib/create.js b/node_modules/npm/node_modules/tar/lib/create.js new file mode 100644 index 00000000..9c860d4e --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/create.js @@ -0,0 +1,111 @@ +'use strict' + +// tar -c +const hlo = require('./high-level-opt.js') + +const Pack = require('./pack.js') +const fsm = require('fs-minipass') +const t = require('./list.js') +const path = require('path') + +module.exports = (opt_, files, cb) => { + if (typeof files === 'function') { + cb = files + } + + if (Array.isArray(opt_)) { + files = opt_, opt_ = {} + } + + if (!files || !Array.isArray(files) || !files.length) { + throw new TypeError('no files or directories specified') + } + + files = Array.from(files) + + const opt = hlo(opt_) + + if (opt.sync && typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions') + } + + if (!opt.file && typeof cb === 'function') { + throw new TypeError('callback only supported with file option') + } + + return opt.file && opt.sync ? createFileSync(opt, files) + : opt.file ? createFile(opt, files, cb) + : opt.sync ? createSync(opt, files) + : create(opt, files) +} + +const createFileSync = (opt, files) => { + const p = new Pack.Sync(opt) + const stream = new fsm.WriteStreamSync(opt.file, { + mode: opt.mode || 0o666, + }) + p.pipe(stream) + addFilesSync(p, files) +} + +const createFile = (opt, files, cb) => { + const p = new Pack(opt) + const stream = new fsm.WriteStream(opt.file, { + mode: opt.mode || 0o666, + }) + p.pipe(stream) + + const promise = new Promise((res, rej) => { + stream.on('error', rej) + stream.on('close', res) + p.on('error', rej) + }) + + addFilesAsync(p, files) + + return cb ? promise.then(cb, cb) : promise +} + +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') { + t({ + file: path.resolve(p.cwd, file.slice(1)), + sync: true, + noResume: true, + onentry: entry => p.add(entry), + }) + } else { + p.add(file) + } + }) + p.end() +} + +const addFilesAsync = (p, files) => { + while (files.length) { + const file = files.shift() + if (file.charAt(0) === '@') { + return t({ + file: path.resolve(p.cwd, file.slice(1)), + noResume: true, + onentry: entry => p.add(entry), + }).then(_ => addFilesAsync(p, files)) + } else { + p.add(file) + } + } + p.end() +} + +const createSync = (opt, files) => { + const p = new Pack.Sync(opt) + addFilesSync(p, files) + return p +} + +const create = (opt, files) => { + const p = new Pack(opt) + addFilesAsync(p, files) + return p +} diff --git a/node_modules/npm/node_modules/tar/lib/extract.js b/node_modules/npm/node_modules/tar/lib/extract.js new file mode 100644 index 00000000..54767982 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/extract.js @@ -0,0 +1,113 @@ +'use strict' + +// tar -x +const hlo = require('./high-level-opt.js') +const Unpack = require('./unpack.js') +const fs = require('fs') +const fsm = require('fs-minipass') +const path = require('path') +const stripSlash = require('./strip-trailing-slashes.js') + +module.exports = (opt_, files, cb) => { + if (typeof opt_ === 'function') { + cb = opt_, files = null, opt_ = {} + } else if (Array.isArray(opt_)) { + files = opt_, opt_ = {} + } + + if (typeof files === 'function') { + cb = files, files = null + } + + if (!files) { + files = [] + } else { + files = Array.from(files) + } + + const opt = hlo(opt_) + + if (opt.sync && typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions') + } + + if (!opt.file && typeof cb === 'function') { + throw new TypeError('callback only supported with file option') + } + + if (files.length) { + filesFilter(opt, files) + } + + return opt.file && opt.sync ? extractFileSync(opt) + : opt.file ? extractFile(opt, cb) + : opt.sync ? extractSync(opt) + : extract(opt) +} + +// construct a filter that limits the file entries listed +// include child entries if a dir is included +const filesFilter = (opt, files) => { + const map = new Map(files.map(f => [stripSlash(f), true])) + const filter = opt.filter + + const mapHas = (file, r) => { + const root = r || path.parse(file).root || '.' + const ret = file === root ? false + : map.has(file) ? map.get(file) + : mapHas(path.dirname(file), root) + + map.set(file, ret) + return ret + } + + opt.filter = filter + ? (file, entry) => filter(file, entry) && mapHas(stripSlash(file)) + : file => mapHas(stripSlash(file)) +} + +const extractFileSync = opt => { + const u = new Unpack.Sync(opt) + + const file = opt.file + const stat = fs.statSync(file) + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + const readSize = opt.maxReadSize || 16 * 1024 * 1024 + const stream = new fsm.ReadStreamSync(file, { + readSize: readSize, + size: stat.size, + }) + stream.pipe(u) +} + +const extractFile = (opt, cb) => { + const u = new Unpack(opt) + const readSize = opt.maxReadSize || 16 * 1024 * 1024 + + const file = opt.file + const p = new Promise((resolve, reject) => { + u.on('error', reject) + u.on('close', resolve) + + // This trades a zero-byte read() syscall for a stat + // However, it will usually result in less memory allocation + fs.stat(file, (er, stat) => { + if (er) { + reject(er) + } else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size, + }) + stream.on('error', reject) + stream.pipe(u) + } + }) + }) + return cb ? p.then(cb, cb) : p +} + +const extractSync = opt => new Unpack.Sync(opt) + +const extract = opt => new Unpack(opt) diff --git a/node_modules/npm/node_modules/tar/lib/get-write-flag.js b/node_modules/npm/node_modules/tar/lib/get-write-flag.js new file mode 100644 index 00000000..e8695999 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/get-write-flag.js @@ -0,0 +1,20 @@ +// Get the appropriate flag to use for creating files +// We use fmap on Windows platforms for files less than +// 512kb. This is a fairly low limit, but avoids making +// things slower in some cases. Since most of what this +// library is used for is extracting tarballs of many +// relatively small files in npm packages and the like, +// it can be a big boost on Windows platforms. +// Only supported in Node v12.9.0 and above. +const platform = process.env.__FAKE_PLATFORM__ || process.platform +const isWindows = platform === 'win32' +const fs = global.__FAKE_TESTING_FS__ || require('fs') + +/* istanbul ignore next */ +const { O_CREAT, O_TRUNC, O_WRONLY, UV_FS_O_FILEMAP = 0 } = fs.constants + +const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP +const fMapLimit = 512 * 1024 +const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY +module.exports = !fMapEnabled ? () => 'w' + : size => size < fMapLimit ? fMapFlag : 'w' diff --git a/node_modules/npm/node_modules/tar/lib/header.js b/node_modules/npm/node_modules/tar/lib/header.js new file mode 100644 index 00000000..411d5e45 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/header.js @@ -0,0 +1,304 @@ +'use strict' +// parse a 512-byte header block to a data object, or vice-versa +// encode returns `true` if a pax extended header is needed, because +// the data could not be faithfully encoded in a simple header. +// (Also, check header.needPax to see if it needs a pax header.) + +const types = require('./types.js') +const pathModule = require('path').posix +const large = require('./large-numbers.js') + +const SLURP = Symbol('slurp') +const TYPE = Symbol('type') + +class Header { + constructor (data, off, ex, gex) { + this.cksumValid = false + this.needPax = false + this.nullBlock = false + + this.block = null + this.path = null + this.mode = null + this.uid = null + this.gid = null + this.size = null + this.mtime = null + this.cksum = null + this[TYPE] = '0' + this.linkpath = null + this.uname = null + this.gname = null + this.devmaj = 0 + this.devmin = 0 + this.atime = null + this.ctime = null + + if (Buffer.isBuffer(data)) { + this.decode(data, off || 0, ex, gex) + } else if (data) { + this.set(data) + } + } + + decode (buf, off, ex, gex) { + if (!off) { + off = 0 + } + + if (!buf || !(buf.length >= off + 512)) { + throw new Error('need 512 bytes for header') + } + + this.path = decString(buf, off, 100) + this.mode = decNumber(buf, off + 100, 8) + this.uid = decNumber(buf, off + 108, 8) + this.gid = decNumber(buf, off + 116, 8) + this.size = decNumber(buf, off + 124, 12) + this.mtime = decDate(buf, off + 136, 12) + this.cksum = decNumber(buf, off + 148, 12) + + // if we have extended or global extended headers, apply them now + // See https://github.com/npm/node-tar/pull/187 + this[SLURP](ex) + this[SLURP](gex, true) + + // old tar versions marked dirs as a file with a trailing / + this[TYPE] = decString(buf, off + 156, 1) + if (this[TYPE] === '') { + this[TYPE] = '0' + } + if (this[TYPE] === '0' && this.path.slice(-1) === '/') { + this[TYPE] = '5' + } + + // tar implementations sometimes incorrectly put the stat(dir).size + // as the size in the tarball, even though Directory entries are + // not able to have any body at all. In the very rare chance that + // it actually DOES have a body, we weren't going to do anything with + // it anyway, and it'll just be a warning about an invalid header. + if (this[TYPE] === '5') { + this.size = 0 + } + + this.linkpath = decString(buf, off + 157, 100) + if (buf.slice(off + 257, off + 265).toString() === 'ustar\u000000') { + this.uname = decString(buf, off + 265, 32) + this.gname = decString(buf, off + 297, 32) + this.devmaj = decNumber(buf, off + 329, 8) + this.devmin = decNumber(buf, off + 337, 8) + if (buf[off + 475] !== 0) { + // definitely a prefix, definitely >130 chars. + const prefix = decString(buf, off + 345, 155) + this.path = prefix + '/' + this.path + } else { + const prefix = decString(buf, off + 345, 130) + if (prefix) { + this.path = prefix + '/' + this.path + } + this.atime = decDate(buf, off + 476, 12) + this.ctime = decDate(buf, off + 488, 12) + } + } + + let sum = 8 * 0x20 + for (let i = off; i < off + 148; i++) { + sum += buf[i] + } + + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i] + } + + this.cksumValid = sum === this.cksum + if (this.cksum === null && sum === 8 * 0x20) { + this.nullBlock = true + } + } + + [SLURP] (ex, global) { + for (const k in ex) { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. + if (ex[k] !== null && ex[k] !== undefined && + !(global && k === 'path')) { + this[k] = ex[k] + } + } + } + + encode (buf, off) { + if (!buf) { + buf = this.block = Buffer.alloc(512) + off = 0 + } + + if (!off) { + off = 0 + } + + if (!(buf.length >= off + 512)) { + throw new Error('need 512 bytes for header') + } + + const prefixSize = this.ctime || this.atime ? 130 : 155 + const split = splitPrefix(this.path || '', prefixSize) + const path = split[0] + const prefix = split[1] + this.needPax = split[2] + + this.needPax = encString(buf, off, 100, path) || this.needPax + this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax + this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax + this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax + this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax + this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax + buf[off + 156] = this[TYPE].charCodeAt(0) + this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax + buf.write('ustar\u000000', off + 257, 8) + this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax + this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax + this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax + this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax + this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax + if (buf[off + 475] !== 0) { + this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax + } else { + this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax + this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax + this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax + } + + let sum = 8 * 0x20 + for (let i = off; i < off + 148; i++) { + sum += buf[i] + } + + for (let i = off + 156; i < off + 512; i++) { + sum += buf[i] + } + + this.cksum = sum + encNumber(buf, off + 148, 8, this.cksum) + this.cksumValid = true + + return this.needPax + } + + set (data) { + for (const i in data) { + if (data[i] !== null && data[i] !== undefined) { + this[i] = data[i] + } + } + } + + get type () { + return types.name.get(this[TYPE]) || this[TYPE] + } + + get typeKey () { + return this[TYPE] + } + + set type (type) { + if (types.code.has(type)) { + this[TYPE] = types.code.get(type) + } else { + this[TYPE] = type + } + } +} + +const splitPrefix = (p, prefixSize) => { + const pathSize = 100 + let pp = p + let prefix = '' + let ret + const root = pathModule.parse(p).root || '.' + + if (Buffer.byteLength(pp) < pathSize) { + ret = [pp, prefix, false] + } else { + // first set prefix to the dir, and path to the base + prefix = pathModule.dirname(pp) + pp = pathModule.basename(pp) + + do { + if (Buffer.byteLength(pp) <= pathSize && + Buffer.byteLength(prefix) <= prefixSize) { + // both fit! + ret = [pp, prefix, false] + } else if (Buffer.byteLength(pp) > pathSize && + Buffer.byteLength(prefix) <= prefixSize) { + // prefix fits in prefix, but path doesn't fit in path + ret = [pp.slice(0, pathSize - 1), prefix, true] + } else { + // make path take a bit from prefix + pp = pathModule.join(pathModule.basename(prefix), pp) + prefix = pathModule.dirname(prefix) + } + } while (prefix !== root && !ret) + + // at this point, found no resolution, just truncate + if (!ret) { + ret = [p.slice(0, pathSize - 1), '', true] + } + } + return ret +} + +const decString = (buf, off, size) => + buf.slice(off, off + size).toString('utf8').replace(/\0.*/, '') + +const decDate = (buf, off, size) => + numToDate(decNumber(buf, off, size)) + +const numToDate = num => num === null ? null : new Date(num * 1000) + +const decNumber = (buf, off, size) => + buf[off] & 0x80 ? large.parse(buf.slice(off, off + size)) + : decSmallNumber(buf, off, size) + +const nanNull = value => isNaN(value) ? null : value + +const decSmallNumber = (buf, off, size) => + nanNull(parseInt( + buf.slice(off, off + size) + .toString('utf8').replace(/\0.*$/, '').trim(), 8)) + +// the maximum encodable as a null-terminated octal, by field size +const MAXNUM = { + 12: 0o77777777777, + 8: 0o7777777, +} + +const encNumber = (buf, off, size, number) => + number === null ? false : + number > MAXNUM[size] || number < 0 + ? (large.encode(number, buf.slice(off, off + size)), true) + : (encSmallNumber(buf, off, size, number), false) + +const encSmallNumber = (buf, off, size, number) => + buf.write(octalString(number, size), off, size, 'ascii') + +const octalString = (number, size) => + padOctal(Math.floor(number).toString(8), size) + +const padOctal = (string, size) => + (string.length === size - 1 ? string + : new Array(size - string.length - 1).join('0') + string + ' ') + '\0' + +const encDate = (buf, off, size, date) => + date === null ? false : + encNumber(buf, off, size, date.getTime() / 1000) + +// enough to fill the longest string we've got +const NULLS = new Array(156).join('\0') +// pad with nulls, return true if it's longer or non-ascii +const encString = (buf, off, size, string) => + string === null ? false : + (buf.write(string + NULLS, off, size, 'utf8'), + string.length !== Buffer.byteLength(string) || string.length > size) + +module.exports = Header diff --git a/node_modules/npm/node_modules/tar/lib/high-level-opt.js b/node_modules/npm/node_modules/tar/lib/high-level-opt.js new file mode 100644 index 00000000..40e44180 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/high-level-opt.js @@ -0,0 +1,29 @@ +'use strict' + +// turn tar(1) style args like `C` into the more verbose things like `cwd` + +const argmap = new Map([ + ['C', 'cwd'], + ['f', 'file'], + ['z', 'gzip'], + ['P', 'preservePaths'], + ['U', 'unlink'], + ['strip-components', 'strip'], + ['stripComponents', 'strip'], + ['keep-newer', 'newer'], + ['keepNewer', 'newer'], + ['keep-newer-files', 'newer'], + ['keepNewerFiles', 'newer'], + ['k', 'keep'], + ['keep-existing', 'keep'], + ['keepExisting', 'keep'], + ['m', 'noMtime'], + ['no-mtime', 'noMtime'], + ['p', 'preserveOwner'], + ['L', 'follow'], + ['h', 'follow'], +]) + +module.exports = opt => opt ? Object.keys(opt).map(k => [ + argmap.has(k) ? argmap.get(k) : k, opt[k], +]).reduce((set, kv) => (set[kv[0]] = kv[1], set), Object.create(null)) : {} diff --git a/node_modules/npm/node_modules/tar/lib/large-numbers.js b/node_modules/npm/node_modules/tar/lib/large-numbers.js new file mode 100644 index 00000000..b11e72d9 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/large-numbers.js @@ -0,0 +1,104 @@ +'use strict' +// Tar can encode large and negative numbers using a leading byte of +// 0xff for negative, and 0x80 for positive. + +const encode = (num, buf) => { + if (!Number.isSafeInteger(num)) { + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('cannot encode number outside of javascript safe integer range') + } else if (num < 0) { + encodeNegative(num, buf) + } else { + encodePositive(num, buf) + } + return buf +} + +const encodePositive = (num, buf) => { + buf[0] = 0x80 + + for (var i = buf.length; i > 1; i--) { + buf[i - 1] = num & 0xff + num = Math.floor(num / 0x100) + } +} + +const encodeNegative = (num, buf) => { + buf[0] = 0xff + var flipped = false + num = num * -1 + for (var i = buf.length; i > 1; i--) { + var byte = num & 0xff + num = Math.floor(num / 0x100) + if (flipped) { + buf[i - 1] = onesComp(byte) + } else if (byte === 0) { + buf[i - 1] = 0 + } else { + flipped = true + buf[i - 1] = twosComp(byte) + } + } +} + +const parse = (buf) => { + const pre = buf[0] + const value = pre === 0x80 ? pos(buf.slice(1, buf.length)) + : pre === 0xff ? twos(buf) + : null + if (value === null) { + throw Error('invalid base256 encoding') + } + + if (!Number.isSafeInteger(value)) { + // The number is so large that javascript cannot represent it with integer + // precision. + throw Error('parsed number outside of javascript safe integer range') + } + + return value +} + +const twos = (buf) => { + var len = buf.length + var sum = 0 + var flipped = false + for (var i = len - 1; i > -1; i--) { + var byte = buf[i] + var f + if (flipped) { + f = onesComp(byte) + } else if (byte === 0) { + f = byte + } else { + flipped = true + f = twosComp(byte) + } + if (f !== 0) { + sum -= f * Math.pow(256, len - i - 1) + } + } + return sum +} + +const pos = (buf) => { + var len = buf.length + var sum = 0 + for (var i = len - 1; i > -1; i--) { + var byte = buf[i] + if (byte !== 0) { + sum += byte * Math.pow(256, len - i - 1) + } + } + return sum +} + +const onesComp = byte => (0xff ^ byte) & 0xff + +const twosComp = byte => ((0xff ^ byte) + 1) & 0xff + +module.exports = { + encode, + parse, +} diff --git a/node_modules/npm/node_modules/tar/lib/list.js b/node_modules/npm/node_modules/tar/lib/list.js new file mode 100644 index 00000000..f2358c25 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/list.js @@ -0,0 +1,139 @@ +'use strict' + +// XXX: This shares a lot in common with extract.js +// maybe some DRY opportunity here? + +// tar -t +const hlo = require('./high-level-opt.js') +const Parser = require('./parse.js') +const fs = require('fs') +const fsm = require('fs-minipass') +const path = require('path') +const stripSlash = require('./strip-trailing-slashes.js') + +module.exports = (opt_, files, cb) => { + if (typeof opt_ === 'function') { + cb = opt_, files = null, opt_ = {} + } else if (Array.isArray(opt_)) { + files = opt_, opt_ = {} + } + + if (typeof files === 'function') { + cb = files, files = null + } + + if (!files) { + files = [] + } else { + files = Array.from(files) + } + + const opt = hlo(opt_) + + if (opt.sync && typeof cb === 'function') { + throw new TypeError('callback not supported for sync tar functions') + } + + if (!opt.file && typeof cb === 'function') { + throw new TypeError('callback only supported with file option') + } + + if (files.length) { + filesFilter(opt, files) + } + + if (!opt.noResume) { + onentryFunction(opt) + } + + return opt.file && opt.sync ? listFileSync(opt) + : opt.file ? listFile(opt, cb) + : list(opt) +} + +const onentryFunction = opt => { + const onentry = opt.onentry + opt.onentry = onentry ? e => { + onentry(e) + e.resume() + } : e => e.resume() +} + +// construct a filter that limits the file entries listed +// include child entries if a dir is included +const filesFilter = (opt, files) => { + const map = new Map(files.map(f => [stripSlash(f), true])) + const filter = opt.filter + + const mapHas = (file, r) => { + const root = r || path.parse(file).root || '.' + const ret = file === root ? false + : map.has(file) ? map.get(file) + : mapHas(path.dirname(file), root) + + map.set(file, ret) + return ret + } + + opt.filter = filter + ? (file, entry) => filter(file, entry) && mapHas(stripSlash(file)) + : file => mapHas(stripSlash(file)) +} + +const listFileSync = opt => { + const p = list(opt) + const file = opt.file + let threw = true + let fd + try { + const stat = fs.statSync(file) + const readSize = opt.maxReadSize || 16 * 1024 * 1024 + if (stat.size < readSize) { + p.end(fs.readFileSync(file)) + } else { + let pos = 0 + const buf = Buffer.allocUnsafe(readSize) + fd = fs.openSync(file, 'r') + while (pos < stat.size) { + const bytesRead = fs.readSync(fd, buf, 0, readSize, pos) + pos += bytesRead + p.write(buf.slice(0, bytesRead)) + } + p.end() + } + threw = false + } finally { + if (threw && fd) { + try { + fs.closeSync(fd) + } catch (er) {} + } + } +} + +const listFile = (opt, cb) => { + const parse = new Parser(opt) + const readSize = opt.maxReadSize || 16 * 1024 * 1024 + + const file = opt.file + const p = new Promise((resolve, reject) => { + parse.on('error', reject) + parse.on('end', resolve) + + fs.stat(file, (er, stat) => { + if (er) { + reject(er) + } else { + const stream = new fsm.ReadStream(file, { + readSize: readSize, + size: stat.size, + }) + stream.on('error', reject) + stream.pipe(parse) + } + }) + }) + return cb ? p.then(cb, cb) : p +} + +const list = opt => new Parser(opt) diff --git a/node_modules/npm/node_modules/tar/lib/mkdir.js b/node_modules/npm/node_modules/tar/lib/mkdir.js new file mode 100644 index 00000000..8ee8de78 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/mkdir.js @@ -0,0 +1,229 @@ +'use strict' +// wrapper around mkdirp for tar's needs. + +// TODO: This should probably be a class, not functionally +// passing around state in a gazillion args. + +const mkdirp = require('mkdirp') +const fs = require('fs') +const path = require('path') +const chownr = require('chownr') +const normPath = require('./normalize-windows-path.js') + +class SymlinkError extends Error { + constructor (symlink, path) { + super('Cannot extract through symbolic link') + this.path = path + this.symlink = symlink + } + + get name () { + return 'SylinkError' + } +} + +class CwdError extends Error { + constructor (path, code) { + super(code + ': Cannot cd into \'' + path + '\'') + this.path = path + this.code = code + } + + get name () { + return 'CwdError' + } +} + +const cGet = (cache, key) => cache.get(normPath(key)) +const cSet = (cache, key, val) => cache.set(normPath(key), val) + +const checkCwd = (dir, cb) => { + fs.stat(dir, (er, st) => { + if (er || !st.isDirectory()) { + er = new CwdError(dir, er && er.code || 'ENOTDIR') + } + cb(er) + }) +} + +module.exports = (dir, opt, cb) => { + dir = normPath(dir) + + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + const umask = opt.umask + const mode = opt.mode | 0o0700 + const needChmod = (mode & umask) !== 0 + + const uid = opt.uid + const gid = opt.gid + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + (uid !== opt.processUid || gid !== opt.processGid) + + const preserve = opt.preserve + const unlink = opt.unlink + const cache = opt.cache + const cwd = normPath(opt.cwd) + + const done = (er, created) => { + if (er) { + cb(er) + } else { + cSet(cache, dir, true) + if (created && doChown) { + chownr(created, uid, gid, er => done(er)) + } else if (needChmod) { + fs.chmod(dir, mode, cb) + } else { + cb() + } + } + } + + if (cache && cGet(cache, dir) === true) { + return done() + } + + if (dir === cwd) { + return checkCwd(dir, done) + } + + if (preserve) { + return mkdirp(dir, { mode }).then(made => done(null, made), done) + } + + const sub = normPath(path.relative(cwd, dir)) + const parts = sub.split('/') + mkdir_(cwd, parts, mode, cache, unlink, cwd, null, done) +} + +const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => { + if (!parts.length) { + return cb(null, created) + } + const p = parts.shift() + const part = normPath(path.resolve(base + '/' + p)) + if (cGet(cache, part)) { + return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb) + } + fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)) +} + +const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => er => { + if (er) { + fs.lstat(part, (statEr, st) => { + if (statEr) { + statEr.path = statEr.path && normPath(statEr.path) + cb(statEr) + } else if (st.isDirectory()) { + mkdir_(part, parts, mode, cache, unlink, cwd, created, cb) + } else if (unlink) { + fs.unlink(part, er => { + if (er) { + return cb(er) + } + fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)) + }) + } else if (st.isSymbolicLink()) { + return cb(new SymlinkError(part, part + '/' + parts.join('/'))) + } else { + cb(er) + } + }) + } else { + created = created || part + mkdir_(part, parts, mode, cache, unlink, cwd, created, cb) + } +} + +const checkCwdSync = dir => { + let ok = false + let code = 'ENOTDIR' + try { + ok = fs.statSync(dir).isDirectory() + } catch (er) { + code = er.code + } finally { + if (!ok) { + throw new CwdError(dir, code) + } + } +} + +module.exports.sync = (dir, opt) => { + dir = normPath(dir) + // if there's any overlap between mask and mode, + // then we'll need an explicit chmod + const umask = opt.umask + const mode = opt.mode | 0o0700 + const needChmod = (mode & umask) !== 0 + + const uid = opt.uid + const gid = opt.gid + const doChown = typeof uid === 'number' && + typeof gid === 'number' && + (uid !== opt.processUid || gid !== opt.processGid) + + const preserve = opt.preserve + const unlink = opt.unlink + const cache = opt.cache + const cwd = normPath(opt.cwd) + + const done = (created) => { + cSet(cache, dir, true) + if (created && doChown) { + chownr.sync(created, uid, gid) + } + if (needChmod) { + fs.chmodSync(dir, mode) + } + } + + if (cache && cGet(cache, dir) === true) { + return done() + } + + if (dir === cwd) { + checkCwdSync(cwd) + return done() + } + + if (preserve) { + return done(mkdirp.sync(dir, mode)) + } + + const sub = normPath(path.relative(cwd, dir)) + const parts = sub.split('/') + let created = null + for (let p = parts.shift(), part = cwd; + p && (part += '/' + p); + p = parts.shift()) { + part = normPath(path.resolve(part)) + if (cGet(cache, part)) { + continue + } + + try { + fs.mkdirSync(part, mode) + created = created || part + cSet(cache, part, true) + } catch (er) { + const st = fs.lstatSync(part) + if (st.isDirectory()) { + cSet(cache, part, true) + continue + } else if (unlink) { + fs.unlinkSync(part) + fs.mkdirSync(part, mode) + created = created || part + cSet(cache, part, true) + continue + } else if (st.isSymbolicLink()) { + return new SymlinkError(part, part + '/' + parts.join('/')) + } + } + } + + return done(created) +} diff --git a/node_modules/npm/node_modules/tar/lib/mode-fix.js b/node_modules/npm/node_modules/tar/lib/mode-fix.js new file mode 100644 index 00000000..42f1d6e6 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/mode-fix.js @@ -0,0 +1,27 @@ +'use strict' +module.exports = (mode, isDir, portable) => { + mode &= 0o7777 + + // in portable mode, use the minimum reasonable umask + // if this system creates files with 0o664 by default + // (as some linux distros do), then we'll write the + // archive with 0o644 instead. Also, don't ever create + // a file that is not readable/writable by the owner. + if (portable) { + mode = (mode | 0o600) & ~0o22 + } + + // if dirs are readable, then they should be listable + if (isDir) { + if (mode & 0o400) { + mode |= 0o100 + } + if (mode & 0o40) { + mode |= 0o10 + } + if (mode & 0o4) { + mode |= 0o1 + } + } + return mode +} diff --git a/node_modules/npm/node_modules/tar/lib/normalize-unicode.js b/node_modules/npm/node_modules/tar/lib/normalize-unicode.js new file mode 100644 index 00000000..79e285ab --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/normalize-unicode.js @@ -0,0 +1,12 @@ +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +const normalizeCache = Object.create(null) +const { hasOwnProperty } = Object.prototype +module.exports = s => { + if (!hasOwnProperty.call(normalizeCache, s)) { + normalizeCache[s] = s.normalize('NFD') + } + return normalizeCache[s] +} diff --git a/node_modules/npm/node_modules/tar/lib/normalize-windows-path.js b/node_modules/npm/node_modules/tar/lib/normalize-windows-path.js new file mode 100644 index 00000000..eb13ba01 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/normalize-windows-path.js @@ -0,0 +1,8 @@ +// on windows, either \ or / are valid directory separators. +// on unix, \ is a valid character in filenames. +// so, on windows, and only on windows, we replace all \ chars with /, +// so that we can use / as our one and only directory separator char. + +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform +module.exports = platform !== 'win32' ? p => p + : p => p && p.replace(/\\/g, '/') diff --git a/node_modules/npm/node_modules/tar/lib/pack.js b/node_modules/npm/node_modules/tar/lib/pack.js new file mode 100644 index 00000000..d533a068 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/pack.js @@ -0,0 +1,432 @@ +'use strict' + +// A readable tar stream creator +// Technically, this is a transform stream that you write paths into, +// and tar format comes out of. +// The `add()` method is like `write()` but returns this, +// and end() return `this` as well, so you can +// do `new Pack(opt).add('files').add('dir').end().pipe(output) +// You could also do something like: +// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar')) + +class PackJob { + constructor (path, absolute) { + this.path = path || './' + this.absolute = absolute + this.entry = null + this.stat = null + this.readdir = null + this.pending = false + this.ignore = false + this.piped = false + } +} + +const { Minipass } = require('minipass') +const zlib = require('minizlib') +const ReadEntry = require('./read-entry.js') +const WriteEntry = require('./write-entry.js') +const WriteEntrySync = WriteEntry.Sync +const WriteEntryTar = WriteEntry.Tar +const Yallist = require('yallist') +const EOF = Buffer.alloc(1024) +const ONSTAT = Symbol('onStat') +const ENDED = Symbol('ended') +const QUEUE = Symbol('queue') +const CURRENT = Symbol('current') +const PROCESS = Symbol('process') +const PROCESSING = Symbol('processing') +const PROCESSJOB = Symbol('processJob') +const JOBS = Symbol('jobs') +const JOBDONE = Symbol('jobDone') +const ADDFSENTRY = Symbol('addFSEntry') +const ADDTARENTRY = Symbol('addTarEntry') +const STAT = Symbol('stat') +const READDIR = Symbol('readdir') +const ONREADDIR = Symbol('onreaddir') +const PIPE = Symbol('pipe') +const ENTRY = Symbol('entry') +const ENTRYOPT = Symbol('entryOpt') +const WRITEENTRYCLASS = Symbol('writeEntryClass') +const WRITE = Symbol('write') +const ONDRAIN = Symbol('ondrain') + +const fs = require('fs') +const path = require('path') +const warner = require('./warn-mixin.js') +const normPath = require('./normalize-windows-path.js') + +const Pack = warner(class Pack extends Minipass { + constructor (opt) { + super(opt) + opt = opt || Object.create(null) + this.opt = opt + this.file = opt.file || '' + this.cwd = opt.cwd || process.cwd() + this.maxReadSize = opt.maxReadSize + this.preservePaths = !!opt.preservePaths + this.strict = !!opt.strict + this.noPax = !!opt.noPax + this.prefix = normPath(opt.prefix || '') + this.linkCache = opt.linkCache || new Map() + this.statCache = opt.statCache || new Map() + this.readdirCache = opt.readdirCache || new Map() + + this[WRITEENTRYCLASS] = WriteEntry + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn) + } + + this.portable = !!opt.portable + this.zip = null + + if (opt.gzip || opt.brotli) { + if (opt.gzip && opt.brotli) { + throw new TypeError('gzip and brotli are mutually exclusive') + } + if (opt.gzip) { + if (typeof opt.gzip !== 'object') { + opt.gzip = {} + } + if (this.portable) { + opt.gzip.portable = true + } + this.zip = new zlib.Gzip(opt.gzip) + } + if (opt.brotli) { + if (typeof opt.brotli !== 'object') { + opt.brotli = {} + } + this.zip = new zlib.BrotliCompress(opt.brotli) + } + this.zip.on('data', chunk => super.write(chunk)) + this.zip.on('end', _ => super.end()) + this.zip.on('drain', _ => this[ONDRAIN]()) + this.on('resume', _ => this.zip.resume()) + } else { + this.on('drain', this[ONDRAIN]) + } + + this.noDirRecurse = !!opt.noDirRecurse + this.follow = !!opt.follow + this.noMtime = !!opt.noMtime + this.mtime = opt.mtime || null + + this.filter = typeof opt.filter === 'function' ? opt.filter : _ => true + + this[QUEUE] = new Yallist() + this[JOBS] = 0 + this.jobs = +opt.jobs || 4 + this[PROCESSING] = false + this[ENDED] = false + } + + [WRITE] (chunk) { + return super.write(chunk) + } + + add (path) { + this.write(path) + return this + } + + end (path) { + if (path) { + this.write(path) + } + this[ENDED] = true + this[PROCESS]() + return this + } + + write (path) { + if (this[ENDED]) { + throw new Error('write after end') + } + + if (path instanceof ReadEntry) { + this[ADDTARENTRY](path) + } else { + this[ADDFSENTRY](path) + } + return this.flowing + } + + [ADDTARENTRY] (p) { + const absolute = normPath(path.resolve(this.cwd, p.path)) + // in this case, we don't have to wait for the stat + if (!this.filter(p.path, p)) { + p.resume() + } else { + const job = new PackJob(p.path, absolute, false) + job.entry = new WriteEntryTar(p, this[ENTRYOPT](job)) + job.entry.on('end', _ => this[JOBDONE](job)) + this[JOBS] += 1 + this[QUEUE].push(job) + } + + this[PROCESS]() + } + + [ADDFSENTRY] (p) { + const absolute = normPath(path.resolve(this.cwd, p)) + this[QUEUE].push(new PackJob(p, absolute)) + this[PROCESS]() + } + + [STAT] (job) { + job.pending = true + this[JOBS] += 1 + const stat = this.follow ? 'stat' : 'lstat' + fs[stat](job.absolute, (er, stat) => { + job.pending = false + this[JOBS] -= 1 + if (er) { + this.emit('error', er) + } else { + this[ONSTAT](job, stat) + } + }) + } + + [ONSTAT] (job, stat) { + this.statCache.set(job.absolute, stat) + job.stat = stat + + // now we have the stat, we can filter it. + if (!this.filter(job.path, stat)) { + job.ignore = true + } + + this[PROCESS]() + } + + [READDIR] (job) { + job.pending = true + this[JOBS] += 1 + fs.readdir(job.absolute, (er, entries) => { + job.pending = false + this[JOBS] -= 1 + if (er) { + return this.emit('error', er) + } + this[ONREADDIR](job, entries) + }) + } + + [ONREADDIR] (job, entries) { + this.readdirCache.set(job.absolute, entries) + job.readdir = entries + this[PROCESS]() + } + + [PROCESS] () { + if (this[PROCESSING]) { + return + } + + this[PROCESSING] = true + for (let w = this[QUEUE].head; + w !== null && this[JOBS] < this.jobs; + w = w.next) { + this[PROCESSJOB](w.value) + if (w.value.ignore) { + const p = w.next + this[QUEUE].removeNode(w) + w.next = p + } + } + + this[PROCESSING] = false + + if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) { + if (this.zip) { + this.zip.end(EOF) + } else { + super.write(EOF) + super.end() + } + } + } + + get [CURRENT] () { + return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value + } + + [JOBDONE] (job) { + this[QUEUE].shift() + this[JOBS] -= 1 + this[PROCESS]() + } + + [PROCESSJOB] (job) { + if (job.pending) { + return + } + + if (job.entry) { + if (job === this[CURRENT] && !job.piped) { + this[PIPE](job) + } + return + } + + if (!job.stat) { + if (this.statCache.has(job.absolute)) { + this[ONSTAT](job, this.statCache.get(job.absolute)) + } else { + this[STAT](job) + } + } + if (!job.stat) { + return + } + + // filtered out! + if (job.ignore) { + return + } + + if (!this.noDirRecurse && job.stat.isDirectory() && !job.readdir) { + if (this.readdirCache.has(job.absolute)) { + this[ONREADDIR](job, this.readdirCache.get(job.absolute)) + } else { + this[READDIR](job) + } + if (!job.readdir) { + return + } + } + + // we know it doesn't have an entry, because that got checked above + job.entry = this[ENTRY](job) + if (!job.entry) { + job.ignore = true + return + } + + if (job === this[CURRENT] && !job.piped) { + this[PIPE](job) + } + } + + [ENTRYOPT] (job) { + return { + onwarn: (code, msg, data) => this.warn(code, msg, data), + noPax: this.noPax, + cwd: this.cwd, + absolute: job.absolute, + preservePaths: this.preservePaths, + maxReadSize: this.maxReadSize, + strict: this.strict, + portable: this.portable, + linkCache: this.linkCache, + statCache: this.statCache, + noMtime: this.noMtime, + mtime: this.mtime, + prefix: this.prefix, + } + } + + [ENTRY] (job) { + this[JOBS] += 1 + try { + return new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)) + .on('end', () => this[JOBDONE](job)) + .on('error', er => this.emit('error', er)) + } catch (er) { + this.emit('error', er) + } + } + + [ONDRAIN] () { + if (this[CURRENT] && this[CURRENT].entry) { + this[CURRENT].entry.resume() + } + } + + // like .pipe() but using super, because our write() is special + [PIPE] (job) { + job.piped = true + + if (job.readdir) { + job.readdir.forEach(entry => { + const p = job.path + const base = p === './' ? '' : p.replace(/\/*$/, '/') + this[ADDFSENTRY](base + entry) + }) + } + + const source = job.entry + const zip = this.zip + + if (zip) { + source.on('data', chunk => { + if (!zip.write(chunk)) { + source.pause() + } + }) + } else { + source.on('data', chunk => { + if (!super.write(chunk)) { + source.pause() + } + }) + } + } + + pause () { + if (this.zip) { + this.zip.pause() + } + return super.pause() + } +}) + +class PackSync extends Pack { + constructor (opt) { + super(opt) + this[WRITEENTRYCLASS] = WriteEntrySync + } + + // pause/resume are no-ops in sync streams. + pause () {} + resume () {} + + [STAT] (job) { + const stat = this.follow ? 'statSync' : 'lstatSync' + this[ONSTAT](job, fs[stat](job.absolute)) + } + + [READDIR] (job, stat) { + this[ONREADDIR](job, fs.readdirSync(job.absolute)) + } + + // gotta get it all in this tick + [PIPE] (job) { + const source = job.entry + const zip = this.zip + + if (job.readdir) { + job.readdir.forEach(entry => { + const p = job.path + const base = p === './' ? '' : p.replace(/\/*$/, '/') + this[ADDFSENTRY](base + entry) + }) + } + + if (zip) { + source.on('data', chunk => { + zip.write(chunk) + }) + } else { + source.on('data', chunk => { + super[WRITE](chunk) + }) + } + } +} + +Pack.Sync = PackSync + +module.exports = Pack diff --git a/node_modules/npm/node_modules/tar/lib/parse.js b/node_modules/npm/node_modules/tar/lib/parse.js new file mode 100644 index 00000000..94e53042 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/parse.js @@ -0,0 +1,552 @@ +'use strict' + +// this[BUFFER] is the remainder of a chunk if we're waiting for +// the full 512 bytes of a header to come in. We will Buffer.concat() +// it to the next write(), which is a mem copy, but a small one. +// +// this[QUEUE] is a Yallist of entries that haven't been emitted +// yet this can only get filled up if the user keeps write()ing after +// a write() returns false, or does a write() with more than one entry +// +// We don't buffer chunks, we always parse them and either create an +// entry, or push it into the active entry. The ReadEntry class knows +// to throw data away if .ignore=true +// +// Shift entry off the buffer when it emits 'end', and emit 'entry' for +// the next one in the list. +// +// At any time, we're pushing body chunks into the entry at WRITEENTRY, +// and waiting for 'end' on the entry at READENTRY +// +// ignored entries get .resume() called on them straight away + +const warner = require('./warn-mixin.js') +const Header = require('./header.js') +const EE = require('events') +const Yallist = require('yallist') +const maxMetaEntrySize = 1024 * 1024 +const Entry = require('./read-entry.js') +const Pax = require('./pax.js') +const zlib = require('minizlib') +const { nextTick } = require('process') + +const gzipHeader = Buffer.from([0x1f, 0x8b]) +const STATE = Symbol('state') +const WRITEENTRY = Symbol('writeEntry') +const READENTRY = Symbol('readEntry') +const NEXTENTRY = Symbol('nextEntry') +const PROCESSENTRY = Symbol('processEntry') +const EX = Symbol('extendedHeader') +const GEX = Symbol('globalExtendedHeader') +const META = Symbol('meta') +const EMITMETA = Symbol('emitMeta') +const BUFFER = Symbol('buffer') +const QUEUE = Symbol('queue') +const ENDED = Symbol('ended') +const EMITTEDEND = Symbol('emittedEnd') +const EMIT = Symbol('emit') +const UNZIP = Symbol('unzip') +const CONSUMECHUNK = Symbol('consumeChunk') +const CONSUMECHUNKSUB = Symbol('consumeChunkSub') +const CONSUMEBODY = Symbol('consumeBody') +const CONSUMEMETA = Symbol('consumeMeta') +const CONSUMEHEADER = Symbol('consumeHeader') +const CONSUMING = Symbol('consuming') +const BUFFERCONCAT = Symbol('bufferConcat') +const MAYBEEND = Symbol('maybeEnd') +const WRITING = Symbol('writing') +const ABORTED = Symbol('aborted') +const DONE = Symbol('onDone') +const SAW_VALID_ENTRY = Symbol('sawValidEntry') +const SAW_NULL_BLOCK = Symbol('sawNullBlock') +const SAW_EOF = Symbol('sawEOF') +const CLOSESTREAM = Symbol('closeStream') + +const noop = _ => true + +module.exports = warner(class Parser extends EE { + constructor (opt) { + opt = opt || {} + super(opt) + + this.file = opt.file || '' + + // set to boolean false when an entry starts. 1024 bytes of \0 + // is technically a valid tarball, albeit a boring one. + this[SAW_VALID_ENTRY] = null + + // these BADARCHIVE errors can't be detected early. listen on DONE. + this.on(DONE, _ => { + if (this[STATE] === 'begin' || this[SAW_VALID_ENTRY] === false) { + // either less than 1 block of data, or all entries were invalid. + // Either way, probably not even a tarball. + this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format') + } + }) + + if (opt.ondone) { + this.on(DONE, opt.ondone) + } else { + this.on(DONE, _ => { + this.emit('prefinish') + this.emit('finish') + this.emit('end') + }) + } + + this.strict = !!opt.strict + this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize + this.filter = typeof opt.filter === 'function' ? opt.filter : noop + // Unlike gzip, brotli doesn't have any magic bytes to identify it + // Users need to explicitly tell us they're extracting a brotli file + // Or we infer from the file extension + const isTBR = (opt.file && ( + opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr'))) + // if it's a tbr file it MIGHT be brotli, but we don't know until + // we look at it and verify it's not a valid tar file. + this.brotli = !opt.gzip && opt.brotli !== undefined ? opt.brotli + : isTBR ? undefined + : false + + // have to set this so that streams are ok piping into it + this.writable = true + this.readable = false + + this[QUEUE] = new Yallist() + this[BUFFER] = null + this[READENTRY] = null + this[WRITEENTRY] = null + this[STATE] = 'begin' + this[META] = '' + this[EX] = null + this[GEX] = null + this[ENDED] = false + this[UNZIP] = null + this[ABORTED] = false + this[SAW_NULL_BLOCK] = false + this[SAW_EOF] = false + + this.on('end', () => this[CLOSESTREAM]()) + + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn) + } + if (typeof opt.onentry === 'function') { + this.on('entry', opt.onentry) + } + } + + [CONSUMEHEADER] (chunk, position) { + if (this[SAW_VALID_ENTRY] === null) { + this[SAW_VALID_ENTRY] = false + } + let header + try { + header = new Header(chunk, position, this[EX], this[GEX]) + } catch (er) { + return this.warn('TAR_ENTRY_INVALID', er) + } + + if (header.nullBlock) { + if (this[SAW_NULL_BLOCK]) { + this[SAW_EOF] = true + // ending an archive with no entries. pointless, but legal. + if (this[STATE] === 'begin') { + this[STATE] = 'header' + } + this[EMIT]('eof') + } else { + this[SAW_NULL_BLOCK] = true + this[EMIT]('nullBlock') + } + } else { + this[SAW_NULL_BLOCK] = false + if (!header.cksumValid) { + this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header }) + } else if (!header.path) { + this.warn('TAR_ENTRY_INVALID', 'path is required', { header }) + } else { + const type = header.type + if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) { + this.warn('TAR_ENTRY_INVALID', 'linkpath required', { header }) + } else if (!/^(Symbolic)?Link$/.test(type) && header.linkpath) { + this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', { header }) + } else { + const entry = this[WRITEENTRY] = new Entry(header, this[EX], this[GEX]) + + // we do this for meta & ignored entries as well, because they + // are still valid tar, or else we wouldn't know to ignore them + if (!this[SAW_VALID_ENTRY]) { + if (entry.remain) { + // this might be the one! + const onend = () => { + if (!entry.invalid) { + this[SAW_VALID_ENTRY] = true + } + } + entry.on('end', onend) + } else { + this[SAW_VALID_ENTRY] = true + } + } + + if (entry.meta) { + if (entry.size > this.maxMetaEntrySize) { + entry.ignore = true + this[EMIT]('ignoredEntry', entry) + this[STATE] = 'ignore' + entry.resume() + } else if (entry.size > 0) { + this[META] = '' + entry.on('data', c => this[META] += c) + this[STATE] = 'meta' + } + } else { + this[EX] = null + entry.ignore = entry.ignore || !this.filter(entry.path, entry) + + if (entry.ignore) { + // probably valid, just not something we care about + this[EMIT]('ignoredEntry', entry) + this[STATE] = entry.remain ? 'ignore' : 'header' + entry.resume() + } else { + if (entry.remain) { + this[STATE] = 'body' + } else { + this[STATE] = 'header' + entry.end() + } + + if (!this[READENTRY]) { + this[QUEUE].push(entry) + this[NEXTENTRY]() + } else { + this[QUEUE].push(entry) + } + } + } + } + } + } + } + + [CLOSESTREAM] () { + nextTick(() => this.emit('close')) + } + + [PROCESSENTRY] (entry) { + let go = true + + if (!entry) { + this[READENTRY] = null + go = false + } else if (Array.isArray(entry)) { + this.emit.apply(this, entry) + } else { + this[READENTRY] = entry + this.emit('entry', entry) + if (!entry.emittedEnd) { + entry.on('end', _ => this[NEXTENTRY]()) + go = false + } + } + + return go + } + + [NEXTENTRY] () { + do {} while (this[PROCESSENTRY](this[QUEUE].shift())) + + if (!this[QUEUE].length) { + // At this point, there's nothing in the queue, but we may have an + // entry which is being consumed (readEntry). + // If we don't, then we definitely can handle more data. + // If we do, and either it's flowing, or it has never had any data + // written to it, then it needs more. + // The only other possibility is that it has returned false from a + // write() call, so we wait for the next drain to continue. + const re = this[READENTRY] + const drainNow = !re || re.flowing || re.size === re.remain + if (drainNow) { + if (!this[WRITING]) { + this.emit('drain') + } + } else { + re.once('drain', _ => this.emit('drain')) + } + } + } + + [CONSUMEBODY] (chunk, position) { + // write up to but no more than writeEntry.blockRemain + const entry = this[WRITEENTRY] + const br = entry.blockRemain + const c = (br >= chunk.length && position === 0) ? chunk + : chunk.slice(position, position + br) + + entry.write(c) + + if (!entry.blockRemain) { + this[STATE] = 'header' + this[WRITEENTRY] = null + entry.end() + } + + return c.length + } + + [CONSUMEMETA] (chunk, position) { + const entry = this[WRITEENTRY] + const ret = this[CONSUMEBODY](chunk, position) + + // if we finished, then the entry is reset + if (!this[WRITEENTRY]) { + this[EMITMETA](entry) + } + + return ret + } + + [EMIT] (ev, data, extra) { + if (!this[QUEUE].length && !this[READENTRY]) { + this.emit(ev, data, extra) + } else { + this[QUEUE].push([ev, data, extra]) + } + } + + [EMITMETA] (entry) { + this[EMIT]('meta', this[META]) + switch (entry.type) { + case 'ExtendedHeader': + case 'OldExtendedHeader': + this[EX] = Pax.parse(this[META], this[EX], false) + break + + case 'GlobalExtendedHeader': + this[GEX] = Pax.parse(this[META], this[GEX], true) + break + + case 'NextFileHasLongPath': + case 'OldGnuLongPath': + this[EX] = this[EX] || Object.create(null) + this[EX].path = this[META].replace(/\0.*/, '') + break + + case 'NextFileHasLongLinkpath': + this[EX] = this[EX] || Object.create(null) + this[EX].linkpath = this[META].replace(/\0.*/, '') + break + + /* istanbul ignore next */ + default: throw new Error('unknown meta: ' + entry.type) + } + } + + abort (error) { + this[ABORTED] = true + this.emit('abort', error) + // always throws, even in non-strict mode + this.warn('TAR_ABORT', error, { recoverable: false }) + } + + write (chunk) { + if (this[ABORTED]) { + return + } + + // first write, might be gzipped + const needSniff = this[UNZIP] === null || + this.brotli === undefined && this[UNZIP] === false + if (needSniff && chunk) { + if (this[BUFFER]) { + chunk = Buffer.concat([this[BUFFER], chunk]) + this[BUFFER] = null + } + if (chunk.length < gzipHeader.length) { + this[BUFFER] = chunk + return true + } + + // look for gzip header + for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) { + if (chunk[i] !== gzipHeader[i]) { + this[UNZIP] = false + } + } + + const maybeBrotli = this.brotli === undefined + if (this[UNZIP] === false && maybeBrotli) { + // read the first header to see if it's a valid tar file. If so, + // we can safely assume that it's not actually brotli, despite the + // .tbr or .tar.br file extension. + // if we ended before getting a full chunk, yes, def brotli + if (chunk.length < 512) { + if (this[ENDED]) { + this.brotli = true + } else { + this[BUFFER] = chunk + return true + } + } else { + // if it's tar, it's pretty reliably not brotli, chances of + // that happening are astronomical. + try { + new Header(chunk.slice(0, 512)) + this.brotli = false + } catch (_) { + this.brotli = true + } + } + } + + if (this[UNZIP] === null || (this[UNZIP] === false && this.brotli)) { + const ended = this[ENDED] + this[ENDED] = false + this[UNZIP] = this[UNZIP] === null + ? new zlib.Unzip() + : new zlib.BrotliDecompress() + this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)) + this[UNZIP].on('error', er => this.abort(er)) + this[UNZIP].on('end', _ => { + this[ENDED] = true + this[CONSUMECHUNK]() + }) + this[WRITING] = true + const ret = this[UNZIP][ended ? 'end' : 'write'](chunk) + this[WRITING] = false + return ret + } + } + + this[WRITING] = true + if (this[UNZIP]) { + this[UNZIP].write(chunk) + } else { + this[CONSUMECHUNK](chunk) + } + this[WRITING] = false + + // return false if there's a queue, or if the current entry isn't flowing + const ret = + this[QUEUE].length ? false : + this[READENTRY] ? this[READENTRY].flowing : + true + + // if we have no queue, then that means a clogged READENTRY + if (!ret && !this[QUEUE].length) { + this[READENTRY].once('drain', _ => this.emit('drain')) + } + + return ret + } + + [BUFFERCONCAT] (c) { + if (c && !this[ABORTED]) { + this[BUFFER] = this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c + } + } + + [MAYBEEND] () { + if (this[ENDED] && + !this[EMITTEDEND] && + !this[ABORTED] && + !this[CONSUMING]) { + this[EMITTEDEND] = true + const entry = this[WRITEENTRY] + if (entry && entry.blockRemain) { + // truncated, likely a damaged file + const have = this[BUFFER] ? this[BUFFER].length : 0 + this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${ + entry.blockRemain} more bytes, only ${have} available)`, { entry }) + if (this[BUFFER]) { + entry.write(this[BUFFER]) + } + entry.end() + } + this[EMIT](DONE) + } + } + + [CONSUMECHUNK] (chunk) { + if (this[CONSUMING]) { + this[BUFFERCONCAT](chunk) + } else if (!chunk && !this[BUFFER]) { + this[MAYBEEND]() + } else { + this[CONSUMING] = true + if (this[BUFFER]) { + this[BUFFERCONCAT](chunk) + const c = this[BUFFER] + this[BUFFER] = null + this[CONSUMECHUNKSUB](c) + } else { + this[CONSUMECHUNKSUB](chunk) + } + + while (this[BUFFER] && + this[BUFFER].length >= 512 && + !this[ABORTED] && + !this[SAW_EOF]) { + const c = this[BUFFER] + this[BUFFER] = null + this[CONSUMECHUNKSUB](c) + } + this[CONSUMING] = false + } + + if (!this[BUFFER] || this[ENDED]) { + this[MAYBEEND]() + } + } + + [CONSUMECHUNKSUB] (chunk) { + // we know that we are in CONSUMING mode, so anything written goes into + // the buffer. Advance the position and put any remainder in the buffer. + let position = 0 + const length = chunk.length + while (position + 512 <= length && !this[ABORTED] && !this[SAW_EOF]) { + switch (this[STATE]) { + case 'begin': + case 'header': + this[CONSUMEHEADER](chunk, position) + position += 512 + break + + case 'ignore': + case 'body': + position += this[CONSUMEBODY](chunk, position) + break + + case 'meta': + position += this[CONSUMEMETA](chunk, position) + break + + /* istanbul ignore next */ + default: + throw new Error('invalid state: ' + this[STATE]) + } + } + + if (position < length) { + if (this[BUFFER]) { + this[BUFFER] = Buffer.concat([chunk.slice(position), this[BUFFER]]) + } else { + this[BUFFER] = chunk.slice(position) + } + } + } + + end (chunk) { + if (!this[ABORTED]) { + if (this[UNZIP]) { + this[UNZIP].end(chunk) + } else { + this[ENDED] = true + if (this.brotli === undefined) chunk = chunk || Buffer.alloc(0) + this.write(chunk) + } + } + } +}) diff --git a/node_modules/npm/node_modules/tar/lib/path-reservations.js b/node_modules/npm/node_modules/tar/lib/path-reservations.js new file mode 100644 index 00000000..8d349d58 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/path-reservations.js @@ -0,0 +1,156 @@ +// A path exclusive reservation system +// reserve([list, of, paths], fn) +// When the fn is first in line for all its paths, it +// is called with a cb that clears the reservation. +// +// Used by async unpack to avoid clobbering paths in use, +// while still allowing maximal safe parallelization. + +const assert = require('assert') +const normalize = require('./normalize-unicode.js') +const stripSlashes = require('./strip-trailing-slashes.js') +const { join } = require('path') + +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform +const isWindows = platform === 'win32' + +module.exports = () => { + // path => [function or Set] + // A Set object means a directory reservation + // A fn is a direct reservation on that path + const queues = new Map() + + // fn => {paths:[path,...], dirs:[path, ...]} + const reservations = new Map() + + // return a set of parent dirs for a given path + // '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d'] + const getDirs = path => { + const dirs = path.split('/').slice(0, -1).reduce((set, path) => { + if (set.length) { + path = join(set[set.length - 1], path) + } + set.push(path || '/') + return set + }, []) + return dirs + } + + // functions currently running + const running = new Set() + + // return the queues for each path the function cares about + // fn => {paths, dirs} + const getQueues = fn => { + const res = reservations.get(fn) + /* istanbul ignore if - unpossible */ + if (!res) { + throw new Error('function does not have any path reservations') + } + return { + paths: res.paths.map(path => queues.get(path)), + dirs: [...res.dirs].map(path => queues.get(path)), + } + } + + // check if fn is first in line for all its paths, and is + // included in the first set for all its dir queues + const check = fn => { + const { paths, dirs } = getQueues(fn) + return paths.every(q => q[0] === fn) && + dirs.every(q => q[0] instanceof Set && q[0].has(fn)) + } + + // run the function if it's first in line and not already running + const run = fn => { + if (running.has(fn) || !check(fn)) { + return false + } + running.add(fn) + fn(() => clear(fn)) + return true + } + + const clear = fn => { + if (!running.has(fn)) { + return false + } + + const { paths, dirs } = reservations.get(fn) + const next = new Set() + + paths.forEach(path => { + const q = queues.get(path) + assert.equal(q[0], fn) + if (q.length === 1) { + queues.delete(path) + } else { + q.shift() + if (typeof q[0] === 'function') { + next.add(q[0]) + } else { + q[0].forEach(fn => next.add(fn)) + } + } + }) + + dirs.forEach(dir => { + const q = queues.get(dir) + assert(q[0] instanceof Set) + if (q[0].size === 1 && q.length === 1) { + queues.delete(dir) + } else if (q[0].size === 1) { + q.shift() + + // must be a function or else the Set would've been reused + next.add(q[0]) + } else { + q[0].delete(fn) + } + }) + running.delete(fn) + + next.forEach(fn => run(fn)) + return true + } + + const reserve = (paths, fn) => { + // collide on matches across case and unicode normalization + // On windows, thanks to the magic of 8.3 shortnames, it is fundamentally + // impossible to determine whether two paths refer to the same thing on + // disk, without asking the kernel for a shortname. + // So, we just pretend that every path matches every other path here, + // effectively removing all parallelization on windows. + paths = isWindows ? ['win32 parallelization disabled'] : paths.map(p => { + // don't need normPath, because we skip this entirely for windows + return stripSlashes(join(normalize(p))).toLowerCase() + }) + + const dirs = new Set( + paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b)) + ) + reservations.set(fn, { dirs, paths }) + paths.forEach(path => { + const q = queues.get(path) + if (!q) { + queues.set(path, [fn]) + } else { + q.push(fn) + } + }) + dirs.forEach(dir => { + const q = queues.get(dir) + if (!q) { + queues.set(dir, [new Set([fn])]) + } else if (q[q.length - 1] instanceof Set) { + q[q.length - 1].add(fn) + } else { + q.push(new Set([fn])) + } + }) + + return run(fn) + } + + return { check, reserve } +} diff --git a/node_modules/npm/node_modules/tar/lib/pax.js b/node_modules/npm/node_modules/tar/lib/pax.js new file mode 100644 index 00000000..4a7ca853 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/pax.js @@ -0,0 +1,150 @@ +'use strict' +const Header = require('./header.js') +const path = require('path') + +class Pax { + constructor (obj, global) { + this.atime = obj.atime || null + this.charset = obj.charset || null + this.comment = obj.comment || null + this.ctime = obj.ctime || null + this.gid = obj.gid || null + this.gname = obj.gname || null + this.linkpath = obj.linkpath || null + this.mtime = obj.mtime || null + this.path = obj.path || null + this.size = obj.size || null + this.uid = obj.uid || null + this.uname = obj.uname || null + this.dev = obj.dev || null + this.ino = obj.ino || null + this.nlink = obj.nlink || null + this.global = global || false + } + + encode () { + const body = this.encodeBody() + if (body === '') { + return null + } + + const bodyLen = Buffer.byteLength(body) + // round up to 512 bytes + // add 512 for header + const bufLen = 512 * Math.ceil(1 + bodyLen / 512) + const buf = Buffer.allocUnsafe(bufLen) + + // 0-fill the header section, it might not hit every field + for (let i = 0; i < 512; i++) { + buf[i] = 0 + } + + new Header({ + // XXX split the path + // then the path should be PaxHeader + basename, but less than 99, + // prepend with the dirname + path: ('PaxHeader/' + path.basename(this.path)).slice(0, 99), + mode: this.mode || 0o644, + uid: this.uid || null, + gid: this.gid || null, + size: bodyLen, + mtime: this.mtime || null, + type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader', + linkpath: '', + uname: this.uname || '', + gname: this.gname || '', + devmaj: 0, + devmin: 0, + atime: this.atime || null, + ctime: this.ctime || null, + }).encode(buf) + + buf.write(body, 512, bodyLen, 'utf8') + + // null pad after the body + for (let i = bodyLen + 512; i < buf.length; i++) { + buf[i] = 0 + } + + return buf + } + + encodeBody () { + return ( + this.encodeField('path') + + this.encodeField('ctime') + + this.encodeField('atime') + + this.encodeField('dev') + + this.encodeField('ino') + + this.encodeField('nlink') + + this.encodeField('charset') + + this.encodeField('comment') + + this.encodeField('gid') + + this.encodeField('gname') + + this.encodeField('linkpath') + + this.encodeField('mtime') + + this.encodeField('size') + + this.encodeField('uid') + + this.encodeField('uname') + ) + } + + encodeField (field) { + if (this[field] === null || this[field] === undefined) { + return '' + } + const v = this[field] instanceof Date ? this[field].getTime() / 1000 + : this[field] + const s = ' ' + + (field === 'dev' || field === 'ino' || field === 'nlink' + ? 'SCHILY.' : '') + + field + '=' + v + '\n' + const byteLen = Buffer.byteLength(s) + // the digits includes the length of the digits in ascii base-10 + // so if it's 9 characters, then adding 1 for the 9 makes it 10 + // which makes it 11 chars. + let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1 + if (byteLen + digits >= Math.pow(10, digits)) { + digits += 1 + } + const len = digits + byteLen + return len + s + } +} + +Pax.parse = (string, ex, g) => new Pax(merge(parseKV(string), ex), g) + +const merge = (a, b) => + b ? Object.keys(a).reduce((s, k) => (s[k] = a[k], s), b) : a + +const parseKV = string => + string + .replace(/\n$/, '') + .split('\n') + .reduce(parseKVLine, Object.create(null)) + +const parseKVLine = (set, line) => { + const n = parseInt(line, 10) + + // XXX Values with \n in them will fail this. + // Refactor to not be a naive line-by-line parse. + if (n !== Buffer.byteLength(line) + 1) { + return set + } + + line = line.slice((n + ' ').length) + const kv = line.split('=') + const k = kv.shift().replace(/^SCHILY\.(dev|ino|nlink)/, '$1') + if (!k) { + return set + } + + const v = kv.join('=') + set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) + ? new Date(v * 1000) + : /^[0-9]+$/.test(v) ? +v + : v + return set +} + +module.exports = Pax diff --git a/node_modules/npm/node_modules/tar/lib/read-entry.js b/node_modules/npm/node_modules/tar/lib/read-entry.js new file mode 100644 index 00000000..6186266e --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/read-entry.js @@ -0,0 +1,107 @@ +'use strict' +const { Minipass } = require('minipass') +const normPath = require('./normalize-windows-path.js') + +const SLURP = Symbol('slurp') +module.exports = class ReadEntry extends Minipass { + constructor (header, ex, gex) { + super() + // read entries always start life paused. this is to avoid the + // situation where Minipass's auto-ending empty streams results + // in an entry ending before we're ready for it. + this.pause() + this.extended = ex + this.globalExtended = gex + this.header = header + this.startBlockSize = 512 * Math.ceil(header.size / 512) + this.blockRemain = this.startBlockSize + this.remain = header.size + this.type = header.type + this.meta = false + this.ignore = false + switch (this.type) { + case 'File': + case 'OldFile': + case 'Link': + case 'SymbolicLink': + case 'CharacterDevice': + case 'BlockDevice': + case 'Directory': + case 'FIFO': + case 'ContiguousFile': + case 'GNUDumpDir': + break + + case 'NextFileHasLongLinkpath': + case 'NextFileHasLongPath': + case 'OldGnuLongPath': + case 'GlobalExtendedHeader': + case 'ExtendedHeader': + case 'OldExtendedHeader': + this.meta = true + break + + // NOTE: gnutar and bsdtar treat unrecognized types as 'File' + // it may be worth doing the same, but with a warning. + default: + this.ignore = true + } + + this.path = normPath(header.path) + this.mode = header.mode + if (this.mode) { + this.mode = this.mode & 0o7777 + } + this.uid = header.uid + this.gid = header.gid + this.uname = header.uname + this.gname = header.gname + this.size = header.size + this.mtime = header.mtime + this.atime = header.atime + this.ctime = header.ctime + this.linkpath = normPath(header.linkpath) + this.uname = header.uname + this.gname = header.gname + + if (ex) { + this[SLURP](ex) + } + if (gex) { + this[SLURP](gex, true) + } + } + + write (data) { + const writeLen = data.length + if (writeLen > this.blockRemain) { + throw new Error('writing more to entry than is appropriate') + } + + const r = this.remain + const br = this.blockRemain + this.remain = Math.max(0, r - writeLen) + this.blockRemain = Math.max(0, br - writeLen) + if (this.ignore) { + return true + } + + if (r >= writeLen) { + return super.write(data) + } + + // r < writeLen + return super.write(data.slice(0, r)) + } + + [SLURP] (ex, global) { + for (const k in ex) { + // we slurp in everything except for the path attribute in + // a global extended header, because that's weird. + if (ex[k] !== null && ex[k] !== undefined && + !(global && k === 'path')) { + this[k] = k === 'path' || k === 'linkpath' ? normPath(ex[k]) : ex[k] + } + } + } +} diff --git a/node_modules/npm/node_modules/tar/lib/replace.js b/node_modules/npm/node_modules/tar/lib/replace.js new file mode 100644 index 00000000..8db6800b --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/replace.js @@ -0,0 +1,246 @@ +'use strict' + +// tar -r +const hlo = require('./high-level-opt.js') +const Pack = require('./pack.js') +const fs = require('fs') +const fsm = require('fs-minipass') +const t = require('./list.js') +const path = require('path') + +// starting at the head of the file, read a Header +// If the checksum is invalid, that's our position to start writing +// If it is, jump forward by the specified size (round up to 512) +// and try again. +// Write the new Pack stream starting there. + +const Header = require('./header.js') + +module.exports = (opt_, files, cb) => { + const opt = hlo(opt_) + + if (!opt.file) { + throw new TypeError('file is required') + } + + if (opt.gzip || opt.brotli || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) { + throw new TypeError('cannot append to compressed archives') + } + + if (!files || !Array.isArray(files) || !files.length) { + throw new TypeError('no files or directories specified') + } + + files = Array.from(files) + + return opt.sync ? replaceSync(opt, files) + : replace(opt, files, cb) +} + +const replaceSync = (opt, files) => { + const p = new Pack.Sync(opt) + + let threw = true + let fd + let position + + try { + try { + fd = fs.openSync(opt.file, 'r+') + } catch (er) { + if (er.code === 'ENOENT') { + fd = fs.openSync(opt.file, 'w+') + } else { + throw er + } + } + + const st = fs.fstatSync(fd) + const headBuf = Buffer.alloc(512) + + POSITION: for (position = 0; position < st.size; position += 512) { + for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { + bytes = fs.readSync( + fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos + ) + + if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) { + throw new Error('cannot append to compressed archives') + } + + if (!bytes) { + break POSITION + } + } + + const h = new Header(headBuf) + if (!h.cksumValid) { + break + } + const entryBlockSize = 512 * Math.ceil(h.size / 512) + if (position + entryBlockSize + 512 > st.size) { + break + } + // the 512 for the header we just parsed will be added as well + // also jump ahead all the blocks for the body + position += entryBlockSize + if (opt.mtimeCache) { + opt.mtimeCache.set(h.path, h.mtime) + } + } + threw = false + + streamSync(opt, p, position, fd, files) + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } + } +} + +const streamSync = (opt, p, position, fd, files) => { + const stream = new fsm.WriteStreamSync(opt.file, { + fd: fd, + start: position, + }) + p.pipe(stream) + addFilesSync(p, files) +} + +const replace = (opt, files, cb) => { + files = Array.from(files) + const p = new Pack(opt) + + const getPos = (fd, size, cb_) => { + const cb = (er, pos) => { + if (er) { + fs.close(fd, _ => cb_(er)) + } else { + cb_(null, pos) + } + } + + let position = 0 + if (size === 0) { + return cb(null, 0) + } + + let bufPos = 0 + const headBuf = Buffer.alloc(512) + const onread = (er, bytes) => { + if (er) { + return cb(er) + } + bufPos += bytes + if (bufPos < 512 && bytes) { + return fs.read( + fd, headBuf, bufPos, headBuf.length - bufPos, + position + bufPos, onread + ) + } + + if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) { + return cb(new Error('cannot append to compressed archives')) + } + + // truncated header + if (bufPos < 512) { + return cb(null, position) + } + + const h = new Header(headBuf) + if (!h.cksumValid) { + return cb(null, position) + } + + const entryBlockSize = 512 * Math.ceil(h.size / 512) + if (position + entryBlockSize + 512 > size) { + return cb(null, position) + } + + position += entryBlockSize + 512 + if (position >= size) { + return cb(null, position) + } + + if (opt.mtimeCache) { + opt.mtimeCache.set(h.path, h.mtime) + } + bufPos = 0 + fs.read(fd, headBuf, 0, 512, position, onread) + } + fs.read(fd, headBuf, 0, 512, position, onread) + } + + const promise = new Promise((resolve, reject) => { + p.on('error', reject) + let flag = 'r+' + const onopen = (er, fd) => { + if (er && er.code === 'ENOENT' && flag === 'r+') { + flag = 'w+' + return fs.open(opt.file, flag, onopen) + } + + if (er) { + return reject(er) + } + + fs.fstat(fd, (er, st) => { + if (er) { + return fs.close(fd, () => reject(er)) + } + + getPos(fd, st.size, (er, position) => { + if (er) { + return reject(er) + } + const stream = new fsm.WriteStream(opt.file, { + fd: fd, + start: position, + }) + p.pipe(stream) + stream.on('error', reject) + stream.on('close', resolve) + addFilesAsync(p, files) + }) + }) + } + fs.open(opt.file, flag, onopen) + }) + + return cb ? promise.then(cb, cb) : promise +} + +const addFilesSync = (p, files) => { + files.forEach(file => { + if (file.charAt(0) === '@') { + t({ + file: path.resolve(p.cwd, file.slice(1)), + sync: true, + noResume: true, + onentry: entry => p.add(entry), + }) + } else { + p.add(file) + } + }) + p.end() +} + +const addFilesAsync = (p, files) => { + while (files.length) { + const file = files.shift() + if (file.charAt(0) === '@') { + return t({ + file: path.resolve(p.cwd, file.slice(1)), + noResume: true, + onentry: entry => p.add(entry), + }).then(_ => addFilesAsync(p, files)) + } else { + p.add(file) + } + } + p.end() +} diff --git a/node_modules/npm/node_modules/tar/lib/strip-absolute-path.js b/node_modules/npm/node_modules/tar/lib/strip-absolute-path.js new file mode 100644 index 00000000..185e2dea --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/strip-absolute-path.js @@ -0,0 +1,24 @@ +// unix absolute paths are also absolute on win32, so we use this for both +const { isAbsolute, parse } = require('path').win32 + +// returns [root, stripped] +// Note that windows will think that //x/y/z/a has a "root" of //x/y, and in +// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip / +// explicitly if it's the first character. +// drive-specific relative paths on Windows get their root stripped off even +// though they are not absolute, so `c:../foo` becomes ['c:', '../foo'] +module.exports = path => { + let r = '' + + let parsed = parse(path) + while (isAbsolute(path) || parsed.root) { + // windows will think that //x/y/z has a "root" of //x/y/ + // but strip the //?/C:/ off of //?/C:/path + const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ? '/' + : parsed.root + path = path.slice(root.length) + r += root + parsed = parse(path) + } + return [r, path] +} diff --git a/node_modules/npm/node_modules/tar/lib/strip-trailing-slashes.js b/node_modules/npm/node_modules/tar/lib/strip-trailing-slashes.js new file mode 100644 index 00000000..3e3ecec5 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/strip-trailing-slashes.js @@ -0,0 +1,13 @@ +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +module.exports = str => { + let i = str.length - 1 + let slashesStart = -1 + while (i > -1 && str.charAt(i) === '/') { + slashesStart = i + i-- + } + return slashesStart === -1 ? str : str.slice(0, slashesStart) +} diff --git a/node_modules/npm/node_modules/tar/lib/types.js b/node_modules/npm/node_modules/tar/lib/types.js new file mode 100644 index 00000000..7bfc2546 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/types.js @@ -0,0 +1,44 @@ +'use strict' +// map types from key to human-friendly name +exports.name = new Map([ + ['0', 'File'], + // same as File + ['', 'OldFile'], + ['1', 'Link'], + ['2', 'SymbolicLink'], + // Devices and FIFOs aren't fully supported + // they are parsed, but skipped when unpacking + ['3', 'CharacterDevice'], + ['4', 'BlockDevice'], + ['5', 'Directory'], + ['6', 'FIFO'], + // same as File + ['7', 'ContiguousFile'], + // pax headers + ['g', 'GlobalExtendedHeader'], + ['x', 'ExtendedHeader'], + // vendor-specific stuff + // skip + ['A', 'SolarisACL'], + // like 5, but with data, which should be skipped + ['D', 'GNUDumpDir'], + // metadata only, skip + ['I', 'Inode'], + // data = link path of next file + ['K', 'NextFileHasLongLinkpath'], + // data = path of next file + ['L', 'NextFileHasLongPath'], + // skip + ['M', 'ContinuationFile'], + // like L + ['N', 'OldGnuLongPath'], + // skip + ['S', 'SparseFile'], + // skip + ['V', 'TapeVolumeHeader'], + // like x + ['X', 'OldExtendedHeader'], +]) + +// map the other direction +exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]])) diff --git a/node_modules/npm/node_modules/tar/lib/unpack.js b/node_modules/npm/node_modules/tar/lib/unpack.js new file mode 100644 index 00000000..03172e2c --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/unpack.js @@ -0,0 +1,923 @@ +'use strict' + +// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet. +// but the path reservations are required to avoid race conditions where +// parallelized unpack ops may mess with one another, due to dependencies +// (like a Link depending on its target) or destructive operations (like +// clobbering an fs object to create one of a different type.) + +const assert = require('assert') +const Parser = require('./parse.js') +const fs = require('fs') +const fsm = require('fs-minipass') +const path = require('path') +const mkdir = require('./mkdir.js') +const wc = require('./winchars.js') +const pathReservations = require('./path-reservations.js') +const stripAbsolutePath = require('./strip-absolute-path.js') +const normPath = require('./normalize-windows-path.js') +const stripSlash = require('./strip-trailing-slashes.js') +const normalize = require('./normalize-unicode.js') + +const ONENTRY = Symbol('onEntry') +const CHECKFS = Symbol('checkFs') +const CHECKFS2 = Symbol('checkFs2') +const PRUNECACHE = Symbol('pruneCache') +const ISREUSABLE = Symbol('isReusable') +const MAKEFS = Symbol('makeFs') +const FILE = Symbol('file') +const DIRECTORY = Symbol('directory') +const LINK = Symbol('link') +const SYMLINK = Symbol('symlink') +const HARDLINK = Symbol('hardlink') +const UNSUPPORTED = Symbol('unsupported') +const CHECKPATH = Symbol('checkPath') +const MKDIR = Symbol('mkdir') +const ONERROR = Symbol('onError') +const PENDING = Symbol('pending') +const PEND = Symbol('pend') +const UNPEND = Symbol('unpend') +const ENDED = Symbol('ended') +const MAYBECLOSE = Symbol('maybeClose') +const SKIP = Symbol('skip') +const DOCHOWN = Symbol('doChown') +const UID = Symbol('uid') +const GID = Symbol('gid') +const CHECKED_CWD = Symbol('checkedCwd') +const crypto = require('crypto') +const getFlag = require('./get-write-flag.js') +const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform +const isWindows = platform === 'win32' +const DEFAULT_MAX_DEPTH = 1024 + +// Unlinks on Windows are not atomic. +// +// This means that if you have a file entry, followed by another +// file entry with an identical name, and you cannot re-use the file +// (because it's a hardlink, or because unlink:true is set, or it's +// Windows, which does not have useful nlink values), then the unlink +// will be committed to the disk AFTER the new file has been written +// over the old one, deleting the new file. +// +// To work around this, on Windows systems, we rename the file and then +// delete the renamed file. It's a sloppy kludge, but frankly, I do not +// know of a better way to do this, given windows' non-atomic unlink +// semantics. +// +// See: https://github.com/npm/node-tar/issues/183 +/* istanbul ignore next */ +const unlinkFile = (path, cb) => { + if (!isWindows) { + return fs.unlink(path, cb) + } + + const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex') + fs.rename(path, name, er => { + if (er) { + return cb(er) + } + fs.unlink(name, cb) + }) +} + +/* istanbul ignore next */ +const unlinkFileSync = path => { + if (!isWindows) { + return fs.unlinkSync(path) + } + + const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex') + fs.renameSync(path, name) + fs.unlinkSync(name) +} + +// this.gid, entry.gid, this.processUid +const uint32 = (a, b, c) => + a === a >>> 0 ? a + : b === b >>> 0 ? b + : c + +// clear the cache if it's a case-insensitive unicode-squashing match. +// we can't know if the current file system is case-sensitive or supports +// unicode fully, so we check for similarity on the maximally compatible +// representation. Err on the side of pruning, since all it's doing is +// preventing lstats, and it's not the end of the world if we get a false +// positive. +// Note that on windows, we always drop the entire cache whenever a +// symbolic link is encountered, because 8.3 filenames are impossible +// to reason about, and collisions are hazards rather than just failures. +const cacheKeyNormalize = path => stripSlash(normPath(normalize(path))) + .toLowerCase() + +const pruneCache = (cache, abs) => { + abs = cacheKeyNormalize(abs) + for (const path of cache.keys()) { + const pnorm = cacheKeyNormalize(path) + if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) { + cache.delete(path) + } + } +} + +const dropCache = cache => { + for (const key of cache.keys()) { + cache.delete(key) + } +} + +class Unpack extends Parser { + constructor (opt) { + if (!opt) { + opt = {} + } + + opt.ondone = _ => { + this[ENDED] = true + this[MAYBECLOSE]() + } + + super(opt) + + this[CHECKED_CWD] = false + + this.reservations = pathReservations() + + this.transform = typeof opt.transform === 'function' ? opt.transform : null + + this.writable = true + this.readable = false + + this[PENDING] = 0 + this[ENDED] = false + + this.dirCache = opt.dirCache || new Map() + + if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { + // need both or neither + if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number') { + throw new TypeError('cannot set owner without number uid and gid') + } + if (opt.preserveOwner) { + throw new TypeError( + 'cannot preserve owner in archive and also set owner explicitly') + } + this.uid = opt.uid + this.gid = opt.gid + this.setOwner = true + } else { + this.uid = null + this.gid = null + this.setOwner = false + } + + // default true for root + if (opt.preserveOwner === undefined && typeof opt.uid !== 'number') { + this.preserveOwner = process.getuid && process.getuid() === 0 + } else { + this.preserveOwner = !!opt.preserveOwner + } + + this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? + process.getuid() : null + this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? + process.getgid() : null + + // prevent excessively deep nesting of subfolders + // set to `Infinity` to remove this restriction + this.maxDepth = typeof opt.maxDepth === 'number' + ? opt.maxDepth + : DEFAULT_MAX_DEPTH + + // mostly just for testing, but useful in some cases. + // Forcibly trigger a chown on every entry, no matter what + this.forceChown = opt.forceChown === true + + // turn > this[ONENTRY](entry)) + } + + // a bad or damaged archive is a warning for Parser, but an error + // when extracting. Mark those errors as unrecoverable, because + // the Unpack contract cannot be met. + warn (code, msg, data = {}) { + if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') { + data.recoverable = false + } + return super.warn(code, msg, data) + } + + [MAYBECLOSE] () { + if (this[ENDED] && this[PENDING] === 0) { + this.emit('prefinish') + this.emit('finish') + this.emit('end') + } + } + + [CHECKPATH] (entry) { + const p = normPath(entry.path) + const parts = p.split('/') + + if (this.strip) { + if (parts.length < this.strip) { + return false + } + if (entry.type === 'Link') { + const linkparts = normPath(entry.linkpath).split('/') + if (linkparts.length >= this.strip) { + entry.linkpath = linkparts.slice(this.strip).join('/') + } else { + return false + } + } + parts.splice(0, this.strip) + entry.path = parts.join('/') + } + + if (isFinite(this.maxDepth) && parts.length > this.maxDepth) { + this.warn('TAR_ENTRY_ERROR', 'path excessively deep', { + entry, + path: p, + depth: parts.length, + maxDepth: this.maxDepth, + }) + return false + } + + if (!this.preservePaths) { + if (parts.includes('..') || isWindows && /^[a-z]:\.\.$/i.test(parts[0])) { + this.warn('TAR_ENTRY_ERROR', `path contains '..'`, { + entry, + path: p, + }) + return false + } + + // strip off the root + const [root, stripped] = stripAbsolutePath(p) + if (root) { + entry.path = stripped + this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, { + entry, + path: p, + }) + } + } + + if (path.isAbsolute(entry.path)) { + entry.absolute = normPath(path.resolve(entry.path)) + } else { + entry.absolute = normPath(path.resolve(this.cwd, entry.path)) + } + + // if we somehow ended up with a path that escapes the cwd, and we are + // not in preservePaths mode, then something is fishy! This should have + // been prevented above, so ignore this for coverage. + /* istanbul ignore if - defense in depth */ + if (!this.preservePaths && + entry.absolute.indexOf(this.cwd + '/') !== 0 && + entry.absolute !== this.cwd) { + this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', { + entry, + path: normPath(entry.path), + resolvedPath: entry.absolute, + cwd: this.cwd, + }) + return false + } + + // an archive can set properties on the extraction directory, but it + // may not replace the cwd with a different kind of thing entirely. + if (entry.absolute === this.cwd && + entry.type !== 'Directory' && + entry.type !== 'GNUDumpDir') { + return false + } + + // only encode : chars that aren't drive letter indicators + if (this.win32) { + const { root: aRoot } = path.win32.parse(entry.absolute) + entry.absolute = aRoot + wc.encode(entry.absolute.slice(aRoot.length)) + const { root: pRoot } = path.win32.parse(entry.path) + entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length)) + } + + return true + } + + [ONENTRY] (entry) { + if (!this[CHECKPATH](entry)) { + return entry.resume() + } + + assert.equal(typeof entry.absolute, 'string') + + switch (entry.type) { + case 'Directory': + case 'GNUDumpDir': + if (entry.mode) { + entry.mode = entry.mode | 0o700 + } + + // eslint-disable-next-line no-fallthrough + case 'File': + case 'OldFile': + case 'ContiguousFile': + case 'Link': + case 'SymbolicLink': + return this[CHECKFS](entry) + + case 'CharacterDevice': + case 'BlockDevice': + case 'FIFO': + default: + return this[UNSUPPORTED](entry) + } + } + + [ONERROR] (er, entry) { + // Cwd has to exist, or else nothing works. That's serious. + // Other errors are warnings, which raise the error in strict + // mode, but otherwise continue on. + if (er.name === 'CwdError') { + this.emit('error', er) + } else { + this.warn('TAR_ENTRY_ERROR', er, { entry }) + this[UNPEND]() + entry.resume() + } + } + + [MKDIR] (dir, mode, cb) { + mkdir(normPath(dir), { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cache: this.dirCache, + cwd: this.cwd, + mode: mode, + noChmod: this.noChmod, + }, cb) + } + + [DOCHOWN] (entry) { + // in preserve owner mode, chown if the entry doesn't match process + // in set owner mode, chown if setting doesn't match process + return this.forceChown || + this.preserveOwner && + (typeof entry.uid === 'number' && entry.uid !== this.processUid || + typeof entry.gid === 'number' && entry.gid !== this.processGid) + || + (typeof this.uid === 'number' && this.uid !== this.processUid || + typeof this.gid === 'number' && this.gid !== this.processGid) + } + + [UID] (entry) { + return uint32(this.uid, entry.uid, this.processUid) + } + + [GID] (entry) { + return uint32(this.gid, entry.gid, this.processGid) + } + + [FILE] (entry, fullyDone) { + const mode = entry.mode & 0o7777 || this.fmode + const stream = new fsm.WriteStream(entry.absolute, { + flags: getFlag(entry.size), + mode: mode, + autoClose: false, + }) + stream.on('error', er => { + if (stream.fd) { + fs.close(stream.fd, () => {}) + } + + // flush all the data out so that we aren't left hanging + // if the error wasn't actually fatal. otherwise the parse + // is blocked, and we never proceed. + stream.write = () => true + this[ONERROR](er, entry) + fullyDone() + }) + + let actions = 1 + const done = er => { + if (er) { + /* istanbul ignore else - we should always have a fd by now */ + if (stream.fd) { + fs.close(stream.fd, () => {}) + } + + this[ONERROR](er, entry) + fullyDone() + return + } + + if (--actions === 0) { + fs.close(stream.fd, er => { + if (er) { + this[ONERROR](er, entry) + } else { + this[UNPEND]() + } + fullyDone() + }) + } + } + + stream.on('finish', _ => { + // if futimes fails, try utimes + // if utimes fails, fail with the original error + // same for fchown/chown + const abs = entry.absolute + const fd = stream.fd + + if (entry.mtime && !this.noMtime) { + actions++ + const atime = entry.atime || new Date() + const mtime = entry.mtime + fs.futimes(fd, atime, mtime, er => + er ? fs.utimes(abs, atime, mtime, er2 => done(er2 && er)) + : done()) + } + + if (this[DOCHOWN](entry)) { + actions++ + const uid = this[UID](entry) + const gid = this[GID](entry) + fs.fchown(fd, uid, gid, er => + er ? fs.chown(abs, uid, gid, er2 => done(er2 && er)) + : done()) + } + + done() + }) + + const tx = this.transform ? this.transform(entry) || entry : entry + if (tx !== entry) { + tx.on('error', er => { + this[ONERROR](er, entry) + fullyDone() + }) + entry.pipe(tx) + } + tx.pipe(stream) + } + + [DIRECTORY] (entry, fullyDone) { + const mode = entry.mode & 0o7777 || this.dmode + this[MKDIR](entry.absolute, mode, er => { + if (er) { + this[ONERROR](er, entry) + fullyDone() + return + } + + let actions = 1 + const done = _ => { + if (--actions === 0) { + fullyDone() + this[UNPEND]() + entry.resume() + } + } + + if (entry.mtime && !this.noMtime) { + actions++ + fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, done) + } + + if (this[DOCHOWN](entry)) { + actions++ + fs.chown(entry.absolute, this[UID](entry), this[GID](entry), done) + } + + done() + }) + } + + [UNSUPPORTED] (entry) { + entry.unsupported = true + this.warn('TAR_ENTRY_UNSUPPORTED', + `unsupported entry type: ${entry.type}`, { entry }) + entry.resume() + } + + [SYMLINK] (entry, done) { + this[LINK](entry, entry.linkpath, 'symlink', done) + } + + [HARDLINK] (entry, done) { + const linkpath = normPath(path.resolve(this.cwd, entry.linkpath)) + this[LINK](entry, linkpath, 'link', done) + } + + [PEND] () { + this[PENDING]++ + } + + [UNPEND] () { + this[PENDING]-- + this[MAYBECLOSE]() + } + + [SKIP] (entry) { + this[UNPEND]() + entry.resume() + } + + // Check if we can reuse an existing filesystem entry safely and + // overwrite it, rather than unlinking and recreating + // Windows doesn't report a useful nlink, so we just never reuse entries + [ISREUSABLE] (entry, st) { + return entry.type === 'File' && + !this.unlink && + st.isFile() && + st.nlink <= 1 && + !isWindows + } + + // check if a thing is there, and if so, try to clobber it + [CHECKFS] (entry) { + this[PEND]() + const paths = [entry.path] + if (entry.linkpath) { + paths.push(entry.linkpath) + } + this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)) + } + + [PRUNECACHE] (entry) { + // if we are not creating a directory, and the path is in the dirCache, + // then that means we are about to delete the directory we created + // previously, and it is no longer going to be a directory, and neither + // is any of its children. + // If a symbolic link is encountered, all bets are off. There is no + // reasonable way to sanitize the cache in such a way we will be able to + // avoid having filesystem collisions. If this happens with a non-symlink + // entry, it'll just fail to unpack, but a symlink to a directory, using an + // 8.3 shortname or certain unicode attacks, can evade detection and lead + // to arbitrary writes to anywhere on the system. + if (entry.type === 'SymbolicLink') { + dropCache(this.dirCache) + } else if (entry.type !== 'Directory') { + pruneCache(this.dirCache, entry.absolute) + } + } + + [CHECKFS2] (entry, fullyDone) { + this[PRUNECACHE](entry) + + const done = er => { + this[PRUNECACHE](entry) + fullyDone(er) + } + + const checkCwd = () => { + this[MKDIR](this.cwd, this.dmode, er => { + if (er) { + this[ONERROR](er, entry) + done() + return + } + this[CHECKED_CWD] = true + start() + }) + } + + const start = () => { + if (entry.absolute !== this.cwd) { + const parent = normPath(path.dirname(entry.absolute)) + if (parent !== this.cwd) { + return this[MKDIR](parent, this.dmode, er => { + if (er) { + this[ONERROR](er, entry) + done() + return + } + afterMakeParent() + }) + } + } + afterMakeParent() + } + + const afterMakeParent = () => { + fs.lstat(entry.absolute, (lstatEr, st) => { + if (st && (this.keep || this.newer && st.mtime > entry.mtime)) { + this[SKIP](entry) + done() + return + } + if (lstatEr || this[ISREUSABLE](entry, st)) { + return this[MAKEFS](null, entry, done) + } + + if (st.isDirectory()) { + if (entry.type === 'Directory') { + const needChmod = !this.noChmod && + entry.mode && + (st.mode & 0o7777) !== entry.mode + const afterChmod = er => this[MAKEFS](er, entry, done) + if (!needChmod) { + return afterChmod() + } + return fs.chmod(entry.absolute, entry.mode, afterChmod) + } + // Not a dir entry, have to remove it. + // NB: the only way to end up with an entry that is the cwd + // itself, in such a way that == does not detect, is a + // tricky windows absolute path with UNC or 8.3 parts (and + // preservePaths:true, or else it will have been stripped). + // In that case, the user has opted out of path protections + // explicitly, so if they blow away the cwd, c'est la vie. + if (entry.absolute !== this.cwd) { + return fs.rmdir(entry.absolute, er => + this[MAKEFS](er, entry, done)) + } + } + + // not a dir, and not reusable + // don't remove if the cwd, we want that error + if (entry.absolute === this.cwd) { + return this[MAKEFS](null, entry, done) + } + + unlinkFile(entry.absolute, er => + this[MAKEFS](er, entry, done)) + }) + } + + if (this[CHECKED_CWD]) { + start() + } else { + checkCwd() + } + } + + [MAKEFS] (er, entry, done) { + if (er) { + this[ONERROR](er, entry) + done() + return + } + + switch (entry.type) { + case 'File': + case 'OldFile': + case 'ContiguousFile': + return this[FILE](entry, done) + + case 'Link': + return this[HARDLINK](entry, done) + + case 'SymbolicLink': + return this[SYMLINK](entry, done) + + case 'Directory': + case 'GNUDumpDir': + return this[DIRECTORY](entry, done) + } + } + + [LINK] (entry, linkpath, link, done) { + // XXX: get the type ('symlink' or 'junction') for windows + fs[link](linkpath, entry.absolute, er => { + if (er) { + this[ONERROR](er, entry) + } else { + this[UNPEND]() + entry.resume() + } + done() + }) + } +} + +const callSync = fn => { + try { + return [null, fn()] + } catch (er) { + return [er, null] + } +} +class UnpackSync extends Unpack { + [MAKEFS] (er, entry) { + return super[MAKEFS](er, entry, () => {}) + } + + [CHECKFS] (entry) { + this[PRUNECACHE](entry) + + if (!this[CHECKED_CWD]) { + const er = this[MKDIR](this.cwd, this.dmode) + if (er) { + return this[ONERROR](er, entry) + } + this[CHECKED_CWD] = true + } + + // don't bother to make the parent if the current entry is the cwd, + // we've already checked it. + if (entry.absolute !== this.cwd) { + const parent = normPath(path.dirname(entry.absolute)) + if (parent !== this.cwd) { + const mkParent = this[MKDIR](parent, this.dmode) + if (mkParent) { + return this[ONERROR](mkParent, entry) + } + } + } + + const [lstatEr, st] = callSync(() => fs.lstatSync(entry.absolute)) + if (st && (this.keep || this.newer && st.mtime > entry.mtime)) { + return this[SKIP](entry) + } + + if (lstatEr || this[ISREUSABLE](entry, st)) { + return this[MAKEFS](null, entry) + } + + if (st.isDirectory()) { + if (entry.type === 'Directory') { + const needChmod = !this.noChmod && + entry.mode && + (st.mode & 0o7777) !== entry.mode + const [er] = needChmod ? callSync(() => { + fs.chmodSync(entry.absolute, entry.mode) + }) : [] + return this[MAKEFS](er, entry) + } + // not a dir entry, have to remove it + const [er] = callSync(() => fs.rmdirSync(entry.absolute)) + this[MAKEFS](er, entry) + } + + // not a dir, and not reusable. + // don't remove if it's the cwd, since we want that error. + const [er] = entry.absolute === this.cwd ? [] + : callSync(() => unlinkFileSync(entry.absolute)) + this[MAKEFS](er, entry) + } + + [FILE] (entry, done) { + const mode = entry.mode & 0o7777 || this.fmode + + const oner = er => { + let closeError + try { + fs.closeSync(fd) + } catch (e) { + closeError = e + } + if (er || closeError) { + this[ONERROR](er || closeError, entry) + } + done() + } + + let fd + try { + fd = fs.openSync(entry.absolute, getFlag(entry.size), mode) + } catch (er) { + return oner(er) + } + const tx = this.transform ? this.transform(entry) || entry : entry + if (tx !== entry) { + tx.on('error', er => this[ONERROR](er, entry)) + entry.pipe(tx) + } + + tx.on('data', chunk => { + try { + fs.writeSync(fd, chunk, 0, chunk.length) + } catch (er) { + oner(er) + } + }) + + tx.on('end', _ => { + let er = null + // try both, falling futimes back to utimes + // if either fails, handle the first error + if (entry.mtime && !this.noMtime) { + const atime = entry.atime || new Date() + const mtime = entry.mtime + try { + fs.futimesSync(fd, atime, mtime) + } catch (futimeser) { + try { + fs.utimesSync(entry.absolute, atime, mtime) + } catch (utimeser) { + er = futimeser + } + } + } + + if (this[DOCHOWN](entry)) { + const uid = this[UID](entry) + const gid = this[GID](entry) + + try { + fs.fchownSync(fd, uid, gid) + } catch (fchowner) { + try { + fs.chownSync(entry.absolute, uid, gid) + } catch (chowner) { + er = er || fchowner + } + } + } + + oner(er) + }) + } + + [DIRECTORY] (entry, done) { + const mode = entry.mode & 0o7777 || this.dmode + const er = this[MKDIR](entry.absolute, mode) + if (er) { + this[ONERROR](er, entry) + done() + return + } + if (entry.mtime && !this.noMtime) { + try { + fs.utimesSync(entry.absolute, entry.atime || new Date(), entry.mtime) + } catch (er) {} + } + if (this[DOCHOWN](entry)) { + try { + fs.chownSync(entry.absolute, this[UID](entry), this[GID](entry)) + } catch (er) {} + } + done() + entry.resume() + } + + [MKDIR] (dir, mode) { + try { + return mkdir.sync(normPath(dir), { + uid: this.uid, + gid: this.gid, + processUid: this.processUid, + processGid: this.processGid, + umask: this.processUmask, + preserve: this.preservePaths, + unlink: this.unlink, + cache: this.dirCache, + cwd: this.cwd, + mode: mode, + }) + } catch (er) { + return er + } + } + + [LINK] (entry, linkpath, link, done) { + try { + fs[link + 'Sync'](linkpath, entry.absolute) + done() + entry.resume() + } catch (er) { + return this[ONERROR](er, entry) + } + } +} + +Unpack.Sync = UnpackSync +module.exports = Unpack diff --git a/node_modules/npm/node_modules/tar/lib/update.js b/node_modules/npm/node_modules/tar/lib/update.js new file mode 100644 index 00000000..4d328543 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/update.js @@ -0,0 +1,40 @@ +'use strict' + +// tar -u + +const hlo = require('./high-level-opt.js') +const r = require('./replace.js') +// just call tar.r with the filter and mtimeCache + +module.exports = (opt_, files, cb) => { + const opt = hlo(opt_) + + if (!opt.file) { + throw new TypeError('file is required') + } + + if (opt.gzip || opt.brotli || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) { + throw new TypeError('cannot append to compressed archives') + } + + if (!files || !Array.isArray(files) || !files.length) { + throw new TypeError('no files or directories specified') + } + + files = Array.from(files) + + mtimeFilter(opt) + return r(opt, files, cb) +} + +const mtimeFilter = opt => { + const filter = opt.filter + + if (!opt.mtimeCache) { + opt.mtimeCache = new Map() + } + + opt.filter = filter ? (path, stat) => + filter(path, stat) && !(opt.mtimeCache.get(path) > stat.mtime) + : (path, stat) => !(opt.mtimeCache.get(path) > stat.mtime) +} diff --git a/node_modules/npm/node_modules/tar/lib/warn-mixin.js b/node_modules/npm/node_modules/tar/lib/warn-mixin.js new file mode 100644 index 00000000..a9406396 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/warn-mixin.js @@ -0,0 +1,24 @@ +'use strict' +module.exports = Base => class extends Base { + warn (code, message, data = {}) { + if (this.file) { + data.file = this.file + } + if (this.cwd) { + data.cwd = this.cwd + } + data.code = message instanceof Error && message.code || code + data.tarCode = code + if (!this.strict && data.recoverable !== false) { + if (message instanceof Error) { + data = Object.assign(message, data) + message = message.message + } + this.emit('warn', data.tarCode, message, data) + } else if (message instanceof Error) { + this.emit('error', Object.assign(message, data)) + } else { + this.emit('error', Object.assign(new Error(`${code}: ${message}`), data)) + } + } +} diff --git a/node_modules/npm/node_modules/tar/lib/winchars.js b/node_modules/npm/node_modules/tar/lib/winchars.js new file mode 100644 index 00000000..ebcab4ae --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/winchars.js @@ -0,0 +1,23 @@ +'use strict' + +// When writing files on Windows, translate the characters to their +// 0xf000 higher-encoded versions. + +const raw = [ + '|', + '<', + '>', + '?', + ':', +] + +const win = raw.map(char => + String.fromCharCode(0xf000 + char.charCodeAt(0))) + +const toWin = new Map(raw.map((char, i) => [char, win[i]])) +const toRaw = new Map(win.map((char, i) => [char, raw[i]])) + +module.exports = { + encode: s => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s), + decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s), +} diff --git a/node_modules/npm/node_modules/tar/lib/write-entry.js b/node_modules/npm/node_modules/tar/lib/write-entry.js new file mode 100644 index 00000000..7d2f3eb1 --- /dev/null +++ b/node_modules/npm/node_modules/tar/lib/write-entry.js @@ -0,0 +1,546 @@ +'use strict' +const { Minipass } = require('minipass') +const Pax = require('./pax.js') +const Header = require('./header.js') +const fs = require('fs') +const path = require('path') +const normPath = require('./normalize-windows-path.js') +const stripSlash = require('./strip-trailing-slashes.js') + +const prefixPath = (path, prefix) => { + if (!prefix) { + return normPath(path) + } + path = normPath(path).replace(/^\.(\/|$)/, '') + return stripSlash(prefix) + '/' + path +} + +const maxReadSize = 16 * 1024 * 1024 +const PROCESS = Symbol('process') +const FILE = Symbol('file') +const DIRECTORY = Symbol('directory') +const SYMLINK = Symbol('symlink') +const HARDLINK = Symbol('hardlink') +const HEADER = Symbol('header') +const READ = Symbol('read') +const LSTAT = Symbol('lstat') +const ONLSTAT = Symbol('onlstat') +const ONREAD = Symbol('onread') +const ONREADLINK = Symbol('onreadlink') +const OPENFILE = Symbol('openfile') +const ONOPENFILE = Symbol('onopenfile') +const CLOSE = Symbol('close') +const MODE = Symbol('mode') +const AWAITDRAIN = Symbol('awaitDrain') +const ONDRAIN = Symbol('ondrain') +const PREFIX = Symbol('prefix') +const HAD_ERROR = Symbol('hadError') +const warner = require('./warn-mixin.js') +const winchars = require('./winchars.js') +const stripAbsolutePath = require('./strip-absolute-path.js') + +const modeFix = require('./mode-fix.js') + +const WriteEntry = warner(class WriteEntry extends Minipass { + constructor (p, opt) { + opt = opt || {} + super(opt) + if (typeof p !== 'string') { + throw new TypeError('path is required') + } + this.path = normPath(p) + // suppress atime, ctime, uid, gid, uname, gname + this.portable = !!opt.portable + // until node has builtin pwnam functions, this'll have to do + this.myuid = process.getuid && process.getuid() || 0 + this.myuser = process.env.USER || '' + this.maxReadSize = opt.maxReadSize || maxReadSize + this.linkCache = opt.linkCache || new Map() + this.statCache = opt.statCache || new Map() + this.preservePaths = !!opt.preservePaths + this.cwd = normPath(opt.cwd || process.cwd()) + this.strict = !!opt.strict + this.noPax = !!opt.noPax + this.noMtime = !!opt.noMtime + this.mtime = opt.mtime || null + this.prefix = opt.prefix ? normPath(opt.prefix) : null + + this.fd = null + this.blockLen = null + this.blockRemain = null + this.buf = null + this.offset = null + this.length = null + this.pos = null + this.remain = null + + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn) + } + + let pathWarn = false + if (!this.preservePaths) { + const [root, stripped] = stripAbsolutePath(this.path) + if (root) { + this.path = stripped + pathWarn = root + } + } + + this.win32 = !!opt.win32 || process.platform === 'win32' + if (this.win32) { + // force the \ to / normalization, since we might not *actually* + // be on windows, but want \ to be considered a path separator. + this.path = winchars.decode(this.path.replace(/\\/g, '/')) + p = p.replace(/\\/g, '/') + } + + this.absolute = normPath(opt.absolute || path.resolve(this.cwd, p)) + + if (this.path === '') { + this.path = './' + } + + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }) + } + + if (this.statCache.has(this.absolute)) { + this[ONLSTAT](this.statCache.get(this.absolute)) + } else { + this[LSTAT]() + } + } + + emit (ev, ...data) { + if (ev === 'error') { + this[HAD_ERROR] = true + } + return super.emit(ev, ...data) + } + + [LSTAT] () { + fs.lstat(this.absolute, (er, stat) => { + if (er) { + return this.emit('error', er) + } + this[ONLSTAT](stat) + }) + } + + [ONLSTAT] (stat) { + this.statCache.set(this.absolute, stat) + this.stat = stat + if (!stat.isFile()) { + stat.size = 0 + } + this.type = getType(stat) + this.emit('stat', stat) + this[PROCESS]() + } + + [PROCESS] () { + switch (this.type) { + case 'File': return this[FILE]() + case 'Directory': return this[DIRECTORY]() + case 'SymbolicLink': return this[SYMLINK]() + // unsupported types are ignored. + default: return this.end() + } + } + + [MODE] (mode) { + return modeFix(mode, this.type === 'Directory', this.portable) + } + + [PREFIX] (path) { + return prefixPath(path, this.prefix) + } + + [HEADER] () { + if (this.type === 'Directory' && this.portable) { + this.noMtime = true + } + + this.header = new Header({ + path: this[PREFIX](this.path), + // only apply the prefix to hard links. + linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath) + : this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this[MODE](this.stat.mode), + uid: this.portable ? null : this.stat.uid, + gid: this.portable ? null : this.stat.gid, + size: this.stat.size, + mtime: this.noMtime ? null : this.mtime || this.stat.mtime, + type: this.type, + uname: this.portable ? null : + this.stat.uid === this.myuid ? this.myuser : '', + atime: this.portable ? null : this.stat.atime, + ctime: this.portable ? null : this.stat.ctime, + }) + + if (this.header.encode() && !this.noPax) { + super.write(new Pax({ + atime: this.portable ? null : this.header.atime, + ctime: this.portable ? null : this.header.ctime, + gid: this.portable ? null : this.header.gid, + mtime: this.noMtime ? null : this.mtime || this.header.mtime, + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath) + : this.linkpath, + size: this.header.size, + uid: this.portable ? null : this.header.uid, + uname: this.portable ? null : this.header.uname, + dev: this.portable ? null : this.stat.dev, + ino: this.portable ? null : this.stat.ino, + nlink: this.portable ? null : this.stat.nlink, + }).encode()) + } + super.write(this.header.block) + } + + [DIRECTORY] () { + if (this.path.slice(-1) !== '/') { + this.path += '/' + } + this.stat.size = 0 + this[HEADER]() + this.end() + } + + [SYMLINK] () { + fs.readlink(this.absolute, (er, linkpath) => { + if (er) { + return this.emit('error', er) + } + this[ONREADLINK](linkpath) + }) + } + + [ONREADLINK] (linkpath) { + this.linkpath = normPath(linkpath) + this[HEADER]() + this.end() + } + + [HARDLINK] (linkpath) { + this.type = 'Link' + this.linkpath = normPath(path.relative(this.cwd, linkpath)) + this.stat.size = 0 + this[HEADER]() + this.end() + } + + [FILE] () { + if (this.stat.nlink > 1) { + const linkKey = this.stat.dev + ':' + this.stat.ino + if (this.linkCache.has(linkKey)) { + const linkpath = this.linkCache.get(linkKey) + if (linkpath.indexOf(this.cwd) === 0) { + return this[HARDLINK](linkpath) + } + } + this.linkCache.set(linkKey, this.absolute) + } + + this[HEADER]() + if (this.stat.size === 0) { + return this.end() + } + + this[OPENFILE]() + } + + [OPENFILE] () { + fs.open(this.absolute, 'r', (er, fd) => { + if (er) { + return this.emit('error', er) + } + this[ONOPENFILE](fd) + }) + } + + [ONOPENFILE] (fd) { + this.fd = fd + if (this[HAD_ERROR]) { + return this[CLOSE]() + } + + this.blockLen = 512 * Math.ceil(this.stat.size / 512) + this.blockRemain = this.blockLen + const bufLen = Math.min(this.blockLen, this.maxReadSize) + this.buf = Buffer.allocUnsafe(bufLen) + this.offset = 0 + this.pos = 0 + this.remain = this.stat.size + this.length = this.buf.length + this[READ]() + } + + [READ] () { + const { fd, buf, offset, length, pos } = this + fs.read(fd, buf, offset, length, pos, (er, bytesRead) => { + if (er) { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + return this[CLOSE](() => this.emit('error', er)) + } + this[ONREAD](bytesRead) + }) + } + + [CLOSE] (cb) { + fs.close(this.fd, cb) + } + + [ONREAD] (bytesRead) { + if (bytesRead <= 0 && this.remain > 0) { + const er = new Error('encountered unexpected EOF') + er.path = this.absolute + er.syscall = 'read' + er.code = 'EOF' + return this[CLOSE](() => this.emit('error', er)) + } + + if (bytesRead > this.remain) { + const er = new Error('did not encounter expected EOF') + er.path = this.absolute + er.syscall = 'read' + er.code = 'EOF' + return this[CLOSE](() => this.emit('error', er)) + } + + // null out the rest of the buffer, if we could fit the block padding + // at the end of this loop, we've incremented bytesRead and this.remain + // to be incremented up to the blockRemain level, as if we had expected + // to get a null-padded file, and read it until the end. then we will + // decrement both remain and blockRemain by bytesRead, and know that we + // reached the expected EOF, without any null buffer to append. + if (bytesRead === this.remain) { + for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) { + this.buf[i + this.offset] = 0 + bytesRead++ + this.remain++ + } + } + + const writeBuf = this.offset === 0 && bytesRead === this.buf.length ? + this.buf : this.buf.slice(this.offset, this.offset + bytesRead) + + const flushed = this.write(writeBuf) + if (!flushed) { + this[AWAITDRAIN](() => this[ONDRAIN]()) + } else { + this[ONDRAIN]() + } + } + + [AWAITDRAIN] (cb) { + this.once('drain', cb) + } + + write (writeBuf) { + if (this.blockRemain < writeBuf.length) { + const er = new Error('writing more data than expected') + er.path = this.absolute + return this.emit('error', er) + } + this.remain -= writeBuf.length + this.blockRemain -= writeBuf.length + this.pos += writeBuf.length + this.offset += writeBuf.length + return super.write(writeBuf) + } + + [ONDRAIN] () { + if (!this.remain) { + if (this.blockRemain) { + super.write(Buffer.alloc(this.blockRemain)) + } + return this[CLOSE](er => er ? this.emit('error', er) : this.end()) + } + + if (this.offset >= this.length) { + // if we only have a smaller bit left to read, alloc a smaller buffer + // otherwise, keep it the same length it was before. + this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)) + this.offset = 0 + } + this.length = this.buf.length - this.offset + this[READ]() + } +}) + +class WriteEntrySync extends WriteEntry { + [LSTAT] () { + this[ONLSTAT](fs.lstatSync(this.absolute)) + } + + [SYMLINK] () { + this[ONREADLINK](fs.readlinkSync(this.absolute)) + } + + [OPENFILE] () { + this[ONOPENFILE](fs.openSync(this.absolute, 'r')) + } + + [READ] () { + let threw = true + try { + const { fd, buf, offset, length, pos } = this + const bytesRead = fs.readSync(fd, buf, offset, length, pos) + this[ONREAD](bytesRead) + threw = false + } finally { + // ignoring the error from close(2) is a bad practice, but at + // this point we already have an error, don't need another one + if (threw) { + try { + this[CLOSE](() => {}) + } catch (er) {} + } + } + } + + [AWAITDRAIN] (cb) { + cb() + } + + [CLOSE] (cb) { + fs.closeSync(this.fd) + cb() + } +} + +const WriteEntryTar = warner(class WriteEntryTar extends Minipass { + constructor (readEntry, opt) { + opt = opt || {} + super(opt) + this.preservePaths = !!opt.preservePaths + this.portable = !!opt.portable + this.strict = !!opt.strict + this.noPax = !!opt.noPax + this.noMtime = !!opt.noMtime + + this.readEntry = readEntry + this.type = readEntry.type + if (this.type === 'Directory' && this.portable) { + this.noMtime = true + } + + this.prefix = opt.prefix || null + + this.path = normPath(readEntry.path) + this.mode = this[MODE](readEntry.mode) + this.uid = this.portable ? null : readEntry.uid + this.gid = this.portable ? null : readEntry.gid + this.uname = this.portable ? null : readEntry.uname + this.gname = this.portable ? null : readEntry.gname + this.size = readEntry.size + this.mtime = this.noMtime ? null : opt.mtime || readEntry.mtime + this.atime = this.portable ? null : readEntry.atime + this.ctime = this.portable ? null : readEntry.ctime + this.linkpath = normPath(readEntry.linkpath) + + if (typeof opt.onwarn === 'function') { + this.on('warn', opt.onwarn) + } + + let pathWarn = false + if (!this.preservePaths) { + const [root, stripped] = stripAbsolutePath(this.path) + if (root) { + this.path = stripped + pathWarn = root + } + } + + this.remain = readEntry.size + this.blockRemain = readEntry.startBlockSize + + this.header = new Header({ + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath) + : this.linkpath, + // only the permissions and setuid/setgid/sticky bitflags + // not the higher-order bits that specify file type + mode: this.mode, + uid: this.portable ? null : this.uid, + gid: this.portable ? null : this.gid, + size: this.size, + mtime: this.noMtime ? null : this.mtime, + type: this.type, + uname: this.portable ? null : this.uname, + atime: this.portable ? null : this.atime, + ctime: this.portable ? null : this.ctime, + }) + + if (pathWarn) { + this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { + entry: this, + path: pathWarn + this.path, + }) + } + + if (this.header.encode() && !this.noPax) { + super.write(new Pax({ + atime: this.portable ? null : this.atime, + ctime: this.portable ? null : this.ctime, + gid: this.portable ? null : this.gid, + mtime: this.noMtime ? null : this.mtime, + path: this[PREFIX](this.path), + linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath) + : this.linkpath, + size: this.size, + uid: this.portable ? null : this.uid, + uname: this.portable ? null : this.uname, + dev: this.portable ? null : this.readEntry.dev, + ino: this.portable ? null : this.readEntry.ino, + nlink: this.portable ? null : this.readEntry.nlink, + }).encode()) + } + + super.write(this.header.block) + readEntry.pipe(this) + } + + [PREFIX] (path) { + return prefixPath(path, this.prefix) + } + + [MODE] (mode) { + return modeFix(mode, this.type === 'Directory', this.portable) + } + + write (data) { + const writeLen = data.length + if (writeLen > this.blockRemain) { + throw new Error('writing more to entry than is appropriate') + } + this.blockRemain -= writeLen + return super.write(data) + } + + end () { + if (this.blockRemain) { + super.write(Buffer.alloc(this.blockRemain)) + } + return super.end() + } +}) + +WriteEntry.Sync = WriteEntrySync +WriteEntry.Tar = WriteEntryTar + +const getType = stat => + stat.isFile() ? 'File' + : stat.isDirectory() ? 'Directory' + : stat.isSymbolicLink() ? 'SymbolicLink' + : 'Unsupported' + +module.exports = WriteEntry diff --git a/node_modules/npm/node_modules/tar/node_modules/fs-minipass/LICENSE b/node_modules/npm/node_modules/tar/node_modules/fs-minipass/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/tar/node_modules/fs-minipass/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/tar/node_modules/fs-minipass/index.js b/node_modules/npm/node_modules/tar/node_modules/fs-minipass/index.js new file mode 100644 index 00000000..9b0779c8 --- /dev/null +++ b/node_modules/npm/node_modules/tar/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/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/LICENSE b/node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/LICENSE new file mode 100644 index 00000000..bf1dece2 --- /dev/null +++ b/node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/index.js b/node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/index.js new file mode 100644 index 00000000..e8797aab --- /dev/null +++ b/node_modules/npm/node_modules/tar/node_modules/fs-minipass/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/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/package.json b/node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/package.json new file mode 100644 index 00000000..548d03fa --- /dev/null +++ b/node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/package.json @@ -0,0 +1,56 @@ +{ + "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/npm/node_modules/tar/node_modules/fs-minipass/package.json b/node_modules/npm/node_modules/tar/node_modules/fs-minipass/package.json new file mode 100644 index 00000000..2f2436cb --- /dev/null +++ b/node_modules/npm/node_modules/tar/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/npm/node_modules/tar/node_modules/minipass/LICENSE b/node_modules/npm/node_modules/tar/node_modules/minipass/LICENSE new file mode 100644 index 00000000..97f8e32e --- /dev/null +++ b/node_modules/npm/node_modules/tar/node_modules/minipass/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2017-2023 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/npm/node_modules/tar/node_modules/minipass/index.js b/node_modules/npm/node_modules/tar/node_modules/minipass/index.js new file mode 100644 index 00000000..ed07c17a --- /dev/null +++ b/node_modules/npm/node_modules/tar/node_modules/minipass/index.js @@ -0,0 +1,702 @@ +'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/npm/node_modules/tar/node_modules/minipass/index.mjs b/node_modules/npm/node_modules/tar/node_modules/minipass/index.mjs new file mode 100644 index 00000000..6ef6cd8c --- /dev/null +++ b/node_modules/npm/node_modules/tar/node_modules/minipass/index.mjs @@ -0,0 +1,702 @@ +'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/npm/node_modules/tar/node_modules/minipass/package.json b/node_modules/npm/node_modules/tar/node_modules/minipass/package.json new file mode 100644 index 00000000..0e20e988 --- /dev/null +++ b/node_modules/npm/node_modules/tar/node_modules/minipass/package.json @@ -0,0 +1,76 @@ +{ + "name": "minipass", + "version": "5.0.0", + "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" + }, + "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" + }, + "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", + "index.mjs" + ], + "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/npm/node_modules/tar/package.json b/node_modules/npm/node_modules/tar/package.json new file mode 100644 index 00000000..f84a41cc --- /dev/null +++ b/node_modules/npm/node_modules/tar/package.json @@ -0,0 +1,70 @@ +{ + "author": "GitHub Inc.", + "name": "tar", + "description": "tar for node", + "version": "6.2.1", + "repository": { + "type": "git", + "url": "https://github.com/isaacs/node-tar.git" + }, + "scripts": { + "genparse": "node scripts/generate-parse-fixtures.js", + "snap": "tap", + "test": "tap" + }, + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "devDependencies": { + "@npmcli/eslint-config": "^4.0.0", + "@npmcli/template-oss": "4.11.0", + "chmodr": "^1.2.0", + "end-of-stream": "^1.4.3", + "events-to-array": "^2.0.3", + "mutate-fs": "^2.1.1", + "nock": "^13.2.9", + "rimraf": "^3.0.2", + "tap": "^16.0.1" + }, + "license": "ISC", + "engines": { + "node": ">=10" + }, + "files": [ + "bin/", + "lib/", + "index.js" + ], + "tap": { + "coverage-map": "map.js", + "timeout": 0, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.11.0", + "content": "scripts/template-oss", + "engines": ">=10", + "distPaths": [ + "index.js" + ], + "allowPaths": [ + "/index.js" + ], + "ciVersions": [ + "10.x", + "12.x", + "14.x", + "16.x", + "18.x" + ] + } +} diff --git a/node_modules/npm/node_modules/text-table/LICENSE b/node_modules/npm/node_modules/text-table/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/npm/node_modules/text-table/LICENSE @@ -0,0 +1,18 @@ +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/npm/node_modules/text-table/example/align.js b/node_modules/npm/node_modules/text-table/example/align.js new file mode 100644 index 00000000..9be43098 --- /dev/null +++ b/node_modules/npm/node_modules/text-table/example/align.js @@ -0,0 +1,8 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] +], { align: [ 'l', 'r' ] }); +console.log(t); diff --git a/node_modules/npm/node_modules/text-table/example/center.js b/node_modules/npm/node_modules/text-table/example/center.js new file mode 100644 index 00000000..52b1c69e --- /dev/null +++ b/node_modules/npm/node_modules/text-table/example/center.js @@ -0,0 +1,8 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] +], { align: [ 'l', 'c', 'l' ] }); +console.log(t); diff --git a/node_modules/npm/node_modules/text-table/example/dotalign.js b/node_modules/npm/node_modules/text-table/example/dotalign.js new file mode 100644 index 00000000..2cea6299 --- /dev/null +++ b/node_modules/npm/node_modules/text-table/example/dotalign.js @@ -0,0 +1,9 @@ +var table = require('../'); +var t = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] +], { align: [ 'l', '.' ] }); +console.log(t); diff --git a/node_modules/npm/node_modules/text-table/example/doubledot.js b/node_modules/npm/node_modules/text-table/example/doubledot.js new file mode 100644 index 00000000..bab983b6 --- /dev/null +++ b/node_modules/npm/node_modules/text-table/example/doubledot.js @@ -0,0 +1,11 @@ +var table = require('../'); +var t = table([ + [ '0.1.2' ], + [ '11.22.33' ], + [ '5.6.7' ], + [ '1.22222' ], + [ '12345.' ], + [ '5555.' ], + [ '123' ] +], { align: [ '.' ] }); +console.log(t); diff --git a/node_modules/npm/node_modules/text-table/example/table.js b/node_modules/npm/node_modules/text-table/example/table.js new file mode 100644 index 00000000..903ea4c4 --- /dev/null +++ b/node_modules/npm/node_modules/text-table/example/table.js @@ -0,0 +1,6 @@ +var table = require('../'); +var t = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] +]); +console.log(t); diff --git a/node_modules/npm/node_modules/text-table/index.js b/node_modules/npm/node_modules/text-table/index.js new file mode 100644 index 00000000..5c0ba987 --- /dev/null +++ b/node_modules/npm/node_modules/text-table/index.js @@ -0,0 +1,86 @@ +module.exports = function (rows_, opts) { + if (!opts) opts = {}; + var hsep = opts.hsep === undefined ? ' ' : opts.hsep; + var align = opts.align || []; + var stringLength = opts.stringLength + || function (s) { return String(s).length; } + ; + + var dotsizes = reduce(rows_, function (acc, row) { + forEach(row, function (c, ix) { + var n = dotindex(c); + if (!acc[ix] || n > acc[ix]) acc[ix] = n; + }); + return acc; + }, []); + + var rows = map(rows_, function (row) { + return map(row, function (c_, ix) { + var c = String(c_); + if (align[ix] === '.') { + var index = dotindex(c); + var size = dotsizes[ix] + (/\./.test(c) ? 1 : 2) + - (stringLength(c) - index) + ; + return c + Array(size).join(' '); + } + else return c; + }); + }); + + var sizes = reduce(rows, function (acc, row) { + forEach(row, function (c, ix) { + var n = stringLength(c); + if (!acc[ix] || n > acc[ix]) acc[ix] = n; + }); + return acc; + }, []); + + return map(rows, function (row) { + return map(row, function (c, ix) { + var n = (sizes[ix] - stringLength(c)) || 0; + var s = Array(Math.max(n + 1, 1)).join(' '); + if (align[ix] === 'r' || align[ix] === '.') { + return s + c; + } + if (align[ix] === 'c') { + return Array(Math.ceil(n / 2 + 1)).join(' ') + + c + Array(Math.floor(n / 2 + 1)).join(' ') + ; + } + + return c + s; + }).join(hsep).replace(/\s+$/, ''); + }).join('\n'); +}; + +function dotindex (c) { + var m = /\.[^.]*$/.exec(c); + return m ? m.index + 1 : c.length; +} + +function reduce (xs, f, init) { + if (xs.reduce) return xs.reduce(f, init); + var i = 0; + var acc = arguments.length >= 3 ? init : xs[i++]; + for (; i < xs.length; i++) { + f(acc, xs[i], i); + } + return acc; +} + +function forEach (xs, f) { + if (xs.forEach) return xs.forEach(f); + for (var i = 0; i < xs.length; i++) { + f.call(xs, xs[i], i); + } +} + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f.call(xs, xs[i], i)); + } + return res; +} diff --git a/node_modules/npm/node_modules/text-table/package.json b/node_modules/npm/node_modules/text-table/package.json new file mode 100644 index 00000000..b4d17a4f --- /dev/null +++ b/node_modules/npm/node_modules/text-table/package.json @@ -0,0 +1,44 @@ +{ + "name": "text-table", + "version": "0.2.0", + "description": "borderless text tables with alignment", + "main": "index.js", + "devDependencies": { + "tap": "~0.4.0", + "tape": "~1.0.2", + "cli-color": "~0.2.3" + }, + "scripts": { + "test": "tap test/*.js" + }, + "testling" : { + "files" : "test/*.js", + "browsers" : [ + "ie/6..latest", + "chrome/20..latest", + "firefox/10..latest", + "safari/latest", + "opera/11.0..latest", + "iphone/6", "ipad/6" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/substack/text-table.git" + }, + "homepage": "https://github.com/substack/text-table", + "keywords": [ + "text", + "table", + "align", + "ascii", + "rows", + "tabular" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "license": "MIT" +} diff --git a/node_modules/npm/node_modules/text-table/test/align.js b/node_modules/npm/node_modules/text-table/test/align.js new file mode 100644 index 00000000..245357f2 --- /dev/null +++ b/node_modules/npm/node_modules/text-table/test/align.js @@ -0,0 +1,18 @@ +var test = require('tape'); +var table = require('../'); + +test('align', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024' ], + [ 'boop', '33450' ], + [ 'foo', '1006' ], + [ 'bar', '45' ] + ], { align: [ 'l', 'r' ] }); + t.equal(s, [ + 'beep 1024', + 'boop 33450', + 'foo 1006', + 'bar 45' + ].join('\n')); +}); diff --git a/node_modules/npm/node_modules/text-table/test/ansi-colors.js b/node_modules/npm/node_modules/text-table/test/ansi-colors.js new file mode 100644 index 00000000..fbc5bb10 --- /dev/null +++ b/node_modules/npm/node_modules/text-table/test/ansi-colors.js @@ -0,0 +1,32 @@ +var test = require('tape'); +var table = require('../'); +var color = require('cli-color'); +var ansiTrim = require('cli-color/lib/trim'); + +test('center', function (t) { + t.plan(1); + var opts = { + align: [ 'l', 'c', 'l' ], + stringLength: function(s) { return ansiTrim(s).length } + }; + var s = table([ + [ + color.red('Red'), color.green('Green'), color.blue('Blue') + ], + [ + color.bold('Bold'), color.underline('Underline'), + color.italic('Italic') + ], + [ + color.inverse('Inverse'), color.strike('Strike'), + color.blink('Blink') + ], + [ 'bar', '45', 'lmno' ] + ], opts); + t.equal(ansiTrim(s), [ + 'Red Green Blue', + 'Bold Underline Italic', + 'Inverse Strike Blink', + 'bar 45 lmno' + ].join('\n')); +}); diff --git a/node_modules/npm/node_modules/text-table/test/center.js b/node_modules/npm/node_modules/text-table/test/center.js new file mode 100644 index 00000000..c2c7a62a --- /dev/null +++ b/node_modules/npm/node_modules/text-table/test/center.js @@ -0,0 +1,18 @@ +var test = require('tape'); +var table = require('../'); + +test('center', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024', 'xyz' ], + [ 'boop', '3388450', 'tuv' ], + [ 'foo', '10106', 'qrstuv' ], + [ 'bar', '45', 'lmno' ] + ], { align: [ 'l', 'c', 'l' ] }); + t.equal(s, [ + 'beep 1024 xyz', + 'boop 3388450 tuv', + 'foo 10106 qrstuv', + 'bar 45 lmno' + ].join('\n')); +}); diff --git a/node_modules/npm/node_modules/text-table/test/dotalign.js b/node_modules/npm/node_modules/text-table/test/dotalign.js new file mode 100644 index 00000000..f804f928 --- /dev/null +++ b/node_modules/npm/node_modules/text-table/test/dotalign.js @@ -0,0 +1,20 @@ +var test = require('tape'); +var table = require('../'); + +test('dot align', function (t) { + t.plan(1); + var s = table([ + [ 'beep', '1024' ], + [ 'boop', '334.212' ], + [ 'foo', '1006' ], + [ 'bar', '45.6' ], + [ 'baz', '123.' ] + ], { align: [ 'l', '.' ] }); + t.equal(s, [ + 'beep 1024', + 'boop 334.212', + 'foo 1006', + 'bar 45.6', + 'baz 123.' + ].join('\n')); +}); diff --git a/node_modules/npm/node_modules/text-table/test/doubledot.js b/node_modules/npm/node_modules/text-table/test/doubledot.js new file mode 100644 index 00000000..659b57c9 --- /dev/null +++ b/node_modules/npm/node_modules/text-table/test/doubledot.js @@ -0,0 +1,24 @@ +var test = require('tape'); +var table = require('../'); + +test('dot align', function (t) { + t.plan(1); + var s = table([ + [ '0.1.2' ], + [ '11.22.33' ], + [ '5.6.7' ], + [ '1.22222' ], + [ '12345.' ], + [ '5555.' ], + [ '123' ] + ], { align: [ '.' ] }); + t.equal(s, [ + ' 0.1.2', + '11.22.33', + ' 5.6.7', + ' 1.22222', + '12345.', + ' 5555.', + ' 123' + ].join('\n')); +}); diff --git a/node_modules/npm/node_modules/text-table/test/table.js b/node_modules/npm/node_modules/text-table/test/table.js new file mode 100644 index 00000000..9c670146 --- /dev/null +++ b/node_modules/npm/node_modules/text-table/test/table.js @@ -0,0 +1,14 @@ +var test = require('tape'); +var table = require('../'); + +test('table', function (t) { + t.plan(1); + var s = table([ + [ 'master', '0123456789abcdef' ], + [ 'staging', 'fedcba9876543210' ] + ]); + t.equal(s, [ + 'master 0123456789abcdef', + 'staging fedcba9876543210' + ].join('\n')); +}); diff --git a/node_modules/npm/node_modules/tiny-relative-date/LICENSE.md b/node_modules/npm/node_modules/tiny-relative-date/LICENSE.md new file mode 100644 index 00000000..e42aca31 --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Joseph Wynn + +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/npm/node_modules/tiny-relative-date/lib/factory.js b/node_modules/npm/node_modules/tiny-relative-date/lib/factory.js new file mode 100644 index 00000000..ac901614 --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/lib/factory.js @@ -0,0 +1,100 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = relativeDateFactory; +var calculateDelta = function calculateDelta(now, date) { + return Math.round(Math.abs(now - date) / 1000); +}; + +function relativeDateFactory(translations) { + return function relativeDate(date) { + var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); + + if (!(date instanceof Date)) { + date = new Date(date); + } + + var delta = null; + + var minute = 60; + var hour = minute * 60; + var day = hour * 24; + var week = day * 7; + var month = day * 30; + var year = day * 365; + + delta = calculateDelta(now, date); + + if (delta > day && delta < week) { + date = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); + delta = calculateDelta(now, date); + } + + var translate = function translate(translatePhrase, timeValue) { + var key = void 0; + + if (translatePhrase === 'justNow') { + key = translatePhrase; + } else if (now >= date) { + key = translatePhrase + 'Ago'; + } else { + key = translatePhrase + 'FromNow'; + } + + var translation = translations[key]; + + if (typeof translation === 'function') { + return translation(timeValue); + } + + return translation.replace('{{time}}', timeValue); + }; + + switch (false) { + case !(delta < 30): + return translate('justNow'); + + case !(delta < minute): + return translate('seconds', delta); + + case !(delta < 2 * minute): + return translate('aMinute'); + + case !(delta < hour): + return translate('minutes', Math.floor(delta / minute)); + + case Math.floor(delta / hour) !== 1: + return translate('anHour'); + + case !(delta < day): + return translate('hours', Math.floor(delta / hour)); + + case !(delta < day * 2): + return translate('aDay'); + + case !(delta < week): + return translate('days', Math.floor(delta / day)); + + case Math.floor(delta / week) !== 1: + return translate('aWeek'); + + case !(delta < month): + return translate('weeks', Math.floor(delta / week)); + + case Math.floor(delta / month) !== 1: + return translate('aMonth'); + + case !(delta < year): + return translate('months', Math.floor(delta / month)); + + case Math.floor(delta / year) !== 1: + return translate('aYear'); + + default: + return translate('overAYear'); + } + }; +} +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/npm/node_modules/tiny-relative-date/lib/index.js b/node_modules/npm/node_modules/tiny-relative-date/lib/index.js new file mode 100644 index 00000000..ed8a82ad --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/lib/index.js @@ -0,0 +1,18 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _factory = require('./factory'); + +var _factory2 = _interopRequireDefault(_factory); + +var _en = require('../translations/en'); + +var _en2 = _interopRequireDefault(_en); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = (0, _factory2.default)(_en2.default); +module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/npm/node_modules/tiny-relative-date/package.json b/node_modules/npm/node_modules/tiny-relative-date/package.json new file mode 100644 index 00000000..26c88147 --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/package.json @@ -0,0 +1,39 @@ +{ + "name": "tiny-relative-date", + "version": "1.3.0", + "description": "Tiny function that provides relative, human-readable dates.", + "main": "lib/index.js", + "module": "src/index.js", + "scripts": { + "build": "babel src -d lib", + "test": "npm run eslint && npm run jasmine", + "eslint": "eslint --fix src/**/*.js", + "jasmine": "jasmine", + "prepublish": "npm run build" + }, + "files": [ + "lib/", + "src/", + "translations/" + ], + "license": "MIT", + "author": "Joseph Wynn (https://wildlyinaccurate.com/)", + "repository": { + "type": "git", + "url": "https://github.com/wildlyinaccurate/relative-date.git" + }, + "devDependencies": { + "babel-cli": "^6.24.1", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-preset-es2015": "^6.24.1", + "babel-register": "^6.24.1", + "eslint": "^4.1.0", + "eslint-config-standard": "^10.2.1", + "eslint-plugin-import": "^2.6.0", + "eslint-plugin-node": "^5.0.0", + "eslint-plugin-promise": "^3.5.0", + "eslint-plugin-standard": "^3.0.1", + "jasmine": "^2.6.0", + "jasmine-spec-reporter": "^4.1.1" + } +} diff --git a/node_modules/npm/node_modules/tiny-relative-date/src/factory.js b/node_modules/npm/node_modules/tiny-relative-date/src/factory.js new file mode 100644 index 00000000..689359bc --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/src/factory.js @@ -0,0 +1,89 @@ +const calculateDelta = (now, date) => Math.round(Math.abs(now - date) / 1000) + +export default function relativeDateFactory (translations) { + return function relativeDate (date, now = new Date()) { + if (!(date instanceof Date)) { + date = new Date(date) + } + + let delta = null + + const minute = 60 + const hour = minute * 60 + const day = hour * 24 + const week = day * 7 + const month = day * 30 + const year = day * 365 + + delta = calculateDelta(now, date) + + if (delta > day && delta < week) { + date = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0) + delta = calculateDelta(now, date) + } + + const translate = (translatePhrase, timeValue) => { + let key + + if (translatePhrase === 'justNow') { + key = translatePhrase + } else if (now >= date) { + key = `${translatePhrase}Ago` + } else { + key = `${translatePhrase}FromNow` + } + + const translation = translations[key] + + if (typeof translation === 'function') { + return translation(timeValue) + } + + return translation.replace('{{time}}', timeValue) + } + + switch (false) { + case !(delta < 30): + return translate('justNow') + + case !(delta < minute): + return translate('seconds', delta) + + case !(delta < 2 * minute): + return translate('aMinute') + + case !(delta < hour): + return translate('minutes', Math.floor(delta / minute)) + + case Math.floor(delta / hour) !== 1: + return translate('anHour') + + case !(delta < day): + return translate('hours', Math.floor(delta / hour)) + + case !(delta < day * 2): + return translate('aDay') + + case !(delta < week): + return translate('days', Math.floor(delta / day)) + + case Math.floor(delta / week) !== 1: + return translate('aWeek') + + case !(delta < month): + return translate('weeks', Math.floor(delta / week)) + + case Math.floor(delta / month) !== 1: + return translate('aMonth') + + case !(delta < year): + return translate('months', Math.floor(delta / month)) + + case Math.floor(delta / year) !== 1: + return translate('aYear') + + default: + return translate('overAYear') + } + } +} diff --git a/node_modules/npm/node_modules/tiny-relative-date/src/index.js b/node_modules/npm/node_modules/tiny-relative-date/src/index.js new file mode 100644 index 00000000..c2cef688 --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/src/index.js @@ -0,0 +1,4 @@ +import relativeDateFactory from './factory' +import enTranslations from '../translations/en' + +export default relativeDateFactory(enTranslations) diff --git a/node_modules/npm/node_modules/tiny-relative-date/translations/da.js b/node_modules/npm/node_modules/tiny-relative-date/translations/da.js new file mode 100644 index 00000000..dedc17d9 --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/translations/da.js @@ -0,0 +1,31 @@ +module.exports = { + justNow: "ligenu", + secondsAgo: "{{time}} sekunder siden", + aMinuteAgo: "et minut siden", + minutesAgo: "{{time}} minutter siden", + anHourAgo: "en time siden", + hoursAgo: "{{time}} timer siden", + aDayAgo: "i går", + daysAgo: "{{time}} dage siden", + aWeekAgo: "en uge siden", + weeksAgo: "{{time}} uger siden", + aMonthAgo: "en måned siden", + monthsAgo: "{{time}} måneder siden", + aYearAgo: "et år siden", + yearsAgo: "{{time}} år siden", + overAYearAgo: "over et år siden", + secondsFromNow: "om {{time}} sekunder", + aMinuteFromNow: "om et minut", + minutesFromNow: "om {{time}} minutter", + anHourFromNow: "om en time", + hoursFromNow: "om {{time}} timer", + aDayFromNow: "i morgen", + daysFromNow: "om {{time}} dage", + aWeekFromNow: "om en uge", + weeksFromNow: "om {{time}} uger", + aMonthFromNow: "om en måned", + monthsFromNow: "om {{time}} måneder", + aYearFromNow: "om et år", + yearsFromNow: "om {{time}} år", + overAYearFromNow: "om over et år" +} diff --git a/node_modules/npm/node_modules/tiny-relative-date/translations/de.js b/node_modules/npm/node_modules/tiny-relative-date/translations/de.js new file mode 100644 index 00000000..c0342e19 --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/translations/de.js @@ -0,0 +1,31 @@ +module.exports = { + justNow: "gerade eben", + secondsAgo: "vor {{time}} Sekunden", + aMinuteAgo: "vor einer Minute", + minutesAgo: "vor {{time}} Minuten", + anHourAgo: "vor einer Stunde", + hoursAgo: "vor {{time}} Stunden", + aDayAgo: "gestern", + daysAgo: "vor {{time}} Tagen", + aWeekAgo: "letzte Woche", + weeksAgo: "vor {{time}} Wochen", + aMonthAgo: "letzten Monat", + monthsAgo: "vor {{time}} Monaten", + aYearAgo: "letztes Jahr", + yearsAgo: "vor {{time}} Jahren", + overAYearAgo: "vor über einem Jahr", + secondsFromNow: "in {{time}} Sekunden", + aMinuteFromNow: "in einer Minute", + minutesFromNow: "in {{time}} Minuten", + anHourFromNow: "in einer Stunde", + hoursFromNow: "in {{time}} Stunden", + aDayFromNow: "morgen", + daysFromNow: "in {{time}} Tagen", + aWeekFromNow: "nächste Woche", + weeksFromNow: "in {{time}} Wochen", + aMonthFromNow: "nächsten Monat", + monthsFromNow: "in {{time}} Monaten", + aYearFromNow: "nächstes Jahr", + yearsFromNow: "in {{time}} Jahren", + overAYearFromNow: "in über einem Jahr" +} diff --git a/node_modules/npm/node_modules/tiny-relative-date/translations/en-short.js b/node_modules/npm/node_modules/tiny-relative-date/translations/en-short.js new file mode 100644 index 00000000..b368d192 --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/translations/en-short.js @@ -0,0 +1,31 @@ +module.exports = { + justNow: "now", + secondsAgo: "{{time}}s", + aMinuteAgo: "1m", + minutesAgo: "{{time}}m", + anHourAgo: "1h", + hoursAgo: "{{time}}h", + aDayAgo: "1d", + daysAgo: "{{time}}d", + aWeekAgo: "1w", + weeksAgo: "{{time}}w", + aMonthAgo: '4w', + monthsAgo: (months) => `${Math.round(months / 12 * 52)}w`, + aYearAgo: "1y", + yearsAgo: "{{time}}y", + overAYearAgo: "1y+", + secondsFromNow: "+{{time}}s", + aMinuteFromNow: "+1m", + minutesFromNow: "+{{time}}m", + anHourFromNow: "+1h", + hoursFromNow: "+{{time}}h", + aDayFromNow: "+1d", + daysFromNow: "+{{time}}d", + aWeekFromNow: "+1w", + weeksFromNow: "+{{time}}w", + aMonthFromNow: '+4w', + monthsFromNow: (months) => `+${Math.round(months / 12 * 52)}w`, + aYearFromNow: "+1y", + yearsFromNow: "+{{time}}y", + overAYearFromNow: "+1y+" +} diff --git a/node_modules/npm/node_modules/tiny-relative-date/translations/en.js b/node_modules/npm/node_modules/tiny-relative-date/translations/en.js new file mode 100644 index 00000000..8411bf03 --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/translations/en.js @@ -0,0 +1,31 @@ +module.exports = { + justNow: "just now", + secondsAgo: "{{time}} seconds ago", + aMinuteAgo: "a minute ago", + minutesAgo: "{{time}} minutes ago", + anHourAgo: "an hour ago", + hoursAgo: "{{time}} hours ago", + aDayAgo: "yesterday", + daysAgo: "{{time}} days ago", + aWeekAgo: "a week ago", + weeksAgo: "{{time}} weeks ago", + aMonthAgo: "a month ago", + monthsAgo: "{{time}} months ago", + aYearAgo: "a year ago", + yearsAgo: "{{time}} years ago", + overAYearAgo: "over a year ago", + secondsFromNow: "{{time}} seconds from now", + aMinuteFromNow: "a minute from now", + minutesFromNow: "{{time}} minutes from now", + anHourFromNow: "an hour from now", + hoursFromNow: "{{time}} hours from now", + aDayFromNow: "tomorrow", + daysFromNow: "{{time}} days from now", + aWeekFromNow: "a week from now", + weeksFromNow: "{{time}} weeks from now", + aMonthFromNow: "a month from now", + monthsFromNow: "{{time}} months from now", + aYearFromNow: "a year from now", + yearsFromNow: "{{time}} years from now", + overAYearFromNow: "over a year from now" +} diff --git a/node_modules/npm/node_modules/tiny-relative-date/translations/es.js b/node_modules/npm/node_modules/tiny-relative-date/translations/es.js new file mode 100644 index 00000000..fac622ff --- /dev/null +++ b/node_modules/npm/node_modules/tiny-relative-date/translations/es.js @@ -0,0 +1,31 @@ +module.exports = { + justNow: "recién", + secondsAgo: "hace {{time}} segundos", + aMinuteAgo: "hace un minuto", + minutesAgo: "hace {{time}} minutos", + anHourAgo: "hace una hora", + hoursAgo: "hace {{time}} horas", + aDayAgo: "ayer", + daysAgo: "hace {{time}} días", + aWeekAgo: "hace una semana", + weeksAgo: "hace {{time}} semanas", + aMonthAgo: "hace un mes", + monthsAgo: "hace {{time}} meses", + aYearAgo: "hace un año", + yearsAgo: "hace {{time}} años", + overAYearAgo: "hace mas de un año", + secondsFromNow: "dentro de {{time}} segundos", + aMinuteFromNow: "dentro de un minuto", + minutesFromNow: "dentro de {{time}} minutos", + anHourFromNow: "dentro de una hora", + hoursFromNow: "dentro de {{time}} horas", + aDayFromNow: "mañana", + daysFromNow: "dentro de {{time}} días", + aWeekFromNow: "dentro de una semana", + weeksFromNow: "dentro de {{time}} semanas", + aMonthFromNow: "dentro de un mes", + monthsFromNow: "dentro de {{time}} meses", + aYearFromNow: "dentro de un año", + yearsFromNow: "dentro de {{time}} años", + overAYearFromNow: "dentro de mas de un año" +} diff --git a/node_modules/npm/node_modules/treeverse/LICENSE b/node_modules/npm/node_modules/treeverse/LICENSE new file mode 100644 index 00000000..20a47625 --- /dev/null +++ b/node_modules/npm/node_modules/treeverse/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/npm/node_modules/treeverse/lib/breadth.js b/node_modules/npm/node_modules/treeverse/lib/breadth.js new file mode 100644 index 00000000..6681f8cf --- /dev/null +++ b/node_modules/npm/node_modules/treeverse/lib/breadth.js @@ -0,0 +1,67 @@ +// Perform a breadth-first walk of a tree, either logical or physical +// This one only visits, it doesn't leave. That's because +// in a breadth-first traversal, children may be visited long +// after their parent, so the "exit" pass ends up being just +// another breadth-first walk. +// +// Breadth-first traversals are good for either creating a tree (ie, +// reifying a dep graph based on a package.json without a node_modules +// or package-lock), or mutating it in-place. For a map-reduce type of +// walk, it doesn't make a lot of sense, and is very expensive. +const breadth = ({ + visit, + filter = () => true, + getChildren, + tree, +}) => { + const queue = [] + const seen = new Map() + + const next = () => { + while (queue.length) { + const node = queue.shift() + const res = visitNode(node) + if (isPromise(res)) { + return res.then(() => next()) + } + } + return seen.get(tree) + } + + const visitNode = (visitTree) => { + if (seen.has(visitTree)) { + return seen.get(visitTree) + } + + seen.set(visitTree, null) + const res = visit ? visit(visitTree) : visitTree + if (isPromise(res)) { + const fullResult = res.then(resThen => { + seen.set(visitTree, resThen) + return kidNodes(visitTree) + }) + seen.set(visitTree, fullResult) + return fullResult + } else { + seen.set(visitTree, res) + return kidNodes(visitTree) + } + } + + const kidNodes = (kidTree) => { + const kids = getChildren(kidTree, seen.get(kidTree)) + return isPromise(kids) ? kids.then(processKids) : processKids(kids) + } + + const processKids = (kids) => { + kids = (kids || []).filter(filter) + queue.push(...kids) + } + + queue.push(tree) + return next() +} + +const isPromise = p => p && typeof p.then === 'function' + +module.exports = breadth diff --git a/node_modules/npm/node_modules/treeverse/lib/depth-descent.js b/node_modules/npm/node_modules/treeverse/lib/depth-descent.js new file mode 100644 index 00000000..361d6bf3 --- /dev/null +++ b/node_modules/npm/node_modules/treeverse/lib/depth-descent.js @@ -0,0 +1,88 @@ +// Perform a depth-first walk of a tree, ONLY doing the descent (visit) +// +// This uses a stack rather than recursion, so that it can handle deeply +// nested trees without call stack overflows. (My kingdom for proper TCO!) +// +// This is only used for cases where leave() is not specified. +// +// a +// +-- b +// | +-- 1 +// | +-- 2 +// +-- c +// +-- 3 +// +-- 4 +// +// Expect: +// visit a +// visit b +// visit 1 +// visit 2 +// visit c +// visit 3 +// visit 4 +// +// stack.push(tree) +// while stack not empty +// pop T from stack +// VISIT(T) +// get children C of T +// push each C onto stack + +const depth = ({ + visit, + filter, + getChildren, + tree, +}) => { + const stack = [] + const seen = new Map() + + const next = () => { + while (stack.length) { + const node = stack.pop() + const res = visitNode(node) + if (isPromise(res)) { + return res.then(() => next()) + } + } + return seen.get(tree) + } + + const visitNode = (visitTree) => { + if (seen.has(visitTree)) { + return seen.get(visitTree) + } + + seen.set(visitTree, null) + const res = visit ? visit(visitTree) : visitTree + if (isPromise(res)) { + const fullResult = res.then(resThen => { + seen.set(visitTree, resThen) + return kidNodes(visitTree) + }) + seen.set(visitTree, fullResult) + return fullResult + } else { + seen.set(visitTree, res) + return kidNodes(visitTree) + } + } + + const kidNodes = (kidTree) => { + const kids = getChildren(kidTree, seen.get(kidTree)) + return isPromise(kids) ? kids.then(processKids) : processKids(kids) + } + + const processKids = (kids) => { + kids = (kids || []).filter(filter) + stack.push(...kids) + } + + stack.push(tree) + return next() +} + +const isPromise = p => p && typeof p.then === 'function' + +module.exports = depth diff --git a/node_modules/npm/node_modules/treeverse/lib/depth.js b/node_modules/npm/node_modules/treeverse/lib/depth.js new file mode 100644 index 00000000..ecd13881 --- /dev/null +++ b/node_modules/npm/node_modules/treeverse/lib/depth.js @@ -0,0 +1,76 @@ +// Perform a depth-first walk of a tree. +// +// `visit(node)` is called when the node is first encountered. +// `leave(node, children)` is called when all of the node's children +// have been left or (in the case of cyclic graphs) visited. +// +// Only one of visit or leave is required. (Technically both are optional, +// but if you don't provide at least one, the tree is just walked without +// doing anything, which is a bit pointless.) If visit is provided, and +// leave is not, then this is a root->leaf traversal. If leave is provided, +// and visit is not, then it's leaf->root. Both can be provided for a +// map-reduce operation. +// +// If either visit or leave return a Promise for any node, then the +// walk returns a Promise. + +const depthDescent = require('./depth-descent.js') +const depth = ({ + visit, + leave, + filter = () => true, + seen = new Map(), + getChildren, + tree, +}) => { + if (!leave) { + return depthDescent({ visit, filter, getChildren, tree }) + } + + if (seen.has(tree)) { + return seen.get(tree) + } + + seen.set(tree, null) + + const visitNode = () => { + const res = visit ? visit(tree) : tree + if (isPromise(res)) { + const fullResult = res.then(resThen => { + seen.set(tree, resThen) + return kidNodes() + }) + seen.set(tree, fullResult) + return fullResult + } else { + seen.set(tree, res) + return kidNodes() + } + } + + const kidNodes = () => { + const kids = getChildren(tree, seen.get(tree)) + return isPromise(kids) ? kids.then(processKids) : processKids(kids) + } + + const processKids = nodes => { + const kids = (nodes || []).filter(filter).map(kid => + depth({ visit, leave, filter, seen, getChildren, tree: kid })) + return kids.some(isPromise) + ? Promise.all(kids).then(leaveNode) + : leaveNode(kids) + } + + const leaveNode = kids => { + const res = leave(seen.get(tree), kids) + seen.set(tree, res) + // if it's a promise at this point, the caller deals with it + return res + } + + return visitNode() +} + +const isPromise = p => p && typeof p.then === 'function' + +module.exports = depth diff --git a/node_modules/npm/node_modules/treeverse/lib/index.js b/node_modules/npm/node_modules/treeverse/lib/index.js new file mode 100644 index 00000000..f8e63157 --- /dev/null +++ b/node_modules/npm/node_modules/treeverse/lib/index.js @@ -0,0 +1,4 @@ +module.exports = { + breadth: require('./breadth.js'), + depth: require('./depth.js'), +} diff --git a/node_modules/npm/node_modules/treeverse/package.json b/node_modules/npm/node_modules/treeverse/package.json new file mode 100644 index 00000000..b8de0b21 --- /dev/null +++ b/node_modules/npm/node_modules/treeverse/package.json @@ -0,0 +1,51 @@ +{ + "name": "treeverse", + "version": "3.0.0", + "description": "Walk any kind of tree structure depth- or breadth-first. Supports promises and advanced map-reduce operations with a very small API.", + "author": "GitHub Inc.", + "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/npm/treeverse.git" + }, + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "eslint \"**/*.js\"", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint" + }, + "tap": { + "100": true, + "coverage-map": "test/coverage-map.js", + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "devDependencies": { + "@npmcli/eslint-config": "^3.0.1", + "@npmcli/template-oss": "4.5.1", + "tap": "^16.0.1" + }, + "files": [ + "bin/", + "lib/" + ], + "main": "lib/index.js", + "keywords": [ + "tree", + "traversal", + "depth first search", + "breadth first search" + ], + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.5.1" + } +} diff --git a/node_modules/npm/node_modules/tuf-js/LICENSE b/node_modules/npm/node_modules/tuf-js/LICENSE new file mode 100644 index 00000000..420700f5 --- /dev/null +++ b/node_modules/npm/node_modules/tuf-js/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 GitHub and the TUF 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/npm/node_modules/tuf-js/dist/config.js b/node_modules/npm/node_modules/tuf-js/dist/config.js new file mode 100644 index 00000000..c66d76af --- /dev/null +++ b/node_modules/npm/node_modules/tuf-js/dist/config.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.defaultConfig = void 0; +exports.defaultConfig = { + maxRootRotations: 256, + maxDelegations: 32, + rootMaxLength: 512000, //bytes + timestampMaxLength: 16384, // bytes + snapshotMaxLength: 2000000, // bytes + targetsMaxLength: 5000000, // bytes + prefixTargetsWithHash: true, + fetchTimeout: 100000, // milliseconds + fetchRetries: undefined, + fetchRetry: 2, +}; diff --git a/node_modules/npm/node_modules/tuf-js/dist/error.js b/node_modules/npm/node_modules/tuf-js/dist/error.js new file mode 100644 index 00000000..f4b10fa2 --- /dev/null +++ b/node_modules/npm/node_modules/tuf-js/dist/error.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DownloadHTTPError = exports.DownloadLengthMismatchError = exports.DownloadError = exports.ExpiredMetadataError = exports.EqualVersionError = exports.BadVersionError = exports.RepositoryError = exports.PersistError = exports.RuntimeError = exports.ValueError = void 0; +// An error about insufficient values +class ValueError extends Error { +} +exports.ValueError = ValueError; +class RuntimeError extends Error { +} +exports.RuntimeError = RuntimeError; +class PersistError extends Error { +} +exports.PersistError = PersistError; +// An error with a repository's state, such as a missing file. +// It covers all exceptions that come from the repository side when +// looking from the perspective of users of metadata API or ngclient. +class RepositoryError extends Error { +} +exports.RepositoryError = RepositoryError; +// An error for metadata that contains an invalid version number. +class BadVersionError extends RepositoryError { +} +exports.BadVersionError = BadVersionError; +// An error for metadata containing a previously verified version number. +class EqualVersionError extends BadVersionError { +} +exports.EqualVersionError = EqualVersionError; +// Indicate that a TUF Metadata file has expired. +class ExpiredMetadataError extends RepositoryError { +} +exports.ExpiredMetadataError = ExpiredMetadataError; +//----- Download Errors ------------------------------------------------------- +// An error occurred while attempting to download a file. +class DownloadError extends Error { +} +exports.DownloadError = DownloadError; +// Indicate that a mismatch of lengths was seen while downloading a file +class DownloadLengthMismatchError extends DownloadError { +} +exports.DownloadLengthMismatchError = DownloadLengthMismatchError; +// Returned by FetcherInterface implementations for HTTP errors. +class DownloadHTTPError extends DownloadError { + constructor(message, statusCode) { + super(message); + this.statusCode = statusCode; + } +} +exports.DownloadHTTPError = DownloadHTTPError; diff --git a/node_modules/npm/node_modules/tuf-js/dist/fetcher.js b/node_modules/npm/node_modules/tuf-js/dist/fetcher.js new file mode 100644 index 00000000..f966ce1b --- /dev/null +++ b/node_modules/npm/node_modules/tuf-js/dist/fetcher.js @@ -0,0 +1,84 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DefaultFetcher = exports.BaseFetcher = void 0; +const debug_1 = __importDefault(require("debug")); +const fs_1 = __importDefault(require("fs")); +const make_fetch_happen_1 = __importDefault(require("make-fetch-happen")); +const util_1 = __importDefault(require("util")); +const error_1 = require("./error"); +const tmpfile_1 = require("./utils/tmpfile"); +const log = (0, debug_1.default)('tuf:fetch'); +class BaseFetcher { + // Download file from given URL. The file is downloaded to a temporary + // location and then passed to the given handler. The handler is responsible + // for moving the file to its final location. The temporary file is deleted + // after the handler returns. + async downloadFile(url, maxLength, handler) { + return (0, tmpfile_1.withTempFile)(async (tmpFile) => { + const reader = await this.fetch(url); + let numberOfBytesReceived = 0; + const fileStream = fs_1.default.createWriteStream(tmpFile); + // Read the stream a chunk at a time so that we can check + // the length of the file as we go + try { + for await (const chunk of reader) { + const bufferChunk = Buffer.from(chunk); + numberOfBytesReceived += bufferChunk.length; + if (numberOfBytesReceived > maxLength) { + throw new error_1.DownloadLengthMismatchError('Max length reached'); + } + await writeBufferToStream(fileStream, bufferChunk); + } + } + finally { + // Make sure we always close the stream + await util_1.default.promisify(fileStream.close).bind(fileStream)(); + } + return handler(tmpFile); + }); + } + // Download bytes from given URL. + async downloadBytes(url, maxLength) { + return this.downloadFile(url, maxLength, async (file) => { + const stream = fs_1.default.createReadStream(file); + const chunks = []; + for await (const chunk of stream) { + chunks.push(chunk); + } + return Buffer.concat(chunks); + }); + } +} +exports.BaseFetcher = BaseFetcher; +class DefaultFetcher extends BaseFetcher { + constructor(options = {}) { + super(); + this.timeout = options.timeout; + this.retry = options.retry; + } + async fetch(url) { + log('GET %s', url); + const response = await (0, make_fetch_happen_1.default)(url, { + timeout: this.timeout, + retry: this.retry, + }); + if (!response.ok || !response?.body) { + throw new error_1.DownloadHTTPError('Failed to download', response.status); + } + return response.body; + } +} +exports.DefaultFetcher = DefaultFetcher; +const writeBufferToStream = async (stream, buffer) => { + return new Promise((resolve, reject) => { + stream.write(buffer, (err) => { + if (err) { + reject(err); + } + resolve(true); + }); + }); +}; diff --git a/node_modules/npm/node_modules/tuf-js/dist/index.js b/node_modules/npm/node_modules/tuf-js/dist/index.js new file mode 100644 index 00000000..5a83b91f --- /dev/null +++ b/node_modules/npm/node_modules/tuf-js/dist/index.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Updater = exports.BaseFetcher = exports.TargetFile = void 0; +var models_1 = require("@tufjs/models"); +Object.defineProperty(exports, "TargetFile", { enumerable: true, get: function () { return models_1.TargetFile; } }); +var fetcher_1 = require("./fetcher"); +Object.defineProperty(exports, "BaseFetcher", { enumerable: true, get: function () { return fetcher_1.BaseFetcher; } }); +var updater_1 = require("./updater"); +Object.defineProperty(exports, "Updater", { enumerable: true, get: function () { return updater_1.Updater; } }); diff --git a/node_modules/npm/node_modules/tuf-js/dist/store.js b/node_modules/npm/node_modules/tuf-js/dist/store.js new file mode 100644 index 00000000..85673361 --- /dev/null +++ b/node_modules/npm/node_modules/tuf-js/dist/store.js @@ -0,0 +1,208 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TrustedMetadataStore = void 0; +const models_1 = require("@tufjs/models"); +const error_1 = require("./error"); +class TrustedMetadataStore { + constructor(rootData) { + this.trustedSet = {}; + // Client workflow 5.1: record fixed update start time + this.referenceTime = new Date(); + // Client workflow 5.2: load trusted root metadata + this.loadTrustedRoot(rootData); + } + get root() { + if (!this.trustedSet.root) { + throw new ReferenceError('No trusted root metadata'); + } + return this.trustedSet.root; + } + get timestamp() { + return this.trustedSet.timestamp; + } + get snapshot() { + return this.trustedSet.snapshot; + } + get targets() { + return this.trustedSet.targets; + } + getRole(name) { + return this.trustedSet[name]; + } + updateRoot(bytesBuffer) { + const data = JSON.parse(bytesBuffer.toString('utf8')); + const newRoot = models_1.Metadata.fromJSON(models_1.MetadataKind.Root, data); + if (newRoot.signed.type != models_1.MetadataKind.Root) { + throw new error_1.RepositoryError(`Expected 'root', got ${newRoot.signed.type}`); + } + // Client workflow 5.4: check for arbitrary software attack + this.root.verifyDelegate(models_1.MetadataKind.Root, newRoot); + // Client workflow 5.5: check for rollback attack + if (newRoot.signed.version != this.root.signed.version + 1) { + throw new error_1.BadVersionError(`Expected version ${this.root.signed.version + 1}, got ${newRoot.signed.version}`); + } + // Check that new root is signed by self + newRoot.verifyDelegate(models_1.MetadataKind.Root, newRoot); + // Client workflow 5.7: set new root as trusted root + this.trustedSet.root = newRoot; + return newRoot; + } + updateTimestamp(bytesBuffer) { + if (this.snapshot) { + throw new error_1.RuntimeError('Cannot update timestamp after snapshot'); + } + if (this.root.signed.isExpired(this.referenceTime)) { + throw new error_1.ExpiredMetadataError('Final root.json is expired'); + } + const data = JSON.parse(bytesBuffer.toString('utf8')); + const newTimestamp = models_1.Metadata.fromJSON(models_1.MetadataKind.Timestamp, data); + if (newTimestamp.signed.type != models_1.MetadataKind.Timestamp) { + throw new error_1.RepositoryError(`Expected 'timestamp', got ${newTimestamp.signed.type}`); + } + // Client workflow 5.4.2: check for arbitrary software attack + this.root.verifyDelegate(models_1.MetadataKind.Timestamp, newTimestamp); + if (this.timestamp) { + // Prevent rolling back timestamp version + // Client workflow 5.4.3.1: check for rollback attack + if (newTimestamp.signed.version < this.timestamp.signed.version) { + throw new error_1.BadVersionError(`New timestamp version ${newTimestamp.signed.version} is less than current version ${this.timestamp.signed.version}`); + } + // Keep using old timestamp if versions are equal. + if (newTimestamp.signed.version === this.timestamp.signed.version) { + throw new error_1.EqualVersionError(`New timestamp version ${newTimestamp.signed.version} is equal to current version ${this.timestamp.signed.version}`); + } + // Prevent rolling back snapshot version + // Client workflow 5.4.3.2: check for rollback attack + const snapshotMeta = this.timestamp.signed.snapshotMeta; + const newSnapshotMeta = newTimestamp.signed.snapshotMeta; + if (newSnapshotMeta.version < snapshotMeta.version) { + throw new error_1.BadVersionError(`New snapshot version ${newSnapshotMeta.version} is less than current version ${snapshotMeta.version}`); + } + } + // expiry not checked to allow old timestamp to be used for rollback + // protection of new timestamp: expiry is checked in update_snapshot + this.trustedSet.timestamp = newTimestamp; + // Client workflow 5.4.4: check for freeze attack + this.checkFinalTimestamp(); + return newTimestamp; + } + updateSnapshot(bytesBuffer, trusted = false) { + if (!this.timestamp) { + throw new error_1.RuntimeError('Cannot update snapshot before timestamp'); + } + if (this.targets) { + throw new error_1.RuntimeError('Cannot update snapshot after targets'); + } + // Snapshot cannot be loaded if final timestamp is expired + this.checkFinalTimestamp(); + const snapshotMeta = this.timestamp.signed.snapshotMeta; + // Verify non-trusted data against the hashes in timestamp, if any. + // Trusted snapshot data has already been verified once. + // Client workflow 5.5.2: check against timestamp role's snaphsot hash + if (!trusted) { + snapshotMeta.verify(bytesBuffer); + } + const data = JSON.parse(bytesBuffer.toString('utf8')); + const newSnapshot = models_1.Metadata.fromJSON(models_1.MetadataKind.Snapshot, data); + if (newSnapshot.signed.type != models_1.MetadataKind.Snapshot) { + throw new error_1.RepositoryError(`Expected 'snapshot', got ${newSnapshot.signed.type}`); + } + // Client workflow 5.5.3: check for arbitrary software attack + this.root.verifyDelegate(models_1.MetadataKind.Snapshot, newSnapshot); + // version check against meta version (5.5.4) is deferred to allow old + // snapshot to be used in rollback protection + // Client workflow 5.5.5: check for rollback attack + if (this.snapshot) { + Object.entries(this.snapshot.signed.meta).forEach(([fileName, fileInfo]) => { + const newFileInfo = newSnapshot.signed.meta[fileName]; + if (!newFileInfo) { + throw new error_1.RepositoryError(`Missing file ${fileName} in new snapshot`); + } + if (newFileInfo.version < fileInfo.version) { + throw new error_1.BadVersionError(`New version ${newFileInfo.version} of ${fileName} is less than current version ${fileInfo.version}`); + } + }); + } + this.trustedSet.snapshot = newSnapshot; + // snapshot is loaded, but we raise if it's not valid _final_ snapshot + // Client workflow 5.5.4 & 5.5.6 + this.checkFinalSnapsnot(); + return newSnapshot; + } + updateDelegatedTargets(bytesBuffer, roleName, delegatorName) { + if (!this.snapshot) { + throw new error_1.RuntimeError('Cannot update delegated targets before snapshot'); + } + // Targets cannot be loaded if final snapshot is expired or its version + // does not match meta version in timestamp. + this.checkFinalSnapsnot(); + const delegator = this.trustedSet[delegatorName]; + if (!delegator) { + throw new error_1.RuntimeError(`No trusted ${delegatorName} metadata`); + } + // Extract metadata for the delegated role from snapshot + const meta = this.snapshot.signed.meta?.[`${roleName}.json`]; + if (!meta) { + throw new error_1.RepositoryError(`Missing ${roleName}.json in snapshot`); + } + // Client workflow 5.6.2: check against snapshot role's targets hash + meta.verify(bytesBuffer); + const data = JSON.parse(bytesBuffer.toString('utf8')); + const newDelegate = models_1.Metadata.fromJSON(models_1.MetadataKind.Targets, data); + if (newDelegate.signed.type != models_1.MetadataKind.Targets) { + throw new error_1.RepositoryError(`Expected 'targets', got ${newDelegate.signed.type}`); + } + // Client workflow 5.6.3: check for arbitrary software attack + delegator.verifyDelegate(roleName, newDelegate); + // Client workflow 5.6.4: Check against snapshot role’s targets version + const version = newDelegate.signed.version; + if (version != meta.version) { + throw new error_1.BadVersionError(`Version ${version} of ${roleName} does not match snapshot version ${meta.version}`); + } + // Client workflow 5.6.5: check for a freeze attack + if (newDelegate.signed.isExpired(this.referenceTime)) { + throw new error_1.ExpiredMetadataError(`${roleName}.json is expired`); + } + this.trustedSet[roleName] = newDelegate; + } + // Verifies and loads data as trusted root metadata. + // Note that an expired initial root is still considered valid. + loadTrustedRoot(bytesBuffer) { + const data = JSON.parse(bytesBuffer.toString('utf8')); + const root = models_1.Metadata.fromJSON(models_1.MetadataKind.Root, data); + if (root.signed.type != models_1.MetadataKind.Root) { + throw new error_1.RepositoryError(`Expected 'root', got ${root.signed.type}`); + } + root.verifyDelegate(models_1.MetadataKind.Root, root); + this.trustedSet['root'] = root; + } + checkFinalTimestamp() { + // Timestamp MUST be loaded + if (!this.timestamp) { + throw new ReferenceError('No trusted timestamp metadata'); + } + // Client workflow 5.4.4: check for freeze attack + if (this.timestamp.signed.isExpired(this.referenceTime)) { + throw new error_1.ExpiredMetadataError('Final timestamp.json is expired'); + } + } + checkFinalSnapsnot() { + // Snapshot and timestamp MUST be loaded + if (!this.snapshot) { + throw new ReferenceError('No trusted snapshot metadata'); + } + if (!this.timestamp) { + throw new ReferenceError('No trusted timestamp metadata'); + } + // Client workflow 5.5.6: check for freeze attack + if (this.snapshot.signed.isExpired(this.referenceTime)) { + throw new error_1.ExpiredMetadataError('snapshot.json is expired'); + } + // Client workflow 5.5.4: check against timestamp role’s snapshot version + const snapshotMeta = this.timestamp.signed.snapshotMeta; + if (this.snapshot.signed.version !== snapshotMeta.version) { + throw new error_1.BadVersionError("Snapshot version doesn't match timestamp"); + } + } +} +exports.TrustedMetadataStore = TrustedMetadataStore; diff --git a/node_modules/npm/node_modules/tuf-js/dist/updater.js b/node_modules/npm/node_modules/tuf-js/dist/updater.js new file mode 100644 index 00000000..8d5eb442 --- /dev/null +++ b/node_modules/npm/node_modules/tuf-js/dist/updater.js @@ -0,0 +1,350 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Updater = void 0; +const models_1 = require("@tufjs/models"); +const debug_1 = __importDefault(require("debug")); +const fs = __importStar(require("fs")); +const path = __importStar(require("path")); +const config_1 = require("./config"); +const error_1 = require("./error"); +const fetcher_1 = require("./fetcher"); +const store_1 = require("./store"); +const url = __importStar(require("./utils/url")); +const log = (0, debug_1.default)('tuf:cache'); +class Updater { + constructor(options) { + const { metadataDir, metadataBaseUrl, targetDir, targetBaseUrl, fetcher, config, } = options; + this.dir = metadataDir; + this.metadataBaseUrl = metadataBaseUrl; + this.targetDir = targetDir; + this.targetBaseUrl = targetBaseUrl; + this.forceCache = options.forceCache ?? false; + const data = this.loadLocalMetadata(models_1.MetadataKind.Root); + this.trustedSet = new store_1.TrustedMetadataStore(data); + this.config = { ...config_1.defaultConfig, ...config }; + this.fetcher = + fetcher || + new fetcher_1.DefaultFetcher({ + timeout: this.config.fetchTimeout, + retry: this.config.fetchRetries ?? this.config.fetchRetry, + }); + } + // refresh and load the metadata before downloading the target + // refresh should be called once after the client is initialized + async refresh() { + // If forceCache is true, try to load the timestamp from local storage + // without fetching it from the remote. Otherwise, load the root and + // timestamp from the remote per the TUF spec. + if (this.forceCache) { + // If anything fails, load the root and timestamp from the remote. This + // should cover any situation where the local metadata is corrupted or + // expired. + try { + await this.loadTimestamp({ checkRemote: false }); + } + catch (error) { + await this.loadRoot(); + await this.loadTimestamp(); + } + } + else { + await this.loadRoot(); + await this.loadTimestamp(); + } + await this.loadSnapshot(); + await this.loadTargets(models_1.MetadataKind.Targets, models_1.MetadataKind.Root); + } + // Returns the TargetFile instance with information for the given target path. + // + // Implicitly calls refresh if it hasn't already been called. + async getTargetInfo(targetPath) { + if (!this.trustedSet.targets) { + await this.refresh(); + } + return this.preorderDepthFirstWalk(targetPath); + } + async downloadTarget(targetInfo, filePath, targetBaseUrl) { + const targetPath = filePath || this.generateTargetPath(targetInfo); + if (!targetBaseUrl) { + if (!this.targetBaseUrl) { + throw new error_1.ValueError('Target base URL not set'); + } + targetBaseUrl = this.targetBaseUrl; + } + let targetFilePath = targetInfo.path; + const consistentSnapshot = this.trustedSet.root.signed.consistentSnapshot; + if (consistentSnapshot && this.config.prefixTargetsWithHash) { + const hashes = Object.values(targetInfo.hashes); + const { dir, base } = path.parse(targetFilePath); + const filename = `${hashes[0]}.${base}`; + targetFilePath = dir ? `${dir}/${filename}` : filename; + } + const targetUrl = url.join(targetBaseUrl, targetFilePath); + // Client workflow 5.7.3: download target file + await this.fetcher.downloadFile(targetUrl, targetInfo.length, async (fileName) => { + // Verify hashes and length of downloaded file + await targetInfo.verify(fs.createReadStream(fileName)); + // Copy file to target path + log('WRITE %s', targetPath); + fs.copyFileSync(fileName, targetPath); + }); + return targetPath; + } + async findCachedTarget(targetInfo, filePath) { + if (!filePath) { + filePath = this.generateTargetPath(targetInfo); + } + try { + if (fs.existsSync(filePath)) { + await targetInfo.verify(fs.createReadStream(filePath)); + return filePath; + } + } + catch (error) { + return; // File not found + } + return; // File not found + } + loadLocalMetadata(fileName) { + const filePath = path.join(this.dir, `${fileName}.json`); + log('READ %s', filePath); + return fs.readFileSync(filePath); + } + // Sequentially load and persist on local disk every newer root metadata + // version available on the remote. + // Client workflow 5.3: update root role + async loadRoot() { + // Client workflow 5.3.2: version of trusted root metadata file + const rootVersion = this.trustedSet.root.signed.version; + const lowerBound = rootVersion + 1; + const upperBound = lowerBound + this.config.maxRootRotations; + for (let version = lowerBound; version < upperBound; version++) { + const rootUrl = url.join(this.metadataBaseUrl, `${version}.root.json`); + try { + // Client workflow 5.3.3: download new root metadata file + const bytesData = await this.fetcher.downloadBytes(rootUrl, this.config.rootMaxLength); + // Client workflow 5.3.4 - 5.4.7 + this.trustedSet.updateRoot(bytesData); + // Client workflow 5.3.8: persist root metadata file + this.persistMetadata(models_1.MetadataKind.Root, bytesData); + } + catch (error) { + if (error instanceof error_1.DownloadHTTPError) { + // 404/403 means current root is newest available + if ([403, 404].includes(error.statusCode)) { + break; + } + } + throw error; + } + } + } + // Load local and remote timestamp metadata. + // Client workflow 5.4: update timestamp role + async loadTimestamp({ checkRemote } = { checkRemote: true }) { + // Load local and remote timestamp metadata + try { + const data = this.loadLocalMetadata(models_1.MetadataKind.Timestamp); + this.trustedSet.updateTimestamp(data); + // If checkRemote is disabled, return here to avoid fetching the remote + // timestamp metadata. + if (!checkRemote) { + return; + } + } + catch (error) { + // continue + } + //Load from remote (whether local load succeeded or not) + const timestampUrl = url.join(this.metadataBaseUrl, 'timestamp.json'); + // Client workflow 5.4.1: download timestamp metadata file + const bytesData = await this.fetcher.downloadBytes(timestampUrl, this.config.timestampMaxLength); + try { + // Client workflow 5.4.2 - 5.4.4 + this.trustedSet.updateTimestamp(bytesData); + } + catch (error) { + // If new timestamp version is same as current, discardd the new one. + // This is normal and should NOT raise an error. + if (error instanceof error_1.EqualVersionError) { + return; + } + // Re-raise any other error + throw error; + } + // Client workflow 5.4.5: persist timestamp metadata + this.persistMetadata(models_1.MetadataKind.Timestamp, bytesData); + } + // Load local and remote snapshot metadata. + // Client workflow 5.5: update snapshot role + async loadSnapshot() { + //Load local (and if needed remote) snapshot metadata + try { + const data = this.loadLocalMetadata(models_1.MetadataKind.Snapshot); + this.trustedSet.updateSnapshot(data, true); + } + catch (error) { + if (!this.trustedSet.timestamp) { + throw new ReferenceError('No timestamp metadata'); + } + const snapshotMeta = this.trustedSet.timestamp.signed.snapshotMeta; + const maxLength = snapshotMeta.length || this.config.snapshotMaxLength; + const version = this.trustedSet.root.signed.consistentSnapshot + ? snapshotMeta.version + : undefined; + const snapshotUrl = url.join(this.metadataBaseUrl, version ? `${version}.snapshot.json` : 'snapshot.json'); + try { + // Client workflow 5.5.1: download snapshot metadata file + const bytesData = await this.fetcher.downloadBytes(snapshotUrl, maxLength); + // Client workflow 5.5.2 - 5.5.6 + this.trustedSet.updateSnapshot(bytesData); + // Client workflow 5.5.7: persist snapshot metadata file + this.persistMetadata(models_1.MetadataKind.Snapshot, bytesData); + } + catch (error) { + throw new error_1.RuntimeError(`Unable to load snapshot metadata error ${error}`); + } + } + } + // Load local and remote targets metadata. + // Client workflow 5.6: update targets role + async loadTargets(role, parentRole) { + if (this.trustedSet.getRole(role)) { + return this.trustedSet.getRole(role); + } + try { + const buffer = this.loadLocalMetadata(role); + this.trustedSet.updateDelegatedTargets(buffer, role, parentRole); + } + catch (error) { + // Local 'role' does not exist or is invalid: update from remote + if (!this.trustedSet.snapshot) { + throw new ReferenceError('No snapshot metadata'); + } + const metaInfo = this.trustedSet.snapshot.signed.meta[`${role}.json`]; + // TODO: use length for fetching + const maxLength = metaInfo.length || this.config.targetsMaxLength; + const version = this.trustedSet.root.signed.consistentSnapshot + ? metaInfo.version + : undefined; + const encodedRole = encodeURIComponent(role); + const metadataUrl = url.join(this.metadataBaseUrl, version ? `${version}.${encodedRole}.json` : `${encodedRole}.json`); + try { + // Client workflow 5.6.1: download targets metadata file + const bytesData = await this.fetcher.downloadBytes(metadataUrl, maxLength); + // Client workflow 5.6.2 - 5.6.6 + this.trustedSet.updateDelegatedTargets(bytesData, role, parentRole); + // Client workflow 5.6.7: persist targets metadata file + this.persistMetadata(role, bytesData); + } + catch (error) { + throw new error_1.RuntimeError(`Unable to load targets error ${error}`); + } + } + return this.trustedSet.getRole(role); + } + async preorderDepthFirstWalk(targetPath) { + // Interrogates the tree of target delegations in order of appearance + // (which implicitly order trustworthiness), and returns the matching + // target found in the most trusted role. + // List of delegations to be interrogated. A (role, parent role) pair + // is needed to load and verify the delegated targets metadata. + const delegationsToVisit = [ + { + roleName: models_1.MetadataKind.Targets, + parentRoleName: models_1.MetadataKind.Root, + }, + ]; + const visitedRoleNames = new Set(); + // Client workflow 5.6.7: preorder depth-first traversal of the graph of + // target delegations + while (visitedRoleNames.size <= this.config.maxDelegations && + delegationsToVisit.length > 0) { + // Pop the role name from the top of the stack. + const { roleName, parentRoleName } = delegationsToVisit.pop(); + // Skip any visited current role to prevent cycles. + // Client workflow 5.6.7.1: skip already-visited roles + if (visitedRoleNames.has(roleName)) { + continue; + } + // The metadata for 'role_name' must be downloaded/updated before + // its targets, delegations, and child roles can be inspected. + const targets = (await this.loadTargets(roleName, parentRoleName)) + ?.signed; + if (!targets) { + continue; + } + const target = targets.targets?.[targetPath]; + if (target) { + return target; + } + // After preorder check, add current role to set of visited roles. + visitedRoleNames.add(roleName); + if (targets.delegations) { + const childRolesToVisit = []; + // NOTE: This may be a slow operation if there are many delegated roles. + const rolesForTarget = targets.delegations.rolesForTarget(targetPath); + for (const { role: childName, terminating } of rolesForTarget) { + childRolesToVisit.push({ + roleName: childName, + parentRoleName: roleName, + }); + // Client workflow 5.6.7.2.1 + if (terminating) { + delegationsToVisit.splice(0); // empty the array + break; + } + } + childRolesToVisit.reverse(); + delegationsToVisit.push(...childRolesToVisit); + } + } + return; // no matching target found + } + generateTargetPath(targetInfo) { + if (!this.targetDir) { + throw new error_1.ValueError('Target directory not set'); + } + // URL encode target path + const filePath = encodeURIComponent(targetInfo.path); + return path.join(this.targetDir, filePath); + } + persistMetadata(metaDataName, bytesData) { + const encodedName = encodeURIComponent(metaDataName); + try { + const filePath = path.join(this.dir, `${encodedName}.json`); + log('WRITE %s', filePath); + fs.writeFileSync(filePath, bytesData.toString('utf8')); + } + catch (error) { + throw new error_1.PersistError(`Failed to persist metadata ${encodedName} error: ${error}`); + } + } +} +exports.Updater = Updater; diff --git a/node_modules/npm/node_modules/tuf-js/dist/utils/tmpfile.js b/node_modules/npm/node_modules/tuf-js/dist/utils/tmpfile.js new file mode 100644 index 00000000..923eef60 --- /dev/null +++ b/node_modules/npm/node_modules/tuf-js/dist/utils/tmpfile.js @@ -0,0 +1,25 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withTempFile = void 0; +const promises_1 = __importDefault(require("fs/promises")); +const os_1 = __importDefault(require("os")); +const path_1 = __importDefault(require("path")); +// Invokes the given handler with the path to a temporary file. The file +// is deleted after the handler returns. +const withTempFile = async (handler) => withTempDir(async (dir) => handler(path_1.default.join(dir, 'tempfile'))); +exports.withTempFile = withTempFile; +// Invokes the given handler with a temporary directory. The directory is +// deleted after the handler returns. +const withTempDir = async (handler) => { + const tmpDir = await promises_1.default.realpath(os_1.default.tmpdir()); + const dir = await promises_1.default.mkdtemp(tmpDir + path_1.default.sep); + try { + return await handler(dir); + } + finally { + await promises_1.default.rm(dir, { force: true, recursive: true, maxRetries: 3 }); + } +}; diff --git a/node_modules/npm/node_modules/tuf-js/dist/utils/url.js b/node_modules/npm/node_modules/tuf-js/dist/utils/url.js new file mode 100644 index 00000000..359d1f3e --- /dev/null +++ b/node_modules/npm/node_modules/tuf-js/dist/utils/url.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.join = join; +const url_1 = require("url"); +function join(base, path) { + return new url_1.URL(ensureTrailingSlash(base) + removeLeadingSlash(path)).toString(); +} +function ensureTrailingSlash(path) { + return path.endsWith('/') ? path : path + '/'; +} +function removeLeadingSlash(path) { + return path.startsWith('/') ? path.slice(1) : path; +} diff --git a/node_modules/npm/node_modules/tuf-js/package.json b/node_modules/npm/node_modules/tuf-js/package.json new file mode 100644 index 00000000..e79a3d45 --- /dev/null +++ b/node_modules/npm/node_modules/tuf-js/package.json @@ -0,0 +1,43 @@ +{ + "name": "tuf-js", + "version": "3.0.1", + "description": "JavaScript implementation of The Update Framework (TUF)", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "tsc --build", + "clean": "rm -rf dist && rm tsconfig.tsbuildinfo", + "test": "jest" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/theupdateframework/tuf-js.git" + }, + "files": [ + "dist" + ], + "keywords": [ + "tuf", + "security", + "update" + ], + "author": "bdehamer@github.com", + "license": "MIT", + "bugs": { + "url": "https://github.com/theupdateframework/tuf-js/issues" + }, + "homepage": "https://github.com/theupdateframework/tuf-js/tree/main/packages/client#readme", + "devDependencies": { + "@tufjs/repo-mock": "3.0.1", + "@types/debug": "^4.1.12", + "@types/make-fetch-happen": "^10.0.4" + }, + "dependencies": { + "@tufjs/models": "3.0.1", + "debug": "^4.3.6", + "make-fetch-happen": "^14.0.1" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } +} diff --git a/node_modules/npm/node_modules/unique-filename/LICENSE b/node_modules/npm/node_modules/unique-filename/LICENSE new file mode 100644 index 00000000..69619c12 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/unique-filename/lib/index.js b/node_modules/npm/node_modules/unique-filename/lib/index.js new file mode 100644 index 00000000..d067d2e7 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/unique-filename/package.json b/node_modules/npm/node_modules/unique-filename/package.json new file mode 100644 index 00000000..a08196e1 --- /dev/null +++ b/node_modules/npm/node_modules/unique-filename/package.json @@ -0,0 +1,53 @@ +{ + "name": "unique-filename", + "version": "4.0.0", + "description": "Generate a unique filename for use in temporary directories or caches.", + "main": "lib/index.js", + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+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": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.3.0" + }, + "dependencies": { + "unique-slug": "^5.0.0" + }, + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/unique-slug/LICENSE b/node_modules/npm/node_modules/unique-slug/LICENSE new file mode 100644 index 00000000..7953647e --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/unique-slug/lib/index.js b/node_modules/npm/node_modules/unique-slug/lib/index.js new file mode 100644 index 00000000..1bac84d9 --- /dev/null +++ b/node_modules/npm/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/npm/node_modules/unique-slug/package.json b/node_modules/npm/node_modules/unique-slug/package.json new file mode 100644 index 00000000..b4d287ae --- /dev/null +++ b/node_modules/npm/node_modules/unique-slug/package.json @@ -0,0 +1,49 @@ +{ + "name": "unique-slug", + "version": "5.0.0", + "description": "Generate a unique character string suitible for use in files and URLs.", + "main": "lib/index.js", + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "keywords": [], + "author": "GitHub Inc.", + "license": "ISC", + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.3.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/unique-slug.git" + }, + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/util-deprecate/History.md b/node_modules/npm/node_modules/util-deprecate/History.md new file mode 100644 index 00000000..acc86753 --- /dev/null +++ b/node_modules/npm/node_modules/util-deprecate/History.md @@ -0,0 +1,16 @@ + +1.0.2 / 2015-10-07 +================== + + * use try/catch when checking `localStorage` (#3, @kumavis) + +1.0.1 / 2014-11-25 +================== + + * browser: use `console.warn()` for deprecation calls + * browser: more jsdocs + +1.0.0 / 2014-04-30 +================== + + * initial commit diff --git a/node_modules/npm/node_modules/util-deprecate/LICENSE b/node_modules/npm/node_modules/util-deprecate/LICENSE new file mode 100644 index 00000000..6a60e8c2 --- /dev/null +++ b/node_modules/npm/node_modules/util-deprecate/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2014 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/npm/node_modules/util-deprecate/browser.js b/node_modules/npm/node_modules/util-deprecate/browser.js new file mode 100644 index 00000000..549ae2f0 --- /dev/null +++ b/node_modules/npm/node_modules/util-deprecate/browser.js @@ -0,0 +1,67 @@ + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} diff --git a/node_modules/npm/node_modules/util-deprecate/node.js b/node_modules/npm/node_modules/util-deprecate/node.js new file mode 100644 index 00000000..5e6fcff5 --- /dev/null +++ b/node_modules/npm/node_modules/util-deprecate/node.js @@ -0,0 +1,6 @@ + +/** + * For Node.js, simply re-export the core `util.deprecate` function. + */ + +module.exports = require('util').deprecate; diff --git a/node_modules/npm/node_modules/util-deprecate/package.json b/node_modules/npm/node_modules/util-deprecate/package.json new file mode 100644 index 00000000..2e79f89a --- /dev/null +++ b/node_modules/npm/node_modules/util-deprecate/package.json @@ -0,0 +1,27 @@ +{ + "name": "util-deprecate", + "version": "1.0.2", + "description": "The Node.js `util.deprecate()` function with browser support", + "main": "node.js", + "browser": "browser.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/util-deprecate.git" + }, + "keywords": [ + "util", + "deprecate", + "browserify", + "browser", + "node" + ], + "author": "Nathan Rajlich (http://n8.io/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/TooTallNate/util-deprecate/issues" + }, + "homepage": "https://github.com/TooTallNate/util-deprecate" +} diff --git a/node_modules/npm/node_modules/validate-npm-package-license/LICENSE b/node_modules/npm/node_modules/validate-npm-package-license/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-license/LICENSE @@ -0,0 +1,202 @@ + + 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 + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/node_modules/npm/node_modules/validate-npm-package-license/index.js b/node_modules/npm/node_modules/validate-npm-package-license/index.js new file mode 100644 index 00000000..35eaa732 --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-license/index.js @@ -0,0 +1,86 @@ +var parse = require('spdx-expression-parse'); +var correct = require('spdx-correct'); + +var genericWarning = ( + 'license should be ' + + 'a valid SPDX license expression (without "LicenseRef"), ' + + '"UNLICENSED", or ' + + '"SEE LICENSE IN "' +); + +var fileReferenceRE = /^SEE LICEN[CS]E IN (.+)$/; + +function startsWith(prefix, string) { + return string.slice(0, prefix.length) === prefix; +} + +function usesLicenseRef(ast) { + if (ast.hasOwnProperty('license')) { + var license = ast.license; + return ( + startsWith('LicenseRef', license) || + startsWith('DocumentRef', license) + ); + } else { + return ( + usesLicenseRef(ast.left) || + usesLicenseRef(ast.right) + ); + } +} + +module.exports = function(argument) { + var ast; + + try { + ast = parse(argument); + } catch (e) { + var match + if ( + argument === 'UNLICENSED' || + argument === 'UNLICENCED' + ) { + return { + validForOldPackages: true, + validForNewPackages: true, + unlicensed: true + }; + } else if (match = fileReferenceRE.exec(argument)) { + return { + validForOldPackages: true, + validForNewPackages: true, + inFile: match[1] + }; + } else { + var result = { + validForOldPackages: false, + validForNewPackages: false, + warnings: [genericWarning] + }; + if (argument.trim().length !== 0) { + var corrected = correct(argument); + if (corrected) { + result.warnings.push( + 'license is similar to the valid expression "' + corrected + '"' + ); + } + } + return result; + } + } + + if (usesLicenseRef(ast)) { + return { + validForNewPackages: false, + validForOldPackages: false, + spdx: true, + warnings: [genericWarning] + }; + } else { + return { + validForNewPackages: true, + validForOldPackages: true, + spdx: true + }; + } +}; diff --git a/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/AUTHORS b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/AUTHORS new file mode 100644 index 00000000..257a76b9 --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/AUTHORS @@ -0,0 +1,4 @@ +C. Scott Ananian (http://cscott.net) +Kyle E. Mitchell (https://kemitchell.com) +Shinnosuke Watanabe +Antoine Motet diff --git a/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/LICENSE b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/LICENSE new file mode 100644 index 00000000..831618ea --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/LICENSE @@ -0,0 +1,22 @@ +The MIT License + +Copyright (c) 2015 Kyle E. Mitchell & other authors listed in AUTHORS + +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/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/index.js b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/index.js new file mode 100644 index 00000000..52fab560 --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/index.js @@ -0,0 +1,8 @@ +'use strict' + +var scan = require('./scan') +var parse = require('./parse') + +module.exports = function (source) { + return parse(scan(source)) +} diff --git a/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/package.json b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/package.json new file mode 100644 index 00000000..c9edc9f9 --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/package.json @@ -0,0 +1,39 @@ +{ + "name": "spdx-expression-parse", + "description": "parse SPDX license expressions", + "version": "3.0.1", + "author": "Kyle E. Mitchell (https://kemitchell.com)", + "files": [ + "AUTHORS", + "index.js", + "parse.js", + "scan.js" + ], + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + }, + "devDependencies": { + "defence-cli": "^3.0.1", + "replace-require-self": "^1.0.0", + "standard": "^14.1.0" + }, + "keywords": [ + "SPDX", + "law", + "legal", + "license", + "metadata", + "package", + "package.json", + "standards" + ], + "license": "MIT", + "repository": "jslicense/spdx-expression-parse.js", + "scripts": { + "lint": "standard", + "test:readme": "defence -i javascript README.md | replace-require-self | node", + "test:suite": "node test.js", + "test": "npm run test:suite && npm run test:readme" + } +} diff --git a/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/parse.js b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/parse.js new file mode 100644 index 00000000..5a00b45c --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/parse.js @@ -0,0 +1,138 @@ +'use strict' + +// The ABNF grammar in the spec is totally ambiguous. +// +// This parser follows the operator precedence defined in the +// `Order of Precedence and Parentheses` section. + +module.exports = function (tokens) { + var index = 0 + + function hasMore () { + return index < tokens.length + } + + function token () { + return hasMore() ? tokens[index] : null + } + + function next () { + if (!hasMore()) { + throw new Error() + } + index++ + } + + function parseOperator (operator) { + var t = token() + if (t && t.type === 'OPERATOR' && operator === t.string) { + next() + return t.string + } + } + + function parseWith () { + if (parseOperator('WITH')) { + var t = token() + if (t && t.type === 'EXCEPTION') { + next() + return t.string + } + throw new Error('Expected exception after `WITH`') + } + } + + function parseLicenseRef () { + // TODO: Actually, everything is concatenated into one string + // for backward-compatibility but it could be better to return + // a nice structure. + var begin = index + var string = '' + var t = token() + if (t.type === 'DOCUMENTREF') { + next() + string += 'DocumentRef-' + t.string + ':' + if (!parseOperator(':')) { + throw new Error('Expected `:` after `DocumentRef-...`') + } + } + t = token() + if (t.type === 'LICENSEREF') { + next() + string += 'LicenseRef-' + t.string + return { license: string } + } + index = begin + } + + function parseLicense () { + var t = token() + if (t && t.type === 'LICENSE') { + next() + var node = { license: t.string } + if (parseOperator('+')) { + node.plus = true + } + var exception = parseWith() + if (exception) { + node.exception = exception + } + return node + } + } + + function parseParenthesizedExpression () { + var left = parseOperator('(') + if (!left) { + return + } + + var expr = parseExpression() + + if (!parseOperator(')')) { + throw new Error('Expected `)`') + } + + return expr + } + + function parseAtom () { + return ( + parseParenthesizedExpression() || + parseLicenseRef() || + parseLicense() + ) + } + + function makeBinaryOpParser (operator, nextParser) { + return function parseBinaryOp () { + var left = nextParser() + if (!left) { + return + } + + if (!parseOperator(operator)) { + return left + } + + var right = parseBinaryOp() + if (!right) { + throw new Error('Expected expression') + } + return { + left: left, + conjunction: operator.toLowerCase(), + right: right + } + } + } + + var parseAnd = makeBinaryOpParser('AND', parseAtom) + var parseExpression = makeBinaryOpParser('OR', parseAnd) + + var node = parseExpression() + if (!node || hasMore()) { + throw new Error('Syntax error') + } + return node +} diff --git a/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/scan.js b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/scan.js new file mode 100644 index 00000000..b74fce2e --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse/scan.js @@ -0,0 +1,131 @@ +'use strict' + +var licenses = [] + .concat(require('spdx-license-ids')) + .concat(require('spdx-license-ids/deprecated')) +var exceptions = require('spdx-exceptions') + +module.exports = function (source) { + var index = 0 + + function hasMore () { + return index < source.length + } + + // `value` can be a regexp or a string. + // If it is recognized, the matching source string is returned and + // the index is incremented. Otherwise `undefined` is returned. + function read (value) { + if (value instanceof RegExp) { + var chars = source.slice(index) + var match = chars.match(value) + if (match) { + index += match[0].length + return match[0] + } + } else { + if (source.indexOf(value, index) === index) { + index += value.length + return value + } + } + } + + function skipWhitespace () { + read(/[ ]*/) + } + + function operator () { + var string + var possibilities = ['WITH', 'AND', 'OR', '(', ')', ':', '+'] + for (var i = 0; i < possibilities.length; i++) { + string = read(possibilities[i]) + if (string) { + break + } + } + + if (string === '+' && index > 1 && source[index - 2] === ' ') { + throw new Error('Space before `+`') + } + + return string && { + type: 'OPERATOR', + string: string + } + } + + function idstring () { + return read(/[A-Za-z0-9-.]+/) + } + + function expectIdstring () { + var string = idstring() + if (!string) { + throw new Error('Expected idstring at offset ' + index) + } + return string + } + + function documentRef () { + if (read('DocumentRef-')) { + var string = expectIdstring() + return { type: 'DOCUMENTREF', string: string } + } + } + + function licenseRef () { + if (read('LicenseRef-')) { + var string = expectIdstring() + return { type: 'LICENSEREF', string: string } + } + } + + function identifier () { + var begin = index + var string = idstring() + + if (licenses.indexOf(string) !== -1) { + return { + type: 'LICENSE', + string: string + } + } else if (exceptions.indexOf(string) !== -1) { + return { + type: 'EXCEPTION', + string: string + } + } + + index = begin + } + + // Tries to read the next token. Returns `undefined` if no token is + // recognized. + function parseToken () { + // Ordering matters + return ( + operator() || + documentRef() || + licenseRef() || + identifier() + ) + } + + var tokens = [] + while (hasMore()) { + skipWhitespace() + if (!hasMore()) { + break + } + + var token = parseToken() + if (!token) { + throw new Error('Unexpected `' + source[index] + + '` at offset ' + index) + } + + tokens.push(token) + } + return tokens +} diff --git a/node_modules/npm/node_modules/validate-npm-package-license/package.json b/node_modules/npm/node_modules/validate-npm-package-license/package.json new file mode 100644 index 00000000..9e92af4f --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-license/package.json @@ -0,0 +1,28 @@ +{ + "name": "validate-npm-package-license", + "description": "Give me a string and I'll tell you if it's a valid npm package license string", + "version": "3.0.4", + "author": "Kyle E. Mitchell (https://kemitchell.com)", + "contributors": [ + "Mark Stacey " + ], + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + }, + "devDependencies": { + "defence-cli": "^2.0.1", + "replace-require-self": "^1.0.0" + }, + "keywords": [ + "license", + "npm", + "package", + "validation" + ], + "license": "Apache-2.0", + "repository": "kemitchell/validate-npm-package-license.js", + "scripts": { + "test": "defence README.md | replace-require-self | node" + } +} diff --git a/node_modules/npm/node_modules/validate-npm-package-name/LICENSE b/node_modules/npm/node_modules/validate-npm-package-name/LICENSE new file mode 100644 index 00000000..fdcd63b3 --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-name/LICENSE @@ -0,0 +1,6 @@ +Copyright (c) 2015, 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/npm/node_modules/validate-npm-package-name/lib/index.js b/node_modules/npm/node_modules/validate-npm-package-name/lib/index.js new file mode 100644 index 00000000..fd800d5a --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-name/lib/index.js @@ -0,0 +1,105 @@ +'use strict' +const { builtinModules: builtins } = require('module') + +var scopedPackagePattern = new RegExp('^(?:@([^/]+?)[/])?([^/]+?)$') +var blacklist = [ + 'node_modules', + 'favicon.ico', +] + +function validate (name) { + var warnings = [] + var errors = [] + + if (name === null) { + errors.push('name cannot be null') + return done(warnings, errors) + } + + if (name === undefined) { + errors.push('name cannot be undefined') + return done(warnings, errors) + } + + if (typeof name !== 'string') { + errors.push('name must be a string') + return done(warnings, errors) + } + + if (!name.length) { + errors.push('name length must be greater than zero') + } + + if (name.match(/^\./)) { + errors.push('name cannot start with a period') + } + + if (name.match(/^_/)) { + errors.push('name cannot start with an underscore') + } + + if (name.trim() !== name) { + errors.push('name cannot contain leading or trailing spaces') + } + + // No funny business + blacklist.forEach(function (blacklistedName) { + if (name.toLowerCase() === blacklistedName) { + errors.push(blacklistedName + ' is a blacklisted name') + } + }) + + // Generate warnings for stuff that used to be allowed + + // core module names like http, events, util, etc + if (builtins.includes(name.toLowerCase())) { + warnings.push(name + ' is a core module name') + } + + if (name.length > 214) { + warnings.push('name can no longer contain more than 214 characters') + } + + // mIxeD CaSe nAMEs + if (name.toLowerCase() !== name) { + warnings.push('name can no longer contain capital letters') + } + + if (/[~'!()*]/.test(name.split('/').slice(-1)[0])) { + warnings.push('name can no longer contain special characters ("~\'!()*")') + } + + if (encodeURIComponent(name) !== name) { + // Maybe it's a scoped package name, like @user/package + var nameMatch = name.match(scopedPackagePattern) + if (nameMatch) { + var user = nameMatch[1] + var pkg = nameMatch[2] + if (encodeURIComponent(user) === user && encodeURIComponent(pkg) === pkg) { + return done(warnings, errors) + } + } + + errors.push('name can only contain URL-friendly characters') + } + + return done(warnings, errors) +} + +var done = function (warnings, errors) { + var result = { + validForNewPackages: errors.length === 0 && warnings.length === 0, + validForOldPackages: errors.length === 0, + warnings: warnings, + errors: errors, + } + if (!result.warnings.length) { + delete result.warnings + } + if (!result.errors.length) { + delete result.errors + } + return result +} + +module.exports = validate diff --git a/node_modules/npm/node_modules/validate-npm-package-name/package.json b/node_modules/npm/node_modules/validate-npm-package-name/package.json new file mode 100644 index 00000000..42089cbb --- /dev/null +++ b/node_modules/npm/node_modules/validate-npm-package-name/package.json @@ -0,0 +1,61 @@ +{ + "name": "validate-npm-package-name", + "version": "6.0.0", + "description": "Give me a string and I'll tell you if it's a valid npm package name", + "main": "lib/", + "directories": { + "test": "test" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.0.1" + }, + "scripts": { + "cov:test": "TAP_FLAGS='--cov' npm run test:code", + "test:code": "tap ${TAP_FLAGS:-'--'} test/*.js", + "test:style": "standard", + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/validate-npm-package-name.git" + }, + "keywords": [ + "npm", + "package", + "names", + "validation" + ], + "author": "GitHub Inc.", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/validate-npm-package-name/issues" + }, + "homepage": "https://github.com/npm/validate-npm-package-name", + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": true + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/walk-up-path/LICENSE b/node_modules/npm/node_modules/walk-up-path/LICENSE new file mode 100644 index 00000000..d7105826 --- /dev/null +++ b/node_modules/npm/node_modules/walk-up-path/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2020-2023 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/npm/node_modules/walk-up-path/dist/commonjs/index.js b/node_modules/npm/node_modules/walk-up-path/dist/commonjs/index.js new file mode 100644 index 00000000..9295d00c --- /dev/null +++ b/node_modules/npm/node_modules/walk-up-path/dist/commonjs/index.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.walkUp = void 0; +const path_1 = require("path"); +const walkUp = function* (path) { + for (path = (0, path_1.resolve)(path); path;) { + yield path; + const pp = (0, path_1.dirname)(path); + if (pp === path) { + break; + } + else { + path = pp; + } + } +}; +exports.walkUp = walkUp; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/walk-up-path/dist/commonjs/package.json b/node_modules/npm/node_modules/walk-up-path/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/walk-up-path/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/walk-up-path/dist/esm/index.js b/node_modules/npm/node_modules/walk-up-path/dist/esm/index.js new file mode 100644 index 00000000..93f37e1d --- /dev/null +++ b/node_modules/npm/node_modules/walk-up-path/dist/esm/index.js @@ -0,0 +1,14 @@ +import { dirname, resolve } from 'path'; +export const walkUp = function* (path) { + for (path = resolve(path); path;) { + yield path; + const pp = dirname(path); + if (pp === path) { + break; + } + else { + path = pp; + } + } +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/walk-up-path/dist/esm/package.json b/node_modules/npm/node_modules/walk-up-path/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/walk-up-path/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/walk-up-path/package.json b/node_modules/npm/node_modules/walk-up-path/package.json new file mode 100644 index 00000000..4f6d9536 --- /dev/null +++ b/node_modules/npm/node_modules/walk-up-path/package.json @@ -0,0 +1,71 @@ +{ + "name": "walk-up-path", + "version": "4.0.0", + "files": [ + "dist" + ], + "description": "Given a path string, return a generator that walks up the path, emitting each dirname.", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/walk-up-path" + }, + "author": "Isaac Z. Schlueter (https://izs.me)", + "license": "ISC", + "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 . --log-level warn", + "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts" + }, + "prettier": { + "experimentalTernaries": true, + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "devDependencies": { + "@types/node": "^20.14.10", + "prettier": "^3.3.2", + "tap": "^20.0.3", + "tshy": "^3.0.0", + "typedoc": "^0.26.3" + }, + "type": "module", + "tshy": { + "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" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js", + "engines": { + "node": "20 || >=22" + } +} diff --git a/node_modules/npm/node_modules/which/LICENSE b/node_modules/npm/node_modules/which/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/which/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/which/README.md b/node_modules/npm/node_modules/which/README.md new file mode 100644 index 00000000..323aaf29 --- /dev/null +++ b/node_modules/npm/node_modules/which/README.md @@ -0,0 +1,51 @@ +# which + +Like the unix `which` utility. + +Finds the first instance of a specified executable in the PATH +environment variable. Does not cache the results, so `hash -r` is not +needed when the PATH changes. + +## USAGE + +```javascript +const which = require('which') + +// async usage +// rejects if not found +const resolved = await which('node') + +// if nothrow option is used, returns null if not found +const resolvedOrNull = await which('node', { nothrow: true }) + +// sync usage +// throws if not found +const resolved = which.sync('node') + +// if nothrow option is used, returns null if not found +const resolvedOrNull = which.sync('node', { nothrow: true }) + +// Pass options to override the PATH and PATHEXT environment vars. +await which('node', { path: someOtherPath, pathExt: somePathExt }) +``` + +## CLI USAGE + +Just like the BSD `which(1)` binary but using `node-which`. + +``` +usage: node-which [-as] program ... +``` + +You can learn more about why the binary is `node-which` and not `which` +[here](https://github.com/npm/node-which/pull/67) + +## OPTIONS + +You may pass an options object as the second argument. + +- `path`: Use instead of the `PATH` environment variable. +- `pathExt`: Use instead of the `PATHEXT` environment variable. +- `all`: Return all matches, instead of just the first one. Note that + this means the function returns an array of strings instead of a + single string. diff --git a/node_modules/npm/node_modules/which/bin/which.js b/node_modules/npm/node_modules/which/bin/which.js new file mode 100755 index 00000000..6df16f21 --- /dev/null +++ b/node_modules/npm/node_modules/which/bin/which.js @@ -0,0 +1,52 @@ +#!/usr/bin/env node + +const which = require('../lib') +const argv = process.argv.slice(2) + +const usage = (err) => { + if (err) { + console.error(`which: ${err}`) + } + console.error('usage: which [-as] program ...') + process.exit(1) +} + +if (!argv.length) { + return usage() +} + +let dashdash = false +const [commands, flags] = argv.reduce((acc, arg) => { + if (dashdash || arg === '--') { + dashdash = true + return acc + } + + if (!/^-/.test(arg)) { + acc[0].push(arg) + return acc + } + + for (const flag of arg.slice(1).split('')) { + if (flag === 's') { + acc[1].silent = true + } else if (flag === 'a') { + acc[1].all = true + } else { + usage(`illegal option -- ${flag}`) + } + } + + return acc +}, [[], {}]) + +for (const command of commands) { + try { + const res = which.sync(command, { all: flags.all }) + if (!flags.silent) { + console.log([].concat(res).join('\n')) + } + } catch (err) { + process.exitCode = 1 + } +} diff --git a/node_modules/npm/node_modules/which/lib/index.js b/node_modules/npm/node_modules/which/lib/index.js new file mode 100644 index 00000000..2fd358ba --- /dev/null +++ b/node_modules/npm/node_modules/which/lib/index.js @@ -0,0 +1,111 @@ +const { isexe, sync: isexeSync } = require('isexe') +const { join, delimiter, sep, posix } = require('path') + +const isWindows = process.platform === 'win32' + +// used to check for slashed in commands passed in. always checks for the posix +// seperator on all platforms, and checks for the current separator when not on +// a posix platform. don't use the isWindows check for this since that is mocked +// in tests but we still need the code to actually work when called. that is also +// why it is ignored from coverage. +/* istanbul ignore next */ +const rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? '' : sep}]`.replace(/(\\)/g, '\\$1')) +const rRel = new RegExp(`^\\.${rSlash.source}`) + +const getNotFoundError = (cmd) => + Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' }) + +const getPathInfo = (cmd, { + path: optPath = process.env.PATH, + pathExt: optPathExt = process.env.PATHEXT, + delimiter: optDelimiter = delimiter, +}) => { + // 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(rSlash) ? [''] : [ + // windows always checks the cwd first + ...(isWindows ? [process.cwd()] : []), + ...(optPath || /* istanbul ignore next: very unusual */ '').split(optDelimiter), + ] + + if (isWindows) { + const pathExtExe = optPathExt || + ['.EXE', '.CMD', '.BAT', '.COM'].join(optDelimiter) + const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]) + if (cmd.includes('.') && pathExt[0] !== '') { + pathExt.unshift('') + } + return { pathEnv, pathExt, pathExtExe } + } + + return { pathEnv, pathExt: [''] } +} + +const getPathPart = (raw, cmd) => { + const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw + const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : '' + return prefix + join(pathPart, cmd) +} + +const which = async (cmd, opt = {}) => { + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (const envPart of pathEnv) { + const p = getPathPart(envPart, cmd) + + for (const ext of pathExt) { + const withExt = p + ext + const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true }) + if (is) { + if (!opt.all) { + return withExt + } + found.push(withExt) + } + } + } + + if (opt.all && found.length) { + return found + } + + if (opt.nothrow) { + return null + } + + throw getNotFoundError(cmd) +} + +const whichSync = (cmd, opt = {}) => { + const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt) + const found = [] + + for (const pathEnvPart of pathEnv) { + const p = getPathPart(pathEnvPart, cmd) + + for (const ext of pathExt) { + const withExt = p + ext + const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true }) + if (is) { + if (!opt.all) { + return withExt + } + found.push(withExt) + } + } + } + + 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/npm/node_modules/which/node_modules/isexe/LICENSE b/node_modules/npm/node_modules/which/node_modules/isexe/LICENSE new file mode 100644 index 00000000..c925dbe8 --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2016-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/npm/node_modules/which/node_modules/isexe/dist/cjs/index.js b/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/index.js new file mode 100644 index 00000000..cefcb66b --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/index.js @@ -0,0 +1,46 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sync = exports.isexe = exports.posix = exports.win32 = void 0; +const posix = __importStar(require("./posix.js")); +exports.posix = posix; +const win32 = __importStar(require("./win32.js")); +exports.win32 = win32; +__exportStar(require("./options.js"), exports); +const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform; +const impl = platform === 'win32' ? win32 : posix; +/** + * Determine whether a path is executable on the current platform. + */ +exports.isexe = impl.isexe; +/** + * Synchronously determine whether a path is executable on the + * current platform. + */ +exports.sync = impl.sync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/options.js b/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/options.js new file mode 100644 index 00000000..0dfad076 --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/options.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/package.json b/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/posix.js b/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/posix.js new file mode 100644 index 00000000..3bc5e79d --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/posix.js @@ -0,0 +1,67 @@ +"use strict"; +/** + * This is the Posix implementation of isexe, which uses the file + * mode and uid/gid values. + * + * @module + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sync = exports.isexe = void 0; +const fs_1 = require("fs"); +const promises_1 = require("fs/promises"); +/** + * Determine whether a path is executable according to the mode and + * current (or specified) user and group IDs. + */ +const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await (0, promises_1.stat)(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.isexe = isexe; +/** + * Synchronously determine whether a path is executable according to + * the mode and current (or specified) user and group IDs. + */ +const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat((0, fs_1.statSync)(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.sync = sync; +const checkStat = (stat, options) => stat.isFile() && checkMode(stat, options); +const checkMode = (stat, options) => { + const myUid = options.uid ?? process.getuid?.(); + const myGroups = options.groups ?? process.getgroups?.() ?? []; + const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]; + if (myUid === undefined || myGid === undefined) { + throw new Error('cannot get uid or gid'); + } + const groups = new Set([myGid, ...myGroups]); + const mod = stat.mode; + const uid = stat.uid; + const gid = stat.gid; + const u = parseInt('100', 8); + const g = parseInt('010', 8); + const o = parseInt('001', 8); + const ug = u | g; + return !!(mod & o || + (mod & g && groups.has(gid)) || + (mod & u && uid === myUid) || + (mod & ug && myUid === 0)); +}; +//# sourceMappingURL=posix.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/win32.js b/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/win32.js new file mode 100644 index 00000000..fa7a4d2f --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/dist/cjs/win32.js @@ -0,0 +1,62 @@ +"use strict"; +/** + * This is the Windows implementation of isexe, which uses the file + * extension and PATHEXT setting. + * + * @module + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sync = exports.isexe = void 0; +const fs_1 = require("fs"); +const promises_1 = require("fs/promises"); +/** + * Determine whether a path is executable based on the file extension + * and PATHEXT environment variable (or specified pathExt option) + */ +const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await (0, promises_1.stat)(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.isexe = isexe; +/** + * Synchronously determine whether a path is executable based on the file + * extension and PATHEXT environment variable (or specified pathExt option) + */ +const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat((0, fs_1.statSync)(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +exports.sync = sync; +const checkPathExt = (path, options) => { + const { pathExt = process.env.PATHEXT || '' } = options; + const peSplit = pathExt.split(';'); + if (peSplit.indexOf('') !== -1) { + return true; + } + for (let i = 0; i < peSplit.length; i++) { + const p = peSplit[i].toLowerCase(); + const ext = path.substring(path.length - p.length).toLowerCase(); + if (p && ext === p) { + return true; + } + } + return false; +}; +const checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, options); +//# sourceMappingURL=win32.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/index.js b/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/index.js new file mode 100644 index 00000000..1e309acd --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/index.js @@ -0,0 +1,16 @@ +import * as posix from './posix.js'; +import * as win32 from './win32.js'; +export * from './options.js'; +export { win32, posix }; +const platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform; +const impl = platform === 'win32' ? win32 : posix; +/** + * Determine whether a path is executable on the current platform. + */ +export const isexe = impl.isexe; +/** + * Synchronously determine whether a path is executable on the + * current platform. + */ +export const sync = impl.sync; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/options.js b/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/options.js new file mode 100644 index 00000000..e9ded40b --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/options.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/package.json b/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/posix.js b/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/posix.js new file mode 100644 index 00000000..c453776c --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/posix.js @@ -0,0 +1,62 @@ +/** + * This is the Posix implementation of isexe, which uses the file + * mode and uid/gid values. + * + * @module + */ +import { statSync } from 'fs'; +import { stat } from 'fs/promises'; +/** + * Determine whether a path is executable according to the mode and + * current (or specified) user and group IDs. + */ +export const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await stat(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +/** + * Synchronously determine whether a path is executable according to + * the mode and current (or specified) user and group IDs. + */ +export const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(statSync(path), options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +const checkStat = (stat, options) => stat.isFile() && checkMode(stat, options); +const checkMode = (stat, options) => { + const myUid = options.uid ?? process.getuid?.(); + const myGroups = options.groups ?? process.getgroups?.() ?? []; + const myGid = options.gid ?? process.getgid?.() ?? myGroups[0]; + if (myUid === undefined || myGid === undefined) { + throw new Error('cannot get uid or gid'); + } + const groups = new Set([myGid, ...myGroups]); + const mod = stat.mode; + const uid = stat.uid; + const gid = stat.gid; + const u = parseInt('100', 8); + const g = parseInt('010', 8); + const o = parseInt('001', 8); + const ug = u | g; + return !!(mod & o || + (mod & g && groups.has(gid)) || + (mod & u && uid === myUid) || + (mod & ug && myUid === 0)); +}; +//# sourceMappingURL=posix.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/win32.js b/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/win32.js new file mode 100644 index 00000000..a354ee2a --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/dist/mjs/win32.js @@ -0,0 +1,57 @@ +/** + * This is the Windows implementation of isexe, which uses the file + * extension and PATHEXT setting. + * + * @module + */ +import { statSync } from 'fs'; +import { stat } from 'fs/promises'; +/** + * Determine whether a path is executable based on the file extension + * and PATHEXT environment variable (or specified pathExt option) + */ +export const isexe = async (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(await stat(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +/** + * Synchronously determine whether a path is executable based on the file + * extension and PATHEXT environment variable (or specified pathExt option) + */ +export const sync = (path, options = {}) => { + const { ignoreErrors = false } = options; + try { + return checkStat(statSync(path), path, options); + } + catch (e) { + const er = e; + if (ignoreErrors || er.code === 'EACCES') + return false; + throw er; + } +}; +const checkPathExt = (path, options) => { + const { pathExt = process.env.PATHEXT || '' } = options; + const peSplit = pathExt.split(';'); + if (peSplit.indexOf('') !== -1) { + return true; + } + for (let i = 0; i < peSplit.length; i++) { + const p = peSplit[i].toLowerCase(); + const ext = path.substring(path.length - p.length).toLowerCase(); + if (p && ext === p) { + return true; + } + } + return false; +}; +const checkStat = (stat, path, options) => stat.isFile() && checkPathExt(path, options); +//# sourceMappingURL=win32.js.map \ No newline at end of file diff --git a/node_modules/npm/node_modules/which/node_modules/isexe/package.json b/node_modules/npm/node_modules/which/node_modules/isexe/package.json new file mode 100644 index 00000000..a0e2cd04 --- /dev/null +++ b/node_modules/npm/node_modules/which/node_modules/isexe/package.json @@ -0,0 +1,96 @@ +{ + "name": "isexe", + "version": "3.1.1", + "description": "Minimal module to check if a file is executable.", + "main": "./dist/cjs/index.js", + "module": "./dist/mjs/index.js", + "types": "./dist/cjs/index.js", + "files": [ + "dist" + ], + "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" + } + }, + "./posix": { + "import": { + "types": "./dist/mjs/posix.d.ts", + "default": "./dist/mjs/posix.js" + }, + "require": { + "types": "./dist/cjs/posix.d.ts", + "default": "./dist/cjs/posix.js" + } + }, + "./win32": { + "import": { + "types": "./dist/mjs/win32.d.ts", + "default": "./dist/mjs/win32.js" + }, + "require": { + "types": "./dist/cjs/win32.d.ts", + "default": "./dist/cjs/win32.js" + } + }, + "./package.json": "./package.json" + }, + "devDependencies": { + "@types/node": "^20.4.5", + "@types/tap": "^15.0.8", + "c8": "^8.0.1", + "mkdirp": "^0.5.1", + "prettier": "^2.8.8", + "rimraf": "^2.5.0", + "sync-content": "^1.0.2", + "tap": "^16.3.8", + "ts-node": "^10.9.1", + "typedoc": "^0.24.8", + "typescript": "^5.1.6" + }, + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "prepare": "tsc -p tsconfig/cjs.json && tsc -p tsconfig/esm.json && bash ./scripts/fixup.sh", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "test": "c8 tap", + "snap": "c8 tap", + "format": "prettier --write . --loglevel warn --ignore-path ../../.prettierignore --cache", + "typedoc": "typedoc --tsconfig tsconfig/esm.json ./src/*.ts" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "tap": { + "coverage": false, + "node-arg": [ + "--enable-source-maps", + "--no-warnings", + "--loader", + "ts-node/esm" + ], + "ts": false + }, + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "repository": "https://github.com/isaacs/isexe", + "engines": { + "node": ">=16" + } +} diff --git a/node_modules/npm/node_modules/which/package.json b/node_modules/npm/node_modules/which/package.json new file mode 100644 index 00000000..94184233 --- /dev/null +++ b/node_modules/npm/node_modules/which/package.json @@ -0,0 +1,52 @@ +{ + "author": "GitHub Inc.", + "name": "which", + "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", + "version": "5.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/node-which.git" + }, + "main": "lib/index.js", + "bin": { + "node-which": "./bin/which.js" + }, + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.3.0" + }, + "scripts": { + "test": "tap", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "posttest": "npm run lint", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "files": [ + "bin/", + "lib/" + ], + "tap": { + "check-coverage": true, + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.3", + "publish": "true" + } +} diff --git a/node_modules/npm/node_modules/wrap-ansi-cjs/index.js b/node_modules/npm/node_modules/wrap-ansi-cjs/index.js new file mode 100755 index 00000000..d502255b --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi-cjs/index.js @@ -0,0 +1,216 @@ +'use strict'; +const stringWidth = require('string-width'); +const stripAnsi = require('strip-ansi'); +const ansiStyles = require('ansi-styles'); + +const ESCAPES = new Set([ + '\u001B', + '\u009B' +]); + +const END_CODE = 39; + +const ANSI_ESCAPE_BELL = '\u0007'; +const ANSI_CSI = '['; +const ANSI_OSC = ']'; +const ANSI_SGR_TERMINATOR = 'm'; +const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`; + +const wrapAnsi = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`; +const wrapAnsiHyperlink = uri => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`; + +// Calculate the length of words split on ' ', ignoring +// the extra characters added by ansi escape codes +const wordLengths = string => string.split(' ').map(character => stringWidth(character)); + +// Wrap a long word across multiple rows +// Ansi escape codes do not count towards length +const wrapWord = (rows, word, columns) => { + const characters = [...word]; + + let isInsideEscape = false; + let isInsideLinkEscape = false; + let visible = stringWidth(stripAnsi(rows[rows.length - 1])); + + for (const [index, character] of characters.entries()) { + const characterLength = stringWidth(character); + + if (visible + characterLength <= columns) { + rows[rows.length - 1] += character; + } else { + rows.push(character); + visible = 0; + } + + if (ESCAPES.has(character)) { + isInsideEscape = true; + isInsideLinkEscape = characters.slice(index + 1).join('').startsWith(ANSI_ESCAPE_LINK); + } + + if (isInsideEscape) { + if (isInsideLinkEscape) { + if (character === ANSI_ESCAPE_BELL) { + isInsideEscape = false; + isInsideLinkEscape = false; + } + } else if (character === ANSI_SGR_TERMINATOR) { + isInsideEscape = false; + } + + continue; + } + + visible += characterLength; + + if (visible === columns && index < characters.length - 1) { + rows.push(''); + visible = 0; + } + } + + // It's possible that the last row we copy over is only + // ansi escape characters, handle this edge-case + if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) { + rows[rows.length - 2] += rows.pop(); + } +}; + +// Trims spaces from a string ignoring invisible sequences +const stringVisibleTrimSpacesRight = string => { + const words = string.split(' '); + let last = words.length; + + while (last > 0) { + if (stringWidth(words[last - 1]) > 0) { + break; + } + + last--; + } + + if (last === words.length) { + return string; + } + + return words.slice(0, last).join(' ') + words.slice(last).join(''); +}; + +// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode +// +// 'hard' will never allow a string to take up more than columns characters +// +// 'soft' allows long words to expand past the column length +const exec = (string, columns, options = {}) => { + if (options.trim !== false && string.trim() === '') { + return ''; + } + + let returnValue = ''; + let escapeCode; + let escapeUrl; + + const lengths = wordLengths(string); + let rows = ['']; + + for (const [index, word] of string.split(' ').entries()) { + if (options.trim !== false) { + rows[rows.length - 1] = rows[rows.length - 1].trimStart(); + } + + let rowLength = stringWidth(rows[rows.length - 1]); + + if (index !== 0) { + if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) { + // If we start with a new word but the current row length equals the length of the columns, add a new row + rows.push(''); + rowLength = 0; + } + + if (rowLength > 0 || options.trim === false) { + rows[rows.length - 1] += ' '; + rowLength++; + } + } + + // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns' + if (options.hard && lengths[index] > columns) { + const remainingColumns = (columns - rowLength); + const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns); + const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns); + if (breaksStartingNextLine < breaksStartingThisLine) { + rows.push(''); + } + + wrapWord(rows, word, columns); + continue; + } + + if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) { + if (options.wordWrap === false && rowLength < columns) { + wrapWord(rows, word, columns); + continue; + } + + rows.push(''); + } + + if (rowLength + lengths[index] > columns && options.wordWrap === false) { + wrapWord(rows, word, columns); + continue; + } + + rows[rows.length - 1] += word; + } + + if (options.trim !== false) { + rows = rows.map(stringVisibleTrimSpacesRight); + } + + const pre = [...rows.join('\n')]; + + for (const [index, character] of pre.entries()) { + returnValue += character; + + if (ESCAPES.has(character)) { + const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?\\d+)m|\\${ANSI_ESCAPE_LINK}(?.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join('')) || {groups: {}}; + if (groups.code !== undefined) { + const code = Number.parseFloat(groups.code); + escapeCode = code === END_CODE ? undefined : code; + } else if (groups.uri !== undefined) { + escapeUrl = groups.uri.length === 0 ? undefined : groups.uri; + } + } + + const code = ansiStyles.codes.get(Number(escapeCode)); + + if (pre[index + 1] === '\n') { + if (escapeUrl) { + returnValue += wrapAnsiHyperlink(''); + } + + if (escapeCode && code) { + returnValue += wrapAnsi(code); + } + } else if (character === '\n') { + if (escapeCode && code) { + returnValue += wrapAnsi(escapeCode); + } + + if (escapeUrl) { + returnValue += wrapAnsiHyperlink(escapeUrl); + } + } + } + + return returnValue; +}; + +// For each newline, invoke the method separately +module.exports = (string, columns, options) => { + return String(string) + .normalize() + .replace(/\r\n/g, '\n') + .split('\n') + .map(line => exec(line, columns, options)) + .join('\n'); +}; diff --git a/node_modules/npm/node_modules/wrap-ansi-cjs/license b/node_modules/npm/node_modules/wrap-ansi-cjs/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi-cjs/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/index.js b/node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/index.js new file mode 100644 index 00000000..5d82581a --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/index.js @@ -0,0 +1,163 @@ +'use strict'; + +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; + +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + + return value; + }, + enumerable: true, + configurable: true + }); +}; + +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = require('color-convert'); + } + + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); diff --git a/node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/license b/node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/license @@ -0,0 +1,9 @@ +MIT License + +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/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/package.json b/node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/package.json new file mode 100644 index 00000000..75393284 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/package.json @@ -0,0 +1,56 @@ +{ + "name": "ansi-styles", + "version": "4.3.0", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": "chalk/ansi-styles", + "funding": "https://github.com/chalk/ansi-styles?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "color-convert": "^2.0.1" + }, + "devDependencies": { + "@types/color-convert": "^1.9.0", + "ava": "^2.3.0", + "svg-term-cli": "^2.1.1", + "tsd": "^0.11.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/npm/node_modules/wrap-ansi-cjs/package.json b/node_modules/npm/node_modules/wrap-ansi-cjs/package.json new file mode 100644 index 00000000..dfb2f4f1 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi-cjs/package.json @@ -0,0 +1,62 @@ +{ + "name": "wrap-ansi", + "version": "7.0.0", + "description": "Wordwrap a string with ANSI escape codes", + "license": "MIT", + "repository": "chalk/wrap-ansi", + "funding": "https://github.com/chalk/wrap-ansi?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=10" + }, + "scripts": { + "test": "xo && nyc ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "wrap", + "break", + "wordwrap", + "wordbreak", + "linewrap", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "devDependencies": { + "ava": "^2.1.0", + "chalk": "^4.0.0", + "coveralls": "^3.0.3", + "has-ansi": "^4.0.0", + "nyc": "^15.0.1", + "xo": "^0.29.1" + } +} diff --git a/node_modules/npm/node_modules/wrap-ansi/index.js b/node_modules/npm/node_modules/wrap-ansi/index.js new file mode 100755 index 00000000..d80c74c1 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/index.js @@ -0,0 +1,214 @@ +import stringWidth from 'string-width'; +import stripAnsi from 'strip-ansi'; +import ansiStyles from 'ansi-styles'; + +const ESCAPES = new Set([ + '\u001B', + '\u009B', +]); + +const END_CODE = 39; +const ANSI_ESCAPE_BELL = '\u0007'; +const ANSI_CSI = '['; +const ANSI_OSC = ']'; +const ANSI_SGR_TERMINATOR = 'm'; +const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`; + +const wrapAnsiCode = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`; +const wrapAnsiHyperlink = uri => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`; + +// Calculate the length of words split on ' ', ignoring +// the extra characters added by ansi escape codes +const wordLengths = string => string.split(' ').map(character => stringWidth(character)); + +// Wrap a long word across multiple rows +// Ansi escape codes do not count towards length +const wrapWord = (rows, word, columns) => { + const characters = [...word]; + + let isInsideEscape = false; + let isInsideLinkEscape = false; + let visible = stringWidth(stripAnsi(rows[rows.length - 1])); + + for (const [index, character] of characters.entries()) { + const characterLength = stringWidth(character); + + if (visible + characterLength <= columns) { + rows[rows.length - 1] += character; + } else { + rows.push(character); + visible = 0; + } + + if (ESCAPES.has(character)) { + isInsideEscape = true; + isInsideLinkEscape = characters.slice(index + 1).join('').startsWith(ANSI_ESCAPE_LINK); + } + + if (isInsideEscape) { + if (isInsideLinkEscape) { + if (character === ANSI_ESCAPE_BELL) { + isInsideEscape = false; + isInsideLinkEscape = false; + } + } else if (character === ANSI_SGR_TERMINATOR) { + isInsideEscape = false; + } + + continue; + } + + visible += characterLength; + + if (visible === columns && index < characters.length - 1) { + rows.push(''); + visible = 0; + } + } + + // It's possible that the last row we copy over is only + // ansi escape characters, handle this edge-case + if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) { + rows[rows.length - 2] += rows.pop(); + } +}; + +// Trims spaces from a string ignoring invisible sequences +const stringVisibleTrimSpacesRight = string => { + const words = string.split(' '); + let last = words.length; + + while (last > 0) { + if (stringWidth(words[last - 1]) > 0) { + break; + } + + last--; + } + + if (last === words.length) { + return string; + } + + return words.slice(0, last).join(' ') + words.slice(last).join(''); +}; + +// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode +// +// 'hard' will never allow a string to take up more than columns characters +// +// 'soft' allows long words to expand past the column length +const exec = (string, columns, options = {}) => { + if (options.trim !== false && string.trim() === '') { + return ''; + } + + let returnValue = ''; + let escapeCode; + let escapeUrl; + + const lengths = wordLengths(string); + let rows = ['']; + + for (const [index, word] of string.split(' ').entries()) { + if (options.trim !== false) { + rows[rows.length - 1] = rows[rows.length - 1].trimStart(); + } + + let rowLength = stringWidth(rows[rows.length - 1]); + + if (index !== 0) { + if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) { + // If we start with a new word but the current row length equals the length of the columns, add a new row + rows.push(''); + rowLength = 0; + } + + if (rowLength > 0 || options.trim === false) { + rows[rows.length - 1] += ' '; + rowLength++; + } + } + + // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns' + if (options.hard && lengths[index] > columns) { + const remainingColumns = (columns - rowLength); + const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns); + const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns); + if (breaksStartingNextLine < breaksStartingThisLine) { + rows.push(''); + } + + wrapWord(rows, word, columns); + continue; + } + + if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) { + if (options.wordWrap === false && rowLength < columns) { + wrapWord(rows, word, columns); + continue; + } + + rows.push(''); + } + + if (rowLength + lengths[index] > columns && options.wordWrap === false) { + wrapWord(rows, word, columns); + continue; + } + + rows[rows.length - 1] += word; + } + + if (options.trim !== false) { + rows = rows.map(row => stringVisibleTrimSpacesRight(row)); + } + + const pre = [...rows.join('\n')]; + + for (const [index, character] of pre.entries()) { + returnValue += character; + + if (ESCAPES.has(character)) { + const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?\\d+)m|\\${ANSI_ESCAPE_LINK}(?.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join('')) || {groups: {}}; + if (groups.code !== undefined) { + const code = Number.parseFloat(groups.code); + escapeCode = code === END_CODE ? undefined : code; + } else if (groups.uri !== undefined) { + escapeUrl = groups.uri.length === 0 ? undefined : groups.uri; + } + } + + const code = ansiStyles.codes.get(Number(escapeCode)); + + if (pre[index + 1] === '\n') { + if (escapeUrl) { + returnValue += wrapAnsiHyperlink(''); + } + + if (escapeCode && code) { + returnValue += wrapAnsiCode(code); + } + } else if (character === '\n') { + if (escapeCode && code) { + returnValue += wrapAnsiCode(escapeCode); + } + + if (escapeUrl) { + returnValue += wrapAnsiHyperlink(escapeUrl); + } + } + } + + return returnValue; +}; + +// For each newline, invoke the method separately +export default function wrapAnsi(string, columns, options) { + return String(string) + .normalize() + .replace(/\r\n/g, '\n') + .split('\n') + .map(line => exec(line, columns, options)) + .join('\n'); +} diff --git a/node_modules/npm/node_modules/wrap-ansi/license b/node_modules/npm/node_modules/wrap-ansi/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/wrap-ansi/node_modules/ansi-regex/index.js b/node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex/index.js new file mode 100644 index 00000000..ddfdba39 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +export default function ansiRegex({onlyFirst = false} = {}) { + // Valid string terminator sequences are BEL, ESC\, and 0x9c + const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)'; + const pattern = [ + `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))', + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +} diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex/license b/node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/wrap-ansi/node_modules/ansi-regex/package.json b/node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex/package.json new file mode 100644 index 00000000..49f3f610 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex/package.json @@ -0,0 +1,61 @@ +{ + "name": "ansi-regex", + "version": "6.1.0", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "funding": "https://github.com/chalk/ansi-regex?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "types": "./index.d.ts", + "sideEffects": false, + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "ansi-escapes": "^5.0.0", + "ava": "^3.15.0", + "tsd": "^0.21.0", + "xo": "^0.54.2" + } +} diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/LICENSE-MIT.txt b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/LICENSE-MIT.txt new file mode 100644 index 00000000..a41e0a7e --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +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/npm/node_modules/wrap-ansi/node_modules/emoji-regex/RGI_Emoji.js b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/RGI_Emoji.js new file mode 100644 index 00000000..3fbe9241 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/RGI_Emoji.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE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uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\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46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]/g; +}; diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/RGI_Emoji.js b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/RGI_Emoji.js new file mode 100644 index 00000000..ecf32f17 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/RGI_Emoji.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074}|\u{E0065}\u{E006E}\u{E0067})\u{E007F}|(?:\u{1F9D1}\u{1F3FF}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FE}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FD}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FB}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FC}-\u{1F3FF}]|\u{1F468}(?:\u{1F3FB}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]))?|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC})?|(?:\u{1F469}(?:\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}]))|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]\u200D\u{1F91D}\u200D\u{1F9D1})[\u{1F3FB}-\u{1F3FF}]|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F469}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F9D1}(?:\u200D(?:\u{1F91D}\u200D\u{1F9D1}|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F9D1}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F636}\u200D\u{1F32B}|\u{1F3F3}\uFE0F\u200D\u26A7|\u{1F43B}\u200D\u2744|(?:[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u{1F3F4}\u200D\u2620|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F202}\u{1F237}\u{1F321}\u{1F324}-\u{1F32C}\u{1F336}\u{1F37D}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}\u{1F39F}\u{1F3CD}\u{1F3CE}\u{1F3D4}-\u{1F3DF}\u{1F3F5}\u{1F3F7}\u{1F43F}\u{1F4FD}\u{1F549}\u{1F54A}\u{1F56F}\u{1F570}\u{1F573}\u{1F576}-\u{1F579}\u{1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C}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270C\u270D\u{1F574}\u{1F590}][\uFE0F\u{1F3FB}-\u{1F3FF}]|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F408}\u{1F415}\u{1F43B}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F62E}\u{1F635}\u{1F636}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F384}\u{1F386}-\u{1F393}\u{1F3A0}-\u{1F3C1}\u{1F3C5}\u{1F3C6}\u{1F3C8}\u{1F3C9}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F8}-\u{1F407}\u{1F409}-\u{1F414}\u{1F416}-\u{1F43A}\u{1F43C}-\u{1F43E}\u{1F440}\u{1F444}\u{1F445}\u{1F451}-\u{1F465}\u{1F46A}\u{1F479}-\u{1F47B}\u{1F47D}-\u{1F480}\u{1F484}\u{1F488}-\u{1F48E}\u{1F490}\u{1F492}-\u{1F4A9}\u{1F4AB}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F5A4}\u{1F5FB}-\u{1F62D}\u{1F62F}-\u{1F634}\u{1F637}-\u{1F644}\u{1F648}-\u{1F64A}\u{1F680}-\u{1F6A2}\u{1F6A4}-\u{1F6B3}\u{1F6B7}-\u{1F6BF}\u{1F6C1}-\u{1F6C5}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90D}\u{1F90E}\u{1F910}-\u{1F917}\u{1F91D}\u{1F920}-\u{1F925}\u{1F927}-\u{1F92F}\u{1F93A}\u{1F93F}-\u{1F945}\u{1F947}-\u{1F976}\u{1F978}\u{1F97A}-\u{1F9B4}\u{1F9B7}\u{1F9BA}\u{1F9BC}-\u{1F9CB}\u{1F9D0}\u{1F9E0}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]/gu; +}; diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/index.js b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/index.js new file mode 100644 index 00000000..1a4fc8d0 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074}|\u{E0065}\u{E006E}\u{E0067})\u{E007F}|(?:\u{1F9D1}\u{1F3FF}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FE}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FD}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FB}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FC}-\u{1F3FF}]|\u{1F468}(?:\u{1F3FB}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]))?|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC})?|(?:\u{1F469}(?:\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}]))|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]\u200D\u{1F91D}\u200D\u{1F9D1})[\u{1F3FB}-\u{1F3FF}]|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F469}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u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}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F9D1}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F636}\u200D\u{1F32B}|\u{1F3F3}\uFE0F\u200D\u26A7|\u{1F43B}\u200D\u2744|(?:[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u{1F3F4}\u200D\u2620|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F202}\u{1F237}\u{1F321}\u{1F324}-\u{1F32C}\u{1F336}\u{1F37D}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}\u{1F39F}\u{1F3CD}\u{1F3CE}\u{1F3D4}-\u{1F3DF}\u{1F3F5}\u{1F3F7}\u{1F43F}\u{1F4FD}\u{1F549}\u{1F54A}\u{1F56F}\u{1F570}\u{1F573}\u{1F576}-\u{1F579}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}\u{1F6CB}\u{1F6CD}-\u{1F6CF}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6F0}\u{1F6F3}])\uFE0F|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F469}\u200D\u{1F467}|\u{1F469}\u200D\u{1F466}|\u{1F635}\u200D\u{1F4AB}|\u{1F62E}\u200D\u{1F4A8}|\u{1F415}\u200D\u{1F9BA}|\u{1F9D1}(?:\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC}|\u{1F3FB})?|\u{1F469}(?:\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC}|\u{1F3FB})?|\u{1F1FD}\u{1F1F0}|\u{1F1F6}\u{1F1E6}|\u{1F1F4}\u{1F1F2}|\u{1F408}\u200D\u2B1B|\u2764\uFE0F\u200D[\u{1F525}\u{1FA79}]|\u{1F441}\uFE0F|\u{1F3F3}\uFE0F|\u{1F1FF}[\u{1F1E6}\u{1F1F2}\u{1F1FC}]|\u{1F1FE}[\u{1F1EA}\u{1F1F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{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]|\u{1F3F4}|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270C\u270D\u{1F574}\u{1F590}][\uFE0F\u{1F3FB}-\u{1F3FF}]|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F408}\u{1F415}\u{1F43B}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F62E}\u{1F635}\u{1F636}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F384}\u{1F386}-\u{1F393}\u{1F3A0}-\u{1F3C1}\u{1F3C5}\u{1F3C6}\u{1F3C8}\u{1F3C9}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F8}-\u{1F407}\u{1F409}-\u{1F414}\u{1F416}-\u{1F43A}\u{1F43C}-\u{1F43E}\u{1F440}\u{1F444}\u{1F445}\u{1F451}-\u{1F465}\u{1F46A}\u{1F479}-\u{1F47B}\u{1F47D}-\u{1F480}\u{1F484}\u{1F488}-\u{1F48E}\u{1F490}\u{1F492}-\u{1F4A9}\u{1F4AB}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F5A4}\u{1F5FB}-\u{1F62D}\u{1F62F}-\u{1F634}\u{1F637}-\u{1F644}\u{1F648}-\u{1F64A}\u{1F680}-\u{1F6A2}\u{1F6A4}-\u{1F6B3}\u{1F6B7}-\u{1F6BF}\u{1F6C1}-\u{1F6C5}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90D}\u{1F90E}\u{1F910}-\u{1F917}\u{1F91D}\u{1F920}-\u{1F925}\u{1F927}-\u{1F92F}\u{1F93A}\u{1F93F}-\u{1F945}\u{1F947}-\u{1F976}\u{1F978}\u{1F97A}-\u{1F9B4}\u{1F9B7}\u{1F9BA}\u{1F9BC}-\u{1F9CB}\u{1F9D0}\u{1F9E0}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90C}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F978}\u{1F97A}-\u{1F9CB}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}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481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; +}; diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/text.js b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/text.js new file mode 100644 index 00000000..8e9f9857 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/es2015/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0077}\u{E006C}\u{E0073}|\u{E0073}\u{E0063}\u{E0074}|\u{E0065}\u{E006E}\u{E0067})\u{E007F}|(?:\u{1F9D1}\u{1F3FF}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FE}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FD}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|(?:\u{1F9D1}\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F9D1}|\u{1F469}\u{1F3FB}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FC}-\u{1F3FF}]|\u{1F468}(?:\u{1F3FB}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]))?|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FF}]|\u{1F468}[\u{1F3FB}-\u{1F3FF}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u{1F466}\u{1F467}])|\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC})?|(?:\u{1F469}(?:\u{1F3FB}\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F3FC}-\u{1F3FF}]\u200D\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}]))|\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]\u200D\u{1F91D}\u200D\u{1F9D1})[\u{1F3FB}-\u{1F3FF}]|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F469}(?:\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FE}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{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F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FD}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FC}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F37C}\u{1F384}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F9D1}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\u{1F636}\u200D\u{1F32B}|\u{1F3F3}\uFE0F\u200D\u26A7|\u{1F43B}\u200D\u2744|(?:[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u{1F3F4}\u200D\u2620|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F202}\u{1F237}\u{1F321}\u{1F324}-\u{1F32C}\u{1F336}\u{1F37D}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}\u{1F39F}\u{1F3CD}\u{1F3CE}\u{1F3D4}-\u{1F3DF}\u{1F3F5}\u{1F3F7}\u{1F43F}\u{1F4FD}\u{1F549}\u{1F54A}\u{1F56F}\u{1F570}\u{1F573}\u{1F576}-\u{1F579}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}\u{1F6CB}\u{1F6CD}-\u{1F6CF}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6F0}\u{1F6F3}])\uFE0F|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F469}\u200D\u{1F467}|\u{1F469}\u200D\u{1F466}|\u{1F635}\u200D\u{1F4AB}|\u{1F62E}\u200D\u{1F4A8}|\u{1F415}\u200D\u{1F9BA}|\u{1F9D1}(?:\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC}|\u{1F3FB})?|\u{1F469}(?:\u{1F3FF}|\u{1F3FE}|\u{1F3FD}|\u{1F3FC}|\u{1F3FB})?|\u{1F1FD}\u{1F1F0}|\u{1F1F6}\u{1F1E6}|\u{1F1F4}\u{1F1F2}|\u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E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}][\u{1F3FB}-\u{1F3FF}]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\uFE0F\u{1F3FB}-\u{1F3FF}]|\u{1F3F4}|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u261D\u270C\u270D\u{1F574}\u{1F590}][\uFE0F\u{1F3FB}-\u{1F3FF}]|[\u270A\u270B\u{1F385}\u{1F3C2}\u{1F3C7}\u{1F408}\u{1F415}\u{1F43B}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F57A}\u{1F595}\u{1F596}\u{1F62E}\u{1F635}\u{1F636}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90C}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F934}\u{1F936}\u{1F977}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}\u{1F9D3}\u{1F9D5}]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F470}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F935}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D4}\u{1F9D6}-\u{1F9DD}]|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F384}\u{1F386}-\u{1F393}\u{1F3A0}-\u{1F3C1}\u{1F3C5}\u{1F3C6}\u{1F3C8}\u{1F3C9}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F8}-\u{1F407}\u{1F409}-\u{1F414}\u{1F416}-\u{1F43A}\u{1F43C}-\u{1F43E}\u{1F440}\u{1F444}\u{1F445}\u{1F451}-\u{1F465}\u{1F46A}\u{1F479}-\u{1F47B}\u{1F47D}-\u{1F480}\u{1F484}\u{1F488}-\u{1F48E}\u{1F490}\u{1F492}-\u{1F4A9}\u{1F4AB}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F5A4}\u{1F5FB}-\u{1F62D}\u{1F62F}-\u{1F634}\u{1F637}-\u{1F644}\u{1F648}-\u{1F64A}\u{1F680}-\u{1F6A2}\u{1F6A4}-\u{1F6B3}\u{1F6B7}-\u{1F6BF}\u{1F6C1}-\u{1F6C5}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90D}\u{1F90E}\u{1F910}-\u{1F917}\u{1F91D}\u{1F920}-\u{1F925}\u{1F927}-\u{1F92F}\u{1F93A}\u{1F93F}-\u{1F945}\u{1F947}-\u{1F976}\u{1F978}\u{1F97A}-\u{1F9B4}\u{1F9B7}\u{1F9BA}\u{1F9BC}-\u{1F9CB}\u{1F9D0}\u{1F9E0}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}-\u{1F6D7}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F90C}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F978}\u{1F97A}-\u{1F9CB}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAA8}\u{1FAB0}-\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD6}]\uFE0F?/gu; +}; diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/index.js b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/index.js new file mode 100644 index 00000000..c0490d4c --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\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DFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3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74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; +}; diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/package.json b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/package.json new file mode 100644 index 00000000..eac892a1 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/package.json @@ -0,0 +1,52 @@ +{ + "name": "emoji-regex", + "version": "9.2.2", + "description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.", + "homepage": "https://mths.be/emoji-regex", + "main": "index.js", + "types": "index.d.ts", + "keywords": [ + "unicode", + "regex", + "regexp", + "regular expressions", + "code points", + "symbols", + "characters", + "emoji" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "repository": { + "type": "git", + "url": "https://github.com/mathiasbynens/emoji-regex.git" + }, + "bugs": "https://github.com/mathiasbynens/emoji-regex/issues", + "files": [ + "LICENSE-MIT.txt", + "index.js", + "index.d.ts", + "RGI_Emoji.js", + "RGI_Emoji.d.ts", + "text.js", + "text.d.ts", + "es2015" + ], + "scripts": { + "build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src es2015_types -D -d ./es2015; node script/inject-sequences.js", + "test": "mocha", + "test:watch": "npm run test -- --watch" + }, + "devDependencies": { + "@babel/cli": "^7.4.4", + "@babel/core": "^7.4.4", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/preset-env": "^7.4.4", + "@unicode/unicode-13.0.0": "^1.0.3", + "mocha": "^6.1.4", + "regexgen": "^1.3.0" + } +} diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/text.js b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/text.js new file mode 100644 index 00000000..9bc63ce7 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB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DF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|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[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F?/g; +}; diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/index.js b/node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/index.js new file mode 100644 index 00000000..9294488f --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/index.js @@ -0,0 +1,54 @@ +import stripAnsi from 'strip-ansi'; +import eastAsianWidth from 'eastasianwidth'; +import emojiRegex from 'emoji-regex'; + +export default function stringWidth(string, options = {}) { + if (typeof string !== 'string' || string.length === 0) { + return 0; + } + + options = { + ambiguousIsNarrow: true, + ...options + }; + + string = stripAnsi(string); + + if (string.length === 0) { + return 0; + } + + string = string.replace(emojiRegex(), ' '); + + const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2; + let width = 0; + + for (const character of string) { + const codePoint = character.codePointAt(0); + + // Ignore control characters + if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) { + continue; + } + + // Ignore combining characters + if (codePoint >= 0x300 && codePoint <= 0x36F) { + continue; + } + + const code = eastAsianWidth.eastAsianWidth(character); + switch (code) { + case 'F': + case 'W': + width += 2; + break; + case 'A': + width += ambiguousCharacterWidth; + break; + default: + width += 1; + } + } + + return width; +} diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/license b/node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/wrap-ansi/node_modules/string-width/package.json b/node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/package.json new file mode 100644 index 00000000..f46d6770 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/string-width/package.json @@ -0,0 +1,59 @@ +{ + "name": "string-width", + "version": "5.1.2", + "description": "Get the visual width of a string - the number of columns required to display it", + "license": "MIT", + "repository": "sindresorhus/string-width", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "string", + "character", + "unicode", + "width", + "visual", + "column", + "columns", + "fullwidth", + "full-width", + "full", + "ansi", + "escape", + "codes", + "cli", + "command-line", + "terminal", + "console", + "cjk", + "chinese", + "japanese", + "korean", + "fixed-width" + ], + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.14.0", + "xo": "^0.38.2" + } +} diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/index.js b/node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/index.js new file mode 100644 index 00000000..ba19750e --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/index.js @@ -0,0 +1,14 @@ +import ansiRegex from 'ansi-regex'; + +const regex = ansiRegex(); + +export default function stripAnsi(string) { + if (typeof string !== 'string') { + throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); + } + + // Even though the regex is global, we don't need to reset the `.lastIndex` + // because unlike `.exec()` and `.test()`, `.replace()` does it automatically + // and doing it manually has a performance penalty. + return string.replace(regex, ''); +} diff --git a/node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/license b/node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/npm/node_modules/wrap-ansi/node_modules/strip-ansi/package.json b/node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/package.json new file mode 100644 index 00000000..e1f455c3 --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi/package.json @@ -0,0 +1,57 @@ +{ + "name": "strip-ansi", + "version": "7.1.0", + "description": "Strip ANSI escape codes from a string", + "license": "MIT", + "repository": "chalk/strip-ansi", + "funding": "https://github.com/chalk/strip-ansi?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.17.0", + "xo": "^0.44.0" + } +} diff --git a/node_modules/npm/node_modules/wrap-ansi/package.json b/node_modules/npm/node_modules/wrap-ansi/package.json new file mode 100644 index 00000000..198a5dbc --- /dev/null +++ b/node_modules/npm/node_modules/wrap-ansi/package.json @@ -0,0 +1,69 @@ +{ + "name": "wrap-ansi", + "version": "8.1.0", + "description": "Wordwrap a string with ANSI escape codes", + "license": "MIT", + "repository": "chalk/wrap-ansi", + "funding": "https://github.com/chalk/wrap-ansi?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": { + "types": "./index.d.ts", + "default": "./index.js" + }, + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && nyc ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "wrap", + "break", + "wordwrap", + "wordbreak", + "linewrap", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "devDependencies": { + "ava": "^3.15.0", + "chalk": "^4.1.2", + "coveralls": "^3.1.1", + "has-ansi": "^5.0.1", + "nyc": "^15.1.0", + "tsd": "^0.25.0", + "xo": "^0.44.0" + } +} diff --git a/node_modules/npm/node_modules/write-file-atomic/LICENSE.md b/node_modules/npm/node_modules/write-file-atomic/LICENSE.md new file mode 100644 index 00000000..95e65a77 --- /dev/null +++ b/node_modules/npm/node_modules/write-file-atomic/LICENSE.md @@ -0,0 +1,6 @@ +Copyright (c) 2015, Rebecca Turner + +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/npm/node_modules/write-file-atomic/lib/index.js b/node_modules/npm/node_modules/write-file-atomic/lib/index.js new file mode 100644 index 00000000..6013894c --- /dev/null +++ b/node_modules/npm/node_modules/write-file-atomic/lib/index.js @@ -0,0 +1,267 @@ +'use strict' +module.exports = writeFile +module.exports.sync = writeFileSync +module.exports._getTmpname = getTmpname // for testing +module.exports._cleanupOnExit = cleanupOnExit + +const fs = require('fs') +const MurmurHash3 = require('imurmurhash') +const { onExit } = require('signal-exit') +const path = require('path') +const { promisify } = require('util') +const activeFiles = {} + +// if we run inside of a worker_thread, `process.pid` is not unique +/* istanbul ignore next */ +const threadId = (function getId () { + try { + const workerThreads = require('worker_threads') + + /// if we are in main thread, this is set to `0` + return workerThreads.threadId + } catch (e) { + // worker_threads are not available, fallback to 0 + return 0 + } +})() + +let invocations = 0 +function getTmpname (filename) { + return filename + '.' + + MurmurHash3(__filename) + .hash(String(process.pid)) + .hash(String(threadId)) + .hash(String(++invocations)) + .result() +} + +function cleanupOnExit (tmpfile) { + return () => { + try { + fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile) + } catch { + // ignore errors + } + } +} + +function serializeActiveFile (absoluteName) { + return new Promise(resolve => { + // make a queue if it doesn't already exist + if (!activeFiles[absoluteName]) { + activeFiles[absoluteName] = [] + } + + activeFiles[absoluteName].push(resolve) // add this job to the queue + if (activeFiles[absoluteName].length === 1) { + resolve() + } // kick off the first one + }) +} + +// https://github.com/isaacs/node-graceful-fs/blob/master/polyfills.js#L315-L342 +function isChownErrOk (err) { + if (err.code === 'ENOSYS') { + return true + } + + const nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (err.code === 'EINVAL' || err.code === 'EPERM') { + return true + } + } + + return false +} + +async function writeFileAsync (filename, data, options = {}) { + if (typeof options === 'string') { + options = { encoding: options } + } + + let fd + let tmpfile + /* istanbul ignore next -- The closure only gets called when onExit triggers */ + const removeOnExitHandler = onExit(cleanupOnExit(() => tmpfile)) + const absoluteName = path.resolve(filename) + + try { + await serializeActiveFile(absoluteName) + const truename = await promisify(fs.realpath)(filename).catch(() => filename) + tmpfile = getTmpname(truename) + + if (!options.mode || !options.chown) { + // Either mode or chown is not explicitly set + // Default behavior is to copy it from original file + const stats = await promisify(fs.stat)(truename).catch(() => {}) + if (stats) { + if (options.mode == null) { + options.mode = stats.mode + } + + if (options.chown == null && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid } + } + } + } + + fd = await promisify(fs.open)(tmpfile, 'w', options.mode) + if (options.tmpfileCreated) { + await options.tmpfileCreated(tmpfile) + } + if (ArrayBuffer.isView(data)) { + await promisify(fs.write)(fd, data, 0, data.length, 0) + } else if (data != null) { + await promisify(fs.write)(fd, String(data), 0, String(options.encoding || 'utf8')) + } + + if (options.fsync !== false) { + await promisify(fs.fsync)(fd) + } + + await promisify(fs.close)(fd) + fd = null + + if (options.chown) { + await promisify(fs.chown)(tmpfile, options.chown.uid, options.chown.gid).catch(err => { + if (!isChownErrOk(err)) { + throw err + } + }) + } + + if (options.mode) { + await promisify(fs.chmod)(tmpfile, options.mode).catch(err => { + if (!isChownErrOk(err)) { + throw err + } + }) + } + + await promisify(fs.rename)(tmpfile, truename) + } finally { + if (fd) { + await promisify(fs.close)(fd).catch( + /* istanbul ignore next */ + () => {} + ) + } + removeOnExitHandler() + await promisify(fs.unlink)(tmpfile).catch(() => {}) + activeFiles[absoluteName].shift() // remove the element added by serializeSameFile + if (activeFiles[absoluteName].length > 0) { + activeFiles[absoluteName][0]() // start next job if one is pending + } else { + delete activeFiles[absoluteName] + } + } +} + +async function writeFile (filename, data, options, callback) { + if (options instanceof Function) { + callback = options + options = {} + } + + const promise = writeFileAsync(filename, data, options) + if (callback) { + try { + const result = await promise + return callback(result) + } catch (err) { + return callback(err) + } + } + + return promise +} + +function writeFileSync (filename, data, options) { + if (typeof options === 'string') { + options = { encoding: options } + } else if (!options) { + options = {} + } + try { + filename = fs.realpathSync(filename) + } catch (ex) { + // it's ok, it'll happen on a not yet existing file + } + const tmpfile = getTmpname(filename) + + if (!options.mode || !options.chown) { + // Either mode or chown is not explicitly set + // Default behavior is to copy it from original file + try { + const stats = fs.statSync(filename) + options = Object.assign({}, options) + if (!options.mode) { + options.mode = stats.mode + } + if (!options.chown && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid } + } + } catch (ex) { + // ignore stat errors + } + } + + let fd + const cleanup = cleanupOnExit(tmpfile) + const removeOnExitHandler = onExit(cleanup) + + let threw = true + try { + fd = fs.openSync(tmpfile, 'w', options.mode || 0o666) + if (options.tmpfileCreated) { + options.tmpfileCreated(tmpfile) + } + if (ArrayBuffer.isView(data)) { + fs.writeSync(fd, data, 0, data.length, 0) + } else if (data != null) { + fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8')) + } + if (options.fsync !== false) { + fs.fsyncSync(fd) + } + + fs.closeSync(fd) + fd = null + + if (options.chown) { + try { + fs.chownSync(tmpfile, options.chown.uid, options.chown.gid) + } catch (err) { + if (!isChownErrOk(err)) { + throw err + } + } + } + + if (options.mode) { + try { + fs.chmodSync(tmpfile, options.mode) + } catch (err) { + if (!isChownErrOk(err)) { + throw err + } + } + } + + fs.renameSync(tmpfile, filename) + threw = false + } finally { + if (fd) { + try { + fs.closeSync(fd) + } catch (ex) { + // ignore close errors at this stage, error may have closed fd already. + } + } + removeOnExitHandler() + if (threw) { + cleanup() + } + } +} diff --git a/node_modules/npm/node_modules/write-file-atomic/package.json b/node_modules/npm/node_modules/write-file-atomic/package.json new file mode 100644 index 00000000..1e88b5b8 --- /dev/null +++ b/node_modules/npm/node_modules/write-file-atomic/package.json @@ -0,0 +1,58 @@ +{ + "name": "write-file-atomic", + "version": "6.0.0", + "description": "Write files in an atomic fashion w/configurable ownership", + "main": "./lib/index.js", + "scripts": { + "test": "tap", + "posttest": "npm run lint", + "lint": "npm run eslint", + "postlint": "template-oss-check", + "lintfix": "npm run eslint -- --fix", + "snap": "tap", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/npm/write-file-atomic.git" + }, + "keywords": [ + "writeFile", + "atomic" + ], + "author": "GitHub Inc.", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/write-file-atomic/issues" + }, + "homepage": "https://github.com/npm/write-file-atomic", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + }, + "devDependencies": { + "@npmcli/eslint-config": "^5.0.0", + "@npmcli/template-oss": "4.23.3", + "tap": "^16.0.1" + }, + "files": [ + "bin/", + "lib/" + ], + "engines": { + "node": "^18.17.0 || >=20.5.0" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "windowsCI": false, + "version": "4.23.3", + "publish": "true" + }, + "tap": { + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + } +} diff --git a/node_modules/npm/node_modules/yallist/LICENSE b/node_modules/npm/node_modules/yallist/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/npm/node_modules/yallist/LICENSE @@ -0,0 +1,15 @@ +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/npm/node_modules/yallist/iterator.js b/node_modules/npm/node_modules/yallist/iterator.js new file mode 100644 index 00000000..d41c97a1 --- /dev/null +++ b/node_modules/npm/node_modules/yallist/iterator.js @@ -0,0 +1,8 @@ +'use strict' +module.exports = function (Yallist) { + Yallist.prototype[Symbol.iterator] = function* () { + for (let walker = this.head; walker; walker = walker.next) { + yield walker.value + } + } +} diff --git a/node_modules/npm/node_modules/yallist/package.json b/node_modules/npm/node_modules/yallist/package.json new file mode 100644 index 00000000..8a083867 --- /dev/null +++ b/node_modules/npm/node_modules/yallist/package.json @@ -0,0 +1,29 @@ +{ + "name": "yallist", + "version": "4.0.0", + "description": "Yet Another Linked List", + "main": "yallist.js", + "directories": { + "test": "test" + }, + "files": [ + "yallist.js", + "iterator.js" + ], + "dependencies": {}, + "devDependencies": { + "tap": "^12.1.0" + }, + "scripts": { + "test": "tap test/*.js --100", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/yallist.git" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC" +} diff --git a/node_modules/npm/node_modules/yallist/yallist.js b/node_modules/npm/node_modules/yallist/yallist.js new file mode 100644 index 00000000..4e83ab1c --- /dev/null +++ b/node_modules/npm/node_modules/yallist/yallist.js @@ -0,0 +1,426 @@ +'use strict' +module.exports = Yallist + +Yallist.Node = Node +Yallist.create = Yallist + +function Yallist (list) { + var self = this + if (!(self instanceof Yallist)) { + self = new Yallist() + } + + self.tail = null + self.head = null + self.length = 0 + + if (list && typeof list.forEach === 'function') { + list.forEach(function (item) { + self.push(item) + }) + } else if (arguments.length > 0) { + for (var i = 0, l = arguments.length; i < l; i++) { + self.push(arguments[i]) + } + } + + return self +} + +Yallist.prototype.removeNode = function (node) { + if (node.list !== this) { + throw new Error('removing node which does not belong to this list') + } + + var next = node.next + var prev = node.prev + + if (next) { + next.prev = prev + } + + if (prev) { + prev.next = next + } + + if (node === this.head) { + this.head = next + } + if (node === this.tail) { + this.tail = prev + } + + node.list.length-- + node.next = null + node.prev = null + node.list = null + + return next +} + +Yallist.prototype.unshiftNode = function (node) { + if (node === this.head) { + return + } + + if (node.list) { + node.list.removeNode(node) + } + + var head = this.head + node.list = this + node.next = head + if (head) { + head.prev = node + } + + this.head = node + if (!this.tail) { + this.tail = node + } + this.length++ +} + +Yallist.prototype.pushNode = function (node) { + if (node === this.tail) { + return + } + + if (node.list) { + node.list.removeNode(node) + } + + var tail = this.tail + node.list = this + node.prev = tail + if (tail) { + tail.next = node + } + + this.tail = node + if (!this.head) { + this.head = node + } + this.length++ +} + +Yallist.prototype.push = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + push(this, arguments[i]) + } + return this.length +} + +Yallist.prototype.unshift = function () { + for (var i = 0, l = arguments.length; i < l; i++) { + unshift(this, arguments[i]) + } + return this.length +} + +Yallist.prototype.pop = function () { + if (!this.tail) { + return undefined + } + + var res = this.tail.value + this.tail = this.tail.prev + if (this.tail) { + this.tail.next = null + } else { + this.head = null + } + this.length-- + return res +} + +Yallist.prototype.shift = function () { + if (!this.head) { + return undefined + } + + var res = this.head.value + this.head = this.head.next + if (this.head) { + this.head.prev = null + } else { + this.tail = null + } + this.length-- + return res +} + +Yallist.prototype.forEach = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.head, i = 0; walker !== null; i++) { + fn.call(thisp, walker.value, i, this) + walker = walker.next + } +} + +Yallist.prototype.forEachReverse = function (fn, thisp) { + thisp = thisp || this + for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { + fn.call(thisp, walker.value, i, this) + walker = walker.prev + } +} + +Yallist.prototype.get = function (n) { + for (var i = 0, walker = this.head; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.next + } + if (i === n && walker !== null) { + return walker.value + } +} + +Yallist.prototype.getReverse = function (n) { + for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { + // abort out of the list early if we hit a cycle + walker = walker.prev + } + if (i === n && walker !== null) { + return walker.value + } +} + +Yallist.prototype.map = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.head; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.next + } + return res +} + +Yallist.prototype.mapReverse = function (fn, thisp) { + thisp = thisp || this + var res = new Yallist() + for (var walker = this.tail; walker !== null;) { + res.push(fn.call(thisp, walker.value, this)) + walker = walker.prev + } + return res +} + +Yallist.prototype.reduce = function (fn, initial) { + var acc + var walker = this.head + if (arguments.length > 1) { + acc = initial + } else if (this.head) { + walker = this.head.next + acc = this.head.value + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = 0; walker !== null; i++) { + acc = fn(acc, walker.value, i) + walker = walker.next + } + + return acc +} + +Yallist.prototype.reduceReverse = function (fn, initial) { + var acc + var walker = this.tail + if (arguments.length > 1) { + acc = initial + } else if (this.tail) { + walker = this.tail.prev + acc = this.tail.value + } else { + throw new TypeError('Reduce of empty list with no initial value') + } + + for (var i = this.length - 1; walker !== null; i--) { + acc = fn(acc, walker.value, i) + walker = walker.prev + } + + return acc +} + +Yallist.prototype.toArray = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.head; walker !== null; i++) { + arr[i] = walker.value + walker = walker.next + } + return arr +} + +Yallist.prototype.toArrayReverse = function () { + var arr = new Array(this.length) + for (var i = 0, walker = this.tail; walker !== null; i++) { + arr[i] = walker.value + walker = walker.prev + } + return arr +} + +Yallist.prototype.slice = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = 0, walker = this.head; walker !== null && i < from; i++) { + walker = walker.next + } + for (; walker !== null && i < to; i++, walker = walker.next) { + ret.push(walker.value) + } + return ret +} + +Yallist.prototype.sliceReverse = function (from, to) { + to = to || this.length + if (to < 0) { + to += this.length + } + from = from || 0 + if (from < 0) { + from += this.length + } + var ret = new Yallist() + if (to < from || to < 0) { + return ret + } + if (from < 0) { + from = 0 + } + if (to > this.length) { + to = this.length + } + for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { + walker = walker.prev + } + for (; walker !== null && i > from; i--, walker = walker.prev) { + ret.push(walker.value) + } + return ret +} + +Yallist.prototype.splice = function (start, deleteCount, ...nodes) { + if (start > this.length) { + start = this.length - 1 + } + if (start < 0) { + start = this.length + start; + } + + for (var i = 0, walker = this.head; walker !== null && i < start; i++) { + walker = walker.next + } + + var ret = [] + for (var i = 0; walker && i < deleteCount; i++) { + ret.push(walker.value) + walker = this.removeNode(walker) + } + if (walker === null) { + walker = this.tail + } + + if (walker !== this.head && walker !== this.tail) { + walker = walker.prev + } + + for (var i = 0; i < nodes.length; i++) { + walker = insert(this, walker, nodes[i]) + } + return ret; +} + +Yallist.prototype.reverse = function () { + var head = this.head + var tail = this.tail + for (var walker = head; walker !== null; walker = walker.prev) { + var p = walker.prev + walker.prev = walker.next + walker.next = p + } + this.head = tail + this.tail = head + return this +} + +function insert (self, node, value) { + var inserted = node === self.head ? + new Node(value, null, node, self) : + new Node(value, node, node.next, self) + + if (inserted.next === null) { + self.tail = inserted + } + if (inserted.prev === null) { + self.head = inserted + } + + self.length++ + + return inserted +} + +function push (self, item) { + self.tail = new Node(item, self.tail, null, self) + if (!self.head) { + self.head = self.tail + } + self.length++ +} + +function unshift (self, item) { + self.head = new Node(item, null, self.head, self) + if (!self.tail) { + self.tail = self.head + } + self.length++ +} + +function Node (value, prev, next, list) { + if (!(this instanceof Node)) { + return new Node(value, prev, next, list) + } + + this.list = list + this.value = value + + if (prev) { + prev.next = this + this.prev = prev + } else { + this.prev = null + } + + if (next) { + next.prev = this + this.next = next + } else { + this.next = null + } +} + +try { + // add if support for Symbol.iterator is present + require('./iterator.js')(Yallist) +} catch (er) {} diff --git a/node_modules/npm/package.json b/node_modules/npm/package.json new file mode 100644 index 00000000..82c5a193 --- /dev/null +++ b/node_modules/npm/package.json @@ -0,0 +1,260 @@ +{ + "version": "11.0.0", + "name": "npm", + "description": "a package manager for JavaScript", + "workspaces": [ + "docs", + "smoke-tests", + "mock-globals", + "mock-registry", + "workspaces/*" + ], + "files": [ + "bin/", + "lib/", + "index.js", + "docs/content/", + "docs/output/", + "man/" + ], + "keywords": [ + "install", + "modules", + "package manager", + "package.json" + ], + "homepage": "https://docs.npmjs.com/", + "author": "GitHub Inc.", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/cli.git" + }, + "bugs": { + "url": "https://github.com/npm/cli/issues" + }, + "directories": { + "doc": "./doc", + "man": "./man" + }, + "main": "./index.js", + "bin": { + "npm": "bin/npm-cli.js", + "npx": "bin/npx-cli.js" + }, + "exports": { + ".": [ + { + "default": "./index.js" + }, + "./index.js" + ], + "./package.json": "./package.json" + }, + "dependencies": { + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/arborist": "^9.0.0", + "@npmcli/config": "^10.0.0", + "@npmcli/fs": "^4.0.0", + "@npmcli/map-workspaces": "^4.0.2", + "@npmcli/package-json": "^6.1.0", + "@npmcli/promise-spawn": "^8.0.2", + "@npmcli/redact": "^3.0.0", + "@npmcli/run-script": "^9.0.1", + "@sigstore/tuf": "^3.0.0", + "abbrev": "^3.0.0", + "archy": "~1.0.0", + "cacache": "^19.0.1", + "chalk": "^5.3.0", + "ci-info": "^4.1.0", + "cli-columns": "^4.0.0", + "fastest-levenshtein": "^1.0.16", + "fs-minipass": "^3.0.3", + "glob": "^10.4.5", + "graceful-fs": "^4.2.11", + "hosted-git-info": "^8.0.2", + "ini": "^5.0.0", + "init-package-json": "^8.0.0", + "is-cidr": "^5.1.0", + "json-parse-even-better-errors": "^4.0.0", + "libnpmaccess": "^10.0.0", + "libnpmdiff": "^8.0.0", + "libnpmexec": "^10.0.0", + "libnpmfund": "^7.0.0", + "libnpmorg": "^8.0.0", + "libnpmpack": "^9.0.0", + "libnpmpublish": "^11.0.0", + "libnpmsearch": "^9.0.0", + "libnpmteam": "^8.0.0", + "libnpmversion": "^8.0.0", + "make-fetch-happen": "^14.0.3", + "minimatch": "^9.0.5", + "minipass": "^7.1.1", + "minipass-pipeline": "^1.2.4", + "ms": "^2.1.2", + "node-gyp": "^11.0.0", + "nopt": "^8.0.0", + "normalize-package-data": "^7.0.0", + "npm-audit-report": "^6.0.0", + "npm-install-checks": "^7.1.1", + "npm-package-arg": "^12.0.1", + "npm-pick-manifest": "^10.0.0", + "npm-profile": "^11.0.1", + "npm-registry-fetch": "^18.0.2", + "npm-user-validate": "^3.0.0", + "p-map": "^7.0.3", + "pacote": "^21.0.0", + "parse-conflict-json": "^4.0.0", + "proc-log": "^5.0.0", + "qrcode-terminal": "^0.12.0", + "read": "^4.0.0", + "semver": "^7.6.3", + "spdx-expression-parse": "^4.0.0", + "ssri": "^12.0.0", + "supports-color": "^9.4.0", + "tar": "^6.2.1", + "text-table": "~0.2.0", + "tiny-relative-date": "^1.3.0", + "treeverse": "^3.0.0", + "validate-npm-package-name": "^6.0.0", + "which": "^5.0.0" + }, + "bundleDependencies": [ + "@isaacs/string-locale-compare", + "@npmcli/arborist", + "@npmcli/config", + "@npmcli/fs", + "@npmcli/map-workspaces", + "@npmcli/package-json", + "@npmcli/promise-spawn", + "@npmcli/redact", + "@npmcli/run-script", + "@sigstore/tuf", + "abbrev", + "archy", + "cacache", + "chalk", + "ci-info", + "cli-columns", + "fastest-levenshtein", + "fs-minipass", + "glob", + "graceful-fs", + "hosted-git-info", + "ini", + "init-package-json", + "is-cidr", + "json-parse-even-better-errors", + "libnpmaccess", + "libnpmdiff", + "libnpmexec", + "libnpmfund", + "libnpmorg", + "libnpmpack", + "libnpmpublish", + "libnpmsearch", + "libnpmteam", + "libnpmversion", + "make-fetch-happen", + "minimatch", + "minipass", + "minipass-pipeline", + "ms", + "node-gyp", + "nopt", + "normalize-package-data", + "npm-audit-report", + "npm-install-checks", + "npm-package-arg", + "npm-pick-manifest", + "npm-profile", + "npm-registry-fetch", + "npm-user-validate", + "p-map", + "pacote", + "parse-conflict-json", + "proc-log", + "qrcode-terminal", + "read", + "semver", + "spdx-expression-parse", + "ssri", + "supports-color", + "tar", + "text-table", + "tiny-relative-date", + "treeverse", + "validate-npm-package-name", + "which" + ], + "devDependencies": { + "@npmcli/docs": "^1.0.0", + "@npmcli/eslint-config": "^5.0.1", + "@npmcli/git": "^6.0.1", + "@npmcli/mock-globals": "^1.0.0", + "@npmcli/mock-registry": "^1.0.0", + "@npmcli/template-oss": "4.23.6", + "@tufjs/repo-mock": "^3.0.1", + "ajv": "^8.12.0", + "ajv-formats": "^2.1.1", + "ajv-formats-draft2019": "^1.6.1", + "cli-table3": "^0.6.4", + "diff": "^7.0.0", + "nock": "^13.4.0", + "npm-packlist": "^10.0.0", + "remark": "^14.0.2", + "remark-gfm": "^3.0.1", + "remark-github": "^11.2.4", + "rimraf": "^5.0.5", + "spawk": "^1.7.1", + "tap": "^16.3.9" + }, + "scripts": { + "dependencies": "node scripts/bundle-and-gitignore-deps.js && node scripts/dependency-graph.js", + "dumpconf": "env | grep npm | sort | uniq", + "licenses": "npx licensee --production --errors-only", + "test": "tap", + "test:nocolor": "CI=true tap -Rclassic", + "test-all": "node . run test -ws -iwr --if-present", + "snap": "tap", + "prepack": "node . run build -w docs", + "posttest": "node . run lint", + "lint": "node . run eslint", + "lintfix": "node . run eslint -- --fix", + "lint-all": "node . run lint -ws -iwr --if-present", + "resetdeps": "node scripts/resetdeps.js", + "rp-pull-request": "node scripts/update-authors.js", + "postlint": "template-oss-check", + "template-oss-apply": "template-oss-apply --force", + "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" + }, + "tap": { + "test-env": [ + "LC_ALL=sk" + ], + "timeout": 600, + "nyc-arg": [ + "--exclude", + "docs/**", + "--exclude", + "smoke-tests/**", + "--exclude", + "mock-globals/**", + "--exclude", + "mock-registry/**", + "--exclude", + "workspaces/**", + "--exclude", + "tap-snapshots/**" + ], + "test-ignore": "^(docs|smoke-tests|mock-globals|mock-registry|workspaces)/" + }, + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.23.6", + "content": "./scripts/template-oss/root.js" + }, + "license": "Artistic-2.0", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } +} diff --git a/node_modules/object-assign/index.js b/node_modules/object-assign/index.js new file mode 100644 index 00000000..0930cf88 --- /dev/null +++ b/node_modules/object-assign/index.js @@ -0,0 +1,90 @@ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; diff --git a/node_modules/object-assign/license b/node_modules/object-assign/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/object-assign/license @@ -0,0 +1,21 @@ +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/object-assign/package.json b/node_modules/object-assign/package.json new file mode 100644 index 00000000..503eb1e6 --- /dev/null +++ b/node_modules/object-assign/package.json @@ -0,0 +1,42 @@ +{ + "name": "object-assign", + "version": "4.1.1", + "description": "ES2015 `Object.assign()` ponyfill", + "license": "MIT", + "repository": "sindresorhus/object-assign", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava", + "bench": "matcha bench.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "object", + "assign", + "extend", + "properties", + "es2015", + "ecmascript", + "harmony", + "ponyfill", + "prollyfill", + "polyfill", + "shim", + "browser" + ], + "devDependencies": { + "ava": "^0.16.0", + "lodash": "^4.16.4", + "matcha": "^0.7.0", + "xo": "^0.16.0" + } +} diff --git a/node_modules/object-assign/readme.md b/node_modules/object-assign/readme.md new file mode 100644 index 00000000..1be09d35 --- /dev/null +++ b/node_modules/object-assign/readme.md @@ -0,0 +1,61 @@ +# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) + +> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) + + +## Use the built-in + +Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), +support `Object.assign()` :tada:. If you target only those environments, then by all +means, use `Object.assign()` instead of this package. + + +## Install + +``` +$ npm install --save object-assign +``` + + +## Usage + +```js +const objectAssign = require('object-assign'); + +objectAssign({foo: 0}, {bar: 1}); +//=> {foo: 0, bar: 1} + +// multiple sources +objectAssign({foo: 0}, {bar: 1}, {baz: 2}); +//=> {foo: 0, bar: 1, baz: 2} + +// overwrites equal keys +objectAssign({foo: 0}, {foo: 1}, {foo: 2}); +//=> {foo: 2} + +// ignores null and undefined sources +objectAssign({foo: 0}, null, {bar: 1}, undefined); +//=> {foo: 0, bar: 1} +``` + + +## API + +### objectAssign(target, [source, ...]) + +Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. + + +## Resources + +- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) + + +## Related + +- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/object-hash/LICENSE b/node_modules/object-hash/LICENSE new file mode 100644 index 00000000..6ea185fa --- /dev/null +++ b/node_modules/object-hash/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 object-hash 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/object-hash/dist/object_hash.js b/node_modules/object-hash/dist/object_hash.js new file mode 100644 index 00000000..2e584c57 --- /dev/null +++ b/node_modules/object-hash/dist/object_hash.js @@ -0,0 +1 @@ +!function(e){var t;"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):("undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.objectHash=e())}(function(){return function r(o,i,u){function s(n,e){if(!i[n]){if(!o[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(a)return a(n,!0);throw new Error("Cannot find module '"+n+"'")}e=i[n]={exports:{}};o[n][0].call(e.exports,function(e){var t=o[n][1][e];return s(t||e)},e,e.exports,r,o,i,u)}return i[n].exports}for(var a="function"==typeof require&&require,e=0;e>16),s((65280&n)>>8),s(255&n);return 2==r?s(255&(n=f(e.charAt(t))<<2|f(e.charAt(t+1))>>4)):1==r&&(s((n=f(e.charAt(t))<<10|f(e.charAt(t+1))<<4|f(e.charAt(t+2))>>2)>>8&255),s(255&n)),o},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,u="";function s(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t>18&63)+s(o>>12&63)+s(o>>6&63)+s(63&o);switch(i){case 1:u=(u+=s((n=e[e.length-1])>>2))+s(n<<4&63)+"==";break;case 2:u=(u=(u+=s((n=(e[e.length-2]<<8)+e[e.length-1])>>10))+s(n>>4&63))+s(n<<2&63)+"="}return u}}(void 0===f?this.base64js={}:f)}.call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(O,e,H){!function(e,n,f,r,h,p,g,y,w){var a=O("base64-js"),i=O("ieee754");function f(e,t,n){if(!(this instanceof f))return new f(e,t,n);var r,o,i,u,s=typeof e;if("base64"===t&&"string"==s)for(e=(u=e).trim?u.trim():u.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==s)r=j(e);else if("string"==s)r=f.byteLength(e,t);else{if("object"!=s)throw new Error("First argument needs to be a number, array or string.");r=j(e.length)}if(f._useTypedArrays?o=f._augment(new Uint8Array(r)):((o=this).length=r,o._isBuffer=!0),f._useTypedArrays&&"number"==typeof e.byteLength)o._set(e);else if(C(u=e)||f.isBuffer(u)||u&&"object"==typeof u&&"number"==typeof u.length)for(i=0;i>8,n=n%256,r.push(n),r.push(t);return r}(t),e,n,r)}function v(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o>>0)):(t+1>>0),o}function _(e,t,n,r){if(r||(d("boolean"==typeof n,"missing or invalid endian"),d(null!=t,"missing offset"),d(t+1>>8*(r?i:1-i)}function l(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+3>>8*(r?i:3-i)&255}function B(e,t,n,r,o){o||(d(null!=t,"missing value"),d("boolean"==typeof r,"missing or invalid endian"),d(null!=n,"missing offset"),d(n+1this.length&&(r=this.length);var o=(r=e.length-t=this.length))return this[e]},f.prototype.readUInt16LE=function(e,t){return o(this,e,!0,t)},f.prototype.readUInt16BE=function(e,t){return o(this,e,!1,t)},f.prototype.readUInt32LE=function(e,t){return u(this,e,!0,t)},f.prototype.readUInt32BE=function(e,t){return u(this,e,!1,t)},f.prototype.readInt8=function(e,t){if(t||(d(null!=e,"missing offset"),d(e=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},f.prototype.readInt16LE=function(e,t){return _(this,e,!0,t)},f.prototype.readInt16BE=function(e,t){return _(this,e,!1,t)},f.prototype.readInt32LE=function(e,t){return E(this,e,!0,t)},f.prototype.readInt32BE=function(e,t){return E(this,e,!1,t)},f.prototype.readFloatLE=function(e,t){return I(this,e,!0,t)},f.prototype.readFloatBE=function(e,t){return I(this,e,!1,t)},f.prototype.readDoubleLE=function(e,t){return A(this,e,!0,t)},f.prototype.readDoubleBE=function(e,t){return A(this,e,!1,t)},f.prototype.writeUInt8=function(e,t,n){n||(d(null!=e,"missing value"),d(null!=t,"missing offset"),d(t=this.length||(this[t]=e)},f.prototype.writeUInt16LE=function(e,t,n){s(this,e,t,!0,n)},f.prototype.writeUInt16BE=function(e,t,n){s(this,e,t,!1,n)},f.prototype.writeUInt32LE=function(e,t,n){l(this,e,t,!0,n)},f.prototype.writeUInt32BE=function(e,t,n){l(this,e,t,!1,n)},f.prototype.writeInt8=function(e,t,n){n||(d(null!=e,"missing value"),d(null!=t,"missing offset"),d(t=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},f.prototype.writeInt16LE=function(e,t,n){B(this,e,t,!0,n)},f.prototype.writeInt16BE=function(e,t,n){B(this,e,t,!1,n)},f.prototype.writeInt32LE=function(e,t,n){L(this,e,t,!0,n)},f.prototype.writeInt32BE=function(e,t,n){L(this,e,t,!1,n)},f.prototype.writeFloatLE=function(e,t,n){U(this,e,t,!0,n)},f.prototype.writeFloatBE=function(e,t,n){U(this,e,t,!1,n)},f.prototype.writeDoubleLE=function(e,t,n){x(this,e,t,!0,n)},f.prototype.writeDoubleBE=function(e,t,n){x(this,e,t,!1,n)},f.prototype.fill=function(e,t,n){if(t=t||0,n=n||this.length,d("number"==typeof(e="string"==typeof(e=e||0)?e.charCodeAt(0):e)&&!isNaN(e),"value is not a number"),d(t<=n,"end < start"),n!==t&&0!==this.length){d(0<=t&&t"},f.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(f._useTypedArrays)return new f(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function N(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function Y(e,t){d("number"==typeof e,"cannot write a non-number as a number"),d(0<=e,"specified a negative value for writing an unsigned value"),d(e<=t,"value is larger than maximum value for type"),d(Math.floor(e)===e,"value has a fractional component")}function F(e,t,n){d("number"==typeof e,"cannot write a non-number as a number"),d(e<=t,"value larger than maximum allowed value"),d(n<=e,"value smaller than minimum allowed value"),d(Math.floor(e)===e,"value has a fractional component")}function D(e,t,n){d("number"==typeof e,"cannot write a non-number as a number"),d(e<=t,"value larger than maximum allowed value"),d(n<=e,"value smaller than minimum allowed value")}function d(e,t){if(!e)throw new Error(t||"Failed assertion")}f._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=t.get,e.set=t.set,e.write=t.write,e.toString=t.toString,e.toLocaleString=t.toString,e.toJSON=t.toJSON,e.copy=t.copy,e.slice=t.slice,e.readUInt8=t.readUInt8,e.readUInt16LE=t.readUInt16LE,e.readUInt16BE=t.readUInt16BE,e.readUInt32LE=t.readUInt32LE,e.readUInt32BE=t.readUInt32BE,e.readInt8=t.readInt8,e.readInt16LE=t.readInt16LE,e.readInt16BE=t.readInt16BE,e.readInt32LE=t.readInt32LE,e.readInt32BE=t.readInt32BE,e.readFloatLE=t.readFloatLE,e.readFloatBE=t.readFloatBE,e.readDoubleLE=t.readDoubleLE,e.readDoubleBE=t.readDoubleBE,e.writeUInt8=t.writeUInt8,e.writeUInt16LE=t.writeUInt16LE,e.writeUInt16BE=t.writeUInt16BE,e.writeUInt32LE=t.writeUInt32LE,e.writeUInt32BE=t.writeUInt32BE,e.writeInt8=t.writeInt8,e.writeInt16LE=t.writeInt16LE,e.writeInt16BE=t.writeInt16BE,e.writeInt32LE=t.writeInt32LE,e.writeInt32BE=t.writeInt32BE,e.writeFloatLE=t.writeFloatLE,e.writeFloatBE=t.writeFloatBE,e.writeDoubleLE=t.writeDoubleLE,e.writeDoubleBE=t.writeDoubleBE,e.fill=t.fill,e.inspect=t.inspect,e.toArrayBuffer=t.toArrayBuffer,e}}.call(this,O("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},O("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(c,d,e){!function(e,t,a,n,r,o,i,u,s){var a=c("buffer").Buffer,f=4,l=new a(f);l.fill(0);d.exports={hash:function(e,t,n,r){for(var o=t(function(e,t){e.length%f!=0&&(n=e.length+(f-e.length%f),e=a.concat([e,l],n));for(var n,r=[],o=t?e.readInt32BE:e.readInt32LE,i=0;is?t=e(t):t.length>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,u=0;u>>32-o,n)}function c(e,t,n,r,o,i,u){return s(t&n|~t&r,e,t,o,i,u)}function d(e,t,n,r,o,i,u){return s(t&r|n&~r,e,t,o,i,u)}function h(e,t,n,r,o,i,u){return s(t^n^r,e,t,o,i,u)}function p(e,t,n,r,o,i,u){return s(n^(t|~r),e,t,o,i,u)}function g(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}b.exports=function(e){return t.hash(e,n,16)}}.call(this,w("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},w("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,l,t){!function(e,t,n,r,o,i,u,s,f){var a;l.exports=a||function(e){for(var t,n=new Array(e),r=0;r>>((3&r)<<3)&255;return n}}.call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(c,d,e){!function(e,t,n,r,o,s,a,f,l){var i=c("./helpers");function u(l,c){l[c>>5]|=128<<24-c%32,l[15+(c+64>>9<<4)]=c;for(var e,t,n,r=Array(80),o=1732584193,i=-271733879,u=-1732584194,s=271733878,d=-1009589776,h=0;h>16)+(t>>16)+(n>>16)<<16|65535&n}function v(e,t){return e<>>32-t}d.exports=function(e){return i.hash(e,u,20,!0)}}.call(this,c("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},c("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(c,d,e){!function(e,t,n,r,u,s,a,f,l){function b(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,l){var c,d=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),t=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),n=new Array(64);e[l>>5]|=128<<24-l%32,e[15+(l+64>>9<<4)]=l;for(var r,o,h=0;h>>t|e<<32-t},v=function(e,t){return e>>>t};d.exports=function(e){return i.hash(e,o,32,!0)}}.call(this,c("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},c("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,t,f){!function(e,t,n,r,o,i,u,s,a){f.read=function(e,t,n,r,o){var i,u,l=8*o-r-1,c=(1<>1,s=-7,a=n?o-1:0,f=n?-1:1,o=e[t+a];for(a+=f,i=o&(1<<-s)-1,o>>=-s,s+=l;0>=-s,s+=r;0>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:c-1,h=n?1:-1,c=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,o=s):(o=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-o))<1&&(o--,n*=2),2<=(t+=1<=o+a?d/n:d*Math.pow(2,1-a))*n&&(o++,n/=2),s<=o+a?(i=0,o=s):1<=o+a?(i=(t*n-1)*Math.pow(2,r),o+=a):(i=t*Math.pow(2,a-1)*Math.pow(2,r),o=0));8<=r;e[l+f]=255&i,f+=h,i/=256,r-=8);for(o=o<", type, " -> ", "_" + type); + + return this['_' + type](value); + }, + _object: function(object) { + var pattern = (/\[object (.*)\]/i); + var objString = Object.prototype.toString.call(object); + var objType = pattern.exec(objString); + if (!objType) { // object type did not match [object ...] + objType = 'unknown:[' + objString + ']'; + } else { + objType = objType[1]; // take only the class name + } + + objType = objType.toLowerCase(); + + var objectNumber = null; + + if ((objectNumber = context.indexOf(object)) >= 0) { + return this.dispatch('[CIRCULAR:' + objectNumber + ']'); + } else { + context.push(object); + } + + if (typeof Buffer !== 'undefined' && Buffer.isBuffer && Buffer.isBuffer(object)) { + write('buffer:'); + return write(object); + } + + if(objType !== 'object' && objType !== 'function' && objType !== 'asyncfunction') { + if(this['_' + objType]) { + this['_' + objType](object); + } else if (options.ignoreUnknown) { + return write('[' + objType + ']'); + } else { + throw new Error('Unknown object type "' + objType + '"'); + } + }else{ + var keys = Object.keys(object); + if (options.unorderedObjects) { + keys = keys.sort(); + } + // Make sure to incorporate special properties, so + // Types with different prototypes will produce + // a different hash and objects derived from + // different functions (`new Foo`, `new Bar`) will + // produce different hashes. + // We never do this for native functions since some + // seem to break because of that. + if (options.respectType !== false && !isNativeFunction(object)) { + keys.splice(0, 0, 'prototype', '__proto__', 'constructor'); + } + + if (options.excludeKeys) { + keys = keys.filter(function(key) { return !options.excludeKeys(key); }); + } + + write('object:' + keys.length + ':'); + var self = this; + return keys.forEach(function(key){ + self.dispatch(key); + write(':'); + if(!options.excludeValues) { + self.dispatch(object[key]); + } + write(','); + }); + } + }, + _array: function(arr, unordered){ + unordered = typeof unordered !== 'undefined' ? unordered : + options.unorderedArrays !== false; // default to options.unorderedArrays + + var self = this; + write('array:' + arr.length + ':'); + if (!unordered || arr.length <= 1) { + return arr.forEach(function(entry) { + return self.dispatch(entry); + }); + } + + // the unordered case is a little more complicated: + // since there is no canonical ordering on objects, + // i.e. {a:1} < {a:2} and {a:1} > {a:2} are both false, + // we first serialize each entry using a PassThrough stream + // before sorting. + // also: we can’t use the same context array for all entries + // since the order of hashing should *not* matter. instead, + // we keep track of the additions to a copy of the context array + // and add all of them to the global context array when we’re done + var contextAdditions = []; + var entries = arr.map(function(entry) { + var strm = new PassThrough(); + var localContext = context.slice(); // make copy + var hasher = typeHasher(options, strm, localContext); + hasher.dispatch(entry); + // take only what was added to localContext and append it to contextAdditions + contextAdditions = contextAdditions.concat(localContext.slice(context.length)); + return strm.read().toString(); + }); + context = context.concat(contextAdditions); + entries.sort(); + return this._array(entries, false); + }, + _date: function(date){ + return write('date:' + date.toJSON()); + }, + _symbol: function(sym){ + return write('symbol:' + sym.toString()); + }, + _error: function(err){ + return write('error:' + err.toString()); + }, + _boolean: function(bool){ + return write('bool:' + bool.toString()); + }, + _string: function(string){ + write('string:' + string.length + ':'); + write(string.toString()); + }, + _function: function(fn){ + write('fn:'); + if (isNativeFunction(fn)) { + this.dispatch('[native]'); + } else { + this.dispatch(fn.toString()); + } + + if (options.respectFunctionNames !== false) { + // Make sure we can still distinguish native functions + // by their name, otherwise String and Function will + // have the same hash + this.dispatch("function-name:" + String(fn.name)); + } + + if (options.respectFunctionProperties) { + this._object(fn); + } + }, + _number: function(number){ + return write('number:' + number.toString()); + }, + _xml: function(xml){ + return write('xml:' + xml.toString()); + }, + _null: function() { + return write('Null'); + }, + _undefined: function() { + return write('Undefined'); + }, + _regexp: function(regex){ + return write('regex:' + regex.toString()); + }, + _uint8array: function(arr){ + write('uint8array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _uint8clampedarray: function(arr){ + write('uint8clampedarray:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _int8array: function(arr){ + write('int8array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _uint16array: function(arr){ + write('uint16array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _int16array: function(arr){ + write('int16array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _uint32array: function(arr){ + write('uint32array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _int32array: function(arr){ + write('int32array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _float32array: function(arr){ + write('float32array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _float64array: function(arr){ + write('float64array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _arraybuffer: function(arr){ + write('arraybuffer:'); + return this.dispatch(new Uint8Array(arr)); + }, + _url: function(url) { + return write('url:' + url.toString(), 'utf8'); + }, + _map: function(map) { + write('map:'); + var arr = Array.from(map); + return this._array(arr, options.unorderedSets !== false); + }, + _set: function(set) { + write('set:'); + var arr = Array.from(set); + return this._array(arr, options.unorderedSets !== false); + }, + _file: function(file) { + write('file:'); + return this.dispatch([file.name, file.size, file.type, file.lastModfied]); + }, + _blob: function() { + if (options.ignoreUnknown) { + return write('[blob]'); + } + + throw Error('Hashing Blob objects is currently not supported\n' + + '(see https://github.com/puleos/object-hash/issues/26)\n' + + 'Use "options.replacer" or "options.ignoreUnknown"\n'); + }, + _domwindow: function() { return write('domwindow'); }, + _bigint: function(number){ + return write('bigint:' + number.toString()); + }, + /* Node.js standard native objects */ + _process: function() { return write('process'); }, + _timer: function() { return write('timer'); }, + _pipe: function() { return write('pipe'); }, + _tcp: function() { return write('tcp'); }, + _udp: function() { return write('udp'); }, + _tty: function() { return write('tty'); }, + _statwatcher: function() { return write('statwatcher'); }, + _securecontext: function() { return write('securecontext'); }, + _connection: function() { return write('connection'); }, + _zlib: function() { return write('zlib'); }, + _context: function() { return write('context'); }, + _nodescript: function() { return write('nodescript'); }, + _httpparser: function() { return write('httpparser'); }, + _dataview: function() { return write('dataview'); }, + _signal: function() { return write('signal'); }, + _fsevent: function() { return write('fsevent'); }, + _tlswrap: function() { return write('tlswrap'); }, + }; +} + +// Mini-implementation of stream.PassThrough +// We are far from having need for the full implementation, and we can +// make assumptions like "many writes, then only one final read" +// and we can ignore encoding specifics +function PassThrough() { + return { + buf: '', + + write: function(b) { + this.buf += b; + }, + + end: function(b) { + this.buf += b; + }, + + read: function() { + return this.buf; + } + }; +} diff --git a/node_modules/object-hash/package.json b/node_modules/object-hash/package.json new file mode 100644 index 00000000..a72557f6 --- /dev/null +++ b/node_modules/object-hash/package.json @@ -0,0 +1,53 @@ +{ + "name": "object-hash", + "version": "3.0.0", + "description": "Generate hashes from javascript objects in node and the browser.", + "homepage": "https://github.com/puleos/object-hash", + "repository": { + "type": "git", + "url": "https://github.com/puleos/object-hash" + }, + "keywords": [ + "object", + "hash", + "sha1", + "md5" + ], + "bugs": { + "url": "https://github.com/puleos/object-hash/issues" + }, + "scripts": { + "test": "node ./node_modules/.bin/mocha test", + "prepublish": "gulp dist" + }, + "author": "Scott Puleo ", + "files": [ + "index.js", + "dist/object_hash.js" + ], + "license": "MIT", + "devDependencies": { + "browserify": "^16.2.3", + "gulp": "^4.0.0", + "gulp-browserify": "^0.5.1", + "gulp-coveralls": "^0.1.4", + "gulp-exec": "^3.0.1", + "gulp-istanbul": "^1.1.3", + "gulp-jshint": "^2.0.0", + "gulp-mocha": "^5.0.0", + "gulp-rename": "^1.2.0", + "gulp-replace": "^1.0.0", + "gulp-uglify": "^3.0.0", + "jshint": "^2.8.0", + "jshint-stylish": "^2.1.0", + "karma": "^4.2.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^6.2.0" + }, + "engines": { + "node": ">= 6" + }, + "main": "./index.js", + "browser": "./dist/object_hash.js" +} diff --git a/node_modules/object-hash/readme.markdown b/node_modules/object-hash/readme.markdown new file mode 100644 index 00000000..c507cf8c --- /dev/null +++ b/node_modules/object-hash/readme.markdown @@ -0,0 +1,198 @@ +# object-hash + +Generate hashes from objects and values in node and the browser. Uses node.js +crypto module for hashing. Supports SHA1 and many others (depending on the platform) +as well as custom streams (e.g. CRC32). + +[![NPM](https://nodei.co/npm/object-hash.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/object-hash) + +[![Travis CI](https://secure.travis-ci.org/puleos/object-hash.png?branch=master)](https://secure.travis-ci.org/puleos/object-hash?branch=master) +[![Coverage Status](https://coveralls.io/repos/puleos/object-hash/badge.svg?branch=master&service=github)](https://coveralls.io/github/puleos/object-hash?branch=master) + +* Hash values of any type. +* Supports a keys only option for grouping similar objects with different values. + +```js +var hash = require('object-hash'); + +hash({foo: 'bar'}) // => '67b69634f9880a282c14a0f0cb7ba20cf5d677e9' +hash([1, 2, 2.718, 3.14159]) // => '136b9b88375971dff9f1af09d7356e3e04281951' +``` + +## Versioning Disclaimer + +Starting with version `1.1.8` (released April 2017), new versions will consider +the exact returned hash part of the API contract, i.e. changes that will affect +hash values will be considered `semver-major`. Previous versions may violate +that expectation. + +For more information, see [this discussion](https://github.com/puleos/object-hash/issues/30). + +## hash(value, options) + +Generate a hash from any object or type. Defaults to sha1 with hex encoding. + +* `algorithm` hash algo to be used: 'sha1', 'md5', 'passthrough'. default: sha1 + * This supports the algorithms returned by `crypto.getHashes()`. Note that the default of SHA-1 is not considered secure, and a stronger algorithm should be used if a cryptographical hash is desired. + * This also supports the `passthrough` algorith, which will return the information that would otherwise have been hashed. +* `excludeValues` {true|false} hash object keys, values ignored. default: false +* `encoding` hash encoding, supports 'buffer', 'hex', 'binary', 'base64'. default: hex +* `ignoreUnknown` {true|*false} ignore unknown object types. default: false +* `replacer` optional function that replaces values before hashing. default: accept all values +* `respectFunctionProperties` {true|false} Whether properties on functions are considered when hashing. default: true +* `respectFunctionNames` {true|false} consider `name` property of functions for hashing. default: true +* `respectType` {true|false} Whether special type attributes (`.prototype`, `.__proto__`, `.constructor`) + are hashed. default: true +* `unorderedArrays` {true|false} Sort all arrays before hashing. Note that this affects *all* collections, + i.e. including typed arrays, Sets, Maps, etc. default: false +* `unorderedSets` {true|false} Sort `Set` and `Map` instances before hashing, i.e. make + `hash(new Set([1, 2])) == hash(new Set([2, 1]))` return `true`. default: true +* `unorderedObjects` {true|false} Sort objects before hashing, i.e. make `hash({ x: 1, y: 2 }) === hash({ y: 2, x: 1 })`. default: true +* `excludeKeys` optional function for excluding specific key(s) from hashing, if true is returned then exclude from hash. default: include all keys + +## hash.sha1(value) + +Hash using the sha1 algorithm. + +Note that SHA-1 is not considered secure, and a stronger algorithm should be used if a cryptographical hash is desired. + +*Sugar method, equivalent to* `hash(value, {algorithm: 'sha1'})` + +## hash.keys(value) + +Hash object keys using the sha1 algorithm, values ignored. + +*Sugar method, equivalent to* `hash(value, {excludeValues: true})` + +## hash.MD5(value) + +Hash using the md5 algorithm. + +Note that the MD5 algorithm is not considered secure, and a stronger algorithm should be used if a cryptographical hash is desired. + +*Sugar method, equivalent to* `hash(value, {algorithm: 'md5'})` + +## hash.keysMD5(value) + +Hash object keys using the md5 algorithm, values ignored. + +Note that the MD5 algorithm is not considered secure, and a stronger algorithm should be used if a cryptographical hash is desired. + +*Sugar method, equivalent to* `hash(value, {algorithm: 'md5', excludeValues: true})` + +## hash.writeToStream(value, [options,] stream) + +Write the information that would otherwise have been hashed to a stream, e.g.: + +```js +hash.writeToStream({foo: 'bar', a: 42}, {respectType: false}, process.stdout) +// => e.g. 'object:a:number:42foo:string:bar' +``` + +## Installation + +node: + +```js +npm install object-hash +``` + +browser: */dist/object_hash.js* + +```html + + + +``` + +## Example usage + +```js +var hash = require('object-hash'); + +var peter = { name: 'Peter', stapler: false, friends: ['Joanna', 'Michael', 'Samir'] }; +var michael = { name: 'Michael', stapler: false, friends: ['Peter', 'Samir'] }; +var bob = { name: 'Bob', stapler: true, friends: [] }; + +/*** + * sha1 hex encoding (default) + */ +hash(peter); +// 14fa461bf4b98155e82adc86532938553b4d33a9 +hash(michael); +// 4b2b30e27699979ce46714253bc2213010db039c +hash(bob); +// 38d96106bc8ef3d8bd369b99bb6972702c9826d5 + +/*** + * hash object keys, values ignored + */ +hash(peter, { excludeValues: true }); +// 48f370a772c7496f6c9d2e6d92e920c87dd00a5c +hash(michael, { excludeValues: true }); +// 48f370a772c7496f6c9d2e6d92e920c87dd00a5c +hash.keys(bob); +// 48f370a772c7496f6c9d2e6d92e920c87dd00a5c + +/*** + * hash object, ignore specific key(s) + */ +hash(peter, { excludeKeys: function(key) { + if ( key === 'friends') { + return true; + } + return false; + } +}); +// 66b7d7e64871aa9fda1bdc8e88a28df797648d80 + +/*** + * md5 base64 encoding + */ +hash(peter, { algorithm: 'md5', encoding: 'base64' }); +// 6rkWaaDiG3NynWw4svGH7g== +hash(michael, { algorithm: 'md5', encoding: 'base64' }); +// djXaWpuWVJeOF8Sb6SFFNg== +hash(bob, { algorithm: 'md5', encoding: 'base64' }); +// lFzkw/IJ8/12jZI0rQeS3w== +``` + +## Legacy Browser Support + +IE <= 8 and Opera <= 11 support dropped in version 0.3.0. If you require +legacy browser support you must either use an ES5 shim or use version 0.2.5 +of this module. + +## Development + +```sh-session +git clone https://github.com/puleos/object-hash +``` + +## Node Docker Wrapper + +If you want to stand this up in a docker container, you should take at look +at the [![node-object-hash](https://github.com/bean5/node-object-hash)](https://github.com/bean5/node-object-hash) project. + +### gulp tasks + +* `gulp watch` (default) watch files, test and lint on change/add +* `gulp test` unit tests +* `gulp karma` browser unit tests +* `gulp lint` jshint +* `gulp dist` create browser version in /dist + +## License + +MIT + +## Changelog + +### v2.0.0 + +Only Node.js versions `>= 6.0.0` are being tested in CI now. +No other breaking changes were introduced. diff --git a/node_modules/once/LICENSE b/node_modules/once/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +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/README.md b/node_modules/once/README.md new file mode 100644 index 00000000..1f1ffca9 --- /dev/null +++ b/node_modules/once/README.md @@ -0,0 +1,79 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` + +## `once.strict(func)` + +Throw an error if the function is called twice. + +Some functions are expected to be called only once. Using `once` for them would +potentially hide logical errors. + +In the example below, the `greet` function has to call the callback only once: + +```javascript +function greet (name, cb) { + // return is missing from the if statement + // when no name is passed, the callback is called twice + if (!name) cb('Hello anonymous') + cb('Hello ' + name) +} + +function log (msg) { + console.log(msg) +} + +// this will print 'Hello anonymous' but the logical error will be missed +greet(null, once(msg)) + +// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time +greet(null, once.strict(msg)) +``` diff --git a/node_modules/once/once.js b/node_modules/once/once.js new file mode 100644 index 00000000..23540673 --- /dev/null +++ b/node_modules/once/once.js @@ -0,0 +1,42 @@ +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 new file mode 100644 index 00000000..16815b2f --- /dev/null +++ b/node_modules/once/package.json @@ -0,0 +1,33 @@ +{ + "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/p-limit/index.d.ts b/node_modules/p-limit/index.d.ts new file mode 100644 index 00000000..6bbfad4a --- /dev/null +++ b/node_modules/p-limit/index.d.ts @@ -0,0 +1,38 @@ +export interface Limit { + /** + @param fn - Promise-returning/async function. + @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions. + @returns The promise returned by calling `fn(...arguments)`. + */ + ( + fn: (...arguments: Arguments) => PromiseLike | ReturnType, + ...arguments: Arguments + ): Promise; + + /** + The number of promises that are currently running. + */ + readonly activeCount: number; + + /** + The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). + */ + readonly pendingCount: number; + + /** + Discard pending promises that are waiting to run. + + This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. + + Note: This does not cancel promises that are already running. + */ + clearQueue(): void; +} + +/** +Run multiple promise-returning & async functions with limited concurrency. + +@param concurrency - Concurrency limit. Minimum: `1`. +@returns A `limit` function. +*/ +export default function pLimit(concurrency: number): Limit; diff --git a/node_modules/p-limit/index.js b/node_modules/p-limit/index.js new file mode 100644 index 00000000..6a72a4c4 --- /dev/null +++ b/node_modules/p-limit/index.js @@ -0,0 +1,57 @@ +'use strict'; +const pTry = require('p-try'); + +const pLimit = concurrency => { + if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) { + return Promise.reject(new TypeError('Expected `concurrency` to be a number from 1 and up')); + } + + const queue = []; + let activeCount = 0; + + const next = () => { + activeCount--; + + if (queue.length > 0) { + queue.shift()(); + } + }; + + const run = (fn, resolve, ...args) => { + activeCount++; + + const result = pTry(fn, ...args); + + resolve(result); + + result.then(next, next); + }; + + const enqueue = (fn, resolve, ...args) => { + if (activeCount < concurrency) { + run(fn, resolve, ...args); + } else { + queue.push(run.bind(null, fn, resolve, ...args)); + } + }; + + const generator = (fn, ...args) => new Promise(resolve => enqueue(fn, resolve, ...args)); + Object.defineProperties(generator, { + activeCount: { + get: () => activeCount + }, + pendingCount: { + get: () => queue.length + }, + clearQueue: { + value: () => { + queue.length = 0; + } + } + }); + + return generator; +}; + +module.exports = pLimit; +module.exports.default = pLimit; diff --git a/node_modules/p-limit/license b/node_modules/p-limit/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/p-limit/license @@ -0,0 +1,9 @@ +MIT License + +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/p-limit/package.json b/node_modules/p-limit/package.json new file mode 100644 index 00000000..99a814f6 --- /dev/null +++ b/node_modules/p-limit/package.json @@ -0,0 +1,52 @@ +{ + "name": "p-limit", + "version": "2.3.0", + "description": "Run multiple promise-returning & async functions with limited concurrency", + "license": "MIT", + "repository": "sindresorhus/p-limit", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=6" + }, + "scripts": { + "test": "xo && ava && tsd-check" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "promise", + "limit", + "limited", + "concurrency", + "throttle", + "throat", + "rate", + "batch", + "ratelimit", + "task", + "queue", + "async", + "await", + "promises", + "bluebird" + ], + "dependencies": { + "p-try": "^2.0.0" + }, + "devDependencies": { + "ava": "^1.2.1", + "delay": "^4.1.0", + "in-range": "^1.0.0", + "random-int": "^1.0.0", + "time-span": "^2.0.0", + "tsd-check": "^0.3.0", + "xo": "^0.24.0" + } +} diff --git a/node_modules/p-limit/readme.md b/node_modules/p-limit/readme.md new file mode 100644 index 00000000..64aa476e --- /dev/null +++ b/node_modules/p-limit/readme.md @@ -0,0 +1,101 @@ +# p-limit [![Build Status](https://travis-ci.org/sindresorhus/p-limit.svg?branch=master)](https://travis-ci.org/sindresorhus/p-limit) + +> Run multiple promise-returning & async functions with limited concurrency + +## Install + +``` +$ npm install p-limit +``` + +## Usage + +```js +const pLimit = require('p-limit'); + +const limit = pLimit(1); + +const input = [ + limit(() => fetchSomething('foo')), + limit(() => fetchSomething('bar')), + limit(() => doSomething()) +]; + +(async () => { + // Only one promise is run at once + const result = await Promise.all(input); + console.log(result); +})(); +``` + +## API + +### pLimit(concurrency) + +Returns a `limit` function. + +#### concurrency + +Type: `number`\ +Minimum: `1`\ +Default: `Infinity` + +Concurrency limit. + +### limit(fn, ...args) + +Returns the promise returned by calling `fn(...args)`. + +#### fn + +Type: `Function` + +Promise-returning/async function. + +#### args + +Any arguments to pass through to `fn`. + +Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions. + +### limit.activeCount + +The number of promises that are currently running. + +### limit.pendingCount + +The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). + +### limit.clearQueue() + +Discard pending promises that are waiting to run. + +This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. + +Note: This does not cancel promises that are already running. + +## FAQ + +### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package? + +This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue. + +## Related + +- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control +- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions +- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions +- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency +- [More…](https://github.com/sindresorhus/promise-fun) + +--- + +

    + + Get professional support for this package with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    diff --git a/node_modules/p-locate/index.d.ts b/node_modules/p-locate/index.d.ts new file mode 100644 index 00000000..14115e16 --- /dev/null +++ b/node_modules/p-locate/index.d.ts @@ -0,0 +1,64 @@ +declare namespace pLocate { + interface Options { + /** + Number of concurrently pending promises returned by `tester`. Minimum: `1`. + + @default Infinity + */ + readonly concurrency?: number; + + /** + Preserve `input` order when searching. + + Disable this to improve performance if you don't care about the order. + + @default true + */ + readonly preserveOrder?: boolean; + } +} + +declare const pLocate: { + /** + Get the first fulfilled promise that satisfies the provided testing function. + + @param input - An iterable of promises/values to test. + @param tester - This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. + @returns A `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. + + @example + ``` + import pathExists = require('path-exists'); + import pLocate = require('p-locate'); + + const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' + ]; + + (async () => { + const foundPath = await pLocate(files, file => pathExists(file)); + + console.log(foundPath); + //=> 'rainbow' + })(); + ``` + */ + ( + input: Iterable | ValueType>, + tester: (element: ValueType) => PromiseLike | boolean, + options?: pLocate.Options + ): Promise; + + // TODO: Remove this for the next major release, refactor the whole definition to: + // declare function pLocate( + // input: Iterable | ValueType>, + // tester: (element: ValueType) => PromiseLike | boolean, + // options?: pLocate.Options + // ): Promise; + // export = pLocate; + default: typeof pLocate; +}; + +export = pLocate; diff --git a/node_modules/p-locate/index.js b/node_modules/p-locate/index.js new file mode 100644 index 00000000..e13ce153 --- /dev/null +++ b/node_modules/p-locate/index.js @@ -0,0 +1,52 @@ +'use strict'; +const pLimit = require('p-limit'); + +class EndError extends Error { + constructor(value) { + super(); + this.value = value; + } +} + +// The input can also be a promise, so we await it +const testElement = async (element, tester) => tester(await element); + +// The input can also be a promise, so we `Promise.all()` them both +const finder = async element => { + const values = await Promise.all(element); + if (values[1] === true) { + throw new EndError(values[0]); + } + + return false; +}; + +const pLocate = async (iterable, tester, options) => { + options = { + concurrency: Infinity, + preserveOrder: true, + ...options + }; + + const limit = pLimit(options.concurrency); + + // Start all the promises concurrently with optional limit + const items = [...iterable].map(element => [element, limit(testElement, element, tester)]); + + // Check the promises either serially or concurrently + const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity); + + try { + await Promise.all(items.map(element => checkLimit(finder, element))); + } catch (error) { + if (error instanceof EndError) { + return error.value; + } + + throw error; + } +}; + +module.exports = pLocate; +// TODO: Remove this for the next major release +module.exports.default = pLocate; diff --git a/node_modules/p-locate/license b/node_modules/p-locate/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/p-locate/license @@ -0,0 +1,9 @@ +MIT License + +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/p-locate/package.json b/node_modules/p-locate/package.json new file mode 100644 index 00000000..e3de2756 --- /dev/null +++ b/node_modules/p-locate/package.json @@ -0,0 +1,53 @@ +{ + "name": "p-locate", + "version": "4.1.0", + "description": "Get the first fulfilled promise that satisfies the provided testing function", + "license": "MIT", + "repository": "sindresorhus/p-locate", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "promise", + "locate", + "find", + "finder", + "search", + "searcher", + "test", + "array", + "collection", + "iterable", + "iterator", + "race", + "fulfilled", + "fastest", + "async", + "await", + "promises", + "bluebird" + ], + "dependencies": { + "p-limit": "^2.2.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "delay": "^4.1.0", + "in-range": "^1.0.0", + "time-span": "^3.0.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/p-locate/readme.md b/node_modules/p-locate/readme.md new file mode 100644 index 00000000..f8e2c2ea --- /dev/null +++ b/node_modules/p-locate/readme.md @@ -0,0 +1,90 @@ +# p-locate [![Build Status](https://travis-ci.org/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.org/sindresorhus/p-locate) + +> Get the first fulfilled promise that satisfies the provided testing function + +Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find). + + +## Install + +``` +$ npm install p-locate +``` + + +## Usage + +Here we find the first file that exists on disk, in array order. + +```js +const pathExists = require('path-exists'); +const pLocate = require('p-locate'); + +const files = [ + 'unicorn.png', + 'rainbow.png', // Only this one actually exists on disk + 'pony.png' +]; + +(async () => { + const foundPath = await pLocate(files, file => pathExists(file)); + + console.log(foundPath); + //=> 'rainbow' +})(); +``` + +*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.* + + +## API + +### pLocate(input, tester, [options]) + +Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. + +#### input + +Type: `Iterable` + +An iterable of promises/values to test. + +#### tester(element) + +Type: `Function` + +This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. + +#### options + +Type: `Object` + +##### concurrency + +Type: `number`
    +Default: `Infinity`
    +Minimum: `1` + +Number of concurrently pending promises returned by `tester`. + +##### preserveOrder + +Type: `boolean`
    +Default: `true` + +Preserve `input` order when searching. + +Disable this to improve performance if you don't care about the order. + + +## Related + +- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently +- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently +- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/p-try/index.d.ts b/node_modules/p-try/index.d.ts new file mode 100644 index 00000000..2a7319ec --- /dev/null +++ b/node_modules/p-try/index.d.ts @@ -0,0 +1,39 @@ +declare const pTry: { + /** + Start a promise chain. + + @param fn - The function to run to start the promise chain. + @param arguments - Arguments to pass to `fn`. + @returns The value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error. + + @example + ``` + import pTry = require('p-try'); + + (async () => { + try { + const value = await pTry(() => { + return synchronousFunctionThatMightThrow(); + }); + console.log(value); + } catch (error) { + console.error(error); + } + })(); + ``` + */ + ( + fn: (...arguments: ArgumentsType) => PromiseLike | ValueType, + ...arguments: ArgumentsType + ): Promise; + + // TODO: remove this in the next major version, refactor the whole definition to: + // declare function pTry( + // fn: (...arguments: ArgumentsType) => PromiseLike | ValueType, + // ...arguments: ArgumentsType + // ): Promise; + // export = pTry; + default: typeof pTry; +}; + +export = pTry; diff --git a/node_modules/p-try/index.js b/node_modules/p-try/index.js new file mode 100644 index 00000000..db858da2 --- /dev/null +++ b/node_modules/p-try/index.js @@ -0,0 +1,9 @@ +'use strict'; + +const pTry = (fn, ...arguments_) => new Promise(resolve => { + resolve(fn(...arguments_)); +}); + +module.exports = pTry; +// TODO: remove this in the next major version +module.exports.default = pTry; diff --git a/node_modules/p-try/license b/node_modules/p-try/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/p-try/license @@ -0,0 +1,9 @@ +MIT License + +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/p-try/package.json b/node_modules/p-try/package.json new file mode 100644 index 00000000..81c4d32e --- /dev/null +++ b/node_modules/p-try/package.json @@ -0,0 +1,42 @@ +{ + "name": "p-try", + "version": "2.2.0", + "description": "`Start a promise chain", + "license": "MIT", + "repository": "sindresorhus/p-try", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=6" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "promise", + "try", + "resolve", + "function", + "catch", + "async", + "await", + "promises", + "settled", + "ponyfill", + "polyfill", + "shim", + "bluebird" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" + } +} diff --git a/node_modules/p-try/readme.md b/node_modules/p-try/readme.md new file mode 100644 index 00000000..4d7bd64d --- /dev/null +++ b/node_modules/p-try/readme.md @@ -0,0 +1,58 @@ +# p-try [![Build Status](https://travis-ci.org/sindresorhus/p-try.svg?branch=master)](https://travis-ci.org/sindresorhus/p-try) + +> Start a promise chain + +[How is it useful?](http://cryto.net/~joepie91/blog/2016/05/11/what-is-promise-try-and-why-does-it-matter/) + + +## Install + +``` +$ npm install p-try +``` + + +## Usage + +```js +const pTry = require('p-try'); + +(async () => { + try { + const value = await pTry(() => { + return synchronousFunctionThatMightThrow(); + }); + console.log(value); + } catch (error) { + console.error(error); + } +})(); +``` + + +## API + +### pTry(fn, ...arguments) + +Returns a `Promise` resolved with the value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error. + +Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions. + +#### fn + +The function to run to start the promise chain. + +#### arguments + +Arguments to pass to `fn`. + + +## Related + +- [p-finally](https://github.com/sindresorhus/p-finally) - `Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-exists/index.d.ts b/node_modules/path-exists/index.d.ts new file mode 100644 index 00000000..54b7ab8f --- /dev/null +++ b/node_modules/path-exists/index.d.ts @@ -0,0 +1,28 @@ +declare const pathExists: { + /** + Check if a path exists. + + @returns Whether the path exists. + + @example + ``` + // foo.ts + import pathExists = require('path-exists'); + + (async () => { + console.log(await pathExists('foo.ts')); + //=> true + })(); + ``` + */ + (path: string): Promise; + + /** + Synchronously check if a path exists. + + @returns Whether the path exists. + */ + sync(path: string): boolean; +}; + +export = pathExists; diff --git a/node_modules/path-exists/index.js b/node_modules/path-exists/index.js new file mode 100644 index 00000000..1943921b --- /dev/null +++ b/node_modules/path-exists/index.js @@ -0,0 +1,23 @@ +'use strict'; +const fs = require('fs'); +const {promisify} = require('util'); + +const pAccess = promisify(fs.access); + +module.exports = async path => { + try { + await pAccess(path); + return true; + } catch (_) { + return false; + } +}; + +module.exports.sync = path => { + try { + fs.accessSync(path); + return true; + } catch (_) { + return false; + } +}; diff --git a/node_modules/path-exists/license b/node_modules/path-exists/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/path-exists/license @@ -0,0 +1,9 @@ +MIT License + +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-exists/package.json b/node_modules/path-exists/package.json new file mode 100644 index 00000000..0755256a --- /dev/null +++ b/node_modules/path-exists/package.json @@ -0,0 +1,39 @@ +{ + "name": "path-exists", + "version": "4.0.0", + "description": "Check if a path exists", + "license": "MIT", + "repository": "sindresorhus/path-exists", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "path", + "exists", + "exist", + "file", + "filepath", + "fs", + "filesystem", + "file-system", + "access", + "stat" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/path-exists/readme.md b/node_modules/path-exists/readme.md new file mode 100644 index 00000000..81f98454 --- /dev/null +++ b/node_modules/path-exists/readme.md @@ -0,0 +1,52 @@ +# path-exists [![Build Status](https://travis-ci.org/sindresorhus/path-exists.svg?branch=master)](https://travis-ci.org/sindresorhus/path-exists) + +> Check if a path exists + +NOTE: `fs.existsSync` has been un-deprecated in Node.js since 6.8.0. If you only need to check synchronously, this module is not needed. + +While [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), there's still a genuine use-case of being able to check if a path exists for other purposes than doing IO with it. + +Never use this before handling a file though: + +> In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to `fs.exists()` and `fs.open()`. Just open the file and handle the error when it's not there. + + +## Install + +``` +$ npm install path-exists +``` + + +## Usage + +```js +// foo.js +const pathExists = require('path-exists'); + +(async () => { + console.log(await pathExists('foo.js')); + //=> true +})(); +``` + + +## API + +### pathExists(path) + +Returns a `Promise` of whether the path exists. + +### pathExists.sync(path) + +Returns a `boolean` of whether the path exists. + + +## Related + +- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-is-absolute/index.js b/node_modules/path-is-absolute/index.js new file mode 100644 index 00000000..22aa6c35 --- /dev/null +++ b/node_modules/path-is-absolute/index.js @@ -0,0 +1,20 @@ +'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 new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/path-is-absolute/license @@ -0,0 +1,21 @@ +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 new file mode 100644 index 00000000..91196d5e --- /dev/null +++ b/node_modules/path-is-absolute/package.json @@ -0,0 +1,43 @@ +{ + "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/path-is-absolute/readme.md b/node_modules/path-is-absolute/readme.md new file mode 100644 index 00000000..8dbdf5fc --- /dev/null +++ b/node_modules/path-is-absolute/readme.md @@ -0,0 +1,59 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +const pathIsAbsolute = require('path-is-absolute'); + +// Running on Linux +pathIsAbsolute('/home/foo'); +//=> true +pathIsAbsolute('C:/Users/foo'); +//=> false + +// Running on Windows +pathIsAbsolute('C:/Users/foo'); +//=> true +pathIsAbsolute('/home/foo'); +//=> false + +// Running on any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +pathIsAbsolute.posix('C:/Users/foo'); +//=> false +pathIsAbsolute.win32('C:/Users/foo'); +//=> true +pathIsAbsolute.win32('/home/foo'); +//=> false +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +POSIX specific version. + +### pathIsAbsolute.win32(path) + +Windows specific version. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/path-key/index.d.ts b/node_modules/path-key/index.d.ts new file mode 100644 index 00000000..7c575d19 --- /dev/null +++ b/node_modules/path-key/index.d.ts @@ -0,0 +1,40 @@ +/// + +declare namespace pathKey { + interface Options { + /** + Use a custom environment variables object. Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env). + */ + readonly env?: {[key: string]: string | undefined}; + + /** + Get the PATH key for a specific platform. Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform). + */ + readonly platform?: NodeJS.Platform; + } +} + +declare const pathKey: { + /** + Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform. + + @example + ``` + import pathKey = require('path-key'); + + const key = pathKey(); + //=> 'PATH' + + const PATH = process.env[key]; + //=> '/usr/local/bin:/usr/bin:/bin' + ``` + */ + (options?: pathKey.Options): string; + + // TODO: Remove this for the next major release, refactor the whole definition to: + // declare function pathKey(options?: pathKey.Options): string; + // export = pathKey; + default: typeof pathKey; +}; + +export = pathKey; diff --git a/node_modules/path-key/index.js b/node_modules/path-key/index.js new file mode 100644 index 00000000..0cf6415d --- /dev/null +++ b/node_modules/path-key/index.js @@ -0,0 +1,16 @@ +'use strict'; + +const pathKey = (options = {}) => { + const environment = options.env || process.env; + const platform = options.platform || process.platform; + + if (platform !== 'win32') { + return 'PATH'; + } + + return Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path'; +}; + +module.exports = pathKey; +// TODO: Remove this for the next major release +module.exports.default = pathKey; diff --git a/node_modules/path-key/license b/node_modules/path-key/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/path-key/license @@ -0,0 +1,9 @@ +MIT License + +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-key/package.json b/node_modules/path-key/package.json new file mode 100644 index 00000000..c8cbd383 --- /dev/null +++ b/node_modules/path-key/package.json @@ -0,0 +1,39 @@ +{ + "name": "path-key", + "version": "3.1.1", + "description": "Get the PATH environment variable key cross-platform", + "license": "MIT", + "repository": "sindresorhus/path-key", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "path", + "key", + "environment", + "env", + "variable", + "var", + "get", + "cross-platform", + "windows" + ], + "devDependencies": { + "@types/node": "^11.13.0", + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/path-key/readme.md b/node_modules/path-key/readme.md new file mode 100644 index 00000000..a9052d7a --- /dev/null +++ b/node_modules/path-key/readme.md @@ -0,0 +1,61 @@ +# path-key [![Build Status](https://travis-ci.org/sindresorhus/path-key.svg?branch=master)](https://travis-ci.org/sindresorhus/path-key) + +> Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform + +It's usually `PATH`, but on Windows it can be any casing like `Path`... + + +## Install + +``` +$ npm install path-key +``` + + +## Usage + +```js +const pathKey = require('path-key'); + +const key = pathKey(); +//=> 'PATH' + +const PATH = process.env[key]; +//=> '/usr/local/bin:/usr/bin:/bin' +``` + + +## API + +### pathKey(options?) + +#### options + +Type: `object` + +##### env + +Type: `object`
    +Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env) + +Use a custom environment variables object. + +#### platform + +Type: `string`
    +Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform) + +Get the PATH key for a specific platform. + + +--- + +
    + + Get professional support for this package with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    diff --git a/node_modules/path-parse/LICENSE b/node_modules/path-parse/LICENSE new file mode 100644 index 00000000..810f3dbe --- /dev/null +++ b/node_modules/path-parse/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Javier Blanco + +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-parse/README.md b/node_modules/path-parse/README.md new file mode 100644 index 00000000..05097f86 --- /dev/null +++ b/node_modules/path-parse/README.md @@ -0,0 +1,42 @@ +# path-parse [![Build Status](https://travis-ci.org/jbgutierrez/path-parse.svg?branch=master)](https://travis-ci.org/jbgutierrez/path-parse) + +> Node.js [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) [ponyfill](https://ponyfill.com). + +## Install + +``` +$ npm install --save path-parse +``` + +## Usage + +```js +var pathParse = require('path-parse'); + +pathParse('/home/user/dir/file.txt'); +//=> { +// root : "/", +// dir : "/home/user/dir", +// base : "file.txt", +// ext : ".txt", +// name : "file" +// } +``` + +## API + +See [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) docs. + +### pathParse(path) + +### pathParse.posix(path) + +The Posix specific version. + +### pathParse.win32(path) + +The Windows specific version. + +## License + +MIT © [Javier Blanco](http://jbgutierrez.info) diff --git a/node_modules/path-parse/index.js b/node_modules/path-parse/index.js new file mode 100644 index 00000000..f062d0a2 --- /dev/null +++ b/node_modules/path-parse/index.js @@ -0,0 +1,75 @@ +'use strict'; + +var isWindows = process.platform === 'win32'; + +// Regex to split a windows path into into [dir, root, basename, name, ext] +var splitWindowsRe = + /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/; + +var win32 = {}; + +function win32SplitPath(filename) { + return splitWindowsRe.exec(filename).slice(1); +} + +win32.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = win32SplitPath(pathString); + if (!allParts || allParts.length !== 5) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + return { + root: allParts[1], + dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1), + base: allParts[2], + ext: allParts[4], + name: allParts[3] + }; +}; + + + +// Split a filename into [dir, root, basename, name, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/; +var posix = {}; + + +function posixSplitPath(filename) { + return splitPathRe.exec(filename).slice(1); +} + + +posix.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = posixSplitPath(pathString); + if (!allParts || allParts.length !== 5) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + + return { + root: allParts[1], + dir: allParts[0].slice(0, -1), + base: allParts[2], + ext: allParts[4], + name: allParts[3], + }; +}; + + +if (isWindows) + module.exports = win32.parse; +else /* posix */ + module.exports = posix.parse; + +module.exports.posix = posix.parse; +module.exports.win32 = win32.parse; diff --git a/node_modules/path-parse/package.json b/node_modules/path-parse/package.json new file mode 100644 index 00000000..36c23f84 --- /dev/null +++ b/node_modules/path-parse/package.json @@ -0,0 +1,33 @@ +{ + "name": "path-parse", + "version": "1.0.7", + "description": "Node.js path.parse() ponyfill", + "main": "index.js", + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/jbgutierrez/path-parse.git" + }, + "keywords": [ + "path", + "paths", + "file", + "dir", + "parse", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim" + ], + "author": "Javier Blanco ", + "license": "MIT", + "bugs": { + "url": "https://github.com/jbgutierrez/path-parse/issues" + }, + "homepage": "https://github.com/jbgutierrez/path-parse#readme" +} diff --git a/node_modules/path-scurry/LICENSE.md b/node_modules/path-scurry/LICENSE.md new file mode 100644 index 00000000..c5402b95 --- /dev/null +++ b/node_modules/path-scurry/LICENSE.md @@ -0,0 +1,55 @@ +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/node_modules/path-scurry/README.md b/node_modules/path-scurry/README.md new file mode 100644 index 00000000..b5cb495c --- /dev/null +++ b/node_modules/path-scurry/README.md @@ -0,0 +1,636 @@ +# path-scurry + +Extremely high performant utility for building tools that read +the file system, minimizing filesystem and path string munging +operations to the greatest degree possible. + +## Ugh, yet another file traversal thing on npm? + +Yes. None of the existing ones gave me exactly what I wanted. + +## Well what is it you wanted? + +While working on [glob](http://npm.im/glob), I found that I +needed a module to very efficiently manage the traversal over a +folder tree, such that: + +1. No `readdir()` or `stat()` would ever be called on the same + file or directory more than one time. +2. No `readdir()` calls would be made if we can be reasonably + sure that the path is not a directory. (Ie, a previous + `readdir()` or `stat()` covered the path, and + `ent.isDirectory()` is false.) +3. `path.resolve()`, `dirname()`, `basename()`, and other + string-parsing/munging operations are be minimized. This means + it has to track "provisional" child nodes that may not exist + (and if we find that they _don't_ exist, store that + information as well, so we don't have to ever check again). +4. The API is not limited to use as a stream/iterator/etc. There + are many cases where an API like node's `fs` is preferrable. +5. It's more important to prevent excess syscalls than to be up + to date, but it should be smart enough to know what it + _doesn't_ know, and go get it seamlessly when requested. +6. Do not blow up the JS heap allocation if operating on a + directory with a huge number of entries. +7. Handle all the weird aspects of Windows paths, like UNC paths + and drive letters and wrongway slashes, so that the consumer + can return canonical platform-specific paths without having to + parse or join or do any error-prone string munging. + +## PERFORMANCE + +JavaScript people throw around the word "blazing" a lot. I hope +that this module doesn't blaze anyone. But it does go very fast, +in the cases it's optimized for, if used properly. + +PathScurry provides ample opportunities to get extremely good +performance, as well as several options to trade performance for +convenience. + +Benchmarks can be run by executing `npm run bench`. + +As is always the case, doing more means going slower, doing less +means going faster, and there are trade offs between speed and +memory usage. + +PathScurry makes heavy use of [LRUCache](http://npm.im/lru-cache) +to efficiently cache whatever it can, and `Path` objects remain +in the graph for the lifetime of the walker, so repeated calls +with a single PathScurry object will be extremely fast. However, +adding items to a cold cache means "doing more", so in those +cases, we pay a price. Nothing is free, but every effort has been +made to reduce costs wherever possible. + +Also, note that a "cache as long as possible" approach means that +changes to the filesystem may not be reflected in the results of +repeated PathScurry operations. + +For resolving string paths, `PathScurry` ranges from 5-50 times +faster than `path.resolve` on repeated resolutions, but around +100 to 1000 times _slower_ on the first resolution. If your +program is spending a lot of time resolving the _same_ paths +repeatedly (like, thousands or millions of times), then this can +be beneficial. But both implementations are pretty fast, and +speeding up an infrequent operation from 4µs to 400ns is not +going to move the needle on your app's performance. + +For walking file system directory trees, a lot depends on how +often a given PathScurry object will be used, and also on the +walk method used. + +With default settings on a folder tree of 100,000 items, +consisting of around a 10-to-1 ratio of normal files to +directories, PathScurry performs comparably to +[@nodelib/fs.walk](http://npm.im/@nodelib/fs.walk), which is the +fastest and most reliable file system walker I could find. As far +as I can tell, it's almost impossible to go much faster in a +Node.js program, just based on how fast you can push syscalls out +to the fs thread pool. + +On my machine, that is about 1000-1200 completed walks per second +for async or stream walks, and around 500-600 walks per second +synchronously. + +In the warm cache state, PathScurry's performance increases +around 4x for async `for await` iteration, 10-15x faster for +streams and synchronous `for of` iteration, and anywhere from 30x +to 80x faster for the rest. + +``` +# walk 100,000 fs entries, 10/1 file/dir ratio +# operations / ms + New PathScurry object | Reuse PathScurry object + stream: 1112.589 | 13974.917 +sync stream: 492.718 | 15028.343 + async walk: 1095.648 | 32706.395 + sync walk: 527.632 | 46129.772 + async iter: 1288.821 | 5045.510 + sync iter: 498.496 | 17920.746 +``` + +A hand-rolled walk calling `entry.readdir()` and recursing +through the entries can benefit even more from caching, with +greater flexibility and without the overhead of streams or +generators. + +The cold cache state is still limited by the costs of file system +operations, but with a warm cache, the only bottleneck is CPU +speed and VM optimizations. Of course, in that case, some care +must be taken to ensure that you don't lose performance as a +result of silly mistakes, like calling `readdir()` on entries +that you know are not directories. + +``` +# manual recursive iteration functions + cold cache | warm cache +async: 1164.901 | 17923.320 + cb: 1101.127 | 40999.344 +zalgo: 1082.240 | 66689.936 + sync: 526.935 | 87097.591 +``` + +In this case, the speed improves by around 10-20x in the async +case, 40x in the case of using `entry.readdirCB` with protections +against synchronous callbacks, and 50-100x with callback +deferrals disabled, and _several hundred times faster_ for +synchronous iteration. + +If you can think of a case that is not covered in these +benchmarks, or an implementation that performs significantly +better than PathScurry, please [let me +know](https://github.com/isaacs/path-scurry/issues). + +## USAGE + +```ts +// hybrid module, load with either method +import { PathScurry, Path } from 'path-scurry' +// or: +const { PathScurry, Path } = require('path-scurry') + +// very simple example, say we want to find and +// delete all the .DS_Store files in a given path +// note that the API is very similar to just a +// naive walk with fs.readdir() +import { unlink } from 'fs/promises' + +// easy way, iterate over the directory and do the thing +const pw = new PathScurry(process.cwd()) +for await (const entry of pw) { + if (entry.isFile() && entry.name === '.DS_Store') { + unlink(entry.fullpath()) + } +} + +// here it is as a manual recursive method +const walk = async (entry: Path) => { + const promises: Promise = [] + // readdir doesn't throw on non-directories, it just doesn't + // return any entries, to save stack trace costs. + // Items are returned in arbitrary unsorted order + for (const child of await pw.readdir(entry)) { + // each child is a Path object + if (child.name === '.DS_Store' && child.isFile()) { + // could also do pw.resolve(entry, child.name), + // just like fs.readdir walking, but .fullpath is + // a *slightly* more efficient shorthand. + promises.push(unlink(child.fullpath())) + } else if (child.isDirectory()) { + promises.push(walk(child)) + } + } + return Promise.all(promises) +} + +walk(pw.cwd).then(() => { + console.log('all .DS_Store files removed') +}) + +const pw2 = new PathScurry('/a/b/c') // pw2.cwd is the Path for /a/b/c +const relativeDir = pw2.cwd.resolve('../x') // Path entry for '/a/b/x' +const relative2 = pw2.cwd.resolve('/a/b/d/../x') // same path, same entry +assert.equal(relativeDir, relative2) +``` + +## API + +[Full TypeDoc API](https://isaacs.github.io/path-scurry) + +There are platform-specific classes exported, but for the most +part, the default `PathScurry` and `Path` exports are what you +most likely need, unless you are testing behavior for other +platforms. + +Intended public API is documented here, but the full +documentation does include internal types, which should not be +accessed directly. + +### Interface `PathScurryOpts` + +The type of the `options` argument passed to the `PathScurry` +constructor. + +- `nocase`: Boolean indicating that file names should be compared + case-insensitively. Defaults to `true` on darwin and win32 + implementations, `false` elsewhere. + + **Warning** Performing case-insensitive matching on a + case-sensitive filesystem will result in occasionally very + bizarre behavior. Performing case-sensitive matching on a + case-insensitive filesystem may negatively impact performance. + +- `childrenCacheSize`: Number of child entries to cache, in order + to speed up `resolve()` and `readdir()` calls. Defaults to + `16 * 1024` (ie, `16384`). + + Setting it to a higher value will run the risk of JS heap + allocation errors on large directory trees. Setting it to `256` + or smaller will significantly reduce the construction time and + data consumption overhead, but with the downside of operations + being slower on large directory trees. Setting it to `0` will + mean that effectively no operations are cached, and this module + will be roughly the same speed as `fs` for file system + operations, and _much_ slower than `path.resolve()` for + repeated path resolution. + +- `fs` An object that will be used to override the default `fs` + methods. Any methods that are not overridden will use Node's + built-in implementations. + + - lstatSync + - readdir (callback `withFileTypes` Dirent variant, used for + readdirCB and most walks) + - readdirSync + - readlinkSync + - realpathSync + - promises: Object containing the following async methods: + - lstat + - readdir (Dirent variant only) + - readlink + - realpath + +### Interface `WalkOptions` + +The options object that may be passed to all walk methods. + +- `withFileTypes`: Boolean, default true. Indicates that `Path` + objects should be returned. Set to `false` to get string paths + instead. +- `follow`: Boolean, default false. Attempt to read directory + entries from symbolic links. Otherwise, only actual directories + are traversed. Regardless of this setting, a given target path + will only ever be walked once, meaning that a symbolic link to + a previously traversed directory will never be followed. + + Setting this imposes a slight performance penalty, because + `readlink` must be called on all symbolic links encountered, in + order to avoid infinite cycles. + +- `filter`: Function `(entry: Path) => boolean`. If provided, + will prevent the inclusion of any entry for which it returns a + falsey value. This will not prevent directories from being + traversed if they do not pass the filter, though it will + prevent the directories themselves from being included in the + results. By default, if no filter is provided, then all entries + are included in the results. +- `walkFilter`: Function `(entry: Path) => boolean`. If provided, + will prevent the traversal of any directory (or in the case of + `follow:true` symbolic links to directories) for which the + function returns false. This will not prevent the directories + themselves from being included in the result set. Use `filter` + for that. + +Note that TypeScript return types will only be inferred properly +from static analysis if the `withFileTypes` option is omitted, or +a constant `true` or `false` value. + +### Class `PathScurry` + +The main interface. Defaults to an appropriate class based on the +current platform. + +Use `PathScurryWin32`, `PathScurryDarwin`, or `PathScurryPosix` +if implementation-specific behavior is desired. + +All walk methods may be called with a `WalkOptions` argument to +walk over the object's current working directory with the +supplied options. + +#### `async pw.walk(entry?: string | Path | WalkOptions, opts?: WalkOptions)` + +Walk the directory tree according to the options provided, +resolving to an array of all entries found. + +#### `pw.walkSync(entry?: string | Path | WalkOptions, opts?: WalkOptions)` + +Walk the directory tree according to the options provided, +returning an array of all entries found. + +#### `pw.iterate(entry?: string | Path | WalkOptions, opts?: WalkOptions)` + +Iterate over the directory asynchronously, for use with `for +await of`. This is also the default async iterator method. + +#### `pw.iterateSync(entry?: string | Path | WalkOptions, opts?: WalkOptions)` + +Iterate over the directory synchronously, for use with `for of`. +This is also the default sync iterator method. + +#### `pw.stream(entry?: string | Path | WalkOptions, opts?: WalkOptions)` + +Return a [Minipass](http://npm.im/minipass) stream that emits +each entry or path string in the walk. Results are made available +asynchronously. + +#### `pw.streamSync(entry?: string | Path | WalkOptions, opts?: WalkOptions)` + +Return a [Minipass](http://npm.im/minipass) stream that emits +each entry or path string in the walk. Results are made available +synchronously, meaning that the walk will complete in a single +tick if the stream is fully consumed. + +#### `pw.cwd` + +Path object representing the current working directory for the +PathScurry. + +#### `pw.chdir(path: string)` + +Set the new effective current working directory for the scurry +object, so that `path.relative()` and `path.relativePosix()` +return values relative to the new cwd path. + +#### `pw.depth(path?: Path | string): number` + +Return the depth of the specified path (or the PathScurry cwd) +within the directory tree. + +Root entries have a depth of `0`. + +#### `pw.resolve(...paths: string[])` + +Caching `path.resolve()`. + +Significantly faster than `path.resolve()` if called repeatedly +with the same paths. Significantly slower otherwise, as it builds +out the cached Path entries. + +To get a `Path` object resolved from the `PathScurry`, use +`pw.cwd.resolve(path)`. Note that `Path.resolve` only takes a +single string argument, not multiple. + +#### `pw.resolvePosix(...paths: string[])` + +Caching `path.resolve()`, but always using posix style paths. + +This is identical to `pw.resolve(...paths)` on posix systems (ie, +everywhere except Windows). + +On Windows, it returns the full absolute UNC path using `/` +separators. Ie, instead of `'C:\\foo\\bar`, it would return +`//?/C:/foo/bar`. + +#### `pw.relative(path: string | Path): string` + +Return the relative path from the PathWalker cwd to the supplied +path string or entry. + +If the nearest common ancestor is the root, then an absolute path +is returned. + +#### `pw.relativePosix(path: string | Path): string` + +Return the relative path from the PathWalker cwd to the supplied +path string or entry, using `/` path separators. + +If the nearest common ancestor is the root, then an absolute path +is returned. + +On posix platforms (ie, all platforms except Windows), this is +identical to `pw.relative(path)`. + +On Windows systems, it returns the resulting string as a +`/`-delimited path. If an absolute path is returned (because the +target does not share a common ancestor with `pw.cwd`), then a +full absolute UNC path will be returned. Ie, instead of +`'C:\\foo\\bar`, it would return `//?/C:/foo/bar`. + +#### `pw.basename(path: string | Path): string` + +Return the basename of the provided string or Path. + +#### `pw.dirname(path: string | Path): string` + +Return the parent directory of the supplied string or Path. + +#### `async pw.readdir(dir = pw.cwd, opts = { withFileTypes: true })` + +Read the directory and resolve to an array of strings if +`withFileTypes` is explicitly set to `false` or Path objects +otherwise. + +Can be called as `pw.readdir({ withFileTypes: boolean })` as +well. + +Returns `[]` if no entries are found, or if any error occurs. + +Note that TypeScript return types will only be inferred properly +from static analysis if the `withFileTypes` option is omitted, or +a constant `true` or `false` value. + +#### `pw.readdirSync(dir = pw.cwd, opts = { withFileTypes: true })` + +Synchronous `pw.readdir()` + +#### `async pw.readlink(link = pw.cwd, opts = { withFileTypes: false })` + +Call `fs.readlink` on the supplied string or Path object, and +return the result. + +Can be called as `pw.readlink({ withFileTypes: boolean })` as +well. + +Returns `undefined` if any error occurs (for example, if the +argument is not a symbolic link), or a `Path` object if +`withFileTypes` is explicitly set to `true`, or a string +otherwise. + +Note that TypeScript return types will only be inferred properly +from static analysis if the `withFileTypes` option is omitted, or +a constant `true` or `false` value. + +#### `pw.readlinkSync(link = pw.cwd, opts = { withFileTypes: false })` + +Synchronous `pw.readlink()` + +#### `async pw.lstat(entry = pw.cwd)` + +Call `fs.lstat` on the supplied string or Path object, and fill +in as much information as possible, returning the updated `Path` +object. + +Returns `undefined` if the entry does not exist, or if any error +is encountered. + +Note that some `Stats` data (such as `ino`, `dev`, and `mode`) +will not be supplied. For those things, you'll need to call +`fs.lstat` yourself. + +#### `pw.lstatSync(entry = pw.cwd)` + +Synchronous `pw.lstat()` + +#### `pw.realpath(entry = pw.cwd, opts = { withFileTypes: false })` + +Call `fs.realpath` on the supplied string or Path object, and +return the realpath if available. + +Returns `undefined` if any error occurs. + +May be called as `pw.realpath({ withFileTypes: boolean })` to run +on `pw.cwd`. + +#### `pw.realpathSync(entry = pw.cwd, opts = { withFileTypes: false })` + +Synchronous `pw.realpath()` + +### Class `Path` implements [fs.Dirent](https://nodejs.org/docs/latest/api/fs.html#class-fsdirent) + +Object representing a given path on the filesystem, which may or +may not exist. + +Note that the actual class in use will be either `PathWin32` or +`PathPosix`, depending on the implementation of `PathScurry` in +use. They differ in the separators used to split and join path +strings, and the handling of root paths. + +In `PathPosix` implementations, paths are split and joined using +the `'/'` character, and `'/'` is the only root path ever in use. + +In `PathWin32` implementations, paths are split using either +`'/'` or `'\\'` and joined using `'\\'`, and multiple roots may +be in use based on the drives and UNC paths encountered. UNC +paths such as `//?/C:/` that identify a drive letter, will be +treated as an alias for the same root entry as their associated +drive letter (in this case `'C:\\'`). + +#### `path.name` + +Name of this file system entry. + +**Important**: _always_ test the path name against any test +string using the `isNamed` method, and not by directly comparing +this string. Otherwise, unicode path strings that the system sees +as identical will not be properly treated as the same path, +leading to incorrect behavior and possible security issues. + +#### `path.isNamed(name: string): boolean` + +Return true if the path is a match for the given path name. This +handles case sensitivity and unicode normalization. + +Note: even on case-sensitive systems, it is **not** safe to test +the equality of the `.name` property to determine whether a given +pathname matches, due to unicode normalization mismatches. + +Always use this method instead of testing the `path.name` +property directly. + +#### `path.isCWD` + +Set to true if this `Path` object is the current working +directory of the `PathScurry` collection that contains it. + +#### `path.getType()` + +Returns the type of the Path object, `'File'`, `'Directory'`, +etc. + +#### `path.isType(t: type)` + +Returns true if `is{t}()` returns true. + +For example, `path.isType('Directory')` is equivalent to +`path.isDirectory()`. + +#### `path.depth()` + +Return the depth of the Path entry within the directory tree. +Root paths have a depth of `0`. + +#### `path.fullpath()` + +The fully resolved path to the entry. + +#### `path.fullpathPosix()` + +The fully resolved path to the entry, using `/` separators. + +On posix systems, this is identical to `path.fullpath()`. On +windows, this will return a fully resolved absolute UNC path +using `/` separators. Eg, instead of `'C:\\foo\\bar'`, it will +return `'//?/C:/foo/bar'`. + +#### `path.isFile()`, `path.isDirectory()`, etc. + +Same as the identical `fs.Dirent.isX()` methods. + +#### `path.isUnknown()` + +Returns true if the path's type is unknown. Always returns true +when the path is known to not exist. + +#### `path.resolve(p: string)` + +Return a `Path` object associated with the provided path string +as resolved from the current Path object. + +#### `path.relative(): string` + +Return the relative path from the PathWalker cwd to the supplied +path string or entry. + +If the nearest common ancestor is the root, then an absolute path +is returned. + +#### `path.relativePosix(): string` + +Return the relative path from the PathWalker cwd to the supplied +path string or entry, using `/` path separators. + +If the nearest common ancestor is the root, then an absolute path +is returned. + +On posix platforms (ie, all platforms except Windows), this is +identical to `pw.relative(path)`. + +On Windows systems, it returns the resulting string as a +`/`-delimited path. If an absolute path is returned (because the +target does not share a common ancestor with `pw.cwd`), then a +full absolute UNC path will be returned. Ie, instead of +`'C:\\foo\\bar`, it would return `//?/C:/foo/bar`. + +#### `async path.readdir()` + +Return an array of `Path` objects found by reading the associated +path entry. + +If path is not a directory, or if any error occurs, returns `[]`, +and marks all children as provisional and non-existent. + +#### `path.readdirSync()` + +Synchronous `path.readdir()` + +#### `async path.readlink()` + +Return the `Path` object referenced by the `path` as a symbolic +link. + +If the `path` is not a symbolic link, or any error occurs, +returns `undefined`. + +#### `path.readlinkSync()` + +Synchronous `path.readlink()` + +#### `async path.lstat()` + +Call `lstat` on the path object, and fill it in with details +determined. + +If path does not exist, or any other error occurs, returns +`undefined`, and marks the path as "unknown" type. + +#### `path.lstatSync()` + +Synchronous `path.lstat()` + +#### `async path.realpath()` + +Call `realpath` on the path, and return a Path object +corresponding to the result, or `undefined` if any error occurs. + +#### `path.realpathSync()` + +Synchornous `path.realpath()` diff --git a/node_modules/path-scurry/dist/commonjs/index.d.ts b/node_modules/path-scurry/dist/commonjs/index.d.ts new file mode 100644 index 00000000..3ad4aa5b --- /dev/null +++ b/node_modules/path-scurry/dist/commonjs/index.d.ts @@ -0,0 +1,1116 @@ +/// +/// +/// +import { LRUCache } from 'lru-cache'; +import { posix, win32 } from 'node:path'; +import { Minipass } from 'minipass'; +import type { Dirent, Stats } from 'node:fs'; +/** + * An object that will be used to override the default `fs` + * methods. Any methods that are not overridden will use Node's + * built-in implementations. + * + * - lstatSync + * - readdir (callback `withFileTypes` Dirent variant, used for + * readdirCB and most walks) + * - readdirSync + * - readlinkSync + * - realpathSync + * - promises: Object containing the following async methods: + * - lstat + * - readdir (Dirent variant only) + * - readlink + * - realpath + */ +export interface FSOption { + lstatSync?: (path: string) => Stats; + readdir?: (path: string, options: { + withFileTypes: true; + }, cb: (er: NodeJS.ErrnoException | null, entries?: Dirent[]) => any) => void; + readdirSync?: (path: string, options: { + withFileTypes: true; + }) => Dirent[]; + readlinkSync?: (path: string) => string; + realpathSync?: (path: string) => string; + promises?: { + lstat?: (path: string) => Promise; + readdir?: (path: string, options: { + withFileTypes: true; + }) => Promise; + readlink?: (path: string) => Promise; + realpath?: (path: string) => Promise; + [k: string]: any; + }; + [k: string]: any; +} +interface FSValue { + lstatSync: (path: string) => Stats; + readdir: (path: string, options: { + withFileTypes: true; + }, cb: (er: NodeJS.ErrnoException | null, entries?: Dirent[]) => any) => void; + readdirSync: (path: string, options: { + withFileTypes: true; + }) => Dirent[]; + readlinkSync: (path: string) => string; + realpathSync: (path: string) => string; + promises: { + lstat: (path: string) => Promise; + readdir: (path: string, options: { + withFileTypes: true; + }) => Promise; + readlink: (path: string) => Promise; + realpath: (path: string) => Promise; + [k: string]: any; + }; + [k: string]: any; +} +export type Type = 'Unknown' | 'FIFO' | 'CharacterDevice' | 'Directory' | 'BlockDevice' | 'File' | 'SymbolicLink' | 'Socket'; +/** + * Options that may be provided to the Path constructor + */ +export interface PathOpts { + fullpath?: string; + relative?: string; + relativePosix?: string; + parent?: PathBase; + /** + * See {@link FSOption} + */ + fs?: FSOption; +} +/** + * An LRUCache for storing resolved path strings or Path objects. + * @internal + */ +export declare class ResolveCache extends LRUCache { + constructor(); +} +/** + * an LRUCache for storing child entries. + * @internal + */ +export declare class ChildrenCache extends LRUCache { + constructor(maxSize?: number); +} +/** + * Array of Path objects, plus a marker indicating the first provisional entry + * + * @internal + */ +export type Children = PathBase[] & { + provisional: number; +}; +declare const setAsCwd: unique symbol; +/** + * Path objects are sort of like a super-powered + * {@link https://nodejs.org/docs/latest/api/fs.html#class-fsdirent fs.Dirent} + * + * Each one represents a single filesystem entry on disk, which may or may not + * exist. It includes methods for reading various types of information via + * lstat, readlink, and readdir, and caches all information to the greatest + * degree possible. + * + * Note that fs operations that would normally throw will instead return an + * "empty" value. This is in order to prevent excessive overhead from error + * stack traces. + */ +export declare abstract class PathBase implements Dirent { + #private; + /** + * the basename of this path + * + * **Important**: *always* test the path name against any test string + * usingthe {@link isNamed} method, and not by directly comparing this + * string. Otherwise, unicode path strings that the system sees as identical + * will not be properly treated as the same path, leading to incorrect + * behavior and possible security issues. + */ + name: string; + /** + * the Path entry corresponding to the path root. + * + * @internal + */ + root: PathBase; + /** + * All roots found within the current PathScurry family + * + * @internal + */ + roots: { + [k: string]: PathBase; + }; + /** + * a reference to the parent path, or undefined in the case of root entries + * + * @internal + */ + parent?: PathBase; + /** + * boolean indicating whether paths are compared case-insensitively + * @internal + */ + nocase: boolean; + /** + * boolean indicating that this path is the current working directory + * of the PathScurry collection that contains it. + */ + isCWD: boolean; + /** + * the string or regexp used to split paths. On posix, it is `'/'`, and on + * windows it is a RegExp matching either `'/'` or `'\\'` + */ + abstract splitSep: string | RegExp; + /** + * The path separator string to use when joining paths + */ + abstract sep: string; + get dev(): number | undefined; + get mode(): number | undefined; + get nlink(): number | undefined; + get uid(): number | undefined; + get gid(): number | undefined; + get rdev(): number | undefined; + get blksize(): number | undefined; + get ino(): number | undefined; + get size(): number | undefined; + get blocks(): number | undefined; + get atimeMs(): number | undefined; + get mtimeMs(): number | undefined; + get ctimeMs(): number | undefined; + get birthtimeMs(): number | undefined; + get atime(): Date | undefined; + get mtime(): Date | undefined; + get ctime(): Date | undefined; + get birthtime(): Date | undefined; + /** + * This property is for compatibility with the Dirent class as of + * Node v20, where Dirent['parentPath'] refers to the path of the + * directory that was passed to readdir. For root entries, it's the path + * to the entry itself. + */ + get parentPath(): string; + /** + * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively, + * this property refers to the *parent* path, not the path object itself. + */ + get path(): string; + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name: string, type: number | undefined, root: PathBase | undefined, roots: { + [k: string]: PathBase; + }, nocase: boolean, children: ChildrenCache, opts: PathOpts); + /** + * Returns the depth of the Path object from its root. + * + * For example, a path at `/foo/bar` would have a depth of 2. + */ + depth(): number; + /** + * @internal + */ + abstract getRootString(path: string): string; + /** + * @internal + */ + abstract getRoot(rootPath: string): PathBase; + /** + * @internal + */ + abstract newChild(name: string, type?: number, opts?: PathOpts): PathBase; + /** + * @internal + */ + childrenCache(): ChildrenCache; + /** + * Get the Path object referenced by the string path, resolved from this Path + */ + resolve(path?: string): PathBase; + /** + * Returns the cached children Path objects, if still available. If they + * have fallen out of the cache, then returns an empty array, and resets the + * READDIR_CALLED bit, so that future calls to readdir() will require an fs + * lookup. + * + * @internal + */ + children(): Children; + /** + * Resolves a path portion and returns or creates the child Path. + * + * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is + * `'..'`. + * + * This should not be called directly. If `pathPart` contains any path + * separators, it will lead to unsafe undefined behavior. + * + * Use `Path.resolve()` instead. + * + * @internal + */ + child(pathPart: string, opts?: PathOpts): PathBase; + /** + * The relative path from the cwd. If it does not share an ancestor with + * the cwd, then this ends up being equivalent to the fullpath() + */ + relative(): string; + /** + * The relative path from the cwd, using / as the path separator. + * If it does not share an ancestor with + * the cwd, then this ends up being equivalent to the fullpathPosix() + * On posix systems, this is identical to relative(). + */ + relativePosix(): string; + /** + * The fully resolved path string for this Path entry + */ + fullpath(): string; + /** + * On platforms other than windows, this is identical to fullpath. + * + * On windows, this is overridden to return the forward-slash form of the + * full UNC path. + */ + fullpathPosix(): string; + /** + * Is the Path of an unknown type? + * + * Note that we might know *something* about it if there has been a previous + * filesystem operation, for example that it does not exist, or is not a + * link, or whether it has child entries. + */ + isUnknown(): boolean; + isType(type: Type): boolean; + getType(): Type; + /** + * Is the Path a regular file? + */ + isFile(): boolean; + /** + * Is the Path a directory? + */ + isDirectory(): boolean; + /** + * Is the path a character device? + */ + isCharacterDevice(): boolean; + /** + * Is the path a block device? + */ + isBlockDevice(): boolean; + /** + * Is the path a FIFO pipe? + */ + isFIFO(): boolean; + /** + * Is the path a socket? + */ + isSocket(): boolean; + /** + * Is the path a symbolic link? + */ + isSymbolicLink(): boolean; + /** + * Return the entry if it has been subject of a successful lstat, or + * undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* simply + * mean that we haven't called lstat on it. + */ + lstatCached(): PathBase | undefined; + /** + * Return the cached link target if the entry has been the subject of a + * successful readlink, or undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * readlink() has been called at some point. + */ + readlinkCached(): PathBase | undefined; + /** + * Returns the cached realpath target if the entry has been the subject + * of a successful realpath, or undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * realpath() has been called at some point. + */ + realpathCached(): PathBase | undefined; + /** + * Returns the cached child Path entries array if the entry has been the + * subject of a successful readdir(), or [] otherwise. + * + * Does not read the filesystem, so an empty array *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * readdir() has been called recently enough to still be valid. + */ + readdirCached(): PathBase[]; + /** + * Return true if it's worth trying to readlink. Ie, we don't (yet) have + * any indication that readlink will definitely fail. + * + * Returns false if the path is known to not be a symlink, if a previous + * readlink failed, or if the entry does not exist. + */ + canReadlink(): boolean; + /** + * Return true if readdir has previously been successfully called on this + * path, indicating that cachedReaddir() is likely valid. + */ + calledReaddir(): boolean; + /** + * Returns true if the path is known to not exist. That is, a previous lstat + * or readdir failed to verify its existence when that would have been + * expected, or a parent entry was marked either enoent or enotdir. + */ + isENOENT(): boolean; + /** + * Return true if the path is a match for the given path name. This handles + * case sensitivity and unicode normalization. + * + * Note: even on case-sensitive systems, it is **not** safe to test the + * equality of the `.name` property to determine whether a given pathname + * matches, due to unicode normalization mismatches. + * + * Always use this method instead of testing the `path.name` property + * directly. + */ + isNamed(n: string): boolean; + /** + * Return the Path object corresponding to the target of a symbolic link. + * + * If the Path is not a symbolic link, or if the readlink call fails for any + * reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + */ + readlink(): Promise; + /** + * Synchronous {@link PathBase.readlink} + */ + readlinkSync(): PathBase | undefined; + /** + * Call lstat() on this Path, and update all known information that can be + * determined. + * + * Note that unlike `fs.lstat()`, the returned value does not contain some + * information, such as `mode`, `dev`, `nlink`, and `ino`. If that + * information is required, you will need to call `fs.lstat` yourself. + * + * If the Path refers to a nonexistent file, or if the lstat call fails for + * any reason, `undefined` is returned. Otherwise the updated Path object is + * returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + lstat(): Promise; + /** + * synchronous {@link PathBase.lstat} + */ + lstatSync(): PathBase | undefined; + /** + * Standard node-style callback interface to get list of directory entries. + * + * If the Path cannot or does not contain any children, then an empty array + * is returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + * + * @param cb The callback called with (er, entries). Note that the `er` + * param is somewhat extraneous, as all readdir() errors are handled and + * simply result in an empty set of entries being returned. + * @param allowZalgo Boolean indicating that immediately known results should + * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release + * zalgo at your peril, the dark pony lord is devious and unforgiving. + */ + readdirCB(cb: (er: NodeJS.ErrnoException | null, entries: PathBase[]) => any, allowZalgo?: boolean): void; + /** + * Return an array of known child entries. + * + * If the Path cannot or does not contain any children, then an empty array + * is returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + readdir(): Promise; + /** + * synchronous {@link PathBase.readdir} + */ + readdirSync(): PathBase[]; + canReaddir(): boolean; + shouldWalk(dirs: Set, walkFilter?: (e: PathBase) => boolean): boolean; + /** + * Return the Path object corresponding to path as resolved + * by realpath(3). + * + * If the realpath call fails for any reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + * On success, returns a Path object. + */ + realpath(): Promise; + /** + * Synchronous {@link realpath} + */ + realpathSync(): PathBase | undefined; + /** + * Internal method to mark this Path object as the scurry cwd, + * called by {@link PathScurry#chdir} + * + * @internal + */ + [setAsCwd](oldCwd: PathBase): void; +} +/** + * Path class used on win32 systems + * + * Uses `'\\'` as the path separator for returned paths, either `'\\'` or `'/'` + * as the path separator for parsing paths. + */ +export declare class PathWin32 extends PathBase { + /** + * Separator for generating path strings. + */ + sep: '\\'; + /** + * Separator for parsing path strings. + */ + splitSep: RegExp; + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name: string, type: number | undefined, root: PathBase | undefined, roots: { + [k: string]: PathBase; + }, nocase: boolean, children: ChildrenCache, opts: PathOpts); + /** + * @internal + */ + newChild(name: string, type?: number, opts?: PathOpts): PathWin32; + /** + * @internal + */ + getRootString(path: string): string; + /** + * @internal + */ + getRoot(rootPath: string): PathBase; + /** + * @internal + */ + sameRoot(rootPath: string, compare?: string): boolean; +} +/** + * Path class used on all posix systems. + * + * Uses `'/'` as the path separator. + */ +export declare class PathPosix extends PathBase { + /** + * separator for parsing path strings + */ + splitSep: '/'; + /** + * separator for generating path strings + */ + sep: '/'; + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name: string, type: number | undefined, root: PathBase | undefined, roots: { + [k: string]: PathBase; + }, nocase: boolean, children: ChildrenCache, opts: PathOpts); + /** + * @internal + */ + getRootString(path: string): string; + /** + * @internal + */ + getRoot(_rootPath: string): PathBase; + /** + * @internal + */ + newChild(name: string, type?: number, opts?: PathOpts): PathPosix; +} +/** + * Options that may be provided to the PathScurry constructor + */ +export interface PathScurryOpts { + /** + * perform case-insensitive path matching. Default based on platform + * subclass. + */ + nocase?: boolean; + /** + * Number of Path entries to keep in the cache of Path child references. + * + * Setting this higher than 65536 will dramatically increase the data + * consumption and construction time overhead of each PathScurry. + * + * Setting this value to 256 or lower will significantly reduce the data + * consumption and construction time overhead, but may also reduce resolve() + * and readdir() performance on large filesystems. + * + * Default `16384`. + */ + childrenCacheSize?: number; + /** + * An object that overrides the built-in functions from the fs and + * fs/promises modules. + * + * See {@link FSOption} + */ + fs?: FSOption; +} +/** + * The base class for all PathScurry classes, providing the interface for path + * resolution and filesystem operations. + * + * Typically, you should *not* instantiate this class directly, but rather one + * of the platform-specific classes, or the exported {@link PathScurry} which + * defaults to the current platform. + */ +export declare abstract class PathScurryBase { + #private; + /** + * The root Path entry for the current working directory of this Scurry + */ + root: PathBase; + /** + * The string path for the root of this Scurry's current working directory + */ + rootPath: string; + /** + * A collection of all roots encountered, referenced by rootPath + */ + roots: { + [k: string]: PathBase; + }; + /** + * The Path entry corresponding to this PathScurry's current working directory. + */ + cwd: PathBase; + /** + * Perform path comparisons case-insensitively. + * + * Defaults true on Darwin and Windows systems, false elsewhere. + */ + nocase: boolean; + /** + * The path separator used for parsing paths + * + * `'/'` on Posix systems, either `'/'` or `'\\'` on Windows + */ + abstract sep: string | RegExp; + /** + * This class should not be instantiated directly. + * + * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry + * + * @internal + */ + constructor(cwd: string | URL | undefined, pathImpl: typeof win32 | typeof posix, sep: string | RegExp, { nocase, childrenCacheSize, fs, }?: PathScurryOpts); + /** + * Get the depth of a provided path, string, or the cwd + */ + depth(path?: Path | string): number; + /** + * Parse the root portion of a path string + * + * @internal + */ + abstract parseRootPath(dir: string): string; + /** + * create a new Path to use as root during construction. + * + * @internal + */ + abstract newRoot(fs: FSValue): PathBase; + /** + * Determine whether a given path string is absolute + */ + abstract isAbsolute(p: string): boolean; + /** + * Return the cache of child entries. Exposed so subclasses can create + * child Path objects in a platform-specific way. + * + * @internal + */ + childrenCache(): ChildrenCache; + /** + * Resolve one or more path strings to a resolved string + * + * Same interface as require('path').resolve. + * + * Much faster than path.resolve() when called multiple times for the same + * path, because the resolved Path objects are cached. Much slower + * otherwise. + */ + resolve(...paths: string[]): string; + /** + * Resolve one or more path strings to a resolved string, returning + * the posix path. Identical to .resolve() on posix systems, but on + * windows will return a forward-slash separated UNC path. + * + * Same interface as require('path').resolve. + * + * Much faster than path.resolve() when called multiple times for the same + * path, because the resolved Path objects are cached. Much slower + * otherwise. + */ + resolvePosix(...paths: string[]): string; + /** + * find the relative path from the cwd to the supplied path string or entry + */ + relative(entry?: PathBase | string): string; + /** + * find the relative path from the cwd to the supplied path string or + * entry, using / as the path delimiter, even on Windows. + */ + relativePosix(entry?: PathBase | string): string; + /** + * Return the basename for the provided string or Path object + */ + basename(entry?: PathBase | string): string; + /** + * Return the dirname for the provided string or Path object + */ + dirname(entry?: PathBase | string): string; + /** + * Return an array of known child entries. + * + * First argument may be either a string, or a Path object. + * + * If the Path cannot or does not contain any children, then an empty array + * is returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + * + * Unlike `fs.readdir()`, the `withFileTypes` option defaults to `true`. Set + * `{ withFileTypes: false }` to return strings. + */ + readdir(): Promise; + readdir(opts: { + withFileTypes: true; + }): Promise; + readdir(opts: { + withFileTypes: false; + }): Promise; + readdir(opts: { + withFileTypes: boolean; + }): Promise; + readdir(entry: PathBase | string): Promise; + readdir(entry: PathBase | string, opts: { + withFileTypes: true; + }): Promise; + readdir(entry: PathBase | string, opts: { + withFileTypes: false; + }): Promise; + readdir(entry: PathBase | string, opts: { + withFileTypes: boolean; + }): Promise; + /** + * synchronous {@link PathScurryBase.readdir} + */ + readdirSync(): PathBase[]; + readdirSync(opts: { + withFileTypes: true; + }): PathBase[]; + readdirSync(opts: { + withFileTypes: false; + }): string[]; + readdirSync(opts: { + withFileTypes: boolean; + }): PathBase[] | string[]; + readdirSync(entry: PathBase | string): PathBase[]; + readdirSync(entry: PathBase | string, opts: { + withFileTypes: true; + }): PathBase[]; + readdirSync(entry: PathBase | string, opts: { + withFileTypes: false; + }): string[]; + readdirSync(entry: PathBase | string, opts: { + withFileTypes: boolean; + }): PathBase[] | string[]; + /** + * Call lstat() on the string or Path object, and update all known + * information that can be determined. + * + * Note that unlike `fs.lstat()`, the returned value does not contain some + * information, such as `mode`, `dev`, `nlink`, and `ino`. If that + * information is required, you will need to call `fs.lstat` yourself. + * + * If the Path refers to a nonexistent file, or if the lstat call fails for + * any reason, `undefined` is returned. Otherwise the updated Path object is + * returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + lstat(entry?: string | PathBase): Promise; + /** + * synchronous {@link PathScurryBase.lstat} + */ + lstatSync(entry?: string | PathBase): PathBase | undefined; + /** + * Return the Path object or string path corresponding to the target of a + * symbolic link. + * + * If the path is not a symbolic link, or if the readlink call fails for any + * reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + * + * `{withFileTypes}` option defaults to `false`. + * + * On success, returns a Path object if `withFileTypes` option is true, + * otherwise a string. + */ + readlink(): Promise; + readlink(opt: { + withFileTypes: false; + }): Promise; + readlink(opt: { + withFileTypes: true; + }): Promise; + readlink(opt: { + withFileTypes: boolean; + }): Promise; + readlink(entry: string | PathBase, opt?: { + withFileTypes: false; + }): Promise; + readlink(entry: string | PathBase, opt: { + withFileTypes: true; + }): Promise; + readlink(entry: string | PathBase, opt: { + withFileTypes: boolean; + }): Promise; + /** + * synchronous {@link PathScurryBase.readlink} + */ + readlinkSync(): string | undefined; + readlinkSync(opt: { + withFileTypes: false; + }): string | undefined; + readlinkSync(opt: { + withFileTypes: true; + }): PathBase | undefined; + readlinkSync(opt: { + withFileTypes: boolean; + }): PathBase | string | undefined; + readlinkSync(entry: string | PathBase, opt?: { + withFileTypes: false; + }): string | undefined; + readlinkSync(entry: string | PathBase, opt: { + withFileTypes: true; + }): PathBase | undefined; + readlinkSync(entry: string | PathBase, opt: { + withFileTypes: boolean; + }): string | PathBase | undefined; + /** + * Return the Path object or string path corresponding to path as resolved + * by realpath(3). + * + * If the realpath call fails for any reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + * + * `{withFileTypes}` option defaults to `false`. + * + * On success, returns a Path object if `withFileTypes` option is true, + * otherwise a string. + */ + realpath(): Promise; + realpath(opt: { + withFileTypes: false; + }): Promise; + realpath(opt: { + withFileTypes: true; + }): Promise; + realpath(opt: { + withFileTypes: boolean; + }): Promise; + realpath(entry: string | PathBase, opt?: { + withFileTypes: false; + }): Promise; + realpath(entry: string | PathBase, opt: { + withFileTypes: true; + }): Promise; + realpath(entry: string | PathBase, opt: { + withFileTypes: boolean; + }): Promise; + realpathSync(): string | undefined; + realpathSync(opt: { + withFileTypes: false; + }): string | undefined; + realpathSync(opt: { + withFileTypes: true; + }): PathBase | undefined; + realpathSync(opt: { + withFileTypes: boolean; + }): PathBase | string | undefined; + realpathSync(entry: string | PathBase, opt?: { + withFileTypes: false; + }): string | undefined; + realpathSync(entry: string | PathBase, opt: { + withFileTypes: true; + }): PathBase | undefined; + realpathSync(entry: string | PathBase, opt: { + withFileTypes: boolean; + }): string | PathBase | undefined; + /** + * Asynchronously walk the directory tree, returning an array of + * all path strings or Path objects found. + * + * Note that this will be extremely memory-hungry on large filesystems. + * In such cases, it may be better to use the stream or async iterator + * walk implementation. + */ + walk(): Promise; + walk(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Promise; + walk(opts: WalkOptionsWithFileTypesFalse): Promise; + walk(opts: WalkOptions): Promise; + walk(entry: string | PathBase): Promise; + walk(entry: string | PathBase, opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Promise; + walk(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): Promise; + walk(entry: string | PathBase, opts: WalkOptions): Promise; + /** + * Synchronously walk the directory tree, returning an array of + * all path strings or Path objects found. + * + * Note that this will be extremely memory-hungry on large filesystems. + * In such cases, it may be better to use the stream or async iterator + * walk implementation. + */ + walkSync(): PathBase[]; + walkSync(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): PathBase[]; + walkSync(opts: WalkOptionsWithFileTypesFalse): string[]; + walkSync(opts: WalkOptions): string[] | PathBase[]; + walkSync(entry: string | PathBase): PathBase[]; + walkSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue): PathBase[]; + walkSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): string[]; + walkSync(entry: string | PathBase, opts: WalkOptions): PathBase[] | string[]; + /** + * Support for `for await` + * + * Alias for {@link PathScurryBase.iterate} + * + * Note: As of Node 19, this is very slow, compared to other methods of + * walking. Consider using {@link PathScurryBase.stream} if memory overhead + * and backpressure are concerns, or {@link PathScurryBase.walk} if not. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Async generator form of {@link PathScurryBase.walk} + * + * Note: As of Node 19, this is very slow, compared to other methods of + * walking, especially if most/all of the directory tree has been previously + * walked. Consider using {@link PathScurryBase.stream} if memory overhead + * and backpressure are concerns, or {@link PathScurryBase.walk} if not. + */ + iterate(): AsyncGenerator; + iterate(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): AsyncGenerator; + iterate(opts: WalkOptionsWithFileTypesFalse): AsyncGenerator; + iterate(opts: WalkOptions): AsyncGenerator; + iterate(entry: string | PathBase): AsyncGenerator; + iterate(entry: string | PathBase, opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): AsyncGenerator; + iterate(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): AsyncGenerator; + iterate(entry: string | PathBase, opts: WalkOptions): AsyncGenerator; + /** + * Iterating over a PathScurry performs a synchronous walk. + * + * Alias for {@link PathScurryBase.iterateSync} + */ + [Symbol.iterator](): Generator; + iterateSync(): Generator; + iterateSync(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Generator; + iterateSync(opts: WalkOptionsWithFileTypesFalse): Generator; + iterateSync(opts: WalkOptions): Generator; + iterateSync(entry: string | PathBase): Generator; + iterateSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Generator; + iterateSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): Generator; + iterateSync(entry: string | PathBase, opts: WalkOptions): Generator; + /** + * Stream form of {@link PathScurryBase.walk} + * + * Returns a Minipass stream that emits {@link PathBase} objects by default, + * or strings if `{ withFileTypes: false }` is set in the options. + */ + stream(): Minipass; + stream(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Minipass; + stream(opts: WalkOptionsWithFileTypesFalse): Minipass; + stream(opts: WalkOptions): Minipass; + stream(entry: string | PathBase): Minipass; + stream(entry: string | PathBase, opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue): Minipass; + stream(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): Minipass; + stream(entry: string | PathBase, opts: WalkOptions): Minipass | Minipass; + /** + * Synchronous form of {@link PathScurryBase.stream} + * + * Returns a Minipass stream that emits {@link PathBase} objects by default, + * or strings if `{ withFileTypes: false }` is set in the options. + * + * Will complete the walk in a single tick if the stream is consumed fully. + * Otherwise, will pause as needed for stream backpressure. + */ + streamSync(): Minipass; + streamSync(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Minipass; + streamSync(opts: WalkOptionsWithFileTypesFalse): Minipass; + streamSync(opts: WalkOptions): Minipass; + streamSync(entry: string | PathBase): Minipass; + streamSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue): Minipass; + streamSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): Minipass; + streamSync(entry: string | PathBase, opts: WalkOptions): Minipass | Minipass; + chdir(path?: string | Path): void; +} +/** + * Options provided to all walk methods. + */ +export interface WalkOptions { + /** + * Return results as {@link PathBase} objects rather than strings. + * When set to false, results are fully resolved paths, as returned by + * {@link PathBase.fullpath}. + * @default true + */ + withFileTypes?: boolean; + /** + * Attempt to read directory entries from symbolic links. Otherwise, only + * actual directories are traversed. Regardless of this setting, a given + * target path will only ever be walked once, meaning that a symbolic link + * to a previously traversed directory will never be followed. + * + * Setting this imposes a slight performance penalty, because `readlink` + * must be called on all symbolic links encountered, in order to avoid + * infinite cycles. + * @default false + */ + follow?: boolean; + /** + * Only return entries where the provided function returns true. + * + * This will not prevent directories from being traversed, even if they do + * not pass the filter, though it will prevent directories themselves from + * being included in the result set. See {@link walkFilter} + * + * Asynchronous functions are not supported here. + * + * By default, if no filter is provided, all entries and traversed + * directories are included. + */ + filter?: (entry: PathBase) => boolean; + /** + * Only traverse directories (and in the case of {@link follow} being set to + * true, symbolic links to directories) if the provided function returns + * true. + * + * This will not prevent directories from being included in the result set, + * even if they do not pass the supplied filter function. See {@link filter} + * to do that. + * + * Asynchronous functions are not supported here. + */ + walkFilter?: (entry: PathBase) => boolean; +} +export type WalkOptionsWithFileTypesUnset = WalkOptions & { + withFileTypes?: undefined; +}; +export type WalkOptionsWithFileTypesTrue = WalkOptions & { + withFileTypes: true; +}; +export type WalkOptionsWithFileTypesFalse = WalkOptions & { + withFileTypes: false; +}; +/** + * Windows implementation of {@link PathScurryBase} + * + * Defaults to case insensitve, uses `'\\'` to generate path strings. Uses + * {@link PathWin32} for Path objects. + */ +export declare class PathScurryWin32 extends PathScurryBase { + /** + * separator for generating path strings + */ + sep: '\\'; + constructor(cwd?: URL | string, opts?: PathScurryOpts); + /** + * @internal + */ + parseRootPath(dir: string): string; + /** + * @internal + */ + newRoot(fs: FSValue): PathWin32; + /** + * Return true if the provided path string is an absolute path + */ + isAbsolute(p: string): boolean; +} +/** + * {@link PathScurryBase} implementation for all posix systems other than Darwin. + * + * Defaults to case-sensitive matching, uses `'/'` to generate path strings. + * + * Uses {@link PathPosix} for Path objects. + */ +export declare class PathScurryPosix extends PathScurryBase { + /** + * separator for generating path strings + */ + sep: '/'; + constructor(cwd?: URL | string, opts?: PathScurryOpts); + /** + * @internal + */ + parseRootPath(_dir: string): string; + /** + * @internal + */ + newRoot(fs: FSValue): PathPosix; + /** + * Return true if the provided path string is an absolute path + */ + isAbsolute(p: string): boolean; +} +/** + * {@link PathScurryBase} implementation for Darwin (macOS) systems. + * + * Defaults to case-insensitive matching, uses `'/'` for generating path + * strings. + * + * Uses {@link PathPosix} for Path objects. + */ +export declare class PathScurryDarwin extends PathScurryPosix { + constructor(cwd?: URL | string, opts?: PathScurryOpts); +} +/** + * Default {@link PathBase} implementation for the current platform. + * + * {@link PathWin32} on Windows systems, {@link PathPosix} on all others. + */ +export declare const Path: typeof PathWin32 | typeof PathPosix; +export type Path = PathBase | InstanceType; +/** + * Default {@link PathScurryBase} implementation for the current platform. + * + * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on + * Darwin (macOS) systems, {@link PathScurryPosix} on all others. + */ +export declare const PathScurry: typeof PathScurryWin32 | typeof PathScurryDarwin | typeof PathScurryPosix; +export type PathScurry = PathScurryBase | InstanceType; +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/path-scurry/dist/commonjs/index.d.ts.map b/node_modules/path-scurry/dist/commonjs/index.d.ts.map new file mode 100644 index 00000000..1f59f8f4 --- /dev/null +++ b/node_modules/path-scurry/dist/commonjs/index.d.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AsB,EACjC,IAAI,GAAE,cAAmB;IAO3B;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAInC;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,OAAO;IAYnB;;OAEG;IACH,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;CAG/B;AAED;;;;;;;GAOG;AACH,qBAAa,gBAAiB,SAAQ,eAAe;gBAEjD,GAAG,GAAE,GAAG,GAAG,MAAsB,EACjC,IAAI,GAAE,cAAmB;CAK5B;AAED;;;;GAIG;AACH,eAAO,MAAM,IAAI,qCAAuD,CAAA;AACxE,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,YAAY,CAAC,OAAO,IAAI,CAAC,CAAA;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EACnB,OAAO,eAAe,GACtB,OAAO,gBAAgB,GACvB,OAAO,eAGQ,CAAA;AACnB,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,YAAY,CAAC,OAAO,UAAU,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/path-scurry/dist/commonjs/index.js b/node_modules/path-scurry/dist/commonjs/index.js new file mode 100644 index 00000000..555de62f --- /dev/null +++ b/node_modules/path-scurry/dist/commonjs/index.js @@ -0,0 +1,2014 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PathScurry = exports.Path = exports.PathScurryDarwin = exports.PathScurryPosix = exports.PathScurryWin32 = exports.PathScurryBase = exports.PathPosix = exports.PathWin32 = exports.PathBase = exports.ChildrenCache = exports.ResolveCache = void 0; +const lru_cache_1 = require("lru-cache"); +const node_path_1 = require("node:path"); +const node_url_1 = require("node:url"); +const fs_1 = require("fs"); +const actualFS = __importStar(require("node:fs")); +const realpathSync = fs_1.realpathSync.native; +// TODO: test perf of fs/promises realpath vs realpathCB, +// since the promises one uses realpath.native +const promises_1 = require("node:fs/promises"); +const minipass_1 = require("minipass"); +const defaultFS = { + lstatSync: fs_1.lstatSync, + readdir: fs_1.readdir, + readdirSync: fs_1.readdirSync, + readlinkSync: fs_1.readlinkSync, + realpathSync, + promises: { + lstat: promises_1.lstat, + readdir: promises_1.readdir, + readlink: promises_1.readlink, + realpath: promises_1.realpath, + }, +}; +// if they just gave us require('fs') then use our default +const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === actualFS ? + defaultFS + : { + ...defaultFS, + ...fsOption, + promises: { + ...defaultFS.promises, + ...(fsOption.promises || {}), + }, + }; +// turn something like //?/c:/ into c:\ +const uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i; +const uncToDrive = (rootPath) => rootPath.replace(/\//g, '\\').replace(uncDriveRegexp, '$1\\'); +// windows paths are separated by either / or \ +const eitherSep = /[\\\/]/; +const UNKNOWN = 0; // may not even exist, for all we know +const IFIFO = 0b0001; +const IFCHR = 0b0010; +const IFDIR = 0b0100; +const IFBLK = 0b0110; +const IFREG = 0b1000; +const IFLNK = 0b1010; +const IFSOCK = 0b1100; +const IFMT = 0b1111; +// mask to unset low 4 bits +const IFMT_UNKNOWN = ~IFMT; +// set after successfully calling readdir() and getting entries. +const READDIR_CALLED = 0b0000_0001_0000; +// set after a successful lstat() +const LSTAT_CALLED = 0b0000_0010_0000; +// set if an entry (or one of its parents) is definitely not a dir +const ENOTDIR = 0b0000_0100_0000; +// set if an entry (or one of its parents) does not exist +// (can also be set on lstat errors like EACCES or ENAMETOOLONG) +const ENOENT = 0b0000_1000_0000; +// cannot have child entries -- also verify &IFMT is either IFDIR or IFLNK +// set if we fail to readlink +const ENOREADLINK = 0b0001_0000_0000; +// set if we know realpath() will fail +const ENOREALPATH = 0b0010_0000_0000; +const ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH; +const TYPEMASK = 0b0011_1111_1111; +const entToType = (s) => s.isFile() ? IFREG + : s.isDirectory() ? IFDIR + : s.isSymbolicLink() ? IFLNK + : s.isCharacterDevice() ? IFCHR + : s.isBlockDevice() ? IFBLK + : s.isSocket() ? IFSOCK + : s.isFIFO() ? IFIFO + : UNKNOWN; +// normalize unicode path names +const normalizeCache = new Map(); +const normalize = (s) => { + const c = normalizeCache.get(s); + if (c) + return c; + const n = s.normalize('NFKD'); + normalizeCache.set(s, n); + return n; +}; +const normalizeNocaseCache = new Map(); +const normalizeNocase = (s) => { + const c = normalizeNocaseCache.get(s); + if (c) + return c; + const n = normalize(s.toLowerCase()); + normalizeNocaseCache.set(s, n); + return n; +}; +/** + * An LRUCache for storing resolved path strings or Path objects. + * @internal + */ +class ResolveCache extends lru_cache_1.LRUCache { + constructor() { + super({ max: 256 }); + } +} +exports.ResolveCache = ResolveCache; +// In order to prevent blowing out the js heap by allocating hundreds of +// thousands of Path entries when walking extremely large trees, the "children" +// in this tree are represented by storing an array of Path entries in an +// LRUCache, indexed by the parent. At any time, Path.children() may return an +// empty array, indicating that it doesn't know about any of its children, and +// thus has to rebuild that cache. This is fine, it just means that we don't +// benefit as much from having the cached entries, but huge directory walks +// don't blow out the stack, and smaller ones are still as fast as possible. +// +//It does impose some complexity when building up the readdir data, because we +//need to pass a reference to the children array that we started with. +/** + * an LRUCache for storing child entries. + * @internal + */ +class ChildrenCache extends lru_cache_1.LRUCache { + constructor(maxSize = 16 * 1024) { + super({ + maxSize, + // parent + children + sizeCalculation: a => a.length + 1, + }); + } +} +exports.ChildrenCache = ChildrenCache; +const setAsCwd = Symbol('PathScurry setAsCwd'); +/** + * Path objects are sort of like a super-powered + * {@link https://nodejs.org/docs/latest/api/fs.html#class-fsdirent fs.Dirent} + * + * Each one represents a single filesystem entry on disk, which may or may not + * exist. It includes methods for reading various types of information via + * lstat, readlink, and readdir, and caches all information to the greatest + * degree possible. + * + * Note that fs operations that would normally throw will instead return an + * "empty" value. This is in order to prevent excessive overhead from error + * stack traces. + */ +class PathBase { + /** + * the basename of this path + * + * **Important**: *always* test the path name against any test string + * usingthe {@link isNamed} method, and not by directly comparing this + * string. Otherwise, unicode path strings that the system sees as identical + * will not be properly treated as the same path, leading to incorrect + * behavior and possible security issues. + */ + name; + /** + * the Path entry corresponding to the path root. + * + * @internal + */ + root; + /** + * All roots found within the current PathScurry family + * + * @internal + */ + roots; + /** + * a reference to the parent path, or undefined in the case of root entries + * + * @internal + */ + parent; + /** + * boolean indicating whether paths are compared case-insensitively + * @internal + */ + nocase; + /** + * boolean indicating that this path is the current working directory + * of the PathScurry collection that contains it. + */ + isCWD = false; + // potential default fs override + #fs; + // Stats fields + #dev; + get dev() { + return this.#dev; + } + #mode; + get mode() { + return this.#mode; + } + #nlink; + get nlink() { + return this.#nlink; + } + #uid; + get uid() { + return this.#uid; + } + #gid; + get gid() { + return this.#gid; + } + #rdev; + get rdev() { + return this.#rdev; + } + #blksize; + get blksize() { + return this.#blksize; + } + #ino; + get ino() { + return this.#ino; + } + #size; + get size() { + return this.#size; + } + #blocks; + get blocks() { + return this.#blocks; + } + #atimeMs; + get atimeMs() { + return this.#atimeMs; + } + #mtimeMs; + get mtimeMs() { + return this.#mtimeMs; + } + #ctimeMs; + get ctimeMs() { + return this.#ctimeMs; + } + #birthtimeMs; + get birthtimeMs() { + return this.#birthtimeMs; + } + #atime; + get atime() { + return this.#atime; + } + #mtime; + get mtime() { + return this.#mtime; + } + #ctime; + get ctime() { + return this.#ctime; + } + #birthtime; + get birthtime() { + return this.#birthtime; + } + #matchName; + #depth; + #fullpath; + #fullpathPosix; + #relative; + #relativePosix; + #type; + #children; + #linkTarget; + #realpath; + /** + * This property is for compatibility with the Dirent class as of + * Node v20, where Dirent['parentPath'] refers to the path of the + * directory that was passed to readdir. For root entries, it's the path + * to the entry itself. + */ + get parentPath() { + return (this.parent || this).fullpath(); + } + /** + * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively, + * this property refers to the *parent* path, not the path object itself. + */ + get path() { + return this.parentPath; + } + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) { + this.name = name; + this.#matchName = nocase ? normalizeNocase(name) : normalize(name); + this.#type = type & TYPEMASK; + this.nocase = nocase; + this.roots = roots; + this.root = root || this; + this.#children = children; + this.#fullpath = opts.fullpath; + this.#relative = opts.relative; + this.#relativePosix = opts.relativePosix; + this.parent = opts.parent; + if (this.parent) { + this.#fs = this.parent.#fs; + } + else { + this.#fs = fsFromOption(opts.fs); + } + } + /** + * Returns the depth of the Path object from its root. + * + * For example, a path at `/foo/bar` would have a depth of 2. + */ + depth() { + if (this.#depth !== undefined) + return this.#depth; + if (!this.parent) + return (this.#depth = 0); + return (this.#depth = this.parent.depth() + 1); + } + /** + * @internal + */ + childrenCache() { + return this.#children; + } + /** + * Get the Path object referenced by the string path, resolved from this Path + */ + resolve(path) { + if (!path) { + return this; + } + const rootPath = this.getRootString(path); + const dir = path.substring(rootPath.length); + const dirParts = dir.split(this.splitSep); + const result = rootPath ? + this.getRoot(rootPath).#resolveParts(dirParts) + : this.#resolveParts(dirParts); + return result; + } + #resolveParts(dirParts) { + let p = this; + for (const part of dirParts) { + p = p.child(part); + } + return p; + } + /** + * Returns the cached children Path objects, if still available. If they + * have fallen out of the cache, then returns an empty array, and resets the + * READDIR_CALLED bit, so that future calls to readdir() will require an fs + * lookup. + * + * @internal + */ + children() { + const cached = this.#children.get(this); + if (cached) { + return cached; + } + const children = Object.assign([], { provisional: 0 }); + this.#children.set(this, children); + this.#type &= ~READDIR_CALLED; + return children; + } + /** + * Resolves a path portion and returns or creates the child Path. + * + * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is + * `'..'`. + * + * This should not be called directly. If `pathPart` contains any path + * separators, it will lead to unsafe undefined behavior. + * + * Use `Path.resolve()` instead. + * + * @internal + */ + child(pathPart, opts) { + if (pathPart === '' || pathPart === '.') { + return this; + } + if (pathPart === '..') { + return this.parent || this; + } + // find the child + const children = this.children(); + const name = this.nocase ? normalizeNocase(pathPart) : normalize(pathPart); + for (const p of children) { + if (p.#matchName === name) { + return p; + } + } + // didn't find it, create provisional child, since it might not + // actually exist. If we know the parent isn't a dir, then + // in fact it CAN'T exist. + const s = this.parent ? this.sep : ''; + const fullpath = this.#fullpath ? this.#fullpath + s + pathPart : undefined; + const pchild = this.newChild(pathPart, UNKNOWN, { + ...opts, + parent: this, + fullpath, + }); + if (!this.canReaddir()) { + pchild.#type |= ENOENT; + } + // don't have to update provisional, because if we have real children, + // then provisional is set to children.length, otherwise a lower number + children.push(pchild); + return pchild; + } + /** + * The relative path from the cwd. If it does not share an ancestor with + * the cwd, then this ends up being equivalent to the fullpath() + */ + relative() { + if (this.isCWD) + return ''; + if (this.#relative !== undefined) { + return this.#relative; + } + const name = this.name; + const p = this.parent; + if (!p) { + return (this.#relative = this.name); + } + const pv = p.relative(); + return pv + (!pv || !p.parent ? '' : this.sep) + name; + } + /** + * The relative path from the cwd, using / as the path separator. + * If it does not share an ancestor with + * the cwd, then this ends up being equivalent to the fullpathPosix() + * On posix systems, this is identical to relative(). + */ + relativePosix() { + if (this.sep === '/') + return this.relative(); + if (this.isCWD) + return ''; + if (this.#relativePosix !== undefined) + return this.#relativePosix; + const name = this.name; + const p = this.parent; + if (!p) { + return (this.#relativePosix = this.fullpathPosix()); + } + const pv = p.relativePosix(); + return pv + (!pv || !p.parent ? '' : '/') + name; + } + /** + * The fully resolved path string for this Path entry + */ + fullpath() { + if (this.#fullpath !== undefined) { + return this.#fullpath; + } + const name = this.name; + const p = this.parent; + if (!p) { + return (this.#fullpath = this.name); + } + const pv = p.fullpath(); + const fp = pv + (!p.parent ? '' : this.sep) + name; + return (this.#fullpath = fp); + } + /** + * On platforms other than windows, this is identical to fullpath. + * + * On windows, this is overridden to return the forward-slash form of the + * full UNC path. + */ + fullpathPosix() { + if (this.#fullpathPosix !== undefined) + return this.#fullpathPosix; + if (this.sep === '/') + return (this.#fullpathPosix = this.fullpath()); + if (!this.parent) { + const p = this.fullpath().replace(/\\/g, '/'); + if (/^[a-z]:\//i.test(p)) { + return (this.#fullpathPosix = `//?/${p}`); + } + else { + return (this.#fullpathPosix = p); + } + } + const p = this.parent; + const pfpp = p.fullpathPosix(); + const fpp = pfpp + (!pfpp || !p.parent ? '' : '/') + this.name; + return (this.#fullpathPosix = fpp); + } + /** + * Is the Path of an unknown type? + * + * Note that we might know *something* about it if there has been a previous + * filesystem operation, for example that it does not exist, or is not a + * link, or whether it has child entries. + */ + isUnknown() { + return (this.#type & IFMT) === UNKNOWN; + } + isType(type) { + return this[`is${type}`](); + } + getType() { + return (this.isUnknown() ? 'Unknown' + : this.isDirectory() ? 'Directory' + : this.isFile() ? 'File' + : this.isSymbolicLink() ? 'SymbolicLink' + : this.isFIFO() ? 'FIFO' + : this.isCharacterDevice() ? 'CharacterDevice' + : this.isBlockDevice() ? 'BlockDevice' + : /* c8 ignore start */ this.isSocket() ? 'Socket' + : 'Unknown'); + /* c8 ignore stop */ + } + /** + * Is the Path a regular file? + */ + isFile() { + return (this.#type & IFMT) === IFREG; + } + /** + * Is the Path a directory? + */ + isDirectory() { + return (this.#type & IFMT) === IFDIR; + } + /** + * Is the path a character device? + */ + isCharacterDevice() { + return (this.#type & IFMT) === IFCHR; + } + /** + * Is the path a block device? + */ + isBlockDevice() { + return (this.#type & IFMT) === IFBLK; + } + /** + * Is the path a FIFO pipe? + */ + isFIFO() { + return (this.#type & IFMT) === IFIFO; + } + /** + * Is the path a socket? + */ + isSocket() { + return (this.#type & IFMT) === IFSOCK; + } + /** + * Is the path a symbolic link? + */ + isSymbolicLink() { + return (this.#type & IFLNK) === IFLNK; + } + /** + * Return the entry if it has been subject of a successful lstat, or + * undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* simply + * mean that we haven't called lstat on it. + */ + lstatCached() { + return this.#type & LSTAT_CALLED ? this : undefined; + } + /** + * Return the cached link target if the entry has been the subject of a + * successful readlink, or undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * readlink() has been called at some point. + */ + readlinkCached() { + return this.#linkTarget; + } + /** + * Returns the cached realpath target if the entry has been the subject + * of a successful realpath, or undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * realpath() has been called at some point. + */ + realpathCached() { + return this.#realpath; + } + /** + * Returns the cached child Path entries array if the entry has been the + * subject of a successful readdir(), or [] otherwise. + * + * Does not read the filesystem, so an empty array *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * readdir() has been called recently enough to still be valid. + */ + readdirCached() { + const children = this.children(); + return children.slice(0, children.provisional); + } + /** + * Return true if it's worth trying to readlink. Ie, we don't (yet) have + * any indication that readlink will definitely fail. + * + * Returns false if the path is known to not be a symlink, if a previous + * readlink failed, or if the entry does not exist. + */ + canReadlink() { + if (this.#linkTarget) + return true; + if (!this.parent) + return false; + // cases where it cannot possibly succeed + const ifmt = this.#type & IFMT; + return !((ifmt !== UNKNOWN && ifmt !== IFLNK) || + this.#type & ENOREADLINK || + this.#type & ENOENT); + } + /** + * Return true if readdir has previously been successfully called on this + * path, indicating that cachedReaddir() is likely valid. + */ + calledReaddir() { + return !!(this.#type & READDIR_CALLED); + } + /** + * Returns true if the path is known to not exist. That is, a previous lstat + * or readdir failed to verify its existence when that would have been + * expected, or a parent entry was marked either enoent or enotdir. + */ + isENOENT() { + return !!(this.#type & ENOENT); + } + /** + * Return true if the path is a match for the given path name. This handles + * case sensitivity and unicode normalization. + * + * Note: even on case-sensitive systems, it is **not** safe to test the + * equality of the `.name` property to determine whether a given pathname + * matches, due to unicode normalization mismatches. + * + * Always use this method instead of testing the `path.name` property + * directly. + */ + isNamed(n) { + return !this.nocase ? + this.#matchName === normalize(n) + : this.#matchName === normalizeNocase(n); + } + /** + * Return the Path object corresponding to the target of a symbolic link. + * + * If the Path is not a symbolic link, or if the readlink call fails for any + * reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + */ + async readlink() { + const target = this.#linkTarget; + if (target) { + return target; + } + if (!this.canReadlink()) { + return undefined; + } + /* c8 ignore start */ + // already covered by the canReadlink test, here for ts grumples + if (!this.parent) { + return undefined; + } + /* c8 ignore stop */ + try { + const read = await this.#fs.promises.readlink(this.fullpath()); + const linkTarget = (await this.parent.realpath())?.resolve(read); + if (linkTarget) { + return (this.#linkTarget = linkTarget); + } + } + catch (er) { + this.#readlinkFail(er.code); + return undefined; + } + } + /** + * Synchronous {@link PathBase.readlink} + */ + readlinkSync() { + const target = this.#linkTarget; + if (target) { + return target; + } + if (!this.canReadlink()) { + return undefined; + } + /* c8 ignore start */ + // already covered by the canReadlink test, here for ts grumples + if (!this.parent) { + return undefined; + } + /* c8 ignore stop */ + try { + const read = this.#fs.readlinkSync(this.fullpath()); + const linkTarget = this.parent.realpathSync()?.resolve(read); + if (linkTarget) { + return (this.#linkTarget = linkTarget); + } + } + catch (er) { + this.#readlinkFail(er.code); + return undefined; + } + } + #readdirSuccess(children) { + // succeeded, mark readdir called bit + this.#type |= READDIR_CALLED; + // mark all remaining provisional children as ENOENT + for (let p = children.provisional; p < children.length; p++) { + const c = children[p]; + if (c) + c.#markENOENT(); + } + } + #markENOENT() { + // mark as UNKNOWN and ENOENT + if (this.#type & ENOENT) + return; + this.#type = (this.#type | ENOENT) & IFMT_UNKNOWN; + this.#markChildrenENOENT(); + } + #markChildrenENOENT() { + // all children are provisional and do not exist + const children = this.children(); + children.provisional = 0; + for (const p of children) { + p.#markENOENT(); + } + } + #markENOREALPATH() { + this.#type |= ENOREALPATH; + this.#markENOTDIR(); + } + // save the information when we know the entry is not a dir + #markENOTDIR() { + // entry is not a directory, so any children can't exist. + // this *should* be impossible, since any children created + // after it's been marked ENOTDIR should be marked ENOENT, + // so it won't even get to this point. + /* c8 ignore start */ + if (this.#type & ENOTDIR) + return; + /* c8 ignore stop */ + let t = this.#type; + // this could happen if we stat a dir, then delete it, + // then try to read it or one of its children. + if ((t & IFMT) === IFDIR) + t &= IFMT_UNKNOWN; + this.#type = t | ENOTDIR; + this.#markChildrenENOENT(); + } + #readdirFail(code = '') { + // markENOTDIR and markENOENT also set provisional=0 + if (code === 'ENOTDIR' || code === 'EPERM') { + this.#markENOTDIR(); + } + else if (code === 'ENOENT') { + this.#markENOENT(); + } + else { + this.children().provisional = 0; + } + } + #lstatFail(code = '') { + // Windows just raises ENOENT in this case, disable for win CI + /* c8 ignore start */ + if (code === 'ENOTDIR') { + // already know it has a parent by this point + const p = this.parent; + p.#markENOTDIR(); + } + else if (code === 'ENOENT') { + /* c8 ignore stop */ + this.#markENOENT(); + } + } + #readlinkFail(code = '') { + let ter = this.#type; + ter |= ENOREADLINK; + if (code === 'ENOENT') + ter |= ENOENT; + // windows gets a weird error when you try to readlink a file + if (code === 'EINVAL' || code === 'UNKNOWN') { + // exists, but not a symlink, we don't know WHAT it is, so remove + // all IFMT bits. + ter &= IFMT_UNKNOWN; + } + this.#type = ter; + // windows just gets ENOENT in this case. We do cover the case, + // just disabled because it's impossible on Windows CI + /* c8 ignore start */ + if (code === 'ENOTDIR' && this.parent) { + this.parent.#markENOTDIR(); + } + /* c8 ignore stop */ + } + #readdirAddChild(e, c) { + return (this.#readdirMaybePromoteChild(e, c) || + this.#readdirAddNewChild(e, c)); + } + #readdirAddNewChild(e, c) { + // alloc new entry at head, so it's never provisional + const type = entToType(e); + const child = this.newChild(e.name, type, { parent: this }); + const ifmt = child.#type & IFMT; + if (ifmt !== IFDIR && ifmt !== IFLNK && ifmt !== UNKNOWN) { + child.#type |= ENOTDIR; + } + c.unshift(child); + c.provisional++; + return child; + } + #readdirMaybePromoteChild(e, c) { + for (let p = c.provisional; p < c.length; p++) { + const pchild = c[p]; + const name = this.nocase ? normalizeNocase(e.name) : normalize(e.name); + if (name !== pchild.#matchName) { + continue; + } + return this.#readdirPromoteChild(e, pchild, p, c); + } + } + #readdirPromoteChild(e, p, index, c) { + const v = p.name; + // retain any other flags, but set ifmt from dirent + p.#type = (p.#type & IFMT_UNKNOWN) | entToType(e); + // case sensitivity fixing when we learn the true name. + if (v !== e.name) + p.name = e.name; + // just advance provisional index (potentially off the list), + // otherwise we have to splice/pop it out and re-insert at head + if (index !== c.provisional) { + if (index === c.length - 1) + c.pop(); + else + c.splice(index, 1); + c.unshift(p); + } + c.provisional++; + return p; + } + /** + * Call lstat() on this Path, and update all known information that can be + * determined. + * + * Note that unlike `fs.lstat()`, the returned value does not contain some + * information, such as `mode`, `dev`, `nlink`, and `ino`. If that + * information is required, you will need to call `fs.lstat` yourself. + * + * If the Path refers to a nonexistent file, or if the lstat call fails for + * any reason, `undefined` is returned. Otherwise the updated Path object is + * returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + async lstat() { + if ((this.#type & ENOENT) === 0) { + try { + this.#applyStat(await this.#fs.promises.lstat(this.fullpath())); + return this; + } + catch (er) { + this.#lstatFail(er.code); + } + } + } + /** + * synchronous {@link PathBase.lstat} + */ + lstatSync() { + if ((this.#type & ENOENT) === 0) { + try { + this.#applyStat(this.#fs.lstatSync(this.fullpath())); + return this; + } + catch (er) { + this.#lstatFail(er.code); + } + } + } + #applyStat(st) { + const { atime, atimeMs, birthtime, birthtimeMs, blksize, blocks, ctime, ctimeMs, dev, gid, ino, mode, mtime, mtimeMs, nlink, rdev, size, uid, } = st; + this.#atime = atime; + this.#atimeMs = atimeMs; + this.#birthtime = birthtime; + this.#birthtimeMs = birthtimeMs; + this.#blksize = blksize; + this.#blocks = blocks; + this.#ctime = ctime; + this.#ctimeMs = ctimeMs; + this.#dev = dev; + this.#gid = gid; + this.#ino = ino; + this.#mode = mode; + this.#mtime = mtime; + this.#mtimeMs = mtimeMs; + this.#nlink = nlink; + this.#rdev = rdev; + this.#size = size; + this.#uid = uid; + const ifmt = entToType(st); + // retain any other flags, but set the ifmt + this.#type = (this.#type & IFMT_UNKNOWN) | ifmt | LSTAT_CALLED; + if (ifmt !== UNKNOWN && ifmt !== IFDIR && ifmt !== IFLNK) { + this.#type |= ENOTDIR; + } + } + #onReaddirCB = []; + #readdirCBInFlight = false; + #callOnReaddirCB(children) { + this.#readdirCBInFlight = false; + const cbs = this.#onReaddirCB.slice(); + this.#onReaddirCB.length = 0; + cbs.forEach(cb => cb(null, children)); + } + /** + * Standard node-style callback interface to get list of directory entries. + * + * If the Path cannot or does not contain any children, then an empty array + * is returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + * + * @param cb The callback called with (er, entries). Note that the `er` + * param is somewhat extraneous, as all readdir() errors are handled and + * simply result in an empty set of entries being returned. + * @param allowZalgo Boolean indicating that immediately known results should + * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release + * zalgo at your peril, the dark pony lord is devious and unforgiving. + */ + readdirCB(cb, allowZalgo = false) { + if (!this.canReaddir()) { + if (allowZalgo) + cb(null, []); + else + queueMicrotask(() => cb(null, [])); + return; + } + const children = this.children(); + if (this.calledReaddir()) { + const c = children.slice(0, children.provisional); + if (allowZalgo) + cb(null, c); + else + queueMicrotask(() => cb(null, c)); + return; + } + // don't have to worry about zalgo at this point. + this.#onReaddirCB.push(cb); + if (this.#readdirCBInFlight) { + return; + } + this.#readdirCBInFlight = true; + // else read the directory, fill up children + // de-provisionalize any provisional children. + const fullpath = this.fullpath(); + this.#fs.readdir(fullpath, { withFileTypes: true }, (er, entries) => { + if (er) { + this.#readdirFail(er.code); + children.provisional = 0; + } + else { + // if we didn't get an error, we always get entries. + //@ts-ignore + for (const e of entries) { + this.#readdirAddChild(e, children); + } + this.#readdirSuccess(children); + } + this.#callOnReaddirCB(children.slice(0, children.provisional)); + return; + }); + } + #asyncReaddirInFlight; + /** + * Return an array of known child entries. + * + * If the Path cannot or does not contain any children, then an empty array + * is returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + async readdir() { + if (!this.canReaddir()) { + return []; + } + const children = this.children(); + if (this.calledReaddir()) { + return children.slice(0, children.provisional); + } + // else read the directory, fill up children + // de-provisionalize any provisional children. + const fullpath = this.fullpath(); + if (this.#asyncReaddirInFlight) { + await this.#asyncReaddirInFlight; + } + else { + /* c8 ignore start */ + let resolve = () => { }; + /* c8 ignore stop */ + this.#asyncReaddirInFlight = new Promise(res => (resolve = res)); + try { + for (const e of await this.#fs.promises.readdir(fullpath, { + withFileTypes: true, + })) { + this.#readdirAddChild(e, children); + } + this.#readdirSuccess(children); + } + catch (er) { + this.#readdirFail(er.code); + children.provisional = 0; + } + this.#asyncReaddirInFlight = undefined; + resolve(); + } + return children.slice(0, children.provisional); + } + /** + * synchronous {@link PathBase.readdir} + */ + readdirSync() { + if (!this.canReaddir()) { + return []; + } + const children = this.children(); + if (this.calledReaddir()) { + return children.slice(0, children.provisional); + } + // else read the directory, fill up children + // de-provisionalize any provisional children. + const fullpath = this.fullpath(); + try { + for (const e of this.#fs.readdirSync(fullpath, { + withFileTypes: true, + })) { + this.#readdirAddChild(e, children); + } + this.#readdirSuccess(children); + } + catch (er) { + this.#readdirFail(er.code); + children.provisional = 0; + } + return children.slice(0, children.provisional); + } + canReaddir() { + if (this.#type & ENOCHILD) + return false; + const ifmt = IFMT & this.#type; + // we always set ENOTDIR when setting IFMT, so should be impossible + /* c8 ignore start */ + if (!(ifmt === UNKNOWN || ifmt === IFDIR || ifmt === IFLNK)) { + return false; + } + /* c8 ignore stop */ + return true; + } + shouldWalk(dirs, walkFilter) { + return ((this.#type & IFDIR) === IFDIR && + !(this.#type & ENOCHILD) && + !dirs.has(this) && + (!walkFilter || walkFilter(this))); + } + /** + * Return the Path object corresponding to path as resolved + * by realpath(3). + * + * If the realpath call fails for any reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + * On success, returns a Path object. + */ + async realpath() { + if (this.#realpath) + return this.#realpath; + if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type) + return undefined; + try { + const rp = await this.#fs.promises.realpath(this.fullpath()); + return (this.#realpath = this.resolve(rp)); + } + catch (_) { + this.#markENOREALPATH(); + } + } + /** + * Synchronous {@link realpath} + */ + realpathSync() { + if (this.#realpath) + return this.#realpath; + if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type) + return undefined; + try { + const rp = this.#fs.realpathSync(this.fullpath()); + return (this.#realpath = this.resolve(rp)); + } + catch (_) { + this.#markENOREALPATH(); + } + } + /** + * Internal method to mark this Path object as the scurry cwd, + * called by {@link PathScurry#chdir} + * + * @internal + */ + [setAsCwd](oldCwd) { + if (oldCwd === this) + return; + oldCwd.isCWD = false; + this.isCWD = true; + const changed = new Set([]); + let rp = []; + let p = this; + while (p && p.parent) { + changed.add(p); + p.#relative = rp.join(this.sep); + p.#relativePosix = rp.join('/'); + p = p.parent; + rp.push('..'); + } + // now un-memoize parents of old cwd + p = oldCwd; + while (p && p.parent && !changed.has(p)) { + p.#relative = undefined; + p.#relativePosix = undefined; + p = p.parent; + } + } +} +exports.PathBase = PathBase; +/** + * Path class used on win32 systems + * + * Uses `'\\'` as the path separator for returned paths, either `'\\'` or `'/'` + * as the path separator for parsing paths. + */ +class PathWin32 extends PathBase { + /** + * Separator for generating path strings. + */ + sep = '\\'; + /** + * Separator for parsing path strings. + */ + splitSep = eitherSep; + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) { + super(name, type, root, roots, nocase, children, opts); + } + /** + * @internal + */ + newChild(name, type = UNKNOWN, opts = {}) { + return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts); + } + /** + * @internal + */ + getRootString(path) { + return node_path_1.win32.parse(path).root; + } + /** + * @internal + */ + getRoot(rootPath) { + rootPath = uncToDrive(rootPath.toUpperCase()); + if (rootPath === this.root.name) { + return this.root; + } + // ok, not that one, check if it matches another we know about + for (const [compare, root] of Object.entries(this.roots)) { + if (this.sameRoot(rootPath, compare)) { + return (this.roots[rootPath] = root); + } + } + // otherwise, have to create a new one. + return (this.roots[rootPath] = new PathScurryWin32(rootPath, this).root); + } + /** + * @internal + */ + sameRoot(rootPath, compare = this.root.name) { + // windows can (rarely) have case-sensitive filesystem, but + // UNC and drive letters are always case-insensitive, and canonically + // represented uppercase. + rootPath = rootPath + .toUpperCase() + .replace(/\//g, '\\') + .replace(uncDriveRegexp, '$1\\'); + return rootPath === compare; + } +} +exports.PathWin32 = PathWin32; +/** + * Path class used on all posix systems. + * + * Uses `'/'` as the path separator. + */ +class PathPosix extends PathBase { + /** + * separator for parsing path strings + */ + splitSep = '/'; + /** + * separator for generating path strings + */ + sep = '/'; + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) { + super(name, type, root, roots, nocase, children, opts); + } + /** + * @internal + */ + getRootString(path) { + return path.startsWith('/') ? '/' : ''; + } + /** + * @internal + */ + getRoot(_rootPath) { + return this.root; + } + /** + * @internal + */ + newChild(name, type = UNKNOWN, opts = {}) { + return new PathPosix(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts); + } +} +exports.PathPosix = PathPosix; +/** + * The base class for all PathScurry classes, providing the interface for path + * resolution and filesystem operations. + * + * Typically, you should *not* instantiate this class directly, but rather one + * of the platform-specific classes, or the exported {@link PathScurry} which + * defaults to the current platform. + */ +class PathScurryBase { + /** + * The root Path entry for the current working directory of this Scurry + */ + root; + /** + * The string path for the root of this Scurry's current working directory + */ + rootPath; + /** + * A collection of all roots encountered, referenced by rootPath + */ + roots; + /** + * The Path entry corresponding to this PathScurry's current working directory. + */ + cwd; + #resolveCache; + #resolvePosixCache; + #children; + /** + * Perform path comparisons case-insensitively. + * + * Defaults true on Darwin and Windows systems, false elsewhere. + */ + nocase; + #fs; + /** + * This class should not be instantiated directly. + * + * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry + * + * @internal + */ + constructor(cwd = process.cwd(), pathImpl, sep, { nocase, childrenCacheSize = 16 * 1024, fs = defaultFS, } = {}) { + this.#fs = fsFromOption(fs); + if (cwd instanceof URL || cwd.startsWith('file://')) { + cwd = (0, node_url_1.fileURLToPath)(cwd); + } + // resolve and split root, and then add to the store. + // this is the only time we call path.resolve() + const cwdPath = pathImpl.resolve(cwd); + this.roots = Object.create(null); + this.rootPath = this.parseRootPath(cwdPath); + this.#resolveCache = new ResolveCache(); + this.#resolvePosixCache = new ResolveCache(); + this.#children = new ChildrenCache(childrenCacheSize); + const split = cwdPath.substring(this.rootPath.length).split(sep); + // resolve('/') leaves '', splits to [''], we don't want that. + if (split.length === 1 && !split[0]) { + split.pop(); + } + /* c8 ignore start */ + if (nocase === undefined) { + throw new TypeError('must provide nocase setting to PathScurryBase ctor'); + } + /* c8 ignore stop */ + this.nocase = nocase; + this.root = this.newRoot(this.#fs); + this.roots[this.rootPath] = this.root; + let prev = this.root; + let len = split.length - 1; + const joinSep = pathImpl.sep; + let abs = this.rootPath; + let sawFirst = false; + for (const part of split) { + const l = len--; + prev = prev.child(part, { + relative: new Array(l).fill('..').join(joinSep), + relativePosix: new Array(l).fill('..').join('/'), + fullpath: (abs += (sawFirst ? '' : joinSep) + part), + }); + sawFirst = true; + } + this.cwd = prev; + } + /** + * Get the depth of a provided path, string, or the cwd + */ + depth(path = this.cwd) { + if (typeof path === 'string') { + path = this.cwd.resolve(path); + } + return path.depth(); + } + /** + * Return the cache of child entries. Exposed so subclasses can create + * child Path objects in a platform-specific way. + * + * @internal + */ + childrenCache() { + return this.#children; + } + /** + * Resolve one or more path strings to a resolved string + * + * Same interface as require('path').resolve. + * + * Much faster than path.resolve() when called multiple times for the same + * path, because the resolved Path objects are cached. Much slower + * otherwise. + */ + resolve(...paths) { + // first figure out the minimum number of paths we have to test + // we always start at cwd, but any absolutes will bump the start + let r = ''; + for (let i = paths.length - 1; i >= 0; i--) { + const p = paths[i]; + if (!p || p === '.') + continue; + r = r ? `${p}/${r}` : p; + if (this.isAbsolute(p)) { + break; + } + } + const cached = this.#resolveCache.get(r); + if (cached !== undefined) { + return cached; + } + const result = this.cwd.resolve(r).fullpath(); + this.#resolveCache.set(r, result); + return result; + } + /** + * Resolve one or more path strings to a resolved string, returning + * the posix path. Identical to .resolve() on posix systems, but on + * windows will return a forward-slash separated UNC path. + * + * Same interface as require('path').resolve. + * + * Much faster than path.resolve() when called multiple times for the same + * path, because the resolved Path objects are cached. Much slower + * otherwise. + */ + resolvePosix(...paths) { + // first figure out the minimum number of paths we have to test + // we always start at cwd, but any absolutes will bump the start + let r = ''; + for (let i = paths.length - 1; i >= 0; i--) { + const p = paths[i]; + if (!p || p === '.') + continue; + r = r ? `${p}/${r}` : p; + if (this.isAbsolute(p)) { + break; + } + } + const cached = this.#resolvePosixCache.get(r); + if (cached !== undefined) { + return cached; + } + const result = this.cwd.resolve(r).fullpathPosix(); + this.#resolvePosixCache.set(r, result); + return result; + } + /** + * find the relative path from the cwd to the supplied path string or entry + */ + relative(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return entry.relative(); + } + /** + * find the relative path from the cwd to the supplied path string or + * entry, using / as the path delimiter, even on Windows. + */ + relativePosix(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return entry.relativePosix(); + } + /** + * Return the basename for the provided string or Path object + */ + basename(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return entry.name; + } + /** + * Return the dirname for the provided string or Path object + */ + dirname(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return (entry.parent || entry).fullpath(); + } + async readdir(entry = this.cwd, opts = { + withFileTypes: true, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes } = opts; + if (!entry.canReaddir()) { + return []; + } + else { + const p = await entry.readdir(); + return withFileTypes ? p : p.map(e => e.name); + } + } + readdirSync(entry = this.cwd, opts = { + withFileTypes: true, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true } = opts; + if (!entry.canReaddir()) { + return []; + } + else if (withFileTypes) { + return entry.readdirSync(); + } + else { + return entry.readdirSync().map(e => e.name); + } + } + /** + * Call lstat() on the string or Path object, and update all known + * information that can be determined. + * + * Note that unlike `fs.lstat()`, the returned value does not contain some + * information, such as `mode`, `dev`, `nlink`, and `ino`. If that + * information is required, you will need to call `fs.lstat` yourself. + * + * If the Path refers to a nonexistent file, or if the lstat call fails for + * any reason, `undefined` is returned. Otherwise the updated Path object is + * returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + async lstat(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return entry.lstat(); + } + /** + * synchronous {@link PathScurryBase.lstat} + */ + lstatSync(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return entry.lstatSync(); + } + async readlink(entry = this.cwd, { withFileTypes } = { + withFileTypes: false, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + withFileTypes = entry.withFileTypes; + entry = this.cwd; + } + const e = await entry.readlink(); + return withFileTypes ? e : e?.fullpath(); + } + readlinkSync(entry = this.cwd, { withFileTypes } = { + withFileTypes: false, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + withFileTypes = entry.withFileTypes; + entry = this.cwd; + } + const e = entry.readlinkSync(); + return withFileTypes ? e : e?.fullpath(); + } + async realpath(entry = this.cwd, { withFileTypes } = { + withFileTypes: false, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + withFileTypes = entry.withFileTypes; + entry = this.cwd; + } + const e = await entry.realpath(); + return withFileTypes ? e : e?.fullpath(); + } + realpathSync(entry = this.cwd, { withFileTypes } = { + withFileTypes: false, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + withFileTypes = entry.withFileTypes; + entry = this.cwd; + } + const e = entry.realpathSync(); + return withFileTypes ? e : e?.fullpath(); + } + async walk(entry = this.cwd, opts = {}) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true, follow = false, filter, walkFilter, } = opts; + const results = []; + if (!filter || filter(entry)) { + results.push(withFileTypes ? entry : entry.fullpath()); + } + const dirs = new Set(); + const walk = (dir, cb) => { + dirs.add(dir); + dir.readdirCB((er, entries) => { + /* c8 ignore start */ + if (er) { + return cb(er); + } + /* c8 ignore stop */ + let len = entries.length; + if (!len) + return cb(); + const next = () => { + if (--len === 0) { + cb(); + } + }; + for (const e of entries) { + if (!filter || filter(e)) { + results.push(withFileTypes ? e : e.fullpath()); + } + if (follow && e.isSymbolicLink()) { + e.realpath() + .then(r => (r?.isUnknown() ? r.lstat() : r)) + .then(r => r?.shouldWalk(dirs, walkFilter) ? walk(r, next) : next()); + } + else { + if (e.shouldWalk(dirs, walkFilter)) { + walk(e, next); + } + else { + next(); + } + } + } + }, true); // zalgooooooo + }; + const start = entry; + return new Promise((res, rej) => { + walk(start, er => { + /* c8 ignore start */ + if (er) + return rej(er); + /* c8 ignore stop */ + res(results); + }); + }); + } + walkSync(entry = this.cwd, opts = {}) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true, follow = false, filter, walkFilter, } = opts; + const results = []; + if (!filter || filter(entry)) { + results.push(withFileTypes ? entry : entry.fullpath()); + } + const dirs = new Set([entry]); + for (const dir of dirs) { + const entries = dir.readdirSync(); + for (const e of entries) { + if (!filter || filter(e)) { + results.push(withFileTypes ? e : e.fullpath()); + } + let r = e; + if (e.isSymbolicLink()) { + if (!(follow && (r = e.realpathSync()))) + continue; + if (r.isUnknown()) + r.lstatSync(); + } + if (r.shouldWalk(dirs, walkFilter)) { + dirs.add(r); + } + } + } + return results; + } + /** + * Support for `for await` + * + * Alias for {@link PathScurryBase.iterate} + * + * Note: As of Node 19, this is very slow, compared to other methods of + * walking. Consider using {@link PathScurryBase.stream} if memory overhead + * and backpressure are concerns, or {@link PathScurryBase.walk} if not. + */ + [Symbol.asyncIterator]() { + return this.iterate(); + } + iterate(entry = this.cwd, options = {}) { + // iterating async over the stream is significantly more performant, + // especially in the warm-cache scenario, because it buffers up directory + // entries in the background instead of waiting for a yield for each one. + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + options = entry; + entry = this.cwd; + } + return this.stream(entry, options)[Symbol.asyncIterator](); + } + /** + * Iterating over a PathScurry performs a synchronous walk. + * + * Alias for {@link PathScurryBase.iterateSync} + */ + [Symbol.iterator]() { + return this.iterateSync(); + } + *iterateSync(entry = this.cwd, opts = {}) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true, follow = false, filter, walkFilter, } = opts; + if (!filter || filter(entry)) { + yield withFileTypes ? entry : entry.fullpath(); + } + const dirs = new Set([entry]); + for (const dir of dirs) { + const entries = dir.readdirSync(); + for (const e of entries) { + if (!filter || filter(e)) { + yield withFileTypes ? e : e.fullpath(); + } + let r = e; + if (e.isSymbolicLink()) { + if (!(follow && (r = e.realpathSync()))) + continue; + if (r.isUnknown()) + r.lstatSync(); + } + if (r.shouldWalk(dirs, walkFilter)) { + dirs.add(r); + } + } + } + } + stream(entry = this.cwd, opts = {}) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true, follow = false, filter, walkFilter, } = opts; + const results = new minipass_1.Minipass({ objectMode: true }); + if (!filter || filter(entry)) { + results.write(withFileTypes ? entry : entry.fullpath()); + } + const dirs = new Set(); + const queue = [entry]; + let processing = 0; + const process = () => { + let paused = false; + while (!paused) { + const dir = queue.shift(); + if (!dir) { + if (processing === 0) + results.end(); + return; + } + processing++; + dirs.add(dir); + const onReaddir = (er, entries, didRealpaths = false) => { + /* c8 ignore start */ + if (er) + return results.emit('error', er); + /* c8 ignore stop */ + if (follow && !didRealpaths) { + const promises = []; + for (const e of entries) { + if (e.isSymbolicLink()) { + promises.push(e + .realpath() + .then((r) => r?.isUnknown() ? r.lstat() : r)); + } + } + if (promises.length) { + Promise.all(promises).then(() => onReaddir(null, entries, true)); + return; + } + } + for (const e of entries) { + if (e && (!filter || filter(e))) { + if (!results.write(withFileTypes ? e : e.fullpath())) { + paused = true; + } + } + } + processing--; + for (const e of entries) { + const r = e.realpathCached() || e; + if (r.shouldWalk(dirs, walkFilter)) { + queue.push(r); + } + } + if (paused && !results.flowing) { + results.once('drain', process); + } + else if (!sync) { + process(); + } + }; + // zalgo containment + let sync = true; + dir.readdirCB(onReaddir, true); + sync = false; + } + }; + process(); + return results; + } + streamSync(entry = this.cwd, opts = {}) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true, follow = false, filter, walkFilter, } = opts; + const results = new minipass_1.Minipass({ objectMode: true }); + const dirs = new Set(); + if (!filter || filter(entry)) { + results.write(withFileTypes ? entry : entry.fullpath()); + } + const queue = [entry]; + let processing = 0; + const process = () => { + let paused = false; + while (!paused) { + const dir = queue.shift(); + if (!dir) { + if (processing === 0) + results.end(); + return; + } + processing++; + dirs.add(dir); + const entries = dir.readdirSync(); + for (const e of entries) { + if (!filter || filter(e)) { + if (!results.write(withFileTypes ? e : e.fullpath())) { + paused = true; + } + } + } + processing--; + for (const e of entries) { + let r = e; + if (e.isSymbolicLink()) { + if (!(follow && (r = e.realpathSync()))) + continue; + if (r.isUnknown()) + r.lstatSync(); + } + if (r.shouldWalk(dirs, walkFilter)) { + queue.push(r); + } + } + } + if (paused && !results.flowing) + results.once('drain', process); + }; + process(); + return results; + } + chdir(path = this.cwd) { + const oldCwd = this.cwd; + this.cwd = typeof path === 'string' ? this.cwd.resolve(path) : path; + this.cwd[setAsCwd](oldCwd); + } +} +exports.PathScurryBase = PathScurryBase; +/** + * Windows implementation of {@link PathScurryBase} + * + * Defaults to case insensitve, uses `'\\'` to generate path strings. Uses + * {@link PathWin32} for Path objects. + */ +class PathScurryWin32 extends PathScurryBase { + /** + * separator for generating path strings + */ + sep = '\\'; + constructor(cwd = process.cwd(), opts = {}) { + const { nocase = true } = opts; + super(cwd, node_path_1.win32, '\\', { ...opts, nocase }); + this.nocase = nocase; + for (let p = this.cwd; p; p = p.parent) { + p.nocase = this.nocase; + } + } + /** + * @internal + */ + parseRootPath(dir) { + // if the path starts with a single separator, it's not a UNC, and we'll + // just get separator as the root, and driveFromUNC will return \ + // In that case, mount \ on the root from the cwd. + return node_path_1.win32.parse(dir).root.toUpperCase(); + } + /** + * @internal + */ + newRoot(fs) { + return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs }); + } + /** + * Return true if the provided path string is an absolute path + */ + isAbsolute(p) { + return (p.startsWith('/') || p.startsWith('\\') || /^[a-z]:(\/|\\)/i.test(p)); + } +} +exports.PathScurryWin32 = PathScurryWin32; +/** + * {@link PathScurryBase} implementation for all posix systems other than Darwin. + * + * Defaults to case-sensitive matching, uses `'/'` to generate path strings. + * + * Uses {@link PathPosix} for Path objects. + */ +class PathScurryPosix extends PathScurryBase { + /** + * separator for generating path strings + */ + sep = '/'; + constructor(cwd = process.cwd(), opts = {}) { + const { nocase = false } = opts; + super(cwd, node_path_1.posix, '/', { ...opts, nocase }); + this.nocase = nocase; + } + /** + * @internal + */ + parseRootPath(_dir) { + return '/'; + } + /** + * @internal + */ + newRoot(fs) { + return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs }); + } + /** + * Return true if the provided path string is an absolute path + */ + isAbsolute(p) { + return p.startsWith('/'); + } +} +exports.PathScurryPosix = PathScurryPosix; +/** + * {@link PathScurryBase} implementation for Darwin (macOS) systems. + * + * Defaults to case-insensitive matching, uses `'/'` for generating path + * strings. + * + * Uses {@link PathPosix} for Path objects. + */ +class PathScurryDarwin extends PathScurryPosix { + constructor(cwd = process.cwd(), opts = {}) { + const { nocase = true } = opts; + super(cwd, { ...opts, nocase }); + } +} +exports.PathScurryDarwin = PathScurryDarwin; +/** + * Default {@link PathBase} implementation for the current platform. + * + * {@link PathWin32} on Windows systems, {@link PathPosix} on all others. + */ +exports.Path = process.platform === 'win32' ? PathWin32 : PathPosix; +/** + * Default {@link PathScurryBase} implementation for the current platform. + * + * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on + * Darwin (macOS) systems, {@link PathScurryPosix} on all others. + */ +exports.PathScurry = process.platform === 'win32' ? PathScurryWin32 + : process.platform === 'darwin' ? PathScurryDarwin + : PathScurryPosix; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/path-scurry/dist/commonjs/index.js.map b/node_modules/path-scurry/dist/commonjs/index.js.map new file mode 100644 index 00000000..fdeca217 --- /dev/null +++ b/node_modules/path-scurry/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sour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AAK,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;IACjC,CAAC;CACF;AARD,4CAQC;AAED;;;;GAIG;AACU,QAAA,IAAI,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA;AAGxE;;;;;GAKG;AACU,QAAA,UAAU,GAIrB,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe;IAC9C,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB;QAClD,CAAC,CAAC,eAAe,CAAA","sourcesContent":["import { LRUCache } from 'lru-cache'\nimport { posix, win32 } from 'node:path'\n\nimport { fileURLToPath } from 'node:url'\n\nimport {\n lstatSync,\n readdir as readdirCB,\n readdirSync,\n readlinkSync,\n realpathSync as rps,\n} from 'fs'\nimport * as actualFS from 'node:fs'\n\nconst realpathSync = rps.native\n// TODO: test perf of fs/promises realpath vs realpathCB,\n// since the promises one uses realpath.native\n\nimport { lstat, readdir, readlink, realpath } from 'node:fs/promises'\n\nimport { Minipass } from 'minipass'\nimport type { Dirent, Stats } from 'node:fs'\n\n/**\n * An object that will be used to override the default `fs`\n * methods. Any methods that are not overridden will use Node's\n * built-in implementations.\n *\n * - lstatSync\n * - readdir (callback `withFileTypes` Dirent variant, used for\n * readdirCB and most walks)\n * - readdirSync\n * - readlinkSync\n * - realpathSync\n * - promises: Object containing the following async methods:\n * - lstat\n * - readdir (Dirent variant only)\n * - readlink\n * - realpath\n */\nexport interface FSOption {\n lstatSync?: (path: string) => Stats\n readdir?: (\n path: string,\n options: { withFileTypes: true },\n cb: (er: NodeJS.ErrnoException | null, entries?: Dirent[]) => any,\n ) => void\n readdirSync?: (\n path: string,\n options: { withFileTypes: true },\n ) => Dirent[]\n readlinkSync?: (path: string) => string\n realpathSync?: (path: string) => string\n promises?: {\n lstat?: (path: string) => Promise\n readdir?: (\n path: string,\n options: { withFileTypes: true },\n ) => Promise\n readlink?: (path: string) => Promise\n realpath?: (path: string) => Promise\n [k: string]: any\n }\n [k: string]: any\n}\n\ninterface FSValue {\n lstatSync: (path: string) => Stats\n readdir: (\n path: string,\n options: { withFileTypes: true },\n cb: (er: NodeJS.ErrnoException | null, entries?: Dirent[]) => any,\n ) => void\n readdirSync: (path: string, options: { withFileTypes: true }) => Dirent[]\n readlinkSync: (path: string) => string\n realpathSync: (path: string) => string\n promises: {\n lstat: (path: string) => Promise\n readdir: (\n path: string,\n options: { withFileTypes: true },\n ) => Promise\n readlink: (path: string) => Promise\n realpath: (path: string) => Promise\n [k: string]: any\n }\n [k: string]: any\n}\n\nconst defaultFS: FSValue = {\n lstatSync,\n readdir: readdirCB,\n readdirSync,\n readlinkSync,\n realpathSync,\n promises: {\n lstat,\n readdir,\n readlink,\n realpath,\n },\n}\n\n// if they just gave us require('fs') then use our default\nconst fsFromOption = (fsOption?: FSOption): FSValue =>\n !fsOption || fsOption === defaultFS || fsOption === actualFS ?\n defaultFS\n : {\n ...defaultFS,\n ...fsOption,\n promises: {\n ...defaultFS.promises,\n ...(fsOption.promises || {}),\n },\n }\n\n// turn something like //?/c:/ into c:\\\nconst uncDriveRegexp = /^\\\\\\\\\\?\\\\([a-z]:)\\\\?$/i\nconst uncToDrive = (rootPath: string): string =>\n rootPath.replace(/\\//g, '\\\\').replace(uncDriveRegexp, '$1\\\\')\n\n// windows paths are separated by either / or \\\nconst eitherSep = /[\\\\\\/]/\n\nconst UNKNOWN = 0 // may not even exist, for all we know\nconst IFIFO = 0b0001\nconst IFCHR = 0b0010\nconst IFDIR = 0b0100\nconst IFBLK = 0b0110\nconst IFREG = 0b1000\nconst IFLNK = 0b1010\nconst IFSOCK = 0b1100\nconst IFMT = 0b1111\n\nexport type Type =\n | 'Unknown'\n | 'FIFO'\n | 'CharacterDevice'\n | 'Directory'\n | 'BlockDevice'\n | 'File'\n | 'SymbolicLink'\n | 'Socket'\n\n// mask to unset low 4 bits\nconst IFMT_UNKNOWN = ~IFMT\n\n// set after successfully calling readdir() and getting entries.\nconst READDIR_CALLED = 0b0000_0001_0000\n// set after a successful lstat()\nconst LSTAT_CALLED = 0b0000_0010_0000\n// set if an entry (or one of its parents) is definitely not a dir\nconst ENOTDIR = 0b0000_0100_0000\n// set if an entry (or one of its parents) does not exist\n// (can also be set on lstat errors like EACCES or ENAMETOOLONG)\nconst ENOENT = 0b0000_1000_0000\n// cannot have child entries -- also verify &IFMT is either IFDIR or IFLNK\n// set if we fail to readlink\nconst ENOREADLINK = 0b0001_0000_0000\n// set if we know realpath() will fail\nconst ENOREALPATH = 0b0010_0000_0000\n\nconst ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH\nconst TYPEMASK = 0b0011_1111_1111\n\nconst entToType = (s: Dirent | Stats) =>\n s.isFile() ? IFREG\n : s.isDirectory() ? IFDIR\n : s.isSymbolicLink() ? IFLNK\n : s.isCharacterDevice() ? IFCHR\n : s.isBlockDevice() ? IFBLK\n : s.isSocket() ? IFSOCK\n : s.isFIFO() ? IFIFO\n : UNKNOWN\n\n// normalize unicode path names\nconst normalizeCache = new Map()\nconst normalize = (s: string) => {\n const c = normalizeCache.get(s)\n if (c) return c\n const n = s.normalize('NFKD')\n normalizeCache.set(s, n)\n return n\n}\n\nconst normalizeNocaseCache = new Map()\nconst normalizeNocase = (s: string) => {\n const c = normalizeNocaseCache.get(s)\n if (c) return c\n const n = normalize(s.toLowerCase())\n normalizeNocaseCache.set(s, n)\n return n\n}\n\n/**\n * Options that may be provided to the Path constructor\n */\nexport interface PathOpts {\n fullpath?: string\n relative?: string\n relativePosix?: string\n parent?: PathBase\n /**\n * See {@link FSOption}\n */\n fs?: FSOption\n}\n\n/**\n * An LRUCache for storing resolved path strings or Path objects.\n * @internal\n */\nexport class ResolveCache extends LRUCache {\n constructor() {\n super({ max: 256 })\n }\n}\n\n// In order to prevent blowing out the js heap by allocating hundreds of\n// thousands of Path entries when walking extremely large trees, the \"children\"\n// in this tree are represented by storing an array of Path entries in an\n// LRUCache, indexed by the parent. At any time, Path.children() may return an\n// empty array, indicating that it doesn't know about any of its children, and\n// thus has to rebuild that cache. This is fine, it just means that we don't\n// benefit as much from having the cached entries, but huge directory walks\n// don't blow out the stack, and smaller ones are still as fast as possible.\n//\n//It does impose some complexity when building up the readdir data, because we\n//need to pass a reference to the children array that we started with.\n\n/**\n * an LRUCache for storing child entries.\n * @internal\n */\nexport class ChildrenCache extends LRUCache {\n constructor(maxSize: number = 16 * 1024) {\n super({\n maxSize,\n // parent + children\n sizeCalculation: a => a.length + 1,\n })\n }\n}\n\n/**\n * Array of Path objects, plus a marker indicating the first provisional entry\n *\n * @internal\n */\nexport type Children = PathBase[] & { provisional: number }\n\nconst setAsCwd = Symbol('PathScurry setAsCwd')\n\n/**\n * Path objects are sort of like a super-powered\n * {@link https://nodejs.org/docs/latest/api/fs.html#class-fsdirent fs.Dirent}\n *\n * Each one represents a single filesystem entry on disk, which may or may not\n * exist. It includes methods for reading various types of information via\n * lstat, readlink, and readdir, and caches all information to the greatest\n * degree possible.\n *\n * Note that fs operations that would normally throw will instead return an\n * \"empty\" value. This is in order to prevent excessive overhead from error\n * stack traces.\n */\nexport abstract class PathBase implements Dirent {\n /**\n * the basename of this path\n *\n * **Important**: *always* test the path name against any test string\n * usingthe {@link isNamed} method, and not by directly comparing this\n * string. Otherwise, unicode path strings that the system sees as identical\n * will not be properly treated as the same path, leading to incorrect\n * behavior and possible security issues.\n */\n name: string\n /**\n * the Path entry corresponding to the path root.\n *\n * @internal\n */\n root: PathBase\n /**\n * All roots found within the current PathScurry family\n *\n * @internal\n */\n roots: { [k: string]: PathBase }\n /**\n * a reference to the parent path, or undefined in the case of root entries\n *\n * @internal\n */\n parent?: PathBase\n /**\n * boolean indicating whether paths are compared case-insensitively\n * @internal\n */\n nocase: boolean\n\n /**\n * boolean indicating that this path is the current working directory\n * of the PathScurry collection that contains it.\n */\n isCWD: boolean = false\n\n /**\n * the string or regexp used to split paths. On posix, it is `'/'`, and on\n * windows it is a RegExp matching either `'/'` or `'\\\\'`\n */\n abstract splitSep: string | RegExp\n /**\n * The path separator string to use when joining paths\n */\n abstract sep: string\n\n // potential default fs override\n #fs: FSValue\n\n // Stats fields\n #dev?: number\n get dev() {\n return this.#dev\n }\n #mode?: number\n get mode() {\n return this.#mode\n }\n #nlink?: number\n get nlink() {\n return this.#nlink\n }\n #uid?: number\n get uid() {\n return this.#uid\n }\n #gid?: number\n get gid() {\n return this.#gid\n }\n #rdev?: number\n get rdev() {\n return this.#rdev\n }\n #blksize?: number\n get blksize() {\n return this.#blksize\n }\n #ino?: number\n get ino() {\n return this.#ino\n }\n #size?: number\n get size() {\n return this.#size\n }\n #blocks?: number\n get blocks() {\n return this.#blocks\n }\n #atimeMs?: number\n get atimeMs() {\n return this.#atimeMs\n }\n #mtimeMs?: number\n get mtimeMs() {\n return this.#mtimeMs\n }\n #ctimeMs?: number\n get ctimeMs() {\n return this.#ctimeMs\n }\n #birthtimeMs?: number\n get birthtimeMs() {\n return this.#birthtimeMs\n }\n #atime?: Date\n get atime() {\n return this.#atime\n }\n #mtime?: Date\n get mtime() {\n return this.#mtime\n }\n #ctime?: Date\n get ctime() {\n return this.#ctime\n }\n #birthtime?: Date\n get birthtime() {\n return this.#birthtime\n }\n\n #matchName: string\n #depth?: number\n #fullpath?: string\n #fullpathPosix?: string\n #relative?: string\n #relativePosix?: string\n #type: number\n #children: ChildrenCache\n #linkTarget?: PathBase\n #realpath?: PathBase\n\n /**\n * This property is for compatibility with the Dirent class as of\n * Node v20, where Dirent['parentPath'] refers to the path of the\n * directory that was passed to readdir. For root entries, it's the path\n * to the entry itself.\n */\n get parentPath(): string {\n return (this.parent || this).fullpath()\n }\n\n /**\n * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,\n * this property refers to the *parent* path, not the path object itself.\n */\n get path(): string {\n return this.parentPath\n }\n\n /**\n * Do not create new Path objects directly. They should always be accessed\n * via the PathScurry class or other methods on the Path class.\n *\n * @internal\n */\n constructor(\n name: string,\n type: number = UNKNOWN,\n root: PathBase | undefined,\n roots: { [k: string]: PathBase },\n nocase: boolean,\n children: ChildrenCache,\n opts: PathOpts,\n ) {\n this.name = name\n this.#matchName = nocase ? normalizeNocase(name) : normalize(name)\n this.#type = type & TYPEMASK\n this.nocase = nocase\n this.roots = roots\n this.root = root || this\n this.#children = children\n this.#fullpath = opts.fullpath\n this.#relative = opts.relative\n this.#relativePosix = opts.relativePosix\n this.parent = opts.parent\n if (this.parent) {\n this.#fs = this.parent.#fs\n } else {\n this.#fs = fsFromOption(opts.fs)\n }\n }\n\n /**\n * Returns the depth of the Path object from its root.\n *\n * For example, a path at `/foo/bar` would have a depth of 2.\n */\n depth(): number {\n if (this.#depth !== undefined) return this.#depth\n if (!this.parent) return (this.#depth = 0)\n return (this.#depth = this.parent.depth() + 1)\n }\n\n /**\n * @internal\n */\n abstract getRootString(path: string): string\n /**\n * @internal\n */\n abstract getRoot(rootPath: string): PathBase\n /**\n * @internal\n */\n abstract newChild(name: string, type?: number, opts?: PathOpts): PathBase\n\n /**\n * @internal\n */\n childrenCache() {\n return this.#children\n }\n\n /**\n * Get the Path object referenced by the string path, resolved from this Path\n */\n resolve(path?: string): PathBase {\n if (!path) {\n return this\n }\n const rootPath = this.getRootString(path)\n const dir = path.substring(rootPath.length)\n const dirParts = dir.split(this.splitSep)\n const result: PathBase =\n rootPath ?\n this.getRoot(rootPath).#resolveParts(dirParts)\n : this.#resolveParts(dirParts)\n return result\n }\n\n #resolveParts(dirParts: string[]) {\n let p: PathBase = this\n for (const part of dirParts) {\n p = p.child(part)\n }\n return p\n }\n\n /**\n * Returns the cached children Path objects, if still available. If they\n * have fallen out of the cache, then returns an empty array, and resets the\n * READDIR_CALLED bit, so that future calls to readdir() will require an fs\n * lookup.\n *\n * @internal\n */\n children(): Children {\n const cached = this.#children.get(this)\n if (cached) {\n return cached\n }\n const children: Children = Object.assign([], { provisional: 0 })\n this.#children.set(this, children)\n this.#type &= ~READDIR_CALLED\n return children\n }\n\n /**\n * Resolves a path portion and returns or creates the child Path.\n *\n * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is\n * `'..'`.\n *\n * This should not be called directly. If `pathPart` contains any path\n * separators, it will lead to unsafe undefined behavior.\n *\n * Use `Path.resolve()` instead.\n *\n * @internal\n */\n child(pathPart: string, opts?: PathOpts): PathBase {\n if (pathPart === '' || pathPart === '.') {\n return this\n }\n if (pathPart === '..') {\n return this.parent || this\n }\n\n // find the child\n const children = this.children()\n const name =\n this.nocase ? normalizeNocase(pathPart) : normalize(pathPart)\n for (const p of children) {\n if (p.#matchName === name) {\n return p\n }\n }\n\n // didn't find it, create provisional child, since it might not\n // actually exist. If we know the parent isn't a dir, then\n // in fact it CAN'T exist.\n const s = this.parent ? this.sep : ''\n const fullpath =\n this.#fullpath ? this.#fullpath + s + pathPart : undefined\n const pchild = this.newChild(pathPart, UNKNOWN, {\n ...opts,\n parent: this,\n fullpath,\n })\n\n if (!this.canReaddir()) {\n pchild.#type |= ENOENT\n }\n\n // don't have to update provisional, because if we have real children,\n // then provisional is set to children.length, otherwise a lower number\n children.push(pchild)\n return pchild\n }\n\n /**\n * The relative path from the cwd. If it does not share an ancestor with\n * the cwd, then this ends up being equivalent to the fullpath()\n */\n relative(): string {\n if (this.isCWD) return ''\n if (this.#relative !== undefined) {\n return this.#relative\n }\n const name = this.name\n const p = this.parent\n if (!p) {\n return (this.#relative = this.name)\n }\n const pv = p.relative()\n return pv + (!pv || !p.parent ? '' : this.sep) + name\n }\n\n /**\n * The relative path from the cwd, using / as the path separator.\n * If it does not share an ancestor with\n * the cwd, then this ends up being equivalent to the fullpathPosix()\n * On posix systems, this is identical to relative().\n */\n relativePosix(): string {\n if (this.sep === '/') return this.relative()\n if (this.isCWD) return ''\n if (this.#relativePosix !== undefined) return this.#relativePosix\n const name = this.name\n const p = this.parent\n if (!p) {\n return (this.#relativePosix = this.fullpathPosix())\n }\n const pv = p.relativePosix()\n return pv + (!pv || !p.parent ? '' : '/') + name\n }\n\n /**\n * The fully resolved path string for this Path entry\n */\n fullpath(): string {\n if (this.#fullpath !== undefined) {\n return this.#fullpath\n }\n const name = this.name\n const p = this.parent\n if (!p) {\n return (this.#fullpath = this.name)\n }\n const pv = p.fullpath()\n const fp = pv + (!p.parent ? '' : this.sep) + name\n return (this.#fullpath = fp)\n }\n\n /**\n * On platforms other than windows, this is identical to fullpath.\n *\n * On windows, this is overridden to return the forward-slash form of the\n * full UNC path.\n */\n fullpathPosix(): string {\n if (this.#fullpathPosix !== undefined) return this.#fullpathPosix\n if (this.sep === '/') return (this.#fullpathPosix = this.fullpath())\n if (!this.parent) {\n const p = this.fullpath().replace(/\\\\/g, '/')\n if (/^[a-z]:\\//i.test(p)) {\n return (this.#fullpathPosix = `//?/${p}`)\n } else {\n return (this.#fullpathPosix = p)\n }\n }\n const p = this.parent\n const pfpp = p.fullpathPosix()\n const fpp = pfpp + (!pfpp || !p.parent ? '' : '/') + this.name\n return (this.#fullpathPosix = fpp)\n }\n\n /**\n * Is the Path of an unknown type?\n *\n * Note that we might know *something* about it if there has been a previous\n * filesystem operation, for example that it does not exist, or is not a\n * link, or whether it has child entries.\n */\n isUnknown(): boolean {\n return (this.#type & IFMT) === UNKNOWN\n }\n\n isType(type: Type): boolean {\n return this[`is${type}`]()\n }\n\n getType(): Type {\n return (\n this.isUnknown() ? 'Unknown'\n : this.isDirectory() ? 'Directory'\n : this.isFile() ? 'File'\n : this.isSymbolicLink() ? 'SymbolicLink'\n : this.isFIFO() ? 'FIFO'\n : this.isCharacterDevice() ? 'CharacterDevice'\n : this.isBlockDevice() ? 'BlockDevice'\n : /* c8 ignore start */ this.isSocket() ? 'Socket'\n : 'Unknown'\n )\n /* c8 ignore stop */\n }\n\n /**\n * Is the Path a regular file?\n */\n isFile(): boolean {\n return (this.#type & IFMT) === IFREG\n }\n\n /**\n * Is the Path a directory?\n */\n isDirectory(): boolean {\n return (this.#type & IFMT) === IFDIR\n }\n\n /**\n * Is the path a character device?\n */\n isCharacterDevice(): boolean {\n return (this.#type & IFMT) === IFCHR\n }\n\n /**\n * Is the path a block device?\n */\n isBlockDevice(): boolean {\n return (this.#type & IFMT) === IFBLK\n }\n\n /**\n * Is the path a FIFO pipe?\n */\n isFIFO(): boolean {\n return (this.#type & IFMT) === IFIFO\n }\n\n /**\n * Is the path a socket?\n */\n isSocket(): boolean {\n return (this.#type & IFMT) === IFSOCK\n }\n\n /**\n * Is the path a symbolic link?\n */\n isSymbolicLink(): boolean {\n return (this.#type & IFLNK) === IFLNK\n }\n\n /**\n * Return the entry if it has been subject of a successful lstat, or\n * undefined otherwise.\n *\n * Does not read the filesystem, so an undefined result *could* simply\n * mean that we haven't called lstat on it.\n */\n lstatCached(): PathBase | undefined {\n return this.#type & LSTAT_CALLED ? this : undefined\n }\n\n /**\n * Return the cached link target if the entry has been the subject of a\n * successful readlink, or undefined otherwise.\n *\n * Does not read the filesystem, so an undefined result *could* just mean we\n * don't have any cached data. Only use it if you are very sure that a\n * readlink() has been called at some point.\n */\n readlinkCached(): PathBase | undefined {\n return this.#linkTarget\n }\n\n /**\n * Returns the cached realpath target if the entry has been the subject\n * of a successful realpath, or undefined otherwise.\n *\n * Does not read the filesystem, so an undefined result *could* just mean we\n * don't have any cached data. Only use it if you are very sure that a\n * realpath() has been called at some point.\n */\n realpathCached(): PathBase | undefined {\n return this.#realpath\n }\n\n /**\n * Returns the cached child Path entries array if the entry has been the\n * subject of a successful readdir(), or [] otherwise.\n *\n * Does not read the filesystem, so an empty array *could* just mean we\n * don't have any cached data. Only use it if you are very sure that a\n * readdir() has been called recently enough to still be valid.\n */\n readdirCached(): PathBase[] {\n const children = this.children()\n return children.slice(0, children.provisional)\n }\n\n /**\n * Return true if it's worth trying to readlink. Ie, we don't (yet) have\n * any indication that readlink will definitely fail.\n *\n * Returns false if the path is known to not be a symlink, if a previous\n * readlink failed, or if the entry does not exist.\n */\n canReadlink(): boolean {\n if (this.#linkTarget) return true\n if (!this.parent) return false\n // cases where it cannot possibly succeed\n const ifmt = this.#type & IFMT\n return !(\n (ifmt !== UNKNOWN && ifmt !== IFLNK) ||\n this.#type & ENOREADLINK ||\n this.#type & ENOENT\n )\n }\n\n /**\n * Return true if readdir has previously been successfully called on this\n * path, indicating that cachedReaddir() is likely valid.\n */\n calledReaddir(): boolean {\n return !!(this.#type & READDIR_CALLED)\n }\n\n /**\n * Returns true if the path is known to not exist. That is, a previous lstat\n * or readdir failed to verify its existence when that would have been\n * expected, or a parent entry was marked either enoent or enotdir.\n */\n isENOENT(): boolean {\n return !!(this.#type & ENOENT)\n }\n\n /**\n * Return true if the path is a match for the given path name. This handles\n * case sensitivity and unicode normalization.\n *\n * Note: even on case-sensitive systems, it is **not** safe to test the\n * equality of the `.name` property to determine whether a given pathname\n * matches, due to unicode normalization mismatches.\n *\n * Always use this method instead of testing the `path.name` property\n * directly.\n */\n isNamed(n: string): boolean {\n return !this.nocase ?\n this.#matchName === normalize(n)\n : this.#matchName === normalizeNocase(n)\n }\n\n /**\n * Return the Path object corresponding to the target of a symbolic link.\n *\n * If the Path is not a symbolic link, or if the readlink call fails for any\n * reason, `undefined` is returned.\n *\n * Result is cached, and thus may be outdated if the filesystem is mutated.\n */\n async readlink(): Promise {\n const target = this.#linkTarget\n if (target) {\n return target\n }\n if (!this.canReadlink()) {\n return undefined\n }\n /* c8 ignore start */\n // already covered by the canReadlink test, here for ts grumples\n if (!this.parent) {\n return undefined\n }\n /* c8 ignore stop */\n try {\n const read = await this.#fs.promises.readlink(this.fullpath())\n const linkTarget = (await this.parent.realpath())?.resolve(read)\n if (linkTarget) {\n return (this.#linkTarget = linkTarget)\n }\n } catch (er) {\n this.#readlinkFail((er as NodeJS.ErrnoException).code)\n return undefined\n }\n }\n\n /**\n * Synchronous {@link PathBase.readlink}\n */\n readlinkSync(): PathBase | undefined {\n const target = this.#linkTarget\n if (target) {\n return target\n }\n if (!this.canReadlink()) {\n return undefined\n }\n /* c8 ignore start */\n // already covered by the canReadlink test, here for ts grumples\n if (!this.parent) {\n return undefined\n }\n /* c8 ignore stop */\n try {\n const read = this.#fs.readlinkSync(this.fullpath())\n const linkTarget = this.parent.realpathSync()?.resolve(read)\n if (linkTarget) {\n return (this.#linkTarget = linkTarget)\n }\n } catch (er) {\n this.#readlinkFail((er as NodeJS.ErrnoException).code)\n return undefined\n }\n }\n\n #readdirSuccess(children: Children) {\n // succeeded, mark readdir called bit\n this.#type |= READDIR_CALLED\n // mark all remaining provisional children as ENOENT\n for (let p = children.provisional; p < children.length; p++) {\n const c = children[p]\n if (c) c.#markENOENT()\n }\n }\n\n #markENOENT() {\n // mark as UNKNOWN and ENOENT\n if (this.#type & ENOENT) return\n this.#type = (this.#type | ENOENT) & IFMT_UNKNOWN\n this.#markChildrenENOENT()\n }\n\n #markChildrenENOENT() {\n // all children are provisional and do not exist\n const children = this.children()\n children.provisional = 0\n for (const p of children) {\n p.#markENOENT()\n }\n }\n\n #markENOREALPATH() {\n this.#type |= ENOREALPATH\n this.#markENOTDIR()\n }\n\n // save the information when we know the entry is not a dir\n #markENOTDIR() {\n // entry is not a directory, so any children can't exist.\n // this *should* be impossible, since any children created\n // after it's been marked ENOTDIR should be marked ENOENT,\n // so it won't even get to this point.\n /* c8 ignore start */\n if (this.#type & ENOTDIR) return\n /* c8 ignore stop */\n let t = this.#type\n // this could happen if we stat a dir, then delete it,\n // then try to read it or one of its children.\n if ((t & IFMT) === IFDIR) t &= IFMT_UNKNOWN\n this.#type = t | ENOTDIR\n this.#markChildrenENOENT()\n }\n\n #readdirFail(code: string = '') {\n // markENOTDIR and markENOENT also set provisional=0\n if (code === 'ENOTDIR' || code === 'EPERM') {\n this.#markENOTDIR()\n } else if (code === 'ENOENT') {\n this.#markENOENT()\n } else {\n this.children().provisional = 0\n }\n }\n\n #lstatFail(code: string = '') {\n // Windows just raises ENOENT in this case, disable for win CI\n /* c8 ignore start */\n if (code === 'ENOTDIR') {\n // already know it has a parent by this point\n const p = this.parent as PathBase\n p.#markENOTDIR()\n } else if (code === 'ENOENT') {\n /* c8 ignore stop */\n this.#markENOENT()\n }\n }\n\n #readlinkFail(code: string = '') {\n let ter = this.#type\n ter |= ENOREADLINK\n if (code === 'ENOENT') ter |= ENOENT\n // windows gets a weird error when you try to readlink a file\n if (code === 'EINVAL' || code === 'UNKNOWN') {\n // exists, but not a symlink, we don't know WHAT it is, so remove\n // all IFMT bits.\n ter &= IFMT_UNKNOWN\n }\n this.#type = ter\n // windows just gets ENOENT in this case. We do cover the case,\n // just disabled because it's impossible on Windows CI\n /* c8 ignore start */\n if (code === 'ENOTDIR' && this.parent) {\n this.parent.#markENOTDIR()\n }\n /* c8 ignore stop */\n }\n\n #readdirAddChild(e: Dirent, c: Children) {\n return (\n this.#readdirMaybePromoteChild(e, c) ||\n this.#readdirAddNewChild(e, c)\n )\n }\n\n #readdirAddNewChild(e: Dirent, c: Children): PathBase {\n // alloc new entry at head, so it's never provisional\n const type = entToType(e)\n const child = this.newChild(e.name, type, { parent: this })\n const ifmt = child.#type & IFMT\n if (ifmt !== IFDIR && ifmt !== IFLNK && ifmt !== UNKNOWN) {\n child.#type |= ENOTDIR\n }\n c.unshift(child)\n c.provisional++\n return child\n }\n\n #readdirMaybePromoteChild(e: Dirent, c: Children): PathBase | undefined {\n for (let p = c.provisional; p < c.length; p++) {\n const pchild = c[p]\n const name =\n this.nocase ? normalizeNocase(e.name) : normalize(e.name)\n if (name !== pchild!.#matchName) {\n continue\n }\n\n return this.#readdirPromoteChild(e, pchild!, p, c)\n }\n }\n\n #readdirPromoteChild(\n e: Dirent,\n p: PathBase,\n index: number,\n c: Children,\n ): PathBase {\n const v = p.name\n // retain any other flags, but set ifmt from dirent\n p.#type = (p.#type & IFMT_UNKNOWN) | entToType(e)\n // case sensitivity fixing when we learn the true name.\n if (v !== e.name) p.name = e.name\n\n // just advance provisional index (potentially off the list),\n // otherwise we have to splice/pop it out and re-insert at head\n if (index !== c.provisional) {\n if (index === c.length - 1) c.pop()\n else c.splice(index, 1)\n c.unshift(p)\n }\n c.provisional++\n return p\n }\n\n /**\n * Call lstat() on this Path, and update all known information that can be\n * determined.\n *\n * Note that unlike `fs.lstat()`, the returned value does not contain some\n * information, such as `mode`, `dev`, `nlink`, and `ino`. If that\n * information is required, you will need to call `fs.lstat` yourself.\n *\n * If the Path refers to a nonexistent file, or if the lstat call fails for\n * any reason, `undefined` is returned. Otherwise the updated Path object is\n * returned.\n *\n * Results are cached, and thus may be out of date if the filesystem is\n * mutated.\n */\n async lstat(): Promise {\n if ((this.#type & ENOENT) === 0) {\n try {\n this.#applyStat(await this.#fs.promises.lstat(this.fullpath()))\n return this\n } catch (er) {\n this.#lstatFail((er as NodeJS.ErrnoException).code)\n }\n }\n }\n\n /**\n * synchronous {@link PathBase.lstat}\n */\n lstatSync(): PathBase | undefined {\n if ((this.#type & ENOENT) === 0) {\n try {\n this.#applyStat(this.#fs.lstatSync(this.fullpath()))\n return this\n } catch (er) {\n this.#lstatFail((er as NodeJS.ErrnoException).code)\n }\n }\n }\n\n #applyStat(st: Stats) {\n const {\n atime,\n atimeMs,\n birthtime,\n birthtimeMs,\n blksize,\n blocks,\n ctime,\n ctimeMs,\n dev,\n gid,\n ino,\n mode,\n mtime,\n mtimeMs,\n nlink,\n rdev,\n size,\n uid,\n } = st\n this.#atime = atime\n this.#atimeMs = atimeMs\n this.#birthtime = birthtime\n this.#birthtimeMs = birthtimeMs\n this.#blksize = blksize\n this.#blocks = blocks\n this.#ctime = ctime\n this.#ctimeMs = ctimeMs\n this.#dev = dev\n this.#gid = gid\n this.#ino = ino\n this.#mode = mode\n this.#mtime = mtime\n this.#mtimeMs = mtimeMs\n this.#nlink = nlink\n this.#rdev = rdev\n this.#size = size\n this.#uid = uid\n const ifmt = entToType(st)\n // retain any other flags, but set the ifmt\n this.#type = (this.#type & IFMT_UNKNOWN) | ifmt | LSTAT_CALLED\n if (ifmt !== UNKNOWN && ifmt !== IFDIR && ifmt !== IFLNK) {\n this.#type |= ENOTDIR\n }\n }\n\n #onReaddirCB: ((\n er: NodeJS.ErrnoException | null,\n entries: Path[],\n ) => any)[] = []\n #readdirCBInFlight: boolean = false\n #callOnReaddirCB(children: Path[]) {\n this.#readdirCBInFlight = false\n const cbs = this.#onReaddirCB.slice()\n this.#onReaddirCB.length = 0\n cbs.forEach(cb => cb(null, children))\n }\n\n /**\n * Standard node-style callback interface to get list of directory entries.\n *\n * If the Path cannot or does not contain any children, then an empty array\n * is returned.\n *\n * Results are cached, and thus may be out of date if the filesystem is\n * mutated.\n *\n * @param cb The callback called with (er, entries). Note that the `er`\n * param is somewhat extraneous, as all readdir() errors are handled and\n * simply result in an empty set of entries being returned.\n * @param allowZalgo Boolean indicating that immediately known results should\n * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release\n * zalgo at your peril, the dark pony lord is devious and unforgiving.\n */\n readdirCB(\n cb: (er: NodeJS.ErrnoException | null, entries: PathBase[]) => any,\n allowZalgo: boolean = false,\n ): void {\n if (!this.canReaddir()) {\n if (allowZalgo) cb(null, [])\n else queueMicrotask(() => cb(null, []))\n return\n }\n\n const children = this.children()\n if (this.calledReaddir()) {\n const c = children.slice(0, children.provisional)\n if (allowZalgo) cb(null, c)\n else queueMicrotask(() => cb(null, c))\n return\n }\n\n // don't have to worry about zalgo at this point.\n this.#onReaddirCB.push(cb)\n if (this.#readdirCBInFlight) {\n return\n }\n this.#readdirCBInFlight = true\n\n // else read the directory, fill up children\n // de-provisionalize any provisional children.\n const fullpath = this.fullpath()\n this.#fs.readdir(fullpath, { withFileTypes: true }, (er, entries) => {\n if (er) {\n this.#readdirFail((er as NodeJS.ErrnoException).code)\n children.provisional = 0\n } else {\n // if we didn't get an error, we always get entries.\n //@ts-ignore\n for (const e of entries) {\n this.#readdirAddChild(e, children)\n }\n this.#readdirSuccess(children)\n }\n this.#callOnReaddirCB(children.slice(0, children.provisional))\n return\n })\n }\n\n #asyncReaddirInFlight?: Promise\n\n /**\n * Return an array of known child entries.\n *\n * If the Path cannot or does not contain any children, then an empty array\n * is returned.\n *\n * Results are cached, and thus may be out of date if the filesystem is\n * mutated.\n */\n async readdir(): Promise {\n if (!this.canReaddir()) {\n return []\n }\n\n const children = this.children()\n if (this.calledReaddir()) {\n return children.slice(0, children.provisional)\n }\n\n // else read the directory, fill up children\n // de-provisionalize any provisional children.\n const fullpath = this.fullpath()\n if (this.#asyncReaddirInFlight) {\n await this.#asyncReaddirInFlight\n } else {\n /* c8 ignore start */\n let resolve: () => void = () => {}\n /* c8 ignore stop */\n this.#asyncReaddirInFlight = new Promise(\n res => (resolve = res),\n )\n try {\n for (const e of await this.#fs.promises.readdir(fullpath, {\n withFileTypes: true,\n })) {\n this.#readdirAddChild(e, children)\n }\n this.#readdirSuccess(children)\n } catch (er) {\n this.#readdirFail((er as NodeJS.ErrnoException).code)\n children.provisional = 0\n }\n this.#asyncReaddirInFlight = undefined\n resolve()\n }\n return children.slice(0, children.provisional)\n }\n\n /**\n * synchronous {@link PathBase.readdir}\n */\n readdirSync(): PathBase[] {\n if (!this.canReaddir()) {\n return []\n }\n\n const children = this.children()\n if (this.calledReaddir()) {\n return children.slice(0, children.provisional)\n }\n\n // else read the directory, fill up children\n // de-provisionalize any provisional children.\n const fullpath = this.fullpath()\n try {\n for (const e of this.#fs.readdirSync(fullpath, {\n withFileTypes: true,\n })) {\n this.#readdirAddChild(e, children)\n }\n this.#readdirSuccess(children)\n } catch (er) {\n this.#readdirFail((er as NodeJS.ErrnoException).code)\n children.provisional = 0\n }\n return children.slice(0, children.provisional)\n }\n\n canReaddir() {\n if (this.#type & ENOCHILD) return false\n const ifmt = IFMT & this.#type\n // we always set ENOTDIR when setting IFMT, so should be impossible\n /* c8 ignore start */\n if (!(ifmt === UNKNOWN || ifmt === IFDIR || ifmt === IFLNK)) {\n return false\n }\n /* c8 ignore stop */\n return true\n }\n\n shouldWalk(\n dirs: Set,\n walkFilter?: (e: PathBase) => boolean,\n ): boolean {\n return (\n (this.#type & IFDIR) === IFDIR &&\n !(this.#type & ENOCHILD) &&\n !dirs.has(this) &&\n (!walkFilter || walkFilter(this))\n )\n }\n\n /**\n * Return the Path object corresponding to path as resolved\n * by realpath(3).\n *\n * If the realpath call fails for any reason, `undefined` is returned.\n *\n * Result is cached, and thus may be outdated if the filesystem is mutated.\n * On success, returns a Path object.\n */\n async realpath(): Promise {\n if (this.#realpath) return this.#realpath\n if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type) return undefined\n try {\n const rp = await this.#fs.promises.realpath(this.fullpath())\n return (this.#realpath = this.resolve(rp))\n } catch (_) {\n this.#markENOREALPATH()\n }\n }\n\n /**\n * Synchronous {@link realpath}\n */\n realpathSync(): PathBase | undefined {\n if (this.#realpath) return this.#realpath\n if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type) return undefined\n try {\n const rp = this.#fs.realpathSync(this.fullpath())\n return (this.#realpath = this.resolve(rp))\n } catch (_) {\n this.#markENOREALPATH()\n }\n }\n\n /**\n * Internal method to mark this Path object as the scurry cwd,\n * called by {@link PathScurry#chdir}\n *\n * @internal\n */\n [setAsCwd](oldCwd: PathBase): void {\n if (oldCwd === this) return\n oldCwd.isCWD = false\n this.isCWD = true\n\n const changed = new Set([])\n let rp = []\n let p: PathBase = this\n while (p && p.parent) {\n changed.add(p)\n p.#relative = rp.join(this.sep)\n p.#relativePosix = rp.join('/')\n p = p.parent\n rp.push('..')\n }\n // now un-memoize parents of old cwd\n p = oldCwd\n while (p && p.parent && !changed.has(p)) {\n p.#relative = undefined\n p.#relativePosix = undefined\n p = p.parent\n }\n }\n}\n\n/**\n * Path class used on win32 systems\n *\n * Uses `'\\\\'` as the path separator for returned paths, either `'\\\\'` or `'/'`\n * as the path separator for parsing paths.\n */\nexport class PathWin32 extends PathBase {\n /**\n * Separator for generating path strings.\n */\n sep: '\\\\' = '\\\\'\n /**\n * Separator for parsing path strings.\n */\n splitSep: RegExp = eitherSep\n\n /**\n * Do not create new Path objects directly. They should always be accessed\n * via the PathScurry class or other methods on the Path class.\n *\n * @internal\n */\n constructor(\n name: string,\n type: number = UNKNOWN,\n root: PathBase | undefined,\n roots: { [k: string]: PathBase },\n nocase: boolean,\n children: ChildrenCache,\n opts: PathOpts,\n ) {\n super(name, type, root, roots, nocase, children, opts)\n }\n\n /**\n * @internal\n */\n newChild(name: string, type: number = UNKNOWN, opts: PathOpts = {}) {\n return new PathWin32(\n name,\n type,\n this.root,\n this.roots,\n this.nocase,\n this.childrenCache(),\n opts,\n )\n }\n\n /**\n * @internal\n */\n getRootString(path: string): string {\n return win32.parse(path).root\n }\n\n /**\n * @internal\n */\n getRoot(rootPath: string): PathBase {\n rootPath = uncToDrive(rootPath.toUpperCase())\n if (rootPath === this.root.name) {\n return this.root\n }\n // ok, not that one, check if it matches another we know about\n for (const [compare, root] of Object.entries(this.roots)) {\n if (this.sameRoot(rootPath, compare)) {\n return (this.roots[rootPath] = root)\n }\n }\n // otherwise, have to create a new one.\n return (this.roots[rootPath] = new PathScurryWin32(\n rootPath,\n this,\n ).root)\n }\n\n /**\n * @internal\n */\n sameRoot(rootPath: string, compare: string = this.root.name): boolean {\n // windows can (rarely) have case-sensitive filesystem, but\n // UNC and drive letters are always case-insensitive, and canonically\n // represented uppercase.\n rootPath = rootPath\n .toUpperCase()\n .replace(/\\//g, '\\\\')\n .replace(uncDriveRegexp, '$1\\\\')\n return rootPath === compare\n }\n}\n\n/**\n * Path class used on all posix systems.\n *\n * Uses `'/'` as the path separator.\n */\nexport class PathPosix extends PathBase {\n /**\n * separator for parsing path strings\n */\n splitSep: '/' = '/'\n /**\n * separator for generating path strings\n */\n sep: '/' = '/'\n\n /**\n * Do not create new Path objects directly. They should always be accessed\n * via the PathScurry class or other methods on the Path class.\n *\n * @internal\n */\n constructor(\n name: string,\n type: number = UNKNOWN,\n root: PathBase | undefined,\n roots: { [k: string]: PathBase },\n nocase: boolean,\n children: ChildrenCache,\n opts: PathOpts,\n ) {\n super(name, type, root, roots, nocase, children, opts)\n }\n\n /**\n * @internal\n */\n getRootString(path: string): string {\n return path.startsWith('/') ? '/' : ''\n }\n\n /**\n * @internal\n */\n getRoot(_rootPath: string): PathBase {\n return this.root\n }\n\n /**\n * @internal\n */\n newChild(name: string, type: number = UNKNOWN, opts: PathOpts = {}) {\n return new PathPosix(\n name,\n type,\n this.root,\n this.roots,\n this.nocase,\n this.childrenCache(),\n opts,\n )\n }\n}\n\n/**\n * Options that may be provided to the PathScurry constructor\n */\nexport interface PathScurryOpts {\n /**\n * perform case-insensitive path matching. Default based on platform\n * subclass.\n */\n nocase?: boolean\n /**\n * Number of Path entries to keep in the cache of Path child references.\n *\n * Setting this higher than 65536 will dramatically increase the data\n * consumption and construction time overhead of each PathScurry.\n *\n * Setting this value to 256 or lower will significantly reduce the data\n * consumption and construction time overhead, but may also reduce resolve()\n * and readdir() performance on large filesystems.\n *\n * Default `16384`.\n */\n childrenCacheSize?: number\n /**\n * An object that overrides the built-in functions from the fs and\n * fs/promises modules.\n *\n * See {@link FSOption}\n */\n fs?: FSOption\n}\n\n/**\n * The base class for all PathScurry classes, providing the interface for path\n * resolution and filesystem operations.\n *\n * Typically, you should *not* instantiate this class directly, but rather one\n * of the platform-specific classes, or the exported {@link PathScurry} which\n * defaults to the current platform.\n */\nexport abstract class PathScurryBase {\n /**\n * The root Path entry for the current working directory of this Scurry\n */\n root: PathBase\n /**\n * The string path for the root of this Scurry's current working directory\n */\n rootPath: string\n /**\n * A collection of all roots encountered, referenced by rootPath\n */\n roots: { [k: string]: PathBase }\n /**\n * The Path entry corresponding to this PathScurry's current working directory.\n */\n cwd: PathBase\n #resolveCache: ResolveCache\n #resolvePosixCache: ResolveCache\n #children: ChildrenCache\n /**\n * Perform path comparisons case-insensitively.\n *\n * Defaults true on Darwin and Windows systems, false elsewhere.\n */\n nocase: boolean\n\n /**\n * The path separator used for parsing paths\n *\n * `'/'` on Posix systems, either `'/'` or `'\\\\'` on Windows\n */\n abstract sep: string | RegExp\n\n #fs: FSValue\n\n /**\n * This class should not be instantiated directly.\n *\n * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry\n *\n * @internal\n */\n constructor(\n cwd: URL | string = process.cwd(),\n pathImpl: typeof win32 | typeof posix,\n sep: string | RegExp,\n {\n nocase,\n childrenCacheSize = 16 * 1024,\n fs = defaultFS,\n }: PathScurryOpts = {},\n ) {\n this.#fs = fsFromOption(fs)\n if (cwd instanceof URL || cwd.startsWith('file://')) {\n cwd = fileURLToPath(cwd)\n }\n // resolve and split root, and then add to the store.\n // this is the only time we call path.resolve()\n const cwdPath = pathImpl.resolve(cwd)\n this.roots = Object.create(null)\n this.rootPath = this.parseRootPath(cwdPath)\n this.#resolveCache = new ResolveCache()\n this.#resolvePosixCache = new ResolveCache()\n this.#children = new ChildrenCache(childrenCacheSize)\n\n const split = cwdPath.substring(this.rootPath.length).split(sep)\n // resolve('/') leaves '', splits to [''], we don't want that.\n if (split.length === 1 && !split[0]) {\n split.pop()\n }\n /* c8 ignore start */\n if (nocase === undefined) {\n throw new TypeError(\n 'must provide nocase setting to PathScurryBase ctor',\n )\n }\n /* c8 ignore stop */\n this.nocase = nocase\n this.root = this.newRoot(this.#fs)\n this.roots[this.rootPath] = this.root\n let prev: PathBase = this.root\n let len = split.length - 1\n const joinSep = pathImpl.sep\n let abs = this.rootPath\n let sawFirst = false\n for (const part of split) {\n const l = len--\n prev = prev.child(part, {\n relative: new Array(l).fill('..').join(joinSep),\n relativePosix: new Array(l).fill('..').join('/'),\n fullpath: (abs += (sawFirst ? '' : joinSep) + part),\n })\n sawFirst = true\n }\n this.cwd = prev\n }\n\n /**\n * Get the depth of a provided path, string, or the cwd\n */\n depth(path: Path | string = this.cwd): number {\n if (typeof path === 'string') {\n path = this.cwd.resolve(path)\n }\n return path.depth()\n }\n\n /**\n * Parse the root portion of a path string\n *\n * @internal\n */\n abstract parseRootPath(dir: string): string\n /**\n * create a new Path to use as root during construction.\n *\n * @internal\n */\n abstract newRoot(fs: FSValue): PathBase\n /**\n * Determine whether a given path string is absolute\n */\n abstract isAbsolute(p: string): boolean\n\n /**\n * Return the cache of child entries. Exposed so subclasses can create\n * child Path objects in a platform-specific way.\n *\n * @internal\n */\n childrenCache() {\n return this.#children\n }\n\n /**\n * Resolve one or more path strings to a resolved string\n *\n * Same interface as require('path').resolve.\n *\n * Much faster than path.resolve() when called multiple times for the same\n * path, because the resolved Path objects are cached. Much slower\n * otherwise.\n */\n resolve(...paths: string[]): string {\n // first figure out the minimum number of paths we have to test\n // we always start at cwd, but any absolutes will bump the start\n let r = ''\n for (let i = paths.length - 1; i >= 0; i--) {\n const p = paths[i]\n if (!p || p === '.') continue\n r = r ? `${p}/${r}` : p\n if (this.isAbsolute(p)) {\n break\n }\n }\n const cached = this.#resolveCache.get(r)\n if (cached !== undefined) {\n return cached\n }\n const result = this.cwd.resolve(r).fullpath()\n this.#resolveCache.set(r, result)\n return result\n }\n\n /**\n * Resolve one or more path strings to a resolved string, returning\n * the posix path. Identical to .resolve() on posix systems, but on\n * windows will return a forward-slash separated UNC path.\n *\n * Same interface as require('path').resolve.\n *\n * Much faster than path.resolve() when called multiple times for the same\n * path, because the resolved Path objects are cached. Much slower\n * otherwise.\n */\n resolvePosix(...paths: string[]): string {\n // first figure out the minimum number of paths we have to test\n // we always start at cwd, but any absolutes will bump the start\n let r = ''\n for (let i = paths.length - 1; i >= 0; i--) {\n const p = paths[i]\n if (!p || p === '.') continue\n r = r ? `${p}/${r}` : p\n if (this.isAbsolute(p)) {\n break\n }\n }\n const cached = this.#resolvePosixCache.get(r)\n if (cached !== undefined) {\n return cached\n }\n const result = this.cwd.resolve(r).fullpathPosix()\n this.#resolvePosixCache.set(r, result)\n return result\n }\n\n /**\n * find the relative path from the cwd to the supplied path string or entry\n */\n relative(entry: PathBase | string = this.cwd): string {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return entry.relative()\n }\n\n /**\n * find the relative path from the cwd to the supplied path string or\n * entry, using / as the path delimiter, even on Windows.\n */\n relativePosix(entry: PathBase | string = this.cwd): string {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return entry.relativePosix()\n }\n\n /**\n * Return the basename for the provided string or Path object\n */\n basename(entry: PathBase | string = this.cwd): string {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return entry.name\n }\n\n /**\n * Return the dirname for the provided string or Path object\n */\n dirname(entry: PathBase | string = this.cwd): string {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return (entry.parent || entry).fullpath()\n }\n\n /**\n * Return an array of known child entries.\n *\n * First argument may be either a string, or a Path object.\n *\n * If the Path cannot or does not contain any children, then an empty array\n * is returned.\n *\n * Results are cached, and thus may be out of date if the filesystem is\n * mutated.\n *\n * Unlike `fs.readdir()`, the `withFileTypes` option defaults to `true`. Set\n * `{ withFileTypes: false }` to return strings.\n */\n\n readdir(): Promise\n readdir(opts: { withFileTypes: true }): Promise\n readdir(opts: { withFileTypes: false }): Promise\n readdir(opts: { withFileTypes: boolean }): Promise\n readdir(entry: PathBase | string): Promise\n readdir(\n entry: PathBase | string,\n opts: { withFileTypes: true },\n ): Promise\n readdir(\n entry: PathBase | string,\n opts: { withFileTypes: false },\n ): Promise\n readdir(\n entry: PathBase | string,\n opts: { withFileTypes: boolean },\n ): Promise\n async readdir(\n entry: PathBase | string | { withFileTypes: boolean } = this.cwd,\n opts: { withFileTypes: boolean } = {\n withFileTypes: true,\n },\n ): Promise {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const { withFileTypes } = opts\n if (!entry.canReaddir()) {\n return []\n } else {\n const p = await entry.readdir()\n return withFileTypes ? p : p.map(e => e.name)\n }\n }\n\n /**\n * synchronous {@link PathScurryBase.readdir}\n */\n readdirSync(): PathBase[]\n readdirSync(opts: { withFileTypes: true }): PathBase[]\n readdirSync(opts: { withFileTypes: false }): string[]\n readdirSync(opts: { withFileTypes: boolean }): PathBase[] | string[]\n readdirSync(entry: PathBase | string): PathBase[]\n readdirSync(\n entry: PathBase | string,\n opts: { withFileTypes: true },\n ): PathBase[]\n readdirSync(\n entry: PathBase | string,\n opts: { withFileTypes: false },\n ): string[]\n readdirSync(\n entry: PathBase | string,\n opts: { withFileTypes: boolean },\n ): PathBase[] | string[]\n readdirSync(\n entry: PathBase | string | { withFileTypes: boolean } = this.cwd,\n opts: { withFileTypes: boolean } = {\n withFileTypes: true,\n },\n ): PathBase[] | string[] {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const { withFileTypes = true } = opts\n if (!entry.canReaddir()) {\n return []\n } else if (withFileTypes) {\n return entry.readdirSync()\n } else {\n return entry.readdirSync().map(e => e.name)\n }\n }\n\n /**\n * Call lstat() on the string or Path object, and update all known\n * information that can be determined.\n *\n * Note that unlike `fs.lstat()`, the returned value does not contain some\n * information, such as `mode`, `dev`, `nlink`, and `ino`. If that\n * information is required, you will need to call `fs.lstat` yourself.\n *\n * If the Path refers to a nonexistent file, or if the lstat call fails for\n * any reason, `undefined` is returned. Otherwise the updated Path object is\n * returned.\n *\n * Results are cached, and thus may be out of date if the filesystem is\n * mutated.\n */\n async lstat(\n entry: string | PathBase = this.cwd,\n ): Promise {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return entry.lstat()\n }\n\n /**\n * synchronous {@link PathScurryBase.lstat}\n */\n lstatSync(entry: string | PathBase = this.cwd): PathBase | undefined {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return entry.lstatSync()\n }\n\n /**\n * Return the Path object or string path corresponding to the target of a\n * symbolic link.\n *\n * If the path is not a symbolic link, or if the readlink call fails for any\n * reason, `undefined` is returned.\n *\n * Result is cached, and thus may be outdated if the filesystem is mutated.\n *\n * `{withFileTypes}` option defaults to `false`.\n *\n * On success, returns a Path object if `withFileTypes` option is true,\n * otherwise a string.\n */\n readlink(): Promise\n readlink(opt: { withFileTypes: false }): Promise\n readlink(opt: { withFileTypes: true }): Promise\n readlink(opt: {\n withFileTypes: boolean\n }): Promise\n readlink(\n entry: string | PathBase,\n opt?: { withFileTypes: false },\n ): Promise\n readlink(\n entry: string | PathBase,\n opt: { withFileTypes: true },\n ): Promise\n readlink(\n entry: string | PathBase,\n opt: { withFileTypes: boolean },\n ): Promise\n async readlink(\n entry: string | PathBase | { withFileTypes: boolean } = this.cwd,\n { withFileTypes }: { withFileTypes: boolean } = {\n withFileTypes: false,\n },\n ): Promise {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n withFileTypes = entry.withFileTypes\n entry = this.cwd\n }\n const e = await entry.readlink()\n return withFileTypes ? e : e?.fullpath()\n }\n\n /**\n * synchronous {@link PathScurryBase.readlink}\n */\n readlinkSync(): string | undefined\n readlinkSync(opt: { withFileTypes: false }): string | undefined\n readlinkSync(opt: { withFileTypes: true }): PathBase | undefined\n readlinkSync(opt: {\n withFileTypes: boolean\n }): PathBase | string | undefined\n readlinkSync(\n entry: string | PathBase,\n opt?: { withFileTypes: false },\n ): string | undefined\n readlinkSync(\n entry: string | PathBase,\n opt: { withFileTypes: true },\n ): PathBase | undefined\n readlinkSync(\n entry: string | PathBase,\n opt: { withFileTypes: boolean },\n ): string | PathBase | undefined\n readlinkSync(\n entry: string | PathBase | { withFileTypes: boolean } = this.cwd,\n { withFileTypes }: { withFileTypes: boolean } = {\n withFileTypes: false,\n },\n ): string | PathBase | undefined {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n withFileTypes = entry.withFileTypes\n entry = this.cwd\n }\n const e = entry.readlinkSync()\n return withFileTypes ? e : e?.fullpath()\n }\n\n /**\n * Return the Path object or string path corresponding to path as resolved\n * by realpath(3).\n *\n * If the realpath call fails for any reason, `undefined` is returned.\n *\n * Result is cached, and thus may be outdated if the filesystem is mutated.\n *\n * `{withFileTypes}` option defaults to `false`.\n *\n * On success, returns a Path object if `withFileTypes` option is true,\n * otherwise a string.\n */\n realpath(): Promise\n realpath(opt: { withFileTypes: false }): Promise\n realpath(opt: { withFileTypes: true }): Promise\n realpath(opt: {\n withFileTypes: boolean\n }): Promise\n realpath(\n entry: string | PathBase,\n opt?: { withFileTypes: false },\n ): Promise\n realpath(\n entry: string | PathBase,\n opt: { withFileTypes: true },\n ): Promise\n realpath(\n entry: string | PathBase,\n opt: { withFileTypes: boolean },\n ): Promise\n async realpath(\n entry: string | PathBase | { withFileTypes: boolean } = this.cwd,\n { withFileTypes }: { withFileTypes: boolean } = {\n withFileTypes: false,\n },\n ): Promise {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n withFileTypes = entry.withFileTypes\n entry = this.cwd\n }\n const e = await entry.realpath()\n return withFileTypes ? e : e?.fullpath()\n }\n\n realpathSync(): string | undefined\n realpathSync(opt: { withFileTypes: false }): string | undefined\n realpathSync(opt: { withFileTypes: true }): PathBase | undefined\n realpathSync(opt: {\n withFileTypes: boolean\n }): PathBase | string | undefined\n realpathSync(\n entry: string | PathBase,\n opt?: { withFileTypes: false },\n ): string | undefined\n realpathSync(\n entry: string | PathBase,\n opt: { withFileTypes: true },\n ): PathBase | undefined\n realpathSync(\n entry: string | PathBase,\n opt: { withFileTypes: boolean },\n ): string | PathBase | undefined\n realpathSync(\n entry: string | PathBase | { withFileTypes: boolean } = this.cwd,\n { withFileTypes }: { withFileTypes: boolean } = {\n withFileTypes: false,\n },\n ): string | PathBase | undefined {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n withFileTypes = entry.withFileTypes\n entry = this.cwd\n }\n const e = entry.realpathSync()\n return withFileTypes ? e : e?.fullpath()\n }\n\n /**\n * Asynchronously walk the directory tree, returning an array of\n * all path strings or Path objects found.\n *\n * Note that this will be extremely memory-hungry on large filesystems.\n * In such cases, it may be better to use the stream or async iterator\n * walk implementation.\n */\n walk(): Promise\n walk(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Promise\n walk(opts: WalkOptionsWithFileTypesFalse): Promise\n walk(opts: WalkOptions): Promise\n walk(entry: string | PathBase): Promise\n walk(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Promise\n walk(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): Promise\n walk(\n entry: string | PathBase,\n opts: WalkOptions,\n ): Promise\n async walk(\n entry: string | PathBase | WalkOptions = this.cwd,\n opts: WalkOptions = {},\n ): Promise {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const {\n withFileTypes = true,\n follow = false,\n filter,\n walkFilter,\n } = opts\n const results: (string | PathBase)[] = []\n if (!filter || filter(entry)) {\n results.push(withFileTypes ? entry : entry.fullpath())\n }\n const dirs = new Set()\n const walk = (\n dir: PathBase,\n cb: (er?: NodeJS.ErrnoException) => void,\n ) => {\n dirs.add(dir)\n dir.readdirCB((er, entries) => {\n /* c8 ignore start */\n if (er) {\n return cb(er)\n }\n /* c8 ignore stop */\n let len = entries.length\n if (!len) return cb()\n const next = () => {\n if (--len === 0) {\n cb()\n }\n }\n for (const e of entries) {\n if (!filter || filter(e)) {\n results.push(withFileTypes ? e : e.fullpath())\n }\n if (follow && e.isSymbolicLink()) {\n e.realpath()\n .then(r => (r?.isUnknown() ? r.lstat() : r))\n .then(r =>\n r?.shouldWalk(dirs, walkFilter) ? walk(r, next) : next(),\n )\n } else {\n if (e.shouldWalk(dirs, walkFilter)) {\n walk(e, next)\n } else {\n next()\n }\n }\n }\n }, true) // zalgooooooo\n }\n\n const start = entry\n return new Promise((res, rej) => {\n walk(start, er => {\n /* c8 ignore start */\n if (er) return rej(er)\n /* c8 ignore stop */\n res(results as PathBase[] | string[])\n })\n })\n }\n\n /**\n * Synchronously walk the directory tree, returning an array of\n * all path strings or Path objects found.\n *\n * Note that this will be extremely memory-hungry on large filesystems.\n * In such cases, it may be better to use the stream or async iterator\n * walk implementation.\n */\n walkSync(): PathBase[]\n walkSync(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): PathBase[]\n walkSync(opts: WalkOptionsWithFileTypesFalse): string[]\n walkSync(opts: WalkOptions): string[] | PathBase[]\n walkSync(entry: string | PathBase): PathBase[]\n walkSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue,\n ): PathBase[]\n walkSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): string[]\n walkSync(\n entry: string | PathBase,\n opts: WalkOptions,\n ): PathBase[] | string[]\n walkSync(\n entry: string | PathBase | WalkOptions = this.cwd,\n opts: WalkOptions = {},\n ): PathBase[] | string[] {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const {\n withFileTypes = true,\n follow = false,\n filter,\n walkFilter,\n } = opts\n const results: (string | PathBase)[] = []\n if (!filter || filter(entry)) {\n results.push(withFileTypes ? entry : entry.fullpath())\n }\n const dirs = new Set([entry])\n for (const dir of dirs) {\n const entries = dir.readdirSync()\n for (const e of entries) {\n if (!filter || filter(e)) {\n results.push(withFileTypes ? e : e.fullpath())\n }\n let r: PathBase | undefined = e\n if (e.isSymbolicLink()) {\n if (!(follow && (r = e.realpathSync()))) continue\n if (r.isUnknown()) r.lstatSync()\n }\n if (r.shouldWalk(dirs, walkFilter)) {\n dirs.add(r)\n }\n }\n }\n return results as string[] | PathBase[]\n }\n\n /**\n * Support for `for await`\n *\n * Alias for {@link PathScurryBase.iterate}\n *\n * Note: As of Node 19, this is very slow, compared to other methods of\n * walking. Consider using {@link PathScurryBase.stream} if memory overhead\n * and backpressure are concerns, or {@link PathScurryBase.walk} if not.\n */\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n\n /**\n * Async generator form of {@link PathScurryBase.walk}\n *\n * Note: As of Node 19, this is very slow, compared to other methods of\n * walking, especially if most/all of the directory tree has been previously\n * walked. Consider using {@link PathScurryBase.stream} if memory overhead\n * and backpressure are concerns, or {@link PathScurryBase.walk} if not.\n */\n iterate(): AsyncGenerator\n iterate(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): AsyncGenerator\n iterate(\n opts: WalkOptionsWithFileTypesFalse,\n ): AsyncGenerator\n iterate(opts: WalkOptions): AsyncGenerator\n iterate(entry: string | PathBase): AsyncGenerator\n iterate(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): AsyncGenerator\n iterate(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): AsyncGenerator\n iterate(\n entry: string | PathBase,\n opts: WalkOptions,\n ): AsyncGenerator\n iterate(\n entry: string | PathBase | WalkOptions = this.cwd,\n options: WalkOptions = {},\n ): AsyncGenerator {\n // iterating async over the stream is significantly more performant,\n // especially in the warm-cache scenario, because it buffers up directory\n // entries in the background instead of waiting for a yield for each one.\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n options = entry\n entry = this.cwd\n }\n return this.stream(entry, options)[Symbol.asyncIterator]()\n }\n\n /**\n * Iterating over a PathScurry performs a synchronous walk.\n *\n * Alias for {@link PathScurryBase.iterateSync}\n */\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n iterateSync(): Generator\n iterateSync(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Generator\n iterateSync(\n opts: WalkOptionsWithFileTypesFalse,\n ): Generator\n iterateSync(opts: WalkOptions): Generator\n iterateSync(entry: string | PathBase): Generator\n iterateSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Generator\n iterateSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): Generator\n iterateSync(\n entry: string | PathBase,\n opts: WalkOptions,\n ): Generator\n *iterateSync(\n entry: string | PathBase | WalkOptions = this.cwd,\n opts: WalkOptions = {},\n ): Generator {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const {\n withFileTypes = true,\n follow = false,\n filter,\n walkFilter,\n } = opts\n if (!filter || filter(entry)) {\n yield withFileTypes ? entry : entry.fullpath()\n }\n const dirs = new Set([entry])\n for (const dir of dirs) {\n const entries = dir.readdirSync()\n for (const e of entries) {\n if (!filter || filter(e)) {\n yield withFileTypes ? e : e.fullpath()\n }\n let r: PathBase | undefined = e\n if (e.isSymbolicLink()) {\n if (!(follow && (r = e.realpathSync()))) continue\n if (r.isUnknown()) r.lstatSync()\n }\n if (r.shouldWalk(dirs, walkFilter)) {\n dirs.add(r)\n }\n }\n }\n }\n\n /**\n * Stream form of {@link PathScurryBase.walk}\n *\n * Returns a Minipass stream that emits {@link PathBase} objects by default,\n * or strings if `{ withFileTypes: false }` is set in the options.\n */\n stream(): Minipass\n stream(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Minipass\n stream(opts: WalkOptionsWithFileTypesFalse): Minipass\n stream(opts: WalkOptions): Minipass\n stream(entry: string | PathBase): Minipass\n stream(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue,\n ): Minipass\n stream(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): Minipass\n stream(\n entry: string | PathBase,\n opts: WalkOptions,\n ): Minipass | Minipass\n stream(\n entry: string | PathBase | WalkOptions = this.cwd,\n opts: WalkOptions = {},\n ): Minipass | Minipass {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const {\n withFileTypes = true,\n follow = false,\n filter,\n walkFilter,\n } = opts\n const results = new Minipass({ objectMode: true })\n if (!filter || filter(entry)) {\n results.write(withFileTypes ? entry : entry.fullpath())\n }\n const dirs = new Set()\n const queue: PathBase[] = [entry]\n let processing = 0\n const process = () => {\n let paused = false\n while (!paused) {\n const dir = queue.shift()\n if (!dir) {\n if (processing === 0) results.end()\n return\n }\n\n processing++\n dirs.add(dir)\n\n const onReaddir = (\n er: null | NodeJS.ErrnoException,\n entries: PathBase[],\n didRealpaths: boolean = false,\n ) => {\n /* c8 ignore start */\n if (er) return results.emit('error', er)\n /* c8 ignore stop */\n if (follow && !didRealpaths) {\n const promises: Promise[] = []\n for (const e of entries) {\n if (e.isSymbolicLink()) {\n promises.push(\n e\n .realpath()\n .then((r: PathBase | undefined) =>\n r?.isUnknown() ? r.lstat() : r,\n ),\n )\n }\n }\n if (promises.length) {\n Promise.all(promises).then(() =>\n onReaddir(null, entries, true),\n )\n return\n }\n }\n\n for (const e of entries) {\n if (e && (!filter || filter(e))) {\n if (!results.write(withFileTypes ? e : e.fullpath())) {\n paused = true\n }\n }\n }\n\n processing--\n for (const e of entries) {\n const r = e.realpathCached() || e\n if (r.shouldWalk(dirs, walkFilter)) {\n queue.push(r)\n }\n }\n if (paused && !results.flowing) {\n results.once('drain', process)\n } else if (!sync) {\n process()\n }\n }\n\n // zalgo containment\n let sync = true\n dir.readdirCB(onReaddir, true)\n sync = false\n }\n }\n process()\n return results as Minipass | Minipass\n }\n\n /**\n * Synchronous form of {@link PathScurryBase.stream}\n *\n * Returns a Minipass stream that emits {@link PathBase} objects by default,\n * or strings if `{ withFileTypes: false }` is set in the options.\n *\n * Will complete the walk in a single tick if the stream is consumed fully.\n * Otherwise, will pause as needed for stream backpressure.\n */\n streamSync(): Minipass\n streamSync(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Minipass\n streamSync(opts: WalkOptionsWithFileTypesFalse): Minipass\n streamSync(opts: WalkOptions): Minipass\n streamSync(entry: string | PathBase): Minipass\n streamSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue,\n ): Minipass\n streamSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): Minipass\n streamSync(\n entry: string | PathBase,\n opts: WalkOptions,\n ): Minipass | Minipass\n streamSync(\n entry: string | PathBase | WalkOptions = this.cwd,\n opts: WalkOptions = {},\n ): Minipass | Minipass {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const {\n withFileTypes = true,\n follow = false,\n filter,\n walkFilter,\n } = opts\n const results = new Minipass({ objectMode: true })\n const dirs = new Set()\n if (!filter || filter(entry)) {\n results.write(withFileTypes ? entry : entry.fullpath())\n }\n const queue: PathBase[] = [entry]\n let processing = 0\n const process = () => {\n let paused = false\n while (!paused) {\n const dir = queue.shift()\n if (!dir) {\n if (processing === 0) results.end()\n return\n }\n processing++\n dirs.add(dir)\n\n const entries = dir.readdirSync()\n for (const e of entries) {\n if (!filter || filter(e)) {\n if (!results.write(withFileTypes ? e : e.fullpath())) {\n paused = true\n }\n }\n }\n processing--\n for (const e of entries) {\n let r: PathBase | undefined = e\n if (e.isSymbolicLink()) {\n if (!(follow && (r = e.realpathSync()))) continue\n if (r.isUnknown()) r.lstatSync()\n }\n if (r.shouldWalk(dirs, walkFilter)) {\n queue.push(r)\n }\n }\n }\n if (paused && !results.flowing) results.once('drain', process)\n }\n process()\n return results as Minipass | Minipass\n }\n\n chdir(path: string | Path = this.cwd) {\n const oldCwd = this.cwd\n this.cwd = typeof path === 'string' ? this.cwd.resolve(path) : path\n this.cwd[setAsCwd](oldCwd)\n }\n}\n\n/**\n * Options provided to all walk methods.\n */\nexport interface WalkOptions {\n /**\n * Return results as {@link PathBase} objects rather than strings.\n * When set to false, results are fully resolved paths, as returned by\n * {@link PathBase.fullpath}.\n * @default true\n */\n withFileTypes?: boolean\n\n /**\n * Attempt to read directory entries from symbolic links. Otherwise, only\n * actual directories are traversed. Regardless of this setting, a given\n * target path will only ever be walked once, meaning that a symbolic link\n * to a previously traversed directory will never be followed.\n *\n * Setting this imposes a slight performance penalty, because `readlink`\n * must be called on all symbolic links encountered, in order to avoid\n * infinite cycles.\n * @default false\n */\n follow?: boolean\n\n /**\n * Only return entries where the provided function returns true.\n *\n * This will not prevent directories from being traversed, even if they do\n * not pass the filter, though it will prevent directories themselves from\n * being included in the result set. See {@link walkFilter}\n *\n * Asynchronous functions are not supported here.\n *\n * By default, if no filter is provided, all entries and traversed\n * directories are included.\n */\n filter?: (entry: PathBase) => boolean\n\n /**\n * Only traverse directories (and in the case of {@link follow} being set to\n * true, symbolic links to directories) if the provided function returns\n * true.\n *\n * This will not prevent directories from being included in the result set,\n * even if they do not pass the supplied filter function. See {@link filter}\n * to do that.\n *\n * Asynchronous functions are not supported here.\n */\n walkFilter?: (entry: PathBase) => boolean\n}\n\nexport type WalkOptionsWithFileTypesUnset = WalkOptions & {\n withFileTypes?: undefined\n}\nexport type WalkOptionsWithFileTypesTrue = WalkOptions & {\n withFileTypes: true\n}\nexport type WalkOptionsWithFileTypesFalse = WalkOptions & {\n withFileTypes: false\n}\n\n/**\n * Windows implementation of {@link PathScurryBase}\n *\n * Defaults to case insensitve, uses `'\\\\'` to generate path strings. Uses\n * {@link PathWin32} for Path objects.\n */\nexport class PathScurryWin32 extends PathScurryBase {\n /**\n * separator for generating path strings\n */\n sep: '\\\\' = '\\\\'\n\n constructor(\n cwd: URL | string = process.cwd(),\n opts: PathScurryOpts = {},\n ) {\n const { nocase = true } = opts\n super(cwd, win32, '\\\\', { ...opts, nocase })\n this.nocase = nocase\n for (let p: PathBase | undefined = this.cwd; p; p = p.parent) {\n p.nocase = this.nocase\n }\n }\n\n /**\n * @internal\n */\n parseRootPath(dir: string): string {\n // if the path starts with a single separator, it's not a UNC, and we'll\n // just get separator as the root, and driveFromUNC will return \\\n // In that case, mount \\ on the root from the cwd.\n return win32.parse(dir).root.toUpperCase()\n }\n\n /**\n * @internal\n */\n newRoot(fs: FSValue) {\n return new PathWin32(\n this.rootPath,\n IFDIR,\n undefined,\n this.roots,\n this.nocase,\n this.childrenCache(),\n { fs },\n )\n }\n\n /**\n * Return true if the provided path string is an absolute path\n */\n isAbsolute(p: string): boolean {\n return (\n p.startsWith('/') || p.startsWith('\\\\') || /^[a-z]:(\\/|\\\\)/i.test(p)\n )\n }\n}\n\n/**\n * {@link PathScurryBase} implementation for all posix systems other than Darwin.\n *\n * Defaults to case-sensitive matching, uses `'/'` to generate path strings.\n *\n * Uses {@link PathPosix} for Path objects.\n */\nexport class PathScurryPosix extends PathScurryBase {\n /**\n * separator for generating path strings\n */\n sep: '/' = '/'\n constructor(\n cwd: URL | string = process.cwd(),\n opts: PathScurryOpts = {},\n ) {\n const { nocase = false } = opts\n super(cwd, posix, '/', { ...opts, nocase })\n this.nocase = nocase\n }\n\n /**\n * @internal\n */\n parseRootPath(_dir: string): string {\n return '/'\n }\n\n /**\n * @internal\n */\n newRoot(fs: FSValue) {\n return new PathPosix(\n this.rootPath,\n IFDIR,\n undefined,\n this.roots,\n this.nocase,\n this.childrenCache(),\n { fs },\n )\n }\n\n /**\n * Return true if the provided path string is an absolute path\n */\n isAbsolute(p: string): boolean {\n return p.startsWith('/')\n }\n}\n\n/**\n * {@link PathScurryBase} implementation for Darwin (macOS) systems.\n *\n * Defaults to case-insensitive matching, uses `'/'` for generating path\n * strings.\n *\n * Uses {@link PathPosix} for Path objects.\n */\nexport class PathScurryDarwin extends PathScurryPosix {\n constructor(\n cwd: URL | string = process.cwd(),\n opts: PathScurryOpts = {},\n ) {\n const { nocase = true } = opts\n super(cwd, { ...opts, nocase })\n }\n}\n\n/**\n * Default {@link PathBase} implementation for the current platform.\n *\n * {@link PathWin32} on Windows systems, {@link PathPosix} on all others.\n */\nexport const Path = process.platform === 'win32' ? PathWin32 : PathPosix\nexport type Path = PathBase | InstanceType\n\n/**\n * Default {@link PathScurryBase} implementation for the current platform.\n *\n * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on\n * Darwin (macOS) systems, {@link PathScurryPosix} on all others.\n */\nexport const PathScurry:\n | typeof PathScurryWin32\n | typeof PathScurryDarwin\n | typeof PathScurryPosix =\n process.platform === 'win32' ? PathScurryWin32\n : process.platform === 'darwin' ? PathScurryDarwin\n : PathScurryPosix\nexport type PathScurry = PathScurryBase | InstanceType\n"]} \ No newline at end of file diff --git a/node_modules/path-scurry/dist/commonjs/package.json b/node_modules/path-scurry/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/path-scurry/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/path-scurry/dist/esm/index.d.ts b/node_modules/path-scurry/dist/esm/index.d.ts new file mode 100644 index 00000000..33b3edbd --- /dev/null +++ b/node_modules/path-scurry/dist/esm/index.d.ts @@ -0,0 +1,1116 @@ +/// +/// +/// +import { LRUCache } from 'lru-cache'; +import { posix, win32 } from 'node:path'; +import { Minipass } from 'minipass'; +import type { Dirent, Stats } from 'node:fs'; +/** + * An object that will be used to override the default `fs` + * methods. Any methods that are not overridden will use Node's + * built-in implementations. + * + * - lstatSync + * - readdir (callback `withFileTypes` Dirent variant, used for + * readdirCB and most walks) + * - readdirSync + * - readlinkSync + * - realpathSync + * - promises: Object containing the following async methods: + * - lstat + * - readdir (Dirent variant only) + * - readlink + * - realpath + */ +export interface FSOption { + lstatSync?: (path: string) => Stats; + readdir?: (path: string, options: { + withFileTypes: true; + }, cb: (er: NodeJS.ErrnoException | null, entries?: Dirent[]) => any) => void; + readdirSync?: (path: string, options: { + withFileTypes: true; + }) => Dirent[]; + readlinkSync?: (path: string) => string; + realpathSync?: (path: string) => string; + promises?: { + lstat?: (path: string) => Promise; + readdir?: (path: string, options: { + withFileTypes: true; + }) => Promise; + readlink?: (path: string) => Promise; + realpath?: (path: string) => Promise; + [k: string]: any; + }; + [k: string]: any; +} +interface FSValue { + lstatSync: (path: string) => Stats; + readdir: (path: string, options: { + withFileTypes: true; + }, cb: (er: NodeJS.ErrnoException | null, entries?: Dirent[]) => any) => void; + readdirSync: (path: string, options: { + withFileTypes: true; + }) => Dirent[]; + readlinkSync: (path: string) => string; + realpathSync: (path: string) => string; + promises: { + lstat: (path: string) => Promise; + readdir: (path: string, options: { + withFileTypes: true; + }) => Promise; + readlink: (path: string) => Promise; + realpath: (path: string) => Promise; + [k: string]: any; + }; + [k: string]: any; +} +export type Type = 'Unknown' | 'FIFO' | 'CharacterDevice' | 'Directory' | 'BlockDevice' | 'File' | 'SymbolicLink' | 'Socket'; +/** + * Options that may be provided to the Path constructor + */ +export interface PathOpts { + fullpath?: string; + relative?: string; + relativePosix?: string; + parent?: PathBase; + /** + * See {@link FSOption} + */ + fs?: FSOption; +} +/** + * An LRUCache for storing resolved path strings or Path objects. + * @internal + */ +export declare class ResolveCache extends LRUCache { + constructor(); +} +/** + * an LRUCache for storing child entries. + * @internal + */ +export declare class ChildrenCache extends LRUCache { + constructor(maxSize?: number); +} +/** + * Array of Path objects, plus a marker indicating the first provisional entry + * + * @internal + */ +export type Children = PathBase[] & { + provisional: number; +}; +declare const setAsCwd: unique symbol; +/** + * Path objects are sort of like a super-powered + * {@link https://nodejs.org/docs/latest/api/fs.html#class-fsdirent fs.Dirent} + * + * Each one represents a single filesystem entry on disk, which may or may not + * exist. It includes methods for reading various types of information via + * lstat, readlink, and readdir, and caches all information to the greatest + * degree possible. + * + * Note that fs operations that would normally throw will instead return an + * "empty" value. This is in order to prevent excessive overhead from error + * stack traces. + */ +export declare abstract class PathBase implements Dirent { + #private; + /** + * the basename of this path + * + * **Important**: *always* test the path name against any test string + * usingthe {@link isNamed} method, and not by directly comparing this + * string. Otherwise, unicode path strings that the system sees as identical + * will not be properly treated as the same path, leading to incorrect + * behavior and possible security issues. + */ + name: string; + /** + * the Path entry corresponding to the path root. + * + * @internal + */ + root: PathBase; + /** + * All roots found within the current PathScurry family + * + * @internal + */ + roots: { + [k: string]: PathBase; + }; + /** + * a reference to the parent path, or undefined in the case of root entries + * + * @internal + */ + parent?: PathBase; + /** + * boolean indicating whether paths are compared case-insensitively + * @internal + */ + nocase: boolean; + /** + * boolean indicating that this path is the current working directory + * of the PathScurry collection that contains it. + */ + isCWD: boolean; + /** + * the string or regexp used to split paths. On posix, it is `'/'`, and on + * windows it is a RegExp matching either `'/'` or `'\\'` + */ + abstract splitSep: string | RegExp; + /** + * The path separator string to use when joining paths + */ + abstract sep: string; + get dev(): number | undefined; + get mode(): number | undefined; + get nlink(): number | undefined; + get uid(): number | undefined; + get gid(): number | undefined; + get rdev(): number | undefined; + get blksize(): number | undefined; + get ino(): number | undefined; + get size(): number | undefined; + get blocks(): number | undefined; + get atimeMs(): number | undefined; + get mtimeMs(): number | undefined; + get ctimeMs(): number | undefined; + get birthtimeMs(): number | undefined; + get atime(): Date | undefined; + get mtime(): Date | undefined; + get ctime(): Date | undefined; + get birthtime(): Date | undefined; + /** + * This property is for compatibility with the Dirent class as of + * Node v20, where Dirent['parentPath'] refers to the path of the + * directory that was passed to readdir. For root entries, it's the path + * to the entry itself. + */ + get parentPath(): string; + /** + * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively, + * this property refers to the *parent* path, not the path object itself. + */ + get path(): string; + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name: string, type: number | undefined, root: PathBase | undefined, roots: { + [k: string]: PathBase; + }, nocase: boolean, children: ChildrenCache, opts: PathOpts); + /** + * Returns the depth of the Path object from its root. + * + * For example, a path at `/foo/bar` would have a depth of 2. + */ + depth(): number; + /** + * @internal + */ + abstract getRootString(path: string): string; + /** + * @internal + */ + abstract getRoot(rootPath: string): PathBase; + /** + * @internal + */ + abstract newChild(name: string, type?: number, opts?: PathOpts): PathBase; + /** + * @internal + */ + childrenCache(): ChildrenCache; + /** + * Get the Path object referenced by the string path, resolved from this Path + */ + resolve(path?: string): PathBase; + /** + * Returns the cached children Path objects, if still available. If they + * have fallen out of the cache, then returns an empty array, and resets the + * READDIR_CALLED bit, so that future calls to readdir() will require an fs + * lookup. + * + * @internal + */ + children(): Children; + /** + * Resolves a path portion and returns or creates the child Path. + * + * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is + * `'..'`. + * + * This should not be called directly. If `pathPart` contains any path + * separators, it will lead to unsafe undefined behavior. + * + * Use `Path.resolve()` instead. + * + * @internal + */ + child(pathPart: string, opts?: PathOpts): PathBase; + /** + * The relative path from the cwd. If it does not share an ancestor with + * the cwd, then this ends up being equivalent to the fullpath() + */ + relative(): string; + /** + * The relative path from the cwd, using / as the path separator. + * If it does not share an ancestor with + * the cwd, then this ends up being equivalent to the fullpathPosix() + * On posix systems, this is identical to relative(). + */ + relativePosix(): string; + /** + * The fully resolved path string for this Path entry + */ + fullpath(): string; + /** + * On platforms other than windows, this is identical to fullpath. + * + * On windows, this is overridden to return the forward-slash form of the + * full UNC path. + */ + fullpathPosix(): string; + /** + * Is the Path of an unknown type? + * + * Note that we might know *something* about it if there has been a previous + * filesystem operation, for example that it does not exist, or is not a + * link, or whether it has child entries. + */ + isUnknown(): boolean; + isType(type: Type): boolean; + getType(): Type; + /** + * Is the Path a regular file? + */ + isFile(): boolean; + /** + * Is the Path a directory? + */ + isDirectory(): boolean; + /** + * Is the path a character device? + */ + isCharacterDevice(): boolean; + /** + * Is the path a block device? + */ + isBlockDevice(): boolean; + /** + * Is the path a FIFO pipe? + */ + isFIFO(): boolean; + /** + * Is the path a socket? + */ + isSocket(): boolean; + /** + * Is the path a symbolic link? + */ + isSymbolicLink(): boolean; + /** + * Return the entry if it has been subject of a successful lstat, or + * undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* simply + * mean that we haven't called lstat on it. + */ + lstatCached(): PathBase | undefined; + /** + * Return the cached link target if the entry has been the subject of a + * successful readlink, or undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * readlink() has been called at some point. + */ + readlinkCached(): PathBase | undefined; + /** + * Returns the cached realpath target if the entry has been the subject + * of a successful realpath, or undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * realpath() has been called at some point. + */ + realpathCached(): PathBase | undefined; + /** + * Returns the cached child Path entries array if the entry has been the + * subject of a successful readdir(), or [] otherwise. + * + * Does not read the filesystem, so an empty array *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * readdir() has been called recently enough to still be valid. + */ + readdirCached(): PathBase[]; + /** + * Return true if it's worth trying to readlink. Ie, we don't (yet) have + * any indication that readlink will definitely fail. + * + * Returns false if the path is known to not be a symlink, if a previous + * readlink failed, or if the entry does not exist. + */ + canReadlink(): boolean; + /** + * Return true if readdir has previously been successfully called on this + * path, indicating that cachedReaddir() is likely valid. + */ + calledReaddir(): boolean; + /** + * Returns true if the path is known to not exist. That is, a previous lstat + * or readdir failed to verify its existence when that would have been + * expected, or a parent entry was marked either enoent or enotdir. + */ + isENOENT(): boolean; + /** + * Return true if the path is a match for the given path name. This handles + * case sensitivity and unicode normalization. + * + * Note: even on case-sensitive systems, it is **not** safe to test the + * equality of the `.name` property to determine whether a given pathname + * matches, due to unicode normalization mismatches. + * + * Always use this method instead of testing the `path.name` property + * directly. + */ + isNamed(n: string): boolean; + /** + * Return the Path object corresponding to the target of a symbolic link. + * + * If the Path is not a symbolic link, or if the readlink call fails for any + * reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + */ + readlink(): Promise; + /** + * Synchronous {@link PathBase.readlink} + */ + readlinkSync(): PathBase | undefined; + /** + * Call lstat() on this Path, and update all known information that can be + * determined. + * + * Note that unlike `fs.lstat()`, the returned value does not contain some + * information, such as `mode`, `dev`, `nlink`, and `ino`. If that + * information is required, you will need to call `fs.lstat` yourself. + * + * If the Path refers to a nonexistent file, or if the lstat call fails for + * any reason, `undefined` is returned. Otherwise the updated Path object is + * returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + lstat(): Promise; + /** + * synchronous {@link PathBase.lstat} + */ + lstatSync(): PathBase | undefined; + /** + * Standard node-style callback interface to get list of directory entries. + * + * If the Path cannot or does not contain any children, then an empty array + * is returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + * + * @param cb The callback called with (er, entries). Note that the `er` + * param is somewhat extraneous, as all readdir() errors are handled and + * simply result in an empty set of entries being returned. + * @param allowZalgo Boolean indicating that immediately known results should + * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release + * zalgo at your peril, the dark pony lord is devious and unforgiving. + */ + readdirCB(cb: (er: NodeJS.ErrnoException | null, entries: PathBase[]) => any, allowZalgo?: boolean): void; + /** + * Return an array of known child entries. + * + * If the Path cannot or does not contain any children, then an empty array + * is returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + readdir(): Promise; + /** + * synchronous {@link PathBase.readdir} + */ + readdirSync(): PathBase[]; + canReaddir(): boolean; + shouldWalk(dirs: Set, walkFilter?: (e: PathBase) => boolean): boolean; + /** + * Return the Path object corresponding to path as resolved + * by realpath(3). + * + * If the realpath call fails for any reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + * On success, returns a Path object. + */ + realpath(): Promise; + /** + * Synchronous {@link realpath} + */ + realpathSync(): PathBase | undefined; + /** + * Internal method to mark this Path object as the scurry cwd, + * called by {@link PathScurry#chdir} + * + * @internal + */ + [setAsCwd](oldCwd: PathBase): void; +} +/** + * Path class used on win32 systems + * + * Uses `'\\'` as the path separator for returned paths, either `'\\'` or `'/'` + * as the path separator for parsing paths. + */ +export declare class PathWin32 extends PathBase { + /** + * Separator for generating path strings. + */ + sep: '\\'; + /** + * Separator for parsing path strings. + */ + splitSep: RegExp; + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name: string, type: number | undefined, root: PathBase | undefined, roots: { + [k: string]: PathBase; + }, nocase: boolean, children: ChildrenCache, opts: PathOpts); + /** + * @internal + */ + newChild(name: string, type?: number, opts?: PathOpts): PathWin32; + /** + * @internal + */ + getRootString(path: string): string; + /** + * @internal + */ + getRoot(rootPath: string): PathBase; + /** + * @internal + */ + sameRoot(rootPath: string, compare?: string): boolean; +} +/** + * Path class used on all posix systems. + * + * Uses `'/'` as the path separator. + */ +export declare class PathPosix extends PathBase { + /** + * separator for parsing path strings + */ + splitSep: '/'; + /** + * separator for generating path strings + */ + sep: '/'; + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name: string, type: number | undefined, root: PathBase | undefined, roots: { + [k: string]: PathBase; + }, nocase: boolean, children: ChildrenCache, opts: PathOpts); + /** + * @internal + */ + getRootString(path: string): string; + /** + * @internal + */ + getRoot(_rootPath: string): PathBase; + /** + * @internal + */ + newChild(name: string, type?: number, opts?: PathOpts): PathPosix; +} +/** + * Options that may be provided to the PathScurry constructor + */ +export interface PathScurryOpts { + /** + * perform case-insensitive path matching. Default based on platform + * subclass. + */ + nocase?: boolean; + /** + * Number of Path entries to keep in the cache of Path child references. + * + * Setting this higher than 65536 will dramatically increase the data + * consumption and construction time overhead of each PathScurry. + * + * Setting this value to 256 or lower will significantly reduce the data + * consumption and construction time overhead, but may also reduce resolve() + * and readdir() performance on large filesystems. + * + * Default `16384`. + */ + childrenCacheSize?: number; + /** + * An object that overrides the built-in functions from the fs and + * fs/promises modules. + * + * See {@link FSOption} + */ + fs?: FSOption; +} +/** + * The base class for all PathScurry classes, providing the interface for path + * resolution and filesystem operations. + * + * Typically, you should *not* instantiate this class directly, but rather one + * of the platform-specific classes, or the exported {@link PathScurry} which + * defaults to the current platform. + */ +export declare abstract class PathScurryBase { + #private; + /** + * The root Path entry for the current working directory of this Scurry + */ + root: PathBase; + /** + * The string path for the root of this Scurry's current working directory + */ + rootPath: string; + /** + * A collection of all roots encountered, referenced by rootPath + */ + roots: { + [k: string]: PathBase; + }; + /** + * The Path entry corresponding to this PathScurry's current working directory. + */ + cwd: PathBase; + /** + * Perform path comparisons case-insensitively. + * + * Defaults true on Darwin and Windows systems, false elsewhere. + */ + nocase: boolean; + /** + * The path separator used for parsing paths + * + * `'/'` on Posix systems, either `'/'` or `'\\'` on Windows + */ + abstract sep: string | RegExp; + /** + * This class should not be instantiated directly. + * + * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry + * + * @internal + */ + constructor(cwd: string | URL | undefined, pathImpl: typeof win32 | typeof posix, sep: string | RegExp, { nocase, childrenCacheSize, fs, }?: PathScurryOpts); + /** + * Get the depth of a provided path, string, or the cwd + */ + depth(path?: Path | string): number; + /** + * Parse the root portion of a path string + * + * @internal + */ + abstract parseRootPath(dir: string): string; + /** + * create a new Path to use as root during construction. + * + * @internal + */ + abstract newRoot(fs: FSValue): PathBase; + /** + * Determine whether a given path string is absolute + */ + abstract isAbsolute(p: string): boolean; + /** + * Return the cache of child entries. Exposed so subclasses can create + * child Path objects in a platform-specific way. + * + * @internal + */ + childrenCache(): ChildrenCache; + /** + * Resolve one or more path strings to a resolved string + * + * Same interface as require('path').resolve. + * + * Much faster than path.resolve() when called multiple times for the same + * path, because the resolved Path objects are cached. Much slower + * otherwise. + */ + resolve(...paths: string[]): string; + /** + * Resolve one or more path strings to a resolved string, returning + * the posix path. Identical to .resolve() on posix systems, but on + * windows will return a forward-slash separated UNC path. + * + * Same interface as require('path').resolve. + * + * Much faster than path.resolve() when called multiple times for the same + * path, because the resolved Path objects are cached. Much slower + * otherwise. + */ + resolvePosix(...paths: string[]): string; + /** + * find the relative path from the cwd to the supplied path string or entry + */ + relative(entry?: PathBase | string): string; + /** + * find the relative path from the cwd to the supplied path string or + * entry, using / as the path delimiter, even on Windows. + */ + relativePosix(entry?: PathBase | string): string; + /** + * Return the basename for the provided string or Path object + */ + basename(entry?: PathBase | string): string; + /** + * Return the dirname for the provided string or Path object + */ + dirname(entry?: PathBase | string): string; + /** + * Return an array of known child entries. + * + * First argument may be either a string, or a Path object. + * + * If the Path cannot or does not contain any children, then an empty array + * is returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + * + * Unlike `fs.readdir()`, the `withFileTypes` option defaults to `true`. Set + * `{ withFileTypes: false }` to return strings. + */ + readdir(): Promise; + readdir(opts: { + withFileTypes: true; + }): Promise; + readdir(opts: { + withFileTypes: false; + }): Promise; + readdir(opts: { + withFileTypes: boolean; + }): Promise; + readdir(entry: PathBase | string): Promise; + readdir(entry: PathBase | string, opts: { + withFileTypes: true; + }): Promise; + readdir(entry: PathBase | string, opts: { + withFileTypes: false; + }): Promise; + readdir(entry: PathBase | string, opts: { + withFileTypes: boolean; + }): Promise; + /** + * synchronous {@link PathScurryBase.readdir} + */ + readdirSync(): PathBase[]; + readdirSync(opts: { + withFileTypes: true; + }): PathBase[]; + readdirSync(opts: { + withFileTypes: false; + }): string[]; + readdirSync(opts: { + withFileTypes: boolean; + }): PathBase[] | string[]; + readdirSync(entry: PathBase | string): PathBase[]; + readdirSync(entry: PathBase | string, opts: { + withFileTypes: true; + }): PathBase[]; + readdirSync(entry: PathBase | string, opts: { + withFileTypes: false; + }): string[]; + readdirSync(entry: PathBase | string, opts: { + withFileTypes: boolean; + }): PathBase[] | string[]; + /** + * Call lstat() on the string or Path object, and update all known + * information that can be determined. + * + * Note that unlike `fs.lstat()`, the returned value does not contain some + * information, such as `mode`, `dev`, `nlink`, and `ino`. If that + * information is required, you will need to call `fs.lstat` yourself. + * + * If the Path refers to a nonexistent file, or if the lstat call fails for + * any reason, `undefined` is returned. Otherwise the updated Path object is + * returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + lstat(entry?: string | PathBase): Promise; + /** + * synchronous {@link PathScurryBase.lstat} + */ + lstatSync(entry?: string | PathBase): PathBase | undefined; + /** + * Return the Path object or string path corresponding to the target of a + * symbolic link. + * + * If the path is not a symbolic link, or if the readlink call fails for any + * reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + * + * `{withFileTypes}` option defaults to `false`. + * + * On success, returns a Path object if `withFileTypes` option is true, + * otherwise a string. + */ + readlink(): Promise; + readlink(opt: { + withFileTypes: false; + }): Promise; + readlink(opt: { + withFileTypes: true; + }): Promise; + readlink(opt: { + withFileTypes: boolean; + }): Promise; + readlink(entry: string | PathBase, opt?: { + withFileTypes: false; + }): Promise; + readlink(entry: string | PathBase, opt: { + withFileTypes: true; + }): Promise; + readlink(entry: string | PathBase, opt: { + withFileTypes: boolean; + }): Promise; + /** + * synchronous {@link PathScurryBase.readlink} + */ + readlinkSync(): string | undefined; + readlinkSync(opt: { + withFileTypes: false; + }): string | undefined; + readlinkSync(opt: { + withFileTypes: true; + }): PathBase | undefined; + readlinkSync(opt: { + withFileTypes: boolean; + }): PathBase | string | undefined; + readlinkSync(entry: string | PathBase, opt?: { + withFileTypes: false; + }): string | undefined; + readlinkSync(entry: string | PathBase, opt: { + withFileTypes: true; + }): PathBase | undefined; + readlinkSync(entry: string | PathBase, opt: { + withFileTypes: boolean; + }): string | PathBase | undefined; + /** + * Return the Path object or string path corresponding to path as resolved + * by realpath(3). + * + * If the realpath call fails for any reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + * + * `{withFileTypes}` option defaults to `false`. + * + * On success, returns a Path object if `withFileTypes` option is true, + * otherwise a string. + */ + realpath(): Promise; + realpath(opt: { + withFileTypes: false; + }): Promise; + realpath(opt: { + withFileTypes: true; + }): Promise; + realpath(opt: { + withFileTypes: boolean; + }): Promise; + realpath(entry: string | PathBase, opt?: { + withFileTypes: false; + }): Promise; + realpath(entry: string | PathBase, opt: { + withFileTypes: true; + }): Promise; + realpath(entry: string | PathBase, opt: { + withFileTypes: boolean; + }): Promise; + realpathSync(): string | undefined; + realpathSync(opt: { + withFileTypes: false; + }): string | undefined; + realpathSync(opt: { + withFileTypes: true; + }): PathBase | undefined; + realpathSync(opt: { + withFileTypes: boolean; + }): PathBase | string | undefined; + realpathSync(entry: string | PathBase, opt?: { + withFileTypes: false; + }): string | undefined; + realpathSync(entry: string | PathBase, opt: { + withFileTypes: true; + }): PathBase | undefined; + realpathSync(entry: string | PathBase, opt: { + withFileTypes: boolean; + }): string | PathBase | undefined; + /** + * Asynchronously walk the directory tree, returning an array of + * all path strings or Path objects found. + * + * Note that this will be extremely memory-hungry on large filesystems. + * In such cases, it may be better to use the stream or async iterator + * walk implementation. + */ + walk(): Promise; + walk(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Promise; + walk(opts: WalkOptionsWithFileTypesFalse): Promise; + walk(opts: WalkOptions): Promise; + walk(entry: string | PathBase): Promise; + walk(entry: string | PathBase, opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Promise; + walk(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): Promise; + walk(entry: string | PathBase, opts: WalkOptions): Promise; + /** + * Synchronously walk the directory tree, returning an array of + * all path strings or Path objects found. + * + * Note that this will be extremely memory-hungry on large filesystems. + * In such cases, it may be better to use the stream or async iterator + * walk implementation. + */ + walkSync(): PathBase[]; + walkSync(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): PathBase[]; + walkSync(opts: WalkOptionsWithFileTypesFalse): string[]; + walkSync(opts: WalkOptions): string[] | PathBase[]; + walkSync(entry: string | PathBase): PathBase[]; + walkSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue): PathBase[]; + walkSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): string[]; + walkSync(entry: string | PathBase, opts: WalkOptions): PathBase[] | string[]; + /** + * Support for `for await` + * + * Alias for {@link PathScurryBase.iterate} + * + * Note: As of Node 19, this is very slow, compared to other methods of + * walking. Consider using {@link PathScurryBase.stream} if memory overhead + * and backpressure are concerns, or {@link PathScurryBase.walk} if not. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Async generator form of {@link PathScurryBase.walk} + * + * Note: As of Node 19, this is very slow, compared to other methods of + * walking, especially if most/all of the directory tree has been previously + * walked. Consider using {@link PathScurryBase.stream} if memory overhead + * and backpressure are concerns, or {@link PathScurryBase.walk} if not. + */ + iterate(): AsyncGenerator; + iterate(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): AsyncGenerator; + iterate(opts: WalkOptionsWithFileTypesFalse): AsyncGenerator; + iterate(opts: WalkOptions): AsyncGenerator; + iterate(entry: string | PathBase): AsyncGenerator; + iterate(entry: string | PathBase, opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): AsyncGenerator; + iterate(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): AsyncGenerator; + iterate(entry: string | PathBase, opts: WalkOptions): AsyncGenerator; + /** + * Iterating over a PathScurry performs a synchronous walk. + * + * Alias for {@link PathScurryBase.iterateSync} + */ + [Symbol.iterator](): Generator; + iterateSync(): Generator; + iterateSync(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Generator; + iterateSync(opts: WalkOptionsWithFileTypesFalse): Generator; + iterateSync(opts: WalkOptions): Generator; + iterateSync(entry: string | PathBase): Generator; + iterateSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Generator; + iterateSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): Generator; + iterateSync(entry: string | PathBase, opts: WalkOptions): Generator; + /** + * Stream form of {@link PathScurryBase.walk} + * + * Returns a Minipass stream that emits {@link PathBase} objects by default, + * or strings if `{ withFileTypes: false }` is set in the options. + */ + stream(): Minipass; + stream(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Minipass; + stream(opts: WalkOptionsWithFileTypesFalse): Minipass; + stream(opts: WalkOptions): Minipass; + stream(entry: string | PathBase): Minipass; + stream(entry: string | PathBase, opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue): Minipass; + stream(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): Minipass; + stream(entry: string | PathBase, opts: WalkOptions): Minipass | Minipass; + /** + * Synchronous form of {@link PathScurryBase.stream} + * + * Returns a Minipass stream that emits {@link PathBase} objects by default, + * or strings if `{ withFileTypes: false }` is set in the options. + * + * Will complete the walk in a single tick if the stream is consumed fully. + * Otherwise, will pause as needed for stream backpressure. + */ + streamSync(): Minipass; + streamSync(opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset): Minipass; + streamSync(opts: WalkOptionsWithFileTypesFalse): Minipass; + streamSync(opts: WalkOptions): Minipass; + streamSync(entry: string | PathBase): Minipass; + streamSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue): Minipass; + streamSync(entry: string | PathBase, opts: WalkOptionsWithFileTypesFalse): Minipass; + streamSync(entry: string | PathBase, opts: WalkOptions): Minipass | Minipass; + chdir(path?: string | Path): void; +} +/** + * Options provided to all walk methods. + */ +export interface WalkOptions { + /** + * Return results as {@link PathBase} objects rather than strings. + * When set to false, results are fully resolved paths, as returned by + * {@link PathBase.fullpath}. + * @default true + */ + withFileTypes?: boolean; + /** + * Attempt to read directory entries from symbolic links. Otherwise, only + * actual directories are traversed. Regardless of this setting, a given + * target path will only ever be walked once, meaning that a symbolic link + * to a previously traversed directory will never be followed. + * + * Setting this imposes a slight performance penalty, because `readlink` + * must be called on all symbolic links encountered, in order to avoid + * infinite cycles. + * @default false + */ + follow?: boolean; + /** + * Only return entries where the provided function returns true. + * + * This will not prevent directories from being traversed, even if they do + * not pass the filter, though it will prevent directories themselves from + * being included in the result set. See {@link walkFilter} + * + * Asynchronous functions are not supported here. + * + * By default, if no filter is provided, all entries and traversed + * directories are included. + */ + filter?: (entry: PathBase) => boolean; + /** + * Only traverse directories (and in the case of {@link follow} being set to + * true, symbolic links to directories) if the provided function returns + * true. + * + * This will not prevent directories from being included in the result set, + * even if they do not pass the supplied filter function. See {@link filter} + * to do that. + * + * Asynchronous functions are not supported here. + */ + walkFilter?: (entry: PathBase) => boolean; +} +export type WalkOptionsWithFileTypesUnset = WalkOptions & { + withFileTypes?: undefined; +}; +export type WalkOptionsWithFileTypesTrue = WalkOptions & { + withFileTypes: true; +}; +export type WalkOptionsWithFileTypesFalse = WalkOptions & { + withFileTypes: false; +}; +/** + * Windows implementation of {@link PathScurryBase} + * + * Defaults to case insensitve, uses `'\\'` to generate path strings. Uses + * {@link PathWin32} for Path objects. + */ +export declare class PathScurryWin32 extends PathScurryBase { + /** + * separator for generating path strings + */ + sep: '\\'; + constructor(cwd?: URL | string, opts?: PathScurryOpts); + /** + * @internal + */ + parseRootPath(dir: string): string; + /** + * @internal + */ + newRoot(fs: FSValue): PathWin32; + /** + * Return true if the provided path string is an absolute path + */ + isAbsolute(p: string): boolean; +} +/** + * {@link PathScurryBase} implementation for all posix systems other than Darwin. + * + * Defaults to case-sensitive matching, uses `'/'` to generate path strings. + * + * Uses {@link PathPosix} for Path objects. + */ +export declare class PathScurryPosix extends PathScurryBase { + /** + * separator for generating path strings + */ + sep: '/'; + constructor(cwd?: URL | string, opts?: PathScurryOpts); + /** + * @internal + */ + parseRootPath(_dir: string): string; + /** + * @internal + */ + newRoot(fs: FSValue): PathPosix; + /** + * Return true if the provided path string is an absolute path + */ + isAbsolute(p: string): boolean; +} +/** + * {@link PathScurryBase} implementation for Darwin (macOS) systems. + * + * Defaults to case-insensitive matching, uses `'/'` for generating path + * strings. + * + * Uses {@link PathPosix} for Path objects. + */ +export declare class PathScurryDarwin extends PathScurryPosix { + constructor(cwd?: URL | string, opts?: PathScurryOpts); +} +/** + * Default {@link PathBase} implementation for the current platform. + * + * {@link PathWin32} on Windows systems, {@link PathPosix} on all others. + */ +export declare const Path: typeof PathWin32 | typeof PathPosix; +export type Path = PathBase | InstanceType; +/** + * Default {@link PathScurryBase} implementation for the current platform. + * + * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on + * Darwin (macOS) systems, {@link PathScurryPosix} on all others. + */ +export declare const PathScurry: typeof PathScurryWin32 | typeof PathScurryDarwin | typeof PathScurryPosix; +export type PathScurry = PathScurryBase | InstanceType; +export {}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/path-scurry/dist/esm/index.d.ts.map b/node_modules/path-scurry/dist/esm/index.d.ts.map new file mode 100644 index 00000000..1f59f8f4 --- /dev/null +++ b/node_modules/path-scurry/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAmBxC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAA;IACnC,OAAO,CAAC,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;QAAE,aAAa,EAAE,IAAI,CAAA;KAAE,EAChC,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,GAAG,KAC9D,IAAI,CAAA;IACT,WAAW,CAAC,EAAE,CACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;QAAE,aAAa,EAAE,IAAI,CAAA;KAAE,KAC7B,MAAM,EAAE,CAAA;IACb,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MA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,cAAmB;IAU3B;;OAEG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAOlC;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,OAAO;IAYnB;;OAEG;IACH,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;CAK/B;AAED;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,cAAc;IACjD;;OAEG;IACH,GAAG,EAAE,GAAG,CAAM;gBAEZ,GAAG,GAAE,GAAG,GAAG,MAAsB,EACjC,IAAI,GAAE,cAAmB;IAO3B;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAInC;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,OAAO;IAYnB;;OAEG;IACH,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;CAG/B;AAED;;;;;;;GAOG;AACH,qBAAa,gBAAiB,SAAQ,eAAe;gBAEjD,GAAG,GAAE,GAAG,GAAG,MAAsB,EACjC,IAAI,GAAE,cAAmB;CAK5B;AAED;;;;GAIG;AACH,eAAO,MAAM,IAAI,qCAAuD,CAAA;AACxE,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,YAAY,CAAC,OAAO,IAAI,CAAC,CAAA;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EACnB,OAAO,eAAe,GACtB,OAAO,gBAAgB,GACvB,OAAO,eAGQ,CAAA;AACnB,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,YAAY,CAAC,OAAO,UAAU,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/path-scurry/dist/esm/index.js b/node_modules/path-scurry/dist/esm/index.js new file mode 100644 index 00000000..3b11b819 --- /dev/null +++ b/node_modules/path-scurry/dist/esm/index.js @@ -0,0 +1,1979 @@ +import { LRUCache } from 'lru-cache'; +import { posix, win32 } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { lstatSync, readdir as readdirCB, readdirSync, readlinkSync, realpathSync as rps, } from 'fs'; +import * as actualFS from 'node:fs'; +const realpathSync = rps.native; +// TODO: test perf of fs/promises realpath vs realpathCB, +// since the promises one uses realpath.native +import { lstat, readdir, readlink, realpath } from 'node:fs/promises'; +import { Minipass } from 'minipass'; +const defaultFS = { + lstatSync, + readdir: readdirCB, + readdirSync, + readlinkSync, + realpathSync, + promises: { + lstat, + readdir, + readlink, + realpath, + }, +}; +// if they just gave us require('fs') then use our default +const fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === actualFS ? + defaultFS + : { + ...defaultFS, + ...fsOption, + promises: { + ...defaultFS.promises, + ...(fsOption.promises || {}), + }, + }; +// turn something like //?/c:/ into c:\ +const uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i; +const uncToDrive = (rootPath) => rootPath.replace(/\//g, '\\').replace(uncDriveRegexp, '$1\\'); +// windows paths are separated by either / or \ +const eitherSep = /[\\\/]/; +const UNKNOWN = 0; // may not even exist, for all we know +const IFIFO = 0b0001; +const IFCHR = 0b0010; +const IFDIR = 0b0100; +const IFBLK = 0b0110; +const IFREG = 0b1000; +const IFLNK = 0b1010; +const IFSOCK = 0b1100; +const IFMT = 0b1111; +// mask to unset low 4 bits +const IFMT_UNKNOWN = ~IFMT; +// set after successfully calling readdir() and getting entries. +const READDIR_CALLED = 0b0000_0001_0000; +// set after a successful lstat() +const LSTAT_CALLED = 0b0000_0010_0000; +// set if an entry (or one of its parents) is definitely not a dir +const ENOTDIR = 0b0000_0100_0000; +// set if an entry (or one of its parents) does not exist +// (can also be set on lstat errors like EACCES or ENAMETOOLONG) +const ENOENT = 0b0000_1000_0000; +// cannot have child entries -- also verify &IFMT is either IFDIR or IFLNK +// set if we fail to readlink +const ENOREADLINK = 0b0001_0000_0000; +// set if we know realpath() will fail +const ENOREALPATH = 0b0010_0000_0000; +const ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH; +const TYPEMASK = 0b0011_1111_1111; +const entToType = (s) => s.isFile() ? IFREG + : s.isDirectory() ? IFDIR + : s.isSymbolicLink() ? IFLNK + : s.isCharacterDevice() ? IFCHR + : s.isBlockDevice() ? IFBLK + : s.isSocket() ? IFSOCK + : s.isFIFO() ? IFIFO + : UNKNOWN; +// normalize unicode path names +const normalizeCache = new Map(); +const normalize = (s) => { + const c = normalizeCache.get(s); + if (c) + return c; + const n = s.normalize('NFKD'); + normalizeCache.set(s, n); + return n; +}; +const normalizeNocaseCache = new Map(); +const normalizeNocase = (s) => { + const c = normalizeNocaseCache.get(s); + if (c) + return c; + const n = normalize(s.toLowerCase()); + normalizeNocaseCache.set(s, n); + return n; +}; +/** + * An LRUCache for storing resolved path strings or Path objects. + * @internal + */ +export class ResolveCache extends LRUCache { + constructor() { + super({ max: 256 }); + } +} +// In order to prevent blowing out the js heap by allocating hundreds of +// thousands of Path entries when walking extremely large trees, the "children" +// in this tree are represented by storing an array of Path entries in an +// LRUCache, indexed by the parent. At any time, Path.children() may return an +// empty array, indicating that it doesn't know about any of its children, and +// thus has to rebuild that cache. This is fine, it just means that we don't +// benefit as much from having the cached entries, but huge directory walks +// don't blow out the stack, and smaller ones are still as fast as possible. +// +//It does impose some complexity when building up the readdir data, because we +//need to pass a reference to the children array that we started with. +/** + * an LRUCache for storing child entries. + * @internal + */ +export class ChildrenCache extends LRUCache { + constructor(maxSize = 16 * 1024) { + super({ + maxSize, + // parent + children + sizeCalculation: a => a.length + 1, + }); + } +} +const setAsCwd = Symbol('PathScurry setAsCwd'); +/** + * Path objects are sort of like a super-powered + * {@link https://nodejs.org/docs/latest/api/fs.html#class-fsdirent fs.Dirent} + * + * Each one represents a single filesystem entry on disk, which may or may not + * exist. It includes methods for reading various types of information via + * lstat, readlink, and readdir, and caches all information to the greatest + * degree possible. + * + * Note that fs operations that would normally throw will instead return an + * "empty" value. This is in order to prevent excessive overhead from error + * stack traces. + */ +export class PathBase { + /** + * the basename of this path + * + * **Important**: *always* test the path name against any test string + * usingthe {@link isNamed} method, and not by directly comparing this + * string. Otherwise, unicode path strings that the system sees as identical + * will not be properly treated as the same path, leading to incorrect + * behavior and possible security issues. + */ + name; + /** + * the Path entry corresponding to the path root. + * + * @internal + */ + root; + /** + * All roots found within the current PathScurry family + * + * @internal + */ + roots; + /** + * a reference to the parent path, or undefined in the case of root entries + * + * @internal + */ + parent; + /** + * boolean indicating whether paths are compared case-insensitively + * @internal + */ + nocase; + /** + * boolean indicating that this path is the current working directory + * of the PathScurry collection that contains it. + */ + isCWD = false; + // potential default fs override + #fs; + // Stats fields + #dev; + get dev() { + return this.#dev; + } + #mode; + get mode() { + return this.#mode; + } + #nlink; + get nlink() { + return this.#nlink; + } + #uid; + get uid() { + return this.#uid; + } + #gid; + get gid() { + return this.#gid; + } + #rdev; + get rdev() { + return this.#rdev; + } + #blksize; + get blksize() { + return this.#blksize; + } + #ino; + get ino() { + return this.#ino; + } + #size; + get size() { + return this.#size; + } + #blocks; + get blocks() { + return this.#blocks; + } + #atimeMs; + get atimeMs() { + return this.#atimeMs; + } + #mtimeMs; + get mtimeMs() { + return this.#mtimeMs; + } + #ctimeMs; + get ctimeMs() { + return this.#ctimeMs; + } + #birthtimeMs; + get birthtimeMs() { + return this.#birthtimeMs; + } + #atime; + get atime() { + return this.#atime; + } + #mtime; + get mtime() { + return this.#mtime; + } + #ctime; + get ctime() { + return this.#ctime; + } + #birthtime; + get birthtime() { + return this.#birthtime; + } + #matchName; + #depth; + #fullpath; + #fullpathPosix; + #relative; + #relativePosix; + #type; + #children; + #linkTarget; + #realpath; + /** + * This property is for compatibility with the Dirent class as of + * Node v20, where Dirent['parentPath'] refers to the path of the + * directory that was passed to readdir. For root entries, it's the path + * to the entry itself. + */ + get parentPath() { + return (this.parent || this).fullpath(); + } + /** + * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively, + * this property refers to the *parent* path, not the path object itself. + */ + get path() { + return this.parentPath; + } + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) { + this.name = name; + this.#matchName = nocase ? normalizeNocase(name) : normalize(name); + this.#type = type & TYPEMASK; + this.nocase = nocase; + this.roots = roots; + this.root = root || this; + this.#children = children; + this.#fullpath = opts.fullpath; + this.#relative = opts.relative; + this.#relativePosix = opts.relativePosix; + this.parent = opts.parent; + if (this.parent) { + this.#fs = this.parent.#fs; + } + else { + this.#fs = fsFromOption(opts.fs); + } + } + /** + * Returns the depth of the Path object from its root. + * + * For example, a path at `/foo/bar` would have a depth of 2. + */ + depth() { + if (this.#depth !== undefined) + return this.#depth; + if (!this.parent) + return (this.#depth = 0); + return (this.#depth = this.parent.depth() + 1); + } + /** + * @internal + */ + childrenCache() { + return this.#children; + } + /** + * Get the Path object referenced by the string path, resolved from this Path + */ + resolve(path) { + if (!path) { + return this; + } + const rootPath = this.getRootString(path); + const dir = path.substring(rootPath.length); + const dirParts = dir.split(this.splitSep); + const result = rootPath ? + this.getRoot(rootPath).#resolveParts(dirParts) + : this.#resolveParts(dirParts); + return result; + } + #resolveParts(dirParts) { + let p = this; + for (const part of dirParts) { + p = p.child(part); + } + return p; + } + /** + * Returns the cached children Path objects, if still available. If they + * have fallen out of the cache, then returns an empty array, and resets the + * READDIR_CALLED bit, so that future calls to readdir() will require an fs + * lookup. + * + * @internal + */ + children() { + const cached = this.#children.get(this); + if (cached) { + return cached; + } + const children = Object.assign([], { provisional: 0 }); + this.#children.set(this, children); + this.#type &= ~READDIR_CALLED; + return children; + } + /** + * Resolves a path portion and returns or creates the child Path. + * + * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is + * `'..'`. + * + * This should not be called directly. If `pathPart` contains any path + * separators, it will lead to unsafe undefined behavior. + * + * Use `Path.resolve()` instead. + * + * @internal + */ + child(pathPart, opts) { + if (pathPart === '' || pathPart === '.') { + return this; + } + if (pathPart === '..') { + return this.parent || this; + } + // find the child + const children = this.children(); + const name = this.nocase ? normalizeNocase(pathPart) : normalize(pathPart); + for (const p of children) { + if (p.#matchName === name) { + return p; + } + } + // didn't find it, create provisional child, since it might not + // actually exist. If we know the parent isn't a dir, then + // in fact it CAN'T exist. + const s = this.parent ? this.sep : ''; + const fullpath = this.#fullpath ? this.#fullpath + s + pathPart : undefined; + const pchild = this.newChild(pathPart, UNKNOWN, { + ...opts, + parent: this, + fullpath, + }); + if (!this.canReaddir()) { + pchild.#type |= ENOENT; + } + // don't have to update provisional, because if we have real children, + // then provisional is set to children.length, otherwise a lower number + children.push(pchild); + return pchild; + } + /** + * The relative path from the cwd. If it does not share an ancestor with + * the cwd, then this ends up being equivalent to the fullpath() + */ + relative() { + if (this.isCWD) + return ''; + if (this.#relative !== undefined) { + return this.#relative; + } + const name = this.name; + const p = this.parent; + if (!p) { + return (this.#relative = this.name); + } + const pv = p.relative(); + return pv + (!pv || !p.parent ? '' : this.sep) + name; + } + /** + * The relative path from the cwd, using / as the path separator. + * If it does not share an ancestor with + * the cwd, then this ends up being equivalent to the fullpathPosix() + * On posix systems, this is identical to relative(). + */ + relativePosix() { + if (this.sep === '/') + return this.relative(); + if (this.isCWD) + return ''; + if (this.#relativePosix !== undefined) + return this.#relativePosix; + const name = this.name; + const p = this.parent; + if (!p) { + return (this.#relativePosix = this.fullpathPosix()); + } + const pv = p.relativePosix(); + return pv + (!pv || !p.parent ? '' : '/') + name; + } + /** + * The fully resolved path string for this Path entry + */ + fullpath() { + if (this.#fullpath !== undefined) { + return this.#fullpath; + } + const name = this.name; + const p = this.parent; + if (!p) { + return (this.#fullpath = this.name); + } + const pv = p.fullpath(); + const fp = pv + (!p.parent ? '' : this.sep) + name; + return (this.#fullpath = fp); + } + /** + * On platforms other than windows, this is identical to fullpath. + * + * On windows, this is overridden to return the forward-slash form of the + * full UNC path. + */ + fullpathPosix() { + if (this.#fullpathPosix !== undefined) + return this.#fullpathPosix; + if (this.sep === '/') + return (this.#fullpathPosix = this.fullpath()); + if (!this.parent) { + const p = this.fullpath().replace(/\\/g, '/'); + if (/^[a-z]:\//i.test(p)) { + return (this.#fullpathPosix = `//?/${p}`); + } + else { + return (this.#fullpathPosix = p); + } + } + const p = this.parent; + const pfpp = p.fullpathPosix(); + const fpp = pfpp + (!pfpp || !p.parent ? '' : '/') + this.name; + return (this.#fullpathPosix = fpp); + } + /** + * Is the Path of an unknown type? + * + * Note that we might know *something* about it if there has been a previous + * filesystem operation, for example that it does not exist, or is not a + * link, or whether it has child entries. + */ + isUnknown() { + return (this.#type & IFMT) === UNKNOWN; + } + isType(type) { + return this[`is${type}`](); + } + getType() { + return (this.isUnknown() ? 'Unknown' + : this.isDirectory() ? 'Directory' + : this.isFile() ? 'File' + : this.isSymbolicLink() ? 'SymbolicLink' + : this.isFIFO() ? 'FIFO' + : this.isCharacterDevice() ? 'CharacterDevice' + : this.isBlockDevice() ? 'BlockDevice' + : /* c8 ignore start */ this.isSocket() ? 'Socket' + : 'Unknown'); + /* c8 ignore stop */ + } + /** + * Is the Path a regular file? + */ + isFile() { + return (this.#type & IFMT) === IFREG; + } + /** + * Is the Path a directory? + */ + isDirectory() { + return (this.#type & IFMT) === IFDIR; + } + /** + * Is the path a character device? + */ + isCharacterDevice() { + return (this.#type & IFMT) === IFCHR; + } + /** + * Is the path a block device? + */ + isBlockDevice() { + return (this.#type & IFMT) === IFBLK; + } + /** + * Is the path a FIFO pipe? + */ + isFIFO() { + return (this.#type & IFMT) === IFIFO; + } + /** + * Is the path a socket? + */ + isSocket() { + return (this.#type & IFMT) === IFSOCK; + } + /** + * Is the path a symbolic link? + */ + isSymbolicLink() { + return (this.#type & IFLNK) === IFLNK; + } + /** + * Return the entry if it has been subject of a successful lstat, or + * undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* simply + * mean that we haven't called lstat on it. + */ + lstatCached() { + return this.#type & LSTAT_CALLED ? this : undefined; + } + /** + * Return the cached link target if the entry has been the subject of a + * successful readlink, or undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * readlink() has been called at some point. + */ + readlinkCached() { + return this.#linkTarget; + } + /** + * Returns the cached realpath target if the entry has been the subject + * of a successful realpath, or undefined otherwise. + * + * Does not read the filesystem, so an undefined result *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * realpath() has been called at some point. + */ + realpathCached() { + return this.#realpath; + } + /** + * Returns the cached child Path entries array if the entry has been the + * subject of a successful readdir(), or [] otherwise. + * + * Does not read the filesystem, so an empty array *could* just mean we + * don't have any cached data. Only use it if you are very sure that a + * readdir() has been called recently enough to still be valid. + */ + readdirCached() { + const children = this.children(); + return children.slice(0, children.provisional); + } + /** + * Return true if it's worth trying to readlink. Ie, we don't (yet) have + * any indication that readlink will definitely fail. + * + * Returns false if the path is known to not be a symlink, if a previous + * readlink failed, or if the entry does not exist. + */ + canReadlink() { + if (this.#linkTarget) + return true; + if (!this.parent) + return false; + // cases where it cannot possibly succeed + const ifmt = this.#type & IFMT; + return !((ifmt !== UNKNOWN && ifmt !== IFLNK) || + this.#type & ENOREADLINK || + this.#type & ENOENT); + } + /** + * Return true if readdir has previously been successfully called on this + * path, indicating that cachedReaddir() is likely valid. + */ + calledReaddir() { + return !!(this.#type & READDIR_CALLED); + } + /** + * Returns true if the path is known to not exist. That is, a previous lstat + * or readdir failed to verify its existence when that would have been + * expected, or a parent entry was marked either enoent or enotdir. + */ + isENOENT() { + return !!(this.#type & ENOENT); + } + /** + * Return true if the path is a match for the given path name. This handles + * case sensitivity and unicode normalization. + * + * Note: even on case-sensitive systems, it is **not** safe to test the + * equality of the `.name` property to determine whether a given pathname + * matches, due to unicode normalization mismatches. + * + * Always use this method instead of testing the `path.name` property + * directly. + */ + isNamed(n) { + return !this.nocase ? + this.#matchName === normalize(n) + : this.#matchName === normalizeNocase(n); + } + /** + * Return the Path object corresponding to the target of a symbolic link. + * + * If the Path is not a symbolic link, or if the readlink call fails for any + * reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + */ + async readlink() { + const target = this.#linkTarget; + if (target) { + return target; + } + if (!this.canReadlink()) { + return undefined; + } + /* c8 ignore start */ + // already covered by the canReadlink test, here for ts grumples + if (!this.parent) { + return undefined; + } + /* c8 ignore stop */ + try { + const read = await this.#fs.promises.readlink(this.fullpath()); + const linkTarget = (await this.parent.realpath())?.resolve(read); + if (linkTarget) { + return (this.#linkTarget = linkTarget); + } + } + catch (er) { + this.#readlinkFail(er.code); + return undefined; + } + } + /** + * Synchronous {@link PathBase.readlink} + */ + readlinkSync() { + const target = this.#linkTarget; + if (target) { + return target; + } + if (!this.canReadlink()) { + return undefined; + } + /* c8 ignore start */ + // already covered by the canReadlink test, here for ts grumples + if (!this.parent) { + return undefined; + } + /* c8 ignore stop */ + try { + const read = this.#fs.readlinkSync(this.fullpath()); + const linkTarget = this.parent.realpathSync()?.resolve(read); + if (linkTarget) { + return (this.#linkTarget = linkTarget); + } + } + catch (er) { + this.#readlinkFail(er.code); + return undefined; + } + } + #readdirSuccess(children) { + // succeeded, mark readdir called bit + this.#type |= READDIR_CALLED; + // mark all remaining provisional children as ENOENT + for (let p = children.provisional; p < children.length; p++) { + const c = children[p]; + if (c) + c.#markENOENT(); + } + } + #markENOENT() { + // mark as UNKNOWN and ENOENT + if (this.#type & ENOENT) + return; + this.#type = (this.#type | ENOENT) & IFMT_UNKNOWN; + this.#markChildrenENOENT(); + } + #markChildrenENOENT() { + // all children are provisional and do not exist + const children = this.children(); + children.provisional = 0; + for (const p of children) { + p.#markENOENT(); + } + } + #markENOREALPATH() { + this.#type |= ENOREALPATH; + this.#markENOTDIR(); + } + // save the information when we know the entry is not a dir + #markENOTDIR() { + // entry is not a directory, so any children can't exist. + // this *should* be impossible, since any children created + // after it's been marked ENOTDIR should be marked ENOENT, + // so it won't even get to this point. + /* c8 ignore start */ + if (this.#type & ENOTDIR) + return; + /* c8 ignore stop */ + let t = this.#type; + // this could happen if we stat a dir, then delete it, + // then try to read it or one of its children. + if ((t & IFMT) === IFDIR) + t &= IFMT_UNKNOWN; + this.#type = t | ENOTDIR; + this.#markChildrenENOENT(); + } + #readdirFail(code = '') { + // markENOTDIR and markENOENT also set provisional=0 + if (code === 'ENOTDIR' || code === 'EPERM') { + this.#markENOTDIR(); + } + else if (code === 'ENOENT') { + this.#markENOENT(); + } + else { + this.children().provisional = 0; + } + } + #lstatFail(code = '') { + // Windows just raises ENOENT in this case, disable for win CI + /* c8 ignore start */ + if (code === 'ENOTDIR') { + // already know it has a parent by this point + const p = this.parent; + p.#markENOTDIR(); + } + else if (code === 'ENOENT') { + /* c8 ignore stop */ + this.#markENOENT(); + } + } + #readlinkFail(code = '') { + let ter = this.#type; + ter |= ENOREADLINK; + if (code === 'ENOENT') + ter |= ENOENT; + // windows gets a weird error when you try to readlink a file + if (code === 'EINVAL' || code === 'UNKNOWN') { + // exists, but not a symlink, we don't know WHAT it is, so remove + // all IFMT bits. + ter &= IFMT_UNKNOWN; + } + this.#type = ter; + // windows just gets ENOENT in this case. We do cover the case, + // just disabled because it's impossible on Windows CI + /* c8 ignore start */ + if (code === 'ENOTDIR' && this.parent) { + this.parent.#markENOTDIR(); + } + /* c8 ignore stop */ + } + #readdirAddChild(e, c) { + return (this.#readdirMaybePromoteChild(e, c) || + this.#readdirAddNewChild(e, c)); + } + #readdirAddNewChild(e, c) { + // alloc new entry at head, so it's never provisional + const type = entToType(e); + const child = this.newChild(e.name, type, { parent: this }); + const ifmt = child.#type & IFMT; + if (ifmt !== IFDIR && ifmt !== IFLNK && ifmt !== UNKNOWN) { + child.#type |= ENOTDIR; + } + c.unshift(child); + c.provisional++; + return child; + } + #readdirMaybePromoteChild(e, c) { + for (let p = c.provisional; p < c.length; p++) { + const pchild = c[p]; + const name = this.nocase ? normalizeNocase(e.name) : normalize(e.name); + if (name !== pchild.#matchName) { + continue; + } + return this.#readdirPromoteChild(e, pchild, p, c); + } + } + #readdirPromoteChild(e, p, index, c) { + const v = p.name; + // retain any other flags, but set ifmt from dirent + p.#type = (p.#type & IFMT_UNKNOWN) | entToType(e); + // case sensitivity fixing when we learn the true name. + if (v !== e.name) + p.name = e.name; + // just advance provisional index (potentially off the list), + // otherwise we have to splice/pop it out and re-insert at head + if (index !== c.provisional) { + if (index === c.length - 1) + c.pop(); + else + c.splice(index, 1); + c.unshift(p); + } + c.provisional++; + return p; + } + /** + * Call lstat() on this Path, and update all known information that can be + * determined. + * + * Note that unlike `fs.lstat()`, the returned value does not contain some + * information, such as `mode`, `dev`, `nlink`, and `ino`. If that + * information is required, you will need to call `fs.lstat` yourself. + * + * If the Path refers to a nonexistent file, or if the lstat call fails for + * any reason, `undefined` is returned. Otherwise the updated Path object is + * returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + async lstat() { + if ((this.#type & ENOENT) === 0) { + try { + this.#applyStat(await this.#fs.promises.lstat(this.fullpath())); + return this; + } + catch (er) { + this.#lstatFail(er.code); + } + } + } + /** + * synchronous {@link PathBase.lstat} + */ + lstatSync() { + if ((this.#type & ENOENT) === 0) { + try { + this.#applyStat(this.#fs.lstatSync(this.fullpath())); + return this; + } + catch (er) { + this.#lstatFail(er.code); + } + } + } + #applyStat(st) { + const { atime, atimeMs, birthtime, birthtimeMs, blksize, blocks, ctime, ctimeMs, dev, gid, ino, mode, mtime, mtimeMs, nlink, rdev, size, uid, } = st; + this.#atime = atime; + this.#atimeMs = atimeMs; + this.#birthtime = birthtime; + this.#birthtimeMs = birthtimeMs; + this.#blksize = blksize; + this.#blocks = blocks; + this.#ctime = ctime; + this.#ctimeMs = ctimeMs; + this.#dev = dev; + this.#gid = gid; + this.#ino = ino; + this.#mode = mode; + this.#mtime = mtime; + this.#mtimeMs = mtimeMs; + this.#nlink = nlink; + this.#rdev = rdev; + this.#size = size; + this.#uid = uid; + const ifmt = entToType(st); + // retain any other flags, but set the ifmt + this.#type = (this.#type & IFMT_UNKNOWN) | ifmt | LSTAT_CALLED; + if (ifmt !== UNKNOWN && ifmt !== IFDIR && ifmt !== IFLNK) { + this.#type |= ENOTDIR; + } + } + #onReaddirCB = []; + #readdirCBInFlight = false; + #callOnReaddirCB(children) { + this.#readdirCBInFlight = false; + const cbs = this.#onReaddirCB.slice(); + this.#onReaddirCB.length = 0; + cbs.forEach(cb => cb(null, children)); + } + /** + * Standard node-style callback interface to get list of directory entries. + * + * If the Path cannot or does not contain any children, then an empty array + * is returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + * + * @param cb The callback called with (er, entries). Note that the `er` + * param is somewhat extraneous, as all readdir() errors are handled and + * simply result in an empty set of entries being returned. + * @param allowZalgo Boolean indicating that immediately known results should + * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release + * zalgo at your peril, the dark pony lord is devious and unforgiving. + */ + readdirCB(cb, allowZalgo = false) { + if (!this.canReaddir()) { + if (allowZalgo) + cb(null, []); + else + queueMicrotask(() => cb(null, [])); + return; + } + const children = this.children(); + if (this.calledReaddir()) { + const c = children.slice(0, children.provisional); + if (allowZalgo) + cb(null, c); + else + queueMicrotask(() => cb(null, c)); + return; + } + // don't have to worry about zalgo at this point. + this.#onReaddirCB.push(cb); + if (this.#readdirCBInFlight) { + return; + } + this.#readdirCBInFlight = true; + // else read the directory, fill up children + // de-provisionalize any provisional children. + const fullpath = this.fullpath(); + this.#fs.readdir(fullpath, { withFileTypes: true }, (er, entries) => { + if (er) { + this.#readdirFail(er.code); + children.provisional = 0; + } + else { + // if we didn't get an error, we always get entries. + //@ts-ignore + for (const e of entries) { + this.#readdirAddChild(e, children); + } + this.#readdirSuccess(children); + } + this.#callOnReaddirCB(children.slice(0, children.provisional)); + return; + }); + } + #asyncReaddirInFlight; + /** + * Return an array of known child entries. + * + * If the Path cannot or does not contain any children, then an empty array + * is returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + async readdir() { + if (!this.canReaddir()) { + return []; + } + const children = this.children(); + if (this.calledReaddir()) { + return children.slice(0, children.provisional); + } + // else read the directory, fill up children + // de-provisionalize any provisional children. + const fullpath = this.fullpath(); + if (this.#asyncReaddirInFlight) { + await this.#asyncReaddirInFlight; + } + else { + /* c8 ignore start */ + let resolve = () => { }; + /* c8 ignore stop */ + this.#asyncReaddirInFlight = new Promise(res => (resolve = res)); + try { + for (const e of await this.#fs.promises.readdir(fullpath, { + withFileTypes: true, + })) { + this.#readdirAddChild(e, children); + } + this.#readdirSuccess(children); + } + catch (er) { + this.#readdirFail(er.code); + children.provisional = 0; + } + this.#asyncReaddirInFlight = undefined; + resolve(); + } + return children.slice(0, children.provisional); + } + /** + * synchronous {@link PathBase.readdir} + */ + readdirSync() { + if (!this.canReaddir()) { + return []; + } + const children = this.children(); + if (this.calledReaddir()) { + return children.slice(0, children.provisional); + } + // else read the directory, fill up children + // de-provisionalize any provisional children. + const fullpath = this.fullpath(); + try { + for (const e of this.#fs.readdirSync(fullpath, { + withFileTypes: true, + })) { + this.#readdirAddChild(e, children); + } + this.#readdirSuccess(children); + } + catch (er) { + this.#readdirFail(er.code); + children.provisional = 0; + } + return children.slice(0, children.provisional); + } + canReaddir() { + if (this.#type & ENOCHILD) + return false; + const ifmt = IFMT & this.#type; + // we always set ENOTDIR when setting IFMT, so should be impossible + /* c8 ignore start */ + if (!(ifmt === UNKNOWN || ifmt === IFDIR || ifmt === IFLNK)) { + return false; + } + /* c8 ignore stop */ + return true; + } + shouldWalk(dirs, walkFilter) { + return ((this.#type & IFDIR) === IFDIR && + !(this.#type & ENOCHILD) && + !dirs.has(this) && + (!walkFilter || walkFilter(this))); + } + /** + * Return the Path object corresponding to path as resolved + * by realpath(3). + * + * If the realpath call fails for any reason, `undefined` is returned. + * + * Result is cached, and thus may be outdated if the filesystem is mutated. + * On success, returns a Path object. + */ + async realpath() { + if (this.#realpath) + return this.#realpath; + if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type) + return undefined; + try { + const rp = await this.#fs.promises.realpath(this.fullpath()); + return (this.#realpath = this.resolve(rp)); + } + catch (_) { + this.#markENOREALPATH(); + } + } + /** + * Synchronous {@link realpath} + */ + realpathSync() { + if (this.#realpath) + return this.#realpath; + if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type) + return undefined; + try { + const rp = this.#fs.realpathSync(this.fullpath()); + return (this.#realpath = this.resolve(rp)); + } + catch (_) { + this.#markENOREALPATH(); + } + } + /** + * Internal method to mark this Path object as the scurry cwd, + * called by {@link PathScurry#chdir} + * + * @internal + */ + [setAsCwd](oldCwd) { + if (oldCwd === this) + return; + oldCwd.isCWD = false; + this.isCWD = true; + const changed = new Set([]); + let rp = []; + let p = this; + while (p && p.parent) { + changed.add(p); + p.#relative = rp.join(this.sep); + p.#relativePosix = rp.join('/'); + p = p.parent; + rp.push('..'); + } + // now un-memoize parents of old cwd + p = oldCwd; + while (p && p.parent && !changed.has(p)) { + p.#relative = undefined; + p.#relativePosix = undefined; + p = p.parent; + } + } +} +/** + * Path class used on win32 systems + * + * Uses `'\\'` as the path separator for returned paths, either `'\\'` or `'/'` + * as the path separator for parsing paths. + */ +export class PathWin32 extends PathBase { + /** + * Separator for generating path strings. + */ + sep = '\\'; + /** + * Separator for parsing path strings. + */ + splitSep = eitherSep; + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) { + super(name, type, root, roots, nocase, children, opts); + } + /** + * @internal + */ + newChild(name, type = UNKNOWN, opts = {}) { + return new PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts); + } + /** + * @internal + */ + getRootString(path) { + return win32.parse(path).root; + } + /** + * @internal + */ + getRoot(rootPath) { + rootPath = uncToDrive(rootPath.toUpperCase()); + if (rootPath === this.root.name) { + return this.root; + } + // ok, not that one, check if it matches another we know about + for (const [compare, root] of Object.entries(this.roots)) { + if (this.sameRoot(rootPath, compare)) { + return (this.roots[rootPath] = root); + } + } + // otherwise, have to create a new one. + return (this.roots[rootPath] = new PathScurryWin32(rootPath, this).root); + } + /** + * @internal + */ + sameRoot(rootPath, compare = this.root.name) { + // windows can (rarely) have case-sensitive filesystem, but + // UNC and drive letters are always case-insensitive, and canonically + // represented uppercase. + rootPath = rootPath + .toUpperCase() + .replace(/\//g, '\\') + .replace(uncDriveRegexp, '$1\\'); + return rootPath === compare; + } +} +/** + * Path class used on all posix systems. + * + * Uses `'/'` as the path separator. + */ +export class PathPosix extends PathBase { + /** + * separator for parsing path strings + */ + splitSep = '/'; + /** + * separator for generating path strings + */ + sep = '/'; + /** + * Do not create new Path objects directly. They should always be accessed + * via the PathScurry class or other methods on the Path class. + * + * @internal + */ + constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) { + super(name, type, root, roots, nocase, children, opts); + } + /** + * @internal + */ + getRootString(path) { + return path.startsWith('/') ? '/' : ''; + } + /** + * @internal + */ + getRoot(_rootPath) { + return this.root; + } + /** + * @internal + */ + newChild(name, type = UNKNOWN, opts = {}) { + return new PathPosix(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts); + } +} +/** + * The base class for all PathScurry classes, providing the interface for path + * resolution and filesystem operations. + * + * Typically, you should *not* instantiate this class directly, but rather one + * of the platform-specific classes, or the exported {@link PathScurry} which + * defaults to the current platform. + */ +export class PathScurryBase { + /** + * The root Path entry for the current working directory of this Scurry + */ + root; + /** + * The string path for the root of this Scurry's current working directory + */ + rootPath; + /** + * A collection of all roots encountered, referenced by rootPath + */ + roots; + /** + * The Path entry corresponding to this PathScurry's current working directory. + */ + cwd; + #resolveCache; + #resolvePosixCache; + #children; + /** + * Perform path comparisons case-insensitively. + * + * Defaults true on Darwin and Windows systems, false elsewhere. + */ + nocase; + #fs; + /** + * This class should not be instantiated directly. + * + * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry + * + * @internal + */ + constructor(cwd = process.cwd(), pathImpl, sep, { nocase, childrenCacheSize = 16 * 1024, fs = defaultFS, } = {}) { + this.#fs = fsFromOption(fs); + if (cwd instanceof URL || cwd.startsWith('file://')) { + cwd = fileURLToPath(cwd); + } + // resolve and split root, and then add to the store. + // this is the only time we call path.resolve() + const cwdPath = pathImpl.resolve(cwd); + this.roots = Object.create(null); + this.rootPath = this.parseRootPath(cwdPath); + this.#resolveCache = new ResolveCache(); + this.#resolvePosixCache = new ResolveCache(); + this.#children = new ChildrenCache(childrenCacheSize); + const split = cwdPath.substring(this.rootPath.length).split(sep); + // resolve('/') leaves '', splits to [''], we don't want that. + if (split.length === 1 && !split[0]) { + split.pop(); + } + /* c8 ignore start */ + if (nocase === undefined) { + throw new TypeError('must provide nocase setting to PathScurryBase ctor'); + } + /* c8 ignore stop */ + this.nocase = nocase; + this.root = this.newRoot(this.#fs); + this.roots[this.rootPath] = this.root; + let prev = this.root; + let len = split.length - 1; + const joinSep = pathImpl.sep; + let abs = this.rootPath; + let sawFirst = false; + for (const part of split) { + const l = len--; + prev = prev.child(part, { + relative: new Array(l).fill('..').join(joinSep), + relativePosix: new Array(l).fill('..').join('/'), + fullpath: (abs += (sawFirst ? '' : joinSep) + part), + }); + sawFirst = true; + } + this.cwd = prev; + } + /** + * Get the depth of a provided path, string, or the cwd + */ + depth(path = this.cwd) { + if (typeof path === 'string') { + path = this.cwd.resolve(path); + } + return path.depth(); + } + /** + * Return the cache of child entries. Exposed so subclasses can create + * child Path objects in a platform-specific way. + * + * @internal + */ + childrenCache() { + return this.#children; + } + /** + * Resolve one or more path strings to a resolved string + * + * Same interface as require('path').resolve. + * + * Much faster than path.resolve() when called multiple times for the same + * path, because the resolved Path objects are cached. Much slower + * otherwise. + */ + resolve(...paths) { + // first figure out the minimum number of paths we have to test + // we always start at cwd, but any absolutes will bump the start + let r = ''; + for (let i = paths.length - 1; i >= 0; i--) { + const p = paths[i]; + if (!p || p === '.') + continue; + r = r ? `${p}/${r}` : p; + if (this.isAbsolute(p)) { + break; + } + } + const cached = this.#resolveCache.get(r); + if (cached !== undefined) { + return cached; + } + const result = this.cwd.resolve(r).fullpath(); + this.#resolveCache.set(r, result); + return result; + } + /** + * Resolve one or more path strings to a resolved string, returning + * the posix path. Identical to .resolve() on posix systems, but on + * windows will return a forward-slash separated UNC path. + * + * Same interface as require('path').resolve. + * + * Much faster than path.resolve() when called multiple times for the same + * path, because the resolved Path objects are cached. Much slower + * otherwise. + */ + resolvePosix(...paths) { + // first figure out the minimum number of paths we have to test + // we always start at cwd, but any absolutes will bump the start + let r = ''; + for (let i = paths.length - 1; i >= 0; i--) { + const p = paths[i]; + if (!p || p === '.') + continue; + r = r ? `${p}/${r}` : p; + if (this.isAbsolute(p)) { + break; + } + } + const cached = this.#resolvePosixCache.get(r); + if (cached !== undefined) { + return cached; + } + const result = this.cwd.resolve(r).fullpathPosix(); + this.#resolvePosixCache.set(r, result); + return result; + } + /** + * find the relative path from the cwd to the supplied path string or entry + */ + relative(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return entry.relative(); + } + /** + * find the relative path from the cwd to the supplied path string or + * entry, using / as the path delimiter, even on Windows. + */ + relativePosix(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return entry.relativePosix(); + } + /** + * Return the basename for the provided string or Path object + */ + basename(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return entry.name; + } + /** + * Return the dirname for the provided string or Path object + */ + dirname(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return (entry.parent || entry).fullpath(); + } + async readdir(entry = this.cwd, opts = { + withFileTypes: true, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes } = opts; + if (!entry.canReaddir()) { + return []; + } + else { + const p = await entry.readdir(); + return withFileTypes ? p : p.map(e => e.name); + } + } + readdirSync(entry = this.cwd, opts = { + withFileTypes: true, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true } = opts; + if (!entry.canReaddir()) { + return []; + } + else if (withFileTypes) { + return entry.readdirSync(); + } + else { + return entry.readdirSync().map(e => e.name); + } + } + /** + * Call lstat() on the string or Path object, and update all known + * information that can be determined. + * + * Note that unlike `fs.lstat()`, the returned value does not contain some + * information, such as `mode`, `dev`, `nlink`, and `ino`. If that + * information is required, you will need to call `fs.lstat` yourself. + * + * If the Path refers to a nonexistent file, or if the lstat call fails for + * any reason, `undefined` is returned. Otherwise the updated Path object is + * returned. + * + * Results are cached, and thus may be out of date if the filesystem is + * mutated. + */ + async lstat(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return entry.lstat(); + } + /** + * synchronous {@link PathScurryBase.lstat} + */ + lstatSync(entry = this.cwd) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + return entry.lstatSync(); + } + async readlink(entry = this.cwd, { withFileTypes } = { + withFileTypes: false, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + withFileTypes = entry.withFileTypes; + entry = this.cwd; + } + const e = await entry.readlink(); + return withFileTypes ? e : e?.fullpath(); + } + readlinkSync(entry = this.cwd, { withFileTypes } = { + withFileTypes: false, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + withFileTypes = entry.withFileTypes; + entry = this.cwd; + } + const e = entry.readlinkSync(); + return withFileTypes ? e : e?.fullpath(); + } + async realpath(entry = this.cwd, { withFileTypes } = { + withFileTypes: false, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + withFileTypes = entry.withFileTypes; + entry = this.cwd; + } + const e = await entry.realpath(); + return withFileTypes ? e : e?.fullpath(); + } + realpathSync(entry = this.cwd, { withFileTypes } = { + withFileTypes: false, + }) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + withFileTypes = entry.withFileTypes; + entry = this.cwd; + } + const e = entry.realpathSync(); + return withFileTypes ? e : e?.fullpath(); + } + async walk(entry = this.cwd, opts = {}) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true, follow = false, filter, walkFilter, } = opts; + const results = []; + if (!filter || filter(entry)) { + results.push(withFileTypes ? entry : entry.fullpath()); + } + const dirs = new Set(); + const walk = (dir, cb) => { + dirs.add(dir); + dir.readdirCB((er, entries) => { + /* c8 ignore start */ + if (er) { + return cb(er); + } + /* c8 ignore stop */ + let len = entries.length; + if (!len) + return cb(); + const next = () => { + if (--len === 0) { + cb(); + } + }; + for (const e of entries) { + if (!filter || filter(e)) { + results.push(withFileTypes ? e : e.fullpath()); + } + if (follow && e.isSymbolicLink()) { + e.realpath() + .then(r => (r?.isUnknown() ? r.lstat() : r)) + .then(r => r?.shouldWalk(dirs, walkFilter) ? walk(r, next) : next()); + } + else { + if (e.shouldWalk(dirs, walkFilter)) { + walk(e, next); + } + else { + next(); + } + } + } + }, true); // zalgooooooo + }; + const start = entry; + return new Promise((res, rej) => { + walk(start, er => { + /* c8 ignore start */ + if (er) + return rej(er); + /* c8 ignore stop */ + res(results); + }); + }); + } + walkSync(entry = this.cwd, opts = {}) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true, follow = false, filter, walkFilter, } = opts; + const results = []; + if (!filter || filter(entry)) { + results.push(withFileTypes ? entry : entry.fullpath()); + } + const dirs = new Set([entry]); + for (const dir of dirs) { + const entries = dir.readdirSync(); + for (const e of entries) { + if (!filter || filter(e)) { + results.push(withFileTypes ? e : e.fullpath()); + } + let r = e; + if (e.isSymbolicLink()) { + if (!(follow && (r = e.realpathSync()))) + continue; + if (r.isUnknown()) + r.lstatSync(); + } + if (r.shouldWalk(dirs, walkFilter)) { + dirs.add(r); + } + } + } + return results; + } + /** + * Support for `for await` + * + * Alias for {@link PathScurryBase.iterate} + * + * Note: As of Node 19, this is very slow, compared to other methods of + * walking. Consider using {@link PathScurryBase.stream} if memory overhead + * and backpressure are concerns, or {@link PathScurryBase.walk} if not. + */ + [Symbol.asyncIterator]() { + return this.iterate(); + } + iterate(entry = this.cwd, options = {}) { + // iterating async over the stream is significantly more performant, + // especially in the warm-cache scenario, because it buffers up directory + // entries in the background instead of waiting for a yield for each one. + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + options = entry; + entry = this.cwd; + } + return this.stream(entry, options)[Symbol.asyncIterator](); + } + /** + * Iterating over a PathScurry performs a synchronous walk. + * + * Alias for {@link PathScurryBase.iterateSync} + */ + [Symbol.iterator]() { + return this.iterateSync(); + } + *iterateSync(entry = this.cwd, opts = {}) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true, follow = false, filter, walkFilter, } = opts; + if (!filter || filter(entry)) { + yield withFileTypes ? entry : entry.fullpath(); + } + const dirs = new Set([entry]); + for (const dir of dirs) { + const entries = dir.readdirSync(); + for (const e of entries) { + if (!filter || filter(e)) { + yield withFileTypes ? e : e.fullpath(); + } + let r = e; + if (e.isSymbolicLink()) { + if (!(follow && (r = e.realpathSync()))) + continue; + if (r.isUnknown()) + r.lstatSync(); + } + if (r.shouldWalk(dirs, walkFilter)) { + dirs.add(r); + } + } + } + } + stream(entry = this.cwd, opts = {}) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true, follow = false, filter, walkFilter, } = opts; + const results = new Minipass({ objectMode: true }); + if (!filter || filter(entry)) { + results.write(withFileTypes ? entry : entry.fullpath()); + } + const dirs = new Set(); + const queue = [entry]; + let processing = 0; + const process = () => { + let paused = false; + while (!paused) { + const dir = queue.shift(); + if (!dir) { + if (processing === 0) + results.end(); + return; + } + processing++; + dirs.add(dir); + const onReaddir = (er, entries, didRealpaths = false) => { + /* c8 ignore start */ + if (er) + return results.emit('error', er); + /* c8 ignore stop */ + if (follow && !didRealpaths) { + const promises = []; + for (const e of entries) { + if (e.isSymbolicLink()) { + promises.push(e + .realpath() + .then((r) => r?.isUnknown() ? r.lstat() : r)); + } + } + if (promises.length) { + Promise.all(promises).then(() => onReaddir(null, entries, true)); + return; + } + } + for (const e of entries) { + if (e && (!filter || filter(e))) { + if (!results.write(withFileTypes ? e : e.fullpath())) { + paused = true; + } + } + } + processing--; + for (const e of entries) { + const r = e.realpathCached() || e; + if (r.shouldWalk(dirs, walkFilter)) { + queue.push(r); + } + } + if (paused && !results.flowing) { + results.once('drain', process); + } + else if (!sync) { + process(); + } + }; + // zalgo containment + let sync = true; + dir.readdirCB(onReaddir, true); + sync = false; + } + }; + process(); + return results; + } + streamSync(entry = this.cwd, opts = {}) { + if (typeof entry === 'string') { + entry = this.cwd.resolve(entry); + } + else if (!(entry instanceof PathBase)) { + opts = entry; + entry = this.cwd; + } + const { withFileTypes = true, follow = false, filter, walkFilter, } = opts; + const results = new Minipass({ objectMode: true }); + const dirs = new Set(); + if (!filter || filter(entry)) { + results.write(withFileTypes ? entry : entry.fullpath()); + } + const queue = [entry]; + let processing = 0; + const process = () => { + let paused = false; + while (!paused) { + const dir = queue.shift(); + if (!dir) { + if (processing === 0) + results.end(); + return; + } + processing++; + dirs.add(dir); + const entries = dir.readdirSync(); + for (const e of entries) { + if (!filter || filter(e)) { + if (!results.write(withFileTypes ? e : e.fullpath())) { + paused = true; + } + } + } + processing--; + for (const e of entries) { + let r = e; + if (e.isSymbolicLink()) { + if (!(follow && (r = e.realpathSync()))) + continue; + if (r.isUnknown()) + r.lstatSync(); + } + if (r.shouldWalk(dirs, walkFilter)) { + queue.push(r); + } + } + } + if (paused && !results.flowing) + results.once('drain', process); + }; + process(); + return results; + } + chdir(path = this.cwd) { + const oldCwd = this.cwd; + this.cwd = typeof path === 'string' ? this.cwd.resolve(path) : path; + this.cwd[setAsCwd](oldCwd); + } +} +/** + * Windows implementation of {@link PathScurryBase} + * + * Defaults to case insensitve, uses `'\\'` to generate path strings. Uses + * {@link PathWin32} for Path objects. + */ +export class PathScurryWin32 extends PathScurryBase { + /** + * separator for generating path strings + */ + sep = '\\'; + constructor(cwd = process.cwd(), opts = {}) { + const { nocase = true } = opts; + super(cwd, win32, '\\', { ...opts, nocase }); + this.nocase = nocase; + for (let p = this.cwd; p; p = p.parent) { + p.nocase = this.nocase; + } + } + /** + * @internal + */ + parseRootPath(dir) { + // if the path starts with a single separator, it's not a UNC, and we'll + // just get separator as the root, and driveFromUNC will return \ + // In that case, mount \ on the root from the cwd. + return win32.parse(dir).root.toUpperCase(); + } + /** + * @internal + */ + newRoot(fs) { + return new PathWin32(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs }); + } + /** + * Return true if the provided path string is an absolute path + */ + isAbsolute(p) { + return (p.startsWith('/') || p.startsWith('\\') || /^[a-z]:(\/|\\)/i.test(p)); + } +} +/** + * {@link PathScurryBase} implementation for all posix systems other than Darwin. + * + * Defaults to case-sensitive matching, uses `'/'` to generate path strings. + * + * Uses {@link PathPosix} for Path objects. + */ +export class PathScurryPosix extends PathScurryBase { + /** + * separator for generating path strings + */ + sep = '/'; + constructor(cwd = process.cwd(), opts = {}) { + const { nocase = false } = opts; + super(cwd, posix, '/', { ...opts, nocase }); + this.nocase = nocase; + } + /** + * @internal + */ + parseRootPath(_dir) { + return '/'; + } + /** + * @internal + */ + newRoot(fs) { + return new PathPosix(this.rootPath, IFDIR, undefined, this.roots, this.nocase, this.childrenCache(), { fs }); + } + /** + * Return true if the provided path string is an absolute path + */ + isAbsolute(p) { + return p.startsWith('/'); + } +} +/** + * {@link PathScurryBase} implementation for Darwin (macOS) systems. + * + * Defaults to case-insensitive matching, uses `'/'` for generating path + * strings. + * + * Uses {@link PathPosix} for Path objects. + */ +export class PathScurryDarwin extends PathScurryPosix { + constructor(cwd = process.cwd(), opts = {}) { + const { nocase = true } = opts; + super(cwd, { ...opts, nocase }); + } +} +/** + * Default {@link PathBase} implementation for the current platform. + * + * {@link PathWin32} on Windows systems, {@link PathPosix} on all others. + */ +export const Path = process.platform === 'win32' ? PathWin32 : PathPosix; +/** + * Default {@link PathScurryBase} implementation for the current platform. + * + * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on + * Darwin (macOS) systems, {@link PathScurryPosix} on all others. + */ +export const PathScurry = process.platform === 'win32' ? PathScurryWin32 + : process.platform === 'darwin' ? PathScurryDarwin + : PathScurryPosix; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/path-scurry/dist/esm/index.js.map b/node_modules/path-scurry/dist/esm/index.js.map new file mode 100644 index 00000000..7e01bd25 --- /dev/null +++ b/node_modules/path-scurry/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EACL,SAAS,EACT,OAAO,IAAI,SAAS,EACpB,WAAW,EACX,YAAY,EACZ,YAAY,IAAI,GAAG,GACpB,MAAM,IAAI,CAAA;AACX,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAA;AAEnC,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAA;AAC/B,yDAAyD;AACzD,8CAA8C;AAE9C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAErE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAqEnC,MAAM,SAAS,GAAY;IACzB,SAAS;IACT,OAAO,EAAE,SAAS;IAClB,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,QAAQ,EAAE;QACR,KAAK;QACL,OAAO;QACP,QAAQ;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,CAAA;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,IAAY;QACxB,OAAO,GAAG,CAAA;IACZ,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,EAAW;QACjB,OAAO,IAAI,SAAS,CAClB,IAAI,CAAC,QAAQ,EACb,KAAK,EACL,SAAS,EACT,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,aAAa,EAAE,EACpB,EAAE,EAAE,EAAE,CACP,CAAA;IACH,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,CAAS;QAClB,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAiB,SAAQ,eAAe;IACnD,YACE,MAAoB,OAAO,CAAC,GAAG,EAAE,EACjC,OAAuB,EAAE;QAEzB,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;QAC9B,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;IACjC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA;AAGxE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAIrB,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe;IAC9C,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB;QAClD,CAAC,CAAC,eAAe,CAAA","sourcesContent":["import { LRUCache } from 'lru-cache'\nimport { posix, win32 } from 'node:path'\n\nimport { fileURLToPath } from 'node:url'\n\nimport {\n lstatSync,\n readdir as readdirCB,\n readdirSync,\n readlinkSync,\n realpathSync as rps,\n} from 'fs'\nimport * as actualFS from 'node:fs'\n\nconst realpathSync = rps.native\n// TODO: test perf of fs/promises realpath vs realpathCB,\n// since the promises one uses realpath.native\n\nimport { lstat, readdir, readlink, realpath } from 'node:fs/promises'\n\nimport { Minipass } from 'minipass'\nimport type { Dirent, Stats } from 'node:fs'\n\n/**\n * An object that will be used to override the default `fs`\n * methods. Any methods that are not overridden will use Node's\n * built-in implementations.\n *\n * - lstatSync\n * - readdir (callback `withFileTypes` Dirent variant, used for\n * readdirCB and most walks)\n * - readdirSync\n * - readlinkSync\n * - realpathSync\n * - promises: Object containing the following async methods:\n * - lstat\n * - readdir (Dirent variant only)\n * - readlink\n * - realpath\n */\nexport interface FSOption {\n lstatSync?: (path: string) => Stats\n readdir?: (\n path: string,\n options: { withFileTypes: true },\n cb: (er: NodeJS.ErrnoException | null, entries?: Dirent[]) => any,\n ) => void\n readdirSync?: (\n path: string,\n options: { withFileTypes: true },\n ) => Dirent[]\n readlinkSync?: (path: string) => string\n realpathSync?: (path: string) => string\n promises?: {\n lstat?: (path: string) => Promise\n readdir?: (\n path: string,\n options: { withFileTypes: true },\n ) => Promise\n readlink?: (path: string) => Promise\n realpath?: (path: string) => Promise\n [k: string]: any\n }\n [k: string]: any\n}\n\ninterface FSValue {\n lstatSync: (path: string) => Stats\n readdir: (\n path: string,\n options: { withFileTypes: true },\n cb: (er: NodeJS.ErrnoException | null, entries?: Dirent[]) => any,\n ) => void\n readdirSync: (path: string, options: { withFileTypes: true }) => Dirent[]\n readlinkSync: (path: string) => string\n realpathSync: (path: string) => string\n promises: {\n lstat: (path: string) => Promise\n readdir: (\n path: string,\n options: { withFileTypes: true },\n ) => Promise\n readlink: (path: string) => Promise\n realpath: (path: string) => Promise\n [k: string]: any\n }\n [k: string]: any\n}\n\nconst defaultFS: FSValue = {\n lstatSync,\n readdir: readdirCB,\n readdirSync,\n readlinkSync,\n realpathSync,\n promises: {\n lstat,\n readdir,\n readlink,\n realpath,\n },\n}\n\n// if they just gave us require('fs') then use our default\nconst fsFromOption = (fsOption?: FSOption): FSValue =>\n !fsOption || fsOption === defaultFS || fsOption === actualFS ?\n defaultFS\n : {\n ...defaultFS,\n ...fsOption,\n promises: {\n ...defaultFS.promises,\n ...(fsOption.promises || {}),\n },\n }\n\n// turn something like //?/c:/ into c:\\\nconst uncDriveRegexp = /^\\\\\\\\\\?\\\\([a-z]:)\\\\?$/i\nconst uncToDrive = (rootPath: string): string =>\n rootPath.replace(/\\//g, '\\\\').replace(uncDriveRegexp, '$1\\\\')\n\n// windows paths are separated by either / or \\\nconst eitherSep = /[\\\\\\/]/\n\nconst UNKNOWN = 0 // may not even exist, for all we know\nconst IFIFO = 0b0001\nconst IFCHR = 0b0010\nconst IFDIR = 0b0100\nconst IFBLK = 0b0110\nconst IFREG = 0b1000\nconst IFLNK = 0b1010\nconst IFSOCK = 0b1100\nconst IFMT = 0b1111\n\nexport type Type =\n | 'Unknown'\n | 'FIFO'\n | 'CharacterDevice'\n | 'Directory'\n | 'BlockDevice'\n | 'File'\n | 'SymbolicLink'\n | 'Socket'\n\n// mask to unset low 4 bits\nconst IFMT_UNKNOWN = ~IFMT\n\n// set after successfully calling readdir() and getting entries.\nconst READDIR_CALLED = 0b0000_0001_0000\n// set after a successful lstat()\nconst LSTAT_CALLED = 0b0000_0010_0000\n// set if an entry (or one of its parents) is definitely not a dir\nconst ENOTDIR = 0b0000_0100_0000\n// set if an entry (or one of its parents) does not exist\n// (can also be set on lstat errors like EACCES or ENAMETOOLONG)\nconst ENOENT = 0b0000_1000_0000\n// cannot have child entries -- also verify &IFMT is either IFDIR or IFLNK\n// set if we fail to readlink\nconst ENOREADLINK = 0b0001_0000_0000\n// set if we know realpath() will fail\nconst ENOREALPATH = 0b0010_0000_0000\n\nconst ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH\nconst TYPEMASK = 0b0011_1111_1111\n\nconst entToType = (s: Dirent | Stats) =>\n s.isFile() ? IFREG\n : s.isDirectory() ? IFDIR\n : s.isSymbolicLink() ? IFLNK\n : s.isCharacterDevice() ? IFCHR\n : s.isBlockDevice() ? IFBLK\n : s.isSocket() ? IFSOCK\n : s.isFIFO() ? IFIFO\n : UNKNOWN\n\n// normalize unicode path names\nconst normalizeCache = new Map()\nconst normalize = (s: string) => {\n const c = normalizeCache.get(s)\n if (c) return c\n const n = s.normalize('NFKD')\n normalizeCache.set(s, n)\n return n\n}\n\nconst normalizeNocaseCache = new Map()\nconst normalizeNocase = (s: string) => {\n const c = normalizeNocaseCache.get(s)\n if (c) return c\n const n = normalize(s.toLowerCase())\n normalizeNocaseCache.set(s, n)\n return n\n}\n\n/**\n * Options that may be provided to the Path constructor\n */\nexport interface PathOpts {\n fullpath?: string\n relative?: string\n relativePosix?: string\n parent?: PathBase\n /**\n * See {@link FSOption}\n */\n fs?: FSOption\n}\n\n/**\n * An LRUCache for storing resolved path strings or Path objects.\n * @internal\n */\nexport class ResolveCache extends LRUCache {\n constructor() {\n super({ max: 256 })\n }\n}\n\n// In order to prevent blowing out the js heap by allocating hundreds of\n// thousands of Path entries when walking extremely large trees, the \"children\"\n// in this tree are represented by storing an array of Path entries in an\n// LRUCache, indexed by the parent. At any time, Path.children() may return an\n// empty array, indicating that it doesn't know about any of its children, and\n// thus has to rebuild that cache. This is fine, it just means that we don't\n// benefit as much from having the cached entries, but huge directory walks\n// don't blow out the stack, and smaller ones are still as fast as possible.\n//\n//It does impose some complexity when building up the readdir data, because we\n//need to pass a reference to the children array that we started with.\n\n/**\n * an LRUCache for storing child entries.\n * @internal\n */\nexport class ChildrenCache extends LRUCache {\n constructor(maxSize: number = 16 * 1024) {\n super({\n maxSize,\n // parent + children\n sizeCalculation: a => a.length + 1,\n })\n }\n}\n\n/**\n * Array of Path objects, plus a marker indicating the first provisional entry\n *\n * @internal\n */\nexport type Children = PathBase[] & { provisional: number }\n\nconst setAsCwd = Symbol('PathScurry setAsCwd')\n\n/**\n * Path objects are sort of like a super-powered\n * {@link https://nodejs.org/docs/latest/api/fs.html#class-fsdirent fs.Dirent}\n *\n * Each one represents a single filesystem entry on disk, which may or may not\n * exist. It includes methods for reading various types of information via\n * lstat, readlink, and readdir, and caches all information to the greatest\n * degree possible.\n *\n * Note that fs operations that would normally throw will instead return an\n * \"empty\" value. This is in order to prevent excessive overhead from error\n * stack traces.\n */\nexport abstract class PathBase implements Dirent {\n /**\n * the basename of this path\n *\n * **Important**: *always* test the path name against any test string\n * usingthe {@link isNamed} method, and not by directly comparing this\n * string. Otherwise, unicode path strings that the system sees as identical\n * will not be properly treated as the same path, leading to incorrect\n * behavior and possible security issues.\n */\n name: string\n /**\n * the Path entry corresponding to the path root.\n *\n * @internal\n */\n root: PathBase\n /**\n * All roots found within the current PathScurry family\n *\n * @internal\n */\n roots: { [k: string]: PathBase }\n /**\n * a reference to the parent path, or undefined in the case of root entries\n *\n * @internal\n */\n parent?: PathBase\n /**\n * boolean indicating whether paths are compared case-insensitively\n * @internal\n */\n nocase: boolean\n\n /**\n * boolean indicating that this path is the current working directory\n * of the PathScurry collection that contains it.\n */\n isCWD: boolean = false\n\n /**\n * the string or regexp used to split paths. On posix, it is `'/'`, and on\n * windows it is a RegExp matching either `'/'` or `'\\\\'`\n */\n abstract splitSep: string | RegExp\n /**\n * The path separator string to use when joining paths\n */\n abstract sep: string\n\n // potential default fs override\n #fs: FSValue\n\n // Stats fields\n #dev?: number\n get dev() {\n return this.#dev\n }\n #mode?: number\n get mode() {\n return this.#mode\n }\n #nlink?: number\n get nlink() {\n return this.#nlink\n }\n #uid?: number\n get uid() {\n return this.#uid\n }\n #gid?: number\n get gid() {\n return this.#gid\n }\n #rdev?: number\n get rdev() {\n return this.#rdev\n }\n #blksize?: number\n get blksize() {\n return this.#blksize\n }\n #ino?: number\n get ino() {\n return this.#ino\n }\n #size?: number\n get size() {\n return this.#size\n }\n #blocks?: number\n get blocks() {\n return this.#blocks\n }\n #atimeMs?: number\n get atimeMs() {\n return this.#atimeMs\n }\n #mtimeMs?: number\n get mtimeMs() {\n return this.#mtimeMs\n }\n #ctimeMs?: number\n get ctimeMs() {\n return this.#ctimeMs\n }\n #birthtimeMs?: number\n get birthtimeMs() {\n return this.#birthtimeMs\n }\n #atime?: Date\n get atime() {\n return this.#atime\n }\n #mtime?: Date\n get mtime() {\n return this.#mtime\n }\n #ctime?: Date\n get ctime() {\n return this.#ctime\n }\n #birthtime?: Date\n get birthtime() {\n return this.#birthtime\n }\n\n #matchName: string\n #depth?: number\n #fullpath?: string\n #fullpathPosix?: string\n #relative?: string\n #relativePosix?: string\n #type: number\n #children: ChildrenCache\n #linkTarget?: PathBase\n #realpath?: PathBase\n\n /**\n * This property is for compatibility with the Dirent class as of\n * Node v20, where Dirent['parentPath'] refers to the path of the\n * directory that was passed to readdir. For root entries, it's the path\n * to the entry itself.\n */\n get parentPath(): string {\n return (this.parent || this).fullpath()\n }\n\n /**\n * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,\n * this property refers to the *parent* path, not the path object itself.\n */\n get path(): string {\n return this.parentPath\n }\n\n /**\n * Do not create new Path objects directly. They should always be accessed\n * via the PathScurry class or other methods on the Path class.\n *\n * @internal\n */\n constructor(\n name: string,\n type: number = UNKNOWN,\n root: PathBase | undefined,\n roots: { [k: string]: PathBase },\n nocase: boolean,\n children: ChildrenCache,\n opts: PathOpts,\n ) {\n this.name = name\n this.#matchName = nocase ? normalizeNocase(name) : normalize(name)\n this.#type = type & TYPEMASK\n this.nocase = nocase\n this.roots = roots\n this.root = root || this\n this.#children = children\n this.#fullpath = opts.fullpath\n this.#relative = opts.relative\n this.#relativePosix = opts.relativePosix\n this.parent = opts.parent\n if (this.parent) {\n this.#fs = this.parent.#fs\n } else {\n this.#fs = fsFromOption(opts.fs)\n }\n }\n\n /**\n * Returns the depth of the Path object from its root.\n *\n * For example, a path at `/foo/bar` would have a depth of 2.\n */\n depth(): number {\n if (this.#depth !== undefined) return this.#depth\n if (!this.parent) return (this.#depth = 0)\n return (this.#depth = this.parent.depth() + 1)\n }\n\n /**\n * @internal\n */\n abstract getRootString(path: string): string\n /**\n * @internal\n */\n abstract getRoot(rootPath: string): PathBase\n /**\n * @internal\n */\n abstract newChild(name: string, type?: number, opts?: PathOpts): PathBase\n\n /**\n * @internal\n */\n childrenCache() {\n return this.#children\n }\n\n /**\n * Get the Path object referenced by the string path, resolved from this Path\n */\n resolve(path?: string): PathBase {\n if (!path) {\n return this\n }\n const rootPath = this.getRootString(path)\n const dir = path.substring(rootPath.length)\n const dirParts = dir.split(this.splitSep)\n const result: PathBase =\n rootPath ?\n this.getRoot(rootPath).#resolveParts(dirParts)\n : this.#resolveParts(dirParts)\n return result\n }\n\n #resolveParts(dirParts: string[]) {\n let p: PathBase = this\n for (const part of dirParts) {\n p = p.child(part)\n }\n return p\n }\n\n /**\n * Returns the cached children Path objects, if still available. If they\n * have fallen out of the cache, then returns an empty array, and resets the\n * READDIR_CALLED bit, so that future calls to readdir() will require an fs\n * lookup.\n *\n * @internal\n */\n children(): Children {\n const cached = this.#children.get(this)\n if (cached) {\n return cached\n }\n const children: Children = Object.assign([], { provisional: 0 })\n this.#children.set(this, children)\n this.#type &= ~READDIR_CALLED\n return children\n }\n\n /**\n * Resolves a path portion and returns or creates the child Path.\n *\n * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is\n * `'..'`.\n *\n * This should not be called directly. If `pathPart` contains any path\n * separators, it will lead to unsafe undefined behavior.\n *\n * Use `Path.resolve()` instead.\n *\n * @internal\n */\n child(pathPart: string, opts?: PathOpts): PathBase {\n if (pathPart === '' || pathPart === '.') {\n return this\n }\n if (pathPart === '..') {\n return this.parent || this\n }\n\n // find the child\n const children = this.children()\n const name =\n this.nocase ? normalizeNocase(pathPart) : normalize(pathPart)\n for (const p of children) {\n if (p.#matchName === name) {\n return p\n }\n }\n\n // didn't find it, create provisional child, since it might not\n // actually exist. If we know the parent isn't a dir, then\n // in fact it CAN'T exist.\n const s = this.parent ? this.sep : ''\n const fullpath =\n this.#fullpath ? this.#fullpath + s + pathPart : undefined\n const pchild = this.newChild(pathPart, UNKNOWN, {\n ...opts,\n parent: this,\n fullpath,\n })\n\n if (!this.canReaddir()) {\n pchild.#type |= ENOENT\n }\n\n // don't have to update provisional, because if we have real children,\n // then provisional is set to children.length, otherwise a lower number\n children.push(pchild)\n return pchild\n }\n\n /**\n * The relative path from the cwd. If it does not share an ancestor with\n * the cwd, then this ends up being equivalent to the fullpath()\n */\n relative(): string {\n if (this.isCWD) return ''\n if (this.#relative !== undefined) {\n return this.#relative\n }\n const name = this.name\n const p = this.parent\n if (!p) {\n return (this.#relative = this.name)\n }\n const pv = p.relative()\n return pv + (!pv || !p.parent ? '' : this.sep) + name\n }\n\n /**\n * The relative path from the cwd, using / as the path separator.\n * If it does not share an ancestor with\n * the cwd, then this ends up being equivalent to the fullpathPosix()\n * On posix systems, this is identical to relative().\n */\n relativePosix(): string {\n if (this.sep === '/') return this.relative()\n if (this.isCWD) return ''\n if (this.#relativePosix !== undefined) return this.#relativePosix\n const name = this.name\n const p = this.parent\n if (!p) {\n return (this.#relativePosix = this.fullpathPosix())\n }\n const pv = p.relativePosix()\n return pv + (!pv || !p.parent ? '' : '/') + name\n }\n\n /**\n * The fully resolved path string for this Path entry\n */\n fullpath(): string {\n if (this.#fullpath !== undefined) {\n return this.#fullpath\n }\n const name = this.name\n const p = this.parent\n if (!p) {\n return (this.#fullpath = this.name)\n }\n const pv = p.fullpath()\n const fp = pv + (!p.parent ? '' : this.sep) + name\n return (this.#fullpath = fp)\n }\n\n /**\n * On platforms other than windows, this is identical to fullpath.\n *\n * On windows, this is overridden to return the forward-slash form of the\n * full UNC path.\n */\n fullpathPosix(): string {\n if (this.#fullpathPosix !== undefined) return this.#fullpathPosix\n if (this.sep === '/') return (this.#fullpathPosix = this.fullpath())\n if (!this.parent) {\n const p = this.fullpath().replace(/\\\\/g, '/')\n if (/^[a-z]:\\//i.test(p)) {\n return (this.#fullpathPosix = `//?/${p}`)\n } else {\n return (this.#fullpathPosix = p)\n }\n }\n const p = this.parent\n const pfpp = p.fullpathPosix()\n const fpp = pfpp + (!pfpp || !p.parent ? '' : '/') + this.name\n return (this.#fullpathPosix = fpp)\n }\n\n /**\n * Is the Path of an unknown type?\n *\n * Note that we might know *something* about it if there has been a previous\n * filesystem operation, for example that it does not exist, or is not a\n * link, or whether it has child entries.\n */\n isUnknown(): boolean {\n return (this.#type & IFMT) === UNKNOWN\n }\n\n isType(type: Type): boolean {\n return this[`is${type}`]()\n }\n\n getType(): Type {\n return (\n this.isUnknown() ? 'Unknown'\n : this.isDirectory() ? 'Directory'\n : this.isFile() ? 'File'\n : this.isSymbolicLink() ? 'SymbolicLink'\n : this.isFIFO() ? 'FIFO'\n : this.isCharacterDevice() ? 'CharacterDevice'\n : this.isBlockDevice() ? 'BlockDevice'\n : /* c8 ignore start */ this.isSocket() ? 'Socket'\n : 'Unknown'\n )\n /* c8 ignore stop */\n }\n\n /**\n * Is the Path a regular file?\n */\n isFile(): boolean {\n return (this.#type & IFMT) === IFREG\n }\n\n /**\n * Is the Path a directory?\n */\n isDirectory(): boolean {\n return (this.#type & IFMT) === IFDIR\n }\n\n /**\n * Is the path a character device?\n */\n isCharacterDevice(): boolean {\n return (this.#type & IFMT) === IFCHR\n }\n\n /**\n * Is the path a block device?\n */\n isBlockDevice(): boolean {\n return (this.#type & IFMT) === IFBLK\n }\n\n /**\n * Is the path a FIFO pipe?\n */\n isFIFO(): boolean {\n return (this.#type & IFMT) === IFIFO\n }\n\n /**\n * Is the path a socket?\n */\n isSocket(): boolean {\n return (this.#type & IFMT) === IFSOCK\n }\n\n /**\n * Is the path a symbolic link?\n */\n isSymbolicLink(): boolean {\n return (this.#type & IFLNK) === IFLNK\n }\n\n /**\n * Return the entry if it has been subject of a successful lstat, or\n * undefined otherwise.\n *\n * Does not read the filesystem, so an undefined result *could* simply\n * mean that we haven't called lstat on it.\n */\n lstatCached(): PathBase | undefined {\n return this.#type & LSTAT_CALLED ? this : undefined\n }\n\n /**\n * Return the cached link target if the entry has been the subject of a\n * successful readlink, or undefined otherwise.\n *\n * Does not read the filesystem, so an undefined result *could* just mean we\n * don't have any cached data. Only use it if you are very sure that a\n * readlink() has been called at some point.\n */\n readlinkCached(): PathBase | undefined {\n return this.#linkTarget\n }\n\n /**\n * Returns the cached realpath target if the entry has been the subject\n * of a successful realpath, or undefined otherwise.\n *\n * Does not read the filesystem, so an undefined result *could* just mean we\n * don't have any cached data. Only use it if you are very sure that a\n * realpath() has been called at some point.\n */\n realpathCached(): PathBase | undefined {\n return this.#realpath\n }\n\n /**\n * Returns the cached child Path entries array if the entry has been the\n * subject of a successful readdir(), or [] otherwise.\n *\n * Does not read the filesystem, so an empty array *could* just mean we\n * don't have any cached data. Only use it if you are very sure that a\n * readdir() has been called recently enough to still be valid.\n */\n readdirCached(): PathBase[] {\n const children = this.children()\n return children.slice(0, children.provisional)\n }\n\n /**\n * Return true if it's worth trying to readlink. Ie, we don't (yet) have\n * any indication that readlink will definitely fail.\n *\n * Returns false if the path is known to not be a symlink, if a previous\n * readlink failed, or if the entry does not exist.\n */\n canReadlink(): boolean {\n if (this.#linkTarget) return true\n if (!this.parent) return false\n // cases where it cannot possibly succeed\n const ifmt = this.#type & IFMT\n return !(\n (ifmt !== UNKNOWN && ifmt !== IFLNK) ||\n this.#type & ENOREADLINK ||\n this.#type & ENOENT\n )\n }\n\n /**\n * Return true if readdir has previously been successfully called on this\n * path, indicating that cachedReaddir() is likely valid.\n */\n calledReaddir(): boolean {\n return !!(this.#type & READDIR_CALLED)\n }\n\n /**\n * Returns true if the path is known to not exist. That is, a previous lstat\n * or readdir failed to verify its existence when that would have been\n * expected, or a parent entry was marked either enoent or enotdir.\n */\n isENOENT(): boolean {\n return !!(this.#type & ENOENT)\n }\n\n /**\n * Return true if the path is a match for the given path name. This handles\n * case sensitivity and unicode normalization.\n *\n * Note: even on case-sensitive systems, it is **not** safe to test the\n * equality of the `.name` property to determine whether a given pathname\n * matches, due to unicode normalization mismatches.\n *\n * Always use this method instead of testing the `path.name` property\n * directly.\n */\n isNamed(n: string): boolean {\n return !this.nocase ?\n this.#matchName === normalize(n)\n : this.#matchName === normalizeNocase(n)\n }\n\n /**\n * Return the Path object corresponding to the target of a symbolic link.\n *\n * If the Path is not a symbolic link, or if the readlink call fails for any\n * reason, `undefined` is returned.\n *\n * Result is cached, and thus may be outdated if the filesystem is mutated.\n */\n async readlink(): Promise {\n const target = this.#linkTarget\n if (target) {\n return target\n }\n if (!this.canReadlink()) {\n return undefined\n }\n /* c8 ignore start */\n // already covered by the canReadlink test, here for ts grumples\n if (!this.parent) {\n return undefined\n }\n /* c8 ignore stop */\n try {\n const read = await this.#fs.promises.readlink(this.fullpath())\n const linkTarget = (await this.parent.realpath())?.resolve(read)\n if (linkTarget) {\n return (this.#linkTarget = linkTarget)\n }\n } catch (er) {\n this.#readlinkFail((er as NodeJS.ErrnoException).code)\n return undefined\n }\n }\n\n /**\n * Synchronous {@link PathBase.readlink}\n */\n readlinkSync(): PathBase | undefined {\n const target = this.#linkTarget\n if (target) {\n return target\n }\n if (!this.canReadlink()) {\n return undefined\n }\n /* c8 ignore start */\n // already covered by the canReadlink test, here for ts grumples\n if (!this.parent) {\n return undefined\n }\n /* c8 ignore stop */\n try {\n const read = this.#fs.readlinkSync(this.fullpath())\n const linkTarget = this.parent.realpathSync()?.resolve(read)\n if (linkTarget) {\n return (this.#linkTarget = linkTarget)\n }\n } catch (er) {\n this.#readlinkFail((er as NodeJS.ErrnoException).code)\n return undefined\n }\n }\n\n #readdirSuccess(children: Children) {\n // succeeded, mark readdir called bit\n this.#type |= READDIR_CALLED\n // mark all remaining provisional children as ENOENT\n for (let p = children.provisional; p < children.length; p++) {\n const c = children[p]\n if (c) c.#markENOENT()\n }\n }\n\n #markENOENT() {\n // mark as UNKNOWN and ENOENT\n if (this.#type & ENOENT) return\n this.#type = (this.#type | ENOENT) & IFMT_UNKNOWN\n this.#markChildrenENOENT()\n }\n\n #markChildrenENOENT() {\n // all children are provisional and do not exist\n const children = this.children()\n children.provisional = 0\n for (const p of children) {\n p.#markENOENT()\n }\n }\n\n #markENOREALPATH() {\n this.#type |= ENOREALPATH\n this.#markENOTDIR()\n }\n\n // save the information when we know the entry is not a dir\n #markENOTDIR() {\n // entry is not a directory, so any children can't exist.\n // this *should* be impossible, since any children created\n // after it's been marked ENOTDIR should be marked ENOENT,\n // so it won't even get to this point.\n /* c8 ignore start */\n if (this.#type & ENOTDIR) return\n /* c8 ignore stop */\n let t = this.#type\n // this could happen if we stat a dir, then delete it,\n // then try to read it or one of its children.\n if ((t & IFMT) === IFDIR) t &= IFMT_UNKNOWN\n this.#type = t | ENOTDIR\n this.#markChildrenENOENT()\n }\n\n #readdirFail(code: string = '') {\n // markENOTDIR and markENOENT also set provisional=0\n if (code === 'ENOTDIR' || code === 'EPERM') {\n this.#markENOTDIR()\n } else if (code === 'ENOENT') {\n this.#markENOENT()\n } else {\n this.children().provisional = 0\n }\n }\n\n #lstatFail(code: string = '') {\n // Windows just raises ENOENT in this case, disable for win CI\n /* c8 ignore start */\n if (code === 'ENOTDIR') {\n // already know it has a parent by this point\n const p = this.parent as PathBase\n p.#markENOTDIR()\n } else if (code === 'ENOENT') {\n /* c8 ignore stop */\n this.#markENOENT()\n }\n }\n\n #readlinkFail(code: string = '') {\n let ter = this.#type\n ter |= ENOREADLINK\n if (code === 'ENOENT') ter |= ENOENT\n // windows gets a weird error when you try to readlink a file\n if (code === 'EINVAL' || code === 'UNKNOWN') {\n // exists, but not a symlink, we don't know WHAT it is, so remove\n // all IFMT bits.\n ter &= IFMT_UNKNOWN\n }\n this.#type = ter\n // windows just gets ENOENT in this case. We do cover the case,\n // just disabled because it's impossible on Windows CI\n /* c8 ignore start */\n if (code === 'ENOTDIR' && this.parent) {\n this.parent.#markENOTDIR()\n }\n /* c8 ignore stop */\n }\n\n #readdirAddChild(e: Dirent, c: Children) {\n return (\n this.#readdirMaybePromoteChild(e, c) ||\n this.#readdirAddNewChild(e, c)\n )\n }\n\n #readdirAddNewChild(e: Dirent, c: Children): PathBase {\n // alloc new entry at head, so it's never provisional\n const type = entToType(e)\n const child = this.newChild(e.name, type, { parent: this })\n const ifmt = child.#type & IFMT\n if (ifmt !== IFDIR && ifmt !== IFLNK && ifmt !== UNKNOWN) {\n child.#type |= ENOTDIR\n }\n c.unshift(child)\n c.provisional++\n return child\n }\n\n #readdirMaybePromoteChild(e: Dirent, c: Children): PathBase | undefined {\n for (let p = c.provisional; p < c.length; p++) {\n const pchild = c[p]\n const name =\n this.nocase ? normalizeNocase(e.name) : normalize(e.name)\n if (name !== pchild!.#matchName) {\n continue\n }\n\n return this.#readdirPromoteChild(e, pchild!, p, c)\n }\n }\n\n #readdirPromoteChild(\n e: Dirent,\n p: PathBase,\n index: number,\n c: Children,\n ): PathBase {\n const v = p.name\n // retain any other flags, but set ifmt from dirent\n p.#type = (p.#type & IFMT_UNKNOWN) | entToType(e)\n // case sensitivity fixing when we learn the true name.\n if (v !== e.name) p.name = e.name\n\n // just advance provisional index (potentially off the list),\n // otherwise we have to splice/pop it out and re-insert at head\n if (index !== c.provisional) {\n if (index === c.length - 1) c.pop()\n else c.splice(index, 1)\n c.unshift(p)\n }\n c.provisional++\n return p\n }\n\n /**\n * Call lstat() on this Path, and update all known information that can be\n * determined.\n *\n * Note that unlike `fs.lstat()`, the returned value does not contain some\n * information, such as `mode`, `dev`, `nlink`, and `ino`. If that\n * information is required, you will need to call `fs.lstat` yourself.\n *\n * If the Path refers to a nonexistent file, or if the lstat call fails for\n * any reason, `undefined` is returned. Otherwise the updated Path object is\n * returned.\n *\n * Results are cached, and thus may be out of date if the filesystem is\n * mutated.\n */\n async lstat(): Promise {\n if ((this.#type & ENOENT) === 0) {\n try {\n this.#applyStat(await this.#fs.promises.lstat(this.fullpath()))\n return this\n } catch (er) {\n this.#lstatFail((er as NodeJS.ErrnoException).code)\n }\n }\n }\n\n /**\n * synchronous {@link PathBase.lstat}\n */\n lstatSync(): PathBase | undefined {\n if ((this.#type & ENOENT) === 0) {\n try {\n this.#applyStat(this.#fs.lstatSync(this.fullpath()))\n return this\n } catch (er) {\n this.#lstatFail((er as NodeJS.ErrnoException).code)\n }\n }\n }\n\n #applyStat(st: Stats) {\n const {\n atime,\n atimeMs,\n birthtime,\n birthtimeMs,\n blksize,\n blocks,\n ctime,\n ctimeMs,\n dev,\n gid,\n ino,\n mode,\n mtime,\n mtimeMs,\n nlink,\n rdev,\n size,\n uid,\n } = st\n this.#atime = atime\n this.#atimeMs = atimeMs\n this.#birthtime = birthtime\n this.#birthtimeMs = birthtimeMs\n this.#blksize = blksize\n this.#blocks = blocks\n this.#ctime = ctime\n this.#ctimeMs = ctimeMs\n this.#dev = dev\n this.#gid = gid\n this.#ino = ino\n this.#mode = mode\n this.#mtime = mtime\n this.#mtimeMs = mtimeMs\n this.#nlink = nlink\n this.#rdev = rdev\n this.#size = size\n this.#uid = uid\n const ifmt = entToType(st)\n // retain any other flags, but set the ifmt\n this.#type = (this.#type & IFMT_UNKNOWN) | ifmt | LSTAT_CALLED\n if (ifmt !== UNKNOWN && ifmt !== IFDIR && ifmt !== IFLNK) {\n this.#type |= ENOTDIR\n }\n }\n\n #onReaddirCB: ((\n er: NodeJS.ErrnoException | null,\n entries: Path[],\n ) => any)[] = []\n #readdirCBInFlight: boolean = false\n #callOnReaddirCB(children: Path[]) {\n this.#readdirCBInFlight = false\n const cbs = this.#onReaddirCB.slice()\n this.#onReaddirCB.length = 0\n cbs.forEach(cb => cb(null, children))\n }\n\n /**\n * Standard node-style callback interface to get list of directory entries.\n *\n * If the Path cannot or does not contain any children, then an empty array\n * is returned.\n *\n * Results are cached, and thus may be out of date if the filesystem is\n * mutated.\n *\n * @param cb The callback called with (er, entries). Note that the `er`\n * param is somewhat extraneous, as all readdir() errors are handled and\n * simply result in an empty set of entries being returned.\n * @param allowZalgo Boolean indicating that immediately known results should\n * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release\n * zalgo at your peril, the dark pony lord is devious and unforgiving.\n */\n readdirCB(\n cb: (er: NodeJS.ErrnoException | null, entries: PathBase[]) => any,\n allowZalgo: boolean = false,\n ): void {\n if (!this.canReaddir()) {\n if (allowZalgo) cb(null, [])\n else queueMicrotask(() => cb(null, []))\n return\n }\n\n const children = this.children()\n if (this.calledReaddir()) {\n const c = children.slice(0, children.provisional)\n if (allowZalgo) cb(null, c)\n else queueMicrotask(() => cb(null, c))\n return\n }\n\n // don't have to worry about zalgo at this point.\n this.#onReaddirCB.push(cb)\n if (this.#readdirCBInFlight) {\n return\n }\n this.#readdirCBInFlight = true\n\n // else read the directory, fill up children\n // de-provisionalize any provisional children.\n const fullpath = this.fullpath()\n this.#fs.readdir(fullpath, { withFileTypes: true }, (er, entries) => {\n if (er) {\n this.#readdirFail((er as NodeJS.ErrnoException).code)\n children.provisional = 0\n } else {\n // if we didn't get an error, we always get entries.\n //@ts-ignore\n for (const e of entries) {\n this.#readdirAddChild(e, children)\n }\n this.#readdirSuccess(children)\n }\n this.#callOnReaddirCB(children.slice(0, children.provisional))\n return\n })\n }\n\n #asyncReaddirInFlight?: Promise\n\n /**\n * Return an array of known child entries.\n *\n * If the Path cannot or does not contain any children, then an empty array\n * is returned.\n *\n * Results are cached, and thus may be out of date if the filesystem is\n * mutated.\n */\n async readdir(): Promise {\n if (!this.canReaddir()) {\n return []\n }\n\n const children = this.children()\n if (this.calledReaddir()) {\n return children.slice(0, children.provisional)\n }\n\n // else read the directory, fill up children\n // de-provisionalize any provisional children.\n const fullpath = this.fullpath()\n if (this.#asyncReaddirInFlight) {\n await this.#asyncReaddirInFlight\n } else {\n /* c8 ignore start */\n let resolve: () => void = () => {}\n /* c8 ignore stop */\n this.#asyncReaddirInFlight = new Promise(\n res => (resolve = res),\n )\n try {\n for (const e of await this.#fs.promises.readdir(fullpath, {\n withFileTypes: true,\n })) {\n this.#readdirAddChild(e, children)\n }\n this.#readdirSuccess(children)\n } catch (er) {\n this.#readdirFail((er as NodeJS.ErrnoException).code)\n children.provisional = 0\n }\n this.#asyncReaddirInFlight = undefined\n resolve()\n }\n return children.slice(0, children.provisional)\n }\n\n /**\n * synchronous {@link PathBase.readdir}\n */\n readdirSync(): PathBase[] {\n if (!this.canReaddir()) {\n return []\n }\n\n const children = this.children()\n if (this.calledReaddir()) {\n return children.slice(0, children.provisional)\n }\n\n // else read the directory, fill up children\n // de-provisionalize any provisional children.\n const fullpath = this.fullpath()\n try {\n for (const e of this.#fs.readdirSync(fullpath, {\n withFileTypes: true,\n })) {\n this.#readdirAddChild(e, children)\n }\n this.#readdirSuccess(children)\n } catch (er) {\n this.#readdirFail((er as NodeJS.ErrnoException).code)\n children.provisional = 0\n }\n return children.slice(0, children.provisional)\n }\n\n canReaddir() {\n if (this.#type & ENOCHILD) return false\n const ifmt = IFMT & this.#type\n // we always set ENOTDIR when setting IFMT, so should be impossible\n /* c8 ignore start */\n if (!(ifmt === UNKNOWN || ifmt === IFDIR || ifmt === IFLNK)) {\n return false\n }\n /* c8 ignore stop */\n return true\n }\n\n shouldWalk(\n dirs: Set,\n walkFilter?: (e: PathBase) => boolean,\n ): boolean {\n return (\n (this.#type & IFDIR) === IFDIR &&\n !(this.#type & ENOCHILD) &&\n !dirs.has(this) &&\n (!walkFilter || walkFilter(this))\n )\n }\n\n /**\n * Return the Path object corresponding to path as resolved\n * by realpath(3).\n *\n * If the realpath call fails for any reason, `undefined` is returned.\n *\n * Result is cached, and thus may be outdated if the filesystem is mutated.\n * On success, returns a Path object.\n */\n async realpath(): Promise {\n if (this.#realpath) return this.#realpath\n if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type) return undefined\n try {\n const rp = await this.#fs.promises.realpath(this.fullpath())\n return (this.#realpath = this.resolve(rp))\n } catch (_) {\n this.#markENOREALPATH()\n }\n }\n\n /**\n * Synchronous {@link realpath}\n */\n realpathSync(): PathBase | undefined {\n if (this.#realpath) return this.#realpath\n if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type) return undefined\n try {\n const rp = this.#fs.realpathSync(this.fullpath())\n return (this.#realpath = this.resolve(rp))\n } catch (_) {\n this.#markENOREALPATH()\n }\n }\n\n /**\n * Internal method to mark this Path object as the scurry cwd,\n * called by {@link PathScurry#chdir}\n *\n * @internal\n */\n [setAsCwd](oldCwd: PathBase): void {\n if (oldCwd === this) return\n oldCwd.isCWD = false\n this.isCWD = true\n\n const changed = new Set([])\n let rp = []\n let p: PathBase = this\n while (p && p.parent) {\n changed.add(p)\n p.#relative = rp.join(this.sep)\n p.#relativePosix = rp.join('/')\n p = p.parent\n rp.push('..')\n }\n // now un-memoize parents of old cwd\n p = oldCwd\n while (p && p.parent && !changed.has(p)) {\n p.#relative = undefined\n p.#relativePosix = undefined\n p = p.parent\n }\n }\n}\n\n/**\n * Path class used on win32 systems\n *\n * Uses `'\\\\'` as the path separator for returned paths, either `'\\\\'` or `'/'`\n * as the path separator for parsing paths.\n */\nexport class PathWin32 extends PathBase {\n /**\n * Separator for generating path strings.\n */\n sep: '\\\\' = '\\\\'\n /**\n * Separator for parsing path strings.\n */\n splitSep: RegExp = eitherSep\n\n /**\n * Do not create new Path objects directly. They should always be accessed\n * via the PathScurry class or other methods on the Path class.\n *\n * @internal\n */\n constructor(\n name: string,\n type: number = UNKNOWN,\n root: PathBase | undefined,\n roots: { [k: string]: PathBase },\n nocase: boolean,\n children: ChildrenCache,\n opts: PathOpts,\n ) {\n super(name, type, root, roots, nocase, children, opts)\n }\n\n /**\n * @internal\n */\n newChild(name: string, type: number = UNKNOWN, opts: PathOpts = {}) {\n return new PathWin32(\n name,\n type,\n this.root,\n this.roots,\n this.nocase,\n this.childrenCache(),\n opts,\n )\n }\n\n /**\n * @internal\n */\n getRootString(path: string): string {\n return win32.parse(path).root\n }\n\n /**\n * @internal\n */\n getRoot(rootPath: string): PathBase {\n rootPath = uncToDrive(rootPath.toUpperCase())\n if (rootPath === this.root.name) {\n return this.root\n }\n // ok, not that one, check if it matches another we know about\n for (const [compare, root] of Object.entries(this.roots)) {\n if (this.sameRoot(rootPath, compare)) {\n return (this.roots[rootPath] = root)\n }\n }\n // otherwise, have to create a new one.\n return (this.roots[rootPath] = new PathScurryWin32(\n rootPath,\n this,\n ).root)\n }\n\n /**\n * @internal\n */\n sameRoot(rootPath: string, compare: string = this.root.name): boolean {\n // windows can (rarely) have case-sensitive filesystem, but\n // UNC and drive letters are always case-insensitive, and canonically\n // represented uppercase.\n rootPath = rootPath\n .toUpperCase()\n .replace(/\\//g, '\\\\')\n .replace(uncDriveRegexp, '$1\\\\')\n return rootPath === compare\n }\n}\n\n/**\n * Path class used on all posix systems.\n *\n * Uses `'/'` as the path separator.\n */\nexport class PathPosix extends PathBase {\n /**\n * separator for parsing path strings\n */\n splitSep: '/' = '/'\n /**\n * separator for generating path strings\n */\n sep: '/' = '/'\n\n /**\n * Do not create new Path objects directly. They should always be accessed\n * via the PathScurry class or other methods on the Path class.\n *\n * @internal\n */\n constructor(\n name: string,\n type: number = UNKNOWN,\n root: PathBase | undefined,\n roots: { [k: string]: PathBase },\n nocase: boolean,\n children: ChildrenCache,\n opts: PathOpts,\n ) {\n super(name, type, root, roots, nocase, children, opts)\n }\n\n /**\n * @internal\n */\n getRootString(path: string): string {\n return path.startsWith('/') ? '/' : ''\n }\n\n /**\n * @internal\n */\n getRoot(_rootPath: string): PathBase {\n return this.root\n }\n\n /**\n * @internal\n */\n newChild(name: string, type: number = UNKNOWN, opts: PathOpts = {}) {\n return new PathPosix(\n name,\n type,\n this.root,\n this.roots,\n this.nocase,\n this.childrenCache(),\n opts,\n )\n }\n}\n\n/**\n * Options that may be provided to the PathScurry constructor\n */\nexport interface PathScurryOpts {\n /**\n * perform case-insensitive path matching. Default based on platform\n * subclass.\n */\n nocase?: boolean\n /**\n * Number of Path entries to keep in the cache of Path child references.\n *\n * Setting this higher than 65536 will dramatically increase the data\n * consumption and construction time overhead of each PathScurry.\n *\n * Setting this value to 256 or lower will significantly reduce the data\n * consumption and construction time overhead, but may also reduce resolve()\n * and readdir() performance on large filesystems.\n *\n * Default `16384`.\n */\n childrenCacheSize?: number\n /**\n * An object that overrides the built-in functions from the fs and\n * fs/promises modules.\n *\n * See {@link FSOption}\n */\n fs?: FSOption\n}\n\n/**\n * The base class for all PathScurry classes, providing the interface for path\n * resolution and filesystem operations.\n *\n * Typically, you should *not* instantiate this class directly, but rather one\n * of the platform-specific classes, or the exported {@link PathScurry} which\n * defaults to the current platform.\n */\nexport abstract class PathScurryBase {\n /**\n * The root Path entry for the current working directory of this Scurry\n */\n root: PathBase\n /**\n * The string path for the root of this Scurry's current working directory\n */\n rootPath: string\n /**\n * A collection of all roots encountered, referenced by rootPath\n */\n roots: { [k: string]: PathBase }\n /**\n * The Path entry corresponding to this PathScurry's current working directory.\n */\n cwd: PathBase\n #resolveCache: ResolveCache\n #resolvePosixCache: ResolveCache\n #children: ChildrenCache\n /**\n * Perform path comparisons case-insensitively.\n *\n * Defaults true on Darwin and Windows systems, false elsewhere.\n */\n nocase: boolean\n\n /**\n * The path separator used for parsing paths\n *\n * `'/'` on Posix systems, either `'/'` or `'\\\\'` on Windows\n */\n abstract sep: string | RegExp\n\n #fs: FSValue\n\n /**\n * This class should not be instantiated directly.\n *\n * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry\n *\n * @internal\n */\n constructor(\n cwd: URL | string = process.cwd(),\n pathImpl: typeof win32 | typeof posix,\n sep: string | RegExp,\n {\n nocase,\n childrenCacheSize = 16 * 1024,\n fs = defaultFS,\n }: PathScurryOpts = {},\n ) {\n this.#fs = fsFromOption(fs)\n if (cwd instanceof URL || cwd.startsWith('file://')) {\n cwd = fileURLToPath(cwd)\n }\n // resolve and split root, and then add to the store.\n // this is the only time we call path.resolve()\n const cwdPath = pathImpl.resolve(cwd)\n this.roots = Object.create(null)\n this.rootPath = this.parseRootPath(cwdPath)\n this.#resolveCache = new ResolveCache()\n this.#resolvePosixCache = new ResolveCache()\n this.#children = new ChildrenCache(childrenCacheSize)\n\n const split = cwdPath.substring(this.rootPath.length).split(sep)\n // resolve('/') leaves '', splits to [''], we don't want that.\n if (split.length === 1 && !split[0]) {\n split.pop()\n }\n /* c8 ignore start */\n if (nocase === undefined) {\n throw new TypeError(\n 'must provide nocase setting to PathScurryBase ctor',\n )\n }\n /* c8 ignore stop */\n this.nocase = nocase\n this.root = this.newRoot(this.#fs)\n this.roots[this.rootPath] = this.root\n let prev: PathBase = this.root\n let len = split.length - 1\n const joinSep = pathImpl.sep\n let abs = this.rootPath\n let sawFirst = false\n for (const part of split) {\n const l = len--\n prev = prev.child(part, {\n relative: new Array(l).fill('..').join(joinSep),\n relativePosix: new Array(l).fill('..').join('/'),\n fullpath: (abs += (sawFirst ? '' : joinSep) + part),\n })\n sawFirst = true\n }\n this.cwd = prev\n }\n\n /**\n * Get the depth of a provided path, string, or the cwd\n */\n depth(path: Path | string = this.cwd): number {\n if (typeof path === 'string') {\n path = this.cwd.resolve(path)\n }\n return path.depth()\n }\n\n /**\n * Parse the root portion of a path string\n *\n * @internal\n */\n abstract parseRootPath(dir: string): string\n /**\n * create a new Path to use as root during construction.\n *\n * @internal\n */\n abstract newRoot(fs: FSValue): PathBase\n /**\n * Determine whether a given path string is absolute\n */\n abstract isAbsolute(p: string): boolean\n\n /**\n * Return the cache of child entries. Exposed so subclasses can create\n * child Path objects in a platform-specific way.\n *\n * @internal\n */\n childrenCache() {\n return this.#children\n }\n\n /**\n * Resolve one or more path strings to a resolved string\n *\n * Same interface as require('path').resolve.\n *\n * Much faster than path.resolve() when called multiple times for the same\n * path, because the resolved Path objects are cached. Much slower\n * otherwise.\n */\n resolve(...paths: string[]): string {\n // first figure out the minimum number of paths we have to test\n // we always start at cwd, but any absolutes will bump the start\n let r = ''\n for (let i = paths.length - 1; i >= 0; i--) {\n const p = paths[i]\n if (!p || p === '.') continue\n r = r ? `${p}/${r}` : p\n if (this.isAbsolute(p)) {\n break\n }\n }\n const cached = this.#resolveCache.get(r)\n if (cached !== undefined) {\n return cached\n }\n const result = this.cwd.resolve(r).fullpath()\n this.#resolveCache.set(r, result)\n return result\n }\n\n /**\n * Resolve one or more path strings to a resolved string, returning\n * the posix path. Identical to .resolve() on posix systems, but on\n * windows will return a forward-slash separated UNC path.\n *\n * Same interface as require('path').resolve.\n *\n * Much faster than path.resolve() when called multiple times for the same\n * path, because the resolved Path objects are cached. Much slower\n * otherwise.\n */\n resolvePosix(...paths: string[]): string {\n // first figure out the minimum number of paths we have to test\n // we always start at cwd, but any absolutes will bump the start\n let r = ''\n for (let i = paths.length - 1; i >= 0; i--) {\n const p = paths[i]\n if (!p || p === '.') continue\n r = r ? `${p}/${r}` : p\n if (this.isAbsolute(p)) {\n break\n }\n }\n const cached = this.#resolvePosixCache.get(r)\n if (cached !== undefined) {\n return cached\n }\n const result = this.cwd.resolve(r).fullpathPosix()\n this.#resolvePosixCache.set(r, result)\n return result\n }\n\n /**\n * find the relative path from the cwd to the supplied path string or entry\n */\n relative(entry: PathBase | string = this.cwd): string {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return entry.relative()\n }\n\n /**\n * find the relative path from the cwd to the supplied path string or\n * entry, using / as the path delimiter, even on Windows.\n */\n relativePosix(entry: PathBase | string = this.cwd): string {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return entry.relativePosix()\n }\n\n /**\n * Return the basename for the provided string or Path object\n */\n basename(entry: PathBase | string = this.cwd): string {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return entry.name\n }\n\n /**\n * Return the dirname for the provided string or Path object\n */\n dirname(entry: PathBase | string = this.cwd): string {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return (entry.parent || entry).fullpath()\n }\n\n /**\n * Return an array of known child entries.\n *\n * First argument may be either a string, or a Path object.\n *\n * If the Path cannot or does not contain any children, then an empty array\n * is returned.\n *\n * Results are cached, and thus may be out of date if the filesystem is\n * mutated.\n *\n * Unlike `fs.readdir()`, the `withFileTypes` option defaults to `true`. Set\n * `{ withFileTypes: false }` to return strings.\n */\n\n readdir(): Promise\n readdir(opts: { withFileTypes: true }): Promise\n readdir(opts: { withFileTypes: false }): Promise\n readdir(opts: { withFileTypes: boolean }): Promise\n readdir(entry: PathBase | string): Promise\n readdir(\n entry: PathBase | string,\n opts: { withFileTypes: true },\n ): Promise\n readdir(\n entry: PathBase | string,\n opts: { withFileTypes: false },\n ): Promise\n readdir(\n entry: PathBase | string,\n opts: { withFileTypes: boolean },\n ): Promise\n async readdir(\n entry: PathBase | string | { withFileTypes: boolean } = this.cwd,\n opts: { withFileTypes: boolean } = {\n withFileTypes: true,\n },\n ): Promise {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const { withFileTypes } = opts\n if (!entry.canReaddir()) {\n return []\n } else {\n const p = await entry.readdir()\n return withFileTypes ? p : p.map(e => e.name)\n }\n }\n\n /**\n * synchronous {@link PathScurryBase.readdir}\n */\n readdirSync(): PathBase[]\n readdirSync(opts: { withFileTypes: true }): PathBase[]\n readdirSync(opts: { withFileTypes: false }): string[]\n readdirSync(opts: { withFileTypes: boolean }): PathBase[] | string[]\n readdirSync(entry: PathBase | string): PathBase[]\n readdirSync(\n entry: PathBase | string,\n opts: { withFileTypes: true },\n ): PathBase[]\n readdirSync(\n entry: PathBase | string,\n opts: { withFileTypes: false },\n ): string[]\n readdirSync(\n entry: PathBase | string,\n opts: { withFileTypes: boolean },\n ): PathBase[] | string[]\n readdirSync(\n entry: PathBase | string | { withFileTypes: boolean } = this.cwd,\n opts: { withFileTypes: boolean } = {\n withFileTypes: true,\n },\n ): PathBase[] | string[] {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const { withFileTypes = true } = opts\n if (!entry.canReaddir()) {\n return []\n } else if (withFileTypes) {\n return entry.readdirSync()\n } else {\n return entry.readdirSync().map(e => e.name)\n }\n }\n\n /**\n * Call lstat() on the string or Path object, and update all known\n * information that can be determined.\n *\n * Note that unlike `fs.lstat()`, the returned value does not contain some\n * information, such as `mode`, `dev`, `nlink`, and `ino`. If that\n * information is required, you will need to call `fs.lstat` yourself.\n *\n * If the Path refers to a nonexistent file, or if the lstat call fails for\n * any reason, `undefined` is returned. Otherwise the updated Path object is\n * returned.\n *\n * Results are cached, and thus may be out of date if the filesystem is\n * mutated.\n */\n async lstat(\n entry: string | PathBase = this.cwd,\n ): Promise {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return entry.lstat()\n }\n\n /**\n * synchronous {@link PathScurryBase.lstat}\n */\n lstatSync(entry: string | PathBase = this.cwd): PathBase | undefined {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n }\n return entry.lstatSync()\n }\n\n /**\n * Return the Path object or string path corresponding to the target of a\n * symbolic link.\n *\n * If the path is not a symbolic link, or if the readlink call fails for any\n * reason, `undefined` is returned.\n *\n * Result is cached, and thus may be outdated if the filesystem is mutated.\n *\n * `{withFileTypes}` option defaults to `false`.\n *\n * On success, returns a Path object if `withFileTypes` option is true,\n * otherwise a string.\n */\n readlink(): Promise\n readlink(opt: { withFileTypes: false }): Promise\n readlink(opt: { withFileTypes: true }): Promise\n readlink(opt: {\n withFileTypes: boolean\n }): Promise\n readlink(\n entry: string | PathBase,\n opt?: { withFileTypes: false },\n ): Promise\n readlink(\n entry: string | PathBase,\n opt: { withFileTypes: true },\n ): Promise\n readlink(\n entry: string | PathBase,\n opt: { withFileTypes: boolean },\n ): Promise\n async readlink(\n entry: string | PathBase | { withFileTypes: boolean } = this.cwd,\n { withFileTypes }: { withFileTypes: boolean } = {\n withFileTypes: false,\n },\n ): Promise {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n withFileTypes = entry.withFileTypes\n entry = this.cwd\n }\n const e = await entry.readlink()\n return withFileTypes ? e : e?.fullpath()\n }\n\n /**\n * synchronous {@link PathScurryBase.readlink}\n */\n readlinkSync(): string | undefined\n readlinkSync(opt: { withFileTypes: false }): string | undefined\n readlinkSync(opt: { withFileTypes: true }): PathBase | undefined\n readlinkSync(opt: {\n withFileTypes: boolean\n }): PathBase | string | undefined\n readlinkSync(\n entry: string | PathBase,\n opt?: { withFileTypes: false },\n ): string | undefined\n readlinkSync(\n entry: string | PathBase,\n opt: { withFileTypes: true },\n ): PathBase | undefined\n readlinkSync(\n entry: string | PathBase,\n opt: { withFileTypes: boolean },\n ): string | PathBase | undefined\n readlinkSync(\n entry: string | PathBase | { withFileTypes: boolean } = this.cwd,\n { withFileTypes }: { withFileTypes: boolean } = {\n withFileTypes: false,\n },\n ): string | PathBase | undefined {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n withFileTypes = entry.withFileTypes\n entry = this.cwd\n }\n const e = entry.readlinkSync()\n return withFileTypes ? e : e?.fullpath()\n }\n\n /**\n * Return the Path object or string path corresponding to path as resolved\n * by realpath(3).\n *\n * If the realpath call fails for any reason, `undefined` is returned.\n *\n * Result is cached, and thus may be outdated if the filesystem is mutated.\n *\n * `{withFileTypes}` option defaults to `false`.\n *\n * On success, returns a Path object if `withFileTypes` option is true,\n * otherwise a string.\n */\n realpath(): Promise\n realpath(opt: { withFileTypes: false }): Promise\n realpath(opt: { withFileTypes: true }): Promise\n realpath(opt: {\n withFileTypes: boolean\n }): Promise\n realpath(\n entry: string | PathBase,\n opt?: { withFileTypes: false },\n ): Promise\n realpath(\n entry: string | PathBase,\n opt: { withFileTypes: true },\n ): Promise\n realpath(\n entry: string | PathBase,\n opt: { withFileTypes: boolean },\n ): Promise\n async realpath(\n entry: string | PathBase | { withFileTypes: boolean } = this.cwd,\n { withFileTypes }: { withFileTypes: boolean } = {\n withFileTypes: false,\n },\n ): Promise {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n withFileTypes = entry.withFileTypes\n entry = this.cwd\n }\n const e = await entry.realpath()\n return withFileTypes ? e : e?.fullpath()\n }\n\n realpathSync(): string | undefined\n realpathSync(opt: { withFileTypes: false }): string | undefined\n realpathSync(opt: { withFileTypes: true }): PathBase | undefined\n realpathSync(opt: {\n withFileTypes: boolean\n }): PathBase | string | undefined\n realpathSync(\n entry: string | PathBase,\n opt?: { withFileTypes: false },\n ): string | undefined\n realpathSync(\n entry: string | PathBase,\n opt: { withFileTypes: true },\n ): PathBase | undefined\n realpathSync(\n entry: string | PathBase,\n opt: { withFileTypes: boolean },\n ): string | PathBase | undefined\n realpathSync(\n entry: string | PathBase | { withFileTypes: boolean } = this.cwd,\n { withFileTypes }: { withFileTypes: boolean } = {\n withFileTypes: false,\n },\n ): string | PathBase | undefined {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n withFileTypes = entry.withFileTypes\n entry = this.cwd\n }\n const e = entry.realpathSync()\n return withFileTypes ? e : e?.fullpath()\n }\n\n /**\n * Asynchronously walk the directory tree, returning an array of\n * all path strings or Path objects found.\n *\n * Note that this will be extremely memory-hungry on large filesystems.\n * In such cases, it may be better to use the stream or async iterator\n * walk implementation.\n */\n walk(): Promise\n walk(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Promise\n walk(opts: WalkOptionsWithFileTypesFalse): Promise\n walk(opts: WalkOptions): Promise\n walk(entry: string | PathBase): Promise\n walk(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Promise\n walk(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): Promise\n walk(\n entry: string | PathBase,\n opts: WalkOptions,\n ): Promise\n async walk(\n entry: string | PathBase | WalkOptions = this.cwd,\n opts: WalkOptions = {},\n ): Promise {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const {\n withFileTypes = true,\n follow = false,\n filter,\n walkFilter,\n } = opts\n const results: (string | PathBase)[] = []\n if (!filter || filter(entry)) {\n results.push(withFileTypes ? entry : entry.fullpath())\n }\n const dirs = new Set()\n const walk = (\n dir: PathBase,\n cb: (er?: NodeJS.ErrnoException) => void,\n ) => {\n dirs.add(dir)\n dir.readdirCB((er, entries) => {\n /* c8 ignore start */\n if (er) {\n return cb(er)\n }\n /* c8 ignore stop */\n let len = entries.length\n if (!len) return cb()\n const next = () => {\n if (--len === 0) {\n cb()\n }\n }\n for (const e of entries) {\n if (!filter || filter(e)) {\n results.push(withFileTypes ? e : e.fullpath())\n }\n if (follow && e.isSymbolicLink()) {\n e.realpath()\n .then(r => (r?.isUnknown() ? r.lstat() : r))\n .then(r =>\n r?.shouldWalk(dirs, walkFilter) ? walk(r, next) : next(),\n )\n } else {\n if (e.shouldWalk(dirs, walkFilter)) {\n walk(e, next)\n } else {\n next()\n }\n }\n }\n }, true) // zalgooooooo\n }\n\n const start = entry\n return new Promise((res, rej) => {\n walk(start, er => {\n /* c8 ignore start */\n if (er) return rej(er)\n /* c8 ignore stop */\n res(results as PathBase[] | string[])\n })\n })\n }\n\n /**\n * Synchronously walk the directory tree, returning an array of\n * all path strings or Path objects found.\n *\n * Note that this will be extremely memory-hungry on large filesystems.\n * In such cases, it may be better to use the stream or async iterator\n * walk implementation.\n */\n walkSync(): PathBase[]\n walkSync(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): PathBase[]\n walkSync(opts: WalkOptionsWithFileTypesFalse): string[]\n walkSync(opts: WalkOptions): string[] | PathBase[]\n walkSync(entry: string | PathBase): PathBase[]\n walkSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue,\n ): PathBase[]\n walkSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): string[]\n walkSync(\n entry: string | PathBase,\n opts: WalkOptions,\n ): PathBase[] | string[]\n walkSync(\n entry: string | PathBase | WalkOptions = this.cwd,\n opts: WalkOptions = {},\n ): PathBase[] | string[] {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const {\n withFileTypes = true,\n follow = false,\n filter,\n walkFilter,\n } = opts\n const results: (string | PathBase)[] = []\n if (!filter || filter(entry)) {\n results.push(withFileTypes ? entry : entry.fullpath())\n }\n const dirs = new Set([entry])\n for (const dir of dirs) {\n const entries = dir.readdirSync()\n for (const e of entries) {\n if (!filter || filter(e)) {\n results.push(withFileTypes ? e : e.fullpath())\n }\n let r: PathBase | undefined = e\n if (e.isSymbolicLink()) {\n if (!(follow && (r = e.realpathSync()))) continue\n if (r.isUnknown()) r.lstatSync()\n }\n if (r.shouldWalk(dirs, walkFilter)) {\n dirs.add(r)\n }\n }\n }\n return results as string[] | PathBase[]\n }\n\n /**\n * Support for `for await`\n *\n * Alias for {@link PathScurryBase.iterate}\n *\n * Note: As of Node 19, this is very slow, compared to other methods of\n * walking. Consider using {@link PathScurryBase.stream} if memory overhead\n * and backpressure are concerns, or {@link PathScurryBase.walk} if not.\n */\n [Symbol.asyncIterator]() {\n return this.iterate()\n }\n\n /**\n * Async generator form of {@link PathScurryBase.walk}\n *\n * Note: As of Node 19, this is very slow, compared to other methods of\n * walking, especially if most/all of the directory tree has been previously\n * walked. Consider using {@link PathScurryBase.stream} if memory overhead\n * and backpressure are concerns, or {@link PathScurryBase.walk} if not.\n */\n iterate(): AsyncGenerator\n iterate(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): AsyncGenerator\n iterate(\n opts: WalkOptionsWithFileTypesFalse,\n ): AsyncGenerator\n iterate(opts: WalkOptions): AsyncGenerator\n iterate(entry: string | PathBase): AsyncGenerator\n iterate(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): AsyncGenerator\n iterate(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): AsyncGenerator\n iterate(\n entry: string | PathBase,\n opts: WalkOptions,\n ): AsyncGenerator\n iterate(\n entry: string | PathBase | WalkOptions = this.cwd,\n options: WalkOptions = {},\n ): AsyncGenerator {\n // iterating async over the stream is significantly more performant,\n // especially in the warm-cache scenario, because it buffers up directory\n // entries in the background instead of waiting for a yield for each one.\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n options = entry\n entry = this.cwd\n }\n return this.stream(entry, options)[Symbol.asyncIterator]()\n }\n\n /**\n * Iterating over a PathScurry performs a synchronous walk.\n *\n * Alias for {@link PathScurryBase.iterateSync}\n */\n [Symbol.iterator]() {\n return this.iterateSync()\n }\n\n iterateSync(): Generator\n iterateSync(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Generator\n iterateSync(\n opts: WalkOptionsWithFileTypesFalse,\n ): Generator\n iterateSync(opts: WalkOptions): Generator\n iterateSync(entry: string | PathBase): Generator\n iterateSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Generator\n iterateSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): Generator\n iterateSync(\n entry: string | PathBase,\n opts: WalkOptions,\n ): Generator\n *iterateSync(\n entry: string | PathBase | WalkOptions = this.cwd,\n opts: WalkOptions = {},\n ): Generator {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const {\n withFileTypes = true,\n follow = false,\n filter,\n walkFilter,\n } = opts\n if (!filter || filter(entry)) {\n yield withFileTypes ? entry : entry.fullpath()\n }\n const dirs = new Set([entry])\n for (const dir of dirs) {\n const entries = dir.readdirSync()\n for (const e of entries) {\n if (!filter || filter(e)) {\n yield withFileTypes ? e : e.fullpath()\n }\n let r: PathBase | undefined = e\n if (e.isSymbolicLink()) {\n if (!(follow && (r = e.realpathSync()))) continue\n if (r.isUnknown()) r.lstatSync()\n }\n if (r.shouldWalk(dirs, walkFilter)) {\n dirs.add(r)\n }\n }\n }\n }\n\n /**\n * Stream form of {@link PathScurryBase.walk}\n *\n * Returns a Minipass stream that emits {@link PathBase} objects by default,\n * or strings if `{ withFileTypes: false }` is set in the options.\n */\n stream(): Minipass\n stream(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Minipass\n stream(opts: WalkOptionsWithFileTypesFalse): Minipass\n stream(opts: WalkOptions): Minipass\n stream(entry: string | PathBase): Minipass\n stream(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue,\n ): Minipass\n stream(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): Minipass\n stream(\n entry: string | PathBase,\n opts: WalkOptions,\n ): Minipass | Minipass\n stream(\n entry: string | PathBase | WalkOptions = this.cwd,\n opts: WalkOptions = {},\n ): Minipass | Minipass {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const {\n withFileTypes = true,\n follow = false,\n filter,\n walkFilter,\n } = opts\n const results = new Minipass({ objectMode: true })\n if (!filter || filter(entry)) {\n results.write(withFileTypes ? entry : entry.fullpath())\n }\n const dirs = new Set()\n const queue: PathBase[] = [entry]\n let processing = 0\n const process = () => {\n let paused = false\n while (!paused) {\n const dir = queue.shift()\n if (!dir) {\n if (processing === 0) results.end()\n return\n }\n\n processing++\n dirs.add(dir)\n\n const onReaddir = (\n er: null | NodeJS.ErrnoException,\n entries: PathBase[],\n didRealpaths: boolean = false,\n ) => {\n /* c8 ignore start */\n if (er) return results.emit('error', er)\n /* c8 ignore stop */\n if (follow && !didRealpaths) {\n const promises: Promise[] = []\n for (const e of entries) {\n if (e.isSymbolicLink()) {\n promises.push(\n e\n .realpath()\n .then((r: PathBase | undefined) =>\n r?.isUnknown() ? r.lstat() : r,\n ),\n )\n }\n }\n if (promises.length) {\n Promise.all(promises).then(() =>\n onReaddir(null, entries, true),\n )\n return\n }\n }\n\n for (const e of entries) {\n if (e && (!filter || filter(e))) {\n if (!results.write(withFileTypes ? e : e.fullpath())) {\n paused = true\n }\n }\n }\n\n processing--\n for (const e of entries) {\n const r = e.realpathCached() || e\n if (r.shouldWalk(dirs, walkFilter)) {\n queue.push(r)\n }\n }\n if (paused && !results.flowing) {\n results.once('drain', process)\n } else if (!sync) {\n process()\n }\n }\n\n // zalgo containment\n let sync = true\n dir.readdirCB(onReaddir, true)\n sync = false\n }\n }\n process()\n return results as Minipass | Minipass\n }\n\n /**\n * Synchronous form of {@link PathScurryBase.stream}\n *\n * Returns a Minipass stream that emits {@link PathBase} objects by default,\n * or strings if `{ withFileTypes: false }` is set in the options.\n *\n * Will complete the walk in a single tick if the stream is consumed fully.\n * Otherwise, will pause as needed for stream backpressure.\n */\n streamSync(): Minipass\n streamSync(\n opts: WalkOptionsWithFileTypesTrue | WalkOptionsWithFileTypesUnset,\n ): Minipass\n streamSync(opts: WalkOptionsWithFileTypesFalse): Minipass\n streamSync(opts: WalkOptions): Minipass\n streamSync(entry: string | PathBase): Minipass\n streamSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesUnset | WalkOptionsWithFileTypesTrue,\n ): Minipass\n streamSync(\n entry: string | PathBase,\n opts: WalkOptionsWithFileTypesFalse,\n ): Minipass\n streamSync(\n entry: string | PathBase,\n opts: WalkOptions,\n ): Minipass | Minipass\n streamSync(\n entry: string | PathBase | WalkOptions = this.cwd,\n opts: WalkOptions = {},\n ): Minipass | Minipass {\n if (typeof entry === 'string') {\n entry = this.cwd.resolve(entry)\n } else if (!(entry instanceof PathBase)) {\n opts = entry\n entry = this.cwd\n }\n const {\n withFileTypes = true,\n follow = false,\n filter,\n walkFilter,\n } = opts\n const results = new Minipass({ objectMode: true })\n const dirs = new Set()\n if (!filter || filter(entry)) {\n results.write(withFileTypes ? entry : entry.fullpath())\n }\n const queue: PathBase[] = [entry]\n let processing = 0\n const process = () => {\n let paused = false\n while (!paused) {\n const dir = queue.shift()\n if (!dir) {\n if (processing === 0) results.end()\n return\n }\n processing++\n dirs.add(dir)\n\n const entries = dir.readdirSync()\n for (const e of entries) {\n if (!filter || filter(e)) {\n if (!results.write(withFileTypes ? e : e.fullpath())) {\n paused = true\n }\n }\n }\n processing--\n for (const e of entries) {\n let r: PathBase | undefined = e\n if (e.isSymbolicLink()) {\n if (!(follow && (r = e.realpathSync()))) continue\n if (r.isUnknown()) r.lstatSync()\n }\n if (r.shouldWalk(dirs, walkFilter)) {\n queue.push(r)\n }\n }\n }\n if (paused && !results.flowing) results.once('drain', process)\n }\n process()\n return results as Minipass | Minipass\n }\n\n chdir(path: string | Path = this.cwd) {\n const oldCwd = this.cwd\n this.cwd = typeof path === 'string' ? this.cwd.resolve(path) : path\n this.cwd[setAsCwd](oldCwd)\n }\n}\n\n/**\n * Options provided to all walk methods.\n */\nexport interface WalkOptions {\n /**\n * Return results as {@link PathBase} objects rather than strings.\n * When set to false, results are fully resolved paths, as returned by\n * {@link PathBase.fullpath}.\n * @default true\n */\n withFileTypes?: boolean\n\n /**\n * Attempt to read directory entries from symbolic links. Otherwise, only\n * actual directories are traversed. Regardless of this setting, a given\n * target path will only ever be walked once, meaning that a symbolic link\n * to a previously traversed directory will never be followed.\n *\n * Setting this imposes a slight performance penalty, because `readlink`\n * must be called on all symbolic links encountered, in order to avoid\n * infinite cycles.\n * @default false\n */\n follow?: boolean\n\n /**\n * Only return entries where the provided function returns true.\n *\n * This will not prevent directories from being traversed, even if they do\n * not pass the filter, though it will prevent directories themselves from\n * being included in the result set. See {@link walkFilter}\n *\n * Asynchronous functions are not supported here.\n *\n * By default, if no filter is provided, all entries and traversed\n * directories are included.\n */\n filter?: (entry: PathBase) => boolean\n\n /**\n * Only traverse directories (and in the case of {@link follow} being set to\n * true, symbolic links to directories) if the provided function returns\n * true.\n *\n * This will not prevent directories from being included in the result set,\n * even if they do not pass the supplied filter function. See {@link filter}\n * to do that.\n *\n * Asynchronous functions are not supported here.\n */\n walkFilter?: (entry: PathBase) => boolean\n}\n\nexport type WalkOptionsWithFileTypesUnset = WalkOptions & {\n withFileTypes?: undefined\n}\nexport type WalkOptionsWithFileTypesTrue = WalkOptions & {\n withFileTypes: true\n}\nexport type WalkOptionsWithFileTypesFalse = WalkOptions & {\n withFileTypes: false\n}\n\n/**\n * Windows implementation of {@link PathScurryBase}\n *\n * Defaults to case insensitve, uses `'\\\\'` to generate path strings. Uses\n * {@link PathWin32} for Path objects.\n */\nexport class PathScurryWin32 extends PathScurryBase {\n /**\n * separator for generating path strings\n */\n sep: '\\\\' = '\\\\'\n\n constructor(\n cwd: URL | string = process.cwd(),\n opts: PathScurryOpts = {},\n ) {\n const { nocase = true } = opts\n super(cwd, win32, '\\\\', { ...opts, nocase })\n this.nocase = nocase\n for (let p: PathBase | undefined = this.cwd; p; p = p.parent) {\n p.nocase = this.nocase\n }\n }\n\n /**\n * @internal\n */\n parseRootPath(dir: string): string {\n // if the path starts with a single separator, it's not a UNC, and we'll\n // just get separator as the root, and driveFromUNC will return \\\n // In that case, mount \\ on the root from the cwd.\n return win32.parse(dir).root.toUpperCase()\n }\n\n /**\n * @internal\n */\n newRoot(fs: FSValue) {\n return new PathWin32(\n this.rootPath,\n IFDIR,\n undefined,\n this.roots,\n this.nocase,\n this.childrenCache(),\n { fs },\n )\n }\n\n /**\n * Return true if the provided path string is an absolute path\n */\n isAbsolute(p: string): boolean {\n return (\n p.startsWith('/') || p.startsWith('\\\\') || /^[a-z]:(\\/|\\\\)/i.test(p)\n )\n }\n}\n\n/**\n * {@link PathScurryBase} implementation for all posix systems other than Darwin.\n *\n * Defaults to case-sensitive matching, uses `'/'` to generate path strings.\n *\n * Uses {@link PathPosix} for Path objects.\n */\nexport class PathScurryPosix extends PathScurryBase {\n /**\n * separator for generating path strings\n */\n sep: '/' = '/'\n constructor(\n cwd: URL | string = process.cwd(),\n opts: PathScurryOpts = {},\n ) {\n const { nocase = false } = opts\n super(cwd, posix, '/', { ...opts, nocase })\n this.nocase = nocase\n }\n\n /**\n * @internal\n */\n parseRootPath(_dir: string): string {\n return '/'\n }\n\n /**\n * @internal\n */\n newRoot(fs: FSValue) {\n return new PathPosix(\n this.rootPath,\n IFDIR,\n undefined,\n this.roots,\n this.nocase,\n this.childrenCache(),\n { fs },\n )\n }\n\n /**\n * Return true if the provided path string is an absolute path\n */\n isAbsolute(p: string): boolean {\n return p.startsWith('/')\n }\n}\n\n/**\n * {@link PathScurryBase} implementation for Darwin (macOS) systems.\n *\n * Defaults to case-insensitive matching, uses `'/'` for generating path\n * strings.\n *\n * Uses {@link PathPosix} for Path objects.\n */\nexport class PathScurryDarwin extends PathScurryPosix {\n constructor(\n cwd: URL | string = process.cwd(),\n opts: PathScurryOpts = {},\n ) {\n const { nocase = true } = opts\n super(cwd, { ...opts, nocase })\n }\n}\n\n/**\n * Default {@link PathBase} implementation for the current platform.\n *\n * {@link PathWin32} on Windows systems, {@link PathPosix} on all others.\n */\nexport const Path = process.platform === 'win32' ? PathWin32 : PathPosix\nexport type Path = PathBase | InstanceType\n\n/**\n * Default {@link PathScurryBase} implementation for the current platform.\n *\n * {@link PathScurryWin32} on Windows systems, {@link PathScurryDarwin} on\n * Darwin (macOS) systems, {@link PathScurryPosix} on all others.\n */\nexport const PathScurry:\n | typeof PathScurryWin32\n | typeof PathScurryDarwin\n | typeof PathScurryPosix =\n process.platform === 'win32' ? PathScurryWin32\n : process.platform === 'darwin' ? PathScurryDarwin\n : PathScurryPosix\nexport type PathScurry = PathScurryBase | InstanceType\n"]} \ No newline at end of file diff --git a/node_modules/path-scurry/dist/esm/package.json b/node_modules/path-scurry/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/path-scurry/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/path-scurry/package.json b/node_modules/path-scurry/package.json new file mode 100644 index 00000000..e1766157 --- /dev/null +++ b/node_modules/path-scurry/package.json @@ -0,0 +1,89 @@ +{ + "name": "path-scurry", + "version": "1.11.1", + "description": "walk paths fast and efficiently", + "author": "Isaac Z. Schlueter (https://blog.izs.me)", + "main": "./dist/commonjs/index.js", + "type": "module", + "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" + ], + "license": "BlueOak-1.0.0", + "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 tsconfig-esm.json ./src/*.ts", + "bench": "bash ./scripts/bench.sh" + }, + "prettier": { + "experimentalTernaries": true, + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "devDependencies": { + "@nodelib/fs.walk": "^1.2.8", + "@types/node": "^20.12.11", + "c8": "^7.12.0", + "eslint-config-prettier": "^8.6.0", + "mkdirp": "^3.0.0", + "prettier": "^3.2.5", + "rimraf": "^5.0.1", + "tap": "^18.7.2", + "ts-node": "^10.9.2", + "tshy": "^1.14.0", + "typedoc": "^0.25.12", + "typescript": "^5.4.3" + }, + "tap": { + "typecheck": true + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/path-scurry" + }, + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "tshy": { + "selfLink": false, + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "types": "./dist/commonjs/index.d.ts" +} diff --git a/node_modules/picocolors/LICENSE b/node_modules/picocolors/LICENSE new file mode 100644 index 00000000..46c9b95d --- /dev/null +++ b/node_modules/picocolors/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov + +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/picocolors/README.md b/node_modules/picocolors/README.md new file mode 100644 index 00000000..8e47aa8e --- /dev/null +++ b/node_modules/picocolors/README.md @@ -0,0 +1,21 @@ +# picocolors + +The tiniest and the fastest library for terminal output formatting with ANSI colors. + +```javascript +import pc from "picocolors" + +console.log( + pc.green(`How are ${pc.italic(`you`)} doing?`) +) +``` + +- **No dependencies.** +- **14 times** smaller and **2 times** faster than chalk. +- Used by popular tools like PostCSS, SVGO, Stylelint, and Browserslist. +- Node.js v6+ & browsers support. Support for both CJS and ESM projects. +- TypeScript type declarations included. +- [`NO_COLOR`](https://no-color.org/) friendly. + +## Docs +Read **[full docs](https://github.com/alexeyraspopov/picocolors#readme)** on GitHub. diff --git a/node_modules/picocolors/package.json b/node_modules/picocolors/package.json new file mode 100644 index 00000000..372d4b64 --- /dev/null +++ b/node_modules/picocolors/package.json @@ -0,0 +1,25 @@ +{ + "name": "picocolors", + "version": "1.1.1", + "main": "./picocolors.js", + "types": "./picocolors.d.ts", + "browser": { + "./picocolors.js": "./picocolors.browser.js" + }, + "sideEffects": false, + "description": "The tiniest and the fastest library for terminal output formatting with ANSI colors", + "files": [ + "picocolors.*", + "types.d.ts" + ], + "keywords": [ + "terminal", + "colors", + "formatting", + "cli", + "console" + ], + "author": "Alexey Raspopov", + "repository": "alexeyraspopov/picocolors", + "license": "ISC" +} diff --git a/node_modules/picocolors/picocolors.browser.js b/node_modules/picocolors/picocolors.browser.js new file mode 100644 index 00000000..9dcf637c --- /dev/null +++ b/node_modules/picocolors/picocolors.browser.js @@ -0,0 +1,4 @@ +var x=String; +var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x,blackBright:x,redBright:x,greenBright:x,yellowBright:x,blueBright:x,magentaBright:x,cyanBright:x,whiteBright:x,bgBlackBright:x,bgRedBright:x,bgGreenBright:x,bgYellowBright:x,bgBlueBright:x,bgMagentaBright:x,bgCyanBright:x,bgWhiteBright:x}}; +module.exports=create(); +module.exports.createColors = create; diff --git a/node_modules/picocolors/picocolors.d.ts b/node_modules/picocolors/picocolors.d.ts new file mode 100644 index 00000000..94e146a8 --- /dev/null +++ b/node_modules/picocolors/picocolors.d.ts @@ -0,0 +1,5 @@ +import { Colors } from "./types" + +declare const picocolors: Colors & { createColors: (enabled?: boolean) => Colors } + +export = picocolors diff --git a/node_modules/picocolors/picocolors.js b/node_modules/picocolors/picocolors.js new file mode 100644 index 00000000..e32df854 --- /dev/null +++ b/node_modules/picocolors/picocolors.js @@ -0,0 +1,75 @@ +let p = process || {}, argv = p.argv || [], env = p.env || {} +let isColorSupported = + !(!!env.NO_COLOR || argv.includes("--no-color")) && + (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI) + +let formatter = (open, close, replace = open) => + input => { + let string = "" + input, index = string.indexOf(close, open.length) + return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close + } + +let replaceClose = (string, close, replace, index) => { + let result = "", cursor = 0 + do { + result += string.substring(cursor, index) + replace + cursor = index + close.length + index = string.indexOf(close, cursor) + } while (~index) + return result + string.substring(cursor) +} + +let createColors = (enabled = isColorSupported) => { + let f = enabled ? formatter : () => String + return { + isColorSupported: enabled, + reset: f("\x1b[0m", "\x1b[0m"), + bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"), + dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"), + italic: f("\x1b[3m", "\x1b[23m"), + underline: f("\x1b[4m", "\x1b[24m"), + inverse: f("\x1b[7m", "\x1b[27m"), + hidden: f("\x1b[8m", "\x1b[28m"), + strikethrough: f("\x1b[9m", "\x1b[29m"), + + black: f("\x1b[30m", "\x1b[39m"), + red: f("\x1b[31m", "\x1b[39m"), + green: f("\x1b[32m", "\x1b[39m"), + yellow: f("\x1b[33m", "\x1b[39m"), + blue: f("\x1b[34m", "\x1b[39m"), + magenta: f("\x1b[35m", "\x1b[39m"), + cyan: f("\x1b[36m", "\x1b[39m"), + white: f("\x1b[37m", "\x1b[39m"), + gray: f("\x1b[90m", "\x1b[39m"), + + bgBlack: f("\x1b[40m", "\x1b[49m"), + bgRed: f("\x1b[41m", "\x1b[49m"), + bgGreen: f("\x1b[42m", "\x1b[49m"), + bgYellow: f("\x1b[43m", "\x1b[49m"), + bgBlue: f("\x1b[44m", "\x1b[49m"), + bgMagenta: f("\x1b[45m", "\x1b[49m"), + bgCyan: f("\x1b[46m", "\x1b[49m"), + bgWhite: f("\x1b[47m", "\x1b[49m"), + + blackBright: f("\x1b[90m", "\x1b[39m"), + redBright: f("\x1b[91m", "\x1b[39m"), + greenBright: f("\x1b[92m", "\x1b[39m"), + yellowBright: f("\x1b[93m", "\x1b[39m"), + blueBright: f("\x1b[94m", "\x1b[39m"), + magentaBright: f("\x1b[95m", "\x1b[39m"), + cyanBright: f("\x1b[96m", "\x1b[39m"), + whiteBright: f("\x1b[97m", "\x1b[39m"), + + bgBlackBright: f("\x1b[100m", "\x1b[49m"), + bgRedBright: f("\x1b[101m", "\x1b[49m"), + bgGreenBright: f("\x1b[102m", "\x1b[49m"), + bgYellowBright: f("\x1b[103m", "\x1b[49m"), + bgBlueBright: f("\x1b[104m", "\x1b[49m"), + bgMagentaBright: f("\x1b[105m", "\x1b[49m"), + bgCyanBright: f("\x1b[106m", "\x1b[49m"), + bgWhiteBright: f("\x1b[107m", "\x1b[49m"), + } +} + +module.exports = createColors() +module.exports.createColors = createColors diff --git a/node_modules/picocolors/types.d.ts b/node_modules/picocolors/types.d.ts new file mode 100644 index 00000000..cd1aec46 --- /dev/null +++ b/node_modules/picocolors/types.d.ts @@ -0,0 +1,51 @@ +export type Formatter = (input: string | number | null | undefined) => string + +export interface Colors { + isColorSupported: boolean + + reset: Formatter + bold: Formatter + dim: Formatter + italic: Formatter + underline: Formatter + inverse: Formatter + hidden: Formatter + strikethrough: Formatter + + black: Formatter + red: Formatter + green: Formatter + yellow: Formatter + blue: Formatter + magenta: Formatter + cyan: Formatter + white: Formatter + gray: Formatter + + bgBlack: Formatter + bgRed: Formatter + bgGreen: Formatter + bgYellow: Formatter + bgBlue: Formatter + bgMagenta: Formatter + bgCyan: Formatter + bgWhite: Formatter + + blackBright: Formatter + redBright: Formatter + greenBright: Formatter + yellowBright: Formatter + blueBright: Formatter + magentaBright: Formatter + cyanBright: Formatter + whiteBright: Formatter + + bgBlackBright: Formatter + bgRedBright: Formatter + bgGreenBright: Formatter + bgYellowBright: Formatter + bgBlueBright: Formatter + bgMagentaBright: Formatter + bgCyanBright: Formatter + bgWhiteBright: Formatter +} diff --git a/node_modules/picomatch/CHANGELOG.md b/node_modules/picomatch/CHANGELOG.md new file mode 100644 index 00000000..8ccc6c1b --- /dev/null +++ b/node_modules/picomatch/CHANGELOG.md @@ -0,0 +1,136 @@ +# Release history + +**All notable changes to this project will be documented in this file.** + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +
    + Guiding Principles + +- Changelogs are for humans, not machines. +- There should be an entry for every single version. +- The same types of changes should be grouped. +- Versions and sections should be linkable. +- The latest version comes first. +- The release date of each versions is displayed. +- Mention whether you follow Semantic Versioning. + +
    + +
    + Types of changes + +Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): + +- `Added` for new features. +- `Changed` for changes in existing functionality. +- `Deprecated` for soon-to-be removed features. +- `Removed` for now removed features. +- `Fixed` for any bug fixes. +- `Security` in case of vulnerabilities. + +
    + +## 2.3.1 (2022-01-02) + +### Fixed + +* Fixes bug when a pattern containing an expression after the closing parenthesis (`/!(*.d).{ts,tsx}`) was incorrectly converted to regexp ([9f241ef](https://github.com/micromatch/picomatch/commit/9f241ef)). + +### Changed + +* Some documentation improvements ([f81d236](https://github.com/micromatch/picomatch/commit/f81d236), [421e0e7](https://github.com/micromatch/picomatch/commit/421e0e7)). + +## 2.3.0 (2021-05-21) + +### Fixed + +* Fixes bug where file names with two dots were not being matched consistently with negation extglobs containing a star ([56083ef](https://github.com/micromatch/picomatch/commit/56083ef)) + +## 2.2.3 (2021-04-10) + +### Fixed + +* Do not skip pattern seperator for square brackets ([fb08a30](https://github.com/micromatch/picomatch/commit/fb08a30)). +* Set negatedExtGlob also if it does not span the whole pattern ([032e3f5](https://github.com/micromatch/picomatch/commit/032e3f5)). + +## 2.2.2 (2020-03-21) + +### Fixed + +* Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)). + +## 2.2.1 (2020-01-04) + +* Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals. + +## 2.2.0 (2020-01-04) + +* Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f)) +* Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`. + +## 2.1.0 (2019-10-31) + +* add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92)) +* Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650)) +* Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c)) +* Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9)) +* Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625)) +* closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0)) +* Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8)) +* fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07)) +* fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45)) +* Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34)) +* lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55)) +* Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03)) +* minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87)) +* minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d)) +* remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa)) +* remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d)) +* Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54)) +* Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367)) +* support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569)) +* update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77)) +* update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038)) +* Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd)) + +## 2.0.7 (2019-05-14) + +* 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71)) +* supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e)) +* update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279)) +* fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44)) + +## 2.0.4 (2019-04-10) + +### Fixed + +- Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez. +- `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza. + +## 2.0.0 (2019-04-10) + +### Added + +- Adds support for `options.onIgnore`. See the readme for details +- Adds support for `options.onResult`. See the readme for details + +### Breaking changes + +- The unixify option was renamed to `windows` +- caching and all related options and methods have been removed + +## 1.0.0 (2018-11-05) + +- adds `.onMatch` option +- improvements to `.scan` method +- numerous improvements and optimizations for matching and parsing +- better windows path handling + +## 0.1.0 - 2017-04-13 + +First release. + + +[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog diff --git a/node_modules/picomatch/LICENSE b/node_modules/picomatch/LICENSE new file mode 100644 index 00000000..3608dca2 --- /dev/null +++ b/node_modules/picomatch/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017-present, Jon Schlinkert. + +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/picomatch/README.md b/node_modules/picomatch/README.md new file mode 100644 index 00000000..b0526e28 --- /dev/null +++ b/node_modules/picomatch/README.md @@ -0,0 +1,708 @@ +

    Picomatch

    + +

    + +version + + +test status + + +coverage status + + +downloads + +

    + +
    +
    + +

    +Blazing fast and accurate glob matcher written in JavaScript.
    +No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. +

    + +
    +
    + +## Why picomatch? + +* **Lightweight** - No dependencies +* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. +* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) +* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) +* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. +* **Well tested** - Thousands of unit tests + +See the [library comparison](#library-comparisons) to other libraries. + +
    +
    + +## Table of Contents + +
    Click to expand + +- [Install](#install) +- [Usage](#usage) +- [API](#api) + * [picomatch](#picomatch) + * [.test](#test) + * [.matchBase](#matchbase) + * [.isMatch](#ismatch) + * [.parse](#parse) + * [.scan](#scan) + * [.compileRe](#compilere) + * [.makeRe](#makere) + * [.toRegex](#toregex) +- [Options](#options) + * [Picomatch options](#picomatch-options) + * [Scan Options](#scan-options) + * [Options Examples](#options-examples) +- [Globbing features](#globbing-features) + * [Basic globbing](#basic-globbing) + * [Advanced globbing](#advanced-globbing) + * [Braces](#braces) + * [Matching special characters as literals](#matching-special-characters-as-literals) +- [Library Comparisons](#library-comparisons) +- [Benchmarks](#benchmarks) +- [Philosophies](#philosophies) +- [About](#about) + * [Author](#author) + * [License](#license) + +_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ + +
    + +
    +
    + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +npm install --save picomatch +``` + +
    + +## Usage + +The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. + +```js +const pm = require('picomatch'); +const isMatch = pm('*.js'); + +console.log(isMatch('abcd')); //=> false +console.log(isMatch('a.js')); //=> true +console.log(isMatch('a.md')); //=> false +console.log(isMatch('a/b.js')); //=> false +``` + +
    + +## API + +### [picomatch](lib/picomatch.js#L32) + +Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. + +**Params** + +* `globs` **{String|Array}**: One or more glob patterns. +* `options` **{Object=}** +* `returns` **{Function=}**: Returns a matcher function. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch(glob[, options]); + +const isMatch = picomatch('*.!(*a)'); +console.log(isMatch('a.a')); //=> false +console.log(isMatch('a.b')); //=> true +``` + +### [.test](lib/picomatch.js#L117) + +Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. + +**Params** + +* `input` **{String}**: String to test. +* `regex` **{RegExp}** +* `returns` **{Object}**: Returns an object with matching info. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.test(input, regex[, options]); + +console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); +// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } +``` + +### [.matchBase](lib/picomatch.js#L161) + +Match the basename of a filepath. + +**Params** + +* `input` **{String}**: String to test. +* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). +* `returns` **{Boolean}** + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.matchBase(input, glob[, options]); +console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true +``` + +### [.isMatch](lib/picomatch.js#L183) + +Returns true if **any** of the given glob `patterns` match the specified `string`. + +**Params** + +* **{String|Array}**: str The string to test. +* **{String|Array}**: patterns One or more glob patterns to use for matching. +* **{Object}**: See available [options](#options). +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.isMatch(string, patterns[, options]); + +console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true +console.log(picomatch.isMatch('a.a', 'b.*')); //=> false +``` + +### [.parse](lib/picomatch.js#L199) + +Parse a glob pattern to create the source string for a regular expression. + +**Params** + +* `pattern` **{String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. + +**Example** + +```js +const picomatch = require('picomatch'); +const result = picomatch.parse(pattern[, options]); +``` + +### [.scan](lib/picomatch.js#L231) + +Scan a glob pattern to separate the pattern into segments. + +**Params** + +* `input` **{String}**: Glob pattern to scan. +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.scan(input[, options]); + +const result = picomatch.scan('!./foo/*.js'); +console.log(result); +{ prefix: '!./', + input: '!./foo/*.js', + start: 3, + base: 'foo', + glob: '*.js', + isBrace: false, + isBracket: false, + isGlob: true, + isExtglob: false, + isGlobstar: false, + negated: true } +``` + +### [.compileRe](lib/picomatch.js#L245) + +Compile a regular expression from the `state` object returned by the +[parse()](#parse) method. + +**Params** + +* `state` **{Object}** +* `options` **{Object}** +* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. +* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. +* `returns` **{RegExp}** + +### [.makeRe](lib/picomatch.js#L286) + +Create a regular expression from a parsed glob pattern. + +**Params** + +* `state` **{String}**: The object returned from the `.parse` method. +* `options` **{Object}** +* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. +* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. +* `returns` **{RegExp}**: Returns a regex created from the given pattern. + +**Example** + +```js +const picomatch = require('picomatch'); +const state = picomatch.parse('*.js'); +// picomatch.compileRe(state[, options]); + +console.log(picomatch.compileRe(state)); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +### [.toRegex](lib/picomatch.js#L321) + +Create a regular expression from the given regex source string. + +**Params** + +* `source` **{String}**: Regular expression source string. +* `options` **{Object}** +* `returns` **{RegExp}** + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.toRegex(source[, options]); + +const { output } = picomatch.parse('*.js'); +console.log(picomatch.toRegex(output)); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +
    + +## Options + +### Picomatch options + +The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | +| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | +| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | +| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | +| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | +| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | +| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | +| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | +| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | +| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | +| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | +| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | +| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | +| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | +| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | +| `matchBase` | `boolean` | `false` | Alias for `basename` | +| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | +| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | +| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | +| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | +| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | +| `noext` | `boolean` | `false` | Alias for `noextglob` | +| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | +| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | +| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | +| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | +| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | +| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | +| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | +| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | +| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | +| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | +| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | +| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | +| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | +| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | +| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | + +picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error. + +### Scan Options + +In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | +| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | + +**Example** + +```js +const picomatch = require('picomatch'); +const result = picomatch.scan('!./foo/*.js', { tokens: true }); +console.log(result); +// { +// prefix: '!./', +// input: '!./foo/*.js', +// start: 3, +// base: 'foo', +// glob: '*.js', +// isBrace: false, +// isBracket: false, +// isGlob: true, +// isExtglob: false, +// isGlobstar: false, +// negated: true, +// maxDepth: 2, +// tokens: [ +// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, +// { value: 'foo', depth: 1, isGlob: false }, +// { value: '*.js', depth: 1, isGlob: true } +// ], +// slashes: [ 2, 6 ], +// parts: [ 'foo', '*.js' ] +// } +``` + +
    + +### Options Examples + +#### options.expandRange + +**Type**: `function` + +**Default**: `undefined` + +Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. + +**Example** + +The following example shows how to create a glob that matches a folder + +```js +const fill = require('fill-range'); +const regex = pm.makeRe('foo/{01..25}/bar', { + expandRange(a, b) { + return `(${fill(a, b, { toRegex: true })})`; + } +}); + +console.log(regex); +//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ + +console.log(regex.test('foo/00/bar')) // false +console.log(regex.test('foo/01/bar')) // true +console.log(regex.test('foo/10/bar')) // true +console.log(regex.test('foo/22/bar')) // true +console.log(regex.test('foo/25/bar')) // true +console.log(regex.test('foo/26/bar')) // false +``` + +#### options.format + +**Type**: `function` + +**Default**: `undefined` + +Custom function for formatting strings before they're matched. + +**Example** + +```js +// strip leading './' from strings +const format = str => str.replace(/^\.\//, ''); +const isMatch = picomatch('foo/*.js', { format }); +console.log(isMatch('./foo/bar.js')); //=> true +``` + +#### options.onMatch + +```js +const onMatch = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onMatch }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +#### options.onIgnore + +```js +const onIgnore = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +#### options.onResult + +```js +const onResult = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onResult, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +
    +
    + +## Globbing features + +* [Basic globbing](#basic-globbing) (Wildcard matching) +* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) + +### Basic globbing + +| **Character** | **Description** | +| --- | --- | +| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | +| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | +| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | +| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | + +#### Matching behavior vs. Bash + +Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: + +* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. +* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. + +
    + +### Advanced globbing + +* [extglobs](#extglobs) +* [POSIX brackets](#posix-brackets) +* [Braces](#brace-expansion) + +#### Extglobs + +| **Pattern** | **Description** | +| --- | --- | +| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | +| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | +| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | +| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | +| `!(pattern)` | Match _anything but_ `pattern` | + +**Examples** + +```js +const pm = require('picomatch'); + +// *(pattern) matches ZERO or more of "pattern" +console.log(pm.isMatch('a', 'a*(z)')); // true +console.log(pm.isMatch('az', 'a*(z)')); // true +console.log(pm.isMatch('azzz', 'a*(z)')); // true + +// +(pattern) matches ONE or more of "pattern" +console.log(pm.isMatch('a', 'a*(z)')); // true +console.log(pm.isMatch('az', 'a*(z)')); // true +console.log(pm.isMatch('azzz', 'a*(z)')); // true + +// supports multiple extglobs +console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false + +// supports nested extglobs +console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true +``` + +#### POSIX brackets + +POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. + +**Enable POSIX bracket support** + +```js +console.log(pm.makeRe('[[:word:]]+', { posix: true })); +//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ +``` + +**Supported POSIX classes** + +The following named POSIX bracket expressions are supported: + +* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` +* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. +* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. +* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. +* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. +* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. +* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. +* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. +* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. +* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. +* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. +* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. +* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. +* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. + +See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. + +### Braces + +Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. + +### Matching special characters as literals + +If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: + +**Special Characters** + +Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. + +To match any of the following characters as literals: `$^*+?()[] + +Examples: + +```js +console.log(pm.makeRe('foo/bar \\(1\\)')); +console.log(pm.makeRe('foo/bar \\(1\\)')); +``` + +
    +
    + +## Library Comparisons + +The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). + +| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | +| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | +| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | +| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | +| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | +| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | +| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | +| File system operations | - | - | - | - | - | - | - | + +
    +
    + +## Benchmarks + +Performance comparison of picomatch and minimatch. + +``` +# .makeRe star + picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled) + minimatch x 627,206 ops/sec ±1.96% (87 runs sampled)) + +# .makeRe star; dot=true + picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled) + minimatch x 525,876 ops/sec ±0.60% (88 runs sampled) + +# .makeRe globstar + picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled) + minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d) + +# .makeRe globstars + picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled) + minimatch x 477,179 ops/sec ±1.33% (91 runs sampled) + +# .makeRe with leading star + picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled) + minimatch x 453,564 ops/sec ±1.43% (94 runs sampled) + +# .makeRe - basic braces + picomatch x 392,067 ops/sec ±0.70% (90 runs sampled) + minimatch x 99,532 ops/sec ±2.03% (87 runs sampled)) +``` + +
    +
    + +## Philosophies + +The goal of this library is to be blazing fast, without compromising on accuracy. + +**Accuracy** + +The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. + +Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. + +**Performance** + +Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. + +
    +
    + +## About + +
    +Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. + +
    + +
    +Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +npm install && npm test +``` + +
    + +
    +Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
    + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). diff --git a/node_modules/picomatch/index.js b/node_modules/picomatch/index.js new file mode 100644 index 00000000..d2f2bc59 --- /dev/null +++ b/node_modules/picomatch/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/picomatch'); diff --git a/node_modules/picomatch/lib/constants.js b/node_modules/picomatch/lib/constants.js new file mode 100644 index 00000000..a62ef387 --- /dev/null +++ b/node_modules/picomatch/lib/constants.js @@ -0,0 +1,179 @@ +'use strict'; + +const path = require('path'); +const WIN_SLASH = '\\\\/'; +const WIN_NO_SLASH = `[^${WIN_SLASH}]`; + +/** + * Posix glob regex + */ + +const DOT_LITERAL = '\\.'; +const PLUS_LITERAL = '\\+'; +const QMARK_LITERAL = '\\?'; +const SLASH_LITERAL = '\\/'; +const ONE_CHAR = '(?=.)'; +const QMARK = '[^/]'; +const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; +const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; +const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; +const NO_DOT = `(?!${DOT_LITERAL})`; +const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; +const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; +const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; +const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; +const STAR = `${QMARK}*?`; + +const POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR +}; + +/** + * Windows glob regex + */ + +const WINDOWS_CHARS = { + ...POSIX_CHARS, + + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)` +}; + +/** + * POSIX Bracket Regex + */ + +const POSIX_REGEX_SOURCE = { + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\x00-\\x7F', + blank: ' \\t', + cntrl: '\\x00-\\x1F\\x7F', + digit: '0-9', + graph: '\\x21-\\x7E', + lower: 'a-z', + print: '\\x20-\\x7E ', + punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', + space: ' \\t\\r\\n\\v\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' +}; + +module.exports = { + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, + + // regular expressions + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, + + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + '***': '*', + '**/**': '**', + '**/**/**': '**' + }, + + // Digits + CHAR_0: 48, /* 0 */ + CHAR_9: 57, /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 65, /* A */ + CHAR_LOWERCASE_A: 97, /* a */ + CHAR_UPPERCASE_Z: 90, /* Z */ + CHAR_LOWERCASE_Z: 122, /* z */ + + CHAR_LEFT_PARENTHESES: 40, /* ( */ + CHAR_RIGHT_PARENTHESES: 41, /* ) */ + + CHAR_ASTERISK: 42, /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, /* & */ + CHAR_AT: 64, /* @ */ + CHAR_BACKWARD_SLASH: 92, /* \ */ + CHAR_CARRIAGE_RETURN: 13, /* \r */ + CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ + CHAR_COLON: 58, /* : */ + CHAR_COMMA: 44, /* , */ + CHAR_DOT: 46, /* . */ + CHAR_DOUBLE_QUOTE: 34, /* " */ + CHAR_EQUAL: 61, /* = */ + CHAR_EXCLAMATION_MARK: 33, /* ! */ + CHAR_FORM_FEED: 12, /* \f */ + CHAR_FORWARD_SLASH: 47, /* / */ + CHAR_GRAVE_ACCENT: 96, /* ` */ + CHAR_HASH: 35, /* # */ + CHAR_HYPHEN_MINUS: 45, /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ + CHAR_LEFT_CURLY_BRACE: 123, /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ + CHAR_LINE_FEED: 10, /* \n */ + CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ + CHAR_PERCENT: 37, /* % */ + CHAR_PLUS: 43, /* + */ + CHAR_QUESTION_MARK: 63, /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ + CHAR_SEMICOLON: 59, /* ; */ + CHAR_SINGLE_QUOTE: 39, /* ' */ + CHAR_SPACE: 32, /* */ + CHAR_TAB: 9, /* \t */ + CHAR_UNDERSCORE: 95, /* _ */ + CHAR_VERTICAL_LINE: 124, /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ + + SEP: path.sep, + + /** + * Create EXTGLOB_CHARS + */ + + extglobChars(chars) { + return { + '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, + '?': { type: 'qmark', open: '(?:', close: ')?' }, + '+': { type: 'plus', open: '(?:', close: ')+' }, + '*': { type: 'star', open: '(?:', close: ')*' }, + '@': { type: 'at', open: '(?:', close: ')' } + }; + }, + + /** + * Create GLOB_CHARS + */ + + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; + } +}; diff --git a/node_modules/picomatch/lib/parse.js b/node_modules/picomatch/lib/parse.js new file mode 100644 index 00000000..58269d01 --- /dev/null +++ b/node_modules/picomatch/lib/parse.js @@ -0,0 +1,1091 @@ +'use strict'; + +const constants = require('./constants'); +const utils = require('./utils'); + +/** + * Constants + */ + +const { + MAX_LENGTH, + POSIX_REGEX_SOURCE, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS +} = constants; + +/** + * Helpers + */ + +const expandRange = (args, options) => { + if (typeof options.expandRange === 'function') { + return options.expandRange(...args, options); + } + + args.sort(); + const value = `[${args.join('-')}]`; + + try { + /* eslint-disable-next-line no-new */ + new RegExp(value); + } catch (ex) { + return args.map(v => utils.escapeRegex(v)).join('..'); + } + + return value; +}; + +/** + * Create the message for a syntax error + */ + +const syntaxError = (type, char) => { + return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; +}; + +/** + * Parse the given input string. + * @param {String} input + * @param {Object} options + * @return {Object} + */ + +const parse = (input, options) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + input = REPLACEMENTS[input] || input; + + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + + let len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + const bos = { type: 'bos', value: '', output: opts.prepend || '' }; + const tokens = [bos]; + + const capture = opts.capture ? '' : '?:'; + const win32 = utils.isWindows(options); + + // create constants based on platform, for windows or posix + const PLATFORM_CHARS = constants.globChars(win32); + const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); + + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + + const globstar = opts => { + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const nodot = opts.dot ? '' : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + // minimatch options support + if (typeof opts.noext === 'boolean') { + opts.noextglob = opts.noext; + } + + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: '', + output: '', + prefix: '', + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + + input = utils.removePrefix(input, state); + len = input.length; + + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + + /** + * Tokenizing helpers + */ + + const eos = () => state.index === len - 1; + const peek = state.peek = (n = 1) => input[state.index + n]; + const advance = state.advance = () => input[++state.index] || ''; + const remaining = () => input.slice(state.index + 1); + const consume = (value = '', num = 0) => { + state.consumed += value; + state.index += num; + }; + + const append = token => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + + const negate = () => { + let count = 1; + + while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { + advance(); + state.start++; + count++; + } + + if (count % 2 === 0) { + return false; + } + + state.negated = true; + state.start++; + return true; + }; + + const increment = type => { + state[type]++; + stack.push(type); + }; + + const decrement = type => { + state[type]--; + stack.pop(); + }; + + /** + * Push tokens onto the tokens array. This helper speeds up + * tokenizing by 1) helping us avoid backtracking as much as possible, + * and 2) helping us avoid creating extra tokens when consecutive + * characters are plain text. This improves performance and simplifies + * lookbehinds. + */ + + const push = tok => { + if (prev.type === 'globstar') { + const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); + const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); + + if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = 'star'; + prev.value = '*'; + prev.output = star; + state.output += prev.output; + } + } + + if (extglobs.length && tok.type !== 'paren') { + extglobs[extglobs.length - 1].inner += tok.value; + } + + if (tok.value || tok.output) append(tok); + if (prev && prev.type === 'text' && tok.type === 'text') { + prev.value += tok.value; + prev.output = (prev.output || '') + tok.value; + return; + } + + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + + const extglobOpen = (type, value) => { + const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; + + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + const output = (opts.capture ? '(' : '') + token.open; + + increment('parens'); + push({ type, value, output: state.output ? '' : ONE_CHAR }); + push({ type: 'paren', extglob: true, value: advance(), output }); + extglobs.push(token); + }; + + const extglobClose = token => { + let output = token.close + (opts.capture ? ')' : ''); + let rest; + + if (token.type === 'negate') { + let extglobStar = star; + + if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { + extglobStar = globstar(opts); + } + + if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { + output = token.close = `)$))${extglobStar}`; + } + + if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { + // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. + // In this case, we need to parse the string and use it in the output of the original pattern. + // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. + // + // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. + const expression = parse(rest, { ...options, fastpaths: false }).output; + + output = token.close = `)${expression})${extglobStar})`; + } + + if (token.prev.type === 'bos') { + state.negatedExtglob = true; + } + } + + push({ type: 'paren', extglob: true, value, output }); + decrement('parens'); + }; + + /** + * Fast paths + */ + + if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { + let backslashes = false; + + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { + if (first === '\\') { + backslashes = true; + return m; + } + + if (first === '?') { + if (esc) { + return esc + first + (rest ? QMARK.repeat(rest.length) : ''); + } + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); + } + return QMARK.repeat(chars.length); + } + + if (first === '.') { + return DOT_LITERAL.repeat(chars.length); + } + + if (first === '*') { + if (esc) { + return esc + first + (rest ? star : ''); + } + return star; + } + return esc ? m : `\\${m}`; + }); + + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\/g, ''); + } else { + output = output.replace(/\\+/g, m => { + return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); + }); + } + } + + if (output === input && opts.contains === true) { + state.output = input; + return state; + } + + state.output = utils.wrapOutput(output, state, options); + return state; + } + + /** + * Tokenize input until we reach end-of-string + */ + + while (!eos()) { + value = advance(); + + if (value === '\u0000') { + continue; + } + + /** + * Escaped characters + */ + + if (value === '\\') { + const next = peek(); + + if (next === '/' && opts.bash !== true) { + continue; + } + + if (next === '.' || next === ';') { + continue; + } + + if (!next) { + value += '\\'; + push({ type: 'text', value }); + continue; + } + + // collapse slashes to reduce potential for exploits + const match = /^\\+/.exec(remaining()); + let slashes = 0; + + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + if (slashes % 2 !== 0) { + value += '\\'; + } + } + + if (opts.unescape === true) { + value = advance(); + } else { + value += advance(); + } + + if (state.brackets === 0) { + push({ type: 'text', value }); + continue; + } + } + + /** + * If we're inside a regex character class, continue + * until we reach the closing bracket. + */ + + if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { + if (opts.posix !== false && value === ':') { + const inner = prev.value.slice(1); + if (inner.includes('[')) { + prev.posix = true; + + if (inner.includes(':')) { + const idx = prev.value.lastIndexOf('['); + const pre = prev.value.slice(0, idx); + const rest = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE[rest]; + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + continue; + } + } + } + } + + if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { + value = `\\${value}`; + } + + if (value === ']' && (prev.value === '[' || prev.value === '[^')) { + value = `\\${value}`; + } + + if (opts.posix === true && value === '!' && prev.value === '[') { + value = '^'; + } + + prev.value += value; + append({ value }); + continue; + } + + /** + * If we're inside a quoted string, continue + * until we reach the closing double quote. + */ + + if (state.quotes === 1 && value !== '"') { + value = utils.escapeRegex(value); + prev.value += value; + append({ value }); + continue; + } + + /** + * Double quotes + */ + + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + if (opts.keepQuotes === true) { + push({ type: 'text', value }); + } + continue; + } + + /** + * Parentheses + */ + + if (value === '(') { + increment('parens'); + push({ type: 'paren', value }); + continue; + } + + if (value === ')') { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '(')); + } + + const extglob = extglobs[extglobs.length - 1]; + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; + } + + push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); + decrement('parens'); + continue; + } + + /** + * Square brackets + */ + + if (value === '[') { + if (opts.nobracket === true || !remaining().includes(']')) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('closing', ']')); + } + + value = `\\${value}`; + } else { + increment('brackets'); + } + + push({ type: 'bracket', value }); + continue; + } + + if (value === ']') { + if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '[')); + } + + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + decrement('brackets'); + + const prevValue = prev.value.slice(1); + if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { + value = `/${value}`; + } + + prev.value += value; + append({ value }); + + // when literal brackets are explicitly disabled + // assume we should match with a regex character class + if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { + continue; + } + + const escaped = utils.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); + + // when literal brackets are explicitly enabled + // assume we should escape the brackets to match literal characters + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } + + // when the user specifies nothing, try to match both + prev.value = `(${capture}${escaped}|${prev.value})`; + state.output += prev.value; + continue; + } + + /** + * Braces + */ + + if (value === '{' && opts.nobrace !== true) { + increment('braces'); + + const open = { + type: 'brace', + value, + output: '(', + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + + braces.push(open); + push(open); + continue; + } + + if (value === '}') { + const brace = braces[braces.length - 1]; + + if (opts.nobrace === true || !brace) { + push({ type: 'text', value, output: value }); + continue; + } + + let output = ')'; + + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + + for (let i = arr.length - 1; i >= 0; i--) { + tokens.pop(); + if (arr[i].type === 'brace') { + break; + } + if (arr[i].type !== 'dots') { + range.unshift(arr[i].value); + } + } + + output = expandRange(range, opts); + state.backtrack = true; + } + + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = '\\{'; + value = output = '\\}'; + state.output = out; + for (const t of toks) { + state.output += (t.output || t.value); + } + } + + push({ type: 'brace', value, output }); + decrement('braces'); + braces.pop(); + continue; + } + + /** + * Pipes + */ + + if (value === '|') { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + push({ type: 'text', value }); + continue; + } + + /** + * Commas + */ + + if (value === ',') { + let output = value; + + const brace = braces[braces.length - 1]; + if (brace && stack[stack.length - 1] === 'braces') { + brace.comma = true; + output = '|'; + } + + push({ type: 'comma', value, output }); + continue; + } + + /** + * Slashes + */ + + if (value === '/') { + // if the beginning of the glob is "./", advance the start + // to the current index, and don't add the "./" characters + // to the state. This greatly simplifies lookbehinds when + // checking for BOS characters like "!" and "." (not "./") + if (prev.type === 'dot' && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ''; + state.output = ''; + tokens.pop(); + prev = bos; // reset "prev" to the first token + continue; + } + + push({ type: 'slash', value, output: SLASH_LITERAL }); + continue; + } + + /** + * Dots + */ + + if (value === '.') { + if (state.braces > 0 && prev.type === 'dot') { + if (prev.value === '.') prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = 'dots'; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + + if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { + push({ type: 'text', value, output: DOT_LITERAL }); + continue; + } + + push({ type: 'dot', value, output: DOT_LITERAL }); + continue; + } + + /** + * Question marks + */ + + if (value === '?') { + const isGroup = prev && prev.value === '('; + if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('qmark', value); + continue; + } + + if (prev && prev.type === 'paren') { + const next = peek(); + let output = value; + + if (next === '<' && !utils.supportsLookbehinds()) { + throw new Error('Node.js v10 or higher is required for regex lookbehinds'); + } + + if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { + output = `\\${value}`; + } + + push({ type: 'text', value, output }); + continue; + } + + if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { + push({ type: 'qmark', value, output: QMARK_NO_DOT }); + continue; + } + + push({ type: 'qmark', value, output: QMARK }); + continue; + } + + /** + * Exclamation + */ + + if (value === '!') { + if (opts.noextglob !== true && peek() === '(') { + if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { + extglobOpen('negate', value); + continue; + } + } + + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; + } + } + + /** + * Plus + */ + + if (value === '+') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('plus', value); + continue; + } + + if ((prev && prev.value === '(') || opts.regex === false) { + push({ type: 'plus', value, output: PLUS_LITERAL }); + continue; + } + + if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { + push({ type: 'plus', value }); + continue; + } + + push({ type: 'plus', value: PLUS_LITERAL }); + continue; + } + + /** + * Plain text + */ + + if (value === '@') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + push({ type: 'at', extglob: true, value, output: '' }); + continue; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Plain text + */ + + if (value !== '*') { + if (value === '$' || value === '^') { + value = `\\${value}`; + } + + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + if (match) { + value += match[0]; + state.index += match[0].length; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Stars + */ + + if (prev && (prev.type === 'globstar' || prev.star === true)) { + prev.type = 'star'; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; + } + + let rest = remaining(); + if (opts.noextglob !== true && /^\([^?]/.test(rest)) { + extglobOpen('star', value); + continue; + } + + if (prev.type === 'star') { + if (opts.noglobstar === true) { + consume(value); + continue; + } + + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === 'slash' || prior.type === 'bos'; + const afterStar = before && (before.type === 'star' || before.type === 'globstar'); + + if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { + push({ type: 'star', value, output: '' }); + continue; + } + + const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); + const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); + if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { + push({ type: 'star', value, output: '' }); + continue; + } + + // strip consecutive `/**/` + while (rest.slice(0, 3) === '/**') { + const after = input[state.index + 4]; + if (after && after !== '/') { + break; + } + rest = rest.slice(3); + consume('/**', 3); + } + + if (prior.type === 'bos' && eos()) { + prev.type = 'globstar'; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { + const end = rest[1] !== void 0 ? '|$' : ''; + + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; + prev.value += value; + + state.output += prior.output + prev.output; + state.globstar = true; + + consume(value + advance()); + + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + if (prior.type === 'bos' && rest[0] === '/') { + prev.type = 'globstar'; + prev.value += value; + prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + // remove single star from output + state.output = state.output.slice(0, -prev.output.length); + + // reset previous token to globstar + prev.type = 'globstar'; + prev.output = globstar(opts); + prev.value += value; + + // reset output with globstar + state.output += prev.output; + state.globstar = true; + consume(value); + continue; + } + + const token = { type: 'star', value, output: star }; + + if (opts.bash === true) { + token.output = '.*?'; + if (prev.type === 'bos' || prev.type === 'slash') { + token.output = nodot + token.output; + } + push(token); + continue; + } + + if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { + token.output = value; + push(token); + continue; + } + + if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { + if (prev.type === 'dot') { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + + } else { + state.output += nodot; + prev.output += nodot; + } + + if (peek() !== '*') { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } + } + + push(token); + } + + while (state.brackets > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); + state.output = utils.escapeLast(state.output, '['); + decrement('brackets'); + } + + while (state.parens > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); + state.output = utils.escapeLast(state.output, '('); + decrement('parens'); + } + + while (state.braces > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); + state.output = utils.escapeLast(state.output, '{'); + decrement('braces'); + } + + if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { + push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); + } + + // rebuild the output if we had to backtrack at any point + if (state.backtrack === true) { + state.output = ''; + + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; + + if (token.suffix) { + state.output += token.suffix; + } + } + } + + return state; +}; + +/** + * Fast paths for creating regular expressions for common glob patterns. + * This can significantly speed up processing and has very little downside + * impact when none of the fast paths match. + */ + +parse.fastpaths = (input, options) => { + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + const len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + input = REPLACEMENTS[input] || input; + const win32 = utils.isWindows(options); + + // create constants based on platform, for windows or posix + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants.globChars(win32); + + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? '' : '?:'; + const state = { negated: false, prefix: '' }; + let star = opts.bash === true ? '.*?' : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + const globstar = opts => { + if (opts.noglobstar === true) return star; + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const create = str => { + switch (str) { + case '*': + return `${nodot}${ONE_CHAR}${star}`; + + case '.*': + return `${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*.*': + return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*/*': + return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; + + case '**': + return nodot + globstar(opts); + + case '**/*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; + + case '**/*.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '**/.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; + + default: { + const match = /^(.*?)\.(\w+)$/.exec(str); + if (!match) return; + + const source = create(match[1]); + if (!source) return; + + return source + DOT_LITERAL + match[2]; + } + } + }; + + const output = utils.removePrefix(input, state); + let source = create(output); + + if (source && opts.strictSlashes !== true) { + source += `${SLASH_LITERAL}?`; + } + + return source; +}; + +module.exports = parse; diff --git a/node_modules/picomatch/lib/picomatch.js b/node_modules/picomatch/lib/picomatch.js new file mode 100644 index 00000000..782d8094 --- /dev/null +++ b/node_modules/picomatch/lib/picomatch.js @@ -0,0 +1,342 @@ +'use strict'; + +const path = require('path'); +const scan = require('./scan'); +const parse = require('./parse'); +const utils = require('./utils'); +const constants = require('./constants'); +const isObject = val => val && typeof val === 'object' && !Array.isArray(val); + +/** + * Creates a matcher function from one or more glob patterns. The + * returned function takes a string to match as its first argument, + * and returns true if the string is a match. The returned matcher + * function also takes a boolean as the second argument that, when true, + * returns an object with additional information. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch(glob[, options]); + * + * const isMatch = picomatch('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @name picomatch + * @param {String|Array} `globs` One or more glob patterns. + * @param {Object=} `options` + * @return {Function=} Returns a matcher function. + * @api public + */ + +const picomatch = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map(input => picomatch(input, options, returnState)); + const arrayMatcher = str => { + for (const isMatch of fns) { + const state = isMatch(str); + if (state) return state; + } + return false; + }; + return arrayMatcher; + } + + const isState = isObject(glob) && glob.tokens && glob.input; + + if (glob === '' || (typeof glob !== 'string' && !isState)) { + throw new TypeError('Expected pattern to be a non-empty string'); + } + + const opts = options || {}; + const posix = utils.isWindows(options); + const regex = isState + ? picomatch.compileRe(glob, options) + : picomatch.makeRe(glob, options, false, true); + + const state = regex.state; + delete regex.state; + + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; + isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + } + + const matcher = (input, returnObject = false) => { + const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); + const result = { glob, state, regex, posix, input, output, match, isMatch }; + + if (typeof opts.onResult === 'function') { + opts.onResult(result); + } + + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + + if (isIgnored(input)) { + if (typeof opts.onIgnore === 'function') { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; + } + + if (typeof opts.onMatch === 'function') { + opts.onMatch(result); + } + return returnObject ? result : true; + }; + + if (returnState) { + matcher.state = state; + } + + return matcher; +}; + +/** + * Test `input` with the given `regex`. This is used by the main + * `picomatch()` function to test the input string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.test(input, regex[, options]); + * + * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); + * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } + * ``` + * @param {String} `input` String to test. + * @param {RegExp} `regex` + * @return {Object} Returns an object with matching info. + * @api public + */ + +picomatch.test = (input, regex, options, { glob, posix } = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected input to be a string'); + } + + if (input === '') { + return { isMatch: false, output: '' }; + } + + const opts = options || {}; + const format = opts.format || (posix ? utils.toPosixSlashes : null); + let match = input === glob; + let output = (match && format) ? format(input) : input; + + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } + + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } + + return { isMatch: Boolean(match), match, output }; +}; + +/** + * Match the basename of a filepath. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.matchBase(input, glob[, options]); + * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true + * ``` + * @param {String} `input` String to test. + * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). + * @return {Boolean} + * @api public + */ + +picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { + const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); + return regex.test(path.basename(input)); +}; + +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.isMatch(string, patterns[, options]); + * + * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String|Array} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const picomatch = require('picomatch'); + * const result = picomatch.parse(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as a regex source string. + * @api public + */ + +picomatch.parse = (pattern, options) => { + if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); + return parse(pattern, { ...options, fastpaths: false }); +}; + +/** + * Scan a glob pattern to separate the pattern into segments. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.scan(input[, options]); + * + * const result = picomatch.scan('!./foo/*.js'); + * console.log(result); + * { prefix: '!./', + * input: '!./foo/*.js', + * start: 3, + * base: 'foo', + * glob: '*.js', + * isBrace: false, + * isBracket: false, + * isGlob: true, + * isExtglob: false, + * isGlobstar: false, + * negated: true } + * ``` + * @param {String} `input` Glob pattern to scan. + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ + +picomatch.scan = (input, options) => scan(input, options); + +/** + * Compile a regular expression from the `state` object returned by the + * [parse()](#parse) method. + * + * @param {Object} `state` + * @param {Object} `options` + * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. + * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. + * @return {RegExp} + * @api public + */ + +picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return state.output; + } + + const opts = options || {}; + const prepend = opts.contains ? '' : '^'; + const append = opts.contains ? '' : '$'; + + let source = `${prepend}(?:${state.output})${append}`; + if (state && state.negated === true) { + source = `^(?!${source}).*$`; + } + + const regex = picomatch.toRegex(source, options); + if (returnState === true) { + regex.state = state; + } + + return regex; +}; + +/** + * Create a regular expression from a parsed glob pattern. + * + * ```js + * const picomatch = require('picomatch'); + * const state = picomatch.parse('*.js'); + * // picomatch.compileRe(state[, options]); + * + * console.log(picomatch.compileRe(state)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `state` The object returned from the `.parse` method. + * @param {Object} `options` + * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. + * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { + if (!input || typeof input !== 'string') { + throw new TypeError('Expected a non-empty string'); + } + + let parsed = { negated: false, fastpaths: true }; + + if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { + parsed.output = parse.fastpaths(input, options); + } + + if (!parsed.output) { + parsed = parse(input, options); + } + + return picomatch.compileRe(parsed, options, returnOutput, returnState); +}; + +/** + * Create a regular expression from the given regex source string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.toRegex(source[, options]); + * + * const { output } = picomatch.parse('*.js'); + * console.log(picomatch.toRegex(output)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `source` Regular expression source string. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +picomatch.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); + } catch (err) { + if (options && options.debug === true) throw err; + return /$^/; + } +}; + +/** + * Picomatch constants. + * @return {Object} + */ + +picomatch.constants = constants; + +/** + * Expose "picomatch" + */ + +module.exports = picomatch; diff --git a/node_modules/picomatch/lib/scan.js b/node_modules/picomatch/lib/scan.js new file mode 100644 index 00000000..e59cd7a1 --- /dev/null +++ b/node_modules/picomatch/lib/scan.js @@ -0,0 +1,391 @@ +'use strict'; + +const utils = require('./utils'); +const { + CHAR_ASTERISK, /* * */ + CHAR_AT, /* @ */ + CHAR_BACKWARD_SLASH, /* \ */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_EXCLAMATION_MARK, /* ! */ + CHAR_FORWARD_SLASH, /* / */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_PLUS, /* + */ + CHAR_QUESTION_MARK, /* ? */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_RIGHT_SQUARE_BRACKET /* ] */ +} = require('./constants'); + +const isPathSeparator = code => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; +}; + +const depth = token => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; + } +}; + +/** + * Quickly scans a glob pattern and returns an object with a handful of + * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), + * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not + * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). + * + * ```js + * const pm = require('picomatch'); + * console.log(pm.scan('foo/bar/*.js')); + * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {Object} Returns an object with tokens and regex source string. + * @api public + */ + +const scan = (input, options) => { + const opts = options || {}; + + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let negatedExtglob = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = { value: '', depth: 0, isGlob: false }; + + const eos = () => index >= length; + const peek = () => str.charCodeAt(index + 1); + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + + while (index < length) { + code = advance(); + let next; + + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + + if (code === CHAR_LEFT_CURLY_BRACE) { + braceEscaped = true; + } + continue; + } + + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { + braces++; + + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (code === CHAR_LEFT_CURLY_BRACE) { + braces++; + continue; + } + + if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (braceEscaped !== true && code === CHAR_COMMA) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_RIGHT_CURLY_BRACE) { + braces--; + + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = { value: '', depth: 0, isGlob: false }; + + if (finished === true) continue; + if (prev === CHAR_DOT && index === (start + 1)) { + start += 2; + continue; + } + + lastIndex = index + 1; + continue; + } + + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS + || code === CHAR_AT + || code === CHAR_ASTERISK + || code === CHAR_QUESTION_MARK + || code === CHAR_EXCLAMATION_MARK; + + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + if (code === CHAR_EXCLAMATION_MARK && index === start) { + negatedExtglob = true; + } + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES) { + isGlob = token.isGlob = true; + finished = true; + break; + } + } + continue; + } + break; + } + } + + if (code === CHAR_ASTERISK) { + if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_LEFT_SQUARE_BRACKET) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + break; + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_LEFT_PARENTHESES) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES) { + finished = true; + break; + } + } + continue; + } + break; + } + + if (isGlob === true) { + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + } + + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } + + let base = str; + let prefix = ''; + let glob = ''; + + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } + + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob = str.slice(lastIndex); + } else if (isGlob === true) { + base = ''; + glob = str; + } else { + base = str; + } + + if (base && base !== '' && base !== '/' && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } + + if (opts.unescape === true) { + if (glob) glob = utils.removeBackslashes(glob); + + if (base && backslashes === true) { + base = utils.removeBackslashes(base); + } + } + + const state = { + prefix, + input, + start, + base, + glob, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated, + negatedExtglob + }; + + if (opts.tokens === true) { + state.maxDepth = 0; + if (!isPathSeparator(code)) { + tokens.push(token); + } + state.tokens = tokens; + } + + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + + for (let idx = 0; idx < slashes.length; idx++) { + const n = prevIndex ? prevIndex + 1 : start; + const i = slashes[idx]; + const value = input.slice(n, i); + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; + } + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; + } + if (idx !== 0 || value !== '') { + parts.push(value); + } + prevIndex = i; + } + + if (prevIndex && prevIndex + 1 < input.length) { + const value = input.slice(prevIndex + 1); + parts.push(value); + + if (opts.tokens) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + } + + state.slashes = slashes; + state.parts = parts; + } + + return state; +}; + +module.exports = scan; diff --git a/node_modules/picomatch/lib/utils.js b/node_modules/picomatch/lib/utils.js new file mode 100644 index 00000000..c3ca766a --- /dev/null +++ b/node_modules/picomatch/lib/utils.js @@ -0,0 +1,64 @@ +'use strict'; + +const path = require('path'); +const win32 = process.platform === 'win32'; +const { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL +} = require('./constants'); + +exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); +exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); +exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); +exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); +exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); + +exports.removeBackslashes = str => { + return str.replace(REGEX_REMOVE_BACKSLASH, match => { + return match === '\\' ? '' : match; + }); +}; + +exports.supportsLookbehinds = () => { + const segs = process.version.slice(1).split('.').map(Number); + if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { + return true; + } + return false; +}; + +exports.isWindows = options => { + if (options && typeof options.windows === 'boolean') { + return options.windows; + } + return win32 === true || path.sep === '\\'; +}; + +exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) return input; + if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; +}; + +exports.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith('./')) { + output = output.slice(2); + state.prefix = './'; + } + return output; +}; + +exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? '' : '^'; + const append = options.contains ? '' : '$'; + + let output = `${prepend}(?:${input})${append}`; + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; + } + return output; +}; diff --git a/node_modules/picomatch/package.json b/node_modules/picomatch/package.json new file mode 100644 index 00000000..3db22d40 --- /dev/null +++ b/node_modules/picomatch/package.json @@ -0,0 +1,81 @@ +{ + "name": "picomatch", + "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", + "version": "2.3.1", + "homepage": "https://github.com/micromatch/picomatch", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "funding": "https://github.com/sponsors/jonschlinkert", + "repository": "micromatch/picomatch", + "bugs": { + "url": "https://github.com/micromatch/picomatch/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "lib" + ], + "main": "index.js", + "engines": { + "node": ">=8.6" + }, + "scripts": { + "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", + "mocha": "mocha --reporter dot", + "test": "npm run lint && npm run mocha", + "test:ci": "npm run test:cover", + "test:cover": "nyc npm run mocha" + }, + "devDependencies": { + "eslint": "^6.8.0", + "fill-range": "^7.0.1", + "gulp-format-md": "^2.0.0", + "mocha": "^6.2.2", + "nyc": "^15.0.0", + "time-require": "github:jonschlinkert/time-require" + }, + "keywords": [ + "glob", + "match", + "picomatch" + ], + "nyc": { + "reporter": [ + "html", + "lcov", + "text-summary" + ] + }, + "verb": { + "toc": { + "render": true, + "method": "preWrite", + "maxdepth": 3 + }, + "layout": "empty", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "braces", + "micromatch" + ] + }, + "reflinks": [ + "braces", + "expand-brackets", + "extglob", + "fill-range", + "micromatch", + "minimatch", + "nanomatch", + "picomatch" + ] + } +} diff --git a/node_modules/pify/index.js b/node_modules/pify/index.js new file mode 100644 index 00000000..7c720ebe --- /dev/null +++ b/node_modules/pify/index.js @@ -0,0 +1,68 @@ +'use strict'; + +var processFn = function (fn, P, opts) { + return function () { + var that = this; + var args = new Array(arguments.length); + + for (var i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + return new P(function (resolve, reject) { + args.push(function (err, result) { + if (err) { + reject(err); + } else if (opts.multiArgs) { + var results = new Array(arguments.length - 1); + + for (var i = 1; i < arguments.length; i++) { + results[i - 1] = arguments[i]; + } + + resolve(results); + } else { + resolve(result); + } + }); + + fn.apply(that, args); + }); + }; +}; + +var pify = module.exports = function (obj, P, opts) { + if (typeof P !== 'function') { + opts = P; + P = Promise; + } + + opts = opts || {}; + opts.exclude = opts.exclude || [/.+Sync$/]; + + var filter = function (key) { + var match = function (pattern) { + return typeof pattern === 'string' ? key === pattern : pattern.test(key); + }; + + return opts.include ? opts.include.some(match) : !opts.exclude.some(match); + }; + + var ret = typeof obj === 'function' ? function () { + if (opts.excludeMain) { + return obj.apply(this, arguments); + } + + return processFn(obj, P, opts).apply(this, arguments); + } : {}; + + return Object.keys(obj).reduce(function (ret, key) { + var x = obj[key]; + + ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x; + + return ret; + }, ret); +}; + +pify.all = pify; diff --git a/node_modules/pify/license b/node_modules/pify/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/pify/license @@ -0,0 +1,21 @@ +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/pify/package.json b/node_modules/pify/package.json new file mode 100644 index 00000000..311d1982 --- /dev/null +++ b/node_modules/pify/package.json @@ -0,0 +1,48 @@ +{ + "name": "pify", + "version": "2.3.0", + "description": "Promisify a callback-style function", + "license": "MIT", + "repository": "sindresorhus/pify", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava && npm run optimization-test", + "optimization-test": "node --allow-natives-syntax optimization-test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "promises", + "promisify", + "denodify", + "denodeify", + "callback", + "cb", + "node", + "then", + "thenify", + "convert", + "transform", + "wrap", + "wrapper", + "bind", + "to", + "async", + "es2015" + ], + "devDependencies": { + "ava": "*", + "pinkie-promise": "^1.0.0", + "v8-natives": "0.0.2", + "xo": "*" + } +} diff --git a/node_modules/pify/readme.md b/node_modules/pify/readme.md new file mode 100644 index 00000000..c79ca8bf --- /dev/null +++ b/node_modules/pify/readme.md @@ -0,0 +1,119 @@ +# pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify) + +> Promisify a callback-style function + + +## Install + +``` +$ npm install --save pify +``` + + +## Usage + +```js +const fs = require('fs'); +const pify = require('pify'); + +// promisify a single function + +pify(fs.readFile)('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); + +// or promisify all methods in a module + +pify(fs).readFile('package.json', 'utf8').then(data => { + console.log(JSON.parse(data).name); + //=> 'pify' +}); +``` + + +## API + +### pify(input, [promiseModule], [options]) + +Returns a promise wrapped version of the supplied function or module. + +#### input + +Type: `function`, `object` + +Callback-style function or module whose methods you want to promisify. + +#### promiseModule + +Type: `function` + +Custom promise module to use instead of the native one. + +Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. + +#### options + +##### multiArgs + +Type: `boolean` +Default: `false` + +By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. + +```js +const request = require('request'); +const pify = require('pify'); + +pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { + const [httpResponse, body] = result; +}); +``` + +##### include + +Type: `array` of (`string`|`regex`) + +Methods in a module to promisify. Remaining methods will be left untouched. + +##### exclude + +Type: `array` of (`string`|`regex`) +Default: `[/.+Sync$/]` + +Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. + +##### excludeMain + +Type: `boolean` +Default: `false` + +By default, if given module is a function itself, this function will be promisified. Turn this option on if you want to promisify only methods of the module. + +```js +const pify = require('pify'); + +function fn() { + return true; +} + +fn.method = (data, callback) => { + setImmediate(() => { + callback(data, null); + }); +}; + +// promisify methods but not fn() +const promiseFn = pify(fn, {excludeMain: true}); + +if (promiseFn()) { + promiseFn.method('hi').then(data => { + console.log(data); + }); +} +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/pirates/LICENSE b/node_modules/pirates/LICENSE new file mode 100644 index 00000000..acc7a0e0 --- /dev/null +++ b/node_modules/pirates/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016-2018 Ari Porad + +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/pirates/README.md b/node_modules/pirates/README.md new file mode 100644 index 00000000..f61065ef --- /dev/null +++ b/node_modules/pirates/README.md @@ -0,0 +1,69 @@ +# Pirates [![Coverage][codecov-badge]][codecov-link] + +### Properly hijack require + +[codecov-badge]: https://img.shields.io/codecov/c/github/danez/pirates/master.svg?style=flat "codecov" +[codecov-link]: https://codecov.io/gh/danez/pirates "codecov" + +## Why? + +Two reasons: +1. Babel and istanbul were breaking each other. +2. Everyone seemed to re-invent the wheel on this, and everyone wanted a solution that was DRY, simple, easy to use, +and made everything Just Work™, while allowing multiple require hooks, in a fashion similar to calling `super`. + +For some context, see [the Babel issue thread][] which started this all, then [the nyc issue thread][], where +discussion was moved (as we began to discuss just using the code nyc had developed), and finally to [#1][issue-1] +where discussion was finally moved. + +[the Babel issue thread]: https://github.com/babel/babel/pull/3062 "Babel Issue Thread" +[the nyc issue thread]: https://github.com/bcoe/nyc/issues/70 "NYC Issue Thread" +[issue-1]: https://github.com/danez/pirates/issues/1 "Issue #1" + +## Installation + + npm install --save pirates + +## Usage + +Using pirates is really easy: +```javascript +// my-module/register.js +const addHook = require('pirates').addHook; +// Or if you use ES modules +// import { addHook } from 'pirates'; + +function matcher(filename) { + // Here, you can inspect the filename to determine if it should be hooked or + // not. Just return a truthy/falsey. Files in node_modules are automatically ignored, + // unless otherwise specified in options (see below). + + // TODO: Implement your logic here + return true; +} + +const revert = addHook( + (code, filename) => code.replace('@@foo', 'console.log(\'foo\');'), + { exts: ['.js'], matcher } +); + +// And later, if you want to un-hook require, you can just do: +revert(); +``` + +## API + +### pirates.addHook(hook, [opts={ [matcher: true], [exts: ['.js']], [ignoreNodeModules: true] }]); +Add a require hook. `hook` must be a function that takes `(code, filename)`, and returns the modified code. `opts` is +an optional options object. Available options are: `matcher`, which is a function that accepts a filename, and +returns a truthy value if the file should be hooked (defaults to a function that always returns true), falsey if +otherwise; `exts`, which is an array of extensions to hook, they should begin with `.` (defaults to `['.js']`); +`ignoreNodeModules`, if true, any file in a `node_modules` folder wont be hooked (the matcher also wont be called), +if false, then the matcher will be called for any files in `node_modules` (defaults to true). + + +## Projects that use Pirates + +See the [wiki page](https://github.com/danez/pirates/wiki/Projects-using-Pirates). If you add Pirates to your project, +(And you should! It works best if everyone uses it. Then we can have a happy world full of happy require hooks!), please +add yourself to the wiki. diff --git a/node_modules/pirates/index.d.ts b/node_modules/pirates/index.d.ts new file mode 100644 index 00000000..b2d8ce66 --- /dev/null +++ b/node_modules/pirates/index.d.ts @@ -0,0 +1,82 @@ +/* (c) 2015 Ari Porad (@ariporad) . License: ariporad.mit-license.org */ + +/** + * The hook. Accepts the code of the module and the filename. + */ +declare type Hook = (code: string, filename: string) => string; + +/** + * A matcher function, will be called with path to a file. + * + * Should return truthy if the file should be hooked, falsy otherwise. + */ +declare type Matcher = (path: string) => boolean; + +/** + * Reverts the hook when called. + */ +declare type RevertFunction = () => void; +interface Options { + /** + * The extensions to hook. Should start with '.' (ex. ['.js']). + * + * Takes precedence over `exts`, `extension` and `ext`. + * + * @alias exts + * @alias extension + * @alias ext + * @default ['.js'] + */ + extensions?: ReadonlyArray | string; + + /** + * The extensions to hook. Should start with '.' (ex. ['.js']). + * + * Takes precedence over `extension` and `ext`. + * + * @alias extension + * @alias ext + * @default ['.js'] + */ + exts?: ReadonlyArray | string; + + /** + * The extensions to hook. Should start with '.' (ex. ['.js']). + * + * Takes precedence over `ext`. + * + * @alias ext + * @default ['.js'] + */ + extension?: ReadonlyArray | string; + + /** + * The extensions to hook. Should start with '.' (ex. ['.js']). + * + * @default ['.js'] + */ + ext?: ReadonlyArray | string; + + /** + * A matcher function, will be called with path to a file. + * + * Should return truthy if the file should be hooked, falsy otherwise. + */ + matcher?: Matcher | null; + + /** + * Auto-ignore node_modules. Independent of any matcher. + * + * @default true + */ + ignoreNodeModules?: boolean; +} + +/** + * Add a require hook. + * + * @param hook The hook. Accepts the code of the module and the filename. Required. + * @returns The `revert` function. Reverts the hook when called. + */ +export declare function addHook(hook: Hook, opts?: Options): RevertFunction; +export {}; diff --git a/node_modules/pirates/lib/index.js b/node_modules/pirates/lib/index.js new file mode 100644 index 00000000..aa5f5d75 --- /dev/null +++ b/node_modules/pirates/lib/index.js @@ -0,0 +1,139 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.addHook = addHook; +var _module = _interopRequireDefault(require("module")); +var _path = _interopRequireDefault(require("path")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/* (c) 2015 Ari Porad (@ariporad) . License: ariporad.mit-license.org */ + +const nodeModulesRegex = /^(?:.*[\\/])?node_modules(?:[\\/].*)?$/; +// Guard against poorly mocked module constructors. +const Module = module.constructor.length > 1 ? module.constructor : _module.default; +const HOOK_RETURNED_NOTHING_ERROR_MESSAGE = '[Pirates] A hook returned a non-string, or nothing at all! This is a' + ' violation of intergalactic law!\n' + '--------------------\n' + 'If you have no idea what this means or what Pirates is, let me explain: ' + 'Pirates is a module that makes is easy to implement require hooks. One of' + " the require hooks you're using uses it. One of these require hooks" + " didn't return anything from it's handler, so we don't know what to" + ' do. You might want to debug this.'; + +/** + * @param {string} filename The filename to check. + * @param {string[]} exts The extensions to hook. Should start with '.' (ex. ['.js']). + * @param {Matcher|null} matcher A matcher function, will be called with path to a file. Should return truthy if the file should be hooked, falsy otherwise. + * @param {boolean} ignoreNodeModules Auto-ignore node_modules. Independent of any matcher. + */ +function shouldCompile(filename, exts, matcher, ignoreNodeModules) { + if (typeof filename !== 'string') { + return false; + } + if (exts.indexOf(_path.default.extname(filename)) === -1) { + return false; + } + const resolvedFilename = _path.default.resolve(filename); + if (ignoreNodeModules && nodeModulesRegex.test(resolvedFilename)) { + return false; + } + if (matcher && typeof matcher === 'function') { + return !!matcher(resolvedFilename); + } + return true; +} + +/** + * @callback Hook The hook. Accepts the code of the module and the filename. + * @param {string} code + * @param {string} filename + * @returns {string} + */ +/** + * @callback Matcher A matcher function, will be called with path to a file. + * + * Should return truthy if the file should be hooked, falsy otherwise. + * @param {string} path + * @returns {boolean} + */ +/** + * @callback RevertFunction Reverts the hook when called. + * @returns {void} + */ +/** + * @typedef {object} Options + * @property {Matcher|null} [matcher=null] A matcher function, will be called with path to a file. + * + * Should return truthy if the file should be hooked, falsy otherwise. + * + * @property {string[]} [extensions=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']). + * @property {string[]} [exts=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']). + * + * @property {string[]} [extension=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']). + * @property {string[]} [ext=['.js']] The extensions to hook. Should start with '.' (ex. ['.js']). + * + * @property {boolean} [ignoreNodeModules=true] Auto-ignore node_modules. Independent of any matcher. + */ + +/** + * Add a require hook. + * + * @param {Hook} hook The hook. Accepts the code of the module and the filename. Required. + * @param {Options} [opts] Options + * @returns {RevertFunction} The `revert` function. Reverts the hook when called. + */ +function addHook(hook, opts = {}) { + let reverted = false; + const loaders = []; + const oldLoaders = []; + let exts; + + // We need to do this to fix #15. Basically, if you use a non-standard extension (ie. .jsx), then + // We modify the .js loader, then use the modified .js loader for as the base for .jsx. + // This prevents that. + const originalJSLoader = Module._extensions['.js']; + const matcher = opts.matcher || null; + const ignoreNodeModules = opts.ignoreNodeModules !== false; + exts = opts.extensions || opts.exts || opts.extension || opts.ext || ['.js']; + if (!Array.isArray(exts)) { + exts = [exts]; + } + exts.forEach(ext => { + if (typeof ext !== 'string') { + throw new TypeError(`Invalid Extension: ${ext}`); + } + const oldLoader = Module._extensions[ext] || originalJSLoader; + oldLoaders[ext] = Module._extensions[ext]; + loaders[ext] = Module._extensions[ext] = function newLoader(mod, filename) { + let compile; + if (!reverted) { + if (shouldCompile(filename, exts, matcher, ignoreNodeModules)) { + compile = mod._compile; + mod._compile = function _compile(code) { + // reset the compile immediately as otherwise we end up having the + // compile function being changed even though this loader might be reverted + // Not reverting it here leads to long useless compile chains when doing + // addHook -> revert -> addHook -> revert -> ... + // The compile function is also anyway created new when the loader is called a second time. + mod._compile = compile; + const newCode = hook(code, filename); + if (typeof newCode !== 'string') { + throw new Error(HOOK_RETURNED_NOTHING_ERROR_MESSAGE); + } + return mod._compile(newCode, filename); + }; + } + } + oldLoader(mod, filename); + }; + }); + return function revert() { + if (reverted) return; + reverted = true; + exts.forEach(ext => { + // if the current loader for the extension is our loader then unregister it and set the oldLoader again + // if not we can not do anything as we cannot remove a loader from within the loader-chain + if (Module._extensions[ext] === loaders[ext]) { + if (!oldLoaders[ext]) { + delete Module._extensions[ext]; + } else { + Module._extensions[ext] = oldLoaders[ext]; + } + } + }); + }; +} \ No newline at end of file diff --git a/node_modules/pirates/package.json b/node_modules/pirates/package.json new file mode 100644 index 00000000..331ed0e0 --- /dev/null +++ b/node_modules/pirates/package.json @@ -0,0 +1,74 @@ +{ + "name": "pirates", + "description": "Properly hijack require, i.e., properly define require hooks and customizations", + "main": "lib/index.js", + "types": "index.d.ts", + "scripts": { + "clean": "rimraf lib", + "build": "babel src -d lib", + "test": "cross-env BABEL_ENV=test yarn run build && nyc ava", + "lint": "eslint --report-unused-disable-directives .", + "prepublishOnly": "yarn run build" + }, + "files": [ + "lib", + "index.d.ts" + ], + "repository": { + "type": "git", + "url": "https://github.com/danez/pirates.git" + }, + "engines": { + "node": ">= 6" + }, + "author": { + "name": "Ari Porad", + "email": "ari@ariporad.com", + "url": "http://ariporad.com" + }, + "devDependencies": { + "@babel/cli": "7.21.0", + "@babel/core": "7.21.4", + "@babel/preset-env": "7.21.4", + "ava": "1.4.1", + "babel-core": "7.0.0-bridge.0", + "babel-eslint": "10.1.0", + "babel-plugin-istanbul": "5.2.0", + "cross-env": "5.2.1", + "decache": "4.6.1", + "eslint": "5.16.0", + "eslint-config-prettier": "4.3.0", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-prettier": "3.4.1", + "mock-require": "3.0.3", + "nyc": "13.3.0", + "prettier": "1.19.1", + "rewire": "4.0.1", + "rimraf": "3.0.2" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/danez/pirates/issues" + }, + "homepage": "https://github.com/danez/pirates#readme", + "ava": { + "files": [ + "test/*.js" + ], + "sources": [ + "lib/**/*.js" + ] + }, + "nyc": { + "include": [ + "src/*.js" + ], + "reporter": [ + "json", + "text" + ], + "sourceMap": false, + "instrument": false + }, + "version": "4.0.6" +} diff --git a/node_modules/pkg-dir/index.d.ts b/node_modules/pkg-dir/index.d.ts new file mode 100644 index 00000000..e339404e --- /dev/null +++ b/node_modules/pkg-dir/index.d.ts @@ -0,0 +1,44 @@ +declare const pkgDir: { + /** + Find the root directory of a Node.js project or npm package. + + @param cwd - Directory to start from. Default: `process.cwd()`. + @returns The project root path or `undefined` if it couldn't be found. + + @example + ``` + // / + // └── Users + // └── sindresorhus + // └── foo + // ├── package.json + // └── bar + // ├── baz + // └── example.js + + // example.js + import pkgDir = require('pkg-dir'); + + (async () => { + const rootDir = await pkgDir(__dirname); + + console.log(rootDir); + //=> '/Users/sindresorhus/foo' + })(); + ``` + */ + (cwd?: string): Promise; + + /** + Synchronously find the root directory of a Node.js project or npm package. + + @param cwd - Directory to start from. Default: `process.cwd()`. + @returns The project root path or `undefined` if it couldn't be found. + */ + sync(cwd?: string): string | undefined; + + // TODO: Remove this for the next major release + default: typeof pkgDir; +}; + +export = pkgDir; diff --git a/node_modules/pkg-dir/index.js b/node_modules/pkg-dir/index.js new file mode 100644 index 00000000..83e683d8 --- /dev/null +++ b/node_modules/pkg-dir/index.js @@ -0,0 +1,17 @@ +'use strict'; +const path = require('path'); +const findUp = require('find-up'); + +const pkgDir = async cwd => { + const filePath = await findUp('package.json', {cwd}); + return filePath && path.dirname(filePath); +}; + +module.exports = pkgDir; +// TODO: Remove this for the next major release +module.exports.default = pkgDir; + +module.exports.sync = cwd => { + const filePath = findUp.sync('package.json', {cwd}); + return filePath && path.dirname(filePath); +}; diff --git a/node_modules/pkg-dir/license b/node_modules/pkg-dir/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/pkg-dir/license @@ -0,0 +1,9 @@ +MIT License + +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/pkg-dir/package.json b/node_modules/pkg-dir/package.json new file mode 100644 index 00000000..aad11e82 --- /dev/null +++ b/node_modules/pkg-dir/package.json @@ -0,0 +1,56 @@ +{ + "name": "pkg-dir", + "version": "4.2.0", + "description": "Find the root directory of a Node.js project or npm package", + "license": "MIT", + "repository": "sindresorhus/pkg-dir", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "package", + "json", + "root", + "npm", + "entry", + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "resolve", + "parent", + "parents", + "folder", + "directory", + "dir", + "walk", + "walking", + "path" + ], + "dependencies": { + "find-up": "^4.0.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tempy": "^0.3.0", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/pkg-dir/readme.md b/node_modules/pkg-dir/readme.md new file mode 100644 index 00000000..92a77f45 --- /dev/null +++ b/node_modules/pkg-dir/readme.md @@ -0,0 +1,66 @@ +# pkg-dir [![Build Status](https://travis-ci.org/sindresorhus/pkg-dir.svg?branch=master)](https://travis-ci.org/sindresorhus/pkg-dir) + +> Find the root directory of a Node.js project or npm package + + +## Install + +``` +$ npm install pkg-dir +``` + + +## Usage + +``` +/ +└── Users + └── sindresorhus + └── foo + ├── package.json + └── bar + ├── baz + └── example.js +``` + +```js +// example.js +const pkgDir = require('pkg-dir'); + +(async () => { + const rootDir = await pkgDir(__dirname); + + console.log(rootDir); + //=> '/Users/sindresorhus/foo' +})(); +``` + + +## API + +### pkgDir([cwd]) + +Returns a `Promise` for either the project root path or `undefined` if it couldn't be found. + +### pkgDir.sync([cwd]) + +Returns the project root path or `undefined` if it couldn't be found. + +#### cwd + +Type: `string`
    +Default: `process.cwd()` + +Directory to start from. + + +## Related + +- [pkg-dir-cli](https://github.com/sindresorhus/pkg-dir-cli) - CLI for this module +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/postcss-import/LICENSE b/node_modules/postcss-import/LICENSE new file mode 100755 index 00000000..13983fbf --- /dev/null +++ b/node_modules/postcss-import/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Maxime Thirouin, Jason Campbell & Kevin Mårtensson + +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/postcss-import/README.md b/node_modules/postcss-import/README.md new file mode 100644 index 00000000..ac0148e1 --- /dev/null +++ b/node_modules/postcss-import/README.md @@ -0,0 +1,244 @@ +# postcss-import + +[![Build](https://img.shields.io/travis/postcss/postcss-import/master)](https://travis-ci.org/postcss/postcss-import) +[![Version](https://img.shields.io/npm/v/postcss-import)](https://github.com/postcss/postcss-import/blob/master/CHANGELOG.md) +[![postcss compatibility](https://img.shields.io/npm/dependency-version/postcss-import/peer/postcss)](https://postcss.org/) + +> [PostCSS](https://github.com/postcss/postcss) plugin to transform `@import` +rules by inlining content. + +This plugin can consume local files, node modules or web_modules. +To resolve path of an `@import` rule, it can look into root directory +(by default `process.cwd()`), `web_modules`, `node_modules` +or local modules. +_When importing a module, it will look for `index.css` or file referenced in +`package.json` in the `style` or `main` fields._ +You can also provide manually multiples paths where to look at. + +**Notes:** + +- **This plugin should probably be used as the first plugin of your list. +This way, other plugins will work on the AST as if there were only a single file +to process, and will probably work as you can expect**. +- This plugin works great with +[postcss-url](https://github.com/postcss/postcss-url) plugin, +which will allow you to adjust assets `url()` (or even inline them) after +inlining imported files. +- In order to optimize output, **this plugin will only import a file once** on +a given scope (root, media query...). +Tests are made from the path & the content of imported files (using a hash +table). +If this behavior is not what you want, look at `skipDuplicates` option +- If you are looking for **Glob Imports**, you can use [postcss-import-ext-glob](https://github.com/dimitrinicolas/postcss-import-ext-glob) to extend postcss-import. +- Imports which are not modified (by `options.filter` or because they are remote + imports) are moved to the top of the output. +- **This plugin attempts to follow the CSS `@import` spec**; `@import` + statements must precede all other statements (besides `@charset`). + +## Installation + +```console +$ npm install -D postcss-import +``` + +## Usage + +Unless your stylesheet is in the same place where you run postcss +(`process.cwd()`), you will need to use `from` option to make relative imports +work. + +```js +// dependencies +const fs = require("fs") +const postcss = require("postcss") +const atImport = require("postcss-import") + +// css to be processed +const css = fs.readFileSync("css/input.css", "utf8") + +// process css +postcss() + .use(atImport()) + .process(css, { + // `from` option is needed here + from: "css/input.css" + }) + .then((result) => { + const output = result.css + + console.log(output) + }) +``` + +`css/input.css`: + +```css +/* can consume `node_modules`, `web_modules` or local modules */ +@import "cssrecipes-defaults"; /* == @import "../node_modules/cssrecipes-defaults/index.css"; */ +@import "normalize.css"; /* == @import "../node_modules/normalize.css/normalize.css"; */ + +@import "foo.css"; /* relative to css/ according to `from` option above */ + +@import "bar.css" (min-width: 25em); + +@import 'baz.css' layer(baz-layer); + +body { + background: black; +} +``` + +will give you: + +```css +/* ... content of ../node_modules/cssrecipes-defaults/index.css */ +/* ... content of ../node_modules/normalize.css/normalize.css */ + +/* ... content of css/foo.css */ + +@media (min-width: 25em) { +/* ... content of css/bar.css */ +} + +@layer baz-layer { +/* ... content of css/baz.css */ +} + +body { + background: black; +} +``` + +Checkout the [tests](test) for more examples. + +### Options + +### `filter` +Type: `Function` +Default: `() => true` + +Only transform imports for which the test function returns `true`. Imports for +which the test function returns `false` will be left as is. The function gets +the path to import as an argument and should return a boolean. + +#### `root` + +Type: `String` +Default: `process.cwd()` or _dirname of +[the postcss `from`](https://github.com/postcss/postcss#node-source)_ + +Define the root where to resolve path (eg: place where `node_modules` are). +Should not be used that much. +_Note: nested `@import` will additionally benefit of the relative dirname of +imported files._ + +#### `path` + +Type: `String|Array` +Default: `[]` + +A string or an array of paths in where to look for files. + +#### `plugins` + +Type: `Array` +Default: `undefined` + +An array of plugins to be applied on each imported files. + +#### `resolve` + +Type: `Function` +Default: `null` + +You can provide a custom path resolver with this option. This function gets +`(id, basedir, importOptions)` arguments and should return a path, an array of +paths or a promise resolving to the path(s). If you do not return an absolute +path, your path will be resolved to an absolute path using the default +resolver. +You can use [resolve](https://github.com/substack/node-resolve) for this. + +#### `load` + +Type: `Function` +Default: null + +You can overwrite the default loading way by setting this option. +This function gets `(filename, importOptions)` arguments and returns content or +promised content. + +#### `skipDuplicates` + +Type: `Boolean` +Default: `true` + +By default, similar files (based on the same content) are being skipped. +It's to optimize output and skip similar files like `normalize.css` for example. +If this behavior is not what you want, just set this option to `false` to +disable it. + +#### `addModulesDirectories` + +Type: `Array` +Default: `[]` + +An array of folder names to add to [Node's resolver](https://github.com/substack/node-resolve). +Values will be appended to the default resolve directories: +`["node_modules", "web_modules"]`. + +This option is only for adding additional directories to default resolver. If +you provide your own resolver via the `resolve` configuration option above, then +this value will be ignored. + +#### `nameLayer` + +Type: `Function` +Default: `null` + +You can provide a custom naming function for anonymous layers (`@import 'baz.css' layer;`). +This function gets `(index, rootFilename)` arguments and should return a unique string. + +This option only influences imports without a layer name. +Without this option the plugin will warn on anonymous layers. + +#### Example with some options + +```js +const postcss = require("postcss") +const atImport = require("postcss-import") + +postcss() + .use(atImport({ + path: ["src/css"], + })) + .process(cssString) + .then((result) => { + const { css } = result + }) +``` + +## `dependency` Message Support + +`postcss-import` adds a message to `result.messages` for each `@import`. Messages are in the following format: + +``` +{ + type: 'dependency', + file: absoluteFilePath, + parent: fileContainingTheImport +} +``` + +This is mainly for use by postcss runners that implement file watching. + +--- + +## CONTRIBUTING + +* ⇄ Pull requests and ★ Stars are always welcome. +* For bugs and feature requests, please create an issue. +* Pull requests must be accompanied by passing automated tests (`$ npm test`). + +## [Changelog](CHANGELOG.md) + +## [License](LICENSE) diff --git a/node_modules/postcss-import/index.js b/node_modules/postcss-import/index.js new file mode 100755 index 00000000..d324a7e0 --- /dev/null +++ b/node_modules/postcss-import/index.js @@ -0,0 +1,420 @@ +"use strict" +// builtin tooling +const path = require("path") + +// internal tooling +const joinMedia = require("./lib/join-media") +const joinLayer = require("./lib/join-layer") +const resolveId = require("./lib/resolve-id") +const loadContent = require("./lib/load-content") +const processContent = require("./lib/process-content") +const parseStatements = require("./lib/parse-statements") +const assignLayerNames = require("./lib/assign-layer-names") +const dataURL = require("./lib/data-url") + +function AtImport(options) { + options = { + root: process.cwd(), + path: [], + skipDuplicates: true, + resolve: resolveId, + load: loadContent, + plugins: [], + addModulesDirectories: [], + nameLayer: null, + ...options, + } + + options.root = path.resolve(options.root) + + // convert string to an array of a single element + if (typeof options.path === "string") options.path = [options.path] + + if (!Array.isArray(options.path)) options.path = [] + + options.path = options.path.map(p => path.resolve(options.root, p)) + + return { + postcssPlugin: "postcss-import", + Once(styles, { result, atRule, postcss }) { + const state = { + importedFiles: {}, + hashFiles: {}, + rootFilename: null, + anonymousLayerCounter: 0, + } + + if (styles.source?.input?.file) { + state.rootFilename = styles.source.input.file + state.importedFiles[styles.source.input.file] = {} + } + + if (options.plugins && !Array.isArray(options.plugins)) { + throw new Error("plugins option must be an array") + } + + if (options.nameLayer && typeof options.nameLayer !== "function") { + throw new Error("nameLayer option must be a function") + } + + return parseStyles(result, styles, options, state, [], []).then( + bundle => { + applyRaws(bundle) + applyMedia(bundle) + applyStyles(bundle, styles) + } + ) + + function applyRaws(bundle) { + bundle.forEach((stmt, index) => { + if (index === 0) return + + if (stmt.parent) { + const { before } = stmt.parent.node.raws + if (stmt.type === "nodes") stmt.nodes[0].raws.before = before + else stmt.node.raws.before = before + } else if (stmt.type === "nodes") { + stmt.nodes[0].raws.before = stmt.nodes[0].raws.before || "\n" + } + }) + } + + function applyMedia(bundle) { + bundle.forEach(stmt => { + if ( + (!stmt.media.length && !stmt.layer.length) || + stmt.type === "charset" + ) { + return + } + + if (stmt.layer.length > 1) { + assignLayerNames(stmt.layer, stmt.node, state, options) + } + + if (stmt.type === "import") { + const parts = [stmt.fullUri] + + const media = stmt.media.join(", ") + + if (stmt.layer.length) { + const layerName = stmt.layer.join(".") + + let layerParams = "layer" + if (layerName) { + layerParams = `layer(${layerName})` + } + + parts.push(layerParams) + } + + if (media) { + parts.push(media) + } + + stmt.node.params = parts.join(" ") + } else if (stmt.type === "media") { + if (stmt.layer.length) { + const layerNode = atRule({ + name: "layer", + params: stmt.layer.join("."), + source: stmt.node.source, + }) + + if (stmt.parentMedia?.length) { + const mediaNode = atRule({ + name: "media", + params: stmt.parentMedia.join(", "), + source: stmt.node.source, + }) + + mediaNode.append(layerNode) + layerNode.append(stmt.node) + stmt.node = mediaNode + } else { + layerNode.append(stmt.node) + stmt.node = layerNode + } + } else { + stmt.node.params = stmt.media.join(", ") + } + } else { + const { nodes } = stmt + const { parent } = nodes[0] + + let outerAtRule + let innerAtRule + if (stmt.media.length && stmt.layer.length) { + const mediaNode = atRule({ + name: "media", + params: stmt.media.join(", "), + source: parent.source, + }) + + const layerNode = atRule({ + name: "layer", + params: stmt.layer.join("."), + source: parent.source, + }) + + mediaNode.append(layerNode) + innerAtRule = layerNode + outerAtRule = mediaNode + } else if (stmt.media.length) { + const mediaNode = atRule({ + name: "media", + params: stmt.media.join(", "), + source: parent.source, + }) + + innerAtRule = mediaNode + outerAtRule = mediaNode + } else if (stmt.layer.length) { + const layerNode = atRule({ + name: "layer", + params: stmt.layer.join("."), + source: parent.source, + }) + + innerAtRule = layerNode + outerAtRule = layerNode + } + + parent.insertBefore(nodes[0], outerAtRule) + + // remove nodes + nodes.forEach(node => { + node.parent = undefined + }) + + // better output + nodes[0].raws.before = nodes[0].raws.before || "\n" + + // wrap new rules with media query and/or layer at rule + innerAtRule.append(nodes) + + stmt.type = "media" + stmt.node = outerAtRule + delete stmt.nodes + } + }) + } + + function applyStyles(bundle, styles) { + styles.nodes = [] + + // Strip additional statements. + bundle.forEach(stmt => { + if (["charset", "import", "media"].includes(stmt.type)) { + stmt.node.parent = undefined + styles.append(stmt.node) + } else if (stmt.type === "nodes") { + stmt.nodes.forEach(node => { + node.parent = undefined + styles.append(node) + }) + } + }) + } + + function parseStyles(result, styles, options, state, media, layer) { + const statements = parseStatements(result, styles) + + return Promise.resolve(statements) + .then(stmts => { + // process each statement in series + return stmts.reduce((promise, stmt) => { + return promise.then(() => { + stmt.media = joinMedia(media, stmt.media || []) + stmt.parentMedia = media + stmt.layer = joinLayer(layer, stmt.layer || []) + + // skip protocol base uri (protocol://url) or protocol-relative + if ( + stmt.type !== "import" || + /^(?:[a-z]+:)?\/\//i.test(stmt.uri) + ) { + return + } + + if (options.filter && !options.filter(stmt.uri)) { + // rejected by filter + return + } + + return resolveImportId(result, stmt, options, state) + }) + }, Promise.resolve()) + }) + .then(() => { + let charset + const imports = [] + const bundle = [] + + function handleCharset(stmt) { + if (!charset) charset = stmt + // charsets aren't case-sensitive, so convert to lower case to compare + else if ( + stmt.node.params.toLowerCase() !== + charset.node.params.toLowerCase() + ) { + throw new Error( + `Incompatable @charset statements: + ${stmt.node.params} specified in ${stmt.node.source.input.file} + ${charset.node.params} specified in ${charset.node.source.input.file}` + ) + } + } + + // squash statements and their children + statements.forEach(stmt => { + if (stmt.type === "charset") handleCharset(stmt) + else if (stmt.type === "import") { + if (stmt.children) { + stmt.children.forEach((child, index) => { + if (child.type === "import") imports.push(child) + else if (child.type === "charset") handleCharset(child) + else bundle.push(child) + // For better output + if (index === 0) child.parent = stmt + }) + } else imports.push(stmt) + } else if (stmt.type === "media" || stmt.type === "nodes") { + bundle.push(stmt) + } + }) + + return charset + ? [charset, ...imports.concat(bundle)] + : imports.concat(bundle) + }) + } + + function resolveImportId(result, stmt, options, state) { + if (dataURL.isValid(stmt.uri)) { + return loadImportContent(result, stmt, stmt.uri, options, state).then( + result => { + stmt.children = result + } + ) + } + + const atRule = stmt.node + let sourceFile + if (atRule.source?.input?.file) { + sourceFile = atRule.source.input.file + } + const base = sourceFile + ? path.dirname(atRule.source.input.file) + : options.root + + return Promise.resolve(options.resolve(stmt.uri, base, options)) + .then(paths => { + if (!Array.isArray(paths)) paths = [paths] + // Ensure that each path is absolute: + return Promise.all( + paths.map(file => { + return !path.isAbsolute(file) + ? resolveId(file, base, options) + : file + }) + ) + }) + .then(resolved => { + // Add dependency messages: + resolved.forEach(file => { + result.messages.push({ + type: "dependency", + plugin: "postcss-import", + file, + parent: sourceFile, + }) + }) + + return Promise.all( + resolved.map(file => { + return loadImportContent(result, stmt, file, options, state) + }) + ) + }) + .then(result => { + // Merge loaded statements + stmt.children = result.reduce((result, statements) => { + return statements ? result.concat(statements) : result + }, []) + }) + } + + function loadImportContent(result, stmt, filename, options, state) { + const atRule = stmt.node + const { media, layer } = stmt + + assignLayerNames(layer, atRule, state, options) + + if (options.skipDuplicates) { + // skip files already imported at the same scope + if (state.importedFiles[filename]?.[media]?.[layer]) { + return + } + + // save imported files to skip them next time + if (!state.importedFiles[filename]) { + state.importedFiles[filename] = {} + } + if (!state.importedFiles[filename][media]) { + state.importedFiles[filename][media] = {} + } + state.importedFiles[filename][media][layer] = true + } + + return Promise.resolve(options.load(filename, options)).then( + content => { + if (content.trim() === "") { + result.warn(`${filename} is empty`, { node: atRule }) + return + } + + // skip previous imported files not containing @import rules + if (state.hashFiles[content]?.[media]?.[layer]) { + return + } + + return processContent( + result, + content, + filename, + options, + postcss + ).then(importedResult => { + const styles = importedResult.root + result.messages = result.messages.concat(importedResult.messages) + + if (options.skipDuplicates) { + const hasImport = styles.some(child => { + return child.type === "atrule" && child.name === "import" + }) + if (!hasImport) { + // save hash files to skip them next time + if (!state.hashFiles[content]) { + state.hashFiles[content] = {} + } + if (!state.hashFiles[content][media]) { + state.hashFiles[content][media] = {} + } + state.hashFiles[content][media][layer] = true + } + } + + // recursion: import @import from imported file + return parseStyles(result, styles, options, state, media, layer) + }) + } + ) + } + }, + } +} + +AtImport.postcss = true + +module.exports = AtImport diff --git a/node_modules/postcss-import/lib/assign-layer-names.js b/node_modules/postcss-import/lib/assign-layer-names.js new file mode 100644 index 00000000..18cfcc71 --- /dev/null +++ b/node_modules/postcss-import/lib/assign-layer-names.js @@ -0,0 +1,17 @@ +"use strict" + +module.exports = function (layer, node, state, options) { + layer.forEach((layerPart, i) => { + if (layerPart.trim() === "") { + if (options.nameLayer) { + layer[i] = options + .nameLayer(state.anonymousLayerCounter++, state.rootFilename) + .toString() + } else { + throw node.error( + `When using anonymous layers in @import you must also set the "nameLayer" plugin option` + ) + } + } + }) +} diff --git a/node_modules/postcss-import/lib/data-url.js b/node_modules/postcss-import/lib/data-url.js new file mode 100644 index 00000000..a59c5fb5 --- /dev/null +++ b/node_modules/postcss-import/lib/data-url.js @@ -0,0 +1,17 @@ +"use strict" + +const dataURLRegexp = /^data:text\/css;base64,/i + +function isValid(url) { + return dataURLRegexp.test(url) +} + +function contents(url) { + // "data:text/css;base64,".length === 21 + return Buffer.from(url.slice(21), "base64").toString() +} + +module.exports = { + isValid, + contents, +} diff --git a/node_modules/postcss-import/lib/join-layer.js b/node_modules/postcss-import/lib/join-layer.js new file mode 100644 index 00000000..9d915193 --- /dev/null +++ b/node_modules/postcss-import/lib/join-layer.js @@ -0,0 +1,9 @@ +"use strict" + +module.exports = function (parentLayer, childLayer) { + if (!parentLayer.length && childLayer.length) return childLayer + if (parentLayer.length && !childLayer.length) return parentLayer + if (!parentLayer.length && !childLayer.length) return [] + + return parentLayer.concat(childLayer) +} diff --git a/node_modules/postcss-import/lib/join-media.js b/node_modules/postcss-import/lib/join-media.js new file mode 100644 index 00000000..fcaaecd3 --- /dev/null +++ b/node_modules/postcss-import/lib/join-media.js @@ -0,0 +1,28 @@ +"use strict" + +const startsWithKeywordRegexp = /^(all|not|only|print|screen)/i + +module.exports = function (parentMedia, childMedia) { + if (!parentMedia.length && childMedia.length) return childMedia + if (parentMedia.length && !childMedia.length) return parentMedia + if (!parentMedia.length && !childMedia.length) return [] + + const media = [] + + parentMedia.forEach(parentItem => { + const parentItemStartsWithKeyword = startsWithKeywordRegexp.test(parentItem) + + childMedia.forEach(childItem => { + const childItemStartsWithKeyword = startsWithKeywordRegexp.test(childItem) + if (parentItem !== childItem) { + if (childItemStartsWithKeyword && !parentItemStartsWithKeyword) { + media.push(`${childItem} and ${parentItem}`) + } else { + media.push(`${parentItem} and ${childItem}`) + } + } + }) + }) + + return media +} diff --git a/node_modules/postcss-import/lib/load-content.js b/node_modules/postcss-import/lib/load-content.js new file mode 100644 index 00000000..c10b57e4 --- /dev/null +++ b/node_modules/postcss-import/lib/load-content.js @@ -0,0 +1,12 @@ +"use strict" + +const readCache = require("read-cache") +const dataURL = require("./data-url") + +module.exports = filename => { + if (dataURL.isValid(filename)) { + return dataURL.contents(filename) + } + + return readCache(filename, "utf-8") +} diff --git a/node_modules/postcss-import/lib/parse-statements.js b/node_modules/postcss-import/lib/parse-statements.js new file mode 100644 index 00000000..0c94e5a4 --- /dev/null +++ b/node_modules/postcss-import/lib/parse-statements.js @@ -0,0 +1,172 @@ +"use strict" + +// external tooling +const valueParser = require("postcss-value-parser") + +// extended tooling +const { stringify } = valueParser + +function split(params, start) { + const list = [] + const last = params.reduce((item, node, index) => { + if (index < start) return "" + if (node.type === "div" && node.value === ",") { + list.push(item) + return "" + } + return item + stringify(node) + }, "") + list.push(last) + return list +} + +module.exports = function (result, styles) { + const statements = [] + let nodes = [] + + styles.each(node => { + let stmt + if (node.type === "atrule") { + if (node.name === "import") stmt = parseImport(result, node) + else if (node.name === "media") stmt = parseMedia(result, node) + else if (node.name === "charset") stmt = parseCharset(result, node) + } + + if (stmt) { + if (nodes.length) { + statements.push({ + type: "nodes", + nodes, + media: [], + layer: [], + }) + nodes = [] + } + statements.push(stmt) + } else nodes.push(node) + }) + + if (nodes.length) { + statements.push({ + type: "nodes", + nodes, + media: [], + layer: [], + }) + } + + return statements +} + +function parseMedia(result, atRule) { + const params = valueParser(atRule.params).nodes + return { + type: "media", + node: atRule, + media: split(params, 0), + layer: [], + } +} + +function parseCharset(result, atRule) { + if (atRule.prev()) { + return result.warn("@charset must precede all other statements", { + node: atRule, + }) + } + return { + type: "charset", + node: atRule, + media: [], + layer: [], + } +} + +function parseImport(result, atRule) { + let prev = atRule.prev() + if (prev) { + do { + if ( + prev.type !== "comment" && + (prev.type !== "atrule" || + (prev.name !== "import" && + prev.name !== "charset" && + !(prev.name === "layer" && !prev.nodes))) + ) { + return result.warn( + "@import must precede all other statements (besides @charset or empty @layer)", + { node: atRule } + ) + } + prev = prev.prev() + } while (prev) + } + + if (atRule.nodes) { + return result.warn( + "It looks like you didn't end your @import statement correctly. " + + "Child nodes are attached to it.", + { node: atRule } + ) + } + + const params = valueParser(atRule.params).nodes + const stmt = { + type: "import", + node: atRule, + media: [], + layer: [], + } + + // prettier-ignore + if ( + !params.length || + ( + params[0].type !== "string" || + !params[0].value + ) && + ( + params[0].type !== "function" || + params[0].value !== "url" || + !params[0].nodes.length || + !params[0].nodes[0].value + ) + ) { + return result.warn(`Unable to find uri in '${ atRule.toString() }'`, { + node: atRule, + }) + } + + if (params[0].type === "string") stmt.uri = params[0].value + else stmt.uri = params[0].nodes[0].value + stmt.fullUri = stringify(params[0]) + + let remainder = params + if (remainder.length > 2) { + if ( + (remainder[2].type === "word" || remainder[2].type === "function") && + remainder[2].value === "layer" + ) { + if (remainder[1].type !== "space") { + return result.warn("Invalid import layer statement", { node: atRule }) + } + + if (remainder[2].nodes) { + stmt.layer = [stringify(remainder[2].nodes)] + } else { + stmt.layer = [""] + } + remainder = remainder.slice(2) + } + } + + if (remainder.length > 2) { + if (remainder[1].type !== "space") { + return result.warn("Invalid import media statement", { node: atRule }) + } + + stmt.media = split(remainder, 2) + } + + return stmt +} diff --git a/node_modules/postcss-import/lib/process-content.js b/node_modules/postcss-import/lib/process-content.js new file mode 100644 index 00000000..ec413e06 --- /dev/null +++ b/node_modules/postcss-import/lib/process-content.js @@ -0,0 +1,59 @@ +"use strict" + +// builtin tooling +const path = require("path") + +// placeholder tooling +let sugarss + +module.exports = function processContent( + result, + content, + filename, + options, + postcss +) { + const { plugins } = options + const ext = path.extname(filename) + + const parserList = [] + + // SugarSS support: + if (ext === ".sss") { + if (!sugarss) { + try { + sugarss = require("sugarss") + } catch {} // Ignore + } + if (sugarss) + return runPostcss(postcss, content, filename, plugins, [sugarss]) + } + + // Syntax support: + if (result.opts.syntax?.parse) { + parserList.push(result.opts.syntax.parse) + } + + // Parser support: + if (result.opts.parser) parserList.push(result.opts.parser) + // Try the default as a last resort: + parserList.push(null) + + return runPostcss(postcss, content, filename, plugins, parserList) +} + +function runPostcss(postcss, content, filename, plugins, parsers, index) { + if (!index) index = 0 + return postcss(plugins) + .process(content, { + from: filename, + parser: parsers[index], + }) + .catch(err => { + // If there's an error, try the next parser + index++ + // If there are no parsers left, throw it + if (index === parsers.length) throw err + return runPostcss(postcss, content, filename, plugins, parsers, index) + }) +} diff --git a/node_modules/postcss-import/lib/resolve-id.js b/node_modules/postcss-import/lib/resolve-id.js new file mode 100644 index 00000000..ffef034c --- /dev/null +++ b/node_modules/postcss-import/lib/resolve-id.js @@ -0,0 +1,42 @@ +"use strict" + +// external tooling +const resolve = require("resolve") + +const moduleDirectories = ["web_modules", "node_modules"] + +function resolveModule(id, opts) { + return new Promise((res, rej) => { + resolve(id, opts, (err, path) => (err ? rej(err) : res(path))) + }) +} + +module.exports = function (id, base, options) { + const paths = options.path + + const resolveOpts = { + basedir: base, + moduleDirectory: moduleDirectories.concat(options.addModulesDirectories), + paths, + extensions: [".css"], + packageFilter: function processPackage(pkg) { + if (pkg.style) pkg.main = pkg.style + else if (!pkg.main || !/\.css$/.test(pkg.main)) pkg.main = "index.css" + return pkg + }, + preserveSymlinks: false, + } + + return resolveModule(`./${id}`, resolveOpts) + .catch(() => resolveModule(id, resolveOpts)) + .catch(() => { + if (paths.indexOf(base) === -1) paths.unshift(base) + + throw new Error( + `Failed to find '${id}' + in [ + ${paths.join(",\n ")} + ]` + ) + }) +} diff --git a/node_modules/postcss-import/package.json b/node_modules/postcss-import/package.json new file mode 100644 index 00000000..a81ea5f0 --- /dev/null +++ b/node_modules/postcss-import/package.json @@ -0,0 +1,65 @@ +{ + "name": "postcss-import", + "version": "15.1.0", + "description": "PostCSS plugin to import CSS files", + "keywords": [ + "css", + "postcss", + "postcss-plugin", + "import", + "node modules", + "npm" + ], + "author": "Maxime Thirouin", + "license": "MIT", + "repository": "https://github.com/postcss/postcss-import.git", + "files": [ + "index.js", + "lib" + ], + "engines": { + "node": ">=14.0.0" + }, + "dependencies": { + "postcss-value-parser": "^4.0.0", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + }, + "devDependencies": { + "ava": "^5.0.0", + "eslint": "^8.2.0", + "eslint-config-problems": "^7.0.0", + "eslint-plugin-prettier": "^4.0.0", + "postcss": "^8.0.0", + "postcss-scss": "^4.0.0", + "prettier": "~2.8.0", + "sugarss": "^4.0.0" + }, + "peerDependencies": { + "postcss": "^8.0.0" + }, + "scripts": { + "ci": "eslint . && ava", + "lint": "eslint . --fix", + "pretest": "npm run lint", + "test": "ava" + }, + "eslintConfig": { + "extends": "eslint-config-problems", + "env": { + "node": true + }, + "plugins": [ + "prettier" + ], + "rules": { + "prettier/prettier": [ + "error", + { + "semi": false, + "arrowParens": "avoid" + } + ] + } + } +} diff --git a/node_modules/postcss-js/LICENSE b/node_modules/postcss-js/LICENSE new file mode 100644 index 00000000..d3bd6721 --- /dev/null +++ b/node_modules/postcss-js/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2015 Andrey Sitnik + +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/postcss-js/README.md b/node_modules/postcss-js/README.md new file mode 100644 index 00000000..a29e3b05 --- /dev/null +++ b/node_modules/postcss-js/README.md @@ -0,0 +1,22 @@ +# PostCSS JS + + + +[PostCSS] for CSS-in-JS and styles in JS objects. + +For example, to use [Stylelint] or [RTLCSS] plugins in your workflow. + + + Sponsored by Evil Martians + + +[Stylelint]: https://github.com/stylelint/stylelint +[PostCSS]: https://github.com/postcss/postcss +[RTLCSS]: https://github.com/MohammadYounes/rtlcss + + +## Docs +Read full docs **[here](https://github.com/postcss/postcss-js#readme)**. diff --git a/node_modules/postcss-js/async.js b/node_modules/postcss-js/async.js new file mode 100644 index 00000000..4c2f3c6c --- /dev/null +++ b/node_modules/postcss-js/async.js @@ -0,0 +1,15 @@ +let postcss = require('postcss') + +let processResult = require('./process-result') +let parse = require('./parser') + +module.exports = function async(plugins) { + let processor = postcss(plugins) + return async input => { + let result = await processor.process(input, { + parser: parse, + from: undefined + }) + return processResult(result) + } +} diff --git a/node_modules/postcss-js/index.js b/node_modules/postcss-js/index.js new file mode 100644 index 00000000..8a4274ed --- /dev/null +++ b/node_modules/postcss-js/index.js @@ -0,0 +1,11 @@ +let objectify = require('./objectifier') +let parse = require('./parser') +let async = require('./async') +let sync = require('./sync') + +module.exports = { + objectify, + parse, + async, + sync +} diff --git a/node_modules/postcss-js/index.mjs b/node_modules/postcss-js/index.mjs new file mode 100644 index 00000000..d14b61cc --- /dev/null +++ b/node_modules/postcss-js/index.mjs @@ -0,0 +1,8 @@ +import index from './index.js' + +export default index + +export const objectify = index.objectify +export const parse = index.parse +export const async = index.async +export const sync = index.sync diff --git a/node_modules/postcss-js/objectifier.js b/node_modules/postcss-js/objectifier.js new file mode 100644 index 00000000..a4708b82 --- /dev/null +++ b/node_modules/postcss-js/objectifier.js @@ -0,0 +1,85 @@ +let camelcase = require('camelcase-css') + +let UNITLESS = { + boxFlex: true, + boxFlexGroup: true, + columnCount: true, + flex: true, + flexGrow: true, + flexPositive: true, + flexShrink: true, + flexNegative: true, + fontWeight: true, + lineClamp: true, + lineHeight: true, + opacity: true, + order: true, + orphans: true, + tabSize: true, + widows: true, + zIndex: true, + zoom: true, + fillOpacity: true, + strokeDashoffset: true, + strokeOpacity: true, + strokeWidth: true +} + +function atRule(node) { + if (typeof node.nodes === 'undefined') { + return true + } else { + return process(node) + } +} + +function process(node) { + let name + let result = {} + + node.each(child => { + if (child.type === 'atrule') { + name = '@' + child.name + if (child.params) name += ' ' + child.params + if (typeof result[name] === 'undefined') { + result[name] = atRule(child) + } else if (Array.isArray(result[name])) { + result[name].push(atRule(child)) + } else { + result[name] = [result[name], atRule(child)] + } + } else if (child.type === 'rule') { + let body = process(child) + if (result[child.selector]) { + for (let i in body) { + result[child.selector][i] = body[i] + } + } else { + result[child.selector] = body + } + } else if (child.type === 'decl') { + if (child.prop[0] === '-' && child.prop[1] === '-') { + name = child.prop + } else if (child.parent && child.parent.selector === ':export') { + name = child.prop + } else { + name = camelcase(child.prop) + } + let value = child.value + if (!isNaN(child.value) && UNITLESS[name]) { + value = parseFloat(child.value) + } + if (child.important) value += ' !important' + if (typeof result[name] === 'undefined') { + result[name] = value + } else if (Array.isArray(result[name])) { + result[name].push(value) + } else { + result[name] = [result[name], value] + } + } + }) + return result +} + +module.exports = process diff --git a/node_modules/postcss-js/package.json b/node_modules/postcss-js/package.json new file mode 100644 index 00000000..ce0ff356 --- /dev/null +++ b/node_modules/postcss-js/package.json @@ -0,0 +1,42 @@ +{ + "name": "postcss-js", + "version": "4.0.1", + "description": "PostCSS for CSS-in-JS and styles in JS objects", + "keywords": [ + "postcss", + "postcss-runner", + "js", + "inline", + "react", + "css", + "cssinjs" + ], + "author": "Andrey Sitnik ", + "license": "MIT", + "repository": "postcss/postcss-js", + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "exports": { + ".": { + "require": "./index.js", + "import": "./index.mjs" + }, + "./package.json": "./package.json", + "./async": "./async.js", + "./objectifier": "./objectifier.js", + "./parser": "./parser.js", + "./process-result": "./process-result.js", + "./sync": "./sync.js" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.4.21" + }, + "dependencies": { + "camelcase-css": "^2.0.1" + } +} diff --git a/node_modules/postcss-js/parser.js b/node_modules/postcss-js/parser.js new file mode 100644 index 00000000..17ae264b --- /dev/null +++ b/node_modules/postcss-js/parser.js @@ -0,0 +1,104 @@ +let postcss = require('postcss') + +let IMPORTANT = /\s*!important\s*$/i + +let UNITLESS = { + 'box-flex': true, + 'box-flex-group': true, + 'column-count': true, + 'flex': true, + 'flex-grow': true, + 'flex-positive': true, + 'flex-shrink': true, + 'flex-negative': true, + 'font-weight': true, + 'line-clamp': true, + 'line-height': true, + 'opacity': true, + 'order': true, + 'orphans': true, + 'tab-size': true, + 'widows': true, + 'z-index': true, + 'zoom': true, + 'fill-opacity': true, + 'stroke-dashoffset': true, + 'stroke-opacity': true, + 'stroke-width': true +} + +function dashify(str) { + return str + .replace(/([A-Z])/g, '-$1') + .replace(/^ms-/, '-ms-') + .toLowerCase() +} + +function decl(parent, name, value) { + if (value === false || value === null) return + + if (!name.startsWith('--')) { + name = dashify(name) + } + + if (typeof value === 'number') { + if (value === 0 || UNITLESS[name]) { + value = value.toString() + } else { + value += 'px' + } + } + + if (name === 'css-float') name = 'float' + + if (IMPORTANT.test(value)) { + value = value.replace(IMPORTANT, '') + parent.push(postcss.decl({ prop: name, value, important: true })) + } else { + parent.push(postcss.decl({ prop: name, value })) + } +} + +function atRule(parent, parts, value) { + let node = postcss.atRule({ name: parts[1], params: parts[3] || '' }) + if (typeof value === 'object') { + node.nodes = [] + parse(value, node) + } + parent.push(node) +} + +function parse(obj, parent) { + let name, value, node + for (name in obj) { + value = obj[name] + if (value === null || typeof value === 'undefined') { + continue + } else if (name[0] === '@') { + let parts = name.match(/@(\S+)(\s+([\W\w]*)\s*)?/) + if (Array.isArray(value)) { + for (let i of value) { + atRule(parent, parts, i) + } + } else { + atRule(parent, parts, value) + } + } else if (Array.isArray(value)) { + for (let i of value) { + decl(parent, name, i) + } + } else if (typeof value === 'object') { + node = postcss.rule({ selector: name }) + parse(value, node) + parent.push(node) + } else { + decl(parent, name, value) + } + } +} + +module.exports = function (obj) { + let root = postcss.root() + parse(obj, root) + return root +} diff --git a/node_modules/postcss-js/process-result.js b/node_modules/postcss-js/process-result.js new file mode 100644 index 00000000..215a95cc --- /dev/null +++ b/node_modules/postcss-js/process-result.js @@ -0,0 +1,11 @@ +let objectify = require('./objectifier') + +module.exports = function processResult(result) { + if (console && console.warn) { + result.warnings().forEach(warn => { + let source = warn.plugin || 'PostCSS' + console.warn(source + ': ' + warn.text) + }) + } + return objectify(result.root) +} diff --git a/node_modules/postcss-js/sync.js b/node_modules/postcss-js/sync.js new file mode 100644 index 00000000..745bd278 --- /dev/null +++ b/node_modules/postcss-js/sync.js @@ -0,0 +1,12 @@ +let postcss = require('postcss') + +let processResult = require('./process-result') +let parse = require('./parser') + +module.exports = function (plugins) { + let processor = postcss(plugins) + return input => { + let result = processor.process(input, { parser: parse, from: undefined }) + return processResult(result) + } +} diff --git a/node_modules/postcss-value-parser/LICENSE b/node_modules/postcss-value-parser/LICENSE new file mode 100644 index 00000000..6dcaefcb --- /dev/null +++ b/node_modules/postcss-value-parser/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) Bogdan Chadkin + +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/postcss-value-parser/README.md b/node_modules/postcss-value-parser/README.md new file mode 100644 index 00000000..3bd6a0d6 --- /dev/null +++ b/node_modules/postcss-value-parser/README.md @@ -0,0 +1,263 @@ +# postcss-value-parser + +[![Travis CI](https://travis-ci.org/TrySound/postcss-value-parser.svg)](https://travis-ci.org/TrySound/postcss-value-parser) + +Transforms CSS declaration values and at-rule parameters into a tree of nodes, and provides a simple traversal API. + +## Usage + +```js +var valueParser = require('postcss-value-parser'); +var cssBackgroundValue = 'url(foo.png) no-repeat 40px 73%'; +var parsedValue = valueParser(cssBackgroundValue); +// parsedValue exposes an API described below, +// e.g. parsedValue.walk(..), parsedValue.toString(), etc. +``` + +For example, parsing the value `rgba(233, 45, 66, .5)` will return the following: + +```js +{ + nodes: [ + { + type: 'function', + value: 'rgba', + before: '', + after: '', + nodes: [ + { type: 'word', value: '233' }, + { type: 'div', value: ',', before: '', after: ' ' }, + { type: 'word', value: '45' }, + { type: 'div', value: ',', before: '', after: ' ' }, + { type: 'word', value: '66' }, + { type: 'div', value: ',', before: ' ', after: '' }, + { type: 'word', value: '.5' } + ] + } + ] +} +``` + +If you wanted to convert each `rgba()` value in `sourceCSS` to a hex value, you could do so like this: + +```js +var valueParser = require('postcss-value-parser'); + +var parsed = valueParser(sourceCSS); + +// walk() will visit all the of the nodes in the tree, +// invoking the callback for each. +parsed.walk(function (node) { + + // Since we only want to transform rgba() values, + // we can ignore anything else. + if (node.type !== 'function' && node.value !== 'rgba') return; + + // We can make an array of the rgba() arguments to feed to a + // convertToHex() function + var color = node.nodes.filter(function (node) { + return node.type === 'word'; + }).map(function (node) { + return Number(node.value); + }); // [233, 45, 66, .5] + + // Now we will transform the existing rgba() function node + // into a word node with the hex value + node.type = 'word'; + node.value = convertToHex(color); +}) + +parsed.toString(); // #E92D42 +``` + +## Nodes + +Each node is an object with these common properties: + +- **type**: The type of node (`word`, `string`, `div`, `space`, `comment`, or `function`). + Each type is documented below. +- **value**: Each node has a `value` property; but what exactly `value` means + is specific to the node type. Details are documented for each type below. +- **sourceIndex**: The starting index of the node within the original source + string. For example, given the source string `10px 20px`, the `word` node + whose value is `20px` will have a `sourceIndex` of `5`. + +### word + +The catch-all node type that includes keywords (e.g. `no-repeat`), +quantities (e.g. `20px`, `75%`, `1.5`), and hex colors (e.g. `#e6e6e6`). + +Node-specific properties: + +- **value**: The "word" itself. + +### string + +A quoted string value, e.g. `"something"` in `content: "something";`. + +Node-specific properties: + +- **value**: The text content of the string. +- **quote**: The quotation mark surrounding the string, either `"` or `'`. +- **unclosed**: `true` if the string was not closed properly. e.g. `"unclosed string `. + +### div + +A divider, for example + +- `,` in `animation-duration: 1s, 2s, 3s` +- `/` in `border-radius: 10px / 23px` +- `:` in `(min-width: 700px)` + +Node-specific properties: + +- **value**: The divider character. Either `,`, `/`, or `:` (see examples above). +- **before**: Whitespace before the divider. +- **after**: Whitespace after the divider. + +### space + +Whitespace used as a separator, e.g. ` ` occurring twice in `border: 1px solid black;`. + +Node-specific properties: + +- **value**: The whitespace itself. + +### comment + +A CSS comment starts with `/*` and ends with `*/` + +Node-specific properties: + +- **value**: The comment value without `/*` and `*/` +- **unclosed**: `true` if the comment was not closed properly. e.g. `/* comment without an end `. + +### function + +A CSS function, e.g. `rgb(0,0,0)` or `url(foo.bar)`. + +Function nodes have nodes nested within them: the function arguments. + +Additional properties: + +- **value**: The name of the function, e.g. `rgb` in `rgb(0,0,0)`. +- **before**: Whitespace after the opening parenthesis and before the first argument, + e.g. ` ` in `rgb( 0,0,0)`. +- **after**: Whitespace before the closing parenthesis and after the last argument, + e.g. ` ` in `rgb(0,0,0 )`. +- **nodes**: More nodes representing the arguments to the function. +- **unclosed**: `true` if the parentheses was not closed properly. e.g. `( unclosed-function `. + +Media features surrounded by parentheses are considered functions with an +empty value. For example, `(min-width: 700px)` parses to these nodes: + +```js +[ + { + type: 'function', value: '', before: '', after: '', + nodes: [ + { type: 'word', value: 'min-width' }, + { type: 'div', value: ':', before: '', after: ' ' }, + { type: 'word', value: '700px' } + ] + } +] +``` + +`url()` functions can be parsed a little bit differently depending on +whether the first character in the argument is a quotation mark. + +`url( /gfx/img/bg.jpg )` parses to: + +```js +{ type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [ + { type: 'word', sourceIndex: 5, value: '/gfx/img/bg.jpg' } +] } +``` + +`url( "/gfx/img/bg.jpg" )`, on the other hand, parses to: + +```js +{ type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [ + type: 'string', sourceIndex: 5, quote: '"', value: '/gfx/img/bg.jpg' }, +] } +``` + +### unicode-range + +The unicode-range CSS descriptor sets the specific range of characters to be +used from a font defined by @font-face and made available +for use on the current page (`unicode-range: U+0025-00FF`). + +Node-specific properties: + +- **value**: The "unicode-range" itself. + +## API + +``` +var valueParser = require('postcss-value-parser'); +``` + +### valueParser.unit(quantity) + +Parses `quantity`, distinguishing the number from the unit. Returns an object like the following: + +```js +// Given 2rem +{ + number: '2', + unit: 'rem' +} +``` + +If the `quantity` argument cannot be parsed as a number, returns `false`. + +*This function does not parse complete values*: you cannot pass it `1px solid black` and expect `px` as +the unit. Instead, you should pass it single quantities only. Parse `1px solid black`, then pass it +the stringified `1px` node (a `word` node) to parse the number and unit. + +### valueParser.stringify(nodes[, custom]) + +Stringifies a node or array of nodes. + +The `custom` function is called for each `node`; return a string to override the default behaviour. + +### valueParser.walk(nodes, callback[, bubble]) + +Walks each provided node, recursively walking all descendent nodes within functions. + +Returning `false` in the `callback` will prevent traversal of descendent nodes (within functions). +You can use this feature to for shallow iteration, walking over only the *immediate* children. +*Note: This only applies if `bubble` is `false` (which is the default).* + +By default, the tree is walked from the outermost node inwards. +To reverse the direction, pass `true` for the `bubble` argument. + +The `callback` is invoked with three arguments: `callback(node, index, nodes)`. + +- `node`: The current node. +- `index`: The index of the current node. +- `nodes`: The complete nodes array passed to `walk()`. + +Returns the `valueParser` instance. + +### var parsed = valueParser(value) + +Returns the parsed node tree. + +### parsed.nodes + +The array of nodes. + +### parsed.toString() + +Stringifies the node tree. + +### parsed.walk(callback[, bubble]) + +Walks each node inside `parsed.nodes`. See the documentation for `valueParser.walk()` above. + +# License + +MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru) diff --git a/node_modules/postcss-value-parser/lib/index.d.ts b/node_modules/postcss-value-parser/lib/index.d.ts new file mode 100644 index 00000000..8759f3fe --- /dev/null +++ b/node_modules/postcss-value-parser/lib/index.d.ts @@ -0,0 +1,177 @@ +declare namespace postcssValueParser { + interface BaseNode { + /** + * The offset, inclusive, inside the CSS value at which the node starts. + */ + sourceIndex: number; + + /** + * The offset, exclusive, inside the CSS value at which the node ends. + */ + sourceEndIndex: number; + + /** + * The node's characteristic value + */ + value: string; + } + + interface ClosableNode { + /** + * Whether the parsed CSS value ended before the node was properly closed + */ + unclosed?: true; + } + + interface AdjacentAwareNode { + /** + * The token at the start of the node + */ + before: string; + + /** + * The token at the end of the node + */ + after: string; + } + + interface CommentNode extends BaseNode, ClosableNode { + type: "comment"; + } + + interface DivNode extends BaseNode, AdjacentAwareNode { + type: "div"; + } + + interface FunctionNode extends BaseNode, ClosableNode, AdjacentAwareNode { + type: "function"; + + /** + * Nodes inside the function + */ + nodes: Node[]; + } + + interface SpaceNode extends BaseNode { + type: "space"; + } + + interface StringNode extends BaseNode, ClosableNode { + type: "string"; + + /** + * The quote type delimiting the string + */ + quote: '"' | "'"; + } + + interface UnicodeRangeNode extends BaseNode { + type: "unicode-range"; + } + + interface WordNode extends BaseNode { + type: "word"; + } + + /** + * Any node parsed from a CSS value + */ + type Node = + | CommentNode + | DivNode + | FunctionNode + | SpaceNode + | StringNode + | UnicodeRangeNode + | WordNode; + + interface CustomStringifierCallback { + /** + * @param node The node to stringify + * @returns The serialized CSS representation of the node + */ + (nodes: Node): string | undefined; + } + + interface WalkCallback { + /** + * @param node The currently visited node + * @param index The index of the node in the series of parsed nodes + * @param nodes The series of parsed nodes + * @returns Returning `false` will prevent traversal of descendant nodes (only applies if `bubble` was set to `true` in the `walk()` call) + */ + (node: Node, index: number, nodes: Node[]): void | boolean; + } + + /** + * A CSS dimension, decomposed into its numeric and unit parts + */ + interface Dimension { + number: string; + unit: string; + } + + /** + * A wrapper around a parsed CSS value that allows for inspecting and walking nodes + */ + interface ParsedValue { + /** + * The series of parsed nodes + */ + nodes: Node[]; + + /** + * Walk all parsed nodes, applying a callback + * + * @param callback A visitor callback that will be executed for each node + * @param bubble When set to `true`, walking will be done inside-out instead of outside-in + */ + walk(callback: WalkCallback, bubble?: boolean): this; + } + + interface ValueParser { + /** + * Decompose a CSS dimension into its numeric and unit part + * + * @param value The dimension to decompose + * @returns An object representing `number` and `unit` part of the dimension or `false` if the decomposing fails + */ + unit(value: string): Dimension | false; + + /** + * Serialize a series of nodes into a CSS value + * + * @param nodes The nodes to stringify + * @param custom A custom stringifier callback + * @returns The generated CSS value + */ + stringify(nodes: Node | Node[], custom?: CustomStringifierCallback): string; + + /** + * Walk a series of nodes, applying a callback + * + * @param nodes The nodes to walk + * @param callback A visitor callback that will be executed for each node + * @param bubble When set to `true`, walking will be done inside-out instead of outside-in + */ + walk(nodes: Node[], callback: WalkCallback, bubble?: boolean): void; + + /** + * Parse a CSS value into a series of nodes to operate on + * + * @param value The value to parse + */ + new (value: string): ParsedValue; + + /** + * Parse a CSS value into a series of nodes to operate on + * + * @param value The value to parse + */ + (value: string): ParsedValue; + } +} + +declare const postcssValueParser: postcssValueParser.ValueParser; + +export = postcssValueParser; diff --git a/node_modules/postcss-value-parser/lib/index.js b/node_modules/postcss-value-parser/lib/index.js new file mode 100644 index 00000000..f9ac0e68 --- /dev/null +++ b/node_modules/postcss-value-parser/lib/index.js @@ -0,0 +1,28 @@ +var parse = require("./parse"); +var walk = require("./walk"); +var stringify = require("./stringify"); + +function ValueParser(value) { + if (this instanceof ValueParser) { + this.nodes = parse(value); + return this; + } + return new ValueParser(value); +} + +ValueParser.prototype.toString = function() { + return Array.isArray(this.nodes) ? stringify(this.nodes) : ""; +}; + +ValueParser.prototype.walk = function(cb, bubble) { + walk(this.nodes, cb, bubble); + return this; +}; + +ValueParser.unit = require("./unit"); + +ValueParser.walk = walk; + +ValueParser.stringify = stringify; + +module.exports = ValueParser; diff --git a/node_modules/postcss-value-parser/lib/parse.js b/node_modules/postcss-value-parser/lib/parse.js new file mode 100644 index 00000000..950631c9 --- /dev/null +++ b/node_modules/postcss-value-parser/lib/parse.js @@ -0,0 +1,321 @@ +var openParentheses = "(".charCodeAt(0); +var closeParentheses = ")".charCodeAt(0); +var singleQuote = "'".charCodeAt(0); +var doubleQuote = '"'.charCodeAt(0); +var backslash = "\\".charCodeAt(0); +var slash = "/".charCodeAt(0); +var comma = ",".charCodeAt(0); +var colon = ":".charCodeAt(0); +var star = "*".charCodeAt(0); +var uLower = "u".charCodeAt(0); +var uUpper = "U".charCodeAt(0); +var plus = "+".charCodeAt(0); +var isUnicodeRange = /^[a-f0-9?-]+$/i; + +module.exports = function(input) { + var tokens = []; + var value = input; + + var next, + quote, + prev, + token, + escape, + escapePos, + whitespacePos, + parenthesesOpenPos; + var pos = 0; + var code = value.charCodeAt(pos); + var max = value.length; + var stack = [{ nodes: tokens }]; + var balanced = 0; + var parent; + + var name = ""; + var before = ""; + var after = ""; + + while (pos < max) { + // Whitespaces + if (code <= 32) { + next = pos; + do { + next += 1; + code = value.charCodeAt(next); + } while (code <= 32); + token = value.slice(pos, next); + + prev = tokens[tokens.length - 1]; + if (code === closeParentheses && balanced) { + after = token; + } else if (prev && prev.type === "div") { + prev.after = token; + prev.sourceEndIndex += token.length; + } else if ( + code === comma || + code === colon || + (code === slash && + value.charCodeAt(next + 1) !== star && + (!parent || + (parent && parent.type === "function" && parent.value !== "calc"))) + ) { + before = token; + } else { + tokens.push({ + type: "space", + sourceIndex: pos, + sourceEndIndex: next, + value: token + }); + } + + pos = next; + + // Quotes + } else if (code === singleQuote || code === doubleQuote) { + next = pos; + quote = code === singleQuote ? "'" : '"'; + token = { + type: "string", + sourceIndex: pos, + quote: quote + }; + do { + escape = false; + next = value.indexOf(quote, next + 1); + if (~next) { + escapePos = next; + while (value.charCodeAt(escapePos - 1) === backslash) { + escapePos -= 1; + escape = !escape; + } + } else { + value += quote; + next = value.length - 1; + token.unclosed = true; + } + } while (escape); + token.value = value.slice(pos + 1, next); + token.sourceEndIndex = token.unclosed ? next : next + 1; + tokens.push(token); + pos = next + 1; + code = value.charCodeAt(pos); + + // Comments + } else if (code === slash && value.charCodeAt(pos + 1) === star) { + next = value.indexOf("*/", pos); + + token = { + type: "comment", + sourceIndex: pos, + sourceEndIndex: next + 2 + }; + + if (next === -1) { + token.unclosed = true; + next = value.length; + token.sourceEndIndex = next; + } + + token.value = value.slice(pos + 2, next); + tokens.push(token); + + pos = next + 2; + code = value.charCodeAt(pos); + + // Operation within calc + } else if ( + (code === slash || code === star) && + parent && + parent.type === "function" && + parent.value === "calc" + ) { + token = value[pos]; + tokens.push({ + type: "word", + sourceIndex: pos - before.length, + sourceEndIndex: pos + token.length, + value: token + }); + pos += 1; + code = value.charCodeAt(pos); + + // Dividers + } else if (code === slash || code === comma || code === colon) { + token = value[pos]; + + tokens.push({ + type: "div", + sourceIndex: pos - before.length, + sourceEndIndex: pos + token.length, + value: token, + before: before, + after: "" + }); + before = ""; + + pos += 1; + code = value.charCodeAt(pos); + + // Open parentheses + } else if (openParentheses === code) { + // Whitespaces after open parentheses + next = pos; + do { + next += 1; + code = value.charCodeAt(next); + } while (code <= 32); + parenthesesOpenPos = pos; + token = { + type: "function", + sourceIndex: pos - name.length, + value: name, + before: value.slice(parenthesesOpenPos + 1, next) + }; + pos = next; + + if (name === "url" && code !== singleQuote && code !== doubleQuote) { + next -= 1; + do { + escape = false; + next = value.indexOf(")", next + 1); + if (~next) { + escapePos = next; + while (value.charCodeAt(escapePos - 1) === backslash) { + escapePos -= 1; + escape = !escape; + } + } else { + value += ")"; + next = value.length - 1; + token.unclosed = true; + } + } while (escape); + // Whitespaces before closed + whitespacePos = next; + do { + whitespacePos -= 1; + code = value.charCodeAt(whitespacePos); + } while (code <= 32); + if (parenthesesOpenPos < whitespacePos) { + if (pos !== whitespacePos + 1) { + token.nodes = [ + { + type: "word", + sourceIndex: pos, + sourceEndIndex: whitespacePos + 1, + value: value.slice(pos, whitespacePos + 1) + } + ]; + } else { + token.nodes = []; + } + if (token.unclosed && whitespacePos + 1 !== next) { + token.after = ""; + token.nodes.push({ + type: "space", + sourceIndex: whitespacePos + 1, + sourceEndIndex: next, + value: value.slice(whitespacePos + 1, next) + }); + } else { + token.after = value.slice(whitespacePos + 1, next); + token.sourceEndIndex = next; + } + } else { + token.after = ""; + token.nodes = []; + } + pos = next + 1; + token.sourceEndIndex = token.unclosed ? next : pos; + code = value.charCodeAt(pos); + tokens.push(token); + } else { + balanced += 1; + token.after = ""; + token.sourceEndIndex = pos + 1; + tokens.push(token); + stack.push(token); + tokens = token.nodes = []; + parent = token; + } + name = ""; + + // Close parentheses + } else if (closeParentheses === code && balanced) { + pos += 1; + code = value.charCodeAt(pos); + + parent.after = after; + parent.sourceEndIndex += after.length; + after = ""; + balanced -= 1; + stack[stack.length - 1].sourceEndIndex = pos; + stack.pop(); + parent = stack[balanced]; + tokens = parent.nodes; + + // Words + } else { + next = pos; + do { + if (code === backslash) { + next += 1; + } + next += 1; + code = value.charCodeAt(next); + } while ( + next < max && + !( + code <= 32 || + code === singleQuote || + code === doubleQuote || + code === comma || + code === colon || + code === slash || + code === openParentheses || + (code === star && + parent && + parent.type === "function" && + parent.value === "calc") || + (code === slash && + parent.type === "function" && + parent.value === "calc") || + (code === closeParentheses && balanced) + ) + ); + token = value.slice(pos, next); + + if (openParentheses === code) { + name = token; + } else if ( + (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) && + plus === token.charCodeAt(1) && + isUnicodeRange.test(token.slice(2)) + ) { + tokens.push({ + type: "unicode-range", + sourceIndex: pos, + sourceEndIndex: next, + value: token + }); + } else { + tokens.push({ + type: "word", + sourceIndex: pos, + sourceEndIndex: next, + value: token + }); + } + + pos = next; + } + } + + for (pos = stack.length - 1; pos; pos -= 1) { + stack[pos].unclosed = true; + stack[pos].sourceEndIndex = value.length; + } + + return stack[0].nodes; +}; diff --git a/node_modules/postcss-value-parser/lib/stringify.js b/node_modules/postcss-value-parser/lib/stringify.js new file mode 100644 index 00000000..60796711 --- /dev/null +++ b/node_modules/postcss-value-parser/lib/stringify.js @@ -0,0 +1,48 @@ +function stringifyNode(node, custom) { + var type = node.type; + var value = node.value; + var buf; + var customResult; + + if (custom && (customResult = custom(node)) !== undefined) { + return customResult; + } else if (type === "word" || type === "space") { + return value; + } else if (type === "string") { + buf = node.quote || ""; + return buf + value + (node.unclosed ? "" : buf); + } else if (type === "comment") { + return "/*" + value + (node.unclosed ? "" : "*/"); + } else if (type === "div") { + return (node.before || "") + value + (node.after || ""); + } else if (Array.isArray(node.nodes)) { + buf = stringify(node.nodes, custom); + if (type !== "function") { + return buf; + } + return ( + value + + "(" + + (node.before || "") + + buf + + (node.after || "") + + (node.unclosed ? "" : ")") + ); + } + return value; +} + +function stringify(nodes, custom) { + var result, i; + + if (Array.isArray(nodes)) { + result = ""; + for (i = nodes.length - 1; ~i; i -= 1) { + result = stringifyNode(nodes[i], custom) + result; + } + return result; + } + return stringifyNode(nodes, custom); +} + +module.exports = stringify; diff --git a/node_modules/postcss-value-parser/lib/unit.js b/node_modules/postcss-value-parser/lib/unit.js new file mode 100644 index 00000000..c349661a --- /dev/null +++ b/node_modules/postcss-value-parser/lib/unit.js @@ -0,0 +1,120 @@ +var minus = "-".charCodeAt(0); +var plus = "+".charCodeAt(0); +var dot = ".".charCodeAt(0); +var exp = "e".charCodeAt(0); +var EXP = "E".charCodeAt(0); + +// Check if three code points would start a number +// https://www.w3.org/TR/css-syntax-3/#starts-with-a-number +function likeNumber(value) { + var code = value.charCodeAt(0); + var nextCode; + + if (code === plus || code === minus) { + nextCode = value.charCodeAt(1); + + if (nextCode >= 48 && nextCode <= 57) { + return true; + } + + var nextNextCode = value.charCodeAt(2); + + if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) { + return true; + } + + return false; + } + + if (code === dot) { + nextCode = value.charCodeAt(1); + + if (nextCode >= 48 && nextCode <= 57) { + return true; + } + + return false; + } + + if (code >= 48 && code <= 57) { + return true; + } + + return false; +} + +// Consume a number +// https://www.w3.org/TR/css-syntax-3/#consume-number +module.exports = function(value) { + var pos = 0; + var length = value.length; + var code; + var nextCode; + var nextNextCode; + + if (length === 0 || !likeNumber(value)) { + return false; + } + + code = value.charCodeAt(pos); + + if (code === plus || code === minus) { + pos++; + } + + while (pos < length) { + code = value.charCodeAt(pos); + + if (code < 48 || code > 57) { + break; + } + + pos += 1; + } + + code = value.charCodeAt(pos); + nextCode = value.charCodeAt(pos + 1); + + if (code === dot && nextCode >= 48 && nextCode <= 57) { + pos += 2; + + while (pos < length) { + code = value.charCodeAt(pos); + + if (code < 48 || code > 57) { + break; + } + + pos += 1; + } + } + + code = value.charCodeAt(pos); + nextCode = value.charCodeAt(pos + 1); + nextNextCode = value.charCodeAt(pos + 2); + + if ( + (code === exp || code === EXP) && + ((nextCode >= 48 && nextCode <= 57) || + ((nextCode === plus || nextCode === minus) && + nextNextCode >= 48 && + nextNextCode <= 57)) + ) { + pos += nextCode === plus || nextCode === minus ? 3 : 2; + + while (pos < length) { + code = value.charCodeAt(pos); + + if (code < 48 || code > 57) { + break; + } + + pos += 1; + } + } + + return { + number: value.slice(0, pos), + unit: value.slice(pos) + }; +}; diff --git a/node_modules/postcss-value-parser/lib/walk.js b/node_modules/postcss-value-parser/lib/walk.js new file mode 100644 index 00000000..7666c5b1 --- /dev/null +++ b/node_modules/postcss-value-parser/lib/walk.js @@ -0,0 +1,22 @@ +module.exports = function walk(nodes, cb, bubble) { + var i, max, node, result; + + for (i = 0, max = nodes.length; i < max; i += 1) { + node = nodes[i]; + if (!bubble) { + result = cb(node, i, nodes); + } + + if ( + result !== false && + node.type === "function" && + Array.isArray(node.nodes) + ) { + walk(node.nodes, cb, bubble); + } + + if (bubble) { + cb(node, i, nodes); + } + } +}; diff --git a/node_modules/postcss-value-parser/package.json b/node_modules/postcss-value-parser/package.json new file mode 100644 index 00000000..02d744a6 --- /dev/null +++ b/node_modules/postcss-value-parser/package.json @@ -0,0 +1,58 @@ +{ + "name": "postcss-value-parser", + "version": "4.2.0", + "description": "Transforms css values and at-rule params into the tree", + "main": "lib/index.js", + "files": [ + "lib" + ], + "devDependencies": { + "eslint": "^5.16.0", + "husky": "^2.3.0", + "lint-staged": "^8.1.7", + "prettier": "^1.17.1", + "tap-spec": "^5.0.0", + "tape": "^4.10.2" + }, + "scripts": { + "lint:prettier": "prettier \"**/*.js\" \"**/*.ts\" --list-different", + "lint:js": "eslint . --cache", + "lint": "yarn lint:js && yarn lint:prettier", + "pretest": "yarn lint", + "test": "tape test/*.js | tap-spec" + }, + "eslintConfig": { + "env": { + "es6": true, + "node": true + }, + "extends": "eslint:recommended" + }, + "lint-staged": { + "*.js": [ + "eslint", + "prettier --write", + "git add" + ] + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "author": "Bogdan Chadkin ", + "license": "MIT", + "homepage": "https://github.com/TrySound/postcss-value-parser", + "repository": { + "type": "git", + "url": "https://github.com/TrySound/postcss-value-parser.git" + }, + "keywords": [ + "postcss", + "value", + "parser" + ], + "bugs": { + "url": "https://github.com/TrySound/postcss-value-parser/issues" + } +} diff --git a/node_modules/postcss/LICENSE b/node_modules/postcss/LICENSE new file mode 100644 index 00000000..da057b45 --- /dev/null +++ b/node_modules/postcss/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2013 Andrey Sitnik + +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/postcss/README.md b/node_modules/postcss/README.md new file mode 100644 index 00000000..939a8021 --- /dev/null +++ b/node_modules/postcss/README.md @@ -0,0 +1,28 @@ +# PostCSS + +Philosopher’s stone, logo of PostCSS + +PostCSS is a tool for transforming styles with JS plugins. +These plugins can lint your CSS, support variables and mixins, +transpile future CSS syntax, inline images, and more. + +PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba, +and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins is one of the most popular CSS tools. + +--- + +  Made at Evil Martians, product consulting for developer tools. + +--- + +[Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree +[Evil Martians]: https://evilmartians.com/?utm_source=postcss +[Autoprefixer]: https://github.com/postcss/autoprefixer +[Stylelint]: https://stylelint.io/ +[plugins]: https://github.com/postcss/postcss#plugins + + +## Docs +Read full docs **[here](https://postcss.org/)**. diff --git a/node_modules/postcss/lib/at-rule.d.ts b/node_modules/postcss/lib/at-rule.d.ts new file mode 100644 index 00000000..b2a0e0f4 --- /dev/null +++ b/node_modules/postcss/lib/at-rule.d.ts @@ -0,0 +1,140 @@ +import Container, { + ContainerProps, + ContainerWithChildren +} from './container.js' + +declare namespace AtRule { + export interface AtRuleRaws extends Record { + /** + * The space symbols after the last child of the node to the end of the node. + */ + after?: string + + /** + * The space between the at-rule name and its parameters. + */ + afterName?: string + + /** + * The space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + */ + before?: string + + /** + * The symbols between the last parameter and `{` for rules. + */ + between?: string + + /** + * The rule’s selector with comments. + */ + params?: { + raw: string + value: string + } + + /** + * Contains `true` if the last child has an (optional) semicolon. + */ + semicolon?: boolean + } + + export interface AtRuleProps extends ContainerProps { + /** Name of the at-rule. */ + name: string + /** Parameters following the name of the at-rule. */ + params?: number | string + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: AtRuleRaws + } + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { AtRule_ as default } +} + +/** + * Represents an at-rule. + * + * ```js + * Once (root, { AtRule }) { + * let media = new AtRule({ name: 'media', params: 'print' }) + * media.append(…) + * root.append(media) + * } + * ``` + * + * If it’s followed in the CSS by a `{}` block, this node will have + * a nodes property representing its children. + * + * ```js + * const root = postcss.parse('@charset "UTF-8"; @media print {}') + * + * const charset = root.first + * charset.type //=> 'atrule' + * charset.nodes //=> undefined + * + * const media = root.last + * media.nodes //=> [] + * ``` + */ +declare class AtRule_ extends Container { + /** + * An array containing the layer’s children. + * + * ```js + * const root = postcss.parse('@layer example { a { color: black } }') + * const layer = root.first + * layer.nodes.length //=> 1 + * layer.nodes[0].selector //=> 'a' + * ``` + * + * Can be `undefinded` if the at-rule has no body. + * + * ```js + * const root = postcss.parse('@layer a, b, c;') + * const layer = root.first + * layer.nodes //=> undefined + * ``` + */ + nodes: Container['nodes'] + parent: ContainerWithChildren | undefined + + raws: AtRule.AtRuleRaws + type: 'atrule' + constructor(defaults?: AtRule.AtRuleProps) + assign(overrides: AtRule.AtRuleProps | object): this + + clone(overrides?: Partial): this + + cloneAfter(overrides?: Partial): this + + cloneBefore(overrides?: Partial): this + /** + * The at-rule’s name immediately follows the `@`. + * + * ```js + * const root = postcss.parse('@media print {}') + * const media = root.first + * media.name //=> 'media' + * ``` + */ + get name(): string + set name(value: string) + /** + * The at-rule’s parameters, the values that follow the at-rule’s name + * but precede any `{}` block. + * + * ```js + * const root = postcss.parse('@media print, screen {}') + * const media = root.first + * media.params //=> 'print, screen' + * ``` + */ + get params(): string + set params(value: string) +} + +declare class AtRule extends AtRule_ {} + +export = AtRule diff --git a/node_modules/postcss/lib/at-rule.js b/node_modules/postcss/lib/at-rule.js new file mode 100644 index 00000000..9486447b --- /dev/null +++ b/node_modules/postcss/lib/at-rule.js @@ -0,0 +1,25 @@ +'use strict' + +let Container = require('./container') + +class AtRule extends Container { + constructor(defaults) { + super(defaults) + this.type = 'atrule' + } + + append(...children) { + if (!this.proxyOf.nodes) this.nodes = [] + return super.append(...children) + } + + prepend(...children) { + if (!this.proxyOf.nodes) this.nodes = [] + return super.prepend(...children) + } +} + +module.exports = AtRule +AtRule.default = AtRule + +Container.registerAtRule(AtRule) diff --git a/node_modules/postcss/lib/comment.d.ts b/node_modules/postcss/lib/comment.d.ts new file mode 100644 index 00000000..2b1a156d --- /dev/null +++ b/node_modules/postcss/lib/comment.d.ts @@ -0,0 +1,68 @@ +import Container from './container.js' +import Node, { NodeProps } from './node.js' + +declare namespace Comment { + export interface CommentRaws extends Record { + /** + * The space symbols before the node. + */ + before?: string + + /** + * The space symbols between `/*` and the comment’s text. + */ + left?: string + + /** + * The space symbols between the comment’s text. + */ + right?: string + } + + export interface CommentProps extends NodeProps { + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: CommentRaws + /** Content of the comment. */ + text: string + } + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Comment_ as default } +} + +/** + * It represents a class that handles + * [CSS comments](https://developer.mozilla.org/en-US/docs/Web/CSS/Comments) + * + * ```js + * Once (root, { Comment }) { + * const note = new Comment({ text: 'Note: …' }) + * root.append(note) + * } + * ``` + * + * Remember that CSS comments inside selectors, at-rule parameters, + * or declaration values will be stored in the `raws` properties + * explained above. + */ +declare class Comment_ extends Node { + parent: Container | undefined + raws: Comment.CommentRaws + type: 'comment' + constructor(defaults?: Comment.CommentProps) + + assign(overrides: Comment.CommentProps | object): this + + clone(overrides?: Partial): this + cloneAfter(overrides?: Partial): this + cloneBefore(overrides?: Partial): this + /** + * The comment's text. + */ + get text(): string + set text(value: string) +} + +declare class Comment extends Comment_ {} + +export = Comment diff --git a/node_modules/postcss/lib/comment.js b/node_modules/postcss/lib/comment.js new file mode 100644 index 00000000..c5665064 --- /dev/null +++ b/node_modules/postcss/lib/comment.js @@ -0,0 +1,13 @@ +'use strict' + +let Node = require('./node') + +class Comment extends Node { + constructor(defaults) { + super(defaults) + this.type = 'comment' + } +} + +module.exports = Comment +Comment.default = Comment diff --git a/node_modules/postcss/lib/container.d.ts b/node_modules/postcss/lib/container.d.ts new file mode 100644 index 00000000..692bd696 --- /dev/null +++ b/node_modules/postcss/lib/container.d.ts @@ -0,0 +1,483 @@ +import AtRule from './at-rule.js' +import Comment from './comment.js' +import Declaration from './declaration.js' +import Node, { ChildNode, ChildProps, NodeProps } from './node.js' +import Rule from './rule.js' + +declare namespace Container { + export class ContainerWithChildren< + Child extends Node = ChildNode + > extends Container_ { + nodes: Child[] + } + + export interface ValueOptions { + /** + * String that’s used to narrow down values and speed up the regexp search. + */ + fast?: string + + /** + * An array of property names. + */ + props?: readonly string[] + } + + export interface ContainerProps extends NodeProps { + nodes?: readonly (ChildProps | Node)[] + } + + /** + * All types that can be passed into container methods to create or add a new + * child node. + */ + export type NewChild = + | ChildProps + | Node + | readonly ChildProps[] + | readonly Node[] + | readonly string[] + | string + | undefined + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Container_ as default } +} + +/** + * The `Root`, `AtRule`, and `Rule` container nodes + * inherit some common methods to help work with their children. + * + * Note that all containers can store any content. If you write a rule inside + * a rule, PostCSS will parse it. + */ +declare abstract class Container_ extends Node { + /** + * An array containing the container’s children. + * + * ```js + * const root = postcss.parse('a { color: black }') + * root.nodes.length //=> 1 + * root.nodes[0].selector //=> 'a' + * root.nodes[0].nodes[0].prop //=> 'color' + * ``` + */ + nodes: Child[] | undefined + + /** + * An internal method that converts a {@link NewChild} into a list of actual + * child nodes that can then be added to this container. + * + * This ensures that the nodes' parent is set to this container, that they use + * the correct prototype chain, and that they're marked as dirty. + * + * @param mnodes The new node or nodes to add. + * @param sample A node from whose raws the new node's `before` raw should be + * taken. + * @param type This should be set to `'prepend'` if the new nodes will be + * inserted at the beginning of the container. + * @hidden + */ + protected normalize( + nodes: Container.NewChild, + sample: Node | undefined, + type?: 'prepend' | false + ): Child[] + + /** + * Inserts new nodes to the end of the container. + * + * ```js + * const decl1 = new Declaration({ prop: 'color', value: 'black' }) + * const decl2 = new Declaration({ prop: 'background-color', value: 'white' }) + * rule.append(decl1, decl2) + * + * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule + * root.append({ selector: 'a' }) // rule + * rule.append({ prop: 'color', value: 'black' }) // declaration + * rule.append({ text: 'Comment' }) // comment + * + * root.append('a {}') + * root.first.append('color: black; z-index: 1') + * ``` + * + * @param nodes New nodes. + * @return This node for methods chain. + */ + append(...nodes: Container.NewChild[]): this + assign(overrides: Container.ContainerProps | object): this + clone(overrides?: Partial): this + cloneAfter(overrides?: Partial): this + + cloneBefore(overrides?: Partial): this + + /** + * Iterates through the container’s immediate children, + * calling `callback` for each child. + * + * Returning `false` in the callback will break iteration. + * + * This method only iterates through the container’s immediate children. + * If you need to recursively iterate through all the container’s descendant + * nodes, use `Container#walk`. + * + * Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe + * if you are mutating the array of child nodes during iteration. + * PostCSS will adjust the current index to match the mutations. + * + * ```js + * const root = postcss.parse('a { color: black; z-index: 1 }') + * const rule = root.first + * + * for (const decl of rule.nodes) { + * decl.cloneBefore({ prop: '-webkit-' + decl.prop }) + * // Cycle will be infinite, because cloneBefore moves the current node + * // to the next index + * } + * + * rule.each(decl => { + * decl.cloneBefore({ prop: '-webkit-' + decl.prop }) + * // Will be executed only for color and z-index + * }) + * ``` + * + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + each( + callback: (node: Child, index: number) => false | void + ): false | undefined + /** + * Returns `true` if callback returns `true` + * for all of the container’s children. + * + * ```js + * const noPrefixes = rule.every(i => i.prop[0] !== '-') + * ``` + * + * @param condition Iterator returns true or false. + * @return Is every child pass condition. + */ + every( + condition: (node: Child, index: number, nodes: Child[]) => boolean + ): boolean + + /** + * Returns a `child`’s index within the `Container#nodes` array. + * + * ```js + * rule.index( rule.nodes[2] ) //=> 2 + * ``` + * + * @param child Child of the current container. + * @return Child index. + */ + index(child: Child | number): number + /** + * Insert new node after old node within the container. + * + * @param oldNode Child or child’s index. + * @param newNode New node. + * @return This node for methods chain. + */ + insertAfter(oldNode: Child | number, newNode: Container.NewChild): this + + /** + * Insert new node before old node within the container. + * + * ```js + * rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop })) + * ``` + * + * @param oldNode Child or child’s index. + * @param newNode New node. + * @return This node for methods chain. + */ + insertBefore(oldNode: Child | number, newNode: Container.NewChild): this + + /** + * Traverses the container’s descendant nodes, calling callback + * for each comment node. + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * ```js + * root.walkComments(comment => { + * comment.remove() + * }) + * ``` + * + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + + /** + * Inserts new nodes to the start of the container. + * + * ```js + * const decl1 = new Declaration({ prop: 'color', value: 'black' }) + * const decl2 = new Declaration({ prop: 'background-color', value: 'white' }) + * rule.prepend(decl1, decl2) + * + * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule + * root.append({ selector: 'a' }) // rule + * rule.append({ prop: 'color', value: 'black' }) // declaration + * rule.append({ text: 'Comment' }) // comment + * + * root.append('a {}') + * root.first.append('color: black; z-index: 1') + * ``` + * + * @param nodes New nodes. + * @return This node for methods chain. + */ + prepend(...nodes: Container.NewChild[]): this + /** + * Add child to the end of the node. + * + * ```js + * rule.push(new Declaration({ prop: 'color', value: 'black' })) + * ``` + * + * @param child New node. + * @return This node for methods chain. + */ + push(child: Child): this + + /** + * Removes all children from the container + * and cleans their parent properties. + * + * ```js + * rule.removeAll() + * rule.nodes.length //=> 0 + * ``` + * + * @return This node for methods chain. + */ + removeAll(): this + + /** + * Removes node from the container and cleans the parent properties + * from the node and its children. + * + * ```js + * rule.nodes.length //=> 5 + * rule.removeChild(decl) + * rule.nodes.length //=> 4 + * decl.parent //=> undefined + * ``` + * + * @param child Child or child’s index. + * @return This node for methods chain. + */ + removeChild(child: Child | number): this + + replaceValues( + pattern: RegExp | string, + replaced: { (substring: string, ...args: any[]): string } | string + ): this + + /** + * Passes all declaration values within the container that match pattern + * through callback, replacing those values with the returned result + * of callback. + * + * This method is useful if you are using a custom unit or function + * and need to iterate through all values. + * + * ```js + * root.replaceValues(/\d+rem/, { fast: 'rem' }, string => { + * return 15 * parseInt(string) + 'px' + * }) + * ``` + * + * @param pattern Replace pattern. + * @param {object} options Options to speed up the search. + * @param replaced String to replace pattern or callback + * that returns a new value. The callback + * will receive the same arguments + * as those passed to a function parameter + * of `String#replace`. + * @return This node for methods chain. + */ + replaceValues( + pattern: RegExp | string, + options: Container.ValueOptions, + replaced: { (substring: string, ...args: any[]): string } | string + ): this + + /** + * Returns `true` if callback returns `true` for (at least) one + * of the container’s children. + * + * ```js + * const hasPrefix = rule.some(i => i.prop[0] === '-') + * ``` + * + * @param condition Iterator returns true or false. + * @return Is some child pass condition. + */ + some( + condition: (node: Child, index: number, nodes: Child[]) => boolean + ): boolean + + /** + * Traverses the container’s descendant nodes, calling callback + * for each node. + * + * Like container.each(), this method is safe to use + * if you are mutating arrays during iteration. + * + * If you only need to iterate through the container’s immediate children, + * use `Container#each`. + * + * ```js + * root.walk(node => { + * // Traverses all descendant nodes. + * }) + * ``` + * + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walk( + callback: (node: ChildNode, index: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each at-rule node. + * + * If you pass a filter, iteration will only happen over at-rules + * that have matching names. + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * ```js + * root.walkAtRules(rule => { + * if (isOld(rule.name)) rule.remove() + * }) + * + * let first = false + * root.walkAtRules('charset', rule => { + * if (!first) { + * first = true + * } else { + * rule.remove() + * } + * }) + * ``` + * + * @param name String or regular expression to filter at-rules by name. + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walkAtRules( + nameFilter: RegExp | string, + callback: (atRule: AtRule, index: number) => false | void + ): false | undefined + + walkAtRules( + callback: (atRule: AtRule, index: number) => false | void + ): false | undefined + walkComments( + callback: (comment: Comment, indexed: number) => false | void + ): false | undefined + + walkComments( + callback: (comment: Comment, indexed: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each declaration node. + * + * If you pass a filter, iteration will only happen over declarations + * with matching properties. + * + * ```js + * root.walkDecls(decl => { + * checkPropertySupport(decl.prop) + * }) + * + * root.walkDecls('border-radius', decl => { + * decl.remove() + * }) + * + * root.walkDecls(/^background/, decl => { + * decl.value = takeFirstColorFromGradient(decl.value) + * }) + * ``` + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * @param prop String or regular expression to filter declarations + * by property name. + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walkDecls( + propFilter: RegExp | string, + callback: (decl: Declaration, index: number) => false | void + ): false | undefined + + walkDecls( + callback: (decl: Declaration, index: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each rule node. + * + * If you pass a filter, iteration will only happen over rules + * with matching selectors. + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * ```js + * const selectors = [] + * root.walkRules(rule => { + * selectors.push(rule.selector) + * }) + * console.log(`Your CSS uses ${ selectors.length } selectors`) + * ``` + * + * @param selector String or regular expression to filter rules by selector. + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walkRules( + selectorFilter: RegExp | string, + callback: (rule: Rule, index: number) => false | void + ): false | undefined + walkRules( + callback: (rule: Rule, index: number) => false | void + ): false | undefined + /** + * The container’s first child. + * + * ```js + * rule.first === rules.nodes[0] + * ``` + */ + get first(): Child | undefined + /** + * The container’s last child. + * + * ```js + * rule.last === rule.nodes[rule.nodes.length - 1] + * ``` + */ + get last(): Child | undefined +} + +declare class Container< + Child extends Node = ChildNode +> extends Container_ {} + +export = Container diff --git a/node_modules/postcss/lib/container.js b/node_modules/postcss/lib/container.js new file mode 100644 index 00000000..8b9e1ef8 --- /dev/null +++ b/node_modules/postcss/lib/container.js @@ -0,0 +1,447 @@ +'use strict' + +let Comment = require('./comment') +let Declaration = require('./declaration') +let Node = require('./node') +let { isClean, my } = require('./symbols') + +let AtRule, parse, Root, Rule + +function cleanSource(nodes) { + return nodes.map(i => { + if (i.nodes) i.nodes = cleanSource(i.nodes) + delete i.source + return i + }) +} + +function markTreeDirty(node) { + node[isClean] = false + if (node.proxyOf.nodes) { + for (let i of node.proxyOf.nodes) { + markTreeDirty(i) + } + } +} + +class Container extends Node { + append(...children) { + for (let child of children) { + let nodes = this.normalize(child, this.last) + for (let node of nodes) this.proxyOf.nodes.push(node) + } + + this.markDirty() + + return this + } + + cleanRaws(keepBetween) { + super.cleanRaws(keepBetween) + if (this.nodes) { + for (let node of this.nodes) node.cleanRaws(keepBetween) + } + } + + each(callback) { + if (!this.proxyOf.nodes) return undefined + let iterator = this.getIterator() + + let index, result + while (this.indexes[iterator] < this.proxyOf.nodes.length) { + index = this.indexes[iterator] + result = callback(this.proxyOf.nodes[index], index) + if (result === false) break + + this.indexes[iterator] += 1 + } + + delete this.indexes[iterator] + return result + } + + every(condition) { + return this.nodes.every(condition) + } + + getIterator() { + if (!this.lastEach) this.lastEach = 0 + if (!this.indexes) this.indexes = {} + + this.lastEach += 1 + let iterator = this.lastEach + this.indexes[iterator] = 0 + + return iterator + } + + getProxyProcessor() { + return { + get(node, prop) { + if (prop === 'proxyOf') { + return node + } else if (!node[prop]) { + return node[prop] + } else if ( + prop === 'each' || + (typeof prop === 'string' && prop.startsWith('walk')) + ) { + return (...args) => { + return node[prop]( + ...args.map(i => { + if (typeof i === 'function') { + return (child, index) => i(child.toProxy(), index) + } else { + return i + } + }) + ) + } + } else if (prop === 'every' || prop === 'some') { + return cb => { + return node[prop]((child, ...other) => + cb(child.toProxy(), ...other) + ) + } + } else if (prop === 'root') { + return () => node.root().toProxy() + } else if (prop === 'nodes') { + return node.nodes.map(i => i.toProxy()) + } else if (prop === 'first' || prop === 'last') { + return node[prop].toProxy() + } else { + return node[prop] + } + }, + + set(node, prop, value) { + if (node[prop] === value) return true + node[prop] = value + if (prop === 'name' || prop === 'params' || prop === 'selector') { + node.markDirty() + } + return true + } + } + } + + index(child) { + if (typeof child === 'number') return child + if (child.proxyOf) child = child.proxyOf + return this.proxyOf.nodes.indexOf(child) + } + + insertAfter(exist, add) { + let existIndex = this.index(exist) + let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse() + existIndex = this.index(exist) + for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node) + + let index + for (let id in this.indexes) { + index = this.indexes[id] + if (existIndex < index) { + this.indexes[id] = index + nodes.length + } + } + + this.markDirty() + + return this + } + + insertBefore(exist, add) { + let existIndex = this.index(exist) + let type = existIndex === 0 ? 'prepend' : false + let nodes = this.normalize( + add, + this.proxyOf.nodes[existIndex], + type + ).reverse() + existIndex = this.index(exist) + for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node) + + let index + for (let id in this.indexes) { + index = this.indexes[id] + if (existIndex <= index) { + this.indexes[id] = index + nodes.length + } + } + + this.markDirty() + + return this + } + + normalize(nodes, sample) { + if (typeof nodes === 'string') { + nodes = cleanSource(parse(nodes).nodes) + } else if (typeof nodes === 'undefined') { + nodes = [] + } else if (Array.isArray(nodes)) { + nodes = nodes.slice(0) + for (let i of nodes) { + if (i.parent) i.parent.removeChild(i, 'ignore') + } + } else if (nodes.type === 'root' && this.type !== 'document') { + nodes = nodes.nodes.slice(0) + for (let i of nodes) { + if (i.parent) i.parent.removeChild(i, 'ignore') + } + } else if (nodes.type) { + nodes = [nodes] + } else if (nodes.prop) { + if (typeof nodes.value === 'undefined') { + throw new Error('Value field is missed in node creation') + } else if (typeof nodes.value !== 'string') { + nodes.value = String(nodes.value) + } + nodes = [new Declaration(nodes)] + } else if (nodes.selector || nodes.selectors) { + nodes = [new Rule(nodes)] + } else if (nodes.name) { + nodes = [new AtRule(nodes)] + } else if (nodes.text) { + nodes = [new Comment(nodes)] + } else { + throw new Error('Unknown node type in node creation') + } + + let processed = nodes.map(i => { + /* c8 ignore next */ + if (!i[my]) Container.rebuild(i) + i = i.proxyOf + if (i.parent) i.parent.removeChild(i) + if (i[isClean]) markTreeDirty(i) + + if (!i.raws) i.raws = {} + if (typeof i.raws.before === 'undefined') { + if (sample && typeof sample.raws.before !== 'undefined') { + i.raws.before = sample.raws.before.replace(/\S/g, '') + } + } + i.parent = this.proxyOf + return i + }) + + return processed + } + + prepend(...children) { + children = children.reverse() + for (let child of children) { + let nodes = this.normalize(child, this.first, 'prepend').reverse() + for (let node of nodes) this.proxyOf.nodes.unshift(node) + for (let id in this.indexes) { + this.indexes[id] = this.indexes[id] + nodes.length + } + } + + this.markDirty() + + return this + } + + push(child) { + child.parent = this + this.proxyOf.nodes.push(child) + return this + } + + removeAll() { + for (let node of this.proxyOf.nodes) node.parent = undefined + this.proxyOf.nodes = [] + + this.markDirty() + + return this + } + + removeChild(child) { + child = this.index(child) + this.proxyOf.nodes[child].parent = undefined + this.proxyOf.nodes.splice(child, 1) + + let index + for (let id in this.indexes) { + index = this.indexes[id] + if (index >= child) { + this.indexes[id] = index - 1 + } + } + + this.markDirty() + + return this + } + + replaceValues(pattern, opts, callback) { + if (!callback) { + callback = opts + opts = {} + } + + this.walkDecls(decl => { + if (opts.props && !opts.props.includes(decl.prop)) return + if (opts.fast && !decl.value.includes(opts.fast)) return + + decl.value = decl.value.replace(pattern, callback) + }) + + this.markDirty() + + return this + } + + some(condition) { + return this.nodes.some(condition) + } + + walk(callback) { + return this.each((child, i) => { + let result + try { + result = callback(child, i) + } catch (e) { + throw child.addToError(e) + } + if (result !== false && child.walk) { + result = child.walk(callback) + } + + return result + }) + } + + walkAtRules(name, callback) { + if (!callback) { + callback = name + return this.walk((child, i) => { + if (child.type === 'atrule') { + return callback(child, i) + } + }) + } + if (name instanceof RegExp) { + return this.walk((child, i) => { + if (child.type === 'atrule' && name.test(child.name)) { + return callback(child, i) + } + }) + } + return this.walk((child, i) => { + if (child.type === 'atrule' && child.name === name) { + return callback(child, i) + } + }) + } + + walkComments(callback) { + return this.walk((child, i) => { + if (child.type === 'comment') { + return callback(child, i) + } + }) + } + + walkDecls(prop, callback) { + if (!callback) { + callback = prop + return this.walk((child, i) => { + if (child.type === 'decl') { + return callback(child, i) + } + }) + } + if (prop instanceof RegExp) { + return this.walk((child, i) => { + if (child.type === 'decl' && prop.test(child.prop)) { + return callback(child, i) + } + }) + } + return this.walk((child, i) => { + if (child.type === 'decl' && child.prop === prop) { + return callback(child, i) + } + }) + } + + walkRules(selector, callback) { + if (!callback) { + callback = selector + + return this.walk((child, i) => { + if (child.type === 'rule') { + return callback(child, i) + } + }) + } + if (selector instanceof RegExp) { + return this.walk((child, i) => { + if (child.type === 'rule' && selector.test(child.selector)) { + return callback(child, i) + } + }) + } + return this.walk((child, i) => { + if (child.type === 'rule' && child.selector === selector) { + return callback(child, i) + } + }) + } + + get first() { + if (!this.proxyOf.nodes) return undefined + return this.proxyOf.nodes[0] + } + + get last() { + if (!this.proxyOf.nodes) return undefined + return this.proxyOf.nodes[this.proxyOf.nodes.length - 1] + } +} + +Container.registerParse = dependant => { + parse = dependant +} + +Container.registerRule = dependant => { + Rule = dependant +} + +Container.registerAtRule = dependant => { + AtRule = dependant +} + +Container.registerRoot = dependant => { + Root = dependant +} + +module.exports = Container +Container.default = Container + +/* c8 ignore start */ +Container.rebuild = node => { + if (node.type === 'atrule') { + Object.setPrototypeOf(node, AtRule.prototype) + } else if (node.type === 'rule') { + Object.setPrototypeOf(node, Rule.prototype) + } else if (node.type === 'decl') { + Object.setPrototypeOf(node, Declaration.prototype) + } else if (node.type === 'comment') { + Object.setPrototypeOf(node, Comment.prototype) + } else if (node.type === 'root') { + Object.setPrototypeOf(node, Root.prototype) + } + + node[my] = true + + if (node.nodes) { + node.nodes.forEach(child => { + Container.rebuild(child) + }) + } +} +/* c8 ignore stop */ diff --git a/node_modules/postcss/lib/css-syntax-error.d.ts b/node_modules/postcss/lib/css-syntax-error.d.ts new file mode 100644 index 00000000..e540d849 --- /dev/null +++ b/node_modules/postcss/lib/css-syntax-error.d.ts @@ -0,0 +1,248 @@ +import { FilePosition } from './input.js' + +declare namespace CssSyntaxError { + /** + * A position that is part of a range. + */ + export interface RangePosition { + /** + * The column number in the input. + */ + column: number + + /** + * The line number in the input. + */ + line: number + } + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { CssSyntaxError_ as default } +} + +/** + * The CSS parser throws this error for broken CSS. + * + * Custom parsers can throw this error for broken custom syntax using + * the `Node#error` method. + * + * PostCSS will use the input source map to detect the original error location. + * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS, + * PostCSS will show the original position in the Sass file. + * + * If you need the position in the PostCSS input + * (e.g., to debug the previous compiler), use `error.input.file`. + * + * ```js + * // Raising error from plugin + * throw node.error('Unknown variable', { plugin: 'postcss-vars' }) + * ``` + * + * ```js + * // Catching and checking syntax error + * try { + * postcss.parse('a{') + * } catch (error) { + * if (error.name === 'CssSyntaxError') { + * error //=> CssSyntaxError + * } + * } + * ``` + */ +declare class CssSyntaxError_ extends Error { + /** + * Source column of the error. + * + * ```js + * error.column //=> 1 + * error.input.column //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.column`. + */ + column?: number + + /** + * Source column of the error's end, exclusive. Provided if the error pertains + * to a range. + * + * ```js + * error.endColumn //=> 1 + * error.input.endColumn //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.endColumn`. + */ + endColumn?: number + + /** + * Source line of the error's end, exclusive. Provided if the error pertains + * to a range. + * + * ```js + * error.endLine //=> 3 + * error.input.endLine //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.endLine`. + */ + endLine?: number + + /** + * Absolute path to the broken file. + * + * ```js + * error.file //=> 'a.sass' + * error.input.file //=> 'a.css' + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.file`. + */ + file?: string + + /** + * Input object with PostCSS internal information + * about input file. If input has source map + * from previous tool, PostCSS will use origin + * (for example, Sass) source. You can use this + * object to get PostCSS input source. + * + * ```js + * error.input.file //=> 'a.css' + * error.file //=> 'a.sass' + * ``` + */ + input?: FilePosition + + /** + * Source line of the error. + * + * ```js + * error.line //=> 2 + * error.input.line //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.line`. + */ + line?: number + + /** + * Full error text in the GNU error format + * with plugin, file, line and column. + * + * ```js + * error.message //=> 'a.css:1:1: Unclosed block' + * ``` + */ + message: string + + /** + * Always equal to `'CssSyntaxError'`. You should always check error type + * by `error.name === 'CssSyntaxError'` + * instead of `error instanceof CssSyntaxError`, + * because npm could have several PostCSS versions. + * + * ```js + * if (error.name === 'CssSyntaxError') { + * error //=> CssSyntaxError + * } + * ``` + */ + name: 'CssSyntaxError' + + /** + * Plugin name, if error came from plugin. + * + * ```js + * error.plugin //=> 'postcss-vars' + * ``` + */ + plugin?: string + + /** + * Error message. + * + * ```js + * error.message //=> 'Unclosed block' + * ``` + */ + reason: string + + /** + * Source code of the broken file. + * + * ```js + * error.source //=> 'a { b {} }' + * error.input.source //=> 'a b { }' + * ``` + */ + source?: string + + stack: string + + /** + * Instantiates a CSS syntax error. Can be instantiated for a single position + * or for a range. + * @param message Error message. + * @param lineOrStartPos If for a single position, the line number, or if for + * a range, the inclusive start position of the error. + * @param columnOrEndPos If for a single position, the column number, or if for + * a range, the exclusive end position of the error. + * @param source Source code of the broken file. + * @param file Absolute path to the broken file. + * @param plugin PostCSS plugin name, if error came from plugin. + */ + constructor( + message: string, + lineOrStartPos?: CssSyntaxError.RangePosition | number, + columnOrEndPos?: CssSyntaxError.RangePosition | number, + source?: string, + file?: string, + plugin?: string + ) + + /** + * Returns a few lines of CSS source that caused the error. + * + * If the CSS has an input source map without `sourceContent`, + * this method will return an empty string. + * + * ```js + * error.showSourceCode() //=> " 4 | } + * // 5 | a { + * // > 6 | bad + * // | ^ + * // 7 | } + * // 8 | b {" + * ``` + * + * @param color Whether arrow will be colored red by terminal + * color codes. By default, PostCSS will detect + * color support by `process.stdout.isTTY` + * and `process.env.NODE_DISABLE_COLORS`. + * @return Few lines of CSS source that caused the error. + */ + showSourceCode(color?: boolean): string + + /** + * Returns error position, message and source code of the broken part. + * + * ```js + * error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block + * // > 1 | a { + * // | ^" + * ``` + * + * @return Error position, message and source code. + */ + toString(): string +} + +declare class CssSyntaxError extends CssSyntaxError_ {} + +export = CssSyntaxError diff --git a/node_modules/postcss/lib/css-syntax-error.js b/node_modules/postcss/lib/css-syntax-error.js new file mode 100644 index 00000000..275a4f64 --- /dev/null +++ b/node_modules/postcss/lib/css-syntax-error.js @@ -0,0 +1,133 @@ +'use strict' + +let pico = require('picocolors') + +let terminalHighlight = require('./terminal-highlight') + +class CssSyntaxError extends Error { + constructor(message, line, column, source, file, plugin) { + super(message) + this.name = 'CssSyntaxError' + this.reason = message + + if (file) { + this.file = file + } + if (source) { + this.source = source + } + if (plugin) { + this.plugin = plugin + } + if (typeof line !== 'undefined' && typeof column !== 'undefined') { + if (typeof line === 'number') { + this.line = line + this.column = column + } else { + this.line = line.line + this.column = line.column + this.endLine = column.line + this.endColumn = column.column + } + } + + this.setMessage() + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, CssSyntaxError) + } + } + + setMessage() { + this.message = this.plugin ? this.plugin + ': ' : '' + this.message += this.file ? this.file : '' + if (typeof this.line !== 'undefined') { + this.message += ':' + this.line + ':' + this.column + } + this.message += ': ' + this.reason + } + + showSourceCode(color) { + if (!this.source) return '' + + let css = this.source + if (color == null) color = pico.isColorSupported + + let aside = text => text + let mark = text => text + let highlight = text => text + if (color) { + let { bold, gray, red } = pico.createColors(true) + mark = text => bold(red(text)) + aside = text => gray(text) + if (terminalHighlight) { + highlight = text => terminalHighlight(text) + } + } + + let lines = css.split(/\r?\n/) + let start = Math.max(this.line - 3, 0) + let end = Math.min(this.line + 2, lines.length) + let maxWidth = String(end).length + + return lines + .slice(start, end) + .map((line, index) => { + let number = start + 1 + index + let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ' + if (number === this.line) { + if (line.length > 160) { + let padding = 20 + let subLineStart = Math.max(0, this.column - padding) + let subLineEnd = Math.max( + this.column + padding, + this.endColumn + padding + ) + let subLine = line.slice(subLineStart, subLineEnd) + + let spacing = + aside(gutter.replace(/\d/g, ' ')) + + line + .slice(0, Math.min(this.column - 1, padding - 1)) + .replace(/[^\t]/g, ' ') + + return ( + mark('>') + + aside(gutter) + + highlight(subLine) + + '\n ' + + spacing + + mark('^') + ) + } + + let spacing = + aside(gutter.replace(/\d/g, ' ')) + + line.slice(0, this.column - 1).replace(/[^\t]/g, ' ') + + return ( + mark('>') + + aside(gutter) + + highlight(line) + + '\n ' + + spacing + + mark('^') + ) + } + + return ' ' + aside(gutter) + highlight(line) + }) + .join('\n') + } + + toString() { + let code = this.showSourceCode() + if (code) { + code = '\n\n' + code + '\n' + } + return this.name + ': ' + this.message + code + } +} + +module.exports = CssSyntaxError +CssSyntaxError.default = CssSyntaxError diff --git a/node_modules/postcss/lib/declaration.d.ts b/node_modules/postcss/lib/declaration.d.ts new file mode 100644 index 00000000..e707ad67 --- /dev/null +++ b/node_modules/postcss/lib/declaration.d.ts @@ -0,0 +1,151 @@ +import { ContainerWithChildren } from './container.js' +import Node from './node.js' + +declare namespace Declaration { + export interface DeclarationRaws extends Record { + /** + * The space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + */ + before?: string + + /** + * The symbols between the property and value for declarations. + */ + between?: string + + /** + * The content of the important statement, if it is not just `!important`. + */ + important?: string + + /** + * Declaration value with comments. + */ + value?: { + raw: string + value: string + } + } + + export interface DeclarationProps { + /** Whether the declaration has an `!important` annotation. */ + important?: boolean + /** Name of the declaration. */ + prop: string + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: DeclarationRaws + /** Value of the declaration. */ + value: string + } + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Declaration_ as default } +} + +/** + * It represents a class that handles + * [CSS declarations](https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax#css_declarations) + * + * ```js + * Once (root, { Declaration }) { + * const color = new Declaration({ prop: 'color', value: 'black' }) + * root.append(color) + * } + * ``` + * + * ```js + * const root = postcss.parse('a { color: black }') + * const decl = root.first?.first + * + * decl.type //=> 'decl' + * decl.toString() //=> ' color: black' + * ``` + */ +declare class Declaration_ extends Node { + parent: ContainerWithChildren | undefined + raws: Declaration.DeclarationRaws + + type: 'decl' + + constructor(defaults?: Declaration.DeclarationProps) + assign(overrides: Declaration.DeclarationProps | object): this + + clone(overrides?: Partial): this + + cloneAfter(overrides?: Partial): this + + cloneBefore(overrides?: Partial): this + /** + * It represents a specificity of the declaration. + * + * If true, the CSS declaration will have an + * [important](https://developer.mozilla.org/en-US/docs/Web/CSS/important) + * specifier. + * + * ```js + * const root = postcss.parse('a { color: black !important; color: red }') + * + * root.first.first.important //=> true + * root.first.last.important //=> undefined + * ``` + */ + get important(): boolean + + set important(value: boolean) + /** + * The property name for a CSS declaration. + * + * ```js + * const root = postcss.parse('a { color: black }') + * const decl = root.first.first + * + * decl.prop //=> 'color' + * ``` + */ + get prop(): string + + set prop(value: string) + /** + * The property value for a CSS declaration. + * + * Any CSS comments inside the value string will be filtered out. + * CSS comments present in the source value will be available in + * the `raws` property. + * + * Assigning new `value` would ignore the comments in `raws` + * property while compiling node to string. + * + * ```js + * const root = postcss.parse('a { color: black }') + * const decl = root.first.first + * + * decl.value //=> 'black' + * ``` + */ + get value(): string + set value(value: string) + /** + * It represents a getter that returns `true` if a declaration starts with + * `--` or `$`, which are used to declare variables in CSS and SASS/SCSS. + * + * ```js + * const root = postcss.parse(':root { --one: 1 }') + * const one = root.first.first + * + * one.variable //=> true + * ``` + * + * ```js + * const root = postcss.parse('$one: 1') + * const one = root.first + * + * one.variable //=> true + * ``` + */ + get variable(): boolean +} + +declare class Declaration extends Declaration_ {} + +export = Declaration diff --git a/node_modules/postcss/lib/declaration.js b/node_modules/postcss/lib/declaration.js new file mode 100644 index 00000000..a04bdec3 --- /dev/null +++ b/node_modules/postcss/lib/declaration.js @@ -0,0 +1,24 @@ +'use strict' + +let Node = require('./node') + +class Declaration extends Node { + constructor(defaults) { + if ( + defaults && + typeof defaults.value !== 'undefined' && + typeof defaults.value !== 'string' + ) { + defaults = { ...defaults, value: String(defaults.value) } + } + super(defaults) + this.type = 'decl' + } + + get variable() { + return this.prop.startsWith('--') || this.prop[0] === '$' + } +} + +module.exports = Declaration +Declaration.default = Declaration diff --git a/node_modules/postcss/lib/document.d.ts b/node_modules/postcss/lib/document.d.ts new file mode 100644 index 00000000..f9e80634 --- /dev/null +++ b/node_modules/postcss/lib/document.d.ts @@ -0,0 +1,69 @@ +import Container, { ContainerProps } from './container.js' +import { ProcessOptions } from './postcss.js' +import Result from './result.js' +import Root from './root.js' + +declare namespace Document { + export interface DocumentProps extends ContainerProps { + nodes?: readonly Root[] + + /** + * Information to generate byte-to-byte equal node string as it was + * in the origin input. + * + * Every parser saves its own properties. + */ + raws?: Record + } + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Document_ as default } +} + +/** + * Represents a file and contains all its parsed nodes. + * + * **Experimental:** some aspects of this node could change within minor + * or patch version releases. + * + * ```js + * const document = htmlParser( + * '' + * ) + * document.type //=> 'document' + * document.nodes.length //=> 2 + * ``` + */ +declare class Document_ extends Container { + nodes: Root[] + parent: undefined + type: 'document' + + constructor(defaults?: Document.DocumentProps) + + assign(overrides: Document.DocumentProps | object): this + clone(overrides?: Partial): this + cloneAfter(overrides?: Partial): this + cloneBefore(overrides?: Partial): this + + /** + * Returns a `Result` instance representing the document’s CSS roots. + * + * ```js + * const root1 = postcss.parse(css1, { from: 'a.css' }) + * const root2 = postcss.parse(css2, { from: 'b.css' }) + * const document = postcss.document() + * document.append(root1) + * document.append(root2) + * const result = document.toResult({ to: 'all.css', map: true }) + * ``` + * + * @param opts Options. + * @return Result with current document’s CSS. + */ + toResult(options?: ProcessOptions): Result +} + +declare class Document extends Document_ {} + +export = Document diff --git a/node_modules/postcss/lib/document.js b/node_modules/postcss/lib/document.js new file mode 100644 index 00000000..44689917 --- /dev/null +++ b/node_modules/postcss/lib/document.js @@ -0,0 +1,33 @@ +'use strict' + +let Container = require('./container') + +let LazyResult, Processor + +class Document extends Container { + constructor(defaults) { + // type needs to be passed to super, otherwise child roots won't be normalized correctly + super({ type: 'document', ...defaults }) + + if (!this.nodes) { + this.nodes = [] + } + } + + toResult(opts = {}) { + let lazy = new LazyResult(new Processor(), this, opts) + + return lazy.stringify() + } +} + +Document.registerLazyResult = dependant => { + LazyResult = dependant +} + +Document.registerProcessor = dependant => { + Processor = dependant +} + +module.exports = Document +Document.default = Document diff --git a/node_modules/postcss/lib/fromJSON.d.ts b/node_modules/postcss/lib/fromJSON.d.ts new file mode 100644 index 00000000..e1deedbd --- /dev/null +++ b/node_modules/postcss/lib/fromJSON.d.ts @@ -0,0 +1,9 @@ +import { JSONHydrator } from './postcss.js' + +interface FromJSON extends JSONHydrator { + default: FromJSON +} + +declare const fromJSON: FromJSON + +export = fromJSON diff --git a/node_modules/postcss/lib/fromJSON.js b/node_modules/postcss/lib/fromJSON.js new file mode 100644 index 00000000..c9ac1a86 --- /dev/null +++ b/node_modules/postcss/lib/fromJSON.js @@ -0,0 +1,54 @@ +'use strict' + +let AtRule = require('./at-rule') +let Comment = require('./comment') +let Declaration = require('./declaration') +let Input = require('./input') +let PreviousMap = require('./previous-map') +let Root = require('./root') +let Rule = require('./rule') + +function fromJSON(json, inputs) { + if (Array.isArray(json)) return json.map(n => fromJSON(n)) + + let { inputs: ownInputs, ...defaults } = json + if (ownInputs) { + inputs = [] + for (let input of ownInputs) { + let inputHydrated = { ...input, __proto__: Input.prototype } + if (inputHydrated.map) { + inputHydrated.map = { + ...inputHydrated.map, + __proto__: PreviousMap.prototype + } + } + inputs.push(inputHydrated) + } + } + if (defaults.nodes) { + defaults.nodes = json.nodes.map(n => fromJSON(n, inputs)) + } + if (defaults.source) { + let { inputId, ...source } = defaults.source + defaults.source = source + if (inputId != null) { + defaults.source.input = inputs[inputId] + } + } + if (defaults.type === 'root') { + return new Root(defaults) + } else if (defaults.type === 'decl') { + return new Declaration(defaults) + } else if (defaults.type === 'rule') { + return new Rule(defaults) + } else if (defaults.type === 'comment') { + return new Comment(defaults) + } else if (defaults.type === 'atrule') { + return new AtRule(defaults) + } else { + throw new Error('Unknown node type: ' + json.type) + } +} + +module.exports = fromJSON +fromJSON.default = fromJSON diff --git a/node_modules/postcss/lib/input.d.ts b/node_modules/postcss/lib/input.d.ts new file mode 100644 index 00000000..46ded098 --- /dev/null +++ b/node_modules/postcss/lib/input.d.ts @@ -0,0 +1,197 @@ +import { CssSyntaxError, ProcessOptions } from './postcss.js' +import PreviousMap from './previous-map.js' + +declare namespace Input { + export interface FilePosition { + /** + * Column of inclusive start position in source file. + */ + column: number + + /** + * Column of exclusive end position in source file. + */ + endColumn?: number + + /** + * Line of exclusive end position in source file. + */ + endLine?: number + + /** + * Absolute path to the source file. + */ + file?: string + + /** + * Line of inclusive start position in source file. + */ + line: number + + /** + * Source code. + */ + source?: string + + /** + * URL for the source file. + */ + url: string + } + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Input_ as default } +} + +/** + * Represents the source CSS. + * + * ```js + * const root = postcss.parse(css, { from: file }) + * const input = root.source.input + * ``` + */ +declare class Input_ { + /** + * Input CSS source. + * + * ```js + * const input = postcss.parse('a{}', { from: file }).input + * input.css //=> "a{}" + * ``` + */ + css: string + + /** + * The absolute path to the CSS source file defined + * with the `from` option. + * + * ```js + * const root = postcss.parse(css, { from: 'a.css' }) + * root.source.input.file //=> '/home/ai/a.css' + * ``` + */ + file?: string + + /** + * The flag to indicate whether or not the source code has Unicode BOM. + */ + hasBOM: boolean + + /** + * The unique ID of the CSS source. It will be created if `from` option + * is not provided (because PostCSS does not know the file path). + * + * ```js + * const root = postcss.parse(css) + * root.source.input.file //=> undefined + * root.source.input.id //=> "" + * ``` + */ + id?: string + + /** + * The input source map passed from a compilation step before PostCSS + * (for example, from Sass compiler). + * + * ```js + * root.source.input.map.consumer().sources //=> ['a.sass'] + * ``` + */ + map: PreviousMap + + /** + * @param css Input CSS source. + * @param opts Process options. + */ + constructor(css: string, opts?: ProcessOptions) + + error( + message: string, + start: + | { + column: number + line: number + } + | { + offset: number + }, + end: + | { + column: number + line: number + } + | { + offset: number + }, + opts?: { plugin?: CssSyntaxError['plugin'] } + ): CssSyntaxError + + /** + * Returns `CssSyntaxError` with information about the error and its position. + */ + error( + message: string, + line: number, + column: number, + opts?: { plugin?: CssSyntaxError['plugin'] } + ): CssSyntaxError + + error( + message: string, + offset: number, + opts?: { plugin?: CssSyntaxError['plugin'] } + ): CssSyntaxError + + /** + * Converts source offset to line and column. + * + * @param offset Source offset. + */ + fromOffset(offset: number): { col: number; line: number } | null + /** + * Reads the input source map and returns a symbol position + * in the input source (e.g., in a Sass file that was compiled + * to CSS before being passed to PostCSS). Optionally takes an + * end position, exclusive. + * + * ```js + * root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 } + * root.source.input.origin(1, 1, 1, 4) + * //=> { file: 'a.css', line: 3, column: 1, endLine: 3, endColumn: 4 } + * ``` + * + * @param line Line for inclusive start position in input CSS. + * @param column Column for inclusive start position in input CSS. + * @param endLine Line for exclusive end position in input CSS. + * @param endColumn Column for exclusive end position in input CSS. + * + * @return Position in input source. + */ + origin( + line: number, + column: number, + endLine?: number, + endColumn?: number + ): false | Input.FilePosition + /** Converts this to a JSON-friendly object representation. */ + toJSON(): object + + /** + * The CSS source identifier. Contains `Input#file` if the user + * set the `from` option, or `Input#id` if they did not. + * + * ```js + * const root = postcss.parse(css, { from: 'a.css' }) + * root.source.input.from //=> "/home/ai/a.css" + * + * const root = postcss.parse(css) + * root.source.input.from //=> "" + * ``` + */ + get from(): string +} + +declare class Input extends Input_ {} + +export = Input diff --git a/node_modules/postcss/lib/input.js b/node_modules/postcss/lib/input.js new file mode 100644 index 00000000..685bce74 --- /dev/null +++ b/node_modules/postcss/lib/input.js @@ -0,0 +1,248 @@ +'use strict' + +let { nanoid } = require('nanoid/non-secure') +let { isAbsolute, resolve } = require('path') +let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') +let { fileURLToPath, pathToFileURL } = require('url') + +let CssSyntaxError = require('./css-syntax-error') +let PreviousMap = require('./previous-map') +let terminalHighlight = require('./terminal-highlight') + +let fromOffsetCache = Symbol('fromOffsetCache') + +let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) +let pathAvailable = Boolean(resolve && isAbsolute) + +class Input { + constructor(css, opts = {}) { + if ( + css === null || + typeof css === 'undefined' || + (typeof css === 'object' && !css.toString) + ) { + throw new Error(`PostCSS received ${css} instead of CSS string`) + } + + this.css = css.toString() + + if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') { + this.hasBOM = true + this.css = this.css.slice(1) + } else { + this.hasBOM = false + } + + if (opts.from) { + if ( + !pathAvailable || + /^\w+:\/\//.test(opts.from) || + isAbsolute(opts.from) + ) { + this.file = opts.from + } else { + this.file = resolve(opts.from) + } + } + + if (pathAvailable && sourceMapAvailable) { + let map = new PreviousMap(this.css, opts) + if (map.text) { + this.map = map + let file = map.consumer().file + if (!this.file && file) this.file = this.mapResolve(file) + } + } + + if (!this.file) { + this.id = '' + } + if (this.map) this.map.file = this.from + } + + error(message, line, column, opts = {}) { + let endColumn, endLine, result + + if (line && typeof line === 'object') { + let start = line + let end = column + if (typeof start.offset === 'number') { + let pos = this.fromOffset(start.offset) + line = pos.line + column = pos.col + } else { + line = start.line + column = start.column + } + if (typeof end.offset === 'number') { + let pos = this.fromOffset(end.offset) + endLine = pos.line + endColumn = pos.col + } else { + endLine = end.line + endColumn = end.column + } + } else if (!column) { + let pos = this.fromOffset(line) + line = pos.line + column = pos.col + } + + let origin = this.origin(line, column, endLine, endColumn) + if (origin) { + result = new CssSyntaxError( + message, + origin.endLine === undefined + ? origin.line + : { column: origin.column, line: origin.line }, + origin.endLine === undefined + ? origin.column + : { column: origin.endColumn, line: origin.endLine }, + origin.source, + origin.file, + opts.plugin + ) + } else { + result = new CssSyntaxError( + message, + endLine === undefined ? line : { column, line }, + endLine === undefined ? column : { column: endColumn, line: endLine }, + this.css, + this.file, + opts.plugin + ) + } + + result.input = { column, endColumn, endLine, line, source: this.css } + if (this.file) { + if (pathToFileURL) { + result.input.url = pathToFileURL(this.file).toString() + } + result.input.file = this.file + } + + return result + } + + fromOffset(offset) { + let lastLine, lineToIndex + if (!this[fromOffsetCache]) { + let lines = this.css.split('\n') + lineToIndex = new Array(lines.length) + let prevIndex = 0 + + for (let i = 0, l = lines.length; i < l; i++) { + lineToIndex[i] = prevIndex + prevIndex += lines[i].length + 1 + } + + this[fromOffsetCache] = lineToIndex + } else { + lineToIndex = this[fromOffsetCache] + } + lastLine = lineToIndex[lineToIndex.length - 1] + + let min = 0 + if (offset >= lastLine) { + min = lineToIndex.length - 1 + } else { + let max = lineToIndex.length - 2 + let mid + while (min < max) { + mid = min + ((max - min) >> 1) + if (offset < lineToIndex[mid]) { + max = mid - 1 + } else if (offset >= lineToIndex[mid + 1]) { + min = mid + 1 + } else { + min = mid + break + } + } + } + return { + col: offset - lineToIndex[min] + 1, + line: min + 1 + } + } + + mapResolve(file) { + if (/^\w+:\/\//.test(file)) { + return file + } + return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file) + } + + origin(line, column, endLine, endColumn) { + if (!this.map) return false + let consumer = this.map.consumer() + + let from = consumer.originalPositionFor({ column, line }) + if (!from.source) return false + + let to + if (typeof endLine === 'number') { + to = consumer.originalPositionFor({ column: endColumn, line: endLine }) + } + + let fromUrl + + if (isAbsolute(from.source)) { + fromUrl = pathToFileURL(from.source) + } else { + fromUrl = new URL( + from.source, + this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile) + ) + } + + let result = { + column: from.column, + endColumn: to && to.column, + endLine: to && to.line, + line: from.line, + url: fromUrl.toString() + } + + if (fromUrl.protocol === 'file:') { + if (fileURLToPath) { + result.file = fileURLToPath(fromUrl) + } else { + /* c8 ignore next 2 */ + throw new Error(`file: protocol is not available in this PostCSS build`) + } + } + + let source = consumer.sourceContentFor(from.source) + if (source) result.source = source + + return result + } + + toJSON() { + let json = {} + for (let name of ['hasBOM', 'css', 'file', 'id']) { + if (this[name] != null) { + json[name] = this[name] + } + } + if (this.map) { + json.map = { ...this.map } + if (json.map.consumerCache) { + json.map.consumerCache = undefined + } + } + return json + } + + get from() { + return this.file || this.id + } +} + +module.exports = Input +Input.default = Input + +if (terminalHighlight && terminalHighlight.registerInput) { + terminalHighlight.registerInput(Input) +} diff --git a/node_modules/postcss/lib/lazy-result.d.ts b/node_modules/postcss/lib/lazy-result.d.ts new file mode 100644 index 00000000..dd291aa3 --- /dev/null +++ b/node_modules/postcss/lib/lazy-result.d.ts @@ -0,0 +1,190 @@ +import Document from './document.js' +import { SourceMap } from './postcss.js' +import Processor from './processor.js' +import Result, { Message, ResultOptions } from './result.js' +import Root from './root.js' +import Warning from './warning.js' + +declare namespace LazyResult { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { LazyResult_ as default } +} + +/** + * A Promise proxy for the result of PostCSS transformations. + * + * A `LazyResult` instance is returned by `Processor#process`. + * + * ```js + * const lazy = postcss([autoprefixer]).process(css) + * ``` + */ +declare class LazyResult_ + implements PromiseLike> +{ + /** + * Processes input CSS through synchronous and asynchronous plugins + * and calls onRejected for each error thrown in any plugin. + * + * It implements standard Promise API. + * + * ```js + * postcss([autoprefixer]).process(css).then(result => { + * console.log(result.css) + * }).catch(error => { + * console.error(error) + * }) + * ``` + */ + catch: Promise>['catch'] + + /** + * Processes input CSS through synchronous and asynchronous plugins + * and calls onFinally on any error or when all plugins will finish work. + * + * It implements standard Promise API. + * + * ```js + * postcss([autoprefixer]).process(css).finally(() => { + * console.log('processing ended') + * }) + * ``` + */ + finally: Promise>['finally'] + + /** + * Processes input CSS through synchronous and asynchronous plugins + * and calls `onFulfilled` with a Result instance. If a plugin throws + * an error, the `onRejected` callback will be executed. + * + * It implements standard Promise API. + * + * ```js + * postcss([autoprefixer]).process(css, { from: cssPath }).then(result => { + * console.log(result.css) + * }) + * ``` + */ + then: Promise>['then'] + + /** + * @param processor Processor used for this transformation. + * @param css CSS to parse and transform. + * @param opts Options from the `Processor#process` or `Root#toResult`. + */ + constructor(processor: Processor, css: string, opts: ResultOptions) + + /** + * Run plugin in async way and return `Result`. + * + * @return Result with output content. + */ + async(): Promise> + + /** + * Run plugin in sync way and return `Result`. + * + * @return Result with output content. + */ + sync(): Result + + /** + * Alias for the `LazyResult#css` property. + * + * ```js + * lazy + '' === lazy.css + * ``` + * + * @return Output CSS. + */ + toString(): string + + /** + * Processes input CSS through synchronous plugins + * and calls `Result#warnings`. + * + * @return Warnings from plugins. + */ + warnings(): Warning[] + + /** + * An alias for the `css` property. Use it with syntaxes + * that generate non-CSS output. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get content(): string + + /** + * Processes input CSS through synchronous plugins, converts `Root` + * to a CSS string and returns `Result#css`. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get css(): string + + /** + * Processes input CSS through synchronous plugins + * and returns `Result#map`. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get map(): SourceMap + + /** + * Processes input CSS through synchronous plugins + * and returns `Result#messages`. + * + * This property will only work with synchronous plugins. If the processor + * contains any asynchronous plugins it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get messages(): Message[] + + /** + * Options from the `Processor#process` call. + */ + get opts(): ResultOptions + + /** + * Returns a `Processor` instance, which will be used + * for CSS transformations. + */ + get processor(): Processor + + /** + * Processes input CSS through synchronous plugins + * and returns `Result#root`. + * + * This property will only work with synchronous plugins. If the processor + * contains any asynchronous plugins it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get root(): RootNode + + /** + * Returns the default string description of an object. + * Required to implement the Promise interface. + */ + get [Symbol.toStringTag](): string +} + +declare class LazyResult< + RootNode = Document | Root +> extends LazyResult_ {} + +export = LazyResult diff --git a/node_modules/postcss/lib/lazy-result.js b/node_modules/postcss/lib/lazy-result.js new file mode 100644 index 00000000..e27701dd --- /dev/null +++ b/node_modules/postcss/lib/lazy-result.js @@ -0,0 +1,550 @@ +'use strict' + +let Container = require('./container') +let Document = require('./document') +let MapGenerator = require('./map-generator') +let parse = require('./parse') +let Result = require('./result') +let Root = require('./root') +let stringify = require('./stringify') +let { isClean, my } = require('./symbols') +let warnOnce = require('./warn-once') + +const TYPE_TO_CLASS_NAME = { + atrule: 'AtRule', + comment: 'Comment', + decl: 'Declaration', + document: 'Document', + root: 'Root', + rule: 'Rule' +} + +const PLUGIN_PROPS = { + AtRule: true, + AtRuleExit: true, + Comment: true, + CommentExit: true, + Declaration: true, + DeclarationExit: true, + Document: true, + DocumentExit: true, + Once: true, + OnceExit: true, + postcssPlugin: true, + prepare: true, + Root: true, + RootExit: true, + Rule: true, + RuleExit: true +} + +const NOT_VISITORS = { + Once: true, + postcssPlugin: true, + prepare: true +} + +const CHILDREN = 0 + +function isPromise(obj) { + return typeof obj === 'object' && typeof obj.then === 'function' +} + +function getEvents(node) { + let key = false + let type = TYPE_TO_CLASS_NAME[node.type] + if (node.type === 'decl') { + key = node.prop.toLowerCase() + } else if (node.type === 'atrule') { + key = node.name.toLowerCase() + } + + if (key && node.append) { + return [ + type, + type + '-' + key, + CHILDREN, + type + 'Exit', + type + 'Exit-' + key + ] + } else if (key) { + return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key] + } else if (node.append) { + return [type, CHILDREN, type + 'Exit'] + } else { + return [type, type + 'Exit'] + } +} + +function toStack(node) { + let events + if (node.type === 'document') { + events = ['Document', CHILDREN, 'DocumentExit'] + } else if (node.type === 'root') { + events = ['Root', CHILDREN, 'RootExit'] + } else { + events = getEvents(node) + } + + return { + eventIndex: 0, + events, + iterator: 0, + node, + visitorIndex: 0, + visitors: [] + } +} + +function cleanMarks(node) { + node[isClean] = false + if (node.nodes) node.nodes.forEach(i => cleanMarks(i)) + return node +} + +let postcss = {} + +class LazyResult { + constructor(processor, css, opts) { + this.stringified = false + this.processed = false + + let root + if ( + typeof css === 'object' && + css !== null && + (css.type === 'root' || css.type === 'document') + ) { + root = cleanMarks(css) + } else if (css instanceof LazyResult || css instanceof Result) { + root = cleanMarks(css.root) + if (css.map) { + if (typeof opts.map === 'undefined') opts.map = {} + if (!opts.map.inline) opts.map.inline = false + opts.map.prev = css.map + } + } else { + let parser = parse + if (opts.syntax) parser = opts.syntax.parse + if (opts.parser) parser = opts.parser + if (parser.parse) parser = parser.parse + + try { + root = parser(css, opts) + } catch (error) { + this.processed = true + this.error = error + } + + if (root && !root[my]) { + /* c8 ignore next 2 */ + Container.rebuild(root) + } + } + + this.result = new Result(processor, root, opts) + this.helpers = { ...postcss, postcss, result: this.result } + this.plugins = this.processor.plugins.map(plugin => { + if (typeof plugin === 'object' && plugin.prepare) { + return { ...plugin, ...plugin.prepare(this.result) } + } else { + return plugin + } + }) + } + + async() { + if (this.error) return Promise.reject(this.error) + if (this.processed) return Promise.resolve(this.result) + if (!this.processing) { + this.processing = this.runAsync() + } + return this.processing + } + + catch(onRejected) { + return this.async().catch(onRejected) + } + + finally(onFinally) { + return this.async().then(onFinally, onFinally) + } + + getAsyncError() { + throw new Error('Use process(css).then(cb) to work with async plugins') + } + + handleError(error, node) { + let plugin = this.result.lastPlugin + try { + if (node) node.addToError(error) + this.error = error + if (error.name === 'CssSyntaxError' && !error.plugin) { + error.plugin = plugin.postcssPlugin + error.setMessage() + } else if (plugin.postcssVersion) { + if (process.env.NODE_ENV !== 'production') { + let pluginName = plugin.postcssPlugin + let pluginVer = plugin.postcssVersion + let runtimeVer = this.result.processor.version + let a = pluginVer.split('.') + let b = runtimeVer.split('.') + + if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) { + // eslint-disable-next-line no-console + console.error( + 'Unknown error from PostCSS plugin. Your current PostCSS ' + + 'version is ' + + runtimeVer + + ', but ' + + pluginName + + ' uses ' + + pluginVer + + '. Perhaps this is the source of the error below.' + ) + } + } + } + } catch (err) { + /* c8 ignore next 3 */ + // eslint-disable-next-line no-console + if (console && console.error) console.error(err) + } + return error + } + + prepareVisitors() { + this.listeners = {} + let add = (plugin, type, cb) => { + if (!this.listeners[type]) this.listeners[type] = [] + this.listeners[type].push([plugin, cb]) + } + for (let plugin of this.plugins) { + if (typeof plugin === 'object') { + for (let event in plugin) { + if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) { + throw new Error( + `Unknown event ${event} in ${plugin.postcssPlugin}. ` + + `Try to update PostCSS (${this.processor.version} now).` + ) + } + if (!NOT_VISITORS[event]) { + if (typeof plugin[event] === 'object') { + for (let filter in plugin[event]) { + if (filter === '*') { + add(plugin, event, plugin[event][filter]) + } else { + add( + plugin, + event + '-' + filter.toLowerCase(), + plugin[event][filter] + ) + } + } + } else if (typeof plugin[event] === 'function') { + add(plugin, event, plugin[event]) + } + } + } + } + } + this.hasListener = Object.keys(this.listeners).length > 0 + } + + async runAsync() { + this.plugin = 0 + for (let i = 0; i < this.plugins.length; i++) { + let plugin = this.plugins[i] + let promise = this.runOnRoot(plugin) + if (isPromise(promise)) { + try { + await promise + } catch (error) { + throw this.handleError(error) + } + } + } + + this.prepareVisitors() + if (this.hasListener) { + let root = this.result.root + while (!root[isClean]) { + root[isClean] = true + let stack = [toStack(root)] + while (stack.length > 0) { + let promise = this.visitTick(stack) + if (isPromise(promise)) { + try { + await promise + } catch (e) { + let node = stack[stack.length - 1].node + throw this.handleError(e, node) + } + } + } + } + + if (this.listeners.OnceExit) { + for (let [plugin, visitor] of this.listeners.OnceExit) { + this.result.lastPlugin = plugin + try { + if (root.type === 'document') { + let roots = root.nodes.map(subRoot => + visitor(subRoot, this.helpers) + ) + + await Promise.all(roots) + } else { + await visitor(root, this.helpers) + } + } catch (e) { + throw this.handleError(e) + } + } + } + } + + this.processed = true + return this.stringify() + } + + runOnRoot(plugin) { + this.result.lastPlugin = plugin + try { + if (typeof plugin === 'object' && plugin.Once) { + if (this.result.root.type === 'document') { + let roots = this.result.root.nodes.map(root => + plugin.Once(root, this.helpers) + ) + + if (isPromise(roots[0])) { + return Promise.all(roots) + } + + return roots + } + + return plugin.Once(this.result.root, this.helpers) + } else if (typeof plugin === 'function') { + return plugin(this.result.root, this.result) + } + } catch (error) { + throw this.handleError(error) + } + } + + stringify() { + if (this.error) throw this.error + if (this.stringified) return this.result + this.stringified = true + + this.sync() + + let opts = this.result.opts + let str = stringify + if (opts.syntax) str = opts.syntax.stringify + if (opts.stringifier) str = opts.stringifier + if (str.stringify) str = str.stringify + + let map = new MapGenerator(str, this.result.root, this.result.opts) + let data = map.generate() + this.result.css = data[0] + this.result.map = data[1] + + return this.result + } + + sync() { + if (this.error) throw this.error + if (this.processed) return this.result + this.processed = true + + if (this.processing) { + throw this.getAsyncError() + } + + for (let plugin of this.plugins) { + let promise = this.runOnRoot(plugin) + if (isPromise(promise)) { + throw this.getAsyncError() + } + } + + this.prepareVisitors() + if (this.hasListener) { + let root = this.result.root + while (!root[isClean]) { + root[isClean] = true + this.walkSync(root) + } + if (this.listeners.OnceExit) { + if (root.type === 'document') { + for (let subRoot of root.nodes) { + this.visitSync(this.listeners.OnceExit, subRoot) + } + } else { + this.visitSync(this.listeners.OnceExit, root) + } + } + } + + return this.result + } + + then(onFulfilled, onRejected) { + if (process.env.NODE_ENV !== 'production') { + if (!('from' in this.opts)) { + warnOnce( + 'Without `from` option PostCSS could generate wrong source map ' + + 'and will not find Browserslist config. Set it to CSS file path ' + + 'or to `undefined` to prevent this warning.' + ) + } + } + return this.async().then(onFulfilled, onRejected) + } + + toString() { + return this.css + } + + visitSync(visitors, node) { + for (let [plugin, visitor] of visitors) { + this.result.lastPlugin = plugin + let promise + try { + promise = visitor(node, this.helpers) + } catch (e) { + throw this.handleError(e, node.proxyOf) + } + if (node.type !== 'root' && node.type !== 'document' && !node.parent) { + return true + } + if (isPromise(promise)) { + throw this.getAsyncError() + } + } + } + + visitTick(stack) { + let visit = stack[stack.length - 1] + let { node, visitors } = visit + + if (node.type !== 'root' && node.type !== 'document' && !node.parent) { + stack.pop() + return + } + + if (visitors.length > 0 && visit.visitorIndex < visitors.length) { + let [plugin, visitor] = visitors[visit.visitorIndex] + visit.visitorIndex += 1 + if (visit.visitorIndex === visitors.length) { + visit.visitors = [] + visit.visitorIndex = 0 + } + this.result.lastPlugin = plugin + try { + return visitor(node.toProxy(), this.helpers) + } catch (e) { + throw this.handleError(e, node) + } + } + + if (visit.iterator !== 0) { + let iterator = visit.iterator + let child + while ((child = node.nodes[node.indexes[iterator]])) { + node.indexes[iterator] += 1 + if (!child[isClean]) { + child[isClean] = true + stack.push(toStack(child)) + return + } + } + visit.iterator = 0 + delete node.indexes[iterator] + } + + let events = visit.events + while (visit.eventIndex < events.length) { + let event = events[visit.eventIndex] + visit.eventIndex += 1 + if (event === CHILDREN) { + if (node.nodes && node.nodes.length) { + node[isClean] = true + visit.iterator = node.getIterator() + } + return + } else if (this.listeners[event]) { + visit.visitors = this.listeners[event] + return + } + } + stack.pop() + } + + walkSync(node) { + node[isClean] = true + let events = getEvents(node) + for (let event of events) { + if (event === CHILDREN) { + if (node.nodes) { + node.each(child => { + if (!child[isClean]) this.walkSync(child) + }) + } + } else { + let visitors = this.listeners[event] + if (visitors) { + if (this.visitSync(visitors, node.toProxy())) return + } + } + } + } + + warnings() { + return this.sync().warnings() + } + + get content() { + return this.stringify().content + } + + get css() { + return this.stringify().css + } + + get map() { + return this.stringify().map + } + + get messages() { + return this.sync().messages + } + + get opts() { + return this.result.opts + } + + get processor() { + return this.result.processor + } + + get root() { + return this.sync().root + } + + get [Symbol.toStringTag]() { + return 'LazyResult' + } +} + +LazyResult.registerPostcss = dependant => { + postcss = dependant +} + +module.exports = LazyResult +LazyResult.default = LazyResult + +Root.registerLazyResult(LazyResult) +Document.registerLazyResult(LazyResult) diff --git a/node_modules/postcss/lib/list.d.ts b/node_modules/postcss/lib/list.d.ts new file mode 100644 index 00000000..e262ad3f --- /dev/null +++ b/node_modules/postcss/lib/list.d.ts @@ -0,0 +1,60 @@ +declare namespace list { + type List = { + /** + * Safely splits comma-separated values (such as those for `transition-*` + * and `background` properties). + * + * ```js + * Once (root, { list }) { + * list.comma('black, linear-gradient(white, black)') + * //=> ['black', 'linear-gradient(white, black)'] + * } + * ``` + * + * @param str Comma-separated values. + * @return Split values. + */ + comma(str: string): string[] + + default: List + + /** + * Safely splits space-separated values (such as those for `background`, + * `border-radius`, and other shorthand properties). + * + * ```js + * Once (root, { list }) { + * list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)'] + * } + * ``` + * + * @param str Space-separated values. + * @return Split values. + */ + space(str: string): string[] + + /** + * Safely splits values. + * + * ```js + * Once (root, { list }) { + * list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)'] + * } + * ``` + * + * @param string separated values. + * @param separators array of separators. + * @param last boolean indicator. + * @return Split values. + */ + split( + string: string, + separators: readonly string[], + last: boolean + ): string[] + } +} + +declare const list: list.List + +export = list diff --git a/node_modules/postcss/lib/list.js b/node_modules/postcss/lib/list.js new file mode 100644 index 00000000..1b31f980 --- /dev/null +++ b/node_modules/postcss/lib/list.js @@ -0,0 +1,58 @@ +'use strict' + +let list = { + comma(string) { + return list.split(string, [','], true) + }, + + space(string) { + let spaces = [' ', '\n', '\t'] + return list.split(string, spaces) + }, + + split(string, separators, last) { + let array = [] + let current = '' + let split = false + + let func = 0 + let inQuote = false + let prevQuote = '' + let escape = false + + for (let letter of string) { + if (escape) { + escape = false + } else if (letter === '\\') { + escape = true + } else if (inQuote) { + if (letter === prevQuote) { + inQuote = false + } + } else if (letter === '"' || letter === "'") { + inQuote = true + prevQuote = letter + } else if (letter === '(') { + func += 1 + } else if (letter === ')') { + if (func > 0) func -= 1 + } else if (func === 0) { + if (separators.includes(letter)) split = true + } + + if (split) { + if (current !== '') array.push(current.trim()) + current = '' + split = false + } else { + current += letter + } + } + + if (last || current !== '') array.push(current.trim()) + return array + } +} + +module.exports = list +list.default = list diff --git a/node_modules/postcss/lib/map-generator.js b/node_modules/postcss/lib/map-generator.js new file mode 100644 index 00000000..89069d3e --- /dev/null +++ b/node_modules/postcss/lib/map-generator.js @@ -0,0 +1,368 @@ +'use strict' + +let { dirname, relative, resolve, sep } = require('path') +let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') +let { pathToFileURL } = require('url') + +let Input = require('./input') + +let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) +let pathAvailable = Boolean(dirname && resolve && relative && sep) + +class MapGenerator { + constructor(stringify, root, opts, cssString) { + this.stringify = stringify + this.mapOpts = opts.map || {} + this.root = root + this.opts = opts + this.css = cssString + this.originalCSS = cssString + this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute + + this.memoizedFileURLs = new Map() + this.memoizedPaths = new Map() + this.memoizedURLs = new Map() + } + + addAnnotation() { + let content + + if (this.isInline()) { + content = + 'data:application/json;base64,' + this.toBase64(this.map.toString()) + } else if (typeof this.mapOpts.annotation === 'string') { + content = this.mapOpts.annotation + } else if (typeof this.mapOpts.annotation === 'function') { + content = this.mapOpts.annotation(this.opts.to, this.root) + } else { + content = this.outputFile() + '.map' + } + let eol = '\n' + if (this.css.includes('\r\n')) eol = '\r\n' + + this.css += eol + '/*# sourceMappingURL=' + content + ' */' + } + + applyPrevMaps() { + for (let prev of this.previous()) { + let from = this.toUrl(this.path(prev.file)) + let root = prev.root || dirname(prev.file) + let map + + if (this.mapOpts.sourcesContent === false) { + map = new SourceMapConsumer(prev.text) + if (map.sourcesContent) { + map.sourcesContent = null + } + } else { + map = prev.consumer() + } + + this.map.applySourceMap(map, from, this.toUrl(this.path(root))) + } + } + + clearAnnotation() { + if (this.mapOpts.annotation === false) return + + if (this.root) { + let node + for (let i = this.root.nodes.length - 1; i >= 0; i--) { + node = this.root.nodes[i] + if (node.type !== 'comment') continue + if (node.text.startsWith('# sourceMappingURL=')) { + this.root.removeChild(i) + } + } + } else if (this.css) { + this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '') + } + } + + generate() { + this.clearAnnotation() + if (pathAvailable && sourceMapAvailable && this.isMap()) { + return this.generateMap() + } else { + let result = '' + this.stringify(this.root, i => { + result += i + }) + return [result] + } + } + + generateMap() { + if (this.root) { + this.generateString() + } else if (this.previous().length === 1) { + let prev = this.previous()[0].consumer() + prev.file = this.outputFile() + this.map = SourceMapGenerator.fromSourceMap(prev, { + ignoreInvalidMapping: true + }) + } else { + this.map = new SourceMapGenerator({ + file: this.outputFile(), + ignoreInvalidMapping: true + }) + this.map.addMapping({ + generated: { column: 0, line: 1 }, + original: { column: 0, line: 1 }, + source: this.opts.from + ? this.toUrl(this.path(this.opts.from)) + : '' + }) + } + + if (this.isSourcesContent()) this.setSourcesContent() + if (this.root && this.previous().length > 0) this.applyPrevMaps() + if (this.isAnnotation()) this.addAnnotation() + + if (this.isInline()) { + return [this.css] + } else { + return [this.css, this.map] + } + } + + generateString() { + this.css = '' + this.map = new SourceMapGenerator({ + file: this.outputFile(), + ignoreInvalidMapping: true + }) + + let line = 1 + let column = 1 + + let noSource = '' + let mapping = { + generated: { column: 0, line: 0 }, + original: { column: 0, line: 0 }, + source: '' + } + + let last, lines + this.stringify(this.root, (str, node, type) => { + this.css += str + + if (node && type !== 'end') { + mapping.generated.line = line + mapping.generated.column = column - 1 + if (node.source && node.source.start) { + mapping.source = this.sourcePath(node) + mapping.original.line = node.source.start.line + mapping.original.column = node.source.start.column - 1 + this.map.addMapping(mapping) + } else { + mapping.source = noSource + mapping.original.line = 1 + mapping.original.column = 0 + this.map.addMapping(mapping) + } + } + + lines = str.match(/\n/g) + if (lines) { + line += lines.length + last = str.lastIndexOf('\n') + column = str.length - last + } else { + column += str.length + } + + if (node && type !== 'start') { + let p = node.parent || { raws: {} } + let childless = + node.type === 'decl' || (node.type === 'atrule' && !node.nodes) + if (!childless || node !== p.last || p.raws.semicolon) { + if (node.source && node.source.end) { + mapping.source = this.sourcePath(node) + mapping.original.line = node.source.end.line + mapping.original.column = node.source.end.column - 1 + mapping.generated.line = line + mapping.generated.column = column - 2 + this.map.addMapping(mapping) + } else { + mapping.source = noSource + mapping.original.line = 1 + mapping.original.column = 0 + mapping.generated.line = line + mapping.generated.column = column - 1 + this.map.addMapping(mapping) + } + } + } + }) + } + + isAnnotation() { + if (this.isInline()) { + return true + } + if (typeof this.mapOpts.annotation !== 'undefined') { + return this.mapOpts.annotation + } + if (this.previous().length) { + return this.previous().some(i => i.annotation) + } + return true + } + + isInline() { + if (typeof this.mapOpts.inline !== 'undefined') { + return this.mapOpts.inline + } + + let annotation = this.mapOpts.annotation + if (typeof annotation !== 'undefined' && annotation !== true) { + return false + } + + if (this.previous().length) { + return this.previous().some(i => i.inline) + } + return true + } + + isMap() { + if (typeof this.opts.map !== 'undefined') { + return !!this.opts.map + } + return this.previous().length > 0 + } + + isSourcesContent() { + if (typeof this.mapOpts.sourcesContent !== 'undefined') { + return this.mapOpts.sourcesContent + } + if (this.previous().length) { + return this.previous().some(i => i.withContent()) + } + return true + } + + outputFile() { + if (this.opts.to) { + return this.path(this.opts.to) + } else if (this.opts.from) { + return this.path(this.opts.from) + } else { + return 'to.css' + } + } + + path(file) { + if (this.mapOpts.absolute) return file + if (file.charCodeAt(0) === 60 /* `<` */) return file + if (/^\w+:\/\//.test(file)) return file + let cached = this.memoizedPaths.get(file) + if (cached) return cached + + let from = this.opts.to ? dirname(this.opts.to) : '.' + + if (typeof this.mapOpts.annotation === 'string') { + from = dirname(resolve(from, this.mapOpts.annotation)) + } + + let path = relative(from, file) + this.memoizedPaths.set(file, path) + + return path + } + + previous() { + if (!this.previousMaps) { + this.previousMaps = [] + if (this.root) { + this.root.walk(node => { + if (node.source && node.source.input.map) { + let map = node.source.input.map + if (!this.previousMaps.includes(map)) { + this.previousMaps.push(map) + } + } + }) + } else { + let input = new Input(this.originalCSS, this.opts) + if (input.map) this.previousMaps.push(input.map) + } + } + + return this.previousMaps + } + + setSourcesContent() { + let already = {} + if (this.root) { + this.root.walk(node => { + if (node.source) { + let from = node.source.input.from + if (from && !already[from]) { + already[from] = true + let fromUrl = this.usesFileUrls + ? this.toFileUrl(from) + : this.toUrl(this.path(from)) + this.map.setSourceContent(fromUrl, node.source.input.css) + } + } + }) + } else if (this.css) { + let from = this.opts.from + ? this.toUrl(this.path(this.opts.from)) + : '' + this.map.setSourceContent(from, this.css) + } + } + + sourcePath(node) { + if (this.mapOpts.from) { + return this.toUrl(this.mapOpts.from) + } else if (this.usesFileUrls) { + return this.toFileUrl(node.source.input.from) + } else { + return this.toUrl(this.path(node.source.input.from)) + } + } + + toBase64(str) { + if (Buffer) { + return Buffer.from(str).toString('base64') + } else { + return window.btoa(unescape(encodeURIComponent(str))) + } + } + + toFileUrl(path) { + let cached = this.memoizedFileURLs.get(path) + if (cached) return cached + + if (pathToFileURL) { + let fileURL = pathToFileURL(path).toString() + this.memoizedFileURLs.set(path, fileURL) + + return fileURL + } else { + throw new Error( + '`map.absolute` option is not available in this PostCSS build' + ) + } + } + + toUrl(path) { + let cached = this.memoizedURLs.get(path) + if (cached) return cached + + if (sep === '\\') { + path = path.replace(/\\/g, '/') + } + + let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent) + this.memoizedURLs.set(path, url) + + return url + } +} + +module.exports = MapGenerator diff --git a/node_modules/postcss/lib/no-work-result.d.ts b/node_modules/postcss/lib/no-work-result.d.ts new file mode 100644 index 00000000..80390765 --- /dev/null +++ b/node_modules/postcss/lib/no-work-result.d.ts @@ -0,0 +1,46 @@ +import LazyResult from './lazy-result.js' +import { SourceMap } from './postcss.js' +import Processor from './processor.js' +import Result, { Message, ResultOptions } from './result.js' +import Root from './root.js' +import Warning from './warning.js' + +declare namespace NoWorkResult { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { NoWorkResult_ as default } +} + +/** + * A Promise proxy for the result of PostCSS transformations. + * This lazy result instance doesn't parse css unless `NoWorkResult#root` or `Result#root` + * are accessed. See the example below for details. + * A `NoWork` instance is returned by `Processor#process` ONLY when no plugins defined. + * + * ```js + * const noWorkResult = postcss().process(css) // No plugins are defined. + * // CSS is not parsed + * let root = noWorkResult.root // now css is parsed because we accessed the root + * ``` + */ +declare class NoWorkResult_ implements LazyResult { + catch: Promise>['catch'] + finally: Promise>['finally'] + then: Promise>['then'] + constructor(processor: Processor, css: string, opts: ResultOptions) + async(): Promise> + sync(): Result + toString(): string + warnings(): Warning[] + get content(): string + get css(): string + get map(): SourceMap + get messages(): Message[] + get opts(): ResultOptions + get processor(): Processor + get root(): Root + get [Symbol.toStringTag](): string +} + +declare class NoWorkResult extends NoWorkResult_ {} + +export = NoWorkResult diff --git a/node_modules/postcss/lib/no-work-result.js b/node_modules/postcss/lib/no-work-result.js new file mode 100644 index 00000000..a84d8438 --- /dev/null +++ b/node_modules/postcss/lib/no-work-result.js @@ -0,0 +1,138 @@ +'use strict' + +let MapGenerator = require('./map-generator') +let parse = require('./parse') +const Result = require('./result') +let stringify = require('./stringify') +let warnOnce = require('./warn-once') + +class NoWorkResult { + constructor(processor, css, opts) { + css = css.toString() + this.stringified = false + + this._processor = processor + this._css = css + this._opts = opts + this._map = undefined + let root + + let str = stringify + this.result = new Result(this._processor, root, this._opts) + this.result.css = css + + let self = this + Object.defineProperty(this.result, 'root', { + get() { + return self.root + } + }) + + let map = new MapGenerator(str, root, this._opts, css) + if (map.isMap()) { + let [generatedCSS, generatedMap] = map.generate() + if (generatedCSS) { + this.result.css = generatedCSS + } + if (generatedMap) { + this.result.map = generatedMap + } + } else { + map.clearAnnotation() + this.result.css = map.css + } + } + + async() { + if (this.error) return Promise.reject(this.error) + return Promise.resolve(this.result) + } + + catch(onRejected) { + return this.async().catch(onRejected) + } + + finally(onFinally) { + return this.async().then(onFinally, onFinally) + } + + sync() { + if (this.error) throw this.error + return this.result + } + + then(onFulfilled, onRejected) { + if (process.env.NODE_ENV !== 'production') { + if (!('from' in this._opts)) { + warnOnce( + 'Without `from` option PostCSS could generate wrong source map ' + + 'and will not find Browserslist config. Set it to CSS file path ' + + 'or to `undefined` to prevent this warning.' + ) + } + } + + return this.async().then(onFulfilled, onRejected) + } + + toString() { + return this._css + } + + warnings() { + return [] + } + + get content() { + return this.result.css + } + + get css() { + return this.result.css + } + + get map() { + return this.result.map + } + + get messages() { + return [] + } + + get opts() { + return this.result.opts + } + + get processor() { + return this.result.processor + } + + get root() { + if (this._root) { + return this._root + } + + let root + let parser = parse + + try { + root = parser(this._css, this._opts) + } catch (error) { + this.error = error + } + + if (this.error) { + throw this.error + } else { + this._root = root + return root + } + } + + get [Symbol.toStringTag]() { + return 'NoWorkResult' + } +} + +module.exports = NoWorkResult +NoWorkResult.default = NoWorkResult diff --git a/node_modules/postcss/lib/node.d.ts b/node_modules/postcss/lib/node.d.ts new file mode 100644 index 00000000..35976702 --- /dev/null +++ b/node_modules/postcss/lib/node.d.ts @@ -0,0 +1,541 @@ +import AtRule = require('./at-rule.js') + +import { AtRuleProps } from './at-rule.js' +import Comment, { CommentProps } from './comment.js' +import Container, { NewChild } from './container.js' +import CssSyntaxError from './css-syntax-error.js' +import Declaration, { DeclarationProps } from './declaration.js' +import Document from './document.js' +import Input from './input.js' +import { Stringifier, Syntax } from './postcss.js' +import Result from './result.js' +import Root from './root.js' +import Rule, { RuleProps } from './rule.js' +import Warning, { WarningOptions } from './warning.js' + +declare namespace Node { + export type ChildNode = AtRule.default | Comment | Declaration | Rule + + export type AnyNode = + | AtRule.default + | Comment + | Declaration + | Document + | Root + | Rule + + export type ChildProps = + | AtRuleProps + | CommentProps + | DeclarationProps + | RuleProps + + export interface Position { + /** + * Source line in file. In contrast to `offset` it starts from 1. + */ + column: number + + /** + * Source column in file. + */ + line: number + + /** + * Source offset in file. It starts from 0. + */ + offset: number + } + + export interface Range { + /** + * End position, exclusive. + */ + end: Position + + /** + * Start position, inclusive. + */ + start: Position + } + + /** + * Source represents an interface for the {@link Node.source} property. + */ + export interface Source { + /** + * The inclusive ending position for the source + * code of a node. + */ + end?: Position + + /** + * The source file from where a node has originated. + */ + input: Input + + /** + * The inclusive starting position for the source + * code of a node. + */ + start?: Position + } + + /** + * Interface represents an interface for an object received + * as parameter by Node class constructor. + */ + export interface NodeProps { + source?: Source + } + + export interface NodeErrorOptions { + /** + * An ending index inside a node's string that should be highlighted as + * source of error. + */ + endIndex?: number + /** + * An index inside a node's string that should be highlighted as source + * of error. + */ + index?: number + /** + * Plugin name that created this error. PostCSS will set it automatically. + */ + plugin?: string + /** + * A word inside a node's string, that should be highlighted as source + * of error. + */ + word?: string + } + + // eslint-disable-next-line @typescript-eslint/no-shadow + class Node extends Node_ {} + export { Node as default } +} + +/** + * It represents an abstract class that handles common + * methods for other CSS abstract syntax tree nodes. + * + * Any node that represents CSS selector or value should + * not extend the `Node` class. + */ +declare abstract class Node_ { + /** + * It represents parent of the current node. + * + * ```js + * root.nodes[0].parent === root //=> true + * ``` + */ + parent: Container | Document | undefined + + /** + * It represents unnecessary whitespace and characters present + * in the css source code. + * + * Information to generate byte-to-byte equal node string as it was + * in the origin input. + * + * The properties of the raws object are decided by parser, + * the default parser uses the following properties: + * + * * `before`: the space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + * * `after`: the space symbols after the last child of the node + * to the end of the node. + * * `between`: the symbols between the property and value + * for declarations, selector and `{` for rules, or last parameter + * and `{` for at-rules. + * * `semicolon`: contains true if the last child has + * an (optional) semicolon. + * * `afterName`: the space between the at-rule name and its parameters. + * * `left`: the space symbols between `/*` and the comment’s text. + * * `right`: the space symbols between the comment’s text + * and */. + * - `important`: the content of the important statement, + * if it is not just `!important`. + * + * PostCSS filters out the comments inside selectors, declaration values + * and at-rule parameters but it stores the origin content in raws. + * + * ```js + * const root = postcss.parse('a {\n color:black\n}') + * root.first.first.raws //=> { before: '\n ', between: ':' } + * ``` + */ + raws: any + + /** + * It represents information related to origin of a node and is required + * for generating source maps. + * + * The nodes that are created manually using the public APIs + * provided by PostCSS will have `source` undefined and + * will be absent in the source map. + * + * For this reason, the plugin developer should consider + * duplicating nodes as the duplicate node will have the + * same source as the original node by default or assign + * source to a node created manually. + * + * ```js + * decl.source.input.from //=> '/home/ai/source.css' + * decl.source.start //=> { line: 10, column: 2 } + * decl.source.end //=> { line: 10, column: 12 } + * ``` + * + * ```js + * // Incorrect method, source not specified! + * const prefixed = postcss.decl({ + * prop: '-moz-' + decl.prop, + * value: decl.value + * }) + * + * // Correct method, source is inherited when duplicating. + * const prefixed = decl.clone({ + * prop: '-moz-' + decl.prop + * }) + * ``` + * + * ```js + * if (atrule.name === 'add-link') { + * const rule = postcss.rule({ + * selector: 'a', + * source: atrule.source + * }) + * + * atrule.parent.insertBefore(atrule, rule) + * } + * ``` + */ + source?: Node.Source + + /** + * It represents type of a node in + * an abstract syntax tree. + * + * A type of node helps in identification of a node + * and perform operation based on it's type. + * + * ```js + * const declaration = new Declaration({ + * prop: 'color', + * value: 'black' + * }) + * + * declaration.type //=> 'decl' + * ``` + */ + type: string + + constructor(defaults?: object) + + /** + * If this node isn't already dirty, marks it and its ancestors as such. This + * indicates to the LazyResult processor that the {@link Root} has been + * modified by the current plugin and may need to be processed again by other + * plugins. + */ + protected markDirty(): void + + /** + * Insert new node after current node to current node’s parent. + * + * Just alias for `node.parent.insertAfter(node, add)`. + * + * ```js + * decl.after('color: black') + * ``` + * + * @param newNode New node. + * @return This node for methods chain. + */ + after( + newNode: Node | Node.ChildProps | readonly Node[] | string | undefined + ): this + + /** + * It assigns properties to an existing node instance. + * + * ```js + * decl.assign({ prop: 'word-wrap', value: 'break-word' }) + * ``` + * + * @param overrides New properties to override the node. + * + * @return `this` for method chaining. + */ + assign(overrides: object): this + + /** + * Insert new node before current node to current node’s parent. + * + * Just alias for `node.parent.insertBefore(node, add)`. + * + * ```js + * decl.before('content: ""') + * ``` + * + * @param newNode New node. + * @return This node for methods chain. + */ + before( + newNode: Node | Node.ChildProps | readonly Node[] | string | undefined + ): this + + /** + * Clear the code style properties for the node and its children. + * + * ```js + * node.raws.before //=> ' ' + * node.cleanRaws() + * node.raws.before //=> undefined + * ``` + * + * @param keepBetween Keep the `raws.between` symbols. + */ + cleanRaws(keepBetween?: boolean): void + + /** + * It creates clone of an existing node, which includes all the properties + * and their values, that includes `raws` but not `type`. + * + * ```js + * decl.raws.before //=> "\n " + * const cloned = decl.clone({ prop: '-moz-' + decl.prop }) + * cloned.raws.before //=> "\n " + * cloned.toString() //=> -moz-transform: scale(0) + * ``` + * + * @param overrides New properties to override in the clone. + * + * @return Duplicate of the node instance. + */ + clone(overrides?: object): this + + /** + * Shortcut to clone the node and insert the resulting cloned node + * after the current node. + * + * @param overrides New properties to override in the clone. + * @return New node. + */ + cloneAfter(overrides?: object): this + + /** + * Shortcut to clone the node and insert the resulting cloned node + * before the current node. + * + * ```js + * decl.cloneBefore({ prop: '-moz-' + decl.prop }) + * ``` + * + * @param overrides Mew properties to override in the clone. + * + * @return New node + */ + cloneBefore(overrides?: object): this + + /** + * It creates an instance of the class `CssSyntaxError` and parameters passed + * to this method are assigned to the error instance. + * + * The error instance will have description for the + * error, original position of the node in the + * source, showing line and column number. + * + * If any previous map is present, it would be used + * to get original position of the source. + * + * The Previous Map here is referred to the source map + * generated by previous compilation, example: Less, + * Stylus and Sass. + * + * This method returns the error instance instead of + * throwing it. + * + * ```js + * if (!variables[name]) { + * throw decl.error(`Unknown variable ${name}`, { word: name }) + * // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black + * // color: $black + * // a + * // ^ + * // background: white + * } + * ``` + * + * @param message Description for the error instance. + * @param options Options for the error instance. + * + * @return Error instance is returned. + */ + error(message: string, options?: Node.NodeErrorOptions): CssSyntaxError + + /** + * Returns the next child of the node’s parent. + * Returns `undefined` if the current node is the last child. + * + * ```js + * if (comment.text === 'delete next') { + * const next = comment.next() + * if (next) { + * next.remove() + * } + * } + * ``` + * + * @return Next node. + */ + next(): Node.ChildNode | undefined + + /** + * Get the position for a word or an index inside the node. + * + * @param opts Options. + * @return Position. + */ + positionBy(opts?: Pick): Node.Position + + /** + * Convert string index to line/column. + * + * @param index The symbol number in the node’s string. + * @return Symbol position in file. + */ + positionInside(index: number): Node.Position + + /** + * Returns the previous child of the node’s parent. + * Returns `undefined` if the current node is the first child. + * + * ```js + * const annotation = decl.prev() + * if (annotation.type === 'comment') { + * readAnnotation(annotation.text) + * } + * ``` + * + * @return Previous node. + */ + prev(): Node.ChildNode | undefined + + /** + * Get the range for a word or start and end index inside the node. + * The start index is inclusive; the end index is exclusive. + * + * @param opts Options. + * @return Range. + */ + rangeBy( + opts?: Pick + ): Node.Range + + /** + * Returns a `raws` value. If the node is missing + * the code style property (because the node was manually built or cloned), + * PostCSS will try to autodetect the code style property by looking + * at other nodes in the tree. + * + * ```js + * const root = postcss.parse('a { background: white }') + * root.nodes[0].append({ prop: 'color', value: 'black' }) + * root.nodes[0].nodes[1].raws.before //=> undefined + * root.nodes[0].nodes[1].raw('before') //=> ' ' + * ``` + * + * @param prop Name of code style property. + * @param defaultType Name of default value, it can be missed + * if the value is the same as prop. + * @return {string} Code style value. + */ + raw(prop: string, defaultType?: string): string + + /** + * It removes the node from its parent and deletes its parent property. + * + * ```js + * if (decl.prop.match(/^-webkit-/)) { + * decl.remove() + * } + * ``` + * + * @return `this` for method chaining. + */ + remove(): this + + /** + * Inserts node(s) before the current node and removes the current node. + * + * ```js + * AtRule: { + * mixin: atrule => { + * atrule.replaceWith(mixinRules[atrule.params]) + * } + * } + * ``` + * + * @param nodes Mode(s) to replace current one. + * @return Current node to methods chain. + */ + replaceWith(...nodes: NewChild[]): this + + /** + * Finds the Root instance of the node’s tree. + * + * ```js + * root.nodes[0].nodes[0].root() === root + * ``` + * + * @return Root parent. + */ + root(): Root + + /** + * Fix circular links on `JSON.stringify()`. + * + * @return Cleaned object. + */ + toJSON(): object + + /** + * It compiles the node to browser readable cascading style sheets string + * depending on it's type. + * + * ```js + * new Rule({ selector: 'a' }).toString() //=> "a {}" + * ``` + * + * @param stringifier A syntax to use in string generation. + * @return CSS string of this node. + */ + toString(stringifier?: Stringifier | Syntax): string + + /** + * It is a wrapper for {@link Result#warn}, providing convenient + * way of generating warnings. + * + * ```js + * Declaration: { + * bad: (decl, { result }) => { + * decl.warn(result, 'Deprecated property: bad') + * } + * } + * ``` + * + * @param result The `Result` instance that will receive the warning. + * @param message Description for the warning. + * @param options Options for the warning. + * + * @return `Warning` instance is returned + */ + warn(result: Result, message: string, options?: WarningOptions): Warning +} + +declare class Node extends Node_ {} + +export = Node diff --git a/node_modules/postcss/lib/node.js b/node_modules/postcss/lib/node.js new file mode 100644 index 00000000..9949be78 --- /dev/null +++ b/node_modules/postcss/lib/node.js @@ -0,0 +1,425 @@ +'use strict' + +let CssSyntaxError = require('./css-syntax-error') +let Stringifier = require('./stringifier') +let stringify = require('./stringify') +let { isClean, my } = require('./symbols') + +function cloneNode(obj, parent) { + let cloned = new obj.constructor() + + for (let i in obj) { + if (!Object.prototype.hasOwnProperty.call(obj, i)) { + /* c8 ignore next 2 */ + continue + } + if (i === 'proxyCache') continue + let value = obj[i] + let type = typeof value + + if (i === 'parent' && type === 'object') { + if (parent) cloned[i] = parent + } else if (i === 'source') { + cloned[i] = value + } else if (Array.isArray(value)) { + cloned[i] = value.map(j => cloneNode(j, cloned)) + } else { + if (type === 'object' && value !== null) value = cloneNode(value) + cloned[i] = value + } + } + + return cloned +} + +function sourceOffset(inputCSS, position) { + // Not all custom syntaxes support `offset` in `source.start` and `source.end` + if ( + position && + typeof position.offset !== 'undefined' + ) { + return position.offset; + } + + let column = 1 + let line = 1 + let offset = 0 + + for (let i = 0; i < inputCSS.length; i++) { + if (line === position.line && column === position.column) { + offset = i + break + } + + if (inputCSS[i] === '\n') { + column = 1 + line += 1 + } else { + column += 1 + } + } + + return offset +} + +class Node { + constructor(defaults = {}) { + this.raws = {} + this[isClean] = false + this[my] = true + + for (let name in defaults) { + if (name === 'nodes') { + this.nodes = [] + for (let node of defaults[name]) { + if (typeof node.clone === 'function') { + this.append(node.clone()) + } else { + this.append(node) + } + } + } else { + this[name] = defaults[name] + } + } + } + + addToError(error) { + error.postcssNode = this + if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) { + let s = this.source + error.stack = error.stack.replace( + /\n\s{4}at /, + `$&${s.input.from}:${s.start.line}:${s.start.column}$&` + ) + } + return error + } + + after(add) { + this.parent.insertAfter(this, add) + return this + } + + assign(overrides = {}) { + for (let name in overrides) { + this[name] = overrides[name] + } + return this + } + + before(add) { + this.parent.insertBefore(this, add) + return this + } + + cleanRaws(keepBetween) { + delete this.raws.before + delete this.raws.after + if (!keepBetween) delete this.raws.between + } + + clone(overrides = {}) { + let cloned = cloneNode(this) + for (let name in overrides) { + cloned[name] = overrides[name] + } + return cloned + } + + cloneAfter(overrides = {}) { + let cloned = this.clone(overrides) + this.parent.insertAfter(this, cloned) + return cloned + } + + cloneBefore(overrides = {}) { + let cloned = this.clone(overrides) + this.parent.insertBefore(this, cloned) + return cloned + } + + error(message, opts = {}) { + if (this.source) { + let { end, start } = this.rangeBy(opts) + return this.source.input.error( + message, + { column: start.column, line: start.line }, + { column: end.column, line: end.line }, + opts + ) + } + return new CssSyntaxError(message) + } + + getProxyProcessor() { + return { + get(node, prop) { + if (prop === 'proxyOf') { + return node + } else if (prop === 'root') { + return () => node.root().toProxy() + } else { + return node[prop] + } + }, + + set(node, prop, value) { + if (node[prop] === value) return true + node[prop] = value + if ( + prop === 'prop' || + prop === 'value' || + prop === 'name' || + prop === 'params' || + prop === 'important' || + /* c8 ignore next */ + prop === 'text' + ) { + node.markDirty() + } + return true + } + } + } + + /* c8 ignore next 3 */ + markClean() { + this[isClean] = true + } + + markDirty() { + if (this[isClean]) { + this[isClean] = false + let next = this + while ((next = next.parent)) { + next[isClean] = false + } + } + } + + next() { + if (!this.parent) return undefined + let index = this.parent.index(this) + return this.parent.nodes[index + 1] + } + + positionBy(opts) { + let pos = this.source.start + if (opts.index) { + pos = this.positionInside(opts.index) + } else if (opts.word) { + let stringRepresentation = this.source.input.css.slice( + sourceOffset(this.source.input.css, this.source.start), + sourceOffset(this.source.input.css, this.source.end) + ) + let index = stringRepresentation.indexOf(opts.word) + if (index !== -1) pos = this.positionInside(index) + } + return pos + } + + positionInside(index) { + let column = this.source.start.column + let line = this.source.start.line + let offset = sourceOffset(this.source.input.css, this.source.start) + let end = offset + index + + for (let i = offset; i < end; i++) { + if (this.source.input.css[i] === '\n') { + column = 1 + line += 1 + } else { + column += 1 + } + } + + return { column, line } + } + + prev() { + if (!this.parent) return undefined + let index = this.parent.index(this) + return this.parent.nodes[index - 1] + } + + rangeBy(opts) { + let start = { + column: this.source.start.column, + line: this.source.start.line + } + let end = this.source.end + ? { + column: this.source.end.column + 1, + line: this.source.end.line + } + : { + column: start.column + 1, + line: start.line + } + + if (opts.word) { + let stringRepresentation = this.source.input.css.slice( + sourceOffset(this.source.input.css, this.source.start), + sourceOffset(this.source.input.css, this.source.end) + ) + let index = stringRepresentation.indexOf(opts.word) + if (index !== -1) { + start = this.positionInside(index) + end = this.positionInside( + index + opts.word.length, + ) + } + } else { + if (opts.start) { + start = { + column: opts.start.column, + line: opts.start.line + } + } else if (opts.index) { + start = this.positionInside(opts.index) + } + + if (opts.end) { + end = { + column: opts.end.column, + line: opts.end.line + } + } else if (typeof opts.endIndex === 'number') { + end = this.positionInside(opts.endIndex) + } else if (opts.index) { + end = this.positionInside(opts.index + 1) + } + } + + if ( + end.line < start.line || + (end.line === start.line && end.column <= start.column) + ) { + end = { column: start.column + 1, line: start.line } + } + + return { end, start } + } + + raw(prop, defaultType) { + let str = new Stringifier() + return str.raw(this, prop, defaultType) + } + + remove() { + if (this.parent) { + this.parent.removeChild(this) + } + this.parent = undefined + return this + } + + replaceWith(...nodes) { + if (this.parent) { + let bookmark = this + let foundSelf = false + for (let node of nodes) { + if (node === this) { + foundSelf = true + } else if (foundSelf) { + this.parent.insertAfter(bookmark, node) + bookmark = node + } else { + this.parent.insertBefore(bookmark, node) + } + } + + if (!foundSelf) { + this.remove() + } + } + + return this + } + + root() { + let result = this + while (result.parent && result.parent.type !== 'document') { + result = result.parent + } + return result + } + + toJSON(_, inputs) { + let fixed = {} + let emitInputs = inputs == null + inputs = inputs || new Map() + let inputsNextIndex = 0 + + for (let name in this) { + if (!Object.prototype.hasOwnProperty.call(this, name)) { + /* c8 ignore next 2 */ + continue + } + if (name === 'parent' || name === 'proxyCache') continue + let value = this[name] + + if (Array.isArray(value)) { + fixed[name] = value.map(i => { + if (typeof i === 'object' && i.toJSON) { + return i.toJSON(null, inputs) + } else { + return i + } + }) + } else if (typeof value === 'object' && value.toJSON) { + fixed[name] = value.toJSON(null, inputs) + } else if (name === 'source') { + let inputId = inputs.get(value.input) + if (inputId == null) { + inputId = inputsNextIndex + inputs.set(value.input, inputsNextIndex) + inputsNextIndex++ + } + fixed[name] = { + end: value.end, + inputId, + start: value.start + } + } else { + fixed[name] = value + } + } + + if (emitInputs) { + fixed.inputs = [...inputs.keys()].map(input => input.toJSON()) + } + + return fixed + } + + toProxy() { + if (!this.proxyCache) { + this.proxyCache = new Proxy(this, this.getProxyProcessor()) + } + return this.proxyCache + } + + toString(stringifier = stringify) { + if (stringifier.stringify) stringifier = stringifier.stringify + let result = '' + stringifier(this, i => { + result += i + }) + return result + } + + warn(result, text, opts) { + let data = { node: this } + for (let i in opts) data[i] = opts[i] + return result.warn(text, data) + } + + get proxyOf() { + return this + } +} + +module.exports = Node +Node.default = Node diff --git a/node_modules/postcss/lib/parse.d.ts b/node_modules/postcss/lib/parse.d.ts new file mode 100644 index 00000000..4c943a4d --- /dev/null +++ b/node_modules/postcss/lib/parse.d.ts @@ -0,0 +1,9 @@ +import { Parser } from './postcss.js' + +interface Parse extends Parser { + default: Parse +} + +declare const parse: Parse + +export = parse diff --git a/node_modules/postcss/lib/parse.js b/node_modules/postcss/lib/parse.js new file mode 100644 index 00000000..00a1037a --- /dev/null +++ b/node_modules/postcss/lib/parse.js @@ -0,0 +1,42 @@ +'use strict' + +let Container = require('./container') +let Input = require('./input') +let Parser = require('./parser') + +function parse(css, opts) { + let input = new Input(css, opts) + let parser = new Parser(input) + try { + parser.parse() + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + if (e.name === 'CssSyntaxError' && opts && opts.from) { + if (/\.scss$/i.test(opts.from)) { + e.message += + '\nYou tried to parse SCSS with ' + + 'the standard CSS parser; ' + + 'try again with the postcss-scss parser' + } else if (/\.sass/i.test(opts.from)) { + e.message += + '\nYou tried to parse Sass with ' + + 'the standard CSS parser; ' + + 'try again with the postcss-sass parser' + } else if (/\.less$/i.test(opts.from)) { + e.message += + '\nYou tried to parse Less with ' + + 'the standard CSS parser; ' + + 'try again with the postcss-less parser' + } + } + } + throw e + } + + return parser.root +} + +module.exports = parse +parse.default = parse + +Container.registerParse(parse) diff --git a/node_modules/postcss/lib/parser.js b/node_modules/postcss/lib/parser.js new file mode 100644 index 00000000..8a044117 --- /dev/null +++ b/node_modules/postcss/lib/parser.js @@ -0,0 +1,609 @@ +'use strict' + +let AtRule = require('./at-rule') +let Comment = require('./comment') +let Declaration = require('./declaration') +let Root = require('./root') +let Rule = require('./rule') +let tokenizer = require('./tokenize') + +const SAFE_COMMENT_NEIGHBOR = { + empty: true, + space: true +} + +function findLastWithPosition(tokens) { + for (let i = tokens.length - 1; i >= 0; i--) { + let token = tokens[i] + let pos = token[3] || token[2] + if (pos) return pos + } +} + +class Parser { + constructor(input) { + this.input = input + + this.root = new Root() + this.current = this.root + this.spaces = '' + this.semicolon = false + + this.createTokenizer() + this.root.source = { input, start: { column: 1, line: 1, offset: 0 } } + } + + atrule(token) { + let node = new AtRule() + node.name = token[1].slice(1) + if (node.name === '') { + this.unnamedAtrule(node, token) + } + this.init(node, token[2]) + + let type + let prev + let shift + let last = false + let open = false + let params = [] + let brackets = [] + + while (!this.tokenizer.endOfFile()) { + token = this.tokenizer.nextToken() + type = token[0] + + if (type === '(' || type === '[') { + brackets.push(type === '(' ? ')' : ']') + } else if (type === '{' && brackets.length > 0) { + brackets.push('}') + } else if (type === brackets[brackets.length - 1]) { + brackets.pop() + } + + if (brackets.length === 0) { + if (type === ';') { + node.source.end = this.getPosition(token[2]) + node.source.end.offset++ + this.semicolon = true + break + } else if (type === '{') { + open = true + break + } else if (type === '}') { + if (params.length > 0) { + shift = params.length - 1 + prev = params[shift] + while (prev && prev[0] === 'space') { + prev = params[--shift] + } + if (prev) { + node.source.end = this.getPosition(prev[3] || prev[2]) + node.source.end.offset++ + } + } + this.end(token) + break + } else { + params.push(token) + } + } else { + params.push(token) + } + + if (this.tokenizer.endOfFile()) { + last = true + break + } + } + + node.raws.between = this.spacesAndCommentsFromEnd(params) + if (params.length) { + node.raws.afterName = this.spacesAndCommentsFromStart(params) + this.raw(node, 'params', params) + if (last) { + token = params[params.length - 1] + node.source.end = this.getPosition(token[3] || token[2]) + node.source.end.offset++ + this.spaces = node.raws.between + node.raws.between = '' + } + } else { + node.raws.afterName = '' + node.params = '' + } + + if (open) { + node.nodes = [] + this.current = node + } + } + + checkMissedSemicolon(tokens) { + let colon = this.colon(tokens) + if (colon === false) return + + let founded = 0 + let token + for (let j = colon - 1; j >= 0; j--) { + token = tokens[j] + if (token[0] !== 'space') { + founded += 1 + if (founded === 2) break + } + } + // If the token is a word, e.g. `!important`, `red` or any other valid property's value. + // Then we need to return the colon after that word token. [3] is the "end" colon of that word. + // And because we need it after that one we do +1 to get the next one. + throw this.input.error( + 'Missed semicolon', + token[0] === 'word' ? token[3] + 1 : token[2] + ) + } + + colon(tokens) { + let brackets = 0 + let prev, token, type + for (let [i, element] of tokens.entries()) { + token = element + type = token[0] + + if (type === '(') { + brackets += 1 + } + if (type === ')') { + brackets -= 1 + } + if (brackets === 0 && type === ':') { + if (!prev) { + this.doubleColon(token) + } else if (prev[0] === 'word' && prev[1] === 'progid') { + continue + } else { + return i + } + } + + prev = token + } + return false + } + + comment(token) { + let node = new Comment() + this.init(node, token[2]) + node.source.end = this.getPosition(token[3] || token[2]) + node.source.end.offset++ + + let text = token[1].slice(2, -2) + if (/^\s*$/.test(text)) { + node.text = '' + node.raws.left = text + node.raws.right = '' + } else { + let match = text.match(/^(\s*)([^]*\S)(\s*)$/) + node.text = match[2] + node.raws.left = match[1] + node.raws.right = match[3] + } + } + + createTokenizer() { + this.tokenizer = tokenizer(this.input) + } + + decl(tokens, customProperty) { + let node = new Declaration() + this.init(node, tokens[0][2]) + + let last = tokens[tokens.length - 1] + if (last[0] === ';') { + this.semicolon = true + tokens.pop() + } + + node.source.end = this.getPosition( + last[3] || last[2] || findLastWithPosition(tokens) + ) + node.source.end.offset++ + + while (tokens[0][0] !== 'word') { + if (tokens.length === 1) this.unknownWord(tokens) + node.raws.before += tokens.shift()[1] + } + node.source.start = this.getPosition(tokens[0][2]) + + node.prop = '' + while (tokens.length) { + let type = tokens[0][0] + if (type === ':' || type === 'space' || type === 'comment') { + break + } + node.prop += tokens.shift()[1] + } + + node.raws.between = '' + + let token + while (tokens.length) { + token = tokens.shift() + + if (token[0] === ':') { + node.raws.between += token[1] + break + } else { + if (token[0] === 'word' && /\w/.test(token[1])) { + this.unknownWord([token]) + } + node.raws.between += token[1] + } + } + + if (node.prop[0] === '_' || node.prop[0] === '*') { + node.raws.before += node.prop[0] + node.prop = node.prop.slice(1) + } + + let firstSpaces = [] + let next + while (tokens.length) { + next = tokens[0][0] + if (next !== 'space' && next !== 'comment') break + firstSpaces.push(tokens.shift()) + } + + this.precheckMissedSemicolon(tokens) + + for (let i = tokens.length - 1; i >= 0; i--) { + token = tokens[i] + if (token[1].toLowerCase() === '!important') { + node.important = true + let string = this.stringFrom(tokens, i) + string = this.spacesFromEnd(tokens) + string + if (string !== ' !important') node.raws.important = string + break + } else if (token[1].toLowerCase() === 'important') { + let cache = tokens.slice(0) + let str = '' + for (let j = i; j > 0; j--) { + let type = cache[j][0] + if (str.trim().startsWith('!') && type !== 'space') { + break + } + str = cache.pop()[1] + str + } + if (str.trim().startsWith('!')) { + node.important = true + node.raws.important = str + tokens = cache + } + } + + if (token[0] !== 'space' && token[0] !== 'comment') { + break + } + } + + let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment') + + if (hasWord) { + node.raws.between += firstSpaces.map(i => i[1]).join('') + firstSpaces = [] + } + this.raw(node, 'value', firstSpaces.concat(tokens), customProperty) + + if (node.value.includes(':') && !customProperty) { + this.checkMissedSemicolon(tokens) + } + } + + doubleColon(token) { + throw this.input.error( + 'Double colon', + { offset: token[2] }, + { offset: token[2] + token[1].length } + ) + } + + emptyRule(token) { + let node = new Rule() + this.init(node, token[2]) + node.selector = '' + node.raws.between = '' + this.current = node + } + + end(token) { + if (this.current.nodes && this.current.nodes.length) { + this.current.raws.semicolon = this.semicolon + } + this.semicolon = false + + this.current.raws.after = (this.current.raws.after || '') + this.spaces + this.spaces = '' + + if (this.current.parent) { + this.current.source.end = this.getPosition(token[2]) + this.current.source.end.offset++ + this.current = this.current.parent + } else { + this.unexpectedClose(token) + } + } + + endFile() { + if (this.current.parent) this.unclosedBlock() + if (this.current.nodes && this.current.nodes.length) { + this.current.raws.semicolon = this.semicolon + } + this.current.raws.after = (this.current.raws.after || '') + this.spaces + this.root.source.end = this.getPosition(this.tokenizer.position()) + } + + freeSemicolon(token) { + this.spaces += token[1] + if (this.current.nodes) { + let prev = this.current.nodes[this.current.nodes.length - 1] + if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) { + prev.raws.ownSemicolon = this.spaces + this.spaces = '' + } + } + } + + // Helpers + + getPosition(offset) { + let pos = this.input.fromOffset(offset) + return { + column: pos.col, + line: pos.line, + offset + } + } + + init(node, offset) { + this.current.push(node) + node.source = { + input: this.input, + start: this.getPosition(offset) + } + node.raws.before = this.spaces + this.spaces = '' + if (node.type !== 'comment') this.semicolon = false + } + + other(start) { + let end = false + let type = null + let colon = false + let bracket = null + let brackets = [] + let customProperty = start[1].startsWith('--') + + let tokens = [] + let token = start + while (token) { + type = token[0] + tokens.push(token) + + if (type === '(' || type === '[') { + if (!bracket) bracket = token + brackets.push(type === '(' ? ')' : ']') + } else if (customProperty && colon && type === '{') { + if (!bracket) bracket = token + brackets.push('}') + } else if (brackets.length === 0) { + if (type === ';') { + if (colon) { + this.decl(tokens, customProperty) + return + } else { + break + } + } else if (type === '{') { + this.rule(tokens) + return + } else if (type === '}') { + this.tokenizer.back(tokens.pop()) + end = true + break + } else if (type === ':') { + colon = true + } + } else if (type === brackets[brackets.length - 1]) { + brackets.pop() + if (brackets.length === 0) bracket = null + } + + token = this.tokenizer.nextToken() + } + + if (this.tokenizer.endOfFile()) end = true + if (brackets.length > 0) this.unclosedBracket(bracket) + + if (end && colon) { + if (!customProperty) { + while (tokens.length) { + token = tokens[tokens.length - 1][0] + if (token !== 'space' && token !== 'comment') break + this.tokenizer.back(tokens.pop()) + } + } + this.decl(tokens, customProperty) + } else { + this.unknownWord(tokens) + } + } + + parse() { + let token + while (!this.tokenizer.endOfFile()) { + token = this.tokenizer.nextToken() + + switch (token[0]) { + case 'space': + this.spaces += token[1] + break + + case ';': + this.freeSemicolon(token) + break + + case '}': + this.end(token) + break + + case 'comment': + this.comment(token) + break + + case 'at-word': + this.atrule(token) + break + + case '{': + this.emptyRule(token) + break + + default: + this.other(token) + break + } + } + this.endFile() + } + + precheckMissedSemicolon(/* tokens */) { + // Hook for Safe Parser + } + + raw(node, prop, tokens, customProperty) { + let token, type + let length = tokens.length + let value = '' + let clean = true + let next, prev + + for (let i = 0; i < length; i += 1) { + token = tokens[i] + type = token[0] + if (type === 'space' && i === length - 1 && !customProperty) { + clean = false + } else if (type === 'comment') { + prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty' + next = tokens[i + 1] ? tokens[i + 1][0] : 'empty' + if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) { + if (value.slice(-1) === ',') { + clean = false + } else { + value += token[1] + } + } else { + clean = false + } + } else { + value += token[1] + } + } + if (!clean) { + let raw = tokens.reduce((all, i) => all + i[1], '') + node.raws[prop] = { raw, value } + } + node[prop] = value + } + + rule(tokens) { + tokens.pop() + + let node = new Rule() + this.init(node, tokens[0][2]) + + node.raws.between = this.spacesAndCommentsFromEnd(tokens) + this.raw(node, 'selector', tokens) + this.current = node + } + + spacesAndCommentsFromEnd(tokens) { + let lastTokenType + let spaces = '' + while (tokens.length) { + lastTokenType = tokens[tokens.length - 1][0] + if (lastTokenType !== 'space' && lastTokenType !== 'comment') break + spaces = tokens.pop()[1] + spaces + } + return spaces + } + + // Errors + + spacesAndCommentsFromStart(tokens) { + let next + let spaces = '' + while (tokens.length) { + next = tokens[0][0] + if (next !== 'space' && next !== 'comment') break + spaces += tokens.shift()[1] + } + return spaces + } + + spacesFromEnd(tokens) { + let lastTokenType + let spaces = '' + while (tokens.length) { + lastTokenType = tokens[tokens.length - 1][0] + if (lastTokenType !== 'space') break + spaces = tokens.pop()[1] + spaces + } + return spaces + } + + stringFrom(tokens, from) { + let result = '' + for (let i = from; i < tokens.length; i++) { + result += tokens[i][1] + } + tokens.splice(from, tokens.length - from) + return result + } + + unclosedBlock() { + let pos = this.current.source.start + throw this.input.error('Unclosed block', pos.line, pos.column) + } + + unclosedBracket(bracket) { + throw this.input.error( + 'Unclosed bracket', + { offset: bracket[2] }, + { offset: bracket[2] + 1 } + ) + } + + unexpectedClose(token) { + throw this.input.error( + 'Unexpected }', + { offset: token[2] }, + { offset: token[2] + 1 } + ) + } + + unknownWord(tokens) { + throw this.input.error( + 'Unknown word', + { offset: tokens[0][2] }, + { offset: tokens[0][2] + tokens[0][1].length } + ) + } + + unnamedAtrule(node, token) { + throw this.input.error( + 'At-rule without name', + { offset: token[2] }, + { offset: token[2] + token[1].length } + ) + } +} + +module.exports = Parser diff --git a/node_modules/postcss/lib/postcss.d.mts b/node_modules/postcss/lib/postcss.d.mts new file mode 100644 index 00000000..4cf5b492 --- /dev/null +++ b/node_modules/postcss/lib/postcss.d.mts @@ -0,0 +1,69 @@ +export { + // postcss function / namespace + default, + + // Value exports from postcss.mjs + stringify, + fromJSON, + // @ts-expect-error This value exists, but it’s untyped. + plugin, + parse, + list, + document, + comment, + atRule, + rule, + decl, + root, + CssSyntaxError, + Declaration, + Container, + Processor, + Document, + Comment, + Warning, + AtRule, + Result, + Input, + Rule, + Root, + Node, + + // Type-only exports + AcceptedPlugin, + AnyNode, + AtRuleProps, + Builder, + ChildNode, + ChildProps, + CommentProps, + ContainerProps, + DeclarationProps, + DocumentProps, + FilePosition, + Helpers, + JSONHydrator, + Message, + NodeErrorOptions, + NodeProps, + OldPlugin, + Parser, + Plugin, + PluginCreator, + Position, + Postcss, + ProcessOptions, + RootProps, + RuleProps, + Source, + SourceMap, + SourceMapOptions, + Stringifier, + Syntax, + TransformCallback, + Transformer, + WarningOptions, + + // This is a class, but it’s not re-exported. That’s why it’s exported as type-only here. + type LazyResult +} from './postcss.js' diff --git a/node_modules/postcss/lib/postcss.d.ts b/node_modules/postcss/lib/postcss.d.ts new file mode 100644 index 00000000..d0b8b53d --- /dev/null +++ b/node_modules/postcss/lib/postcss.d.ts @@ -0,0 +1,453 @@ +import { RawSourceMap, SourceMapGenerator } from 'source-map-js' + +import AtRule, { AtRuleProps } from './at-rule.js' +import Comment, { CommentProps } from './comment.js' +import Container, { ContainerProps, NewChild } from './container.js' +import CssSyntaxError from './css-syntax-error.js' +import Declaration, { DeclarationProps } from './declaration.js' +import Document, { DocumentProps } from './document.js' +import Input, { FilePosition } from './input.js' +import LazyResult from './lazy-result.js' +import list from './list.js' +import Node, { + AnyNode, + ChildNode, + ChildProps, + NodeErrorOptions, + NodeProps, + Position, + Source +} from './node.js' +import Processor from './processor.js' +import Result, { Message } from './result.js' +import Root, { RootProps } from './root.js' +import Rule, { RuleProps } from './rule.js' +import Warning, { WarningOptions } from './warning.js' + +type DocumentProcessor = ( + document: Document, + helper: postcss.Helpers +) => Promise | void +type RootProcessor = ( + root: Root, + helper: postcss.Helpers +) => Promise | void +type DeclarationProcessor = ( + decl: Declaration, + helper: postcss.Helpers +) => Promise | void +type RuleProcessor = ( + rule: Rule, + helper: postcss.Helpers +) => Promise | void +type AtRuleProcessor = ( + atRule: AtRule, + helper: postcss.Helpers +) => Promise | void +type CommentProcessor = ( + comment: Comment, + helper: postcss.Helpers +) => Promise | void + +interface Processors { + /** + * Will be called on all`AtRule` nodes. + * + * Will be called again on node or children changes. + */ + AtRule?: { [name: string]: AtRuleProcessor } | AtRuleProcessor + + /** + * Will be called on all `AtRule` nodes, when all children will be processed. + * + * Will be called again on node or children changes. + */ + AtRuleExit?: { [name: string]: AtRuleProcessor } | AtRuleProcessor + + /** + * Will be called on all `Comment` nodes. + * + * Will be called again on node or children changes. + */ + Comment?: CommentProcessor + + /** + * Will be called on all `Comment` nodes after listeners + * for `Comment` event. + * + * Will be called again on node or children changes. + */ + CommentExit?: CommentProcessor + + /** + * Will be called on all `Declaration` nodes after listeners + * for `Declaration` event. + * + * Will be called again on node or children changes. + */ + Declaration?: { [prop: string]: DeclarationProcessor } | DeclarationProcessor + + /** + * Will be called on all `Declaration` nodes. + * + * Will be called again on node or children changes. + */ + DeclarationExit?: + | { [prop: string]: DeclarationProcessor } + | DeclarationProcessor + + /** + * Will be called on `Document` node. + * + * Will be called again on children changes. + */ + Document?: DocumentProcessor + + /** + * Will be called on `Document` node, when all children will be processed. + * + * Will be called again on children changes. + */ + DocumentExit?: DocumentProcessor + + /** + * Will be called on `Root` node once. + */ + Once?: RootProcessor + + /** + * Will be called on `Root` node once, when all children will be processed. + */ + OnceExit?: RootProcessor + + /** + * Will be called on `Root` node. + * + * Will be called again on children changes. + */ + Root?: RootProcessor + + /** + * Will be called on `Root` node, when all children will be processed. + * + * Will be called again on children changes. + */ + RootExit?: RootProcessor + + /** + * Will be called on all `Rule` nodes. + * + * Will be called again on node or children changes. + */ + Rule?: RuleProcessor + + /** + * Will be called on all `Rule` nodes, when all children will be processed. + * + * Will be called again on node or children changes. + */ + RuleExit?: RuleProcessor +} + +declare namespace postcss { + export { + AnyNode, + AtRule, + AtRuleProps, + ChildNode, + ChildProps, + Comment, + CommentProps, + Container, + ContainerProps, + CssSyntaxError, + Declaration, + DeclarationProps, + Document, + DocumentProps, + FilePosition, + Input, + LazyResult, + list, + Message, + NewChild, + Node, + NodeErrorOptions, + NodeProps, + Position, + Processor, + Result, + Root, + RootProps, + Rule, + RuleProps, + Source, + Warning, + WarningOptions + } + + export type SourceMap = { + toJSON(): RawSourceMap + } & SourceMapGenerator + + export type Helpers = { postcss: Postcss; result: Result } & Postcss + + export interface Plugin extends Processors { + postcssPlugin: string + prepare?: (result: Result) => Processors + } + + export interface PluginCreator { + (opts?: PluginOptions): Plugin | Processor + postcss: true + } + + export interface Transformer extends TransformCallback { + postcssPlugin: string + postcssVersion: string + } + + export interface TransformCallback { + (root: Root, result: Result): Promise | void + } + + export interface OldPlugin extends Transformer { + (opts?: T): Transformer + postcss: Transformer + } + + export type AcceptedPlugin = + | { + postcss: Processor | TransformCallback + } + | OldPlugin + | Plugin + | PluginCreator + | Processor + | TransformCallback + + export interface Parser { + ( + css: { toString(): string } | string, + opts?: Pick + ): RootNode + } + + export interface Builder { + (part: string, node?: AnyNode, type?: 'end' | 'start'): void + } + + export interface Stringifier { + (node: AnyNode, builder: Builder): void + } + + export interface JSONHydrator { + (data: object): Node + (data: object[]): Node[] + } + + export interface Syntax { + /** + * Function to generate AST by string. + */ + parse?: Parser + + /** + * Class to generate string by AST. + */ + stringify?: Stringifier + } + + export interface SourceMapOptions { + /** + * Use absolute path in generated source map. + */ + absolute?: boolean + + /** + * Indicates that PostCSS should add annotation comments to the CSS. + * By default, PostCSS will always add a comment with a path + * to the source map. PostCSS will not add annotations to CSS files + * that do not contain any comments. + * + * By default, PostCSS presumes that you want to save the source map as + * `opts.to + '.map'` and will use this path in the annotation comment. + * A different path can be set by providing a string value for annotation. + * + * If you have set `inline: true`, annotation cannot be disabled. + */ + annotation?: ((file: string, root: Root) => string) | boolean | string + + /** + * Override `from` in map’s sources. + */ + from?: string + + /** + * Indicates that the source map should be embedded in the output CSS + * as a Base64-encoded comment. By default, it is `true`. + * But if all previous maps are external, not inline, PostCSS will not embed + * the map even if you do not set this option. + * + * If you have an inline source map, the result.map property will be empty, + * as the source map will be contained within the text of `result.css`. + */ + inline?: boolean + + /** + * Source map content from a previous processing step (e.g., Sass). + * + * PostCSS will try to read the previous source map + * automatically (based on comments within the source CSS), but you can use + * this option to identify it manually. + * + * If desired, you can omit the previous map with prev: `false`. + */ + prev?: ((file: string) => string) | boolean | object | string + + /** + * Indicates that PostCSS should set the origin content (e.g., Sass source) + * of the source map. By default, it is true. But if all previous maps do not + * contain sources content, PostCSS will also leave it out even if you + * do not set this option. + */ + sourcesContent?: boolean + } + + export interface ProcessOptions { + /** + * The path of the CSS source file. You should always set `from`, + * because it is used in source map generation and syntax error messages. + */ + from?: string | undefined + + /** + * Source map options + */ + map?: boolean | SourceMapOptions + + /** + * Function to generate AST by string. + */ + parser?: Parser | Syntax + + /** + * Class to generate string by AST. + */ + stringifier?: Stringifier | Syntax + + /** + * Object with parse and stringify. + */ + syntax?: Syntax + + /** + * The path where you'll put the output CSS file. You should always set `to` + * to generate correct source maps. + */ + to?: string + } + + export type Postcss = typeof postcss + + /** + * Default function to convert a node tree into a CSS string. + */ + export let stringify: Stringifier + + /** + * Parses source css and returns a new `Root` or `Document` node, + * which contains the source CSS nodes. + * + * ```js + * // Simple CSS concatenation with source map support + * const root1 = postcss.parse(css1, { from: file1 }) + * const root2 = postcss.parse(css2, { from: file2 }) + * root1.append(root2).toResult().css + * ``` + */ + export let parse: Parser + + /** + * Rehydrate a JSON AST (from `Node#toJSON`) back into the AST classes. + * + * ```js + * const json = root.toJSON() + * // save to file, send by network, etc + * const root2 = postcss.fromJSON(json) + * ``` + */ + export let fromJSON: JSONHydrator + + /** + * Creates a new `Comment` node. + * + * @param defaults Properties for the new node. + * @return New comment node + */ + export function comment(defaults?: CommentProps): Comment + + /** + * Creates a new `AtRule` node. + * + * @param defaults Properties for the new node. + * @return New at-rule node. + */ + export function atRule(defaults?: AtRuleProps): AtRule + + /** + * Creates a new `Declaration` node. + * + * @param defaults Properties for the new node. + * @return New declaration node. + */ + export function decl(defaults?: DeclarationProps): Declaration + + /** + * Creates a new `Rule` node. + * + * @param default Properties for the new node. + * @return New rule node. + */ + export function rule(defaults?: RuleProps): Rule + + /** + * Creates a new `Root` node. + * + * @param defaults Properties for the new node. + * @return New root node. + */ + export function root(defaults?: RootProps): Root + + /** + * Creates a new `Document` node. + * + * @param defaults Properties for the new node. + * @return New document node. + */ + export function document(defaults?: DocumentProps): Document + + export { postcss as default } +} + +/** + * Create a new `Processor` instance that will apply `plugins` + * as CSS processors. + * + * ```js + * let postcss = require('postcss') + * + * postcss(plugins).process(css, { from, to }).then(result => { + * console.log(result.css) + * }) + * ``` + * + * @param plugins PostCSS plugins. + * @return Processor to process multiple CSS. + */ +declare function postcss( + plugins?: readonly postcss.AcceptedPlugin[] +): Processor +declare function postcss(...plugins: postcss.AcceptedPlugin[]): Processor + +export = postcss diff --git a/node_modules/postcss/lib/postcss.js b/node_modules/postcss/lib/postcss.js new file mode 100644 index 00000000..8f0773b2 --- /dev/null +++ b/node_modules/postcss/lib/postcss.js @@ -0,0 +1,101 @@ +'use strict' + +let AtRule = require('./at-rule') +let Comment = require('./comment') +let Container = require('./container') +let CssSyntaxError = require('./css-syntax-error') +let Declaration = require('./declaration') +let Document = require('./document') +let fromJSON = require('./fromJSON') +let Input = require('./input') +let LazyResult = require('./lazy-result') +let list = require('./list') +let Node = require('./node') +let parse = require('./parse') +let Processor = require('./processor') +let Result = require('./result.js') +let Root = require('./root') +let Rule = require('./rule') +let stringify = require('./stringify') +let Warning = require('./warning') + +function postcss(...plugins) { + if (plugins.length === 1 && Array.isArray(plugins[0])) { + plugins = plugins[0] + } + return new Processor(plugins) +} + +postcss.plugin = function plugin(name, initializer) { + let warningPrinted = false + function creator(...args) { + // eslint-disable-next-line no-console + if (console && console.warn && !warningPrinted) { + warningPrinted = true + // eslint-disable-next-line no-console + console.warn( + name + + ': postcss.plugin was deprecated. Migration guide:\n' + + 'https://evilmartians.com/chronicles/postcss-8-plugin-migration' + ) + if (process.env.LANG && process.env.LANG.startsWith('cn')) { + /* c8 ignore next 7 */ + // eslint-disable-next-line no-console + console.warn( + name + + ': 里面 postcss.plugin 被弃用. 迁移指南:\n' + + 'https://www.w3ctech.com/topic/2226' + ) + } + } + let transformer = initializer(...args) + transformer.postcssPlugin = name + transformer.postcssVersion = new Processor().version + return transformer + } + + let cache + Object.defineProperty(creator, 'postcss', { + get() { + if (!cache) cache = creator() + return cache + } + }) + + creator.process = function (css, processOpts, pluginOpts) { + return postcss([creator(pluginOpts)]).process(css, processOpts) + } + + return creator +} + +postcss.stringify = stringify +postcss.parse = parse +postcss.fromJSON = fromJSON +postcss.list = list + +postcss.comment = defaults => new Comment(defaults) +postcss.atRule = defaults => new AtRule(defaults) +postcss.decl = defaults => new Declaration(defaults) +postcss.rule = defaults => new Rule(defaults) +postcss.root = defaults => new Root(defaults) +postcss.document = defaults => new Document(defaults) + +postcss.CssSyntaxError = CssSyntaxError +postcss.Declaration = Declaration +postcss.Container = Container +postcss.Processor = Processor +postcss.Document = Document +postcss.Comment = Comment +postcss.Warning = Warning +postcss.AtRule = AtRule +postcss.Result = Result +postcss.Input = Input +postcss.Rule = Rule +postcss.Root = Root +postcss.Node = Node + +LazyResult.registerPostcss(postcss) + +module.exports = postcss +postcss.default = postcss diff --git a/node_modules/postcss/lib/postcss.mjs b/node_modules/postcss/lib/postcss.mjs new file mode 100644 index 00000000..35075988 --- /dev/null +++ b/node_modules/postcss/lib/postcss.mjs @@ -0,0 +1,30 @@ +import postcss from './postcss.js' + +export default postcss + +export const stringify = postcss.stringify +export const fromJSON = postcss.fromJSON +export const plugin = postcss.plugin +export const parse = postcss.parse +export const list = postcss.list + +export const document = postcss.document +export const comment = postcss.comment +export const atRule = postcss.atRule +export const rule = postcss.rule +export const decl = postcss.decl +export const root = postcss.root + +export const CssSyntaxError = postcss.CssSyntaxError +export const Declaration = postcss.Declaration +export const Container = postcss.Container +export const Processor = postcss.Processor +export const Document = postcss.Document +export const Comment = postcss.Comment +export const Warning = postcss.Warning +export const AtRule = postcss.AtRule +export const Result = postcss.Result +export const Input = postcss.Input +export const Rule = postcss.Rule +export const Root = postcss.Root +export const Node = postcss.Node diff --git a/node_modules/postcss/lib/previous-map.d.ts b/node_modules/postcss/lib/previous-map.d.ts new file mode 100644 index 00000000..23edeb5c --- /dev/null +++ b/node_modules/postcss/lib/previous-map.d.ts @@ -0,0 +1,81 @@ +import { SourceMapConsumer } from 'source-map-js' + +import { ProcessOptions } from './postcss.js' + +declare namespace PreviousMap { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { PreviousMap_ as default } +} + +/** + * Source map information from input CSS. + * For example, source map after Sass compiler. + * + * This class will automatically find source map in input CSS or in file system + * near input file (according `from` option). + * + * ```js + * const root = parse(css, { from: 'a.sass.css' }) + * root.input.map //=> PreviousMap + * ``` + */ +declare class PreviousMap_ { + /** + * `sourceMappingURL` content. + */ + annotation?: string + + /** + * The CSS source identifier. Contains `Input#file` if the user + * set the `from` option, or `Input#id` if they did not. + */ + file?: string + + /** + * Was source map inlined by data-uri to input CSS. + */ + inline: boolean + + /** + * Path to source map file. + */ + mapFile?: string + + /** + * The directory with source map file, if source map is in separated file. + */ + root?: string + + /** + * Source map file content. + */ + text?: string + + /** + * @param css Input CSS source. + * @param opts Process options. + */ + constructor(css: string, opts?: ProcessOptions) + + /** + * Create a instance of `SourceMapGenerator` class + * from the `source-map` library to work with source map information. + * + * It is lazy method, so it will create object only on first call + * and then it will use cache. + * + * @return Object with source map information. + */ + consumer(): SourceMapConsumer + + /** + * Does source map contains `sourcesContent` with input source text. + * + * @return Is `sourcesContent` present. + */ + withContent(): boolean +} + +declare class PreviousMap extends PreviousMap_ {} + +export = PreviousMap diff --git a/node_modules/postcss/lib/previous-map.js b/node_modules/postcss/lib/previous-map.js new file mode 100644 index 00000000..b123dcdc --- /dev/null +++ b/node_modules/postcss/lib/previous-map.js @@ -0,0 +1,144 @@ +'use strict' + +let { existsSync, readFileSync } = require('fs') +let { dirname, join } = require('path') +let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') + +function fromBase64(str) { + if (Buffer) { + return Buffer.from(str, 'base64').toString() + } else { + /* c8 ignore next 2 */ + return window.atob(str) + } +} + +class PreviousMap { + constructor(css, opts) { + if (opts.map === false) return + this.loadAnnotation(css) + this.inline = this.startWith(this.annotation, 'data:') + + let prev = opts.map ? opts.map.prev : undefined + let text = this.loadMap(opts.from, prev) + if (!this.mapFile && opts.from) { + this.mapFile = opts.from + } + if (this.mapFile) this.root = dirname(this.mapFile) + if (text) this.text = text + } + + consumer() { + if (!this.consumerCache) { + this.consumerCache = new SourceMapConsumer(this.text) + } + return this.consumerCache + } + + decodeInline(text) { + let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/ + let baseUri = /^data:application\/json;base64,/ + let charsetUri = /^data:application\/json;charset=utf-?8,/ + let uri = /^data:application\/json,/ + + let uriMatch = text.match(charsetUri) || text.match(uri) + if (uriMatch) { + return decodeURIComponent(text.substr(uriMatch[0].length)) + } + + let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri) + if (baseUriMatch) { + return fromBase64(text.substr(baseUriMatch[0].length)) + } + + let encoding = text.match(/data:application\/json;([^,]+),/)[1] + throw new Error('Unsupported source map encoding ' + encoding) + } + + getAnnotationURL(sourceMapString) { + return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim() + } + + isMap(map) { + if (typeof map !== 'object') return false + return ( + typeof map.mappings === 'string' || + typeof map._mappings === 'string' || + Array.isArray(map.sections) + ) + } + + loadAnnotation(css) { + let comments = css.match(/\/\*\s*# sourceMappingURL=/g) + if (!comments) return + + // sourceMappingURLs from comments, strings, etc. + let start = css.lastIndexOf(comments.pop()) + let end = css.indexOf('*/', start) + + if (start > -1 && end > -1) { + // Locate the last sourceMappingURL to avoid pickin + this.annotation = this.getAnnotationURL(css.substring(start, end)) + } + } + + loadFile(path) { + this.root = dirname(path) + if (existsSync(path)) { + this.mapFile = path + return readFileSync(path, 'utf-8').toString().trim() + } + } + + loadMap(file, prev) { + if (prev === false) return false + + if (prev) { + if (typeof prev === 'string') { + return prev + } else if (typeof prev === 'function') { + let prevPath = prev(file) + if (prevPath) { + let map = this.loadFile(prevPath) + if (!map) { + throw new Error( + 'Unable to load previous source map: ' + prevPath.toString() + ) + } + return map + } + } else if (prev instanceof SourceMapConsumer) { + return SourceMapGenerator.fromSourceMap(prev).toString() + } else if (prev instanceof SourceMapGenerator) { + return prev.toString() + } else if (this.isMap(prev)) { + return JSON.stringify(prev) + } else { + throw new Error( + 'Unsupported previous source map format: ' + prev.toString() + ) + } + } else if (this.inline) { + return this.decodeInline(this.annotation) + } else if (this.annotation) { + let map = this.annotation + if (file) map = join(dirname(file), map) + return this.loadFile(map) + } + } + + startWith(string, start) { + if (!string) return false + return string.substr(0, start.length) === start + } + + withContent() { + return !!( + this.consumer().sourcesContent && + this.consumer().sourcesContent.length > 0 + ) + } +} + +module.exports = PreviousMap +PreviousMap.default = PreviousMap diff --git a/node_modules/postcss/lib/processor.d.ts b/node_modules/postcss/lib/processor.d.ts new file mode 100644 index 00000000..aa2942c6 --- /dev/null +++ b/node_modules/postcss/lib/processor.d.ts @@ -0,0 +1,115 @@ +import Document from './document.js' +import LazyResult from './lazy-result.js' +import NoWorkResult from './no-work-result.js' +import { + AcceptedPlugin, + Plugin, + ProcessOptions, + TransformCallback, + Transformer +} from './postcss.js' +import Result from './result.js' +import Root from './root.js' + +declare namespace Processor { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Processor_ as default } +} + +/** + * Contains plugins to process CSS. Create one `Processor` instance, + * initialize its plugins, and then use that instance on numerous CSS files. + * + * ```js + * const processor = postcss([autoprefixer, postcssNested]) + * processor.process(css1).then(result => console.log(result.css)) + * processor.process(css2).then(result => console.log(result.css)) + * ``` + */ +declare class Processor_ { + /** + * Plugins added to this processor. + * + * ```js + * const processor = postcss([autoprefixer, postcssNested]) + * processor.plugins.length //=> 2 + * ``` + */ + plugins: (Plugin | TransformCallback | Transformer)[] + + /** + * Current PostCSS version. + * + * ```js + * if (result.processor.version.split('.')[0] !== '6') { + * throw new Error('This plugin works only with PostCSS 6') + * } + * ``` + */ + version: string + + /** + * @param plugins PostCSS plugins + */ + constructor(plugins?: readonly AcceptedPlugin[]) + + /** + * Parses source CSS and returns a `LazyResult` Promise proxy. + * Because some plugins can be asynchronous it doesn’t make + * any transformations. Transformations will be applied + * in the `LazyResult` methods. + * + * ```js + * processor.process(css, { from: 'a.css', to: 'a.out.css' }) + * .then(result => { + * console.log(result.css) + * }) + * ``` + * + * @param css String with input CSS or any object with a `toString()` method, + * like a Buffer. Optionally, send a `Result` instance + * and the processor will take the `Root` from it. + * @param opts Options. + * @return Promise proxy. + */ + process( + css: { toString(): string } | LazyResult | Result | Root | string + ): LazyResult | NoWorkResult + process( + css: { toString(): string } | LazyResult | Result | Root | string, + options: ProcessOptions + ): LazyResult + + /** + * Adds a plugin to be used as a CSS processor. + * + * PostCSS plugin can be in 4 formats: + * * A plugin in `Plugin` format. + * * A plugin creator function with `pluginCreator.postcss = true`. + * PostCSS will call this function without argument to get plugin. + * * A function. PostCSS will pass the function a {@link Root} + * as the first argument and current `Result` instance + * as the second. + * * Another `Processor` instance. PostCSS will copy plugins + * from that instance into this one. + * + * Plugins can also be added by passing them as arguments when creating + * a `postcss` instance (see [`postcss(plugins)`]). + * + * Asynchronous plugins should return a `Promise` instance. + * + * ```js + * const processor = postcss() + * .use(autoprefixer) + * .use(postcssNested) + * ``` + * + * @param plugin PostCSS plugin or `Processor` with plugins. + * @return Current processor to make methods chain. + */ + use(plugin: AcceptedPlugin): this +} + +declare class Processor extends Processor_ {} + +export = Processor diff --git a/node_modules/postcss/lib/processor.js b/node_modules/postcss/lib/processor.js new file mode 100644 index 00000000..d6192ab4 --- /dev/null +++ b/node_modules/postcss/lib/processor.js @@ -0,0 +1,67 @@ +'use strict' + +let Document = require('./document') +let LazyResult = require('./lazy-result') +let NoWorkResult = require('./no-work-result') +let Root = require('./root') + +class Processor { + constructor(plugins = []) { + this.version = '8.4.49' + this.plugins = this.normalize(plugins) + } + + normalize(plugins) { + let normalized = [] + for (let i of plugins) { + if (i.postcss === true) { + i = i() + } else if (i.postcss) { + i = i.postcss + } + + if (typeof i === 'object' && Array.isArray(i.plugins)) { + normalized = normalized.concat(i.plugins) + } else if (typeof i === 'object' && i.postcssPlugin) { + normalized.push(i) + } else if (typeof i === 'function') { + normalized.push(i) + } else if (typeof i === 'object' && (i.parse || i.stringify)) { + if (process.env.NODE_ENV !== 'production') { + throw new Error( + 'PostCSS syntaxes cannot be used as plugins. Instead, please use ' + + 'one of the syntax/parser/stringifier options as outlined ' + + 'in your PostCSS runner documentation.' + ) + } + } else { + throw new Error(i + ' is not a PostCSS plugin') + } + } + return normalized + } + + process(css, opts = {}) { + if ( + !this.plugins.length && + !opts.parser && + !opts.stringifier && + !opts.syntax + ) { + return new NoWorkResult(this, css, opts) + } else { + return new LazyResult(this, css, opts) + } + } + + use(plugin) { + this.plugins = this.plugins.concat(this.normalize([plugin])) + return this + } +} + +module.exports = Processor +Processor.default = Processor + +Root.registerProcessor(Processor) +Document.registerProcessor(Processor) diff --git a/node_modules/postcss/lib/result.d.ts b/node_modules/postcss/lib/result.d.ts new file mode 100644 index 00000000..40e086f7 --- /dev/null +++ b/node_modules/postcss/lib/result.d.ts @@ -0,0 +1,205 @@ +import { + Document, + Node, + Plugin, + ProcessOptions, + Root, + SourceMap, + TransformCallback, + Warning, + WarningOptions +} from './postcss.js' +import Processor from './processor.js' + +declare namespace Result { + export interface Message { + [others: string]: any + + /** + * Source PostCSS plugin name. + */ + plugin?: string + + /** + * Message type. + */ + type: string + } + + export interface ResultOptions extends ProcessOptions { + /** + * The CSS node that was the source of the warning. + */ + node?: Node + + /** + * Name of plugin that created this warning. `Result#warn` will fill it + * automatically with `Plugin#postcssPlugin` value. + */ + plugin?: string + } + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Result_ as default } +} + +/** + * Provides the result of the PostCSS transformations. + * + * A Result instance is returned by `LazyResult#then` + * or `Root#toResult` methods. + * + * ```js + * postcss([autoprefixer]).process(css).then(result => { + * console.log(result.css) + * }) + * ``` + * + * ```js + * const result2 = postcss.parse(css).toResult() + * ``` + */ +declare class Result_ { + /** + * A CSS string representing of `Result#root`. + * + * ```js + * postcss.parse('a{}').toResult().css //=> "a{}" + * ``` + */ + css: string + + /** + * Last runned PostCSS plugin. + */ + lastPlugin: Plugin | TransformCallback + + /** + * An instance of `SourceMapGenerator` class from the `source-map` library, + * representing changes to the `Result#root` instance. + * + * ```js + * result.map.toJSON() //=> { version: 3, file: 'a.css', … } + * ``` + * + * ```js + * if (result.map) { + * fs.writeFileSync(result.opts.to + '.map', result.map.toString()) + * } + * ``` + */ + map: SourceMap + + /** + * Contains messages from plugins (e.g., warnings or custom messages). + * Each message should have type and plugin properties. + * + * ```js + * AtRule: { + * import: (atRule, { result }) { + * const importedFile = parseImport(atRule) + * result.messages.push({ + * type: 'dependency', + * plugin: 'postcss-import', + * file: importedFile, + * parent: result.opts.from + * }) + * } + * } + * ``` + */ + messages: Result.Message[] + + /** + * Options from the `Processor#process` or `Root#toResult` call + * that produced this Result instance.] + * + * ```js + * root.toResult(opts).opts === opts + * ``` + */ + opts: Result.ResultOptions + + /** + * The Processor instance used for this transformation. + * + * ```js + * for (const plugin of result.processor.plugins) { + * if (plugin.postcssPlugin === 'postcss-bad') { + * throw 'postcss-good is incompatible with postcss-bad' + * } + * }) + * ``` + */ + processor: Processor + + /** + * Root node after all transformations. + * + * ```js + * root.toResult().root === root + * ``` + */ + root: RootNode + + /** + * @param processor Processor used for this transformation. + * @param root Root node after all transformations. + * @param opts Options from the `Processor#process` or `Root#toResult`. + */ + constructor(processor: Processor, root: RootNode, opts: Result.ResultOptions) + + /** + * Returns for `Result#css` content. + * + * ```js + * result + '' === result.css + * ``` + * + * @return String representing of `Result#root`. + */ + toString(): string + + /** + * Creates an instance of `Warning` and adds it to `Result#messages`. + * + * ```js + * if (decl.important) { + * result.warn('Avoid !important', { node: decl, word: '!important' }) + * } + * ``` + * + * @param text Warning message. + * @param opts Warning options. + * @return Created warning. + */ + warn(message: string, options?: WarningOptions): Warning + + /** + * Returns warnings from plugins. Filters `Warning` instances + * from `Result#messages`. + * + * ```js + * result.warnings().forEach(warn => { + * console.warn(warn.toString()) + * }) + * ``` + * + * @return Warnings from plugins. + */ + warnings(): Warning[] + + /** + * An alias for the `Result#css` property. + * Use it with syntaxes that generate non-CSS output. + * + * ```js + * result.css === result.content + * ``` + */ + get content(): string +} + +declare class Result extends Result_ {} + +export = Result diff --git a/node_modules/postcss/lib/result.js b/node_modules/postcss/lib/result.js new file mode 100644 index 00000000..a39751de --- /dev/null +++ b/node_modules/postcss/lib/result.js @@ -0,0 +1,42 @@ +'use strict' + +let Warning = require('./warning') + +class Result { + constructor(processor, root, opts) { + this.processor = processor + this.messages = [] + this.root = root + this.opts = opts + this.css = undefined + this.map = undefined + } + + toString() { + return this.css + } + + warn(text, opts = {}) { + if (!opts.plugin) { + if (this.lastPlugin && this.lastPlugin.postcssPlugin) { + opts.plugin = this.lastPlugin.postcssPlugin + } + } + + let warning = new Warning(text, opts) + this.messages.push(warning) + + return warning + } + + warnings() { + return this.messages.filter(i => i.type === 'warning') + } + + get content() { + return this.css + } +} + +module.exports = Result +Result.default = Result diff --git a/node_modules/postcss/lib/root.d.ts b/node_modules/postcss/lib/root.d.ts new file mode 100644 index 00000000..5c911396 --- /dev/null +++ b/node_modules/postcss/lib/root.d.ts @@ -0,0 +1,87 @@ +import Container, { ContainerProps } from './container.js' +import Document from './document.js' +import { ProcessOptions } from './postcss.js' +import Result from './result.js' + +declare namespace Root { + export interface RootRaws extends Record { + /** + * The space symbols after the last child to the end of file. + */ + after?: string + + /** + * Non-CSS code after `Root`, when `Root` is inside `Document`. + * + * **Experimental:** some aspects of this node could change within minor + * or patch version releases. + */ + codeAfter?: string + + /** + * Non-CSS code before `Root`, when `Root` is inside `Document`. + * + * **Experimental:** some aspects of this node could change within minor + * or patch version releases. + */ + codeBefore?: string + + /** + * Is the last child has an (optional) semicolon. + */ + semicolon?: boolean + } + + export interface RootProps extends ContainerProps { + /** + * Information used to generate byte-to-byte equal node string + * as it was in the origin input. + * */ + raws?: RootRaws + } + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Root_ as default } +} + +/** + * Represents a CSS file and contains all its parsed nodes. + * + * ```js + * const root = postcss.parse('a{color:black} b{z-index:2}') + * root.type //=> 'root' + * root.nodes.length //=> 2 + * ``` + */ +declare class Root_ extends Container { + nodes: NonNullable + parent: Document | undefined + raws: Root.RootRaws + type: 'root' + + constructor(defaults?: Root.RootProps) + + assign(overrides: object | Root.RootProps): this + clone(overrides?: Partial): this + cloneAfter(overrides?: Partial): this + cloneBefore(overrides?: Partial): this + + /** + * Returns a `Result` instance representing the root’s CSS. + * + * ```js + * const root1 = postcss.parse(css1, { from: 'a.css' }) + * const root2 = postcss.parse(css2, { from: 'b.css' }) + * root1.append(root2) + * const result = root1.toResult({ to: 'all.css', map: true }) + * ``` + * + * @param options Options. + * @return Result with current root’s CSS. + */ + toResult(options?: ProcessOptions): Result +} + +declare class Root extends Root_ {} + +export = Root diff --git a/node_modules/postcss/lib/root.js b/node_modules/postcss/lib/root.js new file mode 100644 index 00000000..ea574edc --- /dev/null +++ b/node_modules/postcss/lib/root.js @@ -0,0 +1,61 @@ +'use strict' + +let Container = require('./container') + +let LazyResult, Processor + +class Root extends Container { + constructor(defaults) { + super(defaults) + this.type = 'root' + if (!this.nodes) this.nodes = [] + } + + normalize(child, sample, type) { + let nodes = super.normalize(child) + + if (sample) { + if (type === 'prepend') { + if (this.nodes.length > 1) { + sample.raws.before = this.nodes[1].raws.before + } else { + delete sample.raws.before + } + } else if (this.first !== sample) { + for (let node of nodes) { + node.raws.before = sample.raws.before + } + } + } + + return nodes + } + + removeChild(child, ignore) { + let index = this.index(child) + + if (!ignore && index === 0 && this.nodes.length > 1) { + this.nodes[1].raws.before = this.nodes[index].raws.before + } + + return super.removeChild(child) + } + + toResult(opts = {}) { + let lazy = new LazyResult(new Processor(), this, opts) + return lazy.stringify() + } +} + +Root.registerLazyResult = dependant => { + LazyResult = dependant +} + +Root.registerProcessor = dependant => { + Processor = dependant +} + +module.exports = Root +Root.default = Root + +Container.registerRoot(Root) diff --git a/node_modules/postcss/lib/rule.d.ts b/node_modules/postcss/lib/rule.d.ts new file mode 100644 index 00000000..da8aae74 --- /dev/null +++ b/node_modules/postcss/lib/rule.d.ts @@ -0,0 +1,126 @@ +import Container, { + ContainerProps, + ContainerWithChildren +} from './container.js' + +declare namespace Rule { + export interface RuleRaws extends Record { + /** + * The space symbols after the last child of the node to the end of the node. + */ + after?: string + + /** + * The space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + */ + before?: string + + /** + * The symbols between the selector and `{` for rules. + */ + between?: string + + /** + * Contains `true` if there is semicolon after rule. + */ + ownSemicolon?: string + + /** + * The rule’s selector with comments. + */ + selector?: { + raw: string + value: string + } + + /** + * Contains `true` if the last child has an (optional) semicolon. + */ + semicolon?: boolean + } + + export type RuleProps = { + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: RuleRaws + } & ( + | { + /** Selector or selectors of the rule. */ + selector: string + selectors?: never + } + | { + selector?: never + /** Selectors of the rule represented as an array of strings. */ + selectors: readonly string[] + } + ) & ContainerProps + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Rule_ as default } +} + +/** + * Represents a CSS rule: a selector followed by a declaration block. + * + * ```js + * Once (root, { Rule }) { + * let a = new Rule({ selector: 'a' }) + * a.append(…) + * root.append(a) + * } + * ``` + * + * ```js + * const root = postcss.parse('a{}') + * const rule = root.first + * rule.type //=> 'rule' + * rule.toString() //=> 'a{}' + * ``` + */ +declare class Rule_ extends Container { + nodes: NonNullable + parent: ContainerWithChildren | undefined + raws: Rule.RuleRaws + type: 'rule' + constructor(defaults?: Rule.RuleProps) + + assign(overrides: object | Rule.RuleProps): this + clone(overrides?: Partial): this + + cloneAfter(overrides?: Partial): this + + cloneBefore(overrides?: Partial): this + /** + * The rule’s full selector represented as a string. + * + * ```js + * const root = postcss.parse('a, b { }') + * const rule = root.first + * rule.selector //=> 'a, b' + * ``` + */ + get selector(): string + set selector(value: string) + /** + * An array containing the rule’s individual selectors. + * Groups of selectors are split at commas. + * + * ```js + * const root = postcss.parse('a, b { }') + * const rule = root.first + * + * rule.selector //=> 'a, b' + * rule.selectors //=> ['a', 'b'] + * + * rule.selectors = ['a', 'strong'] + * rule.selector //=> 'a, strong' + * ``` + */ + get selectors(): string[] + set selectors(values: string[]) +} + +declare class Rule extends Rule_ {} + +export = Rule diff --git a/node_modules/postcss/lib/rule.js b/node_modules/postcss/lib/rule.js new file mode 100644 index 00000000..a93ab25b --- /dev/null +++ b/node_modules/postcss/lib/rule.js @@ -0,0 +1,27 @@ +'use strict' + +let Container = require('./container') +let list = require('./list') + +class Rule extends Container { + constructor(defaults) { + super(defaults) + this.type = 'rule' + if (!this.nodes) this.nodes = [] + } + + get selectors() { + return list.comma(this.selector) + } + + set selectors(values) { + let match = this.selector ? this.selector.match(/,\s*/) : null + let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen') + this.selector = values.join(sep) + } +} + +module.exports = Rule +Rule.default = Rule + +Container.registerRule(Rule) diff --git a/node_modules/postcss/lib/stringifier.d.ts b/node_modules/postcss/lib/stringifier.d.ts new file mode 100644 index 00000000..f707a6aa --- /dev/null +++ b/node_modules/postcss/lib/stringifier.d.ts @@ -0,0 +1,46 @@ +import { + AnyNode, + AtRule, + Builder, + Comment, + Container, + Declaration, + Document, + Root, + Rule +} from './postcss.js' + +declare namespace Stringifier { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Stringifier_ as default } +} + +declare class Stringifier_ { + builder: Builder + constructor(builder: Builder) + atrule(node: AtRule, semicolon?: boolean): void + beforeAfter(node: AnyNode, detect: 'after' | 'before'): string + block(node: AnyNode, start: string): void + body(node: Container): void + comment(node: Comment): void + decl(node: Declaration, semicolon?: boolean): void + document(node: Document): void + raw(node: AnyNode, own: null | string, detect?: string): string + rawBeforeClose(root: Root): string | undefined + rawBeforeComment(root: Root, node: Comment): string | undefined + rawBeforeDecl(root: Root, node: Declaration): string | undefined + rawBeforeOpen(root: Root): string | undefined + rawBeforeRule(root: Root): string | undefined + rawColon(root: Root): string | undefined + rawEmptyBody(root: Root): string | undefined + rawIndent(root: Root): string | undefined + rawSemicolon(root: Root): boolean | undefined + rawValue(node: AnyNode, prop: string): string + root(node: Root): void + rule(node: Rule): void + stringify(node: AnyNode, semicolon?: boolean): void +} + +declare class Stringifier extends Stringifier_ {} + +export = Stringifier diff --git a/node_modules/postcss/lib/stringifier.js b/node_modules/postcss/lib/stringifier.js new file mode 100644 index 00000000..e07ad12e --- /dev/null +++ b/node_modules/postcss/lib/stringifier.js @@ -0,0 +1,353 @@ +'use strict' + +const DEFAULT_RAW = { + after: '\n', + beforeClose: '\n', + beforeComment: '\n', + beforeDecl: '\n', + beforeOpen: ' ', + beforeRule: '\n', + colon: ': ', + commentLeft: ' ', + commentRight: ' ', + emptyBody: '', + indent: ' ', + semicolon: false +} + +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1) +} + +class Stringifier { + constructor(builder) { + this.builder = builder + } + + atrule(node, semicolon) { + let name = '@' + node.name + let params = node.params ? this.rawValue(node, 'params') : '' + + if (typeof node.raws.afterName !== 'undefined') { + name += node.raws.afterName + } else if (params) { + name += ' ' + } + + if (node.nodes) { + this.block(node, name + params) + } else { + let end = (node.raws.between || '') + (semicolon ? ';' : '') + this.builder(name + params + end, node) + } + } + + beforeAfter(node, detect) { + let value + if (node.type === 'decl') { + value = this.raw(node, null, 'beforeDecl') + } else if (node.type === 'comment') { + value = this.raw(node, null, 'beforeComment') + } else if (detect === 'before') { + value = this.raw(node, null, 'beforeRule') + } else { + value = this.raw(node, null, 'beforeClose') + } + + let buf = node.parent + let depth = 0 + while (buf && buf.type !== 'root') { + depth += 1 + buf = buf.parent + } + + if (value.includes('\n')) { + let indent = this.raw(node, null, 'indent') + if (indent.length) { + for (let step = 0; step < depth; step++) value += indent + } + } + + return value + } + + block(node, start) { + let between = this.raw(node, 'between', 'beforeOpen') + this.builder(start + between + '{', node, 'start') + + let after + if (node.nodes && node.nodes.length) { + this.body(node) + after = this.raw(node, 'after') + } else { + after = this.raw(node, 'after', 'emptyBody') + } + + if (after) this.builder(after) + this.builder('}', node, 'end') + } + + body(node) { + let last = node.nodes.length - 1 + while (last > 0) { + if (node.nodes[last].type !== 'comment') break + last -= 1 + } + + let semicolon = this.raw(node, 'semicolon') + for (let i = 0; i < node.nodes.length; i++) { + let child = node.nodes[i] + let before = this.raw(child, 'before') + if (before) this.builder(before) + this.stringify(child, last !== i || semicolon) + } + } + + comment(node) { + let left = this.raw(node, 'left', 'commentLeft') + let right = this.raw(node, 'right', 'commentRight') + this.builder('/*' + left + node.text + right + '*/', node) + } + + decl(node, semicolon) { + let between = this.raw(node, 'between', 'colon') + let string = node.prop + between + this.rawValue(node, 'value') + + if (node.important) { + string += node.raws.important || ' !important' + } + + if (semicolon) string += ';' + this.builder(string, node) + } + + document(node) { + this.body(node) + } + + raw(node, own, detect) { + let value + if (!detect) detect = own + + // Already had + if (own) { + value = node.raws[own] + if (typeof value !== 'undefined') return value + } + + let parent = node.parent + + if (detect === 'before') { + // Hack for first rule in CSS + if (!parent || (parent.type === 'root' && parent.first === node)) { + return '' + } + + // `root` nodes in `document` should use only their own raws + if (parent && parent.type === 'document') { + return '' + } + } + + // Floating child without parent + if (!parent) return DEFAULT_RAW[detect] + + // Detect style by other nodes + let root = node.root() + if (!root.rawCache) root.rawCache = {} + if (typeof root.rawCache[detect] !== 'undefined') { + return root.rawCache[detect] + } + + if (detect === 'before' || detect === 'after') { + return this.beforeAfter(node, detect) + } else { + let method = 'raw' + capitalize(detect) + if (this[method]) { + value = this[method](root, node) + } else { + root.walk(i => { + value = i.raws[own] + if (typeof value !== 'undefined') return false + }) + } + } + + if (typeof value === 'undefined') value = DEFAULT_RAW[detect] + + root.rawCache[detect] = value + return value + } + + rawBeforeClose(root) { + let value + root.walk(i => { + if (i.nodes && i.nodes.length > 0) { + if (typeof i.raws.after !== 'undefined') { + value = i.raws.after + if (value.includes('\n')) { + value = value.replace(/[^\n]+$/, '') + } + return false + } + } + }) + if (value) value = value.replace(/\S/g, '') + return value + } + + rawBeforeComment(root, node) { + let value + root.walkComments(i => { + if (typeof i.raws.before !== 'undefined') { + value = i.raws.before + if (value.includes('\n')) { + value = value.replace(/[^\n]+$/, '') + } + return false + } + }) + if (typeof value === 'undefined') { + value = this.raw(node, null, 'beforeDecl') + } else if (value) { + value = value.replace(/\S/g, '') + } + return value + } + + rawBeforeDecl(root, node) { + let value + root.walkDecls(i => { + if (typeof i.raws.before !== 'undefined') { + value = i.raws.before + if (value.includes('\n')) { + value = value.replace(/[^\n]+$/, '') + } + return false + } + }) + if (typeof value === 'undefined') { + value = this.raw(node, null, 'beforeRule') + } else if (value) { + value = value.replace(/\S/g, '') + } + return value + } + + rawBeforeOpen(root) { + let value + root.walk(i => { + if (i.type !== 'decl') { + value = i.raws.between + if (typeof value !== 'undefined') return false + } + }) + return value + } + + rawBeforeRule(root) { + let value + root.walk(i => { + if (i.nodes && (i.parent !== root || root.first !== i)) { + if (typeof i.raws.before !== 'undefined') { + value = i.raws.before + if (value.includes('\n')) { + value = value.replace(/[^\n]+$/, '') + } + return false + } + } + }) + if (value) value = value.replace(/\S/g, '') + return value + } + + rawColon(root) { + let value + root.walkDecls(i => { + if (typeof i.raws.between !== 'undefined') { + value = i.raws.between.replace(/[^\s:]/g, '') + return false + } + }) + return value + } + + rawEmptyBody(root) { + let value + root.walk(i => { + if (i.nodes && i.nodes.length === 0) { + value = i.raws.after + if (typeof value !== 'undefined') return false + } + }) + return value + } + + rawIndent(root) { + if (root.raws.indent) return root.raws.indent + let value + root.walk(i => { + let p = i.parent + if (p && p !== root && p.parent && p.parent === root) { + if (typeof i.raws.before !== 'undefined') { + let parts = i.raws.before.split('\n') + value = parts[parts.length - 1] + value = value.replace(/\S/g, '') + return false + } + } + }) + return value + } + + rawSemicolon(root) { + let value + root.walk(i => { + if (i.nodes && i.nodes.length && i.last.type === 'decl') { + value = i.raws.semicolon + if (typeof value !== 'undefined') return false + } + }) + return value + } + + rawValue(node, prop) { + let value = node[prop] + let raw = node.raws[prop] + if (raw && raw.value === value) { + return raw.raw + } + + return value + } + + root(node) { + this.body(node) + if (node.raws.after) this.builder(node.raws.after) + } + + rule(node) { + this.block(node, this.rawValue(node, 'selector')) + if (node.raws.ownSemicolon) { + this.builder(node.raws.ownSemicolon, node, 'end') + } + } + + stringify(node, semicolon) { + /* c8 ignore start */ + if (!this[node.type]) { + throw new Error( + 'Unknown AST node type ' + + node.type + + '. ' + + 'Maybe you need to change PostCSS stringifier.' + ) + } + /* c8 ignore stop */ + this[node.type](node, semicolon) + } +} + +module.exports = Stringifier +Stringifier.default = Stringifier diff --git a/node_modules/postcss/lib/stringify.d.ts b/node_modules/postcss/lib/stringify.d.ts new file mode 100644 index 00000000..06ad0b4d --- /dev/null +++ b/node_modules/postcss/lib/stringify.d.ts @@ -0,0 +1,9 @@ +import { Stringifier } from './postcss.js' + +interface Stringify extends Stringifier { + default: Stringify +} + +declare const stringify: Stringify + +export = stringify diff --git a/node_modules/postcss/lib/stringify.js b/node_modules/postcss/lib/stringify.js new file mode 100644 index 00000000..77bd0178 --- /dev/null +++ b/node_modules/postcss/lib/stringify.js @@ -0,0 +1,11 @@ +'use strict' + +let Stringifier = require('./stringifier') + +function stringify(node, builder) { + let str = new Stringifier(builder) + str.stringify(node) +} + +module.exports = stringify +stringify.default = stringify diff --git a/node_modules/postcss/lib/symbols.js b/node_modules/postcss/lib/symbols.js new file mode 100644 index 00000000..a142c268 --- /dev/null +++ b/node_modules/postcss/lib/symbols.js @@ -0,0 +1,5 @@ +'use strict' + +module.exports.isClean = Symbol('isClean') + +module.exports.my = Symbol('my') diff --git a/node_modules/postcss/lib/terminal-highlight.js b/node_modules/postcss/lib/terminal-highlight.js new file mode 100644 index 00000000..6196c9df --- /dev/null +++ b/node_modules/postcss/lib/terminal-highlight.js @@ -0,0 +1,70 @@ +'use strict' + +let pico = require('picocolors') + +let tokenizer = require('./tokenize') + +let Input + +function registerInput(dependant) { + Input = dependant +} + +const HIGHLIGHT_THEME = { + ';': pico.yellow, + ':': pico.yellow, + '(': pico.cyan, + ')': pico.cyan, + '[': pico.yellow, + ']': pico.yellow, + '{': pico.yellow, + '}': pico.yellow, + 'at-word': pico.cyan, + 'brackets': pico.cyan, + 'call': pico.cyan, + 'class': pico.yellow, + 'comment': pico.gray, + 'hash': pico.magenta, + 'string': pico.green +} + +function getTokenType([type, value], processor) { + if (type === 'word') { + if (value[0] === '.') { + return 'class' + } + if (value[0] === '#') { + return 'hash' + } + } + + if (!processor.endOfFile()) { + let next = processor.nextToken() + processor.back(next) + if (next[0] === 'brackets' || next[0] === '(') return 'call' + } + + return type +} + +function terminalHighlight(css) { + let processor = tokenizer(new Input(css), { ignoreErrors: true }) + let result = '' + while (!processor.endOfFile()) { + let token = processor.nextToken() + let color = HIGHLIGHT_THEME[getTokenType(token, processor)] + if (color) { + result += token[1] + .split(/\r?\n/) + .map(i => color(i)) + .join('\n') + } else { + result += token[1] + } + } + return result +} + +terminalHighlight.registerInput = registerInput + +module.exports = terminalHighlight diff --git a/node_modules/postcss/lib/tokenize.js b/node_modules/postcss/lib/tokenize.js new file mode 100644 index 00000000..1d412845 --- /dev/null +++ b/node_modules/postcss/lib/tokenize.js @@ -0,0 +1,266 @@ +'use strict' + +const SINGLE_QUOTE = "'".charCodeAt(0) +const DOUBLE_QUOTE = '"'.charCodeAt(0) +const BACKSLASH = '\\'.charCodeAt(0) +const SLASH = '/'.charCodeAt(0) +const NEWLINE = '\n'.charCodeAt(0) +const SPACE = ' '.charCodeAt(0) +const FEED = '\f'.charCodeAt(0) +const TAB = '\t'.charCodeAt(0) +const CR = '\r'.charCodeAt(0) +const OPEN_SQUARE = '['.charCodeAt(0) +const CLOSE_SQUARE = ']'.charCodeAt(0) +const OPEN_PARENTHESES = '('.charCodeAt(0) +const CLOSE_PARENTHESES = ')'.charCodeAt(0) +const OPEN_CURLY = '{'.charCodeAt(0) +const CLOSE_CURLY = '}'.charCodeAt(0) +const SEMICOLON = ';'.charCodeAt(0) +const ASTERISK = '*'.charCodeAt(0) +const COLON = ':'.charCodeAt(0) +const AT = '@'.charCodeAt(0) + +const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g +const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g +const RE_BAD_BRACKET = /.[\r\n"'(/\\]/ +const RE_HEX_ESCAPE = /[\da-f]/i + +module.exports = function tokenizer(input, options = {}) { + let css = input.css.valueOf() + let ignore = options.ignoreErrors + + let code, content, escape, next, quote + let currentToken, escaped, escapePos, n, prev + + let length = css.length + let pos = 0 + let buffer = [] + let returned = [] + + function position() { + return pos + } + + function unclosed(what) { + throw input.error('Unclosed ' + what, pos) + } + + function endOfFile() { + return returned.length === 0 && pos >= length + } + + function nextToken(opts) { + if (returned.length) return returned.pop() + if (pos >= length) return + + let ignoreUnclosed = opts ? opts.ignoreUnclosed : false + + code = css.charCodeAt(pos) + + switch (code) { + case NEWLINE: + case SPACE: + case TAB: + case CR: + case FEED: { + next = pos + do { + next += 1 + code = css.charCodeAt(next) + } while ( + code === SPACE || + code === NEWLINE || + code === TAB || + code === CR || + code === FEED + ) + + currentToken = ['space', css.slice(pos, next)] + pos = next - 1 + break + } + + case OPEN_SQUARE: + case CLOSE_SQUARE: + case OPEN_CURLY: + case CLOSE_CURLY: + case COLON: + case SEMICOLON: + case CLOSE_PARENTHESES: { + let controlChar = String.fromCharCode(code) + currentToken = [controlChar, controlChar, pos] + break + } + + case OPEN_PARENTHESES: { + prev = buffer.length ? buffer.pop()[1] : '' + n = css.charCodeAt(pos + 1) + if ( + prev === 'url' && + n !== SINGLE_QUOTE && + n !== DOUBLE_QUOTE && + n !== SPACE && + n !== NEWLINE && + n !== TAB && + n !== FEED && + n !== CR + ) { + next = pos + do { + escaped = false + next = css.indexOf(')', next + 1) + if (next === -1) { + if (ignore || ignoreUnclosed) { + next = pos + break + } else { + unclosed('bracket') + } + } + escapePos = next + while (css.charCodeAt(escapePos - 1) === BACKSLASH) { + escapePos -= 1 + escaped = !escaped + } + } while (escaped) + + currentToken = ['brackets', css.slice(pos, next + 1), pos, next] + + pos = next + } else { + next = css.indexOf(')', pos + 1) + content = css.slice(pos, next + 1) + + if (next === -1 || RE_BAD_BRACKET.test(content)) { + currentToken = ['(', '(', pos] + } else { + currentToken = ['brackets', content, pos, next] + pos = next + } + } + + break + } + + case SINGLE_QUOTE: + case DOUBLE_QUOTE: { + quote = code === SINGLE_QUOTE ? "'" : '"' + next = pos + do { + escaped = false + next = css.indexOf(quote, next + 1) + if (next === -1) { + if (ignore || ignoreUnclosed) { + next = pos + 1 + break + } else { + unclosed('string') + } + } + escapePos = next + while (css.charCodeAt(escapePos - 1) === BACKSLASH) { + escapePos -= 1 + escaped = !escaped + } + } while (escaped) + + currentToken = ['string', css.slice(pos, next + 1), pos, next] + pos = next + break + } + + case AT: { + RE_AT_END.lastIndex = pos + 1 + RE_AT_END.test(css) + if (RE_AT_END.lastIndex === 0) { + next = css.length - 1 + } else { + next = RE_AT_END.lastIndex - 2 + } + + currentToken = ['at-word', css.slice(pos, next + 1), pos, next] + + pos = next + break + } + + case BACKSLASH: { + next = pos + escape = true + while (css.charCodeAt(next + 1) === BACKSLASH) { + next += 1 + escape = !escape + } + code = css.charCodeAt(next + 1) + if ( + escape && + code !== SLASH && + code !== SPACE && + code !== NEWLINE && + code !== TAB && + code !== CR && + code !== FEED + ) { + next += 1 + if (RE_HEX_ESCAPE.test(css.charAt(next))) { + while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) { + next += 1 + } + if (css.charCodeAt(next + 1) === SPACE) { + next += 1 + } + } + } + + currentToken = ['word', css.slice(pos, next + 1), pos, next] + + pos = next + break + } + + default: { + if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) { + next = css.indexOf('*/', pos + 2) + 1 + if (next === 0) { + if (ignore || ignoreUnclosed) { + next = css.length + } else { + unclosed('comment') + } + } + + currentToken = ['comment', css.slice(pos, next + 1), pos, next] + pos = next + } else { + RE_WORD_END.lastIndex = pos + 1 + RE_WORD_END.test(css) + if (RE_WORD_END.lastIndex === 0) { + next = css.length - 1 + } else { + next = RE_WORD_END.lastIndex - 2 + } + + currentToken = ['word', css.slice(pos, next + 1), pos, next] + buffer.push(currentToken) + pos = next + } + + break + } + } + + pos++ + return currentToken + } + + function back(token) { + returned.push(token) + } + + return { + back, + endOfFile, + nextToken, + position + } +} diff --git a/node_modules/postcss/lib/warn-once.js b/node_modules/postcss/lib/warn-once.js new file mode 100644 index 00000000..316e1cf4 --- /dev/null +++ b/node_modules/postcss/lib/warn-once.js @@ -0,0 +1,13 @@ +/* eslint-disable no-console */ +'use strict' + +let printed = {} + +module.exports = function warnOnce(message) { + if (printed[message]) return + printed[message] = true + + if (typeof console !== 'undefined' && console.warn) { + console.warn(message) + } +} diff --git a/node_modules/postcss/lib/warning.d.ts b/node_modules/postcss/lib/warning.d.ts new file mode 100644 index 00000000..b25bba81 --- /dev/null +++ b/node_modules/postcss/lib/warning.d.ts @@ -0,0 +1,147 @@ +import { RangePosition } from './css-syntax-error.js' +import Node from './node.js' + +declare namespace Warning { + export interface WarningOptions { + /** + * End position, exclusive, in CSS node string that caused the warning. + */ + end?: RangePosition + + /** + * End index, exclusive, in CSS node string that caused the warning. + */ + endIndex?: number + + /** + * Start index, inclusive, in CSS node string that caused the warning. + */ + index?: number + + /** + * CSS node that caused the warning. + */ + node?: Node + + /** + * Name of the plugin that created this warning. `Result#warn` fills + * this property automatically. + */ + plugin?: string + + /** + * Start position, inclusive, in CSS node string that caused the warning. + */ + start?: RangePosition + + /** + * Word in CSS source that caused the warning. + */ + word?: string + } + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + export { Warning_ as default } +} + +/** + * Represents a plugin’s warning. It can be created using `Node#warn`. + * + * ```js + * if (decl.important) { + * decl.warn(result, 'Avoid !important', { word: '!important' }) + * } + * ``` + */ +declare class Warning_ { + /** + * Column for inclusive start position in the input file with this warning’s source. + * + * ```js + * warning.column //=> 6 + * ``` + */ + column: number + + /** + * Column for exclusive end position in the input file with this warning’s source. + * + * ```js + * warning.endColumn //=> 4 + * ``` + */ + endColumn?: number + + /** + * Line for exclusive end position in the input file with this warning’s source. + * + * ```js + * warning.endLine //=> 6 + * ``` + */ + endLine?: number + + /** + * Line for inclusive start position in the input file with this warning’s source. + * + * ```js + * warning.line //=> 5 + * ``` + */ + line: number + + /** + * Contains the CSS node that caused the warning. + * + * ```js + * warning.node.toString() //=> 'color: white !important' + * ``` + */ + node: Node + + /** + * The name of the plugin that created this warning. + * When you call `Node#warn` it will fill this property automatically. + * + * ```js + * warning.plugin //=> 'postcss-important' + * ``` + */ + plugin: string + + /** + * The warning message. + * + * ```js + * warning.text //=> 'Try to avoid !important' + * ``` + */ + text: string + + /** + * Type to filter warnings from `Result#messages`. + * Always equal to `"warning"`. + */ + type: 'warning' + + /** + * @param text Warning message. + * @param opts Warning options. + */ + constructor(text: string, opts?: Warning.WarningOptions) + + /** + * Returns a warning position and message. + * + * ```js + * warning.toString() //=> 'postcss-lint:a.css:10:14: Avoid !important' + * ``` + * + * @return Warning position and message. + */ + toString(): string +} + +declare class Warning extends Warning_ {} + +export = Warning diff --git a/node_modules/postcss/lib/warning.js b/node_modules/postcss/lib/warning.js new file mode 100644 index 00000000..3a3d79c9 --- /dev/null +++ b/node_modules/postcss/lib/warning.js @@ -0,0 +1,37 @@ +'use strict' + +class Warning { + constructor(text, opts = {}) { + this.type = 'warning' + this.text = text + + if (opts.node && opts.node.source) { + let range = opts.node.rangeBy(opts) + this.line = range.start.line + this.column = range.start.column + this.endLine = range.end.line + this.endColumn = range.end.column + } + + for (let opt in opts) this[opt] = opts[opt] + } + + toString() { + if (this.node) { + return this.node.error(this.text, { + index: this.index, + plugin: this.plugin, + word: this.word + }).message + } + + if (this.plugin) { + return this.plugin + ': ' + this.text + } + + return this.text + } +} + +module.exports = Warning +Warning.default = Warning diff --git a/node_modules/postcss/package.json b/node_modules/postcss/package.json new file mode 100755 index 00000000..4890c36c --- /dev/null +++ b/node_modules/postcss/package.json @@ -0,0 +1,88 @@ +{ + "name": "postcss", + "version": "8.4.49", + "description": "Tool for transforming styles with JS plugins", + "engines": { + "node": "^10 || ^12 || >=14" + }, + "exports": { + ".": { + "require": "./lib/postcss.js", + "import": "./lib/postcss.mjs" + }, + "./lib/at-rule": "./lib/at-rule.js", + "./lib/comment": "./lib/comment.js", + "./lib/container": "./lib/container.js", + "./lib/css-syntax-error": "./lib/css-syntax-error.js", + "./lib/declaration": "./lib/declaration.js", + "./lib/fromJSON": "./lib/fromJSON.js", + "./lib/input": "./lib/input.js", + "./lib/lazy-result": "./lib/lazy-result.js", + "./lib/no-work-result": "./lib/no-work-result.js", + "./lib/list": "./lib/list.js", + "./lib/map-generator": "./lib/map-generator.js", + "./lib/node": "./lib/node.js", + "./lib/parse": "./lib/parse.js", + "./lib/parser": "./lib/parser.js", + "./lib/postcss": "./lib/postcss.js", + "./lib/previous-map": "./lib/previous-map.js", + "./lib/processor": "./lib/processor.js", + "./lib/result": "./lib/result.js", + "./lib/root": "./lib/root.js", + "./lib/rule": "./lib/rule.js", + "./lib/stringifier": "./lib/stringifier.js", + "./lib/stringify": "./lib/stringify.js", + "./lib/symbols": "./lib/symbols.js", + "./lib/terminal-highlight": "./lib/terminal-highlight.js", + "./lib/tokenize": "./lib/tokenize.js", + "./lib/warn-once": "./lib/warn-once.js", + "./lib/warning": "./lib/warning.js", + "./package.json": "./package.json" + }, + "main": "./lib/postcss.js", + "types": "./lib/postcss.d.ts", + "keywords": [ + "css", + "postcss", + "rework", + "preprocessor", + "parser", + "source map", + "transform", + "manipulation", + "transpiler" + ], + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "author": "Andrey Sitnik ", + "license": "MIT", + "homepage": "https://postcss.org/", + "repository": "postcss/postcss", + "bugs": { + "url": "https://github.com/postcss/postcss/issues" + }, + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "browser": { + "./lib/terminal-highlight": false, + "source-map-js": false, + "path": false, + "url": false, + "fs": false + } +} diff --git a/node_modules/queue-microtask/LICENSE b/node_modules/queue-microtask/LICENSE new file mode 100755 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/queue-microtask/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +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/queue-microtask/README.md b/node_modules/queue-microtask/README.md new file mode 100644 index 00000000..0be05a64 --- /dev/null +++ b/node_modules/queue-microtask/README.md @@ -0,0 +1,90 @@ +# queue-microtask [![ci][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[ci-image]: https://img.shields.io/github/workflow/status/feross/queue-microtask/ci/master +[ci-url]: https://github.com/feross/queue-microtask/actions +[npm-image]: https://img.shields.io/npm/v/queue-microtask.svg +[npm-url]: https://npmjs.org/package/queue-microtask +[downloads-image]: https://img.shields.io/npm/dm/queue-microtask.svg +[downloads-url]: https://npmjs.org/package/queue-microtask +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +### fast, tiny [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask) shim for modern engines + +- Use [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask) in all modern JS engines. +- No dependencies. Less than 10 lines. No shims or complicated fallbacks. +- Optimal performance in all modern environments + - Uses `queueMicrotask` in modern environments + - Fallback to `Promise.resolve().then(fn)` in Node.js 10 and earlier, and old browsers (same performance as `queueMicrotask`) + +## install + +``` +npm install queue-microtask +``` + +## usage + +```js +const queueMicrotask = require('queue-microtask') + +queueMicrotask(() => { /* this will run soon */ }) +``` + +## What is `queueMicrotask` and why would one use it? + +The `queueMicrotask` function is a WHATWG standard. It queues a microtask to be executed prior to control returning to the event loop. + +A microtask is a short function which will run after the current task has completed its work and when there is no other code waiting to be run before control of the execution context is returned to the event loop. + +The code `queueMicrotask(fn)` is equivalent to the code `Promise.resolve().then(fn)`. It is also very similar to [`process.nextTick(fn)`](https://nodejs.org/api/process.html#process_process_nexttick_callback_args) in Node. + +Using microtasks lets code run without interfering with any other, potentially higher priority, code that is pending, but before the JS engine regains control over the execution context. + +See the [spec](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing) or [Node documentation](https://nodejs.org/api/globals.html#globals_queuemicrotask_callback) for more information. + +## Who is this package for? + +This package allows you to use `queueMicrotask` safely in all modern JS engines. Use it if you prioritize small JS bundle size over support for old browsers. + +If you just need to support Node 12 and later, use `queueMicrotask` directly. If you need to support all versions of Node, use this package. + +## Why not use `process.nextTick`? + +In Node, `queueMicrotask` and `process.nextTick` are [essentially equivalent](https://nodejs.org/api/globals.html#globals_queuemicrotask_callback), though there are [subtle differences](https://github.com/YuzuJS/setImmediate#macrotasks-and-microtasks) that don't matter in most situations. + +You can think of `queueMicrotask` as a standardized version of `process.nextTick` that works in the browser. No need to rely on your browser bundler to shim `process` for the browser environment. + +## Why not use `setTimeout(fn, 0)`? + +This approach is the most compatible, but it has problems. Modern browsers throttle timers severely, so `setTimeout(…, 0)` usually takes at least 4ms to run. Furthermore, the throttling gets even worse if the page is backgrounded. If you have many `setTimeout` calls, then this can severely limit the performance of your program. + +## Why not use a microtask library like [`immediate`](https://www.npmjs.com/package/immediate) or [`asap`](https://www.npmjs.com/package/asap)? + +These packages are great! However, if you prioritize small JS bundle size over optimal performance in old browsers then you may want to consider this package. + +This package (`queue-microtask`) is four times smaller than `immediate`, twice as small as `asap`, and twice as small as using `process.nextTick` and letting the browser bundler shim it automatically. + +Note: This package throws an exception in JS environments which lack `Promise` support -- which are usually very old browsers and Node.js versions. + +Since the `queueMicrotask` API is supported in Node.js, Chrome, Firefox, Safari, Opera, and Edge, **the vast majority of users will get optimal performance**. Any JS environment with `Promise`, which is almost all of them, also get optimal performance. If you need support for JS environments which lack `Promise` support, use one of the alternative packages. + +## What is a shim? + +> In computer programming, a shim is a library that transparently intercepts API calls and changes the arguments passed, handles the operation itself or redirects the operation elsewhere. – [Wikipedia](https://en.wikipedia.org/wiki/Shim_(computing)) + +This package could also be described as a "ponyfill". + +> A ponyfill is almost the same as a polyfill, but not quite. Instead of patching functionality for older browsers, a ponyfill provides that functionality as a standalone module you can use. – [PonyFoo](https://ponyfoo.com/articles/polyfills-or-ponyfills) + +## API + +### `queueMicrotask(fn)` + +The `queueMicrotask()` method queues a microtask. + +The `fn` argument is a function to be executed after all pending tasks have completed but before yielding control to the browser's event loop. + +## license + +MIT. Copyright (c) [Feross Aboukhadijeh](https://feross.org). diff --git a/node_modules/queue-microtask/index.d.ts b/node_modules/queue-microtask/index.d.ts new file mode 100644 index 00000000..b6a86463 --- /dev/null +++ b/node_modules/queue-microtask/index.d.ts @@ -0,0 +1,2 @@ +declare const queueMicrotask: (cb: () => void) => void +export = queueMicrotask diff --git a/node_modules/queue-microtask/index.js b/node_modules/queue-microtask/index.js new file mode 100644 index 00000000..55605343 --- /dev/null +++ b/node_modules/queue-microtask/index.js @@ -0,0 +1,9 @@ +/*! queue-microtask. MIT License. Feross Aboukhadijeh */ +let promise + +module.exports = typeof queueMicrotask === 'function' + ? queueMicrotask.bind(typeof window !== 'undefined' ? window : global) + // reuse resolved promise, and allocate it lazily + : cb => (promise || (promise = Promise.resolve())) + .then(cb) + .catch(err => setTimeout(() => { throw err }, 0)) diff --git a/node_modules/queue-microtask/package.json b/node_modules/queue-microtask/package.json new file mode 100644 index 00000000..d29a401f --- /dev/null +++ b/node_modules/queue-microtask/package.json @@ -0,0 +1,55 @@ +{ + "name": "queue-microtask", + "description": "fast, tiny `queueMicrotask` shim for modern engines", + "version": "1.2.3", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "https://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/queue-microtask/issues" + }, + "devDependencies": { + "standard": "*", + "tape": "^5.2.2" + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "homepage": "https://github.com/feross/queue-microtask", + "keywords": [ + "asap", + "immediate", + "micro task", + "microtask", + "nextTick", + "process.nextTick", + "queue micro task", + "queue microtask", + "queue-microtask", + "queueMicrotask", + "setImmediate", + "task" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/queue-microtask.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + } +} diff --git a/node_modules/read-cache/LICENSE b/node_modules/read-cache/LICENSE new file mode 100644 index 00000000..4b98a41f --- /dev/null +++ b/node_modules/read-cache/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2016 Bogdan Chadkin + +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/read-cache/README.md b/node_modules/read-cache/README.md new file mode 100644 index 00000000..16a5c36e --- /dev/null +++ b/node_modules/read-cache/README.md @@ -0,0 +1,46 @@ +# read-cache [![Build Status](https://travis-ci.org/TrySound/read-cache.svg?branch=master)](https://travis-ci.org/TrySound/read-cache) + +Reads and caches the entire contents of a file until it is modified. + + +## Install + +``` +$ npm i read-cache +``` + + +## Usage + +```js +// foo.js +var readCache = require('read-cache'); + +readCache('foo.js').then(function (contents) { + console.log(contents); +}); +``` + + +## API + +### readCache(path[, encoding]) + +Returns a promise that resolves with the file's contents. + +### readCache.sync(path[, encoding]) + +Returns the content of the file. + +### readCache.get(path[, encoding]) + +Returns the content of cached file or null. + +### readCache.clear() + +Clears the contents of the cache. + + +## License + +MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru) diff --git a/node_modules/read-cache/index.js b/node_modules/read-cache/index.js new file mode 100644 index 00000000..b5263e68 --- /dev/null +++ b/node_modules/read-cache/index.js @@ -0,0 +1,78 @@ +var fs = require('fs'); +var path = require('path'); +var pify = require('pify'); + +var stat = pify(fs.stat); +var readFile = pify(fs.readFile); +var resolve = path.resolve; + +var cache = Object.create(null); + +function convert(content, encoding) { + if (Buffer.isEncoding(encoding)) { + return content.toString(encoding); + } + return content; +} + +module.exports = function (path, encoding) { + path = resolve(path); + + return stat(path).then(function (stats) { + var item = cache[path]; + + if (item && item.mtime.getTime() === stats.mtime.getTime()) { + return convert(item.content, encoding); + } + + return readFile(path).then(function (data) { + cache[path] = { + mtime: stats.mtime, + content: data + }; + + return convert(data, encoding); + }); + }).catch(function (err) { + cache[path] = null; + return Promise.reject(err); + }); +}; + +module.exports.sync = function (path, encoding) { + path = resolve(path); + + try { + var stats = fs.statSync(path); + var item = cache[path]; + + if (item && item.mtime.getTime() === stats.mtime.getTime()) { + return convert(item.content, encoding); + } + + var data = fs.readFileSync(path); + + cache[path] = { + mtime: stats.mtime, + content: data + }; + + return convert(data, encoding); + } catch (err) { + cache[path] = null; + throw err; + } + +}; + +module.exports.get = function (path, encoding) { + path = resolve(path); + if (cache[path]) { + return convert(cache[path].content, encoding); + } + return null; +}; + +module.exports.clear = function () { + cache = Object.create(null); +}; diff --git a/node_modules/read-cache/package.json b/node_modules/read-cache/package.json new file mode 100644 index 00000000..87199b0e --- /dev/null +++ b/node_modules/read-cache/package.json @@ -0,0 +1,34 @@ +{ + "name": "read-cache", + "version": "1.0.0", + "description": "Reads and caches the entire contents of a file until it is modified", + "files": [ + "index.js" + ], + "main": "index.js", + "scripts": { + "test": "ava" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/TrySound/read-cache.git" + }, + "keywords": [ + "fs", + "read", + "cache" + ], + "author": "Bogdan Chadkin ", + "license": "MIT", + "bugs": { + "url": "https://github.com/TrySound/read-cache/issues" + }, + "homepage": "https://github.com/TrySound/read-cache#readme", + "devDependencies": { + "ava": "^0.9.1", + "del": "^2.2.0" + }, + "dependencies": { + "pify": "^2.3.0" + } +} diff --git a/node_modules/resolve-from/index.d.ts b/node_modules/resolve-from/index.d.ts new file mode 100644 index 00000000..dd5f5ef6 --- /dev/null +++ b/node_modules/resolve-from/index.d.ts @@ -0,0 +1,31 @@ +declare const resolveFrom: { + /** + Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path. + + @param fromDirectory - Directory to resolve from. + @param moduleId - What you would use in `require()`. + @returns Resolved module path. Throws when the module can't be found. + + @example + ``` + import resolveFrom = require('resolve-from'); + + // There is a file at `./foo/bar.js` + + resolveFrom('foo', './bar'); + //=> '/Users/sindresorhus/dev/test/foo/bar.js' + ``` + */ + (fromDirectory: string, moduleId: string): string; + + /** + Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path. + + @param fromDirectory - Directory to resolve from. + @param moduleId - What you would use in `require()`. + @returns Resolved module path or `undefined` when the module can't be found. + */ + silent(fromDirectory: string, moduleId: string): string | undefined; +}; + +export = resolveFrom; diff --git a/node_modules/resolve-from/index.js b/node_modules/resolve-from/index.js new file mode 100644 index 00000000..44f291c1 --- /dev/null +++ b/node_modules/resolve-from/index.js @@ -0,0 +1,47 @@ +'use strict'; +const path = require('path'); +const Module = require('module'); +const fs = require('fs'); + +const resolveFrom = (fromDirectory, moduleId, silent) => { + if (typeof fromDirectory !== 'string') { + throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``); + } + + if (typeof moduleId !== 'string') { + throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); + } + + try { + fromDirectory = fs.realpathSync(fromDirectory); + } catch (error) { + if (error.code === 'ENOENT') { + fromDirectory = path.resolve(fromDirectory); + } else if (silent) { + return; + } else { + throw error; + } + } + + const fromFile = path.join(fromDirectory, 'noop.js'); + + const resolveFileName = () => Module._resolveFilename(moduleId, { + id: fromFile, + filename: fromFile, + paths: Module._nodeModulePaths(fromDirectory) + }); + + if (silent) { + try { + return resolveFileName(); + } catch (error) { + return; + } + } + + return resolveFileName(); +}; + +module.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId); +module.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true); diff --git a/node_modules/resolve-from/license b/node_modules/resolve-from/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/resolve-from/license @@ -0,0 +1,9 @@ +MIT License + +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/resolve-from/package.json b/node_modules/resolve-from/package.json new file mode 100644 index 00000000..733df162 --- /dev/null +++ b/node_modules/resolve-from/package.json @@ -0,0 +1,36 @@ +{ + "name": "resolve-from", + "version": "5.0.0", + "description": "Resolve the path of a module like `require.resolve()` but from a given path", + "license": "MIT", + "repository": "sindresorhus/resolve-from", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "require", + "resolve", + "path", + "module", + "from", + "like", + "import" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/resolve-from/readme.md b/node_modules/resolve-from/readme.md new file mode 100644 index 00000000..fd4f46f9 --- /dev/null +++ b/node_modules/resolve-from/readme.md @@ -0,0 +1,72 @@ +# resolve-from [![Build Status](https://travis-ci.org/sindresorhus/resolve-from.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-from) + +> Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from a given path + + +## Install + +``` +$ npm install resolve-from +``` + + +## Usage + +```js +const resolveFrom = require('resolve-from'); + +// There is a file at `./foo/bar.js` + +resolveFrom('foo', './bar'); +//=> '/Users/sindresorhus/dev/test/foo/bar.js' +``` + + +## API + +### resolveFrom(fromDirectory, moduleId) + +Like `require()`, throws when the module can't be found. + +### resolveFrom.silent(fromDirectory, moduleId) + +Returns `undefined` instead of throwing when the module can't be found. + +#### fromDirectory + +Type: `string` + +Directory to resolve from. + +#### moduleId + +Type: `string` + +What you would use in `require()`. + + +## Tip + +Create a partial using a bound function if you want to resolve from the same `fromDirectory` multiple times: + +```js +const resolveFromFoo = resolveFrom.bind(null, 'foo'); + +resolveFromFoo('./bar'); +resolveFromFoo('./baz'); +``` + + +## Related + +- [resolve-cwd](https://github.com/sindresorhus/resolve-cwd) - Resolve the path of a module from the current working directory +- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path +- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory +- [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point +- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily +- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/reusify/.coveralls.yml b/node_modules/reusify/.coveralls.yml new file mode 100644 index 00000000..359f6834 --- /dev/null +++ b/node_modules/reusify/.coveralls.yml @@ -0,0 +1 @@ +repo_token: yIxhFqtaaz5iGVYfie9mODehFYogm8S8L diff --git a/node_modules/reusify/.travis.yml b/node_modules/reusify/.travis.yml new file mode 100644 index 00000000..19704768 --- /dev/null +++ b/node_modules/reusify/.travis.yml @@ -0,0 +1,28 @@ +language: node_js +sudo: false + +node_js: + - 9 + - 8 + - 7 + - 6 + - 5 + - 4 + - 4.0 + - iojs-v3 + - iojs-v2 + - iojs-v1 + - 0.12 + - 0.10 + +cache: + directories: + - node_modules + +after_script: +- npm run coverage + +notifications: + email: + on_success: never + on_failure: always diff --git a/node_modules/reusify/LICENSE b/node_modules/reusify/LICENSE new file mode 100644 index 00000000..fbf3a01d --- /dev/null +++ b/node_modules/reusify/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Matteo Collina + +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/reusify/README.md b/node_modules/reusify/README.md new file mode 100644 index 00000000..badcb7cc --- /dev/null +++ b/node_modules/reusify/README.md @@ -0,0 +1,145 @@ +# reusify + +[![npm version][npm-badge]][npm-url] +[![Build Status][travis-badge]][travis-url] +[![Coverage Status][coveralls-badge]][coveralls-url] + +Reuse your objects and functions for maximum speed. This technique will +make any function run ~10% faster. You call your functions a +lot, and it adds up quickly in hot code paths. + +``` +$ node benchmarks/createNoCodeFunction.js +Total time 53133 +Total iterations 100000000 +Iteration/s 1882069.5236482036 + +$ node benchmarks/reuseNoCodeFunction.js +Total time 50617 +Total iterations 100000000 +Iteration/s 1975620.838848608 +``` + +The above benchmark uses fibonacci to simulate a real high-cpu load. +The actual numbers might differ for your use case, but the difference +should not. + +The benchmark was taken using Node v6.10.0. + +This library was extracted from +[fastparallel](http://npm.im/fastparallel). + +## Example + +```js +var reusify = require('reusify') +var fib = require('reusify/benchmarks/fib') +var instance = reusify(MyObject) + +// get an object from the cache, +// or creates a new one when cache is empty +var obj = instance.get() + +// set the state +obj.num = 100 +obj.func() + +// reset the state. +// if the state contains any external object +// do not use delete operator (it is slow) +// prefer set them to null +obj.num = 0 + +// store an object in the cache +instance.release(obj) + +function MyObject () { + // you need to define this property + // so V8 can compile MyObject into an + // hidden class + this.next = null + this.num = 0 + + var that = this + + // this function is never reallocated, + // so it can be optimized by V8 + this.func = function () { + if (null) { + // do nothing + } else { + // calculates fibonacci + fib(that.num) + } + } +} +``` + +The above example was intended for synchronous code, let's see async: +```js +var reusify = require('reusify') +var instance = reusify(MyObject) + +for (var i = 0; i < 100; i++) { + getData(i, console.log) +} + +function getData (value, cb) { + var obj = instance.get() + + obj.value = value + obj.cb = cb + obj.run() +} + +function MyObject () { + this.next = null + this.value = null + + var that = this + + this.run = function () { + asyncOperation(that.value, that.handle) + } + + this.handle = function (err, result) { + that.cb(err, result) + that.value = null + that.cb = null + instance.release(that) + } +} +``` + +Also note how in the above examples, the code, that consumes an istance of `MyObject`, +reset the state to initial condition, just before storing it in the cache. +That's needed so that every subsequent request for an instance from the cache, +could get a clean instance. + +## Why + +It is faster because V8 doesn't have to collect all the functions you +create. On a short-lived benchmark, it is as fast as creating the +nested function, but on a longer time frame it creates less +pressure on the garbage collector. + +## Other examples +If you want to see some complex example, checkout [middie](https://github.com/fastify/middie) and [steed](https://github.com/mcollina/steed). + +## Acknowledgements + +Thanks to [Trevor Norris](https://github.com/trevnorris) for +getting me down the rabbit hole of performance, and thanks to [Mathias +Buss](http://github.com/mafintosh) for suggesting me to share this +trick. + +## License + +MIT + +[npm-badge]: https://badge.fury.io/js/reusify.svg +[npm-url]: https://badge.fury.io/js/reusify +[travis-badge]: https://api.travis-ci.org/mcollina/reusify.svg +[travis-url]: https://travis-ci.org/mcollina/reusify +[coveralls-badge]: https://coveralls.io/repos/mcollina/reusify/badge.svg?branch=master&service=github +[coveralls-url]: https://coveralls.io/github/mcollina/reusify?branch=master diff --git a/node_modules/reusify/benchmarks/createNoCodeFunction.js b/node_modules/reusify/benchmarks/createNoCodeFunction.js new file mode 100644 index 00000000..ce1aac7b --- /dev/null +++ b/node_modules/reusify/benchmarks/createNoCodeFunction.js @@ -0,0 +1,30 @@ +'use strict' + +var fib = require('./fib') +var max = 100000000 +var start = Date.now() + +// create a funcion with the typical error +// pattern, that delegates the heavy load +// to something else +function createNoCodeFunction () { + /* eslint no-constant-condition: "off" */ + var num = 100 + + ;(function () { + if (null) { + // do nothing + } else { + fib(num) + } + })() +} + +for (var i = 0; i < max; i++) { + createNoCodeFunction() +} + +var time = Date.now() - start +console.log('Total time', time) +console.log('Total iterations', max) +console.log('Iteration/s', max / time * 1000) diff --git a/node_modules/reusify/benchmarks/fib.js b/node_modules/reusify/benchmarks/fib.js new file mode 100644 index 00000000..e22cc48d --- /dev/null +++ b/node_modules/reusify/benchmarks/fib.js @@ -0,0 +1,13 @@ +'use strict' + +function fib (num) { + var fib = [] + + fib[0] = 0 + fib[1] = 1 + for (var i = 2; i <= num; i++) { + fib[i] = fib[i - 2] + fib[i - 1] + } +} + +module.exports = fib diff --git a/node_modules/reusify/benchmarks/reuseNoCodeFunction.js b/node_modules/reusify/benchmarks/reuseNoCodeFunction.js new file mode 100644 index 00000000..3358d6e5 --- /dev/null +++ b/node_modules/reusify/benchmarks/reuseNoCodeFunction.js @@ -0,0 +1,38 @@ +'use strict' + +var reusify = require('../') +var fib = require('./fib') +var instance = reusify(MyObject) +var max = 100000000 +var start = Date.now() + +function reuseNoCodeFunction () { + var obj = instance.get() + obj.num = 100 + obj.func() + obj.num = 0 + instance.release(obj) +} + +function MyObject () { + this.next = null + var that = this + this.num = 0 + this.func = function () { + /* eslint no-constant-condition: "off" */ + if (null) { + // do nothing + } else { + fib(that.num) + } + } +} + +for (var i = 0; i < max; i++) { + reuseNoCodeFunction() +} + +var time = Date.now() - start +console.log('Total time', time) +console.log('Total iterations', max) +console.log('Iteration/s', max / time * 1000) diff --git a/node_modules/reusify/package.json b/node_modules/reusify/package.json new file mode 100644 index 00000000..ee66aeec --- /dev/null +++ b/node_modules/reusify/package.json @@ -0,0 +1,45 @@ +{ + "name": "reusify", + "version": "1.0.4", + "description": "Reuse objects and functions with style", + "main": "reusify.js", + "scripts": { + "lint": "standard", + "test": "tape test.js | faucet", + "istanbul": "istanbul cover tape test.js", + "coverage": "npm run istanbul; cat coverage/lcov.info | coveralls" + }, + "pre-commit": [ + "lint", + "test" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/mcollina/reusify.git" + }, + "keywords": [ + "reuse", + "object", + "performance", + "function", + "fast" + ], + "author": "Matteo Collina ", + "license": "MIT", + "bugs": { + "url": "https://github.com/mcollina/reusify/issues" + }, + "homepage": "https://github.com/mcollina/reusify#readme", + "engines": { + "node": ">=0.10.0", + "iojs": ">=1.0.0" + }, + "devDependencies": { + "coveralls": "^2.13.3", + "faucet": "0.0.1", + "istanbul": "^0.4.5", + "pre-commit": "^1.2.2", + "standard": "^10.0.3", + "tape": "^4.8.0" + } +} diff --git a/node_modules/reusify/reusify.js b/node_modules/reusify/reusify.js new file mode 100644 index 00000000..e6f36f3a --- /dev/null +++ b/node_modules/reusify/reusify.js @@ -0,0 +1,33 @@ +'use strict' + +function reusify (Constructor) { + var head = new Constructor() + var tail = head + + function get () { + var current = head + + if (current.next) { + head = current.next + } else { + head = new Constructor() + tail = head + } + + current.next = null + + return current + } + + function release (obj) { + tail.next = obj + tail = obj + } + + return { + get: get, + release: release + } +} + +module.exports = reusify diff --git a/node_modules/reusify/test.js b/node_modules/reusify/test.js new file mode 100644 index 00000000..929cfd71 --- /dev/null +++ b/node_modules/reusify/test.js @@ -0,0 +1,66 @@ +'use strict' + +var test = require('tape') +var reusify = require('./') + +test('reuse objects', function (t) { + t.plan(6) + + function MyObject () { + t.pass('constructor called') + this.next = null + } + + var instance = reusify(MyObject) + var obj = instance.get() + + t.notEqual(obj, instance.get(), 'two instance created') + t.notOk(obj.next, 'next must be null') + + instance.release(obj) + + // the internals keeps a hot copy ready for reuse + // putting this one back in the queue + instance.release(instance.get()) + + // comparing the old one with the one we got + // never do this in real code, after release you + // should never reuse that instance + t.equal(obj, instance.get(), 'instance must be reused') +}) + +test('reuse more than 2 objects', function (t) { + function MyObject () { + t.pass('constructor called') + this.next = null + } + + var instance = reusify(MyObject) + var obj = instance.get() + var obj2 = instance.get() + var obj3 = instance.get() + + t.notOk(obj.next, 'next must be null') + t.notOk(obj2.next, 'next must be null') + t.notOk(obj3.next, 'next must be null') + + t.notEqual(obj, obj2) + t.notEqual(obj, obj3) + t.notEqual(obj3, obj2) + + instance.release(obj) + instance.release(obj2) + instance.release(obj3) + + // skip one + instance.get() + + var obj4 = instance.get() + var obj5 = instance.get() + var obj6 = instance.get() + + t.equal(obj4, obj) + t.equal(obj5, obj2) + t.equal(obj6, obj3) + t.end() +}) diff --git a/node_modules/rimraf/node_modules/minimatch/LICENSE b/node_modules/rimraf/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..1493534e --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +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/rimraf/node_modules/minimatch/README.md b/node_modules/rimraf/node_modules/minimatch/README.md new file mode 100644 index 00000000..3c97a02f --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/README.md @@ -0,0 +1,454 @@ +# minimatch + +A minimal matching utility. + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```js +// hybrid module, load with require() or import +import { minimatch } from 'minimatch' +// or: +const { minimatch } = require('minimatch') + +minimatch('bar.foo', '*.foo') // true! +minimatch('bar.foo', '*.bar') // false! +minimatch('bar.foo', '*.+(bar|foo)', { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +- Brace Expansion +- Extended glob matching +- "Globstar" `**` matching +- [Posix character + classes](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html), + like `[[:alpha:]]`, supporting the full range of Unicode + characters. For example, `[[:alpha:]]` will match against + `'é'`, though `[a-zA-Z]` will not. Collating symbol and set + matching is not supported, so `[[=e=]]` will _not_ match `'é'` + and `[[.ch.]]` will not match `'ch'` in locales where `ch` is + considered a single character. + +See: + +- `man sh` +- `man bash` [Pattern + Matching](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) +- `man 3 fnmatch` +- `man 5 gitignore` + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes in patterns +will always be interpreted as escape characters, not path separators. + +Note that `\` or `/` _will_ be interpreted as path separators in paths on +Windows, and will match against `/` in glob expressions. + +So just always use `/` in patterns. + +### UNC Paths + +On Windows, UNC paths like `//?/c:/...` or +`//ComputerName/Share/...` are handled specially. + +- Patterns starting with a double-slash followed by some + non-slash characters will preserve their double-slash. As a + result, a pattern like `//*` will match `//x`, but not `/x`. +- Patterns staring with `//?/:` will _not_ treat + the `?` as a wildcard character. Instead, it will be treated + as a normal string. +- Patterns starting with `//?/:/...` will match + file paths starting with `:/...`, and vice versa, + as if the `//?/` was not present. This behavior only is + present when the drive letters are a case-insensitive match to + one another. The remaining portions of the path/pattern are + compared case sensitively, unless `nocase:true` is set. + +Note that specifying a UNC path using `\` characters as path +separators is always allowed in the file path argument, but only +allowed in the pattern argument when `windowsPathsNoEscape: true` +is set in the options. + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require('minimatch').Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +- `pattern` The original pattern the minimatch object represents. +- `options` The options supplied to the constructor. +- `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +- `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +- `negate` True if the pattern is negated. +- `comment` True if the pattern is a comment. +- `empty` True if the pattern is `""`. + +### Methods + +- `makeRe()` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +- `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +- `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. +- `hasMagic()` Returns true if the parsed pattern contains any + magic characters. Returns false if all comparator parts are + string literals. If the `magicalBraces` option is set on the + constructor, then it will consider brace expansions which are + not otherwise magical to be magic. If not set, then a pattern + like `a{b,c}d` will return `false`, because neither `abd` nor + `acd` contain any special glob characters. + + This does **not** mean that the pattern string can be used as a + literal filename, as it may contain magic glob characters that + are escaped. For example, the pattern `\\*` or `[*]` would not + be considered to have magic, as the matching portion parses to + the literal string `'*'` and would match a path named `'*'`, + not `'\\*'` or `'[*]'`. The `minimatch.unescape()` method may + be used to remove escape characters. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, '*.js', { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter('*.js', { matchBase: true })) +``` + +### minimatch.escape(pattern, options = {}) + +Escape all magic characters in a glob pattern, so that it will +only ever match literal strings + +If the `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. + +Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot +be escaped or unescaped. + +### minimatch.unescape(pattern, options = {}) + +Un-escape a glob string that may contain some escaped characters. + +If the `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 `'*'`, because `\` 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. + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, '*.js', { matchBase: true }) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nocaseMagicOnly + +When used with `{nocase: true}`, create regular expressions that +are case-insensitive, but leave string match portions untouched. +Has no effect when used without `{nocase: true}` + +Useful when some other form of case-insensitive matching is used, +or if the original string representation is useful in some other +way. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### magicalBraces + +This only affects the results of the `Minimatch.hasMagic` method. + +If the pattern contains brace expansions, such as `a{b,c}d`, but +no other magic characters, then the `Minimatch.hasMagic()` method +will return `false` by default. When this option set, it will +return `true` for brace expansion as well as other magic glob +characters. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + +### partial + +Compare a partial path to a pattern. As long as the parts of the path that +are present are not contradicted by the pattern, it will be treated as a +match. This is useful in applications where you're walking through a +folder structure, and don't yet have the full path, but want to ensure that +you do not walk down paths that can never be a match. + +For example, + +```js +minimatch('/a/b', '/a/*/c/d', { partial: true }) // true, might be /a/b/c/d +minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d +minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a +``` + +### windowsPathsNoEscape + +Use `\\` as a path separator _only_, and _never_ as an escape +character. If set, all `\\` characters are replaced with `/` in +the pattern. Note that this makes it **impossible** to match +against paths containing literal glob pattern characters, but +allows matching with patterns constructed using `path.join()` and +`path.resolve()` on Windows platforms, mimicking the (buggy!) +behavior of earlier versions on Windows. Please use with +caution, and be mindful of [the caveat about Windows +paths](#windows). + +For legacy reasons, this is also set if +`options.allowWindowsEscape` is set to the exact value `false`. + +### windowsNoMagicRoot + +When a pattern starts with a UNC path or drive letter, and in +`nocase:true` mode, do not convert the root portions of the +pattern into a case-insensitive regular expression, and instead +leave them as strings. + +This is the default when the platform is `win32` and +`nocase:true` is set. + +### preserveMultipleSlashes + +By default, multiple `/` characters (other than the leading `//` +in a UNC path, see "UNC Paths" above) are treated as a single +`/`. + +That is, a pattern like `a///b` will match the file path `a/b`. + +Set `preserveMultipleSlashes: true` to suppress this behavior. + +### optimizationLevel + +A number indicating the level of optimization that should be done +to the pattern prior to parsing and using it for matches. + +Globstar parts `**` are always converted to `*` when `noglobstar` +is set, and multiple adjacent `**` parts are converted into a +single `**` (ie, `a/**/**/b` will be treated as `a/**/b`, as this +is equivalent in all cases). + +- `0` - Make no further changes. In this mode, `.` and `..` are + maintained in the pattern, meaning that they must also appear + in the same position in the test path string. Eg, a pattern + like `a/*/../c` will match the string `a/b/../c` but not the + string `a/c`. +- `1` - (default) Remove cases where a double-dot `..` follows a + pattern portion that is not `**`, `.`, `..`, or empty `''`. For + example, the pattern `./a/b/../*` is converted to `./a/*`, and + so it will match the path string `./a/c`, but not the path + string `./a/b/../c`. Dots and empty path portions in the + pattern are preserved. +- `2` (or higher) - Much more aggressive optimizations, suitable + for use with file-walking cases: + + - Remove cases where a double-dot `..` follows a pattern + portion that is not `**`, `.`, or empty `''`. Remove empty + and `.` portions of the pattern, where safe to do so (ie, + anywhere other than the last position, the first position, or + the second position in a pattern starting with `/`, as this + may indicate a UNC path on Windows). + - Convert patterns containing `
    /**/../

    /` into the + equivalent `

    /{..,**}/

    /`, where `

    ` is a + a pattern portion other than `.`, `..`, `**`, or empty + `''`. + - Dedupe patterns where a `**` portion is present in one and + omitted in another, and it is not the final path portion, and + they are otherwise equivalent. So `{a/**/b,a/b}` becomes + `a/**/b`, because `**` matches against an empty path portion. + - Dedupe patterns where a `*` portion is present in one, and a + non-dot pattern other than `**`, `.`, `..`, or `''` is in the + same position in the other. So `a/{*,x}/b` becomes `a/*/b`, + because `*` can match against `x`. + + While these optimizations improve the performance of + file-walking use cases such as [glob](http://npm.im/glob) (ie, + the reason this module exists), there are cases where it will + fail to match a literal string that would have been matched in + optimization level 1 or 0. + + Specifically, while the `Minimatch.match()` method will + optimize the file path string in the same ways, resulting in + the same matches, it will fail when tested with the regular + expression provided by `Minimatch.makeRe()`, unless the path + string is first processed with + `minimatch.levelTwoFileOptimize()` or similar. + +### platform + +When set to `win32`, this will trigger all windows-specific +behaviors (special handling for UNC paths, and treating `\` as +separators in file paths for comparison.) + +Defaults to the value of `process.platform`. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a +worthwhile goal, some discrepancies exist between minimatch and +other implementations. Some are intentional, and some are +unavoidable. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +Negated extglob patterns are handled as closely as possible to +Bash semantics, but there are some cases with negative extglobs +which are exceedingly difficult to express in a JavaScript +regular expression. In particular the negated pattern +`!(*|)*` will in bash match anything that does +not start with ``. However, +`!(*)*` _will_ match paths starting with +``, because the empty string can match against +the negated portion. In this library, `!(*|)*` +will _not_ match any pattern starting with ``, due to a +difference in precisely which patterns are considered "greedy" in +Regular Expressions vs bash path expansion. This may be fixable, +but not without incurring some complexity and performance costs, +and the trade-off seems to not be worth pursuing. + +Note that `fnmatch(3)` in libc is an extremely naive string comparison +matcher, which does not do anything special for slashes. This library is +designed to be used in glob searching and file walkers, and so it does do +special things with `/`. Thus, `foo*` will not match `foo/bar` in this +library, even though it would in `fnmatch(3)`. diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts new file mode 100644 index 00000000..8e318b23 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts @@ -0,0 +1,2 @@ +export declare const assertValidPattern: (pattern: any) => void; +//# sourceMappingURL=assert-valid-pattern.d.ts.map \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map new file mode 100644 index 00000000..c61c0310 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assert-valid-pattern.d.ts","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAUlD,CAAA"} \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js new file mode 100644 index 00000000..5fc86bbd --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js @@ -0,0 +1,14 @@ +"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/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map new file mode 100644 index 00000000..d43215c6 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assert-valid-pattern.js","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAA;AAC7B,MAAM,kBAAkB,GAA2B,CACxD,OAAY,EACe,EAAE;IAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;KACvC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,EAAE;QACvC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAA;KAC3C;AACH,CAAC,CAAA;AAVY,QAAA,kBAAkB,sBAU9B","sourcesContent":["const MAX_PATTERN_LENGTH = 1024 * 64\nexport const assertValidPattern: (pattern: any) => void = (\n pattern: any\n): asserts pattern is string => {\n if (typeof pattern !== 'string') {\n throw new TypeError('invalid pattern')\n }\n\n if (pattern.length > MAX_PATTERN_LENGTH) {\n throw new TypeError('pattern is too long')\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.d.ts new file mode 100644 index 00000000..b8c1e544 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.d.ts @@ -0,0 +1,20 @@ +import { MinimatchOptions, MMRegExp } from './index.js'; +export type ExtglobType = '!' | '?' | '+' | '*' | '@'; +export declare class AST { + #private; + type: ExtglobType | null; + constructor(type: ExtglobType | null, parent?: AST, options?: MinimatchOptions); + get hasMagic(): boolean | undefined; + toString(): string; + push(...parts: (string | AST)[]): void; + toJSON(): any[]; + isStart(): boolean; + isEnd(): boolean; + copyIn(part: AST | string): void; + clone(parent: AST): AST; + static fromGlob(pattern: string, options?: MinimatchOptions): AST; + toMMPattern(): MMRegExp | string; + get options(): MinimatchOptions; + toRegExpSource(allowDot?: boolean): [re: string, body: string, hasMagic: boolean, uflag: boolean]; +} +//# sourceMappingURL=ast.d.ts.map \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.d.ts.map new file mode 100644 index 00000000..9e7bfb9a --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAwCvD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAkCrD,qBAAa,GAAG;;IACd,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;gBAiBtB,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,GAAE,gBAAqB;IAahC,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAUlC;IAGD,QAAQ,IAAI,MAAM;IA+ClB,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE;IAY/B,MAAM;IAgBN,OAAO,IAAI,OAAO;IAgBlB,KAAK,IAAI,OAAO;IAYhB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM;IAKzB,KAAK,CAAC,MAAM,EAAE,GAAG;IAsIjB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAQ/D,WAAW,IAAI,QAAQ,GAAG,MAAM;IA2BhC,IAAI,OAAO,qBAEV;IAuED,cAAc,CACZ,QAAQ,CAAC,EAAE,OAAO,GACjB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC;CAiMjE"} \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.js b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.js new file mode 100644 index 00000000..7b210962 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.js @@ -0,0 +1,592 @@ +"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, + }); + } + get options() { + return this.#options; + } + // 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/rimraf/node_modules/minimatch/dist/commonjs/ast.js.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.js.map new file mode 100644 index 00000000..8383e433 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/ast.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":";AAAA,8BAA8B;;;AAE9B,iEAAmD;AAEnD,+CAAwC;AAwCxC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAA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Q,GAAG,IAAI,CAAA;iBAChB;gBACD,SAAQ;aACT;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,IAAA,iCAAU,EAAC,IAAI,EAAE,CAAC,CAAC,CAAA;gBAC7D,IAAI,QAAQ,EAAE;oBACZ,EAAE,IAAI,GAAG,CAAA;oBACT,KAAK,GAAG,KAAK,IAAI,SAAS,CAAA;oBAC1B,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAA;oBACjB,QAAQ,GAAG,QAAQ,IAAI,KAAK,CAAA;oBAC5B,SAAQ;iBACT;aACF;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,IAAI,OAAO,IAAI,IAAI,KAAK,GAAG;oBAAE,EAAE,IAAI,WAAW,CAAA;;oBACzC,EAAE,IAAI,IAAI,CAAA;gBACf,QAAQ,GAAG,IAAI,CAAA;gBACf,SAAQ;aACT;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,EAAE,IAAI,KAAK,CAAA;gBACX,QAAQ,GAAG,IAAI,CAAA;gBACf,SAAQ;aACT;YACD,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,CAAA;SACtB;QACD,OAAO,CAAC,EAAE,EAAE,IAAA,sBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;CACF;AA/kBD,kBA+kBC","sourcesContent":["// parse a single path portion\n\nimport { parseClass } from './brace-expressions.js'\nimport { MinimatchOptions, MMRegExp } from './index.js'\nimport { unescape } from './unescape.js'\n\n// classes [] are handled by the parseClass method\n// for positive extglobs, we sub-parse the contents, and combine,\n// with the appropriate regexp close.\n// for negative extglobs, we sub-parse the contents, but then\n// have to include the rest of the pattern, then the parent, etc.,\n// as the thing that cannot be because RegExp negative lookaheads\n// are different from globs.\n//\n// So for example:\n// a@(i|w!(x|y)z|j)b => ^a(i|w((!?(x|y)zb).*)z|j)b$\n// 1 2 3 4 5 6 1 2 3 46 5 6\n//\n// Assembling the extglob requires not just the negated patterns themselves,\n// but also anything following the negative patterns up to the boundary\n// of the current pattern, plus anything following in the parent pattern.\n//\n//\n// So, first, we parse the string into an AST of extglobs, without turning\n// anything into regexps yet.\n//\n// ['a', {@ [['i'], ['w', {!['x', 'y']}, 'z'], ['j']]}, 'b']\n//\n// Then, for all the negative extglobs, we append whatever comes after in\n// each parent as their tail\n//\n// ['a', {@ [['i'], ['w', {!['x', 'y'], 'z', 'b'}, 'z'], ['j']]}, 'b']\n//\n// Lastly, we turn each of these pieces into a regexp, and join\n//\n// v----- .* because there's more following,\n// v v otherwise, .+ because it must be\n// v v *something* there.\n// ['^a', {@ ['i', 'w(?:(!?(?:x|y).*zb$).*)z', 'j' ]}, 'b$']\n// copy what follows into here--^^^^^\n// ['^a', '(?:i|w(?:(?!(?:x|y).*zb$).*)z|j)', 'b$']\n// ['^a(?:i|w(?:(?!(?:x|y).*zb$).*)z|j)b$']\n\nexport type ExtglobType = '!' | '?' | '+' | '*' | '@'\nconst types = new Set(['!', '?', '+', '*', '@'])\nconst isExtglobType = (c: string): c is ExtglobType =>\n types.has(c as ExtglobType)\n\n// Patterns that get prepended to bind to the start of either the\n// entire string, or just a single path portion, to prevent dots\n// and/or traversal patterns, when needed.\n// Exts don't need the ^ or / bit, because the root binds that already.\nconst startNoTraversal = '(?!(?:^|/)\\\\.\\\\.?(?:$|/))'\nconst startNoDot = '(?!\\\\.)'\n\n// characters that indicate a start of pattern needs the \"no dots\" bit,\n// because a dot *might* be matched. ( is not in the list, because in\n// the case of a child extglob, it will handle the prevention itself.\nconst addPatternStart = new Set(['[', '.'])\n// cases where traversal is A-OK, no dot prevention needed\nconst justDots = new Set(['..', '.'])\nconst reSpecials = new Set('().*{}+?[]^$\\\\!')\nconst regExpEscape = (s: string) =>\n s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// any single thing other than /\nconst qmark = '[^/]'\n\n// * => any number of characters\nconst star = qmark + '*?'\n// use + when we need to ensure that *something* matches, because the * is\n// the only thing in the path portion.\nconst starNoEmpty = qmark + '+?'\n\n// remove the \\ chars that we added if we end up doing a nonmagic compare\n// const deslash = (s: string) => s.replace(/\\\\(.)/g, '$1')\n\nexport class AST {\n type: ExtglobType | null\n readonly #root: AST\n\n #hasMagic?: boolean\n #uflag: boolean = false\n #parts: (string | AST)[] = []\n readonly #parent?: AST\n readonly #parentIndex: number\n #negs: AST[]\n #filledNegs: boolean = false\n #options: MinimatchOptions\n #toString?: string\n // set to true if it's an extglob with no children\n // (which really means one child of '')\n #emptyExt: boolean = false\n\n constructor(\n type: ExtglobType | null,\n parent?: AST,\n options: MinimatchOptions = {}\n ) {\n this.type = type\n // extglobs are inherently magical\n if (type) this.#hasMagic = true\n this.#parent = parent\n this.#root = this.#parent ? this.#parent.#root : this\n this.#options = this.#root === this ? options : this.#root.#options\n this.#negs = this.#root === this ? [] : this.#root.#negs\n if (type === '!' && !this.#root.#filledNegs) this.#negs.push(this)\n this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0\n }\n\n get hasMagic(): boolean | undefined {\n /* c8 ignore start */\n if (this.#hasMagic !== undefined) return this.#hasMagic\n /* c8 ignore stop */\n for (const p of this.#parts) {\n if (typeof p === 'string') continue\n if (p.type || p.hasMagic) return (this.#hasMagic = true)\n }\n // note: will be undefined until we generate the regexp src and find out\n return this.#hasMagic\n }\n\n // reconstructs the pattern\n toString(): string {\n if (this.#toString !== undefined) return this.#toString\n if (!this.type) {\n return (this.#toString = this.#parts.map(p => String(p)).join(''))\n } else {\n return (this.#toString =\n this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')')\n }\n }\n\n #fillNegs() {\n /* c8 ignore start */\n if (this !== this.#root) throw new Error('should only call on root')\n if (this.#filledNegs) return this\n /* c8 ignore stop */\n\n // call toString() once to fill this out\n this.toString()\n this.#filledNegs = true\n let n: AST | undefined\n while ((n = this.#negs.pop())) {\n if (n.type !== '!') continue\n // walk up the tree, appending everthing that comes AFTER parentIndex\n let p: AST | undefined = n\n let pp = p.#parent\n while (pp) {\n for (\n let i = p.#parentIndex + 1;\n !pp.type && i < pp.#parts.length;\n i++\n ) {\n for (const part of n.#parts) {\n /* c8 ignore start */\n if (typeof part === 'string') {\n throw new Error('string part in extglob AST??')\n }\n /* c8 ignore stop */\n part.copyIn(pp.#parts[i])\n }\n }\n p = pp\n pp = p.#parent\n }\n }\n return this\n }\n\n push(...parts: (string | AST)[]) {\n for (const p of parts) {\n if (p === '') continue\n /* c8 ignore start */\n if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {\n throw new Error('invalid part: ' + p)\n }\n /* c8 ignore stop */\n this.#parts.push(p)\n }\n }\n\n toJSON() {\n const ret: any[] =\n this.type === null\n ? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))\n : [this.type, ...this.#parts.map(p => (p as AST).toJSON())]\n if (this.isStart() && !this.type) ret.unshift([])\n if (\n this.isEnd() &&\n (this === this.#root ||\n (this.#root.#filledNegs && this.#parent?.type === '!'))\n ) {\n ret.push({})\n }\n return ret\n }\n\n isStart(): boolean {\n if (this.#root === this) return true\n // if (this.type) return !!this.#parent?.isStart()\n if (!this.#parent?.isStart()) return false\n if (this.#parentIndex === 0) return true\n // if everything AHEAD of this is a negation, then it's still the \"start\"\n const p = this.#parent\n for (let i = 0; i < this.#parentIndex; i++) {\n const pp = p.#parts[i]\n if (!(pp instanceof AST && pp.type === '!')) {\n return false\n }\n }\n return true\n }\n\n isEnd(): boolean {\n if (this.#root === this) return true\n if (this.#parent?.type === '!') return true\n if (!this.#parent?.isEnd()) return false\n if (!this.type) return this.#parent?.isEnd()\n // if not root, it'll always have a parent\n /* c8 ignore start */\n const pl = this.#parent ? this.#parent.#parts.length : 0\n /* c8 ignore stop */\n return this.#parentIndex === pl - 1\n }\n\n copyIn(part: AST | string) {\n if (typeof part === 'string') this.push(part)\n else this.push(part.clone(this))\n }\n\n clone(parent: AST) {\n const c = new AST(this.type, parent)\n for (const p of this.#parts) {\n c.copyIn(p)\n }\n return c\n }\n\n static #parseAST(\n str: string,\n ast: AST,\n pos: number,\n opt: MinimatchOptions\n ): number {\n let escaping = false\n let inBrace = false\n let braceStart = -1\n let braceNeg = false\n if (ast.type === null) {\n // outside of a extglob, append until we find a start\n let i = pos\n let acc = ''\n while (i < str.length) {\n const c = str.charAt(i++)\n // still accumulate escapes at this point, but we do ignore\n // starts that are escaped\n if (escaping || c === '\\\\') {\n escaping = !escaping\n acc += c\n continue\n }\n\n if (inBrace) {\n if (i === braceStart + 1) {\n if (c === '^' || c === '!') {\n braceNeg = true\n }\n } else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {\n inBrace = false\n }\n acc += c\n continue\n } else if (c === '[') {\n inBrace = true\n braceStart = i\n braceNeg = false\n acc += c\n continue\n }\n\n if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {\n ast.push(acc)\n acc = ''\n const ext = new AST(c, ast)\n i = AST.#parseAST(str, ext, i, opt)\n ast.push(ext)\n continue\n }\n acc += c\n }\n ast.push(acc)\n return i\n }\n\n // some kind of extglob, pos is at the (\n // find the next | or )\n let i = pos + 1\n let part = new AST(null, ast)\n const parts: AST[] = []\n let acc = ''\n while (i < str.length) {\n const c = str.charAt(i++)\n // still accumulate escapes at this point, but we do ignore\n // starts that are escaped\n if (escaping || c === '\\\\') {\n escaping = !escaping\n acc += c\n continue\n }\n\n if (inBrace) {\n if (i === braceStart + 1) {\n if (c === '^' || c === '!') {\n braceNeg = true\n }\n } else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {\n inBrace = false\n }\n acc += c\n continue\n } else if (c === '[') {\n inBrace = true\n braceStart = i\n braceNeg = false\n acc += c\n continue\n }\n\n if (isExtglobType(c) && str.charAt(i) === '(') {\n part.push(acc)\n acc = ''\n const ext = new AST(c, part)\n part.push(ext)\n i = AST.#parseAST(str, ext, i, opt)\n continue\n }\n if (c === '|') {\n part.push(acc)\n acc = ''\n parts.push(part)\n part = new AST(null, ast)\n continue\n }\n if (c === ')') {\n if (acc === '' && ast.#parts.length === 0) {\n ast.#emptyExt = true\n }\n part.push(acc)\n acc = ''\n ast.push(...parts, part)\n return i\n }\n acc += c\n }\n\n // unfinished extglob\n // if we got here, it was a malformed extglob! not an extglob, but\n // maybe something else in there.\n ast.type = null\n ast.#hasMagic = undefined\n ast.#parts = [str.substring(pos - 1)]\n return i\n }\n\n static fromGlob(pattern: string, options: MinimatchOptions = {}) {\n const ast = new AST(null, undefined, options)\n AST.#parseAST(pattern, ast, 0, options)\n return ast\n }\n\n // returns the regular expression if there's magic, or the unescaped\n // string if not.\n toMMPattern(): MMRegExp | string {\n // should only be called on root\n /* c8 ignore start */\n if (this !== this.#root) return this.#root.toMMPattern()\n /* c8 ignore stop */\n const glob = this.toString()\n const [re, body, hasMagic, uflag] = this.toRegExpSource()\n // if we're in nocase mode, and not nocaseMagicOnly, then we do\n // still need a regular expression if we have to case-insensitively\n // match capital/lowercase characters.\n const anyMagic =\n hasMagic ||\n this.#hasMagic ||\n (this.#options.nocase &&\n !this.#options.nocaseMagicOnly &&\n glob.toUpperCase() !== glob.toLowerCase())\n if (!anyMagic) {\n return body\n }\n\n const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '')\n return Object.assign(new RegExp(`^${re}$`, flags), {\n _src: re,\n _glob: glob,\n })\n }\n\n get options() {\n return this.#options\n }\n\n // returns the string match, the regexp source, whether there's magic\n // in the regexp (so a regular expression is required) and whether or\n // not the uflag is needed for the regular expression (for posix classes)\n // TODO: instead of injecting the start/end at this point, just return\n // the BODY of the regexp, along with the start/end portions suitable\n // for binding the start/end in either a joined full-path makeRe context\n // (where we bind to (^|/), or a standalone matchPart context (where\n // we bind to ^, and not /). Otherwise slashes get duped!\n //\n // In part-matching mode, the start is:\n // - if not isStart: nothing\n // - if traversal possible, but not allowed: ^(?!\\.\\.?$)\n // - if dots allowed or not possible: ^\n // - if dots possible and not allowed: ^(?!\\.)\n // end is:\n // - if not isEnd(): nothing\n // - else: $\n //\n // In full-path matching mode, we put the slash at the START of the\n // pattern, so start is:\n // - if first pattern: same as part-matching mode\n // - if not isStart(): nothing\n // - if traversal possible, but not allowed: /(?!\\.\\.?(?:$|/))\n // - if dots allowed or not possible: /\n // - if dots possible and not allowed: /(?!\\.)\n // end is:\n // - if last pattern, same as part-matching mode\n // - else nothing\n //\n // Always put the (?:$|/) on negated tails, though, because that has to be\n // there to bind the end of the negated pattern portion, and it's easier to\n // just stick it in now rather than try to inject it later in the middle of\n // the pattern.\n //\n // We can just always return the same end, and leave it up to the caller\n // to know whether it's going to be used joined or in parts.\n // And, if the start is adjusted slightly, can do the same there:\n // - if not isStart: nothing\n // - if traversal possible, but not allowed: (?:/|^)(?!\\.\\.?$)\n // - if dots allowed or not possible: (?:/|^)\n // - if dots possible and not allowed: (?:/|^)(?!\\.)\n //\n // But it's better to have a simpler binding without a conditional, for\n // performance, so probably better to return both start options.\n //\n // Then the caller just ignores the end if it's not the first pattern,\n // and the start always gets applied.\n //\n // But that's always going to be $ if it's the ending pattern, or nothing,\n // so the caller can just attach $ at the end of the pattern when building.\n //\n // So the todo is:\n // - better detect what kind of start is needed\n // - return both flavors of starting pattern\n // - attach $ at the end of the pattern when creating the actual RegExp\n //\n // Ah, but wait, no, that all only applies to the root when the first pattern\n // is not an extglob. If the first pattern IS an extglob, then we need all\n // that dot prevention biz to live in the extglob portions, because eg\n // +(*|.x*) can match .xy but not .yx.\n //\n // So, return the two flavors if it's #root and the first child is not an\n // AST, otherwise leave it to the child AST to handle it, and there,\n // use the (?:^|/) style of start binding.\n //\n // Even simplified further:\n // - Since the start for a join is eg /(?!\\.) and the start for a part\n // is ^(?!\\.), we can just prepend (?!\\.) to the pattern (either root\n // or start or whatever) and prepend ^ or / at the Regexp construction.\n toRegExpSource(\n allowDot?: boolean\n ): [re: string, body: string, hasMagic: boolean, uflag: boolean] {\n const dot = allowDot ?? !!this.#options.dot\n if (this.#root === this) this.#fillNegs()\n if (!this.type) {\n const noEmpty = this.isStart() && this.isEnd()\n const src = this.#parts\n .map(p => {\n const [re, _, hasMagic, uflag] =\n typeof p === 'string'\n ? AST.#parseGlob(p, this.#hasMagic, noEmpty)\n : p.toRegExpSource(allowDot)\n this.#hasMagic = this.#hasMagic || hasMagic\n this.#uflag = this.#uflag || uflag\n return re\n })\n .join('')\n\n let start = ''\n if (this.isStart()) {\n if (typeof this.#parts[0] === 'string') {\n // this is the string that will match the start of the pattern,\n // so we need to protect against dots and such.\n\n // '.' and '..' cannot match unless the pattern is that exactly,\n // even if it starts with . or dot:true is set.\n const dotTravAllowed =\n this.#parts.length === 1 && justDots.has(this.#parts[0])\n if (!dotTravAllowed) {\n const aps = addPatternStart\n // check if we have a possibility of matching . or ..,\n // and prevent that.\n const needNoTrav =\n // dots are allowed, and the pattern starts with [ or .\n (dot && aps.has(src.charAt(0))) ||\n // the pattern starts with \\., and then [ or .\n (src.startsWith('\\\\.') && aps.has(src.charAt(2))) ||\n // the pattern starts with \\.\\., and then [ or .\n (src.startsWith('\\\\.\\\\.') && aps.has(src.charAt(4)))\n // no need to prevent dots if it can't match a dot, or if a\n // sub-pattern will be preventing it anyway.\n const needNoDot = !dot && !allowDot && aps.has(src.charAt(0))\n\n start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : ''\n }\n }\n }\n\n // append the \"end of path portion\" pattern to negation tails\n let end = ''\n if (\n this.isEnd() &&\n this.#root.#filledNegs &&\n this.#parent?.type === '!'\n ) {\n end = '(?:$|\\\\/)'\n }\n const final = start + src + end\n return [\n final,\n unescape(src),\n (this.#hasMagic = !!this.#hasMagic),\n this.#uflag,\n ]\n }\n\n // We need to calculate the body *twice* if it's a repeat pattern\n // at the start, once in nodot mode, then again in dot mode, so a\n // pattern like *(?) can match 'x.y'\n\n const repeated = this.type === '*' || this.type === '+'\n // some kind of extglob\n const start = this.type === '!' ? '(?:(?!(?:' : '(?:'\n let body = this.#partsToRegExp(dot)\n\n if (this.isStart() && this.isEnd() && !body && this.type !== '!') {\n // invalid extglob, has to at least be *something* present, if it's\n // the entire path portion.\n const s = this.toString()\n this.#parts = [s]\n this.type = null\n this.#hasMagic = undefined\n return [s, unescape(this.toString()), false, false]\n }\n\n // XXX abstract out this map method\n let bodyDotAllowed =\n !repeated || allowDot || dot || !startNoDot\n ? ''\n : this.#partsToRegExp(true)\n if (bodyDotAllowed === body) {\n bodyDotAllowed = ''\n }\n if (bodyDotAllowed) {\n body = `(?:${body})(?:${bodyDotAllowed})*?`\n }\n\n // an empty !() is exactly equivalent to a starNoEmpty\n let final = ''\n if (this.type === '!' && this.#emptyExt) {\n final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty\n } else {\n const close =\n this.type === '!'\n ? // !() must match something,but !(x) can match ''\n '))' +\n (this.isStart() && !dot && !allowDot ? startNoDot : '') +\n star +\n ')'\n : this.type === '@'\n ? ')'\n : this.type === '?'\n ? ')?'\n : this.type === '+' && bodyDotAllowed\n ? ')'\n : this.type === '*' && bodyDotAllowed\n ? `)?`\n : `)${this.type}`\n final = start + body + close\n }\n return [\n final,\n unescape(body),\n (this.#hasMagic = !!this.#hasMagic),\n this.#uflag,\n ]\n }\n\n #partsToRegExp(dot: boolean) {\n return this.#parts\n .map(p => {\n // extglob ASTs should only contain parent ASTs\n /* c8 ignore start */\n if (typeof p === 'string') {\n throw new Error('string type in extglob ast??')\n }\n /* c8 ignore stop */\n // can ignore hasMagic, because extglobs are already always magic\n const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot)\n this.#uflag = this.#uflag || uflag\n return re\n })\n .filter(p => !(this.isStart() && this.isEnd()) || !!p)\n .join('|')\n }\n\n static #parseGlob(\n glob: string,\n hasMagic: boolean | undefined,\n noEmpty: boolean = false\n ): [re: string, body: string, hasMagic: boolean, uflag: boolean] {\n let escaping = false\n let re = ''\n let uflag = false\n for (let i = 0; i < glob.length; i++) {\n const c = glob.charAt(i)\n if (escaping) {\n escaping = false\n re += (reSpecials.has(c) ? '\\\\' : '') + c\n continue\n }\n if (c === '\\\\') {\n if (i === glob.length - 1) {\n re += '\\\\\\\\'\n } else {\n escaping = true\n }\n continue\n }\n if (c === '[') {\n const [src, needUflag, consumed, magic] = parseClass(glob, i)\n if (consumed) {\n re += src\n uflag = uflag || needUflag\n i += consumed - 1\n hasMagic = hasMagic || magic\n continue\n }\n }\n if (c === '*') {\n if (noEmpty && glob === '*') re += starNoEmpty\n else re += star\n hasMagic = true\n continue\n }\n if (c === '?') {\n re += qmark\n hasMagic = true\n continue\n }\n re += regExpEscape(c)\n }\n return [re, unescape(glob), !!hasMagic, uflag]\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts new file mode 100644 index 00000000..b1572deb --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts @@ -0,0 +1,8 @@ +export type ParseClassResult = [ + src: string, + uFlag: boolean, + consumed: number, + hasMagic: boolean +]; +export declare const parseClass: (glob: string, position: number) => ParseClassResult; +//# sourceMappingURL=brace-expressions.d.ts.map \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map new file mode 100644 index 00000000..d3949648 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"brace-expressions.d.ts","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,OAAO;CAClB,CAAA;AAQD,eAAO,MAAM,UAAU,SACf,MAAM,YACF,MAAM,qBA8HjB,CAAA"} \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.js b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.js new file mode 100644 index 00000000..0e13eefc --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.js @@ -0,0 +1,152 @@ +"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/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.js.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.js.map new file mode 100644 index 00000000..86b04756 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/brace-expressions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"brace-expressions.js","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,wCAAwC;;;AAExC,8DAA8D;AAC9D,MAAM,YAAY,GAA0D;IAC1E,WAAW,EAAE,CAAC,sBAAsB,EAAE,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,KAAK,GAAG,QAAQ,GAAG,IAAI,EAAE,KAAK,CAAC;IAC7C,WAAW,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC;IACjC,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;IAC7B,WAAW,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;IAC7B,WAA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E,IAAI,CAAC,CAAA;AAC1C,CAAC,CAAA;AAhIY,QAAA,UAAU,cAgItB","sourcesContent":["// translate the various posix character classes into unicode properties\n// this works across all unicode locales\n\n// { : [, /u flag required, negated]\nconst posixClasses: { [k: string]: [e: string, u: boolean, n?: boolean] } = {\n '[:alnum:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}', true],\n '[:alpha:]': ['\\\\p{L}\\\\p{Nl}', true],\n '[:ascii:]': ['\\\\x' + '00-\\\\x' + '7f', false],\n '[:blank:]': ['\\\\p{Zs}\\\\t', true],\n '[:cntrl:]': ['\\\\p{Cc}', true],\n '[:digit:]': ['\\\\p{Nd}', true],\n '[:graph:]': ['\\\\p{Z}\\\\p{C}', true, true],\n '[:lower:]': ['\\\\p{Ll}', true],\n '[:print:]': ['\\\\p{C}', true],\n '[:punct:]': ['\\\\p{P}', true],\n '[:space:]': ['\\\\p{Z}\\\\t\\\\r\\\\n\\\\v\\\\f', true],\n '[:upper:]': ['\\\\p{Lu}', true],\n '[:word:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}', true],\n '[:xdigit:]': ['A-Fa-f0-9', false],\n}\n\n// only need to escape a few things inside of brace expressions\n// escapes: [ \\ ] -\nconst braceEscape = (s: string) => s.replace(/[[\\]\\\\-]/g, '\\\\$&')\n// escape all regexp magic characters\nconst regexpEscape = (s: string) =>\n s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// everything has already been escaped, we just have to join\nconst rangesToString = (ranges: string[]): string => ranges.join('')\n\nexport type ParseClassResult = [\n src: string,\n uFlag: boolean,\n consumed: number,\n hasMagic: boolean\n]\n\n// takes a glob string at a posix brace expression, and returns\n// an equivalent regular expression source, and boolean indicating\n// whether the /u flag needs to be applied, and the number of chars\n// consumed to parse the character class.\n// This also removes out of order ranges, and returns ($.) if the\n// entire class just no good.\nexport const parseClass = (\n glob: string,\n position: number\n): ParseClassResult => {\n const pos = position\n /* c8 ignore start */\n if (glob.charAt(pos) !== '[') {\n throw new Error('not in a brace expression')\n }\n /* c8 ignore stop */\n const ranges: string[] = []\n const negs: string[] = []\n\n let i = pos + 1\n let sawStart = false\n let uflag = false\n let escaping = false\n let negate = false\n let endPos = pos\n let rangeStart = ''\n WHILE: while (i < glob.length) {\n const c = glob.charAt(i)\n if ((c === '!' || c === '^') && i === pos + 1) {\n negate = true\n i++\n continue\n }\n\n if (c === ']' && sawStart && !escaping) {\n endPos = i + 1\n break\n }\n\n sawStart = true\n if (c === '\\\\') {\n if (!escaping) {\n escaping = true\n i++\n continue\n }\n // escaped \\ char, fall through and treat like normal char\n }\n if (c === '[' && !escaping) {\n // either a posix class, a collation equivalent, or just a [\n for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {\n if (glob.startsWith(cls, i)) {\n // invalid, [a-[] is fine, but not [a-[:alpha]]\n if (rangeStart) {\n return ['$.', false, glob.length - pos, true]\n }\n i += cls.length\n if (neg) negs.push(unip)\n else ranges.push(unip)\n uflag = uflag || u\n continue WHILE\n }\n }\n }\n\n // now it's just a normal character, effectively\n escaping = false\n if (rangeStart) {\n // throw this range away if it's not valid, but others\n // can still match.\n if (c > rangeStart) {\n ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c))\n } else if (c === rangeStart) {\n ranges.push(braceEscape(c))\n }\n rangeStart = ''\n i++\n continue\n }\n\n // now might be the start of a range.\n // can be either c-d or c-] or c] or c] at this point\n if (glob.startsWith('-]', i + 1)) {\n ranges.push(braceEscape(c + '-'))\n i += 2\n continue\n }\n if (glob.startsWith('-', i + 1)) {\n rangeStart = c\n i += 2\n continue\n }\n\n // not the start of a range, just a single character\n ranges.push(braceEscape(c))\n i++\n }\n\n if (endPos < i) {\n // didn't see the end of the class, not a valid class,\n // but might still be valid as a literal match.\n return ['', false, 0, false]\n }\n\n // if we got no ranges and no negates, then we have a range that\n // cannot possibly match anything, and that poisons the whole glob\n if (!ranges.length && !negs.length) {\n return ['$.', false, glob.length - pos, true]\n }\n\n // if we got one positive range, and it's a single character, then that's\n // not actually a magic pattern, it's just that one literal character.\n // we should not treat that as \"magic\", we should just return the literal\n // character. [_] is a perfectly valid way to escape glob magic chars.\n if (\n negs.length === 0 &&\n ranges.length === 1 &&\n /^\\\\?.$/.test(ranges[0]) &&\n !negate\n ) {\n const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]\n return [regexpEscape(r), false, endPos - pos, false]\n }\n\n const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']'\n const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']'\n const comb =\n ranges.length && negs.length\n ? '(' + sranges + '|' + snegs + ')'\n : ranges.length\n ? sranges\n : snegs\n\n return [comb, uflag, endPos - pos, true]\n}\n"]} \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.d.ts new file mode 100644 index 00000000..dc3e3163 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.d.ts @@ -0,0 +1,12 @@ +import { MinimatchOptions } from './index.js'; +/** + * 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 declare const escape: (s: string, { windowsPathsNoEscape, }?: Pick) => string; +//# sourceMappingURL=escape.d.ts.map \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.d.ts.map new file mode 100644 index 00000000..0779dae7 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,MACd,MAAM,8BAGN,KAAK,gBAAgB,EAAE,sBAAsB,CAAC,WAQlD,CAAA"} \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.js b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.js new file mode 100644 index 00000000..02a4f8a8 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.js @@ -0,0 +1,22 @@ +"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/rimraf/node_modules/minimatch/dist/commonjs/escape.js.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.js.map new file mode 100644 index 00000000..264b2ea5 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/escape.js.map @@ -0,0 +1 @@ +{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":";;;AACA;;;;;;;;GAQG;AACI,MAAM,MAAM,GAAG,CACpB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,wDAAwD;IACxD,4DAA4D;IAC5D,sDAAsD;IACtD,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AACvC,CAAC,CAAA;AAZY,QAAA,MAAM,UAYlB","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Escape all magic characters in a glob pattern.\n *\n * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}\n * option is used, then characters are escaped by wrapping in `[]`, because\n * a magic character wrapped in a character class can only be satisfied by\n * that exact character. In this mode, `\\` is _not_ escaped, because it is\n * not interpreted as a magic character, but instead as a path separator.\n */\nexport const escape = (\n s: string,\n {\n windowsPathsNoEscape = false,\n }: Pick = {}\n) => {\n // don't need to escape +@! because we escape the parens\n // that make those magic, and escaping ! as [!] isn't valid,\n // because [!]] is a valid glob class meaning not ']'.\n return windowsPathsNoEscape\n ? s.replace(/[?*()[\\]]/g, '[$&]')\n : s.replace(/[?*()[\\]\\\\]/g, '\\\\$&')\n}\n"]} \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.d.ts new file mode 100644 index 00000000..41d16a98 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.d.ts @@ -0,0 +1,94 @@ +import { AST } from './ast.js'; +type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd'; +export interface MinimatchOptions { + nobrace?: boolean; + nocomment?: boolean; + nonegate?: boolean; + debug?: boolean; + noglobstar?: boolean; + noext?: boolean; + nonull?: boolean; + windowsPathsNoEscape?: boolean; + allowWindowsEscape?: boolean; + partial?: boolean; + dot?: boolean; + nocase?: boolean; + nocaseMagicOnly?: boolean; + magicalBraces?: boolean; + matchBase?: boolean; + flipNegate?: boolean; + preserveMultipleSlashes?: boolean; + optimizationLevel?: number; + platform?: Platform; + windowsNoMagicRoot?: boolean; +} +export declare const minimatch: { + (p: string, pattern: string, options?: MinimatchOptions): boolean; + sep: Sep; + GLOBSTAR: typeof GLOBSTAR; + filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean; + defaults: (def: MinimatchOptions) => typeof minimatch; + braceExpand: (pattern: string, options?: MinimatchOptions) => string[]; + makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp; + match: (list: string[], pattern: string, options?: MinimatchOptions) => string[]; + AST: typeof AST; + Minimatch: typeof Minimatch; + escape: (s: string, { windowsPathsNoEscape, }?: Pick) => string; + unescape: (s: string, { windowsPathsNoEscape, }?: Pick) => string; +}; +type Sep = '\\' | '/'; +export declare const sep: Sep; +export declare const GLOBSTAR: unique symbol; +export declare const filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean; +export declare const defaults: (def: MinimatchOptions) => typeof minimatch; +export declare const braceExpand: (pattern: string, options?: MinimatchOptions) => string[]; +export declare const makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp; +export declare const match: (list: string[], pattern: string, options?: MinimatchOptions) => string[]; +export type MMRegExp = RegExp & { + _src?: string; + _glob?: string; +}; +export type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR; +export type ParseReturn = ParseReturnFiltered | false; +export declare class Minimatch { + options: MinimatchOptions; + set: ParseReturnFiltered[][]; + pattern: string; + windowsPathsNoEscape: boolean; + nonegate: boolean; + negate: boolean; + comment: boolean; + empty: boolean; + preserveMultipleSlashes: boolean; + partial: boolean; + globSet: string[]; + globParts: string[][]; + nocase: boolean; + isWindows: boolean; + platform: Platform; + windowsNoMagicRoot: boolean; + regexp: false | null | MMRegExp; + constructor(pattern: string, options?: MinimatchOptions); + hasMagic(): boolean; + debug(..._: any[]): void; + make(): void; + preprocess(globParts: string[][]): string[][]; + adjascentGlobstarOptimize(globParts: string[][]): string[][]; + levelOneOptimize(globParts: string[][]): string[][]; + levelTwoFileOptimize(parts: string | string[]): string[]; + firstPhasePreProcess(globParts: string[][]): string[][]; + secondPhasePreProcess(globParts: string[][]): string[][]; + partsMatch(a: string[], b: string[], emptyGSMatch?: boolean): false | string[]; + parseNegate(): void; + matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean; + braceExpand(): string[]; + parse(pattern: string): ParseReturn; + makeRe(): false | MMRegExp; + slashSplit(p: string): string[]; + match(f: string, partial?: boolean): boolean; + static defaults(def: MinimatchOptions): typeof Minimatch; +} +export { AST } from './ast.js'; +export { escape } from './escape.js'; +export { unescape } from './unescape.js'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.d.ts.map new file mode 100644 index 00000000..195491d8 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAe,MAAM,UAAU,CAAA;AAI3C,KAAK,QAAQ,GACT,KAAK,GACL,SAAS,GACT,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,kBAAkB,CAAC,EAA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AM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE;IAkBxD,UAAU,CACR,CAAC,EAAE,MAAM,EAAE,EACX,CAAC,EAAE,MAAM,EAAE,EACX,YAAY,GAAE,OAAe,GAC5B,KAAK,GAAG,MAAM,EAAE;IA+CnB,WAAW;IAqBX,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,OAAO,GAAE,OAAe;IAiNzE,WAAW;IAIX,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;IAiDnC,MAAM;IAsFN,UAAU,CAAC,CAAC,EAAE,MAAM;IAepB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,UAAe;IAiEvC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,gBAAgB;CAGtC;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"} \ No newline at end of file diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.js b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.js new file mode 100644 index 00000000..64a0f1f8 --- /dev/null +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.js @@ -0,0 +1,1017 @@ +"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 { + // just collapse multiple ** portions into one + 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) {
    +                    globParts[i] = [];
    +                    globParts[j] = matched;
    +                    break;
    +                }
    +            }
    +        }
    +        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();
    +        if (fastTest && typeof re === 'object') {
    +            // Avoids overriding in frozen environments
    +            Reflect.defineProperty(re, 'test', { value: fastTest });
    +        }
    +        return 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/rimraf/node_modules/minimatch/dist/commonjs/index.js.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.js.map
    new file mode 100644
    index 00000000..d4f6a870
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/index.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAoC;AACpC,uEAA8D;AAC9D,qCAA2C;AAC3C,2CAAoC;AACpC,+CAAwC;AAsCjC,MAAM,SAAS,GAAG,CACvB,CAAS,EACT,OAAe,EACf,UAA4B,EAAE,EAC9B,EAAE;IACF,IAAA,4CAAkB,EAAC,OAAO,CAAC,CAAA;IAE3B,oCAAoC;IACpC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACnD,OAAO,KAAK,CAAA;KACb;IAED,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACjD,CAAC,CAAA;AAbY,QAAA,SAAS,aAarB;AAED,wDAAwD;AACxD,MAAM,YAAY,GAAG,uBAAuB,CAAA;AAC5C,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,CAAS,EAAE,EAAE,CACpD,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACvC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACzE,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAE,EAAE;IAC3C,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;IACvB,OAAO,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,I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AAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;YACjD,IAAI,GAAG,EAAE;gBACP,IAAI,OAAO,CAAC,UAAU,EAAE;oBACtB,OAAO,IAAI,CAAA;iBACZ;gBACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAA;aACpB;SACF;QAED,2DAA2D;QAC3D,8BAA8B;QAC9B,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,OAAO,KAAK,CAAA;SACb;QACD,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,GAAqB;QACnC,OAAO,iBAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,CAAA;IAC1C,CAAC;CACF;AAl4BD,8BAk4BC;AACD,qBAAqB;AACrB,mCAA8B;AAArB,6FAAA,GAAG,OAAA;AACZ,yCAAoC;AAA3B,mGAAA,MAAM,OAAA;AACf,6CAAwC;AAA/B,uGAAA,QAAQ,OAAA;AACjB,oBAAoB;AACpB,iBAAS,CAAC,GAAG,GAAG,YAAG,CAAA;AACnB,iBAAS,CAAC,SAAS,GAAG,SAAS,CAAA;AAC/B,iBAAS,CAAC,MAAM,GAAG,kBAAM,CAAA;AACzB,iBAAS,CAAC,QAAQ,GAAG,sBAAQ,CAAA","sourcesContent":["import expand from 'brace-expansion'\nimport { assertValidPattern } from './assert-valid-pattern.js'\nimport { AST, ExtglobType } from './ast.js'\nimport { escape } from './escape.js'\nimport { unescape } from './unescape.js'\n\ntype Platform =\n  | 'aix'\n  | 'android'\n  | 'darwin'\n  | 'freebsd'\n  | 'haiku'\n  | 'linux'\n  | 'openbsd'\n  | 'sunos'\n  | 'win32'\n  | 'cygwin'\n  | 'netbsd'\n\nexport interface MinimatchOptions {\n  nobrace?: boolean\n  nocomment?: boolean\n  nonegate?: boolean\n  debug?: boolean\n  noglobstar?: boolean\n  noext?: boolean\n  nonull?: boolean\n  windowsPathsNoEscape?: boolean\n  allowWindowsEscape?: boolean\n  partial?: boolean\n  dot?: boolean\n  nocase?: boolean\n  nocaseMagicOnly?: boolean\n  magicalBraces?: boolean\n  matchBase?: boolean\n  flipNegate?: boolean\n  preserveMultipleSlashes?: boolean\n  optimizationLevel?: number\n  platform?: Platform\n  windowsNoMagicRoot?: boolean\n}\n\nexport const minimatch = (\n  p: string,\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  assertValidPattern(pattern)\n\n  // shortcut: comments match nothing.\n  if (!options.nocomment && pattern.charAt(0) === '#') {\n    return false\n  }\n\n  return new Minimatch(pattern, options).match(p)\n}\n\n// Optimized checking for the most common glob patterns.\nconst starDotExtRE = /^\\*+([^+@!?\\*\\[\\(]*)$/\nconst starDotExtTest = (ext: string) => (f: string) =>\n  !f.startsWith('.') && f.endsWith(ext)\nconst starDotExtTestDot = (ext: string) => (f: string) => f.endsWith(ext)\nconst starDotExtTestNocase = (ext: string) => {\n  ext = ext.toLowerCase()\n  return (f: string) => !f.startsWith('.') && f.toLowerCase().endsWith(ext)\n}\nconst starDotExtTestNocaseDot = (ext: string) => {\n  ext = ext.toLowerCase()\n  return (f: string) => f.toLowerCase().endsWith(ext)\n}\nconst starDotStarRE = /^\\*+\\.\\*+$/\nconst starDotStarTest = (f: string) => !f.startsWith('.') && f.includes('.')\nconst starDotStarTestDot = (f: string) =>\n  f !== '.' && f !== '..' && f.includes('.')\nconst dotStarRE = /^\\.\\*+$/\nconst dotStarTest = (f: string) => f !== '.' && f !== '..' && f.startsWith('.')\nconst starRE = /^\\*+$/\nconst starTest = (f: string) => f.length !== 0 && !f.startsWith('.')\nconst starTestDot = (f: string) => f.length !== 0 && f !== '.' && f !== '..'\nconst qmarksRE = /^\\?+([^+@!?\\*\\[\\(]*)?$/\nconst qmarksTestNocase = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExt([$0])\n  if (!ext) return noext\n  ext = ext.toLowerCase()\n  return (f: string) => noext(f) && f.toLowerCase().endsWith(ext)\n}\nconst qmarksTestNocaseDot = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExtDot([$0])\n  if (!ext) return noext\n  ext = ext.toLowerCase()\n  return (f: string) => noext(f) && f.toLowerCase().endsWith(ext)\n}\nconst qmarksTestDot = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExtDot([$0])\n  return !ext ? noext : (f: string) => noext(f) && f.endsWith(ext)\n}\nconst qmarksTest = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExt([$0])\n  return !ext ? noext : (f: string) => noext(f) && f.endsWith(ext)\n}\nconst qmarksTestNoExt = ([$0]: RegExpMatchArray) => {\n  const len = $0.length\n  return (f: string) => f.length === len && !f.startsWith('.')\n}\nconst qmarksTestNoExtDot = ([$0]: RegExpMatchArray) => {\n  const len = $0.length\n  return (f: string) => f.length === len && f !== '.' && f !== '..'\n}\n\n/* c8 ignore start */\nconst defaultPlatform: Platform = (\n  typeof process === 'object' && process\n    ? (typeof process.env === 'object' &&\n        process.env &&\n        process.env.__MINIMATCH_TESTING_PLATFORM__) ||\n      process.platform\n    : 'posix'\n) as Platform\ntype Sep = '\\\\' | '/'\nconst path: { [k: string]: { sep: Sep } } = {\n  win32: { sep: '\\\\' },\n  posix: { sep: '/' },\n}\n/* c8 ignore stop */\n\nexport const sep = defaultPlatform === 'win32' ? path.win32.sep : path.posix.sep\nminimatch.sep = sep\n\nexport const GLOBSTAR = Symbol('globstar **')\nminimatch.GLOBSTAR = GLOBSTAR\n\n// any single thing other than /\n// don't need to escape / when using new RegExp()\nconst qmark = '[^/]'\n\n// * => any number of characters\nconst star = qmark + '*?'\n\n// ** when dots are allowed.  Anything goes, except .. and .\n// not (^ or / followed by one or two dots followed by $ or /),\n// followed by anything, any number of times.\nconst twoStarDot = '(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?'\n\n// not a ^ or / followed by a dot,\n// followed by anything, any number of times.\nconst twoStarNoDot = '(?:(?!(?:\\\\/|^)\\\\.).)*?'\n\nexport const filter =\n  (pattern: string, options: MinimatchOptions = {}) =>\n  (p: string) =>\n    minimatch(p, pattern, options)\nminimatch.filter = filter\n\nconst ext = (a: MinimatchOptions, b: MinimatchOptions = {}) =>\n  Object.assign({}, a, b)\n\nexport const defaults = (def: MinimatchOptions): typeof minimatch => {\n  if (!def || typeof def !== 'object' || !Object.keys(def).length) {\n    return minimatch\n  }\n\n  const orig = minimatch\n\n  const m = (p: string, pattern: string, options: MinimatchOptions = {}) =>\n    orig(p, pattern, ext(def, options))\n\n  return Object.assign(m, {\n    Minimatch: class Minimatch extends orig.Minimatch {\n      constructor(pattern: string, options: MinimatchOptions = {}) {\n        super(pattern, ext(def, options))\n      }\n      static defaults(options: MinimatchOptions) {\n        return orig.defaults(ext(def, options)).Minimatch\n      }\n    },\n\n    AST: class AST extends orig.AST {\n      /* c8 ignore start */\n      constructor(\n        type: ExtglobType | null,\n        parent?: AST,\n        options: MinimatchOptions = {}\n      ) {\n        super(type, parent, ext(def, options))\n      }\n      /* c8 ignore stop */\n\n      static fromGlob(pattern: string, options: MinimatchOptions = {}) {\n        return orig.AST.fromGlob(pattern, ext(def, options))\n      }\n    },\n\n    unescape: (\n      s: string,\n      options: Pick = {}\n    ) => orig.unescape(s, ext(def, options)),\n\n    escape: (\n      s: string,\n      options: Pick = {}\n    ) => orig.escape(s, ext(def, options)),\n\n    filter: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.filter(pattern, ext(def, options)),\n\n    defaults: (options: MinimatchOptions) => orig.defaults(ext(def, options)),\n\n    makeRe: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.makeRe(pattern, ext(def, options)),\n\n    braceExpand: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.braceExpand(pattern, ext(def, options)),\n\n    match: (list: string[], pattern: string, options: MinimatchOptions = {}) =>\n      orig.match(list, pattern, ext(def, options)),\n\n    sep: orig.sep,\n    GLOBSTAR: GLOBSTAR as typeof GLOBSTAR,\n  })\n}\nminimatch.defaults = defaults\n\n// Brace expansion:\n// a{b,c}d -> abd acd\n// a{b,}c -> abc ac\n// a{0..3}d -> a0d a1d a2d a3d\n// a{b,c{d,e}f}g -> abg acdfg acefg\n// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg\n//\n// Invalid sets are not expanded.\n// a{2..}b -> a{2..}b\n// a{b}c -> a{b}c\nexport const braceExpand = (\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  assertValidPattern(pattern)\n\n  // Thanks to Yeting Li  for\n  // improving this regexp to avoid a ReDOS vulnerability.\n  if (options.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(pattern)) {\n    // shortcut. no need to expand.\n    return [pattern]\n  }\n\n  return expand(pattern)\n}\nminimatch.braceExpand = braceExpand\n\n// parse a component of the expanded set.\n// At this point, no pattern may contain \"/\" in it\n// so we're going to return a 2d array, where each entry is the full\n// pattern, split on '/', and then turned into a regular expression.\n// A regexp is made at the end which joins each array with an\n// escaped /, and another full one which joins each regexp with |.\n//\n// Following the lead of Bash 4.1, note that \"**\" only has special meaning\n// when it is the *only* thing in a path portion.  Otherwise, any series\n// of * is equivalent to a single *.  Globstar behavior is enabled by\n// default, and can be disabled by setting options.noglobstar.\n\nexport const makeRe = (pattern: string, options: MinimatchOptions = {}) =>\n  new Minimatch(pattern, options).makeRe()\nminimatch.makeRe = makeRe\n\nexport const match = (\n  list: string[],\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  const mm = new Minimatch(pattern, options)\n  list = list.filter(f => mm.match(f))\n  if (mm.options.nonull && !list.length) {\n    list.push(pattern)\n  }\n  return list\n}\nminimatch.match = match\n\n// replace stuff like \\* with *\nconst globMagic = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/\nconst regExpEscape = (s: string) =>\n  s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\nexport type MMRegExp = RegExp & {\n  _src?: string\n  _glob?: string\n}\n\nexport type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR\nexport type ParseReturn = ParseReturnFiltered | false\n\nexport class Minimatch {\n  options: MinimatchOptions\n  set: ParseReturnFiltered[][]\n  pattern: string\n\n  windowsPathsNoEscape: boolean\n  nonegate: boolean\n  negate: boolean\n  comment: boolean\n  empty: boolean\n  preserveMultipleSlashes: boolean\n  partial: boolean\n  globSet: string[]\n  globParts: string[][]\n  nocase: boolean\n\n  isWindows: boolean\n  platform: Platform\n  windowsNoMagicRoot: boolean\n\n  regexp: false | null | MMRegExp\n  constructor(pattern: string, options: MinimatchOptions = {}) {\n    assertValidPattern(pattern)\n\n    options = options || {}\n    this.options = options\n    this.pattern = pattern\n    this.platform = options.platform || defaultPlatform\n    this.isWindows = this.platform === 'win32'\n    this.windowsPathsNoEscape =\n      !!options.windowsPathsNoEscape || options.allowWindowsEscape === false\n    if (this.windowsPathsNoEscape) {\n      this.pattern = this.pattern.replace(/\\\\/g, '/')\n    }\n    this.preserveMultipleSlashes = !!options.preserveMultipleSlashes\n    this.regexp = null\n    this.negate = false\n    this.nonegate = !!options.nonegate\n    this.comment = false\n    this.empty = false\n    this.partial = !!options.partial\n    this.nocase = !!this.options.nocase\n    this.windowsNoMagicRoot =\n      options.windowsNoMagicRoot !== undefined\n        ? options.windowsNoMagicRoot\n        : !!(this.isWindows && this.nocase)\n\n    this.globSet = []\n    this.globParts = []\n    this.set = []\n\n    // make the set of regexps etc.\n    this.make()\n  }\n\n  hasMagic(): boolean {\n    if (this.options.magicalBraces && this.set.length > 1) {\n      return true\n    }\n    for (const pattern of this.set) {\n      for (const part of pattern) {\n        if (typeof part !== 'string') return true\n      }\n    }\n    return false\n  }\n\n  debug(..._: any[]) {}\n\n  make() {\n    const pattern = this.pattern\n    const options = this.options\n\n    // empty patterns and comments match nothing.\n    if (!options.nocomment && pattern.charAt(0) === '#') {\n      this.comment = true\n      return\n    }\n\n    if (!pattern) {\n      this.empty = true\n      return\n    }\n\n    // step 1: figure out negation, etc.\n    this.parseNegate()\n\n    // step 2: expand braces\n    this.globSet = [...new Set(this.braceExpand())]\n\n    if (options.debug) {\n      this.debug = (...args: any[]) => console.error(...args)\n    }\n\n    this.debug(this.pattern, this.globSet)\n\n    // step 3: now we have a set, so turn each one into a series of\n    // path-portion matching patterns.\n    // These will be regexps, except in the case of \"**\", which is\n    // set to the GLOBSTAR object for globstar behavior,\n    // and will not contain any / characters\n    //\n    // First, we preprocess to make the glob pattern sets a bit simpler\n    // and deduped.  There are some perf-killing patterns that can cause\n    // problems with a glob walk, but we can simplify them down a bit.\n    const rawGlobParts = this.globSet.map(s => this.slashSplit(s))\n    this.globParts = this.preprocess(rawGlobParts)\n    this.debug(this.pattern, this.globParts)\n\n    // glob --> regexps\n    let set = this.globParts.map((s, _, __) => {\n      if (this.isWindows && this.windowsNoMagicRoot) {\n        // check if it's a drive or unc path.\n        const isUNC =\n          s[0] === '' &&\n          s[1] === '' &&\n          (s[2] === '?' || !globMagic.test(s[2])) &&\n          !globMagic.test(s[3])\n        const isDrive = /^[a-z]:/i.test(s[0])\n        if (isUNC) {\n          return [...s.slice(0, 4), ...s.slice(4).map(ss => this.parse(ss))]\n        } else if (isDrive) {\n          return [s[0], ...s.slice(1).map(ss => this.parse(ss))]\n        }\n      }\n      return s.map(ss => this.parse(ss))\n    })\n\n    this.debug(this.pattern, set)\n\n    // filter out everything that didn't compile properly.\n    this.set = set.filter(\n      s => s.indexOf(false) === -1\n    ) as ParseReturnFiltered[][]\n\n    // do not treat the ? in UNC paths as magic\n    if (this.isWindows) {\n      for (let i = 0; i < this.set.length; i++) {\n        const p = this.set[i]\n        if (\n          p[0] === '' &&\n          p[1] === '' &&\n          this.globParts[i][2] === '?' &&\n          typeof p[3] === 'string' &&\n          /^[a-z]:$/i.test(p[3])\n        ) {\n          p[2] = '?'\n        }\n      }\n    }\n\n    this.debug(this.pattern, this.set)\n  }\n\n  // various transforms to equivalent pattern sets that are\n  // faster to process in a filesystem walk.  The goal is to\n  // eliminate what we can, and push all ** patterns as far\n  // to the right as possible, even if it increases the number\n  // of patterns that we have to process.\n  preprocess(globParts: string[][]) {\n    // if we're not in globstar mode, then turn all ** into *\n    if (this.options.noglobstar) {\n      for (let i = 0; i < globParts.length; i++) {\n        for (let j = 0; j < globParts[i].length; j++) {\n          if (globParts[i][j] === '**') {\n            globParts[i][j] = '*'\n          }\n        }\n      }\n    }\n\n    const { optimizationLevel = 1 } = this.options\n\n    if (optimizationLevel >= 2) {\n      // aggressive optimization for the purpose of fs walking\n      globParts = this.firstPhasePreProcess(globParts)\n      globParts = this.secondPhasePreProcess(globParts)\n    } else if (optimizationLevel >= 1) {\n      // just basic optimizations to remove some .. parts\n      globParts = this.levelOneOptimize(globParts)\n    } else {\n      // just collapse multiple ** portions into one\n      globParts = this.adjascentGlobstarOptimize(globParts)\n    }\n\n    return globParts\n  }\n\n  // just get rid of adjascent ** portions\n  adjascentGlobstarOptimize(globParts: string[][]) {\n    return globParts.map(parts => {\n      let gs: number = -1\n      while (-1 !== (gs = parts.indexOf('**', gs + 1))) {\n        let i = gs\n        while (parts[i + 1] === '**') {\n          i++\n        }\n        if (i !== gs) {\n          parts.splice(gs, i - gs)\n        }\n      }\n      return parts\n    })\n  }\n\n  // get rid of adjascent ** and resolve .. portions\n  levelOneOptimize(globParts: string[][]) {\n    return globParts.map(parts => {\n      parts = parts.reduce((set: string[], part) => {\n        const prev = set[set.length - 1]\n        if (part === '**' && prev === '**') {\n          return set\n        }\n        if (part === '..') {\n          if (prev && prev !== '..' && prev !== '.' && prev !== '**') {\n            set.pop()\n            return set\n          }\n        }\n        set.push(part)\n        return set\n      }, [])\n      return parts.length === 0 ? [''] : parts\n    })\n  }\n\n  levelTwoFileOptimize(parts: string | string[]) {\n    if (!Array.isArray(parts)) {\n      parts = this.slashSplit(parts)\n    }\n    let didSomething: boolean = false\n    do {\n      didSomething = false\n      // 
    // -> 
    /\n      if (!this.preserveMultipleSlashes) {\n        for (let i = 1; i < parts.length - 1; i++) {\n          const p = parts[i]\n          // don't squeeze out UNC patterns\n          if (i === 1 && p === '' && parts[0] === '') continue\n          if (p === '.' || p === '') {\n            didSomething = true\n            parts.splice(i, 1)\n            i--\n          }\n        }\n        if (\n          parts[0] === '.' &&\n          parts.length === 2 &&\n          (parts[1] === '.' || parts[1] === '')\n        ) {\n          didSomething = true\n          parts.pop()\n        }\n      }\n\n      // 
    /

    /../ ->

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

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

    /**/../

    /

    / -> {

    /../

    /

    /,

    /**/

    /

    /}\n //

    // -> 
    /\n  // 
    /

    /../ ->

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

    /

    / -> {

    /../

    /

    /,

    /**/

    /

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

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

    /../ ->

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

    /} ->

    /*/\n  // {
    /,
    /} -> 
    /\n  // {
    /**/,
    /} -> 
    /**/\n  //\n  // {
    /**/,
    /**/

    /} ->

    /**/\n  // ^-- not valid because ** doens't follow symlinks\n  secondPhasePreProcess(globParts: string[][]): string[][] {\n    for (let i = 0; i < globParts.length - 1; i++) {\n      for (let j = i + 1; j < globParts.length; j++) {\n        const matched = this.partsMatch(\n          globParts[i],\n          globParts[j],\n          !this.preserveMultipleSlashes\n        )\n        if (matched) {\n          globParts[i] = []\n          globParts[j] = matched\n          break\n        }\n      }\n    }\n    return globParts.filter(gs => gs.length)\n  }\n\n  partsMatch(\n    a: string[],\n    b: string[],\n    emptyGSMatch: boolean = false\n  ): false | string[] {\n    let ai = 0\n    let bi = 0\n    let result: string[] = []\n    let which: string = ''\n    while (ai < a.length && bi < b.length) {\n      if (a[ai] === b[bi]) {\n        result.push(which === 'b' ? b[bi] : a[ai])\n        ai++\n        bi++\n      } else if (emptyGSMatch && a[ai] === '**' && b[bi] === a[ai + 1]) {\n        result.push(a[ai])\n        ai++\n      } else if (emptyGSMatch && b[bi] === '**' && a[ai] === b[bi + 1]) {\n        result.push(b[bi])\n        bi++\n      } else if (\n        a[ai] === '*' &&\n        b[bi] &&\n        (this.options.dot || !b[bi].startsWith('.')) &&\n        b[bi] !== '**'\n      ) {\n        if (which === 'b') return false\n        which = 'a'\n        result.push(a[ai])\n        ai++\n        bi++\n      } else if (\n        b[bi] === '*' &&\n        a[ai] &&\n        (this.options.dot || !a[ai].startsWith('.')) &&\n        a[ai] !== '**'\n      ) {\n        if (which === 'a') return false\n        which = 'b'\n        result.push(b[bi])\n        ai++\n        bi++\n      } else {\n        return false\n      }\n    }\n    // if we fall out of the loop, it means they two are identical\n    // as long as their lengths match\n    return a.length === b.length && result\n  }\n\n  parseNegate() {\n    if (this.nonegate) return\n\n    const pattern = this.pattern\n    let negate = false\n    let negateOffset = 0\n\n    for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {\n      negate = !negate\n      negateOffset++\n    }\n\n    if (negateOffset) this.pattern = pattern.slice(negateOffset)\n    this.negate = negate\n  }\n\n  // set partial to true to test if, for example,\n  // \"/a/b\" matches the start of \"/*/b/*/d\"\n  // Partial means, if you run out of file before you run\n  // out of pattern, then that's fine, as long as all\n  // the parts match.\n  matchOne(file: string[], pattern: ParseReturn[], partial: boolean = false) {\n    const options = this.options\n\n    // UNC paths like //?/X:/... can match X:/... and vice versa\n    // Drive letters in absolute drive or unc paths are always compared\n    // case-insensitively.\n    if (this.isWindows) {\n      const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0])\n      const fileUNC =\n        !fileDrive &&\n        file[0] === '' &&\n        file[1] === '' &&\n        file[2] === '?' &&\n        /^[a-z]:$/i.test(file[3])\n\n      const patternDrive =\n        typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0])\n      const patternUNC =\n        !patternDrive &&\n        pattern[0] === '' &&\n        pattern[1] === '' &&\n        pattern[2] === '?' &&\n        typeof pattern[3] === 'string' &&\n        /^[a-z]:$/i.test(pattern[3])\n\n      const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined\n      const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined\n      if (typeof fdi === 'number' && typeof pdi === 'number') {\n        const [fd, pd]: [string, string] = [file[fdi], pattern[pdi] as string]\n        if (fd.toLowerCase() === pd.toLowerCase()) {\n          pattern[pdi] = fd\n          if (pdi > fdi) {\n            pattern = pattern.slice(pdi)\n          } else if (fdi > pdi) {\n            file = file.slice(fdi)\n          }\n        }\n      }\n    }\n\n    // resolve and reduce . and .. portions in the file as well.\n    // dont' need to do the second phase, because it's only one string[]\n    const { optimizationLevel = 1 } = this.options\n    if (optimizationLevel >= 2) {\n      file = this.levelTwoFileOptimize(file)\n    }\n\n    this.debug('matchOne', this, { file, pattern })\n    this.debug('matchOne', file.length, pattern.length)\n\n    for (\n      var fi = 0, pi = 0, fl = file.length, pl = pattern.length;\n      fi < fl && pi < pl;\n      fi++, pi++\n    ) {\n      this.debug('matchOne loop')\n      var p = pattern[pi]\n      var f = file[fi]\n\n      this.debug(pattern, p, f)\n\n      // should be impossible.\n      // some invalid regexp stuff in the set.\n      /* c8 ignore start */\n      if (p === false) {\n        return false\n      }\n      /* c8 ignore stop */\n\n      if (p === GLOBSTAR) {\n        this.debug('GLOBSTAR', [pattern, p, f])\n\n        // \"**\"\n        // a/**/b/**/c would match the following:\n        // a/b/x/y/z/c\n        // a/x/y/z/b/c\n        // a/b/x/b/x/c\n        // a/b/c\n        // To do this, take the rest of the pattern after\n        // the **, and see if it would match the file remainder.\n        // If so, return success.\n        // If not, the ** \"swallows\" a segment, and try again.\n        // This is recursively awful.\n        //\n        // a/**/b/**/c matching a/b/x/y/z/c\n        // - a matches a\n        // - doublestar\n        //   - matchOne(b/x/y/z/c, b/**/c)\n        //     - b matches b\n        //     - doublestar\n        //       - matchOne(x/y/z/c, c) -> no\n        //       - matchOne(y/z/c, c) -> no\n        //       - matchOne(z/c, c) -> no\n        //       - matchOne(c, c) yes, hit\n        var fr = fi\n        var pr = pi + 1\n        if (pr === pl) {\n          this.debug('** at the end')\n          // a ** at the end will just swallow the rest.\n          // We have found a match.\n          // however, it will not swallow /.x, unless\n          // options.dot is set.\n          // . and .. are *never* matched by **, for explosively\n          // exponential reasons.\n          for (; fi < fl; fi++) {\n            if (\n              file[fi] === '.' ||\n              file[fi] === '..' ||\n              (!options.dot && file[fi].charAt(0) === '.')\n            )\n              return false\n          }\n          return true\n        }\n\n        // ok, let's see if we can swallow whatever we can.\n        while (fr < fl) {\n          var swallowee = file[fr]\n\n          this.debug('\\nglobstar while', file, fr, pattern, pr, swallowee)\n\n          // XXX remove this slice.  Just pass the start index.\n          if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {\n            this.debug('globstar found match!', fr, fl, swallowee)\n            // found a match.\n            return true\n          } else {\n            // can't swallow \".\" or \"..\" ever.\n            // can only swallow \".foo\" when explicitly asked.\n            if (\n              swallowee === '.' ||\n              swallowee === '..' ||\n              (!options.dot && swallowee.charAt(0) === '.')\n            ) {\n              this.debug('dot detected!', file, fr, pattern, pr)\n              break\n            }\n\n            // ** swallows a segment, and continue.\n            this.debug('globstar swallow a segment, and continue')\n            fr++\n          }\n        }\n\n        // no match was found.\n        // However, in partial mode, we can't say this is necessarily over.\n        /* c8 ignore start */\n        if (partial) {\n          // ran out of file\n          this.debug('\\n>>> no match, partial?', file, fr, pattern, pr)\n          if (fr === fl) {\n            return true\n          }\n        }\n        /* c8 ignore stop */\n        return false\n      }\n\n      // something other than **\n      // non-magic patterns just have to match exactly\n      // patterns with magic have been turned into regexps.\n      let hit: boolean\n      if (typeof p === 'string') {\n        hit = f === p\n        this.debug('string match', p, f, hit)\n      } else {\n        hit = p.test(f)\n        this.debug('pattern match', p, f, hit)\n      }\n\n      if (!hit) return false\n    }\n\n    // Note: ending in / means that we'll get a final \"\"\n    // at the end of the pattern.  This can only match a\n    // corresponding \"\" at the end of the file.\n    // If the file ends in /, then it can only match a\n    // a pattern that ends in /, unless the pattern just\n    // doesn't have any more for it. But, a/b/ should *not*\n    // match \"a/b/*\", even though \"\" matches against the\n    // [^/]*? pattern, except in partial mode, where it might\n    // simply not be reached yet.\n    // However, a/b/ should still satisfy a/*\n\n    // now either we fell off the end of the pattern, or we're done.\n    if (fi === fl && pi === pl) {\n      // ran out of pattern and filename at the same time.\n      // an exact hit!\n      return true\n    } else if (fi === fl) {\n      // ran out of file, but still had pattern left.\n      // this is ok if we're doing the match as part of\n      // a glob fs traversal.\n      return partial\n    } else if (pi === pl) {\n      // ran out of pattern, still have file left.\n      // this is only acceptable if we're on the very last\n      // empty segment of a file with a trailing slash.\n      // a/* should match a/b/\n      return fi === fl - 1 && file[fi] === ''\n\n      /* c8 ignore start */\n    } else {\n      // should be unreachable.\n      throw new Error('wtf?')\n    }\n    /* c8 ignore stop */\n  }\n\n  braceExpand() {\n    return braceExpand(this.pattern, this.options)\n  }\n\n  parse(pattern: string): ParseReturn {\n    assertValidPattern(pattern)\n\n    const options = this.options\n\n    // shortcuts\n    if (pattern === '**') return GLOBSTAR\n    if (pattern === '') return ''\n\n    // far and away, the most common glob pattern parts are\n    // *, *.*, and *.  Add a fast check method for those.\n    let m: RegExpMatchArray | null\n    let fastTest: null | ((f: string) => boolean) = null\n    if ((m = pattern.match(starRE))) {\n      fastTest = options.dot ? starTestDot : starTest\n    } else if ((m = pattern.match(starDotExtRE))) {\n      fastTest = (\n        options.nocase\n          ? options.dot\n            ? starDotExtTestNocaseDot\n            : starDotExtTestNocase\n          : options.dot\n          ? starDotExtTestDot\n          : starDotExtTest\n      )(m[1])\n    } else if ((m = pattern.match(qmarksRE))) {\n      fastTest = (\n        options.nocase\n          ? options.dot\n            ? qmarksTestNocaseDot\n            : qmarksTestNocase\n          : options.dot\n          ? qmarksTestDot\n          : qmarksTest\n      )(m)\n    } else if ((m = pattern.match(starDotStarRE))) {\n      fastTest = options.dot ? starDotStarTestDot : starDotStarTest\n    } else if ((m = pattern.match(dotStarRE))) {\n      fastTest = dotStarTest\n    }\n\n    const re = AST.fromGlob(pattern, this.options).toMMPattern()\n    if (fastTest && typeof re === 'object') {\n      // Avoids overriding in frozen environments\n      Reflect.defineProperty(re, 'test', { value: fastTest })\n    }\n    return re\n  }\n\n  makeRe() {\n    if (this.regexp || this.regexp === false) return this.regexp\n\n    // at this point, this.set is a 2d array of partial\n    // pattern strings, or \"**\".\n    //\n    // It's better to use .match().  This function shouldn't\n    // be used, really, but it's pretty convenient sometimes,\n    // when you just want to work with a regex.\n    const set = this.set\n\n    if (!set.length) {\n      this.regexp = false\n      return this.regexp\n    }\n    const options = this.options\n\n    const twoStar = options.noglobstar\n      ? star\n      : options.dot\n      ? twoStarDot\n      : twoStarNoDot\n    const flags = new Set(options.nocase ? ['i'] : [])\n\n    // regexpify non-globstar patterns\n    // if ** is only item, then we just do one twoStar\n    // if ** is first, and there are more, prepend (\\/|twoStar\\/)? to next\n    // if ** is last, append (\\/twoStar|) to previous\n    // if ** is in the middle, append (\\/|\\/twoStar\\/) to previous\n    // then filter out GLOBSTAR symbols\n    let re = set\n      .map(pattern => {\n        const pp: (string | typeof GLOBSTAR)[] = pattern.map(p => {\n          if (p instanceof RegExp) {\n            for (const f of p.flags.split('')) flags.add(f)\n          }\n          return typeof p === 'string'\n            ? regExpEscape(p)\n            : p === GLOBSTAR\n            ? GLOBSTAR\n            : p._src\n        }) as (string | typeof GLOBSTAR)[]\n        pp.forEach((p, i) => {\n          const next = pp[i + 1]\n          const prev = pp[i - 1]\n          if (p !== GLOBSTAR || prev === GLOBSTAR) {\n            return\n          }\n          if (prev === undefined) {\n            if (next !== undefined && next !== GLOBSTAR) {\n              pp[i + 1] = '(?:\\\\/|' + twoStar + '\\\\/)?' + next\n            } else {\n              pp[i] = twoStar\n            }\n          } else if (next === undefined) {\n            pp[i - 1] = prev + '(?:\\\\/|' + twoStar + ')?'\n          } else if (next !== GLOBSTAR) {\n            pp[i - 1] = prev + '(?:\\\\/|\\\\/' + twoStar + '\\\\/)' + next\n            pp[i + 1] = GLOBSTAR\n          }\n        })\n        return pp.filter(p => p !== GLOBSTAR).join('/')\n      })\n      .join('|')\n\n    // need to wrap in parens if we had more than one thing with |,\n    // otherwise only the first will be anchored to ^ and the last to $\n    const [open, close] = set.length > 1 ? ['(?:', ')'] : ['', '']\n    // must match entire pattern\n    // ending in a * or ** will make it less strict.\n    re = '^' + open + re + close + '$'\n\n    // can match anything, as long as it's not this.\n    if (this.negate) re = '^(?!' + re + ').+$'\n\n    try {\n      this.regexp = new RegExp(re, [...flags].join(''))\n      /* c8 ignore start */\n    } catch (ex) {\n      // should be impossible\n      this.regexp = false\n    }\n    /* c8 ignore stop */\n    return this.regexp\n  }\n\n  slashSplit(p: string) {\n    // if p starts with // on windows, we preserve that\n    // so that UNC paths aren't broken.  Otherwise, any number of\n    // / characters are coalesced into one, unless\n    // preserveMultipleSlashes is set to true.\n    if (this.preserveMultipleSlashes) {\n      return p.split('/')\n    } else if (this.isWindows && /^\\/\\/[^\\/]+/.test(p)) {\n      // add an extra '' for the one we lose\n      return ['', ...p.split(/\\/+/)]\n    } else {\n      return p.split(/\\/+/)\n    }\n  }\n\n  match(f: string, partial = this.partial) {\n    this.debug('match', f, this.pattern)\n    // short-circuit in the case of busted things.\n    // comments, etc.\n    if (this.comment) {\n      return false\n    }\n    if (this.empty) {\n      return f === ''\n    }\n\n    if (f === '/' && partial) {\n      return true\n    }\n\n    const options = this.options\n\n    // windows: need to use /, not \\\n    if (this.isWindows) {\n      f = f.split('\\\\').join('/')\n    }\n\n    // treat the test path as a set of pathparts.\n    const ff = this.slashSplit(f)\n    this.debug(this.pattern, 'split', ff)\n\n    // just ONE of the pattern sets in this.set needs to match\n    // in order for it to be valid.  If negating, then just one\n    // match means that we have failed.\n    // Either way, return on the first hit.\n\n    const set = this.set\n    this.debug(this.pattern, 'set', set)\n\n    // Find the basename of the path by looking for the last non-empty segment\n    let filename: string = ff[ff.length - 1]\n    if (!filename) {\n      for (let i = ff.length - 2; !filename && i >= 0; i--) {\n        filename = ff[i]\n      }\n    }\n\n    for (let i = 0; i < set.length; i++) {\n      const pattern = set[i]\n      let file = ff\n      if (options.matchBase && pattern.length === 1) {\n        file = [filename]\n      }\n      const hit = this.matchOne(file, pattern, partial)\n      if (hit) {\n        if (options.flipNegate) {\n          return true\n        }\n        return !this.negate\n      }\n    }\n\n    // didn't get any hits.  this is success if it's a negative\n    // pattern, failure otherwise.\n    if (options.flipNegate) {\n      return false\n    }\n    return this.negate\n  }\n\n  static defaults(def: MinimatchOptions) {\n    return minimatch.defaults(def).Minimatch\n  }\n}\n/* c8 ignore start */\nexport { AST } from './ast.js'\nexport { escape } from './escape.js'\nexport { unescape } from './unescape.js'\n/* c8 ignore stop */\nminimatch.AST = AST\nminimatch.Minimatch = Minimatch\nminimatch.escape = escape\nminimatch.unescape = unescape\n"]}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/package.json b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.d.ts
    new file mode 100644
    index 00000000..23a7b387
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.d.ts
    @@ -0,0 +1,17 @@
    +import { MinimatchOptions } from './index.js';
    +/**
    + * 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 declare const unescape: (s: string, { windowsPathsNoEscape, }?: Pick) => string;
    +//# sourceMappingURL=unescape.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.d.ts.map
    new file mode 100644
    index 00000000..7ace0701
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"unescape.d.ts","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,MAChB,MAAM,8BAGN,KAAK,gBAAgB,EAAE,sBAAsB,CAAC,WAKlD,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.js b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.js
    new file mode 100644
    index 00000000..47c36bce
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.js
    @@ -0,0 +1,24 @@
    +"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/rimraf/node_modules/minimatch/dist/commonjs/unescape.js.map b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.js.map
    new file mode 100644
    index 00000000..353d3aa0
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/commonjs/unescape.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"unescape.js","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":";;;AACA;;;;;;;;;;;;;GAaG;AACI,MAAM,QAAQ,GAAG,CACtB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC;QACnC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAChF,CAAC,CAAA;AATY,QAAA,QAAQ,YASpB","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Un-escape a string that has been escaped with {@link escape}.\n *\n * If the {@link windowsPathsNoEscape} option is used, then square-brace\n * escapes are removed, but not backslash escapes.  For example, it will turn\n * the string `'[*]'` into `*`, but it will not turn `'\\\\*'` into `'*'`,\n * becuase `\\` is a path separator in `windowsPathsNoEscape` mode.\n *\n * When `windowsPathsNoEscape` is not set, then both brace escapes and\n * backslash escapes are removed.\n *\n * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped\n * or unescaped.\n */\nexport const unescape = (\n  s: string,\n  {\n    windowsPathsNoEscape = false,\n  }: Pick = {}\n) => {\n  return windowsPathsNoEscape\n    ? s.replace(/\\[([^\\/\\\\])\\]/g, '$1')\n    : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, '$1$2').replace(/\\\\([^\\/])/g, '$1')\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts
    new file mode 100644
    index 00000000..8e318b23
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts
    @@ -0,0 +1,2 @@
    +export declare const assertValidPattern: (pattern: any) => void;
    +//# sourceMappingURL=assert-valid-pattern.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map
    new file mode 100644
    index 00000000..c61c0310
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"assert-valid-pattern.d.ts","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAUlD,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.js b/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.js
    new file mode 100644
    index 00000000..7b534fc3
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.js
    @@ -0,0 +1,10 @@
    +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/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map
    new file mode 100644
    index 00000000..b1a5a0b9
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"assert-valid-pattern.js","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAA;AACpC,MAAM,CAAC,MAAM,kBAAkB,GAA2B,CACxD,OAAY,EACe,EAAE;IAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;KACvC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,EAAE;QACvC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAA;KAC3C;AACH,CAAC,CAAA","sourcesContent":["const MAX_PATTERN_LENGTH = 1024 * 64\nexport const assertValidPattern: (pattern: any) => void = (\n  pattern: any\n): asserts pattern is string => {\n  if (typeof pattern !== 'string') {\n    throw new TypeError('invalid pattern')\n  }\n\n  if (pattern.length > MAX_PATTERN_LENGTH) {\n    throw new TypeError('pattern is too long')\n  }\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.d.ts
    new file mode 100644
    index 00000000..b8c1e544
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.d.ts
    @@ -0,0 +1,20 @@
    +import { MinimatchOptions, MMRegExp } from './index.js';
    +export type ExtglobType = '!' | '?' | '+' | '*' | '@';
    +export declare class AST {
    +    #private;
    +    type: ExtglobType | null;
    +    constructor(type: ExtglobType | null, parent?: AST, options?: MinimatchOptions);
    +    get hasMagic(): boolean | undefined;
    +    toString(): string;
    +    push(...parts: (string | AST)[]): void;
    +    toJSON(): any[];
    +    isStart(): boolean;
    +    isEnd(): boolean;
    +    copyIn(part: AST | string): void;
    +    clone(parent: AST): AST;
    +    static fromGlob(pattern: string, options?: MinimatchOptions): AST;
    +    toMMPattern(): MMRegExp | string;
    +    get options(): MinimatchOptions;
    +    toRegExpSource(allowDot?: boolean): [re: string, body: string, hasMagic: boolean, uflag: boolean];
    +}
    +//# sourceMappingURL=ast.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.d.ts.map
    new file mode 100644
    index 00000000..9e7bfb9a
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAwCvD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAkCrD,qBAAa,GAAG;;IACd,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;gBAiBtB,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,GAAE,gBAAqB;IAahC,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAUlC;IAGD,QAAQ,IAAI,MAAM;IA+ClB,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE;IAY/B,MAAM;IAgBN,OAAO,IAAI,OAAO;IAgBlB,KAAK,IAAI,OAAO;IAYhB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM;IAKzB,KAAK,CAAC,MAAM,EAAE,GAAG;IAsIjB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAQ/D,WAAW,IAAI,QAAQ,GAAG,MAAM;IA2BhC,IAAI,OAAO,qBAEV;IAuED,cAAc,CACZ,QAAQ,CAAC,EAAE,OAAO,GACjB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC;CAiMjE"}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.js b/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.js
    new file mode 100644
    index 00000000..2d2bced6
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.js
    @@ -0,0 +1,588 @@
    +// 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,
    +        });
    +    }
    +    get options() {
    +        return this.#options;
    +    }
    +    // 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/rimraf/node_modules/minimatch/dist/esm/ast.js.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.js.map
    new file mode 100644
    index 00000000..f1f8b34c
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/ast.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAwCxC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAC7D,MAAM,aAAa,GAAG,CAAC,CAAS,EAAoB,EAAE,CACpD,KAAK,CAAC,GAAG,CAAC,CAAgB,CAAC,CAAA;AAE7B,iEAAiE;AACjE,gEAAgE;AAChE,0CAA0C;AAC1C,uEAAuE;AACvE,MAAM,gBAAgB,GAAG,2BAA2B,CAAA;AACpD,MAAM,UAAU,GAAG,SAAS,CAAA;AAE5B,uEAAuE;AACv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C,IAAI,QAAQ,GAAG,CAAC,CAAA;oBACjB,QAAQ,GAAG,QAAQ,IAAI,KAAK,CAAA;oBAC5B,SAAQ;iBACT;aACF;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,IAAI,OAAO,IAAI,IAAI,KAAK,GAAG;oBAAE,EAAE,IAAI,WAAW,CAAA;;oBACzC,EAAE,IAAI,IAAI,CAAA;gBACf,QAAQ,GAAG,IAAI,CAAA;gBACf,SAAQ;aACT;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,EAAE,IAAI,KAAK,CAAA;gBACX,QAAQ,GAAG,IAAI,CAAA;gBACf,SAAQ;aACT;YACD,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,CAAA;SACtB;QACD,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;CACF","sourcesContent":["// parse a single path portion\n\nimport { parseClass } from './brace-expressions.js'\nimport { MinimatchOptions, MMRegExp } from './index.js'\nimport { unescape } from './unescape.js'\n\n// classes [] are handled by the parseClass method\n// for positive extglobs, we sub-parse the contents, and combine,\n// with the appropriate regexp close.\n// for negative extglobs, we sub-parse the contents, but then\n// have to include the rest of the pattern, then the parent, etc.,\n// as the thing that cannot be because RegExp negative lookaheads\n// are different from globs.\n//\n// So for example:\n// a@(i|w!(x|y)z|j)b => ^a(i|w((!?(x|y)zb).*)z|j)b$\n//   1   2 3   4 5 6      1   2    3   46      5 6\n//\n// Assembling the extglob requires not just the negated patterns themselves,\n// but also anything following the negative patterns up to the boundary\n// of the current pattern, plus anything following in the parent pattern.\n//\n//\n// So, first, we parse the string into an AST of extglobs, without turning\n// anything into regexps yet.\n//\n// ['a', {@ [['i'], ['w', {!['x', 'y']}, 'z'], ['j']]}, 'b']\n//\n// Then, for all the negative extglobs, we append whatever comes after in\n// each parent as their tail\n//\n// ['a', {@ [['i'], ['w', {!['x', 'y'], 'z', 'b'}, 'z'], ['j']]}, 'b']\n//\n// Lastly, we turn each of these pieces into a regexp, and join\n//\n//                                 v----- .* because there's more following,\n//                                 v    v  otherwise, .+ because it must be\n//                                 v    v  *something* there.\n// ['^a', {@ ['i', 'w(?:(!?(?:x|y).*zb$).*)z', 'j' ]}, 'b$']\n//   copy what follows into here--^^^^^\n// ['^a', '(?:i|w(?:(?!(?:x|y).*zb$).*)z|j)', 'b$']\n// ['^a(?:i|w(?:(?!(?:x|y).*zb$).*)z|j)b$']\n\nexport type ExtglobType = '!' | '?' | '+' | '*' | '@'\nconst types = new Set(['!', '?', '+', '*', '@'])\nconst isExtglobType = (c: string): c is ExtglobType =>\n  types.has(c as ExtglobType)\n\n// Patterns that get prepended to bind to the start of either the\n// entire string, or just a single path portion, to prevent dots\n// and/or traversal patterns, when needed.\n// Exts don't need the ^ or / bit, because the root binds that already.\nconst startNoTraversal = '(?!(?:^|/)\\\\.\\\\.?(?:$|/))'\nconst startNoDot = '(?!\\\\.)'\n\n// characters that indicate a start of pattern needs the \"no dots\" bit,\n// because a dot *might* be matched. ( is not in the list, because in\n// the case of a child extglob, it will handle the prevention itself.\nconst addPatternStart = new Set(['[', '.'])\n// cases where traversal is A-OK, no dot prevention needed\nconst justDots = new Set(['..', '.'])\nconst reSpecials = new Set('().*{}+?[]^$\\\\!')\nconst regExpEscape = (s: string) =>\n  s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// any single thing other than /\nconst qmark = '[^/]'\n\n// * => any number of characters\nconst star = qmark + '*?'\n// use + when we need to ensure that *something* matches, because the * is\n// the only thing in the path portion.\nconst starNoEmpty = qmark + '+?'\n\n// remove the \\ chars that we added if we end up doing a nonmagic compare\n// const deslash = (s: string) => s.replace(/\\\\(.)/g, '$1')\n\nexport class AST {\n  type: ExtglobType | null\n  readonly #root: AST\n\n  #hasMagic?: boolean\n  #uflag: boolean = false\n  #parts: (string | AST)[] = []\n  readonly #parent?: AST\n  readonly #parentIndex: number\n  #negs: AST[]\n  #filledNegs: boolean = false\n  #options: MinimatchOptions\n  #toString?: string\n  // set to true if it's an extglob with no children\n  // (which really means one child of '')\n  #emptyExt: boolean = false\n\n  constructor(\n    type: ExtglobType | null,\n    parent?: AST,\n    options: MinimatchOptions = {}\n  ) {\n    this.type = type\n    // extglobs are inherently magical\n    if (type) this.#hasMagic = true\n    this.#parent = parent\n    this.#root = this.#parent ? this.#parent.#root : this\n    this.#options = this.#root === this ? options : this.#root.#options\n    this.#negs = this.#root === this ? [] : this.#root.#negs\n    if (type === '!' && !this.#root.#filledNegs) this.#negs.push(this)\n    this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0\n  }\n\n  get hasMagic(): boolean | undefined {\n    /* c8 ignore start */\n    if (this.#hasMagic !== undefined) return this.#hasMagic\n    /* c8 ignore stop */\n    for (const p of this.#parts) {\n      if (typeof p === 'string') continue\n      if (p.type || p.hasMagic) return (this.#hasMagic = true)\n    }\n    // note: will be undefined until we generate the regexp src and find out\n    return this.#hasMagic\n  }\n\n  // reconstructs the pattern\n  toString(): string {\n    if (this.#toString !== undefined) return this.#toString\n    if (!this.type) {\n      return (this.#toString = this.#parts.map(p => String(p)).join(''))\n    } else {\n      return (this.#toString =\n        this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')')\n    }\n  }\n\n  #fillNegs() {\n    /* c8 ignore start */\n    if (this !== this.#root) throw new Error('should only call on root')\n    if (this.#filledNegs) return this\n    /* c8 ignore stop */\n\n    // call toString() once to fill this out\n    this.toString()\n    this.#filledNegs = true\n    let n: AST | undefined\n    while ((n = this.#negs.pop())) {\n      if (n.type !== '!') continue\n      // walk up the tree, appending everthing that comes AFTER parentIndex\n      let p: AST | undefined = n\n      let pp = p.#parent\n      while (pp) {\n        for (\n          let i = p.#parentIndex + 1;\n          !pp.type && i < pp.#parts.length;\n          i++\n        ) {\n          for (const part of n.#parts) {\n            /* c8 ignore start */\n            if (typeof part === 'string') {\n              throw new Error('string part in extglob AST??')\n            }\n            /* c8 ignore stop */\n            part.copyIn(pp.#parts[i])\n          }\n        }\n        p = pp\n        pp = p.#parent\n      }\n    }\n    return this\n  }\n\n  push(...parts: (string | AST)[]) {\n    for (const p of parts) {\n      if (p === '') continue\n      /* c8 ignore start */\n      if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {\n        throw new Error('invalid part: ' + p)\n      }\n      /* c8 ignore stop */\n      this.#parts.push(p)\n    }\n  }\n\n  toJSON() {\n    const ret: any[] =\n      this.type === null\n        ? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))\n        : [this.type, ...this.#parts.map(p => (p as AST).toJSON())]\n    if (this.isStart() && !this.type) ret.unshift([])\n    if (\n      this.isEnd() &&\n      (this === this.#root ||\n        (this.#root.#filledNegs && this.#parent?.type === '!'))\n    ) {\n      ret.push({})\n    }\n    return ret\n  }\n\n  isStart(): boolean {\n    if (this.#root === this) return true\n    // if (this.type) return !!this.#parent?.isStart()\n    if (!this.#parent?.isStart()) return false\n    if (this.#parentIndex === 0) return true\n    // if everything AHEAD of this is a negation, then it's still the \"start\"\n    const p = this.#parent\n    for (let i = 0; i < this.#parentIndex; i++) {\n      const pp = p.#parts[i]\n      if (!(pp instanceof AST && pp.type === '!')) {\n        return false\n      }\n    }\n    return true\n  }\n\n  isEnd(): boolean {\n    if (this.#root === this) return true\n    if (this.#parent?.type === '!') return true\n    if (!this.#parent?.isEnd()) return false\n    if (!this.type) return this.#parent?.isEnd()\n    // if not root, it'll always have a parent\n    /* c8 ignore start */\n    const pl = this.#parent ? this.#parent.#parts.length : 0\n    /* c8 ignore stop */\n    return this.#parentIndex === pl - 1\n  }\n\n  copyIn(part: AST | string) {\n    if (typeof part === 'string') this.push(part)\n    else this.push(part.clone(this))\n  }\n\n  clone(parent: AST) {\n    const c = new AST(this.type, parent)\n    for (const p of this.#parts) {\n      c.copyIn(p)\n    }\n    return c\n  }\n\n  static #parseAST(\n    str: string,\n    ast: AST,\n    pos: number,\n    opt: MinimatchOptions\n  ): number {\n    let escaping = false\n    let inBrace = false\n    let braceStart = -1\n    let braceNeg = false\n    if (ast.type === null) {\n      // outside of a extglob, append until we find a start\n      let i = pos\n      let acc = ''\n      while (i < str.length) {\n        const c = str.charAt(i++)\n        // still accumulate escapes at this point, but we do ignore\n        // starts that are escaped\n        if (escaping || c === '\\\\') {\n          escaping = !escaping\n          acc += c\n          continue\n        }\n\n        if (inBrace) {\n          if (i === braceStart + 1) {\n            if (c === '^' || c === '!') {\n              braceNeg = true\n            }\n          } else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {\n            inBrace = false\n          }\n          acc += c\n          continue\n        } else if (c === '[') {\n          inBrace = true\n          braceStart = i\n          braceNeg = false\n          acc += c\n          continue\n        }\n\n        if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {\n          ast.push(acc)\n          acc = ''\n          const ext = new AST(c, ast)\n          i = AST.#parseAST(str, ext, i, opt)\n          ast.push(ext)\n          continue\n        }\n        acc += c\n      }\n      ast.push(acc)\n      return i\n    }\n\n    // some kind of extglob, pos is at the (\n    // find the next | or )\n    let i = pos + 1\n    let part = new AST(null, ast)\n    const parts: AST[] = []\n    let acc = ''\n    while (i < str.length) {\n      const c = str.charAt(i++)\n      // still accumulate escapes at this point, but we do ignore\n      // starts that are escaped\n      if (escaping || c === '\\\\') {\n        escaping = !escaping\n        acc += c\n        continue\n      }\n\n      if (inBrace) {\n        if (i === braceStart + 1) {\n          if (c === '^' || c === '!') {\n            braceNeg = true\n          }\n        } else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {\n          inBrace = false\n        }\n        acc += c\n        continue\n      } else if (c === '[') {\n        inBrace = true\n        braceStart = i\n        braceNeg = false\n        acc += c\n        continue\n      }\n\n      if (isExtglobType(c) && str.charAt(i) === '(') {\n        part.push(acc)\n        acc = ''\n        const ext = new AST(c, part)\n        part.push(ext)\n        i = AST.#parseAST(str, ext, i, opt)\n        continue\n      }\n      if (c === '|') {\n        part.push(acc)\n        acc = ''\n        parts.push(part)\n        part = new AST(null, ast)\n        continue\n      }\n      if (c === ')') {\n        if (acc === '' && ast.#parts.length === 0) {\n          ast.#emptyExt = true\n        }\n        part.push(acc)\n        acc = ''\n        ast.push(...parts, part)\n        return i\n      }\n      acc += c\n    }\n\n    // unfinished extglob\n    // if we got here, it was a malformed extglob! not an extglob, but\n    // maybe something else in there.\n    ast.type = null\n    ast.#hasMagic = undefined\n    ast.#parts = [str.substring(pos - 1)]\n    return i\n  }\n\n  static fromGlob(pattern: string, options: MinimatchOptions = {}) {\n    const ast = new AST(null, undefined, options)\n    AST.#parseAST(pattern, ast, 0, options)\n    return ast\n  }\n\n  // returns the regular expression if there's magic, or the unescaped\n  // string if not.\n  toMMPattern(): MMRegExp | string {\n    // should only be called on root\n    /* c8 ignore start */\n    if (this !== this.#root) return this.#root.toMMPattern()\n    /* c8 ignore stop */\n    const glob = this.toString()\n    const [re, body, hasMagic, uflag] = this.toRegExpSource()\n    // if we're in nocase mode, and not nocaseMagicOnly, then we do\n    // still need a regular expression if we have to case-insensitively\n    // match capital/lowercase characters.\n    const anyMagic =\n      hasMagic ||\n      this.#hasMagic ||\n      (this.#options.nocase &&\n        !this.#options.nocaseMagicOnly &&\n        glob.toUpperCase() !== glob.toLowerCase())\n    if (!anyMagic) {\n      return body\n    }\n\n    const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '')\n    return Object.assign(new RegExp(`^${re}$`, flags), {\n      _src: re,\n      _glob: glob,\n    })\n  }\n\n  get options() {\n    return this.#options\n  }\n\n  // returns the string match, the regexp source, whether there's magic\n  // in the regexp (so a regular expression is required) and whether or\n  // not the uflag is needed for the regular expression (for posix classes)\n  // TODO: instead of injecting the start/end at this point, just return\n  // the BODY of the regexp, along with the start/end portions suitable\n  // for binding the start/end in either a joined full-path makeRe context\n  // (where we bind to (^|/), or a standalone matchPart context (where\n  // we bind to ^, and not /).  Otherwise slashes get duped!\n  //\n  // In part-matching mode, the start is:\n  // - if not isStart: nothing\n  // - if traversal possible, but not allowed: ^(?!\\.\\.?$)\n  // - if dots allowed or not possible: ^\n  // - if dots possible and not allowed: ^(?!\\.)\n  // end is:\n  // - if not isEnd(): nothing\n  // - else: $\n  //\n  // In full-path matching mode, we put the slash at the START of the\n  // pattern, so start is:\n  // - if first pattern: same as part-matching mode\n  // - if not isStart(): nothing\n  // - if traversal possible, but not allowed: /(?!\\.\\.?(?:$|/))\n  // - if dots allowed or not possible: /\n  // - if dots possible and not allowed: /(?!\\.)\n  // end is:\n  // - if last pattern, same as part-matching mode\n  // - else nothing\n  //\n  // Always put the (?:$|/) on negated tails, though, because that has to be\n  // there to bind the end of the negated pattern portion, and it's easier to\n  // just stick it in now rather than try to inject it later in the middle of\n  // the pattern.\n  //\n  // We can just always return the same end, and leave it up to the caller\n  // to know whether it's going to be used joined or in parts.\n  // And, if the start is adjusted slightly, can do the same there:\n  // - if not isStart: nothing\n  // - if traversal possible, but not allowed: (?:/|^)(?!\\.\\.?$)\n  // - if dots allowed or not possible: (?:/|^)\n  // - if dots possible and not allowed: (?:/|^)(?!\\.)\n  //\n  // But it's better to have a simpler binding without a conditional, for\n  // performance, so probably better to return both start options.\n  //\n  // Then the caller just ignores the end if it's not the first pattern,\n  // and the start always gets applied.\n  //\n  // But that's always going to be $ if it's the ending pattern, or nothing,\n  // so the caller can just attach $ at the end of the pattern when building.\n  //\n  // So the todo is:\n  // - better detect what kind of start is needed\n  // - return both flavors of starting pattern\n  // - attach $ at the end of the pattern when creating the actual RegExp\n  //\n  // Ah, but wait, no, that all only applies to the root when the first pattern\n  // is not an extglob. If the first pattern IS an extglob, then we need all\n  // that dot prevention biz to live in the extglob portions, because eg\n  // +(*|.x*) can match .xy but not .yx.\n  //\n  // So, return the two flavors if it's #root and the first child is not an\n  // AST, otherwise leave it to the child AST to handle it, and there,\n  // use the (?:^|/) style of start binding.\n  //\n  // Even simplified further:\n  // - Since the start for a join is eg /(?!\\.) and the start for a part\n  // is ^(?!\\.), we can just prepend (?!\\.) to the pattern (either root\n  // or start or whatever) and prepend ^ or / at the Regexp construction.\n  toRegExpSource(\n    allowDot?: boolean\n  ): [re: string, body: string, hasMagic: boolean, uflag: boolean] {\n    const dot = allowDot ?? !!this.#options.dot\n    if (this.#root === this) this.#fillNegs()\n    if (!this.type) {\n      const noEmpty = this.isStart() && this.isEnd()\n      const src = this.#parts\n        .map(p => {\n          const [re, _, hasMagic, uflag] =\n            typeof p === 'string'\n              ? AST.#parseGlob(p, this.#hasMagic, noEmpty)\n              : p.toRegExpSource(allowDot)\n          this.#hasMagic = this.#hasMagic || hasMagic\n          this.#uflag = this.#uflag || uflag\n          return re\n        })\n        .join('')\n\n      let start = ''\n      if (this.isStart()) {\n        if (typeof this.#parts[0] === 'string') {\n          // this is the string that will match the start of the pattern,\n          // so we need to protect against dots and such.\n\n          // '.' and '..' cannot match unless the pattern is that exactly,\n          // even if it starts with . or dot:true is set.\n          const dotTravAllowed =\n            this.#parts.length === 1 && justDots.has(this.#parts[0])\n          if (!dotTravAllowed) {\n            const aps = addPatternStart\n            // check if we have a possibility of matching . or ..,\n            // and prevent that.\n            const needNoTrav =\n              // dots are allowed, and the pattern starts with [ or .\n              (dot && aps.has(src.charAt(0))) ||\n              // the pattern starts with \\., and then [ or .\n              (src.startsWith('\\\\.') && aps.has(src.charAt(2))) ||\n              // the pattern starts with \\.\\., and then [ or .\n              (src.startsWith('\\\\.\\\\.') && aps.has(src.charAt(4)))\n            // no need to prevent dots if it can't match a dot, or if a\n            // sub-pattern will be preventing it anyway.\n            const needNoDot = !dot && !allowDot && aps.has(src.charAt(0))\n\n            start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : ''\n          }\n        }\n      }\n\n      // append the \"end of path portion\" pattern to negation tails\n      let end = ''\n      if (\n        this.isEnd() &&\n        this.#root.#filledNegs &&\n        this.#parent?.type === '!'\n      ) {\n        end = '(?:$|\\\\/)'\n      }\n      const final = start + src + end\n      return [\n        final,\n        unescape(src),\n        (this.#hasMagic = !!this.#hasMagic),\n        this.#uflag,\n      ]\n    }\n\n    // We need to calculate the body *twice* if it's a repeat pattern\n    // at the start, once in nodot mode, then again in dot mode, so a\n    // pattern like *(?) can match 'x.y'\n\n    const repeated = this.type === '*' || this.type === '+'\n    // some kind of extglob\n    const start = this.type === '!' ? '(?:(?!(?:' : '(?:'\n    let body = this.#partsToRegExp(dot)\n\n    if (this.isStart() && this.isEnd() && !body && this.type !== '!') {\n      // invalid extglob, has to at least be *something* present, if it's\n      // the entire path portion.\n      const s = this.toString()\n      this.#parts = [s]\n      this.type = null\n      this.#hasMagic = undefined\n      return [s, unescape(this.toString()), false, false]\n    }\n\n    // XXX abstract out this map method\n    let bodyDotAllowed =\n      !repeated || allowDot || dot || !startNoDot\n        ? ''\n        : this.#partsToRegExp(true)\n    if (bodyDotAllowed === body) {\n      bodyDotAllowed = ''\n    }\n    if (bodyDotAllowed) {\n      body = `(?:${body})(?:${bodyDotAllowed})*?`\n    }\n\n    // an empty !() is exactly equivalent to a starNoEmpty\n    let final = ''\n    if (this.type === '!' && this.#emptyExt) {\n      final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty\n    } else {\n      const close =\n        this.type === '!'\n          ? // !() must match something,but !(x) can match ''\n            '))' +\n            (this.isStart() && !dot && !allowDot ? startNoDot : '') +\n            star +\n            ')'\n          : this.type === '@'\n          ? ')'\n          : this.type === '?'\n          ? ')?'\n          : this.type === '+' && bodyDotAllowed\n          ? ')'\n          : this.type === '*' && bodyDotAllowed\n          ? `)?`\n          : `)${this.type}`\n      final = start + body + close\n    }\n    return [\n      final,\n      unescape(body),\n      (this.#hasMagic = !!this.#hasMagic),\n      this.#uflag,\n    ]\n  }\n\n  #partsToRegExp(dot: boolean) {\n    return this.#parts\n      .map(p => {\n        // extglob ASTs should only contain parent ASTs\n        /* c8 ignore start */\n        if (typeof p === 'string') {\n          throw new Error('string type in extglob ast??')\n        }\n        /* c8 ignore stop */\n        // can ignore hasMagic, because extglobs are already always magic\n        const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot)\n        this.#uflag = this.#uflag || uflag\n        return re\n      })\n      .filter(p => !(this.isStart() && this.isEnd()) || !!p)\n      .join('|')\n  }\n\n  static #parseGlob(\n    glob: string,\n    hasMagic: boolean | undefined,\n    noEmpty: boolean = false\n  ): [re: string, body: string, hasMagic: boolean, uflag: boolean] {\n    let escaping = false\n    let re = ''\n    let uflag = false\n    for (let i = 0; i < glob.length; i++) {\n      const c = glob.charAt(i)\n      if (escaping) {\n        escaping = false\n        re += (reSpecials.has(c) ? '\\\\' : '') + c\n        continue\n      }\n      if (c === '\\\\') {\n        if (i === glob.length - 1) {\n          re += '\\\\\\\\'\n        } else {\n          escaping = true\n        }\n        continue\n      }\n      if (c === '[') {\n        const [src, needUflag, consumed, magic] = parseClass(glob, i)\n        if (consumed) {\n          re += src\n          uflag = uflag || needUflag\n          i += consumed - 1\n          hasMagic = hasMagic || magic\n          continue\n        }\n      }\n      if (c === '*') {\n        if (noEmpty && glob === '*') re += starNoEmpty\n        else re += star\n        hasMagic = true\n        continue\n      }\n      if (c === '?') {\n        re += qmark\n        hasMagic = true\n        continue\n      }\n      re += regExpEscape(c)\n    }\n    return [re, unescape(glob), !!hasMagic, uflag]\n  }\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.d.ts
    new file mode 100644
    index 00000000..b1572deb
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.d.ts
    @@ -0,0 +1,8 @@
    +export type ParseClassResult = [
    +    src: string,
    +    uFlag: boolean,
    +    consumed: number,
    +    hasMagic: boolean
    +];
    +export declare const parseClass: (glob: string, position: number) => ParseClassResult;
    +//# sourceMappingURL=brace-expressions.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map
    new file mode 100644
    index 00000000..d3949648
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"brace-expressions.d.ts","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,OAAO;CAClB,CAAA;AAQD,eAAO,MAAM,UAAU,SACf,MAAM,YACF,MAAM,qBA8HjB,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.js b/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.js
    new file mode 100644
    index 00000000..c629d6ae
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.js
    @@ -0,0 +1,148 @@
    +// 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/rimraf/node_modules/minimatch/dist/esm/brace-expressions.js.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.js.map
    new file mode 100644
    index 00000000..cdba30da
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/brace-expressions.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"brace-expressions.js","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,wCAAwC;AAExC,8DAA8D;AAC9D,MAAM,YAAY,GAA0D;IAC1E,WAAW,EAAE,CAAC,sBAAsB,EAAE,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,KAAK,GAAG,QAAQ,GAAG,IAAI,EAAE,KAAK,CAAC;IAC7C,WAAW,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC;IACjC,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;IAC7B,WAAW,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;IAC7B,WAAW,EAAE,CAAC,uBAAuB,EAAE,IAAI,CAAC;IAC5C,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,UAAU,EAAE,CAAC,6BAA6B,EAAE,IAAI,CAAC;IACjD,YAAY,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC;CACnC,CAAA;AAED,+DAA+D;AAC/D,mBAAmB;AACnB,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;AACjE,qCAAqC;AACrC,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,EAAE,CACj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AM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAClE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,KAAK,CAAC,CAAA;KACrD;IAED,MAAM,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG,GAAG,CAAA;IACxE,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACpE,MAAM,IAAI,GACR,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM;QAC1B,CAAC,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG;QACnC,CAAC,CAAC,MAAM,CAAC,MAAM;YACf,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,KAAK,CAAA;IAEX,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,CAAA;AAC1C,CAAC,CAAA","sourcesContent":["// translate the various posix character classes into unicode properties\n// this works across all unicode locales\n\n// { : [, /u flag required, negated]\nconst posixClasses: { [k: string]: [e: string, u: boolean, n?: boolean] } = {\n  '[:alnum:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}', true],\n  '[:alpha:]': ['\\\\p{L}\\\\p{Nl}', true],\n  '[:ascii:]': ['\\\\x' + '00-\\\\x' + '7f', false],\n  '[:blank:]': ['\\\\p{Zs}\\\\t', true],\n  '[:cntrl:]': ['\\\\p{Cc}', true],\n  '[:digit:]': ['\\\\p{Nd}', true],\n  '[:graph:]': ['\\\\p{Z}\\\\p{C}', true, true],\n  '[:lower:]': ['\\\\p{Ll}', true],\n  '[:print:]': ['\\\\p{C}', true],\n  '[:punct:]': ['\\\\p{P}', true],\n  '[:space:]': ['\\\\p{Z}\\\\t\\\\r\\\\n\\\\v\\\\f', true],\n  '[:upper:]': ['\\\\p{Lu}', true],\n  '[:word:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}', true],\n  '[:xdigit:]': ['A-Fa-f0-9', false],\n}\n\n// only need to escape a few things inside of brace expressions\n// escapes: [ \\ ] -\nconst braceEscape = (s: string) => s.replace(/[[\\]\\\\-]/g, '\\\\$&')\n// escape all regexp magic characters\nconst regexpEscape = (s: string) =>\n  s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// everything has already been escaped, we just have to join\nconst rangesToString = (ranges: string[]): string => ranges.join('')\n\nexport type ParseClassResult = [\n  src: string,\n  uFlag: boolean,\n  consumed: number,\n  hasMagic: boolean\n]\n\n// takes a glob string at a posix brace expression, and returns\n// an equivalent regular expression source, and boolean indicating\n// whether the /u flag needs to be applied, and the number of chars\n// consumed to parse the character class.\n// This also removes out of order ranges, and returns ($.) if the\n// entire class just no good.\nexport const parseClass = (\n  glob: string,\n  position: number\n): ParseClassResult => {\n  const pos = position\n  /* c8 ignore start */\n  if (glob.charAt(pos) !== '[') {\n    throw new Error('not in a brace expression')\n  }\n  /* c8 ignore stop */\n  const ranges: string[] = []\n  const negs: string[] = []\n\n  let i = pos + 1\n  let sawStart = false\n  let uflag = false\n  let escaping = false\n  let negate = false\n  let endPos = pos\n  let rangeStart = ''\n  WHILE: while (i < glob.length) {\n    const c = glob.charAt(i)\n    if ((c === '!' || c === '^') && i === pos + 1) {\n      negate = true\n      i++\n      continue\n    }\n\n    if (c === ']' && sawStart && !escaping) {\n      endPos = i + 1\n      break\n    }\n\n    sawStart = true\n    if (c === '\\\\') {\n      if (!escaping) {\n        escaping = true\n        i++\n        continue\n      }\n      // escaped \\ char, fall through and treat like normal char\n    }\n    if (c === '[' && !escaping) {\n      // either a posix class, a collation equivalent, or just a [\n      for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {\n        if (glob.startsWith(cls, i)) {\n          // invalid, [a-[] is fine, but not [a-[:alpha]]\n          if (rangeStart) {\n            return ['$.', false, glob.length - pos, true]\n          }\n          i += cls.length\n          if (neg) negs.push(unip)\n          else ranges.push(unip)\n          uflag = uflag || u\n          continue WHILE\n        }\n      }\n    }\n\n    // now it's just a normal character, effectively\n    escaping = false\n    if (rangeStart) {\n      // throw this range away if it's not valid, but others\n      // can still match.\n      if (c > rangeStart) {\n        ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c))\n      } else if (c === rangeStart) {\n        ranges.push(braceEscape(c))\n      }\n      rangeStart = ''\n      i++\n      continue\n    }\n\n    // now might be the start of a range.\n    // can be either c-d or c-] or c] or c] at this point\n    if (glob.startsWith('-]', i + 1)) {\n      ranges.push(braceEscape(c + '-'))\n      i += 2\n      continue\n    }\n    if (glob.startsWith('-', i + 1)) {\n      rangeStart = c\n      i += 2\n      continue\n    }\n\n    // not the start of a range, just a single character\n    ranges.push(braceEscape(c))\n    i++\n  }\n\n  if (endPos < i) {\n    // didn't see the end of the class, not a valid class,\n    // but might still be valid as a literal match.\n    return ['', false, 0, false]\n  }\n\n  // if we got no ranges and no negates, then we have a range that\n  // cannot possibly match anything, and that poisons the whole glob\n  if (!ranges.length && !negs.length) {\n    return ['$.', false, glob.length - pos, true]\n  }\n\n  // if we got one positive range, and it's a single character, then that's\n  // not actually a magic pattern, it's just that one literal character.\n  // we should not treat that as \"magic\", we should just return the literal\n  // character. [_] is a perfectly valid way to escape glob magic chars.\n  if (\n    negs.length === 0 &&\n    ranges.length === 1 &&\n    /^\\\\?.$/.test(ranges[0]) &&\n    !negate\n  ) {\n    const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]\n    return [regexpEscape(r), false, endPos - pos, false]\n  }\n\n  const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']'\n  const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']'\n  const comb =\n    ranges.length && negs.length\n      ? '(' + sranges + '|' + snegs + ')'\n      : ranges.length\n      ? sranges\n      : snegs\n\n  return [comb, uflag, endPos - pos, true]\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.d.ts
    new file mode 100644
    index 00000000..dc3e3163
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.d.ts
    @@ -0,0 +1,12 @@
    +import { MinimatchOptions } from './index.js';
    +/**
    + * 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 declare const escape: (s: string, { windowsPathsNoEscape, }?: Pick) => string;
    +//# sourceMappingURL=escape.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.d.ts.map
    new file mode 100644
    index 00000000..0779dae7
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,MACd,MAAM,8BAGN,KAAK,gBAAgB,EAAE,sBAAsB,CAAC,WAQlD,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.js b/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.js
    new file mode 100644
    index 00000000..16f7c8c7
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.js
    @@ -0,0 +1,18 @@
    +/**
    + * 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/rimraf/node_modules/minimatch/dist/esm/escape.js.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.js.map
    new file mode 100644
    index 00000000..170fd1ad
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/escape.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,wDAAwD;IACxD,4DAA4D;IAC5D,sDAAsD;IACtD,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AACvC,CAAC,CAAA","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Escape all magic characters in a glob pattern.\n *\n * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}\n * option is used, then characters are escaped by wrapping in `[]`, because\n * a magic character wrapped in a character class can only be satisfied by\n * that exact character.  In this mode, `\\` is _not_ escaped, because it is\n * not interpreted as a magic character, but instead as a path separator.\n */\nexport const escape = (\n  s: string,\n  {\n    windowsPathsNoEscape = false,\n  }: Pick = {}\n) => {\n  // don't need to escape +@! because we escape the parens\n  // that make those magic, and escaping ! as [!] isn't valid,\n  // because [!]] is a valid glob class meaning not ']'.\n  return windowsPathsNoEscape\n    ? s.replace(/[?*()[\\]]/g, '[$&]')\n    : s.replace(/[?*()[\\]\\\\]/g, '\\\\$&')\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/index.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/esm/index.d.ts
    new file mode 100644
    index 00000000..41d16a98
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/index.d.ts
    @@ -0,0 +1,94 @@
    +import { AST } from './ast.js';
    +type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
    +export interface MinimatchOptions {
    +    nobrace?: boolean;
    +    nocomment?: boolean;
    +    nonegate?: boolean;
    +    debug?: boolean;
    +    noglobstar?: boolean;
    +    noext?: boolean;
    +    nonull?: boolean;
    +    windowsPathsNoEscape?: boolean;
    +    allowWindowsEscape?: boolean;
    +    partial?: boolean;
    +    dot?: boolean;
    +    nocase?: boolean;
    +    nocaseMagicOnly?: boolean;
    +    magicalBraces?: boolean;
    +    matchBase?: boolean;
    +    flipNegate?: boolean;
    +    preserveMultipleSlashes?: boolean;
    +    optimizationLevel?: number;
    +    platform?: Platform;
    +    windowsNoMagicRoot?: boolean;
    +}
    +export declare const minimatch: {
    +    (p: string, pattern: string, options?: MinimatchOptions): boolean;
    +    sep: Sep;
    +    GLOBSTAR: typeof GLOBSTAR;
    +    filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
    +    defaults: (def: MinimatchOptions) => typeof minimatch;
    +    braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
    +    makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
    +    match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
    +    AST: typeof AST;
    +    Minimatch: typeof Minimatch;
    +    escape: (s: string, { windowsPathsNoEscape, }?: Pick) => string;
    +    unescape: (s: string, { windowsPathsNoEscape, }?: Pick) => string;
    +};
    +type Sep = '\\' | '/';
    +export declare const sep: Sep;
    +export declare const GLOBSTAR: unique symbol;
    +export declare const filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
    +export declare const defaults: (def: MinimatchOptions) => typeof minimatch;
    +export declare const braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
    +export declare const makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
    +export declare const match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
    +export type MMRegExp = RegExp & {
    +    _src?: string;
    +    _glob?: string;
    +};
    +export type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR;
    +export type ParseReturn = ParseReturnFiltered | false;
    +export declare class Minimatch {
    +    options: MinimatchOptions;
    +    set: ParseReturnFiltered[][];
    +    pattern: string;
    +    windowsPathsNoEscape: boolean;
    +    nonegate: boolean;
    +    negate: boolean;
    +    comment: boolean;
    +    empty: boolean;
    +    preserveMultipleSlashes: boolean;
    +    partial: boolean;
    +    globSet: string[];
    +    globParts: string[][];
    +    nocase: boolean;
    +    isWindows: boolean;
    +    platform: Platform;
    +    windowsNoMagicRoot: boolean;
    +    regexp: false | null | MMRegExp;
    +    constructor(pattern: string, options?: MinimatchOptions);
    +    hasMagic(): boolean;
    +    debug(..._: any[]): void;
    +    make(): void;
    +    preprocess(globParts: string[][]): string[][];
    +    adjascentGlobstarOptimize(globParts: string[][]): string[][];
    +    levelOneOptimize(globParts: string[][]): string[][];
    +    levelTwoFileOptimize(parts: string | string[]): string[];
    +    firstPhasePreProcess(globParts: string[][]): string[][];
    +    secondPhasePreProcess(globParts: string[][]): string[][];
    +    partsMatch(a: string[], b: string[], emptyGSMatch?: boolean): false | string[];
    +    parseNegate(): void;
    +    matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean;
    +    braceExpand(): string[];
    +    parse(pattern: string): ParseReturn;
    +    makeRe(): false | MMRegExp;
    +    slashSplit(p: string): string[];
    +    match(f: string, partial?: boolean): boolean;
    +    static defaults(def: MinimatchOptions): typeof Minimatch;
    +}
    +export { AST } from './ast.js';
    +export { escape } from './escape.js';
    +export { unescape } from './unescape.js';
    +//# sourceMappingURL=index.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/index.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/index.d.ts.map
    new file mode 100644
    index 00000000..195491d8
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/index.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAe,MAAM,UAAU,CAAA;AAI3C,KAAK,QAAQ,GACT,KAAK,GACL,SAAS,GACT,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAA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AoB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IA0F1C,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE;IAkBxD,UAAU,CACR,CAAC,EAAE,MAAM,EAAE,EACX,CAAC,EAAE,MAAM,EAAE,EACX,YAAY,GAAE,OAAe,GAC5B,KAAK,GAAG,MAAM,EAAE;IA+CnB,WAAW;IAqBX,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,OAAO,GAAE,OAAe;IAiNzE,WAAW;IAIX,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;IAiDnC,MAAM;IAsFN,UAAU,CAAC,CAAC,EAAE,MAAM;IAepB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,UAAe;IAiEvC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,gBAAgB;CAGtC;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/index.js b/node_modules/rimraf/node_modules/minimatch/dist/esm/index.js
    new file mode 100644
    index 00000000..84b577b0
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/index.js
    @@ -0,0 +1,1001 @@
    +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 {
    +            // just collapse multiple ** portions into one
    +            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) {
    +                    globParts[i] = [];
    +                    globParts[j] = matched;
    +                    break;
    +                }
    +            }
    +        }
    +        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();
    +        if (fastTest && typeof re === 'object') {
    +            // Avoids overriding in frozen environments
    +            Reflect.defineProperty(re, 'test', { value: fastTest });
    +        }
    +        return 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/rimraf/node_modules/minimatch/dist/esm/index.js.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/index.js.map
    new file mode 100644
    index 00000000..ff82a0d3
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/index.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,GAAG,EAAe,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAsCxC,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,CAAS,EACT,OAAe,EACf,UAA4B,EAAE,EAC9B,EAAE;IACF,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAE3B,oCAAoC;IACpC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACnD,OAAO,KAAK,CAAA;KACb;IAED,OAAO,IAAI,SAAS,C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AAG,SAAS,CAAA;AAC/B,SAAS,CAAC,MAAM,GAAG,MAAM,CAAA;AACzB,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAA","sourcesContent":["import expand from 'brace-expansion'\nimport { assertValidPattern } from './assert-valid-pattern.js'\nimport { AST, ExtglobType } from './ast.js'\nimport { escape } from './escape.js'\nimport { unescape } from './unescape.js'\n\ntype Platform =\n  | 'aix'\n  | 'android'\n  | 'darwin'\n  | 'freebsd'\n  | 'haiku'\n  | 'linux'\n  | 'openbsd'\n  | 'sunos'\n  | 'win32'\n  | 'cygwin'\n  | 'netbsd'\n\nexport interface MinimatchOptions {\n  nobrace?: boolean\n  nocomment?: boolean\n  nonegate?: boolean\n  debug?: boolean\n  noglobstar?: boolean\n  noext?: boolean\n  nonull?: boolean\n  windowsPathsNoEscape?: boolean\n  allowWindowsEscape?: boolean\n  partial?: boolean\n  dot?: boolean\n  nocase?: boolean\n  nocaseMagicOnly?: boolean\n  magicalBraces?: boolean\n  matchBase?: boolean\n  flipNegate?: boolean\n  preserveMultipleSlashes?: boolean\n  optimizationLevel?: number\n  platform?: Platform\n  windowsNoMagicRoot?: boolean\n}\n\nexport const minimatch = (\n  p: string,\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  assertValidPattern(pattern)\n\n  // shortcut: comments match nothing.\n  if (!options.nocomment && pattern.charAt(0) === '#') {\n    return false\n  }\n\n  return new Minimatch(pattern, options).match(p)\n}\n\n// Optimized checking for the most common glob patterns.\nconst starDotExtRE = /^\\*+([^+@!?\\*\\[\\(]*)$/\nconst starDotExtTest = (ext: string) => (f: string) =>\n  !f.startsWith('.') && f.endsWith(ext)\nconst starDotExtTestDot = (ext: string) => (f: string) => f.endsWith(ext)\nconst starDotExtTestNocase = (ext: string) => {\n  ext = ext.toLowerCase()\n  return (f: string) => !f.startsWith('.') && f.toLowerCase().endsWith(ext)\n}\nconst starDotExtTestNocaseDot = (ext: string) => {\n  ext = ext.toLowerCase()\n  return (f: string) => f.toLowerCase().endsWith(ext)\n}\nconst starDotStarRE = /^\\*+\\.\\*+$/\nconst starDotStarTest = (f: string) => !f.startsWith('.') && f.includes('.')\nconst starDotStarTestDot = (f: string) =>\n  f !== '.' && f !== '..' && f.includes('.')\nconst dotStarRE = /^\\.\\*+$/\nconst dotStarTest = (f: string) => f !== '.' && f !== '..' && f.startsWith('.')\nconst starRE = /^\\*+$/\nconst starTest = (f: string) => f.length !== 0 && !f.startsWith('.')\nconst starTestDot = (f: string) => f.length !== 0 && f !== '.' && f !== '..'\nconst qmarksRE = /^\\?+([^+@!?\\*\\[\\(]*)?$/\nconst qmarksTestNocase = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExt([$0])\n  if (!ext) return noext\n  ext = ext.toLowerCase()\n  return (f: string) => noext(f) && f.toLowerCase().endsWith(ext)\n}\nconst qmarksTestNocaseDot = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExtDot([$0])\n  if (!ext) return noext\n  ext = ext.toLowerCase()\n  return (f: string) => noext(f) && f.toLowerCase().endsWith(ext)\n}\nconst qmarksTestDot = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExtDot([$0])\n  return !ext ? noext : (f: string) => noext(f) && f.endsWith(ext)\n}\nconst qmarksTest = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExt([$0])\n  return !ext ? noext : (f: string) => noext(f) && f.endsWith(ext)\n}\nconst qmarksTestNoExt = ([$0]: RegExpMatchArray) => {\n  const len = $0.length\n  return (f: string) => f.length === len && !f.startsWith('.')\n}\nconst qmarksTestNoExtDot = ([$0]: RegExpMatchArray) => {\n  const len = $0.length\n  return (f: string) => f.length === len && f !== '.' && f !== '..'\n}\n\n/* c8 ignore start */\nconst defaultPlatform: Platform = (\n  typeof process === 'object' && process\n    ? (typeof process.env === 'object' &&\n        process.env &&\n        process.env.__MINIMATCH_TESTING_PLATFORM__) ||\n      process.platform\n    : 'posix'\n) as Platform\ntype Sep = '\\\\' | '/'\nconst path: { [k: string]: { sep: Sep } } = {\n  win32: { sep: '\\\\' },\n  posix: { sep: '/' },\n}\n/* c8 ignore stop */\n\nexport const sep = defaultPlatform === 'win32' ? path.win32.sep : path.posix.sep\nminimatch.sep = sep\n\nexport const GLOBSTAR = Symbol('globstar **')\nminimatch.GLOBSTAR = GLOBSTAR\n\n// any single thing other than /\n// don't need to escape / when using new RegExp()\nconst qmark = '[^/]'\n\n// * => any number of characters\nconst star = qmark + '*?'\n\n// ** when dots are allowed.  Anything goes, except .. and .\n// not (^ or / followed by one or two dots followed by $ or /),\n// followed by anything, any number of times.\nconst twoStarDot = '(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?'\n\n// not a ^ or / followed by a dot,\n// followed by anything, any number of times.\nconst twoStarNoDot = '(?:(?!(?:\\\\/|^)\\\\.).)*?'\n\nexport const filter =\n  (pattern: string, options: MinimatchOptions = {}) =>\n  (p: string) =>\n    minimatch(p, pattern, options)\nminimatch.filter = filter\n\nconst ext = (a: MinimatchOptions, b: MinimatchOptions = {}) =>\n  Object.assign({}, a, b)\n\nexport const defaults = (def: MinimatchOptions): typeof minimatch => {\n  if (!def || typeof def !== 'object' || !Object.keys(def).length) {\n    return minimatch\n  }\n\n  const orig = minimatch\n\n  const m = (p: string, pattern: string, options: MinimatchOptions = {}) =>\n    orig(p, pattern, ext(def, options))\n\n  return Object.assign(m, {\n    Minimatch: class Minimatch extends orig.Minimatch {\n      constructor(pattern: string, options: MinimatchOptions = {}) {\n        super(pattern, ext(def, options))\n      }\n      static defaults(options: MinimatchOptions) {\n        return orig.defaults(ext(def, options)).Minimatch\n      }\n    },\n\n    AST: class AST extends orig.AST {\n      /* c8 ignore start */\n      constructor(\n        type: ExtglobType | null,\n        parent?: AST,\n        options: MinimatchOptions = {}\n      ) {\n        super(type, parent, ext(def, options))\n      }\n      /* c8 ignore stop */\n\n      static fromGlob(pattern: string, options: MinimatchOptions = {}) {\n        return orig.AST.fromGlob(pattern, ext(def, options))\n      }\n    },\n\n    unescape: (\n      s: string,\n      options: Pick = {}\n    ) => orig.unescape(s, ext(def, options)),\n\n    escape: (\n      s: string,\n      options: Pick = {}\n    ) => orig.escape(s, ext(def, options)),\n\n    filter: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.filter(pattern, ext(def, options)),\n\n    defaults: (options: MinimatchOptions) => orig.defaults(ext(def, options)),\n\n    makeRe: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.makeRe(pattern, ext(def, options)),\n\n    braceExpand: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.braceExpand(pattern, ext(def, options)),\n\n    match: (list: string[], pattern: string, options: MinimatchOptions = {}) =>\n      orig.match(list, pattern, ext(def, options)),\n\n    sep: orig.sep,\n    GLOBSTAR: GLOBSTAR as typeof GLOBSTAR,\n  })\n}\nminimatch.defaults = defaults\n\n// Brace expansion:\n// a{b,c}d -> abd acd\n// a{b,}c -> abc ac\n// a{0..3}d -> a0d a1d a2d a3d\n// a{b,c{d,e}f}g -> abg acdfg acefg\n// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg\n//\n// Invalid sets are not expanded.\n// a{2..}b -> a{2..}b\n// a{b}c -> a{b}c\nexport const braceExpand = (\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  assertValidPattern(pattern)\n\n  // Thanks to Yeting Li  for\n  // improving this regexp to avoid a ReDOS vulnerability.\n  if (options.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(pattern)) {\n    // shortcut. no need to expand.\n    return [pattern]\n  }\n\n  return expand(pattern)\n}\nminimatch.braceExpand = braceExpand\n\n// parse a component of the expanded set.\n// At this point, no pattern may contain \"/\" in it\n// so we're going to return a 2d array, where each entry is the full\n// pattern, split on '/', and then turned into a regular expression.\n// A regexp is made at the end which joins each array with an\n// escaped /, and another full one which joins each regexp with |.\n//\n// Following the lead of Bash 4.1, note that \"**\" only has special meaning\n// when it is the *only* thing in a path portion.  Otherwise, any series\n// of * is equivalent to a single *.  Globstar behavior is enabled by\n// default, and can be disabled by setting options.noglobstar.\n\nexport const makeRe = (pattern: string, options: MinimatchOptions = {}) =>\n  new Minimatch(pattern, options).makeRe()\nminimatch.makeRe = makeRe\n\nexport const match = (\n  list: string[],\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  const mm = new Minimatch(pattern, options)\n  list = list.filter(f => mm.match(f))\n  if (mm.options.nonull && !list.length) {\n    list.push(pattern)\n  }\n  return list\n}\nminimatch.match = match\n\n// replace stuff like \\* with *\nconst globMagic = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/\nconst regExpEscape = (s: string) =>\n  s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\nexport type MMRegExp = RegExp & {\n  _src?: string\n  _glob?: string\n}\n\nexport type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR\nexport type ParseReturn = ParseReturnFiltered | false\n\nexport class Minimatch {\n  options: MinimatchOptions\n  set: ParseReturnFiltered[][]\n  pattern: string\n\n  windowsPathsNoEscape: boolean\n  nonegate: boolean\n  negate: boolean\n  comment: boolean\n  empty: boolean\n  preserveMultipleSlashes: boolean\n  partial: boolean\n  globSet: string[]\n  globParts: string[][]\n  nocase: boolean\n\n  isWindows: boolean\n  platform: Platform\n  windowsNoMagicRoot: boolean\n\n  regexp: false | null | MMRegExp\n  constructor(pattern: string, options: MinimatchOptions = {}) {\n    assertValidPattern(pattern)\n\n    options = options || {}\n    this.options = options\n    this.pattern = pattern\n    this.platform = options.platform || defaultPlatform\n    this.isWindows = this.platform === 'win32'\n    this.windowsPathsNoEscape =\n      !!options.windowsPathsNoEscape || options.allowWindowsEscape === false\n    if (this.windowsPathsNoEscape) {\n      this.pattern = this.pattern.replace(/\\\\/g, '/')\n    }\n    this.preserveMultipleSlashes = !!options.preserveMultipleSlashes\n    this.regexp = null\n    this.negate = false\n    this.nonegate = !!options.nonegate\n    this.comment = false\n    this.empty = false\n    this.partial = !!options.partial\n    this.nocase = !!this.options.nocase\n    this.windowsNoMagicRoot =\n      options.windowsNoMagicRoot !== undefined\n        ? options.windowsNoMagicRoot\n        : !!(this.isWindows && this.nocase)\n\n    this.globSet = []\n    this.globParts = []\n    this.set = []\n\n    // make the set of regexps etc.\n    this.make()\n  }\n\n  hasMagic(): boolean {\n    if (this.options.magicalBraces && this.set.length > 1) {\n      return true\n    }\n    for (const pattern of this.set) {\n      for (const part of pattern) {\n        if (typeof part !== 'string') return true\n      }\n    }\n    return false\n  }\n\n  debug(..._: any[]) {}\n\n  make() {\n    const pattern = this.pattern\n    const options = this.options\n\n    // empty patterns and comments match nothing.\n    if (!options.nocomment && pattern.charAt(0) === '#') {\n      this.comment = true\n      return\n    }\n\n    if (!pattern) {\n      this.empty = true\n      return\n    }\n\n    // step 1: figure out negation, etc.\n    this.parseNegate()\n\n    // step 2: expand braces\n    this.globSet = [...new Set(this.braceExpand())]\n\n    if (options.debug) {\n      this.debug = (...args: any[]) => console.error(...args)\n    }\n\n    this.debug(this.pattern, this.globSet)\n\n    // step 3: now we have a set, so turn each one into a series of\n    // path-portion matching patterns.\n    // These will be regexps, except in the case of \"**\", which is\n    // set to the GLOBSTAR object for globstar behavior,\n    // and will not contain any / characters\n    //\n    // First, we preprocess to make the glob pattern sets a bit simpler\n    // and deduped.  There are some perf-killing patterns that can cause\n    // problems with a glob walk, but we can simplify them down a bit.\n    const rawGlobParts = this.globSet.map(s => this.slashSplit(s))\n    this.globParts = this.preprocess(rawGlobParts)\n    this.debug(this.pattern, this.globParts)\n\n    // glob --> regexps\n    let set = this.globParts.map((s, _, __) => {\n      if (this.isWindows && this.windowsNoMagicRoot) {\n        // check if it's a drive or unc path.\n        const isUNC =\n          s[0] === '' &&\n          s[1] === '' &&\n          (s[2] === '?' || !globMagic.test(s[2])) &&\n          !globMagic.test(s[3])\n        const isDrive = /^[a-z]:/i.test(s[0])\n        if (isUNC) {\n          return [...s.slice(0, 4), ...s.slice(4).map(ss => this.parse(ss))]\n        } else if (isDrive) {\n          return [s[0], ...s.slice(1).map(ss => this.parse(ss))]\n        }\n      }\n      return s.map(ss => this.parse(ss))\n    })\n\n    this.debug(this.pattern, set)\n\n    // filter out everything that didn't compile properly.\n    this.set = set.filter(\n      s => s.indexOf(false) === -1\n    ) as ParseReturnFiltered[][]\n\n    // do not treat the ? in UNC paths as magic\n    if (this.isWindows) {\n      for (let i = 0; i < this.set.length; i++) {\n        const p = this.set[i]\n        if (\n          p[0] === '' &&\n          p[1] === '' &&\n          this.globParts[i][2] === '?' &&\n          typeof p[3] === 'string' &&\n          /^[a-z]:$/i.test(p[3])\n        ) {\n          p[2] = '?'\n        }\n      }\n    }\n\n    this.debug(this.pattern, this.set)\n  }\n\n  // various transforms to equivalent pattern sets that are\n  // faster to process in a filesystem walk.  The goal is to\n  // eliminate what we can, and push all ** patterns as far\n  // to the right as possible, even if it increases the number\n  // of patterns that we have to process.\n  preprocess(globParts: string[][]) {\n    // if we're not in globstar mode, then turn all ** into *\n    if (this.options.noglobstar) {\n      for (let i = 0; i < globParts.length; i++) {\n        for (let j = 0; j < globParts[i].length; j++) {\n          if (globParts[i][j] === '**') {\n            globParts[i][j] = '*'\n          }\n        }\n      }\n    }\n\n    const { optimizationLevel = 1 } = this.options\n\n    if (optimizationLevel >= 2) {\n      // aggressive optimization for the purpose of fs walking\n      globParts = this.firstPhasePreProcess(globParts)\n      globParts = this.secondPhasePreProcess(globParts)\n    } else if (optimizationLevel >= 1) {\n      // just basic optimizations to remove some .. parts\n      globParts = this.levelOneOptimize(globParts)\n    } else {\n      // just collapse multiple ** portions into one\n      globParts = this.adjascentGlobstarOptimize(globParts)\n    }\n\n    return globParts\n  }\n\n  // just get rid of adjascent ** portions\n  adjascentGlobstarOptimize(globParts: string[][]) {\n    return globParts.map(parts => {\n      let gs: number = -1\n      while (-1 !== (gs = parts.indexOf('**', gs + 1))) {\n        let i = gs\n        while (parts[i + 1] === '**') {\n          i++\n        }\n        if (i !== gs) {\n          parts.splice(gs, i - gs)\n        }\n      }\n      return parts\n    })\n  }\n\n  // get rid of adjascent ** and resolve .. portions\n  levelOneOptimize(globParts: string[][]) {\n    return globParts.map(parts => {\n      parts = parts.reduce((set: string[], part) => {\n        const prev = set[set.length - 1]\n        if (part === '**' && prev === '**') {\n          return set\n        }\n        if (part === '..') {\n          if (prev && prev !== '..' && prev !== '.' && prev !== '**') {\n            set.pop()\n            return set\n          }\n        }\n        set.push(part)\n        return set\n      }, [])\n      return parts.length === 0 ? [''] : parts\n    })\n  }\n\n  levelTwoFileOptimize(parts: string | string[]) {\n    if (!Array.isArray(parts)) {\n      parts = this.slashSplit(parts)\n    }\n    let didSomething: boolean = false\n    do {\n      didSomething = false\n      // 
    // -> 
    /\n      if (!this.preserveMultipleSlashes) {\n        for (let i = 1; i < parts.length - 1; i++) {\n          const p = parts[i]\n          // don't squeeze out UNC patterns\n          if (i === 1 && p === '' && parts[0] === '') continue\n          if (p === '.' || p === '') {\n            didSomething = true\n            parts.splice(i, 1)\n            i--\n          }\n        }\n        if (\n          parts[0] === '.' &&\n          parts.length === 2 &&\n          (parts[1] === '.' || parts[1] === '')\n        ) {\n          didSomething = true\n          parts.pop()\n        }\n      }\n\n      // 
    /

    /../ ->

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

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

    /**/../

    /

    / -> {

    /../

    /

    /,

    /**/

    /

    /}\n //

    // -> 
    /\n  // 
    /

    /../ ->

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

    /

    / -> {

    /../

    /

    /,

    /**/

    /

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

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

    /../ ->

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

    /} ->

    /*/\n  // {
    /,
    /} -> 
    /\n  // {
    /**/,
    /} -> 
    /**/\n  //\n  // {
    /**/,
    /**/

    /} ->

    /**/\n  // ^-- not valid because ** doens't follow symlinks\n  secondPhasePreProcess(globParts: string[][]): string[][] {\n    for (let i = 0; i < globParts.length - 1; i++) {\n      for (let j = i + 1; j < globParts.length; j++) {\n        const matched = this.partsMatch(\n          globParts[i],\n          globParts[j],\n          !this.preserveMultipleSlashes\n        )\n        if (matched) {\n          globParts[i] = []\n          globParts[j] = matched\n          break\n        }\n      }\n    }\n    return globParts.filter(gs => gs.length)\n  }\n\n  partsMatch(\n    a: string[],\n    b: string[],\n    emptyGSMatch: boolean = false\n  ): false | string[] {\n    let ai = 0\n    let bi = 0\n    let result: string[] = []\n    let which: string = ''\n    while (ai < a.length && bi < b.length) {\n      if (a[ai] === b[bi]) {\n        result.push(which === 'b' ? b[bi] : a[ai])\n        ai++\n        bi++\n      } else if (emptyGSMatch && a[ai] === '**' && b[bi] === a[ai + 1]) {\n        result.push(a[ai])\n        ai++\n      } else if (emptyGSMatch && b[bi] === '**' && a[ai] === b[bi + 1]) {\n        result.push(b[bi])\n        bi++\n      } else if (\n        a[ai] === '*' &&\n        b[bi] &&\n        (this.options.dot || !b[bi].startsWith('.')) &&\n        b[bi] !== '**'\n      ) {\n        if (which === 'b') return false\n        which = 'a'\n        result.push(a[ai])\n        ai++\n        bi++\n      } else if (\n        b[bi] === '*' &&\n        a[ai] &&\n        (this.options.dot || !a[ai].startsWith('.')) &&\n        a[ai] !== '**'\n      ) {\n        if (which === 'a') return false\n        which = 'b'\n        result.push(b[bi])\n        ai++\n        bi++\n      } else {\n        return false\n      }\n    }\n    // if we fall out of the loop, it means they two are identical\n    // as long as their lengths match\n    return a.length === b.length && result\n  }\n\n  parseNegate() {\n    if (this.nonegate) return\n\n    const pattern = this.pattern\n    let negate = false\n    let negateOffset = 0\n\n    for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {\n      negate = !negate\n      negateOffset++\n    }\n\n    if (negateOffset) this.pattern = pattern.slice(negateOffset)\n    this.negate = negate\n  }\n\n  // set partial to true to test if, for example,\n  // \"/a/b\" matches the start of \"/*/b/*/d\"\n  // Partial means, if you run out of file before you run\n  // out of pattern, then that's fine, as long as all\n  // the parts match.\n  matchOne(file: string[], pattern: ParseReturn[], partial: boolean = false) {\n    const options = this.options\n\n    // UNC paths like //?/X:/... can match X:/... and vice versa\n    // Drive letters in absolute drive or unc paths are always compared\n    // case-insensitively.\n    if (this.isWindows) {\n      const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0])\n      const fileUNC =\n        !fileDrive &&\n        file[0] === '' &&\n        file[1] === '' &&\n        file[2] === '?' &&\n        /^[a-z]:$/i.test(file[3])\n\n      const patternDrive =\n        typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0])\n      const patternUNC =\n        !patternDrive &&\n        pattern[0] === '' &&\n        pattern[1] === '' &&\n        pattern[2] === '?' &&\n        typeof pattern[3] === 'string' &&\n        /^[a-z]:$/i.test(pattern[3])\n\n      const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined\n      const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined\n      if (typeof fdi === 'number' && typeof pdi === 'number') {\n        const [fd, pd]: [string, string] = [file[fdi], pattern[pdi] as string]\n        if (fd.toLowerCase() === pd.toLowerCase()) {\n          pattern[pdi] = fd\n          if (pdi > fdi) {\n            pattern = pattern.slice(pdi)\n          } else if (fdi > pdi) {\n            file = file.slice(fdi)\n          }\n        }\n      }\n    }\n\n    // resolve and reduce . and .. portions in the file as well.\n    // dont' need to do the second phase, because it's only one string[]\n    const { optimizationLevel = 1 } = this.options\n    if (optimizationLevel >= 2) {\n      file = this.levelTwoFileOptimize(file)\n    }\n\n    this.debug('matchOne', this, { file, pattern })\n    this.debug('matchOne', file.length, pattern.length)\n\n    for (\n      var fi = 0, pi = 0, fl = file.length, pl = pattern.length;\n      fi < fl && pi < pl;\n      fi++, pi++\n    ) {\n      this.debug('matchOne loop')\n      var p = pattern[pi]\n      var f = file[fi]\n\n      this.debug(pattern, p, f)\n\n      // should be impossible.\n      // some invalid regexp stuff in the set.\n      /* c8 ignore start */\n      if (p === false) {\n        return false\n      }\n      /* c8 ignore stop */\n\n      if (p === GLOBSTAR) {\n        this.debug('GLOBSTAR', [pattern, p, f])\n\n        // \"**\"\n        // a/**/b/**/c would match the following:\n        // a/b/x/y/z/c\n        // a/x/y/z/b/c\n        // a/b/x/b/x/c\n        // a/b/c\n        // To do this, take the rest of the pattern after\n        // the **, and see if it would match the file remainder.\n        // If so, return success.\n        // If not, the ** \"swallows\" a segment, and try again.\n        // This is recursively awful.\n        //\n        // a/**/b/**/c matching a/b/x/y/z/c\n        // - a matches a\n        // - doublestar\n        //   - matchOne(b/x/y/z/c, b/**/c)\n        //     - b matches b\n        //     - doublestar\n        //       - matchOne(x/y/z/c, c) -> no\n        //       - matchOne(y/z/c, c) -> no\n        //       - matchOne(z/c, c) -> no\n        //       - matchOne(c, c) yes, hit\n        var fr = fi\n        var pr = pi + 1\n        if (pr === pl) {\n          this.debug('** at the end')\n          // a ** at the end will just swallow the rest.\n          // We have found a match.\n          // however, it will not swallow /.x, unless\n          // options.dot is set.\n          // . and .. are *never* matched by **, for explosively\n          // exponential reasons.\n          for (; fi < fl; fi++) {\n            if (\n              file[fi] === '.' ||\n              file[fi] === '..' ||\n              (!options.dot && file[fi].charAt(0) === '.')\n            )\n              return false\n          }\n          return true\n        }\n\n        // ok, let's see if we can swallow whatever we can.\n        while (fr < fl) {\n          var swallowee = file[fr]\n\n          this.debug('\\nglobstar while', file, fr, pattern, pr, swallowee)\n\n          // XXX remove this slice.  Just pass the start index.\n          if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {\n            this.debug('globstar found match!', fr, fl, swallowee)\n            // found a match.\n            return true\n          } else {\n            // can't swallow \".\" or \"..\" ever.\n            // can only swallow \".foo\" when explicitly asked.\n            if (\n              swallowee === '.' ||\n              swallowee === '..' ||\n              (!options.dot && swallowee.charAt(0) === '.')\n            ) {\n              this.debug('dot detected!', file, fr, pattern, pr)\n              break\n            }\n\n            // ** swallows a segment, and continue.\n            this.debug('globstar swallow a segment, and continue')\n            fr++\n          }\n        }\n\n        // no match was found.\n        // However, in partial mode, we can't say this is necessarily over.\n        /* c8 ignore start */\n        if (partial) {\n          // ran out of file\n          this.debug('\\n>>> no match, partial?', file, fr, pattern, pr)\n          if (fr === fl) {\n            return true\n          }\n        }\n        /* c8 ignore stop */\n        return false\n      }\n\n      // something other than **\n      // non-magic patterns just have to match exactly\n      // patterns with magic have been turned into regexps.\n      let hit: boolean\n      if (typeof p === 'string') {\n        hit = f === p\n        this.debug('string match', p, f, hit)\n      } else {\n        hit = p.test(f)\n        this.debug('pattern match', p, f, hit)\n      }\n\n      if (!hit) return false\n    }\n\n    // Note: ending in / means that we'll get a final \"\"\n    // at the end of the pattern.  This can only match a\n    // corresponding \"\" at the end of the file.\n    // If the file ends in /, then it can only match a\n    // a pattern that ends in /, unless the pattern just\n    // doesn't have any more for it. But, a/b/ should *not*\n    // match \"a/b/*\", even though \"\" matches against the\n    // [^/]*? pattern, except in partial mode, where it might\n    // simply not be reached yet.\n    // However, a/b/ should still satisfy a/*\n\n    // now either we fell off the end of the pattern, or we're done.\n    if (fi === fl && pi === pl) {\n      // ran out of pattern and filename at the same time.\n      // an exact hit!\n      return true\n    } else if (fi === fl) {\n      // ran out of file, but still had pattern left.\n      // this is ok if we're doing the match as part of\n      // a glob fs traversal.\n      return partial\n    } else if (pi === pl) {\n      // ran out of pattern, still have file left.\n      // this is only acceptable if we're on the very last\n      // empty segment of a file with a trailing slash.\n      // a/* should match a/b/\n      return fi === fl - 1 && file[fi] === ''\n\n      /* c8 ignore start */\n    } else {\n      // should be unreachable.\n      throw new Error('wtf?')\n    }\n    /* c8 ignore stop */\n  }\n\n  braceExpand() {\n    return braceExpand(this.pattern, this.options)\n  }\n\n  parse(pattern: string): ParseReturn {\n    assertValidPattern(pattern)\n\n    const options = this.options\n\n    // shortcuts\n    if (pattern === '**') return GLOBSTAR\n    if (pattern === '') return ''\n\n    // far and away, the most common glob pattern parts are\n    // *, *.*, and *.  Add a fast check method for those.\n    let m: RegExpMatchArray | null\n    let fastTest: null | ((f: string) => boolean) = null\n    if ((m = pattern.match(starRE))) {\n      fastTest = options.dot ? starTestDot : starTest\n    } else if ((m = pattern.match(starDotExtRE))) {\n      fastTest = (\n        options.nocase\n          ? options.dot\n            ? starDotExtTestNocaseDot\n            : starDotExtTestNocase\n          : options.dot\n          ? starDotExtTestDot\n          : starDotExtTest\n      )(m[1])\n    } else if ((m = pattern.match(qmarksRE))) {\n      fastTest = (\n        options.nocase\n          ? options.dot\n            ? qmarksTestNocaseDot\n            : qmarksTestNocase\n          : options.dot\n          ? qmarksTestDot\n          : qmarksTest\n      )(m)\n    } else if ((m = pattern.match(starDotStarRE))) {\n      fastTest = options.dot ? starDotStarTestDot : starDotStarTest\n    } else if ((m = pattern.match(dotStarRE))) {\n      fastTest = dotStarTest\n    }\n\n    const re = AST.fromGlob(pattern, this.options).toMMPattern()\n    if (fastTest && typeof re === 'object') {\n      // Avoids overriding in frozen environments\n      Reflect.defineProperty(re, 'test', { value: fastTest })\n    }\n    return re\n  }\n\n  makeRe() {\n    if (this.regexp || this.regexp === false) return this.regexp\n\n    // at this point, this.set is a 2d array of partial\n    // pattern strings, or \"**\".\n    //\n    // It's better to use .match().  This function shouldn't\n    // be used, really, but it's pretty convenient sometimes,\n    // when you just want to work with a regex.\n    const set = this.set\n\n    if (!set.length) {\n      this.regexp = false\n      return this.regexp\n    }\n    const options = this.options\n\n    const twoStar = options.noglobstar\n      ? star\n      : options.dot\n      ? twoStarDot\n      : twoStarNoDot\n    const flags = new Set(options.nocase ? ['i'] : [])\n\n    // regexpify non-globstar patterns\n    // if ** is only item, then we just do one twoStar\n    // if ** is first, and there are more, prepend (\\/|twoStar\\/)? to next\n    // if ** is last, append (\\/twoStar|) to previous\n    // if ** is in the middle, append (\\/|\\/twoStar\\/) to previous\n    // then filter out GLOBSTAR symbols\n    let re = set\n      .map(pattern => {\n        const pp: (string | typeof GLOBSTAR)[] = pattern.map(p => {\n          if (p instanceof RegExp) {\n            for (const f of p.flags.split('')) flags.add(f)\n          }\n          return typeof p === 'string'\n            ? regExpEscape(p)\n            : p === GLOBSTAR\n            ? GLOBSTAR\n            : p._src\n        }) as (string | typeof GLOBSTAR)[]\n        pp.forEach((p, i) => {\n          const next = pp[i + 1]\n          const prev = pp[i - 1]\n          if (p !== GLOBSTAR || prev === GLOBSTAR) {\n            return\n          }\n          if (prev === undefined) {\n            if (next !== undefined && next !== GLOBSTAR) {\n              pp[i + 1] = '(?:\\\\/|' + twoStar + '\\\\/)?' + next\n            } else {\n              pp[i] = twoStar\n            }\n          } else if (next === undefined) {\n            pp[i - 1] = prev + '(?:\\\\/|' + twoStar + ')?'\n          } else if (next !== GLOBSTAR) {\n            pp[i - 1] = prev + '(?:\\\\/|\\\\/' + twoStar + '\\\\/)' + next\n            pp[i + 1] = GLOBSTAR\n          }\n        })\n        return pp.filter(p => p !== GLOBSTAR).join('/')\n      })\n      .join('|')\n\n    // need to wrap in parens if we had more than one thing with |,\n    // otherwise only the first will be anchored to ^ and the last to $\n    const [open, close] = set.length > 1 ? ['(?:', ')'] : ['', '']\n    // must match entire pattern\n    // ending in a * or ** will make it less strict.\n    re = '^' + open + re + close + '$'\n\n    // can match anything, as long as it's not this.\n    if (this.negate) re = '^(?!' + re + ').+$'\n\n    try {\n      this.regexp = new RegExp(re, [...flags].join(''))\n      /* c8 ignore start */\n    } catch (ex) {\n      // should be impossible\n      this.regexp = false\n    }\n    /* c8 ignore stop */\n    return this.regexp\n  }\n\n  slashSplit(p: string) {\n    // if p starts with // on windows, we preserve that\n    // so that UNC paths aren't broken.  Otherwise, any number of\n    // / characters are coalesced into one, unless\n    // preserveMultipleSlashes is set to true.\n    if (this.preserveMultipleSlashes) {\n      return p.split('/')\n    } else if (this.isWindows && /^\\/\\/[^\\/]+/.test(p)) {\n      // add an extra '' for the one we lose\n      return ['', ...p.split(/\\/+/)]\n    } else {\n      return p.split(/\\/+/)\n    }\n  }\n\n  match(f: string, partial = this.partial) {\n    this.debug('match', f, this.pattern)\n    // short-circuit in the case of busted things.\n    // comments, etc.\n    if (this.comment) {\n      return false\n    }\n    if (this.empty) {\n      return f === ''\n    }\n\n    if (f === '/' && partial) {\n      return true\n    }\n\n    const options = this.options\n\n    // windows: need to use /, not \\\n    if (this.isWindows) {\n      f = f.split('\\\\').join('/')\n    }\n\n    // treat the test path as a set of pathparts.\n    const ff = this.slashSplit(f)\n    this.debug(this.pattern, 'split', ff)\n\n    // just ONE of the pattern sets in this.set needs to match\n    // in order for it to be valid.  If negating, then just one\n    // match means that we have failed.\n    // Either way, return on the first hit.\n\n    const set = this.set\n    this.debug(this.pattern, 'set', set)\n\n    // Find the basename of the path by looking for the last non-empty segment\n    let filename: string = ff[ff.length - 1]\n    if (!filename) {\n      for (let i = ff.length - 2; !filename && i >= 0; i--) {\n        filename = ff[i]\n      }\n    }\n\n    for (let i = 0; i < set.length; i++) {\n      const pattern = set[i]\n      let file = ff\n      if (options.matchBase && pattern.length === 1) {\n        file = [filename]\n      }\n      const hit = this.matchOne(file, pattern, partial)\n      if (hit) {\n        if (options.flipNegate) {\n          return true\n        }\n        return !this.negate\n      }\n    }\n\n    // didn't get any hits.  this is success if it's a negative\n    // pattern, failure otherwise.\n    if (options.flipNegate) {\n      return false\n    }\n    return this.negate\n  }\n\n  static defaults(def: MinimatchOptions) {\n    return minimatch.defaults(def).Minimatch\n  }\n}\n/* c8 ignore start */\nexport { AST } from './ast.js'\nexport { escape } from './escape.js'\nexport { unescape } from './unescape.js'\n/* c8 ignore stop */\nminimatch.AST = AST\nminimatch.Minimatch = Minimatch\nminimatch.escape = escape\nminimatch.unescape = unescape\n"]}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/package.json b/node_modules/rimraf/node_modules/minimatch/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.d.ts b/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.d.ts
    new file mode 100644
    index 00000000..23a7b387
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.d.ts
    @@ -0,0 +1,17 @@
    +import { MinimatchOptions } from './index.js';
    +/**
    + * 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 declare const unescape: (s: string, { windowsPathsNoEscape, }?: Pick) => string;
    +//# sourceMappingURL=unescape.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.d.ts.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.d.ts.map
    new file mode 100644
    index 00000000..7ace0701
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"unescape.d.ts","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,MAChB,MAAM,8BAGN,KAAK,gBAAgB,EAAE,sBAAsB,CAAC,WAKlD,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.js b/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.js
    new file mode 100644
    index 00000000..0faf9a2b
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.js
    @@ -0,0 +1,20 @@
    +/**
    + * 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/rimraf/node_modules/minimatch/dist/esm/unescape.js.map b/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.js.map
    new file mode 100644
    index 00000000..eb146c20
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/dist/esm/unescape.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"unescape.js","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC;QACnC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAChF,CAAC,CAAA","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Un-escape a string that has been escaped with {@link escape}.\n *\n * If the {@link windowsPathsNoEscape} option is used, then square-brace\n * escapes are removed, but not backslash escapes.  For example, it will turn\n * the string `'[*]'` into `*`, but it will not turn `'\\\\*'` into `'*'`,\n * becuase `\\` is a path separator in `windowsPathsNoEscape` mode.\n *\n * When `windowsPathsNoEscape` is not set, then both brace escapes and\n * backslash escapes are removed.\n *\n * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped\n * or unescaped.\n */\nexport const unescape = (\n  s: string,\n  {\n    windowsPathsNoEscape = false,\n  }: Pick = {}\n) => {\n  return windowsPathsNoEscape\n    ? s.replace(/\\[([^\\/\\\\])\\]/g, '$1')\n    : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, '$1$2').replace(/\\\\([^\\/])/g, '$1')\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/rimraf/node_modules/minimatch/package.json b/node_modules/rimraf/node_modules/minimatch/package.json
    new file mode 100644
    index 00000000..01fc48ec
    --- /dev/null
    +++ b/node_modules/rimraf/node_modules/minimatch/package.json
    @@ -0,0 +1,82 @@
    +{
    +  "author": "Isaac Z. Schlueter  (http://blog.izs.me)",
    +  "name": "minimatch",
    +  "description": "a glob matcher in javascript",
    +  "version": "9.0.5",
    +  "repository": {
    +    "type": "git",
    +    "url": "git://github.com/isaacs/minimatch.git"
    +  },
    +  "main": "./dist/commonjs/index.js",
    +  "types": "./dist/commonjs/index.d.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",
    +    "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",
    +    "eslint-config-prettier": "^8.6.0",
    +    "mkdirp": "1",
    +    "prettier": "^2.8.2",
    +    "tap": "^18.7.2",
    +    "ts-node": "^10.9.1",
    +    "tshy": "^1.12.0",
    +    "typedoc": "^0.23.21",
    +    "typescript": "^4.9.3"
    +  },
    +  "funding": {
    +    "url": "https://github.com/sponsors/isaacs"
    +  },
    +  "license": "ISC",
    +  "tshy": {
    +    "exports": {
    +      "./package.json": "./package.json",
    +      ".": "./src/index.ts"
    +    }
    +  },
    +  "type": "module"
    +}
    diff --git a/node_modules/run-parallel/LICENSE b/node_modules/run-parallel/LICENSE
    new file mode 100644
    index 00000000..c7e68527
    --- /dev/null
    +++ b/node_modules/run-parallel/LICENSE
    @@ -0,0 +1,20 @@
    +The MIT License (MIT)
    +
    +Copyright (c) Feross Aboukhadijeh
    +
    +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/run-parallel/README.md b/node_modules/run-parallel/README.md
    new file mode 100644
    index 00000000..edc3da45
    --- /dev/null
    +++ b/node_modules/run-parallel/README.md
    @@ -0,0 +1,85 @@
    +# run-parallel [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
    +
    +[travis-image]: https://img.shields.io/travis/feross/run-parallel/master.svg
    +[travis-url]: https://travis-ci.org/feross/run-parallel
    +[npm-image]: https://img.shields.io/npm/v/run-parallel.svg
    +[npm-url]: https://npmjs.org/package/run-parallel
    +[downloads-image]: https://img.shields.io/npm/dm/run-parallel.svg
    +[downloads-url]: https://npmjs.org/package/run-parallel
    +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
    +[standard-url]: https://standardjs.com
    +
    +### Run an array of functions in parallel
    +
    +![parallel](https://raw.githubusercontent.com/feross/run-parallel/master/img.png) [![Sauce Test Status](https://saucelabs.com/browser-matrix/run-parallel.svg)](https://saucelabs.com/u/run-parallel)
    +
    +### install
    +
    +```
    +npm install run-parallel
    +```
    +
    +### usage
    +
    +#### parallel(tasks, [callback])
    +
    +Run the `tasks` array of functions in parallel, without waiting until the previous
    +function has completed. If any of the functions pass an error to its callback, the main
    +`callback` is immediately called with the value of the error. Once the `tasks` have
    +completed, the results are passed to the final `callback` as an array.
    +
    +It is also possible to use an object instead of an array. Each property will be run as a
    +function and the results will be passed to the final `callback` as an object instead of
    +an array. This can be a more readable way of handling the results.
    +
    +##### arguments
    +
    +- `tasks` - An array or object containing functions to run. Each function is passed a
    +`callback(err, result)` which it must call on completion with an error `err` (which can
    +be `null`) and an optional `result` value.
    +- `callback(err, results)` - An optional callback to run once all the functions have
    +completed. This function gets a results array (or object) containing all the result
    +arguments passed to the task callbacks.
    +
    +##### example
    +
    +```js
    +var parallel = require('run-parallel')
    +
    +parallel([
    +  function (callback) {
    +    setTimeout(function () {
    +      callback(null, 'one')
    +    }, 200)
    +  },
    +  function (callback) {
    +    setTimeout(function () {
    +      callback(null, 'two')
    +    }, 100)
    +  }
    +],
    +// optional callback
    +function (err, results) {
    +  // the results array will equal ['one','two'] even though
    +  // the second function had a shorter timeout.
    +})
    +```
    +
    +This module is basically equavalent to
    +[`async.parallel`](https://github.com/caolan/async#paralleltasks-callback), but it's
    +handy to just have the one function you need instead of the kitchen sink. Modularity!
    +Especially handy if you're serving to the browser and need to reduce your javascript
    +bundle size.
    +
    +Works great in the browser with [browserify](http://browserify.org/)!
    +
    +### see also
    +
    +- [run-auto](https://github.com/feross/run-auto)
    +- [run-parallel-limit](https://github.com/feross/run-parallel-limit)
    +- [run-series](https://github.com/feross/run-series)
    +- [run-waterfall](https://github.com/feross/run-waterfall)
    +
    +### license
    +
    +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).
    diff --git a/node_modules/run-parallel/index.js b/node_modules/run-parallel/index.js
    new file mode 100644
    index 00000000..6307141d
    --- /dev/null
    +++ b/node_modules/run-parallel/index.js
    @@ -0,0 +1,51 @@
    +/*! run-parallel. MIT License. Feross Aboukhadijeh  */
    +module.exports = runParallel
    +
    +const queueMicrotask = require('queue-microtask')
    +
    +function runParallel (tasks, cb) {
    +  let results, pending, keys
    +  let isSync = true
    +
    +  if (Array.isArray(tasks)) {
    +    results = []
    +    pending = tasks.length
    +  } else {
    +    keys = Object.keys(tasks)
    +    results = {}
    +    pending = keys.length
    +  }
    +
    +  function done (err) {
    +    function end () {
    +      if (cb) cb(err, results)
    +      cb = null
    +    }
    +    if (isSync) queueMicrotask(end)
    +    else end()
    +  }
    +
    +  function each (i, err, result) {
    +    results[i] = result
    +    if (--pending === 0 || err) {
    +      done(err)
    +    }
    +  }
    +
    +  if (!pending) {
    +    // empty
    +    done(null)
    +  } else if (keys) {
    +    // object
    +    keys.forEach(function (key) {
    +      tasks[key](function (err, result) { each(key, err, result) })
    +    })
    +  } else {
    +    // array
    +    tasks.forEach(function (task, i) {
    +      task(function (err, result) { each(i, err, result) })
    +    })
    +  }
    +
    +  isSync = false
    +}
    diff --git a/node_modules/run-parallel/package.json b/node_modules/run-parallel/package.json
    new file mode 100644
    index 00000000..1f147578
    --- /dev/null
    +++ b/node_modules/run-parallel/package.json
    @@ -0,0 +1,58 @@
    +{
    +  "name": "run-parallel",
    +  "description": "Run an array of functions in parallel",
    +  "version": "1.2.0",
    +  "author": {
    +    "name": "Feross Aboukhadijeh",
    +    "email": "feross@feross.org",
    +    "url": "https://feross.org"
    +  },
    +  "bugs": {
    +    "url": "https://github.com/feross/run-parallel/issues"
    +  },
    +  "dependencies": {
    +    "queue-microtask": "^1.2.2"
    +  },
    +  "devDependencies": {
    +    "airtap": "^3.0.0",
    +    "standard": "*",
    +    "tape": "^5.0.1"
    +  },
    +  "homepage": "https://github.com/feross/run-parallel",
    +  "keywords": [
    +    "parallel",
    +    "async",
    +    "function",
    +    "callback",
    +    "asynchronous",
    +    "run",
    +    "array",
    +    "run parallel"
    +  ],
    +  "license": "MIT",
    +  "main": "index.js",
    +  "repository": {
    +    "type": "git",
    +    "url": "git://github.com/feross/run-parallel.git"
    +  },
    +  "scripts": {
    +    "test": "standard && npm run test-node && npm run test-browser",
    +    "test-browser": "airtap -- test/*.js",
    +    "test-browser-local": "airtap --local -- test/*.js",
    +    "test-node": "tape test/*.js"
    +  },
    +  "funding": [
    +    {
    +      "type": "github",
    +      "url": "https://github.com/sponsors/feross"
    +    },
    +    {
    +      "type": "patreon",
    +      "url": "https://www.patreon.com/feross"
    +    },
    +    {
    +      "type": "consulting",
    +      "url": "https://feross.org/support"
    +    }
    +  ]
    +}
    diff --git a/node_modules/sade/index.d.ts b/node_modules/sade/index.d.ts
    new file mode 100644
    index 00000000..4a269ecc
    --- /dev/null
    +++ b/node_modules/sade/index.d.ts
    @@ -0,0 +1,37 @@
    +import type * as mri from 'mri';
    +
    +type Arrayable = T | T[];
    +
    +declare function sade(usage: string, isSingle?: boolean): sade.Sade;
    +
    +declare namespace sade {
    +	export type Handler = (...args: any[]) => any;
    +	export type Value = number | string | boolean | null;
    +
    +	export interface LazyOutput {
    +		name: string;
    +		handler: Handler;
    +		args: string[];
    +	}
    +
    +	export interface Sade {
    +		command(usage: string, description?: string, options?: {
    +			alias?: Arrayable;
    +			default?: boolean;
    +		}): Sade;
    +
    +		option(flag: string, description?: string, value?: Value): Sade;
    +		action(handler: Handler): Sade;
    +		describe(text: Arrayable): Sade;
    +		alias(...names: string[]): Sade;
    +		example(usage: string): Sade;
    +
    +		parse(arr: string[], opts: { lazy: true } & mri.Options): LazyOutput;
    +		parse(arr: string[], opts?: { lazy?: boolean } & mri.Options): void;
    +
    +		version(value: string): Sade;
    +		help(cmd?: string): void;
    +	}
    +}
    +
    +export = sade;
    diff --git a/node_modules/sade/lib/index.js b/node_modules/sade/lib/index.js
    new file mode 100644
    index 00000000..146fb979
    --- /dev/null
    +++ b/node_modules/sade/lib/index.js
    @@ -0,0 +1 @@
    +const e=require("mri"),t="__all__",i="__default__",s="\n";function r(e){if(!e.length)return"";let t=function(e){let t=0,i=0,s=0,r=e.length;if(r)for(;r--;)i=e[r].length,i>t&&(s=r,t=i);return e[s].length}(e.map(e=>e[0]))+4;return e.map(e=>e[0]+" ".repeat(t-e[0].length)+e[1]+(null==e[2]?"":`  (default ${e[2]})`))}function n(e){return e}function l(e,t,i){if(!t||!t.length)return"";let r=0,n="";for(n+="\n  "+e;r0,this.bin=r,this.ver="0.0.0",this.default="",this.tree={},this.command(t),this.command([i].concat(s?n:"").join(" ")),this.single=s,this.curr=""}command(e,t,i={}){if(this.single)throw new Error('Disable "single" mode to add commands');let s=[],r=[],n=/(\[|<)/;if(e.split(/\s+/).forEach(e=>{(n.test(e.charAt(0))?r:s).push(e)}),s=s.join(" "),s in this.tree)throw new Error("Command already exists: "+s);return s.includes("__")||r.unshift(s),r=r.join(" "),this.curr=s,i.default&&(this.default=s),this.tree[s]={usage:r,alibi:[],options:[],alias:{},default:{},examples:[]},i.alias&&this.alias(i.alias),t&&this.describe(t),this}describe(e){return this.tree[this.curr||i].describe=Array.isArray(e)?e:function(e){return(e||"").replace(/([.?!])\s*(?=[A-Z])/g,"$1|").split("|")}(e),this}alias(...e){if(this.single)throw new Error('Cannot call `alias()` in "single" mode');if(!this.curr)throw new Error("Cannot call `alias()` before defining a command");return(this.tree[this.curr].alibi=this.tree[this.curr].alibi.concat(...e)).forEach(e=>this.tree[e]=this.curr),this}option(e,i,s){let r=this.tree[this.curr||t],[n,l]=function(e){return(e||"").split(/^-{1,2}|,|\s+-{1,2}|\s+/).filter(Boolean)}(e);if(l&&l.length>1&&([n,l]=[l,n]),e="--"+n,l&&l.length>0){e=`-${l}, ${e}`;let t=r.alias[l];r.alias[l]=(t||[]).concat(n)}let a=[e,i||""];return void 0!==s?(a.push(s),r.default[n]=s):l||(r.default[n]=void 0),r.options.push(a),this}action(e){return this.tree[this.curr||i].handler=e,this}example(e){return this.tree[this.curr||i].examples.push(e),this}version(e){return this.ver=e,this}parse(s,r={}){s=s.slice();let n,l,o,h,u=2,c=e(s.slice(u),{alias:{h:"help",v:"version"}}),f=this.single,p=this.bin,d="";if(f)h=this.tree[i];else{let e,t=1,i=c._.length+1;for(;t"<"===e.charAt(0)),v=m._.splice(0,_.length);if(v.length<_.length)return d&&(p+=" "+d),a(p,"Insufficient arguments!");b.filter(e=>"["===e.charAt(0)).forEach(e=>{v.push(m._.shift())}),v.push(m);let $=h.handler;return r.lazy?{args:v,name:d,handler:$}:$.apply(null,v)}help(e){console.log(function(e,a,o,h){let u="",c=a[o],f="$ "+e,p=a[t],d=e=>`${f} ${e}`.replace(/\s+/g," "),g=[["-h, --help","Displays this message"]];if(o===i&&g.unshift(["-v, --version","Displays current version"]),c.options=(c.options||[]).concat(p.options,g),c.options.length>0&&(c.usage+=" [options]"),u+=l("Description",c.describe,n),u+=l("Usage",[c.usage],d),h||o!==i)h||o===i||(u+=l("Aliases",c.alibi,d));else{let e,t=/^__/,i="",o=[];for(e in a)"string"==typeof a[e]||t.test(e)||o.push([e,(a[e].describe||[""])[0]])<3&&(i+=`\n    ${f} ${e} --help`);u+=l("Available Commands",r(o),n),u+="\n  For more info, run any command with the `--help` flag"+i+s}return u+=l("Options",r(c.options),n),u+=l("Examples",c.examples.map(d),n),u}(this.bin,this.tree,e||i,this.single))}_version(){console.log(`${this.bin}, ${this.ver}`)}}module.exports=(e,t)=>new o(e,t);
    diff --git a/node_modules/sade/lib/index.mjs b/node_modules/sade/lib/index.mjs
    new file mode 100644
    index 00000000..76d35dc1
    --- /dev/null
    +++ b/node_modules/sade/lib/index.mjs
    @@ -0,0 +1 @@
    +import e from"mri";const t="__all__",i="__default__",s="\n";function r(e){if(!e.length)return"";let t=function(e){let t=0,i=0,s=0,r=e.length;if(r)for(;r--;)i=e[r].length,i>t&&(s=r,t=i);return e[s].length}(e.map(e=>e[0]))+4;return e.map(e=>e[0]+" ".repeat(t-e[0].length)+e[1]+(null==e[2]?"":`  (default ${e[2]})`))}function n(e){return e}function l(e,t,i){if(!t||!t.length)return"";let r=0,n="";for(n+="\n  "+e;r0,this.bin=r,this.ver="0.0.0",this.default="",this.tree={},this.command(t),this.command([i].concat(s?n:"").join(" ")),this.single=s,this.curr=""}command(e,t,i={}){if(this.single)throw new Error('Disable "single" mode to add commands');let s=[],r=[],n=/(\[|<)/;if(e.split(/\s+/).forEach(e=>{(n.test(e.charAt(0))?r:s).push(e)}),s=s.join(" "),s in this.tree)throw new Error("Command already exists: "+s);return s.includes("__")||r.unshift(s),r=r.join(" "),this.curr=s,i.default&&(this.default=s),this.tree[s]={usage:r,alibi:[],options:[],alias:{},default:{},examples:[]},i.alias&&this.alias(i.alias),t&&this.describe(t),this}describe(e){return this.tree[this.curr||i].describe=Array.isArray(e)?e:function(e){return(e||"").replace(/([.?!])\s*(?=[A-Z])/g,"$1|").split("|")}(e),this}alias(...e){if(this.single)throw new Error('Cannot call `alias()` in "single" mode');if(!this.curr)throw new Error("Cannot call `alias()` before defining a command");return(this.tree[this.curr].alibi=this.tree[this.curr].alibi.concat(...e)).forEach(e=>this.tree[e]=this.curr),this}option(e,i,s){let r=this.tree[this.curr||t],[n,l]=function(e){return(e||"").split(/^-{1,2}|,|\s+-{1,2}|\s+/).filter(Boolean)}(e);if(l&&l.length>1&&([n,l]=[l,n]),e="--"+n,l&&l.length>0){e=`-${l}, ${e}`;let t=r.alias[l];r.alias[l]=(t||[]).concat(n)}let a=[e,i||""];return void 0!==s?(a.push(s),r.default[n]=s):l||(r.default[n]=void 0),r.options.push(a),this}action(e){return this.tree[this.curr||i].handler=e,this}example(e){return this.tree[this.curr||i].examples.push(e),this}version(e){return this.ver=e,this}parse(s,r={}){s=s.slice();let n,l,o,h,u=2,f=e(s.slice(u),{alias:{h:"help",v:"version"}}),c=this.single,p=this.bin,d="";if(c)h=this.tree[i];else{let e,t=1,i=f._.length+1;for(;t"<"===e.charAt(0)),v=m._.splice(0,_.length);if(v.length<_.length)return d&&(p+=" "+d),a(p,"Insufficient arguments!");b.filter(e=>"["===e.charAt(0)).forEach(e=>{v.push(m._.shift())}),v.push(m);let $=h.handler;return r.lazy?{args:v,name:d,handler:$}:$.apply(null,v)}help(e){console.log(function(e,a,o,h){let u="",f=a[o],c="$ "+e,p=a[t],d=e=>`${c} ${e}`.replace(/\s+/g," "),g=[["-h, --help","Displays this message"]];if(o===i&&g.unshift(["-v, --version","Displays current version"]),f.options=(f.options||[]).concat(p.options,g),f.options.length>0&&(f.usage+=" [options]"),u+=l("Description",f.describe,n),u+=l("Usage",[f.usage],d),h||o!==i)h||o===i||(u+=l("Aliases",f.alibi,d));else{let e,t=/^__/,i="",o=[];for(e in a)"string"==typeof a[e]||t.test(e)||o.push([e,(a[e].describe||[""])[0]])<3&&(i+=`\n    ${c} ${e} --help`);u+=l("Available Commands",r(o),n),u+="\n  For more info, run any command with the `--help` flag"+i+s}return u+=l("Options",r(f.options),n),u+=l("Examples",f.examples.map(d),n),u}(this.bin,this.tree,e||i,this.single))}_version(){console.log(`${this.bin}, ${this.ver}`)}}export default(e,t)=>new o(e,t);
    diff --git a/node_modules/sade/license b/node_modules/sade/license
    new file mode 100644
    index 00000000..d46889ae
    --- /dev/null
    +++ b/node_modules/sade/license
    @@ -0,0 +1,21 @@
    +The MIT License (MIT)
    +
    +Copyright (c) Luke Edwards  (https://lukeed.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/sade/package.json b/node_modules/sade/package.json
    new file mode 100644
    index 00000000..bb40f10d
    --- /dev/null
    +++ b/node_modules/sade/package.json
    @@ -0,0 +1,45 @@
    +{
    +  "name": "sade",
    +  "version": "1.8.1",
    +  "description": "Smooth (CLI) operator 🎶",
    +  "repository": "lukeed/sade",
    +  "module": "lib/index.mjs",
    +  "main": "lib/index.js",
    +  "types": "index.d.ts",
    +  "license": "MIT",
    +  "files": [
    +    "*.d.ts",
    +    "lib"
    +  ],
    +  "author": {
    +    "name": "Luke Edwards",
    +    "email": "luke.edwards05@gmail.com",
    +    "url": "https://lukeed.com"
    +  },
    +  "scripts": {
    +    "build": "rollup -c",
    +    "test": "tape -r esm test/*.js | tap-spec"
    +  },
    +  "dependencies": {
    +    "mri": "^1.1.0"
    +  },
    +  "engines": {
    +    "node": ">=6"
    +  },
    +  "keywords": [
    +    "cli",
    +    "cli-app",
    +    "commander",
    +    "arguments",
    +    "parser",
    +    "yargs",
    +    "argv"
    +  ],
    +  "devDependencies": {
    +    "esm": "3.2.25",
    +    "rollup": "1.32.1",
    +    "tap-spec": "4.1.2",
    +    "tape": "4.14.0",
    +    "terser": "4.8.0"
    +  }
    +}
    diff --git a/node_modules/sade/readme.md b/node_modules/sade/readme.md
    new file mode 100644
    index 00000000..fb8f70c5
    --- /dev/null
    +++ b/node_modules/sade/readme.md
    @@ -0,0 +1,672 @@
    +# sade [![Build Status](https://travis-ci.org/lukeed/sade.svg?branch=master)](https://travis-ci.org/lukeed/sade)
    +
    +> Smooth (CLI) Operator 🎶
    +
    +Sade is a small but powerful tool for building command-line interface (CLI) applications for Node.js that are fast, responsive, and helpful!
    +
    +It enables default commands, git-like subcommands, option flags with aliases, default option values with type-casting, required-vs-optional argument handling, command validation, and automated help text generation!
    +
    +Your app's UX will be as smooth as butter... just like [Sade's voice](https://www.youtube.com/watch?v=4TYv2PhG89A). 😉
    +
    +
    +## Install
    +
    +```
    +$ npm install --save sade
    +```
    +
    +
    +## Usage
    +
    +***Input:***
    +
    +```js
    +#!/usr/bin/env node
    +
    +const sade = require('sade');
    +
    +const prog = sade('my-cli');
    +
    +prog
    +  .version('1.0.5')
    +  .option('--global, -g', 'An example global flag')
    +  .option('-c, --config', 'Provide path to custom config', 'foo.config.js');
    +
    +prog
    +  .command('build  ')
    +  .describe('Build the source directory. Expects an `index.js` entry file.')
    +  .option('-o, --output', 'Change the name of the output file', 'bundle.js')
    +  .example('build src build --global --config my-conf.js')
    +  .example('build app public -o main.js')
    +  .action((src, dest, opts) => {
    +    console.log(`> building from ${src} to ${dest}`);
    +    console.log('> these are extra opts', opts);
    +  });
    +
    +prog.parse(process.argv);
    +```
    +
    +***Output:***
    +
    +```a
    +$ my-cli --help
    +
    +  Usage
    +    $ my-cli  [options]
    +
    +  Available Commands
    +    build    Build the source directory.
    +
    +  For more info, run any command with the `--help` flag
    +    $ my-cli build --help
    +
    +  Options
    +    -v, --version    Displays current version
    +    -g, --global     An example global flag
    +    -c, --config     Provide path to custom config  (default foo.config.js)
    +    -h, --help       Displays this message
    +
    +
    +$ my-cli build --help
    +
    +  Description
    +    Build the source directory.
    +    Expects an `index.js` entry file.
    +
    +  Usage
    +    $ my-cli build  [options]
    +
    +  Options
    +    -o, --output    Change the name of the output file  (default bundle.js)
    +    -g, --global    An example global flag
    +    -c, --config    Provide path to custom config  (default foo.config.js)
    +    -h, --help      Displays this message
    +
    +  Examples
    +    $ my-cli build src build --global --config my-conf.js
    +    $ my-cli build app public -o main.js
    +```
    +
    +## Tips
    +
    +- **Define your global/program-wide version, options, description, and/or examples first.**
    + _Once you define a Command, you can't access the global-scope again._ + +- **Define all commands & options in the order that you want them to appear.**
    + _Sade will not mutate or sort your CLI for you. Global options print before local options._ + +- **Required arguments without values will error & exit**
    + _An `Insufficient arguments!` error will be displayed along with a help prompt._ + +- **Don't worry about manually displaying help~!**
    + _Your help text is displayed automatically... including command-specific help text!_ + +- **Automatic default/basic patterns**
    + _Usage text will always append `[options]` & `--help` and `--version` are done for you._ + +- **Only define what you want to display!**
    + _Help text sections (example, options, etc) will only display if you provide values._ + + +## Subcommands + +Subcommands are defined & parsed like any other command! When defining their [`usage`](#usage-1), everything up until the first argument (`[foo]` or ``) is interpreted as the command string. + +They should be defined in the order that you want them to appear in your general `--help` output. + +Lastly, it is _not_ necessary to define the subcommand's "base" as an additional command. However, if you choose to do so, it's recommended that you define it first for better visibility. + +```js +const prog = sade('git'); + +// Not necessary for subcommands to work, but it's here anyway! +prog + .command('remote') + .describe('Manage set of tracked repositories') + .action(opts => { + console.log('~> Print current remotes...'); + }); + +prog + .command('remote add ', 'Demo...') + .action((name, url, opts) => { + console.log(`~> Adding a new remote (${name}) to ${url}`); + }); + +prog + .command('remote rename ', 'Demo...') + .action((old, nxt, opts) => { + console.log(`~> Renaming from ${old} to ${nxt}~!`); + }); +``` + + +## Single Command Mode + +In certain circumstances, you may only need `sade` for a single-command CLI application. + +> **Note:** Until `v1.6.0`, this made for an awkward pairing. + +To enable this, you may make use of the [`isSingle`](#issingle) argument. Doing so allows you to pass the program's entire [`usage` text](#usage-1) into the `name` argument. + +With "Single Command Mode" enabled, your entire binary operates as one command. This means that any [`prog.command`](#progcommandusage-desc-opts) calls are disallowed & will instead throw an Error. Of course, you may still define a program version, a description, an example or two, and declare options. You are customizing the program's attributes as a whole.* + +> * This is true for multi-command applications, too, up until your first `prog.command()` call! + +***Example*** + +Let's reconstruct [`sirv-cli`](https://github.com/lukeed/sirv), which is a single-command application that (optionally) accepts a directory from which to serve files. It also offers a slew of option flags: + +```js +sade('sirv [dir]', true) + .version('1.0.0') + .describe('Run a static file server') + .example('public -qeim 31536000') + .example('--port 8080 --etag') + .example('my-app --dev') + .option('-D, --dev', 'Enable "dev" mode') + .option('-e, --etag', 'Enable "Etag" header') + // There are a lot... + .option('-H, --host', 'Hostname to bind', 'localhost') + .option('-p, --port', 'Port to bind', 5000) + .action((dir, opts) => { + // Program handler + }) + .parse(process.argv); +``` + +When `sirv --help` is run, the generated help text is trimmed, fully aware that there's only one command in this program: + +``` + Description + Run a static file server + + Usage + $ sirv [dir] [options] + + Options + -D, --dev Enable "dev" mode + -e, --etag Enable "Etag" header + -H, --host Hostname to bind (default localhost) + -p, --port Port to bind (default 5000) + -v, --version Displays current version + -h, --help Displays this message + + Examples + $ sirv public -qeim 31536000 + $ sirv --port 8080 --etag + $ sirv my-app --dev +``` + +## Command Aliases + +Command aliases are alternative names (aliases) for a command. They are often used as shortcuts or as typo relief! + +The aliased names do not appear in the general help text.
    +Instead, they only appear within the Command-specific help text under an "Aliases" section. + +***Limitations*** + +* You cannot assign aliases while in [Single Command Mode](#single-command-mode) +* You cannot call [`prog.alias()`](#progaliasnames) before defining any Commands (via `prog.commmand()`) +* You, the developer, must keep track of which aliases have already been used and/or exist as Command names + +***Example*** + +Let's reconstruct the `npm install` command as a Sade program: + +```js +sade('npm') + // ... + .command('install [package]', 'Install a package', { + alias: ['i', 'add', 'isntall'] + }) + .option('-P, --save-prod', 'Package will appear in your dependencies.') + .option('-D, --save-dev', 'Package will appear in your devDependencies.') + .option('-O, --save-optional', 'Package will appear in your optionalDependencies') + .option('-E, --save-exact', 'Save exact versions instead of using a semver range operator') + // ... +``` + +When we run `npm --help` we'll see this general help text: + +``` + Usage + $ npm [options] + + Available Commands + install Install a package + + For more info, run any command with the `--help` flag + $ npm install --help + + Options + -v, --version Displays current version + -h, --help Displays this message +``` + +When we run `npm install --help` — ***or*** the help flag with any of `install`'s aliases — we'll see this command-specific help text: + +``` + Description + Install a package + + Usage + $ npm install [package] [options] + + Aliases + $ npm i + $ npm add + $ npm isntall + + Options + -P, --save-prod Package will appear in your dependencies. + -D, --save-dev Package will appear in your devDependencies. + -O, --save-optional Package will appear in your optionalDependencies + -E, --save-exact Save exact versions instead of using a semver range operator + -h, --help Displays this message +``` + + + +## API + +### sade(name, isSingle) +Returns: `Program` + +Returns your chainable Sade instance, aka your `Program`. + +#### name +Type: `String`
    +Required: `true` + +The name of your `Program` / binary application. + +#### isSingle +Type: `Boolean`
    +Default: `name.includes(' ');` + +If your `Program` is meant to have ***only one command***.
    +When `true`, this simplifies your generated `--help` output such that: + +* the "root-level help" is your _only_ help text +* the "root-level help" does not display an `Available Commands` section +* the "root-level help" does not inject `$ name ` into the `Usage` section +* the "root-level help" does not display `For more info, run any command with the `--help` flag` text + +You may customize the `Usage` of your command by modifying the `name` argument directly.
    +Please read [Single Command Mode](#single-command-mode) for an example and more information. + +> **Important:** Whenever `name` includes a custom usage, then `isSingle` is automatically assumed and enforced! + +### prog.command(usage, desc, opts) + +Create a new Command for your Program. This changes the current state of your Program. + +All configuration methods (`prog.describe`, `prog.action`, etc) will apply to this Command until another Command has been created! + +#### usage + +Type: `String` + +The usage pattern for your current Command. This will be included in the general or command-specific `--help` output. + +_Required_ arguments are wrapped with `<` and `>` characters; for example, `` and ``. + +_Optional_ arguments are wrapped with `[` and `]` characters; for example, `[foo]` and `[bar]`. + +All arguments are ***positionally important***, which means they are passed to your current Command's [`handler`](#handler) function in the order that they were defined. + +When optional arguments are defined but don't receive a value, their positionally-equivalent function parameter will be `undefined`. + +> **Important:** You **must** define & expect required arguments _before_ optional arguments! + +```js +sade('foo') + + .command('greet ') + .action((adjective, noun, opts) => { + console.log(`Hello, ${adjective} ${noun}!`); + }) + + .command('drive [color] [speed]') + .action((vehicle, color, speed, opts) => { + let arr = ['Driving my']; + arr.push(color ? `${color} ${vehicle}` : vehicle); + speed && arr.push(`at ${speed}`); + opts.yolo && arr.push('...YOLO!!'); + let str = arr.join(' '); + console.log(str); + }); +``` + +```sh +$ foo greet beautiful person +# //=> Hello, beautiful person! + +$ foo drive car +# //=> Driving my car + +$ foo drive car red +# //=> Driving my red card + +$ foo drive car blue 100mph --yolo +# //=> Driving my blue car at 100mph ...YOLO!! +``` + + +#### desc + +Type: `String`
    +Default: `''` + +The Command's description. The value is passed directly to [`prog.describe`](#progdescribetext). + +#### opts + +Type: `Object`
    +Default: `{}` + +##### opts.alias +Type: `String|Array` + +Optionally define one or more aliases for the current Command.
    +When declared, the `opts.alias` value is passed _directly_ to the [`prog.alias`](#progaliasnames) method. + +```js +// Program A is equivalent to Program B +// --- + +const A = sade('bin') + .command('build', 'My build command', { alias: 'b' }) + .command('watch', 'My watch command', { alias: ['w', 'dev'] }); + +const B = sade('bin') + .command('build', 'My build command').alias('b') + .command('watch', 'My watch command').alias('w', 'dev'); +``` + + +##### opts.default + +Type: `Boolean` + +Manually set/force the current Command to be the Program's default command. This ensures that the current Command will run if no command was specified. + +> **Important:** If you run your Program without a Command _and_ without specifying a default command, your Program will exit with a `No command specified` error. + +```js +const prog = sade('greet'); + +prog.command('hello'); +//=> only runs if :: `$ greet hello` + +// $ greet +//=> error: No command specified. + +prog.command('howdy', '', { default:true }); +//=> runs as `$ greet` OR `$ greet howdy` + +// $ greet +//=> runs 'howdy' handler + +// $ greet foobar +//=> error: Invalid command +``` + + +### prog.describe(text) + +Add a description to the current Command. + +#### text + +Type: `String|Array` + +The description text for the current Command. This will be included in the general or command-specific `--help` output. + +Internally, your description will be separated into an `Array` of sentences. + +For general `--help` output, ***only*** the first sentence will be displayed. However, **all sentences** will be printed for command-specific `--help` text. + +> **Note:** Pass an `Array` if you don't want internal assumptions. However, the first item is _always_ displayed in general help, so it's recommended to keep it short. + + +### prog.alias(...names) + +Define one or more aliases for the current Command. + +> **Important:** An error will be thrown if:
    1) the program is in [Single Command Mode](#single-command-mode); or
    2) `prog.alias` is called before any `prog.command`. + +#### names + +Type: `String` + +The list of alternative names (aliases) for the current Command.
    +For example, you may want to define shortcuts and/or common typos for the Command's full name. + +> **Important:** Sade _does not_ check if the incoming `names` are already in use by other Commands or their aliases.
    During conflicts, the Command with the same `name` is given priority, otherwise the first Command (according to Program order) with `name` as an alias is chosen. + +The `prog.alias()` is append-only, so calling it multiple times within a Command context will _keep_ all aliases, including those initially passed via [`opts.alias`](#optsdefault). + +```js +sade('bin') + .command('hello ', 'Greet someone by their name', { + alias: ['hey', 'yo'] + }) + .alias('hi', 'howdy') + .alias('hola', 'oi'); +//=> hello aliases: hey, yo, hi, howdy, hola, oi +``` + + +### prog.action(handler) + +Attach a callback to the current Command. + +#### handler + +Type: `Function` + +The function to run when the current Command is executed. + +Its parameters are based (positionally) on your Command's [`usage`](#usage-1) definition. + +All options, flags, and extra/unknown values are included as the last parameter. + +> **Note:** Optional arguments are also passed as parameters & may be `undefined`! + +```js +sade('foo') + .command('cp ') + .option('-f, --force', 'Overwrite without confirmation') + .option('-c, --clone-dir', 'Copy files to additional directory') + .option('-v, --verbose', 'Enable verbose output') + .action((src, dest, opts) => { + console.log(`Copying files from ${src} --> ${dest}`); + opts.c && console.log(`ALSO copying files from ${src} --> ${opts['clone-dir']}`); + console.log('My options:', opts); + }) + +// $ foo cp original my-copy -v +//=> Copying files from original --> my-copy +//=> My options: { _:[], v:true, verbose:true } + +// $ foo cp original my-copy --clone-dir my-backup +//=> Copying files from original --> my-copy +//=> ALSO copying files from original --> my-backup +//=> My options: { _:[], c:'my-backup', 'clone-dir':'my-backup' } +``` + + +### prog.example(str) + +Add an example for the current Command. + +#### str + +Type: `String` + +The example string to add. This will be included in the general or command-specific `--help` output. + +> **Note:** Your example's `str` will be prefixed with your Program's [`name`](#sadename). + + +### prog.option(flags, desc, value) + +Add an Option to the current Command. + +#### flags + +Type: `String` + +The Option's flags, which may optionally include an alias. + +You may use a comma (`,`) or a space (` `) to separate the flags. + +> **Note:** The short & long flags can be declared in any order. However, the alias will always be displayed first. + +> **Important:** If using hyphenated flag names, they will be accessible **as declared** within your [`action()`](#progactionhandler) handler! + +```js +prog.option('--global'); // no alias +prog.option('-g, --global'); // alias first, comma +prog.option('--global -g'); // alias last, space +// etc... +``` + +#### desc + +Type: `String` + +The description for the Option. + +#### value + +Type: `String` + +The **default** value for the Option. + +Flags and aliases, if parsed, are `true` by default. See [`mri`](https://github.com/lukeed/mri#minimist) for more info. + +> **Note:** You probably only want to define a default `value` if you're expecting a `String` or `Number` value type. + +If you _do_ pass a `String` or `Number` value type, your flag value will be casted to the same type. See [`mri#options.default`](https://github.com/lukeed/mri#optionsdefault) for info~! + + +### prog.version(str) + +The `--version` and `-v` flags will automatically output the Program version. + +#### str + +Type: `String`
    +Default: `0.0.0` + +The new version number for your Program. + +> **Note:** Your Program `version` is `0.0.0` until you change it. + +### prog.parse(arr, opts) + +Parse a set of CLI arguments. + +#### arr + +Type: `Array` + +Your Program's `process.argv` input. + +> **Important:** Do not `.slice(2)`! Doing so will break parsing~! + +#### opts + +Type: `Object`
    +Default: `{}` + +Additional `process.argv` parsing config. See [`mri`'s options](https://github.com/lukeed/mri#mriargs-options) for details. + +> **Important:** These values _override_ any internal values! + +```js +prog + .command('hello') + .option('-f, --force', 'My flag'); +//=> currently has alias pair: f <--> force + +prog.parse(process.argv, { + alias: { + f: ['foo', 'fizz'] + }, + default: { + abc: 123 + } +}); +//=> ADDS alias pair: f <--> foo +//=> REMOVES alias pair: f <--> force +//=> ADDS alias pair: f <--> fizz +//=> ADDS default: abc -> 123 (number) +``` + +#### opts.unknown + +Type: `Function`
    +Default: `undefined` + +Callback to run when an unspecified option flag has been found. This is [passed directly to `mri`](https://github.com/lukeed/mri#optionsunknown). + +Your handler will receive the unknown flag (string) as its only argument.
    +You may return a string, which will be used as a custom error message. Otherwise, a default message is displayed. + +```js +sade('sirv') + .command('start [dir]') + .parse(process.argv, { + unknown: arg => `Custom error message: ${arg}` + }); + +/* +$ sirv start --foobar + + ERROR + Custom error message: --foobar + + Run `$ sirv --help` for more info. +*/ +``` + +#### opts.lazy + +Type: `Boolean`
    +Default: `false` + +If true, Sade will not immediately execute the `action` handler. Instead, `parse()` will return an object of `{ name, args, handler }` shape, wherein the `name` is the command name, `args` is all arguments that _would be_ passed to the action handler, and `handler` is the function itself. + +From this, you may choose when to run the `handler` function. You also have the option to further modify the `args` for any reason, if needed. + +```js +let { name, args, handler } = prog.parse(process.argv, { lazy:true }); +console.log('> Received command: ', name); + +// later on... +handler.apply(null, args); +``` + +### prog.help(cmd) + +Manually display the help text for a given command. If no command name is provided, the general/global help is printed. + +Your general and command-specific help text is automatically attached to the `--help` and `-h` flags. + +> **Note:** You don't have to call this directly! It's automatically run when you `bin --help` + +#### cmd +Type: `String`
    +Default: `null` + +The name of the command for which to display help. Otherwise displays the general help. + + +## License + +MIT © [Luke Edwards](https://lukeed.com) diff --git a/node_modules/shebang-command/index.js b/node_modules/shebang-command/index.js new file mode 100644 index 00000000..f35db308 --- /dev/null +++ b/node_modules/shebang-command/index.js @@ -0,0 +1,19 @@ +'use strict'; +const shebangRegex = require('shebang-regex'); + +module.exports = (string = '') => { + const match = string.match(shebangRegex); + + if (!match) { + return null; + } + + const [path, argument] = match[0].replace(/#! ?/, '').split(' '); + const binary = path.split('/').pop(); + + if (binary === 'env') { + return argument; + } + + return argument ? `${binary} ${argument}` : binary; +}; diff --git a/node_modules/shebang-command/license b/node_modules/shebang-command/license new file mode 100644 index 00000000..db6bc32c --- /dev/null +++ b/node_modules/shebang-command/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Kevin Mårtensson (github.com/kevva) + +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/shebang-command/package.json b/node_modules/shebang-command/package.json new file mode 100644 index 00000000..18e3c046 --- /dev/null +++ b/node_modules/shebang-command/package.json @@ -0,0 +1,34 @@ +{ + "name": "shebang-command", + "version": "2.0.0", + "description": "Get the command from a shebang", + "license": "MIT", + "repository": "kevva/shebang-command", + "author": { + "name": "Kevin Mårtensson", + "email": "kevinmartensson@gmail.com", + "url": "github.com/kevva" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "cmd", + "command", + "parse", + "shebang" + ], + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "devDependencies": { + "ava": "^2.3.0", + "xo": "^0.24.0" + } +} diff --git a/node_modules/shebang-command/readme.md b/node_modules/shebang-command/readme.md new file mode 100644 index 00000000..84feb442 --- /dev/null +++ b/node_modules/shebang-command/readme.md @@ -0,0 +1,34 @@ +# shebang-command [![Build Status](https://travis-ci.org/kevva/shebang-command.svg?branch=master)](https://travis-ci.org/kevva/shebang-command) + +> Get the command from a shebang + + +## Install + +``` +$ npm install shebang-command +``` + + +## Usage + +```js +const shebangCommand = require('shebang-command'); + +shebangCommand('#!/usr/bin/env node'); +//=> 'node' + +shebangCommand('#!/bin/bash'); +//=> 'bash' +``` + + +## API + +### shebangCommand(string) + +#### string + +Type: `string` + +String containing a shebang. diff --git a/node_modules/shebang-regex/index.d.ts b/node_modules/shebang-regex/index.d.ts new file mode 100644 index 00000000..61d034b3 --- /dev/null +++ b/node_modules/shebang-regex/index.d.ts @@ -0,0 +1,22 @@ +/** +Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line. + +@example +``` +import shebangRegex = require('shebang-regex'); + +const string = '#!/usr/bin/env node\nconsole.log("unicorns");'; + +shebangRegex.test(string); +//=> true + +shebangRegex.exec(string)[0]; +//=> '#!/usr/bin/env node' + +shebangRegex.exec(string)[1]; +//=> '/usr/bin/env node' +``` +*/ +declare const shebangRegex: RegExp; + +export = shebangRegex; diff --git a/node_modules/shebang-regex/index.js b/node_modules/shebang-regex/index.js new file mode 100644 index 00000000..63fc4a0b --- /dev/null +++ b/node_modules/shebang-regex/index.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = /^#!(.*)/; diff --git a/node_modules/shebang-regex/license b/node_modules/shebang-regex/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/shebang-regex/license @@ -0,0 +1,9 @@ +MIT License + +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/shebang-regex/package.json b/node_modules/shebang-regex/package.json new file mode 100644 index 00000000..00ab30fe --- /dev/null +++ b/node_modules/shebang-regex/package.json @@ -0,0 +1,35 @@ +{ + "name": "shebang-regex", + "version": "3.0.0", + "description": "Regular expression for matching a shebang line", + "license": "MIT", + "repository": "sindresorhus/shebang-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "regex", + "regexp", + "shebang", + "match", + "test", + "line" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/shebang-regex/readme.md b/node_modules/shebang-regex/readme.md new file mode 100644 index 00000000..5ecf863a --- /dev/null +++ b/node_modules/shebang-regex/readme.md @@ -0,0 +1,33 @@ +# shebang-regex [![Build Status](https://travis-ci.org/sindresorhus/shebang-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/shebang-regex) + +> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line + + +## Install + +``` +$ npm install shebang-regex +``` + + +## Usage + +```js +const shebangRegex = require('shebang-regex'); + +const string = '#!/usr/bin/env node\nconsole.log("unicorns");'; + +shebangRegex.test(string); +//=> true + +shebangRegex.exec(string)[0]; +//=> '#!/usr/bin/env node' + +shebangRegex.exec(string)[1]; +//=> '/usr/bin/env node' +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/signal-exit/LICENSE.txt b/node_modules/signal-exit/LICENSE.txt new file mode 100644 index 00000000..954f2fa8 --- /dev/null +++ b/node_modules/signal-exit/LICENSE.txt @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) 2015-2023 Benjamin Coe, 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/signal-exit/README.md b/node_modules/signal-exit/README.md new file mode 100644 index 00000000..c55cd45e --- /dev/null +++ b/node_modules/signal-exit/README.md @@ -0,0 +1,74 @@ +# signal-exit + +When you want to fire an event no matter how a process exits: + +- reaching the end of execution. +- explicitly having `process.exit(code)` called. +- having `process.kill(pid, sig)` called. +- receiving a fatal signal from outside the process + +Use `signal-exit`. + +```js +// Hybrid module, either works +import { onExit } from 'signal-exit' +// or: +// const { onExit } = require('signal-exit') + +onExit((code, signal) => { + console.log('process exited!', code, signal) +}) +``` + +## API + +`remove = onExit((code, signal) => {}, options)` + +The return value of the function is a function that will remove +the handler. + +Note that the function _only_ fires for signals if the signal +would cause the process to exit. That is, there are no other +listeners, and it is a fatal signal. + +If the global `process` object is not suitable for this purpose +(ie, it's unset, or doesn't have an `emit` method, etc.) then the +`onExit` function is a no-op that returns a no-op `remove` method. + +### Options + +- `alwaysLast`: Run this handler after any other signal or exit + handlers. This causes `process.emit` to be monkeypatched. + +### Capturing Signal Exits + +If the handler returns an exact boolean `true`, and the exit is a +due to signal, then the signal will be considered handled, and +will _not_ trigger a synthetic `process.kill(process.pid, +signal)` after firing the `onExit` handlers. + +In this case, it your responsibility as the caller to exit with a +signal (for example, by calling `process.kill()`) if you wish to +preserve the same exit status that would otherwise have occurred. +If you do not, then the process will likely exit gracefully with +status 0 at some point, assuming that no other terminating signal +or other exit trigger occurs. + +Prior to calling handlers, the `onExit` machinery is unloaded, so +any subsequent exits or signals will not be handled, even if the +signal is captured and the exit is thus prevented. + +Note that numeric code exits may indicate that the process is +already committed to exiting, for example due to a fatal +exception or unhandled promise rejection, and so there is no way to +prevent it safely. + +### Browser Fallback + +The `'signal-exit/browser'` module is the same fallback shim that +just doesn't do anything, but presents the same function +interface. + +Patches welcome to add something that hooks onto +`window.onbeforeunload` or similar, but it might just not be a +thing that makes sense there. diff --git a/node_modules/signal-exit/dist/cjs/browser.d.ts b/node_modules/signal-exit/dist/cjs/browser.d.ts new file mode 100644 index 00000000..90f2e3f1 --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/browser.d.ts @@ -0,0 +1,12 @@ +/** + * This is a browser shim that provides the same functional interface + * as the main node export, but it does nothing. + * @module + */ +import type { Handler } from './index.js'; +export declare const onExit: (cb: Handler, opts: { + alwaysLast?: boolean; +}) => () => void; +export declare const load: () => void; +export declare const unload: () => void; +//# sourceMappingURL=browser.d.ts.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/browser.d.ts.map b/node_modules/signal-exit/dist/cjs/browser.d.ts.map new file mode 100644 index 00000000..aacc1d3b --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,eAAO,MAAM,MAAM,EAAE,CACnB,EAAE,EAAE,OAAO,EACX,IAAI,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,KAC3B,MAAM,IAAqB,CAAA;AAChC,eAAO,MAAM,IAAI,YAAW,CAAA;AAC5B,eAAO,MAAM,MAAM,YAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/browser.js b/node_modules/signal-exit/dist/cjs/browser.js new file mode 100644 index 00000000..614fbf01 --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/browser.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.unload = exports.load = exports.onExit = void 0; +const onExit = () => () => { }; +exports.onExit = onExit; +const load = () => { }; +exports.load = load; +const unload = () => { }; +exports.unload = unload; +//# sourceMappingURL=browser.js.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/browser.js.map b/node_modules/signal-exit/dist/cjs/browser.js.map new file mode 100644 index 00000000..342cf2e2 --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":";;;AAMO,MAAM,MAAM,GAGD,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAAA;AAHnB,QAAA,MAAM,UAGa;AACzB,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AAAf,QAAA,IAAI,QAAW;AACrB,MAAM,MAAM,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AAAjB,QAAA,MAAM,UAAW","sourcesContent":["/**\n * This is a browser shim that provides the same functional interface\n * as the main node export, but it does nothing.\n * @module\n */\nimport type { Handler } from './index.js'\nexport const onExit: (\n cb: Handler,\n opts: { alwaysLast?: boolean }\n) => () => void = () => () => {}\nexport const load = () => {}\nexport const unload = () => {}\n"]} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/index.d.ts b/node_modules/signal-exit/dist/cjs/index.d.ts new file mode 100644 index 00000000..cabe9cfc --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/index.d.ts @@ -0,0 +1,48 @@ +/// +import { signals } from './signals.js'; +export { signals }; +/** + * A function that takes an exit code and signal as arguments + * + * In the case of signal exits *only*, a return value of true + * will indicate that the signal is being handled, and we should + * not synthetically exit with the signal we received. Regardless + * of the handler return value, the handler is unloaded when an + * otherwise fatal signal is received, so you get exactly 1 shot + * at it, unless you add another onExit handler at that point. + * + * In the case of numeric code exits, we may already have committed + * to exiting the process, for example via a fatal exception or + * unhandled promise rejection, so it is impossible to stop safely. + */ +export type Handler = (code: number | null | undefined, signal: NodeJS.Signals | null) => true | void; +export declare const +/** + * Called when the process is exiting, whether via signal, explicit + * exit, or running out of stuff to do. + * + * If the global process object is not suitable for instrumentation, + * then this will be a no-op. + * + * Returns a function that may be used to unload signal-exit. + */ +onExit: (cb: Handler, opts?: { + alwaysLast?: boolean | undefined; +} | undefined) => () => void, +/** + * Load the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +load: () => void, +/** + * Unload the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +unload: () => void; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/index.d.ts.map b/node_modules/signal-exit/dist/cjs/index.d.ts.map new file mode 100644 index 00000000..f84594e2 --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,CAAA;AAuBlB;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,KAC1B,IAAI,GAAG,IAAI,CAAA;AA8QhB,eAAO;AACL;;;;;;;;GAQG;AACH,MAAM,OAzMO,OAAO;;wBAPiD,IAAI;AAkNzE;;;;;;GAMG;AACH,IAAI;AAEJ;;;;;;GAMG;AACH,MAAM,YAGP,CAAA"} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/index.js b/node_modules/signal-exit/dist/cjs/index.js new file mode 100644 index 00000000..797e6743 --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/index.js @@ -0,0 +1,279 @@ +"use strict"; +var _a; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.unload = exports.load = exports.onExit = exports.signals = void 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 +const signals_js_1 = require("./signals.js"); +Object.defineProperty(exports, "signals", { enumerable: true, get: function () { return signals_js_1.signals; } }); +const processOk = (process) => !!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'; +const kExitEmitter = Symbol.for('signal-exit emitter'); +const global = globalThis; +const ObjectDefineProperty = Object.defineProperty.bind(Object); +// teeny special purpose ee +class Emitter { + emitted = { + afterExit: false, + exit: false, + }; + listeners = { + afterExit: [], + exit: [], + }; + count = 0; + id = Math.random(); + constructor() { + if (global[kExitEmitter]) { + return global[kExitEmitter]; + } + ObjectDefineProperty(global, kExitEmitter, { + value: this, + writable: false, + enumerable: false, + configurable: false, + }); + } + on(ev, fn) { + this.listeners[ev].push(fn); + } + removeListener(ev, fn) { + const list = this.listeners[ev]; + const i = list.indexOf(fn); + /* c8 ignore start */ + if (i === -1) { + return; + } + /* c8 ignore stop */ + if (i === 0 && list.length === 1) { + list.length = 0; + } + else { + list.splice(i, 1); + } + } + emit(ev, code, signal) { + if (this.emitted[ev]) { + return false; + } + this.emitted[ev] = true; + let ret = false; + for (const fn of this.listeners[ev]) { + ret = fn(code, signal) === true || ret; + } + if (ev === 'exit') { + ret = this.emit('afterExit', code, signal) || ret; + } + return ret; + } +} +class SignalExitBase { +} +const signalExitWrap = (handler) => { + return { + onExit(cb, opts) { + return handler.onExit(cb, opts); + }, + load() { + return handler.load(); + }, + unload() { + return handler.unload(); + }, + }; +}; +class SignalExitFallback extends SignalExitBase { + onExit() { + return () => { }; + } + load() { } + unload() { } +} +class SignalExit extends SignalExitBase { + // "SIGHUP" throws an `ENOSYS` error on Windows, + // so use a supported signal instead + /* c8 ignore start */ + #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP'; + /* c8 ignore stop */ + #emitter = new Emitter(); + #process; + #originalProcessEmit; + #originalProcessReallyExit; + #sigListeners = {}; + #loaded = false; + constructor(process) { + super(); + this.#process = process; + // { : , ... } + this.#sigListeners = {}; + for (const sig of signals_js_1.signals) { + this.#sigListeners[sig] = () => { + // 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. + const listeners = this.#process.listeners(sig); + let { count } = this.#emitter; + // This is a workaround for the fact that signal-exit v3 and signal + // exit v4 are not aware of each other, and each will attempt to let + // the other handle it, so neither of them do. To correct this, we + // detect if we're the only handler *except* for previous versions + // of signal-exit, and increment by the count of listeners it has + // created. + /* c8 ignore start */ + const p = process; + if (typeof p.__signal_exit_emitter__ === 'object' && + typeof p.__signal_exit_emitter__.count === 'number') { + count += p.__signal_exit_emitter__.count; + } + /* c8 ignore stop */ + if (listeners.length === count) { + this.unload(); + const ret = this.#emitter.emit('exit', null, sig); + /* c8 ignore start */ + const s = sig === 'SIGHUP' ? this.#hupSig : sig; + if (!ret) + process.kill(process.pid, s); + /* c8 ignore stop */ + } + }; + } + this.#originalProcessReallyExit = process.reallyExit; + this.#originalProcessEmit = process.emit; + } + onExit(cb, opts) { + /* c8 ignore start */ + if (!processOk(this.#process)) { + return () => { }; + } + /* c8 ignore stop */ + if (this.#loaded === false) { + this.load(); + } + const ev = opts?.alwaysLast ? 'afterExit' : 'exit'; + this.#emitter.on(ev, cb); + return () => { + this.#emitter.removeListener(ev, cb); + if (this.#emitter.listeners['exit'].length === 0 && + this.#emitter.listeners['afterExit'].length === 0) { + this.unload(); + } + }; + } + load() { + if (this.#loaded) { + return; + } + this.#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. + this.#emitter.count += 1; + for (const sig of signals_js_1.signals) { + try { + const fn = this.#sigListeners[sig]; + if (fn) + this.#process.on(sig, fn); + } + catch (_) { } + } + this.#process.emit = (ev, ...a) => { + return this.#processEmit(ev, ...a); + }; + this.#process.reallyExit = (code) => { + return this.#processReallyExit(code); + }; + } + unload() { + if (!this.#loaded) { + return; + } + this.#loaded = false; + signals_js_1.signals.forEach(sig => { + const listener = this.#sigListeners[sig]; + /* c8 ignore start */ + if (!listener) { + throw new Error('Listener not defined for signal: ' + sig); + } + /* c8 ignore stop */ + try { + this.#process.removeListener(sig, listener); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + }); + this.#process.emit = this.#originalProcessEmit; + this.#process.reallyExit = this.#originalProcessReallyExit; + this.#emitter.count -= 1; + } + #processReallyExit(code) { + /* c8 ignore start */ + if (!processOk(this.#process)) { + return 0; + } + this.#process.exitCode = code || 0; + /* c8 ignore stop */ + this.#emitter.emit('exit', this.#process.exitCode, null); + return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode); + } + #processEmit(ev, ...args) { + const og = this.#originalProcessEmit; + if (ev === 'exit' && processOk(this.#process)) { + if (typeof args[0] === 'number') { + this.#process.exitCode = args[0]; + /* c8 ignore start */ + } + /* c8 ignore start */ + const ret = og.call(this.#process, ev, ...args); + /* c8 ignore start */ + this.#emitter.emit('exit', this.#process.exitCode, null); + /* c8 ignore stop */ + return ret; + } + else { + return og.call(this.#process, ev, ...args); + } + } +} +const process = globalThis.process; +// wrap so that we call the method on the actual handler, without +// exporting it directly. +_a = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback()), +/** + * Called when the process is exiting, whether via signal, explicit + * exit, or running out of stuff to do. + * + * If the global process object is not suitable for instrumentation, + * then this will be a no-op. + * + * Returns a function that may be used to unload signal-exit. + */ +exports.onExit = _a.onExit, +/** + * Load the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +exports.load = _a.load, +/** + * Unload the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +exports.unload = _a.unload; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/index.js.map b/node_modules/signal-exit/dist/cjs/index.js.map new file mode 100644 index 00000000..528e3cc9 --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,iEAAiE;AACjE,+DAA+D;AAC/D,qDAAqD;AACrD,4DAA4D;AAC5D,6CAAsC;AAC7B,wFADA,oBAAO,OACA;AAQhB,MAAM,SAAS,GAAG,CAAC,OAAY,EAAwB,EAAE,CACvD,CAAC,CAAC,OAAO;IACT,OAAO,OAAO,KAAK,QAAQ;IAC3B,OAAO,OAAO,CAAC,cAAc,KAAK,UAAU;IAC5C,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU;IAClC,OAAO,OAAO,CAAC,UAAU,KAAK,UAAU;IACxC,OAAO,OAAO,CAAC,SAAS,KAAK,UAAU;IACvC,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU;IAClC,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ;IAC/B,OAAO,OAAO,CAAC,EAAE,KAAK,UAAU,CAAA;AAElC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;AACtD,MAAM,MAAM,GAAqD,UAAU,CAAA;AAC3E,MAAM,oBAAoB,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAwB/D,2BAA2B;AAC3B,MAAM,OAAO;IACX,OAAO,GAAY;QACjB,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,KAAK;KACZ,CAAA;IAED,SA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A;AAClC,iEAAiE;AACjE,yBAAyB;AACZ,KA6BT,cAAc,CAChB,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,kBAAkB,EAAE,CACxE;AA9BC;;;;;;;;GAQG;AACH,cAAM;AAEN;;;;;;GAMG;AACH,YAAI;AAEJ;;;;;;GAMG;AACH,cAAM,aAGP","sourcesContent":["// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nimport { signals } from './signals.js'\nexport { signals }\n\n// just a loosened process type so we can do some evil things\ntype ProcessRE = NodeJS.Process & {\n reallyExit: (code?: number | undefined | null) => any\n emit: (ev: string, ...a: any[]) => any\n}\n\nconst processOk = (process: any): process is ProcessRE =>\n !!process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function'\n\nconst kExitEmitter = Symbol.for('signal-exit emitter')\nconst global: typeof globalThis & { [kExitEmitter]?: Emitter } = globalThis\nconst ObjectDefineProperty = Object.defineProperty.bind(Object)\n\n/**\n * A function that takes an exit code and signal as arguments\n *\n * In the case of signal exits *only*, a return value of true\n * will indicate that the signal is being handled, and we should\n * not synthetically exit with the signal we received. Regardless\n * of the handler return value, the handler is unloaded when an\n * otherwise fatal signal is received, so you get exactly 1 shot\n * at it, unless you add another onExit handler at that point.\n *\n * In the case of numeric code exits, we may already have committed\n * to exiting the process, for example via a fatal exception or\n * unhandled promise rejection, so it is impossible to stop safely.\n */\nexport type Handler = (\n code: number | null | undefined,\n signal: NodeJS.Signals | null\n) => true | void\ntype ExitEvent = 'afterExit' | 'exit'\ntype Emitted = { [k in ExitEvent]: boolean }\ntype Listeners = { [k in ExitEvent]: Handler[] }\n\n// teeny special purpose ee\nclass Emitter {\n emitted: Emitted = {\n afterExit: false,\n exit: false,\n }\n\n listeners: Listeners = {\n afterExit: [],\n exit: [],\n }\n\n count: number = 0\n id: number = Math.random()\n\n constructor() {\n if (global[kExitEmitter]) {\n return global[kExitEmitter]\n }\n ObjectDefineProperty(global, kExitEmitter, {\n value: this,\n writable: false,\n enumerable: false,\n configurable: false,\n })\n }\n\n on(ev: ExitEvent, fn: Handler) {\n this.listeners[ev].push(fn)\n }\n\n removeListener(ev: ExitEvent, fn: Handler) {\n const list = this.listeners[ev]\n const i = list.indexOf(fn)\n /* c8 ignore start */\n if (i === -1) {\n return\n }\n /* c8 ignore stop */\n if (i === 0 && list.length === 1) {\n list.length = 0\n } else {\n list.splice(i, 1)\n }\n }\n\n emit(\n ev: ExitEvent,\n code: number | null | undefined,\n signal: NodeJS.Signals | null\n ): boolean {\n if (this.emitted[ev]) {\n return false\n }\n this.emitted[ev] = true\n let ret: boolean = false\n for (const fn of this.listeners[ev]) {\n ret = fn(code, signal) === true || ret\n }\n if (ev === 'exit') {\n ret = this.emit('afterExit', code, signal) || ret\n }\n return ret\n }\n}\n\nabstract class SignalExitBase {\n abstract onExit(cb: Handler, opts?: { alwaysLast?: boolean }): () => void\n abstract load(): void\n abstract unload(): void\n}\n\nconst signalExitWrap = (handler: T) => {\n return {\n onExit(cb: Handler, opts?: { alwaysLast?: boolean }) {\n return handler.onExit(cb, opts)\n },\n load() {\n return handler.load()\n },\n unload() {\n return handler.unload()\n },\n }\n}\n\nclass SignalExitFallback extends SignalExitBase {\n onExit() {\n return () => {}\n }\n load() {}\n unload() {}\n}\n\nclass SignalExit extends SignalExitBase {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n /* c8 ignore start */\n #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP'\n /* c8 ignore stop */\n #emitter = new Emitter()\n #process: ProcessRE\n #originalProcessEmit: ProcessRE['emit']\n #originalProcessReallyExit: ProcessRE['reallyExit']\n\n #sigListeners: { [k in NodeJS.Signals]?: () => void } = {}\n #loaded: boolean = false\n\n constructor(process: ProcessRE) {\n super()\n this.#process = process\n // { : , ... }\n this.#sigListeners = {}\n for (const sig of signals) {\n this.#sigListeners[sig] = () => {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = this.#process.listeners(sig)\n let { count } = this.#emitter\n // This is a workaround for the fact that signal-exit v3 and signal\n // exit v4 are not aware of each other, and each will attempt to let\n // the other handle it, so neither of them do. To correct this, we\n // detect if we're the only handler *except* for previous versions\n // of signal-exit, and increment by the count of listeners it has\n // created.\n /* c8 ignore start */\n const p = process as unknown as {\n __signal_exit_emitter__?: { count: number }\n }\n if (\n typeof p.__signal_exit_emitter__ === 'object' &&\n typeof p.__signal_exit_emitter__.count === 'number'\n ) {\n count += p.__signal_exit_emitter__.count\n }\n /* c8 ignore stop */\n if (listeners.length === count) {\n this.unload()\n const ret = this.#emitter.emit('exit', null, sig)\n /* c8 ignore start */\n const s = sig === 'SIGHUP' ? this.#hupSig : sig\n if (!ret) process.kill(process.pid, s)\n /* c8 ignore stop */\n }\n }\n }\n\n this.#originalProcessReallyExit = process.reallyExit\n this.#originalProcessEmit = process.emit\n }\n\n onExit(cb: Handler, opts?: { alwaysLast?: boolean }) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return () => {}\n }\n /* c8 ignore stop */\n\n if (this.#loaded === false) {\n this.load()\n }\n\n const ev = opts?.alwaysLast ? 'afterExit' : 'exit'\n this.#emitter.on(ev, cb)\n return () => {\n this.#emitter.removeListener(ev, cb)\n if (\n this.#emitter.listeners['exit'].length === 0 &&\n this.#emitter.listeners['afterExit'].length === 0\n ) {\n this.unload()\n }\n }\n }\n\n load() {\n if (this.#loaded) {\n return\n }\n this.#loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n this.#emitter.count += 1\n\n for (const sig of signals) {\n try {\n const fn = this.#sigListeners[sig]\n if (fn) this.#process.on(sig, fn)\n } catch (_) {}\n }\n\n this.#process.emit = (ev: string, ...a: any[]) => {\n return this.#processEmit(ev, ...a)\n }\n this.#process.reallyExit = (code?: number | null | undefined) => {\n return this.#processReallyExit(code)\n }\n }\n\n unload() {\n if (!this.#loaded) {\n return\n }\n this.#loaded = false\n\n signals.forEach(sig => {\n const listener = this.#sigListeners[sig]\n /* c8 ignore start */\n if (!listener) {\n throw new Error('Listener not defined for signal: ' + sig)\n }\n /* c8 ignore stop */\n try {\n this.#process.removeListener(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n })\n this.#process.emit = this.#originalProcessEmit\n this.#process.reallyExit = this.#originalProcessReallyExit\n this.#emitter.count -= 1\n }\n\n #processReallyExit(code?: number | null | undefined) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return 0\n }\n this.#process.exitCode = code || 0\n /* c8 ignore stop */\n\n this.#emitter.emit('exit', this.#process.exitCode, null)\n return this.#originalProcessReallyExit.call(\n this.#process,\n this.#process.exitCode\n )\n }\n\n #processEmit(ev: string, ...args: any[]): any {\n const og = this.#originalProcessEmit\n if (ev === 'exit' && processOk(this.#process)) {\n if (typeof args[0] === 'number') {\n this.#process.exitCode = args[0]\n /* c8 ignore start */\n }\n /* c8 ignore start */\n const ret = og.call(this.#process, ev, ...args)\n /* c8 ignore start */\n this.#emitter.emit('exit', this.#process.exitCode, null)\n /* c8 ignore stop */\n return ret\n } else {\n return og.call(this.#process, ev, ...args)\n }\n }\n}\n\nconst process = globalThis.process\n// wrap so that we call the method on the actual handler, without\n// exporting it directly.\nexport const {\n /**\n * Called when the process is exiting, whether via signal, explicit\n * exit, or running out of stuff to do.\n *\n * If the global process object is not suitable for instrumentation,\n * then this will be a no-op.\n *\n * Returns a function that may be used to unload signal-exit.\n */\n onExit,\n\n /**\n * Load the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\n load,\n\n /**\n * Unload the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\n unload,\n} = signalExitWrap(\n processOk(process) ? new SignalExit(process) : new SignalExitFallback()\n)\n"]} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/package.json b/node_modules/signal-exit/dist/cjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/signal-exit/dist/cjs/signals.d.ts b/node_modules/signal-exit/dist/cjs/signals.d.ts new file mode 100644 index 00000000..3f01ef00 --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/signals.d.ts @@ -0,0 +1,29 @@ +/// +/** + * 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. + * + * Windows signals are a different set, since there are + * signals that terminate Windows processes, but don't + * terminate (or don't even exist) on Posix systems. + * + * 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. + */ +export declare const signals: NodeJS.Signals[]; +//# sourceMappingURL=signals.d.ts.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/signals.d.ts.map b/node_modules/signal-exit/dist/cjs/signals.d.ts.map new file mode 100644 index 00000000..891fe1e6 --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/signals.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/signals.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,OAAO,EAAO,CAAA"} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/signals.js b/node_modules/signal-exit/dist/cjs/signals.js new file mode 100644 index 00000000..28afc502 --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/signals.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.signals = void 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. + * + * Windows signals are a different set, since there are + * signals that terminate Windows processes, but don't + * terminate (or don't even exist) on Posix systems. + * + * 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. + */ +exports.signals = []; +exports.signals.push('SIGHUP', 'SIGINT', 'SIGTERM'); +if (process.platform !== 'win32') { + exports.signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT' + // should detect profiler and enable/disable accordingly. + // see #21 + // 'SIGPROF' + ); +} +if (process.platform === 'linux') { + exports.signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT'); +} +//# sourceMappingURL=signals.js.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/cjs/signals.js.map b/node_modules/signal-exit/dist/cjs/signals.js.map new file mode 100644 index 00000000..78c613f6 --- /dev/null +++ b/node_modules/signal-exit/dist/cjs/signals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../src/signals.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACU,QAAA,OAAO,GAAqB,EAAE,CAAA;AAC3C,eAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;AAE3C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,eAAO,CAAC,IAAI,CACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ;IACR,yDAAyD;IACzD,UAAU;IACV,YAAY;KACb,CAAA;CACF;AAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,eAAO,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;CACxD","sourcesContent":["/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems. Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL. It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals: NodeJS.Signals[] = []\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM')\n\nif (process.platform !== 'win32') {\n signals.push(\n 'SIGALRM',\n 'SIGABRT',\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n}\n\nif (process.platform === 'linux') {\n signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT')\n}\n"]} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/browser.d.ts b/node_modules/signal-exit/dist/mjs/browser.d.ts new file mode 100644 index 00000000..90f2e3f1 --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/browser.d.ts @@ -0,0 +1,12 @@ +/** + * This is a browser shim that provides the same functional interface + * as the main node export, but it does nothing. + * @module + */ +import type { Handler } from './index.js'; +export declare const onExit: (cb: Handler, opts: { + alwaysLast?: boolean; +}) => () => void; +export declare const load: () => void; +export declare const unload: () => void; +//# sourceMappingURL=browser.d.ts.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/browser.d.ts.map b/node_modules/signal-exit/dist/mjs/browser.d.ts.map new file mode 100644 index 00000000..aacc1d3b --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,eAAO,MAAM,MAAM,EAAE,CACnB,EAAE,EAAE,OAAO,EACX,IAAI,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,KAC3B,MAAM,IAAqB,CAAA;AAChC,eAAO,MAAM,IAAI,YAAW,CAAA;AAC5B,eAAO,MAAM,MAAM,YAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/browser.js b/node_modules/signal-exit/dist/mjs/browser.js new file mode 100644 index 00000000..9c5f9b9e --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/browser.js @@ -0,0 +1,4 @@ +export const onExit = () => () => { }; +export const load = () => { }; +export const unload = () => { }; +//# sourceMappingURL=browser.js.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/browser.js.map b/node_modules/signal-exit/dist/mjs/browser.js.map new file mode 100644 index 00000000..b3ff303a --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,MAAM,GAGD,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAAA;AAChC,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AAC5B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA","sourcesContent":["/**\n * This is a browser shim that provides the same functional interface\n * as the main node export, but it does nothing.\n * @module\n */\nimport type { Handler } from './index.js'\nexport const onExit: (\n cb: Handler,\n opts: { alwaysLast?: boolean }\n) => () => void = () => () => {}\nexport const load = () => {}\nexport const unload = () => {}\n"]} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/index.d.ts b/node_modules/signal-exit/dist/mjs/index.d.ts new file mode 100644 index 00000000..cabe9cfc --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/index.d.ts @@ -0,0 +1,48 @@ +/// +import { signals } from './signals.js'; +export { signals }; +/** + * A function that takes an exit code and signal as arguments + * + * In the case of signal exits *only*, a return value of true + * will indicate that the signal is being handled, and we should + * not synthetically exit with the signal we received. Regardless + * of the handler return value, the handler is unloaded when an + * otherwise fatal signal is received, so you get exactly 1 shot + * at it, unless you add another onExit handler at that point. + * + * In the case of numeric code exits, we may already have committed + * to exiting the process, for example via a fatal exception or + * unhandled promise rejection, so it is impossible to stop safely. + */ +export type Handler = (code: number | null | undefined, signal: NodeJS.Signals | null) => true | void; +export declare const +/** + * Called when the process is exiting, whether via signal, explicit + * exit, or running out of stuff to do. + * + * If the global process object is not suitable for instrumentation, + * then this will be a no-op. + * + * Returns a function that may be used to unload signal-exit. + */ +onExit: (cb: Handler, opts?: { + alwaysLast?: boolean | undefined; +} | undefined) => () => void, +/** + * Load the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +load: () => void, +/** + * Unload the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +unload: () => void; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/index.d.ts.map b/node_modules/signal-exit/dist/mjs/index.d.ts.map new file mode 100644 index 00000000..f84594e2 --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,CAAA;AAuBlB;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,KAC1B,IAAI,GAAG,IAAI,CAAA;AA8QhB,eAAO;AACL;;;;;;;;GAQG;AACH,MAAM,OAzMO,OAAO;;wBAPiD,IAAI;AAkNzE;;;;;;GAMG;AACH,IAAI;AAEJ;;;;;;GAMG;AACH,MAAM,YAGP,CAAA"} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/index.js b/node_modules/signal-exit/dist/mjs/index.js new file mode 100644 index 00000000..4a78bad8 --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/index.js @@ -0,0 +1,275 @@ +// 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 +import { signals } from './signals.js'; +export { signals }; +const processOk = (process) => !!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'; +const kExitEmitter = Symbol.for('signal-exit emitter'); +const global = globalThis; +const ObjectDefineProperty = Object.defineProperty.bind(Object); +// teeny special purpose ee +class Emitter { + emitted = { + afterExit: false, + exit: false, + }; + listeners = { + afterExit: [], + exit: [], + }; + count = 0; + id = Math.random(); + constructor() { + if (global[kExitEmitter]) { + return global[kExitEmitter]; + } + ObjectDefineProperty(global, kExitEmitter, { + value: this, + writable: false, + enumerable: false, + configurable: false, + }); + } + on(ev, fn) { + this.listeners[ev].push(fn); + } + removeListener(ev, fn) { + const list = this.listeners[ev]; + const i = list.indexOf(fn); + /* c8 ignore start */ + if (i === -1) { + return; + } + /* c8 ignore stop */ + if (i === 0 && list.length === 1) { + list.length = 0; + } + else { + list.splice(i, 1); + } + } + emit(ev, code, signal) { + if (this.emitted[ev]) { + return false; + } + this.emitted[ev] = true; + let ret = false; + for (const fn of this.listeners[ev]) { + ret = fn(code, signal) === true || ret; + } + if (ev === 'exit') { + ret = this.emit('afterExit', code, signal) || ret; + } + return ret; + } +} +class SignalExitBase { +} +const signalExitWrap = (handler) => { + return { + onExit(cb, opts) { + return handler.onExit(cb, opts); + }, + load() { + return handler.load(); + }, + unload() { + return handler.unload(); + }, + }; +}; +class SignalExitFallback extends SignalExitBase { + onExit() { + return () => { }; + } + load() { } + unload() { } +} +class SignalExit extends SignalExitBase { + // "SIGHUP" throws an `ENOSYS` error on Windows, + // so use a supported signal instead + /* c8 ignore start */ + #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP'; + /* c8 ignore stop */ + #emitter = new Emitter(); + #process; + #originalProcessEmit; + #originalProcessReallyExit; + #sigListeners = {}; + #loaded = false; + constructor(process) { + super(); + this.#process = process; + // { : , ... } + this.#sigListeners = {}; + for (const sig of signals) { + this.#sigListeners[sig] = () => { + // 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. + const listeners = this.#process.listeners(sig); + let { count } = this.#emitter; + // This is a workaround for the fact that signal-exit v3 and signal + // exit v4 are not aware of each other, and each will attempt to let + // the other handle it, so neither of them do. To correct this, we + // detect if we're the only handler *except* for previous versions + // of signal-exit, and increment by the count of listeners it has + // created. + /* c8 ignore start */ + const p = process; + if (typeof p.__signal_exit_emitter__ === 'object' && + typeof p.__signal_exit_emitter__.count === 'number') { + count += p.__signal_exit_emitter__.count; + } + /* c8 ignore stop */ + if (listeners.length === count) { + this.unload(); + const ret = this.#emitter.emit('exit', null, sig); + /* c8 ignore start */ + const s = sig === 'SIGHUP' ? this.#hupSig : sig; + if (!ret) + process.kill(process.pid, s); + /* c8 ignore stop */ + } + }; + } + this.#originalProcessReallyExit = process.reallyExit; + this.#originalProcessEmit = process.emit; + } + onExit(cb, opts) { + /* c8 ignore start */ + if (!processOk(this.#process)) { + return () => { }; + } + /* c8 ignore stop */ + if (this.#loaded === false) { + this.load(); + } + const ev = opts?.alwaysLast ? 'afterExit' : 'exit'; + this.#emitter.on(ev, cb); + return () => { + this.#emitter.removeListener(ev, cb); + if (this.#emitter.listeners['exit'].length === 0 && + this.#emitter.listeners['afterExit'].length === 0) { + this.unload(); + } + }; + } + load() { + if (this.#loaded) { + return; + } + this.#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. + this.#emitter.count += 1; + for (const sig of signals) { + try { + const fn = this.#sigListeners[sig]; + if (fn) + this.#process.on(sig, fn); + } + catch (_) { } + } + this.#process.emit = (ev, ...a) => { + return this.#processEmit(ev, ...a); + }; + this.#process.reallyExit = (code) => { + return this.#processReallyExit(code); + }; + } + unload() { + if (!this.#loaded) { + return; + } + this.#loaded = false; + signals.forEach(sig => { + const listener = this.#sigListeners[sig]; + /* c8 ignore start */ + if (!listener) { + throw new Error('Listener not defined for signal: ' + sig); + } + /* c8 ignore stop */ + try { + this.#process.removeListener(sig, listener); + /* c8 ignore start */ + } + catch (_) { } + /* c8 ignore stop */ + }); + this.#process.emit = this.#originalProcessEmit; + this.#process.reallyExit = this.#originalProcessReallyExit; + this.#emitter.count -= 1; + } + #processReallyExit(code) { + /* c8 ignore start */ + if (!processOk(this.#process)) { + return 0; + } + this.#process.exitCode = code || 0; + /* c8 ignore stop */ + this.#emitter.emit('exit', this.#process.exitCode, null); + return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode); + } + #processEmit(ev, ...args) { + const og = this.#originalProcessEmit; + if (ev === 'exit' && processOk(this.#process)) { + if (typeof args[0] === 'number') { + this.#process.exitCode = args[0]; + /* c8 ignore start */ + } + /* c8 ignore start */ + const ret = og.call(this.#process, ev, ...args); + /* c8 ignore start */ + this.#emitter.emit('exit', this.#process.exitCode, null); + /* c8 ignore stop */ + return ret; + } + else { + return og.call(this.#process, ev, ...args); + } + } +} +const process = globalThis.process; +// wrap so that we call the method on the actual handler, without +// exporting it directly. +export const { +/** + * Called when the process is exiting, whether via signal, explicit + * exit, or running out of stuff to do. + * + * If the global process object is not suitable for instrumentation, + * then this will be a no-op. + * + * Returns a function that may be used to unload signal-exit. + */ +onExit, +/** + * Load the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +load, +/** + * Unload the listeners. Likely you never need to call this, unless + * doing a rather deep integration with signal-exit functionality. + * Mostly exposed for the benefit of testing. + * + * @internal + */ +unload, } = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback()); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/index.js.map b/node_modules/signal-exit/dist/mjs/index.js.map new file mode 100644 index 00000000..3a7b76d6 --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,+DAA+D;AAC/D,qDAAqD;AACrD,4DAA4D;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,CAAA;AAQlB,MAAM,SAAS,GAAG,CAAC,OAAY,EAAwB,EAAE,CACvD,CAAC,CAAC,OAAO;IACT,OAAO,OAAO,KAAK,QAAQ;IAC3B,OAAO,OAAO,CAAC,cAAc,KAAK,UAAU;IAC5C,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU;IAClC,OAAO,OAAO,CAAC,UAAU,KAAK,UAAU;IACxC,OAAO,OAAO,CAAC,SAAS,KAAK,UAAU;IACvC,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU;IAClC,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ;IAC/B,OAAO,OAAO,CAAC,EAAE,KAAK,UAAU,CAAA;AAElC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;AACtD,MAAM,MAAM,GAAqD,UAAU,CAAA;AAC3E,MAAM,oBAAoB,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAwB/D,2BAA2B;AAC3B,MAAM,OAAO;IACX,OAAO,GAAY;QACjB,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,KAAK;KACZ,CAAA;IAED,SAAS,GAAc;QACrB,SAAS,EAAE,EAAE;QACb,IAAI,EAAE,EAAE;KACT,CAAA;IAED,KAAK,GAAW,CAAC,CAAA;IACjB,EAAE,GAAW,IAAI,CAAC,MAAM,EAAE,CAAA;IAE1B;QACE,IAAI,MAAM,CAAC,YAAY,CAAC,EAAE;YACxB,OAAO,MAAM,CAAC,YAAY,CAAC,CA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AAC,CAAC,CAAC,CAAC,IAAI,kBAAkB,EAAE,CACxE,CAAA","sourcesContent":["// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nimport { signals } from './signals.js'\nexport { signals }\n\n// just a loosened process type so we can do some evil things\ntype ProcessRE = NodeJS.Process & {\n reallyExit: (code?: number | undefined | null) => any\n emit: (ev: string, ...a: any[]) => any\n}\n\nconst processOk = (process: any): process is ProcessRE =>\n !!process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function'\n\nconst kExitEmitter = Symbol.for('signal-exit emitter')\nconst global: typeof globalThis & { [kExitEmitter]?: Emitter } = globalThis\nconst ObjectDefineProperty = Object.defineProperty.bind(Object)\n\n/**\n * A function that takes an exit code and signal as arguments\n *\n * In the case of signal exits *only*, a return value of true\n * will indicate that the signal is being handled, and we should\n * not synthetically exit with the signal we received. Regardless\n * of the handler return value, the handler is unloaded when an\n * otherwise fatal signal is received, so you get exactly 1 shot\n * at it, unless you add another onExit handler at that point.\n *\n * In the case of numeric code exits, we may already have committed\n * to exiting the process, for example via a fatal exception or\n * unhandled promise rejection, so it is impossible to stop safely.\n */\nexport type Handler = (\n code: number | null | undefined,\n signal: NodeJS.Signals | null\n) => true | void\ntype ExitEvent = 'afterExit' | 'exit'\ntype Emitted = { [k in ExitEvent]: boolean }\ntype Listeners = { [k in ExitEvent]: Handler[] }\n\n// teeny special purpose ee\nclass Emitter {\n emitted: Emitted = {\n afterExit: false,\n exit: false,\n }\n\n listeners: Listeners = {\n afterExit: [],\n exit: [],\n }\n\n count: number = 0\n id: number = Math.random()\n\n constructor() {\n if (global[kExitEmitter]) {\n return global[kExitEmitter]\n }\n ObjectDefineProperty(global, kExitEmitter, {\n value: this,\n writable: false,\n enumerable: false,\n configurable: false,\n })\n }\n\n on(ev: ExitEvent, fn: Handler) {\n this.listeners[ev].push(fn)\n }\n\n removeListener(ev: ExitEvent, fn: Handler) {\n const list = this.listeners[ev]\n const i = list.indexOf(fn)\n /* c8 ignore start */\n if (i === -1) {\n return\n }\n /* c8 ignore stop */\n if (i === 0 && list.length === 1) {\n list.length = 0\n } else {\n list.splice(i, 1)\n }\n }\n\n emit(\n ev: ExitEvent,\n code: number | null | undefined,\n signal: NodeJS.Signals | null\n ): boolean {\n if (this.emitted[ev]) {\n return false\n }\n this.emitted[ev] = true\n let ret: boolean = false\n for (const fn of this.listeners[ev]) {\n ret = fn(code, signal) === true || ret\n }\n if (ev === 'exit') {\n ret = this.emit('afterExit', code, signal) || ret\n }\n return ret\n }\n}\n\nabstract class SignalExitBase {\n abstract onExit(cb: Handler, opts?: { alwaysLast?: boolean }): () => void\n abstract load(): void\n abstract unload(): void\n}\n\nconst signalExitWrap = (handler: T) => {\n return {\n onExit(cb: Handler, opts?: { alwaysLast?: boolean }) {\n return handler.onExit(cb, opts)\n },\n load() {\n return handler.load()\n },\n unload() {\n return handler.unload()\n },\n }\n}\n\nclass SignalExitFallback extends SignalExitBase {\n onExit() {\n return () => {}\n }\n load() {}\n unload() {}\n}\n\nclass SignalExit extends SignalExitBase {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n /* c8 ignore start */\n #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP'\n /* c8 ignore stop */\n #emitter = new Emitter()\n #process: ProcessRE\n #originalProcessEmit: ProcessRE['emit']\n #originalProcessReallyExit: ProcessRE['reallyExit']\n\n #sigListeners: { [k in NodeJS.Signals]?: () => void } = {}\n #loaded: boolean = false\n\n constructor(process: ProcessRE) {\n super()\n this.#process = process\n // { : , ... }\n this.#sigListeners = {}\n for (const sig of signals) {\n this.#sigListeners[sig] = () => {\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n const listeners = this.#process.listeners(sig)\n let { count } = this.#emitter\n // This is a workaround for the fact that signal-exit v3 and signal\n // exit v4 are not aware of each other, and each will attempt to let\n // the other handle it, so neither of them do. To correct this, we\n // detect if we're the only handler *except* for previous versions\n // of signal-exit, and increment by the count of listeners it has\n // created.\n /* c8 ignore start */\n const p = process as unknown as {\n __signal_exit_emitter__?: { count: number }\n }\n if (\n typeof p.__signal_exit_emitter__ === 'object' &&\n typeof p.__signal_exit_emitter__.count === 'number'\n ) {\n count += p.__signal_exit_emitter__.count\n }\n /* c8 ignore stop */\n if (listeners.length === count) {\n this.unload()\n const ret = this.#emitter.emit('exit', null, sig)\n /* c8 ignore start */\n const s = sig === 'SIGHUP' ? this.#hupSig : sig\n if (!ret) process.kill(process.pid, s)\n /* c8 ignore stop */\n }\n }\n }\n\n this.#originalProcessReallyExit = process.reallyExit\n this.#originalProcessEmit = process.emit\n }\n\n onExit(cb: Handler, opts?: { alwaysLast?: boolean }) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return () => {}\n }\n /* c8 ignore stop */\n\n if (this.#loaded === false) {\n this.load()\n }\n\n const ev = opts?.alwaysLast ? 'afterExit' : 'exit'\n this.#emitter.on(ev, cb)\n return () => {\n this.#emitter.removeListener(ev, cb)\n if (\n this.#emitter.listeners['exit'].length === 0 &&\n this.#emitter.listeners['afterExit'].length === 0\n ) {\n this.unload()\n }\n }\n }\n\n load() {\n if (this.#loaded) {\n return\n }\n this.#loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n this.#emitter.count += 1\n\n for (const sig of signals) {\n try {\n const fn = this.#sigListeners[sig]\n if (fn) this.#process.on(sig, fn)\n } catch (_) {}\n }\n\n this.#process.emit = (ev: string, ...a: any[]) => {\n return this.#processEmit(ev, ...a)\n }\n this.#process.reallyExit = (code?: number | null | undefined) => {\n return this.#processReallyExit(code)\n }\n }\n\n unload() {\n if (!this.#loaded) {\n return\n }\n this.#loaded = false\n\n signals.forEach(sig => {\n const listener = this.#sigListeners[sig]\n /* c8 ignore start */\n if (!listener) {\n throw new Error('Listener not defined for signal: ' + sig)\n }\n /* c8 ignore stop */\n try {\n this.#process.removeListener(sig, listener)\n /* c8 ignore start */\n } catch (_) {}\n /* c8 ignore stop */\n })\n this.#process.emit = this.#originalProcessEmit\n this.#process.reallyExit = this.#originalProcessReallyExit\n this.#emitter.count -= 1\n }\n\n #processReallyExit(code?: number | null | undefined) {\n /* c8 ignore start */\n if (!processOk(this.#process)) {\n return 0\n }\n this.#process.exitCode = code || 0\n /* c8 ignore stop */\n\n this.#emitter.emit('exit', this.#process.exitCode, null)\n return this.#originalProcessReallyExit.call(\n this.#process,\n this.#process.exitCode\n )\n }\n\n #processEmit(ev: string, ...args: any[]): any {\n const og = this.#originalProcessEmit\n if (ev === 'exit' && processOk(this.#process)) {\n if (typeof args[0] === 'number') {\n this.#process.exitCode = args[0]\n /* c8 ignore start */\n }\n /* c8 ignore start */\n const ret = og.call(this.#process, ev, ...args)\n /* c8 ignore start */\n this.#emitter.emit('exit', this.#process.exitCode, null)\n /* c8 ignore stop */\n return ret\n } else {\n return og.call(this.#process, ev, ...args)\n }\n }\n}\n\nconst process = globalThis.process\n// wrap so that we call the method on the actual handler, without\n// exporting it directly.\nexport const {\n /**\n * Called when the process is exiting, whether via signal, explicit\n * exit, or running out of stuff to do.\n *\n * If the global process object is not suitable for instrumentation,\n * then this will be a no-op.\n *\n * Returns a function that may be used to unload signal-exit.\n */\n onExit,\n\n /**\n * Load the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\n load,\n\n /**\n * Unload the listeners. Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\n unload,\n} = signalExitWrap(\n processOk(process) ? new SignalExit(process) : new SignalExitFallback()\n)\n"]} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/package.json b/node_modules/signal-exit/dist/mjs/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/signal-exit/dist/mjs/signals.d.ts b/node_modules/signal-exit/dist/mjs/signals.d.ts new file mode 100644 index 00000000..3f01ef00 --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/signals.d.ts @@ -0,0 +1,29 @@ +/// +/** + * 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. + * + * Windows signals are a different set, since there are + * signals that terminate Windows processes, but don't + * terminate (or don't even exist) on Posix systems. + * + * 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. + */ +export declare const signals: NodeJS.Signals[]; +//# sourceMappingURL=signals.d.ts.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/signals.d.ts.map b/node_modules/signal-exit/dist/mjs/signals.d.ts.map new file mode 100644 index 00000000..891fe1e6 --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/signals.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/signals.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,OAAO,EAAO,CAAA"} \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/signals.js b/node_modules/signal-exit/dist/mjs/signals.js new file mode 100644 index 00000000..7dbf15a5 --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/signals.js @@ -0,0 +1,39 @@ +/** + * 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. + * + * Windows signals are a different set, since there are + * signals that terminate Windows processes, but don't + * terminate (or don't even exist) on Posix systems. + * + * 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. + */ +export const signals = []; +signals.push('SIGHUP', 'SIGINT', 'SIGTERM'); +if (process.platform !== 'win32') { + signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT' + // should detect profiler and enable/disable accordingly. + // see #21 + // 'SIGPROF' + ); +} +if (process.platform === 'linux') { + signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT'); +} +//# sourceMappingURL=signals.js.map \ No newline at end of file diff --git a/node_modules/signal-exit/dist/mjs/signals.js.map b/node_modules/signal-exit/dist/mjs/signals.js.map new file mode 100644 index 00000000..91008c91 --- /dev/null +++ b/node_modules/signal-exit/dist/mjs/signals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../src/signals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAqB,EAAE,CAAA;AAC3C,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;AAE3C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,OAAO,CAAC,IAAI,CACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ;IACR,yDAAyD;IACzD,UAAU;IACV,YAAY;KACb,CAAA;CACF;AAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;CACxD","sourcesContent":["/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems. Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL. It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals: NodeJS.Signals[] = []\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM')\n\nif (process.platform !== 'win32') {\n signals.push(\n 'SIGALRM',\n 'SIGABRT',\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n}\n\nif (process.platform === 'linux') {\n signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT')\n}\n"]} \ No newline at end of file diff --git a/node_modules/signal-exit/package.json b/node_modules/signal-exit/package.json new file mode 100644 index 00000000..ac176cec --- /dev/null +++ b/node_modules/signal-exit/package.json @@ -0,0 +1,106 @@ +{ + "name": "signal-exit", + "version": "4.1.0", + "description": "when you want to fire an event no matter how a process exits.", + "main": "./dist/cjs/index.js", + "module": "./dist/mjs/index.js", + "browser": "./dist/mjs/browser.js", + "types": "./dist/mjs/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" + } + }, + "./signals": { + "import": { + "types": "./dist/mjs/signals.d.ts", + "default": "./dist/mjs/signals.js" + }, + "require": { + "types": "./dist/cjs/signals.d.ts", + "default": "./dist/cjs/signals.js" + } + }, + "./browser": { + "import": { + "types": "./dist/mjs/browser.d.ts", + "default": "./dist/mjs/browser.js" + }, + "require": { + "types": "./dist/cjs/browser.d.ts", + "default": "./dist/cjs/browser.js" + } + } + }, + "files": [ + "dist" + ], + "engines": { + "node": ">=14" + }, + "repository": { + "type": "git", + "url": "https://github.com/tapjs/signal-exit.git" + }, + "keywords": [ + "signal", + "exit" + ], + "author": "Ben Coe ", + "license": "ISC", + "devDependencies": { + "@types/cross-spawn": "^6.0.2", + "@types/node": "^18.15.11", + "@types/signal-exit": "^3.0.1", + "@types/tap": "^15.0.8", + "c8": "^7.13.0", + "prettier": "^2.8.6", + "tap": "^16.3.4", + "ts-node": "^10.9.1", + "typedoc": "^0.23.28", + "typescript": "^5.0.2" + }, + "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 ./scripts/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" + }, + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "tap": { + "coverage": false, + "jobs": 1, + "node-arg": [ + "--no-warnings", + "--loader", + "ts-node/esm" + ], + "ts": false + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } +} diff --git a/node_modules/simple-icons-font/font/simple-icons.css b/node_modules/simple-icons-font/font/simple-icons.css new file mode 100644 index 00000000..ee98c1d3 --- /dev/null +++ b/node_modules/simple-icons-font/font/simple-icons.css @@ -0,0 +1,4056 @@ +@font-face { + font-family: 'Simple Icons'; + src: + url(SimpleIcons.woff) format('woff'), + url(SimpleIcons.woff2) format('woff2'), + url(SimpleIcons.ttf) format('truetype'), + url(SimpleIcons.otf) format('opentype'), + url(SimpleIcons.eot) format('embedded-opentype'); +} + +.si { + font-style: normal; + font-family: 'Simple Icons', sans-serif; + vertical-align: middle; +} + +.si-42::before { content: "\ea0e"; } +.si-42.si--color::before { color: #000000; } +.si-dotenv::before { content: "\ea01"; } +.si-dotenv.si--color::before { color: #ECD53F; } +.si-dotnet::before { content: "\ea02"; } +.si-dotnet.si--color::before { color: #512BD4; } +.si-e::before { content: "\ea03"; } +.si-e.si--color::before { color: #000000; } +.si-1dot1dot1dot1::before { content: "\ea04"; } +.si-1dot1dot1dot1.si--color::before { color: #221E68; } +.si-1and1::before { content: "\ea05"; } +.si-1and1.si--color::before { color: #003D8F; } +.si-1001tracklists::before { content: "\ea06"; } +.si-1001tracklists.si--color::before { color: #40AEF0; } +.si-1panel::before { content: "\ea07"; } +.si-1panel.si--color::before { color: #0854C1; } +.si-1password::before { content: "\ea08"; } +.si-1password.si--color::before { color: #3B66BC; } +.si-2fas::before { content: "\ea09"; } +.si-2fas.si--color::before { color: #EC1C24; } +.si-2k::before { content: "\ea0a"; } +.si-2k.si--color::before { color: #DD0700; } +.si-30secondsofcode::before { content: "\ea0b"; } +.si-30secondsofcode.si--color::before { color: #5395FD; } +.si-365datascience::before { content: "\ea0c"; } +.si-365datascience.si--color::before { color: #000C1F; } +.si-3m::before { content: "\ea0d"; } +.si-3m.si--color::before { color: #FF0000; } +.si-4chan::before { content: "\ea0f"; } +.si-4chan.si--color::before { color: #006600; } +.si-4d::before { content: "\ea10"; } +.si-4d.si--color::before { color: #004088; } +.si-500px::before { content: "\ea11"; } +.si-500px.si--color::before { color: #222222; } +.si-7zip::before { content: "\ea12"; } +.si-7zip.si--color::before { color: #000000; } +.si-99designs::before { content: "\ea13"; } +.si-99designs.si--color::before { color: #FE5F50; } +.si-9gag::before { content: "\ea14"; } +.si-9gag.si--color::before { color: #000000; } +.si-aframe::before { content: "\ea15"; } +.si-aframe.si--color::before { color: #EF2D5E; } +.si-abbrobotstudio::before { content: "\ea16"; } +.si-abbrobotstudio.si--color::before { color: #FF9E0F; } +.si-abbott::before { content: "\ea17"; } +.si-abbott.si--color::before { color: #008FC7; } +.si-abbvie::before { content: "\ea18"; } +.si-abbvie.si--color::before { color: #071D49; } +.si-aboutdotme::before { content: "\ea19"; } +.si-aboutdotme.si--color::before { color: #333333; } +.si-abstract::before { content: "\ea1a"; } +.si-abstract.si--color::before { color: #191A1B; } +.si-abusedotch::before { content: "\ea1b"; } +.si-abusedotch.si--color::before { color: #00465B; } +.si-academia::before { content: "\ea1c"; } +.si-academia.si--color::before { color: #41454A; } +.si-accenture::before { content: "\ea1d"; } +.si-accenture.si--color::before { color: #A100FF; } +.si-accusoft::before { content: "\ea1e"; } +.si-accusoft.si--color::before { color: #A9225C; } +.si-accuweather::before { content: "\ea1f"; } +.si-accuweather.si--color::before { color: #FF6600; } +.si-acer::before { content: "\ea20"; } +.si-acer.si--color::before { color: #83B81A; } +.si-acm::before { content: "\ea21"; } +.si-acm.si--color::before { color: #0085CA; } +.si-actigraph::before { content: "\ea22"; } +.si-actigraph.si--color::before { color: #0B2C4A; } +.si-activision::before { content: "\ea23"; } +.si-activision.si--color::before { color: #000000; } +.si-activitypub::before { content: "\ea24"; } +.si-activitypub.si--color::before { color: #F1007E; } +.si-actix::before { content: "\ea25"; } +.si-actix.si--color::before { color: #000000; } +.si-actualbudget::before { content: "\ea26"; } +.si-actualbudget.si--color::before { color: #6B46C1; } +.si-acura::before { content: "\ea27"; } +.si-acura.si--color::before { color: #000000; } +.si-adafruit::before { content: "\ea28"; } +.si-adafruit.si--color::before { color: #000000; } +.si-adblock::before { content: "\ea29"; } +.si-adblock.si--color::before { color: #F40D12; } +.si-adblockplus::before { content: "\ea2a"; } +.si-adblockplus.si--color::before { color: #C70D2C; } +.si-addydotio::before { content: "\ea2b"; } +.si-addydotio.si--color::before { color: #19216C; } +.si-adguard::before { content: "\ea2c"; } +.si-adguard.si--color::before { color: #68BC71; } +.si-adidas::before { content: "\ea2d"; } +.si-adidas.si--color::before { color: #000000; } +.si-adminer::before { content: "\ea2e"; } +.si-adminer.si--color::before { color: #34567C; } +.si-adonisjs::before { content: "\ea2f"; } +.si-adonisjs.si--color::before { color: #5A45FF; } +.si-adp::before { content: "\ea30"; } +.si-adp.si--color::before { color: #D0271D; } +.si-adroll::before { content: "\ea31"; } +.si-adroll.si--color::before { color: #0DBDFF; } +.si-adventofcode::before { content: "\ea32"; } +.si-adventofcode.si--color::before { color: #FFFF66; } +.si-adyen::before { content: "\ea33"; } +.si-adyen.si--color::before { color: #0ABF53; } +.si-aegisauthenticator::before { content: "\ea34"; } +.si-aegisauthenticator.si--color::before { color: #005E9D; } +.si-aerlingus::before { content: "\ea35"; } +.si-aerlingus.si--color::before { color: #006272; } +.si-aeroflot::before { content: "\ea36"; } +.si-aeroflot.si--color::before { color: #02458D; } +.si-aeromexico::before { content: "\ea37"; } +.si-aeromexico.si--color::before { color: #0B2343; } +.si-aerospike::before { content: "\ea38"; } +.si-aerospike.si--color::before { color: #C22127; } +.si-aew::before { content: "\ea39"; } +.si-aew.si--color::before { color: #000000; } +.si-afdian::before { content: "\ea3a"; } +.si-afdian.si--color::before { color: #946CE6; } +.si-affine::before { content: "\ea3b"; } +.si-affine.si--color::before { color: #1E96EB; } +.si-affinity::before { content: "\ea3c"; } +.si-affinity.si--color::before { color: #222324; } +.si-affinitydesigner::before { content: "\ea3d"; } +.si-affinitydesigner.si--color::before { color: #134881; } +.si-affinityphoto::before { content: "\ea3e"; } +.si-affinityphoto.si--color::before { color: #4E3188; } +.si-affinitypublisher::before { content: "\ea3f"; } +.si-affinitypublisher.si--color::before { color: #891B26; } +.si-afterpay::before { content: "\ea40"; } +.si-afterpay.si--color::before { color: #B2FCE4; } +.si-aftership::before { content: "\ea41"; } +.si-aftership.si--color::before { color: #FF6B2B; } +.si-agora::before { content: "\ea42"; } +.si-agora.si--color::before { color: #099DFD; } +.si-aidungeon::before { content: "\ea43"; } +.si-aidungeon.si--color::before { color: #000000; } +.si-aib::before { content: "\ea44"; } +.si-aib.si--color::before { color: #7F2B7B; } +.si-aiohttp::before { content: "\ea45"; } +.si-aiohttp.si--color::before { color: #2C5BB4; } +.si-aiqfome::before { content: "\ea46"; } +.si-aiqfome.si--color::before { color: #7A1FA2; } +.si-aircanada::before { content: "\ea47"; } +.si-aircanada.si--color::before { color: #F01428; } +.si-airchina::before { content: "\ea48"; } +.si-airchina.si--color::before { color: #E30E17; } +.si-airfrance::before { content: "\ea49"; } +.si-airfrance.si--color::before { color: #002157; } +.si-airindia::before { content: "\ea4a"; } +.si-airindia.si--color::before { color: #DA0E29; } +.si-airserbia::before { content: "\ea4b"; } +.si-airserbia.si--color::before { color: #0E203F; } +.si-airtransat::before { content: "\ea4c"; } +.si-airtransat.si--color::before { color: #172B54; } +.si-airasia::before { content: "\ea4d"; } +.si-airasia.si--color::before { color: #FF0000; } +.si-airbnb::before { content: "\ea4e"; } +.si-airbnb.si--color::before { color: #FF5A5F; } +.si-airbrake::before { content: "\ea4f"; } +.si-airbrake.si--color::before { color: #FFA500; } +.si-airbus::before { content: "\ea50"; } +.si-airbus.si--color::before { color: #00205B; } +.si-airbyte::before { content: "\ea51"; } +.si-airbyte.si--color::before { color: #615EFF; } +.si-aircall::before { content: "\ea52"; } +.si-aircall.si--color::before { color: #00B388; } +.si-airplayaudio::before { content: "\ea53"; } +.si-airplayaudio.si--color::before { color: #000000; } +.si-airplayvideo::before { content: "\ea54"; } +.si-airplayvideo.si--color::before { color: #000000; } +.si-airtable::before { content: "\ea55"; } +.si-airtable.si--color::before { color: #18BFFF; } +.si-airtel::before { content: "\ea56"; } +.si-airtel.si--color::before { color: #E40000; } +.si-ajv::before { content: "\ea57"; } +.si-ajv.si--color::before { color: #23C8D2; } +.si-akamai::before { content: "\ea58"; } +.si-akamai.si--color::before { color: #0096D6; } +.si-akasaair::before { content: "\ea59"; } +.si-akasaair.si--color::before { color: #FF6300; } +.si-akaunting::before { content: "\ea5a"; } +.si-akaunting.si--color::before { color: #6DA252; } +.si-akiflow::before { content: "\ea5b"; } +.si-akiflow.si--color::before { color: #AF38F9; } +.si-alacritty::before { content: "\ea5c"; } +.si-alacritty.si--color::before { color: #F46D01; } +.si-alamy::before { content: "\ea5d"; } +.si-alamy.si--color::before { color: #00FF7B; } +.si-albertheijn::before { content: "\ea5e"; } +.si-albertheijn.si--color::before { color: #04ACE6; } +.si-alby::before { content: "\ea5f"; } +.si-alby.si--color::before { color: #FFDF6F; } +.si-alchemy::before { content: "\ea60"; } +.si-alchemy.si--color::before { color: #0C0C0E; } +.si-aldinord::before { content: "\ea61"; } +.si-aldinord.si--color::before { color: #2490D7; } +.si-aldisud::before { content: "\ea62"; } +.si-aldisud.si--color::before { color: #00005F; } +.si-alfaromeo::before { content: "\ea63"; } +.si-alfaromeo.si--color::before { color: #981E32; } +.si-alfred::before { content: "\ea64"; } +.si-alfred.si--color::before { color: #5C1F87; } +.si-algolia::before { content: "\ea65"; } +.si-algolia.si--color::before { color: #003DFF; } +.si-algorand::before { content: "\ea66"; } +.si-algorand.si--color::before { color: #000000; } +.si-alibabacloud::before { content: "\ea67"; } +.si-alibabacloud.si--color::before { color: #FF6A00; } +.si-alibabadotcom::before { content: "\ea68"; } +.si-alibabadotcom.si--color::before { color: #FF6A00; } +.si-alienware::before { content: "\ea69"; } +.si-alienware.si--color::before { color: #541BAE; } +.si-aliexpress::before { content: "\ea6a"; } +.si-aliexpress.si--color::before { color: #FF4747; } +.si-alipay::before { content: "\ea6b"; } +.si-alipay.si--color::before { color: #1677FF; } +.si-allegro::before { content: "\ea6c"; } +.si-allegro.si--color::before { color: #FF5A00; } +.si-alliedmodders::before { content: "\ea6d"; } +.si-alliedmodders.si--color::before { color: #1578D3; } +.si-allocine::before { content: "\ea6e"; } +.si-allocine.si--color::before { color: #FECC00; } +.si-alltrails::before { content: "\ea6f"; } +.si-alltrails.si--color::before { color: #142800; } +.si-almalinux::before { content: "\ea70"; } +.si-almalinux.si--color::before { color: #000000; } +.si-alpinelinux::before { content: "\ea71"; } +.si-alpinelinux.si--color::before { color: #0D597F; } +.si-alpinedotjs::before { content: "\ea72"; } +.si-alpinedotjs.si--color::before { color: #8BC0D0; } +.si-alternativeto::before { content: "\ea73"; } +.si-alternativeto.si--color::before { color: #0289D5; } +.si-alteryx::before { content: "\ea74"; } +.si-alteryx.si--color::before { color: #0078C0; } +.si-altiumdesigner::before { content: "\ea75"; } +.si-altiumdesigner.si--color::before { color: #A5915F; } +.si-alwaysdata::before { content: "\ea76"; } +.si-alwaysdata.si--color::before { color: #E9568E; } +.si-alx::before { content: "\ea77"; } +.si-alx.si--color::before { color: #002B56; } +.si-amazon::before { content: "\ea78"; } +.si-amazon.si--color::before { color: #FF9900; } +.si-amazonalexa::before { content: "\ea79"; } +.si-amazonalexa.si--color::before { color: #00CAFF; } +.si-amazonapigateway::before { content: "\ea7a"; } +.si-amazonapigateway.si--color::before { color: #FF4F8B; } +.si-amazoncloudwatch::before { content: "\ea7b"; } +.si-amazoncloudwatch.si--color::before { color: #FF4F8B; } +.si-amazoncognito::before { content: "\ea7c"; } +.si-amazoncognito.si--color::before { color: #DD344C; } +.si-amazondocumentdb::before { content: "\ea7d"; } +.si-amazondocumentdb.si--color::before { color: #C925D1; } +.si-amazondynamodb::before { content: "\ea7e"; } +.si-amazondynamodb.si--color::before { color: #4053D6; } +.si-amazonec2::before { content: "\ea7f"; } +.si-amazonec2.si--color::before { color: #FF9900; } +.si-amazonecs::before { content: "\ea80"; } +.si-amazonecs.si--color::before { color: #FF9900; } +.si-amazoneks::before { content: "\ea81"; } +.si-amazoneks.si--color::before { color: #FF9900; } +.si-amazonelasticache::before { content: "\ea82"; } +.si-amazonelasticache.si--color::before { color: #C925D1; } +.si-amazonfiretv::before { content: "\ea83"; } +.si-amazonfiretv.si--color::before { color: #FC4C02; } +.si-amazongames::before { content: "\ea84"; } +.si-amazongames.si--color::before { color: #FF9900; } +.si-amazoniam::before { content: "\ea85"; } +.si-amazoniam.si--color::before { color: #DD344C; } +.si-amazonlumberyard::before { content: "\ea86"; } +.si-amazonlumberyard.si--color::before { color: #66459B; } +.si-amazonluna::before { content: "\ea87"; } +.si-amazonluna.si--color::before { color: #9146FF; } +.si-amazonmusic::before { content: "\ea88"; } +.si-amazonmusic.si--color::before { color: #46C3D0; } +.si-amazonpay::before { content: "\ea89"; } +.si-amazonpay.si--color::before { color: #FF9900; } +.si-amazonprime::before { content: "\ea8a"; } +.si-amazonprime.si--color::before { color: #00A8E1; } +.si-amazonrds::before { content: "\ea8b"; } +.si-amazonrds.si--color::before { color: #527FFF; } +.si-amazonredshift::before { content: "\ea8c"; } +.si-amazonredshift.si--color::before { color: #8C4FFF; } +.si-amazonroute53::before { content: "\ea8d"; } +.si-amazonroute53.si--color::before { color: #8C4FFF; } +.si-amazons3::before { content: "\ea8e"; } +.si-amazons3.si--color::before { color: #569A31; } +.si-amazonsimpleemailservice::before { content: "\ea8f"; } +.si-amazonsimpleemailservice.si--color::before { color: #DD344C; } +.si-amazonsqs::before { content: "\ea90"; } +.si-amazonsqs.si--color::before { color: #FF4F8B; } +.si-amazonwebservices::before { content: "\ea91"; } +.si-amazonwebservices.si--color::before { color: #232F3E; } +.si-amd::before { content: "\ea92"; } +.si-amd.si--color::before { color: #ED1C24; } +.si-ameba::before { content: "\ea93"; } +.si-ameba.si--color::before { color: #2D8C3C; } +.si-americanairlines::before { content: "\ea94"; } +.si-americanairlines.si--color::before { color: #0078D2; } +.si-americanexpress::before { content: "\ea95"; } +.si-americanexpress.si--color::before { color: #2E77BC; } +.si-amg::before { content: "\ea96"; } +.si-amg.si--color::before { color: #000000; } +.si-amp::before { content: "\ea97"; } +.si-amp.si--color::before { color: #005AF0; } +.si-amul::before { content: "\ea98"; } +.si-amul.si--color::before { color: #ED1D24; } +.si-ana::before { content: "\ea99"; } +.si-ana.si--color::before { color: #13448F; } +.si-anaconda::before { content: "\ea9a"; } +.si-anaconda.si--color::before { color: #44A833; } +.si-analogue::before { content: "\ea9b"; } +.si-analogue.si--color::before { color: #1A1A1A; } +.si-andela::before { content: "\ea9c"; } +.si-andela.si--color::before { color: #173B3F; } +.si-android::before { content: "\ea9d"; } +.si-android.si--color::before { color: #34A853; } +.si-androidauto::before { content: "\ea9e"; } +.si-androidauto.si--color::before { color: #3DDC84; } +.si-androidstudio::before { content: "\ea9f"; } +.si-androidstudio.si--color::before { color: #3DDC84; } +.si-angular::before { content: "\eaa0"; } +.si-angular.si--color::before { color: #0F0F11; } +.si-anilist::before { content: "\eaa1"; } +.si-anilist.si--color::before { color: #02A9FF; } +.si-animalplanet::before { content: "\eaa2"; } +.si-animalplanet.si--color::before { color: #0073FF; } +.si-ankermake::before { content: "\eaa3"; } +.si-ankermake.si--color::before { color: #88F387; } +.si-anki::before { content: "\eaa4"; } +.si-anki.si--color::before { color: #80C2EE; } +.si-ansible::before { content: "\eaa5"; } +.si-ansible.si--color::before { color: #EE0000; } +.si-answer::before { content: "\eaa6"; } +.si-answer.si--color::before { color: #0033FF; } +.si-ansys::before { content: "\eaa7"; } +.si-ansys.si--color::before { color: #FFB71B; } +.si-antdesign::before { content: "\eaa8"; } +.si-antdesign.si--color::before { color: #0170FE; } +.si-anta::before { content: "\eaa9"; } +.si-anta.si--color::before { color: #D70010; } +.si-antena3::before { content: "\eaaa"; } +.si-antena3.si--color::before { color: #FF7328; } +.si-anthropic::before { content: "\eaab"; } +.si-anthropic.si--color::before { color: #191919; } +.si-antv::before { content: "\eaac"; } +.si-antv.si--color::before { color: #8B5DFF; } +.si-anycubic::before { content: "\eaad"; } +.si-anycubic.si--color::before { color: #476695; } +.si-anydesk::before { content: "\eaae"; } +.si-anydesk.si--color::before { color: #EF443B; } +.si-anytype::before { content: "\eaaf"; } +.si-anytype.si--color::before { color: #FF6A7B; } +.si-aol::before { content: "\eab0"; } +.si-aol.si--color::before { color: #3399FF; } +.si-apache::before { content: "\eab1"; } +.si-apache.si--color::before { color: #D22128; } +.si-apacheairflow::before { content: "\eab2"; } +.si-apacheairflow.si--color::before { color: #017CEE; } +.si-apacheant::before { content: "\eab3"; } +.si-apacheant.si--color::before { color: #A81C7D; } +.si-apachecassandra::before { content: "\eab4"; } +.si-apachecassandra.si--color::before { color: #1287B1; } +.si-apachecloudstack::before { content: "\eab5"; } +.si-apachecloudstack.si--color::before { color: #2AA5DC; } +.si-apachecordova::before { content: "\eab6"; } +.si-apachecordova.si--color::before { color: #E8E8E8; } +.si-apachecouchdb::before { content: "\eab7"; } +.si-apachecouchdb.si--color::before { color: #E42528; } +.si-apachedolphinscheduler::before { content: "\eab8"; } +.si-apachedolphinscheduler.si--color::before { color: #85CDF0; } +.si-apachedruid::before { content: "\eab9"; } +.si-apachedruid.si--color::before { color: #29F1FB; } +.si-apacheecharts::before { content: "\eaba"; } +.si-apacheecharts.si--color::before { color: #AA344D; } +.si-apacheflink::before { content: "\eabb"; } +.si-apacheflink.si--color::before { color: #E6526F; } +.si-apachefreemarker::before { content: "\eabc"; } +.si-apachefreemarker.si--color::before { color: #326CAC; } +.si-apachegroovy::before { content: "\eabd"; } +.si-apachegroovy.si--color::before { color: #4298B8; } +.si-apacheguacamole::before { content: "\eabe"; } +.si-apacheguacamole.si--color::before { color: #578B34; } +.si-apachehadoop::before { content: "\eabf"; } +.si-apachehadoop.si--color::before { color: #66CCFF; } +.si-apachehbase::before { content: "\eac0"; } +.si-apachehbase.si--color::before { color: #BE160C; } +.si-apachehive::before { content: "\eac1"; } +.si-apachehive.si--color::before { color: #FDEE21; } +.si-apachejmeter::before { content: "\eac2"; } +.si-apachejmeter.si--color::before { color: #D22128; } +.si-apachekafka::before { content: "\eac3"; } +.si-apachekafka.si--color::before { color: #231F20; } +.si-apachekylin::before { content: "\eac4"; } +.si-apachekylin.si--color::before { color: #F09D13; } +.si-apachelucene::before { content: "\eac5"; } +.si-apachelucene.si--color::before { color: #019B8F; } +.si-apachemaven::before { content: "\eac6"; } +.si-apachemaven.si--color::before { color: #C71A36; } +.si-apachenetbeanside::before { content: "\eac7"; } +.si-apachenetbeanside.si--color::before { color: #1B6AC6; } +.si-apachenifi::before { content: "\eac8"; } +.si-apachenifi.si--color::before { color: #728E9B; } +.si-apacheopenoffice::before { content: "\eac9"; } +.si-apacheopenoffice.si--color::before { color: #0E85CD; } +.si-apacheparquet::before { content: "\eaca"; } +.si-apacheparquet.si--color::before { color: #50ABF1; } +.si-apachepulsar::before { content: "\eacb"; } +.si-apachepulsar.si--color::before { color: #188FFF; } +.si-apacherocketmq::before { content: "\eacc"; } +.si-apacherocketmq.si--color::before { color: #D77310; } +.si-apachesolr::before { content: "\eacd"; } +.si-apachesolr.si--color::before { color: #D9411E; } +.si-apachespark::before { content: "\eace"; } +.si-apachespark.si--color::before { color: #E25A1C; } +.si-apachestorm::before { content: "\eacf"; } +.si-apachestorm.si--color::before { color: #225593; } +.si-apachesuperset::before { content: "\ead0"; } +.si-apachesuperset.si--color::before { color: #20A6C9; } +.si-apachetomcat::before { content: "\ead1"; } +.si-apachetomcat.si--color::before { color: #F8DC75; } +.si-aparat::before { content: "\ead2"; } +.si-aparat.si--color::before { color: #ED145B; } +.si-apifox::before { content: "\ead3"; } +.si-apifox.si--color::before { color: #F44A53; } +.si-apmterminals::before { content: "\ead4"; } +.si-apmterminals.si--color::before { color: #FF6441; } +.si-apollographql::before { content: "\ead5"; } +.si-apollographql.si--color::before { color: #311C87; } +.si-apostrophe::before { content: "\ead6"; } +.si-apostrophe.si--color::before { color: #6236FF; } +.si-appstore::before { content: "\ead7"; } +.si-appstore.si--color::before { color: #0D96F6; } +.si-appgallery::before { content: "\ead8"; } +.si-appgallery.si--color::before { color: #FF0000; } +.si-appian::before { content: "\ead9"; } +.si-appian.si--color::before { color: #2322F0; } +.si-appium::before { content: "\eada"; } +.si-appium.si--color::before { color: #EE376D; } +.si-apple::before { content: "\eadb"; } +.si-apple.si--color::before { color: #000000; } +.si-applearcade::before { content: "\eadc"; } +.si-applearcade.si--color::before { color: #000000; } +.si-applemusic::before { content: "\eadd"; } +.si-applemusic.si--color::before { color: #FA243C; } +.si-applenews::before { content: "\eade"; } +.si-applenews.si--color::before { color: #FD415E; } +.si-applepay::before { content: "\eadf"; } +.si-applepay.si--color::before { color: #000000; } +.si-applepodcasts::before { content: "\eae0"; } +.si-applepodcasts.si--color::before { color: #9933CC; } +.si-appletv::before { content: "\eae1"; } +.si-appletv.si--color::before { color: #000000; } +.si-appsignal::before { content: "\eae2"; } +.si-appsignal.si--color::before { color: #21375A; } +.si-appsmith::before { content: "\eae3"; } +.si-appsmith.si--color::before { color: #2A2F3D; } +.si-appveyor::before { content: "\eae4"; } +.si-appveyor.si--color::before { color: #00B3E0; } +.si-appwrite::before { content: "\eae5"; } +.si-appwrite.si--color::before { color: #FD366E; } +.si-aqua::before { content: "\eae6"; } +.si-aqua.si--color::before { color: #1904DA; } +.si-aral::before { content: "\eae7"; } +.si-aral.si--color::before { color: #0063CB; } +.si-arangodb::before { content: "\eae8"; } +.si-arangodb.si--color::before { color: #DDE072; } +.si-arc::before { content: "\eae9"; } +.si-arc.si--color::before { color: #FCBFBD; } +.si-arcgis::before { content: "\eaea"; } +.si-arcgis.si--color::before { color: #2C7AC3; } +.si-archlinux::before { content: "\eaeb"; } +.si-archlinux.si--color::before { color: #1793D1; } +.si-archicad::before { content: "\eaec"; } +.si-archicad.si--color::before { color: #2D50A5; } +.si-archiveofourown::before { content: "\eaed"; } +.si-archiveofourown.si--color::before { color: #990000; } +.si-ardour::before { content: "\eaee"; } +.si-ardour.si--color::before { color: #C61C3E; } +.si-arduino::before { content: "\eaef"; } +.si-arduino.si--color::before { color: #00878F; } +.si-argo::before { content: "\eaf0"; } +.si-argo.si--color::before { color: #EF7B4D; } +.si-argos::before { content: "\eaf1"; } +.si-argos.si--color::before { color: #DA291C; } +.si-ariakit::before { content: "\eaf2"; } +.si-ariakit.si--color::before { color: #007ACC; } +.si-arkecosystem::before { content: "\eaf3"; } +.si-arkecosystem.si--color::before { color: #C9292C; } +.si-arlo::before { content: "\eaf4"; } +.si-arlo.si--color::before { color: #49B48A; } +.si-arm::before { content: "\eaf5"; } +.si-arm.si--color::before { color: #0091BD; } +.si-armkeil::before { content: "\eaf6"; } +.si-armkeil.si--color::before { color: #394049; } +.si-arstechnica::before { content: "\eaf7"; } +.si-arstechnica.si--color::before { color: #FF4E00; } +.si-artifacthub::before { content: "\eaf8"; } +.si-artifacthub.si--color::before { color: #417598; } +.si-artixlinux::before { content: "\eaf9"; } +.si-artixlinux.si--color::before { color: #10A0CC; } +.si-artstation::before { content: "\eafa"; } +.si-artstation.si--color::before { color: #13AFF0; } +.si-arxiv::before { content: "\eafb"; } +.si-arxiv.si--color::before { color: #B31B1B; } +.si-asahilinux::before { content: "\eafc"; } +.si-asahilinux.si--color::before { color: #A61200; } +.si-asana::before { content: "\eafd"; } +.si-asana.si--color::before { color: #F06A6A; } +.si-asciidoctor::before { content: "\eafe"; } +.si-asciidoctor.si--color::before { color: #E40046; } +.si-asciinema::before { content: "\eaff"; } +.si-asciinema.si--color::before { color: #D40000; } +.si-asda::before { content: "\eb00"; } +.si-asda.si--color::before { color: #68A51C; } +.si-aseprite::before { content: "\eb01"; } +.si-aseprite.si--color::before { color: #7D929E; } +.si-assemblyscript::before { content: "\eb02"; } +.si-assemblyscript.si--color::before { color: #007AAC; } +.si-asterisk::before { content: "\eb03"; } +.si-asterisk.si--color::before { color: #F68F1E; } +.si-astonmartin::before { content: "\eb04"; } +.si-astonmartin.si--color::before { color: #00665E; } +.si-astra::before { content: "\eb05"; } +.si-astra.si--color::before { color: #5C2EDE; } +.si-astral::before { content: "\eb06"; } +.si-astral.si--color::before { color: #261230; } +.si-astro::before { content: "\eb07"; } +.si-astro.si--color::before { color: #BC52EE; } +.si-asus::before { content: "\eb08"; } +.si-asus.si--color::before { color: #000000; } +.si-atandt::before { content: "\eb09"; } +.si-atandt.si--color::before { color: #009FDB; } +.si-atari::before { content: "\eb0a"; } +.si-atari.si--color::before { color: #E4202E; } +.si-atlasos::before { content: "\eb0b"; } +.si-atlasos.si--color::before { color: #1A91FF; } +.si-atlassian::before { content: "\eb0c"; } +.si-atlassian.si--color::before { color: #0052CC; } +.si-auchan::before { content: "\eb0d"; } +.si-auchan.si--color::before { color: #D6180B; } +.si-audacity::before { content: "\eb0e"; } +.si-audacity.si--color::before { color: #0000CC; } +.si-audi::before { content: "\eb0f"; } +.si-audi.si--color::before { color: #BB0A30; } +.si-audible::before { content: "\eb10"; } +.si-audible.si--color::before { color: #F8991C; } +.si-audiotechnica::before { content: "\eb11"; } +.si-audiotechnica.si--color::before { color: #000000; } +.si-audiobookshelf::before { content: "\eb12"; } +.si-audiobookshelf.si--color::before { color: #82612C; } +.si-audioboom::before { content: "\eb13"; } +.si-audioboom.si--color::before { color: #007CE2; } +.si-audiomack::before { content: "\eb14"; } +.si-audiomack.si--color::before { color: #FFA200; } +.si-aurelia::before { content: "\eb15"; } +.si-aurelia.si--color::before { color: #ED2B88; } +.si-auth0::before { content: "\eb16"; } +.si-auth0.si--color::before { color: #EB5424; } +.si-authelia::before { content: "\eb17"; } +.si-authelia.si--color::before { color: #113155; } +.si-authentik::before { content: "\eb18"; } +.si-authentik.si--color::before { color: #FD4B2D; } +.si-authy::before { content: "\eb19"; } +.si-authy.si--color::before { color: #EC1C24; } +.si-autocad::before { content: "\eb1a"; } +.si-autocad.si--color::before { color: #E51050; } +.si-autocannon::before { content: "\eb1b"; } +.si-autocannon.si--color::before { color: #3BA4B7; } +.si-autodesk::before { content: "\eb1c"; } +.si-autodesk.si--color::before { color: #000000; } +.si-autodeskmaya::before { content: "\eb1d"; } +.si-autodeskmaya.si--color::before { color: #37A5CC; } +.si-autodeskrevit::before { content: "\eb1e"; } +.si-autodeskrevit.si--color::before { color: #186BFF; } +.si-autohotkey::before { content: "\eb1f"; } +.si-autohotkey.si--color::before { color: #334455; } +.si-autoit::before { content: "\eb20"; } +.si-autoit.si--color::before { color: #5D83AC; } +.si-automattic::before { content: "\eb21"; } +.si-automattic.si--color::before { color: #3499CD; } +.si-autoprefixer::before { content: "\eb22"; } +.si-autoprefixer.si--color::before { color: #DD3735; } +.si-autozone::before { content: "\eb23"; } +.si-autozone.si--color::before { color: #D52B1E; } +.si-avajs::before { content: "\eb24"; } +.si-avajs.si--color::before { color: #4B4B77; } +.si-avast::before { content: "\eb25"; } +.si-avast.si--color::before { color: #FF7800; } +.si-avianca::before { content: "\eb26"; } +.si-avianca.si--color::before { color: #FF0000; } +.si-avira::before { content: "\eb27"; } +.si-avira.si--color::before { color: #E02027; } +.si-awesomelists::before { content: "\eb28"; } +.si-awesomelists.si--color::before { color: #FC60A8; } +.si-awesomewm::before { content: "\eb29"; } +.si-awesomewm.si--color::before { color: #535D6C; } +.si-awsamplify::before { content: "\eb2a"; } +.si-awsamplify.si--color::before { color: #FF9900; } +.si-awselasticloadbalancing::before { content: "\eb2b"; } +.si-awselasticloadbalancing.si--color::before { color: #8C4FFF; } +.si-awsfargate::before { content: "\eb2c"; } +.si-awsfargate.si--color::before { color: #FF9900; } +.si-awslambda::before { content: "\eb2d"; } +.si-awslambda.si--color::before { color: #FF9900; } +.si-awsorganizations::before { content: "\eb2e"; } +.si-awsorganizations.si--color::before { color: #E7157B; } +.si-awssecretsmanager::before { content: "\eb2f"; } +.si-awssecretsmanager.si--color::before { color: #DD344C; } +.si-awwwards::before { content: "\eb30"; } +.si-awwwards.si--color::before { color: #222222; } +.si-axios::before { content: "\eb31"; } +.si-axios.si--color::before { color: #5A29E4; } +.si-bandrautomation::before { content: "\eb32"; } +.si-bandrautomation.si--color::before { color: #FF8800; } +.si-babel::before { content: "\eb33"; } +.si-babel.si--color::before { color: #F9DC3E; } +.si-babelio::before { content: "\eb34"; } +.si-babelio.si--color::before { color: #FBB91E; } +.si-babylondotjs::before { content: "\eb35"; } +.si-babylondotjs.si--color::before { color: #BB464B; } +.si-backblaze::before { content: "\eb36"; } +.si-backblaze.si--color::before { color: #E21E29; } +.si-backbone::before { content: "\eb37"; } +.si-backbone.si--color::before { color: #000000; } +.si-backbonedotjs::before { content: "\eb38"; } +.si-backbonedotjs.si--color::before { color: #0071B5; } +.si-backendless::before { content: "\eb39"; } +.si-backendless.si--color::before { color: #1D77BD; } +.si-backstage::before { content: "\eb3a"; } +.si-backstage.si--color::before { color: #9BF0E1; } +.si-badoo::before { content: "\eb3b"; } +.si-badoo.si--color::before { color: #783BF9; } +.si-baidu::before { content: "\eb3c"; } +.si-baidu.si--color::before { color: #2932E1; } +.si-bakalari::before { content: "\eb3d"; } +.si-bakalari.si--color::before { color: #00A2E2; } +.si-bamboo::before { content: "\eb3e"; } +.si-bamboo.si--color::before { color: #0052CC; } +.si-bambulab::before { content: "\eb3f"; } +.si-bambulab.si--color::before { color: #00AE42; } +.si-bandcamp::before { content: "\eb40"; } +.si-bandcamp.si--color::before { color: #408294; } +.si-bandlab::before { content: "\eb41"; } +.si-bandlab.si--color::before { color: #F12C18; } +.si-bandsintown::before { content: "\eb42"; } +.si-bandsintown.si--color::before { color: #00CEC8; } +.si-bankofamerica::before { content: "\eb43"; } +.si-bankofamerica.si--color::before { color: #012169; } +.si-barclays::before { content: "\eb44"; } +.si-barclays.si--color::before { color: #00AEEF; } +.si-baremetrics::before { content: "\eb45"; } +.si-baremetrics.si--color::before { color: #6078FF; } +.si-barmenia::before { content: "\eb46"; } +.si-barmenia.si--color::before { color: #009FE3; } +.si-basecamp::before { content: "\eb47"; } +.si-basecamp.si--color::before { color: #1D2D35; } +.si-baserow::before { content: "\eb48"; } +.si-baserow.si--color::before { color: #5190EF; } +.si-basicattentiontoken::before { content: "\eb49"; } +.si-basicattentiontoken.si--color::before { color: #80247B; } +.si-bastyon::before { content: "\eb4a"; } +.si-bastyon.si--color::before { color: #00A4FF; } +.si-bat::before { content: "\eb4b"; } +.si-bat.si--color::before { color: #31369E; } +.si-bata::before { content: "\eb4c"; } +.si-bata.si--color::before { color: #DD282E; } +.si-battledotnet::before { content: "\eb4d"; } +.si-battledotnet.si--color::before { color: #4381C3; } +.si-bazel::before { content: "\eb4e"; } +.si-bazel.si--color::before { color: #43A047; } +.si-beatport::before { content: "\eb4f"; } +.si-beatport.si--color::before { color: #01FF95; } +.si-beats::before { content: "\eb50"; } +.si-beats.si--color::before { color: #005571; } +.si-beatsbydre::before { content: "\eb51"; } +.si-beatsbydre.si--color::before { color: #E01F3D; } +.si-beatstars::before { content: "\eb52"; } +.si-beatstars.si--color::before { color: #EB0000; } +.si-beekeeperstudio::before { content: "\eb53"; } +.si-beekeeperstudio.si--color::before { color: #FAD83B; } +.si-behance::before { content: "\eb54"; } +.si-behance.si--color::before { color: #1769FF; } +.si-beijingsubway::before { content: "\eb55"; } +.si-beijingsubway.si--color::before { color: #004A9D; } +.si-bem::before { content: "\eb56"; } +.si-bem.si--color::before { color: #000000; } +.si-bentley::before { content: "\eb57"; } +.si-bentley.si--color::before { color: #333333; } +.si-bento::before { content: "\eb58"; } +.si-bento.si--color::before { color: #768CFF; } +.si-bentobox::before { content: "\eb59"; } +.si-bentobox.si--color::before { color: #F15541; } +.si-bentoml::before { content: "\eb5a"; } +.si-bentoml.si--color::before { color: #000000; } +.si-bereal::before { content: "\eb5b"; } +.si-bereal.si--color::before { color: #000000; } +.si-betfair::before { content: "\eb5c"; } +.si-betfair.si--color::before { color: #FFB80B; } +.si-betterstack::before { content: "\eb5d"; } +.si-betterstack.si--color::before { color: #000000; } +.si-bevy::before { content: "\eb5e"; } +.si-bevy.si--color::before { color: #232326; } +.si-bigcartel::before { content: "\eb5f"; } +.si-bigcartel.si--color::before { color: #222222; } +.si-bigbasket::before { content: "\eb60"; } +.si-bigbasket.si--color::before { color: #A5CD39; } +.si-bigbluebutton::before { content: "\eb61"; } +.si-bigbluebutton.si--color::before { color: #283274; } +.si-bigcommerce::before { content: "\eb62"; } +.si-bigcommerce.si--color::before { color: #121118; } +.si-bilibili::before { content: "\eb63"; } +.si-bilibili.si--color::before { color: #00A1D6; } +.si-billboard::before { content: "\eb64"; } +.si-billboard.si--color::before { color: #000000; } +.si-bim::before { content: "\eb65"; } +.si-bim.si--color::before { color: #EB1928; } +.si-binance::before { content: "\eb66"; } +.si-binance.si--color::before { color: #F0B90B; } +.si-biolink::before { content: "\eb67"; } +.si-biolink.si--color::before { color: #000000; } +.si-biome::before { content: "\eb68"; } +.si-biome.si--color::before { color: #60A5FA; } +.si-bisecthosting::before { content: "\eb69"; } +.si-bisecthosting.si--color::before { color: #0D1129; } +.si-bit::before { content: "\eb6a"; } +.si-bit.si--color::before { color: #592EC1; } +.si-bitbucket::before { content: "\eb6b"; } +.si-bitbucket.si--color::before { color: #0052CC; } +.si-bitcoin::before { content: "\eb6c"; } +.si-bitcoin.si--color::before { color: #F7931A; } +.si-bitcoincash::before { content: "\eb6d"; } +.si-bitcoincash.si--color::before { color: #0AC18E; } +.si-bitcoinsv::before { content: "\eb6e"; } +.si-bitcoinsv.si--color::before { color: #EAB300; } +.si-bitcomet::before { content: "\eb6f"; } +.si-bitcomet.si--color::before { color: #F49923; } +.si-bitdefender::before { content: "\eb70"; } +.si-bitdefender.si--color::before { color: #ED1C24; } +.si-bitly::before { content: "\eb71"; } +.si-bitly.si--color::before { color: #EE6123; } +.si-bitrise::before { content: "\eb72"; } +.si-bitrise.si--color::before { color: #683D87; } +.si-bittorrent::before { content: "\eb73"; } +.si-bittorrent.si--color::before { color: #050505; } +.si-bitwarden::before { content: "\eb74"; } +.si-bitwarden.si--color::before { color: #175DDC; } +.si-bitwig::before { content: "\eb75"; } +.si-bitwig.si--color::before { color: #FF5A00; } +.si-blackberry::before { content: "\eb76"; } +.si-blackberry.si--color::before { color: #000000; } +.si-blackmagicdesign::before { content: "\eb77"; } +.si-blackmagicdesign.si--color::before { color: #FFA200; } +.si-blazemeter::before { content: "\eb78"; } +.si-blazemeter.si--color::before { color: #CA2133; } +.si-blazor::before { content: "\eb79"; } +.si-blazor.si--color::before { color: #512BD4; } +.si-blender::before { content: "\eb7a"; } +.si-blender.si--color::before { color: #E87D0D; } +.si-blockbench::before { content: "\eb7b"; } +.si-blockbench.si--color::before { color: #1E93D9; } +.si-blockchaindotcom::before { content: "\eb7c"; } +.si-blockchaindotcom.si--color::before { color: #121D33; } +.si-blogger::before { content: "\eb7d"; } +.si-blogger.si--color::before { color: #FF5722; } +.si-bloglovin::before { content: "\eb7e"; } +.si-bloglovin.si--color::before { color: #000000; } +.si-blueprint::before { content: "\eb7f"; } +.si-blueprint.si--color::before { color: #137CBD; } +.si-bluesky::before { content: "\eb80"; } +.si-bluesky.si--color::before { color: #0285FF; } +.si-bluesound::before { content: "\eb81"; } +.si-bluesound.si--color::before { color: #0F131E; } +.si-bluetooth::before { content: "\eb82"; } +.si-bluetooth.si--color::before { color: #0082FC; } +.si-bmcsoftware::before { content: "\eb83"; } +.si-bmcsoftware.si--color::before { color: #FE5000; } +.si-bmw::before { content: "\eb84"; } +.si-bmw.si--color::before { color: #0066B1; } +.si-bnbchain::before { content: "\eb85"; } +.si-bnbchain.si--color::before { color: #F0B90B; } +.si-boardgamegeek::before { content: "\eb86"; } +.si-boardgamegeek.si--color::before { color: #FF5100; } +.si-boat::before { content: "\eb87"; } +.si-boat.si--color::before { color: #E20722; } +.si-boehringeringelheim::before { content: "\eb88"; } +.si-boehringeringelheim.si--color::before { color: #00E47C; } +.si-boeing::before { content: "\eb89"; } +.si-boeing.si--color::before { color: #1D439C; } +.si-bombardier::before { content: "\eb8a"; } +.si-bombardier.si--color::before { color: #000000; } +.si-bookalope::before { content: "\eb8b"; } +.si-bookalope.si--color::before { color: #DC2829; } +.si-bookbub::before { content: "\eb8c"; } +.si-bookbub.si--color::before { color: #F44336; } +.si-bookmeter::before { content: "\eb8d"; } +.si-bookmeter.si--color::before { color: #64BC4B; } +.si-bookmyshow::before { content: "\eb8e"; } +.si-bookmyshow.si--color::before { color: #C4242B; } +.si-bookstack::before { content: "\eb8f"; } +.si-bookstack.si--color::before { color: #0288D1; } +.si-boost::before { content: "\eb90"; } +.si-boost.si--color::before { color: #F7901E; } +.si-boosty::before { content: "\eb91"; } +.si-boosty.si--color::before { color: #F15F2C; } +.si-boots::before { content: "\eb92"; } +.si-boots.si--color::before { color: #05054B; } +.si-bootstrap::before { content: "\eb93"; } +.si-bootstrap.si--color::before { color: #7952B3; } +.si-borgbackup::before { content: "\eb94"; } +.si-borgbackup.si--color::before { color: #00DD00; } +.si-bosch::before { content: "\eb95"; } +.si-bosch.si--color::before { color: #EA0016; } +.si-bose::before { content: "\eb96"; } +.si-bose.si--color::before { color: #000000; } +.si-botblecms::before { content: "\eb97"; } +.si-botblecms.si--color::before { color: #205081; } +.si-boulanger::before { content: "\eb98"; } +.si-boulanger.si--color::before { color: #FD5300; } +.si-bower::before { content: "\eb99"; } +.si-bower.si--color::before { color: #EF5734; } +.si-box::before { content: "\eb9a"; } +.si-box.si--color::before { color: #0061D5; } +.si-boxysvg::before { content: "\eb9b"; } +.si-boxysvg.si--color::before { color: #3584E3; } +.si-braintree::before { content: "\eb9c"; } +.si-braintree.si--color::before { color: #000000; } +.si-brandfolder::before { content: "\eb9d"; } +.si-brandfolder.si--color::before { color: #40D1F5; } +.si-brave::before { content: "\eb9e"; } +.si-brave.si--color::before { color: #FB542B; } +.si-breaker::before { content: "\eb9f"; } +.si-breaker.si--color::before { color: #003DAD; } +.si-brenntag::before { content: "\eba0"; } +.si-brenntag.si--color::before { color: #1A0033; } +.si-brevo::before { content: "\eba1"; } +.si-brevo.si--color::before { color: #0B996E; } +.si-brex::before { content: "\eba2"; } +.si-brex.si--color::before { color: #212121; } +.si-bricks::before { content: "\eba3"; } +.si-bricks.si--color::before { color: #FFD54D; } +.si-britishairways::before { content: "\eba4"; } +.si-britishairways.si--color::before { color: #2E5C99; } +.si-broadcom::before { content: "\eba5"; } +.si-broadcom.si--color::before { color: #E31837; } +.si-bruno::before { content: "\eba6"; } +.si-bruno.si--color::before { color: #F4AA41; } +.si-bsd::before { content: "\eba7"; } +.si-bsd.si--color::before { color: #AB2B28; } +.si-bspwm::before { content: "\eba8"; } +.si-bspwm.si--color::before { color: #2E2E2E; } +.si-bt::before { content: "\eba9"; } +.si-bt.si--color::before { color: #6400AA; } +.si-buddy::before { content: "\ebaa"; } +.si-buddy.si--color::before { color: #1A86FD; } +.si-budibase::before { content: "\ebab"; } +.si-budibase.si--color::before { color: #000000; } +.si-buefy::before { content: "\ebac"; } +.si-buefy.si--color::before { color: #7957D5; } +.si-buffer::before { content: "\ebad"; } +.si-buffer.si--color::before { color: #231F20; } +.si-bugatti::before { content: "\ebae"; } +.si-bugatti.si--color::before { color: #000000; } +.si-bugcrowd::before { content: "\ebaf"; } +.si-bugcrowd.si--color::before { color: #F26822; } +.si-bugsnag::before { content: "\ebb0"; } +.si-bugsnag.si--color::before { color: #4949E4; } +.si-buhl::before { content: "\ebb1"; } +.si-buhl.si--color::before { color: #023E84; } +.si-buildkite::before { content: "\ebb2"; } +.si-buildkite.si--color::before { color: #14CC80; } +.si-builtbybit::before { content: "\ebb3"; } +.si-builtbybit.si--color::before { color: #2D87C3; } +.si-bukalapak::before { content: "\ebb4"; } +.si-bukalapak.si--color::before { color: #E31E52; } +.si-bulma::before { content: "\ebb5"; } +.si-bulma.si--color::before { color: #00D1B2; } +.si-bun::before { content: "\ebb6"; } +.si-bun.si--color::before { color: #000000; } +.si-bungie::before { content: "\ebb7"; } +.si-bungie.si--color::before { color: #0075BB; } +.si-bunq::before { content: "\ebb8"; } +.si-bunq.si--color::before { color: #3394D7; } +.si-burgerking::before { content: "\ebb9"; } +.si-burgerking.si--color::before { color: #D62300; } +.si-burpsuite::before { content: "\ebba"; } +.si-burpsuite.si--color::before { color: #FF6633; } +.si-burton::before { content: "\ebbb"; } +.si-burton.si--color::before { color: #000000; } +.si-buymeacoffee::before { content: "\ebbc"; } +.si-buymeacoffee.si--color::before { color: #FFDD00; } +.si-buysellads::before { content: "\ebbd"; } +.si-buysellads.si--color::before { color: #EB4714; } +.si-buzzfeed::before { content: "\ebbe"; } +.si-buzzfeed.si--color::before { color: #EE3322; } +.si-bvg::before { content: "\ebbf"; } +.si-bvg.si--color::before { color: #F0D722; } +.si-byjus::before { content: "\ebc0"; } +.si-byjus.si--color::before { color: #813588; } +.si-bytedance::before { content: "\ebc1"; } +.si-bytedance.si--color::before { color: #3C8CFF; } +.si-c::before { content: "\ebc2"; } +.si-c.si--color::before { color: #A8B9CC; } +.si-cplusplus::before { content: "\ebc3"; } +.si-cplusplus.si--color::before { color: #00599C; } +.si-cplusplusbuilder::before { content: "\ebc4"; } +.si-cplusplusbuilder.si--color::before { color: #E62431; } +.si-cachet::before { content: "\ebc5"; } +.si-cachet.si--color::before { color: #7ED321; } +.si-caddy::before { content: "\ebc6"; } +.si-caddy.si--color::before { color: #1F88C0; } +.si-cadillac::before { content: "\ebc7"; } +.si-cadillac.si--color::before { color: #000000; } +.si-cafepress::before { content: "\ebc8"; } +.si-cafepress.si--color::before { color: #58A616; } +.si-cairographics::before { content: "\ebc9"; } +.si-cairographics.si--color::before { color: #F39914; } +.si-cairometro::before { content: "\ebca"; } +.si-cairometro.si--color::before { color: #C10C0C; } +.si-caixabank::before { content: "\ebcb"; } +.si-caixabank.si--color::before { color: #007EAE; } +.si-cakephp::before { content: "\ebcc"; } +.si-cakephp.si--color::before { color: #D33C43; } +.si-caldotcom::before { content: "\ebcd"; } +.si-caldotcom.si--color::before { color: #292929; } +.si-calendly::before { content: "\ebce"; } +.si-calendly.si--color::before { color: #006BFF; } +.si-calibreweb::before { content: "\ebcf"; } +.si-calibreweb.si--color::before { color: #45B29D; } +.si-campaignmonitor::before { content: "\ebd0"; } +.si-campaignmonitor.si--color::before { color: #111324; } +.si-camunda::before { content: "\ebd1"; } +.si-camunda.si--color::before { color: #FC5D0D; } +.si-canonical::before { content: "\ebd2"; } +.si-canonical.si--color::before { color: #E95420; } +.si-canva::before { content: "\ebd3"; } +.si-canva.si--color::before { color: #00C4CC; } +.si-canvas::before { content: "\ebd4"; } +.si-canvas.si--color::before { color: #E72429; } +.si-capacitor::before { content: "\ebd5"; } +.si-capacitor.si--color::before { color: #119EFF; } +.si-caprover::before { content: "\ebd6"; } +.si-caprover.si--color::before { color: #ED5B26; } +.si-carthrottle::before { content: "\ebd7"; } +.si-carthrottle.si--color::before { color: #FF9C42; } +.si-cardano::before { content: "\ebd8"; } +.si-cardano.si--color::before { color: #0133AD; } +.si-carlsberggroup::before { content: "\ebd9"; } +.si-carlsberggroup.si--color::before { color: #00321E; } +.si-carrd::before { content: "\ebda"; } +.si-carrd.si--color::before { color: #596CAF; } +.si-carrefour::before { content: "\ebdb"; } +.si-carrefour.si--color::before { color: #004E9F; } +.si-carto::before { content: "\ebdc"; } +.si-carto.si--color::before { color: #EB1510; } +.si-cashapp::before { content: "\ebdd"; } +.si-cashapp.si--color::before { color: #00C244; } +.si-castbox::before { content: "\ebde"; } +.si-castbox.si--color::before { color: #F55B23; } +.si-castorama::before { content: "\ebdf"; } +.si-castorama.si--color::before { color: #0078D7; } +.si-castro::before { content: "\ebe0"; } +.si-castro.si--color::before { color: #00B265; } +.si-caterpillar::before { content: "\ebe1"; } +.si-caterpillar.si--color::before { color: #FFCD11; } +.si-cbc::before { content: "\ebe2"; } +.si-cbc.si--color::before { color: #E60505; } +.si-cbs::before { content: "\ebe3"; } +.si-cbs.si--color::before { color: #033963; } +.si-ccc::before { content: "\ebe4"; } +.si-ccc.si--color::before { color: #000000; } +.si-ccleaner::before { content: "\ebe5"; } +.si-ccleaner.si--color::before { color: #CB2D29; } +.si-cdprojekt::before { content: "\ebe6"; } +.si-cdprojekt.si--color::before { color: #DC0D15; } +.si-ce::before { content: "\ebe7"; } +.si-ce.si--color::before { color: #000000; } +.si-celery::before { content: "\ebe8"; } +.si-celery.si--color::before { color: #37814A; } +.si-celestron::before { content: "\ebe9"; } +.si-celestron.si--color::before { color: #F47216; } +.si-centos::before { content: "\ebea"; } +.si-centos.si--color::before { color: #262577; } +.si-ceph::before { content: "\ebeb"; } +.si-ceph.si--color::before { color: #EF5C55; } +.si-cesium::before { content: "\ebec"; } +.si-cesium.si--color::before { color: #6CADDF; } +.si-chai::before { content: "\ebed"; } +.si-chai.si--color::before { color: #A30701; } +.si-chainguard::before { content: "\ebee"; } +.si-chainguard.si--color::before { color: #4445E7; } +.si-chainlink::before { content: "\ebef"; } +.si-chainlink.si--color::before { color: #375BD2; } +.si-chakraui::before { content: "\ebf0"; } +.si-chakraui.si--color::before { color: #319795; } +.si-channel4::before { content: "\ebf1"; } +.si-channel4.si--color::before { color: #AAFF89; } +.si-charles::before { content: "\ebf2"; } +.si-charles.si--color::before { color: #F3F5F5; } +.si-chartdotjs::before { content: "\ebf3"; } +.si-chartdotjs.si--color::before { color: #FF6384; } +.si-chartmogul::before { content: "\ebf4"; } +.si-chartmogul.si--color::before { color: #13324B; } +.si-chase::before { content: "\ebf5"; } +.si-chase.si--color::before { color: #117ACA; } +.si-chatbot::before { content: "\ebf6"; } +.si-chatbot.si--color::before { color: #0066FF; } +.si-chatwoot::before { content: "\ebf7"; } +.si-chatwoot.si--color::before { color: #1F93FF; } +.si-checkio::before { content: "\ebf8"; } +.si-checkio.si--color::before { color: #008DB6; } +.si-checkmarx::before { content: "\ebf9"; } +.si-checkmarx.si--color::before { color: #54B848; } +.si-checkmk::before { content: "\ebfa"; } +.si-checkmk.si--color::before { color: #15D1A0; } +.si-chedraui::before { content: "\ebfb"; } +.si-chedraui.si--color::before { color: #E0832F; } +.si-cheerio::before { content: "\ebfc"; } +.si-cheerio.si--color::before { color: #E88C1F; } +.si-chef::before { content: "\ebfd"; } +.si-chef.si--color::before { color: #F09820; } +.si-chemex::before { content: "\ebfe"; } +.si-chemex.si--color::before { color: #4D2B1A; } +.si-chessdotcom::before { content: "\ebff"; } +.si-chessdotcom.si--color::before { color: #81B64C; } +.si-chevrolet::before { content: "\ec00"; } +.si-chevrolet.si--color::before { color: #CD9834; } +.si-chianetwork::before { content: "\ec01"; } +.si-chianetwork.si--color::before { color: #5ECE71; } +.si-chinaeasternairlines::before { content: "\ec02"; } +.si-chinaeasternairlines.si--color::before { color: #1A2477; } +.si-chinasouthernairlines::before { content: "\ec03"; } +.si-chinasouthernairlines.si--color::before { color: #008BCB; } +.si-chocolatey::before { content: "\ec04"; } +.si-chocolatey.si--color::before { color: #80B5E3; } +.si-chromatic::before { content: "\ec05"; } +.si-chromatic.si--color::before { color: #FC521F; } +.si-chromewebstore::before { content: "\ec06"; } +.si-chromewebstore.si--color::before { color: #4285F4; } +.si-chromecast::before { content: "\ec07"; } +.si-chromecast.si--color::before { color: #999999; } +.si-chrysler::before { content: "\ec08"; } +.si-chrysler.si--color::before { color: #000000; } +.si-chupachups::before { content: "\ec09"; } +.si-chupachups.si--color::before { color: #CF103E; } +.si-cilium::before { content: "\ec0a"; } +.si-cilium.si--color::before { color: #F8C517; } +.si-cinema4d::before { content: "\ec0b"; } +.si-cinema4d.si--color::before { color: #011A6A; } +.si-cinnamon::before { content: "\ec0c"; } +.si-cinnamon.si--color::before { color: #DC682E; } +.si-circle::before { content: "\ec0d"; } +.si-circle.si--color::before { color: #8669AE; } +.si-circleci::before { content: "\ec0e"; } +.si-circleci.si--color::before { color: #343434; } +.si-circuitverse::before { content: "\ec0f"; } +.si-circuitverse.si--color::before { color: #42B883; } +.si-cirrusci::before { content: "\ec10"; } +.si-cirrusci.si--color::before { color: #4051B5; } +.si-cisco::before { content: "\ec11"; } +.si-cisco.si--color::before { color: #1BA0D7; } +.si-citrix::before { content: "\ec12"; } +.si-citrix.si--color::before { color: #452170; } +.si-citroen::before { content: "\ec13"; } +.si-citroen.si--color::before { color: #DA291C; } +.si-civicrm::before { content: "\ec14"; } +.si-civicrm.si--color::before { color: #81C459; } +.si-civo::before { content: "\ec15"; } +.si-civo.si--color::before { color: #239DFF; } +.si-clarifai::before { content: "\ec16"; } +.si-clarifai.si--color::before { color: #1955FF; } +.si-claris::before { content: "\ec17"; } +.si-claris.si--color::before { color: #000000; } +.si-clarivate::before { content: "\ec18"; } +.si-clarivate.si--color::before { color: #93FF9E; } +.si-claude::before { content: "\ec19"; } +.si-claude.si--color::before { color: #D97757; } +.si-clerk::before { content: "\ec1a"; } +.si-clerk.si--color::before { color: #6C47FF; } +.si-clevercloud::before { content: "\ec1b"; } +.si-clevercloud.si--color::before { color: #171C36; } +.si-clickhouse::before { content: "\ec1c"; } +.si-clickhouse.si--color::before { color: #FFCC01; } +.si-clickup::before { content: "\ec1d"; } +.si-clickup.si--color::before { color: #7B68EE; } +.si-clion::before { content: "\ec1e"; } +.si-clion.si--color::before { color: #000000; } +.si-clockify::before { content: "\ec1f"; } +.si-clockify.si--color::before { color: #03A9F4; } +.si-clojure::before { content: "\ec20"; } +.si-clojure.si--color::before { color: #5881D8; } +.si-cloud66::before { content: "\ec21"; } +.si-cloud66.si--color::before { color: #3C72B9; } +.si-cloudfoundry::before { content: "\ec22"; } +.si-cloudfoundry.si--color::before { color: #0C9ED5; } +.si-cloudbees::before { content: "\ec23"; } +.si-cloudbees.si--color::before { color: #1997B5; } +.si-cloudcannon::before { content: "\ec24"; } +.si-cloudcannon.si--color::before { color: #407AFC; } +.si-cloudera::before { content: "\ec25"; } +.si-cloudera.si--color::before { color: #F96702; } +.si-cloudflare::before { content: "\ec26"; } +.si-cloudflare.si--color::before { color: #F38020; } +.si-cloudflarepages::before { content: "\ec27"; } +.si-cloudflarepages.si--color::before { color: #F38020; } +.si-cloudflareworkers::before { content: "\ec28"; } +.si-cloudflareworkers.si--color::before { color: #F38020; } +.si-cloudinary::before { content: "\ec29"; } +.si-cloudinary.si--color::before { color: #3448C5; } +.si-cloudron::before { content: "\ec2a"; } +.si-cloudron.si--color::before { color: #03A9F4; } +.si-cloudsmith::before { content: "\ec2b"; } +.si-cloudsmith.si--color::before { color: #2A6FE1; } +.si-cloudways::before { content: "\ec2c"; } +.si-cloudways.si--color::before { color: #2C39BD; } +.si-clubforce::before { content: "\ec2d"; } +.si-clubforce.si--color::before { color: #191176; } +.si-clubhouse::before { content: "\ec2e"; } +.si-clubhouse.si--color::before { color: #FFE450; } +.si-clyp::before { content: "\ec2f"; } +.si-clyp.si--color::before { color: #3CBDB1; } +.si-cmake::before { content: "\ec30"; } +.si-cmake.si--color::before { color: #064F8C; } +.si-cncf::before { content: "\ec31"; } +.si-cncf.si--color::before { color: #231F20; } +.si-cnet::before { content: "\ec32"; } +.si-cnet.si--color::before { color: #E71D1D; } +.si-cnn::before { content: "\ec33"; } +.si-cnn.si--color::before { color: #CC0000; } +.si-coop::before { content: "\ec34"; } +.si-coop.si--color::before { color: #00B1E7; } +.si-cocacola::before { content: "\ec35"; } +.si-cocacola.si--color::before { color: #D00013; } +.si-cockpit::before { content: "\ec36"; } +.si-cockpit.si--color::before { color: #0066CC; } +.si-cockroachlabs::before { content: "\ec37"; } +.si-cockroachlabs.si--color::before { color: #6933FF; } +.si-cocoapods::before { content: "\ec38"; } +.si-cocoapods.si--color::before { color: #EE3322; } +.si-cocos::before { content: "\ec39"; } +.si-cocos.si--color::before { color: #55C2E1; } +.si-coda::before { content: "\ec3a"; } +.si-coda.si--color::before { color: #F46A54; } +.si-codacy::before { content: "\ec3b"; } +.si-codacy.si--color::before { color: #222F29; } +.si-codeclimate::before { content: "\ec3c"; } +.si-codeclimate.si--color::before { color: #000000; } +.si-codeblocks::before { content: "\ec3d"; } +.si-codeblocks.si--color::before { color: #41AD48; } +.si-codeberg::before { content: "\ec3e"; } +.si-codeberg.si--color::before { color: #2185D0; } +.si-codecademy::before { content: "\ec3f"; } +.si-codecademy.si--color::before { color: #1F4056; } +.si-codeceptjs::before { content: "\ec40"; } +.si-codeceptjs.si--color::before { color: #F6E05E; } +.si-codechef::before { content: "\ec41"; } +.si-codechef.si--color::before { color: #5B4638; } +.si-codecov::before { content: "\ec42"; } +.si-codecov.si--color::before { color: #F01F7A; } +.si-codecrafters::before { content: "\ec43"; } +.si-codecrafters.si--color::before { color: #171920; } +.si-codefactor::before { content: "\ec44"; } +.si-codefactor.si--color::before { color: #F44A6A; } +.si-codeforces::before { content: "\ec45"; } +.si-codeforces.si--color::before { color: #1F8ACB; } +.si-codefresh::before { content: "\ec46"; } +.si-codefresh.si--color::before { color: #08B1AB; } +.si-codeigniter::before { content: "\ec47"; } +.si-codeigniter.si--color::before { color: #EF4223; } +.si-codeium::before { content: "\ec48"; } +.si-codeium.si--color::before { color: #09B6A2; } +.si-codemagic::before { content: "\ec49"; } +.si-codemagic.si--color::before { color: #F45E3F; } +.si-codementor::before { content: "\ec4a"; } +.si-codementor.si--color::before { color: #003648; } +.si-codemirror::before { content: "\ec4b"; } +.si-codemirror.si--color::before { color: #D30707; } +.si-codenewbie::before { content: "\ec4c"; } +.si-codenewbie.si--color::before { color: #9013FE; } +.si-codepen::before { content: "\ec4d"; } +.si-codepen.si--color::before { color: #000000; } +.si-codeproject::before { content: "\ec4e"; } +.si-codeproject.si--color::before { color: #FF9900; } +.si-coder::before { content: "\ec4f"; } +.si-coder.si--color::before { color: #000000; } +.si-codersrank::before { content: "\ec50"; } +.si-codersrank.si--color::before { color: #67A4AC; } +.si-coderwall::before { content: "\ec51"; } +.si-coderwall.si--color::before { color: #3E8DCC; } +.si-codesandbox::before { content: "\ec52"; } +.si-codesandbox.si--color::before { color: #151515; } +.si-codeship::before { content: "\ec53"; } +.si-codeship.si--color::before { color: #004466; } +.si-codesignal::before { content: "\ec54"; } +.si-codesignal.si--color::before { color: #1062FB; } +.si-codestream::before { content: "\ec55"; } +.si-codestream.si--color::before { color: #008C99; } +.si-codewars::before { content: "\ec56"; } +.si-codewars.si--color::before { color: #B1361E; } +.si-codingninjas::before { content: "\ec57"; } +.si-codingninjas.si--color::before { color: #DD6620; } +.si-codingame::before { content: "\ec58"; } +.si-codingame.si--color::before { color: #F2BB13; } +.si-codio::before { content: "\ec59"; } +.si-codio.si--color::before { color: #4574E0; } +.si-coffeescript::before { content: "\ec5a"; } +.si-coffeescript.si--color::before { color: #2F2625; } +.si-coggle::before { content: "\ec5b"; } +.si-coggle.si--color::before { color: #9ED56B; } +.si-cognizant::before { content: "\ec5c"; } +.si-cognizant.si--color::before { color: #1A4CA1; } +.si-cohost::before { content: "\ec5d"; } +.si-cohost.si--color::before { color: #83254F; } +.si-coinbase::before { content: "\ec5e"; } +.si-coinbase.si--color::before { color: #0052FF; } +.si-coinmarketcap::before { content: "\ec5f"; } +.si-coinmarketcap.si--color::before { color: #17181B; } +.si-collaboraonline::before { content: "\ec60"; } +.si-collaboraonline.si--color::before { color: #5C2983; } +.si-comicfury::before { content: "\ec61"; } +.si-comicfury.si--color::before { color: #79BD42; } +.si-comma::before { content: "\ec62"; } +.si-comma.si--color::before { color: #51FF00; } +.si-commerzbank::before { content: "\ec63"; } +.si-commerzbank.si--color::before { color: #FFCC33; } +.si-commitlint::before { content: "\ec64"; } +.si-commitlint.si--color::before { color: #000000; } +.si-commodore::before { content: "\ec65"; } +.si-commodore.si--color::before { color: #1E2A4E; } +.si-commonlisp::before { content: "\ec66"; } +.si-commonlisp.si--color::before { color: #000000; } +.si-commonworkflowlanguage::before { content: "\ec67"; } +.si-commonworkflowlanguage.si--color::before { color: #B5314C; } +.si-compilerexplorer::before { content: "\ec68"; } +.si-compilerexplorer.si--color::before { color: #67C52A; } +.si-composer::before { content: "\ec69"; } +.si-composer.si--color::before { color: #885630; } +.si-comptia::before { content: "\ec6a"; } +.si-comptia.si--color::before { color: #C8202F; } +.si-comsol::before { content: "\ec6b"; } +.si-comsol.si--color::before { color: #368CCB; } +.si-conan::before { content: "\ec6c"; } +.si-conan.si--color::before { color: #6699CB; } +.si-concourse::before { content: "\ec6d"; } +.si-concourse.si--color::before { color: #3398DC; } +.si-condaforge::before { content: "\ec6e"; } +.si-condaforge.si--color::before { color: #000000; } +.si-conekta::before { content: "\ec6f"; } +.si-conekta.si--color::before { color: #0A1837; } +.si-confluence::before { content: "\ec70"; } +.si-confluence.si--color::before { color: #172B4D; } +.si-construct3::before { content: "\ec71"; } +.si-construct3.si--color::before { color: #00FFDA; } +.si-consul::before { content: "\ec72"; } +.si-consul.si--color::before { color: #F24C53; } +.si-contabo::before { content: "\ec73"; } +.si-contabo.si--color::before { color: #00AAEB; } +.si-contactlesspayment::before { content: "\ec74"; } +.si-contactlesspayment.si--color::before { color: #000000; } +.si-containerd::before { content: "\ec75"; } +.si-containerd.si--color::before { color: #575757; } +.si-contao::before { content: "\ec76"; } +.si-contao.si--color::before { color: #F47C00; } +.si-contentful::before { content: "\ec77"; } +.si-contentful.si--color::before { color: #2478CC; } +.si-contentstack::before { content: "\ec78"; } +.si-contentstack.si--color::before { color: #E74C3D; } +.si-continente::before { content: "\ec79"; } +.si-continente.si--color::before { color: #E31E24; } +.si-contributorcovenant::before { content: "\ec7a"; } +.si-contributorcovenant.si--color::before { color: #5E0D73; } +.si-conventionalcommits::before { content: "\ec7b"; } +.si-conventionalcommits.si--color::before { color: #FE5196; } +.si-convertio::before { content: "\ec7c"; } +.si-convertio.si--color::before { color: #FF3333; } +.si-cookiecutter::before { content: "\ec7d"; } +.si-cookiecutter.si--color::before { color: #D4AA00; } +.si-coolermaster::before { content: "\ec7e"; } +.si-coolermaster.si--color::before { color: #1E1E28; } +.si-copaairlines::before { content: "\ec7f"; } +.si-copaairlines.si--color::before { color: #0032A0; } +.si-coppel::before { content: "\ec80"; } +.si-coppel.si--color::before { color: #0266AE; } +.si-cora::before { content: "\ec81"; } +.si-cora.si--color::before { color: #E61845; } +.si-coreldraw::before { content: "\ec82"; } +.si-coreldraw.si--color::before { color: #000000; } +.si-coronaengine::before { content: "\ec83"; } +.si-coronaengine.si--color::before { color: #F96F29; } +.si-coronarenderer::before { content: "\ec84"; } +.si-coronarenderer.si--color::before { color: #E6502A; } +.si-corsair::before { content: "\ec85"; } +.si-corsair.si--color::before { color: #000000; } +.si-couchbase::before { content: "\ec86"; } +.si-couchbase.si--color::before { color: #EA2328; } +.si-counterstrike::before { content: "\ec87"; } +.si-counterstrike.si--color::before { color: #000000; } +.si-countingworkspro::before { content: "\ec88"; } +.si-countingworkspro.si--color::before { color: #2E3084; } +.si-coursera::before { content: "\ec89"; } +.si-coursera.si--color::before { color: #0056D2; } +.si-coveralls::before { content: "\ec8a"; } +.si-coveralls.si--color::before { color: #3F5767; } +.si-coze::before { content: "\ec8b"; } +.si-coze.si--color::before { color: #4D53E8; } +.si-cpanel::before { content: "\ec8c"; } +.si-cpanel.si--color::before { color: #FF6C2C; } +.si-craftcms::before { content: "\ec8d"; } +.si-craftcms.si--color::before { color: #E5422B; } +.si-craftsman::before { content: "\ec8e"; } +.si-craftsman.si--color::before { color: #D6001C; } +.si-cratedb::before { content: "\ec8f"; } +.si-cratedb.si--color::before { color: #009DC7; } +.si-crayon::before { content: "\ec90"; } +.si-crayon.si--color::before { color: #FF6A4C; } +.si-creality::before { content: "\ec91"; } +.si-creality.si--color::before { color: #000000; } +.si-createreactapp::before { content: "\ec92"; } +.si-createreactapp.si--color::before { color: #09D3AC; } +.si-creativecommons::before { content: "\ec93"; } +.si-creativecommons.si--color::before { color: #ED592F; } +.si-creativetechnology::before { content: "\ec94"; } +.si-creativetechnology.si--color::before { color: #000000; } +.si-credly::before { content: "\ec95"; } +.si-credly.si--color::before { color: #FF6B00; } +.si-crehana::before { content: "\ec96"; } +.si-crehana.si--color::before { color: #4B22F4; } +.si-crewunited::before { content: "\ec97"; } +.si-crewunited.si--color::before { color: #000000; } +.si-criticalrole::before { content: "\ec98"; } +.si-criticalrole.si--color::before { color: #000000; } +.si-crowdin::before { content: "\ec99"; } +.si-crowdin.si--color::before { color: #2E3340; } +.si-crowdsource::before { content: "\ec9a"; } +.si-crowdsource.si--color::before { color: #4285F4; } +.si-crunchbase::before { content: "\ec9b"; } +.si-crunchbase.si--color::before { color: #0288D1; } +.si-crunchyroll::before { content: "\ec9c"; } +.si-crunchyroll.si--color::before { color: #F47521; } +.si-cryengine::before { content: "\ec9d"; } +.si-cryengine.si--color::before { color: #000000; } +.si-cryptomator::before { content: "\ec9e"; } +.si-cryptomator.si--color::before { color: #49B04A; } +.si-cryptpad::before { content: "\ec9f"; } +.si-cryptpad.si--color::before { color: #0087FF; } +.si-crystal::before { content: "\eca0"; } +.si-crystal.si--color::before { color: #000000; } +.si-csdn::before { content: "\eca1"; } +.si-csdn.si--color::before { color: #FC5531; } +.si-css::before { content: "\eca2"; } +.si-css.si--color::before { color: #663399; } +.si-cssdesignawards::before { content: "\eca3"; } +.si-cssdesignawards.si--color::before { color: #280FEE; } +.si-cssmodules::before { content: "\eca4"; } +.si-cssmodules.si--color::before { color: #000000; } +.si-csswizardry::before { content: "\eca5"; } +.si-csswizardry.si--color::before { color: #F43059; } +.si-css3::before { content: "\eca6"; } +.si-css3.si--color::before { color: #1572B6; } +.si-cts::before { content: "\eca7"; } +.si-cts.si--color::before { color: #E53236; } +.si-cucumber::before { content: "\eca8"; } +.si-cucumber.si--color::before { color: #23D96C; } +.si-cultura::before { content: "\eca9"; } +.si-cultura.si--color::before { color: #1D2C54; } +.si-curl::before { content: "\ecaa"; } +.si-curl.si--color::before { color: #073551; } +.si-curseforge::before { content: "\ecab"; } +.si-curseforge.si--color::before { color: #F16436; } +.si-customink::before { content: "\ecac"; } +.si-customink.si--color::before { color: #4051B5; } +.si-cyberdefenders::before { content: "\ecad"; } +.si-cyberdefenders.si--color::before { color: #335EEA; } +.si-cycling74::before { content: "\ecae"; } +.si-cycling74.si--color::before { color: #111111; } +.si-cypress::before { content: "\ecaf"; } +.si-cypress.si--color::before { color: #69D3A7; } +.si-cytoscapedotjs::before { content: "\ecb0"; } +.si-cytoscapedotjs.si--color::before { color: #F7DF1E; } +.si-d::before { content: "\ecb1"; } +.si-d.si--color::before { color: #B03931; } +.si-dedge::before { content: "\ecb2"; } +.si-dedge.si--color::before { color: #432975; } +.si-dwavesystems::before { content: "\ecb3"; } +.si-dwavesystems.si--color::before { color: #008CD7; } +.si-d3::before { content: "\ecb4"; } +.si-d3.si--color::before { color: #F9A03C; } +.si-dacia::before { content: "\ecb5"; } +.si-dacia.si--color::before { color: #646B52; } +.si-daf::before { content: "\ecb6"; } +.si-daf.si--color::before { color: #00529B; } +.si-dailydotdev::before { content: "\ecb7"; } +.si-dailydotdev.si--color::before { color: #CE3DF3; } +.si-dailymotion::before { content: "\ecb8"; } +.si-dailymotion.si--color::before { color: #0A0A0A; } +.si-daisyui::before { content: "\ecb9"; } +.si-daisyui.si--color::before { color: #1AD1A5; } +.si-dapr::before { content: "\ecba"; } +.si-dapr.si--color::before { color: #0D2192; } +.si-darkreader::before { content: "\ecbb"; } +.si-darkreader.si--color::before { color: #141E24; } +.si-dart::before { content: "\ecbc"; } +.si-dart.si--color::before { color: #0175C2; } +.si-darty::before { content: "\ecbd"; } +.si-darty.si--color::before { color: #EB1B23; } +.si-daserste::before { content: "\ecbe"; } +.si-daserste.si--color::before { color: #001A4B; } +.si-dash::before { content: "\ecbf"; } +.si-dash.si--color::before { color: #008DE4; } +.si-dashlane::before { content: "\ecc0"; } +.si-dashlane.si--color::before { color: #0E353D; } +.si-dask::before { content: "\ecc1"; } +.si-dask.si--color::before { color: #FC6E6B; } +.si-dassaultsystemes::before { content: "\ecc2"; } +.si-dassaultsystemes.si--color::before { color: #005386; } +.si-datadotai::before { content: "\ecc3"; } +.si-datadotai.si--color::before { color: #000000; } +.si-databricks::before { content: "\ecc4"; } +.si-databricks.si--color::before { color: #FF3621; } +.si-datacamp::before { content: "\ecc5"; } +.si-datacamp.si--color::before { color: #03EF62; } +.si-datadog::before { content: "\ecc6"; } +.si-datadog.si--color::before { color: #632CA6; } +.si-datagrip::before { content: "\ecc7"; } +.si-datagrip.si--color::before { color: #000000; } +.si-dataiku::before { content: "\ecc8"; } +.si-dataiku.si--color::before { color: #2AB1AC; } +.si-datastax::before { content: "\ecc9"; } +.si-datastax.si--color::before { color: #000000; } +.si-datefns::before { content: "\ecca"; } +.si-datefns.si--color::before { color: #770C56; } +.si-datev::before { content: "\eccb"; } +.si-datev.si--color::before { color: #9BD547; } +.si-datocms::before { content: "\eccc"; } +.si-datocms.si--color::before { color: #FF7751; } +.si-datto::before { content: "\eccd"; } +.si-datto.si--color::before { color: #199ED9; } +.si-davinciresolve::before { content: "\ecce"; } +.si-davinciresolve.si--color::before { color: #233A51; } +.si-dazhongdianping::before { content: "\eccf"; } +.si-dazhongdianping.si--color::before { color: #FF6633; } +.si-dazn::before { content: "\ecd0"; } +.si-dazn.si--color::before { color: #F8F8F5; } +.si-dbeaver::before { content: "\ecd1"; } +.si-dbeaver.si--color::before { color: #382923; } +.si-dblp::before { content: "\ecd2"; } +.si-dblp.si--color::before { color: #004F9F; } +.si-dbt::before { content: "\ecd3"; } +.si-dbt.si--color::before { color: #FF694B; } +.si-dcentertainment::before { content: "\ecd4"; } +.si-dcentertainment.si--color::before { color: #0078F0; } +.si-delonghi::before { content: "\ecd5"; } +.si-delonghi.si--color::before { color: #072240; } +.si-debian::before { content: "\ecd6"; } +.si-debian.si--color::before { color: #A81D33; } +.si-debridlink::before { content: "\ecd7"; } +.si-debridlink.si--color::before { color: #264E70; } +.si-decapcms::before { content: "\ecd8"; } +.si-decapcms.si--color::before { color: #FF0082; } +.si-decentraland::before { content: "\ecd9"; } +.si-decentraland.si--color::before { color: #FF2D55; } +.si-deepcool::before { content: "\ecda"; } +.si-deepcool.si--color::before { color: #068584; } +.si-deepgram::before { content: "\ecdb"; } +.si-deepgram.si--color::before { color: #13EF93; } +.si-deepin::before { content: "\ecdc"; } +.si-deepin.si--color::before { color: #007CFF; } +.si-deepl::before { content: "\ecdd"; } +.si-deepl.si--color::before { color: #0F2B46; } +.si-deepnote::before { content: "\ecde"; } +.si-deepnote.si--color::before { color: #3793EF; } +.si-deliveroo::before { content: "\ecdf"; } +.si-deliveroo.si--color::before { color: #00CCBC; } +.si-dell::before { content: "\ece0"; } +.si-dell.si--color::before { color: #007DB8; } +.si-delphi::before { content: "\ece1"; } +.si-delphi.si--color::before { color: #E62431; } +.si-delta::before { content: "\ece2"; } +.si-delta.si--color::before { color: #003366; } +.si-deluge::before { content: "\ece3"; } +.si-deluge.si--color::before { color: #094491; } +.si-deno::before { content: "\ece4"; } +.si-deno.si--color::before { color: #70FFAF; } +.si-denon::before { content: "\ece5"; } +.si-denon.si--color::before { color: #0B131A; } +.si-dependabot::before { content: "\ece6"; } +.si-dependabot.si--color::before { color: #025E8C; } +.si-depositphotos::before { content: "\ece7"; } +.si-depositphotos.si--color::before { color: #000000; } +.si-derspiegel::before { content: "\ece8"; } +.si-derspiegel.si--color::before { color: #E64415; } +.si-deutschebahn::before { content: "\ece9"; } +.si-deutschebahn.si--color::before { color: #F01414; } +.si-deutschebank::before { content: "\ecea"; } +.si-deutschebank.si--color::before { color: #0018A8; } +.si-deutschepost::before { content: "\eceb"; } +.si-deutschepost.si--color::before { color: #FFCC00; } +.si-deutschetelekom::before { content: "\ecec"; } +.si-deutschetelekom.si--color::before { color: #E20074; } +.si-deutschewelle::before { content: "\eced"; } +.si-deutschewelle.si--color::before { color: #05B2FC; } +.si-devdotto::before { content: "\ecee"; } +.si-devdotto.si--color::before { color: #0A0A0A; } +.si-devexpress::before { content: "\ecef"; } +.si-devexpress.si--color::before { color: #FF7200; } +.si-deviantart::before { content: "\ecf0"; } +.si-deviantart.si--color::before { color: #05CC47; } +.si-devpost::before { content: "\ecf1"; } +.si-devpost.si--color::before { color: #003E54; } +.si-devrant::before { content: "\ecf2"; } +.si-devrant.si--color::before { color: #F99A66; } +.si-dgraph::before { content: "\ecf3"; } +.si-dgraph.si--color::before { color: #E50695; } +.si-dhl::before { content: "\ecf4"; } +.si-dhl.si--color::before { color: #FFCC00; } +.si-diagramsdotnet::before { content: "\ecf5"; } +.si-diagramsdotnet.si--color::before { color: #F08705; } +.si-dialogflow::before { content: "\ecf6"; } +.si-dialogflow.si--color::before { color: #FF9800; } +.si-diaspora::before { content: "\ecf7"; } +.si-diaspora.si--color::before { color: #000000; } +.si-dictionarydotcom::before { content: "\ecf8"; } +.si-dictionarydotcom.si--color::before { color: #0049D7; } +.si-digg::before { content: "\ecf9"; } +.si-digg.si--color::before { color: #000000; } +.si-digikeyelectronics::before { content: "\ecfa"; } +.si-digikeyelectronics.si--color::before { color: #CC0000; } +.si-digitalocean::before { content: "\ecfb"; } +.si-digitalocean.si--color::before { color: #0080FF; } +.si-dinersclub::before { content: "\ecfc"; } +.si-dinersclub.si--color::before { color: #004C97; } +.si-dior::before { content: "\ecfd"; } +.si-dior.si--color::before { color: #000000; } +.si-directus::before { content: "\ecfe"; } +.si-directus.si--color::before { color: #263238; } +.si-discogs::before { content: "\ecff"; } +.si-discogs.si--color::before { color: #333333; } +.si-discord::before { content: "\ed00"; } +.si-discord.si--color::before { color: #5865F2; } +.si-discourse::before { content: "\ed01"; } +.si-discourse.si--color::before { color: #000000; } +.si-discover::before { content: "\ed02"; } +.si-discover.si--color::before { color: #FF6000; } +.si-disqus::before { content: "\ed03"; } +.si-disqus.si--color::before { color: #2E9FFF; } +.si-disroot::before { content: "\ed04"; } +.si-disroot.si--color::before { color: #50162D; } +.si-distrokid::before { content: "\ed05"; } +.si-distrokid.si--color::before { color: #231F20; } +.si-django::before { content: "\ed06"; } +.si-django.si--color::before { color: #092E20; } +.si-dji::before { content: "\ed07"; } +.si-dji.si--color::before { color: #000000; } +.si-dlib::before { content: "\ed08"; } +.si-dlib.si--color::before { color: #008000; } +.si-dlna::before { content: "\ed09"; } +.si-dlna.si--color::before { color: #48A842; } +.si-dm::before { content: "\ed0a"; } +.si-dm.si--color::before { color: #002878; } +.si-docker::before { content: "\ed0b"; } +.si-docker.si--color::before { color: #2496ED; } +.si-docsdotrs::before { content: "\ed0c"; } +.si-docsdotrs.si--color::before { color: #000000; } +.si-docsify::before { content: "\ed0d"; } +.si-docsify.si--color::before { color: #2ECE53; } +.si-doctrine::before { content: "\ed0e"; } +.si-doctrine.si--color::before { color: #FC6A31; } +.si-docusaurus::before { content: "\ed0f"; } +.si-docusaurus.si--color::before { color: #3ECC5F; } +.si-dogecoin::before { content: "\ed10"; } +.si-dogecoin.si--color::before { color: #C2A633; } +.si-doi::before { content: "\ed11"; } +.si-doi.si--color::before { color: #FAB70C; } +.si-dolby::before { content: "\ed12"; } +.si-dolby.si--color::before { color: #000000; } +.si-doordash::before { content: "\ed13"; } +.si-doordash.si--color::before { color: #FF3008; } +.si-dota2::before { content: "\ed14"; } +.si-dota2.si--color::before { color: #BF2E1A; } +.si-douban::before { content: "\ed15"; } +.si-douban.si--color::before { color: #2D963D; } +.si-doubanread::before { content: "\ed16"; } +.si-doubanread.si--color::before { color: #389EAC; } +.si-dovecot::before { content: "\ed17"; } +.si-dovecot.si--color::before { color: #54BCAB; } +.si-dovetail::before { content: "\ed18"; } +.si-dovetail.si--color::before { color: #190041; } +.si-downdetector::before { content: "\ed19"; } +.si-downdetector.si--color::before { color: #FF160A; } +.si-doxygen::before { content: "\ed1a"; } +.si-doxygen.si--color::before { color: #2C4AA8; } +.si-dpd::before { content: "\ed1b"; } +.si-dpd.si--color::before { color: #DC0032; } +.si-dragonframe::before { content: "\ed1c"; } +.si-dragonframe.si--color::before { color: #D4911E; } +.si-draugiemdotlv::before { content: "\ed1d"; } +.si-draugiemdotlv.si--color::before { color: #FF6600; } +.si-dreamstime::before { content: "\ed1e"; } +.si-dreamstime.si--color::before { color: #50A901; } +.si-dribbble::before { content: "\ed1f"; } +.si-dribbble.si--color::before { color: #EA4C89; } +.si-drizzle::before { content: "\ed20"; } +.si-drizzle.si--color::before { color: #C5F74F; } +.si-drone::before { content: "\ed21"; } +.si-drone.si--color::before { color: #212121; } +.si-drooble::before { content: "\ed22"; } +.si-drooble.si--color::before { color: #19C4BE; } +.si-dropbox::before { content: "\ed23"; } +.si-dropbox.si--color::before { color: #0061FF; } +.si-drupal::before { content: "\ed24"; } +.si-drupal.si--color::before { color: #0678BE; } +.si-dsautomobiles::before { content: "\ed25"; } +.si-dsautomobiles.si--color::before { color: #1D1717; } +.si-dts::before { content: "\ed26"; } +.si-dts.si--color::before { color: #F98B2B; } +.si-dtube::before { content: "\ed27"; } +.si-dtube.si--color::before { color: #F01A30; } +.si-ducati::before { content: "\ed28"; } +.si-ducati.si--color::before { color: #CC0000; } +.si-duckdb::before { content: "\ed29"; } +.si-duckdb.si--color::before { color: #FFF000; } +.si-duckduckgo::before { content: "\ed2a"; } +.si-duckduckgo.si--color::before { color: #DE5833; } +.si-dungeonsanddragons::before { content: "\ed2b"; } +.si-dungeonsanddragons.si--color::before { color: #ED1C24; } +.si-dunked::before { content: "\ed2c"; } +.si-dunked.si--color::before { color: #2DA9D7; } +.si-dunzo::before { content: "\ed2d"; } +.si-dunzo.si--color::before { color: #00D290; } +.si-duolingo::before { content: "\ed2e"; } +.si-duolingo.si--color::before { color: #58CC02; } +.si-duplicati::before { content: "\ed2f"; } +.si-duplicati.si--color::before { color: #1E3A8A; } +.si-dvc::before { content: "\ed30"; } +.si-dvc.si--color::before { color: #13ADC7; } +.si-dwm::before { content: "\ed31"; } +.si-dwm.si--color::before { color: #1177AA; } +.si-dynatrace::before { content: "\ed32"; } +.si-dynatrace.si--color::before { color: #1496FF; } +.si-edotleclerc::before { content: "\ed33"; } +.si-edotleclerc.si--color::before { color: #0066CC; } +.si-e3::before { content: "\ed34"; } +.si-e3.si--color::before { color: #E73D2F; } +.si-ea::before { content: "\ed35"; } +.si-ea.si--color::before { color: #000000; } +.si-eac::before { content: "\ed36"; } +.si-eac.si--color::before { color: #000000; } +.si-eagle::before { content: "\ed37"; } +.si-eagle.si--color::before { color: #0072EF; } +.si-easyeda::before { content: "\ed38"; } +.si-easyeda.si--color::before { color: #1765F6; } +.si-easyjet::before { content: "\ed39"; } +.si-easyjet.si--color::before { color: #FF6600; } +.si-ebay::before { content: "\ed3a"; } +.si-ebay.si--color::before { color: #E53238; } +.si-ebox::before { content: "\ed3b"; } +.si-ebox.si--color::before { color: #BE2323; } +.si-eclipseadoptium::before { content: "\ed3c"; } +.si-eclipseadoptium.si--color::before { color: #FF1464; } +.si-eclipseche::before { content: "\ed3d"; } +.si-eclipseche.si--color::before { color: #525C86; } +.si-eclipseide::before { content: "\ed3e"; } +.si-eclipseide.si--color::before { color: #2C2255; } +.si-eclipsejetty::before { content: "\ed3f"; } +.si-eclipsejetty.si--color::before { color: #FC390E; } +.si-eclipsemosquitto::before { content: "\ed40"; } +.si-eclipsemosquitto.si--color::before { color: #3C5280; } +.si-eclipsevertdotx::before { content: "\ed41"; } +.si-eclipsevertdotx.si--color::before { color: #782A90; } +.si-ecosia::before { content: "\ed42"; } +.si-ecosia.si--color::before { color: #008009; } +.si-ecovacs::before { content: "\ed43"; } +.si-ecovacs.si--color::before { color: #1E384B; } +.si-edeka::before { content: "\ed44"; } +.si-edeka.si--color::before { color: #1B66B3; } +.si-edgeimpulse::before { content: "\ed45"; } +.si-edgeimpulse.si--color::before { color: #3B47C2; } +.si-editorconfig::before { content: "\ed46"; } +.si-editorconfig.si--color::before { color: #FEFEFE; } +.si-educative::before { content: "\ed47"; } +.si-educative.si--color::before { color: #4951F5; } +.si-edx::before { content: "\ed48"; } +.si-edx.si--color::before { color: #02262B; } +.si-egghead::before { content: "\ed49"; } +.si-egghead.si--color::before { color: #FCFBFA; } +.si-egnyte::before { content: "\ed4a"; } +.si-egnyte.si--color::before { color: #00968F; } +.si-eight::before { content: "\ed4b"; } +.si-eight.si--color::before { color: #0054FF; } +.si-eightsleep::before { content: "\ed4c"; } +.si-eightsleep.si--color::before { color: #262729; } +.si-ejs::before { content: "\ed4d"; } +.si-ejs.si--color::before { color: #B4CA65; } +.si-elastic::before { content: "\ed4e"; } +.si-elastic.si--color::before { color: #005571; } +.si-elasticcloud::before { content: "\ed4f"; } +.si-elasticcloud.si--color::before { color: #005571; } +.si-elasticstack::before { content: "\ed50"; } +.si-elasticstack.si--color::before { color: #005571; } +.si-elasticsearch::before { content: "\ed51"; } +.si-elasticsearch.si--color::before { color: #005571; } +.si-elavon::before { content: "\ed52"; } +.si-elavon.si--color::before { color: #0C2074; } +.si-electron::before { content: "\ed53"; } +.si-electron.si--color::before { color: #47848F; } +.si-electronfiddle::before { content: "\ed54"; } +.si-electronfiddle.si--color::before { color: #E79537; } +.si-electronbuilder::before { content: "\ed55"; } +.si-electronbuilder.si--color::before { color: #000000; } +.si-elegoo::before { content: "\ed56"; } +.si-elegoo.si--color::before { color: #2C3A83; } +.si-element::before { content: "\ed57"; } +.si-element.si--color::before { color: #0DBD8B; } +.si-elementary::before { content: "\ed58"; } +.si-elementary.si--color::before { color: #64BAFF; } +.si-elementor::before { content: "\ed59"; } +.si-elementor.si--color::before { color: #92003B; } +.si-elevenlabs::before { content: "\ed5a"; } +.si-elevenlabs.si--color::before { color: #000000; } +.si-eleventy::before { content: "\ed5b"; } +.si-eleventy.si--color::before { color: #222222; } +.si-elgato::before { content: "\ed5c"; } +.si-elgato.si--color::before { color: #101010; } +.si-elixir::before { content: "\ed5d"; } +.si-elixir.si--color::before { color: #4B275F; } +.si-elm::before { content: "\ed5e"; } +.si-elm.si--color::before { color: #1293D8; } +.si-elsevier::before { content: "\ed5f"; } +.si-elsevier.si--color::before { color: #FF6C00; } +.si-embarcadero::before { content: "\ed60"; } +.si-embarcadero.si--color::before { color: #ED1F35; } +.si-embark::before { content: "\ed61"; } +.si-embark.si--color::before { color: #000000; } +.si-emberdotjs::before { content: "\ed62"; } +.si-emberdotjs.si--color::before { color: #E04E39; } +.si-emby::before { content: "\ed63"; } +.si-emby.si--color::before { color: #52B54B; } +.si-emirates::before { content: "\ed64"; } +.si-emirates.si--color::before { color: #D71921; } +.si-emlakjet::before { content: "\ed65"; } +.si-emlakjet.si--color::before { color: #0AE524; } +.si-empirekred::before { content: "\ed66"; } +.si-empirekred.si--color::before { color: #72BE50; } +.si-endeavouros::before { content: "\ed67"; } +.si-endeavouros.si--color::before { color: #7F7FFF; } +.si-engadget::before { content: "\ed68"; } +.si-engadget.si--color::before { color: #000000; } +.si-enpass::before { content: "\ed69"; } +.si-enpass.si--color::before { color: #0D47A1; } +.si-enterprisedb::before { content: "\ed6a"; } +.si-enterprisedb.si--color::before { color: #FF3E00; } +.si-envato::before { content: "\ed6b"; } +.si-envato.si--color::before { color: #87E64B; } +.si-envoyproxy::before { content: "\ed6c"; } +.si-envoyproxy.si--color::before { color: #AC6199; } +.si-epel::before { content: "\ed6d"; } +.si-epel.si--color::before { color: #FC0000; } +.si-epicgames::before { content: "\ed6e"; } +.si-epicgames.si--color::before { color: #313131; } +.si-epson::before { content: "\ed6f"; } +.si-epson.si--color::before { color: #003399; } +.si-equinixmetal::before { content: "\ed70"; } +.si-equinixmetal.si--color::before { color: #ED2224; } +.si-eraser::before { content: "\ed71"; } +.si-eraser.si--color::before { color: #EC2C40; } +.si-ericsson::before { content: "\ed72"; } +.si-ericsson.si--color::before { color: #0082F0; } +.si-erlang::before { content: "\ed73"; } +.si-erlang.si--color::before { color: #A90533; } +.si-erpnext::before { content: "\ed74"; } +.si-erpnext.si--color::before { color: #0089FF; } +.si-esbuild::before { content: "\ed75"; } +.si-esbuild.si--color::before { color: #FFCF00; } +.si-esea::before { content: "\ed76"; } +.si-esea.si--color::before { color: #0E9648; } +.si-eslgaming::before { content: "\ed77"; } +.si-eslgaming.si--color::before { color: #FFFF09; } +.si-eslint::before { content: "\ed78"; } +.si-eslint.si--color::before { color: #4B32C3; } +.si-esotericsoftware::before { content: "\ed79"; } +.si-esotericsoftware.si--color::before { color: #3FA9F5; } +.si-esphome::before { content: "\ed7a"; } +.si-esphome.si--color::before { color: #000000; } +.si-espressif::before { content: "\ed7b"; } +.si-espressif.si--color::before { color: #E7352C; } +.si-esri::before { content: "\ed7c"; } +.si-esri.si--color::before { color: #000000; } +.si-etcd::before { content: "\ed7d"; } +.si-etcd.si--color::before { color: #419EDA; } +.si-ethereum::before { content: "\ed7e"; } +.si-ethereum.si--color::before { color: #3C3C3D; } +.si-ethers::before { content: "\ed7f"; } +.si-ethers.si--color::before { color: #2535A0; } +.si-ethiopianairlines::before { content: "\ed80"; } +.si-ethiopianairlines.si--color::before { color: #648B1A; } +.si-etihadairways::before { content: "\ed81"; } +.si-etihadairways.si--color::before { color: #BD8B13; } +.si-etsy::before { content: "\ed82"; } +.si-etsy.si--color::before { color: #F16521; } +.si-europeanunion::before { content: "\ed83"; } +.si-europeanunion.si--color::before { color: #003399; } +.si-eventstore::before { content: "\ed84"; } +.si-eventstore.si--color::before { color: #5AB552; } +.si-eventbrite::before { content: "\ed85"; } +.si-eventbrite.si--color::before { color: #F05537; } +.si-evernote::before { content: "\ed86"; } +.si-evernote.si--color::before { color: #00A82D; } +.si-excalidraw::before { content: "\ed87"; } +.si-excalidraw.si--color::before { color: #6965DB; } +.si-exercism::before { content: "\ed88"; } +.si-exercism.si--color::before { color: #009CAB; } +.si-exordo::before { content: "\ed89"; } +.si-exordo.si--color::before { color: #DAA449; } +.si-exoscale::before { content: "\ed8a"; } +.si-exoscale.si--color::before { color: #DA291C; } +.si-expedia::before { content: "\ed8b"; } +.si-expedia.si--color::before { color: #191E3B; } +.si-expensify::before { content: "\ed8c"; } +.si-expensify.si--color::before { color: #0185FF; } +.si-expertsexchange::before { content: "\ed8d"; } +.si-expertsexchange.si--color::before { color: #00AAE7; } +.si-expo::before { content: "\ed8e"; } +.si-expo.si--color::before { color: #000020; } +.si-express::before { content: "\ed8f"; } +.si-express.si--color::before { color: #000000; } +.si-expressdotcom::before { content: "\ed90"; } +.si-expressdotcom.si--color::before { color: #000000; } +.si-expressvpn::before { content: "\ed91"; } +.si-expressvpn.si--color::before { color: #DA3940; } +.si-eyeem::before { content: "\ed92"; } +.si-eyeem.si--color::before { color: #000000; } +.si-fdroid::before { content: "\ed93"; } +.si-fdroid.si--color::before { color: #1976D2; } +.si-fsecure::before { content: "\ed94"; } +.si-fsecure.si--color::before { color: #00BAFF; } +.si-fsharp::before { content: "\ed95"; } +.si-fsharp.si--color::before { color: #378BBA; } +.si-f1::before { content: "\ed96"; } +.si-f1.si--color::before { color: #E10600; } +.si-f5::before { content: "\ed97"; } +.si-f5.si--color::before { color: #E4002B; } +.si-facebook::before { content: "\ed98"; } +.si-facebook.si--color::before { color: #0866FF; } +.si-facebookgaming::before { content: "\ed99"; } +.si-facebookgaming.si--color::before { color: #005FED; } +.si-facebooklive::before { content: "\ed9a"; } +.si-facebooklive.si--color::before { color: #ED4242; } +.si-faceit::before { content: "\ed9b"; } +.si-faceit.si--color::before { color: #FF5500; } +.si-facepunch::before { content: "\ed9c"; } +.si-facepunch.si--color::before { color: #EC1C24; } +.si-fairphone::before { content: "\ed9d"; } +.si-fairphone.si--color::before { color: #4495D1; } +.si-falco::before { content: "\ed9e"; } +.si-falco.si--color::before { color: #00AEC7; } +.si-falcon::before { content: "\ed9f"; } +.si-falcon.si--color::before { color: #F0AD4E; } +.si-fampay::before { content: "\eda0"; } +.si-fampay.si--color::before { color: #FFAD00; } +.si-fandango::before { content: "\eda1"; } +.si-fandango.si--color::before { color: #FF7300; } +.si-fandom::before { content: "\eda2"; } +.si-fandom.si--color::before { color: #FA005A; } +.si-fanfou::before { content: "\eda3"; } +.si-fanfou.si--color::before { color: #00CCFF; } +.si-fantom::before { content: "\eda4"; } +.si-fantom.si--color::before { color: #0928FF; } +.si-farcaster::before { content: "\eda5"; } +.si-farcaster.si--color::before { color: #855DCD; } +.si-fareharbor::before { content: "\eda6"; } +.si-fareharbor.si--color::before { color: #0A6ECE; } +.si-farfetch::before { content: "\eda7"; } +.si-farfetch.si--color::before { color: #000000; } +.si-fastapi::before { content: "\eda8"; } +.si-fastapi.si--color::before { color: #009688; } +.si-fastify::before { content: "\eda9"; } +.si-fastify.si--color::before { color: #000000; } +.si-fastlane::before { content: "\edaa"; } +.si-fastlane.si--color::before { color: #00F200; } +.si-fastly::before { content: "\edab"; } +.si-fastly.si--color::before { color: #FF282D; } +.si-fathom::before { content: "\edac"; } +.si-fathom.si--color::before { color: #9187FF; } +.si-fauna::before { content: "\edad"; } +.si-fauna.si--color::before { color: #3A1AB6; } +.si-favro::before { content: "\edae"; } +.si-favro.si--color::before { color: #512DA8; } +.si-fcc::before { content: "\edaf"; } +.si-fcc.si--color::before { color: #1C3664; } +.si-fedex::before { content: "\edb0"; } +.si-fedex.si--color::before { color: #4D148C; } +.si-fedora::before { content: "\edb1"; } +.si-fedora.si--color::before { color: #51A2DA; } +.si-feedly::before { content: "\edb2"; } +.si-feedly.si--color::before { color: #2BB24C; } +.si-ferrari::before { content: "\edb3"; } +.si-ferrari.si--color::before { color: #D40000; } +.si-ferrarinv::before { content: "\edb4"; } +.si-ferrarinv.si--color::before { color: #EB2E2C; } +.si-ferretdb::before { content: "\edb5"; } +.si-ferretdb.si--color::before { color: #042133; } +.si-ffmpeg::before { content: "\edb6"; } +.si-ffmpeg.si--color::before { color: #007808; } +.si-fi::before { content: "\edb7"; } +.si-fi.si--color::before { color: #00B899; } +.si-fiat::before { content: "\edb8"; } +.si-fiat.si--color::before { color: #941711; } +.si-fidoalliance::before { content: "\edb9"; } +.si-fidoalliance.si--color::before { color: #FFBF3B; } +.si-fifa::before { content: "\edba"; } +.si-fifa.si--color::before { color: #326295; } +.si-fig::before { content: "\edbb"; } +.si-fig.si--color::before { color: #000000; } +.si-figma::before { content: "\edbc"; } +.si-figma.si--color::before { color: #F24E1E; } +.si-figshare::before { content: "\edbd"; } +.si-figshare.si--color::before { color: #556472; } +.si-fila::before { content: "\edbe"; } +.si-fila.si--color::before { color: #002D62; } +.si-filament::before { content: "\edbf"; } +.si-filament.si--color::before { color: #FDAE4B; } +.si-filedotio::before { content: "\edc0"; } +.si-filedotio.si--color::before { color: #3D3C9D; } +.si-files::before { content: "\edc1"; } +.si-files.si--color::before { color: #4285F4; } +.si-filezilla::before { content: "\edc2"; } +.si-filezilla.si--color::before { color: #BF0000; } +.si-fineco::before { content: "\edc3"; } +.si-fineco.si--color::before { color: #00549F; } +.si-fing::before { content: "\edc4"; } +.si-fing.si--color::before { color: #009AEE; } +.si-firebase::before { content: "\edc5"; } +.si-firebase.si--color::before { color: #DD2C00; } +.si-firefish::before { content: "\edc6"; } +.si-firefish.si--color::before { color: #F07A5B; } +.si-fireflyiii::before { content: "\edc7"; } +.si-fireflyiii.si--color::before { color: #CD5029; } +.si-firefox::before { content: "\edc8"; } +.si-firefox.si--color::before { color: #FF7139; } +.si-firefoxbrowser::before { content: "\edc9"; } +.si-firefoxbrowser.si--color::before { color: #FF7139; } +.si-fireship::before { content: "\edca"; } +.si-fireship.si--color::before { color: #EB844E; } +.si-firewalla::before { content: "\edcb"; } +.si-firewalla.si--color::before { color: #C8332D; } +.si-first::before { content: "\edcc"; } +.si-first.si--color::before { color: #0066B3; } +.si-fishshell::before { content: "\edcd"; } +.si-fishshell.si--color::before { color: #34C534; } +.si-fitbit::before { content: "\edce"; } +.si-fitbit.si--color::before { color: #00B0B9; } +.si-fivem::before { content: "\edcf"; } +.si-fivem.si--color::before { color: #F40552; } +.si-fiverr::before { content: "\edd0"; } +.si-fiverr.si--color::before { color: #1DBF73; } +.si-fizz::before { content: "\edd1"; } +.si-fizz.si--color::before { color: #00D672; } +.si-flashforge::before { content: "\edd2"; } +.si-flashforge.si--color::before { color: #000000; } +.si-flask::before { content: "\edd3"; } +.si-flask.si--color::before { color: #000000; } +.si-flat::before { content: "\edd4"; } +.si-flat.si--color::before { color: #3481FE; } +.si-flathub::before { content: "\edd5"; } +.si-flathub.si--color::before { color: #000000; } +.si-flatpak::before { content: "\edd6"; } +.si-flatpak.si--color::before { color: #4A90D9; } +.si-flickr::before { content: "\edd7"; } +.si-flickr.si--color::before { color: #0063DC; } +.si-flightaware::before { content: "\edd8"; } +.si-flightaware.si--color::before { color: #19315B; } +.si-flipboard::before { content: "\edd9"; } +.si-flipboard.si--color::before { color: #E12828; } +.si-flipkart::before { content: "\edda"; } +.si-flipkart.si--color::before { color: #2874F0; } +.si-floatplane::before { content: "\eddb"; } +.si-floatplane.si--color::before { color: #00AEEF; } +.si-flood::before { content: "\eddc"; } +.si-flood.si--color::before { color: #4285F4; } +.si-fluentbit::before { content: "\eddd"; } +.si-fluentbit.si--color::before { color: #49BDA5; } +.si-fluentd::before { content: "\edde"; } +.si-fluentd.si--color::before { color: #0E83C8; } +.si-fluke::before { content: "\eddf"; } +.si-fluke.si--color::before { color: #FFC20E; } +.si-flutter::before { content: "\ede0"; } +.si-flutter.si--color::before { color: #02569B; } +.si-flux::before { content: "\ede1"; } +.si-flux.si--color::before { color: #5468FF; } +.si-flydotio::before { content: "\ede2"; } +.si-flydotio.si--color::before { color: #24175B; } +.si-flyway::before { content: "\ede3"; } +.si-flyway.si--color::before { color: #CC0200; } +.si-fmod::before { content: "\ede4"; } +.si-fmod.si--color::before { color: #000000; } +.si-fnac::before { content: "\ede5"; } +.si-fnac.si--color::before { color: #E1A925; } +.si-folium::before { content: "\ede6"; } +.si-folium.si--color::before { color: #77B829; } +.si-fonoma::before { content: "\ede7"; } +.si-fonoma.si--color::before { color: #02B78F; } +.si-fontawesome::before { content: "\ede8"; } +.si-fontawesome.si--color::before { color: #538DD7; } +.si-fontbase::before { content: "\ede9"; } +.si-fontbase.si--color::before { color: #3D03A7; } +.si-fontforge::before { content: "\edea"; } +.si-fontforge.si--color::before { color: #F2712B; } +.si-foobar2000::before { content: "\edeb"; } +.si-foobar2000.si--color::before { color: #000000; } +.si-foodpanda::before { content: "\edec"; } +.si-foodpanda.si--color::before { color: #D70F64; } +.si-ford::before { content: "\eded"; } +.si-ford.si--color::before { color: #00274E; } +.si-forgejo::before { content: "\edee"; } +.si-forgejo.si--color::before { color: #FB923C; } +.si-formik::before { content: "\edef"; } +.si-formik.si--color::before { color: #2563EB; } +.si-formspree::before { content: "\edf0"; } +.si-formspree.si--color::before { color: #E5122E; } +.si-formstack::before { content: "\edf1"; } +.si-formstack.si--color::before { color: #21B573; } +.si-fortinet::before { content: "\edf2"; } +.si-fortinet.si--color::before { color: #EE3124; } +.si-fortran::before { content: "\edf3"; } +.si-fortran.si--color::before { color: #734F96; } +.si-fossa::before { content: "\edf4"; } +.si-fossa.si--color::before { color: #289E6D; } +.si-fossilscm::before { content: "\edf5"; } +.si-fossilscm.si--color::before { color: #548294; } +.si-foundryvirtualtabletop::before { content: "\edf6"; } +.si-foundryvirtualtabletop.si--color::before { color: #FE6A1F; } +.si-foursquare::before { content: "\edf7"; } +.si-foursquare.si--color::before { color: #3333FF; } +.si-fox::before { content: "\edf8"; } +.si-fox.si--color::before { color: #000000; } +.si-foxtel::before { content: "\edf9"; } +.si-foxtel.si--color::before { color: #EB5205; } +.si-fozzy::before { content: "\edfa"; } +.si-fozzy.si--color::before { color: #F15B29; } +.si-framer::before { content: "\edfb"; } +.si-framer.si--color::before { color: #0055FF; } +.si-framework::before { content: "\edfc"; } +.si-framework.si--color::before { color: #000000; } +.si-framework7::before { content: "\edfd"; } +.si-framework7.si--color::before { color: #EE350F; } +.si-franprix::before { content: "\edfe"; } +.si-franprix.si--color::before { color: #EC6237; } +.si-frappe::before { content: "\edff"; } +.si-frappe.si--color::before { color: #0089FF; } +.si-fraunhofergesellschaft::before { content: "\ee00"; } +.si-fraunhofergesellschaft.si--color::before { color: #179C7D; } +.si-freebsd::before { content: "\ee01"; } +.si-freebsd.si--color::before { color: #AB2B28; } +.si-freecad::before { content: "\ee02"; } +.si-freecad.si--color::before { color: #729FCF; } +.si-freecodecamp::before { content: "\ee03"; } +.si-freecodecamp.si--color::before { color: #0A0A23; } +.si-freedesktopdotorg::before { content: "\ee04"; } +.si-freedesktopdotorg.si--color::before { color: #3B80AE; } +.si-freelancer::before { content: "\ee05"; } +.si-freelancer.si--color::before { color: #29B2FE; } +.si-freelancermap::before { content: "\ee06"; } +.si-freelancermap.si--color::before { color: #00CFD6; } +.si-freenas::before { content: "\ee07"; } +.si-freenas.si--color::before { color: #343434; } +.si-freenet::before { content: "\ee08"; } +.si-freenet.si--color::before { color: #84BC34; } +.si-freepik::before { content: "\ee09"; } +.si-freepik.si--color::before { color: #1273EB; } +.si-fresh::before { content: "\ee0a"; } +.si-fresh.si--color::before { color: #FFDB1E; } +.si-frontendmentor::before { content: "\ee0b"; } +.si-frontendmentor.si--color::before { color: #3F54A3; } +.si-frontify::before { content: "\ee0c"; } +.si-frontify.si--color::before { color: #2D3232; } +.si-fubo::before { content: "\ee0d"; } +.si-fubo.si--color::before { color: #C83D1E; } +.si-fueler::before { content: "\ee0e"; } +.si-fueler.si--color::before { color: #09C9E3; } +.si-fugacloud::before { content: "\ee0f"; } +.si-fugacloud.si--color::before { color: #242F4B; } +.si-fujifilm::before { content: "\ee10"; } +.si-fujifilm.si--color::before { color: #FB0020; } +.si-fujitsu::before { content: "\ee11"; } +.si-fujitsu.si--color::before { color: #FF0000; } +.si-furaffinity::before { content: "\ee12"; } +.si-furaffinity.si--color::before { color: #36566F; } +.si-furrynetwork::before { content: "\ee13"; } +.si-furrynetwork.si--color::before { color: #2E75B4; } +.si-fusionauth::before { content: "\ee14"; } +.si-fusionauth.si--color::before { color: #F58320; } +.si-futurelearn::before { content: "\ee15"; } +.si-futurelearn.si--color::before { color: #DE00A5; } +.si-g2::before { content: "\ee16"; } +.si-g2.si--color::before { color: #FF492C; } +.si-g2a::before { content: "\ee17"; } +.si-g2a.si--color::before { color: #F05F00; } +.si-g2g::before { content: "\ee18"; } +.si-g2g.si--color::before { color: #ED1C24; } +.si-galaxus::before { content: "\ee19"; } +.si-galaxus.si--color::before { color: #000000; } +.si-gamedeveloper::before { content: "\ee1a"; } +.si-gamedeveloper.si--color::before { color: #E60012; } +.si-gamejolt::before { content: "\ee1b"; } +.si-gamejolt.si--color::before { color: #CCFF00; } +.si-gamescience::before { content: "\ee1c"; } +.si-gamescience.si--color::before { color: #000000; } +.si-gamebanana::before { content: "\ee1d"; } +.si-gamebanana.si--color::before { color: #FCEF40; } +.si-gameloft::before { content: "\ee1e"; } +.si-gameloft.si--color::before { color: #000000; } +.si-gamemaker::before { content: "\ee1f"; } +.si-gamemaker.si--color::before { color: #000000; } +.si-garmin::before { content: "\ee20"; } +.si-garmin.si--color::before { color: #000000; } +.si-gatling::before { content: "\ee21"; } +.si-gatling.si--color::before { color: #FF9E2A; } +.si-gatsby::before { content: "\ee22"; } +.si-gatsby.si--color::before { color: #663399; } +.si-gcore::before { content: "\ee23"; } +.si-gcore.si--color::before { color: #FF4C00; } +.si-gdal::before { content: "\ee24"; } +.si-gdal.si--color::before { color: #5CAE58; } +.si-geeksforgeeks::before { content: "\ee25"; } +.si-geeksforgeeks.si--color::before { color: #2F8D46; } +.si-generalelectric::before { content: "\ee26"; } +.si-generalelectric.si--color::before { color: #0870D8; } +.si-generalmotors::before { content: "\ee27"; } +.si-generalmotors.si--color::before { color: #0170CE; } +.si-genius::before { content: "\ee28"; } +.si-genius.si--color::before { color: #FFFF64; } +.si-gentoo::before { content: "\ee29"; } +.si-gentoo.si--color::before { color: #54487A; } +.si-geocaching::before { content: "\ee2a"; } +.si-geocaching.si--color::before { color: #00874D; } +.si-geode::before { content: "\ee2b"; } +.si-geode.si--color::before { color: #8D7ACF; } +.si-geopandas::before { content: "\ee2c"; } +.si-geopandas.si--color::before { color: #139C5A; } +.si-gerrit::before { content: "\ee2d"; } +.si-gerrit.si--color::before { color: #EEEEEE; } +.si-getx::before { content: "\ee2e"; } +.si-getx.si--color::before { color: #8A2BE2; } +.si-ghost::before { content: "\ee2f"; } +.si-ghost.si--color::before { color: #15171A; } +.si-ghostery::before { content: "\ee30"; } +.si-ghostery.si--color::before { color: #00AEF0; } +.si-gimp::before { content: "\ee31"; } +.si-gimp.si--color::before { color: #5C5543; } +.si-gin::before { content: "\ee32"; } +.si-gin.si--color::before { color: #008ECF; } +.si-giphy::before { content: "\ee33"; } +.si-giphy.si--color::before { color: #FF6666; } +.si-git::before { content: "\ee34"; } +.si-git.si--color::before { color: #F05032; } +.si-gitextensions::before { content: "\ee35"; } +.si-gitextensions.si--color::before { color: #212121; } +.si-gitforwindows::before { content: "\ee36"; } +.si-gitforwindows.si--color::before { color: #80B3FF; } +.si-gitlfs::before { content: "\ee37"; } +.si-gitlfs.si--color::before { color: #F64935; } +.si-gitbook::before { content: "\ee38"; } +.si-gitbook.si--color::before { color: #BBDDE5; } +.si-gitconnected::before { content: "\ee39"; } +.si-gitconnected.si--color::before { color: #2E69AE; } +.si-gitea::before { content: "\ee3a"; } +.si-gitea.si--color::before { color: #609926; } +.si-gitee::before { content: "\ee3b"; } +.si-gitee.si--color::before { color: #C71D23; } +.si-github::before { content: "\ee3c"; } +.si-github.si--color::before { color: #181717; } +.si-githubactions::before { content: "\ee3d"; } +.si-githubactions.si--color::before { color: #2088FF; } +.si-githubcopilot::before { content: "\ee3e"; } +.si-githubcopilot.si--color::before { color: #000000; } +.si-githubpages::before { content: "\ee3f"; } +.si-githubpages.si--color::before { color: #222222; } +.si-githubsponsors::before { content: "\ee40"; } +.si-githubsponsors.si--color::before { color: #EA4AAA; } +.si-gitignoredotio::before { content: "\ee41"; } +.si-gitignoredotio.si--color::before { color: #204ECF; } +.si-gitkraken::before { content: "\ee42"; } +.si-gitkraken.si--color::before { color: #179287; } +.si-gitlab::before { content: "\ee43"; } +.si-gitlab.si--color::before { color: #FC6D26; } +.si-gitpod::before { content: "\ee44"; } +.si-gitpod.si--color::before { color: #FFAE33; } +.si-gitter::before { content: "\ee45"; } +.si-gitter.si--color::before { color: #ED1965; } +.si-glassdoor::before { content: "\ee46"; } +.si-glassdoor.si--color::before { color: #00A162; } +.si-glide::before { content: "\ee47"; } +.si-glide.si--color::before { color: #18BED4; } +.si-glitch::before { content: "\ee48"; } +.si-glitch.si--color::before { color: #3333FF; } +.si-globus::before { content: "\ee49"; } +.si-globus.si--color::before { color: #CA6201; } +.si-glovo::before { content: "\ee4a"; } +.si-glovo.si--color::before { color: #F2CC38; } +.si-gltf::before { content: "\ee4b"; } +.si-gltf.si--color::before { color: #87C540; } +.si-gmail::before { content: "\ee4c"; } +.si-gmail.si--color::before { color: #EA4335; } +.si-gmx::before { content: "\ee4d"; } +.si-gmx.si--color::before { color: #1C449B; } +.si-gnome::before { content: "\ee4e"; } +.si-gnome.si--color::before { color: #4A86CF; } +.si-gnometerminal::before { content: "\ee4f"; } +.si-gnometerminal.si--color::before { color: #241F31; } +.si-gnu::before { content: "\ee50"; } +.si-gnu.si--color::before { color: #A42E2B; } +.si-gnubash::before { content: "\ee51"; } +.si-gnubash.si--color::before { color: #4EAA25; } +.si-gnuemacs::before { content: "\ee52"; } +.si-gnuemacs.si--color::before { color: #7F5AB6; } +.si-gnuicecat::before { content: "\ee53"; } +.si-gnuicecat.si--color::before { color: #002F5B; } +.si-gnuprivacyguard::before { content: "\ee54"; } +.si-gnuprivacyguard.si--color::before { color: #0093DD; } +.si-gnusocial::before { content: "\ee55"; } +.si-gnusocial.si--color::before { color: #A22430; } +.si-go::before { content: "\ee56"; } +.si-go.si--color::before { color: #00ADD8; } +.si-gocd::before { content: "\ee57"; } +.si-gocd.si--color::before { color: #94399E; } +.si-godaddy::before { content: "\ee58"; } +.si-godaddy.si--color::before { color: #1BDBDB; } +.si-godotengine::before { content: "\ee59"; } +.si-godotengine.si--color::before { color: #478CBF; } +.si-gofundme::before { content: "\ee5a"; } +.si-gofundme.si--color::before { color: #00B964; } +.si-gogdotcom::before { content: "\ee5b"; } +.si-gogdotcom.si--color::before { color: #86328A; } +.si-gojek::before { content: "\ee5c"; } +.si-gojek.si--color::before { color: #00AA13; } +.si-goland::before { content: "\ee5d"; } +.si-goland.si--color::before { color: #000000; } +.si-goldenline::before { content: "\ee5e"; } +.si-goldenline.si--color::before { color: #FFE005; } +.si-goldmansachs::before { content: "\ee5f"; } +.si-goldmansachs.si--color::before { color: #7399C6; } +.si-goodreads::before { content: "\ee60"; } +.si-goodreads.si--color::before { color: #372213; } +.si-google::before { content: "\ee61"; } +.si-google.si--color::before { color: #4285F4; } +.si-googleadmob::before { content: "\ee62"; } +.si-googleadmob.si--color::before { color: #EA4335; } +.si-googleads::before { content: "\ee63"; } +.si-googleads.si--color::before { color: #4285F4; } +.si-googleadsense::before { content: "\ee64"; } +.si-googleadsense.si--color::before { color: #4285F4; } +.si-googleanalytics::before { content: "\ee65"; } +.si-googleanalytics.si--color::before { color: #E37400; } +.si-googleappsscript::before { content: "\ee66"; } +.si-googleappsscript.si--color::before { color: #4285F4; } +.si-googleassistant::before { content: "\ee67"; } +.si-googleassistant.si--color::before { color: #4285F4; } +.si-googleauthenticator::before { content: "\ee68"; } +.si-googleauthenticator.si--color::before { color: #4285F4; } +.si-googlebigquery::before { content: "\ee69"; } +.si-googlebigquery.si--color::before { color: #669DF6; } +.si-googlebigtable::before { content: "\ee6a"; } +.si-googlebigtable.si--color::before { color: #669DF6; } +.si-googlecalendar::before { content: "\ee6b"; } +.si-googlecalendar.si--color::before { color: #4285F4; } +.si-googlecampaignmanager360::before { content: "\ee6c"; } +.si-googlecampaignmanager360.si--color::before { color: #1E8E3E; } +.si-googlecardboard::before { content: "\ee6d"; } +.si-googlecardboard.si--color::before { color: #FF7143; } +.si-googlechat::before { content: "\ee6e"; } +.si-googlechat.si--color::before { color: #34A853; } +.si-googlechrome::before { content: "\ee6f"; } +.si-googlechrome.si--color::before { color: #4285F4; } +.si-googlechronicle::before { content: "\ee70"; } +.si-googlechronicle.si--color::before { color: #4285F4; } +.si-googleclassroom::before { content: "\ee71"; } +.si-googleclassroom.si--color::before { color: #0F9D58; } +.si-googlecloud::before { content: "\ee72"; } +.si-googlecloud.si--color::before { color: #4285F4; } +.si-googlecloudcomposer::before { content: "\ee73"; } +.si-googlecloudcomposer.si--color::before { color: #4285F4; } +.si-googlecloudspanner::before { content: "\ee74"; } +.si-googlecloudspanner.si--color::before { color: #4285F4; } +.si-googlecloudstorage::before { content: "\ee75"; } +.si-googlecloudstorage.si--color::before { color: #AECBFA; } +.si-googlecolab::before { content: "\ee76"; } +.si-googlecolab.si--color::before { color: #F9AB00; } +.si-googlecontaineroptimizedos::before { content: "\ee77"; } +.si-googlecontaineroptimizedos.si--color::before { color: #4285F4; } +.si-googledatastudio::before { content: "\ee78"; } +.si-googledatastudio.si--color::before { color: #669DF6; } +.si-googledataflow::before { content: "\ee79"; } +.si-googledataflow.si--color::before { color: #AECBFA; } +.si-googledataproc::before { content: "\ee7a"; } +.si-googledataproc.si--color::before { color: #AECBFA; } +.si-googledisplayandvideo360::before { content: "\ee7b"; } +.si-googledisplayandvideo360.si--color::before { color: #34A853; } +.si-googledocs::before { content: "\ee7c"; } +.si-googledocs.si--color::before { color: #4285F4; } +.si-googledrive::before { content: "\ee7d"; } +.si-googledrive.si--color::before { color: #4285F4; } +.si-googleearth::before { content: "\ee7e"; } +.si-googleearth.si--color::before { color: #4285F4; } +.si-googleearthengine::before { content: "\ee7f"; } +.si-googleearthengine.si--color::before { color: #4285F4; } +.si-googlefit::before { content: "\ee80"; } +.si-googlefit.si--color::before { color: #4285F4; } +.si-googlefonts::before { content: "\ee81"; } +.si-googlefonts.si--color::before { color: #4285F4; } +.si-googleforms::before { content: "\ee82"; } +.si-googleforms.si--color::before { color: #7248B9; } +.si-googlegemini::before { content: "\ee83"; } +.si-googlegemini.si--color::before { color: #8E75B2; } +.si-googlehome::before { content: "\ee84"; } +.si-googlehome.si--color::before { color: #4285F4; } +.si-googlekeep::before { content: "\ee85"; } +.si-googlekeep.si--color::before { color: #FFBB00; } +.si-googlelens::before { content: "\ee86"; } +.si-googlelens.si--color::before { color: #4285F4; } +.si-googlemaps::before { content: "\ee87"; } +.si-googlemaps.si--color::before { color: #4285F4; } +.si-googlemarketingplatform::before { content: "\ee88"; } +.si-googlemarketingplatform.si--color::before { color: #4285F4; } +.si-googlemeet::before { content: "\ee89"; } +.si-googlemeet.si--color::before { color: #00897B; } +.si-googlemessages::before { content: "\ee8a"; } +.si-googlemessages.si--color::before { color: #1A73E8; } +.si-googlenearby::before { content: "\ee8b"; } +.si-googlenearby.si--color::before { color: #4285F4; } +.si-googlenews::before { content: "\ee8c"; } +.si-googlenews.si--color::before { color: #174EA6; } +.si-googlepay::before { content: "\ee8d"; } +.si-googlepay.si--color::before { color: #4285F4; } +.si-googlephotos::before { content: "\ee8e"; } +.si-googlephotos.si--color::before { color: #4285F4; } +.si-googleplay::before { content: "\ee8f"; } +.si-googleplay.si--color::before { color: #414141; } +.si-googlepubsub::before { content: "\ee90"; } +.si-googlepubsub.si--color::before { color: #AECBFA; } +.si-googlescholar::before { content: "\ee91"; } +.si-googlescholar.si--color::before { color: #4285F4; } +.si-googlesearchconsole::before { content: "\ee92"; } +.si-googlesearchconsole.si--color::before { color: #458CF5; } +.si-googlesheets::before { content: "\ee93"; } +.si-googlesheets.si--color::before { color: #34A853; } +.si-googleslides::before { content: "\ee94"; } +.si-googleslides.si--color::before { color: #FBBC04; } +.si-googlestreetview::before { content: "\ee95"; } +.si-googlestreetview.si--color::before { color: #FEC111; } +.si-googletagmanager::before { content: "\ee96"; } +.si-googletagmanager.si--color::before { color: #246FDB; } +.si-googletasks::before { content: "\ee97"; } +.si-googletasks.si--color::before { color: #2684FC; } +.si-googletranslate::before { content: "\ee98"; } +.si-googletranslate.si--color::before { color: #4285F4; } +.si-gotomeeting::before { content: "\ee99"; } +.si-gotomeeting.si--color::before { color: #F68D2E; } +.si-grab::before { content: "\ee9a"; } +.si-grab.si--color::before { color: #00B14F; } +.si-gradle::before { content: "\ee9b"; } +.si-gradle.si--color::before { color: #02303A; } +.si-gradleplaypublisher::before { content: "\ee9c"; } +.si-gradleplaypublisher.si--color::before { color: #82B816; } +.si-grafana::before { content: "\ee9d"; } +.si-grafana.si--color::before { color: #F46800; } +.si-grammarly::before { content: "\ee9e"; } +.si-grammarly.si--color::before { color: #027E6F; } +.si-grandfrais::before { content: "\ee9f"; } +.si-grandfrais.si--color::before { color: #ED2D2F; } +.si-grapheneos::before { content: "\eea0"; } +.si-grapheneos.si--color::before { color: #0053A3; } +.si-graphite::before { content: "\eea1"; } +.si-graphite.si--color::before { color: #000000; } +.si-graphql::before { content: "\eea2"; } +.si-graphql.si--color::before { color: #E10098; } +.si-grav::before { content: "\eea3"; } +.si-grav.si--color::before { color: #221E1F; } +.si-gravatar::before { content: "\eea4"; } +.si-gravatar.si--color::before { color: #1E8CBE; } +.si-graylog::before { content: "\eea5"; } +.si-graylog.si--color::before { color: #FF3633; } +.si-greasyfork::before { content: "\eea6"; } +.si-greasyfork.si--color::before { color: #670000; } +.si-greatlearning::before { content: "\eea7"; } +.si-greatlearning.si--color::before { color: #0E39A9; } +.si-greenhouse::before { content: "\eea8"; } +.si-greenhouse.si--color::before { color: #24A47F; } +.si-greensock::before { content: "\eea9"; } +.si-greensock.si--color::before { color: #88CE02; } +.si-griddotai::before { content: "\eeaa"; } +.si-griddotai.si--color::before { color: #78FF96; } +.si-gridsome::before { content: "\eeab"; } +.si-gridsome.si--color::before { color: #00A672; } +.si-grocy::before { content: "\eeac"; } +.si-grocy.si--color::before { color: #337AB7; } +.si-groupme::before { content: "\eead"; } +.si-groupme.si--color::before { color: #00AFF0; } +.si-groupon::before { content: "\eeae"; } +.si-groupon.si--color::before { color: #53A318; } +.si-grubhub::before { content: "\eeaf"; } +.si-grubhub.si--color::before { color: #F63440; } +.si-grunt::before { content: "\eeb0"; } +.si-grunt.si--color::before { color: #FAA918; } +.si-gsk::before { content: "\eeb1"; } +.si-gsk.si--color::before { color: #F36633; } +.si-gsmarenadotcom::before { content: "\eeb2"; } +.si-gsmarenadotcom.si--color::before { color: #D50000; } +.si-gstreamer::before { content: "\eeb3"; } +.si-gstreamer.si--color::before { color: #FF3131; } +.si-gtk::before { content: "\eeb4"; } +.si-gtk.si--color::before { color: #7FE719; } +.si-guangzhoumetro::before { content: "\eeb5"; } +.si-guangzhoumetro.si--color::before { color: #C51935; } +.si-guilded::before { content: "\eeb6"; } +.si-guilded.si--color::before { color: #F5C400; } +.si-guitarpro::before { content: "\eeb7"; } +.si-guitarpro.si--color::before { color: #569FFF; } +.si-gulp::before { content: "\eeb8"; } +.si-gulp.si--color::before { color: #CF4647; } +.si-gumroad::before { content: "\eeb9"; } +.si-gumroad.si--color::before { color: #FF90E8; } +.si-gumtree::before { content: "\eeba"; } +.si-gumtree.si--color::before { color: #72EF36; } +.si-gunicorn::before { content: "\eebb"; } +.si-gunicorn.si--color::before { color: #499848; } +.si-gurobi::before { content: "\eebc"; } +.si-gurobi.si--color::before { color: #EE3524; } +.si-gusto::before { content: "\eebd"; } +.si-gusto.si--color::before { color: #F45D48; } +.si-gutenberg::before { content: "\eebe"; } +.si-gutenberg.si--color::before { color: #000000; } +.si-handm::before { content: "\eebf"; } +.si-handm.si--color::before { color: #E50010; } +.si-h3::before { content: "\eec0"; } +.si-h3.si--color::before { color: #1E54B7; } +.si-habr::before { content: "\eec1"; } +.si-habr.si--color::before { color: #65A3BE; } +.si-hackclub::before { content: "\eec2"; } +.si-hackclub.si--color::before { color: #EC3750; } +.si-hackthebox::before { content: "\eec3"; } +.si-hackthebox.si--color::before { color: #9FEF00; } +.si-hackaday::before { content: "\eec4"; } +.si-hackaday.si--color::before { color: #1A1A1A; } +.si-hackernoon::before { content: "\eec5"; } +.si-hackernoon.si--color::before { color: #00FE00; } +.si-hackerearth::before { content: "\eec6"; } +.si-hackerearth.si--color::before { color: #2C3454; } +.si-hackerone::before { content: "\eec7"; } +.si-hackerone.si--color::before { color: #494649; } +.si-hackerrank::before { content: "\eec8"; } +.si-hackerrank.si--color::before { color: #00EA64; } +.si-hackster::before { content: "\eec9"; } +.si-hackster.si--color::before { color: #2E9FE6; } +.si-hal::before { content: "\eeca"; } +.si-hal.si--color::before { color: #B03532; } +.si-handlebarsdotjs::before { content: "\eecb"; } +.si-handlebarsdotjs.si--color::before { color: #000000; } +.si-handshake::before { content: "\eecc"; } +.si-handshake.si--color::before { color: #D3FB52; } +.si-handshake_protocol::before { content: "\eecd"; } +.si-handshake_protocol.si--color::before { color: #000000; } +.si-happycow::before { content: "\eece"; } +.si-happycow.si--color::before { color: #7C4EC4; } +.si-harbor::before { content: "\eecf"; } +.si-harbor.si--color::before { color: #60B932; } +.si-harmonyos::before { content: "\eed0"; } +.si-harmonyos.si--color::before { color: #000000; } +.si-hashicorp::before { content: "\eed1"; } +.si-hashicorp.si--color::before { color: #000000; } +.si-hashnode::before { content: "\eed2"; } +.si-hashnode.si--color::before { color: #2962FF; } +.si-haskell::before { content: "\eed3"; } +.si-haskell.si--color::before { color: #5D4F85; } +.si-hasura::before { content: "\eed4"; } +.si-hasura.si--color::before { color: #1EB4D4; } +.si-hatenabookmark::before { content: "\eed5"; } +.si-hatenabookmark.si--color::before { color: #00A4DE; } +.si-haveibeenpwned::before { content: "\eed6"; } +.si-haveibeenpwned.si--color::before { color: #2A6379; } +.si-haxe::before { content: "\eed7"; } +.si-haxe.si--color::before { color: #EA8220; } +.si-hbo::before { content: "\eed8"; } +.si-hbo.si--color::before { color: #000000; } +.si-hcl::before { content: "\eed9"; } +.si-hcl.si--color::before { color: #006BB6; } +.si-hdfcbank::before { content: "\eeda"; } +.si-hdfcbank.si--color::before { color: #004B8D; } +.si-headlessui::before { content: "\eedb"; } +.si-headlessui.si--color::before { color: #66E3FF; } +.si-headphonezone::before { content: "\eedc"; } +.si-headphonezone.si--color::before { color: #3C07FF; } +.si-headspace::before { content: "\eedd"; } +.si-headspace.si--color::before { color: #F47D31; } +.si-hearth::before { content: "\eede"; } +.si-hearth.si--color::before { color: #A33035; } +.si-hearthisdotat::before { content: "\eedf"; } +.si-hearthisdotat.si--color::before { color: #000000; } +.si-hedera::before { content: "\eee0"; } +.si-hedera.si--color::before { color: #222222; } +.si-helium::before { content: "\eee1"; } +.si-helium.si--color::before { color: #0ACF83; } +.si-helix::before { content: "\eee2"; } +.si-helix.si--color::before { color: #281733; } +.si-hellofresh::before { content: "\eee3"; } +.si-hellofresh.si--color::before { color: #99CC33; } +.si-hellyhansen::before { content: "\eee4"; } +.si-hellyhansen.si--color::before { color: #DA2128; } +.si-helm::before { content: "\eee5"; } +.si-helm.si--color::before { color: #0F1689; } +.si-helpscout::before { content: "\eee6"; } +.si-helpscout.si--color::before { color: #1292EE; } +.si-helpdesk::before { content: "\eee7"; } +.si-helpdesk.si--color::before { color: #2FC774; } +.si-hepsiemlak::before { content: "\eee8"; } +.si-hepsiemlak.si--color::before { color: #E1251B; } +.si-here::before { content: "\eee9"; } +.si-here.si--color::before { color: #00AFAA; } +.si-hermes::before { content: "\eeea"; } +.si-hermes.si--color::before { color: #0091CD; } +.si-heroku::before { content: "\eeeb"; } +.si-heroku.si--color::before { color: #430098; } +.si-hetzner::before { content: "\eeec"; } +.si-hetzner.si--color::before { color: #D50C2D; } +.si-hevy::before { content: "\eeed"; } +.si-hevy.si--color::before { color: #000000; } +.si-hexlet::before { content: "\eeee"; } +.si-hexlet.si--color::before { color: #116EF5; } +.si-hexo::before { content: "\eeef"; } +.si-hexo.si--color::before { color: #0E83CD; } +.si-hey::before { content: "\eef0"; } +.si-hey.si--color::before { color: #5522FA; } +.si-hibob::before { content: "\eef1"; } +.si-hibob.si--color::before { color: #E42C51; } +.si-hibernate::before { content: "\eef2"; } +.si-hibernate.si--color::before { color: #59666C; } +.si-hilton::before { content: "\eef3"; } +.si-hilton.si--color::before { color: #231F20; } +.si-hiltonhotelsandresorts::before { content: "\eef4"; } +.si-hiltonhotelsandresorts.si--color::before { color: #1E4380; } +.si-hitachi::before { content: "\eef5"; } +.si-hitachi.si--color::before { color: #E60027; } +.si-hive::before { content: "\eef6"; } +.si-hive.si--color::before { color: #FF7A00; } +.si-hive_blockchain::before { content: "\eef7"; } +.si-hive_blockchain.si--color::before { color: #E31337; } +.si-hivemq::before { content: "\eef8"; } +.si-hivemq.si--color::before { color: #FFC000; } +.si-homarr::before { content: "\eef9"; } +.si-homarr.si--color::before { color: #FA5252; } +.si-homeassistant::before { content: "\eefa"; } +.si-homeassistant.si--color::before { color: #18BCF2; } +.si-homeassistantcommunitystore::before { content: "\eefb"; } +.si-homeassistantcommunitystore.si--color::before { color: #41BDF5; } +.si-homeadvisor::before { content: "\eefc"; } +.si-homeadvisor.si--color::before { color: #F68315; } +.si-homebrew::before { content: "\eefd"; } +.si-homebrew.si--color::before { color: #FBB040; } +.si-homebridge::before { content: "\eefe"; } +.si-homebridge.si--color::before { color: #491F59; } +.si-homepage::before { content: "\eeff"; } +.si-homepage.si--color::before { color: #009BD5; } +.si-homify::before { content: "\ef00"; } +.si-homify.si--color::before { color: #7DCDA3; } +.si-honda::before { content: "\ef01"; } +.si-honda.si--color::before { color: #E40521; } +.si-honey::before { content: "\ef02"; } +.si-honey.si--color::before { color: #FF6801; } +.si-honeybadger::before { content: "\ef03"; } +.si-honeybadger.si--color::before { color: #EA5937; } +.si-honeygain::before { content: "\ef04"; } +.si-honeygain.si--color::before { color: #F9C900; } +.si-hono::before { content: "\ef05"; } +.si-hono.si--color::before { color: #E36002; } +.si-honor::before { content: "\ef06"; } +.si-honor.si--color::before { color: #000000; } +.si-hootsuite::before { content: "\ef07"; } +.si-hootsuite.si--color::before { color: #FF4C46; } +.si-hoppscotch::before { content: "\ef08"; } +.si-hoppscotch.si--color::before { color: #09090B; } +.si-hostinger::before { content: "\ef09"; } +.si-hostinger.si--color::before { color: #673DE6; } +.si-hotelsdotcom::before { content: "\ef0a"; } +.si-hotelsdotcom.si--color::before { color: #EF3346; } +.si-hotjar::before { content: "\ef0b"; } +.si-hotjar.si--color::before { color: #FF3C00; } +.si-hotwire::before { content: "\ef0c"; } +.si-hotwire.si--color::before { color: #FFE801; } +.si-houdini::before { content: "\ef0d"; } +.si-houdini.si--color::before { color: #FF4713; } +.si-houzz::before { content: "\ef0e"; } +.si-houzz.si--color::before { color: #4DBC15; } +.si-hp::before { content: "\ef0f"; } +.si-hp.si--color::before { color: #0096D6; } +.si-hsbc::before { content: "\ef10"; } +.si-hsbc.si--color::before { color: #DB0011; } +.si-htc::before { content: "\ef11"; } +.si-htc.si--color::before { color: #A5CF4C; } +.si-htcvive::before { content: "\ef12"; } +.si-htcvive.si--color::before { color: #00B2E3; } +.si-htmlacademy::before { content: "\ef13"; } +.si-htmlacademy.si--color::before { color: #302683; } +.si-html5::before { content: "\ef14"; } +.si-html5.si--color::before { color: #E34F26; } +.si-htmx::before { content: "\ef15"; } +.si-htmx.si--color::before { color: #3366CC; } +.si-htop::before { content: "\ef16"; } +.si-htop.si--color::before { color: #009020; } +.si-httpie::before { content: "\ef17"; } +.si-httpie.si--color::before { color: #73DC8C; } +.si-huawei::before { content: "\ef18"; } +.si-huawei.si--color::before { color: #FF0000; } +.si-hubspot::before { content: "\ef19"; } +.si-hubspot.si--color::before { color: #FF7A59; } +.si-huggingface::before { content: "\ef1a"; } +.si-huggingface.si--color::before { color: #FFD21E; } +.si-hugo::before { content: "\ef1b"; } +.si-hugo.si--color::before { color: #FF4088; } +.si-humblebundle::before { content: "\ef1c"; } +.si-humblebundle.si--color::before { color: #CC2929; } +.si-humhub::before { content: "\ef1d"; } +.si-humhub.si--color::before { color: #1B8291; } +.si-hungryjacks::before { content: "\ef1e"; } +.si-hungryjacks.si--color::before { color: #D0021B; } +.si-husqvarna::before { content: "\ef1f"; } +.si-husqvarna.si--color::before { color: #273A60; } +.si-hyper::before { content: "\ef20"; } +.si-hyper.si--color::before { color: #000000; } +.si-hyperskill::before { content: "\ef21"; } +.si-hyperskill.si--color::before { color: #8C5AFF; } +.si-hyperx::before { content: "\ef22"; } +.si-hyperx.si--color::before { color: #E21836; } +.si-hypothesis::before { content: "\ef23"; } +.si-hypothesis.si--color::before { color: #BD1C2B; } +.si-hyprland::before { content: "\ef24"; } +.si-hyprland.si--color::before { color: #58E1FF; } +.si-hyundai::before { content: "\ef25"; } +.si-hyundai.si--color::before { color: #002C5E; } +.si-i18next::before { content: "\ef26"; } +.si-i18next.si--color::before { color: #26A69A; } +.si-i3::before { content: "\ef27"; } +.si-i3.si--color::before { color: #52C0FF; } +.si-iata::before { content: "\ef28"; } +.si-iata.si--color::before { color: #004E81; } +.si-ibeacon::before { content: "\ef29"; } +.si-ibeacon.si--color::before { color: #3D7EBB; } +.si-iberia::before { content: "\ef2a"; } +.si-iberia.si--color::before { color: #D7192D; } +.si-iced::before { content: "\ef2b"; } +.si-iced.si--color::before { color: #3645FF; } +.si-iceland::before { content: "\ef2c"; } +.si-iceland.si--color::before { color: #CC092F; } +.si-icicibank::before { content: "\ef2d"; } +.si-icicibank.si--color::before { color: #AE282E; } +.si-icinga::before { content: "\ef2e"; } +.si-icinga.si--color::before { color: #06062C; } +.si-icloud::before { content: "\ef2f"; } +.si-icloud.si--color::before { color: #3693F3; } +.si-icomoon::before { content: "\ef30"; } +.si-icomoon.si--color::before { color: #825794; } +.si-icon::before { content: "\ef31"; } +.si-icon.si--color::before { color: #31B8BB; } +.si-iconfinder::before { content: "\ef32"; } +.si-iconfinder.si--color::before { color: #1A1B1F; } +.si-iconify::before { content: "\ef33"; } +.si-iconify.si--color::before { color: #1769AA; } +.si-iconjar::before { content: "\ef34"; } +.si-iconjar.si--color::before { color: #16A5F3; } +.si-icons8::before { content: "\ef35"; } +.si-icons8.si--color::before { color: #1FB141; } +.si-icq::before { content: "\ef36"; } +.si-icq.si--color::before { color: #24FF00; } +.si-ieee::before { content: "\ef37"; } +.si-ieee.si--color::before { color: #00629B; } +.si-ifixit::before { content: "\ef38"; } +.si-ifixit.si--color::before { color: #0071CE; } +.si-ifood::before { content: "\ef39"; } +.si-ifood.si--color::before { color: #EA1D2C; } +.si-ifttt::before { content: "\ef3a"; } +.si-ifttt.si--color::before { color: #000000; } +.si-igdb::before { content: "\ef3b"; } +.si-igdb.si--color::before { color: #9147FF; } +.si-ign::before { content: "\ef3c"; } +.si-ign.si--color::before { color: #BF1313; } +.si-iheartradio::before { content: "\ef3d"; } +.si-iheartradio.si--color::before { color: #C6002B; } +.si-ikea::before { content: "\ef3e"; } +.si-ikea.si--color::before { color: #0058A3; } +.si-iledefrancemobilites::before { content: "\ef3f"; } +.si-iledefrancemobilites.si--color::before { color: #67B4E7; } +.si-imagedotsc::before { content: "\ef40"; } +.si-imagedotsc.si--color::before { color: #039CB2; } +.si-imagej::before { content: "\ef41"; } +.si-imagej.si--color::before { color: #00D8E0; } +.si-imdb::before { content: "\ef42"; } +.si-imdb.si--color::before { color: #F5C518; } +.si-imessage::before { content: "\ef43"; } +.si-imessage.si--color::before { color: #34DA50; } +.si-imgur::before { content: "\ef44"; } +.si-imgur.si--color::before { color: #1BB76E; } +.si-immer::before { content: "\ef45"; } +.si-immer.si--color::before { color: #00E7C3; } +.si-immich::before { content: "\ef46"; } +.si-immich.si--color::before { color: #4250AF; } +.si-imou::before { content: "\ef47"; } +.si-imou.si--color::before { color: #E89313; } +.si-improvmx::before { content: "\ef48"; } +.si-improvmx.si--color::before { color: #2FBEFF; } +.si-indeed::before { content: "\ef49"; } +.si-indeed.si--color::before { color: #003A9B; } +.si-indiansuperleague::before { content: "\ef4a"; } +.si-indiansuperleague.si--color::before { color: #ED2F21; } +.si-indiehackers::before { content: "\ef4b"; } +.si-indiehackers.si--color::before { color: #0E2439; } +.si-indigo::before { content: "\ef4c"; } +.si-indigo.si--color::before { color: #09009B; } +.si-inductiveautomation::before { content: "\ef4d"; } +.si-inductiveautomation.si--color::before { color: #445C6D; } +.si-inertia::before { content: "\ef4e"; } +.si-inertia.si--color::before { color: #9553E9; } +.si-infiniti::before { content: "\ef4f"; } +.si-infiniti.si--color::before { color: #020B24; } +.si-influxdb::before { content: "\ef50"; } +.si-influxdb.si--color::before { color: #22ADF6; } +.si-infomaniak::before { content: "\ef51"; } +.si-infomaniak.si--color::before { color: #0098FF; } +.si-infoq::before { content: "\ef52"; } +.si-infoq.si--color::before { color: #2C6CAF; } +.si-informatica::before { content: "\ef53"; } +.si-informatica.si--color::before { color: #FF4D00; } +.si-infosys::before { content: "\ef54"; } +.si-infosys.si--color::before { color: #007CC3; } +.si-infracost::before { content: "\ef55"; } +.si-infracost.si--color::before { color: #DB44B8; } +.si-ingress::before { content: "\ef56"; } +.si-ingress.si--color::before { color: #783CBD; } +.si-inkdrop::before { content: "\ef57"; } +.si-inkdrop.si--color::before { color: #7A78D7; } +.si-inkscape::before { content: "\ef58"; } +.si-inkscape.si--color::before { color: #000000; } +.si-inoreader::before { content: "\ef59"; } +.si-inoreader.si--color::before { color: #1875F3; } +.si-insomnia::before { content: "\ef5a"; } +.si-insomnia.si--color::before { color: #4000BF; } +.si-inspire::before { content: "\ef5b"; } +.si-inspire.si--color::before { color: #00E5FF; } +.si-insta360::before { content: "\ef5c"; } +.si-insta360.si--color::before { color: #FFEE00; } +.si-instacart::before { content: "\ef5d"; } +.si-instacart.si--color::before { color: #43B02A; } +.si-instagram::before { content: "\ef5e"; } +.si-instagram.si--color::before { color: #FF0069; } +.si-instapaper::before { content: "\ef5f"; } +.si-instapaper.si--color::before { color: #1F1F1F; } +.si-instatus::before { content: "\ef60"; } +.si-instatus.si--color::before { color: #4EE3C2; } +.si-instructables::before { content: "\ef61"; } +.si-instructables.si--color::before { color: #FABF15; } +.si-instructure::before { content: "\ef62"; } +.si-instructure.si--color::before { color: #2A7BA0; } +.si-intel::before { content: "\ef63"; } +.si-intel.si--color::before { color: #0071C5; } +.si-intellijidea::before { content: "\ef64"; } +.si-intellijidea.si--color::before { color: #000000; } +.si-interactiondesignfoundation::before { content: "\ef65"; } +.si-interactiondesignfoundation.si--color::before { color: #2B2B2B; } +.si-interactjs::before { content: "\ef66"; } +.si-interactjs.si--color::before { color: #2599ED; } +.si-interbase::before { content: "\ef67"; } +.si-interbase.si--color::before { color: #E62431; } +.si-intercom::before { content: "\ef68"; } +.si-intercom.si--color::before { color: #6AFDEF; } +.si-intermarche::before { content: "\ef69"; } +.si-intermarche.si--color::before { color: #E2001A; } +.si-internetarchive::before { content: "\ef6a"; } +.si-internetarchive.si--color::before { color: #666666; } +.si-internetcomputer::before { content: "\ef6b"; } +.si-internetcomputer.si--color::before { color: #3B00B9; } +.si-intigriti::before { content: "\ef6c"; } +.si-intigriti.si--color::before { color: #161A36; } +.si-intuit::before { content: "\ef6d"; } +.si-intuit.si--color::before { color: #236CFF; } +.si-invision::before { content: "\ef6e"; } +.si-invision.si--color::before { color: #FF3366; } +.si-invoiceninja::before { content: "\ef6f"; } +.si-invoiceninja.si--color::before { color: #000000; } +.si-iobroker::before { content: "\ef70"; } +.si-iobroker.si--color::before { color: #3399CC; } +.si-ionic::before { content: "\ef71"; } +.si-ionic.si--color::before { color: #3880FF; } +.si-ionos::before { content: "\ef72"; } +.si-ionos.si--color::before { color: #003D8F; } +.si-ios::before { content: "\ef73"; } +.si-ios.si--color::before { color: #000000; } +.si-iota::before { content: "\ef74"; } +.si-iota.si--color::before { color: #131F37; } +.si-ipfs::before { content: "\ef75"; } +.si-ipfs.si--color::before { color: #65C2CB; } +.si-iris::before { content: "\ef76"; } +.si-iris.si--color::before { color: #25313C; } +.si-irobot::before { content: "\ef77"; } +.si-irobot.si--color::before { color: #6CB86A; } +.si-isc2::before { content: "\ef78"; } +.si-isc2.si--color::before { color: #468145; } +.si-issuu::before { content: "\ef79"; } +.si-issuu.si--color::before { color: #F36D5D; } +.si-istio::before { content: "\ef7a"; } +.si-istio.si--color::before { color: #466BB0; } +.si-itchdotio::before { content: "\ef7b"; } +.si-itchdotio.si--color::before { color: #FA5C5C; } +.si-iterm2::before { content: "\ef7c"; } +.si-iterm2.si--color::before { color: #000000; } +.si-itunes::before { content: "\ef7d"; } +.si-itunes.si--color::before { color: #FB5BC5; } +.si-itvx::before { content: "\ef7e"; } +.si-itvx.si--color::before { color: #DEEB52; } +.si-iveco::before { content: "\ef7f"; } +.si-iveco.si--color::before { color: #1554FF; } +.si-jabber::before { content: "\ef80"; } +.si-jabber.si--color::before { color: #CC0000; } +.si-jaeger::before { content: "\ef81"; } +.si-jaeger.si--color::before { color: #66CFE3; } +.si-jaguar::before { content: "\ef82"; } +.si-jaguar.si--color::before { color: #FFFFFF; } +.si-jamboard::before { content: "\ef83"; } +.si-jamboard.si--color::before { color: #F37C20; } +.si-jameson::before { content: "\ef84"; } +.si-jameson.si--color::before { color: #004027; } +.si-jamstack::before { content: "\ef85"; } +.si-jamstack.si--color::before { color: #F0047F; } +.si-japanairlines::before { content: "\ef86"; } +.si-japanairlines.si--color::before { color: #C00000; } +.si-jasmine::before { content: "\ef87"; } +.si-jasmine.si--color::before { color: #8A4182; } +.si-javascript::before { content: "\ef88"; } +.si-javascript.si--color::before { color: #F7DF1E; } +.si-jbl::before { content: "\ef89"; } +.si-jbl.si--color::before { color: #FF3300; } +.si-jcb::before { content: "\ef8a"; } +.si-jcb.si--color::before { color: #0B4EA2; } +.si-jeep::before { content: "\ef8b"; } +.si-jeep.si--color::before { color: #000000; } +.si-jekyll::before { content: "\ef8c"; } +.si-jekyll.si--color::before { color: #CC0000; } +.si-jellyfin::before { content: "\ef8d"; } +.si-jellyfin.si--color::before { color: #00A4DC; } +.si-jenkins::before { content: "\ef8e"; } +.si-jenkins.si--color::before { color: #D24939; } +.si-jest::before { content: "\ef8f"; } +.si-jest.si--color::before { color: #C21325; } +.si-jet::before { content: "\ef90"; } +.si-jet.si--color::before { color: #FBBA00; } +.si-jetblue::before { content: "\ef91"; } +.si-jetblue.si--color::before { color: #001E59; } +.si-jetbrains::before { content: "\ef92"; } +.si-jetbrains.si--color::before { color: #000000; } +.si-jetpackcompose::before { content: "\ef93"; } +.si-jetpackcompose.si--color::before { color: #4285F4; } +.si-jfrog::before { content: "\ef94"; } +.si-jfrog.si--color::before { color: #40BE46; } +.si-jfrogpipelines::before { content: "\ef95"; } +.si-jfrogpipelines.si--color::before { color: #40BE46; } +.si-jhipster::before { content: "\ef96"; } +.si-jhipster.si--color::before { color: #3E8ACC; } +.si-jinja::before { content: "\ef97"; } +.si-jinja.si--color::before { color: #B41717; } +.si-jio::before { content: "\ef98"; } +.si-jio.si--color::before { color: #0A2885; } +.si-jira::before { content: "\ef99"; } +.si-jira.si--color::before { color: #0052CC; } +.si-jirasoftware::before { content: "\ef9a"; } +.si-jirasoftware.si--color::before { color: #0052CC; } +.si-jitpack::before { content: "\ef9b"; } +.si-jitpack.si--color::before { color: #000000; } +.si-jitsi::before { content: "\ef9c"; } +.si-jitsi.si--color::before { color: #97979A; } +.si-johndeere::before { content: "\ef9d"; } +.si-johndeere.si--color::before { color: #367C2B; } +.si-joomla::before { content: "\ef9e"; } +.si-joomla.si--color::before { color: #5091CD; } +.si-joplin::before { content: "\ef9f"; } +.si-joplin.si--color::before { color: #1071D3; } +.si-jordan::before { content: "\efa0"; } +.si-jordan.si--color::before { color: #000000; } +.si-jouav::before { content: "\efa1"; } +.si-jouav.si--color::before { color: #E1B133; } +.si-jovian::before { content: "\efa2"; } +.si-jovian.si--color::before { color: #0D61FF; } +.si-jpeg::before { content: "\efa3"; } +.si-jpeg.si--color::before { color: #8A8A8A; } +.si-jquery::before { content: "\efa4"; } +.si-jquery.si--color::before { color: #0769AD; } +.si-jrgroup::before { content: "\efa5"; } +.si-jrgroup.si--color::before { color: #44AF35; } +.si-jsdelivr::before { content: "\efa6"; } +.si-jsdelivr.si--color::before { color: #E84D3D; } +.si-jsfiddle::before { content: "\efa7"; } +.si-jsfiddle.si--color::before { color: #0084FF; } +.si-json::before { content: "\efa8"; } +.si-json.si--color::before { color: #000000; } +.si-jsonwebtokens::before { content: "\efa9"; } +.si-jsonwebtokens.si--color::before { color: #000000; } +.si-jsr::before { content: "\efaa"; } +.si-jsr.si--color::before { color: #F7DF1E; } +.si-jss::before { content: "\efab"; } +.si-jss.si--color::before { color: #F7DF1E; } +.si-juce::before { content: "\efac"; } +.si-juce.si--color::before { color: #8DC63F; } +.si-juejin::before { content: "\efad"; } +.si-juejin.si--color::before { color: #007FFF; } +.si-juke::before { content: "\efae"; } +.si-juke.si--color::before { color: #6CD74A; } +.si-julia::before { content: "\efaf"; } +.si-julia.si--color::before { color: #9558B2; } +.si-junipernetworks::before { content: "\efb0"; } +.si-junipernetworks.si--color::before { color: #84B135; } +.si-junit5::before { content: "\efb1"; } +.si-junit5.si--color::before { color: #25A162; } +.si-jupyter::before { content: "\efb2"; } +.si-jupyter.si--color::before { color: #F37626; } +.si-justeat::before { content: "\efb3"; } +.si-justeat.si--color::before { color: #F36D00; } +.si-justgiving::before { content: "\efb4"; } +.si-justgiving.si--color::before { color: #AD29B6; } +.si-k3s::before { content: "\efb5"; } +.si-k3s.si--color::before { color: #FFC61C; } +.si-k6::before { content: "\efb6"; } +.si-k6.si--color::before { color: #7D64FF; } +.si-kaggle::before { content: "\efb7"; } +.si-kaggle.si--color::before { color: #20BEFF; } +.si-kagi::before { content: "\efb8"; } +.si-kagi.si--color::before { color: #FFB319; } +.si-kahoot::before { content: "\efb9"; } +.si-kahoot.si--color::before { color: #46178F; } +.si-kaios::before { content: "\efba"; } +.si-kaios.si--color::before { color: #6F02B5; } +.si-kakao::before { content: "\efbb"; } +.si-kakao.si--color::before { color: #FFCD00; } +.si-kakaotalk::before { content: "\efbc"; } +.si-kakaotalk.si--color::before { color: #FFCD00; } +.si-kalilinux::before { content: "\efbd"; } +.si-kalilinux.si--color::before { color: #557C94; } +.si-kamailio::before { content: "\efbe"; } +.si-kamailio.si--color::before { color: #506365; } +.si-kaniko::before { content: "\efbf"; } +.si-kaniko.si--color::before { color: #FFA600; } +.si-karlsruherverkehrsverbund::before { content: "\efc0"; } +.si-karlsruherverkehrsverbund.si--color::before { color: #9B2321; } +.si-kasasmart::before { content: "\efc1"; } +.si-kasasmart.si--color::before { color: #4ACBD6; } +.si-kashflow::before { content: "\efc2"; } +.si-kashflow.si--color::before { color: #E5426E; } +.si-kaspersky::before { content: "\efc3"; } +.si-kaspersky.si--color::before { color: #006D5C; } +.si-katana::before { content: "\efc4"; } +.si-katana.si--color::before { color: #000000; } +.si-kaufland::before { content: "\efc5"; } +.si-kaufland.si--color::before { color: #E10915; } +.si-kde::before { content: "\efc6"; } +.si-kde.si--color::before { color: #1D99F3; } +.si-kdeplasma::before { content: "\efc7"; } +.si-kdeplasma.si--color::before { color: #1D99F3; } +.si-kdenlive::before { content: "\efc8"; } +.si-kdenlive.si--color::before { color: #527EB2; } +.si-kedro::before { content: "\efc9"; } +.si-kedro.si--color::before { color: #FFC900; } +.si-keenetic::before { content: "\efca"; } +.si-keenetic.si--color::before { color: #009EE2; } +.si-keepachangelog::before { content: "\efcb"; } +.si-keepachangelog.si--color::before { color: #E05735; } +.si-keepassxc::before { content: "\efcc"; } +.si-keepassxc.si--color::before { color: #6CAC4D; } +.si-keeper::before { content: "\efcd"; } +.si-keeper.si--color::before { color: #FFC700; } +.si-keeweb::before { content: "\efce"; } +.si-keeweb.si--color::before { color: #528BFF; } +.si-kentico::before { content: "\efcf"; } +.si-kentico.si--color::before { color: #F05A22; } +.si-keras::before { content: "\efd0"; } +.si-keras.si--color::before { color: #D00000; } +.si-keybase::before { content: "\efd1"; } +.si-keybase.si--color::before { color: #33A0FF; } +.si-keycdn::before { content: "\efd2"; } +.si-keycdn.si--color::before { color: #047AED; } +.si-keycloak::before { content: "\efd3"; } +.si-keycloak.si--color::before { color: #4D4D4D; } +.si-keystone::before { content: "\efd4"; } +.si-keystone.si--color::before { color: #166BFF; } +.si-kfc::before { content: "\efd5"; } +.si-kfc.si--color::before { color: #F40027; } +.si-khanacademy::before { content: "\efd6"; } +.si-khanacademy.si--color::before { color: #14BF96; } +.si-khronosgroup::before { content: "\efd7"; } +.si-khronosgroup.si--color::before { color: #CC3333; } +.si-kia::before { content: "\efd8"; } +.si-kia.si--color::before { color: #05141F; } +.si-kibana::before { content: "\efd9"; } +.si-kibana.si--color::before { color: #005571; } +.si-kicad::before { content: "\efda"; } +.si-kicad.si--color::before { color: #314CB0; } +.si-kick::before { content: "\efdb"; } +.si-kick.si--color::before { color: #53FC19; } +.si-kickstarter::before { content: "\efdc"; } +.si-kickstarter.si--color::before { color: #05CE78; } +.si-kik::before { content: "\efdd"; } +.si-kik.si--color::before { color: #82BC23; } +.si-kingstontechnology::before { content: "\efde"; } +.si-kingstontechnology.si--color::before { color: #000000; } +.si-kinopoisk::before { content: "\efdf"; } +.si-kinopoisk.si--color::before { color: #FF5500; } +.si-kinsta::before { content: "\efe0"; } +.si-kinsta.si--color::before { color: #5333ED; } +.si-kirby::before { content: "\efe1"; } +.si-kirby.si--color::before { color: #000000; } +.si-kit::before { content: "\efe2"; } +.si-kit.si--color::before { color: #000000; } +.si-kitsu::before { content: "\efe3"; } +.si-kitsu.si--color::before { color: #FD755C; } +.si-klarna::before { content: "\efe4"; } +.si-klarna.si--color::before { color: #FFB3C7; } +.si-kleinanzeigen::before { content: "\efe5"; } +.si-kleinanzeigen.si--color::before { color: #1D4B00; } +.si-klm::before { content: "\efe6"; } +.si-klm.si--color::before { color: #00A1DE; } +.si-klook::before { content: "\efe7"; } +.si-klook.si--color::before { color: #FF5722; } +.si-knative::before { content: "\efe8"; } +.si-knative.si--color::before { color: #0865AD; } +.si-knexdotjs::before { content: "\efe9"; } +.si-knexdotjs.si--color::before { color: #D26B38; } +.si-knime::before { content: "\efea"; } +.si-knime.si--color::before { color: #FDD800; } +.si-knip::before { content: "\efeb"; } +.si-knip.si--color::before { color: #F56E0F; } +.si-knowledgebase::before { content: "\efec"; } +.si-knowledgebase.si--color::before { color: #9146FF; } +.si-known::before { content: "\efed"; } +.si-known.si--color::before { color: #333333; } +.si-kofi::before { content: "\efee"; } +.si-kofi.si--color::before { color: #FF6433; } +.si-koa::before { content: "\efef"; } +.si-koa.si--color::before { color: #33333D; } +.si-koc::before { content: "\eff0"; } +.si-koc.si--color::before { color: #F9423A; } +.si-kodak::before { content: "\eff1"; } +.si-kodak.si--color::before { color: #ED0000; } +.si-kodi::before { content: "\eff2"; } +.si-kodi.si--color::before { color: #17B2E7; } +.si-koenigsegg::before { content: "\eff3"; } +.si-koenigsegg.si--color::before { color: #000000; } +.si-kofax::before { content: "\eff4"; } +.si-kofax.si--color::before { color: #00558C; } +.si-komoot::before { content: "\eff5"; } +.si-komoot.si--color::before { color: #6AA127; } +.si-konami::before { content: "\eff6"; } +.si-konami.si--color::before { color: #B60014; } +.si-kong::before { content: "\eff7"; } +.si-kong.si--color::before { color: #003459; } +.si-kongregate::before { content: "\eff8"; } +.si-kongregate.si--color::before { color: #F04438; } +.si-konva::before { content: "\eff9"; } +.si-konva.si--color::before { color: #0D83CD; } +.si-kotlin::before { content: "\effa"; } +.si-kotlin.si--color::before { color: #7F52FF; } +.si-koyeb::before { content: "\effb"; } +.si-koyeb.si--color::before { color: #121212; } +.si-krita::before { content: "\effc"; } +.si-krita.si--color::before { color: #3BABFF; } +.si-ktm::before { content: "\effd"; } +.si-ktm.si--color::before { color: #FF6600; } +.si-ktor::before { content: "\effe"; } +.si-ktor.si--color::before { color: #087CFA; } +.si-kuaishou::before { content: "\efff"; } +.si-kuaishou.si--color::before { color: #FF4906; } +.si-kubernetes::before { content: "\f000"; } +.si-kubernetes.si--color::before { color: #326CE5; } +.si-kubuntu::before { content: "\f001"; } +.si-kubuntu.si--color::before { color: #0079C1; } +.si-kucoin::before { content: "\f002"; } +.si-kucoin.si--color::before { color: #01BC8D; } +.si-kueski::before { content: "\f003"; } +.si-kueski.si--color::before { color: #0075FF; } +.si-kuma::before { content: "\f004"; } +.si-kuma.si--color::before { color: #290B53; } +.si-kununu::before { content: "\f005"; } +.si-kununu.si--color::before { color: #FFC62E; } +.si-kuula::before { content: "\f006"; } +.si-kuula.si--color::before { color: #4092B4; } +.si-kx::before { content: "\f007"; } +.si-kx.si--color::before { color: #101820; } +.si-kyocera::before { content: "\f008"; } +.si-kyocera.si--color::before { color: #DF0522; } +.si-lequipe::before { content: "\f009"; } +.si-lequipe.si--color::before { color: #E42829; } +.si-labview::before { content: "\f00a"; } +.si-labview.si--color::before { color: #FFDB00; } +.si-lada::before { content: "\f00b"; } +.si-lada.si--color::before { color: #ED6B21; } +.si-lamborghini::before { content: "\f00c"; } +.si-lamborghini.si--color::before { color: #B6A272; } +.si-landrover::before { content: "\f00d"; } +.si-landrover.si--color::before { color: #005A2B; } +.si-langchain::before { content: "\f00e"; } +.si-langchain.si--color::before { color: #1C3C3C; } +.si-languagetool::before { content: "\f00f"; } +.si-languagetool.si--color::before { color: #45A1FC; } +.si-lapce::before { content: "\f010"; } +.si-lapce.si--color::before { color: #3B82F6; } +.si-laragon::before { content: "\f011"; } +.si-laragon.si--color::before { color: #0E83CD; } +.si-laravel::before { content: "\f012"; } +.si-laravel.si--color::before { color: #FF2D20; } +.si-laravelhorizon::before { content: "\f013"; } +.si-laravelhorizon.si--color::before { color: #405263; } +.si-laravelnova::before { content: "\f014"; } +.si-laravelnova.si--color::before { color: #252D37; } +.si-lastdotfm::before { content: "\f015"; } +.si-lastdotfm.si--color::before { color: #D51007; } +.si-lastpass::before { content: "\f016"; } +.si-lastpass.si--color::before { color: #D32D27; } +.si-latex::before { content: "\f017"; } +.si-latex.si--color::before { color: #008080; } +.si-launchpad::before { content: "\f018"; } +.si-launchpad.si--color::before { color: #F8C300; } +.si-lazarus::before { content: "\f019"; } +.si-lazarus.si--color::before { color: #000000; } +.si-lazyvim::before { content: "\f01a"; } +.si-lazyvim.si--color::before { color: #2E7DE9; } +.si-lbry::before { content: "\f01b"; } +.si-lbry.si--color::before { color: #2F9176; } +.si-leaderprice::before { content: "\f01c"; } +.si-leaderprice.si--color::before { color: #E50005; } +.si-leaflet::before { content: "\f01d"; } +.si-leaflet.si--color::before { color: #199900; } +.si-leagueoflegends::before { content: "\f01e"; } +.si-leagueoflegends.si--color::before { color: #C28F2C; } +.si-leanpub::before { content: "\f01f"; } +.si-leanpub.si--color::before { color: #262425; } +.si-leetcode::before { content: "\f020"; } +.si-leetcode.si--color::before { color: #FFA116; } +.si-lefthook::before { content: "\f021"; } +.si-lefthook.si--color::before { color: #FF1E1E; } +.si-legacygames::before { content: "\f022"; } +.si-legacygames.si--color::before { color: #144B9E; } +.si-leica::before { content: "\f023"; } +.si-leica.si--color::before { color: #E20612; } +.si-lemmy::before { content: "\f024"; } +.si-lemmy.si--color::before { color: #000000; } +.si-lemonsqueezy::before { content: "\f025"; } +.si-lemonsqueezy.si--color::before { color: #FFC233; } +.si-lenovo::before { content: "\f026"; } +.si-lenovo.si--color::before { color: #E2231A; } +.si-lens::before { content: "\f027"; } +.si-lens.si--color::before { color: #3D90CE; } +.si-leptos::before { content: "\f028"; } +.si-leptos.si--color::before { color: #EF3939; } +.si-lerna::before { content: "\f029"; } +.si-lerna.si--color::before { color: #C084FC; } +.si-leroymerlin::before { content: "\f02a"; } +.si-leroymerlin.si--color::before { color: #78BE20; } +.si-leslibraires::before { content: "\f02b"; } +.si-leslibraires.si--color::before { color: #CF4A0C; } +.si-less::before { content: "\f02c"; } +.si-less.si--color::before { color: #1D365D; } +.si-letsencrypt::before { content: "\f02d"; } +.si-letsencrypt.si--color::before { color: #003A70; } +.si-letterboxd::before { content: "\f02e"; } +.si-letterboxd.si--color::before { color: #202830; } +.si-levelsdotfyi::before { content: "\f02f"; } +.si-levelsdotfyi.si--color::before { color: #788B95; } +.si-lg::before { content: "\f030"; } +.si-lg.si--color::before { color: #A50034; } +.si-lining::before { content: "\f031"; } +.si-lining.si--color::before { color: #C5242C; } +.si-liberadotchat::before { content: "\f032"; } +.si-liberadotchat.si--color::before { color: #FF55DD; } +.si-liberapay::before { content: "\f033"; } +.si-liberapay.si--color::before { color: #F6C915; } +.si-librariesdotio::before { content: "\f034"; } +.si-librariesdotio.si--color::before { color: #337AB7; } +.si-librarything::before { content: "\f035"; } +.si-librarything.si--color::before { color: #251A15; } +.si-libreoffice::before { content: "\f036"; } +.si-libreoffice.si--color::before { color: #18A303; } +.si-libreofficebase::before { content: "\f037"; } +.si-libreofficebase.si--color::before { color: #7324A9; } +.si-libreofficecalc::before { content: "\f038"; } +.si-libreofficecalc.si--color::before { color: #007C3C; } +.si-libreofficedraw::before { content: "\f039"; } +.si-libreofficedraw.si--color::before { color: #CB6D30; } +.si-libreofficeimpress::before { content: "\f03a"; } +.si-libreofficeimpress.si--color::before { color: #D0120D; } +.si-libreofficemath::before { content: "\f03b"; } +.si-libreofficemath.si--color::before { color: #C10018; } +.si-libreofficewriter::before { content: "\f03c"; } +.si-libreofficewriter.si--color::before { color: #083FA6; } +.si-libretranslate::before { content: "\f03d"; } +.si-libretranslate.si--color::before { color: #1565C0; } +.si-libretube::before { content: "\f03e"; } +.si-libretube.si--color::before { color: #FF9699; } +.si-librewolf::before { content: "\f03f"; } +.si-librewolf.si--color::before { color: #00ACFF; } +.si-libuv::before { content: "\f040"; } +.si-libuv.si--color::before { color: #403C3D; } +.si-lichess::before { content: "\f041"; } +.si-lichess.si--color::before { color: #000000; } +.si-lidl::before { content: "\f042"; } +.si-lidl.si--color::before { color: #0050AA; } +.si-lifx::before { content: "\f043"; } +.si-lifx.si--color::before { color: #000000; } +.si-lightburn::before { content: "\f044"; } +.si-lightburn.si--color::before { color: #57182D; } +.si-lighthouse::before { content: "\f045"; } +.si-lighthouse.si--color::before { color: #F44B21; } +.si-lightning::before { content: "\f046"; } +.si-lightning.si--color::before { color: #792EE5; } +.si-limesurvey::before { content: "\f047"; } +.si-limesurvey.si--color::before { color: #14AE5C; } +.si-line::before { content: "\f048"; } +.si-line.si--color::before { color: #00C300; } +.si-lineageos::before { content: "\f049"; } +.si-lineageos.si--color::before { color: #167C80; } +.si-linear::before { content: "\f04a"; } +.si-linear.si--color::before { color: #5E6AD2; } +.si-linkerd::before { content: "\f04b"; } +.si-linkerd.si--color::before { color: #2BEDA7; } +.si-linkfire::before { content: "\f04c"; } +.si-linkfire.si--color::before { color: #FF3850; } +.si-linksys::before { content: "\f04d"; } +.si-linksys.si--color::before { color: #000000; } +.si-linktree::before { content: "\f04e"; } +.si-linktree.si--color::before { color: #43E55E; } +.si-linphone::before { content: "\f04f"; } +.si-linphone.si--color::before { color: #FF5E00; } +.si-lintcode::before { content: "\f050"; } +.si-lintcode.si--color::before { color: #13B4FF; } +.si-linux::before { content: "\f051"; } +.si-linux.si--color::before { color: #FCC624; } +.si-linuxcontainers::before { content: "\f052"; } +.si-linuxcontainers.si--color::before { color: #333333; } +.si-linuxfoundation::before { content: "\f053"; } +.si-linuxfoundation.si--color::before { color: #003778; } +.si-linuxmint::before { content: "\f054"; } +.si-linuxmint.si--color::before { color: #86BE43; } +.si-linuxprofessionalinstitute::before { content: "\f055"; } +.si-linuxprofessionalinstitute.si--color::before { color: #FDC300; } +.si-linuxserver::before { content: "\f056"; } +.si-linuxserver.si--color::before { color: #DA3B8A; } +.si-lionair::before { content: "\f057"; } +.si-lionair.si--color::before { color: #ED3237; } +.si-liquibase::before { content: "\f058"; } +.si-liquibase.si--color::before { color: #2962FF; } +.si-listmonk::before { content: "\f059"; } +.si-listmonk.si--color::before { color: #0055D4; } +.si-lit::before { content: "\f05a"; } +.si-lit.si--color::before { color: #324FFF; } +.si-litecoin::before { content: "\f05b"; } +.si-litecoin.si--color::before { color: #A6A9AA; } +.si-literal::before { content: "\f05c"; } +.si-literal.si--color::before { color: #000000; } +.si-litiengine::before { content: "\f05d"; } +.si-litiengine.si--color::before { color: #00A5BC; } +.si-livechat::before { content: "\f05e"; } +.si-livechat.si--color::before { color: #FF5100; } +.si-livejournal::before { content: "\f05f"; } +.si-livejournal.si--color::before { color: #00B0EA; } +.si-livewire::before { content: "\f060"; } +.si-livewire.si--color::before { color: #4E56A6; } +.si-llvm::before { content: "\f061"; } +.si-llvm.si--color::before { color: #262D3A; } +.si-lmms::before { content: "\f062"; } +.si-lmms.si--color::before { color: #10B146; } +.si-lobsters::before { content: "\f063"; } +.si-lobsters.si--color::before { color: #AC130D; } +.si-local::before { content: "\f064"; } +.si-local.si--color::before { color: #51BB7B; } +.si-lodash::before { content: "\f065"; } +.si-lodash.si--color::before { color: #3492FF; } +.si-logitech::before { content: "\f066"; } +.si-logitech.si--color::before { color: #00B8FC; } +.si-logitechg::before { content: "\f067"; } +.si-logitechg.si--color::before { color: #00B8FC; } +.si-logmein::before { content: "\f068"; } +.si-logmein.si--color::before { color: #45B6F2; } +.si-logseq::before { content: "\f069"; } +.si-logseq.si--color::before { color: #85C8C8; } +.si-logstash::before { content: "\f06a"; } +.si-logstash.si--color::before { color: #005571; } +.si-looker::before { content: "\f06b"; } +.si-looker.si--color::before { color: #4285F4; } +.si-loom::before { content: "\f06c"; } +.si-loom.si--color::before { color: #625DF5; } +.si-loop::before { content: "\f06d"; } +.si-loop.si--color::before { color: #F29400; } +.si-loopback::before { content: "\f06e"; } +.si-loopback.si--color::before { color: #3F5DFF; } +.si-lootcrate::before { content: "\f06f"; } +.si-lootcrate.si--color::before { color: #1E1E1E; } +.si-lospec::before { content: "\f070"; } +.si-lospec.si--color::before { color: #EAEAEA; } +.si-lotpolishairlines::before { content: "\f071"; } +.si-lotpolishairlines.si--color::before { color: #11397E; } +.si-ltspice::before { content: "\f072"; } +.si-ltspice.si--color::before { color: #900028; } +.si-lua::before { content: "\f073"; } +.si-lua.si--color::before { color: #2C2D72; } +.si-lubuntu::before { content: "\f074"; } +.si-lubuntu.si--color::before { color: #0068C8; } +.si-lucia::before { content: "\f075"; } +.si-lucia.si--color::before { color: #5F57FF; } +.si-lucid::before { content: "\f076"; } +.si-lucid.si--color::before { color: #282C33; } +.si-lucide::before { content: "\f077"; } +.si-lucide.si--color::before { color: #F56565; } +.si-ludwig::before { content: "\f078"; } +.si-ludwig.si--color::before { color: #FFFFFF; } +.si-lufthansa::before { content: "\f079"; } +.si-lufthansa.si--color::before { color: #05164D; } +.si-lumen::before { content: "\f07a"; } +.si-lumen.si--color::before { color: #E74430; } +.si-lunacy::before { content: "\f07b"; } +.si-lunacy.si--color::before { color: #179DE3; } +.si-lutris::before { content: "\f07c"; } +.si-lutris.si--color::before { color: #FF9900; } +.si-lvgl::before { content: "\f07d"; } +.si-lvgl.si--color::before { color: #343839; } +.si-lydia::before { content: "\f07e"; } +.si-lydia.si--color::before { color: #0180FF; } +.si-lyft::before { content: "\f07f"; } +.si-lyft.si--color::before { color: #FF00BF; } +.si-maas::before { content: "\f080"; } +.si-maas.si--color::before { color: #E95420; } +.si-macos::before { content: "\f081"; } +.si-macos.si--color::before { color: #000000; } +.si-macpaw::before { content: "\f082"; } +.si-macpaw.si--color::before { color: #000000; } +.si-macys::before { content: "\f083"; } +.si-macys.si--color::before { color: #E21A2C; } +.si-magasinsu::before { content: "\f084"; } +.si-magasinsu.si--color::before { color: #E71B34; } +.si-magic::before { content: "\f085"; } +.si-magic.si--color::before { color: #6851FF; } +.si-magisk::before { content: "\f086"; } +.si-magisk.si--color::before { color: #00AF9C; } +.si-mahindra::before { content: "\f087"; } +.si-mahindra.si--color::before { color: #DD052B; } +.si-maildotcom::before { content: "\f088"; } +.si-maildotcom.si--color::before { color: #004788; } +.si-maildotru::before { content: "\f089"; } +.si-maildotru.si--color::before { color: #005FF9; } +.si-mailboxdotorg::before { content: "\f08a"; } +.si-mailboxdotorg.si--color::before { color: #76BB21; } +.si-mailchimp::before { content: "\f08b"; } +.si-mailchimp.si--color::before { color: #FFE01B; } +.si-mailgun::before { content: "\f08c"; } +.si-mailgun.si--color::before { color: #F06B66; } +.si-mailtrap::before { content: "\f08d"; } +.si-mailtrap.si--color::before { color: #22D172; } +.si-mainwp::before { content: "\f08e"; } +.si-mainwp.si--color::before { color: #7FB100; } +.si-majorleaguehacking::before { content: "\f08f"; } +.si-majorleaguehacking.si--color::before { color: #265A8F; } +.si-make::before { content: "\f090"; } +.si-make.si--color::before { color: #6D00CC; } +.si-makerbot::before { content: "\f091"; } +.si-makerbot.si--color::before { color: #FF1E0D; } +.si-malt::before { content: "\f092"; } +.si-malt.si--color::before { color: #FC5757; } +.si-malwarebytes::before { content: "\f093"; } +.si-malwarebytes.si--color::before { color: #0D3ECC; } +.si-mambaui::before { content: "\f094"; } +.si-mambaui.si--color::before { color: #6D28D9; } +.si-mamp::before { content: "\f095"; } +.si-mamp.si--color::before { color: #02749C; } +.si-man::before { content: "\f096"; } +.si-man.si--color::before { color: #E40045; } +.si-manageiq::before { content: "\f097"; } +.si-manageiq.si--color::before { color: #EF2929; } +.si-manjaro::before { content: "\f098"; } +.si-manjaro.si--color::before { color: #35BF5C; } +.si-mantine::before { content: "\f099"; } +.si-mantine.si--color::before { color: #339AF0; } +.si-mapbox::before { content: "\f09a"; } +.si-mapbox.si--color::before { color: #000000; } +.si-mapillary::before { content: "\f09b"; } +.si-mapillary.si--color::before { color: #00AF66; } +.si-maplibre::before { content: "\f09c"; } +.si-maplibre.si--color::before { color: #396CB2; } +.si-maptiler::before { content: "\f09d"; } +.si-maptiler.si--color::before { color: #323357; } +.si-mariadb::before { content: "\f09e"; } +.si-mariadb.si--color::before { color: #003545; } +.si-mariadbfoundation::before { content: "\f09f"; } +.si-mariadbfoundation.si--color::before { color: #1F305F; } +.si-markdown::before { content: "\f0a0"; } +.si-markdown.si--color::before { color: #000000; } +.si-marko::before { content: "\f0a1"; } +.si-marko.si--color::before { color: #2596BE; } +.si-marriott::before { content: "\f0a2"; } +.si-marriott.si--color::before { color: #A70023; } +.si-marvelapp::before { content: "\f0a3"; } +.si-marvelapp.si--color::before { color: #1FB6FF; } +.si-maserati::before { content: "\f0a4"; } +.si-maserati.si--color::before { color: #0C2340; } +.si-mastercard::before { content: "\f0a5"; } +.si-mastercard.si--color::before { color: #EB001B; } +.si-mastercomfig::before { content: "\f0a6"; } +.si-mastercomfig.si--color::before { color: #009688; } +.si-mastodon::before { content: "\f0a7"; } +.si-mastodon.si--color::before { color: #6364FF; } +.si-materialdesign::before { content: "\f0a8"; } +.si-materialdesign.si--color::before { color: #757575; } +.si-materialdesignicons::before { content: "\f0a9"; } +.si-materialdesignicons.si--color::before { color: #2196F3; } +.si-materialformkdocs::before { content: "\f0aa"; } +.si-materialformkdocs.si--color::before { color: #526CFE; } +.si-matillion::before { content: "\f0ab"; } +.si-matillion.si--color::before { color: #19E57F; } +.si-matomo::before { content: "\f0ac"; } +.si-matomo.si--color::before { color: #3152A0; } +.si-matrix::before { content: "\f0ad"; } +.si-matrix.si--color::before { color: #000000; } +.si-matterdotjs::before { content: "\f0ae"; } +.si-matterdotjs.si--color::before { color: #4B5562; } +.si-mattermost::before { content: "\f0af"; } +.si-mattermost.si--color::before { color: #0058CC; } +.si-matternet::before { content: "\f0b0"; } +.si-matternet.si--color::before { color: #261C29; } +.si-mautic::before { content: "\f0b1"; } +.si-mautic.si--color::before { color: #4E5E9E; } +.si-max::before { content: "\f0b2"; } +.si-max.si--color::before { color: #525252; } +.si-maxplanckgesellschaft::before { content: "\f0b3"; } +.si-maxplanckgesellschaft.si--color::before { color: #006C66; } +.si-maytag::before { content: "\f0b4"; } +.si-maytag.si--color::before { color: #002E5F; } +.si-mazda::before { content: "\f0b5"; } +.si-mazda.si--color::before { color: #101010; } +.si-maze::before { content: "\f0b6"; } +.si-maze.si--color::before { color: #000000; } +.si-mcafee::before { content: "\f0b7"; } +.si-mcafee.si--color::before { color: #C01818; } +.si-mcdonalds::before { content: "\f0b8"; } +.si-mcdonalds.si--color::before { color: #FBC817; } +.si-mclaren::before { content: "\f0b9"; } +.si-mclaren.si--color::before { color: #FF0000; } +.si-mdbook::before { content: "\f0ba"; } +.si-mdbook.si--color::before { color: #000000; } +.si-mdnwebdocs::before { content: "\f0bb"; } +.si-mdnwebdocs.si--color::before { color: #000000; } +.si-mdx::before { content: "\f0bc"; } +.si-mdx.si--color::before { color: #1B1F24; } +.si-mediafire::before { content: "\f0bd"; } +.si-mediafire.si--color::before { color: #1299F3; } +.si-mediamarkt::before { content: "\f0be"; } +.si-mediamarkt.si--color::before { color: #DF0000; } +.si-mediapipe::before { content: "\f0bf"; } +.si-mediapipe.si--color::before { color: #0097A7; } +.si-mediatek::before { content: "\f0c0"; } +.si-mediatek.si--color::before { color: #EC9430; } +.si-medibangpaint::before { content: "\f0c1"; } +.si-medibangpaint.si--color::before { color: #00DBDE; } +.si-medium::before { content: "\f0c2"; } +.si-medium.si--color::before { color: #000000; } +.si-medusa::before { content: "\f0c3"; } +.si-medusa.si--color::before { color: #000000; } +.si-meetup::before { content: "\f0c4"; } +.si-meetup.si--color::before { color: #ED1C40; } +.si-mega::before { content: "\f0c5"; } +.si-mega.si--color::before { color: #D9272E; } +.si-meilisearch::before { content: "\f0c6"; } +.si-meilisearch.si--color::before { color: #FF5CAA; } +.si-meituan::before { content: "\f0c7"; } +.si-meituan.si--color::before { color: #FFD100; } +.si-meizu::before { content: "\f0c8"; } +.si-meizu.si--color::before { color: #FF4132; } +.si-mendeley::before { content: "\f0c9"; } +.si-mendeley.si--color::before { color: #9D1620; } +.si-mentorcruise::before { content: "\f0ca"; } +.si-mentorcruise.si--color::before { color: #172E59; } +.si-mercadopago::before { content: "\f0cb"; } +.si-mercadopago.si--color::before { color: #00B1EA; } +.si-mercedes::before { content: "\f0cc"; } +.si-mercedes.si--color::before { color: #242424; } +.si-merck::before { content: "\f0cd"; } +.si-merck.si--color::before { color: #007A73; } +.si-mercurial::before { content: "\f0ce"; } +.si-mercurial.si--color::before { color: #999999; } +.si-mermaid::before { content: "\f0cf"; } +.si-mermaid.si--color::before { color: #FF3670; } +.si-messenger::before { content: "\f0d0"; } +.si-messenger.si--color::before { color: #00B2FF; } +.si-meta::before { content: "\f0d1"; } +.si-meta.si--color::before { color: #0467DF; } +.si-metabase::before { content: "\f0d2"; } +.si-metabase.si--color::before { color: #509EE3; } +.si-metacritic::before { content: "\f0d3"; } +.si-metacritic.si--color::before { color: #000000; } +.si-metafilter::before { content: "\f0d4"; } +.si-metafilter.si--color::before { color: #065A8F; } +.si-metasploit::before { content: "\f0d5"; } +.si-metasploit.si--color::before { color: #2596CD; } +.si-meteor::before { content: "\f0d6"; } +.si-meteor.si--color::before { color: #DE4F4F; } +.si-metro::before { content: "\f0d7"; } +.si-metro.si--color::before { color: #EF4242; } +.si-metrodelaciudaddemexico::before { content: "\f0d8"; } +.si-metrodelaciudaddemexico.si--color::before { color: #F77E1C; } +.si-metrodemadrid::before { content: "\f0d9"; } +.si-metrodemadrid.si--color::before { color: #255E9C; } +.si-metrodeparis::before { content: "\f0da"; } +.si-metrodeparis.si--color::before { color: #003E95; } +.si-mewe::before { content: "\f0db"; } +.si-mewe.si--color::before { color: #17377F; } +.si-mg::before { content: "\f0dc"; } +.si-mg.si--color::before { color: #FF0000; } +.si-microeditor::before { content: "\f0dd"; } +.si-microeditor.si--color::before { color: #2E3192; } +.si-microbit::before { content: "\f0de"; } +.si-microbit.si--color::before { color: #00ED00; } +.si-microdotblog::before { content: "\f0df"; } +.si-microdotblog.si--color::before { color: #FF8800; } +.si-micropython::before { content: "\f0e0"; } +.si-micropython.si--color::before { color: #2B2728; } +.si-microstation::before { content: "\f0e1"; } +.si-microstation.si--color::before { color: #62BB47; } +.si-microstrategy::before { content: "\f0e2"; } +.si-microstrategy.si--color::before { color: #D9232E; } +.si-midi::before { content: "\f0e3"; } +.si-midi.si--color::before { color: #000000; } +.si-migadu::before { content: "\f0e4"; } +.si-migadu.si--color::before { color: #0043CE; } +.si-mihoyo::before { content: "\f0e5"; } +.si-mihoyo.si--color::before { color: #4EA4DD; } +.si-mikrotik::before { content: "\f0e6"; } +.si-mikrotik.si--color::before { color: #293239; } +.si-milanote::before { content: "\f0e7"; } +.si-milanote.si--color::before { color: #31303A; } +.si-milvus::before { content: "\f0e8"; } +.si-milvus.si--color::before { color: #00A1EA; } +.si-minds::before { content: "\f0e9"; } +.si-minds.si--color::before { color: #FED12F; } +.si-minetest::before { content: "\f0ea"; } +.si-minetest.si--color::before { color: #53AC56; } +.si-mingww64::before { content: "\f0eb"; } +.si-mingww64.si--color::before { color: #000000; } +.si-mini::before { content: "\f0ec"; } +.si-mini.si--color::before { color: #000000; } +.si-minio::before { content: "\f0ed"; } +.si-minio.si--color::before { color: #C72E49; } +.si-mintlify::before { content: "\f0ee"; } +.si-mintlify.si--color::before { color: #18E299; } +.si-minutemailer::before { content: "\f0ef"; } +.si-minutemailer.si--color::before { color: #30B980; } +.si-miraheze::before { content: "\f0f0"; } +.si-miraheze.si--color::before { color: #FFFC00; } +.si-miro::before { content: "\f0f1"; } +.si-miro.si--color::before { color: #050038; } +.si-misskey::before { content: "\f0f2"; } +.si-misskey.si--color::before { color: #A1CA03; } +.si-mitsubishi::before { content: "\f0f3"; } +.si-mitsubishi.si--color::before { color: #E60012; } +.si-mix::before { content: "\f0f4"; } +.si-mix.si--color::before { color: #FF8126; } +.si-mixcloud::before { content: "\f0f5"; } +.si-mixcloud.si--color::before { color: #5000FF; } +.si-mixpanel::before { content: "\f0f6"; } +.si-mixpanel.si--color::before { color: #7856FF; } +.si-mlb::before { content: "\f0f7"; } +.si-mlb.si--color::before { color: #041E42; } +.si-mlflow::before { content: "\f0f8"; } +.si-mlflow.si--color::before { color: #0194E2; } +.si-mobx::before { content: "\f0f9"; } +.si-mobx.si--color::before { color: #FF9955; } +.si-mobxstatetree::before { content: "\f0fa"; } +.si-mobxstatetree.si--color::before { color: #FF7102; } +.si-mocha::before { content: "\f0fb"; } +.si-mocha.si--color::before { color: #8D6748; } +.si-mockserviceworker::before { content: "\f0fc"; } +.si-mockserviceworker.si--color::before { color: #FF6A33; } +.si-modal::before { content: "\f0fd"; } +.si-modal.si--color::before { color: #7FEE64; } +.si-modin::before { content: "\f0fe"; } +.si-modin.si--color::before { color: #001729; } +.si-modrinth::before { content: "\f0ff"; } +.si-modrinth.si--color::before { color: #00AF5C; } +.si-modx::before { content: "\f100"; } +.si-modx.si--color::before { color: #102C53; } +.si-mojeek::before { content: "\f101"; } +.si-mojeek.si--color::before { color: #7AB93C; } +.si-moleculer::before { content: "\f102"; } +.si-moleculer.si--color::before { color: #3CAFCE; } +.si-momenteo::before { content: "\f103"; } +.si-momenteo.si--color::before { color: #5A6AB1; } +.si-monero::before { content: "\f104"; } +.si-monero.si--color::before { color: #FF6600; } +.si-moneygram::before { content: "\f105"; } +.si-moneygram.si--color::before { color: #DA291C; } +.si-mongodb::before { content: "\f106"; } +.si-mongodb.si--color::before { color: #47A248; } +.si-mongoose::before { content: "\f107"; } +.si-mongoose.si--color::before { color: #880000; } +.si-mongoosedotws::before { content: "\f108"; } +.si-mongoosedotws.si--color::before { color: #F04D35; } +.si-monica::before { content: "\f109"; } +.si-monica.si--color::before { color: #2C2B29; } +.si-monkeytie::before { content: "\f10a"; } +.si-monkeytie.si--color::before { color: #1A52C2; } +.si-monkeytype::before { content: "\f10b"; } +.si-monkeytype.si--color::before { color: #E2B714; } +.si-monogame::before { content: "\f10c"; } +.si-monogame.si--color::before { color: #E73C00; } +.si-monoprix::before { content: "\f10d"; } +.si-monoprix.si--color::before { color: #FB1911; } +.si-monster::before { content: "\f10e"; } +.si-monster.si--color::before { color: #6D4C9F; } +.si-monzo::before { content: "\f10f"; } +.si-monzo.si--color::before { color: #14233C; } +.si-moo::before { content: "\f110"; } +.si-moo.si--color::before { color: #00945E; } +.si-moodle::before { content: "\f111"; } +.si-moodle.si--color::before { color: #F98012; } +.si-moonrepo::before { content: "\f112"; } +.si-moonrepo.si--color::before { color: #6F53F3; } +.si-moq::before { content: "\f113"; } +.si-moq.si--color::before { color: #F4BE00; } +.si-moqups::before { content: "\f114"; } +.si-moqups.si--color::before { color: #006BE5; } +.si-morrisons::before { content: "\f115"; } +.si-morrisons.si--color::before { color: #007531; } +.si-moscowmetro::before { content: "\f116"; } +.si-moscowmetro.si--color::before { color: #D9232E; } +.si-motorola::before { content: "\f117"; } +.si-motorola.si--color::before { color: #E1140A; } +.si-movistar::before { content: "\f118"; } +.si-movistar.si--color::before { color: #019DF4; } +.si-mozilla::before { content: "\f119"; } +.si-mozilla.si--color::before { color: #000000; } +.si-mpv::before { content: "\f11a"; } +.si-mpv.si--color::before { color: #691F69; } +.si-mqtt::before { content: "\f11b"; } +.si-mqtt.si--color::before { color: #660066; } +.si-msi::before { content: "\f11c"; } +.si-msi.si--color::before { color: #FF0000; } +.si-msibusiness::before { content: "\f11d"; } +.si-msibusiness.si--color::before { color: #9A8555; } +.si-mta::before { content: "\f11e"; } +.si-mta.si--color::before { color: #0039A6; } +.si-mtr::before { content: "\f11f"; } +.si-mtr.si--color::before { color: #AC2E45; } +.si-mubi::before { content: "\f120"; } +.si-mubi.si--color::before { color: #000000; } +.si-mui::before { content: "\f121"; } +.si-mui.si--color::before { color: #007FFF; } +.si-mulesoft::before { content: "\f122"; } +.si-mulesoft.si--color::before { color: #00A0DF; } +.si-muller::before { content: "\f123"; } +.si-muller.si--color::before { color: #F46519; } +.si-mullvad::before { content: "\f124"; } +.si-mullvad.si--color::before { color: #294D73; } +.si-multisim::before { content: "\f125"; } +.si-multisim.si--color::before { color: #57B685; } +.si-mumble::before { content: "\f126"; } +.si-mumble.si--color::before { color: #000000; } +.si-muo::before { content: "\f127"; } +.si-muo.si--color::before { color: #C60D0D; } +.si-mural::before { content: "\f128"; } +.si-mural.si--color::before { color: #FF4B4B; } +.si-musescore::before { content: "\f129"; } +.si-musescore.si--color::before { color: #1A70B8; } +.si-musicbrainz::before { content: "\f12a"; } +.si-musicbrainz.si--color::before { color: #BA478F; } +.si-mxlinux::before { content: "\f12b"; } +.si-mxlinux.si--color::before { color: #000000; } +.si-myanimelist::before { content: "\f12c"; } +.si-myanimelist.si--color::before { color: #2E51A2; } +.si-myget::before { content: "\f12d"; } +.si-myget.si--color::before { color: #0C79CE; } +.si-myob::before { content: "\f12e"; } +.si-myob.si--color::before { color: #6100A5; } +.si-myspace::before { content: "\f12f"; } +.si-myspace.si--color::before { color: #030303; } +.si-mysql::before { content: "\f130"; } +.si-mysql.si--color::before { color: #4479A1; } +.si-n26::before { content: "\f131"; } +.si-n26.si--color::before { color: #48AC98; } +.si-n8n::before { content: "\f132"; } +.si-n8n.si--color::before { color: #EA4B71; } +.si-namebase::before { content: "\f133"; } +.si-namebase.si--color::before { color: #0068FF; } +.si-namecheap::before { content: "\f134"; } +.si-namecheap.si--color::before { color: #DE3723; } +.si-namemc::before { content: "\f135"; } +.si-namemc.si--color::before { color: #12161A; } +.si-namesilo::before { content: "\f136"; } +.si-namesilo.si--color::before { color: #031B4E; } +.si-namuwiki::before { content: "\f137"; } +.si-namuwiki.si--color::before { color: #008275; } +.si-nano::before { content: "\f138"; } +.si-nano.si--color::before { color: #4A90E2; } +.si-nanostores::before { content: "\f139"; } +.si-nanostores.si--color::before { color: #000000; } +.si-napster::before { content: "\f13a"; } +.si-napster.si--color::before { color: #2259FF; } +.si-nasa::before { content: "\f13b"; } +.si-nasa.si--color::before { color: #E03C31; } +.si-nationalgrid::before { content: "\f13c"; } +.si-nationalgrid.si--color::before { color: #00148C; } +.si-nationalrail::before { content: "\f13d"; } +.si-nationalrail.si--color::before { color: #003366; } +.si-nativescript::before { content: "\f13e"; } +.si-nativescript.si--color::before { color: #65ADF1; } +.si-natsdotio::before { content: "\f13f"; } +.si-natsdotio.si--color::before { color: #27AAE1; } +.si-naver::before { content: "\f140"; } +.si-naver.si--color::before { color: #03C75A; } +.si-nba::before { content: "\f141"; } +.si-nba.si--color::before { color: #253B73; } +.si-nbb::before { content: "\f142"; } +.si-nbb.si--color::before { color: #FF7100; } +.si-nbc::before { content: "\f143"; } +.si-nbc.si--color::before { color: #222222; } +.si-ndr::before { content: "\f144"; } +.si-ndr.si--color::before { color: #0C1754; } +.si-near::before { content: "\f145"; } +.si-near.si--color::before { color: #000000; } +.si-nebula::before { content: "\f146"; } +.si-nebula.si--color::before { color: #2CADFE; } +.si-nec::before { content: "\f147"; } +.si-nec.si--color::before { color: #1414A0; } +.si-neo4j::before { content: "\f148"; } +.si-neo4j.si--color::before { color: #4581C3; } +.si-neovim::before { content: "\f149"; } +.si-neovim.si--color::before { color: #57A143; } +.si-neptune::before { content: "\f14a"; } +.si-neptune.si--color::before { color: #5B69C2; } +.si-nestjs::before { content: "\f14b"; } +.si-nestjs.si--color::before { color: #E0234E; } +.si-netapp::before { content: "\f14c"; } +.si-netapp.si--color::before { color: #0067C5; } +.si-netbsd::before { content: "\f14d"; } +.si-netbsd.si--color::before { color: #FF6600; } +.si-netcup::before { content: "\f14e"; } +.si-netcup.si--color::before { color: #056473; } +.si-netdata::before { content: "\f14f"; } +.si-netdata.si--color::before { color: #00AB44; } +.si-neteasecloudmusic::before { content: "\f150"; } +.si-neteasecloudmusic.si--color::before { color: #D43C33; } +.si-netflix::before { content: "\f151"; } +.si-netflix.si--color::before { color: #E50914; } +.si-netgear::before { content: "\f152"; } +.si-netgear.si--color::before { color: #2C262D; } +.si-netlify::before { content: "\f153"; } +.si-netlify.si--color::before { color: #00C7B7; } +.si-nette::before { content: "\f154"; } +.si-nette.si--color::before { color: #3484D2; } +.si-netto::before { content: "\f155"; } +.si-netto.si--color::before { color: #FFE500; } +.si-neutralinojs::before { content: "\f156"; } +.si-neutralinojs.si--color::before { color: #F89901; } +.si-newbalance::before { content: "\f157"; } +.si-newbalance.si--color::before { color: #CF0A2C; } +.si-newjapanprowrestling::before { content: "\f158"; } +.si-newjapanprowrestling.si--color::before { color: #FF160B; } +.si-newrelic::before { content: "\f159"; } +.si-newrelic.si--color::before { color: #1CE783; } +.si-newyorktimes::before { content: "\f15a"; } +.si-newyorktimes.si--color::before { color: #000000; } +.si-newegg::before { content: "\f15b"; } +.si-newegg.si--color::before { color: #E05E00; } +.si-nexon::before { content: "\f15c"; } +.si-nexon.si--color::before { color: #000000; } +.si-nextdotjs::before { content: "\f15d"; } +.si-nextdotjs.si--color::before { color: #000000; } +.si-nextbilliondotai::before { content: "\f15e"; } +.si-nextbilliondotai.si--color::before { color: #8D5A9E; } +.si-nextcloud::before { content: "\f15f"; } +.si-nextcloud.si--color::before { color: #0082C9; } +.si-nextdns::before { content: "\f160"; } +.si-nextdns.si--color::before { color: #007BFF; } +.si-nextdoor::before { content: "\f161"; } +.si-nextdoor.si--color::before { color: #8ED500; } +.si-nextflow::before { content: "\f162"; } +.si-nextflow.si--color::before { color: #0DC09D; } +.si-nextra::before { content: "\f163"; } +.si-nextra.si--color::before { color: #000000; } +.si-nextui::before { content: "\f164"; } +.si-nextui.si--color::before { color: #000000; } +.si-nexusmods::before { content: "\f165"; } +.si-nexusmods.si--color::before { color: #E6832B; } +.si-nfcore::before { content: "\f166"; } +.si-nfcore.si--color::before { color: #24B064; } +.si-nfc::before { content: "\f167"; } +.si-nfc.si--color::before { color: #002E5F; } +.si-nginx::before { content: "\f168"; } +.si-nginx.si--color::before { color: #009639; } +.si-nginxproxymanager::before { content: "\f169"; } +.si-nginxproxymanager.si--color::before { color: #F15833; } +.si-ngrok::before { content: "\f16a"; } +.si-ngrok.si--color::before { color: #1F1E37; } +.si-ngrx::before { content: "\f16b"; } +.si-ngrx.si--color::before { color: #BA2BD2; } +.si-nhl::before { content: "\f16c"; } +.si-nhl.si--color::before { color: #000000; } +.si-nicehash::before { content: "\f16d"; } +.si-nicehash.si--color::before { color: #FBC342; } +.si-niconico::before { content: "\f16e"; } +.si-niconico.si--color::before { color: #231815; } +.si-nike::before { content: "\f16f"; } +.si-nike.si--color::before { color: #111111; } +.si-nikon::before { content: "\f170"; } +.si-nikon.si--color::before { color: #FFE100; } +.si-nim::before { content: "\f171"; } +.si-nim.si--color::before { color: #FFE953; } +.si-nissan::before { content: "\f172"; } +.si-nissan.si--color::before { color: #C3002F; } +.si-nixos::before { content: "\f173"; } +.si-nixos.si--color::before { color: #5277C3; } +.si-nodered::before { content: "\f174"; } +.si-nodered.si--color::before { color: #8F0000; } +.si-nodedotjs::before { content: "\f175"; } +.si-nodedotjs.si--color::before { color: #5FA04E; } +.si-nodemon::before { content: "\f176"; } +.si-nodemon.si--color::before { color: #76D04B; } +.si-nokia::before { content: "\f177"; } +.si-nokia.si--color::before { color: #005AFF; } +.si-nomad::before { content: "\f178"; } +.si-nomad.si--color::before { color: #00CA8E; } +.si-norco::before { content: "\f179"; } +.si-norco.si--color::before { color: #00FF00; } +.si-nordicsemiconductor::before { content: "\f17a"; } +.si-nordicsemiconductor.si--color::before { color: #00A9CE; } +.si-nordvpn::before { content: "\f17b"; } +.si-nordvpn.si--color::before { color: #4687FF; } +.si-normalizedotcss::before { content: "\f17c"; } +.si-normalizedotcss.si--color::before { color: #E3695F; } +.si-norton::before { content: "\f17d"; } +.si-norton.si--color::before { color: #FFE01A; } +.si-norwegian::before { content: "\f17e"; } +.si-norwegian.si--color::before { color: #D81939; } +.si-notepadplusplus::before { content: "\f17f"; } +.si-notepadplusplus.si--color::before { color: #90E59A; } +.si-notion::before { content: "\f180"; } +.si-notion.si--color::before { color: #000000; } +.si-notist::before { content: "\f181"; } +.si-notist.si--color::before { color: #333333; } +.si-nounproject::before { content: "\f182"; } +.si-nounproject.si--color::before { color: #000000; } +.si-novu::before { content: "\f183"; } +.si-novu.si--color::before { color: #000000; } +.si-now::before { content: "\f184"; } +.si-now.si--color::before { color: #001211; } +.si-npm::before { content: "\f185"; } +.si-npm.si--color::before { color: #CB3837; } +.si-nrwl::before { content: "\f186"; } +.si-nrwl.si--color::before { color: #96D7E8; } +.si-nsis::before { content: "\f187"; } +.si-nsis.si--color::before { color: #01B0F0; } +.si-ntfy::before { content: "\f188"; } +.si-ntfy.si--color::before { color: #317F6F; } +.si-nubank::before { content: "\f189"; } +.si-nubank.si--color::before { color: #820AD1; } +.si-nucleo::before { content: "\f18a"; } +.si-nucleo.si--color::before { color: #252B2D; } +.si-nuget::before { content: "\f18b"; } +.si-nuget.si--color::before { color: #004880; } +.si-nuke::before { content: "\f18c"; } +.si-nuke.si--color::before { color: #000000; } +.si-numba::before { content: "\f18d"; } +.si-numba.si--color::before { color: #00A3E0; } +.si-numpy::before { content: "\f18e"; } +.si-numpy.si--color::before { color: #013243; } +.si-nunjucks::before { content: "\f18f"; } +.si-nunjucks.si--color::before { color: #1C4913; } +.si-nushell::before { content: "\f190"; } +.si-nushell.si--color::before { color: #4E9A06; } +.si-nutanix::before { content: "\f191"; } +.si-nutanix.si--color::before { color: #024DA1; } +.si-nuxt::before { content: "\f192"; } +.si-nuxt.si--color::before { color: #00DC82; } +.si-nvidia::before { content: "\f193"; } +.si-nvidia.si--color::before { color: #76B900; } +.si-nvm::before { content: "\f194"; } +.si-nvm.si--color::before { color: #F4DD4B; } +.si-nx::before { content: "\f195"; } +.si-nx.si--color::before { color: #143055; } +.si-nxp::before { content: "\f196"; } +.si-nxp.si--color::before { color: #000000; } +.si-nzxt::before { content: "\f197"; } +.si-nzxt.si--color::before { color: #000000; } +.si-oreilly::before { content: "\f198"; } +.si-oreilly.si--color::before { color: #D3002D; } +.si-o2::before { content: "\f199"; } +.si-o2.si--color::before { color: #0050FF; } +.si-obb::before { content: "\f19a"; } +.si-obb.si--color::before { color: #E40327; } +.si-obsstudio::before { content: "\f19b"; } +.si-obsstudio.si--color::before { color: #302E31; } +.si-observable::before { content: "\f19c"; } +.si-observable.si--color::before { color: #353E58; } +.si-obsidian::before { content: "\f19d"; } +.si-obsidian.si--color::before { color: #7C3AED; } +.si-obtainium::before { content: "\f19e"; } +.si-obtainium.si--color::before { color: #D2BCFD; } +.si-ocaml::before { content: "\f19f"; } +.si-ocaml.si--color::before { color: #EC6813; } +.si-oclc::before { content: "\f1a0"; } +.si-oclc.si--color::before { color: #007DBA; } +.si-oclif::before { content: "\f1a1"; } +.si-oclif.si--color::before { color: #000000; } +.si-octanerender::before { content: "\f1a2"; } +.si-octanerender.si--color::before { color: #000000; } +.si-octave::before { content: "\f1a3"; } +.si-octave.si--color::before { color: #0790C0; } +.si-octobercms::before { content: "\f1a4"; } +.si-octobercms.si--color::before { color: #DB6A26; } +.si-octoprint::before { content: "\f1a5"; } +.si-octoprint.si--color::before { color: #13C100; } +.si-octopusdeploy::before { content: "\f1a6"; } +.si-octopusdeploy.si--color::before { color: #2F93E0; } +.si-oculus::before { content: "\f1a7"; } +.si-oculus.si--color::before { color: #1C1E20; } +.si-odin::before { content: "\f1a8"; } +.si-odin.si--color::before { color: #3882D2; } +.si-odnoklassniki::before { content: "\f1a9"; } +.si-odnoklassniki.si--color::before { color: #EE8208; } +.si-odoo::before { content: "\f1aa"; } +.si-odoo.si--color::before { color: #714B67; } +.si-odysee::before { content: "\f1ab"; } +.si-odysee.si--color::before { color: #EF1970; } +.si-ohdear::before { content: "\f1ac"; } +.si-ohdear.si--color::before { color: #FF3900; } +.si-okcupid::before { content: "\f1ad"; } +.si-okcupid.si--color::before { color: #0500BE; } +.si-okta::before { content: "\f1ae"; } +.si-okta.si--color::before { color: #007DC1; } +.si-okx::before { content: "\f1af"; } +.si-okx.si--color::before { color: #000000; } +.si-ollama::before { content: "\f1b0"; } +.si-ollama.si--color::before { color: #000000; } +.si-omadacloud::before { content: "\f1b1"; } +.si-omadacloud.si--color::before { color: #10C1D0; } +.si-oneplus::before { content: "\f1b2"; } +.si-oneplus.si--color::before { color: #F5010C; } +.si-onlyfans::before { content: "\f1b3"; } +.si-onlyfans.si--color::before { color: #00AFF0; } +.si-onlyoffice::before { content: "\f1b4"; } +.si-onlyoffice.si--color::before { color: #444444; } +.si-onnx::before { content: "\f1b5"; } +.si-onnx.si--color::before { color: #005CED; } +.si-onstar::before { content: "\f1b6"; } +.si-onstar.si--color::before { color: #003D7D; } +.si-opel::before { content: "\f1b7"; } +.si-opel.si--color::before { color: #F7FF14; } +.si-openaccess::before { content: "\f1b8"; } +.si-openaccess.si--color::before { color: #F68212; } +.si-openbadges::before { content: "\f1b9"; } +.si-openbadges.si--color::before { color: #073B5A; } +.si-openbugbounty::before { content: "\f1ba"; } +.si-openbugbounty.si--color::before { color: #F67909; } +.si-opencollective::before { content: "\f1bb"; } +.si-opencollective.si--color::before { color: #7FADF2; } +.si-opencontainersinitiative::before { content: "\f1bc"; } +.si-opencontainersinitiative.si--color::before { color: #262261; } +.si-opensourcehardware::before { content: "\f1bd"; } +.si-opensourcehardware.si--color::before { color: #0099B0; } +.si-opensourceinitiative::before { content: "\f1be"; } +.si-opensourceinitiative.si--color::before { color: #3DA639; } +.si-openai::before { content: "\f1bf"; } +.si-openai.si--color::before { color: #412991; } +.si-openaigym::before { content: "\f1c0"; } +.si-openaigym.si--color::before { color: #0081A5; } +.si-openapiinitiative::before { content: "\f1c1"; } +.si-openapiinitiative.si--color::before { color: #6BA539; } +.si-openbsd::before { content: "\f1c2"; } +.si-openbsd.si--color::before { color: #F2CA30; } +.si-opencv::before { content: "\f1c3"; } +.si-opencv.si--color::before { color: #5C3EE8; } +.si-openfaas::before { content: "\f1c4"; } +.si-openfaas.si--color::before { color: #3B5EE9; } +.si-opengl::before { content: "\f1c5"; } +.si-opengl.si--color::before { color: #5586A4; } +.si-openhab::before { content: "\f1c6"; } +.si-openhab.si--color::before { color: #E64A19; } +.si-openid::before { content: "\f1c7"; } +.si-openid.si--color::before { color: #F78C40; } +.si-openjdk::before { content: "\f1c8"; } +.si-openjdk.si--color::before { color: #000000; } +.si-openjsfoundation::before { content: "\f1c9"; } +.si-openjsfoundation.si--color::before { color: #0075C9; } +.si-openlayers::before { content: "\f1ca"; } +.si-openlayers.si--color::before { color: #1F6B75; } +.si-openmediavault::before { content: "\f1cb"; } +.si-openmediavault.si--color::before { color: #5DACDF; } +.si-openmined::before { content: "\f1cc"; } +.si-openmined.si--color::before { color: #ED986C; } +.si-opennebula::before { content: "\f1cd"; } +.si-opennebula.si--color::before { color: #0097C2; } +.si-openproject::before { content: "\f1ce"; } +.si-openproject.si--color::before { color: #0770B8; } +.si-openscad::before { content: "\f1cf"; } +.si-openscad.si--color::before { color: #F9D72C; } +.si-opensea::before { content: "\f1d0"; } +.si-opensea.si--color::before { color: #2081E2; } +.si-opensearch::before { content: "\f1d1"; } +.si-opensearch.si--color::before { color: #005EB8; } +.si-openssl::before { content: "\f1d2"; } +.si-openssl.si--color::before { color: #721412; } +.si-openstack::before { content: "\f1d3"; } +.si-openstack.si--color::before { color: #ED1944; } +.si-openstreetmap::before { content: "\f1d4"; } +.si-openstreetmap.si--color::before { color: #7EBC6F; } +.si-opensuse::before { content: "\f1d5"; } +.si-opensuse.si--color::before { color: #73BA25; } +.si-opentelemetry::before { content: "\f1d6"; } +.si-opentelemetry.si--color::before { color: #000000; } +.si-opentext::before { content: "\f1d7"; } +.si-opentext.si--color::before { color: #000000; } +.si-opentofu::before { content: "\f1d8"; } +.si-opentofu.si--color::before { color: #FFDA18; } +.si-openverse::before { content: "\f1d9"; } +.si-openverse.si--color::before { color: #FFE033; } +.si-openvpn::before { content: "\f1da"; } +.si-openvpn.si--color::before { color: #EA7E20; } +.si-openwrt::before { content: "\f1db"; } +.si-openwrt.si--color::before { color: #00B5E2; } +.si-openzeppelin::before { content: "\f1dc"; } +.si-openzeppelin.si--color::before { color: #4E5EE4; } +.si-openzfs::before { content: "\f1dd"; } +.si-openzfs.si--color::before { color: #2A667F; } +.si-opera::before { content: "\f1de"; } +.si-opera.si--color::before { color: #FF1B2D; } +.si-operagx::before { content: "\f1df"; } +.si-operagx.si--color::before { color: #EE2950; } +.si-opnsense::before { content: "\f1e0"; } +.si-opnsense.si--color::before { color: #D94F00; } +.si-oppo::before { content: "\f1e1"; } +.si-oppo.si--color::before { color: #2D683D; } +.si-opsgenie::before { content: "\f1e2"; } +.si-opsgenie.si--color::before { color: #172B4D; } +.si-opslevel::before { content: "\f1e3"; } +.si-opslevel.si--color::before { color: #0A53E0; } +.si-optimism::before { content: "\f1e4"; } +.si-optimism \ No newline at end of file diff --git a/node_modules/sirv/build.js b/node_modules/sirv/build.js new file mode 100644 index 00000000..0c6ed8e2 --- /dev/null +++ b/node_modules/sirv/build.js @@ -0,0 +1,194 @@ +const fs = require('node:fs'); +const { join, normalize, resolve } = require('node:path'); +const { totalist } = require('totalist/sync'); +const { parse } = require('@polka/url'); +const { lookup } = require('mrmime'); + +const noop = () => {}; + +function isMatch(uri, arr) { + for (let i=0; i < arr.length; i++) { + if (arr[i].test(uri)) return true; + } +} + +function toAssume(uri, extns) { + let i=0, x, len=uri.length - 1; + if (uri.charCodeAt(len) === 47) { + uri = uri.substring(0, len); + } + + let arr=[], tmp=`${uri}/index`; + for (; i < extns.length; i++) { + x = extns[i] ? `.${extns[i]}` : ''; + if (uri) arr.push(uri + x); + arr.push(tmp + x); + } + + return arr; +} + +function viaCache(cache, uri, extns) { + let i=0, data, arr=toAssume(uri, extns); + for (; i < arr.length; i++) { + if (data = cache[arr[i]]) return data; + } +} + +function viaLocal(dir, isEtag, uri, extns) { + let i=0, arr=toAssume(uri, extns); + let abs, stats, name, headers; + for (; i < arr.length; i++) { + abs = normalize(join(dir, name=arr[i])); + if (abs.startsWith(dir) && fs.existsSync(abs)) { + stats = fs.statSync(abs); + if (stats.isDirectory()) continue; + headers = toHeaders(name, stats, isEtag); + headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store'; + return { abs, stats, headers }; + } + } +} + +function is404(req, res) { + return (res.statusCode=404,res.end()); +} + +function send(req, res, file, stats, headers) { + let code=200, tmp, opts={}; + headers = { ...headers }; + + for (let key in headers) { + tmp = res.getHeader(key); + if (tmp) headers[key] = tmp; + } + + if (tmp = res.getHeader('content-type')) { + headers['Content-Type'] = tmp; + } + + if (req.headers.range) { + code = 206; + let [x, y] = req.headers.range.replace('bytes=', '').split('-'); + let end = opts.end = parseInt(y, 10) || stats.size - 1; + let start = opts.start = parseInt(x, 10) || 0; + + if (end >= stats.size) { + end = stats.size - 1; + } + + if (start >= stats.size) { + res.setHeader('Content-Range', `bytes */${stats.size}`); + res.statusCode = 416; + return res.end(); + } + + headers['Content-Range'] = `bytes ${start}-${end}/${stats.size}`; + headers['Content-Length'] = (end - start + 1); + headers['Accept-Ranges'] = 'bytes'; + } + + res.writeHead(code, headers); + fs.createReadStream(file, opts).pipe(res); +} + +const ENCODING = { + '.br': 'br', + '.gz': 'gzip', +}; + +function toHeaders(name, stats, isEtag) { + let enc = ENCODING[name.slice(-3)]; + + let ctype = lookup(name.slice(0, enc && -3)) || ''; + if (ctype === 'text/html') ctype += ';charset=utf-8'; + + let headers = { + 'Content-Length': stats.size, + 'Content-Type': ctype, + 'Last-Modified': stats.mtime.toUTCString(), + }; + + if (enc) headers['Content-Encoding'] = enc; + if (isEtag) headers['ETag'] = `W/"${stats.size}-${stats.mtime.getTime()}"`; + + return headers; +} + +module.exports = function (dir, opts={}) { + dir = resolve(dir || '.'); + + let isNotFound = opts.onNoMatch || is404; + let setHeaders = opts.setHeaders || noop; + + let extensions = opts.extensions || ['html', 'htm']; + let gzips = opts.gzip && extensions.map(x => `${x}.gz`).concat('gz'); + let brots = opts.brotli && extensions.map(x => `${x}.br`).concat('br'); + + const FILES = {}; + + let fallback = '/'; + let isEtag = !!opts.etag; + let isSPA = !!opts.single; + if (typeof opts.single === 'string') { + let idx = opts.single.lastIndexOf('.'); + fallback += !!~idx ? opts.single.substring(0, idx) : opts.single; + } + + let ignores = []; + if (opts.ignores !== false) { + ignores.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/); // any extn + if (opts.dotfiles) ignores.push(/\/\.\w/); + else ignores.push(/\/\.well-known/); + [].concat(opts.ignores || []).forEach(x => { + ignores.push(new RegExp(x, 'i')); + }); + } + + let cc = opts.maxAge != null && `public,max-age=${opts.maxAge}`; + if (cc && opts.immutable) cc += ',immutable'; + else if (cc && opts.maxAge === 0) cc += ',must-revalidate'; + + if (!opts.dev) { + totalist(dir, (name, abs, stats) => { + if (/\.well-known[\\+\/]/.test(name)) {} // keep + else if (!opts.dotfiles && /(^\.|[\\+|\/+]\.)/.test(name)) return; + + let headers = toHeaders(name, stats, isEtag); + if (cc) headers['Cache-Control'] = cc; + + FILES['/' + name.normalize().replace(/\\+/g, '/')] = { abs, stats, headers }; + }); + } + + let lookup = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache.bind(0, FILES); + + return function (req, res, next) { + let extns = ['']; + let pathname = parse(req).pathname; + let val = req.headers['accept-encoding'] || ''; + if (gzips && val.includes('gzip')) extns.unshift(...gzips); + if (brots && /(br|brotli)/i.test(val)) extns.unshift(...brots); + extns.push(...extensions); // [...br, ...gz, orig, ...exts] + + if (pathname.indexOf('%') !== -1) { + try { pathname = decodeURI(pathname) } + catch (err) { /* malform uri */ } + } + + let data = lookup(pathname, extns) || isSPA && !isMatch(pathname, ignores) && lookup(fallback, extns); + if (!data) return next ? next() : isNotFound(req, res); + + if (isEtag && req.headers['if-none-match'] === data.headers['ETag']) { + res.writeHead(304); + return res.end(); + } + + if (gzips || brots) { + res.setHeader('Vary', 'Accept-Encoding'); + } + + setHeaders(res, pathname, data.stats); + send(req, res, data.abs, data.stats, data.headers); + }; +} diff --git a/node_modules/sirv/build.mjs b/node_modules/sirv/build.mjs new file mode 100644 index 00000000..3ad14d45 --- /dev/null +++ b/node_modules/sirv/build.mjs @@ -0,0 +1,194 @@ +import * as fs from 'node:fs'; +import { join, normalize, resolve } from 'node:path'; +import { totalist } from 'totalist/sync'; +import { parse } from '@polka/url'; +import { lookup } from 'mrmime'; + +const noop = () => {}; + +function isMatch(uri, arr) { + for (let i=0; i < arr.length; i++) { + if (arr[i].test(uri)) return true; + } +} + +function toAssume(uri, extns) { + let i=0, x, len=uri.length - 1; + if (uri.charCodeAt(len) === 47) { + uri = uri.substring(0, len); + } + + let arr=[], tmp=`${uri}/index`; + for (; i < extns.length; i++) { + x = extns[i] ? `.${extns[i]}` : ''; + if (uri) arr.push(uri + x); + arr.push(tmp + x); + } + + return arr; +} + +function viaCache(cache, uri, extns) { + let i=0, data, arr=toAssume(uri, extns); + for (; i < arr.length; i++) { + if (data = cache[arr[i]]) return data; + } +} + +function viaLocal(dir, isEtag, uri, extns) { + let i=0, arr=toAssume(uri, extns); + let abs, stats, name, headers; + for (; i < arr.length; i++) { + abs = normalize(join(dir, name=arr[i])); + if (abs.startsWith(dir) && fs.existsSync(abs)) { + stats = fs.statSync(abs); + if (stats.isDirectory()) continue; + headers = toHeaders(name, stats, isEtag); + headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store'; + return { abs, stats, headers }; + } + } +} + +function is404(req, res) { + return (res.statusCode=404,res.end()); +} + +function send(req, res, file, stats, headers) { + let code=200, tmp, opts={}; + headers = { ...headers }; + + for (let key in headers) { + tmp = res.getHeader(key); + if (tmp) headers[key] = tmp; + } + + if (tmp = res.getHeader('content-type')) { + headers['Content-Type'] = tmp; + } + + if (req.headers.range) { + code = 206; + let [x, y] = req.headers.range.replace('bytes=', '').split('-'); + let end = opts.end = parseInt(y, 10) || stats.size - 1; + let start = opts.start = parseInt(x, 10) || 0; + + if (end >= stats.size) { + end = stats.size - 1; + } + + if (start >= stats.size) { + res.setHeader('Content-Range', `bytes */${stats.size}`); + res.statusCode = 416; + return res.end(); + } + + headers['Content-Range'] = `bytes ${start}-${end}/${stats.size}`; + headers['Content-Length'] = (end - start + 1); + headers['Accept-Ranges'] = 'bytes'; + } + + res.writeHead(code, headers); + fs.createReadStream(file, opts).pipe(res); +} + +const ENCODING = { + '.br': 'br', + '.gz': 'gzip', +}; + +function toHeaders(name, stats, isEtag) { + let enc = ENCODING[name.slice(-3)]; + + let ctype = lookup(name.slice(0, enc && -3)) || ''; + if (ctype === 'text/html') ctype += ';charset=utf-8'; + + let headers = { + 'Content-Length': stats.size, + 'Content-Type': ctype, + 'Last-Modified': stats.mtime.toUTCString(), + }; + + if (enc) headers['Content-Encoding'] = enc; + if (isEtag) headers['ETag'] = `W/"${stats.size}-${stats.mtime.getTime()}"`; + + return headers; +} + +export default function (dir, opts={}) { + dir = resolve(dir || '.'); + + let isNotFound = opts.onNoMatch || is404; + let setHeaders = opts.setHeaders || noop; + + let extensions = opts.extensions || ['html', 'htm']; + let gzips = opts.gzip && extensions.map(x => `${x}.gz`).concat('gz'); + let brots = opts.brotli && extensions.map(x => `${x}.br`).concat('br'); + + const FILES = {}; + + let fallback = '/'; + let isEtag = !!opts.etag; + let isSPA = !!opts.single; + if (typeof opts.single === 'string') { + let idx = opts.single.lastIndexOf('.'); + fallback += !!~idx ? opts.single.substring(0, idx) : opts.single; + } + + let ignores = []; + if (opts.ignores !== false) { + ignores.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/); // any extn + if (opts.dotfiles) ignores.push(/\/\.\w/); + else ignores.push(/\/\.well-known/); + [].concat(opts.ignores || []).forEach(x => { + ignores.push(new RegExp(x, 'i')); + }); + } + + let cc = opts.maxAge != null && `public,max-age=${opts.maxAge}`; + if (cc && opts.immutable) cc += ',immutable'; + else if (cc && opts.maxAge === 0) cc += ',must-revalidate'; + + if (!opts.dev) { + totalist(dir, (name, abs, stats) => { + if (/\.well-known[\\+\/]/.test(name)) {} // keep + else if (!opts.dotfiles && /(^\.|[\\+|\/+]\.)/.test(name)) return; + + let headers = toHeaders(name, stats, isEtag); + if (cc) headers['Cache-Control'] = cc; + + FILES['/' + name.normalize().replace(/\\+/g, '/')] = { abs, stats, headers }; + }); + } + + let lookup = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache.bind(0, FILES); + + return function (req, res, next) { + let extns = ['']; + let pathname = parse(req).pathname; + let val = req.headers['accept-encoding'] || ''; + if (gzips && val.includes('gzip')) extns.unshift(...gzips); + if (brots && /(br|brotli)/i.test(val)) extns.unshift(...brots); + extns.push(...extensions); // [...br, ...gz, orig, ...exts] + + if (pathname.indexOf('%') !== -1) { + try { pathname = decodeURI(pathname) } + catch (err) { /* malform uri */ } + } + + let data = lookup(pathname, extns) || isSPA && !isMatch(pathname, ignores) && lookup(fallback, extns); + if (!data) return next ? next() : isNotFound(req, res); + + if (isEtag && req.headers['if-none-match'] === data.headers['ETag']) { + res.writeHead(304); + return res.end(); + } + + if (gzips || brots) { + res.setHeader('Vary', 'Accept-Encoding'); + } + + setHeaders(res, pathname, data.stats); + send(req, res, data.abs, data.stats, data.headers); + }; +} diff --git a/node_modules/sirv/index.d.mts b/node_modules/sirv/index.d.mts new file mode 100644 index 00000000..8bfe364f --- /dev/null +++ b/node_modules/sirv/index.d.mts @@ -0,0 +1,29 @@ +import type { Stats } from "node:fs"; +import type { IncomingMessage, ServerResponse } from "node:http"; + +type Arrayable = T | T[]; + +export type NextHandler = () => void | Promise; + +export type RequestHandler = ( + req: IncomingMessage, + res: ServerResponse, + next?: NextHandler, +) => void; + +export interface Options { + dev?: boolean; + etag?: boolean; + maxAge?: number; + immutable?: boolean; + single?: string | boolean; + ignores?: false | Arrayable; + extensions?: string[]; + dotfiles?: boolean; + brotli?: boolean; + gzip?: boolean; + onNoMatch?: (req: IncomingMessage, res: ServerResponse) => void; + setHeaders?: (res: ServerResponse, pathname: string, stats: Stats) => void; +} + +export default function (dir?: string, opts?: Options): RequestHandler; diff --git a/node_modules/sirv/index.d.ts b/node_modules/sirv/index.d.ts new file mode 100644 index 00000000..96cc63e7 --- /dev/null +++ b/node_modules/sirv/index.d.ts @@ -0,0 +1,33 @@ +import type { Stats } from "node:fs"; +import type { IncomingMessage, ServerResponse } from "node:http"; + +declare namespace sirv { + type Arrayable = T | T[]; + + export type NextHandler = () => void | Promise; + + export type RequestHandler = ( + req: IncomingMessage, + res: ServerResponse, + next?: NextHandler, + ) => void; + + export interface Options { + dev?: boolean; + etag?: boolean; + maxAge?: number; + immutable?: boolean; + single?: string | boolean; + ignores?: false | Arrayable; + extensions?: string[]; + dotfiles?: boolean; + brotli?: boolean; + gzip?: boolean; + onNoMatch?: (req: IncomingMessage, res: ServerResponse) => void; + setHeaders?: (res: ServerResponse, pathname: string, stats: Stats) => void; + } +} + +declare function sirv(dir?: string, opts?: sirv.Options): sirv.RequestHandler; + +export = sirv; diff --git a/node_modules/sirv/package.json b/node_modules/sirv/package.json new file mode 100644 index 00000000..a45c69c1 --- /dev/null +++ b/node_modules/sirv/package.json @@ -0,0 +1,40 @@ +{ + "name": "sirv", + "version": "3.0.0", + "description": "The optimized & lightweight middleware for serving requests to static assets", + "repository": "lukeed/sirv", + "module": "build.mjs", + "types": "sirv.d.ts", + "main": "build.js", + "license": "MIT", + "files": [ + "build.*", + "index.d.*" + ], + "exports": { + ".": { + "import": { + "types": "./index.d.mts", + "default": "./build.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./build.js" + } + }, + "./package.json": "./package.json" + }, + "author": { + "name": "Luke Edwards", + "email": "luke@lukeed.com", + "url": "https://lukeed.com" + }, + "engines": { + "node": ">=18" + }, + "dependencies": { + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" + } +} \ No newline at end of file diff --git a/node_modules/sirv/readme.md b/node_modules/sirv/readme.md new file mode 100644 index 00000000..d4a56da2 --- /dev/null +++ b/node_modules/sirv/readme.md @@ -0,0 +1,238 @@ +# sirv ![CI](https://github.com/lukeed/sirv/workflows/CI/badge.svg) + +> The optimized and lightweight middleware for serving requests to static assets + +You may use `sirv` as a *very* fast and lightweight alternative to [`serve-static`](https://www.npmjs.com/package/serve-static). + +The massive performance advantage over `serve-static` is explained by **not** relying on the file system for existence checks on every request. These are expensive interactions and must be avoided whenever possible! Instead, when not in "dev" mode, `sirv` performs all its file-system operations upfront and then relies on its cache for future operations. + +This middleware will work out of the box for [Polka](https://github.com/lukeed/polka), Express, and other Express-like frameworks. It will also work with the native `http`, `https` and `http2` modules. It requires _very_ little effort to modify/wrap it for servers that don't accept the `(req, res, next)` signature. + +:bulb: For a feature-complete CLI application, check out the sibling [`sirv-cli`](https://github.com/lukeed/sirv/tree/master/packages/sirv-cli) package as an alternative to [`zeit/serve`](https://github.com/zeit/serve)~! + +## Install + +``` +$ npm install --save sirv +``` + + +## Usage + +```js +const sirv = require('sirv'); +const polka = require('polka'); +const compress = require('compression')(); + +// Init `sirv` handler +const assets = sirv('public', { + maxAge: 31536000, // 1Y + immutable: true +}); + +polka() + .use(compress, assets) + .use('/api', require('./api')) + .listen(3000, err => { + if (err) throw err; + console.log('> Ready on localhost:3000~!'); + }); +``` + + +## API + +### sirv(dir, opts={}) + +Returns: `Function` + +The returned function is a middleware in the standard Express-like signature: `(req, res, next)`, where `req` is the [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage), `res` is the [`http.ServerResponse`](https://nodejs.org/dist/latest-v9.x/docs/api/http.html#http_class_http_serverresponse), and `next` (in this case) is the function to call if no file was found for the given path. + +When defined, a `next()` callback is always called _instead of_ the [`opts.onNoMatch`](#optsonnomatch) callback. However, unlike `onNoMatch`, your `next()` is given no arguments. + +#### dir +Type: `String`
    +Default: `.` + +The directory from which to read and serve assets. It is resolved to an absolute path — you must provide an absolute path yourself if `process.cwd()` is not the correct assumption. + +#### opts.dev +Type: `Boolean`
    +Default: `false` + +Enable "dev" mode, which disables/skips caching. Instead, `sirv` will traverse the file system ***on every request***. + +Additionally, `dev` mode will ignore `maxAge` and `immutable` as these options generate a production-oriented `Cache-Control` header value. + +> **Important:** Do not use `dev` mode in production! + +#### opts.etag +Type: `Boolean`
    +Default: `false` + +Generate and attach an `ETag` header to responses. + +> **Note:** If an incoming request's [`If-None-Match` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match) matches the `ETag` value, a `304` response is given. + +#### opts.dotfiles +Type: `Boolean`
    +Default: `false` + +Allow requests to dotfiles (files or directories beginning with a `.`). + +> **Note:** Requests to [`/.well-known/*`](https://tools.ietf.org/html/rfc8615) are always allowed. + +#### opts.extensions +Type: `Array`
    +Default: `['html', 'htm']` + +The file extension fallbacks to check for if a pathame is not initially found. For example, if a `/login` request cannot find a `login` filename, it will then look for `login.html` and `login.htm` before giving up~! + +> **Important:** Actually, `sirv` will **also** look for `login/index.html` and `login/index.htm` before giving up. + +#### opts.gzip +Type: `Boolean`
    +Default: `false` + +Determine if `sirv` look for **precompiled** `*.gz` files.
    +Must be enabled _and_ the incoming request's [`Accept Encoding`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) must include "gzip" in order for `sirv` to search for the gzip'd alternative. + +> **Note:** The `.gz` assumption also applies to the `opts.extensions` list. + +```js +// NOTE: PSEUDO CODE +// Showing lookup logic + +// Request: [Accept-Encoding: gzip] "/foobar.jpg" +lookup([ + '/foobar.jpg.gz', '/foobar.jpg', + '/foobar.jpg.html.gz', '/foobar.jpg/index.html.gz', + '/foobar.jpg.htm.gz', '/foobar.jpg/index.htm.gz', + '/foobar.jpg.html', '/foobar.jpg/index.html', + '/foobar.jpg.htm', '/foobar.jpg/index.htm', +]); + +// Request: [Accept-Encoding: gzip] "/" +lookup([ + '/index.html.gz', + '/index.htm.gz', + '/index.html', + '/index.htm', +]); +``` + + +#### opts.brotli +Type: `Boolean`
    +Default: `false` + +Determine if `sirv` look for **precompiled** `*.br` files.
    +Must be enabled _and_ the incoming request's [`Accept Encoding`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) must include either "br" or "brotli" in order for `sirv` to search for the brotli-compressed alternative. + +> **Note:** The `.br` assumption also applies to the `opts.extensions` list. + +When both `opts.broli` and `opts.gzip` are enabled — and all conditions are equal — then the brotli variant always takes priority. + +```js +// NOTE: PSEUDO CODE +// Showing lookup logic + +// Request: [Accept-Encoding: br] "/foobar.jpg" +lookup([ + '/foobar.jpg.br', '/foobar.jpg', + '/foobar.jpg.html.br', '/foobar.jpg/index.html.br', + '/foobar.jpg.htm.br', '/foobar.jpg/index.htm.br', + '/foobar.jpg.html', '/foobar.jpg/index.html', + '/foobar.jpg.htm', '/foobar.jpg/index.htm', +]); + +// Request: [Accept-Encoding: br,gz] "/" +lookup([ + '/index.html.br' + '/index.htm.br' + '/index.html.gz' + '/index.htm.gz' + '/index.html' + '/index.htm' +]); +``` + +#### opts.maxAge +Type: `Number`
    +Default: `undefined` + +Enables the `Cache-Control` header on responses and sets the `max-age` value (in seconds).
    +For example, `maxAge: 31536000` is equivalent to one year. + +#### opts.immutable +Type: `Boolean`
    +Default: `false` + +Appends the [`immutable` directive](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#Revalidation_and_reloading) on your `Cache-Control` header, used for uniquely-named assets that will not change! + +> **Important:** Will only work if `opts.maxAge` has a value defined! + +#### opts.single +Type: `Boolean` or `String`
    +Default: `false` + +Treat the directory as a single-page application. + +When `true`, the directory's index page (default `index.html`) will be sent if the request asset does not exist.
    +You may pass a `string` value to use a file _instead of_ `index.html` as your fallback. + +For example, if "/about" is requested but no variants of that file exist, then the response for "/" is sent instead: + +```js +// Note: This is psuedo code to illustrate what's happening + +// Request: "/about" +let file = find(['/about', '/about.html', '/about.htm', '/about/index.html', '/about.htm']); +if (file) { + send(file); +} else if (opts.single === true) { + file = find(['/', '/index.html', '/index.htm']); + send(file); +} else if (typeof opts.single === 'string') { + file = find([opts.single]); + send(file); +} else { + // next() or 404 +} +``` + +#### opts.ignores +Type: `false` or `Array` + +Specify paths/patterns that should ignore the fallback behavior that `opts.single` provides. + +By default, any asset-like path (URLs that end with an extension) will be ignored. This means that, for example, if `/foobar.jpg` is not found, a `404` response is sent instead of the `index.html` fallback. + +Additionally, any `/.well-known/*` pathname ignores the fallback – as do all other dotfile requests when `opts.dotfiles` is enabled. + +Any string value(s) will be passed through `new RegExp(value, 'i')` directly. + +Finally, you may set `ignores: false` to disable ***all*** ignores, including the defaults. Put differently, this will fallback ***all*** unknown pathnames to your `index.html` (or custom `opts.single` value). + +> **Important:** Only has an effect if `opts.single` is enabled. + +#### opts.onNoMatch +Type: `Function` + +A custom function to run if a file cannot be found for a given request.
    By default, `sirv` will send a basic `(404) Not found` response. + +The function receives the current `req , res ` pair for as its two arguments. + +> **Note:** This won't run if a `next` callback has been provided to the middleware; see [`sirv`](#sirvdir-opts) description. + +#### opts.setHeaders +Type: `Function` + +A custom function to append or change any headers on the outgoing response. There is no default. + +Its signature is `(res, pathname, stats)`, where `res` is the `ServerResponse`, `pathname` is incoming request path (stripped of queries), and `stats` is the file's result from [`fs.statSync`](https://nodejs.org/api/fs.html#fs_fs_statsync_path). + + +## License + +MIT © [Luke Edwards](https://lukeed.com) diff --git a/node_modules/slash/index.d.ts b/node_modules/slash/index.d.ts new file mode 100644 index 00000000..f9d07d11 --- /dev/null +++ b/node_modules/slash/index.d.ts @@ -0,0 +1,25 @@ +/** +Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`. + +[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters. + +@param path - A Windows backslash path. +@returns A path with forward slashes. + +@example +``` +import * as path from 'path'; +import slash = require('slash'); + +const string = path.join('foo', 'bar'); +// Unix => foo/bar +// Windows => foo\\bar + +slash(string); +// Unix => foo/bar +// Windows => foo/bar +``` +*/ +declare function slash(path: string): string; + +export = slash; diff --git a/node_modules/slash/index.js b/node_modules/slash/index.js new file mode 100644 index 00000000..103fbea9 --- /dev/null +++ b/node_modules/slash/index.js @@ -0,0 +1,11 @@ +'use strict'; +module.exports = path => { + const isExtendedLengthPath = /^\\\\\?\\/.test(path); + const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex + + if (isExtendedLengthPath || hasNonAscii) { + return path; + } + + return path.replace(/\\/g, '/'); +}; diff --git a/node_modules/slash/license b/node_modules/slash/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/slash/license @@ -0,0 +1,9 @@ +MIT License + +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/slash/package.json b/node_modules/slash/package.json new file mode 100644 index 00000000..c88fcc71 --- /dev/null +++ b/node_modules/slash/package.json @@ -0,0 +1,35 @@ +{ + "name": "slash", + "version": "3.0.0", + "description": "Convert Windows backslash paths to slash paths", + "license": "MIT", + "repository": "sindresorhus/slash", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "path", + "seperator", + "slash", + "backslash", + "windows", + "convert" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/slash/readme.md b/node_modules/slash/readme.md new file mode 100644 index 00000000..f0ef4acb --- /dev/null +++ b/node_modules/slash/readme.md @@ -0,0 +1,44 @@ +# slash [![Build Status](https://travis-ci.org/sindresorhus/slash.svg?branch=master)](https://travis-ci.org/sindresorhus/slash) + +> Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar` + +[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters. + +This was created since the `path` methods in Node.js outputs `\\` paths on Windows. + + +## Install + +``` +$ npm install slash +``` + + +## Usage + +```js +const path = require('path'); +const slash = require('slash'); + +const string = path.join('foo', 'bar'); +// Unix => foo/bar +// Windows => foo\\bar + +slash(string); +// Unix => foo/bar +// Windows => foo/bar +``` + + +## API + +### slash(path) + +Type: `string` + +Accepts a Windows backslash path and returns a path with forward slashes. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/source-map-js/LICENSE b/node_modules/source-map-js/LICENSE new file mode 100644 index 00000000..ed1b7cf2 --- /dev/null +++ b/node_modules/source-map-js/LICENSE @@ -0,0 +1,28 @@ + +Copyright (c) 2009-2011, Mozilla Foundation and 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: + +* 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 names of the Mozilla Foundation nor the names of project + 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 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/source-map-js/README.md b/node_modules/source-map-js/README.md new file mode 100644 index 00000000..614962d7 --- /dev/null +++ b/node_modules/source-map-js/README.md @@ -0,0 +1,765 @@ +# Source Map JS + +[![NPM](https://nodei.co/npm/source-map-js.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map-js) + +Difference between original [source-map](https://github.com/mozilla/source-map): + +> TL,DR: it's fork of original source-map@0.6, but with perfomance optimizations. + +This journey starts from [source-map@0.7.0](https://github.com/mozilla/source-map/blob/master/CHANGELOG.md#070). Some part of it was rewritten to Rust and WASM and API became async. + +It's still a major block for many libraries like PostCSS or Sass for example because they need to migrate the whole API to the async way. This is the reason why 0.6.1 has 2x more downloads than 0.7.3 while it's faster several times. + +![Downloads count](media/downloads.png) + +More important that WASM version has some optimizations in JS code too. This is why [community asked to create branch for 0.6 version](https://github.com/mozilla/source-map/issues/324) and port these optimizations but, sadly, the answer was «no». A bit later I discovered [the issue](https://github.com/mozilla/source-map/issues/370) created by [Ben Rothman (@benthemonkey)](https://github.com/benthemonkey) with no response at all. + +[Roman Dvornov (@lahmatiy)](https://github.com/lahmatiy) wrote a [serveral posts](https://t.me/gorshochekvarit/76) (russian, only, sorry) about source-map library in his own Telegram channel. He mentioned the article [«Maybe you don't need Rust and WASM to speed up your JS»](https://mrale.ph/blog/2018/02/03/maybe-you-dont-need-rust-to-speed-up-your-js.html) written by [Vyacheslav Egorov (@mraleph)](https://github.com/mraleph). This article contains optimizations and hacks that lead to almost the same performance compare to WASM implementation. + +I decided to fork the original source-map and port these optimizations from the article and several others PR from the original source-map. + +--------- + +This is a library to generate and consume the source map format +[described here][format]. + +[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit + +## Use with Node + + $ npm install source-map-js + + + +-------------------------------------------------------------------------------- + + + + + +## Table of Contents + +- [Examples](#examples) + - [Consuming a source map](#consuming-a-source-map) + - [Generating a source map](#generating-a-source-map) + - [With SourceNode (high level API)](#with-sourcenode-high-level-api) + - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api) +- [API](#api) + - [SourceMapConsumer](#sourcemapconsumer) + - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap) + - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans) + - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition) + - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition) + - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition) + - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources) + - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing) + - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order) + - [SourceMapGenerator](#sourcemapgenerator) + - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap) + - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer) + - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping) + - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent) + - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath) + - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring) + - [SourceNode](#sourcenode) + - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name) + - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath) + - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk) + - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk) + - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent) + - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn) + - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn) + - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep) + - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement) + - [SourceNode.prototype.toString()](#sourcenodeprototypetostring) + - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap) + + + +## Examples + +### Consuming a source map + +```js +var rawSourceMap = { + version: 3, + file: 'min.js', + names: ['bar', 'baz', 'n'], + sources: ['one.js', 'two.js'], + sourceRoot: 'http://example.com/www/js/', + mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA' +}; + +var smc = new SourceMapConsumer(rawSourceMap); + +console.log(smc.sources); +// [ 'http://example.com/www/js/one.js', +// 'http://example.com/www/js/two.js' ] + +console.log(smc.originalPositionFor({ + line: 2, + column: 28 +})); +// { source: 'http://example.com/www/js/two.js', +// line: 2, +// column: 10, +// name: 'n' } + +console.log(smc.generatedPositionFor({ + source: 'http://example.com/www/js/two.js', + line: 2, + column: 10 +})); +// { line: 2, column: 28 } + +smc.eachMapping(function (m) { + // ... +}); +``` + +### Generating a source map + +In depth guide: +[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/) + +#### With SourceNode (high level API) + +```js +function compile(ast) { + switch (ast.type) { + case 'BinaryExpression': + return new SourceNode( + ast.location.line, + ast.location.column, + ast.location.source, + [compile(ast.left), " + ", compile(ast.right)] + ); + case 'Literal': + return new SourceNode( + ast.location.line, + ast.location.column, + ast.location.source, + String(ast.value) + ); + // ... + default: + throw new Error("Bad AST"); + } +} + +var ast = parse("40 + 2", "add.js"); +console.log(compile(ast).toStringWithSourceMap({ + file: 'add.js' +})); +// { code: '40 + 2', +// map: [object SourceMapGenerator] } +``` + +#### With SourceMapGenerator (low level API) + +```js +var map = new SourceMapGenerator({ + file: "source-mapped.js" +}); + +map.addMapping({ + generated: { + line: 10, + column: 35 + }, + source: "foo.js", + original: { + line: 33, + column: 2 + }, + name: "christopher" +}); + +console.log(map.toString()); +// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}' +``` + +## API + +Get a reference to the module: + +```js +// Node.js +var sourceMap = require('source-map'); + +// Browser builds +var sourceMap = window.sourceMap; + +// Inside Firefox +const sourceMap = require("devtools/toolkit/sourcemap/source-map.js"); +``` + +### SourceMapConsumer + +A SourceMapConsumer instance represents a parsed source map which we can query +for information about the original file positions by giving it a file position +in the generated source. + +#### new SourceMapConsumer(rawSourceMap) + +The only parameter is the raw source map (either as a string which can be +`JSON.parse`'d, or an object). According to the spec, source maps have the +following attributes: + +* `version`: Which version of the source map spec this map is following. + +* `sources`: An array of URLs to the original source files. + +* `names`: An array of identifiers which can be referenced by individual + mappings. + +* `sourceRoot`: Optional. The URL root from which all sources are relative. + +* `sourcesContent`: Optional. An array of contents of the original source files. + +* `mappings`: A string of base64 VLQs which contain the actual mappings. + +* `file`: Optional. The generated filename this source map is associated with. + +```js +var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData); +``` + +#### SourceMapConsumer.prototype.computeColumnSpans() + +Compute the last column for each generated mapping. The last column is +inclusive. + +```js +// Before: +consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) +// [ { line: 2, +// column: 1 }, +// { line: 2, +// column: 10 }, +// { line: 2, +// column: 20 } ] + +consumer.computeColumnSpans(); + +// After: +consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) +// [ { line: 2, +// column: 1, +// lastColumn: 9 }, +// { line: 2, +// column: 10, +// lastColumn: 19 }, +// { line: 2, +// column: 20, +// lastColumn: Infinity } ] + +``` + +#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition) + +Returns the original source, line, and column information for the generated +source's line and column positions provided. The only argument is an object with +the following properties: + +* `line`: The line number in the generated source. Line numbers in + this library are 1-based (note that the underlying source map + specification uses 0-based line numbers -- this library handles the + translation). + +* `column`: The column number in the generated source. Column numbers + in this library are 0-based. + +* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or + `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest + element that is smaller than or greater than the one we are searching for, + respectively, if the exact element cannot be found. Defaults to + `SourceMapConsumer.GREATEST_LOWER_BOUND`. + +and an object is returned with the following properties: + +* `source`: The original source file, or null if this information is not + available. + +* `line`: The line number in the original source, or null if this information is + not available. The line number is 1-based. + +* `column`: The column number in the original source, or null if this + information is not available. The column number is 0-based. + +* `name`: The original identifier, or null if this information is not available. + +```js +consumer.originalPositionFor({ line: 2, column: 10 }) +// { source: 'foo.coffee', +// line: 2, +// column: 2, +// name: null } + +consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 }) +// { source: null, +// line: null, +// column: null, +// name: null } +``` + +#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition) + +Returns the generated line and column information for the original source, +line, and column positions provided. The only argument is an object with +the following properties: + +* `source`: The filename of the original source. + +* `line`: The line number in the original source. The line number is + 1-based. + +* `column`: The column number in the original source. The column + number is 0-based. + +and an object is returned with the following properties: + +* `line`: The line number in the generated source, or null. The line + number is 1-based. + +* `column`: The column number in the generated source, or null. The + column number is 0-based. + +```js +consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 }) +// { line: 1, +// column: 56 } +``` + +#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition) + +Returns all generated line and column information for the original source, line, +and column provided. If no column is provided, returns all mappings +corresponding to a either the line we are searching for or the next closest line +that has any mappings. Otherwise, returns all mappings corresponding to the +given line and either the column we are searching for or the next closest column +that has any offsets. + +The only argument is an object with the following properties: + +* `source`: The filename of the original source. + +* `line`: The line number in the original source. The line number is + 1-based. + +* `column`: Optional. The column number in the original source. The + column number is 0-based. + +and an array of objects is returned, each with the following properties: + +* `line`: The line number in the generated source, or null. The line + number is 1-based. + +* `column`: The column number in the generated source, or null. The + column number is 0-based. + +```js +consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) +// [ { line: 2, +// column: 1 }, +// { line: 2, +// column: 10 }, +// { line: 2, +// column: 20 } ] +``` + +#### SourceMapConsumer.prototype.hasContentsOfAllSources() + +Return true if we have the embedded source content for every source listed in +the source map, false otherwise. + +In other words, if this method returns `true`, then +`consumer.sourceContentFor(s)` will succeed for every source `s` in +`consumer.sources`. + +```js +// ... +if (consumer.hasContentsOfAllSources()) { + consumerReadyCallback(consumer); +} else { + fetchSources(consumer, consumerReadyCallback); +} +// ... +``` + +#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing]) + +Returns the original source content for the source provided. The only +argument is the URL of the original source file. + +If the source content for the given source is not found, then an error is +thrown. Optionally, pass `true` as the second param to have `null` returned +instead. + +```js +consumer.sources +// [ "my-cool-lib.clj" ] + +consumer.sourceContentFor("my-cool-lib.clj") +// "..." + +consumer.sourceContentFor("this is not in the source map"); +// Error: "this is not in the source map" is not in the source map + +consumer.sourceContentFor("this is not in the source map", true); +// null +``` + +#### SourceMapConsumer.prototype.eachMapping(callback, context, order) + +Iterate over each mapping between an original source/line/column and a +generated line/column in this source map. + +* `callback`: The function that is called with each mapping. Mappings have the + form `{ source, generatedLine, generatedColumn, originalLine, originalColumn, + name }` + +* `context`: Optional. If specified, this object will be the value of `this` + every time that `callback` is called. + +* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or + `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over + the mappings sorted by the generated file's line/column order or the + original's source/line/column order, respectively. Defaults to + `SourceMapConsumer.GENERATED_ORDER`. + +```js +consumer.eachMapping(function (m) { console.log(m); }) +// ... +// { source: 'illmatic.js', +// generatedLine: 1, +// generatedColumn: 0, +// originalLine: 1, +// originalColumn: 0, +// name: null } +// { source: 'illmatic.js', +// generatedLine: 2, +// generatedColumn: 0, +// originalLine: 2, +// originalColumn: 0, +// name: null } +// ... +``` +### SourceMapGenerator + +An instance of the SourceMapGenerator represents a source map which is being +built incrementally. + +#### new SourceMapGenerator([startOfSourceMap]) + +You may pass an object with the following properties: + +* `file`: The filename of the generated source that this source map is + associated with. + +* `sourceRoot`: A root for all relative URLs in this source map. + +* `skipValidation`: Optional. When `true`, disables validation of mappings as + they are added. This can improve performance but should be used with + discretion, as a last resort. Even then, one should avoid using this flag when + running tests, if possible. + +* `ignoreInvalidMapping`: Optional. When `true`, instead of throwing error on + invalid mapping, it will be ignored. + +```js +var generator = new sourceMap.SourceMapGenerator({ + file: "my-generated-javascript-file.js", + sourceRoot: "http://example.com/app/js/" +}); +``` + +#### SourceMapGenerator.fromSourceMap(sourceMapConsumer, sourceMapGeneratorOptions) + +Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance. + +* `sourceMapConsumer` The SourceMap. + +* `sourceMapGeneratorOptions` options that will be passed to the SourceMapGenerator constructor which used under the hood. + +```js +var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer, { + ignoreInvalidMapping: true, +}); +``` + +#### SourceMapGenerator.prototype.addMapping(mapping) + +Add a single mapping from original source line and column to the generated +source's line and column for this source map being created. The mapping object +should have the following properties: + +* `generated`: An object with the generated line and column positions. + +* `original`: An object with the original line and column positions. + +* `source`: The original source file (relative to the sourceRoot). + +* `name`: An optional original token name for this mapping. + +```js +generator.addMapping({ + source: "module-one.scm", + original: { line: 128, column: 0 }, + generated: { line: 3, column: 456 } +}) +``` + +#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent) + +Set the source content for an original source file. + +* `sourceFile` the URL of the original source file. + +* `sourceContent` the content of the source file. + +```js +generator.setSourceContent("module-one.scm", + fs.readFileSync("path/to/module-one.scm")) +``` + +#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]]) + +Applies a SourceMap for a source file to the SourceMap. +Each mapping to the supplied source file is rewritten using the +supplied SourceMap. Note: The resolution for the resulting mappings +is the minimum of this map and the supplied map. + +* `sourceMapConsumer`: The SourceMap to be applied. + +* `sourceFile`: Optional. The filename of the source file. + If omitted, sourceMapConsumer.file will be used, if it exists. + Otherwise an error will be thrown. + +* `sourceMapPath`: Optional. The dirname of the path to the SourceMap + to be applied. If relative, it is relative to the SourceMap. + + This parameter is needed when the two SourceMaps aren't in the same + directory, and the SourceMap to be applied contains relative source + paths. If so, those relative source paths need to be rewritten + relative to the SourceMap. + + If omitted, it is assumed that both SourceMaps are in the same directory, + thus not needing any rewriting. (Supplying `'.'` has the same effect.) + +#### SourceMapGenerator.prototype.toString() + +Renders the source map being generated to a string. + +```js +generator.toString() +// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}' +``` + +### SourceNode + +SourceNodes provide a way to abstract over interpolating and/or concatenating +snippets of generated JavaScript source code, while maintaining the line and +column information associated between those snippets and the original source +code. This is useful as the final intermediate representation a compiler might +use before outputting the generated JS and source map. + +#### new SourceNode([line, column, source[, chunk[, name]]]) + +* `line`: The original line number associated with this source node, or null if + it isn't associated with an original line. The line number is 1-based. + +* `column`: The original column number associated with this source node, or null + if it isn't associated with an original column. The column number + is 0-based. + +* `source`: The original source's filename; null if no filename is provided. + +* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see + below. + +* `name`: Optional. The original identifier. + +```js +var node = new SourceNode(1, 2, "a.cpp", [ + new SourceNode(3, 4, "b.cpp", "extern int status;\n"), + new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"), + new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"), +]); +``` + +#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath]) + +Creates a SourceNode from generated code and a SourceMapConsumer. + +* `code`: The generated code + +* `sourceMapConsumer` The SourceMap for the generated code + +* `relativePath` The optional path that relative sources in `sourceMapConsumer` + should be relative to. + +```js +var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8")); +var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"), + consumer); +``` + +#### SourceNode.prototype.add(chunk) + +Add a chunk of generated JS to this source node. + +* `chunk`: A string snippet of generated JS code, another instance of + `SourceNode`, or an array where each member is one of those things. + +```js +node.add(" + "); +node.add(otherNode); +node.add([leftHandOperandNode, " + ", rightHandOperandNode]); +``` + +#### SourceNode.prototype.prepend(chunk) + +Prepend a chunk of generated JS to this source node. + +* `chunk`: A string snippet of generated JS code, another instance of + `SourceNode`, or an array where each member is one of those things. + +```js +node.prepend("/** Build Id: f783haef86324gf **/\n\n"); +``` + +#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent) + +Set the source content for a source file. This will be added to the +`SourceMap` in the `sourcesContent` field. + +* `sourceFile`: The filename of the source file + +* `sourceContent`: The content of the source file + +```js +node.setSourceContent("module-one.scm", + fs.readFileSync("path/to/module-one.scm")) +``` + +#### SourceNode.prototype.walk(fn) + +Walk over the tree of JS snippets in this node and its children. The walking +function is called once for each snippet of JS and is passed that snippet and +the its original associated source's line/column location. + +* `fn`: The traversal function. + +```js +var node = new SourceNode(1, 2, "a.js", [ + new SourceNode(3, 4, "b.js", "uno"), + "dos", + [ + "tres", + new SourceNode(5, 6, "c.js", "quatro") + ] +]); + +node.walk(function (code, loc) { console.log("WALK:", code, loc); }) +// WALK: uno { source: 'b.js', line: 3, column: 4, name: null } +// WALK: dos { source: 'a.js', line: 1, column: 2, name: null } +// WALK: tres { source: 'a.js', line: 1, column: 2, name: null } +// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null } +``` + +#### SourceNode.prototype.walkSourceContents(fn) + +Walk over the tree of SourceNodes. The walking function is called for each +source file content and is passed the filename and source content. + +* `fn`: The traversal function. + +```js +var a = new SourceNode(1, 2, "a.js", "generated from a"); +a.setSourceContent("a.js", "original a"); +var b = new SourceNode(1, 2, "b.js", "generated from b"); +b.setSourceContent("b.js", "original b"); +var c = new SourceNode(1, 2, "c.js", "generated from c"); +c.setSourceContent("c.js", "original c"); + +var node = new SourceNode(null, null, null, [a, b, c]); +node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); }) +// WALK: a.js : original a +// WALK: b.js : original b +// WALK: c.js : original c +``` + +#### SourceNode.prototype.join(sep) + +Like `Array.prototype.join` except for SourceNodes. Inserts the separator +between each of this source node's children. + +* `sep`: The separator. + +```js +var lhs = new SourceNode(1, 2, "a.rs", "my_copy"); +var operand = new SourceNode(3, 4, "a.rs", "="); +var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()"); + +var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]); +var joinedNode = node.join(" "); +``` + +#### SourceNode.prototype.replaceRight(pattern, replacement) + +Call `String.prototype.replace` on the very right-most source snippet. Useful +for trimming white space from the end of a source node, etc. + +* `pattern`: The pattern to replace. + +* `replacement`: The thing to replace the pattern with. + +```js +// Trim trailing white space. +node.replaceRight(/\s*$/, ""); +``` + +#### SourceNode.prototype.toString() + +Return the string representation of this source node. Walks over the tree and +concatenates all the various snippets together to one string. + +```js +var node = new SourceNode(1, 2, "a.js", [ + new SourceNode(3, 4, "b.js", "uno"), + "dos", + [ + "tres", + new SourceNode(5, 6, "c.js", "quatro") + ] +]); + +node.toString() +// 'unodostresquatro' +``` + +#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap]) + +Returns the string representation of this tree of source nodes, plus a +SourceMapGenerator which contains all the mappings between the generated and +original sources. + +The arguments are the same as those to `new SourceMapGenerator`. + +```js +var node = new SourceNode(1, 2, "a.js", [ + new SourceNode(3, 4, "b.js", "uno"), + "dos", + [ + "tres", + new SourceNode(5, 6, "c.js", "quatro") + ] +]); + +node.toStringWithSourceMap({ file: "my-output-file.js" }) +// { code: 'unodostresquatro', +// map: [object SourceMapGenerator] } +``` diff --git a/node_modules/source-map-js/lib/array-set.js b/node_modules/source-map-js/lib/array-set.js new file mode 100644 index 00000000..fbd5c81c --- /dev/null +++ b/node_modules/source-map-js/lib/array-set.js @@ -0,0 +1,121 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = require('./util'); +var has = Object.prototype.hasOwnProperty; +var hasNativeMap = typeof Map !== "undefined"; + +/** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ +function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); +} + +/** + * Static method for creating ArraySet instances from an existing array. + */ +ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; +}; + +/** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ +ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; +}; + +/** + * Add the given string to this set. + * + * @param String aStr + */ +ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } +}; + +/** + * Is the given string a member of this set? + * + * @param String aStr + */ +ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } +}; + +/** + * What is the index of the given string in the array? + * + * @param String aStr + */ +ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); +}; + +/** + * What is the element at the given index? + * + * @param Number aIdx + */ +ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); +}; + +/** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ +ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); +}; + +exports.ArraySet = ArraySet; diff --git a/node_modules/source-map-js/lib/base64-vlq.js b/node_modules/source-map-js/lib/base64-vlq.js new file mode 100644 index 00000000..612b4040 --- /dev/null +++ b/node_modules/source-map-js/lib/base64-vlq.js @@ -0,0 +1,140 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. 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. + */ + +var base64 = require('./base64'); + +// A single base 64 digit can contain 6 bits of data. For the base 64 variable +// length quantities we use in the source map spec, the first bit is the sign, +// the next four bits are the actual value, and the 6th bit is the +// continuation bit. The continuation bit tells us whether there are more +// digits in this value following this digit. +// +// Continuation +// | Sign +// | | +// V V +// 101011 + +var VLQ_BASE_SHIFT = 5; + +// binary: 100000 +var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + +// binary: 011111 +var VLQ_BASE_MASK = VLQ_BASE - 1; + +// binary: 100000 +var VLQ_CONTINUATION_BIT = VLQ_BASE; + +/** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ +function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; +} + +/** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ +function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; +} + +/** + * Returns the base 64 VLQ encoded value. + */ +exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; +}; + +/** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ +exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; +}; diff --git a/node_modules/source-map-js/lib/base64.js b/node_modules/source-map-js/lib/base64.js new file mode 100644 index 00000000..8aa86b30 --- /dev/null +++ b/node_modules/source-map-js/lib/base64.js @@ -0,0 +1,67 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + +/** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ +exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); +}; + +/** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ +exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; +}; diff --git a/node_modules/source-map-js/lib/binary-search.js b/node_modules/source-map-js/lib/binary-search.js new file mode 100644 index 00000000..010ac941 --- /dev/null +++ b/node_modules/source-map-js/lib/binary-search.js @@ -0,0 +1,111 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +exports.GREATEST_LOWER_BOUND = 1; +exports.LEAST_UPPER_BOUND = 2; + +/** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ +function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } +} + +/** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ +exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; +}; diff --git a/node_modules/source-map-js/lib/mapping-list.js b/node_modules/source-map-js/lib/mapping-list.js new file mode 100644 index 00000000..06d1274a --- /dev/null +++ b/node_modules/source-map-js/lib/mapping-list.js @@ -0,0 +1,79 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = require('./util'); + +/** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ +function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; +} + +/** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ +function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; +} + +/** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ +MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + +/** + * Add the given source mapping. + * + * @param Object aMapping + */ +MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } +}; + +/** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ +MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; +}; + +exports.MappingList = MappingList; diff --git a/node_modules/source-map-js/lib/quick-sort.js b/node_modules/source-map-js/lib/quick-sort.js new file mode 100644 index 00000000..23f9eda5 --- /dev/null +++ b/node_modules/source-map-js/lib/quick-sort.js @@ -0,0 +1,132 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +// It turns out that some (most?) JavaScript engines don't self-host +// `Array.prototype.sort`. This makes sense because C++ will likely remain +// faster than JS when doing raw CPU-intensive sorting. However, when using a +// custom comparator function, calling back and forth between the VM's C++ and +// JIT'd JS is rather slow *and* loses JIT type information, resulting in +// worse generated code for the comparator function than would be optimal. In +// fact, when sorting with a comparator, these costs outweigh the benefits of +// sorting in C++. By using our own JS-implemented Quick Sort (below), we get +// a ~3500ms mean speed-up in `bench/bench.html`. + +function SortTemplate(comparator) { + +/** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ +function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; +} + +/** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ +function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); +} + +/** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ +function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot, false) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } +} + + return doQuickSort; +} + +function cloneSort(comparator) { + let template = SortTemplate.toString(); + let templateFn = new Function(`return ${template}`)(); + return templateFn(comparator); +} + +/** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ + +let sortCache = new WeakMap(); +exports.quickSort = function (ary, comparator, start = 0) { + let doQuickSort = sortCache.get(comparator); + if (doQuickSort === void 0) { + doQuickSort = cloneSort(comparator); + sortCache.set(comparator, doQuickSort); + } + doQuickSort(ary, comparator, start, ary.length - 1); +}; diff --git a/node_modules/source-map-js/lib/source-map-consumer.d.ts b/node_modules/source-map-js/lib/source-map-consumer.d.ts new file mode 100644 index 00000000..744bda73 --- /dev/null +++ b/node_modules/source-map-js/lib/source-map-consumer.d.ts @@ -0,0 +1 @@ +export { SourceMapConsumer } from '..'; diff --git a/node_modules/source-map-js/lib/source-map-consumer.js b/node_modules/source-map-js/lib/source-map-consumer.js new file mode 100644 index 00000000..ee661146 --- /dev/null +++ b/node_modules/source-map-js/lib/source-map-consumer.js @@ -0,0 +1,1188 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = require('./util'); +var binarySearch = require('./binary-search'); +var ArraySet = require('./array-set').ArraySet; +var base64VLQ = require('./base64-vlq'); +var quickSort = require('./quick-sort').quickSort; + +function SourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) + : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); +} + +SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); +} + +/** + * The version of the source mapping spec that we are consuming. + */ +SourceMapConsumer.prototype._version = 3; + +// `__generatedMappings` and `__originalMappings` are arrays that hold the +// parsed mapping coordinates from the source map's "mappings" attribute. They +// are lazily instantiated, accessed via the `_generatedMappings` and +// `_originalMappings` getters respectively, and we only parse the mappings +// and create these arrays once queried for a source location. We jump through +// these hoops because there can be many thousands of mappings, and parsing +// them is expensive, so we only want to do it if we must. +// +// Each object in the arrays is of the form: +// +// { +// generatedLine: The line number in the generated code, +// generatedColumn: The column number in the generated code, +// source: The path to the original source file that generated this +// chunk of code, +// originalLine: The line number in the original source that +// corresponds to this chunk of generated code, +// originalColumn: The column number in the original source that +// corresponds to this chunk of generated code, +// name: The name of the original symbol which generated this chunk of +// code. +// } +// +// All properties except for `generatedLine` and `generatedColumn` can be +// `null`. +// +// `_generatedMappings` is ordered by the generated positions. +// +// `_originalMappings` is ordered by the original positions. + +SourceMapConsumer.prototype.__generatedMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } +}); + +SourceMapConsumer.prototype.__originalMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } +}); + +SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + +SourceMapConsumer.GENERATED_ORDER = 1; +SourceMapConsumer.ORIGINAL_ORDER = 2; + +SourceMapConsumer.GREATEST_LOWER_BOUND = 1; +SourceMapConsumer.LEAST_UPPER_BOUND = 2; + +/** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ +SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + var boundCallback = aCallback.bind(context); + var names = this._names; + var sources = this._sources; + var sourceMapURL = this._sourceMapURL; + + for (var i = 0, n = mappings.length; i < n; i++) { + var mapping = mappings[i]; + var source = mapping.source === null ? null : sources.at(mapping.source); + if(source !== null) { + source = util.computeSourceURL(sourceRoot, source, sourceMapURL); + } + boundCallback({ + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : names.at(mapping.name) + }); + } + }; + +/** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number is 1-based. + * - column: Optional. the column number in the original source. + * The column number is 0-based. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + needle.source = this._findSourceIndex(needle.source); + if (needle.source < 0) { + return []; + } + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + +exports.SourceMapConsumer = SourceMapConsumer; + +/** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The first parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ +function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + if (sourceRoot) { + sourceRoot = util.normalize(sourceRoot); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this._absoluteSources = this._sources.toArray().map(function (s) { + return util.computeSourceURL(sourceRoot, s, aSourceMapURL); + }); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this._sourceMapURL = aSourceMapURL; + this.file = file; +} + +BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + +/** + * Utility function to find the index of a source. Returns -1 if not + * found. + */ +BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + if (this._sources.has(relativeSource)) { + return this._sources.indexOf(relativeSource); + } + + // Maybe aSource is an absolute URL as returned by |sources|. In + // this case we can't simply undo the transform. + var i; + for (i = 0; i < this._absoluteSources.length; ++i) { + if (this._absoluteSources[i] == aSource) { + return i; + } + } + + return -1; +}; + +/** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @param String aSourceMapURL + * The URL at which the source map can be found (optional) + * @returns BasicSourceMapConsumer + */ +BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + smc._sourceMapURL = aSourceMapURL; + smc._absoluteSources = smc._sources.toArray().map(function (s) { + return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); + }); + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + +/** + * The version of the source mapping spec that we are consuming. + */ +BasicSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._absoluteSources.slice(); + } +}); + +/** + * Provide the JIT with a nice shape / hidden class. + */ +function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; +} + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + +const compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine; +function sortGenerated(array, start) { + let l = array.length; + let n = array.length - start; + if (n <= 1) { + return; + } else if (n == 2) { + let a = array[start]; + let b = array[start + 1]; + if (compareGenerated(a, b) > 0) { + array[start] = b; + array[start + 1] = a; + } + } else if (n < 20) { + for (let i = start; i < l; i++) { + for (let j = i; j > start; j--) { + let a = array[j - 1]; + let b = array[j]; + if (compareGenerated(a, b) <= 0) { + break; + } + array[j - 1] = b; + array[j] = a; + } + } + } else { + quickSort(array, compareGenerated, start); + } +} +BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + let subarrayStart = 0; + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + + sortGenerated(generatedMappings, subarrayStart); + subarrayStart = generatedMappings.length; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + let currentSource = mapping.source; + while (originalMappings.length <= currentSource) { + originalMappings.push(null); + } + if (originalMappings[currentSource] === null) { + originalMappings[currentSource] = []; + } + originalMappings[currentSource].push(mapping); + } + } + } + + sortGenerated(generatedMappings, subarrayStart); + this.__generatedMappings = generatedMappings; + + for (var i = 0; i < originalMappings.length; i++) { + if (originalMappings[i] != null) { + quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource); + } + } + this.__originalMappings = [].concat(...originalMappings); + }; + +/** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ +BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + +/** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ +BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ +BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + var index = this._findSourceIndex(aSource); + if (index >= 0) { + return this.sourcesContent[index]; + } + + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + relativeSource)) { + return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + relativeSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + source = this._findSourceIndex(source); + if (source < 0) { + return { + line: null, + column: null, + lastColumn: null + }; + } + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + +exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + +/** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The first parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ +function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) + } + }); +} + +IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + +/** + * The version of the source mapping spec that we are consuming. + */ +IndexedSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } +}); + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ +IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content || content === '') { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + if(source !== null) { + source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); + } + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = null; + if (mapping.name) { + name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + } + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + +exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; diff --git a/node_modules/source-map-js/lib/source-map-generator.d.ts b/node_modules/source-map-js/lib/source-map-generator.d.ts new file mode 100644 index 00000000..f59d70aa --- /dev/null +++ b/node_modules/source-map-js/lib/source-map-generator.d.ts @@ -0,0 +1 @@ +export { SourceMapGenerator } from '..'; diff --git a/node_modules/source-map-js/lib/source-map-generator.js b/node_modules/source-map-js/lib/source-map-generator.js new file mode 100644 index 00000000..bab04ff8 --- /dev/null +++ b/node_modules/source-map-js/lib/source-map-generator.js @@ -0,0 +1,444 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var base64VLQ = require('./base64-vlq'); +var util = require('./util'); +var ArraySet = require('./array-set').ArraySet; +var MappingList = require('./mapping-list').MappingList; + +/** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ +function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._ignoreInvalidMapping = util.getArg(aArgs, 'ignoreInvalidMapping', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; +} + +SourceMapGenerator.prototype._version = 3; + +/** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ +SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator(Object.assign(generatorOps || {}, { + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + })); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var sourceRelative = sourceFile; + if (sourceRoot !== null) { + sourceRelative = util.relative(sourceRoot, sourceFile); + } + + if (!generator._sources.has(sourceRelative)) { + generator._sources.add(sourceRelative); + } + + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + +/** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ +SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + if (this._validateMapping(generated, original, source, name) === false) { + return; + } + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + +/** + * Set the source content for a source file. + */ +SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + +/** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ +SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + +/** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ +SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + var message = 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + + if (this._ignoreInvalidMapping) { + if (typeof console !== 'undefined' && console.warn) { + console.warn(message); + } + return false; + } else { + throw new Error(message); + } + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + var message = 'Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + }); + + if (this._ignoreInvalidMapping) { + if (typeof console !== 'undefined' && console.warn) { + console.warn(message); + } + return false; + } else { + throw new Error(message) + } + } + }; + +/** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ +SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + +SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + +/** + * Externalize the source map. + */ +SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + +/** + * Render the source map being generated to a string. + */ +SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + +exports.SourceMapGenerator = SourceMapGenerator; diff --git a/node_modules/source-map-js/lib/source-node.d.ts b/node_modules/source-map-js/lib/source-node.d.ts new file mode 100644 index 00000000..4df6a1ac --- /dev/null +++ b/node_modules/source-map-js/lib/source-node.d.ts @@ -0,0 +1 @@ +export { SourceNode } from '..'; diff --git a/node_modules/source-map-js/lib/source-node.js b/node_modules/source-map-js/lib/source-node.js new file mode 100644 index 00000000..8bcdbe38 --- /dev/null +++ b/node_modules/source-map-js/lib/source-node.js @@ -0,0 +1,413 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; +var util = require('./util'); + +// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other +// operating systems these days (capturing the result). +var REGEX_NEWLINE = /(\r?\n)/; + +// Newline character code for charCodeAt() comparisons +var NEWLINE_CODE = 10; + +// Private symbol for identifying `SourceNode`s when multiple versions of +// the source-map library are loaded. This MUST NOT CHANGE across +// versions! +var isSourceNode = "$$$isSourceNode$$$"; + +/** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ +function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); +} + +/** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ +SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[remainingLinesIndex] || ''; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[remainingLinesIndex] || ''; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + }; + +/** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } +}; + +/** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ +SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; +}; + +/** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ +SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; +}; + +/** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ +SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + +/** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + +/** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ +SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; +}; + +/** + * Returns the string representation of this source node along with a source + * map. + */ +SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; +}; + +exports.SourceNode = SourceNode; diff --git a/node_modules/source-map-js/lib/util.js b/node_modules/source-map-js/lib/util.js new file mode 100644 index 00000000..430e2d0f --- /dev/null +++ b/node_modules/source-map-js/lib/util.js @@ -0,0 +1,594 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +/** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ +function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } +} +exports.getArg = getArg; + +var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; +var dataUrlRegexp = /^data:.+\,.+$/; + +function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; +} +exports.urlParse = urlParse; + +function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; +} +exports.urlGenerate = urlGenerate; + +var MAX_CACHED_INPUTS = 32; + +/** + * Takes some function `f(input) -> result` and returns a memoized version of + * `f`. + * + * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The + * memoization is a dumb-simple, linear least-recently-used cache. + */ +function lruMemoize(f) { + var cache = []; + + return function(input) { + for (var i = 0; i < cache.length; i++) { + if (cache[i].input === input) { + var temp = cache[0]; + cache[0] = cache[i]; + cache[i] = temp; + return cache[0].result; + } + } + + var result = f(input); + + cache.unshift({ + input, + result, + }); + + if (cache.length > MAX_CACHED_INPUTS) { + cache.pop(); + } + + return result; + }; +} + +/** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ +var normalize = lruMemoize(function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + // Split the path into parts between `/` characters. This is much faster than + // using `.split(/\/+/g)`. + var parts = []; + var start = 0; + var i = 0; + while (true) { + start = i; + i = path.indexOf("/", start); + if (i === -1) { + parts.push(path.slice(start)); + break; + } else { + parts.push(path.slice(start, i)); + while (i < path.length && path[i] === "/") { + i++; + } + } + } + + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; +}); +exports.normalize = normalize; + +/** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ +function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; +} +exports.join = join; + +exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || urlRegexp.test(aPath); +}; + +/** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ +function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); +} +exports.relative = relative; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} + +/** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ +function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ +function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByOriginalPositions = compareByOriginalPositions; + +function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) { + var cmp + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource; + +/** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ +function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + +function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine; + +function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 === null) { + return 1; // aStr2 !== null + } + + if (aStr2 === null) { + return -1; // aStr1 !== null + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; +} + +/** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ +function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + +/** + * Strip any JSON XSSI avoidance prefix from the string (as documented + * in the source maps specification), and then parse the string as + * JSON. + */ +function parseSourceMapInput(str) { + return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); +} +exports.parseSourceMapInput = parseSourceMapInput; + +/** + * Compute the URL of a source given the the source root, the source's + * URL, and the source map's URL. + */ +function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { + sourceURL = sourceURL || ''; + + if (sourceRoot) { + // This follows what Chrome does. + if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { + sourceRoot += '/'; + } + // The spec says: + // Line 4: An optional source root, useful for relocating source + // files on a server or removing repeated values in the + // “sources” entry. This value is prepended to the individual + // entries in the “source” field. + sourceURL = sourceRoot + sourceURL; + } + + // Historically, SourceMapConsumer did not take the sourceMapURL as + // a parameter. This mode is still somewhat supported, which is why + // this code block is conditional. However, it's preferable to pass + // the source map URL to SourceMapConsumer, so that this function + // can implement the source URL resolution algorithm as outlined in + // the spec. This block is basically the equivalent of: + // new URL(sourceURL, sourceMapURL).toString() + // ... except it avoids using URL, which wasn't available in the + // older releases of node still supported by this library. + // + // The spec says: + // If the sources are not absolute URLs after prepending of the + // “sourceRoot”, the sources are resolved relative to the + // SourceMap (like resolving script src in a html document). + if (sourceMapURL) { + var parsed = urlParse(sourceMapURL); + if (!parsed) { + throw new Error("sourceMapURL could not be parsed"); + } + if (parsed.path) { + // Strip the last path component, but keep the "/". + var index = parsed.path.lastIndexOf('/'); + if (index >= 0) { + parsed.path = parsed.path.substring(0, index + 1); + } + } + sourceURL = join(urlGenerate(parsed), sourceURL); + } + + return normalize(sourceURL); +} +exports.computeSourceURL = computeSourceURL; diff --git a/node_modules/source-map-js/package.json b/node_modules/source-map-js/package.json new file mode 100644 index 00000000..f58dbeb4 --- /dev/null +++ b/node_modules/source-map-js/package.json @@ -0,0 +1,71 @@ +{ + "name": "source-map-js", + "description": "Generates and consumes source maps", + "version": "1.2.1", + "homepage": "https://github.com/7rulnik/source-map-js", + "author": "Valentin 7rulnik Semirulnik ", + "contributors": [ + "Nick Fitzgerald ", + "Tobias Koppers ", + "Duncan Beevers ", + "Stephen Crane ", + "Ryan Seddon ", + "Miles Elam ", + "Mihai Bazon ", + "Michael Ficarra ", + "Todd Wolfson ", + "Alexander Solovyov ", + "Felix Gnass ", + "Conrad Irwin ", + "usrbincc ", + "David Glasser ", + "Chase Douglas ", + "Evan Wallace ", + "Heather Arthur ", + "Hugh Kennedy ", + "David Glasser ", + "Simon Lydell ", + "Jmeas Smith ", + "Michael Z Goddard ", + "azu ", + "John Gozde ", + "Adam Kirkton ", + "Chris Montgomery ", + "J. Ryan Stinnett ", + "Jack Herrington ", + "Chris Truter ", + "Daniel Espeset ", + "Jamie Wong ", + "Eddy Bruël ", + "Hawken Rives ", + "Gilad Peleg ", + "djchie ", + "Gary Ye ", + "Nicolas Lalevée " + ], + "repository": "7rulnik/source-map-js", + "main": "./source-map.js", + "files": [ + "source-map.js", + "source-map.d.ts", + "lib/" + ], + "engines": { + "node": ">=0.10.0" + }, + "license": "BSD-3-Clause", + "scripts": { + "test": "npm run build && node test/run-tests.js", + "build": "webpack --color", + "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" + }, + "devDependencies": { + "clean-publish": "^3.1.0", + "doctoc": "^0.15.0", + "webpack": "^1.12.0" + }, + "clean-publish": { + "cleanDocs": true + }, + "typings": "source-map.d.ts" +} diff --git a/node_modules/source-map-js/source-map.d.ts b/node_modules/source-map-js/source-map.d.ts new file mode 100644 index 00000000..ec8892fa --- /dev/null +++ b/node_modules/source-map-js/source-map.d.ts @@ -0,0 +1,104 @@ +export interface StartOfSourceMap { + file?: string; + sourceRoot?: string; +} + +export interface RawSourceMap extends StartOfSourceMap { + version: string; + sources: string[]; + names: string[]; + sourcesContent?: string[]; + mappings: string; +} + +export interface Position { + line: number; + column: number; +} + +export interface LineRange extends Position { + lastColumn: number; +} + +export interface FindPosition extends Position { + // SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND + bias?: number; +} + +export interface SourceFindPosition extends FindPosition { + source: string; +} + +export interface MappedPosition extends Position { + source: string; + name?: string; +} + +export interface MappingItem { + source: string | null; + generatedLine: number; + generatedColumn: number; + originalLine: number | null; + originalColumn: number | null; + name: string | null; +} + +export class SourceMapConsumer { + static GENERATED_ORDER: number; + static ORIGINAL_ORDER: number; + + static GREATEST_LOWER_BOUND: number; + static LEAST_UPPER_BOUND: number; + + constructor(rawSourceMap: RawSourceMap); + readonly file: string | undefined | null; + readonly sourceRoot: string | undefined | null; + readonly sourcesContent: readonly string[] | null | undefined; + readonly sources: readonly string[] + + computeColumnSpans(): void; + originalPositionFor(generatedPosition: FindPosition): MappedPosition; + generatedPositionFor(originalPosition: SourceFindPosition): LineRange; + allGeneratedPositionsFor(originalPosition: MappedPosition): Position[]; + hasContentsOfAllSources(): boolean; + sourceContentFor(source: string, returnNullOnMissing?: boolean): string | null; + eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void; +} + +export interface Mapping { + generated: Position; + original?: Position | null; + source?: string | null; + name?: string | null; +} + +export class SourceMapGenerator { + constructor(startOfSourceMap?: StartOfSourceMap); + static fromSourceMap(sourceMapConsumer: SourceMapConsumer, startOfSourceMap?: StartOfSourceMap): SourceMapGenerator; + addMapping(mapping: Mapping): void; + setSourceContent(sourceFile: string, sourceContent: string | null | undefined): void; + applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void; + toString(): string; + toJSON(): RawSourceMap; +} + +export interface CodeWithSourceMap { + code: string; + map: SourceMapGenerator; +} + +export class SourceNode { + constructor(); + constructor(line: number, column: number, source: string); + constructor(line: number, column: number, source: string, chunk?: string, name?: string); + static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode; + add(chunk: string): void; + prepend(chunk: string): void; + setSourceContent(sourceFile: string, sourceContent: string): void; + walk(fn: (chunk: string, mapping: MappedPosition) => void): void; + walkSourceContents(fn: (file: string, content: string) => void): void; + join(sep: string): SourceNode; + replaceRight(pattern: string, replacement: string): SourceNode; + toString(): string; + toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap; +} diff --git a/node_modules/source-map-js/source-map.js b/node_modules/source-map-js/source-map.js new file mode 100644 index 00000000..bc88fe82 --- /dev/null +++ b/node_modules/source-map-js/source-map.js @@ -0,0 +1,8 @@ +/* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ +exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator; +exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer; +exports.SourceNode = require('./lib/source-node').SourceNode; diff --git a/node_modules/string-width-cjs/index.d.ts b/node_modules/string-width-cjs/index.d.ts new file mode 100644 index 00000000..12b53097 --- /dev/null +++ b/node_modules/string-width-cjs/index.d.ts @@ -0,0 +1,29 @@ +declare const stringWidth: { + /** + Get the visual width of a string - the number of columns required to display it. + + Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. + + @example + ``` + import stringWidth = require('string-width'); + + stringWidth('a'); + //=> 1 + + stringWidth('古'); + //=> 2 + + stringWidth('\u001B[1m古\u001B[22m'); + //=> 2 + ``` + */ + (string: string): number; + + // TODO: remove this in the next major version, refactor the whole definition to: + // declare function stringWidth(string: string): number; + // export = stringWidth; + default: typeof stringWidth; +} + +export = stringWidth; diff --git a/node_modules/string-width-cjs/index.js b/node_modules/string-width-cjs/index.js new file mode 100644 index 00000000..f4d261a9 --- /dev/null +++ b/node_modules/string-width-cjs/index.js @@ -0,0 +1,47 @@ +'use strict'; +const stripAnsi = require('strip-ansi'); +const isFullwidthCodePoint = require('is-fullwidth-code-point'); +const emojiRegex = require('emoji-regex'); + +const stringWidth = string => { + if (typeof string !== 'string' || string.length === 0) { + return 0; + } + + string = stripAnsi(string); + + if (string.length === 0) { + return 0; + } + + string = string.replace(emojiRegex(), ' '); + + let width = 0; + + for (let i = 0; i < string.length; i++) { + const code = string.codePointAt(i); + + // Ignore control characters + if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { + continue; + } + + // Ignore combining characters + if (code >= 0x300 && code <= 0x36F) { + continue; + } + + // Surrogates + if (code > 0xFFFF) { + i++; + } + + width += isFullwidthCodePoint(code) ? 2 : 1; + } + + return width; +}; + +module.exports = stringWidth; +// TODO: remove this in the next major version +module.exports.default = stringWidth; diff --git a/node_modules/string-width-cjs/license b/node_modules/string-width-cjs/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/string-width-cjs/license @@ -0,0 +1,9 @@ +MIT License + +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/string-width-cjs/node_modules/ansi-regex/index.d.ts b/node_modules/string-width-cjs/node_modules/ansi-regex/index.d.ts new file mode 100644 index 00000000..2dbf6af2 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/ansi-regex/index.d.ts @@ -0,0 +1,37 @@ +declare namespace ansiRegex { + interface Options { + /** + Match only the first ANSI escape. + + @default false + */ + onlyFirst: boolean; + } +} + +/** +Regular expression for matching ANSI escape codes. + +@example +``` +import ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` +*/ +declare function ansiRegex(options?: ansiRegex.Options): RegExp; + +export = ansiRegex; diff --git a/node_modules/string-width-cjs/node_modules/ansi-regex/index.js b/node_modules/string-width-cjs/node_modules/ansi-regex/index.js new file mode 100644 index 00000000..616ff837 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = ({onlyFirst = false} = {}) => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; diff --git a/node_modules/string-width-cjs/node_modules/ansi-regex/license b/node_modules/string-width-cjs/node_modules/ansi-regex/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/ansi-regex/license @@ -0,0 +1,9 @@ +MIT License + +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/string-width-cjs/node_modules/ansi-regex/package.json b/node_modules/string-width-cjs/node_modules/ansi-regex/package.json new file mode 100644 index 00000000..017f5311 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/ansi-regex/package.json @@ -0,0 +1,55 @@ +{ + "name": "ansi-regex", + "version": "5.0.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/string-width-cjs/node_modules/ansi-regex/readme.md b/node_modules/string-width-cjs/node_modules/ansi-regex/readme.md new file mode 100644 index 00000000..4d848bc3 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/ansi-regex/readme.md @@ -0,0 +1,78 @@ +# ansi-regex + +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install ansi-regex +``` + + +## Usage + +```js +const ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` + + +## API + +### ansiRegex(options?) + +Returns a regex for matching ANSI escape codes. + +#### options + +Type: `object` + +##### onlyFirst + +Type: `boolean`
    +Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +--- + +
    + + Get professional support for this package with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    diff --git a/node_modules/string-width-cjs/node_modules/emoji-regex/LICENSE-MIT.txt b/node_modules/string-width-cjs/node_modules/emoji-regex/LICENSE-MIT.txt new file mode 100644 index 00000000..a41e0a7e --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/emoji-regex/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens + +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/string-width-cjs/node_modules/emoji-regex/README.md b/node_modules/string-width-cjs/node_modules/emoji-regex/README.md new file mode 100644 index 00000000..f10e1733 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/emoji-regex/README.md @@ -0,0 +1,73 @@ +# emoji-regex [![Build status](https://travis-ci.org/mathiasbynens/emoji-regex.svg?branch=master)](https://travis-ci.org/mathiasbynens/emoji-regex) + +_emoji-regex_ offers a regular expression to match all emoji symbols (including textual representations of emoji) as per the Unicode Standard. + +This repository contains a script that generates this regular expression based on [the data from Unicode v12](https://github.com/mathiasbynens/unicode-12.0.0). Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard. + +## Installation + +Via [npm](https://www.npmjs.com/): + +```bash +npm install emoji-regex +``` + +In [Node.js](https://nodejs.org/): + +```js +const emojiRegex = require('emoji-regex'); +// Note: because the regular expression has the global flag set, this module +// exports a function that returns the regex rather than exporting the regular +// expression itself, to make it impossible to (accidentally) mutate the +// original regular expression. + +const text = ` +\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation) +\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji +\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base) +\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier +`; + +const regex = emojiRegex(); +let match; +while (match = regex.exec(text)) { + const emoji = match[0]; + console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`); +} +``` + +Console output: + +``` +Matched sequence ⌚ — code points: 1 +Matched sequence ⌚ — code points: 1 +Matched sequence ↔️ — code points: 2 +Matched sequence ↔️ — code points: 2 +Matched sequence 👩 — code points: 1 +Matched sequence 👩 — code points: 1 +Matched sequence 👩🏿 — code points: 2 +Matched sequence 👩🏿 — code points: 2 +``` + +To match emoji in their textual representation as well (i.e. emoji that are not `Emoji_Presentation` symbols and that aren’t forced to render as emoji by a variation selector), `require` the other regex: + +```js +const emojiRegex = require('emoji-regex/text.js'); +``` + +Additionally, in environments which support ES2015 Unicode escapes, you may `require` ES2015-style versions of the regexes: + +```js +const emojiRegex = require('emoji-regex/es2015/index.js'); +const emojiRegexText = require('emoji-regex/es2015/text.js'); +``` + +## Author + +| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](https://mathiasbynens.be/) | + +## License + +_emoji-regex_ is available under the [MIT](https://mths.be/mit) license. diff --git a/node_modules/string-width-cjs/node_modules/emoji-regex/es2015/index.js b/node_modules/string-width-cjs/node_modules/emoji-regex/es2015/index.js new file mode 100644 index 00000000..b4cf3dcd --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/emoji-regex/es2015/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F}|\u{1F468}(?:\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}\u{1F3FB}|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|[\u{1F3FB}-\u{1F3FF}])|(?:\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F469})\u{1F3FB}|\u{1F9D1}(?:\u{1F3FF}\u200D\u{1F91D}\u200D\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u200D\u{1F91D}\u200D\u{1F9D1})|(?:\u{1F9D1}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}\u{1F3FC}]|\u{1F469}(?:\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FB}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|(?:\u{1F9D1}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}-\u{1F3FD}]|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])\u200D[\u2640\u2642]|[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}][\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|[\u{1F3C3}\u{1F3C4}\u{1F3CA}\u{1F46E}\u{1F471}\u{1F473}\u{1F477}\u{1F481}\u{1F482}\u{1F486}\u{1F487}\u{1F645}-\u{1F647}\u{1F64B}\u{1F64D}\u{1F64E}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F926}\u{1F937}-\u{1F939}\u{1F93D}\u{1F93E}\u{1F9B8}\u{1F9B9}\u{1F9CD}-\u{1F9CF}\u{1F9D6}-\u{1F9DD}](?:[\u{1F3FB}-\u{1F3FF}]\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\u{1F3F4}\u200D\u2620)\uFE0F|\u{1F469}\u200D\u{1F467}\u200D[\u{1F466}\u{1F467}]|\u{1F3F3}\uFE0F\u200D\u{1F308}|\u{1F415}\u200D\u{1F9BA}|\u{1F469}\u200D\u{1F466}|\u{1F469}\u200D\u{1F467}|\u{1F1FD}\u{1F1F0}|\u{1F1F4}\u{1F1F2}|\u{1F1F6}\u{1F1E6}|[#\*0-9]\uFE0F\u20E3|\u{1F1E7}[\u{1F1E6}\u{1F1E7}\u{1F1E9}-\u{1F1EF}\u{1F1F1}-\u{1F1F4}\u{1F1F6}-\u{1F1F9}\u{1F1FB}\u{1F1FC}\u{1F1FE}\u{1F1FF}]|\u{1F1F9}[\u{1F1E6}\u{1F1E8}\u{1F1E9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{1F385}\u{1F3C2}\u{1F3C7}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}\u{1F467}\u{1F46B}-\u{1F46D}\u{1F470}\u{1F472}\u{1F474}-\u{1F476}\u{1F478}\u{1F47C}\u{1F483}\u{1F485}\u{1F4AA}\u{1F574}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F64C}\u{1F64F}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91C}\u{1F91E}\u{1F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F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91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; +}; diff --git a/node_modules/string-width-cjs/node_modules/emoji-regex/es2015/text.js b/node_modules/string-width-cjs/node_modules/emoji-regex/es2015/text.js new file mode 100644 index 00000000..780309df --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/emoji-regex/es2015/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = () => { + // https://mths.be/emoji + return /\u{1F3F4}\u{E0067}\u{E0062}(?:\u{E0065}\u{E006E}\u{E0067}|\u{E0073}\u{E0063}\u{E0074}|\u{E0077}\u{E006C}\u{E0073})\u{E007F}|\u{1F468}(?:\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}\u{1F3FB}|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FE}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D)?\u{1F468}|[\u{1F468}\u{1F469}]\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}]|[\u{1F468}\u{1F469}]\u200D[\u{1F466}\u{1F467}]|[\u2695\u2696\u2708]\uFE0F|[\u{1F466}\u{1F467}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|(?:\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708])\uFE0F|\u{1F3FB}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}]|[\u{1F3FB}-\u{1F3FF}])|(?:\u{1F9D1}\u{1F3FB}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F469})\u{1F3FB}|\u{1F9D1}(?:\u{1F3FF}\u200D\u{1F91D}\u200D\u{1F9D1}[\u{1F3FB}-\u{1F3FF}]|\u200D\u{1F91D}\u200D\u{1F9D1})|(?:\u{1F9D1}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FF}\u200D\u{1F91D}\u200D[\u{1F468}\u{1F469}])[\u{1F3FB}-\u{1F3FE}]|(?:\u{1F9D1}\u{1F3FC}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}\u{1F3FC}]|\u{1F469}(?:\u{1F3FE}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}-\u{1F3FD}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FC}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FD}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FB}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FC}-\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FD}\u200D(?:\u{1F91D}\u200D\u{1F468}[\u{1F3FB}\u{1F3FC}\u{1F3FE}\u{1F3FF}]|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u200D(?:\u2764\uFE0F\u200D(?:\u{1F48B}\u200D[\u{1F468}\u{1F469}]|[\u{1F468}\u{1F469}])|[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F3FF}\u200D[\u{1F33E}\u{1F373}\u{1F393}\u{1F3A4}\u{1F3A8}\u{1F3EB}\u{1F3ED}\u{1F4BB}\u{1F4BC}\u{1F527}\u{1F52C}\u{1F680}\u{1F692}\u{1F9AF}-\u{1F9B3}\u{1F9BC}\u{1F9BD}])|\u{1F469}\u200D\u{1F469}\u200D(?:\u{1F466}\u200D\u{1F466}|\u{1F467}\u200D[\u{1F466}\u{1F467}])|(?:\u{1F9D1}\u{1F3FD}\u200D\u{1F91D}\u200D\u{1F9D1}|\u{1F469}\u{1F3FE}\u200D\u{1F91D}\u200D\u{1F469})[\u{1F3FB}-\u{1F3FD}]|\u{1F469}\u200D\u{1F466}\u200D\u{1F466}|\u{1F469}\u200D\u{1F469}\u200D[\u{1F466}\u{1F467}]|(?:\u{1F441}\uFE0F\u200D\u{1F5E8}|\u{1F469}(?:\u{1F3FF}\u200D[\u2695\u2696\u2708]|\u{1F3FE}\u200D[\u2695\u2696\u2708]|\u{1F3FC}\u200D[\u2695\u2696\u2708]|\u{1F3FB}\u200D[\u2695\u2696\u2708]|\u{1F3FD}\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:[\u26F9\u{1F3CB}\u{1F3CC}\u{1F575}]\uFE0F|[\u{1F46F}\u{1F93C}\u{1F9DE}\u{1F9DF}])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F91F}\u{1F930}-\u{1F936}\u{1F9B5}\u{1F9B6}\u{1F9BB}\u{1F9D2}-\u{1F9D5}][\u{1F3FB}-\u{1F3FF}]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]|[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299\u{1F004}\u{1F0CF}\u{1F170}\u{1F171}\u{1F17E}\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E6}-\u{1F1FF}\u{1F201}\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F321}\u{1F324}-\u{1F393}\u{1F396}\u{1F397}\u{1F399}-\u{1F39B}\u{1F39E}-\u{1F3F0}\u{1F3F3}-\u{1F3F5}\u{1F3F7}-\u{1F4FD}\u{1F4FF}-\u{1F53D}\u{1F549}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F56F}\u{1F570}\u{1F573}-\u{1F57A}\u{1F587}\u{1F58A}-\u{1F58D}\u{1F590}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5A5}\u{1F5A8}\u{1F5B1}\u{1F5B2}\u{1F5BC}\u{1F5C2}-\u{1F5C4}\u{1F5D1}-\u{1F5D3}\u{1F5DC}-\u{1F5DE}\u{1F5E1}\u{1F5E3}\u{1F5E8}\u{1F5EF}\u{1F5F3}\u{1F5FA}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CB}-\u{1F6D2}\u{1F6D5}\u{1F6E0}-\u{1F6E5}\u{1F6E9}\u{1F6EB}\u{1F6EC}\u{1F6F0}\u{1F6F3}-\u{1F6FA}\u{1F7E0}-\u{1F7EB}\u{1F90D}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F971}\u{1F973}-\u{1F976}\u{1F97A}-\u{1F9A2}\u{1F9A5}-\u{1F9AA}\u{1F9AE}-\u{1F9CA}\u{1F9CD}-\u{1F9FF}\u{1FA70}-\u{1FA73}\u{1FA78}-\u{1FA7A}\u{1FA80}-\u{1FA82}\u{1FA90}-\u{1FA95}]\uFE0F?|[\u261D\u26F9\u270A-\u270D\u{1F385}\u{1F3C2}-\u{1F3C4}\u{1F3C7}\u{1F3CA}-\u{1F3CC}\u{1F442}\u{1F443}\u{1F446}-\u{1F450}\u{1F466}-\u{1F478}\u{1F47C}\u{1F481}-\u{1F483}\u{1F485}-\u{1F487}\u{1F48F}\u{1F491}\u{1F4AA}\u{1F574}\u{1F575}\u{1F57A}\u{1F590}\u{1F595}\u{1F596}\u{1F645}-\u{1F647}\u{1F64B}-\u{1F64F}\u{1F6A3}\u{1F6B4}-\u{1F6B6}\u{1F6C0}\u{1F6CC}\u{1F90F}\u{1F918}-\u{1F91F}\u{1F926}\u{1F930}-\u{1F939}\u{1F93C}-\u{1F93E}\u{1F9B5}\u{1F9B6}\u{1F9B8}\u{1F9B9}\u{1F9BB}\u{1F9CD}-\u{1F9CF}\u{1F9D1}-\u{1F9DD}]/gu; +}; diff --git a/node_modules/string-width-cjs/node_modules/emoji-regex/index.d.ts b/node_modules/string-width-cjs/node_modules/emoji-regex/index.d.ts new file mode 100644 index 00000000..1955b470 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/emoji-regex/index.d.ts @@ -0,0 +1,23 @@ +declare module 'emoji-regex' { + function emojiRegex(): RegExp; + + export default emojiRegex; +} + +declare module 'emoji-regex/text' { + function emojiRegex(): RegExp; + + export default emojiRegex; +} + +declare module 'emoji-regex/es2015' { + function emojiRegex(): RegExp; + + export default emojiRegex; +} + +declare module 'emoji-regex/es2015/text' { + function emojiRegex(): RegExp; + + export default emojiRegex; +} diff --git a/node_modules/string-width-cjs/node_modules/emoji-regex/index.js b/node_modules/string-width-cjs/node_modules/emoji-regex/index.js new file mode 100644 index 00000000..d993a3a9 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/emoji-regex/index.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\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FA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; +}; diff --git a/node_modules/string-width-cjs/node_modules/emoji-regex/package.json b/node_modules/string-width-cjs/node_modules/emoji-regex/package.json new file mode 100644 index 00000000..6d323528 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/emoji-regex/package.json @@ -0,0 +1,50 @@ +{ + "name": "emoji-regex", + "version": "8.0.0", + "description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.", + "homepage": "https://mths.be/emoji-regex", + "main": "index.js", + "types": "index.d.ts", + "keywords": [ + "unicode", + "regex", + "regexp", + "regular expressions", + "code points", + "symbols", + "characters", + "emoji" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "repository": { + "type": "git", + "url": "https://github.com/mathiasbynens/emoji-regex.git" + }, + "bugs": "https://github.com/mathiasbynens/emoji-regex/issues", + "files": [ + "LICENSE-MIT.txt", + "index.js", + "index.d.ts", + "text.js", + "es2015/index.js", + "es2015/text.js" + ], + "scripts": { + "build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src -d ./es2015; node script/inject-sequences.js", + "test": "mocha", + "test:watch": "npm run test -- --watch" + }, + "devDependencies": { + "@babel/cli": "^7.2.3", + "@babel/core": "^7.3.4", + "@babel/plugin-proposal-unicode-property-regex": "^7.2.0", + "@babel/preset-env": "^7.3.4", + "mocha": "^6.0.2", + "regexgen": "^1.3.0", + "unicode-12.0.0": "^0.7.9" + } +} diff --git a/node_modules/string-width-cjs/node_modules/emoji-regex/text.js b/node_modules/string-width-cjs/node_modules/emoji-regex/text.js new file mode 100644 index 00000000..0a55ce2f --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/emoji-regex/text.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = function () { + // https://mths.be/emoji + return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\u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DF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F?|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; +}; diff --git a/node_modules/string-width-cjs/node_modules/strip-ansi/index.d.ts b/node_modules/string-width-cjs/node_modules/strip-ansi/index.d.ts new file mode 100644 index 00000000..907fccc2 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/strip-ansi/index.d.ts @@ -0,0 +1,17 @@ +/** +Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. + +@example +``` +import stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` +*/ +declare function stripAnsi(string: string): string; + +export = stripAnsi; diff --git a/node_modules/string-width-cjs/node_modules/strip-ansi/index.js b/node_modules/string-width-cjs/node_modules/strip-ansi/index.js new file mode 100644 index 00000000..9a593dfc --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/strip-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +const ansiRegex = require('ansi-regex'); + +module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/node_modules/string-width-cjs/node_modules/strip-ansi/license b/node_modules/string-width-cjs/node_modules/strip-ansi/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/strip-ansi/license @@ -0,0 +1,9 @@ +MIT License + +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/string-width-cjs/node_modules/strip-ansi/package.json b/node_modules/string-width-cjs/node_modules/strip-ansi/package.json new file mode 100644 index 00000000..1a41108d --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/strip-ansi/package.json @@ -0,0 +1,54 @@ +{ + "name": "strip-ansi", + "version": "6.0.1", + "description": "Strip ANSI escape codes from a string", + "license": "MIT", + "repository": "chalk/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.10.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/string-width-cjs/node_modules/strip-ansi/readme.md b/node_modules/string-width-cjs/node_modules/strip-ansi/readme.md new file mode 100644 index 00000000..7c4b56d4 --- /dev/null +++ b/node_modules/string-width-cjs/node_modules/strip-ansi/readme.md @@ -0,0 +1,46 @@ +# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) + +> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string + + +## Install + +``` +$ npm install strip-ansi +``` + + +## Usage + +```js +const stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` + + +## strip-ansi for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + + +## Related + +- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module +- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes +- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + diff --git a/node_modules/string-width-cjs/package.json b/node_modules/string-width-cjs/package.json new file mode 100644 index 00000000..28ba7b4c --- /dev/null +++ b/node_modules/string-width-cjs/package.json @@ -0,0 +1,56 @@ +{ + "name": "string-width", + "version": "4.2.3", + "description": "Get the visual width of a string - the number of columns required to display it", + "license": "MIT", + "repository": "sindresorhus/string-width", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "string", + "character", + "unicode", + "width", + "visual", + "column", + "columns", + "fullwidth", + "full-width", + "full", + "ansi", + "escape", + "codes", + "cli", + "command-line", + "terminal", + "console", + "cjk", + "chinese", + "japanese", + "korean", + "fixed-width" + ], + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" + } +} diff --git a/node_modules/string-width-cjs/readme.md b/node_modules/string-width-cjs/readme.md new file mode 100644 index 00000000..bdd31412 --- /dev/null +++ b/node_modules/string-width-cjs/readme.md @@ -0,0 +1,50 @@ +# string-width + +> Get the visual width of a string - the number of columns required to display it + +Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. + +Useful to be able to measure the actual width of command-line output. + + +## Install + +``` +$ npm install string-width +``` + + +## Usage + +```js +const stringWidth = require('string-width'); + +stringWidth('a'); +//=> 1 + +stringWidth('古'); +//=> 2 + +stringWidth('\u001B[1m古\u001B[22m'); +//=> 2 +``` + + +## Related + +- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module +- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string +- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string + + +--- + +
    + + Get professional support for this package with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    diff --git a/node_modules/string-width/index.d.ts b/node_modules/string-width/index.d.ts new file mode 100644 index 00000000..aed9fdff --- /dev/null +++ b/node_modules/string-width/index.d.ts @@ -0,0 +1,29 @@ +export interface Options { + /** + Count [ambiguous width characters](https://www.unicode.org/reports/tr11/#Ambiguous) as having narrow width (count of 1) instead of wide width (count of 2). + + @default true + */ + readonly ambiguousIsNarrow: boolean; +} + +/** +Get the visual width of a string - the number of columns required to display it. + +Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. + +@example +``` +import stringWidth from 'string-width'; + +stringWidth('a'); +//=> 1 + +stringWidth('古'); +//=> 2 + +stringWidth('\u001B[1m古\u001B[22m'); +//=> 2 +``` +*/ +export default function stringWidth(string: string, options?: Options): number; diff --git a/node_modules/string-width/index.js b/node_modules/string-width/index.js new file mode 100644 index 00000000..9294488f --- /dev/null +++ b/node_modules/string-width/index.js @@ -0,0 +1,54 @@ +import stripAnsi from 'strip-ansi'; +import eastAsianWidth from 'eastasianwidth'; +import emojiRegex from 'emoji-regex'; + +export default function stringWidth(string, options = {}) { + if (typeof string !== 'string' || string.length === 0) { + return 0; + } + + options = { + ambiguousIsNarrow: true, + ...options + }; + + string = stripAnsi(string); + + if (string.length === 0) { + return 0; + } + + string = string.replace(emojiRegex(), ' '); + + const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2; + let width = 0; + + for (const character of string) { + const codePoint = character.codePointAt(0); + + // Ignore control characters + if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) { + continue; + } + + // Ignore combining characters + if (codePoint >= 0x300 && codePoint <= 0x36F) { + continue; + } + + const code = eastAsianWidth.eastAsianWidth(character); + switch (code) { + case 'F': + case 'W': + width += 2; + break; + case 'A': + width += ambiguousCharacterWidth; + break; + default: + width += 1; + } + } + + return width; +} diff --git a/node_modules/string-width/license b/node_modules/string-width/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/string-width/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/string-width/package.json b/node_modules/string-width/package.json new file mode 100644 index 00000000..f46d6770 --- /dev/null +++ b/node_modules/string-width/package.json @@ -0,0 +1,59 @@ +{ + "name": "string-width", + "version": "5.1.2", + "description": "Get the visual width of a string - the number of columns required to display it", + "license": "MIT", + "repository": "sindresorhus/string-width", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "string", + "character", + "unicode", + "width", + "visual", + "column", + "columns", + "fullwidth", + "full-width", + "full", + "ansi", + "escape", + "codes", + "cli", + "command-line", + "terminal", + "console", + "cjk", + "chinese", + "japanese", + "korean", + "fixed-width" + ], + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.14.0", + "xo": "^0.38.2" + } +} diff --git a/node_modules/string-width/readme.md b/node_modules/string-width/readme.md new file mode 100644 index 00000000..52910df1 --- /dev/null +++ b/node_modules/string-width/readme.md @@ -0,0 +1,67 @@ +# string-width + +> Get the visual width of a string - the number of columns required to display it + +Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. + +Useful to be able to measure the actual width of command-line output. + +## Install + +``` +$ npm install string-width +``` + +## Usage + +```js +import stringWidth from 'string-width'; + +stringWidth('a'); +//=> 1 + +stringWidth('古'); +//=> 2 + +stringWidth('\u001B[1m古\u001B[22m'); +//=> 2 +``` + +## API + +### stringWidth(string, options?) + +#### string + +Type: `string` + +The string to be counted. + +#### options + +Type: `object` + +##### ambiguousIsNarrow + +Type: `boolean`\ +Default: `false` + +Count [ambiguous width characters](https://www.unicode.org/reports/tr11/#Ambiguous) as having narrow width (count of 1) instead of wide width (count of 2). + +## Related + +- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module +- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string +- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string + +--- + +
    + + Get professional support for this package with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    diff --git a/node_modules/strip-ansi-cjs/index.d.ts b/node_modules/strip-ansi-cjs/index.d.ts new file mode 100644 index 00000000..907fccc2 --- /dev/null +++ b/node_modules/strip-ansi-cjs/index.d.ts @@ -0,0 +1,17 @@ +/** +Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. + +@example +``` +import stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` +*/ +declare function stripAnsi(string: string): string; + +export = stripAnsi; diff --git a/node_modules/strip-ansi-cjs/index.js b/node_modules/strip-ansi-cjs/index.js new file mode 100644 index 00000000..9a593dfc --- /dev/null +++ b/node_modules/strip-ansi-cjs/index.js @@ -0,0 +1,4 @@ +'use strict'; +const ansiRegex = require('ansi-regex'); + +module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; diff --git a/node_modules/strip-ansi-cjs/license b/node_modules/strip-ansi-cjs/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/strip-ansi-cjs/license @@ -0,0 +1,9 @@ +MIT License + +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/strip-ansi-cjs/node_modules/ansi-regex/index.d.ts b/node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.d.ts new file mode 100644 index 00000000..2dbf6af2 --- /dev/null +++ b/node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.d.ts @@ -0,0 +1,37 @@ +declare namespace ansiRegex { + interface Options { + /** + Match only the first ANSI escape. + + @default false + */ + onlyFirst: boolean; + } +} + +/** +Regular expression for matching ANSI escape codes. + +@example +``` +import ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` +*/ +declare function ansiRegex(options?: ansiRegex.Options): RegExp; + +export = ansiRegex; diff --git a/node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.js b/node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.js new file mode 100644 index 00000000..616ff837 --- /dev/null +++ b/node_modules/strip-ansi-cjs/node_modules/ansi-regex/index.js @@ -0,0 +1,10 @@ +'use strict'; + +module.exports = ({onlyFirst = false} = {}) => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; diff --git a/node_modules/strip-ansi-cjs/node_modules/ansi-regex/license b/node_modules/strip-ansi-cjs/node_modules/ansi-regex/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/strip-ansi-cjs/node_modules/ansi-regex/license @@ -0,0 +1,9 @@ +MIT License + +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/strip-ansi-cjs/node_modules/ansi-regex/package.json b/node_modules/strip-ansi-cjs/node_modules/ansi-regex/package.json new file mode 100644 index 00000000..017f5311 --- /dev/null +++ b/node_modules/strip-ansi-cjs/node_modules/ansi-regex/package.json @@ -0,0 +1,55 @@ +{ + "name": "ansi-regex", + "version": "5.0.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": "chalk/ansi-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd", + "view-supported": "node fixtures/view-codes.js" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/strip-ansi-cjs/node_modules/ansi-regex/readme.md b/node_modules/strip-ansi-cjs/node_modules/ansi-regex/readme.md new file mode 100644 index 00000000..4d848bc3 --- /dev/null +++ b/node_modules/strip-ansi-cjs/node_modules/ansi-regex/readme.md @@ -0,0 +1,78 @@ +# ansi-regex + +> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +``` +$ npm install ansi-regex +``` + + +## Usage + +```js +const ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001B[4mcake\u001B[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001B[4mcake\u001B[0m'.match(ansiRegex()); +//=> ['\u001B[4m', '\u001B[0m'] + +'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true})); +//=> ['\u001B[4m'] + +'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex()); +//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007'] +``` + + +## API + +### ansiRegex(options?) + +Returns a regex for matching ANSI escape codes. + +#### options + +Type: `object` + +##### onlyFirst + +Type: `boolean`
    +Default: `false` *(Matches any ANSI escape codes in a string)* + +Match only the first ANSI escape. + + +## FAQ + +### Why do you test for codes not in the ECMA 48 standard? + +Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them. + +On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out. + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +--- + +
    + + Get professional support for this package with a Tidelift subscription + +
    + + Tidelift helps make open source sustainable for maintainers while giving companies
    assurances about security, maintenance, and licensing for their dependencies. +
    +
    diff --git a/node_modules/strip-ansi-cjs/package.json b/node_modules/strip-ansi-cjs/package.json new file mode 100644 index 00000000..1a41108d --- /dev/null +++ b/node_modules/strip-ansi-cjs/package.json @@ -0,0 +1,54 @@ +{ + "name": "strip-ansi", + "version": "6.0.1", + "description": "Strip ANSI escape codes from a string", + "license": "MIT", + "repository": "chalk/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.10.0", + "xo": "^0.25.3" + } +} diff --git a/node_modules/strip-ansi-cjs/readme.md b/node_modules/strip-ansi-cjs/readme.md new file mode 100644 index 00000000..7c4b56d4 --- /dev/null +++ b/node_modules/strip-ansi-cjs/readme.md @@ -0,0 +1,46 @@ +# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) + +> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string + + +## Install + +``` +$ npm install strip-ansi +``` + + +## Usage + +```js +const stripAnsi = require('strip-ansi'); + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` + + +## strip-ansi for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + + +## Related + +- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module +- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes +- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + diff --git a/node_modules/strip-ansi/index.d.ts b/node_modules/strip-ansi/index.d.ts new file mode 100644 index 00000000..44e954d0 --- /dev/null +++ b/node_modules/strip-ansi/index.d.ts @@ -0,0 +1,15 @@ +/** +Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. + +@example +``` +import stripAnsi from 'strip-ansi'; + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` +*/ +export default function stripAnsi(string: string): string; diff --git a/node_modules/strip-ansi/index.js b/node_modules/strip-ansi/index.js new file mode 100644 index 00000000..ba19750e --- /dev/null +++ b/node_modules/strip-ansi/index.js @@ -0,0 +1,14 @@ +import ansiRegex from 'ansi-regex'; + +const regex = ansiRegex(); + +export default function stripAnsi(string) { + if (typeof string !== 'string') { + throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); + } + + // Even though the regex is global, we don't need to reset the `.lastIndex` + // because unlike `.exec()` and `.test()`, `.replace()` does it automatically + // and doing it manually has a performance penalty. + return string.replace(regex, ''); +} diff --git a/node_modules/strip-ansi/license b/node_modules/strip-ansi/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/strip-ansi/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://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/strip-ansi/package.json b/node_modules/strip-ansi/package.json new file mode 100644 index 00000000..e1f455c3 --- /dev/null +++ b/node_modules/strip-ansi/package.json @@ -0,0 +1,57 @@ +{ + "name": "strip-ansi", + "version": "7.1.0", + "description": "Strip ANSI escape codes from a string", + "license": "MIT", + "repository": "chalk/strip-ansi", + "funding": "https://github.com/chalk/strip-ansi?sponsor=1", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "type": "module", + "exports": "./index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "devDependencies": { + "ava": "^3.15.0", + "tsd": "^0.17.0", + "xo": "^0.44.0" + } +} diff --git a/node_modules/strip-ansi/readme.md b/node_modules/strip-ansi/readme.md new file mode 100644 index 00000000..56278510 --- /dev/null +++ b/node_modules/strip-ansi/readme.md @@ -0,0 +1,41 @@ +# strip-ansi + +> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string + +## Install + +``` +$ npm install strip-ansi +``` + +## Usage + +```js +import stripAnsi from 'strip-ansi'; + +stripAnsi('\u001B[4mUnicorn\u001B[0m'); +//=> 'Unicorn' + +stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); +//=> 'Click' +``` + +## strip-ansi for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) + +## Related + +- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module +- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module +- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes +- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + diff --git a/node_modules/strip-outer/index.js b/node_modules/strip-outer/index.js new file mode 100644 index 00000000..497186a7 --- /dev/null +++ b/node_modules/strip-outer/index.js @@ -0,0 +1,11 @@ +'use strict'; +var escapeStringRegexp = require('escape-string-regexp'); + +module.exports = function (str, sub) { + if (typeof str !== 'string' || typeof sub !== 'string') { + throw new TypeError(); + } + + sub = escapeStringRegexp(sub); + return str.replace(new RegExp('^' + sub + '|' + sub + '$', 'g'), ''); +}; diff --git a/node_modules/strip-outer/license b/node_modules/strip-outer/license new file mode 100644 index 00000000..654d0bfe --- /dev/null +++ b/node_modules/strip-outer/license @@ -0,0 +1,21 @@ +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/strip-outer/package.json b/node_modules/strip-outer/package.json new file mode 100644 index 00000000..f98d0464 --- /dev/null +++ b/node_modules/strip-outer/package.json @@ -0,0 +1,44 @@ +{ + "name": "strip-outer", + "version": "1.0.1", + "description": "Strip a substring from the start/end of a string", + "license": "MIT", + "repository": "sindresorhus/strip-outer", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "strip", + "trim", + "remove", + "outer", + "str", + "string", + "substring", + "start", + "end", + "wrap", + "leading", + "trailing", + "regex", + "regexp" + ], + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/strip-outer/readme.md b/node_modules/strip-outer/readme.md new file mode 100644 index 00000000..4f4bee29 --- /dev/null +++ b/node_modules/strip-outer/readme.md @@ -0,0 +1,28 @@ +# strip-outer [![Build Status](https://travis-ci.org/sindresorhus/strip-outer.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-outer) + +> Strip a substring from the start/end of a string + + +## Install + +``` +$ npm install --save strip-outer +``` + + +## Usage + +```js +const stripOuter = require('strip-outer'); + +stripOuter('foobarfoo', 'foo'); +//=> 'bar' + +stripOuter('unicorncake', 'unicorn'); +//=> 'cake' +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/style-value-types/CHANGELOG.md b/node_modules/style-value-types/CHANGELOG.md new file mode 100644 index 00000000..bb65f501 --- /dev/null +++ b/node_modules/style-value-types/CHANGELOG.md @@ -0,0 +1,219 @@ +# Changelog + +Style Value Types adheres to [Semantic Versioning](http://semver.org/). + +## [5.1.2] 2022-08-15 + +### Update + +- Updating `tslib` and `typescript`. + +## [5.1.1] 2022-08-10 + +### Fixed + +- Supporting `rgba` and `hsla` values without spaces around the alpha slash. + +### Update + +- Adding `types` to `exports` field. + +## [5.1.0] 2021-11-24 + +### Update + +- Updating `tslib`. + +## [5.0.0] 2021-09-23 + +### Fixed + +- Fixing `exports` and `module` in `package.json`. This will break (unsupported) direct file imports. + +### [4.1.5] 2021-09-21 + +### Fixed + +- Making complex value type gracefully accept numbers. + +### [4.1.4] 2021-03-19 + +### Fixed + +- Fixing `main` entry point. + +### [4.1.3] 2021-03-19 + +### Fixed + +- Fixing `main` entry point. + +### [4.1.2] 2021-03-19 + +### Added + +- Adding `exports` to `package.json`. + +### Updated + +- `tslib` to latest. + +### [4.1.1] 2021-03-01 + +### Fixed + +- Fixing es entry point. + +### [4.1.0] 2021-03-01 + +### Fixed + +- Unbundling ES code to facilitate code-splitting in Webpack. + +## [4.0.3] 2020-02-22 + +### Fixed + +- Fixing `hasOwnProperty` call on `null` for color test. + +## [4.0.1] 2020-01-08 + +### Added + +- Restoring support for RGBA/HSLA objects in rgba.parse/hsla.parse. + +## [4.0.0] 2020-01-08 + +### Added + +- Support for hex alpha. +- `filter` type. +- Improved handling of decimals with no preceding digit. + +### Removed + +- Support for RGBA/HSLA objects in rgba.parse/hsla.parse. + +## [3.2.0] 2020-12-18 + +### Fixed + +- Including `tslib` as a separate dependency. + +## [3.1.9] 2020-07-23 + +### Fixed + +- Fixed opacity with whitespace syntax colors. + +## [3.1.8] 2020-07-23 + +### Fixed + +- Fixed whitespace syntax colors. +- Fixed HSL(A) colors containing decimals. + +## [3.1.7] 2019-11-14 + +### Fixed + +- Updating to Typescript 3.7. + +## [3.1.6] 2019-07-25 + +### Fixed + +- Clamping color alpha to 0-1. + +## [3.1.4] 2019-05-01 + +### Fixed + +- Rejecting `complex` values in `color` tests. + +## [3.1.3] 2019-04-29 + +### Fixed + +- Dynamic type imports. + +## [3.1.2] 2019-04-29 + +### Removed + +- Hard `ValueType` typing from `complex`. + +## [3.1.1] 2019-04-29 + +### Added + +- `getAnimatableNone` to `complex` value type. + +## [3.1.0] 2019-03-12 + +### Added + +- `progressPercentage` value type. + +## [3.0.7] 2018-08-30 + +### Fixed + +- Preventing unit types from matching anything that contains that string ie px matching to `blur(20px)`. + +## [3.0.6] 2018-08-16 + +### Fixed + +- Detecting exponential values in complex.createTransformer. [#423](https://github.com/Popmotion/popmotion/issues/423) + +## [3.0.5] 2018-08-14 + +### Fixed + +- Preventing `complex` from matching `number`. + +## [3.0.4] 2018-08-13 + +### Fixed + +- Fixed a bug in the complex value type where single function-like values, like `grayscale(0%)` aren't recognised as complex value types. + +## [3.0.3] 2018-06-28 + +### Fixed + +- Fixing error in `tsconfig.json` that leaves code untranspiled. + +## [3.0.2] 2018-06-27 + +### Fixed + +- Improving color regex to pick 6-letter hex codes first. + +## [3.0.1] 2018-06-27 + +### Fixed + +- Fixing template algo. + +## [3.0.0] 2018-06-22 + +### Removed + +- Removed new `combo` in favour of a single unified `complex` value type that can handle mixed number and color strings. + +## [2.0.1] 2018-06-21 + +### Fixed + +- Now finding colors containing spaces within combo values. + +## [2.0.0] 2018-06-20 + +### Added + +- New units: `vh`, `vw` +- New space-delimited combo type +- Strengthened unit type tests +- Color types can accept already-parsed numbers diff --git a/node_modules/style-value-types/LICENSE.md b/node_modules/style-value-types/LICENSE.md new file mode 100644 index 00000000..13575d10 --- /dev/null +++ b/node_modules/style-value-types/LICENSE.md @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2018 Popmotion + +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. \ No newline at end of file diff --git a/node_modules/style-value-types/README.md b/node_modules/style-value-types/README.md new file mode 100644 index 00000000..728a1a0c --- /dev/null +++ b/node_modules/style-value-types/README.md @@ -0,0 +1,64 @@ +# Style Value Types +Parsers, transformers and tests for common style value types, eg: %, hex codes etc. + +To help convert numerical values into commonly-used special value types, like `px` or `hex`, we provide an optional module called `style-value-types`: + +```bash +npm install style-value-types --save +``` + +Each value type has three functions: + +- `test`: Returns `true` if the provided value is of that type. +- `parse`: Returns the value in a format suitable for animation. Either a `number` or `{ [key: string]: number }`. + +And one of: +- `transform`: The reverse of `parse`. Accepts a `number` or map of named numbers and converts that into the value type. +- `createTransformer`: Accepts a value and returns a `transform` based on that specific value. + +## Import + +```javascript +import { color } from 'style-value-types'; +``` + +## Example + +```javascript +// Test +color.test('#fff'); // true +color.test(0); // false + +// Parse +color.parse('rgba(255, 255, 255, 0)'); +// { red: 255, green: 255, blue: 255, alpha: 0 } + +// Transform +color.transform({ hue: 200, saturation: 100, lightness: 50, alpha: 0.5 }); +// 'hsla(200, 100%, 50%, 0.5)' +``` + +## Included value types + +- `alpha`: `Number` between `0` and `1` +- `complex`: Handles space and comma delimited values, like CSS box-shadow: `'10px 10px inset #f00, 5px 5px 30px #fff'`, gradient or a path definition. +- `color`: `String` of either `hex`, `hsla` or `rgba` type +- `degrees`: `String` ending in `deg` +- `hex`: `String` beginning with `#` and followed by 3 or 6-digit hex code +- `hsla`: `String` with valid `hsla` property +- `percent`: `String` ending in `%` +- `px`: `String` ending in `px` +- `scale`: `Number` with a `default` of `1` instead of `0` +- `rgbUnit`: Integer between `1` and `255` +- `rgba`: String in `rgba(rgbUnit, rgbUnit, rgbUnit, alpha)` format + +## complex + +The `complex` value type is slightly different to the others. Instead of a `transform` method, it has a `createTransformer` method which returns the `transform` method: + +```javascript +const svgPath = 'M150 0 L75 200'; +const transform = complex.createTransformer(svgPath); +``` + +The returned `transform` function is unique to the string given to it. When this function is provided an object of the same format as returned by `complex.parse()` (in this example `complex.parse(svgPath)`), it will use the original string as a template. diff --git a/node_modules/style-value-types/dist/es/color/hex.mjs b/node_modules/style-value-types/dist/es/color/hex.mjs new file mode 100644 index 00000000..7e2efe53 --- /dev/null +++ b/node_modules/style-value-types/dist/es/color/hex.mjs @@ -0,0 +1,38 @@ +import { rgba } from './rgba.mjs'; +import { isColorString } from './utils.mjs'; + +function parseHex(v) { + let r = ''; + let g = ''; + let b = ''; + let a = ''; + if (v.length > 5) { + r = v.substr(1, 2); + g = v.substr(3, 2); + b = v.substr(5, 2); + a = v.substr(7, 2); + } + else { + r = v.substr(1, 1); + g = v.substr(2, 1); + b = v.substr(3, 1); + a = v.substr(4, 1); + r += r; + g += g; + b += b; + a += a; + } + return { + red: parseInt(r, 16), + green: parseInt(g, 16), + blue: parseInt(b, 16), + alpha: a ? parseInt(a, 16) / 255 : 1, + }; +} +const hex = { + test: isColorString('#'), + parse: parseHex, + transform: rgba.transform, +}; + +export { hex }; diff --git a/node_modules/style-value-types/dist/es/color/hsla.mjs b/node_modules/style-value-types/dist/es/color/hsla.mjs new file mode 100644 index 00000000..5db6f208 --- /dev/null +++ b/node_modules/style-value-types/dist/es/color/hsla.mjs @@ -0,0 +1,22 @@ +import { alpha } from '../numbers/index.mjs'; +import { percent } from '../numbers/units.mjs'; +import { sanitize } from '../utils.mjs'; +import { isColorString, splitColor } from './utils.mjs'; + +const hsla = { + test: isColorString('hsl', 'hue'), + parse: splitColor('hue', 'saturation', 'lightness'), + transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => { + return ('hsla(' + + Math.round(hue) + + ', ' + + percent.transform(sanitize(saturation)) + + ', ' + + percent.transform(sanitize(lightness)) + + ', ' + + sanitize(alpha.transform(alpha$1)) + + ')'); + }, +}; + +export { hsla }; diff --git a/node_modules/style-value-types/dist/es/color/index.mjs b/node_modules/style-value-types/dist/es/color/index.mjs new file mode 100644 index 00000000..abc5c2bc --- /dev/null +++ b/node_modules/style-value-types/dist/es/color/index.mjs @@ -0,0 +1,28 @@ +import { isString } from '../utils.mjs'; +import { hex } from './hex.mjs'; +import { hsla } from './hsla.mjs'; +import { rgba } from './rgba.mjs'; + +const color = { + test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v), + parse: (v) => { + if (rgba.test(v)) { + return rgba.parse(v); + } + else if (hsla.test(v)) { + return hsla.parse(v); + } + else { + return hex.parse(v); + } + }, + transform: (v) => { + return isString(v) + ? v + : v.hasOwnProperty('red') + ? rgba.transform(v) + : hsla.transform(v); + }, +}; + +export { color }; diff --git a/node_modules/style-value-types/dist/es/color/rgba.mjs b/node_modules/style-value-types/dist/es/color/rgba.mjs new file mode 100644 index 00000000..30e553e1 --- /dev/null +++ b/node_modules/style-value-types/dist/es/color/rgba.mjs @@ -0,0 +1,21 @@ +import { number, alpha } from '../numbers/index.mjs'; +import { sanitize, clamp } from '../utils.mjs'; +import { isColorString, splitColor } from './utils.mjs'; + +const clampRgbUnit = clamp(0, 255); +const rgbUnit = Object.assign(Object.assign({}, number), { transform: (v) => Math.round(clampRgbUnit(v)) }); +const rgba = { + test: isColorString('rgb', 'red'), + parse: splitColor('red', 'green', 'blue'), + transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => 'rgba(' + + rgbUnit.transform(red) + + ', ' + + rgbUnit.transform(green) + + ', ' + + rgbUnit.transform(blue) + + ', ' + + sanitize(alpha.transform(alpha$1)) + + ')', +}; + +export { rgbUnit, rgba }; diff --git a/node_modules/style-value-types/dist/es/color/utils.mjs b/node_modules/style-value-types/dist/es/color/utils.mjs new file mode 100644 index 00000000..21e182d2 --- /dev/null +++ b/node_modules/style-value-types/dist/es/color/utils.mjs @@ -0,0 +1,19 @@ +import { isString, singleColorRegex, floatRegex } from '../utils.mjs'; + +const isColorString = (type, testProp) => (v) => { + return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) || + (testProp && Object.prototype.hasOwnProperty.call(v, testProp))); +}; +const splitColor = (aName, bName, cName) => (v) => { + if (!isString(v)) + return v; + const [a, b, c, alpha] = v.match(floatRegex); + return { + [aName]: parseFloat(a), + [bName]: parseFloat(b), + [cName]: parseFloat(c), + alpha: alpha !== undefined ? parseFloat(alpha) : 1, + }; +}; + +export { isColorString, splitColor }; diff --git a/node_modules/style-value-types/dist/es/complex/filter.mjs b/node_modules/style-value-types/dist/es/complex/filter.mjs new file mode 100644 index 00000000..f83a5d6d --- /dev/null +++ b/node_modules/style-value-types/dist/es/complex/filter.mjs @@ -0,0 +1,24 @@ +import { complex } from './index.mjs'; +import { floatRegex } from '../utils.mjs'; + +const maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']); +function applyDefaultFilter(v) { + let [name, value] = v.slice(0, -1).split('('); + if (name === 'drop-shadow') + return v; + const [number] = value.match(floatRegex) || []; + if (!number) + return v; + const unit = value.replace(number, ''); + let defaultValue = maxDefaults.has(name) ? 1 : 0; + if (number !== value) + defaultValue *= 100; + return name + '(' + defaultValue + unit + ')'; +} +const functionRegex = /([a-z-]*)\(.*?\)/g; +const filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v) => { + const functions = v.match(functionRegex); + return functions ? functions.map(applyDefaultFilter).join(' ') : v; + } }); + +export { filter }; diff --git a/node_modules/style-value-types/dist/es/complex/index.mjs b/node_modules/style-value-types/dist/es/complex/index.mjs new file mode 100644 index 00000000..5d746a86 --- /dev/null +++ b/node_modules/style-value-types/dist/es/complex/index.mjs @@ -0,0 +1,53 @@ +import { color } from '../color/index.mjs'; +import { number } from '../numbers/index.mjs'; +import { isString, floatRegex, colorRegex, sanitize } from '../utils.mjs'; + +const colorToken = '${c}'; +const numberToken = '${n}'; +function test(v) { + var _a, _b, _c, _d; + return (isNaN(v) && + isString(v) && + ((_b = (_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(colorRegex)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0); +} +function analyse(v) { + if (typeof v === 'number') + v = `${v}`; + const values = []; + let numColors = 0; + const colors = v.match(colorRegex); + if (colors) { + numColors = colors.length; + v = v.replace(colorRegex, colorToken); + values.push(...colors.map(color.parse)); + } + const numbers = v.match(floatRegex); + if (numbers) { + v = v.replace(floatRegex, numberToken); + values.push(...numbers.map(number.parse)); + } + return { values, numColors, tokenised: v }; +} +function parse(v) { + return analyse(v).values; +} +function createTransformer(v) { + const { values, numColors, tokenised } = analyse(v); + const numValues = values.length; + return (v) => { + let output = tokenised; + for (let i = 0; i < numValues; i++) { + output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i])); + } + return output; + }; +} +const convertNumbersToZero = (v) => typeof v === 'number' ? 0 : v; +function getAnimatableNone(v) { + const parsed = parse(v); + const transformer = createTransformer(v); + return transformer(parsed.map(convertNumbersToZero)); +} +const complex = { test, parse, createTransformer, getAnimatableNone }; + +export { complex }; diff --git a/node_modules/style-value-types/dist/es/index.mjs b/node_modules/style-value-types/dist/es/index.mjs new file mode 100644 index 00000000..f61bf083 --- /dev/null +++ b/node_modules/style-value-types/dist/es/index.mjs @@ -0,0 +1,8 @@ +export { alpha, number, scale } from './numbers/index.mjs'; +export { degrees, percent, progressPercentage, px, vh, vw } from './numbers/units.mjs'; +export { hsla } from './color/hsla.mjs'; +export { rgbUnit, rgba } from './color/rgba.mjs'; +export { hex } from './color/hex.mjs'; +export { color } from './color/index.mjs'; +export { complex } from './complex/index.mjs'; +export { filter } from './complex/filter.mjs'; diff --git a/node_modules/style-value-types/dist/es/numbers/index.mjs b/node_modules/style-value-types/dist/es/numbers/index.mjs new file mode 100644 index 00000000..e6904018 --- /dev/null +++ b/node_modules/style-value-types/dist/es/numbers/index.mjs @@ -0,0 +1,11 @@ +import { clamp } from '../utils.mjs'; + +const number = { + test: (v) => typeof v === 'number', + parse: parseFloat, + transform: (v) => v, +}; +const alpha = Object.assign(Object.assign({}, number), { transform: clamp(0, 1) }); +const scale = Object.assign(Object.assign({}, number), { default: 1 }); + +export { alpha, number, scale }; diff --git a/node_modules/style-value-types/dist/es/numbers/units.mjs b/node_modules/style-value-types/dist/es/numbers/units.mjs new file mode 100644 index 00000000..24b7015d --- /dev/null +++ b/node_modules/style-value-types/dist/es/numbers/units.mjs @@ -0,0 +1,15 @@ +import { isString } from '../utils.mjs'; + +const createUnitType = (unit) => ({ + test: (v) => isString(v) && v.endsWith(unit) && v.split(' ').length === 1, + parse: parseFloat, + transform: (v) => `${v}${unit}`, +}); +const degrees = createUnitType('deg'); +const percent = createUnitType('%'); +const px = createUnitType('px'); +const vh = createUnitType('vh'); +const vw = createUnitType('vw'); +const progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) }); + +export { degrees, percent, progressPercentage, px, vh, vw }; diff --git a/node_modules/style-value-types/dist/es/utils.mjs b/node_modules/style-value-types/dist/es/utils.mjs new file mode 100644 index 00000000..32b7ca8d --- /dev/null +++ b/node_modules/style-value-types/dist/es/utils.mjs @@ -0,0 +1,10 @@ +const clamp = (min, max) => (v) => Math.max(Math.min(v, max), min); +const sanitize = (v) => (v % 1 ? Number(v.toFixed(5)) : v); +const floatRegex = /(-)?([\d]*\.?[\d])+/g; +const colorRegex = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi; +const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i; +function isString(v) { + return typeof v === 'string'; +} + +export { clamp, colorRegex, floatRegex, isString, sanitize, singleColorRegex }; diff --git a/node_modules/style-value-types/dist/style-value-types.min.js b/node_modules/style-value-types/dist/style-value-types.min.js new file mode 100644 index 00000000..de51a4a4 --- /dev/null +++ b/node_modules/style-value-types/dist/style-value-types.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).valueTypes={})}(this,(function(t){"use strict";const e=(t,e)=>s=>Math.max(Math.min(s,e),t),s=t=>t%1?Number(t.toFixed(5)):t,r=/(-)?([\d]*\.?[\d])+/g,n=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,a=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function o(t){return"string"==typeof t}const l={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},u=Object.assign(Object.assign({},l),{transform:e(0,1)}),i=Object.assign(Object.assign({},l),{default:1}),p=t=>({test:e=>o(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),c=p("deg"),f=p("%"),h=p("px"),m=p("vh"),d=p("vw"),b=Object.assign(Object.assign({},f),{parse:t=>f.parse(t)/100,transform:t=>f.transform(100*t)}),g=(t,e)=>s=>Boolean(o(s)&&a.test(s)&&s.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(s,e)),v=(t,e,s)=>n=>{if(!o(n))return n;const[a,l,u,i]=n.match(r);return{[t]:parseFloat(a),[e]:parseFloat(l),[s]:parseFloat(u),alpha:void 0!==i?parseFloat(i):1}},j={test:g("hsl","hue"),parse:v("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+f.transform(s(e))+", "+f.transform(s(r))+", "+s(u.transform(n))+")"},y=e(0,255),O=Object.assign(Object.assign({},l),{transform:t=>Math.round(y(t))}),x={test:g("rgb","red"),parse:v("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+O.transform(t)+", "+O.transform(e)+", "+O.transform(r)+", "+s(u.transform(n))+")"};const F={test:g("#"),parse:function(t){let e="",s="",r="",n="";return t.length>5?(e=t.substr(1,2),s=t.substr(3,2),r=t.substr(5,2),n=t.substr(7,2)):(e=t.substr(1,1),s=t.substr(2,1),r=t.substr(3,1),n=t.substr(4,1),e+=e,s+=s,r+=r,n+=n),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:n?parseInt(n,16)/255:1}},transform:x.transform},w={test:t=>x.test(t)||F.test(t)||j.test(t),parse:t=>x.test(t)?x.parse(t):j.test(t)?j.parse(t):F.parse(t),transform:t=>o(t)?t:t.hasOwnProperty("red")?x.transform(t):j.transform(t)},$="${c}",M="${n}";function N(t){"number"==typeof t&&(t=`${t}`);const e=[];let s=0;const a=t.match(n);a&&(s=a.length,t=t.replace(n,$),e.push(...a.map(w.parse)));const o=t.match(r);return o&&(t=t.replace(r,M),e.push(...o.map(l.parse))),{values:e,numColors:s,tokenised:t}}function I(t){return N(t).values}function P(t){const{values:e,numColors:r,tokenised:n}=N(t),a=e.length;return t=>{let e=n;for(let n=0;n"number"==typeof t?0:t;const k={test:function(t){var e,s,a,l;return isNaN(t)&&o(t)&&(null!==(s=null===(e=t.match(r))||void 0===e?void 0:e.length)&&void 0!==s?s:0)+(null!==(l=null===(a=t.match(n))||void 0===a?void 0:a.length)&&void 0!==l?l:0)>0},parse:I,createTransformer:P,getAnimatableNone:function(t){const e=I(t);return P(t)(e.map(T))}},A=new Set(["brightness","contrast","saturate","opacity"]);function C(t){let[e,s]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[n]=s.match(r)||[];if(!n)return t;const a=s.replace(n,"");let o=A.has(e)?1:0;return n!==s&&(o*=100),e+"("+o+a+")"}const W=/([a-z-]*)\(.*?\)/g,_=Object.assign(Object.assign({},k),{getAnimatableNone:t=>{const e=t.match(W);return e?e.map(C).join(" "):t}});t.alpha=u,t.color=w,t.complex=k,t.degrees=c,t.filter=_,t.hex=F,t.hsla=j,t.number=l,t.percent=f,t.progressPercentage=b,t.px=h,t.rgbUnit=O,t.rgba=x,t.scale=i,t.vh=m,t.vw=d,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/node_modules/style-value-types/dist/valueTypes.cjs.js b/node_modules/style-value-types/dist/valueTypes.cjs.js new file mode 100644 index 00000000..04d55fd4 --- /dev/null +++ b/node_modules/style-value-types/dist/valueTypes.cjs.js @@ -0,0 +1,221 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +const clamp = (min, max) => (v) => Math.max(Math.min(v, max), min); +const sanitize = (v) => (v % 1 ? Number(v.toFixed(5)) : v); +const floatRegex = /(-)?([\d]*\.?[\d])+/g; +const colorRegex = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi; +const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i; +function isString(v) { + return typeof v === 'string'; +} + +const number = { + test: (v) => typeof v === 'number', + parse: parseFloat, + transform: (v) => v, +}; +const alpha = Object.assign(Object.assign({}, number), { transform: clamp(0, 1) }); +const scale = Object.assign(Object.assign({}, number), { default: 1 }); + +const createUnitType = (unit) => ({ + test: (v) => isString(v) && v.endsWith(unit) && v.split(' ').length === 1, + parse: parseFloat, + transform: (v) => `${v}${unit}`, +}); +const degrees = createUnitType('deg'); +const percent = createUnitType('%'); +const px = createUnitType('px'); +const vh = createUnitType('vh'); +const vw = createUnitType('vw'); +const progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) }); + +const isColorString = (type, testProp) => (v) => { + return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) || + (testProp && Object.prototype.hasOwnProperty.call(v, testProp))); +}; +const splitColor = (aName, bName, cName) => (v) => { + if (!isString(v)) + return v; + const [a, b, c, alpha] = v.match(floatRegex); + return { + [aName]: parseFloat(a), + [bName]: parseFloat(b), + [cName]: parseFloat(c), + alpha: alpha !== undefined ? parseFloat(alpha) : 1, + }; +}; + +const hsla = { + test: isColorString('hsl', 'hue'), + parse: splitColor('hue', 'saturation', 'lightness'), + transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => { + return ('hsla(' + + Math.round(hue) + + ', ' + + percent.transform(sanitize(saturation)) + + ', ' + + percent.transform(sanitize(lightness)) + + ', ' + + sanitize(alpha.transform(alpha$1)) + + ')'); + }, +}; + +const clampRgbUnit = clamp(0, 255); +const rgbUnit = Object.assign(Object.assign({}, number), { transform: (v) => Math.round(clampRgbUnit(v)) }); +const rgba = { + test: isColorString('rgb', 'red'), + parse: splitColor('red', 'green', 'blue'), + transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => 'rgba(' + + rgbUnit.transform(red) + + ', ' + + rgbUnit.transform(green) + + ', ' + + rgbUnit.transform(blue) + + ', ' + + sanitize(alpha.transform(alpha$1)) + + ')', +}; + +function parseHex(v) { + let r = ''; + let g = ''; + let b = ''; + let a = ''; + if (v.length > 5) { + r = v.substr(1, 2); + g = v.substr(3, 2); + b = v.substr(5, 2); + a = v.substr(7, 2); + } + else { + r = v.substr(1, 1); + g = v.substr(2, 1); + b = v.substr(3, 1); + a = v.substr(4, 1); + r += r; + g += g; + b += b; + a += a; + } + return { + red: parseInt(r, 16), + green: parseInt(g, 16), + blue: parseInt(b, 16), + alpha: a ? parseInt(a, 16) / 255 : 1, + }; +} +const hex = { + test: isColorString('#'), + parse: parseHex, + transform: rgba.transform, +}; + +const color = { + test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v), + parse: (v) => { + if (rgba.test(v)) { + return rgba.parse(v); + } + else if (hsla.test(v)) { + return hsla.parse(v); + } + else { + return hex.parse(v); + } + }, + transform: (v) => { + return isString(v) + ? v + : v.hasOwnProperty('red') + ? rgba.transform(v) + : hsla.transform(v); + }, +}; + +const colorToken = '${c}'; +const numberToken = '${n}'; +function test(v) { + var _a, _b, _c, _d; + return (isNaN(v) && + isString(v) && + ((_b = (_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(colorRegex)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0); +} +function analyse(v) { + if (typeof v === 'number') + v = `${v}`; + const values = []; + let numColors = 0; + const colors = v.match(colorRegex); + if (colors) { + numColors = colors.length; + v = v.replace(colorRegex, colorToken); + values.push(...colors.map(color.parse)); + } + const numbers = v.match(floatRegex); + if (numbers) { + v = v.replace(floatRegex, numberToken); + values.push(...numbers.map(number.parse)); + } + return { values, numColors, tokenised: v }; +} +function parse(v) { + return analyse(v).values; +} +function createTransformer(v) { + const { values, numColors, tokenised } = analyse(v); + const numValues = values.length; + return (v) => { + let output = tokenised; + for (let i = 0; i < numValues; i++) { + output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i])); + } + return output; + }; +} +const convertNumbersToZero = (v) => typeof v === 'number' ? 0 : v; +function getAnimatableNone(v) { + const parsed = parse(v); + const transformer = createTransformer(v); + return transformer(parsed.map(convertNumbersToZero)); +} +const complex = { test, parse, createTransformer, getAnimatableNone }; + +const maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']); +function applyDefaultFilter(v) { + let [name, value] = v.slice(0, -1).split('('); + if (name === 'drop-shadow') + return v; + const [number] = value.match(floatRegex) || []; + if (!number) + return v; + const unit = value.replace(number, ''); + let defaultValue = maxDefaults.has(name) ? 1 : 0; + if (number !== value) + defaultValue *= 100; + return name + '(' + defaultValue + unit + ')'; +} +const functionRegex = /([a-z-]*)\(.*?\)/g; +const filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v) => { + const functions = v.match(functionRegex); + return functions ? functions.map(applyDefaultFilter).join(' ') : v; + } }); + +exports.alpha = alpha; +exports.color = color; +exports.complex = complex; +exports.degrees = degrees; +exports.filter = filter; +exports.hex = hex; +exports.hsla = hsla; +exports.number = number; +exports.percent = percent; +exports.progressPercentage = progressPercentage; +exports.px = px; +exports.rgbUnit = rgbUnit; +exports.rgba = rgba; +exports.scale = scale; +exports.vh = vh; +exports.vw = vw; diff --git a/node_modules/style-value-types/dist/valueTypes.js b/node_modules/style-value-types/dist/valueTypes.js new file mode 100644 index 00000000..bf80b4e9 --- /dev/null +++ b/node_modules/style-value-types/dist/valueTypes.js @@ -0,0 +1,227 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.valueTypes = {})); +}(this, (function (exports) { 'use strict'; + + const clamp = (min, max) => (v) => Math.max(Math.min(v, max), min); + const sanitize = (v) => (v % 1 ? Number(v.toFixed(5)) : v); + const floatRegex = /(-)?([\d]*\.?[\d])+/g; + const colorRegex = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi; + const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i; + function isString(v) { + return typeof v === 'string'; + } + + const number = { + test: (v) => typeof v === 'number', + parse: parseFloat, + transform: (v) => v, + }; + const alpha = Object.assign(Object.assign({}, number), { transform: clamp(0, 1) }); + const scale = Object.assign(Object.assign({}, number), { default: 1 }); + + const createUnitType = (unit) => ({ + test: (v) => isString(v) && v.endsWith(unit) && v.split(' ').length === 1, + parse: parseFloat, + transform: (v) => `${v}${unit}`, + }); + const degrees = createUnitType('deg'); + const percent = createUnitType('%'); + const px = createUnitType('px'); + const vh = createUnitType('vh'); + const vw = createUnitType('vw'); + const progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) }); + + const isColorString = (type, testProp) => (v) => { + return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) || + (testProp && Object.prototype.hasOwnProperty.call(v, testProp))); + }; + const splitColor = (aName, bName, cName) => (v) => { + if (!isString(v)) + return v; + const [a, b, c, alpha] = v.match(floatRegex); + return { + [aName]: parseFloat(a), + [bName]: parseFloat(b), + [cName]: parseFloat(c), + alpha: alpha !== undefined ? parseFloat(alpha) : 1, + }; + }; + + const hsla = { + test: isColorString('hsl', 'hue'), + parse: splitColor('hue', 'saturation', 'lightness'), + transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => { + return ('hsla(' + + Math.round(hue) + + ', ' + + percent.transform(sanitize(saturation)) + + ', ' + + percent.transform(sanitize(lightness)) + + ', ' + + sanitize(alpha.transform(alpha$1)) + + ')'); + }, + }; + + const clampRgbUnit = clamp(0, 255); + const rgbUnit = Object.assign(Object.assign({}, number), { transform: (v) => Math.round(clampRgbUnit(v)) }); + const rgba = { + test: isColorString('rgb', 'red'), + parse: splitColor('red', 'green', 'blue'), + transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => 'rgba(' + + rgbUnit.transform(red) + + ', ' + + rgbUnit.transform(green) + + ', ' + + rgbUnit.transform(blue) + + ', ' + + sanitize(alpha.transform(alpha$1)) + + ')', + }; + + function parseHex(v) { + let r = ''; + let g = ''; + let b = ''; + let a = ''; + if (v.length > 5) { + r = v.substr(1, 2); + g = v.substr(3, 2); + b = v.substr(5, 2); + a = v.substr(7, 2); + } + else { + r = v.substr(1, 1); + g = v.substr(2, 1); + b = v.substr(3, 1); + a = v.substr(4, 1); + r += r; + g += g; + b += b; + a += a; + } + return { + red: parseInt(r, 16), + green: parseInt(g, 16), + blue: parseInt(b, 16), + alpha: a ? parseInt(a, 16) / 255 : 1, + }; + } + const hex = { + test: isColorString('#'), + parse: parseHex, + transform: rgba.transform, + }; + + const color = { + test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v), + parse: (v) => { + if (rgba.test(v)) { + return rgba.parse(v); + } + else if (hsla.test(v)) { + return hsla.parse(v); + } + else { + return hex.parse(v); + } + }, + transform: (v) => { + return isString(v) + ? v + : v.hasOwnProperty('red') + ? rgba.transform(v) + : hsla.transform(v); + }, + }; + + const colorToken = '${c}'; + const numberToken = '${n}'; + function test(v) { + var _a, _b, _c, _d; + return (isNaN(v) && + isString(v) && + ((_b = (_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(colorRegex)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0); + } + function analyse(v) { + if (typeof v === 'number') + v = `${v}`; + const values = []; + let numColors = 0; + const colors = v.match(colorRegex); + if (colors) { + numColors = colors.length; + v = v.replace(colorRegex, colorToken); + values.push(...colors.map(color.parse)); + } + const numbers = v.match(floatRegex); + if (numbers) { + v = v.replace(floatRegex, numberToken); + values.push(...numbers.map(number.parse)); + } + return { values, numColors, tokenised: v }; + } + function parse(v) { + return analyse(v).values; + } + function createTransformer(v) { + const { values, numColors, tokenised } = analyse(v); + const numValues = values.length; + return (v) => { + let output = tokenised; + for (let i = 0; i < numValues; i++) { + output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i])); + } + return output; + }; + } + const convertNumbersToZero = (v) => typeof v === 'number' ? 0 : v; + function getAnimatableNone(v) { + const parsed = parse(v); + const transformer = createTransformer(v); + return transformer(parsed.map(convertNumbersToZero)); + } + const complex = { test, parse, createTransformer, getAnimatableNone }; + + const maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']); + function applyDefaultFilter(v) { + let [name, value] = v.slice(0, -1).split('('); + if (name === 'drop-shadow') + return v; + const [number] = value.match(floatRegex) || []; + if (!number) + return v; + const unit = value.replace(number, ''); + let defaultValue = maxDefaults.has(name) ? 1 : 0; + if (number !== value) + defaultValue *= 100; + return name + '(' + defaultValue + unit + ')'; + } + const functionRegex = /([a-z-]*)\(.*?\)/g; + const filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v) => { + const functions = v.match(functionRegex); + return functions ? functions.map(applyDefaultFilter).join(' ') : v; + } }); + + exports.alpha = alpha; + exports.color = color; + exports.complex = complex; + exports.degrees = degrees; + exports.filter = filter; + exports.hex = hex; + exports.hsla = hsla; + exports.number = number; + exports.percent = percent; + exports.progressPercentage = progressPercentage; + exports.px = px; + exports.rgbUnit = rgbUnit; + exports.rgba = rgba; + exports.scale = scale; + exports.vh = vh; + exports.vw = vw; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/node_modules/style-value-types/lib/color/hex.d.ts b/node_modules/style-value-types/lib/color/hex.d.ts new file mode 100644 index 00000000..e5846ced --- /dev/null +++ b/node_modules/style-value-types/lib/color/hex.d.ts @@ -0,0 +1,2 @@ +import { ValueType } from '../types'; +export declare const hex: ValueType; diff --git a/node_modules/style-value-types/lib/color/hex.js b/node_modules/style-value-types/lib/color/hex.js new file mode 100644 index 00000000..33c82e5e --- /dev/null +++ b/node_modules/style-value-types/lib/color/hex.js @@ -0,0 +1,36 @@ +import { rgba } from './rgba'; +import { isColorString } from './utils'; +function parseHex(v) { + let r = ''; + let g = ''; + let b = ''; + let a = ''; + if (v.length > 5) { + r = v.substr(1, 2); + g = v.substr(3, 2); + b = v.substr(5, 2); + a = v.substr(7, 2); + } + else { + r = v.substr(1, 1); + g = v.substr(2, 1); + b = v.substr(3, 1); + a = v.substr(4, 1); + r += r; + g += g; + b += b; + a += a; + } + return { + red: parseInt(r, 16), + green: parseInt(g, 16), + blue: parseInt(b, 16), + alpha: a ? parseInt(a, 16) / 255 : 1, + }; +} +export const hex = { + test: isColorString('#'), + parse: parseHex, + transform: rgba.transform, +}; +//# sourceMappingURL=hex.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/color/hex.js.map b/node_modules/style-value-types/lib/color/hex.js.map new file mode 100644 index 00000000..037be570 --- /dev/null +++ b/node_modules/style-value-types/lib/color/hex.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hex.js","sourceRoot":"","sources":["../../src/color/hex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,SAAS,QAAQ,CAAC,CAAS;IACzB,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,IAAI,CAAC,GAAG,EAAE,CAAC;IAGX,IAAI,CAAC,CAAC,MA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lib/color/hsla.d.ts b/node_modules/style-value-types/lib/color/hsla.d.ts new file mode 100644 index 00000000..9cd630d8 --- /dev/null +++ b/node_modules/style-value-types/lib/color/hsla.d.ts @@ -0,0 +1,2 @@ +import { ValueType } from '../types'; +export declare const hsla: ValueType; diff --git a/node_modules/style-value-types/lib/color/hsla.js b/node_modules/style-value-types/lib/color/hsla.js new file mode 100644 index 00000000..974b1048 --- /dev/null +++ b/node_modules/style-value-types/lib/color/hsla.js @@ -0,0 +1,20 @@ +import { alpha as alphaType } from '../numbers'; +import { percent } from '../numbers/units'; +import { sanitize } from '../utils'; +import { isColorString, splitColor } from './utils'; +export const hsla = { + test: isColorString('hsl', 'hue'), + parse: splitColor('hue', 'saturation', 'lightness'), + transform: ({ hue, saturation, lightness, alpha = 1 }) => { + return ('hsla(' + + Math.round(hue) + + ', ' + + percent.transform(sanitize(saturation)) + + ', ' + + percent.transform(sanitize(lightness)) + + ', ' + + sanitize(alphaType.transform(alpha)) + + ')'); + }, +}; +//# sourceMappingURL=hsla.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/color/hsla.js.map b/node_modules/style-value-types/lib/color/hsla.js.map new file mode 100644 index 00000000..63ab2e34 --- /dev/null +++ b/node_modules/style-value-types/lib/color/hsla.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hsla.js","sourceRoot":"","sources":["../../src/color/hsla.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,CAAC,MAAM,IAAI,GAAc;IAC7B,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;IACjC,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC;IACnD,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,GAAG,CAAC,EAAQ,EAAE,EAAE;QAC7D,OAAO,CACL,OAAO;YACP,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YACf,IAAI;YACJ,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACvC,IAAI;YACJ,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACtC,IAAI;YACJ,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACpC,GAAG,CACJ,CAAC;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/style-value-types/lib/color/index.d.ts b/node_modules/style-value-types/lib/color/index.d.ts new file mode 100644 index 00000000..878196bd --- /dev/null +++ b/node_modules/style-value-types/lib/color/index.d.ts @@ -0,0 +1,2 @@ +import { ValueType } from '../types'; +export declare const color: ValueType; diff --git a/node_modules/style-value-types/lib/color/index.js b/node_modules/style-value-types/lib/color/index.js new file mode 100644 index 00000000..df8f894f --- /dev/null +++ b/node_modules/style-value-types/lib/color/index.js @@ -0,0 +1,26 @@ +import { isString } from '../utils'; +import { hex } from './hex'; +import { hsla } from './hsla'; +import { rgba } from './rgba'; +export const color = { + test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v), + parse: (v) => { + if (rgba.test(v)) { + return rgba.parse(v); + } + else if (hsla.test(v)) { + return hsla.parse(v); + } + else { + return hex.parse(v); + } + }, + transform: (v) => { + return isString(v) + ? v + : v.hasOwnProperty('red') + ? rgba.transform(v) + : hsla.transform(v); + }, +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/color/index.js.map b/node_modules/style-value-types/lib/color/index.js.map new file mode 100644 index 00000000..76cc185a --- /dev/null +++ b/node_modules/style-value-types/lib/color/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/color/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,CAAC,MAAM,KAAK,GAAc;IAC9B,IAAI,EAAE,CAAC,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,KAAK,EAAE,CAAC,CAAM,EAAE,EAAE;QAChB,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YAChB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACtB;aAAM,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YACvB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACtB;aAAM;YACL,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACrB;IACH,CAAC;IACD,SAAS,EAAE,CAAC,CAAuB,EAAE,EAAE;QACrC,OAAO,QAAQ,CAAC,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;YACH,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;gBACzB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;gBACnB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/node_modules/style-value-types/lib/color/rgba.d.ts b/node_modules/style-value-types/lib/color/rgba.d.ts new file mode 100644 index 00000000..34ce20fc --- /dev/null +++ b/node_modules/style-value-types/lib/color/rgba.d.ts @@ -0,0 +1,3 @@ +import { ValueType } from '../types'; +export declare const rgbUnit: ValueType; +export declare const rgba: ValueType; diff --git a/node_modules/style-value-types/lib/color/rgba.js b/node_modules/style-value-types/lib/color/rgba.js new file mode 100644 index 00000000..f8641273 --- /dev/null +++ b/node_modules/style-value-types/lib/color/rgba.js @@ -0,0 +1,19 @@ +import { alpha as alphaType, number } from '../numbers'; +import { clamp, sanitize } from '../utils'; +import { isColorString, splitColor } from './utils'; +const clampRgbUnit = clamp(0, 255); +export const rgbUnit = Object.assign(Object.assign({}, number), { transform: (v) => Math.round(clampRgbUnit(v)) }); +export const rgba = { + test: isColorString('rgb', 'red'), + parse: splitColor('red', 'green', 'blue'), + transform: ({ red, green, blue, alpha = 1 }) => 'rgba(' + + rgbUnit.transform(red) + + ', ' + + rgbUnit.transform(green) + + ', ' + + rgbUnit.transform(blue) + + ', ' + + sanitize(alphaType.transform(alpha)) + + ')', +}; +//# sourceMappingURL=rgba.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/color/rgba.js.map b/node_modules/style-value-types/lib/color/rgba.js.map new file mode 100644 index 00000000..0b43e35e --- /dev/null +++ b/node_modules/style-value-types/lib/color/rgba.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rgba.js","sourceRoot":"","sources":["../../src/color/rgba.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACnC,MAAM,CAAC,MAAM,OAAO,mCACf,MAAM,KACT,SAAS,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACtD,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAc;IAC7B,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC;IACjC,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC,EAAQ,EAAE,EAAE,CACnD,OAAO;QACP,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC;QACtB,IAAI;QACJ,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;QACxB,IAAI;QACJ,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;QACvB,IAAI;QACJ,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACpC,GAAG;CACN,CAAC"} \ No newline at end of file diff --git a/node_modules/style-value-types/lib/color/utils.d.ts b/node_modules/style-value-types/lib/color/utils.d.ts new file mode 100644 index 00000000..45184b32 --- /dev/null +++ b/node_modules/style-value-types/lib/color/utils.d.ts @@ -0,0 +1,6 @@ +import { Color } from '../types'; +export declare const isColorString: (type: string, testProp?: string) => (v: any) => boolean; +export declare const splitColor: (aName: string, bName: string, cName: string) => (v: string | Color) => import("../types").RGBA | import("../types").HSLA | { + [x: string]: number; + alpha: number; +}; diff --git a/node_modules/style-value-types/lib/color/utils.js b/node_modules/style-value-types/lib/color/utils.js new file mode 100644 index 00000000..9823367a --- /dev/null +++ b/node_modules/style-value-types/lib/color/utils.js @@ -0,0 +1,17 @@ +import { floatRegex, isString, singleColorRegex } from '../utils'; +export const isColorString = (type, testProp) => (v) => { + return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) || + (testProp && Object.prototype.hasOwnProperty.call(v, testProp))); +}; +export const splitColor = (aName, bName, cName) => (v) => { + if (!isString(v)) + return v; + const [a, b, c, alpha] = v.match(floatRegex); + return { + [aName]: parseFloat(a), + [bName]: parseFloat(b), + [cName]: parseFloat(c), + alpha: alpha !== undefined ? parseFloat(alpha) : 1, + }; +}; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/color/utils.js.map b/node_modules/style-value-types/lib/color/utils.js.map new file mode 100644 index 00000000..de3ab4ef --- /dev/null +++ b/node_modules/style-value-types/lib/color/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/color/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMlE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,QAAiB,EAAE,EAAE,CAAC,CAAC,CAAM,EAAE,EAAE;IAC3E,OAAO,OAAO,CACZ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7D,CAAC,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAClE,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,KAAa,EAAE,KAAa,EAAE,EAAE,CAAC,CACzE,CAAiB,EACjB,EAAE;IACF,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IAE3B,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAE7C,OAAO;QACL,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;QACtB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;QACtB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;QACtB,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KACnD,CAAC;AACJ,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/style-value-types/lib/complex/filter.d.ts b/node_modules/style-value-types/lib/complex/filter.d.ts new file mode 100644 index 00000000..786df381 --- /dev/null +++ b/node_modules/style-value-types/lib/complex/filter.d.ts @@ -0,0 +1,6 @@ +export declare const filter: { + getAnimatableNone: (v: string) => string; + test: (v: any) => boolean; + parse: (v: string | number) => (number | import("..").RGBA | import("..").HSLA)[]; + createTransformer: (v: string | number) => (v: (string | number | import("..").RGBA | import("..").HSLA)[]) => string; +}; diff --git a/node_modules/style-value-types/lib/complex/filter.js b/node_modules/style-value-types/lib/complex/filter.js new file mode 100644 index 00000000..1601f5e2 --- /dev/null +++ b/node_modules/style-value-types/lib/complex/filter.js @@ -0,0 +1,22 @@ +import { complex } from '.'; +import { floatRegex } from '../utils'; +const maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']); +function applyDefaultFilter(v) { + let [name, value] = v.slice(0, -1).split('('); + if (name === 'drop-shadow') + return v; + const [number] = value.match(floatRegex) || []; + if (!number) + return v; + const unit = value.replace(number, ''); + let defaultValue = maxDefaults.has(name) ? 1 : 0; + if (number !== value) + defaultValue *= 100; + return name + '(' + defaultValue + unit + ')'; +} +const functionRegex = /([a-z-]*)\(.*?\)/g; +export const filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v) => { + const functions = v.match(functionRegex); + return functions ? functions.map(applyDefaultFilter).join(' ') : v; + } }); +//# sourceMappingURL=filter.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/complex/filter.js.map b/node_modules/style-value-types/lib/complex/filter.js.map new file mode 100644 index 00000000..46a0a25b --- /dev/null +++ b/node_modules/style-value-types/lib/complex/filter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filter.js","sourceRoot":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C,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC,GACF,CAAC"} \ No newline at end of file diff --git a/node_modules/style-value-types/lib/complex/index.d.ts b/node_modules/style-value-types/lib/complex/index.d.ts new file mode 100644 index 00000000..00393dc0 --- /dev/null +++ b/node_modules/style-value-types/lib/complex/index.d.ts @@ -0,0 +1,12 @@ +import { Color } from '../types'; +declare function test(v: any): boolean; +declare function parse(v: string | number): (number | import("../types").RGBA | import("../types").HSLA)[]; +declare function createTransformer(v: string | number): (v: Array) => string; +declare function getAnimatableNone(v: string | number): string; +export declare const complex: { + test: typeof test; + parse: typeof parse; + createTransformer: typeof createTransformer; + getAnimatableNone: typeof getAnimatableNone; +}; +export {}; diff --git a/node_modules/style-value-types/lib/complex/index.js b/node_modules/style-value-types/lib/complex/index.js new file mode 100644 index 00000000..42bba3ac --- /dev/null +++ b/node_modules/style-value-types/lib/complex/index.js @@ -0,0 +1,51 @@ +import { color } from '../color'; +import { number } from '../numbers'; +import { colorRegex, floatRegex, isString, sanitize } from '../utils'; +const colorToken = '${c}'; +const numberToken = '${n}'; +function test(v) { + var _a, _b, _c, _d; + return (isNaN(v) && + isString(v) && + ((_b = (_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(colorRegex)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0); +} +function analyse(v) { + if (typeof v === 'number') + v = `${v}`; + const values = []; + let numColors = 0; + const colors = v.match(colorRegex); + if (colors) { + numColors = colors.length; + v = v.replace(colorRegex, colorToken); + values.push(...colors.map(color.parse)); + } + const numbers = v.match(floatRegex); + if (numbers) { + v = v.replace(floatRegex, numberToken); + values.push(...numbers.map(number.parse)); + } + return { values, numColors, tokenised: v }; +} +function parse(v) { + return analyse(v).values; +} +function createTransformer(v) { + const { values, numColors, tokenised } = analyse(v); + const numValues = values.length; + return (v) => { + let output = tokenised; + for (let i = 0; i < numValues; i++) { + output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i])); + } + return output; + }; +} +const convertNumbersToZero = (v) => typeof v === 'number' ? 0 : v; +function getAnimatableNone(v) { + const parsed = parse(v); + const transformer = createTransformer(v); + return transformer(parsed.map(convertNumbersToZero)); +} +export const complex = { test, parse, createTransformer, getAnimatableNone }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/complex/index.js.map b/node_modules/style-value-types/lib/complex/index.js.map new file mode 100644 index 00000000..12ae4fc5 --- /dev/null +++ b/node_modules/style-value-types/lib/complex/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/complex/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEtE,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1B,MAAM,WAAW,GAAG,MAAM,CAAC;AAE3B,SAAS,IAAI,CAAC,CAAM;;IAClB,OAAO,CACL,KAAK,CAAC,CAAC,CAAC;QACR,QAAQ,CAAC,CAAC,CAAC;QACX,aAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,0CAAE,MAAM,mCAAI,CAAC,CAAC,GAAG,aAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,0CAAE,MAAM,mCAAI,CAAC,CAAC,GAAG,CAAC,CAC5E,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,CAAkB;IACjC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;IAEtC,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,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AAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAW,CAAC,CACjE,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,oBAAoB,GAAG,CAAC,CAAiB,EAAE,EAAE,CACjD,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhC,SAAS,iBAAiB,CAAC,CAAkB;IAC3C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,MAAM,WAAW,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACzC,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/node_modules/style-value-types/lib/index.d.ts b/node_modules/style-value-types/lib/index.d.ts new file mode 100644 index 00000000..56b49d36 --- /dev/null +++ b/node_modules/style-value-types/lib/index.d.ts @@ -0,0 +1,9 @@ +export * from './types'; +export { number, scale, alpha } from './numbers'; +export { degrees, percent, progressPercentage, px, vw, vh, } from './numbers/units'; +export { hsla } from './color/hsla'; +export { rgba, rgbUnit } from './color/rgba'; +export { hex } from './color/hex'; +export { color } from './color'; +export { complex } from './complex'; +export { filter } from './complex/filter'; diff --git a/node_modules/style-value-types/lib/index.js b/node_modules/style-value-types/lib/index.js new file mode 100644 index 00000000..39ad1889 --- /dev/null +++ b/node_modules/style-value-types/lib/index.js @@ -0,0 +1,10 @@ +export * from './types'; +export { number, scale, alpha } from './numbers'; +export { degrees, percent, progressPercentage, px, vw, vh, } from './numbers/units'; +export { hsla } from './color/hsla'; +export { rgba, rgbUnit } from './color/rgba'; +export { hex } from './color/hex'; +export { color } from './color'; +export { complex } from './complex'; +export { filter } from './complex/filter'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/index.js.map b/node_modules/style-value-types/lib/index.js.map new file mode 100644 index 00000000..a732f09b --- /dev/null +++ b/node_modules/style-value-types/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,EAAE,EACF,EAAE,EACF,EAAE,GACH,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"} \ No newline at end of file diff --git a/node_modules/style-value-types/lib/numbers/index.d.ts b/node_modules/style-value-types/lib/numbers/index.d.ts new file mode 100644 index 00000000..23ed657e --- /dev/null +++ b/node_modules/style-value-types/lib/numbers/index.d.ts @@ -0,0 +1,4 @@ +import { ValueType } from '../types'; +export declare const number: ValueType; +export declare const alpha: ValueType; +export declare const scale: ValueType; diff --git a/node_modules/style-value-types/lib/numbers/index.js b/node_modules/style-value-types/lib/numbers/index.js new file mode 100644 index 00000000..9e575959 --- /dev/null +++ b/node_modules/style-value-types/lib/numbers/index.js @@ -0,0 +1,9 @@ +import { clamp } from '../utils'; +export const number = { + test: (v) => typeof v === 'number', + parse: parseFloat, + transform: (v) => v, +}; +export const alpha = Object.assign(Object.assign({}, number), { transform: clamp(0, 1) }); +export const scale = Object.assign(Object.assign({}, number), { default: 1 }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/numbers/index.js.map b/node_modules/style-value-types/lib/numbers/index.js.map new file mode 100644 index 00000000..e5047723 --- /dev/null +++ b/node_modules/style-value-types/lib/numbers/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/numbers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,MAAM,CAAC,MAAM,MAAM,GAAc;IAC/B,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ;IAClC,KAAK,EAAE,UAAU;IACjB,SAAS,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,mCACb,MAAM,KACT,SAAS,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GACvB,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,mCACb,MAAM,KACT,OAAO,EAAE,CAAC,GACX,CAAC"} \ No newline at end of file diff --git a/node_modules/style-value-types/lib/numbers/units.d.ts b/node_modules/style-value-types/lib/numbers/units.d.ts new file mode 100644 index 00000000..a4118f24 --- /dev/null +++ b/node_modules/style-value-types/lib/numbers/units.d.ts @@ -0,0 +1,7 @@ +import { ValueType } from '../types'; +export declare const degrees: ValueType; +export declare const percent: ValueType; +export declare const px: ValueType; +export declare const vh: ValueType; +export declare const vw: ValueType; +export declare const progressPercentage: ValueType; diff --git a/node_modules/style-value-types/lib/numbers/units.js b/node_modules/style-value-types/lib/numbers/units.js new file mode 100644 index 00000000..6ca563ab --- /dev/null +++ b/node_modules/style-value-types/lib/numbers/units.js @@ -0,0 +1,13 @@ +import { isString } from '../utils'; +const createUnitType = (unit) => ({ + test: (v) => isString(v) && v.endsWith(unit) && v.split(' ').length === 1, + parse: parseFloat, + transform: (v) => `${v}${unit}`, +}); +export const degrees = createUnitType('deg'); +export const percent = createUnitType('%'); +export const px = createUnitType('px'); +export const vh = createUnitType('vh'); +export const vw = createUnitType('vw'); +export const progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) }); +//# sourceMappingURL=units.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/numbers/units.js.map b/node_modules/style-value-types/lib/numbers/units.js.map new file mode 100644 index 00000000..93f84b3d --- /dev/null +++ b/node_modules/style-value-types/lib/numbers/units.js.map @@ -0,0 +1 @@ +{"version":3,"file":"units.js","sourceRoot":"","sources":["../../src/numbers/units.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAa,EAAE,CAAC,CAAC;IACnD,IAAI,EAAE,CAAC,CAAS,EAAE,EAAE,CAClB,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC;IAC9D,KAAK,EAAE,UAAU;IACjB,SAAS,EAAE,CAAC,CAAkB,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE;CACjD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AAEvC,MAAM,CAAC,MAAM,kBAAkB,mCAC1B,OAAO,KACV,KAAK,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,EAC5C,SAAS,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,GAAG,CAAC,GACrD,CAAC"} \ No newline at end of file diff --git a/node_modules/style-value-types/lib/types.d.ts b/node_modules/style-value-types/lib/types.d.ts new file mode 100644 index 00000000..fa664668 --- /dev/null +++ b/node_modules/style-value-types/lib/types.d.ts @@ -0,0 +1,25 @@ +export declare type Transformer = (v: any) => any; +export declare type ValueType = { + test: (v: any) => boolean; + parse: (v: any) => any; + transform?: Transformer; + createTransformer?: (template: string) => Transformer; + default?: any; + getAnimatableNone?: (v: any) => any; +}; +export declare type NumberMap = { + [key: string]: number; +}; +export declare type RGBA = { + red: number; + green: number; + blue: number; + alpha?: number; +}; +export declare type HSLA = { + hue: number; + saturation: number; + lightness: number; + alpha?: number; +}; +export declare type Color = HSLA | RGBA; diff --git a/node_modules/style-value-types/lib/types.js b/node_modules/style-value-types/lib/types.js new file mode 100644 index 00000000..5b2306a4 --- /dev/null +++ b/node_modules/style-value-types/lib/types.js @@ -0,0 +1 @@ +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/types.js.map b/node_modules/style-value-types/lib/types.js.map new file mode 100644 index 00000000..c768b790 --- /dev/null +++ b/node_modules/style-value-types/lib/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/style-value-types/lib/utils.d.ts b/node_modules/style-value-types/lib/utils.d.ts new file mode 100644 index 00000000..4000cf24 --- /dev/null +++ b/node_modules/style-value-types/lib/utils.d.ts @@ -0,0 +1,6 @@ +export declare const clamp: (min: number, max: number) => (v: number) => number; +export declare const sanitize: (v: number) => number; +export declare const floatRegex: RegExp; +export declare const colorRegex: RegExp; +export declare const singleColorRegex: RegExp; +export declare function isString(v: any): v is string; diff --git a/node_modules/style-value-types/lib/utils.js b/node_modules/style-value-types/lib/utils.js new file mode 100644 index 00000000..9bbe02cc --- /dev/null +++ b/node_modules/style-value-types/lib/utils.js @@ -0,0 +1,9 @@ +export const clamp = (min, max) => (v) => Math.max(Math.min(v, max), min); +export const sanitize = (v) => (v % 1 ? Number(v.toFixed(5)) : v); +export const floatRegex = /(-)?([\d]*\.?[\d])+/g; +export const colorRegex = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi; +export const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i; +export function isString(v) { + return typeof v === 'string'; +} +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/style-value-types/lib/utils.js.map b/node_modules/style-value-types/lib/utils.js.map new file mode 100644 index 00000000..e8ddb13f --- /dev/null +++ b/node_modules/style-value-types/lib/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE,CAAC,CAAC,CAAS,EAAE,EAAE,CAC/D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAIlC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC;AACjD,MAAM,CAAC,MAAM,UAAU,GAAG,8HAA8H,CAAC;AACzJ,MAAM,CAAC,MAAM,gBAAgB,GAAG,kHAAkH,CAAC;AAEnJ,MAAM,UAAU,QAAQ,CAAC,CAAM;IAC7B,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC;AAC/B,CAAC"} \ No newline at end of file diff --git a/node_modules/style-value-types/package.json b/node_modules/style-value-types/package.json new file mode 100644 index 00000000..d42abe3b --- /dev/null +++ b/node_modules/style-value-types/package.json @@ -0,0 +1,73 @@ +{ + "name": "style-value-types", + "version": "5.1.2", + "description": "Parsers, transformers and tests for special value types, eg: %, hex codes etc.", + "main": "dist/valueTypes.cjs.js", + "types": "lib/index.d.ts", + "module": "dist/es/index.mjs", + "jsnext:main": "dist/es/index.mjs", + "exports": { + ".": { + "types": "./lib/index.d.ts", + "import": "./dist/es/index.mjs", + "require": "./dist/valueTypes.cjs.js", + "default": "./dist/valueTypes.cjs.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "lib", + "dist" + ], + "sideEffects": false, + "scripts": { + "build": "tsc -p . && rollup -c && yarn measure", + "watch": "rollup -c -w", + "lint": "tslint -c tslint.json 'src/**/*.{ts}'", + "test": "jest --maxWorkers=2", + "measure": "gzip -c dist/style-value-types.min.js | wc -c", + "prepublishOnly": "npm run test && npm run build" + }, + "repository": { + "type": "git", + "url": "https://github.com/Popmotion/popmotion/tree/master/packages/style-value-types" + }, + "keywords": [ + "css", + "svg", + "hex", + "rgba", + "hsla" + ], + "author": "Matt Perry", + "license": "MIT", + "bugs": { + "url": "https://github.com/Popmotion/popmotion/issues" + }, + "homepage": "https://popmotion.io", + "devDependencies": { + "@types/jest": "^23.1.1", + "webpack": "^3.12.0" + }, + "jest": { + "moduleFileExtensions": [ + "ts", + "js" + ], + "transform": { + "\\.(ts)$": "../../../node_modules/ts-jest/preprocessor.js" + }, + "testRegex": "/_tests/.*\\.(ts|tsx|js)$", + "rootDir": "src", + "testURL": "http://localhost/" + }, + "unpkg": "./dist/style-value-types.min.js", + "prettier": { + "parser": "typescript", + "singleQuote": true + }, + "dependencies": { + "hey-listen": "^1.0.8", + "tslib": "2.4.0" + } +} diff --git a/node_modules/sucrase/LICENSE b/node_modules/sucrase/LICENSE new file mode 100644 index 00000000..06d77d6a --- /dev/null +++ b/node_modules/sucrase/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2012-2018 various contributors (see AUTHORS) + +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/sucrase/README.md b/node_modules/sucrase/README.md new file mode 100644 index 00000000..c45138a3 --- /dev/null +++ b/node_modules/sucrase/README.md @@ -0,0 +1,295 @@ +# Sucrase + +[![Build Status](https://github.com/alangpierce/sucrase/workflows/All%20tests/badge.svg)](https://github.com/alangpierce/sucrase/actions) +[![npm version](https://img.shields.io/npm/v/sucrase.svg)](https://www.npmjs.com/package/sucrase) +[![Install Size](https://packagephobia.now.sh/badge?p=sucrase)](https://packagephobia.now.sh/result?p=sucrase) +[![MIT License](https://img.shields.io/npm/l/express.svg?maxAge=2592000)](LICENSE) +[![Join the chat at https://gitter.im/sucrasejs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sucrasejs/Lobby) + +## [Try it out](https://sucrase.io) + +## Quick usage + +```bash +yarn add --dev sucrase # Or npm install --save-dev sucrase +node -r sucrase/register main.ts +``` + +Using the [ts-node](https://github.com/TypeStrong/ts-node) integration: + +```bash +yarn add --dev sucrase ts-node typescript +./node_modules/.bin/ts-node --transpiler sucrase/ts-node-plugin main.ts +``` + +## Project overview + +Sucrase is an alternative to Babel that allows super-fast development builds. +Instead of compiling a large range of JS features to be able to work in Internet +Explorer, Sucrase assumes that you're developing with a recent browser or recent +Node.js version, so it focuses on compiling non-standard language extensions: +JSX, TypeScript, and Flow. Because of this smaller scope, Sucrase can get away +with an architecture that is much more performant but less extensible and +maintainable. Sucrase's parser is forked from Babel's parser (so Sucrase is +indebted to Babel and wouldn't be possible without it) and trims it down to a +focused subset of what Babel solves. If it fits your use case, hopefully Sucrase +can speed up your development experience! + +**Sucrase has been extensively tested.** It can successfully build +the [Benchling](https://benchling.com/) frontend code, +[Babel](https://github.com/babel/babel), +[React](https://github.com/facebook/react), +[TSLint](https://github.com/palantir/tslint), +[Apollo client](https://github.com/apollographql/apollo-client), and +[decaffeinate](https://github.com/decaffeinate/decaffeinate) +with all tests passing, about 1 million lines of code total. + +**Sucrase is about 20x faster than Babel.** Here's one measurement of how +Sucrase compares with other tools when compiling the Jest codebase 3 times, +about 360k lines of code total: + +```text + Time Speed +Sucrase 0.57 seconds 636975 lines per second +swc 1.19 seconds 304526 lines per second +esbuild 1.45 seconds 248692 lines per second +TypeScript 8.98 seconds 40240 lines per second +Babel 9.18 seconds 39366 lines per second +``` + +Details: Measured on July 2022. Tools run in single-threaded mode without warm-up. See the +[benchmark code](https://github.com/alangpierce/sucrase/blob/main/benchmark/benchmark.ts) +for methodology and caveats. + +## Transforms + +The main configuration option in Sucrase is an array of transform names. These +transforms are available: + +* **jsx**: Enables JSX syntax. By default, JSX is transformed to `React.createClass`, + but may be preserved or transformed to `_jsx()` by setting the `jsxRuntime` option. + Also adds `createReactClass` display names and JSX context information. +* **typescript**: Compiles TypeScript code to JavaScript, removing type + annotations and handling features like enums. Does not check types. Sucrase + transforms each file independently, so you should enable the `isolatedModules` + TypeScript flag so that the typechecker will disallow the few features like + `const enum`s that need cross-file compilation. The Sucrase option `keepUnusedImports` + can be used to disable all automatic removal of imports and exports, analogous to TS + `verbatimModuleSyntax`. +* **flow**: Removes Flow type annotations. Does not check types. +* **imports**: Transforms ES Modules (`import`/`export`) to CommonJS + (`require`/`module.exports`) using the same approach as Babel and TypeScript + with `--esModuleInterop`. If `preserveDynamicImport` is specified in the Sucrase + options, then dynamic `import` expressions are left alone, which is particularly + useful in Node to load ESM-only libraries. If `preserveDynamicImport` is not + specified, `import` expressions are transformed into a promise-wrapped call to + `require`. +* **react-hot-loader**: Performs the equivalent of the `react-hot-loader/babel` + transform in the [react-hot-loader](https://github.com/gaearon/react-hot-loader) + project. This enables advanced hot reloading use cases such as editing of + bound methods. +* **jest**: Hoist desired [jest](https://jestjs.io/) method calls above imports in + the same way as [babel-plugin-jest-hoist](https://github.com/facebook/jest/tree/master/packages/babel-plugin-jest-hoist). + Does not validate the arguments passed to `jest.mock`, but the same rules still apply. + +When the `imports` transform is *not* specified (i.e. when targeting ESM), the +`injectCreateRequireForImportRequire` option can be specified to transform TS +`import foo = require("foo");` in a way that matches the +[TypeScript 4.7 behavior](https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#commonjs-interoperability) +with `module: nodenext`. + +These newer JS features are transformed by default: + +* [Optional chaining](https://github.com/tc39/proposal-optional-chaining): `a?.b` +* [Nullish coalescing](https://github.com/tc39/proposal-nullish-coalescing): `a ?? b` +* [Class fields](https://github.com/tc39/proposal-class-fields): `class C { x = 1; }`. + This includes static fields but not the `#x` private field syntax. +* [Numeric separators](https://github.com/tc39/proposal-numeric-separator): + `const n = 1_234;` +* [Optional catch binding](https://github.com/tc39/proposal-optional-catch-binding): + `try { doThing(); } catch { }`. + +If your target runtime supports these features, you can specify +`disableESTransforms: true` so that Sucrase preserves the syntax rather than +trying to transform it. Note that transpiled and standard class fields behave +slightly differently; see the +[TypeScript 3.7 release notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier) +for details. If you use TypeScript, you can enable the TypeScript option +`useDefineForClassFields` to enable error checking related to these differences. + +### Unsupported syntax + +All JS syntax not mentioned above will "pass through" and needs to be supported +by your JS runtime. For example: + +* Decorators, private fields, `throw` expressions, generator arrow functions, + and `do` expressions are all unsupported in browsers and Node (as of this + writing), and Sucrase doesn't make an attempt to transpile them. +* Object rest/spread, async functions, and async iterators are all recent + features that should work fine, but might cause issues if you use older + versions of tools like webpack. BigInt and newer regex features may or may not + work, based on your tooling. + +### JSX Options + +By default, JSX is compiled to React functions in development mode. This can be +configured with a few options: + +* **jsxRuntime**: A string specifying the transform mode, which can be one of three values: + * `"classic"` (default): The original JSX transform that calls `React.createElement` by default. + To configure for non-React use cases, specify: + * **jsxPragma**: Element creation function, defaults to `React.createElement`. + * **jsxFragmentPragma**: Fragment component, defaults to `React.Fragment`. + * `"automatic"`: The [new JSX transform](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html) + introduced with React 17, which calls `jsx` functions and auto-adds import statements. + To configure for non-React use cases, specify: + * **jsxImportSource**: Package name for auto-generated import statements, defaults to `react`. + * `"preserve"`: Don't transform JSX, and instead emit it as-is in the output code. +* **production**: If `true`, use production version of functions and don't include debugging + information. When using React in production mode with the automatic transform, this *must* be + set to true to avoid an error about `jsxDEV` being missing. + +### Legacy CommonJS interop + +Two legacy modes can be used with the `imports` transform: + +* **enableLegacyTypeScriptModuleInterop**: Use the default TypeScript approach + to CommonJS interop instead of assuming that TypeScript's `--esModuleInterop` + flag is enabled. For example, if a CJS module exports a function, legacy + TypeScript interop requires you to write `import * as add from './add';`, + while Babel, Webpack, Node.js, and TypeScript with `--esModuleInterop` require + you to write `import add from './add';`. As mentioned in the + [docs](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#support-for-import-d-from-cjs-form-commonjs-modules-with---esmoduleinterop), + the TypeScript team recommends you always use `--esModuleInterop`. +* **enableLegacyBabel5ModuleInterop**: Use the Babel 5 approach to CommonJS + interop, so that you can run `require('./MyModule')` instead of + `require('./MyModule').default`. Analogous to + [babel-plugin-add-module-exports](https://github.com/59naga/babel-plugin-add-module-exports). + +## Usage + +### Tool integrations + +* [Webpack](https://github.com/alangpierce/sucrase/tree/main/integrations/webpack-loader) +* [Gulp](https://github.com/alangpierce/sucrase/tree/main/integrations/gulp-plugin) +* [Jest](https://github.com/alangpierce/sucrase/tree/main/integrations/jest-plugin) +* [Rollup](https://github.com/rollup/plugins/tree/master/packages/sucrase) +* [Broccoli](https://github.com/stefanpenner/broccoli-sucrase) + +### Usage in Node + +The most robust way is to use the Sucrase plugin for [ts-node](https://github.com/TypeStrong/ts-node), +which has various Node integrations and configures Sucrase via `tsconfig.json`: +```bash +ts-node --transpiler sucrase/ts-node-plugin +``` + +For projects that don't target ESM, Sucrase also has a require hook with some +reasonable defaults that can be accessed in a few ways: + +* From code: `require("sucrase/register");` +* When invoking Node: `node -r sucrase/register main.ts` +* As a separate binary: `sucrase-node main.ts` + +Options can be passed to the require hook via a `SUCRASE_OPTIONS` environment +variable holding a JSON string of options. + +### Compiling a project to JS + +For simple use cases, Sucrase comes with a `sucrase` CLI that mirrors your +directory structure to an output directory: +```bash +sucrase ./srcDir -d ./outDir --transforms typescript,imports +``` + +### Usage from code + +For any advanced use cases, Sucrase can be called from JS directly: + +```js +import {transform} from "sucrase"; +const compiledCode = transform(code, {transforms: ["typescript", "imports"]}).code; +``` + +## What Sucrase is not + +Sucrase is intended to be useful for the most common cases, but it does not aim +to have nearly the scope and versatility of Babel. Some specific examples: + +* Sucrase does not check your code for errors. Sucrase's contract is that if you + give it valid code, it will produce valid JS code. If you give it invalid + code, it might produce invalid code, it might produce valid code, or it might + give an error. Always use Sucrase with a linter or typechecker, which is more + suited for error-checking. +* Sucrase is not pluginizable. With the current architecture, transforms need to + be explicitly written to cooperate with each other, so each additional + transform takes significant extra work. +* Sucrase is not good for prototyping language extensions and upcoming language + features. Its faster architecture makes new transforms more difficult to write + and more fragile. +* Sucrase will never produce code for old browsers like IE. Compiling code down + to ES5 is much more complicated than any transformation that Sucrase needs to + do. +* Sucrase is hesitant to implement upcoming JS features, although some of them + make sense to implement for pragmatic reasons. Its main focus is on language + extensions (JSX, TypeScript, Flow) that will never be supported by JS + runtimes. +* Like Babel, Sucrase is not a typechecker, and must process each file in + isolation. For example, TypeScript `const enum`s are treated as regular + `enum`s rather than inlining across files. +* You should think carefully before using Sucrase in production. Sucrase is + mostly beneficial in development, and in many cases, Babel or tsc will be more + suitable for production builds. + +See the [Project Vision](./docs/PROJECT_VISION.md) document for more details on +the philosophy behind Sucrase. + +## Motivation + +As JavaScript implementations mature, it becomes more and more reasonable to +disable Babel transforms, especially in development when you know that you're +targeting a modern runtime. You might hope that you could simplify and speed up +the build step by eventually disabling Babel entirely, but this isn't possible +if you're using a non-standard language extension like JSX, TypeScript, or Flow. +Unfortunately, disabling most transforms in Babel doesn't speed it up as much as +you might expect. To understand, let's take a look at how Babel works: + +1. Tokenize the input source code into a token stream. +2. Parse the token stream into an AST. +3. Walk the AST to compute the scope information for each variable. +4. Apply all transform plugins in a single traversal, resulting in a new AST. +5. Print the resulting AST. + +Only step 4 gets faster when disabling plugins, so there's always a fixed cost +to running Babel regardless of how many transforms are enabled. + +Sucrase bypasses most of these steps, and works like this: + +1. Tokenize the input source code into a token stream using a trimmed-down fork + of the Babel parser. This fork does not produce a full AST, but still + produces meaningful token metadata specifically designed for the later + transforms. +2. Scan through the tokens, computing preliminary information like all + imported/exported names. +3. Run the transform by doing a pass through the tokens and performing a number + of careful find-and-replace operations, like replacing ` 0 || + importInfo.namedExports.length > 0 + ) { + continue; + } + const names = [ + ...importInfo.defaultNames, + ...importInfo.wildcardNames, + ...importInfo.namedImports.map(({localName}) => localName), + ]; + if (names.every((name) => this.shouldAutomaticallyElideImportedName(name))) { + this.importsToReplace.set(path, ""); + } + } + } + + shouldAutomaticallyElideImportedName(name) { + return ( + this.isTypeScriptTransformEnabled && + !this.keepUnusedImports && + !this.nonTypeIdentifiers.has(name) + ); + } + + generateImportReplacements() { + for (const [path, importInfo] of this.importInfoByPath.entries()) { + const { + defaultNames, + wildcardNames, + namedImports, + namedExports, + exportStarNames, + hasStarExport, + } = importInfo; + + if ( + defaultNames.length === 0 && + wildcardNames.length === 0 && + namedImports.length === 0 && + namedExports.length === 0 && + exportStarNames.length === 0 && + !hasStarExport + ) { + // Import is never used, so don't even assign a name. + this.importsToReplace.set(path, `require('${path}');`); + continue; + } + + const primaryImportName = this.getFreeIdentifierForPath(path); + let secondaryImportName; + if (this.enableLegacyTypeScriptModuleInterop) { + secondaryImportName = primaryImportName; + } else { + secondaryImportName = + wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(path); + } + let requireCode = `var ${primaryImportName} = require('${path}');`; + if (wildcardNames.length > 0) { + for (const wildcardName of wildcardNames) { + const moduleExpr = this.enableLegacyTypeScriptModuleInterop + ? primaryImportName + : `${this.helperManager.getHelperName("interopRequireWildcard")}(${primaryImportName})`; + requireCode += ` var ${wildcardName} = ${moduleExpr};`; + } + } else if (exportStarNames.length > 0 && secondaryImportName !== primaryImportName) { + requireCode += ` var ${secondaryImportName} = ${this.helperManager.getHelperName( + "interopRequireWildcard", + )}(${primaryImportName});`; + } else if (defaultNames.length > 0 && secondaryImportName !== primaryImportName) { + requireCode += ` var ${secondaryImportName} = ${this.helperManager.getHelperName( + "interopRequireDefault", + )}(${primaryImportName});`; + } + + for (const {importedName, localName} of namedExports) { + requireCode += ` ${this.helperManager.getHelperName( + "createNamedExportFrom", + )}(${primaryImportName}, '${localName}', '${importedName}');`; + } + for (const exportStarName of exportStarNames) { + requireCode += ` exports.${exportStarName} = ${secondaryImportName};`; + } + if (hasStarExport) { + requireCode += ` ${this.helperManager.getHelperName( + "createStarExport", + )}(${primaryImportName});`; + } + + this.importsToReplace.set(path, requireCode); + + for (const defaultName of defaultNames) { + this.identifierReplacements.set(defaultName, `${secondaryImportName}.default`); + } + for (const {importedName, localName} of namedImports) { + this.identifierReplacements.set(localName, `${primaryImportName}.${importedName}`); + } + } + } + + getFreeIdentifierForPath(path) { + const components = path.split("/"); + const lastComponent = components[components.length - 1]; + const baseName = lastComponent.replace(/\W/g, ""); + return this.nameManager.claimFreeName(`_${baseName}`); + } + + preprocessImportAtIndex(index) { + const defaultNames = []; + const wildcardNames = []; + const namedImports = []; + + index++; + if ( + (this.tokens.matchesContextualAtIndex(index, _keywords.ContextualKeyword._type) || + this.tokens.matches1AtIndex(index, _types.TokenType._typeof)) && + !this.tokens.matches1AtIndex(index + 1, _types.TokenType.comma) && + !this.tokens.matchesContextualAtIndex(index + 1, _keywords.ContextualKeyword._from) + ) { + // import type declaration, so no need to process anything. + return; + } + + if (this.tokens.matches1AtIndex(index, _types.TokenType.parenL)) { + // Dynamic import, so nothing to do + return; + } + + if (this.tokens.matches1AtIndex(index, _types.TokenType.name)) { + defaultNames.push(this.tokens.identifierNameAtIndex(index)); + index++; + if (this.tokens.matches1AtIndex(index, _types.TokenType.comma)) { + index++; + } + } + + if (this.tokens.matches1AtIndex(index, _types.TokenType.star)) { + // * as + index += 2; + wildcardNames.push(this.tokens.identifierNameAtIndex(index)); + index++; + } + + if (this.tokens.matches1AtIndex(index, _types.TokenType.braceL)) { + const result = this.getNamedImports(index + 1); + index = result.newIndex; + + for (const namedImport of result.namedImports) { + // Treat {default as X} as a default import to ensure usage of require interop helper + if (namedImport.importedName === "default") { + defaultNames.push(namedImport.localName); + } else { + namedImports.push(namedImport); + } + } + } + + if (this.tokens.matchesContextualAtIndex(index, _keywords.ContextualKeyword._from)) { + index++; + } + + if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) { + throw new Error("Expected string token at the end of import statement."); + } + const path = this.tokens.stringValueAtIndex(index); + const importInfo = this.getImportInfo(path); + importInfo.defaultNames.push(...defaultNames); + importInfo.wildcardNames.push(...wildcardNames); + importInfo.namedImports.push(...namedImports); + if (defaultNames.length === 0 && wildcardNames.length === 0 && namedImports.length === 0) { + importInfo.hasBareImport = true; + } + } + + preprocessExportAtIndex(index) { + if ( + this.tokens.matches2AtIndex(index, _types.TokenType._export, _types.TokenType._var) || + this.tokens.matches2AtIndex(index, _types.TokenType._export, _types.TokenType._let) || + this.tokens.matches2AtIndex(index, _types.TokenType._export, _types.TokenType._const) + ) { + this.preprocessVarExportAtIndex(index); + } else if ( + this.tokens.matches2AtIndex(index, _types.TokenType._export, _types.TokenType._function) || + this.tokens.matches2AtIndex(index, _types.TokenType._export, _types.TokenType._class) + ) { + const exportName = this.tokens.identifierNameAtIndex(index + 2); + this.addExportBinding(exportName, exportName); + } else if (this.tokens.matches3AtIndex(index, _types.TokenType._export, _types.TokenType.name, _types.TokenType._function)) { + const exportName = this.tokens.identifierNameAtIndex(index + 3); + this.addExportBinding(exportName, exportName); + } else if (this.tokens.matches2AtIndex(index, _types.TokenType._export, _types.TokenType.braceL)) { + this.preprocessNamedExportAtIndex(index); + } else if (this.tokens.matches2AtIndex(index, _types.TokenType._export, _types.TokenType.star)) { + this.preprocessExportStarAtIndex(index); + } + } + + preprocessVarExportAtIndex(index) { + let depth = 0; + // Handle cases like `export let {x} = y;`, starting at the open-brace in that case. + for (let i = index + 2; ; i++) { + if ( + this.tokens.matches1AtIndex(i, _types.TokenType.braceL) || + this.tokens.matches1AtIndex(i, _types.TokenType.dollarBraceL) || + this.tokens.matches1AtIndex(i, _types.TokenType.bracketL) + ) { + depth++; + } else if ( + this.tokens.matches1AtIndex(i, _types.TokenType.braceR) || + this.tokens.matches1AtIndex(i, _types.TokenType.bracketR) + ) { + depth--; + } else if (depth === 0 && !this.tokens.matches1AtIndex(i, _types.TokenType.name)) { + break; + } else if (this.tokens.matches1AtIndex(1, _types.TokenType.eq)) { + const endIndex = this.tokens.currentToken().rhsEndIndex; + if (endIndex == null) { + throw new Error("Expected = token with an end index."); + } + i = endIndex - 1; + } else { + const token = this.tokens.tokens[i]; + if (_tokenizer.isDeclaration.call(void 0, token)) { + const exportName = this.tokens.identifierNameAtIndex(i); + this.identifierReplacements.set(exportName, `exports.${exportName}`); + } + } + } + } + + /** + * Walk this export statement just in case it's an export...from statement. + * If it is, combine it into the import info for that path. Otherwise, just + * bail out; it'll be handled later. + */ + preprocessNamedExportAtIndex(index) { + // export { + index += 2; + const {newIndex, namedImports} = this.getNamedImports(index); + index = newIndex; + + if (this.tokens.matchesContextualAtIndex(index, _keywords.ContextualKeyword._from)) { + index++; + } else { + // Reinterpret "a as b" to be local/exported rather than imported/local. + for (const {importedName: localName, localName: exportedName} of namedImports) { + this.addExportBinding(localName, exportedName); + } + return; + } + + if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) { + throw new Error("Expected string token at the end of import statement."); + } + const path = this.tokens.stringValueAtIndex(index); + const importInfo = this.getImportInfo(path); + importInfo.namedExports.push(...namedImports); + } + + preprocessExportStarAtIndex(index) { + let exportedName = null; + if (this.tokens.matches3AtIndex(index, _types.TokenType._export, _types.TokenType.star, _types.TokenType._as)) { + // export * as + index += 3; + exportedName = this.tokens.identifierNameAtIndex(index); + // foo from + index += 2; + } else { + // export * from + index += 3; + } + if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) { + throw new Error("Expected string token at the end of star export statement."); + } + const path = this.tokens.stringValueAtIndex(index); + const importInfo = this.getImportInfo(path); + if (exportedName !== null) { + importInfo.exportStarNames.push(exportedName); + } else { + importInfo.hasStarExport = true; + } + } + + getNamedImports(index) { + const namedImports = []; + while (true) { + if (this.tokens.matches1AtIndex(index, _types.TokenType.braceR)) { + index++; + break; + } + + const specifierInfo = _getImportExportSpecifierInfo2.default.call(void 0, this.tokens, index); + index = specifierInfo.endIndex; + if (!specifierInfo.isType) { + namedImports.push({ + importedName: specifierInfo.leftName, + localName: specifierInfo.rightName, + }); + } + + if (this.tokens.matches2AtIndex(index, _types.TokenType.comma, _types.TokenType.braceR)) { + index += 2; + break; + } else if (this.tokens.matches1AtIndex(index, _types.TokenType.braceR)) { + index++; + break; + } else if (this.tokens.matches1AtIndex(index, _types.TokenType.comma)) { + index++; + } else { + throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[index])}`); + } + } + return {newIndex: index, namedImports}; + } + + /** + * Get a mutable import info object for this path, creating one if it doesn't + * exist yet. + */ + getImportInfo(path) { + const existingInfo = this.importInfoByPath.get(path); + if (existingInfo) { + return existingInfo; + } + const newInfo = { + defaultNames: [], + wildcardNames: [], + namedImports: [], + namedExports: [], + hasBareImport: false, + exportStarNames: [], + hasStarExport: false, + }; + this.importInfoByPath.set(path, newInfo); + return newInfo; + } + + addExportBinding(localName, exportedName) { + if (!this.exportBindingsByLocalName.has(localName)) { + this.exportBindingsByLocalName.set(localName, []); + } + this.exportBindingsByLocalName.get(localName).push(exportedName); + } + + /** + * Return the code to use for the import for this path, or the empty string if + * the code has already been "claimed" by a previous import. + */ + claimImportCode(importPath) { + const result = this.importsToReplace.get(importPath); + this.importsToReplace.set(importPath, ""); + return result || ""; + } + + getIdentifierReplacement(identifierName) { + return this.identifierReplacements.get(identifierName) || null; + } + + /** + * Return a string like `exports.foo = exports.bar`. + */ + resolveExportBinding(assignedName) { + const exportedNames = this.exportBindingsByLocalName.get(assignedName); + if (!exportedNames || exportedNames.length === 0) { + return null; + } + return exportedNames.map((exportedName) => `exports.${exportedName}`).join(" = "); + } + + /** + * Return all imported/exported names where we might be interested in whether usages of those + * names are shadowed. + */ + getGlobalNames() { + return new Set([ + ...this.identifierReplacements.keys(), + ...this.exportBindingsByLocalName.keys(), + ]); + } +} exports.default = CJSImportProcessor; diff --git a/node_modules/sucrase/dist/HelperManager.js b/node_modules/sucrase/dist/HelperManager.js new file mode 100644 index 00000000..6dcc9c99 --- /dev/null +++ b/node_modules/sucrase/dist/HelperManager.js @@ -0,0 +1,176 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); + +const HELPERS = { + require: ` + import {createRequire as CREATE_REQUIRE_NAME} from "module"; + const require = CREATE_REQUIRE_NAME(import.meta.url); + `, + interopRequireWildcard: ` + function interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {}; + if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + return newObj; + } + } + `, + interopRequireDefault: ` + function interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + `, + createNamedExportFrom: ` + function createNamedExportFrom(obj, localName, importedName) { + Object.defineProperty(exports, localName, {enumerable: true, configurable: true, get: () => obj[importedName]}); + } + `, + // Note that TypeScript and Babel do this differently; TypeScript does a simple existence + // check in the exports object and does a plain assignment, whereas Babel uses + // defineProperty and builds an object of explicitly-exported names so that star exports can + // always take lower precedence. For now, we do the easier TypeScript thing. + createStarExport: ` + function createStarExport(obj) { + Object.keys(obj) + .filter((key) => key !== "default" && key !== "__esModule") + .forEach((key) => { + if (exports.hasOwnProperty(key)) { + return; + } + Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); + }); + } + `, + nullishCoalesce: ` + function nullishCoalesce(lhs, rhsFn) { + if (lhs != null) { + return lhs; + } else { + return rhsFn(); + } + } + `, + asyncNullishCoalesce: ` + async function asyncNullishCoalesce(lhs, rhsFn) { + if (lhs != null) { + return lhs; + } else { + return await rhsFn(); + } + } + `, + optionalChain: ` + function optionalChain(ops) { + let lastAccessLHS = undefined; + let value = ops[0]; + let i = 1; + while (i < ops.length) { + const op = ops[i]; + const fn = ops[i + 1]; + i += 2; + if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { + return undefined; + } + if (op === 'access' || op === 'optionalAccess') { + lastAccessLHS = value; + value = fn(value); + } else if (op === 'call' || op === 'optionalCall') { + value = fn((...args) => value.call(lastAccessLHS, ...args)); + lastAccessLHS = undefined; + } + } + return value; + } + `, + asyncOptionalChain: ` + async function asyncOptionalChain(ops) { + let lastAccessLHS = undefined; + let value = ops[0]; + let i = 1; + while (i < ops.length) { + const op = ops[i]; + const fn = ops[i + 1]; + i += 2; + if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { + return undefined; + } + if (op === 'access' || op === 'optionalAccess') { + lastAccessLHS = value; + value = await fn(value); + } else if (op === 'call' || op === 'optionalCall') { + value = await fn((...args) => value.call(lastAccessLHS, ...args)); + lastAccessLHS = undefined; + } + } + return value; + } + `, + optionalChainDelete: ` + function optionalChainDelete(ops) { + const result = OPTIONAL_CHAIN_NAME(ops); + return result == null ? true : result; + } + `, + asyncOptionalChainDelete: ` + async function asyncOptionalChainDelete(ops) { + const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops); + return result == null ? true : result; + } + `, +}; + + class HelperManager { + __init() {this.helperNames = {}} + __init2() {this.createRequireName = null} + constructor( nameManager) {;this.nameManager = nameManager;HelperManager.prototype.__init.call(this);HelperManager.prototype.__init2.call(this);} + + getHelperName(baseName) { + let helperName = this.helperNames[baseName]; + if (helperName) { + return helperName; + } + helperName = this.nameManager.claimFreeName(`_${baseName}`); + this.helperNames[baseName] = helperName; + return helperName; + } + + emitHelpers() { + let resultCode = ""; + if (this.helperNames.optionalChainDelete) { + this.getHelperName("optionalChain"); + } + if (this.helperNames.asyncOptionalChainDelete) { + this.getHelperName("asyncOptionalChain"); + } + for (const [baseName, helperCodeTemplate] of Object.entries(HELPERS)) { + const helperName = this.helperNames[baseName]; + let helperCode = helperCodeTemplate; + if (baseName === "optionalChainDelete") { + helperCode = helperCode.replace("OPTIONAL_CHAIN_NAME", this.helperNames.optionalChain); + } else if (baseName === "asyncOptionalChainDelete") { + helperCode = helperCode.replace( + "ASYNC_OPTIONAL_CHAIN_NAME", + this.helperNames.asyncOptionalChain, + ); + } else if (baseName === "require") { + if (this.createRequireName === null) { + this.createRequireName = this.nameManager.claimFreeName("_createRequire"); + } + helperCode = helperCode.replace(/CREATE_REQUIRE_NAME/g, this.createRequireName); + } + if (helperName) { + resultCode += " "; + resultCode += helperCode.replace(baseName, helperName).replace(/\s+/g, " ").trim(); + } + } + return resultCode; + } +} exports.HelperManager = HelperManager; diff --git a/node_modules/sucrase/dist/NameManager.js b/node_modules/sucrase/dist/NameManager.js new file mode 100644 index 00000000..0ebbe28f --- /dev/null +++ b/node_modules/sucrase/dist/NameManager.js @@ -0,0 +1,27 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _getIdentifierNames = require('./util/getIdentifierNames'); var _getIdentifierNames2 = _interopRequireDefault(_getIdentifierNames); + + class NameManager { + __init() {this.usedNames = new Set()} + + constructor(code, tokens) {;NameManager.prototype.__init.call(this); + this.usedNames = new Set(_getIdentifierNames2.default.call(void 0, code, tokens)); + } + + claimFreeName(name) { + const newName = this.findFreeName(name); + this.usedNames.add(newName); + return newName; + } + + findFreeName(name) { + if (!this.usedNames.has(name)) { + return name; + } + let suffixNum = 2; + while (this.usedNames.has(name + String(suffixNum))) { + suffixNum++; + } + return name + String(suffixNum); + } +} exports.default = NameManager; diff --git a/node_modules/sucrase/dist/Options-gen-types.js b/node_modules/sucrase/dist/Options-gen-types.js new file mode 100644 index 00000000..438d198b --- /dev/null +++ b/node_modules/sucrase/dist/Options-gen-types.js @@ -0,0 +1,42 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }/** + * This module was automatically generated by `ts-interface-builder` + */ +var _tsinterfacechecker = require('ts-interface-checker'); var t = _interopRequireWildcard(_tsinterfacechecker); +// tslint:disable:object-literal-key-quotes + + const Transform = t.union( + t.lit("jsx"), + t.lit("typescript"), + t.lit("flow"), + t.lit("imports"), + t.lit("react-hot-loader"), + t.lit("jest"), +); exports.Transform = Transform; + + const SourceMapOptions = t.iface([], { + compiledFilename: "string", +}); exports.SourceMapOptions = SourceMapOptions; + + const Options = t.iface([], { + transforms: t.array("Transform"), + disableESTransforms: t.opt("boolean"), + jsxRuntime: t.opt(t.union(t.lit("classic"), t.lit("automatic"), t.lit("preserve"))), + production: t.opt("boolean"), + jsxImportSource: t.opt("string"), + jsxPragma: t.opt("string"), + jsxFragmentPragma: t.opt("string"), + keepUnusedImports: t.opt("boolean"), + preserveDynamicImport: t.opt("boolean"), + injectCreateRequireForImportRequire: t.opt("boolean"), + enableLegacyTypeScriptModuleInterop: t.opt("boolean"), + enableLegacyBabel5ModuleInterop: t.opt("boolean"), + sourceMapOptions: t.opt("SourceMapOptions"), + filePath: t.opt("string"), +}); exports.Options = Options; + +const exportedTypeSuite = { + Transform: exports.Transform, + SourceMapOptions: exports.SourceMapOptions, + Options: exports.Options, +}; +exports. default = exportedTypeSuite; diff --git a/node_modules/sucrase/dist/Options.js b/node_modules/sucrase/dist/Options.js new file mode 100644 index 00000000..15855c40 --- /dev/null +++ b/node_modules/sucrase/dist/Options.js @@ -0,0 +1,101 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _tsinterfacechecker = require('ts-interface-checker'); + +var _Optionsgentypes = require('./Options-gen-types'); var _Optionsgentypes2 = _interopRequireDefault(_Optionsgentypes); + +const {Options: OptionsChecker} = _tsinterfacechecker.createCheckers.call(void 0, _Optionsgentypes2.default); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + function validateOptions(options) { + OptionsChecker.strictCheck(options); +} exports.validateOptions = validateOptions; diff --git a/node_modules/sucrase/dist/TokenProcessor.js b/node_modules/sucrase/dist/TokenProcessor.js new file mode 100644 index 00000000..58fdd98b --- /dev/null +++ b/node_modules/sucrase/dist/TokenProcessor.js @@ -0,0 +1,357 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + +var _types = require('./parser/tokenizer/types'); +var _isAsyncOperation = require('./util/isAsyncOperation'); var _isAsyncOperation2 = _interopRequireDefault(_isAsyncOperation); + + + + + + + + + + + + class TokenProcessor { + __init() {this.resultCode = ""} + // Array mapping input token index to optional string index position in the + // output code. + __init2() {this.resultMappings = new Array(this.tokens.length)} + __init3() {this.tokenIndex = 0} + + constructor( + code, + tokens, + isFlowEnabled, + disableESTransforms, + helperManager, + ) {;this.code = code;this.tokens = tokens;this.isFlowEnabled = isFlowEnabled;this.disableESTransforms = disableESTransforms;this.helperManager = helperManager;TokenProcessor.prototype.__init.call(this);TokenProcessor.prototype.__init2.call(this);TokenProcessor.prototype.__init3.call(this);} + + /** + * Snapshot the token state in a way that can be restored later, useful for + * things like lookahead. + * + * resultMappings do not need to be copied since in all use cases, they will + * be overwritten anyway after restore. + */ + snapshot() { + return { + resultCode: this.resultCode, + tokenIndex: this.tokenIndex, + }; + } + + restoreToSnapshot(snapshot) { + this.resultCode = snapshot.resultCode; + this.tokenIndex = snapshot.tokenIndex; + } + + /** + * Remove and return the code generated since the snapshot, leaving the + * current token position in-place. Unlike most TokenProcessor operations, + * this operation can result in input/output line number mismatches because + * the removed code may contain newlines, so this operation should be used + * sparingly. + */ + dangerouslyGetAndRemoveCodeSinceSnapshot(snapshot) { + const result = this.resultCode.slice(snapshot.resultCode.length); + this.resultCode = snapshot.resultCode; + return result; + } + + reset() { + this.resultCode = ""; + this.resultMappings = new Array(this.tokens.length); + this.tokenIndex = 0; + } + + matchesContextualAtIndex(index, contextualKeyword) { + return ( + this.matches1AtIndex(index, _types.TokenType.name) && + this.tokens[index].contextualKeyword === contextualKeyword + ); + } + + identifierNameAtIndex(index) { + // TODO: We need to process escapes since technically you can have unicode escapes in variable + // names. + return this.identifierNameForToken(this.tokens[index]); + } + + identifierNameAtRelativeIndex(relativeIndex) { + return this.identifierNameForToken(this.tokenAtRelativeIndex(relativeIndex)); + } + + identifierName() { + return this.identifierNameForToken(this.currentToken()); + } + + identifierNameForToken(token) { + return this.code.slice(token.start, token.end); + } + + rawCodeForToken(token) { + return this.code.slice(token.start, token.end); + } + + stringValueAtIndex(index) { + return this.stringValueForToken(this.tokens[index]); + } + + stringValue() { + return this.stringValueForToken(this.currentToken()); + } + + stringValueForToken(token) { + // This is used to identify when two imports are the same and to resolve TypeScript enum keys. + // Ideally we'd process escapes within the strings, but for now we pretty much take the raw + // code. + return this.code.slice(token.start + 1, token.end - 1); + } + + matches1AtIndex(index, t1) { + return this.tokens[index].type === t1; + } + + matches2AtIndex(index, t1, t2) { + return this.tokens[index].type === t1 && this.tokens[index + 1].type === t2; + } + + matches3AtIndex(index, t1, t2, t3) { + return ( + this.tokens[index].type === t1 && + this.tokens[index + 1].type === t2 && + this.tokens[index + 2].type === t3 + ); + } + + matches1(t1) { + return this.tokens[this.tokenIndex].type === t1; + } + + matches2(t1, t2) { + return this.tokens[this.tokenIndex].type === t1 && this.tokens[this.tokenIndex + 1].type === t2; + } + + matches3(t1, t2, t3) { + return ( + this.tokens[this.tokenIndex].type === t1 && + this.tokens[this.tokenIndex + 1].type === t2 && + this.tokens[this.tokenIndex + 2].type === t3 + ); + } + + matches4(t1, t2, t3, t4) { + return ( + this.tokens[this.tokenIndex].type === t1 && + this.tokens[this.tokenIndex + 1].type === t2 && + this.tokens[this.tokenIndex + 2].type === t3 && + this.tokens[this.tokenIndex + 3].type === t4 + ); + } + + matches5(t1, t2, t3, t4, t5) { + return ( + this.tokens[this.tokenIndex].type === t1 && + this.tokens[this.tokenIndex + 1].type === t2 && + this.tokens[this.tokenIndex + 2].type === t3 && + this.tokens[this.tokenIndex + 3].type === t4 && + this.tokens[this.tokenIndex + 4].type === t5 + ); + } + + matchesContextual(contextualKeyword) { + return this.matchesContextualAtIndex(this.tokenIndex, contextualKeyword); + } + + matchesContextIdAndLabel(type, contextId) { + return this.matches1(type) && this.currentToken().contextId === contextId; + } + + previousWhitespaceAndComments() { + let whitespaceAndComments = this.code.slice( + this.tokenIndex > 0 ? this.tokens[this.tokenIndex - 1].end : 0, + this.tokenIndex < this.tokens.length ? this.tokens[this.tokenIndex].start : this.code.length, + ); + if (this.isFlowEnabled) { + whitespaceAndComments = whitespaceAndComments.replace(/@flow/g, ""); + } + return whitespaceAndComments; + } + + replaceToken(newCode) { + this.resultCode += this.previousWhitespaceAndComments(); + this.appendTokenPrefix(); + this.resultMappings[this.tokenIndex] = this.resultCode.length; + this.resultCode += newCode; + this.appendTokenSuffix(); + this.tokenIndex++; + } + + replaceTokenTrimmingLeftWhitespace(newCode) { + this.resultCode += this.previousWhitespaceAndComments().replace(/[^\r\n]/g, ""); + this.appendTokenPrefix(); + this.resultMappings[this.tokenIndex] = this.resultCode.length; + this.resultCode += newCode; + this.appendTokenSuffix(); + this.tokenIndex++; + } + + removeInitialToken() { + this.replaceToken(""); + } + + removeToken() { + this.replaceTokenTrimmingLeftWhitespace(""); + } + + /** + * Remove all code until the next }, accounting for balanced braces. + */ + removeBalancedCode() { + let braceDepth = 0; + while (!this.isAtEnd()) { + if (this.matches1(_types.TokenType.braceL)) { + braceDepth++; + } else if (this.matches1(_types.TokenType.braceR)) { + if (braceDepth === 0) { + return; + } + braceDepth--; + } + this.removeToken(); + } + } + + copyExpectedToken(tokenType) { + if (this.tokens[this.tokenIndex].type !== tokenType) { + throw new Error(`Expected token ${tokenType}`); + } + this.copyToken(); + } + + copyToken() { + this.resultCode += this.previousWhitespaceAndComments(); + this.appendTokenPrefix(); + this.resultMappings[this.tokenIndex] = this.resultCode.length; + this.resultCode += this.code.slice( + this.tokens[this.tokenIndex].start, + this.tokens[this.tokenIndex].end, + ); + this.appendTokenSuffix(); + this.tokenIndex++; + } + + copyTokenWithPrefix(prefix) { + this.resultCode += this.previousWhitespaceAndComments(); + this.appendTokenPrefix(); + this.resultCode += prefix; + this.resultMappings[this.tokenIndex] = this.resultCode.length; + this.resultCode += this.code.slice( + this.tokens[this.tokenIndex].start, + this.tokens[this.tokenIndex].end, + ); + this.appendTokenSuffix(); + this.tokenIndex++; + } + + appendTokenPrefix() { + const token = this.currentToken(); + if (token.numNullishCoalesceStarts || token.isOptionalChainStart) { + token.isAsyncOperation = _isAsyncOperation2.default.call(void 0, this); + } + if (this.disableESTransforms) { + return; + } + if (token.numNullishCoalesceStarts) { + for (let i = 0; i < token.numNullishCoalesceStarts; i++) { + if (token.isAsyncOperation) { + this.resultCode += "await "; + this.resultCode += this.helperManager.getHelperName("asyncNullishCoalesce"); + } else { + this.resultCode += this.helperManager.getHelperName("nullishCoalesce"); + } + this.resultCode += "("; + } + } + if (token.isOptionalChainStart) { + if (token.isAsyncOperation) { + this.resultCode += "await "; + } + if (this.tokenIndex > 0 && this.tokenAtRelativeIndex(-1).type === _types.TokenType._delete) { + if (token.isAsyncOperation) { + this.resultCode += this.helperManager.getHelperName("asyncOptionalChainDelete"); + } else { + this.resultCode += this.helperManager.getHelperName("optionalChainDelete"); + } + } else if (token.isAsyncOperation) { + this.resultCode += this.helperManager.getHelperName("asyncOptionalChain"); + } else { + this.resultCode += this.helperManager.getHelperName("optionalChain"); + } + this.resultCode += "(["; + } + } + + appendTokenSuffix() { + const token = this.currentToken(); + if (token.isOptionalChainEnd && !this.disableESTransforms) { + this.resultCode += "])"; + } + if (token.numNullishCoalesceEnds && !this.disableESTransforms) { + for (let i = 0; i < token.numNullishCoalesceEnds; i++) { + this.resultCode += "))"; + } + } + } + + appendCode(code) { + this.resultCode += code; + } + + currentToken() { + return this.tokens[this.tokenIndex]; + } + + currentTokenCode() { + const token = this.currentToken(); + return this.code.slice(token.start, token.end); + } + + tokenAtRelativeIndex(relativeIndex) { + return this.tokens[this.tokenIndex + relativeIndex]; + } + + currentIndex() { + return this.tokenIndex; + } + + /** + * Move to the next token. Only suitable in preprocessing steps. When + * generating new code, you should use copyToken or removeToken. + */ + nextToken() { + if (this.tokenIndex === this.tokens.length) { + throw new Error("Unexpectedly reached end of input."); + } + this.tokenIndex++; + } + + previousToken() { + this.tokenIndex--; + } + + finish() { + if (this.tokenIndex !== this.tokens.length) { + throw new Error("Tried to finish processing tokens before reaching the end."); + } + this.resultCode += this.previousWhitespaceAndComments(); + return {code: this.resultCode, mappings: this.resultMappings}; + } + + isAtEnd() { + return this.tokenIndex === this.tokens.length; + } +} exports.default = TokenProcessor; diff --git a/node_modules/sucrase/dist/cli.js b/node_modules/sucrase/dist/cli.js new file mode 100644 index 00000000..470cd848 --- /dev/null +++ b/node_modules/sucrase/dist/cli.js @@ -0,0 +1,317 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/* eslint-disable no-console */ +var _commander = require('commander'); var _commander2 = _interopRequireDefault(_commander); +var _glob = require('glob'); +var _fs = require('mz/fs'); +var _path = require('path'); + +var _index = require('./index'); + + + + + + + + + + + + function run() { + _commander2.default + .description(`Sucrase: super-fast Babel alternative.`) + .usage("[options] ") + .option( + "-d, --out-dir ", + "Compile an input directory of modules into an output directory.", + ) + .option( + "-p, --project ", + "Compile a TypeScript project, will read from tsconfig.json in ", + ) + .option("--out-extension ", "File extension to use for all output files.", "js") + .option("--exclude-dirs ", "Names of directories that should not be traversed.") + .option("-q, --quiet", "Don't print the names of converted files.") + .option("-t, --transforms ", "Comma-separated list of transforms to run.") + .option("--disable-es-transforms", "Opt out of all ES syntax transforms.") + .option("--jsx-runtime ", "Transformation mode for the JSX transform.") + .option("--production", "Disable debugging information from JSX in output.") + .option( + "--jsx-import-source ", + "Automatic JSX transform import path prefix, defaults to `React.Fragment`.", + ) + .option( + "--jsx-pragma ", + "Classic JSX transform element creation function, defaults to `React.createElement`.", + ) + .option( + "--jsx-fragment-pragma ", + "Classic JSX transform fragment component, defaults to `React.Fragment`.", + ) + .option("--keep-unused-imports", "Disable automatic removal of type-only imports/exports.") + .option("--preserve-dynamic-import", "Don't transpile dynamic import() to require.") + .option( + "--inject-create-require-for-import-require", + "Use `createRequire` when transpiling TS `import = require` to ESM.", + ) + .option( + "--enable-legacy-typescript-module-interop", + "Use default TypeScript ESM/CJS interop strategy.", + ) + .option("--enable-legacy-babel5-module-interop", "Use Babel 5 ESM/CJS interop strategy.") + .parse(process.argv); + + if (_commander2.default.project) { + if ( + _commander2.default.outDir || + _commander2.default.transforms || + _commander2.default.args[0] || + _commander2.default.enableLegacyTypescriptModuleInterop + ) { + console.error( + "If TypeScript project is specified, out directory, transforms, source " + + "directory, and --enable-legacy-typescript-module-interop may not be specified.", + ); + process.exit(1); + } + } else { + if (!_commander2.default.outDir) { + console.error("Out directory is required"); + process.exit(1); + } + + if (!_commander2.default.transforms) { + console.error("Transforms option is required."); + process.exit(1); + } + + if (!_commander2.default.args[0]) { + console.error("Source directory is required."); + process.exit(1); + } + } + + const options = { + outDirPath: _commander2.default.outDir, + srcDirPath: _commander2.default.args[0], + project: _commander2.default.project, + outExtension: _commander2.default.outExtension, + excludeDirs: _commander2.default.excludeDirs ? _commander2.default.excludeDirs.split(",") : [], + quiet: _commander2.default.quiet, + sucraseOptions: { + transforms: _commander2.default.transforms ? _commander2.default.transforms.split(",") : [], + disableESTransforms: _commander2.default.disableEsTransforms, + jsxRuntime: _commander2.default.jsxRuntime, + production: _commander2.default.production, + jsxImportSource: _commander2.default.jsxImportSource, + jsxPragma: _commander2.default.jsxPragma || "React.createElement", + jsxFragmentPragma: _commander2.default.jsxFragmentPragma || "React.Fragment", + keepUnusedImports: _commander2.default.keepUnusedImports, + preserveDynamicImport: _commander2.default.preserveDynamicImport, + injectCreateRequireForImportRequire: _commander2.default.injectCreateRequireForImportRequire, + enableLegacyTypeScriptModuleInterop: _commander2.default.enableLegacyTypescriptModuleInterop, + enableLegacyBabel5ModuleInterop: _commander2.default.enableLegacyBabel5ModuleInterop, + }, + }; + + buildDirectory(options).catch((e) => { + process.exitCode = 1; + console.error(e); + }); +} exports.default = run; + + + + + + +async function findFiles(options) { + const outDirPath = options.outDirPath; + const srcDirPath = options.srcDirPath; + + const extensions = options.sucraseOptions.transforms.includes("typescript") + ? [".ts", ".tsx"] + : [".js", ".jsx"]; + + if (!(await _fs.exists.call(void 0, outDirPath))) { + await _fs.mkdir.call(void 0, outDirPath); + } + + const outArr = []; + for (const child of await _fs.readdir.call(void 0, srcDirPath)) { + if (["node_modules", ".git"].includes(child) || options.excludeDirs.includes(child)) { + continue; + } + const srcChildPath = _path.join.call(void 0, srcDirPath, child); + const outChildPath = _path.join.call(void 0, outDirPath, child); + if ((await _fs.stat.call(void 0, srcChildPath)).isDirectory()) { + const innerOptions = {...options}; + innerOptions.srcDirPath = srcChildPath; + innerOptions.outDirPath = outChildPath; + const innerFiles = await findFiles(innerOptions); + outArr.push(...innerFiles); + } else if (extensions.some((ext) => srcChildPath.endsWith(ext))) { + const outPath = outChildPath.replace(/\.\w+$/, `.${options.outExtension}`); + outArr.push({ + srcPath: srcChildPath, + outPath, + }); + } + } + + return outArr; +} + +async function runGlob(options) { + const tsConfigPath = _path.join.call(void 0, options.project, "tsconfig.json"); + + let str; + try { + str = await _fs.readFile.call(void 0, tsConfigPath, "utf8"); + } catch (err) { + console.error("Could not find project tsconfig.json"); + console.error(` --project=${options.project}`); + console.error(err); + process.exit(1); + } + const json = JSON.parse(str); + + const foundFiles = []; + + const files = json.files; + const include = json.include; + + const absProject = _path.join.call(void 0, process.cwd(), options.project); + const outDirs = []; + + if (!(await _fs.exists.call(void 0, options.outDirPath))) { + await _fs.mkdir.call(void 0, options.outDirPath); + } + + if (files) { + for (const file of files) { + if (file.endsWith(".d.ts")) { + continue; + } + if (!file.endsWith(".ts") && !file.endsWith(".js")) { + continue; + } + + const srcFile = _path.join.call(void 0, absProject, file); + const outFile = _path.join.call(void 0, options.outDirPath, file); + const outPath = outFile.replace(/\.\w+$/, `.${options.outExtension}`); + + const outDir = _path.dirname.call(void 0, outPath); + if (!outDirs.includes(outDir)) { + outDirs.push(outDir); + } + + foundFiles.push({ + srcPath: srcFile, + outPath, + }); + } + } + if (include) { + for (const pattern of include) { + const globFiles = await _glob.glob.call(void 0, _path.join.call(void 0, absProject, pattern)); + for (const file of globFiles) { + if (!file.endsWith(".ts") && !file.endsWith(".js")) { + continue; + } + if (file.endsWith(".d.ts")) { + continue; + } + + const relativeFile = _path.relative.call(void 0, absProject, file); + const outFile = _path.join.call(void 0, options.outDirPath, relativeFile); + const outPath = outFile.replace(/\.\w+$/, `.${options.outExtension}`); + + const outDir = _path.dirname.call(void 0, outPath); + if (!outDirs.includes(outDir)) { + outDirs.push(outDir); + } + + foundFiles.push({ + srcPath: file, + outPath, + }); + } + } + } + + for (const outDirPath of outDirs) { + if (!(await _fs.exists.call(void 0, outDirPath))) { + await _fs.mkdir.call(void 0, outDirPath); + } + } + + // TODO: read exclude + + return foundFiles; +} + +async function updateOptionsFromProject(options) { + /** + * Read the project information and assign the following. + * - outDirPath + * - transform: imports + * - transform: typescript + * - enableLegacyTypescriptModuleInterop: true/false. + */ + + const tsConfigPath = _path.join.call(void 0, options.project, "tsconfig.json"); + + let str; + try { + str = await _fs.readFile.call(void 0, tsConfigPath, "utf8"); + } catch (err) { + console.error("Could not find project tsconfig.json"); + console.error(` --project=${options.project}`); + console.error(err); + process.exit(1); + } + const json = JSON.parse(str); + const sucraseOpts = options.sucraseOptions; + if (!sucraseOpts.transforms.includes("typescript")) { + sucraseOpts.transforms.push("typescript"); + } + + const compilerOpts = json.compilerOptions; + if (compilerOpts.outDir) { + options.outDirPath = _path.join.call(void 0, process.cwd(), options.project, compilerOpts.outDir); + } + if (compilerOpts.esModuleInterop !== true) { + sucraseOpts.enableLegacyTypeScriptModuleInterop = true; + } + if (compilerOpts.module === "commonjs") { + if (!sucraseOpts.transforms.includes("imports")) { + sucraseOpts.transforms.push("imports"); + } + } +} + +async function buildDirectory(options) { + let files; + if (options.outDirPath && options.srcDirPath) { + files = await findFiles(options); + } else if (options.project) { + await updateOptionsFromProject(options); + files = await runGlob(options); + } else { + console.error("Project or Source directory required."); + process.exit(1); + } + + for (const file of files) { + await buildFile(file.srcPath, file.outPath, options); + } +} + +async function buildFile(srcPath, outPath, options) { + if (!options.quiet) { + console.log(`${srcPath} -> ${outPath}`); + } + const code = (await _fs.readFile.call(void 0, srcPath)).toString(); + const transformedCode = _index.transform.call(void 0, code, {...options.sucraseOptions, filePath: srcPath}).code; + await _fs.writeFile.call(void 0, outPath, transformedCode); +} diff --git a/node_modules/sucrase/dist/computeSourceMap.js b/node_modules/sucrase/dist/computeSourceMap.js new file mode 100644 index 00000000..567ddbb2 --- /dev/null +++ b/node_modules/sucrase/dist/computeSourceMap.js @@ -0,0 +1,89 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _genmapping = require('@jridgewell/gen-mapping'); + + + +var _charcodes = require('./parser/util/charcodes'); + + + + + + + + + + + + +/** + * Generate a source map indicating that each line maps directly to the original line, + * with the tokens in their new positions. + */ + function computeSourceMap( + {code: generatedCode, mappings: rawMappings}, + filePath, + options, + source, + tokens, +) { + const sourceColumns = computeSourceColumns(source, tokens); + const map = new (0, _genmapping.GenMapping)({file: options.compiledFilename}); + let tokenIndex = 0; + // currentMapping is the output source index for the current input token being + // considered. + let currentMapping = rawMappings[0]; + while (currentMapping === undefined && tokenIndex < rawMappings.length - 1) { + tokenIndex++; + currentMapping = rawMappings[tokenIndex]; + } + let line = 0; + let lineStart = 0; + if (currentMapping !== lineStart) { + _genmapping.maybeAddSegment.call(void 0, map, line, 0, filePath, line, 0); + } + for (let i = 0; i < generatedCode.length; i++) { + if (i === currentMapping) { + const genColumn = currentMapping - lineStart; + const sourceColumn = sourceColumns[tokenIndex]; + _genmapping.maybeAddSegment.call(void 0, map, line, genColumn, filePath, line, sourceColumn); + while ( + (currentMapping === i || currentMapping === undefined) && + tokenIndex < rawMappings.length - 1 + ) { + tokenIndex++; + currentMapping = rawMappings[tokenIndex]; + } + } + if (generatedCode.charCodeAt(i) === _charcodes.charCodes.lineFeed) { + line++; + lineStart = i + 1; + if (currentMapping !== lineStart) { + _genmapping.maybeAddSegment.call(void 0, map, line, 0, filePath, line, 0); + } + } + } + const {sourceRoot, sourcesContent, ...sourceMap} = _genmapping.toEncodedMap.call(void 0, map); + return sourceMap ; +} exports.default = computeSourceMap; + +/** + * Create an array mapping each token index to the 0-based column of the start + * position of the token. + */ +function computeSourceColumns(code, tokens) { + const sourceColumns = new Array(tokens.length); + let tokenIndex = 0; + let currentMapping = tokens[tokenIndex].start; + let lineStart = 0; + for (let i = 0; i < code.length; i++) { + if (i === currentMapping) { + sourceColumns[tokenIndex] = currentMapping - lineStart; + tokenIndex++; + currentMapping = tokens[tokenIndex].start; + } + if (code.charCodeAt(i) === _charcodes.charCodes.lineFeed) { + lineStart = i + 1; + } + } + return sourceColumns; +} diff --git a/node_modules/sucrase/dist/esm/CJSImportProcessor.js b/node_modules/sucrase/dist/esm/CJSImportProcessor.js new file mode 100644 index 00000000..d8b7803a --- /dev/null +++ b/node_modules/sucrase/dist/esm/CJSImportProcessor.js @@ -0,0 +1,456 @@ + + + +import {isDeclaration} from "./parser/tokenizer"; +import {ContextualKeyword} from "./parser/tokenizer/keywords"; +import {TokenType as tt} from "./parser/tokenizer/types"; + +import getImportExportSpecifierInfo from "./util/getImportExportSpecifierInfo"; +import {getNonTypeIdentifiers} from "./util/getNonTypeIdentifiers"; + + + + + + + + + + + + + + + + +/** + * Class responsible for preprocessing and bookkeeping import and export declarations within the + * file. + * + * TypeScript uses a simpler mechanism that does not use functions like interopRequireDefault and + * interopRequireWildcard, so we also allow that mode for compatibility. + */ +export default class CJSImportProcessor { + __init() {this.nonTypeIdentifiers = new Set()} + __init2() {this.importInfoByPath = new Map()} + __init3() {this.importsToReplace = new Map()} + __init4() {this.identifierReplacements = new Map()} + __init5() {this.exportBindingsByLocalName = new Map()} + + constructor( + nameManager, + tokens, + enableLegacyTypeScriptModuleInterop, + options, + isTypeScriptTransformEnabled, + keepUnusedImports, + helperManager, + ) {;this.nameManager = nameManager;this.tokens = tokens;this.enableLegacyTypeScriptModuleInterop = enableLegacyTypeScriptModuleInterop;this.options = options;this.isTypeScriptTransformEnabled = isTypeScriptTransformEnabled;this.keepUnusedImports = keepUnusedImports;this.helperManager = helperManager;CJSImportProcessor.prototype.__init.call(this);CJSImportProcessor.prototype.__init2.call(this);CJSImportProcessor.prototype.__init3.call(this);CJSImportProcessor.prototype.__init4.call(this);CJSImportProcessor.prototype.__init5.call(this);} + + preprocessTokens() { + for (let i = 0; i < this.tokens.tokens.length; i++) { + if ( + this.tokens.matches1AtIndex(i, tt._import) && + !this.tokens.matches3AtIndex(i, tt._import, tt.name, tt.eq) + ) { + this.preprocessImportAtIndex(i); + } + if ( + this.tokens.matches1AtIndex(i, tt._export) && + !this.tokens.matches2AtIndex(i, tt._export, tt.eq) + ) { + this.preprocessExportAtIndex(i); + } + } + this.generateImportReplacements(); + } + + /** + * In TypeScript, import statements that only import types should be removed. + * This includes `import {} from 'foo';`, but not `import 'foo';`. + */ + pruneTypeOnlyImports() { + this.nonTypeIdentifiers = getNonTypeIdentifiers(this.tokens, this.options); + for (const [path, importInfo] of this.importInfoByPath.entries()) { + if ( + importInfo.hasBareImport || + importInfo.hasStarExport || + importInfo.exportStarNames.length > 0 || + importInfo.namedExports.length > 0 + ) { + continue; + } + const names = [ + ...importInfo.defaultNames, + ...importInfo.wildcardNames, + ...importInfo.namedImports.map(({localName}) => localName), + ]; + if (names.every((name) => this.shouldAutomaticallyElideImportedName(name))) { + this.importsToReplace.set(path, ""); + } + } + } + + shouldAutomaticallyElideImportedName(name) { + return ( + this.isTypeScriptTransformEnabled && + !this.keepUnusedImports && + !this.nonTypeIdentifiers.has(name) + ); + } + + generateImportReplacements() { + for (const [path, importInfo] of this.importInfoByPath.entries()) { + const { + defaultNames, + wildcardNames, + namedImports, + namedExports, + exportStarNames, + hasStarExport, + } = importInfo; + + if ( + defaultNames.length === 0 && + wildcardNames.length === 0 && + namedImports.length === 0 && + namedExports.length === 0 && + exportStarNames.length === 0 && + !hasStarExport + ) { + // Import is never used, so don't even assign a name. + this.importsToReplace.set(path, `require('${path}');`); + continue; + } + + const primaryImportName = this.getFreeIdentifierForPath(path); + let secondaryImportName; + if (this.enableLegacyTypeScriptModuleInterop) { + secondaryImportName = primaryImportName; + } else { + secondaryImportName = + wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(path); + } + let requireCode = `var ${primaryImportName} = require('${path}');`; + if (wildcardNames.length > 0) { + for (const wildcardName of wildcardNames) { + const moduleExpr = this.enableLegacyTypeScriptModuleInterop + ? primaryImportName + : `${this.helperManager.getHelperName("interopRequireWildcard")}(${primaryImportName})`; + requireCode += ` var ${wildcardName} = ${moduleExpr};`; + } + } else if (exportStarNames.length > 0 && secondaryImportName !== primaryImportName) { + requireCode += ` var ${secondaryImportName} = ${this.helperManager.getHelperName( + "interopRequireWildcard", + )}(${primaryImportName});`; + } else if (defaultNames.length > 0 && secondaryImportName !== primaryImportName) { + requireCode += ` var ${secondaryImportName} = ${this.helperManager.getHelperName( + "interopRequireDefault", + )}(${primaryImportName});`; + } + + for (const {importedName, localName} of namedExports) { + requireCode += ` ${this.helperManager.getHelperName( + "createNamedExportFrom", + )}(${primaryImportName}, '${localName}', '${importedName}');`; + } + for (const exportStarName of exportStarNames) { + requireCode += ` exports.${exportStarName} = ${secondaryImportName};`; + } + if (hasStarExport) { + requireCode += ` ${this.helperManager.getHelperName( + "createStarExport", + )}(${primaryImportName});`; + } + + this.importsToReplace.set(path, requireCode); + + for (const defaultName of defaultNames) { + this.identifierReplacements.set(defaultName, `${secondaryImportName}.default`); + } + for (const {importedName, localName} of namedImports) { + this.identifierReplacements.set(localName, `${primaryImportName}.${importedName}`); + } + } + } + + getFreeIdentifierForPath(path) { + const components = path.split("/"); + const lastComponent = components[components.length - 1]; + const baseName = lastComponent.replace(/\W/g, ""); + return this.nameManager.claimFreeName(`_${baseName}`); + } + + preprocessImportAtIndex(index) { + const defaultNames = []; + const wildcardNames = []; + const namedImports = []; + + index++; + if ( + (this.tokens.matchesContextualAtIndex(index, ContextualKeyword._type) || + this.tokens.matches1AtIndex(index, tt._typeof)) && + !this.tokens.matches1AtIndex(index + 1, tt.comma) && + !this.tokens.matchesContextualAtIndex(index + 1, ContextualKeyword._from) + ) { + // import type declaration, so no need to process anything. + return; + } + + if (this.tokens.matches1AtIndex(index, tt.parenL)) { + // Dynamic import, so nothing to do + return; + } + + if (this.tokens.matches1AtIndex(index, tt.name)) { + defaultNames.push(this.tokens.identifierNameAtIndex(index)); + index++; + if (this.tokens.matches1AtIndex(index, tt.comma)) { + index++; + } + } + + if (this.tokens.matches1AtIndex(index, tt.star)) { + // * as + index += 2; + wildcardNames.push(this.tokens.identifierNameAtIndex(index)); + index++; + } + + if (this.tokens.matches1AtIndex(index, tt.braceL)) { + const result = this.getNamedImports(index + 1); + index = result.newIndex; + + for (const namedImport of result.namedImports) { + // Treat {default as X} as a default import to ensure usage of require interop helper + if (namedImport.importedName === "default") { + defaultNames.push(namedImport.localName); + } else { + namedImports.push(namedImport); + } + } + } + + if (this.tokens.matchesContextualAtIndex(index, ContextualKeyword._from)) { + index++; + } + + if (!this.tokens.matches1AtIndex(index, tt.string)) { + throw new Error("Expected string token at the end of import statement."); + } + const path = this.tokens.stringValueAtIndex(index); + const importInfo = this.getImportInfo(path); + importInfo.defaultNames.push(...defaultNames); + importInfo.wildcardNames.push(...wildcardNames); + importInfo.namedImports.push(...namedImports); + if (defaultNames.length === 0 && wildcardNames.length === 0 && namedImports.length === 0) { + importInfo.hasBareImport = true; + } + } + + preprocessExportAtIndex(index) { + if ( + this.tokens.matches2AtIndex(index, tt._export, tt._var) || + this.tokens.matches2AtIndex(index, tt._export, tt._let) || + this.tokens.matches2AtIndex(index, tt._export, tt._const) + ) { + this.preprocessVarExportAtIndex(index); + } else if ( + this.tokens.matches2AtIndex(index, tt._export, tt._function) || + this.tokens.matches2AtIndex(index, tt._export, tt._class) + ) { + const exportName = this.tokens.identifierNameAtIndex(index + 2); + this.addExportBinding(exportName, exportName); + } else if (this.tokens.matches3AtIndex(index, tt._export, tt.name, tt._function)) { + const exportName = this.tokens.identifierNameAtIndex(index + 3); + this.addExportBinding(exportName, exportName); + } else if (this.tokens.matches2AtIndex(index, tt._export, tt.braceL)) { + this.preprocessNamedExportAtIndex(index); + } else if (this.tokens.matches2AtIndex(index, tt._export, tt.star)) { + this.preprocessExportStarAtIndex(index); + } + } + + preprocessVarExportAtIndex(index) { + let depth = 0; + // Handle cases like `export let {x} = y;`, starting at the open-brace in that case. + for (let i = index + 2; ; i++) { + if ( + this.tokens.matches1AtIndex(i, tt.braceL) || + this.tokens.matches1AtIndex(i, tt.dollarBraceL) || + this.tokens.matches1AtIndex(i, tt.bracketL) + ) { + depth++; + } else if ( + this.tokens.matches1AtIndex(i, tt.braceR) || + this.tokens.matches1AtIndex(i, tt.bracketR) + ) { + depth--; + } else if (depth === 0 && !this.tokens.matches1AtIndex(i, tt.name)) { + break; + } else if (this.tokens.matches1AtIndex(1, tt.eq)) { + const endIndex = this.tokens.currentToken().rhsEndIndex; + if (endIndex == null) { + throw new Error("Expected = token with an end index."); + } + i = endIndex - 1; + } else { + const token = this.tokens.tokens[i]; + if (isDeclaration(token)) { + const exportName = this.tokens.identifierNameAtIndex(i); + this.identifierReplacements.set(exportName, `exports.${exportName}`); + } + } + } + } + + /** + * Walk this export statement just in case it's an export...from statement. + * If it is, combine it into the import info for that path. Otherwise, just + * bail out; it'll be handled later. + */ + preprocessNamedExportAtIndex(index) { + // export { + index += 2; + const {newIndex, namedImports} = this.getNamedImports(index); + index = newIndex; + + if (this.tokens.matchesContextualAtIndex(index, ContextualKeyword._from)) { + index++; + } else { + // Reinterpret "a as b" to be local/exported rather than imported/local. + for (const {importedName: localName, localName: exportedName} of namedImports) { + this.addExportBinding(localName, exportedName); + } + return; + } + + if (!this.tokens.matches1AtIndex(index, tt.string)) { + throw new Error("Expected string token at the end of import statement."); + } + const path = this.tokens.stringValueAtIndex(index); + const importInfo = this.getImportInfo(path); + importInfo.namedExports.push(...namedImports); + } + + preprocessExportStarAtIndex(index) { + let exportedName = null; + if (this.tokens.matches3AtIndex(index, tt._export, tt.star, tt._as)) { + // export * as + index += 3; + exportedName = this.tokens.identifierNameAtIndex(index); + // foo from + index += 2; + } else { + // export * from + index += 3; + } + if (!this.tokens.matches1AtIndex(index, tt.string)) { + throw new Error("Expected string token at the end of star export statement."); + } + const path = this.tokens.stringValueAtIndex(index); + const importInfo = this.getImportInfo(path); + if (exportedName !== null) { + importInfo.exportStarNames.push(exportedName); + } else { + importInfo.hasStarExport = true; + } + } + + getNamedImports(index) { + const namedImports = []; + while (true) { + if (this.tokens.matches1AtIndex(index, tt.braceR)) { + index++; + break; + } + + const specifierInfo = getImportExportSpecifierInfo(this.tokens, index); + index = specifierInfo.endIndex; + if (!specifierInfo.isType) { + namedImports.push({ + importedName: specifierInfo.leftName, + localName: specifierInfo.rightName, + }); + } + + if (this.tokens.matches2AtIndex(index, tt.comma, tt.braceR)) { + index += 2; + break; + } else if (this.tokens.matches1AtIndex(index, tt.braceR)) { + index++; + break; + } else if (this.tokens.matches1AtIndex(index, tt.comma)) { + index++; + } else { + throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[index])}`); + } + } + return {newIndex: index, namedImports}; + } + + /** + * Get a mutable import info object for this path, creating one if it doesn't + * exist yet. + */ + getImportInfo(path) { + const existingInfo = this.importInfoByPath.get(path); + if (existingInfo) { + return existingInfo; + } + const newInfo = { + defaultNames: [], + wildcardNames: [], + namedImports: [], + namedExports: [], + hasBareImport: false, + exportStarNames: [], + hasStarExport: false, + }; + this.importInfoByPath.set(path, newInfo); + return newInfo; + } + + addExportBinding(localName, exportedName) { + if (!this.exportBindingsByLocalName.has(localName)) { + this.exportBindingsByLocalName.set(localName, []); + } + this.exportBindingsByLocalName.get(localName).push(exportedName); + } + + /** + * Return the code to use for the import for this path, or the empty string if + * the code has already been "claimed" by a previous import. + */ + claimImportCode(importPath) { + const result = this.importsToReplace.get(importPath); + this.importsToReplace.set(importPath, ""); + return result || ""; + } + + getIdentifierReplacement(identifierName) { + return this.identifierReplacements.get(identifierName) || null; + } + + /** + * Return a string like `exports.foo = exports.bar`. + */ + resolveExportBinding(assignedName) { + const exportedNames = this.exportBindingsByLocalName.get(assignedName); + if (!exportedNames || exportedNames.length === 0) { + return null; + } + return exportedNames.map((exportedName) => `exports.${exportedName}`).join(" = "); + } + + /** + * Return all imported/exported names where we might be interested in whether usages of those + * names are shadowed. + */ + getGlobalNames() { + return new Set([ + ...this.identifierReplacements.keys(), + ...this.exportBindingsByLocalName.keys(), + ]); + } +} diff --git a/node_modules/sucrase/dist/esm/HelperManager.js b/node_modules/sucrase/dist/esm/HelperManager.js new file mode 100644 index 00000000..7964db39 --- /dev/null +++ b/node_modules/sucrase/dist/esm/HelperManager.js @@ -0,0 +1,176 @@ + + +const HELPERS = { + require: ` + import {createRequire as CREATE_REQUIRE_NAME} from "module"; + const require = CREATE_REQUIRE_NAME(import.meta.url); + `, + interopRequireWildcard: ` + function interopRequireWildcard(obj) { + if (obj && obj.__esModule) { + return obj; + } else { + var newObj = {}; + if (obj != null) { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + newObj[key] = obj[key]; + } + } + } + newObj.default = obj; + return newObj; + } + } + `, + interopRequireDefault: ` + function interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + `, + createNamedExportFrom: ` + function createNamedExportFrom(obj, localName, importedName) { + Object.defineProperty(exports, localName, {enumerable: true, configurable: true, get: () => obj[importedName]}); + } + `, + // Note that TypeScript and Babel do this differently; TypeScript does a simple existence + // check in the exports object and does a plain assignment, whereas Babel uses + // defineProperty and builds an object of explicitly-exported names so that star exports can + // always take lower precedence. For now, we do the easier TypeScript thing. + createStarExport: ` + function createStarExport(obj) { + Object.keys(obj) + .filter((key) => key !== "default" && key !== "__esModule") + .forEach((key) => { + if (exports.hasOwnProperty(key)) { + return; + } + Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); + }); + } + `, + nullishCoalesce: ` + function nullishCoalesce(lhs, rhsFn) { + if (lhs != null) { + return lhs; + } else { + return rhsFn(); + } + } + `, + asyncNullishCoalesce: ` + async function asyncNullishCoalesce(lhs, rhsFn) { + if (lhs != null) { + return lhs; + } else { + return await rhsFn(); + } + } + `, + optionalChain: ` + function optionalChain(ops) { + let lastAccessLHS = undefined; + let value = ops[0]; + let i = 1; + while (i < ops.length) { + const op = ops[i]; + const fn = ops[i + 1]; + i += 2; + if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { + return undefined; + } + if (op === 'access' || op === 'optionalAccess') { + lastAccessLHS = value; + value = fn(value); + } else if (op === 'call' || op === 'optionalCall') { + value = fn((...args) => value.call(lastAccessLHS, ...args)); + lastAccessLHS = undefined; + } + } + return value; + } + `, + asyncOptionalChain: ` + async function asyncOptionalChain(ops) { + let lastAccessLHS = undefined; + let value = ops[0]; + let i = 1; + while (i < ops.length) { + const op = ops[i]; + const fn = ops[i + 1]; + i += 2; + if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { + return undefined; + } + if (op === 'access' || op === 'optionalAccess') { + lastAccessLHS = value; + value = await fn(value); + } else if (op === 'call' || op === 'optionalCall') { + value = await fn((...args) => value.call(lastAccessLHS, ...args)); + lastAccessLHS = undefined; + } + } + return value; + } + `, + optionalChainDelete: ` + function optionalChainDelete(ops) { + const result = OPTIONAL_CHAIN_NAME(ops); + return result == null ? true : result; + } + `, + asyncOptionalChainDelete: ` + async function asyncOptionalChainDelete(ops) { + const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops); + return result == null ? true : result; + } + `, +}; + +export class HelperManager { + __init() {this.helperNames = {}} + __init2() {this.createRequireName = null} + constructor( nameManager) {;this.nameManager = nameManager;HelperManager.prototype.__init.call(this);HelperManager.prototype.__init2.call(this);} + + getHelperName(baseName) { + let helperName = this.helperNames[baseName]; + if (helperName) { + return helperName; + } + helperName = this.nameManager.claimFreeName(`_${baseName}`); + this.helperNames[baseName] = helperName; + return helperName; + } + + emitHelpers() { + let resultCode = ""; + if (this.helperNames.optionalChainDelete) { + this.getHelperName("optionalChain"); + } + if (this.helperNames.asyncOptionalChainDelete) { + this.getHelperName("asyncOptionalChain"); + } + for (const [baseName, helperCodeTemplate] of Object.entries(HELPERS)) { + const helperName = this.helperNames[baseName]; + let helperCode = helperCodeTemplate; + if (baseName === "optionalChainDelete") { + helperCode = helperCode.replace("OPTIONAL_CHAIN_NAME", this.helperNames.optionalChain); + } else if (baseName === "asyncOptionalChainDelete") { + helperCode = helperCode.replace( + "ASYNC_OPTIONAL_CHAIN_NAME", + this.helperNames.asyncOptionalChain, + ); + } else if (baseName === "require") { + if (this.createRequireName === null) { + this.createRequireName = this.nameManager.claimFreeName("_createRequire"); + } + helperCode = helperCode.replace(/CREATE_REQUIRE_NAME/g, this.createRequireName); + } + if (helperName) { + resultCode += " "; + resultCode += helperCode.replace(baseName, helperName).replace(/\s+/g, " ").trim(); + } + } + return resultCode; + } +} diff --git a/node_modules/sucrase/dist/esm/NameManager.js b/node_modules/sucrase/dist/esm/NameManager.js new file mode 100644 index 00000000..47d2c9f7 --- /dev/null +++ b/node_modules/sucrase/dist/esm/NameManager.js @@ -0,0 +1,27 @@ + +import getIdentifierNames from "./util/getIdentifierNames"; + +export default class NameManager { + __init() {this.usedNames = new Set()} + + constructor(code, tokens) {;NameManager.prototype.__init.call(this); + this.usedNames = new Set(getIdentifierNames(code, tokens)); + } + + claimFreeName(name) { + const newName = this.findFreeName(name); + this.usedNames.add(newName); + return newName; + } + + findFreeName(name) { + if (!this.usedNames.has(name)) { + return name; + } + let suffixNum = 2; + while (this.usedNames.has(name + String(suffixNum))) { + suffixNum++; + } + return name + String(suffixNum); + } +} diff --git a/node_modules/sucrase/dist/esm/Options-gen-types.js b/node_modules/sucrase/dist/esm/Options-gen-types.js new file mode 100644 index 00000000..5c39c2cc --- /dev/null +++ b/node_modules/sucrase/dist/esm/Options-gen-types.js @@ -0,0 +1,42 @@ +/** + * This module was automatically generated by `ts-interface-builder` + */ +import * as t from "ts-interface-checker"; +// tslint:disable:object-literal-key-quotes + +export const Transform = t.union( + t.lit("jsx"), + t.lit("typescript"), + t.lit("flow"), + t.lit("imports"), + t.lit("react-hot-loader"), + t.lit("jest"), +); + +export const SourceMapOptions = t.iface([], { + compiledFilename: "string", +}); + +export const Options = t.iface([], { + transforms: t.array("Transform"), + disableESTransforms: t.opt("boolean"), + jsxRuntime: t.opt(t.union(t.lit("classic"), t.lit("automatic"), t.lit("preserve"))), + production: t.opt("boolean"), + jsxImportSource: t.opt("string"), + jsxPragma: t.opt("string"), + jsxFragmentPragma: t.opt("string"), + keepUnusedImports: t.opt("boolean"), + preserveDynamicImport: t.opt("boolean"), + injectCreateRequireForImportRequire: t.opt("boolean"), + enableLegacyTypeScriptModuleInterop: t.opt("boolean"), + enableLegacyBabel5ModuleInterop: t.opt("boolean"), + sourceMapOptions: t.opt("SourceMapOptions"), + filePath: t.opt("string"), +}); + +const exportedTypeSuite = { + Transform, + SourceMapOptions, + Options, +}; +export default exportedTypeSuite; diff --git a/node_modules/sucrase/dist/esm/Options.js b/node_modules/sucrase/dist/esm/Options.js new file mode 100644 index 00000000..83ee83d9 --- /dev/null +++ b/node_modules/sucrase/dist/esm/Options.js @@ -0,0 +1,101 @@ +import {createCheckers} from "ts-interface-checker"; + +import OptionsGenTypes from "./Options-gen-types"; + +const {Options: OptionsChecker} = createCheckers(OptionsGenTypes); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +export function validateOptions(options) { + OptionsChecker.strictCheck(options); +} diff --git a/node_modules/sucrase/dist/esm/TokenProcessor.js b/node_modules/sucrase/dist/esm/TokenProcessor.js new file mode 100644 index 00000000..5335f233 --- /dev/null +++ b/node_modules/sucrase/dist/esm/TokenProcessor.js @@ -0,0 +1,357 @@ + + + +import { TokenType as tt} from "./parser/tokenizer/types"; +import isAsyncOperation from "./util/isAsyncOperation"; + + + + + + + + + + + +export default class TokenProcessor { + __init() {this.resultCode = ""} + // Array mapping input token index to optional string index position in the + // output code. + __init2() {this.resultMappings = new Array(this.tokens.length)} + __init3() {this.tokenIndex = 0} + + constructor( + code, + tokens, + isFlowEnabled, + disableESTransforms, + helperManager, + ) {;this.code = code;this.tokens = tokens;this.isFlowEnabled = isFlowEnabled;this.disableESTransforms = disableESTransforms;this.helperManager = helperManager;TokenProcessor.prototype.__init.call(this);TokenProcessor.prototype.__init2.call(this);TokenProcessor.prototype.__init3.call(this);} + + /** + * Snapshot the token state in a way that can be restored later, useful for + * things like lookahead. + * + * resultMappings do not need to be copied since in all use cases, they will + * be overwritten anyway after restore. + */ + snapshot() { + return { + resultCode: this.resultCode, + tokenIndex: this.tokenIndex, + }; + } + + restoreToSnapshot(snapshot) { + this.resultCode = snapshot.resultCode; + this.tokenIndex = snapshot.tokenIndex; + } + + /** + * Remove and return the code generated since the snapshot, leaving the + * current token position in-place. Unlike most TokenProcessor operations, + * this operation can result in input/output line number mismatches because + * the removed code may contain newlines, so this operation should be used + * sparingly. + */ + dangerouslyGetAndRemoveCodeSinceSnapshot(snapshot) { + const result = this.resultCode.slice(snapshot.resultCode.length); + this.resultCode = snapshot.resultCode; + return result; + } + + reset() { + this.resultCode = ""; + this.resultMappings = new Array(this.tokens.length); + this.tokenIndex = 0; + } + + matchesContextualAtIndex(index, contextualKeyword) { + return ( + this.matches1AtIndex(index, tt.name) && + this.tokens[index].contextualKeyword === contextualKeyword + ); + } + + identifierNameAtIndex(index) { + // TODO: We need to process escapes since technically you can have unicode escapes in variable + // names. + return this.identifierNameForToken(this.tokens[index]); + } + + identifierNameAtRelativeIndex(relativeIndex) { + return this.identifierNameForToken(this.tokenAtRelativeIndex(relativeIndex)); + } + + identifierName() { + return this.identifierNameForToken(this.currentToken()); + } + + identifierNameForToken(token) { + return this.code.slice(token.start, token.end); + } + + rawCodeForToken(token) { + return this.code.slice(token.start, token.end); + } + + stringValueAtIndex(index) { + return this.stringValueForToken(this.tokens[index]); + } + + stringValue() { + return this.stringValueForToken(this.currentToken()); + } + + stringValueForToken(token) { + // This is used to identify when two imports are the same and to resolve TypeScript enum keys. + // Ideally we'd process escapes within the strings, but for now we pretty much take the raw + // code. + return this.code.slice(token.start + 1, token.end - 1); + } + + matches1AtIndex(index, t1) { + return this.tokens[index].type === t1; + } + + matches2AtIndex(index, t1, t2) { + return this.tokens[index].type === t1 && this.tokens[index + 1].type === t2; + } + + matches3AtIndex(index, t1, t2, t3) { + return ( + this.tokens[index].type === t1 && + this.tokens[index + 1].type === t2 && + this.tokens[index + 2].type === t3 + ); + } + + matches1(t1) { + return this.tokens[this.tokenIndex].type === t1; + } + + matches2(t1, t2) { + return this.tokens[this.tokenIndex].type === t1 && this.tokens[this.tokenIndex + 1].type === t2; + } + + matches3(t1, t2, t3) { + return ( + this.tokens[this.tokenIndex].type === t1 && + this.tokens[this.tokenIndex + 1].type === t2 && + this.tokens[this.tokenIndex + 2].type === t3 + ); + } + + matches4(t1, t2, t3, t4) { + return ( + this.tokens[this.tokenIndex].type === t1 && + this.tokens[this.tokenIndex + 1].type === t2 && + this.tokens[this.tokenIndex + 2].type === t3 && + this.tokens[this.tokenIndex + 3].type === t4 + ); + } + + matches5(t1, t2, t3, t4, t5) { + return ( + this.tokens[this.tokenIndex].type === t1 && + this.tokens[this.tokenIndex + 1].type === t2 && + this.tokens[this.tokenIndex + 2].type === t3 && + this.tokens[this.tokenIndex + 3].type === t4 && + this.tokens[this.tokenIndex + 4].type === t5 + ); + } + + matchesContextual(contextualKeyword) { + return this.matchesContextualAtIndex(this.tokenIndex, contextualKeyword); + } + + matchesContextIdAndLabel(type, contextId) { + return this.matches1(type) && this.currentToken().contextId === contextId; + } + + previousWhitespaceAndComments() { + let whitespaceAndComments = this.code.slice( + this.tokenIndex > 0 ? this.tokens[this.tokenIndex - 1].end : 0, + this.tokenIndex < this.tokens.length ? this.tokens[this.tokenIndex].start : this.code.length, + ); + if (this.isFlowEnabled) { + whitespaceAndComments = whitespaceAndComments.replace(/@flow/g, ""); + } + return whitespaceAndComments; + } + + replaceToken(newCode) { + this.resultCode += this.previousWhitespaceAndComments(); + this.appendTokenPrefix(); + this.resultMappings[this.tokenIndex] = this.resultCode.length; + this.resultCode += newCode; + this.appendTokenSuffix(); + this.tokenIndex++; + } + + replaceTokenTrimmingLeftWhitespace(newCode) { + this.resultCode += this.previousWhitespaceAndComments().replace(/[^\r\n]/g, ""); + this.appendTokenPrefix(); + this.resultMappings[this.tokenIndex] = this.resultCode.length; + this.resultCode += newCode; + this.appendTokenSuffix(); + this.tokenIndex++; + } + + removeInitialToken() { + this.replaceToken(""); + } + + removeToken() { + this.replaceTokenTrimmingLeftWhitespace(""); + } + + /** + * Remove all code until the next }, accounting for balanced braces. + */ + removeBalancedCode() { + let braceDepth = 0; + while (!this.isAtEnd()) { + if (this.matches1(tt.braceL)) { + braceDepth++; + } else if (this.matches1(tt.braceR)) { + if (braceDepth === 0) { + return; + } + braceDepth--; + } + this.removeToken(); + } + } + + copyExpectedToken(tokenType) { + if (this.tokens[this.tokenIndex].type !== tokenType) { + throw new Error(`Expected token ${tokenType}`); + } + this.copyToken(); + } + + copyToken() { + this.resultCode += this.previousWhitespaceAndComments(); + this.appendTokenPrefix(); + this.resultMappings[this.tokenIndex] = this.resultCode.length; + this.resultCode += this.code.slice( + this.tokens[this.tokenIndex].start, + this.tokens[this.tokenIndex].end, + ); + this.appendTokenSuffix(); + this.tokenIndex++; + } + + copyTokenWithPrefix(prefix) { + this.resultCode += this.previousWhitespaceAndComments(); + this.appendTokenPrefix(); + this.resultCode += prefix; + this.resultMappings[this.tokenIndex] = this.resultCode.length; + this.resultCode += this.code.slice( + this.tokens[this.tokenIndex].start, + this.tokens[this.tokenIndex].end, + ); + this.appendTokenSuffix(); + this.tokenIndex++; + } + + appendTokenPrefix() { + const token = this.currentToken(); + if (token.numNullishCoalesceStarts || token.isOptionalChainStart) { + token.isAsyncOperation = isAsyncOperation(this); + } + if (this.disableESTransforms) { + return; + } + if (token.numNullishCoalesceStarts) { + for (let i = 0; i < token.numNullishCoalesceStarts; i++) { + if (token.isAsyncOperation) { + this.resultCode += "await "; + this.resultCode += this.helperManager.getHelperName("asyncNullishCoalesce"); + } else { + this.resultCode += this.helperManager.getHelperName("nullishCoalesce"); + } + this.resultCode += "("; + } + } + if (token.isOptionalChainStart) { + if (token.isAsyncOperation) { + this.resultCode += "await "; + } + if (this.tokenIndex > 0 && this.tokenAtRelativeIndex(-1).type === tt._delete) { + if (token.isAsyncOperation) { + this.resultCode += this.helperManager.getHelperName("asyncOptionalChainDelete"); + } else { + this.resultCode += this.helperManager.getHelperName("optionalChainDelete"); + } + } else if (token.isAsyncOperation) { + this.resultCode += this.helperManager.getHelperName("asyncOptionalChain"); + } else { + this.resultCode += this.helperManager.getHelperName("optionalChain"); + } + this.resultCode += "(["; + } + } + + appendTokenSuffix() { + const token = this.currentToken(); + if (token.isOptionalChainEnd && !this.disableESTransforms) { + this.resultCode += "])"; + } + if (token.numNullishCoalesceEnds && !this.disableESTransforms) { + for (let i = 0; i < token.numNullishCoalesceEnds; i++) { + this.resultCode += "))"; + } + } + } + + appendCode(code) { + this.resultCode += code; + } + + currentToken() { + return this.tokens[this.tokenIndex]; + } + + currentTokenCode() { + const token = this.currentToken(); + return this.code.slice(token.start, token.end); + } + + tokenAtRelativeIndex(relativeIndex) { + return this.tokens[this.tokenIndex + relativeIndex]; + } + + currentIndex() { + return this.tokenIndex; + } + + /** + * Move to the next token. Only suitable in preprocessing steps. When + * generating new code, you should use copyToken or removeToken. + */ + nextToken() { + if (this.tokenIndex === this.tokens.length) { + throw new Error("Unexpectedly reached end of input."); + } + this.tokenIndex++; + } + + previousToken() { + this.tokenIndex--; + } + + finish() { + if (this.tokenIndex !== this.tokens.length) { + throw new Error("Tried to finish processing tokens before reaching the end."); + } + this.resultCode += this.previousWhitespaceAndComments(); + return {code: this.resultCode, mappings: this.resultMappings}; + } + + isAtEnd() { + return this.tokenIndex === this.tokens.length; + } +} diff --git a/node_modules/sucrase/dist/esm/cli.js b/node_modules/sucrase/dist/esm/cli.js new file mode 100644 index 00000000..2fb9dd33 --- /dev/null +++ b/node_modules/sucrase/dist/esm/cli.js @@ -0,0 +1,317 @@ +/* eslint-disable no-console */ +import commander from "commander"; +import {glob} from "glob"; +import {exists, mkdir, readdir, readFile, stat, writeFile} from "mz/fs"; +import {dirname, join, relative} from "path"; + +import { transform} from "./index"; + + + + + + + + + + + +export default function run() { + commander + .description(`Sucrase: super-fast Babel alternative.`) + .usage("[options] ") + .option( + "-d, --out-dir ", + "Compile an input directory of modules into an output directory.", + ) + .option( + "-p, --project ", + "Compile a TypeScript project, will read from tsconfig.json in ", + ) + .option("--out-extension ", "File extension to use for all output files.", "js") + .option("--exclude-dirs ", "Names of directories that should not be traversed.") + .option("-q, --quiet", "Don't print the names of converted files.") + .option("-t, --transforms ", "Comma-separated list of transforms to run.") + .option("--disable-es-transforms", "Opt out of all ES syntax transforms.") + .option("--jsx-runtime ", "Transformation mode for the JSX transform.") + .option("--production", "Disable debugging information from JSX in output.") + .option( + "--jsx-import-source ", + "Automatic JSX transform import path prefix, defaults to `React.Fragment`.", + ) + .option( + "--jsx-pragma ", + "Classic JSX transform element creation function, defaults to `React.createElement`.", + ) + .option( + "--jsx-fragment-pragma ", + "Classic JSX transform fragment component, defaults to `React.Fragment`.", + ) + .option("--keep-unused-imports", "Disable automatic removal of type-only imports/exports.") + .option("--preserve-dynamic-import", "Don't transpile dynamic import() to require.") + .option( + "--inject-create-require-for-import-require", + "Use `createRequire` when transpiling TS `import = require` to ESM.", + ) + .option( + "--enable-legacy-typescript-module-interop", + "Use default TypeScript ESM/CJS interop strategy.", + ) + .option("--enable-legacy-babel5-module-interop", "Use Babel 5 ESM/CJS interop strategy.") + .parse(process.argv); + + if (commander.project) { + if ( + commander.outDir || + commander.transforms || + commander.args[0] || + commander.enableLegacyTypescriptModuleInterop + ) { + console.error( + "If TypeScript project is specified, out directory, transforms, source " + + "directory, and --enable-legacy-typescript-module-interop may not be specified.", + ); + process.exit(1); + } + } else { + if (!commander.outDir) { + console.error("Out directory is required"); + process.exit(1); + } + + if (!commander.transforms) { + console.error("Transforms option is required."); + process.exit(1); + } + + if (!commander.args[0]) { + console.error("Source directory is required."); + process.exit(1); + } + } + + const options = { + outDirPath: commander.outDir, + srcDirPath: commander.args[0], + project: commander.project, + outExtension: commander.outExtension, + excludeDirs: commander.excludeDirs ? commander.excludeDirs.split(",") : [], + quiet: commander.quiet, + sucraseOptions: { + transforms: commander.transforms ? commander.transforms.split(",") : [], + disableESTransforms: commander.disableEsTransforms, + jsxRuntime: commander.jsxRuntime, + production: commander.production, + jsxImportSource: commander.jsxImportSource, + jsxPragma: commander.jsxPragma || "React.createElement", + jsxFragmentPragma: commander.jsxFragmentPragma || "React.Fragment", + keepUnusedImports: commander.keepUnusedImports, + preserveDynamicImport: commander.preserveDynamicImport, + injectCreateRequireForImportRequire: commander.injectCreateRequireForImportRequire, + enableLegacyTypeScriptModuleInterop: commander.enableLegacyTypescriptModuleInterop, + enableLegacyBabel5ModuleInterop: commander.enableLegacyBabel5ModuleInterop, + }, + }; + + buildDirectory(options).catch((e) => { + process.exitCode = 1; + console.error(e); + }); +} + + + + + + +async function findFiles(options) { + const outDirPath = options.outDirPath; + const srcDirPath = options.srcDirPath; + + const extensions = options.sucraseOptions.transforms.includes("typescript") + ? [".ts", ".tsx"] + : [".js", ".jsx"]; + + if (!(await exists(outDirPath))) { + await mkdir(outDirPath); + } + + const outArr = []; + for (const child of await readdir(srcDirPath)) { + if (["node_modules", ".git"].includes(child) || options.excludeDirs.includes(child)) { + continue; + } + const srcChildPath = join(srcDirPath, child); + const outChildPath = join(outDirPath, child); + if ((await stat(srcChildPath)).isDirectory()) { + const innerOptions = {...options}; + innerOptions.srcDirPath = srcChildPath; + innerOptions.outDirPath = outChildPath; + const innerFiles = await findFiles(innerOptions); + outArr.push(...innerFiles); + } else if (extensions.some((ext) => srcChildPath.endsWith(ext))) { + const outPath = outChildPath.replace(/\.\w+$/, `.${options.outExtension}`); + outArr.push({ + srcPath: srcChildPath, + outPath, + }); + } + } + + return outArr; +} + +async function runGlob(options) { + const tsConfigPath = join(options.project, "tsconfig.json"); + + let str; + try { + str = await readFile(tsConfigPath, "utf8"); + } catch (err) { + console.error("Could not find project tsconfig.json"); + console.error(` --project=${options.project}`); + console.error(err); + process.exit(1); + } + const json = JSON.parse(str); + + const foundFiles = []; + + const files = json.files; + const include = json.include; + + const absProject = join(process.cwd(), options.project); + const outDirs = []; + + if (!(await exists(options.outDirPath))) { + await mkdir(options.outDirPath); + } + + if (files) { + for (const file of files) { + if (file.endsWith(".d.ts")) { + continue; + } + if (!file.endsWith(".ts") && !file.endsWith(".js")) { + continue; + } + + const srcFile = join(absProject, file); + const outFile = join(options.outDirPath, file); + const outPath = outFile.replace(/\.\w+$/, `.${options.outExtension}`); + + const outDir = dirname(outPath); + if (!outDirs.includes(outDir)) { + outDirs.push(outDir); + } + + foundFiles.push({ + srcPath: srcFile, + outPath, + }); + } + } + if (include) { + for (const pattern of include) { + const globFiles = await glob(join(absProject, pattern)); + for (const file of globFiles) { + if (!file.endsWith(".ts") && !file.endsWith(".js")) { + continue; + } + if (file.endsWith(".d.ts")) { + continue; + } + + const relativeFile = relative(absProject, file); + const outFile = join(options.outDirPath, relativeFile); + const outPath = outFile.replace(/\.\w+$/, `.${options.outExtension}`); + + const outDir = dirname(outPath); + if (!outDirs.includes(outDir)) { + outDirs.push(outDir); + } + + foundFiles.push({ + srcPath: file, + outPath, + }); + } + } + } + + for (const outDirPath of outDirs) { + if (!(await exists(outDirPath))) { + await mkdir(outDirPath); + } + } + + // TODO: read exclude + + return foundFiles; +} + +async function updateOptionsFromProject(options) { + /** + * Read the project information and assign the following. + * - outDirPath + * - transform: imports + * - transform: typescript + * - enableLegacyTypescriptModuleInterop: true/false. + */ + + const tsConfigPath = join(options.project, "tsconfig.json"); + + let str; + try { + str = await readFile(tsConfigPath, "utf8"); + } catch (err) { + console.error("Could not find project tsconfig.json"); + console.error(` --project=${options.project}`); + console.error(err); + process.exit(1); + } + const json = JSON.parse(str); + const sucraseOpts = options.sucraseOptions; + if (!sucraseOpts.transforms.includes("typescript")) { + sucraseOpts.transforms.push("typescript"); + } + + const compilerOpts = json.compilerOptions; + if (compilerOpts.outDir) { + options.outDirPath = join(process.cwd(), options.project, compilerOpts.outDir); + } + if (compilerOpts.esModuleInterop !== true) { + sucraseOpts.enableLegacyTypeScriptModuleInterop = true; + } + if (compilerOpts.module === "commonjs") { + if (!sucraseOpts.transforms.includes("imports")) { + sucraseOpts.transforms.push("imports"); + } + } +} + +async function buildDirectory(options) { + let files; + if (options.outDirPath && options.srcDirPath) { + files = await findFiles(options); + } else if (options.project) { + await updateOptionsFromProject(options); + files = await runGlob(options); + } else { + console.error("Project or Source directory required."); + process.exit(1); + } + + for (const file of files) { + await buildFile(file.srcPath, file.outPath, options); + } +} + +async function buildFile(srcPath, outPath, options) { + if (!options.quiet) { + console.log(`${srcPath} -> ${outPath}`); + } + const code = (await readFile(srcPath)).toString(); + const transformedCode = transform(code, {...options.sucraseOptions, filePath: srcPath}).code; + await writeFile(outPath, transformedCode); +} diff --git a/node_modules/sucrase/dist/esm/computeSourceMap.js b/node_modules/sucrase/dist/esm/computeSourceMap.js new file mode 100644 index 00000000..699ea783 --- /dev/null +++ b/node_modules/sucrase/dist/esm/computeSourceMap.js @@ -0,0 +1,89 @@ +import {GenMapping, maybeAddSegment, toEncodedMap} from "@jridgewell/gen-mapping"; + + + +import {charCodes} from "./parser/util/charcodes"; + + + + + + + + + + + + +/** + * Generate a source map indicating that each line maps directly to the original line, + * with the tokens in their new positions. + */ +export default function computeSourceMap( + {code: generatedCode, mappings: rawMappings}, + filePath, + options, + source, + tokens, +) { + const sourceColumns = computeSourceColumns(source, tokens); + const map = new GenMapping({file: options.compiledFilename}); + let tokenIndex = 0; + // currentMapping is the output source index for the current input token being + // considered. + let currentMapping = rawMappings[0]; + while (currentMapping === undefined && tokenIndex < rawMappings.length - 1) { + tokenIndex++; + currentMapping = rawMappings[tokenIndex]; + } + let line = 0; + let lineStart = 0; + if (currentMapping !== lineStart) { + maybeAddSegment(map, line, 0, filePath, line, 0); + } + for (let i = 0; i < generatedCode.length; i++) { + if (i === currentMapping) { + const genColumn = currentMapping - lineStart; + const sourceColumn = sourceColumns[tokenIndex]; + maybeAddSegment(map, line, genColumn, filePath, line, sourceColumn); + while ( + (currentMapping === i || currentMapping === undefined) && + tokenIndex < rawMappings.length - 1 + ) { + tokenIndex++; + currentMapping = rawMappings[tokenIndex]; + } + } + if (generatedCode.charCodeAt(i) === charCodes.lineFeed) { + line++; + lineStart = i + 1; + if (currentMapping !== lineStart) { + maybeAddSegment(map, line, 0, filePath, line, 0); + } + } + } + const {sourceRoot, sourcesContent, ...sourceMap} = toEncodedMap(map); + return sourceMap ; +} + +/** + * Create an array mapping each token index to the 0-based column of the start + * position of the token. + */ +function computeSourceColumns(code, tokens) { + const sourceColumns = new Array(tokens.length); + let tokenIndex = 0; + let currentMapping = tokens[tokenIndex].start; + let lineStart = 0; + for (let i = 0; i < code.length; i++) { + if (i === currentMapping) { + sourceColumns[tokenIndex] = currentMapping - lineStart; + tokenIndex++; + currentMapping = tokens[tokenIndex].start; + } + if (code.charCodeAt(i) === charCodes.lineFeed) { + lineStart = i + 1; + } + } + return sourceColumns; +} diff --git a/node_modules/sucrase/dist/esm/identifyShadowedGlobals.js b/node_modules/sucrase/dist/esm/identifyShadowedGlobals.js new file mode 100644 index 00000000..f9536335 --- /dev/null +++ b/node_modules/sucrase/dist/esm/identifyShadowedGlobals.js @@ -0,0 +1,98 @@ +import { + isBlockScopedDeclaration, + isFunctionScopedDeclaration, + isNonTopLevelDeclaration, +} from "./parser/tokenizer"; + +import {TokenType as tt} from "./parser/tokenizer/types"; + + +/** + * Traverse the given tokens and modify them if necessary to indicate that some names shadow global + * variables. + */ +export default function identifyShadowedGlobals( + tokens, + scopes, + globalNames, +) { + if (!hasShadowedGlobals(tokens, globalNames)) { + return; + } + markShadowedGlobals(tokens, scopes, globalNames); +} + +/** + * We can do a fast up-front check to see if there are any declarations to global names. If not, + * then there's no point in computing scope assignments. + */ +// Exported for testing. +export function hasShadowedGlobals(tokens, globalNames) { + for (const token of tokens.tokens) { + if ( + token.type === tt.name && + !token.isType && + isNonTopLevelDeclaration(token) && + globalNames.has(tokens.identifierNameForToken(token)) + ) { + return true; + } + } + return false; +} + +function markShadowedGlobals( + tokens, + scopes, + globalNames, +) { + const scopeStack = []; + let scopeIndex = scopes.length - 1; + // Scopes were generated at completion time, so they're sorted by end index, so we can maintain a + // good stack by going backwards through them. + for (let i = tokens.tokens.length - 1; ; i--) { + while (scopeStack.length > 0 && scopeStack[scopeStack.length - 1].startTokenIndex === i + 1) { + scopeStack.pop(); + } + while (scopeIndex >= 0 && scopes[scopeIndex].endTokenIndex === i + 1) { + scopeStack.push(scopes[scopeIndex]); + scopeIndex--; + } + // Process scopes after the last iteration so we can make sure we pop all of them. + if (i < 0) { + break; + } + + const token = tokens.tokens[i]; + const name = tokens.identifierNameForToken(token); + if (scopeStack.length > 1 && !token.isType && token.type === tt.name && globalNames.has(name)) { + if (isBlockScopedDeclaration(token)) { + markShadowedForScope(scopeStack[scopeStack.length - 1], tokens, name); + } else if (isFunctionScopedDeclaration(token)) { + let stackIndex = scopeStack.length - 1; + while (stackIndex > 0 && !scopeStack[stackIndex].isFunctionScope) { + stackIndex--; + } + if (stackIndex < 0) { + throw new Error("Did not find parent function scope."); + } + markShadowedForScope(scopeStack[stackIndex], tokens, name); + } + } + } + if (scopeStack.length > 0) { + throw new Error("Expected empty scope stack after processing file."); + } +} + +function markShadowedForScope(scope, tokens, name) { + for (let i = scope.startTokenIndex; i < scope.endTokenIndex; i++) { + const token = tokens.tokens[i]; + if ( + (token.type === tt.name || token.type === tt.jsxName) && + tokens.identifierNameForToken(token) === name + ) { + token.shadowsGlobal = true; + } + } +} diff --git a/node_modules/sucrase/dist/esm/index.js b/node_modules/sucrase/dist/esm/index.js new file mode 100644 index 00000000..41a7aa08 --- /dev/null +++ b/node_modules/sucrase/dist/esm/index.js @@ -0,0 +1,133 @@ +import CJSImportProcessor from "./CJSImportProcessor"; +import computeSourceMap, {} from "./computeSourceMap"; +import {HelperManager} from "./HelperManager"; +import identifyShadowedGlobals from "./identifyShadowedGlobals"; +import NameManager from "./NameManager"; +import {validateOptions} from "./Options"; + +import {parse} from "./parser"; + +import TokenProcessor from "./TokenProcessor"; +import RootTransformer from "./transformers/RootTransformer"; +import formatTokens from "./util/formatTokens"; +import getTSImportedNames from "./util/getTSImportedNames"; + + + + + + + + + + + + + + +; + +export function getVersion() { + /* istanbul ignore next */ + return "3.35.0"; +} + +export function transform(code, options) { + validateOptions(options); + try { + const sucraseContext = getSucraseContext(code, options); + const transformer = new RootTransformer( + sucraseContext, + options.transforms, + Boolean(options.enableLegacyBabel5ModuleInterop), + options, + ); + const transformerResult = transformer.transform(); + let result = {code: transformerResult.code}; + if (options.sourceMapOptions) { + if (!options.filePath) { + throw new Error("filePath must be specified when generating a source map."); + } + result = { + ...result, + sourceMap: computeSourceMap( + transformerResult, + options.filePath, + options.sourceMapOptions, + code, + sucraseContext.tokenProcessor.tokens, + ), + }; + } + return result; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (e) { + if (options.filePath) { + e.message = `Error transforming ${options.filePath}: ${e.message}`; + } + throw e; + } +} + +/** + * Return a string representation of the sucrase tokens, mostly useful for + * diagnostic purposes. + */ +export function getFormattedTokens(code, options) { + const tokens = getSucraseContext(code, options).tokenProcessor.tokens; + return formatTokens(code, tokens); +} + +/** + * Call into the parser/tokenizer and do some further preprocessing: + * - Come up with a set of used names so that we can assign new names. + * - Preprocess all import/export statements so we know which globals we are interested in. + * - Compute situations where any of those globals are shadowed. + * + * In the future, some of these preprocessing steps can be skipped based on what actual work is + * being done. + */ +function getSucraseContext(code, options) { + const isJSXEnabled = options.transforms.includes("jsx"); + const isTypeScriptEnabled = options.transforms.includes("typescript"); + const isFlowEnabled = options.transforms.includes("flow"); + const disableESTransforms = options.disableESTransforms === true; + const file = parse(code, isJSXEnabled, isTypeScriptEnabled, isFlowEnabled); + const tokens = file.tokens; + const scopes = file.scopes; + + const nameManager = new NameManager(code, tokens); + const helperManager = new HelperManager(nameManager); + const tokenProcessor = new TokenProcessor( + code, + tokens, + isFlowEnabled, + disableESTransforms, + helperManager, + ); + const enableLegacyTypeScriptModuleInterop = Boolean(options.enableLegacyTypeScriptModuleInterop); + + let importProcessor = null; + if (options.transforms.includes("imports")) { + importProcessor = new CJSImportProcessor( + nameManager, + tokenProcessor, + enableLegacyTypeScriptModuleInterop, + options, + options.transforms.includes("typescript"), + Boolean(options.keepUnusedImports), + helperManager, + ); + importProcessor.preprocessTokens(); + // We need to mark shadowed globals after processing imports so we know that the globals are, + // but before type-only import pruning, since that relies on shadowing information. + identifyShadowedGlobals(tokenProcessor, scopes, importProcessor.getGlobalNames()); + if (options.transforms.includes("typescript") && !options.keepUnusedImports) { + importProcessor.pruneTypeOnlyImports(); + } + } else if (options.transforms.includes("typescript") && !options.keepUnusedImports) { + // Shadowed global detection is needed for TS implicit elision of imported names. + identifyShadowedGlobals(tokenProcessor, scopes, getTSImportedNames(tokenProcessor)); + } + return {tokenProcessor, scopes, nameManager, importProcessor, helperManager}; +} diff --git a/node_modules/sucrase/dist/esm/parser/index.js b/node_modules/sucrase/dist/esm/parser/index.js new file mode 100644 index 00000000..5074ae44 --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/index.js @@ -0,0 +1,31 @@ + + +import {augmentError, initParser, state} from "./traverser/base"; +import {parseFile} from "./traverser/index"; + +export class File { + + + + constructor(tokens, scopes) { + this.tokens = tokens; + this.scopes = scopes; + } +} + +export function parse( + input, + isJSXEnabled, + isTypeScriptEnabled, + isFlowEnabled, +) { + if (isFlowEnabled && isTypeScriptEnabled) { + throw new Error("Cannot combine flow and typescript plugins."); + } + initParser(input, isJSXEnabled, isTypeScriptEnabled, isFlowEnabled); + const result = parseFile(); + if (state.error) { + throw augmentError(state.error); + } + return result; +} diff --git a/node_modules/sucrase/dist/esm/parser/plugins/flow.js b/node_modules/sucrase/dist/esm/parser/plugins/flow.js new file mode 100644 index 00000000..66295d1e --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/plugins/flow.js @@ -0,0 +1,1105 @@ +/* eslint max-len: 0 */ + +import { + eat, + lookaheadType, + lookaheadTypeAndKeyword, + match, + next, + popTypeContext, + pushTypeContext, + +} from "../tokenizer/index"; +import {ContextualKeyword} from "../tokenizer/keywords"; +import {TokenType, TokenType as tt} from "../tokenizer/types"; +import {input, state} from "../traverser/base"; +import { + baseParseMaybeAssign, + baseParseSubscript, + baseParseSubscripts, + parseArrow, + parseArrowExpression, + parseCallExpressionArguments, + parseExprAtom, + parseExpression, + parseFunctionBody, + parseIdentifier, + parseLiteral, + +} from "../traverser/expression"; +import { + baseParseExportStar, + parseExport, + parseExportFrom, + parseExportSpecifiers, + parseFunctionParams, + parseImport, + parseStatement, +} from "../traverser/statement"; +import { + canInsertSemicolon, + eatContextual, + expect, + expectContextual, + isContextual, + isLookaheadContextual, + semicolon, + unexpected, +} from "../traverser/util"; + +function isMaybeDefaultImport(lookahead) { + return ( + (lookahead.type === tt.name || !!(lookahead.type & TokenType.IS_KEYWORD)) && + lookahead.contextualKeyword !== ContextualKeyword._from + ); +} + +function flowParseTypeInitialiser(tok) { + const oldIsType = pushTypeContext(0); + expect(tok || tt.colon); + flowParseType(); + popTypeContext(oldIsType); +} + +function flowParsePredicate() { + expect(tt.modulo); + expectContextual(ContextualKeyword._checks); + if (eat(tt.parenL)) { + parseExpression(); + expect(tt.parenR); + } +} + +function flowParseTypeAndPredicateInitialiser() { + const oldIsType = pushTypeContext(0); + expect(tt.colon); + if (match(tt.modulo)) { + flowParsePredicate(); + } else { + flowParseType(); + if (match(tt.modulo)) { + flowParsePredicate(); + } + } + popTypeContext(oldIsType); +} + +function flowParseDeclareClass() { + next(); + flowParseInterfaceish(/* isClass */ true); +} + +function flowParseDeclareFunction() { + next(); + parseIdentifier(); + + if (match(tt.lessThan)) { + flowParseTypeParameterDeclaration(); + } + + expect(tt.parenL); + flowParseFunctionTypeParams(); + expect(tt.parenR); + + flowParseTypeAndPredicateInitialiser(); + + semicolon(); +} + +function flowParseDeclare() { + if (match(tt._class)) { + flowParseDeclareClass(); + } else if (match(tt._function)) { + flowParseDeclareFunction(); + } else if (match(tt._var)) { + flowParseDeclareVariable(); + } else if (eatContextual(ContextualKeyword._module)) { + if (eat(tt.dot)) { + flowParseDeclareModuleExports(); + } else { + flowParseDeclareModule(); + } + } else if (isContextual(ContextualKeyword._type)) { + flowParseDeclareTypeAlias(); + } else if (isContextual(ContextualKeyword._opaque)) { + flowParseDeclareOpaqueType(); + } else if (isContextual(ContextualKeyword._interface)) { + flowParseDeclareInterface(); + } else if (match(tt._export)) { + flowParseDeclareExportDeclaration(); + } else { + unexpected(); + } +} + +function flowParseDeclareVariable() { + next(); + flowParseTypeAnnotatableIdentifier(); + semicolon(); +} + +function flowParseDeclareModule() { + if (match(tt.string)) { + parseExprAtom(); + } else { + parseIdentifier(); + } + + expect(tt.braceL); + while (!match(tt.braceR) && !state.error) { + if (match(tt._import)) { + next(); + parseImport(); + } else { + unexpected(); + } + } + expect(tt.braceR); +} + +function flowParseDeclareExportDeclaration() { + expect(tt._export); + + if (eat(tt._default)) { + if (match(tt._function) || match(tt._class)) { + // declare export default class ... + // declare export default function ... + flowParseDeclare(); + } else { + // declare export default [type]; + flowParseType(); + semicolon(); + } + } else if ( + match(tt._var) || // declare export var ... + match(tt._function) || // declare export function ... + match(tt._class) || // declare export class ... + isContextual(ContextualKeyword._opaque) // declare export opaque .. + ) { + flowParseDeclare(); + } else if ( + match(tt.star) || // declare export * from '' + match(tt.braceL) || // declare export {} ... + isContextual(ContextualKeyword._interface) || // declare export interface ... + isContextual(ContextualKeyword._type) || // declare export type ... + isContextual(ContextualKeyword._opaque) // declare export opaque type ... + ) { + parseExport(); + } else { + unexpected(); + } +} + +function flowParseDeclareModuleExports() { + expectContextual(ContextualKeyword._exports); + flowParseTypeAnnotation(); + semicolon(); +} + +function flowParseDeclareTypeAlias() { + next(); + flowParseTypeAlias(); +} + +function flowParseDeclareOpaqueType() { + next(); + flowParseOpaqueType(true); +} + +function flowParseDeclareInterface() { + next(); + flowParseInterfaceish(); +} + +// Interfaces + +function flowParseInterfaceish(isClass = false) { + flowParseRestrictedIdentifier(); + + if (match(tt.lessThan)) { + flowParseTypeParameterDeclaration(); + } + + if (eat(tt._extends)) { + do { + flowParseInterfaceExtends(); + } while (!isClass && eat(tt.comma)); + } + + if (isContextual(ContextualKeyword._mixins)) { + next(); + do { + flowParseInterfaceExtends(); + } while (eat(tt.comma)); + } + + if (isContextual(ContextualKeyword._implements)) { + next(); + do { + flowParseInterfaceExtends(); + } while (eat(tt.comma)); + } + + flowParseObjectType(isClass, false, isClass); +} + +function flowParseInterfaceExtends() { + flowParseQualifiedTypeIdentifier(false); + if (match(tt.lessThan)) { + flowParseTypeParameterInstantiation(); + } +} + +function flowParseInterface() { + flowParseInterfaceish(); +} + +function flowParseRestrictedIdentifier() { + parseIdentifier(); +} + +function flowParseTypeAlias() { + flowParseRestrictedIdentifier(); + + if (match(tt.lessThan)) { + flowParseTypeParameterDeclaration(); + } + + flowParseTypeInitialiser(tt.eq); + semicolon(); +} + +function flowParseOpaqueType(declare) { + expectContextual(ContextualKeyword._type); + flowParseRestrictedIdentifier(); + + if (match(tt.lessThan)) { + flowParseTypeParameterDeclaration(); + } + + // Parse the supertype + if (match(tt.colon)) { + flowParseTypeInitialiser(tt.colon); + } + + if (!declare) { + flowParseTypeInitialiser(tt.eq); + } + semicolon(); +} + +function flowParseTypeParameter() { + flowParseVariance(); + flowParseTypeAnnotatableIdentifier(); + + if (eat(tt.eq)) { + flowParseType(); + } +} + +export function flowParseTypeParameterDeclaration() { + const oldIsType = pushTypeContext(0); + // istanbul ignore else: this condition is already checked at all call sites + if (match(tt.lessThan) || match(tt.typeParameterStart)) { + next(); + } else { + unexpected(); + } + + do { + flowParseTypeParameter(); + if (!match(tt.greaterThan)) { + expect(tt.comma); + } + } while (!match(tt.greaterThan) && !state.error); + expect(tt.greaterThan); + popTypeContext(oldIsType); +} + +function flowParseTypeParameterInstantiation() { + const oldIsType = pushTypeContext(0); + expect(tt.lessThan); + while (!match(tt.greaterThan) && !state.error) { + flowParseType(); + if (!match(tt.greaterThan)) { + expect(tt.comma); + } + } + expect(tt.greaterThan); + popTypeContext(oldIsType); +} + +function flowParseInterfaceType() { + expectContextual(ContextualKeyword._interface); + if (eat(tt._extends)) { + do { + flowParseInterfaceExtends(); + } while (eat(tt.comma)); + } + flowParseObjectType(false, false, false); +} + +function flowParseObjectPropertyKey() { + if (match(tt.num) || match(tt.string)) { + parseExprAtom(); + } else { + parseIdentifier(); + } +} + +function flowParseObjectTypeIndexer() { + // Note: bracketL has already been consumed + if (lookaheadType() === tt.colon) { + flowParseObjectPropertyKey(); + flowParseTypeInitialiser(); + } else { + flowParseType(); + } + expect(tt.bracketR); + flowParseTypeInitialiser(); +} + +function flowParseObjectTypeInternalSlot() { + // Note: both bracketL have already been consumed + flowParseObjectPropertyKey(); + expect(tt.bracketR); + expect(tt.bracketR); + if (match(tt.lessThan) || match(tt.parenL)) { + flowParseObjectTypeMethodish(); + } else { + eat(tt.question); + flowParseTypeInitialiser(); + } +} + +function flowParseObjectTypeMethodish() { + if (match(tt.lessThan)) { + flowParseTypeParameterDeclaration(); + } + + expect(tt.parenL); + while (!match(tt.parenR) && !match(tt.ellipsis) && !state.error) { + flowParseFunctionTypeParam(); + if (!match(tt.parenR)) { + expect(tt.comma); + } + } + + if (eat(tt.ellipsis)) { + flowParseFunctionTypeParam(); + } + expect(tt.parenR); + flowParseTypeInitialiser(); +} + +function flowParseObjectTypeCallProperty() { + flowParseObjectTypeMethodish(); +} + +function flowParseObjectType(allowStatic, allowExact, allowProto) { + let endDelim; + if (allowExact && match(tt.braceBarL)) { + expect(tt.braceBarL); + endDelim = tt.braceBarR; + } else { + expect(tt.braceL); + endDelim = tt.braceR; + } + + while (!match(endDelim) && !state.error) { + if (allowProto && isContextual(ContextualKeyword._proto)) { + const lookahead = lookaheadType(); + if (lookahead !== tt.colon && lookahead !== tt.question) { + next(); + allowStatic = false; + } + } + if (allowStatic && isContextual(ContextualKeyword._static)) { + const lookahead = lookaheadType(); + if (lookahead !== tt.colon && lookahead !== tt.question) { + next(); + } + } + + flowParseVariance(); + + if (eat(tt.bracketL)) { + if (eat(tt.bracketL)) { + flowParseObjectTypeInternalSlot(); + } else { + flowParseObjectTypeIndexer(); + } + } else if (match(tt.parenL) || match(tt.lessThan)) { + flowParseObjectTypeCallProperty(); + } else { + if (isContextual(ContextualKeyword._get) || isContextual(ContextualKeyword._set)) { + const lookahead = lookaheadType(); + if (lookahead === tt.name || lookahead === tt.string || lookahead === tt.num) { + next(); + } + } + + flowParseObjectTypeProperty(); + } + + flowObjectTypeSemicolon(); + } + + expect(endDelim); +} + +function flowParseObjectTypeProperty() { + if (match(tt.ellipsis)) { + expect(tt.ellipsis); + if (!eat(tt.comma)) { + eat(tt.semi); + } + // Explicit inexact object syntax. + if (match(tt.braceR)) { + return; + } + flowParseType(); + } else { + flowParseObjectPropertyKey(); + if (match(tt.lessThan) || match(tt.parenL)) { + // This is a method property + flowParseObjectTypeMethodish(); + } else { + eat(tt.question); + flowParseTypeInitialiser(); + } + } +} + +function flowObjectTypeSemicolon() { + if (!eat(tt.semi) && !eat(tt.comma) && !match(tt.braceR) && !match(tt.braceBarR)) { + unexpected(); + } +} + +function flowParseQualifiedTypeIdentifier(initialIdAlreadyParsed) { + if (!initialIdAlreadyParsed) { + parseIdentifier(); + } + while (eat(tt.dot)) { + parseIdentifier(); + } +} + +function flowParseGenericType() { + flowParseQualifiedTypeIdentifier(true); + if (match(tt.lessThan)) { + flowParseTypeParameterInstantiation(); + } +} + +function flowParseTypeofType() { + expect(tt._typeof); + flowParsePrimaryType(); +} + +function flowParseTupleType() { + expect(tt.bracketL); + // We allow trailing commas + while (state.pos < input.length && !match(tt.bracketR)) { + flowParseType(); + if (match(tt.bracketR)) { + break; + } + expect(tt.comma); + } + expect(tt.bracketR); +} + +function flowParseFunctionTypeParam() { + const lookahead = lookaheadType(); + if (lookahead === tt.colon || lookahead === tt.question) { + parseIdentifier(); + eat(tt.question); + flowParseTypeInitialiser(); + } else { + flowParseType(); + } +} + +function flowParseFunctionTypeParams() { + while (!match(tt.parenR) && !match(tt.ellipsis) && !state.error) { + flowParseFunctionTypeParam(); + if (!match(tt.parenR)) { + expect(tt.comma); + } + } + if (eat(tt.ellipsis)) { + flowParseFunctionTypeParam(); + } +} + +// The parsing of types roughly parallels the parsing of expressions, and +// primary types are kind of like primary expressions...they're the +// primitives with which other types are constructed. +function flowParsePrimaryType() { + let isGroupedType = false; + const oldNoAnonFunctionType = state.noAnonFunctionType; + + switch (state.type) { + case tt.name: { + if (isContextual(ContextualKeyword._interface)) { + flowParseInterfaceType(); + return; + } + parseIdentifier(); + flowParseGenericType(); + return; + } + + case tt.braceL: + flowParseObjectType(false, false, false); + return; + + case tt.braceBarL: + flowParseObjectType(false, true, false); + return; + + case tt.bracketL: + flowParseTupleType(); + return; + + case tt.lessThan: + flowParseTypeParameterDeclaration(); + expect(tt.parenL); + flowParseFunctionTypeParams(); + expect(tt.parenR); + expect(tt.arrow); + flowParseType(); + return; + + case tt.parenL: + next(); + + // Check to see if this is actually a grouped type + if (!match(tt.parenR) && !match(tt.ellipsis)) { + if (match(tt.name)) { + const token = lookaheadType(); + isGroupedType = token !== tt.question && token !== tt.colon; + } else { + isGroupedType = true; + } + } + + if (isGroupedType) { + state.noAnonFunctionType = false; + flowParseType(); + state.noAnonFunctionType = oldNoAnonFunctionType; + + // A `,` or a `) =>` means this is an anonymous function type + if ( + state.noAnonFunctionType || + !(match(tt.comma) || (match(tt.parenR) && lookaheadType() === tt.arrow)) + ) { + expect(tt.parenR); + return; + } else { + // Eat a comma if there is one + eat(tt.comma); + } + } + + flowParseFunctionTypeParams(); + + expect(tt.parenR); + expect(tt.arrow); + flowParseType(); + return; + + case tt.minus: + next(); + parseLiteral(); + return; + + case tt.string: + case tt.num: + case tt._true: + case tt._false: + case tt._null: + case tt._this: + case tt._void: + case tt.star: + next(); + return; + + default: + if (state.type === tt._typeof) { + flowParseTypeofType(); + return; + } else if (state.type & TokenType.IS_KEYWORD) { + next(); + state.tokens[state.tokens.length - 1].type = tt.name; + return; + } + } + + unexpected(); +} + +function flowParsePostfixType() { + flowParsePrimaryType(); + while (!canInsertSemicolon() && (match(tt.bracketL) || match(tt.questionDot))) { + eat(tt.questionDot); + expect(tt.bracketL); + if (eat(tt.bracketR)) { + // Array type + } else { + // Indexed access type + flowParseType(); + expect(tt.bracketR); + } + } +} + +function flowParsePrefixType() { + if (eat(tt.question)) { + flowParsePrefixType(); + } else { + flowParsePostfixType(); + } +} + +function flowParseAnonFunctionWithoutParens() { + flowParsePrefixType(); + if (!state.noAnonFunctionType && eat(tt.arrow)) { + flowParseType(); + } +} + +function flowParseIntersectionType() { + eat(tt.bitwiseAND); + flowParseAnonFunctionWithoutParens(); + while (eat(tt.bitwiseAND)) { + flowParseAnonFunctionWithoutParens(); + } +} + +function flowParseUnionType() { + eat(tt.bitwiseOR); + flowParseIntersectionType(); + while (eat(tt.bitwiseOR)) { + flowParseIntersectionType(); + } +} + +function flowParseType() { + flowParseUnionType(); +} + +export function flowParseTypeAnnotation() { + flowParseTypeInitialiser(); +} + +function flowParseTypeAnnotatableIdentifier() { + parseIdentifier(); + if (match(tt.colon)) { + flowParseTypeAnnotation(); + } +} + +export function flowParseVariance() { + if (match(tt.plus) || match(tt.minus)) { + next(); + state.tokens[state.tokens.length - 1].isType = true; + } +} + +// ================================== +// Overrides +// ================================== + +export function flowParseFunctionBodyAndFinish(funcContextId) { + // For arrow functions, `parseArrow` handles the return type itself. + if (match(tt.colon)) { + flowParseTypeAndPredicateInitialiser(); + } + + parseFunctionBody(false, funcContextId); +} + +export function flowParseSubscript( + startTokenIndex, + noCalls, + stopState, +) { + if (match(tt.questionDot) && lookaheadType() === tt.lessThan) { + if (noCalls) { + stopState.stop = true; + return; + } + next(); + flowParseTypeParameterInstantiation(); + expect(tt.parenL); + parseCallExpressionArguments(); + return; + } else if (!noCalls && match(tt.lessThan)) { + const snapshot = state.snapshot(); + flowParseTypeParameterInstantiation(); + expect(tt.parenL); + parseCallExpressionArguments(); + if (state.error) { + state.restoreFromSnapshot(snapshot); + } else { + return; + } + } + baseParseSubscript(startTokenIndex, noCalls, stopState); +} + +export function flowStartParseNewArguments() { + if (match(tt.lessThan)) { + const snapshot = state.snapshot(); + flowParseTypeParameterInstantiation(); + if (state.error) { + state.restoreFromSnapshot(snapshot); + } + } +} + +// interfaces +export function flowTryParseStatement() { + if (match(tt.name) && state.contextualKeyword === ContextualKeyword._interface) { + const oldIsType = pushTypeContext(0); + next(); + flowParseInterface(); + popTypeContext(oldIsType); + return true; + } else if (isContextual(ContextualKeyword._enum)) { + flowParseEnumDeclaration(); + return true; + } + return false; +} + +export function flowTryParseExportDefaultExpression() { + if (isContextual(ContextualKeyword._enum)) { + flowParseEnumDeclaration(); + return true; + } + return false; +} + +// declares, interfaces and type aliases +export function flowParseIdentifierStatement(contextualKeyword) { + if (contextualKeyword === ContextualKeyword._declare) { + if ( + match(tt._class) || + match(tt.name) || + match(tt._function) || + match(tt._var) || + match(tt._export) + ) { + const oldIsType = pushTypeContext(1); + flowParseDeclare(); + popTypeContext(oldIsType); + } + } else if (match(tt.name)) { + if (contextualKeyword === ContextualKeyword._interface) { + const oldIsType = pushTypeContext(1); + flowParseInterface(); + popTypeContext(oldIsType); + } else if (contextualKeyword === ContextualKeyword._type) { + const oldIsType = pushTypeContext(1); + flowParseTypeAlias(); + popTypeContext(oldIsType); + } else if (contextualKeyword === ContextualKeyword._opaque) { + const oldIsType = pushTypeContext(1); + flowParseOpaqueType(false); + popTypeContext(oldIsType); + } + } + semicolon(); +} + +// export type +export function flowShouldParseExportDeclaration() { + return ( + isContextual(ContextualKeyword._type) || + isContextual(ContextualKeyword._interface) || + isContextual(ContextualKeyword._opaque) || + isContextual(ContextualKeyword._enum) + ); +} + +export function flowShouldDisallowExportDefaultSpecifier() { + return ( + match(tt.name) && + (state.contextualKeyword === ContextualKeyword._type || + state.contextualKeyword === ContextualKeyword._interface || + state.contextualKeyword === ContextualKeyword._opaque || + state.contextualKeyword === ContextualKeyword._enum) + ); +} + +export function flowParseExportDeclaration() { + if (isContextual(ContextualKeyword._type)) { + const oldIsType = pushTypeContext(1); + next(); + + if (match(tt.braceL)) { + // export type { foo, bar }; + parseExportSpecifiers(); + parseExportFrom(); + } else { + // export type Foo = Bar; + flowParseTypeAlias(); + } + popTypeContext(oldIsType); + } else if (isContextual(ContextualKeyword._opaque)) { + const oldIsType = pushTypeContext(1); + next(); + // export opaque type Foo = Bar; + flowParseOpaqueType(false); + popTypeContext(oldIsType); + } else if (isContextual(ContextualKeyword._interface)) { + const oldIsType = pushTypeContext(1); + next(); + flowParseInterface(); + popTypeContext(oldIsType); + } else { + parseStatement(true); + } +} + +export function flowShouldParseExportStar() { + return match(tt.star) || (isContextual(ContextualKeyword._type) && lookaheadType() === tt.star); +} + +export function flowParseExportStar() { + if (eatContextual(ContextualKeyword._type)) { + const oldIsType = pushTypeContext(2); + baseParseExportStar(); + popTypeContext(oldIsType); + } else { + baseParseExportStar(); + } +} + +// parse a the super class type parameters and implements +export function flowAfterParseClassSuper(hasSuper) { + if (hasSuper && match(tt.lessThan)) { + flowParseTypeParameterInstantiation(); + } + if (isContextual(ContextualKeyword._implements)) { + const oldIsType = pushTypeContext(0); + next(); + state.tokens[state.tokens.length - 1].type = tt._implements; + do { + flowParseRestrictedIdentifier(); + if (match(tt.lessThan)) { + flowParseTypeParameterInstantiation(); + } + } while (eat(tt.comma)); + popTypeContext(oldIsType); + } +} + +// parse type parameters for object method shorthand +export function flowStartParseObjPropValue() { + // method shorthand + if (match(tt.lessThan)) { + flowParseTypeParameterDeclaration(); + if (!match(tt.parenL)) unexpected(); + } +} + +export function flowParseAssignableListItemTypes() { + const oldIsType = pushTypeContext(0); + eat(tt.question); + if (match(tt.colon)) { + flowParseTypeAnnotation(); + } + popTypeContext(oldIsType); +} + +// parse typeof and type imports +export function flowStartParseImportSpecifiers() { + if (match(tt._typeof) || isContextual(ContextualKeyword._type)) { + const lh = lookaheadTypeAndKeyword(); + if (isMaybeDefaultImport(lh) || lh.type === tt.braceL || lh.type === tt.star) { + next(); + } + } +} + +// parse import-type/typeof shorthand +export function flowParseImportSpecifier() { + const isTypeKeyword = + state.contextualKeyword === ContextualKeyword._type || state.type === tt._typeof; + if (isTypeKeyword) { + next(); + } else { + parseIdentifier(); + } + + if (isContextual(ContextualKeyword._as) && !isLookaheadContextual(ContextualKeyword._as)) { + parseIdentifier(); + if (isTypeKeyword && !match(tt.name) && !(state.type & TokenType.IS_KEYWORD)) { + // `import {type as ,` or `import {type as }` + } else { + // `import {type as foo` + parseIdentifier(); + } + } else { + if (isTypeKeyword && (match(tt.name) || !!(state.type & TokenType.IS_KEYWORD))) { + // `import {type foo` + parseIdentifier(); + } + if (eatContextual(ContextualKeyword._as)) { + parseIdentifier(); + } + } +} + +// parse function type parameters - function foo() {} +export function flowStartParseFunctionParams() { + // Originally this checked if the method is a getter/setter, but if it was, we'd crash soon + // anyway, so don't try to propagate that information. + if (match(tt.lessThan)) { + const oldIsType = pushTypeContext(0); + flowParseTypeParameterDeclaration(); + popTypeContext(oldIsType); + } +} + +// parse flow type annotations on variable declarator heads - let foo: string = bar +export function flowAfterParseVarHead() { + if (match(tt.colon)) { + flowParseTypeAnnotation(); + } +} + +// parse the return type of an async arrow function - let foo = (async (): number => {}); +export function flowStartParseAsyncArrowFromCallExpression() { + if (match(tt.colon)) { + const oldNoAnonFunctionType = state.noAnonFunctionType; + state.noAnonFunctionType = true; + flowParseTypeAnnotation(); + state.noAnonFunctionType = oldNoAnonFunctionType; + } +} + +// We need to support type parameter declarations for arrow functions. This +// is tricky. There are three situations we need to handle +// +// 1. This is either JSX or an arrow function. We'll try JSX first. If that +// fails, we'll try an arrow function. If that fails, we'll throw the JSX +// error. +// 2. This is an arrow function. We'll parse the type parameter declaration, +// parse the rest, make sure the rest is an arrow function, and go from +// there +// 3. This is neither. Just call the super method +export function flowParseMaybeAssign(noIn, isWithinParens) { + if (match(tt.lessThan)) { + const snapshot = state.snapshot(); + let wasArrow = baseParseMaybeAssign(noIn, isWithinParens); + if (state.error) { + state.restoreFromSnapshot(snapshot); + state.type = tt.typeParameterStart; + } else { + return wasArrow; + } + + const oldIsType = pushTypeContext(0); + flowParseTypeParameterDeclaration(); + popTypeContext(oldIsType); + wasArrow = baseParseMaybeAssign(noIn, isWithinParens); + if (wasArrow) { + return true; + } + unexpected(); + } + + return baseParseMaybeAssign(noIn, isWithinParens); +} + +// handle return types for arrow functions +export function flowParseArrow() { + if (match(tt.colon)) { + const oldIsType = pushTypeContext(0); + const snapshot = state.snapshot(); + + const oldNoAnonFunctionType = state.noAnonFunctionType; + state.noAnonFunctionType = true; + flowParseTypeAndPredicateInitialiser(); + state.noAnonFunctionType = oldNoAnonFunctionType; + + if (canInsertSemicolon()) unexpected(); + if (!match(tt.arrow)) unexpected(); + + if (state.error) { + state.restoreFromSnapshot(snapshot); + } + popTypeContext(oldIsType); + } + return eat(tt.arrow); +} + +export function flowParseSubscripts(startTokenIndex, noCalls = false) { + if ( + state.tokens[state.tokens.length - 1].contextualKeyword === ContextualKeyword._async && + match(tt.lessThan) + ) { + const snapshot = state.snapshot(); + const wasArrow = parseAsyncArrowWithTypeParameters(); + if (wasArrow && !state.error) { + return; + } + state.restoreFromSnapshot(snapshot); + } + + baseParseSubscripts(startTokenIndex, noCalls); +} + +// Returns true if there was an arrow function here. +function parseAsyncArrowWithTypeParameters() { + state.scopeDepth++; + const startTokenIndex = state.tokens.length; + parseFunctionParams(); + if (!parseArrow()) { + return false; + } + parseArrowExpression(startTokenIndex); + return true; +} + +function flowParseEnumDeclaration() { + expectContextual(ContextualKeyword._enum); + state.tokens[state.tokens.length - 1].type = tt._enum; + parseIdentifier(); + flowParseEnumBody(); +} + +function flowParseEnumBody() { + if (eatContextual(ContextualKeyword._of)) { + next(); + } + expect(tt.braceL); + flowParseEnumMembers(); + expect(tt.braceR); +} + +function flowParseEnumMembers() { + while (!match(tt.braceR) && !state.error) { + if (eat(tt.ellipsis)) { + break; + } + flowParseEnumMember(); + if (!match(tt.braceR)) { + expect(tt.comma); + } + } +} + +function flowParseEnumMember() { + parseIdentifier(); + if (eat(tt.eq)) { + // Flow enum values are always just one token (a string, number, or boolean literal). + next(); + } +} diff --git a/node_modules/sucrase/dist/esm/parser/plugins/jsx/index.js b/node_modules/sucrase/dist/esm/parser/plugins/jsx/index.js new file mode 100644 index 00000000..83f39836 --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/plugins/jsx/index.js @@ -0,0 +1,367 @@ +import { + eat, + finishToken, + getTokenFromCode, + IdentifierRole, + JSXRole, + match, + next, + skipSpace, + Token, +} from "../../tokenizer/index"; +import {TokenType as tt} from "../../tokenizer/types"; +import {input, isTypeScriptEnabled, state} from "../../traverser/base"; +import {parseExpression, parseMaybeAssign} from "../../traverser/expression"; +import {expect, unexpected} from "../../traverser/util"; +import {charCodes} from "../../util/charcodes"; +import {IS_IDENTIFIER_CHAR, IS_IDENTIFIER_START} from "../../util/identifier"; +import {tsTryParseJSXTypeArgument} from "../typescript"; + +/** + * Read token with JSX contents. + * + * In addition to detecting jsxTagStart and also regular tokens that might be + * part of an expression, this code detects the start and end of text ranges + * within JSX children. In order to properly count the number of children, we + * distinguish jsxText from jsxEmptyText, which is a text range that simplifies + * to the empty string after JSX whitespace trimming. + * + * It turns out that a JSX text range will simplify to the empty string if and + * only if both of these conditions hold: + * - The range consists entirely of whitespace characters (only counting space, + * tab, \r, and \n). + * - The range has at least one newline. + * This can be proven by analyzing any implementation of whitespace trimming, + * e.g. formatJSXTextLiteral in Sucrase or cleanJSXElementLiteralChild in Babel. + */ +function jsxReadToken() { + let sawNewline = false; + let sawNonWhitespace = false; + while (true) { + if (state.pos >= input.length) { + unexpected("Unterminated JSX contents"); + return; + } + + const ch = input.charCodeAt(state.pos); + if (ch === charCodes.lessThan || ch === charCodes.leftCurlyBrace) { + if (state.pos === state.start) { + if (ch === charCodes.lessThan) { + state.pos++; + finishToken(tt.jsxTagStart); + return; + } + getTokenFromCode(ch); + return; + } + if (sawNewline && !sawNonWhitespace) { + finishToken(tt.jsxEmptyText); + } else { + finishToken(tt.jsxText); + } + return; + } + + // This is part of JSX text. + if (ch === charCodes.lineFeed) { + sawNewline = true; + } else if (ch !== charCodes.space && ch !== charCodes.carriageReturn && ch !== charCodes.tab) { + sawNonWhitespace = true; + } + state.pos++; + } +} + +function jsxReadString(quote) { + state.pos++; + for (;;) { + if (state.pos >= input.length) { + unexpected("Unterminated string constant"); + return; + } + + const ch = input.charCodeAt(state.pos); + if (ch === quote) { + state.pos++; + break; + } + state.pos++; + } + finishToken(tt.string); +} + +// Read a JSX identifier (valid tag or attribute name). +// +// Optimized version since JSX identifiers can't contain +// escape characters and so can be read as single slice. +// Also assumes that first character was already checked +// by isIdentifierStart in readToken. + +function jsxReadWord() { + let ch; + do { + if (state.pos > input.length) { + unexpected("Unexpectedly reached the end of input."); + return; + } + ch = input.charCodeAt(++state.pos); + } while (IS_IDENTIFIER_CHAR[ch] || ch === charCodes.dash); + finishToken(tt.jsxName); +} + +// Parse next token as JSX identifier +function jsxParseIdentifier() { + nextJSXTagToken(); +} + +// Parse namespaced identifier. +function jsxParseNamespacedName(identifierRole) { + jsxParseIdentifier(); + if (!eat(tt.colon)) { + // Plain identifier, so this is an access. + state.tokens[state.tokens.length - 1].identifierRole = identifierRole; + return; + } + // Process the second half of the namespaced name. + jsxParseIdentifier(); +} + +// Parses element name in any form - namespaced, member +// or single identifier. +function jsxParseElementName() { + const firstTokenIndex = state.tokens.length; + jsxParseNamespacedName(IdentifierRole.Access); + let hadDot = false; + while (match(tt.dot)) { + hadDot = true; + nextJSXTagToken(); + jsxParseIdentifier(); + } + // For tags like
    with a lowercase letter and no dots, the name is + // actually *not* an identifier access, since it's referring to a built-in + // tag name. Remove the identifier role in this case so that it's not + // accidentally transformed by the imports transform when preserving JSX. + if (!hadDot) { + const firstToken = state.tokens[firstTokenIndex]; + const firstChar = input.charCodeAt(firstToken.start); + if (firstChar >= charCodes.lowercaseA && firstChar <= charCodes.lowercaseZ) { + firstToken.identifierRole = null; + } + } +} + +// Parses any type of JSX attribute value. +function jsxParseAttributeValue() { + switch (state.type) { + case tt.braceL: + next(); + parseExpression(); + nextJSXTagToken(); + return; + + case tt.jsxTagStart: + jsxParseElement(); + nextJSXTagToken(); + return; + + case tt.string: + nextJSXTagToken(); + return; + + default: + unexpected("JSX value should be either an expression or a quoted JSX text"); + } +} + +// Parse JSX spread child, after already processing the { +// Does not parse the closing } +function jsxParseSpreadChild() { + expect(tt.ellipsis); + parseExpression(); +} + +// Parses JSX opening tag starting after "<". +// Returns true if the tag was self-closing. +// Does not parse the last token. +function jsxParseOpeningElement(initialTokenIndex) { + if (match(tt.jsxTagEnd)) { + // This is an open-fragment. + return false; + } + jsxParseElementName(); + if (isTypeScriptEnabled) { + tsTryParseJSXTypeArgument(); + } + let hasSeenPropSpread = false; + while (!match(tt.slash) && !match(tt.jsxTagEnd) && !state.error) { + if (eat(tt.braceL)) { + hasSeenPropSpread = true; + expect(tt.ellipsis); + parseMaybeAssign(); + // } + nextJSXTagToken(); + continue; + } + if ( + hasSeenPropSpread && + state.end - state.start === 3 && + input.charCodeAt(state.start) === charCodes.lowercaseK && + input.charCodeAt(state.start + 1) === charCodes.lowercaseE && + input.charCodeAt(state.start + 2) === charCodes.lowercaseY + ) { + state.tokens[initialTokenIndex].jsxRole = JSXRole.KeyAfterPropSpread; + } + jsxParseNamespacedName(IdentifierRole.ObjectKey); + if (match(tt.eq)) { + nextJSXTagToken(); + jsxParseAttributeValue(); + } + } + const isSelfClosing = match(tt.slash); + if (isSelfClosing) { + // / + nextJSXTagToken(); + } + return isSelfClosing; +} + +// Parses JSX closing tag starting after " 1) { + state.tokens[initialTokenIndex].jsxRole = JSXRole.StaticChildren; + } + } + return; + } + numExplicitChildren++; + jsxParseElementAt(); + nextJSXExprToken(); + break; + + case tt.jsxText: + numExplicitChildren++; + nextJSXExprToken(); + break; + + case tt.jsxEmptyText: + nextJSXExprToken(); + break; + + case tt.braceL: + next(); + if (match(tt.ellipsis)) { + jsxParseSpreadChild(); + nextJSXExprToken(); + // Spread children are a mechanism to explicitly mark children as + // static, so count it as 2 children to satisfy the "more than one + // child" condition. + numExplicitChildren += 2; + } else { + // If we see {}, this is an empty pseudo-expression that doesn't + // count as a child. + if (!match(tt.braceR)) { + numExplicitChildren++; + parseExpression(); + } + nextJSXExprToken(); + } + + break; + + // istanbul ignore next - should never happen + default: + unexpected(); + return; + } + } + } +} + +// Parses entire JSX element from current position. +// Does not parse the last token. +export function jsxParseElement() { + nextJSXTagToken(); + jsxParseElementAt(); +} + +// ================================== +// Overrides +// ================================== + +export function nextJSXTagToken() { + state.tokens.push(new Token()); + skipSpace(); + state.start = state.pos; + const code = input.charCodeAt(state.pos); + + if (IS_IDENTIFIER_START[code]) { + jsxReadWord(); + } else if (code === charCodes.quotationMark || code === charCodes.apostrophe) { + jsxReadString(code); + } else { + // The following tokens are just one character each. + ++state.pos; + switch (code) { + case charCodes.greaterThan: + finishToken(tt.jsxTagEnd); + break; + case charCodes.lessThan: + finishToken(tt.jsxTagStart); + break; + case charCodes.slash: + finishToken(tt.slash); + break; + case charCodes.equalsTo: + finishToken(tt.eq); + break; + case charCodes.leftCurlyBrace: + finishToken(tt.braceL); + break; + case charCodes.dot: + finishToken(tt.dot); + break; + case charCodes.colon: + finishToken(tt.colon); + break; + default: + unexpected(); + } + } +} + +function nextJSXExprToken() { + state.tokens.push(new Token()); + state.start = state.pos; + jsxReadToken(); +} diff --git a/node_modules/sucrase/dist/esm/parser/plugins/jsx/xhtml.js b/node_modules/sucrase/dist/esm/parser/plugins/jsx/xhtml.js new file mode 100644 index 00000000..c6a07418 --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/plugins/jsx/xhtml.js @@ -0,0 +1,256 @@ +// Use a Map rather than object to avoid unexpected __proto__ access. +export default new Map([ + ["quot", "\u0022"], + ["amp", "&"], + ["apos", "\u0027"], + ["lt", "<"], + ["gt", ">"], + ["nbsp", "\u00A0"], + ["iexcl", "\u00A1"], + ["cent", "\u00A2"], + ["pound", "\u00A3"], + ["curren", "\u00A4"], + ["yen", "\u00A5"], + ["brvbar", "\u00A6"], + ["sect", "\u00A7"], + ["uml", "\u00A8"], + ["copy", "\u00A9"], + ["ordf", "\u00AA"], + ["laquo", "\u00AB"], + ["not", "\u00AC"], + ["shy", "\u00AD"], + ["reg", "\u00AE"], + ["macr", "\u00AF"], + ["deg", "\u00B0"], + ["plusmn", "\u00B1"], + ["sup2", "\u00B2"], + ["sup3", "\u00B3"], + ["acute", "\u00B4"], + ["micro", "\u00B5"], + ["para", "\u00B6"], + ["middot", "\u00B7"], + ["cedil", "\u00B8"], + ["sup1", "\u00B9"], + ["ordm", "\u00BA"], + ["raquo", "\u00BB"], + ["frac14", "\u00BC"], + ["frac12", "\u00BD"], + ["frac34", "\u00BE"], + ["iquest", "\u00BF"], + ["Agrave", "\u00C0"], + ["Aacute", "\u00C1"], + ["Acirc", "\u00C2"], + ["Atilde", "\u00C3"], + ["Auml", "\u00C4"], + ["Aring", "\u00C5"], + ["AElig", "\u00C6"], + ["Ccedil", "\u00C7"], + ["Egrave", "\u00C8"], + ["Eacute", "\u00C9"], + ["Ecirc", "\u00CA"], + ["Euml", "\u00CB"], + ["Igrave", "\u00CC"], + ["Iacute", "\u00CD"], + ["Icirc", "\u00CE"], + ["Iuml", "\u00CF"], + ["ETH", "\u00D0"], + ["Ntilde", "\u00D1"], + ["Ograve", "\u00D2"], + ["Oacute", "\u00D3"], + ["Ocirc", "\u00D4"], + ["Otilde", "\u00D5"], + ["Ouml", "\u00D6"], + ["times", "\u00D7"], + ["Oslash", "\u00D8"], + ["Ugrave", "\u00D9"], + ["Uacute", "\u00DA"], + ["Ucirc", "\u00DB"], + ["Uuml", "\u00DC"], + ["Yacute", "\u00DD"], + ["THORN", "\u00DE"], + ["szlig", "\u00DF"], + ["agrave", "\u00E0"], + ["aacute", "\u00E1"], + ["acirc", "\u00E2"], + ["atilde", "\u00E3"], + ["auml", "\u00E4"], + ["aring", "\u00E5"], + ["aelig", "\u00E6"], + ["ccedil", "\u00E7"], + ["egrave", "\u00E8"], + ["eacute", "\u00E9"], + ["ecirc", "\u00EA"], + ["euml", "\u00EB"], + ["igrave", "\u00EC"], + ["iacute", "\u00ED"], + ["icirc", "\u00EE"], + ["iuml", "\u00EF"], + ["eth", "\u00F0"], + ["ntilde", "\u00F1"], + ["ograve", "\u00F2"], + ["oacute", "\u00F3"], + ["ocirc", "\u00F4"], + ["otilde", "\u00F5"], + ["ouml", "\u00F6"], + ["divide", "\u00F7"], + ["oslash", "\u00F8"], + ["ugrave", "\u00F9"], + ["uacute", "\u00FA"], + ["ucirc", "\u00FB"], + ["uuml", "\u00FC"], + ["yacute", "\u00FD"], + ["thorn", "\u00FE"], + ["yuml", "\u00FF"], + ["OElig", "\u0152"], + ["oelig", "\u0153"], + ["Scaron", "\u0160"], + ["scaron", "\u0161"], + ["Yuml", "\u0178"], + ["fnof", "\u0192"], + ["circ", "\u02C6"], + ["tilde", "\u02DC"], + ["Alpha", "\u0391"], + ["Beta", "\u0392"], + ["Gamma", "\u0393"], + ["Delta", "\u0394"], + ["Epsilon", "\u0395"], + ["Zeta", "\u0396"], + ["Eta", "\u0397"], + ["Theta", "\u0398"], + ["Iota", "\u0399"], + ["Kappa", "\u039A"], + ["Lambda", "\u039B"], + ["Mu", "\u039C"], + ["Nu", "\u039D"], + ["Xi", "\u039E"], + ["Omicron", "\u039F"], + ["Pi", "\u03A0"], + ["Rho", "\u03A1"], + ["Sigma", "\u03A3"], + ["Tau", "\u03A4"], + ["Upsilon", "\u03A5"], + ["Phi", "\u03A6"], + ["Chi", "\u03A7"], + ["Psi", "\u03A8"], + ["Omega", "\u03A9"], + ["alpha", "\u03B1"], + ["beta", "\u03B2"], + ["gamma", "\u03B3"], + ["delta", "\u03B4"], + ["epsilon", "\u03B5"], + ["zeta", "\u03B6"], + ["eta", "\u03B7"], + ["theta", "\u03B8"], + ["iota", "\u03B9"], + ["kappa", "\u03BA"], + ["lambda", "\u03BB"], + ["mu", "\u03BC"], + ["nu", "\u03BD"], + ["xi", "\u03BE"], + ["omicron", "\u03BF"], + ["pi", "\u03C0"], + ["rho", "\u03C1"], + ["sigmaf", "\u03C2"], + ["sigma", "\u03C3"], + ["tau", "\u03C4"], + ["upsilon", "\u03C5"], + ["phi", "\u03C6"], + ["chi", "\u03C7"], + ["psi", "\u03C8"], + ["omega", "\u03C9"], + ["thetasym", "\u03D1"], + ["upsih", "\u03D2"], + ["piv", "\u03D6"], + ["ensp", "\u2002"], + ["emsp", "\u2003"], + ["thinsp", "\u2009"], + ["zwnj", "\u200C"], + ["zwj", "\u200D"], + ["lrm", "\u200E"], + ["rlm", "\u200F"], + ["ndash", "\u2013"], + ["mdash", "\u2014"], + ["lsquo", "\u2018"], + ["rsquo", "\u2019"], + ["sbquo", "\u201A"], + ["ldquo", "\u201C"], + ["rdquo", "\u201D"], + ["bdquo", "\u201E"], + ["dagger", "\u2020"], + ["Dagger", "\u2021"], + ["bull", "\u2022"], + ["hellip", "\u2026"], + ["permil", "\u2030"], + ["prime", "\u2032"], + ["Prime", "\u2033"], + ["lsaquo", "\u2039"], + ["rsaquo", "\u203A"], + ["oline", "\u203E"], + ["frasl", "\u2044"], + ["euro", "\u20AC"], + ["image", "\u2111"], + ["weierp", "\u2118"], + ["real", "\u211C"], + ["trade", "\u2122"], + ["alefsym", "\u2135"], + ["larr", "\u2190"], + ["uarr", "\u2191"], + ["rarr", "\u2192"], + ["darr", "\u2193"], + ["harr", "\u2194"], + ["crarr", "\u21B5"], + ["lArr", "\u21D0"], + ["uArr", "\u21D1"], + ["rArr", "\u21D2"], + ["dArr", "\u21D3"], + ["hArr", "\u21D4"], + ["forall", "\u2200"], + ["part", "\u2202"], + ["exist", "\u2203"], + ["empty", "\u2205"], + ["nabla", "\u2207"], + ["isin", "\u2208"], + ["notin", "\u2209"], + ["ni", "\u220B"], + ["prod", "\u220F"], + ["sum", "\u2211"], + ["minus", "\u2212"], + ["lowast", "\u2217"], + ["radic", "\u221A"], + ["prop", "\u221D"], + ["infin", "\u221E"], + ["ang", "\u2220"], + ["and", "\u2227"], + ["or", "\u2228"], + ["cap", "\u2229"], + ["cup", "\u222A"], + ["int", "\u222B"], + ["there4", "\u2234"], + ["sim", "\u223C"], + ["cong", "\u2245"], + ["asymp", "\u2248"], + ["ne", "\u2260"], + ["equiv", "\u2261"], + ["le", "\u2264"], + ["ge", "\u2265"], + ["sub", "\u2282"], + ["sup", "\u2283"], + ["nsub", "\u2284"], + ["sube", "\u2286"], + ["supe", "\u2287"], + ["oplus", "\u2295"], + ["otimes", "\u2297"], + ["perp", "\u22A5"], + ["sdot", "\u22C5"], + ["lceil", "\u2308"], + ["rceil", "\u2309"], + ["lfloor", "\u230A"], + ["rfloor", "\u230B"], + ["lang", "\u2329"], + ["rang", "\u232A"], + ["loz", "\u25CA"], + ["spades", "\u2660"], + ["clubs", "\u2663"], + ["hearts", "\u2665"], + ["diams", "\u2666"], +]); diff --git a/node_modules/sucrase/dist/esm/parser/plugins/types.js b/node_modules/sucrase/dist/esm/parser/plugins/types.js new file mode 100644 index 00000000..78e4af43 --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/plugins/types.js @@ -0,0 +1,37 @@ +import {eatTypeToken, lookaheadType, match} from "../tokenizer/index"; +import {TokenType as tt} from "../tokenizer/types"; +import {isFlowEnabled, isTypeScriptEnabled} from "../traverser/base"; +import {baseParseConditional} from "../traverser/expression"; +import {flowParseTypeAnnotation} from "./flow"; +import {tsParseTypeAnnotation} from "./typescript"; + +/** + * Common parser code for TypeScript and Flow. + */ + +// An apparent conditional expression could actually be an optional parameter in an arrow function. +export function typedParseConditional(noIn) { + // If we see ?:, this can't possibly be a valid conditional. typedParseParenItem will be called + // later to finish off the arrow parameter. We also need to handle bare ? tokens for optional + // parameters without type annotations, i.e. ?, and ?) . + if (match(tt.question)) { + const nextType = lookaheadType(); + if (nextType === tt.colon || nextType === tt.comma || nextType === tt.parenR) { + return; + } + } + baseParseConditional(noIn); +} + +// Note: These "type casts" are *not* valid TS expressions. +// But we parse them here and change them when completing the arrow function. +export function typedParseParenItem() { + eatTypeToken(tt.question); + if (match(tt.colon)) { + if (isTypeScriptEnabled) { + tsParseTypeAnnotation(); + } else if (isFlowEnabled) { + flowParseTypeAnnotation(); + } + } +} diff --git a/node_modules/sucrase/dist/esm/parser/plugins/typescript.js b/node_modules/sucrase/dist/esm/parser/plugins/typescript.js new file mode 100644 index 00000000..f64ca67e --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/plugins/typescript.js @@ -0,0 +1,1632 @@ +import { + eat, + finishToken, + IdentifierRole, + lookaheadType, + lookaheadTypeAndKeyword, + match, + next, + nextTemplateToken, + popTypeContext, + pushTypeContext, + rescan_gt, +} from "../tokenizer/index"; +import {ContextualKeyword} from "../tokenizer/keywords"; +import {TokenType, TokenType as tt} from "../tokenizer/types"; +import {isJSXEnabled, state} from "../traverser/base"; +import { + atPossibleAsync, + baseParseMaybeAssign, + baseParseSubscript, + parseCallExpressionArguments, + parseExprAtom, + parseExpression, + parseFunctionBody, + parseIdentifier, + parseLiteral, + parseMaybeAssign, + parseMaybeUnary, + parsePropertyName, + parseTemplate, + +} from "../traverser/expression"; +import {parseBindingIdentifier, parseBindingList, parseImportedIdentifier} from "../traverser/lval"; +import { + baseParseMaybeDecoratorArguments, + parseBlockBody, + parseClass, + parseFunction, + parseFunctionParams, + parseStatement, + parseVarStatement, +} from "../traverser/statement"; +import { + canInsertSemicolon, + eatContextual, + expect, + expectContextual, + hasPrecedingLineBreak, + isContextual, + isLineTerminator, + isLookaheadContextual, + semicolon, + unexpected, +} from "../traverser/util"; +import {nextJSXTagToken} from "./jsx"; + +function tsIsIdentifier() { + // TODO: actually a bit more complex in TypeScript, but shouldn't matter. + // See https://github.com/Microsoft/TypeScript/issues/15008 + return match(tt.name); +} + +function isLiteralPropertyName() { + return ( + match(tt.name) || + Boolean(state.type & TokenType.IS_KEYWORD) || + match(tt.string) || + match(tt.num) || + match(tt.bigint) || + match(tt.decimal) + ); +} + +function tsNextTokenCanFollowModifier() { + // Note: TypeScript's implementation is much more complicated because + // more things are considered modifiers there. + // This implementation only handles modifiers not handled by babylon itself. And "static". + // TODO: Would be nice to avoid lookahead. Want a hasLineBreakUpNext() method... + const snapshot = state.snapshot(); + + next(); + const canFollowModifier = + (match(tt.bracketL) || + match(tt.braceL) || + match(tt.star) || + match(tt.ellipsis) || + match(tt.hash) || + isLiteralPropertyName()) && + !hasPrecedingLineBreak(); + + if (canFollowModifier) { + return true; + } else { + state.restoreFromSnapshot(snapshot); + return false; + } +} + +export function tsParseModifiers(allowedModifiers) { + while (true) { + const modifier = tsParseModifier(allowedModifiers); + if (modifier === null) { + break; + } + } +} + +/** Parses a modifier matching one the given modifier names. */ +export function tsParseModifier( + allowedModifiers, +) { + if (!match(tt.name)) { + return null; + } + + const modifier = state.contextualKeyword; + if (allowedModifiers.indexOf(modifier) !== -1 && tsNextTokenCanFollowModifier()) { + switch (modifier) { + case ContextualKeyword._readonly: + state.tokens[state.tokens.length - 1].type = tt._readonly; + break; + case ContextualKeyword._abstract: + state.tokens[state.tokens.length - 1].type = tt._abstract; + break; + case ContextualKeyword._static: + state.tokens[state.tokens.length - 1].type = tt._static; + break; + case ContextualKeyword._public: + state.tokens[state.tokens.length - 1].type = tt._public; + break; + case ContextualKeyword._private: + state.tokens[state.tokens.length - 1].type = tt._private; + break; + case ContextualKeyword._protected: + state.tokens[state.tokens.length - 1].type = tt._protected; + break; + case ContextualKeyword._override: + state.tokens[state.tokens.length - 1].type = tt._override; + break; + case ContextualKeyword._declare: + state.tokens[state.tokens.length - 1].type = tt._declare; + break; + default: + break; + } + return modifier; + } + return null; +} + +function tsParseEntityName() { + parseIdentifier(); + while (eat(tt.dot)) { + parseIdentifier(); + } +} + +function tsParseTypeReference() { + tsParseEntityName(); + if (!hasPrecedingLineBreak() && match(tt.lessThan)) { + tsParseTypeArguments(); + } +} + +function tsParseThisTypePredicate() { + next(); + tsParseTypeAnnotation(); +} + +function tsParseThisTypeNode() { + next(); +} + +function tsParseTypeQuery() { + expect(tt._typeof); + if (match(tt._import)) { + tsParseImportType(); + } else { + tsParseEntityName(); + } + if (!hasPrecedingLineBreak() && match(tt.lessThan)) { + tsParseTypeArguments(); + } +} + +function tsParseImportType() { + expect(tt._import); + expect(tt.parenL); + expect(tt.string); + expect(tt.parenR); + if (eat(tt.dot)) { + tsParseEntityName(); + } + if (match(tt.lessThan)) { + tsParseTypeArguments(); + } +} + +function tsParseTypeParameter() { + eat(tt._const); + const hadIn = eat(tt._in); + const hadOut = eatContextual(ContextualKeyword._out); + eat(tt._const); + if ((hadIn || hadOut) && !match(tt.name)) { + // The "in" or "out" keyword must have actually been the type parameter + // name, so set it as the name. + state.tokens[state.tokens.length - 1].type = tt.name; + } else { + parseIdentifier(); + } + + if (eat(tt._extends)) { + tsParseType(); + } + if (eat(tt.eq)) { + tsParseType(); + } +} + +export function tsTryParseTypeParameters() { + if (match(tt.lessThan)) { + tsParseTypeParameters(); + } +} + +function tsParseTypeParameters() { + const oldIsType = pushTypeContext(0); + if (match(tt.lessThan) || match(tt.typeParameterStart)) { + next(); + } else { + unexpected(); + } + + while (!eat(tt.greaterThan) && !state.error) { + tsParseTypeParameter(); + eat(tt.comma); + } + popTypeContext(oldIsType); +} + +// Note: In TypeScript implementation we must provide `yieldContext` and `awaitContext`, +// but here it's always false, because this is only used for types. +function tsFillSignature(returnToken) { + // Arrow fns *must* have return token (`=>`). Normal functions can omit it. + const returnTokenRequired = returnToken === tt.arrow; + tsTryParseTypeParameters(); + expect(tt.parenL); + // Create a scope even though we're doing type parsing so we don't accidentally + // treat params as top-level bindings. + state.scopeDepth++; + tsParseBindingListForSignature(false /* isBlockScope */); + state.scopeDepth--; + if (returnTokenRequired) { + tsParseTypeOrTypePredicateAnnotation(returnToken); + } else if (match(returnToken)) { + tsParseTypeOrTypePredicateAnnotation(returnToken); + } +} + +function tsParseBindingListForSignature(isBlockScope) { + parseBindingList(tt.parenR, isBlockScope); +} + +function tsParseTypeMemberSemicolon() { + if (!eat(tt.comma)) { + semicolon(); + } +} + +function tsParseSignatureMember() { + tsFillSignature(tt.colon); + tsParseTypeMemberSemicolon(); +} + +function tsIsUnambiguouslyIndexSignature() { + const snapshot = state.snapshot(); + next(); // Skip '{' + const isIndexSignature = eat(tt.name) && match(tt.colon); + state.restoreFromSnapshot(snapshot); + return isIndexSignature; +} + +function tsTryParseIndexSignature() { + if (!(match(tt.bracketL) && tsIsUnambiguouslyIndexSignature())) { + return false; + } + + const oldIsType = pushTypeContext(0); + + expect(tt.bracketL); + parseIdentifier(); + tsParseTypeAnnotation(); + expect(tt.bracketR); + + tsTryParseTypeAnnotation(); + tsParseTypeMemberSemicolon(); + + popTypeContext(oldIsType); + return true; +} + +function tsParsePropertyOrMethodSignature(isReadonly) { + eat(tt.question); + + if (!isReadonly && (match(tt.parenL) || match(tt.lessThan))) { + tsFillSignature(tt.colon); + tsParseTypeMemberSemicolon(); + } else { + tsTryParseTypeAnnotation(); + tsParseTypeMemberSemicolon(); + } +} + +function tsParseTypeMember() { + if (match(tt.parenL) || match(tt.lessThan)) { + // call signature + tsParseSignatureMember(); + return; + } + if (match(tt._new)) { + next(); + if (match(tt.parenL) || match(tt.lessThan)) { + // constructor signature + tsParseSignatureMember(); + } else { + tsParsePropertyOrMethodSignature(false); + } + return; + } + const readonly = !!tsParseModifier([ContextualKeyword._readonly]); + + const found = tsTryParseIndexSignature(); + if (found) { + return; + } + if ( + (isContextual(ContextualKeyword._get) || isContextual(ContextualKeyword._set)) && + tsNextTokenCanFollowModifier() + ) { + // This is a getter/setter on a type. The tsNextTokenCanFollowModifier + // function already called next() for us, so continue parsing the name. + } + parsePropertyName(-1 /* Types don't need context IDs. */); + tsParsePropertyOrMethodSignature(readonly); +} + +function tsParseTypeLiteral() { + tsParseObjectTypeMembers(); +} + +function tsParseObjectTypeMembers() { + expect(tt.braceL); + while (!eat(tt.braceR) && !state.error) { + tsParseTypeMember(); + } +} + +function tsLookaheadIsStartOfMappedType() { + const snapshot = state.snapshot(); + const isStartOfMappedType = tsIsStartOfMappedType(); + state.restoreFromSnapshot(snapshot); + return isStartOfMappedType; +} + +function tsIsStartOfMappedType() { + next(); + if (eat(tt.plus) || eat(tt.minus)) { + return isContextual(ContextualKeyword._readonly); + } + if (isContextual(ContextualKeyword._readonly)) { + next(); + } + if (!match(tt.bracketL)) { + return false; + } + next(); + if (!tsIsIdentifier()) { + return false; + } + next(); + return match(tt._in); +} + +function tsParseMappedTypeParameter() { + parseIdentifier(); + expect(tt._in); + tsParseType(); +} + +function tsParseMappedType() { + expect(tt.braceL); + if (match(tt.plus) || match(tt.minus)) { + next(); + expectContextual(ContextualKeyword._readonly); + } else { + eatContextual(ContextualKeyword._readonly); + } + expect(tt.bracketL); + tsParseMappedTypeParameter(); + if (eatContextual(ContextualKeyword._as)) { + tsParseType(); + } + expect(tt.bracketR); + if (match(tt.plus) || match(tt.minus)) { + next(); + expect(tt.question); + } else { + eat(tt.question); + } + tsTryParseType(); + semicolon(); + expect(tt.braceR); +} + +function tsParseTupleType() { + expect(tt.bracketL); + while (!eat(tt.bracketR) && !state.error) { + // Do not validate presence of either none or only labeled elements + tsParseTupleElementType(); + eat(tt.comma); + } +} + +function tsParseTupleElementType() { + // parses `...TsType[]` + if (eat(tt.ellipsis)) { + tsParseType(); + } else { + // parses `TsType?` + tsParseType(); + eat(tt.question); + } + + // The type we parsed above was actually a label + if (eat(tt.colon)) { + // Labeled tuple types must affix the label with `...` or `?`, so no need to handle those here + tsParseType(); + } +} + +function tsParseParenthesizedType() { + expect(tt.parenL); + tsParseType(); + expect(tt.parenR); +} + +function tsParseTemplateLiteralType() { + // Finish `, read quasi + nextTemplateToken(); + // Finish quasi, read ${ + nextTemplateToken(); + while (!match(tt.backQuote) && !state.error) { + expect(tt.dollarBraceL); + tsParseType(); + // Finish }, read quasi + nextTemplateToken(); + // Finish quasi, read either ${ or ` + nextTemplateToken(); + } + next(); +} + +var FunctionType; (function (FunctionType) { + const TSFunctionType = 0; FunctionType[FunctionType["TSFunctionType"] = TSFunctionType] = "TSFunctionType"; + const TSConstructorType = TSFunctionType + 1; FunctionType[FunctionType["TSConstructorType"] = TSConstructorType] = "TSConstructorType"; + const TSAbstractConstructorType = TSConstructorType + 1; FunctionType[FunctionType["TSAbstractConstructorType"] = TSAbstractConstructorType] = "TSAbstractConstructorType"; +})(FunctionType || (FunctionType = {})); + +function tsParseFunctionOrConstructorType(type) { + if (type === FunctionType.TSAbstractConstructorType) { + expectContextual(ContextualKeyword._abstract); + } + if (type === FunctionType.TSConstructorType || type === FunctionType.TSAbstractConstructorType) { + expect(tt._new); + } + const oldInDisallowConditionalTypesContext = state.inDisallowConditionalTypesContext; + state.inDisallowConditionalTypesContext = false; + tsFillSignature(tt.arrow); + state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; +} + +function tsParseNonArrayType() { + switch (state.type) { + case tt.name: + tsParseTypeReference(); + return; + case tt._void: + case tt._null: + next(); + return; + case tt.string: + case tt.num: + case tt.bigint: + case tt.decimal: + case tt._true: + case tt._false: + parseLiteral(); + return; + case tt.minus: + next(); + parseLiteral(); + return; + case tt._this: { + tsParseThisTypeNode(); + if (isContextual(ContextualKeyword._is) && !hasPrecedingLineBreak()) { + tsParseThisTypePredicate(); + } + return; + } + case tt._typeof: + tsParseTypeQuery(); + return; + case tt._import: + tsParseImportType(); + return; + case tt.braceL: + if (tsLookaheadIsStartOfMappedType()) { + tsParseMappedType(); + } else { + tsParseTypeLiteral(); + } + return; + case tt.bracketL: + tsParseTupleType(); + return; + case tt.parenL: + tsParseParenthesizedType(); + return; + case tt.backQuote: + tsParseTemplateLiteralType(); + return; + default: + if (state.type & TokenType.IS_KEYWORD) { + next(); + state.tokens[state.tokens.length - 1].type = tt.name; + return; + } + break; + } + + unexpected(); +} + +function tsParseArrayTypeOrHigher() { + tsParseNonArrayType(); + while (!hasPrecedingLineBreak() && eat(tt.bracketL)) { + if (!eat(tt.bracketR)) { + // If we hit ] immediately, this is an array type, otherwise it's an indexed access type. + tsParseType(); + expect(tt.bracketR); + } + } +} + +function tsParseInferType() { + expectContextual(ContextualKeyword._infer); + parseIdentifier(); + if (match(tt._extends)) { + // Infer type constraints introduce an ambiguity about whether the "extends" + // is a constraint for this infer type or is another conditional type. + const snapshot = state.snapshot(); + expect(tt._extends); + const oldInDisallowConditionalTypesContext = state.inDisallowConditionalTypesContext; + state.inDisallowConditionalTypesContext = true; + tsParseType(); + state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; + if (state.error || (!state.inDisallowConditionalTypesContext && match(tt.question))) { + state.restoreFromSnapshot(snapshot); + } + } +} + +function tsParseTypeOperatorOrHigher() { + if ( + isContextual(ContextualKeyword._keyof) || + isContextual(ContextualKeyword._unique) || + isContextual(ContextualKeyword._readonly) + ) { + next(); + tsParseTypeOperatorOrHigher(); + } else if (isContextual(ContextualKeyword._infer)) { + tsParseInferType(); + } else { + const oldInDisallowConditionalTypesContext = state.inDisallowConditionalTypesContext; + state.inDisallowConditionalTypesContext = false; + tsParseArrayTypeOrHigher(); + state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; + } +} + +function tsParseIntersectionTypeOrHigher() { + eat(tt.bitwiseAND); + tsParseTypeOperatorOrHigher(); + if (match(tt.bitwiseAND)) { + while (eat(tt.bitwiseAND)) { + tsParseTypeOperatorOrHigher(); + } + } +} + +function tsParseUnionTypeOrHigher() { + eat(tt.bitwiseOR); + tsParseIntersectionTypeOrHigher(); + if (match(tt.bitwiseOR)) { + while (eat(tt.bitwiseOR)) { + tsParseIntersectionTypeOrHigher(); + } + } +} + +function tsIsStartOfFunctionType() { + if (match(tt.lessThan)) { + return true; + } + return match(tt.parenL) && tsLookaheadIsUnambiguouslyStartOfFunctionType(); +} + +function tsSkipParameterStart() { + if (match(tt.name) || match(tt._this)) { + next(); + return true; + } + // If this is a possible array/object destructure, walk to the matching bracket/brace. + // The next token after will tell us definitively whether this is a function param. + if (match(tt.braceL) || match(tt.bracketL)) { + let depth = 1; + next(); + while (depth > 0 && !state.error) { + if (match(tt.braceL) || match(tt.bracketL)) { + depth++; + } else if (match(tt.braceR) || match(tt.bracketR)) { + depth--; + } + next(); + } + return true; + } + return false; +} + +function tsLookaheadIsUnambiguouslyStartOfFunctionType() { + const snapshot = state.snapshot(); + const isUnambiguouslyStartOfFunctionType = tsIsUnambiguouslyStartOfFunctionType(); + state.restoreFromSnapshot(snapshot); + return isUnambiguouslyStartOfFunctionType; +} + +function tsIsUnambiguouslyStartOfFunctionType() { + next(); + if (match(tt.parenR) || match(tt.ellipsis)) { + // ( ) + // ( ... + return true; + } + if (tsSkipParameterStart()) { + if (match(tt.colon) || match(tt.comma) || match(tt.question) || match(tt.eq)) { + // ( xxx : + // ( xxx , + // ( xxx ? + // ( xxx = + return true; + } + if (match(tt.parenR)) { + next(); + if (match(tt.arrow)) { + // ( xxx ) => + return true; + } + } + } + return false; +} + +function tsParseTypeOrTypePredicateAnnotation(returnToken) { + const oldIsType = pushTypeContext(0); + expect(returnToken); + const finishedReturn = tsParseTypePredicateOrAssertsPrefix(); + if (!finishedReturn) { + tsParseType(); + } + popTypeContext(oldIsType); +} + +function tsTryParseTypeOrTypePredicateAnnotation() { + if (match(tt.colon)) { + tsParseTypeOrTypePredicateAnnotation(tt.colon); + } +} + +export function tsTryParseTypeAnnotation() { + if (match(tt.colon)) { + tsParseTypeAnnotation(); + } +} + +function tsTryParseType() { + if (eat(tt.colon)) { + tsParseType(); + } +} + +/** + * Detect a few special return syntax cases: `x is T`, `asserts x`, `asserts x is T`, + * `asserts this is T`. + * + * Returns true if we parsed the return type, false if there's still a type to be parsed. + */ +function tsParseTypePredicateOrAssertsPrefix() { + const snapshot = state.snapshot(); + if (isContextual(ContextualKeyword._asserts)) { + // Normally this is `asserts x is T`, but at this point, it might be `asserts is T` (a user- + // defined type guard on the `asserts` variable) or just a type called `asserts`. + next(); + if (eatContextual(ContextualKeyword._is)) { + // If we see `asserts is`, then this must be of the form `asserts is T`, since + // `asserts is is T` isn't valid. + tsParseType(); + return true; + } else if (tsIsIdentifier() || match(tt._this)) { + next(); + if (eatContextual(ContextualKeyword._is)) { + // If we see `is`, then this is `asserts x is T`. Otherwise, it's `asserts x`. + tsParseType(); + } + return true; + } else { + // Regular type, so bail out and start type parsing from scratch. + state.restoreFromSnapshot(snapshot); + return false; + } + } else if (tsIsIdentifier() || match(tt._this)) { + // This is a regular identifier, which may or may not have "is" after it. + next(); + if (isContextual(ContextualKeyword._is) && !hasPrecedingLineBreak()) { + next(); + tsParseType(); + return true; + } else { + // Regular type, so bail out and start type parsing from scratch. + state.restoreFromSnapshot(snapshot); + return false; + } + } + return false; +} + +export function tsParseTypeAnnotation() { + const oldIsType = pushTypeContext(0); + expect(tt.colon); + tsParseType(); + popTypeContext(oldIsType); +} + +export function tsParseType() { + tsParseNonConditionalType(); + if (state.inDisallowConditionalTypesContext || hasPrecedingLineBreak() || !eat(tt._extends)) { + return; + } + // extends type + const oldInDisallowConditionalTypesContext = state.inDisallowConditionalTypesContext; + state.inDisallowConditionalTypesContext = true; + tsParseNonConditionalType(); + state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; + + expect(tt.question); + // true type + tsParseType(); + expect(tt.colon); + // false type + tsParseType(); +} + +function isAbstractConstructorSignature() { + return isContextual(ContextualKeyword._abstract) && lookaheadType() === tt._new; +} + +export function tsParseNonConditionalType() { + if (tsIsStartOfFunctionType()) { + tsParseFunctionOrConstructorType(FunctionType.TSFunctionType); + return; + } + if (match(tt._new)) { + // As in `new () => Date` + tsParseFunctionOrConstructorType(FunctionType.TSConstructorType); + return; + } else if (isAbstractConstructorSignature()) { + // As in `abstract new () => Date` + tsParseFunctionOrConstructorType(FunctionType.TSAbstractConstructorType); + return; + } + tsParseUnionTypeOrHigher(); +} + +export function tsParseTypeAssertion() { + const oldIsType = pushTypeContext(1); + tsParseType(); + expect(tt.greaterThan); + popTypeContext(oldIsType); + parseMaybeUnary(); +} + +export function tsTryParseJSXTypeArgument() { + if (eat(tt.jsxTagStart)) { + state.tokens[state.tokens.length - 1].type = tt.typeParameterStart; + const oldIsType = pushTypeContext(1); + while (!match(tt.greaterThan) && !state.error) { + tsParseType(); + eat(tt.comma); + } + // Process >, but the one after needs to be parsed JSX-style. + nextJSXTagToken(); + popTypeContext(oldIsType); + } +} + +function tsParseHeritageClause() { + while (!match(tt.braceL) && !state.error) { + tsParseExpressionWithTypeArguments(); + eat(tt.comma); + } +} + +function tsParseExpressionWithTypeArguments() { + // Note: TS uses parseLeftHandSideExpressionOrHigher, + // then has grammar errors later if it's not an EntityName. + tsParseEntityName(); + if (match(tt.lessThan)) { + tsParseTypeArguments(); + } +} + +function tsParseInterfaceDeclaration() { + parseBindingIdentifier(false); + tsTryParseTypeParameters(); + if (eat(tt._extends)) { + tsParseHeritageClause(); + } + tsParseObjectTypeMembers(); +} + +function tsParseTypeAliasDeclaration() { + parseBindingIdentifier(false); + tsTryParseTypeParameters(); + expect(tt.eq); + tsParseType(); + semicolon(); +} + +function tsParseEnumMember() { + // Computed property names are grammar errors in an enum, so accept just string literal or identifier. + if (match(tt.string)) { + parseLiteral(); + } else { + parseIdentifier(); + } + if (eat(tt.eq)) { + const eqIndex = state.tokens.length - 1; + parseMaybeAssign(); + state.tokens[eqIndex].rhsEndIndex = state.tokens.length; + } +} + +function tsParseEnumDeclaration() { + parseBindingIdentifier(false); + expect(tt.braceL); + while (!eat(tt.braceR) && !state.error) { + tsParseEnumMember(); + eat(tt.comma); + } +} + +function tsParseModuleBlock() { + expect(tt.braceL); + parseBlockBody(/* end */ tt.braceR); +} + +function tsParseModuleOrNamespaceDeclaration() { + parseBindingIdentifier(false); + if (eat(tt.dot)) { + tsParseModuleOrNamespaceDeclaration(); + } else { + tsParseModuleBlock(); + } +} + +function tsParseAmbientExternalModuleDeclaration() { + if (isContextual(ContextualKeyword._global)) { + parseIdentifier(); + } else if (match(tt.string)) { + parseExprAtom(); + } else { + unexpected(); + } + + if (match(tt.braceL)) { + tsParseModuleBlock(); + } else { + semicolon(); + } +} + +export function tsParseImportEqualsDeclaration() { + parseImportedIdentifier(); + expect(tt.eq); + tsParseModuleReference(); + semicolon(); +} + +function tsIsExternalModuleReference() { + return isContextual(ContextualKeyword._require) && lookaheadType() === tt.parenL; +} + +function tsParseModuleReference() { + if (tsIsExternalModuleReference()) { + tsParseExternalModuleReference(); + } else { + tsParseEntityName(); + } +} + +function tsParseExternalModuleReference() { + expectContextual(ContextualKeyword._require); + expect(tt.parenL); + if (!match(tt.string)) { + unexpected(); + } + parseLiteral(); + expect(tt.parenR); +} + +// Utilities + +// Returns true if a statement matched. +function tsTryParseDeclare() { + if (isLineTerminator()) { + return false; + } + switch (state.type) { + case tt._function: { + const oldIsType = pushTypeContext(1); + next(); + // We don't need to precisely get the function start here, since it's only used to mark + // the function as a type if it's bodiless, and it's already a type here. + const functionStart = state.start; + parseFunction(functionStart, /* isStatement */ true); + popTypeContext(oldIsType); + return true; + } + case tt._class: { + const oldIsType = pushTypeContext(1); + parseClass(/* isStatement */ true, /* optionalId */ false); + popTypeContext(oldIsType); + return true; + } + case tt._const: { + if (match(tt._const) && isLookaheadContextual(ContextualKeyword._enum)) { + const oldIsType = pushTypeContext(1); + // `const enum = 0;` not allowed because "enum" is a strict mode reserved word. + expect(tt._const); + expectContextual(ContextualKeyword._enum); + state.tokens[state.tokens.length - 1].type = tt._enum; + tsParseEnumDeclaration(); + popTypeContext(oldIsType); + return true; + } + } + // falls through + case tt._var: + case tt._let: { + const oldIsType = pushTypeContext(1); + parseVarStatement(state.type !== tt._var); + popTypeContext(oldIsType); + return true; + } + case tt.name: { + const oldIsType = pushTypeContext(1); + const contextualKeyword = state.contextualKeyword; + let matched = false; + if (contextualKeyword === ContextualKeyword._global) { + tsParseAmbientExternalModuleDeclaration(); + matched = true; + } else { + matched = tsParseDeclaration(contextualKeyword, /* isBeforeToken */ true); + } + popTypeContext(oldIsType); + return matched; + } + default: + return false; + } +} + +// Note: this won't be called unless the keyword is allowed in `shouldParseExportDeclaration`. +// Returns true if it matched a declaration. +function tsTryParseExportDeclaration() { + return tsParseDeclaration(state.contextualKeyword, /* isBeforeToken */ true); +} + +// Returns true if it matched a statement. +function tsParseExpressionStatement(contextualKeyword) { + switch (contextualKeyword) { + case ContextualKeyword._declare: { + const declareTokenIndex = state.tokens.length - 1; + const matched = tsTryParseDeclare(); + if (matched) { + state.tokens[declareTokenIndex].type = tt._declare; + return true; + } + break; + } + case ContextualKeyword._global: + // `global { }` (with no `declare`) may appear inside an ambient module declaration. + // Would like to use tsParseAmbientExternalModuleDeclaration here, but already ran past "global". + if (match(tt.braceL)) { + tsParseModuleBlock(); + return true; + } + break; + + default: + return tsParseDeclaration(contextualKeyword, /* isBeforeToken */ false); + } + return false; +} + +/** + * Common code for parsing a declaration. + * + * isBeforeToken indicates that the current parser state is at the contextual + * keyword (and that it is not yet emitted) rather than reading the token after + * it. When isBeforeToken is true, we may be preceded by an `export` token and + * should include that token in a type context we create, e.g. to handle + * `export interface` or `export type`. (This is a bit of a hack and should be + * cleaned up at some point.) + * + * Returns true if it matched a declaration. + */ +function tsParseDeclaration(contextualKeyword, isBeforeToken) { + switch (contextualKeyword) { + case ContextualKeyword._abstract: + if (tsCheckLineTerminator(isBeforeToken) && match(tt._class)) { + state.tokens[state.tokens.length - 1].type = tt._abstract; + parseClass(/* isStatement */ true, /* optionalId */ false); + return true; + } + break; + + case ContextualKeyword._enum: + if (tsCheckLineTerminator(isBeforeToken) && match(tt.name)) { + state.tokens[state.tokens.length - 1].type = tt._enum; + tsParseEnumDeclaration(); + return true; + } + break; + + case ContextualKeyword._interface: + if (tsCheckLineTerminator(isBeforeToken) && match(tt.name)) { + // `next` is true in "export" and "declare" contexts, so we want to remove that token + // as well. + const oldIsType = pushTypeContext(isBeforeToken ? 2 : 1); + tsParseInterfaceDeclaration(); + popTypeContext(oldIsType); + return true; + } + break; + + case ContextualKeyword._module: + if (tsCheckLineTerminator(isBeforeToken)) { + if (match(tt.string)) { + const oldIsType = pushTypeContext(isBeforeToken ? 2 : 1); + tsParseAmbientExternalModuleDeclaration(); + popTypeContext(oldIsType); + return true; + } else if (match(tt.name)) { + const oldIsType = pushTypeContext(isBeforeToken ? 2 : 1); + tsParseModuleOrNamespaceDeclaration(); + popTypeContext(oldIsType); + return true; + } + } + break; + + case ContextualKeyword._namespace: + if (tsCheckLineTerminator(isBeforeToken) && match(tt.name)) { + const oldIsType = pushTypeContext(isBeforeToken ? 2 : 1); + tsParseModuleOrNamespaceDeclaration(); + popTypeContext(oldIsType); + return true; + } + break; + + case ContextualKeyword._type: + if (tsCheckLineTerminator(isBeforeToken) && match(tt.name)) { + const oldIsType = pushTypeContext(isBeforeToken ? 2 : 1); + tsParseTypeAliasDeclaration(); + popTypeContext(oldIsType); + return true; + } + break; + + default: + break; + } + return false; +} + +function tsCheckLineTerminator(isBeforeToken) { + if (isBeforeToken) { + // Babel checks hasFollowingLineBreak here and returns false, but this + // doesn't actually come up, e.g. `export interface` can never be on its own + // line in valid code. + next(); + return true; + } else { + return !isLineTerminator(); + } +} + +// Returns true if there was a generic async arrow function. +function tsTryParseGenericAsyncArrowFunction() { + const snapshot = state.snapshot(); + + tsParseTypeParameters(); + parseFunctionParams(); + tsTryParseTypeOrTypePredicateAnnotation(); + expect(tt.arrow); + + if (state.error) { + state.restoreFromSnapshot(snapshot); + return false; + } + + parseFunctionBody(true); + return true; +} + +/** + * If necessary, hack the tokenizer state so that this bitshift was actually a + * less-than token, then keep parsing. This should only be used in situations + * where we restore from snapshot on error (which reverts this change) or + * where bitshift would be illegal anyway (e.g. in a class "extends" clause). + * + * This hack is useful to handle situations like foo<() => void>() where + * there can legitimately be two open-angle-brackets in a row in TS. + */ +function tsParseTypeArgumentsWithPossibleBitshift() { + if (state.type === tt.bitShiftL) { + state.pos -= 1; + finishToken(tt.lessThan); + } + tsParseTypeArguments(); +} + +function tsParseTypeArguments() { + const oldIsType = pushTypeContext(0); + expect(tt.lessThan); + while (!match(tt.greaterThan) && !state.error) { + tsParseType(); + eat(tt.comma); + } + if (!oldIsType) { + // If the type arguments are present in an expression context, e.g. + // f(), then the > sign should be tokenized as a non-type token. + // In particular, f(a < b, c >= d) should parse the >= as a single token, + // resulting in a syntax error and fallback to the non-type-args + // interpretation. In the success case, even though the > is tokenized as a + // non-type token, it still must be marked as a type token so that it is + // erased. + popTypeContext(oldIsType); + rescan_gt(); + expect(tt.greaterThan); + state.tokens[state.tokens.length - 1].isType = true; + } else { + expect(tt.greaterThan); + popTypeContext(oldIsType); + } +} + +export function tsIsDeclarationStart() { + if (match(tt.name)) { + switch (state.contextualKeyword) { + case ContextualKeyword._abstract: + case ContextualKeyword._declare: + case ContextualKeyword._enum: + case ContextualKeyword._interface: + case ContextualKeyword._module: + case ContextualKeyword._namespace: + case ContextualKeyword._type: + return true; + default: + break; + } + } + + return false; +} + +// ====================================================== +// OVERRIDES +// ====================================================== + +export function tsParseFunctionBodyAndFinish(functionStart, funcContextId) { + // For arrow functions, `parseArrow` handles the return type itself. + if (match(tt.colon)) { + tsParseTypeOrTypePredicateAnnotation(tt.colon); + } + + // The original code checked the node type to make sure this function type allows a missing + // body, but we skip that to avoid sending around the node type. We instead just use the + // allowExpressionBody boolean to make sure it's not an arrow function. + if (!match(tt.braceL) && isLineTerminator()) { + // Retroactively mark the function declaration as a type. + let i = state.tokens.length - 1; + while ( + i >= 0 && + (state.tokens[i].start >= functionStart || + state.tokens[i].type === tt._default || + state.tokens[i].type === tt._export) + ) { + state.tokens[i].isType = true; + i--; + } + return; + } + + parseFunctionBody(false, funcContextId); +} + +export function tsParseSubscript( + startTokenIndex, + noCalls, + stopState, +) { + if (!hasPrecedingLineBreak() && eat(tt.bang)) { + state.tokens[state.tokens.length - 1].type = tt.nonNullAssertion; + return; + } + + if (match(tt.lessThan) || match(tt.bitShiftL)) { + // There are number of things we are going to "maybe" parse, like type arguments on + // tagged template expressions. If any of them fail, walk it back and continue. + const snapshot = state.snapshot(); + + if (!noCalls && atPossibleAsync()) { + // Almost certainly this is a generic async function `async () => ... + // But it might be a call with a type argument `async();` + const asyncArrowFn = tsTryParseGenericAsyncArrowFunction(); + if (asyncArrowFn) { + return; + } + } + tsParseTypeArgumentsWithPossibleBitshift(); + if (!noCalls && eat(tt.parenL)) { + // With f(), the subscriptStartIndex marker is on the ( token. + state.tokens[state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + parseCallExpressionArguments(); + } else if (match(tt.backQuote)) { + // Tagged template with a type argument. + parseTemplate(); + } else if ( + // The remaining possible case is an instantiation expression, e.g. + // Array . Check for a few cases that would disqualify it and + // cause us to bail out. + // a>c is not (a)>c, but a<(b>>c) + state.type === tt.greaterThan || + // ac is (ac + (state.type !== tt.parenL && + Boolean(state.type & TokenType.IS_EXPRESSION_START) && + !hasPrecedingLineBreak()) + ) { + // Bail out. We have something like ac, which is not an expression with + // type arguments but an (a < b) > c comparison. + unexpected(); + } + + if (state.error) { + state.restoreFromSnapshot(snapshot); + } else { + return; + } + } else if (!noCalls && match(tt.questionDot) && lookaheadType() === tt.lessThan) { + // If we see f?.<, then this must be an optional call with a type argument. + next(); + state.tokens[startTokenIndex].isOptionalChainStart = true; + // With f?.(), the subscriptStartIndex marker is on the ?. token. + state.tokens[state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + + tsParseTypeArguments(); + expect(tt.parenL); + parseCallExpressionArguments(); + } + baseParseSubscript(startTokenIndex, noCalls, stopState); +} + +export function tsTryParseExport() { + if (eat(tt._import)) { + // One of these cases: + // export import A = B; + // export import type A = require("A"); + if (isContextual(ContextualKeyword._type) && lookaheadType() !== tt.eq) { + // Eat a `type` token, unless it's actually an identifier name. + expectContextual(ContextualKeyword._type); + } + tsParseImportEqualsDeclaration(); + return true; + } else if (eat(tt.eq)) { + // `export = x;` + parseExpression(); + semicolon(); + return true; + } else if (eatContextual(ContextualKeyword._as)) { + // `export as namespace A;` + // See `parseNamespaceExportDeclaration` in TypeScript's own parser + expectContextual(ContextualKeyword._namespace); + parseIdentifier(); + semicolon(); + return true; + } else { + if (isContextual(ContextualKeyword._type)) { + const nextType = lookaheadType(); + // export type {foo} from 'a'; + // export type * from 'a';' + // export type * as ns from 'a';' + if (nextType === tt.braceL || nextType === tt.star) { + next(); + } + } + return false; + } +} + +/** + * Parse a TS import specifier, which may be prefixed with "type" and may be of + * the form `foo as bar`. + * + * The number of identifier-like tokens we see happens to be enough to uniquely + * identify the form, so simply count the number of identifiers rather than + * matching the words `type` or `as`. This is particularly important because + * `type` and `as` could each actually be plain identifiers rather than + * keywords. + */ +export function tsParseImportSpecifier() { + parseIdentifier(); + if (match(tt.comma) || match(tt.braceR)) { + // import {foo} + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ImportDeclaration; + return; + } + parseIdentifier(); + if (match(tt.comma) || match(tt.braceR)) { + // import {type foo} + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ImportDeclaration; + state.tokens[state.tokens.length - 2].isType = true; + state.tokens[state.tokens.length - 1].isType = true; + return; + } + parseIdentifier(); + if (match(tt.comma) || match(tt.braceR)) { + // import {foo as bar} + state.tokens[state.tokens.length - 3].identifierRole = IdentifierRole.ImportAccess; + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ImportDeclaration; + return; + } + parseIdentifier(); + // import {type foo as bar} + state.tokens[state.tokens.length - 3].identifierRole = IdentifierRole.ImportAccess; + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ImportDeclaration; + state.tokens[state.tokens.length - 4].isType = true; + state.tokens[state.tokens.length - 3].isType = true; + state.tokens[state.tokens.length - 2].isType = true; + state.tokens[state.tokens.length - 1].isType = true; +} + +/** + * Just like named import specifiers, export specifiers can have from 1 to 4 + * tokens, inclusive, and the number of tokens determines the role of each token. + */ +export function tsParseExportSpecifier() { + parseIdentifier(); + if (match(tt.comma) || match(tt.braceR)) { + // export {foo} + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ExportAccess; + return; + } + parseIdentifier(); + if (match(tt.comma) || match(tt.braceR)) { + // export {type foo} + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ExportAccess; + state.tokens[state.tokens.length - 2].isType = true; + state.tokens[state.tokens.length - 1].isType = true; + return; + } + parseIdentifier(); + if (match(tt.comma) || match(tt.braceR)) { + // export {foo as bar} + state.tokens[state.tokens.length - 3].identifierRole = IdentifierRole.ExportAccess; + return; + } + parseIdentifier(); + // export {type foo as bar} + state.tokens[state.tokens.length - 3].identifierRole = IdentifierRole.ExportAccess; + state.tokens[state.tokens.length - 4].isType = true; + state.tokens[state.tokens.length - 3].isType = true; + state.tokens[state.tokens.length - 2].isType = true; + state.tokens[state.tokens.length - 1].isType = true; +} + +export function tsTryParseExportDefaultExpression() { + if (isContextual(ContextualKeyword._abstract) && lookaheadType() === tt._class) { + state.type = tt._abstract; + next(); // Skip "abstract" + parseClass(true, true); + return true; + } + if (isContextual(ContextualKeyword._interface)) { + // Make sure "export default" are considered type tokens so the whole thing is removed. + const oldIsType = pushTypeContext(2); + tsParseDeclaration(ContextualKeyword._interface, true); + popTypeContext(oldIsType); + return true; + } + return false; +} + +export function tsTryParseStatementContent() { + if (state.type === tt._const) { + const ahead = lookaheadTypeAndKeyword(); + if (ahead.type === tt.name && ahead.contextualKeyword === ContextualKeyword._enum) { + expect(tt._const); + expectContextual(ContextualKeyword._enum); + state.tokens[state.tokens.length - 1].type = tt._enum; + tsParseEnumDeclaration(); + return true; + } + } + return false; +} + +export function tsTryParseClassMemberWithIsStatic(isStatic) { + const memberStartIndexAfterStatic = state.tokens.length; + tsParseModifiers([ + ContextualKeyword._abstract, + ContextualKeyword._readonly, + ContextualKeyword._declare, + ContextualKeyword._static, + ContextualKeyword._override, + ]); + + const modifiersEndIndex = state.tokens.length; + const found = tsTryParseIndexSignature(); + if (found) { + // Index signatures are type declarations, so set the modifier tokens as + // type tokens. Most tokens could be assumed to be type tokens, but `static` + // is ambiguous unless we set it explicitly here. + const memberStartIndex = isStatic + ? memberStartIndexAfterStatic - 1 + : memberStartIndexAfterStatic; + for (let i = memberStartIndex; i < modifiersEndIndex; i++) { + state.tokens[i].isType = true; + } + return true; + } + return false; +} + +// Note: The reason we do this in `parseIdentifierStatement` and not `parseStatement` +// is that e.g. `type()` is valid JS, so we must try parsing that first. +// If it's really a type, we will parse `type` as the statement, and can correct it here +// by parsing the rest. +export function tsParseIdentifierStatement(contextualKeyword) { + const matched = tsParseExpressionStatement(contextualKeyword); + if (!matched) { + semicolon(); + } +} + +export function tsParseExportDeclaration() { + // "export declare" is equivalent to just "export". + const isDeclare = eatContextual(ContextualKeyword._declare); + if (isDeclare) { + state.tokens[state.tokens.length - 1].type = tt._declare; + } + + let matchedDeclaration = false; + if (match(tt.name)) { + if (isDeclare) { + const oldIsType = pushTypeContext(2); + matchedDeclaration = tsTryParseExportDeclaration(); + popTypeContext(oldIsType); + } else { + matchedDeclaration = tsTryParseExportDeclaration(); + } + } + if (!matchedDeclaration) { + if (isDeclare) { + const oldIsType = pushTypeContext(2); + parseStatement(true); + popTypeContext(oldIsType); + } else { + parseStatement(true); + } + } +} + +export function tsAfterParseClassSuper(hasSuper) { + if (hasSuper && (match(tt.lessThan) || match(tt.bitShiftL))) { + tsParseTypeArgumentsWithPossibleBitshift(); + } + if (eatContextual(ContextualKeyword._implements)) { + state.tokens[state.tokens.length - 1].type = tt._implements; + const oldIsType = pushTypeContext(1); + tsParseHeritageClause(); + popTypeContext(oldIsType); + } +} + +export function tsStartParseObjPropValue() { + tsTryParseTypeParameters(); +} + +export function tsStartParseFunctionParams() { + tsTryParseTypeParameters(); +} + +// `let x: number;` +export function tsAfterParseVarHead() { + const oldIsType = pushTypeContext(0); + if (!hasPrecedingLineBreak()) { + eat(tt.bang); + } + tsTryParseTypeAnnotation(); + popTypeContext(oldIsType); +} + +// parse the return type of an async arrow function - let foo = (async (): number => {}); +export function tsStartParseAsyncArrowFromCallExpression() { + if (match(tt.colon)) { + tsParseTypeAnnotation(); + } +} + +// Returns true if the expression was an arrow function. +export function tsParseMaybeAssign(noIn, isWithinParens) { + // Note: When the JSX plugin is on, type assertions (` x`) aren't valid syntax. + if (isJSXEnabled) { + return tsParseMaybeAssignWithJSX(noIn, isWithinParens); + } else { + return tsParseMaybeAssignWithoutJSX(noIn, isWithinParens); + } +} + +export function tsParseMaybeAssignWithJSX(noIn, isWithinParens) { + if (!match(tt.lessThan)) { + return baseParseMaybeAssign(noIn, isWithinParens); + } + + // Prefer to parse JSX if possible. But may be an arrow fn. + const snapshot = state.snapshot(); + let wasArrow = baseParseMaybeAssign(noIn, isWithinParens); + if (state.error) { + state.restoreFromSnapshot(snapshot); + } else { + return wasArrow; + } + + // Otherwise, try as type-parameterized arrow function. + state.type = tt.typeParameterStart; + // This is similar to TypeScript's `tryParseParenthesizedArrowFunctionExpression`. + tsParseTypeParameters(); + wasArrow = baseParseMaybeAssign(noIn, isWithinParens); + if (!wasArrow) { + unexpected(); + } + + return wasArrow; +} + +export function tsParseMaybeAssignWithoutJSX(noIn, isWithinParens) { + if (!match(tt.lessThan)) { + return baseParseMaybeAssign(noIn, isWithinParens); + } + + const snapshot = state.snapshot(); + // This is similar to TypeScript's `tryParseParenthesizedArrowFunctionExpression`. + tsParseTypeParameters(); + const wasArrow = baseParseMaybeAssign(noIn, isWithinParens); + if (!wasArrow) { + unexpected(); + } + if (state.error) { + state.restoreFromSnapshot(snapshot); + } else { + return wasArrow; + } + + // Try parsing a type cast instead of an arrow function. + // This will start with a type assertion (via parseMaybeUnary). + // But don't directly call `tsParseTypeAssertion` because we want to handle any binary after it. + return baseParseMaybeAssign(noIn, isWithinParens); +} + +export function tsParseArrow() { + if (match(tt.colon)) { + // This is different from how the TS parser does it. + // TS uses lookahead. Babylon parses it as a parenthesized expression and converts. + const snapshot = state.snapshot(); + + tsParseTypeOrTypePredicateAnnotation(tt.colon); + if (canInsertSemicolon()) unexpected(); + if (!match(tt.arrow)) unexpected(); + + if (state.error) { + state.restoreFromSnapshot(snapshot); + } + } + return eat(tt.arrow); +} + +// Allow type annotations inside of a parameter list. +export function tsParseAssignableListItemTypes() { + const oldIsType = pushTypeContext(0); + eat(tt.question); + tsTryParseTypeAnnotation(); + popTypeContext(oldIsType); +} + +export function tsParseMaybeDecoratorArguments() { + if (match(tt.lessThan) || match(tt.bitShiftL)) { + tsParseTypeArgumentsWithPossibleBitshift(); + } + baseParseMaybeDecoratorArguments(); +} diff --git a/node_modules/sucrase/dist/esm/parser/tokenizer/index.js b/node_modules/sucrase/dist/esm/parser/tokenizer/index.js new file mode 100644 index 00000000..69f286ab --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/tokenizer/index.js @@ -0,0 +1,1004 @@ +/* eslint max-len: 0 */ + +import {input, isFlowEnabled, state} from "../traverser/base"; +import {unexpected} from "../traverser/util"; +import {charCodes} from "../util/charcodes"; +import {IS_IDENTIFIER_CHAR, IS_IDENTIFIER_START} from "../util/identifier"; +import {IS_WHITESPACE, skipWhiteSpace} from "../util/whitespace"; +import {ContextualKeyword} from "./keywords"; +import readWord from "./readWord"; +import { TokenType as tt} from "./types"; + +export var IdentifierRole; (function (IdentifierRole) { + const Access = 0; IdentifierRole[IdentifierRole["Access"] = Access] = "Access"; + const ExportAccess = Access + 1; IdentifierRole[IdentifierRole["ExportAccess"] = ExportAccess] = "ExportAccess"; + const TopLevelDeclaration = ExportAccess + 1; IdentifierRole[IdentifierRole["TopLevelDeclaration"] = TopLevelDeclaration] = "TopLevelDeclaration"; + const FunctionScopedDeclaration = TopLevelDeclaration + 1; IdentifierRole[IdentifierRole["FunctionScopedDeclaration"] = FunctionScopedDeclaration] = "FunctionScopedDeclaration"; + const BlockScopedDeclaration = FunctionScopedDeclaration + 1; IdentifierRole[IdentifierRole["BlockScopedDeclaration"] = BlockScopedDeclaration] = "BlockScopedDeclaration"; + const ObjectShorthandTopLevelDeclaration = BlockScopedDeclaration + 1; IdentifierRole[IdentifierRole["ObjectShorthandTopLevelDeclaration"] = ObjectShorthandTopLevelDeclaration] = "ObjectShorthandTopLevelDeclaration"; + const ObjectShorthandFunctionScopedDeclaration = ObjectShorthandTopLevelDeclaration + 1; IdentifierRole[IdentifierRole["ObjectShorthandFunctionScopedDeclaration"] = ObjectShorthandFunctionScopedDeclaration] = "ObjectShorthandFunctionScopedDeclaration"; + const ObjectShorthandBlockScopedDeclaration = ObjectShorthandFunctionScopedDeclaration + 1; IdentifierRole[IdentifierRole["ObjectShorthandBlockScopedDeclaration"] = ObjectShorthandBlockScopedDeclaration] = "ObjectShorthandBlockScopedDeclaration"; + const ObjectShorthand = ObjectShorthandBlockScopedDeclaration + 1; IdentifierRole[IdentifierRole["ObjectShorthand"] = ObjectShorthand] = "ObjectShorthand"; + // Any identifier bound in an import statement, e.g. both A and b from + // `import A, * as b from 'A';` + const ImportDeclaration = ObjectShorthand + 1; IdentifierRole[IdentifierRole["ImportDeclaration"] = ImportDeclaration] = "ImportDeclaration"; + const ObjectKey = ImportDeclaration + 1; IdentifierRole[IdentifierRole["ObjectKey"] = ObjectKey] = "ObjectKey"; + // The `foo` in `import {foo as bar} from "./abc";`. + const ImportAccess = ObjectKey + 1; IdentifierRole[IdentifierRole["ImportAccess"] = ImportAccess] = "ImportAccess"; +})(IdentifierRole || (IdentifierRole = {})); + +/** + * Extra information on jsxTagStart tokens, used to determine which of the three + * jsx functions are called in the automatic transform. + */ +export var JSXRole; (function (JSXRole) { + // The element is self-closing or has a body that resolves to empty. We + // shouldn't emit children at all in this case. + const NoChildren = 0; JSXRole[JSXRole["NoChildren"] = NoChildren] = "NoChildren"; + // The element has a single explicit child, which might still be an arbitrary + // expression like an array. We should emit that expression as the children. + const OneChild = NoChildren + 1; JSXRole[JSXRole["OneChild"] = OneChild] = "OneChild"; + // The element has at least two explicitly-specified children or has spread + // children, so child positions are assumed to be "static". We should wrap + // these children in an array. + const StaticChildren = OneChild + 1; JSXRole[JSXRole["StaticChildren"] = StaticChildren] = "StaticChildren"; + // The element has a prop named "key" after a prop spread, so we should fall + // back to the createElement function. + const KeyAfterPropSpread = StaticChildren + 1; JSXRole[JSXRole["KeyAfterPropSpread"] = KeyAfterPropSpread] = "KeyAfterPropSpread"; +})(JSXRole || (JSXRole = {})); + +export function isDeclaration(token) { + const role = token.identifierRole; + return ( + role === IdentifierRole.TopLevelDeclaration || + role === IdentifierRole.FunctionScopedDeclaration || + role === IdentifierRole.BlockScopedDeclaration || + role === IdentifierRole.ObjectShorthandTopLevelDeclaration || + role === IdentifierRole.ObjectShorthandFunctionScopedDeclaration || + role === IdentifierRole.ObjectShorthandBlockScopedDeclaration + ); +} + +export function isNonTopLevelDeclaration(token) { + const role = token.identifierRole; + return ( + role === IdentifierRole.FunctionScopedDeclaration || + role === IdentifierRole.BlockScopedDeclaration || + role === IdentifierRole.ObjectShorthandFunctionScopedDeclaration || + role === IdentifierRole.ObjectShorthandBlockScopedDeclaration + ); +} + +export function isTopLevelDeclaration(token) { + const role = token.identifierRole; + return ( + role === IdentifierRole.TopLevelDeclaration || + role === IdentifierRole.ObjectShorthandTopLevelDeclaration || + role === IdentifierRole.ImportDeclaration + ); +} + +export function isBlockScopedDeclaration(token) { + const role = token.identifierRole; + // Treat top-level declarations as block scope since the distinction doesn't matter here. + return ( + role === IdentifierRole.TopLevelDeclaration || + role === IdentifierRole.BlockScopedDeclaration || + role === IdentifierRole.ObjectShorthandTopLevelDeclaration || + role === IdentifierRole.ObjectShorthandBlockScopedDeclaration + ); +} + +export function isFunctionScopedDeclaration(token) { + const role = token.identifierRole; + return ( + role === IdentifierRole.FunctionScopedDeclaration || + role === IdentifierRole.ObjectShorthandFunctionScopedDeclaration + ); +} + +export function isObjectShorthandDeclaration(token) { + return ( + token.identifierRole === IdentifierRole.ObjectShorthandTopLevelDeclaration || + token.identifierRole === IdentifierRole.ObjectShorthandBlockScopedDeclaration || + token.identifierRole === IdentifierRole.ObjectShorthandFunctionScopedDeclaration + ); +} + +// Object type used to represent tokens. Note that normally, tokens +// simply exist as properties on the parser object. This is only +// used for the onToken callback and the external tokenizer. +export class Token { + constructor() { + this.type = state.type; + this.contextualKeyword = state.contextualKeyword; + this.start = state.start; + this.end = state.end; + this.scopeDepth = state.scopeDepth; + this.isType = state.isType; + this.identifierRole = null; + this.jsxRole = null; + this.shadowsGlobal = false; + this.isAsyncOperation = false; + this.contextId = null; + this.rhsEndIndex = null; + this.isExpression = false; + this.numNullishCoalesceStarts = 0; + this.numNullishCoalesceEnds = 0; + this.isOptionalChainStart = false; + this.isOptionalChainEnd = false; + this.subscriptStartIndex = null; + this.nullishStartIndex = null; + } + + + + + + + + + + // Initially false for all tokens, then may be computed in a follow-up step that does scope + // analysis. + + // Initially false for all tokens, but may be set during transform to mark it as containing an + // await operation. + + + // For assignments, the index of the RHS. For export tokens, the end of the export. + + // For class tokens, records if the class is a class expression or a class statement. + + // Number of times to insert a `nullishCoalesce(` snippet before this token. + + // Number of times to insert a `)` snippet after this token. + + // If true, insert an `optionalChain([` snippet before this token. + + // If true, insert a `])` snippet after this token. + + // Tag for `.`, `?.`, `[`, `?.[`, `(`, and `?.(` to denote the "root" token for this + // subscript chain. This can be used to determine if this chain is an optional chain. + + // Tag for `??` operators to denote the root token for this nullish coalescing call. + +} + +// ## Tokenizer + +// Move to the next token +export function next() { + state.tokens.push(new Token()); + nextToken(); +} + +// Call instead of next when inside a template, since that needs to be handled differently. +export function nextTemplateToken() { + state.tokens.push(new Token()); + state.start = state.pos; + readTmplToken(); +} + +// The tokenizer never parses regexes by default. Instead, the parser is responsible for +// instructing it to parse a regex when we see a slash at the start of an expression. +export function retokenizeSlashAsRegex() { + if (state.type === tt.assign) { + --state.pos; + } + readRegexp(); +} + +export function pushTypeContext(existingTokensInType) { + for (let i = state.tokens.length - existingTokensInType; i < state.tokens.length; i++) { + state.tokens[i].isType = true; + } + const oldIsType = state.isType; + state.isType = true; + return oldIsType; +} + +export function popTypeContext(oldIsType) { + state.isType = oldIsType; +} + +export function eat(type) { + if (match(type)) { + next(); + return true; + } else { + return false; + } +} + +export function eatTypeToken(tokenType) { + const oldIsType = state.isType; + state.isType = true; + eat(tokenType); + state.isType = oldIsType; +} + +export function match(type) { + return state.type === type; +} + +export function lookaheadType() { + const snapshot = state.snapshot(); + next(); + const type = state.type; + state.restoreFromSnapshot(snapshot); + return type; +} + +export class TypeAndKeyword { + + + constructor(type, contextualKeyword) { + this.type = type; + this.contextualKeyword = contextualKeyword; + } +} + +export function lookaheadTypeAndKeyword() { + const snapshot = state.snapshot(); + next(); + const type = state.type; + const contextualKeyword = state.contextualKeyword; + state.restoreFromSnapshot(snapshot); + return new TypeAndKeyword(type, contextualKeyword); +} + +export function nextTokenStart() { + return nextTokenStartSince(state.pos); +} + +export function nextTokenStartSince(pos) { + skipWhiteSpace.lastIndex = pos; + const skip = skipWhiteSpace.exec(input); + return pos + skip[0].length; +} + +export function lookaheadCharCode() { + return input.charCodeAt(nextTokenStart()); +} + +// Read a single token, updating the parser object's token-related +// properties. +export function nextToken() { + skipSpace(); + state.start = state.pos; + if (state.pos >= input.length) { + const tokens = state.tokens; + // We normally run past the end a bit, but if we're way past the end, avoid an infinite loop. + // Also check the token positions rather than the types since sometimes we rewrite the token + // type to something else. + if ( + tokens.length >= 2 && + tokens[tokens.length - 1].start >= input.length && + tokens[tokens.length - 2].start >= input.length + ) { + unexpected("Unexpectedly reached the end of input."); + } + finishToken(tt.eof); + return; + } + readToken(input.charCodeAt(state.pos)); +} + +function readToken(code) { + // Identifier or keyword. '\uXXXX' sequences are allowed in + // identifiers, so '\' also dispatches to that. + if ( + IS_IDENTIFIER_START[code] || + code === charCodes.backslash || + (code === charCodes.atSign && input.charCodeAt(state.pos + 1) === charCodes.atSign) + ) { + readWord(); + } else { + getTokenFromCode(code); + } +} + +function skipBlockComment() { + while ( + input.charCodeAt(state.pos) !== charCodes.asterisk || + input.charCodeAt(state.pos + 1) !== charCodes.slash + ) { + state.pos++; + if (state.pos > input.length) { + unexpected("Unterminated comment", state.pos - 2); + return; + } + } + state.pos += 2; +} + +export function skipLineComment(startSkip) { + let ch = input.charCodeAt((state.pos += startSkip)); + if (state.pos < input.length) { + while ( + ch !== charCodes.lineFeed && + ch !== charCodes.carriageReturn && + ch !== charCodes.lineSeparator && + ch !== charCodes.paragraphSeparator && + ++state.pos < input.length + ) { + ch = input.charCodeAt(state.pos); + } + } +} + +// Called at the start of the parse and after every token. Skips +// whitespace and comments. +export function skipSpace() { + while (state.pos < input.length) { + const ch = input.charCodeAt(state.pos); + switch (ch) { + case charCodes.carriageReturn: + if (input.charCodeAt(state.pos + 1) === charCodes.lineFeed) { + ++state.pos; + } + + case charCodes.lineFeed: + case charCodes.lineSeparator: + case charCodes.paragraphSeparator: + ++state.pos; + break; + + case charCodes.slash: + switch (input.charCodeAt(state.pos + 1)) { + case charCodes.asterisk: + state.pos += 2; + skipBlockComment(); + break; + + case charCodes.slash: + skipLineComment(2); + break; + + default: + return; + } + break; + + default: + if (IS_WHITESPACE[ch]) { + ++state.pos; + } else { + return; + } + } + } +} + +// Called at the end of every token. Sets various fields, and skips the space after the token, so +// that the next one's `start` will point at the right position. +export function finishToken( + type, + contextualKeyword = ContextualKeyword.NONE, +) { + state.end = state.pos; + state.type = type; + state.contextualKeyword = contextualKeyword; +} + +// ### Token reading + +// This is the function that is called to fetch the next token. It +// is somewhat obscure, because it works in character codes rather +// than characters, and because operator parsing has been inlined +// into it. +// +// All in the name of speed. +function readToken_dot() { + const nextChar = input.charCodeAt(state.pos + 1); + if (nextChar >= charCodes.digit0 && nextChar <= charCodes.digit9) { + readNumber(true); + return; + } + + if (nextChar === charCodes.dot && input.charCodeAt(state.pos + 2) === charCodes.dot) { + state.pos += 3; + finishToken(tt.ellipsis); + } else { + ++state.pos; + finishToken(tt.dot); + } +} + +function readToken_slash() { + const nextChar = input.charCodeAt(state.pos + 1); + if (nextChar === charCodes.equalsTo) { + finishOp(tt.assign, 2); + } else { + finishOp(tt.slash, 1); + } +} + +function readToken_mult_modulo(code) { + // '%*' + let tokenType = code === charCodes.asterisk ? tt.star : tt.modulo; + let width = 1; + let nextChar = input.charCodeAt(state.pos + 1); + + // Exponentiation operator ** + if (code === charCodes.asterisk && nextChar === charCodes.asterisk) { + width++; + nextChar = input.charCodeAt(state.pos + 2); + tokenType = tt.exponent; + } + + // Match *= or %=, disallowing *=> which can be valid in flow. + if ( + nextChar === charCodes.equalsTo && + input.charCodeAt(state.pos + 2) !== charCodes.greaterThan + ) { + width++; + tokenType = tt.assign; + } + + finishOp(tokenType, width); +} + +function readToken_pipe_amp(code) { + // '|&' + const nextChar = input.charCodeAt(state.pos + 1); + + if (nextChar === code) { + if (input.charCodeAt(state.pos + 2) === charCodes.equalsTo) { + // ||= or &&= + finishOp(tt.assign, 3); + } else { + // || or && + finishOp(code === charCodes.verticalBar ? tt.logicalOR : tt.logicalAND, 2); + } + return; + } + + if (code === charCodes.verticalBar) { + // '|>' + if (nextChar === charCodes.greaterThan) { + finishOp(tt.pipeline, 2); + return; + } else if (nextChar === charCodes.rightCurlyBrace && isFlowEnabled) { + // '|}' + finishOp(tt.braceBarR, 2); + return; + } + } + + if (nextChar === charCodes.equalsTo) { + finishOp(tt.assign, 2); + return; + } + + finishOp(code === charCodes.verticalBar ? tt.bitwiseOR : tt.bitwiseAND, 1); +} + +function readToken_caret() { + // '^' + const nextChar = input.charCodeAt(state.pos + 1); + if (nextChar === charCodes.equalsTo) { + finishOp(tt.assign, 2); + } else { + finishOp(tt.bitwiseXOR, 1); + } +} + +function readToken_plus_min(code) { + // '+-' + const nextChar = input.charCodeAt(state.pos + 1); + + if (nextChar === code) { + // Tentatively call this a prefix operator, but it might be changed to postfix later. + finishOp(tt.preIncDec, 2); + return; + } + + if (nextChar === charCodes.equalsTo) { + finishOp(tt.assign, 2); + } else if (code === charCodes.plusSign) { + finishOp(tt.plus, 1); + } else { + finishOp(tt.minus, 1); + } +} + +function readToken_lt() { + const nextChar = input.charCodeAt(state.pos + 1); + + if (nextChar === charCodes.lessThan) { + if (input.charCodeAt(state.pos + 2) === charCodes.equalsTo) { + finishOp(tt.assign, 3); + return; + } + // We see <<, but need to be really careful about whether to treat it as a + // true left-shift or as two < tokens. + if (state.isType) { + // Within a type, << might come up in a snippet like `Array<() => void>`, + // so treat it as two < tokens. Importantly, this should only override << + // rather than other tokens like <= . If we treated <= as < in a type + // context, then the snippet `a as T <= 1` would incorrectly start parsing + // a type argument on T. We don't need to worry about `a as T << 1` + // because TypeScript disallows that syntax. + finishOp(tt.lessThan, 1); + } else { + // Outside a type, this might be a true left-shift operator, or it might + // still be two open-type-arg tokens, such as in `f<() => void>()`. We + // look at the token while considering the `f`, so we don't yet know that + // we're in a type context. In this case, we initially tokenize as a + // left-shift and correct after-the-fact as necessary in + // tsParseTypeArgumentsWithPossibleBitshift . + finishOp(tt.bitShiftL, 2); + } + return; + } + + if (nextChar === charCodes.equalsTo) { + // <= + finishOp(tt.relationalOrEqual, 2); + } else { + finishOp(tt.lessThan, 1); + } +} + +function readToken_gt() { + if (state.isType) { + // Avoid right-shift for things like `Array>` and + // greater-than-or-equal for things like `const a: Array=[];`. + finishOp(tt.greaterThan, 1); + return; + } + + const nextChar = input.charCodeAt(state.pos + 1); + + if (nextChar === charCodes.greaterThan) { + const size = input.charCodeAt(state.pos + 2) === charCodes.greaterThan ? 3 : 2; + if (input.charCodeAt(state.pos + size) === charCodes.equalsTo) { + finishOp(tt.assign, size + 1); + return; + } + finishOp(tt.bitShiftR, size); + return; + } + + if (nextChar === charCodes.equalsTo) { + // >= + finishOp(tt.relationalOrEqual, 2); + } else { + finishOp(tt.greaterThan, 1); + } +} + +/** + * Reinterpret a possible > token when transitioning from a type to a non-type + * context. + * + * This comes up in two situations where >= needs to be treated as one token: + * - After an `as` expression, like in the code `a as T >= 1`. + * - In a type argument in an expression context, e.g. `f(a < b, c >= d)`, we + * need to see the token as >= so that we get an error and backtrack to + * normal expression parsing. + * + * Other situations require >= to be seen as two tokens, e.g. + * `const x: Array=[];`, so it's important to treat > as its own token in + * typical type parsing situations. + */ +export function rescan_gt() { + if (state.type === tt.greaterThan) { + state.pos -= 1; + readToken_gt(); + } +} + +function readToken_eq_excl(code) { + // '=!' + const nextChar = input.charCodeAt(state.pos + 1); + if (nextChar === charCodes.equalsTo) { + finishOp(tt.equality, input.charCodeAt(state.pos + 2) === charCodes.equalsTo ? 3 : 2); + return; + } + if (code === charCodes.equalsTo && nextChar === charCodes.greaterThan) { + // '=>' + state.pos += 2; + finishToken(tt.arrow); + return; + } + finishOp(code === charCodes.equalsTo ? tt.eq : tt.bang, 1); +} + +function readToken_question() { + // '?' + const nextChar = input.charCodeAt(state.pos + 1); + const nextChar2 = input.charCodeAt(state.pos + 2); + if ( + nextChar === charCodes.questionMark && + // In Flow (but not TypeScript), ??string is a valid type that should be + // tokenized as two individual ? tokens. + !(isFlowEnabled && state.isType) + ) { + if (nextChar2 === charCodes.equalsTo) { + // '??=' + finishOp(tt.assign, 3); + } else { + // '??' + finishOp(tt.nullishCoalescing, 2); + } + } else if ( + nextChar === charCodes.dot && + !(nextChar2 >= charCodes.digit0 && nextChar2 <= charCodes.digit9) + ) { + // '.' not followed by a number + state.pos += 2; + finishToken(tt.questionDot); + } else { + ++state.pos; + finishToken(tt.question); + } +} + +export function getTokenFromCode(code) { + switch (code) { + case charCodes.numberSign: + ++state.pos; + finishToken(tt.hash); + return; + + // The interpretation of a dot depends on whether it is followed + // by a digit or another two dots. + + case charCodes.dot: + readToken_dot(); + return; + + // Punctuation tokens. + case charCodes.leftParenthesis: + ++state.pos; + finishToken(tt.parenL); + return; + case charCodes.rightParenthesis: + ++state.pos; + finishToken(tt.parenR); + return; + case charCodes.semicolon: + ++state.pos; + finishToken(tt.semi); + return; + case charCodes.comma: + ++state.pos; + finishToken(tt.comma); + return; + case charCodes.leftSquareBracket: + ++state.pos; + finishToken(tt.bracketL); + return; + case charCodes.rightSquareBracket: + ++state.pos; + finishToken(tt.bracketR); + return; + + case charCodes.leftCurlyBrace: + if (isFlowEnabled && input.charCodeAt(state.pos + 1) === charCodes.verticalBar) { + finishOp(tt.braceBarL, 2); + } else { + ++state.pos; + finishToken(tt.braceL); + } + return; + + case charCodes.rightCurlyBrace: + ++state.pos; + finishToken(tt.braceR); + return; + + case charCodes.colon: + if (input.charCodeAt(state.pos + 1) === charCodes.colon) { + finishOp(tt.doubleColon, 2); + } else { + ++state.pos; + finishToken(tt.colon); + } + return; + + case charCodes.questionMark: + readToken_question(); + return; + case charCodes.atSign: + ++state.pos; + finishToken(tt.at); + return; + + case charCodes.graveAccent: + ++state.pos; + finishToken(tt.backQuote); + return; + + case charCodes.digit0: { + const nextChar = input.charCodeAt(state.pos + 1); + // '0x', '0X', '0o', '0O', '0b', '0B' + if ( + nextChar === charCodes.lowercaseX || + nextChar === charCodes.uppercaseX || + nextChar === charCodes.lowercaseO || + nextChar === charCodes.uppercaseO || + nextChar === charCodes.lowercaseB || + nextChar === charCodes.uppercaseB + ) { + readRadixNumber(); + return; + } + } + // Anything else beginning with a digit is an integer, octal + // number, or float. + case charCodes.digit1: + case charCodes.digit2: + case charCodes.digit3: + case charCodes.digit4: + case charCodes.digit5: + case charCodes.digit6: + case charCodes.digit7: + case charCodes.digit8: + case charCodes.digit9: + readNumber(false); + return; + + // Quotes produce strings. + case charCodes.quotationMark: + case charCodes.apostrophe: + readString(code); + return; + + // Operators are parsed inline in tiny state machines. '=' (charCodes.equalsTo) is + // often referred to. `finishOp` simply skips the amount of + // characters it is given as second argument, and returns a token + // of the type given by its first argument. + + case charCodes.slash: + readToken_slash(); + return; + + case charCodes.percentSign: + case charCodes.asterisk: + readToken_mult_modulo(code); + return; + + case charCodes.verticalBar: + case charCodes.ampersand: + readToken_pipe_amp(code); + return; + + case charCodes.caret: + readToken_caret(); + return; + + case charCodes.plusSign: + case charCodes.dash: + readToken_plus_min(code); + return; + + case charCodes.lessThan: + readToken_lt(); + return; + + case charCodes.greaterThan: + readToken_gt(); + return; + + case charCodes.equalsTo: + case charCodes.exclamationMark: + readToken_eq_excl(code); + return; + + case charCodes.tilde: + finishOp(tt.tilde, 1); + return; + + default: + break; + } + + unexpected(`Unexpected character '${String.fromCharCode(code)}'`, state.pos); +} + +function finishOp(type, size) { + state.pos += size; + finishToken(type); +} + +function readRegexp() { + const start = state.pos; + let escaped = false; + let inClass = false; + for (;;) { + if (state.pos >= input.length) { + unexpected("Unterminated regular expression", start); + return; + } + const code = input.charCodeAt(state.pos); + if (escaped) { + escaped = false; + } else { + if (code === charCodes.leftSquareBracket) { + inClass = true; + } else if (code === charCodes.rightSquareBracket && inClass) { + inClass = false; + } else if (code === charCodes.slash && !inClass) { + break; + } + escaped = code === charCodes.backslash; + } + ++state.pos; + } + ++state.pos; + // Need to use `skipWord` because '\uXXXX' sequences are allowed here (don't ask). + skipWord(); + + finishToken(tt.regexp); +} + +/** + * Read a decimal integer. Note that this can't be unified with the similar code + * in readRadixNumber (which also handles hex digits) because "e" needs to be + * the end of the integer so that we can properly handle scientific notation. + */ +function readInt() { + while (true) { + const code = input.charCodeAt(state.pos); + if ((code >= charCodes.digit0 && code <= charCodes.digit9) || code === charCodes.underscore) { + state.pos++; + } else { + break; + } + } +} + +function readRadixNumber() { + state.pos += 2; // 0x + + // Walk to the end of the number, allowing hex digits. + while (true) { + const code = input.charCodeAt(state.pos); + if ( + (code >= charCodes.digit0 && code <= charCodes.digit9) || + (code >= charCodes.lowercaseA && code <= charCodes.lowercaseF) || + (code >= charCodes.uppercaseA && code <= charCodes.uppercaseF) || + code === charCodes.underscore + ) { + state.pos++; + } else { + break; + } + } + + const nextChar = input.charCodeAt(state.pos); + if (nextChar === charCodes.lowercaseN) { + ++state.pos; + finishToken(tt.bigint); + } else { + finishToken(tt.num); + } +} + +// Read an integer, octal integer, or floating-point number. +function readNumber(startsWithDot) { + let isBigInt = false; + let isDecimal = false; + + if (!startsWithDot) { + readInt(); + } + + let nextChar = input.charCodeAt(state.pos); + if (nextChar === charCodes.dot) { + ++state.pos; + readInt(); + nextChar = input.charCodeAt(state.pos); + } + + if (nextChar === charCodes.uppercaseE || nextChar === charCodes.lowercaseE) { + nextChar = input.charCodeAt(++state.pos); + if (nextChar === charCodes.plusSign || nextChar === charCodes.dash) { + ++state.pos; + } + readInt(); + nextChar = input.charCodeAt(state.pos); + } + + if (nextChar === charCodes.lowercaseN) { + ++state.pos; + isBigInt = true; + } else if (nextChar === charCodes.lowercaseM) { + ++state.pos; + isDecimal = true; + } + + if (isBigInt) { + finishToken(tt.bigint); + return; + } + + if (isDecimal) { + finishToken(tt.decimal); + return; + } + + finishToken(tt.num); +} + +function readString(quote) { + state.pos++; + for (;;) { + if (state.pos >= input.length) { + unexpected("Unterminated string constant"); + return; + } + const ch = input.charCodeAt(state.pos); + if (ch === charCodes.backslash) { + state.pos++; + } else if (ch === quote) { + break; + } + state.pos++; + } + state.pos++; + finishToken(tt.string); +} + +// Reads template string tokens. +function readTmplToken() { + for (;;) { + if (state.pos >= input.length) { + unexpected("Unterminated template"); + return; + } + const ch = input.charCodeAt(state.pos); + if ( + ch === charCodes.graveAccent || + (ch === charCodes.dollarSign && input.charCodeAt(state.pos + 1) === charCodes.leftCurlyBrace) + ) { + if (state.pos === state.start && match(tt.template)) { + if (ch === charCodes.dollarSign) { + state.pos += 2; + finishToken(tt.dollarBraceL); + return; + } else { + ++state.pos; + finishToken(tt.backQuote); + return; + } + } + finishToken(tt.template); + return; + } + if (ch === charCodes.backslash) { + state.pos++; + } + state.pos++; + } +} + +// Skip to the end of the current word. Note that this is the same as the snippet at the end of +// readWord, but calling skipWord from readWord seems to slightly hurt performance from some rough +// measurements. +export function skipWord() { + while (state.pos < input.length) { + const ch = input.charCodeAt(state.pos); + if (IS_IDENTIFIER_CHAR[ch]) { + state.pos++; + } else if (ch === charCodes.backslash) { + // \u + state.pos += 2; + if (input.charCodeAt(state.pos) === charCodes.leftCurlyBrace) { + while ( + state.pos < input.length && + input.charCodeAt(state.pos) !== charCodes.rightCurlyBrace + ) { + state.pos++; + } + state.pos++; + } + } else { + break; + } + } +} diff --git a/node_modules/sucrase/dist/esm/parser/tokenizer/keywords.js b/node_modules/sucrase/dist/esm/parser/tokenizer/keywords.js new file mode 100644 index 00000000..0dcf1b0f --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/tokenizer/keywords.js @@ -0,0 +1,43 @@ +export var ContextualKeyword; (function (ContextualKeyword) { + const NONE = 0; ContextualKeyword[ContextualKeyword["NONE"] = NONE] = "NONE"; + const _abstract = NONE + 1; ContextualKeyword[ContextualKeyword["_abstract"] = _abstract] = "_abstract"; + const _accessor = _abstract + 1; ContextualKeyword[ContextualKeyword["_accessor"] = _accessor] = "_accessor"; + const _as = _accessor + 1; ContextualKeyword[ContextualKeyword["_as"] = _as] = "_as"; + const _assert = _as + 1; ContextualKeyword[ContextualKeyword["_assert"] = _assert] = "_assert"; + const _asserts = _assert + 1; ContextualKeyword[ContextualKeyword["_asserts"] = _asserts] = "_asserts"; + const _async = _asserts + 1; ContextualKeyword[ContextualKeyword["_async"] = _async] = "_async"; + const _await = _async + 1; ContextualKeyword[ContextualKeyword["_await"] = _await] = "_await"; + const _checks = _await + 1; ContextualKeyword[ContextualKeyword["_checks"] = _checks] = "_checks"; + const _constructor = _checks + 1; ContextualKeyword[ContextualKeyword["_constructor"] = _constructor] = "_constructor"; + const _declare = _constructor + 1; ContextualKeyword[ContextualKeyword["_declare"] = _declare] = "_declare"; + const _enum = _declare + 1; ContextualKeyword[ContextualKeyword["_enum"] = _enum] = "_enum"; + const _exports = _enum + 1; ContextualKeyword[ContextualKeyword["_exports"] = _exports] = "_exports"; + const _from = _exports + 1; ContextualKeyword[ContextualKeyword["_from"] = _from] = "_from"; + const _get = _from + 1; ContextualKeyword[ContextualKeyword["_get"] = _get] = "_get"; + const _global = _get + 1; ContextualKeyword[ContextualKeyword["_global"] = _global] = "_global"; + const _implements = _global + 1; ContextualKeyword[ContextualKeyword["_implements"] = _implements] = "_implements"; + const _infer = _implements + 1; ContextualKeyword[ContextualKeyword["_infer"] = _infer] = "_infer"; + const _interface = _infer + 1; ContextualKeyword[ContextualKeyword["_interface"] = _interface] = "_interface"; + const _is = _interface + 1; ContextualKeyword[ContextualKeyword["_is"] = _is] = "_is"; + const _keyof = _is + 1; ContextualKeyword[ContextualKeyword["_keyof"] = _keyof] = "_keyof"; + const _mixins = _keyof + 1; ContextualKeyword[ContextualKeyword["_mixins"] = _mixins] = "_mixins"; + const _module = _mixins + 1; ContextualKeyword[ContextualKeyword["_module"] = _module] = "_module"; + const _namespace = _module + 1; ContextualKeyword[ContextualKeyword["_namespace"] = _namespace] = "_namespace"; + const _of = _namespace + 1; ContextualKeyword[ContextualKeyword["_of"] = _of] = "_of"; + const _opaque = _of + 1; ContextualKeyword[ContextualKeyword["_opaque"] = _opaque] = "_opaque"; + const _out = _opaque + 1; ContextualKeyword[ContextualKeyword["_out"] = _out] = "_out"; + const _override = _out + 1; ContextualKeyword[ContextualKeyword["_override"] = _override] = "_override"; + const _private = _override + 1; ContextualKeyword[ContextualKeyword["_private"] = _private] = "_private"; + const _protected = _private + 1; ContextualKeyword[ContextualKeyword["_protected"] = _protected] = "_protected"; + const _proto = _protected + 1; ContextualKeyword[ContextualKeyword["_proto"] = _proto] = "_proto"; + const _public = _proto + 1; ContextualKeyword[ContextualKeyword["_public"] = _public] = "_public"; + const _readonly = _public + 1; ContextualKeyword[ContextualKeyword["_readonly"] = _readonly] = "_readonly"; + const _require = _readonly + 1; ContextualKeyword[ContextualKeyword["_require"] = _require] = "_require"; + const _satisfies = _require + 1; ContextualKeyword[ContextualKeyword["_satisfies"] = _satisfies] = "_satisfies"; + const _set = _satisfies + 1; ContextualKeyword[ContextualKeyword["_set"] = _set] = "_set"; + const _static = _set + 1; ContextualKeyword[ContextualKeyword["_static"] = _static] = "_static"; + const _symbol = _static + 1; ContextualKeyword[ContextualKeyword["_symbol"] = _symbol] = "_symbol"; + const _type = _symbol + 1; ContextualKeyword[ContextualKeyword["_type"] = _type] = "_type"; + const _unique = _type + 1; ContextualKeyword[ContextualKeyword["_unique"] = _unique] = "_unique"; + const _using = _unique + 1; ContextualKeyword[ContextualKeyword["_using"] = _using] = "_using"; +})(ContextualKeyword || (ContextualKeyword = {})); diff --git a/node_modules/sucrase/dist/esm/parser/tokenizer/readWord.js b/node_modules/sucrase/dist/esm/parser/tokenizer/readWord.js new file mode 100644 index 00000000..cf3df89f --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/tokenizer/readWord.js @@ -0,0 +1,64 @@ +import {input, state} from "../traverser/base"; +import {charCodes} from "../util/charcodes"; +import {IS_IDENTIFIER_CHAR} from "../util/identifier"; +import {finishToken} from "./index"; +import {READ_WORD_TREE} from "./readWordTree"; +import {TokenType as tt} from "./types"; + +/** + * Read an identifier, producing either a name token or matching on one of the existing keywords. + * For performance, we pre-generate big decision tree that we traverse. Each node represents a + * prefix and has 27 values, where the first value is the token or contextual token, if any (-1 if + * not), and the other 26 values are the transitions to other nodes, or -1 to stop. + */ +export default function readWord() { + let treePos = 0; + let code = 0; + let pos = state.pos; + while (pos < input.length) { + code = input.charCodeAt(pos); + if (code < charCodes.lowercaseA || code > charCodes.lowercaseZ) { + break; + } + const next = READ_WORD_TREE[treePos + (code - charCodes.lowercaseA) + 1]; + if (next === -1) { + break; + } else { + treePos = next; + pos++; + } + } + + const keywordValue = READ_WORD_TREE[treePos]; + if (keywordValue > -1 && !IS_IDENTIFIER_CHAR[code]) { + state.pos = pos; + if (keywordValue & 1) { + finishToken(keywordValue >>> 1); + } else { + finishToken(tt.name, keywordValue >>> 1); + } + return; + } + + while (pos < input.length) { + const ch = input.charCodeAt(pos); + if (IS_IDENTIFIER_CHAR[ch]) { + pos++; + } else if (ch === charCodes.backslash) { + // \u + pos += 2; + if (input.charCodeAt(pos) === charCodes.leftCurlyBrace) { + while (pos < input.length && input.charCodeAt(pos) !== charCodes.rightCurlyBrace) { + pos++; + } + pos++; + } + } else if (ch === charCodes.atSign && input.charCodeAt(pos + 1) === charCodes.atSign) { + pos += 2; + } else { + break; + } + } + state.pos = pos; + finishToken(tt.name); +} diff --git a/node_modules/sucrase/dist/esm/parser/tokenizer/readWordTree.js b/node_modules/sucrase/dist/esm/parser/tokenizer/readWordTree.js new file mode 100644 index 00000000..ffb8cac7 --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/tokenizer/readWordTree.js @@ -0,0 +1,671 @@ +// Generated file, do not edit! Run "yarn generate" to re-generate this file. +import {ContextualKeyword} from "./keywords"; +import {TokenType as tt} from "./types"; + +// prettier-ignore +export const READ_WORD_TREE = new Int32Array([ + // "" + -1, 27, 783, 918, 1755, 2376, 2862, 3483, -1, 3699, -1, 4617, 4752, 4833, 5130, 5508, 5940, -1, 6480, 6939, 7749, 8181, 8451, 8613, -1, 8829, -1, + // "a" + -1, -1, 54, 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 432, -1, -1, -1, 675, -1, -1, -1, + // "ab" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, + // "abs" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, + // "abst" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, -1, -1, + // "abstr" + -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "abstra" + -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "abstrac" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 216, -1, -1, -1, -1, -1, -1, + // "abstract" + ContextualKeyword._abstract << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ac" + -1, -1, -1, 270, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "acc" + -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "acce" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 324, -1, -1, -1, -1, -1, -1, -1, + // "acces" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 351, -1, -1, -1, -1, -1, -1, -1, + // "access" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 378, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "accesso" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 405, -1, -1, -1, -1, -1, -1, -1, -1, + // "accessor" + ContextualKeyword._accessor << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "as" + ContextualKeyword._as << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 459, -1, -1, -1, -1, -1, 594, -1, + // "ass" + -1, -1, -1, -1, -1, 486, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "asse" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 513, -1, -1, -1, -1, -1, -1, -1, -1, + // "asser" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 540, -1, -1, -1, -1, -1, -1, + // "assert" + ContextualKeyword._assert << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 567, -1, -1, -1, -1, -1, -1, -1, + // "asserts" + ContextualKeyword._asserts << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "asy" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 621, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "asyn" + -1, -1, -1, 648, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "async" + ContextualKeyword._async << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "aw" + -1, 702, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "awa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 729, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "awai" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 756, -1, -1, -1, -1, -1, -1, + // "await" + ContextualKeyword._await << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "b" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 810, -1, -1, -1, -1, -1, -1, -1, -1, + // "br" + -1, -1, -1, -1, -1, 837, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "bre" + -1, 864, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "brea" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 891, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "break" + (tt._break << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "c" + -1, 945, -1, -1, -1, -1, -1, -1, 1107, -1, -1, -1, 1242, -1, -1, 1350, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ca" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 972, 1026, -1, -1, -1, -1, -1, -1, + // "cas" + -1, -1, -1, -1, -1, 999, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "case" + (tt._case << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "cat" + -1, -1, -1, 1053, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "catc" + -1, -1, -1, -1, -1, -1, -1, -1, 1080, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "catch" + (tt._catch << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ch" + -1, -1, -1, -1, -1, 1134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "che" + -1, -1, -1, 1161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "chec" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1188, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "check" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1215, -1, -1, -1, -1, -1, -1, -1, + // "checks" + ContextualKeyword._checks << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "cl" + -1, 1269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "cla" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1296, -1, -1, -1, -1, -1, -1, -1, + // "clas" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1323, -1, -1, -1, -1, -1, -1, -1, + // "class" + (tt._class << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "co" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1377, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "con" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1404, 1620, -1, -1, -1, -1, -1, -1, + // "cons" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1431, -1, -1, -1, -1, -1, -1, + // "const" + (tt._const << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1458, -1, -1, -1, -1, -1, -1, -1, -1, + // "constr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1485, -1, -1, -1, -1, -1, + // "constru" + -1, -1, -1, 1512, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "construc" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1539, -1, -1, -1, -1, -1, -1, + // "construct" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1566, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "constructo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1593, -1, -1, -1, -1, -1, -1, -1, -1, + // "constructor" + ContextualKeyword._constructor << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "cont" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 1647, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "conti" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1674, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "contin" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1701, -1, -1, -1, -1, -1, + // "continu" + -1, -1, -1, -1, -1, 1728, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "continue" + (tt._continue << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "d" + -1, -1, -1, -1, -1, 1782, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2349, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "de" + -1, -1, 1809, 1971, -1, -1, 2106, -1, -1, -1, -1, -1, 2241, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "deb" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1836, -1, -1, -1, -1, -1, + // "debu" + -1, -1, -1, -1, -1, -1, -1, 1863, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "debug" + -1, -1, -1, -1, -1, -1, -1, 1890, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "debugg" + -1, -1, -1, -1, -1, 1917, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "debugge" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1944, -1, -1, -1, -1, -1, -1, -1, -1, + // "debugger" + (tt._debugger << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "dec" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1998, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "decl" + -1, 2025, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "decla" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2052, -1, -1, -1, -1, -1, -1, -1, -1, + // "declar" + -1, -1, -1, -1, -1, 2079, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "declare" + ContextualKeyword._declare << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "def" + -1, 2133, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "defa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2160, -1, -1, -1, -1, -1, + // "defau" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2187, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "defaul" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2214, -1, -1, -1, -1, -1, -1, + // "default" + (tt._default << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "del" + -1, -1, -1, -1, -1, 2268, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "dele" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2295, -1, -1, -1, -1, -1, -1, + // "delet" + -1, -1, -1, -1, -1, 2322, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "delete" + (tt._delete << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "do" + (tt._do << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "e" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2403, -1, 2484, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2565, -1, -1, + // "el" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2430, -1, -1, -1, -1, -1, -1, -1, + // "els" + -1, -1, -1, -1, -1, 2457, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "else" + (tt._else << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "en" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2511, -1, -1, -1, -1, -1, + // "enu" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2538, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "enum" + ContextualKeyword._enum << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ex" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2592, -1, -1, -1, 2727, -1, -1, -1, -1, -1, -1, + // "exp" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2619, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "expo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2646, -1, -1, -1, -1, -1, -1, -1, -1, + // "expor" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2673, -1, -1, -1, -1, -1, -1, + // "export" + (tt._export << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2700, -1, -1, -1, -1, -1, -1, -1, + // "exports" + ContextualKeyword._exports << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ext" + -1, -1, -1, -1, -1, 2754, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "exte" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2781, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "exten" + -1, -1, -1, -1, 2808, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "extend" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2835, -1, -1, -1, -1, -1, -1, -1, + // "extends" + (tt._extends << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "f" + -1, 2889, -1, -1, -1, -1, -1, -1, -1, 2997, -1, -1, -1, -1, -1, 3159, -1, -1, 3213, -1, -1, 3294, -1, -1, -1, -1, -1, + // "fa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2916, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fal" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2943, -1, -1, -1, -1, -1, -1, -1, + // "fals" + -1, -1, -1, -1, -1, 2970, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "false" + (tt._false << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3024, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fin" + -1, 3051, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fina" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3078, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "final" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "finall" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3132, -1, + // "finally" + (tt._finally << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3186, -1, -1, -1, -1, -1, -1, -1, -1, + // "for" + (tt._for << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fro" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3267, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "from" + ContextualKeyword._from << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fu" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3321, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fun" + -1, -1, -1, 3348, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "func" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3375, -1, -1, -1, -1, -1, -1, + // "funct" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 3402, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "functi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3429, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "functio" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3456, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "function" + (tt._function << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "g" + -1, -1, -1, -1, -1, 3510, -1, -1, -1, -1, -1, -1, 3564, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ge" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3537, -1, -1, -1, -1, -1, -1, + // "get" + ContextualKeyword._get << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "gl" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3591, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "glo" + -1, -1, 3618, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "glob" + -1, 3645, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "globa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3672, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "global" + ContextualKeyword._global << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "i" + -1, -1, -1, -1, -1, -1, 3726, -1, -1, -1, -1, -1, -1, 3753, 4077, -1, -1, -1, -1, 4590, -1, -1, -1, -1, -1, -1, -1, + // "if" + (tt._if << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "im" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3780, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "imp" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3807, -1, -1, 3996, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "impl" + -1, -1, -1, -1, -1, 3834, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "imple" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3861, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "implem" + -1, -1, -1, -1, -1, 3888, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "impleme" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3915, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "implemen" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3942, -1, -1, -1, -1, -1, -1, + // "implement" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3969, -1, -1, -1, -1, -1, -1, -1, + // "implements" + ContextualKeyword._implements << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "impo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4023, -1, -1, -1, -1, -1, -1, -1, -1, + // "impor" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4050, -1, -1, -1, -1, -1, -1, + // "import" + (tt._import << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "in" + (tt._in << 1) + 1, -1, -1, -1, -1, -1, 4104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4185, 4401, -1, -1, -1, -1, -1, -1, + // "inf" + -1, -1, -1, -1, -1, 4131, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "infe" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4158, -1, -1, -1, -1, -1, -1, -1, -1, + // "infer" + ContextualKeyword._infer << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ins" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4212, -1, -1, -1, -1, -1, -1, + // "inst" + -1, 4239, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "insta" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4266, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "instan" + -1, -1, -1, 4293, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "instanc" + -1, -1, -1, -1, -1, 4320, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "instance" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4347, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "instanceo" + -1, -1, -1, -1, -1, -1, 4374, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "instanceof" + (tt._instanceof << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "int" + -1, -1, -1, -1, -1, 4428, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "inte" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4455, -1, -1, -1, -1, -1, -1, -1, -1, + // "inter" + -1, -1, -1, -1, -1, -1, 4482, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "interf" + -1, 4509, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "interfa" + -1, -1, -1, 4536, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "interfac" + -1, -1, -1, -1, -1, 4563, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "interface" + ContextualKeyword._interface << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "is" + ContextualKeyword._is << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "k" + -1, -1, -1, -1, -1, 4644, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ke" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4671, -1, + // "key" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4698, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "keyo" + -1, -1, -1, -1, -1, -1, 4725, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "keyof" + ContextualKeyword._keyof << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "l" + -1, -1, -1, -1, -1, 4779, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "le" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4806, -1, -1, -1, -1, -1, -1, + // "let" + (tt._let << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "m" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 4860, -1, -1, -1, -1, -1, 4995, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "mi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4887, -1, -1, + // "mix" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 4914, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "mixi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4941, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "mixin" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4968, -1, -1, -1, -1, -1, -1, -1, + // "mixins" + ContextualKeyword._mixins << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "mo" + -1, -1, -1, -1, 5022, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "mod" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5049, -1, -1, -1, -1, -1, + // "modu" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5076, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "modul" + -1, -1, -1, -1, -1, 5103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "module" + ContextualKeyword._module << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "n" + -1, 5157, -1, -1, -1, 5373, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5427, -1, -1, -1, -1, -1, + // "na" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5184, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "nam" + -1, -1, -1, -1, -1, 5211, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "name" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5238, -1, -1, -1, -1, -1, -1, -1, + // "names" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5265, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "namesp" + -1, 5292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "namespa" + -1, -1, -1, 5319, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "namespac" + -1, -1, -1, -1, -1, 5346, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "namespace" + ContextualKeyword._namespace << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ne" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5400, -1, -1, -1, + // "new" + (tt._new << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "nu" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5454, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "nul" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5481, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "null" + (tt._null << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "o" + -1, -1, -1, -1, -1, -1, 5535, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5562, -1, -1, -1, -1, 5697, 5751, -1, -1, -1, -1, + // "of" + ContextualKeyword._of << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "op" + -1, 5589, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "opa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5616, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "opaq" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5643, -1, -1, -1, -1, -1, + // "opaqu" + -1, -1, -1, -1, -1, 5670, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "opaque" + ContextualKeyword._opaque << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ou" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5724, -1, -1, -1, -1, -1, -1, + // "out" + ContextualKeyword._out << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ov" + -1, -1, -1, -1, -1, 5778, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ove" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5805, -1, -1, -1, -1, -1, -1, -1, -1, + // "over" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5832, -1, -1, -1, -1, -1, -1, -1, -1, + // "overr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 5859, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "overri" + -1, -1, -1, -1, 5886, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "overrid" + -1, -1, -1, -1, -1, 5913, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "override" + ContextualKeyword._override << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "p" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5967, -1, -1, 6345, -1, -1, -1, -1, -1, + // "pr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 5994, -1, -1, -1, -1, -1, 6129, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "pri" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6021, -1, -1, -1, -1, + // "priv" + -1, 6048, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "priva" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6075, -1, -1, -1, -1, -1, -1, + // "privat" + -1, -1, -1, -1, -1, 6102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "private" + ContextualKeyword._private << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "pro" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6156, -1, -1, -1, -1, -1, -1, + // "prot" + -1, -1, -1, -1, -1, 6183, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6318, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "prote" + -1, -1, -1, 6210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "protec" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6237, -1, -1, -1, -1, -1, -1, + // "protect" + -1, -1, -1, -1, -1, 6264, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "protecte" + -1, -1, -1, -1, 6291, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "protected" + ContextualKeyword._protected << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "proto" + ContextualKeyword._proto << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "pu" + -1, -1, 6372, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "pub" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6399, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "publ" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 6426, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "publi" + -1, -1, -1, 6453, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "public" + ContextualKeyword._public << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "r" + -1, -1, -1, -1, -1, 6507, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "re" + -1, 6534, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6696, -1, -1, 6831, -1, -1, -1, -1, -1, -1, + // "rea" + -1, -1, -1, -1, 6561, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "read" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6588, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "reado" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6615, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "readon" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6642, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "readonl" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6669, -1, + // "readonly" + ContextualKeyword._readonly << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "req" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6723, -1, -1, -1, -1, -1, + // "requ" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 6750, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "requi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6777, -1, -1, -1, -1, -1, -1, -1, -1, + // "requir" + -1, -1, -1, -1, -1, 6804, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "require" + ContextualKeyword._require << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ret" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6858, -1, -1, -1, -1, -1, + // "retu" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6885, -1, -1, -1, -1, -1, -1, -1, -1, + // "retur" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6912, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "return" + (tt._return << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "s" + -1, 6966, -1, -1, -1, 7182, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7236, 7371, -1, 7479, -1, 7614, -1, + // "sa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6993, -1, -1, -1, -1, -1, -1, + // "sat" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7020, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sati" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7047, -1, -1, -1, -1, -1, -1, -1, + // "satis" + -1, -1, -1, -1, -1, -1, 7074, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "satisf" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "satisfi" + -1, -1, -1, -1, -1, 7128, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "satisfie" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7155, -1, -1, -1, -1, -1, -1, -1, + // "satisfies" + ContextualKeyword._satisfies << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "se" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7209, -1, -1, -1, -1, -1, -1, + // "set" + ContextualKeyword._set << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "st" + -1, 7263, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sta" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7290, -1, -1, -1, -1, -1, -1, + // "stat" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7317, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "stati" + -1, -1, -1, 7344, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "static" + ContextualKeyword._static << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "su" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7398, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sup" + -1, -1, -1, -1, -1, 7425, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "supe" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7452, -1, -1, -1, -1, -1, -1, -1, -1, + // "super" + (tt._super << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sw" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7506, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "swi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7533, -1, -1, -1, -1, -1, -1, + // "swit" + -1, -1, -1, 7560, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "switc" + -1, -1, -1, -1, -1, -1, -1, -1, 7587, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "switch" + (tt._switch << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sy" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7641, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sym" + -1, -1, 7668, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "symb" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7695, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "symbo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7722, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "symbol" + ContextualKeyword._symbol << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "t" + -1, -1, -1, -1, -1, -1, -1, -1, 7776, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7938, -1, -1, -1, -1, -1, -1, 8046, -1, + // "th" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7803, -1, -1, -1, -1, -1, -1, -1, -1, 7857, -1, -1, -1, -1, -1, -1, -1, -1, + // "thi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7830, -1, -1, -1, -1, -1, -1, -1, + // "this" + (tt._this << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "thr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7884, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "thro" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7911, -1, -1, -1, + // "throw" + (tt._throw << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "tr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7965, -1, -1, -1, 8019, -1, + // "tru" + -1, -1, -1, -1, -1, 7992, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "true" + (tt._true << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "try" + (tt._try << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ty" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8073, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "typ" + -1, -1, -1, -1, -1, 8100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "type" + ContextualKeyword._type << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8127, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "typeo" + -1, -1, -1, -1, -1, -1, 8154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "typeof" + (tt._typeof << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "u" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8208, -1, -1, -1, -1, 8343, -1, -1, -1, -1, -1, -1, -1, + // "un" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8235, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "uni" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8262, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "uniq" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8289, -1, -1, -1, -1, -1, + // "uniqu" + -1, -1, -1, -1, -1, 8316, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "unique" + ContextualKeyword._unique << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "us" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8370, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "usi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8397, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "usin" + -1, -1, -1, -1, -1, -1, -1, 8424, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "using" + ContextualKeyword._using << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "v" + -1, 8478, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8532, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "va" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8505, -1, -1, -1, -1, -1, -1, -1, -1, + // "var" + (tt._var << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "vo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8559, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "voi" + -1, -1, -1, -1, 8586, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "void" + (tt._void << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "w" + -1, -1, -1, -1, -1, -1, -1, -1, 8640, 8748, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "wh" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8667, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "whi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8694, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "whil" + -1, -1, -1, -1, -1, 8721, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "while" + (tt._while << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "wi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8775, -1, -1, -1, -1, -1, -1, + // "wit" + -1, -1, -1, -1, -1, -1, -1, -1, 8802, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "with" + (tt._with << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "y" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8856, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "yi" + -1, -1, -1, -1, -1, 8883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "yie" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8910, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "yiel" + -1, -1, -1, -1, 8937, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "yield" + (tt._yield << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +]); diff --git a/node_modules/sucrase/dist/esm/parser/tokenizer/state.js b/node_modules/sucrase/dist/esm/parser/tokenizer/state.js new file mode 100644 index 00000000..940cde08 --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/tokenizer/state.js @@ -0,0 +1,106 @@ + +import {ContextualKeyword} from "./keywords"; +import { TokenType as tt} from "./types"; + +export class Scope { + + + + + constructor(startTokenIndex, endTokenIndex, isFunctionScope) { + this.startTokenIndex = startTokenIndex; + this.endTokenIndex = endTokenIndex; + this.isFunctionScope = isFunctionScope; + } +} + +export class StateSnapshot { + constructor( + potentialArrowAt, + noAnonFunctionType, + inDisallowConditionalTypesContext, + tokensLength, + scopesLength, + pos, + type, + contextualKeyword, + start, + end, + isType, + scopeDepth, + error, + ) {;this.potentialArrowAt = potentialArrowAt;this.noAnonFunctionType = noAnonFunctionType;this.inDisallowConditionalTypesContext = inDisallowConditionalTypesContext;this.tokensLength = tokensLength;this.scopesLength = scopesLength;this.pos = pos;this.type = type;this.contextualKeyword = contextualKeyword;this.start = start;this.end = end;this.isType = isType;this.scopeDepth = scopeDepth;this.error = error;} +} + +export default class State {constructor() { State.prototype.__init.call(this);State.prototype.__init2.call(this);State.prototype.__init3.call(this);State.prototype.__init4.call(this);State.prototype.__init5.call(this);State.prototype.__init6.call(this);State.prototype.__init7.call(this);State.prototype.__init8.call(this);State.prototype.__init9.call(this);State.prototype.__init10.call(this);State.prototype.__init11.call(this);State.prototype.__init12.call(this);State.prototype.__init13.call(this); } + // Used to signify the start of a potential arrow function + __init() {this.potentialArrowAt = -1} + + // Used by Flow to handle an edge case involving function type parsing. + __init2() {this.noAnonFunctionType = false} + + // Used by TypeScript to handle ambiguities when parsing conditional types. + __init3() {this.inDisallowConditionalTypesContext = false} + + // Token store. + __init4() {this.tokens = []} + + // Array of all observed scopes, ordered by their ending position. + __init5() {this.scopes = []} + + // The current position of the tokenizer in the input. + __init6() {this.pos = 0} + + // Information about the current token. + __init7() {this.type = tt.eof} + __init8() {this.contextualKeyword = ContextualKeyword.NONE} + __init9() {this.start = 0} + __init10() {this.end = 0} + + __init11() {this.isType = false} + __init12() {this.scopeDepth = 0} + + /** + * If the parser is in an error state, then the token is always tt.eof and all functions can + * keep executing but should be written so they don't get into an infinite loop in this situation. + * + * This approach, combined with the ability to snapshot and restore state, allows us to implement + * backtracking without exceptions and without needing to explicitly propagate error states + * everywhere. + */ + __init13() {this.error = null} + + snapshot() { + return new StateSnapshot( + this.potentialArrowAt, + this.noAnonFunctionType, + this.inDisallowConditionalTypesContext, + this.tokens.length, + this.scopes.length, + this.pos, + this.type, + this.contextualKeyword, + this.start, + this.end, + this.isType, + this.scopeDepth, + this.error, + ); + } + + restoreFromSnapshot(snapshot) { + this.potentialArrowAt = snapshot.potentialArrowAt; + this.noAnonFunctionType = snapshot.noAnonFunctionType; + this.inDisallowConditionalTypesContext = snapshot.inDisallowConditionalTypesContext; + this.tokens.length = snapshot.tokensLength; + this.scopes.length = snapshot.scopesLength; + this.pos = snapshot.pos; + this.type = snapshot.type; + this.contextualKeyword = snapshot.contextualKeyword; + this.start = snapshot.start; + this.end = snapshot.end; + this.isType = snapshot.isType; + this.scopeDepth = snapshot.scopeDepth; + this.error = snapshot.error; + } +} diff --git a/node_modules/sucrase/dist/esm/parser/tokenizer/types.js b/node_modules/sucrase/dist/esm/parser/tokenizer/types.js new file mode 100644 index 00000000..9746ad67 --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/tokenizer/types.js @@ -0,0 +1,361 @@ +// Generated file, do not edit! Run "yarn generate" to re-generate this file. +/* istanbul ignore file */ +/** + * Enum of all token types, with bit fields to signify meaningful properties. + */ +export var TokenType; (function (TokenType) { + // Precedence 0 means not an operator; otherwise it is a positive number up to 12. + const PRECEDENCE_MASK = 0xf; TokenType[TokenType["PRECEDENCE_MASK"] = PRECEDENCE_MASK] = "PRECEDENCE_MASK"; + const IS_KEYWORD = 1 << 4; TokenType[TokenType["IS_KEYWORD"] = IS_KEYWORD] = "IS_KEYWORD"; + const IS_ASSIGN = 1 << 5; TokenType[TokenType["IS_ASSIGN"] = IS_ASSIGN] = "IS_ASSIGN"; + const IS_RIGHT_ASSOCIATIVE = 1 << 6; TokenType[TokenType["IS_RIGHT_ASSOCIATIVE"] = IS_RIGHT_ASSOCIATIVE] = "IS_RIGHT_ASSOCIATIVE"; + const IS_PREFIX = 1 << 7; TokenType[TokenType["IS_PREFIX"] = IS_PREFIX] = "IS_PREFIX"; + const IS_POSTFIX = 1 << 8; TokenType[TokenType["IS_POSTFIX"] = IS_POSTFIX] = "IS_POSTFIX"; + const IS_EXPRESSION_START = 1 << 9; TokenType[TokenType["IS_EXPRESSION_START"] = IS_EXPRESSION_START] = "IS_EXPRESSION_START"; + + const num = 512; TokenType[TokenType["num"] = num] = "num"; // num startsExpr + const bigint = 1536; TokenType[TokenType["bigint"] = bigint] = "bigint"; // bigint startsExpr + const decimal = 2560; TokenType[TokenType["decimal"] = decimal] = "decimal"; // decimal startsExpr + const regexp = 3584; TokenType[TokenType["regexp"] = regexp] = "regexp"; // regexp startsExpr + const string = 4608; TokenType[TokenType["string"] = string] = "string"; // string startsExpr + const name = 5632; TokenType[TokenType["name"] = name] = "name"; // name startsExpr + const eof = 6144; TokenType[TokenType["eof"] = eof] = "eof"; // eof + const bracketL = 7680; TokenType[TokenType["bracketL"] = bracketL] = "bracketL"; // [ startsExpr + const bracketR = 8192; TokenType[TokenType["bracketR"] = bracketR] = "bracketR"; // ] + const braceL = 9728; TokenType[TokenType["braceL"] = braceL] = "braceL"; // { startsExpr + const braceBarL = 10752; TokenType[TokenType["braceBarL"] = braceBarL] = "braceBarL"; // {| startsExpr + const braceR = 11264; TokenType[TokenType["braceR"] = braceR] = "braceR"; // } + const braceBarR = 12288; TokenType[TokenType["braceBarR"] = braceBarR] = "braceBarR"; // |} + const parenL = 13824; TokenType[TokenType["parenL"] = parenL] = "parenL"; // ( startsExpr + const parenR = 14336; TokenType[TokenType["parenR"] = parenR] = "parenR"; // ) + const comma = 15360; TokenType[TokenType["comma"] = comma] = "comma"; // , + const semi = 16384; TokenType[TokenType["semi"] = semi] = "semi"; // ; + const colon = 17408; TokenType[TokenType["colon"] = colon] = "colon"; // : + const doubleColon = 18432; TokenType[TokenType["doubleColon"] = doubleColon] = "doubleColon"; // :: + const dot = 19456; TokenType[TokenType["dot"] = dot] = "dot"; // . + const question = 20480; TokenType[TokenType["question"] = question] = "question"; // ? + const questionDot = 21504; TokenType[TokenType["questionDot"] = questionDot] = "questionDot"; // ?. + const arrow = 22528; TokenType[TokenType["arrow"] = arrow] = "arrow"; // => + const template = 23552; TokenType[TokenType["template"] = template] = "template"; // template + const ellipsis = 24576; TokenType[TokenType["ellipsis"] = ellipsis] = "ellipsis"; // ... + const backQuote = 25600; TokenType[TokenType["backQuote"] = backQuote] = "backQuote"; // ` + const dollarBraceL = 27136; TokenType[TokenType["dollarBraceL"] = dollarBraceL] = "dollarBraceL"; // ${ startsExpr + const at = 27648; TokenType[TokenType["at"] = at] = "at"; // @ + const hash = 29184; TokenType[TokenType["hash"] = hash] = "hash"; // # startsExpr + const eq = 29728; TokenType[TokenType["eq"] = eq] = "eq"; // = isAssign + const assign = 30752; TokenType[TokenType["assign"] = assign] = "assign"; // _= isAssign + const preIncDec = 32640; TokenType[TokenType["preIncDec"] = preIncDec] = "preIncDec"; // ++/-- prefix postfix startsExpr + const postIncDec = 33664; TokenType[TokenType["postIncDec"] = postIncDec] = "postIncDec"; // ++/-- prefix postfix startsExpr + const bang = 34432; TokenType[TokenType["bang"] = bang] = "bang"; // ! prefix startsExpr + const tilde = 35456; TokenType[TokenType["tilde"] = tilde] = "tilde"; // ~ prefix startsExpr + const pipeline = 35841; TokenType[TokenType["pipeline"] = pipeline] = "pipeline"; // |> prec:1 + const nullishCoalescing = 36866; TokenType[TokenType["nullishCoalescing"] = nullishCoalescing] = "nullishCoalescing"; // ?? prec:2 + const logicalOR = 37890; TokenType[TokenType["logicalOR"] = logicalOR] = "logicalOR"; // || prec:2 + const logicalAND = 38915; TokenType[TokenType["logicalAND"] = logicalAND] = "logicalAND"; // && prec:3 + const bitwiseOR = 39940; TokenType[TokenType["bitwiseOR"] = bitwiseOR] = "bitwiseOR"; // | prec:4 + const bitwiseXOR = 40965; TokenType[TokenType["bitwiseXOR"] = bitwiseXOR] = "bitwiseXOR"; // ^ prec:5 + const bitwiseAND = 41990; TokenType[TokenType["bitwiseAND"] = bitwiseAND] = "bitwiseAND"; // & prec:6 + const equality = 43015; TokenType[TokenType["equality"] = equality] = "equality"; // ==/!= prec:7 + const lessThan = 44040; TokenType[TokenType["lessThan"] = lessThan] = "lessThan"; // < prec:8 + const greaterThan = 45064; TokenType[TokenType["greaterThan"] = greaterThan] = "greaterThan"; // > prec:8 + const relationalOrEqual = 46088; TokenType[TokenType["relationalOrEqual"] = relationalOrEqual] = "relationalOrEqual"; // <=/>= prec:8 + const bitShiftL = 47113; TokenType[TokenType["bitShiftL"] = bitShiftL] = "bitShiftL"; // << prec:9 + const bitShiftR = 48137; TokenType[TokenType["bitShiftR"] = bitShiftR] = "bitShiftR"; // >>/>>> prec:9 + const plus = 49802; TokenType[TokenType["plus"] = plus] = "plus"; // + prec:10 prefix startsExpr + const minus = 50826; TokenType[TokenType["minus"] = minus] = "minus"; // - prec:10 prefix startsExpr + const modulo = 51723; TokenType[TokenType["modulo"] = modulo] = "modulo"; // % prec:11 startsExpr + const star = 52235; TokenType[TokenType["star"] = star] = "star"; // * prec:11 + const slash = 53259; TokenType[TokenType["slash"] = slash] = "slash"; // / prec:11 + const exponent = 54348; TokenType[TokenType["exponent"] = exponent] = "exponent"; // ** prec:12 rightAssociative + const jsxName = 55296; TokenType[TokenType["jsxName"] = jsxName] = "jsxName"; // jsxName + const jsxText = 56320; TokenType[TokenType["jsxText"] = jsxText] = "jsxText"; // jsxText + const jsxEmptyText = 57344; TokenType[TokenType["jsxEmptyText"] = jsxEmptyText] = "jsxEmptyText"; // jsxEmptyText + const jsxTagStart = 58880; TokenType[TokenType["jsxTagStart"] = jsxTagStart] = "jsxTagStart"; // jsxTagStart startsExpr + const jsxTagEnd = 59392; TokenType[TokenType["jsxTagEnd"] = jsxTagEnd] = "jsxTagEnd"; // jsxTagEnd + const typeParameterStart = 60928; TokenType[TokenType["typeParameterStart"] = typeParameterStart] = "typeParameterStart"; // typeParameterStart startsExpr + const nonNullAssertion = 61440; TokenType[TokenType["nonNullAssertion"] = nonNullAssertion] = "nonNullAssertion"; // nonNullAssertion + const _break = 62480; TokenType[TokenType["_break"] = _break] = "_break"; // break keyword + const _case = 63504; TokenType[TokenType["_case"] = _case] = "_case"; // case keyword + const _catch = 64528; TokenType[TokenType["_catch"] = _catch] = "_catch"; // catch keyword + const _continue = 65552; TokenType[TokenType["_continue"] = _continue] = "_continue"; // continue keyword + const _debugger = 66576; TokenType[TokenType["_debugger"] = _debugger] = "_debugger"; // debugger keyword + const _default = 67600; TokenType[TokenType["_default"] = _default] = "_default"; // default keyword + const _do = 68624; TokenType[TokenType["_do"] = _do] = "_do"; // do keyword + const _else = 69648; TokenType[TokenType["_else"] = _else] = "_else"; // else keyword + const _finally = 70672; TokenType[TokenType["_finally"] = _finally] = "_finally"; // finally keyword + const _for = 71696; TokenType[TokenType["_for"] = _for] = "_for"; // for keyword + const _function = 73232; TokenType[TokenType["_function"] = _function] = "_function"; // function keyword startsExpr + const _if = 73744; TokenType[TokenType["_if"] = _if] = "_if"; // if keyword + const _return = 74768; TokenType[TokenType["_return"] = _return] = "_return"; // return keyword + const _switch = 75792; TokenType[TokenType["_switch"] = _switch] = "_switch"; // switch keyword + const _throw = 77456; TokenType[TokenType["_throw"] = _throw] = "_throw"; // throw keyword prefix startsExpr + const _try = 77840; TokenType[TokenType["_try"] = _try] = "_try"; // try keyword + const _var = 78864; TokenType[TokenType["_var"] = _var] = "_var"; // var keyword + const _let = 79888; TokenType[TokenType["_let"] = _let] = "_let"; // let keyword + const _const = 80912; TokenType[TokenType["_const"] = _const] = "_const"; // const keyword + const _while = 81936; TokenType[TokenType["_while"] = _while] = "_while"; // while keyword + const _with = 82960; TokenType[TokenType["_with"] = _with] = "_with"; // with keyword + const _new = 84496; TokenType[TokenType["_new"] = _new] = "_new"; // new keyword startsExpr + const _this = 85520; TokenType[TokenType["_this"] = _this] = "_this"; // this keyword startsExpr + const _super = 86544; TokenType[TokenType["_super"] = _super] = "_super"; // super keyword startsExpr + const _class = 87568; TokenType[TokenType["_class"] = _class] = "_class"; // class keyword startsExpr + const _extends = 88080; TokenType[TokenType["_extends"] = _extends] = "_extends"; // extends keyword + const _export = 89104; TokenType[TokenType["_export"] = _export] = "_export"; // export keyword + const _import = 90640; TokenType[TokenType["_import"] = _import] = "_import"; // import keyword startsExpr + const _yield = 91664; TokenType[TokenType["_yield"] = _yield] = "_yield"; // yield keyword startsExpr + const _null = 92688; TokenType[TokenType["_null"] = _null] = "_null"; // null keyword startsExpr + const _true = 93712; TokenType[TokenType["_true"] = _true] = "_true"; // true keyword startsExpr + const _false = 94736; TokenType[TokenType["_false"] = _false] = "_false"; // false keyword startsExpr + const _in = 95256; TokenType[TokenType["_in"] = _in] = "_in"; // in prec:8 keyword + const _instanceof = 96280; TokenType[TokenType["_instanceof"] = _instanceof] = "_instanceof"; // instanceof prec:8 keyword + const _typeof = 97936; TokenType[TokenType["_typeof"] = _typeof] = "_typeof"; // typeof keyword prefix startsExpr + const _void = 98960; TokenType[TokenType["_void"] = _void] = "_void"; // void keyword prefix startsExpr + const _delete = 99984; TokenType[TokenType["_delete"] = _delete] = "_delete"; // delete keyword prefix startsExpr + const _async = 100880; TokenType[TokenType["_async"] = _async] = "_async"; // async keyword startsExpr + const _get = 101904; TokenType[TokenType["_get"] = _get] = "_get"; // get keyword startsExpr + const _set = 102928; TokenType[TokenType["_set"] = _set] = "_set"; // set keyword startsExpr + const _declare = 103952; TokenType[TokenType["_declare"] = _declare] = "_declare"; // declare keyword startsExpr + const _readonly = 104976; TokenType[TokenType["_readonly"] = _readonly] = "_readonly"; // readonly keyword startsExpr + const _abstract = 106000; TokenType[TokenType["_abstract"] = _abstract] = "_abstract"; // abstract keyword startsExpr + const _static = 107024; TokenType[TokenType["_static"] = _static] = "_static"; // static keyword startsExpr + const _public = 107536; TokenType[TokenType["_public"] = _public] = "_public"; // public keyword + const _private = 108560; TokenType[TokenType["_private"] = _private] = "_private"; // private keyword + const _protected = 109584; TokenType[TokenType["_protected"] = _protected] = "_protected"; // protected keyword + const _override = 110608; TokenType[TokenType["_override"] = _override] = "_override"; // override keyword + const _as = 112144; TokenType[TokenType["_as"] = _as] = "_as"; // as keyword startsExpr + const _enum = 113168; TokenType[TokenType["_enum"] = _enum] = "_enum"; // enum keyword startsExpr + const _type = 114192; TokenType[TokenType["_type"] = _type] = "_type"; // type keyword startsExpr + const _implements = 115216; TokenType[TokenType["_implements"] = _implements] = "_implements"; // implements keyword startsExpr +})(TokenType || (TokenType = {})); +export function formatTokenType(tokenType) { + switch (tokenType) { + case TokenType.num: + return "num"; + case TokenType.bigint: + return "bigint"; + case TokenType.decimal: + return "decimal"; + case TokenType.regexp: + return "regexp"; + case TokenType.string: + return "string"; + case TokenType.name: + return "name"; + case TokenType.eof: + return "eof"; + case TokenType.bracketL: + return "["; + case TokenType.bracketR: + return "]"; + case TokenType.braceL: + return "{"; + case TokenType.braceBarL: + return "{|"; + case TokenType.braceR: + return "}"; + case TokenType.braceBarR: + return "|}"; + case TokenType.parenL: + return "("; + case TokenType.parenR: + return ")"; + case TokenType.comma: + return ","; + case TokenType.semi: + return ";"; + case TokenType.colon: + return ":"; + case TokenType.doubleColon: + return "::"; + case TokenType.dot: + return "."; + case TokenType.question: + return "?"; + case TokenType.questionDot: + return "?."; + case TokenType.arrow: + return "=>"; + case TokenType.template: + return "template"; + case TokenType.ellipsis: + return "..."; + case TokenType.backQuote: + return "`"; + case TokenType.dollarBraceL: + return "${"; + case TokenType.at: + return "@"; + case TokenType.hash: + return "#"; + case TokenType.eq: + return "="; + case TokenType.assign: + return "_="; + case TokenType.preIncDec: + return "++/--"; + case TokenType.postIncDec: + return "++/--"; + case TokenType.bang: + return "!"; + case TokenType.tilde: + return "~"; + case TokenType.pipeline: + return "|>"; + case TokenType.nullishCoalescing: + return "??"; + case TokenType.logicalOR: + return "||"; + case TokenType.logicalAND: + return "&&"; + case TokenType.bitwiseOR: + return "|"; + case TokenType.bitwiseXOR: + return "^"; + case TokenType.bitwiseAND: + return "&"; + case TokenType.equality: + return "==/!="; + case TokenType.lessThan: + return "<"; + case TokenType.greaterThan: + return ">"; + case TokenType.relationalOrEqual: + return "<=/>="; + case TokenType.bitShiftL: + return "<<"; + case TokenType.bitShiftR: + return ">>/>>>"; + case TokenType.plus: + return "+"; + case TokenType.minus: + return "-"; + case TokenType.modulo: + return "%"; + case TokenType.star: + return "*"; + case TokenType.slash: + return "/"; + case TokenType.exponent: + return "**"; + case TokenType.jsxName: + return "jsxName"; + case TokenType.jsxText: + return "jsxText"; + case TokenType.jsxEmptyText: + return "jsxEmptyText"; + case TokenType.jsxTagStart: + return "jsxTagStart"; + case TokenType.jsxTagEnd: + return "jsxTagEnd"; + case TokenType.typeParameterStart: + return "typeParameterStart"; + case TokenType.nonNullAssertion: + return "nonNullAssertion"; + case TokenType._break: + return "break"; + case TokenType._case: + return "case"; + case TokenType._catch: + return "catch"; + case TokenType._continue: + return "continue"; + case TokenType._debugger: + return "debugger"; + case TokenType._default: + return "default"; + case TokenType._do: + return "do"; + case TokenType._else: + return "else"; + case TokenType._finally: + return "finally"; + case TokenType._for: + return "for"; + case TokenType._function: + return "function"; + case TokenType._if: + return "if"; + case TokenType._return: + return "return"; + case TokenType._switch: + return "switch"; + case TokenType._throw: + return "throw"; + case TokenType._try: + return "try"; + case TokenType._var: + return "var"; + case TokenType._let: + return "let"; + case TokenType._const: + return "const"; + case TokenType._while: + return "while"; + case TokenType._with: + return "with"; + case TokenType._new: + return "new"; + case TokenType._this: + return "this"; + case TokenType._super: + return "super"; + case TokenType._class: + return "class"; + case TokenType._extends: + return "extends"; + case TokenType._export: + return "export"; + case TokenType._import: + return "import"; + case TokenType._yield: + return "yield"; + case TokenType._null: + return "null"; + case TokenType._true: + return "true"; + case TokenType._false: + return "false"; + case TokenType._in: + return "in"; + case TokenType._instanceof: + return "instanceof"; + case TokenType._typeof: + return "typeof"; + case TokenType._void: + return "void"; + case TokenType._delete: + return "delete"; + case TokenType._async: + return "async"; + case TokenType._get: + return "get"; + case TokenType._set: + return "set"; + case TokenType._declare: + return "declare"; + case TokenType._readonly: + return "readonly"; + case TokenType._abstract: + return "abstract"; + case TokenType._static: + return "static"; + case TokenType._public: + return "public"; + case TokenType._private: + return "private"; + case TokenType._protected: + return "protected"; + case TokenType._override: + return "override"; + case TokenType._as: + return "as"; + case TokenType._enum: + return "enum"; + case TokenType._type: + return "type"; + case TokenType._implements: + return "implements"; + default: + return ""; + } +} diff --git a/node_modules/sucrase/dist/esm/parser/traverser/base.js b/node_modules/sucrase/dist/esm/parser/traverser/base.js new file mode 100644 index 00000000..df24ff70 --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/traverser/base.js @@ -0,0 +1,60 @@ +import State from "../tokenizer/state"; +import {charCodes} from "../util/charcodes"; + +export let isJSXEnabled; +export let isTypeScriptEnabled; +export let isFlowEnabled; +export let state; +export let input; +export let nextContextId; + +export function getNextContextId() { + return nextContextId++; +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function augmentError(error) { + if ("pos" in error) { + const loc = locationForIndex(error.pos); + error.message += ` (${loc.line}:${loc.column})`; + error.loc = loc; + } + return error; +} + +export class Loc { + + + constructor(line, column) { + this.line = line; + this.column = column; + } +} + +export function locationForIndex(pos) { + let line = 1; + let column = 1; + for (let i = 0; i < pos; i++) { + if (input.charCodeAt(i) === charCodes.lineFeed) { + line++; + column = 1; + } else { + column++; + } + } + return new Loc(line, column); +} + +export function initParser( + inputCode, + isJSXEnabledArg, + isTypeScriptEnabledArg, + isFlowEnabledArg, +) { + input = inputCode; + state = new State(); + nextContextId = 1; + isJSXEnabled = isJSXEnabledArg; + isTypeScriptEnabled = isTypeScriptEnabledArg; + isFlowEnabled = isFlowEnabledArg; +} diff --git a/node_modules/sucrase/dist/esm/parser/traverser/expression.js b/node_modules/sucrase/dist/esm/parser/traverser/expression.js new file mode 100644 index 00000000..aa6717fc --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/traverser/expression.js @@ -0,0 +1,1022 @@ +/* eslint max-len: 0 */ + +// A recursive descent parser operates by defining functions for all +// syntactic elements, and recursively calling those, each function +// advancing the input stream and returning an AST node. Precedence +// of constructs (for example, the fact that `!x[1]` means `!(x[1])` +// instead of `(!x)[1]` is handled by the fact that the parser +// function that parses unary prefix operators is called first, and +// in turn calls the function that parses `[]` subscripts — that +// way, it'll receive the node for `x[1]` already parsed, and wraps +// *that* in the unary operator node. +// +// Acorn uses an [operator precedence parser][opp] to handle binary +// operator precedence, because it is much more compact than using +// the technique outlined above, which uses different, nesting +// functions to specify precedence, for all of the ten binary +// precedence levels that JavaScript defines. +// +// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser + +import { + flowParseArrow, + flowParseFunctionBodyAndFinish, + flowParseMaybeAssign, + flowParseSubscript, + flowParseSubscripts, + flowParseVariance, + flowStartParseAsyncArrowFromCallExpression, + flowStartParseNewArguments, + flowStartParseObjPropValue, +} from "../plugins/flow"; +import {jsxParseElement} from "../plugins/jsx/index"; +import {typedParseConditional, typedParseParenItem} from "../plugins/types"; +import { + tsParseArrow, + tsParseFunctionBodyAndFinish, + tsParseMaybeAssign, + tsParseSubscript, + tsParseType, + tsParseTypeAssertion, + tsStartParseAsyncArrowFromCallExpression, + tsStartParseObjPropValue, +} from "../plugins/typescript"; +import { + eat, + IdentifierRole, + lookaheadCharCode, + lookaheadType, + match, + next, + nextTemplateToken, + popTypeContext, + pushTypeContext, + rescan_gt, + retokenizeSlashAsRegex, +} from "../tokenizer/index"; +import {ContextualKeyword} from "../tokenizer/keywords"; +import {Scope} from "../tokenizer/state"; +import {TokenType, TokenType as tt} from "../tokenizer/types"; +import {charCodes} from "../util/charcodes"; +import {IS_IDENTIFIER_START} from "../util/identifier"; +import {getNextContextId, isFlowEnabled, isJSXEnabled, isTypeScriptEnabled, state} from "./base"; +import { + markPriorBindingIdentifier, + parseBindingIdentifier, + parseMaybeDefault, + parseRest, + parseSpread, +} from "./lval"; +import { + parseBlock, + parseBlockBody, + parseClass, + parseDecorators, + parseFunction, + parseFunctionParams, +} from "./statement"; +import { + canInsertSemicolon, + eatContextual, + expect, + expectContextual, + hasFollowingLineBreak, + hasPrecedingLineBreak, + isContextual, + unexpected, +} from "./util"; + +export class StopState { + + constructor(stop) { + this.stop = stop; + } +} + +// ### Expression parsing + +// These nest, from the most general expression type at the top to +// 'atomic', nondivisible expression types at the bottom. Most of +// the functions will simply let the function (s) below them parse, +// and, *if* the syntactic construct they handle is present, wrap +// the AST node that the inner parser gave them in another node. +export function parseExpression(noIn = false) { + parseMaybeAssign(noIn); + if (match(tt.comma)) { + while (eat(tt.comma)) { + parseMaybeAssign(noIn); + } + } +} + +/** + * noIn is used when parsing a for loop so that we don't interpret a following "in" as the binary + * operatior. + * isWithinParens is used to indicate that we're parsing something that might be a comma expression + * or might be an arrow function or might be a Flow type assertion (which requires explicit parens). + * In these cases, we should allow : and ?: after the initial "left" part. + */ +export function parseMaybeAssign(noIn = false, isWithinParens = false) { + if (isTypeScriptEnabled) { + return tsParseMaybeAssign(noIn, isWithinParens); + } else if (isFlowEnabled) { + return flowParseMaybeAssign(noIn, isWithinParens); + } else { + return baseParseMaybeAssign(noIn, isWithinParens); + } +} + +// Parse an assignment expression. This includes applications of +// operators like `+=`. +// Returns true if the expression was an arrow function. +export function baseParseMaybeAssign(noIn, isWithinParens) { + if (match(tt._yield)) { + parseYield(); + return false; + } + + if (match(tt.parenL) || match(tt.name) || match(tt._yield)) { + state.potentialArrowAt = state.start; + } + + const wasArrow = parseMaybeConditional(noIn); + if (isWithinParens) { + parseParenItem(); + } + if (state.type & TokenType.IS_ASSIGN) { + next(); + parseMaybeAssign(noIn); + return false; + } + return wasArrow; +} + +// Parse a ternary conditional (`?:`) operator. +// Returns true if the expression was an arrow function. +function parseMaybeConditional(noIn) { + const wasArrow = parseExprOps(noIn); + if (wasArrow) { + return true; + } + parseConditional(noIn); + return false; +} + +function parseConditional(noIn) { + if (isTypeScriptEnabled || isFlowEnabled) { + typedParseConditional(noIn); + } else { + baseParseConditional(noIn); + } +} + +export function baseParseConditional(noIn) { + if (eat(tt.question)) { + parseMaybeAssign(); + expect(tt.colon); + parseMaybeAssign(noIn); + } +} + +// Start the precedence parser. +// Returns true if this was an arrow function +function parseExprOps(noIn) { + const startTokenIndex = state.tokens.length; + const wasArrow = parseMaybeUnary(); + if (wasArrow) { + return true; + } + parseExprOp(startTokenIndex, -1, noIn); + return false; +} + +// Parse binary operators with the operator precedence parsing +// algorithm. `left` is the left-hand side of the operator. +// `minPrec` provides context that allows the function to stop and +// defer further parser to one of its callers when it encounters an +// operator that has a lower precedence than the set it is parsing. +function parseExprOp(startTokenIndex, minPrec, noIn) { + if ( + isTypeScriptEnabled && + (tt._in & TokenType.PRECEDENCE_MASK) > minPrec && + !hasPrecedingLineBreak() && + (eatContextual(ContextualKeyword._as) || eatContextual(ContextualKeyword._satisfies)) + ) { + const oldIsType = pushTypeContext(1); + tsParseType(); + popTypeContext(oldIsType); + rescan_gt(); + parseExprOp(startTokenIndex, minPrec, noIn); + return; + } + + const prec = state.type & TokenType.PRECEDENCE_MASK; + if (prec > 0 && (!noIn || !match(tt._in))) { + if (prec > minPrec) { + const op = state.type; + next(); + if (op === tt.nullishCoalescing) { + state.tokens[state.tokens.length - 1].nullishStartIndex = startTokenIndex; + } + + const rhsStartTokenIndex = state.tokens.length; + parseMaybeUnary(); + // Extend the right operand of this operator if possible. + parseExprOp(rhsStartTokenIndex, op & TokenType.IS_RIGHT_ASSOCIATIVE ? prec - 1 : prec, noIn); + if (op === tt.nullishCoalescing) { + state.tokens[startTokenIndex].numNullishCoalesceStarts++; + state.tokens[state.tokens.length - 1].numNullishCoalesceEnds++; + } + // Continue with any future operator holding this expression as the left operand. + parseExprOp(startTokenIndex, minPrec, noIn); + } + } +} + +// Parse unary operators, both prefix and postfix. +// Returns true if this was an arrow function. +export function parseMaybeUnary() { + if (isTypeScriptEnabled && !isJSXEnabled && eat(tt.lessThan)) { + tsParseTypeAssertion(); + return false; + } + if ( + isContextual(ContextualKeyword._module) && + lookaheadCharCode() === charCodes.leftCurlyBrace && + !hasFollowingLineBreak() + ) { + parseModuleExpression(); + return false; + } + if (state.type & TokenType.IS_PREFIX) { + next(); + parseMaybeUnary(); + return false; + } + + const wasArrow = parseExprSubscripts(); + if (wasArrow) { + return true; + } + while (state.type & TokenType.IS_POSTFIX && !canInsertSemicolon()) { + // The tokenizer calls everything a preincrement, so make it a postincrement when + // we see it in that context. + if (state.type === tt.preIncDec) { + state.type = tt.postIncDec; + } + next(); + } + return false; +} + +// Parse call, dot, and `[]`-subscript expressions. +// Returns true if this was an arrow function. +export function parseExprSubscripts() { + const startTokenIndex = state.tokens.length; + const wasArrow = parseExprAtom(); + if (wasArrow) { + return true; + } + parseSubscripts(startTokenIndex); + // If there was any optional chain operation, the start token would be marked + // as such, so also mark the end now. + if (state.tokens.length > startTokenIndex && state.tokens[startTokenIndex].isOptionalChainStart) { + state.tokens[state.tokens.length - 1].isOptionalChainEnd = true; + } + return false; +} + +function parseSubscripts(startTokenIndex, noCalls = false) { + if (isFlowEnabled) { + flowParseSubscripts(startTokenIndex, noCalls); + } else { + baseParseSubscripts(startTokenIndex, noCalls); + } +} + +export function baseParseSubscripts(startTokenIndex, noCalls = false) { + const stopState = new StopState(false); + do { + parseSubscript(startTokenIndex, noCalls, stopState); + } while (!stopState.stop && !state.error); +} + +function parseSubscript(startTokenIndex, noCalls, stopState) { + if (isTypeScriptEnabled) { + tsParseSubscript(startTokenIndex, noCalls, stopState); + } else if (isFlowEnabled) { + flowParseSubscript(startTokenIndex, noCalls, stopState); + } else { + baseParseSubscript(startTokenIndex, noCalls, stopState); + } +} + +/** Set 'state.stop = true' to indicate that we should stop parsing subscripts. */ +export function baseParseSubscript( + startTokenIndex, + noCalls, + stopState, +) { + if (!noCalls && eat(tt.doubleColon)) { + parseNoCallExpr(); + stopState.stop = true; + // Propagate startTokenIndex so that `a::b?.()` will keep `a` as the first token. We may want + // to revisit this in the future when fully supporting bind syntax. + parseSubscripts(startTokenIndex, noCalls); + } else if (match(tt.questionDot)) { + state.tokens[startTokenIndex].isOptionalChainStart = true; + if (noCalls && lookaheadType() === tt.parenL) { + stopState.stop = true; + return; + } + next(); + state.tokens[state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + + if (eat(tt.bracketL)) { + parseExpression(); + expect(tt.bracketR); + } else if (eat(tt.parenL)) { + parseCallExpressionArguments(); + } else { + parseMaybePrivateName(); + } + } else if (eat(tt.dot)) { + state.tokens[state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + parseMaybePrivateName(); + } else if (eat(tt.bracketL)) { + state.tokens[state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + parseExpression(); + expect(tt.bracketR); + } else if (!noCalls && match(tt.parenL)) { + if (atPossibleAsync()) { + // We see "async", but it's possible it's a usage of the name "async". Parse as if it's a + // function call, and if we see an arrow later, backtrack and re-parse as a parameter list. + const snapshot = state.snapshot(); + const asyncStartTokenIndex = state.tokens.length; + next(); + state.tokens[state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + + const callContextId = getNextContextId(); + + state.tokens[state.tokens.length - 1].contextId = callContextId; + parseCallExpressionArguments(); + state.tokens[state.tokens.length - 1].contextId = callContextId; + + if (shouldParseAsyncArrow()) { + // We hit an arrow, so backtrack and start again parsing function parameters. + state.restoreFromSnapshot(snapshot); + stopState.stop = true; + state.scopeDepth++; + + parseFunctionParams(); + parseAsyncArrowFromCallExpression(asyncStartTokenIndex); + } + } else { + next(); + state.tokens[state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + const callContextId = getNextContextId(); + state.tokens[state.tokens.length - 1].contextId = callContextId; + parseCallExpressionArguments(); + state.tokens[state.tokens.length - 1].contextId = callContextId; + } + } else if (match(tt.backQuote)) { + // Tagged template expression. + parseTemplate(); + } else { + stopState.stop = true; + } +} + +export function atPossibleAsync() { + // This was made less strict than the original version to avoid passing around nodes, but it + // should be safe to have rare false positives here. + return ( + state.tokens[state.tokens.length - 1].contextualKeyword === ContextualKeyword._async && + !canInsertSemicolon() + ); +} + +export function parseCallExpressionArguments() { + let first = true; + while (!eat(tt.parenR) && !state.error) { + if (first) { + first = false; + } else { + expect(tt.comma); + if (eat(tt.parenR)) { + break; + } + } + + parseExprListItem(false); + } +} + +function shouldParseAsyncArrow() { + return match(tt.colon) || match(tt.arrow); +} + +function parseAsyncArrowFromCallExpression(startTokenIndex) { + if (isTypeScriptEnabled) { + tsStartParseAsyncArrowFromCallExpression(); + } else if (isFlowEnabled) { + flowStartParseAsyncArrowFromCallExpression(); + } + expect(tt.arrow); + parseArrowExpression(startTokenIndex); +} + +// Parse a no-call expression (like argument of `new` or `::` operators). + +function parseNoCallExpr() { + const startTokenIndex = state.tokens.length; + parseExprAtom(); + parseSubscripts(startTokenIndex, true); +} + +// Parse an atomic expression — either a single token that is an +// expression, an expression started by a keyword like `function` or +// `new`, or an expression wrapped in punctuation like `()`, `[]`, +// or `{}`. +// Returns true if the parsed expression was an arrow function. +export function parseExprAtom() { + if (eat(tt.modulo)) { + // V8 intrinsic expression. Just parse the identifier, and the function invocation is parsed + // naturally. + parseIdentifier(); + return false; + } + + if (match(tt.jsxText) || match(tt.jsxEmptyText)) { + parseLiteral(); + return false; + } else if (match(tt.lessThan) && isJSXEnabled) { + state.type = tt.jsxTagStart; + jsxParseElement(); + next(); + return false; + } + + const canBeArrow = state.potentialArrowAt === state.start; + switch (state.type) { + case tt.slash: + case tt.assign: + retokenizeSlashAsRegex(); + // Fall through. + + case tt._super: + case tt._this: + case tt.regexp: + case tt.num: + case tt.bigint: + case tt.decimal: + case tt.string: + case tt._null: + case tt._true: + case tt._false: + next(); + return false; + + case tt._import: + next(); + if (match(tt.dot)) { + // import.meta + state.tokens[state.tokens.length - 1].type = tt.name; + next(); + parseIdentifier(); + } + return false; + + case tt.name: { + const startTokenIndex = state.tokens.length; + const functionStart = state.start; + const contextualKeyword = state.contextualKeyword; + parseIdentifier(); + if (contextualKeyword === ContextualKeyword._await) { + parseAwait(); + return false; + } else if ( + contextualKeyword === ContextualKeyword._async && + match(tt._function) && + !canInsertSemicolon() + ) { + next(); + parseFunction(functionStart, false); + return false; + } else if ( + canBeArrow && + contextualKeyword === ContextualKeyword._async && + !canInsertSemicolon() && + match(tt.name) + ) { + state.scopeDepth++; + parseBindingIdentifier(false); + expect(tt.arrow); + // let foo = async bar => {}; + parseArrowExpression(startTokenIndex); + return true; + } else if (match(tt._do) && !canInsertSemicolon()) { + next(); + parseBlock(); + return false; + } + + if (canBeArrow && !canInsertSemicolon() && match(tt.arrow)) { + state.scopeDepth++; + markPriorBindingIdentifier(false); + expect(tt.arrow); + parseArrowExpression(startTokenIndex); + return true; + } + + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.Access; + return false; + } + + case tt._do: { + next(); + parseBlock(); + return false; + } + + case tt.parenL: { + const wasArrow = parseParenAndDistinguishExpression(canBeArrow); + return wasArrow; + } + + case tt.bracketL: + next(); + parseExprList(tt.bracketR, true); + return false; + + case tt.braceL: + parseObj(false, false); + return false; + + case tt._function: + parseFunctionExpression(); + return false; + + case tt.at: + parseDecorators(); + // Fall through. + + case tt._class: + parseClass(false); + return false; + + case tt._new: + parseNew(); + return false; + + case tt.backQuote: + parseTemplate(); + return false; + + case tt.doubleColon: { + next(); + parseNoCallExpr(); + return false; + } + + case tt.hash: { + const code = lookaheadCharCode(); + if (IS_IDENTIFIER_START[code] || code === charCodes.backslash) { + parseMaybePrivateName(); + } else { + next(); + } + // Smart pipeline topic reference. + return false; + } + + default: + unexpected(); + return false; + } +} + +function parseMaybePrivateName() { + eat(tt.hash); + parseIdentifier(); +} + +function parseFunctionExpression() { + const functionStart = state.start; + parseIdentifier(); + if (eat(tt.dot)) { + // function.sent + parseIdentifier(); + } + parseFunction(functionStart, false); +} + +export function parseLiteral() { + next(); +} + +export function parseParenExpression() { + expect(tt.parenL); + parseExpression(); + expect(tt.parenR); +} + +// Returns true if this was an arrow expression. +function parseParenAndDistinguishExpression(canBeArrow) { + // Assume this is a normal parenthesized expression, but if we see an arrow, we'll bail and + // start over as a parameter list. + const snapshot = state.snapshot(); + + const startTokenIndex = state.tokens.length; + expect(tt.parenL); + + let first = true; + + while (!match(tt.parenR) && !state.error) { + if (first) { + first = false; + } else { + expect(tt.comma); + if (match(tt.parenR)) { + break; + } + } + + if (match(tt.ellipsis)) { + parseRest(false /* isBlockScope */); + parseParenItem(); + break; + } else { + parseMaybeAssign(false, true); + } + } + + expect(tt.parenR); + + if (canBeArrow && shouldParseArrow()) { + const wasArrow = parseArrow(); + if (wasArrow) { + // It was an arrow function this whole time, so start over and parse it as params so that we + // get proper token annotations. + state.restoreFromSnapshot(snapshot); + state.scopeDepth++; + // Don't specify a context ID because arrow functions don't need a context ID. + parseFunctionParams(); + parseArrow(); + parseArrowExpression(startTokenIndex); + if (state.error) { + // Nevermind! This must have been something that looks very much like an + // arrow function but where its "parameter list" isn't actually a valid + // parameter list. Force non-arrow parsing. + // See https://github.com/alangpierce/sucrase/issues/666 for an example. + state.restoreFromSnapshot(snapshot); + parseParenAndDistinguishExpression(false); + return false; + } + return true; + } + } + + return false; +} + +function shouldParseArrow() { + return match(tt.colon) || !canInsertSemicolon(); +} + +// Returns whether there was an arrow token. +export function parseArrow() { + if (isTypeScriptEnabled) { + return tsParseArrow(); + } else if (isFlowEnabled) { + return flowParseArrow(); + } else { + return eat(tt.arrow); + } +} + +function parseParenItem() { + if (isTypeScriptEnabled || isFlowEnabled) { + typedParseParenItem(); + } +} + +// New's precedence is slightly tricky. It must allow its argument to +// be a `[]` or dot subscript expression, but not a call — at least, +// not without wrapping it in parentheses. Thus, it uses the noCalls +// argument to parseSubscripts to prevent it from consuming the +// argument list. +function parseNew() { + expect(tt._new); + if (eat(tt.dot)) { + // new.target + parseIdentifier(); + return; + } + parseNewCallee(); + if (isFlowEnabled) { + flowStartParseNewArguments(); + } + if (eat(tt.parenL)) { + parseExprList(tt.parenR); + } +} + +function parseNewCallee() { + parseNoCallExpr(); + eat(tt.questionDot); +} + +export function parseTemplate() { + // Finish `, read quasi + nextTemplateToken(); + // Finish quasi, read ${ + nextTemplateToken(); + while (!match(tt.backQuote) && !state.error) { + expect(tt.dollarBraceL); + parseExpression(); + // Finish }, read quasi + nextTemplateToken(); + // Finish quasi, read either ${ or ` + nextTemplateToken(); + } + next(); +} + +// Parse an object literal or binding pattern. +export function parseObj(isPattern, isBlockScope) { + // Attach a context ID to the object open and close brace and each object key. + const contextId = getNextContextId(); + let first = true; + + next(); + state.tokens[state.tokens.length - 1].contextId = contextId; + + while (!eat(tt.braceR) && !state.error) { + if (first) { + first = false; + } else { + expect(tt.comma); + if (eat(tt.braceR)) { + break; + } + } + + let isGenerator = false; + if (match(tt.ellipsis)) { + const previousIndex = state.tokens.length; + parseSpread(); + if (isPattern) { + // Mark role when the only thing being spread over is an identifier. + if (state.tokens.length === previousIndex + 2) { + markPriorBindingIdentifier(isBlockScope); + } + if (eat(tt.braceR)) { + break; + } + } + continue; + } + + if (!isPattern) { + isGenerator = eat(tt.star); + } + + if (!isPattern && isContextual(ContextualKeyword._async)) { + if (isGenerator) unexpected(); + + parseIdentifier(); + if ( + match(tt.colon) || + match(tt.parenL) || + match(tt.braceR) || + match(tt.eq) || + match(tt.comma) + ) { + // This is a key called "async" rather than an async function. + } else { + if (match(tt.star)) { + next(); + isGenerator = true; + } + parsePropertyName(contextId); + } + } else { + parsePropertyName(contextId); + } + + parseObjPropValue(isPattern, isBlockScope, contextId); + } + + state.tokens[state.tokens.length - 1].contextId = contextId; +} + +function isGetterOrSetterMethod(isPattern) { + // We go off of the next and don't bother checking if the node key is actually "get" or "set". + // This lets us avoid generating a node, and should only make the validation worse. + return ( + !isPattern && + (match(tt.string) || // get "string"() {} + match(tt.num) || // get 1() {} + match(tt.bracketL) || // get ["string"]() {} + match(tt.name) || // get foo() {} + !!(state.type & TokenType.IS_KEYWORD)) // get debugger() {} + ); +} + +// Returns true if this was a method. +function parseObjectMethod(isPattern, objectContextId) { + // We don't need to worry about modifiers because object methods can't have optional bodies, so + // the start will never be used. + const functionStart = state.start; + if (match(tt.parenL)) { + if (isPattern) unexpected(); + parseMethod(functionStart, /* isConstructor */ false); + return true; + } + + if (isGetterOrSetterMethod(isPattern)) { + parsePropertyName(objectContextId); + parseMethod(functionStart, /* isConstructor */ false); + return true; + } + return false; +} + +function parseObjectProperty(isPattern, isBlockScope) { + if (eat(tt.colon)) { + if (isPattern) { + parseMaybeDefault(isBlockScope); + } else { + parseMaybeAssign(false); + } + return; + } + + // Since there's no colon, we assume this is an object shorthand. + + // If we're in a destructuring, we've now discovered that the key was actually an assignee, so + // we need to tag it as a declaration with the appropriate scope. Otherwise, we might need to + // transform it on access, so mark it as a normal object shorthand. + let identifierRole; + if (isPattern) { + if (state.scopeDepth === 0) { + identifierRole = IdentifierRole.ObjectShorthandTopLevelDeclaration; + } else if (isBlockScope) { + identifierRole = IdentifierRole.ObjectShorthandBlockScopedDeclaration; + } else { + identifierRole = IdentifierRole.ObjectShorthandFunctionScopedDeclaration; + } + } else { + identifierRole = IdentifierRole.ObjectShorthand; + } + state.tokens[state.tokens.length - 1].identifierRole = identifierRole; + + // Regardless of whether we know this to be a pattern or if we're in an ambiguous context, allow + // parsing as if there's a default value. + parseMaybeDefault(isBlockScope, true); +} + +function parseObjPropValue( + isPattern, + isBlockScope, + objectContextId, +) { + if (isTypeScriptEnabled) { + tsStartParseObjPropValue(); + } else if (isFlowEnabled) { + flowStartParseObjPropValue(); + } + const wasMethod = parseObjectMethod(isPattern, objectContextId); + if (!wasMethod) { + parseObjectProperty(isPattern, isBlockScope); + } +} + +export function parsePropertyName(objectContextId) { + if (isFlowEnabled) { + flowParseVariance(); + } + if (eat(tt.bracketL)) { + state.tokens[state.tokens.length - 1].contextId = objectContextId; + parseMaybeAssign(); + expect(tt.bracketR); + state.tokens[state.tokens.length - 1].contextId = objectContextId; + } else { + if (match(tt.num) || match(tt.string) || match(tt.bigint) || match(tt.decimal)) { + parseExprAtom(); + } else { + parseMaybePrivateName(); + } + + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ObjectKey; + state.tokens[state.tokens.length - 1].contextId = objectContextId; + } +} + +// Parse object or class method. +export function parseMethod(functionStart, isConstructor) { + const funcContextId = getNextContextId(); + + state.scopeDepth++; + const startTokenIndex = state.tokens.length; + const allowModifiers = isConstructor; // For TypeScript parameter properties + parseFunctionParams(allowModifiers, funcContextId); + parseFunctionBodyAndFinish(functionStart, funcContextId); + const endTokenIndex = state.tokens.length; + state.scopes.push(new Scope(startTokenIndex, endTokenIndex, true)); + state.scopeDepth--; +} + +// Parse arrow function expression. +// If the parameters are provided, they will be converted to an +// assignable list. +export function parseArrowExpression(startTokenIndex) { + parseFunctionBody(true); + const endTokenIndex = state.tokens.length; + state.scopes.push(new Scope(startTokenIndex, endTokenIndex, true)); + state.scopeDepth--; +} + +export function parseFunctionBodyAndFinish(functionStart, funcContextId = 0) { + if (isTypeScriptEnabled) { + tsParseFunctionBodyAndFinish(functionStart, funcContextId); + } else if (isFlowEnabled) { + flowParseFunctionBodyAndFinish(funcContextId); + } else { + parseFunctionBody(false, funcContextId); + } +} + +export function parseFunctionBody(allowExpression, funcContextId = 0) { + const isExpression = allowExpression && !match(tt.braceL); + + if (isExpression) { + parseMaybeAssign(); + } else { + parseBlock(true /* isFunctionScope */, funcContextId); + } +} + +// Parses a comma-separated list of expressions, and returns them as +// an array. `close` is the token type that ends the list, and +// `allowEmpty` can be turned on to allow subsequent commas with +// nothing in between them to be parsed as `null` (which is needed +// for array literals). + +function parseExprList(close, allowEmpty = false) { + let first = true; + while (!eat(close) && !state.error) { + if (first) { + first = false; + } else { + expect(tt.comma); + if (eat(close)) break; + } + parseExprListItem(allowEmpty); + } +} + +function parseExprListItem(allowEmpty) { + if (allowEmpty && match(tt.comma)) { + // Empty item; nothing more to parse for this item. + } else if (match(tt.ellipsis)) { + parseSpread(); + parseParenItem(); + } else if (match(tt.question)) { + // Partial function application proposal. + next(); + } else { + parseMaybeAssign(false, true); + } +} + +// Parse the next token as an identifier. +export function parseIdentifier() { + next(); + state.tokens[state.tokens.length - 1].type = tt.name; +} + +// Parses await expression inside async function. +function parseAwait() { + parseMaybeUnary(); +} + +// Parses yield expression inside generator. +function parseYield() { + next(); + if (!match(tt.semi) && !canInsertSemicolon()) { + eat(tt.star); + parseMaybeAssign(); + } +} + +// https://github.com/tc39/proposal-js-module-blocks +function parseModuleExpression() { + expectContextual(ContextualKeyword._module); + expect(tt.braceL); + // For now, just call parseBlockBody to parse the block. In the future when we + // implement full support, we'll want to emit scopes and possibly other + // information. + parseBlockBody(tt.braceR); +} diff --git a/node_modules/sucrase/dist/esm/parser/traverser/index.js b/node_modules/sucrase/dist/esm/parser/traverser/index.js new file mode 100644 index 00000000..eb8c990a --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/traverser/index.js @@ -0,0 +1,18 @@ + +import {nextToken, skipLineComment} from "../tokenizer/index"; +import {charCodes} from "../util/charcodes"; +import {input, state} from "./base"; +import {parseTopLevel} from "./statement"; + +export function parseFile() { + // If enabled, skip leading hashbang line. + if ( + state.pos === 0 && + input.charCodeAt(0) === charCodes.numberSign && + input.charCodeAt(1) === charCodes.exclamationMark + ) { + skipLineComment(2); + } + nextToken(); + return parseTopLevel(); +} diff --git a/node_modules/sucrase/dist/esm/parser/traverser/lval.js b/node_modules/sucrase/dist/esm/parser/traverser/lval.js new file mode 100644 index 00000000..f5c4855e --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/traverser/lval.js @@ -0,0 +1,159 @@ +import {flowParseAssignableListItemTypes} from "../plugins/flow"; +import {tsParseAssignableListItemTypes, tsParseModifiers} from "../plugins/typescript"; +import { + eat, + IdentifierRole, + match, + next, + popTypeContext, + pushTypeContext, +} from "../tokenizer/index"; +import {ContextualKeyword} from "../tokenizer/keywords"; +import {TokenType, TokenType as tt} from "../tokenizer/types"; +import {isFlowEnabled, isTypeScriptEnabled, state} from "./base"; +import {parseIdentifier, parseMaybeAssign, parseObj} from "./expression"; +import {expect, unexpected} from "./util"; + +export function parseSpread() { + next(); + parseMaybeAssign(false); +} + +export function parseRest(isBlockScope) { + next(); + parseBindingAtom(isBlockScope); +} + +export function parseBindingIdentifier(isBlockScope) { + parseIdentifier(); + markPriorBindingIdentifier(isBlockScope); +} + +export function parseImportedIdentifier() { + parseIdentifier(); + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ImportDeclaration; +} + +export function markPriorBindingIdentifier(isBlockScope) { + let identifierRole; + if (state.scopeDepth === 0) { + identifierRole = IdentifierRole.TopLevelDeclaration; + } else if (isBlockScope) { + identifierRole = IdentifierRole.BlockScopedDeclaration; + } else { + identifierRole = IdentifierRole.FunctionScopedDeclaration; + } + state.tokens[state.tokens.length - 1].identifierRole = identifierRole; +} + +// Parses lvalue (assignable) atom. +export function parseBindingAtom(isBlockScope) { + switch (state.type) { + case tt._this: { + // In TypeScript, "this" may be the name of a parameter, so allow it. + const oldIsType = pushTypeContext(0); + next(); + popTypeContext(oldIsType); + return; + } + + case tt._yield: + case tt.name: { + state.type = tt.name; + parseBindingIdentifier(isBlockScope); + return; + } + + case tt.bracketL: { + next(); + parseBindingList(tt.bracketR, isBlockScope, true /* allowEmpty */); + return; + } + + case tt.braceL: + parseObj(true, isBlockScope); + return; + + default: + unexpected(); + } +} + +export function parseBindingList( + close, + isBlockScope, + allowEmpty = false, + allowModifiers = false, + contextId = 0, +) { + let first = true; + + let hasRemovedComma = false; + const firstItemTokenIndex = state.tokens.length; + + while (!eat(close) && !state.error) { + if (first) { + first = false; + } else { + expect(tt.comma); + state.tokens[state.tokens.length - 1].contextId = contextId; + // After a "this" type in TypeScript, we need to set the following comma (if any) to also be + // a type token so that it will be removed. + if (!hasRemovedComma && state.tokens[firstItemTokenIndex].isType) { + state.tokens[state.tokens.length - 1].isType = true; + hasRemovedComma = true; + } + } + if (allowEmpty && match(tt.comma)) { + // Empty item; nothing further to parse for this item. + } else if (eat(close)) { + break; + } else if (match(tt.ellipsis)) { + parseRest(isBlockScope); + parseAssignableListItemTypes(); + // Support rest element trailing commas allowed by TypeScript <2.9. + eat(TokenType.comma); + expect(close); + break; + } else { + parseAssignableListItem(allowModifiers, isBlockScope); + } + } +} + +function parseAssignableListItem(allowModifiers, isBlockScope) { + if (allowModifiers) { + tsParseModifiers([ + ContextualKeyword._public, + ContextualKeyword._protected, + ContextualKeyword._private, + ContextualKeyword._readonly, + ContextualKeyword._override, + ]); + } + + parseMaybeDefault(isBlockScope); + parseAssignableListItemTypes(); + parseMaybeDefault(isBlockScope, true /* leftAlreadyParsed */); +} + +function parseAssignableListItemTypes() { + if (isFlowEnabled) { + flowParseAssignableListItemTypes(); + } else if (isTypeScriptEnabled) { + tsParseAssignableListItemTypes(); + } +} + +// Parses assignment pattern around given atom if possible. +export function parseMaybeDefault(isBlockScope, leftAlreadyParsed = false) { + if (!leftAlreadyParsed) { + parseBindingAtom(isBlockScope); + } + if (!eat(tt.eq)) { + return; + } + const eqIndex = state.tokens.length - 1; + parseMaybeAssign(); + state.tokens[eqIndex].rhsEndIndex = state.tokens.length; +} diff --git a/node_modules/sucrase/dist/esm/parser/traverser/statement.js b/node_modules/sucrase/dist/esm/parser/traverser/statement.js new file mode 100644 index 00000000..34a6511c --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/traverser/statement.js @@ -0,0 +1,1332 @@ +/* eslint max-len: 0 */ + +import {File} from "../index"; +import { + flowAfterParseClassSuper, + flowAfterParseVarHead, + flowParseExportDeclaration, + flowParseExportStar, + flowParseIdentifierStatement, + flowParseImportSpecifier, + flowParseTypeAnnotation, + flowParseTypeParameterDeclaration, + flowShouldDisallowExportDefaultSpecifier, + flowShouldParseExportDeclaration, + flowShouldParseExportStar, + flowStartParseFunctionParams, + flowStartParseImportSpecifiers, + flowTryParseExportDefaultExpression, + flowTryParseStatement, +} from "../plugins/flow"; +import { + tsAfterParseClassSuper, + tsAfterParseVarHead, + tsIsDeclarationStart, + tsParseExportDeclaration, + tsParseExportSpecifier, + tsParseIdentifierStatement, + tsParseImportEqualsDeclaration, + tsParseImportSpecifier, + tsParseMaybeDecoratorArguments, + tsParseModifiers, + tsStartParseFunctionParams, + tsTryParseClassMemberWithIsStatic, + tsTryParseExport, + tsTryParseExportDefaultExpression, + tsTryParseStatementContent, + tsTryParseTypeAnnotation, + tsTryParseTypeParameters, +} from "../plugins/typescript"; +import { + eat, + eatTypeToken, + IdentifierRole, + lookaheadType, + lookaheadTypeAndKeyword, + match, + next, + nextTokenStart, + nextTokenStartSince, + popTypeContext, + pushTypeContext, +} from "../tokenizer"; +import {ContextualKeyword} from "../tokenizer/keywords"; +import {Scope} from "../tokenizer/state"; +import { TokenType as tt} from "../tokenizer/types"; +import {charCodes} from "../util/charcodes"; +import {getNextContextId, input, isFlowEnabled, isTypeScriptEnabled, state} from "./base"; +import { + parseCallExpressionArguments, + parseExprAtom, + parseExpression, + parseExprSubscripts, + parseFunctionBodyAndFinish, + parseIdentifier, + parseMaybeAssign, + parseMethod, + parseObj, + parseParenExpression, + parsePropertyName, +} from "./expression"; +import { + parseBindingAtom, + parseBindingIdentifier, + parseBindingList, + parseImportedIdentifier, +} from "./lval"; +import { + canInsertSemicolon, + eatContextual, + expect, + expectContextual, + hasFollowingLineBreak, + hasPrecedingLineBreak, + isContextual, + isLineTerminator, + isLookaheadContextual, + semicolon, + unexpected, +} from "./util"; + +export function parseTopLevel() { + parseBlockBody(tt.eof); + state.scopes.push(new Scope(0, state.tokens.length, true)); + if (state.scopeDepth !== 0) { + throw new Error(`Invalid scope depth at end of file: ${state.scopeDepth}`); + } + return new File(state.tokens, state.scopes); +} + +// Parse a single statement. +// +// If expecting a statement and finding a slash operator, parse a +// regular expression literal. This is to handle cases like +// `if (foo) /blah/.exec(foo)`, where looking at the previous token +// does not help. + +export function parseStatement(declaration) { + if (isFlowEnabled) { + if (flowTryParseStatement()) { + return; + } + } + if (match(tt.at)) { + parseDecorators(); + } + parseStatementContent(declaration); +} + +function parseStatementContent(declaration) { + if (isTypeScriptEnabled) { + if (tsTryParseStatementContent()) { + return; + } + } + + const starttype = state.type; + + // Most types of statements are recognized by the keyword they + // start with. Many are trivial to parse, some require a bit of + // complexity. + + switch (starttype) { + case tt._break: + case tt._continue: + parseBreakContinueStatement(); + return; + case tt._debugger: + parseDebuggerStatement(); + return; + case tt._do: + parseDoStatement(); + return; + case tt._for: + parseForStatement(); + return; + case tt._function: + if (lookaheadType() === tt.dot) break; + if (!declaration) unexpected(); + parseFunctionStatement(); + return; + + case tt._class: + if (!declaration) unexpected(); + parseClass(true); + return; + + case tt._if: + parseIfStatement(); + return; + case tt._return: + parseReturnStatement(); + return; + case tt._switch: + parseSwitchStatement(); + return; + case tt._throw: + parseThrowStatement(); + return; + case tt._try: + parseTryStatement(); + return; + + case tt._let: + case tt._const: + if (!declaration) unexpected(); // NOTE: falls through to _var + + case tt._var: + parseVarStatement(starttype !== tt._var); + return; + + case tt._while: + parseWhileStatement(); + return; + case tt.braceL: + parseBlock(); + return; + case tt.semi: + parseEmptyStatement(); + return; + case tt._export: + case tt._import: { + const nextType = lookaheadType(); + if (nextType === tt.parenL || nextType === tt.dot) { + break; + } + next(); + if (starttype === tt._import) { + parseImport(); + } else { + parseExport(); + } + return; + } + case tt.name: + if (state.contextualKeyword === ContextualKeyword._async) { + const functionStart = state.start; + // peek ahead and see if next token is a function + const snapshot = state.snapshot(); + next(); + if (match(tt._function) && !canInsertSemicolon()) { + expect(tt._function); + parseFunction(functionStart, true); + return; + } else { + state.restoreFromSnapshot(snapshot); + } + } else if ( + state.contextualKeyword === ContextualKeyword._using && + !hasFollowingLineBreak() && + // Statements like `using[0]` and `using in foo` aren't actual using + // declarations. + lookaheadType() === tt.name + ) { + parseVarStatement(true); + return; + } else if (startsAwaitUsing()) { + expectContextual(ContextualKeyword._await); + parseVarStatement(true); + return; + } + default: + // Do nothing. + break; + } + + // If the statement does not start with a statement keyword or a + // brace, it's an ExpressionStatement or LabeledStatement. We + // simply start parsing an expression, and afterwards, if the + // next token is a colon and the expression was a simple + // Identifier node, we switch to interpreting it as a label. + const initialTokensLength = state.tokens.length; + parseExpression(); + let simpleName = null; + if (state.tokens.length === initialTokensLength + 1) { + const token = state.tokens[state.tokens.length - 1]; + if (token.type === tt.name) { + simpleName = token.contextualKeyword; + } + } + if (simpleName == null) { + semicolon(); + return; + } + if (eat(tt.colon)) { + parseLabeledStatement(); + } else { + // This was an identifier, so we might want to handle flow/typescript-specific cases. + parseIdentifierStatement(simpleName); + } +} + +/** + * Determine if we're positioned at an `await using` declaration. + * + * Note that this can happen either in place of a regular variable declaration + * or in a loop body, and in both places, there are similar-looking cases where + * we need to return false. + * + * Examples returning true: + * await using foo = bar(); + * for (await using a of b) {} + * + * Examples returning false: + * await using + * await using + 1 + * await using instanceof T + * for (await using;;) {} + * + * For now, we early return if we don't see `await`, then do a simple + * backtracking-based lookahead for the `using` and identifier tokens. In the + * future, this could be optimized with a character-based approach. + */ +function startsAwaitUsing() { + if (!isContextual(ContextualKeyword._await)) { + return false; + } + const snapshot = state.snapshot(); + // await + next(); + if (!isContextual(ContextualKeyword._using) || hasPrecedingLineBreak()) { + state.restoreFromSnapshot(snapshot); + return false; + } + // using + next(); + if (!match(tt.name) || hasPrecedingLineBreak()) { + state.restoreFromSnapshot(snapshot); + return false; + } + state.restoreFromSnapshot(snapshot); + return true; +} + +export function parseDecorators() { + while (match(tt.at)) { + parseDecorator(); + } +} + +function parseDecorator() { + next(); + if (eat(tt.parenL)) { + parseExpression(); + expect(tt.parenR); + } else { + parseIdentifier(); + while (eat(tt.dot)) { + parseIdentifier(); + } + parseMaybeDecoratorArguments(); + } +} + +function parseMaybeDecoratorArguments() { + if (isTypeScriptEnabled) { + tsParseMaybeDecoratorArguments(); + } else { + baseParseMaybeDecoratorArguments(); + } +} + +export function baseParseMaybeDecoratorArguments() { + if (eat(tt.parenL)) { + parseCallExpressionArguments(); + } +} + +function parseBreakContinueStatement() { + next(); + if (!isLineTerminator()) { + parseIdentifier(); + semicolon(); + } +} + +function parseDebuggerStatement() { + next(); + semicolon(); +} + +function parseDoStatement() { + next(); + parseStatement(false); + expect(tt._while); + parseParenExpression(); + eat(tt.semi); +} + +function parseForStatement() { + state.scopeDepth++; + const startTokenIndex = state.tokens.length; + parseAmbiguousForStatement(); + const endTokenIndex = state.tokens.length; + state.scopes.push(new Scope(startTokenIndex, endTokenIndex, false)); + state.scopeDepth--; +} + +/** + * Determine if this token is a `using` declaration (explicit resource + * management) as part of a loop. + * https://github.com/tc39/proposal-explicit-resource-management + */ +function isUsingInLoop() { + if (!isContextual(ContextualKeyword._using)) { + return false; + } + // This must be `for (using of`, where `using` is the name of the loop + // variable. + if (isLookaheadContextual(ContextualKeyword._of)) { + return false; + } + return true; +} + +// Disambiguating between a `for` and a `for`/`in` or `for`/`of` +// loop is non-trivial. Basically, we have to parse the init `var` +// statement or expression, disallowing the `in` operator (see +// the second parameter to `parseExpression`), and then check +// whether the next token is `in` or `of`. When there is no init +// part (semicolon immediately after the opening parenthesis), it +// is a regular `for` loop. +function parseAmbiguousForStatement() { + next(); + + let forAwait = false; + if (isContextual(ContextualKeyword._await)) { + forAwait = true; + next(); + } + expect(tt.parenL); + + if (match(tt.semi)) { + if (forAwait) { + unexpected(); + } + parseFor(); + return; + } + + const isAwaitUsing = startsAwaitUsing(); + if (isAwaitUsing || match(tt._var) || match(tt._let) || match(tt._const) || isUsingInLoop()) { + if (isAwaitUsing) { + expectContextual(ContextualKeyword._await); + } + next(); + parseVar(true, state.type !== tt._var); + if (match(tt._in) || isContextual(ContextualKeyword._of)) { + parseForIn(forAwait); + return; + } + parseFor(); + return; + } + + parseExpression(true); + if (match(tt._in) || isContextual(ContextualKeyword._of)) { + parseForIn(forAwait); + return; + } + if (forAwait) { + unexpected(); + } + parseFor(); +} + +function parseFunctionStatement() { + const functionStart = state.start; + next(); + parseFunction(functionStart, true); +} + +function parseIfStatement() { + next(); + parseParenExpression(); + parseStatement(false); + if (eat(tt._else)) { + parseStatement(false); + } +} + +function parseReturnStatement() { + next(); + + // In `return` (and `break`/`continue`), the keywords with + // optional arguments, we eagerly look for a semicolon or the + // possibility to insert one. + + if (!isLineTerminator()) { + parseExpression(); + semicolon(); + } +} + +function parseSwitchStatement() { + next(); + parseParenExpression(); + state.scopeDepth++; + const startTokenIndex = state.tokens.length; + expect(tt.braceL); + + // Don't bother validation; just go through any sequence of cases, defaults, and statements. + while (!match(tt.braceR) && !state.error) { + if (match(tt._case) || match(tt._default)) { + const isCase = match(tt._case); + next(); + if (isCase) { + parseExpression(); + } + expect(tt.colon); + } else { + parseStatement(true); + } + } + next(); // Closing brace + const endTokenIndex = state.tokens.length; + state.scopes.push(new Scope(startTokenIndex, endTokenIndex, false)); + state.scopeDepth--; +} + +function parseThrowStatement() { + next(); + parseExpression(); + semicolon(); +} + +function parseCatchClauseParam() { + parseBindingAtom(true /* isBlockScope */); + + if (isTypeScriptEnabled) { + tsTryParseTypeAnnotation(); + } +} + +function parseTryStatement() { + next(); + + parseBlock(); + + if (match(tt._catch)) { + next(); + let catchBindingStartTokenIndex = null; + if (match(tt.parenL)) { + state.scopeDepth++; + catchBindingStartTokenIndex = state.tokens.length; + expect(tt.parenL); + parseCatchClauseParam(); + expect(tt.parenR); + } + parseBlock(); + if (catchBindingStartTokenIndex != null) { + // We need a special scope for the catch binding which includes the binding itself and the + // catch block. + const endTokenIndex = state.tokens.length; + state.scopes.push(new Scope(catchBindingStartTokenIndex, endTokenIndex, false)); + state.scopeDepth--; + } + } + if (eat(tt._finally)) { + parseBlock(); + } +} + +export function parseVarStatement(isBlockScope) { + next(); + parseVar(false, isBlockScope); + semicolon(); +} + +function parseWhileStatement() { + next(); + parseParenExpression(); + parseStatement(false); +} + +function parseEmptyStatement() { + next(); +} + +function parseLabeledStatement() { + parseStatement(true); +} + +/** + * Parse a statement starting with an identifier of the given name. Subclasses match on the name + * to handle statements like "declare". + */ +function parseIdentifierStatement(contextualKeyword) { + if (isTypeScriptEnabled) { + tsParseIdentifierStatement(contextualKeyword); + } else if (isFlowEnabled) { + flowParseIdentifierStatement(contextualKeyword); + } else { + semicolon(); + } +} + +// Parse a semicolon-enclosed block of statements. +export function parseBlock(isFunctionScope = false, contextId = 0) { + const startTokenIndex = state.tokens.length; + state.scopeDepth++; + expect(tt.braceL); + if (contextId) { + state.tokens[state.tokens.length - 1].contextId = contextId; + } + parseBlockBody(tt.braceR); + if (contextId) { + state.tokens[state.tokens.length - 1].contextId = contextId; + } + const endTokenIndex = state.tokens.length; + state.scopes.push(new Scope(startTokenIndex, endTokenIndex, isFunctionScope)); + state.scopeDepth--; +} + +export function parseBlockBody(end) { + while (!eat(end) && !state.error) { + parseStatement(true); + } +} + +// Parse a regular `for` loop. The disambiguation code in +// `parseStatement` will already have parsed the init statement or +// expression. + +function parseFor() { + expect(tt.semi); + if (!match(tt.semi)) { + parseExpression(); + } + expect(tt.semi); + if (!match(tt.parenR)) { + parseExpression(); + } + expect(tt.parenR); + parseStatement(false); +} + +// Parse a `for`/`in` and `for`/`of` loop, which are almost +// same from parser's perspective. + +function parseForIn(forAwait) { + if (forAwait) { + eatContextual(ContextualKeyword._of); + } else { + next(); + } + parseExpression(); + expect(tt.parenR); + parseStatement(false); +} + +// Parse a list of variable declarations. + +function parseVar(isFor, isBlockScope) { + while (true) { + parseVarHead(isBlockScope); + if (eat(tt.eq)) { + const eqIndex = state.tokens.length - 1; + parseMaybeAssign(isFor); + state.tokens[eqIndex].rhsEndIndex = state.tokens.length; + } + if (!eat(tt.comma)) { + break; + } + } +} + +function parseVarHead(isBlockScope) { + parseBindingAtom(isBlockScope); + if (isTypeScriptEnabled) { + tsAfterParseVarHead(); + } else if (isFlowEnabled) { + flowAfterParseVarHead(); + } +} + +// Parse a function declaration or literal (depending on the +// `isStatement` parameter). + +export function parseFunction( + functionStart, + isStatement, + optionalId = false, +) { + if (match(tt.star)) { + next(); + } + + if (isStatement && !optionalId && !match(tt.name) && !match(tt._yield)) { + unexpected(); + } + + let nameScopeStartTokenIndex = null; + + if (match(tt.name)) { + // Expression-style functions should limit their name's scope to the function body, so we make + // a new function scope to enforce that. + if (!isStatement) { + nameScopeStartTokenIndex = state.tokens.length; + state.scopeDepth++; + } + parseBindingIdentifier(false); + } + + const startTokenIndex = state.tokens.length; + state.scopeDepth++; + parseFunctionParams(); + parseFunctionBodyAndFinish(functionStart); + const endTokenIndex = state.tokens.length; + // In addition to the block scope of the function body, we need a separate function-style scope + // that includes the params. + state.scopes.push(new Scope(startTokenIndex, endTokenIndex, true)); + state.scopeDepth--; + if (nameScopeStartTokenIndex !== null) { + state.scopes.push(new Scope(nameScopeStartTokenIndex, endTokenIndex, true)); + state.scopeDepth--; + } +} + +export function parseFunctionParams( + allowModifiers = false, + funcContextId = 0, +) { + if (isTypeScriptEnabled) { + tsStartParseFunctionParams(); + } else if (isFlowEnabled) { + flowStartParseFunctionParams(); + } + + expect(tt.parenL); + if (funcContextId) { + state.tokens[state.tokens.length - 1].contextId = funcContextId; + } + parseBindingList( + tt.parenR, + false /* isBlockScope */, + false /* allowEmpty */, + allowModifiers, + funcContextId, + ); + if (funcContextId) { + state.tokens[state.tokens.length - 1].contextId = funcContextId; + } +} + +// Parse a class declaration or literal (depending on the +// `isStatement` parameter). + +export function parseClass(isStatement, optionalId = false) { + // Put a context ID on the class keyword, the open-brace, and the close-brace, so that later + // code can easily navigate to meaningful points on the class. + const contextId = getNextContextId(); + + next(); + state.tokens[state.tokens.length - 1].contextId = contextId; + state.tokens[state.tokens.length - 1].isExpression = !isStatement; + // Like with functions, we declare a special "name scope" from the start of the name to the end + // of the class, but only with expression-style classes, to represent the fact that the name is + // available to the body of the class but not an outer declaration. + let nameScopeStartTokenIndex = null; + if (!isStatement) { + nameScopeStartTokenIndex = state.tokens.length; + state.scopeDepth++; + } + parseClassId(isStatement, optionalId); + parseClassSuper(); + const openBraceIndex = state.tokens.length; + parseClassBody(contextId); + if (state.error) { + return; + } + state.tokens[openBraceIndex].contextId = contextId; + state.tokens[state.tokens.length - 1].contextId = contextId; + if (nameScopeStartTokenIndex !== null) { + const endTokenIndex = state.tokens.length; + state.scopes.push(new Scope(nameScopeStartTokenIndex, endTokenIndex, false)); + state.scopeDepth--; + } +} + +function isClassProperty() { + return match(tt.eq) || match(tt.semi) || match(tt.braceR) || match(tt.bang) || match(tt.colon); +} + +function isClassMethod() { + return match(tt.parenL) || match(tt.lessThan); +} + +function parseClassBody(classContextId) { + expect(tt.braceL); + + while (!eat(tt.braceR) && !state.error) { + if (eat(tt.semi)) { + continue; + } + + if (match(tt.at)) { + parseDecorator(); + continue; + } + const memberStart = state.start; + parseClassMember(memberStart, classContextId); + } +} + +function parseClassMember(memberStart, classContextId) { + if (isTypeScriptEnabled) { + tsParseModifiers([ + ContextualKeyword._declare, + ContextualKeyword._public, + ContextualKeyword._protected, + ContextualKeyword._private, + ContextualKeyword._override, + ]); + } + let isStatic = false; + if (match(tt.name) && state.contextualKeyword === ContextualKeyword._static) { + parseIdentifier(); // eats 'static' + if (isClassMethod()) { + parseClassMethod(memberStart, /* isConstructor */ false); + return; + } else if (isClassProperty()) { + parseClassProperty(); + return; + } + // otherwise something static + state.tokens[state.tokens.length - 1].type = tt._static; + isStatic = true; + + if (match(tt.braceL)) { + // This is a static block. Mark the word "static" with the class context ID for class element + // detection and parse as a regular block. + state.tokens[state.tokens.length - 1].contextId = classContextId; + parseBlock(); + return; + } + } + + parseClassMemberWithIsStatic(memberStart, isStatic, classContextId); +} + +function parseClassMemberWithIsStatic( + memberStart, + isStatic, + classContextId, +) { + if (isTypeScriptEnabled) { + if (tsTryParseClassMemberWithIsStatic(isStatic)) { + return; + } + } + if (eat(tt.star)) { + // a generator + parseClassPropertyName(classContextId); + parseClassMethod(memberStart, /* isConstructor */ false); + return; + } + + // Get the identifier name so we can tell if it's actually a keyword like "async", "get", or + // "set". + parseClassPropertyName(classContextId); + let isConstructor = false; + const token = state.tokens[state.tokens.length - 1]; + // We allow "constructor" as either an identifier or a string. + if (token.contextualKeyword === ContextualKeyword._constructor) { + isConstructor = true; + } + parsePostMemberNameModifiers(); + + if (isClassMethod()) { + parseClassMethod(memberStart, isConstructor); + } else if (isClassProperty()) { + parseClassProperty(); + } else if (token.contextualKeyword === ContextualKeyword._async && !isLineTerminator()) { + state.tokens[state.tokens.length - 1].type = tt._async; + // an async method + const isGenerator = match(tt.star); + if (isGenerator) { + next(); + } + + // The so-called parsed name would have been "async": get the real name. + parseClassPropertyName(classContextId); + parsePostMemberNameModifiers(); + parseClassMethod(memberStart, false /* isConstructor */); + } else if ( + (token.contextualKeyword === ContextualKeyword._get || + token.contextualKeyword === ContextualKeyword._set) && + !(isLineTerminator() && match(tt.star)) + ) { + if (token.contextualKeyword === ContextualKeyword._get) { + state.tokens[state.tokens.length - 1].type = tt._get; + } else { + state.tokens[state.tokens.length - 1].type = tt._set; + } + // `get\n*` is an uninitialized property named 'get' followed by a generator. + // a getter or setter + // The so-called parsed name would have been "get/set": get the real name. + parseClassPropertyName(classContextId); + parseClassMethod(memberStart, /* isConstructor */ false); + } else if (token.contextualKeyword === ContextualKeyword._accessor && !isLineTerminator()) { + parseClassPropertyName(classContextId); + parseClassProperty(); + } else if (isLineTerminator()) { + // an uninitialized class property (due to ASI, since we don't otherwise recognize the next token) + parseClassProperty(); + } else { + unexpected(); + } +} + +function parseClassMethod(functionStart, isConstructor) { + if (isTypeScriptEnabled) { + tsTryParseTypeParameters(); + } else if (isFlowEnabled) { + if (match(tt.lessThan)) { + flowParseTypeParameterDeclaration(); + } + } + parseMethod(functionStart, isConstructor); +} + +// Return the name of the class property, if it is a simple identifier. +export function parseClassPropertyName(classContextId) { + parsePropertyName(classContextId); +} + +export function parsePostMemberNameModifiers() { + if (isTypeScriptEnabled) { + const oldIsType = pushTypeContext(0); + eat(tt.question); + popTypeContext(oldIsType); + } +} + +export function parseClassProperty() { + if (isTypeScriptEnabled) { + eatTypeToken(tt.bang); + tsTryParseTypeAnnotation(); + } else if (isFlowEnabled) { + if (match(tt.colon)) { + flowParseTypeAnnotation(); + } + } + + if (match(tt.eq)) { + const equalsTokenIndex = state.tokens.length; + next(); + parseMaybeAssign(); + state.tokens[equalsTokenIndex].rhsEndIndex = state.tokens.length; + } + semicolon(); +} + +function parseClassId(isStatement, optionalId = false) { + if ( + isTypeScriptEnabled && + (!isStatement || optionalId) && + isContextual(ContextualKeyword._implements) + ) { + return; + } + + if (match(tt.name)) { + parseBindingIdentifier(true); + } + + if (isTypeScriptEnabled) { + tsTryParseTypeParameters(); + } else if (isFlowEnabled) { + if (match(tt.lessThan)) { + flowParseTypeParameterDeclaration(); + } + } +} + +// Returns true if there was a superclass. +function parseClassSuper() { + let hasSuper = false; + if (eat(tt._extends)) { + parseExprSubscripts(); + hasSuper = true; + } else { + hasSuper = false; + } + if (isTypeScriptEnabled) { + tsAfterParseClassSuper(hasSuper); + } else if (isFlowEnabled) { + flowAfterParseClassSuper(hasSuper); + } +} + +// Parses module export declaration. + +export function parseExport() { + const exportIndex = state.tokens.length - 1; + if (isTypeScriptEnabled) { + if (tsTryParseExport()) { + return; + } + } + // export * from '...' + if (shouldParseExportStar()) { + parseExportStar(); + } else if (isExportDefaultSpecifier()) { + // export default from + parseIdentifier(); + if (match(tt.comma) && lookaheadType() === tt.star) { + expect(tt.comma); + expect(tt.star); + expectContextual(ContextualKeyword._as); + parseIdentifier(); + } else { + parseExportSpecifiersMaybe(); + } + parseExportFrom(); + } else if (eat(tt._default)) { + // export default ... + parseExportDefaultExpression(); + } else if (shouldParseExportDeclaration()) { + parseExportDeclaration(); + } else { + // export { x, y as z } [from '...'] + parseExportSpecifiers(); + parseExportFrom(); + } + state.tokens[exportIndex].rhsEndIndex = state.tokens.length; +} + +function parseExportDefaultExpression() { + if (isTypeScriptEnabled) { + if (tsTryParseExportDefaultExpression()) { + return; + } + } + if (isFlowEnabled) { + if (flowTryParseExportDefaultExpression()) { + return; + } + } + const functionStart = state.start; + if (eat(tt._function)) { + parseFunction(functionStart, true, true); + } else if (isContextual(ContextualKeyword._async) && lookaheadType() === tt._function) { + // async function declaration + eatContextual(ContextualKeyword._async); + eat(tt._function); + parseFunction(functionStart, true, true); + } else if (match(tt._class)) { + parseClass(true, true); + } else if (match(tt.at)) { + parseDecorators(); + parseClass(true, true); + } else { + parseMaybeAssign(); + semicolon(); + } +} + +function parseExportDeclaration() { + if (isTypeScriptEnabled) { + tsParseExportDeclaration(); + } else if (isFlowEnabled) { + flowParseExportDeclaration(); + } else { + parseStatement(true); + } +} + +function isExportDefaultSpecifier() { + if (isTypeScriptEnabled && tsIsDeclarationStart()) { + return false; + } else if (isFlowEnabled && flowShouldDisallowExportDefaultSpecifier()) { + return false; + } + if (match(tt.name)) { + return state.contextualKeyword !== ContextualKeyword._async; + } + + if (!match(tt._default)) { + return false; + } + + const _next = nextTokenStart(); + const lookahead = lookaheadTypeAndKeyword(); + const hasFrom = + lookahead.type === tt.name && lookahead.contextualKeyword === ContextualKeyword._from; + if (lookahead.type === tt.comma) { + return true; + } + // lookahead again when `export default from` is seen + if (hasFrom) { + const nextAfterFrom = input.charCodeAt(nextTokenStartSince(_next + 4)); + return nextAfterFrom === charCodes.quotationMark || nextAfterFrom === charCodes.apostrophe; + } + return false; +} + +function parseExportSpecifiersMaybe() { + if (eat(tt.comma)) { + parseExportSpecifiers(); + } +} + +export function parseExportFrom() { + if (eatContextual(ContextualKeyword._from)) { + parseExprAtom(); + maybeParseImportAttributes(); + } + semicolon(); +} + +function shouldParseExportStar() { + if (isFlowEnabled) { + return flowShouldParseExportStar(); + } else { + return match(tt.star); + } +} + +function parseExportStar() { + if (isFlowEnabled) { + flowParseExportStar(); + } else { + baseParseExportStar(); + } +} + +export function baseParseExportStar() { + expect(tt.star); + + if (isContextual(ContextualKeyword._as)) { + parseExportNamespace(); + } else { + parseExportFrom(); + } +} + +function parseExportNamespace() { + next(); + state.tokens[state.tokens.length - 1].type = tt._as; + parseIdentifier(); + parseExportSpecifiersMaybe(); + parseExportFrom(); +} + +function shouldParseExportDeclaration() { + return ( + (isTypeScriptEnabled && tsIsDeclarationStart()) || + (isFlowEnabled && flowShouldParseExportDeclaration()) || + state.type === tt._var || + state.type === tt._const || + state.type === tt._let || + state.type === tt._function || + state.type === tt._class || + isContextual(ContextualKeyword._async) || + match(tt.at) + ); +} + +// Parses a comma-separated list of module exports. +export function parseExportSpecifiers() { + let first = true; + + // export { x, y as z } [from '...'] + expect(tt.braceL); + + while (!eat(tt.braceR) && !state.error) { + if (first) { + first = false; + } else { + expect(tt.comma); + if (eat(tt.braceR)) { + break; + } + } + parseExportSpecifier(); + } +} + +function parseExportSpecifier() { + if (isTypeScriptEnabled) { + tsParseExportSpecifier(); + return; + } + parseIdentifier(); + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ExportAccess; + if (eatContextual(ContextualKeyword._as)) { + parseIdentifier(); + } +} + +/** + * Starting at the `module` token in an import, determine if it was truly an + * import reflection token or just looks like one. + * + * Returns true for: + * import module foo from "foo"; + * import module from from "foo"; + * + * Returns false for: + * import module from "foo"; + * import module, {bar} from "foo"; + */ +function isImportReflection() { + const snapshot = state.snapshot(); + expectContextual(ContextualKeyword._module); + if (eatContextual(ContextualKeyword._from)) { + if (isContextual(ContextualKeyword._from)) { + state.restoreFromSnapshot(snapshot); + return true; + } else { + state.restoreFromSnapshot(snapshot); + return false; + } + } else if (match(tt.comma)) { + state.restoreFromSnapshot(snapshot); + return false; + } else { + state.restoreFromSnapshot(snapshot); + return true; + } +} + +/** + * Eat the "module" token from the import reflection proposal. + * https://github.com/tc39/proposal-import-reflection + */ +function parseMaybeImportReflection() { + // isImportReflection does snapshot/restore, so only run it if we see the word + // "module". + if (isContextual(ContextualKeyword._module) && isImportReflection()) { + next(); + } +} + +// Parses import declaration. + +export function parseImport() { + if (isTypeScriptEnabled && match(tt.name) && lookaheadType() === tt.eq) { + tsParseImportEqualsDeclaration(); + return; + } + if (isTypeScriptEnabled && isContextual(ContextualKeyword._type)) { + const lookahead = lookaheadTypeAndKeyword(); + if (lookahead.type === tt.name && lookahead.contextualKeyword !== ContextualKeyword._from) { + // One of these `import type` cases: + // import type T = require('T'); + // import type A from 'A'; + expectContextual(ContextualKeyword._type); + if (lookaheadType() === tt.eq) { + tsParseImportEqualsDeclaration(); + return; + } + // If this is an `import type...from` statement, then we already ate the + // type token, so proceed to the regular import parser. + } else if (lookahead.type === tt.star || lookahead.type === tt.braceL) { + // One of these `import type` cases, in which case we can eat the type token + // and proceed as normal: + // import type * as A from 'A'; + // import type {a} from 'A'; + expectContextual(ContextualKeyword._type); + } + // Otherwise, we are importing the name "type". + } + + // import '...' + if (match(tt.string)) { + parseExprAtom(); + } else { + parseMaybeImportReflection(); + parseImportSpecifiers(); + expectContextual(ContextualKeyword._from); + parseExprAtom(); + } + maybeParseImportAttributes(); + semicolon(); +} + +// eslint-disable-next-line no-unused-vars +function shouldParseDefaultImport() { + return match(tt.name); +} + +function parseImportSpecifierLocal() { + parseImportedIdentifier(); +} + +// Parses a comma-separated list of module imports. +function parseImportSpecifiers() { + if (isFlowEnabled) { + flowStartParseImportSpecifiers(); + } + + let first = true; + if (shouldParseDefaultImport()) { + // import defaultObj, { x, y as z } from '...' + parseImportSpecifierLocal(); + + if (!eat(tt.comma)) return; + } + + if (match(tt.star)) { + next(); + expectContextual(ContextualKeyword._as); + + parseImportSpecifierLocal(); + + return; + } + + expect(tt.braceL); + while (!eat(tt.braceR) && !state.error) { + if (first) { + first = false; + } else { + // Detect an attempt to deep destructure + if (eat(tt.colon)) { + unexpected( + "ES2015 named imports do not destructure. Use another statement for destructuring after the import.", + ); + } + + expect(tt.comma); + if (eat(tt.braceR)) { + break; + } + } + + parseImportSpecifier(); + } +} + +function parseImportSpecifier() { + if (isTypeScriptEnabled) { + tsParseImportSpecifier(); + return; + } + if (isFlowEnabled) { + flowParseImportSpecifier(); + return; + } + parseImportedIdentifier(); + if (isContextual(ContextualKeyword._as)) { + state.tokens[state.tokens.length - 1].identifierRole = IdentifierRole.ImportAccess; + next(); + parseImportedIdentifier(); + } +} + +/** + * Parse import attributes like `with {type: "json"}`, or the legacy form + * `assert {type: "json"}`. + * + * Import attributes technically have their own syntax, but are always parseable + * as a plain JS object, so just do that for simplicity. + */ +function maybeParseImportAttributes() { + if (match(tt._with) || (isContextual(ContextualKeyword._assert) && !hasPrecedingLineBreak())) { + next(); + parseObj(false, false); + } +} diff --git a/node_modules/sucrase/dist/esm/parser/traverser/util.js b/node_modules/sucrase/dist/esm/parser/traverser/util.js new file mode 100644 index 00000000..6a2b2d93 --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/traverser/util.js @@ -0,0 +1,104 @@ +import {eat, finishToken, lookaheadTypeAndKeyword, match, nextTokenStart} from "../tokenizer/index"; + +import {formatTokenType, TokenType as tt} from "../tokenizer/types"; +import {charCodes} from "../util/charcodes"; +import {input, state} from "./base"; + +// ## Parser utilities + +// Tests whether parsed token is a contextual keyword. +export function isContextual(contextualKeyword) { + return state.contextualKeyword === contextualKeyword; +} + +export function isLookaheadContextual(contextualKeyword) { + const l = lookaheadTypeAndKeyword(); + return l.type === tt.name && l.contextualKeyword === contextualKeyword; +} + +// Consumes contextual keyword if possible. +export function eatContextual(contextualKeyword) { + return state.contextualKeyword === contextualKeyword && eat(tt.name); +} + +// Asserts that following token is given contextual keyword. +export function expectContextual(contextualKeyword) { + if (!eatContextual(contextualKeyword)) { + unexpected(); + } +} + +// Test whether a semicolon can be inserted at the current position. +export function canInsertSemicolon() { + return match(tt.eof) || match(tt.braceR) || hasPrecedingLineBreak(); +} + +export function hasPrecedingLineBreak() { + const prevToken = state.tokens[state.tokens.length - 1]; + const lastTokEnd = prevToken ? prevToken.end : 0; + for (let i = lastTokEnd; i < state.start; i++) { + const code = input.charCodeAt(i); + if ( + code === charCodes.lineFeed || + code === charCodes.carriageReturn || + code === 0x2028 || + code === 0x2029 + ) { + return true; + } + } + return false; +} + +export function hasFollowingLineBreak() { + const nextStart = nextTokenStart(); + for (let i = state.end; i < nextStart; i++) { + const code = input.charCodeAt(i); + if ( + code === charCodes.lineFeed || + code === charCodes.carriageReturn || + code === 0x2028 || + code === 0x2029 + ) { + return true; + } + } + return false; +} + +export function isLineTerminator() { + return eat(tt.semi) || canInsertSemicolon(); +} + +// Consume a semicolon, or, failing that, see if we are allowed to +// pretend that there is a semicolon at this position. +export function semicolon() { + if (!isLineTerminator()) { + unexpected('Unexpected token, expected ";"'); + } +} + +// Expect a token of a given type. If found, consume it, otherwise, +// raise an unexpected token error at given pos. +export function expect(type) { + const matched = eat(type); + if (!matched) { + unexpected(`Unexpected token, expected "${formatTokenType(type)}"`); + } +} + +/** + * Transition the parser to an error state. All code needs to be written to naturally unwind in this + * state, which allows us to backtrack without exceptions and without error plumbing everywhere. + */ +export function unexpected(message = "Unexpected token", pos = state.start) { + if (state.error) { + return; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const err = new SyntaxError(message); + err.pos = pos; + state.error = err; + state.pos = input.length; + finishToken(tt.eof); +} diff --git a/node_modules/sucrase/dist/esm/parser/util/charcodes.js b/node_modules/sucrase/dist/esm/parser/util/charcodes.js new file mode 100644 index 00000000..36ea667e --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/util/charcodes.js @@ -0,0 +1,115 @@ +export var charCodes; (function (charCodes) { + const backSpace = 8; charCodes[charCodes["backSpace"] = backSpace] = "backSpace"; + const lineFeed = 10; charCodes[charCodes["lineFeed"] = lineFeed] = "lineFeed"; // '\n' + const tab = 9; charCodes[charCodes["tab"] = tab] = "tab"; // '\t' + const carriageReturn = 13; charCodes[charCodes["carriageReturn"] = carriageReturn] = "carriageReturn"; // '\r' + const shiftOut = 14; charCodes[charCodes["shiftOut"] = shiftOut] = "shiftOut"; + const space = 32; charCodes[charCodes["space"] = space] = "space"; + const exclamationMark = 33; charCodes[charCodes["exclamationMark"] = exclamationMark] = "exclamationMark"; // '!' + const quotationMark = 34; charCodes[charCodes["quotationMark"] = quotationMark] = "quotationMark"; // '"' + const numberSign = 35; charCodes[charCodes["numberSign"] = numberSign] = "numberSign"; // '#' + const dollarSign = 36; charCodes[charCodes["dollarSign"] = dollarSign] = "dollarSign"; // '$' + const percentSign = 37; charCodes[charCodes["percentSign"] = percentSign] = "percentSign"; // '%' + const ampersand = 38; charCodes[charCodes["ampersand"] = ampersand] = "ampersand"; // '&' + const apostrophe = 39; charCodes[charCodes["apostrophe"] = apostrophe] = "apostrophe"; // ''' + const leftParenthesis = 40; charCodes[charCodes["leftParenthesis"] = leftParenthesis] = "leftParenthesis"; // '(' + const rightParenthesis = 41; charCodes[charCodes["rightParenthesis"] = rightParenthesis] = "rightParenthesis"; // ')' + const asterisk = 42; charCodes[charCodes["asterisk"] = asterisk] = "asterisk"; // '*' + const plusSign = 43; charCodes[charCodes["plusSign"] = plusSign] = "plusSign"; // '+' + const comma = 44; charCodes[charCodes["comma"] = comma] = "comma"; // ',' + const dash = 45; charCodes[charCodes["dash"] = dash] = "dash"; // '-' + const dot = 46; charCodes[charCodes["dot"] = dot] = "dot"; // '.' + const slash = 47; charCodes[charCodes["slash"] = slash] = "slash"; // '/' + const digit0 = 48; charCodes[charCodes["digit0"] = digit0] = "digit0"; // '0' + const digit1 = 49; charCodes[charCodes["digit1"] = digit1] = "digit1"; // '1' + const digit2 = 50; charCodes[charCodes["digit2"] = digit2] = "digit2"; // '2' + const digit3 = 51; charCodes[charCodes["digit3"] = digit3] = "digit3"; // '3' + const digit4 = 52; charCodes[charCodes["digit4"] = digit4] = "digit4"; // '4' + const digit5 = 53; charCodes[charCodes["digit5"] = digit5] = "digit5"; // '5' + const digit6 = 54; charCodes[charCodes["digit6"] = digit6] = "digit6"; // '6' + const digit7 = 55; charCodes[charCodes["digit7"] = digit7] = "digit7"; // '7' + const digit8 = 56; charCodes[charCodes["digit8"] = digit8] = "digit8"; // '8' + const digit9 = 57; charCodes[charCodes["digit9"] = digit9] = "digit9"; // '9' + const colon = 58; charCodes[charCodes["colon"] = colon] = "colon"; // ':' + const semicolon = 59; charCodes[charCodes["semicolon"] = semicolon] = "semicolon"; // ';' + const lessThan = 60; charCodes[charCodes["lessThan"] = lessThan] = "lessThan"; // '<' + const equalsTo = 61; charCodes[charCodes["equalsTo"] = equalsTo] = "equalsTo"; // '=' + const greaterThan = 62; charCodes[charCodes["greaterThan"] = greaterThan] = "greaterThan"; // '>' + const questionMark = 63; charCodes[charCodes["questionMark"] = questionMark] = "questionMark"; // '?' + const atSign = 64; charCodes[charCodes["atSign"] = atSign] = "atSign"; // '@' + const uppercaseA = 65; charCodes[charCodes["uppercaseA"] = uppercaseA] = "uppercaseA"; // 'A' + const uppercaseB = 66; charCodes[charCodes["uppercaseB"] = uppercaseB] = "uppercaseB"; // 'B' + const uppercaseC = 67; charCodes[charCodes["uppercaseC"] = uppercaseC] = "uppercaseC"; // 'C' + const uppercaseD = 68; charCodes[charCodes["uppercaseD"] = uppercaseD] = "uppercaseD"; // 'D' + const uppercaseE = 69; charCodes[charCodes["uppercaseE"] = uppercaseE] = "uppercaseE"; // 'E' + const uppercaseF = 70; charCodes[charCodes["uppercaseF"] = uppercaseF] = "uppercaseF"; // 'F' + const uppercaseG = 71; charCodes[charCodes["uppercaseG"] = uppercaseG] = "uppercaseG"; // 'G' + const uppercaseH = 72; charCodes[charCodes["uppercaseH"] = uppercaseH] = "uppercaseH"; // 'H' + const uppercaseI = 73; charCodes[charCodes["uppercaseI"] = uppercaseI] = "uppercaseI"; // 'I' + const uppercaseJ = 74; charCodes[charCodes["uppercaseJ"] = uppercaseJ] = "uppercaseJ"; // 'J' + const uppercaseK = 75; charCodes[charCodes["uppercaseK"] = uppercaseK] = "uppercaseK"; // 'K' + const uppercaseL = 76; charCodes[charCodes["uppercaseL"] = uppercaseL] = "uppercaseL"; // 'L' + const uppercaseM = 77; charCodes[charCodes["uppercaseM"] = uppercaseM] = "uppercaseM"; // 'M' + const uppercaseN = 78; charCodes[charCodes["uppercaseN"] = uppercaseN] = "uppercaseN"; // 'N' + const uppercaseO = 79; charCodes[charCodes["uppercaseO"] = uppercaseO] = "uppercaseO"; // 'O' + const uppercaseP = 80; charCodes[charCodes["uppercaseP"] = uppercaseP] = "uppercaseP"; // 'P' + const uppercaseQ = 81; charCodes[charCodes["uppercaseQ"] = uppercaseQ] = "uppercaseQ"; // 'Q' + const uppercaseR = 82; charCodes[charCodes["uppercaseR"] = uppercaseR] = "uppercaseR"; // 'R' + const uppercaseS = 83; charCodes[charCodes["uppercaseS"] = uppercaseS] = "uppercaseS"; // 'S' + const uppercaseT = 84; charCodes[charCodes["uppercaseT"] = uppercaseT] = "uppercaseT"; // 'T' + const uppercaseU = 85; charCodes[charCodes["uppercaseU"] = uppercaseU] = "uppercaseU"; // 'U' + const uppercaseV = 86; charCodes[charCodes["uppercaseV"] = uppercaseV] = "uppercaseV"; // 'V' + const uppercaseW = 87; charCodes[charCodes["uppercaseW"] = uppercaseW] = "uppercaseW"; // 'W' + const uppercaseX = 88; charCodes[charCodes["uppercaseX"] = uppercaseX] = "uppercaseX"; // 'X' + const uppercaseY = 89; charCodes[charCodes["uppercaseY"] = uppercaseY] = "uppercaseY"; // 'Y' + const uppercaseZ = 90; charCodes[charCodes["uppercaseZ"] = uppercaseZ] = "uppercaseZ"; // 'Z' + const leftSquareBracket = 91; charCodes[charCodes["leftSquareBracket"] = leftSquareBracket] = "leftSquareBracket"; // '[' + const backslash = 92; charCodes[charCodes["backslash"] = backslash] = "backslash"; // '\ ' + const rightSquareBracket = 93; charCodes[charCodes["rightSquareBracket"] = rightSquareBracket] = "rightSquareBracket"; // ']' + const caret = 94; charCodes[charCodes["caret"] = caret] = "caret"; // '^' + const underscore = 95; charCodes[charCodes["underscore"] = underscore] = "underscore"; // '_' + const graveAccent = 96; charCodes[charCodes["graveAccent"] = graveAccent] = "graveAccent"; // '`' + const lowercaseA = 97; charCodes[charCodes["lowercaseA"] = lowercaseA] = "lowercaseA"; // 'a' + const lowercaseB = 98; charCodes[charCodes["lowercaseB"] = lowercaseB] = "lowercaseB"; // 'b' + const lowercaseC = 99; charCodes[charCodes["lowercaseC"] = lowercaseC] = "lowercaseC"; // 'c' + const lowercaseD = 100; charCodes[charCodes["lowercaseD"] = lowercaseD] = "lowercaseD"; // 'd' + const lowercaseE = 101; charCodes[charCodes["lowercaseE"] = lowercaseE] = "lowercaseE"; // 'e' + const lowercaseF = 102; charCodes[charCodes["lowercaseF"] = lowercaseF] = "lowercaseF"; // 'f' + const lowercaseG = 103; charCodes[charCodes["lowercaseG"] = lowercaseG] = "lowercaseG"; // 'g' + const lowercaseH = 104; charCodes[charCodes["lowercaseH"] = lowercaseH] = "lowercaseH"; // 'h' + const lowercaseI = 105; charCodes[charCodes["lowercaseI"] = lowercaseI] = "lowercaseI"; // 'i' + const lowercaseJ = 106; charCodes[charCodes["lowercaseJ"] = lowercaseJ] = "lowercaseJ"; // 'j' + const lowercaseK = 107; charCodes[charCodes["lowercaseK"] = lowercaseK] = "lowercaseK"; // 'k' + const lowercaseL = 108; charCodes[charCodes["lowercaseL"] = lowercaseL] = "lowercaseL"; // 'l' + const lowercaseM = 109; charCodes[charCodes["lowercaseM"] = lowercaseM] = "lowercaseM"; // 'm' + const lowercaseN = 110; charCodes[charCodes["lowercaseN"] = lowercaseN] = "lowercaseN"; // 'n' + const lowercaseO = 111; charCodes[charCodes["lowercaseO"] = lowercaseO] = "lowercaseO"; // 'o' + const lowercaseP = 112; charCodes[charCodes["lowercaseP"] = lowercaseP] = "lowercaseP"; // 'p' + const lowercaseQ = 113; charCodes[charCodes["lowercaseQ"] = lowercaseQ] = "lowercaseQ"; // 'q' + const lowercaseR = 114; charCodes[charCodes["lowercaseR"] = lowercaseR] = "lowercaseR"; // 'r' + const lowercaseS = 115; charCodes[charCodes["lowercaseS"] = lowercaseS] = "lowercaseS"; // 's' + const lowercaseT = 116; charCodes[charCodes["lowercaseT"] = lowercaseT] = "lowercaseT"; // 't' + const lowercaseU = 117; charCodes[charCodes["lowercaseU"] = lowercaseU] = "lowercaseU"; // 'u' + const lowercaseV = 118; charCodes[charCodes["lowercaseV"] = lowercaseV] = "lowercaseV"; // 'v' + const lowercaseW = 119; charCodes[charCodes["lowercaseW"] = lowercaseW] = "lowercaseW"; // 'w' + const lowercaseX = 120; charCodes[charCodes["lowercaseX"] = lowercaseX] = "lowercaseX"; // 'x' + const lowercaseY = 121; charCodes[charCodes["lowercaseY"] = lowercaseY] = "lowercaseY"; // 'y' + const lowercaseZ = 122; charCodes[charCodes["lowercaseZ"] = lowercaseZ] = "lowercaseZ"; // 'z' + const leftCurlyBrace = 123; charCodes[charCodes["leftCurlyBrace"] = leftCurlyBrace] = "leftCurlyBrace"; // '{' + const verticalBar = 124; charCodes[charCodes["verticalBar"] = verticalBar] = "verticalBar"; // '|' + const rightCurlyBrace = 125; charCodes[charCodes["rightCurlyBrace"] = rightCurlyBrace] = "rightCurlyBrace"; // '}' + const tilde = 126; charCodes[charCodes["tilde"] = tilde] = "tilde"; // '~' + const nonBreakingSpace = 160; charCodes[charCodes["nonBreakingSpace"] = nonBreakingSpace] = "nonBreakingSpace"; + // eslint-disable-next-line no-irregular-whitespace + const oghamSpaceMark = 5760; charCodes[charCodes["oghamSpaceMark"] = oghamSpaceMark] = "oghamSpaceMark"; // ' ' + const lineSeparator = 8232; charCodes[charCodes["lineSeparator"] = lineSeparator] = "lineSeparator"; + const paragraphSeparator = 8233; charCodes[charCodes["paragraphSeparator"] = paragraphSeparator] = "paragraphSeparator"; +})(charCodes || (charCodes = {})); + +export function isDigit(code) { + return ( + (code >= charCodes.digit0 && code <= charCodes.digit9) || + (code >= charCodes.lowercaseA && code <= charCodes.lowercaseF) || + (code >= charCodes.uppercaseA && code <= charCodes.uppercaseF) + ); +} diff --git a/node_modules/sucrase/dist/esm/parser/util/identifier.js b/node_modules/sucrase/dist/esm/parser/util/identifier.js new file mode 100644 index 00000000..33a6bb14 --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/util/identifier.js @@ -0,0 +1,34 @@ +import {charCodes} from "./charcodes"; +import {WHITESPACE_CHARS} from "./whitespace"; + +function computeIsIdentifierChar(code) { + if (code < 48) return code === 36; + if (code < 58) return true; + if (code < 65) return false; + if (code < 91) return true; + if (code < 97) return code === 95; + if (code < 123) return true; + if (code < 128) return false; + throw new Error("Should not be called with non-ASCII char code."); +} + +export const IS_IDENTIFIER_CHAR = new Uint8Array(65536); +for (let i = 0; i < 128; i++) { + IS_IDENTIFIER_CHAR[i] = computeIsIdentifierChar(i) ? 1 : 0; +} +for (let i = 128; i < 65536; i++) { + IS_IDENTIFIER_CHAR[i] = 1; +} +// Aside from whitespace and newlines, all characters outside the ASCII space are either +// identifier characters or invalid. Since we're not performing code validation, we can just +// treat all invalid characters as identifier characters. +for (const whitespaceChar of WHITESPACE_CHARS) { + IS_IDENTIFIER_CHAR[whitespaceChar] = 0; +} +IS_IDENTIFIER_CHAR[0x2028] = 0; +IS_IDENTIFIER_CHAR[0x2029] = 0; + +export const IS_IDENTIFIER_START = IS_IDENTIFIER_CHAR.slice(); +for (let numChar = charCodes.digit0; numChar <= charCodes.digit9; numChar++) { + IS_IDENTIFIER_START[numChar] = 0; +} diff --git a/node_modules/sucrase/dist/esm/parser/util/whitespace.js b/node_modules/sucrase/dist/esm/parser/util/whitespace.js new file mode 100644 index 00000000..303b8a6e --- /dev/null +++ b/node_modules/sucrase/dist/esm/parser/util/whitespace.js @@ -0,0 +1,33 @@ +import {charCodes} from "./charcodes"; + +// https://tc39.github.io/ecma262/#sec-white-space +export const WHITESPACE_CHARS = [ + 0x0009, + 0x000b, + 0x000c, + charCodes.space, + charCodes.nonBreakingSpace, + charCodes.oghamSpaceMark, + 0x2000, // EN QUAD + 0x2001, // EM QUAD + 0x2002, // EN SPACE + 0x2003, // EM SPACE + 0x2004, // THREE-PER-EM SPACE + 0x2005, // FOUR-PER-EM SPACE + 0x2006, // SIX-PER-EM SPACE + 0x2007, // FIGURE SPACE + 0x2008, // PUNCTUATION SPACE + 0x2009, // THIN SPACE + 0x200a, // HAIR SPACE + 0x202f, // NARROW NO-BREAK SPACE + 0x205f, // MEDIUM MATHEMATICAL SPACE + 0x3000, // IDEOGRAPHIC SPACE + 0xfeff, // ZERO WIDTH NO-BREAK SPACE +]; + +export const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; + +export const IS_WHITESPACE = new Uint8Array(65536); +for (const char of WHITESPACE_CHARS) { + IS_WHITESPACE[char] = 1; +} diff --git a/node_modules/sucrase/dist/esm/register.js b/node_modules/sucrase/dist/esm/register.js new file mode 100644 index 00000000..ca30cab3 --- /dev/null +++ b/node_modules/sucrase/dist/esm/register.js @@ -0,0 +1,88 @@ +import * as pirates from "pirates"; + +import { transform} from "./index"; + + + + + + + + +export function addHook( + extension, + sucraseOptions, + hookOptions, +) { + let mergedSucraseOptions = sucraseOptions; + const sucraseOptionsEnvJSON = process.env.SUCRASE_OPTIONS; + if (sucraseOptionsEnvJSON) { + mergedSucraseOptions = {...mergedSucraseOptions, ...JSON.parse(sucraseOptionsEnvJSON)}; + } + return pirates.addHook( + (code, filePath) => { + const {code: transformedCode, sourceMap} = transform(code, { + ...mergedSucraseOptions, + sourceMapOptions: {compiledFilename: filePath}, + filePath, + }); + const mapBase64 = Buffer.from(JSON.stringify(sourceMap)).toString("base64"); + const suffix = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${mapBase64}`; + return `${transformedCode}\n${suffix}`; + }, + {...hookOptions, exts: [extension]}, + ); +} + +export function registerJS(hookOptions) { + return addHook(".js", {transforms: ["imports", "flow", "jsx"]}, hookOptions); +} + +export function registerJSX(hookOptions) { + return addHook(".jsx", {transforms: ["imports", "flow", "jsx"]}, hookOptions); +} + +export function registerTS(hookOptions) { + return addHook(".ts", {transforms: ["imports", "typescript"]}, hookOptions); +} + +export function registerTSX(hookOptions) { + return addHook(".tsx", {transforms: ["imports", "typescript", "jsx"]}, hookOptions); +} + +export function registerTSLegacyModuleInterop(hookOptions) { + return addHook( + ".ts", + { + transforms: ["imports", "typescript"], + enableLegacyTypeScriptModuleInterop: true, + }, + hookOptions, + ); +} + +export function registerTSXLegacyModuleInterop(hookOptions) { + return addHook( + ".tsx", + { + transforms: ["imports", "typescript", "jsx"], + enableLegacyTypeScriptModuleInterop: true, + }, + hookOptions, + ); +} + +export function registerAll(hookOptions) { + const reverts = [ + registerJS(hookOptions), + registerJSX(hookOptions), + registerTS(hookOptions), + registerTSX(hookOptions), + ]; + + return () => { + for (const fn of reverts) { + fn(); + } + }; +} diff --git a/node_modules/sucrase/dist/esm/transformers/CJSImportTransformer.js b/node_modules/sucrase/dist/esm/transformers/CJSImportTransformer.js new file mode 100644 index 00000000..78cf8967 --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/CJSImportTransformer.js @@ -0,0 +1,916 @@ + + + +import {IdentifierRole, isDeclaration, isObjectShorthandDeclaration} from "../parser/tokenizer"; +import {ContextualKeyword} from "../parser/tokenizer/keywords"; +import {TokenType as tt} from "../parser/tokenizer/types"; + +import elideImportEquals from "../util/elideImportEquals"; +import getDeclarationInfo, { + + EMPTY_DECLARATION_INFO, +} from "../util/getDeclarationInfo"; +import getImportExportSpecifierInfo from "../util/getImportExportSpecifierInfo"; +import isExportFrom from "../util/isExportFrom"; +import {removeMaybeImportAttributes} from "../util/removeMaybeImportAttributes"; +import shouldElideDefaultExport from "../util/shouldElideDefaultExport"; + + +import Transformer from "./Transformer"; + +/** + * Class for editing import statements when we are transforming to commonjs. + */ +export default class CJSImportTransformer extends Transformer { + __init() {this.hadExport = false} + __init2() {this.hadNamedExport = false} + __init3() {this.hadDefaultExport = false} + + + constructor( + rootTransformer, + tokens, + importProcessor, + nameManager, + helperManager, + reactHotLoaderTransformer, + enableLegacyBabel5ModuleInterop, + enableLegacyTypeScriptModuleInterop, + isTypeScriptTransformEnabled, + isFlowTransformEnabled, + preserveDynamicImport, + keepUnusedImports, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.importProcessor = importProcessor;this.nameManager = nameManager;this.helperManager = helperManager;this.reactHotLoaderTransformer = reactHotLoaderTransformer;this.enableLegacyBabel5ModuleInterop = enableLegacyBabel5ModuleInterop;this.enableLegacyTypeScriptModuleInterop = enableLegacyTypeScriptModuleInterop;this.isTypeScriptTransformEnabled = isTypeScriptTransformEnabled;this.isFlowTransformEnabled = isFlowTransformEnabled;this.preserveDynamicImport = preserveDynamicImport;this.keepUnusedImports = keepUnusedImports;CJSImportTransformer.prototype.__init.call(this);CJSImportTransformer.prototype.__init2.call(this);CJSImportTransformer.prototype.__init3.call(this);; + this.declarationInfo = isTypeScriptTransformEnabled + ? getDeclarationInfo(tokens) + : EMPTY_DECLARATION_INFO; + } + + getPrefixCode() { + let prefix = ""; + if (this.hadExport) { + prefix += 'Object.defineProperty(exports, "__esModule", {value: true});'; + } + return prefix; + } + + getSuffixCode() { + if (this.enableLegacyBabel5ModuleInterop && this.hadDefaultExport && !this.hadNamedExport) { + return "\nmodule.exports = exports.default;\n"; + } + return ""; + } + + process() { + // TypeScript `import foo = require('foo');` should always just be translated to plain require. + if (this.tokens.matches3(tt._import, tt.name, tt.eq)) { + return this.processImportEquals(); + } + if (this.tokens.matches1(tt._import)) { + this.processImport(); + return true; + } + if (this.tokens.matches2(tt._export, tt.eq)) { + this.tokens.replaceToken("module.exports"); + return true; + } + if (this.tokens.matches1(tt._export) && !this.tokens.currentToken().isType) { + this.hadExport = true; + return this.processExport(); + } + if (this.tokens.matches2(tt.name, tt.postIncDec)) { + // Fall through to normal identifier matching if this doesn't apply. + if (this.processPostIncDec()) { + return true; + } + } + if (this.tokens.matches1(tt.name) || this.tokens.matches1(tt.jsxName)) { + return this.processIdentifier(); + } + if (this.tokens.matches1(tt.eq)) { + return this.processAssignment(); + } + if (this.tokens.matches1(tt.assign)) { + return this.processComplexAssignment(); + } + if (this.tokens.matches1(tt.preIncDec)) { + return this.processPreIncDec(); + } + return false; + } + + processImportEquals() { + const importName = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1); + if (this.importProcessor.shouldAutomaticallyElideImportedName(importName)) { + // If this name is only used as a type, elide the whole import. + elideImportEquals(this.tokens); + } else { + // Otherwise, switch `import` to `const`. + this.tokens.replaceToken("const"); + } + return true; + } + + /** + * Transform this: + * import foo, {bar} from 'baz'; + * into + * var _baz = require('baz'); var _baz2 = _interopRequireDefault(_baz); + * + * The import code was already generated in the import preprocessing step, so + * we just need to look it up. + */ + processImport() { + if (this.tokens.matches2(tt._import, tt.parenL)) { + if (this.preserveDynamicImport) { + // Bail out, only making progress for this one token. + this.tokens.copyToken(); + return; + } + const requireWrapper = this.enableLegacyTypeScriptModuleInterop + ? "" + : `${this.helperManager.getHelperName("interopRequireWildcard")}(`; + this.tokens.replaceToken(`Promise.resolve().then(() => ${requireWrapper}require`); + const contextId = this.tokens.currentToken().contextId; + if (contextId == null) { + throw new Error("Expected context ID on dynamic import invocation."); + } + this.tokens.copyToken(); + while (!this.tokens.matchesContextIdAndLabel(tt.parenR, contextId)) { + this.rootTransformer.processToken(); + } + this.tokens.replaceToken(requireWrapper ? ")))" : "))"); + return; + } + + const shouldElideImport = this.removeImportAndDetectIfShouldElide(); + if (shouldElideImport) { + this.tokens.removeToken(); + } else { + const path = this.tokens.stringValue(); + this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path)); + this.tokens.appendCode(this.importProcessor.claimImportCode(path)); + } + removeMaybeImportAttributes(this.tokens); + if (this.tokens.matches1(tt.semi)) { + this.tokens.removeToken(); + } + } + + /** + * Erase this import (since any CJS output would be completely different), and + * return true if this import is should be elided due to being a type-only + * import. Such imports will not be emitted at all to avoid side effects. + * + * Import elision only happens with the TypeScript or Flow transforms enabled. + * + * TODO: This function has some awkward overlap with + * CJSImportProcessor.pruneTypeOnlyImports , and the two should be unified. + * That function handles TypeScript implicit import name elision, and removes + * an import if all typical imported names (without `type`) are removed due + * to being type-only imports. This function handles Flow import removal and + * properly distinguishes `import 'foo'` from `import {} from 'foo'` for TS + * purposes. + * + * The position should end at the import string. + */ + removeImportAndDetectIfShouldElide() { + this.tokens.removeInitialToken(); + if ( + this.tokens.matchesContextual(ContextualKeyword._type) && + !this.tokens.matches1AtIndex(this.tokens.currentIndex() + 1, tt.comma) && + !this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, ContextualKeyword._from) + ) { + // This is an "import type" statement, so exit early. + this.removeRemainingImport(); + return true; + } + + if (this.tokens.matches1(tt.name) || this.tokens.matches1(tt.star)) { + // We have a default import or namespace import, so there must be some + // non-type import. + this.removeRemainingImport(); + return false; + } + + if (this.tokens.matches1(tt.string)) { + // This is a bare import, so we should proceed with the import. + return false; + } + + let foundNonTypeImport = false; + let foundAnyNamedImport = false; + while (!this.tokens.matches1(tt.string)) { + // Check if any named imports are of the form "foo" or "foo as bar", with + // no leading "type". + if ( + (!foundNonTypeImport && this.tokens.matches1(tt.braceL)) || + this.tokens.matches1(tt.comma) + ) { + this.tokens.removeToken(); + if (!this.tokens.matches1(tt.braceR)) { + foundAnyNamedImport = true; + } + if ( + this.tokens.matches2(tt.name, tt.comma) || + this.tokens.matches2(tt.name, tt.braceR) || + this.tokens.matches4(tt.name, tt.name, tt.name, tt.comma) || + this.tokens.matches4(tt.name, tt.name, tt.name, tt.braceR) + ) { + foundNonTypeImport = true; + } + } + this.tokens.removeToken(); + } + if (this.keepUnusedImports) { + return false; + } + if (this.isTypeScriptTransformEnabled) { + return !foundNonTypeImport; + } else if (this.isFlowTransformEnabled) { + // In Flow, unlike TS, `import {} from 'foo';` preserves the import. + return foundAnyNamedImport && !foundNonTypeImport; + } else { + return false; + } + } + + removeRemainingImport() { + while (!this.tokens.matches1(tt.string)) { + this.tokens.removeToken(); + } + } + + processIdentifier() { + const token = this.tokens.currentToken(); + if (token.shadowsGlobal) { + return false; + } + + if (token.identifierRole === IdentifierRole.ObjectShorthand) { + return this.processObjectShorthand(); + } + + if (token.identifierRole !== IdentifierRole.Access) { + return false; + } + const replacement = this.importProcessor.getIdentifierReplacement( + this.tokens.identifierNameForToken(token), + ); + if (!replacement) { + return false; + } + // Tolerate any number of closing parens while looking for an opening paren + // that indicates a function call. + let possibleOpenParenIndex = this.tokens.currentIndex() + 1; + while ( + possibleOpenParenIndex < this.tokens.tokens.length && + this.tokens.tokens[possibleOpenParenIndex].type === tt.parenR + ) { + possibleOpenParenIndex++; + } + // Avoid treating imported functions as methods of their `exports` object + // by using `(0, f)` when the identifier is in a paren expression. Else + // use `Function.prototype.call` when the identifier is a guaranteed + // function call. When using `call`, pass undefined as the context. + if (this.tokens.tokens[possibleOpenParenIndex].type === tt.parenL) { + if ( + this.tokens.tokenAtRelativeIndex(1).type === tt.parenL && + this.tokens.tokenAtRelativeIndex(-1).type !== tt._new + ) { + this.tokens.replaceToken(`${replacement}.call(void 0, `); + // Remove the old paren. + this.tokens.removeToken(); + // Balance out the new paren. + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(tt.parenR); + } else { + // See here: http://2ality.com/2015/12/references.html + this.tokens.replaceToken(`(0, ${replacement})`); + } + } else { + this.tokens.replaceToken(replacement); + } + return true; + } + + processObjectShorthand() { + const identifier = this.tokens.identifierName(); + const replacement = this.importProcessor.getIdentifierReplacement(identifier); + if (!replacement) { + return false; + } + this.tokens.replaceToken(`${identifier}: ${replacement}`); + return true; + } + + processExport() { + if ( + this.tokens.matches2(tt._export, tt._enum) || + this.tokens.matches3(tt._export, tt._const, tt._enum) + ) { + this.hadNamedExport = true; + // Let the TypeScript transform handle it. + return false; + } + if (this.tokens.matches2(tt._export, tt._default)) { + if (this.tokens.matches3(tt._export, tt._default, tt._enum)) { + this.hadDefaultExport = true; + // Flow export default enums need some special handling, so handle them + // in that tranform rather than this one. + return false; + } + this.processExportDefault(); + return true; + } else if (this.tokens.matches2(tt._export, tt.braceL)) { + this.processExportBindings(); + return true; + } else if ( + this.tokens.matches2(tt._export, tt.name) && + this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, ContextualKeyword._type) + ) { + // export type {a}; + // export type {a as b}; + // export type {a} from './b'; + // export type * from './b'; + // export type * as ns from './b'; + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + if (this.tokens.matches1(tt.braceL)) { + while (!this.tokens.matches1(tt.braceR)) { + this.tokens.removeToken(); + } + this.tokens.removeToken(); + } else { + // * + this.tokens.removeToken(); + if (this.tokens.matches1(tt._as)) { + // as + this.tokens.removeToken(); + // ns + this.tokens.removeToken(); + } + } + // Remove type re-export `... } from './T'` + if ( + this.tokens.matchesContextual(ContextualKeyword._from) && + this.tokens.matches1AtIndex(this.tokens.currentIndex() + 1, tt.string) + ) { + this.tokens.removeToken(); + this.tokens.removeToken(); + removeMaybeImportAttributes(this.tokens); + } + return true; + } + this.hadNamedExport = true; + if ( + this.tokens.matches2(tt._export, tt._var) || + this.tokens.matches2(tt._export, tt._let) || + this.tokens.matches2(tt._export, tt._const) + ) { + this.processExportVar(); + return true; + } else if ( + this.tokens.matches2(tt._export, tt._function) || + // export async function + this.tokens.matches3(tt._export, tt.name, tt._function) + ) { + this.processExportFunction(); + return true; + } else if ( + this.tokens.matches2(tt._export, tt._class) || + this.tokens.matches3(tt._export, tt._abstract, tt._class) || + this.tokens.matches2(tt._export, tt.at) + ) { + this.processExportClass(); + return true; + } else if (this.tokens.matches2(tt._export, tt.star)) { + this.processExportStar(); + return true; + } else { + throw new Error("Unrecognized export syntax."); + } + } + + processAssignment() { + const index = this.tokens.currentIndex(); + const identifierToken = this.tokens.tokens[index - 1]; + // If the LHS is a type identifier, this must be a declaration like `let a: b = c;`, + // with `b` as the identifier, so nothing needs to be done in that case. + if (identifierToken.isType || identifierToken.type !== tt.name) { + return false; + } + if (identifierToken.shadowsGlobal) { + return false; + } + if (index >= 2 && this.tokens.matches1AtIndex(index - 2, tt.dot)) { + return false; + } + if (index >= 2 && [tt._var, tt._let, tt._const].includes(this.tokens.tokens[index - 2].type)) { + // Declarations don't need an extra assignment. This doesn't avoid the + // assignment for comma-separated declarations, but it's still correct + // since the assignment is just redundant. + return false; + } + const assignmentSnippet = this.importProcessor.resolveExportBinding( + this.tokens.identifierNameForToken(identifierToken), + ); + if (!assignmentSnippet) { + return false; + } + this.tokens.copyToken(); + this.tokens.appendCode(` ${assignmentSnippet} =`); + return true; + } + + /** + * Process something like `a += 3`, where `a` might be an exported value. + */ + processComplexAssignment() { + const index = this.tokens.currentIndex(); + const identifierToken = this.tokens.tokens[index - 1]; + if (identifierToken.type !== tt.name) { + return false; + } + if (identifierToken.shadowsGlobal) { + return false; + } + if (index >= 2 && this.tokens.matches1AtIndex(index - 2, tt.dot)) { + return false; + } + const assignmentSnippet = this.importProcessor.resolveExportBinding( + this.tokens.identifierNameForToken(identifierToken), + ); + if (!assignmentSnippet) { + return false; + } + this.tokens.appendCode(` = ${assignmentSnippet}`); + this.tokens.copyToken(); + return true; + } + + /** + * Process something like `++a`, where `a` might be an exported value. + */ + processPreIncDec() { + const index = this.tokens.currentIndex(); + const identifierToken = this.tokens.tokens[index + 1]; + if (identifierToken.type !== tt.name) { + return false; + } + if (identifierToken.shadowsGlobal) { + return false; + } + // Ignore things like ++a.b and ++a[b] and ++a().b. + if ( + index + 2 < this.tokens.tokens.length && + (this.tokens.matches1AtIndex(index + 2, tt.dot) || + this.tokens.matches1AtIndex(index + 2, tt.bracketL) || + this.tokens.matches1AtIndex(index + 2, tt.parenL)) + ) { + return false; + } + const identifierName = this.tokens.identifierNameForToken(identifierToken); + const assignmentSnippet = this.importProcessor.resolveExportBinding(identifierName); + if (!assignmentSnippet) { + return false; + } + this.tokens.appendCode(`${assignmentSnippet} = `); + this.tokens.copyToken(); + return true; + } + + /** + * Process something like `a++`, where `a` might be an exported value. + * This starts at the `a`, not at the `++`. + */ + processPostIncDec() { + const index = this.tokens.currentIndex(); + const identifierToken = this.tokens.tokens[index]; + const operatorToken = this.tokens.tokens[index + 1]; + if (identifierToken.type !== tt.name) { + return false; + } + if (identifierToken.shadowsGlobal) { + return false; + } + if (index >= 1 && this.tokens.matches1AtIndex(index - 1, tt.dot)) { + return false; + } + const identifierName = this.tokens.identifierNameForToken(identifierToken); + const assignmentSnippet = this.importProcessor.resolveExportBinding(identifierName); + if (!assignmentSnippet) { + return false; + } + const operatorCode = this.tokens.rawCodeForToken(operatorToken); + // We might also replace the identifier with something like exports.x, so + // do that replacement here as well. + const base = this.importProcessor.getIdentifierReplacement(identifierName) || identifierName; + if (operatorCode === "++") { + this.tokens.replaceToken(`(${base} = ${assignmentSnippet} = ${base} + 1, ${base} - 1)`); + } else if (operatorCode === "--") { + this.tokens.replaceToken(`(${base} = ${assignmentSnippet} = ${base} - 1, ${base} + 1)`); + } else { + throw new Error(`Unexpected operator: ${operatorCode}`); + } + this.tokens.removeToken(); + return true; + } + + processExportDefault() { + let exportedRuntimeValue = true; + if ( + this.tokens.matches4(tt._export, tt._default, tt._function, tt.name) || + // export default async function + (this.tokens.matches5(tt._export, tt._default, tt.name, tt._function, tt.name) && + this.tokens.matchesContextualAtIndex( + this.tokens.currentIndex() + 2, + ContextualKeyword._async, + )) + ) { + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + // Named function export case: change it to a top-level function + // declaration followed by exports statement. + const name = this.processNamedFunction(); + this.tokens.appendCode(` exports.default = ${name};`); + } else if ( + this.tokens.matches4(tt._export, tt._default, tt._class, tt.name) || + this.tokens.matches5(tt._export, tt._default, tt._abstract, tt._class, tt.name) || + this.tokens.matches3(tt._export, tt._default, tt.at) + ) { + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + this.copyDecorators(); + if (this.tokens.matches1(tt._abstract)) { + this.tokens.removeToken(); + } + const name = this.rootTransformer.processNamedClass(); + this.tokens.appendCode(` exports.default = ${name};`); + // After this point, this is a plain "export default E" statement. + } else if ( + shouldElideDefaultExport( + this.isTypeScriptTransformEnabled, + this.keepUnusedImports, + this.tokens, + this.declarationInfo, + ) + ) { + // If the exported value is just an identifier and should be elided by TypeScript + // rules, then remove it entirely. It will always have the form `export default e`, + // where `e` is an identifier. + exportedRuntimeValue = false; + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + this.tokens.removeToken(); + } else if (this.reactHotLoaderTransformer) { + // We need to assign E to a variable. Change "export default E" to + // "let _default; exports.default = _default = E" + const defaultVarName = this.nameManager.claimFreeName("_default"); + this.tokens.replaceToken(`let ${defaultVarName}; exports.`); + this.tokens.copyToken(); + this.tokens.appendCode(` = ${defaultVarName} =`); + this.reactHotLoaderTransformer.setExtractedDefaultExportName(defaultVarName); + } else { + // Change "export default E" to "exports.default = E" + this.tokens.replaceToken("exports."); + this.tokens.copyToken(); + this.tokens.appendCode(" ="); + } + if (exportedRuntimeValue) { + this.hadDefaultExport = true; + } + } + + copyDecorators() { + while (this.tokens.matches1(tt.at)) { + this.tokens.copyToken(); + if (this.tokens.matches1(tt.parenL)) { + this.tokens.copyExpectedToken(tt.parenL); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(tt.parenR); + } else { + this.tokens.copyExpectedToken(tt.name); + while (this.tokens.matches1(tt.dot)) { + this.tokens.copyExpectedToken(tt.dot); + this.tokens.copyExpectedToken(tt.name); + } + if (this.tokens.matches1(tt.parenL)) { + this.tokens.copyExpectedToken(tt.parenL); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(tt.parenR); + } + } + } + } + + /** + * Transform a declaration like `export var`, `export let`, or `export const`. + */ + processExportVar() { + if (this.isSimpleExportVar()) { + this.processSimpleExportVar(); + } else { + this.processComplexExportVar(); + } + } + + /** + * Determine if the export is of the form: + * export var/let/const [varName] = [expr]; + * In other words, determine if function name inference might apply. + */ + isSimpleExportVar() { + let tokenIndex = this.tokens.currentIndex(); + // export + tokenIndex++; + // var/let/const + tokenIndex++; + if (!this.tokens.matches1AtIndex(tokenIndex, tt.name)) { + return false; + } + tokenIndex++; + while (tokenIndex < this.tokens.tokens.length && this.tokens.tokens[tokenIndex].isType) { + tokenIndex++; + } + if (!this.tokens.matches1AtIndex(tokenIndex, tt.eq)) { + return false; + } + return true; + } + + /** + * Transform an `export var` declaration initializing a single variable. + * + * For example, this: + * export const f = () => {}; + * becomes this: + * const f = () => {}; exports.f = f; + * + * The variable is unused (e.g. exports.f has the true value of the export). + * We need to produce an assignment of this form so that the function will + * have an inferred name of "f", which wouldn't happen in the more general + * case below. + */ + processSimpleExportVar() { + // export + this.tokens.removeInitialToken(); + // var/let/const + this.tokens.copyToken(); + const varName = this.tokens.identifierName(); + // x: number -> x + while (!this.tokens.matches1(tt.eq)) { + this.rootTransformer.processToken(); + } + const endIndex = this.tokens.currentToken().rhsEndIndex; + if (endIndex == null) { + throw new Error("Expected = token with an end index."); + } + while (this.tokens.currentIndex() < endIndex) { + this.rootTransformer.processToken(); + } + this.tokens.appendCode(`; exports.${varName} = ${varName}`); + } + + /** + * Transform normal declaration exports, including handling destructuring. + * For example, this: + * export const {x: [a = 2, b], c} = d; + * becomes this: + * ({x: [exports.a = 2, exports.b], c: exports.c} = d;) + */ + processComplexExportVar() { + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + const needsParens = this.tokens.matches1(tt.braceL); + if (needsParens) { + this.tokens.appendCode("("); + } + + let depth = 0; + while (true) { + if ( + this.tokens.matches1(tt.braceL) || + this.tokens.matches1(tt.dollarBraceL) || + this.tokens.matches1(tt.bracketL) + ) { + depth++; + this.tokens.copyToken(); + } else if (this.tokens.matches1(tt.braceR) || this.tokens.matches1(tt.bracketR)) { + depth--; + this.tokens.copyToken(); + } else if ( + depth === 0 && + !this.tokens.matches1(tt.name) && + !this.tokens.currentToken().isType + ) { + break; + } else if (this.tokens.matches1(tt.eq)) { + // Default values might have assignments in the RHS that we want to ignore, so skip past + // them. + const endIndex = this.tokens.currentToken().rhsEndIndex; + if (endIndex == null) { + throw new Error("Expected = token with an end index."); + } + while (this.tokens.currentIndex() < endIndex) { + this.rootTransformer.processToken(); + } + } else { + const token = this.tokens.currentToken(); + if (isDeclaration(token)) { + const name = this.tokens.identifierName(); + let replacement = this.importProcessor.getIdentifierReplacement(name); + if (replacement === null) { + throw new Error(`Expected a replacement for ${name} in \`export var\` syntax.`); + } + if (isObjectShorthandDeclaration(token)) { + replacement = `${name}: ${replacement}`; + } + this.tokens.replaceToken(replacement); + } else { + this.rootTransformer.processToken(); + } + } + } + + if (needsParens) { + // Seek to the end of the RHS. + const endIndex = this.tokens.currentToken().rhsEndIndex; + if (endIndex == null) { + throw new Error("Expected = token with an end index."); + } + while (this.tokens.currentIndex() < endIndex) { + this.rootTransformer.processToken(); + } + this.tokens.appendCode(")"); + } + } + + /** + * Transform this: + * export function foo() {} + * into this: + * function foo() {} exports.foo = foo; + */ + processExportFunction() { + this.tokens.replaceToken(""); + const name = this.processNamedFunction(); + this.tokens.appendCode(` exports.${name} = ${name};`); + } + + /** + * Skip past a function with a name and return that name. + */ + processNamedFunction() { + if (this.tokens.matches1(tt._function)) { + this.tokens.copyToken(); + } else if (this.tokens.matches2(tt.name, tt._function)) { + if (!this.tokens.matchesContextual(ContextualKeyword._async)) { + throw new Error("Expected async keyword in function export."); + } + this.tokens.copyToken(); + this.tokens.copyToken(); + } + if (this.tokens.matches1(tt.star)) { + this.tokens.copyToken(); + } + if (!this.tokens.matches1(tt.name)) { + throw new Error("Expected identifier for exported function name."); + } + const name = this.tokens.identifierName(); + this.tokens.copyToken(); + if (this.tokens.currentToken().isType) { + this.tokens.removeInitialToken(); + while (this.tokens.currentToken().isType) { + this.tokens.removeToken(); + } + } + this.tokens.copyExpectedToken(tt.parenL); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(tt.parenR); + this.rootTransformer.processPossibleTypeRange(); + this.tokens.copyExpectedToken(tt.braceL); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(tt.braceR); + return name; + } + + /** + * Transform this: + * export class A {} + * into this: + * class A {} exports.A = A; + */ + processExportClass() { + this.tokens.removeInitialToken(); + this.copyDecorators(); + if (this.tokens.matches1(tt._abstract)) { + this.tokens.removeToken(); + } + const name = this.rootTransformer.processNamedClass(); + this.tokens.appendCode(` exports.${name} = ${name};`); + } + + /** + * Transform this: + * export {a, b as c}; + * into this: + * exports.a = a; exports.c = b; + * + * OR + * + * Transform this: + * export {a, b as c} from './foo'; + * into the pre-generated Object.defineProperty code from the ImportProcessor. + * + * For the first case, if the TypeScript transform is enabled, we need to skip + * exports that are only defined as types. + */ + processExportBindings() { + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + + const isReExport = isExportFrom(this.tokens); + + const exportStatements = []; + while (true) { + if (this.tokens.matches1(tt.braceR)) { + this.tokens.removeToken(); + break; + } + + const specifierInfo = getImportExportSpecifierInfo(this.tokens); + + while (this.tokens.currentIndex() < specifierInfo.endIndex) { + this.tokens.removeToken(); + } + + const shouldRemoveExport = + specifierInfo.isType || + (!isReExport && this.shouldElideExportedIdentifier(specifierInfo.leftName)); + if (!shouldRemoveExport) { + const exportedName = specifierInfo.rightName; + if (exportedName === "default") { + this.hadDefaultExport = true; + } else { + this.hadNamedExport = true; + } + const localName = specifierInfo.leftName; + const newLocalName = this.importProcessor.getIdentifierReplacement(localName); + exportStatements.push(`exports.${exportedName} = ${newLocalName || localName};`); + } + + if (this.tokens.matches1(tt.braceR)) { + this.tokens.removeToken(); + break; + } + if (this.tokens.matches2(tt.comma, tt.braceR)) { + this.tokens.removeToken(); + this.tokens.removeToken(); + break; + } else if (this.tokens.matches1(tt.comma)) { + this.tokens.removeToken(); + } else { + throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`); + } + } + + if (this.tokens.matchesContextual(ContextualKeyword._from)) { + // This is an export...from, so throw away the normal named export code + // and use the Object.defineProperty code from ImportProcessor. + this.tokens.removeToken(); + const path = this.tokens.stringValue(); + this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path)); + removeMaybeImportAttributes(this.tokens); + } else { + // This is a normal named export, so use that. + this.tokens.appendCode(exportStatements.join(" ")); + } + + if (this.tokens.matches1(tt.semi)) { + this.tokens.removeToken(); + } + } + + processExportStar() { + this.tokens.removeInitialToken(); + while (!this.tokens.matches1(tt.string)) { + this.tokens.removeToken(); + } + const path = this.tokens.stringValue(); + this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path)); + removeMaybeImportAttributes(this.tokens); + if (this.tokens.matches1(tt.semi)) { + this.tokens.removeToken(); + } + } + + shouldElideExportedIdentifier(name) { + return ( + this.isTypeScriptTransformEnabled && + !this.keepUnusedImports && + !this.declarationInfo.valueDeclarations.has(name) + ); + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/ESMImportTransformer.js b/node_modules/sucrase/dist/esm/transformers/ESMImportTransformer.js new file mode 100644 index 00000000..b45cd3e0 --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/ESMImportTransformer.js @@ -0,0 +1,415 @@ + + + +import {ContextualKeyword} from "../parser/tokenizer/keywords"; +import {TokenType as tt} from "../parser/tokenizer/types"; + +import elideImportEquals from "../util/elideImportEquals"; +import getDeclarationInfo, { + + EMPTY_DECLARATION_INFO, +} from "../util/getDeclarationInfo"; +import getImportExportSpecifierInfo from "../util/getImportExportSpecifierInfo"; +import {getNonTypeIdentifiers} from "../util/getNonTypeIdentifiers"; +import isExportFrom from "../util/isExportFrom"; +import {removeMaybeImportAttributes} from "../util/removeMaybeImportAttributes"; +import shouldElideDefaultExport from "../util/shouldElideDefaultExport"; + +import Transformer from "./Transformer"; + +/** + * Class for editing import statements when we are keeping the code as ESM. We still need to remove + * type-only imports in TypeScript and Flow. + */ +export default class ESMImportTransformer extends Transformer { + + + + + constructor( + tokens, + nameManager, + helperManager, + reactHotLoaderTransformer, + isTypeScriptTransformEnabled, + isFlowTransformEnabled, + keepUnusedImports, + options, + ) { + super();this.tokens = tokens;this.nameManager = nameManager;this.helperManager = helperManager;this.reactHotLoaderTransformer = reactHotLoaderTransformer;this.isTypeScriptTransformEnabled = isTypeScriptTransformEnabled;this.isFlowTransformEnabled = isFlowTransformEnabled;this.keepUnusedImports = keepUnusedImports;; + this.nonTypeIdentifiers = + isTypeScriptTransformEnabled && !keepUnusedImports + ? getNonTypeIdentifiers(tokens, options) + : new Set(); + this.declarationInfo = + isTypeScriptTransformEnabled && !keepUnusedImports + ? getDeclarationInfo(tokens) + : EMPTY_DECLARATION_INFO; + this.injectCreateRequireForImportRequire = Boolean(options.injectCreateRequireForImportRequire); + } + + process() { + // TypeScript `import foo = require('foo');` should always just be translated to plain require. + if (this.tokens.matches3(tt._import, tt.name, tt.eq)) { + return this.processImportEquals(); + } + if ( + this.tokens.matches4(tt._import, tt.name, tt.name, tt.eq) && + this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, ContextualKeyword._type) + ) { + // import type T = require('T') + this.tokens.removeInitialToken(); + // This construct is always exactly 8 tokens long, so remove the 7 remaining tokens. + for (let i = 0; i < 7; i++) { + this.tokens.removeToken(); + } + return true; + } + if (this.tokens.matches2(tt._export, tt.eq)) { + this.tokens.replaceToken("module.exports"); + return true; + } + if ( + this.tokens.matches5(tt._export, tt._import, tt.name, tt.name, tt.eq) && + this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 2, ContextualKeyword._type) + ) { + // export import type T = require('T') + this.tokens.removeInitialToken(); + // This construct is always exactly 9 tokens long, so remove the 8 remaining tokens. + for (let i = 0; i < 8; i++) { + this.tokens.removeToken(); + } + return true; + } + if (this.tokens.matches1(tt._import)) { + return this.processImport(); + } + if (this.tokens.matches2(tt._export, tt._default)) { + return this.processExportDefault(); + } + if (this.tokens.matches2(tt._export, tt.braceL)) { + return this.processNamedExports(); + } + if ( + this.tokens.matches2(tt._export, tt.name) && + this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, ContextualKeyword._type) + ) { + // export type {a}; + // export type {a as b}; + // export type {a} from './b'; + // export type * from './b'; + // export type * as ns from './b'; + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + if (this.tokens.matches1(tt.braceL)) { + while (!this.tokens.matches1(tt.braceR)) { + this.tokens.removeToken(); + } + this.tokens.removeToken(); + } else { + // * + this.tokens.removeToken(); + if (this.tokens.matches1(tt._as)) { + // as + this.tokens.removeToken(); + // ns + this.tokens.removeToken(); + } + } + // Remove type re-export `... } from './T'` + if ( + this.tokens.matchesContextual(ContextualKeyword._from) && + this.tokens.matches1AtIndex(this.tokens.currentIndex() + 1, tt.string) + ) { + this.tokens.removeToken(); + this.tokens.removeToken(); + removeMaybeImportAttributes(this.tokens); + } + return true; + } + return false; + } + + processImportEquals() { + const importName = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1); + if (this.shouldAutomaticallyElideImportedName(importName)) { + // If this name is only used as a type, elide the whole import. + elideImportEquals(this.tokens); + } else if (this.injectCreateRequireForImportRequire) { + // We're using require in an environment (Node ESM) that doesn't provide + // it as a global, so generate a helper to import it. + // import -> const + this.tokens.replaceToken("const"); + // Foo + this.tokens.copyToken(); + // = + this.tokens.copyToken(); + // require + this.tokens.replaceToken(this.helperManager.getHelperName("require")); + } else { + // Otherwise, just switch `import` to `const`. + this.tokens.replaceToken("const"); + } + return true; + } + + processImport() { + if (this.tokens.matches2(tt._import, tt.parenL)) { + // Dynamic imports don't need to be transformed. + return false; + } + + const snapshot = this.tokens.snapshot(); + const allImportsRemoved = this.removeImportTypeBindings(); + if (allImportsRemoved) { + this.tokens.restoreToSnapshot(snapshot); + while (!this.tokens.matches1(tt.string)) { + this.tokens.removeToken(); + } + this.tokens.removeToken(); + removeMaybeImportAttributes(this.tokens); + if (this.tokens.matches1(tt.semi)) { + this.tokens.removeToken(); + } + } + return true; + } + + /** + * Remove type bindings from this import, leaving the rest of the import intact. + * + * Return true if this import was ONLY types, and thus is eligible for removal. This will bail out + * of the replacement operation, so we can return early here. + */ + removeImportTypeBindings() { + this.tokens.copyExpectedToken(tt._import); + if ( + this.tokens.matchesContextual(ContextualKeyword._type) && + !this.tokens.matches1AtIndex(this.tokens.currentIndex() + 1, tt.comma) && + !this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, ContextualKeyword._from) + ) { + // This is an "import type" statement, so exit early. + return true; + } + + if (this.tokens.matches1(tt.string)) { + // This is a bare import, so we should proceed with the import. + this.tokens.copyToken(); + return false; + } + + // Skip the "module" token in import reflection. + if ( + this.tokens.matchesContextual(ContextualKeyword._module) && + this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 2, ContextualKeyword._from) + ) { + this.tokens.copyToken(); + } + + let foundNonTypeImport = false; + let foundAnyNamedImport = false; + let needsComma = false; + + // Handle default import. + if (this.tokens.matches1(tt.name)) { + if (this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())) { + this.tokens.removeToken(); + if (this.tokens.matches1(tt.comma)) { + this.tokens.removeToken(); + } + } else { + foundNonTypeImport = true; + this.tokens.copyToken(); + if (this.tokens.matches1(tt.comma)) { + // We're in a statement like: + // import A, * as B from './A'; + // or + // import A, {foo} from './A'; + // where the `A` is being kept. The comma should be removed if an only + // if the next part of the import statement is elided, but that's hard + // to determine at this point in the code. Instead, always remove it + // and set a flag to add it back if necessary. + needsComma = true; + this.tokens.removeToken(); + } + } + } + + if (this.tokens.matches1(tt.star)) { + if (this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))) { + this.tokens.removeToken(); + this.tokens.removeToken(); + this.tokens.removeToken(); + } else { + if (needsComma) { + this.tokens.appendCode(","); + } + foundNonTypeImport = true; + this.tokens.copyExpectedToken(tt.star); + this.tokens.copyExpectedToken(tt.name); + this.tokens.copyExpectedToken(tt.name); + } + } else if (this.tokens.matches1(tt.braceL)) { + if (needsComma) { + this.tokens.appendCode(","); + } + this.tokens.copyToken(); + while (!this.tokens.matches1(tt.braceR)) { + foundAnyNamedImport = true; + const specifierInfo = getImportExportSpecifierInfo(this.tokens); + if ( + specifierInfo.isType || + this.shouldAutomaticallyElideImportedName(specifierInfo.rightName) + ) { + while (this.tokens.currentIndex() < specifierInfo.endIndex) { + this.tokens.removeToken(); + } + if (this.tokens.matches1(tt.comma)) { + this.tokens.removeToken(); + } + } else { + foundNonTypeImport = true; + while (this.tokens.currentIndex() < specifierInfo.endIndex) { + this.tokens.copyToken(); + } + if (this.tokens.matches1(tt.comma)) { + this.tokens.copyToken(); + } + } + } + this.tokens.copyExpectedToken(tt.braceR); + } + + if (this.keepUnusedImports) { + return false; + } + if (this.isTypeScriptTransformEnabled) { + return !foundNonTypeImport; + } else if (this.isFlowTransformEnabled) { + // In Flow, unlike TS, `import {} from 'foo';` preserves the import. + return foundAnyNamedImport && !foundNonTypeImport; + } else { + return false; + } + } + + shouldAutomaticallyElideImportedName(name) { + return ( + this.isTypeScriptTransformEnabled && + !this.keepUnusedImports && + !this.nonTypeIdentifiers.has(name) + ); + } + + processExportDefault() { + if ( + shouldElideDefaultExport( + this.isTypeScriptTransformEnabled, + this.keepUnusedImports, + this.tokens, + this.declarationInfo, + ) + ) { + // If the exported value is just an identifier and should be elided by TypeScript + // rules, then remove it entirely. It will always have the form `export default e`, + // where `e` is an identifier. + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + this.tokens.removeToken(); + return true; + } + + const alreadyHasName = + this.tokens.matches4(tt._export, tt._default, tt._function, tt.name) || + // export default async function + (this.tokens.matches5(tt._export, tt._default, tt.name, tt._function, tt.name) && + this.tokens.matchesContextualAtIndex( + this.tokens.currentIndex() + 2, + ContextualKeyword._async, + )) || + this.tokens.matches4(tt._export, tt._default, tt._class, tt.name) || + this.tokens.matches5(tt._export, tt._default, tt._abstract, tt._class, tt.name); + + if (!alreadyHasName && this.reactHotLoaderTransformer) { + // This is a plain "export default E" statement and we need to assign E to a variable. + // Change "export default E" to "let _default; export default _default = E" + const defaultVarName = this.nameManager.claimFreeName("_default"); + this.tokens.replaceToken(`let ${defaultVarName}; export`); + this.tokens.copyToken(); + this.tokens.appendCode(` ${defaultVarName} =`); + this.reactHotLoaderTransformer.setExtractedDefaultExportName(defaultVarName); + return true; + } + return false; + } + + /** + * Handle a statement with one of these forms: + * export {a, type b}; + * export {c, type d} from 'foo'; + * + * In both cases, any explicit type exports should be removed. In the first + * case, we also need to handle implicit export elision for names declared as + * types. In the second case, we must NOT do implicit named export elision, + * but we must remove the runtime import if all exports are type exports. + */ + processNamedExports() { + if (!this.isTypeScriptTransformEnabled) { + return false; + } + this.tokens.copyExpectedToken(tt._export); + this.tokens.copyExpectedToken(tt.braceL); + + const isReExport = isExportFrom(this.tokens); + let foundNonTypeExport = false; + while (!this.tokens.matches1(tt.braceR)) { + const specifierInfo = getImportExportSpecifierInfo(this.tokens); + if ( + specifierInfo.isType || + (!isReExport && this.shouldElideExportedName(specifierInfo.leftName)) + ) { + // Type export, so remove all tokens, including any comma. + while (this.tokens.currentIndex() < specifierInfo.endIndex) { + this.tokens.removeToken(); + } + if (this.tokens.matches1(tt.comma)) { + this.tokens.removeToken(); + } + } else { + // Non-type export, so copy all tokens, including any comma. + foundNonTypeExport = true; + while (this.tokens.currentIndex() < specifierInfo.endIndex) { + this.tokens.copyToken(); + } + if (this.tokens.matches1(tt.comma)) { + this.tokens.copyToken(); + } + } + } + this.tokens.copyExpectedToken(tt.braceR); + + if (!this.keepUnusedImports && isReExport && !foundNonTypeExport) { + // This is a type-only re-export, so skip evaluating the other module. Technically this + // leaves the statement as `export {}`, but that's ok since that's a no-op. + this.tokens.removeToken(); + this.tokens.removeToken(); + removeMaybeImportAttributes(this.tokens); + } + + return true; + } + + /** + * ESM elides all imports with the rule that we only elide if we see that it's + * a type and never see it as a value. This is in contrast to CJS, which + * elides imports that are completely unknown. + */ + shouldElideExportedName(name) { + return ( + this.isTypeScriptTransformEnabled && + !this.keepUnusedImports && + this.declarationInfo.typeDeclarations.has(name) && + !this.declarationInfo.valueDeclarations.has(name) + ); + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/FlowTransformer.js b/node_modules/sucrase/dist/esm/transformers/FlowTransformer.js new file mode 100644 index 00000000..7df0aca9 --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/FlowTransformer.js @@ -0,0 +1,182 @@ +import {ContextualKeyword} from "../parser/tokenizer/keywords"; +import {TokenType as tt} from "../parser/tokenizer/types"; + + +import Transformer from "./Transformer"; + +export default class FlowTransformer extends Transformer { + constructor( + rootTransformer, + tokens, + isImportsTransformEnabled, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.isImportsTransformEnabled = isImportsTransformEnabled;; + } + + process() { + if ( + this.rootTransformer.processPossibleArrowParamEnd() || + this.rootTransformer.processPossibleAsyncArrowWithTypeParams() || + this.rootTransformer.processPossibleTypeRange() + ) { + return true; + } + if (this.tokens.matches1(tt._enum)) { + this.processEnum(); + return true; + } + if (this.tokens.matches2(tt._export, tt._enum)) { + this.processNamedExportEnum(); + return true; + } + if (this.tokens.matches3(tt._export, tt._default, tt._enum)) { + this.processDefaultExportEnum(); + return true; + } + return false; + } + + /** + * Handle a declaration like: + * export enum E ... + * + * With this imports transform, this becomes: + * const E = [[enum]]; exports.E = E; + * + * otherwise, it becomes: + * export const E = [[enum]]; + */ + processNamedExportEnum() { + if (this.isImportsTransformEnabled) { + // export + this.tokens.removeInitialToken(); + const enumName = this.tokens.identifierNameAtRelativeIndex(1); + this.processEnum(); + this.tokens.appendCode(` exports.${enumName} = ${enumName};`); + } else { + this.tokens.copyToken(); + this.processEnum(); + } + } + + /** + * Handle a declaration like: + * export default enum E + * + * With the imports transform, this becomes: + * const E = [[enum]]; exports.default = E; + * + * otherwise, it becomes: + * const E = [[enum]]; export default E; + */ + processDefaultExportEnum() { + // export + this.tokens.removeInitialToken(); + // default + this.tokens.removeToken(); + const enumName = this.tokens.identifierNameAtRelativeIndex(1); + this.processEnum(); + if (this.isImportsTransformEnabled) { + this.tokens.appendCode(` exports.default = ${enumName};`); + } else { + this.tokens.appendCode(` export default ${enumName};`); + } + } + + /** + * Transpile flow enums to invoke the "flow-enums-runtime" library. + * + * Currently, the transpiled code always uses `require("flow-enums-runtime")`, + * but if future flexibility is needed, we could expose a config option for + * this string (similar to configurable JSX). Even when targeting ESM, the + * default behavior of babel-plugin-transform-flow-enums is to use require + * rather than injecting an import. + * + * Flow enums are quite a bit simpler than TS enums and have some convenient + * constraints: + * - Element initializers must be either always present or always absent. That + * means that we can use fixed lookahead on the first element (if any) and + * assume that all elements are like that. + * - The right-hand side of an element initializer must be a literal value, + * not a complex expression and not referencing other elements. That means + * we can simply copy a single token. + * + * Enums can be broken up into three basic cases: + * + * Mirrored enums: + * enum E {A, B} + * -> + * const E = require("flow-enums-runtime").Mirrored(["A", "B"]); + * + * Initializer enums: + * enum E {A = 1, B = 2} + * -> + * const E = require("flow-enums-runtime")({A: 1, B: 2}); + * + * Symbol enums: + * enum E of symbol {A, B} + * -> + * const E = require("flow-enums-runtime")({A: Symbol("A"), B: Symbol("B")}); + * + * We can statically detect which of the three cases this is by looking at the + * "of" declaration (if any) and seeing if the first element has an initializer. + * Since the other transform details are so similar between the three cases, we + * use a single implementation and vary the transform within processEnumElement + * based on case. + */ + processEnum() { + // enum E -> const E + this.tokens.replaceToken("const"); + this.tokens.copyExpectedToken(tt.name); + + let isSymbolEnum = false; + if (this.tokens.matchesContextual(ContextualKeyword._of)) { + this.tokens.removeToken(); + isSymbolEnum = this.tokens.matchesContextual(ContextualKeyword._symbol); + this.tokens.removeToken(); + } + const hasInitializers = this.tokens.matches3(tt.braceL, tt.name, tt.eq); + this.tokens.appendCode(' = require("flow-enums-runtime")'); + + const isMirrored = !isSymbolEnum && !hasInitializers; + this.tokens.replaceTokenTrimmingLeftWhitespace(isMirrored ? ".Mirrored([" : "({"); + + while (!this.tokens.matches1(tt.braceR)) { + // ... is allowed at the end and has no runtime behavior. + if (this.tokens.matches1(tt.ellipsis)) { + this.tokens.removeToken(); + break; + } + this.processEnumElement(isSymbolEnum, hasInitializers); + if (this.tokens.matches1(tt.comma)) { + this.tokens.copyToken(); + } + } + + this.tokens.replaceToken(isMirrored ? "]);" : "});"); + } + + /** + * Process an individual enum element, producing either an array element or an + * object element based on what type of enum this is. + */ + processEnumElement(isSymbolEnum, hasInitializers) { + if (isSymbolEnum) { + // Symbol enums never have initializers and are expanded to object elements. + // A, -> A: Symbol("A"), + const elementName = this.tokens.identifierName(); + this.tokens.copyToken(); + this.tokens.appendCode(`: Symbol("${elementName}")`); + } else if (hasInitializers) { + // Initializers are expanded to object elements. + // A = 1, -> A: 1, + this.tokens.copyToken(); + this.tokens.replaceTokenTrimmingLeftWhitespace(":"); + this.tokens.copyToken(); + } else { + // Enum elements without initializers become string literal array elements. + // A, -> "A", + this.tokens.replaceToken(`"${this.tokens.identifierName()}"`); + } + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/JSXTransformer.js b/node_modules/sucrase/dist/esm/transformers/JSXTransformer.js new file mode 100644 index 00000000..e5f5ae57 --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/JSXTransformer.js @@ -0,0 +1,733 @@ + + + +import XHTMLEntities from "../parser/plugins/jsx/xhtml"; +import {JSXRole} from "../parser/tokenizer"; +import {TokenType as tt} from "../parser/tokenizer/types"; +import {charCodes} from "../parser/util/charcodes"; + +import getJSXPragmaInfo, {} from "../util/getJSXPragmaInfo"; + +import Transformer from "./Transformer"; + +export default class JSXTransformer extends Transformer { + + + + + // State for calculating the line number of each JSX tag in development. + __init() {this.lastLineNumber = 1} + __init2() {this.lastIndex = 0} + + // In development, variable name holding the name of the current file. + __init3() {this.filenameVarName = null} + // Mapping of claimed names for imports in the automatic transform, e,g. + // {jsx: "_jsx"}. This determines which imports to generate in the prefix. + __init4() {this.esmAutomaticImportNameResolutions = {}} + // When automatically adding imports in CJS mode, we store the variable name + // holding the imported CJS module so we can require it in the prefix. + __init5() {this.cjsAutomaticModuleNameResolutions = {}} + + constructor( + rootTransformer, + tokens, + importProcessor, + nameManager, + options, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.importProcessor = importProcessor;this.nameManager = nameManager;this.options = options;JSXTransformer.prototype.__init.call(this);JSXTransformer.prototype.__init2.call(this);JSXTransformer.prototype.__init3.call(this);JSXTransformer.prototype.__init4.call(this);JSXTransformer.prototype.__init5.call(this);; + this.jsxPragmaInfo = getJSXPragmaInfo(options); + this.isAutomaticRuntime = options.jsxRuntime === "automatic"; + this.jsxImportSource = options.jsxImportSource || "react"; + } + + process() { + if (this.tokens.matches1(tt.jsxTagStart)) { + this.processJSXTag(); + return true; + } + return false; + } + + getPrefixCode() { + let prefix = ""; + if (this.filenameVarName) { + prefix += `const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath || "")};`; + } + if (this.isAutomaticRuntime) { + if (this.importProcessor) { + // CJS mode: emit require statements for all modules that were referenced. + for (const [path, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) { + prefix += `var ${resolvedName} = require("${path}");`; + } + } else { + // ESM mode: consolidate and emit import statements for referenced names. + const {createElement: createElementResolution, ...otherResolutions} = + this.esmAutomaticImportNameResolutions; + if (createElementResolution) { + prefix += `import {createElement as ${createElementResolution}} from "${this.jsxImportSource}";`; + } + const importSpecifiers = Object.entries(otherResolutions) + .map(([name, resolvedName]) => `${name} as ${resolvedName}`) + .join(", "); + if (importSpecifiers) { + const importPath = + this.jsxImportSource + (this.options.production ? "/jsx-runtime" : "/jsx-dev-runtime"); + prefix += `import {${importSpecifiers}} from "${importPath}";`; + } + } + } + return prefix; + } + + processJSXTag() { + const {jsxRole, start} = this.tokens.currentToken(); + // Calculate line number information at the very start (if in development + // mode) so that the information is guaranteed to be queried in token order. + const elementLocationCode = this.options.production ? null : this.getElementLocationCode(start); + if (this.isAutomaticRuntime && jsxRole !== JSXRole.KeyAfterPropSpread) { + this.transformTagToJSXFunc(elementLocationCode, jsxRole); + } else { + this.transformTagToCreateElement(elementLocationCode); + } + } + + getElementLocationCode(firstTokenStart) { + const lineNumber = this.getLineNumberForIndex(firstTokenStart); + return `lineNumber: ${lineNumber}`; + } + + /** + * Get the line number for this source position. This is calculated lazily and + * must be called in increasing order by index. + */ + getLineNumberForIndex(index) { + const code = this.tokens.code; + while (this.lastIndex < index && this.lastIndex < code.length) { + if (code[this.lastIndex] === "\n") { + this.lastLineNumber++; + } + this.lastIndex++; + } + return this.lastLineNumber; + } + + /** + * Convert the current JSX element to a call to jsx, jsxs, or jsxDEV. This is + * the primary transformation for the automatic transform. + * + * Example: + *
    Hello{x}
    + * becomes + * jsxs('div', {a: 1, children: ["Hello", x]}, 2) + */ + transformTagToJSXFunc(elementLocationCode, jsxRole) { + const isStatic = jsxRole === JSXRole.StaticChildren; + // First tag is always jsxTagStart. + this.tokens.replaceToken(this.getJSXFuncInvocationCode(isStatic)); + + let keyCode = null; + if (this.tokens.matches1(tt.jsxTagEnd)) { + // Fragment syntax. + this.tokens.replaceToken(`${this.getFragmentCode()}, {`); + this.processAutomaticChildrenAndEndProps(jsxRole); + } else { + // Normal open tag or self-closing tag. + this.processTagIntro(); + this.tokens.appendCode(", {"); + keyCode = this.processProps(true); + + if (this.tokens.matches2(tt.slash, tt.jsxTagEnd)) { + // Self-closing tag, no children to add, so close the props. + this.tokens.appendCode("}"); + } else if (this.tokens.matches1(tt.jsxTagEnd)) { + // Tag with children. + this.tokens.removeToken(); + this.processAutomaticChildrenAndEndProps(jsxRole); + } else { + throw new Error("Expected either /> or > at the end of the tag."); + } + // If a key was present, move it to its own arg. Note that moving code + // like this will cause line numbers to get out of sync within the JSX + // element if the key expression has a newline in it. This is unfortunate, + // but hopefully should be rare. + if (keyCode) { + this.tokens.appendCode(`, ${keyCode}`); + } + } + if (!this.options.production) { + // If the key wasn't already added, add it now so we can correctly set + // positional args for jsxDEV. + if (keyCode === null) { + this.tokens.appendCode(", void 0"); + } + this.tokens.appendCode(`, ${isStatic}, ${this.getDevSource(elementLocationCode)}, this`); + } + // We're at the close-tag or the end of a self-closing tag, so remove + // everything else and close the function call. + this.tokens.removeInitialToken(); + while (!this.tokens.matches1(tt.jsxTagEnd)) { + this.tokens.removeToken(); + } + this.tokens.replaceToken(")"); + } + + /** + * Convert the current JSX element to a createElement call. In the classic + * runtime, this is the only case. In the automatic runtime, this is called + * as a fallback in some situations. + * + * Example: + *
    Hello{x}
    + * becomes + * React.createElement('div', {a: 1, key: 2}, "Hello", x) + */ + transformTagToCreateElement(elementLocationCode) { + // First tag is always jsxTagStart. + this.tokens.replaceToken(this.getCreateElementInvocationCode()); + + if (this.tokens.matches1(tt.jsxTagEnd)) { + // Fragment syntax. + this.tokens.replaceToken(`${this.getFragmentCode()}, null`); + this.processChildren(true); + } else { + // Normal open tag or self-closing tag. + this.processTagIntro(); + this.processPropsObjectWithDevInfo(elementLocationCode); + + if (this.tokens.matches2(tt.slash, tt.jsxTagEnd)) { + // Self-closing tag; no children to process. + } else if (this.tokens.matches1(tt.jsxTagEnd)) { + // Tag with children and a close-tag; process the children as args. + this.tokens.removeToken(); + this.processChildren(true); + } else { + throw new Error("Expected either /> or > at the end of the tag."); + } + } + // We're at the close-tag or the end of a self-closing tag, so remove + // everything else and close the function call. + this.tokens.removeInitialToken(); + while (!this.tokens.matches1(tt.jsxTagEnd)) { + this.tokens.removeToken(); + } + this.tokens.replaceToken(")"); + } + + /** + * Get the code for the relevant function for this context: jsx, jsxs, + * or jsxDEV. The following open-paren is included as well. + * + * These functions are only used for the automatic runtime, so they are always + * auto-imported, but the auto-import will be either CJS or ESM based on the + * target module format. + */ + getJSXFuncInvocationCode(isStatic) { + if (this.options.production) { + if (isStatic) { + return this.claimAutoImportedFuncInvocation("jsxs", "/jsx-runtime"); + } else { + return this.claimAutoImportedFuncInvocation("jsx", "/jsx-runtime"); + } + } else { + return this.claimAutoImportedFuncInvocation("jsxDEV", "/jsx-dev-runtime"); + } + } + + /** + * Return the code to use for the createElement function, e.g. + * `React.createElement`, including the following open-paren. + * + * This is the main function to use for the classic runtime. For the + * automatic runtime, this function is used as a fallback function to + * preserve behavior when there is a prop spread followed by an explicit + * key. In that automatic runtime case, the function should be automatically + * imported. + */ + getCreateElementInvocationCode() { + if (this.isAutomaticRuntime) { + return this.claimAutoImportedFuncInvocation("createElement", ""); + } else { + const {jsxPragmaInfo} = this; + const resolvedPragmaBaseName = this.importProcessor + ? this.importProcessor.getIdentifierReplacement(jsxPragmaInfo.base) || jsxPragmaInfo.base + : jsxPragmaInfo.base; + return `${resolvedPragmaBaseName}${jsxPragmaInfo.suffix}(`; + } + } + + /** + * Return the code to use as the component when compiling a shorthand + * fragment, e.g. `React.Fragment`. + * + * This may be called from either the classic or automatic runtime, and + * the value should be auto-imported for the automatic runtime. + */ + getFragmentCode() { + if (this.isAutomaticRuntime) { + return this.claimAutoImportedName( + "Fragment", + this.options.production ? "/jsx-runtime" : "/jsx-dev-runtime", + ); + } else { + const {jsxPragmaInfo} = this; + const resolvedFragmentPragmaBaseName = this.importProcessor + ? this.importProcessor.getIdentifierReplacement(jsxPragmaInfo.fragmentBase) || + jsxPragmaInfo.fragmentBase + : jsxPragmaInfo.fragmentBase; + return resolvedFragmentPragmaBaseName + jsxPragmaInfo.fragmentSuffix; + } + } + + /** + * Return code that invokes the given function. + * + * When the imports transform is enabled, use the CJSImportTransformer + * strategy of using `.call(void 0, ...` to avoid passing a `this` value in a + * situation that would otherwise look like a method call. + */ + claimAutoImportedFuncInvocation(funcName, importPathSuffix) { + const funcCode = this.claimAutoImportedName(funcName, importPathSuffix); + if (this.importProcessor) { + return `${funcCode}.call(void 0, `; + } else { + return `${funcCode}(`; + } + } + + claimAutoImportedName(funcName, importPathSuffix) { + if (this.importProcessor) { + // CJS mode: claim a name for the module and mark it for import. + const path = this.jsxImportSource + importPathSuffix; + if (!this.cjsAutomaticModuleNameResolutions[path]) { + this.cjsAutomaticModuleNameResolutions[path] = + this.importProcessor.getFreeIdentifierForPath(path); + } + return `${this.cjsAutomaticModuleNameResolutions[path]}.${funcName}`; + } else { + // ESM mode: claim a name for this function and add it to the names that + // should be auto-imported when the prefix is generated. + if (!this.esmAutomaticImportNameResolutions[funcName]) { + this.esmAutomaticImportNameResolutions[funcName] = this.nameManager.claimFreeName( + `_${funcName}`, + ); + } + return this.esmAutomaticImportNameResolutions[funcName]; + } + } + + /** + * Process the first part of a tag, before any props. + */ + processTagIntro() { + // Walk forward until we see one of these patterns: + // jsxName to start the first prop, preceded by another jsxName to end the tag name. + // jsxName to start the first prop, preceded by greaterThan to end the type argument. + // [open brace] to start the first prop. + // [jsxTagEnd] to end the open-tag. + // [slash, jsxTagEnd] to end the self-closing tag. + let introEnd = this.tokens.currentIndex() + 1; + while ( + this.tokens.tokens[introEnd].isType || + (!this.tokens.matches2AtIndex(introEnd - 1, tt.jsxName, tt.jsxName) && + !this.tokens.matches2AtIndex(introEnd - 1, tt.greaterThan, tt.jsxName) && + !this.tokens.matches1AtIndex(introEnd, tt.braceL) && + !this.tokens.matches1AtIndex(introEnd, tt.jsxTagEnd) && + !this.tokens.matches2AtIndex(introEnd, tt.slash, tt.jsxTagEnd)) + ) { + introEnd++; + } + if (introEnd === this.tokens.currentIndex() + 1) { + const tagName = this.tokens.identifierName(); + if (startsWithLowerCase(tagName)) { + this.tokens.replaceToken(`'${tagName}'`); + } + } + while (this.tokens.currentIndex() < introEnd) { + this.rootTransformer.processToken(); + } + } + + /** + * Starting at the beginning of the props, add the props argument to + * React.createElement, including the comma before it. + */ + processPropsObjectWithDevInfo(elementLocationCode) { + const devProps = this.options.production + ? "" + : `__self: this, __source: ${this.getDevSource(elementLocationCode)}`; + if (!this.tokens.matches1(tt.jsxName) && !this.tokens.matches1(tt.braceL)) { + if (devProps) { + this.tokens.appendCode(`, {${devProps}}`); + } else { + this.tokens.appendCode(`, null`); + } + return; + } + this.tokens.appendCode(`, {`); + this.processProps(false); + if (devProps) { + this.tokens.appendCode(` ${devProps}}`); + } else { + this.tokens.appendCode("}"); + } + } + + /** + * Transform the core part of the props, assuming that a { has already been + * inserted before us and that a } will be inserted after us. + * + * If extractKeyCode is true (i.e. when using any jsx... function), any prop + * named "key" has its code captured and returned rather than being emitted to + * the output code. This shifts line numbers, and emitting the code later will + * correct line numbers again. If no key is found or if extractKeyCode is + * false, this function returns null. + */ + processProps(extractKeyCode) { + let keyCode = null; + while (true) { + if (this.tokens.matches2(tt.jsxName, tt.eq)) { + // This is a regular key={value} or key="value" prop. + const propName = this.tokens.identifierName(); + if (extractKeyCode && propName === "key") { + if (keyCode !== null) { + // The props list has multiple keys. Different implementations are + // inconsistent about what to do here: as of this writing, Babel and + // swc keep the *last* key and completely remove the rest, while + // TypeScript uses the *first* key and leaves the others as regular + // props. The React team collaborated with Babel on the + // implementation of this behavior, so presumably the Babel behavior + // is the one to use. + // Since we won't ever be emitting the previous key code, we need to + // at least emit its newlines here so that the line numbers match up + // in the long run. + this.tokens.appendCode(keyCode.replace(/[^\n]/g, "")); + } + // key + this.tokens.removeToken(); + // = + this.tokens.removeToken(); + const snapshot = this.tokens.snapshot(); + this.processPropValue(); + keyCode = this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(snapshot); + // Don't add a comma + continue; + } else { + this.processPropName(propName); + this.tokens.replaceToken(": "); + this.processPropValue(); + } + } else if (this.tokens.matches1(tt.jsxName)) { + // This is a shorthand prop like . + const propName = this.tokens.identifierName(); + this.processPropName(propName); + this.tokens.appendCode(": true"); + } else if (this.tokens.matches1(tt.braceL)) { + // This is prop spread, like
    , which we can pass + // through fairly directly as an object spread. + this.tokens.replaceToken(""); + this.rootTransformer.processBalancedCode(); + this.tokens.replaceToken(""); + } else { + break; + } + this.tokens.appendCode(","); + } + return keyCode; + } + + processPropName(propName) { + if (propName.includes("-")) { + this.tokens.replaceToken(`'${propName}'`); + } else { + this.tokens.copyToken(); + } + } + + processPropValue() { + if (this.tokens.matches1(tt.braceL)) { + this.tokens.replaceToken(""); + this.rootTransformer.processBalancedCode(); + this.tokens.replaceToken(""); + } else if (this.tokens.matches1(tt.jsxTagStart)) { + this.processJSXTag(); + } else { + this.processStringPropValue(); + } + } + + processStringPropValue() { + const token = this.tokens.currentToken(); + const valueCode = this.tokens.code.slice(token.start + 1, token.end - 1); + const replacementCode = formatJSXTextReplacement(valueCode); + const literalCode = formatJSXStringValueLiteral(valueCode); + this.tokens.replaceToken(literalCode + replacementCode); + } + + /** + * Starting in the middle of the props object literal, produce an additional + * prop for the children and close the object literal. + */ + processAutomaticChildrenAndEndProps(jsxRole) { + if (jsxRole === JSXRole.StaticChildren) { + this.tokens.appendCode(" children: ["); + this.processChildren(false); + this.tokens.appendCode("]}"); + } else { + // The parser information tells us whether we will see a real child or if + // all remaining children (if any) will resolve to empty. If there are no + // non-empty children, don't emit a children prop at all, but still + // process children so that we properly transform the code into nothing. + if (jsxRole === JSXRole.OneChild) { + this.tokens.appendCode(" children: "); + } + this.processChildren(false); + this.tokens.appendCode("}"); + } + } + + /** + * Transform children into a comma-separated list, which will be either + * arguments to createElement or array elements of a children prop. + */ + processChildren(needsInitialComma) { + let needsComma = needsInitialComma; + while (true) { + if (this.tokens.matches2(tt.jsxTagStart, tt.slash)) { + // Closing tag, so no more children. + return; + } + let didEmitElement = false; + if (this.tokens.matches1(tt.braceL)) { + if (this.tokens.matches2(tt.braceL, tt.braceR)) { + // Empty interpolations and comment-only interpolations are allowed + // and don't create an extra child arg. + this.tokens.replaceToken(""); + this.tokens.replaceToken(""); + } else { + // Interpolated expression. + this.tokens.replaceToken(needsComma ? ", " : ""); + this.rootTransformer.processBalancedCode(); + this.tokens.replaceToken(""); + didEmitElement = true; + } + } else if (this.tokens.matches1(tt.jsxTagStart)) { + // Child JSX element + this.tokens.appendCode(needsComma ? ", " : ""); + this.processJSXTag(); + didEmitElement = true; + } else if (this.tokens.matches1(tt.jsxText) || this.tokens.matches1(tt.jsxEmptyText)) { + didEmitElement = this.processChildTextElement(needsComma); + } else { + throw new Error("Unexpected token when processing JSX children."); + } + if (didEmitElement) { + needsComma = true; + } + } + } + + /** + * Turn a JSX text element into a string literal, or nothing at all if the JSX + * text resolves to the empty string. + * + * Returns true if a string literal is emitted, false otherwise. + */ + processChildTextElement(needsComma) { + const token = this.tokens.currentToken(); + const valueCode = this.tokens.code.slice(token.start, token.end); + const replacementCode = formatJSXTextReplacement(valueCode); + const literalCode = formatJSXTextLiteral(valueCode); + if (literalCode === '""') { + this.tokens.replaceToken(replacementCode); + return false; + } else { + this.tokens.replaceToken(`${needsComma ? ", " : ""}${literalCode}${replacementCode}`); + return true; + } + } + + getDevSource(elementLocationCode) { + return `{fileName: ${this.getFilenameVarName()}, ${elementLocationCode}}`; + } + + getFilenameVarName() { + if (!this.filenameVarName) { + this.filenameVarName = this.nameManager.claimFreeName("_jsxFileName"); + } + return this.filenameVarName; + } +} + +/** + * Spec for identifiers: https://tc39.github.io/ecma262/#prod-IdentifierStart. + * + * Really only treat anything starting with a-z as tag names. `_`, `$`, `é` + * should be treated as component names + */ +export function startsWithLowerCase(s) { + const firstChar = s.charCodeAt(0); + return firstChar >= charCodes.lowercaseA && firstChar <= charCodes.lowercaseZ; +} + +/** + * Turn the given jsxText string into a JS string literal. Leading and trailing + * whitespace on lines is removed, except immediately after the open-tag and + * before the close-tag. Empty lines are completely removed, and spaces are + * added between lines after that. + * + * We use JSON.stringify to introduce escape characters as necessary, and trim + * the start and end of each line and remove blank lines. + */ +function formatJSXTextLiteral(text) { + let result = ""; + let whitespace = ""; + + let isInInitialLineWhitespace = false; + let seenNonWhitespace = false; + for (let i = 0; i < text.length; i++) { + const c = text[i]; + if (c === " " || c === "\t" || c === "\r") { + if (!isInInitialLineWhitespace) { + whitespace += c; + } + } else if (c === "\n") { + whitespace = ""; + isInInitialLineWhitespace = true; + } else { + if (seenNonWhitespace && isInInitialLineWhitespace) { + result += " "; + } + result += whitespace; + whitespace = ""; + if (c === "&") { + const {entity, newI} = processEntity(text, i + 1); + i = newI - 1; + result += entity; + } else { + result += c; + } + seenNonWhitespace = true; + isInInitialLineWhitespace = false; + } + } + if (!isInInitialLineWhitespace) { + result += whitespace; + } + return JSON.stringify(result); +} + +/** + * Produce the code that should be printed after the JSX text string literal, + * with most content removed, but all newlines preserved and all spacing at the + * end preserved. + */ +function formatJSXTextReplacement(text) { + let numNewlines = 0; + let numSpaces = 0; + for (const c of text) { + if (c === "\n") { + numNewlines++; + numSpaces = 0; + } else if (c === " ") { + numSpaces++; + } + } + return "\n".repeat(numNewlines) + " ".repeat(numSpaces); +} + +/** + * Format a string in the value position of a JSX prop. + * + * Use the same implementation as convertAttribute from + * babel-helper-builder-react-jsx. + */ +function formatJSXStringValueLiteral(text) { + let result = ""; + for (let i = 0; i < text.length; i++) { + const c = text[i]; + if (c === "\n") { + if (/\s/.test(text[i + 1])) { + result += " "; + while (i < text.length && /\s/.test(text[i + 1])) { + i++; + } + } else { + result += "\n"; + } + } else if (c === "&") { + const {entity, newI} = processEntity(text, i + 1); + result += entity; + i = newI - 1; + } else { + result += c; + } + } + return JSON.stringify(result); +} + +/** + * Starting at a &, see if there's an HTML entity (specified by name, decimal + * char code, or hex char code) and return it if so. + * + * Modified from jsxReadString in babel-parser. + */ +function processEntity(text, indexAfterAmpersand) { + let str = ""; + let count = 0; + let entity; + let i = indexAfterAmpersand; + + if (text[i] === "#") { + let radix = 10; + i++; + let numStart; + if (text[i] === "x") { + radix = 16; + i++; + numStart = i; + while (i < text.length && isHexDigit(text.charCodeAt(i))) { + i++; + } + } else { + numStart = i; + while (i < text.length && isDecimalDigit(text.charCodeAt(i))) { + i++; + } + } + if (text[i] === ";") { + const numStr = text.slice(numStart, i); + if (numStr) { + i++; + entity = String.fromCodePoint(parseInt(numStr, radix)); + } + } + } else { + while (i < text.length && count++ < 10) { + const ch = text[i]; + i++; + if (ch === ";") { + entity = XHTMLEntities.get(str); + break; + } + str += ch; + } + } + + if (!entity) { + return {entity: "&", newI: indexAfterAmpersand}; + } + return {entity, newI: i}; +} + +function isDecimalDigit(code) { + return code >= charCodes.digit0 && code <= charCodes.digit9; +} + +function isHexDigit(code) { + return ( + (code >= charCodes.digit0 && code <= charCodes.digit9) || + (code >= charCodes.lowercaseA && code <= charCodes.lowercaseF) || + (code >= charCodes.uppercaseA && code <= charCodes.uppercaseF) + ); +} diff --git a/node_modules/sucrase/dist/esm/transformers/JestHoistTransformer.js b/node_modules/sucrase/dist/esm/transformers/JestHoistTransformer.js new file mode 100644 index 00000000..8f45d06f --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/JestHoistTransformer.js @@ -0,0 +1,111 @@ + function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } + +import {TokenType as tt} from "../parser/tokenizer/types"; + + +import Transformer from "./Transformer"; + +const JEST_GLOBAL_NAME = "jest"; +const HOISTED_METHODS = ["mock", "unmock", "enableAutomock", "disableAutomock"]; + +/** + * Implementation of babel-plugin-jest-hoist, which hoists up some jest method + * calls above the imports to allow them to override other imports. + * + * To preserve line numbers, rather than directly moving the jest.mock code, we + * wrap each invocation in a function statement and then call the function from + * the top of the file. + */ +export default class JestHoistTransformer extends Transformer { + __init() {this.hoistedFunctionNames = []} + + constructor( + rootTransformer, + tokens, + nameManager, + importProcessor, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.nameManager = nameManager;this.importProcessor = importProcessor;JestHoistTransformer.prototype.__init.call(this);; + } + + process() { + if ( + this.tokens.currentToken().scopeDepth === 0 && + this.tokens.matches4(tt.name, tt.dot, tt.name, tt.parenL) && + this.tokens.identifierName() === JEST_GLOBAL_NAME + ) { + // TODO: This only works if imports transform is active, which it will be for jest. + // But if jest adds module support and we no longer need the import transform, this needs fixing. + if (_optionalChain([this, 'access', _ => _.importProcessor, 'optionalAccess', _2 => _2.getGlobalNames, 'call', _3 => _3(), 'optionalAccess', _4 => _4.has, 'call', _5 => _5(JEST_GLOBAL_NAME)])) { + return false; + } + return this.extractHoistedCalls(); + } + + return false; + } + + getHoistedCode() { + if (this.hoistedFunctionNames.length > 0) { + // This will be placed before module interop code, but that's fine since + // imports aren't allowed in module mock factories. + return this.hoistedFunctionNames.map((name) => `${name}();`).join(""); + } + return ""; + } + + /** + * Extracts any methods calls on the jest-object that should be hoisted. + * + * According to the jest docs, https://jestjs.io/docs/en/jest-object#jestmockmodulename-factory-options, + * mock, unmock, enableAutomock, disableAutomock, are the methods that should be hoisted. + * + * We do not apply the same checks of the arguments as babel-plugin-jest-hoist does. + */ + extractHoistedCalls() { + // We're handling a chain of calls where `jest` may or may not need to be inserted for each call + // in the chain, so remove the initial `jest` to make the loop implementation cleaner. + this.tokens.removeToken(); + // Track some state so that multiple non-hoisted chained calls in a row keep their chaining + // syntax. + let followsNonHoistedJestCall = false; + + // Iterate through all chained calls on the jest object. + while (this.tokens.matches3(tt.dot, tt.name, tt.parenL)) { + const methodName = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1); + const shouldHoist = HOISTED_METHODS.includes(methodName); + if (shouldHoist) { + // We've matched e.g. `.mock(...)` or similar call. + // Replace the initial `.` with `function __jestHoist(){jest.` + const hoistedFunctionName = this.nameManager.claimFreeName("__jestHoist"); + this.hoistedFunctionNames.push(hoistedFunctionName); + this.tokens.replaceToken(`function ${hoistedFunctionName}(){${JEST_GLOBAL_NAME}.`); + this.tokens.copyToken(); + this.tokens.copyToken(); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(tt.parenR); + this.tokens.appendCode(";}"); + followsNonHoistedJestCall = false; + } else { + // This is a non-hoisted method, so just transform the code as usual. + if (followsNonHoistedJestCall) { + // If we didn't hoist the previous call, we can leave the code as-is to chain off of the + // previous method call. It's important to preserve the code here because we don't know + // for sure that the method actually returned the jest object for chaining. + this.tokens.copyToken(); + } else { + // If we hoisted the previous call, we know it returns the jest object back, so we insert + // the identifier `jest` to continue the chain. + this.tokens.replaceToken(`${JEST_GLOBAL_NAME}.`); + } + this.tokens.copyToken(); + this.tokens.copyToken(); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(tt.parenR); + followsNonHoistedJestCall = true; + } + } + + return true; + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/NumericSeparatorTransformer.js b/node_modules/sucrase/dist/esm/transformers/NumericSeparatorTransformer.js new file mode 100644 index 00000000..0cb01a16 --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/NumericSeparatorTransformer.js @@ -0,0 +1,20 @@ +import {TokenType as tt} from "../parser/tokenizer/types"; + +import Transformer from "./Transformer"; + +export default class NumericSeparatorTransformer extends Transformer { + constructor( tokens) { + super();this.tokens = tokens;; + } + + process() { + if (this.tokens.matches1(tt.num)) { + const code = this.tokens.currentTokenCode(); + if (code.includes("_")) { + this.tokens.replaceToken(code.replace(/_/g, "")); + return true; + } + } + return false; + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/OptionalCatchBindingTransformer.js b/node_modules/sucrase/dist/esm/transformers/OptionalCatchBindingTransformer.js new file mode 100644 index 00000000..547273b4 --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/OptionalCatchBindingTransformer.js @@ -0,0 +1,19 @@ + +import {TokenType as tt} from "../parser/tokenizer/types"; + +import Transformer from "./Transformer"; + +export default class OptionalCatchBindingTransformer extends Transformer { + constructor( tokens, nameManager) { + super();this.tokens = tokens;this.nameManager = nameManager;; + } + + process() { + if (this.tokens.matches2(tt._catch, tt.braceL)) { + this.tokens.copyToken(); + this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`); + return true; + } + return false; + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/OptionalChainingNullishTransformer.js b/node_modules/sucrase/dist/esm/transformers/OptionalChainingNullishTransformer.js new file mode 100644 index 00000000..571d97ff --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/OptionalChainingNullishTransformer.js @@ -0,0 +1,155 @@ + +import {TokenType as tt} from "../parser/tokenizer/types"; + +import Transformer from "./Transformer"; + +/** + * Transformer supporting the optional chaining and nullish coalescing operators. + * + * Tech plan here: + * https://github.com/alangpierce/sucrase/wiki/Sucrase-Optional-Chaining-and-Nullish-Coalescing-Technical-Plan + * + * The prefix and suffix code snippets are handled by TokenProcessor, and this transformer handles + * the operators themselves. + */ +export default class OptionalChainingNullishTransformer extends Transformer { + constructor( tokens, nameManager) { + super();this.tokens = tokens;this.nameManager = nameManager;; + } + + process() { + if (this.tokens.matches1(tt.nullishCoalescing)) { + const token = this.tokens.currentToken(); + if (this.tokens.tokens[token.nullishStartIndex].isAsyncOperation) { + this.tokens.replaceTokenTrimmingLeftWhitespace(", async () => ("); + } else { + this.tokens.replaceTokenTrimmingLeftWhitespace(", () => ("); + } + return true; + } + if (this.tokens.matches1(tt._delete)) { + const nextToken = this.tokens.tokenAtRelativeIndex(1); + if (nextToken.isOptionalChainStart) { + this.tokens.removeInitialToken(); + return true; + } + } + const token = this.tokens.currentToken(); + const chainStart = token.subscriptStartIndex; + if ( + chainStart != null && + this.tokens.tokens[chainStart].isOptionalChainStart && + // Super subscripts can't be optional (since super is never null/undefined), and the syntax + // relies on the subscript being intact, so leave this token alone. + this.tokens.tokenAtRelativeIndex(-1).type !== tt._super + ) { + const param = this.nameManager.claimFreeName("_"); + let arrowStartSnippet; + if ( + chainStart > 0 && + this.tokens.matches1AtIndex(chainStart - 1, tt._delete) && + this.isLastSubscriptInChain() + ) { + // Delete operations are special: we already removed the delete keyword, and to still + // perform a delete, we need to insert a delete in the very last part of the chain, which + // in correct code will always be a property access. + arrowStartSnippet = `${param} => delete ${param}`; + } else { + arrowStartSnippet = `${param} => ${param}`; + } + if (this.tokens.tokens[chainStart].isAsyncOperation) { + arrowStartSnippet = `async ${arrowStartSnippet}`; + } + if ( + this.tokens.matches2(tt.questionDot, tt.parenL) || + this.tokens.matches2(tt.questionDot, tt.lessThan) + ) { + if (this.justSkippedSuper()) { + this.tokens.appendCode(".bind(this)"); + } + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${arrowStartSnippet}`); + } else if (this.tokens.matches2(tt.questionDot, tt.bracketL)) { + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${arrowStartSnippet}`); + } else if (this.tokens.matches1(tt.questionDot)) { + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${arrowStartSnippet}.`); + } else if (this.tokens.matches1(tt.dot)) { + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${arrowStartSnippet}.`); + } else if (this.tokens.matches1(tt.bracketL)) { + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${arrowStartSnippet}[`); + } else if (this.tokens.matches1(tt.parenL)) { + if (this.justSkippedSuper()) { + this.tokens.appendCode(".bind(this)"); + } + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${arrowStartSnippet}(`); + } else { + throw new Error("Unexpected subscript operator in optional chain."); + } + return true; + } + return false; + } + + /** + * Determine if the current token is the last of its chain, so that we know whether it's eligible + * to have a delete op inserted. + * + * We can do this by walking forward until we determine one way or another. Each + * isOptionalChainStart token must be paired with exactly one isOptionalChainEnd token after it in + * a nesting way, so we can track depth and walk to the end of the chain (the point where the + * depth goes negative) and see if any other subscript token is after us in the chain. + */ + isLastSubscriptInChain() { + let depth = 0; + for (let i = this.tokens.currentIndex() + 1; ; i++) { + if (i >= this.tokens.tokens.length) { + throw new Error("Reached the end of the code while finding the end of the access chain."); + } + if (this.tokens.tokens[i].isOptionalChainStart) { + depth++; + } else if (this.tokens.tokens[i].isOptionalChainEnd) { + depth--; + } + if (depth < 0) { + return true; + } + + // This subscript token is a later one in the same chain. + if (depth === 0 && this.tokens.tokens[i].subscriptStartIndex != null) { + return false; + } + } + } + + /** + * Determine if we are the open-paren in an expression like super.a()?.b. + * + * We can do this by walking backward to find the previous subscript. If that subscript was + * preceded by a super, then we must be the subscript after it, so if this is a call expression, + * we'll need to attach the right context. + */ + justSkippedSuper() { + let depth = 0; + let index = this.tokens.currentIndex() - 1; + while (true) { + if (index < 0) { + throw new Error( + "Reached the start of the code while finding the start of the access chain.", + ); + } + if (this.tokens.tokens[index].isOptionalChainStart) { + depth--; + } else if (this.tokens.tokens[index].isOptionalChainEnd) { + depth++; + } + if (depth < 0) { + return false; + } + + // This subscript token is a later one in the same chain. + if (depth === 0 && this.tokens.tokens[index].subscriptStartIndex != null) { + return this.tokens.tokens[index - 1].type === tt._super; + } + index--; + } + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/ReactDisplayNameTransformer.js b/node_modules/sucrase/dist/esm/transformers/ReactDisplayNameTransformer.js new file mode 100644 index 00000000..0c44c818 --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/ReactDisplayNameTransformer.js @@ -0,0 +1,160 @@ + + +import {IdentifierRole} from "../parser/tokenizer"; +import {TokenType as tt} from "../parser/tokenizer/types"; + + +import Transformer from "./Transformer"; + +/** + * Implementation of babel-plugin-transform-react-display-name, which adds a + * display name to usages of React.createClass and createReactClass. + */ +export default class ReactDisplayNameTransformer extends Transformer { + constructor( + rootTransformer, + tokens, + importProcessor, + options, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.importProcessor = importProcessor;this.options = options;; + } + + process() { + const startIndex = this.tokens.currentIndex(); + if (this.tokens.identifierName() === "createReactClass") { + const newName = + this.importProcessor && this.importProcessor.getIdentifierReplacement("createReactClass"); + if (newName) { + this.tokens.replaceToken(`(0, ${newName})`); + } else { + this.tokens.copyToken(); + } + this.tryProcessCreateClassCall(startIndex); + return true; + } + if ( + this.tokens.matches3(tt.name, tt.dot, tt.name) && + this.tokens.identifierName() === "React" && + this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 2) === "createClass" + ) { + const newName = this.importProcessor + ? this.importProcessor.getIdentifierReplacement("React") || "React" + : "React"; + if (newName) { + this.tokens.replaceToken(newName); + this.tokens.copyToken(); + this.tokens.copyToken(); + } else { + this.tokens.copyToken(); + this.tokens.copyToken(); + this.tokens.copyToken(); + } + this.tryProcessCreateClassCall(startIndex); + return true; + } + return false; + } + + /** + * This is called with the token position at the open-paren. + */ + tryProcessCreateClassCall(startIndex) { + const displayName = this.findDisplayName(startIndex); + if (!displayName) { + return; + } + + if (this.classNeedsDisplayName()) { + this.tokens.copyExpectedToken(tt.parenL); + this.tokens.copyExpectedToken(tt.braceL); + this.tokens.appendCode(`displayName: '${displayName}',`); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(tt.braceR); + this.tokens.copyExpectedToken(tt.parenR); + } + } + + findDisplayName(startIndex) { + if (startIndex < 2) { + return null; + } + if (this.tokens.matches2AtIndex(startIndex - 2, tt.name, tt.eq)) { + // This is an assignment (or declaration) and the LHS is either an identifier or a member + // expression ending in an identifier, so use that identifier name. + return this.tokens.identifierNameAtIndex(startIndex - 2); + } + if ( + startIndex >= 2 && + this.tokens.tokens[startIndex - 2].identifierRole === IdentifierRole.ObjectKey + ) { + // This is an object literal value. + return this.tokens.identifierNameAtIndex(startIndex - 2); + } + if (this.tokens.matches2AtIndex(startIndex - 2, tt._export, tt._default)) { + return this.getDisplayNameFromFilename(); + } + return null; + } + + getDisplayNameFromFilename() { + const filePath = this.options.filePath || "unknown"; + const pathSegments = filePath.split("/"); + const filename = pathSegments[pathSegments.length - 1]; + const dotIndex = filename.lastIndexOf("."); + const baseFilename = dotIndex === -1 ? filename : filename.slice(0, dotIndex); + if (baseFilename === "index" && pathSegments[pathSegments.length - 2]) { + return pathSegments[pathSegments.length - 2]; + } else { + return baseFilename; + } + } + + /** + * We only want to add a display name when this is a function call containing + * one argument, which is an object literal without `displayName` as an + * existing key. + */ + classNeedsDisplayName() { + let index = this.tokens.currentIndex(); + if (!this.tokens.matches2(tt.parenL, tt.braceL)) { + return false; + } + // The block starts on the {, and we expect any displayName key to be in + // that context. We need to ignore other other contexts to avoid matching + // nested displayName keys. + const objectStartIndex = index + 1; + const objectContextId = this.tokens.tokens[objectStartIndex].contextId; + if (objectContextId == null) { + throw new Error("Expected non-null context ID on object open-brace."); + } + + for (; index < this.tokens.tokens.length; index++) { + const token = this.tokens.tokens[index]; + if (token.type === tt.braceR && token.contextId === objectContextId) { + index++; + break; + } + + if ( + this.tokens.identifierNameAtIndex(index) === "displayName" && + this.tokens.tokens[index].identifierRole === IdentifierRole.ObjectKey && + token.contextId === objectContextId + ) { + // We found a displayName key, so bail out. + return false; + } + } + + if (index === this.tokens.tokens.length) { + throw new Error("Unexpected end of input when processing React class."); + } + + // If we got this far, we know we have createClass with an object with no + // display name, so we want to proceed as long as that was the only argument. + return ( + this.tokens.matches1AtIndex(index, tt.parenR) || + this.tokens.matches2AtIndex(index, tt.comma, tt.parenR) + ); + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/ReactHotLoaderTransformer.js b/node_modules/sucrase/dist/esm/transformers/ReactHotLoaderTransformer.js new file mode 100644 index 00000000..873902e6 --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/ReactHotLoaderTransformer.js @@ -0,0 +1,69 @@ +import {IdentifierRole, isTopLevelDeclaration} from "../parser/tokenizer"; + +import Transformer from "./Transformer"; + +export default class ReactHotLoaderTransformer extends Transformer { + __init() {this.extractedDefaultExportName = null} + + constructor( tokens, filePath) { + super();this.tokens = tokens;this.filePath = filePath;ReactHotLoaderTransformer.prototype.__init.call(this);; + } + + setExtractedDefaultExportName(extractedDefaultExportName) { + this.extractedDefaultExportName = extractedDefaultExportName; + } + + getPrefixCode() { + return ` + (function () { + var enterModule = require('react-hot-loader').enterModule; + enterModule && enterModule(module); + })();` + .replace(/\s+/g, " ") + .trim(); + } + + getSuffixCode() { + const topLevelNames = new Set(); + for (const token of this.tokens.tokens) { + if ( + !token.isType && + isTopLevelDeclaration(token) && + token.identifierRole !== IdentifierRole.ImportDeclaration + ) { + topLevelNames.add(this.tokens.identifierNameForToken(token)); + } + } + const namesToRegister = Array.from(topLevelNames).map((name) => ({ + variableName: name, + uniqueLocalName: name, + })); + if (this.extractedDefaultExportName) { + namesToRegister.push({ + variableName: this.extractedDefaultExportName, + uniqueLocalName: "default", + }); + } + return ` +;(function () { + var reactHotLoader = require('react-hot-loader').default; + var leaveModule = require('react-hot-loader').leaveModule; + if (!reactHotLoader) { + return; + } +${namesToRegister + .map( + ({variableName, uniqueLocalName}) => + ` reactHotLoader.register(${variableName}, "${uniqueLocalName}", ${JSON.stringify( + this.filePath || "", + )});`, + ) + .join("\n")} + leaveModule(module); +})();`; + } + + process() { + return false; + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/RootTransformer.js b/node_modules/sucrase/dist/esm/transformers/RootTransformer.js new file mode 100644 index 00000000..c7a83fef --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/RootTransformer.js @@ -0,0 +1,462 @@ + + + +import {ContextualKeyword} from "../parser/tokenizer/keywords"; +import {TokenType as tt} from "../parser/tokenizer/types"; + +import getClassInfo, {} from "../util/getClassInfo"; +import CJSImportTransformer from "./CJSImportTransformer"; +import ESMImportTransformer from "./ESMImportTransformer"; +import FlowTransformer from "./FlowTransformer"; +import JestHoistTransformer from "./JestHoistTransformer"; +import JSXTransformer from "./JSXTransformer"; +import NumericSeparatorTransformer from "./NumericSeparatorTransformer"; +import OptionalCatchBindingTransformer from "./OptionalCatchBindingTransformer"; +import OptionalChainingNullishTransformer from "./OptionalChainingNullishTransformer"; +import ReactDisplayNameTransformer from "./ReactDisplayNameTransformer"; +import ReactHotLoaderTransformer from "./ReactHotLoaderTransformer"; + +import TypeScriptTransformer from "./TypeScriptTransformer"; + + + + + + + + +export default class RootTransformer { + __init() {this.transformers = []} + + + __init2() {this.generatedVariables = []} + + + + + + constructor( + sucraseContext, + transforms, + enableLegacyBabel5ModuleInterop, + options, + ) {;RootTransformer.prototype.__init.call(this);RootTransformer.prototype.__init2.call(this); + this.nameManager = sucraseContext.nameManager; + this.helperManager = sucraseContext.helperManager; + const {tokenProcessor, importProcessor} = sucraseContext; + this.tokens = tokenProcessor; + this.isImportsTransformEnabled = transforms.includes("imports"); + this.isReactHotLoaderTransformEnabled = transforms.includes("react-hot-loader"); + this.disableESTransforms = Boolean(options.disableESTransforms); + + if (!options.disableESTransforms) { + this.transformers.push( + new OptionalChainingNullishTransformer(tokenProcessor, this.nameManager), + ); + this.transformers.push(new NumericSeparatorTransformer(tokenProcessor)); + this.transformers.push(new OptionalCatchBindingTransformer(tokenProcessor, this.nameManager)); + } + + if (transforms.includes("jsx")) { + if (options.jsxRuntime !== "preserve") { + this.transformers.push( + new JSXTransformer(this, tokenProcessor, importProcessor, this.nameManager, options), + ); + } + this.transformers.push( + new ReactDisplayNameTransformer(this, tokenProcessor, importProcessor, options), + ); + } + + let reactHotLoaderTransformer = null; + if (transforms.includes("react-hot-loader")) { + if (!options.filePath) { + throw new Error("filePath is required when using the react-hot-loader transform."); + } + reactHotLoaderTransformer = new ReactHotLoaderTransformer(tokenProcessor, options.filePath); + this.transformers.push(reactHotLoaderTransformer); + } + + // Note that we always want to enable the imports transformer, even when the import transform + // itself isn't enabled, since we need to do type-only import pruning for both Flow and + // TypeScript. + if (transforms.includes("imports")) { + if (importProcessor === null) { + throw new Error("Expected non-null importProcessor with imports transform enabled."); + } + this.transformers.push( + new CJSImportTransformer( + this, + tokenProcessor, + importProcessor, + this.nameManager, + this.helperManager, + reactHotLoaderTransformer, + enableLegacyBabel5ModuleInterop, + Boolean(options.enableLegacyTypeScriptModuleInterop), + transforms.includes("typescript"), + transforms.includes("flow"), + Boolean(options.preserveDynamicImport), + Boolean(options.keepUnusedImports), + ), + ); + } else { + this.transformers.push( + new ESMImportTransformer( + tokenProcessor, + this.nameManager, + this.helperManager, + reactHotLoaderTransformer, + transforms.includes("typescript"), + transforms.includes("flow"), + Boolean(options.keepUnusedImports), + options, + ), + ); + } + + if (transforms.includes("flow")) { + this.transformers.push( + new FlowTransformer(this, tokenProcessor, transforms.includes("imports")), + ); + } + if (transforms.includes("typescript")) { + this.transformers.push( + new TypeScriptTransformer(this, tokenProcessor, transforms.includes("imports")), + ); + } + if (transforms.includes("jest")) { + this.transformers.push( + new JestHoistTransformer(this, tokenProcessor, this.nameManager, importProcessor), + ); + } + } + + transform() { + this.tokens.reset(); + this.processBalancedCode(); + const shouldAddUseStrict = this.isImportsTransformEnabled; + // "use strict" always needs to be first, so override the normal transformer order. + let prefix = shouldAddUseStrict ? '"use strict";' : ""; + for (const transformer of this.transformers) { + prefix += transformer.getPrefixCode(); + } + prefix += this.helperManager.emitHelpers(); + prefix += this.generatedVariables.map((v) => ` var ${v};`).join(""); + for (const transformer of this.transformers) { + prefix += transformer.getHoistedCode(); + } + let suffix = ""; + for (const transformer of this.transformers) { + suffix += transformer.getSuffixCode(); + } + const result = this.tokens.finish(); + let {code} = result; + if (code.startsWith("#!")) { + let newlineIndex = code.indexOf("\n"); + if (newlineIndex === -1) { + newlineIndex = code.length; + code += "\n"; + } + return { + code: code.slice(0, newlineIndex + 1) + prefix + code.slice(newlineIndex + 1) + suffix, + // The hashbang line has no tokens, so shifting the tokens to account + // for prefix can happen normally. + mappings: this.shiftMappings(result.mappings, prefix.length), + }; + } else { + return { + code: prefix + code + suffix, + mappings: this.shiftMappings(result.mappings, prefix.length), + }; + } + } + + processBalancedCode() { + let braceDepth = 0; + let parenDepth = 0; + while (!this.tokens.isAtEnd()) { + if (this.tokens.matches1(tt.braceL) || this.tokens.matches1(tt.dollarBraceL)) { + braceDepth++; + } else if (this.tokens.matches1(tt.braceR)) { + if (braceDepth === 0) { + return; + } + braceDepth--; + } + if (this.tokens.matches1(tt.parenL)) { + parenDepth++; + } else if (this.tokens.matches1(tt.parenR)) { + if (parenDepth === 0) { + return; + } + parenDepth--; + } + this.processToken(); + } + } + + processToken() { + if (this.tokens.matches1(tt._class)) { + this.processClass(); + return; + } + for (const transformer of this.transformers) { + const wasProcessed = transformer.process(); + if (wasProcessed) { + return; + } + } + this.tokens.copyToken(); + } + + /** + * Skip past a class with a name and return that name. + */ + processNamedClass() { + if (!this.tokens.matches2(tt._class, tt.name)) { + throw new Error("Expected identifier for exported class name."); + } + const name = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1); + this.processClass(); + return name; + } + + processClass() { + const classInfo = getClassInfo(this, this.tokens, this.nameManager, this.disableESTransforms); + + // Both static and instance initializers need a class name to use to invoke the initializer, so + // assign to one if necessary. + const needsCommaExpression = + (classInfo.headerInfo.isExpression || !classInfo.headerInfo.className) && + classInfo.staticInitializerNames.length + classInfo.instanceInitializerNames.length > 0; + + let className = classInfo.headerInfo.className; + if (needsCommaExpression) { + className = this.nameManager.claimFreeName("_class"); + this.generatedVariables.push(className); + this.tokens.appendCode(` (${className} =`); + } + + const classToken = this.tokens.currentToken(); + const contextId = classToken.contextId; + if (contextId == null) { + throw new Error("Expected class to have a context ID."); + } + this.tokens.copyExpectedToken(tt._class); + while (!this.tokens.matchesContextIdAndLabel(tt.braceL, contextId)) { + this.processToken(); + } + + this.processClassBody(classInfo, className); + + const staticInitializerStatements = classInfo.staticInitializerNames.map( + (name) => `${className}.${name}()`, + ); + if (needsCommaExpression) { + this.tokens.appendCode( + `, ${staticInitializerStatements.map((s) => `${s}, `).join("")}${className})`, + ); + } else if (classInfo.staticInitializerNames.length > 0) { + this.tokens.appendCode(` ${staticInitializerStatements.map((s) => `${s};`).join(" ")}`); + } + } + + /** + * We want to just handle class fields in all contexts, since TypeScript supports them. Later, + * when some JS implementations support class fields, this should be made optional. + */ + processClassBody(classInfo, className) { + const { + headerInfo, + constructorInsertPos, + constructorInitializerStatements, + fields, + instanceInitializerNames, + rangesToRemove, + } = classInfo; + let fieldIndex = 0; + let rangeToRemoveIndex = 0; + const classContextId = this.tokens.currentToken().contextId; + if (classContextId == null) { + throw new Error("Expected non-null context ID on class."); + } + this.tokens.copyExpectedToken(tt.braceL); + if (this.isReactHotLoaderTransformEnabled) { + this.tokens.appendCode( + "__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}", + ); + } + + const needsConstructorInit = + constructorInitializerStatements.length + instanceInitializerNames.length > 0; + + if (constructorInsertPos === null && needsConstructorInit) { + const constructorInitializersCode = this.makeConstructorInitCode( + constructorInitializerStatements, + instanceInitializerNames, + className, + ); + if (headerInfo.hasSuperclass) { + const argsName = this.nameManager.claimFreeName("args"); + this.tokens.appendCode( + `constructor(...${argsName}) { super(...${argsName}); ${constructorInitializersCode}; }`, + ); + } else { + this.tokens.appendCode(`constructor() { ${constructorInitializersCode}; }`); + } + } + + while (!this.tokens.matchesContextIdAndLabel(tt.braceR, classContextId)) { + if (fieldIndex < fields.length && this.tokens.currentIndex() === fields[fieldIndex].start) { + let needsCloseBrace = false; + if (this.tokens.matches1(tt.bracketL)) { + this.tokens.copyTokenWithPrefix(`${fields[fieldIndex].initializerName}() {this`); + } else if (this.tokens.matches1(tt.string) || this.tokens.matches1(tt.num)) { + this.tokens.copyTokenWithPrefix(`${fields[fieldIndex].initializerName}() {this[`); + needsCloseBrace = true; + } else { + this.tokens.copyTokenWithPrefix(`${fields[fieldIndex].initializerName}() {this.`); + } + while (this.tokens.currentIndex() < fields[fieldIndex].end) { + if (needsCloseBrace && this.tokens.currentIndex() === fields[fieldIndex].equalsIndex) { + this.tokens.appendCode("]"); + } + this.processToken(); + } + this.tokens.appendCode("}"); + fieldIndex++; + } else if ( + rangeToRemoveIndex < rangesToRemove.length && + this.tokens.currentIndex() >= rangesToRemove[rangeToRemoveIndex].start + ) { + if (this.tokens.currentIndex() < rangesToRemove[rangeToRemoveIndex].end) { + this.tokens.removeInitialToken(); + } + while (this.tokens.currentIndex() < rangesToRemove[rangeToRemoveIndex].end) { + this.tokens.removeToken(); + } + rangeToRemoveIndex++; + } else if (this.tokens.currentIndex() === constructorInsertPos) { + this.tokens.copyToken(); + if (needsConstructorInit) { + this.tokens.appendCode( + `;${this.makeConstructorInitCode( + constructorInitializerStatements, + instanceInitializerNames, + className, + )};`, + ); + } + this.processToken(); + } else { + this.processToken(); + } + } + this.tokens.copyExpectedToken(tt.braceR); + } + + makeConstructorInitCode( + constructorInitializerStatements, + instanceInitializerNames, + className, + ) { + return [ + ...constructorInitializerStatements, + ...instanceInitializerNames.map((name) => `${className}.prototype.${name}.call(this)`), + ].join(";"); + } + + /** + * Normally it's ok to simply remove type tokens, but we need to be more careful when dealing with + * arrow function return types since they can confuse the parser. In that case, we want to move + * the close-paren to the same line as the arrow. + * + * See https://github.com/alangpierce/sucrase/issues/391 for more details. + */ + processPossibleArrowParamEnd() { + if (this.tokens.matches2(tt.parenR, tt.colon) && this.tokens.tokenAtRelativeIndex(1).isType) { + let nextNonTypeIndex = this.tokens.currentIndex() + 1; + // Look ahead to see if this is an arrow function or something else. + while (this.tokens.tokens[nextNonTypeIndex].isType) { + nextNonTypeIndex++; + } + if (this.tokens.matches1AtIndex(nextNonTypeIndex, tt.arrow)) { + this.tokens.removeInitialToken(); + while (this.tokens.currentIndex() < nextNonTypeIndex) { + this.tokens.removeToken(); + } + this.tokens.replaceTokenTrimmingLeftWhitespace(") =>"); + return true; + } + } + return false; + } + + /** + * An async arrow function might be of the form: + * + * async < + * T + * >() => {} + * + * in which case, removing the type parameters will cause a syntax error. Detect this case and + * move the open-paren earlier. + */ + processPossibleAsyncArrowWithTypeParams() { + if ( + !this.tokens.matchesContextual(ContextualKeyword._async) && + !this.tokens.matches1(tt._async) + ) { + return false; + } + const nextToken = this.tokens.tokenAtRelativeIndex(1); + if (nextToken.type !== tt.lessThan || !nextToken.isType) { + return false; + } + + let nextNonTypeIndex = this.tokens.currentIndex() + 1; + // Look ahead to see if this is an arrow function or something else. + while (this.tokens.tokens[nextNonTypeIndex].isType) { + nextNonTypeIndex++; + } + if (this.tokens.matches1AtIndex(nextNonTypeIndex, tt.parenL)) { + this.tokens.replaceToken("async ("); + this.tokens.removeInitialToken(); + while (this.tokens.currentIndex() < nextNonTypeIndex) { + this.tokens.removeToken(); + } + this.tokens.removeToken(); + // We ate a ( token, so we need to process the tokens in between and then the ) token so that + // we remain balanced. + this.processBalancedCode(); + this.processToken(); + return true; + } + return false; + } + + processPossibleTypeRange() { + if (this.tokens.currentToken().isType) { + this.tokens.removeInitialToken(); + while (this.tokens.currentToken().isType) { + this.tokens.removeToken(); + } + return true; + } + return false; + } + + shiftMappings( + mappings, + prefixLength, + ) { + for (let i = 0; i < mappings.length; i++) { + const mapping = mappings[i]; + if (mapping !== undefined) { + mappings[i] = mapping + prefixLength; + } + } + return mappings; + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/Transformer.js b/node_modules/sucrase/dist/esm/transformers/Transformer.js new file mode 100644 index 00000000..5e8e9e73 --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/Transformer.js @@ -0,0 +1,16 @@ +export default class Transformer { + // Return true if anything was processed, false otherwise. + + + getPrefixCode() { + return ""; + } + + getHoistedCode() { + return ""; + } + + getSuffixCode() { + return ""; + } +} diff --git a/node_modules/sucrase/dist/esm/transformers/TypeScriptTransformer.js b/node_modules/sucrase/dist/esm/transformers/TypeScriptTransformer.js new file mode 100644 index 00000000..67e1274a --- /dev/null +++ b/node_modules/sucrase/dist/esm/transformers/TypeScriptTransformer.js @@ -0,0 +1,279 @@ + +import {TokenType as tt} from "../parser/tokenizer/types"; + +import isIdentifier from "../util/isIdentifier"; + +import Transformer from "./Transformer"; + +export default class TypeScriptTransformer extends Transformer { + constructor( + rootTransformer, + tokens, + isImportsTransformEnabled, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.isImportsTransformEnabled = isImportsTransformEnabled;; + } + + process() { + if ( + this.rootTransformer.processPossibleArrowParamEnd() || + this.rootTransformer.processPossibleAsyncArrowWithTypeParams() || + this.rootTransformer.processPossibleTypeRange() + ) { + return true; + } + if ( + this.tokens.matches1(tt._public) || + this.tokens.matches1(tt._protected) || + this.tokens.matches1(tt._private) || + this.tokens.matches1(tt._abstract) || + this.tokens.matches1(tt._readonly) || + this.tokens.matches1(tt._override) || + this.tokens.matches1(tt.nonNullAssertion) + ) { + this.tokens.removeInitialToken(); + return true; + } + if (this.tokens.matches1(tt._enum) || this.tokens.matches2(tt._const, tt._enum)) { + this.processEnum(); + return true; + } + if ( + this.tokens.matches2(tt._export, tt._enum) || + this.tokens.matches3(tt._export, tt._const, tt._enum) + ) { + this.processEnum(true); + return true; + } + return false; + } + + processEnum(isExport = false) { + // We might have "export const enum", so just remove all relevant tokens. + this.tokens.removeInitialToken(); + while (this.tokens.matches1(tt._const) || this.tokens.matches1(tt._enum)) { + this.tokens.removeToken(); + } + const enumName = this.tokens.identifierName(); + this.tokens.removeToken(); + if (isExport && !this.isImportsTransformEnabled) { + this.tokens.appendCode("export "); + } + this.tokens.appendCode(`var ${enumName}; (function (${enumName})`); + this.tokens.copyExpectedToken(tt.braceL); + this.processEnumBody(enumName); + this.tokens.copyExpectedToken(tt.braceR); + if (isExport && this.isImportsTransformEnabled) { + this.tokens.appendCode(`)(${enumName} || (exports.${enumName} = ${enumName} = {}));`); + } else { + this.tokens.appendCode(`)(${enumName} || (${enumName} = {}));`); + } + } + + /** + * Transform an enum into equivalent JS. This has complexity in a few places: + * - TS allows string enums, numeric enums, and a mix of the two styles within an enum. + * - Enum keys are allowed to be referenced in later enum values. + * - Enum keys are allowed to be strings. + * - When enum values are omitted, they should follow an auto-increment behavior. + */ + processEnumBody(enumName) { + // Code that can be used to reference the previous enum member, or null if this is the first + // enum member. + let previousValueCode = null; + while (true) { + if (this.tokens.matches1(tt.braceR)) { + break; + } + const {nameStringCode, variableName} = this.extractEnumKeyInfo(this.tokens.currentToken()); + this.tokens.removeInitialToken(); + + if ( + this.tokens.matches3(tt.eq, tt.string, tt.comma) || + this.tokens.matches3(tt.eq, tt.string, tt.braceR) + ) { + this.processStringLiteralEnumMember(enumName, nameStringCode, variableName); + } else if (this.tokens.matches1(tt.eq)) { + this.processExplicitValueEnumMember(enumName, nameStringCode, variableName); + } else { + this.processImplicitValueEnumMember( + enumName, + nameStringCode, + variableName, + previousValueCode, + ); + } + if (this.tokens.matches1(tt.comma)) { + this.tokens.removeToken(); + } + + if (variableName != null) { + previousValueCode = variableName; + } else { + previousValueCode = `${enumName}[${nameStringCode}]`; + } + } + } + + /** + * Detect name information about this enum key, which will be used to determine which code to emit + * and whether we should declare a variable as part of this declaration. + * + * Some cases to keep in mind: + * - Enum keys can be implicitly referenced later, e.g. `X = 1, Y = X`. In Sucrase, we implement + * this by declaring a variable `X` so that later expressions can use it. + * - In addition to the usual identifier key syntax, enum keys are allowed to be string literals, + * e.g. `"hello world" = 3,`. Template literal syntax is NOT allowed. + * - Even if the enum key is defined as a string literal, it may still be referenced by identifier + * later, e.g. `"X" = 1, Y = X`. That means that we need to detect whether or not a string + * literal is identifier-like and emit a variable if so, even if the declaration did not use an + * identifier. + * - Reserved keywords like `break` are valid enum keys, but are not valid to be referenced later + * and would be a syntax error if we emitted a variable, so we need to skip the variable + * declaration in those cases. + * + * The variableName return value captures these nuances: if non-null, we can and must emit a + * variable declaration, and if null, we can't and shouldn't. + */ + extractEnumKeyInfo(nameToken) { + if (nameToken.type === tt.name) { + const name = this.tokens.identifierNameForToken(nameToken); + return { + nameStringCode: `"${name}"`, + variableName: isIdentifier(name) ? name : null, + }; + } else if (nameToken.type === tt.string) { + const name = this.tokens.stringValueForToken(nameToken); + return { + nameStringCode: this.tokens.code.slice(nameToken.start, nameToken.end), + variableName: isIdentifier(name) ? name : null, + }; + } else { + throw new Error("Expected name or string at beginning of enum element."); + } + } + + /** + * Handle an enum member where the RHS is just a string literal (not omitted, not a number, and + * not a complex expression). This is the typical form for TS string enums, and in this case, we + * do *not* create a reverse mapping. + * + * This is called after deleting the key token, when the token processor is at the equals sign. + * + * Example 1: + * someKey = "some value" + * -> + * const someKey = "some value"; MyEnum["someKey"] = someKey; + * + * Example 2: + * "some key" = "some value" + * -> + * MyEnum["some key"] = "some value"; + */ + processStringLiteralEnumMember( + enumName, + nameStringCode, + variableName, + ) { + if (variableName != null) { + this.tokens.appendCode(`const ${variableName}`); + // = + this.tokens.copyToken(); + // value string + this.tokens.copyToken(); + this.tokens.appendCode(`; ${enumName}[${nameStringCode}] = ${variableName};`); + } else { + this.tokens.appendCode(`${enumName}[${nameStringCode}]`); + // = + this.tokens.copyToken(); + // value string + this.tokens.copyToken(); + this.tokens.appendCode(";"); + } + } + + /** + * Handle an enum member initialized with an expression on the right-hand side (other than a + * string literal). In these cases, we should transform the expression and emit code that sets up + * a reverse mapping. + * + * The TypeScript implementation of this operation distinguishes between expressions that can be + * "constant folded" at compile time (i.e. consist of number literals and simple math operations + * on those numbers) and ones that are dynamic. For constant expressions, it emits the resolved + * numeric value, and auto-incrementing is only allowed in that case. Evaluating expressions at + * compile time would add significant complexity to Sucrase, so Sucrase instead leaves the + * expression as-is, and will later emit something like `MyEnum["previousKey"] + 1` to implement + * auto-incrementing. + * + * This is called after deleting the key token, when the token processor is at the equals sign. + * + * Example 1: + * someKey = 1 + 1 + * -> + * const someKey = 1 + 1; MyEnum[MyEnum["someKey"] = someKey] = "someKey"; + * + * Example 2: + * "some key" = 1 + 1 + * -> + * MyEnum[MyEnum["some key"] = 1 + 1] = "some key"; + */ + processExplicitValueEnumMember( + enumName, + nameStringCode, + variableName, + ) { + const rhsEndIndex = this.tokens.currentToken().rhsEndIndex; + if (rhsEndIndex == null) { + throw new Error("Expected rhsEndIndex on enum assign."); + } + + if (variableName != null) { + this.tokens.appendCode(`const ${variableName}`); + this.tokens.copyToken(); + while (this.tokens.currentIndex() < rhsEndIndex) { + this.rootTransformer.processToken(); + } + this.tokens.appendCode( + `; ${enumName}[${enumName}[${nameStringCode}] = ${variableName}] = ${nameStringCode};`, + ); + } else { + this.tokens.appendCode(`${enumName}[${enumName}[${nameStringCode}]`); + this.tokens.copyToken(); + while (this.tokens.currentIndex() < rhsEndIndex) { + this.rootTransformer.processToken(); + } + this.tokens.appendCode(`] = ${nameStringCode};`); + } + } + + /** + * Handle an enum member with no right-hand side expression. In this case, the value is the + * previous value plus 1, or 0 if there was no previous value. We should also always emit a + * reverse mapping. + * + * Example 1: + * someKey2 + * -> + * const someKey2 = someKey1 + 1; MyEnum[MyEnum["someKey2"] = someKey2] = "someKey2"; + * + * Example 2: + * "some key 2" + * -> + * MyEnum[MyEnum["some key 2"] = someKey1 + 1] = "some key 2"; + */ + processImplicitValueEnumMember( + enumName, + nameStringCode, + variableName, + previousValueCode, + ) { + let valueCode = previousValueCode != null ? `${previousValueCode} + 1` : "0"; + if (variableName != null) { + this.tokens.appendCode(`const ${variableName} = ${valueCode}; `); + valueCode = variableName; + } + this.tokens.appendCode( + `${enumName}[${enumName}[${nameStringCode}] = ${valueCode}] = ${nameStringCode};`, + ); + } +} diff --git a/node_modules/sucrase/dist/esm/util/elideImportEquals.js b/node_modules/sucrase/dist/esm/util/elideImportEquals.js new file mode 100644 index 00000000..6b18a7af --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/elideImportEquals.js @@ -0,0 +1,29 @@ +import {TokenType as tt} from "../parser/tokenizer/types"; + + +export default function elideImportEquals(tokens) { + // import + tokens.removeInitialToken(); + // name + tokens.removeToken(); + // = + tokens.removeToken(); + // name or require + tokens.removeToken(); + // Handle either `import A = require('A')` or `import A = B.C.D`. + if (tokens.matches1(tt.parenL)) { + // ( + tokens.removeToken(); + // path string + tokens.removeToken(); + // ) + tokens.removeToken(); + } else { + while (tokens.matches1(tt.dot)) { + // . + tokens.removeToken(); + // name + tokens.removeToken(); + } + } +} diff --git a/node_modules/sucrase/dist/esm/util/formatTokens.js b/node_modules/sucrase/dist/esm/util/formatTokens.js new file mode 100644 index 00000000..eea07d24 --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/formatTokens.js @@ -0,0 +1,74 @@ +import LinesAndColumns from "lines-and-columns"; + + +import {formatTokenType} from "../parser/tokenizer/types"; + +export default function formatTokens(code, tokens) { + if (tokens.length === 0) { + return ""; + } + + const tokenKeys = Object.keys(tokens[0]).filter( + (k) => k !== "type" && k !== "value" && k !== "start" && k !== "end" && k !== "loc", + ); + const typeKeys = Object.keys(tokens[0].type).filter((k) => k !== "label" && k !== "keyword"); + + const headings = ["Location", "Label", "Raw", ...tokenKeys, ...typeKeys]; + + const lines = new LinesAndColumns(code); + const rows = [headings, ...tokens.map(getTokenComponents)]; + const padding = headings.map(() => 0); + for (const components of rows) { + for (let i = 0; i < components.length; i++) { + padding[i] = Math.max(padding[i], components[i].length); + } + } + return rows + .map((components) => components.map((component, i) => component.padEnd(padding[i])).join(" ")) + .join("\n"); + + function getTokenComponents(token) { + const raw = code.slice(token.start, token.end); + return [ + formatRange(token.start, token.end), + formatTokenType(token.type), + truncate(String(raw), 14), + // @ts-ignore: Intentional dynamic access by key. + ...tokenKeys.map((key) => formatValue(token[key], key)), + // @ts-ignore: Intentional dynamic access by key. + ...typeKeys.map((key) => formatValue(token.type[key], key)), + ]; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function formatValue(value, key) { + if (value === true) { + return key; + } else if (value === false || value === null) { + return ""; + } else { + return String(value); + } + } + + function formatRange(start, end) { + return `${formatPos(start)}-${formatPos(end)}`; + } + + function formatPos(pos) { + const location = lines.locationForIndex(pos); + if (!location) { + return "Unknown"; + } else { + return `${location.line + 1}:${location.column + 1}`; + } + } +} + +function truncate(s, length) { + if (s.length > length) { + return `${s.slice(0, length - 3)}...`; + } else { + return s; + } +} diff --git a/node_modules/sucrase/dist/esm/util/getClassInfo.js b/node_modules/sucrase/dist/esm/util/getClassInfo.js new file mode 100644 index 00000000..0100ad61 --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/getClassInfo.js @@ -0,0 +1,352 @@ + + +import {ContextualKeyword} from "../parser/tokenizer/keywords"; +import {TokenType as tt} from "../parser/tokenizer/types"; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + * Get information about the class fields for this class, given a token processor pointing to the + * open-brace at the start of the class. + */ +export default function getClassInfo( + rootTransformer, + tokens, + nameManager, + disableESTransforms, +) { + const snapshot = tokens.snapshot(); + + const headerInfo = processClassHeader(tokens); + + let constructorInitializerStatements = []; + const instanceInitializerNames = []; + const staticInitializerNames = []; + let constructorInsertPos = null; + const fields = []; + const rangesToRemove = []; + + const classContextId = tokens.currentToken().contextId; + if (classContextId == null) { + throw new Error("Expected non-null class context ID on class open-brace."); + } + + tokens.nextToken(); + while (!tokens.matchesContextIdAndLabel(tt.braceR, classContextId)) { + if (tokens.matchesContextual(ContextualKeyword._constructor) && !tokens.currentToken().isType) { + ({constructorInitializerStatements, constructorInsertPos} = processConstructor(tokens)); + } else if (tokens.matches1(tt.semi)) { + if (!disableESTransforms) { + rangesToRemove.push({start: tokens.currentIndex(), end: tokens.currentIndex() + 1}); + } + tokens.nextToken(); + } else if (tokens.currentToken().isType) { + tokens.nextToken(); + } else { + // Either a method or a field. Skip to the identifier part. + const statementStartIndex = tokens.currentIndex(); + let isStatic = false; + let isESPrivate = false; + let isDeclareOrAbstract = false; + while (isAccessModifier(tokens.currentToken())) { + if (tokens.matches1(tt._static)) { + isStatic = true; + } + if (tokens.matches1(tt.hash)) { + isESPrivate = true; + } + if (tokens.matches1(tt._declare) || tokens.matches1(tt._abstract)) { + isDeclareOrAbstract = true; + } + tokens.nextToken(); + } + if (isStatic && tokens.matches1(tt.braceL)) { + // This is a static block, so don't process it in any special way. + skipToNextClassElement(tokens, classContextId); + continue; + } + if (isESPrivate) { + // Sucrase doesn't attempt to transpile private fields; just leave them as-is. + skipToNextClassElement(tokens, classContextId); + continue; + } + if ( + tokens.matchesContextual(ContextualKeyword._constructor) && + !tokens.currentToken().isType + ) { + ({constructorInitializerStatements, constructorInsertPos} = processConstructor(tokens)); + continue; + } + + const nameStartIndex = tokens.currentIndex(); + skipFieldName(tokens); + if (tokens.matches1(tt.lessThan) || tokens.matches1(tt.parenL)) { + // This is a method, so nothing to process. + skipToNextClassElement(tokens, classContextId); + continue; + } + // There might be a type annotation that we need to skip. + while (tokens.currentToken().isType) { + tokens.nextToken(); + } + if (tokens.matches1(tt.eq)) { + const equalsIndex = tokens.currentIndex(); + // This is an initializer, so we need to wrap in an initializer method. + const valueEnd = tokens.currentToken().rhsEndIndex; + if (valueEnd == null) { + throw new Error("Expected rhsEndIndex on class field assignment."); + } + tokens.nextToken(); + while (tokens.currentIndex() < valueEnd) { + rootTransformer.processToken(); + } + let initializerName; + if (isStatic) { + initializerName = nameManager.claimFreeName("__initStatic"); + staticInitializerNames.push(initializerName); + } else { + initializerName = nameManager.claimFreeName("__init"); + instanceInitializerNames.push(initializerName); + } + // Fields start at the name, so `static x = 1;` has a field range of `x = 1;`. + fields.push({ + initializerName, + equalsIndex, + start: nameStartIndex, + end: tokens.currentIndex(), + }); + } else if (!disableESTransforms || isDeclareOrAbstract) { + // This is a regular field declaration, like `x;`. With the class transform enabled, we just + // remove the line so that no output is produced. With the class transform disabled, we + // usually want to preserve the declaration (but still strip types), but if the `declare` + // or `abstract` keyword is specified, we should remove the line to avoid initializing the + // value to undefined. + rangesToRemove.push({start: statementStartIndex, end: tokens.currentIndex()}); + } + } + } + + tokens.restoreToSnapshot(snapshot); + if (disableESTransforms) { + // With ES transforms disabled, we don't want to transform regular class + // field declarations, and we don't need to do any additional tricks to + // reference the constructor for static init, but we still need to transform + // TypeScript field initializers defined as constructor parameters and we + // still need to remove `declare` fields. For now, we run the same code + // path but omit any field information, as if the class had no field + // declarations. In the future, when we fully drop the class fields + // transform, we can simplify this code significantly. + return { + headerInfo, + constructorInitializerStatements, + instanceInitializerNames: [], + staticInitializerNames: [], + constructorInsertPos, + fields: [], + rangesToRemove, + }; + } else { + return { + headerInfo, + constructorInitializerStatements, + instanceInitializerNames, + staticInitializerNames, + constructorInsertPos, + fields, + rangesToRemove, + }; + } +} + +/** + * Move the token processor to the next method/field in the class. + * + * To do that, we seek forward to the next start of a class name (either an open + * bracket or an identifier, or the closing curly brace), then seek backward to + * include any access modifiers. + */ +function skipToNextClassElement(tokens, classContextId) { + tokens.nextToken(); + while (tokens.currentToken().contextId !== classContextId) { + tokens.nextToken(); + } + while (isAccessModifier(tokens.tokenAtRelativeIndex(-1))) { + tokens.previousToken(); + } +} + +function processClassHeader(tokens) { + const classToken = tokens.currentToken(); + const contextId = classToken.contextId; + if (contextId == null) { + throw new Error("Expected context ID on class token."); + } + const isExpression = classToken.isExpression; + if (isExpression == null) { + throw new Error("Expected isExpression on class token."); + } + let className = null; + let hasSuperclass = false; + tokens.nextToken(); + if (tokens.matches1(tt.name)) { + className = tokens.identifierName(); + } + while (!tokens.matchesContextIdAndLabel(tt.braceL, contextId)) { + // If this has a superclass, there will always be an `extends` token. If it doesn't have a + // superclass, only type parameters and `implements` clauses can show up here, all of which + // consist only of type tokens. A declaration like `class A {` should *not* count + // as having a superclass. + if (tokens.matches1(tt._extends) && !tokens.currentToken().isType) { + hasSuperclass = true; + } + tokens.nextToken(); + } + return {isExpression, className, hasSuperclass}; +} + +/** + * Extract useful information out of a constructor, starting at the "constructor" name. + */ +function processConstructor(tokens) + + + { + const constructorInitializerStatements = []; + + tokens.nextToken(); + const constructorContextId = tokens.currentToken().contextId; + if (constructorContextId == null) { + throw new Error("Expected context ID on open-paren starting constructor params."); + } + // Advance through parameters looking for access modifiers. + while (!tokens.matchesContextIdAndLabel(tt.parenR, constructorContextId)) { + if (tokens.currentToken().contextId === constructorContextId) { + // Current token is an open paren or comma just before a param, so check + // that param for access modifiers. + tokens.nextToken(); + if (isAccessModifier(tokens.currentToken())) { + tokens.nextToken(); + while (isAccessModifier(tokens.currentToken())) { + tokens.nextToken(); + } + const token = tokens.currentToken(); + if (token.type !== tt.name) { + throw new Error("Expected identifier after access modifiers in constructor arg."); + } + const name = tokens.identifierNameForToken(token); + constructorInitializerStatements.push(`this.${name} = ${name}`); + } + } else { + tokens.nextToken(); + } + } + // ) + tokens.nextToken(); + // Constructor type annotations are invalid, but skip them anyway since + // they're easy to skip. + while (tokens.currentToken().isType) { + tokens.nextToken(); + } + let constructorInsertPos = tokens.currentIndex(); + + // Advance through body looking for a super call. + let foundSuperCall = false; + while (!tokens.matchesContextIdAndLabel(tt.braceR, constructorContextId)) { + if (!foundSuperCall && tokens.matches2(tt._super, tt.parenL)) { + tokens.nextToken(); + const superCallContextId = tokens.currentToken().contextId; + if (superCallContextId == null) { + throw new Error("Expected a context ID on the super call"); + } + while (!tokens.matchesContextIdAndLabel(tt.parenR, superCallContextId)) { + tokens.nextToken(); + } + constructorInsertPos = tokens.currentIndex(); + foundSuperCall = true; + } + tokens.nextToken(); + } + // } + tokens.nextToken(); + + return {constructorInitializerStatements, constructorInsertPos}; +} + +/** + * Determine if this is any token that can go before the name in a method/field. + */ +function isAccessModifier(token) { + return [ + tt._async, + tt._get, + tt._set, + tt.plus, + tt.minus, + tt._readonly, + tt._static, + tt._public, + tt._private, + tt._protected, + tt._override, + tt._abstract, + tt.star, + tt._declare, + tt.hash, + ].includes(token.type); +} + +/** + * The next token or set of tokens is either an identifier or an expression in square brackets, for + * a method or field name. + */ +function skipFieldName(tokens) { + if (tokens.matches1(tt.bracketL)) { + const startToken = tokens.currentToken(); + const classContextId = startToken.contextId; + if (classContextId == null) { + throw new Error("Expected class context ID on computed name open bracket."); + } + while (!tokens.matchesContextIdAndLabel(tt.bracketR, classContextId)) { + tokens.nextToken(); + } + tokens.nextToken(); + } else { + tokens.nextToken(); + } +} diff --git a/node_modules/sucrase/dist/esm/util/getDeclarationInfo.js b/node_modules/sucrase/dist/esm/util/getDeclarationInfo.js new file mode 100644 index 00000000..ade9a817 --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/getDeclarationInfo.js @@ -0,0 +1,40 @@ +import {isTopLevelDeclaration} from "../parser/tokenizer"; +import {TokenType as tt} from "../parser/tokenizer/types"; + + + + + + + +export const EMPTY_DECLARATION_INFO = { + typeDeclarations: new Set(), + valueDeclarations: new Set(), +}; + +/** + * Get all top-level identifiers that should be preserved when exported in TypeScript. + * + * Examples: + * - If an identifier is declared as `const x`, then `export {x}` should be preserved. + * - If it's declared as `type x`, then `export {x}` should be removed. + * - If it's declared as both `const x` and `type x`, then the export should be preserved. + * - Classes and enums should be preserved (even though they also introduce types). + * - Imported identifiers should be preserved since we don't have enough information to + * rule them out. --isolatedModules disallows re-exports, which catches errors here. + */ +export default function getDeclarationInfo(tokens) { + const typeDeclarations = new Set(); + const valueDeclarations = new Set(); + for (let i = 0; i < tokens.tokens.length; i++) { + const token = tokens.tokens[i]; + if (token.type === tt.name && isTopLevelDeclaration(token)) { + if (token.isType) { + typeDeclarations.add(tokens.identifierNameForToken(token)); + } else { + valueDeclarations.add(tokens.identifierNameForToken(token)); + } + } + } + return {typeDeclarations, valueDeclarations}; +} diff --git a/node_modules/sucrase/dist/esm/util/getIdentifierNames.js b/node_modules/sucrase/dist/esm/util/getIdentifierNames.js new file mode 100644 index 00000000..5b859017 --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/getIdentifierNames.js @@ -0,0 +1,15 @@ + +import {TokenType as tt} from "../parser/tokenizer/types"; + +/** + * Get all identifier names in the code, in order, including duplicates. + */ +export default function getIdentifierNames(code, tokens) { + const names = []; + for (const token of tokens) { + if (token.type === tt.name) { + names.push(code.slice(token.start, token.end)); + } + } + return names; +} diff --git a/node_modules/sucrase/dist/esm/util/getImportExportSpecifierInfo.js b/node_modules/sucrase/dist/esm/util/getImportExportSpecifierInfo.js new file mode 100644 index 00000000..3dc6d2c8 --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/getImportExportSpecifierInfo.js @@ -0,0 +1,92 @@ +import {TokenType as tt} from "../parser/tokenizer/types"; + + + + + + + + + + + + + + + + +/** + * Determine information about this named import or named export specifier. + * + * This syntax is the `a` from statements like these: + * import {A} from "./foo"; + * export {A}; + * export {A} from "./foo"; + * + * As it turns out, we can exactly characterize the syntax meaning by simply + * counting the number of tokens, which can be from 1 to 4: + * {A} + * {type A} + * {A as B} + * {type A as B} + * + * In the type case, we never actually need the names in practice, so don't get + * them. + * + * TODO: There's some redundancy with the type detection here and the isType + * flag that's already present on tokens in TS mode. This function could + * potentially be simplified and/or pushed to the call sites to avoid the object + * allocation. + */ +export default function getImportExportSpecifierInfo( + tokens, + index = tokens.currentIndex(), +) { + let endIndex = index + 1; + if (isSpecifierEnd(tokens, endIndex)) { + // import {A} + const name = tokens.identifierNameAtIndex(index); + return { + isType: false, + leftName: name, + rightName: name, + endIndex, + }; + } + endIndex++; + if (isSpecifierEnd(tokens, endIndex)) { + // import {type A} + return { + isType: true, + leftName: null, + rightName: null, + endIndex, + }; + } + endIndex++; + if (isSpecifierEnd(tokens, endIndex)) { + // import {A as B} + return { + isType: false, + leftName: tokens.identifierNameAtIndex(index), + rightName: tokens.identifierNameAtIndex(index + 2), + endIndex, + }; + } + endIndex++; + if (isSpecifierEnd(tokens, endIndex)) { + // import {type A as B} + return { + isType: true, + leftName: null, + rightName: null, + endIndex, + }; + } + throw new Error(`Unexpected import/export specifier at ${index}`); +} + +function isSpecifierEnd(tokens, index) { + const token = tokens.tokens[index]; + return token.type === tt.braceR || token.type === tt.comma; +} diff --git a/node_modules/sucrase/dist/esm/util/getJSXPragmaInfo.js b/node_modules/sucrase/dist/esm/util/getJSXPragmaInfo.js new file mode 100644 index 00000000..9972342e --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/getJSXPragmaInfo.js @@ -0,0 +1,22 @@ + + + + + + + + + +export default function getJSXPragmaInfo(options) { + const [base, suffix] = splitPragma(options.jsxPragma || "React.createElement"); + const [fragmentBase, fragmentSuffix] = splitPragma(options.jsxFragmentPragma || "React.Fragment"); + return {base, suffix, fragmentBase, fragmentSuffix}; +} + +function splitPragma(pragma) { + let dotIndex = pragma.indexOf("."); + if (dotIndex === -1) { + dotIndex = pragma.length; + } + return [pragma.slice(0, dotIndex), pragma.slice(dotIndex)]; +} diff --git a/node_modules/sucrase/dist/esm/util/getNonTypeIdentifiers.js b/node_modules/sucrase/dist/esm/util/getNonTypeIdentifiers.js new file mode 100644 index 00000000..24c73ddd --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/getNonTypeIdentifiers.js @@ -0,0 +1,43 @@ + +import {IdentifierRole} from "../parser/tokenizer"; +import {TokenType, TokenType as tt} from "../parser/tokenizer/types"; + +import {startsWithLowerCase} from "../transformers/JSXTransformer"; +import getJSXPragmaInfo from "./getJSXPragmaInfo"; + +export function getNonTypeIdentifiers(tokens, options) { + const jsxPragmaInfo = getJSXPragmaInfo(options); + const nonTypeIdentifiers = new Set(); + for (let i = 0; i < tokens.tokens.length; i++) { + const token = tokens.tokens[i]; + if ( + token.type === tt.name && + !token.isType && + (token.identifierRole === IdentifierRole.Access || + token.identifierRole === IdentifierRole.ObjectShorthand || + token.identifierRole === IdentifierRole.ExportAccess) && + !token.shadowsGlobal + ) { + nonTypeIdentifiers.add(tokens.identifierNameForToken(token)); + } + if (token.type === tt.jsxTagStart) { + nonTypeIdentifiers.add(jsxPragmaInfo.base); + } + if ( + token.type === tt.jsxTagStart && + i + 1 < tokens.tokens.length && + tokens.tokens[i + 1].type === tt.jsxTagEnd + ) { + nonTypeIdentifiers.add(jsxPragmaInfo.base); + nonTypeIdentifiers.add(jsxPragmaInfo.fragmentBase); + } + if (token.type === tt.jsxName && token.identifierRole === IdentifierRole.Access) { + const identifierName = tokens.identifierNameForToken(token); + // Lower-case single-component tag names like "div" don't count. + if (!startsWithLowerCase(identifierName) || tokens.tokens[i + 1].type === TokenType.dot) { + nonTypeIdentifiers.add(tokens.identifierNameForToken(token)); + } + } + } + return nonTypeIdentifiers; +} diff --git a/node_modules/sucrase/dist/esm/util/getTSImportedNames.js b/node_modules/sucrase/dist/esm/util/getTSImportedNames.js new file mode 100644 index 00000000..523181a7 --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/getTSImportedNames.js @@ -0,0 +1,84 @@ +import {TokenType as tt} from "../parser/tokenizer/types"; + +import getImportExportSpecifierInfo from "./getImportExportSpecifierInfo"; + +/** + * Special case code to scan for imported names in ESM TypeScript. We need to do this so we can + * properly get globals so we can compute shadowed globals. + * + * This is similar to logic in CJSImportProcessor, but trimmed down to avoid logic with CJS + * replacement and flow type imports. + */ +export default function getTSImportedNames(tokens) { + const importedNames = new Set(); + for (let i = 0; i < tokens.tokens.length; i++) { + if ( + tokens.matches1AtIndex(i, tt._import) && + !tokens.matches3AtIndex(i, tt._import, tt.name, tt.eq) + ) { + collectNamesForImport(tokens, i, importedNames); + } + } + return importedNames; +} + +function collectNamesForImport( + tokens, + index, + importedNames, +) { + index++; + + if (tokens.matches1AtIndex(index, tt.parenL)) { + // Dynamic import, so nothing to do + return; + } + + if (tokens.matches1AtIndex(index, tt.name)) { + importedNames.add(tokens.identifierNameAtIndex(index)); + index++; + if (tokens.matches1AtIndex(index, tt.comma)) { + index++; + } + } + + if (tokens.matches1AtIndex(index, tt.star)) { + // * as + index += 2; + importedNames.add(tokens.identifierNameAtIndex(index)); + index++; + } + + if (tokens.matches1AtIndex(index, tt.braceL)) { + index++; + collectNamesForNamedImport(tokens, index, importedNames); + } +} + +function collectNamesForNamedImport( + tokens, + index, + importedNames, +) { + while (true) { + if (tokens.matches1AtIndex(index, tt.braceR)) { + return; + } + + const specifierInfo = getImportExportSpecifierInfo(tokens, index); + index = specifierInfo.endIndex; + if (!specifierInfo.isType) { + importedNames.add(specifierInfo.rightName); + } + + if (tokens.matches2AtIndex(index, tt.comma, tt.braceR)) { + return; + } else if (tokens.matches1AtIndex(index, tt.braceR)) { + return; + } else if (tokens.matches1AtIndex(index, tt.comma)) { + index++; + } else { + throw new Error(`Unexpected token: ${JSON.stringify(tokens.tokens[index])}`); + } + } +} diff --git a/node_modules/sucrase/dist/esm/util/isAsyncOperation.js b/node_modules/sucrase/dist/esm/util/isAsyncOperation.js new file mode 100644 index 00000000..af40e9a5 --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/isAsyncOperation.js @@ -0,0 +1,38 @@ +import {ContextualKeyword} from "../parser/tokenizer/keywords"; + + +/** + * Determine whether this optional chain or nullish coalescing operation has any await statements in + * it. If so, we'll need to transpile to an async operation. + * + * We compute this by walking the length of the operation and returning true if we see an await + * keyword used as a real await (rather than an object key or property access). Nested optional + * chain/nullish operations need to be tracked but don't silence await, but a nested async function + * (or any other nested scope) will make the await not count. + */ +export default function isAsyncOperation(tokens) { + let index = tokens.currentIndex(); + let depth = 0; + const startToken = tokens.currentToken(); + do { + const token = tokens.tokens[index]; + if (token.isOptionalChainStart) { + depth++; + } + if (token.isOptionalChainEnd) { + depth--; + } + depth += token.numNullishCoalesceStarts; + depth -= token.numNullishCoalesceEnds; + + if ( + token.contextualKeyword === ContextualKeyword._await && + token.identifierRole == null && + token.scopeDepth === startToken.scopeDepth + ) { + return true; + } + index += 1; + } while (depth > 0 && index < tokens.tokens.length); + return false; +} diff --git a/node_modules/sucrase/dist/esm/util/isExportFrom.js b/node_modules/sucrase/dist/esm/util/isExportFrom.js new file mode 100644 index 00000000..fd336652 --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/isExportFrom.js @@ -0,0 +1,18 @@ +import {ContextualKeyword} from "../parser/tokenizer/keywords"; +import {TokenType as tt} from "../parser/tokenizer/types"; + + +/** + * Starting at `export {`, look ahead and return `true` if this is an + * `export {...} from` statement and `false` if this is a plain multi-export. + */ +export default function isExportFrom(tokens) { + let closeBraceIndex = tokens.currentIndex(); + while (!tokens.matches1AtIndex(closeBraceIndex, tt.braceR)) { + closeBraceIndex++; + } + return ( + tokens.matchesContextualAtIndex(closeBraceIndex + 1, ContextualKeyword._from) && + tokens.matches1AtIndex(closeBraceIndex + 2, tt.string) + ); +} diff --git a/node_modules/sucrase/dist/esm/util/isIdentifier.js b/node_modules/sucrase/dist/esm/util/isIdentifier.js new file mode 100644 index 00000000..4a62ff6a --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/isIdentifier.js @@ -0,0 +1,81 @@ +import {IS_IDENTIFIER_CHAR, IS_IDENTIFIER_START} from "../parser/util/identifier"; + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar +// Hard-code a list of reserved words rather than trying to use keywords or contextual keywords +// from the parser, since currently there are various exceptions, like `package` being reserved +// but unused and various contextual keywords being reserved. Note that we assume that all code +// compiled by Sucrase is in a module, so strict mode words and await are all considered reserved +// here. +const RESERVED_WORDS = new Set([ + // Reserved keywords as of ECMAScript 2015 + "break", + "case", + "catch", + "class", + "const", + "continue", + "debugger", + "default", + "delete", + "do", + "else", + "export", + "extends", + "finally", + "for", + "function", + "if", + "import", + "in", + "instanceof", + "new", + "return", + "super", + "switch", + "this", + "throw", + "try", + "typeof", + "var", + "void", + "while", + "with", + "yield", + // Future reserved keywords + "enum", + "implements", + "interface", + "let", + "package", + "private", + "protected", + "public", + "static", + "await", + // Literals that cannot be used as identifiers + "false", + "null", + "true", +]); + +/** + * Determine if the given name is a legal variable name. + * + * This is needed when transforming TypeScript enums; if an enum key is a valid + * variable name, it might be referenced later in the enum, so we need to + * declare a variable. + */ +export default function isIdentifier(name) { + if (name.length === 0) { + return false; + } + if (!IS_IDENTIFIER_START[name.charCodeAt(0)]) { + return false; + } + for (let i = 1; i < name.length; i++) { + if (!IS_IDENTIFIER_CHAR[name.charCodeAt(i)]) { + return false; + } + } + return !RESERVED_WORDS.has(name); +} diff --git a/node_modules/sucrase/dist/esm/util/removeMaybeImportAttributes.js b/node_modules/sucrase/dist/esm/util/removeMaybeImportAttributes.js new file mode 100644 index 00000000..abced0ee --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/removeMaybeImportAttributes.js @@ -0,0 +1,22 @@ +import {ContextualKeyword} from "../parser/tokenizer/keywords"; +import {TokenType as tt} from "../parser/tokenizer/types"; + + +/** + * Starting at a potential `with` or (legacy) `assert` token, remove the import + * attributes if they exist. + */ +export function removeMaybeImportAttributes(tokens) { + if ( + tokens.matches2(tt._with, tt.braceL) || + (tokens.matches2(tt.name, tt.braceL) && tokens.matchesContextual(ContextualKeyword._assert)) + ) { + // assert + tokens.removeToken(); + // { + tokens.removeToken(); + tokens.removeBalancedCode(); + // } + tokens.removeToken(); + } +} diff --git a/node_modules/sucrase/dist/esm/util/shouldElideDefaultExport.js b/node_modules/sucrase/dist/esm/util/shouldElideDefaultExport.js new file mode 100644 index 00000000..d3c46938 --- /dev/null +++ b/node_modules/sucrase/dist/esm/util/shouldElideDefaultExport.js @@ -0,0 +1,38 @@ +import {TokenType as tt} from "../parser/tokenizer/types"; + + + +/** + * Common method sharing code between CJS and ESM cases, since they're the same here. + */ +export default function shouldElideDefaultExport( + isTypeScriptTransformEnabled, + keepUnusedImports, + tokens, + declarationInfo, +) { + if (!isTypeScriptTransformEnabled || keepUnusedImports) { + return false; + } + const exportToken = tokens.currentToken(); + if (exportToken.rhsEndIndex == null) { + throw new Error("Expected non-null rhsEndIndex on export token."); + } + // The export must be of the form `export default a` or `export default a;`. + const numTokens = exportToken.rhsEndIndex - tokens.currentIndex(); + if ( + numTokens !== 3 && + !(numTokens === 4 && tokens.matches1AtIndex(exportToken.rhsEndIndex - 1, tt.semi)) + ) { + return false; + } + const identifierToken = tokens.tokenAtRelativeIndex(2); + if (identifierToken.type !== tt.name) { + return false; + } + const exportedName = tokens.identifierNameForToken(identifierToken); + return ( + declarationInfo.typeDeclarations.has(exportedName) && + !declarationInfo.valueDeclarations.has(exportedName) + ); +} diff --git a/node_modules/sucrase/dist/identifyShadowedGlobals.js b/node_modules/sucrase/dist/identifyShadowedGlobals.js new file mode 100644 index 00000000..41c8eeff --- /dev/null +++ b/node_modules/sucrase/dist/identifyShadowedGlobals.js @@ -0,0 +1,98 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); + + + +var _tokenizer = require('./parser/tokenizer'); + +var _types = require('./parser/tokenizer/types'); + + +/** + * Traverse the given tokens and modify them if necessary to indicate that some names shadow global + * variables. + */ + function identifyShadowedGlobals( + tokens, + scopes, + globalNames, +) { + if (!hasShadowedGlobals(tokens, globalNames)) { + return; + } + markShadowedGlobals(tokens, scopes, globalNames); +} exports.default = identifyShadowedGlobals; + +/** + * We can do a fast up-front check to see if there are any declarations to global names. If not, + * then there's no point in computing scope assignments. + */ +// Exported for testing. + function hasShadowedGlobals(tokens, globalNames) { + for (const token of tokens.tokens) { + if ( + token.type === _types.TokenType.name && + !token.isType && + _tokenizer.isNonTopLevelDeclaration.call(void 0, token) && + globalNames.has(tokens.identifierNameForToken(token)) + ) { + return true; + } + } + return false; +} exports.hasShadowedGlobals = hasShadowedGlobals; + +function markShadowedGlobals( + tokens, + scopes, + globalNames, +) { + const scopeStack = []; + let scopeIndex = scopes.length - 1; + // Scopes were generated at completion time, so they're sorted by end index, so we can maintain a + // good stack by going backwards through them. + for (let i = tokens.tokens.length - 1; ; i--) { + while (scopeStack.length > 0 && scopeStack[scopeStack.length - 1].startTokenIndex === i + 1) { + scopeStack.pop(); + } + while (scopeIndex >= 0 && scopes[scopeIndex].endTokenIndex === i + 1) { + scopeStack.push(scopes[scopeIndex]); + scopeIndex--; + } + // Process scopes after the last iteration so we can make sure we pop all of them. + if (i < 0) { + break; + } + + const token = tokens.tokens[i]; + const name = tokens.identifierNameForToken(token); + if (scopeStack.length > 1 && !token.isType && token.type === _types.TokenType.name && globalNames.has(name)) { + if (_tokenizer.isBlockScopedDeclaration.call(void 0, token)) { + markShadowedForScope(scopeStack[scopeStack.length - 1], tokens, name); + } else if (_tokenizer.isFunctionScopedDeclaration.call(void 0, token)) { + let stackIndex = scopeStack.length - 1; + while (stackIndex > 0 && !scopeStack[stackIndex].isFunctionScope) { + stackIndex--; + } + if (stackIndex < 0) { + throw new Error("Did not find parent function scope."); + } + markShadowedForScope(scopeStack[stackIndex], tokens, name); + } + } + } + if (scopeStack.length > 0) { + throw new Error("Expected empty scope stack after processing file."); + } +} + +function markShadowedForScope(scope, tokens, name) { + for (let i = scope.startTokenIndex; i < scope.endTokenIndex; i++) { + const token = tokens.tokens[i]; + if ( + (token.type === _types.TokenType.name || token.type === _types.TokenType.jsxName) && + tokens.identifierNameForToken(token) === name + ) { + token.shadowsGlobal = true; + } + } +} diff --git a/node_modules/sucrase/dist/index.js b/node_modules/sucrase/dist/index.js new file mode 100644 index 00000000..63952451 --- /dev/null +++ b/node_modules/sucrase/dist/index.js @@ -0,0 +1,133 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _CJSImportProcessor = require('./CJSImportProcessor'); var _CJSImportProcessor2 = _interopRequireDefault(_CJSImportProcessor); +var _computeSourceMap = require('./computeSourceMap'); var _computeSourceMap2 = _interopRequireDefault(_computeSourceMap); +var _HelperManager = require('./HelperManager'); +var _identifyShadowedGlobals = require('./identifyShadowedGlobals'); var _identifyShadowedGlobals2 = _interopRequireDefault(_identifyShadowedGlobals); +var _NameManager = require('./NameManager'); var _NameManager2 = _interopRequireDefault(_NameManager); +var _Options = require('./Options'); + +var _parser = require('./parser'); + +var _TokenProcessor = require('./TokenProcessor'); var _TokenProcessor2 = _interopRequireDefault(_TokenProcessor); +var _RootTransformer = require('./transformers/RootTransformer'); var _RootTransformer2 = _interopRequireDefault(_RootTransformer); +var _formatTokens = require('./util/formatTokens'); var _formatTokens2 = _interopRequireDefault(_formatTokens); +var _getTSImportedNames = require('./util/getTSImportedNames'); var _getTSImportedNames2 = _interopRequireDefault(_getTSImportedNames); + + + + + + + + + + + + + + +; + + function getVersion() { + /* istanbul ignore next */ + return "3.35.0"; +} exports.getVersion = getVersion; + + function transform(code, options) { + _Options.validateOptions.call(void 0, options); + try { + const sucraseContext = getSucraseContext(code, options); + const transformer = new (0, _RootTransformer2.default)( + sucraseContext, + options.transforms, + Boolean(options.enableLegacyBabel5ModuleInterop), + options, + ); + const transformerResult = transformer.transform(); + let result = {code: transformerResult.code}; + if (options.sourceMapOptions) { + if (!options.filePath) { + throw new Error("filePath must be specified when generating a source map."); + } + result = { + ...result, + sourceMap: _computeSourceMap2.default.call(void 0, + transformerResult, + options.filePath, + options.sourceMapOptions, + code, + sucraseContext.tokenProcessor.tokens, + ), + }; + } + return result; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (e) { + if (options.filePath) { + e.message = `Error transforming ${options.filePath}: ${e.message}`; + } + throw e; + } +} exports.transform = transform; + +/** + * Return a string representation of the sucrase tokens, mostly useful for + * diagnostic purposes. + */ + function getFormattedTokens(code, options) { + const tokens = getSucraseContext(code, options).tokenProcessor.tokens; + return _formatTokens2.default.call(void 0, code, tokens); +} exports.getFormattedTokens = getFormattedTokens; + +/** + * Call into the parser/tokenizer and do some further preprocessing: + * - Come up with a set of used names so that we can assign new names. + * - Preprocess all import/export statements so we know which globals we are interested in. + * - Compute situations where any of those globals are shadowed. + * + * In the future, some of these preprocessing steps can be skipped based on what actual work is + * being done. + */ +function getSucraseContext(code, options) { + const isJSXEnabled = options.transforms.includes("jsx"); + const isTypeScriptEnabled = options.transforms.includes("typescript"); + const isFlowEnabled = options.transforms.includes("flow"); + const disableESTransforms = options.disableESTransforms === true; + const file = _parser.parse.call(void 0, code, isJSXEnabled, isTypeScriptEnabled, isFlowEnabled); + const tokens = file.tokens; + const scopes = file.scopes; + + const nameManager = new (0, _NameManager2.default)(code, tokens); + const helperManager = new (0, _HelperManager.HelperManager)(nameManager); + const tokenProcessor = new (0, _TokenProcessor2.default)( + code, + tokens, + isFlowEnabled, + disableESTransforms, + helperManager, + ); + const enableLegacyTypeScriptModuleInterop = Boolean(options.enableLegacyTypeScriptModuleInterop); + + let importProcessor = null; + if (options.transforms.includes("imports")) { + importProcessor = new (0, _CJSImportProcessor2.default)( + nameManager, + tokenProcessor, + enableLegacyTypeScriptModuleInterop, + options, + options.transforms.includes("typescript"), + Boolean(options.keepUnusedImports), + helperManager, + ); + importProcessor.preprocessTokens(); + // We need to mark shadowed globals after processing imports so we know that the globals are, + // but before type-only import pruning, since that relies on shadowing information. + _identifyShadowedGlobals2.default.call(void 0, tokenProcessor, scopes, importProcessor.getGlobalNames()); + if (options.transforms.includes("typescript") && !options.keepUnusedImports) { + importProcessor.pruneTypeOnlyImports(); + } + } else if (options.transforms.includes("typescript") && !options.keepUnusedImports) { + // Shadowed global detection is needed for TS implicit elision of imported names. + _identifyShadowedGlobals2.default.call(void 0, tokenProcessor, scopes, _getTSImportedNames2.default.call(void 0, tokenProcessor)); + } + return {tokenProcessor, scopes, nameManager, importProcessor, helperManager}; +} diff --git a/node_modules/sucrase/dist/parser/index.js b/node_modules/sucrase/dist/parser/index.js new file mode 100644 index 00000000..35d832a2 --- /dev/null +++ b/node_modules/sucrase/dist/parser/index.js @@ -0,0 +1,31 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); + +var _base = require('./traverser/base'); +var _index = require('./traverser/index'); + + class File { + + + + constructor(tokens, scopes) { + this.tokens = tokens; + this.scopes = scopes; + } +} exports.File = File; + + function parse( + input, + isJSXEnabled, + isTypeScriptEnabled, + isFlowEnabled, +) { + if (isFlowEnabled && isTypeScriptEnabled) { + throw new Error("Cannot combine flow and typescript plugins."); + } + _base.initParser.call(void 0, input, isJSXEnabled, isTypeScriptEnabled, isFlowEnabled); + const result = _index.parseFile.call(void 0, ); + if (_base.state.error) { + throw _base.augmentError.call(void 0, _base.state.error); + } + return result; +} exports.parse = parse; diff --git a/node_modules/sucrase/dist/parser/plugins/flow.js b/node_modules/sucrase/dist/parser/plugins/flow.js new file mode 100644 index 00000000..9401895f --- /dev/null +++ b/node_modules/sucrase/dist/parser/plugins/flow.js @@ -0,0 +1,1105 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});/* eslint max-len: 0 */ + + + + + + + + + + +var _index = require('../tokenizer/index'); +var _keywords = require('../tokenizer/keywords'); +var _types = require('../tokenizer/types'); +var _base = require('../traverser/base'); + + + + + + + + + + + + + +var _expression = require('../traverser/expression'); + + + + + + + + +var _statement = require('../traverser/statement'); + + + + + + + + + +var _util = require('../traverser/util'); + +function isMaybeDefaultImport(lookahead) { + return ( + (lookahead.type === _types.TokenType.name || !!(lookahead.type & _types.TokenType.IS_KEYWORD)) && + lookahead.contextualKeyword !== _keywords.ContextualKeyword._from + ); +} + +function flowParseTypeInitialiser(tok) { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _util.expect.call(void 0, tok || _types.TokenType.colon); + flowParseType(); + _index.popTypeContext.call(void 0, oldIsType); +} + +function flowParsePredicate() { + _util.expect.call(void 0, _types.TokenType.modulo); + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._checks); + if (_index.eat.call(void 0, _types.TokenType.parenL)) { + _expression.parseExpression.call(void 0, ); + _util.expect.call(void 0, _types.TokenType.parenR); + } +} + +function flowParseTypeAndPredicateInitialiser() { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _util.expect.call(void 0, _types.TokenType.colon); + if (_index.match.call(void 0, _types.TokenType.modulo)) { + flowParsePredicate(); + } else { + flowParseType(); + if (_index.match.call(void 0, _types.TokenType.modulo)) { + flowParsePredicate(); + } + } + _index.popTypeContext.call(void 0, oldIsType); +} + +function flowParseDeclareClass() { + _index.next.call(void 0, ); + flowParseInterfaceish(/* isClass */ true); +} + +function flowParseDeclareFunction() { + _index.next.call(void 0, ); + _expression.parseIdentifier.call(void 0, ); + + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseTypeParameterDeclaration(); + } + + _util.expect.call(void 0, _types.TokenType.parenL); + flowParseFunctionTypeParams(); + _util.expect.call(void 0, _types.TokenType.parenR); + + flowParseTypeAndPredicateInitialiser(); + + _util.semicolon.call(void 0, ); +} + +function flowParseDeclare() { + if (_index.match.call(void 0, _types.TokenType._class)) { + flowParseDeclareClass(); + } else if (_index.match.call(void 0, _types.TokenType._function)) { + flowParseDeclareFunction(); + } else if (_index.match.call(void 0, _types.TokenType._var)) { + flowParseDeclareVariable(); + } else if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._module)) { + if (_index.eat.call(void 0, _types.TokenType.dot)) { + flowParseDeclareModuleExports(); + } else { + flowParseDeclareModule(); + } + } else if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._type)) { + flowParseDeclareTypeAlias(); + } else if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._opaque)) { + flowParseDeclareOpaqueType(); + } else if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._interface)) { + flowParseDeclareInterface(); + } else if (_index.match.call(void 0, _types.TokenType._export)) { + flowParseDeclareExportDeclaration(); + } else { + _util.unexpected.call(void 0, ); + } +} + +function flowParseDeclareVariable() { + _index.next.call(void 0, ); + flowParseTypeAnnotatableIdentifier(); + _util.semicolon.call(void 0, ); +} + +function flowParseDeclareModule() { + if (_index.match.call(void 0, _types.TokenType.string)) { + _expression.parseExprAtom.call(void 0, ); + } else { + _expression.parseIdentifier.call(void 0, ); + } + + _util.expect.call(void 0, _types.TokenType.braceL); + while (!_index.match.call(void 0, _types.TokenType.braceR) && !_base.state.error) { + if (_index.match.call(void 0, _types.TokenType._import)) { + _index.next.call(void 0, ); + _statement.parseImport.call(void 0, ); + } else { + _util.unexpected.call(void 0, ); + } + } + _util.expect.call(void 0, _types.TokenType.braceR); +} + +function flowParseDeclareExportDeclaration() { + _util.expect.call(void 0, _types.TokenType._export); + + if (_index.eat.call(void 0, _types.TokenType._default)) { + if (_index.match.call(void 0, _types.TokenType._function) || _index.match.call(void 0, _types.TokenType._class)) { + // declare export default class ... + // declare export default function ... + flowParseDeclare(); + } else { + // declare export default [type]; + flowParseType(); + _util.semicolon.call(void 0, ); + } + } else if ( + _index.match.call(void 0, _types.TokenType._var) || // declare export var ... + _index.match.call(void 0, _types.TokenType._function) || // declare export function ... + _index.match.call(void 0, _types.TokenType._class) || // declare export class ... + _util.isContextual.call(void 0, _keywords.ContextualKeyword._opaque) // declare export opaque .. + ) { + flowParseDeclare(); + } else if ( + _index.match.call(void 0, _types.TokenType.star) || // declare export * from '' + _index.match.call(void 0, _types.TokenType.braceL) || // declare export {} ... + _util.isContextual.call(void 0, _keywords.ContextualKeyword._interface) || // declare export interface ... + _util.isContextual.call(void 0, _keywords.ContextualKeyword._type) || // declare export type ... + _util.isContextual.call(void 0, _keywords.ContextualKeyword._opaque) // declare export opaque type ... + ) { + _statement.parseExport.call(void 0, ); + } else { + _util.unexpected.call(void 0, ); + } +} + +function flowParseDeclareModuleExports() { + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._exports); + flowParseTypeAnnotation(); + _util.semicolon.call(void 0, ); +} + +function flowParseDeclareTypeAlias() { + _index.next.call(void 0, ); + flowParseTypeAlias(); +} + +function flowParseDeclareOpaqueType() { + _index.next.call(void 0, ); + flowParseOpaqueType(true); +} + +function flowParseDeclareInterface() { + _index.next.call(void 0, ); + flowParseInterfaceish(); +} + +// Interfaces + +function flowParseInterfaceish(isClass = false) { + flowParseRestrictedIdentifier(); + + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseTypeParameterDeclaration(); + } + + if (_index.eat.call(void 0, _types.TokenType._extends)) { + do { + flowParseInterfaceExtends(); + } while (!isClass && _index.eat.call(void 0, _types.TokenType.comma)); + } + + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._mixins)) { + _index.next.call(void 0, ); + do { + flowParseInterfaceExtends(); + } while (_index.eat.call(void 0, _types.TokenType.comma)); + } + + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._implements)) { + _index.next.call(void 0, ); + do { + flowParseInterfaceExtends(); + } while (_index.eat.call(void 0, _types.TokenType.comma)); + } + + flowParseObjectType(isClass, false, isClass); +} + +function flowParseInterfaceExtends() { + flowParseQualifiedTypeIdentifier(false); + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseTypeParameterInstantiation(); + } +} + +function flowParseInterface() { + flowParseInterfaceish(); +} + +function flowParseRestrictedIdentifier() { + _expression.parseIdentifier.call(void 0, ); +} + +function flowParseTypeAlias() { + flowParseRestrictedIdentifier(); + + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseTypeParameterDeclaration(); + } + + flowParseTypeInitialiser(_types.TokenType.eq); + _util.semicolon.call(void 0, ); +} + +function flowParseOpaqueType(declare) { + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._type); + flowParseRestrictedIdentifier(); + + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseTypeParameterDeclaration(); + } + + // Parse the supertype + if (_index.match.call(void 0, _types.TokenType.colon)) { + flowParseTypeInitialiser(_types.TokenType.colon); + } + + if (!declare) { + flowParseTypeInitialiser(_types.TokenType.eq); + } + _util.semicolon.call(void 0, ); +} + +function flowParseTypeParameter() { + flowParseVariance(); + flowParseTypeAnnotatableIdentifier(); + + if (_index.eat.call(void 0, _types.TokenType.eq)) { + flowParseType(); + } +} + + function flowParseTypeParameterDeclaration() { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + // istanbul ignore else: this condition is already checked at all call sites + if (_index.match.call(void 0, _types.TokenType.lessThan) || _index.match.call(void 0, _types.TokenType.typeParameterStart)) { + _index.next.call(void 0, ); + } else { + _util.unexpected.call(void 0, ); + } + + do { + flowParseTypeParameter(); + if (!_index.match.call(void 0, _types.TokenType.greaterThan)) { + _util.expect.call(void 0, _types.TokenType.comma); + } + } while (!_index.match.call(void 0, _types.TokenType.greaterThan) && !_base.state.error); + _util.expect.call(void 0, _types.TokenType.greaterThan); + _index.popTypeContext.call(void 0, oldIsType); +} exports.flowParseTypeParameterDeclaration = flowParseTypeParameterDeclaration; + +function flowParseTypeParameterInstantiation() { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _util.expect.call(void 0, _types.TokenType.lessThan); + while (!_index.match.call(void 0, _types.TokenType.greaterThan) && !_base.state.error) { + flowParseType(); + if (!_index.match.call(void 0, _types.TokenType.greaterThan)) { + _util.expect.call(void 0, _types.TokenType.comma); + } + } + _util.expect.call(void 0, _types.TokenType.greaterThan); + _index.popTypeContext.call(void 0, oldIsType); +} + +function flowParseInterfaceType() { + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._interface); + if (_index.eat.call(void 0, _types.TokenType._extends)) { + do { + flowParseInterfaceExtends(); + } while (_index.eat.call(void 0, _types.TokenType.comma)); + } + flowParseObjectType(false, false, false); +} + +function flowParseObjectPropertyKey() { + if (_index.match.call(void 0, _types.TokenType.num) || _index.match.call(void 0, _types.TokenType.string)) { + _expression.parseExprAtom.call(void 0, ); + } else { + _expression.parseIdentifier.call(void 0, ); + } +} + +function flowParseObjectTypeIndexer() { + // Note: bracketL has already been consumed + if (_index.lookaheadType.call(void 0, ) === _types.TokenType.colon) { + flowParseObjectPropertyKey(); + flowParseTypeInitialiser(); + } else { + flowParseType(); + } + _util.expect.call(void 0, _types.TokenType.bracketR); + flowParseTypeInitialiser(); +} + +function flowParseObjectTypeInternalSlot() { + // Note: both bracketL have already been consumed + flowParseObjectPropertyKey(); + _util.expect.call(void 0, _types.TokenType.bracketR); + _util.expect.call(void 0, _types.TokenType.bracketR); + if (_index.match.call(void 0, _types.TokenType.lessThan) || _index.match.call(void 0, _types.TokenType.parenL)) { + flowParseObjectTypeMethodish(); + } else { + _index.eat.call(void 0, _types.TokenType.question); + flowParseTypeInitialiser(); + } +} + +function flowParseObjectTypeMethodish() { + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseTypeParameterDeclaration(); + } + + _util.expect.call(void 0, _types.TokenType.parenL); + while (!_index.match.call(void 0, _types.TokenType.parenR) && !_index.match.call(void 0, _types.TokenType.ellipsis) && !_base.state.error) { + flowParseFunctionTypeParam(); + if (!_index.match.call(void 0, _types.TokenType.parenR)) { + _util.expect.call(void 0, _types.TokenType.comma); + } + } + + if (_index.eat.call(void 0, _types.TokenType.ellipsis)) { + flowParseFunctionTypeParam(); + } + _util.expect.call(void 0, _types.TokenType.parenR); + flowParseTypeInitialiser(); +} + +function flowParseObjectTypeCallProperty() { + flowParseObjectTypeMethodish(); +} + +function flowParseObjectType(allowStatic, allowExact, allowProto) { + let endDelim; + if (allowExact && _index.match.call(void 0, _types.TokenType.braceBarL)) { + _util.expect.call(void 0, _types.TokenType.braceBarL); + endDelim = _types.TokenType.braceBarR; + } else { + _util.expect.call(void 0, _types.TokenType.braceL); + endDelim = _types.TokenType.braceR; + } + + while (!_index.match.call(void 0, endDelim) && !_base.state.error) { + if (allowProto && _util.isContextual.call(void 0, _keywords.ContextualKeyword._proto)) { + const lookahead = _index.lookaheadType.call(void 0, ); + if (lookahead !== _types.TokenType.colon && lookahead !== _types.TokenType.question) { + _index.next.call(void 0, ); + allowStatic = false; + } + } + if (allowStatic && _util.isContextual.call(void 0, _keywords.ContextualKeyword._static)) { + const lookahead = _index.lookaheadType.call(void 0, ); + if (lookahead !== _types.TokenType.colon && lookahead !== _types.TokenType.question) { + _index.next.call(void 0, ); + } + } + + flowParseVariance(); + + if (_index.eat.call(void 0, _types.TokenType.bracketL)) { + if (_index.eat.call(void 0, _types.TokenType.bracketL)) { + flowParseObjectTypeInternalSlot(); + } else { + flowParseObjectTypeIndexer(); + } + } else if (_index.match.call(void 0, _types.TokenType.parenL) || _index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseObjectTypeCallProperty(); + } else { + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._get) || _util.isContextual.call(void 0, _keywords.ContextualKeyword._set)) { + const lookahead = _index.lookaheadType.call(void 0, ); + if (lookahead === _types.TokenType.name || lookahead === _types.TokenType.string || lookahead === _types.TokenType.num) { + _index.next.call(void 0, ); + } + } + + flowParseObjectTypeProperty(); + } + + flowObjectTypeSemicolon(); + } + + _util.expect.call(void 0, endDelim); +} + +function flowParseObjectTypeProperty() { + if (_index.match.call(void 0, _types.TokenType.ellipsis)) { + _util.expect.call(void 0, _types.TokenType.ellipsis); + if (!_index.eat.call(void 0, _types.TokenType.comma)) { + _index.eat.call(void 0, _types.TokenType.semi); + } + // Explicit inexact object syntax. + if (_index.match.call(void 0, _types.TokenType.braceR)) { + return; + } + flowParseType(); + } else { + flowParseObjectPropertyKey(); + if (_index.match.call(void 0, _types.TokenType.lessThan) || _index.match.call(void 0, _types.TokenType.parenL)) { + // This is a method property + flowParseObjectTypeMethodish(); + } else { + _index.eat.call(void 0, _types.TokenType.question); + flowParseTypeInitialiser(); + } + } +} + +function flowObjectTypeSemicolon() { + if (!_index.eat.call(void 0, _types.TokenType.semi) && !_index.eat.call(void 0, _types.TokenType.comma) && !_index.match.call(void 0, _types.TokenType.braceR) && !_index.match.call(void 0, _types.TokenType.braceBarR)) { + _util.unexpected.call(void 0, ); + } +} + +function flowParseQualifiedTypeIdentifier(initialIdAlreadyParsed) { + if (!initialIdAlreadyParsed) { + _expression.parseIdentifier.call(void 0, ); + } + while (_index.eat.call(void 0, _types.TokenType.dot)) { + _expression.parseIdentifier.call(void 0, ); + } +} + +function flowParseGenericType() { + flowParseQualifiedTypeIdentifier(true); + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseTypeParameterInstantiation(); + } +} + +function flowParseTypeofType() { + _util.expect.call(void 0, _types.TokenType._typeof); + flowParsePrimaryType(); +} + +function flowParseTupleType() { + _util.expect.call(void 0, _types.TokenType.bracketL); + // We allow trailing commas + while (_base.state.pos < _base.input.length && !_index.match.call(void 0, _types.TokenType.bracketR)) { + flowParseType(); + if (_index.match.call(void 0, _types.TokenType.bracketR)) { + break; + } + _util.expect.call(void 0, _types.TokenType.comma); + } + _util.expect.call(void 0, _types.TokenType.bracketR); +} + +function flowParseFunctionTypeParam() { + const lookahead = _index.lookaheadType.call(void 0, ); + if (lookahead === _types.TokenType.colon || lookahead === _types.TokenType.question) { + _expression.parseIdentifier.call(void 0, ); + _index.eat.call(void 0, _types.TokenType.question); + flowParseTypeInitialiser(); + } else { + flowParseType(); + } +} + +function flowParseFunctionTypeParams() { + while (!_index.match.call(void 0, _types.TokenType.parenR) && !_index.match.call(void 0, _types.TokenType.ellipsis) && !_base.state.error) { + flowParseFunctionTypeParam(); + if (!_index.match.call(void 0, _types.TokenType.parenR)) { + _util.expect.call(void 0, _types.TokenType.comma); + } + } + if (_index.eat.call(void 0, _types.TokenType.ellipsis)) { + flowParseFunctionTypeParam(); + } +} + +// The parsing of types roughly parallels the parsing of expressions, and +// primary types are kind of like primary expressions...they're the +// primitives with which other types are constructed. +function flowParsePrimaryType() { + let isGroupedType = false; + const oldNoAnonFunctionType = _base.state.noAnonFunctionType; + + switch (_base.state.type) { + case _types.TokenType.name: { + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._interface)) { + flowParseInterfaceType(); + return; + } + _expression.parseIdentifier.call(void 0, ); + flowParseGenericType(); + return; + } + + case _types.TokenType.braceL: + flowParseObjectType(false, false, false); + return; + + case _types.TokenType.braceBarL: + flowParseObjectType(false, true, false); + return; + + case _types.TokenType.bracketL: + flowParseTupleType(); + return; + + case _types.TokenType.lessThan: + flowParseTypeParameterDeclaration(); + _util.expect.call(void 0, _types.TokenType.parenL); + flowParseFunctionTypeParams(); + _util.expect.call(void 0, _types.TokenType.parenR); + _util.expect.call(void 0, _types.TokenType.arrow); + flowParseType(); + return; + + case _types.TokenType.parenL: + _index.next.call(void 0, ); + + // Check to see if this is actually a grouped type + if (!_index.match.call(void 0, _types.TokenType.parenR) && !_index.match.call(void 0, _types.TokenType.ellipsis)) { + if (_index.match.call(void 0, _types.TokenType.name)) { + const token = _index.lookaheadType.call(void 0, ); + isGroupedType = token !== _types.TokenType.question && token !== _types.TokenType.colon; + } else { + isGroupedType = true; + } + } + + if (isGroupedType) { + _base.state.noAnonFunctionType = false; + flowParseType(); + _base.state.noAnonFunctionType = oldNoAnonFunctionType; + + // A `,` or a `) =>` means this is an anonymous function type + if ( + _base.state.noAnonFunctionType || + !(_index.match.call(void 0, _types.TokenType.comma) || (_index.match.call(void 0, _types.TokenType.parenR) && _index.lookaheadType.call(void 0, ) === _types.TokenType.arrow)) + ) { + _util.expect.call(void 0, _types.TokenType.parenR); + return; + } else { + // Eat a comma if there is one + _index.eat.call(void 0, _types.TokenType.comma); + } + } + + flowParseFunctionTypeParams(); + + _util.expect.call(void 0, _types.TokenType.parenR); + _util.expect.call(void 0, _types.TokenType.arrow); + flowParseType(); + return; + + case _types.TokenType.minus: + _index.next.call(void 0, ); + _expression.parseLiteral.call(void 0, ); + return; + + case _types.TokenType.string: + case _types.TokenType.num: + case _types.TokenType._true: + case _types.TokenType._false: + case _types.TokenType._null: + case _types.TokenType._this: + case _types.TokenType._void: + case _types.TokenType.star: + _index.next.call(void 0, ); + return; + + default: + if (_base.state.type === _types.TokenType._typeof) { + flowParseTypeofType(); + return; + } else if (_base.state.type & _types.TokenType.IS_KEYWORD) { + _index.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType.name; + return; + } + } + + _util.unexpected.call(void 0, ); +} + +function flowParsePostfixType() { + flowParsePrimaryType(); + while (!_util.canInsertSemicolon.call(void 0, ) && (_index.match.call(void 0, _types.TokenType.bracketL) || _index.match.call(void 0, _types.TokenType.questionDot))) { + _index.eat.call(void 0, _types.TokenType.questionDot); + _util.expect.call(void 0, _types.TokenType.bracketL); + if (_index.eat.call(void 0, _types.TokenType.bracketR)) { + // Array type + } else { + // Indexed access type + flowParseType(); + _util.expect.call(void 0, _types.TokenType.bracketR); + } + } +} + +function flowParsePrefixType() { + if (_index.eat.call(void 0, _types.TokenType.question)) { + flowParsePrefixType(); + } else { + flowParsePostfixType(); + } +} + +function flowParseAnonFunctionWithoutParens() { + flowParsePrefixType(); + if (!_base.state.noAnonFunctionType && _index.eat.call(void 0, _types.TokenType.arrow)) { + flowParseType(); + } +} + +function flowParseIntersectionType() { + _index.eat.call(void 0, _types.TokenType.bitwiseAND); + flowParseAnonFunctionWithoutParens(); + while (_index.eat.call(void 0, _types.TokenType.bitwiseAND)) { + flowParseAnonFunctionWithoutParens(); + } +} + +function flowParseUnionType() { + _index.eat.call(void 0, _types.TokenType.bitwiseOR); + flowParseIntersectionType(); + while (_index.eat.call(void 0, _types.TokenType.bitwiseOR)) { + flowParseIntersectionType(); + } +} + +function flowParseType() { + flowParseUnionType(); +} + + function flowParseTypeAnnotation() { + flowParseTypeInitialiser(); +} exports.flowParseTypeAnnotation = flowParseTypeAnnotation; + +function flowParseTypeAnnotatableIdentifier() { + _expression.parseIdentifier.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.colon)) { + flowParseTypeAnnotation(); + } +} + + function flowParseVariance() { + if (_index.match.call(void 0, _types.TokenType.plus) || _index.match.call(void 0, _types.TokenType.minus)) { + _index.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].isType = true; + } +} exports.flowParseVariance = flowParseVariance; + +// ================================== +// Overrides +// ================================== + + function flowParseFunctionBodyAndFinish(funcContextId) { + // For arrow functions, `parseArrow` handles the return type itself. + if (_index.match.call(void 0, _types.TokenType.colon)) { + flowParseTypeAndPredicateInitialiser(); + } + + _expression.parseFunctionBody.call(void 0, false, funcContextId); +} exports.flowParseFunctionBodyAndFinish = flowParseFunctionBodyAndFinish; + + function flowParseSubscript( + startTokenIndex, + noCalls, + stopState, +) { + if (_index.match.call(void 0, _types.TokenType.questionDot) && _index.lookaheadType.call(void 0, ) === _types.TokenType.lessThan) { + if (noCalls) { + stopState.stop = true; + return; + } + _index.next.call(void 0, ); + flowParseTypeParameterInstantiation(); + _util.expect.call(void 0, _types.TokenType.parenL); + _expression.parseCallExpressionArguments.call(void 0, ); + return; + } else if (!noCalls && _index.match.call(void 0, _types.TokenType.lessThan)) { + const snapshot = _base.state.snapshot(); + flowParseTypeParameterInstantiation(); + _util.expect.call(void 0, _types.TokenType.parenL); + _expression.parseCallExpressionArguments.call(void 0, ); + if (_base.state.error) { + _base.state.restoreFromSnapshot(snapshot); + } else { + return; + } + } + _expression.baseParseSubscript.call(void 0, startTokenIndex, noCalls, stopState); +} exports.flowParseSubscript = flowParseSubscript; + + function flowStartParseNewArguments() { + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + const snapshot = _base.state.snapshot(); + flowParseTypeParameterInstantiation(); + if (_base.state.error) { + _base.state.restoreFromSnapshot(snapshot); + } + } +} exports.flowStartParseNewArguments = flowStartParseNewArguments; + +// interfaces + function flowTryParseStatement() { + if (_index.match.call(void 0, _types.TokenType.name) && _base.state.contextualKeyword === _keywords.ContextualKeyword._interface) { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _index.next.call(void 0, ); + flowParseInterface(); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } else if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._enum)) { + flowParseEnumDeclaration(); + return true; + } + return false; +} exports.flowTryParseStatement = flowTryParseStatement; + + function flowTryParseExportDefaultExpression() { + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._enum)) { + flowParseEnumDeclaration(); + return true; + } + return false; +} exports.flowTryParseExportDefaultExpression = flowTryParseExportDefaultExpression; + +// declares, interfaces and type aliases + function flowParseIdentifierStatement(contextualKeyword) { + if (contextualKeyword === _keywords.ContextualKeyword._declare) { + if ( + _index.match.call(void 0, _types.TokenType._class) || + _index.match.call(void 0, _types.TokenType.name) || + _index.match.call(void 0, _types.TokenType._function) || + _index.match.call(void 0, _types.TokenType._var) || + _index.match.call(void 0, _types.TokenType._export) + ) { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + flowParseDeclare(); + _index.popTypeContext.call(void 0, oldIsType); + } + } else if (_index.match.call(void 0, _types.TokenType.name)) { + if (contextualKeyword === _keywords.ContextualKeyword._interface) { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + flowParseInterface(); + _index.popTypeContext.call(void 0, oldIsType); + } else if (contextualKeyword === _keywords.ContextualKeyword._type) { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + flowParseTypeAlias(); + _index.popTypeContext.call(void 0, oldIsType); + } else if (contextualKeyword === _keywords.ContextualKeyword._opaque) { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + flowParseOpaqueType(false); + _index.popTypeContext.call(void 0, oldIsType); + } + } + _util.semicolon.call(void 0, ); +} exports.flowParseIdentifierStatement = flowParseIdentifierStatement; + +// export type + function flowShouldParseExportDeclaration() { + return ( + _util.isContextual.call(void 0, _keywords.ContextualKeyword._type) || + _util.isContextual.call(void 0, _keywords.ContextualKeyword._interface) || + _util.isContextual.call(void 0, _keywords.ContextualKeyword._opaque) || + _util.isContextual.call(void 0, _keywords.ContextualKeyword._enum) + ); +} exports.flowShouldParseExportDeclaration = flowShouldParseExportDeclaration; + + function flowShouldDisallowExportDefaultSpecifier() { + return ( + _index.match.call(void 0, _types.TokenType.name) && + (_base.state.contextualKeyword === _keywords.ContextualKeyword._type || + _base.state.contextualKeyword === _keywords.ContextualKeyword._interface || + _base.state.contextualKeyword === _keywords.ContextualKeyword._opaque || + _base.state.contextualKeyword === _keywords.ContextualKeyword._enum) + ); +} exports.flowShouldDisallowExportDefaultSpecifier = flowShouldDisallowExportDefaultSpecifier; + + function flowParseExportDeclaration() { + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._type)) { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + _index.next.call(void 0, ); + + if (_index.match.call(void 0, _types.TokenType.braceL)) { + // export type { foo, bar }; + _statement.parseExportSpecifiers.call(void 0, ); + _statement.parseExportFrom.call(void 0, ); + } else { + // export type Foo = Bar; + flowParseTypeAlias(); + } + _index.popTypeContext.call(void 0, oldIsType); + } else if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._opaque)) { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + _index.next.call(void 0, ); + // export opaque type Foo = Bar; + flowParseOpaqueType(false); + _index.popTypeContext.call(void 0, oldIsType); + } else if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._interface)) { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + _index.next.call(void 0, ); + flowParseInterface(); + _index.popTypeContext.call(void 0, oldIsType); + } else { + _statement.parseStatement.call(void 0, true); + } +} exports.flowParseExportDeclaration = flowParseExportDeclaration; + + function flowShouldParseExportStar() { + return _index.match.call(void 0, _types.TokenType.star) || (_util.isContextual.call(void 0, _keywords.ContextualKeyword._type) && _index.lookaheadType.call(void 0, ) === _types.TokenType.star); +} exports.flowShouldParseExportStar = flowShouldParseExportStar; + + function flowParseExportStar() { + if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._type)) { + const oldIsType = _index.pushTypeContext.call(void 0, 2); + _statement.baseParseExportStar.call(void 0, ); + _index.popTypeContext.call(void 0, oldIsType); + } else { + _statement.baseParseExportStar.call(void 0, ); + } +} exports.flowParseExportStar = flowParseExportStar; + +// parse a the super class type parameters and implements + function flowAfterParseClassSuper(hasSuper) { + if (hasSuper && _index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseTypeParameterInstantiation(); + } + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._implements)) { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _index.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._implements; + do { + flowParseRestrictedIdentifier(); + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseTypeParameterInstantiation(); + } + } while (_index.eat.call(void 0, _types.TokenType.comma)); + _index.popTypeContext.call(void 0, oldIsType); + } +} exports.flowAfterParseClassSuper = flowAfterParseClassSuper; + +// parse type parameters for object method shorthand + function flowStartParseObjPropValue() { + // method shorthand + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + flowParseTypeParameterDeclaration(); + if (!_index.match.call(void 0, _types.TokenType.parenL)) _util.unexpected.call(void 0, ); + } +} exports.flowStartParseObjPropValue = flowStartParseObjPropValue; + + function flowParseAssignableListItemTypes() { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _index.eat.call(void 0, _types.TokenType.question); + if (_index.match.call(void 0, _types.TokenType.colon)) { + flowParseTypeAnnotation(); + } + _index.popTypeContext.call(void 0, oldIsType); +} exports.flowParseAssignableListItemTypes = flowParseAssignableListItemTypes; + +// parse typeof and type imports + function flowStartParseImportSpecifiers() { + if (_index.match.call(void 0, _types.TokenType._typeof) || _util.isContextual.call(void 0, _keywords.ContextualKeyword._type)) { + const lh = _index.lookaheadTypeAndKeyword.call(void 0, ); + if (isMaybeDefaultImport(lh) || lh.type === _types.TokenType.braceL || lh.type === _types.TokenType.star) { + _index.next.call(void 0, ); + } + } +} exports.flowStartParseImportSpecifiers = flowStartParseImportSpecifiers; + +// parse import-type/typeof shorthand + function flowParseImportSpecifier() { + const isTypeKeyword = + _base.state.contextualKeyword === _keywords.ContextualKeyword._type || _base.state.type === _types.TokenType._typeof; + if (isTypeKeyword) { + _index.next.call(void 0, ); + } else { + _expression.parseIdentifier.call(void 0, ); + } + + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._as) && !_util.isLookaheadContextual.call(void 0, _keywords.ContextualKeyword._as)) { + _expression.parseIdentifier.call(void 0, ); + if (isTypeKeyword && !_index.match.call(void 0, _types.TokenType.name) && !(_base.state.type & _types.TokenType.IS_KEYWORD)) { + // `import {type as ,` or `import {type as }` + } else { + // `import {type as foo` + _expression.parseIdentifier.call(void 0, ); + } + } else { + if (isTypeKeyword && (_index.match.call(void 0, _types.TokenType.name) || !!(_base.state.type & _types.TokenType.IS_KEYWORD))) { + // `import {type foo` + _expression.parseIdentifier.call(void 0, ); + } + if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._as)) { + _expression.parseIdentifier.call(void 0, ); + } + } +} exports.flowParseImportSpecifier = flowParseImportSpecifier; + +// parse function type parameters - function foo() {} + function flowStartParseFunctionParams() { + // Originally this checked if the method is a getter/setter, but if it was, we'd crash soon + // anyway, so don't try to propagate that information. + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + flowParseTypeParameterDeclaration(); + _index.popTypeContext.call(void 0, oldIsType); + } +} exports.flowStartParseFunctionParams = flowStartParseFunctionParams; + +// parse flow type annotations on variable declarator heads - let foo: string = bar + function flowAfterParseVarHead() { + if (_index.match.call(void 0, _types.TokenType.colon)) { + flowParseTypeAnnotation(); + } +} exports.flowAfterParseVarHead = flowAfterParseVarHead; + +// parse the return type of an async arrow function - let foo = (async (): number => {}); + function flowStartParseAsyncArrowFromCallExpression() { + if (_index.match.call(void 0, _types.TokenType.colon)) { + const oldNoAnonFunctionType = _base.state.noAnonFunctionType; + _base.state.noAnonFunctionType = true; + flowParseTypeAnnotation(); + _base.state.noAnonFunctionType = oldNoAnonFunctionType; + } +} exports.flowStartParseAsyncArrowFromCallExpression = flowStartParseAsyncArrowFromCallExpression; + +// We need to support type parameter declarations for arrow functions. This +// is tricky. There are three situations we need to handle +// +// 1. This is either JSX or an arrow function. We'll try JSX first. If that +// fails, we'll try an arrow function. If that fails, we'll throw the JSX +// error. +// 2. This is an arrow function. We'll parse the type parameter declaration, +// parse the rest, make sure the rest is an arrow function, and go from +// there +// 3. This is neither. Just call the super method + function flowParseMaybeAssign(noIn, isWithinParens) { + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + const snapshot = _base.state.snapshot(); + let wasArrow = _expression.baseParseMaybeAssign.call(void 0, noIn, isWithinParens); + if (_base.state.error) { + _base.state.restoreFromSnapshot(snapshot); + _base.state.type = _types.TokenType.typeParameterStart; + } else { + return wasArrow; + } + + const oldIsType = _index.pushTypeContext.call(void 0, 0); + flowParseTypeParameterDeclaration(); + _index.popTypeContext.call(void 0, oldIsType); + wasArrow = _expression.baseParseMaybeAssign.call(void 0, noIn, isWithinParens); + if (wasArrow) { + return true; + } + _util.unexpected.call(void 0, ); + } + + return _expression.baseParseMaybeAssign.call(void 0, noIn, isWithinParens); +} exports.flowParseMaybeAssign = flowParseMaybeAssign; + +// handle return types for arrow functions + function flowParseArrow() { + if (_index.match.call(void 0, _types.TokenType.colon)) { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + const snapshot = _base.state.snapshot(); + + const oldNoAnonFunctionType = _base.state.noAnonFunctionType; + _base.state.noAnonFunctionType = true; + flowParseTypeAndPredicateInitialiser(); + _base.state.noAnonFunctionType = oldNoAnonFunctionType; + + if (_util.canInsertSemicolon.call(void 0, )) _util.unexpected.call(void 0, ); + if (!_index.match.call(void 0, _types.TokenType.arrow)) _util.unexpected.call(void 0, ); + + if (_base.state.error) { + _base.state.restoreFromSnapshot(snapshot); + } + _index.popTypeContext.call(void 0, oldIsType); + } + return _index.eat.call(void 0, _types.TokenType.arrow); +} exports.flowParseArrow = flowParseArrow; + + function flowParseSubscripts(startTokenIndex, noCalls = false) { + if ( + _base.state.tokens[_base.state.tokens.length - 1].contextualKeyword === _keywords.ContextualKeyword._async && + _index.match.call(void 0, _types.TokenType.lessThan) + ) { + const snapshot = _base.state.snapshot(); + const wasArrow = parseAsyncArrowWithTypeParameters(); + if (wasArrow && !_base.state.error) { + return; + } + _base.state.restoreFromSnapshot(snapshot); + } + + _expression.baseParseSubscripts.call(void 0, startTokenIndex, noCalls); +} exports.flowParseSubscripts = flowParseSubscripts; + +// Returns true if there was an arrow function here. +function parseAsyncArrowWithTypeParameters() { + _base.state.scopeDepth++; + const startTokenIndex = _base.state.tokens.length; + _statement.parseFunctionParams.call(void 0, ); + if (!_expression.parseArrow.call(void 0, )) { + return false; + } + _expression.parseArrowExpression.call(void 0, startTokenIndex); + return true; +} + +function flowParseEnumDeclaration() { + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._enum); + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._enum; + _expression.parseIdentifier.call(void 0, ); + flowParseEnumBody(); +} + +function flowParseEnumBody() { + if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._of)) { + _index.next.call(void 0, ); + } + _util.expect.call(void 0, _types.TokenType.braceL); + flowParseEnumMembers(); + _util.expect.call(void 0, _types.TokenType.braceR); +} + +function flowParseEnumMembers() { + while (!_index.match.call(void 0, _types.TokenType.braceR) && !_base.state.error) { + if (_index.eat.call(void 0, _types.TokenType.ellipsis)) { + break; + } + flowParseEnumMember(); + if (!_index.match.call(void 0, _types.TokenType.braceR)) { + _util.expect.call(void 0, _types.TokenType.comma); + } + } +} + +function flowParseEnumMember() { + _expression.parseIdentifier.call(void 0, ); + if (_index.eat.call(void 0, _types.TokenType.eq)) { + // Flow enum values are always just one token (a string, number, or boolean literal). + _index.next.call(void 0, ); + } +} diff --git a/node_modules/sucrase/dist/parser/plugins/jsx/index.js b/node_modules/sucrase/dist/parser/plugins/jsx/index.js new file mode 100644 index 00000000..41797de5 --- /dev/null +++ b/node_modules/sucrase/dist/parser/plugins/jsx/index.js @@ -0,0 +1,367 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); + + + + + + + + + +var _index = require('../../tokenizer/index'); +var _types = require('../../tokenizer/types'); +var _base = require('../../traverser/base'); +var _expression = require('../../traverser/expression'); +var _util = require('../../traverser/util'); +var _charcodes = require('../../util/charcodes'); +var _identifier = require('../../util/identifier'); +var _typescript = require('../typescript'); + +/** + * Read token with JSX contents. + * + * In addition to detecting jsxTagStart and also regular tokens that might be + * part of an expression, this code detects the start and end of text ranges + * within JSX children. In order to properly count the number of children, we + * distinguish jsxText from jsxEmptyText, which is a text range that simplifies + * to the empty string after JSX whitespace trimming. + * + * It turns out that a JSX text range will simplify to the empty string if and + * only if both of these conditions hold: + * - The range consists entirely of whitespace characters (only counting space, + * tab, \r, and \n). + * - The range has at least one newline. + * This can be proven by analyzing any implementation of whitespace trimming, + * e.g. formatJSXTextLiteral in Sucrase or cleanJSXElementLiteralChild in Babel. + */ +function jsxReadToken() { + let sawNewline = false; + let sawNonWhitespace = false; + while (true) { + if (_base.state.pos >= _base.input.length) { + _util.unexpected.call(void 0, "Unterminated JSX contents"); + return; + } + + const ch = _base.input.charCodeAt(_base.state.pos); + if (ch === _charcodes.charCodes.lessThan || ch === _charcodes.charCodes.leftCurlyBrace) { + if (_base.state.pos === _base.state.start) { + if (ch === _charcodes.charCodes.lessThan) { + _base.state.pos++; + _index.finishToken.call(void 0, _types.TokenType.jsxTagStart); + return; + } + _index.getTokenFromCode.call(void 0, ch); + return; + } + if (sawNewline && !sawNonWhitespace) { + _index.finishToken.call(void 0, _types.TokenType.jsxEmptyText); + } else { + _index.finishToken.call(void 0, _types.TokenType.jsxText); + } + return; + } + + // This is part of JSX text. + if (ch === _charcodes.charCodes.lineFeed) { + sawNewline = true; + } else if (ch !== _charcodes.charCodes.space && ch !== _charcodes.charCodes.carriageReturn && ch !== _charcodes.charCodes.tab) { + sawNonWhitespace = true; + } + _base.state.pos++; + } +} + +function jsxReadString(quote) { + _base.state.pos++; + for (;;) { + if (_base.state.pos >= _base.input.length) { + _util.unexpected.call(void 0, "Unterminated string constant"); + return; + } + + const ch = _base.input.charCodeAt(_base.state.pos); + if (ch === quote) { + _base.state.pos++; + break; + } + _base.state.pos++; + } + _index.finishToken.call(void 0, _types.TokenType.string); +} + +// Read a JSX identifier (valid tag or attribute name). +// +// Optimized version since JSX identifiers can't contain +// escape characters and so can be read as single slice. +// Also assumes that first character was already checked +// by isIdentifierStart in readToken. + +function jsxReadWord() { + let ch; + do { + if (_base.state.pos > _base.input.length) { + _util.unexpected.call(void 0, "Unexpectedly reached the end of input."); + return; + } + ch = _base.input.charCodeAt(++_base.state.pos); + } while (_identifier.IS_IDENTIFIER_CHAR[ch] || ch === _charcodes.charCodes.dash); + _index.finishToken.call(void 0, _types.TokenType.jsxName); +} + +// Parse next token as JSX identifier +function jsxParseIdentifier() { + nextJSXTagToken(); +} + +// Parse namespaced identifier. +function jsxParseNamespacedName(identifierRole) { + jsxParseIdentifier(); + if (!_index.eat.call(void 0, _types.TokenType.colon)) { + // Plain identifier, so this is an access. + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = identifierRole; + return; + } + // Process the second half of the namespaced name. + jsxParseIdentifier(); +} + +// Parses element name in any form - namespaced, member +// or single identifier. +function jsxParseElementName() { + const firstTokenIndex = _base.state.tokens.length; + jsxParseNamespacedName(_index.IdentifierRole.Access); + let hadDot = false; + while (_index.match.call(void 0, _types.TokenType.dot)) { + hadDot = true; + nextJSXTagToken(); + jsxParseIdentifier(); + } + // For tags like
    with a lowercase letter and no dots, the name is + // actually *not* an identifier access, since it's referring to a built-in + // tag name. Remove the identifier role in this case so that it's not + // accidentally transformed by the imports transform when preserving JSX. + if (!hadDot) { + const firstToken = _base.state.tokens[firstTokenIndex]; + const firstChar = _base.input.charCodeAt(firstToken.start); + if (firstChar >= _charcodes.charCodes.lowercaseA && firstChar <= _charcodes.charCodes.lowercaseZ) { + firstToken.identifierRole = null; + } + } +} + +// Parses any type of JSX attribute value. +function jsxParseAttributeValue() { + switch (_base.state.type) { + case _types.TokenType.braceL: + _index.next.call(void 0, ); + _expression.parseExpression.call(void 0, ); + nextJSXTagToken(); + return; + + case _types.TokenType.jsxTagStart: + jsxParseElement(); + nextJSXTagToken(); + return; + + case _types.TokenType.string: + nextJSXTagToken(); + return; + + default: + _util.unexpected.call(void 0, "JSX value should be either an expression or a quoted JSX text"); + } +} + +// Parse JSX spread child, after already processing the { +// Does not parse the closing } +function jsxParseSpreadChild() { + _util.expect.call(void 0, _types.TokenType.ellipsis); + _expression.parseExpression.call(void 0, ); +} + +// Parses JSX opening tag starting after "<". +// Returns true if the tag was self-closing. +// Does not parse the last token. +function jsxParseOpeningElement(initialTokenIndex) { + if (_index.match.call(void 0, _types.TokenType.jsxTagEnd)) { + // This is an open-fragment. + return false; + } + jsxParseElementName(); + if (_base.isTypeScriptEnabled) { + _typescript.tsTryParseJSXTypeArgument.call(void 0, ); + } + let hasSeenPropSpread = false; + while (!_index.match.call(void 0, _types.TokenType.slash) && !_index.match.call(void 0, _types.TokenType.jsxTagEnd) && !_base.state.error) { + if (_index.eat.call(void 0, _types.TokenType.braceL)) { + hasSeenPropSpread = true; + _util.expect.call(void 0, _types.TokenType.ellipsis); + _expression.parseMaybeAssign.call(void 0, ); + // } + nextJSXTagToken(); + continue; + } + if ( + hasSeenPropSpread && + _base.state.end - _base.state.start === 3 && + _base.input.charCodeAt(_base.state.start) === _charcodes.charCodes.lowercaseK && + _base.input.charCodeAt(_base.state.start + 1) === _charcodes.charCodes.lowercaseE && + _base.input.charCodeAt(_base.state.start + 2) === _charcodes.charCodes.lowercaseY + ) { + _base.state.tokens[initialTokenIndex].jsxRole = _index.JSXRole.KeyAfterPropSpread; + } + jsxParseNamespacedName(_index.IdentifierRole.ObjectKey); + if (_index.match.call(void 0, _types.TokenType.eq)) { + nextJSXTagToken(); + jsxParseAttributeValue(); + } + } + const isSelfClosing = _index.match.call(void 0, _types.TokenType.slash); + if (isSelfClosing) { + // / + nextJSXTagToken(); + } + return isSelfClosing; +} + +// Parses JSX closing tag starting after " 1) { + _base.state.tokens[initialTokenIndex].jsxRole = _index.JSXRole.StaticChildren; + } + } + return; + } + numExplicitChildren++; + jsxParseElementAt(); + nextJSXExprToken(); + break; + + case _types.TokenType.jsxText: + numExplicitChildren++; + nextJSXExprToken(); + break; + + case _types.TokenType.jsxEmptyText: + nextJSXExprToken(); + break; + + case _types.TokenType.braceL: + _index.next.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.ellipsis)) { + jsxParseSpreadChild(); + nextJSXExprToken(); + // Spread children are a mechanism to explicitly mark children as + // static, so count it as 2 children to satisfy the "more than one + // child" condition. + numExplicitChildren += 2; + } else { + // If we see {}, this is an empty pseudo-expression that doesn't + // count as a child. + if (!_index.match.call(void 0, _types.TokenType.braceR)) { + numExplicitChildren++; + _expression.parseExpression.call(void 0, ); + } + nextJSXExprToken(); + } + + break; + + // istanbul ignore next - should never happen + default: + _util.unexpected.call(void 0, ); + return; + } + } + } +} + +// Parses entire JSX element from current position. +// Does not parse the last token. + function jsxParseElement() { + nextJSXTagToken(); + jsxParseElementAt(); +} exports.jsxParseElement = jsxParseElement; + +// ================================== +// Overrides +// ================================== + + function nextJSXTagToken() { + _base.state.tokens.push(new (0, _index.Token)()); + _index.skipSpace.call(void 0, ); + _base.state.start = _base.state.pos; + const code = _base.input.charCodeAt(_base.state.pos); + + if (_identifier.IS_IDENTIFIER_START[code]) { + jsxReadWord(); + } else if (code === _charcodes.charCodes.quotationMark || code === _charcodes.charCodes.apostrophe) { + jsxReadString(code); + } else { + // The following tokens are just one character each. + ++_base.state.pos; + switch (code) { + case _charcodes.charCodes.greaterThan: + _index.finishToken.call(void 0, _types.TokenType.jsxTagEnd); + break; + case _charcodes.charCodes.lessThan: + _index.finishToken.call(void 0, _types.TokenType.jsxTagStart); + break; + case _charcodes.charCodes.slash: + _index.finishToken.call(void 0, _types.TokenType.slash); + break; + case _charcodes.charCodes.equalsTo: + _index.finishToken.call(void 0, _types.TokenType.eq); + break; + case _charcodes.charCodes.leftCurlyBrace: + _index.finishToken.call(void 0, _types.TokenType.braceL); + break; + case _charcodes.charCodes.dot: + _index.finishToken.call(void 0, _types.TokenType.dot); + break; + case _charcodes.charCodes.colon: + _index.finishToken.call(void 0, _types.TokenType.colon); + break; + default: + _util.unexpected.call(void 0, ); + } + } +} exports.nextJSXTagToken = nextJSXTagToken; + +function nextJSXExprToken() { + _base.state.tokens.push(new (0, _index.Token)()); + _base.state.start = _base.state.pos; + jsxReadToken(); +} diff --git a/node_modules/sucrase/dist/parser/plugins/jsx/xhtml.js b/node_modules/sucrase/dist/parser/plugins/jsx/xhtml.js new file mode 100644 index 00000000..d8e91c5f --- /dev/null +++ b/node_modules/sucrase/dist/parser/plugins/jsx/xhtml.js @@ -0,0 +1,256 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});// Use a Map rather than object to avoid unexpected __proto__ access. +exports. default = new Map([ + ["quot", "\u0022"], + ["amp", "&"], + ["apos", "\u0027"], + ["lt", "<"], + ["gt", ">"], + ["nbsp", "\u00A0"], + ["iexcl", "\u00A1"], + ["cent", "\u00A2"], + ["pound", "\u00A3"], + ["curren", "\u00A4"], + ["yen", "\u00A5"], + ["brvbar", "\u00A6"], + ["sect", "\u00A7"], + ["uml", "\u00A8"], + ["copy", "\u00A9"], + ["ordf", "\u00AA"], + ["laquo", "\u00AB"], + ["not", "\u00AC"], + ["shy", "\u00AD"], + ["reg", "\u00AE"], + ["macr", "\u00AF"], + ["deg", "\u00B0"], + ["plusmn", "\u00B1"], + ["sup2", "\u00B2"], + ["sup3", "\u00B3"], + ["acute", "\u00B4"], + ["micro", "\u00B5"], + ["para", "\u00B6"], + ["middot", "\u00B7"], + ["cedil", "\u00B8"], + ["sup1", "\u00B9"], + ["ordm", "\u00BA"], + ["raquo", "\u00BB"], + ["frac14", "\u00BC"], + ["frac12", "\u00BD"], + ["frac34", "\u00BE"], + ["iquest", "\u00BF"], + ["Agrave", "\u00C0"], + ["Aacute", "\u00C1"], + ["Acirc", "\u00C2"], + ["Atilde", "\u00C3"], + ["Auml", "\u00C4"], + ["Aring", "\u00C5"], + ["AElig", "\u00C6"], + ["Ccedil", "\u00C7"], + ["Egrave", "\u00C8"], + ["Eacute", "\u00C9"], + ["Ecirc", "\u00CA"], + ["Euml", "\u00CB"], + ["Igrave", "\u00CC"], + ["Iacute", "\u00CD"], + ["Icirc", "\u00CE"], + ["Iuml", "\u00CF"], + ["ETH", "\u00D0"], + ["Ntilde", "\u00D1"], + ["Ograve", "\u00D2"], + ["Oacute", "\u00D3"], + ["Ocirc", "\u00D4"], + ["Otilde", "\u00D5"], + ["Ouml", "\u00D6"], + ["times", "\u00D7"], + ["Oslash", "\u00D8"], + ["Ugrave", "\u00D9"], + ["Uacute", "\u00DA"], + ["Ucirc", "\u00DB"], + ["Uuml", "\u00DC"], + ["Yacute", "\u00DD"], + ["THORN", "\u00DE"], + ["szlig", "\u00DF"], + ["agrave", "\u00E0"], + ["aacute", "\u00E1"], + ["acirc", "\u00E2"], + ["atilde", "\u00E3"], + ["auml", "\u00E4"], + ["aring", "\u00E5"], + ["aelig", "\u00E6"], + ["ccedil", "\u00E7"], + ["egrave", "\u00E8"], + ["eacute", "\u00E9"], + ["ecirc", "\u00EA"], + ["euml", "\u00EB"], + ["igrave", "\u00EC"], + ["iacute", "\u00ED"], + ["icirc", "\u00EE"], + ["iuml", "\u00EF"], + ["eth", "\u00F0"], + ["ntilde", "\u00F1"], + ["ograve", "\u00F2"], + ["oacute", "\u00F3"], + ["ocirc", "\u00F4"], + ["otilde", "\u00F5"], + ["ouml", "\u00F6"], + ["divide", "\u00F7"], + ["oslash", "\u00F8"], + ["ugrave", "\u00F9"], + ["uacute", "\u00FA"], + ["ucirc", "\u00FB"], + ["uuml", "\u00FC"], + ["yacute", "\u00FD"], + ["thorn", "\u00FE"], + ["yuml", "\u00FF"], + ["OElig", "\u0152"], + ["oelig", "\u0153"], + ["Scaron", "\u0160"], + ["scaron", "\u0161"], + ["Yuml", "\u0178"], + ["fnof", "\u0192"], + ["circ", "\u02C6"], + ["tilde", "\u02DC"], + ["Alpha", "\u0391"], + ["Beta", "\u0392"], + ["Gamma", "\u0393"], + ["Delta", "\u0394"], + ["Epsilon", "\u0395"], + ["Zeta", "\u0396"], + ["Eta", "\u0397"], + ["Theta", "\u0398"], + ["Iota", "\u0399"], + ["Kappa", "\u039A"], + ["Lambda", "\u039B"], + ["Mu", "\u039C"], + ["Nu", "\u039D"], + ["Xi", "\u039E"], + ["Omicron", "\u039F"], + ["Pi", "\u03A0"], + ["Rho", "\u03A1"], + ["Sigma", "\u03A3"], + ["Tau", "\u03A4"], + ["Upsilon", "\u03A5"], + ["Phi", "\u03A6"], + ["Chi", "\u03A7"], + ["Psi", "\u03A8"], + ["Omega", "\u03A9"], + ["alpha", "\u03B1"], + ["beta", "\u03B2"], + ["gamma", "\u03B3"], + ["delta", "\u03B4"], + ["epsilon", "\u03B5"], + ["zeta", "\u03B6"], + ["eta", "\u03B7"], + ["theta", "\u03B8"], + ["iota", "\u03B9"], + ["kappa", "\u03BA"], + ["lambda", "\u03BB"], + ["mu", "\u03BC"], + ["nu", "\u03BD"], + ["xi", "\u03BE"], + ["omicron", "\u03BF"], + ["pi", "\u03C0"], + ["rho", "\u03C1"], + ["sigmaf", "\u03C2"], + ["sigma", "\u03C3"], + ["tau", "\u03C4"], + ["upsilon", "\u03C5"], + ["phi", "\u03C6"], + ["chi", "\u03C7"], + ["psi", "\u03C8"], + ["omega", "\u03C9"], + ["thetasym", "\u03D1"], + ["upsih", "\u03D2"], + ["piv", "\u03D6"], + ["ensp", "\u2002"], + ["emsp", "\u2003"], + ["thinsp", "\u2009"], + ["zwnj", "\u200C"], + ["zwj", "\u200D"], + ["lrm", "\u200E"], + ["rlm", "\u200F"], + ["ndash", "\u2013"], + ["mdash", "\u2014"], + ["lsquo", "\u2018"], + ["rsquo", "\u2019"], + ["sbquo", "\u201A"], + ["ldquo", "\u201C"], + ["rdquo", "\u201D"], + ["bdquo", "\u201E"], + ["dagger", "\u2020"], + ["Dagger", "\u2021"], + ["bull", "\u2022"], + ["hellip", "\u2026"], + ["permil", "\u2030"], + ["prime", "\u2032"], + ["Prime", "\u2033"], + ["lsaquo", "\u2039"], + ["rsaquo", "\u203A"], + ["oline", "\u203E"], + ["frasl", "\u2044"], + ["euro", "\u20AC"], + ["image", "\u2111"], + ["weierp", "\u2118"], + ["real", "\u211C"], + ["trade", "\u2122"], + ["alefsym", "\u2135"], + ["larr", "\u2190"], + ["uarr", "\u2191"], + ["rarr", "\u2192"], + ["darr", "\u2193"], + ["harr", "\u2194"], + ["crarr", "\u21B5"], + ["lArr", "\u21D0"], + ["uArr", "\u21D1"], + ["rArr", "\u21D2"], + ["dArr", "\u21D3"], + ["hArr", "\u21D4"], + ["forall", "\u2200"], + ["part", "\u2202"], + ["exist", "\u2203"], + ["empty", "\u2205"], + ["nabla", "\u2207"], + ["isin", "\u2208"], + ["notin", "\u2209"], + ["ni", "\u220B"], + ["prod", "\u220F"], + ["sum", "\u2211"], + ["minus", "\u2212"], + ["lowast", "\u2217"], + ["radic", "\u221A"], + ["prop", "\u221D"], + ["infin", "\u221E"], + ["ang", "\u2220"], + ["and", "\u2227"], + ["or", "\u2228"], + ["cap", "\u2229"], + ["cup", "\u222A"], + ["int", "\u222B"], + ["there4", "\u2234"], + ["sim", "\u223C"], + ["cong", "\u2245"], + ["asymp", "\u2248"], + ["ne", "\u2260"], + ["equiv", "\u2261"], + ["le", "\u2264"], + ["ge", "\u2265"], + ["sub", "\u2282"], + ["sup", "\u2283"], + ["nsub", "\u2284"], + ["sube", "\u2286"], + ["supe", "\u2287"], + ["oplus", "\u2295"], + ["otimes", "\u2297"], + ["perp", "\u22A5"], + ["sdot", "\u22C5"], + ["lceil", "\u2308"], + ["rceil", "\u2309"], + ["lfloor", "\u230A"], + ["rfloor", "\u230B"], + ["lang", "\u2329"], + ["rang", "\u232A"], + ["loz", "\u25CA"], + ["spades", "\u2660"], + ["clubs", "\u2663"], + ["hearts", "\u2665"], + ["diams", "\u2666"], +]); diff --git a/node_modules/sucrase/dist/parser/plugins/types.js b/node_modules/sucrase/dist/parser/plugins/types.js new file mode 100644 index 00000000..c892994e --- /dev/null +++ b/node_modules/sucrase/dist/parser/plugins/types.js @@ -0,0 +1,37 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _index = require('../tokenizer/index'); +var _types = require('../tokenizer/types'); +var _base = require('../traverser/base'); +var _expression = require('../traverser/expression'); +var _flow = require('./flow'); +var _typescript = require('./typescript'); + +/** + * Common parser code for TypeScript and Flow. + */ + +// An apparent conditional expression could actually be an optional parameter in an arrow function. + function typedParseConditional(noIn) { + // If we see ?:, this can't possibly be a valid conditional. typedParseParenItem will be called + // later to finish off the arrow parameter. We also need to handle bare ? tokens for optional + // parameters without type annotations, i.e. ?, and ?) . + if (_index.match.call(void 0, _types.TokenType.question)) { + const nextType = _index.lookaheadType.call(void 0, ); + if (nextType === _types.TokenType.colon || nextType === _types.TokenType.comma || nextType === _types.TokenType.parenR) { + return; + } + } + _expression.baseParseConditional.call(void 0, noIn); +} exports.typedParseConditional = typedParseConditional; + +// Note: These "type casts" are *not* valid TS expressions. +// But we parse them here and change them when completing the arrow function. + function typedParseParenItem() { + _index.eatTypeToken.call(void 0, _types.TokenType.question); + if (_index.match.call(void 0, _types.TokenType.colon)) { + if (_base.isTypeScriptEnabled) { + _typescript.tsParseTypeAnnotation.call(void 0, ); + } else if (_base.isFlowEnabled) { + _flow.flowParseTypeAnnotation.call(void 0, ); + } + } +} exports.typedParseParenItem = typedParseParenItem; diff --git a/node_modules/sucrase/dist/parser/plugins/typescript.js b/node_modules/sucrase/dist/parser/plugins/typescript.js new file mode 100644 index 00000000..d1ec6d3a --- /dev/null +++ b/node_modules/sucrase/dist/parser/plugins/typescript.js @@ -0,0 +1,1632 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); + + + + + + + + + + + +var _index = require('../tokenizer/index'); +var _keywords = require('../tokenizer/keywords'); +var _types = require('../tokenizer/types'); +var _base = require('../traverser/base'); + + + + + + + + + + + + + + + +var _expression = require('../traverser/expression'); +var _lval = require('../traverser/lval'); + + + + + + + + +var _statement = require('../traverser/statement'); + + + + + + + + + + + +var _util = require('../traverser/util'); +var _jsx = require('./jsx'); + +function tsIsIdentifier() { + // TODO: actually a bit more complex in TypeScript, but shouldn't matter. + // See https://github.com/Microsoft/TypeScript/issues/15008 + return _index.match.call(void 0, _types.TokenType.name); +} + +function isLiteralPropertyName() { + return ( + _index.match.call(void 0, _types.TokenType.name) || + Boolean(_base.state.type & _types.TokenType.IS_KEYWORD) || + _index.match.call(void 0, _types.TokenType.string) || + _index.match.call(void 0, _types.TokenType.num) || + _index.match.call(void 0, _types.TokenType.bigint) || + _index.match.call(void 0, _types.TokenType.decimal) + ); +} + +function tsNextTokenCanFollowModifier() { + // Note: TypeScript's implementation is much more complicated because + // more things are considered modifiers there. + // This implementation only handles modifiers not handled by babylon itself. And "static". + // TODO: Would be nice to avoid lookahead. Want a hasLineBreakUpNext() method... + const snapshot = _base.state.snapshot(); + + _index.next.call(void 0, ); + const canFollowModifier = + (_index.match.call(void 0, _types.TokenType.bracketL) || + _index.match.call(void 0, _types.TokenType.braceL) || + _index.match.call(void 0, _types.TokenType.star) || + _index.match.call(void 0, _types.TokenType.ellipsis) || + _index.match.call(void 0, _types.TokenType.hash) || + isLiteralPropertyName()) && + !_util.hasPrecedingLineBreak.call(void 0, ); + + if (canFollowModifier) { + return true; + } else { + _base.state.restoreFromSnapshot(snapshot); + return false; + } +} + + function tsParseModifiers(allowedModifiers) { + while (true) { + const modifier = tsParseModifier(allowedModifiers); + if (modifier === null) { + break; + } + } +} exports.tsParseModifiers = tsParseModifiers; + +/** Parses a modifier matching one the given modifier names. */ + function tsParseModifier( + allowedModifiers, +) { + if (!_index.match.call(void 0, _types.TokenType.name)) { + return null; + } + + const modifier = _base.state.contextualKeyword; + if (allowedModifiers.indexOf(modifier) !== -1 && tsNextTokenCanFollowModifier()) { + switch (modifier) { + case _keywords.ContextualKeyword._readonly: + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._readonly; + break; + case _keywords.ContextualKeyword._abstract: + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._abstract; + break; + case _keywords.ContextualKeyword._static: + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._static; + break; + case _keywords.ContextualKeyword._public: + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._public; + break; + case _keywords.ContextualKeyword._private: + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._private; + break; + case _keywords.ContextualKeyword._protected: + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._protected; + break; + case _keywords.ContextualKeyword._override: + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._override; + break; + case _keywords.ContextualKeyword._declare: + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._declare; + break; + default: + break; + } + return modifier; + } + return null; +} exports.tsParseModifier = tsParseModifier; + +function tsParseEntityName() { + _expression.parseIdentifier.call(void 0, ); + while (_index.eat.call(void 0, _types.TokenType.dot)) { + _expression.parseIdentifier.call(void 0, ); + } +} + +function tsParseTypeReference() { + tsParseEntityName(); + if (!_util.hasPrecedingLineBreak.call(void 0, ) && _index.match.call(void 0, _types.TokenType.lessThan)) { + tsParseTypeArguments(); + } +} + +function tsParseThisTypePredicate() { + _index.next.call(void 0, ); + tsParseTypeAnnotation(); +} + +function tsParseThisTypeNode() { + _index.next.call(void 0, ); +} + +function tsParseTypeQuery() { + _util.expect.call(void 0, _types.TokenType._typeof); + if (_index.match.call(void 0, _types.TokenType._import)) { + tsParseImportType(); + } else { + tsParseEntityName(); + } + if (!_util.hasPrecedingLineBreak.call(void 0, ) && _index.match.call(void 0, _types.TokenType.lessThan)) { + tsParseTypeArguments(); + } +} + +function tsParseImportType() { + _util.expect.call(void 0, _types.TokenType._import); + _util.expect.call(void 0, _types.TokenType.parenL); + _util.expect.call(void 0, _types.TokenType.string); + _util.expect.call(void 0, _types.TokenType.parenR); + if (_index.eat.call(void 0, _types.TokenType.dot)) { + tsParseEntityName(); + } + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + tsParseTypeArguments(); + } +} + +function tsParseTypeParameter() { + _index.eat.call(void 0, _types.TokenType._const); + const hadIn = _index.eat.call(void 0, _types.TokenType._in); + const hadOut = _util.eatContextual.call(void 0, _keywords.ContextualKeyword._out); + _index.eat.call(void 0, _types.TokenType._const); + if ((hadIn || hadOut) && !_index.match.call(void 0, _types.TokenType.name)) { + // The "in" or "out" keyword must have actually been the type parameter + // name, so set it as the name. + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType.name; + } else { + _expression.parseIdentifier.call(void 0, ); + } + + if (_index.eat.call(void 0, _types.TokenType._extends)) { + tsParseType(); + } + if (_index.eat.call(void 0, _types.TokenType.eq)) { + tsParseType(); + } +} + + function tsTryParseTypeParameters() { + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + tsParseTypeParameters(); + } +} exports.tsTryParseTypeParameters = tsTryParseTypeParameters; + +function tsParseTypeParameters() { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + if (_index.match.call(void 0, _types.TokenType.lessThan) || _index.match.call(void 0, _types.TokenType.typeParameterStart)) { + _index.next.call(void 0, ); + } else { + _util.unexpected.call(void 0, ); + } + + while (!_index.eat.call(void 0, _types.TokenType.greaterThan) && !_base.state.error) { + tsParseTypeParameter(); + _index.eat.call(void 0, _types.TokenType.comma); + } + _index.popTypeContext.call(void 0, oldIsType); +} + +// Note: In TypeScript implementation we must provide `yieldContext` and `awaitContext`, +// but here it's always false, because this is only used for types. +function tsFillSignature(returnToken) { + // Arrow fns *must* have return token (`=>`). Normal functions can omit it. + const returnTokenRequired = returnToken === _types.TokenType.arrow; + tsTryParseTypeParameters(); + _util.expect.call(void 0, _types.TokenType.parenL); + // Create a scope even though we're doing type parsing so we don't accidentally + // treat params as top-level bindings. + _base.state.scopeDepth++; + tsParseBindingListForSignature(false /* isBlockScope */); + _base.state.scopeDepth--; + if (returnTokenRequired) { + tsParseTypeOrTypePredicateAnnotation(returnToken); + } else if (_index.match.call(void 0, returnToken)) { + tsParseTypeOrTypePredicateAnnotation(returnToken); + } +} + +function tsParseBindingListForSignature(isBlockScope) { + _lval.parseBindingList.call(void 0, _types.TokenType.parenR, isBlockScope); +} + +function tsParseTypeMemberSemicolon() { + if (!_index.eat.call(void 0, _types.TokenType.comma)) { + _util.semicolon.call(void 0, ); + } +} + +function tsParseSignatureMember() { + tsFillSignature(_types.TokenType.colon); + tsParseTypeMemberSemicolon(); +} + +function tsIsUnambiguouslyIndexSignature() { + const snapshot = _base.state.snapshot(); + _index.next.call(void 0, ); // Skip '{' + const isIndexSignature = _index.eat.call(void 0, _types.TokenType.name) && _index.match.call(void 0, _types.TokenType.colon); + _base.state.restoreFromSnapshot(snapshot); + return isIndexSignature; +} + +function tsTryParseIndexSignature() { + if (!(_index.match.call(void 0, _types.TokenType.bracketL) && tsIsUnambiguouslyIndexSignature())) { + return false; + } + + const oldIsType = _index.pushTypeContext.call(void 0, 0); + + _util.expect.call(void 0, _types.TokenType.bracketL); + _expression.parseIdentifier.call(void 0, ); + tsParseTypeAnnotation(); + _util.expect.call(void 0, _types.TokenType.bracketR); + + tsTryParseTypeAnnotation(); + tsParseTypeMemberSemicolon(); + + _index.popTypeContext.call(void 0, oldIsType); + return true; +} + +function tsParsePropertyOrMethodSignature(isReadonly) { + _index.eat.call(void 0, _types.TokenType.question); + + if (!isReadonly && (_index.match.call(void 0, _types.TokenType.parenL) || _index.match.call(void 0, _types.TokenType.lessThan))) { + tsFillSignature(_types.TokenType.colon); + tsParseTypeMemberSemicolon(); + } else { + tsTryParseTypeAnnotation(); + tsParseTypeMemberSemicolon(); + } +} + +function tsParseTypeMember() { + if (_index.match.call(void 0, _types.TokenType.parenL) || _index.match.call(void 0, _types.TokenType.lessThan)) { + // call signature + tsParseSignatureMember(); + return; + } + if (_index.match.call(void 0, _types.TokenType._new)) { + _index.next.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.parenL) || _index.match.call(void 0, _types.TokenType.lessThan)) { + // constructor signature + tsParseSignatureMember(); + } else { + tsParsePropertyOrMethodSignature(false); + } + return; + } + const readonly = !!tsParseModifier([_keywords.ContextualKeyword._readonly]); + + const found = tsTryParseIndexSignature(); + if (found) { + return; + } + if ( + (_util.isContextual.call(void 0, _keywords.ContextualKeyword._get) || _util.isContextual.call(void 0, _keywords.ContextualKeyword._set)) && + tsNextTokenCanFollowModifier() + ) { + // This is a getter/setter on a type. The tsNextTokenCanFollowModifier + // function already called next() for us, so continue parsing the name. + } + _expression.parsePropertyName.call(void 0, -1 /* Types don't need context IDs. */); + tsParsePropertyOrMethodSignature(readonly); +} + +function tsParseTypeLiteral() { + tsParseObjectTypeMembers(); +} + +function tsParseObjectTypeMembers() { + _util.expect.call(void 0, _types.TokenType.braceL); + while (!_index.eat.call(void 0, _types.TokenType.braceR) && !_base.state.error) { + tsParseTypeMember(); + } +} + +function tsLookaheadIsStartOfMappedType() { + const snapshot = _base.state.snapshot(); + const isStartOfMappedType = tsIsStartOfMappedType(); + _base.state.restoreFromSnapshot(snapshot); + return isStartOfMappedType; +} + +function tsIsStartOfMappedType() { + _index.next.call(void 0, ); + if (_index.eat.call(void 0, _types.TokenType.plus) || _index.eat.call(void 0, _types.TokenType.minus)) { + return _util.isContextual.call(void 0, _keywords.ContextualKeyword._readonly); + } + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._readonly)) { + _index.next.call(void 0, ); + } + if (!_index.match.call(void 0, _types.TokenType.bracketL)) { + return false; + } + _index.next.call(void 0, ); + if (!tsIsIdentifier()) { + return false; + } + _index.next.call(void 0, ); + return _index.match.call(void 0, _types.TokenType._in); +} + +function tsParseMappedTypeParameter() { + _expression.parseIdentifier.call(void 0, ); + _util.expect.call(void 0, _types.TokenType._in); + tsParseType(); +} + +function tsParseMappedType() { + _util.expect.call(void 0, _types.TokenType.braceL); + if (_index.match.call(void 0, _types.TokenType.plus) || _index.match.call(void 0, _types.TokenType.minus)) { + _index.next.call(void 0, ); + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._readonly); + } else { + _util.eatContextual.call(void 0, _keywords.ContextualKeyword._readonly); + } + _util.expect.call(void 0, _types.TokenType.bracketL); + tsParseMappedTypeParameter(); + if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._as)) { + tsParseType(); + } + _util.expect.call(void 0, _types.TokenType.bracketR); + if (_index.match.call(void 0, _types.TokenType.plus) || _index.match.call(void 0, _types.TokenType.minus)) { + _index.next.call(void 0, ); + _util.expect.call(void 0, _types.TokenType.question); + } else { + _index.eat.call(void 0, _types.TokenType.question); + } + tsTryParseType(); + _util.semicolon.call(void 0, ); + _util.expect.call(void 0, _types.TokenType.braceR); +} + +function tsParseTupleType() { + _util.expect.call(void 0, _types.TokenType.bracketL); + while (!_index.eat.call(void 0, _types.TokenType.bracketR) && !_base.state.error) { + // Do not validate presence of either none or only labeled elements + tsParseTupleElementType(); + _index.eat.call(void 0, _types.TokenType.comma); + } +} + +function tsParseTupleElementType() { + // parses `...TsType[]` + if (_index.eat.call(void 0, _types.TokenType.ellipsis)) { + tsParseType(); + } else { + // parses `TsType?` + tsParseType(); + _index.eat.call(void 0, _types.TokenType.question); + } + + // The type we parsed above was actually a label + if (_index.eat.call(void 0, _types.TokenType.colon)) { + // Labeled tuple types must affix the label with `...` or `?`, so no need to handle those here + tsParseType(); + } +} + +function tsParseParenthesizedType() { + _util.expect.call(void 0, _types.TokenType.parenL); + tsParseType(); + _util.expect.call(void 0, _types.TokenType.parenR); +} + +function tsParseTemplateLiteralType() { + // Finish `, read quasi + _index.nextTemplateToken.call(void 0, ); + // Finish quasi, read ${ + _index.nextTemplateToken.call(void 0, ); + while (!_index.match.call(void 0, _types.TokenType.backQuote) && !_base.state.error) { + _util.expect.call(void 0, _types.TokenType.dollarBraceL); + tsParseType(); + // Finish }, read quasi + _index.nextTemplateToken.call(void 0, ); + // Finish quasi, read either ${ or ` + _index.nextTemplateToken.call(void 0, ); + } + _index.next.call(void 0, ); +} + +var FunctionType; (function (FunctionType) { + const TSFunctionType = 0; FunctionType[FunctionType["TSFunctionType"] = TSFunctionType] = "TSFunctionType"; + const TSConstructorType = TSFunctionType + 1; FunctionType[FunctionType["TSConstructorType"] = TSConstructorType] = "TSConstructorType"; + const TSAbstractConstructorType = TSConstructorType + 1; FunctionType[FunctionType["TSAbstractConstructorType"] = TSAbstractConstructorType] = "TSAbstractConstructorType"; +})(FunctionType || (FunctionType = {})); + +function tsParseFunctionOrConstructorType(type) { + if (type === FunctionType.TSAbstractConstructorType) { + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._abstract); + } + if (type === FunctionType.TSConstructorType || type === FunctionType.TSAbstractConstructorType) { + _util.expect.call(void 0, _types.TokenType._new); + } + const oldInDisallowConditionalTypesContext = _base.state.inDisallowConditionalTypesContext; + _base.state.inDisallowConditionalTypesContext = false; + tsFillSignature(_types.TokenType.arrow); + _base.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; +} + +function tsParseNonArrayType() { + switch (_base.state.type) { + case _types.TokenType.name: + tsParseTypeReference(); + return; + case _types.TokenType._void: + case _types.TokenType._null: + _index.next.call(void 0, ); + return; + case _types.TokenType.string: + case _types.TokenType.num: + case _types.TokenType.bigint: + case _types.TokenType.decimal: + case _types.TokenType._true: + case _types.TokenType._false: + _expression.parseLiteral.call(void 0, ); + return; + case _types.TokenType.minus: + _index.next.call(void 0, ); + _expression.parseLiteral.call(void 0, ); + return; + case _types.TokenType._this: { + tsParseThisTypeNode(); + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._is) && !_util.hasPrecedingLineBreak.call(void 0, )) { + tsParseThisTypePredicate(); + } + return; + } + case _types.TokenType._typeof: + tsParseTypeQuery(); + return; + case _types.TokenType._import: + tsParseImportType(); + return; + case _types.TokenType.braceL: + if (tsLookaheadIsStartOfMappedType()) { + tsParseMappedType(); + } else { + tsParseTypeLiteral(); + } + return; + case _types.TokenType.bracketL: + tsParseTupleType(); + return; + case _types.TokenType.parenL: + tsParseParenthesizedType(); + return; + case _types.TokenType.backQuote: + tsParseTemplateLiteralType(); + return; + default: + if (_base.state.type & _types.TokenType.IS_KEYWORD) { + _index.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType.name; + return; + } + break; + } + + _util.unexpected.call(void 0, ); +} + +function tsParseArrayTypeOrHigher() { + tsParseNonArrayType(); + while (!_util.hasPrecedingLineBreak.call(void 0, ) && _index.eat.call(void 0, _types.TokenType.bracketL)) { + if (!_index.eat.call(void 0, _types.TokenType.bracketR)) { + // If we hit ] immediately, this is an array type, otherwise it's an indexed access type. + tsParseType(); + _util.expect.call(void 0, _types.TokenType.bracketR); + } + } +} + +function tsParseInferType() { + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._infer); + _expression.parseIdentifier.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType._extends)) { + // Infer type constraints introduce an ambiguity about whether the "extends" + // is a constraint for this infer type or is another conditional type. + const snapshot = _base.state.snapshot(); + _util.expect.call(void 0, _types.TokenType._extends); + const oldInDisallowConditionalTypesContext = _base.state.inDisallowConditionalTypesContext; + _base.state.inDisallowConditionalTypesContext = true; + tsParseType(); + _base.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; + if (_base.state.error || (!_base.state.inDisallowConditionalTypesContext && _index.match.call(void 0, _types.TokenType.question))) { + _base.state.restoreFromSnapshot(snapshot); + } + } +} + +function tsParseTypeOperatorOrHigher() { + if ( + _util.isContextual.call(void 0, _keywords.ContextualKeyword._keyof) || + _util.isContextual.call(void 0, _keywords.ContextualKeyword._unique) || + _util.isContextual.call(void 0, _keywords.ContextualKeyword._readonly) + ) { + _index.next.call(void 0, ); + tsParseTypeOperatorOrHigher(); + } else if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._infer)) { + tsParseInferType(); + } else { + const oldInDisallowConditionalTypesContext = _base.state.inDisallowConditionalTypesContext; + _base.state.inDisallowConditionalTypesContext = false; + tsParseArrayTypeOrHigher(); + _base.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; + } +} + +function tsParseIntersectionTypeOrHigher() { + _index.eat.call(void 0, _types.TokenType.bitwiseAND); + tsParseTypeOperatorOrHigher(); + if (_index.match.call(void 0, _types.TokenType.bitwiseAND)) { + while (_index.eat.call(void 0, _types.TokenType.bitwiseAND)) { + tsParseTypeOperatorOrHigher(); + } + } +} + +function tsParseUnionTypeOrHigher() { + _index.eat.call(void 0, _types.TokenType.bitwiseOR); + tsParseIntersectionTypeOrHigher(); + if (_index.match.call(void 0, _types.TokenType.bitwiseOR)) { + while (_index.eat.call(void 0, _types.TokenType.bitwiseOR)) { + tsParseIntersectionTypeOrHigher(); + } + } +} + +function tsIsStartOfFunctionType() { + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + return true; + } + return _index.match.call(void 0, _types.TokenType.parenL) && tsLookaheadIsUnambiguouslyStartOfFunctionType(); +} + +function tsSkipParameterStart() { + if (_index.match.call(void 0, _types.TokenType.name) || _index.match.call(void 0, _types.TokenType._this)) { + _index.next.call(void 0, ); + return true; + } + // If this is a possible array/object destructure, walk to the matching bracket/brace. + // The next token after will tell us definitively whether this is a function param. + if (_index.match.call(void 0, _types.TokenType.braceL) || _index.match.call(void 0, _types.TokenType.bracketL)) { + let depth = 1; + _index.next.call(void 0, ); + while (depth > 0 && !_base.state.error) { + if (_index.match.call(void 0, _types.TokenType.braceL) || _index.match.call(void 0, _types.TokenType.bracketL)) { + depth++; + } else if (_index.match.call(void 0, _types.TokenType.braceR) || _index.match.call(void 0, _types.TokenType.bracketR)) { + depth--; + } + _index.next.call(void 0, ); + } + return true; + } + return false; +} + +function tsLookaheadIsUnambiguouslyStartOfFunctionType() { + const snapshot = _base.state.snapshot(); + const isUnambiguouslyStartOfFunctionType = tsIsUnambiguouslyStartOfFunctionType(); + _base.state.restoreFromSnapshot(snapshot); + return isUnambiguouslyStartOfFunctionType; +} + +function tsIsUnambiguouslyStartOfFunctionType() { + _index.next.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.parenR) || _index.match.call(void 0, _types.TokenType.ellipsis)) { + // ( ) + // ( ... + return true; + } + if (tsSkipParameterStart()) { + if (_index.match.call(void 0, _types.TokenType.colon) || _index.match.call(void 0, _types.TokenType.comma) || _index.match.call(void 0, _types.TokenType.question) || _index.match.call(void 0, _types.TokenType.eq)) { + // ( xxx : + // ( xxx , + // ( xxx ? + // ( xxx = + return true; + } + if (_index.match.call(void 0, _types.TokenType.parenR)) { + _index.next.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.arrow)) { + // ( xxx ) => + return true; + } + } + } + return false; +} + +function tsParseTypeOrTypePredicateAnnotation(returnToken) { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _util.expect.call(void 0, returnToken); + const finishedReturn = tsParseTypePredicateOrAssertsPrefix(); + if (!finishedReturn) { + tsParseType(); + } + _index.popTypeContext.call(void 0, oldIsType); +} + +function tsTryParseTypeOrTypePredicateAnnotation() { + if (_index.match.call(void 0, _types.TokenType.colon)) { + tsParseTypeOrTypePredicateAnnotation(_types.TokenType.colon); + } +} + + function tsTryParseTypeAnnotation() { + if (_index.match.call(void 0, _types.TokenType.colon)) { + tsParseTypeAnnotation(); + } +} exports.tsTryParseTypeAnnotation = tsTryParseTypeAnnotation; + +function tsTryParseType() { + if (_index.eat.call(void 0, _types.TokenType.colon)) { + tsParseType(); + } +} + +/** + * Detect a few special return syntax cases: `x is T`, `asserts x`, `asserts x is T`, + * `asserts this is T`. + * + * Returns true if we parsed the return type, false if there's still a type to be parsed. + */ +function tsParseTypePredicateOrAssertsPrefix() { + const snapshot = _base.state.snapshot(); + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._asserts)) { + // Normally this is `asserts x is T`, but at this point, it might be `asserts is T` (a user- + // defined type guard on the `asserts` variable) or just a type called `asserts`. + _index.next.call(void 0, ); + if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._is)) { + // If we see `asserts is`, then this must be of the form `asserts is T`, since + // `asserts is is T` isn't valid. + tsParseType(); + return true; + } else if (tsIsIdentifier() || _index.match.call(void 0, _types.TokenType._this)) { + _index.next.call(void 0, ); + if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._is)) { + // If we see `is`, then this is `asserts x is T`. Otherwise, it's `asserts x`. + tsParseType(); + } + return true; + } else { + // Regular type, so bail out and start type parsing from scratch. + _base.state.restoreFromSnapshot(snapshot); + return false; + } + } else if (tsIsIdentifier() || _index.match.call(void 0, _types.TokenType._this)) { + // This is a regular identifier, which may or may not have "is" after it. + _index.next.call(void 0, ); + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._is) && !_util.hasPrecedingLineBreak.call(void 0, )) { + _index.next.call(void 0, ); + tsParseType(); + return true; + } else { + // Regular type, so bail out and start type parsing from scratch. + _base.state.restoreFromSnapshot(snapshot); + return false; + } + } + return false; +} + + function tsParseTypeAnnotation() { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _util.expect.call(void 0, _types.TokenType.colon); + tsParseType(); + _index.popTypeContext.call(void 0, oldIsType); +} exports.tsParseTypeAnnotation = tsParseTypeAnnotation; + + function tsParseType() { + tsParseNonConditionalType(); + if (_base.state.inDisallowConditionalTypesContext || _util.hasPrecedingLineBreak.call(void 0, ) || !_index.eat.call(void 0, _types.TokenType._extends)) { + return; + } + // extends type + const oldInDisallowConditionalTypesContext = _base.state.inDisallowConditionalTypesContext; + _base.state.inDisallowConditionalTypesContext = true; + tsParseNonConditionalType(); + _base.state.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; + + _util.expect.call(void 0, _types.TokenType.question); + // true type + tsParseType(); + _util.expect.call(void 0, _types.TokenType.colon); + // false type + tsParseType(); +} exports.tsParseType = tsParseType; + +function isAbstractConstructorSignature() { + return _util.isContextual.call(void 0, _keywords.ContextualKeyword._abstract) && _index.lookaheadType.call(void 0, ) === _types.TokenType._new; +} + + function tsParseNonConditionalType() { + if (tsIsStartOfFunctionType()) { + tsParseFunctionOrConstructorType(FunctionType.TSFunctionType); + return; + } + if (_index.match.call(void 0, _types.TokenType._new)) { + // As in `new () => Date` + tsParseFunctionOrConstructorType(FunctionType.TSConstructorType); + return; + } else if (isAbstractConstructorSignature()) { + // As in `abstract new () => Date` + tsParseFunctionOrConstructorType(FunctionType.TSAbstractConstructorType); + return; + } + tsParseUnionTypeOrHigher(); +} exports.tsParseNonConditionalType = tsParseNonConditionalType; + + function tsParseTypeAssertion() { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + tsParseType(); + _util.expect.call(void 0, _types.TokenType.greaterThan); + _index.popTypeContext.call(void 0, oldIsType); + _expression.parseMaybeUnary.call(void 0, ); +} exports.tsParseTypeAssertion = tsParseTypeAssertion; + + function tsTryParseJSXTypeArgument() { + if (_index.eat.call(void 0, _types.TokenType.jsxTagStart)) { + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType.typeParameterStart; + const oldIsType = _index.pushTypeContext.call(void 0, 1); + while (!_index.match.call(void 0, _types.TokenType.greaterThan) && !_base.state.error) { + tsParseType(); + _index.eat.call(void 0, _types.TokenType.comma); + } + // Process >, but the one after needs to be parsed JSX-style. + _jsx.nextJSXTagToken.call(void 0, ); + _index.popTypeContext.call(void 0, oldIsType); + } +} exports.tsTryParseJSXTypeArgument = tsTryParseJSXTypeArgument; + +function tsParseHeritageClause() { + while (!_index.match.call(void 0, _types.TokenType.braceL) && !_base.state.error) { + tsParseExpressionWithTypeArguments(); + _index.eat.call(void 0, _types.TokenType.comma); + } +} + +function tsParseExpressionWithTypeArguments() { + // Note: TS uses parseLeftHandSideExpressionOrHigher, + // then has grammar errors later if it's not an EntityName. + tsParseEntityName(); + if (_index.match.call(void 0, _types.TokenType.lessThan)) { + tsParseTypeArguments(); + } +} + +function tsParseInterfaceDeclaration() { + _lval.parseBindingIdentifier.call(void 0, false); + tsTryParseTypeParameters(); + if (_index.eat.call(void 0, _types.TokenType._extends)) { + tsParseHeritageClause(); + } + tsParseObjectTypeMembers(); +} + +function tsParseTypeAliasDeclaration() { + _lval.parseBindingIdentifier.call(void 0, false); + tsTryParseTypeParameters(); + _util.expect.call(void 0, _types.TokenType.eq); + tsParseType(); + _util.semicolon.call(void 0, ); +} + +function tsParseEnumMember() { + // Computed property names are grammar errors in an enum, so accept just string literal or identifier. + if (_index.match.call(void 0, _types.TokenType.string)) { + _expression.parseLiteral.call(void 0, ); + } else { + _expression.parseIdentifier.call(void 0, ); + } + if (_index.eat.call(void 0, _types.TokenType.eq)) { + const eqIndex = _base.state.tokens.length - 1; + _expression.parseMaybeAssign.call(void 0, ); + _base.state.tokens[eqIndex].rhsEndIndex = _base.state.tokens.length; + } +} + +function tsParseEnumDeclaration() { + _lval.parseBindingIdentifier.call(void 0, false); + _util.expect.call(void 0, _types.TokenType.braceL); + while (!_index.eat.call(void 0, _types.TokenType.braceR) && !_base.state.error) { + tsParseEnumMember(); + _index.eat.call(void 0, _types.TokenType.comma); + } +} + +function tsParseModuleBlock() { + _util.expect.call(void 0, _types.TokenType.braceL); + _statement.parseBlockBody.call(void 0, /* end */ _types.TokenType.braceR); +} + +function tsParseModuleOrNamespaceDeclaration() { + _lval.parseBindingIdentifier.call(void 0, false); + if (_index.eat.call(void 0, _types.TokenType.dot)) { + tsParseModuleOrNamespaceDeclaration(); + } else { + tsParseModuleBlock(); + } +} + +function tsParseAmbientExternalModuleDeclaration() { + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._global)) { + _expression.parseIdentifier.call(void 0, ); + } else if (_index.match.call(void 0, _types.TokenType.string)) { + _expression.parseExprAtom.call(void 0, ); + } else { + _util.unexpected.call(void 0, ); + } + + if (_index.match.call(void 0, _types.TokenType.braceL)) { + tsParseModuleBlock(); + } else { + _util.semicolon.call(void 0, ); + } +} + + function tsParseImportEqualsDeclaration() { + _lval.parseImportedIdentifier.call(void 0, ); + _util.expect.call(void 0, _types.TokenType.eq); + tsParseModuleReference(); + _util.semicolon.call(void 0, ); +} exports.tsParseImportEqualsDeclaration = tsParseImportEqualsDeclaration; + +function tsIsExternalModuleReference() { + return _util.isContextual.call(void 0, _keywords.ContextualKeyword._require) && _index.lookaheadType.call(void 0, ) === _types.TokenType.parenL; +} + +function tsParseModuleReference() { + if (tsIsExternalModuleReference()) { + tsParseExternalModuleReference(); + } else { + tsParseEntityName(); + } +} + +function tsParseExternalModuleReference() { + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._require); + _util.expect.call(void 0, _types.TokenType.parenL); + if (!_index.match.call(void 0, _types.TokenType.string)) { + _util.unexpected.call(void 0, ); + } + _expression.parseLiteral.call(void 0, ); + _util.expect.call(void 0, _types.TokenType.parenR); +} + +// Utilities + +// Returns true if a statement matched. +function tsTryParseDeclare() { + if (_util.isLineTerminator.call(void 0, )) { + return false; + } + switch (_base.state.type) { + case _types.TokenType._function: { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + _index.next.call(void 0, ); + // We don't need to precisely get the function start here, since it's only used to mark + // the function as a type if it's bodiless, and it's already a type here. + const functionStart = _base.state.start; + _statement.parseFunction.call(void 0, functionStart, /* isStatement */ true); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } + case _types.TokenType._class: { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + _statement.parseClass.call(void 0, /* isStatement */ true, /* optionalId */ false); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } + case _types.TokenType._const: { + if (_index.match.call(void 0, _types.TokenType._const) && _util.isLookaheadContextual.call(void 0, _keywords.ContextualKeyword._enum)) { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + // `const enum = 0;` not allowed because "enum" is a strict mode reserved word. + _util.expect.call(void 0, _types.TokenType._const); + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._enum); + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._enum; + tsParseEnumDeclaration(); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } + } + // falls through + case _types.TokenType._var: + case _types.TokenType._let: { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + _statement.parseVarStatement.call(void 0, _base.state.type !== _types.TokenType._var); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } + case _types.TokenType.name: { + const oldIsType = _index.pushTypeContext.call(void 0, 1); + const contextualKeyword = _base.state.contextualKeyword; + let matched = false; + if (contextualKeyword === _keywords.ContextualKeyword._global) { + tsParseAmbientExternalModuleDeclaration(); + matched = true; + } else { + matched = tsParseDeclaration(contextualKeyword, /* isBeforeToken */ true); + } + _index.popTypeContext.call(void 0, oldIsType); + return matched; + } + default: + return false; + } +} + +// Note: this won't be called unless the keyword is allowed in `shouldParseExportDeclaration`. +// Returns true if it matched a declaration. +function tsTryParseExportDeclaration() { + return tsParseDeclaration(_base.state.contextualKeyword, /* isBeforeToken */ true); +} + +// Returns true if it matched a statement. +function tsParseExpressionStatement(contextualKeyword) { + switch (contextualKeyword) { + case _keywords.ContextualKeyword._declare: { + const declareTokenIndex = _base.state.tokens.length - 1; + const matched = tsTryParseDeclare(); + if (matched) { + _base.state.tokens[declareTokenIndex].type = _types.TokenType._declare; + return true; + } + break; + } + case _keywords.ContextualKeyword._global: + // `global { }` (with no `declare`) may appear inside an ambient module declaration. + // Would like to use tsParseAmbientExternalModuleDeclaration here, but already ran past "global". + if (_index.match.call(void 0, _types.TokenType.braceL)) { + tsParseModuleBlock(); + return true; + } + break; + + default: + return tsParseDeclaration(contextualKeyword, /* isBeforeToken */ false); + } + return false; +} + +/** + * Common code for parsing a declaration. + * + * isBeforeToken indicates that the current parser state is at the contextual + * keyword (and that it is not yet emitted) rather than reading the token after + * it. When isBeforeToken is true, we may be preceded by an `export` token and + * should include that token in a type context we create, e.g. to handle + * `export interface` or `export type`. (This is a bit of a hack and should be + * cleaned up at some point.) + * + * Returns true if it matched a declaration. + */ +function tsParseDeclaration(contextualKeyword, isBeforeToken) { + switch (contextualKeyword) { + case _keywords.ContextualKeyword._abstract: + if (tsCheckLineTerminator(isBeforeToken) && _index.match.call(void 0, _types.TokenType._class)) { + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._abstract; + _statement.parseClass.call(void 0, /* isStatement */ true, /* optionalId */ false); + return true; + } + break; + + case _keywords.ContextualKeyword._enum: + if (tsCheckLineTerminator(isBeforeToken) && _index.match.call(void 0, _types.TokenType.name)) { + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._enum; + tsParseEnumDeclaration(); + return true; + } + break; + + case _keywords.ContextualKeyword._interface: + if (tsCheckLineTerminator(isBeforeToken) && _index.match.call(void 0, _types.TokenType.name)) { + // `next` is true in "export" and "declare" contexts, so we want to remove that token + // as well. + const oldIsType = _index.pushTypeContext.call(void 0, isBeforeToken ? 2 : 1); + tsParseInterfaceDeclaration(); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } + break; + + case _keywords.ContextualKeyword._module: + if (tsCheckLineTerminator(isBeforeToken)) { + if (_index.match.call(void 0, _types.TokenType.string)) { + const oldIsType = _index.pushTypeContext.call(void 0, isBeforeToken ? 2 : 1); + tsParseAmbientExternalModuleDeclaration(); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } else if (_index.match.call(void 0, _types.TokenType.name)) { + const oldIsType = _index.pushTypeContext.call(void 0, isBeforeToken ? 2 : 1); + tsParseModuleOrNamespaceDeclaration(); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } + } + break; + + case _keywords.ContextualKeyword._namespace: + if (tsCheckLineTerminator(isBeforeToken) && _index.match.call(void 0, _types.TokenType.name)) { + const oldIsType = _index.pushTypeContext.call(void 0, isBeforeToken ? 2 : 1); + tsParseModuleOrNamespaceDeclaration(); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } + break; + + case _keywords.ContextualKeyword._type: + if (tsCheckLineTerminator(isBeforeToken) && _index.match.call(void 0, _types.TokenType.name)) { + const oldIsType = _index.pushTypeContext.call(void 0, isBeforeToken ? 2 : 1); + tsParseTypeAliasDeclaration(); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } + break; + + default: + break; + } + return false; +} + +function tsCheckLineTerminator(isBeforeToken) { + if (isBeforeToken) { + // Babel checks hasFollowingLineBreak here and returns false, but this + // doesn't actually come up, e.g. `export interface` can never be on its own + // line in valid code. + _index.next.call(void 0, ); + return true; + } else { + return !_util.isLineTerminator.call(void 0, ); + } +} + +// Returns true if there was a generic async arrow function. +function tsTryParseGenericAsyncArrowFunction() { + const snapshot = _base.state.snapshot(); + + tsParseTypeParameters(); + _statement.parseFunctionParams.call(void 0, ); + tsTryParseTypeOrTypePredicateAnnotation(); + _util.expect.call(void 0, _types.TokenType.arrow); + + if (_base.state.error) { + _base.state.restoreFromSnapshot(snapshot); + return false; + } + + _expression.parseFunctionBody.call(void 0, true); + return true; +} + +/** + * If necessary, hack the tokenizer state so that this bitshift was actually a + * less-than token, then keep parsing. This should only be used in situations + * where we restore from snapshot on error (which reverts this change) or + * where bitshift would be illegal anyway (e.g. in a class "extends" clause). + * + * This hack is useful to handle situations like foo<() => void>() where + * there can legitimately be two open-angle-brackets in a row in TS. + */ +function tsParseTypeArgumentsWithPossibleBitshift() { + if (_base.state.type === _types.TokenType.bitShiftL) { + _base.state.pos -= 1; + _index.finishToken.call(void 0, _types.TokenType.lessThan); + } + tsParseTypeArguments(); +} + +function tsParseTypeArguments() { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _util.expect.call(void 0, _types.TokenType.lessThan); + while (!_index.match.call(void 0, _types.TokenType.greaterThan) && !_base.state.error) { + tsParseType(); + _index.eat.call(void 0, _types.TokenType.comma); + } + if (!oldIsType) { + // If the type arguments are present in an expression context, e.g. + // f(), then the > sign should be tokenized as a non-type token. + // In particular, f(a < b, c >= d) should parse the >= as a single token, + // resulting in a syntax error and fallback to the non-type-args + // interpretation. In the success case, even though the > is tokenized as a + // non-type token, it still must be marked as a type token so that it is + // erased. + _index.popTypeContext.call(void 0, oldIsType); + _index.rescan_gt.call(void 0, ); + _util.expect.call(void 0, _types.TokenType.greaterThan); + _base.state.tokens[_base.state.tokens.length - 1].isType = true; + } else { + _util.expect.call(void 0, _types.TokenType.greaterThan); + _index.popTypeContext.call(void 0, oldIsType); + } +} + + function tsIsDeclarationStart() { + if (_index.match.call(void 0, _types.TokenType.name)) { + switch (_base.state.contextualKeyword) { + case _keywords.ContextualKeyword._abstract: + case _keywords.ContextualKeyword._declare: + case _keywords.ContextualKeyword._enum: + case _keywords.ContextualKeyword._interface: + case _keywords.ContextualKeyword._module: + case _keywords.ContextualKeyword._namespace: + case _keywords.ContextualKeyword._type: + return true; + default: + break; + } + } + + return false; +} exports.tsIsDeclarationStart = tsIsDeclarationStart; + +// ====================================================== +// OVERRIDES +// ====================================================== + + function tsParseFunctionBodyAndFinish(functionStart, funcContextId) { + // For arrow functions, `parseArrow` handles the return type itself. + if (_index.match.call(void 0, _types.TokenType.colon)) { + tsParseTypeOrTypePredicateAnnotation(_types.TokenType.colon); + } + + // The original code checked the node type to make sure this function type allows a missing + // body, but we skip that to avoid sending around the node type. We instead just use the + // allowExpressionBody boolean to make sure it's not an arrow function. + if (!_index.match.call(void 0, _types.TokenType.braceL) && _util.isLineTerminator.call(void 0, )) { + // Retroactively mark the function declaration as a type. + let i = _base.state.tokens.length - 1; + while ( + i >= 0 && + (_base.state.tokens[i].start >= functionStart || + _base.state.tokens[i].type === _types.TokenType._default || + _base.state.tokens[i].type === _types.TokenType._export) + ) { + _base.state.tokens[i].isType = true; + i--; + } + return; + } + + _expression.parseFunctionBody.call(void 0, false, funcContextId); +} exports.tsParseFunctionBodyAndFinish = tsParseFunctionBodyAndFinish; + + function tsParseSubscript( + startTokenIndex, + noCalls, + stopState, +) { + if (!_util.hasPrecedingLineBreak.call(void 0, ) && _index.eat.call(void 0, _types.TokenType.bang)) { + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType.nonNullAssertion; + return; + } + + if (_index.match.call(void 0, _types.TokenType.lessThan) || _index.match.call(void 0, _types.TokenType.bitShiftL)) { + // There are number of things we are going to "maybe" parse, like type arguments on + // tagged template expressions. If any of them fail, walk it back and continue. + const snapshot = _base.state.snapshot(); + + if (!noCalls && _expression.atPossibleAsync.call(void 0, )) { + // Almost certainly this is a generic async function `async () => ... + // But it might be a call with a type argument `async();` + const asyncArrowFn = tsTryParseGenericAsyncArrowFunction(); + if (asyncArrowFn) { + return; + } + } + tsParseTypeArgumentsWithPossibleBitshift(); + if (!noCalls && _index.eat.call(void 0, _types.TokenType.parenL)) { + // With f(), the subscriptStartIndex marker is on the ( token. + _base.state.tokens[_base.state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + _expression.parseCallExpressionArguments.call(void 0, ); + } else if (_index.match.call(void 0, _types.TokenType.backQuote)) { + // Tagged template with a type argument. + _expression.parseTemplate.call(void 0, ); + } else if ( + // The remaining possible case is an instantiation expression, e.g. + // Array . Check for a few cases that would disqualify it and + // cause us to bail out. + // a>c is not (a)>c, but a<(b>>c) + _base.state.type === _types.TokenType.greaterThan || + // ac is (ac + (_base.state.type !== _types.TokenType.parenL && + Boolean(_base.state.type & _types.TokenType.IS_EXPRESSION_START) && + !_util.hasPrecedingLineBreak.call(void 0, )) + ) { + // Bail out. We have something like ac, which is not an expression with + // type arguments but an (a < b) > c comparison. + _util.unexpected.call(void 0, ); + } + + if (_base.state.error) { + _base.state.restoreFromSnapshot(snapshot); + } else { + return; + } + } else if (!noCalls && _index.match.call(void 0, _types.TokenType.questionDot) && _index.lookaheadType.call(void 0, ) === _types.TokenType.lessThan) { + // If we see f?.<, then this must be an optional call with a type argument. + _index.next.call(void 0, ); + _base.state.tokens[startTokenIndex].isOptionalChainStart = true; + // With f?.(), the subscriptStartIndex marker is on the ?. token. + _base.state.tokens[_base.state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + + tsParseTypeArguments(); + _util.expect.call(void 0, _types.TokenType.parenL); + _expression.parseCallExpressionArguments.call(void 0, ); + } + _expression.baseParseSubscript.call(void 0, startTokenIndex, noCalls, stopState); +} exports.tsParseSubscript = tsParseSubscript; + + function tsTryParseExport() { + if (_index.eat.call(void 0, _types.TokenType._import)) { + // One of these cases: + // export import A = B; + // export import type A = require("A"); + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._type) && _index.lookaheadType.call(void 0, ) !== _types.TokenType.eq) { + // Eat a `type` token, unless it's actually an identifier name. + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._type); + } + tsParseImportEqualsDeclaration(); + return true; + } else if (_index.eat.call(void 0, _types.TokenType.eq)) { + // `export = x;` + _expression.parseExpression.call(void 0, ); + _util.semicolon.call(void 0, ); + return true; + } else if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._as)) { + // `export as namespace A;` + // See `parseNamespaceExportDeclaration` in TypeScript's own parser + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._namespace); + _expression.parseIdentifier.call(void 0, ); + _util.semicolon.call(void 0, ); + return true; + } else { + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._type)) { + const nextType = _index.lookaheadType.call(void 0, ); + // export type {foo} from 'a'; + // export type * from 'a';' + // export type * as ns from 'a';' + if (nextType === _types.TokenType.braceL || nextType === _types.TokenType.star) { + _index.next.call(void 0, ); + } + } + return false; + } +} exports.tsTryParseExport = tsTryParseExport; + +/** + * Parse a TS import specifier, which may be prefixed with "type" and may be of + * the form `foo as bar`. + * + * The number of identifier-like tokens we see happens to be enough to uniquely + * identify the form, so simply count the number of identifiers rather than + * matching the words `type` or `as`. This is particularly important because + * `type` and `as` could each actually be plain identifiers rather than + * keywords. + */ + function tsParseImportSpecifier() { + _expression.parseIdentifier.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.comma) || _index.match.call(void 0, _types.TokenType.braceR)) { + // import {foo} + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _index.IdentifierRole.ImportDeclaration; + return; + } + _expression.parseIdentifier.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.comma) || _index.match.call(void 0, _types.TokenType.braceR)) { + // import {type foo} + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _index.IdentifierRole.ImportDeclaration; + _base.state.tokens[_base.state.tokens.length - 2].isType = true; + _base.state.tokens[_base.state.tokens.length - 1].isType = true; + return; + } + _expression.parseIdentifier.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.comma) || _index.match.call(void 0, _types.TokenType.braceR)) { + // import {foo as bar} + _base.state.tokens[_base.state.tokens.length - 3].identifierRole = _index.IdentifierRole.ImportAccess; + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _index.IdentifierRole.ImportDeclaration; + return; + } + _expression.parseIdentifier.call(void 0, ); + // import {type foo as bar} + _base.state.tokens[_base.state.tokens.length - 3].identifierRole = _index.IdentifierRole.ImportAccess; + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _index.IdentifierRole.ImportDeclaration; + _base.state.tokens[_base.state.tokens.length - 4].isType = true; + _base.state.tokens[_base.state.tokens.length - 3].isType = true; + _base.state.tokens[_base.state.tokens.length - 2].isType = true; + _base.state.tokens[_base.state.tokens.length - 1].isType = true; +} exports.tsParseImportSpecifier = tsParseImportSpecifier; + +/** + * Just like named import specifiers, export specifiers can have from 1 to 4 + * tokens, inclusive, and the number of tokens determines the role of each token. + */ + function tsParseExportSpecifier() { + _expression.parseIdentifier.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.comma) || _index.match.call(void 0, _types.TokenType.braceR)) { + // export {foo} + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _index.IdentifierRole.ExportAccess; + return; + } + _expression.parseIdentifier.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.comma) || _index.match.call(void 0, _types.TokenType.braceR)) { + // export {type foo} + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _index.IdentifierRole.ExportAccess; + _base.state.tokens[_base.state.tokens.length - 2].isType = true; + _base.state.tokens[_base.state.tokens.length - 1].isType = true; + return; + } + _expression.parseIdentifier.call(void 0, ); + if (_index.match.call(void 0, _types.TokenType.comma) || _index.match.call(void 0, _types.TokenType.braceR)) { + // export {foo as bar} + _base.state.tokens[_base.state.tokens.length - 3].identifierRole = _index.IdentifierRole.ExportAccess; + return; + } + _expression.parseIdentifier.call(void 0, ); + // export {type foo as bar} + _base.state.tokens[_base.state.tokens.length - 3].identifierRole = _index.IdentifierRole.ExportAccess; + _base.state.tokens[_base.state.tokens.length - 4].isType = true; + _base.state.tokens[_base.state.tokens.length - 3].isType = true; + _base.state.tokens[_base.state.tokens.length - 2].isType = true; + _base.state.tokens[_base.state.tokens.length - 1].isType = true; +} exports.tsParseExportSpecifier = tsParseExportSpecifier; + + function tsTryParseExportDefaultExpression() { + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._abstract) && _index.lookaheadType.call(void 0, ) === _types.TokenType._class) { + _base.state.type = _types.TokenType._abstract; + _index.next.call(void 0, ); // Skip "abstract" + _statement.parseClass.call(void 0, true, true); + return true; + } + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._interface)) { + // Make sure "export default" are considered type tokens so the whole thing is removed. + const oldIsType = _index.pushTypeContext.call(void 0, 2); + tsParseDeclaration(_keywords.ContextualKeyword._interface, true); + _index.popTypeContext.call(void 0, oldIsType); + return true; + } + return false; +} exports.tsTryParseExportDefaultExpression = tsTryParseExportDefaultExpression; + + function tsTryParseStatementContent() { + if (_base.state.type === _types.TokenType._const) { + const ahead = _index.lookaheadTypeAndKeyword.call(void 0, ); + if (ahead.type === _types.TokenType.name && ahead.contextualKeyword === _keywords.ContextualKeyword._enum) { + _util.expect.call(void 0, _types.TokenType._const); + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._enum); + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._enum; + tsParseEnumDeclaration(); + return true; + } + } + return false; +} exports.tsTryParseStatementContent = tsTryParseStatementContent; + + function tsTryParseClassMemberWithIsStatic(isStatic) { + const memberStartIndexAfterStatic = _base.state.tokens.length; + tsParseModifiers([ + _keywords.ContextualKeyword._abstract, + _keywords.ContextualKeyword._readonly, + _keywords.ContextualKeyword._declare, + _keywords.ContextualKeyword._static, + _keywords.ContextualKeyword._override, + ]); + + const modifiersEndIndex = _base.state.tokens.length; + const found = tsTryParseIndexSignature(); + if (found) { + // Index signatures are type declarations, so set the modifier tokens as + // type tokens. Most tokens could be assumed to be type tokens, but `static` + // is ambiguous unless we set it explicitly here. + const memberStartIndex = isStatic + ? memberStartIndexAfterStatic - 1 + : memberStartIndexAfterStatic; + for (let i = memberStartIndex; i < modifiersEndIndex; i++) { + _base.state.tokens[i].isType = true; + } + return true; + } + return false; +} exports.tsTryParseClassMemberWithIsStatic = tsTryParseClassMemberWithIsStatic; + +// Note: The reason we do this in `parseIdentifierStatement` and not `parseStatement` +// is that e.g. `type()` is valid JS, so we must try parsing that first. +// If it's really a type, we will parse `type` as the statement, and can correct it here +// by parsing the rest. + function tsParseIdentifierStatement(contextualKeyword) { + const matched = tsParseExpressionStatement(contextualKeyword); + if (!matched) { + _util.semicolon.call(void 0, ); + } +} exports.tsParseIdentifierStatement = tsParseIdentifierStatement; + + function tsParseExportDeclaration() { + // "export declare" is equivalent to just "export". + const isDeclare = _util.eatContextual.call(void 0, _keywords.ContextualKeyword._declare); + if (isDeclare) { + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._declare; + } + + let matchedDeclaration = false; + if (_index.match.call(void 0, _types.TokenType.name)) { + if (isDeclare) { + const oldIsType = _index.pushTypeContext.call(void 0, 2); + matchedDeclaration = tsTryParseExportDeclaration(); + _index.popTypeContext.call(void 0, oldIsType); + } else { + matchedDeclaration = tsTryParseExportDeclaration(); + } + } + if (!matchedDeclaration) { + if (isDeclare) { + const oldIsType = _index.pushTypeContext.call(void 0, 2); + _statement.parseStatement.call(void 0, true); + _index.popTypeContext.call(void 0, oldIsType); + } else { + _statement.parseStatement.call(void 0, true); + } + } +} exports.tsParseExportDeclaration = tsParseExportDeclaration; + + function tsAfterParseClassSuper(hasSuper) { + if (hasSuper && (_index.match.call(void 0, _types.TokenType.lessThan) || _index.match.call(void 0, _types.TokenType.bitShiftL))) { + tsParseTypeArgumentsWithPossibleBitshift(); + } + if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._implements)) { + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._implements; + const oldIsType = _index.pushTypeContext.call(void 0, 1); + tsParseHeritageClause(); + _index.popTypeContext.call(void 0, oldIsType); + } +} exports.tsAfterParseClassSuper = tsAfterParseClassSuper; + + function tsStartParseObjPropValue() { + tsTryParseTypeParameters(); +} exports.tsStartParseObjPropValue = tsStartParseObjPropValue; + + function tsStartParseFunctionParams() { + tsTryParseTypeParameters(); +} exports.tsStartParseFunctionParams = tsStartParseFunctionParams; + +// `let x: number;` + function tsAfterParseVarHead() { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + if (!_util.hasPrecedingLineBreak.call(void 0, )) { + _index.eat.call(void 0, _types.TokenType.bang); + } + tsTryParseTypeAnnotation(); + _index.popTypeContext.call(void 0, oldIsType); +} exports.tsAfterParseVarHead = tsAfterParseVarHead; + +// parse the return type of an async arrow function - let foo = (async (): number => {}); + function tsStartParseAsyncArrowFromCallExpression() { + if (_index.match.call(void 0, _types.TokenType.colon)) { + tsParseTypeAnnotation(); + } +} exports.tsStartParseAsyncArrowFromCallExpression = tsStartParseAsyncArrowFromCallExpression; + +// Returns true if the expression was an arrow function. + function tsParseMaybeAssign(noIn, isWithinParens) { + // Note: When the JSX plugin is on, type assertions (` x`) aren't valid syntax. + if (_base.isJSXEnabled) { + return tsParseMaybeAssignWithJSX(noIn, isWithinParens); + } else { + return tsParseMaybeAssignWithoutJSX(noIn, isWithinParens); + } +} exports.tsParseMaybeAssign = tsParseMaybeAssign; + + function tsParseMaybeAssignWithJSX(noIn, isWithinParens) { + if (!_index.match.call(void 0, _types.TokenType.lessThan)) { + return _expression.baseParseMaybeAssign.call(void 0, noIn, isWithinParens); + } + + // Prefer to parse JSX if possible. But may be an arrow fn. + const snapshot = _base.state.snapshot(); + let wasArrow = _expression.baseParseMaybeAssign.call(void 0, noIn, isWithinParens); + if (_base.state.error) { + _base.state.restoreFromSnapshot(snapshot); + } else { + return wasArrow; + } + + // Otherwise, try as type-parameterized arrow function. + _base.state.type = _types.TokenType.typeParameterStart; + // This is similar to TypeScript's `tryParseParenthesizedArrowFunctionExpression`. + tsParseTypeParameters(); + wasArrow = _expression.baseParseMaybeAssign.call(void 0, noIn, isWithinParens); + if (!wasArrow) { + _util.unexpected.call(void 0, ); + } + + return wasArrow; +} exports.tsParseMaybeAssignWithJSX = tsParseMaybeAssignWithJSX; + + function tsParseMaybeAssignWithoutJSX(noIn, isWithinParens) { + if (!_index.match.call(void 0, _types.TokenType.lessThan)) { + return _expression.baseParseMaybeAssign.call(void 0, noIn, isWithinParens); + } + + const snapshot = _base.state.snapshot(); + // This is similar to TypeScript's `tryParseParenthesizedArrowFunctionExpression`. + tsParseTypeParameters(); + const wasArrow = _expression.baseParseMaybeAssign.call(void 0, noIn, isWithinParens); + if (!wasArrow) { + _util.unexpected.call(void 0, ); + } + if (_base.state.error) { + _base.state.restoreFromSnapshot(snapshot); + } else { + return wasArrow; + } + + // Try parsing a type cast instead of an arrow function. + // This will start with a type assertion (via parseMaybeUnary). + // But don't directly call `tsParseTypeAssertion` because we want to handle any binary after it. + return _expression.baseParseMaybeAssign.call(void 0, noIn, isWithinParens); +} exports.tsParseMaybeAssignWithoutJSX = tsParseMaybeAssignWithoutJSX; + + function tsParseArrow() { + if (_index.match.call(void 0, _types.TokenType.colon)) { + // This is different from how the TS parser does it. + // TS uses lookahead. Babylon parses it as a parenthesized expression and converts. + const snapshot = _base.state.snapshot(); + + tsParseTypeOrTypePredicateAnnotation(_types.TokenType.colon); + if (_util.canInsertSemicolon.call(void 0, )) _util.unexpected.call(void 0, ); + if (!_index.match.call(void 0, _types.TokenType.arrow)) _util.unexpected.call(void 0, ); + + if (_base.state.error) { + _base.state.restoreFromSnapshot(snapshot); + } + } + return _index.eat.call(void 0, _types.TokenType.arrow); +} exports.tsParseArrow = tsParseArrow; + +// Allow type annotations inside of a parameter list. + function tsParseAssignableListItemTypes() { + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _index.eat.call(void 0, _types.TokenType.question); + tsTryParseTypeAnnotation(); + _index.popTypeContext.call(void 0, oldIsType); +} exports.tsParseAssignableListItemTypes = tsParseAssignableListItemTypes; + + function tsParseMaybeDecoratorArguments() { + if (_index.match.call(void 0, _types.TokenType.lessThan) || _index.match.call(void 0, _types.TokenType.bitShiftL)) { + tsParseTypeArgumentsWithPossibleBitshift(); + } + _statement.baseParseMaybeDecoratorArguments.call(void 0, ); +} exports.tsParseMaybeDecoratorArguments = tsParseMaybeDecoratorArguments; diff --git a/node_modules/sucrase/dist/parser/tokenizer/index.js b/node_modules/sucrase/dist/parser/tokenizer/index.js new file mode 100644 index 00000000..84f5e142 --- /dev/null +++ b/node_modules/sucrase/dist/parser/tokenizer/index.js @@ -0,0 +1,1004 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/* eslint max-len: 0 */ + +var _base = require('../traverser/base'); +var _util = require('../traverser/util'); +var _charcodes = require('../util/charcodes'); +var _identifier = require('../util/identifier'); +var _whitespace = require('../util/whitespace'); +var _keywords = require('./keywords'); +var _readWord = require('./readWord'); var _readWord2 = _interopRequireDefault(_readWord); +var _types = require('./types'); + +var IdentifierRole; (function (IdentifierRole) { + const Access = 0; IdentifierRole[IdentifierRole["Access"] = Access] = "Access"; + const ExportAccess = Access + 1; IdentifierRole[IdentifierRole["ExportAccess"] = ExportAccess] = "ExportAccess"; + const TopLevelDeclaration = ExportAccess + 1; IdentifierRole[IdentifierRole["TopLevelDeclaration"] = TopLevelDeclaration] = "TopLevelDeclaration"; + const FunctionScopedDeclaration = TopLevelDeclaration + 1; IdentifierRole[IdentifierRole["FunctionScopedDeclaration"] = FunctionScopedDeclaration] = "FunctionScopedDeclaration"; + const BlockScopedDeclaration = FunctionScopedDeclaration + 1; IdentifierRole[IdentifierRole["BlockScopedDeclaration"] = BlockScopedDeclaration] = "BlockScopedDeclaration"; + const ObjectShorthandTopLevelDeclaration = BlockScopedDeclaration + 1; IdentifierRole[IdentifierRole["ObjectShorthandTopLevelDeclaration"] = ObjectShorthandTopLevelDeclaration] = "ObjectShorthandTopLevelDeclaration"; + const ObjectShorthandFunctionScopedDeclaration = ObjectShorthandTopLevelDeclaration + 1; IdentifierRole[IdentifierRole["ObjectShorthandFunctionScopedDeclaration"] = ObjectShorthandFunctionScopedDeclaration] = "ObjectShorthandFunctionScopedDeclaration"; + const ObjectShorthandBlockScopedDeclaration = ObjectShorthandFunctionScopedDeclaration + 1; IdentifierRole[IdentifierRole["ObjectShorthandBlockScopedDeclaration"] = ObjectShorthandBlockScopedDeclaration] = "ObjectShorthandBlockScopedDeclaration"; + const ObjectShorthand = ObjectShorthandBlockScopedDeclaration + 1; IdentifierRole[IdentifierRole["ObjectShorthand"] = ObjectShorthand] = "ObjectShorthand"; + // Any identifier bound in an import statement, e.g. both A and b from + // `import A, * as b from 'A';` + const ImportDeclaration = ObjectShorthand + 1; IdentifierRole[IdentifierRole["ImportDeclaration"] = ImportDeclaration] = "ImportDeclaration"; + const ObjectKey = ImportDeclaration + 1; IdentifierRole[IdentifierRole["ObjectKey"] = ObjectKey] = "ObjectKey"; + // The `foo` in `import {foo as bar} from "./abc";`. + const ImportAccess = ObjectKey + 1; IdentifierRole[IdentifierRole["ImportAccess"] = ImportAccess] = "ImportAccess"; +})(IdentifierRole || (exports.IdentifierRole = IdentifierRole = {})); + +/** + * Extra information on jsxTagStart tokens, used to determine which of the three + * jsx functions are called in the automatic transform. + */ +var JSXRole; (function (JSXRole) { + // The element is self-closing or has a body that resolves to empty. We + // shouldn't emit children at all in this case. + const NoChildren = 0; JSXRole[JSXRole["NoChildren"] = NoChildren] = "NoChildren"; + // The element has a single explicit child, which might still be an arbitrary + // expression like an array. We should emit that expression as the children. + const OneChild = NoChildren + 1; JSXRole[JSXRole["OneChild"] = OneChild] = "OneChild"; + // The element has at least two explicitly-specified children or has spread + // children, so child positions are assumed to be "static". We should wrap + // these children in an array. + const StaticChildren = OneChild + 1; JSXRole[JSXRole["StaticChildren"] = StaticChildren] = "StaticChildren"; + // The element has a prop named "key" after a prop spread, so we should fall + // back to the createElement function. + const KeyAfterPropSpread = StaticChildren + 1; JSXRole[JSXRole["KeyAfterPropSpread"] = KeyAfterPropSpread] = "KeyAfterPropSpread"; +})(JSXRole || (exports.JSXRole = JSXRole = {})); + + function isDeclaration(token) { + const role = token.identifierRole; + return ( + role === IdentifierRole.TopLevelDeclaration || + role === IdentifierRole.FunctionScopedDeclaration || + role === IdentifierRole.BlockScopedDeclaration || + role === IdentifierRole.ObjectShorthandTopLevelDeclaration || + role === IdentifierRole.ObjectShorthandFunctionScopedDeclaration || + role === IdentifierRole.ObjectShorthandBlockScopedDeclaration + ); +} exports.isDeclaration = isDeclaration; + + function isNonTopLevelDeclaration(token) { + const role = token.identifierRole; + return ( + role === IdentifierRole.FunctionScopedDeclaration || + role === IdentifierRole.BlockScopedDeclaration || + role === IdentifierRole.ObjectShorthandFunctionScopedDeclaration || + role === IdentifierRole.ObjectShorthandBlockScopedDeclaration + ); +} exports.isNonTopLevelDeclaration = isNonTopLevelDeclaration; + + function isTopLevelDeclaration(token) { + const role = token.identifierRole; + return ( + role === IdentifierRole.TopLevelDeclaration || + role === IdentifierRole.ObjectShorthandTopLevelDeclaration || + role === IdentifierRole.ImportDeclaration + ); +} exports.isTopLevelDeclaration = isTopLevelDeclaration; + + function isBlockScopedDeclaration(token) { + const role = token.identifierRole; + // Treat top-level declarations as block scope since the distinction doesn't matter here. + return ( + role === IdentifierRole.TopLevelDeclaration || + role === IdentifierRole.BlockScopedDeclaration || + role === IdentifierRole.ObjectShorthandTopLevelDeclaration || + role === IdentifierRole.ObjectShorthandBlockScopedDeclaration + ); +} exports.isBlockScopedDeclaration = isBlockScopedDeclaration; + + function isFunctionScopedDeclaration(token) { + const role = token.identifierRole; + return ( + role === IdentifierRole.FunctionScopedDeclaration || + role === IdentifierRole.ObjectShorthandFunctionScopedDeclaration + ); +} exports.isFunctionScopedDeclaration = isFunctionScopedDeclaration; + + function isObjectShorthandDeclaration(token) { + return ( + token.identifierRole === IdentifierRole.ObjectShorthandTopLevelDeclaration || + token.identifierRole === IdentifierRole.ObjectShorthandBlockScopedDeclaration || + token.identifierRole === IdentifierRole.ObjectShorthandFunctionScopedDeclaration + ); +} exports.isObjectShorthandDeclaration = isObjectShorthandDeclaration; + +// Object type used to represent tokens. Note that normally, tokens +// simply exist as properties on the parser object. This is only +// used for the onToken callback and the external tokenizer. + class Token { + constructor() { + this.type = _base.state.type; + this.contextualKeyword = _base.state.contextualKeyword; + this.start = _base.state.start; + this.end = _base.state.end; + this.scopeDepth = _base.state.scopeDepth; + this.isType = _base.state.isType; + this.identifierRole = null; + this.jsxRole = null; + this.shadowsGlobal = false; + this.isAsyncOperation = false; + this.contextId = null; + this.rhsEndIndex = null; + this.isExpression = false; + this.numNullishCoalesceStarts = 0; + this.numNullishCoalesceEnds = 0; + this.isOptionalChainStart = false; + this.isOptionalChainEnd = false; + this.subscriptStartIndex = null; + this.nullishStartIndex = null; + } + + + + + + + + + + // Initially false for all tokens, then may be computed in a follow-up step that does scope + // analysis. + + // Initially false for all tokens, but may be set during transform to mark it as containing an + // await operation. + + + // For assignments, the index of the RHS. For export tokens, the end of the export. + + // For class tokens, records if the class is a class expression or a class statement. + + // Number of times to insert a `nullishCoalesce(` snippet before this token. + + // Number of times to insert a `)` snippet after this token. + + // If true, insert an `optionalChain([` snippet before this token. + + // If true, insert a `])` snippet after this token. + + // Tag for `.`, `?.`, `[`, `?.[`, `(`, and `?.(` to denote the "root" token for this + // subscript chain. This can be used to determine if this chain is an optional chain. + + // Tag for `??` operators to denote the root token for this nullish coalescing call. + +} exports.Token = Token; + +// ## Tokenizer + +// Move to the next token + function next() { + _base.state.tokens.push(new Token()); + nextToken(); +} exports.next = next; + +// Call instead of next when inside a template, since that needs to be handled differently. + function nextTemplateToken() { + _base.state.tokens.push(new Token()); + _base.state.start = _base.state.pos; + readTmplToken(); +} exports.nextTemplateToken = nextTemplateToken; + +// The tokenizer never parses regexes by default. Instead, the parser is responsible for +// instructing it to parse a regex when we see a slash at the start of an expression. + function retokenizeSlashAsRegex() { + if (_base.state.type === _types.TokenType.assign) { + --_base.state.pos; + } + readRegexp(); +} exports.retokenizeSlashAsRegex = retokenizeSlashAsRegex; + + function pushTypeContext(existingTokensInType) { + for (let i = _base.state.tokens.length - existingTokensInType; i < _base.state.tokens.length; i++) { + _base.state.tokens[i].isType = true; + } + const oldIsType = _base.state.isType; + _base.state.isType = true; + return oldIsType; +} exports.pushTypeContext = pushTypeContext; + + function popTypeContext(oldIsType) { + _base.state.isType = oldIsType; +} exports.popTypeContext = popTypeContext; + + function eat(type) { + if (match(type)) { + next(); + return true; + } else { + return false; + } +} exports.eat = eat; + + function eatTypeToken(tokenType) { + const oldIsType = _base.state.isType; + _base.state.isType = true; + eat(tokenType); + _base.state.isType = oldIsType; +} exports.eatTypeToken = eatTypeToken; + + function match(type) { + return _base.state.type === type; +} exports.match = match; + + function lookaheadType() { + const snapshot = _base.state.snapshot(); + next(); + const type = _base.state.type; + _base.state.restoreFromSnapshot(snapshot); + return type; +} exports.lookaheadType = lookaheadType; + + class TypeAndKeyword { + + + constructor(type, contextualKeyword) { + this.type = type; + this.contextualKeyword = contextualKeyword; + } +} exports.TypeAndKeyword = TypeAndKeyword; + + function lookaheadTypeAndKeyword() { + const snapshot = _base.state.snapshot(); + next(); + const type = _base.state.type; + const contextualKeyword = _base.state.contextualKeyword; + _base.state.restoreFromSnapshot(snapshot); + return new TypeAndKeyword(type, contextualKeyword); +} exports.lookaheadTypeAndKeyword = lookaheadTypeAndKeyword; + + function nextTokenStart() { + return nextTokenStartSince(_base.state.pos); +} exports.nextTokenStart = nextTokenStart; + + function nextTokenStartSince(pos) { + _whitespace.skipWhiteSpace.lastIndex = pos; + const skip = _whitespace.skipWhiteSpace.exec(_base.input); + return pos + skip[0].length; +} exports.nextTokenStartSince = nextTokenStartSince; + + function lookaheadCharCode() { + return _base.input.charCodeAt(nextTokenStart()); +} exports.lookaheadCharCode = lookaheadCharCode; + +// Read a single token, updating the parser object's token-related +// properties. + function nextToken() { + skipSpace(); + _base.state.start = _base.state.pos; + if (_base.state.pos >= _base.input.length) { + const tokens = _base.state.tokens; + // We normally run past the end a bit, but if we're way past the end, avoid an infinite loop. + // Also check the token positions rather than the types since sometimes we rewrite the token + // type to something else. + if ( + tokens.length >= 2 && + tokens[tokens.length - 1].start >= _base.input.length && + tokens[tokens.length - 2].start >= _base.input.length + ) { + _util.unexpected.call(void 0, "Unexpectedly reached the end of input."); + } + finishToken(_types.TokenType.eof); + return; + } + readToken(_base.input.charCodeAt(_base.state.pos)); +} exports.nextToken = nextToken; + +function readToken(code) { + // Identifier or keyword. '\uXXXX' sequences are allowed in + // identifiers, so '\' also dispatches to that. + if ( + _identifier.IS_IDENTIFIER_START[code] || + code === _charcodes.charCodes.backslash || + (code === _charcodes.charCodes.atSign && _base.input.charCodeAt(_base.state.pos + 1) === _charcodes.charCodes.atSign) + ) { + _readWord2.default.call(void 0, ); + } else { + getTokenFromCode(code); + } +} + +function skipBlockComment() { + while ( + _base.input.charCodeAt(_base.state.pos) !== _charcodes.charCodes.asterisk || + _base.input.charCodeAt(_base.state.pos + 1) !== _charcodes.charCodes.slash + ) { + _base.state.pos++; + if (_base.state.pos > _base.input.length) { + _util.unexpected.call(void 0, "Unterminated comment", _base.state.pos - 2); + return; + } + } + _base.state.pos += 2; +} + + function skipLineComment(startSkip) { + let ch = _base.input.charCodeAt((_base.state.pos += startSkip)); + if (_base.state.pos < _base.input.length) { + while ( + ch !== _charcodes.charCodes.lineFeed && + ch !== _charcodes.charCodes.carriageReturn && + ch !== _charcodes.charCodes.lineSeparator && + ch !== _charcodes.charCodes.paragraphSeparator && + ++_base.state.pos < _base.input.length + ) { + ch = _base.input.charCodeAt(_base.state.pos); + } + } +} exports.skipLineComment = skipLineComment; + +// Called at the start of the parse and after every token. Skips +// whitespace and comments. + function skipSpace() { + while (_base.state.pos < _base.input.length) { + const ch = _base.input.charCodeAt(_base.state.pos); + switch (ch) { + case _charcodes.charCodes.carriageReturn: + if (_base.input.charCodeAt(_base.state.pos + 1) === _charcodes.charCodes.lineFeed) { + ++_base.state.pos; + } + + case _charcodes.charCodes.lineFeed: + case _charcodes.charCodes.lineSeparator: + case _charcodes.charCodes.paragraphSeparator: + ++_base.state.pos; + break; + + case _charcodes.charCodes.slash: + switch (_base.input.charCodeAt(_base.state.pos + 1)) { + case _charcodes.charCodes.asterisk: + _base.state.pos += 2; + skipBlockComment(); + break; + + case _charcodes.charCodes.slash: + skipLineComment(2); + break; + + default: + return; + } + break; + + default: + if (_whitespace.IS_WHITESPACE[ch]) { + ++_base.state.pos; + } else { + return; + } + } + } +} exports.skipSpace = skipSpace; + +// Called at the end of every token. Sets various fields, and skips the space after the token, so +// that the next one's `start` will point at the right position. + function finishToken( + type, + contextualKeyword = _keywords.ContextualKeyword.NONE, +) { + _base.state.end = _base.state.pos; + _base.state.type = type; + _base.state.contextualKeyword = contextualKeyword; +} exports.finishToken = finishToken; + +// ### Token reading + +// This is the function that is called to fetch the next token. It +// is somewhat obscure, because it works in character codes rather +// than characters, and because operator parsing has been inlined +// into it. +// +// All in the name of speed. +function readToken_dot() { + const nextChar = _base.input.charCodeAt(_base.state.pos + 1); + if (nextChar >= _charcodes.charCodes.digit0 && nextChar <= _charcodes.charCodes.digit9) { + readNumber(true); + return; + } + + if (nextChar === _charcodes.charCodes.dot && _base.input.charCodeAt(_base.state.pos + 2) === _charcodes.charCodes.dot) { + _base.state.pos += 3; + finishToken(_types.TokenType.ellipsis); + } else { + ++_base.state.pos; + finishToken(_types.TokenType.dot); + } +} + +function readToken_slash() { + const nextChar = _base.input.charCodeAt(_base.state.pos + 1); + if (nextChar === _charcodes.charCodes.equalsTo) { + finishOp(_types.TokenType.assign, 2); + } else { + finishOp(_types.TokenType.slash, 1); + } +} + +function readToken_mult_modulo(code) { + // '%*' + let tokenType = code === _charcodes.charCodes.asterisk ? _types.TokenType.star : _types.TokenType.modulo; + let width = 1; + let nextChar = _base.input.charCodeAt(_base.state.pos + 1); + + // Exponentiation operator ** + if (code === _charcodes.charCodes.asterisk && nextChar === _charcodes.charCodes.asterisk) { + width++; + nextChar = _base.input.charCodeAt(_base.state.pos + 2); + tokenType = _types.TokenType.exponent; + } + + // Match *= or %=, disallowing *=> which can be valid in flow. + if ( + nextChar === _charcodes.charCodes.equalsTo && + _base.input.charCodeAt(_base.state.pos + 2) !== _charcodes.charCodes.greaterThan + ) { + width++; + tokenType = _types.TokenType.assign; + } + + finishOp(tokenType, width); +} + +function readToken_pipe_amp(code) { + // '|&' + const nextChar = _base.input.charCodeAt(_base.state.pos + 1); + + if (nextChar === code) { + if (_base.input.charCodeAt(_base.state.pos + 2) === _charcodes.charCodes.equalsTo) { + // ||= or &&= + finishOp(_types.TokenType.assign, 3); + } else { + // || or && + finishOp(code === _charcodes.charCodes.verticalBar ? _types.TokenType.logicalOR : _types.TokenType.logicalAND, 2); + } + return; + } + + if (code === _charcodes.charCodes.verticalBar) { + // '|>' + if (nextChar === _charcodes.charCodes.greaterThan) { + finishOp(_types.TokenType.pipeline, 2); + return; + } else if (nextChar === _charcodes.charCodes.rightCurlyBrace && _base.isFlowEnabled) { + // '|}' + finishOp(_types.TokenType.braceBarR, 2); + return; + } + } + + if (nextChar === _charcodes.charCodes.equalsTo) { + finishOp(_types.TokenType.assign, 2); + return; + } + + finishOp(code === _charcodes.charCodes.verticalBar ? _types.TokenType.bitwiseOR : _types.TokenType.bitwiseAND, 1); +} + +function readToken_caret() { + // '^' + const nextChar = _base.input.charCodeAt(_base.state.pos + 1); + if (nextChar === _charcodes.charCodes.equalsTo) { + finishOp(_types.TokenType.assign, 2); + } else { + finishOp(_types.TokenType.bitwiseXOR, 1); + } +} + +function readToken_plus_min(code) { + // '+-' + const nextChar = _base.input.charCodeAt(_base.state.pos + 1); + + if (nextChar === code) { + // Tentatively call this a prefix operator, but it might be changed to postfix later. + finishOp(_types.TokenType.preIncDec, 2); + return; + } + + if (nextChar === _charcodes.charCodes.equalsTo) { + finishOp(_types.TokenType.assign, 2); + } else if (code === _charcodes.charCodes.plusSign) { + finishOp(_types.TokenType.plus, 1); + } else { + finishOp(_types.TokenType.minus, 1); + } +} + +function readToken_lt() { + const nextChar = _base.input.charCodeAt(_base.state.pos + 1); + + if (nextChar === _charcodes.charCodes.lessThan) { + if (_base.input.charCodeAt(_base.state.pos + 2) === _charcodes.charCodes.equalsTo) { + finishOp(_types.TokenType.assign, 3); + return; + } + // We see <<, but need to be really careful about whether to treat it as a + // true left-shift or as two < tokens. + if (_base.state.isType) { + // Within a type, << might come up in a snippet like `Array<() => void>`, + // so treat it as two < tokens. Importantly, this should only override << + // rather than other tokens like <= . If we treated <= as < in a type + // context, then the snippet `a as T <= 1` would incorrectly start parsing + // a type argument on T. We don't need to worry about `a as T << 1` + // because TypeScript disallows that syntax. + finishOp(_types.TokenType.lessThan, 1); + } else { + // Outside a type, this might be a true left-shift operator, or it might + // still be two open-type-arg tokens, such as in `f<() => void>()`. We + // look at the token while considering the `f`, so we don't yet know that + // we're in a type context. In this case, we initially tokenize as a + // left-shift and correct after-the-fact as necessary in + // tsParseTypeArgumentsWithPossibleBitshift . + finishOp(_types.TokenType.bitShiftL, 2); + } + return; + } + + if (nextChar === _charcodes.charCodes.equalsTo) { + // <= + finishOp(_types.TokenType.relationalOrEqual, 2); + } else { + finishOp(_types.TokenType.lessThan, 1); + } +} + +function readToken_gt() { + if (_base.state.isType) { + // Avoid right-shift for things like `Array>` and + // greater-than-or-equal for things like `const a: Array=[];`. + finishOp(_types.TokenType.greaterThan, 1); + return; + } + + const nextChar = _base.input.charCodeAt(_base.state.pos + 1); + + if (nextChar === _charcodes.charCodes.greaterThan) { + const size = _base.input.charCodeAt(_base.state.pos + 2) === _charcodes.charCodes.greaterThan ? 3 : 2; + if (_base.input.charCodeAt(_base.state.pos + size) === _charcodes.charCodes.equalsTo) { + finishOp(_types.TokenType.assign, size + 1); + return; + } + finishOp(_types.TokenType.bitShiftR, size); + return; + } + + if (nextChar === _charcodes.charCodes.equalsTo) { + // >= + finishOp(_types.TokenType.relationalOrEqual, 2); + } else { + finishOp(_types.TokenType.greaterThan, 1); + } +} + +/** + * Reinterpret a possible > token when transitioning from a type to a non-type + * context. + * + * This comes up in two situations where >= needs to be treated as one token: + * - After an `as` expression, like in the code `a as T >= 1`. + * - In a type argument in an expression context, e.g. `f(a < b, c >= d)`, we + * need to see the token as >= so that we get an error and backtrack to + * normal expression parsing. + * + * Other situations require >= to be seen as two tokens, e.g. + * `const x: Array=[];`, so it's important to treat > as its own token in + * typical type parsing situations. + */ + function rescan_gt() { + if (_base.state.type === _types.TokenType.greaterThan) { + _base.state.pos -= 1; + readToken_gt(); + } +} exports.rescan_gt = rescan_gt; + +function readToken_eq_excl(code) { + // '=!' + const nextChar = _base.input.charCodeAt(_base.state.pos + 1); + if (nextChar === _charcodes.charCodes.equalsTo) { + finishOp(_types.TokenType.equality, _base.input.charCodeAt(_base.state.pos + 2) === _charcodes.charCodes.equalsTo ? 3 : 2); + return; + } + if (code === _charcodes.charCodes.equalsTo && nextChar === _charcodes.charCodes.greaterThan) { + // '=>' + _base.state.pos += 2; + finishToken(_types.TokenType.arrow); + return; + } + finishOp(code === _charcodes.charCodes.equalsTo ? _types.TokenType.eq : _types.TokenType.bang, 1); +} + +function readToken_question() { + // '?' + const nextChar = _base.input.charCodeAt(_base.state.pos + 1); + const nextChar2 = _base.input.charCodeAt(_base.state.pos + 2); + if ( + nextChar === _charcodes.charCodes.questionMark && + // In Flow (but not TypeScript), ??string is a valid type that should be + // tokenized as two individual ? tokens. + !(_base.isFlowEnabled && _base.state.isType) + ) { + if (nextChar2 === _charcodes.charCodes.equalsTo) { + // '??=' + finishOp(_types.TokenType.assign, 3); + } else { + // '??' + finishOp(_types.TokenType.nullishCoalescing, 2); + } + } else if ( + nextChar === _charcodes.charCodes.dot && + !(nextChar2 >= _charcodes.charCodes.digit0 && nextChar2 <= _charcodes.charCodes.digit9) + ) { + // '.' not followed by a number + _base.state.pos += 2; + finishToken(_types.TokenType.questionDot); + } else { + ++_base.state.pos; + finishToken(_types.TokenType.question); + } +} + + function getTokenFromCode(code) { + switch (code) { + case _charcodes.charCodes.numberSign: + ++_base.state.pos; + finishToken(_types.TokenType.hash); + return; + + // The interpretation of a dot depends on whether it is followed + // by a digit or another two dots. + + case _charcodes.charCodes.dot: + readToken_dot(); + return; + + // Punctuation tokens. + case _charcodes.charCodes.leftParenthesis: + ++_base.state.pos; + finishToken(_types.TokenType.parenL); + return; + case _charcodes.charCodes.rightParenthesis: + ++_base.state.pos; + finishToken(_types.TokenType.parenR); + return; + case _charcodes.charCodes.semicolon: + ++_base.state.pos; + finishToken(_types.TokenType.semi); + return; + case _charcodes.charCodes.comma: + ++_base.state.pos; + finishToken(_types.TokenType.comma); + return; + case _charcodes.charCodes.leftSquareBracket: + ++_base.state.pos; + finishToken(_types.TokenType.bracketL); + return; + case _charcodes.charCodes.rightSquareBracket: + ++_base.state.pos; + finishToken(_types.TokenType.bracketR); + return; + + case _charcodes.charCodes.leftCurlyBrace: + if (_base.isFlowEnabled && _base.input.charCodeAt(_base.state.pos + 1) === _charcodes.charCodes.verticalBar) { + finishOp(_types.TokenType.braceBarL, 2); + } else { + ++_base.state.pos; + finishToken(_types.TokenType.braceL); + } + return; + + case _charcodes.charCodes.rightCurlyBrace: + ++_base.state.pos; + finishToken(_types.TokenType.braceR); + return; + + case _charcodes.charCodes.colon: + if (_base.input.charCodeAt(_base.state.pos + 1) === _charcodes.charCodes.colon) { + finishOp(_types.TokenType.doubleColon, 2); + } else { + ++_base.state.pos; + finishToken(_types.TokenType.colon); + } + return; + + case _charcodes.charCodes.questionMark: + readToken_question(); + return; + case _charcodes.charCodes.atSign: + ++_base.state.pos; + finishToken(_types.TokenType.at); + return; + + case _charcodes.charCodes.graveAccent: + ++_base.state.pos; + finishToken(_types.TokenType.backQuote); + return; + + case _charcodes.charCodes.digit0: { + const nextChar = _base.input.charCodeAt(_base.state.pos + 1); + // '0x', '0X', '0o', '0O', '0b', '0B' + if ( + nextChar === _charcodes.charCodes.lowercaseX || + nextChar === _charcodes.charCodes.uppercaseX || + nextChar === _charcodes.charCodes.lowercaseO || + nextChar === _charcodes.charCodes.uppercaseO || + nextChar === _charcodes.charCodes.lowercaseB || + nextChar === _charcodes.charCodes.uppercaseB + ) { + readRadixNumber(); + return; + } + } + // Anything else beginning with a digit is an integer, octal + // number, or float. + case _charcodes.charCodes.digit1: + case _charcodes.charCodes.digit2: + case _charcodes.charCodes.digit3: + case _charcodes.charCodes.digit4: + case _charcodes.charCodes.digit5: + case _charcodes.charCodes.digit6: + case _charcodes.charCodes.digit7: + case _charcodes.charCodes.digit8: + case _charcodes.charCodes.digit9: + readNumber(false); + return; + + // Quotes produce strings. + case _charcodes.charCodes.quotationMark: + case _charcodes.charCodes.apostrophe: + readString(code); + return; + + // Operators are parsed inline in tiny state machines. '=' (charCodes.equalsTo) is + // often referred to. `finishOp` simply skips the amount of + // characters it is given as second argument, and returns a token + // of the type given by its first argument. + + case _charcodes.charCodes.slash: + readToken_slash(); + return; + + case _charcodes.charCodes.percentSign: + case _charcodes.charCodes.asterisk: + readToken_mult_modulo(code); + return; + + case _charcodes.charCodes.verticalBar: + case _charcodes.charCodes.ampersand: + readToken_pipe_amp(code); + return; + + case _charcodes.charCodes.caret: + readToken_caret(); + return; + + case _charcodes.charCodes.plusSign: + case _charcodes.charCodes.dash: + readToken_plus_min(code); + return; + + case _charcodes.charCodes.lessThan: + readToken_lt(); + return; + + case _charcodes.charCodes.greaterThan: + readToken_gt(); + return; + + case _charcodes.charCodes.equalsTo: + case _charcodes.charCodes.exclamationMark: + readToken_eq_excl(code); + return; + + case _charcodes.charCodes.tilde: + finishOp(_types.TokenType.tilde, 1); + return; + + default: + break; + } + + _util.unexpected.call(void 0, `Unexpected character '${String.fromCharCode(code)}'`, _base.state.pos); +} exports.getTokenFromCode = getTokenFromCode; + +function finishOp(type, size) { + _base.state.pos += size; + finishToken(type); +} + +function readRegexp() { + const start = _base.state.pos; + let escaped = false; + let inClass = false; + for (;;) { + if (_base.state.pos >= _base.input.length) { + _util.unexpected.call(void 0, "Unterminated regular expression", start); + return; + } + const code = _base.input.charCodeAt(_base.state.pos); + if (escaped) { + escaped = false; + } else { + if (code === _charcodes.charCodes.leftSquareBracket) { + inClass = true; + } else if (code === _charcodes.charCodes.rightSquareBracket && inClass) { + inClass = false; + } else if (code === _charcodes.charCodes.slash && !inClass) { + break; + } + escaped = code === _charcodes.charCodes.backslash; + } + ++_base.state.pos; + } + ++_base.state.pos; + // Need to use `skipWord` because '\uXXXX' sequences are allowed here (don't ask). + skipWord(); + + finishToken(_types.TokenType.regexp); +} + +/** + * Read a decimal integer. Note that this can't be unified with the similar code + * in readRadixNumber (which also handles hex digits) because "e" needs to be + * the end of the integer so that we can properly handle scientific notation. + */ +function readInt() { + while (true) { + const code = _base.input.charCodeAt(_base.state.pos); + if ((code >= _charcodes.charCodes.digit0 && code <= _charcodes.charCodes.digit9) || code === _charcodes.charCodes.underscore) { + _base.state.pos++; + } else { + break; + } + } +} + +function readRadixNumber() { + _base.state.pos += 2; // 0x + + // Walk to the end of the number, allowing hex digits. + while (true) { + const code = _base.input.charCodeAt(_base.state.pos); + if ( + (code >= _charcodes.charCodes.digit0 && code <= _charcodes.charCodes.digit9) || + (code >= _charcodes.charCodes.lowercaseA && code <= _charcodes.charCodes.lowercaseF) || + (code >= _charcodes.charCodes.uppercaseA && code <= _charcodes.charCodes.uppercaseF) || + code === _charcodes.charCodes.underscore + ) { + _base.state.pos++; + } else { + break; + } + } + + const nextChar = _base.input.charCodeAt(_base.state.pos); + if (nextChar === _charcodes.charCodes.lowercaseN) { + ++_base.state.pos; + finishToken(_types.TokenType.bigint); + } else { + finishToken(_types.TokenType.num); + } +} + +// Read an integer, octal integer, or floating-point number. +function readNumber(startsWithDot) { + let isBigInt = false; + let isDecimal = false; + + if (!startsWithDot) { + readInt(); + } + + let nextChar = _base.input.charCodeAt(_base.state.pos); + if (nextChar === _charcodes.charCodes.dot) { + ++_base.state.pos; + readInt(); + nextChar = _base.input.charCodeAt(_base.state.pos); + } + + if (nextChar === _charcodes.charCodes.uppercaseE || nextChar === _charcodes.charCodes.lowercaseE) { + nextChar = _base.input.charCodeAt(++_base.state.pos); + if (nextChar === _charcodes.charCodes.plusSign || nextChar === _charcodes.charCodes.dash) { + ++_base.state.pos; + } + readInt(); + nextChar = _base.input.charCodeAt(_base.state.pos); + } + + if (nextChar === _charcodes.charCodes.lowercaseN) { + ++_base.state.pos; + isBigInt = true; + } else if (nextChar === _charcodes.charCodes.lowercaseM) { + ++_base.state.pos; + isDecimal = true; + } + + if (isBigInt) { + finishToken(_types.TokenType.bigint); + return; + } + + if (isDecimal) { + finishToken(_types.TokenType.decimal); + return; + } + + finishToken(_types.TokenType.num); +} + +function readString(quote) { + _base.state.pos++; + for (;;) { + if (_base.state.pos >= _base.input.length) { + _util.unexpected.call(void 0, "Unterminated string constant"); + return; + } + const ch = _base.input.charCodeAt(_base.state.pos); + if (ch === _charcodes.charCodes.backslash) { + _base.state.pos++; + } else if (ch === quote) { + break; + } + _base.state.pos++; + } + _base.state.pos++; + finishToken(_types.TokenType.string); +} + +// Reads template string tokens. +function readTmplToken() { + for (;;) { + if (_base.state.pos >= _base.input.length) { + _util.unexpected.call(void 0, "Unterminated template"); + return; + } + const ch = _base.input.charCodeAt(_base.state.pos); + if ( + ch === _charcodes.charCodes.graveAccent || + (ch === _charcodes.charCodes.dollarSign && _base.input.charCodeAt(_base.state.pos + 1) === _charcodes.charCodes.leftCurlyBrace) + ) { + if (_base.state.pos === _base.state.start && match(_types.TokenType.template)) { + if (ch === _charcodes.charCodes.dollarSign) { + _base.state.pos += 2; + finishToken(_types.TokenType.dollarBraceL); + return; + } else { + ++_base.state.pos; + finishToken(_types.TokenType.backQuote); + return; + } + } + finishToken(_types.TokenType.template); + return; + } + if (ch === _charcodes.charCodes.backslash) { + _base.state.pos++; + } + _base.state.pos++; + } +} + +// Skip to the end of the current word. Note that this is the same as the snippet at the end of +// readWord, but calling skipWord from readWord seems to slightly hurt performance from some rough +// measurements. + function skipWord() { + while (_base.state.pos < _base.input.length) { + const ch = _base.input.charCodeAt(_base.state.pos); + if (_identifier.IS_IDENTIFIER_CHAR[ch]) { + _base.state.pos++; + } else if (ch === _charcodes.charCodes.backslash) { + // \u + _base.state.pos += 2; + if (_base.input.charCodeAt(_base.state.pos) === _charcodes.charCodes.leftCurlyBrace) { + while ( + _base.state.pos < _base.input.length && + _base.input.charCodeAt(_base.state.pos) !== _charcodes.charCodes.rightCurlyBrace + ) { + _base.state.pos++; + } + _base.state.pos++; + } + } else { + break; + } + } +} exports.skipWord = skipWord; diff --git a/node_modules/sucrase/dist/parser/tokenizer/keywords.js b/node_modules/sucrase/dist/parser/tokenizer/keywords.js new file mode 100644 index 00000000..e741926a --- /dev/null +++ b/node_modules/sucrase/dist/parser/tokenizer/keywords.js @@ -0,0 +1,43 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var ContextualKeyword; (function (ContextualKeyword) { + const NONE = 0; ContextualKeyword[ContextualKeyword["NONE"] = NONE] = "NONE"; + const _abstract = NONE + 1; ContextualKeyword[ContextualKeyword["_abstract"] = _abstract] = "_abstract"; + const _accessor = _abstract + 1; ContextualKeyword[ContextualKeyword["_accessor"] = _accessor] = "_accessor"; + const _as = _accessor + 1; ContextualKeyword[ContextualKeyword["_as"] = _as] = "_as"; + const _assert = _as + 1; ContextualKeyword[ContextualKeyword["_assert"] = _assert] = "_assert"; + const _asserts = _assert + 1; ContextualKeyword[ContextualKeyword["_asserts"] = _asserts] = "_asserts"; + const _async = _asserts + 1; ContextualKeyword[ContextualKeyword["_async"] = _async] = "_async"; + const _await = _async + 1; ContextualKeyword[ContextualKeyword["_await"] = _await] = "_await"; + const _checks = _await + 1; ContextualKeyword[ContextualKeyword["_checks"] = _checks] = "_checks"; + const _constructor = _checks + 1; ContextualKeyword[ContextualKeyword["_constructor"] = _constructor] = "_constructor"; + const _declare = _constructor + 1; ContextualKeyword[ContextualKeyword["_declare"] = _declare] = "_declare"; + const _enum = _declare + 1; ContextualKeyword[ContextualKeyword["_enum"] = _enum] = "_enum"; + const _exports = _enum + 1; ContextualKeyword[ContextualKeyword["_exports"] = _exports] = "_exports"; + const _from = _exports + 1; ContextualKeyword[ContextualKeyword["_from"] = _from] = "_from"; + const _get = _from + 1; ContextualKeyword[ContextualKeyword["_get"] = _get] = "_get"; + const _global = _get + 1; ContextualKeyword[ContextualKeyword["_global"] = _global] = "_global"; + const _implements = _global + 1; ContextualKeyword[ContextualKeyword["_implements"] = _implements] = "_implements"; + const _infer = _implements + 1; ContextualKeyword[ContextualKeyword["_infer"] = _infer] = "_infer"; + const _interface = _infer + 1; ContextualKeyword[ContextualKeyword["_interface"] = _interface] = "_interface"; + const _is = _interface + 1; ContextualKeyword[ContextualKeyword["_is"] = _is] = "_is"; + const _keyof = _is + 1; ContextualKeyword[ContextualKeyword["_keyof"] = _keyof] = "_keyof"; + const _mixins = _keyof + 1; ContextualKeyword[ContextualKeyword["_mixins"] = _mixins] = "_mixins"; + const _module = _mixins + 1; ContextualKeyword[ContextualKeyword["_module"] = _module] = "_module"; + const _namespace = _module + 1; ContextualKeyword[ContextualKeyword["_namespace"] = _namespace] = "_namespace"; + const _of = _namespace + 1; ContextualKeyword[ContextualKeyword["_of"] = _of] = "_of"; + const _opaque = _of + 1; ContextualKeyword[ContextualKeyword["_opaque"] = _opaque] = "_opaque"; + const _out = _opaque + 1; ContextualKeyword[ContextualKeyword["_out"] = _out] = "_out"; + const _override = _out + 1; ContextualKeyword[ContextualKeyword["_override"] = _override] = "_override"; + const _private = _override + 1; ContextualKeyword[ContextualKeyword["_private"] = _private] = "_private"; + const _protected = _private + 1; ContextualKeyword[ContextualKeyword["_protected"] = _protected] = "_protected"; + const _proto = _protected + 1; ContextualKeyword[ContextualKeyword["_proto"] = _proto] = "_proto"; + const _public = _proto + 1; ContextualKeyword[ContextualKeyword["_public"] = _public] = "_public"; + const _readonly = _public + 1; ContextualKeyword[ContextualKeyword["_readonly"] = _readonly] = "_readonly"; + const _require = _readonly + 1; ContextualKeyword[ContextualKeyword["_require"] = _require] = "_require"; + const _satisfies = _require + 1; ContextualKeyword[ContextualKeyword["_satisfies"] = _satisfies] = "_satisfies"; + const _set = _satisfies + 1; ContextualKeyword[ContextualKeyword["_set"] = _set] = "_set"; + const _static = _set + 1; ContextualKeyword[ContextualKeyword["_static"] = _static] = "_static"; + const _symbol = _static + 1; ContextualKeyword[ContextualKeyword["_symbol"] = _symbol] = "_symbol"; + const _type = _symbol + 1; ContextualKeyword[ContextualKeyword["_type"] = _type] = "_type"; + const _unique = _type + 1; ContextualKeyword[ContextualKeyword["_unique"] = _unique] = "_unique"; + const _using = _unique + 1; ContextualKeyword[ContextualKeyword["_using"] = _using] = "_using"; +})(ContextualKeyword || (exports.ContextualKeyword = ContextualKeyword = {})); diff --git a/node_modules/sucrase/dist/parser/tokenizer/readWord.js b/node_modules/sucrase/dist/parser/tokenizer/readWord.js new file mode 100644 index 00000000..69ed5c93 --- /dev/null +++ b/node_modules/sucrase/dist/parser/tokenizer/readWord.js @@ -0,0 +1,64 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _base = require('../traverser/base'); +var _charcodes = require('../util/charcodes'); +var _identifier = require('../util/identifier'); +var _index = require('./index'); +var _readWordTree = require('./readWordTree'); +var _types = require('./types'); + +/** + * Read an identifier, producing either a name token or matching on one of the existing keywords. + * For performance, we pre-generate big decision tree that we traverse. Each node represents a + * prefix and has 27 values, where the first value is the token or contextual token, if any (-1 if + * not), and the other 26 values are the transitions to other nodes, or -1 to stop. + */ + function readWord() { + let treePos = 0; + let code = 0; + let pos = _base.state.pos; + while (pos < _base.input.length) { + code = _base.input.charCodeAt(pos); + if (code < _charcodes.charCodes.lowercaseA || code > _charcodes.charCodes.lowercaseZ) { + break; + } + const next = _readWordTree.READ_WORD_TREE[treePos + (code - _charcodes.charCodes.lowercaseA) + 1]; + if (next === -1) { + break; + } else { + treePos = next; + pos++; + } + } + + const keywordValue = _readWordTree.READ_WORD_TREE[treePos]; + if (keywordValue > -1 && !_identifier.IS_IDENTIFIER_CHAR[code]) { + _base.state.pos = pos; + if (keywordValue & 1) { + _index.finishToken.call(void 0, keywordValue >>> 1); + } else { + _index.finishToken.call(void 0, _types.TokenType.name, keywordValue >>> 1); + } + return; + } + + while (pos < _base.input.length) { + const ch = _base.input.charCodeAt(pos); + if (_identifier.IS_IDENTIFIER_CHAR[ch]) { + pos++; + } else if (ch === _charcodes.charCodes.backslash) { + // \u + pos += 2; + if (_base.input.charCodeAt(pos) === _charcodes.charCodes.leftCurlyBrace) { + while (pos < _base.input.length && _base.input.charCodeAt(pos) !== _charcodes.charCodes.rightCurlyBrace) { + pos++; + } + pos++; + } + } else if (ch === _charcodes.charCodes.atSign && _base.input.charCodeAt(pos + 1) === _charcodes.charCodes.atSign) { + pos += 2; + } else { + break; + } + } + _base.state.pos = pos; + _index.finishToken.call(void 0, _types.TokenType.name); +} exports.default = readWord; diff --git a/node_modules/sucrase/dist/parser/tokenizer/readWordTree.js b/node_modules/sucrase/dist/parser/tokenizer/readWordTree.js new file mode 100644 index 00000000..fcc7733f --- /dev/null +++ b/node_modules/sucrase/dist/parser/tokenizer/readWordTree.js @@ -0,0 +1,671 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});// Generated file, do not edit! Run "yarn generate" to re-generate this file. +var _keywords = require('./keywords'); +var _types = require('./types'); + +// prettier-ignore + const READ_WORD_TREE = new Int32Array([ + // "" + -1, 27, 783, 918, 1755, 2376, 2862, 3483, -1, 3699, -1, 4617, 4752, 4833, 5130, 5508, 5940, -1, 6480, 6939, 7749, 8181, 8451, 8613, -1, 8829, -1, + // "a" + -1, -1, 54, 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 432, -1, -1, -1, 675, -1, -1, -1, + // "ab" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, + // "abs" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, + // "abst" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, -1, -1, + // "abstr" + -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "abstra" + -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "abstrac" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 216, -1, -1, -1, -1, -1, -1, + // "abstract" + _keywords.ContextualKeyword._abstract << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ac" + -1, -1, -1, 270, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "acc" + -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "acce" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 324, -1, -1, -1, -1, -1, -1, -1, + // "acces" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 351, -1, -1, -1, -1, -1, -1, -1, + // "access" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 378, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "accesso" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 405, -1, -1, -1, -1, -1, -1, -1, -1, + // "accessor" + _keywords.ContextualKeyword._accessor << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "as" + _keywords.ContextualKeyword._as << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 459, -1, -1, -1, -1, -1, 594, -1, + // "ass" + -1, -1, -1, -1, -1, 486, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "asse" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 513, -1, -1, -1, -1, -1, -1, -1, -1, + // "asser" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 540, -1, -1, -1, -1, -1, -1, + // "assert" + _keywords.ContextualKeyword._assert << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 567, -1, -1, -1, -1, -1, -1, -1, + // "asserts" + _keywords.ContextualKeyword._asserts << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "asy" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 621, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "asyn" + -1, -1, -1, 648, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "async" + _keywords.ContextualKeyword._async << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "aw" + -1, 702, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "awa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 729, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "awai" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 756, -1, -1, -1, -1, -1, -1, + // "await" + _keywords.ContextualKeyword._await << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "b" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 810, -1, -1, -1, -1, -1, -1, -1, -1, + // "br" + -1, -1, -1, -1, -1, 837, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "bre" + -1, 864, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "brea" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 891, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "break" + (_types.TokenType._break << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "c" + -1, 945, -1, -1, -1, -1, -1, -1, 1107, -1, -1, -1, 1242, -1, -1, 1350, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ca" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 972, 1026, -1, -1, -1, -1, -1, -1, + // "cas" + -1, -1, -1, -1, -1, 999, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "case" + (_types.TokenType._case << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "cat" + -1, -1, -1, 1053, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "catc" + -1, -1, -1, -1, -1, -1, -1, -1, 1080, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "catch" + (_types.TokenType._catch << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ch" + -1, -1, -1, -1, -1, 1134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "che" + -1, -1, -1, 1161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "chec" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1188, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "check" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1215, -1, -1, -1, -1, -1, -1, -1, + // "checks" + _keywords.ContextualKeyword._checks << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "cl" + -1, 1269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "cla" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1296, -1, -1, -1, -1, -1, -1, -1, + // "clas" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1323, -1, -1, -1, -1, -1, -1, -1, + // "class" + (_types.TokenType._class << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "co" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1377, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "con" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1404, 1620, -1, -1, -1, -1, -1, -1, + // "cons" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1431, -1, -1, -1, -1, -1, -1, + // "const" + (_types.TokenType._const << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1458, -1, -1, -1, -1, -1, -1, -1, -1, + // "constr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1485, -1, -1, -1, -1, -1, + // "constru" + -1, -1, -1, 1512, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "construc" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1539, -1, -1, -1, -1, -1, -1, + // "construct" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1566, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "constructo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1593, -1, -1, -1, -1, -1, -1, -1, -1, + // "constructor" + _keywords.ContextualKeyword._constructor << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "cont" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 1647, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "conti" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1674, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "contin" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1701, -1, -1, -1, -1, -1, + // "continu" + -1, -1, -1, -1, -1, 1728, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "continue" + (_types.TokenType._continue << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "d" + -1, -1, -1, -1, -1, 1782, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2349, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "de" + -1, -1, 1809, 1971, -1, -1, 2106, -1, -1, -1, -1, -1, 2241, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "deb" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1836, -1, -1, -1, -1, -1, + // "debu" + -1, -1, -1, -1, -1, -1, -1, 1863, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "debug" + -1, -1, -1, -1, -1, -1, -1, 1890, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "debugg" + -1, -1, -1, -1, -1, 1917, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "debugge" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1944, -1, -1, -1, -1, -1, -1, -1, -1, + // "debugger" + (_types.TokenType._debugger << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "dec" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1998, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "decl" + -1, 2025, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "decla" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2052, -1, -1, -1, -1, -1, -1, -1, -1, + // "declar" + -1, -1, -1, -1, -1, 2079, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "declare" + _keywords.ContextualKeyword._declare << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "def" + -1, 2133, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "defa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2160, -1, -1, -1, -1, -1, + // "defau" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2187, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "defaul" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2214, -1, -1, -1, -1, -1, -1, + // "default" + (_types.TokenType._default << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "del" + -1, -1, -1, -1, -1, 2268, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "dele" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2295, -1, -1, -1, -1, -1, -1, + // "delet" + -1, -1, -1, -1, -1, 2322, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "delete" + (_types.TokenType._delete << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "do" + (_types.TokenType._do << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "e" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2403, -1, 2484, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2565, -1, -1, + // "el" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2430, -1, -1, -1, -1, -1, -1, -1, + // "els" + -1, -1, -1, -1, -1, 2457, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "else" + (_types.TokenType._else << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "en" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2511, -1, -1, -1, -1, -1, + // "enu" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2538, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "enum" + _keywords.ContextualKeyword._enum << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ex" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2592, -1, -1, -1, 2727, -1, -1, -1, -1, -1, -1, + // "exp" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2619, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "expo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2646, -1, -1, -1, -1, -1, -1, -1, -1, + // "expor" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2673, -1, -1, -1, -1, -1, -1, + // "export" + (_types.TokenType._export << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2700, -1, -1, -1, -1, -1, -1, -1, + // "exports" + _keywords.ContextualKeyword._exports << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ext" + -1, -1, -1, -1, -1, 2754, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "exte" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2781, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "exten" + -1, -1, -1, -1, 2808, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "extend" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2835, -1, -1, -1, -1, -1, -1, -1, + // "extends" + (_types.TokenType._extends << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "f" + -1, 2889, -1, -1, -1, -1, -1, -1, -1, 2997, -1, -1, -1, -1, -1, 3159, -1, -1, 3213, -1, -1, 3294, -1, -1, -1, -1, -1, + // "fa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2916, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fal" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2943, -1, -1, -1, -1, -1, -1, -1, + // "fals" + -1, -1, -1, -1, -1, 2970, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "false" + (_types.TokenType._false << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3024, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fin" + -1, 3051, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fina" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3078, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "final" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "finall" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3132, -1, + // "finally" + (_types.TokenType._finally << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3186, -1, -1, -1, -1, -1, -1, -1, -1, + // "for" + (_types.TokenType._for << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fro" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3267, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "from" + _keywords.ContextualKeyword._from << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fu" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3321, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "fun" + -1, -1, -1, 3348, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "func" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3375, -1, -1, -1, -1, -1, -1, + // "funct" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 3402, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "functi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3429, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "functio" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3456, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "function" + (_types.TokenType._function << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "g" + -1, -1, -1, -1, -1, 3510, -1, -1, -1, -1, -1, -1, 3564, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ge" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3537, -1, -1, -1, -1, -1, -1, + // "get" + _keywords.ContextualKeyword._get << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "gl" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3591, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "glo" + -1, -1, 3618, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "glob" + -1, 3645, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "globa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3672, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "global" + _keywords.ContextualKeyword._global << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "i" + -1, -1, -1, -1, -1, -1, 3726, -1, -1, -1, -1, -1, -1, 3753, 4077, -1, -1, -1, -1, 4590, -1, -1, -1, -1, -1, -1, -1, + // "if" + (_types.TokenType._if << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "im" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3780, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "imp" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3807, -1, -1, 3996, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "impl" + -1, -1, -1, -1, -1, 3834, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "imple" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3861, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "implem" + -1, -1, -1, -1, -1, 3888, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "impleme" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3915, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "implemen" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3942, -1, -1, -1, -1, -1, -1, + // "implement" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3969, -1, -1, -1, -1, -1, -1, -1, + // "implements" + _keywords.ContextualKeyword._implements << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "impo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4023, -1, -1, -1, -1, -1, -1, -1, -1, + // "impor" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4050, -1, -1, -1, -1, -1, -1, + // "import" + (_types.TokenType._import << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "in" + (_types.TokenType._in << 1) + 1, -1, -1, -1, -1, -1, 4104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4185, 4401, -1, -1, -1, -1, -1, -1, + // "inf" + -1, -1, -1, -1, -1, 4131, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "infe" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4158, -1, -1, -1, -1, -1, -1, -1, -1, + // "infer" + _keywords.ContextualKeyword._infer << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ins" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4212, -1, -1, -1, -1, -1, -1, + // "inst" + -1, 4239, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "insta" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4266, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "instan" + -1, -1, -1, 4293, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "instanc" + -1, -1, -1, -1, -1, 4320, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "instance" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4347, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "instanceo" + -1, -1, -1, -1, -1, -1, 4374, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "instanceof" + (_types.TokenType._instanceof << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "int" + -1, -1, -1, -1, -1, 4428, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "inte" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4455, -1, -1, -1, -1, -1, -1, -1, -1, + // "inter" + -1, -1, -1, -1, -1, -1, 4482, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "interf" + -1, 4509, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "interfa" + -1, -1, -1, 4536, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "interfac" + -1, -1, -1, -1, -1, 4563, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "interface" + _keywords.ContextualKeyword._interface << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "is" + _keywords.ContextualKeyword._is << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "k" + -1, -1, -1, -1, -1, 4644, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ke" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4671, -1, + // "key" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4698, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "keyo" + -1, -1, -1, -1, -1, -1, 4725, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "keyof" + _keywords.ContextualKeyword._keyof << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "l" + -1, -1, -1, -1, -1, 4779, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "le" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4806, -1, -1, -1, -1, -1, -1, + // "let" + (_types.TokenType._let << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "m" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 4860, -1, -1, -1, -1, -1, 4995, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "mi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4887, -1, -1, + // "mix" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 4914, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "mixi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4941, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "mixin" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4968, -1, -1, -1, -1, -1, -1, -1, + // "mixins" + _keywords.ContextualKeyword._mixins << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "mo" + -1, -1, -1, -1, 5022, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "mod" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5049, -1, -1, -1, -1, -1, + // "modu" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5076, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "modul" + -1, -1, -1, -1, -1, 5103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "module" + _keywords.ContextualKeyword._module << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "n" + -1, 5157, -1, -1, -1, 5373, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5427, -1, -1, -1, -1, -1, + // "na" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5184, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "nam" + -1, -1, -1, -1, -1, 5211, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "name" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5238, -1, -1, -1, -1, -1, -1, -1, + // "names" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5265, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "namesp" + -1, 5292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "namespa" + -1, -1, -1, 5319, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "namespac" + -1, -1, -1, -1, -1, 5346, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "namespace" + _keywords.ContextualKeyword._namespace << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ne" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5400, -1, -1, -1, + // "new" + (_types.TokenType._new << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "nu" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5454, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "nul" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5481, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "null" + (_types.TokenType._null << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "o" + -1, -1, -1, -1, -1, -1, 5535, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5562, -1, -1, -1, -1, 5697, 5751, -1, -1, -1, -1, + // "of" + _keywords.ContextualKeyword._of << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "op" + -1, 5589, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "opa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5616, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "opaq" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5643, -1, -1, -1, -1, -1, + // "opaqu" + -1, -1, -1, -1, -1, 5670, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "opaque" + _keywords.ContextualKeyword._opaque << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ou" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5724, -1, -1, -1, -1, -1, -1, + // "out" + _keywords.ContextualKeyword._out << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ov" + -1, -1, -1, -1, -1, 5778, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ove" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5805, -1, -1, -1, -1, -1, -1, -1, -1, + // "over" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5832, -1, -1, -1, -1, -1, -1, -1, -1, + // "overr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 5859, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "overri" + -1, -1, -1, -1, 5886, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "overrid" + -1, -1, -1, -1, -1, 5913, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "override" + _keywords.ContextualKeyword._override << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "p" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5967, -1, -1, 6345, -1, -1, -1, -1, -1, + // "pr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 5994, -1, -1, -1, -1, -1, 6129, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "pri" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6021, -1, -1, -1, -1, + // "priv" + -1, 6048, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "priva" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6075, -1, -1, -1, -1, -1, -1, + // "privat" + -1, -1, -1, -1, -1, 6102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "private" + _keywords.ContextualKeyword._private << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "pro" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6156, -1, -1, -1, -1, -1, -1, + // "prot" + -1, -1, -1, -1, -1, 6183, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6318, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "prote" + -1, -1, -1, 6210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "protec" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6237, -1, -1, -1, -1, -1, -1, + // "protect" + -1, -1, -1, -1, -1, 6264, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "protecte" + -1, -1, -1, -1, 6291, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "protected" + _keywords.ContextualKeyword._protected << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "proto" + _keywords.ContextualKeyword._proto << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "pu" + -1, -1, 6372, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "pub" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6399, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "publ" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 6426, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "publi" + -1, -1, -1, 6453, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "public" + _keywords.ContextualKeyword._public << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "r" + -1, -1, -1, -1, -1, 6507, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "re" + -1, 6534, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6696, -1, -1, 6831, -1, -1, -1, -1, -1, -1, + // "rea" + -1, -1, -1, -1, 6561, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "read" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6588, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "reado" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6615, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "readon" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6642, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "readonl" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6669, -1, + // "readonly" + _keywords.ContextualKeyword._readonly << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "req" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6723, -1, -1, -1, -1, -1, + // "requ" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 6750, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "requi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6777, -1, -1, -1, -1, -1, -1, -1, -1, + // "requir" + -1, -1, -1, -1, -1, 6804, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "require" + _keywords.ContextualKeyword._require << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ret" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6858, -1, -1, -1, -1, -1, + // "retu" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6885, -1, -1, -1, -1, -1, -1, -1, -1, + // "retur" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6912, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "return" + (_types.TokenType._return << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "s" + -1, 6966, -1, -1, -1, 7182, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7236, 7371, -1, 7479, -1, 7614, -1, + // "sa" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6993, -1, -1, -1, -1, -1, -1, + // "sat" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7020, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sati" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7047, -1, -1, -1, -1, -1, -1, -1, + // "satis" + -1, -1, -1, -1, -1, -1, 7074, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "satisf" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "satisfi" + -1, -1, -1, -1, -1, 7128, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "satisfie" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7155, -1, -1, -1, -1, -1, -1, -1, + // "satisfies" + _keywords.ContextualKeyword._satisfies << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "se" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7209, -1, -1, -1, -1, -1, -1, + // "set" + _keywords.ContextualKeyword._set << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "st" + -1, 7263, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sta" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7290, -1, -1, -1, -1, -1, -1, + // "stat" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7317, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "stati" + -1, -1, -1, 7344, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "static" + _keywords.ContextualKeyword._static << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "su" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7398, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sup" + -1, -1, -1, -1, -1, 7425, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "supe" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7452, -1, -1, -1, -1, -1, -1, -1, -1, + // "super" + (_types.TokenType._super << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sw" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7506, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "swi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7533, -1, -1, -1, -1, -1, -1, + // "swit" + -1, -1, -1, 7560, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "switc" + -1, -1, -1, -1, -1, -1, -1, -1, 7587, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "switch" + (_types.TokenType._switch << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sy" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7641, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "sym" + -1, -1, 7668, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "symb" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7695, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "symbo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7722, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "symbol" + _keywords.ContextualKeyword._symbol << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "t" + -1, -1, -1, -1, -1, -1, -1, -1, 7776, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7938, -1, -1, -1, -1, -1, -1, 8046, -1, + // "th" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7803, -1, -1, -1, -1, -1, -1, -1, -1, 7857, -1, -1, -1, -1, -1, -1, -1, -1, + // "thi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7830, -1, -1, -1, -1, -1, -1, -1, + // "this" + (_types.TokenType._this << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "thr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7884, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "thro" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7911, -1, -1, -1, + // "throw" + (_types.TokenType._throw << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "tr" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7965, -1, -1, -1, 8019, -1, + // "tru" + -1, -1, -1, -1, -1, 7992, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "true" + (_types.TokenType._true << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "try" + (_types.TokenType._try << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "ty" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8073, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "typ" + -1, -1, -1, -1, -1, 8100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "type" + _keywords.ContextualKeyword._type << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8127, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "typeo" + -1, -1, -1, -1, -1, -1, 8154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "typeof" + (_types.TokenType._typeof << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "u" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8208, -1, -1, -1, -1, 8343, -1, -1, -1, -1, -1, -1, -1, + // "un" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8235, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "uni" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8262, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "uniq" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8289, -1, -1, -1, -1, -1, + // "uniqu" + -1, -1, -1, -1, -1, 8316, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "unique" + _keywords.ContextualKeyword._unique << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "us" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8370, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "usi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8397, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "usin" + -1, -1, -1, -1, -1, -1, -1, 8424, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "using" + _keywords.ContextualKeyword._using << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "v" + -1, 8478, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8532, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "va" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8505, -1, -1, -1, -1, -1, -1, -1, -1, + // "var" + (_types.TokenType._var << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "vo" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8559, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "voi" + -1, -1, -1, -1, 8586, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "void" + (_types.TokenType._void << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "w" + -1, -1, -1, -1, -1, -1, -1, -1, 8640, 8748, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "wh" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8667, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "whi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8694, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "whil" + -1, -1, -1, -1, -1, 8721, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "while" + (_types.TokenType._while << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "wi" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8775, -1, -1, -1, -1, -1, -1, + // "wit" + -1, -1, -1, -1, -1, -1, -1, -1, 8802, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "with" + (_types.TokenType._with << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "y" + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8856, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "yi" + -1, -1, -1, -1, -1, 8883, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "yie" + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8910, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "yiel" + -1, -1, -1, -1, 8937, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + // "yield" + (_types.TokenType._yield << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +]); exports.READ_WORD_TREE = READ_WORD_TREE; diff --git a/node_modules/sucrase/dist/parser/tokenizer/state.js b/node_modules/sucrase/dist/parser/tokenizer/state.js new file mode 100644 index 00000000..359e1b45 --- /dev/null +++ b/node_modules/sucrase/dist/parser/tokenizer/state.js @@ -0,0 +1,106 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); +var _keywords = require('./keywords'); +var _types = require('./types'); + + class Scope { + + + + + constructor(startTokenIndex, endTokenIndex, isFunctionScope) { + this.startTokenIndex = startTokenIndex; + this.endTokenIndex = endTokenIndex; + this.isFunctionScope = isFunctionScope; + } +} exports.Scope = Scope; + + class StateSnapshot { + constructor( + potentialArrowAt, + noAnonFunctionType, + inDisallowConditionalTypesContext, + tokensLength, + scopesLength, + pos, + type, + contextualKeyword, + start, + end, + isType, + scopeDepth, + error, + ) {;this.potentialArrowAt = potentialArrowAt;this.noAnonFunctionType = noAnonFunctionType;this.inDisallowConditionalTypesContext = inDisallowConditionalTypesContext;this.tokensLength = tokensLength;this.scopesLength = scopesLength;this.pos = pos;this.type = type;this.contextualKeyword = contextualKeyword;this.start = start;this.end = end;this.isType = isType;this.scopeDepth = scopeDepth;this.error = error;} +} exports.StateSnapshot = StateSnapshot; + + class State {constructor() { State.prototype.__init.call(this);State.prototype.__init2.call(this);State.prototype.__init3.call(this);State.prototype.__init4.call(this);State.prototype.__init5.call(this);State.prototype.__init6.call(this);State.prototype.__init7.call(this);State.prototype.__init8.call(this);State.prototype.__init9.call(this);State.prototype.__init10.call(this);State.prototype.__init11.call(this);State.prototype.__init12.call(this);State.prototype.__init13.call(this); } + // Used to signify the start of a potential arrow function + __init() {this.potentialArrowAt = -1} + + // Used by Flow to handle an edge case involving function type parsing. + __init2() {this.noAnonFunctionType = false} + + // Used by TypeScript to handle ambiguities when parsing conditional types. + __init3() {this.inDisallowConditionalTypesContext = false} + + // Token store. + __init4() {this.tokens = []} + + // Array of all observed scopes, ordered by their ending position. + __init5() {this.scopes = []} + + // The current position of the tokenizer in the input. + __init6() {this.pos = 0} + + // Information about the current token. + __init7() {this.type = _types.TokenType.eof} + __init8() {this.contextualKeyword = _keywords.ContextualKeyword.NONE} + __init9() {this.start = 0} + __init10() {this.end = 0} + + __init11() {this.isType = false} + __init12() {this.scopeDepth = 0} + + /** + * If the parser is in an error state, then the token is always tt.eof and all functions can + * keep executing but should be written so they don't get into an infinite loop in this situation. + * + * This approach, combined with the ability to snapshot and restore state, allows us to implement + * backtracking without exceptions and without needing to explicitly propagate error states + * everywhere. + */ + __init13() {this.error = null} + + snapshot() { + return new StateSnapshot( + this.potentialArrowAt, + this.noAnonFunctionType, + this.inDisallowConditionalTypesContext, + this.tokens.length, + this.scopes.length, + this.pos, + this.type, + this.contextualKeyword, + this.start, + this.end, + this.isType, + this.scopeDepth, + this.error, + ); + } + + restoreFromSnapshot(snapshot) { + this.potentialArrowAt = snapshot.potentialArrowAt; + this.noAnonFunctionType = snapshot.noAnonFunctionType; + this.inDisallowConditionalTypesContext = snapshot.inDisallowConditionalTypesContext; + this.tokens.length = snapshot.tokensLength; + this.scopes.length = snapshot.scopesLength; + this.pos = snapshot.pos; + this.type = snapshot.type; + this.contextualKeyword = snapshot.contextualKeyword; + this.start = snapshot.start; + this.end = snapshot.end; + this.isType = snapshot.isType; + this.scopeDepth = snapshot.scopeDepth; + this.error = snapshot.error; + } +} exports.default = State; diff --git a/node_modules/sucrase/dist/parser/tokenizer/types.js b/node_modules/sucrase/dist/parser/tokenizer/types.js new file mode 100644 index 00000000..c1f2a81c --- /dev/null +++ b/node_modules/sucrase/dist/parser/tokenizer/types.js @@ -0,0 +1,361 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});// Generated file, do not edit! Run "yarn generate" to re-generate this file. +/* istanbul ignore file */ +/** + * Enum of all token types, with bit fields to signify meaningful properties. + */ +var TokenType; (function (TokenType) { + // Precedence 0 means not an operator; otherwise it is a positive number up to 12. + const PRECEDENCE_MASK = 0xf; TokenType[TokenType["PRECEDENCE_MASK"] = PRECEDENCE_MASK] = "PRECEDENCE_MASK"; + const IS_KEYWORD = 1 << 4; TokenType[TokenType["IS_KEYWORD"] = IS_KEYWORD] = "IS_KEYWORD"; + const IS_ASSIGN = 1 << 5; TokenType[TokenType["IS_ASSIGN"] = IS_ASSIGN] = "IS_ASSIGN"; + const IS_RIGHT_ASSOCIATIVE = 1 << 6; TokenType[TokenType["IS_RIGHT_ASSOCIATIVE"] = IS_RIGHT_ASSOCIATIVE] = "IS_RIGHT_ASSOCIATIVE"; + const IS_PREFIX = 1 << 7; TokenType[TokenType["IS_PREFIX"] = IS_PREFIX] = "IS_PREFIX"; + const IS_POSTFIX = 1 << 8; TokenType[TokenType["IS_POSTFIX"] = IS_POSTFIX] = "IS_POSTFIX"; + const IS_EXPRESSION_START = 1 << 9; TokenType[TokenType["IS_EXPRESSION_START"] = IS_EXPRESSION_START] = "IS_EXPRESSION_START"; + + const num = 512; TokenType[TokenType["num"] = num] = "num"; // num startsExpr + const bigint = 1536; TokenType[TokenType["bigint"] = bigint] = "bigint"; // bigint startsExpr + const decimal = 2560; TokenType[TokenType["decimal"] = decimal] = "decimal"; // decimal startsExpr + const regexp = 3584; TokenType[TokenType["regexp"] = regexp] = "regexp"; // regexp startsExpr + const string = 4608; TokenType[TokenType["string"] = string] = "string"; // string startsExpr + const name = 5632; TokenType[TokenType["name"] = name] = "name"; // name startsExpr + const eof = 6144; TokenType[TokenType["eof"] = eof] = "eof"; // eof + const bracketL = 7680; TokenType[TokenType["bracketL"] = bracketL] = "bracketL"; // [ startsExpr + const bracketR = 8192; TokenType[TokenType["bracketR"] = bracketR] = "bracketR"; // ] + const braceL = 9728; TokenType[TokenType["braceL"] = braceL] = "braceL"; // { startsExpr + const braceBarL = 10752; TokenType[TokenType["braceBarL"] = braceBarL] = "braceBarL"; // {| startsExpr + const braceR = 11264; TokenType[TokenType["braceR"] = braceR] = "braceR"; // } + const braceBarR = 12288; TokenType[TokenType["braceBarR"] = braceBarR] = "braceBarR"; // |} + const parenL = 13824; TokenType[TokenType["parenL"] = parenL] = "parenL"; // ( startsExpr + const parenR = 14336; TokenType[TokenType["parenR"] = parenR] = "parenR"; // ) + const comma = 15360; TokenType[TokenType["comma"] = comma] = "comma"; // , + const semi = 16384; TokenType[TokenType["semi"] = semi] = "semi"; // ; + const colon = 17408; TokenType[TokenType["colon"] = colon] = "colon"; // : + const doubleColon = 18432; TokenType[TokenType["doubleColon"] = doubleColon] = "doubleColon"; // :: + const dot = 19456; TokenType[TokenType["dot"] = dot] = "dot"; // . + const question = 20480; TokenType[TokenType["question"] = question] = "question"; // ? + const questionDot = 21504; TokenType[TokenType["questionDot"] = questionDot] = "questionDot"; // ?. + const arrow = 22528; TokenType[TokenType["arrow"] = arrow] = "arrow"; // => + const template = 23552; TokenType[TokenType["template"] = template] = "template"; // template + const ellipsis = 24576; TokenType[TokenType["ellipsis"] = ellipsis] = "ellipsis"; // ... + const backQuote = 25600; TokenType[TokenType["backQuote"] = backQuote] = "backQuote"; // ` + const dollarBraceL = 27136; TokenType[TokenType["dollarBraceL"] = dollarBraceL] = "dollarBraceL"; // ${ startsExpr + const at = 27648; TokenType[TokenType["at"] = at] = "at"; // @ + const hash = 29184; TokenType[TokenType["hash"] = hash] = "hash"; // # startsExpr + const eq = 29728; TokenType[TokenType["eq"] = eq] = "eq"; // = isAssign + const assign = 30752; TokenType[TokenType["assign"] = assign] = "assign"; // _= isAssign + const preIncDec = 32640; TokenType[TokenType["preIncDec"] = preIncDec] = "preIncDec"; // ++/-- prefix postfix startsExpr + const postIncDec = 33664; TokenType[TokenType["postIncDec"] = postIncDec] = "postIncDec"; // ++/-- prefix postfix startsExpr + const bang = 34432; TokenType[TokenType["bang"] = bang] = "bang"; // ! prefix startsExpr + const tilde = 35456; TokenType[TokenType["tilde"] = tilde] = "tilde"; // ~ prefix startsExpr + const pipeline = 35841; TokenType[TokenType["pipeline"] = pipeline] = "pipeline"; // |> prec:1 + const nullishCoalescing = 36866; TokenType[TokenType["nullishCoalescing"] = nullishCoalescing] = "nullishCoalescing"; // ?? prec:2 + const logicalOR = 37890; TokenType[TokenType["logicalOR"] = logicalOR] = "logicalOR"; // || prec:2 + const logicalAND = 38915; TokenType[TokenType["logicalAND"] = logicalAND] = "logicalAND"; // && prec:3 + const bitwiseOR = 39940; TokenType[TokenType["bitwiseOR"] = bitwiseOR] = "bitwiseOR"; // | prec:4 + const bitwiseXOR = 40965; TokenType[TokenType["bitwiseXOR"] = bitwiseXOR] = "bitwiseXOR"; // ^ prec:5 + const bitwiseAND = 41990; TokenType[TokenType["bitwiseAND"] = bitwiseAND] = "bitwiseAND"; // & prec:6 + const equality = 43015; TokenType[TokenType["equality"] = equality] = "equality"; // ==/!= prec:7 + const lessThan = 44040; TokenType[TokenType["lessThan"] = lessThan] = "lessThan"; // < prec:8 + const greaterThan = 45064; TokenType[TokenType["greaterThan"] = greaterThan] = "greaterThan"; // > prec:8 + const relationalOrEqual = 46088; TokenType[TokenType["relationalOrEqual"] = relationalOrEqual] = "relationalOrEqual"; // <=/>= prec:8 + const bitShiftL = 47113; TokenType[TokenType["bitShiftL"] = bitShiftL] = "bitShiftL"; // << prec:9 + const bitShiftR = 48137; TokenType[TokenType["bitShiftR"] = bitShiftR] = "bitShiftR"; // >>/>>> prec:9 + const plus = 49802; TokenType[TokenType["plus"] = plus] = "plus"; // + prec:10 prefix startsExpr + const minus = 50826; TokenType[TokenType["minus"] = minus] = "minus"; // - prec:10 prefix startsExpr + const modulo = 51723; TokenType[TokenType["modulo"] = modulo] = "modulo"; // % prec:11 startsExpr + const star = 52235; TokenType[TokenType["star"] = star] = "star"; // * prec:11 + const slash = 53259; TokenType[TokenType["slash"] = slash] = "slash"; // / prec:11 + const exponent = 54348; TokenType[TokenType["exponent"] = exponent] = "exponent"; // ** prec:12 rightAssociative + const jsxName = 55296; TokenType[TokenType["jsxName"] = jsxName] = "jsxName"; // jsxName + const jsxText = 56320; TokenType[TokenType["jsxText"] = jsxText] = "jsxText"; // jsxText + const jsxEmptyText = 57344; TokenType[TokenType["jsxEmptyText"] = jsxEmptyText] = "jsxEmptyText"; // jsxEmptyText + const jsxTagStart = 58880; TokenType[TokenType["jsxTagStart"] = jsxTagStart] = "jsxTagStart"; // jsxTagStart startsExpr + const jsxTagEnd = 59392; TokenType[TokenType["jsxTagEnd"] = jsxTagEnd] = "jsxTagEnd"; // jsxTagEnd + const typeParameterStart = 60928; TokenType[TokenType["typeParameterStart"] = typeParameterStart] = "typeParameterStart"; // typeParameterStart startsExpr + const nonNullAssertion = 61440; TokenType[TokenType["nonNullAssertion"] = nonNullAssertion] = "nonNullAssertion"; // nonNullAssertion + const _break = 62480; TokenType[TokenType["_break"] = _break] = "_break"; // break keyword + const _case = 63504; TokenType[TokenType["_case"] = _case] = "_case"; // case keyword + const _catch = 64528; TokenType[TokenType["_catch"] = _catch] = "_catch"; // catch keyword + const _continue = 65552; TokenType[TokenType["_continue"] = _continue] = "_continue"; // continue keyword + const _debugger = 66576; TokenType[TokenType["_debugger"] = _debugger] = "_debugger"; // debugger keyword + const _default = 67600; TokenType[TokenType["_default"] = _default] = "_default"; // default keyword + const _do = 68624; TokenType[TokenType["_do"] = _do] = "_do"; // do keyword + const _else = 69648; TokenType[TokenType["_else"] = _else] = "_else"; // else keyword + const _finally = 70672; TokenType[TokenType["_finally"] = _finally] = "_finally"; // finally keyword + const _for = 71696; TokenType[TokenType["_for"] = _for] = "_for"; // for keyword + const _function = 73232; TokenType[TokenType["_function"] = _function] = "_function"; // function keyword startsExpr + const _if = 73744; TokenType[TokenType["_if"] = _if] = "_if"; // if keyword + const _return = 74768; TokenType[TokenType["_return"] = _return] = "_return"; // return keyword + const _switch = 75792; TokenType[TokenType["_switch"] = _switch] = "_switch"; // switch keyword + const _throw = 77456; TokenType[TokenType["_throw"] = _throw] = "_throw"; // throw keyword prefix startsExpr + const _try = 77840; TokenType[TokenType["_try"] = _try] = "_try"; // try keyword + const _var = 78864; TokenType[TokenType["_var"] = _var] = "_var"; // var keyword + const _let = 79888; TokenType[TokenType["_let"] = _let] = "_let"; // let keyword + const _const = 80912; TokenType[TokenType["_const"] = _const] = "_const"; // const keyword + const _while = 81936; TokenType[TokenType["_while"] = _while] = "_while"; // while keyword + const _with = 82960; TokenType[TokenType["_with"] = _with] = "_with"; // with keyword + const _new = 84496; TokenType[TokenType["_new"] = _new] = "_new"; // new keyword startsExpr + const _this = 85520; TokenType[TokenType["_this"] = _this] = "_this"; // this keyword startsExpr + const _super = 86544; TokenType[TokenType["_super"] = _super] = "_super"; // super keyword startsExpr + const _class = 87568; TokenType[TokenType["_class"] = _class] = "_class"; // class keyword startsExpr + const _extends = 88080; TokenType[TokenType["_extends"] = _extends] = "_extends"; // extends keyword + const _export = 89104; TokenType[TokenType["_export"] = _export] = "_export"; // export keyword + const _import = 90640; TokenType[TokenType["_import"] = _import] = "_import"; // import keyword startsExpr + const _yield = 91664; TokenType[TokenType["_yield"] = _yield] = "_yield"; // yield keyword startsExpr + const _null = 92688; TokenType[TokenType["_null"] = _null] = "_null"; // null keyword startsExpr + const _true = 93712; TokenType[TokenType["_true"] = _true] = "_true"; // true keyword startsExpr + const _false = 94736; TokenType[TokenType["_false"] = _false] = "_false"; // false keyword startsExpr + const _in = 95256; TokenType[TokenType["_in"] = _in] = "_in"; // in prec:8 keyword + const _instanceof = 96280; TokenType[TokenType["_instanceof"] = _instanceof] = "_instanceof"; // instanceof prec:8 keyword + const _typeof = 97936; TokenType[TokenType["_typeof"] = _typeof] = "_typeof"; // typeof keyword prefix startsExpr + const _void = 98960; TokenType[TokenType["_void"] = _void] = "_void"; // void keyword prefix startsExpr + const _delete = 99984; TokenType[TokenType["_delete"] = _delete] = "_delete"; // delete keyword prefix startsExpr + const _async = 100880; TokenType[TokenType["_async"] = _async] = "_async"; // async keyword startsExpr + const _get = 101904; TokenType[TokenType["_get"] = _get] = "_get"; // get keyword startsExpr + const _set = 102928; TokenType[TokenType["_set"] = _set] = "_set"; // set keyword startsExpr + const _declare = 103952; TokenType[TokenType["_declare"] = _declare] = "_declare"; // declare keyword startsExpr + const _readonly = 104976; TokenType[TokenType["_readonly"] = _readonly] = "_readonly"; // readonly keyword startsExpr + const _abstract = 106000; TokenType[TokenType["_abstract"] = _abstract] = "_abstract"; // abstract keyword startsExpr + const _static = 107024; TokenType[TokenType["_static"] = _static] = "_static"; // static keyword startsExpr + const _public = 107536; TokenType[TokenType["_public"] = _public] = "_public"; // public keyword + const _private = 108560; TokenType[TokenType["_private"] = _private] = "_private"; // private keyword + const _protected = 109584; TokenType[TokenType["_protected"] = _protected] = "_protected"; // protected keyword + const _override = 110608; TokenType[TokenType["_override"] = _override] = "_override"; // override keyword + const _as = 112144; TokenType[TokenType["_as"] = _as] = "_as"; // as keyword startsExpr + const _enum = 113168; TokenType[TokenType["_enum"] = _enum] = "_enum"; // enum keyword startsExpr + const _type = 114192; TokenType[TokenType["_type"] = _type] = "_type"; // type keyword startsExpr + const _implements = 115216; TokenType[TokenType["_implements"] = _implements] = "_implements"; // implements keyword startsExpr +})(TokenType || (exports.TokenType = TokenType = {})); + function formatTokenType(tokenType) { + switch (tokenType) { + case TokenType.num: + return "num"; + case TokenType.bigint: + return "bigint"; + case TokenType.decimal: + return "decimal"; + case TokenType.regexp: + return "regexp"; + case TokenType.string: + return "string"; + case TokenType.name: + return "name"; + case TokenType.eof: + return "eof"; + case TokenType.bracketL: + return "["; + case TokenType.bracketR: + return "]"; + case TokenType.braceL: + return "{"; + case TokenType.braceBarL: + return "{|"; + case TokenType.braceR: + return "}"; + case TokenType.braceBarR: + return "|}"; + case TokenType.parenL: + return "("; + case TokenType.parenR: + return ")"; + case TokenType.comma: + return ","; + case TokenType.semi: + return ";"; + case TokenType.colon: + return ":"; + case TokenType.doubleColon: + return "::"; + case TokenType.dot: + return "."; + case TokenType.question: + return "?"; + case TokenType.questionDot: + return "?."; + case TokenType.arrow: + return "=>"; + case TokenType.template: + return "template"; + case TokenType.ellipsis: + return "..."; + case TokenType.backQuote: + return "`"; + case TokenType.dollarBraceL: + return "${"; + case TokenType.at: + return "@"; + case TokenType.hash: + return "#"; + case TokenType.eq: + return "="; + case TokenType.assign: + return "_="; + case TokenType.preIncDec: + return "++/--"; + case TokenType.postIncDec: + return "++/--"; + case TokenType.bang: + return "!"; + case TokenType.tilde: + return "~"; + case TokenType.pipeline: + return "|>"; + case TokenType.nullishCoalescing: + return "??"; + case TokenType.logicalOR: + return "||"; + case TokenType.logicalAND: + return "&&"; + case TokenType.bitwiseOR: + return "|"; + case TokenType.bitwiseXOR: + return "^"; + case TokenType.bitwiseAND: + return "&"; + case TokenType.equality: + return "==/!="; + case TokenType.lessThan: + return "<"; + case TokenType.greaterThan: + return ">"; + case TokenType.relationalOrEqual: + return "<=/>="; + case TokenType.bitShiftL: + return "<<"; + case TokenType.bitShiftR: + return ">>/>>>"; + case TokenType.plus: + return "+"; + case TokenType.minus: + return "-"; + case TokenType.modulo: + return "%"; + case TokenType.star: + return "*"; + case TokenType.slash: + return "/"; + case TokenType.exponent: + return "**"; + case TokenType.jsxName: + return "jsxName"; + case TokenType.jsxText: + return "jsxText"; + case TokenType.jsxEmptyText: + return "jsxEmptyText"; + case TokenType.jsxTagStart: + return "jsxTagStart"; + case TokenType.jsxTagEnd: + return "jsxTagEnd"; + case TokenType.typeParameterStart: + return "typeParameterStart"; + case TokenType.nonNullAssertion: + return "nonNullAssertion"; + case TokenType._break: + return "break"; + case TokenType._case: + return "case"; + case TokenType._catch: + return "catch"; + case TokenType._continue: + return "continue"; + case TokenType._debugger: + return "debugger"; + case TokenType._default: + return "default"; + case TokenType._do: + return "do"; + case TokenType._else: + return "else"; + case TokenType._finally: + return "finally"; + case TokenType._for: + return "for"; + case TokenType._function: + return "function"; + case TokenType._if: + return "if"; + case TokenType._return: + return "return"; + case TokenType._switch: + return "switch"; + case TokenType._throw: + return "throw"; + case TokenType._try: + return "try"; + case TokenType._var: + return "var"; + case TokenType._let: + return "let"; + case TokenType._const: + return "const"; + case TokenType._while: + return "while"; + case TokenType._with: + return "with"; + case TokenType._new: + return "new"; + case TokenType._this: + return "this"; + case TokenType._super: + return "super"; + case TokenType._class: + return "class"; + case TokenType._extends: + return "extends"; + case TokenType._export: + return "export"; + case TokenType._import: + return "import"; + case TokenType._yield: + return "yield"; + case TokenType._null: + return "null"; + case TokenType._true: + return "true"; + case TokenType._false: + return "false"; + case TokenType._in: + return "in"; + case TokenType._instanceof: + return "instanceof"; + case TokenType._typeof: + return "typeof"; + case TokenType._void: + return "void"; + case TokenType._delete: + return "delete"; + case TokenType._async: + return "async"; + case TokenType._get: + return "get"; + case TokenType._set: + return "set"; + case TokenType._declare: + return "declare"; + case TokenType._readonly: + return "readonly"; + case TokenType._abstract: + return "abstract"; + case TokenType._static: + return "static"; + case TokenType._public: + return "public"; + case TokenType._private: + return "private"; + case TokenType._protected: + return "protected"; + case TokenType._override: + return "override"; + case TokenType._as: + return "as"; + case TokenType._enum: + return "enum"; + case TokenType._type: + return "type"; + case TokenType._implements: + return "implements"; + default: + return ""; + } +} exports.formatTokenType = formatTokenType; diff --git a/node_modules/sucrase/dist/parser/traverser/base.js b/node_modules/sucrase/dist/parser/traverser/base.js new file mode 100644 index 00000000..85c9c176 --- /dev/null +++ b/node_modules/sucrase/dist/parser/traverser/base.js @@ -0,0 +1,60 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _state = require('../tokenizer/state'); var _state2 = _interopRequireDefault(_state); +var _charcodes = require('../util/charcodes'); + + exports.isJSXEnabled; + exports.isTypeScriptEnabled; + exports.isFlowEnabled; + exports.state; + exports.input; + exports.nextContextId; + + function getNextContextId() { + return exports.nextContextId++; +} exports.getNextContextId = getNextContextId; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any + function augmentError(error) { + if ("pos" in error) { + const loc = locationForIndex(error.pos); + error.message += ` (${loc.line}:${loc.column})`; + error.loc = loc; + } + return error; +} exports.augmentError = augmentError; + + class Loc { + + + constructor(line, column) { + this.line = line; + this.column = column; + } +} exports.Loc = Loc; + + function locationForIndex(pos) { + let line = 1; + let column = 1; + for (let i = 0; i < pos; i++) { + if (exports.input.charCodeAt(i) === _charcodes.charCodes.lineFeed) { + line++; + column = 1; + } else { + column++; + } + } + return new Loc(line, column); +} exports.locationForIndex = locationForIndex; + + function initParser( + inputCode, + isJSXEnabledArg, + isTypeScriptEnabledArg, + isFlowEnabledArg, +) { + exports.input = inputCode; + exports.state = new (0, _state2.default)(); + exports.nextContextId = 1; + exports.isJSXEnabled = isJSXEnabledArg; + exports.isTypeScriptEnabled = isTypeScriptEnabledArg; + exports.isFlowEnabled = isFlowEnabledArg; +} exports.initParser = initParser; diff --git a/node_modules/sucrase/dist/parser/traverser/expression.js b/node_modules/sucrase/dist/parser/traverser/expression.js new file mode 100644 index 00000000..d0011e37 --- /dev/null +++ b/node_modules/sucrase/dist/parser/traverser/expression.js @@ -0,0 +1,1022 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});/* eslint max-len: 0 */ + +// A recursive descent parser operates by defining functions for all +// syntactic elements, and recursively calling those, each function +// advancing the input stream and returning an AST node. Precedence +// of constructs (for example, the fact that `!x[1]` means `!(x[1])` +// instead of `(!x)[1]` is handled by the fact that the parser +// function that parses unary prefix operators is called first, and +// in turn calls the function that parses `[]` subscripts — that +// way, it'll receive the node for `x[1]` already parsed, and wraps +// *that* in the unary operator node. +// +// Acorn uses an [operator precedence parser][opp] to handle binary +// operator precedence, because it is much more compact than using +// the technique outlined above, which uses different, nesting +// functions to specify precedence, for all of the ten binary +// precedence levels that JavaScript defines. +// +// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser + + + + + + + + + + + +var _flow = require('../plugins/flow'); +var _index = require('../plugins/jsx/index'); +var _types = require('../plugins/types'); + + + + + + + + + +var _typescript = require('../plugins/typescript'); + + + + + + + + + + + + +var _index3 = require('../tokenizer/index'); +var _keywords = require('../tokenizer/keywords'); +var _state = require('../tokenizer/state'); +var _types3 = require('../tokenizer/types'); +var _charcodes = require('../util/charcodes'); +var _identifier = require('../util/identifier'); +var _base = require('./base'); + + + + + + +var _lval = require('./lval'); + + + + + + + +var _statement = require('./statement'); + + + + + + + + + +var _util = require('./util'); + + class StopState { + + constructor(stop) { + this.stop = stop; + } +} exports.StopState = StopState; + +// ### Expression parsing + +// These nest, from the most general expression type at the top to +// 'atomic', nondivisible expression types at the bottom. Most of +// the functions will simply let the function (s) below them parse, +// and, *if* the syntactic construct they handle is present, wrap +// the AST node that the inner parser gave them in another node. + function parseExpression(noIn = false) { + parseMaybeAssign(noIn); + if (_index3.match.call(void 0, _types3.TokenType.comma)) { + while (_index3.eat.call(void 0, _types3.TokenType.comma)) { + parseMaybeAssign(noIn); + } + } +} exports.parseExpression = parseExpression; + +/** + * noIn is used when parsing a for loop so that we don't interpret a following "in" as the binary + * operatior. + * isWithinParens is used to indicate that we're parsing something that might be a comma expression + * or might be an arrow function or might be a Flow type assertion (which requires explicit parens). + * In these cases, we should allow : and ?: after the initial "left" part. + */ + function parseMaybeAssign(noIn = false, isWithinParens = false) { + if (_base.isTypeScriptEnabled) { + return _typescript.tsParseMaybeAssign.call(void 0, noIn, isWithinParens); + } else if (_base.isFlowEnabled) { + return _flow.flowParseMaybeAssign.call(void 0, noIn, isWithinParens); + } else { + return baseParseMaybeAssign(noIn, isWithinParens); + } +} exports.parseMaybeAssign = parseMaybeAssign; + +// Parse an assignment expression. This includes applications of +// operators like `+=`. +// Returns true if the expression was an arrow function. + function baseParseMaybeAssign(noIn, isWithinParens) { + if (_index3.match.call(void 0, _types3.TokenType._yield)) { + parseYield(); + return false; + } + + if (_index3.match.call(void 0, _types3.TokenType.parenL) || _index3.match.call(void 0, _types3.TokenType.name) || _index3.match.call(void 0, _types3.TokenType._yield)) { + _base.state.potentialArrowAt = _base.state.start; + } + + const wasArrow = parseMaybeConditional(noIn); + if (isWithinParens) { + parseParenItem(); + } + if (_base.state.type & _types3.TokenType.IS_ASSIGN) { + _index3.next.call(void 0, ); + parseMaybeAssign(noIn); + return false; + } + return wasArrow; +} exports.baseParseMaybeAssign = baseParseMaybeAssign; + +// Parse a ternary conditional (`?:`) operator. +// Returns true if the expression was an arrow function. +function parseMaybeConditional(noIn) { + const wasArrow = parseExprOps(noIn); + if (wasArrow) { + return true; + } + parseConditional(noIn); + return false; +} + +function parseConditional(noIn) { + if (_base.isTypeScriptEnabled || _base.isFlowEnabled) { + _types.typedParseConditional.call(void 0, noIn); + } else { + baseParseConditional(noIn); + } +} + + function baseParseConditional(noIn) { + if (_index3.eat.call(void 0, _types3.TokenType.question)) { + parseMaybeAssign(); + _util.expect.call(void 0, _types3.TokenType.colon); + parseMaybeAssign(noIn); + } +} exports.baseParseConditional = baseParseConditional; + +// Start the precedence parser. +// Returns true if this was an arrow function +function parseExprOps(noIn) { + const startTokenIndex = _base.state.tokens.length; + const wasArrow = parseMaybeUnary(); + if (wasArrow) { + return true; + } + parseExprOp(startTokenIndex, -1, noIn); + return false; +} + +// Parse binary operators with the operator precedence parsing +// algorithm. `left` is the left-hand side of the operator. +// `minPrec` provides context that allows the function to stop and +// defer further parser to one of its callers when it encounters an +// operator that has a lower precedence than the set it is parsing. +function parseExprOp(startTokenIndex, minPrec, noIn) { + if ( + _base.isTypeScriptEnabled && + (_types3.TokenType._in & _types3.TokenType.PRECEDENCE_MASK) > minPrec && + !_util.hasPrecedingLineBreak.call(void 0, ) && + (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._as) || _util.eatContextual.call(void 0, _keywords.ContextualKeyword._satisfies)) + ) { + const oldIsType = _index3.pushTypeContext.call(void 0, 1); + _typescript.tsParseType.call(void 0, ); + _index3.popTypeContext.call(void 0, oldIsType); + _index3.rescan_gt.call(void 0, ); + parseExprOp(startTokenIndex, minPrec, noIn); + return; + } + + const prec = _base.state.type & _types3.TokenType.PRECEDENCE_MASK; + if (prec > 0 && (!noIn || !_index3.match.call(void 0, _types3.TokenType._in))) { + if (prec > minPrec) { + const op = _base.state.type; + _index3.next.call(void 0, ); + if (op === _types3.TokenType.nullishCoalescing) { + _base.state.tokens[_base.state.tokens.length - 1].nullishStartIndex = startTokenIndex; + } + + const rhsStartTokenIndex = _base.state.tokens.length; + parseMaybeUnary(); + // Extend the right operand of this operator if possible. + parseExprOp(rhsStartTokenIndex, op & _types3.TokenType.IS_RIGHT_ASSOCIATIVE ? prec - 1 : prec, noIn); + if (op === _types3.TokenType.nullishCoalescing) { + _base.state.tokens[startTokenIndex].numNullishCoalesceStarts++; + _base.state.tokens[_base.state.tokens.length - 1].numNullishCoalesceEnds++; + } + // Continue with any future operator holding this expression as the left operand. + parseExprOp(startTokenIndex, minPrec, noIn); + } + } +} + +// Parse unary operators, both prefix and postfix. +// Returns true if this was an arrow function. + function parseMaybeUnary() { + if (_base.isTypeScriptEnabled && !_base.isJSXEnabled && _index3.eat.call(void 0, _types3.TokenType.lessThan)) { + _typescript.tsParseTypeAssertion.call(void 0, ); + return false; + } + if ( + _util.isContextual.call(void 0, _keywords.ContextualKeyword._module) && + _index3.lookaheadCharCode.call(void 0, ) === _charcodes.charCodes.leftCurlyBrace && + !_util.hasFollowingLineBreak.call(void 0, ) + ) { + parseModuleExpression(); + return false; + } + if (_base.state.type & _types3.TokenType.IS_PREFIX) { + _index3.next.call(void 0, ); + parseMaybeUnary(); + return false; + } + + const wasArrow = parseExprSubscripts(); + if (wasArrow) { + return true; + } + while (_base.state.type & _types3.TokenType.IS_POSTFIX && !_util.canInsertSemicolon.call(void 0, )) { + // The tokenizer calls everything a preincrement, so make it a postincrement when + // we see it in that context. + if (_base.state.type === _types3.TokenType.preIncDec) { + _base.state.type = _types3.TokenType.postIncDec; + } + _index3.next.call(void 0, ); + } + return false; +} exports.parseMaybeUnary = parseMaybeUnary; + +// Parse call, dot, and `[]`-subscript expressions. +// Returns true if this was an arrow function. + function parseExprSubscripts() { + const startTokenIndex = _base.state.tokens.length; + const wasArrow = parseExprAtom(); + if (wasArrow) { + return true; + } + parseSubscripts(startTokenIndex); + // If there was any optional chain operation, the start token would be marked + // as such, so also mark the end now. + if (_base.state.tokens.length > startTokenIndex && _base.state.tokens[startTokenIndex].isOptionalChainStart) { + _base.state.tokens[_base.state.tokens.length - 1].isOptionalChainEnd = true; + } + return false; +} exports.parseExprSubscripts = parseExprSubscripts; + +function parseSubscripts(startTokenIndex, noCalls = false) { + if (_base.isFlowEnabled) { + _flow.flowParseSubscripts.call(void 0, startTokenIndex, noCalls); + } else { + baseParseSubscripts(startTokenIndex, noCalls); + } +} + + function baseParseSubscripts(startTokenIndex, noCalls = false) { + const stopState = new StopState(false); + do { + parseSubscript(startTokenIndex, noCalls, stopState); + } while (!stopState.stop && !_base.state.error); +} exports.baseParseSubscripts = baseParseSubscripts; + +function parseSubscript(startTokenIndex, noCalls, stopState) { + if (_base.isTypeScriptEnabled) { + _typescript.tsParseSubscript.call(void 0, startTokenIndex, noCalls, stopState); + } else if (_base.isFlowEnabled) { + _flow.flowParseSubscript.call(void 0, startTokenIndex, noCalls, stopState); + } else { + baseParseSubscript(startTokenIndex, noCalls, stopState); + } +} + +/** Set 'state.stop = true' to indicate that we should stop parsing subscripts. */ + function baseParseSubscript( + startTokenIndex, + noCalls, + stopState, +) { + if (!noCalls && _index3.eat.call(void 0, _types3.TokenType.doubleColon)) { + parseNoCallExpr(); + stopState.stop = true; + // Propagate startTokenIndex so that `a::b?.()` will keep `a` as the first token. We may want + // to revisit this in the future when fully supporting bind syntax. + parseSubscripts(startTokenIndex, noCalls); + } else if (_index3.match.call(void 0, _types3.TokenType.questionDot)) { + _base.state.tokens[startTokenIndex].isOptionalChainStart = true; + if (noCalls && _index3.lookaheadType.call(void 0, ) === _types3.TokenType.parenL) { + stopState.stop = true; + return; + } + _index3.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + + if (_index3.eat.call(void 0, _types3.TokenType.bracketL)) { + parseExpression(); + _util.expect.call(void 0, _types3.TokenType.bracketR); + } else if (_index3.eat.call(void 0, _types3.TokenType.parenL)) { + parseCallExpressionArguments(); + } else { + parseMaybePrivateName(); + } + } else if (_index3.eat.call(void 0, _types3.TokenType.dot)) { + _base.state.tokens[_base.state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + parseMaybePrivateName(); + } else if (_index3.eat.call(void 0, _types3.TokenType.bracketL)) { + _base.state.tokens[_base.state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + parseExpression(); + _util.expect.call(void 0, _types3.TokenType.bracketR); + } else if (!noCalls && _index3.match.call(void 0, _types3.TokenType.parenL)) { + if (atPossibleAsync()) { + // We see "async", but it's possible it's a usage of the name "async". Parse as if it's a + // function call, and if we see an arrow later, backtrack and re-parse as a parameter list. + const snapshot = _base.state.snapshot(); + const asyncStartTokenIndex = _base.state.tokens.length; + _index3.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + + const callContextId = _base.getNextContextId.call(void 0, ); + + _base.state.tokens[_base.state.tokens.length - 1].contextId = callContextId; + parseCallExpressionArguments(); + _base.state.tokens[_base.state.tokens.length - 1].contextId = callContextId; + + if (shouldParseAsyncArrow()) { + // We hit an arrow, so backtrack and start again parsing function parameters. + _base.state.restoreFromSnapshot(snapshot); + stopState.stop = true; + _base.state.scopeDepth++; + + _statement.parseFunctionParams.call(void 0, ); + parseAsyncArrowFromCallExpression(asyncStartTokenIndex); + } + } else { + _index3.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].subscriptStartIndex = startTokenIndex; + const callContextId = _base.getNextContextId.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].contextId = callContextId; + parseCallExpressionArguments(); + _base.state.tokens[_base.state.tokens.length - 1].contextId = callContextId; + } + } else if (_index3.match.call(void 0, _types3.TokenType.backQuote)) { + // Tagged template expression. + parseTemplate(); + } else { + stopState.stop = true; + } +} exports.baseParseSubscript = baseParseSubscript; + + function atPossibleAsync() { + // This was made less strict than the original version to avoid passing around nodes, but it + // should be safe to have rare false positives here. + return ( + _base.state.tokens[_base.state.tokens.length - 1].contextualKeyword === _keywords.ContextualKeyword._async && + !_util.canInsertSemicolon.call(void 0, ) + ); +} exports.atPossibleAsync = atPossibleAsync; + + function parseCallExpressionArguments() { + let first = true; + while (!_index3.eat.call(void 0, _types3.TokenType.parenR) && !_base.state.error) { + if (first) { + first = false; + } else { + _util.expect.call(void 0, _types3.TokenType.comma); + if (_index3.eat.call(void 0, _types3.TokenType.parenR)) { + break; + } + } + + parseExprListItem(false); + } +} exports.parseCallExpressionArguments = parseCallExpressionArguments; + +function shouldParseAsyncArrow() { + return _index3.match.call(void 0, _types3.TokenType.colon) || _index3.match.call(void 0, _types3.TokenType.arrow); +} + +function parseAsyncArrowFromCallExpression(startTokenIndex) { + if (_base.isTypeScriptEnabled) { + _typescript.tsStartParseAsyncArrowFromCallExpression.call(void 0, ); + } else if (_base.isFlowEnabled) { + _flow.flowStartParseAsyncArrowFromCallExpression.call(void 0, ); + } + _util.expect.call(void 0, _types3.TokenType.arrow); + parseArrowExpression(startTokenIndex); +} + +// Parse a no-call expression (like argument of `new` or `::` operators). + +function parseNoCallExpr() { + const startTokenIndex = _base.state.tokens.length; + parseExprAtom(); + parseSubscripts(startTokenIndex, true); +} + +// Parse an atomic expression — either a single token that is an +// expression, an expression started by a keyword like `function` or +// `new`, or an expression wrapped in punctuation like `()`, `[]`, +// or `{}`. +// Returns true if the parsed expression was an arrow function. + function parseExprAtom() { + if (_index3.eat.call(void 0, _types3.TokenType.modulo)) { + // V8 intrinsic expression. Just parse the identifier, and the function invocation is parsed + // naturally. + parseIdentifier(); + return false; + } + + if (_index3.match.call(void 0, _types3.TokenType.jsxText) || _index3.match.call(void 0, _types3.TokenType.jsxEmptyText)) { + parseLiteral(); + return false; + } else if (_index3.match.call(void 0, _types3.TokenType.lessThan) && _base.isJSXEnabled) { + _base.state.type = _types3.TokenType.jsxTagStart; + _index.jsxParseElement.call(void 0, ); + _index3.next.call(void 0, ); + return false; + } + + const canBeArrow = _base.state.potentialArrowAt === _base.state.start; + switch (_base.state.type) { + case _types3.TokenType.slash: + case _types3.TokenType.assign: + _index3.retokenizeSlashAsRegex.call(void 0, ); + // Fall through. + + case _types3.TokenType._super: + case _types3.TokenType._this: + case _types3.TokenType.regexp: + case _types3.TokenType.num: + case _types3.TokenType.bigint: + case _types3.TokenType.decimal: + case _types3.TokenType.string: + case _types3.TokenType._null: + case _types3.TokenType._true: + case _types3.TokenType._false: + _index3.next.call(void 0, ); + return false; + + case _types3.TokenType._import: + _index3.next.call(void 0, ); + if (_index3.match.call(void 0, _types3.TokenType.dot)) { + // import.meta + _base.state.tokens[_base.state.tokens.length - 1].type = _types3.TokenType.name; + _index3.next.call(void 0, ); + parseIdentifier(); + } + return false; + + case _types3.TokenType.name: { + const startTokenIndex = _base.state.tokens.length; + const functionStart = _base.state.start; + const contextualKeyword = _base.state.contextualKeyword; + parseIdentifier(); + if (contextualKeyword === _keywords.ContextualKeyword._await) { + parseAwait(); + return false; + } else if ( + contextualKeyword === _keywords.ContextualKeyword._async && + _index3.match.call(void 0, _types3.TokenType._function) && + !_util.canInsertSemicolon.call(void 0, ) + ) { + _index3.next.call(void 0, ); + _statement.parseFunction.call(void 0, functionStart, false); + return false; + } else if ( + canBeArrow && + contextualKeyword === _keywords.ContextualKeyword._async && + !_util.canInsertSemicolon.call(void 0, ) && + _index3.match.call(void 0, _types3.TokenType.name) + ) { + _base.state.scopeDepth++; + _lval.parseBindingIdentifier.call(void 0, false); + _util.expect.call(void 0, _types3.TokenType.arrow); + // let foo = async bar => {}; + parseArrowExpression(startTokenIndex); + return true; + } else if (_index3.match.call(void 0, _types3.TokenType._do) && !_util.canInsertSemicolon.call(void 0, )) { + _index3.next.call(void 0, ); + _statement.parseBlock.call(void 0, ); + return false; + } + + if (canBeArrow && !_util.canInsertSemicolon.call(void 0, ) && _index3.match.call(void 0, _types3.TokenType.arrow)) { + _base.state.scopeDepth++; + _lval.markPriorBindingIdentifier.call(void 0, false); + _util.expect.call(void 0, _types3.TokenType.arrow); + parseArrowExpression(startTokenIndex); + return true; + } + + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _index3.IdentifierRole.Access; + return false; + } + + case _types3.TokenType._do: { + _index3.next.call(void 0, ); + _statement.parseBlock.call(void 0, ); + return false; + } + + case _types3.TokenType.parenL: { + const wasArrow = parseParenAndDistinguishExpression(canBeArrow); + return wasArrow; + } + + case _types3.TokenType.bracketL: + _index3.next.call(void 0, ); + parseExprList(_types3.TokenType.bracketR, true); + return false; + + case _types3.TokenType.braceL: + parseObj(false, false); + return false; + + case _types3.TokenType._function: + parseFunctionExpression(); + return false; + + case _types3.TokenType.at: + _statement.parseDecorators.call(void 0, ); + // Fall through. + + case _types3.TokenType._class: + _statement.parseClass.call(void 0, false); + return false; + + case _types3.TokenType._new: + parseNew(); + return false; + + case _types3.TokenType.backQuote: + parseTemplate(); + return false; + + case _types3.TokenType.doubleColon: { + _index3.next.call(void 0, ); + parseNoCallExpr(); + return false; + } + + case _types3.TokenType.hash: { + const code = _index3.lookaheadCharCode.call(void 0, ); + if (_identifier.IS_IDENTIFIER_START[code] || code === _charcodes.charCodes.backslash) { + parseMaybePrivateName(); + } else { + _index3.next.call(void 0, ); + } + // Smart pipeline topic reference. + return false; + } + + default: + _util.unexpected.call(void 0, ); + return false; + } +} exports.parseExprAtom = parseExprAtom; + +function parseMaybePrivateName() { + _index3.eat.call(void 0, _types3.TokenType.hash); + parseIdentifier(); +} + +function parseFunctionExpression() { + const functionStart = _base.state.start; + parseIdentifier(); + if (_index3.eat.call(void 0, _types3.TokenType.dot)) { + // function.sent + parseIdentifier(); + } + _statement.parseFunction.call(void 0, functionStart, false); +} + + function parseLiteral() { + _index3.next.call(void 0, ); +} exports.parseLiteral = parseLiteral; + + function parseParenExpression() { + _util.expect.call(void 0, _types3.TokenType.parenL); + parseExpression(); + _util.expect.call(void 0, _types3.TokenType.parenR); +} exports.parseParenExpression = parseParenExpression; + +// Returns true if this was an arrow expression. +function parseParenAndDistinguishExpression(canBeArrow) { + // Assume this is a normal parenthesized expression, but if we see an arrow, we'll bail and + // start over as a parameter list. + const snapshot = _base.state.snapshot(); + + const startTokenIndex = _base.state.tokens.length; + _util.expect.call(void 0, _types3.TokenType.parenL); + + let first = true; + + while (!_index3.match.call(void 0, _types3.TokenType.parenR) && !_base.state.error) { + if (first) { + first = false; + } else { + _util.expect.call(void 0, _types3.TokenType.comma); + if (_index3.match.call(void 0, _types3.TokenType.parenR)) { + break; + } + } + + if (_index3.match.call(void 0, _types3.TokenType.ellipsis)) { + _lval.parseRest.call(void 0, false /* isBlockScope */); + parseParenItem(); + break; + } else { + parseMaybeAssign(false, true); + } + } + + _util.expect.call(void 0, _types3.TokenType.parenR); + + if (canBeArrow && shouldParseArrow()) { + const wasArrow = parseArrow(); + if (wasArrow) { + // It was an arrow function this whole time, so start over and parse it as params so that we + // get proper token annotations. + _base.state.restoreFromSnapshot(snapshot); + _base.state.scopeDepth++; + // Don't specify a context ID because arrow functions don't need a context ID. + _statement.parseFunctionParams.call(void 0, ); + parseArrow(); + parseArrowExpression(startTokenIndex); + if (_base.state.error) { + // Nevermind! This must have been something that looks very much like an + // arrow function but where its "parameter list" isn't actually a valid + // parameter list. Force non-arrow parsing. + // See https://github.com/alangpierce/sucrase/issues/666 for an example. + _base.state.restoreFromSnapshot(snapshot); + parseParenAndDistinguishExpression(false); + return false; + } + return true; + } + } + + return false; +} + +function shouldParseArrow() { + return _index3.match.call(void 0, _types3.TokenType.colon) || !_util.canInsertSemicolon.call(void 0, ); +} + +// Returns whether there was an arrow token. + function parseArrow() { + if (_base.isTypeScriptEnabled) { + return _typescript.tsParseArrow.call(void 0, ); + } else if (_base.isFlowEnabled) { + return _flow.flowParseArrow.call(void 0, ); + } else { + return _index3.eat.call(void 0, _types3.TokenType.arrow); + } +} exports.parseArrow = parseArrow; + +function parseParenItem() { + if (_base.isTypeScriptEnabled || _base.isFlowEnabled) { + _types.typedParseParenItem.call(void 0, ); + } +} + +// New's precedence is slightly tricky. It must allow its argument to +// be a `[]` or dot subscript expression, but not a call — at least, +// not without wrapping it in parentheses. Thus, it uses the noCalls +// argument to parseSubscripts to prevent it from consuming the +// argument list. +function parseNew() { + _util.expect.call(void 0, _types3.TokenType._new); + if (_index3.eat.call(void 0, _types3.TokenType.dot)) { + // new.target + parseIdentifier(); + return; + } + parseNewCallee(); + if (_base.isFlowEnabled) { + _flow.flowStartParseNewArguments.call(void 0, ); + } + if (_index3.eat.call(void 0, _types3.TokenType.parenL)) { + parseExprList(_types3.TokenType.parenR); + } +} + +function parseNewCallee() { + parseNoCallExpr(); + _index3.eat.call(void 0, _types3.TokenType.questionDot); +} + + function parseTemplate() { + // Finish `, read quasi + _index3.nextTemplateToken.call(void 0, ); + // Finish quasi, read ${ + _index3.nextTemplateToken.call(void 0, ); + while (!_index3.match.call(void 0, _types3.TokenType.backQuote) && !_base.state.error) { + _util.expect.call(void 0, _types3.TokenType.dollarBraceL); + parseExpression(); + // Finish }, read quasi + _index3.nextTemplateToken.call(void 0, ); + // Finish quasi, read either ${ or ` + _index3.nextTemplateToken.call(void 0, ); + } + _index3.next.call(void 0, ); +} exports.parseTemplate = parseTemplate; + +// Parse an object literal or binding pattern. + function parseObj(isPattern, isBlockScope) { + // Attach a context ID to the object open and close brace and each object key. + const contextId = _base.getNextContextId.call(void 0, ); + let first = true; + + _index3.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].contextId = contextId; + + while (!_index3.eat.call(void 0, _types3.TokenType.braceR) && !_base.state.error) { + if (first) { + first = false; + } else { + _util.expect.call(void 0, _types3.TokenType.comma); + if (_index3.eat.call(void 0, _types3.TokenType.braceR)) { + break; + } + } + + let isGenerator = false; + if (_index3.match.call(void 0, _types3.TokenType.ellipsis)) { + const previousIndex = _base.state.tokens.length; + _lval.parseSpread.call(void 0, ); + if (isPattern) { + // Mark role when the only thing being spread over is an identifier. + if (_base.state.tokens.length === previousIndex + 2) { + _lval.markPriorBindingIdentifier.call(void 0, isBlockScope); + } + if (_index3.eat.call(void 0, _types3.TokenType.braceR)) { + break; + } + } + continue; + } + + if (!isPattern) { + isGenerator = _index3.eat.call(void 0, _types3.TokenType.star); + } + + if (!isPattern && _util.isContextual.call(void 0, _keywords.ContextualKeyword._async)) { + if (isGenerator) _util.unexpected.call(void 0, ); + + parseIdentifier(); + if ( + _index3.match.call(void 0, _types3.TokenType.colon) || + _index3.match.call(void 0, _types3.TokenType.parenL) || + _index3.match.call(void 0, _types3.TokenType.braceR) || + _index3.match.call(void 0, _types3.TokenType.eq) || + _index3.match.call(void 0, _types3.TokenType.comma) + ) { + // This is a key called "async" rather than an async function. + } else { + if (_index3.match.call(void 0, _types3.TokenType.star)) { + _index3.next.call(void 0, ); + isGenerator = true; + } + parsePropertyName(contextId); + } + } else { + parsePropertyName(contextId); + } + + parseObjPropValue(isPattern, isBlockScope, contextId); + } + + _base.state.tokens[_base.state.tokens.length - 1].contextId = contextId; +} exports.parseObj = parseObj; + +function isGetterOrSetterMethod(isPattern) { + // We go off of the next and don't bother checking if the node key is actually "get" or "set". + // This lets us avoid generating a node, and should only make the validation worse. + return ( + !isPattern && + (_index3.match.call(void 0, _types3.TokenType.string) || // get "string"() {} + _index3.match.call(void 0, _types3.TokenType.num) || // get 1() {} + _index3.match.call(void 0, _types3.TokenType.bracketL) || // get ["string"]() {} + _index3.match.call(void 0, _types3.TokenType.name) || // get foo() {} + !!(_base.state.type & _types3.TokenType.IS_KEYWORD)) // get debugger() {} + ); +} + +// Returns true if this was a method. +function parseObjectMethod(isPattern, objectContextId) { + // We don't need to worry about modifiers because object methods can't have optional bodies, so + // the start will never be used. + const functionStart = _base.state.start; + if (_index3.match.call(void 0, _types3.TokenType.parenL)) { + if (isPattern) _util.unexpected.call(void 0, ); + parseMethod(functionStart, /* isConstructor */ false); + return true; + } + + if (isGetterOrSetterMethod(isPattern)) { + parsePropertyName(objectContextId); + parseMethod(functionStart, /* isConstructor */ false); + return true; + } + return false; +} + +function parseObjectProperty(isPattern, isBlockScope) { + if (_index3.eat.call(void 0, _types3.TokenType.colon)) { + if (isPattern) { + _lval.parseMaybeDefault.call(void 0, isBlockScope); + } else { + parseMaybeAssign(false); + } + return; + } + + // Since there's no colon, we assume this is an object shorthand. + + // If we're in a destructuring, we've now discovered that the key was actually an assignee, so + // we need to tag it as a declaration with the appropriate scope. Otherwise, we might need to + // transform it on access, so mark it as a normal object shorthand. + let identifierRole; + if (isPattern) { + if (_base.state.scopeDepth === 0) { + identifierRole = _index3.IdentifierRole.ObjectShorthandTopLevelDeclaration; + } else if (isBlockScope) { + identifierRole = _index3.IdentifierRole.ObjectShorthandBlockScopedDeclaration; + } else { + identifierRole = _index3.IdentifierRole.ObjectShorthandFunctionScopedDeclaration; + } + } else { + identifierRole = _index3.IdentifierRole.ObjectShorthand; + } + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = identifierRole; + + // Regardless of whether we know this to be a pattern or if we're in an ambiguous context, allow + // parsing as if there's a default value. + _lval.parseMaybeDefault.call(void 0, isBlockScope, true); +} + +function parseObjPropValue( + isPattern, + isBlockScope, + objectContextId, +) { + if (_base.isTypeScriptEnabled) { + _typescript.tsStartParseObjPropValue.call(void 0, ); + } else if (_base.isFlowEnabled) { + _flow.flowStartParseObjPropValue.call(void 0, ); + } + const wasMethod = parseObjectMethod(isPattern, objectContextId); + if (!wasMethod) { + parseObjectProperty(isPattern, isBlockScope); + } +} + + function parsePropertyName(objectContextId) { + if (_base.isFlowEnabled) { + _flow.flowParseVariance.call(void 0, ); + } + if (_index3.eat.call(void 0, _types3.TokenType.bracketL)) { + _base.state.tokens[_base.state.tokens.length - 1].contextId = objectContextId; + parseMaybeAssign(); + _util.expect.call(void 0, _types3.TokenType.bracketR); + _base.state.tokens[_base.state.tokens.length - 1].contextId = objectContextId; + } else { + if (_index3.match.call(void 0, _types3.TokenType.num) || _index3.match.call(void 0, _types3.TokenType.string) || _index3.match.call(void 0, _types3.TokenType.bigint) || _index3.match.call(void 0, _types3.TokenType.decimal)) { + parseExprAtom(); + } else { + parseMaybePrivateName(); + } + + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _index3.IdentifierRole.ObjectKey; + _base.state.tokens[_base.state.tokens.length - 1].contextId = objectContextId; + } +} exports.parsePropertyName = parsePropertyName; + +// Parse object or class method. + function parseMethod(functionStart, isConstructor) { + const funcContextId = _base.getNextContextId.call(void 0, ); + + _base.state.scopeDepth++; + const startTokenIndex = _base.state.tokens.length; + const allowModifiers = isConstructor; // For TypeScript parameter properties + _statement.parseFunctionParams.call(void 0, allowModifiers, funcContextId); + parseFunctionBodyAndFinish(functionStart, funcContextId); + const endTokenIndex = _base.state.tokens.length; + _base.state.scopes.push(new (0, _state.Scope)(startTokenIndex, endTokenIndex, true)); + _base.state.scopeDepth--; +} exports.parseMethod = parseMethod; + +// Parse arrow function expression. +// If the parameters are provided, they will be converted to an +// assignable list. + function parseArrowExpression(startTokenIndex) { + parseFunctionBody(true); + const endTokenIndex = _base.state.tokens.length; + _base.state.scopes.push(new (0, _state.Scope)(startTokenIndex, endTokenIndex, true)); + _base.state.scopeDepth--; +} exports.parseArrowExpression = parseArrowExpression; + + function parseFunctionBodyAndFinish(functionStart, funcContextId = 0) { + if (_base.isTypeScriptEnabled) { + _typescript.tsParseFunctionBodyAndFinish.call(void 0, functionStart, funcContextId); + } else if (_base.isFlowEnabled) { + _flow.flowParseFunctionBodyAndFinish.call(void 0, funcContextId); + } else { + parseFunctionBody(false, funcContextId); + } +} exports.parseFunctionBodyAndFinish = parseFunctionBodyAndFinish; + + function parseFunctionBody(allowExpression, funcContextId = 0) { + const isExpression = allowExpression && !_index3.match.call(void 0, _types3.TokenType.braceL); + + if (isExpression) { + parseMaybeAssign(); + } else { + _statement.parseBlock.call(void 0, true /* isFunctionScope */, funcContextId); + } +} exports.parseFunctionBody = parseFunctionBody; + +// Parses a comma-separated list of expressions, and returns them as +// an array. `close` is the token type that ends the list, and +// `allowEmpty` can be turned on to allow subsequent commas with +// nothing in between them to be parsed as `null` (which is needed +// for array literals). + +function parseExprList(close, allowEmpty = false) { + let first = true; + while (!_index3.eat.call(void 0, close) && !_base.state.error) { + if (first) { + first = false; + } else { + _util.expect.call(void 0, _types3.TokenType.comma); + if (_index3.eat.call(void 0, close)) break; + } + parseExprListItem(allowEmpty); + } +} + +function parseExprListItem(allowEmpty) { + if (allowEmpty && _index3.match.call(void 0, _types3.TokenType.comma)) { + // Empty item; nothing more to parse for this item. + } else if (_index3.match.call(void 0, _types3.TokenType.ellipsis)) { + _lval.parseSpread.call(void 0, ); + parseParenItem(); + } else if (_index3.match.call(void 0, _types3.TokenType.question)) { + // Partial function application proposal. + _index3.next.call(void 0, ); + } else { + parseMaybeAssign(false, true); + } +} + +// Parse the next token as an identifier. + function parseIdentifier() { + _index3.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].type = _types3.TokenType.name; +} exports.parseIdentifier = parseIdentifier; + +// Parses await expression inside async function. +function parseAwait() { + parseMaybeUnary(); +} + +// Parses yield expression inside generator. +function parseYield() { + _index3.next.call(void 0, ); + if (!_index3.match.call(void 0, _types3.TokenType.semi) && !_util.canInsertSemicolon.call(void 0, )) { + _index3.eat.call(void 0, _types3.TokenType.star); + parseMaybeAssign(); + } +} + +// https://github.com/tc39/proposal-js-module-blocks +function parseModuleExpression() { + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._module); + _util.expect.call(void 0, _types3.TokenType.braceL); + // For now, just call parseBlockBody to parse the block. In the future when we + // implement full support, we'll want to emit scopes and possibly other + // information. + _statement.parseBlockBody.call(void 0, _types3.TokenType.braceR); +} diff --git a/node_modules/sucrase/dist/parser/traverser/index.js b/node_modules/sucrase/dist/parser/traverser/index.js new file mode 100644 index 00000000..72e4130c --- /dev/null +++ b/node_modules/sucrase/dist/parser/traverser/index.js @@ -0,0 +1,18 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); +var _index = require('../tokenizer/index'); +var _charcodes = require('../util/charcodes'); +var _base = require('./base'); +var _statement = require('./statement'); + + function parseFile() { + // If enabled, skip leading hashbang line. + if ( + _base.state.pos === 0 && + _base.input.charCodeAt(0) === _charcodes.charCodes.numberSign && + _base.input.charCodeAt(1) === _charcodes.charCodes.exclamationMark + ) { + _index.skipLineComment.call(void 0, 2); + } + _index.nextToken.call(void 0, ); + return _statement.parseTopLevel.call(void 0, ); +} exports.parseFile = parseFile; diff --git a/node_modules/sucrase/dist/parser/traverser/lval.js b/node_modules/sucrase/dist/parser/traverser/lval.js new file mode 100644 index 00000000..90574979 --- /dev/null +++ b/node_modules/sucrase/dist/parser/traverser/lval.js @@ -0,0 +1,159 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _flow = require('../plugins/flow'); +var _typescript = require('../plugins/typescript'); + + + + + + + +var _index = require('../tokenizer/index'); +var _keywords = require('../tokenizer/keywords'); +var _types = require('../tokenizer/types'); +var _base = require('./base'); +var _expression = require('./expression'); +var _util = require('./util'); + + function parseSpread() { + _index.next.call(void 0, ); + _expression.parseMaybeAssign.call(void 0, false); +} exports.parseSpread = parseSpread; + + function parseRest(isBlockScope) { + _index.next.call(void 0, ); + parseBindingAtom(isBlockScope); +} exports.parseRest = parseRest; + + function parseBindingIdentifier(isBlockScope) { + _expression.parseIdentifier.call(void 0, ); + markPriorBindingIdentifier(isBlockScope); +} exports.parseBindingIdentifier = parseBindingIdentifier; + + function parseImportedIdentifier() { + _expression.parseIdentifier.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _index.IdentifierRole.ImportDeclaration; +} exports.parseImportedIdentifier = parseImportedIdentifier; + + function markPriorBindingIdentifier(isBlockScope) { + let identifierRole; + if (_base.state.scopeDepth === 0) { + identifierRole = _index.IdentifierRole.TopLevelDeclaration; + } else if (isBlockScope) { + identifierRole = _index.IdentifierRole.BlockScopedDeclaration; + } else { + identifierRole = _index.IdentifierRole.FunctionScopedDeclaration; + } + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = identifierRole; +} exports.markPriorBindingIdentifier = markPriorBindingIdentifier; + +// Parses lvalue (assignable) atom. + function parseBindingAtom(isBlockScope) { + switch (_base.state.type) { + case _types.TokenType._this: { + // In TypeScript, "this" may be the name of a parameter, so allow it. + const oldIsType = _index.pushTypeContext.call(void 0, 0); + _index.next.call(void 0, ); + _index.popTypeContext.call(void 0, oldIsType); + return; + } + + case _types.TokenType._yield: + case _types.TokenType.name: { + _base.state.type = _types.TokenType.name; + parseBindingIdentifier(isBlockScope); + return; + } + + case _types.TokenType.bracketL: { + _index.next.call(void 0, ); + parseBindingList(_types.TokenType.bracketR, isBlockScope, true /* allowEmpty */); + return; + } + + case _types.TokenType.braceL: + _expression.parseObj.call(void 0, true, isBlockScope); + return; + + default: + _util.unexpected.call(void 0, ); + } +} exports.parseBindingAtom = parseBindingAtom; + + function parseBindingList( + close, + isBlockScope, + allowEmpty = false, + allowModifiers = false, + contextId = 0, +) { + let first = true; + + let hasRemovedComma = false; + const firstItemTokenIndex = _base.state.tokens.length; + + while (!_index.eat.call(void 0, close) && !_base.state.error) { + if (first) { + first = false; + } else { + _util.expect.call(void 0, _types.TokenType.comma); + _base.state.tokens[_base.state.tokens.length - 1].contextId = contextId; + // After a "this" type in TypeScript, we need to set the following comma (if any) to also be + // a type token so that it will be removed. + if (!hasRemovedComma && _base.state.tokens[firstItemTokenIndex].isType) { + _base.state.tokens[_base.state.tokens.length - 1].isType = true; + hasRemovedComma = true; + } + } + if (allowEmpty && _index.match.call(void 0, _types.TokenType.comma)) { + // Empty item; nothing further to parse for this item. + } else if (_index.eat.call(void 0, close)) { + break; + } else if (_index.match.call(void 0, _types.TokenType.ellipsis)) { + parseRest(isBlockScope); + parseAssignableListItemTypes(); + // Support rest element trailing commas allowed by TypeScript <2.9. + _index.eat.call(void 0, _types.TokenType.comma); + _util.expect.call(void 0, close); + break; + } else { + parseAssignableListItem(allowModifiers, isBlockScope); + } + } +} exports.parseBindingList = parseBindingList; + +function parseAssignableListItem(allowModifiers, isBlockScope) { + if (allowModifiers) { + _typescript.tsParseModifiers.call(void 0, [ + _keywords.ContextualKeyword._public, + _keywords.ContextualKeyword._protected, + _keywords.ContextualKeyword._private, + _keywords.ContextualKeyword._readonly, + _keywords.ContextualKeyword._override, + ]); + } + + parseMaybeDefault(isBlockScope); + parseAssignableListItemTypes(); + parseMaybeDefault(isBlockScope, true /* leftAlreadyParsed */); +} + +function parseAssignableListItemTypes() { + if (_base.isFlowEnabled) { + _flow.flowParseAssignableListItemTypes.call(void 0, ); + } else if (_base.isTypeScriptEnabled) { + _typescript.tsParseAssignableListItemTypes.call(void 0, ); + } +} + +// Parses assignment pattern around given atom if possible. + function parseMaybeDefault(isBlockScope, leftAlreadyParsed = false) { + if (!leftAlreadyParsed) { + parseBindingAtom(isBlockScope); + } + if (!_index.eat.call(void 0, _types.TokenType.eq)) { + return; + } + const eqIndex = _base.state.tokens.length - 1; + _expression.parseMaybeAssign.call(void 0, ); + _base.state.tokens[eqIndex].rhsEndIndex = _base.state.tokens.length; +} exports.parseMaybeDefault = parseMaybeDefault; diff --git a/node_modules/sucrase/dist/parser/traverser/statement.js b/node_modules/sucrase/dist/parser/traverser/statement.js new file mode 100644 index 00000000..6be33915 --- /dev/null +++ b/node_modules/sucrase/dist/parser/traverser/statement.js @@ -0,0 +1,1332 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});/* eslint max-len: 0 */ + +var _index = require('../index'); + + + + + + + + + + + + + + + + +var _flow = require('../plugins/flow'); + + + + + + + + + + + + + + + + + + +var _typescript = require('../plugins/typescript'); + + + + + + + + + + + + +var _tokenizer = require('../tokenizer'); +var _keywords = require('../tokenizer/keywords'); +var _state = require('../tokenizer/state'); +var _types = require('../tokenizer/types'); +var _charcodes = require('../util/charcodes'); +var _base = require('./base'); + + + + + + + + + + + + +var _expression = require('./expression'); + + + + + +var _lval = require('./lval'); + + + + + + + + + + + + +var _util = require('./util'); + + function parseTopLevel() { + parseBlockBody(_types.TokenType.eof); + _base.state.scopes.push(new (0, _state.Scope)(0, _base.state.tokens.length, true)); + if (_base.state.scopeDepth !== 0) { + throw new Error(`Invalid scope depth at end of file: ${_base.state.scopeDepth}`); + } + return new (0, _index.File)(_base.state.tokens, _base.state.scopes); +} exports.parseTopLevel = parseTopLevel; + +// Parse a single statement. +// +// If expecting a statement and finding a slash operator, parse a +// regular expression literal. This is to handle cases like +// `if (foo) /blah/.exec(foo)`, where looking at the previous token +// does not help. + + function parseStatement(declaration) { + if (_base.isFlowEnabled) { + if (_flow.flowTryParseStatement.call(void 0, )) { + return; + } + } + if (_tokenizer.match.call(void 0, _types.TokenType.at)) { + parseDecorators(); + } + parseStatementContent(declaration); +} exports.parseStatement = parseStatement; + +function parseStatementContent(declaration) { + if (_base.isTypeScriptEnabled) { + if (_typescript.tsTryParseStatementContent.call(void 0, )) { + return; + } + } + + const starttype = _base.state.type; + + // Most types of statements are recognized by the keyword they + // start with. Many are trivial to parse, some require a bit of + // complexity. + + switch (starttype) { + case _types.TokenType._break: + case _types.TokenType._continue: + parseBreakContinueStatement(); + return; + case _types.TokenType._debugger: + parseDebuggerStatement(); + return; + case _types.TokenType._do: + parseDoStatement(); + return; + case _types.TokenType._for: + parseForStatement(); + return; + case _types.TokenType._function: + if (_tokenizer.lookaheadType.call(void 0, ) === _types.TokenType.dot) break; + if (!declaration) _util.unexpected.call(void 0, ); + parseFunctionStatement(); + return; + + case _types.TokenType._class: + if (!declaration) _util.unexpected.call(void 0, ); + parseClass(true); + return; + + case _types.TokenType._if: + parseIfStatement(); + return; + case _types.TokenType._return: + parseReturnStatement(); + return; + case _types.TokenType._switch: + parseSwitchStatement(); + return; + case _types.TokenType._throw: + parseThrowStatement(); + return; + case _types.TokenType._try: + parseTryStatement(); + return; + + case _types.TokenType._let: + case _types.TokenType._const: + if (!declaration) _util.unexpected.call(void 0, ); // NOTE: falls through to _var + + case _types.TokenType._var: + parseVarStatement(starttype !== _types.TokenType._var); + return; + + case _types.TokenType._while: + parseWhileStatement(); + return; + case _types.TokenType.braceL: + parseBlock(); + return; + case _types.TokenType.semi: + parseEmptyStatement(); + return; + case _types.TokenType._export: + case _types.TokenType._import: { + const nextType = _tokenizer.lookaheadType.call(void 0, ); + if (nextType === _types.TokenType.parenL || nextType === _types.TokenType.dot) { + break; + } + _tokenizer.next.call(void 0, ); + if (starttype === _types.TokenType._import) { + parseImport(); + } else { + parseExport(); + } + return; + } + case _types.TokenType.name: + if (_base.state.contextualKeyword === _keywords.ContextualKeyword._async) { + const functionStart = _base.state.start; + // peek ahead and see if next token is a function + const snapshot = _base.state.snapshot(); + _tokenizer.next.call(void 0, ); + if (_tokenizer.match.call(void 0, _types.TokenType._function) && !_util.canInsertSemicolon.call(void 0, )) { + _util.expect.call(void 0, _types.TokenType._function); + parseFunction(functionStart, true); + return; + } else { + _base.state.restoreFromSnapshot(snapshot); + } + } else if ( + _base.state.contextualKeyword === _keywords.ContextualKeyword._using && + !_util.hasFollowingLineBreak.call(void 0, ) && + // Statements like `using[0]` and `using in foo` aren't actual using + // declarations. + _tokenizer.lookaheadType.call(void 0, ) === _types.TokenType.name + ) { + parseVarStatement(true); + return; + } else if (startsAwaitUsing()) { + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._await); + parseVarStatement(true); + return; + } + default: + // Do nothing. + break; + } + + // If the statement does not start with a statement keyword or a + // brace, it's an ExpressionStatement or LabeledStatement. We + // simply start parsing an expression, and afterwards, if the + // next token is a colon and the expression was a simple + // Identifier node, we switch to interpreting it as a label. + const initialTokensLength = _base.state.tokens.length; + _expression.parseExpression.call(void 0, ); + let simpleName = null; + if (_base.state.tokens.length === initialTokensLength + 1) { + const token = _base.state.tokens[_base.state.tokens.length - 1]; + if (token.type === _types.TokenType.name) { + simpleName = token.contextualKeyword; + } + } + if (simpleName == null) { + _util.semicolon.call(void 0, ); + return; + } + if (_tokenizer.eat.call(void 0, _types.TokenType.colon)) { + parseLabeledStatement(); + } else { + // This was an identifier, so we might want to handle flow/typescript-specific cases. + parseIdentifierStatement(simpleName); + } +} + +/** + * Determine if we're positioned at an `await using` declaration. + * + * Note that this can happen either in place of a regular variable declaration + * or in a loop body, and in both places, there are similar-looking cases where + * we need to return false. + * + * Examples returning true: + * await using foo = bar(); + * for (await using a of b) {} + * + * Examples returning false: + * await using + * await using + 1 + * await using instanceof T + * for (await using;;) {} + * + * For now, we early return if we don't see `await`, then do a simple + * backtracking-based lookahead for the `using` and identifier tokens. In the + * future, this could be optimized with a character-based approach. + */ +function startsAwaitUsing() { + if (!_util.isContextual.call(void 0, _keywords.ContextualKeyword._await)) { + return false; + } + const snapshot = _base.state.snapshot(); + // await + _tokenizer.next.call(void 0, ); + if (!_util.isContextual.call(void 0, _keywords.ContextualKeyword._using) || _util.hasPrecedingLineBreak.call(void 0, )) { + _base.state.restoreFromSnapshot(snapshot); + return false; + } + // using + _tokenizer.next.call(void 0, ); + if (!_tokenizer.match.call(void 0, _types.TokenType.name) || _util.hasPrecedingLineBreak.call(void 0, )) { + _base.state.restoreFromSnapshot(snapshot); + return false; + } + _base.state.restoreFromSnapshot(snapshot); + return true; +} + + function parseDecorators() { + while (_tokenizer.match.call(void 0, _types.TokenType.at)) { + parseDecorator(); + } +} exports.parseDecorators = parseDecorators; + +function parseDecorator() { + _tokenizer.next.call(void 0, ); + if (_tokenizer.eat.call(void 0, _types.TokenType.parenL)) { + _expression.parseExpression.call(void 0, ); + _util.expect.call(void 0, _types.TokenType.parenR); + } else { + _expression.parseIdentifier.call(void 0, ); + while (_tokenizer.eat.call(void 0, _types.TokenType.dot)) { + _expression.parseIdentifier.call(void 0, ); + } + parseMaybeDecoratorArguments(); + } +} + +function parseMaybeDecoratorArguments() { + if (_base.isTypeScriptEnabled) { + _typescript.tsParseMaybeDecoratorArguments.call(void 0, ); + } else { + baseParseMaybeDecoratorArguments(); + } +} + + function baseParseMaybeDecoratorArguments() { + if (_tokenizer.eat.call(void 0, _types.TokenType.parenL)) { + _expression.parseCallExpressionArguments.call(void 0, ); + } +} exports.baseParseMaybeDecoratorArguments = baseParseMaybeDecoratorArguments; + +function parseBreakContinueStatement() { + _tokenizer.next.call(void 0, ); + if (!_util.isLineTerminator.call(void 0, )) { + _expression.parseIdentifier.call(void 0, ); + _util.semicolon.call(void 0, ); + } +} + +function parseDebuggerStatement() { + _tokenizer.next.call(void 0, ); + _util.semicolon.call(void 0, ); +} + +function parseDoStatement() { + _tokenizer.next.call(void 0, ); + parseStatement(false); + _util.expect.call(void 0, _types.TokenType._while); + _expression.parseParenExpression.call(void 0, ); + _tokenizer.eat.call(void 0, _types.TokenType.semi); +} + +function parseForStatement() { + _base.state.scopeDepth++; + const startTokenIndex = _base.state.tokens.length; + parseAmbiguousForStatement(); + const endTokenIndex = _base.state.tokens.length; + _base.state.scopes.push(new (0, _state.Scope)(startTokenIndex, endTokenIndex, false)); + _base.state.scopeDepth--; +} + +/** + * Determine if this token is a `using` declaration (explicit resource + * management) as part of a loop. + * https://github.com/tc39/proposal-explicit-resource-management + */ +function isUsingInLoop() { + if (!_util.isContextual.call(void 0, _keywords.ContextualKeyword._using)) { + return false; + } + // This must be `for (using of`, where `using` is the name of the loop + // variable. + if (_util.isLookaheadContextual.call(void 0, _keywords.ContextualKeyword._of)) { + return false; + } + return true; +} + +// Disambiguating between a `for` and a `for`/`in` or `for`/`of` +// loop is non-trivial. Basically, we have to parse the init `var` +// statement or expression, disallowing the `in` operator (see +// the second parameter to `parseExpression`), and then check +// whether the next token is `in` or `of`. When there is no init +// part (semicolon immediately after the opening parenthesis), it +// is a regular `for` loop. +function parseAmbiguousForStatement() { + _tokenizer.next.call(void 0, ); + + let forAwait = false; + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._await)) { + forAwait = true; + _tokenizer.next.call(void 0, ); + } + _util.expect.call(void 0, _types.TokenType.parenL); + + if (_tokenizer.match.call(void 0, _types.TokenType.semi)) { + if (forAwait) { + _util.unexpected.call(void 0, ); + } + parseFor(); + return; + } + + const isAwaitUsing = startsAwaitUsing(); + if (isAwaitUsing || _tokenizer.match.call(void 0, _types.TokenType._var) || _tokenizer.match.call(void 0, _types.TokenType._let) || _tokenizer.match.call(void 0, _types.TokenType._const) || isUsingInLoop()) { + if (isAwaitUsing) { + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._await); + } + _tokenizer.next.call(void 0, ); + parseVar(true, _base.state.type !== _types.TokenType._var); + if (_tokenizer.match.call(void 0, _types.TokenType._in) || _util.isContextual.call(void 0, _keywords.ContextualKeyword._of)) { + parseForIn(forAwait); + return; + } + parseFor(); + return; + } + + _expression.parseExpression.call(void 0, true); + if (_tokenizer.match.call(void 0, _types.TokenType._in) || _util.isContextual.call(void 0, _keywords.ContextualKeyword._of)) { + parseForIn(forAwait); + return; + } + if (forAwait) { + _util.unexpected.call(void 0, ); + } + parseFor(); +} + +function parseFunctionStatement() { + const functionStart = _base.state.start; + _tokenizer.next.call(void 0, ); + parseFunction(functionStart, true); +} + +function parseIfStatement() { + _tokenizer.next.call(void 0, ); + _expression.parseParenExpression.call(void 0, ); + parseStatement(false); + if (_tokenizer.eat.call(void 0, _types.TokenType._else)) { + parseStatement(false); + } +} + +function parseReturnStatement() { + _tokenizer.next.call(void 0, ); + + // In `return` (and `break`/`continue`), the keywords with + // optional arguments, we eagerly look for a semicolon or the + // possibility to insert one. + + if (!_util.isLineTerminator.call(void 0, )) { + _expression.parseExpression.call(void 0, ); + _util.semicolon.call(void 0, ); + } +} + +function parseSwitchStatement() { + _tokenizer.next.call(void 0, ); + _expression.parseParenExpression.call(void 0, ); + _base.state.scopeDepth++; + const startTokenIndex = _base.state.tokens.length; + _util.expect.call(void 0, _types.TokenType.braceL); + + // Don't bother validation; just go through any sequence of cases, defaults, and statements. + while (!_tokenizer.match.call(void 0, _types.TokenType.braceR) && !_base.state.error) { + if (_tokenizer.match.call(void 0, _types.TokenType._case) || _tokenizer.match.call(void 0, _types.TokenType._default)) { + const isCase = _tokenizer.match.call(void 0, _types.TokenType._case); + _tokenizer.next.call(void 0, ); + if (isCase) { + _expression.parseExpression.call(void 0, ); + } + _util.expect.call(void 0, _types.TokenType.colon); + } else { + parseStatement(true); + } + } + _tokenizer.next.call(void 0, ); // Closing brace + const endTokenIndex = _base.state.tokens.length; + _base.state.scopes.push(new (0, _state.Scope)(startTokenIndex, endTokenIndex, false)); + _base.state.scopeDepth--; +} + +function parseThrowStatement() { + _tokenizer.next.call(void 0, ); + _expression.parseExpression.call(void 0, ); + _util.semicolon.call(void 0, ); +} + +function parseCatchClauseParam() { + _lval.parseBindingAtom.call(void 0, true /* isBlockScope */); + + if (_base.isTypeScriptEnabled) { + _typescript.tsTryParseTypeAnnotation.call(void 0, ); + } +} + +function parseTryStatement() { + _tokenizer.next.call(void 0, ); + + parseBlock(); + + if (_tokenizer.match.call(void 0, _types.TokenType._catch)) { + _tokenizer.next.call(void 0, ); + let catchBindingStartTokenIndex = null; + if (_tokenizer.match.call(void 0, _types.TokenType.parenL)) { + _base.state.scopeDepth++; + catchBindingStartTokenIndex = _base.state.tokens.length; + _util.expect.call(void 0, _types.TokenType.parenL); + parseCatchClauseParam(); + _util.expect.call(void 0, _types.TokenType.parenR); + } + parseBlock(); + if (catchBindingStartTokenIndex != null) { + // We need a special scope for the catch binding which includes the binding itself and the + // catch block. + const endTokenIndex = _base.state.tokens.length; + _base.state.scopes.push(new (0, _state.Scope)(catchBindingStartTokenIndex, endTokenIndex, false)); + _base.state.scopeDepth--; + } + } + if (_tokenizer.eat.call(void 0, _types.TokenType._finally)) { + parseBlock(); + } +} + + function parseVarStatement(isBlockScope) { + _tokenizer.next.call(void 0, ); + parseVar(false, isBlockScope); + _util.semicolon.call(void 0, ); +} exports.parseVarStatement = parseVarStatement; + +function parseWhileStatement() { + _tokenizer.next.call(void 0, ); + _expression.parseParenExpression.call(void 0, ); + parseStatement(false); +} + +function parseEmptyStatement() { + _tokenizer.next.call(void 0, ); +} + +function parseLabeledStatement() { + parseStatement(true); +} + +/** + * Parse a statement starting with an identifier of the given name. Subclasses match on the name + * to handle statements like "declare". + */ +function parseIdentifierStatement(contextualKeyword) { + if (_base.isTypeScriptEnabled) { + _typescript.tsParseIdentifierStatement.call(void 0, contextualKeyword); + } else if (_base.isFlowEnabled) { + _flow.flowParseIdentifierStatement.call(void 0, contextualKeyword); + } else { + _util.semicolon.call(void 0, ); + } +} + +// Parse a semicolon-enclosed block of statements. + function parseBlock(isFunctionScope = false, contextId = 0) { + const startTokenIndex = _base.state.tokens.length; + _base.state.scopeDepth++; + _util.expect.call(void 0, _types.TokenType.braceL); + if (contextId) { + _base.state.tokens[_base.state.tokens.length - 1].contextId = contextId; + } + parseBlockBody(_types.TokenType.braceR); + if (contextId) { + _base.state.tokens[_base.state.tokens.length - 1].contextId = contextId; + } + const endTokenIndex = _base.state.tokens.length; + _base.state.scopes.push(new (0, _state.Scope)(startTokenIndex, endTokenIndex, isFunctionScope)); + _base.state.scopeDepth--; +} exports.parseBlock = parseBlock; + + function parseBlockBody(end) { + while (!_tokenizer.eat.call(void 0, end) && !_base.state.error) { + parseStatement(true); + } +} exports.parseBlockBody = parseBlockBody; + +// Parse a regular `for` loop. The disambiguation code in +// `parseStatement` will already have parsed the init statement or +// expression. + +function parseFor() { + _util.expect.call(void 0, _types.TokenType.semi); + if (!_tokenizer.match.call(void 0, _types.TokenType.semi)) { + _expression.parseExpression.call(void 0, ); + } + _util.expect.call(void 0, _types.TokenType.semi); + if (!_tokenizer.match.call(void 0, _types.TokenType.parenR)) { + _expression.parseExpression.call(void 0, ); + } + _util.expect.call(void 0, _types.TokenType.parenR); + parseStatement(false); +} + +// Parse a `for`/`in` and `for`/`of` loop, which are almost +// same from parser's perspective. + +function parseForIn(forAwait) { + if (forAwait) { + _util.eatContextual.call(void 0, _keywords.ContextualKeyword._of); + } else { + _tokenizer.next.call(void 0, ); + } + _expression.parseExpression.call(void 0, ); + _util.expect.call(void 0, _types.TokenType.parenR); + parseStatement(false); +} + +// Parse a list of variable declarations. + +function parseVar(isFor, isBlockScope) { + while (true) { + parseVarHead(isBlockScope); + if (_tokenizer.eat.call(void 0, _types.TokenType.eq)) { + const eqIndex = _base.state.tokens.length - 1; + _expression.parseMaybeAssign.call(void 0, isFor); + _base.state.tokens[eqIndex].rhsEndIndex = _base.state.tokens.length; + } + if (!_tokenizer.eat.call(void 0, _types.TokenType.comma)) { + break; + } + } +} + +function parseVarHead(isBlockScope) { + _lval.parseBindingAtom.call(void 0, isBlockScope); + if (_base.isTypeScriptEnabled) { + _typescript.tsAfterParseVarHead.call(void 0, ); + } else if (_base.isFlowEnabled) { + _flow.flowAfterParseVarHead.call(void 0, ); + } +} + +// Parse a function declaration or literal (depending on the +// `isStatement` parameter). + + function parseFunction( + functionStart, + isStatement, + optionalId = false, +) { + if (_tokenizer.match.call(void 0, _types.TokenType.star)) { + _tokenizer.next.call(void 0, ); + } + + if (isStatement && !optionalId && !_tokenizer.match.call(void 0, _types.TokenType.name) && !_tokenizer.match.call(void 0, _types.TokenType._yield)) { + _util.unexpected.call(void 0, ); + } + + let nameScopeStartTokenIndex = null; + + if (_tokenizer.match.call(void 0, _types.TokenType.name)) { + // Expression-style functions should limit their name's scope to the function body, so we make + // a new function scope to enforce that. + if (!isStatement) { + nameScopeStartTokenIndex = _base.state.tokens.length; + _base.state.scopeDepth++; + } + _lval.parseBindingIdentifier.call(void 0, false); + } + + const startTokenIndex = _base.state.tokens.length; + _base.state.scopeDepth++; + parseFunctionParams(); + _expression.parseFunctionBodyAndFinish.call(void 0, functionStart); + const endTokenIndex = _base.state.tokens.length; + // In addition to the block scope of the function body, we need a separate function-style scope + // that includes the params. + _base.state.scopes.push(new (0, _state.Scope)(startTokenIndex, endTokenIndex, true)); + _base.state.scopeDepth--; + if (nameScopeStartTokenIndex !== null) { + _base.state.scopes.push(new (0, _state.Scope)(nameScopeStartTokenIndex, endTokenIndex, true)); + _base.state.scopeDepth--; + } +} exports.parseFunction = parseFunction; + + function parseFunctionParams( + allowModifiers = false, + funcContextId = 0, +) { + if (_base.isTypeScriptEnabled) { + _typescript.tsStartParseFunctionParams.call(void 0, ); + } else if (_base.isFlowEnabled) { + _flow.flowStartParseFunctionParams.call(void 0, ); + } + + _util.expect.call(void 0, _types.TokenType.parenL); + if (funcContextId) { + _base.state.tokens[_base.state.tokens.length - 1].contextId = funcContextId; + } + _lval.parseBindingList.call(void 0, + _types.TokenType.parenR, + false /* isBlockScope */, + false /* allowEmpty */, + allowModifiers, + funcContextId, + ); + if (funcContextId) { + _base.state.tokens[_base.state.tokens.length - 1].contextId = funcContextId; + } +} exports.parseFunctionParams = parseFunctionParams; + +// Parse a class declaration or literal (depending on the +// `isStatement` parameter). + + function parseClass(isStatement, optionalId = false) { + // Put a context ID on the class keyword, the open-brace, and the close-brace, so that later + // code can easily navigate to meaningful points on the class. + const contextId = _base.getNextContextId.call(void 0, ); + + _tokenizer.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].contextId = contextId; + _base.state.tokens[_base.state.tokens.length - 1].isExpression = !isStatement; + // Like with functions, we declare a special "name scope" from the start of the name to the end + // of the class, but only with expression-style classes, to represent the fact that the name is + // available to the body of the class but not an outer declaration. + let nameScopeStartTokenIndex = null; + if (!isStatement) { + nameScopeStartTokenIndex = _base.state.tokens.length; + _base.state.scopeDepth++; + } + parseClassId(isStatement, optionalId); + parseClassSuper(); + const openBraceIndex = _base.state.tokens.length; + parseClassBody(contextId); + if (_base.state.error) { + return; + } + _base.state.tokens[openBraceIndex].contextId = contextId; + _base.state.tokens[_base.state.tokens.length - 1].contextId = contextId; + if (nameScopeStartTokenIndex !== null) { + const endTokenIndex = _base.state.tokens.length; + _base.state.scopes.push(new (0, _state.Scope)(nameScopeStartTokenIndex, endTokenIndex, false)); + _base.state.scopeDepth--; + } +} exports.parseClass = parseClass; + +function isClassProperty() { + return _tokenizer.match.call(void 0, _types.TokenType.eq) || _tokenizer.match.call(void 0, _types.TokenType.semi) || _tokenizer.match.call(void 0, _types.TokenType.braceR) || _tokenizer.match.call(void 0, _types.TokenType.bang) || _tokenizer.match.call(void 0, _types.TokenType.colon); +} + +function isClassMethod() { + return _tokenizer.match.call(void 0, _types.TokenType.parenL) || _tokenizer.match.call(void 0, _types.TokenType.lessThan); +} + +function parseClassBody(classContextId) { + _util.expect.call(void 0, _types.TokenType.braceL); + + while (!_tokenizer.eat.call(void 0, _types.TokenType.braceR) && !_base.state.error) { + if (_tokenizer.eat.call(void 0, _types.TokenType.semi)) { + continue; + } + + if (_tokenizer.match.call(void 0, _types.TokenType.at)) { + parseDecorator(); + continue; + } + const memberStart = _base.state.start; + parseClassMember(memberStart, classContextId); + } +} + +function parseClassMember(memberStart, classContextId) { + if (_base.isTypeScriptEnabled) { + _typescript.tsParseModifiers.call(void 0, [ + _keywords.ContextualKeyword._declare, + _keywords.ContextualKeyword._public, + _keywords.ContextualKeyword._protected, + _keywords.ContextualKeyword._private, + _keywords.ContextualKeyword._override, + ]); + } + let isStatic = false; + if (_tokenizer.match.call(void 0, _types.TokenType.name) && _base.state.contextualKeyword === _keywords.ContextualKeyword._static) { + _expression.parseIdentifier.call(void 0, ); // eats 'static' + if (isClassMethod()) { + parseClassMethod(memberStart, /* isConstructor */ false); + return; + } else if (isClassProperty()) { + parseClassProperty(); + return; + } + // otherwise something static + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._static; + isStatic = true; + + if (_tokenizer.match.call(void 0, _types.TokenType.braceL)) { + // This is a static block. Mark the word "static" with the class context ID for class element + // detection and parse as a regular block. + _base.state.tokens[_base.state.tokens.length - 1].contextId = classContextId; + parseBlock(); + return; + } + } + + parseClassMemberWithIsStatic(memberStart, isStatic, classContextId); +} + +function parseClassMemberWithIsStatic( + memberStart, + isStatic, + classContextId, +) { + if (_base.isTypeScriptEnabled) { + if (_typescript.tsTryParseClassMemberWithIsStatic.call(void 0, isStatic)) { + return; + } + } + if (_tokenizer.eat.call(void 0, _types.TokenType.star)) { + // a generator + parseClassPropertyName(classContextId); + parseClassMethod(memberStart, /* isConstructor */ false); + return; + } + + // Get the identifier name so we can tell if it's actually a keyword like "async", "get", or + // "set". + parseClassPropertyName(classContextId); + let isConstructor = false; + const token = _base.state.tokens[_base.state.tokens.length - 1]; + // We allow "constructor" as either an identifier or a string. + if (token.contextualKeyword === _keywords.ContextualKeyword._constructor) { + isConstructor = true; + } + parsePostMemberNameModifiers(); + + if (isClassMethod()) { + parseClassMethod(memberStart, isConstructor); + } else if (isClassProperty()) { + parseClassProperty(); + } else if (token.contextualKeyword === _keywords.ContextualKeyword._async && !_util.isLineTerminator.call(void 0, )) { + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._async; + // an async method + const isGenerator = _tokenizer.match.call(void 0, _types.TokenType.star); + if (isGenerator) { + _tokenizer.next.call(void 0, ); + } + + // The so-called parsed name would have been "async": get the real name. + parseClassPropertyName(classContextId); + parsePostMemberNameModifiers(); + parseClassMethod(memberStart, false /* isConstructor */); + } else if ( + (token.contextualKeyword === _keywords.ContextualKeyword._get || + token.contextualKeyword === _keywords.ContextualKeyword._set) && + !(_util.isLineTerminator.call(void 0, ) && _tokenizer.match.call(void 0, _types.TokenType.star)) + ) { + if (token.contextualKeyword === _keywords.ContextualKeyword._get) { + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._get; + } else { + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._set; + } + // `get\n*` is an uninitialized property named 'get' followed by a generator. + // a getter or setter + // The so-called parsed name would have been "get/set": get the real name. + parseClassPropertyName(classContextId); + parseClassMethod(memberStart, /* isConstructor */ false); + } else if (token.contextualKeyword === _keywords.ContextualKeyword._accessor && !_util.isLineTerminator.call(void 0, )) { + parseClassPropertyName(classContextId); + parseClassProperty(); + } else if (_util.isLineTerminator.call(void 0, )) { + // an uninitialized class property (due to ASI, since we don't otherwise recognize the next token) + parseClassProperty(); + } else { + _util.unexpected.call(void 0, ); + } +} + +function parseClassMethod(functionStart, isConstructor) { + if (_base.isTypeScriptEnabled) { + _typescript.tsTryParseTypeParameters.call(void 0, ); + } else if (_base.isFlowEnabled) { + if (_tokenizer.match.call(void 0, _types.TokenType.lessThan)) { + _flow.flowParseTypeParameterDeclaration.call(void 0, ); + } + } + _expression.parseMethod.call(void 0, functionStart, isConstructor); +} + +// Return the name of the class property, if it is a simple identifier. + function parseClassPropertyName(classContextId) { + _expression.parsePropertyName.call(void 0, classContextId); +} exports.parseClassPropertyName = parseClassPropertyName; + + function parsePostMemberNameModifiers() { + if (_base.isTypeScriptEnabled) { + const oldIsType = _tokenizer.pushTypeContext.call(void 0, 0); + _tokenizer.eat.call(void 0, _types.TokenType.question); + _tokenizer.popTypeContext.call(void 0, oldIsType); + } +} exports.parsePostMemberNameModifiers = parsePostMemberNameModifiers; + + function parseClassProperty() { + if (_base.isTypeScriptEnabled) { + _tokenizer.eatTypeToken.call(void 0, _types.TokenType.bang); + _typescript.tsTryParseTypeAnnotation.call(void 0, ); + } else if (_base.isFlowEnabled) { + if (_tokenizer.match.call(void 0, _types.TokenType.colon)) { + _flow.flowParseTypeAnnotation.call(void 0, ); + } + } + + if (_tokenizer.match.call(void 0, _types.TokenType.eq)) { + const equalsTokenIndex = _base.state.tokens.length; + _tokenizer.next.call(void 0, ); + _expression.parseMaybeAssign.call(void 0, ); + _base.state.tokens[equalsTokenIndex].rhsEndIndex = _base.state.tokens.length; + } + _util.semicolon.call(void 0, ); +} exports.parseClassProperty = parseClassProperty; + +function parseClassId(isStatement, optionalId = false) { + if ( + _base.isTypeScriptEnabled && + (!isStatement || optionalId) && + _util.isContextual.call(void 0, _keywords.ContextualKeyword._implements) + ) { + return; + } + + if (_tokenizer.match.call(void 0, _types.TokenType.name)) { + _lval.parseBindingIdentifier.call(void 0, true); + } + + if (_base.isTypeScriptEnabled) { + _typescript.tsTryParseTypeParameters.call(void 0, ); + } else if (_base.isFlowEnabled) { + if (_tokenizer.match.call(void 0, _types.TokenType.lessThan)) { + _flow.flowParseTypeParameterDeclaration.call(void 0, ); + } + } +} + +// Returns true if there was a superclass. +function parseClassSuper() { + let hasSuper = false; + if (_tokenizer.eat.call(void 0, _types.TokenType._extends)) { + _expression.parseExprSubscripts.call(void 0, ); + hasSuper = true; + } else { + hasSuper = false; + } + if (_base.isTypeScriptEnabled) { + _typescript.tsAfterParseClassSuper.call(void 0, hasSuper); + } else if (_base.isFlowEnabled) { + _flow.flowAfterParseClassSuper.call(void 0, hasSuper); + } +} + +// Parses module export declaration. + + function parseExport() { + const exportIndex = _base.state.tokens.length - 1; + if (_base.isTypeScriptEnabled) { + if (_typescript.tsTryParseExport.call(void 0, )) { + return; + } + } + // export * from '...' + if (shouldParseExportStar()) { + parseExportStar(); + } else if (isExportDefaultSpecifier()) { + // export default from + _expression.parseIdentifier.call(void 0, ); + if (_tokenizer.match.call(void 0, _types.TokenType.comma) && _tokenizer.lookaheadType.call(void 0, ) === _types.TokenType.star) { + _util.expect.call(void 0, _types.TokenType.comma); + _util.expect.call(void 0, _types.TokenType.star); + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._as); + _expression.parseIdentifier.call(void 0, ); + } else { + parseExportSpecifiersMaybe(); + } + parseExportFrom(); + } else if (_tokenizer.eat.call(void 0, _types.TokenType._default)) { + // export default ... + parseExportDefaultExpression(); + } else if (shouldParseExportDeclaration()) { + parseExportDeclaration(); + } else { + // export { x, y as z } [from '...'] + parseExportSpecifiers(); + parseExportFrom(); + } + _base.state.tokens[exportIndex].rhsEndIndex = _base.state.tokens.length; +} exports.parseExport = parseExport; + +function parseExportDefaultExpression() { + if (_base.isTypeScriptEnabled) { + if (_typescript.tsTryParseExportDefaultExpression.call(void 0, )) { + return; + } + } + if (_base.isFlowEnabled) { + if (_flow.flowTryParseExportDefaultExpression.call(void 0, )) { + return; + } + } + const functionStart = _base.state.start; + if (_tokenizer.eat.call(void 0, _types.TokenType._function)) { + parseFunction(functionStart, true, true); + } else if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._async) && _tokenizer.lookaheadType.call(void 0, ) === _types.TokenType._function) { + // async function declaration + _util.eatContextual.call(void 0, _keywords.ContextualKeyword._async); + _tokenizer.eat.call(void 0, _types.TokenType._function); + parseFunction(functionStart, true, true); + } else if (_tokenizer.match.call(void 0, _types.TokenType._class)) { + parseClass(true, true); + } else if (_tokenizer.match.call(void 0, _types.TokenType.at)) { + parseDecorators(); + parseClass(true, true); + } else { + _expression.parseMaybeAssign.call(void 0, ); + _util.semicolon.call(void 0, ); + } +} + +function parseExportDeclaration() { + if (_base.isTypeScriptEnabled) { + _typescript.tsParseExportDeclaration.call(void 0, ); + } else if (_base.isFlowEnabled) { + _flow.flowParseExportDeclaration.call(void 0, ); + } else { + parseStatement(true); + } +} + +function isExportDefaultSpecifier() { + if (_base.isTypeScriptEnabled && _typescript.tsIsDeclarationStart.call(void 0, )) { + return false; + } else if (_base.isFlowEnabled && _flow.flowShouldDisallowExportDefaultSpecifier.call(void 0, )) { + return false; + } + if (_tokenizer.match.call(void 0, _types.TokenType.name)) { + return _base.state.contextualKeyword !== _keywords.ContextualKeyword._async; + } + + if (!_tokenizer.match.call(void 0, _types.TokenType._default)) { + return false; + } + + const _next = _tokenizer.nextTokenStart.call(void 0, ); + const lookahead = _tokenizer.lookaheadTypeAndKeyword.call(void 0, ); + const hasFrom = + lookahead.type === _types.TokenType.name && lookahead.contextualKeyword === _keywords.ContextualKeyword._from; + if (lookahead.type === _types.TokenType.comma) { + return true; + } + // lookahead again when `export default from` is seen + if (hasFrom) { + const nextAfterFrom = _base.input.charCodeAt(_tokenizer.nextTokenStartSince.call(void 0, _next + 4)); + return nextAfterFrom === _charcodes.charCodes.quotationMark || nextAfterFrom === _charcodes.charCodes.apostrophe; + } + return false; +} + +function parseExportSpecifiersMaybe() { + if (_tokenizer.eat.call(void 0, _types.TokenType.comma)) { + parseExportSpecifiers(); + } +} + + function parseExportFrom() { + if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._from)) { + _expression.parseExprAtom.call(void 0, ); + maybeParseImportAttributes(); + } + _util.semicolon.call(void 0, ); +} exports.parseExportFrom = parseExportFrom; + +function shouldParseExportStar() { + if (_base.isFlowEnabled) { + return _flow.flowShouldParseExportStar.call(void 0, ); + } else { + return _tokenizer.match.call(void 0, _types.TokenType.star); + } +} + +function parseExportStar() { + if (_base.isFlowEnabled) { + _flow.flowParseExportStar.call(void 0, ); + } else { + baseParseExportStar(); + } +} + + function baseParseExportStar() { + _util.expect.call(void 0, _types.TokenType.star); + + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._as)) { + parseExportNamespace(); + } else { + parseExportFrom(); + } +} exports.baseParseExportStar = baseParseExportStar; + +function parseExportNamespace() { + _tokenizer.next.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].type = _types.TokenType._as; + _expression.parseIdentifier.call(void 0, ); + parseExportSpecifiersMaybe(); + parseExportFrom(); +} + +function shouldParseExportDeclaration() { + return ( + (_base.isTypeScriptEnabled && _typescript.tsIsDeclarationStart.call(void 0, )) || + (_base.isFlowEnabled && _flow.flowShouldParseExportDeclaration.call(void 0, )) || + _base.state.type === _types.TokenType._var || + _base.state.type === _types.TokenType._const || + _base.state.type === _types.TokenType._let || + _base.state.type === _types.TokenType._function || + _base.state.type === _types.TokenType._class || + _util.isContextual.call(void 0, _keywords.ContextualKeyword._async) || + _tokenizer.match.call(void 0, _types.TokenType.at) + ); +} + +// Parses a comma-separated list of module exports. + function parseExportSpecifiers() { + let first = true; + + // export { x, y as z } [from '...'] + _util.expect.call(void 0, _types.TokenType.braceL); + + while (!_tokenizer.eat.call(void 0, _types.TokenType.braceR) && !_base.state.error) { + if (first) { + first = false; + } else { + _util.expect.call(void 0, _types.TokenType.comma); + if (_tokenizer.eat.call(void 0, _types.TokenType.braceR)) { + break; + } + } + parseExportSpecifier(); + } +} exports.parseExportSpecifiers = parseExportSpecifiers; + +function parseExportSpecifier() { + if (_base.isTypeScriptEnabled) { + _typescript.tsParseExportSpecifier.call(void 0, ); + return; + } + _expression.parseIdentifier.call(void 0, ); + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _tokenizer.IdentifierRole.ExportAccess; + if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._as)) { + _expression.parseIdentifier.call(void 0, ); + } +} + +/** + * Starting at the `module` token in an import, determine if it was truly an + * import reflection token or just looks like one. + * + * Returns true for: + * import module foo from "foo"; + * import module from from "foo"; + * + * Returns false for: + * import module from "foo"; + * import module, {bar} from "foo"; + */ +function isImportReflection() { + const snapshot = _base.state.snapshot(); + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._module); + if (_util.eatContextual.call(void 0, _keywords.ContextualKeyword._from)) { + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._from)) { + _base.state.restoreFromSnapshot(snapshot); + return true; + } else { + _base.state.restoreFromSnapshot(snapshot); + return false; + } + } else if (_tokenizer.match.call(void 0, _types.TokenType.comma)) { + _base.state.restoreFromSnapshot(snapshot); + return false; + } else { + _base.state.restoreFromSnapshot(snapshot); + return true; + } +} + +/** + * Eat the "module" token from the import reflection proposal. + * https://github.com/tc39/proposal-import-reflection + */ +function parseMaybeImportReflection() { + // isImportReflection does snapshot/restore, so only run it if we see the word + // "module". + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._module) && isImportReflection()) { + _tokenizer.next.call(void 0, ); + } +} + +// Parses import declaration. + + function parseImport() { + if (_base.isTypeScriptEnabled && _tokenizer.match.call(void 0, _types.TokenType.name) && _tokenizer.lookaheadType.call(void 0, ) === _types.TokenType.eq) { + _typescript.tsParseImportEqualsDeclaration.call(void 0, ); + return; + } + if (_base.isTypeScriptEnabled && _util.isContextual.call(void 0, _keywords.ContextualKeyword._type)) { + const lookahead = _tokenizer.lookaheadTypeAndKeyword.call(void 0, ); + if (lookahead.type === _types.TokenType.name && lookahead.contextualKeyword !== _keywords.ContextualKeyword._from) { + // One of these `import type` cases: + // import type T = require('T'); + // import type A from 'A'; + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._type); + if (_tokenizer.lookaheadType.call(void 0, ) === _types.TokenType.eq) { + _typescript.tsParseImportEqualsDeclaration.call(void 0, ); + return; + } + // If this is an `import type...from` statement, then we already ate the + // type token, so proceed to the regular import parser. + } else if (lookahead.type === _types.TokenType.star || lookahead.type === _types.TokenType.braceL) { + // One of these `import type` cases, in which case we can eat the type token + // and proceed as normal: + // import type * as A from 'A'; + // import type {a} from 'A'; + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._type); + } + // Otherwise, we are importing the name "type". + } + + // import '...' + if (_tokenizer.match.call(void 0, _types.TokenType.string)) { + _expression.parseExprAtom.call(void 0, ); + } else { + parseMaybeImportReflection(); + parseImportSpecifiers(); + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._from); + _expression.parseExprAtom.call(void 0, ); + } + maybeParseImportAttributes(); + _util.semicolon.call(void 0, ); +} exports.parseImport = parseImport; + +// eslint-disable-next-line no-unused-vars +function shouldParseDefaultImport() { + return _tokenizer.match.call(void 0, _types.TokenType.name); +} + +function parseImportSpecifierLocal() { + _lval.parseImportedIdentifier.call(void 0, ); +} + +// Parses a comma-separated list of module imports. +function parseImportSpecifiers() { + if (_base.isFlowEnabled) { + _flow.flowStartParseImportSpecifiers.call(void 0, ); + } + + let first = true; + if (shouldParseDefaultImport()) { + // import defaultObj, { x, y as z } from '...' + parseImportSpecifierLocal(); + + if (!_tokenizer.eat.call(void 0, _types.TokenType.comma)) return; + } + + if (_tokenizer.match.call(void 0, _types.TokenType.star)) { + _tokenizer.next.call(void 0, ); + _util.expectContextual.call(void 0, _keywords.ContextualKeyword._as); + + parseImportSpecifierLocal(); + + return; + } + + _util.expect.call(void 0, _types.TokenType.braceL); + while (!_tokenizer.eat.call(void 0, _types.TokenType.braceR) && !_base.state.error) { + if (first) { + first = false; + } else { + // Detect an attempt to deep destructure + if (_tokenizer.eat.call(void 0, _types.TokenType.colon)) { + _util.unexpected.call(void 0, + "ES2015 named imports do not destructure. Use another statement for destructuring after the import.", + ); + } + + _util.expect.call(void 0, _types.TokenType.comma); + if (_tokenizer.eat.call(void 0, _types.TokenType.braceR)) { + break; + } + } + + parseImportSpecifier(); + } +} + +function parseImportSpecifier() { + if (_base.isTypeScriptEnabled) { + _typescript.tsParseImportSpecifier.call(void 0, ); + return; + } + if (_base.isFlowEnabled) { + _flow.flowParseImportSpecifier.call(void 0, ); + return; + } + _lval.parseImportedIdentifier.call(void 0, ); + if (_util.isContextual.call(void 0, _keywords.ContextualKeyword._as)) { + _base.state.tokens[_base.state.tokens.length - 1].identifierRole = _tokenizer.IdentifierRole.ImportAccess; + _tokenizer.next.call(void 0, ); + _lval.parseImportedIdentifier.call(void 0, ); + } +} + +/** + * Parse import attributes like `with {type: "json"}`, or the legacy form + * `assert {type: "json"}`. + * + * Import attributes technically have their own syntax, but are always parseable + * as a plain JS object, so just do that for simplicity. + */ +function maybeParseImportAttributes() { + if (_tokenizer.match.call(void 0, _types.TokenType._with) || (_util.isContextual.call(void 0, _keywords.ContextualKeyword._assert) && !_util.hasPrecedingLineBreak.call(void 0, ))) { + _tokenizer.next.call(void 0, ); + _expression.parseObj.call(void 0, false, false); + } +} diff --git a/node_modules/sucrase/dist/parser/traverser/util.js b/node_modules/sucrase/dist/parser/traverser/util.js new file mode 100644 index 00000000..8ade800b --- /dev/null +++ b/node_modules/sucrase/dist/parser/traverser/util.js @@ -0,0 +1,104 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _index = require('../tokenizer/index'); + +var _types = require('../tokenizer/types'); +var _charcodes = require('../util/charcodes'); +var _base = require('./base'); + +// ## Parser utilities + +// Tests whether parsed token is a contextual keyword. + function isContextual(contextualKeyword) { + return _base.state.contextualKeyword === contextualKeyword; +} exports.isContextual = isContextual; + + function isLookaheadContextual(contextualKeyword) { + const l = _index.lookaheadTypeAndKeyword.call(void 0, ); + return l.type === _types.TokenType.name && l.contextualKeyword === contextualKeyword; +} exports.isLookaheadContextual = isLookaheadContextual; + +// Consumes contextual keyword if possible. + function eatContextual(contextualKeyword) { + return _base.state.contextualKeyword === contextualKeyword && _index.eat.call(void 0, _types.TokenType.name); +} exports.eatContextual = eatContextual; + +// Asserts that following token is given contextual keyword. + function expectContextual(contextualKeyword) { + if (!eatContextual(contextualKeyword)) { + unexpected(); + } +} exports.expectContextual = expectContextual; + +// Test whether a semicolon can be inserted at the current position. + function canInsertSemicolon() { + return _index.match.call(void 0, _types.TokenType.eof) || _index.match.call(void 0, _types.TokenType.braceR) || hasPrecedingLineBreak(); +} exports.canInsertSemicolon = canInsertSemicolon; + + function hasPrecedingLineBreak() { + const prevToken = _base.state.tokens[_base.state.tokens.length - 1]; + const lastTokEnd = prevToken ? prevToken.end : 0; + for (let i = lastTokEnd; i < _base.state.start; i++) { + const code = _base.input.charCodeAt(i); + if ( + code === _charcodes.charCodes.lineFeed || + code === _charcodes.charCodes.carriageReturn || + code === 0x2028 || + code === 0x2029 + ) { + return true; + } + } + return false; +} exports.hasPrecedingLineBreak = hasPrecedingLineBreak; + + function hasFollowingLineBreak() { + const nextStart = _index.nextTokenStart.call(void 0, ); + for (let i = _base.state.end; i < nextStart; i++) { + const code = _base.input.charCodeAt(i); + if ( + code === _charcodes.charCodes.lineFeed || + code === _charcodes.charCodes.carriageReturn || + code === 0x2028 || + code === 0x2029 + ) { + return true; + } + } + return false; +} exports.hasFollowingLineBreak = hasFollowingLineBreak; + + function isLineTerminator() { + return _index.eat.call(void 0, _types.TokenType.semi) || canInsertSemicolon(); +} exports.isLineTerminator = isLineTerminator; + +// Consume a semicolon, or, failing that, see if we are allowed to +// pretend that there is a semicolon at this position. + function semicolon() { + if (!isLineTerminator()) { + unexpected('Unexpected token, expected ";"'); + } +} exports.semicolon = semicolon; + +// Expect a token of a given type. If found, consume it, otherwise, +// raise an unexpected token error at given pos. + function expect(type) { + const matched = _index.eat.call(void 0, type); + if (!matched) { + unexpected(`Unexpected token, expected "${_types.formatTokenType.call(void 0, type)}"`); + } +} exports.expect = expect; + +/** + * Transition the parser to an error state. All code needs to be written to naturally unwind in this + * state, which allows us to backtrack without exceptions and without error plumbing everywhere. + */ + function unexpected(message = "Unexpected token", pos = _base.state.start) { + if (_base.state.error) { + return; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const err = new SyntaxError(message); + err.pos = pos; + _base.state.error = err; + _base.state.pos = _base.input.length; + _index.finishToken.call(void 0, _types.TokenType.eof); +} exports.unexpected = unexpected; diff --git a/node_modules/sucrase/dist/parser/util/charcodes.js b/node_modules/sucrase/dist/parser/util/charcodes.js new file mode 100644 index 00000000..52bebc4e --- /dev/null +++ b/node_modules/sucrase/dist/parser/util/charcodes.js @@ -0,0 +1,115 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var charCodes; (function (charCodes) { + const backSpace = 8; charCodes[charCodes["backSpace"] = backSpace] = "backSpace"; + const lineFeed = 10; charCodes[charCodes["lineFeed"] = lineFeed] = "lineFeed"; // '\n' + const tab = 9; charCodes[charCodes["tab"] = tab] = "tab"; // '\t' + const carriageReturn = 13; charCodes[charCodes["carriageReturn"] = carriageReturn] = "carriageReturn"; // '\r' + const shiftOut = 14; charCodes[charCodes["shiftOut"] = shiftOut] = "shiftOut"; + const space = 32; charCodes[charCodes["space"] = space] = "space"; + const exclamationMark = 33; charCodes[charCodes["exclamationMark"] = exclamationMark] = "exclamationMark"; // '!' + const quotationMark = 34; charCodes[charCodes["quotationMark"] = quotationMark] = "quotationMark"; // '"' + const numberSign = 35; charCodes[charCodes["numberSign"] = numberSign] = "numberSign"; // '#' + const dollarSign = 36; charCodes[charCodes["dollarSign"] = dollarSign] = "dollarSign"; // '$' + const percentSign = 37; charCodes[charCodes["percentSign"] = percentSign] = "percentSign"; // '%' + const ampersand = 38; charCodes[charCodes["ampersand"] = ampersand] = "ampersand"; // '&' + const apostrophe = 39; charCodes[charCodes["apostrophe"] = apostrophe] = "apostrophe"; // ''' + const leftParenthesis = 40; charCodes[charCodes["leftParenthesis"] = leftParenthesis] = "leftParenthesis"; // '(' + const rightParenthesis = 41; charCodes[charCodes["rightParenthesis"] = rightParenthesis] = "rightParenthesis"; // ')' + const asterisk = 42; charCodes[charCodes["asterisk"] = asterisk] = "asterisk"; // '*' + const plusSign = 43; charCodes[charCodes["plusSign"] = plusSign] = "plusSign"; // '+' + const comma = 44; charCodes[charCodes["comma"] = comma] = "comma"; // ',' + const dash = 45; charCodes[charCodes["dash"] = dash] = "dash"; // '-' + const dot = 46; charCodes[charCodes["dot"] = dot] = "dot"; // '.' + const slash = 47; charCodes[charCodes["slash"] = slash] = "slash"; // '/' + const digit0 = 48; charCodes[charCodes["digit0"] = digit0] = "digit0"; // '0' + const digit1 = 49; charCodes[charCodes["digit1"] = digit1] = "digit1"; // '1' + const digit2 = 50; charCodes[charCodes["digit2"] = digit2] = "digit2"; // '2' + const digit3 = 51; charCodes[charCodes["digit3"] = digit3] = "digit3"; // '3' + const digit4 = 52; charCodes[charCodes["digit4"] = digit4] = "digit4"; // '4' + const digit5 = 53; charCodes[charCodes["digit5"] = digit5] = "digit5"; // '5' + const digit6 = 54; charCodes[charCodes["digit6"] = digit6] = "digit6"; // '6' + const digit7 = 55; charCodes[charCodes["digit7"] = digit7] = "digit7"; // '7' + const digit8 = 56; charCodes[charCodes["digit8"] = digit8] = "digit8"; // '8' + const digit9 = 57; charCodes[charCodes["digit9"] = digit9] = "digit9"; // '9' + const colon = 58; charCodes[charCodes["colon"] = colon] = "colon"; // ':' + const semicolon = 59; charCodes[charCodes["semicolon"] = semicolon] = "semicolon"; // ';' + const lessThan = 60; charCodes[charCodes["lessThan"] = lessThan] = "lessThan"; // '<' + const equalsTo = 61; charCodes[charCodes["equalsTo"] = equalsTo] = "equalsTo"; // '=' + const greaterThan = 62; charCodes[charCodes["greaterThan"] = greaterThan] = "greaterThan"; // '>' + const questionMark = 63; charCodes[charCodes["questionMark"] = questionMark] = "questionMark"; // '?' + const atSign = 64; charCodes[charCodes["atSign"] = atSign] = "atSign"; // '@' + const uppercaseA = 65; charCodes[charCodes["uppercaseA"] = uppercaseA] = "uppercaseA"; // 'A' + const uppercaseB = 66; charCodes[charCodes["uppercaseB"] = uppercaseB] = "uppercaseB"; // 'B' + const uppercaseC = 67; charCodes[charCodes["uppercaseC"] = uppercaseC] = "uppercaseC"; // 'C' + const uppercaseD = 68; charCodes[charCodes["uppercaseD"] = uppercaseD] = "uppercaseD"; // 'D' + const uppercaseE = 69; charCodes[charCodes["uppercaseE"] = uppercaseE] = "uppercaseE"; // 'E' + const uppercaseF = 70; charCodes[charCodes["uppercaseF"] = uppercaseF] = "uppercaseF"; // 'F' + const uppercaseG = 71; charCodes[charCodes["uppercaseG"] = uppercaseG] = "uppercaseG"; // 'G' + const uppercaseH = 72; charCodes[charCodes["uppercaseH"] = uppercaseH] = "uppercaseH"; // 'H' + const uppercaseI = 73; charCodes[charCodes["uppercaseI"] = uppercaseI] = "uppercaseI"; // 'I' + const uppercaseJ = 74; charCodes[charCodes["uppercaseJ"] = uppercaseJ] = "uppercaseJ"; // 'J' + const uppercaseK = 75; charCodes[charCodes["uppercaseK"] = uppercaseK] = "uppercaseK"; // 'K' + const uppercaseL = 76; charCodes[charCodes["uppercaseL"] = uppercaseL] = "uppercaseL"; // 'L' + const uppercaseM = 77; charCodes[charCodes["uppercaseM"] = uppercaseM] = "uppercaseM"; // 'M' + const uppercaseN = 78; charCodes[charCodes["uppercaseN"] = uppercaseN] = "uppercaseN"; // 'N' + const uppercaseO = 79; charCodes[charCodes["uppercaseO"] = uppercaseO] = "uppercaseO"; // 'O' + const uppercaseP = 80; charCodes[charCodes["uppercaseP"] = uppercaseP] = "uppercaseP"; // 'P' + const uppercaseQ = 81; charCodes[charCodes["uppercaseQ"] = uppercaseQ] = "uppercaseQ"; // 'Q' + const uppercaseR = 82; charCodes[charCodes["uppercaseR"] = uppercaseR] = "uppercaseR"; // 'R' + const uppercaseS = 83; charCodes[charCodes["uppercaseS"] = uppercaseS] = "uppercaseS"; // 'S' + const uppercaseT = 84; charCodes[charCodes["uppercaseT"] = uppercaseT] = "uppercaseT"; // 'T' + const uppercaseU = 85; charCodes[charCodes["uppercaseU"] = uppercaseU] = "uppercaseU"; // 'U' + const uppercaseV = 86; charCodes[charCodes["uppercaseV"] = uppercaseV] = "uppercaseV"; // 'V' + const uppercaseW = 87; charCodes[charCodes["uppercaseW"] = uppercaseW] = "uppercaseW"; // 'W' + const uppercaseX = 88; charCodes[charCodes["uppercaseX"] = uppercaseX] = "uppercaseX"; // 'X' + const uppercaseY = 89; charCodes[charCodes["uppercaseY"] = uppercaseY] = "uppercaseY"; // 'Y' + const uppercaseZ = 90; charCodes[charCodes["uppercaseZ"] = uppercaseZ] = "uppercaseZ"; // 'Z' + const leftSquareBracket = 91; charCodes[charCodes["leftSquareBracket"] = leftSquareBracket] = "leftSquareBracket"; // '[' + const backslash = 92; charCodes[charCodes["backslash"] = backslash] = "backslash"; // '\ ' + const rightSquareBracket = 93; charCodes[charCodes["rightSquareBracket"] = rightSquareBracket] = "rightSquareBracket"; // ']' + const caret = 94; charCodes[charCodes["caret"] = caret] = "caret"; // '^' + const underscore = 95; charCodes[charCodes["underscore"] = underscore] = "underscore"; // '_' + const graveAccent = 96; charCodes[charCodes["graveAccent"] = graveAccent] = "graveAccent"; // '`' + const lowercaseA = 97; charCodes[charCodes["lowercaseA"] = lowercaseA] = "lowercaseA"; // 'a' + const lowercaseB = 98; charCodes[charCodes["lowercaseB"] = lowercaseB] = "lowercaseB"; // 'b' + const lowercaseC = 99; charCodes[charCodes["lowercaseC"] = lowercaseC] = "lowercaseC"; // 'c' + const lowercaseD = 100; charCodes[charCodes["lowercaseD"] = lowercaseD] = "lowercaseD"; // 'd' + const lowercaseE = 101; charCodes[charCodes["lowercaseE"] = lowercaseE] = "lowercaseE"; // 'e' + const lowercaseF = 102; charCodes[charCodes["lowercaseF"] = lowercaseF] = "lowercaseF"; // 'f' + const lowercaseG = 103; charCodes[charCodes["lowercaseG"] = lowercaseG] = "lowercaseG"; // 'g' + const lowercaseH = 104; charCodes[charCodes["lowercaseH"] = lowercaseH] = "lowercaseH"; // 'h' + const lowercaseI = 105; charCodes[charCodes["lowercaseI"] = lowercaseI] = "lowercaseI"; // 'i' + const lowercaseJ = 106; charCodes[charCodes["lowercaseJ"] = lowercaseJ] = "lowercaseJ"; // 'j' + const lowercaseK = 107; charCodes[charCodes["lowercaseK"] = lowercaseK] = "lowercaseK"; // 'k' + const lowercaseL = 108; charCodes[charCodes["lowercaseL"] = lowercaseL] = "lowercaseL"; // 'l' + const lowercaseM = 109; charCodes[charCodes["lowercaseM"] = lowercaseM] = "lowercaseM"; // 'm' + const lowercaseN = 110; charCodes[charCodes["lowercaseN"] = lowercaseN] = "lowercaseN"; // 'n' + const lowercaseO = 111; charCodes[charCodes["lowercaseO"] = lowercaseO] = "lowercaseO"; // 'o' + const lowercaseP = 112; charCodes[charCodes["lowercaseP"] = lowercaseP] = "lowercaseP"; // 'p' + const lowercaseQ = 113; charCodes[charCodes["lowercaseQ"] = lowercaseQ] = "lowercaseQ"; // 'q' + const lowercaseR = 114; charCodes[charCodes["lowercaseR"] = lowercaseR] = "lowercaseR"; // 'r' + const lowercaseS = 115; charCodes[charCodes["lowercaseS"] = lowercaseS] = "lowercaseS"; // 's' + const lowercaseT = 116; charCodes[charCodes["lowercaseT"] = lowercaseT] = "lowercaseT"; // 't' + const lowercaseU = 117; charCodes[charCodes["lowercaseU"] = lowercaseU] = "lowercaseU"; // 'u' + const lowercaseV = 118; charCodes[charCodes["lowercaseV"] = lowercaseV] = "lowercaseV"; // 'v' + const lowercaseW = 119; charCodes[charCodes["lowercaseW"] = lowercaseW] = "lowercaseW"; // 'w' + const lowercaseX = 120; charCodes[charCodes["lowercaseX"] = lowercaseX] = "lowercaseX"; // 'x' + const lowercaseY = 121; charCodes[charCodes["lowercaseY"] = lowercaseY] = "lowercaseY"; // 'y' + const lowercaseZ = 122; charCodes[charCodes["lowercaseZ"] = lowercaseZ] = "lowercaseZ"; // 'z' + const leftCurlyBrace = 123; charCodes[charCodes["leftCurlyBrace"] = leftCurlyBrace] = "leftCurlyBrace"; // '{' + const verticalBar = 124; charCodes[charCodes["verticalBar"] = verticalBar] = "verticalBar"; // '|' + const rightCurlyBrace = 125; charCodes[charCodes["rightCurlyBrace"] = rightCurlyBrace] = "rightCurlyBrace"; // '}' + const tilde = 126; charCodes[charCodes["tilde"] = tilde] = "tilde"; // '~' + const nonBreakingSpace = 160; charCodes[charCodes["nonBreakingSpace"] = nonBreakingSpace] = "nonBreakingSpace"; + // eslint-disable-next-line no-irregular-whitespace + const oghamSpaceMark = 5760; charCodes[charCodes["oghamSpaceMark"] = oghamSpaceMark] = "oghamSpaceMark"; // ' ' + const lineSeparator = 8232; charCodes[charCodes["lineSeparator"] = lineSeparator] = "lineSeparator"; + const paragraphSeparator = 8233; charCodes[charCodes["paragraphSeparator"] = paragraphSeparator] = "paragraphSeparator"; +})(charCodes || (exports.charCodes = charCodes = {})); + + function isDigit(code) { + return ( + (code >= charCodes.digit0 && code <= charCodes.digit9) || + (code >= charCodes.lowercaseA && code <= charCodes.lowercaseF) || + (code >= charCodes.uppercaseA && code <= charCodes.uppercaseF) + ); +} exports.isDigit = isDigit; diff --git a/node_modules/sucrase/dist/parser/util/identifier.js b/node_modules/sucrase/dist/parser/util/identifier.js new file mode 100644 index 00000000..9a2813c9 --- /dev/null +++ b/node_modules/sucrase/dist/parser/util/identifier.js @@ -0,0 +1,34 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _charcodes = require('./charcodes'); +var _whitespace = require('./whitespace'); + +function computeIsIdentifierChar(code) { + if (code < 48) return code === 36; + if (code < 58) return true; + if (code < 65) return false; + if (code < 91) return true; + if (code < 97) return code === 95; + if (code < 123) return true; + if (code < 128) return false; + throw new Error("Should not be called with non-ASCII char code."); +} + + const IS_IDENTIFIER_CHAR = new Uint8Array(65536); exports.IS_IDENTIFIER_CHAR = IS_IDENTIFIER_CHAR; +for (let i = 0; i < 128; i++) { + exports.IS_IDENTIFIER_CHAR[i] = computeIsIdentifierChar(i) ? 1 : 0; +} +for (let i = 128; i < 65536; i++) { + exports.IS_IDENTIFIER_CHAR[i] = 1; +} +// Aside from whitespace and newlines, all characters outside the ASCII space are either +// identifier characters or invalid. Since we're not performing code validation, we can just +// treat all invalid characters as identifier characters. +for (const whitespaceChar of _whitespace.WHITESPACE_CHARS) { + exports.IS_IDENTIFIER_CHAR[whitespaceChar] = 0; +} +exports.IS_IDENTIFIER_CHAR[0x2028] = 0; +exports.IS_IDENTIFIER_CHAR[0x2029] = 0; + + const IS_IDENTIFIER_START = exports.IS_IDENTIFIER_CHAR.slice(); exports.IS_IDENTIFIER_START = IS_IDENTIFIER_START; +for (let numChar = _charcodes.charCodes.digit0; numChar <= _charcodes.charCodes.digit9; numChar++) { + exports.IS_IDENTIFIER_START[numChar] = 0; +} diff --git a/node_modules/sucrase/dist/parser/util/whitespace.js b/node_modules/sucrase/dist/parser/util/whitespace.js new file mode 100644 index 00000000..55bb994d --- /dev/null +++ b/node_modules/sucrase/dist/parser/util/whitespace.js @@ -0,0 +1,33 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _charcodes = require('./charcodes'); + +// https://tc39.github.io/ecma262/#sec-white-space + const WHITESPACE_CHARS = [ + 0x0009, + 0x000b, + 0x000c, + _charcodes.charCodes.space, + _charcodes.charCodes.nonBreakingSpace, + _charcodes.charCodes.oghamSpaceMark, + 0x2000, // EN QUAD + 0x2001, // EM QUAD + 0x2002, // EN SPACE + 0x2003, // EM SPACE + 0x2004, // THREE-PER-EM SPACE + 0x2005, // FOUR-PER-EM SPACE + 0x2006, // SIX-PER-EM SPACE + 0x2007, // FIGURE SPACE + 0x2008, // PUNCTUATION SPACE + 0x2009, // THIN SPACE + 0x200a, // HAIR SPACE + 0x202f, // NARROW NO-BREAK SPACE + 0x205f, // MEDIUM MATHEMATICAL SPACE + 0x3000, // IDEOGRAPHIC SPACE + 0xfeff, // ZERO WIDTH NO-BREAK SPACE +]; exports.WHITESPACE_CHARS = WHITESPACE_CHARS; + + const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; exports.skipWhiteSpace = skipWhiteSpace; + + const IS_WHITESPACE = new Uint8Array(65536); exports.IS_WHITESPACE = IS_WHITESPACE; +for (const char of exports.WHITESPACE_CHARS) { + exports.IS_WHITESPACE[char] = 1; +} diff --git a/node_modules/sucrase/dist/register.js b/node_modules/sucrase/dist/register.js new file mode 100644 index 00000000..1325f30b --- /dev/null +++ b/node_modules/sucrase/dist/register.js @@ -0,0 +1,88 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _pirates = require('pirates'); var pirates = _interopRequireWildcard(_pirates); + +var _index = require('./index'); + + + + + + + + + function addHook( + extension, + sucraseOptions, + hookOptions, +) { + let mergedSucraseOptions = sucraseOptions; + const sucraseOptionsEnvJSON = process.env.SUCRASE_OPTIONS; + if (sucraseOptionsEnvJSON) { + mergedSucraseOptions = {...mergedSucraseOptions, ...JSON.parse(sucraseOptionsEnvJSON)}; + } + return pirates.addHook( + (code, filePath) => { + const {code: transformedCode, sourceMap} = _index.transform.call(void 0, code, { + ...mergedSucraseOptions, + sourceMapOptions: {compiledFilename: filePath}, + filePath, + }); + const mapBase64 = Buffer.from(JSON.stringify(sourceMap)).toString("base64"); + const suffix = `//# sourceMappingURL=data:application/json;charset=utf-8;base64,${mapBase64}`; + return `${transformedCode}\n${suffix}`; + }, + {...hookOptions, exts: [extension]}, + ); +} exports.addHook = addHook; + + function registerJS(hookOptions) { + return addHook(".js", {transforms: ["imports", "flow", "jsx"]}, hookOptions); +} exports.registerJS = registerJS; + + function registerJSX(hookOptions) { + return addHook(".jsx", {transforms: ["imports", "flow", "jsx"]}, hookOptions); +} exports.registerJSX = registerJSX; + + function registerTS(hookOptions) { + return addHook(".ts", {transforms: ["imports", "typescript"]}, hookOptions); +} exports.registerTS = registerTS; + + function registerTSX(hookOptions) { + return addHook(".tsx", {transforms: ["imports", "typescript", "jsx"]}, hookOptions); +} exports.registerTSX = registerTSX; + + function registerTSLegacyModuleInterop(hookOptions) { + return addHook( + ".ts", + { + transforms: ["imports", "typescript"], + enableLegacyTypeScriptModuleInterop: true, + }, + hookOptions, + ); +} exports.registerTSLegacyModuleInterop = registerTSLegacyModuleInterop; + + function registerTSXLegacyModuleInterop(hookOptions) { + return addHook( + ".tsx", + { + transforms: ["imports", "typescript", "jsx"], + enableLegacyTypeScriptModuleInterop: true, + }, + hookOptions, + ); +} exports.registerTSXLegacyModuleInterop = registerTSXLegacyModuleInterop; + + function registerAll(hookOptions) { + const reverts = [ + registerJS(hookOptions), + registerJSX(hookOptions), + registerTS(hookOptions), + registerTSX(hookOptions), + ]; + + return () => { + for (const fn of reverts) { + fn(); + } + }; +} exports.registerAll = registerAll; diff --git a/node_modules/sucrase/dist/transformers/CJSImportTransformer.js b/node_modules/sucrase/dist/transformers/CJSImportTransformer.js new file mode 100644 index 00000000..170e5bb8 --- /dev/null +++ b/node_modules/sucrase/dist/transformers/CJSImportTransformer.js @@ -0,0 +1,916 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + +var _tokenizer = require('../parser/tokenizer'); +var _keywords = require('../parser/tokenizer/keywords'); +var _types = require('../parser/tokenizer/types'); + +var _elideImportEquals = require('../util/elideImportEquals'); var _elideImportEquals2 = _interopRequireDefault(_elideImportEquals); + + + +var _getDeclarationInfo = require('../util/getDeclarationInfo'); var _getDeclarationInfo2 = _interopRequireDefault(_getDeclarationInfo); +var _getImportExportSpecifierInfo = require('../util/getImportExportSpecifierInfo'); var _getImportExportSpecifierInfo2 = _interopRequireDefault(_getImportExportSpecifierInfo); +var _isExportFrom = require('../util/isExportFrom'); var _isExportFrom2 = _interopRequireDefault(_isExportFrom); +var _removeMaybeImportAttributes = require('../util/removeMaybeImportAttributes'); +var _shouldElideDefaultExport = require('../util/shouldElideDefaultExport'); var _shouldElideDefaultExport2 = _interopRequireDefault(_shouldElideDefaultExport); + + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + +/** + * Class for editing import statements when we are transforming to commonjs. + */ + class CJSImportTransformer extends _Transformer2.default { + __init() {this.hadExport = false} + __init2() {this.hadNamedExport = false} + __init3() {this.hadDefaultExport = false} + + + constructor( + rootTransformer, + tokens, + importProcessor, + nameManager, + helperManager, + reactHotLoaderTransformer, + enableLegacyBabel5ModuleInterop, + enableLegacyTypeScriptModuleInterop, + isTypeScriptTransformEnabled, + isFlowTransformEnabled, + preserveDynamicImport, + keepUnusedImports, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.importProcessor = importProcessor;this.nameManager = nameManager;this.helperManager = helperManager;this.reactHotLoaderTransformer = reactHotLoaderTransformer;this.enableLegacyBabel5ModuleInterop = enableLegacyBabel5ModuleInterop;this.enableLegacyTypeScriptModuleInterop = enableLegacyTypeScriptModuleInterop;this.isTypeScriptTransformEnabled = isTypeScriptTransformEnabled;this.isFlowTransformEnabled = isFlowTransformEnabled;this.preserveDynamicImport = preserveDynamicImport;this.keepUnusedImports = keepUnusedImports;CJSImportTransformer.prototype.__init.call(this);CJSImportTransformer.prototype.__init2.call(this);CJSImportTransformer.prototype.__init3.call(this);; + this.declarationInfo = isTypeScriptTransformEnabled + ? _getDeclarationInfo2.default.call(void 0, tokens) + : _getDeclarationInfo.EMPTY_DECLARATION_INFO; + } + + getPrefixCode() { + let prefix = ""; + if (this.hadExport) { + prefix += 'Object.defineProperty(exports, "__esModule", {value: true});'; + } + return prefix; + } + + getSuffixCode() { + if (this.enableLegacyBabel5ModuleInterop && this.hadDefaultExport && !this.hadNamedExport) { + return "\nmodule.exports = exports.default;\n"; + } + return ""; + } + + process() { + // TypeScript `import foo = require('foo');` should always just be translated to plain require. + if (this.tokens.matches3(_types.TokenType._import, _types.TokenType.name, _types.TokenType.eq)) { + return this.processImportEquals(); + } + if (this.tokens.matches1(_types.TokenType._import)) { + this.processImport(); + return true; + } + if (this.tokens.matches2(_types.TokenType._export, _types.TokenType.eq)) { + this.tokens.replaceToken("module.exports"); + return true; + } + if (this.tokens.matches1(_types.TokenType._export) && !this.tokens.currentToken().isType) { + this.hadExport = true; + return this.processExport(); + } + if (this.tokens.matches2(_types.TokenType.name, _types.TokenType.postIncDec)) { + // Fall through to normal identifier matching if this doesn't apply. + if (this.processPostIncDec()) { + return true; + } + } + if (this.tokens.matches1(_types.TokenType.name) || this.tokens.matches1(_types.TokenType.jsxName)) { + return this.processIdentifier(); + } + if (this.tokens.matches1(_types.TokenType.eq)) { + return this.processAssignment(); + } + if (this.tokens.matches1(_types.TokenType.assign)) { + return this.processComplexAssignment(); + } + if (this.tokens.matches1(_types.TokenType.preIncDec)) { + return this.processPreIncDec(); + } + return false; + } + + processImportEquals() { + const importName = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1); + if (this.importProcessor.shouldAutomaticallyElideImportedName(importName)) { + // If this name is only used as a type, elide the whole import. + _elideImportEquals2.default.call(void 0, this.tokens); + } else { + // Otherwise, switch `import` to `const`. + this.tokens.replaceToken("const"); + } + return true; + } + + /** + * Transform this: + * import foo, {bar} from 'baz'; + * into + * var _baz = require('baz'); var _baz2 = _interopRequireDefault(_baz); + * + * The import code was already generated in the import preprocessing step, so + * we just need to look it up. + */ + processImport() { + if (this.tokens.matches2(_types.TokenType._import, _types.TokenType.parenL)) { + if (this.preserveDynamicImport) { + // Bail out, only making progress for this one token. + this.tokens.copyToken(); + return; + } + const requireWrapper = this.enableLegacyTypeScriptModuleInterop + ? "" + : `${this.helperManager.getHelperName("interopRequireWildcard")}(`; + this.tokens.replaceToken(`Promise.resolve().then(() => ${requireWrapper}require`); + const contextId = this.tokens.currentToken().contextId; + if (contextId == null) { + throw new Error("Expected context ID on dynamic import invocation."); + } + this.tokens.copyToken(); + while (!this.tokens.matchesContextIdAndLabel(_types.TokenType.parenR, contextId)) { + this.rootTransformer.processToken(); + } + this.tokens.replaceToken(requireWrapper ? ")))" : "))"); + return; + } + + const shouldElideImport = this.removeImportAndDetectIfShouldElide(); + if (shouldElideImport) { + this.tokens.removeToken(); + } else { + const path = this.tokens.stringValue(); + this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path)); + this.tokens.appendCode(this.importProcessor.claimImportCode(path)); + } + _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens); + if (this.tokens.matches1(_types.TokenType.semi)) { + this.tokens.removeToken(); + } + } + + /** + * Erase this import (since any CJS output would be completely different), and + * return true if this import is should be elided due to being a type-only + * import. Such imports will not be emitted at all to avoid side effects. + * + * Import elision only happens with the TypeScript or Flow transforms enabled. + * + * TODO: This function has some awkward overlap with + * CJSImportProcessor.pruneTypeOnlyImports , and the two should be unified. + * That function handles TypeScript implicit import name elision, and removes + * an import if all typical imported names (without `type`) are removed due + * to being type-only imports. This function handles Flow import removal and + * properly distinguishes `import 'foo'` from `import {} from 'foo'` for TS + * purposes. + * + * The position should end at the import string. + */ + removeImportAndDetectIfShouldElide() { + this.tokens.removeInitialToken(); + if ( + this.tokens.matchesContextual(_keywords.ContextualKeyword._type) && + !this.tokens.matches1AtIndex(this.tokens.currentIndex() + 1, _types.TokenType.comma) && + !this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, _keywords.ContextualKeyword._from) + ) { + // This is an "import type" statement, so exit early. + this.removeRemainingImport(); + return true; + } + + if (this.tokens.matches1(_types.TokenType.name) || this.tokens.matches1(_types.TokenType.star)) { + // We have a default import or namespace import, so there must be some + // non-type import. + this.removeRemainingImport(); + return false; + } + + if (this.tokens.matches1(_types.TokenType.string)) { + // This is a bare import, so we should proceed with the import. + return false; + } + + let foundNonTypeImport = false; + let foundAnyNamedImport = false; + while (!this.tokens.matches1(_types.TokenType.string)) { + // Check if any named imports are of the form "foo" or "foo as bar", with + // no leading "type". + if ( + (!foundNonTypeImport && this.tokens.matches1(_types.TokenType.braceL)) || + this.tokens.matches1(_types.TokenType.comma) + ) { + this.tokens.removeToken(); + if (!this.tokens.matches1(_types.TokenType.braceR)) { + foundAnyNamedImport = true; + } + if ( + this.tokens.matches2(_types.TokenType.name, _types.TokenType.comma) || + this.tokens.matches2(_types.TokenType.name, _types.TokenType.braceR) || + this.tokens.matches4(_types.TokenType.name, _types.TokenType.name, _types.TokenType.name, _types.TokenType.comma) || + this.tokens.matches4(_types.TokenType.name, _types.TokenType.name, _types.TokenType.name, _types.TokenType.braceR) + ) { + foundNonTypeImport = true; + } + } + this.tokens.removeToken(); + } + if (this.keepUnusedImports) { + return false; + } + if (this.isTypeScriptTransformEnabled) { + return !foundNonTypeImport; + } else if (this.isFlowTransformEnabled) { + // In Flow, unlike TS, `import {} from 'foo';` preserves the import. + return foundAnyNamedImport && !foundNonTypeImport; + } else { + return false; + } + } + + removeRemainingImport() { + while (!this.tokens.matches1(_types.TokenType.string)) { + this.tokens.removeToken(); + } + } + + processIdentifier() { + const token = this.tokens.currentToken(); + if (token.shadowsGlobal) { + return false; + } + + if (token.identifierRole === _tokenizer.IdentifierRole.ObjectShorthand) { + return this.processObjectShorthand(); + } + + if (token.identifierRole !== _tokenizer.IdentifierRole.Access) { + return false; + } + const replacement = this.importProcessor.getIdentifierReplacement( + this.tokens.identifierNameForToken(token), + ); + if (!replacement) { + return false; + } + // Tolerate any number of closing parens while looking for an opening paren + // that indicates a function call. + let possibleOpenParenIndex = this.tokens.currentIndex() + 1; + while ( + possibleOpenParenIndex < this.tokens.tokens.length && + this.tokens.tokens[possibleOpenParenIndex].type === _types.TokenType.parenR + ) { + possibleOpenParenIndex++; + } + // Avoid treating imported functions as methods of their `exports` object + // by using `(0, f)` when the identifier is in a paren expression. Else + // use `Function.prototype.call` when the identifier is a guaranteed + // function call. When using `call`, pass undefined as the context. + if (this.tokens.tokens[possibleOpenParenIndex].type === _types.TokenType.parenL) { + if ( + this.tokens.tokenAtRelativeIndex(1).type === _types.TokenType.parenL && + this.tokens.tokenAtRelativeIndex(-1).type !== _types.TokenType._new + ) { + this.tokens.replaceToken(`${replacement}.call(void 0, `); + // Remove the old paren. + this.tokens.removeToken(); + // Balance out the new paren. + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(_types.TokenType.parenR); + } else { + // See here: http://2ality.com/2015/12/references.html + this.tokens.replaceToken(`(0, ${replacement})`); + } + } else { + this.tokens.replaceToken(replacement); + } + return true; + } + + processObjectShorthand() { + const identifier = this.tokens.identifierName(); + const replacement = this.importProcessor.getIdentifierReplacement(identifier); + if (!replacement) { + return false; + } + this.tokens.replaceToken(`${identifier}: ${replacement}`); + return true; + } + + processExport() { + if ( + this.tokens.matches2(_types.TokenType._export, _types.TokenType._enum) || + this.tokens.matches3(_types.TokenType._export, _types.TokenType._const, _types.TokenType._enum) + ) { + this.hadNamedExport = true; + // Let the TypeScript transform handle it. + return false; + } + if (this.tokens.matches2(_types.TokenType._export, _types.TokenType._default)) { + if (this.tokens.matches3(_types.TokenType._export, _types.TokenType._default, _types.TokenType._enum)) { + this.hadDefaultExport = true; + // Flow export default enums need some special handling, so handle them + // in that tranform rather than this one. + return false; + } + this.processExportDefault(); + return true; + } else if (this.tokens.matches2(_types.TokenType._export, _types.TokenType.braceL)) { + this.processExportBindings(); + return true; + } else if ( + this.tokens.matches2(_types.TokenType._export, _types.TokenType.name) && + this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, _keywords.ContextualKeyword._type) + ) { + // export type {a}; + // export type {a as b}; + // export type {a} from './b'; + // export type * from './b'; + // export type * as ns from './b'; + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + if (this.tokens.matches1(_types.TokenType.braceL)) { + while (!this.tokens.matches1(_types.TokenType.braceR)) { + this.tokens.removeToken(); + } + this.tokens.removeToken(); + } else { + // * + this.tokens.removeToken(); + if (this.tokens.matches1(_types.TokenType._as)) { + // as + this.tokens.removeToken(); + // ns + this.tokens.removeToken(); + } + } + // Remove type re-export `... } from './T'` + if ( + this.tokens.matchesContextual(_keywords.ContextualKeyword._from) && + this.tokens.matches1AtIndex(this.tokens.currentIndex() + 1, _types.TokenType.string) + ) { + this.tokens.removeToken(); + this.tokens.removeToken(); + _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens); + } + return true; + } + this.hadNamedExport = true; + if ( + this.tokens.matches2(_types.TokenType._export, _types.TokenType._var) || + this.tokens.matches2(_types.TokenType._export, _types.TokenType._let) || + this.tokens.matches2(_types.TokenType._export, _types.TokenType._const) + ) { + this.processExportVar(); + return true; + } else if ( + this.tokens.matches2(_types.TokenType._export, _types.TokenType._function) || + // export async function + this.tokens.matches3(_types.TokenType._export, _types.TokenType.name, _types.TokenType._function) + ) { + this.processExportFunction(); + return true; + } else if ( + this.tokens.matches2(_types.TokenType._export, _types.TokenType._class) || + this.tokens.matches3(_types.TokenType._export, _types.TokenType._abstract, _types.TokenType._class) || + this.tokens.matches2(_types.TokenType._export, _types.TokenType.at) + ) { + this.processExportClass(); + return true; + } else if (this.tokens.matches2(_types.TokenType._export, _types.TokenType.star)) { + this.processExportStar(); + return true; + } else { + throw new Error("Unrecognized export syntax."); + } + } + + processAssignment() { + const index = this.tokens.currentIndex(); + const identifierToken = this.tokens.tokens[index - 1]; + // If the LHS is a type identifier, this must be a declaration like `let a: b = c;`, + // with `b` as the identifier, so nothing needs to be done in that case. + if (identifierToken.isType || identifierToken.type !== _types.TokenType.name) { + return false; + } + if (identifierToken.shadowsGlobal) { + return false; + } + if (index >= 2 && this.tokens.matches1AtIndex(index - 2, _types.TokenType.dot)) { + return false; + } + if (index >= 2 && [_types.TokenType._var, _types.TokenType._let, _types.TokenType._const].includes(this.tokens.tokens[index - 2].type)) { + // Declarations don't need an extra assignment. This doesn't avoid the + // assignment for comma-separated declarations, but it's still correct + // since the assignment is just redundant. + return false; + } + const assignmentSnippet = this.importProcessor.resolveExportBinding( + this.tokens.identifierNameForToken(identifierToken), + ); + if (!assignmentSnippet) { + return false; + } + this.tokens.copyToken(); + this.tokens.appendCode(` ${assignmentSnippet} =`); + return true; + } + + /** + * Process something like `a += 3`, where `a` might be an exported value. + */ + processComplexAssignment() { + const index = this.tokens.currentIndex(); + const identifierToken = this.tokens.tokens[index - 1]; + if (identifierToken.type !== _types.TokenType.name) { + return false; + } + if (identifierToken.shadowsGlobal) { + return false; + } + if (index >= 2 && this.tokens.matches1AtIndex(index - 2, _types.TokenType.dot)) { + return false; + } + const assignmentSnippet = this.importProcessor.resolveExportBinding( + this.tokens.identifierNameForToken(identifierToken), + ); + if (!assignmentSnippet) { + return false; + } + this.tokens.appendCode(` = ${assignmentSnippet}`); + this.tokens.copyToken(); + return true; + } + + /** + * Process something like `++a`, where `a` might be an exported value. + */ + processPreIncDec() { + const index = this.tokens.currentIndex(); + const identifierToken = this.tokens.tokens[index + 1]; + if (identifierToken.type !== _types.TokenType.name) { + return false; + } + if (identifierToken.shadowsGlobal) { + return false; + } + // Ignore things like ++a.b and ++a[b] and ++a().b. + if ( + index + 2 < this.tokens.tokens.length && + (this.tokens.matches1AtIndex(index + 2, _types.TokenType.dot) || + this.tokens.matches1AtIndex(index + 2, _types.TokenType.bracketL) || + this.tokens.matches1AtIndex(index + 2, _types.TokenType.parenL)) + ) { + return false; + } + const identifierName = this.tokens.identifierNameForToken(identifierToken); + const assignmentSnippet = this.importProcessor.resolveExportBinding(identifierName); + if (!assignmentSnippet) { + return false; + } + this.tokens.appendCode(`${assignmentSnippet} = `); + this.tokens.copyToken(); + return true; + } + + /** + * Process something like `a++`, where `a` might be an exported value. + * This starts at the `a`, not at the `++`. + */ + processPostIncDec() { + const index = this.tokens.currentIndex(); + const identifierToken = this.tokens.tokens[index]; + const operatorToken = this.tokens.tokens[index + 1]; + if (identifierToken.type !== _types.TokenType.name) { + return false; + } + if (identifierToken.shadowsGlobal) { + return false; + } + if (index >= 1 && this.tokens.matches1AtIndex(index - 1, _types.TokenType.dot)) { + return false; + } + const identifierName = this.tokens.identifierNameForToken(identifierToken); + const assignmentSnippet = this.importProcessor.resolveExportBinding(identifierName); + if (!assignmentSnippet) { + return false; + } + const operatorCode = this.tokens.rawCodeForToken(operatorToken); + // We might also replace the identifier with something like exports.x, so + // do that replacement here as well. + const base = this.importProcessor.getIdentifierReplacement(identifierName) || identifierName; + if (operatorCode === "++") { + this.tokens.replaceToken(`(${base} = ${assignmentSnippet} = ${base} + 1, ${base} - 1)`); + } else if (operatorCode === "--") { + this.tokens.replaceToken(`(${base} = ${assignmentSnippet} = ${base} - 1, ${base} + 1)`); + } else { + throw new Error(`Unexpected operator: ${operatorCode}`); + } + this.tokens.removeToken(); + return true; + } + + processExportDefault() { + let exportedRuntimeValue = true; + if ( + this.tokens.matches4(_types.TokenType._export, _types.TokenType._default, _types.TokenType._function, _types.TokenType.name) || + // export default async function + (this.tokens.matches5(_types.TokenType._export, _types.TokenType._default, _types.TokenType.name, _types.TokenType._function, _types.TokenType.name) && + this.tokens.matchesContextualAtIndex( + this.tokens.currentIndex() + 2, + _keywords.ContextualKeyword._async, + )) + ) { + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + // Named function export case: change it to a top-level function + // declaration followed by exports statement. + const name = this.processNamedFunction(); + this.tokens.appendCode(` exports.default = ${name};`); + } else if ( + this.tokens.matches4(_types.TokenType._export, _types.TokenType._default, _types.TokenType._class, _types.TokenType.name) || + this.tokens.matches5(_types.TokenType._export, _types.TokenType._default, _types.TokenType._abstract, _types.TokenType._class, _types.TokenType.name) || + this.tokens.matches3(_types.TokenType._export, _types.TokenType._default, _types.TokenType.at) + ) { + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + this.copyDecorators(); + if (this.tokens.matches1(_types.TokenType._abstract)) { + this.tokens.removeToken(); + } + const name = this.rootTransformer.processNamedClass(); + this.tokens.appendCode(` exports.default = ${name};`); + // After this point, this is a plain "export default E" statement. + } else if ( + _shouldElideDefaultExport2.default.call(void 0, + this.isTypeScriptTransformEnabled, + this.keepUnusedImports, + this.tokens, + this.declarationInfo, + ) + ) { + // If the exported value is just an identifier and should be elided by TypeScript + // rules, then remove it entirely. It will always have the form `export default e`, + // where `e` is an identifier. + exportedRuntimeValue = false; + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + this.tokens.removeToken(); + } else if (this.reactHotLoaderTransformer) { + // We need to assign E to a variable. Change "export default E" to + // "let _default; exports.default = _default = E" + const defaultVarName = this.nameManager.claimFreeName("_default"); + this.tokens.replaceToken(`let ${defaultVarName}; exports.`); + this.tokens.copyToken(); + this.tokens.appendCode(` = ${defaultVarName} =`); + this.reactHotLoaderTransformer.setExtractedDefaultExportName(defaultVarName); + } else { + // Change "export default E" to "exports.default = E" + this.tokens.replaceToken("exports."); + this.tokens.copyToken(); + this.tokens.appendCode(" ="); + } + if (exportedRuntimeValue) { + this.hadDefaultExport = true; + } + } + + copyDecorators() { + while (this.tokens.matches1(_types.TokenType.at)) { + this.tokens.copyToken(); + if (this.tokens.matches1(_types.TokenType.parenL)) { + this.tokens.copyExpectedToken(_types.TokenType.parenL); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(_types.TokenType.parenR); + } else { + this.tokens.copyExpectedToken(_types.TokenType.name); + while (this.tokens.matches1(_types.TokenType.dot)) { + this.tokens.copyExpectedToken(_types.TokenType.dot); + this.tokens.copyExpectedToken(_types.TokenType.name); + } + if (this.tokens.matches1(_types.TokenType.parenL)) { + this.tokens.copyExpectedToken(_types.TokenType.parenL); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(_types.TokenType.parenR); + } + } + } + } + + /** + * Transform a declaration like `export var`, `export let`, or `export const`. + */ + processExportVar() { + if (this.isSimpleExportVar()) { + this.processSimpleExportVar(); + } else { + this.processComplexExportVar(); + } + } + + /** + * Determine if the export is of the form: + * export var/let/const [varName] = [expr]; + * In other words, determine if function name inference might apply. + */ + isSimpleExportVar() { + let tokenIndex = this.tokens.currentIndex(); + // export + tokenIndex++; + // var/let/const + tokenIndex++; + if (!this.tokens.matches1AtIndex(tokenIndex, _types.TokenType.name)) { + return false; + } + tokenIndex++; + while (tokenIndex < this.tokens.tokens.length && this.tokens.tokens[tokenIndex].isType) { + tokenIndex++; + } + if (!this.tokens.matches1AtIndex(tokenIndex, _types.TokenType.eq)) { + return false; + } + return true; + } + + /** + * Transform an `export var` declaration initializing a single variable. + * + * For example, this: + * export const f = () => {}; + * becomes this: + * const f = () => {}; exports.f = f; + * + * The variable is unused (e.g. exports.f has the true value of the export). + * We need to produce an assignment of this form so that the function will + * have an inferred name of "f", which wouldn't happen in the more general + * case below. + */ + processSimpleExportVar() { + // export + this.tokens.removeInitialToken(); + // var/let/const + this.tokens.copyToken(); + const varName = this.tokens.identifierName(); + // x: number -> x + while (!this.tokens.matches1(_types.TokenType.eq)) { + this.rootTransformer.processToken(); + } + const endIndex = this.tokens.currentToken().rhsEndIndex; + if (endIndex == null) { + throw new Error("Expected = token with an end index."); + } + while (this.tokens.currentIndex() < endIndex) { + this.rootTransformer.processToken(); + } + this.tokens.appendCode(`; exports.${varName} = ${varName}`); + } + + /** + * Transform normal declaration exports, including handling destructuring. + * For example, this: + * export const {x: [a = 2, b], c} = d; + * becomes this: + * ({x: [exports.a = 2, exports.b], c: exports.c} = d;) + */ + processComplexExportVar() { + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + const needsParens = this.tokens.matches1(_types.TokenType.braceL); + if (needsParens) { + this.tokens.appendCode("("); + } + + let depth = 0; + while (true) { + if ( + this.tokens.matches1(_types.TokenType.braceL) || + this.tokens.matches1(_types.TokenType.dollarBraceL) || + this.tokens.matches1(_types.TokenType.bracketL) + ) { + depth++; + this.tokens.copyToken(); + } else if (this.tokens.matches1(_types.TokenType.braceR) || this.tokens.matches1(_types.TokenType.bracketR)) { + depth--; + this.tokens.copyToken(); + } else if ( + depth === 0 && + !this.tokens.matches1(_types.TokenType.name) && + !this.tokens.currentToken().isType + ) { + break; + } else if (this.tokens.matches1(_types.TokenType.eq)) { + // Default values might have assignments in the RHS that we want to ignore, so skip past + // them. + const endIndex = this.tokens.currentToken().rhsEndIndex; + if (endIndex == null) { + throw new Error("Expected = token with an end index."); + } + while (this.tokens.currentIndex() < endIndex) { + this.rootTransformer.processToken(); + } + } else { + const token = this.tokens.currentToken(); + if (_tokenizer.isDeclaration.call(void 0, token)) { + const name = this.tokens.identifierName(); + let replacement = this.importProcessor.getIdentifierReplacement(name); + if (replacement === null) { + throw new Error(`Expected a replacement for ${name} in \`export var\` syntax.`); + } + if (_tokenizer.isObjectShorthandDeclaration.call(void 0, token)) { + replacement = `${name}: ${replacement}`; + } + this.tokens.replaceToken(replacement); + } else { + this.rootTransformer.processToken(); + } + } + } + + if (needsParens) { + // Seek to the end of the RHS. + const endIndex = this.tokens.currentToken().rhsEndIndex; + if (endIndex == null) { + throw new Error("Expected = token with an end index."); + } + while (this.tokens.currentIndex() < endIndex) { + this.rootTransformer.processToken(); + } + this.tokens.appendCode(")"); + } + } + + /** + * Transform this: + * export function foo() {} + * into this: + * function foo() {} exports.foo = foo; + */ + processExportFunction() { + this.tokens.replaceToken(""); + const name = this.processNamedFunction(); + this.tokens.appendCode(` exports.${name} = ${name};`); + } + + /** + * Skip past a function with a name and return that name. + */ + processNamedFunction() { + if (this.tokens.matches1(_types.TokenType._function)) { + this.tokens.copyToken(); + } else if (this.tokens.matches2(_types.TokenType.name, _types.TokenType._function)) { + if (!this.tokens.matchesContextual(_keywords.ContextualKeyword._async)) { + throw new Error("Expected async keyword in function export."); + } + this.tokens.copyToken(); + this.tokens.copyToken(); + } + if (this.tokens.matches1(_types.TokenType.star)) { + this.tokens.copyToken(); + } + if (!this.tokens.matches1(_types.TokenType.name)) { + throw new Error("Expected identifier for exported function name."); + } + const name = this.tokens.identifierName(); + this.tokens.copyToken(); + if (this.tokens.currentToken().isType) { + this.tokens.removeInitialToken(); + while (this.tokens.currentToken().isType) { + this.tokens.removeToken(); + } + } + this.tokens.copyExpectedToken(_types.TokenType.parenL); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(_types.TokenType.parenR); + this.rootTransformer.processPossibleTypeRange(); + this.tokens.copyExpectedToken(_types.TokenType.braceL); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(_types.TokenType.braceR); + return name; + } + + /** + * Transform this: + * export class A {} + * into this: + * class A {} exports.A = A; + */ + processExportClass() { + this.tokens.removeInitialToken(); + this.copyDecorators(); + if (this.tokens.matches1(_types.TokenType._abstract)) { + this.tokens.removeToken(); + } + const name = this.rootTransformer.processNamedClass(); + this.tokens.appendCode(` exports.${name} = ${name};`); + } + + /** + * Transform this: + * export {a, b as c}; + * into this: + * exports.a = a; exports.c = b; + * + * OR + * + * Transform this: + * export {a, b as c} from './foo'; + * into the pre-generated Object.defineProperty code from the ImportProcessor. + * + * For the first case, if the TypeScript transform is enabled, we need to skip + * exports that are only defined as types. + */ + processExportBindings() { + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + + const isReExport = _isExportFrom2.default.call(void 0, this.tokens); + + const exportStatements = []; + while (true) { + if (this.tokens.matches1(_types.TokenType.braceR)) { + this.tokens.removeToken(); + break; + } + + const specifierInfo = _getImportExportSpecifierInfo2.default.call(void 0, this.tokens); + + while (this.tokens.currentIndex() < specifierInfo.endIndex) { + this.tokens.removeToken(); + } + + const shouldRemoveExport = + specifierInfo.isType || + (!isReExport && this.shouldElideExportedIdentifier(specifierInfo.leftName)); + if (!shouldRemoveExport) { + const exportedName = specifierInfo.rightName; + if (exportedName === "default") { + this.hadDefaultExport = true; + } else { + this.hadNamedExport = true; + } + const localName = specifierInfo.leftName; + const newLocalName = this.importProcessor.getIdentifierReplacement(localName); + exportStatements.push(`exports.${exportedName} = ${newLocalName || localName};`); + } + + if (this.tokens.matches1(_types.TokenType.braceR)) { + this.tokens.removeToken(); + break; + } + if (this.tokens.matches2(_types.TokenType.comma, _types.TokenType.braceR)) { + this.tokens.removeToken(); + this.tokens.removeToken(); + break; + } else if (this.tokens.matches1(_types.TokenType.comma)) { + this.tokens.removeToken(); + } else { + throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`); + } + } + + if (this.tokens.matchesContextual(_keywords.ContextualKeyword._from)) { + // This is an export...from, so throw away the normal named export code + // and use the Object.defineProperty code from ImportProcessor. + this.tokens.removeToken(); + const path = this.tokens.stringValue(); + this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path)); + _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens); + } else { + // This is a normal named export, so use that. + this.tokens.appendCode(exportStatements.join(" ")); + } + + if (this.tokens.matches1(_types.TokenType.semi)) { + this.tokens.removeToken(); + } + } + + processExportStar() { + this.tokens.removeInitialToken(); + while (!this.tokens.matches1(_types.TokenType.string)) { + this.tokens.removeToken(); + } + const path = this.tokens.stringValue(); + this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path)); + _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens); + if (this.tokens.matches1(_types.TokenType.semi)) { + this.tokens.removeToken(); + } + } + + shouldElideExportedIdentifier(name) { + return ( + this.isTypeScriptTransformEnabled && + !this.keepUnusedImports && + !this.declarationInfo.valueDeclarations.has(name) + ); + } +} exports.default = CJSImportTransformer; diff --git a/node_modules/sucrase/dist/transformers/ESMImportTransformer.js b/node_modules/sucrase/dist/transformers/ESMImportTransformer.js new file mode 100644 index 00000000..d89e5ea3 --- /dev/null +++ b/node_modules/sucrase/dist/transformers/ESMImportTransformer.js @@ -0,0 +1,415 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + +var _keywords = require('../parser/tokenizer/keywords'); +var _types = require('../parser/tokenizer/types'); + +var _elideImportEquals = require('../util/elideImportEquals'); var _elideImportEquals2 = _interopRequireDefault(_elideImportEquals); + + + +var _getDeclarationInfo = require('../util/getDeclarationInfo'); var _getDeclarationInfo2 = _interopRequireDefault(_getDeclarationInfo); +var _getImportExportSpecifierInfo = require('../util/getImportExportSpecifierInfo'); var _getImportExportSpecifierInfo2 = _interopRequireDefault(_getImportExportSpecifierInfo); +var _getNonTypeIdentifiers = require('../util/getNonTypeIdentifiers'); +var _isExportFrom = require('../util/isExportFrom'); var _isExportFrom2 = _interopRequireDefault(_isExportFrom); +var _removeMaybeImportAttributes = require('../util/removeMaybeImportAttributes'); +var _shouldElideDefaultExport = require('../util/shouldElideDefaultExport'); var _shouldElideDefaultExport2 = _interopRequireDefault(_shouldElideDefaultExport); + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + +/** + * Class for editing import statements when we are keeping the code as ESM. We still need to remove + * type-only imports in TypeScript and Flow. + */ + class ESMImportTransformer extends _Transformer2.default { + + + + + constructor( + tokens, + nameManager, + helperManager, + reactHotLoaderTransformer, + isTypeScriptTransformEnabled, + isFlowTransformEnabled, + keepUnusedImports, + options, + ) { + super();this.tokens = tokens;this.nameManager = nameManager;this.helperManager = helperManager;this.reactHotLoaderTransformer = reactHotLoaderTransformer;this.isTypeScriptTransformEnabled = isTypeScriptTransformEnabled;this.isFlowTransformEnabled = isFlowTransformEnabled;this.keepUnusedImports = keepUnusedImports;; + this.nonTypeIdentifiers = + isTypeScriptTransformEnabled && !keepUnusedImports + ? _getNonTypeIdentifiers.getNonTypeIdentifiers.call(void 0, tokens, options) + : new Set(); + this.declarationInfo = + isTypeScriptTransformEnabled && !keepUnusedImports + ? _getDeclarationInfo2.default.call(void 0, tokens) + : _getDeclarationInfo.EMPTY_DECLARATION_INFO; + this.injectCreateRequireForImportRequire = Boolean(options.injectCreateRequireForImportRequire); + } + + process() { + // TypeScript `import foo = require('foo');` should always just be translated to plain require. + if (this.tokens.matches3(_types.TokenType._import, _types.TokenType.name, _types.TokenType.eq)) { + return this.processImportEquals(); + } + if ( + this.tokens.matches4(_types.TokenType._import, _types.TokenType.name, _types.TokenType.name, _types.TokenType.eq) && + this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, _keywords.ContextualKeyword._type) + ) { + // import type T = require('T') + this.tokens.removeInitialToken(); + // This construct is always exactly 8 tokens long, so remove the 7 remaining tokens. + for (let i = 0; i < 7; i++) { + this.tokens.removeToken(); + } + return true; + } + if (this.tokens.matches2(_types.TokenType._export, _types.TokenType.eq)) { + this.tokens.replaceToken("module.exports"); + return true; + } + if ( + this.tokens.matches5(_types.TokenType._export, _types.TokenType._import, _types.TokenType.name, _types.TokenType.name, _types.TokenType.eq) && + this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 2, _keywords.ContextualKeyword._type) + ) { + // export import type T = require('T') + this.tokens.removeInitialToken(); + // This construct is always exactly 9 tokens long, so remove the 8 remaining tokens. + for (let i = 0; i < 8; i++) { + this.tokens.removeToken(); + } + return true; + } + if (this.tokens.matches1(_types.TokenType._import)) { + return this.processImport(); + } + if (this.tokens.matches2(_types.TokenType._export, _types.TokenType._default)) { + return this.processExportDefault(); + } + if (this.tokens.matches2(_types.TokenType._export, _types.TokenType.braceL)) { + return this.processNamedExports(); + } + if ( + this.tokens.matches2(_types.TokenType._export, _types.TokenType.name) && + this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, _keywords.ContextualKeyword._type) + ) { + // export type {a}; + // export type {a as b}; + // export type {a} from './b'; + // export type * from './b'; + // export type * as ns from './b'; + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + if (this.tokens.matches1(_types.TokenType.braceL)) { + while (!this.tokens.matches1(_types.TokenType.braceR)) { + this.tokens.removeToken(); + } + this.tokens.removeToken(); + } else { + // * + this.tokens.removeToken(); + if (this.tokens.matches1(_types.TokenType._as)) { + // as + this.tokens.removeToken(); + // ns + this.tokens.removeToken(); + } + } + // Remove type re-export `... } from './T'` + if ( + this.tokens.matchesContextual(_keywords.ContextualKeyword._from) && + this.tokens.matches1AtIndex(this.tokens.currentIndex() + 1, _types.TokenType.string) + ) { + this.tokens.removeToken(); + this.tokens.removeToken(); + _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens); + } + return true; + } + return false; + } + + processImportEquals() { + const importName = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1); + if (this.shouldAutomaticallyElideImportedName(importName)) { + // If this name is only used as a type, elide the whole import. + _elideImportEquals2.default.call(void 0, this.tokens); + } else if (this.injectCreateRequireForImportRequire) { + // We're using require in an environment (Node ESM) that doesn't provide + // it as a global, so generate a helper to import it. + // import -> const + this.tokens.replaceToken("const"); + // Foo + this.tokens.copyToken(); + // = + this.tokens.copyToken(); + // require + this.tokens.replaceToken(this.helperManager.getHelperName("require")); + } else { + // Otherwise, just switch `import` to `const`. + this.tokens.replaceToken("const"); + } + return true; + } + + processImport() { + if (this.tokens.matches2(_types.TokenType._import, _types.TokenType.parenL)) { + // Dynamic imports don't need to be transformed. + return false; + } + + const snapshot = this.tokens.snapshot(); + const allImportsRemoved = this.removeImportTypeBindings(); + if (allImportsRemoved) { + this.tokens.restoreToSnapshot(snapshot); + while (!this.tokens.matches1(_types.TokenType.string)) { + this.tokens.removeToken(); + } + this.tokens.removeToken(); + _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens); + if (this.tokens.matches1(_types.TokenType.semi)) { + this.tokens.removeToken(); + } + } + return true; + } + + /** + * Remove type bindings from this import, leaving the rest of the import intact. + * + * Return true if this import was ONLY types, and thus is eligible for removal. This will bail out + * of the replacement operation, so we can return early here. + */ + removeImportTypeBindings() { + this.tokens.copyExpectedToken(_types.TokenType._import); + if ( + this.tokens.matchesContextual(_keywords.ContextualKeyword._type) && + !this.tokens.matches1AtIndex(this.tokens.currentIndex() + 1, _types.TokenType.comma) && + !this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 1, _keywords.ContextualKeyword._from) + ) { + // This is an "import type" statement, so exit early. + return true; + } + + if (this.tokens.matches1(_types.TokenType.string)) { + // This is a bare import, so we should proceed with the import. + this.tokens.copyToken(); + return false; + } + + // Skip the "module" token in import reflection. + if ( + this.tokens.matchesContextual(_keywords.ContextualKeyword._module) && + this.tokens.matchesContextualAtIndex(this.tokens.currentIndex() + 2, _keywords.ContextualKeyword._from) + ) { + this.tokens.copyToken(); + } + + let foundNonTypeImport = false; + let foundAnyNamedImport = false; + let needsComma = false; + + // Handle default import. + if (this.tokens.matches1(_types.TokenType.name)) { + if (this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())) { + this.tokens.removeToken(); + if (this.tokens.matches1(_types.TokenType.comma)) { + this.tokens.removeToken(); + } + } else { + foundNonTypeImport = true; + this.tokens.copyToken(); + if (this.tokens.matches1(_types.TokenType.comma)) { + // We're in a statement like: + // import A, * as B from './A'; + // or + // import A, {foo} from './A'; + // where the `A` is being kept. The comma should be removed if an only + // if the next part of the import statement is elided, but that's hard + // to determine at this point in the code. Instead, always remove it + // and set a flag to add it back if necessary. + needsComma = true; + this.tokens.removeToken(); + } + } + } + + if (this.tokens.matches1(_types.TokenType.star)) { + if (this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))) { + this.tokens.removeToken(); + this.tokens.removeToken(); + this.tokens.removeToken(); + } else { + if (needsComma) { + this.tokens.appendCode(","); + } + foundNonTypeImport = true; + this.tokens.copyExpectedToken(_types.TokenType.star); + this.tokens.copyExpectedToken(_types.TokenType.name); + this.tokens.copyExpectedToken(_types.TokenType.name); + } + } else if (this.tokens.matches1(_types.TokenType.braceL)) { + if (needsComma) { + this.tokens.appendCode(","); + } + this.tokens.copyToken(); + while (!this.tokens.matches1(_types.TokenType.braceR)) { + foundAnyNamedImport = true; + const specifierInfo = _getImportExportSpecifierInfo2.default.call(void 0, this.tokens); + if ( + specifierInfo.isType || + this.shouldAutomaticallyElideImportedName(specifierInfo.rightName) + ) { + while (this.tokens.currentIndex() < specifierInfo.endIndex) { + this.tokens.removeToken(); + } + if (this.tokens.matches1(_types.TokenType.comma)) { + this.tokens.removeToken(); + } + } else { + foundNonTypeImport = true; + while (this.tokens.currentIndex() < specifierInfo.endIndex) { + this.tokens.copyToken(); + } + if (this.tokens.matches1(_types.TokenType.comma)) { + this.tokens.copyToken(); + } + } + } + this.tokens.copyExpectedToken(_types.TokenType.braceR); + } + + if (this.keepUnusedImports) { + return false; + } + if (this.isTypeScriptTransformEnabled) { + return !foundNonTypeImport; + } else if (this.isFlowTransformEnabled) { + // In Flow, unlike TS, `import {} from 'foo';` preserves the import. + return foundAnyNamedImport && !foundNonTypeImport; + } else { + return false; + } + } + + shouldAutomaticallyElideImportedName(name) { + return ( + this.isTypeScriptTransformEnabled && + !this.keepUnusedImports && + !this.nonTypeIdentifiers.has(name) + ); + } + + processExportDefault() { + if ( + _shouldElideDefaultExport2.default.call(void 0, + this.isTypeScriptTransformEnabled, + this.keepUnusedImports, + this.tokens, + this.declarationInfo, + ) + ) { + // If the exported value is just an identifier and should be elided by TypeScript + // rules, then remove it entirely. It will always have the form `export default e`, + // where `e` is an identifier. + this.tokens.removeInitialToken(); + this.tokens.removeToken(); + this.tokens.removeToken(); + return true; + } + + const alreadyHasName = + this.tokens.matches4(_types.TokenType._export, _types.TokenType._default, _types.TokenType._function, _types.TokenType.name) || + // export default async function + (this.tokens.matches5(_types.TokenType._export, _types.TokenType._default, _types.TokenType.name, _types.TokenType._function, _types.TokenType.name) && + this.tokens.matchesContextualAtIndex( + this.tokens.currentIndex() + 2, + _keywords.ContextualKeyword._async, + )) || + this.tokens.matches4(_types.TokenType._export, _types.TokenType._default, _types.TokenType._class, _types.TokenType.name) || + this.tokens.matches5(_types.TokenType._export, _types.TokenType._default, _types.TokenType._abstract, _types.TokenType._class, _types.TokenType.name); + + if (!alreadyHasName && this.reactHotLoaderTransformer) { + // This is a plain "export default E" statement and we need to assign E to a variable. + // Change "export default E" to "let _default; export default _default = E" + const defaultVarName = this.nameManager.claimFreeName("_default"); + this.tokens.replaceToken(`let ${defaultVarName}; export`); + this.tokens.copyToken(); + this.tokens.appendCode(` ${defaultVarName} =`); + this.reactHotLoaderTransformer.setExtractedDefaultExportName(defaultVarName); + return true; + } + return false; + } + + /** + * Handle a statement with one of these forms: + * export {a, type b}; + * export {c, type d} from 'foo'; + * + * In both cases, any explicit type exports should be removed. In the first + * case, we also need to handle implicit export elision for names declared as + * types. In the second case, we must NOT do implicit named export elision, + * but we must remove the runtime import if all exports are type exports. + */ + processNamedExports() { + if (!this.isTypeScriptTransformEnabled) { + return false; + } + this.tokens.copyExpectedToken(_types.TokenType._export); + this.tokens.copyExpectedToken(_types.TokenType.braceL); + + const isReExport = _isExportFrom2.default.call(void 0, this.tokens); + let foundNonTypeExport = false; + while (!this.tokens.matches1(_types.TokenType.braceR)) { + const specifierInfo = _getImportExportSpecifierInfo2.default.call(void 0, this.tokens); + if ( + specifierInfo.isType || + (!isReExport && this.shouldElideExportedName(specifierInfo.leftName)) + ) { + // Type export, so remove all tokens, including any comma. + while (this.tokens.currentIndex() < specifierInfo.endIndex) { + this.tokens.removeToken(); + } + if (this.tokens.matches1(_types.TokenType.comma)) { + this.tokens.removeToken(); + } + } else { + // Non-type export, so copy all tokens, including any comma. + foundNonTypeExport = true; + while (this.tokens.currentIndex() < specifierInfo.endIndex) { + this.tokens.copyToken(); + } + if (this.tokens.matches1(_types.TokenType.comma)) { + this.tokens.copyToken(); + } + } + } + this.tokens.copyExpectedToken(_types.TokenType.braceR); + + if (!this.keepUnusedImports && isReExport && !foundNonTypeExport) { + // This is a type-only re-export, so skip evaluating the other module. Technically this + // leaves the statement as `export {}`, but that's ok since that's a no-op. + this.tokens.removeToken(); + this.tokens.removeToken(); + _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens); + } + + return true; + } + + /** + * ESM elides all imports with the rule that we only elide if we see that it's + * a type and never see it as a value. This is in contrast to CJS, which + * elides imports that are completely unknown. + */ + shouldElideExportedName(name) { + return ( + this.isTypeScriptTransformEnabled && + !this.keepUnusedImports && + this.declarationInfo.typeDeclarations.has(name) && + !this.declarationInfo.valueDeclarations.has(name) + ); + } +} exports.default = ESMImportTransformer; diff --git a/node_modules/sucrase/dist/transformers/FlowTransformer.js b/node_modules/sucrase/dist/transformers/FlowTransformer.js new file mode 100644 index 00000000..31c97441 --- /dev/null +++ b/node_modules/sucrase/dist/transformers/FlowTransformer.js @@ -0,0 +1,182 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _keywords = require('../parser/tokenizer/keywords'); +var _types = require('../parser/tokenizer/types'); + + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + + class FlowTransformer extends _Transformer2.default { + constructor( + rootTransformer, + tokens, + isImportsTransformEnabled, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.isImportsTransformEnabled = isImportsTransformEnabled;; + } + + process() { + if ( + this.rootTransformer.processPossibleArrowParamEnd() || + this.rootTransformer.processPossibleAsyncArrowWithTypeParams() || + this.rootTransformer.processPossibleTypeRange() + ) { + return true; + } + if (this.tokens.matches1(_types.TokenType._enum)) { + this.processEnum(); + return true; + } + if (this.tokens.matches2(_types.TokenType._export, _types.TokenType._enum)) { + this.processNamedExportEnum(); + return true; + } + if (this.tokens.matches3(_types.TokenType._export, _types.TokenType._default, _types.TokenType._enum)) { + this.processDefaultExportEnum(); + return true; + } + return false; + } + + /** + * Handle a declaration like: + * export enum E ... + * + * With this imports transform, this becomes: + * const E = [[enum]]; exports.E = E; + * + * otherwise, it becomes: + * export const E = [[enum]]; + */ + processNamedExportEnum() { + if (this.isImportsTransformEnabled) { + // export + this.tokens.removeInitialToken(); + const enumName = this.tokens.identifierNameAtRelativeIndex(1); + this.processEnum(); + this.tokens.appendCode(` exports.${enumName} = ${enumName};`); + } else { + this.tokens.copyToken(); + this.processEnum(); + } + } + + /** + * Handle a declaration like: + * export default enum E + * + * With the imports transform, this becomes: + * const E = [[enum]]; exports.default = E; + * + * otherwise, it becomes: + * const E = [[enum]]; export default E; + */ + processDefaultExportEnum() { + // export + this.tokens.removeInitialToken(); + // default + this.tokens.removeToken(); + const enumName = this.tokens.identifierNameAtRelativeIndex(1); + this.processEnum(); + if (this.isImportsTransformEnabled) { + this.tokens.appendCode(` exports.default = ${enumName};`); + } else { + this.tokens.appendCode(` export default ${enumName};`); + } + } + + /** + * Transpile flow enums to invoke the "flow-enums-runtime" library. + * + * Currently, the transpiled code always uses `require("flow-enums-runtime")`, + * but if future flexibility is needed, we could expose a config option for + * this string (similar to configurable JSX). Even when targeting ESM, the + * default behavior of babel-plugin-transform-flow-enums is to use require + * rather than injecting an import. + * + * Flow enums are quite a bit simpler than TS enums and have some convenient + * constraints: + * - Element initializers must be either always present or always absent. That + * means that we can use fixed lookahead on the first element (if any) and + * assume that all elements are like that. + * - The right-hand side of an element initializer must be a literal value, + * not a complex expression and not referencing other elements. That means + * we can simply copy a single token. + * + * Enums can be broken up into three basic cases: + * + * Mirrored enums: + * enum E {A, B} + * -> + * const E = require("flow-enums-runtime").Mirrored(["A", "B"]); + * + * Initializer enums: + * enum E {A = 1, B = 2} + * -> + * const E = require("flow-enums-runtime")({A: 1, B: 2}); + * + * Symbol enums: + * enum E of symbol {A, B} + * -> + * const E = require("flow-enums-runtime")({A: Symbol("A"), B: Symbol("B")}); + * + * We can statically detect which of the three cases this is by looking at the + * "of" declaration (if any) and seeing if the first element has an initializer. + * Since the other transform details are so similar between the three cases, we + * use a single implementation and vary the transform within processEnumElement + * based on case. + */ + processEnum() { + // enum E -> const E + this.tokens.replaceToken("const"); + this.tokens.copyExpectedToken(_types.TokenType.name); + + let isSymbolEnum = false; + if (this.tokens.matchesContextual(_keywords.ContextualKeyword._of)) { + this.tokens.removeToken(); + isSymbolEnum = this.tokens.matchesContextual(_keywords.ContextualKeyword._symbol); + this.tokens.removeToken(); + } + const hasInitializers = this.tokens.matches3(_types.TokenType.braceL, _types.TokenType.name, _types.TokenType.eq); + this.tokens.appendCode(' = require("flow-enums-runtime")'); + + const isMirrored = !isSymbolEnum && !hasInitializers; + this.tokens.replaceTokenTrimmingLeftWhitespace(isMirrored ? ".Mirrored([" : "({"); + + while (!this.tokens.matches1(_types.TokenType.braceR)) { + // ... is allowed at the end and has no runtime behavior. + if (this.tokens.matches1(_types.TokenType.ellipsis)) { + this.tokens.removeToken(); + break; + } + this.processEnumElement(isSymbolEnum, hasInitializers); + if (this.tokens.matches1(_types.TokenType.comma)) { + this.tokens.copyToken(); + } + } + + this.tokens.replaceToken(isMirrored ? "]);" : "});"); + } + + /** + * Process an individual enum element, producing either an array element or an + * object element based on what type of enum this is. + */ + processEnumElement(isSymbolEnum, hasInitializers) { + if (isSymbolEnum) { + // Symbol enums never have initializers and are expanded to object elements. + // A, -> A: Symbol("A"), + const elementName = this.tokens.identifierName(); + this.tokens.copyToken(); + this.tokens.appendCode(`: Symbol("${elementName}")`); + } else if (hasInitializers) { + // Initializers are expanded to object elements. + // A = 1, -> A: 1, + this.tokens.copyToken(); + this.tokens.replaceTokenTrimmingLeftWhitespace(":"); + this.tokens.copyToken(); + } else { + // Enum elements without initializers become string literal array elements. + // A, -> "A", + this.tokens.replaceToken(`"${this.tokens.identifierName()}"`); + } + } +} exports.default = FlowTransformer; diff --git a/node_modules/sucrase/dist/transformers/JSXTransformer.js b/node_modules/sucrase/dist/transformers/JSXTransformer.js new file mode 100644 index 00000000..df51be3d --- /dev/null +++ b/node_modules/sucrase/dist/transformers/JSXTransformer.js @@ -0,0 +1,733 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + +var _xhtml = require('../parser/plugins/jsx/xhtml'); var _xhtml2 = _interopRequireDefault(_xhtml); +var _tokenizer = require('../parser/tokenizer'); +var _types = require('../parser/tokenizer/types'); +var _charcodes = require('../parser/util/charcodes'); + +var _getJSXPragmaInfo = require('../util/getJSXPragmaInfo'); var _getJSXPragmaInfo2 = _interopRequireDefault(_getJSXPragmaInfo); + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + + class JSXTransformer extends _Transformer2.default { + + + + + // State for calculating the line number of each JSX tag in development. + __init() {this.lastLineNumber = 1} + __init2() {this.lastIndex = 0} + + // In development, variable name holding the name of the current file. + __init3() {this.filenameVarName = null} + // Mapping of claimed names for imports in the automatic transform, e,g. + // {jsx: "_jsx"}. This determines which imports to generate in the prefix. + __init4() {this.esmAutomaticImportNameResolutions = {}} + // When automatically adding imports in CJS mode, we store the variable name + // holding the imported CJS module so we can require it in the prefix. + __init5() {this.cjsAutomaticModuleNameResolutions = {}} + + constructor( + rootTransformer, + tokens, + importProcessor, + nameManager, + options, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.importProcessor = importProcessor;this.nameManager = nameManager;this.options = options;JSXTransformer.prototype.__init.call(this);JSXTransformer.prototype.__init2.call(this);JSXTransformer.prototype.__init3.call(this);JSXTransformer.prototype.__init4.call(this);JSXTransformer.prototype.__init5.call(this);; + this.jsxPragmaInfo = _getJSXPragmaInfo2.default.call(void 0, options); + this.isAutomaticRuntime = options.jsxRuntime === "automatic"; + this.jsxImportSource = options.jsxImportSource || "react"; + } + + process() { + if (this.tokens.matches1(_types.TokenType.jsxTagStart)) { + this.processJSXTag(); + return true; + } + return false; + } + + getPrefixCode() { + let prefix = ""; + if (this.filenameVarName) { + prefix += `const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath || "")};`; + } + if (this.isAutomaticRuntime) { + if (this.importProcessor) { + // CJS mode: emit require statements for all modules that were referenced. + for (const [path, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) { + prefix += `var ${resolvedName} = require("${path}");`; + } + } else { + // ESM mode: consolidate and emit import statements for referenced names. + const {createElement: createElementResolution, ...otherResolutions} = + this.esmAutomaticImportNameResolutions; + if (createElementResolution) { + prefix += `import {createElement as ${createElementResolution}} from "${this.jsxImportSource}";`; + } + const importSpecifiers = Object.entries(otherResolutions) + .map(([name, resolvedName]) => `${name} as ${resolvedName}`) + .join(", "); + if (importSpecifiers) { + const importPath = + this.jsxImportSource + (this.options.production ? "/jsx-runtime" : "/jsx-dev-runtime"); + prefix += `import {${importSpecifiers}} from "${importPath}";`; + } + } + } + return prefix; + } + + processJSXTag() { + const {jsxRole, start} = this.tokens.currentToken(); + // Calculate line number information at the very start (if in development + // mode) so that the information is guaranteed to be queried in token order. + const elementLocationCode = this.options.production ? null : this.getElementLocationCode(start); + if (this.isAutomaticRuntime && jsxRole !== _tokenizer.JSXRole.KeyAfterPropSpread) { + this.transformTagToJSXFunc(elementLocationCode, jsxRole); + } else { + this.transformTagToCreateElement(elementLocationCode); + } + } + + getElementLocationCode(firstTokenStart) { + const lineNumber = this.getLineNumberForIndex(firstTokenStart); + return `lineNumber: ${lineNumber}`; + } + + /** + * Get the line number for this source position. This is calculated lazily and + * must be called in increasing order by index. + */ + getLineNumberForIndex(index) { + const code = this.tokens.code; + while (this.lastIndex < index && this.lastIndex < code.length) { + if (code[this.lastIndex] === "\n") { + this.lastLineNumber++; + } + this.lastIndex++; + } + return this.lastLineNumber; + } + + /** + * Convert the current JSX element to a call to jsx, jsxs, or jsxDEV. This is + * the primary transformation for the automatic transform. + * + * Example: + *
    Hello{x}
    + * becomes + * jsxs('div', {a: 1, children: ["Hello", x]}, 2) + */ + transformTagToJSXFunc(elementLocationCode, jsxRole) { + const isStatic = jsxRole === _tokenizer.JSXRole.StaticChildren; + // First tag is always jsxTagStart. + this.tokens.replaceToken(this.getJSXFuncInvocationCode(isStatic)); + + let keyCode = null; + if (this.tokens.matches1(_types.TokenType.jsxTagEnd)) { + // Fragment syntax. + this.tokens.replaceToken(`${this.getFragmentCode()}, {`); + this.processAutomaticChildrenAndEndProps(jsxRole); + } else { + // Normal open tag or self-closing tag. + this.processTagIntro(); + this.tokens.appendCode(", {"); + keyCode = this.processProps(true); + + if (this.tokens.matches2(_types.TokenType.slash, _types.TokenType.jsxTagEnd)) { + // Self-closing tag, no children to add, so close the props. + this.tokens.appendCode("}"); + } else if (this.tokens.matches1(_types.TokenType.jsxTagEnd)) { + // Tag with children. + this.tokens.removeToken(); + this.processAutomaticChildrenAndEndProps(jsxRole); + } else { + throw new Error("Expected either /> or > at the end of the tag."); + } + // If a key was present, move it to its own arg. Note that moving code + // like this will cause line numbers to get out of sync within the JSX + // element if the key expression has a newline in it. This is unfortunate, + // but hopefully should be rare. + if (keyCode) { + this.tokens.appendCode(`, ${keyCode}`); + } + } + if (!this.options.production) { + // If the key wasn't already added, add it now so we can correctly set + // positional args for jsxDEV. + if (keyCode === null) { + this.tokens.appendCode(", void 0"); + } + this.tokens.appendCode(`, ${isStatic}, ${this.getDevSource(elementLocationCode)}, this`); + } + // We're at the close-tag or the end of a self-closing tag, so remove + // everything else and close the function call. + this.tokens.removeInitialToken(); + while (!this.tokens.matches1(_types.TokenType.jsxTagEnd)) { + this.tokens.removeToken(); + } + this.tokens.replaceToken(")"); + } + + /** + * Convert the current JSX element to a createElement call. In the classic + * runtime, this is the only case. In the automatic runtime, this is called + * as a fallback in some situations. + * + * Example: + *
    Hello{x}
    + * becomes + * React.createElement('div', {a: 1, key: 2}, "Hello", x) + */ + transformTagToCreateElement(elementLocationCode) { + // First tag is always jsxTagStart. + this.tokens.replaceToken(this.getCreateElementInvocationCode()); + + if (this.tokens.matches1(_types.TokenType.jsxTagEnd)) { + // Fragment syntax. + this.tokens.replaceToken(`${this.getFragmentCode()}, null`); + this.processChildren(true); + } else { + // Normal open tag or self-closing tag. + this.processTagIntro(); + this.processPropsObjectWithDevInfo(elementLocationCode); + + if (this.tokens.matches2(_types.TokenType.slash, _types.TokenType.jsxTagEnd)) { + // Self-closing tag; no children to process. + } else if (this.tokens.matches1(_types.TokenType.jsxTagEnd)) { + // Tag with children and a close-tag; process the children as args. + this.tokens.removeToken(); + this.processChildren(true); + } else { + throw new Error("Expected either /> or > at the end of the tag."); + } + } + // We're at the close-tag or the end of a self-closing tag, so remove + // everything else and close the function call. + this.tokens.removeInitialToken(); + while (!this.tokens.matches1(_types.TokenType.jsxTagEnd)) { + this.tokens.removeToken(); + } + this.tokens.replaceToken(")"); + } + + /** + * Get the code for the relevant function for this context: jsx, jsxs, + * or jsxDEV. The following open-paren is included as well. + * + * These functions are only used for the automatic runtime, so they are always + * auto-imported, but the auto-import will be either CJS or ESM based on the + * target module format. + */ + getJSXFuncInvocationCode(isStatic) { + if (this.options.production) { + if (isStatic) { + return this.claimAutoImportedFuncInvocation("jsxs", "/jsx-runtime"); + } else { + return this.claimAutoImportedFuncInvocation("jsx", "/jsx-runtime"); + } + } else { + return this.claimAutoImportedFuncInvocation("jsxDEV", "/jsx-dev-runtime"); + } + } + + /** + * Return the code to use for the createElement function, e.g. + * `React.createElement`, including the following open-paren. + * + * This is the main function to use for the classic runtime. For the + * automatic runtime, this function is used as a fallback function to + * preserve behavior when there is a prop spread followed by an explicit + * key. In that automatic runtime case, the function should be automatically + * imported. + */ + getCreateElementInvocationCode() { + if (this.isAutomaticRuntime) { + return this.claimAutoImportedFuncInvocation("createElement", ""); + } else { + const {jsxPragmaInfo} = this; + const resolvedPragmaBaseName = this.importProcessor + ? this.importProcessor.getIdentifierReplacement(jsxPragmaInfo.base) || jsxPragmaInfo.base + : jsxPragmaInfo.base; + return `${resolvedPragmaBaseName}${jsxPragmaInfo.suffix}(`; + } + } + + /** + * Return the code to use as the component when compiling a shorthand + * fragment, e.g. `React.Fragment`. + * + * This may be called from either the classic or automatic runtime, and + * the value should be auto-imported for the automatic runtime. + */ + getFragmentCode() { + if (this.isAutomaticRuntime) { + return this.claimAutoImportedName( + "Fragment", + this.options.production ? "/jsx-runtime" : "/jsx-dev-runtime", + ); + } else { + const {jsxPragmaInfo} = this; + const resolvedFragmentPragmaBaseName = this.importProcessor + ? this.importProcessor.getIdentifierReplacement(jsxPragmaInfo.fragmentBase) || + jsxPragmaInfo.fragmentBase + : jsxPragmaInfo.fragmentBase; + return resolvedFragmentPragmaBaseName + jsxPragmaInfo.fragmentSuffix; + } + } + + /** + * Return code that invokes the given function. + * + * When the imports transform is enabled, use the CJSImportTransformer + * strategy of using `.call(void 0, ...` to avoid passing a `this` value in a + * situation that would otherwise look like a method call. + */ + claimAutoImportedFuncInvocation(funcName, importPathSuffix) { + const funcCode = this.claimAutoImportedName(funcName, importPathSuffix); + if (this.importProcessor) { + return `${funcCode}.call(void 0, `; + } else { + return `${funcCode}(`; + } + } + + claimAutoImportedName(funcName, importPathSuffix) { + if (this.importProcessor) { + // CJS mode: claim a name for the module and mark it for import. + const path = this.jsxImportSource + importPathSuffix; + if (!this.cjsAutomaticModuleNameResolutions[path]) { + this.cjsAutomaticModuleNameResolutions[path] = + this.importProcessor.getFreeIdentifierForPath(path); + } + return `${this.cjsAutomaticModuleNameResolutions[path]}.${funcName}`; + } else { + // ESM mode: claim a name for this function and add it to the names that + // should be auto-imported when the prefix is generated. + if (!this.esmAutomaticImportNameResolutions[funcName]) { + this.esmAutomaticImportNameResolutions[funcName] = this.nameManager.claimFreeName( + `_${funcName}`, + ); + } + return this.esmAutomaticImportNameResolutions[funcName]; + } + } + + /** + * Process the first part of a tag, before any props. + */ + processTagIntro() { + // Walk forward until we see one of these patterns: + // jsxName to start the first prop, preceded by another jsxName to end the tag name. + // jsxName to start the first prop, preceded by greaterThan to end the type argument. + // [open brace] to start the first prop. + // [jsxTagEnd] to end the open-tag. + // [slash, jsxTagEnd] to end the self-closing tag. + let introEnd = this.tokens.currentIndex() + 1; + while ( + this.tokens.tokens[introEnd].isType || + (!this.tokens.matches2AtIndex(introEnd - 1, _types.TokenType.jsxName, _types.TokenType.jsxName) && + !this.tokens.matches2AtIndex(introEnd - 1, _types.TokenType.greaterThan, _types.TokenType.jsxName) && + !this.tokens.matches1AtIndex(introEnd, _types.TokenType.braceL) && + !this.tokens.matches1AtIndex(introEnd, _types.TokenType.jsxTagEnd) && + !this.tokens.matches2AtIndex(introEnd, _types.TokenType.slash, _types.TokenType.jsxTagEnd)) + ) { + introEnd++; + } + if (introEnd === this.tokens.currentIndex() + 1) { + const tagName = this.tokens.identifierName(); + if (startsWithLowerCase(tagName)) { + this.tokens.replaceToken(`'${tagName}'`); + } + } + while (this.tokens.currentIndex() < introEnd) { + this.rootTransformer.processToken(); + } + } + + /** + * Starting at the beginning of the props, add the props argument to + * React.createElement, including the comma before it. + */ + processPropsObjectWithDevInfo(elementLocationCode) { + const devProps = this.options.production + ? "" + : `__self: this, __source: ${this.getDevSource(elementLocationCode)}`; + if (!this.tokens.matches1(_types.TokenType.jsxName) && !this.tokens.matches1(_types.TokenType.braceL)) { + if (devProps) { + this.tokens.appendCode(`, {${devProps}}`); + } else { + this.tokens.appendCode(`, null`); + } + return; + } + this.tokens.appendCode(`, {`); + this.processProps(false); + if (devProps) { + this.tokens.appendCode(` ${devProps}}`); + } else { + this.tokens.appendCode("}"); + } + } + + /** + * Transform the core part of the props, assuming that a { has already been + * inserted before us and that a } will be inserted after us. + * + * If extractKeyCode is true (i.e. when using any jsx... function), any prop + * named "key" has its code captured and returned rather than being emitted to + * the output code. This shifts line numbers, and emitting the code later will + * correct line numbers again. If no key is found or if extractKeyCode is + * false, this function returns null. + */ + processProps(extractKeyCode) { + let keyCode = null; + while (true) { + if (this.tokens.matches2(_types.TokenType.jsxName, _types.TokenType.eq)) { + // This is a regular key={value} or key="value" prop. + const propName = this.tokens.identifierName(); + if (extractKeyCode && propName === "key") { + if (keyCode !== null) { + // The props list has multiple keys. Different implementations are + // inconsistent about what to do here: as of this writing, Babel and + // swc keep the *last* key and completely remove the rest, while + // TypeScript uses the *first* key and leaves the others as regular + // props. The React team collaborated with Babel on the + // implementation of this behavior, so presumably the Babel behavior + // is the one to use. + // Since we won't ever be emitting the previous key code, we need to + // at least emit its newlines here so that the line numbers match up + // in the long run. + this.tokens.appendCode(keyCode.replace(/[^\n]/g, "")); + } + // key + this.tokens.removeToken(); + // = + this.tokens.removeToken(); + const snapshot = this.tokens.snapshot(); + this.processPropValue(); + keyCode = this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(snapshot); + // Don't add a comma + continue; + } else { + this.processPropName(propName); + this.tokens.replaceToken(": "); + this.processPropValue(); + } + } else if (this.tokens.matches1(_types.TokenType.jsxName)) { + // This is a shorthand prop like . + const propName = this.tokens.identifierName(); + this.processPropName(propName); + this.tokens.appendCode(": true"); + } else if (this.tokens.matches1(_types.TokenType.braceL)) { + // This is prop spread, like
    , which we can pass + // through fairly directly as an object spread. + this.tokens.replaceToken(""); + this.rootTransformer.processBalancedCode(); + this.tokens.replaceToken(""); + } else { + break; + } + this.tokens.appendCode(","); + } + return keyCode; + } + + processPropName(propName) { + if (propName.includes("-")) { + this.tokens.replaceToken(`'${propName}'`); + } else { + this.tokens.copyToken(); + } + } + + processPropValue() { + if (this.tokens.matches1(_types.TokenType.braceL)) { + this.tokens.replaceToken(""); + this.rootTransformer.processBalancedCode(); + this.tokens.replaceToken(""); + } else if (this.tokens.matches1(_types.TokenType.jsxTagStart)) { + this.processJSXTag(); + } else { + this.processStringPropValue(); + } + } + + processStringPropValue() { + const token = this.tokens.currentToken(); + const valueCode = this.tokens.code.slice(token.start + 1, token.end - 1); + const replacementCode = formatJSXTextReplacement(valueCode); + const literalCode = formatJSXStringValueLiteral(valueCode); + this.tokens.replaceToken(literalCode + replacementCode); + } + + /** + * Starting in the middle of the props object literal, produce an additional + * prop for the children and close the object literal. + */ + processAutomaticChildrenAndEndProps(jsxRole) { + if (jsxRole === _tokenizer.JSXRole.StaticChildren) { + this.tokens.appendCode(" children: ["); + this.processChildren(false); + this.tokens.appendCode("]}"); + } else { + // The parser information tells us whether we will see a real child or if + // all remaining children (if any) will resolve to empty. If there are no + // non-empty children, don't emit a children prop at all, but still + // process children so that we properly transform the code into nothing. + if (jsxRole === _tokenizer.JSXRole.OneChild) { + this.tokens.appendCode(" children: "); + } + this.processChildren(false); + this.tokens.appendCode("}"); + } + } + + /** + * Transform children into a comma-separated list, which will be either + * arguments to createElement or array elements of a children prop. + */ + processChildren(needsInitialComma) { + let needsComma = needsInitialComma; + while (true) { + if (this.tokens.matches2(_types.TokenType.jsxTagStart, _types.TokenType.slash)) { + // Closing tag, so no more children. + return; + } + let didEmitElement = false; + if (this.tokens.matches1(_types.TokenType.braceL)) { + if (this.tokens.matches2(_types.TokenType.braceL, _types.TokenType.braceR)) { + // Empty interpolations and comment-only interpolations are allowed + // and don't create an extra child arg. + this.tokens.replaceToken(""); + this.tokens.replaceToken(""); + } else { + // Interpolated expression. + this.tokens.replaceToken(needsComma ? ", " : ""); + this.rootTransformer.processBalancedCode(); + this.tokens.replaceToken(""); + didEmitElement = true; + } + } else if (this.tokens.matches1(_types.TokenType.jsxTagStart)) { + // Child JSX element + this.tokens.appendCode(needsComma ? ", " : ""); + this.processJSXTag(); + didEmitElement = true; + } else if (this.tokens.matches1(_types.TokenType.jsxText) || this.tokens.matches1(_types.TokenType.jsxEmptyText)) { + didEmitElement = this.processChildTextElement(needsComma); + } else { + throw new Error("Unexpected token when processing JSX children."); + } + if (didEmitElement) { + needsComma = true; + } + } + } + + /** + * Turn a JSX text element into a string literal, or nothing at all if the JSX + * text resolves to the empty string. + * + * Returns true if a string literal is emitted, false otherwise. + */ + processChildTextElement(needsComma) { + const token = this.tokens.currentToken(); + const valueCode = this.tokens.code.slice(token.start, token.end); + const replacementCode = formatJSXTextReplacement(valueCode); + const literalCode = formatJSXTextLiteral(valueCode); + if (literalCode === '""') { + this.tokens.replaceToken(replacementCode); + return false; + } else { + this.tokens.replaceToken(`${needsComma ? ", " : ""}${literalCode}${replacementCode}`); + return true; + } + } + + getDevSource(elementLocationCode) { + return `{fileName: ${this.getFilenameVarName()}, ${elementLocationCode}}`; + } + + getFilenameVarName() { + if (!this.filenameVarName) { + this.filenameVarName = this.nameManager.claimFreeName("_jsxFileName"); + } + return this.filenameVarName; + } +} exports.default = JSXTransformer; + +/** + * Spec for identifiers: https://tc39.github.io/ecma262/#prod-IdentifierStart. + * + * Really only treat anything starting with a-z as tag names. `_`, `$`, `é` + * should be treated as component names + */ + function startsWithLowerCase(s) { + const firstChar = s.charCodeAt(0); + return firstChar >= _charcodes.charCodes.lowercaseA && firstChar <= _charcodes.charCodes.lowercaseZ; +} exports.startsWithLowerCase = startsWithLowerCase; + +/** + * Turn the given jsxText string into a JS string literal. Leading and trailing + * whitespace on lines is removed, except immediately after the open-tag and + * before the close-tag. Empty lines are completely removed, and spaces are + * added between lines after that. + * + * We use JSON.stringify to introduce escape characters as necessary, and trim + * the start and end of each line and remove blank lines. + */ +function formatJSXTextLiteral(text) { + let result = ""; + let whitespace = ""; + + let isInInitialLineWhitespace = false; + let seenNonWhitespace = false; + for (let i = 0; i < text.length; i++) { + const c = text[i]; + if (c === " " || c === "\t" || c === "\r") { + if (!isInInitialLineWhitespace) { + whitespace += c; + } + } else if (c === "\n") { + whitespace = ""; + isInInitialLineWhitespace = true; + } else { + if (seenNonWhitespace && isInInitialLineWhitespace) { + result += " "; + } + result += whitespace; + whitespace = ""; + if (c === "&") { + const {entity, newI} = processEntity(text, i + 1); + i = newI - 1; + result += entity; + } else { + result += c; + } + seenNonWhitespace = true; + isInInitialLineWhitespace = false; + } + } + if (!isInInitialLineWhitespace) { + result += whitespace; + } + return JSON.stringify(result); +} + +/** + * Produce the code that should be printed after the JSX text string literal, + * with most content removed, but all newlines preserved and all spacing at the + * end preserved. + */ +function formatJSXTextReplacement(text) { + let numNewlines = 0; + let numSpaces = 0; + for (const c of text) { + if (c === "\n") { + numNewlines++; + numSpaces = 0; + } else if (c === " ") { + numSpaces++; + } + } + return "\n".repeat(numNewlines) + " ".repeat(numSpaces); +} + +/** + * Format a string in the value position of a JSX prop. + * + * Use the same implementation as convertAttribute from + * babel-helper-builder-react-jsx. + */ +function formatJSXStringValueLiteral(text) { + let result = ""; + for (let i = 0; i < text.length; i++) { + const c = text[i]; + if (c === "\n") { + if (/\s/.test(text[i + 1])) { + result += " "; + while (i < text.length && /\s/.test(text[i + 1])) { + i++; + } + } else { + result += "\n"; + } + } else if (c === "&") { + const {entity, newI} = processEntity(text, i + 1); + result += entity; + i = newI - 1; + } else { + result += c; + } + } + return JSON.stringify(result); +} + +/** + * Starting at a &, see if there's an HTML entity (specified by name, decimal + * char code, or hex char code) and return it if so. + * + * Modified from jsxReadString in babel-parser. + */ +function processEntity(text, indexAfterAmpersand) { + let str = ""; + let count = 0; + let entity; + let i = indexAfterAmpersand; + + if (text[i] === "#") { + let radix = 10; + i++; + let numStart; + if (text[i] === "x") { + radix = 16; + i++; + numStart = i; + while (i < text.length && isHexDigit(text.charCodeAt(i))) { + i++; + } + } else { + numStart = i; + while (i < text.length && isDecimalDigit(text.charCodeAt(i))) { + i++; + } + } + if (text[i] === ";") { + const numStr = text.slice(numStart, i); + if (numStr) { + i++; + entity = String.fromCodePoint(parseInt(numStr, radix)); + } + } + } else { + while (i < text.length && count++ < 10) { + const ch = text[i]; + i++; + if (ch === ";") { + entity = _xhtml2.default.get(str); + break; + } + str += ch; + } + } + + if (!entity) { + return {entity: "&", newI: indexAfterAmpersand}; + } + return {entity, newI: i}; +} + +function isDecimalDigit(code) { + return code >= _charcodes.charCodes.digit0 && code <= _charcodes.charCodes.digit9; +} + +function isHexDigit(code) { + return ( + (code >= _charcodes.charCodes.digit0 && code <= _charcodes.charCodes.digit9) || + (code >= _charcodes.charCodes.lowercaseA && code <= _charcodes.charCodes.lowercaseF) || + (code >= _charcodes.charCodes.uppercaseA && code <= _charcodes.charCodes.uppercaseF) + ); +} diff --git a/node_modules/sucrase/dist/transformers/JestHoistTransformer.js b/node_modules/sucrase/dist/transformers/JestHoistTransformer.js new file mode 100644 index 00000000..fb7f0fd2 --- /dev/null +++ b/node_modules/sucrase/dist/transformers/JestHoistTransformer.js @@ -0,0 +1,111 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } + +var _types = require('../parser/tokenizer/types'); + + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + +const JEST_GLOBAL_NAME = "jest"; +const HOISTED_METHODS = ["mock", "unmock", "enableAutomock", "disableAutomock"]; + +/** + * Implementation of babel-plugin-jest-hoist, which hoists up some jest method + * calls above the imports to allow them to override other imports. + * + * To preserve line numbers, rather than directly moving the jest.mock code, we + * wrap each invocation in a function statement and then call the function from + * the top of the file. + */ + class JestHoistTransformer extends _Transformer2.default { + __init() {this.hoistedFunctionNames = []} + + constructor( + rootTransformer, + tokens, + nameManager, + importProcessor, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.nameManager = nameManager;this.importProcessor = importProcessor;JestHoistTransformer.prototype.__init.call(this);; + } + + process() { + if ( + this.tokens.currentToken().scopeDepth === 0 && + this.tokens.matches4(_types.TokenType.name, _types.TokenType.dot, _types.TokenType.name, _types.TokenType.parenL) && + this.tokens.identifierName() === JEST_GLOBAL_NAME + ) { + // TODO: This only works if imports transform is active, which it will be for jest. + // But if jest adds module support and we no longer need the import transform, this needs fixing. + if (_optionalChain([this, 'access', _ => _.importProcessor, 'optionalAccess', _2 => _2.getGlobalNames, 'call', _3 => _3(), 'optionalAccess', _4 => _4.has, 'call', _5 => _5(JEST_GLOBAL_NAME)])) { + return false; + } + return this.extractHoistedCalls(); + } + + return false; + } + + getHoistedCode() { + if (this.hoistedFunctionNames.length > 0) { + // This will be placed before module interop code, but that's fine since + // imports aren't allowed in module mock factories. + return this.hoistedFunctionNames.map((name) => `${name}();`).join(""); + } + return ""; + } + + /** + * Extracts any methods calls on the jest-object that should be hoisted. + * + * According to the jest docs, https://jestjs.io/docs/en/jest-object#jestmockmodulename-factory-options, + * mock, unmock, enableAutomock, disableAutomock, are the methods that should be hoisted. + * + * We do not apply the same checks of the arguments as babel-plugin-jest-hoist does. + */ + extractHoistedCalls() { + // We're handling a chain of calls where `jest` may or may not need to be inserted for each call + // in the chain, so remove the initial `jest` to make the loop implementation cleaner. + this.tokens.removeToken(); + // Track some state so that multiple non-hoisted chained calls in a row keep their chaining + // syntax. + let followsNonHoistedJestCall = false; + + // Iterate through all chained calls on the jest object. + while (this.tokens.matches3(_types.TokenType.dot, _types.TokenType.name, _types.TokenType.parenL)) { + const methodName = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1); + const shouldHoist = HOISTED_METHODS.includes(methodName); + if (shouldHoist) { + // We've matched e.g. `.mock(...)` or similar call. + // Replace the initial `.` with `function __jestHoist(){jest.` + const hoistedFunctionName = this.nameManager.claimFreeName("__jestHoist"); + this.hoistedFunctionNames.push(hoistedFunctionName); + this.tokens.replaceToken(`function ${hoistedFunctionName}(){${JEST_GLOBAL_NAME}.`); + this.tokens.copyToken(); + this.tokens.copyToken(); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(_types.TokenType.parenR); + this.tokens.appendCode(";}"); + followsNonHoistedJestCall = false; + } else { + // This is a non-hoisted method, so just transform the code as usual. + if (followsNonHoistedJestCall) { + // If we didn't hoist the previous call, we can leave the code as-is to chain off of the + // previous method call. It's important to preserve the code here because we don't know + // for sure that the method actually returned the jest object for chaining. + this.tokens.copyToken(); + } else { + // If we hoisted the previous call, we know it returns the jest object back, so we insert + // the identifier `jest` to continue the chain. + this.tokens.replaceToken(`${JEST_GLOBAL_NAME}.`); + } + this.tokens.copyToken(); + this.tokens.copyToken(); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(_types.TokenType.parenR); + followsNonHoistedJestCall = true; + } + } + + return true; + } +} exports.default = JestHoistTransformer; diff --git a/node_modules/sucrase/dist/transformers/NumericSeparatorTransformer.js b/node_modules/sucrase/dist/transformers/NumericSeparatorTransformer.js new file mode 100644 index 00000000..7a30f09d --- /dev/null +++ b/node_modules/sucrase/dist/transformers/NumericSeparatorTransformer.js @@ -0,0 +1,20 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _types = require('../parser/tokenizer/types'); + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + + class NumericSeparatorTransformer extends _Transformer2.default { + constructor( tokens) { + super();this.tokens = tokens;; + } + + process() { + if (this.tokens.matches1(_types.TokenType.num)) { + const code = this.tokens.currentTokenCode(); + if (code.includes("_")) { + this.tokens.replaceToken(code.replace(/_/g, "")); + return true; + } + } + return false; + } +} exports.default = NumericSeparatorTransformer; diff --git a/node_modules/sucrase/dist/transformers/OptionalCatchBindingTransformer.js b/node_modules/sucrase/dist/transformers/OptionalCatchBindingTransformer.js new file mode 100644 index 00000000..79ae8bc5 --- /dev/null +++ b/node_modules/sucrase/dist/transformers/OptionalCatchBindingTransformer.js @@ -0,0 +1,19 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _types = require('../parser/tokenizer/types'); + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + + class OptionalCatchBindingTransformer extends _Transformer2.default { + constructor( tokens, nameManager) { + super();this.tokens = tokens;this.nameManager = nameManager;; + } + + process() { + if (this.tokens.matches2(_types.TokenType._catch, _types.TokenType.braceL)) { + this.tokens.copyToken(); + this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`); + return true; + } + return false; + } +} exports.default = OptionalCatchBindingTransformer; diff --git a/node_modules/sucrase/dist/transformers/OptionalChainingNullishTransformer.js b/node_modules/sucrase/dist/transformers/OptionalChainingNullishTransformer.js new file mode 100644 index 00000000..3a68a0ab --- /dev/null +++ b/node_modules/sucrase/dist/transformers/OptionalChainingNullishTransformer.js @@ -0,0 +1,155 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _types = require('../parser/tokenizer/types'); + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + +/** + * Transformer supporting the optional chaining and nullish coalescing operators. + * + * Tech plan here: + * https://github.com/alangpierce/sucrase/wiki/Sucrase-Optional-Chaining-and-Nullish-Coalescing-Technical-Plan + * + * The prefix and suffix code snippets are handled by TokenProcessor, and this transformer handles + * the operators themselves. + */ + class OptionalChainingNullishTransformer extends _Transformer2.default { + constructor( tokens, nameManager) { + super();this.tokens = tokens;this.nameManager = nameManager;; + } + + process() { + if (this.tokens.matches1(_types.TokenType.nullishCoalescing)) { + const token = this.tokens.currentToken(); + if (this.tokens.tokens[token.nullishStartIndex].isAsyncOperation) { + this.tokens.replaceTokenTrimmingLeftWhitespace(", async () => ("); + } else { + this.tokens.replaceTokenTrimmingLeftWhitespace(", () => ("); + } + return true; + } + if (this.tokens.matches1(_types.TokenType._delete)) { + const nextToken = this.tokens.tokenAtRelativeIndex(1); + if (nextToken.isOptionalChainStart) { + this.tokens.removeInitialToken(); + return true; + } + } + const token = this.tokens.currentToken(); + const chainStart = token.subscriptStartIndex; + if ( + chainStart != null && + this.tokens.tokens[chainStart].isOptionalChainStart && + // Super subscripts can't be optional (since super is never null/undefined), and the syntax + // relies on the subscript being intact, so leave this token alone. + this.tokens.tokenAtRelativeIndex(-1).type !== _types.TokenType._super + ) { + const param = this.nameManager.claimFreeName("_"); + let arrowStartSnippet; + if ( + chainStart > 0 && + this.tokens.matches1AtIndex(chainStart - 1, _types.TokenType._delete) && + this.isLastSubscriptInChain() + ) { + // Delete operations are special: we already removed the delete keyword, and to still + // perform a delete, we need to insert a delete in the very last part of the chain, which + // in correct code will always be a property access. + arrowStartSnippet = `${param} => delete ${param}`; + } else { + arrowStartSnippet = `${param} => ${param}`; + } + if (this.tokens.tokens[chainStart].isAsyncOperation) { + arrowStartSnippet = `async ${arrowStartSnippet}`; + } + if ( + this.tokens.matches2(_types.TokenType.questionDot, _types.TokenType.parenL) || + this.tokens.matches2(_types.TokenType.questionDot, _types.TokenType.lessThan) + ) { + if (this.justSkippedSuper()) { + this.tokens.appendCode(".bind(this)"); + } + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${arrowStartSnippet}`); + } else if (this.tokens.matches2(_types.TokenType.questionDot, _types.TokenType.bracketL)) { + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${arrowStartSnippet}`); + } else if (this.tokens.matches1(_types.TokenType.questionDot)) { + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${arrowStartSnippet}.`); + } else if (this.tokens.matches1(_types.TokenType.dot)) { + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${arrowStartSnippet}.`); + } else if (this.tokens.matches1(_types.TokenType.bracketL)) { + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${arrowStartSnippet}[`); + } else if (this.tokens.matches1(_types.TokenType.parenL)) { + if (this.justSkippedSuper()) { + this.tokens.appendCode(".bind(this)"); + } + this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${arrowStartSnippet}(`); + } else { + throw new Error("Unexpected subscript operator in optional chain."); + } + return true; + } + return false; + } + + /** + * Determine if the current token is the last of its chain, so that we know whether it's eligible + * to have a delete op inserted. + * + * We can do this by walking forward until we determine one way or another. Each + * isOptionalChainStart token must be paired with exactly one isOptionalChainEnd token after it in + * a nesting way, so we can track depth and walk to the end of the chain (the point where the + * depth goes negative) and see if any other subscript token is after us in the chain. + */ + isLastSubscriptInChain() { + let depth = 0; + for (let i = this.tokens.currentIndex() + 1; ; i++) { + if (i >= this.tokens.tokens.length) { + throw new Error("Reached the end of the code while finding the end of the access chain."); + } + if (this.tokens.tokens[i].isOptionalChainStart) { + depth++; + } else if (this.tokens.tokens[i].isOptionalChainEnd) { + depth--; + } + if (depth < 0) { + return true; + } + + // This subscript token is a later one in the same chain. + if (depth === 0 && this.tokens.tokens[i].subscriptStartIndex != null) { + return false; + } + } + } + + /** + * Determine if we are the open-paren in an expression like super.a()?.b. + * + * We can do this by walking backward to find the previous subscript. If that subscript was + * preceded by a super, then we must be the subscript after it, so if this is a call expression, + * we'll need to attach the right context. + */ + justSkippedSuper() { + let depth = 0; + let index = this.tokens.currentIndex() - 1; + while (true) { + if (index < 0) { + throw new Error( + "Reached the start of the code while finding the start of the access chain.", + ); + } + if (this.tokens.tokens[index].isOptionalChainStart) { + depth--; + } else if (this.tokens.tokens[index].isOptionalChainEnd) { + depth++; + } + if (depth < 0) { + return false; + } + + // This subscript token is a later one in the same chain. + if (depth === 0 && this.tokens.tokens[index].subscriptStartIndex != null) { + return this.tokens.tokens[index - 1].type === _types.TokenType._super; + } + index--; + } + } +} exports.default = OptionalChainingNullishTransformer; diff --git a/node_modules/sucrase/dist/transformers/ReactDisplayNameTransformer.js b/node_modules/sucrase/dist/transformers/ReactDisplayNameTransformer.js new file mode 100644 index 00000000..faf6f652 --- /dev/null +++ b/node_modules/sucrase/dist/transformers/ReactDisplayNameTransformer.js @@ -0,0 +1,160 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var _tokenizer = require('../parser/tokenizer'); +var _types = require('../parser/tokenizer/types'); + + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + +/** + * Implementation of babel-plugin-transform-react-display-name, which adds a + * display name to usages of React.createClass and createReactClass. + */ + class ReactDisplayNameTransformer extends _Transformer2.default { + constructor( + rootTransformer, + tokens, + importProcessor, + options, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.importProcessor = importProcessor;this.options = options;; + } + + process() { + const startIndex = this.tokens.currentIndex(); + if (this.tokens.identifierName() === "createReactClass") { + const newName = + this.importProcessor && this.importProcessor.getIdentifierReplacement("createReactClass"); + if (newName) { + this.tokens.replaceToken(`(0, ${newName})`); + } else { + this.tokens.copyToken(); + } + this.tryProcessCreateClassCall(startIndex); + return true; + } + if ( + this.tokens.matches3(_types.TokenType.name, _types.TokenType.dot, _types.TokenType.name) && + this.tokens.identifierName() === "React" && + this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 2) === "createClass" + ) { + const newName = this.importProcessor + ? this.importProcessor.getIdentifierReplacement("React") || "React" + : "React"; + if (newName) { + this.tokens.replaceToken(newName); + this.tokens.copyToken(); + this.tokens.copyToken(); + } else { + this.tokens.copyToken(); + this.tokens.copyToken(); + this.tokens.copyToken(); + } + this.tryProcessCreateClassCall(startIndex); + return true; + } + return false; + } + + /** + * This is called with the token position at the open-paren. + */ + tryProcessCreateClassCall(startIndex) { + const displayName = this.findDisplayName(startIndex); + if (!displayName) { + return; + } + + if (this.classNeedsDisplayName()) { + this.tokens.copyExpectedToken(_types.TokenType.parenL); + this.tokens.copyExpectedToken(_types.TokenType.braceL); + this.tokens.appendCode(`displayName: '${displayName}',`); + this.rootTransformer.processBalancedCode(); + this.tokens.copyExpectedToken(_types.TokenType.braceR); + this.tokens.copyExpectedToken(_types.TokenType.parenR); + } + } + + findDisplayName(startIndex) { + if (startIndex < 2) { + return null; + } + if (this.tokens.matches2AtIndex(startIndex - 2, _types.TokenType.name, _types.TokenType.eq)) { + // This is an assignment (or declaration) and the LHS is either an identifier or a member + // expression ending in an identifier, so use that identifier name. + return this.tokens.identifierNameAtIndex(startIndex - 2); + } + if ( + startIndex >= 2 && + this.tokens.tokens[startIndex - 2].identifierRole === _tokenizer.IdentifierRole.ObjectKey + ) { + // This is an object literal value. + return this.tokens.identifierNameAtIndex(startIndex - 2); + } + if (this.tokens.matches2AtIndex(startIndex - 2, _types.TokenType._export, _types.TokenType._default)) { + return this.getDisplayNameFromFilename(); + } + return null; + } + + getDisplayNameFromFilename() { + const filePath = this.options.filePath || "unknown"; + const pathSegments = filePath.split("/"); + const filename = pathSegments[pathSegments.length - 1]; + const dotIndex = filename.lastIndexOf("."); + const baseFilename = dotIndex === -1 ? filename : filename.slice(0, dotIndex); + if (baseFilename === "index" && pathSegments[pathSegments.length - 2]) { + return pathSegments[pathSegments.length - 2]; + } else { + return baseFilename; + } + } + + /** + * We only want to add a display name when this is a function call containing + * one argument, which is an object literal without `displayName` as an + * existing key. + */ + classNeedsDisplayName() { + let index = this.tokens.currentIndex(); + if (!this.tokens.matches2(_types.TokenType.parenL, _types.TokenType.braceL)) { + return false; + } + // The block starts on the {, and we expect any displayName key to be in + // that context. We need to ignore other other contexts to avoid matching + // nested displayName keys. + const objectStartIndex = index + 1; + const objectContextId = this.tokens.tokens[objectStartIndex].contextId; + if (objectContextId == null) { + throw new Error("Expected non-null context ID on object open-brace."); + } + + for (; index < this.tokens.tokens.length; index++) { + const token = this.tokens.tokens[index]; + if (token.type === _types.TokenType.braceR && token.contextId === objectContextId) { + index++; + break; + } + + if ( + this.tokens.identifierNameAtIndex(index) === "displayName" && + this.tokens.tokens[index].identifierRole === _tokenizer.IdentifierRole.ObjectKey && + token.contextId === objectContextId + ) { + // We found a displayName key, so bail out. + return false; + } + } + + if (index === this.tokens.tokens.length) { + throw new Error("Unexpected end of input when processing React class."); + } + + // If we got this far, we know we have createClass with an object with no + // display name, so we want to proceed as long as that was the only argument. + return ( + this.tokens.matches1AtIndex(index, _types.TokenType.parenR) || + this.tokens.matches2AtIndex(index, _types.TokenType.comma, _types.TokenType.parenR) + ); + } +} exports.default = ReactDisplayNameTransformer; diff --git a/node_modules/sucrase/dist/transformers/ReactHotLoaderTransformer.js b/node_modules/sucrase/dist/transformers/ReactHotLoaderTransformer.js new file mode 100644 index 00000000..3657c493 --- /dev/null +++ b/node_modules/sucrase/dist/transformers/ReactHotLoaderTransformer.js @@ -0,0 +1,69 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _tokenizer = require('../parser/tokenizer'); + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + + class ReactHotLoaderTransformer extends _Transformer2.default { + __init() {this.extractedDefaultExportName = null} + + constructor( tokens, filePath) { + super();this.tokens = tokens;this.filePath = filePath;ReactHotLoaderTransformer.prototype.__init.call(this);; + } + + setExtractedDefaultExportName(extractedDefaultExportName) { + this.extractedDefaultExportName = extractedDefaultExportName; + } + + getPrefixCode() { + return ` + (function () { + var enterModule = require('react-hot-loader').enterModule; + enterModule && enterModule(module); + })();` + .replace(/\s+/g, " ") + .trim(); + } + + getSuffixCode() { + const topLevelNames = new Set(); + for (const token of this.tokens.tokens) { + if ( + !token.isType && + _tokenizer.isTopLevelDeclaration.call(void 0, token) && + token.identifierRole !== _tokenizer.IdentifierRole.ImportDeclaration + ) { + topLevelNames.add(this.tokens.identifierNameForToken(token)); + } + } + const namesToRegister = Array.from(topLevelNames).map((name) => ({ + variableName: name, + uniqueLocalName: name, + })); + if (this.extractedDefaultExportName) { + namesToRegister.push({ + variableName: this.extractedDefaultExportName, + uniqueLocalName: "default", + }); + } + return ` +;(function () { + var reactHotLoader = require('react-hot-loader').default; + var leaveModule = require('react-hot-loader').leaveModule; + if (!reactHotLoader) { + return; + } +${namesToRegister + .map( + ({variableName, uniqueLocalName}) => + ` reactHotLoader.register(${variableName}, "${uniqueLocalName}", ${JSON.stringify( + this.filePath || "", + )});`, + ) + .join("\n")} + leaveModule(module); +})();`; + } + + process() { + return false; + } +} exports.default = ReactHotLoaderTransformer; diff --git a/node_modules/sucrase/dist/transformers/RootTransformer.js b/node_modules/sucrase/dist/transformers/RootTransformer.js new file mode 100644 index 00000000..70b33c88 --- /dev/null +++ b/node_modules/sucrase/dist/transformers/RootTransformer.js @@ -0,0 +1,462 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + +var _keywords = require('../parser/tokenizer/keywords'); +var _types = require('../parser/tokenizer/types'); + +var _getClassInfo = require('../util/getClassInfo'); var _getClassInfo2 = _interopRequireDefault(_getClassInfo); +var _CJSImportTransformer = require('./CJSImportTransformer'); var _CJSImportTransformer2 = _interopRequireDefault(_CJSImportTransformer); +var _ESMImportTransformer = require('./ESMImportTransformer'); var _ESMImportTransformer2 = _interopRequireDefault(_ESMImportTransformer); +var _FlowTransformer = require('./FlowTransformer'); var _FlowTransformer2 = _interopRequireDefault(_FlowTransformer); +var _JestHoistTransformer = require('./JestHoistTransformer'); var _JestHoistTransformer2 = _interopRequireDefault(_JestHoistTransformer); +var _JSXTransformer = require('./JSXTransformer'); var _JSXTransformer2 = _interopRequireDefault(_JSXTransformer); +var _NumericSeparatorTransformer = require('./NumericSeparatorTransformer'); var _NumericSeparatorTransformer2 = _interopRequireDefault(_NumericSeparatorTransformer); +var _OptionalCatchBindingTransformer = require('./OptionalCatchBindingTransformer'); var _OptionalCatchBindingTransformer2 = _interopRequireDefault(_OptionalCatchBindingTransformer); +var _OptionalChainingNullishTransformer = require('./OptionalChainingNullishTransformer'); var _OptionalChainingNullishTransformer2 = _interopRequireDefault(_OptionalChainingNullishTransformer); +var _ReactDisplayNameTransformer = require('./ReactDisplayNameTransformer'); var _ReactDisplayNameTransformer2 = _interopRequireDefault(_ReactDisplayNameTransformer); +var _ReactHotLoaderTransformer = require('./ReactHotLoaderTransformer'); var _ReactHotLoaderTransformer2 = _interopRequireDefault(_ReactHotLoaderTransformer); + +var _TypeScriptTransformer = require('./TypeScriptTransformer'); var _TypeScriptTransformer2 = _interopRequireDefault(_TypeScriptTransformer); + + + + + + + + + class RootTransformer { + __init() {this.transformers = []} + + + __init2() {this.generatedVariables = []} + + + + + + constructor( + sucraseContext, + transforms, + enableLegacyBabel5ModuleInterop, + options, + ) {;RootTransformer.prototype.__init.call(this);RootTransformer.prototype.__init2.call(this); + this.nameManager = sucraseContext.nameManager; + this.helperManager = sucraseContext.helperManager; + const {tokenProcessor, importProcessor} = sucraseContext; + this.tokens = tokenProcessor; + this.isImportsTransformEnabled = transforms.includes("imports"); + this.isReactHotLoaderTransformEnabled = transforms.includes("react-hot-loader"); + this.disableESTransforms = Boolean(options.disableESTransforms); + + if (!options.disableESTransforms) { + this.transformers.push( + new (0, _OptionalChainingNullishTransformer2.default)(tokenProcessor, this.nameManager), + ); + this.transformers.push(new (0, _NumericSeparatorTransformer2.default)(tokenProcessor)); + this.transformers.push(new (0, _OptionalCatchBindingTransformer2.default)(tokenProcessor, this.nameManager)); + } + + if (transforms.includes("jsx")) { + if (options.jsxRuntime !== "preserve") { + this.transformers.push( + new (0, _JSXTransformer2.default)(this, tokenProcessor, importProcessor, this.nameManager, options), + ); + } + this.transformers.push( + new (0, _ReactDisplayNameTransformer2.default)(this, tokenProcessor, importProcessor, options), + ); + } + + let reactHotLoaderTransformer = null; + if (transforms.includes("react-hot-loader")) { + if (!options.filePath) { + throw new Error("filePath is required when using the react-hot-loader transform."); + } + reactHotLoaderTransformer = new (0, _ReactHotLoaderTransformer2.default)(tokenProcessor, options.filePath); + this.transformers.push(reactHotLoaderTransformer); + } + + // Note that we always want to enable the imports transformer, even when the import transform + // itself isn't enabled, since we need to do type-only import pruning for both Flow and + // TypeScript. + if (transforms.includes("imports")) { + if (importProcessor === null) { + throw new Error("Expected non-null importProcessor with imports transform enabled."); + } + this.transformers.push( + new (0, _CJSImportTransformer2.default)( + this, + tokenProcessor, + importProcessor, + this.nameManager, + this.helperManager, + reactHotLoaderTransformer, + enableLegacyBabel5ModuleInterop, + Boolean(options.enableLegacyTypeScriptModuleInterop), + transforms.includes("typescript"), + transforms.includes("flow"), + Boolean(options.preserveDynamicImport), + Boolean(options.keepUnusedImports), + ), + ); + } else { + this.transformers.push( + new (0, _ESMImportTransformer2.default)( + tokenProcessor, + this.nameManager, + this.helperManager, + reactHotLoaderTransformer, + transforms.includes("typescript"), + transforms.includes("flow"), + Boolean(options.keepUnusedImports), + options, + ), + ); + } + + if (transforms.includes("flow")) { + this.transformers.push( + new (0, _FlowTransformer2.default)(this, tokenProcessor, transforms.includes("imports")), + ); + } + if (transforms.includes("typescript")) { + this.transformers.push( + new (0, _TypeScriptTransformer2.default)(this, tokenProcessor, transforms.includes("imports")), + ); + } + if (transforms.includes("jest")) { + this.transformers.push( + new (0, _JestHoistTransformer2.default)(this, tokenProcessor, this.nameManager, importProcessor), + ); + } + } + + transform() { + this.tokens.reset(); + this.processBalancedCode(); + const shouldAddUseStrict = this.isImportsTransformEnabled; + // "use strict" always needs to be first, so override the normal transformer order. + let prefix = shouldAddUseStrict ? '"use strict";' : ""; + for (const transformer of this.transformers) { + prefix += transformer.getPrefixCode(); + } + prefix += this.helperManager.emitHelpers(); + prefix += this.generatedVariables.map((v) => ` var ${v};`).join(""); + for (const transformer of this.transformers) { + prefix += transformer.getHoistedCode(); + } + let suffix = ""; + for (const transformer of this.transformers) { + suffix += transformer.getSuffixCode(); + } + const result = this.tokens.finish(); + let {code} = result; + if (code.startsWith("#!")) { + let newlineIndex = code.indexOf("\n"); + if (newlineIndex === -1) { + newlineIndex = code.length; + code += "\n"; + } + return { + code: code.slice(0, newlineIndex + 1) + prefix + code.slice(newlineIndex + 1) + suffix, + // The hashbang line has no tokens, so shifting the tokens to account + // for prefix can happen normally. + mappings: this.shiftMappings(result.mappings, prefix.length), + }; + } else { + return { + code: prefix + code + suffix, + mappings: this.shiftMappings(result.mappings, prefix.length), + }; + } + } + + processBalancedCode() { + let braceDepth = 0; + let parenDepth = 0; + while (!this.tokens.isAtEnd()) { + if (this.tokens.matches1(_types.TokenType.braceL) || this.tokens.matches1(_types.TokenType.dollarBraceL)) { + braceDepth++; + } else if (this.tokens.matches1(_types.TokenType.braceR)) { + if (braceDepth === 0) { + return; + } + braceDepth--; + } + if (this.tokens.matches1(_types.TokenType.parenL)) { + parenDepth++; + } else if (this.tokens.matches1(_types.TokenType.parenR)) { + if (parenDepth === 0) { + return; + } + parenDepth--; + } + this.processToken(); + } + } + + processToken() { + if (this.tokens.matches1(_types.TokenType._class)) { + this.processClass(); + return; + } + for (const transformer of this.transformers) { + const wasProcessed = transformer.process(); + if (wasProcessed) { + return; + } + } + this.tokens.copyToken(); + } + + /** + * Skip past a class with a name and return that name. + */ + processNamedClass() { + if (!this.tokens.matches2(_types.TokenType._class, _types.TokenType.name)) { + throw new Error("Expected identifier for exported class name."); + } + const name = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1); + this.processClass(); + return name; + } + + processClass() { + const classInfo = _getClassInfo2.default.call(void 0, this, this.tokens, this.nameManager, this.disableESTransforms); + + // Both static and instance initializers need a class name to use to invoke the initializer, so + // assign to one if necessary. + const needsCommaExpression = + (classInfo.headerInfo.isExpression || !classInfo.headerInfo.className) && + classInfo.staticInitializerNames.length + classInfo.instanceInitializerNames.length > 0; + + let className = classInfo.headerInfo.className; + if (needsCommaExpression) { + className = this.nameManager.claimFreeName("_class"); + this.generatedVariables.push(className); + this.tokens.appendCode(` (${className} =`); + } + + const classToken = this.tokens.currentToken(); + const contextId = classToken.contextId; + if (contextId == null) { + throw new Error("Expected class to have a context ID."); + } + this.tokens.copyExpectedToken(_types.TokenType._class); + while (!this.tokens.matchesContextIdAndLabel(_types.TokenType.braceL, contextId)) { + this.processToken(); + } + + this.processClassBody(classInfo, className); + + const staticInitializerStatements = classInfo.staticInitializerNames.map( + (name) => `${className}.${name}()`, + ); + if (needsCommaExpression) { + this.tokens.appendCode( + `, ${staticInitializerStatements.map((s) => `${s}, `).join("")}${className})`, + ); + } else if (classInfo.staticInitializerNames.length > 0) { + this.tokens.appendCode(` ${staticInitializerStatements.map((s) => `${s};`).join(" ")}`); + } + } + + /** + * We want to just handle class fields in all contexts, since TypeScript supports them. Later, + * when some JS implementations support class fields, this should be made optional. + */ + processClassBody(classInfo, className) { + const { + headerInfo, + constructorInsertPos, + constructorInitializerStatements, + fields, + instanceInitializerNames, + rangesToRemove, + } = classInfo; + let fieldIndex = 0; + let rangeToRemoveIndex = 0; + const classContextId = this.tokens.currentToken().contextId; + if (classContextId == null) { + throw new Error("Expected non-null context ID on class."); + } + this.tokens.copyExpectedToken(_types.TokenType.braceL); + if (this.isReactHotLoaderTransformEnabled) { + this.tokens.appendCode( + "__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}", + ); + } + + const needsConstructorInit = + constructorInitializerStatements.length + instanceInitializerNames.length > 0; + + if (constructorInsertPos === null && needsConstructorInit) { + const constructorInitializersCode = this.makeConstructorInitCode( + constructorInitializerStatements, + instanceInitializerNames, + className, + ); + if (headerInfo.hasSuperclass) { + const argsName = this.nameManager.claimFreeName("args"); + this.tokens.appendCode( + `constructor(...${argsName}) { super(...${argsName}); ${constructorInitializersCode}; }`, + ); + } else { + this.tokens.appendCode(`constructor() { ${constructorInitializersCode}; }`); + } + } + + while (!this.tokens.matchesContextIdAndLabel(_types.TokenType.braceR, classContextId)) { + if (fieldIndex < fields.length && this.tokens.currentIndex() === fields[fieldIndex].start) { + let needsCloseBrace = false; + if (this.tokens.matches1(_types.TokenType.bracketL)) { + this.tokens.copyTokenWithPrefix(`${fields[fieldIndex].initializerName}() {this`); + } else if (this.tokens.matches1(_types.TokenType.string) || this.tokens.matches1(_types.TokenType.num)) { + this.tokens.copyTokenWithPrefix(`${fields[fieldIndex].initializerName}() {this[`); + needsCloseBrace = true; + } else { + this.tokens.copyTokenWithPrefix(`${fields[fieldIndex].initializerName}() {this.`); + } + while (this.tokens.currentIndex() < fields[fieldIndex].end) { + if (needsCloseBrace && this.tokens.currentIndex() === fields[fieldIndex].equalsIndex) { + this.tokens.appendCode("]"); + } + this.processToken(); + } + this.tokens.appendCode("}"); + fieldIndex++; + } else if ( + rangeToRemoveIndex < rangesToRemove.length && + this.tokens.currentIndex() >= rangesToRemove[rangeToRemoveIndex].start + ) { + if (this.tokens.currentIndex() < rangesToRemove[rangeToRemoveIndex].end) { + this.tokens.removeInitialToken(); + } + while (this.tokens.currentIndex() < rangesToRemove[rangeToRemoveIndex].end) { + this.tokens.removeToken(); + } + rangeToRemoveIndex++; + } else if (this.tokens.currentIndex() === constructorInsertPos) { + this.tokens.copyToken(); + if (needsConstructorInit) { + this.tokens.appendCode( + `;${this.makeConstructorInitCode( + constructorInitializerStatements, + instanceInitializerNames, + className, + )};`, + ); + } + this.processToken(); + } else { + this.processToken(); + } + } + this.tokens.copyExpectedToken(_types.TokenType.braceR); + } + + makeConstructorInitCode( + constructorInitializerStatements, + instanceInitializerNames, + className, + ) { + return [ + ...constructorInitializerStatements, + ...instanceInitializerNames.map((name) => `${className}.prototype.${name}.call(this)`), + ].join(";"); + } + + /** + * Normally it's ok to simply remove type tokens, but we need to be more careful when dealing with + * arrow function return types since they can confuse the parser. In that case, we want to move + * the close-paren to the same line as the arrow. + * + * See https://github.com/alangpierce/sucrase/issues/391 for more details. + */ + processPossibleArrowParamEnd() { + if (this.tokens.matches2(_types.TokenType.parenR, _types.TokenType.colon) && this.tokens.tokenAtRelativeIndex(1).isType) { + let nextNonTypeIndex = this.tokens.currentIndex() + 1; + // Look ahead to see if this is an arrow function or something else. + while (this.tokens.tokens[nextNonTypeIndex].isType) { + nextNonTypeIndex++; + } + if (this.tokens.matches1AtIndex(nextNonTypeIndex, _types.TokenType.arrow)) { + this.tokens.removeInitialToken(); + while (this.tokens.currentIndex() < nextNonTypeIndex) { + this.tokens.removeToken(); + } + this.tokens.replaceTokenTrimmingLeftWhitespace(") =>"); + return true; + } + } + return false; + } + + /** + * An async arrow function might be of the form: + * + * async < + * T + * >() => {} + * + * in which case, removing the type parameters will cause a syntax error. Detect this case and + * move the open-paren earlier. + */ + processPossibleAsyncArrowWithTypeParams() { + if ( + !this.tokens.matchesContextual(_keywords.ContextualKeyword._async) && + !this.tokens.matches1(_types.TokenType._async) + ) { + return false; + } + const nextToken = this.tokens.tokenAtRelativeIndex(1); + if (nextToken.type !== _types.TokenType.lessThan || !nextToken.isType) { + return false; + } + + let nextNonTypeIndex = this.tokens.currentIndex() + 1; + // Look ahead to see if this is an arrow function or something else. + while (this.tokens.tokens[nextNonTypeIndex].isType) { + nextNonTypeIndex++; + } + if (this.tokens.matches1AtIndex(nextNonTypeIndex, _types.TokenType.parenL)) { + this.tokens.replaceToken("async ("); + this.tokens.removeInitialToken(); + while (this.tokens.currentIndex() < nextNonTypeIndex) { + this.tokens.removeToken(); + } + this.tokens.removeToken(); + // We ate a ( token, so we need to process the tokens in between and then the ) token so that + // we remain balanced. + this.processBalancedCode(); + this.processToken(); + return true; + } + return false; + } + + processPossibleTypeRange() { + if (this.tokens.currentToken().isType) { + this.tokens.removeInitialToken(); + while (this.tokens.currentToken().isType) { + this.tokens.removeToken(); + } + return true; + } + return false; + } + + shiftMappings( + mappings, + prefixLength, + ) { + for (let i = 0; i < mappings.length; i++) { + const mapping = mappings[i]; + if (mapping !== undefined) { + mappings[i] = mapping + prefixLength; + } + } + return mappings; + } +} exports.default = RootTransformer; diff --git a/node_modules/sucrase/dist/transformers/Transformer.js b/node_modules/sucrase/dist/transformers/Transformer.js new file mode 100644 index 00000000..991d3633 --- /dev/null +++ b/node_modules/sucrase/dist/transformers/Transformer.js @@ -0,0 +1,16 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); class Transformer { + // Return true if anything was processed, false otherwise. + + + getPrefixCode() { + return ""; + } + + getHoistedCode() { + return ""; + } + + getSuffixCode() { + return ""; + } +} exports.default = Transformer; diff --git a/node_modules/sucrase/dist/transformers/TypeScriptTransformer.js b/node_modules/sucrase/dist/transformers/TypeScriptTransformer.js new file mode 100644 index 00000000..9fe5c6ec --- /dev/null +++ b/node_modules/sucrase/dist/transformers/TypeScriptTransformer.js @@ -0,0 +1,279 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _types = require('../parser/tokenizer/types'); + +var _isIdentifier = require('../util/isIdentifier'); var _isIdentifier2 = _interopRequireDefault(_isIdentifier); + +var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer); + + class TypeScriptTransformer extends _Transformer2.default { + constructor( + rootTransformer, + tokens, + isImportsTransformEnabled, + ) { + super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.isImportsTransformEnabled = isImportsTransformEnabled;; + } + + process() { + if ( + this.rootTransformer.processPossibleArrowParamEnd() || + this.rootTransformer.processPossibleAsyncArrowWithTypeParams() || + this.rootTransformer.processPossibleTypeRange() + ) { + return true; + } + if ( + this.tokens.matches1(_types.TokenType._public) || + this.tokens.matches1(_types.TokenType._protected) || + this.tokens.matches1(_types.TokenType._private) || + this.tokens.matches1(_types.TokenType._abstract) || + this.tokens.matches1(_types.TokenType._readonly) || + this.tokens.matches1(_types.TokenType._override) || + this.tokens.matches1(_types.TokenType.nonNullAssertion) + ) { + this.tokens.removeInitialToken(); + return true; + } + if (this.tokens.matches1(_types.TokenType._enum) || this.tokens.matches2(_types.TokenType._const, _types.TokenType._enum)) { + this.processEnum(); + return true; + } + if ( + this.tokens.matches2(_types.TokenType._export, _types.TokenType._enum) || + this.tokens.matches3(_types.TokenType._export, _types.TokenType._const, _types.TokenType._enum) + ) { + this.processEnum(true); + return true; + } + return false; + } + + processEnum(isExport = false) { + // We might have "export const enum", so just remove all relevant tokens. + this.tokens.removeInitialToken(); + while (this.tokens.matches1(_types.TokenType._const) || this.tokens.matches1(_types.TokenType._enum)) { + this.tokens.removeToken(); + } + const enumName = this.tokens.identifierName(); + this.tokens.removeToken(); + if (isExport && !this.isImportsTransformEnabled) { + this.tokens.appendCode("export "); + } + this.tokens.appendCode(`var ${enumName}; (function (${enumName})`); + this.tokens.copyExpectedToken(_types.TokenType.braceL); + this.processEnumBody(enumName); + this.tokens.copyExpectedToken(_types.TokenType.braceR); + if (isExport && this.isImportsTransformEnabled) { + this.tokens.appendCode(`)(${enumName} || (exports.${enumName} = ${enumName} = {}));`); + } else { + this.tokens.appendCode(`)(${enumName} || (${enumName} = {}));`); + } + } + + /** + * Transform an enum into equivalent JS. This has complexity in a few places: + * - TS allows string enums, numeric enums, and a mix of the two styles within an enum. + * - Enum keys are allowed to be referenced in later enum values. + * - Enum keys are allowed to be strings. + * - When enum values are omitted, they should follow an auto-increment behavior. + */ + processEnumBody(enumName) { + // Code that can be used to reference the previous enum member, or null if this is the first + // enum member. + let previousValueCode = null; + while (true) { + if (this.tokens.matches1(_types.TokenType.braceR)) { + break; + } + const {nameStringCode, variableName} = this.extractEnumKeyInfo(this.tokens.currentToken()); + this.tokens.removeInitialToken(); + + if ( + this.tokens.matches3(_types.TokenType.eq, _types.TokenType.string, _types.TokenType.comma) || + this.tokens.matches3(_types.TokenType.eq, _types.TokenType.string, _types.TokenType.braceR) + ) { + this.processStringLiteralEnumMember(enumName, nameStringCode, variableName); + } else if (this.tokens.matches1(_types.TokenType.eq)) { + this.processExplicitValueEnumMember(enumName, nameStringCode, variableName); + } else { + this.processImplicitValueEnumMember( + enumName, + nameStringCode, + variableName, + previousValueCode, + ); + } + if (this.tokens.matches1(_types.TokenType.comma)) { + this.tokens.removeToken(); + } + + if (variableName != null) { + previousValueCode = variableName; + } else { + previousValueCode = `${enumName}[${nameStringCode}]`; + } + } + } + + /** + * Detect name information about this enum key, which will be used to determine which code to emit + * and whether we should declare a variable as part of this declaration. + * + * Some cases to keep in mind: + * - Enum keys can be implicitly referenced later, e.g. `X = 1, Y = X`. In Sucrase, we implement + * this by declaring a variable `X` so that later expressions can use it. + * - In addition to the usual identifier key syntax, enum keys are allowed to be string literals, + * e.g. `"hello world" = 3,`. Template literal syntax is NOT allowed. + * - Even if the enum key is defined as a string literal, it may still be referenced by identifier + * later, e.g. `"X" = 1, Y = X`. That means that we need to detect whether or not a string + * literal is identifier-like and emit a variable if so, even if the declaration did not use an + * identifier. + * - Reserved keywords like `break` are valid enum keys, but are not valid to be referenced later + * and would be a syntax error if we emitted a variable, so we need to skip the variable + * declaration in those cases. + * + * The variableName return value captures these nuances: if non-null, we can and must emit a + * variable declaration, and if null, we can't and shouldn't. + */ + extractEnumKeyInfo(nameToken) { + if (nameToken.type === _types.TokenType.name) { + const name = this.tokens.identifierNameForToken(nameToken); + return { + nameStringCode: `"${name}"`, + variableName: _isIdentifier2.default.call(void 0, name) ? name : null, + }; + } else if (nameToken.type === _types.TokenType.string) { + const name = this.tokens.stringValueForToken(nameToken); + return { + nameStringCode: this.tokens.code.slice(nameToken.start, nameToken.end), + variableName: _isIdentifier2.default.call(void 0, name) ? name : null, + }; + } else { + throw new Error("Expected name or string at beginning of enum element."); + } + } + + /** + * Handle an enum member where the RHS is just a string literal (not omitted, not a number, and + * not a complex expression). This is the typical form for TS string enums, and in this case, we + * do *not* create a reverse mapping. + * + * This is called after deleting the key token, when the token processor is at the equals sign. + * + * Example 1: + * someKey = "some value" + * -> + * const someKey = "some value"; MyEnum["someKey"] = someKey; + * + * Example 2: + * "some key" = "some value" + * -> + * MyEnum["some key"] = "some value"; + */ + processStringLiteralEnumMember( + enumName, + nameStringCode, + variableName, + ) { + if (variableName != null) { + this.tokens.appendCode(`const ${variableName}`); + // = + this.tokens.copyToken(); + // value string + this.tokens.copyToken(); + this.tokens.appendCode(`; ${enumName}[${nameStringCode}] = ${variableName};`); + } else { + this.tokens.appendCode(`${enumName}[${nameStringCode}]`); + // = + this.tokens.copyToken(); + // value string + this.tokens.copyToken(); + this.tokens.appendCode(";"); + } + } + + /** + * Handle an enum member initialized with an expression on the right-hand side (other than a + * string literal). In these cases, we should transform the expression and emit code that sets up + * a reverse mapping. + * + * The TypeScript implementation of this operation distinguishes between expressions that can be + * "constant folded" at compile time (i.e. consist of number literals and simple math operations + * on those numbers) and ones that are dynamic. For constant expressions, it emits the resolved + * numeric value, and auto-incrementing is only allowed in that case. Evaluating expressions at + * compile time would add significant complexity to Sucrase, so Sucrase instead leaves the + * expression as-is, and will later emit something like `MyEnum["previousKey"] + 1` to implement + * auto-incrementing. + * + * This is called after deleting the key token, when the token processor is at the equals sign. + * + * Example 1: + * someKey = 1 + 1 + * -> + * const someKey = 1 + 1; MyEnum[MyEnum["someKey"] = someKey] = "someKey"; + * + * Example 2: + * "some key" = 1 + 1 + * -> + * MyEnum[MyEnum["some key"] = 1 + 1] = "some key"; + */ + processExplicitValueEnumMember( + enumName, + nameStringCode, + variableName, + ) { + const rhsEndIndex = this.tokens.currentToken().rhsEndIndex; + if (rhsEndIndex == null) { + throw new Error("Expected rhsEndIndex on enum assign."); + } + + if (variableName != null) { + this.tokens.appendCode(`const ${variableName}`); + this.tokens.copyToken(); + while (this.tokens.currentIndex() < rhsEndIndex) { + this.rootTransformer.processToken(); + } + this.tokens.appendCode( + `; ${enumName}[${enumName}[${nameStringCode}] = ${variableName}] = ${nameStringCode};`, + ); + } else { + this.tokens.appendCode(`${enumName}[${enumName}[${nameStringCode}]`); + this.tokens.copyToken(); + while (this.tokens.currentIndex() < rhsEndIndex) { + this.rootTransformer.processToken(); + } + this.tokens.appendCode(`] = ${nameStringCode};`); + } + } + + /** + * Handle an enum member with no right-hand side expression. In this case, the value is the + * previous value plus 1, or 0 if there was no previous value. We should also always emit a + * reverse mapping. + * + * Example 1: + * someKey2 + * -> + * const someKey2 = someKey1 + 1; MyEnum[MyEnum["someKey2"] = someKey2] = "someKey2"; + * + * Example 2: + * "some key 2" + * -> + * MyEnum[MyEnum["some key 2"] = someKey1 + 1] = "some key 2"; + */ + processImplicitValueEnumMember( + enumName, + nameStringCode, + variableName, + previousValueCode, + ) { + let valueCode = previousValueCode != null ? `${previousValueCode} + 1` : "0"; + if (variableName != null) { + this.tokens.appendCode(`const ${variableName} = ${valueCode}; `); + valueCode = variableName; + } + this.tokens.appendCode( + `${enumName}[${enumName}[${nameStringCode}] = ${valueCode}] = ${nameStringCode};`, + ); + } +} exports.default = TypeScriptTransformer; diff --git a/node_modules/sucrase/dist/types/CJSImportProcessor.d.ts b/node_modules/sucrase/dist/types/CJSImportProcessor.d.ts new file mode 100644 index 00000000..265db0e4 --- /dev/null +++ b/node_modules/sucrase/dist/types/CJSImportProcessor.d.ts @@ -0,0 +1,67 @@ +import type { HelperManager } from "./HelperManager"; +import type { Options } from "./index"; +import type NameManager from "./NameManager"; +import type TokenProcessor from "./TokenProcessor"; +/** + * Class responsible for preprocessing and bookkeeping import and export declarations within the + * file. + * + * TypeScript uses a simpler mechanism that does not use functions like interopRequireDefault and + * interopRequireWildcard, so we also allow that mode for compatibility. + */ +export default class CJSImportProcessor { + readonly nameManager: NameManager; + readonly tokens: TokenProcessor; + readonly enableLegacyTypeScriptModuleInterop: boolean; + readonly options: Options; + readonly isTypeScriptTransformEnabled: boolean; + readonly keepUnusedImports: boolean; + readonly helperManager: HelperManager; + private nonTypeIdentifiers; + private importInfoByPath; + private importsToReplace; + private identifierReplacements; + private exportBindingsByLocalName; + constructor(nameManager: NameManager, tokens: TokenProcessor, enableLegacyTypeScriptModuleInterop: boolean, options: Options, isTypeScriptTransformEnabled: boolean, keepUnusedImports: boolean, helperManager: HelperManager); + preprocessTokens(): void; + /** + * In TypeScript, import statements that only import types should be removed. + * This includes `import {} from 'foo';`, but not `import 'foo';`. + */ + pruneTypeOnlyImports(): void; + shouldAutomaticallyElideImportedName(name: string): boolean; + private generateImportReplacements; + getFreeIdentifierForPath(path: string): string; + private preprocessImportAtIndex; + private preprocessExportAtIndex; + private preprocessVarExportAtIndex; + /** + * Walk this export statement just in case it's an export...from statement. + * If it is, combine it into the import info for that path. Otherwise, just + * bail out; it'll be handled later. + */ + private preprocessNamedExportAtIndex; + private preprocessExportStarAtIndex; + private getNamedImports; + /** + * Get a mutable import info object for this path, creating one if it doesn't + * exist yet. + */ + private getImportInfo; + private addExportBinding; + /** + * Return the code to use for the import for this path, or the empty string if + * the code has already been "claimed" by a previous import. + */ + claimImportCode(importPath: string): string; + getIdentifierReplacement(identifierName: string): string | null; + /** + * Return a string like `exports.foo = exports.bar`. + */ + resolveExportBinding(assignedName: string): string | null; + /** + * Return all imported/exported names where we might be interested in whether usages of those + * names are shadowed. + */ + getGlobalNames(): Set; +} diff --git a/node_modules/sucrase/dist/types/HelperManager.d.ts b/node_modules/sucrase/dist/types/HelperManager.d.ts new file mode 100644 index 00000000..8ec724d3 --- /dev/null +++ b/node_modules/sucrase/dist/types/HelperManager.d.ts @@ -0,0 +1,15 @@ +import type NameManager from "./NameManager"; +declare const HELPERS: { + [name: string]: string; +}; +export declare class HelperManager { + readonly nameManager: NameManager; + helperNames: { + [baseName in keyof typeof HELPERS]?: string; + }; + createRequireName: string | null; + constructor(nameManager: NameManager); + getHelperName(baseName: keyof typeof HELPERS): string; + emitHelpers(): string; +} +export {}; diff --git a/node_modules/sucrase/dist/types/NameManager.d.ts b/node_modules/sucrase/dist/types/NameManager.d.ts new file mode 100644 index 00000000..7485bf03 --- /dev/null +++ b/node_modules/sucrase/dist/types/NameManager.d.ts @@ -0,0 +1,7 @@ +import type { Token } from "./parser/tokenizer"; +export default class NameManager { + private readonly usedNames; + constructor(code: string, tokens: Array); + claimFreeName(name: string): string; + findFreeName(name: string): string; +} diff --git a/node_modules/sucrase/dist/types/Options-gen-types.d.ts b/node_modules/sucrase/dist/types/Options-gen-types.d.ts new file mode 100644 index 00000000..22996e88 --- /dev/null +++ b/node_modules/sucrase/dist/types/Options-gen-types.d.ts @@ -0,0 +1,9 @@ +/** + * This module was automatically generated by `ts-interface-builder` + */ +import * as t from "ts-interface-checker"; +export declare const Transform: t.TUnion; +export declare const SourceMapOptions: t.TIface; +export declare const Options: t.TIface; +declare const exportedTypeSuite: t.ITypeSuite; +export default exportedTypeSuite; diff --git a/node_modules/sucrase/dist/types/Options.d.ts b/node_modules/sucrase/dist/types/Options.d.ts new file mode 100644 index 00000000..c182ed98 --- /dev/null +++ b/node_modules/sucrase/dist/types/Options.d.ts @@ -0,0 +1,90 @@ +export type Transform = "jsx" | "typescript" | "flow" | "imports" | "react-hot-loader" | "jest"; +export interface SourceMapOptions { + /** + * The name to use in the "file" field of the source map. This should be the name of the compiled + * file. + */ + compiledFilename: string; +} +export interface Options { + /** + * Unordered array of transform names describing both the allowed syntax + * (where applicable) and the transformation behavior. + */ + transforms: Array; + /** + * Opts out of all ES syntax transformations: optional chaining, nullish + * coalescing, class fields, numeric separators, optional catch binding. + */ + disableESTransforms?: boolean; + /** + * Transformation mode for the JSX transform. + * - "classic" refers to the original behavior using `React.createElement`. + * - "automatic" refers to the transform behavior released with React 17, + * where the `jsx` function (or a variation) is automatically imported. + * - "preserve" leaves the JSX as-is. + * + * Default value: "classic". + */ + jsxRuntime?: "classic" | "automatic" | "preserve"; + /** + * Compile code for production use. Currently only applies to the JSX + * transform. + */ + production?: boolean; + /** + * If specified, import path prefix to use in place of "react" when compiling + * JSX with the automatic runtime. + */ + jsxImportSource?: string; + /** + * If specified, function name to use in place of React.createClass when + * compiling JSX with the classic runtime. + */ + jsxPragma?: string; + /** + * If specified, function name to use in place of React.Fragment when + * compiling JSX with the classic runtime. + */ + jsxFragmentPragma?: string; + /** + * If specified, disable automatic removal of type-only import and export + * statements and names. Only statements and names that explicitly use the + * `type` keyword are removed. + */ + keepUnusedImports?: boolean; + /** + * If specified, the imports transform does not attempt to change dynamic + * import() expressions into require() calls. + */ + preserveDynamicImport?: boolean; + /** + * Only relevant when targeting ESM (i.e. when the imports transform is *not* + * specified). This flag changes the behavior of TS require imports: + * + * import Foo = require("foo"); + * + * to import createRequire, create a require function, and use that function. + * This is the TS behavior with module: nodenext and makes it easier for the + * same code to target ESM and CJS. + */ + injectCreateRequireForImportRequire?: boolean; + /** + * If true, replicate the import behavior of TypeScript's esModuleInterop: false. + */ + enableLegacyTypeScriptModuleInterop?: boolean; + /** + * If true, replicate the import behavior Babel 5 and babel-plugin-add-module-exports. + */ + enableLegacyBabel5ModuleInterop?: boolean; + /** + * If specified, we also return a RawSourceMap object alongside the code. + * filePath must be specified if this option is enabled. + */ + sourceMapOptions?: SourceMapOptions; + /** + * File path to use in error messages, React display names, and source maps. + */ + filePath?: string; +} +export declare function validateOptions(options: Options): void; diff --git a/node_modules/sucrase/dist/types/TokenProcessor.d.ts b/node_modules/sucrase/dist/types/TokenProcessor.d.ts new file mode 100644 index 00000000..9492aed5 --- /dev/null +++ b/node_modules/sucrase/dist/types/TokenProcessor.d.ts @@ -0,0 +1,87 @@ +import type { HelperManager } from "./HelperManager"; +import type { Token } from "./parser/tokenizer"; +import type { ContextualKeyword } from "./parser/tokenizer/keywords"; +import { type TokenType } from "./parser/tokenizer/types"; +export interface TokenProcessorSnapshot { + resultCode: string; + tokenIndex: number; +} +export interface TokenProcessorResult { + code: string; + mappings: Array; +} +export default class TokenProcessor { + readonly code: string; + readonly tokens: Array; + readonly isFlowEnabled: boolean; + readonly disableESTransforms: boolean; + readonly helperManager: HelperManager; + private resultCode; + private resultMappings; + private tokenIndex; + constructor(code: string, tokens: Array, isFlowEnabled: boolean, disableESTransforms: boolean, helperManager: HelperManager); + /** + * Snapshot the token state in a way that can be restored later, useful for + * things like lookahead. + * + * resultMappings do not need to be copied since in all use cases, they will + * be overwritten anyway after restore. + */ + snapshot(): TokenProcessorSnapshot; + restoreToSnapshot(snapshot: TokenProcessorSnapshot): void; + /** + * Remove and return the code generated since the snapshot, leaving the + * current token position in-place. Unlike most TokenProcessor operations, + * this operation can result in input/output line number mismatches because + * the removed code may contain newlines, so this operation should be used + * sparingly. + */ + dangerouslyGetAndRemoveCodeSinceSnapshot(snapshot: TokenProcessorSnapshot): string; + reset(): void; + matchesContextualAtIndex(index: number, contextualKeyword: ContextualKeyword): boolean; + identifierNameAtIndex(index: number): string; + identifierNameAtRelativeIndex(relativeIndex: number): string; + identifierName(): string; + identifierNameForToken(token: Token): string; + rawCodeForToken(token: Token): string; + stringValueAtIndex(index: number): string; + stringValue(): string; + stringValueForToken(token: Token): string; + matches1AtIndex(index: number, t1: TokenType): boolean; + matches2AtIndex(index: number, t1: TokenType, t2: TokenType): boolean; + matches3AtIndex(index: number, t1: TokenType, t2: TokenType, t3: TokenType): boolean; + matches1(t1: TokenType): boolean; + matches2(t1: TokenType, t2: TokenType): boolean; + matches3(t1: TokenType, t2: TokenType, t3: TokenType): boolean; + matches4(t1: TokenType, t2: TokenType, t3: TokenType, t4: TokenType): boolean; + matches5(t1: TokenType, t2: TokenType, t3: TokenType, t4: TokenType, t5: TokenType): boolean; + matchesContextual(contextualKeyword: ContextualKeyword): boolean; + matchesContextIdAndLabel(type: TokenType, contextId: number): boolean; + previousWhitespaceAndComments(): string; + replaceToken(newCode: string): void; + replaceTokenTrimmingLeftWhitespace(newCode: string): void; + removeInitialToken(): void; + removeToken(): void; + /** + * Remove all code until the next }, accounting for balanced braces. + */ + removeBalancedCode(): void; + copyExpectedToken(tokenType: TokenType): void; + copyToken(): void; + copyTokenWithPrefix(prefix: string): void; + private appendTokenPrefix; + private appendTokenSuffix; + appendCode(code: string): void; + currentToken(): Token; + currentTokenCode(): string; + tokenAtRelativeIndex(relativeIndex: number): Token; + currentIndex(): number; + /** + * Move to the next token. Only suitable in preprocessing steps. When + * generating new code, you should use copyToken or removeToken. + */ + nextToken(): void; + previousToken(): void; + finish(): TokenProcessorResult; + isAtEnd(): boolean; +} diff --git a/node_modules/sucrase/dist/types/cli.d.ts b/node_modules/sucrase/dist/types/cli.d.ts new file mode 100644 index 00000000..238c75fb --- /dev/null +++ b/node_modules/sucrase/dist/types/cli.d.ts @@ -0,0 +1 @@ +export default function run(): void; diff --git a/node_modules/sucrase/dist/types/computeSourceMap.d.ts b/node_modules/sucrase/dist/types/computeSourceMap.d.ts new file mode 100644 index 00000000..12778472 --- /dev/null +++ b/node_modules/sucrase/dist/types/computeSourceMap.d.ts @@ -0,0 +1,17 @@ +import type { SourceMapOptions } from "./index"; +import type { Token } from "./parser/tokenizer"; +import type { RootTransformerResult } from "./transformers/RootTransformer"; +export interface RawSourceMap { + version: number; + file: string; + sources: Array; + sourceRoot?: string; + sourcesContent?: Array; + mappings: string; + names: Array; +} +/** + * Generate a source map indicating that each line maps directly to the original line, + * with the tokens in their new positions. + */ +export default function computeSourceMap({ code: generatedCode, mappings: rawMappings }: RootTransformerResult, filePath: string, options: SourceMapOptions, source: string, tokens: Array): RawSourceMap; diff --git a/node_modules/sucrase/dist/types/identifyShadowedGlobals.d.ts b/node_modules/sucrase/dist/types/identifyShadowedGlobals.d.ts new file mode 100644 index 00000000..a9222d86 --- /dev/null +++ b/node_modules/sucrase/dist/types/identifyShadowedGlobals.d.ts @@ -0,0 +1,12 @@ +import type { Scope } from "./parser/tokenizer/state"; +import type TokenProcessor from "./TokenProcessor"; +/** + * Traverse the given tokens and modify them if necessary to indicate that some names shadow global + * variables. + */ +export default function identifyShadowedGlobals(tokens: TokenProcessor, scopes: Array, globalNames: Set): void; +/** + * We can do a fast up-front check to see if there are any declarations to global names. If not, + * then there's no point in computing scope assignments. + */ +export declare function hasShadowedGlobals(tokens: TokenProcessor, globalNames: Set): boolean; diff --git a/node_modules/sucrase/dist/types/index.d.ts b/node_modules/sucrase/dist/types/index.d.ts new file mode 100644 index 00000000..bfc4a9ca --- /dev/null +++ b/node_modules/sucrase/dist/types/index.d.ts @@ -0,0 +1,26 @@ +import CJSImportProcessor from "./CJSImportProcessor"; +import { type RawSourceMap } from "./computeSourceMap"; +import { HelperManager } from "./HelperManager"; +import NameManager from "./NameManager"; +import type { Options, SourceMapOptions, Transform } from "./Options"; +import type { Scope } from "./parser/tokenizer/state"; +import TokenProcessor from "./TokenProcessor"; +export interface TransformResult { + code: string; + sourceMap?: RawSourceMap; +} +export interface SucraseContext { + tokenProcessor: TokenProcessor; + scopes: Array; + nameManager: NameManager; + importProcessor: CJSImportProcessor | null; + helperManager: HelperManager; +} +export type { Options, SourceMapOptions, Transform }; +export declare function getVersion(): string; +export declare function transform(code: string, options: Options): TransformResult; +/** + * Return a string representation of the sucrase tokens, mostly useful for + * diagnostic purposes. + */ +export declare function getFormattedTokens(code: string, options: Options): string; diff --git a/node_modules/sucrase/dist/types/parser/index.d.ts b/node_modules/sucrase/dist/types/parser/index.d.ts new file mode 100644 index 00000000..8d082c04 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/index.d.ts @@ -0,0 +1,8 @@ +import type { Token } from "./tokenizer/index"; +import type { Scope } from "./tokenizer/state"; +export declare class File { + tokens: Array; + scopes: Array; + constructor(tokens: Array, scopes: Array); +} +export declare function parse(input: string, isJSXEnabled: boolean, isTypeScriptEnabled: boolean, isFlowEnabled: boolean): File; diff --git a/node_modules/sucrase/dist/types/parser/plugins/flow.d.ts b/node_modules/sucrase/dist/types/parser/plugins/flow.d.ts new file mode 100644 index 00000000..fe83776f --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/plugins/flow.d.ts @@ -0,0 +1,27 @@ +import { ContextualKeyword } from "../tokenizer/keywords"; +import { type StopState } from "../traverser/expression"; +export declare function flowParseTypeParameterDeclaration(): void; +export declare function flowParseTypeAnnotation(): void; +export declare function flowParseVariance(): void; +export declare function flowParseFunctionBodyAndFinish(funcContextId: number): void; +export declare function flowParseSubscript(startTokenIndex: number, noCalls: boolean, stopState: StopState): void; +export declare function flowStartParseNewArguments(): void; +export declare function flowTryParseStatement(): boolean; +export declare function flowTryParseExportDefaultExpression(): boolean; +export declare function flowParseIdentifierStatement(contextualKeyword: ContextualKeyword): void; +export declare function flowShouldParseExportDeclaration(): boolean; +export declare function flowShouldDisallowExportDefaultSpecifier(): boolean; +export declare function flowParseExportDeclaration(): void; +export declare function flowShouldParseExportStar(): boolean; +export declare function flowParseExportStar(): void; +export declare function flowAfterParseClassSuper(hasSuper: boolean): void; +export declare function flowStartParseObjPropValue(): void; +export declare function flowParseAssignableListItemTypes(): void; +export declare function flowStartParseImportSpecifiers(): void; +export declare function flowParseImportSpecifier(): void; +export declare function flowStartParseFunctionParams(): void; +export declare function flowAfterParseVarHead(): void; +export declare function flowStartParseAsyncArrowFromCallExpression(): void; +export declare function flowParseMaybeAssign(noIn: boolean, isWithinParens: boolean): boolean; +export declare function flowParseArrow(): boolean; +export declare function flowParseSubscripts(startTokenIndex: number, noCalls?: boolean): void; diff --git a/node_modules/sucrase/dist/types/parser/plugins/jsx/index.d.ts b/node_modules/sucrase/dist/types/parser/plugins/jsx/index.d.ts new file mode 100644 index 00000000..2600d0f4 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/plugins/jsx/index.d.ts @@ -0,0 +1,2 @@ +export declare function jsxParseElement(): void; +export declare function nextJSXTagToken(): void; diff --git a/node_modules/sucrase/dist/types/parser/plugins/jsx/xhtml.d.ts b/node_modules/sucrase/dist/types/parser/plugins/jsx/xhtml.d.ts new file mode 100644 index 00000000..1190776e --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/plugins/jsx/xhtml.d.ts @@ -0,0 +1,2 @@ +declare const _default: Map; +export default _default; diff --git a/node_modules/sucrase/dist/types/parser/plugins/types.d.ts b/node_modules/sucrase/dist/types/parser/plugins/types.d.ts new file mode 100644 index 00000000..fce6440a --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/plugins/types.d.ts @@ -0,0 +1,5 @@ +/** + * Common parser code for TypeScript and Flow. + */ +export declare function typedParseConditional(noIn: boolean): void; +export declare function typedParseParenItem(): void; diff --git a/node_modules/sucrase/dist/types/parser/plugins/typescript.d.ts b/node_modules/sucrase/dist/types/parser/plugins/typescript.d.ts new file mode 100644 index 00000000..adf9a131 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/plugins/typescript.d.ts @@ -0,0 +1,49 @@ +import { ContextualKeyword } from "../tokenizer/keywords"; +import { type StopState } from "../traverser/expression"; +export declare function tsParseModifiers(allowedModifiers: Array): void; +/** Parses a modifier matching one the given modifier names. */ +export declare function tsParseModifier(allowedModifiers: Array): ContextualKeyword | null; +export declare function tsTryParseTypeParameters(): void; +export declare function tsTryParseTypeAnnotation(): void; +export declare function tsParseTypeAnnotation(): void; +export declare function tsParseType(): void; +export declare function tsParseNonConditionalType(): void; +export declare function tsParseTypeAssertion(): void; +export declare function tsTryParseJSXTypeArgument(): void; +export declare function tsParseImportEqualsDeclaration(): void; +export declare function tsIsDeclarationStart(): boolean; +export declare function tsParseFunctionBodyAndFinish(functionStart: number, funcContextId: number): void; +export declare function tsParseSubscript(startTokenIndex: number, noCalls: boolean, stopState: StopState): void; +export declare function tsTryParseExport(): boolean; +/** + * Parse a TS import specifier, which may be prefixed with "type" and may be of + * the form `foo as bar`. + * + * The number of identifier-like tokens we see happens to be enough to uniquely + * identify the form, so simply count the number of identifiers rather than + * matching the words `type` or `as`. This is particularly important because + * `type` and `as` could each actually be plain identifiers rather than + * keywords. + */ +export declare function tsParseImportSpecifier(): void; +/** + * Just like named import specifiers, export specifiers can have from 1 to 4 + * tokens, inclusive, and the number of tokens determines the role of each token. + */ +export declare function tsParseExportSpecifier(): void; +export declare function tsTryParseExportDefaultExpression(): boolean; +export declare function tsTryParseStatementContent(): boolean; +export declare function tsTryParseClassMemberWithIsStatic(isStatic: boolean): boolean; +export declare function tsParseIdentifierStatement(contextualKeyword: ContextualKeyword): void; +export declare function tsParseExportDeclaration(): void; +export declare function tsAfterParseClassSuper(hasSuper: boolean): void; +export declare function tsStartParseObjPropValue(): void; +export declare function tsStartParseFunctionParams(): void; +export declare function tsAfterParseVarHead(): void; +export declare function tsStartParseAsyncArrowFromCallExpression(): void; +export declare function tsParseMaybeAssign(noIn: boolean, isWithinParens: boolean): boolean; +export declare function tsParseMaybeAssignWithJSX(noIn: boolean, isWithinParens: boolean): boolean; +export declare function tsParseMaybeAssignWithoutJSX(noIn: boolean, isWithinParens: boolean): boolean; +export declare function tsParseArrow(): boolean; +export declare function tsParseAssignableListItemTypes(): void; +export declare function tsParseMaybeDecoratorArguments(): void; diff --git a/node_modules/sucrase/dist/types/parser/tokenizer/index.d.ts b/node_modules/sucrase/dist/types/parser/tokenizer/index.d.ts new file mode 100644 index 00000000..45cd7998 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/tokenizer/index.d.ts @@ -0,0 +1,93 @@ +import { ContextualKeyword } from "./keywords"; +import { type TokenType } from "./types"; +export declare enum IdentifierRole { + Access = 0, + ExportAccess = 1, + TopLevelDeclaration = 2, + FunctionScopedDeclaration = 3, + BlockScopedDeclaration = 4, + ObjectShorthandTopLevelDeclaration = 5, + ObjectShorthandFunctionScopedDeclaration = 6, + ObjectShorthandBlockScopedDeclaration = 7, + ObjectShorthand = 8, + ImportDeclaration = 9, + ObjectKey = 10, + ImportAccess = 11 +} +/** + * Extra information on jsxTagStart tokens, used to determine which of the three + * jsx functions are called in the automatic transform. + */ +export declare enum JSXRole { + NoChildren = 0, + OneChild = 1, + StaticChildren = 2, + KeyAfterPropSpread = 3 +} +export declare function isDeclaration(token: Token): boolean; +export declare function isNonTopLevelDeclaration(token: Token): boolean; +export declare function isTopLevelDeclaration(token: Token): boolean; +export declare function isBlockScopedDeclaration(token: Token): boolean; +export declare function isFunctionScopedDeclaration(token: Token): boolean; +export declare function isObjectShorthandDeclaration(token: Token): boolean; +export declare class Token { + constructor(); + type: TokenType; + contextualKeyword: ContextualKeyword; + start: number; + end: number; + scopeDepth: number; + isType: boolean; + identifierRole: IdentifierRole | null; + jsxRole: JSXRole | null; + shadowsGlobal: boolean; + isAsyncOperation: boolean; + contextId: number | null; + rhsEndIndex: number | null; + isExpression: boolean; + numNullishCoalesceStarts: number; + numNullishCoalesceEnds: number; + isOptionalChainStart: boolean; + isOptionalChainEnd: boolean; + subscriptStartIndex: number | null; + nullishStartIndex: number | null; +} +export declare function next(): void; +export declare function nextTemplateToken(): void; +export declare function retokenizeSlashAsRegex(): void; +export declare function pushTypeContext(existingTokensInType: number): boolean; +export declare function popTypeContext(oldIsType: boolean): void; +export declare function eat(type: TokenType): boolean; +export declare function eatTypeToken(tokenType: TokenType): void; +export declare function match(type: TokenType): boolean; +export declare function lookaheadType(): TokenType; +export declare class TypeAndKeyword { + type: TokenType; + contextualKeyword: ContextualKeyword; + constructor(type: TokenType, contextualKeyword: ContextualKeyword); +} +export declare function lookaheadTypeAndKeyword(): TypeAndKeyword; +export declare function nextTokenStart(): number; +export declare function nextTokenStartSince(pos: number): number; +export declare function lookaheadCharCode(): number; +export declare function nextToken(): void; +export declare function skipLineComment(startSkip: number): void; +export declare function skipSpace(): void; +export declare function finishToken(type: TokenType, contextualKeyword?: ContextualKeyword): void; +/** + * Reinterpret a possible > token when transitioning from a type to a non-type + * context. + * + * This comes up in two situations where >= needs to be treated as one token: + * - After an `as` expression, like in the code `a as T >= 1`. + * - In a type argument in an expression context, e.g. `f(a < b, c >= d)`, we + * need to see the token as >= so that we get an error and backtrack to + * normal expression parsing. + * + * Other situations require >= to be seen as two tokens, e.g. + * `const x: Array=[];`, so it's important to treat > as its own token in + * typical type parsing situations. + */ +export declare function rescan_gt(): void; +export declare function getTokenFromCode(code: number): void; +export declare function skipWord(): void; diff --git a/node_modules/sucrase/dist/types/parser/tokenizer/keywords.d.ts b/node_modules/sucrase/dist/types/parser/tokenizer/keywords.d.ts new file mode 100644 index 00000000..e0e7cd0f --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/tokenizer/keywords.d.ts @@ -0,0 +1,43 @@ +export declare enum ContextualKeyword { + NONE = 0, + _abstract = 1, + _accessor = 2, + _as = 3, + _assert = 4, + _asserts = 5, + _async = 6, + _await = 7, + _checks = 8, + _constructor = 9, + _declare = 10, + _enum = 11, + _exports = 12, + _from = 13, + _get = 14, + _global = 15, + _implements = 16, + _infer = 17, + _interface = 18, + _is = 19, + _keyof = 20, + _mixins = 21, + _module = 22, + _namespace = 23, + _of = 24, + _opaque = 25, + _out = 26, + _override = 27, + _private = 28, + _protected = 29, + _proto = 30, + _public = 31, + _readonly = 32, + _require = 33, + _satisfies = 34, + _set = 35, + _static = 36, + _symbol = 37, + _type = 38, + _unique = 39, + _using = 40 +} diff --git a/node_modules/sucrase/dist/types/parser/tokenizer/readWord.d.ts b/node_modules/sucrase/dist/types/parser/tokenizer/readWord.d.ts new file mode 100644 index 00000000..6fdfe909 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/tokenizer/readWord.d.ts @@ -0,0 +1,7 @@ +/** + * Read an identifier, producing either a name token or matching on one of the existing keywords. + * For performance, we pre-generate big decision tree that we traverse. Each node represents a + * prefix and has 27 values, where the first value is the token or contextual token, if any (-1 if + * not), and the other 26 values are the transitions to other nodes, or -1 to stop. + */ +export default function readWord(): void; diff --git a/node_modules/sucrase/dist/types/parser/tokenizer/readWordTree.d.ts b/node_modules/sucrase/dist/types/parser/tokenizer/readWordTree.d.ts new file mode 100644 index 00000000..f6fb9b24 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/tokenizer/readWordTree.d.ts @@ -0,0 +1 @@ +export declare const READ_WORD_TREE: Int32Array; diff --git a/node_modules/sucrase/dist/types/parser/tokenizer/state.d.ts b/node_modules/sucrase/dist/types/parser/tokenizer/state.d.ts new file mode 100644 index 00000000..e010c18a --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/tokenizer/state.d.ts @@ -0,0 +1,50 @@ +import type { Token } from "./index"; +import { ContextualKeyword } from "./keywords"; +import { type TokenType } from "./types"; +export declare class Scope { + startTokenIndex: number; + endTokenIndex: number; + isFunctionScope: boolean; + constructor(startTokenIndex: number, endTokenIndex: number, isFunctionScope: boolean); +} +export declare class StateSnapshot { + readonly potentialArrowAt: number; + readonly noAnonFunctionType: boolean; + readonly inDisallowConditionalTypesContext: boolean; + readonly tokensLength: number; + readonly scopesLength: number; + readonly pos: number; + readonly type: TokenType; + readonly contextualKeyword: ContextualKeyword; + readonly start: number; + readonly end: number; + readonly isType: boolean; + readonly scopeDepth: number; + readonly error: Error | null; + constructor(potentialArrowAt: number, noAnonFunctionType: boolean, inDisallowConditionalTypesContext: boolean, tokensLength: number, scopesLength: number, pos: number, type: TokenType, contextualKeyword: ContextualKeyword, start: number, end: number, isType: boolean, scopeDepth: number, error: Error | null); +} +export default class State { + potentialArrowAt: number; + noAnonFunctionType: boolean; + inDisallowConditionalTypesContext: boolean; + tokens: Array; + scopes: Array; + pos: number; + type: TokenType; + contextualKeyword: ContextualKeyword; + start: number; + end: number; + isType: boolean; + scopeDepth: number; + /** + * If the parser is in an error state, then the token is always tt.eof and all functions can + * keep executing but should be written so they don't get into an infinite loop in this situation. + * + * This approach, combined with the ability to snapshot and restore state, allows us to implement + * backtracking without exceptions and without needing to explicitly propagate error states + * everywhere. + */ + error: Error | null; + snapshot(): StateSnapshot; + restoreFromSnapshot(snapshot: StateSnapshot): void; +} diff --git a/node_modules/sucrase/dist/types/parser/tokenizer/types.d.ts b/node_modules/sucrase/dist/types/parser/tokenizer/types.d.ts new file mode 100644 index 00000000..d778d5d7 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/tokenizer/types.d.ts @@ -0,0 +1,126 @@ +/** + * Enum of all token types, with bit fields to signify meaningful properties. + */ +export declare enum TokenType { + PRECEDENCE_MASK = 15, + IS_KEYWORD = 16, + IS_ASSIGN = 32, + IS_RIGHT_ASSOCIATIVE = 64, + IS_PREFIX = 128, + IS_POSTFIX = 256, + IS_EXPRESSION_START = 512, + num = 512, + bigint = 1536, + decimal = 2560, + regexp = 3584, + string = 4608, + name = 5632, + eof = 6144, + bracketL = 7680, + bracketR = 8192, + braceL = 9728, + braceBarL = 10752, + braceR = 11264, + braceBarR = 12288, + parenL = 13824, + parenR = 14336, + comma = 15360, + semi = 16384, + colon = 17408, + doubleColon = 18432, + dot = 19456, + question = 20480, + questionDot = 21504, + arrow = 22528, + template = 23552, + ellipsis = 24576, + backQuote = 25600, + dollarBraceL = 27136, + at = 27648, + hash = 29184, + eq = 29728, + assign = 30752, + preIncDec = 32640, + postIncDec = 33664, + bang = 34432, + tilde = 35456, + pipeline = 35841, + nullishCoalescing = 36866, + logicalOR = 37890, + logicalAND = 38915, + bitwiseOR = 39940, + bitwiseXOR = 40965, + bitwiseAND = 41990, + equality = 43015, + lessThan = 44040, + greaterThan = 45064, + relationalOrEqual = 46088, + bitShiftL = 47113, + bitShiftR = 48137, + plus = 49802, + minus = 50826, + modulo = 51723, + star = 52235, + slash = 53259, + exponent = 54348, + jsxName = 55296, + jsxText = 56320, + jsxEmptyText = 57344, + jsxTagStart = 58880, + jsxTagEnd = 59392, + typeParameterStart = 60928, + nonNullAssertion = 61440, + _break = 62480, + _case = 63504, + _catch = 64528, + _continue = 65552, + _debugger = 66576, + _default = 67600, + _do = 68624, + _else = 69648, + _finally = 70672, + _for = 71696, + _function = 73232, + _if = 73744, + _return = 74768, + _switch = 75792, + _throw = 77456, + _try = 77840, + _var = 78864, + _let = 79888, + _const = 80912, + _while = 81936, + _with = 82960, + _new = 84496, + _this = 85520, + _super = 86544, + _class = 87568, + _extends = 88080, + _export = 89104, + _import = 90640, + _yield = 91664, + _null = 92688, + _true = 93712, + _false = 94736, + _in = 95256, + _instanceof = 96280, + _typeof = 97936, + _void = 98960, + _delete = 99984, + _async = 100880, + _get = 101904, + _set = 102928, + _declare = 103952, + _readonly = 104976, + _abstract = 106000, + _static = 107024, + _public = 107536, + _private = 108560, + _protected = 109584, + _override = 110608, + _as = 112144, + _enum = 113168, + _type = 114192, + _implements = 115216 +} +export declare function formatTokenType(tokenType: TokenType): string; diff --git a/node_modules/sucrase/dist/types/parser/traverser/base.d.ts b/node_modules/sucrase/dist/types/parser/traverser/base.d.ts new file mode 100644 index 00000000..e15e8928 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/traverser/base.d.ts @@ -0,0 +1,16 @@ +import State from "../tokenizer/state"; +export declare let isJSXEnabled: boolean; +export declare let isTypeScriptEnabled: boolean; +export declare let isFlowEnabled: boolean; +export declare let state: State; +export declare let input: string; +export declare let nextContextId: number; +export declare function getNextContextId(): number; +export declare function augmentError(error: any): any; +export declare class Loc { + line: number; + column: number; + constructor(line: number, column: number); +} +export declare function locationForIndex(pos: number): Loc; +export declare function initParser(inputCode: string, isJSXEnabledArg: boolean, isTypeScriptEnabledArg: boolean, isFlowEnabledArg: boolean): void; diff --git a/node_modules/sucrase/dist/types/parser/traverser/expression.d.ts b/node_modules/sucrase/dist/types/parser/traverser/expression.d.ts new file mode 100644 index 00000000..52e29fb8 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/traverser/expression.d.ts @@ -0,0 +1,34 @@ +export declare class StopState { + stop: boolean; + constructor(stop: boolean); +} +export declare function parseExpression(noIn?: boolean): void; +/** + * noIn is used when parsing a for loop so that we don't interpret a following "in" as the binary + * operatior. + * isWithinParens is used to indicate that we're parsing something that might be a comma expression + * or might be an arrow function or might be a Flow type assertion (which requires explicit parens). + * In these cases, we should allow : and ?: after the initial "left" part. + */ +export declare function parseMaybeAssign(noIn?: boolean, isWithinParens?: boolean): boolean; +export declare function baseParseMaybeAssign(noIn: boolean, isWithinParens: boolean): boolean; +export declare function baseParseConditional(noIn: boolean): void; +export declare function parseMaybeUnary(): boolean; +export declare function parseExprSubscripts(): boolean; +export declare function baseParseSubscripts(startTokenIndex: number, noCalls?: boolean): void; +/** Set 'state.stop = true' to indicate that we should stop parsing subscripts. */ +export declare function baseParseSubscript(startTokenIndex: number, noCalls: boolean, stopState: StopState): void; +export declare function atPossibleAsync(): boolean; +export declare function parseCallExpressionArguments(): void; +export declare function parseExprAtom(): boolean; +export declare function parseLiteral(): void; +export declare function parseParenExpression(): void; +export declare function parseArrow(): boolean; +export declare function parseTemplate(): void; +export declare function parseObj(isPattern: boolean, isBlockScope: boolean): void; +export declare function parsePropertyName(objectContextId: number): void; +export declare function parseMethod(functionStart: number, isConstructor: boolean): void; +export declare function parseArrowExpression(startTokenIndex: number): void; +export declare function parseFunctionBodyAndFinish(functionStart: number, funcContextId?: number): void; +export declare function parseFunctionBody(allowExpression: boolean, funcContextId?: number): void; +export declare function parseIdentifier(): void; diff --git a/node_modules/sucrase/dist/types/parser/traverser/index.d.ts b/node_modules/sucrase/dist/types/parser/traverser/index.d.ts new file mode 100644 index 00000000..9f9127d1 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/traverser/index.d.ts @@ -0,0 +1,2 @@ +import type { File } from "../index"; +export declare function parseFile(): File; diff --git a/node_modules/sucrase/dist/types/parser/traverser/lval.d.ts b/node_modules/sucrase/dist/types/parser/traverser/lval.d.ts new file mode 100644 index 00000000..eb177566 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/traverser/lval.d.ts @@ -0,0 +1,9 @@ +import { TokenType } from "../tokenizer/types"; +export declare function parseSpread(): void; +export declare function parseRest(isBlockScope: boolean): void; +export declare function parseBindingIdentifier(isBlockScope: boolean): void; +export declare function parseImportedIdentifier(): void; +export declare function markPriorBindingIdentifier(isBlockScope: boolean): void; +export declare function parseBindingAtom(isBlockScope: boolean): void; +export declare function parseBindingList(close: TokenType, isBlockScope: boolean, allowEmpty?: boolean, allowModifiers?: boolean, contextId?: number): void; +export declare function parseMaybeDefault(isBlockScope: boolean, leftAlreadyParsed?: boolean): void; diff --git a/node_modules/sucrase/dist/types/parser/traverser/statement.d.ts b/node_modules/sucrase/dist/types/parser/traverser/statement.d.ts new file mode 100644 index 00000000..508b20a7 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/traverser/statement.d.ts @@ -0,0 +1,20 @@ +import { File } from "../index"; +import { type TokenType } from "../tokenizer/types"; +export declare function parseTopLevel(): File; +export declare function parseStatement(declaration: boolean): void; +export declare function parseDecorators(): void; +export declare function baseParseMaybeDecoratorArguments(): void; +export declare function parseVarStatement(isBlockScope: boolean): void; +export declare function parseBlock(isFunctionScope?: boolean, contextId?: number): void; +export declare function parseBlockBody(end: TokenType): void; +export declare function parseFunction(functionStart: number, isStatement: boolean, optionalId?: boolean): void; +export declare function parseFunctionParams(allowModifiers?: boolean, funcContextId?: number): void; +export declare function parseClass(isStatement: boolean, optionalId?: boolean): void; +export declare function parseClassPropertyName(classContextId: number): void; +export declare function parsePostMemberNameModifiers(): void; +export declare function parseClassProperty(): void; +export declare function parseExport(): void; +export declare function parseExportFrom(): void; +export declare function baseParseExportStar(): void; +export declare function parseExportSpecifiers(): void; +export declare function parseImport(): void; diff --git a/node_modules/sucrase/dist/types/parser/traverser/util.d.ts b/node_modules/sucrase/dist/types/parser/traverser/util.d.ts new file mode 100644 index 00000000..6ec2a55c --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/traverser/util.d.ts @@ -0,0 +1,17 @@ +import type { ContextualKeyword } from "../tokenizer/keywords"; +import { type TokenType } from "../tokenizer/types"; +export declare function isContextual(contextualKeyword: ContextualKeyword): boolean; +export declare function isLookaheadContextual(contextualKeyword: ContextualKeyword): boolean; +export declare function eatContextual(contextualKeyword: ContextualKeyword): boolean; +export declare function expectContextual(contextualKeyword: ContextualKeyword): void; +export declare function canInsertSemicolon(): boolean; +export declare function hasPrecedingLineBreak(): boolean; +export declare function hasFollowingLineBreak(): boolean; +export declare function isLineTerminator(): boolean; +export declare function semicolon(): void; +export declare function expect(type: TokenType): void; +/** + * Transition the parser to an error state. All code needs to be written to naturally unwind in this + * state, which allows us to backtrack without exceptions and without error plumbing everywhere. + */ +export declare function unexpected(message?: string, pos?: number): void; diff --git a/node_modules/sucrase/dist/types/parser/util/charcodes.d.ts b/node_modules/sucrase/dist/types/parser/util/charcodes.d.ts new file mode 100644 index 00000000..19bba1f7 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/util/charcodes.d.ts @@ -0,0 +1,107 @@ +export declare enum charCodes { + backSpace = 8, + lineFeed = 10, + tab = 9, + carriageReturn = 13, + shiftOut = 14, + space = 32, + exclamationMark = 33, + quotationMark = 34, + numberSign = 35, + dollarSign = 36, + percentSign = 37, + ampersand = 38, + apostrophe = 39, + leftParenthesis = 40, + rightParenthesis = 41, + asterisk = 42, + plusSign = 43, + comma = 44, + dash = 45, + dot = 46, + slash = 47, + digit0 = 48, + digit1 = 49, + digit2 = 50, + digit3 = 51, + digit4 = 52, + digit5 = 53, + digit6 = 54, + digit7 = 55, + digit8 = 56, + digit9 = 57, + colon = 58, + semicolon = 59, + lessThan = 60, + equalsTo = 61, + greaterThan = 62, + questionMark = 63, + atSign = 64, + uppercaseA = 65, + uppercaseB = 66, + uppercaseC = 67, + uppercaseD = 68, + uppercaseE = 69, + uppercaseF = 70, + uppercaseG = 71, + uppercaseH = 72, + uppercaseI = 73, + uppercaseJ = 74, + uppercaseK = 75, + uppercaseL = 76, + uppercaseM = 77, + uppercaseN = 78, + uppercaseO = 79, + uppercaseP = 80, + uppercaseQ = 81, + uppercaseR = 82, + uppercaseS = 83, + uppercaseT = 84, + uppercaseU = 85, + uppercaseV = 86, + uppercaseW = 87, + uppercaseX = 88, + uppercaseY = 89, + uppercaseZ = 90, + leftSquareBracket = 91, + backslash = 92, + rightSquareBracket = 93, + caret = 94, + underscore = 95, + graveAccent = 96, + lowercaseA = 97, + lowercaseB = 98, + lowercaseC = 99, + lowercaseD = 100, + lowercaseE = 101, + lowercaseF = 102, + lowercaseG = 103, + lowercaseH = 104, + lowercaseI = 105, + lowercaseJ = 106, + lowercaseK = 107, + lowercaseL = 108, + lowercaseM = 109, + lowercaseN = 110, + lowercaseO = 111, + lowercaseP = 112, + lowercaseQ = 113, + lowercaseR = 114, + lowercaseS = 115, + lowercaseT = 116, + lowercaseU = 117, + lowercaseV = 118, + lowercaseW = 119, + lowercaseX = 120, + lowercaseY = 121, + lowercaseZ = 122, + leftCurlyBrace = 123, + verticalBar = 124, + rightCurlyBrace = 125, + tilde = 126, + nonBreakingSpace = 160, + oghamSpaceMark = 5760, + lineSeparator = 8232, + paragraphSeparator = 8233 +} +export declare function isDigit(code: number): boolean; diff --git a/node_modules/sucrase/dist/types/parser/util/identifier.d.ts b/node_modules/sucrase/dist/types/parser/util/identifier.d.ts new file mode 100644 index 00000000..5c2eaeb1 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/util/identifier.d.ts @@ -0,0 +1,2 @@ +export declare const IS_IDENTIFIER_CHAR: Uint8Array; +export declare const IS_IDENTIFIER_START: Uint8Array; diff --git a/node_modules/sucrase/dist/types/parser/util/whitespace.d.ts b/node_modules/sucrase/dist/types/parser/util/whitespace.d.ts new file mode 100644 index 00000000..dca54255 --- /dev/null +++ b/node_modules/sucrase/dist/types/parser/util/whitespace.d.ts @@ -0,0 +1,3 @@ +export declare const WHITESPACE_CHARS: Array; +export declare const skipWhiteSpace: RegExp; +export declare const IS_WHITESPACE: Uint8Array; diff --git a/node_modules/sucrase/dist/types/register.d.ts b/node_modules/sucrase/dist/types/register.d.ts new file mode 100644 index 00000000..8a7ebd53 --- /dev/null +++ b/node_modules/sucrase/dist/types/register.d.ts @@ -0,0 +1,14 @@ +import { type Options } from "./index"; +export interface HookOptions { + matcher?: (code: string) => boolean; + ignoreNodeModules?: boolean; +} +export type RevertFunction = () => void; +export declare function addHook(extension: string, sucraseOptions: Options, hookOptions?: HookOptions): RevertFunction; +export declare function registerJS(hookOptions?: HookOptions): RevertFunction; +export declare function registerJSX(hookOptions?: HookOptions): RevertFunction; +export declare function registerTS(hookOptions?: HookOptions): RevertFunction; +export declare function registerTSX(hookOptions?: HookOptions): RevertFunction; +export declare function registerTSLegacyModuleInterop(hookOptions?: HookOptions): RevertFunction; +export declare function registerTSXLegacyModuleInterop(hookOptions?: HookOptions): RevertFunction; +export declare function registerAll(hookOptions?: HookOptions): RevertFunction; diff --git a/node_modules/sucrase/dist/types/transformers/CJSImportTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/CJSImportTransformer.d.ts new file mode 100644 index 00000000..6a656213 --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/CJSImportTransformer.d.ts @@ -0,0 +1,149 @@ +import type CJSImportProcessor from "../CJSImportProcessor"; +import type { HelperManager } from "../HelperManager"; +import type NameManager from "../NameManager"; +import type TokenProcessor from "../TokenProcessor"; +import type ReactHotLoaderTransformer from "./ReactHotLoaderTransformer"; +import type RootTransformer from "./RootTransformer"; +import Transformer from "./Transformer"; +/** + * Class for editing import statements when we are transforming to commonjs. + */ +export default class CJSImportTransformer extends Transformer { + readonly rootTransformer: RootTransformer; + readonly tokens: TokenProcessor; + readonly importProcessor: CJSImportProcessor; + readonly nameManager: NameManager; + readonly helperManager: HelperManager; + readonly reactHotLoaderTransformer: ReactHotLoaderTransformer | null; + readonly enableLegacyBabel5ModuleInterop: boolean; + readonly enableLegacyTypeScriptModuleInterop: boolean; + readonly isTypeScriptTransformEnabled: boolean; + readonly isFlowTransformEnabled: boolean; + readonly preserveDynamicImport: boolean; + readonly keepUnusedImports: boolean; + private hadExport; + private hadNamedExport; + private hadDefaultExport; + private declarationInfo; + constructor(rootTransformer: RootTransformer, tokens: TokenProcessor, importProcessor: CJSImportProcessor, nameManager: NameManager, helperManager: HelperManager, reactHotLoaderTransformer: ReactHotLoaderTransformer | null, enableLegacyBabel5ModuleInterop: boolean, enableLegacyTypeScriptModuleInterop: boolean, isTypeScriptTransformEnabled: boolean, isFlowTransformEnabled: boolean, preserveDynamicImport: boolean, keepUnusedImports: boolean); + getPrefixCode(): string; + getSuffixCode(): string; + process(): boolean; + private processImportEquals; + /** + * Transform this: + * import foo, {bar} from 'baz'; + * into + * var _baz = require('baz'); var _baz2 = _interopRequireDefault(_baz); + * + * The import code was already generated in the import preprocessing step, so + * we just need to look it up. + */ + private processImport; + /** + * Erase this import (since any CJS output would be completely different), and + * return true if this import is should be elided due to being a type-only + * import. Such imports will not be emitted at all to avoid side effects. + * + * Import elision only happens with the TypeScript or Flow transforms enabled. + * + * TODO: This function has some awkward overlap with + * CJSImportProcessor.pruneTypeOnlyImports , and the two should be unified. + * That function handles TypeScript implicit import name elision, and removes + * an import if all typical imported names (without `type`) are removed due + * to being type-only imports. This function handles Flow import removal and + * properly distinguishes `import 'foo'` from `import {} from 'foo'` for TS + * purposes. + * + * The position should end at the import string. + */ + private removeImportAndDetectIfShouldElide; + private removeRemainingImport; + private processIdentifier; + processObjectShorthand(): boolean; + processExport(): boolean; + private processAssignment; + /** + * Process something like `a += 3`, where `a` might be an exported value. + */ + private processComplexAssignment; + /** + * Process something like `++a`, where `a` might be an exported value. + */ + private processPreIncDec; + /** + * Process something like `a++`, where `a` might be an exported value. + * This starts at the `a`, not at the `++`. + */ + private processPostIncDec; + private processExportDefault; + private copyDecorators; + /** + * Transform a declaration like `export var`, `export let`, or `export const`. + */ + private processExportVar; + /** + * Determine if the export is of the form: + * export var/let/const [varName] = [expr]; + * In other words, determine if function name inference might apply. + */ + private isSimpleExportVar; + /** + * Transform an `export var` declaration initializing a single variable. + * + * For example, this: + * export const f = () => {}; + * becomes this: + * const f = () => {}; exports.f = f; + * + * The variable is unused (e.g. exports.f has the true value of the export). + * We need to produce an assignment of this form so that the function will + * have an inferred name of "f", which wouldn't happen in the more general + * case below. + */ + private processSimpleExportVar; + /** + * Transform normal declaration exports, including handling destructuring. + * For example, this: + * export const {x: [a = 2, b], c} = d; + * becomes this: + * ({x: [exports.a = 2, exports.b], c: exports.c} = d;) + */ + private processComplexExportVar; + /** + * Transform this: + * export function foo() {} + * into this: + * function foo() {} exports.foo = foo; + */ + private processExportFunction; + /** + * Skip past a function with a name and return that name. + */ + private processNamedFunction; + /** + * Transform this: + * export class A {} + * into this: + * class A {} exports.A = A; + */ + private processExportClass; + /** + * Transform this: + * export {a, b as c}; + * into this: + * exports.a = a; exports.c = b; + * + * OR + * + * Transform this: + * export {a, b as c} from './foo'; + * into the pre-generated Object.defineProperty code from the ImportProcessor. + * + * For the first case, if the TypeScript transform is enabled, we need to skip + * exports that are only defined as types. + */ + private processExportBindings; + private processExportStar; + private shouldElideExportedIdentifier; +} diff --git a/node_modules/sucrase/dist/types/transformers/ESMImportTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/ESMImportTransformer.d.ts new file mode 100644 index 00000000..5caf0823 --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/ESMImportTransformer.d.ts @@ -0,0 +1,52 @@ +import type { HelperManager } from "../HelperManager"; +import type { Options } from "../index"; +import type NameManager from "../NameManager"; +import type TokenProcessor from "../TokenProcessor"; +import type ReactHotLoaderTransformer from "./ReactHotLoaderTransformer"; +import Transformer from "./Transformer"; +/** + * Class for editing import statements when we are keeping the code as ESM. We still need to remove + * type-only imports in TypeScript and Flow. + */ +export default class ESMImportTransformer extends Transformer { + readonly tokens: TokenProcessor; + readonly nameManager: NameManager; + readonly helperManager: HelperManager; + readonly reactHotLoaderTransformer: ReactHotLoaderTransformer | null; + readonly isTypeScriptTransformEnabled: boolean; + readonly isFlowTransformEnabled: boolean; + readonly keepUnusedImports: boolean; + private nonTypeIdentifiers; + private declarationInfo; + private injectCreateRequireForImportRequire; + constructor(tokens: TokenProcessor, nameManager: NameManager, helperManager: HelperManager, reactHotLoaderTransformer: ReactHotLoaderTransformer | null, isTypeScriptTransformEnabled: boolean, isFlowTransformEnabled: boolean, keepUnusedImports: boolean, options: Options); + process(): boolean; + private processImportEquals; + private processImport; + /** + * Remove type bindings from this import, leaving the rest of the import intact. + * + * Return true if this import was ONLY types, and thus is eligible for removal. This will bail out + * of the replacement operation, so we can return early here. + */ + private removeImportTypeBindings; + private shouldAutomaticallyElideImportedName; + private processExportDefault; + /** + * Handle a statement with one of these forms: + * export {a, type b}; + * export {c, type d} from 'foo'; + * + * In both cases, any explicit type exports should be removed. In the first + * case, we also need to handle implicit export elision for names declared as + * types. In the second case, we must NOT do implicit named export elision, + * but we must remove the runtime import if all exports are type exports. + */ + private processNamedExports; + /** + * ESM elides all imports with the rule that we only elide if we see that it's + * a type and never see it as a value. This is in contrast to CJS, which + * elides imports that are completely unknown. + */ + private shouldElideExportedName; +} diff --git a/node_modules/sucrase/dist/types/transformers/FlowTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/FlowTransformer.d.ts new file mode 100644 index 00000000..8a85ac4b --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/FlowTransformer.d.ts @@ -0,0 +1,79 @@ +import type TokenProcessor from "../TokenProcessor"; +import type RootTransformer from "./RootTransformer"; +import Transformer from "./Transformer"; +export default class FlowTransformer extends Transformer { + readonly rootTransformer: RootTransformer; + readonly tokens: TokenProcessor; + readonly isImportsTransformEnabled: boolean; + constructor(rootTransformer: RootTransformer, tokens: TokenProcessor, isImportsTransformEnabled: boolean); + process(): boolean; + /** + * Handle a declaration like: + * export enum E ... + * + * With this imports transform, this becomes: + * const E = [[enum]]; exports.E = E; + * + * otherwise, it becomes: + * export const E = [[enum]]; + */ + processNamedExportEnum(): void; + /** + * Handle a declaration like: + * export default enum E + * + * With the imports transform, this becomes: + * const E = [[enum]]; exports.default = E; + * + * otherwise, it becomes: + * const E = [[enum]]; export default E; + */ + processDefaultExportEnum(): void; + /** + * Transpile flow enums to invoke the "flow-enums-runtime" library. + * + * Currently, the transpiled code always uses `require("flow-enums-runtime")`, + * but if future flexibility is needed, we could expose a config option for + * this string (similar to configurable JSX). Even when targeting ESM, the + * default behavior of babel-plugin-transform-flow-enums is to use require + * rather than injecting an import. + * + * Flow enums are quite a bit simpler than TS enums and have some convenient + * constraints: + * - Element initializers must be either always present or always absent. That + * means that we can use fixed lookahead on the first element (if any) and + * assume that all elements are like that. + * - The right-hand side of an element initializer must be a literal value, + * not a complex expression and not referencing other elements. That means + * we can simply copy a single token. + * + * Enums can be broken up into three basic cases: + * + * Mirrored enums: + * enum E {A, B} + * -> + * const E = require("flow-enums-runtime").Mirrored(["A", "B"]); + * + * Initializer enums: + * enum E {A = 1, B = 2} + * -> + * const E = require("flow-enums-runtime")({A: 1, B: 2}); + * + * Symbol enums: + * enum E of symbol {A, B} + * -> + * const E = require("flow-enums-runtime")({A: Symbol("A"), B: Symbol("B")}); + * + * We can statically detect which of the three cases this is by looking at the + * "of" declaration (if any) and seeing if the first element has an initializer. + * Since the other transform details are so similar between the three cases, we + * use a single implementation and vary the transform within processEnumElement + * based on case. + */ + processEnum(): void; + /** + * Process an individual enum element, producing either an array element or an + * object element based on what type of enum this is. + */ + processEnumElement(isSymbolEnum: boolean, hasInitializers: boolean): void; +} diff --git a/node_modules/sucrase/dist/types/transformers/JSXTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/JSXTransformer.d.ts new file mode 100644 index 00000000..ca7228bb --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/JSXTransformer.d.ts @@ -0,0 +1,144 @@ +import type CJSImportProcessor from "../CJSImportProcessor"; +import type { Options } from "../index"; +import type NameManager from "../NameManager"; +import { JSXRole } from "../parser/tokenizer"; +import type TokenProcessor from "../TokenProcessor"; +import { type JSXPragmaInfo } from "../util/getJSXPragmaInfo"; +import type RootTransformer from "./RootTransformer"; +import Transformer from "./Transformer"; +export default class JSXTransformer extends Transformer { + readonly rootTransformer: RootTransformer; + readonly tokens: TokenProcessor; + readonly importProcessor: CJSImportProcessor | null; + readonly nameManager: NameManager; + readonly options: Options; + jsxPragmaInfo: JSXPragmaInfo; + jsxImportSource: string; + isAutomaticRuntime: boolean; + lastLineNumber: number; + lastIndex: number; + filenameVarName: string | null; + esmAutomaticImportNameResolutions: { + [name: string]: string; + }; + cjsAutomaticModuleNameResolutions: { + [path: string]: string; + }; + constructor(rootTransformer: RootTransformer, tokens: TokenProcessor, importProcessor: CJSImportProcessor | null, nameManager: NameManager, options: Options); + process(): boolean; + getPrefixCode(): string; + processJSXTag(): void; + getElementLocationCode(firstTokenStart: number): string; + /** + * Get the line number for this source position. This is calculated lazily and + * must be called in increasing order by index. + */ + getLineNumberForIndex(index: number): number; + /** + * Convert the current JSX element to a call to jsx, jsxs, or jsxDEV. This is + * the primary transformation for the automatic transform. + * + * Example: + *
    Hello{x}
    + * becomes + * jsxs('div', {a: 1, children: ["Hello", x]}, 2) + */ + transformTagToJSXFunc(elementLocationCode: string | null, jsxRole: JSXRole): void; + /** + * Convert the current JSX element to a createElement call. In the classic + * runtime, this is the only case. In the automatic runtime, this is called + * as a fallback in some situations. + * + * Example: + *
    Hello{x}
    + * becomes + * React.createElement('div', {a: 1, key: 2}, "Hello", x) + */ + transformTagToCreateElement(elementLocationCode: string | null): void; + /** + * Get the code for the relevant function for this context: jsx, jsxs, + * or jsxDEV. The following open-paren is included as well. + * + * These functions are only used for the automatic runtime, so they are always + * auto-imported, but the auto-import will be either CJS or ESM based on the + * target module format. + */ + getJSXFuncInvocationCode(isStatic: boolean): string; + /** + * Return the code to use for the createElement function, e.g. + * `React.createElement`, including the following open-paren. + * + * This is the main function to use for the classic runtime. For the + * automatic runtime, this function is used as a fallback function to + * preserve behavior when there is a prop spread followed by an explicit + * key. In that automatic runtime case, the function should be automatically + * imported. + */ + getCreateElementInvocationCode(): string; + /** + * Return the code to use as the component when compiling a shorthand + * fragment, e.g. `React.Fragment`. + * + * This may be called from either the classic or automatic runtime, and + * the value should be auto-imported for the automatic runtime. + */ + getFragmentCode(): string; + /** + * Return code that invokes the given function. + * + * When the imports transform is enabled, use the CJSImportTransformer + * strategy of using `.call(void 0, ...` to avoid passing a `this` value in a + * situation that would otherwise look like a method call. + */ + claimAutoImportedFuncInvocation(funcName: string, importPathSuffix: string): string; + claimAutoImportedName(funcName: string, importPathSuffix: string): string; + /** + * Process the first part of a tag, before any props. + */ + processTagIntro(): void; + /** + * Starting at the beginning of the props, add the props argument to + * React.createElement, including the comma before it. + */ + processPropsObjectWithDevInfo(elementLocationCode: string | null): void; + /** + * Transform the core part of the props, assuming that a { has already been + * inserted before us and that a } will be inserted after us. + * + * If extractKeyCode is true (i.e. when using any jsx... function), any prop + * named "key" has its code captured and returned rather than being emitted to + * the output code. This shifts line numbers, and emitting the code later will + * correct line numbers again. If no key is found or if extractKeyCode is + * false, this function returns null. + */ + processProps(extractKeyCode: boolean): string | null; + processPropName(propName: string): void; + processPropValue(): void; + processStringPropValue(): void; + /** + * Starting in the middle of the props object literal, produce an additional + * prop for the children and close the object literal. + */ + processAutomaticChildrenAndEndProps(jsxRole: JSXRole): void; + /** + * Transform children into a comma-separated list, which will be either + * arguments to createElement or array elements of a children prop. + */ + processChildren(needsInitialComma: boolean): void; + /** + * Turn a JSX text element into a string literal, or nothing at all if the JSX + * text resolves to the empty string. + * + * Returns true if a string literal is emitted, false otherwise. + */ + processChildTextElement(needsComma: boolean): boolean; + getDevSource(elementLocationCode: string): string; + getFilenameVarName(): string; +} +/** + * Spec for identifiers: https://tc39.github.io/ecma262/#prod-IdentifierStart. + * + * Really only treat anything starting with a-z as tag names. `_`, `$`, `é` + * should be treated as component names + */ +export declare function startsWithLowerCase(s: string): boolean; diff --git a/node_modules/sucrase/dist/types/transformers/JestHoistTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/JestHoistTransformer.d.ts new file mode 100644 index 00000000..6a8b9df4 --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/JestHoistTransformer.d.ts @@ -0,0 +1,32 @@ +import type CJSImportProcessor from "../CJSImportProcessor"; +import type NameManager from "../NameManager"; +import type TokenProcessor from "../TokenProcessor"; +import type RootTransformer from "./RootTransformer"; +import Transformer from "./Transformer"; +/** + * Implementation of babel-plugin-jest-hoist, which hoists up some jest method + * calls above the imports to allow them to override other imports. + * + * To preserve line numbers, rather than directly moving the jest.mock code, we + * wrap each invocation in a function statement and then call the function from + * the top of the file. + */ +export default class JestHoistTransformer extends Transformer { + readonly rootTransformer: RootTransformer; + readonly tokens: TokenProcessor; + readonly nameManager: NameManager; + readonly importProcessor: CJSImportProcessor | null; + private readonly hoistedFunctionNames; + constructor(rootTransformer: RootTransformer, tokens: TokenProcessor, nameManager: NameManager, importProcessor: CJSImportProcessor | null); + process(): boolean; + getHoistedCode(): string; + /** + * Extracts any methods calls on the jest-object that should be hoisted. + * + * According to the jest docs, https://jestjs.io/docs/en/jest-object#jestmockmodulename-factory-options, + * mock, unmock, enableAutomock, disableAutomock, are the methods that should be hoisted. + * + * We do not apply the same checks of the arguments as babel-plugin-jest-hoist does. + */ + private extractHoistedCalls; +} diff --git a/node_modules/sucrase/dist/types/transformers/NumericSeparatorTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/NumericSeparatorTransformer.d.ts new file mode 100644 index 00000000..69a1cf52 --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/NumericSeparatorTransformer.d.ts @@ -0,0 +1,7 @@ +import type TokenProcessor from "../TokenProcessor"; +import Transformer from "./Transformer"; +export default class NumericSeparatorTransformer extends Transformer { + readonly tokens: TokenProcessor; + constructor(tokens: TokenProcessor); + process(): boolean; +} diff --git a/node_modules/sucrase/dist/types/transformers/OptionalCatchBindingTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/OptionalCatchBindingTransformer.d.ts new file mode 100644 index 00000000..d381e5a2 --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/OptionalCatchBindingTransformer.d.ts @@ -0,0 +1,9 @@ +import type NameManager from "../NameManager"; +import type TokenProcessor from "../TokenProcessor"; +import Transformer from "./Transformer"; +export default class OptionalCatchBindingTransformer extends Transformer { + readonly tokens: TokenProcessor; + readonly nameManager: NameManager; + constructor(tokens: TokenProcessor, nameManager: NameManager); + process(): boolean; +} diff --git a/node_modules/sucrase/dist/types/transformers/OptionalChainingNullishTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/OptionalChainingNullishTransformer.d.ts new file mode 100644 index 00000000..d4680297 --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/OptionalChainingNullishTransformer.d.ts @@ -0,0 +1,36 @@ +import type NameManager from "../NameManager"; +import type TokenProcessor from "../TokenProcessor"; +import Transformer from "./Transformer"; +/** + * Transformer supporting the optional chaining and nullish coalescing operators. + * + * Tech plan here: + * https://github.com/alangpierce/sucrase/wiki/Sucrase-Optional-Chaining-and-Nullish-Coalescing-Technical-Plan + * + * The prefix and suffix code snippets are handled by TokenProcessor, and this transformer handles + * the operators themselves. + */ +export default class OptionalChainingNullishTransformer extends Transformer { + readonly tokens: TokenProcessor; + readonly nameManager: NameManager; + constructor(tokens: TokenProcessor, nameManager: NameManager); + process(): boolean; + /** + * Determine if the current token is the last of its chain, so that we know whether it's eligible + * to have a delete op inserted. + * + * We can do this by walking forward until we determine one way or another. Each + * isOptionalChainStart token must be paired with exactly one isOptionalChainEnd token after it in + * a nesting way, so we can track depth and walk to the end of the chain (the point where the + * depth goes negative) and see if any other subscript token is after us in the chain. + */ + isLastSubscriptInChain(): boolean; + /** + * Determine if we are the open-paren in an expression like super.a()?.b. + * + * We can do this by walking backward to find the previous subscript. If that subscript was + * preceded by a super, then we must be the subscript after it, so if this is a call expression, + * we'll need to attach the right context. + */ + justSkippedSuper(): boolean; +} diff --git a/node_modules/sucrase/dist/types/transformers/ReactDisplayNameTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/ReactDisplayNameTransformer.d.ts new file mode 100644 index 00000000..56ed86ee --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/ReactDisplayNameTransformer.d.ts @@ -0,0 +1,29 @@ +import type CJSImportProcessor from "../CJSImportProcessor"; +import type { Options } from "../index"; +import type TokenProcessor from "../TokenProcessor"; +import type RootTransformer from "./RootTransformer"; +import Transformer from "./Transformer"; +/** + * Implementation of babel-plugin-transform-react-display-name, which adds a + * display name to usages of React.createClass and createReactClass. + */ +export default class ReactDisplayNameTransformer extends Transformer { + readonly rootTransformer: RootTransformer; + readonly tokens: TokenProcessor; + readonly importProcessor: CJSImportProcessor | null; + readonly options: Options; + constructor(rootTransformer: RootTransformer, tokens: TokenProcessor, importProcessor: CJSImportProcessor | null, options: Options); + process(): boolean; + /** + * This is called with the token position at the open-paren. + */ + private tryProcessCreateClassCall; + private findDisplayName; + private getDisplayNameFromFilename; + /** + * We only want to add a display name when this is a function call containing + * one argument, which is an object literal without `displayName` as an + * existing key. + */ + private classNeedsDisplayName; +} diff --git a/node_modules/sucrase/dist/types/transformers/ReactHotLoaderTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/ReactHotLoaderTransformer.d.ts new file mode 100644 index 00000000..02212169 --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/ReactHotLoaderTransformer.d.ts @@ -0,0 +1,12 @@ +import type TokenProcessor from "../TokenProcessor"; +import Transformer from "./Transformer"; +export default class ReactHotLoaderTransformer extends Transformer { + readonly tokens: TokenProcessor; + readonly filePath: string; + private extractedDefaultExportName; + constructor(tokens: TokenProcessor, filePath: string); + setExtractedDefaultExportName(extractedDefaultExportName: string): void; + getPrefixCode(): string; + getSuffixCode(): string; + process(): boolean; +} diff --git a/node_modules/sucrase/dist/types/transformers/RootTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/RootTransformer.d.ts new file mode 100644 index 00000000..07a0173d --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/RootTransformer.d.ts @@ -0,0 +1,52 @@ +import type { Options, SucraseContext, Transform } from "../index"; +import { type ClassInfo } from "../util/getClassInfo"; +export interface RootTransformerResult { + code: string; + mappings: Array; +} +export default class RootTransformer { + private transformers; + private nameManager; + private tokens; + private generatedVariables; + private isImportsTransformEnabled; + private isReactHotLoaderTransformEnabled; + private disableESTransforms; + private helperManager; + constructor(sucraseContext: SucraseContext, transforms: Array, enableLegacyBabel5ModuleInterop: boolean, options: Options); + transform(): RootTransformerResult; + processBalancedCode(): void; + processToken(): void; + /** + * Skip past a class with a name and return that name. + */ + processNamedClass(): string; + processClass(): void; + /** + * We want to just handle class fields in all contexts, since TypeScript supports them. Later, + * when some JS implementations support class fields, this should be made optional. + */ + processClassBody(classInfo: ClassInfo, className: string | null): void; + makeConstructorInitCode(constructorInitializerStatements: Array, instanceInitializerNames: Array, className: string): string; + /** + * Normally it's ok to simply remove type tokens, but we need to be more careful when dealing with + * arrow function return types since they can confuse the parser. In that case, we want to move + * the close-paren to the same line as the arrow. + * + * See https://github.com/alangpierce/sucrase/issues/391 for more details. + */ + processPossibleArrowParamEnd(): boolean; + /** + * An async arrow function might be of the form: + * + * async < + * T + * >() => {} + * + * in which case, removing the type parameters will cause a syntax error. Detect this case and + * move the open-paren earlier. + */ + processPossibleAsyncArrowWithTypeParams(): boolean; + processPossibleTypeRange(): boolean; + shiftMappings(mappings: Array, prefixLength: number): Array; +} diff --git a/node_modules/sucrase/dist/types/transformers/Transformer.d.ts b/node_modules/sucrase/dist/types/transformers/Transformer.d.ts new file mode 100644 index 00000000..35c18b16 --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/Transformer.d.ts @@ -0,0 +1,6 @@ +export default abstract class Transformer { + abstract process(): boolean; + getPrefixCode(): string; + getHoistedCode(): string; + getSuffixCode(): string; +} diff --git a/node_modules/sucrase/dist/types/transformers/TypeScriptTransformer.d.ts b/node_modules/sucrase/dist/types/transformers/TypeScriptTransformer.d.ts new file mode 100644 index 00000000..6e9c9d36 --- /dev/null +++ b/node_modules/sucrase/dist/types/transformers/TypeScriptTransformer.d.ts @@ -0,0 +1,104 @@ +import type { Token } from "../parser/tokenizer"; +import type TokenProcessor from "../TokenProcessor"; +import type RootTransformer from "./RootTransformer"; +import Transformer from "./Transformer"; +export default class TypeScriptTransformer extends Transformer { + readonly rootTransformer: RootTransformer; + readonly tokens: TokenProcessor; + readonly isImportsTransformEnabled: boolean; + constructor(rootTransformer: RootTransformer, tokens: TokenProcessor, isImportsTransformEnabled: boolean); + process(): boolean; + processEnum(isExport?: boolean): void; + /** + * Transform an enum into equivalent JS. This has complexity in a few places: + * - TS allows string enums, numeric enums, and a mix of the two styles within an enum. + * - Enum keys are allowed to be referenced in later enum values. + * - Enum keys are allowed to be strings. + * - When enum values are omitted, they should follow an auto-increment behavior. + */ + processEnumBody(enumName: string): void; + /** + * Detect name information about this enum key, which will be used to determine which code to emit + * and whether we should declare a variable as part of this declaration. + * + * Some cases to keep in mind: + * - Enum keys can be implicitly referenced later, e.g. `X = 1, Y = X`. In Sucrase, we implement + * this by declaring a variable `X` so that later expressions can use it. + * - In addition to the usual identifier key syntax, enum keys are allowed to be string literals, + * e.g. `"hello world" = 3,`. Template literal syntax is NOT allowed. + * - Even if the enum key is defined as a string literal, it may still be referenced by identifier + * later, e.g. `"X" = 1, Y = X`. That means that we need to detect whether or not a string + * literal is identifier-like and emit a variable if so, even if the declaration did not use an + * identifier. + * - Reserved keywords like `break` are valid enum keys, but are not valid to be referenced later + * and would be a syntax error if we emitted a variable, so we need to skip the variable + * declaration in those cases. + * + * The variableName return value captures these nuances: if non-null, we can and must emit a + * variable declaration, and if null, we can't and shouldn't. + */ + extractEnumKeyInfo(nameToken: Token): { + nameStringCode: string; + variableName: string | null; + }; + /** + * Handle an enum member where the RHS is just a string literal (not omitted, not a number, and + * not a complex expression). This is the typical form for TS string enums, and in this case, we + * do *not* create a reverse mapping. + * + * This is called after deleting the key token, when the token processor is at the equals sign. + * + * Example 1: + * someKey = "some value" + * -> + * const someKey = "some value"; MyEnum["someKey"] = someKey; + * + * Example 2: + * "some key" = "some value" + * -> + * MyEnum["some key"] = "some value"; + */ + processStringLiteralEnumMember(enumName: string, nameStringCode: string, variableName: string | null): void; + /** + * Handle an enum member initialized with an expression on the right-hand side (other than a + * string literal). In these cases, we should transform the expression and emit code that sets up + * a reverse mapping. + * + * The TypeScript implementation of this operation distinguishes between expressions that can be + * "constant folded" at compile time (i.e. consist of number literals and simple math operations + * on those numbers) and ones that are dynamic. For constant expressions, it emits the resolved + * numeric value, and auto-incrementing is only allowed in that case. Evaluating expressions at + * compile time would add significant complexity to Sucrase, so Sucrase instead leaves the + * expression as-is, and will later emit something like `MyEnum["previousKey"] + 1` to implement + * auto-incrementing. + * + * This is called after deleting the key token, when the token processor is at the equals sign. + * + * Example 1: + * someKey = 1 + 1 + * -> + * const someKey = 1 + 1; MyEnum[MyEnum["someKey"] = someKey] = "someKey"; + * + * Example 2: + * "some key" = 1 + 1 + * -> + * MyEnum[MyEnum["some key"] = 1 + 1] = "some key"; + */ + processExplicitValueEnumMember(enumName: string, nameStringCode: string, variableName: string | null): void; + /** + * Handle an enum member with no right-hand side expression. In this case, the value is the + * previous value plus 1, or 0 if there was no previous value. We should also always emit a + * reverse mapping. + * + * Example 1: + * someKey2 + * -> + * const someKey2 = someKey1 + 1; MyEnum[MyEnum["someKey2"] = someKey2] = "someKey2"; + * + * Example 2: + * "some key 2" + * -> + * MyEnum[MyEnum["some key 2"] = someKey1 + 1] = "some key 2"; + */ + processImplicitValueEnumMember(enumName: string, nameStringCode: string, variableName: string | null, previousValueCode: string | null): void; +} diff --git a/node_modules/sucrase/dist/types/util/elideImportEquals.d.ts b/node_modules/sucrase/dist/types/util/elideImportEquals.d.ts new file mode 100644 index 00000000..d04bb716 --- /dev/null +++ b/node_modules/sucrase/dist/types/util/elideImportEquals.d.ts @@ -0,0 +1,2 @@ +import type TokenProcessor from "../TokenProcessor"; +export default function elideImportEquals(tokens: TokenProcessor): void; diff --git a/node_modules/sucrase/dist/types/util/formatTokens.d.ts b/node_modules/sucrase/dist/types/util/formatTokens.d.ts new file mode 100644 index 00000000..fe5fb1ec --- /dev/null +++ b/node_modules/sucrase/dist/types/util/formatTokens.d.ts @@ -0,0 +1,2 @@ +import type { Token } from "../parser/tokenizer"; +export default function formatTokens(code: string, tokens: Array): string; diff --git a/node_modules/sucrase/dist/types/util/getClassInfo.d.ts b/node_modules/sucrase/dist/types/util/getClassInfo.d.ts new file mode 100644 index 00000000..f4309cbe --- /dev/null +++ b/node_modules/sucrase/dist/types/util/getClassInfo.d.ts @@ -0,0 +1,34 @@ +import type NameManager from "../NameManager"; +import type TokenProcessor from "../TokenProcessor"; +import type RootTransformer from "../transformers/RootTransformer"; +export interface ClassHeaderInfo { + isExpression: boolean; + className: string | null; + hasSuperclass: boolean; +} +export interface TokenRange { + start: number; + end: number; +} +export interface FieldInfo extends TokenRange { + equalsIndex: number; + initializerName: string; +} +/** + * Information about a class returned to inform the implementation of class fields and constructor + * initializers. + */ +export interface ClassInfo { + headerInfo: ClassHeaderInfo; + constructorInitializerStatements: Array; + instanceInitializerNames: Array; + staticInitializerNames: Array; + constructorInsertPos: number | null; + fields: Array; + rangesToRemove: Array; +} +/** + * Get information about the class fields for this class, given a token processor pointing to the + * open-brace at the start of the class. + */ +export default function getClassInfo(rootTransformer: RootTransformer, tokens: TokenProcessor, nameManager: NameManager, disableESTransforms: boolean): ClassInfo; diff --git a/node_modules/sucrase/dist/types/util/getDeclarationInfo.d.ts b/node_modules/sucrase/dist/types/util/getDeclarationInfo.d.ts new file mode 100644 index 00000000..04122ba2 --- /dev/null +++ b/node_modules/sucrase/dist/types/util/getDeclarationInfo.d.ts @@ -0,0 +1,18 @@ +import type TokenProcessor from "../TokenProcessor"; +export interface DeclarationInfo { + typeDeclarations: Set; + valueDeclarations: Set; +} +export declare const EMPTY_DECLARATION_INFO: DeclarationInfo; +/** + * Get all top-level identifiers that should be preserved when exported in TypeScript. + * + * Examples: + * - If an identifier is declared as `const x`, then `export {x}` should be preserved. + * - If it's declared as `type x`, then `export {x}` should be removed. + * - If it's declared as both `const x` and `type x`, then the export should be preserved. + * - Classes and enums should be preserved (even though they also introduce types). + * - Imported identifiers should be preserved since we don't have enough information to + * rule them out. --isolatedModules disallows re-exports, which catches errors here. + */ +export default function getDeclarationInfo(tokens: TokenProcessor): DeclarationInfo; diff --git a/node_modules/sucrase/dist/types/util/getIdentifierNames.d.ts b/node_modules/sucrase/dist/types/util/getIdentifierNames.d.ts new file mode 100644 index 00000000..9e0d5a25 --- /dev/null +++ b/node_modules/sucrase/dist/types/util/getIdentifierNames.d.ts @@ -0,0 +1,5 @@ +import type { Token } from "../parser/tokenizer"; +/** + * Get all identifier names in the code, in order, including duplicates. + */ +export default function getIdentifierNames(code: string, tokens: Array): Array; diff --git a/node_modules/sucrase/dist/types/util/getImportExportSpecifierInfo.d.ts b/node_modules/sucrase/dist/types/util/getImportExportSpecifierInfo.d.ts new file mode 100644 index 00000000..44d53fc6 --- /dev/null +++ b/node_modules/sucrase/dist/types/util/getImportExportSpecifierInfo.d.ts @@ -0,0 +1,36 @@ +import type TokenProcessor from "../TokenProcessor"; +export type ImportExportSpecifierInfo = { + isType: false; + leftName: string; + rightName: string; + endIndex: number; +} | { + isType: true; + leftName: null; + rightName: null; + endIndex: number; +}; +/** + * Determine information about this named import or named export specifier. + * + * This syntax is the `a` from statements like these: + * import {A} from "./foo"; + * export {A}; + * export {A} from "./foo"; + * + * As it turns out, we can exactly characterize the syntax meaning by simply + * counting the number of tokens, which can be from 1 to 4: + * {A} + * {type A} + * {A as B} + * {type A as B} + * + * In the type case, we never actually need the names in practice, so don't get + * them. + * + * TODO: There's some redundancy with the type detection here and the isType + * flag that's already present on tokens in TS mode. This function could + * potentially be simplified and/or pushed to the call sites to avoid the object + * allocation. + */ +export default function getImportExportSpecifierInfo(tokens: TokenProcessor, index?: number): ImportExportSpecifierInfo; diff --git a/node_modules/sucrase/dist/types/util/getJSXPragmaInfo.d.ts b/node_modules/sucrase/dist/types/util/getJSXPragmaInfo.d.ts new file mode 100644 index 00000000..fec9a485 --- /dev/null +++ b/node_modules/sucrase/dist/types/util/getJSXPragmaInfo.d.ts @@ -0,0 +1,8 @@ +import type { Options } from "../index"; +export interface JSXPragmaInfo { + base: string; + suffix: string; + fragmentBase: string; + fragmentSuffix: string; +} +export default function getJSXPragmaInfo(options: Options): JSXPragmaInfo; diff --git a/node_modules/sucrase/dist/types/util/getNonTypeIdentifiers.d.ts b/node_modules/sucrase/dist/types/util/getNonTypeIdentifiers.d.ts new file mode 100644 index 00000000..3e407689 --- /dev/null +++ b/node_modules/sucrase/dist/types/util/getNonTypeIdentifiers.d.ts @@ -0,0 +1,3 @@ +import type { Options } from "../index"; +import type TokenProcessor from "../TokenProcessor"; +export declare function getNonTypeIdentifiers(tokens: TokenProcessor, options: Options): Set; diff --git a/node_modules/sucrase/dist/types/util/getTSImportedNames.d.ts b/node_modules/sucrase/dist/types/util/getTSImportedNames.d.ts new file mode 100644 index 00000000..bc236e4a --- /dev/null +++ b/node_modules/sucrase/dist/types/util/getTSImportedNames.d.ts @@ -0,0 +1,9 @@ +import type TokenProcessor from "../TokenProcessor"; +/** + * Special case code to scan for imported names in ESM TypeScript. We need to do this so we can + * properly get globals so we can compute shadowed globals. + * + * This is similar to logic in CJSImportProcessor, but trimmed down to avoid logic with CJS + * replacement and flow type imports. + */ +export default function getTSImportedNames(tokens: TokenProcessor): Set; diff --git a/node_modules/sucrase/dist/types/util/isAsyncOperation.d.ts b/node_modules/sucrase/dist/types/util/isAsyncOperation.d.ts new file mode 100644 index 00000000..3ad00364 --- /dev/null +++ b/node_modules/sucrase/dist/types/util/isAsyncOperation.d.ts @@ -0,0 +1,11 @@ +import type TokenProcessor from "../TokenProcessor"; +/** + * Determine whether this optional chain or nullish coalescing operation has any await statements in + * it. If so, we'll need to transpile to an async operation. + * + * We compute this by walking the length of the operation and returning true if we see an await + * keyword used as a real await (rather than an object key or property access). Nested optional + * chain/nullish operations need to be tracked but don't silence await, but a nested async function + * (or any other nested scope) will make the await not count. + */ +export default function isAsyncOperation(tokens: TokenProcessor): boolean; diff --git a/node_modules/sucrase/dist/types/util/isExportFrom.d.ts b/node_modules/sucrase/dist/types/util/isExportFrom.d.ts new file mode 100644 index 00000000..abf0b4dd --- /dev/null +++ b/node_modules/sucrase/dist/types/util/isExportFrom.d.ts @@ -0,0 +1,6 @@ +import type TokenProcessor from "../TokenProcessor"; +/** + * Starting at `export {`, look ahead and return `true` if this is an + * `export {...} from` statement and `false` if this is a plain multi-export. + */ +export default function isExportFrom(tokens: TokenProcessor): boolean; diff --git a/node_modules/sucrase/dist/types/util/isIdentifier.d.ts b/node_modules/sucrase/dist/types/util/isIdentifier.d.ts new file mode 100644 index 00000000..b39af27b --- /dev/null +++ b/node_modules/sucrase/dist/types/util/isIdentifier.d.ts @@ -0,0 +1,8 @@ +/** + * Determine if the given name is a legal variable name. + * + * This is needed when transforming TypeScript enums; if an enum key is a valid + * variable name, it might be referenced later in the enum, so we need to + * declare a variable. + */ +export default function isIdentifier(name: string): boolean; diff --git a/node_modules/sucrase/dist/types/util/removeMaybeImportAttributes.d.ts b/node_modules/sucrase/dist/types/util/removeMaybeImportAttributes.d.ts new file mode 100644 index 00000000..0d7ca6e7 --- /dev/null +++ b/node_modules/sucrase/dist/types/util/removeMaybeImportAttributes.d.ts @@ -0,0 +1,6 @@ +import type TokenProcessor from "../TokenProcessor"; +/** + * Starting at a potential `with` or (legacy) `assert` token, remove the import + * attributes if they exist. + */ +export declare function removeMaybeImportAttributes(tokens: TokenProcessor): void; diff --git a/node_modules/sucrase/dist/types/util/shouldElideDefaultExport.d.ts b/node_modules/sucrase/dist/types/util/shouldElideDefaultExport.d.ts new file mode 100644 index 00000000..f774c14d --- /dev/null +++ b/node_modules/sucrase/dist/types/util/shouldElideDefaultExport.d.ts @@ -0,0 +1,6 @@ +import type TokenProcessor from "../TokenProcessor"; +import type { DeclarationInfo } from "./getDeclarationInfo"; +/** + * Common method sharing code between CJS and ESM cases, since they're the same here. + */ +export default function shouldElideDefaultExport(isTypeScriptTransformEnabled: boolean, keepUnusedImports: boolean, tokens: TokenProcessor, declarationInfo: DeclarationInfo): boolean; diff --git a/node_modules/sucrase/dist/util/elideImportEquals.js b/node_modules/sucrase/dist/util/elideImportEquals.js new file mode 100644 index 00000000..c6ef30f0 --- /dev/null +++ b/node_modules/sucrase/dist/util/elideImportEquals.js @@ -0,0 +1,29 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _types = require('../parser/tokenizer/types'); + + + function elideImportEquals(tokens) { + // import + tokens.removeInitialToken(); + // name + tokens.removeToken(); + // = + tokens.removeToken(); + // name or require + tokens.removeToken(); + // Handle either `import A = require('A')` or `import A = B.C.D`. + if (tokens.matches1(_types.TokenType.parenL)) { + // ( + tokens.removeToken(); + // path string + tokens.removeToken(); + // ) + tokens.removeToken(); + } else { + while (tokens.matches1(_types.TokenType.dot)) { + // . + tokens.removeToken(); + // name + tokens.removeToken(); + } + } +} exports.default = elideImportEquals; diff --git a/node_modules/sucrase/dist/util/formatTokens.js b/node_modules/sucrase/dist/util/formatTokens.js new file mode 100644 index 00000000..c663633e --- /dev/null +++ b/node_modules/sucrase/dist/util/formatTokens.js @@ -0,0 +1,74 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _linesandcolumns = require('lines-and-columns'); var _linesandcolumns2 = _interopRequireDefault(_linesandcolumns); + + +var _types = require('../parser/tokenizer/types'); + + function formatTokens(code, tokens) { + if (tokens.length === 0) { + return ""; + } + + const tokenKeys = Object.keys(tokens[0]).filter( + (k) => k !== "type" && k !== "value" && k !== "start" && k !== "end" && k !== "loc", + ); + const typeKeys = Object.keys(tokens[0].type).filter((k) => k !== "label" && k !== "keyword"); + + const headings = ["Location", "Label", "Raw", ...tokenKeys, ...typeKeys]; + + const lines = new (0, _linesandcolumns2.default)(code); + const rows = [headings, ...tokens.map(getTokenComponents)]; + const padding = headings.map(() => 0); + for (const components of rows) { + for (let i = 0; i < components.length; i++) { + padding[i] = Math.max(padding[i], components[i].length); + } + } + return rows + .map((components) => components.map((component, i) => component.padEnd(padding[i])).join(" ")) + .join("\n"); + + function getTokenComponents(token) { + const raw = code.slice(token.start, token.end); + return [ + formatRange(token.start, token.end), + _types.formatTokenType.call(void 0, token.type), + truncate(String(raw), 14), + // @ts-ignore: Intentional dynamic access by key. + ...tokenKeys.map((key) => formatValue(token[key], key)), + // @ts-ignore: Intentional dynamic access by key. + ...typeKeys.map((key) => formatValue(token.type[key], key)), + ]; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function formatValue(value, key) { + if (value === true) { + return key; + } else if (value === false || value === null) { + return ""; + } else { + return String(value); + } + } + + function formatRange(start, end) { + return `${formatPos(start)}-${formatPos(end)}`; + } + + function formatPos(pos) { + const location = lines.locationForIndex(pos); + if (!location) { + return "Unknown"; + } else { + return `${location.line + 1}:${location.column + 1}`; + } + } +} exports.default = formatTokens; + +function truncate(s, length) { + if (s.length > length) { + return `${s.slice(0, length - 3)}...`; + } else { + return s; + } +} diff --git a/node_modules/sucrase/dist/util/getClassInfo.js b/node_modules/sucrase/dist/util/getClassInfo.js new file mode 100644 index 00000000..510a7712 --- /dev/null +++ b/node_modules/sucrase/dist/util/getClassInfo.js @@ -0,0 +1,352 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); + +var _keywords = require('../parser/tokenizer/keywords'); +var _types = require('../parser/tokenizer/types'); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + * Get information about the class fields for this class, given a token processor pointing to the + * open-brace at the start of the class. + */ + function getClassInfo( + rootTransformer, + tokens, + nameManager, + disableESTransforms, +) { + const snapshot = tokens.snapshot(); + + const headerInfo = processClassHeader(tokens); + + let constructorInitializerStatements = []; + const instanceInitializerNames = []; + const staticInitializerNames = []; + let constructorInsertPos = null; + const fields = []; + const rangesToRemove = []; + + const classContextId = tokens.currentToken().contextId; + if (classContextId == null) { + throw new Error("Expected non-null class context ID on class open-brace."); + } + + tokens.nextToken(); + while (!tokens.matchesContextIdAndLabel(_types.TokenType.braceR, classContextId)) { + if (tokens.matchesContextual(_keywords.ContextualKeyword._constructor) && !tokens.currentToken().isType) { + ({constructorInitializerStatements, constructorInsertPos} = processConstructor(tokens)); + } else if (tokens.matches1(_types.TokenType.semi)) { + if (!disableESTransforms) { + rangesToRemove.push({start: tokens.currentIndex(), end: tokens.currentIndex() + 1}); + } + tokens.nextToken(); + } else if (tokens.currentToken().isType) { + tokens.nextToken(); + } else { + // Either a method or a field. Skip to the identifier part. + const statementStartIndex = tokens.currentIndex(); + let isStatic = false; + let isESPrivate = false; + let isDeclareOrAbstract = false; + while (isAccessModifier(tokens.currentToken())) { + if (tokens.matches1(_types.TokenType._static)) { + isStatic = true; + } + if (tokens.matches1(_types.TokenType.hash)) { + isESPrivate = true; + } + if (tokens.matches1(_types.TokenType._declare) || tokens.matches1(_types.TokenType._abstract)) { + isDeclareOrAbstract = true; + } + tokens.nextToken(); + } + if (isStatic && tokens.matches1(_types.TokenType.braceL)) { + // This is a static block, so don't process it in any special way. + skipToNextClassElement(tokens, classContextId); + continue; + } + if (isESPrivate) { + // Sucrase doesn't attempt to transpile private fields; just leave them as-is. + skipToNextClassElement(tokens, classContextId); + continue; + } + if ( + tokens.matchesContextual(_keywords.ContextualKeyword._constructor) && + !tokens.currentToken().isType + ) { + ({constructorInitializerStatements, constructorInsertPos} = processConstructor(tokens)); + continue; + } + + const nameStartIndex = tokens.currentIndex(); + skipFieldName(tokens); + if (tokens.matches1(_types.TokenType.lessThan) || tokens.matches1(_types.TokenType.parenL)) { + // This is a method, so nothing to process. + skipToNextClassElement(tokens, classContextId); + continue; + } + // There might be a type annotation that we need to skip. + while (tokens.currentToken().isType) { + tokens.nextToken(); + } + if (tokens.matches1(_types.TokenType.eq)) { + const equalsIndex = tokens.currentIndex(); + // This is an initializer, so we need to wrap in an initializer method. + const valueEnd = tokens.currentToken().rhsEndIndex; + if (valueEnd == null) { + throw new Error("Expected rhsEndIndex on class field assignment."); + } + tokens.nextToken(); + while (tokens.currentIndex() < valueEnd) { + rootTransformer.processToken(); + } + let initializerName; + if (isStatic) { + initializerName = nameManager.claimFreeName("__initStatic"); + staticInitializerNames.push(initializerName); + } else { + initializerName = nameManager.claimFreeName("__init"); + instanceInitializerNames.push(initializerName); + } + // Fields start at the name, so `static x = 1;` has a field range of `x = 1;`. + fields.push({ + initializerName, + equalsIndex, + start: nameStartIndex, + end: tokens.currentIndex(), + }); + } else if (!disableESTransforms || isDeclareOrAbstract) { + // This is a regular field declaration, like `x;`. With the class transform enabled, we just + // remove the line so that no output is produced. With the class transform disabled, we + // usually want to preserve the declaration (but still strip types), but if the `declare` + // or `abstract` keyword is specified, we should remove the line to avoid initializing the + // value to undefined. + rangesToRemove.push({start: statementStartIndex, end: tokens.currentIndex()}); + } + } + } + + tokens.restoreToSnapshot(snapshot); + if (disableESTransforms) { + // With ES transforms disabled, we don't want to transform regular class + // field declarations, and we don't need to do any additional tricks to + // reference the constructor for static init, but we still need to transform + // TypeScript field initializers defined as constructor parameters and we + // still need to remove `declare` fields. For now, we run the same code + // path but omit any field information, as if the class had no field + // declarations. In the future, when we fully drop the class fields + // transform, we can simplify this code significantly. + return { + headerInfo, + constructorInitializerStatements, + instanceInitializerNames: [], + staticInitializerNames: [], + constructorInsertPos, + fields: [], + rangesToRemove, + }; + } else { + return { + headerInfo, + constructorInitializerStatements, + instanceInitializerNames, + staticInitializerNames, + constructorInsertPos, + fields, + rangesToRemove, + }; + } +} exports.default = getClassInfo; + +/** + * Move the token processor to the next method/field in the class. + * + * To do that, we seek forward to the next start of a class name (either an open + * bracket or an identifier, or the closing curly brace), then seek backward to + * include any access modifiers. + */ +function skipToNextClassElement(tokens, classContextId) { + tokens.nextToken(); + while (tokens.currentToken().contextId !== classContextId) { + tokens.nextToken(); + } + while (isAccessModifier(tokens.tokenAtRelativeIndex(-1))) { + tokens.previousToken(); + } +} + +function processClassHeader(tokens) { + const classToken = tokens.currentToken(); + const contextId = classToken.contextId; + if (contextId == null) { + throw new Error("Expected context ID on class token."); + } + const isExpression = classToken.isExpression; + if (isExpression == null) { + throw new Error("Expected isExpression on class token."); + } + let className = null; + let hasSuperclass = false; + tokens.nextToken(); + if (tokens.matches1(_types.TokenType.name)) { + className = tokens.identifierName(); + } + while (!tokens.matchesContextIdAndLabel(_types.TokenType.braceL, contextId)) { + // If this has a superclass, there will always be an `extends` token. If it doesn't have a + // superclass, only type parameters and `implements` clauses can show up here, all of which + // consist only of type tokens. A declaration like `class A {` should *not* count + // as having a superclass. + if (tokens.matches1(_types.TokenType._extends) && !tokens.currentToken().isType) { + hasSuperclass = true; + } + tokens.nextToken(); + } + return {isExpression, className, hasSuperclass}; +} + +/** + * Extract useful information out of a constructor, starting at the "constructor" name. + */ +function processConstructor(tokens) + + + { + const constructorInitializerStatements = []; + + tokens.nextToken(); + const constructorContextId = tokens.currentToken().contextId; + if (constructorContextId == null) { + throw new Error("Expected context ID on open-paren starting constructor params."); + } + // Advance through parameters looking for access modifiers. + while (!tokens.matchesContextIdAndLabel(_types.TokenType.parenR, constructorContextId)) { + if (tokens.currentToken().contextId === constructorContextId) { + // Current token is an open paren or comma just before a param, so check + // that param for access modifiers. + tokens.nextToken(); + if (isAccessModifier(tokens.currentToken())) { + tokens.nextToken(); + while (isAccessModifier(tokens.currentToken())) { + tokens.nextToken(); + } + const token = tokens.currentToken(); + if (token.type !== _types.TokenType.name) { + throw new Error("Expected identifier after access modifiers in constructor arg."); + } + const name = tokens.identifierNameForToken(token); + constructorInitializerStatements.push(`this.${name} = ${name}`); + } + } else { + tokens.nextToken(); + } + } + // ) + tokens.nextToken(); + // Constructor type annotations are invalid, but skip them anyway since + // they're easy to skip. + while (tokens.currentToken().isType) { + tokens.nextToken(); + } + let constructorInsertPos = tokens.currentIndex(); + + // Advance through body looking for a super call. + let foundSuperCall = false; + while (!tokens.matchesContextIdAndLabel(_types.TokenType.braceR, constructorContextId)) { + if (!foundSuperCall && tokens.matches2(_types.TokenType._super, _types.TokenType.parenL)) { + tokens.nextToken(); + const superCallContextId = tokens.currentToken().contextId; + if (superCallContextId == null) { + throw new Error("Expected a context ID on the super call"); + } + while (!tokens.matchesContextIdAndLabel(_types.TokenType.parenR, superCallContextId)) { + tokens.nextToken(); + } + constructorInsertPos = tokens.currentIndex(); + foundSuperCall = true; + } + tokens.nextToken(); + } + // } + tokens.nextToken(); + + return {constructorInitializerStatements, constructorInsertPos}; +} + +/** + * Determine if this is any token that can go before the name in a method/field. + */ +function isAccessModifier(token) { + return [ + _types.TokenType._async, + _types.TokenType._get, + _types.TokenType._set, + _types.TokenType.plus, + _types.TokenType.minus, + _types.TokenType._readonly, + _types.TokenType._static, + _types.TokenType._public, + _types.TokenType._private, + _types.TokenType._protected, + _types.TokenType._override, + _types.TokenType._abstract, + _types.TokenType.star, + _types.TokenType._declare, + _types.TokenType.hash, + ].includes(token.type); +} + +/** + * The next token or set of tokens is either an identifier or an expression in square brackets, for + * a method or field name. + */ +function skipFieldName(tokens) { + if (tokens.matches1(_types.TokenType.bracketL)) { + const startToken = tokens.currentToken(); + const classContextId = startToken.contextId; + if (classContextId == null) { + throw new Error("Expected class context ID on computed name open bracket."); + } + while (!tokens.matchesContextIdAndLabel(_types.TokenType.bracketR, classContextId)) { + tokens.nextToken(); + } + tokens.nextToken(); + } else { + tokens.nextToken(); + } +} diff --git a/node_modules/sucrase/dist/util/getDeclarationInfo.js b/node_modules/sucrase/dist/util/getDeclarationInfo.js new file mode 100644 index 00000000..465fc066 --- /dev/null +++ b/node_modules/sucrase/dist/util/getDeclarationInfo.js @@ -0,0 +1,40 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _tokenizer = require('../parser/tokenizer'); +var _types = require('../parser/tokenizer/types'); + + + + + + + + const EMPTY_DECLARATION_INFO = { + typeDeclarations: new Set(), + valueDeclarations: new Set(), +}; exports.EMPTY_DECLARATION_INFO = EMPTY_DECLARATION_INFO; + +/** + * Get all top-level identifiers that should be preserved when exported in TypeScript. + * + * Examples: + * - If an identifier is declared as `const x`, then `export {x}` should be preserved. + * - If it's declared as `type x`, then `export {x}` should be removed. + * - If it's declared as both `const x` and `type x`, then the export should be preserved. + * - Classes and enums should be preserved (even though they also introduce types). + * - Imported identifiers should be preserved since we don't have enough information to + * rule them out. --isolatedModules disallows re-exports, which catches errors here. + */ + function getDeclarationInfo(tokens) { + const typeDeclarations = new Set(); + const valueDeclarations = new Set(); + for (let i = 0; i < tokens.tokens.length; i++) { + const token = tokens.tokens[i]; + if (token.type === _types.TokenType.name && _tokenizer.isTopLevelDeclaration.call(void 0, token)) { + if (token.isType) { + typeDeclarations.add(tokens.identifierNameForToken(token)); + } else { + valueDeclarations.add(tokens.identifierNameForToken(token)); + } + } + } + return {typeDeclarations, valueDeclarations}; +} exports.default = getDeclarationInfo; diff --git a/node_modules/sucrase/dist/util/getIdentifierNames.js b/node_modules/sucrase/dist/util/getIdentifierNames.js new file mode 100644 index 00000000..c0195cae --- /dev/null +++ b/node_modules/sucrase/dist/util/getIdentifierNames.js @@ -0,0 +1,15 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); +var _types = require('../parser/tokenizer/types'); + +/** + * Get all identifier names in the code, in order, including duplicates. + */ + function getIdentifierNames(code, tokens) { + const names = []; + for (const token of tokens) { + if (token.type === _types.TokenType.name) { + names.push(code.slice(token.start, token.end)); + } + } + return names; +} exports.default = getIdentifierNames; diff --git a/node_modules/sucrase/dist/util/getImportExportSpecifierInfo.js b/node_modules/sucrase/dist/util/getImportExportSpecifierInfo.js new file mode 100644 index 00000000..45edb74b --- /dev/null +++ b/node_modules/sucrase/dist/util/getImportExportSpecifierInfo.js @@ -0,0 +1,92 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _types = require('../parser/tokenizer/types'); + + + + + + + + + + + + + + + + +/** + * Determine information about this named import or named export specifier. + * + * This syntax is the `a` from statements like these: + * import {A} from "./foo"; + * export {A}; + * export {A} from "./foo"; + * + * As it turns out, we can exactly characterize the syntax meaning by simply + * counting the number of tokens, which can be from 1 to 4: + * {A} + * {type A} + * {A as B} + * {type A as B} + * + * In the type case, we never actually need the names in practice, so don't get + * them. + * + * TODO: There's some redundancy with the type detection here and the isType + * flag that's already present on tokens in TS mode. This function could + * potentially be simplified and/or pushed to the call sites to avoid the object + * allocation. + */ + function getImportExportSpecifierInfo( + tokens, + index = tokens.currentIndex(), +) { + let endIndex = index + 1; + if (isSpecifierEnd(tokens, endIndex)) { + // import {A} + const name = tokens.identifierNameAtIndex(index); + return { + isType: false, + leftName: name, + rightName: name, + endIndex, + }; + } + endIndex++; + if (isSpecifierEnd(tokens, endIndex)) { + // import {type A} + return { + isType: true, + leftName: null, + rightName: null, + endIndex, + }; + } + endIndex++; + if (isSpecifierEnd(tokens, endIndex)) { + // import {A as B} + return { + isType: false, + leftName: tokens.identifierNameAtIndex(index), + rightName: tokens.identifierNameAtIndex(index + 2), + endIndex, + }; + } + endIndex++; + if (isSpecifierEnd(tokens, endIndex)) { + // import {type A as B} + return { + isType: true, + leftName: null, + rightName: null, + endIndex, + }; + } + throw new Error(`Unexpected import/export specifier at ${index}`); +} exports.default = getImportExportSpecifierInfo; + +function isSpecifierEnd(tokens, index) { + const token = tokens.tokens[index]; + return token.type === _types.TokenType.braceR || token.type === _types.TokenType.comma; +} diff --git a/node_modules/sucrase/dist/util/getJSXPragmaInfo.js b/node_modules/sucrase/dist/util/getJSXPragmaInfo.js new file mode 100644 index 00000000..67513db0 --- /dev/null +++ b/node_modules/sucrase/dist/util/getJSXPragmaInfo.js @@ -0,0 +1,22 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); + + + + + + + + + function getJSXPragmaInfo(options) { + const [base, suffix] = splitPragma(options.jsxPragma || "React.createElement"); + const [fragmentBase, fragmentSuffix] = splitPragma(options.jsxFragmentPragma || "React.Fragment"); + return {base, suffix, fragmentBase, fragmentSuffix}; +} exports.default = getJSXPragmaInfo; + +function splitPragma(pragma) { + let dotIndex = pragma.indexOf("."); + if (dotIndex === -1) { + dotIndex = pragma.length; + } + return [pragma.slice(0, dotIndex), pragma.slice(dotIndex)]; +} diff --git a/node_modules/sucrase/dist/util/getNonTypeIdentifiers.js b/node_modules/sucrase/dist/util/getNonTypeIdentifiers.js new file mode 100644 index 00000000..86d9daf3 --- /dev/null +++ b/node_modules/sucrase/dist/util/getNonTypeIdentifiers.js @@ -0,0 +1,43 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _tokenizer = require('../parser/tokenizer'); +var _types = require('../parser/tokenizer/types'); + +var _JSXTransformer = require('../transformers/JSXTransformer'); +var _getJSXPragmaInfo = require('./getJSXPragmaInfo'); var _getJSXPragmaInfo2 = _interopRequireDefault(_getJSXPragmaInfo); + + function getNonTypeIdentifiers(tokens, options) { + const jsxPragmaInfo = _getJSXPragmaInfo2.default.call(void 0, options); + const nonTypeIdentifiers = new Set(); + for (let i = 0; i < tokens.tokens.length; i++) { + const token = tokens.tokens[i]; + if ( + token.type === _types.TokenType.name && + !token.isType && + (token.identifierRole === _tokenizer.IdentifierRole.Access || + token.identifierRole === _tokenizer.IdentifierRole.ObjectShorthand || + token.identifierRole === _tokenizer.IdentifierRole.ExportAccess) && + !token.shadowsGlobal + ) { + nonTypeIdentifiers.add(tokens.identifierNameForToken(token)); + } + if (token.type === _types.TokenType.jsxTagStart) { + nonTypeIdentifiers.add(jsxPragmaInfo.base); + } + if ( + token.type === _types.TokenType.jsxTagStart && + i + 1 < tokens.tokens.length && + tokens.tokens[i + 1].type === _types.TokenType.jsxTagEnd + ) { + nonTypeIdentifiers.add(jsxPragmaInfo.base); + nonTypeIdentifiers.add(jsxPragmaInfo.fragmentBase); + } + if (token.type === _types.TokenType.jsxName && token.identifierRole === _tokenizer.IdentifierRole.Access) { + const identifierName = tokens.identifierNameForToken(token); + // Lower-case single-component tag names like "div" don't count. + if (!_JSXTransformer.startsWithLowerCase.call(void 0, identifierName) || tokens.tokens[i + 1].type === _types.TokenType.dot) { + nonTypeIdentifiers.add(tokens.identifierNameForToken(token)); + } + } + } + return nonTypeIdentifiers; +} exports.getNonTypeIdentifiers = getNonTypeIdentifiers; diff --git a/node_modules/sucrase/dist/util/getTSImportedNames.js b/node_modules/sucrase/dist/util/getTSImportedNames.js new file mode 100644 index 00000000..5c5362cf --- /dev/null +++ b/node_modules/sucrase/dist/util/getTSImportedNames.js @@ -0,0 +1,84 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _types = require('../parser/tokenizer/types'); + +var _getImportExportSpecifierInfo = require('./getImportExportSpecifierInfo'); var _getImportExportSpecifierInfo2 = _interopRequireDefault(_getImportExportSpecifierInfo); + +/** + * Special case code to scan for imported names in ESM TypeScript. We need to do this so we can + * properly get globals so we can compute shadowed globals. + * + * This is similar to logic in CJSImportProcessor, but trimmed down to avoid logic with CJS + * replacement and flow type imports. + */ + function getTSImportedNames(tokens) { + const importedNames = new Set(); + for (let i = 0; i < tokens.tokens.length; i++) { + if ( + tokens.matches1AtIndex(i, _types.TokenType._import) && + !tokens.matches3AtIndex(i, _types.TokenType._import, _types.TokenType.name, _types.TokenType.eq) + ) { + collectNamesForImport(tokens, i, importedNames); + } + } + return importedNames; +} exports.default = getTSImportedNames; + +function collectNamesForImport( + tokens, + index, + importedNames, +) { + index++; + + if (tokens.matches1AtIndex(index, _types.TokenType.parenL)) { + // Dynamic import, so nothing to do + return; + } + + if (tokens.matches1AtIndex(index, _types.TokenType.name)) { + importedNames.add(tokens.identifierNameAtIndex(index)); + index++; + if (tokens.matches1AtIndex(index, _types.TokenType.comma)) { + index++; + } + } + + if (tokens.matches1AtIndex(index, _types.TokenType.star)) { + // * as + index += 2; + importedNames.add(tokens.identifierNameAtIndex(index)); + index++; + } + + if (tokens.matches1AtIndex(index, _types.TokenType.braceL)) { + index++; + collectNamesForNamedImport(tokens, index, importedNames); + } +} + +function collectNamesForNamedImport( + tokens, + index, + importedNames, +) { + while (true) { + if (tokens.matches1AtIndex(index, _types.TokenType.braceR)) { + return; + } + + const specifierInfo = _getImportExportSpecifierInfo2.default.call(void 0, tokens, index); + index = specifierInfo.endIndex; + if (!specifierInfo.isType) { + importedNames.add(specifierInfo.rightName); + } + + if (tokens.matches2AtIndex(index, _types.TokenType.comma, _types.TokenType.braceR)) { + return; + } else if (tokens.matches1AtIndex(index, _types.TokenType.braceR)) { + return; + } else if (tokens.matches1AtIndex(index, _types.TokenType.comma)) { + index++; + } else { + throw new Error(`Unexpected token: ${JSON.stringify(tokens.tokens[index])}`); + } + } +} diff --git a/node_modules/sucrase/dist/util/isAsyncOperation.js b/node_modules/sucrase/dist/util/isAsyncOperation.js new file mode 100644 index 00000000..c02023ad --- /dev/null +++ b/node_modules/sucrase/dist/util/isAsyncOperation.js @@ -0,0 +1,38 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _keywords = require('../parser/tokenizer/keywords'); + + +/** + * Determine whether this optional chain or nullish coalescing operation has any await statements in + * it. If so, we'll need to transpile to an async operation. + * + * We compute this by walking the length of the operation and returning true if we see an await + * keyword used as a real await (rather than an object key or property access). Nested optional + * chain/nullish operations need to be tracked but don't silence await, but a nested async function + * (or any other nested scope) will make the await not count. + */ + function isAsyncOperation(tokens) { + let index = tokens.currentIndex(); + let depth = 0; + const startToken = tokens.currentToken(); + do { + const token = tokens.tokens[index]; + if (token.isOptionalChainStart) { + depth++; + } + if (token.isOptionalChainEnd) { + depth--; + } + depth += token.numNullishCoalesceStarts; + depth -= token.numNullishCoalesceEnds; + + if ( + token.contextualKeyword === _keywords.ContextualKeyword._await && + token.identifierRole == null && + token.scopeDepth === startToken.scopeDepth + ) { + return true; + } + index += 1; + } while (depth > 0 && index < tokens.tokens.length); + return false; +} exports.default = isAsyncOperation; diff --git a/node_modules/sucrase/dist/util/isExportFrom.js b/node_modules/sucrase/dist/util/isExportFrom.js new file mode 100644 index 00000000..830a0fe5 --- /dev/null +++ b/node_modules/sucrase/dist/util/isExportFrom.js @@ -0,0 +1,18 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _keywords = require('../parser/tokenizer/keywords'); +var _types = require('../parser/tokenizer/types'); + + +/** + * Starting at `export {`, look ahead and return `true` if this is an + * `export {...} from` statement and `false` if this is a plain multi-export. + */ + function isExportFrom(tokens) { + let closeBraceIndex = tokens.currentIndex(); + while (!tokens.matches1AtIndex(closeBraceIndex, _types.TokenType.braceR)) { + closeBraceIndex++; + } + return ( + tokens.matchesContextualAtIndex(closeBraceIndex + 1, _keywords.ContextualKeyword._from) && + tokens.matches1AtIndex(closeBraceIndex + 2, _types.TokenType.string) + ); +} exports.default = isExportFrom; diff --git a/node_modules/sucrase/dist/util/isIdentifier.js b/node_modules/sucrase/dist/util/isIdentifier.js new file mode 100644 index 00000000..8be8cf43 --- /dev/null +++ b/node_modules/sucrase/dist/util/isIdentifier.js @@ -0,0 +1,81 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _identifier = require('../parser/util/identifier'); + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar +// Hard-code a list of reserved words rather than trying to use keywords or contextual keywords +// from the parser, since currently there are various exceptions, like `package` being reserved +// but unused and various contextual keywords being reserved. Note that we assume that all code +// compiled by Sucrase is in a module, so strict mode words and await are all considered reserved +// here. +const RESERVED_WORDS = new Set([ + // Reserved keywords as of ECMAScript 2015 + "break", + "case", + "catch", + "class", + "const", + "continue", + "debugger", + "default", + "delete", + "do", + "else", + "export", + "extends", + "finally", + "for", + "function", + "if", + "import", + "in", + "instanceof", + "new", + "return", + "super", + "switch", + "this", + "throw", + "try", + "typeof", + "var", + "void", + "while", + "with", + "yield", + // Future reserved keywords + "enum", + "implements", + "interface", + "let", + "package", + "private", + "protected", + "public", + "static", + "await", + // Literals that cannot be used as identifiers + "false", + "null", + "true", +]); + +/** + * Determine if the given name is a legal variable name. + * + * This is needed when transforming TypeScript enums; if an enum key is a valid + * variable name, it might be referenced later in the enum, so we need to + * declare a variable. + */ + function isIdentifier(name) { + if (name.length === 0) { + return false; + } + if (!_identifier.IS_IDENTIFIER_START[name.charCodeAt(0)]) { + return false; + } + for (let i = 1; i < name.length; i++) { + if (!_identifier.IS_IDENTIFIER_CHAR[name.charCodeAt(i)]) { + return false; + } + } + return !RESERVED_WORDS.has(name); +} exports.default = isIdentifier; diff --git a/node_modules/sucrase/dist/util/removeMaybeImportAttributes.js b/node_modules/sucrase/dist/util/removeMaybeImportAttributes.js new file mode 100644 index 00000000..fd0b1426 --- /dev/null +++ b/node_modules/sucrase/dist/util/removeMaybeImportAttributes.js @@ -0,0 +1,22 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _keywords = require('../parser/tokenizer/keywords'); +var _types = require('../parser/tokenizer/types'); + + +/** + * Starting at a potential `with` or (legacy) `assert` token, remove the import + * attributes if they exist. + */ + function removeMaybeImportAttributes(tokens) { + if ( + tokens.matches2(_types.TokenType._with, _types.TokenType.braceL) || + (tokens.matches2(_types.TokenType.name, _types.TokenType.braceL) && tokens.matchesContextual(_keywords.ContextualKeyword._assert)) + ) { + // assert + tokens.removeToken(); + // { + tokens.removeToken(); + tokens.removeBalancedCode(); + // } + tokens.removeToken(); + } +} exports.removeMaybeImportAttributes = removeMaybeImportAttributes; diff --git a/node_modules/sucrase/dist/util/shouldElideDefaultExport.js b/node_modules/sucrase/dist/util/shouldElideDefaultExport.js new file mode 100644 index 00000000..3525feb6 --- /dev/null +++ b/node_modules/sucrase/dist/util/shouldElideDefaultExport.js @@ -0,0 +1,38 @@ +"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _types = require('../parser/tokenizer/types'); + + + +/** + * Common method sharing code between CJS and ESM cases, since they're the same here. + */ + function shouldElideDefaultExport( + isTypeScriptTransformEnabled, + keepUnusedImports, + tokens, + declarationInfo, +) { + if (!isTypeScriptTransformEnabled || keepUnusedImports) { + return false; + } + const exportToken = tokens.currentToken(); + if (exportToken.rhsEndIndex == null) { + throw new Error("Expected non-null rhsEndIndex on export token."); + } + // The export must be of the form `export default a` or `export default a;`. + const numTokens = exportToken.rhsEndIndex - tokens.currentIndex(); + if ( + numTokens !== 3 && + !(numTokens === 4 && tokens.matches1AtIndex(exportToken.rhsEndIndex - 1, _types.TokenType.semi)) + ) { + return false; + } + const identifierToken = tokens.tokenAtRelativeIndex(2); + if (identifierToken.type !== _types.TokenType.name) { + return false; + } + const exportedName = tokens.identifierNameForToken(identifierToken); + return ( + declarationInfo.typeDeclarations.has(exportedName) && + !declarationInfo.valueDeclarations.has(exportedName) + ); +} exports.default = shouldElideDefaultExport; diff --git a/node_modules/sucrase/node_modules/minimatch/LICENSE b/node_modules/sucrase/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..1493534e --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +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/sucrase/node_modules/minimatch/README.md b/node_modules/sucrase/node_modules/minimatch/README.md new file mode 100644 index 00000000..3c97a02f --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/README.md @@ -0,0 +1,454 @@ +# minimatch + +A minimal matching utility. + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```js +// hybrid module, load with require() or import +import { minimatch } from 'minimatch' +// or: +const { minimatch } = require('minimatch') + +minimatch('bar.foo', '*.foo') // true! +minimatch('bar.foo', '*.bar') // false! +minimatch('bar.foo', '*.+(bar|foo)', { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +- Brace Expansion +- Extended glob matching +- "Globstar" `**` matching +- [Posix character + classes](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html), + like `[[:alpha:]]`, supporting the full range of Unicode + characters. For example, `[[:alpha:]]` will match against + `'é'`, though `[a-zA-Z]` will not. Collating symbol and set + matching is not supported, so `[[=e=]]` will _not_ match `'é'` + and `[[.ch.]]` will not match `'ch'` in locales where `ch` is + considered a single character. + +See: + +- `man sh` +- `man bash` [Pattern + Matching](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) +- `man 3 fnmatch` +- `man 5 gitignore` + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes in patterns +will always be interpreted as escape characters, not path separators. + +Note that `\` or `/` _will_ be interpreted as path separators in paths on +Windows, and will match against `/` in glob expressions. + +So just always use `/` in patterns. + +### UNC Paths + +On Windows, UNC paths like `//?/c:/...` or +`//ComputerName/Share/...` are handled specially. + +- Patterns starting with a double-slash followed by some + non-slash characters will preserve their double-slash. As a + result, a pattern like `//*` will match `//x`, but not `/x`. +- Patterns staring with `//?/:` will _not_ treat + the `?` as a wildcard character. Instead, it will be treated + as a normal string. +- Patterns starting with `//?/:/...` will match + file paths starting with `:/...`, and vice versa, + as if the `//?/` was not present. This behavior only is + present when the drive letters are a case-insensitive match to + one another. The remaining portions of the path/pattern are + compared case sensitively, unless `nocase:true` is set. + +Note that specifying a UNC path using `\` characters as path +separators is always allowed in the file path argument, but only +allowed in the pattern argument when `windowsPathsNoEscape: true` +is set in the options. + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require('minimatch').Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +- `pattern` The original pattern the minimatch object represents. +- `options` The options supplied to the constructor. +- `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +- `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +- `negate` True if the pattern is negated. +- `comment` True if the pattern is a comment. +- `empty` True if the pattern is `""`. + +### Methods + +- `makeRe()` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +- `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +- `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. +- `hasMagic()` Returns true if the parsed pattern contains any + magic characters. Returns false if all comparator parts are + string literals. If the `magicalBraces` option is set on the + constructor, then it will consider brace expansions which are + not otherwise magical to be magic. If not set, then a pattern + like `a{b,c}d` will return `false`, because neither `abd` nor + `acd` contain any special glob characters. + + This does **not** mean that the pattern string can be used as a + literal filename, as it may contain magic glob characters that + are escaped. For example, the pattern `\\*` or `[*]` would not + be considered to have magic, as the matching portion parses to + the literal string `'*'` and would match a path named `'*'`, + not `'\\*'` or `'[*]'`. The `minimatch.unescape()` method may + be used to remove escape characters. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, '*.js', { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter('*.js', { matchBase: true })) +``` + +### minimatch.escape(pattern, options = {}) + +Escape all magic characters in a glob pattern, so that it will +only ever match literal strings + +If the `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. + +Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot +be escaped or unescaped. + +### minimatch.unescape(pattern, options = {}) + +Un-escape a glob string that may contain some escaped characters. + +If the `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 `'*'`, because `\` 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. + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, '*.js', { matchBase: true }) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nocaseMagicOnly + +When used with `{nocase: true}`, create regular expressions that +are case-insensitive, but leave string match portions untouched. +Has no effect when used without `{nocase: true}` + +Useful when some other form of case-insensitive matching is used, +or if the original string representation is useful in some other +way. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### magicalBraces + +This only affects the results of the `Minimatch.hasMagic` method. + +If the pattern contains brace expansions, such as `a{b,c}d`, but +no other magic characters, then the `Minimatch.hasMagic()` method +will return `false` by default. When this option set, it will +return `true` for brace expansion as well as other magic glob +characters. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + +### partial + +Compare a partial path to a pattern. As long as the parts of the path that +are present are not contradicted by the pattern, it will be treated as a +match. This is useful in applications where you're walking through a +folder structure, and don't yet have the full path, but want to ensure that +you do not walk down paths that can never be a match. + +For example, + +```js +minimatch('/a/b', '/a/*/c/d', { partial: true }) // true, might be /a/b/c/d +minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d +minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a +``` + +### windowsPathsNoEscape + +Use `\\` as a path separator _only_, and _never_ as an escape +character. If set, all `\\` characters are replaced with `/` in +the pattern. Note that this makes it **impossible** to match +against paths containing literal glob pattern characters, but +allows matching with patterns constructed using `path.join()` and +`path.resolve()` on Windows platforms, mimicking the (buggy!) +behavior of earlier versions on Windows. Please use with +caution, and be mindful of [the caveat about Windows +paths](#windows). + +For legacy reasons, this is also set if +`options.allowWindowsEscape` is set to the exact value `false`. + +### windowsNoMagicRoot + +When a pattern starts with a UNC path or drive letter, and in +`nocase:true` mode, do not convert the root portions of the +pattern into a case-insensitive regular expression, and instead +leave them as strings. + +This is the default when the platform is `win32` and +`nocase:true` is set. + +### preserveMultipleSlashes + +By default, multiple `/` characters (other than the leading `//` +in a UNC path, see "UNC Paths" above) are treated as a single +`/`. + +That is, a pattern like `a///b` will match the file path `a/b`. + +Set `preserveMultipleSlashes: true` to suppress this behavior. + +### optimizationLevel + +A number indicating the level of optimization that should be done +to the pattern prior to parsing and using it for matches. + +Globstar parts `**` are always converted to `*` when `noglobstar` +is set, and multiple adjacent `**` parts are converted into a +single `**` (ie, `a/**/**/b` will be treated as `a/**/b`, as this +is equivalent in all cases). + +- `0` - Make no further changes. In this mode, `.` and `..` are + maintained in the pattern, meaning that they must also appear + in the same position in the test path string. Eg, a pattern + like `a/*/../c` will match the string `a/b/../c` but not the + string `a/c`. +- `1` - (default) Remove cases where a double-dot `..` follows a + pattern portion that is not `**`, `.`, `..`, or empty `''`. For + example, the pattern `./a/b/../*` is converted to `./a/*`, and + so it will match the path string `./a/c`, but not the path + string `./a/b/../c`. Dots and empty path portions in the + pattern are preserved. +- `2` (or higher) - Much more aggressive optimizations, suitable + for use with file-walking cases: + + - Remove cases where a double-dot `..` follows a pattern + portion that is not `**`, `.`, or empty `''`. Remove empty + and `.` portions of the pattern, where safe to do so (ie, + anywhere other than the last position, the first position, or + the second position in a pattern starting with `/`, as this + may indicate a UNC path on Windows). + - Convert patterns containing `
    /**/../

    /` into the + equivalent `

    /{..,**}/

    /`, where `

    ` is a + a pattern portion other than `.`, `..`, `**`, or empty + `''`. + - Dedupe patterns where a `**` portion is present in one and + omitted in another, and it is not the final path portion, and + they are otherwise equivalent. So `{a/**/b,a/b}` becomes + `a/**/b`, because `**` matches against an empty path portion. + - Dedupe patterns where a `*` portion is present in one, and a + non-dot pattern other than `**`, `.`, `..`, or `''` is in the + same position in the other. So `a/{*,x}/b` becomes `a/*/b`, + because `*` can match against `x`. + + While these optimizations improve the performance of + file-walking use cases such as [glob](http://npm.im/glob) (ie, + the reason this module exists), there are cases where it will + fail to match a literal string that would have been matched in + optimization level 1 or 0. + + Specifically, while the `Minimatch.match()` method will + optimize the file path string in the same ways, resulting in + the same matches, it will fail when tested with the regular + expression provided by `Minimatch.makeRe()`, unless the path + string is first processed with + `minimatch.levelTwoFileOptimize()` or similar. + +### platform + +When set to `win32`, this will trigger all windows-specific +behaviors (special handling for UNC paths, and treating `\` as +separators in file paths for comparison.) + +Defaults to the value of `process.platform`. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a +worthwhile goal, some discrepancies exist between minimatch and +other implementations. Some are intentional, and some are +unavoidable. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +Negated extglob patterns are handled as closely as possible to +Bash semantics, but there are some cases with negative extglobs +which are exceedingly difficult to express in a JavaScript +regular expression. In particular the negated pattern +`!(*|)*` will in bash match anything that does +not start with ``. However, +`!(*)*` _will_ match paths starting with +``, because the empty string can match against +the negated portion. In this library, `!(*|)*` +will _not_ match any pattern starting with ``, due to a +difference in precisely which patterns are considered "greedy" in +Regular Expressions vs bash path expansion. This may be fixable, +but not without incurring some complexity and performance costs, +and the trade-off seems to not be worth pursuing. + +Note that `fnmatch(3)` in libc is an extremely naive string comparison +matcher, which does not do anything special for slashes. This library is +designed to be used in glob searching and file walkers, and so it does do +special things with `/`. Thus, `foo*` will not match `foo/bar` in this +library, even though it would in `fnmatch(3)`. diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts new file mode 100644 index 00000000..8e318b23 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts @@ -0,0 +1,2 @@ +export declare const assertValidPattern: (pattern: any) => void; +//# sourceMappingURL=assert-valid-pattern.d.ts.map \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map new file mode 100644 index 00000000..c61c0310 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assert-valid-pattern.d.ts","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAUlD,CAAA"} \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js new file mode 100644 index 00000000..5fc86bbd --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js @@ -0,0 +1,14 @@ +"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/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map new file mode 100644 index 00000000..d43215c6 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assert-valid-pattern.js","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAA;AAC7B,MAAM,kBAAkB,GAA2B,CACxD,OAAY,EACe,EAAE;IAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;KACvC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,EAAE;QACvC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAA;KAC3C;AACH,CAAC,CAAA;AAVY,QAAA,kBAAkB,sBAU9B","sourcesContent":["const MAX_PATTERN_LENGTH = 1024 * 64\nexport const assertValidPattern: (pattern: any) => void = (\n pattern: any\n): asserts pattern is string => {\n if (typeof pattern !== 'string') {\n throw new TypeError('invalid pattern')\n }\n\n if (pattern.length > MAX_PATTERN_LENGTH) {\n throw new TypeError('pattern is too long')\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.d.ts new file mode 100644 index 00000000..b8c1e544 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.d.ts @@ -0,0 +1,20 @@ +import { MinimatchOptions, MMRegExp } from './index.js'; +export type ExtglobType = '!' | '?' | '+' | '*' | '@'; +export declare class AST { + #private; + type: ExtglobType | null; + constructor(type: ExtglobType | null, parent?: AST, options?: MinimatchOptions); + get hasMagic(): boolean | undefined; + toString(): string; + push(...parts: (string | AST)[]): void; + toJSON(): any[]; + isStart(): boolean; + isEnd(): boolean; + copyIn(part: AST | string): void; + clone(parent: AST): AST; + static fromGlob(pattern: string, options?: MinimatchOptions): AST; + toMMPattern(): MMRegExp | string; + get options(): MinimatchOptions; + toRegExpSource(allowDot?: boolean): [re: string, body: string, hasMagic: boolean, uflag: boolean]; +} +//# sourceMappingURL=ast.d.ts.map \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.d.ts.map new file mode 100644 index 00000000..9e7bfb9a --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAwCvD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAkCrD,qBAAa,GAAG;;IACd,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;gBAiBtB,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,GAAE,gBAAqB;IAahC,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAUlC;IAGD,QAAQ,IAAI,MAAM;IA+ClB,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE;IAY/B,MAAM;IAgBN,OAAO,IAAI,OAAO;IAgBlB,KAAK,IAAI,OAAO;IAYhB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM;IAKzB,KAAK,CAAC,MAAM,EAAE,GAAG;IAsIjB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAQ/D,WAAW,IAAI,QAAQ,GAAG,MAAM;IA2BhC,IAAI,OAAO,qBAEV;IAuED,cAAc,CACZ,QAAQ,CAAC,EAAE,OAAO,GACjB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC;CAiMjE"} \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.js b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.js new file mode 100644 index 00000000..7b210962 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.js @@ -0,0 +1,592 @@ +"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, + }); + } + get options() { + return this.#options; + } + // 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/sucrase/node_modules/minimatch/dist/commonjs/ast.js.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.js.map new file mode 100644 index 00000000..8383e433 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/ast.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":";AAAA,8BAA8B;;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E;gBACd,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;oBACzB,EAAE,IAAI,MAAM,CAAA;iBACb;qBAAM;oBACL,QAAQ,GAAG,IAAI,CAAA;iBAChB;gBACD,SAAQ;aACT;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,MAAM,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,IAAA,iCAAU,EAAC,IAAI,EAAE,CAAC,CAAC,CAAA;gBAC7D,IAAI,QAAQ,EAAE;oBACZ,EAAE,IAAI,GAAG,CAAA;oBACT,KAAK,GAAG,KAAK,IAAI,SAAS,CAAA;oBAC1B,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAA;oBACjB,QAAQ,GAAG,QAAQ,IAAI,KAAK,CAAA;oBAC5B,SAAQ;iBACT;aACF;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,IAAI,OAAO,IAAI,IAAI,KAAK,GAAG;oBAAE,EAAE,IAAI,WAAW,CAAA;;oBACzC,EAAE,IAAI,IAAI,CAAA;gBACf,QAAQ,GAAG,IAAI,CAAA;gBACf,SAAQ;aACT;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,EAAE,IAAI,KAAK,CAAA;gBACX,QAAQ,GAAG,IAAI,CAAA;gBACf,SAAQ;aACT;YACD,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,CAAA;SACtB;QACD,OAAO,CAAC,EAAE,EAAE,IAAA,sBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;CACF;AA/kBD,kBA+kBC","sourcesContent":["// parse a single path portion\n\nimport { parseClass } from './brace-expressions.js'\nimport { MinimatchOptions, MMRegExp } from './index.js'\nimport { unescape } from './unescape.js'\n\n// classes [] are handled by the parseClass method\n// for positive extglobs, we sub-parse the contents, and combine,\n// with the appropriate regexp close.\n// for negative extglobs, we sub-parse the contents, but then\n// have to include the rest of the pattern, then the parent, etc.,\n// as the thing that cannot be because RegExp negative lookaheads\n// are different from globs.\n//\n// So for example:\n// a@(i|w!(x|y)z|j)b => ^a(i|w((!?(x|y)zb).*)z|j)b$\n// 1 2 3 4 5 6 1 2 3 46 5 6\n//\n// Assembling the extglob requires not just the negated patterns themselves,\n// but also anything following the negative patterns up to the boundary\n// of the current pattern, plus anything following in the parent pattern.\n//\n//\n// So, first, we parse the string into an AST of extglobs, without turning\n// anything into regexps yet.\n//\n// ['a', {@ [['i'], ['w', {!['x', 'y']}, 'z'], ['j']]}, 'b']\n//\n// Then, for all the negative extglobs, we append whatever comes after in\n// each parent as their tail\n//\n// ['a', {@ [['i'], ['w', {!['x', 'y'], 'z', 'b'}, 'z'], ['j']]}, 'b']\n//\n// Lastly, we turn each of these pieces into a regexp, and join\n//\n// v----- .* because there's more following,\n// v v otherwise, .+ because it must be\n// v v *something* there.\n// ['^a', {@ ['i', 'w(?:(!?(?:x|y).*zb$).*)z', 'j' ]}, 'b$']\n// copy what follows into here--^^^^^\n// ['^a', '(?:i|w(?:(?!(?:x|y).*zb$).*)z|j)', 'b$']\n// ['^a(?:i|w(?:(?!(?:x|y).*zb$).*)z|j)b$']\n\nexport type ExtglobType = '!' | '?' | '+' | '*' | '@'\nconst types = new Set(['!', '?', '+', '*', '@'])\nconst isExtglobType = (c: string): c is ExtglobType =>\n types.has(c as ExtglobType)\n\n// Patterns that get prepended to bind to the start of either the\n// entire string, or just a single path portion, to prevent dots\n// and/or traversal patterns, when needed.\n// Exts don't need the ^ or / bit, because the root binds that already.\nconst startNoTraversal = '(?!(?:^|/)\\\\.\\\\.?(?:$|/))'\nconst startNoDot = '(?!\\\\.)'\n\n// characters that indicate a start of pattern needs the \"no dots\" bit,\n// because a dot *might* be matched. ( is not in the list, because in\n// the case of a child extglob, it will handle the prevention itself.\nconst addPatternStart = new Set(['[', '.'])\n// cases where traversal is A-OK, no dot prevention needed\nconst justDots = new Set(['..', '.'])\nconst reSpecials = new Set('().*{}+?[]^$\\\\!')\nconst regExpEscape = (s: string) =>\n s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// any single thing other than /\nconst qmark = '[^/]'\n\n// * => any number of characters\nconst star = qmark + '*?'\n// use + when we need to ensure that *something* matches, because the * is\n// the only thing in the path portion.\nconst starNoEmpty = qmark + '+?'\n\n// remove the \\ chars that we added if we end up doing a nonmagic compare\n// const deslash = (s: string) => s.replace(/\\\\(.)/g, '$1')\n\nexport class AST {\n type: ExtglobType | null\n readonly #root: AST\n\n #hasMagic?: boolean\n #uflag: boolean = false\n #parts: (string | AST)[] = []\n readonly #parent?: AST\n readonly #parentIndex: number\n #negs: AST[]\n #filledNegs: boolean = false\n #options: MinimatchOptions\n #toString?: string\n // set to true if it's an extglob with no children\n // (which really means one child of '')\n #emptyExt: boolean = false\n\n constructor(\n type: ExtglobType | null,\n parent?: AST,\n options: MinimatchOptions = {}\n ) {\n this.type = type\n // extglobs are inherently magical\n if (type) this.#hasMagic = true\n this.#parent = parent\n this.#root = this.#parent ? this.#parent.#root : this\n this.#options = this.#root === this ? options : this.#root.#options\n this.#negs = this.#root === this ? [] : this.#root.#negs\n if (type === '!' && !this.#root.#filledNegs) this.#negs.push(this)\n this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0\n }\n\n get hasMagic(): boolean | undefined {\n /* c8 ignore start */\n if (this.#hasMagic !== undefined) return this.#hasMagic\n /* c8 ignore stop */\n for (const p of this.#parts) {\n if (typeof p === 'string') continue\n if (p.type || p.hasMagic) return (this.#hasMagic = true)\n }\n // note: will be undefined until we generate the regexp src and find out\n return this.#hasMagic\n }\n\n // reconstructs the pattern\n toString(): string {\n if (this.#toString !== undefined) return this.#toString\n if (!this.type) {\n return (this.#toString = this.#parts.map(p => String(p)).join(''))\n } else {\n return (this.#toString =\n this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')')\n }\n }\n\n #fillNegs() {\n /* c8 ignore start */\n if (this !== this.#root) throw new Error('should only call on root')\n if (this.#filledNegs) return this\n /* c8 ignore stop */\n\n // call toString() once to fill this out\n this.toString()\n this.#filledNegs = true\n let n: AST | undefined\n while ((n = this.#negs.pop())) {\n if (n.type !== '!') continue\n // walk up the tree, appending everthing that comes AFTER parentIndex\n let p: AST | undefined = n\n let pp = p.#parent\n while (pp) {\n for (\n let i = p.#parentIndex + 1;\n !pp.type && i < pp.#parts.length;\n i++\n ) {\n for (const part of n.#parts) {\n /* c8 ignore start */\n if (typeof part === 'string') {\n throw new Error('string part in extglob AST??')\n }\n /* c8 ignore stop */\n part.copyIn(pp.#parts[i])\n }\n }\n p = pp\n pp = p.#parent\n }\n }\n return this\n }\n\n push(...parts: (string | AST)[]) {\n for (const p of parts) {\n if (p === '') continue\n /* c8 ignore start */\n if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {\n throw new Error('invalid part: ' + p)\n }\n /* c8 ignore stop */\n this.#parts.push(p)\n }\n }\n\n toJSON() {\n const ret: any[] =\n this.type === null\n ? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))\n : [this.type, ...this.#parts.map(p => (p as AST).toJSON())]\n if (this.isStart() && !this.type) ret.unshift([])\n if (\n this.isEnd() &&\n (this === this.#root ||\n (this.#root.#filledNegs && this.#parent?.type === '!'))\n ) {\n ret.push({})\n }\n return ret\n }\n\n isStart(): boolean {\n if (this.#root === this) return true\n // if (this.type) return !!this.#parent?.isStart()\n if (!this.#parent?.isStart()) return false\n if (this.#parentIndex === 0) return true\n // if everything AHEAD of this is a negation, then it's still the \"start\"\n const p = this.#parent\n for (let i = 0; i < this.#parentIndex; i++) {\n const pp = p.#parts[i]\n if (!(pp instanceof AST && pp.type === '!')) {\n return false\n }\n }\n return true\n }\n\n isEnd(): boolean {\n if (this.#root === this) return true\n if (this.#parent?.type === '!') return true\n if (!this.#parent?.isEnd()) return false\n if (!this.type) return this.#parent?.isEnd()\n // if not root, it'll always have a parent\n /* c8 ignore start */\n const pl = this.#parent ? this.#parent.#parts.length : 0\n /* c8 ignore stop */\n return this.#parentIndex === pl - 1\n }\n\n copyIn(part: AST | string) {\n if (typeof part === 'string') this.push(part)\n else this.push(part.clone(this))\n }\n\n clone(parent: AST) {\n const c = new AST(this.type, parent)\n for (const p of this.#parts) {\n c.copyIn(p)\n }\n return c\n }\n\n static #parseAST(\n str: string,\n ast: AST,\n pos: number,\n opt: MinimatchOptions\n ): number {\n let escaping = false\n let inBrace = false\n let braceStart = -1\n let braceNeg = false\n if (ast.type === null) {\n // outside of a extglob, append until we find a start\n let i = pos\n let acc = ''\n while (i < str.length) {\n const c = str.charAt(i++)\n // still accumulate escapes at this point, but we do ignore\n // starts that are escaped\n if (escaping || c === '\\\\') {\n escaping = !escaping\n acc += c\n continue\n }\n\n if (inBrace) {\n if (i === braceStart + 1) {\n if (c === '^' || c === '!') {\n braceNeg = true\n }\n } else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {\n inBrace = false\n }\n acc += c\n continue\n } else if (c === '[') {\n inBrace = true\n braceStart = i\n braceNeg = false\n acc += c\n continue\n }\n\n if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {\n ast.push(acc)\n acc = ''\n const ext = new AST(c, ast)\n i = AST.#parseAST(str, ext, i, opt)\n ast.push(ext)\n continue\n }\n acc += c\n }\n ast.push(acc)\n return i\n }\n\n // some kind of extglob, pos is at the (\n // find the next | or )\n let i = pos + 1\n let part = new AST(null, ast)\n const parts: AST[] = []\n let acc = ''\n while (i < str.length) {\n const c = str.charAt(i++)\n // still accumulate escapes at this point, but we do ignore\n // starts that are escaped\n if (escaping || c === '\\\\') {\n escaping = !escaping\n acc += c\n continue\n }\n\n if (inBrace) {\n if (i === braceStart + 1) {\n if (c === '^' || c === '!') {\n braceNeg = true\n }\n } else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {\n inBrace = false\n }\n acc += c\n continue\n } else if (c === '[') {\n inBrace = true\n braceStart = i\n braceNeg = false\n acc += c\n continue\n }\n\n if (isExtglobType(c) && str.charAt(i) === '(') {\n part.push(acc)\n acc = ''\n const ext = new AST(c, part)\n part.push(ext)\n i = AST.#parseAST(str, ext, i, opt)\n continue\n }\n if (c === '|') {\n part.push(acc)\n acc = ''\n parts.push(part)\n part = new AST(null, ast)\n continue\n }\n if (c === ')') {\n if (acc === '' && ast.#parts.length === 0) {\n ast.#emptyExt = true\n }\n part.push(acc)\n acc = ''\n ast.push(...parts, part)\n return i\n }\n acc += c\n }\n\n // unfinished extglob\n // if we got here, it was a malformed extglob! not an extglob, but\n // maybe something else in there.\n ast.type = null\n ast.#hasMagic = undefined\n ast.#parts = [str.substring(pos - 1)]\n return i\n }\n\n static fromGlob(pattern: string, options: MinimatchOptions = {}) {\n const ast = new AST(null, undefined, options)\n AST.#parseAST(pattern, ast, 0, options)\n return ast\n }\n\n // returns the regular expression if there's magic, or the unescaped\n // string if not.\n toMMPattern(): MMRegExp | string {\n // should only be called on root\n /* c8 ignore start */\n if (this !== this.#root) return this.#root.toMMPattern()\n /* c8 ignore stop */\n const glob = this.toString()\n const [re, body, hasMagic, uflag] = this.toRegExpSource()\n // if we're in nocase mode, and not nocaseMagicOnly, then we do\n // still need a regular expression if we have to case-insensitively\n // match capital/lowercase characters.\n const anyMagic =\n hasMagic ||\n this.#hasMagic ||\n (this.#options.nocase &&\n !this.#options.nocaseMagicOnly &&\n glob.toUpperCase() !== glob.toLowerCase())\n if (!anyMagic) {\n return body\n }\n\n const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '')\n return Object.assign(new RegExp(`^${re}$`, flags), {\n _src: re,\n _glob: glob,\n })\n }\n\n get options() {\n return this.#options\n }\n\n // returns the string match, the regexp source, whether there's magic\n // in the regexp (so a regular expression is required) and whether or\n // not the uflag is needed for the regular expression (for posix classes)\n // TODO: instead of injecting the start/end at this point, just return\n // the BODY of the regexp, along with the start/end portions suitable\n // for binding the start/end in either a joined full-path makeRe context\n // (where we bind to (^|/), or a standalone matchPart context (where\n // we bind to ^, and not /). Otherwise slashes get duped!\n //\n // In part-matching mode, the start is:\n // - if not isStart: nothing\n // - if traversal possible, but not allowed: ^(?!\\.\\.?$)\n // - if dots allowed or not possible: ^\n // - if dots possible and not allowed: ^(?!\\.)\n // end is:\n // - if not isEnd(): nothing\n // - else: $\n //\n // In full-path matching mode, we put the slash at the START of the\n // pattern, so start is:\n // - if first pattern: same as part-matching mode\n // - if not isStart(): nothing\n // - if traversal possible, but not allowed: /(?!\\.\\.?(?:$|/))\n // - if dots allowed or not possible: /\n // - if dots possible and not allowed: /(?!\\.)\n // end is:\n // - if last pattern, same as part-matching mode\n // - else nothing\n //\n // Always put the (?:$|/) on negated tails, though, because that has to be\n // there to bind the end of the negated pattern portion, and it's easier to\n // just stick it in now rather than try to inject it later in the middle of\n // the pattern.\n //\n // We can just always return the same end, and leave it up to the caller\n // to know whether it's going to be used joined or in parts.\n // And, if the start is adjusted slightly, can do the same there:\n // - if not isStart: nothing\n // - if traversal possible, but not allowed: (?:/|^)(?!\\.\\.?$)\n // - if dots allowed or not possible: (?:/|^)\n // - if dots possible and not allowed: (?:/|^)(?!\\.)\n //\n // But it's better to have a simpler binding without a conditional, for\n // performance, so probably better to return both start options.\n //\n // Then the caller just ignores the end if it's not the first pattern,\n // and the start always gets applied.\n //\n // But that's always going to be $ if it's the ending pattern, or nothing,\n // so the caller can just attach $ at the end of the pattern when building.\n //\n // So the todo is:\n // - better detect what kind of start is needed\n // - return both flavors of starting pattern\n // - attach $ at the end of the pattern when creating the actual RegExp\n //\n // Ah, but wait, no, that all only applies to the root when the first pattern\n // is not an extglob. If the first pattern IS an extglob, then we need all\n // that dot prevention biz to live in the extglob portions, because eg\n // +(*|.x*) can match .xy but not .yx.\n //\n // So, return the two flavors if it's #root and the first child is not an\n // AST, otherwise leave it to the child AST to handle it, and there,\n // use the (?:^|/) style of start binding.\n //\n // Even simplified further:\n // - Since the start for a join is eg /(?!\\.) and the start for a part\n // is ^(?!\\.), we can just prepend (?!\\.) to the pattern (either root\n // or start or whatever) and prepend ^ or / at the Regexp construction.\n toRegExpSource(\n allowDot?: boolean\n ): [re: string, body: string, hasMagic: boolean, uflag: boolean] {\n const dot = allowDot ?? !!this.#options.dot\n if (this.#root === this) this.#fillNegs()\n if (!this.type) {\n const noEmpty = this.isStart() && this.isEnd()\n const src = this.#parts\n .map(p => {\n const [re, _, hasMagic, uflag] =\n typeof p === 'string'\n ? AST.#parseGlob(p, this.#hasMagic, noEmpty)\n : p.toRegExpSource(allowDot)\n this.#hasMagic = this.#hasMagic || hasMagic\n this.#uflag = this.#uflag || uflag\n return re\n })\n .join('')\n\n let start = ''\n if (this.isStart()) {\n if (typeof this.#parts[0] === 'string') {\n // this is the string that will match the start of the pattern,\n // so we need to protect against dots and such.\n\n // '.' and '..' cannot match unless the pattern is that exactly,\n // even if it starts with . or dot:true is set.\n const dotTravAllowed =\n this.#parts.length === 1 && justDots.has(this.#parts[0])\n if (!dotTravAllowed) {\n const aps = addPatternStart\n // check if we have a possibility of matching . or ..,\n // and prevent that.\n const needNoTrav =\n // dots are allowed, and the pattern starts with [ or .\n (dot && aps.has(src.charAt(0))) ||\n // the pattern starts with \\., and then [ or .\n (src.startsWith('\\\\.') && aps.has(src.charAt(2))) ||\n // the pattern starts with \\.\\., and then [ or .\n (src.startsWith('\\\\.\\\\.') && aps.has(src.charAt(4)))\n // no need to prevent dots if it can't match a dot, or if a\n // sub-pattern will be preventing it anyway.\n const needNoDot = !dot && !allowDot && aps.has(src.charAt(0))\n\n start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : ''\n }\n }\n }\n\n // append the \"end of path portion\" pattern to negation tails\n let end = ''\n if (\n this.isEnd() &&\n this.#root.#filledNegs &&\n this.#parent?.type === '!'\n ) {\n end = '(?:$|\\\\/)'\n }\n const final = start + src + end\n return [\n final,\n unescape(src),\n (this.#hasMagic = !!this.#hasMagic),\n this.#uflag,\n ]\n }\n\n // We need to calculate the body *twice* if it's a repeat pattern\n // at the start, once in nodot mode, then again in dot mode, so a\n // pattern like *(?) can match 'x.y'\n\n const repeated = this.type === '*' || this.type === '+'\n // some kind of extglob\n const start = this.type === '!' ? '(?:(?!(?:' : '(?:'\n let body = this.#partsToRegExp(dot)\n\n if (this.isStart() && this.isEnd() && !body && this.type !== '!') {\n // invalid extglob, has to at least be *something* present, if it's\n // the entire path portion.\n const s = this.toString()\n this.#parts = [s]\n this.type = null\n this.#hasMagic = undefined\n return [s, unescape(this.toString()), false, false]\n }\n\n // XXX abstract out this map method\n let bodyDotAllowed =\n !repeated || allowDot || dot || !startNoDot\n ? ''\n : this.#partsToRegExp(true)\n if (bodyDotAllowed === body) {\n bodyDotAllowed = ''\n }\n if (bodyDotAllowed) {\n body = `(?:${body})(?:${bodyDotAllowed})*?`\n }\n\n // an empty !() is exactly equivalent to a starNoEmpty\n let final = ''\n if (this.type === '!' && this.#emptyExt) {\n final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty\n } else {\n const close =\n this.type === '!'\n ? // !() must match something,but !(x) can match ''\n '))' +\n (this.isStart() && !dot && !allowDot ? startNoDot : '') +\n star +\n ')'\n : this.type === '@'\n ? ')'\n : this.type === '?'\n ? ')?'\n : this.type === '+' && bodyDotAllowed\n ? ')'\n : this.type === '*' && bodyDotAllowed\n ? `)?`\n : `)${this.type}`\n final = start + body + close\n }\n return [\n final,\n unescape(body),\n (this.#hasMagic = !!this.#hasMagic),\n this.#uflag,\n ]\n }\n\n #partsToRegExp(dot: boolean) {\n return this.#parts\n .map(p => {\n // extglob ASTs should only contain parent ASTs\n /* c8 ignore start */\n if (typeof p === 'string') {\n throw new Error('string type in extglob ast??')\n }\n /* c8 ignore stop */\n // can ignore hasMagic, because extglobs are already always magic\n const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot)\n this.#uflag = this.#uflag || uflag\n return re\n })\n .filter(p => !(this.isStart() && this.isEnd()) || !!p)\n .join('|')\n }\n\n static #parseGlob(\n glob: string,\n hasMagic: boolean | undefined,\n noEmpty: boolean = false\n ): [re: string, body: string, hasMagic: boolean, uflag: boolean] {\n let escaping = false\n let re = ''\n let uflag = false\n for (let i = 0; i < glob.length; i++) {\n const c = glob.charAt(i)\n if (escaping) {\n escaping = false\n re += (reSpecials.has(c) ? '\\\\' : '') + c\n continue\n }\n if (c === '\\\\') {\n if (i === glob.length - 1) {\n re += '\\\\\\\\'\n } else {\n escaping = true\n }\n continue\n }\n if (c === '[') {\n const [src, needUflag, consumed, magic] = parseClass(glob, i)\n if (consumed) {\n re += src\n uflag = uflag || needUflag\n i += consumed - 1\n hasMagic = hasMagic || magic\n continue\n }\n }\n if (c === '*') {\n if (noEmpty && glob === '*') re += starNoEmpty\n else re += star\n hasMagic = true\n continue\n }\n if (c === '?') {\n re += qmark\n hasMagic = true\n continue\n }\n re += regExpEscape(c)\n }\n return [re, unescape(glob), !!hasMagic, uflag]\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts new file mode 100644 index 00000000..b1572deb --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts @@ -0,0 +1,8 @@ +export type ParseClassResult = [ + src: string, + uFlag: boolean, + consumed: number, + hasMagic: boolean +]; +export declare const parseClass: (glob: string, position: number) => ParseClassResult; +//# sourceMappingURL=brace-expressions.d.ts.map \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map new file mode 100644 index 00000000..d3949648 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"brace-expressions.d.ts","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,OAAO;CAClB,CAAA;AAQD,eAAO,MAAM,UAAU,SACf,MAAM,YACF,MAAM,qBA8HjB,CAAA"} \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.js b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.js new file mode 100644 index 00000000..0e13eefc --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.js @@ -0,0 +1,152 @@ +"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/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.js.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.js.map new file mode 100644 index 00000000..86b04756 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/brace-expressions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"brace-expressions.js","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,wCAAwC;;;AAExC,8DAA8D;AAC9D,MAAM,YAAY,GAA0D;IAC1E,WAAW,EAAE,CAAC,sBAAsB,EAAE,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,KAAK,GAAG,QAAQ,GAAG,IAAI,EAAE,KAAK,CAAC;IAC7C,WAAW,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC;IACjC,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,C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;YACf,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,KAAK,CAAA;IAEX,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,CAAA;AAC1C,CAAC,CAAA;AAhIY,QAAA,UAAU,cAgItB","sourcesContent":["// translate the various posix character classes into unicode properties\n// this works across all unicode locales\n\n// { : [, /u flag required, negated]\nconst posixClasses: { [k: string]: [e: string, u: boolean, n?: boolean] } = {\n '[:alnum:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}', true],\n '[:alpha:]': ['\\\\p{L}\\\\p{Nl}', true],\n '[:ascii:]': ['\\\\x' + '00-\\\\x' + '7f', false],\n '[:blank:]': ['\\\\p{Zs}\\\\t', true],\n '[:cntrl:]': ['\\\\p{Cc}', true],\n '[:digit:]': ['\\\\p{Nd}', true],\n '[:graph:]': ['\\\\p{Z}\\\\p{C}', true, true],\n '[:lower:]': ['\\\\p{Ll}', true],\n '[:print:]': ['\\\\p{C}', true],\n '[:punct:]': ['\\\\p{P}', true],\n '[:space:]': ['\\\\p{Z}\\\\t\\\\r\\\\n\\\\v\\\\f', true],\n '[:upper:]': ['\\\\p{Lu}', true],\n '[:word:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}', true],\n '[:xdigit:]': ['A-Fa-f0-9', false],\n}\n\n// only need to escape a few things inside of brace expressions\n// escapes: [ \\ ] -\nconst braceEscape = (s: string) => s.replace(/[[\\]\\\\-]/g, '\\\\$&')\n// escape all regexp magic characters\nconst regexpEscape = (s: string) =>\n s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// everything has already been escaped, we just have to join\nconst rangesToString = (ranges: string[]): string => ranges.join('')\n\nexport type ParseClassResult = [\n src: string,\n uFlag: boolean,\n consumed: number,\n hasMagic: boolean\n]\n\n// takes a glob string at a posix brace expression, and returns\n// an equivalent regular expression source, and boolean indicating\n// whether the /u flag needs to be applied, and the number of chars\n// consumed to parse the character class.\n// This also removes out of order ranges, and returns ($.) if the\n// entire class just no good.\nexport const parseClass = (\n glob: string,\n position: number\n): ParseClassResult => {\n const pos = position\n /* c8 ignore start */\n if (glob.charAt(pos) !== '[') {\n throw new Error('not in a brace expression')\n }\n /* c8 ignore stop */\n const ranges: string[] = []\n const negs: string[] = []\n\n let i = pos + 1\n let sawStart = false\n let uflag = false\n let escaping = false\n let negate = false\n let endPos = pos\n let rangeStart = ''\n WHILE: while (i < glob.length) {\n const c = glob.charAt(i)\n if ((c === '!' || c === '^') && i === pos + 1) {\n negate = true\n i++\n continue\n }\n\n if (c === ']' && sawStart && !escaping) {\n endPos = i + 1\n break\n }\n\n sawStart = true\n if (c === '\\\\') {\n if (!escaping) {\n escaping = true\n i++\n continue\n }\n // escaped \\ char, fall through and treat like normal char\n }\n if (c === '[' && !escaping) {\n // either a posix class, a collation equivalent, or just a [\n for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {\n if (glob.startsWith(cls, i)) {\n // invalid, [a-[] is fine, but not [a-[:alpha]]\n if (rangeStart) {\n return ['$.', false, glob.length - pos, true]\n }\n i += cls.length\n if (neg) negs.push(unip)\n else ranges.push(unip)\n uflag = uflag || u\n continue WHILE\n }\n }\n }\n\n // now it's just a normal character, effectively\n escaping = false\n if (rangeStart) {\n // throw this range away if it's not valid, but others\n // can still match.\n if (c > rangeStart) {\n ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c))\n } else if (c === rangeStart) {\n ranges.push(braceEscape(c))\n }\n rangeStart = ''\n i++\n continue\n }\n\n // now might be the start of a range.\n // can be either c-d or c-] or c] or c] at this point\n if (glob.startsWith('-]', i + 1)) {\n ranges.push(braceEscape(c + '-'))\n i += 2\n continue\n }\n if (glob.startsWith('-', i + 1)) {\n rangeStart = c\n i += 2\n continue\n }\n\n // not the start of a range, just a single character\n ranges.push(braceEscape(c))\n i++\n }\n\n if (endPos < i) {\n // didn't see the end of the class, not a valid class,\n // but might still be valid as a literal match.\n return ['', false, 0, false]\n }\n\n // if we got no ranges and no negates, then we have a range that\n // cannot possibly match anything, and that poisons the whole glob\n if (!ranges.length && !negs.length) {\n return ['$.', false, glob.length - pos, true]\n }\n\n // if we got one positive range, and it's a single character, then that's\n // not actually a magic pattern, it's just that one literal character.\n // we should not treat that as \"magic\", we should just return the literal\n // character. [_] is a perfectly valid way to escape glob magic chars.\n if (\n negs.length === 0 &&\n ranges.length === 1 &&\n /^\\\\?.$/.test(ranges[0]) &&\n !negate\n ) {\n const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]\n return [regexpEscape(r), false, endPos - pos, false]\n }\n\n const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']'\n const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']'\n const comb =\n ranges.length && negs.length\n ? '(' + sranges + '|' + snegs + ')'\n : ranges.length\n ? sranges\n : snegs\n\n return [comb, uflag, endPos - pos, true]\n}\n"]} \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.d.ts new file mode 100644 index 00000000..dc3e3163 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.d.ts @@ -0,0 +1,12 @@ +import { MinimatchOptions } from './index.js'; +/** + * 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 declare const escape: (s: string, { windowsPathsNoEscape, }?: Pick) => string; +//# sourceMappingURL=escape.d.ts.map \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.d.ts.map new file mode 100644 index 00000000..0779dae7 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,MACd,MAAM,8BAGN,KAAK,gBAAgB,EAAE,sBAAsB,CAAC,WAQlD,CAAA"} \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.js b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.js new file mode 100644 index 00000000..02a4f8a8 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.js @@ -0,0 +1,22 @@ +"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/sucrase/node_modules/minimatch/dist/commonjs/escape.js.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.js.map new file mode 100644 index 00000000..264b2ea5 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/escape.js.map @@ -0,0 +1 @@ +{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":";;;AACA;;;;;;;;GAQG;AACI,MAAM,MAAM,GAAG,CACpB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,wDAAwD;IACxD,4DAA4D;IAC5D,sDAAsD;IACtD,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AACvC,CAAC,CAAA;AAZY,QAAA,MAAM,UAYlB","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Escape all magic characters in a glob pattern.\n *\n * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}\n * option is used, then characters are escaped by wrapping in `[]`, because\n * a magic character wrapped in a character class can only be satisfied by\n * that exact character. In this mode, `\\` is _not_ escaped, because it is\n * not interpreted as a magic character, but instead as a path separator.\n */\nexport const escape = (\n s: string,\n {\n windowsPathsNoEscape = false,\n }: Pick = {}\n) => {\n // don't need to escape +@! because we escape the parens\n // that make those magic, and escaping ! as [!] isn't valid,\n // because [!]] is a valid glob class meaning not ']'.\n return windowsPathsNoEscape\n ? s.replace(/[?*()[\\]]/g, '[$&]')\n : s.replace(/[?*()[\\]\\\\]/g, '\\\\$&')\n}\n"]} \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.d.ts new file mode 100644 index 00000000..41d16a98 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.d.ts @@ -0,0 +1,94 @@ +import { AST } from './ast.js'; +type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd'; +export interface MinimatchOptions { + nobrace?: boolean; + nocomment?: boolean; + nonegate?: boolean; + debug?: boolean; + noglobstar?: boolean; + noext?: boolean; + nonull?: boolean; + windowsPathsNoEscape?: boolean; + allowWindowsEscape?: boolean; + partial?: boolean; + dot?: boolean; + nocase?: boolean; + nocaseMagicOnly?: boolean; + magicalBraces?: boolean; + matchBase?: boolean; + flipNegate?: boolean; + preserveMultipleSlashes?: boolean; + optimizationLevel?: number; + platform?: Platform; + windowsNoMagicRoot?: boolean; +} +export declare const minimatch: { + (p: string, pattern: string, options?: MinimatchOptions): boolean; + sep: Sep; + GLOBSTAR: typeof GLOBSTAR; + filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean; + defaults: (def: MinimatchOptions) => typeof minimatch; + braceExpand: (pattern: string, options?: MinimatchOptions) => string[]; + makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp; + match: (list: string[], pattern: string, options?: MinimatchOptions) => string[]; + AST: typeof AST; + Minimatch: typeof Minimatch; + escape: (s: string, { windowsPathsNoEscape, }?: Pick) => string; + unescape: (s: string, { windowsPathsNoEscape, }?: Pick) => string; +}; +type Sep = '\\' | '/'; +export declare const sep: Sep; +export declare const GLOBSTAR: unique symbol; +export declare const filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean; +export declare const defaults: (def: MinimatchOptions) => typeof minimatch; +export declare const braceExpand: (pattern: string, options?: MinimatchOptions) => string[]; +export declare const makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp; +export declare const match: (list: string[], pattern: string, options?: MinimatchOptions) => string[]; +export type MMRegExp = RegExp & { + _src?: string; + _glob?: string; +}; +export type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR; +export type ParseReturn = ParseReturnFiltered | false; +export declare class Minimatch { + options: MinimatchOptions; + set: ParseReturnFiltered[][]; + pattern: string; + windowsPathsNoEscape: boolean; + nonegate: boolean; + negate: boolean; + comment: boolean; + empty: boolean; + preserveMultipleSlashes: boolean; + partial: boolean; + globSet: string[]; + globParts: string[][]; + nocase: boolean; + isWindows: boolean; + platform: Platform; + windowsNoMagicRoot: boolean; + regexp: false | null | MMRegExp; + constructor(pattern: string, options?: MinimatchOptions); + hasMagic(): boolean; + debug(..._: any[]): void; + make(): void; + preprocess(globParts: string[][]): string[][]; + adjascentGlobstarOptimize(globParts: string[][]): string[][]; + levelOneOptimize(globParts: string[][]): string[][]; + levelTwoFileOptimize(parts: string | string[]): string[]; + firstPhasePreProcess(globParts: string[][]): string[][]; + secondPhasePreProcess(globParts: string[][]): string[][]; + partsMatch(a: string[], b: string[], emptyGSMatch?: boolean): false | string[]; + parseNegate(): void; + matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean; + braceExpand(): string[]; + parse(pattern: string): ParseReturn; + makeRe(): false | MMRegExp; + slashSplit(p: string): string[]; + match(f: string, partial?: boolean): boolean; + static defaults(def: MinimatchOptions): typeof Minimatch; +} +export { AST } from './ast.js'; +export { escape } from './escape.js'; +export { unescape } from './unescape.js'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.d.ts.map new file mode 100644 index 00000000..195491d8 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAe,MAAM,UAAU,CAAA;AAI3C,KAAK,QAAQ,GACT,KAAK,GACL,SAAS,GACT,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,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E,MAAM,GAAG,MAAM,EAAE;IA6D7C,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IA0F1C,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE;IAkBxD,UAAU,CACR,CAAC,EAAE,MAAM,EAAE,EACX,CAAC,EAAE,MAAM,EAAE,EACX,YAAY,GAAE,OAAe,GAC5B,KAAK,GAAG,MAAM,EAAE;IA+CnB,WAAW;IAqBX,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,OAAO,GAAE,OAAe;IAiNzE,WAAW;IAIX,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;IAiDnC,MAAM;IAsFN,UAAU,CAAC,CAAC,EAAE,MAAM;IAepB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,UAAe;IAiEvC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,gBAAgB;CAGtC;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"} \ No newline at end of file diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.js b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.js new file mode 100644 index 00000000..64a0f1f8 --- /dev/null +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.js @@ -0,0 +1,1017 @@ +"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 { + // just collapse multiple ** portions into one + 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) {
    +                    globParts[i] = [];
    +                    globParts[j] = matched;
    +                    break;
    +                }
    +            }
    +        }
    +        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();
    +        if (fastTest && typeof re === 'object') {
    +            // Avoids overriding in frozen environments
    +            Reflect.defineProperty(re, 'test', { value: fastTest });
    +        }
    +        return 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/sucrase/node_modules/minimatch/dist/commonjs/index.js.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.js.map
    new file mode 100644
    index 00000000..d4f6a870
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/index.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAoC;AACpC,uEAA8D;AAC9D,qCAA2C;AAC3C,2CAAoC;AACpC,+CAAwC;AAsCjC,MAAM,SAAS,GAAG,CACvB,CAAS,EACT,OAAe,EACf,UAA4B,EAAE,EAC9B,EAAE;IACF,IAAA,4CAAkB,EAAC,OAAO,CAAC,CAAA;IAE3B,oCAAoC;IACpC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACnD,OAAO,KAAK,CAAA;KACb;IAED,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACjD,CAAC,CAAA;AAbY,QAAA,SAAS,aAarB;AAED,wDAAwD;AACxD,MAAM,YAAY,GAAG,uBAAuB,CAAA;AAC5C,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,CAAS,EAAE,EAAE,CACpD,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACvC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACzE,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAE,EAAE;IAC3C,GAAG,GAAG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AAC,MAAM,KAAK,CAAC,EAAE;gBAC7C,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAA;aAClB;YACD,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;YACjD,IAAI,GAAG,EAAE;gBACP,IAAI,OAAO,CAAC,UAAU,EAAE;oBACtB,OAAO,IAAI,CAAA;iBACZ;gBACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAA;aACpB;SACF;QAED,2DAA2D;QAC3D,8BAA8B;QAC9B,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,OAAO,KAAK,CAAA;SACb;QACD,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,GAAqB;QACnC,OAAO,iBAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,CAAA;IAC1C,CAAC;CACF;AAl4BD,8BAk4BC;AACD,qBAAqB;AACrB,mCAA8B;AAArB,6FAAA,GAAG,OAAA;AACZ,yCAAoC;AAA3B,mGAAA,MAAM,OAAA;AACf,6CAAwC;AAA/B,uGAAA,QAAQ,OAAA;AACjB,oBAAoB;AACpB,iBAAS,CAAC,GAAG,GAAG,YAAG,CAAA;AACnB,iBAAS,CAAC,SAAS,GAAG,SAAS,CAAA;AAC/B,iBAAS,CAAC,MAAM,GAAG,kBAAM,CAAA;AACzB,iBAAS,CAAC,QAAQ,GAAG,sBAAQ,CAAA","sourcesContent":["import expand from 'brace-expansion'\nimport { assertValidPattern } from './assert-valid-pattern.js'\nimport { AST, ExtglobType } from './ast.js'\nimport { escape } from './escape.js'\nimport { unescape } from './unescape.js'\n\ntype Platform =\n  | 'aix'\n  | 'android'\n  | 'darwin'\n  | 'freebsd'\n  | 'haiku'\n  | 'linux'\n  | 'openbsd'\n  | 'sunos'\n  | 'win32'\n  | 'cygwin'\n  | 'netbsd'\n\nexport interface MinimatchOptions {\n  nobrace?: boolean\n  nocomment?: boolean\n  nonegate?: boolean\n  debug?: boolean\n  noglobstar?: boolean\n  noext?: boolean\n  nonull?: boolean\n  windowsPathsNoEscape?: boolean\n  allowWindowsEscape?: boolean\n  partial?: boolean\n  dot?: boolean\n  nocase?: boolean\n  nocaseMagicOnly?: boolean\n  magicalBraces?: boolean\n  matchBase?: boolean\n  flipNegate?: boolean\n  preserveMultipleSlashes?: boolean\n  optimizationLevel?: number\n  platform?: Platform\n  windowsNoMagicRoot?: boolean\n}\n\nexport const minimatch = (\n  p: string,\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  assertValidPattern(pattern)\n\n  // shortcut: comments match nothing.\n  if (!options.nocomment && pattern.charAt(0) === '#') {\n    return false\n  }\n\n  return new Minimatch(pattern, options).match(p)\n}\n\n// Optimized checking for the most common glob patterns.\nconst starDotExtRE = /^\\*+([^+@!?\\*\\[\\(]*)$/\nconst starDotExtTest = (ext: string) => (f: string) =>\n  !f.startsWith('.') && f.endsWith(ext)\nconst starDotExtTestDot = (ext: string) => (f: string) => f.endsWith(ext)\nconst starDotExtTestNocase = (ext: string) => {\n  ext = ext.toLowerCase()\n  return (f: string) => !f.startsWith('.') && f.toLowerCase().endsWith(ext)\n}\nconst starDotExtTestNocaseDot = (ext: string) => {\n  ext = ext.toLowerCase()\n  return (f: string) => f.toLowerCase().endsWith(ext)\n}\nconst starDotStarRE = /^\\*+\\.\\*+$/\nconst starDotStarTest = (f: string) => !f.startsWith('.') && f.includes('.')\nconst starDotStarTestDot = (f: string) =>\n  f !== '.' && f !== '..' && f.includes('.')\nconst dotStarRE = /^\\.\\*+$/\nconst dotStarTest = (f: string) => f !== '.' && f !== '..' && f.startsWith('.')\nconst starRE = /^\\*+$/\nconst starTest = (f: string) => f.length !== 0 && !f.startsWith('.')\nconst starTestDot = (f: string) => f.length !== 0 && f !== '.' && f !== '..'\nconst qmarksRE = /^\\?+([^+@!?\\*\\[\\(]*)?$/\nconst qmarksTestNocase = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExt([$0])\n  if (!ext) return noext\n  ext = ext.toLowerCase()\n  return (f: string) => noext(f) && f.toLowerCase().endsWith(ext)\n}\nconst qmarksTestNocaseDot = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExtDot([$0])\n  if (!ext) return noext\n  ext = ext.toLowerCase()\n  return (f: string) => noext(f) && f.toLowerCase().endsWith(ext)\n}\nconst qmarksTestDot = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExtDot([$0])\n  return !ext ? noext : (f: string) => noext(f) && f.endsWith(ext)\n}\nconst qmarksTest = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExt([$0])\n  return !ext ? noext : (f: string) => noext(f) && f.endsWith(ext)\n}\nconst qmarksTestNoExt = ([$0]: RegExpMatchArray) => {\n  const len = $0.length\n  return (f: string) => f.length === len && !f.startsWith('.')\n}\nconst qmarksTestNoExtDot = ([$0]: RegExpMatchArray) => {\n  const len = $0.length\n  return (f: string) => f.length === len && f !== '.' && f !== '..'\n}\n\n/* c8 ignore start */\nconst defaultPlatform: Platform = (\n  typeof process === 'object' && process\n    ? (typeof process.env === 'object' &&\n        process.env &&\n        process.env.__MINIMATCH_TESTING_PLATFORM__) ||\n      process.platform\n    : 'posix'\n) as Platform\ntype Sep = '\\\\' | '/'\nconst path: { [k: string]: { sep: Sep } } = {\n  win32: { sep: '\\\\' },\n  posix: { sep: '/' },\n}\n/* c8 ignore stop */\n\nexport const sep = defaultPlatform === 'win32' ? path.win32.sep : path.posix.sep\nminimatch.sep = sep\n\nexport const GLOBSTAR = Symbol('globstar **')\nminimatch.GLOBSTAR = GLOBSTAR\n\n// any single thing other than /\n// don't need to escape / when using new RegExp()\nconst qmark = '[^/]'\n\n// * => any number of characters\nconst star = qmark + '*?'\n\n// ** when dots are allowed.  Anything goes, except .. and .\n// not (^ or / followed by one or two dots followed by $ or /),\n// followed by anything, any number of times.\nconst twoStarDot = '(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?'\n\n// not a ^ or / followed by a dot,\n// followed by anything, any number of times.\nconst twoStarNoDot = '(?:(?!(?:\\\\/|^)\\\\.).)*?'\n\nexport const filter =\n  (pattern: string, options: MinimatchOptions = {}) =>\n  (p: string) =>\n    minimatch(p, pattern, options)\nminimatch.filter = filter\n\nconst ext = (a: MinimatchOptions, b: MinimatchOptions = {}) =>\n  Object.assign({}, a, b)\n\nexport const defaults = (def: MinimatchOptions): typeof minimatch => {\n  if (!def || typeof def !== 'object' || !Object.keys(def).length) {\n    return minimatch\n  }\n\n  const orig = minimatch\n\n  const m = (p: string, pattern: string, options: MinimatchOptions = {}) =>\n    orig(p, pattern, ext(def, options))\n\n  return Object.assign(m, {\n    Minimatch: class Minimatch extends orig.Minimatch {\n      constructor(pattern: string, options: MinimatchOptions = {}) {\n        super(pattern, ext(def, options))\n      }\n      static defaults(options: MinimatchOptions) {\n        return orig.defaults(ext(def, options)).Minimatch\n      }\n    },\n\n    AST: class AST extends orig.AST {\n      /* c8 ignore start */\n      constructor(\n        type: ExtglobType | null,\n        parent?: AST,\n        options: MinimatchOptions = {}\n      ) {\n        super(type, parent, ext(def, options))\n      }\n      /* c8 ignore stop */\n\n      static fromGlob(pattern: string, options: MinimatchOptions = {}) {\n        return orig.AST.fromGlob(pattern, ext(def, options))\n      }\n    },\n\n    unescape: (\n      s: string,\n      options: Pick = {}\n    ) => orig.unescape(s, ext(def, options)),\n\n    escape: (\n      s: string,\n      options: Pick = {}\n    ) => orig.escape(s, ext(def, options)),\n\n    filter: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.filter(pattern, ext(def, options)),\n\n    defaults: (options: MinimatchOptions) => orig.defaults(ext(def, options)),\n\n    makeRe: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.makeRe(pattern, ext(def, options)),\n\n    braceExpand: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.braceExpand(pattern, ext(def, options)),\n\n    match: (list: string[], pattern: string, options: MinimatchOptions = {}) =>\n      orig.match(list, pattern, ext(def, options)),\n\n    sep: orig.sep,\n    GLOBSTAR: GLOBSTAR as typeof GLOBSTAR,\n  })\n}\nminimatch.defaults = defaults\n\n// Brace expansion:\n// a{b,c}d -> abd acd\n// a{b,}c -> abc ac\n// a{0..3}d -> a0d a1d a2d a3d\n// a{b,c{d,e}f}g -> abg acdfg acefg\n// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg\n//\n// Invalid sets are not expanded.\n// a{2..}b -> a{2..}b\n// a{b}c -> a{b}c\nexport const braceExpand = (\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  assertValidPattern(pattern)\n\n  // Thanks to Yeting Li  for\n  // improving this regexp to avoid a ReDOS vulnerability.\n  if (options.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(pattern)) {\n    // shortcut. no need to expand.\n    return [pattern]\n  }\n\n  return expand(pattern)\n}\nminimatch.braceExpand = braceExpand\n\n// parse a component of the expanded set.\n// At this point, no pattern may contain \"/\" in it\n// so we're going to return a 2d array, where each entry is the full\n// pattern, split on '/', and then turned into a regular expression.\n// A regexp is made at the end which joins each array with an\n// escaped /, and another full one which joins each regexp with |.\n//\n// Following the lead of Bash 4.1, note that \"**\" only has special meaning\n// when it is the *only* thing in a path portion.  Otherwise, any series\n// of * is equivalent to a single *.  Globstar behavior is enabled by\n// default, and can be disabled by setting options.noglobstar.\n\nexport const makeRe = (pattern: string, options: MinimatchOptions = {}) =>\n  new Minimatch(pattern, options).makeRe()\nminimatch.makeRe = makeRe\n\nexport const match = (\n  list: string[],\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  const mm = new Minimatch(pattern, options)\n  list = list.filter(f => mm.match(f))\n  if (mm.options.nonull && !list.length) {\n    list.push(pattern)\n  }\n  return list\n}\nminimatch.match = match\n\n// replace stuff like \\* with *\nconst globMagic = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/\nconst regExpEscape = (s: string) =>\n  s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\nexport type MMRegExp = RegExp & {\n  _src?: string\n  _glob?: string\n}\n\nexport type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR\nexport type ParseReturn = ParseReturnFiltered | false\n\nexport class Minimatch {\n  options: MinimatchOptions\n  set: ParseReturnFiltered[][]\n  pattern: string\n\n  windowsPathsNoEscape: boolean\n  nonegate: boolean\n  negate: boolean\n  comment: boolean\n  empty: boolean\n  preserveMultipleSlashes: boolean\n  partial: boolean\n  globSet: string[]\n  globParts: string[][]\n  nocase: boolean\n\n  isWindows: boolean\n  platform: Platform\n  windowsNoMagicRoot: boolean\n\n  regexp: false | null | MMRegExp\n  constructor(pattern: string, options: MinimatchOptions = {}) {\n    assertValidPattern(pattern)\n\n    options = options || {}\n    this.options = options\n    this.pattern = pattern\n    this.platform = options.platform || defaultPlatform\n    this.isWindows = this.platform === 'win32'\n    this.windowsPathsNoEscape =\n      !!options.windowsPathsNoEscape || options.allowWindowsEscape === false\n    if (this.windowsPathsNoEscape) {\n      this.pattern = this.pattern.replace(/\\\\/g, '/')\n    }\n    this.preserveMultipleSlashes = !!options.preserveMultipleSlashes\n    this.regexp = null\n    this.negate = false\n    this.nonegate = !!options.nonegate\n    this.comment = false\n    this.empty = false\n    this.partial = !!options.partial\n    this.nocase = !!this.options.nocase\n    this.windowsNoMagicRoot =\n      options.windowsNoMagicRoot !== undefined\n        ? options.windowsNoMagicRoot\n        : !!(this.isWindows && this.nocase)\n\n    this.globSet = []\n    this.globParts = []\n    this.set = []\n\n    // make the set of regexps etc.\n    this.make()\n  }\n\n  hasMagic(): boolean {\n    if (this.options.magicalBraces && this.set.length > 1) {\n      return true\n    }\n    for (const pattern of this.set) {\n      for (const part of pattern) {\n        if (typeof part !== 'string') return true\n      }\n    }\n    return false\n  }\n\n  debug(..._: any[]) {}\n\n  make() {\n    const pattern = this.pattern\n    const options = this.options\n\n    // empty patterns and comments match nothing.\n    if (!options.nocomment && pattern.charAt(0) === '#') {\n      this.comment = true\n      return\n    }\n\n    if (!pattern) {\n      this.empty = true\n      return\n    }\n\n    // step 1: figure out negation, etc.\n    this.parseNegate()\n\n    // step 2: expand braces\n    this.globSet = [...new Set(this.braceExpand())]\n\n    if (options.debug) {\n      this.debug = (...args: any[]) => console.error(...args)\n    }\n\n    this.debug(this.pattern, this.globSet)\n\n    // step 3: now we have a set, so turn each one into a series of\n    // path-portion matching patterns.\n    // These will be regexps, except in the case of \"**\", which is\n    // set to the GLOBSTAR object for globstar behavior,\n    // and will not contain any / characters\n    //\n    // First, we preprocess to make the glob pattern sets a bit simpler\n    // and deduped.  There are some perf-killing patterns that can cause\n    // problems with a glob walk, but we can simplify them down a bit.\n    const rawGlobParts = this.globSet.map(s => this.slashSplit(s))\n    this.globParts = this.preprocess(rawGlobParts)\n    this.debug(this.pattern, this.globParts)\n\n    // glob --> regexps\n    let set = this.globParts.map((s, _, __) => {\n      if (this.isWindows && this.windowsNoMagicRoot) {\n        // check if it's a drive or unc path.\n        const isUNC =\n          s[0] === '' &&\n          s[1] === '' &&\n          (s[2] === '?' || !globMagic.test(s[2])) &&\n          !globMagic.test(s[3])\n        const isDrive = /^[a-z]:/i.test(s[0])\n        if (isUNC) {\n          return [...s.slice(0, 4), ...s.slice(4).map(ss => this.parse(ss))]\n        } else if (isDrive) {\n          return [s[0], ...s.slice(1).map(ss => this.parse(ss))]\n        }\n      }\n      return s.map(ss => this.parse(ss))\n    })\n\n    this.debug(this.pattern, set)\n\n    // filter out everything that didn't compile properly.\n    this.set = set.filter(\n      s => s.indexOf(false) === -1\n    ) as ParseReturnFiltered[][]\n\n    // do not treat the ? in UNC paths as magic\n    if (this.isWindows) {\n      for (let i = 0; i < this.set.length; i++) {\n        const p = this.set[i]\n        if (\n          p[0] === '' &&\n          p[1] === '' &&\n          this.globParts[i][2] === '?' &&\n          typeof p[3] === 'string' &&\n          /^[a-z]:$/i.test(p[3])\n        ) {\n          p[2] = '?'\n        }\n      }\n    }\n\n    this.debug(this.pattern, this.set)\n  }\n\n  // various transforms to equivalent pattern sets that are\n  // faster to process in a filesystem walk.  The goal is to\n  // eliminate what we can, and push all ** patterns as far\n  // to the right as possible, even if it increases the number\n  // of patterns that we have to process.\n  preprocess(globParts: string[][]) {\n    // if we're not in globstar mode, then turn all ** into *\n    if (this.options.noglobstar) {\n      for (let i = 0; i < globParts.length; i++) {\n        for (let j = 0; j < globParts[i].length; j++) {\n          if (globParts[i][j] === '**') {\n            globParts[i][j] = '*'\n          }\n        }\n      }\n    }\n\n    const { optimizationLevel = 1 } = this.options\n\n    if (optimizationLevel >= 2) {\n      // aggressive optimization for the purpose of fs walking\n      globParts = this.firstPhasePreProcess(globParts)\n      globParts = this.secondPhasePreProcess(globParts)\n    } else if (optimizationLevel >= 1) {\n      // just basic optimizations to remove some .. parts\n      globParts = this.levelOneOptimize(globParts)\n    } else {\n      // just collapse multiple ** portions into one\n      globParts = this.adjascentGlobstarOptimize(globParts)\n    }\n\n    return globParts\n  }\n\n  // just get rid of adjascent ** portions\n  adjascentGlobstarOptimize(globParts: string[][]) {\n    return globParts.map(parts => {\n      let gs: number = -1\n      while (-1 !== (gs = parts.indexOf('**', gs + 1))) {\n        let i = gs\n        while (parts[i + 1] === '**') {\n          i++\n        }\n        if (i !== gs) {\n          parts.splice(gs, i - gs)\n        }\n      }\n      return parts\n    })\n  }\n\n  // get rid of adjascent ** and resolve .. portions\n  levelOneOptimize(globParts: string[][]) {\n    return globParts.map(parts => {\n      parts = parts.reduce((set: string[], part) => {\n        const prev = set[set.length - 1]\n        if (part === '**' && prev === '**') {\n          return set\n        }\n        if (part === '..') {\n          if (prev && prev !== '..' && prev !== '.' && prev !== '**') {\n            set.pop()\n            return set\n          }\n        }\n        set.push(part)\n        return set\n      }, [])\n      return parts.length === 0 ? [''] : parts\n    })\n  }\n\n  levelTwoFileOptimize(parts: string | string[]) {\n    if (!Array.isArray(parts)) {\n      parts = this.slashSplit(parts)\n    }\n    let didSomething: boolean = false\n    do {\n      didSomething = false\n      // 
    // -> 
    /\n      if (!this.preserveMultipleSlashes) {\n        for (let i = 1; i < parts.length - 1; i++) {\n          const p = parts[i]\n          // don't squeeze out UNC patterns\n          if (i === 1 && p === '' && parts[0] === '') continue\n          if (p === '.' || p === '') {\n            didSomething = true\n            parts.splice(i, 1)\n            i--\n          }\n        }\n        if (\n          parts[0] === '.' &&\n          parts.length === 2 &&\n          (parts[1] === '.' || parts[1] === '')\n        ) {\n          didSomething = true\n          parts.pop()\n        }\n      }\n\n      // 
    /

    /../ ->

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

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

    /**/../

    /

    / -> {

    /../

    /

    /,

    /**/

    /

    /}\n //

    // -> 
    /\n  // 
    /

    /../ ->

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

    /

    / -> {

    /../

    /

    /,

    /**/

    /

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

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

    /../ ->

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

    /} ->

    /*/\n  // {
    /,
    /} -> 
    /\n  // {
    /**/,
    /} -> 
    /**/\n  //\n  // {
    /**/,
    /**/

    /} ->

    /**/\n  // ^-- not valid because ** doens't follow symlinks\n  secondPhasePreProcess(globParts: string[][]): string[][] {\n    for (let i = 0; i < globParts.length - 1; i++) {\n      for (let j = i + 1; j < globParts.length; j++) {\n        const matched = this.partsMatch(\n          globParts[i],\n          globParts[j],\n          !this.preserveMultipleSlashes\n        )\n        if (matched) {\n          globParts[i] = []\n          globParts[j] = matched\n          break\n        }\n      }\n    }\n    return globParts.filter(gs => gs.length)\n  }\n\n  partsMatch(\n    a: string[],\n    b: string[],\n    emptyGSMatch: boolean = false\n  ): false | string[] {\n    let ai = 0\n    let bi = 0\n    let result: string[] = []\n    let which: string = ''\n    while (ai < a.length && bi < b.length) {\n      if (a[ai] === b[bi]) {\n        result.push(which === 'b' ? b[bi] : a[ai])\n        ai++\n        bi++\n      } else if (emptyGSMatch && a[ai] === '**' && b[bi] === a[ai + 1]) {\n        result.push(a[ai])\n        ai++\n      } else if (emptyGSMatch && b[bi] === '**' && a[ai] === b[bi + 1]) {\n        result.push(b[bi])\n        bi++\n      } else if (\n        a[ai] === '*' &&\n        b[bi] &&\n        (this.options.dot || !b[bi].startsWith('.')) &&\n        b[bi] !== '**'\n      ) {\n        if (which === 'b') return false\n        which = 'a'\n        result.push(a[ai])\n        ai++\n        bi++\n      } else if (\n        b[bi] === '*' &&\n        a[ai] &&\n        (this.options.dot || !a[ai].startsWith('.')) &&\n        a[ai] !== '**'\n      ) {\n        if (which === 'a') return false\n        which = 'b'\n        result.push(b[bi])\n        ai++\n        bi++\n      } else {\n        return false\n      }\n    }\n    // if we fall out of the loop, it means they two are identical\n    // as long as their lengths match\n    return a.length === b.length && result\n  }\n\n  parseNegate() {\n    if (this.nonegate) return\n\n    const pattern = this.pattern\n    let negate = false\n    let negateOffset = 0\n\n    for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {\n      negate = !negate\n      negateOffset++\n    }\n\n    if (negateOffset) this.pattern = pattern.slice(negateOffset)\n    this.negate = negate\n  }\n\n  // set partial to true to test if, for example,\n  // \"/a/b\" matches the start of \"/*/b/*/d\"\n  // Partial means, if you run out of file before you run\n  // out of pattern, then that's fine, as long as all\n  // the parts match.\n  matchOne(file: string[], pattern: ParseReturn[], partial: boolean = false) {\n    const options = this.options\n\n    // UNC paths like //?/X:/... can match X:/... and vice versa\n    // Drive letters in absolute drive or unc paths are always compared\n    // case-insensitively.\n    if (this.isWindows) {\n      const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0])\n      const fileUNC =\n        !fileDrive &&\n        file[0] === '' &&\n        file[1] === '' &&\n        file[2] === '?' &&\n        /^[a-z]:$/i.test(file[3])\n\n      const patternDrive =\n        typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0])\n      const patternUNC =\n        !patternDrive &&\n        pattern[0] === '' &&\n        pattern[1] === '' &&\n        pattern[2] === '?' &&\n        typeof pattern[3] === 'string' &&\n        /^[a-z]:$/i.test(pattern[3])\n\n      const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined\n      const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined\n      if (typeof fdi === 'number' && typeof pdi === 'number') {\n        const [fd, pd]: [string, string] = [file[fdi], pattern[pdi] as string]\n        if (fd.toLowerCase() === pd.toLowerCase()) {\n          pattern[pdi] = fd\n          if (pdi > fdi) {\n            pattern = pattern.slice(pdi)\n          } else if (fdi > pdi) {\n            file = file.slice(fdi)\n          }\n        }\n      }\n    }\n\n    // resolve and reduce . and .. portions in the file as well.\n    // dont' need to do the second phase, because it's only one string[]\n    const { optimizationLevel = 1 } = this.options\n    if (optimizationLevel >= 2) {\n      file = this.levelTwoFileOptimize(file)\n    }\n\n    this.debug('matchOne', this, { file, pattern })\n    this.debug('matchOne', file.length, pattern.length)\n\n    for (\n      var fi = 0, pi = 0, fl = file.length, pl = pattern.length;\n      fi < fl && pi < pl;\n      fi++, pi++\n    ) {\n      this.debug('matchOne loop')\n      var p = pattern[pi]\n      var f = file[fi]\n\n      this.debug(pattern, p, f)\n\n      // should be impossible.\n      // some invalid regexp stuff in the set.\n      /* c8 ignore start */\n      if (p === false) {\n        return false\n      }\n      /* c8 ignore stop */\n\n      if (p === GLOBSTAR) {\n        this.debug('GLOBSTAR', [pattern, p, f])\n\n        // \"**\"\n        // a/**/b/**/c would match the following:\n        // a/b/x/y/z/c\n        // a/x/y/z/b/c\n        // a/b/x/b/x/c\n        // a/b/c\n        // To do this, take the rest of the pattern after\n        // the **, and see if it would match the file remainder.\n        // If so, return success.\n        // If not, the ** \"swallows\" a segment, and try again.\n        // This is recursively awful.\n        //\n        // a/**/b/**/c matching a/b/x/y/z/c\n        // - a matches a\n        // - doublestar\n        //   - matchOne(b/x/y/z/c, b/**/c)\n        //     - b matches b\n        //     - doublestar\n        //       - matchOne(x/y/z/c, c) -> no\n        //       - matchOne(y/z/c, c) -> no\n        //       - matchOne(z/c, c) -> no\n        //       - matchOne(c, c) yes, hit\n        var fr = fi\n        var pr = pi + 1\n        if (pr === pl) {\n          this.debug('** at the end')\n          // a ** at the end will just swallow the rest.\n          // We have found a match.\n          // however, it will not swallow /.x, unless\n          // options.dot is set.\n          // . and .. are *never* matched by **, for explosively\n          // exponential reasons.\n          for (; fi < fl; fi++) {\n            if (\n              file[fi] === '.' ||\n              file[fi] === '..' ||\n              (!options.dot && file[fi].charAt(0) === '.')\n            )\n              return false\n          }\n          return true\n        }\n\n        // ok, let's see if we can swallow whatever we can.\n        while (fr < fl) {\n          var swallowee = file[fr]\n\n          this.debug('\\nglobstar while', file, fr, pattern, pr, swallowee)\n\n          // XXX remove this slice.  Just pass the start index.\n          if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {\n            this.debug('globstar found match!', fr, fl, swallowee)\n            // found a match.\n            return true\n          } else {\n            // can't swallow \".\" or \"..\" ever.\n            // can only swallow \".foo\" when explicitly asked.\n            if (\n              swallowee === '.' ||\n              swallowee === '..' ||\n              (!options.dot && swallowee.charAt(0) === '.')\n            ) {\n              this.debug('dot detected!', file, fr, pattern, pr)\n              break\n            }\n\n            // ** swallows a segment, and continue.\n            this.debug('globstar swallow a segment, and continue')\n            fr++\n          }\n        }\n\n        // no match was found.\n        // However, in partial mode, we can't say this is necessarily over.\n        /* c8 ignore start */\n        if (partial) {\n          // ran out of file\n          this.debug('\\n>>> no match, partial?', file, fr, pattern, pr)\n          if (fr === fl) {\n            return true\n          }\n        }\n        /* c8 ignore stop */\n        return false\n      }\n\n      // something other than **\n      // non-magic patterns just have to match exactly\n      // patterns with magic have been turned into regexps.\n      let hit: boolean\n      if (typeof p === 'string') {\n        hit = f === p\n        this.debug('string match', p, f, hit)\n      } else {\n        hit = p.test(f)\n        this.debug('pattern match', p, f, hit)\n      }\n\n      if (!hit) return false\n    }\n\n    // Note: ending in / means that we'll get a final \"\"\n    // at the end of the pattern.  This can only match a\n    // corresponding \"\" at the end of the file.\n    // If the file ends in /, then it can only match a\n    // a pattern that ends in /, unless the pattern just\n    // doesn't have any more for it. But, a/b/ should *not*\n    // match \"a/b/*\", even though \"\" matches against the\n    // [^/]*? pattern, except in partial mode, where it might\n    // simply not be reached yet.\n    // However, a/b/ should still satisfy a/*\n\n    // now either we fell off the end of the pattern, or we're done.\n    if (fi === fl && pi === pl) {\n      // ran out of pattern and filename at the same time.\n      // an exact hit!\n      return true\n    } else if (fi === fl) {\n      // ran out of file, but still had pattern left.\n      // this is ok if we're doing the match as part of\n      // a glob fs traversal.\n      return partial\n    } else if (pi === pl) {\n      // ran out of pattern, still have file left.\n      // this is only acceptable if we're on the very last\n      // empty segment of a file with a trailing slash.\n      // a/* should match a/b/\n      return fi === fl - 1 && file[fi] === ''\n\n      /* c8 ignore start */\n    } else {\n      // should be unreachable.\n      throw new Error('wtf?')\n    }\n    /* c8 ignore stop */\n  }\n\n  braceExpand() {\n    return braceExpand(this.pattern, this.options)\n  }\n\n  parse(pattern: string): ParseReturn {\n    assertValidPattern(pattern)\n\n    const options = this.options\n\n    // shortcuts\n    if (pattern === '**') return GLOBSTAR\n    if (pattern === '') return ''\n\n    // far and away, the most common glob pattern parts are\n    // *, *.*, and *.  Add a fast check method for those.\n    let m: RegExpMatchArray | null\n    let fastTest: null | ((f: string) => boolean) = null\n    if ((m = pattern.match(starRE))) {\n      fastTest = options.dot ? starTestDot : starTest\n    } else if ((m = pattern.match(starDotExtRE))) {\n      fastTest = (\n        options.nocase\n          ? options.dot\n            ? starDotExtTestNocaseDot\n            : starDotExtTestNocase\n          : options.dot\n          ? starDotExtTestDot\n          : starDotExtTest\n      )(m[1])\n    } else if ((m = pattern.match(qmarksRE))) {\n      fastTest = (\n        options.nocase\n          ? options.dot\n            ? qmarksTestNocaseDot\n            : qmarksTestNocase\n          : options.dot\n          ? qmarksTestDot\n          : qmarksTest\n      )(m)\n    } else if ((m = pattern.match(starDotStarRE))) {\n      fastTest = options.dot ? starDotStarTestDot : starDotStarTest\n    } else if ((m = pattern.match(dotStarRE))) {\n      fastTest = dotStarTest\n    }\n\n    const re = AST.fromGlob(pattern, this.options).toMMPattern()\n    if (fastTest && typeof re === 'object') {\n      // Avoids overriding in frozen environments\n      Reflect.defineProperty(re, 'test', { value: fastTest })\n    }\n    return re\n  }\n\n  makeRe() {\n    if (this.regexp || this.regexp === false) return this.regexp\n\n    // at this point, this.set is a 2d array of partial\n    // pattern strings, or \"**\".\n    //\n    // It's better to use .match().  This function shouldn't\n    // be used, really, but it's pretty convenient sometimes,\n    // when you just want to work with a regex.\n    const set = this.set\n\n    if (!set.length) {\n      this.regexp = false\n      return this.regexp\n    }\n    const options = this.options\n\n    const twoStar = options.noglobstar\n      ? star\n      : options.dot\n      ? twoStarDot\n      : twoStarNoDot\n    const flags = new Set(options.nocase ? ['i'] : [])\n\n    // regexpify non-globstar patterns\n    // if ** is only item, then we just do one twoStar\n    // if ** is first, and there are more, prepend (\\/|twoStar\\/)? to next\n    // if ** is last, append (\\/twoStar|) to previous\n    // if ** is in the middle, append (\\/|\\/twoStar\\/) to previous\n    // then filter out GLOBSTAR symbols\n    let re = set\n      .map(pattern => {\n        const pp: (string | typeof GLOBSTAR)[] = pattern.map(p => {\n          if (p instanceof RegExp) {\n            for (const f of p.flags.split('')) flags.add(f)\n          }\n          return typeof p === 'string'\n            ? regExpEscape(p)\n            : p === GLOBSTAR\n            ? GLOBSTAR\n            : p._src\n        }) as (string | typeof GLOBSTAR)[]\n        pp.forEach((p, i) => {\n          const next = pp[i + 1]\n          const prev = pp[i - 1]\n          if (p !== GLOBSTAR || prev === GLOBSTAR) {\n            return\n          }\n          if (prev === undefined) {\n            if (next !== undefined && next !== GLOBSTAR) {\n              pp[i + 1] = '(?:\\\\/|' + twoStar + '\\\\/)?' + next\n            } else {\n              pp[i] = twoStar\n            }\n          } else if (next === undefined) {\n            pp[i - 1] = prev + '(?:\\\\/|' + twoStar + ')?'\n          } else if (next !== GLOBSTAR) {\n            pp[i - 1] = prev + '(?:\\\\/|\\\\/' + twoStar + '\\\\/)' + next\n            pp[i + 1] = GLOBSTAR\n          }\n        })\n        return pp.filter(p => p !== GLOBSTAR).join('/')\n      })\n      .join('|')\n\n    // need to wrap in parens if we had more than one thing with |,\n    // otherwise only the first will be anchored to ^ and the last to $\n    const [open, close] = set.length > 1 ? ['(?:', ')'] : ['', '']\n    // must match entire pattern\n    // ending in a * or ** will make it less strict.\n    re = '^' + open + re + close + '$'\n\n    // can match anything, as long as it's not this.\n    if (this.negate) re = '^(?!' + re + ').+$'\n\n    try {\n      this.regexp = new RegExp(re, [...flags].join(''))\n      /* c8 ignore start */\n    } catch (ex) {\n      // should be impossible\n      this.regexp = false\n    }\n    /* c8 ignore stop */\n    return this.regexp\n  }\n\n  slashSplit(p: string) {\n    // if p starts with // on windows, we preserve that\n    // so that UNC paths aren't broken.  Otherwise, any number of\n    // / characters are coalesced into one, unless\n    // preserveMultipleSlashes is set to true.\n    if (this.preserveMultipleSlashes) {\n      return p.split('/')\n    } else if (this.isWindows && /^\\/\\/[^\\/]+/.test(p)) {\n      // add an extra '' for the one we lose\n      return ['', ...p.split(/\\/+/)]\n    } else {\n      return p.split(/\\/+/)\n    }\n  }\n\n  match(f: string, partial = this.partial) {\n    this.debug('match', f, this.pattern)\n    // short-circuit in the case of busted things.\n    // comments, etc.\n    if (this.comment) {\n      return false\n    }\n    if (this.empty) {\n      return f === ''\n    }\n\n    if (f === '/' && partial) {\n      return true\n    }\n\n    const options = this.options\n\n    // windows: need to use /, not \\\n    if (this.isWindows) {\n      f = f.split('\\\\').join('/')\n    }\n\n    // treat the test path as a set of pathparts.\n    const ff = this.slashSplit(f)\n    this.debug(this.pattern, 'split', ff)\n\n    // just ONE of the pattern sets in this.set needs to match\n    // in order for it to be valid.  If negating, then just one\n    // match means that we have failed.\n    // Either way, return on the first hit.\n\n    const set = this.set\n    this.debug(this.pattern, 'set', set)\n\n    // Find the basename of the path by looking for the last non-empty segment\n    let filename: string = ff[ff.length - 1]\n    if (!filename) {\n      for (let i = ff.length - 2; !filename && i >= 0; i--) {\n        filename = ff[i]\n      }\n    }\n\n    for (let i = 0; i < set.length; i++) {\n      const pattern = set[i]\n      let file = ff\n      if (options.matchBase && pattern.length === 1) {\n        file = [filename]\n      }\n      const hit = this.matchOne(file, pattern, partial)\n      if (hit) {\n        if (options.flipNegate) {\n          return true\n        }\n        return !this.negate\n      }\n    }\n\n    // didn't get any hits.  this is success if it's a negative\n    // pattern, failure otherwise.\n    if (options.flipNegate) {\n      return false\n    }\n    return this.negate\n  }\n\n  static defaults(def: MinimatchOptions) {\n    return minimatch.defaults(def).Minimatch\n  }\n}\n/* c8 ignore start */\nexport { AST } from './ast.js'\nexport { escape } from './escape.js'\nexport { unescape } from './unescape.js'\n/* c8 ignore stop */\nminimatch.AST = AST\nminimatch.Minimatch = Minimatch\nminimatch.escape = escape\nminimatch.unescape = unescape\n"]}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/package.json b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/package.json
    new file mode 100644
    index 00000000..5bbefffb
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "commonjs"
    +}
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.d.ts
    new file mode 100644
    index 00000000..23a7b387
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.d.ts
    @@ -0,0 +1,17 @@
    +import { MinimatchOptions } from './index.js';
    +/**
    + * 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 declare const unescape: (s: string, { windowsPathsNoEscape, }?: Pick) => string;
    +//# sourceMappingURL=unescape.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.d.ts.map
    new file mode 100644
    index 00000000..7ace0701
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"unescape.d.ts","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,MAChB,MAAM,8BAGN,KAAK,gBAAgB,EAAE,sBAAsB,CAAC,WAKlD,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.js b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.js
    new file mode 100644
    index 00000000..47c36bce
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.js
    @@ -0,0 +1,24 @@
    +"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/sucrase/node_modules/minimatch/dist/commonjs/unescape.js.map b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.js.map
    new file mode 100644
    index 00000000..353d3aa0
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/commonjs/unescape.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"unescape.js","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":";;;AACA;;;;;;;;;;;;;GAaG;AACI,MAAM,QAAQ,GAAG,CACtB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC;QACnC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAChF,CAAC,CAAA;AATY,QAAA,QAAQ,YASpB","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Un-escape a string that has been escaped with {@link escape}.\n *\n * If the {@link windowsPathsNoEscape} option is used, then square-brace\n * escapes are removed, but not backslash escapes.  For example, it will turn\n * the string `'[*]'` into `*`, but it will not turn `'\\\\*'` into `'*'`,\n * becuase `\\` is a path separator in `windowsPathsNoEscape` mode.\n *\n * When `windowsPathsNoEscape` is not set, then both brace escapes and\n * backslash escapes are removed.\n *\n * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped\n * or unescaped.\n */\nexport const unescape = (\n  s: string,\n  {\n    windowsPathsNoEscape = false,\n  }: Pick = {}\n) => {\n  return windowsPathsNoEscape\n    ? s.replace(/\\[([^\\/\\\\])\\]/g, '$1')\n    : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, '$1$2').replace(/\\\\([^\\/])/g, '$1')\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts
    new file mode 100644
    index 00000000..8e318b23
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts
    @@ -0,0 +1,2 @@
    +export declare const assertValidPattern: (pattern: any) => void;
    +//# sourceMappingURL=assert-valid-pattern.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map
    new file mode 100644
    index 00000000..c61c0310
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"assert-valid-pattern.d.ts","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAUlD,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.js b/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.js
    new file mode 100644
    index 00000000..7b534fc3
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.js
    @@ -0,0 +1,10 @@
    +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/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map
    new file mode 100644
    index 00000000..b1a5a0b9
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"assert-valid-pattern.js","sourceRoot":"","sources":["../../src/assert-valid-pattern.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAA;AACpC,MAAM,CAAC,MAAM,kBAAkB,GAA2B,CACxD,OAAY,EACe,EAAE;IAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAA;KACvC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,kBAAkB,EAAE;QACvC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAA;KAC3C;AACH,CAAC,CAAA","sourcesContent":["const MAX_PATTERN_LENGTH = 1024 * 64\nexport const assertValidPattern: (pattern: any) => void = (\n  pattern: any\n): asserts pattern is string => {\n  if (typeof pattern !== 'string') {\n    throw new TypeError('invalid pattern')\n  }\n\n  if (pattern.length > MAX_PATTERN_LENGTH) {\n    throw new TypeError('pattern is too long')\n  }\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.d.ts
    new file mode 100644
    index 00000000..b8c1e544
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.d.ts
    @@ -0,0 +1,20 @@
    +import { MinimatchOptions, MMRegExp } from './index.js';
    +export type ExtglobType = '!' | '?' | '+' | '*' | '@';
    +export declare class AST {
    +    #private;
    +    type: ExtglobType | null;
    +    constructor(type: ExtglobType | null, parent?: AST, options?: MinimatchOptions);
    +    get hasMagic(): boolean | undefined;
    +    toString(): string;
    +    push(...parts: (string | AST)[]): void;
    +    toJSON(): any[];
    +    isStart(): boolean;
    +    isEnd(): boolean;
    +    copyIn(part: AST | string): void;
    +    clone(parent: AST): AST;
    +    static fromGlob(pattern: string, options?: MinimatchOptions): AST;
    +    toMMPattern(): MMRegExp | string;
    +    get options(): MinimatchOptions;
    +    toRegExpSource(allowDot?: boolean): [re: string, body: string, hasMagic: boolean, uflag: boolean];
    +}
    +//# sourceMappingURL=ast.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.d.ts.map
    new file mode 100644
    index 00000000..9e7bfb9a
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAwCvD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAkCrD,qBAAa,GAAG;;IACd,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;gBAiBtB,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,GAAE,gBAAqB;IAahC,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAUlC;IAGD,QAAQ,IAAI,MAAM;IA+ClB,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE;IAY/B,MAAM;IAgBN,OAAO,IAAI,OAAO;IAgBlB,KAAK,IAAI,OAAO;IAYhB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM;IAKzB,KAAK,CAAC,MAAM,EAAE,GAAG;IAsIjB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAQ/D,WAAW,IAAI,QAAQ,GAAG,MAAM;IA2BhC,IAAI,OAAO,qBAEV;IAuED,cAAc,CACZ,QAAQ,CAAC,EAAE,OAAO,GACjB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC;CAiMjE"}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.js b/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.js
    new file mode 100644
    index 00000000..2d2bced6
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.js
    @@ -0,0 +1,588 @@
    +// 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,
    +        });
    +    }
    +    get options() {
    +        return this.#options;
    +    }
    +    // 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/sucrase/node_modules/minimatch/dist/esm/ast.js.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.js.map
    new file mode 100644
    index 00000000..f1f8b34c
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/ast.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAwCxC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAC7D,MAAM,aAAa,GAAG,CAAC,CAAS,EAAoB,EAAE,CACpD,KAAK,CAAC,GAAG,CAAC,CAAgB,CAAC,CAAA;AAE7B,iEAAiE;AACjE,gEAAgE;AAChE,0CA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AA;gBAC7D,IAAI,QAAQ,EAAE;oBACZ,EAAE,IAAI,GAAG,CAAA;oBACT,KAAK,GAAG,KAAK,IAAI,SAAS,CAAA;oBAC1B,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAA;oBACjB,QAAQ,GAAG,QAAQ,IAAI,KAAK,CAAA;oBAC5B,SAAQ;iBACT;aACF;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,IAAI,OAAO,IAAI,IAAI,KAAK,GAAG;oBAAE,EAAE,IAAI,WAAW,CAAA;;oBACzC,EAAE,IAAI,IAAI,CAAA;gBACf,QAAQ,GAAG,IAAI,CAAA;gBACf,SAAQ;aACT;YACD,IAAI,CAAC,KAAK,GAAG,EAAE;gBACb,EAAE,IAAI,KAAK,CAAA;gBACX,QAAQ,GAAG,IAAI,CAAA;gBACf,SAAQ;aACT;YACD,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,CAAA;SACtB;QACD,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;CACF","sourcesContent":["// parse a single path portion\n\nimport { parseClass } from './brace-expressions.js'\nimport { MinimatchOptions, MMRegExp } from './index.js'\nimport { unescape } from './unescape.js'\n\n// classes [] are handled by the parseClass method\n// for positive extglobs, we sub-parse the contents, and combine,\n// with the appropriate regexp close.\n// for negative extglobs, we sub-parse the contents, but then\n// have to include the rest of the pattern, then the parent, etc.,\n// as the thing that cannot be because RegExp negative lookaheads\n// are different from globs.\n//\n// So for example:\n// a@(i|w!(x|y)z|j)b => ^a(i|w((!?(x|y)zb).*)z|j)b$\n//   1   2 3   4 5 6      1   2    3   46      5 6\n//\n// Assembling the extglob requires not just the negated patterns themselves,\n// but also anything following the negative patterns up to the boundary\n// of the current pattern, plus anything following in the parent pattern.\n//\n//\n// So, first, we parse the string into an AST of extglobs, without turning\n// anything into regexps yet.\n//\n// ['a', {@ [['i'], ['w', {!['x', 'y']}, 'z'], ['j']]}, 'b']\n//\n// Then, for all the negative extglobs, we append whatever comes after in\n// each parent as their tail\n//\n// ['a', {@ [['i'], ['w', {!['x', 'y'], 'z', 'b'}, 'z'], ['j']]}, 'b']\n//\n// Lastly, we turn each of these pieces into a regexp, and join\n//\n//                                 v----- .* because there's more following,\n//                                 v    v  otherwise, .+ because it must be\n//                                 v    v  *something* there.\n// ['^a', {@ ['i', 'w(?:(!?(?:x|y).*zb$).*)z', 'j' ]}, 'b$']\n//   copy what follows into here--^^^^^\n// ['^a', '(?:i|w(?:(?!(?:x|y).*zb$).*)z|j)', 'b$']\n// ['^a(?:i|w(?:(?!(?:x|y).*zb$).*)z|j)b$']\n\nexport type ExtglobType = '!' | '?' | '+' | '*' | '@'\nconst types = new Set(['!', '?', '+', '*', '@'])\nconst isExtglobType = (c: string): c is ExtglobType =>\n  types.has(c as ExtglobType)\n\n// Patterns that get prepended to bind to the start of either the\n// entire string, or just a single path portion, to prevent dots\n// and/or traversal patterns, when needed.\n// Exts don't need the ^ or / bit, because the root binds that already.\nconst startNoTraversal = '(?!(?:^|/)\\\\.\\\\.?(?:$|/))'\nconst startNoDot = '(?!\\\\.)'\n\n// characters that indicate a start of pattern needs the \"no dots\" bit,\n// because a dot *might* be matched. ( is not in the list, because in\n// the case of a child extglob, it will handle the prevention itself.\nconst addPatternStart = new Set(['[', '.'])\n// cases where traversal is A-OK, no dot prevention needed\nconst justDots = new Set(['..', '.'])\nconst reSpecials = new Set('().*{}+?[]^$\\\\!')\nconst regExpEscape = (s: string) =>\n  s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// any single thing other than /\nconst qmark = '[^/]'\n\n// * => any number of characters\nconst star = qmark + '*?'\n// use + when we need to ensure that *something* matches, because the * is\n// the only thing in the path portion.\nconst starNoEmpty = qmark + '+?'\n\n// remove the \\ chars that we added if we end up doing a nonmagic compare\n// const deslash = (s: string) => s.replace(/\\\\(.)/g, '$1')\n\nexport class AST {\n  type: ExtglobType | null\n  readonly #root: AST\n\n  #hasMagic?: boolean\n  #uflag: boolean = false\n  #parts: (string | AST)[] = []\n  readonly #parent?: AST\n  readonly #parentIndex: number\n  #negs: AST[]\n  #filledNegs: boolean = false\n  #options: MinimatchOptions\n  #toString?: string\n  // set to true if it's an extglob with no children\n  // (which really means one child of '')\n  #emptyExt: boolean = false\n\n  constructor(\n    type: ExtglobType | null,\n    parent?: AST,\n    options: MinimatchOptions = {}\n  ) {\n    this.type = type\n    // extglobs are inherently magical\n    if (type) this.#hasMagic = true\n    this.#parent = parent\n    this.#root = this.#parent ? this.#parent.#root : this\n    this.#options = this.#root === this ? options : this.#root.#options\n    this.#negs = this.#root === this ? [] : this.#root.#negs\n    if (type === '!' && !this.#root.#filledNegs) this.#negs.push(this)\n    this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0\n  }\n\n  get hasMagic(): boolean | undefined {\n    /* c8 ignore start */\n    if (this.#hasMagic !== undefined) return this.#hasMagic\n    /* c8 ignore stop */\n    for (const p of this.#parts) {\n      if (typeof p === 'string') continue\n      if (p.type || p.hasMagic) return (this.#hasMagic = true)\n    }\n    // note: will be undefined until we generate the regexp src and find out\n    return this.#hasMagic\n  }\n\n  // reconstructs the pattern\n  toString(): string {\n    if (this.#toString !== undefined) return this.#toString\n    if (!this.type) {\n      return (this.#toString = this.#parts.map(p => String(p)).join(''))\n    } else {\n      return (this.#toString =\n        this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')')\n    }\n  }\n\n  #fillNegs() {\n    /* c8 ignore start */\n    if (this !== this.#root) throw new Error('should only call on root')\n    if (this.#filledNegs) return this\n    /* c8 ignore stop */\n\n    // call toString() once to fill this out\n    this.toString()\n    this.#filledNegs = true\n    let n: AST | undefined\n    while ((n = this.#negs.pop())) {\n      if (n.type !== '!') continue\n      // walk up the tree, appending everthing that comes AFTER parentIndex\n      let p: AST | undefined = n\n      let pp = p.#parent\n      while (pp) {\n        for (\n          let i = p.#parentIndex + 1;\n          !pp.type && i < pp.#parts.length;\n          i++\n        ) {\n          for (const part of n.#parts) {\n            /* c8 ignore start */\n            if (typeof part === 'string') {\n              throw new Error('string part in extglob AST??')\n            }\n            /* c8 ignore stop */\n            part.copyIn(pp.#parts[i])\n          }\n        }\n        p = pp\n        pp = p.#parent\n      }\n    }\n    return this\n  }\n\n  push(...parts: (string | AST)[]) {\n    for (const p of parts) {\n      if (p === '') continue\n      /* c8 ignore start */\n      if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {\n        throw new Error('invalid part: ' + p)\n      }\n      /* c8 ignore stop */\n      this.#parts.push(p)\n    }\n  }\n\n  toJSON() {\n    const ret: any[] =\n      this.type === null\n        ? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))\n        : [this.type, ...this.#parts.map(p => (p as AST).toJSON())]\n    if (this.isStart() && !this.type) ret.unshift([])\n    if (\n      this.isEnd() &&\n      (this === this.#root ||\n        (this.#root.#filledNegs && this.#parent?.type === '!'))\n    ) {\n      ret.push({})\n    }\n    return ret\n  }\n\n  isStart(): boolean {\n    if (this.#root === this) return true\n    // if (this.type) return !!this.#parent?.isStart()\n    if (!this.#parent?.isStart()) return false\n    if (this.#parentIndex === 0) return true\n    // if everything AHEAD of this is a negation, then it's still the \"start\"\n    const p = this.#parent\n    for (let i = 0; i < this.#parentIndex; i++) {\n      const pp = p.#parts[i]\n      if (!(pp instanceof AST && pp.type === '!')) {\n        return false\n      }\n    }\n    return true\n  }\n\n  isEnd(): boolean {\n    if (this.#root === this) return true\n    if (this.#parent?.type === '!') return true\n    if (!this.#parent?.isEnd()) return false\n    if (!this.type) return this.#parent?.isEnd()\n    // if not root, it'll always have a parent\n    /* c8 ignore start */\n    const pl = this.#parent ? this.#parent.#parts.length : 0\n    /* c8 ignore stop */\n    return this.#parentIndex === pl - 1\n  }\n\n  copyIn(part: AST | string) {\n    if (typeof part === 'string') this.push(part)\n    else this.push(part.clone(this))\n  }\n\n  clone(parent: AST) {\n    const c = new AST(this.type, parent)\n    for (const p of this.#parts) {\n      c.copyIn(p)\n    }\n    return c\n  }\n\n  static #parseAST(\n    str: string,\n    ast: AST,\n    pos: number,\n    opt: MinimatchOptions\n  ): number {\n    let escaping = false\n    let inBrace = false\n    let braceStart = -1\n    let braceNeg = false\n    if (ast.type === null) {\n      // outside of a extglob, append until we find a start\n      let i = pos\n      let acc = ''\n      while (i < str.length) {\n        const c = str.charAt(i++)\n        // still accumulate escapes at this point, but we do ignore\n        // starts that are escaped\n        if (escaping || c === '\\\\') {\n          escaping = !escaping\n          acc += c\n          continue\n        }\n\n        if (inBrace) {\n          if (i === braceStart + 1) {\n            if (c === '^' || c === '!') {\n              braceNeg = true\n            }\n          } else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {\n            inBrace = false\n          }\n          acc += c\n          continue\n        } else if (c === '[') {\n          inBrace = true\n          braceStart = i\n          braceNeg = false\n          acc += c\n          continue\n        }\n\n        if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {\n          ast.push(acc)\n          acc = ''\n          const ext = new AST(c, ast)\n          i = AST.#parseAST(str, ext, i, opt)\n          ast.push(ext)\n          continue\n        }\n        acc += c\n      }\n      ast.push(acc)\n      return i\n    }\n\n    // some kind of extglob, pos is at the (\n    // find the next | or )\n    let i = pos + 1\n    let part = new AST(null, ast)\n    const parts: AST[] = []\n    let acc = ''\n    while (i < str.length) {\n      const c = str.charAt(i++)\n      // still accumulate escapes at this point, but we do ignore\n      // starts that are escaped\n      if (escaping || c === '\\\\') {\n        escaping = !escaping\n        acc += c\n        continue\n      }\n\n      if (inBrace) {\n        if (i === braceStart + 1) {\n          if (c === '^' || c === '!') {\n            braceNeg = true\n          }\n        } else if (c === ']' && !(i === braceStart + 2 && braceNeg)) {\n          inBrace = false\n        }\n        acc += c\n        continue\n      } else if (c === '[') {\n        inBrace = true\n        braceStart = i\n        braceNeg = false\n        acc += c\n        continue\n      }\n\n      if (isExtglobType(c) && str.charAt(i) === '(') {\n        part.push(acc)\n        acc = ''\n        const ext = new AST(c, part)\n        part.push(ext)\n        i = AST.#parseAST(str, ext, i, opt)\n        continue\n      }\n      if (c === '|') {\n        part.push(acc)\n        acc = ''\n        parts.push(part)\n        part = new AST(null, ast)\n        continue\n      }\n      if (c === ')') {\n        if (acc === '' && ast.#parts.length === 0) {\n          ast.#emptyExt = true\n        }\n        part.push(acc)\n        acc = ''\n        ast.push(...parts, part)\n        return i\n      }\n      acc += c\n    }\n\n    // unfinished extglob\n    // if we got here, it was a malformed extglob! not an extglob, but\n    // maybe something else in there.\n    ast.type = null\n    ast.#hasMagic = undefined\n    ast.#parts = [str.substring(pos - 1)]\n    return i\n  }\n\n  static fromGlob(pattern: string, options: MinimatchOptions = {}) {\n    const ast = new AST(null, undefined, options)\n    AST.#parseAST(pattern, ast, 0, options)\n    return ast\n  }\n\n  // returns the regular expression if there's magic, or the unescaped\n  // string if not.\n  toMMPattern(): MMRegExp | string {\n    // should only be called on root\n    /* c8 ignore start */\n    if (this !== this.#root) return this.#root.toMMPattern()\n    /* c8 ignore stop */\n    const glob = this.toString()\n    const [re, body, hasMagic, uflag] = this.toRegExpSource()\n    // if we're in nocase mode, and not nocaseMagicOnly, then we do\n    // still need a regular expression if we have to case-insensitively\n    // match capital/lowercase characters.\n    const anyMagic =\n      hasMagic ||\n      this.#hasMagic ||\n      (this.#options.nocase &&\n        !this.#options.nocaseMagicOnly &&\n        glob.toUpperCase() !== glob.toLowerCase())\n    if (!anyMagic) {\n      return body\n    }\n\n    const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : '')\n    return Object.assign(new RegExp(`^${re}$`, flags), {\n      _src: re,\n      _glob: glob,\n    })\n  }\n\n  get options() {\n    return this.#options\n  }\n\n  // returns the string match, the regexp source, whether there's magic\n  // in the regexp (so a regular expression is required) and whether or\n  // not the uflag is needed for the regular expression (for posix classes)\n  // TODO: instead of injecting the start/end at this point, just return\n  // the BODY of the regexp, along with the start/end portions suitable\n  // for binding the start/end in either a joined full-path makeRe context\n  // (where we bind to (^|/), or a standalone matchPart context (where\n  // we bind to ^, and not /).  Otherwise slashes get duped!\n  //\n  // In part-matching mode, the start is:\n  // - if not isStart: nothing\n  // - if traversal possible, but not allowed: ^(?!\\.\\.?$)\n  // - if dots allowed or not possible: ^\n  // - if dots possible and not allowed: ^(?!\\.)\n  // end is:\n  // - if not isEnd(): nothing\n  // - else: $\n  //\n  // In full-path matching mode, we put the slash at the START of the\n  // pattern, so start is:\n  // - if first pattern: same as part-matching mode\n  // - if not isStart(): nothing\n  // - if traversal possible, but not allowed: /(?!\\.\\.?(?:$|/))\n  // - if dots allowed or not possible: /\n  // - if dots possible and not allowed: /(?!\\.)\n  // end is:\n  // - if last pattern, same as part-matching mode\n  // - else nothing\n  //\n  // Always put the (?:$|/) on negated tails, though, because that has to be\n  // there to bind the end of the negated pattern portion, and it's easier to\n  // just stick it in now rather than try to inject it later in the middle of\n  // the pattern.\n  //\n  // We can just always return the same end, and leave it up to the caller\n  // to know whether it's going to be used joined or in parts.\n  // And, if the start is adjusted slightly, can do the same there:\n  // - if not isStart: nothing\n  // - if traversal possible, but not allowed: (?:/|^)(?!\\.\\.?$)\n  // - if dots allowed or not possible: (?:/|^)\n  // - if dots possible and not allowed: (?:/|^)(?!\\.)\n  //\n  // But it's better to have a simpler binding without a conditional, for\n  // performance, so probably better to return both start options.\n  //\n  // Then the caller just ignores the end if it's not the first pattern,\n  // and the start always gets applied.\n  //\n  // But that's always going to be $ if it's the ending pattern, or nothing,\n  // so the caller can just attach $ at the end of the pattern when building.\n  //\n  // So the todo is:\n  // - better detect what kind of start is needed\n  // - return both flavors of starting pattern\n  // - attach $ at the end of the pattern when creating the actual RegExp\n  //\n  // Ah, but wait, no, that all only applies to the root when the first pattern\n  // is not an extglob. If the first pattern IS an extglob, then we need all\n  // that dot prevention biz to live in the extglob portions, because eg\n  // +(*|.x*) can match .xy but not .yx.\n  //\n  // So, return the two flavors if it's #root and the first child is not an\n  // AST, otherwise leave it to the child AST to handle it, and there,\n  // use the (?:^|/) style of start binding.\n  //\n  // Even simplified further:\n  // - Since the start for a join is eg /(?!\\.) and the start for a part\n  // is ^(?!\\.), we can just prepend (?!\\.) to the pattern (either root\n  // or start or whatever) and prepend ^ or / at the Regexp construction.\n  toRegExpSource(\n    allowDot?: boolean\n  ): [re: string, body: string, hasMagic: boolean, uflag: boolean] {\n    const dot = allowDot ?? !!this.#options.dot\n    if (this.#root === this) this.#fillNegs()\n    if (!this.type) {\n      const noEmpty = this.isStart() && this.isEnd()\n      const src = this.#parts\n        .map(p => {\n          const [re, _, hasMagic, uflag] =\n            typeof p === 'string'\n              ? AST.#parseGlob(p, this.#hasMagic, noEmpty)\n              : p.toRegExpSource(allowDot)\n          this.#hasMagic = this.#hasMagic || hasMagic\n          this.#uflag = this.#uflag || uflag\n          return re\n        })\n        .join('')\n\n      let start = ''\n      if (this.isStart()) {\n        if (typeof this.#parts[0] === 'string') {\n          // this is the string that will match the start of the pattern,\n          // so we need to protect against dots and such.\n\n          // '.' and '..' cannot match unless the pattern is that exactly,\n          // even if it starts with . or dot:true is set.\n          const dotTravAllowed =\n            this.#parts.length === 1 && justDots.has(this.#parts[0])\n          if (!dotTravAllowed) {\n            const aps = addPatternStart\n            // check if we have a possibility of matching . or ..,\n            // and prevent that.\n            const needNoTrav =\n              // dots are allowed, and the pattern starts with [ or .\n              (dot && aps.has(src.charAt(0))) ||\n              // the pattern starts with \\., and then [ or .\n              (src.startsWith('\\\\.') && aps.has(src.charAt(2))) ||\n              // the pattern starts with \\.\\., and then [ or .\n              (src.startsWith('\\\\.\\\\.') && aps.has(src.charAt(4)))\n            // no need to prevent dots if it can't match a dot, or if a\n            // sub-pattern will be preventing it anyway.\n            const needNoDot = !dot && !allowDot && aps.has(src.charAt(0))\n\n            start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : ''\n          }\n        }\n      }\n\n      // append the \"end of path portion\" pattern to negation tails\n      let end = ''\n      if (\n        this.isEnd() &&\n        this.#root.#filledNegs &&\n        this.#parent?.type === '!'\n      ) {\n        end = '(?:$|\\\\/)'\n      }\n      const final = start + src + end\n      return [\n        final,\n        unescape(src),\n        (this.#hasMagic = !!this.#hasMagic),\n        this.#uflag,\n      ]\n    }\n\n    // We need to calculate the body *twice* if it's a repeat pattern\n    // at the start, once in nodot mode, then again in dot mode, so a\n    // pattern like *(?) can match 'x.y'\n\n    const repeated = this.type === '*' || this.type === '+'\n    // some kind of extglob\n    const start = this.type === '!' ? '(?:(?!(?:' : '(?:'\n    let body = this.#partsToRegExp(dot)\n\n    if (this.isStart() && this.isEnd() && !body && this.type !== '!') {\n      // invalid extglob, has to at least be *something* present, if it's\n      // the entire path portion.\n      const s = this.toString()\n      this.#parts = [s]\n      this.type = null\n      this.#hasMagic = undefined\n      return [s, unescape(this.toString()), false, false]\n    }\n\n    // XXX abstract out this map method\n    let bodyDotAllowed =\n      !repeated || allowDot || dot || !startNoDot\n        ? ''\n        : this.#partsToRegExp(true)\n    if (bodyDotAllowed === body) {\n      bodyDotAllowed = ''\n    }\n    if (bodyDotAllowed) {\n      body = `(?:${body})(?:${bodyDotAllowed})*?`\n    }\n\n    // an empty !() is exactly equivalent to a starNoEmpty\n    let final = ''\n    if (this.type === '!' && this.#emptyExt) {\n      final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty\n    } else {\n      const close =\n        this.type === '!'\n          ? // !() must match something,but !(x) can match ''\n            '))' +\n            (this.isStart() && !dot && !allowDot ? startNoDot : '') +\n            star +\n            ')'\n          : this.type === '@'\n          ? ')'\n          : this.type === '?'\n          ? ')?'\n          : this.type === '+' && bodyDotAllowed\n          ? ')'\n          : this.type === '*' && bodyDotAllowed\n          ? `)?`\n          : `)${this.type}`\n      final = start + body + close\n    }\n    return [\n      final,\n      unescape(body),\n      (this.#hasMagic = !!this.#hasMagic),\n      this.#uflag,\n    ]\n  }\n\n  #partsToRegExp(dot: boolean) {\n    return this.#parts\n      .map(p => {\n        // extglob ASTs should only contain parent ASTs\n        /* c8 ignore start */\n        if (typeof p === 'string') {\n          throw new Error('string type in extglob ast??')\n        }\n        /* c8 ignore stop */\n        // can ignore hasMagic, because extglobs are already always magic\n        const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot)\n        this.#uflag = this.#uflag || uflag\n        return re\n      })\n      .filter(p => !(this.isStart() && this.isEnd()) || !!p)\n      .join('|')\n  }\n\n  static #parseGlob(\n    glob: string,\n    hasMagic: boolean | undefined,\n    noEmpty: boolean = false\n  ): [re: string, body: string, hasMagic: boolean, uflag: boolean] {\n    let escaping = false\n    let re = ''\n    let uflag = false\n    for (let i = 0; i < glob.length; i++) {\n      const c = glob.charAt(i)\n      if (escaping) {\n        escaping = false\n        re += (reSpecials.has(c) ? '\\\\' : '') + c\n        continue\n      }\n      if (c === '\\\\') {\n        if (i === glob.length - 1) {\n          re += '\\\\\\\\'\n        } else {\n          escaping = true\n        }\n        continue\n      }\n      if (c === '[') {\n        const [src, needUflag, consumed, magic] = parseClass(glob, i)\n        if (consumed) {\n          re += src\n          uflag = uflag || needUflag\n          i += consumed - 1\n          hasMagic = hasMagic || magic\n          continue\n        }\n      }\n      if (c === '*') {\n        if (noEmpty && glob === '*') re += starNoEmpty\n        else re += star\n        hasMagic = true\n        continue\n      }\n      if (c === '?') {\n        re += qmark\n        hasMagic = true\n        continue\n      }\n      re += regExpEscape(c)\n    }\n    return [re, unescape(glob), !!hasMagic, uflag]\n  }\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.d.ts
    new file mode 100644
    index 00000000..b1572deb
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.d.ts
    @@ -0,0 +1,8 @@
    +export type ParseClassResult = [
    +    src: string,
    +    uFlag: boolean,
    +    consumed: number,
    +    hasMagic: boolean
    +];
    +export declare const parseClass: (glob: string, position: number) => ParseClassResult;
    +//# sourceMappingURL=brace-expressions.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map
    new file mode 100644
    index 00000000..d3949648
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"brace-expressions.d.ts","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,OAAO;CAClB,CAAA;AAQD,eAAO,MAAM,UAAU,SACf,MAAM,YACF,MAAM,qBA8HjB,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.js b/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.js
    new file mode 100644
    index 00000000..c629d6ae
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.js
    @@ -0,0 +1,148 @@
    +// 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/sucrase/node_modules/minimatch/dist/esm/brace-expressions.js.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.js.map
    new file mode 100644
    index 00000000..cdba30da
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/brace-expressions.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"brace-expressions.js","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,wCAAwC;AAExC,8DAA8D;AAC9D,MAAM,YAAY,GAA0D;IAC1E,WAAW,EAAE,CAAC,sBAAsB,EAAE,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,KAAK,GAAG,QAAQ,GAAG,IAAI,EAAE,KAAK,CAAC;IAC7C,WAAW,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC;IACjC,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,WAAW,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;IAC7B,WAAW,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;IAC7B,WAAW,EAAE,CAAC,uBAAuB,EAAE,IAAI,CAAC;IAC5C,WAAW,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9B,UAAU,EAAE,CAAC,6BAA6B,EAAE,IAAI,CAAC;IACjD,YAAY,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC;CACnC,CAAA;AAED,+DAA+D;AAC/D,mBAAmB;AACnB,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAA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I,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC,MAAM,EACP;QACA,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAClE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,KAAK,CAAC,CAAA;KACrD;IAED,MAAM,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG,GAAG,CAAA;IACxE,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACpE,MAAM,IAAI,GACR,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM;QAC1B,CAAC,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG;QACnC,CAAC,CAAC,MAAM,CAAC,MAAM;YACf,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,KAAK,CAAA;IAEX,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,CAAA;AAC1C,CAAC,CAAA","sourcesContent":["// translate the various posix character classes into unicode properties\n// this works across all unicode locales\n\n// { : [, /u flag required, negated]\nconst posixClasses: { [k: string]: [e: string, u: boolean, n?: boolean] } = {\n  '[:alnum:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}', true],\n  '[:alpha:]': ['\\\\p{L}\\\\p{Nl}', true],\n  '[:ascii:]': ['\\\\x' + '00-\\\\x' + '7f', false],\n  '[:blank:]': ['\\\\p{Zs}\\\\t', true],\n  '[:cntrl:]': ['\\\\p{Cc}', true],\n  '[:digit:]': ['\\\\p{Nd}', true],\n  '[:graph:]': ['\\\\p{Z}\\\\p{C}', true, true],\n  '[:lower:]': ['\\\\p{Ll}', true],\n  '[:print:]': ['\\\\p{C}', true],\n  '[:punct:]': ['\\\\p{P}', true],\n  '[:space:]': ['\\\\p{Z}\\\\t\\\\r\\\\n\\\\v\\\\f', true],\n  '[:upper:]': ['\\\\p{Lu}', true],\n  '[:word:]': ['\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}', true],\n  '[:xdigit:]': ['A-Fa-f0-9', false],\n}\n\n// only need to escape a few things inside of brace expressions\n// escapes: [ \\ ] -\nconst braceEscape = (s: string) => s.replace(/[[\\]\\\\-]/g, '\\\\$&')\n// escape all regexp magic characters\nconst regexpEscape = (s: string) =>\n  s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\n// everything has already been escaped, we just have to join\nconst rangesToString = (ranges: string[]): string => ranges.join('')\n\nexport type ParseClassResult = [\n  src: string,\n  uFlag: boolean,\n  consumed: number,\n  hasMagic: boolean\n]\n\n// takes a glob string at a posix brace expression, and returns\n// an equivalent regular expression source, and boolean indicating\n// whether the /u flag needs to be applied, and the number of chars\n// consumed to parse the character class.\n// This also removes out of order ranges, and returns ($.) if the\n// entire class just no good.\nexport const parseClass = (\n  glob: string,\n  position: number\n): ParseClassResult => {\n  const pos = position\n  /* c8 ignore start */\n  if (glob.charAt(pos) !== '[') {\n    throw new Error('not in a brace expression')\n  }\n  /* c8 ignore stop */\n  const ranges: string[] = []\n  const negs: string[] = []\n\n  let i = pos + 1\n  let sawStart = false\n  let uflag = false\n  let escaping = false\n  let negate = false\n  let endPos = pos\n  let rangeStart = ''\n  WHILE: while (i < glob.length) {\n    const c = glob.charAt(i)\n    if ((c === '!' || c === '^') && i === pos + 1) {\n      negate = true\n      i++\n      continue\n    }\n\n    if (c === ']' && sawStart && !escaping) {\n      endPos = i + 1\n      break\n    }\n\n    sawStart = true\n    if (c === '\\\\') {\n      if (!escaping) {\n        escaping = true\n        i++\n        continue\n      }\n      // escaped \\ char, fall through and treat like normal char\n    }\n    if (c === '[' && !escaping) {\n      // either a posix class, a collation equivalent, or just a [\n      for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {\n        if (glob.startsWith(cls, i)) {\n          // invalid, [a-[] is fine, but not [a-[:alpha]]\n          if (rangeStart) {\n            return ['$.', false, glob.length - pos, true]\n          }\n          i += cls.length\n          if (neg) negs.push(unip)\n          else ranges.push(unip)\n          uflag = uflag || u\n          continue WHILE\n        }\n      }\n    }\n\n    // now it's just a normal character, effectively\n    escaping = false\n    if (rangeStart) {\n      // throw this range away if it's not valid, but others\n      // can still match.\n      if (c > rangeStart) {\n        ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c))\n      } else if (c === rangeStart) {\n        ranges.push(braceEscape(c))\n      }\n      rangeStart = ''\n      i++\n      continue\n    }\n\n    // now might be the start of a range.\n    // can be either c-d or c-] or c] or c] at this point\n    if (glob.startsWith('-]', i + 1)) {\n      ranges.push(braceEscape(c + '-'))\n      i += 2\n      continue\n    }\n    if (glob.startsWith('-', i + 1)) {\n      rangeStart = c\n      i += 2\n      continue\n    }\n\n    // not the start of a range, just a single character\n    ranges.push(braceEscape(c))\n    i++\n  }\n\n  if (endPos < i) {\n    // didn't see the end of the class, not a valid class,\n    // but might still be valid as a literal match.\n    return ['', false, 0, false]\n  }\n\n  // if we got no ranges and no negates, then we have a range that\n  // cannot possibly match anything, and that poisons the whole glob\n  if (!ranges.length && !negs.length) {\n    return ['$.', false, glob.length - pos, true]\n  }\n\n  // if we got one positive range, and it's a single character, then that's\n  // not actually a magic pattern, it's just that one literal character.\n  // we should not treat that as \"magic\", we should just return the literal\n  // character. [_] is a perfectly valid way to escape glob magic chars.\n  if (\n    negs.length === 0 &&\n    ranges.length === 1 &&\n    /^\\\\?.$/.test(ranges[0]) &&\n    !negate\n  ) {\n    const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]\n    return [regexpEscape(r), false, endPos - pos, false]\n  }\n\n  const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']'\n  const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']'\n  const comb =\n    ranges.length && negs.length\n      ? '(' + sranges + '|' + snegs + ')'\n      : ranges.length\n      ? sranges\n      : snegs\n\n  return [comb, uflag, endPos - pos, true]\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.d.ts
    new file mode 100644
    index 00000000..dc3e3163
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.d.ts
    @@ -0,0 +1,12 @@
    +import { MinimatchOptions } from './index.js';
    +/**
    + * 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 declare const escape: (s: string, { windowsPathsNoEscape, }?: Pick) => string;
    +//# sourceMappingURL=escape.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.d.ts.map
    new file mode 100644
    index 00000000..0779dae7
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,MACd,MAAM,8BAGN,KAAK,gBAAgB,EAAE,sBAAsB,CAAC,WAQlD,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.js b/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.js
    new file mode 100644
    index 00000000..16f7c8c7
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.js
    @@ -0,0 +1,18 @@
    +/**
    + * 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/sucrase/node_modules/minimatch/dist/esm/escape.js.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.js.map
    new file mode 100644
    index 00000000..170fd1ad
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/escape.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../src/escape.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,wDAAwD;IACxD,4DAA4D;IAC5D,sDAAsD;IACtD,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AACvC,CAAC,CAAA","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Escape all magic characters in a glob pattern.\n *\n * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}\n * option is used, then characters are escaped by wrapping in `[]`, because\n * a magic character wrapped in a character class can only be satisfied by\n * that exact character.  In this mode, `\\` is _not_ escaped, because it is\n * not interpreted as a magic character, but instead as a path separator.\n */\nexport const escape = (\n  s: string,\n  {\n    windowsPathsNoEscape = false,\n  }: Pick = {}\n) => {\n  // don't need to escape +@! because we escape the parens\n  // that make those magic, and escaping ! as [!] isn't valid,\n  // because [!]] is a valid glob class meaning not ']'.\n  return windowsPathsNoEscape\n    ? s.replace(/[?*()[\\]]/g, '[$&]')\n    : s.replace(/[?*()[\\]\\\\]/g, '\\\\$&')\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/index.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/esm/index.d.ts
    new file mode 100644
    index 00000000..41d16a98
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/index.d.ts
    @@ -0,0 +1,94 @@
    +import { AST } from './ast.js';
    +type Platform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'haiku' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin' | 'netbsd';
    +export interface MinimatchOptions {
    +    nobrace?: boolean;
    +    nocomment?: boolean;
    +    nonegate?: boolean;
    +    debug?: boolean;
    +    noglobstar?: boolean;
    +    noext?: boolean;
    +    nonull?: boolean;
    +    windowsPathsNoEscape?: boolean;
    +    allowWindowsEscape?: boolean;
    +    partial?: boolean;
    +    dot?: boolean;
    +    nocase?: boolean;
    +    nocaseMagicOnly?: boolean;
    +    magicalBraces?: boolean;
    +    matchBase?: boolean;
    +    flipNegate?: boolean;
    +    preserveMultipleSlashes?: boolean;
    +    optimizationLevel?: number;
    +    platform?: Platform;
    +    windowsNoMagicRoot?: boolean;
    +}
    +export declare const minimatch: {
    +    (p: string, pattern: string, options?: MinimatchOptions): boolean;
    +    sep: Sep;
    +    GLOBSTAR: typeof GLOBSTAR;
    +    filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
    +    defaults: (def: MinimatchOptions) => typeof minimatch;
    +    braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
    +    makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
    +    match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
    +    AST: typeof AST;
    +    Minimatch: typeof Minimatch;
    +    escape: (s: string, { windowsPathsNoEscape, }?: Pick) => string;
    +    unescape: (s: string, { windowsPathsNoEscape, }?: Pick) => string;
    +};
    +type Sep = '\\' | '/';
    +export declare const sep: Sep;
    +export declare const GLOBSTAR: unique symbol;
    +export declare const filter: (pattern: string, options?: MinimatchOptions) => (p: string) => boolean;
    +export declare const defaults: (def: MinimatchOptions) => typeof minimatch;
    +export declare const braceExpand: (pattern: string, options?: MinimatchOptions) => string[];
    +export declare const makeRe: (pattern: string, options?: MinimatchOptions) => false | MMRegExp;
    +export declare const match: (list: string[], pattern: string, options?: MinimatchOptions) => string[];
    +export type MMRegExp = RegExp & {
    +    _src?: string;
    +    _glob?: string;
    +};
    +export type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR;
    +export type ParseReturn = ParseReturnFiltered | false;
    +export declare class Minimatch {
    +    options: MinimatchOptions;
    +    set: ParseReturnFiltered[][];
    +    pattern: string;
    +    windowsPathsNoEscape: boolean;
    +    nonegate: boolean;
    +    negate: boolean;
    +    comment: boolean;
    +    empty: boolean;
    +    preserveMultipleSlashes: boolean;
    +    partial: boolean;
    +    globSet: string[];
    +    globParts: string[][];
    +    nocase: boolean;
    +    isWindows: boolean;
    +    platform: Platform;
    +    windowsNoMagicRoot: boolean;
    +    regexp: false | null | MMRegExp;
    +    constructor(pattern: string, options?: MinimatchOptions);
    +    hasMagic(): boolean;
    +    debug(..._: any[]): void;
    +    make(): void;
    +    preprocess(globParts: string[][]): string[][];
    +    adjascentGlobstarOptimize(globParts: string[][]): string[][];
    +    levelOneOptimize(globParts: string[][]): string[][];
    +    levelTwoFileOptimize(parts: string | string[]): string[];
    +    firstPhasePreProcess(globParts: string[][]): string[][];
    +    secondPhasePreProcess(globParts: string[][]): string[][];
    +    partsMatch(a: string[], b: string[], emptyGSMatch?: boolean): false | string[];
    +    parseNegate(): void;
    +    matchOne(file: string[], pattern: ParseReturn[], partial?: boolean): boolean;
    +    braceExpand(): string[];
    +    parse(pattern: string): ParseReturn;
    +    makeRe(): false | MMRegExp;
    +    slashSplit(p: string): string[];
    +    match(f: string, partial?: boolean): boolean;
    +    static defaults(def: MinimatchOptions): typeof Minimatch;
    +}
    +export { AST } from './ast.js';
    +export { escape } from './escape.js';
    +export { unescape } from './unescape.js';
    +//# sourceMappingURL=index.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/index.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/index.d.ts.map
    new file mode 100644
    index 00000000..195491d8
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/index.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAe,MAAM,UAAU,CAAA;AAI3C,KAAK,QAAQ,GACT,KAAK,GACL,SAAS,GACT,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK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,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IAoBtC,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IA6D7C,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE;IA0F1C,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE;IAkBxD,UAAU,CACR,CAAC,EAAE,MAAM,EAAE,EACX,CAAC,EAAE,MAAM,EAAE,EACX,YAAY,GAAE,OAAe,GAC5B,KAAK,GAAG,MAAM,EAAE;IA+CnB,WAAW;IAqBX,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,OAAO,GAAE,OAAe;IAiNzE,WAAW;IAIX,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;IAiDnC,MAAM;IAsFN,UAAU,CAAC,CAAC,EAAE,MAAM;IAepB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,UAAe;IAiEvC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,gBAAgB;CAGtC;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/index.js b/node_modules/sucrase/node_modules/minimatch/dist/esm/index.js
    new file mode 100644
    index 00000000..84b577b0
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/index.js
    @@ -0,0 +1,1001 @@
    +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 {
    +            // just collapse multiple ** portions into one
    +            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) {
    +                    globParts[i] = [];
    +                    globParts[j] = matched;
    +                    break;
    +                }
    +            }
    +        }
    +        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();
    +        if (fastTest && typeof re === 'object') {
    +            // Avoids overriding in frozen environments
    +            Reflect.defineProperty(re, 'test', { value: fastTest });
    +        }
    +        return 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/sucrase/node_modules/minimatch/dist/esm/index.js.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/index.js.map
    new file mode 100644
    index 00000000..ff82a0d3
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/index.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,GAAG,EAAe,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAsCxC,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,CAAS,EACT,OAAe,EACf,UAA4B,EAAE,EAC9B,EAAE;IACF,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAE3B,oCAAoC;IACpC,IAAI,CAAC,OAAO,CAAC,SA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AE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,oBAAoB;AACpB,SAAS,CAAC,GAAG,GAAG,GAAG,CAAA;AACnB,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;AAC/B,SAAS,CAAC,MAAM,GAAG,MAAM,CAAA;AACzB,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAA","sourcesContent":["import expand from 'brace-expansion'\nimport { assertValidPattern } from './assert-valid-pattern.js'\nimport { AST, ExtglobType } from './ast.js'\nimport { escape } from './escape.js'\nimport { unescape } from './unescape.js'\n\ntype Platform =\n  | 'aix'\n  | 'android'\n  | 'darwin'\n  | 'freebsd'\n  | 'haiku'\n  | 'linux'\n  | 'openbsd'\n  | 'sunos'\n  | 'win32'\n  | 'cygwin'\n  | 'netbsd'\n\nexport interface MinimatchOptions {\n  nobrace?: boolean\n  nocomment?: boolean\n  nonegate?: boolean\n  debug?: boolean\n  noglobstar?: boolean\n  noext?: boolean\n  nonull?: boolean\n  windowsPathsNoEscape?: boolean\n  allowWindowsEscape?: boolean\n  partial?: boolean\n  dot?: boolean\n  nocase?: boolean\n  nocaseMagicOnly?: boolean\n  magicalBraces?: boolean\n  matchBase?: boolean\n  flipNegate?: boolean\n  preserveMultipleSlashes?: boolean\n  optimizationLevel?: number\n  platform?: Platform\n  windowsNoMagicRoot?: boolean\n}\n\nexport const minimatch = (\n  p: string,\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  assertValidPattern(pattern)\n\n  // shortcut: comments match nothing.\n  if (!options.nocomment && pattern.charAt(0) === '#') {\n    return false\n  }\n\n  return new Minimatch(pattern, options).match(p)\n}\n\n// Optimized checking for the most common glob patterns.\nconst starDotExtRE = /^\\*+([^+@!?\\*\\[\\(]*)$/\nconst starDotExtTest = (ext: string) => (f: string) =>\n  !f.startsWith('.') && f.endsWith(ext)\nconst starDotExtTestDot = (ext: string) => (f: string) => f.endsWith(ext)\nconst starDotExtTestNocase = (ext: string) => {\n  ext = ext.toLowerCase()\n  return (f: string) => !f.startsWith('.') && f.toLowerCase().endsWith(ext)\n}\nconst starDotExtTestNocaseDot = (ext: string) => {\n  ext = ext.toLowerCase()\n  return (f: string) => f.toLowerCase().endsWith(ext)\n}\nconst starDotStarRE = /^\\*+\\.\\*+$/\nconst starDotStarTest = (f: string) => !f.startsWith('.') && f.includes('.')\nconst starDotStarTestDot = (f: string) =>\n  f !== '.' && f !== '..' && f.includes('.')\nconst dotStarRE = /^\\.\\*+$/\nconst dotStarTest = (f: string) => f !== '.' && f !== '..' && f.startsWith('.')\nconst starRE = /^\\*+$/\nconst starTest = (f: string) => f.length !== 0 && !f.startsWith('.')\nconst starTestDot = (f: string) => f.length !== 0 && f !== '.' && f !== '..'\nconst qmarksRE = /^\\?+([^+@!?\\*\\[\\(]*)?$/\nconst qmarksTestNocase = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExt([$0])\n  if (!ext) return noext\n  ext = ext.toLowerCase()\n  return (f: string) => noext(f) && f.toLowerCase().endsWith(ext)\n}\nconst qmarksTestNocaseDot = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExtDot([$0])\n  if (!ext) return noext\n  ext = ext.toLowerCase()\n  return (f: string) => noext(f) && f.toLowerCase().endsWith(ext)\n}\nconst qmarksTestDot = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExtDot([$0])\n  return !ext ? noext : (f: string) => noext(f) && f.endsWith(ext)\n}\nconst qmarksTest = ([$0, ext = '']: RegExpMatchArray) => {\n  const noext = qmarksTestNoExt([$0])\n  return !ext ? noext : (f: string) => noext(f) && f.endsWith(ext)\n}\nconst qmarksTestNoExt = ([$0]: RegExpMatchArray) => {\n  const len = $0.length\n  return (f: string) => f.length === len && !f.startsWith('.')\n}\nconst qmarksTestNoExtDot = ([$0]: RegExpMatchArray) => {\n  const len = $0.length\n  return (f: string) => f.length === len && f !== '.' && f !== '..'\n}\n\n/* c8 ignore start */\nconst defaultPlatform: Platform = (\n  typeof process === 'object' && process\n    ? (typeof process.env === 'object' &&\n        process.env &&\n        process.env.__MINIMATCH_TESTING_PLATFORM__) ||\n      process.platform\n    : 'posix'\n) as Platform\ntype Sep = '\\\\' | '/'\nconst path: { [k: string]: { sep: Sep } } = {\n  win32: { sep: '\\\\' },\n  posix: { sep: '/' },\n}\n/* c8 ignore stop */\n\nexport const sep = defaultPlatform === 'win32' ? path.win32.sep : path.posix.sep\nminimatch.sep = sep\n\nexport const GLOBSTAR = Symbol('globstar **')\nminimatch.GLOBSTAR = GLOBSTAR\n\n// any single thing other than /\n// don't need to escape / when using new RegExp()\nconst qmark = '[^/]'\n\n// * => any number of characters\nconst star = qmark + '*?'\n\n// ** when dots are allowed.  Anything goes, except .. and .\n// not (^ or / followed by one or two dots followed by $ or /),\n// followed by anything, any number of times.\nconst twoStarDot = '(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?'\n\n// not a ^ or / followed by a dot,\n// followed by anything, any number of times.\nconst twoStarNoDot = '(?:(?!(?:\\\\/|^)\\\\.).)*?'\n\nexport const filter =\n  (pattern: string, options: MinimatchOptions = {}) =>\n  (p: string) =>\n    minimatch(p, pattern, options)\nminimatch.filter = filter\n\nconst ext = (a: MinimatchOptions, b: MinimatchOptions = {}) =>\n  Object.assign({}, a, b)\n\nexport const defaults = (def: MinimatchOptions): typeof minimatch => {\n  if (!def || typeof def !== 'object' || !Object.keys(def).length) {\n    return minimatch\n  }\n\n  const orig = minimatch\n\n  const m = (p: string, pattern: string, options: MinimatchOptions = {}) =>\n    orig(p, pattern, ext(def, options))\n\n  return Object.assign(m, {\n    Minimatch: class Minimatch extends orig.Minimatch {\n      constructor(pattern: string, options: MinimatchOptions = {}) {\n        super(pattern, ext(def, options))\n      }\n      static defaults(options: MinimatchOptions) {\n        return orig.defaults(ext(def, options)).Minimatch\n      }\n    },\n\n    AST: class AST extends orig.AST {\n      /* c8 ignore start */\n      constructor(\n        type: ExtglobType | null,\n        parent?: AST,\n        options: MinimatchOptions = {}\n      ) {\n        super(type, parent, ext(def, options))\n      }\n      /* c8 ignore stop */\n\n      static fromGlob(pattern: string, options: MinimatchOptions = {}) {\n        return orig.AST.fromGlob(pattern, ext(def, options))\n      }\n    },\n\n    unescape: (\n      s: string,\n      options: Pick = {}\n    ) => orig.unescape(s, ext(def, options)),\n\n    escape: (\n      s: string,\n      options: Pick = {}\n    ) => orig.escape(s, ext(def, options)),\n\n    filter: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.filter(pattern, ext(def, options)),\n\n    defaults: (options: MinimatchOptions) => orig.defaults(ext(def, options)),\n\n    makeRe: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.makeRe(pattern, ext(def, options)),\n\n    braceExpand: (pattern: string, options: MinimatchOptions = {}) =>\n      orig.braceExpand(pattern, ext(def, options)),\n\n    match: (list: string[], pattern: string, options: MinimatchOptions = {}) =>\n      orig.match(list, pattern, ext(def, options)),\n\n    sep: orig.sep,\n    GLOBSTAR: GLOBSTAR as typeof GLOBSTAR,\n  })\n}\nminimatch.defaults = defaults\n\n// Brace expansion:\n// a{b,c}d -> abd acd\n// a{b,}c -> abc ac\n// a{0..3}d -> a0d a1d a2d a3d\n// a{b,c{d,e}f}g -> abg acdfg acefg\n// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg\n//\n// Invalid sets are not expanded.\n// a{2..}b -> a{2..}b\n// a{b}c -> a{b}c\nexport const braceExpand = (\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  assertValidPattern(pattern)\n\n  // Thanks to Yeting Li  for\n  // improving this regexp to avoid a ReDOS vulnerability.\n  if (options.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(pattern)) {\n    // shortcut. no need to expand.\n    return [pattern]\n  }\n\n  return expand(pattern)\n}\nminimatch.braceExpand = braceExpand\n\n// parse a component of the expanded set.\n// At this point, no pattern may contain \"/\" in it\n// so we're going to return a 2d array, where each entry is the full\n// pattern, split on '/', and then turned into a regular expression.\n// A regexp is made at the end which joins each array with an\n// escaped /, and another full one which joins each regexp with |.\n//\n// Following the lead of Bash 4.1, note that \"**\" only has special meaning\n// when it is the *only* thing in a path portion.  Otherwise, any series\n// of * is equivalent to a single *.  Globstar behavior is enabled by\n// default, and can be disabled by setting options.noglobstar.\n\nexport const makeRe = (pattern: string, options: MinimatchOptions = {}) =>\n  new Minimatch(pattern, options).makeRe()\nminimatch.makeRe = makeRe\n\nexport const match = (\n  list: string[],\n  pattern: string,\n  options: MinimatchOptions = {}\n) => {\n  const mm = new Minimatch(pattern, options)\n  list = list.filter(f => mm.match(f))\n  if (mm.options.nonull && !list.length) {\n    list.push(pattern)\n  }\n  return list\n}\nminimatch.match = match\n\n// replace stuff like \\* with *\nconst globMagic = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/\nconst regExpEscape = (s: string) =>\n  s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n\nexport type MMRegExp = RegExp & {\n  _src?: string\n  _glob?: string\n}\n\nexport type ParseReturnFiltered = string | MMRegExp | typeof GLOBSTAR\nexport type ParseReturn = ParseReturnFiltered | false\n\nexport class Minimatch {\n  options: MinimatchOptions\n  set: ParseReturnFiltered[][]\n  pattern: string\n\n  windowsPathsNoEscape: boolean\n  nonegate: boolean\n  negate: boolean\n  comment: boolean\n  empty: boolean\n  preserveMultipleSlashes: boolean\n  partial: boolean\n  globSet: string[]\n  globParts: string[][]\n  nocase: boolean\n\n  isWindows: boolean\n  platform: Platform\n  windowsNoMagicRoot: boolean\n\n  regexp: false | null | MMRegExp\n  constructor(pattern: string, options: MinimatchOptions = {}) {\n    assertValidPattern(pattern)\n\n    options = options || {}\n    this.options = options\n    this.pattern = pattern\n    this.platform = options.platform || defaultPlatform\n    this.isWindows = this.platform === 'win32'\n    this.windowsPathsNoEscape =\n      !!options.windowsPathsNoEscape || options.allowWindowsEscape === false\n    if (this.windowsPathsNoEscape) {\n      this.pattern = this.pattern.replace(/\\\\/g, '/')\n    }\n    this.preserveMultipleSlashes = !!options.preserveMultipleSlashes\n    this.regexp = null\n    this.negate = false\n    this.nonegate = !!options.nonegate\n    this.comment = false\n    this.empty = false\n    this.partial = !!options.partial\n    this.nocase = !!this.options.nocase\n    this.windowsNoMagicRoot =\n      options.windowsNoMagicRoot !== undefined\n        ? options.windowsNoMagicRoot\n        : !!(this.isWindows && this.nocase)\n\n    this.globSet = []\n    this.globParts = []\n    this.set = []\n\n    // make the set of regexps etc.\n    this.make()\n  }\n\n  hasMagic(): boolean {\n    if (this.options.magicalBraces && this.set.length > 1) {\n      return true\n    }\n    for (const pattern of this.set) {\n      for (const part of pattern) {\n        if (typeof part !== 'string') return true\n      }\n    }\n    return false\n  }\n\n  debug(..._: any[]) {}\n\n  make() {\n    const pattern = this.pattern\n    const options = this.options\n\n    // empty patterns and comments match nothing.\n    if (!options.nocomment && pattern.charAt(0) === '#') {\n      this.comment = true\n      return\n    }\n\n    if (!pattern) {\n      this.empty = true\n      return\n    }\n\n    // step 1: figure out negation, etc.\n    this.parseNegate()\n\n    // step 2: expand braces\n    this.globSet = [...new Set(this.braceExpand())]\n\n    if (options.debug) {\n      this.debug = (...args: any[]) => console.error(...args)\n    }\n\n    this.debug(this.pattern, this.globSet)\n\n    // step 3: now we have a set, so turn each one into a series of\n    // path-portion matching patterns.\n    // These will be regexps, except in the case of \"**\", which is\n    // set to the GLOBSTAR object for globstar behavior,\n    // and will not contain any / characters\n    //\n    // First, we preprocess to make the glob pattern sets a bit simpler\n    // and deduped.  There are some perf-killing patterns that can cause\n    // problems with a glob walk, but we can simplify them down a bit.\n    const rawGlobParts = this.globSet.map(s => this.slashSplit(s))\n    this.globParts = this.preprocess(rawGlobParts)\n    this.debug(this.pattern, this.globParts)\n\n    // glob --> regexps\n    let set = this.globParts.map((s, _, __) => {\n      if (this.isWindows && this.windowsNoMagicRoot) {\n        // check if it's a drive or unc path.\n        const isUNC =\n          s[0] === '' &&\n          s[1] === '' &&\n          (s[2] === '?' || !globMagic.test(s[2])) &&\n          !globMagic.test(s[3])\n        const isDrive = /^[a-z]:/i.test(s[0])\n        if (isUNC) {\n          return [...s.slice(0, 4), ...s.slice(4).map(ss => this.parse(ss))]\n        } else if (isDrive) {\n          return [s[0], ...s.slice(1).map(ss => this.parse(ss))]\n        }\n      }\n      return s.map(ss => this.parse(ss))\n    })\n\n    this.debug(this.pattern, set)\n\n    // filter out everything that didn't compile properly.\n    this.set = set.filter(\n      s => s.indexOf(false) === -1\n    ) as ParseReturnFiltered[][]\n\n    // do not treat the ? in UNC paths as magic\n    if (this.isWindows) {\n      for (let i = 0; i < this.set.length; i++) {\n        const p = this.set[i]\n        if (\n          p[0] === '' &&\n          p[1] === '' &&\n          this.globParts[i][2] === '?' &&\n          typeof p[3] === 'string' &&\n          /^[a-z]:$/i.test(p[3])\n        ) {\n          p[2] = '?'\n        }\n      }\n    }\n\n    this.debug(this.pattern, this.set)\n  }\n\n  // various transforms to equivalent pattern sets that are\n  // faster to process in a filesystem walk.  The goal is to\n  // eliminate what we can, and push all ** patterns as far\n  // to the right as possible, even if it increases the number\n  // of patterns that we have to process.\n  preprocess(globParts: string[][]) {\n    // if we're not in globstar mode, then turn all ** into *\n    if (this.options.noglobstar) {\n      for (let i = 0; i < globParts.length; i++) {\n        for (let j = 0; j < globParts[i].length; j++) {\n          if (globParts[i][j] === '**') {\n            globParts[i][j] = '*'\n          }\n        }\n      }\n    }\n\n    const { optimizationLevel = 1 } = this.options\n\n    if (optimizationLevel >= 2) {\n      // aggressive optimization for the purpose of fs walking\n      globParts = this.firstPhasePreProcess(globParts)\n      globParts = this.secondPhasePreProcess(globParts)\n    } else if (optimizationLevel >= 1) {\n      // just basic optimizations to remove some .. parts\n      globParts = this.levelOneOptimize(globParts)\n    } else {\n      // just collapse multiple ** portions into one\n      globParts = this.adjascentGlobstarOptimize(globParts)\n    }\n\n    return globParts\n  }\n\n  // just get rid of adjascent ** portions\n  adjascentGlobstarOptimize(globParts: string[][]) {\n    return globParts.map(parts => {\n      let gs: number = -1\n      while (-1 !== (gs = parts.indexOf('**', gs + 1))) {\n        let i = gs\n        while (parts[i + 1] === '**') {\n          i++\n        }\n        if (i !== gs) {\n          parts.splice(gs, i - gs)\n        }\n      }\n      return parts\n    })\n  }\n\n  // get rid of adjascent ** and resolve .. portions\n  levelOneOptimize(globParts: string[][]) {\n    return globParts.map(parts => {\n      parts = parts.reduce((set: string[], part) => {\n        const prev = set[set.length - 1]\n        if (part === '**' && prev === '**') {\n          return set\n        }\n        if (part === '..') {\n          if (prev && prev !== '..' && prev !== '.' && prev !== '**') {\n            set.pop()\n            return set\n          }\n        }\n        set.push(part)\n        return set\n      }, [])\n      return parts.length === 0 ? [''] : parts\n    })\n  }\n\n  levelTwoFileOptimize(parts: string | string[]) {\n    if (!Array.isArray(parts)) {\n      parts = this.slashSplit(parts)\n    }\n    let didSomething: boolean = false\n    do {\n      didSomething = false\n      // 
    // -> 
    /\n      if (!this.preserveMultipleSlashes) {\n        for (let i = 1; i < parts.length - 1; i++) {\n          const p = parts[i]\n          // don't squeeze out UNC patterns\n          if (i === 1 && p === '' && parts[0] === '') continue\n          if (p === '.' || p === '') {\n            didSomething = true\n            parts.splice(i, 1)\n            i--\n          }\n        }\n        if (\n          parts[0] === '.' &&\n          parts.length === 2 &&\n          (parts[1] === '.' || parts[1] === '')\n        ) {\n          didSomething = true\n          parts.pop()\n        }\n      }\n\n      // 
    /

    /../ ->

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

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

    /**/../

    /

    / -> {

    /../

    /

    /,

    /**/

    /

    /}\n //

    // -> 
    /\n  // 
    /

    /../ ->

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

    /

    / -> {

    /../

    /

    /,

    /**/

    /

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

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

    /../ ->

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

    /} ->

    /*/\n  // {
    /,
    /} -> 
    /\n  // {
    /**/,
    /} -> 
    /**/\n  //\n  // {
    /**/,
    /**/

    /} ->

    /**/\n  // ^-- not valid because ** doens't follow symlinks\n  secondPhasePreProcess(globParts: string[][]): string[][] {\n    for (let i = 0; i < globParts.length - 1; i++) {\n      for (let j = i + 1; j < globParts.length; j++) {\n        const matched = this.partsMatch(\n          globParts[i],\n          globParts[j],\n          !this.preserveMultipleSlashes\n        )\n        if (matched) {\n          globParts[i] = []\n          globParts[j] = matched\n          break\n        }\n      }\n    }\n    return globParts.filter(gs => gs.length)\n  }\n\n  partsMatch(\n    a: string[],\n    b: string[],\n    emptyGSMatch: boolean = false\n  ): false | string[] {\n    let ai = 0\n    let bi = 0\n    let result: string[] = []\n    let which: string = ''\n    while (ai < a.length && bi < b.length) {\n      if (a[ai] === b[bi]) {\n        result.push(which === 'b' ? b[bi] : a[ai])\n        ai++\n        bi++\n      } else if (emptyGSMatch && a[ai] === '**' && b[bi] === a[ai + 1]) {\n        result.push(a[ai])\n        ai++\n      } else if (emptyGSMatch && b[bi] === '**' && a[ai] === b[bi + 1]) {\n        result.push(b[bi])\n        bi++\n      } else if (\n        a[ai] === '*' &&\n        b[bi] &&\n        (this.options.dot || !b[bi].startsWith('.')) &&\n        b[bi] !== '**'\n      ) {\n        if (which === 'b') return false\n        which = 'a'\n        result.push(a[ai])\n        ai++\n        bi++\n      } else if (\n        b[bi] === '*' &&\n        a[ai] &&\n        (this.options.dot || !a[ai].startsWith('.')) &&\n        a[ai] !== '**'\n      ) {\n        if (which === 'a') return false\n        which = 'b'\n        result.push(b[bi])\n        ai++\n        bi++\n      } else {\n        return false\n      }\n    }\n    // if we fall out of the loop, it means they two are identical\n    // as long as their lengths match\n    return a.length === b.length && result\n  }\n\n  parseNegate() {\n    if (this.nonegate) return\n\n    const pattern = this.pattern\n    let negate = false\n    let negateOffset = 0\n\n    for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {\n      negate = !negate\n      negateOffset++\n    }\n\n    if (negateOffset) this.pattern = pattern.slice(negateOffset)\n    this.negate = negate\n  }\n\n  // set partial to true to test if, for example,\n  // \"/a/b\" matches the start of \"/*/b/*/d\"\n  // Partial means, if you run out of file before you run\n  // out of pattern, then that's fine, as long as all\n  // the parts match.\n  matchOne(file: string[], pattern: ParseReturn[], partial: boolean = false) {\n    const options = this.options\n\n    // UNC paths like //?/X:/... can match X:/... and vice versa\n    // Drive letters in absolute drive or unc paths are always compared\n    // case-insensitively.\n    if (this.isWindows) {\n      const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0])\n      const fileUNC =\n        !fileDrive &&\n        file[0] === '' &&\n        file[1] === '' &&\n        file[2] === '?' &&\n        /^[a-z]:$/i.test(file[3])\n\n      const patternDrive =\n        typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0])\n      const patternUNC =\n        !patternDrive &&\n        pattern[0] === '' &&\n        pattern[1] === '' &&\n        pattern[2] === '?' &&\n        typeof pattern[3] === 'string' &&\n        /^[a-z]:$/i.test(pattern[3])\n\n      const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined\n      const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined\n      if (typeof fdi === 'number' && typeof pdi === 'number') {\n        const [fd, pd]: [string, string] = [file[fdi], pattern[pdi] as string]\n        if (fd.toLowerCase() === pd.toLowerCase()) {\n          pattern[pdi] = fd\n          if (pdi > fdi) {\n            pattern = pattern.slice(pdi)\n          } else if (fdi > pdi) {\n            file = file.slice(fdi)\n          }\n        }\n      }\n    }\n\n    // resolve and reduce . and .. portions in the file as well.\n    // dont' need to do the second phase, because it's only one string[]\n    const { optimizationLevel = 1 } = this.options\n    if (optimizationLevel >= 2) {\n      file = this.levelTwoFileOptimize(file)\n    }\n\n    this.debug('matchOne', this, { file, pattern })\n    this.debug('matchOne', file.length, pattern.length)\n\n    for (\n      var fi = 0, pi = 0, fl = file.length, pl = pattern.length;\n      fi < fl && pi < pl;\n      fi++, pi++\n    ) {\n      this.debug('matchOne loop')\n      var p = pattern[pi]\n      var f = file[fi]\n\n      this.debug(pattern, p, f)\n\n      // should be impossible.\n      // some invalid regexp stuff in the set.\n      /* c8 ignore start */\n      if (p === false) {\n        return false\n      }\n      /* c8 ignore stop */\n\n      if (p === GLOBSTAR) {\n        this.debug('GLOBSTAR', [pattern, p, f])\n\n        // \"**\"\n        // a/**/b/**/c would match the following:\n        // a/b/x/y/z/c\n        // a/x/y/z/b/c\n        // a/b/x/b/x/c\n        // a/b/c\n        // To do this, take the rest of the pattern after\n        // the **, and see if it would match the file remainder.\n        // If so, return success.\n        // If not, the ** \"swallows\" a segment, and try again.\n        // This is recursively awful.\n        //\n        // a/**/b/**/c matching a/b/x/y/z/c\n        // - a matches a\n        // - doublestar\n        //   - matchOne(b/x/y/z/c, b/**/c)\n        //     - b matches b\n        //     - doublestar\n        //       - matchOne(x/y/z/c, c) -> no\n        //       - matchOne(y/z/c, c) -> no\n        //       - matchOne(z/c, c) -> no\n        //       - matchOne(c, c) yes, hit\n        var fr = fi\n        var pr = pi + 1\n        if (pr === pl) {\n          this.debug('** at the end')\n          // a ** at the end will just swallow the rest.\n          // We have found a match.\n          // however, it will not swallow /.x, unless\n          // options.dot is set.\n          // . and .. are *never* matched by **, for explosively\n          // exponential reasons.\n          for (; fi < fl; fi++) {\n            if (\n              file[fi] === '.' ||\n              file[fi] === '..' ||\n              (!options.dot && file[fi].charAt(0) === '.')\n            )\n              return false\n          }\n          return true\n        }\n\n        // ok, let's see if we can swallow whatever we can.\n        while (fr < fl) {\n          var swallowee = file[fr]\n\n          this.debug('\\nglobstar while', file, fr, pattern, pr, swallowee)\n\n          // XXX remove this slice.  Just pass the start index.\n          if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {\n            this.debug('globstar found match!', fr, fl, swallowee)\n            // found a match.\n            return true\n          } else {\n            // can't swallow \".\" or \"..\" ever.\n            // can only swallow \".foo\" when explicitly asked.\n            if (\n              swallowee === '.' ||\n              swallowee === '..' ||\n              (!options.dot && swallowee.charAt(0) === '.')\n            ) {\n              this.debug('dot detected!', file, fr, pattern, pr)\n              break\n            }\n\n            // ** swallows a segment, and continue.\n            this.debug('globstar swallow a segment, and continue')\n            fr++\n          }\n        }\n\n        // no match was found.\n        // However, in partial mode, we can't say this is necessarily over.\n        /* c8 ignore start */\n        if (partial) {\n          // ran out of file\n          this.debug('\\n>>> no match, partial?', file, fr, pattern, pr)\n          if (fr === fl) {\n            return true\n          }\n        }\n        /* c8 ignore stop */\n        return false\n      }\n\n      // something other than **\n      // non-magic patterns just have to match exactly\n      // patterns with magic have been turned into regexps.\n      let hit: boolean\n      if (typeof p === 'string') {\n        hit = f === p\n        this.debug('string match', p, f, hit)\n      } else {\n        hit = p.test(f)\n        this.debug('pattern match', p, f, hit)\n      }\n\n      if (!hit) return false\n    }\n\n    // Note: ending in / means that we'll get a final \"\"\n    // at the end of the pattern.  This can only match a\n    // corresponding \"\" at the end of the file.\n    // If the file ends in /, then it can only match a\n    // a pattern that ends in /, unless the pattern just\n    // doesn't have any more for it. But, a/b/ should *not*\n    // match \"a/b/*\", even though \"\" matches against the\n    // [^/]*? pattern, except in partial mode, where it might\n    // simply not be reached yet.\n    // However, a/b/ should still satisfy a/*\n\n    // now either we fell off the end of the pattern, or we're done.\n    if (fi === fl && pi === pl) {\n      // ran out of pattern and filename at the same time.\n      // an exact hit!\n      return true\n    } else if (fi === fl) {\n      // ran out of file, but still had pattern left.\n      // this is ok if we're doing the match as part of\n      // a glob fs traversal.\n      return partial\n    } else if (pi === pl) {\n      // ran out of pattern, still have file left.\n      // this is only acceptable if we're on the very last\n      // empty segment of a file with a trailing slash.\n      // a/* should match a/b/\n      return fi === fl - 1 && file[fi] === ''\n\n      /* c8 ignore start */\n    } else {\n      // should be unreachable.\n      throw new Error('wtf?')\n    }\n    /* c8 ignore stop */\n  }\n\n  braceExpand() {\n    return braceExpand(this.pattern, this.options)\n  }\n\n  parse(pattern: string): ParseReturn {\n    assertValidPattern(pattern)\n\n    const options = this.options\n\n    // shortcuts\n    if (pattern === '**') return GLOBSTAR\n    if (pattern === '') return ''\n\n    // far and away, the most common glob pattern parts are\n    // *, *.*, and *.  Add a fast check method for those.\n    let m: RegExpMatchArray | null\n    let fastTest: null | ((f: string) => boolean) = null\n    if ((m = pattern.match(starRE))) {\n      fastTest = options.dot ? starTestDot : starTest\n    } else if ((m = pattern.match(starDotExtRE))) {\n      fastTest = (\n        options.nocase\n          ? options.dot\n            ? starDotExtTestNocaseDot\n            : starDotExtTestNocase\n          : options.dot\n          ? starDotExtTestDot\n          : starDotExtTest\n      )(m[1])\n    } else if ((m = pattern.match(qmarksRE))) {\n      fastTest = (\n        options.nocase\n          ? options.dot\n            ? qmarksTestNocaseDot\n            : qmarksTestNocase\n          : options.dot\n          ? qmarksTestDot\n          : qmarksTest\n      )(m)\n    } else if ((m = pattern.match(starDotStarRE))) {\n      fastTest = options.dot ? starDotStarTestDot : starDotStarTest\n    } else if ((m = pattern.match(dotStarRE))) {\n      fastTest = dotStarTest\n    }\n\n    const re = AST.fromGlob(pattern, this.options).toMMPattern()\n    if (fastTest && typeof re === 'object') {\n      // Avoids overriding in frozen environments\n      Reflect.defineProperty(re, 'test', { value: fastTest })\n    }\n    return re\n  }\n\n  makeRe() {\n    if (this.regexp || this.regexp === false) return this.regexp\n\n    // at this point, this.set is a 2d array of partial\n    // pattern strings, or \"**\".\n    //\n    // It's better to use .match().  This function shouldn't\n    // be used, really, but it's pretty convenient sometimes,\n    // when you just want to work with a regex.\n    const set = this.set\n\n    if (!set.length) {\n      this.regexp = false\n      return this.regexp\n    }\n    const options = this.options\n\n    const twoStar = options.noglobstar\n      ? star\n      : options.dot\n      ? twoStarDot\n      : twoStarNoDot\n    const flags = new Set(options.nocase ? ['i'] : [])\n\n    // regexpify non-globstar patterns\n    // if ** is only item, then we just do one twoStar\n    // if ** is first, and there are more, prepend (\\/|twoStar\\/)? to next\n    // if ** is last, append (\\/twoStar|) to previous\n    // if ** is in the middle, append (\\/|\\/twoStar\\/) to previous\n    // then filter out GLOBSTAR symbols\n    let re = set\n      .map(pattern => {\n        const pp: (string | typeof GLOBSTAR)[] = pattern.map(p => {\n          if (p instanceof RegExp) {\n            for (const f of p.flags.split('')) flags.add(f)\n          }\n          return typeof p === 'string'\n            ? regExpEscape(p)\n            : p === GLOBSTAR\n            ? GLOBSTAR\n            : p._src\n        }) as (string | typeof GLOBSTAR)[]\n        pp.forEach((p, i) => {\n          const next = pp[i + 1]\n          const prev = pp[i - 1]\n          if (p !== GLOBSTAR || prev === GLOBSTAR) {\n            return\n          }\n          if (prev === undefined) {\n            if (next !== undefined && next !== GLOBSTAR) {\n              pp[i + 1] = '(?:\\\\/|' + twoStar + '\\\\/)?' + next\n            } else {\n              pp[i] = twoStar\n            }\n          } else if (next === undefined) {\n            pp[i - 1] = prev + '(?:\\\\/|' + twoStar + ')?'\n          } else if (next !== GLOBSTAR) {\n            pp[i - 1] = prev + '(?:\\\\/|\\\\/' + twoStar + '\\\\/)' + next\n            pp[i + 1] = GLOBSTAR\n          }\n        })\n        return pp.filter(p => p !== GLOBSTAR).join('/')\n      })\n      .join('|')\n\n    // need to wrap in parens if we had more than one thing with |,\n    // otherwise only the first will be anchored to ^ and the last to $\n    const [open, close] = set.length > 1 ? ['(?:', ')'] : ['', '']\n    // must match entire pattern\n    // ending in a * or ** will make it less strict.\n    re = '^' + open + re + close + '$'\n\n    // can match anything, as long as it's not this.\n    if (this.negate) re = '^(?!' + re + ').+$'\n\n    try {\n      this.regexp = new RegExp(re, [...flags].join(''))\n      /* c8 ignore start */\n    } catch (ex) {\n      // should be impossible\n      this.regexp = false\n    }\n    /* c8 ignore stop */\n    return this.regexp\n  }\n\n  slashSplit(p: string) {\n    // if p starts with // on windows, we preserve that\n    // so that UNC paths aren't broken.  Otherwise, any number of\n    // / characters are coalesced into one, unless\n    // preserveMultipleSlashes is set to true.\n    if (this.preserveMultipleSlashes) {\n      return p.split('/')\n    } else if (this.isWindows && /^\\/\\/[^\\/]+/.test(p)) {\n      // add an extra '' for the one we lose\n      return ['', ...p.split(/\\/+/)]\n    } else {\n      return p.split(/\\/+/)\n    }\n  }\n\n  match(f: string, partial = this.partial) {\n    this.debug('match', f, this.pattern)\n    // short-circuit in the case of busted things.\n    // comments, etc.\n    if (this.comment) {\n      return false\n    }\n    if (this.empty) {\n      return f === ''\n    }\n\n    if (f === '/' && partial) {\n      return true\n    }\n\n    const options = this.options\n\n    // windows: need to use /, not \\\n    if (this.isWindows) {\n      f = f.split('\\\\').join('/')\n    }\n\n    // treat the test path as a set of pathparts.\n    const ff = this.slashSplit(f)\n    this.debug(this.pattern, 'split', ff)\n\n    // just ONE of the pattern sets in this.set needs to match\n    // in order for it to be valid.  If negating, then just one\n    // match means that we have failed.\n    // Either way, return on the first hit.\n\n    const set = this.set\n    this.debug(this.pattern, 'set', set)\n\n    // Find the basename of the path by looking for the last non-empty segment\n    let filename: string = ff[ff.length - 1]\n    if (!filename) {\n      for (let i = ff.length - 2; !filename && i >= 0; i--) {\n        filename = ff[i]\n      }\n    }\n\n    for (let i = 0; i < set.length; i++) {\n      const pattern = set[i]\n      let file = ff\n      if (options.matchBase && pattern.length === 1) {\n        file = [filename]\n      }\n      const hit = this.matchOne(file, pattern, partial)\n      if (hit) {\n        if (options.flipNegate) {\n          return true\n        }\n        return !this.negate\n      }\n    }\n\n    // didn't get any hits.  this is success if it's a negative\n    // pattern, failure otherwise.\n    if (options.flipNegate) {\n      return false\n    }\n    return this.negate\n  }\n\n  static defaults(def: MinimatchOptions) {\n    return minimatch.defaults(def).Minimatch\n  }\n}\n/* c8 ignore start */\nexport { AST } from './ast.js'\nexport { escape } from './escape.js'\nexport { unescape } from './unescape.js'\n/* c8 ignore stop */\nminimatch.AST = AST\nminimatch.Minimatch = Minimatch\nminimatch.escape = escape\nminimatch.unescape = unescape\n"]}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/package.json b/node_modules/sucrase/node_modules/minimatch/dist/esm/package.json
    new file mode 100644
    index 00000000..3dbc1ca5
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/package.json
    @@ -0,0 +1,3 @@
    +{
    +  "type": "module"
    +}
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.d.ts b/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.d.ts
    new file mode 100644
    index 00000000..23a7b387
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.d.ts
    @@ -0,0 +1,17 @@
    +import { MinimatchOptions } from './index.js';
    +/**
    + * 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 declare const unescape: (s: string, { windowsPathsNoEscape, }?: Pick) => string;
    +//# sourceMappingURL=unescape.d.ts.map
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.d.ts.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.d.ts.map
    new file mode 100644
    index 00000000..7ace0701
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.d.ts.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"unescape.d.ts","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,MAChB,MAAM,8BAGN,KAAK,gBAAgB,EAAE,sBAAsB,CAAC,WAKlD,CAAA"}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.js b/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.js
    new file mode 100644
    index 00000000..0faf9a2b
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.js
    @@ -0,0 +1,20 @@
    +/**
    + * 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/sucrase/node_modules/minimatch/dist/esm/unescape.js.map b/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.js.map
    new file mode 100644
    index 00000000..eb146c20
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/dist/esm/unescape.js.map
    @@ -0,0 +1 @@
    +{"version":3,"file":"unescape.js","sourceRoot":"","sources":["../../src/unescape.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,CAAS,EACT,EACE,oBAAoB,GAAG,KAAK,MACsB,EAAE,EACtD,EAAE;IACF,OAAO,oBAAoB;QACzB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC;QACnC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AAChF,CAAC,CAAA","sourcesContent":["import { MinimatchOptions } from './index.js'\n/**\n * Un-escape a string that has been escaped with {@link escape}.\n *\n * If the {@link windowsPathsNoEscape} option is used, then square-brace\n * escapes are removed, but not backslash escapes.  For example, it will turn\n * the string `'[*]'` into `*`, but it will not turn `'\\\\*'` into `'*'`,\n * becuase `\\` is a path separator in `windowsPathsNoEscape` mode.\n *\n * When `windowsPathsNoEscape` is not set, then both brace escapes and\n * backslash escapes are removed.\n *\n * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped\n * or unescaped.\n */\nexport const unescape = (\n  s: string,\n  {\n    windowsPathsNoEscape = false,\n  }: Pick = {}\n) => {\n  return windowsPathsNoEscape\n    ? s.replace(/\\[([^\\/\\\\])\\]/g, '$1')\n    : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, '$1$2').replace(/\\\\([^\\/])/g, '$1')\n}\n"]}
    \ No newline at end of file
    diff --git a/node_modules/sucrase/node_modules/minimatch/package.json b/node_modules/sucrase/node_modules/minimatch/package.json
    new file mode 100644
    index 00000000..01fc48ec
    --- /dev/null
    +++ b/node_modules/sucrase/node_modules/minimatch/package.json
    @@ -0,0 +1,82 @@
    +{
    +  "author": "Isaac Z. Schlueter  (http://blog.izs.me)",
    +  "name": "minimatch",
    +  "description": "a glob matcher in javascript",
    +  "version": "9.0.5",
    +  "repository": {
    +    "type": "git",
    +    "url": "git://github.com/isaacs/minimatch.git"
    +  },
    +  "main": "./dist/commonjs/index.js",
    +  "types": "./dist/commonjs/index.d.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",
    +    "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",
    +    "eslint-config-prettier": "^8.6.0",
    +    "mkdirp": "1",
    +    "prettier": "^2.8.2",
    +    "tap": "^18.7.2",
    +    "ts-node": "^10.9.1",
    +    "tshy": "^1.12.0",
    +    "typedoc": "^0.23.21",
    +    "typescript": "^4.9.3"
    +  },
    +  "funding": {
    +    "url": "https://github.com/sponsors/isaacs"
    +  },
    +  "license": "ISC",
    +  "tshy": {
    +    "exports": {
    +      "./package.json": "./package.json",
    +      ".": "./src/index.ts"
    +    }
    +  },
    +  "type": "module"
    +}
    diff --git a/node_modules/sucrase/package.json b/node_modules/sucrase/package.json
    new file mode 100644
    index 00000000..dc994251
    --- /dev/null
    +++ b/node_modules/sucrase/package.json
    @@ -0,0 +1,88 @@
    +{
    +  "name": "sucrase",
    +  "version": "3.35.0",
    +  "description": "Super-fast alternative to Babel for when you can target modern JS runtimes",
    +  "author": "Alan Pierce ",
    +  "license": "MIT",
    +  "main": "dist/index.js",
    +  "module": "dist/esm/index.js",
    +  "types": "dist/types/index.d.ts",
    +  "bin": {
    +    "sucrase": "./bin/sucrase",
    +    "sucrase-node": "./bin/sucrase-node"
    +  },
    +  "scripts": {
    +    "build": "sucrase-node script/build.ts",
    +    "fast-build": "sucrase-node script/build.ts --fast",
    +    "clean": "rm -rf ./build ./dist ./dist-self-build ./dist-types ./example-runner/example-repos ./spec-compliance-tests/test262/test262-checkout ./spec-compliance-tests/babel-tests/babel-tests-checkout",
    +    "generate": "sucrase-node generator/generate.ts",
    +    "benchmark": "cd benchmark && yarn && sucrase-node ./benchmark.ts",
    +    "benchmark-compare": "sucrase-node ./benchmark/compare-performance.ts",
    +    "microbenchmark": "sucrase-node benchmark/microbenchmark.ts",
    +    "lint": "sucrase-node script/lint.ts",
    +    "lint-fix": "sucrase-node script/lint.ts --fix",
    +    "profile": "node --inspect-brk ./node_modules/.bin/sucrase-node ./benchmark/profile",
    +    "profile-project": "node --inspect-brk ./node_modules/.bin/sucrase-node ./benchmark/benchmark-project.ts --profile",
    +    "prepublishOnly": "yarn clean && yarn build",
    +    "release": "sucrase-node script/release.ts",
    +    "run-examples": "sucrase-node example-runner/example-runner.ts",
    +    "test": "yarn lint && yarn test-only",
    +    "test-only": "mocha './test/**/*.ts'",
    +    "integration-test": "cd integration-test && yarn && yarn link @sucrase/jest-plugin && mocha --timeout 10000 ./integration-tests.ts",
    +    "test262": "sucrase-node spec-compliance-tests/test262/run-test262.ts",
    +    "check-babel-tests": "sucrase-node spec-compliance-tests/babel-tests/check-babel-tests.ts",
    +    "test-with-coverage": "nyc mocha './test/**/*.ts'",
    +    "report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov"
    +  },
    +  "repository": {
    +    "type": "git",
    +    "url": "https://github.com/alangpierce/sucrase.git"
    +  },
    +  "keywords": [
    +    "babel",
    +    "jsx",
    +    "typescript",
    +    "flow"
    +  ],
    +  "bugs": {
    +    "url": "https://github.com/alangpierce/sucrase/issues"
    +  },
    +  "devDependencies": {
    +    "@babel/core": "^7.22.5",
    +    "@jridgewell/trace-mapping": "^0.3.18",
    +    "@types/mocha": "^9.1.1",
    +    "@types/mz": "^2.7.4",
    +    "@types/node": "^20.3.2",
    +    "@typescript-eslint/eslint-plugin": "^5.60.1",
    +    "@typescript-eslint/parser": "^5.60.1",
    +    "chalk": "^4",
    +    "codecov": "^3.8.3",
    +    "eslint": "^8.43.0",
    +    "eslint-config-airbnb-base": "^15.0.0",
    +    "eslint-config-prettier": "^8.8.0",
    +    "eslint-plugin-import": "~2.26",
    +    "eslint-plugin-prettier": "^4.2.1",
    +    "mocha": "^10.2.0",
    +    "nyc": "^15.1.0",
    +    "prettier": "^2.8.8",
    +    "sucrase": "^3.34.0",
    +    "test262-harness": "^10.0.0",
    +    "ts-interface-builder": "^0.3.3",
    +    "typescript": "~5.0"
    +  },
    +  "dependencies": {
    +    "@jridgewell/gen-mapping": "^0.3.2",
    +    "commander": "^4.0.0",
    +    "glob": "^10.3.10",
    +    "lines-and-columns": "^1.1.6",
    +    "mz": "^2.7.0",
    +    "pirates": "^4.0.1",
    +    "ts-interface-checker": "^0.1.9"
    +  },
    +  "engines": {
    +    "node": ">=16 || 14 >=14.17"
    +  },
    +  "resolutions": {
    +    "**/eshost/socket.io": "4.7.0"
    +  }
    +}
    diff --git a/node_modules/sucrase/register/index.js b/node_modules/sucrase/register/index.js
    new file mode 100644
    index 00000000..f6eb814b
    --- /dev/null
    +++ b/node_modules/sucrase/register/index.js
    @@ -0,0 +1 @@
    +require("../dist/register").registerAll();
    diff --git a/node_modules/sucrase/register/js.js b/node_modules/sucrase/register/js.js
    new file mode 100644
    index 00000000..48918960
    --- /dev/null
    +++ b/node_modules/sucrase/register/js.js
    @@ -0,0 +1 @@
    +require("../dist/register").registerJS();
    diff --git a/node_modules/sucrase/register/jsx.js b/node_modules/sucrase/register/jsx.js
    new file mode 100644
    index 00000000..4bd476ea
    --- /dev/null
    +++ b/node_modules/sucrase/register/jsx.js
    @@ -0,0 +1 @@
    +require("../dist/register").registerJSX();
    diff --git a/node_modules/sucrase/register/ts-legacy-module-interop.js b/node_modules/sucrase/register/ts-legacy-module-interop.js
    new file mode 100644
    index 00000000..1ec5a6d7
    --- /dev/null
    +++ b/node_modules/sucrase/register/ts-legacy-module-interop.js
    @@ -0,0 +1 @@
    +require("../dist/register").registerTSLegacyModuleInterop();
    diff --git a/node_modules/sucrase/register/ts.js b/node_modules/sucrase/register/ts.js
    new file mode 100644
    index 00000000..23b8c885
    --- /dev/null
    +++ b/node_modules/sucrase/register/ts.js
    @@ -0,0 +1 @@
    +require("../dist/register").registerTS();
    diff --git a/node_modules/sucrase/register/tsx-legacy-module-interop.js b/node_modules/sucrase/register/tsx-legacy-module-interop.js
    new file mode 100644
    index 00000000..a883680d
    --- /dev/null
    +++ b/node_modules/sucrase/register/tsx-legacy-module-interop.js
    @@ -0,0 +1 @@
    +require("../dist/register").registerTSXLegacyModuleInterop();
    diff --git a/node_modules/sucrase/register/tsx.js b/node_modules/sucrase/register/tsx.js
    new file mode 100644
    index 00000000..deb8b34e
    --- /dev/null
    +++ b/node_modules/sucrase/register/tsx.js
    @@ -0,0 +1 @@
    +require("../dist/register").registerTSX();
    diff --git a/node_modules/sucrase/ts-node-plugin/index.js b/node_modules/sucrase/ts-node-plugin/index.js
    new file mode 100644
    index 00000000..b523fb36
    --- /dev/null
    +++ b/node_modules/sucrase/ts-node-plugin/index.js
    @@ -0,0 +1,83 @@
    +const {transform} = require("../dist");
    +
    +// Enum constants taken from the TypeScript codebase.
    +const ModuleKindCommonJS = 1;
    +
    +const JsxEmitReactJSX = 4;
    +const JsxEmitReactJSXDev = 5;
    +
    +/**
    + * ts-node transpiler plugin
    + *
    + * This plugin hooks into ts-node so that Sucrase can handle all TS-to-JS
    + * conversion while ts-node handles the ESM loader, require hook, REPL
    + * integration, etc. ts-node automatically discovers the relevant tsconfig file,
    + * so the main logic in this integration is translating tsconfig options to the
    + * corresponding Sucrase options.
    + *
    + * Any tsconfig options relevant to Sucrase are translated, but some config
    + * options outside the scope of Sucrase are ignored. For example, we assume the
    + * isolatedModules option, and we ignore target because Sucrase doesn't provide
    + * JS syntax downleveling (at least not in a way that is useful for Node).
    + *
    + * One notable caveat is that importsNotUsedAsValues and preserveValueImports
    + * are ignored right now, since they are deprecated and don't have exact Sucrase
    + * equivalents. To preserve imports and exports, use verbatimModuleSyntax.
    + */
    +function create(createOptions) {
    +  const {nodeModuleEmitKind} = createOptions;
    +  const {
    +    module,
    +    jsx,
    +    jsxFactory,
    +    jsxFragmentFactory,
    +    jsxImportSource,
    +    esModuleInterop,
    +    verbatimModuleSyntax,
    +  } = createOptions.service.config.options;
    +
    +  return {
    +    transpile(input, transpileOptions) {
    +      const {fileName} = transpileOptions;
    +      const transforms = [];
    +      // Detect JS rather than TS so we bias toward including the typescript
    +      // transform, since almost always it doesn't hurt to include.
    +      const isJS =
    +        fileName.endsWith(".js") ||
    +        fileName.endsWith(".jsx") ||
    +        fileName.endsWith(".mjs") ||
    +        fileName.endsWith(".cjs");
    +      if (!isJS) {
    +        transforms.push("typescript");
    +      }
    +      if (module === ModuleKindCommonJS || nodeModuleEmitKind === "nodecjs") {
    +        transforms.push("imports");
    +      }
    +      if (fileName.endsWith(".tsx") || fileName.endsWith(".jsx")) {
    +        transforms.push("jsx");
    +      }
    +
    +      const {code, sourceMap} = transform(input, {
    +        transforms,
    +        disableESTransforms: true,
    +        jsxRuntime: jsx === JsxEmitReactJSX || jsx === JsxEmitReactJSXDev ? "automatic" : "classic",
    +        production: jsx === JsxEmitReactJSX,
    +        jsxImportSource,
    +        jsxPragma: jsxFactory,
    +        jsxFragmentPragma: jsxFragmentFactory,
    +        keepUnusedImports: verbatimModuleSyntax,
    +        preserveDynamicImport: nodeModuleEmitKind === "nodecjs",
    +        injectCreateRequireForImportRequire: nodeModuleEmitKind === "nodeesm",
    +        enableLegacyTypeScriptModuleInterop: !esModuleInterop,
    +        sourceMapOptions: {compiledFilename: fileName},
    +        filePath: fileName,
    +      });
    +      return {
    +        outputText: code,
    +        sourceMapText: JSON.stringify(sourceMap),
    +      };
    +    },
    +  };
    +}
    +
    +exports.create = create;
    diff --git a/node_modules/supports-preserve-symlinks-flag/.eslintrc b/node_modules/supports-preserve-symlinks-flag/.eslintrc
    new file mode 100644
    index 00000000..346ffeca
    --- /dev/null
    +++ b/node_modules/supports-preserve-symlinks-flag/.eslintrc
    @@ -0,0 +1,14 @@
    +{
    +	"root": true,
    +
    +	"extends": "@ljharb",
    +
    +	"env": {
    +		"browser": true,
    +		"node": true,
    +	},
    +
    +	"rules": {
    +		"id-length": "off",
    +	},
    +}
    diff --git a/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml b/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml
    new file mode 100644
    index 00000000..e8d64f37
    --- /dev/null
    +++ b/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml
    @@ -0,0 +1,12 @@
    +# These are supported funding model platforms
    +
    +github: [ljharb]
    +patreon: # Replace with a single Patreon username
    +open_collective: # Replace with a single Open Collective username
    +ko_fi: # Replace with a single Ko-fi username
    +tidelift: npm/supports-preserve-symlink-flag
    +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
    +liberapay: # Replace with a single Liberapay username
    +issuehunt: # Replace with a single IssueHunt username
    +otechie: # Replace with a single Otechie username
    +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
    diff --git a/node_modules/supports-preserve-symlinks-flag/.nycrc b/node_modules/supports-preserve-symlinks-flag/.nycrc
    new file mode 100644
    index 00000000..bdd626ce
    --- /dev/null
    +++ b/node_modules/supports-preserve-symlinks-flag/.nycrc
    @@ -0,0 +1,9 @@
    +{
    +	"all": true,
    +	"check-coverage": false,
    +	"reporter": ["text-summary", "text", "html", "json"],
    +	"exclude": [
    +		"coverage",
    +		"test"
    +	]
    +}
    diff --git a/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md b/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md
    new file mode 100644
    index 00000000..61f607f4
    --- /dev/null
    +++ b/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md
    @@ -0,0 +1,22 @@
    +# Changelog
    +
    +All notable changes to this project will be documented in this file.
    +
    +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
    +
    +## v1.0.0 - 2022-01-02
    +
    +### Commits
    +
    +- Tests [`e2f59ad`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/e2f59ad74e2ae0f5f4899fcde6a6f693ab7cc074)
    +- Initial commit [`dc222aa`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/dc222aad3c0b940d8d3af1ca9937d108bd2dc4b9)
    +- [meta] do not publish workflow files [`5ef77f7`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/5ef77f7cb6946d16ee38672be9ec0f1bbdf63262)
    +- npm init [`992b068`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/992b068503a461f7e8676f40ca2aab255fd8d6ff)
    +- read me [`6c9afa9`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/6c9afa9fabc8eaf0814aaed6dd01e6df0931b76d)
    +- Initial implementation [`2f98925`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/2f9892546396d4ab0ad9f1ff83e76c3f01234ae8)
    +- [meta] add `auto-changelog` [`6c476ae`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/6c476ae1ed7ce68b0480344f090ac2844f35509d)
    +- [Dev Deps] add `eslint`, `@ljharb/eslint-config` [`d0fffc8`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/d0fffc886d25fba119355520750a909d64da0087)
    +- Only apps should have lockfiles [`ab318ed`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/ab318ed7ae62f6c2c0e80a50398d40912afd8f69)
    +- [meta] add `safe-publish-latest` [`2bb23b3`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/2bb23b3ebab02dc4135c4cdf0217db82835b9fca)
    +- [meta] add `sideEffects` flag [`600223b`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/600223ba24f30779f209d9097721eff35ed62741)
    diff --git a/node_modules/supports-preserve-symlinks-flag/LICENSE b/node_modules/supports-preserve-symlinks-flag/LICENSE
    new file mode 100644
    index 00000000..2e7b9a3e
    --- /dev/null
    +++ b/node_modules/supports-preserve-symlinks-flag/LICENSE
    @@ -0,0 +1,21 @@
    +MIT License
    +
    +Copyright (c) 2022 Inspect JS
    +
    +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/supports-preserve-symlinks-flag/README.md b/node_modules/supports-preserve-symlinks-flag/README.md
    new file mode 100644
    index 00000000..eb05b124
    --- /dev/null
    +++ b/node_modules/supports-preserve-symlinks-flag/README.md
    @@ -0,0 +1,42 @@
    +# node-supports-preserve-symlinks-flag [![Version Badge][npm-version-svg]][package-url]
    +
    +[![github actions][actions-image]][actions-url]
    +[![coverage][codecov-image]][codecov-url]
    +[![dependency status][deps-svg]][deps-url]
    +[![dev dependency status][dev-deps-svg]][dev-deps-url]
    +[![License][license-image]][license-url]
    +[![Downloads][downloads-image]][downloads-url]
    +
    +[![npm badge][npm-badge-png]][package-url]
    +
    +Determine if the current node version supports the `--preserve-symlinks` flag.
    +
    +## Example
    +
    +```js
    +var supportsPreserveSymlinks = require('node-supports-preserve-symlinks-flag');
    +var assert = require('assert');
    +
    +assert.equal(supportsPreserveSymlinks, null); // in a browser
    +assert.equal(supportsPreserveSymlinks, false); // in node < v6.2
    +assert.equal(supportsPreserveSymlinks, true); // in node v6.2+
    +```
    +
    +## Tests
    +Simply clone the repo, `npm install`, and run `npm test`
    +
    +[package-url]: https://npmjs.org/package/node-supports-preserve-symlinks-flag
    +[npm-version-svg]: https://versionbadg.es/inspect-js/node-supports-preserve-symlinks-flag.svg
    +[deps-svg]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag.svg
    +[deps-url]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag
    +[dev-deps-svg]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag/dev-status.svg
    +[dev-deps-url]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag#info=devDependencies
    +[npm-badge-png]: https://nodei.co/npm/node-supports-preserve-symlinks-flag.png?downloads=true&stars=true
    +[license-image]: https://img.shields.io/npm/l/node-supports-preserve-symlinks-flag.svg
    +[license-url]: LICENSE
    +[downloads-image]: https://img.shields.io/npm/dm/node-supports-preserve-symlinks-flag.svg
    +[downloads-url]: https://npm-stat.com/charts.html?package=node-supports-preserve-symlinks-flag
    +[codecov-image]: https://codecov.io/gh/inspect-js/node-supports-preserve-symlinks-flag/branch/main/graphs/badge.svg
    +[codecov-url]: https://app.codecov.io/gh/inspect-js/node-supports-preserve-symlinks-flag/
    +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/node-supports-preserve-symlinks-flag
    +[actions-url]: https://github.com/inspect-js/node-supports-preserve-symlinks-flag/actions
    diff --git a/node_modules/supports-preserve-symlinks-flag/browser.js b/node_modules/supports-preserve-symlinks-flag/browser.js
    new file mode 100644
    index 00000000..087be1fe
    --- /dev/null
    +++ b/node_modules/supports-preserve-symlinks-flag/browser.js
    @@ -0,0 +1,3 @@
    +'use strict';
    +
    +module.exports = null;
    diff --git a/node_modules/supports-preserve-symlinks-flag/index.js b/node_modules/supports-preserve-symlinks-flag/index.js
    new file mode 100644
    index 00000000..86fd5d33
    --- /dev/null
    +++ b/node_modules/supports-preserve-symlinks-flag/index.js
    @@ -0,0 +1,9 @@
    +'use strict';
    +
    +module.exports = (
    +// node 12+
    +	process.allowedNodeEnvironmentFlags && process.allowedNodeEnvironmentFlags.has('--preserve-symlinks')
    +) || (
    +// node v6.2 - v11
    +	String(module.constructor._findPath).indexOf('preserveSymlinks') >= 0 // eslint-disable-line no-underscore-dangle
    +);
    diff --git a/node_modules/supports-preserve-symlinks-flag/package.json b/node_modules/supports-preserve-symlinks-flag/package.json
    new file mode 100644
    index 00000000..56edadca
    --- /dev/null
    +++ b/node_modules/supports-preserve-symlinks-flag/package.json
    @@ -0,0 +1,70 @@
    +{
    +	"name": "supports-preserve-symlinks-flag",
    +	"version": "1.0.0",
    +	"description": "Determine if the current node version supports the `--preserve-symlinks` flag.",
    +	"main": "./index.js",
    +	"browser": "./browser.js",
    +	"exports": {
    +		".": [
    +			{
    +				"browser": "./browser.js",
    +				"default": "./index.js"
    +			},
    +			"./index.js"
    +		],
    +		"./package.json": "./package.json"
    +	},
    +	"sideEffects": false,
    +	"scripts": {
    +		"prepublishOnly": "safe-publish-latest",
    +		"prepublish": "not-in-publish || npm run prepublishOnly",
    +		"lint": "eslint --ext=js,mjs .",
    +		"pretest": "npm run lint",
    +		"tests-only": "nyc tape 'test/**/*.js'",
    +		"test": "npm run tests-only",
    +		"posttest": "aud --production",
    +		"version": "auto-changelog && git add CHANGELOG.md",
    +		"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
    +	},
    +	"repository": {
    +		"type": "git",
    +		"url": "git+https://github.com/inspect-js/node-supports-preserve-symlinks-flag.git"
    +	},
    +	"keywords": [
    +		"node",
    +		"flag",
    +		"symlink",
    +		"symlinks",
    +		"preserve-symlinks"
    +	],
    +	"author": "Jordan Harband ",
    +	"funding": {
    +		"url": "https://github.com/sponsors/ljharb"
    +	},
    +	"license": "MIT",
    +	"bugs": {
    +		"url": "https://github.com/inspect-js/node-supports-preserve-symlinks-flag/issues"
    +	},
    +	"homepage": "https://github.com/inspect-js/node-supports-preserve-symlinks-flag#readme",
    +	"devDependencies": {
    +		"@ljharb/eslint-config": "^20.1.0",
    +		"aud": "^1.1.5",
    +		"auto-changelog": "^2.3.0",
    +		"eslint": "^8.6.0",
    +		"nyc": "^10.3.2",
    +		"safe-publish-latest": "^2.0.0",
    +		"semver": "^6.3.0",
    +		"tape": "^5.4.0"
    +	},
    +	"engines": {
    +		"node": ">= 0.4"
    +	},
    +	"auto-changelog": {
    +		"output": "CHANGELOG.md",
    +		"template": "keepachangelog",
    +		"unreleased": false,
    +		"commitLimit": false,
    +		"backfillLimit": false,
    +		"hideCredit": true
    +	}
    +}
    diff --git a/node_modules/supports-preserve-symlinks-flag/test/index.js b/node_modules/supports-preserve-symlinks-flag/test/index.js
    new file mode 100644
    index 00000000..9938d671
    --- /dev/null
    +++ b/node_modules/supports-preserve-symlinks-flag/test/index.js
    @@ -0,0 +1,29 @@
    +'use strict';
    +
    +var test = require('tape');
    +var semver = require('semver');
    +
    +var supportsPreserveSymlinks = require('../');
    +var browser = require('../browser');
    +
    +test('supportsPreserveSymlinks', function (t) {
    +	t.equal(typeof supportsPreserveSymlinks, 'boolean', 'is a boolean');
    +
    +	t.equal(browser, null, 'browser file is `null`');
    +	t.equal(
    +		supportsPreserveSymlinks,
    +		null,
    +		'in a browser, is null',
    +		{ skip: typeof window === 'undefined' }
    +	);
    +
    +	var expected = semver.satisfies(process.version, '>= 6.2');
    +	t.equal(
    +		supportsPreserveSymlinks,
    +		expected,
    +		'is true in node v6.2+, false otherwise (actual: ' + supportsPreserveSymlinks + ', expected ' + expected + ')',
    +		{ skip: typeof window !== 'undefined' }
    +	);
    +
    +	t.end();
    +});
    diff --git a/node_modules/svelte-inview/README.md b/node_modules/svelte-inview/README.md
    new file mode 100644
    index 00000000..e51dd382
    --- /dev/null
    +++ b/node_modules/svelte-inview/README.md
    @@ -0,0 +1,239 @@
    +# Svelte Inview
    +
    +A Svelte action that monitors an element enters or leaves the viewport/parent element. Performant and efficient thanks to using [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) under the hood. Can be used in multiple projects including lazy loading images, infinite scrolling, playing/pausing the video when in the viewport, tracking user behaviour firing link pre-fetching and animations and many many more.
    +
    +
    +
    +🔥 Check it out live [here](https://svelte-inview.netlify.app/)
    +
    +Support if you like it ☕ 🔥 
    +[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png)](https://www.buymeacoffee.com/maciekgrzybek) + +## Why bother? + +- 👓️ Watch for any element that enters or leaves the viewport (or another wrapper/parent element). +- 🏎️ Thanks to using [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API), Svelte Inview is blazing fast and doesn't block the main thread. +- 📦️ Tiny, yet powerful (just ~2kb). No external dependencies (well, apart from Svelte). +- 🎛️ Use it in several different scenarios such as lazy loading images, infinite scrolling, playing/pausing the video when in the viewport, firing link pre-fetching, animations and many many more. +- 🐥 Easy to use API. +- ↕️ Detects the scrolling direction. + +## Installation + +The only thing you need is Svelte itself. + +Svelte Inview is distributed via [npm](https://www.npmjs.com/package/svelte-inview). + +```sh +$ yarn add svelte-inview +# or +$ npm install --save svelte-inview +``` + +> ⚠️ Modern browsers have the full support of Intersection Observer, but if you need to support ones like IE you can use this [simple polyfill](https://www.npmjs.com/package/intersection-observer). Just install it and import it in your project. + +## Usage + +### Basic Use Case + +This is the most basic use case for `svelte-inview`. Just add the action to the element you want to track - `use:inview`. You can also pass other [configuration props](#props). You can see if the element is visible by checking the `inView` or from the inside of the callback method - `on:inview_change`. + +```html + + + +
    { + const { inView, entry, scrollDirection, observer, node} = event.detail; + isInView = inView; + }} + on:inview_enter={(event) => { + const { inView, entry, scrollDirection, observer, node} = event.detail; + isInView = inView; + }} + on:inview_leave={(event) => { + const { inView, entry, scrollDirection, observer, node} = event.detail; + isInView = inView; + }} + on:inview_init={(event) => { + const { observer, node } = event.detail; + }}>{isInView ? 'Hey I am in the viewport' : 'Bye, Bye'}
    +``` + +### Lazy Loading Images + +Svelte Inview lets you easily lazy load images. For a better UX we can pass a `rootMargin="50px"` props, so the image will be loaded when scroll is 50px before the viewport. After it appears in the viewport, you don't want to observe it anymore, hence the `unobserveOnEnter` props set to true. + +```html + + +
    + {#if isInView} + + {:else} +
    + {/if} +
    +``` + +### Video Control + +You can play/pause a video when it's in/out of the viewport. Simply pass correct methods in `on:inview_enter` and `on:inview_leave` callbacks. + +```html + + +
    videoRef.play()} + on:inview_leave={() => videoRef.pause()} + > + +
    +``` + +### Animations + +You can also add some cool animations when an element enters the viewport. To make sure the animation won't fire too soon you can pass a negative value to `rootMargin`. When `inView` is true, add an animation class to your target. Additionally, you can detect the scroll direction to make the animations even cooler! + +```html + + + +
    +
    + Animate me! +
    +
    +``` + +### Important information about breaking changes in previous versions + +#### Version 4 introduces new names for events. Before they were `'change' | 'leave' | 'enter' | 'init'`. In version 4 they're changed to `'inview_change' | 'inview_leave' | 'inview_enter' | 'inview_init'`. + +This change was needed to satisfy Typescript, as the package was messing up the default types coming from svelte typings. +To ensure backward compatibility, the original events names will still work for some time, but they won't be properly recognized by Typescript. +To sum up, this will still work, but TS won't be happy about it: + +```js +on:change={(event) => { + const { inView, entry, scrollDirection, observer, node} = event.detail; + isInView = inView; +}} +``` + +To make sure it works properly **and** satisfy TS you'll need to change it to this: + +```js +on:inview_change={(event) => { + const { inView, entry, scrollDirection, observer, node} = event.detail; + isInView = inView; +}} +``` + +#### Version 2 was returning `observe` and `unobserve` methods on the events. In version 3 they were removed, and the `observer` and `node` are being returned instead. So if you used those methods before like this: + +```js +event.detail.observe(node); +``` + +You'll need to change it to: + +```js +event.detail.observer.observe(node); +``` + +#### Version 1 was using an `Inview` component. In version 2 that was changed to `action` - API is easier to consume, plus the obsolete wrapper is not longer needed. If you still want to use the component, [check the documentation for version 1](https://github.com/maciekgrzybek/svelte-inview/tree/v-1.0.0). + +## API + +### Props + +| Name | Type | Default | Description | Required | +| ------------------------ | ---------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | +| options.root | `HTMLElement` | `window` | The element that is used as the viewport for checking visibility of the target. Must be the ancestor of the target. | `false` | +| options.rootMargin | `string` | `0px` | Margin around the root element. Values similar to the CSS margin property, e.g. "10px 20px 30px 40px". Can also be a percentage. [See more](#usage-with-rootmargin). | `false` | +| options.threshold | `number` or `number[]` | `0` | Either a single number or an array of numbers which indicate at what percentage of the target's visibility the observer's callback should be executed. If you only want to detect when visibility passes the 50% mark, you can use a value of 0.5. If you want the callback to run every time visibility passes another 25%, you would specify the array [0, 0.25, 0.5, 0.75, 1]. The default is 0 (meaning as soon as even one pixel is visible, the callback will be run) | `false` | +| options.unobserveOnEnter | `boolean` | `false` | If true, target element stops being observed after the first time it appears in the viewport. Can be used when you want to fire the callback only once. | `false` | +| on:inview_change | `function` | - | Event fired every time the target element meets the specified threshold. Receives `event` object as an argument. Inside of `event.detail` you can find all the arguments specified [here](#observer-events-arguments). | `false` | +| on:inview_enter | `function` | - | Event fired every time the target element enters the viewport. Receives `event` object as an argument. Inside of `event.detail` you can find all the arguments specified [here](#observer-events-arguments) . | `false` | +| on:inview_leave | `function` | - | Event fired every time the target element leaves the viewport. Receives `event` object as an argument. Inside of `event.detail` you can find all the arguments specified [here](#observer-events-arguments) . | `false` | +| on:inview_init | `function` | - | Event fired on action initialization, before the observer starts observing the element. Receives lifecycle arguments specified [here](#lifecycle-events-arguments) | `false` | + +### Observer events arguments + +| Name | Type | Description | +| -------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| inView | `boolean` | Visibility state of the target element. If it's `true`, target passed at least the value of the `threshold` props. | +| entry | `IntersectionObserverEntry` | [Intersection Observer entry object](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry) generated every time when IO callback is fired. | +| scrollDirection.vertical | `up` or `down` | Vertical scrolling direction. | +| scrollDirection.horizontal | `left` or `right` | Horizontal scrolling direction. | +| node | `HTMLElement` | Element that is being observed | +| observer | `IntersectionObserver` | [Intersection Observer instance](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver) for the observed element. Among others, it allows to "turn off" the observer at the very beginning. | + +### Lifecycle events arguments + +| Name | Type | Description | +| -------- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| node | `HTMLElement` | Element that is being observed | +| observer | `IntersectionObserver` | [Intersection Observer instance](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver) for the observed element. Among others, it allows to "turn off" the observer at the very beginning. | + +## Additional Info + +### Usage with rootMargin + +If you want to increase or decrease the area of the root, just pass the `rootMargin`. On the image below you can see the blue area being the `root`. It means that every time, the target element will enter or leave that area (or meet the specified threshold), a callback will be fired. + +![Usage of rootMargin](https://raw.githubusercontent.com/maciekgrzybek/svelte-inview/master/demo/static/rootMargin.jpg) + +## License + +Distributed under the MIT License. See [LICENSE](./license.md) for more information. + +## Contact + +Maciek Grzybek - [@grzybek_maciek](https://twitter.com/grzybek_maciek) - maciekgrzybek1@gmail.com - [www.maciekgrzybek.dev](https://www.maciekgrzybek.dev) diff --git a/node_modules/svelte-inview/dist/additional-svelte-jsx.d.ts b/node_modules/svelte-inview/dist/additional-svelte-jsx.d.ts new file mode 100644 index 00000000..08203734 --- /dev/null +++ b/node_modules/svelte-inview/dist/additional-svelte-jsx.d.ts @@ -0,0 +1,39 @@ +// Due to an ambivalent nature of .d.ts files, we can't import or export +// anything in this file. That is the cause we need to manually put ScrollDirection, ObserverEventDetails +// and LifecycleEventDetails types to ensure correct typings in the app. + +type Direction = 'up' | 'down' | 'left' | 'right'; + +type ScrollDirection = { + vertical?: Direction; + horizontal?: Direction; +}; + +type ObserverEventDetails = { + inView: boolean; + entry: IntersectionObserverEntry; + scrollDirection: ScrollDirection; + node: HTMLElement; + observer: IntersectionObserver; +}; + +type LifecycleEventDetails = { + node: HTMLElement; + observer: IntersectionObserver; +}; + +declare namespace svelteHTML { + interface HTMLAttributes { + // Backwards compatibility + 'on:inview_change'?: (e: CustomEvent) => void; + 'on:inview_enter'?: (e: CustomEvent) => void; + 'on:inview_leave'?: (e: CustomEvent) => void; + 'on:inview_init'?: (e: CustomEvent) => void; + + // Svelte5 Syntax + oninview_change?: (e: CustomEvent) => void; + oninview_enter?: (e: CustomEvent) => void; + oninview_leave?: (e: CustomEvent) => void; + oninview_init?: (e: CustomEvent) => void; + } +} diff --git a/node_modules/svelte-inview/dist/index.d.ts b/node_modules/svelte-inview/dist/index.d.ts new file mode 100644 index 00000000..f4cbc791 --- /dev/null +++ b/node_modules/svelte-inview/dist/index.d.ts @@ -0,0 +1,3 @@ +import './additional-svelte-jsx'; +export { inview } from './inview'; +export * from './types'; diff --git a/node_modules/svelte-inview/dist/index.js b/node_modules/svelte-inview/dist/index.js new file mode 100644 index 00000000..33cf71f6 --- /dev/null +++ b/node_modules/svelte-inview/dist/index.js @@ -0,0 +1,178 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Inview = {})); +})(this, (function (exports) { 'use strict'; + + function run(fn) { + return fn(); + } + function run_all(fns) { + fns.forEach(run); + } + + const dirty_components = []; + const binding_callbacks = []; + const render_callbacks = []; + const flush_callbacks = []; + const resolved_promise = Promise.resolve(); + let update_scheduled = false; + function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } + } + function tick() { + schedule_update(); + return resolved_promise; + } + function add_render_callback(fn) { + render_callbacks.push(fn); + } + // flush() calls callbacks in this order: + // 1. All beforeUpdate callbacks, in order: parents before children + // 2. All bind:this callbacks, in reverse order: children before parents. + // 3. All afterUpdate callbacks, in order: parents before children. EXCEPT + // for afterUpdates called during the initial onMount, which are called in + // reverse order: children before parents. + // Since callbacks might update component values, which could trigger another + // call to flush(), the following steps guard against this: + // 1. During beforeUpdate, any updated components will be added to the + // dirty_components array and will cause a reentrant call to flush(). Because + // the flush index is kept outside the function, the reentrant call will pick + // up where the earlier call left off and go through all dirty components. The + // current_component value is saved and restored so that the reentrant call will + // not interfere with the "parent" flush() call. + // 2. bind:this callbacks cannot trigger new flush() calls. + // 3. During afterUpdate, any updated components will NOT have their afterUpdate + // callback called a second time; the seen_callbacks set, outside the flush() + // function, guarantees this behavior. + const seen_callbacks = new Set(); + let flushidx = 0; // Do *not* move this inside the flush() function + function flush() { + do { + // first, call beforeUpdate functions + // and update components + while (flushidx < dirty_components.length) { + const component = dirty_components[flushidx]; + flushidx++; + update(component.$$); + } + dirty_components.length = 0; + flushidx = 0; + while (binding_callbacks.length) + binding_callbacks.pop()(); + // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + for (let i = 0; i < render_callbacks.length; i += 1) { + const callback = render_callbacks[i]; + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + render_callbacks.length = 0; + } while (dirty_components.length); + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + update_scheduled = false; + seen_callbacks.clear(); + } + function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + const dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } + } + + const defaultOptions = { + root: null, + rootMargin: '0px', + threshold: 0, + unobserveOnEnter: false, + }; + const createEvent = (name, detail) => new CustomEvent(name, { detail }); + function inview(node, options = {}) { + const { root, rootMargin, threshold, unobserveOnEnter } = Object.assign(Object.assign({}, defaultOptions), options); + let prevPos = { + x: undefined, + y: undefined, + }; + let scrollDirection = { + vertical: undefined, + horizontal: undefined, + }; + if (typeof IntersectionObserver !== 'undefined' && node) { + const observer = new IntersectionObserver((entries, _observer) => { + entries.forEach((singleEntry) => { + if (prevPos.y > singleEntry.boundingClientRect.y) { + scrollDirection.vertical = 'up'; + } + else { + scrollDirection.vertical = 'down'; + } + if (prevPos.x > singleEntry.boundingClientRect.x) { + scrollDirection.horizontal = 'left'; + } + else { + scrollDirection.horizontal = 'right'; + } + prevPos = { + y: singleEntry.boundingClientRect.y, + x: singleEntry.boundingClientRect.x, + }; + const detail = { + inView: singleEntry.isIntersecting, + entry: singleEntry, + scrollDirection, + node, + observer: _observer, + }; + node.dispatchEvent(createEvent('inview_change', detail)); + //@ts-expect-error only for backward compatibility + node.dispatchEvent(createEvent('change', detail)); + if (singleEntry.isIntersecting) { + node.dispatchEvent(createEvent('inview_enter', detail)); + //@ts-expect-error only for backward compatibility + node.dispatchEvent(createEvent('enter', detail)); + unobserveOnEnter && _observer.unobserve(node); + } + else { + node.dispatchEvent(createEvent('inview_leave', detail)); + //@ts-expect-error only for backward compatibility + node.dispatchEvent(createEvent('leave', detail)); + } + }); + }, { + root, + rootMargin, + threshold, + }); + tick().then(() => { + node.dispatchEvent(createEvent('inview_init', { observer, node })); + node.dispatchEvent( + //@ts-expect-error only for backward compatibility + createEvent('init', { observer, node })); + }); + observer.observe(node); + return { + destroy() { + observer.unobserve(node); + }, + }; + } + } + + exports.inview = inview; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); diff --git a/node_modules/svelte-inview/dist/index.mjs b/node_modules/svelte-inview/dist/index.mjs new file mode 100644 index 00000000..e2bc7401 --- /dev/null +++ b/node_modules/svelte-inview/dist/index.mjs @@ -0,0 +1,168 @@ +function run(fn) { + return fn(); +} +function run_all(fns) { + fns.forEach(run); +} + +const dirty_components = []; +const binding_callbacks = []; +const render_callbacks = []; +const flush_callbacks = []; +const resolved_promise = Promise.resolve(); +let update_scheduled = false; +function schedule_update() { + if (!update_scheduled) { + update_scheduled = true; + resolved_promise.then(flush); + } +} +function tick() { + schedule_update(); + return resolved_promise; +} +function add_render_callback(fn) { + render_callbacks.push(fn); +} +// flush() calls callbacks in this order: +// 1. All beforeUpdate callbacks, in order: parents before children +// 2. All bind:this callbacks, in reverse order: children before parents. +// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT +// for afterUpdates called during the initial onMount, which are called in +// reverse order: children before parents. +// Since callbacks might update component values, which could trigger another +// call to flush(), the following steps guard against this: +// 1. During beforeUpdate, any updated components will be added to the +// dirty_components array and will cause a reentrant call to flush(). Because +// the flush index is kept outside the function, the reentrant call will pick +// up where the earlier call left off and go through all dirty components. The +// current_component value is saved and restored so that the reentrant call will +// not interfere with the "parent" flush() call. +// 2. bind:this callbacks cannot trigger new flush() calls. +// 3. During afterUpdate, any updated components will NOT have their afterUpdate +// callback called a second time; the seen_callbacks set, outside the flush() +// function, guarantees this behavior. +const seen_callbacks = new Set(); +let flushidx = 0; // Do *not* move this inside the flush() function +function flush() { + do { + // first, call beforeUpdate functions + // and update components + while (flushidx < dirty_components.length) { + const component = dirty_components[flushidx]; + flushidx++; + update(component.$$); + } + dirty_components.length = 0; + flushidx = 0; + while (binding_callbacks.length) + binding_callbacks.pop()(); + // then, once components are updated, call + // afterUpdate functions. This may cause + // subsequent updates... + for (let i = 0; i < render_callbacks.length; i += 1) { + const callback = render_callbacks[i]; + if (!seen_callbacks.has(callback)) { + // ...so guard against infinite loops + seen_callbacks.add(callback); + callback(); + } + } + render_callbacks.length = 0; + } while (dirty_components.length); + while (flush_callbacks.length) { + flush_callbacks.pop()(); + } + update_scheduled = false; + seen_callbacks.clear(); +} +function update($$) { + if ($$.fragment !== null) { + $$.update(); + run_all($$.before_update); + const dirty = $$.dirty; + $$.dirty = [-1]; + $$.fragment && $$.fragment.p($$.ctx, dirty); + $$.after_update.forEach(add_render_callback); + } +} + +const defaultOptions = { + root: null, + rootMargin: '0px', + threshold: 0, + unobserveOnEnter: false, +}; +const createEvent = (name, detail) => new CustomEvent(name, { detail }); +function inview(node, options = {}) { + const { root, rootMargin, threshold, unobserveOnEnter } = Object.assign(Object.assign({}, defaultOptions), options); + let prevPos = { + x: undefined, + y: undefined, + }; + let scrollDirection = { + vertical: undefined, + horizontal: undefined, + }; + if (typeof IntersectionObserver !== 'undefined' && node) { + const observer = new IntersectionObserver((entries, _observer) => { + entries.forEach((singleEntry) => { + if (prevPos.y > singleEntry.boundingClientRect.y) { + scrollDirection.vertical = 'up'; + } + else { + scrollDirection.vertical = 'down'; + } + if (prevPos.x > singleEntry.boundingClientRect.x) { + scrollDirection.horizontal = 'left'; + } + else { + scrollDirection.horizontal = 'right'; + } + prevPos = { + y: singleEntry.boundingClientRect.y, + x: singleEntry.boundingClientRect.x, + }; + const detail = { + inView: singleEntry.isIntersecting, + entry: singleEntry, + scrollDirection, + node, + observer: _observer, + }; + node.dispatchEvent(createEvent('inview_change', detail)); + //@ts-expect-error only for backward compatibility + node.dispatchEvent(createEvent('change', detail)); + if (singleEntry.isIntersecting) { + node.dispatchEvent(createEvent('inview_enter', detail)); + //@ts-expect-error only for backward compatibility + node.dispatchEvent(createEvent('enter', detail)); + unobserveOnEnter && _observer.unobserve(node); + } + else { + node.dispatchEvent(createEvent('inview_leave', detail)); + //@ts-expect-error only for backward compatibility + node.dispatchEvent(createEvent('leave', detail)); + } + }); + }, { + root, + rootMargin, + threshold, + }); + tick().then(() => { + node.dispatchEvent(createEvent('inview_init', { observer, node })); + node.dispatchEvent( + //@ts-expect-error only for backward compatibility + createEvent('init', { observer, node })); + }); + observer.observe(node); + return { + destroy() { + observer.unobserve(node); + }, + }; + } +} + +export { inview }; diff --git a/node_modules/svelte-inview/dist/inview.d.ts b/node_modules/svelte-inview/dist/inview.d.ts new file mode 100644 index 00000000..991d2d84 --- /dev/null +++ b/node_modules/svelte-inview/dist/inview.d.ts @@ -0,0 +1,3 @@ +import type { ActionReturn } from 'svelte/action'; +import type { Options, Attributes } from './types'; +export declare function inview(node: HTMLElement, options?: Options): ActionReturn; diff --git a/node_modules/svelte-inview/dist/tests/inview.spec.d.ts b/node_modules/svelte-inview/dist/tests/inview.spec.d.ts new file mode 100644 index 00000000..509db186 --- /dev/null +++ b/node_modules/svelte-inview/dist/tests/inview.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/svelte-inview/dist/types.d.ts b/node_modules/svelte-inview/dist/types.d.ts new file mode 100644 index 00000000..7aa60156 --- /dev/null +++ b/node_modules/svelte-inview/dist/types.d.ts @@ -0,0 +1,40 @@ +export type Prefix = 'inview'; +export type EventBase = 'change' | 'leave' | 'enter' | 'init'; +export type Event = `${Prefix}_${EventBase}`; +export type Options = { + root?: HTMLElement | null; + rootMargin?: string; + threshold?: number | number[]; + unobserveOnEnter?: boolean; +}; +export type Position = { + x?: number; + y?: number; +}; +type Direction = 'up' | 'down' | 'left' | 'right'; +export type ScrollDirection = { + vertical?: Direction; + horizontal?: Direction; +}; +export type ObserverEventDetails = { + inView: boolean; + entry: IntersectionObserverEntry; + scrollDirection: ScrollDirection; + node: HTMLElement; + observer: IntersectionObserver; +}; +export type LifecycleEventDetails = { + node: HTMLElement; + observer: IntersectionObserver; +}; +export interface Attributes { + 'on:inview_change'?: (e: CustomEvent) => void; + 'on:inview_enter'?: (e: CustomEvent) => void; + 'on:inview_leave'?: (e: CustomEvent) => void; + 'on:inview_init'?: (e: CustomEvent) => void; + oninview_change?: (e: CustomEvent) => void; + oninview_enter?: (e: CustomEvent) => void; + oninview_leave?: (e: CustomEvent) => void; + oninview_init?: (e: CustomEvent) => void; +} +export {}; diff --git a/node_modules/svelte-inview/license.md b/node_modules/svelte-inview/license.md new file mode 100644 index 00000000..6f671bfd --- /dev/null +++ b/node_modules/svelte-inview/license.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Maciej Grzybek + +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/svelte-inview/package.json b/node_modules/svelte-inview/package.json new file mode 100644 index 00000000..c733036d --- /dev/null +++ b/node_modules/svelte-inview/package.json @@ -0,0 +1,100 @@ +{ + "name": "svelte-inview", + "version": "4.0.4", + "description": "A Svelte action that monitors an element enters or leaves the viewport or a parent element. Performant and efficient thanks to using Intersection Observer under the hood.", + "homepage": "https://github.com/maciekgrzybek/svelte-inview", + "bugs": "https://github.com/maciekgrzybek/svelte-inview/issues", + "license": "MIT", + "author": { + "email": "maciekgrzybek1@gmail.com", + "name": "Maciek Grzybek", + "url": "https://maciekgrzybek.dev" + }, + "module": "dist/index.mjs", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "rollup -c", + "format": "prettier --write --plugin-search-dir=. **/*.svelte *.ts", + "prepublishOnly": "npm run build", + "build-test-app": "cd test-app && npm i && npm run build", + "start-server": "cd test-app && PORT=5555 npm run dev", + "test": "npx playwright test", + "test-app": " npm run build && start-server-and-test start-server http://localhost:5555 test" + }, + "devDependencies": { + "@playwright/test": "^1.29.1", + "@rollup/plugin-node-resolve": "^11.2.1", + "@rollup/plugin-typescript": "^8.2.1", + "@tsconfig/svelte": "^1.0.10", + "@types/node": "^18.11.18", + "babel-eslint": "^10.1.0", + "eslint": "^7.23.0", + "eslint-config-prettier": "^8.1.0", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-svelte3": "^3.1.2", + "husky": "^4.2.5", + "prettier": "^2.0.5", + "prettier-plugin-svelte": "^2.2.0", + "rollup": "^2.44.0", + "rollup-plugin-copy": "^3.4.0", + "rollup-plugin-svelte": "^7.1.0", + "rollup-plugin-typescript2": "^0.34.1", + "start-server-and-test": "^1.15.2", + "svelte-check": "3.0.1", + "svelte-preprocess": "^4.7.2", + "typescript": "^4.2.4" + }, + "keywords": [ + "svelte", + "observer", + "observing", + "intersection", + "viewport", + "inviewport", + "in-view", + "in-viewport", + "inview", + "observe", + "waypoint", + "intersection-observer", + "intersection-observer-api", + "performance", + "monitor", + "scroll-direction", + "scroll", + "direction", + "lazy", + "lazy-loading", + "scrolling", + "animations", + "compile", + "compiler", + "root", + "root-margin", + "threshold", + "visibility", + "visible", + "infinite-scrolling", + "infinite", + "scrolling", + "intersecting", + "async", + "asynchronously", + "asynchronous", + "preload", + "detect" + ], + "files": [ + "src", + "dist" + ], + "husky": { + "hooks": { + "pre-commit": "npm run format" + } + }, + "peerDependencies": { + "svelte": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^5.0.0-next" + } +} diff --git a/node_modules/svelte-inview/src/additional-svelte-jsx.d.ts b/node_modules/svelte-inview/src/additional-svelte-jsx.d.ts new file mode 100644 index 00000000..08203734 --- /dev/null +++ b/node_modules/svelte-inview/src/additional-svelte-jsx.d.ts @@ -0,0 +1,39 @@ +// Due to an ambivalent nature of .d.ts files, we can't import or export +// anything in this file. That is the cause we need to manually put ScrollDirection, ObserverEventDetails +// and LifecycleEventDetails types to ensure correct typings in the app. + +type Direction = 'up' | 'down' | 'left' | 'right'; + +type ScrollDirection = { + vertical?: Direction; + horizontal?: Direction; +}; + +type ObserverEventDetails = { + inView: boolean; + entry: IntersectionObserverEntry; + scrollDirection: ScrollDirection; + node: HTMLElement; + observer: IntersectionObserver; +}; + +type LifecycleEventDetails = { + node: HTMLElement; + observer: IntersectionObserver; +}; + +declare namespace svelteHTML { + interface HTMLAttributes { + // Backwards compatibility + 'on:inview_change'?: (e: CustomEvent) => void; + 'on:inview_enter'?: (e: CustomEvent) => void; + 'on:inview_leave'?: (e: CustomEvent) => void; + 'on:inview_init'?: (e: CustomEvent) => void; + + // Svelte5 Syntax + oninview_change?: (e: CustomEvent) => void; + oninview_enter?: (e: CustomEvent) => void; + oninview_leave?: (e: CustomEvent) => void; + oninview_init?: (e: CustomEvent) => void; + } +} diff --git a/node_modules/svelte-inview/src/index.d.ts b/node_modules/svelte-inview/src/index.d.ts new file mode 100644 index 00000000..f4cbc791 --- /dev/null +++ b/node_modules/svelte-inview/src/index.d.ts @@ -0,0 +1,3 @@ +import './additional-svelte-jsx'; +export { inview } from './inview'; +export * from './types'; diff --git a/node_modules/svelte-inview/src/index.ts b/node_modules/svelte-inview/src/index.ts new file mode 100644 index 00000000..e2b5bdfc --- /dev/null +++ b/node_modules/svelte-inview/src/index.ts @@ -0,0 +1 @@ +export { inview } from './inview'; diff --git a/node_modules/svelte-inview/src/inview.ts b/node_modules/svelte-inview/src/inview.ts new file mode 100644 index 00000000..c05c6553 --- /dev/null +++ b/node_modules/svelte-inview/src/inview.ts @@ -0,0 +1,115 @@ +import { tick } from 'svelte'; +import type { ActionReturn } from 'svelte/action'; +import type { + ObserverEventDetails, + Options, + Position, + ScrollDirection, + Event, + LifecycleEventDetails, + Attributes, +} from './types'; + +const defaultOptions: Options = { + root: null, + rootMargin: '0px', + threshold: 0, + unobserveOnEnter: false, +}; + +const createEvent = ( + name: Event, + detail: T +): CustomEvent => new CustomEvent(name, { detail }); + +export function inview( + node: HTMLElement, + options: Options = {} +): ActionReturn { + const { root, rootMargin, threshold, unobserveOnEnter }: Options = { + ...defaultOptions, + ...options, + }; + + let prevPos: Position = { + x: undefined, + y: undefined, + }; + + let scrollDirection: ScrollDirection = { + vertical: undefined, + horizontal: undefined, + }; + + if (typeof IntersectionObserver !== 'undefined' && node) { + const observer = new IntersectionObserver( + (entries, _observer) => { + entries.forEach((singleEntry) => { + if (prevPos.y > singleEntry.boundingClientRect.y) { + scrollDirection.vertical = 'up'; + } else { + scrollDirection.vertical = 'down'; + } + + if (prevPos.x > singleEntry.boundingClientRect.x) { + scrollDirection.horizontal = 'left'; + } else { + scrollDirection.horizontal = 'right'; + } + + prevPos = { + y: singleEntry.boundingClientRect.y, + x: singleEntry.boundingClientRect.x, + }; + + const detail: ObserverEventDetails = { + inView: singleEntry.isIntersecting, + entry: singleEntry, + scrollDirection, + node, + observer: _observer, + }; + + node.dispatchEvent(createEvent('inview_change', detail)); + //@ts-expect-error only for backward compatibility + node.dispatchEvent(createEvent('change', detail)); + + if (singleEntry.isIntersecting) { + node.dispatchEvent(createEvent('inview_enter', detail)); + //@ts-expect-error only for backward compatibility + node.dispatchEvent(createEvent('enter', detail)); + + unobserveOnEnter && _observer.unobserve(node); + } else { + node.dispatchEvent(createEvent('inview_leave', detail)); + //@ts-expect-error only for backward compatibility + node.dispatchEvent(createEvent('leave', detail)); + } + }); + }, + { + root, + rootMargin, + threshold, + } + ); + + tick().then(() => { + node.dispatchEvent( + createEvent('inview_init', { observer, node }) + ); + node.dispatchEvent( + //@ts-expect-error only for backward compatibility + createEvent('init', { observer, node }) + ); + }); + + observer.observe(node); + + return { + destroy() { + observer.unobserve(node); + }, + }; + } +} diff --git a/node_modules/svelte-inview/src/tests/inview.spec.ts b/node_modules/svelte-inview/src/tests/inview.spec.ts new file mode 100644 index 00000000..1346e29d --- /dev/null +++ b/node_modules/svelte-inview/src/tests/inview.spec.ts @@ -0,0 +1,112 @@ +import { test, expect } from '@playwright/test'; +import { describe } from 'node:test'; + +describe('default settings', () => { + test('correctly changes the element when it enters the viewport', async ({ + page, + }) => { + await page.goto('/default-settings'); + const targetBlock = page.locator('.target-block'); + + await expect(targetBlock).toBeDefined(); + await expect(targetBlock).toHaveText(/no/i); + + await page.evaluate(() => window.scroll(0, 150)); + + await expect(targetBlock).toHaveText(/yes/i); + }); + + test('correctly changes back the element when it leaves the viewport', async ({ + page, + }) => { + await page.goto('/default-settings'); + const targetBlock = page.locator('.target-block'); + + await expect(targetBlock).toBeDefined(); + await expect(targetBlock).toHaveText(/no/i); + + await page.evaluate(() => window.scroll(0, 150)); + + await expect(targetBlock).toHaveText(/yes/i); + + await page.evaluate(() => window.scroll(0, 1500)); + + await expect(targetBlock).toHaveText(/no/i); + }); +}); + +describe('custom settings', () => { + test('correctly changes the element with custom rootMargin setting', async ({ + page, + }) => { + await page.goto('/root-margin'); + const targetBlock = page.locator('.target-block'); + + await expect(targetBlock).toBeDefined(); + await expect(targetBlock).toHaveText(/no/i); + + await page.evaluate(() => window.scroll(0, 150)); + + await expect(targetBlock).toHaveText(/no/i); + + await page.evaluate(() => window.scroll(0, 250)); + + await expect(targetBlock).toHaveText(/yes/i); + }); + + test('correctly changes the element with custom threshold setting', async ({ + page, + }) => { + await page.goto('/threshold'); + const targetBlock = page.locator('.target-block'); + + await expect(targetBlock).toBeDefined(); + await expect(targetBlock).toHaveText(/no/i); + + await page.evaluate(() => window.scroll(0, 150)); + + await expect(targetBlock).toHaveText(/no/i); + + await page.evaluate(() => window.scroll(0, 250)); + + await expect(targetBlock).toHaveText(/yes/i); + }); + + test('does not change the element back when it leaves the viewport with custom unobserveOnEnter setting', async ({ + page, + }) => { + await page.goto('/unobserve-on-enter'); + + const targetBlock = page.locator('.target-block'); + + await expect(targetBlock).toBeDefined(); + await expect(targetBlock).toHaveText(/no/i); + + await page.evaluate(() => window.scroll(0, 250)); + + await expect(targetBlock).toHaveText(/yes/i); + + await page.evaluate(() => window.scroll(0, 1500)); + + await expect(targetBlock).toHaveText(/yes/i); + }); +}); + +describe('direction', () => { + test('shows the correct direction', async ({ page }) => { + await page.goto('/direction'); + const targetBlock = page.locator('.target-block'); + + await expect(targetBlock).toBeDefined(); + await expect(targetBlock).toHaveText(/down/i); + + await page.evaluate(() => window.scroll(0, 250)); + + await expect(targetBlock).toHaveText(/up/i); + + await page.evaluate(() => window.scroll(0, 1500)); + await page.evaluate(() => window.scroll(0, -1)); + + await expect(targetBlock).toHaveText(/no/i); + }); +}); diff --git a/node_modules/svelte-inview/src/types.ts b/node_modules/svelte-inview/src/types.ts new file mode 100644 index 00000000..e9200776 --- /dev/null +++ b/node_modules/svelte-inview/src/types.ts @@ -0,0 +1,50 @@ +export type Prefix = 'inview'; +export type EventBase = 'change' | 'leave' | 'enter' | 'init'; +export type Event = `${Prefix}_${EventBase}`; + +export type Options = { + root?: HTMLElement | null; + rootMargin?: string; + threshold?: number | number[]; + unobserveOnEnter?: boolean; +}; + +export type Position = { + x?: number; + y?: number; +}; + +// Types below needs to be manually copied to additional-svelte.jsx.d.ts file - more details there +type Direction = 'up' | 'down' | 'left' | 'right'; + +export type ScrollDirection = { + vertical?: Direction; + horizontal?: Direction; +}; + +export type ObserverEventDetails = { + inView: boolean; + entry: IntersectionObserverEntry; + scrollDirection: ScrollDirection; + node: HTMLElement; + observer: IntersectionObserver; +}; + +export type LifecycleEventDetails = { + node: HTMLElement; + observer: IntersectionObserver; +}; + +export interface Attributes { + // Backwards compatibility + 'on:inview_change'?: (e: CustomEvent) => void; + 'on:inview_enter'?: (e: CustomEvent) => void; + 'on:inview_leave'?: (e: CustomEvent) => void; + 'on:inview_init'?: (e: CustomEvent) => void; + + // Svelte5 Syntax + oninview_change?: (e: CustomEvent) => void; + oninview_enter?: (e: CustomEvent) => void; + oninview_leave?: (e: CustomEvent) => void; + oninview_init?: (e: CustomEvent) => void; +} diff --git a/node_modules/svelte-motion/.vscode/settings.json b/node_modules/svelte-motion/.vscode/settings.json new file mode 100644 index 00000000..7a73a41b --- /dev/null +++ b/node_modules/svelte-motion/.vscode/settings.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/node_modules/svelte-motion/LICENSE.md b/node_modules/svelte-motion/LICENSE.md new file mode 100644 index 00000000..43488172 --- /dev/null +++ b/node_modules/svelte-motion/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Michael Lucht + +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/svelte-motion/README.md b/node_modules/svelte-motion/README.md new file mode 100644 index 00000000..51e21d04 --- /dev/null +++ b/node_modules/svelte-motion/README.md @@ -0,0 +1,27 @@ +# Svelte Motion + +An animation library based on [framer-motion](https://www.framer.com/motion/). + +[Visit Project Page](https://svelte-motion.gradientdescent.de) + +## Installation + +```bash +npm install --save-dev svelte-motion +``` + +## Usage + +Corresponding to a `MotionDiv` in framer-motion is this: + +```javascript +import { Motion } from 'svelte-motion' + +
    +``` +For svg elements like 'g', 'path' or 'circle', use: + +```javascript + +``` + diff --git a/node_modules/svelte-motion/package.json b/node_modules/svelte-motion/package.json new file mode 100644 index 00000000..1d79dc5a --- /dev/null +++ b/node_modules/svelte-motion/package.json @@ -0,0 +1,54 @@ +{ + "name": "svelte-motion", + "version": "0.12.2", + "description": "Svelte animation library based on the React library framer-motion.", + "main": "src/index.js", + "scripts": { + "test": "vitest --typecheck.only", + "build": "rollup -c", + "build:svelte": "svelte-package --input ./src && publint --strict" + }, + "author": "Michael Lucht (https://svelte-motion.gradientdescent.de)", + "license": "MIT", + "dependencies": { + "@types/react": "^18.2.42", + "framesync": "^6.1.2", + "popmotion": "^11.0.5", + "style-value-types": "5.1.2", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@emotion/is-prop-valid": "^1.2.1", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-replace": "^5.0.5", + "@sveltejs/vite-plugin-svelte": "^3.0.1", + "@tsconfig/svelte": "^5.0.2", + "rollup": "^4.9.2", + "rollup-plugin-css-porter": "^1.0.2", + "rollup-plugin-svelte": "^7.1.6", + "svelte": "^5.0.0-next.37", + "svelte-preprocess": "^5.1.1", + "tsc": "2.0.4", + "typescript": "5.3.3", + "vite": "^5.0.12", + "vitest": "1.1.1", + "publint": "^0.2.7" + }, + "peerDependencies": { + "svelte": ">=3.35.0 || ^4.0.0 || ^5.0.0 || ^5.0.0-next.0" + }, + "type": "module", + "types": "types/index.d.ts", + "repository": "https://github.com/micha-lmxt/svelte-motion/", + "sideEffects": false, + "keywords": [ + "svelte animation", + "svelte", + "animation", + "gestures", + "drag", + "spring", + "popmotion", + "framer-motion" + ] +} diff --git a/node_modules/svelte-motion/rollup.config.js b/node_modules/svelte-motion/rollup.config.js new file mode 100644 index 00000000..e50f31b7 --- /dev/null +++ b/node_modules/svelte-motion/rollup.config.js @@ -0,0 +1,34 @@ +import svelte from 'rollup-plugin-svelte' +import resolve from '@rollup/plugin-node-resolve' +import autoPreprocess from 'svelte-preprocess'; +import replace from "@rollup/plugin-replace"; +import pkg from './package.json' assert { type: 'json'} + +const name = pkg.name + .replace(/^(@\S+\/)?(svelte-)?(\S+)/, '$3') + .replace(/^\w/, m => m.toUpperCase()) + .replace(/-\w/g, m => m[1].toUpperCase()) + +const external = [ + ...Object.keys(pkg.dependencies || {}), + ...Object.keys(pkg.peerDependencies || {}), +] + +export default [{ + input: 'src/index.js', + output: [ + { file: pkg.module, format: 'es',exports: "named" }, + { file: pkg.main, format: 'umd', name }, + ], + plugins: [ + svelte({ + preprocess: autoPreprocess(), + }), + resolve(), + replace({ + "process.env.NODE_ENV": JSON.stringify("development"), + }) + ], + external +} +] \ No newline at end of file diff --git a/node_modules/svelte-motion/src/animation/UseAnimatedState.svelte b/node_modules/svelte-motion/src/animation/UseAnimatedState.svelte new file mode 100644 index 00000000..e3e841d2 --- /dev/null +++ b/node_modules/svelte-motion/src/animation/UseAnimatedState.svelte @@ -0,0 +1,69 @@ + + + + + + + diff --git a/node_modules/svelte-motion/src/animation/UseAnimation.svelte b/node_modules/svelte-motion/src/animation/UseAnimation.svelte new file mode 100644 index 00000000..1efa7aa0 --- /dev/null +++ b/node_modules/svelte-motion/src/animation/UseAnimation.svelte @@ -0,0 +1,65 @@ + + + diff --git a/node_modules/svelte-motion/src/animation/animate.js b/node_modules/svelte-motion/src/animation/animate.js new file mode 100644 index 00000000..914f466b --- /dev/null +++ b/node_modules/svelte-motion/src/animation/animate.js @@ -0,0 +1,46 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +import { motionValue } from '../value/index.js'; +import { isMotionValue } from '../value/utils/is-motion-value.js'; +import { startAnimation } from './utils/transitions.js'; + +/** + * Animate a single value or a `MotionValue`. + * + * The first argument is either a `MotionValue` to animate, or an initial animation value. + * + * The second is either a value to animate to, or an array of keyframes to animate through. + * + * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`. + * + * Returns `AnimationPlaybackControls`, currently just a `stop` method. + * + * ```javascript + * const x = useMotionValue(0) + * + * useEffect(() => { + * const controls = animate(x, 100, { + * type: "spring", + * stiffness: 2000, + * onComplete: v => {} + * }) + * + * return controls.stop + * }) + * ``` + * + * @public + */ +function animate(from, to, transition) { + if (transition === void 0) { transition = {}; } + var value = isMotionValue(from) ? from : motionValue(from); + startAnimation("", value, to, transition); + return { + stop: function () { return value.stop(); }, + }; +} + +export { animate }; diff --git a/node_modules/svelte-motion/src/animation/animation-controls.js b/node_modules/svelte-motion/src/animation/animation-controls.js new file mode 100644 index 00000000..03818a53 --- /dev/null +++ b/node_modules/svelte-motion/src/animation/animation-controls.js @@ -0,0 +1,93 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +import { __spreadArray, __read } from 'tslib'; +//import { invariant } from 'hey-listen'; +import { stopAnimation, animateVisualElement } from '../render/utils/animation.js'; +import { setValues } from '../render/utils/setters.js'; + +/** + * @public + */ +function animationControls(startStopNotifier) { + /** + * Track whether the host component has mounted. + */ + var hasMounted = false; + /** + * Pending animations that are started before a component is mounted. + * TODO: Remove this as animations should only run in effects + */ + var pendingAnimations = []; + /** + * A collection of linked component animation controls. + */ + var subscribers = new Set(); + var stopNotification; + var controls = { + subscribe: function (visualElement) { + if (subscribers.size === 0){ + stopNotification = startStopNotifier?.(); + } + subscribers.add(visualElement); + return function () { + subscribers.delete(visualElement); + if (subscribers.size===0){ + stopNotification?.() + } + }; + }, + start: function (definition, transitionOverride) { + /** + * TODO: We only perform this hasMounted check because in Framer we used to + * encourage the ability to start an animation within the render phase. This + * isn't behaviour concurrent-safe so when we make Framer concurrent-safe + * we can ditch this. + */ + if (hasMounted) { + var animations_1 = []; + subscribers.forEach(function (visualElement) { + animations_1.push(animateVisualElement(visualElement, definition, { + transitionOverride: transitionOverride, + })); + }); + return Promise.all(animations_1); + } + else { + return new Promise(function (resolve) { + pendingAnimations.push({ + animation: [definition, transitionOverride], + resolve: resolve, + }); + }); + } + }, + set: function (definition) { + //invariant(hasMounted, "controls.set() should only be called after a component has mounted. Consider calling within a useEffect hook."); + return subscribers.forEach(function (visualElement) { + setValues(visualElement, definition); + }); + }, + stop: function () { + subscribers.forEach(function (visualElement) { + stopAnimation(visualElement); + }); + }, + mount: function () { + hasMounted = true; + pendingAnimations.forEach(function (_a) { + var animation = _a.animation, resolve = _a.resolve; + controls.start.apply(controls, __spreadArray([], __read(animation))).then(resolve); + }); + return function () { + hasMounted = false; + controls.stop(); + }; + }, + }; + return controls; +} + +export { animationControls }; diff --git a/node_modules/svelte-motion/src/animation/use-animated-state.js b/node_modules/svelte-motion/src/animation/use-animated-state.js new file mode 100644 index 00000000..1a8241ff --- /dev/null +++ b/node_modules/svelte-motion/src/animation/use-animated-state.js @@ -0,0 +1 @@ +export {default as UseAnimatedState} from './UseAnimatedState.svelte'; \ No newline at end of file diff --git a/node_modules/svelte-motion/src/animation/use-animation.js b/node_modules/svelte-motion/src/animation/use-animation.js new file mode 100644 index 00000000..1332444b --- /dev/null +++ b/node_modules/svelte-motion/src/animation/use-animation.js @@ -0,0 +1,74 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +import { tick } from "svelte"; +import { animationControls } from "./animation-controls" + +/** + * Creates `AnimationControls`, which can be used to manually start, stop + * and sequence animations on one or more components. + * + * The returned `AnimationControls` should be passed to the `animate` property + * of the components you want to animate. + * + * These components can then be animated with the `start` method. + * + * @library + * + * ```jsx + * import * as React from 'react' + * import { Frame, useAnimation } from 'framer' + * + * export function MyComponent(props) { + * const controls = useAnimation() + * + * controls.start({ + * x: 100, + * transition: { duration: 0.5 }, + * }) + * + * return + * } + * ``` + * + * @motion + * + * ```jsx + * import * as React from 'react' + * import { motion, useAnimation } from 'framer-motion' + * + * export function MyComponent(props) { + * const controls = useAnimation() + * + * controls.start({ + * x: 100, + * transition: { duration: 0.5 }, + * }) + * + * return + * } + * ``` + * + * @returns Animation controller with `start` and `stop` methods + * + * @public + */ +export const useAnimation = () =>{ + + const controls = animationControls(()=>{ + + const cleanup = {} + tick().then(v => cleanup.clean = controls.mount()); + return ()=>{ + cleanup.clean?.(); + } + }); + + return controls; +} + + + +export { default as UseAnimation } from "./UseAnimation.svelte"; diff --git a/node_modules/svelte-motion/src/animation/utils/default-transitions.js b/node_modules/svelte-motion/src/animation/utils/default-transitions.js new file mode 100644 index 00000000..9ab62ec9 --- /dev/null +++ b/node_modules/svelte-motion/src/animation/utils/default-transitions.js @@ -0,0 +1,60 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +import { isKeyframesTarget } from './is-keyframes-target.js'; + +var underDampedSpring = function () { return ({ + type: "spring", + stiffness: 500, + damping: 25, + restDelta: 0.5, + restSpeed: 10, +}); }; +var criticallyDampedSpring = function (to) { return ({ + type: "spring", + stiffness: 550, + damping: to === 0 ? 2 * Math.sqrt(550) : 30, + restDelta: 0.01, + restSpeed: 10, +}); }; +var linearTween = function () { return ({ + type: "keyframes", + ease: "linear", + duration: 0.3, +}); }; +var keyframes = function (values) { return ({ + type: "keyframes", + duration: 0.8, + values: values, +}); }; +var defaultTransitions = { + x: underDampedSpring, + y: underDampedSpring, + z: underDampedSpring, + rotate: underDampedSpring, + rotateX: underDampedSpring, + rotateY: underDampedSpring, + rotateZ: underDampedSpring, + scaleX: criticallyDampedSpring, + scaleY: criticallyDampedSpring, + scale: criticallyDampedSpring, + opacity: linearTween, + backgroundColor: linearTween, + color: linearTween, + default: criticallyDampedSpring, +}; +var getDefaultTransition = function (valueKey, to) { + var transitionFactory; + if (isKeyframesTarget(to)) { + transitionFactory = keyframes; + } + else { + transitionFactory = + defaultTransitions[valueKey] || defaultTransitions.default; + } + return Object.assign({ to: to }, transitionFactory(to)); +}; + +export { criticallyDampedSpring, getDefaultTransition, linearTween, underDampedSpring }; diff --git a/node_modules/svelte-motion/src/animation/utils/easing.js b/node_modules/svelte-motion/src/animation/utils/easing.js new file mode 100644 index 00000000..4d1d706c --- /dev/null +++ b/node_modules/svelte-motion/src/animation/utils/easing.js @@ -0,0 +1,45 @@ + +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ +import {fixed} from '../../utils/fix-process-env'; +import { __read } from 'tslib'; +import { cubicBezier, linear, easeIn, easeInOut, easeOut, circIn, circInOut, circOut, backIn, backInOut, backOut, anticipate, bounceIn, bounceInOut, bounceOut } from 'popmotion'; +//import { invariant } from 'hey-listen'; + +var easingLookup = { + linear: linear, + easeIn: easeIn, + easeInOut: easeInOut, + easeOut: easeOut, + circIn: circIn, + circInOut: circInOut, + circOut: circOut, + backIn: backIn, + backInOut: backInOut, + backOut: backOut, + anticipate: anticipate, + bounceIn: bounceIn, + bounceInOut: bounceInOut, + bounceOut: bounceOut, +}; +var easingDefinitionToFunction = function (definition) { + if (Array.isArray(definition)) { + // If cubic bezier definition, create bezier curve + //invariant(definition.length === 4, "Cubic bezier arrays must contain four numerical values."); + var _a = __read(definition, 4), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3]; + return cubicBezier(x1, y1, x2, y2); + } + else if (typeof definition === "string") { + // Else lookup from table + //invariant(easingLookup[definition] !== undefined, "Invalid easing type '" + definition + "'"); + return easingLookup[definition]; + } + return definition; +}; +var isEasingArray = function (ease) { + return Array.isArray(ease) && typeof ease[0] !== "number"; +}; + +export { easingDefinitionToFunction, isEasingArray }; diff --git a/node_modules/svelte-motion/src/animation/utils/is-animatable.js b/node_modules/svelte-motion/src/animation/utils/is-animatable.js new file mode 100644 index 00000000..b3235e04 --- /dev/null +++ b/node_modules/svelte-motion/src/animation/utils/is-animatable.js @@ -0,0 +1,35 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ +import {fixed} from '../../utils/fix-process-env'; +import { complex } from 'style-value-types'; + +/** + * Check if a value is animatable. Examples: + * + * ✅: 100, "100px", "#fff" + * ❌: "block", "url(2.jpg)" + * @param value + * + * @internal + */ +var isAnimatable = function (key, value) { + // If the list of keys tat might be non-animatable grows, replace with Set + if (key === "zIndex") + return false; + // If it's a number or a keyframes array, we can animate it. We might at some point + // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this, + // but for now lets leave it like this for performance reasons + if (typeof value === "number" || Array.isArray(value)) + return true; + if (typeof value === "string" && // It's animatable if we have a string + complex.test(value) && // And it contains numbers and/or colors + !value.startsWith("url(") // Unless it starts with "url(" + ) { + return true; + } + return false; +}; + +export { isAnimatable }; diff --git a/node_modules/svelte-motion/src/animation/utils/is-animation-controls.js b/node_modules/svelte-motion/src/animation/utils/is-animation-controls.js new file mode 100644 index 00000000..d3ebb971 --- /dev/null +++ b/node_modules/svelte-motion/src/animation/utils/is-animation-controls.js @@ -0,0 +1,10 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +var isAnimationControls = function (v) { + return typeof v === "object" && typeof (v).start === "function" +}; + +export { isAnimationControls }; diff --git a/node_modules/svelte-motion/src/animation/utils/is-keyframes-target.js b/node_modules/svelte-motion/src/animation/utils/is-keyframes-target.js new file mode 100644 index 00000000..b832f0dc --- /dev/null +++ b/node_modules/svelte-motion/src/animation/utils/is-keyframes-target.js @@ -0,0 +1,10 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +var isKeyframesTarget = function (v) { + return Array.isArray(v); +}; + +export { isKeyframesTarget }; diff --git a/node_modules/svelte-motion/src/animation/utils/transitions.js b/node_modules/svelte-motion/src/animation/utils/transitions.js new file mode 100644 index 00000000..d2d0db63 --- /dev/null +++ b/node_modules/svelte-motion/src/animation/utils/transitions.js @@ -0,0 +1,208 @@ +/** +based on framer-motion@4.1.15, +Copyright (c) 2018 Framer B.V. +*/ +import {fixed} from '../../utils/fix-process-env'; +import { __rest, __spreadArray, __read } from 'tslib'; +import { inertia, animate } from 'popmotion'; +import { secondsToMilliseconds } from '../../utils/time-conversion.js'; +import { isEasingArray, easingDefinitionToFunction } from './easing.js'; +import { isAnimatable } from './is-animatable.js'; +import { getDefaultTransition } from './default-transitions.js'; +import { warning } from 'hey-listen'; +import { getAnimatableNone } from '../../render/dom/value-types/animatable-none.js'; + +/** + * Decide whether a transition is defined on a given Transition. + * This filters out orchestration options and returns true + * if any options are left. + */ +function isTransitionDefined(_a) { + _a.when; _a.delay; _a.delayChildren; _a.staggerChildren; _a.staggerDirection; _a.repeat; _a.repeatType; _a.repeatDelay; _a.from; var transition = __rest(_a, ["when", "delay", "delayChildren", "staggerChildren", "staggerDirection", "repeat", "repeatType", "repeatDelay", "from"]); + return !!Object.keys(transition).length; +} +var legacyRepeatWarning = false; +/** + * Convert Framer Motion's Transition type into Popmotion-compatible options. + */ +function convertTransitionToAnimationOptions(_a) { + var ease = _a.ease, times = _a.times, yoyo = _a.yoyo, flip = _a.flip, loop = _a.loop, transition = __rest(_a, ["ease", "times", "yoyo", "flip", "loop"]); + var options = Object.assign({}, transition); + if (times) + options["offset"] = times; + /** + * Convert any existing durations from seconds to milliseconds + */ + if (transition.duration) + options["duration"] = secondsToMilliseconds(transition.duration); + if (transition.repeatDelay) + options.repeatDelay = secondsToMilliseconds(transition.repeatDelay); + /** + * Map easing names to Popmotion's easing functions + */ + if (ease) { + options["ease"] = isEasingArray(ease) + ? ease.map(easingDefinitionToFunction) + : easingDefinitionToFunction(ease); + } + /** + * Support legacy transition API + */ + if (transition.type === "tween") + options.type = "keyframes"; + /** + * TODO: These options are officially removed from the API. + */ + if (yoyo || loop || flip) { + warning(!legacyRepeatWarning, "yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options."); + legacyRepeatWarning = true; + if (yoyo) { + options.repeatType = "reverse"; + } + else if (loop) { + options.repeatType = "loop"; + } + else if (flip) { + options.repeatType = "mirror"; + } + options.repeat = loop || yoyo || flip || transition.repeat; + } + /** + * TODO: Popmotion 9 has the ability to automatically detect whether to use + * a keyframes or spring animation, but does so by detecting velocity and other spring options. + * It'd be good to introduce a similar thing here. + */ + if (transition.type !== "spring") + options.type = "keyframes"; + return options; +} +/** + * Get the delay for a value by checking Transition with decreasing specificity. + */ +function getDelayFromTransition(transition, key) { + var _a; + var valueTransition = getValueTransition(transition, key) || {}; + return (_a = valueTransition.delay) !== null && _a !== void 0 ? _a : 0; +} +function hydrateKeyframes(options) { + if (Array.isArray(options.to) && options.to[0] === null) { + options.to = __spreadArray([], __read(options.to)); + options.to[0] = options.from; + } + return options; +} +function getPopmotionAnimationOptions(transition, options, key) { + var _a; + if (Array.isArray(options.to)) { + (_a = transition.duration) !== null && _a !== void 0 ? _a : (transition.duration = 0.8); + } + hydrateKeyframes(options); + /** + * Get a default transition if none is determined to be defined. + */ + if (!isTransitionDefined(transition)) { + transition = Object.assign(Object.assign({}, transition), getDefaultTransition(key, options.to)); + } + return Object.assign(Object.assign({}, options), convertTransitionToAnimationOptions(transition)); +} +/** + * + */ +function getAnimation(key, value, target, transition, onComplete) { + var _a; + var valueTransition = getValueTransition(transition, key); + var origin = (_a = valueTransition.from) !== null && _a !== void 0 ? _a : value.get(); + var isTargetAnimatable = isAnimatable(key, target); + if (origin === "none" && isTargetAnimatable && typeof target === "string") { + /** + * If we're trying to animate from "none", try and get an animatable version + * of the target. This could be improved to work both ways. + */ + origin = getAnimatableNone(key, target); + } + else if (isZero(origin) && typeof target === "string") { + origin = getZeroUnit(target); + } + else if (!Array.isArray(target) && + isZero(target) && + typeof origin === "string") { + target = getZeroUnit(origin); + } + var isOriginAnimatable = isAnimatable(key, origin); + warning(isOriginAnimatable === isTargetAnimatable, "You are trying to animate " + key + " from \"" + origin + "\" to \"" + target + "\". " + origin + " is not an animatable value - to enable this animation set " + origin + " to a value animatable to " + target + " via the `style` property."); + function start() { + var options = { + from: origin, + to: target, + velocity: value.getVelocity(), + onComplete: onComplete, + onUpdate: function (v) { return value.set(v); }, + }; + return valueTransition.type === "inertia" || + valueTransition.type === "decay" + ? inertia(Object.assign(Object.assign({}, options), valueTransition)) + : animate(Object.assign(Object.assign({}, getPopmotionAnimationOptions(valueTransition, options, key)), { onUpdate: function (v) { + var _a; + options.onUpdate(v); + (_a = valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, v); + }, onComplete: function () { + var _a; + options.onComplete(); + (_a = valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition); + } })); + } + function set() { + var _a; + value.set(target); + onComplete(); + (_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition); + return { stop: function () { } }; + } + return !isOriginAnimatable || + !isTargetAnimatable || + valueTransition.type === false + ? set + : start; +} +function isZero(value) { + return (value === 0 || + (typeof value === "string" && + parseFloat(value) === 0 && + value.indexOf(" ") === -1)); +} +function getZeroUnit(potentialUnitType) { + return typeof potentialUnitType === "number" + ? 0 + : getAnimatableNone("", potentialUnitType); +} +function getValueTransition(transition, key) { + return transition[key] || transition["default"] || transition; +} +/** + * Start animation on a MotionValue. This function is an interface between + * Framer Motion and Popmotion + * + * @internal + */ +function startAnimation(key, value, target, transition) { + if (transition === void 0) { transition = {}; } + return value.start(function (onComplete) { + var delayTimer; + var controls; + var animation = getAnimation(key, value, target, transition, onComplete); + var delay = getDelayFromTransition(transition, key); + var start = function () { return (controls = animation()); }; + if (delay) { + delayTimer = setTimeout(start, secondsToMilliseconds(delay)); + } + else { + start(); + } + return function () { + clearTimeout(delayTimer); + controls === null || controls === void 0 ? void 0 : controls.stop(); + }; + }); +} + +export { convertTransitionToAnimationOptions, getDelayFromTransition, getPopmotionAnimationOptions, getValueTransition, getZeroUnit, hydrateKeyframes, isTransitionDefined, isZero, startAnimation }; diff --git a/node_modules/svelte-motion/src/components/AnimatePresence/AnimatePresence.svelte b/node_modules/svelte-motion/src/components/AnimatePresence/AnimatePresence.svelte new file mode 100644 index 00000000..25297986 --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimatePresence/AnimatePresence.svelte @@ -0,0 +1,171 @@ + + +{#each childrenToRender as child (getChildKey(child)) +}{/each} diff --git a/node_modules/svelte-motion/src/components/AnimatePresence/PresenceChild.js b/node_modules/svelte-motion/src/components/AnimatePresence/PresenceChild.js new file mode 100644 index 00000000..d03e1b85 --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimatePresence/PresenceChild.js @@ -0,0 +1 @@ +export {default as PresenceChild} from './PresenceChild.svelte'; \ No newline at end of file diff --git a/node_modules/svelte-motion/src/components/AnimatePresence/PresenceChild.svelte b/node_modules/svelte-motion/src/components/AnimatePresence/PresenceChild.svelte new file mode 100644 index 00000000..ae6cf88b --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimatePresence/PresenceChild.svelte @@ -0,0 +1,76 @@ + + + + + diff --git a/node_modules/svelte-motion/src/components/AnimatePresence/index.js b/node_modules/svelte-motion/src/components/AnimatePresence/index.js new file mode 100644 index 00000000..b8c07f50 --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimatePresence/index.js @@ -0,0 +1 @@ +export {default as AnimatePresence} from './AnimatePresence.svelte'; \ No newline at end of file diff --git a/node_modules/svelte-motion/src/components/AnimatePresence/use-presence.js b/node_modules/svelte-motion/src/components/AnimatePresence/use-presence.js new file mode 100644 index 00000000..5554aa37 --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimatePresence/use-presence.js @@ -0,0 +1,42 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ +import { PresenceContext } from '../../context/PresenceContext.js'; +import { derived, get, readable } from 'svelte/store'; + +import { getContext, onMount} from "svelte"; + +let counter = 0; +const incrementId = () => counter++; + +function isPresent(context) { + return context === null ? true : context.isPresent +} + +export const useIsPresent = (isCustom=false) => { + let presenceContext = getContext(PresenceContext) || PresenceContext(isCustom); + return derived(presenceContext, $v => $v === null ? true : $v.isPresent) +} + +export const usePresence = (isCustom=false) => { + + const context = getContext(PresenceContext)||PresenceContext(isCustom); + const id = get(context) === null ? undefined : incrementId(); + onMount(()=>{ + if (get(context)!==null){ + get(context).register(id); + } + }) + + if (get(context) === null){ + return readable([true,null]); + } + return derived(context,$v=> + (!$v.isPresent && $v.onExitComplete) ? + [false, ()=>$v.onExitComplete?.(id)] : + [true] + ) +} + +export { isPresent }; diff --git a/node_modules/svelte-motion/src/components/AnimateSharedLayout/AnimateSharedLayout.svelte b/node_modules/svelte-motion/src/components/AnimateSharedLayout/AnimateSharedLayout.svelte new file mode 100644 index 00000000..75e5ada7 --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimateSharedLayout/AnimateSharedLayout.svelte @@ -0,0 +1,239 @@ + + + diff --git a/node_modules/svelte-motion/src/components/AnimateSharedLayout/index.js b/node_modules/svelte-motion/src/components/AnimateSharedLayout/index.js new file mode 100644 index 00000000..0d03a1ef --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimateSharedLayout/index.js @@ -0,0 +1 @@ +export {default as AnimateSharedLayout} from './AnimateSharedLayout.svelte' \ No newline at end of file diff --git a/node_modules/svelte-motion/src/components/AnimateSharedLayout/types.js b/node_modules/svelte-motion/src/components/AnimateSharedLayout/types.js new file mode 100644 index 00000000..41576a2d --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimateSharedLayout/types.js @@ -0,0 +1,24 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +/** + * @public + */ +var Presence; +(function (Presence) { + Presence[Presence["Entering"] = 0] = "Entering"; + Presence[Presence["Present"] = 1] = "Present"; + Presence[Presence["Exiting"] = 2] = "Exiting"; +})(Presence || (Presence = {})); +/** + * @public + */ +var VisibilityAction; +(function (VisibilityAction) { + VisibilityAction[VisibilityAction["Hide"] = 0] = "Hide"; + VisibilityAction[VisibilityAction["Show"] = 1] = "Show"; +})(VisibilityAction || (VisibilityAction = {})); + +export { Presence, VisibilityAction }; diff --git a/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/batcher.js b/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/batcher.js new file mode 100644 index 00000000..15aa5843 --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/batcher.js @@ -0,0 +1,90 @@ +/** +based on framer-motion@4.1.15, +Copyright (c) 2018 Framer B.V. +*/ + +import { __spreadArray, __read } from 'tslib'; +import sync, { flushSync } from 'framesync'; +import { collectProjectingAncestors, updateLayoutMeasurement } from '../../../render/dom/projection/utils.js'; +import { batchLayout, flushLayout } from '../../../render/dom/utils/batch-layout.js'; +import { compareByDepth } from '../../../render/utils/compare-by-depth.js'; +import { Presence } from '../types.js'; + +/** + * Default handlers for batching VisualElements + */ +var defaultHandler = { + layoutReady: function (child) { return child.notifyLayoutReady(); }, +}; +/** + * Create a batcher to process VisualElements + */ +function createBatcher() { + var queue = new Set(); + return { + add: function (child) { return queue.add(child); }, + flush: function (_a) { + var _b = _a === void 0 ? defaultHandler : _a, layoutReady = _b.layoutReady, parent = _b.parent; + batchLayout(function (read, write) { + var order = Array.from(queue).sort(compareByDepth); + var ancestors = parent + ? collectProjectingAncestors(parent) + : []; + write(function () { + var allElements = __spreadArray(__spreadArray([], __read(ancestors)), __read(order)); + allElements.forEach(function (element) { return element.resetTransform(); }); + }); + read(function () { + order.forEach(updateLayoutMeasurement); + }); + write(function () { + ancestors.forEach(function (element) { return element.restoreTransform(); }); + order.forEach(layoutReady); + }); + read(function () { + /** + * After all children have started animating, ensure any Entering components are set to Present. + * If we add deferred animations (set up all animations and then start them in two loops) this + * could be moved to the start loop. But it needs to happen after all the animations configs + * are generated in AnimateSharedLayout as this relies on presence data + */ + order.forEach(function (child) { + if (child.isPresent) + child.presence = Presence.Present; + }); + }); + write(function () { + /** + * Starting these animations will have queued jobs on the frame loop. In some situations, + * like when removing an element, these will be processed too late after the DOM is manipulated, + * leaving a flash of incorrectly-projected content. By manually flushing these jobs + * we ensure there's no flash. + */ + flushSync.preRender(); + flushSync.render(); + }); + read(function () { + /** + * Schedule a callback at the end of the following frame to assign the latest projection + * box to the prevViewportBox snapshot. Once global batching is in place this could be run + * synchronously. But for now it ensures that if any nested `AnimateSharedLayout` top-level + * child attempts to calculate its previous relative position against a prevViewportBox + * it will be against its latest projection box instead, as the snapshot is useless beyond this + * render. + */ + sync.postRender(function () { + return order.forEach(assignProjectionToSnapshot); + }); + queue.clear(); + }); + }); + // TODO: Need to find a layout-synchronous way of flushing this + flushLayout(); + }, + }; +} +function assignProjectionToSnapshot(child) { + child.prevViewportBox = child.projection.target; +} + +export { createBatcher }; diff --git a/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/crossfader.js b/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/crossfader.js new file mode 100644 index 00000000..cc796be6 --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/crossfader.js @@ -0,0 +1,233 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ +import {fixed} from '../../../utils/fix-process-env'; +import sync, { getFrameData } from 'framesync'; +import { mix, progress, linear, mixColor, circOut } from 'popmotion'; +import { animate } from '../../../animation/animate.js'; +import { getValueTransition } from '../../../animation/utils/transitions.js'; +import { motionValue } from '../../../value/index.js'; + +function createCrossfader() { + /** + * The current state of the crossfade as a value between 0 and 1 + */ + var progress = motionValue(1); + var options = { + lead: undefined, + follow: undefined, + crossfadeOpacity: false, + preserveFollowOpacity: false, + }; + var prevOptions = Object.assign({}, options); + var leadState = {}; + var followState = {}; + /** + * + */ + var isActive = false; + /** + * + */ + var finalCrossfadeFrame = null; + /** + * Framestamp of the last frame we updated values at. + */ + var prevUpdate = 0; + function startCrossfadeAnimation(target, transition) { + var lead = options.lead, follow = options.follow; + isActive = true; + finalCrossfadeFrame = null; + var hasUpdated = false; + var onUpdate = function () { + hasUpdated = true; + lead && lead.scheduleRender(); + follow && follow.scheduleRender(); + }; + var onComplete = function () { + isActive = false; + /** + * If the crossfade animation is no longer active, flag a frame + * that we're still allowed to crossfade + */ + finalCrossfadeFrame = getFrameData().timestamp; + }; + transition = transition && getValueTransition(transition, "crossfade"); + return animate(progress, target, Object.assign(Object.assign({}, transition), { onUpdate: onUpdate, onComplete: function () { + if (!hasUpdated) { + progress.set(target); + /** + * If we never ran an update, for instance if this was an instant transition, fire a + * simulated final frame to ensure the crossfade gets applied correctly. + */ + sync.read(onComplete); + } + else { + onComplete(); + } + onUpdate(); + } })); + } + function updateCrossfade() { + var _a, _b; + /** + * We only want to compute the crossfade once per frame, so we + * compare the previous update framestamp with the current frame + * and early return if they're the same. + */ + var timestamp = getFrameData().timestamp; + var lead = options.lead, follow = options.follow; + if (timestamp === prevUpdate || !lead) + return; + prevUpdate = timestamp; + /** + * Merge each component's latest values into our crossfaded state + * before crossfading. + */ + var latestLeadValues = lead.getLatestValues(); + Object.assign(leadState, latestLeadValues); + var latestFollowValues = follow + ? follow.getLatestValues() + : options.prevValues; + Object.assign(followState, latestFollowValues); + var p = progress.get(); + /** + * Crossfade the opacity between the two components. This will result + * in a different opacity for each component. + */ + var leadTargetOpacity = (_a = latestLeadValues.opacity) !== null && _a !== void 0 ? _a : 1; + var followTargetOpacity = (_b = latestFollowValues === null || latestFollowValues === void 0 ? void 0 : latestFollowValues.opacity) !== null && _b !== void 0 ? _b : 1; + if (options.crossfadeOpacity && follow) { + leadState.opacity = mix( + /** + * If the follow child has been completely hidden we animate + * this opacity from its previous opacity, but otherwise from completely transparent. + */ + follow.isVisible !== false ? 0 : followTargetOpacity, leadTargetOpacity, easeCrossfadeIn(p)); + followState.opacity = options.preserveFollowOpacity + ? followTargetOpacity + : mix(followTargetOpacity, 0, easeCrossfadeOut(p)); + } + else if (!follow) { + leadState.opacity = mix(followTargetOpacity, leadTargetOpacity, p); + } + mixValues(leadState, followState, latestLeadValues, latestFollowValues || {}, Boolean(follow), p); + } + return { + isActive: function () { + return leadState && + (isActive || getFrameData().timestamp === finalCrossfadeFrame); + }, + fromLead: function (transition) { + return startCrossfadeAnimation(0, transition); + }, + toLead: function (transition) { + var initialProgress = 0; + if (!options.prevValues && !options.follow) { + /** + * If we're not coming from anywhere, start at the end of the animation. + */ + initialProgress = 1; + } + else if (prevOptions.lead === options.follow && + prevOptions.follow === options.lead) { + /** + * If we're swapping follow/lead we can reverse the progress + */ + initialProgress = 1 - progress.get(); + } + progress.set(initialProgress); + return startCrossfadeAnimation(1, transition); + }, + reset: function () { return progress.set(1); }, + stop: function () { return progress.stop(); }, + getCrossfadeState: function (element) { + updateCrossfade(); + if (element === options.lead) { + return leadState; + } + else if (element === options.follow) { + return followState; + } + }, + setOptions: function (newOptions) { + prevOptions = options; + options = newOptions; + leadState = {}; + followState = {}; + }, + getLatestValues: function () { + return leadState; + }, + }; +} +var easeCrossfadeIn = compress(0, 0.5, circOut); +var easeCrossfadeOut = compress(0.5, 0.95, linear); +function compress(min, max, easing) { + return function (p) { + // Could replace ifs with clamp + if (p < min) + return 0; + if (p > max) + return 1; + return easing(progress(min, max, p)); + }; +} +var borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"]; +var numBorders = borders.length; +function mixValues(leadState, followState, latestLeadValues, latestFollowValues, hasFollowElement, p) { + /** + * Mix border radius + */ + for (var i = 0; i < numBorders; i++) { + var borderLabel = "border" + borders[i] + "Radius"; + var followRadius = getRadius(latestFollowValues, borderLabel); + var leadRadius = getRadius(latestLeadValues, borderLabel); + if (followRadius === undefined && leadRadius === undefined) + continue; + followRadius || (followRadius = 0); + leadRadius || (leadRadius = 0); + /** + * Currently we're only crossfading between numerical border radius. + * It would be possible to crossfade between percentages for a little + * extra bundle size. + */ + if (typeof followRadius === "number" && + typeof leadRadius === "number") { + var radius = Math.max(mix(followRadius, leadRadius, p), 0); + leadState[borderLabel] = followState[borderLabel] = radius; + } + } + /** + * Mix rotation + */ + if (latestFollowValues.rotate || latestLeadValues.rotate) { + var rotate = mix(latestFollowValues.rotate || 0, latestLeadValues.rotate || 0, p); + leadState.rotate = followState.rotate = rotate; + } + /** + * We only want to mix the background color if there's a follow element + * that we're not crossfading opacity between. For instance with switch + * AnimateSharedLayout animations, this helps the illusion of a continuous + * element being animated but also cuts down on the number of paints triggered + * for elements where opacity is doing that work for us. + */ + if (!hasFollowElement && + latestLeadValues.backgroundColor && + latestFollowValues.backgroundColor) { + /** + * This isn't ideal performance-wise as mixColor is creating a new function every frame. + * We could probably create a mixer that runs at the start of the animation but + * the idea behind the crossfader is that it runs dynamically between two potentially + * changing targets (ie opacity or borderRadius may be animating independently via variants) + */ + leadState.backgroundColor = followState.backgroundColor = mixColor(latestFollowValues.backgroundColor, latestLeadValues.backgroundColor)(p); + } +} +function getRadius(values, radiusName) { + var _a; + return (_a = values[radiusName]) !== null && _a !== void 0 ? _a : values.borderRadius; +} + +export { createCrossfader }; diff --git a/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/rotate.js b/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/rotate.js new file mode 100644 index 00000000..507bbe0c --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/rotate.js @@ -0,0 +1,41 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +import { transformAxes } from '../../../render/html/utils/transform.js'; + +function resetRotate(child) { + // If there's no detected rotation values, we can early return without a forced render. + var hasRotate = false; + // Keep a record of all the values we've reset + var resetValues = {}; + // Check the rotate value of all axes and reset to 0 + for (var i = 0; i < transformAxes.length; i++) { + var axis = transformAxes[i]; + var key = "rotate" + axis; + // If this rotation doesn't exist as a motion value, then we don't + // need to reset it + if (!child.hasValue(key) || child.getStaticValue(key) === 0) + continue; + hasRotate = true; + // Record the rotation and then temporarily set it to 0 + resetValues[key] = child.getStaticValue(key); + child.setStaticValue(key, 0); + } + // If there's no rotation values, we don't need to do any more. + if (!hasRotate) + return; + // Force a render of this element to apply the transform with all rotations + // set to 0. + child.syncRender(); + // Put back all the values we reset + for (var key in resetValues) { + child.setStaticValue(key, resetValues[key]); + } + // Schedule a render for the next frame. This ensures we won't visually + // see the element with the reset rotate value applied. + child.scheduleRender(); +} + +export { resetRotate }; diff --git a/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/stack.js b/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/stack.js new file mode 100644 index 00000000..cb60dccb --- /dev/null +++ b/node_modules/svelte-motion/src/components/AnimateSharedLayout/utils/stack.js @@ -0,0 +1,138 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +import { Presence } from '../types.js'; +import { elementDragControls } from '../../../gestures/drag/VisualElementDragControls.js'; +import { createCrossfader } from './crossfader.js'; + +function layoutStack() { + var stack = new Set(); + var state = { leadIsExiting: false }; + var prevState = Object.assign({}, state); + var prevValues; + var prevViewportBox; + var prevDragCursor; + var crossfader = createCrossfader(); + var needsCrossfadeAnimation = false; + function getFollowViewportBox() { + return state.follow ? state.follow.prevViewportBox : prevViewportBox; + } + function getFollowLayout() { + var _a; + return (_a = state.follow) === null || _a === void 0 ? void 0 : _a.getLayoutState().layout; + } + return { + add: function (element) { + element.setCrossfader(crossfader); + stack.add(element); + /** + * Hydrate new element with previous drag position if we have one + */ + if (prevDragCursor) + element.prevDragCursor = prevDragCursor; + if (!state.lead) + state.lead = element; + }, + remove: function (element) { + stack.delete(element); + }, + getLead: function () { return state.lead; }, + updateSnapshot: function () { + if (!state.lead) + return; + prevValues = crossfader.isActive() + ? crossfader.getLatestValues() + : state.lead.getLatestValues(); + prevViewportBox = state.lead.prevViewportBox; + var dragControls = elementDragControls.get(state.lead); + if (dragControls && dragControls.isDragging) { + prevDragCursor = dragControls.cursorProgress; + } + }, + clearSnapshot: function () { + prevDragCursor = prevViewportBox = undefined; + }, + updateLeadAndFollow: function () { + var _a; + prevState = Object.assign({}, state); + var lead; + var follow; + var order = Array.from(stack); + for (var i = order.length; i--; i >= 0) { + var element = order[i]; + if (lead) + follow !== null && follow !== void 0 ? follow : (follow = element); + lead !== null && lead !== void 0 ? lead : (lead = element); + if (lead && follow) + break; + } + state.lead = lead; + state.follow = follow; + state.leadIsExiting = ((_a = state.lead) === null || _a === void 0 ? void 0 : _a.presence) === Presence.Exiting; + crossfader.setOptions({ + lead: lead, + follow: follow, + prevValues: prevValues, + crossfadeOpacity: (follow === null || follow === void 0 ? void 0 : follow.isPresenceRoot) || (lead === null || lead === void 0 ? void 0 : lead.isPresenceRoot), + }); + if ( + // Don't crossfade if we've just animated back from lead and switched the + // old follow to the new lead. + state.lead !== prevState.follow && + (prevState.lead !== state.lead || + prevState.leadIsExiting !== state.leadIsExiting)) { + needsCrossfadeAnimation = true; + } + }, + animate: function (child, shouldCrossfade) { + var _a; + if (shouldCrossfade === void 0) { shouldCrossfade = false; } + if (child === state.lead) { + if (shouldCrossfade) { + /** + * Point a lead to itself in case it was previously pointing + * to a different visual element + */ + child.pointTo(state.lead); + } + else { + child.setVisibility(true); + } + var config = {}; + var prevParent = (_a = state.follow) === null || _a === void 0 ? void 0 : _a.getProjectionParent(); + if (prevParent) { + /** + * We'll use this to determine if the element or its layoutId has been reparented. + */ + config.prevParent = prevParent; + } + if (child.presence === Presence.Entering) { + config.originBox = getFollowViewportBox(); + } + else if (child.presence === Presence.Exiting) { + config.targetBox = getFollowLayout(); + } + if (needsCrossfadeAnimation) { + needsCrossfadeAnimation = false; + var transition = child.getDefaultTransition(); + child.presence === Presence.Entering + ? crossfader.toLead(transition) + : crossfader.fromLead(transition); + } + child.notifyLayoutReady(config); + } + else { + if (shouldCrossfade) { + state.lead && child.pointTo(state.lead); + } + else { + child.setVisibility(false); + } + } + }, + }; +} + +export { layoutStack }; diff --git a/node_modules/svelte-motion/src/components/LazyMotion/LazyMotion.svelte b/node_modules/svelte-motion/src/components/LazyMotion/LazyMotion.svelte new file mode 100644 index 00000000..87f64df9 --- /dev/null +++ b/node_modules/svelte-motion/src/components/LazyMotion/LazyMotion.svelte @@ -0,0 +1,78 @@ + + diff --git a/node_modules/svelte-motion/src/components/LazyMotion/index.js b/node_modules/svelte-motion/src/components/LazyMotion/index.js new file mode 100644 index 00000000..a477d4bf --- /dev/null +++ b/node_modules/svelte-motion/src/components/LazyMotion/index.js @@ -0,0 +1,2 @@ +export {default as LazyMotion} from './LazyMotion.svelte'; + diff --git a/node_modules/svelte-motion/src/components/MotionConfig/MotionConfig.svelte b/node_modules/svelte-motion/src/components/MotionConfig/MotionConfig.svelte new file mode 100644 index 00000000..e5881fb2 --- /dev/null +++ b/node_modules/svelte-motion/src/components/MotionConfig/MotionConfig.svelte @@ -0,0 +1,56 @@ + + + + + + diff --git a/node_modules/svelte-motion/src/components/MotionConfig/MotionConfigScaleCorrection.js b/node_modules/svelte-motion/src/components/MotionConfig/MotionConfigScaleCorrection.js new file mode 100644 index 00000000..042ad438 --- /dev/null +++ b/node_modules/svelte-motion/src/components/MotionConfig/MotionConfigScaleCorrection.js @@ -0,0 +1,47 @@ +import { getContext } from "svelte"; +import { get } from "svelte/store"; +import { + ScaleCorrectionContext, + ScaleCorrectionParentContext, +} from "../../context/ScaleCorrectionProvider.svelte"; + + +export const scaleCorrection = () => { + + const scaleCorrectionContext = getContext(ScaleCorrectionContext); + const scaleCorrectionParentContext = getContext( + ScaleCorrectionParentContext + ); + const afterU = (nc = false) => { + /* Second part of the updater calling in child layouts first.*/ + const scc = get(scaleCorrectionContext); + + + scc.forEach((v, i) => { + v.afterU?.(true); + }); + }; + + const updater = () => { + // in React the updater function is called on children first, in Svelte the child does not call it. + get(scaleCorrectionContext).forEach((v) => { + v.updater?.(true); + }) + } + + scaleCorrectionParentContext.update((v) => + v.concat([ + { + updater, + afterU, + }, + ]) + ); + + return { + update: updater + } + } + + + diff --git a/node_modules/svelte-motion/src/components/MotionConfig/index.js b/node_modules/svelte-motion/src/components/MotionConfig/index.js new file mode 100644 index 00000000..892cf3f8 --- /dev/null +++ b/node_modules/svelte-motion/src/components/MotionConfig/index.js @@ -0,0 +1 @@ +export {default as MotionConfig} from './MotionConfig.svelte'; diff --git a/node_modules/svelte-motion/src/components/MotionDiv.svelte b/node_modules/svelte-motion/src/components/MotionDiv.svelte new file mode 100644 index 00000000..db4a1662 --- /dev/null +++ b/node_modules/svelte-motion/src/components/MotionDiv.svelte @@ -0,0 +1,8 @@ + + + +
    +
    diff --git a/node_modules/svelte-motion/src/context/DOMcontext.js b/node_modules/svelte-motion/src/context/DOMcontext.js new file mode 100644 index 00000000..3064ea79 --- /dev/null +++ b/node_modules/svelte-motion/src/context/DOMcontext.js @@ -0,0 +1,21 @@ +export const getDomContext = (name,el) => { + if (!el || !window){ + return undefined; + } + let par = el; + while(par = par.parentNode){ + if (par.motionDomContext && par.motionDomContext.has(name)){ + return par.motionDomContext.get(name) + } + } + return undefined; +} + +export const setDomContext = (name,el,value) => { + if (el && window){ + if (!el.motionDomContext){ + el.motionDomContext = new Map(); + } + el.motionDomContext.set(name,value); + } +} \ No newline at end of file diff --git a/node_modules/svelte-motion/src/context/LayoutGroupContext.js b/node_modules/svelte-motion/src/context/LayoutGroupContext.js new file mode 100644 index 00000000..b4cb32d5 --- /dev/null +++ b/node_modules/svelte-motion/src/context/LayoutGroupContext.js @@ -0,0 +1,7 @@ +import { writable } from "svelte/store"; +import { getDomContext } from "./DOMcontext"; + +/** + * @internal + */ +export const LayoutGroupContext = (c)=>getDomContext("LayoutGroup",c)||writable(null); diff --git a/node_modules/svelte-motion/src/context/LazyContext.js b/node_modules/svelte-motion/src/context/LazyContext.js new file mode 100644 index 00000000..24b8f6c8 --- /dev/null +++ b/node_modules/svelte-motion/src/context/LazyContext.js @@ -0,0 +1,7 @@ +import { writable } from "svelte/store"; +import { getDomContext } from "./DOMcontext"; + + +const LazyContext = (c) => getDomContext("Lazy",c) || writable({ strict: false }); + +export { LazyContext }; diff --git a/node_modules/svelte-motion/src/context/MotionConfigContext.js b/node_modules/svelte-motion/src/context/MotionConfigContext.js new file mode 100644 index 00000000..ba53c955 --- /dev/null +++ b/node_modules/svelte-motion/src/context/MotionConfigContext.js @@ -0,0 +1,13 @@ +import { writable } from "svelte/store"; +import { getDomContext } from "./DOMcontext"; + + +/** + * @public + */ +var MotionConfigContext = (c)=> getDomContext("MotionConfig",c)||writable({ + transformPagePoint: function (p) { return p; }, + isStatic: false, +}); + +export { MotionConfigContext }; diff --git a/node_modules/svelte-motion/src/context/MotionContext/MotionContext.svelte b/node_modules/svelte-motion/src/context/MotionContext/MotionContext.svelte new file mode 100644 index 00000000..20ea43e1 --- /dev/null +++ b/node_modules/svelte-motion/src/context/MotionContext/MotionContext.svelte @@ -0,0 +1,19 @@ + + + diff --git a/node_modules/svelte-motion/src/context/MotionContext/MotionContextProvider.svelte b/node_modules/svelte-motion/src/context/MotionContext/MotionContextProvider.svelte new file mode 100644 index 00000000..27124e70 --- /dev/null +++ b/node_modules/svelte-motion/src/context/MotionContext/MotionContextProvider.svelte @@ -0,0 +1,23 @@ + + diff --git a/node_modules/svelte-motion/src/context/MotionContext/UseCreateMotionContext.svelte b/node_modules/svelte-motion/src/context/MotionContext/UseCreateMotionContext.svelte new file mode 100644 index 00000000..fb706bb5 --- /dev/null +++ b/node_modules/svelte-motion/src/context/MotionContext/UseCreateMotionContext.svelte @@ -0,0 +1,34 @@ + + diff --git a/node_modules/svelte-motion/src/context/MotionContext/create.js b/node_modules/svelte-motion/src/context/MotionContext/create.js new file mode 100644 index 00000000..ecb41e58 --- /dev/null +++ b/node_modules/svelte-motion/src/context/MotionContext/create.js @@ -0,0 +1 @@ +export { default as UseCreateMotionContext } from './UseCreateMotionContext.svelte'; diff --git a/node_modules/svelte-motion/src/context/MotionContext/index.js b/node_modules/svelte-motion/src/context/MotionContext/index.js new file mode 100644 index 00000000..57db1ad5 --- /dev/null +++ b/node_modules/svelte-motion/src/context/MotionContext/index.js @@ -0,0 +1,2 @@ +export {MotionContext,useVisualElementContext, default as UseVisualElementContext} from "./MotionContext.svelte"; + diff --git a/node_modules/svelte-motion/src/context/MotionContext/utils.js b/node_modules/svelte-motion/src/context/MotionContext/utils.js new file mode 100644 index 00000000..16fe23ec --- /dev/null +++ b/node_modules/svelte-motion/src/context/MotionContext/utils.js @@ -0,0 +1,21 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +import { checkIfControllingVariants, isVariantLabel } from '../../render/utils/variants.js'; + +function getCurrentTreeVariants(props, context) { + if (checkIfControllingVariants(props)) { + var initial = props.initial, animate = props.animate; + return { + initial: initial === false || isVariantLabel(initial) + ? initial + : undefined, + animate: isVariantLabel(animate) ? animate : undefined, + }; + } + return props.inherit !== false ? (context||{}) : {}; +} + +export { getCurrentTreeVariants }; diff --git a/node_modules/svelte-motion/src/context/PresenceContext.js b/node_modules/svelte-motion/src/context/PresenceContext.js new file mode 100644 index 00000000..2f2541f5 --- /dev/null +++ b/node_modules/svelte-motion/src/context/PresenceContext.js @@ -0,0 +1,8 @@ +import { writable } from "svelte/store"; +import { getDomContext } from "./DOMcontext"; + + +/** + * @public + */ +export const PresenceContext = (c)=> getDomContext("Presence",c)||writable(null); diff --git a/node_modules/svelte-motion/src/context/ScaleCorrectionProvider.svelte b/node_modules/svelte-motion/src/context/ScaleCorrectionProvider.svelte new file mode 100644 index 00000000..847d1f7f --- /dev/null +++ b/node_modules/svelte-motion/src/context/ScaleCorrectionProvider.svelte @@ -0,0 +1,26 @@ + + + + + diff --git a/node_modules/svelte-motion/src/context/SharedLayoutContext.js b/node_modules/svelte-motion/src/context/SharedLayoutContext.js new file mode 100644 index 00000000..d3bc8c78 --- /dev/null +++ b/node_modules/svelte-motion/src/context/SharedLayoutContext.js @@ -0,0 +1,20 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +import { writable } from 'svelte/store'; +import { createBatcher } from '../components/AnimateSharedLayout/utils/batcher.js'; +import { getDomContext } from './DOMcontext.js'; + +var SharedLayoutContext = (custom) => getDomContext("SharedLayout",custom)||writable(createBatcher()); +/** + * @internal + */ +var FramerTreeLayoutContext = ()=> writable(createBatcher()); + +function isSharedLayout(context) { + return !!context.forceUpdate; +} + +export { FramerTreeLayoutContext, SharedLayoutContext, isSharedLayout }; diff --git a/node_modules/svelte-motion/src/events/UseDomEvent.svelte b/node_modules/svelte-motion/src/events/UseDomEvent.svelte new file mode 100644 index 00000000..a2ba52b7 --- /dev/null +++ b/node_modules/svelte-motion/src/events/UseDomEvent.svelte @@ -0,0 +1,63 @@ + + + + diff --git a/node_modules/svelte-motion/src/events/UsePointerEvent.svelte b/node_modules/svelte-motion/src/events/UsePointerEvent.svelte new file mode 100644 index 00000000..44e2c372 --- /dev/null +++ b/node_modules/svelte-motion/src/events/UsePointerEvent.svelte @@ -0,0 +1,70 @@ + + + + + diff --git a/node_modules/svelte-motion/src/events/event-info.js b/node_modules/svelte-motion/src/events/event-info.js new file mode 100644 index 00000000..a3058151 --- /dev/null +++ b/node_modules/svelte-motion/src/events/event-info.js @@ -0,0 +1,60 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +import { isTouchEvent } from '../gestures/utils/event-type.js'; + +/** + * Filters out events not attached to the primary pointer (currently left mouse button) + * @param eventHandler + */ +function filterPrimaryPointer(eventHandler) { + return function (event) { + var isMouseEvent = event instanceof MouseEvent; + var isPrimaryPointer = !isMouseEvent || + (isMouseEvent && event.button === 0); + if (isPrimaryPointer) { + eventHandler(event); + } + }; +} +var defaultPagePoint = { pageX: 0, pageY: 0 }; +function pointFromTouch(e, pointType) { + if (pointType === void 0) { pointType = "page"; } + var primaryTouch = e.touches[0] || e.changedTouches[0]; + var point = primaryTouch || defaultPagePoint; + return { + x: point[pointType + "X"], + y: point[pointType + "Y"], + }; +} +function pointFromMouse(point, pointType) { + if (pointType === void 0) { pointType = "page"; } + return { + x: point[pointType + "X"], + y: point[pointType + "Y"], + }; +} +function extractEventInfo(event, pointType) { + if (pointType === void 0) { pointType = "page"; } + return { + point: isTouchEvent(event) + ? pointFromTouch(event, pointType) + : pointFromMouse(event, pointType), + }; +} +function getViewportPointFromEvent(event) { + return extractEventInfo(event, "client"); +} +var wrapHandler = function (handler, shouldFilterPrimaryPointer) { + if (shouldFilterPrimaryPointer === void 0) { shouldFilterPrimaryPointer = false; } + var listener = function (event) { + return handler(event, extractEventInfo(event)); + }; + return shouldFilterPrimaryPointer + ? filterPrimaryPointer(listener) + : listener; +}; + +export { extractEventInfo, getViewportPointFromEvent, wrapHandler }; diff --git a/node_modules/svelte-motion/src/events/use-dom-event.js b/node_modules/svelte-motion/src/events/use-dom-event.js new file mode 100644 index 00000000..16de7250 --- /dev/null +++ b/node_modules/svelte-motion/src/events/use-dom-event.js @@ -0,0 +1,3 @@ + + +export { addDomEvent, default as UseDomEvent } from './UseDomEvent.svelte'; diff --git a/node_modules/svelte-motion/src/events/use-pointer-event.js b/node_modules/svelte-motion/src/events/use-pointer-event.js new file mode 100644 index 00000000..9588f358 --- /dev/null +++ b/node_modules/svelte-motion/src/events/use-pointer-event.js @@ -0,0 +1,2 @@ + +export { addPointerEvent, default as UsePointerEvent } from './UsePointerEvent.svelte'; diff --git a/node_modules/svelte-motion/src/events/utils.js b/node_modules/svelte-motion/src/events/utils.js new file mode 100644 index 00000000..2b7bf684 --- /dev/null +++ b/node_modules/svelte-motion/src/events/utils.js @@ -0,0 +1,19 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ + +import { isBrowser } from '../utils/is-browser.js'; + +// We check for event support via functions in case they've been mocked by a testing suite. +var supportsPointerEvents = function () { + return isBrowser && window.onpointerdown === null; +}; +var supportsTouchEvents = function () { + return isBrowser && window.ontouchstart === null; +}; +var supportsMouseEvents = function () { + return isBrowser && window.onmousedown === null; +}; + +export { supportsMouseEvents, supportsPointerEvents, supportsTouchEvents }; diff --git a/node_modules/svelte-motion/src/gestures/PanSession.js b/node_modules/svelte-motion/src/gestures/PanSession.js new file mode 100644 index 00000000..199a6f51 --- /dev/null +++ b/node_modules/svelte-motion/src/gestures/PanSession.js @@ -0,0 +1,157 @@ +/** +based on framer-motion@4.0.3, +Copyright (c) 2018 Framer B.V. +*/ +import {fixed} from '../utils/fix-process-env'; +import { isMouseEvent, isTouchEvent } from './utils/event-type.js'; +import { extractEventInfo } from '../events/event-info.js'; +import sync, { getFrameData, cancelSync } from 'framesync'; +import { secondsToMilliseconds } from '../utils/time-conversion.js'; +import { addPointerEvent } from '../events/use-pointer-event.js'; +import { distance, pipe } from 'popmotion'; + +/** + * @internal + */ +var PanSession = /** @class */ (function () { + function PanSession(event, handlers, _a) { + var _this = this; + var _b = _a === void 0 ? {} : _a, transformPagePoint = _b.transformPagePoint; + /** + * @internal + */ + this.startEvent = null; + /** + * @internal + */ + this.lastMoveEvent = null; + /** + * @internal + */ + this.lastMoveEventInfo = null; + /** + * @internal + */ + this.handlers = {}; + this.updatePoint = function () { + if (!(_this.lastMoveEvent && _this.lastMoveEventInfo)) + return; + var info = getPanInfo(_this.lastMoveEventInfo, _this.history); + var isPanStarted = _this.startEvent !== null; + // Only start panning if the offset is larger than 3 pixels. If we make it + // any larger than this we'll want to reset the pointer history + // on the first update to avoid visual snapping to the cursoe. + var isDistancePastThreshold = distance(info.offset, { x: 0, y: 0 }) >= 3; + if (!isPanStarted && !isDistancePastThreshold) + return; + var point = info.point; + var timestamp = getFrameData().timestamp; + _this.history.push(Object.assign(Object.assign({}, point), { timestamp: timestamp })); + var _a = _this.handlers, onStart = _a.onStart, onMove = _a.onMove; + if (!isPanStarted) { + onStart && onStart(_this.lastMoveEvent, info); + _this.startEvent = _this.lastMoveEvent; + } + onMove && onMove(_this.lastMoveEvent, info); + }; + this.handlePointerMove = function (event, info) { + _this.lastMoveEvent = event; + _this.lastMoveEventInfo = transformPoint(info, _this.transformPagePoint); + // Because Safari doesn't trigger mouseup events when it's above a ` + * + * ``` + * @since 5.8.0 + */ +export class Spring { + constructor(value: T, options?: SpringOpts); + + /** + * Create a spring whose value is bound to the return value of `fn`. This must be called + * inside an effect root (for example, during component initialisation). + * + * ```svelte + * + * ``` + */ + static of(fn: () => U, options?: SpringOpts): Spring; + + /** + * Sets `spring.target` to `value` and returns a `Promise` that resolves if and when `spring.current` catches up to it. + * + * If `options.instant` is `true`, `spring.current` immediately matches `spring.target`. + * + * If `options.preserveMomentum` is provided, the spring will continue on its current trajectory for + * the specified number of milliseconds. This is useful for things like 'fling' gestures. + */ + set(value: T, options?: SpringUpdateOpts): Promise; + + damping: number; + precision: number; + stiffness: number; + /** + * The end value of the spring. + * This property only exists on the `Spring` class, not the legacy `spring` store. + */ + target: T; + /** + * The current value of the spring. + * This property only exists on the `Spring` class, not the legacy `spring` store. + */ + get current(): T; +} + +export interface Tweened extends Readable { + set(value: T, opts?: TweenedOptions): Promise; + update(updater: Updater, opts?: TweenedOptions): Promise; +} + +export { prefersReducedMotion, spring, tweened, Tween } from './index.js'; diff --git a/node_modules/svelte/src/motion/spring.js b/node_modules/svelte/src/motion/spring.js new file mode 100644 index 00000000..bc30ce95 --- /dev/null +++ b/node_modules/svelte/src/motion/spring.js @@ -0,0 +1,349 @@ +/** @import { Task } from '#client' */ +/** @import { SpringOpts, SpringUpdateOpts, TickContext } from './private.js' */ +/** @import { Spring as SpringStore } from './public.js' */ +import { writable } from '../store/shared/index.js'; +import { loop } from '../internal/client/loop.js'; +import { raf } from '../internal/client/timing.js'; +import { is_date } from './utils.js'; +import { set, source } from '../internal/client/reactivity/sources.js'; +import { render_effect } from '../internal/client/reactivity/effects.js'; +import { get } from '../internal/client/runtime.js'; +import { deferred, noop } from '../internal/shared/utils.js'; + +/** + * @template T + * @param {TickContext} ctx + * @param {T} last_value + * @param {T} current_value + * @param {T} target_value + * @returns {T} + */ +function tick_spring(ctx, last_value, current_value, target_value) { + if (typeof current_value === 'number' || is_date(current_value)) { + // @ts-ignore + const delta = target_value - current_value; + // @ts-ignore + const velocity = (current_value - last_value) / (ctx.dt || 1 / 60); // guard div by 0 + const spring = ctx.opts.stiffness * delta; + const damper = ctx.opts.damping * velocity; + const acceleration = (spring - damper) * ctx.inv_mass; + const d = (velocity + acceleration) * ctx.dt; + if (Math.abs(d) < ctx.opts.precision && Math.abs(delta) < ctx.opts.precision) { + return target_value; // settled + } else { + ctx.settled = false; // signal loop to keep ticking + // @ts-ignore + return is_date(current_value) ? new Date(current_value.getTime() + d) : current_value + d; + } + } else if (Array.isArray(current_value)) { + // @ts-ignore + return current_value.map((_, i) => + // @ts-ignore + tick_spring(ctx, last_value[i], current_value[i], target_value[i]) + ); + } else if (typeof current_value === 'object') { + const next_value = {}; + for (const k in current_value) { + // @ts-ignore + next_value[k] = tick_spring(ctx, last_value[k], current_value[k], target_value[k]); + } + // @ts-ignore + return next_value; + } else { + throw new Error(`Cannot spring ${typeof current_value} values`); + } +} + +/** + * The spring function in Svelte creates a store whose value is animated, with a motion that simulates the behavior of a spring. This means when the value changes, instead of transitioning at a steady rate, it "bounces" like a spring would, depending on the physics parameters provided. This adds a level of realism to the transitions and can enhance the user experience. + * + * @deprecated Use [`Spring`](https://svelte.dev/docs/svelte/svelte-motion#Spring) instead + * @template [T=any] + * @param {T} [value] + * @param {SpringOpts} [opts] + * @returns {SpringStore} + */ +export function spring(value, opts = {}) { + const store = writable(value); + const { stiffness = 0.15, damping = 0.8, precision = 0.01 } = opts; + /** @type {number} */ + let last_time; + /** @type {Task | null} */ + let task; + /** @type {object} */ + let current_token; + + let last_value = /** @type {T} */ (value); + let target_value = /** @type {T | undefined} */ (value); + + let inv_mass = 1; + let inv_mass_recovery_rate = 0; + let cancel_task = false; + /** + * @param {T} new_value + * @param {SpringUpdateOpts} opts + * @returns {Promise} + */ + function set(new_value, opts = {}) { + target_value = new_value; + const token = (current_token = {}); + if (value == null || opts.hard || (spring.stiffness >= 1 && spring.damping >= 1)) { + cancel_task = true; // cancel any running animation + last_time = raf.now(); + last_value = new_value; + store.set((value = target_value)); + return Promise.resolve(); + } else if (opts.soft) { + const rate = opts.soft === true ? 0.5 : +opts.soft; + inv_mass_recovery_rate = 1 / (rate * 60); + inv_mass = 0; // infinite mass, unaffected by spring forces + } + if (!task) { + last_time = raf.now(); + cancel_task = false; + task = loop((now) => { + if (cancel_task) { + cancel_task = false; + task = null; + return false; + } + inv_mass = Math.min(inv_mass + inv_mass_recovery_rate, 1); + /** @type {TickContext} */ + const ctx = { + inv_mass, + opts: spring, + settled: true, + dt: ((now - last_time) * 60) / 1000 + }; + // @ts-ignore + const next_value = tick_spring(ctx, last_value, value, target_value); + last_time = now; + last_value = /** @type {T} */ (value); + store.set((value = /** @type {T} */ (next_value))); + if (ctx.settled) { + task = null; + } + return !ctx.settled; + }); + } + return new Promise((fulfil) => { + /** @type {Task} */ (task).promise.then(() => { + if (token === current_token) fulfil(); + }); + }); + } + /** @type {SpringStore} */ + // @ts-expect-error - class-only properties are missing + const spring = { + set, + update: (fn, opts) => set(fn(/** @type {T} */ (target_value), /** @type {T} */ (value)), opts), + subscribe: store.subscribe, + stiffness, + damping, + precision + }; + return spring; +} + +/** + * A wrapper for a value that behaves in a spring-like fashion. Changes to `spring.target` will cause `spring.current` to + * move towards it over time, taking account of the `spring.stiffness` and `spring.damping` parameters. + * + * ```svelte + * + * + * + * + * ``` + * @template T + * @since 5.8.0 + */ +export class Spring { + #stiffness = source(0.15); + #damping = source(0.8); + #precision = source(0.01); + + #current = source(/** @type {T} */ (undefined)); + #target = source(/** @type {T} */ (undefined)); + + #last_value = /** @type {T} */ (undefined); + #last_time = 0; + + #inverse_mass = 1; + #momentum = 0; + + /** @type {import('../internal/client/types').Task | null} */ + #task = null; + + /** @type {ReturnType | null} */ + #deferred = null; + + /** + * @param {T} value + * @param {SpringOpts} [options] + */ + constructor(value, options = {}) { + this.#current.v = this.#target.v = value; + + if (typeof options.stiffness === 'number') this.#stiffness.v = clamp(options.stiffness, 0, 1); + if (typeof options.damping === 'number') this.#damping.v = clamp(options.damping, 0, 1); + if (typeof options.precision === 'number') this.#precision.v = options.precision; + } + + /** + * Create a spring whose value is bound to the return value of `fn`. This must be called + * inside an effect root (for example, during component initialisation). + * + * ```svelte + * + * ``` + * @template U + * @param {() => U} fn + * @param {SpringOpts} [options] + */ + static of(fn, options) { + const spring = new Spring(fn(), options); + + render_effect(() => { + spring.set(fn()); + }); + + return spring; + } + + /** @param {T} value */ + #update(value) { + set(this.#target, value); + + this.#current.v ??= value; + this.#last_value ??= this.#current.v; + + if (!this.#task) { + this.#last_time = raf.now(); + + var inv_mass_recovery_rate = 1000 / (this.#momentum * 60); + + this.#task ??= loop((now) => { + this.#inverse_mass = Math.min(this.#inverse_mass + inv_mass_recovery_rate, 1); + + /** @type {import('./private').TickContext} */ + const ctx = { + inv_mass: this.#inverse_mass, + opts: { + stiffness: this.#stiffness.v, + damping: this.#damping.v, + precision: this.#precision.v + }, + settled: true, + dt: ((now - this.#last_time) * 60) / 1000 + }; + + var next = tick_spring(ctx, this.#last_value, this.#current.v, this.#target.v); + this.#last_value = this.#current.v; + this.#last_time = now; + set(this.#current, next); + + if (ctx.settled) { + this.#task = null; + } + + return !ctx.settled; + }); + } + + return this.#task.promise; + } + + /** + * Sets `spring.target` to `value` and returns a `Promise` that resolves if and when `spring.current` catches up to it. + * + * If `options.instant` is `true`, `spring.current` immediately matches `spring.target`. + * + * If `options.preserveMomentum` is provided, the spring will continue on its current trajectory for + * the specified number of milliseconds. This is useful for things like 'fling' gestures. + * + * @param {T} value + * @param {SpringUpdateOpts} [options] + */ + set(value, options) { + this.#deferred?.reject(new Error('Aborted')); + + if (options?.instant || this.#current.v === undefined) { + this.#task?.abort(); + this.#task = null; + set(this.#current, set(this.#target, value)); + this.#last_value = value; + return Promise.resolve(); + } + + if (options?.preserveMomentum) { + this.#inverse_mass = 0; + this.#momentum = options.preserveMomentum; + } + + var d = (this.#deferred = deferred()); + d.promise.catch(noop); + + this.#update(value).then(() => { + if (d !== this.#deferred) return; + d.resolve(undefined); + }); + + return d.promise; + } + + get current() { + return get(this.#current); + } + + get damping() { + return get(this.#damping); + } + + set damping(v) { + set(this.#damping, clamp(v, 0, 1)); + } + + get precision() { + return get(this.#precision); + } + + set precision(v) { + set(this.#precision, v); + } + + get stiffness() { + return get(this.#stiffness); + } + + set stiffness(v) { + set(this.#stiffness, clamp(v, 0, 1)); + } + + get target() { + return get(this.#target); + } + + set target(v) { + this.set(v); + } +} + +/** + * @param {number} n + * @param {number} min + * @param {number} max + */ +function clamp(n, min, max) { + return Math.max(min, Math.min(max, n)); +} diff --git a/node_modules/svelte/src/motion/tweened.js b/node_modules/svelte/src/motion/tweened.js new file mode 100644 index 00000000..d732dbc2 --- /dev/null +++ b/node_modules/svelte/src/motion/tweened.js @@ -0,0 +1,291 @@ +/** @import { Task } from '../internal/client/types' */ +/** @import { Tweened } from './public' */ +/** @import { TweenedOptions } from './private' */ +import { writable } from '../store/shared/index.js'; +import { raf } from '../internal/client/timing.js'; +import { loop } from '../internal/client/loop.js'; +import { linear } from '../easing/index.js'; +import { is_date } from './utils.js'; +import { set, source } from '../internal/client/reactivity/sources.js'; +import { get, render_effect } from 'svelte/internal/client'; + +/** + * @template T + * @param {T} a + * @param {T} b + * @returns {(t: number) => T} + */ +function get_interpolator(a, b) { + if (a === b || a !== a) return () => a; + + const type = typeof a; + if (type !== typeof b || Array.isArray(a) !== Array.isArray(b)) { + throw new Error('Cannot interpolate values of different type'); + } + + if (Array.isArray(a)) { + const arr = /** @type {Array} */ (b).map((bi, i) => { + return get_interpolator(/** @type {Array} */ (a)[i], bi); + }); + + // @ts-ignore + return (t) => arr.map((fn) => fn(t)); + } + + if (type === 'object') { + if (!a || !b) { + throw new Error('Object cannot be null'); + } + + if (is_date(a) && is_date(b)) { + const an = a.getTime(); + const bn = b.getTime(); + const delta = bn - an; + + // @ts-ignore + return (t) => new Date(an + t * delta); + } + + const keys = Object.keys(b); + + /** @type {Record T>} */ + const interpolators = {}; + keys.forEach((key) => { + // @ts-ignore + interpolators[key] = get_interpolator(a[key], b[key]); + }); + + // @ts-ignore + return (t) => { + /** @type {Record} */ + const result = {}; + keys.forEach((key) => { + result[key] = interpolators[key](t); + }); + return result; + }; + } + + if (type === 'number') { + const delta = /** @type {number} */ (b) - /** @type {number} */ (a); + // @ts-ignore + return (t) => a + t * delta; + } + + throw new Error(`Cannot interpolate ${type} values`); +} + +/** + * A tweened store in Svelte is a special type of store that provides smooth transitions between state values over time. + * + * @deprecated Use [`Tween`](https://svelte.dev/docs/svelte/svelte-motion#Tween) instead + * @template T + * @param {T} [value] + * @param {TweenedOptions} [defaults] + * @returns {Tweened} + */ +export function tweened(value, defaults = {}) { + const store = writable(value); + /** @type {Task} */ + let task; + let target_value = value; + /** + * @param {T} new_value + * @param {TweenedOptions} [opts] + */ + function set(new_value, opts) { + target_value = new_value; + + if (value == null) { + store.set((value = new_value)); + return Promise.resolve(); + } + + /** @type {Task | null} */ + let previous_task = task; + + let started = false; + let { + delay = 0, + duration = 400, + easing = linear, + interpolate = get_interpolator + } = { ...defaults, ...opts }; + + if (duration === 0) { + if (previous_task) { + previous_task.abort(); + previous_task = null; + } + store.set((value = target_value)); + return Promise.resolve(); + } + + const start = raf.now() + delay; + + /** @type {(t: number) => T} */ + let fn; + task = loop((now) => { + if (now < start) return true; + if (!started) { + fn = interpolate(/** @type {any} */ (value), new_value); + if (typeof duration === 'function') + duration = duration(/** @type {any} */ (value), new_value); + started = true; + } + if (previous_task) { + previous_task.abort(); + previous_task = null; + } + const elapsed = now - start; + if (elapsed > /** @type {number} */ (duration)) { + store.set((value = new_value)); + return false; + } + // @ts-ignore + store.set((value = fn(easing(elapsed / duration)))); + return true; + }); + return task.promise; + } + return { + set, + update: (fn, opts) => + set(fn(/** @type {any} */ (target_value), /** @type {any} */ (value)), opts), + subscribe: store.subscribe + }; +} + +/** + * A wrapper for a value that tweens smoothly to its target value. Changes to `tween.target` will cause `tween.current` to + * move towards it over time, taking account of the `delay`, `duration` and `easing` options. + * + * ```svelte + * + * + * + * + * ``` + * @template T + * @since 5.8.0 + */ +export class Tween { + #current = source(/** @type {T} */ (undefined)); + #target = source(/** @type {T} */ (undefined)); + + /** @type {TweenedOptions} */ + #defaults; + + /** @type {import('../internal/client/types').Task | null} */ + #task = null; + + /** + * @param {T} value + * @param {TweenedOptions} options + */ + constructor(value, options = {}) { + this.#current.v = this.#target.v = value; + this.#defaults = options; + } + + /** + * Create a tween whose value is bound to the return value of `fn`. This must be called + * inside an effect root (for example, during component initialisation). + * + * ```svelte + * + * ``` + * @template U + * @param {() => U} fn + * @param {TweenedOptions} [options] + */ + static of(fn, options) { + const tween = new Tween(fn(), options); + + render_effect(() => { + tween.set(fn()); + }); + + return tween; + } + + /** + * Sets `tween.target` to `value` and returns a `Promise` that resolves if and when `tween.current` catches up to it. + * + * If `options` are provided, they will override the tween's defaults. + * @param {T} value + * @param {TweenedOptions} [options] + * @returns + */ + set(value, options) { + set(this.#target, value); + + let previous_value = this.#current.v; + let previous_task = this.#task; + + let started = false; + let { + delay = 0, + duration = 400, + easing = linear, + interpolate = get_interpolator + } = { ...this.#defaults, ...options }; + + const start = raf.now() + delay; + + /** @type {(t: number) => T} */ + let fn; + + this.#task = loop((now) => { + if (now < start) { + return true; + } + + if (!started) { + started = true; + + fn = interpolate(/** @type {any} */ (previous_value), value); + + if (typeof duration === 'function') { + duration = duration(/** @type {any} */ (previous_value), value); + } + + previous_task?.abort(); + } + + const elapsed = now - start; + + if (elapsed > /** @type {number} */ (duration)) { + set(this.#current, value); + return false; + } + + set(this.#current, fn(easing(elapsed / /** @type {number} */ (duration)))); + return true; + }); + + return this.#task.promise; + } + + get current() { + return get(this.#current); + } + + get target() { + return get(this.#target); + } + + set target(v) { + this.set(v); + } +} diff --git a/node_modules/svelte/src/motion/utils.js b/node_modules/svelte/src/motion/utils.js new file mode 100644 index 00000000..62342dc7 --- /dev/null +++ b/node_modules/svelte/src/motion/utils.js @@ -0,0 +1,7 @@ +/** + * @param {any} obj + * @returns {obj is Date} + */ +export function is_date(obj) { + return Object.prototype.toString.call(obj) === '[object Date]'; +} diff --git a/node_modules/svelte/src/reactivity/create-subscriber.js b/node_modules/svelte/src/reactivity/create-subscriber.js new file mode 100644 index 00000000..63deca62 --- /dev/null +++ b/node_modules/svelte/src/reactivity/create-subscriber.js @@ -0,0 +1,81 @@ +import { get, tick, untrack } from '../internal/client/runtime.js'; +import { effect_tracking, render_effect } from '../internal/client/reactivity/effects.js'; +import { source } from '../internal/client/reactivity/sources.js'; +import { increment } from './utils.js'; + +/** + * Returns a `subscribe` function that, if called in an effect (including expressions in the template), + * calls its `start` callback with an `update` function. Whenever `update` is called, the effect re-runs. + * + * If `start` returns a function, it will be called when the effect is destroyed. + * + * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects + * are active, and the returned teardown function will only be called when all effects are destroyed. + * + * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery): + * + * ```js + * import { createSubscriber } from 'svelte/reactivity'; + * import { on } from 'svelte/events'; + * + * export class MediaQuery { + * #query; + * #subscribe; + * + * constructor(query) { + * this.#query = window.matchMedia(`(${query})`); + * + * this.#subscribe = createSubscriber((update) => { + * // when the `change` event occurs, re-run any effects that read `this.current` + * const off = on(this.#query, 'change', update); + * + * // stop listening when all the effects are destroyed + * return () => off(); + * }); + * } + * + * get current() { + * this.#subscribe(); + * + * // Return the current state of the query, whether or not we're in an effect + * return this.#query.matches; + * } + * } + * ``` + * @param {(update: () => void) => (() => void) | void} start + * @since 5.7.0 + */ +export function createSubscriber(start) { + let subscribers = 0; + let version = source(0); + /** @type {(() => void) | void} */ + let stop; + + return () => { + if (effect_tracking()) { + get(version); + + render_effect(() => { + if (subscribers === 0) { + stop = untrack(() => start(() => increment(version))); + } + + subscribers += 1; + + return () => { + tick().then(() => { + // Only count down after timeout, else we would reach 0 before our own render effect reruns, + // but reach 1 again when the tick callback of the prior teardown runs. That would mean we + // re-subcribe unnecessarily and create a memory leak because the old subscription is never cleaned up. + subscribers -= 1; + + if (subscribers === 0) { + stop?.(); + stop = undefined; + } + }); + }; + }); + } + }; +} diff --git a/node_modules/svelte/src/reactivity/date.js b/node_modules/svelte/src/reactivity/date.js new file mode 100644 index 00000000..33da2e17 --- /dev/null +++ b/node_modules/svelte/src/reactivity/date.js @@ -0,0 +1,79 @@ +/** @import { Source } from '#client' */ +import { derived } from '../internal/client/index.js'; +import { source, set } from '../internal/client/reactivity/sources.js'; +import { active_reaction, get, set_active_reaction } from '../internal/client/runtime.js'; + +var inited = false; + +export class SvelteDate extends Date { + #time = source(super.getTime()); + + /** @type {Map>} */ + #deriveds = new Map(); + + #reaction = active_reaction; + + /** @param {any[]} params */ + constructor(...params) { + // @ts-ignore + super(...params); + if (!inited) this.#init(); + } + + #init() { + inited = true; + + var proto = SvelteDate.prototype; + var date_proto = Date.prototype; + + var methods = /** @type {Array} */ ( + Object.getOwnPropertyNames(date_proto) + ); + + for (const method of methods) { + if (method.startsWith('get') || method.startsWith('to') || method === 'valueOf') { + // @ts-ignore + proto[method] = function (...args) { + // don't memoize if there are arguments + // @ts-ignore + if (args.length > 0) { + get(this.#time); + // @ts-ignore + return date_proto[method].apply(this, args); + } + + var d = this.#deriveds.get(method); + + if (d === undefined) { + // lazily create the derived, but as though it were being + // created at the same time as the class instance + const reaction = active_reaction; + set_active_reaction(this.#reaction); + + d = derived(() => { + get(this.#time); + // @ts-ignore + return date_proto[method].apply(this, args); + }); + + this.#deriveds.set(method, d); + + set_active_reaction(reaction); + } + + return get(d); + }; + } + + if (method.startsWith('set')) { + // @ts-ignore + proto[method] = function (...args) { + // @ts-ignore + var result = date_proto[method].apply(this, args); + set(this.#time, date_proto.getTime.call(this)); + return result; + }; + } + } + } +} diff --git a/node_modules/svelte/src/reactivity/index-client.js b/node_modules/svelte/src/reactivity/index-client.js new file mode 100644 index 00000000..3eb9b953 --- /dev/null +++ b/node_modules/svelte/src/reactivity/index-client.js @@ -0,0 +1,7 @@ +export { SvelteDate } from './date.js'; +export { SvelteSet } from './set.js'; +export { SvelteMap } from './map.js'; +export { SvelteURL } from './url.js'; +export { SvelteURLSearchParams } from './url-search-params.js'; +export { MediaQuery } from './media-query.js'; +export { createSubscriber } from './create-subscriber.js'; diff --git a/node_modules/svelte/src/reactivity/index-server.js b/node_modules/svelte/src/reactivity/index-server.js new file mode 100644 index 00000000..6a6c9dcf --- /dev/null +++ b/node_modules/svelte/src/reactivity/index-server.js @@ -0,0 +1,23 @@ +export const SvelteDate = globalThis.Date; +export const SvelteSet = globalThis.Set; +export const SvelteMap = globalThis.Map; +export const SvelteURL = globalThis.URL; +export const SvelteURLSearchParams = globalThis.URLSearchParams; + +export class MediaQuery { + current; + /** + * @param {string} query + * @param {boolean} [matches] + */ + constructor(query, matches = false) { + this.current = matches; + } +} + +/** + * @param {any} _ + */ +export function createSubscriber(_) { + return () => {}; +} diff --git a/node_modules/svelte/src/reactivity/map.js b/node_modules/svelte/src/reactivity/map.js new file mode 100644 index 00000000..3fa2945e --- /dev/null +++ b/node_modules/svelte/src/reactivity/map.js @@ -0,0 +1,192 @@ +/** @import { Source } from '#client' */ +import { DEV } from 'esm-env'; +import { set, source } from '../internal/client/reactivity/sources.js'; +import { get } from '../internal/client/runtime.js'; +import { increment } from './utils.js'; + +/** + * @template K + * @template V + * @extends {Map} + */ +export class SvelteMap extends Map { + /** @type {Map>} */ + #sources = new Map(); + #version = source(0); + #size = source(0); + + /** + * @param {Iterable | null | undefined} [value] + */ + constructor(value) { + super(); + + // If the value is invalid then the native exception will fire here + if (DEV) value = new Map(value); + + if (value) { + for (var [key, v] of value) { + super.set(key, v); + } + this.#size.v = super.size; + } + } + + /** @param {K} key */ + has(key) { + var sources = this.#sources; + var s = sources.get(key); + + if (s === undefined) { + var ret = super.get(key); + if (ret !== undefined) { + s = source(0); + sources.set(key, s); + } else { + // We should always track the version in case + // the Set ever gets this value in the future. + get(this.#version); + return false; + } + } + + get(s); + return true; + } + + /** + * @param {(value: V, key: K, map: Map) => void} callbackfn + * @param {any} [this_arg] + */ + forEach(callbackfn, this_arg) { + this.#read_all(); + super.forEach(callbackfn, this_arg); + } + + /** @param {K} key */ + get(key) { + var sources = this.#sources; + var s = sources.get(key); + + if (s === undefined) { + var ret = super.get(key); + if (ret !== undefined) { + s = source(0); + sources.set(key, s); + } else { + // We should always track the version in case + // the Set ever gets this value in the future. + get(this.#version); + return undefined; + } + } + + get(s); + return super.get(key); + } + + /** + * @param {K} key + * @param {V} value + * */ + set(key, value) { + var sources = this.#sources; + var s = sources.get(key); + var prev_res = super.get(key); + var res = super.set(key, value); + var version = this.#version; + + if (s === undefined) { + sources.set(key, source(0)); + set(this.#size, super.size); + increment(version); + } else if (prev_res !== value) { + increment(s); + + // if not every reaction of s is a reaction of version we need to also include version + var v_reactions = version.reactions === null ? null : new Set(version.reactions); + var needs_version_increase = + v_reactions === null || + !s.reactions?.every((r) => + /** @type {NonNullable} */ (v_reactions).has(r) + ); + if (needs_version_increase) { + increment(version); + } + } + + return res; + } + + /** @param {K} key */ + delete(key) { + var sources = this.#sources; + var s = sources.get(key); + var res = super.delete(key); + + if (s !== undefined) { + sources.delete(key); + set(this.#size, super.size); + set(s, -1); + increment(this.#version); + } + + return res; + } + + clear() { + if (super.size === 0) { + return; + } + // Clear first, so we get nice console.log outputs with $inspect + super.clear(); + var sources = this.#sources; + set(this.#size, 0); + for (var s of sources.values()) { + set(s, -1); + } + increment(this.#version); + sources.clear(); + } + + #read_all() { + get(this.#version); + + var sources = this.#sources; + if (this.#size.v !== sources.size) { + for (var key of super.keys()) { + if (!sources.has(key)) { + sources.set(key, source(0)); + } + } + } + + for (var [, s] of this.#sources) { + get(s); + } + } + + keys() { + get(this.#version); + return super.keys(); + } + + values() { + this.#read_all(); + return super.values(); + } + + entries() { + this.#read_all(); + return super.entries(); + } + + [Symbol.iterator]() { + return this.entries(); + } + + get size() { + get(this.#size); + return super.size; + } +} diff --git a/node_modules/svelte/src/reactivity/media-query.js b/node_modules/svelte/src/reactivity/media-query.js new file mode 100644 index 00000000..22310df1 --- /dev/null +++ b/node_modules/svelte/src/reactivity/media-query.js @@ -0,0 +1,37 @@ +import { on } from '../events/index.js'; +import { ReactiveValue } from './reactive-value.js'; + +const parenthesis_regex = /\(.+\)/; + +/** + * Creates a media query and provides a `current` property that reflects whether or not it matches. + * + * Use it carefully — during server-side rendering, there is no way to know what the correct value should be, potentially causing content to change upon hydration. + * If you can use the media query in CSS to achieve the same effect, do that. + * + * ```svelte + * + * + *

    {large.current ? 'large screen' : 'small screen'}

    + * ``` + * @extends {ReactiveValue} + * @since 5.7.0 + */ +export class MediaQuery extends ReactiveValue { + /** + * @param {string} query A media query string + * @param {boolean} [fallback] Fallback value for the server + */ + constructor(query, fallback) { + let final_query = parenthesis_regex.test(query) ? query : `(${query})`; + const q = window.matchMedia(final_query); + super( + () => q.matches, + (update) => on(q, 'change', update) + ); + } +} diff --git a/node_modules/svelte/src/reactivity/reactive-value.js b/node_modules/svelte/src/reactivity/reactive-value.js new file mode 100644 index 00000000..c7c14ad7 --- /dev/null +++ b/node_modules/svelte/src/reactivity/reactive-value.js @@ -0,0 +1,24 @@ +import { createSubscriber } from './create-subscriber.js'; + +/** + * @template T + */ +export class ReactiveValue { + #fn; + #subscribe; + + /** + * + * @param {() => T} fn + * @param {(update: () => void) => void} onsubscribe + */ + constructor(fn, onsubscribe) { + this.#fn = fn; + this.#subscribe = createSubscriber(onsubscribe); + } + + get current() { + this.#subscribe(); + return this.#fn(); + } +} diff --git a/node_modules/svelte/src/reactivity/set.js b/node_modules/svelte/src/reactivity/set.js new file mode 100644 index 00000000..be0c2d2c --- /dev/null +++ b/node_modules/svelte/src/reactivity/set.js @@ -0,0 +1,158 @@ +/** @import { Source } from '#client' */ +import { DEV } from 'esm-env'; +import { source, set } from '../internal/client/reactivity/sources.js'; +import { get } from '../internal/client/runtime.js'; +import { increment } from './utils.js'; + +var read_methods = ['forEach', 'isDisjointFrom', 'isSubsetOf', 'isSupersetOf']; +var set_like_methods = ['difference', 'intersection', 'symmetricDifference', 'union']; + +var inited = false; + +/** + * @template T + * @extends {Set} + */ +export class SvelteSet extends Set { + /** @type {Map>} */ + #sources = new Map(); + #version = source(0); + #size = source(0); + + /** + * @param {Iterable | null | undefined} [value] + */ + constructor(value) { + super(); + + // If the value is invalid then the native exception will fire here + if (DEV) value = new Set(value); + + if (value) { + for (var element of value) { + super.add(element); + } + this.#size.v = super.size; + } + + if (!inited) this.#init(); + } + + // We init as part of the first instance so that we can treeshake this class + #init() { + inited = true; + + var proto = SvelteSet.prototype; + var set_proto = Set.prototype; + + for (const method of read_methods) { + // @ts-ignore + proto[method] = function (...v) { + get(this.#version); + // @ts-ignore + return set_proto[method].apply(this, v); + }; + } + + for (const method of set_like_methods) { + // @ts-ignore + proto[method] = function (...v) { + get(this.#version); + // @ts-ignore + var set = /** @type {Set} */ (set_proto[method].apply(this, v)); + return new SvelteSet(set); + }; + } + } + + /** @param {T} value */ + has(value) { + var has = super.has(value); + var sources = this.#sources; + var s = sources.get(value); + + if (s === undefined) { + if (!has) { + // If the value doesn't exist, track the version in case it's added later + // but don't create sources willy-nilly to track all possible values + get(this.#version); + return false; + } + + s = source(true); + sources.set(value, s); + } + + get(s); + return has; + } + + /** @param {T} value */ + add(value) { + if (!super.has(value)) { + super.add(value); + set(this.#size, super.size); + increment(this.#version); + } + + return this; + } + + /** @param {T} value */ + delete(value) { + var deleted = super.delete(value); + var sources = this.#sources; + var s = sources.get(value); + + if (s !== undefined) { + sources.delete(value); + set(s, false); + } + + if (deleted) { + set(this.#size, super.size); + increment(this.#version); + } + + return deleted; + } + + clear() { + if (super.size === 0) { + return; + } + // Clear first, so we get nice console.log outputs with $inspect + super.clear(); + var sources = this.#sources; + + for (var s of sources.values()) { + set(s, false); + } + + sources.clear(); + set(this.#size, 0); + increment(this.#version); + } + + keys() { + return this.values(); + } + + values() { + get(this.#version); + return super.values(); + } + + entries() { + get(this.#version); + return super.entries(); + } + + [Symbol.iterator]() { + return this.keys(); + } + + get size() { + return get(this.#size); + } +} diff --git a/node_modules/svelte/src/reactivity/url-search-params.js b/node_modules/svelte/src/reactivity/url-search-params.js new file mode 100644 index 00000000..13f69719 --- /dev/null +++ b/node_modules/svelte/src/reactivity/url-search-params.js @@ -0,0 +1,146 @@ +import { source } from '../internal/client/reactivity/sources.js'; +import { get } from '../internal/client/runtime.js'; +import { get_current_url } from './url.js'; +import { increment } from './utils.js'; + +export const REPLACE = Symbol(); + +export class SvelteURLSearchParams extends URLSearchParams { + #version = source(0); + #url = get_current_url(); + + #updating = false; + + #update_url() { + if (!this.#url || this.#updating) return; + this.#updating = true; + + const search = this.toString(); + this.#url.search = search && `?${search}`; + + this.#updating = false; + } + + /** + * @param {URLSearchParams} params + */ + [REPLACE](params) { + if (this.#updating) return; + this.#updating = true; + + for (const key of [...super.keys()]) { + super.delete(key); + } + + for (const [key, value] of params) { + super.append(key, value); + } + + increment(this.#version); + this.#updating = false; + } + + /** + * @param {string} name + * @param {string} value + * @returns {void} + */ + append(name, value) { + super.append(name, value); + this.#update_url(); + increment(this.#version); + } + + /** + * @param {string} name + * @param {string=} value + * @returns {void} + */ + delete(name, value) { + var has_value = super.has(name, value); + super.delete(name, value); + if (has_value) { + this.#update_url(); + increment(this.#version); + } + } + + /** + * @param {string} name + * @returns {string|null} + */ + get(name) { + get(this.#version); + return super.get(name); + } + + /** + * @param {string} name + * @returns {string[]} + */ + getAll(name) { + get(this.#version); + return super.getAll(name); + } + + /** + * @param {string} name + * @param {string=} value + * @returns {boolean} + */ + has(name, value) { + get(this.#version); + return super.has(name, value); + } + + keys() { + get(this.#version); + return super.keys(); + } + + /** + * @param {string} name + * @param {string} value + * @returns {void} + */ + set(name, value) { + var previous = super.getAll(name).join(''); + super.set(name, value); + // can't use has(name, value), because for something like https://svelte.dev?foo=1&bar=2&foo=3 + // if you set `foo` to 1, then foo=3 gets deleted whilst `has("foo", "1")` returns true + if (previous !== super.getAll(name).join('')) { + this.#update_url(); + increment(this.#version); + } + } + + sort() { + super.sort(); + this.#update_url(); + increment(this.#version); + } + + toString() { + get(this.#version); + return super.toString(); + } + + values() { + get(this.#version); + return super.values(); + } + + entries() { + get(this.#version); + return super.entries(); + } + + [Symbol.iterator]() { + return this.entries(); + } + + get size() { + get(this.#version); + return super.size; + } +} diff --git a/node_modules/svelte/src/reactivity/url.js b/node_modules/svelte/src/reactivity/url.js new file mode 100644 index 00000000..5d003be0 --- /dev/null +++ b/node_modules/svelte/src/reactivity/url.js @@ -0,0 +1,165 @@ +import { source, set } from '../internal/client/reactivity/sources.js'; +import { get } from '../internal/client/runtime.js'; +import { REPLACE, SvelteURLSearchParams } from './url-search-params.js'; + +/** @type {SvelteURL | null} */ +let current_url = null; + +export function get_current_url() { + // ideally we'd just export `current_url` directly, but it seems Vitest doesn't respect live bindings + return current_url; +} + +export class SvelteURL extends URL { + #protocol = source(super.protocol); + #username = source(super.username); + #password = source(super.password); + #hostname = source(super.hostname); + #port = source(super.port); + #pathname = source(super.pathname); + #hash = source(super.hash); + #search = source(super.search); + #searchParams; + + /** + * @param {string | URL} url + * @param {string | URL} [base] + */ + constructor(url, base) { + url = new URL(url, base); + super(url); + + current_url = this; + this.#searchParams = new SvelteURLSearchParams(url.searchParams); + current_url = null; + } + + get hash() { + return get(this.#hash); + } + + set hash(value) { + super.hash = value; + set(this.#hash, super.hash); + } + + get host() { + get(this.#hostname); + get(this.#port); + return super.host; + } + + set host(value) { + super.host = value; + set(this.#hostname, super.hostname); + set(this.#port, super.port); + } + + get hostname() { + return get(this.#hostname); + } + + set hostname(value) { + super.hostname = value; + set(this.#hostname, super.hostname); + } + + get href() { + get(this.#protocol); + get(this.#username); + get(this.#password); + get(this.#hostname); + get(this.#port); + get(this.#pathname); + get(this.#hash); + get(this.#search); + return super.href; + } + + set href(value) { + super.href = value; + set(this.#protocol, super.protocol); + set(this.#username, super.username); + set(this.#password, super.password); + set(this.#hostname, super.hostname); + set(this.#port, super.port); + set(this.#pathname, super.pathname); + set(this.#hash, super.hash); + set(this.#search, super.search); + this.#searchParams[REPLACE](super.searchParams); + } + + get password() { + return get(this.#password); + } + + set password(value) { + super.password = value; + set(this.#password, super.password); + } + + get pathname() { + return get(this.#pathname); + } + + set pathname(value) { + super.pathname = value; + set(this.#pathname, super.pathname); + } + + get port() { + return get(this.#port); + } + + set port(value) { + super.port = value; + set(this.#port, super.port); + } + + get protocol() { + return get(this.#protocol); + } + + set protocol(value) { + super.protocol = value; + set(this.#protocol, super.protocol); + } + + get search() { + return get(this.#search); + } + + set search(value) { + super.search = value; + set(this.#search, value); + this.#searchParams[REPLACE](super.searchParams); + } + + get username() { + return get(this.#username); + } + + set username(value) { + super.username = value; + set(this.#username, super.username); + } + + get origin() { + get(this.#protocol); + get(this.#hostname); + get(this.#port); + return super.origin; + } + + get searchParams() { + return this.#searchParams; + } + + toString() { + return this.href; + } + + toJSON() { + return this.href; + } +} diff --git a/node_modules/svelte/src/reactivity/utils.js b/node_modules/svelte/src/reactivity/utils.js new file mode 100644 index 00000000..cd55e0e0 --- /dev/null +++ b/node_modules/svelte/src/reactivity/utils.js @@ -0,0 +1,7 @@ +/** @import { Source } from '#client' */ +import { set } from '../internal/client/reactivity/sources.js'; + +/** @param {Source} source */ +export function increment(source) { + set(source, source.v + 1); +} diff --git a/node_modules/svelte/src/reactivity/window/index.js b/node_modules/svelte/src/reactivity/window/index.js new file mode 100644 index 00000000..8c50a5c4 --- /dev/null +++ b/node_modules/svelte/src/reactivity/window/index.js @@ -0,0 +1,156 @@ +import { BROWSER } from 'esm-env'; +import { on } from '../../events/index.js'; +import { ReactiveValue } from '../reactive-value.js'; +import { get } from '../../internal/client/index.js'; +import { set, source } from '../../internal/client/reactivity/sources.js'; + +/** + * `scrollX.current` is a reactive view of `window.scrollX`. On the server it is `undefined`. + * @since 5.11.0 + */ +export const scrollX = new ReactiveValue( + BROWSER ? () => window.scrollX : () => undefined, + (update) => on(window, 'scroll', update) +); + +/** + * `scrollY.current` is a reactive view of `window.scrollY`. On the server it is `undefined`. + * @since 5.11.0 + */ +export const scrollY = new ReactiveValue( + BROWSER ? () => window.scrollY : () => undefined, + (update) => on(window, 'scroll', update) +); + +/** + * `innerWidth.current` is a reactive view of `window.innerWidth`. On the server it is `undefined`. + * @since 5.11.0 + */ +export const innerWidth = new ReactiveValue( + BROWSER ? () => window.innerWidth : () => undefined, + (update) => on(window, 'resize', update) +); + +/** + * `innerHeight.current` is a reactive view of `window.innerHeight`. On the server it is `undefined`. + * @since 5.11.0 + */ +export const innerHeight = new ReactiveValue( + BROWSER ? () => window.innerHeight : () => undefined, + (update) => on(window, 'resize', update) +); + +/** + * `outerWidth.current` is a reactive view of `window.outerWidth`. On the server it is `undefined`. + * @since 5.11.0 + */ +export const outerWidth = new ReactiveValue( + BROWSER ? () => window.outerWidth : () => undefined, + (update) => on(window, 'resize', update) +); + +/** + * `outerHeight.current` is a reactive view of `window.outerHeight`. On the server it is `undefined`. + * @since 5.11.0 + */ +export const outerHeight = new ReactiveValue( + BROWSER ? () => window.outerHeight : () => undefined, + (update) => on(window, 'resize', update) +); + +/** + * `screenLeft.current` is a reactive view of `window.screenLeft`. It is updated inside a `requestAnimationFrame` callback. On the server it is `undefined`. + * @since 5.11.0 + */ +export const screenLeft = new ReactiveValue( + BROWSER ? () => window.screenLeft : () => undefined, + (update) => { + let value = window.screenLeft; + + let frame = requestAnimationFrame(function check() { + frame = requestAnimationFrame(check); + + if (value !== (value = window.screenLeft)) { + update(); + } + }); + + return () => { + cancelAnimationFrame(frame); + }; + } +); + +/** + * `screenTop.current` is a reactive view of `window.screenTop`. It is updated inside a `requestAnimationFrame` callback. On the server it is `undefined`. + * @since 5.11.0 + */ +export const screenTop = new ReactiveValue( + BROWSER ? () => window.screenTop : () => undefined, + (update) => { + let value = window.screenTop; + + let frame = requestAnimationFrame(function check() { + frame = requestAnimationFrame(check); + + if (value !== (value = window.screenTop)) { + update(); + } + }); + + return () => { + cancelAnimationFrame(frame); + }; + } +); + +/** + * `online.current` is a reactive view of `navigator.onLine`. On the server it is `undefined`. + * @since 5.11.0 + */ +export const online = new ReactiveValue( + BROWSER ? () => navigator.onLine : () => undefined, + (update) => { + const unsub_online = on(window, 'online', update); + const unsub_offline = on(window, 'offline', update); + return () => { + unsub_online(); + unsub_offline(); + }; + } +); + +/** + * `devicePixelRatio.current` is a reactive view of `window.devicePixelRatio`. On the server it is `undefined`. + * Note that behaviour differs between browsers — on Chrome it will respond to the current zoom level, + * on Firefox and Safari it won't. + * @type {{ get current(): number | undefined }} + * @since 5.11.0 + */ +export const devicePixelRatio = /* @__PURE__ */ new (class DevicePixelRatio { + #dpr = source(BROWSER ? window.devicePixelRatio : undefined); + + #update() { + const off = on( + window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`), + 'change', + () => { + set(this.#dpr, window.devicePixelRatio); + + off(); + this.#update(); + } + ); + } + + constructor() { + if (BROWSER) { + this.#update(); + } + } + + get current() { + get(this.#dpr); + return BROWSER ? window.devicePixelRatio : undefined; + } +})(); diff --git a/node_modules/svelte/src/server/index.d.ts b/node_modules/svelte/src/server/index.d.ts new file mode 100644 index 00000000..b65ce5bd --- /dev/null +++ b/node_modules/svelte/src/server/index.d.ts @@ -0,0 +1,21 @@ +import type { RenderOutput } from '#server'; +import type { ComponentProps, Component, SvelteComponent, ComponentType } from 'svelte'; + +/** + * Only available on the server and when compiling with the `server` option. + * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app. + */ +export function render< + Comp extends SvelteComponent | Component, + Props extends ComponentProps = ComponentProps +>( + ...args: {} extends Props + ? [ + component: Comp extends SvelteComponent ? ComponentType : Comp, + options?: { props?: Omit; context?: Map } + ] + : [ + component: Comp extends SvelteComponent ? ComponentType : Comp, + options: { props: Omit; context?: Map } + ] +): RenderOutput; diff --git a/node_modules/svelte/src/server/index.js b/node_modules/svelte/src/server/index.js new file mode 100644 index 00000000..c02e9d05 --- /dev/null +++ b/node_modules/svelte/src/server/index.js @@ -0,0 +1 @@ +export { render } from '../internal/server/index.js'; diff --git a/node_modules/svelte/src/store/index-client.js b/node_modules/svelte/src/store/index-client.js new file mode 100644 index 00000000..ae6806ec --- /dev/null +++ b/node_modules/svelte/src/store/index-client.js @@ -0,0 +1,148 @@ +/** @import { Readable, Writable } from './public.js' */ +import { + effect_root, + effect_tracking, + render_effect +} from '../internal/client/reactivity/effects.js'; +import { get, writable } from './shared/index.js'; +import { createSubscriber } from '../reactivity/create-subscriber.js'; + +export { derived, get, readable, readonly, writable } from './shared/index.js'; + +/** + * @template V + * @overload + * @param {() => V} get + * @param {(v: V) => void} set + * @returns {Writable} + */ +/** + * @template V + * @overload + * @param {() => V} get + * @returns {Readable} + */ +/** + * Create a store from a function that returns state, and (to make a writable store), an + * optional second function that sets state. + * + * ```ts + * import { toStore } from 'svelte/store'; + * + * let count = $state(0); + * + * const store = toStore(() => count, (v) => (count = v)); + * ``` + * @template V + * @param {() => V} get + * @param {(v: V) => void} [set] + * @returns {Writable | Readable} + */ +export function toStore(get, set) { + let init_value = get(); + const store = writable(init_value, (set) => { + // If the value has changed before we call subscribe, then + // we need to treat the value as already having run + let ran = init_value !== get(); + + // TODO do we need a different implementation on the server? + const teardown = effect_root(() => { + render_effect(() => { + const value = get(); + if (ran) set(value); + }); + }); + + ran = true; + + return teardown; + }); + + if (set) { + return { + set, + update: (fn) => set(fn(get())), + subscribe: store.subscribe + }; + } + + return { + subscribe: store.subscribe + }; +} + +/** + * @template V + * @overload + * @param {Writable} store + * @returns {{ current: V }} + */ +/** + * @template V + * @overload + * @param {Readable} store + * @returns {{ readonly current: V }} + */ +/** + * Convert a store to an object with a reactive `current` property. If `store` + * is a readable store, `current` will be a readonly property. + * + * ```ts + * import { fromStore, get, writable } from 'svelte/store'; + * + * const store = writable(0); + * + * const count = fromStore(store); + * + * count.current; // 0; + * store.set(1); + * count.current; // 1 + * + * count.current += 1; + * get(store); // 2 + * ``` + * @template V + * @param {Writable | Readable} store + */ +export function fromStore(store) { + let value = /** @type {V} */ (undefined); + + const subscribe = createSubscriber((update) => { + let ran = false; + + const unsubscribe = store.subscribe((v) => { + value = v; + if (ran) update(); + }); + + ran = true; + + return unsubscribe; + }); + + function current() { + if (effect_tracking()) { + subscribe(); + return value; + } + + return get(store); + } + + if ('set' in store) { + return { + get current() { + return current(); + }, + set current(v) { + store.set(v); + } + }; + } + + return { + get current() { + return current(); + } + }; +} diff --git a/node_modules/svelte/src/store/index-server.js b/node_modules/svelte/src/store/index-server.js new file mode 100644 index 00000000..3eddd781 --- /dev/null +++ b/node_modules/svelte/src/store/index-server.js @@ -0,0 +1,101 @@ +/** @import { Readable, Writable } from './public.js' */ +import { get, writable } from './shared/index.js'; + +export { derived, get, readable, readonly, writable } from './shared/index.js'; + +/** + * @template V + * @overload + * @param {() => V} get + * @param {(v: V) => void} set + * @returns {Writable} + */ +/** + * @template V + * @overload + * @param {() => V} get + * @returns {Readable} + */ +/** + * Create a store from a function that returns state, and (to make a writable store), an + * optional second function that sets state. + * + * ```ts + * import { toStore } from 'svelte/store'; + * + * let count = $state(0); + * + * const store = toStore(() => count, (v) => (count = v)); + * ``` + * @template V + * @param {() => V} get + * @param {(v: V) => void} [set] + * @returns {Writable | Readable} + */ +export function toStore(get, set) { + const store = writable(get()); + + if (set) { + return { + set, + update: (fn) => set(fn(get())), + subscribe: store.subscribe + }; + } + + return { + subscribe: store.subscribe + }; +} + +/** + * @template V + * @overload + * @param {Writable} store + * @returns {{ current: V }} + */ +/** + * @template V + * @overload + * @param {Readable} store + * @returns {{ readonly current: V }} + */ +/** + * Convert a store to an object with a reactive `current` property. If `store` + * is a readable store, `current` will be a readonly property. + * + * ```ts + * import { fromStore, get, writable } from 'svelte/store'; + * + * const store = writable(0); + * + * const count = fromStore(store); + * + * count.current; // 0; + * store.set(1); + * count.current; // 1 + * + * count.current += 1; + * get(store); // 2 + * ``` + * @template V + * @param {Writable | Readable} store + */ +export function fromStore(store) { + if ('set' in store) { + return { + get current() { + return get(store); + }, + set current(v) { + store.set(v); + } + }; + } + + return { + get current() { + return get(store); + } + }; +} diff --git a/node_modules/svelte/src/store/private.d.ts b/node_modules/svelte/src/store/private.d.ts new file mode 100644 index 00000000..5b41c8bd --- /dev/null +++ b/node_modules/svelte/src/store/private.d.ts @@ -0,0 +1,13 @@ +import { Readable, Subscriber } from './public.js'; + +/** Pair of subscriber and invalidator. */ +type SubscribeInvalidateTuple = [Subscriber, () => void]; + +/** One or more `Readable`s. */ +type Stores = Readable | [Readable, ...Array>] | Array>; + +/** One or more values from `Readable` stores. */ +type StoresValues = + T extends Readable ? U : { [K in keyof T]: T[K] extends Readable ? U : never }; + +export { SubscribeInvalidateTuple, Stores, StoresValues }; diff --git a/node_modules/svelte/src/store/public.d.ts b/node_modules/svelte/src/store/public.d.ts new file mode 100644 index 00000000..7af4c6b6 --- /dev/null +++ b/node_modules/svelte/src/store/public.d.ts @@ -0,0 +1,49 @@ +/** Callback to inform of a value updates. */ +export type Subscriber = (value: T) => void; + +/** Unsubscribes from value updates. */ +export type Unsubscriber = () => void; + +/** Callback to update a value. */ +export type Updater = (value: T) => T; + +/** + * Start and stop notification callbacks. + * This function is called when the first subscriber subscribes. + * + * @param {(value: T) => void} set Function that sets the value of the store. + * @param {(value: Updater) => void} update Function that sets the value of the store after passing the current value to the update function. + * @returns {void | (() => void)} Optionally, a cleanup function that is called when the last remaining + * subscriber unsubscribes. + */ +export type StartStopNotifier = ( + set: (value: T) => void, + update: (fn: Updater) => void +) => void | (() => void); + +/** Readable interface for subscribing. */ +export interface Readable { + /** + * Subscribe on value changes. + * @param run subscription callback + * @param invalidate cleanup callback + */ + subscribe(this: void, run: Subscriber, invalidate?: () => void): Unsubscriber; +} + +/** Writable interface for both updating and subscribing. */ +export interface Writable extends Readable { + /** + * Set value and inform subscribers. + * @param value to set + */ + set(this: void, value: T): void; + + /** + * Update value using callback and inform subscribers. + * @param updater callback + */ + update(this: void, updater: Updater): void; +} + +export * from './index-client.js'; diff --git a/node_modules/svelte/src/store/shared/index.js b/node_modules/svelte/src/store/shared/index.js new file mode 100644 index 00000000..2b923609 --- /dev/null +++ b/node_modules/svelte/src/store/shared/index.js @@ -0,0 +1,209 @@ +/** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from '../public.js' */ +/** @import { Stores, StoresValues, SubscribeInvalidateTuple } from '../private.js' */ +import { noop, run_all } from '../../internal/shared/utils.js'; +import { safe_not_equal } from '../../internal/client/reactivity/equality.js'; +import { subscribe_to_store } from '../utils.js'; + +/** + * @type {Array | any>} + */ +const subscriber_queue = []; + +/** + * Creates a `Readable` store that allows reading by subscription. + * + * @template T + * @param {T} [value] initial value + * @param {StartStopNotifier} [start] + * @returns {Readable} + */ +export function readable(value, start) { + return { + subscribe: writable(value, start).subscribe + }; +} + +/** + * Create a `Writable` store that allows both updating and reading by subscription. + * + * @template T + * @param {T} [value] initial value + * @param {StartStopNotifier} [start] + * @returns {Writable} + */ +export function writable(value, start = noop) { + /** @type {Unsubscriber | null} */ + let stop = null; + + /** @type {Set>} */ + const subscribers = new Set(); + + /** + * @param {T} new_value + * @returns {void} + */ + function set(new_value) { + if (safe_not_equal(value, new_value)) { + value = new_value; + if (stop) { + // store is ready + const run_queue = !subscriber_queue.length; + for (const subscriber of subscribers) { + subscriber[1](); + subscriber_queue.push(subscriber, value); + } + if (run_queue) { + for (let i = 0; i < subscriber_queue.length; i += 2) { + subscriber_queue[i][0](subscriber_queue[i + 1]); + } + subscriber_queue.length = 0; + } + } + } + } + + /** + * @param {Updater} fn + * @returns {void} + */ + function update(fn) { + set(fn(/** @type {T} */ (value))); + } + + /** + * @param {Subscriber} run + * @param {() => void} [invalidate] + * @returns {Unsubscriber} + */ + function subscribe(run, invalidate = noop) { + /** @type {SubscribeInvalidateTuple} */ + const subscriber = [run, invalidate]; + subscribers.add(subscriber); + if (subscribers.size === 1) { + stop = start(set, update) || noop; + } + run(/** @type {T} */ (value)); + return () => { + subscribers.delete(subscriber); + if (subscribers.size === 0 && stop) { + stop(); + stop = null; + } + }; + } + return { set, update, subscribe }; +} + +/** + * Derived value store by synchronizing one or more readable stores and + * applying an aggregation function over its input values. + * + * @template {Stores} S + * @template T + * @overload + * @param {S} stores + * @param {(values: StoresValues, set: (value: T) => void, update: (fn: Updater) => void) => Unsubscriber | void} fn + * @param {T} [initial_value] + * @returns {Readable} + */ +/** + * Derived value store by synchronizing one or more readable stores and + * applying an aggregation function over its input values. + * + * @template {Stores} S + * @template T + * @overload + * @param {S} stores + * @param {(values: StoresValues) => T} fn + * @param {T} [initial_value] + * @returns {Readable} + */ +/** + * @template {Stores} S + * @template T + * @param {S} stores + * @param {Function} fn + * @param {T} [initial_value] + * @returns {Readable} + */ +export function derived(stores, fn, initial_value) { + const single = !Array.isArray(stores); + /** @type {Array>} */ + const stores_array = single ? [stores] : stores; + if (!stores_array.every(Boolean)) { + throw new Error('derived() expects stores as input, got a falsy value'); + } + const auto = fn.length < 2; + return readable(initial_value, (set, update) => { + let started = false; + /** @type {T[]} */ + const values = []; + let pending = 0; + let cleanup = noop; + const sync = () => { + if (pending) { + return; + } + cleanup(); + const result = fn(single ? values[0] : values, set, update); + if (auto) { + set(result); + } else { + cleanup = typeof result === 'function' ? result : noop; + } + }; + const unsubscribers = stores_array.map((store, i) => + subscribe_to_store( + store, + (value) => { + values[i] = value; + pending &= ~(1 << i); + if (started) { + sync(); + } + }, + () => { + pending |= 1 << i; + } + ) + ); + started = true; + sync(); + return function stop() { + run_all(unsubscribers); + cleanup(); + // We need to set this to false because callbacks can still happen despite having unsubscribed: + // Callbacks might already be placed in the queue which doesn't know it should no longer + // invoke this derived store. + started = false; + }; + }); +} + +/** + * Takes a store and returns a new one derived from the old one that is readable. + * + * @template T + * @param {Readable} store - store to make readonly + * @returns {Readable} + */ +export function readonly(store) { + return { + // @ts-expect-error TODO i suspect the bind is unnecessary + subscribe: store.subscribe.bind(store) + }; +} + +/** + * Get the current value from a store by subscribing and immediately unsubscribing. + * + * @template T + * @param {Readable} store + * @returns {T} + */ +export function get(store) { + let value; + subscribe_to_store(store, (_) => (value = _))(); + // @ts-expect-error + return value; +} diff --git a/node_modules/svelte/src/store/utils.js b/node_modules/svelte/src/store/utils.js new file mode 100644 index 00000000..db2a62c6 --- /dev/null +++ b/node_modules/svelte/src/store/utils.js @@ -0,0 +1,36 @@ +/** @import { Readable } from './public' */ +import { untrack } from '../index-client.js'; +import { noop } from '../internal/shared/utils.js'; + +/** + * @template T + * @param {Readable | null | undefined} store + * @param {(value: T) => void} run + * @param {(value: T) => void} [invalidate] + * @returns {() => void} + */ +export function subscribe_to_store(store, run, invalidate) { + if (store == null) { + // @ts-expect-error + run(undefined); + + // @ts-expect-error + if (invalidate) invalidate(undefined); + + return noop; + } + + // Svelte store takes a private second argument + // StartStopNotifier could mutate state, and we want to silence the corresponding validation error + const unsub = untrack(() => + store.subscribe( + run, + // @ts-expect-error + invalidate + ) + ); + + // Also support RxJS + // @ts-expect-error TODO fix this in the types? + return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; +} diff --git a/node_modules/svelte/src/transition/index.js b/node_modules/svelte/src/transition/index.js new file mode 100644 index 00000000..41231062 --- /dev/null +++ b/node_modules/svelte/src/transition/index.js @@ -0,0 +1,286 @@ +/** @import { BlurParams, CrossfadeParams, DrawParams, FadeParams, FlyParams, ScaleParams, SlideParams, TransitionConfig } from './public' */ +/** @param {number} x */ +const linear = (x) => x; + +/** @param {number} t */ +function cubic_out(t) { + const f = t - 1.0; + return f * f * f + 1.0; +} + +/** + * @param {number} t + * @returns {number} + */ +function cubic_in_out(t) { + return t < 0.5 ? 4.0 * t * t * t : 0.5 * Math.pow(2.0 * t - 2.0, 3.0) + 1.0; +} + +/** @param {number | string} value + * @returns {[number, string]} + */ +function split_css_unit(value) { + const split = typeof value === 'string' && value.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); + return split ? [parseFloat(split[1]), split[2] || 'px'] : [/** @type {number} */ (value), 'px']; +} + +/** + * Animates a `blur` filter alongside an element's opacity. + * + * @param {Element} node + * @param {BlurParams} [params] + * @returns {TransitionConfig} + */ +export function blur( + node, + { delay = 0, duration = 400, easing = cubic_in_out, amount = 5, opacity = 0 } = {} +) { + const style = getComputedStyle(node); + const target_opacity = +style.opacity; + const f = style.filter === 'none' ? '' : style.filter; + const od = target_opacity * (1 - opacity); + const [value, unit] = split_css_unit(amount); + return { + delay, + duration, + easing, + css: (_t, u) => `opacity: ${target_opacity - od * u}; filter: ${f} blur(${u * value}${unit});` + }; +} + +/** + * Animates the opacity of an element from 0 to the current opacity for `in` transitions and from the current opacity to 0 for `out` transitions. + * + * @param {Element} node + * @param {FadeParams} [params] + * @returns {TransitionConfig} + */ +export function fade(node, { delay = 0, duration = 400, easing = linear } = {}) { + const o = +getComputedStyle(node).opacity; + return { + delay, + duration, + easing, + css: (t) => `opacity: ${t * o}` + }; +} + +/** + * Animates the x and y positions and the opacity of an element. `in` transitions animate from the provided values, passed as parameters to the element's default values. `out` transitions animate from the element's default values to the provided values. + * + * @param {Element} node + * @param {FlyParams} [params] + * @returns {TransitionConfig} + */ +export function fly( + node, + { delay = 0, duration = 400, easing = cubic_out, x = 0, y = 0, opacity = 0 } = {} +) { + const style = getComputedStyle(node); + const target_opacity = +style.opacity; + const transform = style.transform === 'none' ? '' : style.transform; + const od = target_opacity * (1 - opacity); + const [x_value, x_unit] = split_css_unit(x); + const [y_value, y_unit] = split_css_unit(y); + return { + delay, + duration, + easing, + css: (t, u) => ` + transform: ${transform} translate(${(1 - t) * x_value}${x_unit}, ${(1 - t) * y_value}${y_unit}); + opacity: ${target_opacity - od * u}` + }; +} + +/** + * Slides an element in and out. + * + * @param {Element} node + * @param {SlideParams} [params] + * @returns {TransitionConfig} + */ +export function slide(node, { delay = 0, duration = 400, easing = cubic_out, axis = 'y' } = {}) { + const style = getComputedStyle(node); + const opacity = +style.opacity; + const primary_property = axis === 'y' ? 'height' : 'width'; + const primary_property_value = parseFloat(style[primary_property]); + const secondary_properties = axis === 'y' ? ['top', 'bottom'] : ['left', 'right']; + const capitalized_secondary_properties = secondary_properties.map( + (e) => /** @type {'Left' | 'Right' | 'Top' | 'Bottom'} */ (`${e[0].toUpperCase()}${e.slice(1)}`) + ); + const padding_start_value = parseFloat(style[`padding${capitalized_secondary_properties[0]}`]); + const padding_end_value = parseFloat(style[`padding${capitalized_secondary_properties[1]}`]); + const margin_start_value = parseFloat(style[`margin${capitalized_secondary_properties[0]}`]); + const margin_end_value = parseFloat(style[`margin${capitalized_secondary_properties[1]}`]); + const border_width_start_value = parseFloat( + style[`border${capitalized_secondary_properties[0]}Width`] + ); + const border_width_end_value = parseFloat( + style[`border${capitalized_secondary_properties[1]}Width`] + ); + return { + delay, + duration, + easing, + css: (t) => + 'overflow: hidden;' + + `opacity: ${Math.min(t * 20, 1) * opacity};` + + `${primary_property}: ${t * primary_property_value}px;` + + `padding-${secondary_properties[0]}: ${t * padding_start_value}px;` + + `padding-${secondary_properties[1]}: ${t * padding_end_value}px;` + + `margin-${secondary_properties[0]}: ${t * margin_start_value}px;` + + `margin-${secondary_properties[1]}: ${t * margin_end_value}px;` + + `border-${secondary_properties[0]}-width: ${t * border_width_start_value}px;` + + `border-${secondary_properties[1]}-width: ${t * border_width_end_value}px;` + }; +} + +/** + * Animates the opacity and scale of an element. `in` transitions animate from the provided values, passed as parameters, to an element's current (default) values. `out` transitions animate from an element's default values to the provided values. + * + * @param {Element} node + * @param {ScaleParams} [params] + * @returns {TransitionConfig} + */ +export function scale( + node, + { delay = 0, duration = 400, easing = cubic_out, start = 0, opacity = 0 } = {} +) { + const style = getComputedStyle(node); + const target_opacity = +style.opacity; + const transform = style.transform === 'none' ? '' : style.transform; + const sd = 1 - start; + const od = target_opacity * (1 - opacity); + return { + delay, + duration, + easing, + css: (_t, u) => ` + transform: ${transform} scale(${1 - sd * u}); + opacity: ${target_opacity - od * u} + ` + }; +} + +/** + * Animates the stroke of an SVG element, like a snake in a tube. `in` transitions begin with the path invisible and draw the path to the screen over time. `out` transitions start in a visible state and gradually erase the path. `draw` only works with elements that have a `getTotalLength` method, like `` and ``. + * + * @param {SVGElement & { getTotalLength(): number }} node + * @param {DrawParams} [params] + * @returns {TransitionConfig} + */ +export function draw(node, { delay = 0, speed, duration, easing = cubic_in_out } = {}) { + let len = node.getTotalLength(); + const style = getComputedStyle(node); + if (style.strokeLinecap !== 'butt') { + len += parseInt(style.strokeWidth); + } + if (duration === undefined) { + if (speed === undefined) { + duration = 800; + } else { + duration = len / speed; + } + } else if (typeof duration === 'function') { + duration = duration(len); + } + return { + delay, + duration, + easing, + css: (_, u) => ` + stroke-dasharray: ${len}; + stroke-dashoffset: ${u * len}; + ` + }; +} + +/** + * @template T + * @template S + * @param {T} tar + * @param {S} src + * @returns {T & S} + */ +function assign(tar, src) { + // @ts-ignore + for (const k in src) tar[k] = src[k]; + return /** @type {T & S} */ (tar); +} + +/** + * The `crossfade` function creates a pair of [transitions](https://svelte.dev/docs/svelte/transition) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used. + * + * @param {CrossfadeParams & { + * fallback?: (node: Element, params: CrossfadeParams, intro: boolean) => TransitionConfig; + * }} params + * @returns {[(node: any, params: CrossfadeParams & { key: any; }) => () => TransitionConfig, (node: any, params: CrossfadeParams & { key: any; }) => () => TransitionConfig]} + */ +export function crossfade({ fallback, ...defaults }) { + /** @type {Map} */ + const to_receive = new Map(); + /** @type {Map} */ + const to_send = new Map(); + + /** + * @param {Element} from_node + * @param {Element} node + * @param {CrossfadeParams} params + * @returns {TransitionConfig} + */ + function crossfade(from_node, node, params) { + const { + delay = 0, + duration = /** @param {number} d */ (d) => Math.sqrt(d) * 30, + easing = cubic_out + } = assign(assign({}, defaults), params); + const from = from_node.getBoundingClientRect(); + const to = node.getBoundingClientRect(); + const dx = from.left - to.left; + const dy = from.top - to.top; + const dw = from.width / to.width; + const dh = from.height / to.height; + const d = Math.sqrt(dx * dx + dy * dy); + const style = getComputedStyle(node); + const transform = style.transform === 'none' ? '' : style.transform; + const opacity = +style.opacity; + return { + delay, + duration: typeof duration === 'function' ? duration(d) : duration, + easing, + css: (t, u) => ` + opacity: ${t * opacity}; + transform-origin: top left; + transform: ${transform} translate(${u * dx}px,${u * dy}px) scale(${t + (1 - t) * dw}, ${ + t + (1 - t) * dh + }); + ` + }; + } + + /** + * @param {Map} items + * @param {Map} counterparts + * @param {boolean} intro + * @returns {(node: any, params: CrossfadeParams & { key: any; }) => () => TransitionConfig} + */ + function transition(items, counterparts, intro) { + // @ts-expect-error TODO improve typings (are the public types wrong?) + return (node, params) => { + items.set(params.key, node); + return () => { + if (counterparts.has(params.key)) { + const other_node = counterparts.get(params.key); + counterparts.delete(params.key); + return crossfade(/** @type {Element} */ (other_node), node, params); + } + // if the node is disappearing altogether + // (i.e. wasn't claimed by the other list) + // then we need to supply an outro + items.delete(params.key); + return fallback && fallback(node, params, intro); + }; + }; + } + return [transition(to_send, to_receive, false), transition(to_receive, to_send, true)]; +} diff --git a/node_modules/svelte/src/transition/public.d.ts b/node_modules/svelte/src/transition/public.d.ts new file mode 100644 index 00000000..454840ad --- /dev/null +++ b/node_modules/svelte/src/transition/public.d.ts @@ -0,0 +1,62 @@ +export type EasingFunction = (t: number) => number; + +export interface TransitionConfig { + delay?: number; + duration?: number; + easing?: EasingFunction; + css?: (t: number, u: number) => string; + tick?: (t: number, u: number) => void; +} + +export interface BlurParams { + delay?: number; + duration?: number; + easing?: EasingFunction; + amount?: number | string; + opacity?: number; +} + +export interface FadeParams { + delay?: number; + duration?: number; + easing?: EasingFunction; +} + +export interface FlyParams { + delay?: number; + duration?: number; + easing?: EasingFunction; + x?: number | string; + y?: number | string; + opacity?: number; +} + +export interface SlideParams { + delay?: number; + duration?: number; + easing?: EasingFunction; + axis?: 'x' | 'y'; +} + +export interface ScaleParams { + delay?: number; + duration?: number; + easing?: EasingFunction; + start?: number; + opacity?: number; +} + +export interface DrawParams { + delay?: number; + speed?: number; + duration?: number | ((len: number) => number); + easing?: EasingFunction; +} + +export interface CrossfadeParams { + delay?: number; + duration?: number | ((len: number) => number); + easing?: EasingFunction; +} + +export * from './index.js'; diff --git a/node_modules/svelte/src/utils.js b/node_modules/svelte/src/utils.js new file mode 100644 index 00000000..e42721b4 --- /dev/null +++ b/node_modules/svelte/src/utils.js @@ -0,0 +1,460 @@ +const regex_return_characters = /\r/g; + +/** + * @param {string} str + * @returns {string} + */ +export function hash(str) { + str = str.replace(regex_return_characters, ''); + let hash = 5381; + let i = str.length; + + while (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i); + return (hash >>> 0).toString(36); +} + +const VOID_ELEMENT_NAMES = [ + 'area', + 'base', + 'br', + 'col', + 'command', + 'embed', + 'hr', + 'img', + 'input', + 'keygen', + 'link', + 'meta', + 'param', + 'source', + 'track', + 'wbr' +]; + +/** + * Returns `true` if `name` is of a void element + * @param {string} name + */ +export function is_void(name) { + return VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === '!doctype'; +} + +const RESERVED_WORDS = [ + 'arguments', + 'await', + 'break', + 'case', + 'catch', + 'class', + 'const', + 'continue', + 'debugger', + 'default', + 'delete', + 'do', + 'else', + 'enum', + 'eval', + 'export', + 'extends', + 'false', + 'finally', + 'for', + 'function', + 'if', + 'implements', + 'import', + 'in', + 'instanceof', + 'interface', + 'let', + 'new', + 'null', + 'package', + 'private', + 'protected', + 'public', + 'return', + 'static', + 'super', + 'switch', + 'this', + 'throw', + 'true', + 'try', + 'typeof', + 'var', + 'void', + 'while', + 'with', + 'yield' +]; + +/** + * Returns `true` if `word` is a reserved JavaScript keyword + * @param {string} word + */ +export function is_reserved(word) { + return RESERVED_WORDS.includes(word); +} + +/** + * @param {string} name + */ +export function is_capture_event(name) { + return name.endsWith('capture') && name !== 'gotpointercapture' && name !== 'lostpointercapture'; +} + +/** List of Element events that will be delegated */ +const DELEGATED_EVENTS = [ + 'beforeinput', + 'click', + 'change', + 'dblclick', + 'contextmenu', + 'focusin', + 'focusout', + 'input', + 'keydown', + 'keyup', + 'mousedown', + 'mousemove', + 'mouseout', + 'mouseover', + 'mouseup', + 'pointerdown', + 'pointermove', + 'pointerout', + 'pointerover', + 'pointerup', + 'touchend', + 'touchmove', + 'touchstart' +]; + +/** + * Returns `true` if `event_name` is a delegated event + * @param {string} event_name + */ +export function is_delegated(event_name) { + return DELEGATED_EVENTS.includes(event_name); +} + +/** + * Attributes that are boolean, i.e. they are present or not present. + */ +const DOM_BOOLEAN_ATTRIBUTES = [ + 'allowfullscreen', + 'async', + 'autofocus', + 'autoplay', + 'checked', + 'controls', + 'default', + 'disabled', + 'formnovalidate', + 'hidden', + 'indeterminate', + 'ismap', + 'loop', + 'multiple', + 'muted', + 'nomodule', + 'novalidate', + 'open', + 'playsinline', + 'readonly', + 'required', + 'reversed', + 'seamless', + 'selected', + 'webkitdirectory' +]; + +/** + * Returns `true` if `name` is a boolean attribute + * @param {string} name + */ +export function is_boolean_attribute(name) { + return DOM_BOOLEAN_ATTRIBUTES.includes(name); +} + +/** + * @type {Record} + * List of attribute names that should be aliased to their property names + * because they behave differently between setting them as an attribute and + * setting them as a property. + */ +const ATTRIBUTE_ALIASES = { + // no `class: 'className'` because we handle that separately + formnovalidate: 'formNoValidate', + ismap: 'isMap', + nomodule: 'noModule', + playsinline: 'playsInline', + readonly: 'readOnly', + defaultvalue: 'defaultValue', + defaultchecked: 'defaultChecked', + srcobject: 'srcObject' +}; + +/** + * @param {string} name + */ +export function normalize_attribute(name) { + name = name.toLowerCase(); + return ATTRIBUTE_ALIASES[name] ?? name; +} + +const DOM_PROPERTIES = [ + ...DOM_BOOLEAN_ATTRIBUTES, + 'formNoValidate', + 'isMap', + 'noModule', + 'playsInline', + 'readOnly', + 'value', + 'inert', + 'volume', + 'defaultValue', + 'defaultChecked', + 'srcObject' +]; + +/** + * @param {string} name + */ +export function is_dom_property(name) { + return DOM_PROPERTIES.includes(name); +} + +const NON_STATIC_PROPERTIES = ['autofocus', 'muted', 'defaultValue', 'defaultChecked']; + +/** + * Returns `true` if the given attribute cannot be set through the template + * string, i.e. needs some kind of JavaScript handling to work. + * @param {string} name + */ +export function cannot_be_set_statically(name) { + return NON_STATIC_PROPERTIES.includes(name); +} + +/** + * Subset of delegated events which should be passive by default. + * These two are already passive via browser defaults on window, document and body. + * But since + * - we're delegating them + * - they happen often + * - they apply to mobile which is generally less performant + * we're marking them as passive by default for other elements, too. + */ +const PASSIVE_EVENTS = ['touchstart', 'touchmove']; + +/** + * Returns `true` if `name` is a passive event + * @param {string} name + */ +export function is_passive_event(name) { + return PASSIVE_EVENTS.includes(name); +} + +const CONTENT_EDITABLE_BINDINGS = ['textContent', 'innerHTML', 'innerText']; + +/** @param {string} name */ +export function is_content_editable_binding(name) { + return CONTENT_EDITABLE_BINDINGS.includes(name); +} + +const LOAD_ERROR_ELEMENTS = [ + 'body', + 'embed', + 'iframe', + 'img', + 'link', + 'object', + 'script', + 'style', + 'track' +]; + +/** + * Returns `true` if the element emits `load` and `error` events + * @param {string} name + */ +export function is_load_error_element(name) { + return LOAD_ERROR_ELEMENTS.includes(name); +} + +const SVG_ELEMENTS = [ + 'altGlyph', + 'altGlyphDef', + 'altGlyphItem', + 'animate', + 'animateColor', + 'animateMotion', + 'animateTransform', + 'circle', + 'clipPath', + 'color-profile', + 'cursor', + 'defs', + 'desc', + 'discard', + 'ellipse', + 'feBlend', + 'feColorMatrix', + 'feComponentTransfer', + 'feComposite', + 'feConvolveMatrix', + 'feDiffuseLighting', + 'feDisplacementMap', + 'feDistantLight', + 'feDropShadow', + 'feFlood', + 'feFuncA', + 'feFuncB', + 'feFuncG', + 'feFuncR', + 'feGaussianBlur', + 'feImage', + 'feMerge', + 'feMergeNode', + 'feMorphology', + 'feOffset', + 'fePointLight', + 'feSpecularLighting', + 'feSpotLight', + 'feTile', + 'feTurbulence', + 'filter', + 'font', + 'font-face', + 'font-face-format', + 'font-face-name', + 'font-face-src', + 'font-face-uri', + 'foreignObject', + 'g', + 'glyph', + 'glyphRef', + 'hatch', + 'hatchpath', + 'hkern', + 'image', + 'line', + 'linearGradient', + 'marker', + 'mask', + 'mesh', + 'meshgradient', + 'meshpatch', + 'meshrow', + 'metadata', + 'missing-glyph', + 'mpath', + 'path', + 'pattern', + 'polygon', + 'polyline', + 'radialGradient', + 'rect', + 'set', + 'solidcolor', + 'stop', + 'svg', + 'switch', + 'symbol', + 'text', + 'textPath', + 'tref', + 'tspan', + 'unknown', + 'use', + 'view', + 'vkern' +]; + +/** @param {string} name */ +export function is_svg(name) { + return SVG_ELEMENTS.includes(name); +} + +const MATHML_ELEMENTS = [ + 'annotation', + 'annotation-xml', + 'maction', + 'math', + 'merror', + 'mfrac', + 'mi', + 'mmultiscripts', + 'mn', + 'mo', + 'mover', + 'mpadded', + 'mphantom', + 'mprescripts', + 'mroot', + 'mrow', + 'ms', + 'mspace', + 'msqrt', + 'mstyle', + 'msub', + 'msubsup', + 'msup', + 'mtable', + 'mtd', + 'mtext', + 'mtr', + 'munder', + 'munderover', + 'semantics' +]; + +/** @param {string} name */ +export function is_mathml(name) { + return MATHML_ELEMENTS.includes(name); +} + +const RUNES = /** @type {const} */ ([ + '$state', + '$state.raw', + '$state.snapshot', + '$props', + '$bindable', + '$derived', + '$derived.by', + '$effect', + '$effect.pre', + '$effect.tracking', + '$effect.root', + '$inspect', + '$inspect().with', + '$inspect.trace', + '$host' +]); + +/** + * @param {string} name + * @returns {name is RUNES[number]} + */ +export function is_rune(name) { + return RUNES.includes(/** @type {RUNES[number]} */ (name)); +} + +/** List of elements that require raw contents and should not have SSR comments put in them */ +const RAW_TEXT_ELEMENTS = /** @type {const} */ (['textarea', 'script', 'style', 'title']); + +/** @param {string} name */ +export function is_raw_text_element(name) { + return RAW_TEXT_ELEMENTS.includes(/** @type {RAW_TEXT_ELEMENTS[number]} */ (name)); +} + +/** + * Prevent devtools trying to make `location` a clickable link by inserting a zero-width space + * @param {string | undefined} location + */ +export function sanitize_location(location) { + return location?.replace(/\//g, '/\u200b'); +} diff --git a/node_modules/svelte/src/version.js b/node_modules/svelte/src/version.js new file mode 100644 index 00000000..add463fa --- /dev/null +++ b/node_modules/svelte/src/version.js @@ -0,0 +1,10 @@ +// generated during release, do not modify + +/** + * The current version, as set in package.json. + * + * https://svelte.dev/docs/svelte-compiler#svelte-version + * @type {string} + */ +export const VERSION = '5.16.2'; +export const PUBLIC_VERSION = '5'; diff --git a/node_modules/svelte/store.d.ts b/node_modules/svelte/store.d.ts new file mode 100644 index 00000000..a1a0ce52 --- /dev/null +++ b/node_modules/svelte/store.d.ts @@ -0,0 +1 @@ +import './types/index.js'; diff --git a/node_modules/svelte/svelte-html.d.ts b/node_modules/svelte/svelte-html.d.ts new file mode 100644 index 00000000..5042eaa4 --- /dev/null +++ b/node_modules/svelte/svelte-html.d.ts @@ -0,0 +1,256 @@ +/// +// This file is deliberately not exposed through the exports map. +// It's meant to be loaded directly by the Svelte language server +/* eslint-disable @typescript-eslint/no-empty-interface */ + +import * as svelteElements from './elements.js'; + +/** + * @internal do not use + */ +type HTMLProps = Omit< + import('./elements.js').SvelteHTMLElements[Property], + keyof Override +> & + Override; + +declare global { + /** + * This namespace does not exist in the runtime, it is only used for typings + */ + namespace svelteHTML { + // Every namespace eligible for use needs to implement the following two functions + /** + * @internal do not use + */ + function mapElementTag(tag: K): ElementTagNameMap[K]; + function mapElementTag(tag: K): SVGElementTagNameMap[K]; + function mapElementTag(tag: any): any; // needs to be any because used in context of + + /** + * @internal do not use + */ + function createElement( + // "undefined | null" because of + element: Key | undefined | null, + attrs: string extends Key ? svelteElements.HTMLAttributes : Elements[Key] + ): Key extends keyof ElementTagNameMap + ? ElementTagNameMap[Key] + : Key extends keyof SVGElementTagNameMap + ? SVGElementTagNameMap[Key] + : any; + function createElement( + // "undefined | null" because of + element: Key | undefined | null, + attrsEnhancers: T, + attrs: (string extends Key ? svelteElements.HTMLAttributes : Elements[Key]) & T + ): Key extends keyof ElementTagNameMap + ? ElementTagNameMap[Key] + : Key extends keyof SVGElementTagNameMap + ? SVGElementTagNameMap[Key] + : any; + + // For backwards-compatibility and ease-of-use, in case someone enhanced the typings from import('svelte/elements').HTMLAttributes/SVGAttributes + // eslint-disable-next-line @typescript-eslint/no-unused-vars + interface HTMLAttributes {} + // eslint-disable-next-line @typescript-eslint/no-unused-vars + interface SVGAttributes {} + + /** + * Avoid using this interface directly. Instead use the `SvelteHTMLElements` interface exported by `svelte/elements` + * This should only be used if you need to extend the interface with custom elements + */ + interface IntrinsicElements extends svelteElements.SvelteHTMLElements { + a: HTMLProps<'a', HTMLAttributes>; + abbr: HTMLProps<'abbr', HTMLAttributes>; + address: HTMLProps<'address', HTMLAttributes>; + area: HTMLProps<'area', HTMLAttributes>; + article: HTMLProps<'article', HTMLAttributes>; + aside: HTMLProps<'aside', HTMLAttributes>; + audio: HTMLProps<'audio', HTMLAttributes>; + b: HTMLProps<'b', HTMLAttributes>; + base: HTMLProps<'base', HTMLAttributes>; + bdi: HTMLProps<'bdi', HTMLAttributes>; + bdo: HTMLProps<'bdo', HTMLAttributes>; + big: HTMLProps<'big', HTMLAttributes>; + blockquote: HTMLProps<'blockquote', HTMLAttributes>; + body: HTMLProps<'body', HTMLAttributes>; + br: HTMLProps<'br', HTMLAttributes>; + button: HTMLProps<'button', HTMLAttributes>; + canvas: HTMLProps<'canvas', HTMLAttributes>; + caption: HTMLProps<'caption', HTMLAttributes>; + cite: HTMLProps<'cite', HTMLAttributes>; + code: HTMLProps<'code', HTMLAttributes>; + col: HTMLProps<'col', HTMLAttributes>; + colgroup: HTMLProps<'colgroup', HTMLAttributes>; + data: HTMLProps<'data', HTMLAttributes>; + datalist: HTMLProps<'datalist', HTMLAttributes>; + dd: HTMLProps<'dd', HTMLAttributes>; + del: HTMLProps<'del', HTMLAttributes>; + details: HTMLProps<'details', HTMLAttributes>; + dfn: HTMLProps<'dfn', HTMLAttributes>; + dialog: HTMLProps<'dialog', HTMLAttributes>; + div: HTMLProps<'div', HTMLAttributes>; + dl: HTMLProps<'dl', HTMLAttributes>; + dt: HTMLProps<'dt', HTMLAttributes>; + em: HTMLProps<'em', HTMLAttributes>; + embed: HTMLProps<'embed', HTMLAttributes>; + fieldset: HTMLProps<'fieldset', HTMLAttributes>; + figcaption: HTMLProps<'figcaption', HTMLAttributes>; + figure: HTMLProps<'figure', HTMLAttributes>; + footer: HTMLProps<'footer', HTMLAttributes>; + form: HTMLProps<'form', HTMLAttributes>; + h1: HTMLProps<'h1', HTMLAttributes>; + h2: HTMLProps<'h2', HTMLAttributes>; + h3: HTMLProps<'h3', HTMLAttributes>; + h4: HTMLProps<'h4', HTMLAttributes>; + h5: HTMLProps<'h5', HTMLAttributes>; + h6: HTMLProps<'h6', HTMLAttributes>; + head: HTMLProps<'head', HTMLAttributes>; + header: HTMLProps<'header', HTMLAttributes>; + hgroup: HTMLProps<'hgroup', HTMLAttributes>; + hr: HTMLProps<'hr', HTMLAttributes>; + html: HTMLProps<'html', HTMLAttributes>; + i: HTMLProps<'i', HTMLAttributes>; + iframe: HTMLProps<'iframe', HTMLAttributes>; + img: HTMLProps<'img', HTMLAttributes>; + input: HTMLProps<'input', HTMLAttributes>; + ins: HTMLProps<'ins', HTMLAttributes>; + kbd: HTMLProps<'kbd', HTMLAttributes>; + keygen: HTMLProps<'keygen', HTMLAttributes>; + label: HTMLProps<'label', HTMLAttributes>; + legend: HTMLProps<'legend', HTMLAttributes>; + li: HTMLProps<'li', HTMLAttributes>; + link: HTMLProps<'link', HTMLAttributes>; + main: HTMLProps<'main', HTMLAttributes>; + map: HTMLProps<'map', HTMLAttributes>; + mark: HTMLProps<'mark', HTMLAttributes>; + menu: HTMLProps<'menu', HTMLAttributes>; + menuitem: HTMLProps<'menuitem', HTMLAttributes>; + meta: HTMLProps<'meta', HTMLAttributes>; + meter: HTMLProps<'meter', HTMLAttributes>; + nav: HTMLProps<'nav', HTMLAttributes>; + noscript: HTMLProps<'noscript', HTMLAttributes>; + object: HTMLProps<'object', HTMLAttributes>; + ol: HTMLProps<'ol', HTMLAttributes>; + optgroup: HTMLProps<'optgroup', HTMLAttributes>; + option: HTMLProps<'option', HTMLAttributes>; + output: HTMLProps<'output', HTMLAttributes>; + p: HTMLProps<'p', HTMLAttributes>; + param: HTMLProps<'param', HTMLAttributes>; + picture: HTMLProps<'picture', HTMLAttributes>; + pre: HTMLProps<'pre', HTMLAttributes>; + progress: HTMLProps<'progress', HTMLAttributes>; + q: HTMLProps<'q', HTMLAttributes>; + rp: HTMLProps<'rp', HTMLAttributes>; + rt: HTMLProps<'rt', HTMLAttributes>; + ruby: HTMLProps<'ruby', HTMLAttributes>; + s: HTMLProps<'s', HTMLAttributes>; + samp: HTMLProps<'samp', HTMLAttributes>; + slot: HTMLProps<'slot', HTMLAttributes>; + script: HTMLProps<'script', HTMLAttributes>; + section: HTMLProps<'section', HTMLAttributes>; + select: HTMLProps<'select', HTMLAttributes>; + small: HTMLProps<'small', HTMLAttributes>; + source: HTMLProps<'source', HTMLAttributes>; + span: HTMLProps<'span', HTMLAttributes>; + strong: HTMLProps<'strong', HTMLAttributes>; + style: HTMLProps<'style', HTMLAttributes>; + sub: HTMLProps<'sub', HTMLAttributes>; + summary: HTMLProps<'summary', HTMLAttributes>; + sup: HTMLProps<'sup', HTMLAttributes>; + table: HTMLProps<'table', HTMLAttributes>; + template: HTMLProps<'template', HTMLAttributes>; + tbody: HTMLProps<'tbody', HTMLAttributes>; + td: HTMLProps<'td', HTMLAttributes>; + textarea: HTMLProps<'textarea', HTMLAttributes>; + tfoot: HTMLProps<'tfoot', HTMLAttributes>; + th: HTMLProps<'th', HTMLAttributes>; + thead: HTMLProps<'thead', HTMLAttributes>; + time: HTMLProps<'time', HTMLAttributes>; + title: HTMLProps<'title', HTMLAttributes>; + tr: HTMLProps<'tr', HTMLAttributes>; + track: HTMLProps<'track', HTMLAttributes>; + u: HTMLProps<'u', HTMLAttributes>; + ul: HTMLProps<'ul', HTMLAttributes>; + var: HTMLProps<'var', HTMLAttributes>; + video: HTMLProps<'video', HTMLAttributes>; + wbr: HTMLProps<'wbr', HTMLAttributes>; + webview: HTMLProps<'webview', HTMLAttributes>; + // SVG + svg: HTMLProps<'svg', SVGAttributes>; + + animate: HTMLProps<'animate', SVGAttributes>; + animateMotion: HTMLProps<'animateMotion', SVGAttributes>; + animateTransform: HTMLProps<'animateTransform', SVGAttributes>; + circle: HTMLProps<'circle', SVGAttributes>; + clipPath: HTMLProps<'clipPath', SVGAttributes>; + defs: HTMLProps<'defs', SVGAttributes>; + desc: HTMLProps<'desc', SVGAttributes>; + ellipse: HTMLProps<'ellipse', SVGAttributes>; + feBlend: HTMLProps<'feBlend', SVGAttributes>; + feColorMatrix: HTMLProps<'feColorMatrix', SVGAttributes>; + feComponentTransfer: HTMLProps<'feComponentTransfer', SVGAttributes>; + feComposite: HTMLProps<'feComposite', SVGAttributes>; + feConvolveMatrix: HTMLProps<'feConvolveMatrix', SVGAttributes>; + feDiffuseLighting: HTMLProps<'feDiffuseLighting', SVGAttributes>; + feDisplacementMap: HTMLProps<'feDisplacementMap', SVGAttributes>; + feDistantLight: HTMLProps<'feDistantLight', SVGAttributes>; + feDropShadow: HTMLProps<'feDropShadow', SVGAttributes>; + feFlood: HTMLProps<'feFlood', SVGAttributes>; + feFuncA: HTMLProps<'feFuncA', SVGAttributes>; + feFuncB: HTMLProps<'feFuncB', SVGAttributes>; + feFuncG: HTMLProps<'feFuncG', SVGAttributes>; + feFuncR: HTMLProps<'feFuncR', SVGAttributes>; + feGaussianBlur: HTMLProps<'feGaussianBlur', SVGAttributes>; + feImage: HTMLProps<'feImage', SVGAttributes>; + feMerge: HTMLProps<'feMerge', SVGAttributes>; + feMergeNode: HTMLProps<'feMergeNode', SVGAttributes>; + feMorphology: HTMLProps<'feMorphology', SVGAttributes>; + feOffset: HTMLProps<'feOffset', SVGAttributes>; + fePointLight: HTMLProps<'fePointLight', SVGAttributes>; + feSpecularLighting: HTMLProps<'feSpecularLighting', SVGAttributes>; + feSpotLight: HTMLProps<'feSpotLight', SVGAttributes>; + feTile: HTMLProps<'feTile', SVGAttributes>; + feTurbulence: HTMLProps<'feTurbulence', SVGAttributes>; + filter: HTMLProps<'filter', SVGAttributes>; + foreignObject: HTMLProps<'foreignObject', SVGAttributes>; + g: HTMLProps<'g', SVGAttributes>; + image: HTMLProps<'image', SVGAttributes>; + line: HTMLProps<'line', SVGAttributes>; + linearGradient: HTMLProps<'linearGradient', SVGAttributes>; + marker: HTMLProps<'marker', SVGAttributes>; + mask: HTMLProps<'mask', SVGAttributes>; + metadata: HTMLProps<'metadata', SVGAttributes>; + mpath: HTMLProps<'mpath', SVGAttributes>; + path: HTMLProps<'path', SVGAttributes>; + pattern: HTMLProps<'pattern', SVGAttributes>; + polygon: HTMLProps<'polygon', SVGAttributes>; + polyline: HTMLProps<'polyline', SVGAttributes>; + radialGradient: HTMLProps<'radialGradient', SVGAttributes>; + rect: HTMLProps<'rect', SVGAttributes>; + stop: HTMLProps<'stop', SVGAttributes>; + switch: HTMLProps<'switch', SVGAttributes>; + symbol: HTMLProps<'symbol', SVGAttributes>; + text: HTMLProps<'text', SVGAttributes>; + textPath: HTMLProps<'textPath', SVGAttributes>; + tspan: HTMLProps<'tspan', SVGAttributes>; + use: HTMLProps<'use', SVGAttributes>; + view: HTMLProps<'view', SVGAttributes>; + + // Svelte specific + 'svelte:window': HTMLProps<'svelte:window', HTMLAttributes>; + 'svelte:body': HTMLProps<'svelte:body', HTMLAttributes>; + 'svelte:document': HTMLProps<'svelte:document', HTMLAttributes>; + 'svelte:fragment': { slot?: string }; + 'svelte:head': { [name: string]: any }; + 'svelte:boundary': { + onerror?: (error: unknown, reset: () => void) => void; + failed?: import('svelte').Snippet<[error: unknown, reset: () => void]>; + }; + // don't type svelte:options, it would override the types in svelte/elements and it isn't extendable anyway + + [name: string]: { [name: string]: any }; + } + } +} diff --git a/node_modules/svelte/transition.d.ts b/node_modules/svelte/transition.d.ts new file mode 100644 index 00000000..a1a0ce52 --- /dev/null +++ b/node_modules/svelte/transition.d.ts @@ -0,0 +1 @@ +import './types/index.js'; diff --git a/node_modules/svelte/types/compiler/interfaces.d.ts b/node_modules/svelte/types/compiler/interfaces.d.ts new file mode 100644 index 00000000..c89a9257 --- /dev/null +++ b/node_modules/svelte/types/compiler/interfaces.d.ts @@ -0,0 +1 @@ +import '../index.js'; diff --git a/node_modules/svelte/types/compiler/preprocess.d.ts b/node_modules/svelte/types/compiler/preprocess.d.ts new file mode 100644 index 00000000..c89a9257 --- /dev/null +++ b/node_modules/svelte/types/compiler/preprocess.d.ts @@ -0,0 +1 @@ +import '../index.js'; diff --git a/node_modules/svelte/types/index.d.ts b/node_modules/svelte/types/index.d.ts new file mode 100644 index 00000000..b6b76b1c --- /dev/null +++ b/node_modules/svelte/types/index.d.ts @@ -0,0 +1,3162 @@ +declare module 'svelte' { + /** + * @deprecated In Svelte 4, components are classes. In Svelte 5, they are functions. + * Use `mount` instead to instantiate components. + * See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) + * for more info. + */ + export interface ComponentConstructorOptions< + Props extends Record = Record + > { + target: Element | Document | ShadowRoot; + anchor?: Element; + props?: Props; + context?: Map; + hydrate?: boolean; + intro?: boolean; + recover?: boolean; + sync?: boolean; + $$inline?: boolean; + } + + /** + * Utility type for ensuring backwards compatibility on a type level that if there's a default slot, add 'children' to the props + */ + type Properties = Props & + (Slots extends { default: any } + ? // This is unfortunate because it means "accepts no props" turns into "accepts any prop" + // but the alternative is non-fixable type errors because of the way TypeScript index + // signatures work (they will always take precedence and make an impossible-to-satisfy children type). + Props extends Record + ? any + : { children?: any } + : {}); + + /** + * This was the base class for Svelte components in Svelte 4. Svelte 5+ components + * are completely different under the hood. For typing, use `Component` instead. + * To instantiate components, use `mount` instead. + * See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) for more info. + */ + export class SvelteComponent< + Props extends Record = Record, + Events extends Record = any, + Slots extends Record = any + > { + /** The custom element version of the component. Only present if compiled with the `customElement` compiler option */ + static element?: typeof HTMLElement; + + [prop: string]: any; + /** + * @deprecated This constructor only exists when using the `asClassComponent` compatibility helper, which + * is a stop-gap solution. Migrate towards using `mount` instead. See + * [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) for more info. + */ + constructor(options: ComponentConstructorOptions>); + /** + * For type checking capabilities only. + * Does not exist at runtime. + * ### DO NOT USE! + */ + $$prop_def: Props; // Without Properties: unnecessary, causes type bugs + /** + * For type checking capabilities only. + * Does not exist at runtime. + * ### DO NOT USE! + */ + $$events_def: Events; + /** + * For type checking capabilities only. + * Does not exist at runtime. + * ### DO NOT USE! + */ + $$slot_def: Slots; + /** + * For type checking capabilities only. + * Does not exist at runtime. + * ### DO NOT USE! + */ + $$bindings?: string; + + /** + * @deprecated This method only exists when using one of the legacy compatibility helpers, which + * is a stop-gap solution. See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) + * for more info. + */ + $destroy(): void; + + /** + * @deprecated This method only exists when using one of the legacy compatibility helpers, which + * is a stop-gap solution. See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) + * for more info. + */ + $on>( + type: K, + callback: (e: Events[K]) => void + ): () => void; + + /** + * @deprecated This method only exists when using one of the legacy compatibility helpers, which + * is a stop-gap solution. See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) + * for more info. + */ + $set(props: Partial): void; + } + + const brand: unique symbol; + type Brand = { [brand]: B }; + type Branded = T & Brand; + + /** + * Internal implementation details that vary between environments + */ + export type ComponentInternals = Branded<{}, 'ComponentInternals'>; + + /** + * Can be used to create strongly typed Svelte components. + * + * #### Example: + * + * You have component library on npm called `component-library`, from which + * you export a component called `MyComponent`. For Svelte+TypeScript users, + * you want to provide typings. Therefore you create a `index.d.ts`: + * ```ts + * import type { Component } from 'svelte'; + * export declare const MyComponent: Component<{ foo: string }> {} + * ``` + * Typing this makes it possible for IDEs like VS Code with the Svelte extension + * to provide intellisense and to use the component like this in a Svelte file + * with TypeScript: + * ```svelte + * + * + * ``` + */ + export interface Component< + Props extends Record = {}, + Exports extends Record = {}, + Bindings extends keyof Props | '' = string + > { + /** + * @param internal An internal object used by Svelte. Do not use or modify. + * @param props The props passed to the component. + */ + ( + this: void, + internals: ComponentInternals, + props: Props + ): { + /** + * @deprecated This method only exists when using one of the legacy compatibility helpers, which + * is a stop-gap solution. See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) + * for more info. + */ + $on?(type: string, callback: (e: any) => void): () => void; + /** + * @deprecated This method only exists when using one of the legacy compatibility helpers, which + * is a stop-gap solution. See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) + * for more info. + */ + $set?(props: Partial): void; + } & Exports; + /** The custom element version of the component. Only present if compiled with the `customElement` compiler option */ + element?: typeof HTMLElement; + /** Does not exist at runtime, for typing capabilities only. DO NOT USE */ + z_$$bindings?: Bindings; + } + + /** + * @deprecated Use `Component` instead. See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) for more information. + */ + export class SvelteComponentTyped< + Props extends Record = Record, + Events extends Record = any, + Slots extends Record = any + > extends SvelteComponent {} + + /** + * @deprecated The new `Component` type does not have a dedicated Events type. Use `ComponentProps` instead. + * + * @description + * Convenience type to get the events the given component expects. Example: + * ```html + * + * + * + * ``` + */ + export type ComponentEvents = + Comp extends SvelteComponent ? Events : never; + + /** + * Convenience type to get the props the given component expects. + * + * Example: Ensure a variable contains the props expected by `MyComponent`: + * + * ```ts + * import type { ComponentProps } from 'svelte'; + * import MyComponent from './MyComponent.svelte'; + * + * // Errors if these aren't the correct props expected by MyComponent. + * const props: ComponentProps = { foo: 'bar' }; + * ``` + * + * > [!NOTE] In Svelte 4, you would do `ComponentProps` because `MyComponent` was a class. + * + * Example: A generic function that accepts some component and infers the type of its props: + * + * ```ts + * import type { Component, ComponentProps } from 'svelte'; + * import MyComponent from './MyComponent.svelte'; + * + * function withProps>( + * component: TComponent, + * props: ComponentProps + * ) {}; + * + * // Errors if the second argument is not the correct props expected by the component in the first argument. + * withProps(MyComponent, { foo: 'bar' }); + * ``` + */ + export type ComponentProps> = + Comp extends SvelteComponent + ? Props + : Comp extends Component + ? Props + : never; + + /** + * @deprecated This type is obsolete when working with the new `Component` type. + * + * @description + * Convenience type to get the type of a Svelte component. Useful for example in combination with + * dynamic components using ``. + * + * Example: + * ```html + * + * + * + * + * ``` + */ + export type ComponentType = (new ( + options: ComponentConstructorOptions< + Comp extends SvelteComponent ? Props : Record + > + ) => Comp) & { + /** The custom element version of the component. Only present if compiled with the `customElement` compiler option */ + element?: typeof HTMLElement; + }; + + const SnippetReturn: unique symbol; + + // Use an interface instead of a type, makes for better intellisense info because the type is named in more situations. + /** + * The type of a `#snippet` block. You can use it to (for example) express that your component expects a snippet of a certain type: + * ```ts + * let { banner }: { banner: Snippet<[{ text: string }]> } = $props(); + * ``` + * You can only call a snippet through the `{@render ...}` tag. + * + * https://svelte.dev/docs/svelte/snippet + * + * @template Parameters the parameters that the snippet expects (if any) as a tuple. + */ + export interface Snippet { + ( + this: void, + // this conditional allows tuples but not arrays. Arrays would indicate a + // rest parameter type, which is not supported. If rest parameters are added + // in the future, the condition can be removed. + ...args: number extends Parameters['length'] ? never : Parameters + ): { + '{@render ...} must be called with a Snippet': "import type { Snippet } from 'svelte'"; + } & typeof SnippetReturn; + } + + interface DispatchOptions { + cancelable?: boolean; + } + + export interface EventDispatcher> { + // Implementation notes: + // - undefined extends X instead of X extends undefined makes this work better with both strict and nonstrict mode + // - | null | undefined is added for convenience, as they are equivalent for the custom event constructor (both result in a null detail) + ( + ...args: null extends EventMap[Type] + ? [type: Type, parameter?: EventMap[Type] | null | undefined, options?: DispatchOptions] + : undefined extends EventMap[Type] + ? [type: Type, parameter?: EventMap[Type] | null | undefined, options?: DispatchOptions] + : [type: Type, parameter: EventMap[Type], options?: DispatchOptions] + ): boolean; + } + + /** + * Defines the options accepted by the `mount()` function. + */ + export type MountOptions = Record> = { + /** + * Target element where the component will be mounted. + */ + target: Document | Element | ShadowRoot; + /** + * Optional node inside `target`. When specified, it is used to render the component immediately before it. + */ + anchor?: Node; + /** + * Allows the specification of events. + * @deprecated Use callback props instead. + */ + events?: Record any>; + /** + * Can be accessed via `getContext()` at the component level. + */ + context?: Map; + /** + * Whether or not to play transitions on initial render. + * @default true + */ + intro?: boolean; + } & ({} extends Props + ? { + /** + * Component properties. + */ + props?: Props; + } + : { + /** + * Component properties. + */ + props: Props; + }); + /** + * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM. + * It must be called during the component's initialisation (but doesn't need to live *inside* the component; + * it can be called from an external module). + * + * If a function is returned _synchronously_ from `onMount`, it will be called when the component is unmounted. + * + * `onMount` does not run inside [server-side components](https://svelte.dev/docs/svelte/svelte-server#render). + * + * */ + export function onMount(fn: () => NotFunction | Promise> | (() => any)): void; + /** + * Schedules a callback to run immediately before the component is unmounted. + * + * Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the + * only one that runs inside a server-side component. + * + * */ + export function onDestroy(fn: () => any): void; + /** + * Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs/svelte/legacy-on#Component-events). + * Event dispatchers are functions that can take two arguments: `name` and `detail`. + * + * Component events created with `createEventDispatcher` create a + * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent). + * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture). + * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail) + * property and can contain any type of data. + * + * The event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument: + * ```ts + * const dispatch = createEventDispatcher<{ + * loaded: never; // does not take a detail argument + * change: string; // takes a detail argument of type string, which is required + * optional: number | null; // takes an optional detail argument of type number + * }>(); + * ``` + * + * @deprecated Use callback props and/or the `$host()` rune instead — see [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Event-changes-Component-events) + * */ + export function createEventDispatcher = any>(): EventDispatcher; + /** + * Schedules a callback to run immediately before the component is updated after any state change. + * + * The first time the callback runs will be before the initial `onMount`. + * + * In runes mode use `$effect.pre` instead. + * + * @deprecated Use [`$effect.pre`](https://svelte.dev/docs/svelte/$effect#$effect.pre) instead + * */ + export function beforeUpdate(fn: () => void): void; + /** + * Schedules a callback to run immediately after the component has been updated. + * + * The first time the callback runs will be after the initial `onMount`. + * + * In runes mode use `$effect` instead. + * + * @deprecated Use [`$effect`](https://svelte.dev/docs/svelte/$effect) instead + * */ + export function afterUpdate(fn: () => void): void; + /** + * Synchronously flushes any pending state changes and those that result from it. + * */ + export function flushSync(fn?: (() => void) | undefined): void; + /** + * Create a snippet programmatically + * */ + export function createRawSnippet(fn: (...params: Getters) => { + render: () => string; + setup?: (element: Element) => void | (() => void); + }): Snippet; + /** Anything except a function */ + type NotFunction = T extends Function ? never : T; + /** + * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component. + * Transitions will play during the initial render unless the `intro` option is set to `false`. + * + * */ + export function mount, Exports extends Record>(component: ComponentType> | Component, options: MountOptions): Exports; + /** + * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component + * + * */ + export function hydrate, Exports extends Record>(component: ComponentType> | Component, options: {} extends Props ? { + target: Document | Element | ShadowRoot; + props?: Props; + events?: Record any>; + context?: Map; + intro?: boolean; + recover?: boolean; + } : { + target: Document | Element | ShadowRoot; + props: Props; + events?: Record any>; + context?: Map; + intro?: boolean; + recover?: boolean; + }): Exports; + /** + * Unmounts a component that was previously mounted using `mount` or `hydrate`. + * + * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM. + * + * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`). + * + * ```js + * import { mount, unmount } from 'svelte'; + * import App from './App.svelte'; + * + * const app = mount(App, { target: document.body }); + * + * // later... + * unmount(app, { outro: true }); + * ``` + * */ + export function unmount(component: Record, options?: { + outro?: boolean; + } | undefined): Promise; + /** + * Returns a promise that resolves once any pending state changes have been applied. + * */ + export function tick(): Promise; + /** + * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect), + * any state read inside `fn` will not be treated as a dependency. + * + * ```ts + * $effect(() => { + * // this will run when `data` changes, but not when `time` changes + * save(data, { + * timestamp: untrack(() => time) + * }); + * }); + * ``` + * */ + export function untrack(fn: () => T): T; + /** + * Retrieves the context that belongs to the closest parent component with the specified `key`. + * Must be called during component initialisation. + * + * */ + export function getContext(key: any): T; + /** + * Associates an arbitrary `context` object with the current component and the specified `key` + * and returns that object. The context is then available to children of the component + * (including slotted content) with `getContext`. + * + * Like lifecycle functions, this must be called during component initialisation. + * + * */ + export function setContext(key: any, context: T): T; + /** + * Checks whether a given `key` has been set in the context of a parent component. + * Must be called during component initialisation. + * + * */ + export function hasContext(key: any): boolean; + /** + * Retrieves the whole context map that belongs to the closest parent component. + * Must be called during component initialisation. Useful, for example, if you + * programmatically create a component and want to pass the existing context to it. + * + * */ + export function getAllContexts = Map>(): T; + type Getters = { + [K in keyof T]: () => T[K]; + }; + + export {}; +} + +declare module 'svelte/action' { + /** + * Actions can return an object containing the two properties defined in this interface. Both are optional. + * - update: An action can have a parameter. This method will be called whenever that parameter changes, + * immediately after Svelte has applied updates to the markup. `ActionReturn` and `ActionReturn` both + * mean that the action accepts no parameters. + * - destroy: Method that is called after the element is unmounted + * + * Additionally, you can specify which additional attributes and events the action enables on the applied element. + * This applies to TypeScript typings only and has no effect at runtime. + * + * Example usage: + * ```ts + * interface Attributes { + * newprop?: string; + * 'on:event': (e: CustomEvent) => void; + * } + * + * export function myAction(node: HTMLElement, parameter: Parameter): ActionReturn { + * // ... + * return { + * update: (updatedParameter) => {...}, + * destroy: () => {...} + * }; + * } + * ``` + */ + export interface ActionReturn< + Parameter = undefined, + Attributes extends Record = Record + > { + update?: (parameter: Parameter) => void; + destroy?: () => void; + /** + * ### DO NOT USE THIS + * This exists solely for type-checking and has no effect at runtime. + * Set this through the `Attributes` generic instead. + */ + $$_attributes?: Attributes; + } + + /** + * Actions are functions that are called when an element is created. + * You can use this interface to type such actions. + * The following example defines an action that only works on `
    ` elements + * and optionally accepts a parameter which it has a default value for: + * ```ts + * export const myAction: Action = (node, param = { someProperty: true }) => { + * // ... + * } + * ``` + * `Action` and `Action` both signal that the action accepts no parameters. + * + * You can return an object with methods `update` and `destroy` from the function and type which additional attributes and events it has. + * See interface `ActionReturn` for more details. + */ + export interface Action< + Element = HTMLElement, + Parameter = undefined, + Attributes extends Record = Record + > { + ( + ...args: undefined extends Parameter + ? [node: Node, parameter?: Parameter] + : [node: Node, parameter: Parameter] + ): void | ActionReturn; + } + + // Implementation notes: + // - undefined extends X instead of X extends undefined makes this work better with both strict and nonstrict mode + + export {}; +} + +declare module 'svelte/animate' { + // todo: same as Transition, should it be shared? + export interface AnimationConfig { + delay?: number; + duration?: number; + easing?: (t: number) => number; + css?: (t: number, u: number) => string; + tick?: (t: number, u: number) => void; + } + + export interface FlipParams { + delay?: number; + duration?: number | ((len: number) => number); + easing?: (t: number) => number; + } + /** + * The flip function calculates the start and end position of an element and animates between them, translating the x and y values. + * `flip` stands for [First, Last, Invert, Play](https://aerotwist.com/blog/flip-your-animations/). + * + * */ + export function flip(node: Element, { from, to }: { + from: DOMRect; + to: DOMRect; + }, params?: FlipParams): AnimationConfig; + + export {}; +} + +declare module 'svelte/compiler' { + import type { Expression, Identifier, ArrayExpression, ArrowFunctionExpression, VariableDeclaration, VariableDeclarator, MemberExpression, Node, ObjectExpression, Pattern, Program, ChainExpression, SimpleCallExpression, SequenceExpression } from 'estree'; + import type { SourceMap } from 'magic-string'; + import type { Location } from 'locate-character'; + /** + * `compile` converts your `.svelte` source code into a JavaScript module that exports a component + * + * @param source The component source code + * @param options The compiler options + * */ + export function compile(source: string, options: CompileOptions): CompileResult; + /** + * `compileModule` takes your JavaScript source code containing runes, and turns it into a JavaScript module. + * + * @param source The component source code + * */ + export function compileModule(source: string, options: ModuleCompileOptions): CompileResult; + /** + * The parse function parses a component, returning only its abstract syntax tree. + * + * The `modern` option (`false` by default in Svelte 5) makes the parser return a modern AST instead of the legacy AST. + * `modern` will become `true` by default in Svelte 6, and the option will be removed in Svelte 7. + * + * */ + export function parse(source: string, options: { + filename?: string; + modern: true; + loose?: boolean; + }): AST.Root; + /** + * The parse function parses a component, returning only its abstract syntax tree. + * + * The `modern` option (`false` by default in Svelte 5) makes the parser return a modern AST instead of the legacy AST. + * `modern` will become `true` by default in Svelte 6, and the option will be removed in Svelte 7. + * + * */ + export function parse(source: string, options?: { + filename?: string; + modern?: false; + loose?: boolean; + } | undefined): Record; + /** + * @deprecated Replace this with `import { walk } from 'estree-walker'` + * */ + export function walk(): never; + /** + * The result of a preprocessor run. If the preprocessor does not return a result, it is assumed that the code is unchanged. + */ + export interface Processed { + /** + * The new code + */ + code: string; + /** + * A source map mapping back to the original code + */ + map?: string | object; // we are opaque with the type here to avoid dependency on the remapping module for our public types. + /** + * A list of additional files to watch for changes + */ + dependencies?: string[]; + /** + * Only for script/style preprocessors: The updated attributes to set on the tag. If undefined, attributes stay unchanged. + */ + attributes?: Record; + toString?: () => string; + } + + /** + * A markup preprocessor that takes a string of code and returns a processed version. + */ + export type MarkupPreprocessor = (options: { + /** + * The whole Svelte file content + */ + content: string; + /** + * The filename of the Svelte file + */ + filename?: string; + }) => Processed | void | Promise; + + /** + * A script/style preprocessor that takes a string of code and returns a processed version. + */ + export type Preprocessor = (options: { + /** + * The script/style tag content + */ + content: string; + /** + * The attributes on the script/style tag + */ + attributes: Record; + /** + * The whole Svelte file content + */ + markup: string; + /** + * The filename of the Svelte file + */ + filename?: string; + }) => Processed | void | Promise; + + /** + * A preprocessor group is a set of preprocessors that are applied to a Svelte file. + */ + export interface PreprocessorGroup { + /** Name of the preprocessor. Will be a required option in the next major version */ + name?: string; + markup?: MarkupPreprocessor; + style?: Preprocessor; + script?: Preprocessor; + } + /** The return value of `compile` from `svelte/compiler` */ + export interface CompileResult { + /** The compiled JavaScript */ + js: { + /** The generated code */ + code: string; + /** A source map */ + map: SourceMap; + }; + /** The compiled CSS */ + css: null | { + /** The generated code */ + code: string; + /** A source map */ + map: SourceMap; + }; + /** + * An array of warning objects that were generated during compilation. Each warning has several properties: + * - `code` is a string identifying the category of warning + * - `message` describes the issue in human-readable terms + * - `start` and `end`, if the warning relates to a specific location, are objects with `line`, `column` and `character` properties + */ + warnings: Warning[]; + /** + * Metadata about the compiled component + */ + metadata: { + /** + * Whether the file was compiled in runes mode, either because of an explicit option or inferred from usage. + * For `compileModule`, this is always `true` + */ + runes: boolean; + }; + /** The AST */ + ast: any; + } + + export interface Warning extends ICompileDiagnostic {} + + export interface CompileError extends ICompileDiagnostic {} + + type CssHashGetter = (args: { + name: string; + filename: string; + css: string; + hash: (input: string) => string; + }) => string; + + export interface CompileOptions extends ModuleCompileOptions { + /** + * Sets the name of the resulting JavaScript class (though the compiler will rename it if it would otherwise conflict with other variables in scope). + * If unspecified, will be inferred from `filename` + */ + name?: string; + /** + * If `true`, tells the compiler to generate a custom element constructor instead of a regular Svelte component. + * + * @default false + */ + customElement?: boolean; + /** + * If `true`, getters and setters will be created for the component's props. If `false`, they will only be created for readonly exported values (i.e. those declared with `const`, `class` and `function`). If compiling with `customElement: true` this option defaults to `true`. + * + * @default false + * @deprecated This will have no effect in runes mode + */ + accessors?: boolean; + /** + * The namespace of the element; e.g., `"html"`, `"svg"`, `"mathml"`. + * + * @default 'html' + */ + namespace?: Namespace; + /** + * If `true`, tells the compiler that you promise not to mutate any objects. + * This allows it to be less conservative about checking whether values have changed. + * + * @default false + * @deprecated This will have no effect in runes mode + */ + immutable?: boolean; + /** + * - `'injected'`: styles will be included in the `head` when using `render(...)`, and injected into the document (if not already present) when the component mounts. For components compiled as custom elements, styles are injected to the shadow root. + * - `'external'`: the CSS will only be returned in the `css` field of the compilation result. Most Svelte bundler plugins will set this to `'external'` and use the CSS that is statically generated for better performance, as it will result in smaller JavaScript bundles and the output can be served as cacheable `.css` files. + * This is always `'injected'` when compiling with `customElement` mode. + */ + css?: 'injected' | 'external'; + /** + * A function that takes a `{ hash, css, name, filename }` argument and returns the string that is used as a classname for scoped CSS. + * It defaults to returning `svelte-${hash(css)}`. + * + * @default undefined + */ + cssHash?: CssHashGetter; + /** + * If `true`, your HTML comments will be preserved in the output. By default, they are stripped out. + * + * @default false + */ + preserveComments?: boolean; + /** + * If `true`, whitespace inside and between elements is kept as you typed it, rather than removed or collapsed to a single space where possible. + * + * @default false + */ + preserveWhitespace?: boolean; + /** + * Set to `true` to force the compiler into runes mode, even if there are no indications of runes usage. + * Set to `false` to force the compiler into ignoring runes, even if there are indications of runes usage. + * Set to `undefined` (the default) to infer runes mode from the component code. + * Is always `true` for JS/TS modules compiled with Svelte. + * Will be `true` by default in Svelte 6. + * Note that setting this to `true` in your `svelte.config.js` will force runes mode for your entire project, including components in `node_modules`, + * which is likely not what you want. If you're using Vite, consider using [dynamicCompileOptions](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#dynamiccompileoptions) instead. + * @default undefined + */ + runes?: boolean | undefined; + /** + * If `true`, exposes the Svelte major version in the browser by adding it to a `Set` stored in the global `window.__svelte.v`. + * + * @default true + */ + discloseVersion?: boolean; + /** + * @deprecated Use these only as a temporary solution before migrating your code + */ + compatibility?: { + /** + * Applies a transformation so that the default export of Svelte files can still be instantiated the same way as in Svelte 4 — + * as a class when compiling for the browser (as though using `createClassComponent(MyComponent, {...})` from `svelte/legacy`) + * or as an object with a `.render(...)` method when compiling for the server + * @default 5 + */ + componentApi?: 4 | 5; + }; + /** + * An initial sourcemap that will be merged into the final output sourcemap. + * This is usually the preprocessor sourcemap. + * + * @default null + */ + sourcemap?: object | string; + /** + * Used for your JavaScript sourcemap. + * + * @default null + */ + outputFilename?: string; + /** + * Used for your CSS sourcemap. + * + * @default null + */ + cssOutputFilename?: string; + /** + * If `true`, compiles components with hot reloading support. + * + * @default false + */ + hmr?: boolean; + /** + * If `true`, returns the modern version of the AST. + * Will become `true` by default in Svelte 6, and the option will be removed in Svelte 7. + * + * @default false + */ + modernAst?: boolean; + } + + export interface ModuleCompileOptions { + /** + * If `true`, causes extra code to be added that will perform runtime checks and provide debugging information during development. + * + * @default false + */ + dev?: boolean; + /** + * If `"client"`, Svelte emits code designed to run in the browser. + * If `"server"`, Svelte emits code suitable for server-side rendering. + * If `false`, nothing is generated. Useful for tooling that is only interested in warnings. + * + * @default 'client' + */ + generate?: 'client' | 'server' | false; + /** + * Used for debugging hints and sourcemaps. Your bundler plugin will set it automatically. + */ + filename?: string; + /** + * Used for ensuring filenames don't leak filesystem information. Your bundler plugin will set it automatically. + * @default process.cwd() on node-like environments, undefined elsewhere + */ + rootDir?: string; + /** + * A function that gets a `Warning` as an argument and returns a boolean. + * Use this to filter out warnings. Return `true` to keep the warning, `false` to discard it. + */ + warningFilter?: (warning: Warning) => boolean; + } + /** + * - `html` — the default, for e.g. `
    ` or `` + * - `svg` — for e.g. `` or `` + * - `mathml` — for e.g. `` or `` + */ + type Namespace = 'html' | 'svg' | 'mathml'; + + export namespace AST { + export interface BaseNode { + type: string; + start: number; + end: number; + } + + export interface Fragment { + type: 'Fragment'; + nodes: Array; + } + + export interface Root extends BaseNode { + type: 'Root'; + /** + * Inline options provided by `` — these override options passed to `compile(...)` + */ + options: SvelteOptions | null; + fragment: Fragment; + /** The parsed `(fn: () => U, options?: SpringOpts): Spring; + + /** + * Sets `spring.target` to `value` and returns a `Promise` that resolves if and when `spring.current` catches up to it. + * + * If `options.instant` is `true`, `spring.current` immediately matches `spring.target`. + * + * If `options.preserveMomentum` is provided, the spring will continue on its current trajectory for + * the specified number of milliseconds. This is useful for things like 'fling' gestures. + */ + set(value: T, options?: SpringUpdateOpts): Promise; + + damping: number; + precision: number; + stiffness: number; + /** + * The end value of the spring. + * This property only exists on the `Spring` class, not the legacy `spring` store. + */ + target: T; + /** + * The current value of the spring. + * This property only exists on the `Spring` class, not the legacy `spring` store. + */ + get current(): T; + } + + export interface Tweened extends Readable { + set(value: T, opts?: TweenedOptions): Promise; + update(updater: Updater, opts?: TweenedOptions): Promise; + } + /** Callback to inform of a value updates. */ + type Subscriber = (value: T) => void; + + /** Unsubscribes from value updates. */ + type Unsubscriber = () => void; + + /** Readable interface for subscribing. */ + interface Readable { + /** + * Subscribe on value changes. + * @param run subscription callback + * @param invalidate cleanup callback + */ + subscribe(this: void, run: Subscriber, invalidate?: () => void): Unsubscriber; + } + interface SpringOpts { + stiffness?: number; + damping?: number; + precision?: number; + } + + interface SpringUpdateOpts { + /** + * @deprecated Only use this for the spring store; does nothing when set on the Spring class + */ + hard?: any; + /** + * @deprecated Only use this for the spring store; does nothing when set on the Spring class + */ + soft?: string | number | boolean; + /** + * Only use this for the Spring class; does nothing when set on the spring store + */ + instant?: boolean; + /** + * Only use this for the Spring class; does nothing when set on the spring store + */ + preserveMomentum?: number; + } + + type Updater = (target_value: T, value: T) => T; + + interface TweenedOptions { + delay?: number; + duration?: number | ((from: T, to: T) => number); + easing?: (t: number) => number; + interpolate?: (a: T, b: T) => (t: number) => T; + } + /** + * A [media query](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery) that matches if the user [prefers reduced motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion). + * + * ```svelte + * + * + * + * + * {#if visible} + *

    + * flies in, unless the user prefers reduced motion + *

    + * {/if} + * ``` + * @since 5.7.0 + */ + export const prefersReducedMotion: MediaQuery; + /** + * The spring function in Svelte creates a store whose value is animated, with a motion that simulates the behavior of a spring. This means when the value changes, instead of transitioning at a steady rate, it "bounces" like a spring would, depending on the physics parameters provided. This adds a level of realism to the transitions and can enhance the user experience. + * + * @deprecated Use [`Spring`](https://svelte.dev/docs/svelte/svelte-motion#Spring) instead + * */ + export function spring(value?: T | undefined, opts?: SpringOpts | undefined): Spring; + /** + * A tweened store in Svelte is a special type of store that provides smooth transitions between state values over time. + * + * @deprecated Use [`Tween`](https://svelte.dev/docs/svelte/svelte-motion#Tween) instead + * */ + export function tweened(value?: T | undefined, defaults?: TweenedOptions | undefined): Tweened; + /** + * A wrapper for a value that tweens smoothly to its target value. Changes to `tween.target` will cause `tween.current` to + * move towards it over time, taking account of the `delay`, `duration` and `easing` options. + * + * ```svelte + * + * + * + * + * ``` + * @since 5.8.0 + */ + export class Tween { + /** + * Create a tween whose value is bound to the return value of `fn`. This must be called + * inside an effect root (for example, during component initialisation). + * + * ```svelte + * + * ``` + * + */ + static of(fn: () => U, options?: TweenedOptions | undefined): Tween; + + constructor(value: T, options?: TweenedOptions); + /** + * Sets `tween.target` to `value` and returns a `Promise` that resolves if and when `tween.current` catches up to it. + * + * If `options` are provided, they will override the tween's defaults. + * */ + set(value: T, options?: TweenedOptions | undefined): Promise; + get current(): T; + set target(v: T); + get target(): T; + #private; + } + + export {}; +} + +declare module 'svelte/reactivity' { + export class SvelteDate extends Date { + + constructor(...params: any[]); + #private; + } + export class SvelteSet extends Set { + + constructor(value?: Iterable | null | undefined); + + add(value: T): this; + #private; + } + export class SvelteMap extends Map { + + constructor(value?: Iterable | null | undefined); + + set(key: K, value: V): this; + #private; + } + export class SvelteURL extends URL { + get searchParams(): SvelteURLSearchParams; + #private; + } + const REPLACE: unique symbol; + export class SvelteURLSearchParams extends URLSearchParams { + + [REPLACE](params: URLSearchParams): void; + #private; + } + /** + * Creates a media query and provides a `current` property that reflects whether or not it matches. + * + * Use it carefully — during server-side rendering, there is no way to know what the correct value should be, potentially causing content to change upon hydration. + * If you can use the media query in CSS to achieve the same effect, do that. + * + * ```svelte + * + * + *

    {large.current ? 'large screen' : 'small screen'}

    + * ``` + * @extends {ReactiveValue} + * @since 5.7.0 + */ + export class MediaQuery extends ReactiveValue { + /** + * @param query A media query string + * @param fallback Fallback value for the server + */ + constructor(query: string, fallback?: boolean | undefined); + } + /** + * Returns a `subscribe` function that, if called in an effect (including expressions in the template), + * calls its `start` callback with an `update` function. Whenever `update` is called, the effect re-runs. + * + * If `start` returns a function, it will be called when the effect is destroyed. + * + * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects + * are active, and the returned teardown function will only be called when all effects are destroyed. + * + * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery): + * + * ```js + * import { createSubscriber } from 'svelte/reactivity'; + * import { on } from 'svelte/events'; + * + * export class MediaQuery { + * #query; + * #subscribe; + * + * constructor(query) { + * this.#query = window.matchMedia(`(${query})`); + * + * this.#subscribe = createSubscriber((update) => { + * // when the `change` event occurs, re-run any effects that read `this.current` + * const off = on(this.#query, 'change', update); + * + * // stop listening when all the effects are destroyed + * return () => off(); + * }); + * } + * + * get current() { + * this.#subscribe(); + * + * // Return the current state of the query, whether or not we're in an effect + * return this.#query.matches; + * } + * } + * ``` + * @since 5.7.0 + */ + export function createSubscriber(start: (update: () => void) => (() => void) | void): () => void; + class ReactiveValue { + + constructor(fn: () => T, onsubscribe: (update: () => void) => void); + get current(): T; + #private; + } + + export {}; +} + +declare module 'svelte/reactivity/window' { + /** + * `scrollX.current` is a reactive view of `window.scrollX`. On the server it is `undefined`. + * @since 5.11.0 + */ + export const scrollX: ReactiveValue; + /** + * `scrollY.current` is a reactive view of `window.scrollY`. On the server it is `undefined`. + * @since 5.11.0 + */ + export const scrollY: ReactiveValue; + /** + * `innerWidth.current` is a reactive view of `window.innerWidth`. On the server it is `undefined`. + * @since 5.11.0 + */ + export const innerWidth: ReactiveValue; + /** + * `innerHeight.current` is a reactive view of `window.innerHeight`. On the server it is `undefined`. + * @since 5.11.0 + */ + export const innerHeight: ReactiveValue; + /** + * `outerWidth.current` is a reactive view of `window.outerWidth`. On the server it is `undefined`. + * @since 5.11.0 + */ + export const outerWidth: ReactiveValue; + /** + * `outerHeight.current` is a reactive view of `window.outerHeight`. On the server it is `undefined`. + * @since 5.11.0 + */ + export const outerHeight: ReactiveValue; + /** + * `screenLeft.current` is a reactive view of `window.screenLeft`. It is updated inside a `requestAnimationFrame` callback. On the server it is `undefined`. + * @since 5.11.0 + */ + export const screenLeft: ReactiveValue; + /** + * `screenTop.current` is a reactive view of `window.screenTop`. It is updated inside a `requestAnimationFrame` callback. On the server it is `undefined`. + * @since 5.11.0 + */ + export const screenTop: ReactiveValue; + /** + * `online.current` is a reactive view of `navigator.onLine`. On the server it is `undefined`. + * @since 5.11.0 + */ + export const online: ReactiveValue; + /** + * `devicePixelRatio.current` is a reactive view of `window.devicePixelRatio`. On the server it is `undefined`. + * Note that behaviour differs between browsers — on Chrome it will respond to the current zoom level, + * on Firefox and Safari it won't. + * @since 5.11.0 + */ + export const devicePixelRatio: { + get current(): number | undefined; + }; + class ReactiveValue { + + constructor(fn: () => T, onsubscribe: (update: () => void) => void); + get current(): T; + #private; + } + + export {}; +} + +declare module 'svelte/server' { + import type { ComponentProps, Component, SvelteComponent, ComponentType } from 'svelte'; + /** + * Only available on the server and when compiling with the `server` option. + * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app. + */ + export function render< + Comp extends SvelteComponent | Component, + Props extends ComponentProps = ComponentProps + >( + ...args: {} extends Props + ? [ + component: Comp extends SvelteComponent ? ComponentType : Comp, + options?: { props?: Omit; context?: Map } + ] + : [ + component: Comp extends SvelteComponent ? ComponentType : Comp, + options: { props: Omit; context?: Map } + ] + ): RenderOutput; + interface RenderOutput { + /** HTML that goes into the `` */ + head: string; + /** @deprecated use `body` instead */ + html: string; + /** HTML that goes somewhere into the `` */ + body: string; + } + + export {}; +} + +declare module 'svelte/store' { + /** Callback to inform of a value updates. */ + export type Subscriber = (value: T) => void; + + /** Unsubscribes from value updates. */ + export type Unsubscriber = () => void; + + /** Callback to update a value. */ + export type Updater = (value: T) => T; + + /** + * Start and stop notification callbacks. + * This function is called when the first subscriber subscribes. + * + * @param set Function that sets the value of the store. + * @param update Function that sets the value of the store after passing the current value to the update function. + * @returns Optionally, a cleanup function that is called when the last remaining + * subscriber unsubscribes. + */ + export type StartStopNotifier = ( + set: (value: T) => void, + update: (fn: Updater) => void + ) => void | (() => void); + + /** Readable interface for subscribing. */ + export interface Readable { + /** + * Subscribe on value changes. + * @param run subscription callback + * @param invalidate cleanup callback + */ + subscribe(this: void, run: Subscriber, invalidate?: () => void): Unsubscriber; + } + + /** Writable interface for both updating and subscribing. */ + export interface Writable extends Readable { + /** + * Set value and inform subscribers. + * @param value to set + */ + set(this: void, value: T): void; + + /** + * Update value using callback and inform subscribers. + * @param updater callback + */ + update(this: void, updater: Updater): void; + } + export function toStore(get: () => V, set: (v: V) => void): Writable; + + export function toStore(get: () => V): Readable; + + export function fromStore(store: Writable): { + current: V; + }; + + export function fromStore(store: Readable): { + readonly current: V; + }; + /** + * Creates a `Readable` store that allows reading by subscription. + * + * @param value initial value + * */ + export function readable(value?: T | undefined, start?: StartStopNotifier | undefined): Readable; + /** + * Create a `Writable` store that allows both updating and reading by subscription. + * + * @param value initial value + * */ + export function writable(value?: T | undefined, start?: StartStopNotifier | undefined): Writable; + /** + * Derived value store by synchronizing one or more readable stores and + * applying an aggregation function over its input values. + * + * */ + export function derived(stores: S, fn: (values: StoresValues, set: (value: T) => void, update: (fn: Updater) => void) => Unsubscriber | void, initial_value?: T | undefined): Readable; + /** + * Derived value store by synchronizing one or more readable stores and + * applying an aggregation function over its input values. + * + * */ + export function derived(stores: S, fn: (values: StoresValues) => T, initial_value?: T | undefined): Readable; + /** + * Takes a store and returns a new one derived from the old one that is readable. + * + * @param store - store to make readonly + * */ + export function readonly(store: Readable): Readable; + /** + * Get the current value from a store by subscribing and immediately unsubscribing. + * + * */ + export function get(store: Readable): T; + /** One or more `Readable`s. */ + type Stores = Readable | [Readable, ...Array>] | Array>; + + /** One or more values from `Readable` stores. */ + type StoresValues = + T extends Readable ? U : { [K in keyof T]: T[K] extends Readable ? U : never }; + + export {}; +} + +declare module 'svelte/transition' { + export type EasingFunction = (t: number) => number; + + export interface TransitionConfig { + delay?: number; + duration?: number; + easing?: EasingFunction; + css?: (t: number, u: number) => string; + tick?: (t: number, u: number) => void; + } + + export interface BlurParams { + delay?: number; + duration?: number; + easing?: EasingFunction; + amount?: number | string; + opacity?: number; + } + + export interface FadeParams { + delay?: number; + duration?: number; + easing?: EasingFunction; + } + + export interface FlyParams { + delay?: number; + duration?: number; + easing?: EasingFunction; + x?: number | string; + y?: number | string; + opacity?: number; + } + + export interface SlideParams { + delay?: number; + duration?: number; + easing?: EasingFunction; + axis?: 'x' | 'y'; + } + + export interface ScaleParams { + delay?: number; + duration?: number; + easing?: EasingFunction; + start?: number; + opacity?: number; + } + + export interface DrawParams { + delay?: number; + speed?: number; + duration?: number | ((len: number) => number); + easing?: EasingFunction; + } + + export interface CrossfadeParams { + delay?: number; + duration?: number | ((len: number) => number); + easing?: EasingFunction; + } + /** + * Animates a `blur` filter alongside an element's opacity. + * + * */ + export function blur(node: Element, { delay, duration, easing, amount, opacity }?: BlurParams | undefined): TransitionConfig; + /** + * Animates the opacity of an element from 0 to the current opacity for `in` transitions and from the current opacity to 0 for `out` transitions. + * + * */ + export function fade(node: Element, { delay, duration, easing }?: FadeParams | undefined): TransitionConfig; + /** + * Animates the x and y positions and the opacity of an element. `in` transitions animate from the provided values, passed as parameters to the element's default values. `out` transitions animate from the element's default values to the provided values. + * + * */ + export function fly(node: Element, { delay, duration, easing, x, y, opacity }?: FlyParams | undefined): TransitionConfig; + /** + * Slides an element in and out. + * + * */ + export function slide(node: Element, { delay, duration, easing, axis }?: SlideParams | undefined): TransitionConfig; + /** + * Animates the opacity and scale of an element. `in` transitions animate from the provided values, passed as parameters, to an element's current (default) values. `out` transitions animate from an element's default values to the provided values. + * + * */ + export function scale(node: Element, { delay, duration, easing, start, opacity }?: ScaleParams | undefined): TransitionConfig; + /** + * Animates the stroke of an SVG element, like a snake in a tube. `in` transitions begin with the path invisible and draw the path to the screen over time. `out` transitions start in a visible state and gradually erase the path. `draw` only works with elements that have a `getTotalLength` method, like `` and ``. + * + * */ + export function draw(node: SVGElement & { + getTotalLength(): number; + }, { delay, speed, duration, easing }?: DrawParams | undefined): TransitionConfig; + /** + * The `crossfade` function creates a pair of [transitions](https://svelte.dev/docs/svelte/transition) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used. + * + * */ + export function crossfade({ fallback, ...defaults }: CrossfadeParams & { + fallback?: (node: Element, params: CrossfadeParams, intro: boolean) => TransitionConfig; + }): [(node: any, params: CrossfadeParams & { + key: any; + }) => () => TransitionConfig, (node: any, params: CrossfadeParams & { + key: any; + }) => () => TransitionConfig]; + + export {}; +} + +declare module 'svelte/events' { + // Once https://github.com/microsoft/TypeScript/issues/59980 is fixed we can put these overloads into the JSDoc comments of the `on` function + + /** + * Attaches an event handler to the window and returns a function that removes the handler. Using this + * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively + * (with attributes like `onclick`), which use event delegation for performance reasons + */ + export function on( + window: Window, + type: Type, + handler: (this: Window, event: WindowEventMap[Type]) => any, + options?: AddEventListenerOptions | undefined + ): () => void; + /** + * Attaches an event handler to the document and returns a function that removes the handler. Using this + * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively + * (with attributes like `onclick`), which use event delegation for performance reasons + */ + export function on( + document: Document, + type: Type, + handler: (this: Document, event: DocumentEventMap[Type]) => any, + options?: AddEventListenerOptions | undefined + ): () => void; + /** + * Attaches an event handler to an element and returns a function that removes the handler. Using this + * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively + * (with attributes like `onclick`), which use event delegation for performance reasons + */ + export function on( + element: Element, + type: Type, + handler: (this: Element, event: HTMLElementEventMap[Type]) => any, + options?: AddEventListenerOptions | undefined + ): () => void; + /** + * Attaches an event handler to an element and returns a function that removes the handler. Using this + * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively + * (with attributes like `onclick`), which use event delegation for performance reasons + */ + export function on( + element: Element, + type: Type, + handler: (this: Element, event: MediaQueryListEventMap[Type]) => any, + options?: AddEventListenerOptions | undefined + ): () => void; + /** + * Attaches an event handler to an element and returns a function that removes the handler. Using this + * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively + * (with attributes like `onclick`), which use event delegation for performance reasons + */ + export function on( + element: EventTarget, + type: string, + handler: EventListener, + options?: AddEventListenerOptions | undefined + ): () => void; + + export {}; +} + +declare module 'svelte/types/compiler/preprocess' { + /** @deprecated import this from 'svelte/preprocess' instead */ + export type MarkupPreprocessor = MarkupPreprocessor_1; + /** @deprecated import this from 'svelte/preprocess' instead */ + export type Preprocessor = Preprocessor_1; + /** @deprecated import this from 'svelte/preprocess' instead */ + export type PreprocessorGroup = PreprocessorGroup_1; + /** @deprecated import this from 'svelte/preprocess' instead */ + export type Processed = Processed_1; + /** @deprecated import this from 'svelte/preprocess' instead */ + export type SveltePreprocessor = SveltePreprocessor_1< + PreprocessorType, + Options + >; + /** + * The result of a preprocessor run. If the preprocessor does not return a result, it is assumed that the code is unchanged. + */ + interface Processed_1 { + /** + * The new code + */ + code: string; + /** + * A source map mapping back to the original code + */ + map?: string | object; // we are opaque with the type here to avoid dependency on the remapping module for our public types. + /** + * A list of additional files to watch for changes + */ + dependencies?: string[]; + /** + * Only for script/style preprocessors: The updated attributes to set on the tag. If undefined, attributes stay unchanged. + */ + attributes?: Record; + toString?: () => string; + } + + /** + * A markup preprocessor that takes a string of code and returns a processed version. + */ + type MarkupPreprocessor_1 = (options: { + /** + * The whole Svelte file content + */ + content: string; + /** + * The filename of the Svelte file + */ + filename?: string; + }) => Processed_1 | void | Promise; + + /** + * A script/style preprocessor that takes a string of code and returns a processed version. + */ + type Preprocessor_1 = (options: { + /** + * The script/style tag content + */ + content: string; + /** + * The attributes on the script/style tag + */ + attributes: Record; + /** + * The whole Svelte file content + */ + markup: string; + /** + * The filename of the Svelte file + */ + filename?: string; + }) => Processed_1 | void | Promise; + + /** + * A preprocessor group is a set of preprocessors that are applied to a Svelte file. + */ + interface PreprocessorGroup_1 { + /** Name of the preprocessor. Will be a required option in the next major version */ + name?: string; + markup?: MarkupPreprocessor_1; + style?: Preprocessor_1; + script?: Preprocessor_1; + } + + /** + * @description Utility type to extract the type of a preprocessor from a preprocessor group + * @deprecated Create this utility type yourself instead + */ + interface SveltePreprocessor_1< + PreprocessorType extends keyof PreprocessorGroup_1, + Options = any + > { + (options?: Options): Required>; + } + + export {}; +} + +declare module 'svelte/types/compiler/interfaces' { + import type { Location } from 'locate-character'; + /** @deprecated import this from 'svelte' instead */ + export type CompileOptions = CompileOptions_1; + /** @deprecated import this from 'svelte' instead */ + export type Warning = Warning_1; + interface Warning_1 extends ICompileDiagnostic {} + + type CssHashGetter = (args: { + name: string; + filename: string; + css: string; + hash: (input: string) => string; + }) => string; + + interface CompileOptions_1 extends ModuleCompileOptions { + /** + * Sets the name of the resulting JavaScript class (though the compiler will rename it if it would otherwise conflict with other variables in scope). + * If unspecified, will be inferred from `filename` + */ + name?: string; + /** + * If `true`, tells the compiler to generate a custom element constructor instead of a regular Svelte component. + * + * @default false + */ + customElement?: boolean; + /** + * If `true`, getters and setters will be created for the component's props. If `false`, they will only be created for readonly exported values (i.e. those declared with `const`, `class` and `function`). If compiling with `customElement: true` this option defaults to `true`. + * + * @default false + * @deprecated This will have no effect in runes mode + */ + accessors?: boolean; + /** + * The namespace of the element; e.g., `"html"`, `"svg"`, `"mathml"`. + * + * @default 'html' + */ + namespace?: Namespace; + /** + * If `true`, tells the compiler that you promise not to mutate any objects. + * This allows it to be less conservative about checking whether values have changed. + * + * @default false + * @deprecated This will have no effect in runes mode + */ + immutable?: boolean; + /** + * - `'injected'`: styles will be included in the `head` when using `render(...)`, and injected into the document (if not already present) when the component mounts. For components compiled as custom elements, styles are injected to the shadow root. + * - `'external'`: the CSS will only be returned in the `css` field of the compilation result. Most Svelte bundler plugins will set this to `'external'` and use the CSS that is statically generated for better performance, as it will result in smaller JavaScript bundles and the output can be served as cacheable `.css` files. + * This is always `'injected'` when compiling with `customElement` mode. + */ + css?: 'injected' | 'external'; + /** + * A function that takes a `{ hash, css, name, filename }` argument and returns the string that is used as a classname for scoped CSS. + * It defaults to returning `svelte-${hash(css)}`. + * + * @default undefined + */ + cssHash?: CssHashGetter; + /** + * If `true`, your HTML comments will be preserved in the output. By default, they are stripped out. + * + * @default false + */ + preserveComments?: boolean; + /** + * If `true`, whitespace inside and between elements is kept as you typed it, rather than removed or collapsed to a single space where possible. + * + * @default false + */ + preserveWhitespace?: boolean; + /** + * Set to `true` to force the compiler into runes mode, even if there are no indications of runes usage. + * Set to `false` to force the compiler into ignoring runes, even if there are indications of runes usage. + * Set to `undefined` (the default) to infer runes mode from the component code. + * Is always `true` for JS/TS modules compiled with Svelte. + * Will be `true` by default in Svelte 6. + * Note that setting this to `true` in your `svelte.config.js` will force runes mode for your entire project, including components in `node_modules`, + * which is likely not what you want. If you're using Vite, consider using [dynamicCompileOptions](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#dynamiccompileoptions) instead. + * @default undefined + */ + runes?: boolean | undefined; + /** + * If `true`, exposes the Svelte major version in the browser by adding it to a `Set` stored in the global `window.__svelte.v`. + * + * @default true + */ + discloseVersion?: boolean; + /** + * @deprecated Use these only as a temporary solution before migrating your code + */ + compatibility?: { + /** + * Applies a transformation so that the default export of Svelte files can still be instantiated the same way as in Svelte 4 — + * as a class when compiling for the browser (as though using `createClassComponent(MyComponent, {...})` from `svelte/legacy`) + * or as an object with a `.render(...)` method when compiling for the server + * @default 5 + */ + componentApi?: 4 | 5; + }; + /** + * An initial sourcemap that will be merged into the final output sourcemap. + * This is usually the preprocessor sourcemap. + * + * @default null + */ + sourcemap?: object | string; + /** + * Used for your JavaScript sourcemap. + * + * @default null + */ + outputFilename?: string; + /** + * Used for your CSS sourcemap. + * + * @default null + */ + cssOutputFilename?: string; + /** + * If `true`, compiles components with hot reloading support. + * + * @default false + */ + hmr?: boolean; + /** + * If `true`, returns the modern version of the AST. + * Will become `true` by default in Svelte 6, and the option will be removed in Svelte 7. + * + * @default false + */ + modernAst?: boolean; + } + + interface ModuleCompileOptions { + /** + * If `true`, causes extra code to be added that will perform runtime checks and provide debugging information during development. + * + * @default false + */ + dev?: boolean; + /** + * If `"client"`, Svelte emits code designed to run in the browser. + * If `"server"`, Svelte emits code suitable for server-side rendering. + * If `false`, nothing is generated. Useful for tooling that is only interested in warnings. + * + * @default 'client' + */ + generate?: 'client' | 'server' | false; + /** + * Used for debugging hints and sourcemaps. Your bundler plugin will set it automatically. + */ + filename?: string; + /** + * Used for ensuring filenames don't leak filesystem information. Your bundler plugin will set it automatically. + * @default process.cwd() on node-like environments, undefined elsewhere + */ + rootDir?: string; + /** + * A function that gets a `Warning` as an argument and returns a boolean. + * Use this to filter out warnings. Return `true` to keep the warning, `false` to discard it. + */ + warningFilter?: (warning: Warning_1) => boolean; + } + /** + * - `html` — the default, for e.g. `
    ` or `` + * - `svg` — for e.g. `` or `` + * - `mathml` — for e.g. `` or `` + */ + type Namespace = 'html' | 'svg' | 'mathml'; + type ICompileDiagnostic = { + code: string; + message: string; + stack?: string; + filename?: string; + start?: Location; + end?: Location; + position?: [number, number]; + frame?: string; + }; + + export {}; +}declare module '*.svelte' { + // use prettier-ignore for a while because of https://github.com/sveltejs/language-tools/commit/026111228b5814a9109cc4d779d37fb02955fb8b + // prettier-ignore + import { SvelteComponent } from 'svelte' + import { LegacyComponentType } from 'svelte/legacy'; + const Comp: LegacyComponentType; + type Comp = SvelteComponent; + export default Comp; +} + +/** + * Declares reactive state. + * + * Example: + * ```ts + * let count = $state(0); + * ``` + * + * https://svelte.dev/docs/svelte/$state + * + * @param initial The initial value + */ +declare function $state(initial: T): T; +declare function $state(): T | undefined; + +declare namespace $state { + type Primitive = string | number | boolean | null | undefined; + + type TypedArray = + | Int8Array + | Uint8Array + | Uint8ClampedArray + | Int16Array + | Uint16Array + | Int32Array + | Uint32Array + | Float32Array + | Float64Array + | BigInt64Array + | BigUint64Array; + + /** The things that `structuredClone` can handle — https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm */ + export type Cloneable = + | ArrayBuffer + | DataView + | Date + | Error + | Map + | RegExp + | Set + | TypedArray + // web APIs + | Blob + | CryptoKey + | DOMException + | DOMMatrix + | DOMMatrixReadOnly + | DOMPoint + | DOMPointReadOnly + | DOMQuad + | DOMRect + | DOMRectReadOnly + | File + | FileList + | FileSystemDirectoryHandle + | FileSystemFileHandle + | FileSystemHandle + | ImageBitmap + | ImageData + | RTCCertificate + | VideoFrame; + + /** Turn `SvelteDate`, `SvelteMap` and `SvelteSet` into their non-reactive counterparts. (`URL` is uncloneable.) */ + type NonReactive = T extends Date + ? Date + : T extends Map + ? Map + : T extends Set + ? Set + : T; + + type Snapshot = T extends Primitive + ? T + : T extends Cloneable + ? NonReactive + : T extends { toJSON(): infer R } + ? R + : T extends Array + ? Array> + : T extends object + ? T extends { [key: string]: any } + ? { [K in keyof T]: Snapshot } + : never + : never; + + /** + * Declares state that is _not_ made deeply reactive — instead of mutating it, + * you must reassign it. + * + * Example: + * ```ts + * + * + * + * ``` + * + * https://svelte.dev/docs/svelte/$state#$state.raw + * + * @param initial The initial value + */ + export function raw(initial: T): T; + export function raw(): T | undefined; + /** + * To take a static snapshot of a deeply reactive `$state` proxy, use `$state.snapshot`: + * + * Example: + * ```ts + * + * ``` + * + * https://svelte.dev/docs/svelte/$state#$state.snapshot + * + * @param state The value to snapshot + */ + export function snapshot(state: T): Snapshot; + + // prevent intellisense from being unhelpful + /** @deprecated */ + export const apply: never; + /** @deprecated */ + // @ts-ignore + export const arguments: never; + /** @deprecated */ + export const bind: never; + /** @deprecated */ + export const call: never; + /** @deprecated */ + export const caller: never; + /** @deprecated */ + export const length: never; + /** @deprecated */ + export const name: never; + /** @deprecated */ + export const prototype: never; + /** @deprecated */ + export const toString: never; +} + +/** + * Declares derived state, i.e. one that depends on other state variables. + * The expression inside `$derived(...)` should be free of side-effects. + * + * Example: + * ```ts + * let double = $derived(count * 2); + * ``` + * + * https://svelte.dev/docs/svelte/$derived + * + * @param expression The derived state expression + */ +declare function $derived(expression: T): T; + +declare namespace $derived { + /** + * Sometimes you need to create complex derivations that don't fit inside a short expression. + * In these cases, you can use `$derived.by` which accepts a function as its argument. + * + * Example: + * ```ts + * let total = $derived.by(() => { + * let result = 0; + * for (const n of numbers) { + * result += n; + * } + * return result; + * }); + * ``` + * + * https://svelte.dev/docs/svelte/$derived#$derived.by + */ + export function by(fn: () => T): T; + + // prevent intellisense from being unhelpful + /** @deprecated */ + export const apply: never; + /** @deprecated */ + // @ts-ignore + export const arguments: never; + /** @deprecated */ + export const bind: never; + /** @deprecated */ + export const call: never; + /** @deprecated */ + export const caller: never; + /** @deprecated */ + export const length: never; + /** @deprecated */ + export const name: never; + /** @deprecated */ + export const prototype: never; + /** @deprecated */ + export const toString: never; +} + +/** + * Runs code when a component is mounted to the DOM, and then whenever its dependencies change, i.e. `$state` or `$derived` values. + * The timing of the execution is after the DOM has been updated. + * + * Example: + * ```ts + * $effect(() => console.log('The count is now ' + count)); + * ``` + * + * If you return a function from the effect, it will be called right before the effect is run again, or when the component is unmounted. + * + * Does not run during server side rendering. + * + * https://svelte.dev/docs/svelte/$effect + * @param fn The function to execute + */ +declare function $effect(fn: () => void | (() => void)): void; + +declare namespace $effect { + /** + * Runs code right before a component is mounted to the DOM, and then whenever its dependencies change, i.e. `$state` or `$derived` values. + * The timing of the execution is right before the DOM is updated. + * + * Example: + * ```ts + * $effect.pre(() => console.log('The count is now ' + count)); + * ``` + * + * If you return a function from the effect, it will be called right before the effect is run again, or when the component is unmounted. + * + * Does not run during server side rendering. + * + * https://svelte.dev/docs/svelte/$effect#$effect.pre + * @param fn The function to execute + */ + export function pre(fn: () => void | (() => void)): void; + + /** + * The `$effect.tracking` rune is an advanced feature that tells you whether or not the code is running inside a tracking context, such as an effect or inside your template. + * + * Example: + * ```svelte + * + * + *

    in template: {$effect.tracking()}

    + * ``` + * + * This allows you to (for example) add things like subscriptions without causing memory leaks, by putting them in child effects. + * + * https://svelte.dev/docs/svelte/$effect#$effect.tracking + */ + export function tracking(): boolean; + + /** + * The `$effect.root` rune is an advanced feature that creates a non-tracked scope that doesn't auto-cleanup. This is useful for + * nested effects that you want to manually control. This rune also allows for creation of effects outside of the component + * initialisation phase. + * + * Example: + * ```svelte + * + * + * + * ``` + * + * https://svelte.dev/docs/svelte/$effect#$effect.root + */ + export function root(fn: () => void | (() => void)): () => void; + + // prevent intellisense from being unhelpful + /** @deprecated */ + export const apply: never; + /** @deprecated */ + // @ts-ignore + export const arguments: never; + /** @deprecated */ + export const bind: never; + /** @deprecated */ + export const call: never; + /** @deprecated */ + export const caller: never; + /** @deprecated */ + export const length: never; + /** @deprecated */ + export const name: never; + /** @deprecated */ + export const prototype: never; + /** @deprecated */ + export const toString: never; +} + +/** + * Declares the props that a component accepts. Example: + * + * ```ts + * let { optionalProp = 42, requiredProp, bindableProp = $bindable() }: { optionalProp?: number; requiredProps: string; bindableProp: boolean } = $props(); + * ``` + * + * https://svelte.dev/docs/svelte/$props + */ +declare function $props(): any; + +declare namespace $props { + // prevent intellisense from being unhelpful + /** @deprecated */ + export const apply: never; + /** @deprecated */ + // @ts-ignore + export const arguments: never; + /** @deprecated */ + export const bind: never; + /** @deprecated */ + export const call: never; + /** @deprecated */ + export const caller: never; + /** @deprecated */ + export const length: never; + /** @deprecated */ + export const name: never; + /** @deprecated */ + export const prototype: never; + /** @deprecated */ + export const toString: never; +} + +/** + * Declares a prop as bindable, meaning the parent component can use `bind:propName={value}` to bind to it. + * + * ```ts + * let { propName = $bindable() }: { propName: boolean } = $props(); + * ``` + * + * https://svelte.dev/docs/svelte/$bindable + */ +declare function $bindable(fallback?: T): T; + +declare namespace $bindable { + // prevent intellisense from being unhelpful + /** @deprecated */ + export const apply: never; + /** @deprecated */ + // @ts-ignore + export const arguments: never; + /** @deprecated */ + export const bind: never; + /** @deprecated */ + export const call: never; + /** @deprecated */ + export const caller: never; + /** @deprecated */ + export const length: never; + /** @deprecated */ + export const name: never; + /** @deprecated */ + export const prototype: never; + /** @deprecated */ + export const toString: never; +} + +/** + * Inspects one or more values whenever they, or the properties they contain, change. Example: + * + * ```ts + * $inspect(someValue, someOtherValue) + * ``` + * + * `$inspect` returns a `with` function, which you can invoke with a callback function that + * will be called with the value and the event type (`'init'` or `'update'`) on every change. + * By default, the values will be logged to the console. + * + * ```ts + * $inspect(x).with(console.trace); + * $inspect(x, y).with(() => { debugger; }); + * ``` + * + * https://svelte.dev/docs/svelte/$inspect + */ +declare function $inspect( + ...values: T +): { with: (fn: (type: 'init' | 'update', ...values: T) => void) => void }; + +declare namespace $inspect { + /** + * Tracks which reactive state changes caused an effect to re-run. Must be the first + * statement of a function body. Example: + * + * ```svelte + * + */ + export function trace(name?: string): void; + + // prevent intellisense from being unhelpful + /** @deprecated */ + export const apply: never; + /** @deprecated */ + // @ts-ignore + export const arguments: never; + /** @deprecated */ + export const bind: never; + /** @deprecated */ + export const call: never; + /** @deprecated */ + export const caller: never; + /** @deprecated */ + export const length: never; + /** @deprecated */ + export const name: never; + /** @deprecated */ + export const prototype: never; + /** @deprecated */ + export const toString: never; +} + +/** + * Retrieves the `this` reference of the custom element that contains this component. Example: + * + * ```svelte + * + * + * + * + * + * ``` + * + * Only available inside custom element components, and only on the client-side. + * + * https://svelte.dev/docs/svelte/$host + */ +declare function $host(): El; + +declare namespace $host { + // prevent intellisense from being unhelpful + /** @deprecated */ + export const apply: never; + /** @deprecated */ + // @ts-ignore + export const arguments: never; + /** @deprecated */ + export const bind: never; + /** @deprecated */ + export const call: never; + /** @deprecated */ + export const caller: never; + /** @deprecated */ + export const length: never; + /** @deprecated */ + export const name: never; + /** @deprecated */ + export const prototype: never; + /** @deprecated */ + export const toString: never; +} + +//# sourceMappingURL=index.d.ts.map diff --git a/node_modules/svelte/types/index.d.ts.map b/node_modules/svelte/types/index.d.ts.map new file mode 100644 index 00000000..846b6512 --- /dev/null +++ b/node_modules/svelte/types/index.d.ts.map @@ -0,0 +1,252 @@ +{ + "version": 3, + "file": "index.d.ts", + "names": [ + "ComponentConstructorOptions", + "SvelteComponent", + "ComponentInternals", + "Component", + "SvelteComponentTyped", + "ComponentEvents", + "ComponentProps", + "ComponentType", + "Snippet", + "EventDispatcher", + "MountOptions", + "onMount", + "onDestroy", + "createEventDispatcher", + "beforeUpdate", + "afterUpdate", + "flushSync", + "createRawSnippet", + "NotFunction", + "mount", + "hydrate", + "unmount", + "tick", + "untrack", + "getContext", + "setContext", + "hasContext", + "getAllContexts", + "Getters", + "ActionReturn", + "Action", + "AnimationConfig", + "FlipParams", + "flip", + "compile", + "compileModule", + "walk", + "Processed", + "MarkupPreprocessor", + "Preprocessor", + "PreprocessorGroup", + "CompileResult", + "Warning", + "CompileError", + "CssHashGetter", + "CompileOptions", + "ModuleCompileOptions", + "Namespace", + "AST", + "preprocess", + "VERSION", + "migrate", + "_CSS", + "linear", + "backInOut", + "backIn", + "backOut", + "bounceOut", + "bounceInOut", + "bounceIn", + "circInOut", + "circIn", + "circOut", + "cubicInOut", + "cubicIn", + "cubicOut", + "elasticInOut", + "elasticIn", + "elasticOut", + "expoInOut", + "expoIn", + "expoOut", + "quadInOut", + "quadIn", + "quadOut", + "quartInOut", + "quartIn", + "quartOut", + "quintInOut", + "quintIn", + "quintOut", + "sineInOut", + "sineIn", + "sineOut", + "createClassComponent", + "asClassComponent", + "run", + "handlers", + "createBubbler", + "LegacyComponentType", + "trusted", + "self", + "stopPropagation", + "once", + "stopImmediatePropagation", + "preventDefault", + "passive", + "nonpassive", + "Spring", + "Tweened", + "Subscriber", + "Unsubscriber", + "Readable", + "SpringOpts", + "SpringUpdateOpts", + "Updater", + "TweenedOptions", + "prefersReducedMotion", + "spring", + "tweened", + "Tween", + "SvelteDate", + "SvelteSet", + "SvelteMap", + "SvelteURL", + "REPLACE", + "SvelteURLSearchParams", + "MediaQuery", + "createSubscriber", + "ReactiveValue", + "scrollX", + "scrollY", + "innerWidth", + "innerHeight", + "outerWidth", + "outerHeight", + "screenLeft", + "screenTop", + "online", + "devicePixelRatio", + "render", + "RenderOutput", + "StartStopNotifier", + "Writable", + "readable", + "writable", + "readonly", + "get", + "EasingFunction", + "TransitionConfig", + "BlurParams", + "FadeParams", + "FlyParams", + "SlideParams", + "ScaleParams", + "DrawParams", + "CrossfadeParams", + "blur", + "fade", + "fly", + "slide", + "scale", + "draw", + "crossfade", + "on", + "SveltePreprocessor" + ], + "sources": [ + "../src/index.d.ts", + "../src/index-client.js", + "../src/internal/client/dom/blocks/snippet.js", + "../src/internal/types.d.ts", + "../src/internal/client/render.js", + "../src/internal/client/runtime.js", + "../src/internal/shared/types.d.ts", + "../src/action/public.d.ts", + "../src/animate/public.d.ts", + "../src/animate/index.js", + "../src/compiler/index.js", + "../src/compiler/preprocess/public.d.ts", + "../src/compiler/types/index.d.ts", + "../src/compiler/types/template.d.ts", + "../src/compiler/preprocess/index.js", + "../src/version.js", + "../src/compiler/migrate/index.js", + "../src/compiler/types/css.d.ts", + "../src/easing/index.js", + "../src/legacy/legacy-client.js", + "../src/internal/client/dom/legacy/event-modifiers.js", + "../src/motion/public.d.ts", + "../src/store/public.d.ts", + "../src/motion/private.d.ts", + "../src/motion/index.js", + "../src/motion/spring.js", + "../src/motion/tweened.js", + "../src/reactivity/date.js", + "../src/reactivity/set.js", + "../src/reactivity/map.js", + "../src/reactivity/url.js", + "../src/reactivity/url-search-params.js", + "../src/reactivity/media-query.js", + "../src/reactivity/create-subscriber.js", + "../src/reactivity/reactive-value.js", + "../src/reactivity/window/index.js", + "../src/server/index.d.ts", + "../src/internal/server/types.d.ts", + "../src/store/shared/index.js", + "../src/transition/public.d.ts", + "../src/transition/index.js", + "../src/events/public.d.ts" + ], + "sourcesContent": [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + "mappings": ";;;;;;;kBAUiBA,2BAA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiC/BC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;iBAiBJC,GAAGA;;;;;iBA2BHC,KAAKA;;;;;iBA2CLC,KAAKA;;;;;iBA2BLC,IAAIA;;;;;;;iBA+CJC,SAASA;;;;;;;;;;;;;;;;;;;iBCvKTC,EAAEA;;;;;;;;;;;iBAAFA,EAAEA;;;;;;;;;;;iBAAFA,EAAEA;;;;;;;;;;;iBAAFA,EAAEA;;;;;;;;;;;iBAAFA,EAAEA;;;;;;;;;;;;a9BzBNpH,kBAAkBA;;aAclBC,YAAYA;;aAsBPC,iBAAiBA;;aA3DjBH,SAASA;;aAuETsH,kBAAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aCVlB9G,cAAcA;;aAfdH,OAAOA;;;MAIZE,aAAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAoIRE,oBAAoBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MC9JzBC,SAASA", + "ignoreList": [] +} \ No newline at end of file diff --git a/node_modules/svelte2tsx/LICENSE b/node_modules/svelte2tsx/LICENSE new file mode 100644 index 00000000..16a4082b --- /dev/null +++ b/node_modules/svelte2tsx/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 David Pershouse + +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/svelte2tsx/README.md b/node_modules/svelte2tsx/README.md new file mode 100644 index 00000000..3d4a2473 --- /dev/null +++ b/node_modules/svelte2tsx/README.md @@ -0,0 +1,52 @@ +# svelte2tsx + +Converts [Svelte](https://svelte.dev) component source into TSX. The TSX can be type checked using the included `svelte-jsx.d.ts` and `svelte-shims.d.ts`. + +_This project only converts svelte to tsx, type checking is left to consumers of this plugin such as language services_ + +```typescript +type SvelteCompiledToTsx = { + code: string; + map: import('magic-string').SourceMap; +}; + +export default function svelte2tsx(svelte: string): SvelteCompiledToTsx; +``` + +For example + +Input.svelte + +```svelte + + +

    hello {world}

    +``` + +will produce this ugly but type checkable TSX + +```tsx +<>; +function render() { + let world = 'name'; + <> +

    hello {world}

    + ; + return { props: { world }, slots: {}, events: {} }; +} + +export default class _World_ extends __sveltets_2_createSvelte2TsxComponent( + __sveltets_2_partial(__sveltets_2_with_any_event(render)) +) {} +``` + +with a v3 SourceMap back to the original source. + +For more examples of the transformations, see the `test/**/samples` folders + +## Credits + +- [halfnelson](https://github.com/halfnelson) for creating `svelte2tsx` +- [pushkine](https://github.com/pushkine) for creating the source mapping test infrastructure diff --git a/node_modules/svelte2tsx/index.d.ts b/node_modules/svelte2tsx/index.d.ts new file mode 100644 index 00000000..87c2fda5 --- /dev/null +++ b/node_modules/svelte2tsx/index.d.ts @@ -0,0 +1,197 @@ +import ts from 'typescript'; + +export interface SvelteCompiledToTsx { + code: string; + map: import("magic-string").SourceMap; + exportedNames: IExportedNames; + /** + * @deprecated Use TypeScript's `TypeChecker` to get the type information instead. This only covers literal typings. + */ + events: ComponentEvents; +} + +export interface IExportedNames { + has(name: string): boolean; +} + +/** + * @deprecated Use TypeScript's `TypeChecker` to get the type information instead. This only covers literal typings. + */ +export interface ComponentEvents { + getAll(): { name: string; type: string; doc?: string }[]; +} + +export function svelte2tsx( + svelte: string, + options?: { + /** + * Path of the file + */ + filename?: string; + /** + * If the given file uses TypeScript inside script. + * This cannot be inferred from `svelte2tsx` by looking + * at the attributes of the script tag because the + * user may have set a default-language through + * `svelte-preprocess`. + */ + isTsFile?: boolean; + /** + * Whether to try emitting result when there's a syntax error in the template + */ + emitOnTemplateError?: boolean; + /** + * The namespace option from svelte config + * see https://svelte.dev/docs#svelte_compile for more info + */ + namespace?: string; + /** + * When setting this to 'dts', all ts/js code and the template code will be thrown out. + * Only the `code` property will be set on the returned element. + * Use this as an intermediate step to generate type definitions from a component. + * It is expected to pass the result to TypeScript which should handle emitting the d.ts files. + * The shims need to be provided by the user ambient-style, + * for example through `filenames.push(require.resolve('svelte2tsx/svelte-shims.d.ts'))`. + * If you pass 'ts', it uses the regular Svelte->TS/JS transformation. + * + * @default 'ts' + */ + mode?: 'ts' | 'dts', + /** + * Tells svelte2tsx from which namespace some specific functions to use. + * + * Example: 'svelteHTML' -> svelteHTML.createElement<..>(..) + * + * A namespace needs to implement the following functions: + * - `createElement(str: string, validAttributes: ..): Element` + * - `mapElementTag(str: Key): YourElements[Key]` + * + * @default 'svelteHTML' + */ + typingsNamespace?: string; + /** + * The accessor option from svelte config. + * Would be overridden by the same config in the svelte:option element if exist + * see https://svelte.dev/docs#svelte_compile for more info + */ + accessors?: boolean + /** + * The Svelte parser to use. Defaults to the one bundled with `svelte2tsx`. + */ + parse?: typeof import('svelte/compiler').parse; + /** + * The VERSION from 'svelte/compiler'. Defaults to the one bundled with `svelte2tsx`. + * Transpiled output may vary between versions. + */ + version?: string; + } +): SvelteCompiledToTsx + +export interface EmitDtsConfig { + /** + * Where to output the declaration files + */ + declarationDir: string; + /** + * Path to `svelte-shims.d.ts` of `svelte2tsx`. + * Example: `require.resolve('svelte2tsx/svelte-shims.d.ts')` + * + * If a path is given that points to `svelte-shims-v4.d.ts`, + * the `SvelteComponent` import is used instead of + * `SvelteComponentTyped` which is deprecated in Svelte v4. + */ + svelteShimsPath: string; + /** + * If you want to emit types only for part of your project, + * then set this to the folder for which the types should be emitted. + * Most of the time you don't need this. For SvelteKit, this is for example + * set to `src/lib` by default. + */ + libRoot?: string; + /** + * Name of your tsconfig file, if it's not the standard `tsconfig.json` or `jsconfig.json` + */ + tsconfig?: string; +} + +// to make typo fix non-breaking, continue to export the old name but mark it as deprecated +/**@deprecated*/ +export interface EmitDtsConig extends EmitDtsConfig {} + +/** + * Searches for a jsconfig or tsconfig starting at `root` and emits d.ts files + * into `declarationDir` using the ambient file from `svelteShimsPath`. + * Note: Handwritten `d.ts` files are not copied over; TypeScript does not + * touch these files. + */ +export function emitDts(config: EmitDtsConfig): Promise; + + +/** + * ## Internal, do not use! This is subject to change at any time. + * + * Implementation notice: If one of the methods use a TypeScript function which is not from the + * static top level `ts` namespace, it must be passed as a parameter. + */ +export const internalHelpers: { + get_global_types: ( + tsSystem: ts.System, + isSvelte3: boolean, + sveltePath: string, + typesPath: string, + hiddenFolderPath?: string, + ) => string[], + isKitFile: ( + fileName: string, + options: InternalHelpers.KitFilesSettings + ) => boolean; + isKitRouteFile: (basename: string) => boolean, + isHooksFile: ( + fileName: string, + basename: string, + hooksPath: string + ) => boolean, + isParamsFile: (fileName: string, basename: string, paramsPath: string) =>boolean, + upsertKitFile: ( + _ts: typeof ts, + fileName: string, + kitFilesSettings: InternalHelpers.KitFilesSettings, + getSource: () => ts.SourceFile | undefined, + surround?: (code: string) => string + ) => { text: string; addedCode: InternalHelpers.AddedCode[] } | undefined, + toVirtualPos: (pos: number, addedCode: InternalHelpers.AddedCode[]) => number, + toOriginalPos: (pos: number, addedCode: InternalHelpers.AddedCode[]) => {pos: number; inGenerated: boolean}, + findExports: (_ts: typeof ts, source: ts.SourceFile, isTsFile: boolean) => Map< + string, + | { + type: 'function'; + node: ts.FunctionDeclaration | ts.ArrowFunction | ts.FunctionExpression; + hasTypeDefinition: boolean; + } + | { + type: 'var'; + node: ts.VariableDeclaration; + hasTypeDefinition: boolean; + } + >, +}; + +/** + * ## Internal, do not use! This is subject to change at any time. + */ +export namespace InternalHelpers { + export interface AddedCode { + generatedPos: number; + originalPos: number; + length: number; + total: number; + inserted: string; + } + + export interface KitFilesSettings { + serverHooksPath: string; + clientHooksPath: string; + universalHooksPath: string; + paramsPath: string; + } +} diff --git a/node_modules/svelte2tsx/index.js b/node_modules/svelte2tsx/index.js new file mode 100644 index 00000000..bf34c266 --- /dev/null +++ b/node_modules/svelte2tsx/index.js @@ -0,0 +1,8137 @@ +'use strict'; + +var dedent = require('dedent-js'); +var ts = require('typescript'); +var pascalCase = require('pascal-case'); +var path = require('path'); +var compiler = require('svelte/compiler'); + +function _interopNamespaceDefault(e) { + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n.default = e; + return Object.freeze(n); +} + +var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path); + +const comma = ','.charCodeAt(0); +const semicolon = ';'.charCodeAt(0); +const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; +const intToChar = new Uint8Array(64); // 64 possible chars. +const charToInt = new Uint8Array(128); // z is 122 in ASCII +for (let i = 0; i < chars.length; i++) { + const c = chars.charCodeAt(i); + intToChar[i] = c; + charToInt[c] = i; +} +function encodeInteger(builder, num, relative) { + let delta = num - relative; + delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; + do { + let clamped = delta & 0b011111; + delta >>>= 5; + if (delta > 0) + clamped |= 0b100000; + builder.write(intToChar[clamped]); + } while (delta > 0); + return num; +} + +const bufLength = 1024 * 16; +// Provide a fallback for older environments. +const td = typeof TextDecoder !== 'undefined' + ? /* #__PURE__ */ new TextDecoder() + : typeof Buffer !== 'undefined' + ? { + decode(buf) { + const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); + return out.toString(); + }, + } + : { + decode(buf) { + let out = ''; + for (let i = 0; i < buf.length; i++) { + out += String.fromCharCode(buf[i]); + } + return out; + }, + }; +class StringWriter { + constructor() { + this.pos = 0; + this.out = ''; + this.buffer = new Uint8Array(bufLength); + } + write(v) { + const { buffer } = this; + buffer[this.pos++] = v; + if (this.pos === bufLength) { + this.out += td.decode(buffer); + this.pos = 0; + } + } + flush() { + const { buffer, out, pos } = this; + return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; + } +} +function encode(decoded) { + const writer = new StringWriter(); + let sourcesIndex = 0; + let sourceLine = 0; + let sourceColumn = 0; + let namesIndex = 0; + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + if (i > 0) + writer.write(semicolon); + if (line.length === 0) + continue; + let genColumn = 0; + for (let j = 0; j < line.length; j++) { + const segment = line[j]; + if (j > 0) + writer.write(comma); + genColumn = encodeInteger(writer, segment[0], genColumn); + if (segment.length === 1) + continue; + sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); + sourceLine = encodeInteger(writer, segment[2], sourceLine); + sourceColumn = encodeInteger(writer, segment[3], sourceColumn); + if (segment.length === 4) + continue; + namesIndex = encodeInteger(writer, segment[4], namesIndex); + } + } + return writer.flush(); +} + +class BitSet { + constructor(arg) { + this.bits = arg instanceof BitSet ? arg.bits.slice() : []; + } + + add(n) { + this.bits[n >> 5] |= 1 << (n & 31); + } + + has(n) { + return !!(this.bits[n >> 5] & (1 << (n & 31))); + } +} + +class Chunk { + constructor(start, end, content) { + this.start = start; + this.end = end; + this.original = content; + + this.intro = ''; + this.outro = ''; + + this.content = content; + this.storeName = false; + this.edited = false; + + { + this.previous = null; + this.next = null; + } + } + + appendLeft(content) { + this.outro += content; + } + + appendRight(content) { + this.intro = this.intro + content; + } + + clone() { + const chunk = new Chunk(this.start, this.end, this.original); + + chunk.intro = this.intro; + chunk.outro = this.outro; + chunk.content = this.content; + chunk.storeName = this.storeName; + chunk.edited = this.edited; + + return chunk; + } + + contains(index) { + return this.start < index && index < this.end; + } + + eachNext(fn) { + let chunk = this; + while (chunk) { + fn(chunk); + chunk = chunk.next; + } + } + + eachPrevious(fn) { + let chunk = this; + while (chunk) { + fn(chunk); + chunk = chunk.previous; + } + } + + edit(content, storeName, contentOnly) { + this.content = content; + if (!contentOnly) { + this.intro = ''; + this.outro = ''; + } + this.storeName = storeName; + + this.edited = true; + + return this; + } + + prependLeft(content) { + this.outro = content + this.outro; + } + + prependRight(content) { + this.intro = content + this.intro; + } + + reset() { + this.intro = ''; + this.outro = ''; + if (this.edited) { + this.content = this.original; + this.storeName = false; + this.edited = false; + } + } + + split(index) { + const sliceIndex = index - this.start; + + const originalBefore = this.original.slice(0, sliceIndex); + const originalAfter = this.original.slice(sliceIndex); + + this.original = originalBefore; + + const newChunk = new Chunk(index, this.end, originalAfter); + newChunk.outro = this.outro; + this.outro = ''; + + this.end = index; + + if (this.edited) { + // after split we should save the edit content record into the correct chunk + // to make sure sourcemap correct + // For example: + // ' test'.trim() + // split -> ' ' + 'test' + // ✔️ edit -> '' + 'test' + // ✖️ edit -> 'test' + '' + // TODO is this block necessary?... + newChunk.edit('', false); + this.content = ''; + } else { + this.content = originalBefore; + } + + newChunk.next = this.next; + if (newChunk.next) newChunk.next.previous = newChunk; + newChunk.previous = this; + this.next = newChunk; + + return newChunk; + } + + toString() { + return this.intro + this.content + this.outro; + } + + trimEnd(rx) { + this.outro = this.outro.replace(rx, ''); + if (this.outro.length) return true; + + const trimmed = this.content.replace(rx, ''); + + if (trimmed.length) { + if (trimmed !== this.content) { + this.split(this.start + trimmed.length).edit('', undefined, true); + if (this.edited) { + // save the change, if it has been edited + this.edit(trimmed, this.storeName, true); + } + } + return true; + } else { + this.edit('', undefined, true); + + this.intro = this.intro.replace(rx, ''); + if (this.intro.length) return true; + } + } + + trimStart(rx) { + this.intro = this.intro.replace(rx, ''); + if (this.intro.length) return true; + + const trimmed = this.content.replace(rx, ''); + + if (trimmed.length) { + if (trimmed !== this.content) { + const newChunk = this.split(this.end - trimmed.length); + if (this.edited) { + // save the change, if it has been edited + newChunk.edit(trimmed, this.storeName, true); + } + this.edit('', undefined, true); + } + return true; + } else { + this.edit('', undefined, true); + + this.outro = this.outro.replace(rx, ''); + if (this.outro.length) return true; + } + } +} + +function getBtoa() { + if (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') { + return (str) => globalThis.btoa(unescape(encodeURIComponent(str))); + } else if (typeof Buffer === 'function') { + return (str) => Buffer.from(str, 'utf-8').toString('base64'); + } else { + return () => { + throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.'); + }; + } +} + +const btoa = /*#__PURE__*/ getBtoa(); + +class SourceMap { + constructor(properties) { + this.version = 3; + this.file = properties.file; + this.sources = properties.sources; + this.sourcesContent = properties.sourcesContent; + this.names = properties.names; + this.mappings = encode(properties.mappings); + if (typeof properties.x_google_ignoreList !== 'undefined') { + this.x_google_ignoreList = properties.x_google_ignoreList; + } + } + + toString() { + return JSON.stringify(this); + } + + toUrl() { + return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString()); + } +} + +function guessIndent(code) { + const lines = code.split('\n'); + + const tabbed = lines.filter((line) => /^\t+/.test(line)); + const spaced = lines.filter((line) => /^ {2,}/.test(line)); + + if (tabbed.length === 0 && spaced.length === 0) { + return null; + } + + // More lines tabbed than spaced? Assume tabs, and + // default to tabs in the case of a tie (or nothing + // to go on) + if (tabbed.length >= spaced.length) { + return '\t'; + } + + // Otherwise, we need to guess the multiple + const min = spaced.reduce((previous, current) => { + const numSpaces = /^ +/.exec(current)[0].length; + return Math.min(numSpaces, previous); + }, Infinity); + + return new Array(min + 1).join(' '); +} + +function getRelativePath(from, to) { + const fromParts = from.split(/[/\\]/); + const toParts = to.split(/[/\\]/); + + fromParts.pop(); // get dirname + + while (fromParts[0] === toParts[0]) { + fromParts.shift(); + toParts.shift(); + } + + if (fromParts.length) { + let i = fromParts.length; + while (i--) fromParts[i] = '..'; + } + + return fromParts.concat(toParts).join('/'); +} + +const toString = Object.prototype.toString; + +function isObject(thing) { + return toString.call(thing) === '[object Object]'; +} + +function getLocator(source) { + const originalLines = source.split('\n'); + const lineOffsets = []; + + for (let i = 0, pos = 0; i < originalLines.length; i++) { + lineOffsets.push(pos); + pos += originalLines[i].length + 1; + } + + return function locate(index) { + let i = 0; + let j = lineOffsets.length; + while (i < j) { + const m = (i + j) >> 1; + if (index < lineOffsets[m]) { + j = m; + } else { + i = m + 1; + } + } + const line = i - 1; + const column = index - lineOffsets[line]; + return { line, column }; + }; +} + +const wordRegex = /\w/; + +class Mappings { + constructor(hires) { + this.hires = hires; + this.generatedCodeLine = 0; + this.generatedCodeColumn = 0; + this.raw = []; + this.rawSegments = this.raw[this.generatedCodeLine] = []; + this.pending = null; + } + + addEdit(sourceIndex, content, loc, nameIndex) { + if (content.length) { + const contentLengthMinusOne = content.length - 1; + let contentLineEnd = content.indexOf('\n', 0); + let previousContentLineEnd = -1; + // Loop through each line in the content and add a segment, but stop if the last line is empty, + // else code afterwards would fill one line too many + while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) { + const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; + if (nameIndex >= 0) { + segment.push(nameIndex); + } + this.rawSegments.push(segment); + + this.generatedCodeLine += 1; + this.raw[this.generatedCodeLine] = this.rawSegments = []; + this.generatedCodeColumn = 0; + + previousContentLineEnd = contentLineEnd; + contentLineEnd = content.indexOf('\n', contentLineEnd + 1); + } + + const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; + if (nameIndex >= 0) { + segment.push(nameIndex); + } + this.rawSegments.push(segment); + + this.advance(content.slice(previousContentLineEnd + 1)); + } else if (this.pending) { + this.rawSegments.push(this.pending); + this.advance(content); + } + + this.pending = null; + } + + addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) { + let originalCharIndex = chunk.start; + let first = true; + // when iterating each char, check if it's in a word boundary + let charInHiresBoundary = false; + + while (originalCharIndex < chunk.end) { + if (this.hires || first || sourcemapLocations.has(originalCharIndex)) { + const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; + + if (this.hires === 'boundary') { + // in hires "boundary", group segments per word boundary than per char + if (wordRegex.test(original[originalCharIndex])) { + // for first char in the boundary found, start the boundary by pushing a segment + if (!charInHiresBoundary) { + this.rawSegments.push(segment); + charInHiresBoundary = true; + } + } else { + // for non-word char, end the boundary by pushing a segment + this.rawSegments.push(segment); + charInHiresBoundary = false; + } + } else { + this.rawSegments.push(segment); + } + } + + if (original[originalCharIndex] === '\n') { + loc.line += 1; + loc.column = 0; + this.generatedCodeLine += 1; + this.raw[this.generatedCodeLine] = this.rawSegments = []; + this.generatedCodeColumn = 0; + first = true; + } else { + loc.column += 1; + this.generatedCodeColumn += 1; + first = false; + } + + originalCharIndex += 1; + } + + this.pending = null; + } + + advance(str) { + if (!str) return; + + const lines = str.split('\n'); + + if (lines.length > 1) { + for (let i = 0; i < lines.length - 1; i++) { + this.generatedCodeLine++; + this.raw[this.generatedCodeLine] = this.rawSegments = []; + } + this.generatedCodeColumn = 0; + } + + this.generatedCodeColumn += lines[lines.length - 1].length; + } +} + +const n = '\n'; + +const warned = { + insertLeft: false, + insertRight: false, + storeName: false, +}; + +class MagicString { + constructor(string, options = {}) { + const chunk = new Chunk(0, string.length, string); + + Object.defineProperties(this, { + original: { writable: true, value: string }, + outro: { writable: true, value: '' }, + intro: { writable: true, value: '' }, + firstChunk: { writable: true, value: chunk }, + lastChunk: { writable: true, value: chunk }, + lastSearchedChunk: { writable: true, value: chunk }, + byStart: { writable: true, value: {} }, + byEnd: { writable: true, value: {} }, + filename: { writable: true, value: options.filename }, + indentExclusionRanges: { writable: true, value: options.indentExclusionRanges }, + sourcemapLocations: { writable: true, value: new BitSet() }, + storedNames: { writable: true, value: {} }, + indentStr: { writable: true, value: undefined }, + ignoreList: { writable: true, value: options.ignoreList }, + }); + + this.byStart[0] = chunk; + this.byEnd[string.length] = chunk; + } + + addSourcemapLocation(char) { + this.sourcemapLocations.add(char); + } + + append(content) { + if (typeof content !== 'string') throw new TypeError('outro content must be a string'); + + this.outro += content; + return this; + } + + appendLeft(index, content) { + if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); + + this._split(index); + + const chunk = this.byEnd[index]; + + if (chunk) { + chunk.appendLeft(content); + } else { + this.intro += content; + } + return this; + } + + appendRight(index, content) { + if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); + + this._split(index); + + const chunk = this.byStart[index]; + + if (chunk) { + chunk.appendRight(content); + } else { + this.outro += content; + } + return this; + } + + clone() { + const cloned = new MagicString(this.original, { filename: this.filename }); + + let originalChunk = this.firstChunk; + let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone()); + + while (originalChunk) { + cloned.byStart[clonedChunk.start] = clonedChunk; + cloned.byEnd[clonedChunk.end] = clonedChunk; + + const nextOriginalChunk = originalChunk.next; + const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone(); + + if (nextClonedChunk) { + clonedChunk.next = nextClonedChunk; + nextClonedChunk.previous = clonedChunk; + + clonedChunk = nextClonedChunk; + } + + originalChunk = nextOriginalChunk; + } + + cloned.lastChunk = clonedChunk; + + if (this.indentExclusionRanges) { + cloned.indentExclusionRanges = this.indentExclusionRanges.slice(); + } + + cloned.sourcemapLocations = new BitSet(this.sourcemapLocations); + + cloned.intro = this.intro; + cloned.outro = this.outro; + + return cloned; + } + + generateDecodedMap(options) { + options = options || {}; + + const sourceIndex = 0; + const names = Object.keys(this.storedNames); + const mappings = new Mappings(options.hires); + + const locate = getLocator(this.original); + + if (this.intro) { + mappings.advance(this.intro); + } + + this.firstChunk.eachNext((chunk) => { + const loc = locate(chunk.start); + + if (chunk.intro.length) mappings.advance(chunk.intro); + + if (chunk.edited) { + mappings.addEdit( + sourceIndex, + chunk.content, + loc, + chunk.storeName ? names.indexOf(chunk.original) : -1, + ); + } else { + mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations); + } + + if (chunk.outro.length) mappings.advance(chunk.outro); + }); + + return { + file: options.file ? options.file.split(/[/\\]/).pop() : undefined, + sources: [ + options.source ? getRelativePath(options.file || '', options.source) : options.file || '', + ], + sourcesContent: options.includeContent ? [this.original] : undefined, + names, + mappings: mappings.raw, + x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined, + }; + } + + generateMap(options) { + return new SourceMap(this.generateDecodedMap(options)); + } + + _ensureindentStr() { + if (this.indentStr === undefined) { + this.indentStr = guessIndent(this.original); + } + } + + _getRawIndentString() { + this._ensureindentStr(); + return this.indentStr; + } + + getIndentString() { + this._ensureindentStr(); + return this.indentStr === null ? '\t' : this.indentStr; + } + + indent(indentStr, options) { + const pattern = /^[^\r\n]/gm; + + if (isObject(indentStr)) { + options = indentStr; + indentStr = undefined; + } + + if (indentStr === undefined) { + this._ensureindentStr(); + indentStr = this.indentStr || '\t'; + } + + if (indentStr === '') return this; // noop + + options = options || {}; + + // Process exclusion ranges + const isExcluded = {}; + + if (options.exclude) { + const exclusions = + typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude; + exclusions.forEach((exclusion) => { + for (let i = exclusion[0]; i < exclusion[1]; i += 1) { + isExcluded[i] = true; + } + }); + } + + let shouldIndentNextCharacter = options.indentStart !== false; + const replacer = (match) => { + if (shouldIndentNextCharacter) return `${indentStr}${match}`; + shouldIndentNextCharacter = true; + return match; + }; + + this.intro = this.intro.replace(pattern, replacer); + + let charIndex = 0; + let chunk = this.firstChunk; + + while (chunk) { + const end = chunk.end; + + if (chunk.edited) { + if (!isExcluded[charIndex]) { + chunk.content = chunk.content.replace(pattern, replacer); + + if (chunk.content.length) { + shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n'; + } + } + } else { + charIndex = chunk.start; + + while (charIndex < end) { + if (!isExcluded[charIndex]) { + const char = this.original[charIndex]; + + if (char === '\n') { + shouldIndentNextCharacter = true; + } else if (char !== '\r' && shouldIndentNextCharacter) { + shouldIndentNextCharacter = false; + + if (charIndex === chunk.start) { + chunk.prependRight(indentStr); + } else { + this._splitChunk(chunk, charIndex); + chunk = chunk.next; + chunk.prependRight(indentStr); + } + } + } + + charIndex += 1; + } + } + + charIndex = chunk.end; + chunk = chunk.next; + } + + this.outro = this.outro.replace(pattern, replacer); + + return this; + } + + insert() { + throw new Error( + 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)', + ); + } + + insertLeft(index, content) { + if (!warned.insertLeft) { + console.warn( + 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead', + ); // eslint-disable-line no-console + warned.insertLeft = true; + } + + return this.appendLeft(index, content); + } + + insertRight(index, content) { + if (!warned.insertRight) { + console.warn( + 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead', + ); // eslint-disable-line no-console + warned.insertRight = true; + } + + return this.prependRight(index, content); + } + + move(start, end, index) { + if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself'); + + this._split(start); + this._split(end); + this._split(index); + + const first = this.byStart[start]; + const last = this.byEnd[end]; + + const oldLeft = first.previous; + const oldRight = last.next; + + const newRight = this.byStart[index]; + if (!newRight && last === this.lastChunk) return this; + const newLeft = newRight ? newRight.previous : this.lastChunk; + + if (oldLeft) oldLeft.next = oldRight; + if (oldRight) oldRight.previous = oldLeft; + + if (newLeft) newLeft.next = first; + if (newRight) newRight.previous = last; + + if (!first.previous) this.firstChunk = last.next; + if (!last.next) { + this.lastChunk = first.previous; + this.lastChunk.next = null; + } + + first.previous = newLeft; + last.next = newRight || null; + + if (!newLeft) this.firstChunk = first; + if (!newRight) this.lastChunk = last; + return this; + } + + overwrite(start, end, content, options) { + options = options || {}; + return this.update(start, end, content, { ...options, overwrite: !options.contentOnly }); + } + + update(start, end, content, options) { + if (typeof content !== 'string') throw new TypeError('replacement content must be a string'); + + if (this.original.length !== 0) { + while (start < 0) start += this.original.length; + while (end < 0) end += this.original.length; + } + + if (end > this.original.length) throw new Error('end is out of bounds'); + if (start === end) + throw new Error( + 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead', + ); + + this._split(start); + this._split(end); + + if (options === true) { + if (!warned.storeName) { + console.warn( + 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string', + ); // eslint-disable-line no-console + warned.storeName = true; + } + + options = { storeName: true }; + } + const storeName = options !== undefined ? options.storeName : false; + const overwrite = options !== undefined ? options.overwrite : false; + + if (storeName) { + const original = this.original.slice(start, end); + Object.defineProperty(this.storedNames, original, { + writable: true, + value: true, + enumerable: true, + }); + } + + const first = this.byStart[start]; + const last = this.byEnd[end]; + + if (first) { + let chunk = first; + while (chunk !== last) { + if (chunk.next !== this.byStart[chunk.end]) { + throw new Error('Cannot overwrite across a split point'); + } + chunk = chunk.next; + chunk.edit('', false); + } + + first.edit(content, storeName, !overwrite); + } else { + // must be inserting at the end + const newChunk = new Chunk(start, end, '').edit(content, storeName); + + // TODO last chunk in the array may not be the last chunk, if it's moved... + last.next = newChunk; + newChunk.previous = last; + } + return this; + } + + prepend(content) { + if (typeof content !== 'string') throw new TypeError('outro content must be a string'); + + this.intro = content + this.intro; + return this; + } + + prependLeft(index, content) { + if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); + + this._split(index); + + const chunk = this.byEnd[index]; + + if (chunk) { + chunk.prependLeft(content); + } else { + this.intro = content + this.intro; + } + return this; + } + + prependRight(index, content) { + if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); + + this._split(index); + + const chunk = this.byStart[index]; + + if (chunk) { + chunk.prependRight(content); + } else { + this.outro = content + this.outro; + } + return this; + } + + remove(start, end) { + if (this.original.length !== 0) { + while (start < 0) start += this.original.length; + while (end < 0) end += this.original.length; + } + + if (start === end) return this; + + if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds'); + if (start > end) throw new Error('end must be greater than start'); + + this._split(start); + this._split(end); + + let chunk = this.byStart[start]; + + while (chunk) { + chunk.intro = ''; + chunk.outro = ''; + chunk.edit(''); + + chunk = end > chunk.end ? this.byStart[chunk.end] : null; + } + return this; + } + + reset(start, end) { + if (this.original.length !== 0) { + while (start < 0) start += this.original.length; + while (end < 0) end += this.original.length; + } + + if (start === end) return this; + + if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds'); + if (start > end) throw new Error('end must be greater than start'); + + this._split(start); + this._split(end); + + let chunk = this.byStart[start]; + + while (chunk) { + chunk.reset(); + + chunk = end > chunk.end ? this.byStart[chunk.end] : null; + } + return this; + } + + lastChar() { + if (this.outro.length) return this.outro[this.outro.length - 1]; + let chunk = this.lastChunk; + do { + if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1]; + if (chunk.content.length) return chunk.content[chunk.content.length - 1]; + if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1]; + } while ((chunk = chunk.previous)); + if (this.intro.length) return this.intro[this.intro.length - 1]; + return ''; + } + + lastLine() { + let lineIndex = this.outro.lastIndexOf(n); + if (lineIndex !== -1) return this.outro.substr(lineIndex + 1); + let lineStr = this.outro; + let chunk = this.lastChunk; + do { + if (chunk.outro.length > 0) { + lineIndex = chunk.outro.lastIndexOf(n); + if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr; + lineStr = chunk.outro + lineStr; + } + + if (chunk.content.length > 0) { + lineIndex = chunk.content.lastIndexOf(n); + if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr; + lineStr = chunk.content + lineStr; + } + + if (chunk.intro.length > 0) { + lineIndex = chunk.intro.lastIndexOf(n); + if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr; + lineStr = chunk.intro + lineStr; + } + } while ((chunk = chunk.previous)); + lineIndex = this.intro.lastIndexOf(n); + if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr; + return this.intro + lineStr; + } + + slice(start = 0, end = this.original.length) { + if (this.original.length !== 0) { + while (start < 0) start += this.original.length; + while (end < 0) end += this.original.length; + } + + let result = ''; + + // find start chunk + let chunk = this.firstChunk; + while (chunk && (chunk.start > start || chunk.end <= start)) { + // found end chunk before start + if (chunk.start < end && chunk.end >= end) { + return result; + } + + chunk = chunk.next; + } + + if (chunk && chunk.edited && chunk.start !== start) + throw new Error(`Cannot use replaced character ${start} as slice start anchor.`); + + const startChunk = chunk; + while (chunk) { + if (chunk.intro && (startChunk !== chunk || chunk.start === start)) { + result += chunk.intro; + } + + const containsEnd = chunk.start < end && chunk.end >= end; + if (containsEnd && chunk.edited && chunk.end !== end) + throw new Error(`Cannot use replaced character ${end} as slice end anchor.`); + + const sliceStart = startChunk === chunk ? start - chunk.start : 0; + const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length; + + result += chunk.content.slice(sliceStart, sliceEnd); + + if (chunk.outro && (!containsEnd || chunk.end === end)) { + result += chunk.outro; + } + + if (containsEnd) { + break; + } + + chunk = chunk.next; + } + + return result; + } + + // TODO deprecate this? not really very useful + snip(start, end) { + const clone = this.clone(); + clone.remove(0, start); + clone.remove(end, clone.original.length); + + return clone; + } + + _split(index) { + if (this.byStart[index] || this.byEnd[index]) return; + + let chunk = this.lastSearchedChunk; + const searchForward = index > chunk.end; + + while (chunk) { + if (chunk.contains(index)) return this._splitChunk(chunk, index); + + chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start]; + } + } + + _splitChunk(chunk, index) { + if (chunk.edited && chunk.content.length) { + // zero-length edited chunks are a special case (overlapping replacements) + const loc = getLocator(this.original)(index); + throw new Error( + `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`, + ); + } + + const newChunk = chunk.split(index); + + this.byEnd[index] = chunk; + this.byStart[index] = newChunk; + this.byEnd[newChunk.end] = newChunk; + + if (chunk === this.lastChunk) this.lastChunk = newChunk; + + this.lastSearchedChunk = chunk; + return true; + } + + toString() { + let str = this.intro; + + let chunk = this.firstChunk; + while (chunk) { + str += chunk.toString(); + chunk = chunk.next; + } + + return str + this.outro; + } + + isEmpty() { + let chunk = this.firstChunk; + do { + if ( + (chunk.intro.length && chunk.intro.trim()) || + (chunk.content.length && chunk.content.trim()) || + (chunk.outro.length && chunk.outro.trim()) + ) + return false; + } while ((chunk = chunk.next)); + return true; + } + + length() { + let chunk = this.firstChunk; + let length = 0; + do { + length += chunk.intro.length + chunk.content.length + chunk.outro.length; + } while ((chunk = chunk.next)); + return length; + } + + trimLines() { + return this.trim('[\\r\\n]'); + } + + trim(charType) { + return this.trimStart(charType).trimEnd(charType); + } + + trimEndAborted(charType) { + const rx = new RegExp((charType || '\\s') + '+$'); + + this.outro = this.outro.replace(rx, ''); + if (this.outro.length) return true; + + let chunk = this.lastChunk; + + do { + const end = chunk.end; + const aborted = chunk.trimEnd(rx); + + // if chunk was trimmed, we have a new lastChunk + if (chunk.end !== end) { + if (this.lastChunk === chunk) { + this.lastChunk = chunk.next; + } + + this.byEnd[chunk.end] = chunk; + this.byStart[chunk.next.start] = chunk.next; + this.byEnd[chunk.next.end] = chunk.next; + } + + if (aborted) return true; + chunk = chunk.previous; + } while (chunk); + + return false; + } + + trimEnd(charType) { + this.trimEndAborted(charType); + return this; + } + trimStartAborted(charType) { + const rx = new RegExp('^' + (charType || '\\s') + '+'); + + this.intro = this.intro.replace(rx, ''); + if (this.intro.length) return true; + + let chunk = this.firstChunk; + + do { + const end = chunk.end; + const aborted = chunk.trimStart(rx); + + if (chunk.end !== end) { + // special case... + if (chunk === this.lastChunk) this.lastChunk = chunk.next; + + this.byEnd[chunk.end] = chunk; + this.byStart[chunk.next.start] = chunk.next; + this.byEnd[chunk.next.end] = chunk.next; + } + + if (aborted) return true; + chunk = chunk.next; + } while (chunk); + + return false; + } + + trimStart(charType) { + this.trimStartAborted(charType); + return this; + } + + hasChanged() { + return this.original !== this.toString(); + } + + _replaceRegexp(searchValue, replacement) { + function getReplacement(match, str) { + if (typeof replacement === 'string') { + return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => { + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter + if (i === '$') return '$'; + if (i === '&') return match[0]; + const num = +i; + if (num < match.length) return match[+i]; + return `$${i}`; + }); + } else { + return replacement(...match, match.index, str, match.groups); + } + } + function matchAll(re, str) { + let match; + const matches = []; + while ((match = re.exec(str))) { + matches.push(match); + } + return matches; + } + if (searchValue.global) { + const matches = matchAll(searchValue, this.original); + matches.forEach((match) => { + if (match.index != null) { + const replacement = getReplacement(match, this.original); + if (replacement !== match[0]) { + this.overwrite( + match.index, + match.index + match[0].length, + replacement + ); + } + } + }); + } else { + const match = this.original.match(searchValue); + if (match && match.index != null) { + const replacement = getReplacement(match, this.original); + if (replacement !== match[0]) { + this.overwrite( + match.index, + match.index + match[0].length, + replacement + ); + } + } + } + return this; + } + + _replaceString(string, replacement) { + const { original } = this; + const index = original.indexOf(string); + + if (index !== -1) { + this.overwrite(index, index + string.length, replacement); + } + + return this; + } + + replace(searchValue, replacement) { + if (typeof searchValue === 'string') { + return this._replaceString(searchValue, replacement); + } + + return this._replaceRegexp(searchValue, replacement); + } + + _replaceAllString(string, replacement) { + const { original } = this; + const stringLength = string.length; + for ( + let index = original.indexOf(string); + index !== -1; + index = original.indexOf(string, index + stringLength) + ) { + const previous = original.slice(index, index + stringLength); + if (previous !== replacement) + this.overwrite(index, index + stringLength, replacement); + } + + return this; + } + + replaceAll(searchValue, replacement) { + if (typeof searchValue === 'string') { + return this._replaceAllString(searchValue, replacement); + } + + if (!searchValue.global) { + throw new TypeError( + 'MagicString.prototype.replaceAll called with a non-global RegExp argument', + ); + } + + return this._replaceRegexp(searchValue, replacement); + } +} + +// @ts-check +/** @typedef { import('estree').BaseNode} BaseNode */ + +/** @typedef {{ + skip: () => void; + remove: () => void; + replace: (node: BaseNode) => void; +}} WalkerContext */ + +class WalkerBase { + constructor() { + /** @type {boolean} */ + this.should_skip = false; + + /** @type {boolean} */ + this.should_remove = false; + + /** @type {BaseNode | null} */ + this.replacement = null; + + /** @type {WalkerContext} */ + this.context = { + skip: () => (this.should_skip = true), + remove: () => (this.should_remove = true), + replace: (node) => (this.replacement = node) + }; + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + * @param {BaseNode} node + */ + replace(parent, prop, index, node) { + if (parent) { + if (index !== null) { + parent[prop][index] = node; + } else { + parent[prop] = node; + } + } + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + */ + remove(parent, prop, index) { + if (parent) { + if (index !== null) { + parent[prop].splice(index, 1); + } else { + delete parent[prop]; + } + } + } +} + +// @ts-check + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker.js').WalkerContext} WalkerContext */ + +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => void} SyncHandler */ + +class SyncWalker extends WalkerBase { + /** + * + * @param {SyncHandler} enter + * @param {SyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {SyncHandler} */ + this.enter = enter; + + /** @type {SyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {BaseNode} + */ + visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!this.visit(value[i], node, key, i)) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } +} + +// @ts-check + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./sync.js').SyncHandler} SyncHandler */ +/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */ + +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: SyncHandler + * leave?: SyncHandler + * }} walker + * @returns {BaseNode} + */ +function walk(ast, { enter, leave }) { + const instance = new SyncWalker(enter, leave); + return instance.visit(ast, null); +} + +function parseAttributes(str, start) { + const attrs = []; + const pattern = /([\w-$]+\b)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g; + let match; + while ((match = pattern.exec(str)) !== null) { + const attr = match[0]; + const name = match[1]; + const value = match[2] || match[3] || match[4]; + const attrStart = start + str.indexOf(attr); + attrs[name] = value !== null && value !== void 0 ? value : name; + attrs.push({ + type: 'Attribute', + name, + value: !value || [ + { + type: 'Text', + start: attrStart + attr.indexOf('=') + 1, + end: attrStart + attr.length, + raw: value + } + ], + start: attrStart, + end: attrStart + attr.length + }); + } + return attrs; +} +// Regex ensures that attributes with > characters in them still result in the content being matched correctly +const scriptRegex = /()|('"\/\s]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"\/\s]+)*\s*)>)([\S\s]*?)<\/script>/g; +const styleRegex = /()|('"\/\s]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"\/\s]+)*\s*)>)([\S\s]*?)<\/style>/g; +function extractTag(htmlx, tag) { + const exp = tag === 'script' ? scriptRegex : styleRegex; + const matches = []; + let match = null; + while ((match = exp.exec(htmlx)) != null) { + if (match[0].startsWith(' __sveltets_2_ensureAction(xxx(svelte.mapElementTag('ParentNodeName'),(params))); + */ +function handleActionDirective(attr, element) { + element.addAction(attr); +} + +/** + * Moves or inserts text to the specified end in order. + * "In order" means that the transformation of the text before + * the given position reads exactly what was moved/inserted + * from left to right. + * After the transformation is done, everything inside the start-end-range that was + * not moved will be removed. If there's a delete position given, things will be moved + * to the end first before getting deleted. This may ensure better mappings for auto completion + * for example. + * Note: If you need the last char to be mapped so that it follows the previous character, + * you may need to find a different way because MagicString does not allow us to move a range + * that goes from `start` to `end` to the `end` position. + */ +function transform(str, start, end, transformations) { + var _a, _b; + const moves = []; + let appendPosition = end; + let ignoreNextString = false; + let deletePos; + let deleteDest; + for (let i = 0; i < transformations.length; i++) { + const transformation = transformations[i]; + if (typeof transformation === 'number') { + deletePos = moves.length; + deleteDest = transformation; + } + else if (typeof transformation === 'string') { + if (!ignoreNextString) { + str.appendLeft(appendPosition, transformation); + } + ignoreNextString = false; + } + else { + const tStart = transformation[0]; + let tEnd = transformation[1]; + if (tStart === tEnd) { + // zero-range selection, don't move, it would + // cause bugs and isn't necessary anyway + continue; + } + if (tEnd < end - 1 && + // TODO can we somehow make this more performant? + !transformations.some((t) => typeof t !== 'string' && t[0] === tEnd)) { + tEnd += 1; + const next = transformations[i + 1]; + ignoreNextString = typeof next === 'string'; + // Do not append the next string, rather overwrite the next character. This ensures + // that mappings of the string afterwards are not mapped to a previous character, making + // mappings of ranges one character too short. If there's no string in the next transformation, + // completely delete the first character afterwards. This also makes the mapping more correct, + // so that autocompletion triggered on the last character works correctly. + const overwrite = typeof next === 'string' ? next : ''; + str.overwrite(tEnd - 1, tEnd, overwrite, { contentOnly: true }); + } + appendPosition = tEnd; + moves.push([tStart, tEnd]); + } + } + deletePos = deletePos !== null && deletePos !== void 0 ? deletePos : moves.length; + for (let i = 0; i < deletePos; i++) { + str.move(moves[i][0], moves[i][1], end); + } + let removeStart = start; + const sortedMoves = [...moves].sort((t1, t2) => t1[0] - t2[0]); + // Remove everything between the transformations up until the end position + for (const transformation of sortedMoves) { + if (removeStart < transformation[0]) { + if (deletePos !== moves.length && + removeStart > deleteDest && + removeStart < end && + transformation[0] < end) { + str.move(removeStart, transformation[0], end); + } + if (transformation[0] < end) { + // Use one space because of hover etc: This will make map deleted characters to the whitespace + str.overwrite(removeStart, transformation[0], ' ', { contentOnly: true }); + } + } + removeStart = transformation[1]; + } + if (removeStart > end) { + // Reset the end to the last transformation before the end if there were transformations after the end + // so we still delete the correct range afterwards + let idx = sortedMoves.findIndex((m) => m[0] > end) - 1; + removeStart = (_b = (_a = sortedMoves[idx]) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : end; + } + if (removeStart < end) { + // Completely delete the first character afterwards. This makes the mapping more correct, + // so that autocompletion triggered on the last character works correctly. + str.overwrite(removeStart, removeStart + 1, '', { contentOnly: true }); + removeStart++; + } + if (removeStart < end) { + // Use one space because of hover etc: This will map deleted characters to the whitespace + if (deletePos !== moves.length && removeStart > deleteDest && removeStart + 1 < end) { + // Can only move stuff up to the end, not including, else we get a "cannot move inside itself" error + str.move(removeStart, end - 1, end); + str.overwrite(removeStart, end - 1, ' ', { contentOnly: true }); + str.overwrite(end - 1, end, '', { contentOnly: true }); + } + else { + str.overwrite(removeStart, end, ' ', { contentOnly: true }); + } + } + for (let i = deletePos; i < moves.length; i++) { + // Can happen when there's not enough space left at the end of an unfininished element/component tag. + // Better to leave potentially slightly disarranged code than fail loudly + if (moves[i][1] >= end && moves[i][0] <= end) + break; + str.move(moves[i][0], moves[i][1], end); + } +} +/** + * Surrounds given range with a prefix and suffix. This is benefitial + * for better mappings in some cases. Example: If we transform `foo` to `"foo"` + * and if TS underlines the whole `"foo"`, we need to make sure that the quotes + * are also mapped to the correct positions. + * Returns the input start/end transformation for convenience. + */ +function surroundWith(str, [start, end], prefix, suffix) { + if (start + 1 === end) { + str.overwrite(start, end, `${prefix}${str.original.charAt(start)}${suffix}`, { + contentOnly: true + }); + } + else { + str.overwrite(start, start + 1, `${prefix}${str.original.charAt(start)}`, { + contentOnly: true + }); + str.overwrite(end - 1, end, `${str.original.charAt(end - 1)}${suffix}`, { + contentOnly: true + }); + } + return [start, end]; +} +/** + * Returns the [start, end] indexes of a directive (action,animation,etc) name. + * Example: use:foo --> [startOfFoo, endOfFoo] + */ +function getDirectiveNameStartEndIdx(str, node) { + const colonIdx = str.original.indexOf(':', node.start); + return [colonIdx + 1, colonIdx + 1 + `${node.name}`.length]; +} +/** + * Removes characters from the string that are invalid for TS variable names. + * Careful: This does not check if the leading character + * is valid (numerical values aren't for example). + */ +function sanitizePropName(name) { + return name + .split('') + .map((char) => (/[0-9A-Za-z$_]/.test(char) ? char : '_')) + .join(''); +} +/** + * Check if there's a member access trailing behind given expression and if yes, + * bump the position to include it. + * Usually it's there because of the preprocessing we do before we let Svelte parse the template. + */ +function withTrailingPropertyAccess(originalText, position) { + let index = position; + while (index < originalText.length) { + const char = originalText[index]; + if (!char.trim()) { + index++; + continue; + } + if (char === '.') { + return index + 1; + } + if (char === '?' && originalText[index + 1] === '.') { + return index + 2; + } + break; + } + return position; +} +function rangeWithTrailingPropertyAccess(originalText, node) { + return [node.start, withTrailingPropertyAccess(originalText, node.end)]; +} +/** + * Get the end of the node, excluding the type annotation + */ +function getEnd(node) { + var _a, _b; + return isTypescriptNode(node) ? node.expression.end : ((_b = (_a = node.typeAnnotation) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : node.end); +} +function isTypescriptNode(node) { + return (node.type === 'TSAsExpression' || + node.type === 'TSSatisfiesExpression' || + node.type === 'TSNonNullExpression'); +} +/** + * Returns `true` if the given block is implicitly closed, which could be the case in loose parsing mode. + * E.g.: + * ```html + *
    + * {#if x} + *
    + * ``` + * @param end + * @param block + * @returns + */ +function isImplicitlyClosedBlock(end, block) { + var _a, _b; + return end < ((_b = (_a = block.children[block.children.length - 1]) === null || _a === void 0 ? void 0 : _a.end) !== null && _b !== void 0 ? _b : block.expression.end); +} + +/** + * animate:xxx(yyy) ---> __sveltets_2_ensureAnimation(xxx(svelte.mapElementTag('..'),__sveltets_2_AnimationMove,(yyy))); + */ +function handleAnimateDirective(str, attr, element) { + const transformations = [ + '__sveltets_2_ensureAnimation(', + getDirectiveNameStartEndIdx(str, attr), + `(${element.typingsNamespace}.mapElementTag('${element.tagName}'),__sveltets_2_AnimationMove` + ]; + if (attr.expression) { + transformations.push(',(', rangeWithTrailingPropertyAccess(str.original, attr.expression), ')'); + } + transformations.push('));'); + element.appendToStartEnd(transformations); +} + +var svgAttributes = 'accent-height accumulate additive alignment-baseline allowReorder alphabetic amplitude arabic-form ascent attributeName attributeType autoReverse azimuth baseFrequency baseline-shift baseProfile bbox begin bias by calcMode cap-height class clip clipPathUnits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering contentScriptType contentStyleType cursor cx cy d decelerate descent diffuseConstant direction display divisor dominant-baseline dur dx dy edgeMode elevation enable-background end exponent externalResourcesRequired fill fill-opacity fill-rule filter filterRes filterUnits flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight format from fr fx fy g1 g2 glyph-name glyph-orientation-horizontal glyph-orientation-vertical glyphRef gradientTransform gradientUnits hanging height href horiz-adv-x horiz-origin-x id ideographic image-rendering in in2 intercept k k1 k2 k3 k4 kernelMatrix kernelUnitLength kerning keyPoints keySplines keyTimes lang lengthAdjust letter-spacing lighting-color limitingConeAngle local marker-end marker-mid marker-start markerHeight markerUnits markerWidth mask maskContentUnits maskUnits mathematical max media method min mode name numOctaves offset onabort onactivate onbegin onclick onend onerror onfocusin onfocusout onload onmousedown onmousemove onmouseout onmouseover onmouseup onrepeat onresize onscroll onunload opacity operator order orient orientation origin overflow overline-position overline-thickness panose-1 paint-order pathLength patternContentUnits patternTransform patternUnits pointer-events points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits r radius refX refY rendering-intent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry scale seed shape-rendering slope spacing specularConstant specularExponent speed spreadMethod startOffset stdDeviation stemh stemv stitchTiles stop-color stop-opacity strikethrough-position strikethrough-thickness string stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width style surfaceScale systemLanguage tabindex tableValues target targetX targetY text-anchor text-decoration text-rendering textLength to transform type u1 u2 underline-position underline-thickness unicode unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical values version vert-adv-y vert-origin-x vert-origin-y viewBox viewTarget visibility width widths word-spacing writing-mode x x-height x1 x2 xChannelSelector xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xml:lang xml:space y y1 y2 yChannelSelector z zoomAndPan'.split(' '); + +const IGNORE_START_COMMENT = '/*Ωignore_startΩ*/'; +const IGNORE_END_COMMENT = '/*Ωignore_endΩ*/'; +/** to tell tooling to ignore the character at this position; can for example be used to ignore everything starting at this position */ +const IGNORE_POSITION_COMMENT = '/*Ωignore_positionΩ*/'; +/** + * Surrounds given string with a start/end comment which marks it + * to be ignored by tooling. + */ +function surroundWithIgnoreComments(str) { + return IGNORE_START_COMMENT + str + IGNORE_END_COMMENT; +} + +const voidTags = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr'.split(','); +/** + * Handles HTML elements as well as svelte:options, svelte:head, svelte:window, svelte:body, svelte:element + * + * Children of this element should call the methods on this class to add themselves to the correct + * position within the transformation. + * + * The transformation result does not have anything to do with HTMLx, it instead uses plan JS, + * leveraging scoped blocks (`{ ... }`). Each element is transformed to something that is + * contained in such a block. This ensures we can declare variables inside that do not leak + * to the outside while preserving TypeScript's control flow. + * + * A transformation reads for example like this: + * ``` + * // before + *
    + * // after + * { const $$_div = __sveltets_2_createElement("div", {"class": foo,}); } + * ``` + */ +class Element { + get name() { + this.referencedName = true; + return this._name; + } + /** + * @param str The MagicString instance used to manipulate the text + * @param node The Svelte AST node that represents this element + * @param typingsNamespace Determines which namespace to use for the createElement function + * @param parent The Svelte AST parent node + */ + constructor(str, node, typingsNamespace, parent) { + this.str = str; + this.node = node; + this.typingsNamespace = typingsNamespace; + this.parent = parent; + this.startEndTransformation = ['});']; + this.attrsTransformation = []; + this.actionsTransformation = []; + this.actionIdentifiers = []; + this.endTransformation = []; + // Add const $$xxx = ... only if the variable name is actually used + // in order to prevent "$$xxx is defined but never used" TS hints + this.referencedName = false; + if (parent) { + parent.child = this; + } + this.tagName = this.node.name === 'svelte:body' ? 'body' : this.node.name; + this.isSelfclosing = this.computeIsSelfclosing(); + this.startTagStart = this.node.start; + this.startTagEnd = this.computeStartTagEnd(); + const tagEnd = this.startTagStart + this.node.name.length + 1; + // Ensure deleted characters are mapped to the attributes object so we + // get autocompletion when triggering it on a whitespace. + if (/\s/.test(str.original.charAt(tagEnd))) { + this.attrsTransformation.push(tagEnd); + this.attrsTransformation.push([tagEnd, tagEnd + 1]); + // Overwrite necessary or else we get really weird mappings + this.str.overwrite(tagEnd, tagEnd + 1, '', { contentOnly: true }); + } + switch (this.node.name) { + // Although not everything that is possible to add to Element + // is valid on the special svelte elements, + // we still also handle them here and let the Svelte parser handle invalid + // cases. For us it doesn't make a difference to a normal HTML element. + case 'svelte:options': + case 'svelte:head': + case 'svelte:window': + case 'svelte:body': + case 'svelte:fragment': { + // remove the colon: svelte:xxx -> sveltexxx + const nodeName = `svelte${this.node.name.substring(7)}`; + this._name = '$$_' + nodeName + this.computeDepth(); + break; + } + case 'svelte:element': { + this._name = '$$_svelteelement' + this.computeDepth(); + break; + } + case 'slot': { + this._name = '$$_slot' + this.computeDepth(); + break; + } + default: { + this._name = '$$_' + sanitizePropName(this.node.name) + this.computeDepth(); + break; + } + } + } + /** + * attribute={foo} --> "attribute": foo, + * @param name Attribute name + * @param value Attribute value, if present. If not present, this is treated as a shorthand attribute + */ + addAttribute(name, value) { + if (value) { + this.attrsTransformation.push(...name, ':', ...value, ','); + } + else { + this.attrsTransformation.push(...name, ','); + } + } + /** + * Handle the slot of `<... slot=".." />` + * @param transformation Slot name transformation + */ + addSlotName(transformation) { + this.slotLetsTransformation = this.slotLetsTransformation || [[], []]; + this.slotLetsTransformation[0] = transformation; + } + /** + * Handle the let: of `<... let:xx={yy} />` + * @param transformation Let transformation + */ + addSlotLet(transformation) { + this.slotLetsTransformation = this.slotLetsTransformation || [['default'], []]; + this.slotLetsTransformation[1].push(...transformation, ','); + } + addAction(attr) { + const id = `$$action_${this.actionIdentifiers.length}`; + this.actionIdentifiers.push(id); + if (!this.actionsTransformation.length) { + this.actionsTransformation.push('{'); + } + this.actionsTransformation.push(`const ${id} = __sveltets_2_ensureAction(`, getDirectiveNameStartEndIdx(this.str, attr), `(${this.typingsNamespace}.mapElementTag('${this.tagName}')`); + if (attr.expression) { + this.actionsTransformation.push(',(', rangeWithTrailingPropertyAccess(this.str.original, attr.expression), ')'); + } + this.actionsTransformation.push('));'); + } + /** + * Add something right after the start tag end. + */ + appendToStartEnd(value) { + this.startEndTransformation.push(...value); + } + performTransformation() { + this.endTransformation.push('}'); + const slotLetTransformation = []; + if (this.slotLetsTransformation) { + if (this.slotLetsTransformation[0][0] === 'default') { + slotLetTransformation.push( + // add dummy destructuring parameter because if all parameters are unused, + // the mapping will be confusing, because TS will highlight the whole destructuring + `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.parent.name}.$$slot_def.default;$$_$$;`); + } + else { + slotLetTransformation.push( + // See comment above + `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.parent.name}.$$slot_def["`, ...this.slotLetsTransformation[0], '"];$$_$$;'); + } + this.endTransformation.push('}'); + } + if (this.actionIdentifiers.length) { + this.endTransformation.push('}'); + } + if (this.isSelfclosing) { + transform(this.str, this.startTagStart, this.startTagEnd, [ + // Named slot transformations go first inside a outer block scope because + //
    means "use the x of let:x", and without a separate + // block scope this would give a "used before defined" error + ...slotLetTransformation, + ...this.actionsTransformation, + ...this.getStartTransformation(), + ...this.attrsTransformation, + ...this.startEndTransformation, + ...this.endTransformation + ]); + } + else { + transform(this.str, this.startTagStart, this.startTagEnd, [ + ...slotLetTransformation, + ...this.actionsTransformation, + ...this.getStartTransformation(), + ...this.attrsTransformation, + ...this.startEndTransformation + ]); + const tagEndIdx = this.str.original + .substring(this.node.start, this.node.end) + .lastIndexOf(`fooo

    anothertag

    ` + const endStart = tagEndIdx === -1 ? this.node.end : tagEndIdx + this.node.start; + transform(this.str, endStart, this.node.end, this.endTransformation); + } + } + getStartTransformation() { + var _a, _b; + const createElement = `${this.typingsNamespace}.createElement`; + const addActions = () => { + if (this.actionIdentifiers.length) { + return `, __sveltets_2_union(${this.actionIdentifiers.join(',')})`; + } + else { + return ''; + } + }; + let createElementStatement; + switch (this.node.name) { + // Although not everything that is possible to add to Element + // is valid on the special svelte elements, + // we still also handle them here and let the Svelte parser handle invalid + // cases. For us it doesn't make a difference to a normal HTML element. + case 'svelte:options': + case 'svelte:head': + case 'svelte:window': + case 'svelte:body': + case 'svelte:fragment': { + createElementStatement = [`${createElement}("${this.node.name}"${addActions()}, {`]; + break; + } + case 'svelte:element': { + const nodeName = this.node.tag + ? typeof this.node.tag !== 'string' + ? [this.node.tag.start, this.node.tag.end] + : `"${this.node.tag}"` + : '""'; + createElementStatement = [`${createElement}(`, nodeName, `${addActions()}, {`]; + break; + } + case 'slot': { + // If the element is a tag, create the element with the createSlot-function + // which is created inside createRenderFunction.ts to check that the name and attributes + // of the slot tag are correct. The check will error if the user defined $$Slots + // and the slot definition or its attributes contradict that type definition. + const slotName = ((_b = (_a = this.node.attributes) === null || _a === void 0 ? void 0 : _a.find((a) => a.name === 'name')) === null || _b === void 0 ? void 0 : _b.value[0]) || + 'default'; + createElementStatement = [ + '__sveltets_createSlot(', + typeof slotName === 'string' + ? `"${slotName}"` + : surroundWith(this.str, [slotName.start, slotName.end], '"', '"'), + ', {' + ]; + break; + } + default: { + createElementStatement = [ + `${createElement}("`, + [this.node.start + 1, this.node.start + 1 + this.node.name.length], + `"${addActions()}, {` + ]; + break; + } + } + if (this.referencedName) { + createElementStatement[0] = `const ${this._name} = ` + createElementStatement[0]; + } + createElementStatement[0] = `{ ${createElementStatement[0]}`; + return createElementStatement; + } + computeStartTagEnd() { + var _a; + if ((_a = this.node.children) === null || _a === void 0 ? void 0 : _a.length) { + return this.node.children[0].start; + } + return this.isSelfclosing + ? this.node.end + : this.str.original.lastIndexOf('>', this.node.end - 2) + 1; + } + computeIsSelfclosing() { + var _a; + if (this.str.original[this.node.end - 2] === '/' || voidTags.includes(this.node.name)) { + return true; + } + return (!((_a = this.node.children) === null || _a === void 0 ? void 0 : _a.length) && + // Paranoid check because theoretically there could be other void + // tags in different namespaces other than HTML + !this.str.original + .substring(this.node.start, this.node.end) + .match(new RegExp(`$`))); + } + computeDepth() { + let idx = 0; + let parent = this.parent; + while (parent) { + parent = parent.parent; + idx++; + } + return idx; + } +} + +/** + * Handles Svelte components as well as svelte:self and svelte:component + * + * Children of this element should call the methods on this class to add themselves to the correct + * position within the transformation. + * + * The transformation result does not have anything to do with HTMLx, it instead uses plan JS, + * leveraging scoped blocks (`{ ... }`). Each element is transformed to something that is + * contained in such a block. This ensures we can declare variables inside that do not leak + * to the outside while preserving TypeScript's control flow. + * + * A transformation reads for example like this: + * ``` + * // before + * + * // after + * { const $$_Comp = new Comp({ target: __sveltets_2_any(), props: {"prop": foo,}}); } + * ``` + */ +class InlineComponent { + get name() { + if (this.addNameConstDeclaration) { + this.addNameConstDeclaration(); + this.addNameConstDeclaration = undefined; + } + return this._name; + } + constructor(str, node, parent) { + this.str = str; + this.node = node; + this.parent = parent; + this.startTransformation = []; + this.startEndTransformation = []; + this.propsTransformation = []; + this.eventsTransformation = []; + this.snippetPropsTransformation = []; + this.endTransformation = []; + if (parent) { + parent.child = this; + } + this.isSelfclosing = this.computeIsSelfclosing(); + this.startTagStart = this.node.start; + this.startTagEnd = this.computeStartTagEnd(); + const tagEnd = this.startTagStart + this.node.name.length + 1; + // Ensure deleted characters are mapped to the attributes object so we + // get autocompletion when triggering it on a whitespace. + if (/\s/.test(str.original.charAt(tagEnd))) { + this.propsTransformation.push(tagEnd); + this.propsTransformation.push([tagEnd, tagEnd + 1]); + // Overwrite necessary or else we get really weird mappings + this.str.overwrite(tagEnd, tagEnd + 1, '', { contentOnly: true }); + } + if (this.node.name === 'svelte:self') { + // TODO try to get better typing here, maybe TS allows us to use the created class + // even if it's used in the function that is used to create it + this._name = '$$_svelteself' + this.computeDepth(); + this.startTransformation.push('{ __sveltets_2_createComponentAny({'); + this.addNameConstDeclaration = () => (this.startTransformation[0] = `{ const ${this._name} = __sveltets_2_createComponentAny({`); + this.startEndTransformation.push('});'); + } + else { + const isSvelteComponentTag = this.node.name === 'svelte:component'; + // We don't know if the thing we use to create the Svelte component with + // is actually a proper Svelte component, which would lead to errors + // when accessing things like $$prop_def. Therefore widen the type + // here, falling back to a any-typed component to ensure the user doesn't + // get weird followup-errors all over the place. The diagnostic error + // will be on the __sveltets_2_ensureComponent part, giving a more helpful message + // The name is reversed here so that when the component is undeclared, + // TypeScript won't suggest the undeclared variable to be a misspelling of the generated variable + this._name = + '$$_' + + Array.from(sanitizePropName(this.node.name)).reverse().join('') + + this.computeDepth(); + const constructorName = this._name + 'C'; + const nodeNameStart = isSvelteComponentTag + ? this.node.expression.start + : this.str.original.indexOf(this.node.name, this.node.start); + const nodeNameEnd = isSvelteComponentTag + ? this.node.expression.end + : nodeNameStart + this.node.name.length; + this.startTransformation.push(`{ const ${constructorName} = __sveltets_2_ensureComponent(`, [nodeNameStart, nodeNameEnd], `); new ${constructorName}({ target: __sveltets_2_any(), props: {`); + this.addNameConstDeclaration = () => (this.startTransformation[2] = `); const ${this._name} = new ${constructorName}({ target: __sveltets_2_any(), props: {`); + this.startEndTransformation.push('}});'); + } + } + /** + * prop={foo} --> "prop": foo, + * @param name Property name + * @param value Attribute value, if present. If not present, this is treated as a shorthand attribute + */ + addProp(name, value) { + if (value) { + this.propsTransformation.push(...name, ':', ...value, ','); + } + else { + this.propsTransformation.push(...name, ','); + } + } + /** + * on:click={xxx} --> $$_Component.$on("click", xxx) + * @param name Event name + * @param expression Event handler, if present + */ + addEvent([nameStart, nameEnd], expression) { + this.eventsTransformation.push(`${this.name}.$on(`, surroundWith(this.str, [nameStart, nameEnd], '"', '"'), ', ', expression ? expression : '() => {}', ');'); + } + /** + * Handle the slot of `<... slot=".." />` + * @param transformation Slot name transformation + */ + addSlotName(transformation) { + this.slotLetsTransformation = this.slotLetsTransformation || [[], []]; + this.slotLetsTransformation[0] = transformation; + } + /** + * Handle the let: of `<... let:xx={yy} />` + * @param transformation Let transformation + */ + addSlotLet(transformation) { + this.slotLetsTransformation = this.slotLetsTransformation || [['default'], []]; + this.slotLetsTransformation[1].push(...transformation, ','); + } + addImplicitSnippetProp(name, transforms) { + this.addProp([name], transforms); + this.snippetPropsTransformation.push(this.str.original.slice(name[0], name[1])); + } + /** + * Add something right after the start tag end. + */ + appendToStartEnd(value) { + this.startEndTransformation.push(...value); + } + performTransformation() { + var _a; + const namedSlotLetTransformation = []; + const defaultSlotLetTransformation = []; + if (this.slotLetsTransformation) { + if (this.slotLetsTransformation[0][0] === 'default') { + defaultSlotLetTransformation.push( + // add dummy destructuring parameter because if all parameters are unused, + // the mapping will be confusing, because TS will highlight the whole destructuring + `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.name}.$$slot_def.default;$$_$$;`); + } + else { + namedSlotLetTransformation.push( + // See comment above + `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.parent.name}.$$slot_def["`, ...this.slotLetsTransformation[0], '"];$$_$$;'); + } + this.endTransformation.push('}'); + } + const snippetPropVariables = (_a = this.snippetPropsTransformation) === null || _a === void 0 ? void 0 : _a.join(', '); + const snippetPropVariablesDeclaration = snippetPropVariables + ? surroundWithIgnoreComments(`const {${snippetPropVariables}} = ${this.name}.$$prop_def;`) + : ''; + if (this.isSelfclosing) { + this.endTransformation.push('}'); + transform(this.str, this.startTagStart, this.startTagEnd, [ + // Named slot transformations go first inside a outer block scope because + // means "use the x of let:x", and without a separate + // block scope this would give a "used before defined" error + ...namedSlotLetTransformation, + ...this.startTransformation, + ...this.propsTransformation, + ...this.startEndTransformation, + ...this.eventsTransformation, + ...defaultSlotLetTransformation, + snippetPropVariablesDeclaration, + ...this.endTransformation + ]); + } + else { + let endStart = this.str.original + .substring(this.node.start, this.node.end) + .lastIndexOf(` -> Component} + this.endTransformation.push([endStart + 2, endStart + this.node.name.length + 2]); + } + this.endTransformation.push('}'); + transform(this.str, this.startTagStart, this.startTagEnd, [ + // See comment above why this goes first + ...namedSlotLetTransformation, + ...this.startTransformation, + ...this.propsTransformation, + ...this.startEndTransformation, + ...this.eventsTransformation, + snippetPropVariablesDeclaration, + ...defaultSlotLetTransformation + ]); + transform(this.str, endStart, this.node.end, this.endTransformation); + } + } + computeStartTagEnd() { + var _a; + if ((_a = this.node.children) === null || _a === void 0 ? void 0 : _a.length) { + return this.node.children[0].start; + } + return this.isSelfclosing + ? this.node.end + : this.str.original.lastIndexOf('>', this.node.end - 2) + 1; + } + computeIsSelfclosing() { + return this.str.original[this.node.end - 2] === '/'; + } + computeDepth() { + let idx = 0; + let parent = this.parent; + while (parent) { + parent = parent.parent; + idx++; + } + return idx; + } +} + +/** + * List taken from `elements.d.ts` in Svelte core by searching for all attributes of type `number | undefined | null`; + */ +const numberOnlyAttributes = new Set([ + 'aria-colcount', + 'aria-colindex', + 'aria-colspan', + 'aria-level', + 'aria-posinset', + 'aria-rowcount', + 'aria-rowindex', + 'aria-rowspan', + 'aria-setsize', + 'aria-valuemax', + 'aria-valuemin', + 'aria-valuenow', + 'results', + 'span', + 'marginheight', + 'marginwidth', + 'maxlength', + 'minlength', + 'currenttime', + 'defaultplaybackrate', + 'volume', + 'high', + 'low', + 'optimum', + 'start', + 'size', + 'border', + 'cols', + 'rows', + 'colspan', + 'rowspan', + 'tabindex' +]); +/** + * Handle various kinds of attributes and make them conform to being valid in context of a object definition + * - {x} ---> x + * - x="{..}" ---> x:.. + * - lowercase DOM attributes + * - multi-value handling + */ +function handleAttribute(str, attr, parent, preserveCase, svelte5Plus, element) { + if (parent.name === '!DOCTYPE' || + ['Style', 'Script'].includes(parent.type) || + (attr.name === 'name' && parent.type === 'Slot')) { + // - is already removed by now from MagicString + // - Don't handle script / style tag attributes (context or lang for example) + // - name=".." of tag is already handled in Element + return; + } + if (attr.name === 'slot' && + attributeValueIsOfType(attr.value, 'Text') && + element.parent instanceof InlineComponent) { + // - slot=".." in context of slots with let:xx is handled differently + element.addSlotName([[attr.value[0].start, attr.value[0].end]]); + return; + } + const addAttribute = element instanceof Element + ? (name, value) => { + if (attr.name.startsWith('data-') && !attr.name.startsWith('data-sveltekit-')) { + // any attribute prefixed with data- is valid, but we can't + // type that statically, so we need this workaround + name.unshift('...__sveltets_2_empty({'); + if (!value) { + value = ['__sveltets_2_any()']; + } + value.push('})'); + } + element.addAttribute(name, value); + } + : (name, value) => { + if (attr.name.startsWith('--')) { + // CSS custom properties are not part of the props + // definition, so wrap them to not get "--xx is invalid prop" errors + name.unshift('...__sveltets_2_cssProp({'); + if (!value) { + value = ['""']; + } + value.push('})'); + } + element.addProp(name, value); + }; + /** + * lowercase the attribute name to make it adhere to our intrinsic elements definition + */ + const transformAttributeCase = (name) => { + if (!preserveCase && + !svgAttributes.find((x) => x == name) && + !(element instanceof Element && element.tagName.includes('-')) && + !(svelte5Plus && name.startsWith('on'))) { + return name.toLowerCase(); + } + else { + return name; + } + }; + // Handle attribute name + const attributeName = []; + if (attributeValueIsOfType(attr.value, 'AttributeShorthand')) { + // For the attribute shorthand, the name will be the mapped part + let [start, end] = [attr.value[0].start, attr.value[0].end]; + if (start === end) { + // Loose parsing mode, we have an empty attribute value, e.g. {} + // For proper intellisense we need to make this a non-empty expression. + start--; + str.overwrite(start, end, ' ', { contentOnly: true }); + } + addAttribute([[start, end]]); + return; + } + else { + let name = element instanceof Element && parent.type === 'Element' + ? transformAttributeCase(attr.name) + : attr.name; + // surround with quotes because dashes or other invalid property characters could be part of the name + // Overwrite first char with "+char because TS will squiggle the whole "prop" including quotes when something is wrong + if (name !== attr.name) { + name = '"' + name; + str.overwrite(attr.start, attr.start + attr.name.length, name); + } + else { + str.overwrite(attr.start, attr.start + 1, '"' + str.original.charAt(attr.start), { + contentOnly: true + }); + } + attributeName.push([attr.start, attr.start + attr.name.length], '"'); + } + // Handle attribute value + const attributeValue = []; + if (attr.value === true) { + attributeValue.push('true'); + addAttribute(attributeName, attributeValue); + return; + } + if (attr.value.length == 0) { + // shouldn't happen + addAttribute(attributeName, ['""']); + return; + } + //handle single value + if (attr.value.length == 1) { + const attrVal = attr.value[0]; + if (attrVal.type == 'Text') { + // Handle the attr="" special case with a transformation that allows mapping of the position + if (attrVal.start === attrVal.end) { + addAttribute(attributeName, [[attrVal.start - 1, attrVal.end + 1]]); + return; + } + const lastCharIndex = attrVal.end - 1; + const hasBrackets = str.original[lastCharIndex] === '}' || + ((str.original[lastCharIndex] === '"' || str.original[lastCharIndex] === "'") && + str.original[lastCharIndex - 1] === '}'); + const needsNumberConversion = !hasBrackets && + parent.type === 'Element' && + numberOnlyAttributes.has(attr.name.toLowerCase()) && + !isNaN(attrVal.data); + const includesTemplateLiteralQuote = attrVal.data.includes('`'); + const quote = !includesTemplateLiteralQuote + ? '`' + : ['"', "'"].includes(str.original[attrVal.start - 1]) + ? str.original[attrVal.start - 1] + : '"'; + if (!needsNumberConversion) { + attributeValue.push(quote); + } + if (includesTemplateLiteralQuote && attrVal.data.split('\n').length > 1) { + // Multiline attribute value text which can't be wrapped in a template literal + // -> ensure it's still a valid transformation by transforming the actual line break + str.overwrite(attrVal.start, attrVal.end, attrVal.data.split('\n').join('\\n'), { + contentOnly: true + }); + } + attributeValue.push([attrVal.start, attrVal.end]); + if (!needsNumberConversion) { + attributeValue.push(quote); + } + addAttribute(attributeName, attributeValue); + } + else if (attrVal.type == 'MustacheTag') { + let [start, end] = rangeWithTrailingPropertyAccess(str.original, attrVal.expression); + if (start === end) { + // Loose parsing mode, we have an empty attribute value, e.g. attr={} + // For proper intellisense we need to make this a non-empty expression. + start--; + str.overwrite(start, end, ' ', { contentOnly: true }); + } + attributeValue.push([start, end]); + addAttribute(attributeName, attributeValue); + } + return; + } + // We have multiple attribute values, so we build a template string out of them. + for (const n of attr.value) { + if (n.type === 'MustacheTag') { + str.appendRight(n.start, '$'); + } + } + attributeValue.push('`', [attr.value[0].start, attr.value[attr.value.length - 1].end], '`'); + addAttribute(attributeName, attributeValue); +} +function attributeValueIsOfType(value, type) { + return value !== true && value.length == 1 && value[0].type == type; +} + +/** + * This needs to be called on the way out, not on the way on, when walking, + * because else the order of moves might get messed up with moves in + * the children. + * + * The await block consists of these blocks: + *- expression: the promise - has start and end + *- value: the result of the promise - has start and end + *- error: the error branch value - has start and end + *- pending: start/end of the pending block (if exists), with skip boolean + *- then: start/end of the then block (if exists), with skip boolean + *- catch: start/end of the catch block (if exists), with skip boolean + * + * Implementation note: + * As soon there's a `then` with a value, we transform that to + * `{const $$_value = foo; {const foo = await $$_value;..}}` because + * + * - `{#await foo then foo}` or `{#await foo}..{:then foo}..` is valid Svelte code + * - `{#await foo} {bar} {:then bar} {bar} {/await} is valid Svelte code` + * + * Both would throw "variable used before declaration" if we didn't do the + * transformation this way. + */ +function handleAwait(str, awaitBlock) { + var _a, _b; + const transforms = ['{ ']; + if (!awaitBlock.pending.skip) { + transforms.push([awaitBlock.pending.start, awaitBlock.pending.end]); + } + if (awaitBlock.error || !awaitBlock.catch.skip) { + transforms.push('try { '); + } + if (awaitBlock.value) { + transforms.push('const $$_value = '); + } + const expressionEnd = withTrailingPropertyAccess(str.original, awaitBlock.expression.end); + transforms.push('await (', [awaitBlock.expression.start, expressionEnd], ');'); + if (awaitBlock.value) { + transforms.push('{ const ', [awaitBlock.value.start, awaitBlock.value.end], ' = $$_value; '); + } + if (!awaitBlock.then.skip) { + if (awaitBlock.pending.skip) { + transforms.push([awaitBlock.then.start, awaitBlock.then.end]); + } + else if ((_a = awaitBlock.then.children) === null || _a === void 0 ? void 0 : _a.length) { + transforms.push([ + awaitBlock.then.children[0].start, + awaitBlock.then.children[awaitBlock.then.children.length - 1].end + ]); + } + } + if (awaitBlock.value) { + transforms.push('}'); + } + if (awaitBlock.error || !awaitBlock.catch.skip) { + transforms.push('} catch($$_e) { '); + if (awaitBlock.error) { + transforms.push('const ', [awaitBlock.error.start, awaitBlock.error.end], ' = __sveltets_2_any();'); + } + if (!awaitBlock.catch.skip && ((_b = awaitBlock.catch.children) === null || _b === void 0 ? void 0 : _b.length)) { + transforms.push([ + awaitBlock.catch.children[0].start, + awaitBlock.catch.children[awaitBlock.catch.children.length - 1].end + ]); + } + transforms.push('}'); + } + transforms.push('}'); + transform(str, awaitBlock.start, awaitBlock.end, transforms); +} + +/** + * List of binding names that are transformed to sth like `binding = variable`. + */ +const oneWayBindingAttributes = new Set([ + 'clientWidth', + 'clientHeight', + 'offsetWidth', + 'offsetHeight', + 'duration', + 'seeking', + 'ended', + 'readyState', + 'naturalWidth', + 'naturalHeight' +]); +/** + * List of binding names that are transformed to sth like `binding = variable as GeneratedCode`. + */ +const oneWayBindingAttributesNotOnElement = new Map([ + ['contentRect', 'DOMRectReadOnly'], + ['contentBoxSize', 'ResizeObserverSize[]'], + ['borderBoxSize', 'ResizeObserverSize[]'], + ['devicePixelContentBoxSize', 'ResizeObserverSize[]'], + // available on the element, but with a different type + ['buffered', "import('svelte/elements').SvelteMediaTimeRange[]"], + ['played', "import('svelte/elements').SvelteMediaTimeRange[]"], + ['seekable', "import('svelte/elements').SvelteMediaTimeRange[]"] +]); +const supportsBindThis = [ + 'InlineComponent', + 'Element', + 'Body', + 'Slot' // only valid for Web Components compile target +]; +/** + * Transform bind:xxx into something that conforms to JS/TS + */ +function handleBinding(str, attr, parent, element, preserveBind, isSvelte5Plus) { + const isGetSetBinding = attr.expression.type === 'SequenceExpression'; + if (!isGetSetBinding) { + // bind group on input + if (element instanceof Element && attr.name == 'group' && parent.name == 'input') { + // add reassignment to force TS to widen the type of the declaration (in case it's never reassigned anywhere else) + appendOneWayBinding(attr, ' = __sveltets_2_any(null)', element); + return; + } + // bind this + if (attr.name === 'this' && supportsBindThis.includes(parent.type)) { + // bind:this is effectively only works bottom up - the variable is updated by the element, not + // the other way round. So we check if the instance is assignable to the variable. + // Note: If the component unmounts (it's inside an if block, or svelte:component this={null}, + // the value becomes null, but we don't add it to the clause because it would introduce + // worse DX for the 99% use case, and because null !== undefined which others might use to type the declaration. + appendOneWayBinding(attr, ` = ${element.name}`, element); + return; + } + // one way binding + if (oneWayBindingAttributes.has(attr.name) && element instanceof Element) { + appendOneWayBinding(attr, `= ${element.name}.${attr.name}`, element); + return; + } + // one way binding whose property is not on the element + if (oneWayBindingAttributesNotOnElement.has(attr.name) && element instanceof Element) { + element.appendToStartEnd([ + [attr.expression.start, getEnd(attr.expression)], + `= ${surroundWithIgnoreComments(`null as ${oneWayBindingAttributesNotOnElement.get(attr.name)}`)};` + ]); + return; + } + // add reassignment to force TS to widen the type of the declaration (in case it's never reassigned anywhere else) + const expressionStr = str.original.substring(attr.expression.start, getEnd(attr.expression)); + element.appendToStartEnd([ + surroundWithIgnoreComments(`() => ${expressionStr} = __sveltets_2_any(null);`) + ]); + } + // other bindings which are transformed to normal attributes/props + const isShorthand = attr.expression.start === attr.start + 'bind:'.length; + const name = preserveBind && element instanceof Element + ? // HTML typings - preserve the bind: prefix + isShorthand + ? [`"${str.original.substring(attr.start, attr.end)}"`] + : ['"', [attr.start, str.original.lastIndexOf('=', attr.expression.start)], '"'] + : // Other typings - remove the bind: prefix + isShorthand + ? [[attr.expression.start, attr.expression.end]] + : [ + [ + attr.start + 'bind:'.length, + str.original.lastIndexOf('=', attr.expression.start) + ] + ]; + const [get, set] = isGetSetBinding ? attr.expression.expressions : []; + const value = isShorthand + ? preserveBind && element instanceof Element + ? [rangeWithTrailingPropertyAccess(str.original, attr.expression)] + : undefined + : isGetSetBinding + ? [ + '__sveltets_2_get_set_binding(', + [get.start, get.end], + ',', + rangeWithTrailingPropertyAccess(str.original, set), + ')' + ] + : [rangeWithTrailingPropertyAccess(str.original, attr.expression)]; + if (isSvelte5Plus && element instanceof InlineComponent) { + // To check if property is actually bindable + element.appendToStartEnd([`${element.name}.$$bindings = '${attr.name}';`]); + } + if (element instanceof Element) { + element.addAttribute(name, value); + } + else { + element.addProp(name, value); + } +} +function appendOneWayBinding(attr, assignment, element) { + const expression = attr.expression; + const end = getEnd(expression); + const hasTypeAnnotation = expression.typeAnnotation || isTypescriptNode(expression); + const array = [ + [expression.start, end], + assignment + (hasTypeAnnotation ? '' : ';') + ]; + if (hasTypeAnnotation) { + array.push([end, expression.end], ';'); + } + element.appendToStartEnd(array); +} + +/** + * class:xx={yyy} ---> yyy; + */ +function handleClassDirective(str, attr, element) { + element.appendToStartEnd([rangeWithTrailingPropertyAccess(str.original, attr.expression), ';']); +} + +/** + * Removes comment altogether as it's unimportant for the output + */ +function handleComment(str, node) { + str.overwrite(node.start, node.end, '', { contentOnly: true }); +} + +/** + * `{@const x = y}` --> `const x = y;` + * + * The transformation happens directly in-place. This is more strict than the + * Svelte compiler because the compiler moves all const declarations to the top. + * This transformation results in `x used before being defined` errors if someone + * uses a const variable before declaring it, which arguably is more helpful + * than what the Svelte compiler does. + */ +function handleConstTag(str, constTag) { + str.overwrite(constTag.start, constTag.expression.start, 'const '); + str.overwrite(withTrailingPropertyAccess(str.original, constTag.expression.end), constTag.end, ';'); +} + +/** + * {@debug a} ---> ;a; + * {@debug a, b} ---> ;a;b; + */ +function handleDebug(str, debugBlock) { + let cursor = debugBlock.start; + for (const identifier of debugBlock.identifiers) { + str.overwrite(cursor, identifier.start, ';', { contentOnly: true }); + cursor = identifier.end; + } + str.overwrite(cursor, debugBlock.end, ';', { contentOnly: true }); +} + +/** + * Transform #each into a for-of loop + * + * Implementation notes: + * - If code is + * `{#each items as items,i (key)}` + * then the transformation is + * `{ const $$_each = __sveltets_2_ensureArray(items); for (const items of $$_each) { let i = 0;key;`. + * Transform it this way because `{#each items as items}` is valid Svelte code, but the transformation + * `for(const items of items){..}` is invalid ("variable used before declaration"). Don't do the transformation + * like this everytime because `$$_each` could turn up in the auto completion. + * + * - The `ensureArray` method checks that only `ArrayLike` objects are passed to `#each`. + * `for (const ..)` wouldn't error in this case because it accepts any kind of iterable. + * + * - `{#each true, items as item}` is valid, we need to add braces around that expression, else + * `ensureArray` will error that there are more args than expected + */ +function handleEach(str, eachBlock) { + var _a, _b, _c; + const startEnd = str.original.indexOf('}', ((_a = eachBlock.key) === null || _a === void 0 ? void 0 : _a.end) || ((_b = eachBlock.context) === null || _b === void 0 ? void 0 : _b.end) || eachBlock.expression.end) + 1; + let transforms; + // {#each true, [1,2]} is valid but for (const x of true, [1,2]) is not if not wrapped with braces + const containsComma = str.original + .substring(eachBlock.expression.start, eachBlock.expression.end) + .includes(','); + const expressionEnd = getEnd(eachBlock.expression); + const contextEnd = eachBlock.context && getEnd(eachBlock.context); + const arrayAndItemVarTheSame = !!eachBlock.context && + str.original.substring(eachBlock.expression.start, expressionEnd) === + str.original.substring(eachBlock.context.start, contextEnd); + if (arrayAndItemVarTheSame) { + transforms = [ + `{ const $$_each = __sveltets_2_ensureArray(${containsComma ? '(' : ''}`, + [eachBlock.expression.start, eachBlock.expression.end], + `${containsComma ? ')' : ''}); for(let `, + [eachBlock.context.start, contextEnd], + ' of $$_each){' + ]; + } + else { + transforms = [ + 'for(let ', + eachBlock.context ? [eachBlock.context.start, contextEnd] : '$$each_item', + ` of __sveltets_2_ensureArray(${containsComma ? '(' : ''}`, + [eachBlock.expression.start, eachBlock.expression.end], + `${containsComma ? ')' : ''})){${eachBlock.context ? '' : '$$each_item;'}` + ]; + } + if (eachBlock.index) { + const indexStart = str.original.indexOf(eachBlock.index, ((_c = eachBlock.context) === null || _c === void 0 ? void 0 : _c.end) || eachBlock.expression.end); + const indexEnd = indexStart + eachBlock.index.length; + transforms.push('let ', [indexStart, indexEnd], ' = 1;'); + } + if (eachBlock.key) { + transforms.push([eachBlock.key.start, eachBlock.key.end], ';'); + } + transform(str, eachBlock.start, startEnd, transforms); + const endEach = str.original.lastIndexOf('{', eachBlock.end - 1); + // {/each} -> } or {:else} -> } + if (eachBlock.else) { + const elseEnd = str.original.lastIndexOf('}', eachBlock.else.start); + const elseStart = str.original.lastIndexOf('{', elseEnd); + str.overwrite(elseStart, elseEnd + 1, '}' + (arrayAndItemVarTheSame ? '}' : ''), { + contentOnly: true + }); + if (!isImplicitlyClosedBlock(endEach, eachBlock)) { + str.remove(endEach, eachBlock.end); + } + } + else { + const closing = '}' + (arrayAndItemVarTheSame ? '}' : ''); + if (isImplicitlyClosedBlock(endEach, eachBlock)) { + str.prependLeft(eachBlock.end, closing); + } + else { + str.overwrite(endEach, eachBlock.end, closing, { + contentOnly: true + }); + } + } +} + +/** + * Transform on:xxx={yyy} + * - For DOM elements: ---> onxxx: yyy, + * - For Svelte components/special elements: ---> componentInstance.$on("xxx", yyy)} + */ +function handleEventHandler(str, attr, element) { + const nameStart = str.original.indexOf(':', attr.start) + 1; + // If there's no expression, it's event bubbling (on:click) + const nameEnd = nameStart + attr.name.length; + if (element instanceof Element) { + // Prefix with "on:" for better mapping. + // Surround with quotes because event name could contain invalid prop chars. + surroundWith(str, [nameStart, nameEnd], '"on:', '"'); + element.addAttribute([[nameStart, nameEnd]], attr.expression + ? [rangeWithTrailingPropertyAccess(str.original, attr.expression)] + : ['undefined']); + } + else { + element.addEvent([nameStart, nameEnd], attr.expression + ? rangeWithTrailingPropertyAccess(str.original, attr.expression) + : undefined); + } +} + +/** + * Transforms #if and :else if to a regular if control block. + */ +function handleIf(str, ifBlock) { + if (ifBlock.elseif) { + // {:else if expr} --> } else if(expr) { + const start = str.original.lastIndexOf('{', ifBlock.expression.start); + str.overwrite(start, ifBlock.expression.start, '} else if ('); + } + else { + // {#if expr} --> if (expr){ + str.overwrite(ifBlock.start, ifBlock.expression.start, 'if('); + } + const expressionEnd = withTrailingPropertyAccess(str.original, ifBlock.expression.end); + const end = str.original.indexOf('}', expressionEnd); + str.overwrite(expressionEnd, end + 1, '){'); + const endif = str.original.lastIndexOf('{', ifBlock.end - 1); + if (isImplicitlyClosedBlock(endif, ifBlock)) { + str.prependLeft(ifBlock.end, '}'); + } + else { + // {/if} -> } + str.overwrite(endif, ifBlock.end, '}'); + } +} +/** + * {:else} ---> } else { + */ +function handleElse(str, elseBlock, parent) { + if (parent.type !== 'IfBlock') { + // This is the else branch of an #each block which is handled elsewhere + return; + } + const elseEnd = str.original.lastIndexOf('}', elseBlock.start); + const elseword = str.original.lastIndexOf(':else', elseEnd); + const elseStart = str.original.lastIndexOf('{', elseword); + str.overwrite(elseStart, elseStart + 1, '}'); + str.overwrite(elseEnd, elseEnd + 1, '{'); + const colon = str.original.indexOf(':', elseword); + str.remove(colon, colon + 1); +} + +/** + * {#key expr}content{/key} ---> expr; content + */ +function handleKey(str, keyBlock) { + // {#key expr} -> expr; + str.overwrite(keyBlock.start, keyBlock.expression.start, '', { contentOnly: true }); + const expressionEnd = withTrailingPropertyAccess(str.original, keyBlock.expression.end); + const end = str.original.indexOf('}', expressionEnd); + str.overwrite(expressionEnd, end + 1, '; '); + // {/key} -> + const endKey = str.original.lastIndexOf('{', keyBlock.end - 1); + if (!isImplicitlyClosedBlock(endKey, keyBlock)) { + str.overwrite(endKey, keyBlock.end, '', { contentOnly: true }); + } +} + +/** + * `let:foo={bar}` --> `foo:bar`, which becomes `const {foo:bar} = $$_parent.$$slotDef['slotName'];` + * @param node + * @param element + */ +function handleLet(str, node, parent, preserveCase, svelte5Plus, element) { + if (element instanceof InlineComponent) { + // let:xx belongs to either the default slot or a named slot, + // which is determined in Attribute.ts + addSlotLet(node, element); + } + else { + if (element.parent instanceof InlineComponent) { + // let:xx is on a HTML element and belongs to a (named slot of a parent component + addSlotLet(node, element); + } + else { + // let:xx is a regular HTML attribute (probably a mistake by the user) + handleAttribute(str, { + start: node.start, + end: node.end, + type: 'Attribute', + name: 'let:' + node.name, + value: node.expression + ? [ + { + type: 'MustacheTag', + start: node.expression.start, + end: node.expression.end, + expression: node.expression + } + ] + : true + }, parent, preserveCase, svelte5Plus, element); + } + } +} +function addSlotLet(node, element) { + const letTransformation = [ + [node.start + 'let:'.length, node.start + 'let:'.length + node.name.length] + ]; + if (node.expression) { + letTransformation.push(':', [node.expression.start, node.expression.end]); + } + element.addSlotLet(letTransformation); +} + +/** + * Handle mustache tags that are not part of attributes + * {a} --> a; + */ +function handleMustacheTag(str, node, parent) { + if (parent.type === 'Attribute' || parent.type === 'StyleDirective') { + // handled inside Attribute.ts / StyleDirective.ts + return; + } + str.overwrite(node.start, node.start + 1, '', { contentOnly: true }); + str.overwrite(node.end - 1, node.end, ';', { contentOnly: true }); +} + +/** + * {@html ...} ---> ...; + */ +function handleRawHtml(str, node) { + str.overwrite(node.start, node.expression.start, ' '); + str.overwrite(withTrailingPropertyAccess(str.original, node.expression.end), node.end, ';'); +} + +/** + * Handle spreaded attributes/props on elements/components by removing the braces. + * That way they can be added as a regular object spread. + * `{...xx}` -> `...x` + */ +function handleSpread(node, element) { + const transformation = [[node.start + 1, node.end - 1]]; + if (element instanceof Element) { + element.addAttribute(transformation); + } + else { + element.addProp(transformation); + } +} + +/** + * style:xx ---> __sveltets_2_ensureType(String, Number, xx); + * style:xx={yy} ---> __sveltets_2_ensureType(String, Number, yy); + * style:xx="yy" ---> __sveltets_2_ensureType(String, Number, "yy"); + * style:xx="a{b}" ---> __sveltets_2_ensureType(String, Number, `a${b}`); + */ +function handleStyleDirective(str, style, element) { + const htmlx = str.original; + const ensureType = '__sveltets_2_ensureType(String, Number, '; + if (style.value === true || style.value.length === 0) { + element.appendToStartEnd([ + ensureType, + [htmlx.indexOf(':', style.start) + 1, style.end], + ');' + ]); + return; + } + if (style.value.length > 1) { + // We have multiple attribute values, so we build a template string out of them. + for (const n of style.value) { + if (n.type === 'MustacheTag') { + str.appendRight(n.start, '$'); + } + } + element.appendToStartEnd([ + ensureType + '`', + [style.value[0].start, style.value[style.value.length - 1].end], + '`);' + ]); + return; + } + const styleVal = style.value[0]; + if (styleVal.type === 'Text') { + const quote = ['"', "'"].includes(str.original[styleVal.start - 1]) + ? str.original[styleVal.start - 1] + : '"'; + element.appendToStartEnd([ + `${ensureType}${quote}`, + [styleVal.start, styleVal.end], + `${quote});` + ]); + } + else { + // MustacheTag + element.appendToStartEnd([ensureType, [styleVal.start + 1, styleVal.end - 1], ');']); + } +} + +/** + * Handles a text node transformation. + * Removes everything except whitespace (for better visual output) when it's normal HTML text for example inside an element + * to not clutter up the output. For attributes it leaves the text as is. + */ +function handleText(str, node, parent) { + if (!node.data || parent.type === 'Attribute') { + return; + } + let replacement = node.data.replace(/\S/g, ''); + if (!replacement && node.data.length) { + // minimum of 1 whitespace which ensure hover or other things don't give weird results + // where for example you hover over a text and get a hover info about the containing tag. + replacement = ' '; + } + str.overwrite(node.start, node.end, replacement, { + contentOnly: true + }); +} + +/** + * transition|modifier:xxx(yyy) ---> __sveltets_2_ensureTransition(xxx(svelte.mapElementTag('..'),(yyy))); + */ +function handleTransitionDirective(str, attr, element) { + const transformations = [ + '__sveltets_2_ensureTransition(', + getDirectiveNameStartEndIdx(str, attr), + `(${element.typingsNamespace}.mapElementTag('${element.tagName}')` + ]; + if (attr.expression) { + transformations.push(',(', rangeWithTrailingPropertyAccess(str.original, attr.expression), ')'); + } + transformations.push('));'); + element.appendToStartEnd(transformations); +} + +/** + * Transform #snippet into a function + * + * ```html + * {#snippet foo(bar)} + * .. + * {/snippet} + * ``` + * --> if standalone: + * ```ts + * const foo = (bar) => { async () => { + * .. + * };return return __sveltets_2_any(0)}; + * ``` + * --> if slot prop: + * ```ts + * foo: (bar) => { + * .. + * } + * ``` + */ +function handleSnippet(str, snippetBlock, component) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + const isImplicitProp = component !== undefined; + const endSnippet = str.original.lastIndexOf('{', snippetBlock.end - 1); + const afterSnippet = isImplicitProp + ? `};return __sveltets_2_any(0)}` + : `};return __sveltets_2_any(0)};`; + if (isImplicitlyClosedBlock(endSnippet, snippetBlock)) { + str.prependLeft(snippetBlock.end, afterSnippet); + } + else { + str.overwrite(endSnippet, snippetBlock.end, afterSnippet, { + contentOnly: true + }); + } + const lastParameter = (_a = snippetBlock.parameters) === null || _a === void 0 ? void 0 : _a.at(-1); + const startEnd = str.original.indexOf('}', (_d = (_c = (_b = lastParameter === null || lastParameter === void 0 ? void 0 : lastParameter.typeAnnotation) === null || _b === void 0 ? void 0 : _b.end) !== null && _c !== void 0 ? _c : lastParameter === null || lastParameter === void 0 ? void 0 : lastParameter.end) !== null && _d !== void 0 ? _d : snippetBlock.expression.end) + 1; + let parameters; + if ((_e = snippetBlock.parameters) === null || _e === void 0 ? void 0 : _e.length) { + const firstParameter = snippetBlock.parameters[0]; + const start = (_h = (_g = (_f = firstParameter === null || firstParameter === void 0 ? void 0 : firstParameter.leadingComments) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.start) !== null && _h !== void 0 ? _h : firstParameter.start; + const end = (_k = (_j = lastParameter.typeAnnotation) === null || _j === void 0 ? void 0 : _j.end) !== null && _k !== void 0 ? _k : lastParameter.end; + parameters = [start, end]; + } + // inner async function for potential #await blocks + const afterParameters = ` => { async ()${IGNORE_POSITION_COMMENT} => {`; + if (isImplicitProp) { + /** Can happen in loose parsing mode, e.g. code is currently `{#snippet }` */ + const emptyId = snippetBlock.expression.start === snippetBlock.expression.end; + if (emptyId) { + // Give intellisense a way to map into the right position for implicit prop completion + str.overwrite(snippetBlock.start, snippetBlock.expression.start - 1, '', { + contentOnly: true + }); + str.overwrite(snippetBlock.expression.start - 1, snippetBlock.expression.start, ' ', { + contentOnly: true + }); + } + else { + str.overwrite(snippetBlock.start, snippetBlock.expression.start, '', { + contentOnly: true + }); + } + const transforms = ['(']; + if (parameters) { + transforms.push(parameters); + const [start, end] = parameters; + str.overwrite(snippetBlock.expression.end, start, '', { + contentOnly: true + }); + str.overwrite(end, startEnd, '', { contentOnly: true }); + } + else { + str.overwrite(snippetBlock.expression.end, startEnd, '', { contentOnly: true }); + } + transforms.push(')' + afterParameters); + transforms.push([startEnd, snippetBlock.end]); + if (component instanceof InlineComponent) { + component.addImplicitSnippetProp([snippetBlock.expression.start - (emptyId ? 1 : 0), snippetBlock.expression.end], transforms); + } + else { + component.addAttribute([[snippetBlock.expression.start - (emptyId ? 1 : 0), snippetBlock.expression.end]], transforms); + } + } + else { + const transforms = [ + 'const ', + [snippetBlock.expression.start, snippetBlock.expression.end], + IGNORE_POSITION_COMMENT, + ' = (' + ]; + if (parameters) { + transforms.push(parameters); + } + transforms.push(')', surroundWithIgnoreComments(`: ReturnType`), // shows up nicely preserved on hover, other alternatives don't + afterParameters); + transform(str, snippetBlock.start, startEnd, transforms); + } +} +function handleImplicitChildren(componentNode, component) { + var _a; + if (((_a = componentNode.children) === null || _a === void 0 ? void 0 : _a.length) === 0) { + return; + } + let hasSlot = false; + for (const child of componentNode.children) { + if (child.type === 'SvelteSelf' || + child.type === 'InlineComponent' || + child.type === 'Element' || + child.type === 'SlotTemplate') { + if (child.attributes.some((a) => { + var _a; + return a.type === 'Attribute' && + a.name === 'slot' && + ((_a = a.value[0]) === null || _a === void 0 ? void 0 : _a.data) !== 'default'; + })) { + continue; + } + } + if (child.type === 'Comment' || + child.type === 'Slot' || + (child.type === 'Text' && child.data.trim() === '')) { + continue; + } + if (child.type !== 'SnippetBlock') { + hasSlot = true; + break; + } + } + if (!hasSlot) { + return; + } + // it's enough to fake a children prop, we don't need to actually move the content inside (which would also reset control flow) + component.addProp(['children'], ['() => { return __sveltets_2_any(0); }']); +} +function hoistSnippetBlock(str, blockOrEl) { + var _a; + if (blockOrEl.type === 'InlineComponent' || blockOrEl.type === 'SvelteBoundary') { + // implicit props, handled in InlineComponent + return; + } + let targetPosition; + for (const node of (_a = blockOrEl.children) !== null && _a !== void 0 ? _a : []) { + if (node.type !== 'SnippetBlock') { + if (targetPosition === undefined && (node.type !== 'Text' || node.data.trim() !== '')) { + targetPosition = node.type === 'Text' ? node.end : node.start; + } + continue; + } + // already first + if (targetPosition === undefined) { + continue; + } + if (node.start === targetPosition) { + continue; + } + str.move(node.start, node.end, targetPosition); + } +} + +/** + * `{@render foo(x)}` --> `;foo(x);` + */ +function handleRenderTag(str, renderTag) { + str.overwrite(renderTag.start, renderTag.expression.start, ';__sveltets_2_ensureSnippet(', { + contentOnly: true + }); + str.overwrite(withTrailingPropertyAccess(str.original, renderTag.expression.end), renderTag.end, ');'); +} + +/** + * Add this tag to a HTML comment in a Svelte component and its contents will + * be added as a docstring in the resulting JSX for the component class. + */ +const COMPONENT_DOCUMENTATION_HTML_COMMENT_TAG = '@component'; +class ComponentDocumentation { + constructor() { + this.componentDocumentation = ''; + this.handleComment = (node) => { + if ('data' in node && + typeof node.data === 'string' && + node.data.includes(COMPONENT_DOCUMENTATION_HTML_COMMENT_TAG)) { + this.componentDocumentation = node.data + .replace(COMPONENT_DOCUMENTATION_HTML_COMMENT_TAG, '') + .trim(); + } + }; + } + getFormatted() { + if (!this.componentDocumentation) { + return ''; + } + if (!this.componentDocumentation.includes('\n')) { + return `/** ${this.componentDocumentation} */\n`; + } + const lines = dedent(this.componentDocumentation) + .split('\n') + .map((line) => ` *${line ? ` ${line}` : ''}`) + .join('\n'); + return `/**\n${lines}\n */\n`; + } +} + +let Scope$1 = class Scope { + constructor(parent) { + this.declared = new Set(); + this.parent = parent; + } + hasDefined(name) { + return this.declared.has(name) || (!!this.parent && this.parent.hasDefined(name)); + } +}; +class ScopeStack { + constructor() { + this.current = new Scope$1(); + } + push() { + this.current = new Scope$1(this.current); + } + pop() { + this.current = this.current.parent; + } +} + +function isMember$1(parent, prop) { + return parent.type == 'MemberExpression' && prop == 'property'; +} +function isObjectKey(parent, prop) { + return parent.type == 'Property' && prop == 'key'; +} +function isObjectValue(parent, prop) { + return parent.type == 'Property' && prop == 'value'; +} +function isObjectValueShortHand(property) { + const { value, key } = property; + return value && isIdentifier(value) && key.start === value.start && key.end == value.end; +} +function attributeValueIsString(attr) { + var _a; + return attr.value.length !== 1 || ((_a = attr.value[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Text'; +} +function isDestructuringPatterns(node) { + return node.type === 'ArrayPattern' || node.type === 'ObjectPattern'; +} +function isIdentifier(node) { + return node.type === 'Identifier'; +} +function getSlotName(child) { + var _a, _b; + const slot = (_a = child.attributes) === null || _a === void 0 ? void 0 : _a.find((a) => a.name == 'slot'); + return (_b = slot === null || slot === void 0 ? void 0 : slot.value) === null || _b === void 0 ? void 0 : _b[0].raw; +} + +const reservedNames = new Set(['$$props', '$$restProps', '$$slots']); +class Stores { + constructor(scope, isDeclaration) { + this.scope = scope; + this.isDeclaration = isDeclaration; + this.possibleStores = []; + } + handleDirective(node, str) { + if (this.notAStore(node.name) || this.isDeclaration.value) { + return; + } + const start = str.original.indexOf('$', node.start); + const end = start + node.name.length; + this.possibleStores.push({ + node: { type: 'Identifier', start, end, name: node.name }, + parent: { start: 0, end: 0, type: '' }, + scope: this.scope.current + }); + } + handleIdentifier(node, parent, prop) { + if (this.notAStore(node.name)) { + return; + } + //handle potential store + if (this.isDeclaration.value) { + if (isObjectKey(parent, prop)) { + return; + } + this.scope.current.declared.add(node.name); + } + else { + if (isMember$1(parent, prop) && !parent.computed) { + return; + } + if (isObjectKey(parent, prop)) { + return; + } + this.possibleStores.push({ node, parent, scope: this.scope.current }); + } + } + getStoreNames() { + const stores = this.possibleStores.filter(({ node, scope }) => { + const name = node.name; + // if variable starting with '$' was manually declared by the user, + // this isn't a store access. + return !scope.hasDefined(name); + }); + return stores.map(({ node }) => node.name.slice(1)); + } + notAStore(name) { + return name[0] !== '$' || reservedNames.has(name); + } +} + +class Scripts { + constructor(htmlxAst) { + this.htmlxAst = htmlxAst; + // All script tags, no matter at what level, are listed within the root children, because + // of the logic in htmlxparser.ts + // To get the top level scripts, filter out all those that are part of children's children. + // Those have another type ('Element' with name 'script'). + this.scriptTags = this.htmlxAst.children.filter((child) => child.type === 'Script'); + this.topLevelScripts = this.scriptTags; + } + checkIfElementIsScriptTag(node, parent) { + if (parent !== this.htmlxAst && node.name === 'script') { + this.topLevelScripts = this.topLevelScripts.filter((tag) => tag.start !== node.start || tag.end !== node.end); + } + } + checkIfContainsScriptTag(node) { + this.topLevelScripts = this.topLevelScripts.filter((tag) => !(node.start <= tag.start && node.end >= tag.end)); + } + getTopLevelScriptTags() { + let scriptTag = null; + let moduleScriptTag = null; + // should be 2 at most, one each, so using forEach is safe + this.topLevelScripts.forEach((tag) => { + if (tag.attributes && + tag.attributes.find((a) => (a.name == 'context' && + a.value.length == 1 && + a.value[0].raw == 'module') || + a.name === 'module')) { + moduleScriptTag = tag; + } + else { + scriptTag = tag; + } + }); + return { scriptTag, moduleScriptTag }; + } + blankOtherScriptTags(str) { + this.scriptTags + .filter((tag) => !this.topLevelScripts.includes(tag)) + .forEach((tag) => { + str.remove(tag.start, tag.end); + }); + } +} + +function isInterfaceOrTypeDeclaration(node) { + return ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node); +} +function findExportKeyword(node) { + var _a; + return ts.canHaveModifiers(node) + ? (_a = ts.getModifiers(node)) === null || _a === void 0 ? void 0 : _a.find((x) => x.kind == ts.SyntaxKind.ExportKeyword) + : undefined; +} +/** + * Node is like `bla = ...` or `{bla} = ...` or `[bla] = ...` + */ +function isAssignmentBinaryExpr(node) { + return (ts.isBinaryExpression(node) && + node.operatorToken.kind == ts.SyntaxKind.EqualsToken && + (ts.isIdentifier(node.left) || + ts.isObjectLiteralExpression(node.left) || + ts.isArrayLiteralExpression(node.left))); +} +/** + * Returns if node is like `$: bla = ...` or `$: ({bla} = ...)` or `$: [bla] = ...=` + */ +function getBinaryAssignmentExpr(node) { + if (ts.isExpressionStatement(node.statement)) { + if (isAssignmentBinaryExpr(node.statement.expression)) { + return node.statement.expression; + } + if (ts.isParenthesizedExpression(node.statement.expression) && + isAssignmentBinaryExpr(node.statement.expression.expression)) { + return node.statement.expression.expression; + } + } +} +/** + * Returns true if node is like `({bla} ..)` or `([bla] ...)` + */ +function isParenthesizedObjectOrArrayLiteralExpression(node) { + return (ts.isParenthesizedExpression(node) && + ts.isBinaryExpression(node.expression) && + (ts.isObjectLiteralExpression(node.expression.left) || + ts.isArrayLiteralExpression(node.expression.left))); +} +/** + * + * Adapted from https://github.com/Rich-Harris/periscopic/blob/d7a820b04e1f88b452313ab3e54771b352f0defb/src/index.ts#L150 + */ +function extractIdentifiers(node, identifiers = []) { + if (ts.isIdentifier(node)) { + identifiers.push(node); + } + else if (ts.isBindingElement(node)) { + extractIdentifiers(node.name, identifiers); + } + else if (isMember(node)) { + let object = node; + while (isMember(object)) { + object = object.expression; + } + if (ts.isIdentifier(object)) { + identifiers.push(object); + } + } + else if (ts.isArrayBindingPattern(node) || ts.isObjectBindingPattern(node)) { + node.elements.forEach((element) => { + extractIdentifiers(element, identifiers); + }); + } + else if (ts.isObjectLiteralExpression(node)) { + node.properties.forEach((child) => { + if (ts.isSpreadAssignment(child)) { + extractIdentifiers(child.expression, identifiers); + } + else if (ts.isShorthandPropertyAssignment(child)) { + // in ts Ast { a = 1 } and { a } are both ShorthandPropertyAssignment + extractIdentifiers(child.name, identifiers); + } + else if (ts.isPropertyAssignment(child)) { + // { a: b } + extractIdentifiers(child.initializer, identifiers); + } + }); + } + else if (ts.isArrayLiteralExpression(node)) { + node.elements.forEach((element) => { + if (ts.isSpreadElement(element)) { + extractIdentifiers(element, identifiers); + } + else { + extractIdentifiers(element, identifiers); + } + }); + } + else if (ts.isBinaryExpression(node)) { + extractIdentifiers(node.left, identifiers); + } + return identifiers; +} +function isMember(node) { + return ts.isElementAccessExpression(node) || ts.isPropertyAccessExpression(node); +} +/** + * Returns variable at given level with given name, + * if it is a variable declaration in the form of `const/let a = ..` + */ +function getVariableAtTopLevel(node, identifierName) { + for (const child of node.statements) { + if (ts.isVariableStatement(child)) { + const variable = child.declarationList.declarations.find((declaration) => ts.isIdentifier(declaration.name) && declaration.name.text === identifierName); + if (variable) { + return variable; + } + } + } +} +/** + * Get the leading multiline trivia doc of the node. + */ +function getLastLeadingDoc(node) { + var _a; + const nodeText = node.getFullText(); + const comments = (_a = ts + .getLeadingCommentRanges(nodeText, 0)) === null || _a === void 0 ? void 0 : _a.filter((c) => c.kind === ts.SyntaxKind.MultiLineCommentTrivia); + const comment = comments === null || comments === void 0 ? void 0 : comments[(comments === null || comments === void 0 ? void 0 : comments.length) - 1]; + if (comment) { + let commentText = nodeText.substring(comment.pos, comment.end); + const typedefTags = ts.getAllJSDocTagsOfKind(node, ts.SyntaxKind.JSDocTypedefTag); + typedefTags + .filter((tag) => tag.pos >= comment.pos) + .map((tag) => nodeText.substring(tag.pos, tag.end)) + .forEach((comment) => { + commentText = commentText.replace(comment, ''); + }); + return commentText; + } +} +/** + * Returns true if given identifier is not the property name of an aliased import. + * In other words: It is not `a` in `import {a as b} from ..` + */ +function isNotPropertyNameOfImport(identifier) { + return (!ts.isImportSpecifier(identifier.parent) || identifier.parent.propertyName !== identifier); +} +/** + * Extract the variable names that are assigned to out of a labeled statement. + */ +function getNamesFromLabeledStatement(node) { + var _a; + const leftHandSide = (_a = getBinaryAssignmentExpr(node)) === null || _a === void 0 ? void 0 : _a.left; + if (!leftHandSide) { + return []; + } + return (extractIdentifiers(leftHandSide) + .map((id) => id.text) + // svelte won't let you create a variable with $ prefix (reserved for stores) + .filter((name) => !name.startsWith('$'))); +} +/** + * move node to top of script so they appear outside our render function + */ +function moveNode(node, str, astOffset, scriptStart, sourceFile) { + var _a; + const scanner = ts.createScanner(sourceFile.languageVersion, + /*skipTrivia*/ false, sourceFile.languageVariant); + const comments = (_a = ts.getLeadingCommentRanges(node.getFullText(), 0)) !== null && _a !== void 0 ? _a : []; + if (!comments.some((comment) => comment.hasTrailingNewLine) && + isNewGroup(sourceFile, node, scanner)) { + str.appendRight(node.getStart() + astOffset, '\n'); + } + for (const comment of comments) { + const commentEnd = node.pos + comment.end + astOffset; + str.move(node.pos + comment.pos + astOffset, commentEnd, scriptStart + 1); + if (comment.hasTrailingNewLine) { + str.overwrite(commentEnd - 1, commentEnd, str.original[commentEnd - 1] + '\n'); + } + } + str.move(node.getStart() + astOffset, node.end + astOffset, scriptStart + 1); + //add in a \n + const originalEndChar = str.original[node.end + astOffset - 1]; + str.overwrite(node.end + astOffset - 1, node.end + astOffset, originalEndChar + '\n'); +} +/** + * adopted from https://github.com/microsoft/TypeScript/blob/6e0447fdf165b1cec9fc80802abcc15bd23a268f/src/services/organizeImports.ts#L111 + */ +function isNewGroup(sourceFile, topLevelImportDecl, scanner) { + const startPos = topLevelImportDecl.getFullStart(); + const endPos = topLevelImportDecl.getStart(); + scanner.setText(sourceFile.text, startPos, endPos - startPos); + let numberOfNewLines = 0; + while (scanner.getTokenPos() < endPos) { + const tokenKind = scanner.scan(); + if (tokenKind === ts.SyntaxKind.NewLineTrivia) { + numberOfNewLines++; + if (numberOfNewLines >= 2) { + return true; + } + } + } + return false; +} + +/** + * Get the constructor type of a component node + * @param node The component node to infer the this type from + * @param thisValue If node is svelte:component, you may pass the value + * of this={..} to use that instead of the more general componentType + */ +function getTypeForComponent(node) { + if (node.name === 'svelte:component' || node.name === 'svelte:self') { + return '__sveltets_1_componentType()'; + } + else { + return node.name; + } +} +function attributeStrValueAsJsExpression(attr) { + if (attr.value.length == 0) { + return "''"; //wut? + } + //handle single value + if (attr.value.length == 1) { + const attrVal = attr.value[0]; + if (attrVal.type == 'Text') { + return '"' + attrVal.raw + '"'; + } + } + // we have multiple attribute values, so we know we are building a string out of them. + // so return a dummy string, it will typecheck the same :) + return '"__svelte_ts_string"'; +} +function is$$SlotsDeclaration(node) { + return isInterfaceOrTypeDeclaration(node) && node.name.text === '$$Slots'; +} +class SlotHandler { + constructor(htmlx) { + this.htmlx = htmlx; + this.slots = new Map(); + this.resolved = new Map(); + this.resolvedExpression = new Map(); + } + resolve(identifierDef, initExpression, scope) { + let resolved = this.resolved.get(identifierDef); + if (resolved) { + return resolved; + } + resolved = this.getResolveExpressionStr(identifierDef, scope, initExpression); + if (resolved) { + this.resolved.set(identifierDef, resolved); + } + return resolved; + } + /** + * Returns a string which expresses the given identifier unpacked to + * the top level in order to express the slot types correctly later on. + * + * Example: {#each items as item} ---> __sveltets_2_unwrapArr(items) + */ + getResolveExpressionStr(identifierDef, scope, initExpression) { + const { name } = identifierDef; + const owner = scope.getOwner(name); + if ((owner === null || owner === void 0 ? void 0 : owner.type) === 'CatchBlock') { + return '__sveltets_2_any({})'; + } + // list.map(list => list.someProperty) + // initExpression's scope should the parent scope of identifier scope + else if ((owner === null || owner === void 0 ? void 0 : owner.type) === 'ThenBlock') { + const resolvedExpression = this.resolveExpression(initExpression, scope.parent); + return `__sveltets_2_unwrapPromiseLike(${resolvedExpression})`; + } + else if ((owner === null || owner === void 0 ? void 0 : owner.type) === 'EachBlock') { + const resolvedExpression = this.resolveExpression(initExpression, scope.parent); + return `__sveltets_2_unwrapArr(${resolvedExpression})`; + } + return null; + } + resolveDestructuringAssignment(destructuringNode, identifiers, initExpression, scope) { + const destructuring = this.htmlx.slice(destructuringNode.start, destructuringNode.end); + identifiers.forEach((identifier) => { + const resolved = this.getResolveExpressionStr(identifier, scope, initExpression); + if (resolved) { + this.resolved.set(identifier, `((${destructuring}) => ${identifier.name})(${resolved})`); + } + }); + } + resolveDestructuringAssignmentForLet(destructuringNode, identifiers, letNode, component, slotName) { + const destructuring = this.htmlx.slice(destructuringNode.start, destructuringNode.end); + identifiers.forEach((identifier) => { + const resolved = this.getResolveExpressionStrForLet(letNode, component, slotName); + this.resolved.set(identifier, `((${destructuring}) => ${identifier.name})(${resolved})`); + }); + } + getResolveExpressionStrForLet(letNode, component, slotName) { + return `${getSingleSlotDef(component, slotName)}.${letNode.name}`; + } + resolveLet(letNode, identifierDef, component, slotName) { + let resolved = this.resolved.get(identifierDef); + if (resolved) { + return resolved; + } + resolved = this.getResolveExpressionStrForLet(letNode, component, slotName); + this.resolved.set(identifierDef, resolved); + return resolved; + } + getSlotConsumerOfComponent(component) { + var _a; + let result = (_a = this.getLetNodes(component, 'default')) !== null && _a !== void 0 ? _a : []; + for (const child of component.children) { + const slotName = getSlotName(child); + if (slotName) { + const letNodes = this.getLetNodes(child, slotName); + if (letNodes === null || letNodes === void 0 ? void 0 : letNodes.length) { + result = result.concat(letNodes); + } + } + } + return result; + } + getLetNodes(child, slotName) { + var _a; + const letNodes = ((_a = child === null || child === void 0 ? void 0 : child.attributes) !== null && _a !== void 0 ? _a : []).filter((attr) => attr.type === 'Let'); + return letNodes === null || letNodes === void 0 ? void 0 : letNodes.map((letNode) => ({ + letNode, + slotName + })); + } + /** + * Resolves the slot expression to a string that can be used + * in the props-object in the return type of the render function + */ + resolveExpression(expression, scope) { + let resolved = this.resolvedExpression.get(expression); + if (resolved) { + return resolved; + } + const strForExpression = new MagicString(this.htmlx); + const identifiers = []; + const objectShortHands = []; + walk(expression, { + enter(node, parent, prop) { + if (node.type === 'Identifier') { + if (parent) { + if (isMember$1(parent, prop)) { + return; + } + if (isObjectKey(parent, prop)) { + return; + } + if (isObjectValue(parent, prop)) { + // { value } + if (isObjectValueShortHand(parent)) { + this.skip(); + objectShortHands.push(node); + return; + } + } + } + this.skip(); + identifiers.push(node); + } + } + }); + const getOverwrite = (name) => { + const init = scope.getInit(name); + return init ? this.resolved.get(init) : name; + }; + for (const identifier of objectShortHands) { + const { end, name } = identifier; + const value = getOverwrite(name); + strForExpression.appendLeft(end, `:${value}`); + } + for (const identifier of identifiers) { + const { start, end, name } = identifier; + const value = getOverwrite(name); + strForExpression.overwrite(start, end, value); + } + resolved = strForExpression.slice(expression.start, expression.end); + this.resolvedExpression.set(expression, resolved); + return resolved; + } + handleSlot(node, scope) { + var _a; + const nameAttr = node.attributes.find((a) => a.name == 'name'); + const slotName = nameAttr ? nameAttr.value[0].raw : 'default'; + //collect attributes + const attributes = new Map(); + for (const attr of node.attributes) { + if (attr.name == 'name') { + continue; + } + if (attr.type === 'Spread') { + const rawName = attr.expression.name; + const init = scope.getInit(rawName); + const name = init ? this.resolved.get(init) : rawName; + attributes.set(`__spread__${name}`, name); + } + if (!((_a = attr.value) === null || _a === void 0 ? void 0 : _a.length)) { + continue; + } + if (attributeValueIsString(attr)) { + attributes.set(attr.name, attributeStrValueAsJsExpression(attr)); + continue; + } + attributes.set(attr.name, this.resolveAttr(attr, scope)); + } + this.slots.set(slotName, attributes); + } + getSlotDef() { + return this.slots; + } + resolveAttr(attr, scope) { + const attrVal = attr.value[0]; + if (!attrVal) { + return null; + } + if (attrVal.type == 'AttributeShorthand') { + const { name } = attrVal.expression; + const init = scope.getInit(name); + const resolved = this.resolved.get(init); + return resolved !== null && resolved !== void 0 ? resolved : name; + } + if (attrVal.type == 'MustacheTag') { + return this.resolveExpression(attrVal.expression, scope); + } + throw Error('Unknown attribute value type:' + attrVal.type); + } +} +function getSingleSlotDef(componentNode, slotName) { + // In contrast to getSingleSlotDef in htmlx2jsx, use a simple instanceOf-transformation here. + // This means that if someone forwards a slot whose type can only be infered from the input properties + // because there's a generic relationship, then that slot type is of type any or unknown. + // This is a limitation which could be tackled later. The problem is that in contrast to the transformation + // in htmlx2jsx, we cannot know for sure that all properties we would generate the component with exist + // in this scope, some could have been generated through each/await blocks or other lets. + const componentType = getTypeForComponent(componentNode); + return `__sveltets_2_instanceOf(${componentType}).$$slot_def['${slotName}']`; +} + +/** + * adopted from https://github.com/sveltejs/svelte/blob/master/src/compiler/compile/nodes/shared/TemplateScope.ts + */ +class TemplateScope { + constructor(parent) { + this.owners = new Map(); + this.inits = new Map(); + this.parent = parent; + this.names = new Set(parent ? parent.names : []); + } + addMany(inits, owner) { + inits.forEach((item) => this.add(item, owner)); + return this; + } + add(init, owner) { + const { name } = init; + this.names.add(name); + this.inits.set(name, init); + this.owners.set(name, owner); + return this; + } + child() { + const child = new TemplateScope(this); + return child; + } + getOwner(name) { + var _a; + return this.owners.get(name) || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.getOwner(name)); + } + getInit(name) { + var _a; + return this.inits.get(name) || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.getInit(name)); + } + isLet(name) { + const owner = this.getOwner(name); + return owner && (owner.type === 'Element' || owner.type === 'InlineComponent'); + } +} + +function isReference(node, parent) { + if (node.type === 'MemberExpression') { + return !node.computed && isReference(node.object, node); + } + if (node.type === 'Identifier') { + if (!parent) + return true; + switch (parent.type) { + // disregard `bar` in `foo.bar` + case 'MemberExpression': return parent.computed || node === parent.object; + // disregard the `foo` in `class {foo(){}}` but keep it in `class {[foo](){}}` + case 'MethodDefinition': return parent.computed; + // disregard the `foo` in `class {foo=bar}` but keep it in `class {[foo]=bar}` and `class {bar=foo}` + case 'FieldDefinition': return parent.computed || node === parent.value; + // disregard the `bar` in `{ bar: foo }`, but keep it in `{ [bar]: foo }` + case 'Property': return parent.computed || node === parent.value; + // disregard the `bar` in `export { foo as bar }` or + // the foo in `import { foo as bar }` + case 'ExportSpecifier': + case 'ImportSpecifier': return node === parent.local; + // disregard the `foo` in `foo: while (...) { ... break foo; ... continue foo;}` + case 'LabeledStatement': + case 'BreakStatement': + case 'ContinueStatement': return false; + default: return true; + } + } + return false; +} + +// @ts-check + +/** @typedef { import('estree').Node} Node */ +/** @typedef { import('estree').VariableDeclaration} VariableDeclaration */ +/** @typedef { import('estree').ClassDeclaration} ClassDeclaration */ +/** @typedef { import('estree').VariableDeclarator} VariableDeclarator */ +/** @typedef { import('estree').Property} Property */ +/** @typedef { import('estree').RestElement} RestElement */ +/** @typedef { import('estree').Identifier} Identifier */ + +/** + * + * @param {Node} expression + */ +function analyze(expression) { + /** @type {WeakMap} */ + const map = new WeakMap(); + + /** @type {Map} */ + const globals = new Map(); + + const scope = new Scope(null, false); + + /** @type {[Scope, Identifier][]} */ + const references = []; + let current_scope = scope; + + walk(expression, { + /** + * + * @param {Node} node + * @param {Node} parent + */ + enter(node, parent) { + switch (node.type) { + case 'Identifier': + if (isReference(node, parent)) { + references.push([current_scope, node]); + } + break; + + case 'ImportDeclaration': + node.specifiers.forEach((specifier) => { + current_scope.declarations.set(specifier.local.name, specifier); + }); + break; + + case 'FunctionExpression': + case 'FunctionDeclaration': + case 'ArrowFunctionExpression': + if (node.type === 'FunctionDeclaration') { + if (node.id) { + current_scope.declarations.set(node.id.name, node); + } + + map.set(node, current_scope = new Scope(current_scope, false)); + } else { + map.set(node, current_scope = new Scope(current_scope, false)); + + if (node.type === 'FunctionExpression' && node.id) { + current_scope.declarations.set(node.id.name, node); + } + } + + node.params.forEach(param => { + extract_names(param).forEach(name => { + current_scope.declarations.set(name, node); + }); + }); + break; + + case 'ForStatement': + case 'ForInStatement': + case 'ForOfStatement': + map.set(node, current_scope = new Scope(current_scope, true)); + break; + + case 'BlockStatement': + map.set(node, current_scope = new Scope(current_scope, true)); + break; + + case 'ClassDeclaration': + case 'VariableDeclaration': + current_scope.add_declaration(node); + break; + + case 'CatchClause': + map.set(node, current_scope = new Scope(current_scope, true)); + + if (node.param) { + extract_names(node.param).forEach(name => { + current_scope.declarations.set(name, node.param); + }); + } + break; + } + }, + + /** + * + * @param {Node} node + */ + leave(node) { + if (map.has(node)) { + current_scope = current_scope.parent; + } + } + }); + + for (let i = references.length - 1; i >= 0; --i) { + const [scope, reference] = references[i]; + + if (!scope.references.has(reference.name)) { + add_reference(scope, reference.name); + + if (!scope.find_owner(reference.name)) { + globals.set(reference.name, reference); + } + } + } + + return { map, scope, globals }; +} + +/** + * + * @param {Scope} scope + * @param {string} name + */ +function add_reference(scope, name) { + scope.references.add(name); + if (scope.parent) add_reference(scope.parent, name); +} + +class Scope { + constructor(parent, block) { + /** @type {Scope | null} */ + this.parent = parent; + + /** @type {boolean} */ + this.block = block; + + /** @type {Map} */ + this.declarations = new Map(); + + /** @type {Set} */ + this.initialised_declarations = new Set(); + + /** @type {Set} */ + this.references = new Set(); + } + + /** + * + * @param {VariableDeclaration | ClassDeclaration} node + */ + add_declaration(node) { + if (node.type === 'VariableDeclaration') { + if (node.kind === 'var' && this.block && this.parent) { + this.parent.add_declaration(node); + } else { + /** + * + * @param {VariableDeclarator} declarator + */ + const handle_declarator = (declarator) => { + extract_names(declarator.id).forEach(name => { + this.declarations.set(name, node); + if (declarator.init) this.initialised_declarations.add(name); + }); }; + + node.declarations.forEach(handle_declarator); + } + } else if (node.id) { + this.declarations.set(node.id.name, node); + } + } + + /** + * + * @param {string} name + * @returns {Scope | null} + */ + find_owner(name) { + if (this.declarations.has(name)) return this; + return this.parent && this.parent.find_owner(name); + } + + /** + * + * @param {string} name + * @returns {boolean} + */ + has(name) { + return ( + this.declarations.has(name) || (!!this.parent && this.parent.has(name)) + ); + } +} + +/** + * + * @param {Node} param + * @returns {string[]} + */ +function extract_names(param) { + return extract_identifiers(param).map(node => node.name); +} + +/** + * + * @param {Node} param + * @param {Identifier[]} nodes + * @returns {Identifier[]} + */ +function extract_identifiers(param, nodes = []) { + switch (param.type) { + case 'Identifier': + nodes.push(param); + break; + + case 'MemberExpression': + let object = param; + while (object.type === 'MemberExpression') { + object = /** @type {any} */ (object.object); + } + nodes.push(/** @type {any} */ (object)); + break; + + case 'ObjectPattern': + /** + * + * @param {Property | RestElement} prop + */ + const handle_prop = (prop) => { + if (prop.type === 'RestElement') { + extract_identifiers(prop.argument, nodes); + } else { + extract_identifiers(prop.value, nodes); + } + }; + + param.properties.forEach(handle_prop); + break; + + case 'ArrayPattern': + /** + * + * @param {Node} element + */ + const handle_element = (element) => { + if (element) extract_identifiers(element, nodes); + }; + + param.elements.forEach(handle_element); + break; + + case 'RestElement': + extract_identifiers(param.argument, nodes); + break; + + case 'AssignmentPattern': + extract_identifiers(param.left, nodes); + break; + } + + return nodes; +} + +function handleScopeAndResolveForSlot({ identifierDef, initExpression, owner, slotHandler, templateScope }) { + if (isIdentifier(identifierDef)) { + templateScope.add(identifierDef, owner); + slotHandler.resolve(identifierDef, initExpression, templateScope); + } + if (isDestructuringPatterns(identifierDef)) { + // the node object is returned as-it with no mutation + const identifiers = extract_identifiers(identifierDef); + templateScope.addMany(identifiers, owner); + slotHandler.resolveDestructuringAssignment(identifierDef, identifiers, initExpression, templateScope); + } +} +function handleScopeAndResolveLetVarForSlot({ letNode, component, slotName, templateScope, slotHandler }) { + const { expression } = letNode; + // + if (!expression) { + templateScope.add(letNode, component); + slotHandler.resolveLet(letNode, letNode, component, slotName); + } + else { + if (isIdentifier(expression)) { + templateScope.add(expression, component); + slotHandler.resolveLet(letNode, expression, component, slotName); + } + const expForExtract = { ...expression }; + // https://github.com/sveltejs/svelte/blob/3a37de364bfbe75202d8e9fcef9e76b9ce6faaa2/src/compiler/compile/nodes/Let.ts#L37 + if (expression.type === 'ArrayExpression') { + expForExtract.type = 'ArrayPattern'; + } + else if (expression.type === 'ObjectExpression') { + expForExtract.type = 'ObjectPattern'; + } + if (isDestructuringPatterns(expForExtract)) { + const identifiers = extract_identifiers(expForExtract); + templateScope.addMany(identifiers, component); + slotHandler.resolveDestructuringAssignmentForLet(expForExtract, identifiers, letNode, component, slotName); + } + } +} + +class EventHandler { + constructor() { + this.bubbledEvents = new Map(); + this.callees = []; + } + handleEventHandler(node, parent) { + const eventName = node.name; + // pass-through/ bubble + if (!node.expression) { + if (parent.type === 'InlineComponent') { + if (parent.name !== 'svelte:self') { + this.handleEventHandlerBubble(parent, eventName); + } + return; + } + this.bubbledEvents.set(eventName, getEventDefExpressionForNonComponent(eventName, parent)); + } + } + handleIdentifier(node, parent, prop) { + if (prop === 'callee') { + this.callees.push({ name: node.name, parent }); + } + } + getBubbledEvents() { + return this.bubbledEvents; + } + getDispatchedEventsForIdentifier(name) { + const eventNames = new Set(); + this.callees.forEach((callee) => { + if (callee.name === name) { + const [name] = callee.parent.arguments; + if (name.value !== undefined) { + eventNames.add(name.value); + } + } + }); + return eventNames; + } + bubbledEventsAsStrings() { + return Array.from(this.bubbledEvents.entries()).map(eventMapEntryToString); + } + handleEventHandlerBubble(parent, eventName) { + const componentEventDef = `__sveltets_2_instanceOf(${parent.name})`; + const exp = `__sveltets_2_bubbleEventDef(${componentEventDef}.$$events_def, '${eventName}')`; + const exist = this.bubbledEvents.get(eventName); + this.bubbledEvents.set(eventName, exist ? [].concat(exist, exp) : exp); + } +} +function getEventDefExpressionForNonComponent(eventName, ele) { + switch (ele.type) { + case 'Element': + return `__sveltets_2_mapElementEvent('${eventName}')`; + case 'Body': + return `__sveltets_2_mapBodyEvent('${eventName}')`; + case 'Window': + return `__sveltets_2_mapWindowEvent('${eventName}')`; + } +} +function eventMapEntryToString([eventName, expression]) { + return `'${eventName}':${Array.isArray(expression) ? `__sveltets_2_unionType(${expression.join(',')})` : expression}`; +} + +function is$$EventsDeclaration(node) { + return isInterfaceOrTypeDeclaration(node) && node.name.text === '$$Events'; +} +/** + * This class accumulates all events that are dispatched from the component. + * It also tracks bubbled/forwarded events. + * + * It can not track events which are not fired through a variable + * which was not instantiated within the component with `createEventDispatcher`. + * This means that event dispatchers which are defined outside of the component and then imported do not get picked up. + * + * The logic is as follows: + * - If there exists a ComponentEvents interface definition, use that and skip the rest + * - Else first try to find the `createEventDispatcher` import + * - If it exists, try to find the variables where `createEventDispatcher()` is assigned to + * - For each variable found, try to find out if it's typed. + * - If yes, extract the event names and the event types from it + * - If no, track all invocations of it to get the event names + */ +class ComponentEvents { + get eventsClass() { + return this.componentEventsInterface.isPresent() + ? this.componentEventsInterface + : this.componentEventsFromEventsMap; + } + constructor(eventHandler, strictEvents, str) { + this.strictEvents = strictEvents; + this.str = str; + this.componentEventsInterface = new ComponentEventsFromInterface(); + this.componentEventsFromEventsMap = new ComponentEventsFromEventsMap(eventHandler); + } + /** + * Collect state and create the API which will be part + * of the return object of the `svelte2tsx` function. + */ + createAPI() { + const entries = []; + const iterableEntries = this.eventsClass.events.entries(); + for (const entry of iterableEntries) { + entries.push({ name: entry[0], ...entry[1] }); + } + return { + getAll() { + return entries; + } + }; + } + toDefString() { + return this.eventsClass.toDefString(); + } + setComponentEventsInterface(node, astOffset) { + this.componentEventsInterface.setComponentEventsInterface(node, this.str, astOffset); + } + hasEvents() { + return this.eventsClass.events.size > 0; + } + hasStrictEvents() { + return this.componentEventsInterface.isPresent() || this.strictEvents; + } + checkIfImportIsEventDispatcher(node) { + this.componentEventsFromEventsMap.checkIfImportIsEventDispatcher(node); + this.componentEventsInterface.checkIfImportIsEventDispatcher(node); + } + checkIfIsStringLiteralDeclaration(node) { + this.componentEventsFromEventsMap.checkIfIsStringLiteralDeclaration(node); + } + checkIfDeclarationInstantiatedEventDispatcher(node) { + this.componentEventsFromEventsMap.checkIfDeclarationInstantiatedEventDispatcher(node); + this.componentEventsInterface.checkIfDeclarationInstantiatedEventDispatcher(node); + } + checkIfCallExpressionIsDispatch(node) { + this.componentEventsFromEventsMap.checkIfCallExpressionIsDispatch(node); + } +} +class ComponentEventsFromInterface { + constructor() { + this.events = new Map(); + this.eventDispatcherImport = ''; + } + setComponentEventsInterface(node, str, astOffset) { + this.str = str; + this.astOffset = astOffset; + this.events = this.extractEvents(node); + } + checkIfImportIsEventDispatcher(node) { + if (this.eventDispatcherImport) { + return; + } + this.eventDispatcherImport = checkIfImportIsEventDispatcher(node); + } + checkIfDeclarationInstantiatedEventDispatcher(node) { + if (!this.isPresent()) { + return; + } + const result = checkIfDeclarationInstantiatedEventDispatcher(node, this.eventDispatcherImport); + if (!result) { + return; + } + const { dispatcherTyping, dispatcherCreationExpr } = result; + if (!dispatcherTyping) { + this.str.prependLeft(dispatcherCreationExpr.expression.getEnd() + this.astOffset, '<__sveltets_2_CustomEvents<$$Events>>'); + } + } + toDefString() { + return this.isPresent() ? '{} as unknown as $$Events' : undefined; + } + isPresent() { + return !!this.str; + } + extractEvents(node) { + const map = new Map(); + if (ts.isInterfaceDeclaration(node)) { + this.extractProperties(node.members, map); + } + else { + if (ts.isTypeLiteralNode(node.type)) { + this.extractProperties(node.type.members, map); + } + else if (ts.isIntersectionTypeNode(node.type)) { + node.type.types.forEach((type) => { + if (ts.isTypeLiteralNode(type)) { + this.extractProperties(type.members, map); + } + }); + } + } + return map; + } + extractProperties(members, map) { + members.filter(ts.isPropertySignature).forEach((member) => { + var _a; + map.set(getName(member.name), { + type: ((_a = member.type) === null || _a === void 0 ? void 0 : _a.getText()) || 'Event', + doc: getDoc(member) + }); + }); + } +} +class ComponentEventsFromEventsMap { + constructor(eventHandler) { + this.eventHandler = eventHandler; + this.events = new Map(); + this.dispatchedEvents = new Set(); + this.stringVars = new Map(); + this.eventDispatcherImport = ''; + this.eventDispatchers = []; + this.events = this.extractEvents(eventHandler); + } + checkIfImportIsEventDispatcher(node) { + if (this.eventDispatcherImport) { + return; + } + this.eventDispatcherImport = checkIfImportIsEventDispatcher(node); + } + checkIfIsStringLiteralDeclaration(node) { + if (ts.isIdentifier(node.name) && + node.initializer && + ts.isStringLiteral(node.initializer)) { + this.stringVars.set(node.name.text, node.initializer.text); + } + } + checkIfDeclarationInstantiatedEventDispatcher(node) { + const result = checkIfDeclarationInstantiatedEventDispatcher(node, this.eventDispatcherImport); + if (!result) { + return; + } + const { dispatcherTyping, dispatcherName } = result; + if (dispatcherTyping) { + this.eventDispatchers.push({ + name: dispatcherName, + typing: dispatcherTyping.getText() + }); + if (ts.isTypeLiteralNode(dispatcherTyping)) { + dispatcherTyping.members.filter(ts.isPropertySignature).forEach((member) => { + var _a; + this.addToEvents(getName(member.name), { + type: `CustomEvent<${((_a = member.type) === null || _a === void 0 ? void 0 : _a.getText()) || 'any'}>`, + doc: getDoc(member) + }); + }); + } + } + else { + this.eventDispatchers.push({ name: dispatcherName }); + this.eventHandler + .getDispatchedEventsForIdentifier(dispatcherName) + .forEach((evtName) => { + this.addToEvents(evtName); + this.dispatchedEvents.add(evtName); + }); + } + } + checkIfCallExpressionIsDispatch(node) { + if (this.eventDispatchers.some((dispatcher) => !dispatcher.typing && + ts.isIdentifier(node.expression) && + node.expression.text === dispatcher.name)) { + const firstArg = node.arguments[0]; + if (ts.isStringLiteral(firstArg)) { + this.addToEvents(firstArg.text); + this.dispatchedEvents.add(firstArg.text); + } + else if (ts.isIdentifier(firstArg)) { + const str = this.stringVars.get(firstArg.text); + if (str) { + this.addToEvents(str); + this.dispatchedEvents.add(str); + } + } + } + } + addToEvents(eventName, info = { type: 'CustomEvent' }) { + if (this.events.has(eventName)) { + // If there are multiple definitions, merge them by falling back to any-typing + this.events.set(eventName, { type: 'CustomEvent' }); + this.dispatchedEvents.add(eventName); + } + else { + this.events.set(eventName, info); + } + } + toDefString() { + return ('{' + + [ + ...this.eventDispatchers + .map((dispatcher) => dispatcher.typing && + `...__sveltets_2_toEventTypings<${dispatcher.typing}>()`) + .filter((str) => !!str), + ...this.eventHandler.bubbledEventsAsStrings(), + ...[...this.dispatchedEvents.keys()].map((e) => `'${e}': __sveltets_2_customEvent`) + ].join(', ') + + '}'); + } + extractEvents(eventHandler) { + const map = new Map(); + for (const name of eventHandler.getBubbledEvents().keys()) { + map.set(name, { type: 'Event' }); + } + return map; + } +} +function getName(prop) { + if (ts.isIdentifier(prop) || ts.isStringLiteral(prop)) { + return prop.text; + } + if (ts.isComputedPropertyName(prop)) { + if (ts.isIdentifier(prop.expression)) { + const identifierName = prop.expression.text; + const identifierValue = getIdentifierValue(prop, identifierName); + if (!identifierValue) { + throwError$1(prop); + } + return identifierValue; + } + } + throwError$1(prop); +} +function getIdentifierValue(prop, identifierName) { + const variable = getVariableAtTopLevel(prop.getSourceFile(), identifierName); + if (variable && ts.isStringLiteral(variable.initializer)) { + return variable.initializer.text; + } +} +function throwError$1(prop) { + const error = new Error('The ComponentEvents interface can only have properties of type ' + + 'Identifier, StringLiteral or ComputedPropertyName. ' + + 'In case of ComputedPropertyName, ' + + 'it must be a const declared within the component and initialized with a string.'); + error.start = toLineColumn(prop.getStart()); + error.end = toLineColumn(prop.getEnd()); + throw error; + function toLineColumn(pos) { + const lineChar = prop.getSourceFile().getLineAndCharacterOfPosition(pos); + return { + line: lineChar.line + 1, + column: lineChar.character + }; + } +} +function getDoc(member) { + let doc = undefined; + const comment = getLastLeadingDoc(member); + if (comment) { + doc = comment + .split('\n') + .map((line) => + // Remove /** */ + line + .replace(/\s*\/\*\*/, '') + .replace(/\s*\*\//, '') + .replace(/\s*\*/, '') + .trim()) + .join('\n'); + } + return doc; +} +function checkIfImportIsEventDispatcher(node) { + var _a; + if (ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text !== 'svelte') { + return; + } + const namedImports = (_a = node.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings; + if (namedImports && ts.isNamedImports(namedImports)) { + const eventDispatcherImport = namedImports.elements.find( + // If it's an aliased import, propertyName is set + (el) => (el.propertyName || el.name).text === 'createEventDispatcher'); + if (eventDispatcherImport) { + return eventDispatcherImport.name.text; + } + } +} +function checkIfDeclarationInstantiatedEventDispatcher(node, eventDispatcherImport) { + var _a; + if (!ts.isIdentifier(node.name) || !node.initializer) { + return; + } + if (ts.isCallExpression(node.initializer) && + ts.isIdentifier(node.initializer.expression) && + node.initializer.expression.text === eventDispatcherImport) { + const dispatcherName = node.name.text; + const dispatcherTyping = (_a = node.initializer.typeArguments) === null || _a === void 0 ? void 0 : _a[0]; + return { + dispatcherName, + dispatcherTyping, + dispatcherCreationExpr: node.initializer + }; + } +} + +function stripDoctype(str) { + const regex = /(\n)?/i; + const result = regex.exec(str.original); + if (result) { + str.remove(result.index, result.index + result[0].length); + } +} +/** + * Walks the HTMLx part of the Svelte component + * and converts it to JSX + */ +function convertHtmlxToJsx(str, ast, tags, options = { svelte5Plus: false }) { + options.typingsNamespace = options.typingsNamespace || 'svelteHTML'; + const preserveAttributeCase = options.namespace === 'foreign'; + stripDoctype(str); + const rootSnippets = []; + let element; + const pendingSnippetHoistCheck = new Set(); + let uses$$props = false; + let uses$$restProps = false; + let uses$$slots = false; + let usesAccessors = !!options.accessors; + let isRunes = false; + const componentDocumentation = new ComponentDocumentation(); + //track if we are in a declaration scope + const isDeclaration = { value: false }; + //track $store variables since we are only supposed to give top level scopes special treatment, and users can declare $blah variables at higher scopes + //which prevents us just changing all instances of Identity that start with $ + const scopeStack = new ScopeStack(); + const stores = new Stores(scopeStack, isDeclaration); + const scripts = new Scripts(ast); + const handleSvelteOptions = (node) => { + for (let i = 0; i < node.attributes.length; i++) { + const optionName = node.attributes[i].name; + const optionValue = node.attributes[i].value; + switch (optionName) { + case 'accessors': + if (Array.isArray(optionValue)) { + if (optionValue[0].type === 'MustacheTag') { + usesAccessors = optionValue[0].expression.value; + } + } + else { + usesAccessors = true; + } + break; + case 'runes': + isRunes = true; + break; + } + } + }; + const handleIdentifier = (node) => { + if (node.name === '$$props') { + uses$$props = true; + return; + } + if (node.name === '$$restProps') { + uses$$restProps = true; + return; + } + if (node.name === '$$slots') { + uses$$slots = true; + return; + } + }; + const handleStyleTag = (node) => { + str.remove(node.start, node.end); + }; + const slotHandler = new SlotHandler(str.original); + let templateScope = new TemplateScope(); + const handleComponentLet = (component) => { + templateScope = templateScope.child(); + const lets = slotHandler.getSlotConsumerOfComponent(component); + for (const { letNode, slotName } of lets) { + handleScopeAndResolveLetVarForSlot({ + letNode, + slotName, + slotHandler, + templateScope, + component + }); + } + }; + const handleScopeAndResolveForSlotInner = (identifierDef, initExpression, owner) => { + handleScopeAndResolveForSlot({ + identifierDef, + initExpression, + slotHandler, + templateScope, + owner + }); + }; + const eventHandler = new EventHandler(); + walk(ast, { + enter: (estreeTypedNode, estreeTypedParent, prop) => { + var _a; + const node = estreeTypedNode; + const parent = estreeTypedParent; + if (prop == 'params' && + (parent.type == 'FunctionDeclaration' || parent.type == 'ArrowFunctionExpression')) { + isDeclaration.value = true; + } + if (prop == 'id' && parent.type == 'VariableDeclarator') { + isDeclaration.value = true; + } + try { + switch (node.type) { + case 'Identifier': + handleIdentifier(node); + stores.handleIdentifier(node, parent, prop); + eventHandler.handleIdentifier(node, parent, prop); + break; + case 'IfBlock': + handleIf(str, node); + break; + case 'EachBlock': + templateScope = templateScope.child(); + if (node.context) { + handleScopeAndResolveForSlotInner(node.context, node.expression, node); + } + handleEach(str, node); + break; + case 'ElseBlock': + handleElse(str, node, parent); + break; + case 'KeyBlock': + handleKey(str, node); + break; + case 'BlockStatement': + case 'FunctionDeclaration': + case 'ArrowFunctionExpression': + scopeStack.push(); + break; + case 'SnippetBlock': + scopeStack.push(); + handleSnippet(str, node, (element instanceof InlineComponent && + estreeTypedParent.type === 'InlineComponent') || + (element instanceof Element && + element.tagName === 'svelte:boundary') + ? element + : undefined); + if (parent === ast) { + // root snippet -> move to instance script or possibly even module script + const result = analyze({ + type: 'FunctionDeclaration', + start: -1, + end: -1, + id: node.expression, + params: (_a = node.parameters) !== null && _a !== void 0 ? _a : [], + body: { + type: 'BlockStatement', + start: -1, + end: -1, + body: node.children // wrong AST, but periscopic doesn't care + } + }); + rootSnippets.push([node.start, node.end, result.globals]); + } + else { + pendingSnippetHoistCheck.add(parent); + } + break; + case 'MustacheTag': + handleMustacheTag(str, node, parent); + break; + case 'RawMustacheTag': + scripts.checkIfContainsScriptTag(node); + handleRawHtml(str, node); + break; + case 'DebugTag': + handleDebug(str, node); + break; + case 'ConstTag': + handleConstTag(str, node); + break; + case 'RenderTag': + handleRenderTag(str, node); + break; + case 'InlineComponent': + if (element) { + element.child = new InlineComponent(str, node, element); + element = element.child; + } + else { + element = new InlineComponent(str, node); + } + if (options.svelte5Plus) { + handleImplicitChildren(node, element); + } + handleComponentLet(node); + break; + case 'Element': + case 'Options': + case 'Window': + case 'Head': + case 'Title': + case 'Document': + case 'Body': + case 'SvelteHTML': + case 'SvelteBoundary': + case 'Slot': + case 'SlotTemplate': + if (node.type === 'Element') { + scripts.checkIfElementIsScriptTag(node, parent); + } + else if (node.type === 'Options') { + handleSvelteOptions(node); + } + else if (node.type === 'Slot') { + slotHandler.handleSlot(node, templateScope); + } + if (node.name !== '!DOCTYPE') { + if (element) { + element.child = new Element(str, node, options.typingsNamespace, element); + element = element.child; + } + else { + element = new Element(str, node, options.typingsNamespace); + } + } + break; + case 'Comment': + componentDocumentation.handleComment(node); + handleComment(str, node); + break; + case 'Binding': + handleBinding(str, node, parent, element, options.typingsNamespace === 'svelteHTML', options.svelte5Plus); + break; + case 'Class': + handleClassDirective(str, node, element); + break; + case 'StyleDirective': + handleStyleDirective(str, node, element); + break; + case 'Action': + stores.handleDirective(node, str); + handleActionDirective(node, element); + break; + case 'Transition': + stores.handleDirective(node, str); + handleTransitionDirective(str, node, element); + break; + case 'Animation': + stores.handleDirective(node, str); + handleAnimateDirective(str, node, element); + break; + case 'Attribute': + handleAttribute(str, node, parent, preserveAttributeCase, options.svelte5Plus, element); + break; + case 'Spread': + handleSpread(node, element); + break; + case 'EventHandler': + eventHandler.handleEventHandler(node, parent); + handleEventHandler(str, node, element); + break; + case 'Let': + handleLet(str, node, parent, preserveAttributeCase, options.svelte5Plus, element); + break; + case 'Text': + handleText(str, node, parent); + break; + case 'Style': + handleStyleTag(node); + break; + case 'VariableDeclarator': + isDeclaration.value = true; + break; + case 'AwaitBlock': + templateScope = templateScope.child(); + if (node.value) { + handleScopeAndResolveForSlotInner(node.value, node.expression, node.then); + } + if (node.error) { + handleScopeAndResolveForSlotInner(node.error, node.expression, node.catch); + } + break; + } + } + catch (e) { + console.error('Error walking node ', node, e); + throw e; + } + }, + leave: (estreeTypedNode, estreeTypedParent, prop) => { + const node = estreeTypedNode; + const parent = estreeTypedParent; + if (prop == 'params' && + (parent.type == 'FunctionDeclaration' || parent.type == 'ArrowFunctionExpression')) { + isDeclaration.value = false; + } + if (prop == 'id' && parent.type == 'VariableDeclarator') { + isDeclaration.value = false; + } + const onTemplateScopeLeave = () => { + templateScope = templateScope.parent; + }; + try { + switch (node.type) { + case 'BlockStatement': + case 'FunctionDeclaration': + case 'ArrowFunctionExpression': + case 'SnippetBlock': + scopeStack.pop(); + break; + case 'EachBlock': + onTemplateScopeLeave(); + break; + case 'AwaitBlock': + onTemplateScopeLeave(); + handleAwait(str, node); + break; + case 'InlineComponent': + case 'Element': + case 'Options': + case 'Window': + case 'Head': + case 'Title': + case 'Body': + case 'SvelteHTML': + case 'SvelteBoundary': + case 'Document': + case 'Slot': + case 'SlotTemplate': + if (node.type === 'InlineComponent') { + onTemplateScopeLeave(); + } + if (node.name !== '!DOCTYPE') { + element.performTransformation(); + element = element.parent; + } + break; + } + } + catch (e) { + console.error('Error leaving node ', node); + throw e; + } + } + }); + // hoist inner snippets to top of containing element + for (const node of pendingSnippetHoistCheck) { + hoistSnippetBlock(str, node); + } + // resolve scripts + const { scriptTag, moduleScriptTag } = scripts.getTopLevelScriptTags(); + if (options.mode !== 'ts') { + scripts.blankOtherScriptTags(str); + } + //resolve stores + const resolvedStores = stores.getStoreNames(); + return { + htmlAst: ast, + moduleScriptTag, + scriptTag, + rootSnippets, + slots: slotHandler.getSlotDef(), + events: new ComponentEvents(eventHandler, tags.some((tag) => { var _a; return (_a = tag.attributes) === null || _a === void 0 ? void 0 : _a.some((a) => a.name === 'strictEvents'); }), str), + uses$$props, + uses$$restProps, + uses$$slots, + componentDocumentation, + resolvedStores, + usesAccessors, + isRunes + }; +} + +/** + * A component class name suffix is necessary to prevent class name clashes + * like reported in https://github.com/sveltejs/language-tools/issues/294 + */ +const COMPONENT_SUFFIX = '__SvelteComponent_'; +function addComponentExport(params) { + if (params.generics.has()) { + addGenericsComponentExport(params); + } + else { + addSimpleComponentExport(params); + } +} +function addGenericsComponentExport({ events, canHaveAnyProp, exportedNames, componentDocumentation, fileName, mode, usesAccessors, str, generics, usesSlots, isSvelte5, noSvelteComponentTyped }) { + const genericsDef = generics.toDefinitionString(); + const genericsRef = generics.toReferencesString(); + const doc = componentDocumentation.getFormatted(); + const className = fileName && classNameFromFilename(fileName, mode !== 'dts'); + function returnType(forPart) { + return `ReturnType<__sveltets_Render${genericsRef}['${forPart}']>`; + } + let statement = ` +class __sveltets_Render${genericsDef} { + props() { + return ${props(true, canHaveAnyProp, exportedNames, `render${genericsRef}()`)}.props; + } + events() { + return ${_events(events.hasStrictEvents() || exportedNames.usesRunes(), `render${genericsRef}()`)}.events; + } + slots() { + return render${genericsRef}().slots; + } +${isSvelte5 + ? ` bindings() { return ${exportedNames.createBindingsStr()}; } + exports() { return ${exportedNames.hasExports() ? `render${genericsRef}().exports` : '{}'}; } +}` + : '}'} +`; + const svelteComponentClass = noSvelteComponentTyped + ? 'SvelteComponent' + : 'SvelteComponentTyped'; + const [PropsName] = addTypeExport(str, className, 'Props'); + const [EventsName] = addTypeExport(str, className, 'Events'); + const [SlotsName] = addTypeExport(str, className, 'Slots'); + if (isSvelte5) { + // Don't add props/events/slots type exports in dts mode for now, maybe someone asks for it to be back, + // but it's safer to not do it for now to have more flexibility in the future. + let eventsSlotsType = []; + if (events.hasEvents() || !exportedNames.usesRunes()) { + eventsSlotsType.push(`$$events?: ${returnType('events')}`); + } + if (usesSlots) { + eventsSlotsType.push(`$$slots?: ${returnType('slots')}`); + eventsSlotsType.push(`children?: any`); + } + const propsType = !canHaveAnyProp && exportedNames.hasNoProps() + ? `{${eventsSlotsType.join(', ')}}` + : `${returnType('props')} & {${eventsSlotsType.join(', ')}}`; + const bindingsType = `ReturnType<__sveltets_Render${generics.toReferencesAnyString()}['bindings']>`; + // Sadly, due to a combination of requirements and TypeScript limitations, we need to always create both a legacy class component and function component type. + // - Constraints: Need to support Svelte 4 class component types, therefore we need to use __sveltets_2_ensureComponent to transform function components to classes + // - Limitations: TypeScript is not able to preserve generics during said transformation (i.e. there's no way to express keeping the generic etc) + // TODO Svelte 6/7: Switch this around and not use new Component in svelte2tsx anymore, which means we can remove the legacy class component. We need something like _ensureFnComponent then. + statement += + `\ninterface $$IsomorphicComponent {\n` + + ` new ${genericsDef}(options: import('svelte').ComponentConstructorOptions<${returnType('props') + (usesSlots ? '& {children?: any}' : '')}>): import('svelte').SvelteComponent<${returnType('props')}, ${returnType('events')}, ${returnType('slots')}> & { $$bindings?: ${returnType('bindings')} } & ${returnType('exports')};\n` + + ` ${genericsDef}(internal: unknown, props: ${propsType}): ${returnType('exports')};\n` + + ` z_$$bindings?: ${bindingsType};\n` + + `}\n` + + `${doc}const ${className || '$$Component'}: $$IsomorphicComponent = null as any;\n` + + surroundWithIgnoreComments(`type ${className || '$$Component'}${genericsDef} = InstanceType;\n`) + + `export default ${className || '$$Component'};`; + } + else if (mode === 'dts') { + statement += + `export type ${PropsName}${genericsDef} = ${returnType('props')};\n` + + `export type ${EventsName}${genericsDef} = ${returnType('events')};\n` + + `export type ${SlotsName}${genericsDef} = ${returnType('slots')};\n` + + `\n${doc}export default class${className ? ` ${className}` : ''}${genericsDef} extends ${svelteComponentClass}<${PropsName}${genericsRef}, ${EventsName}${genericsRef}, ${SlotsName}${genericsRef}> {` + + exportedNames.createClassGetters(genericsRef) + + (usesAccessors ? exportedNames.createClassAccessors() : '') + + '\n}'; + } + else { + statement += + `\n\nimport { ${svelteComponentClass} as __SvelteComponentTyped__ } from "svelte" \n` + + `${doc}export default class${className ? ` ${className}` : ''}${genericsDef} extends __SvelteComponentTyped__<${returnType('props')}, ${returnType('events')}, ${returnType('slots')}> {` + + exportedNames.createClassGetters(genericsRef) + + (usesAccessors ? exportedNames.createClassAccessors() : '') + + '\n}'; + } + str.append(statement); +} +function addSimpleComponentExport({ events, isTsFile, canHaveAnyProp, exportedNames, componentDocumentation, fileName, mode, usesAccessors, str, usesSlots, noSvelteComponentTyped, isSvelte5 }) { + const propDef = props(isTsFile, canHaveAnyProp, exportedNames, _events(events.hasStrictEvents(), 'render()')); + const doc = componentDocumentation.getFormatted(); + const className = fileName && classNameFromFilename(fileName, mode !== 'dts'); + const componentName = className || '$$Component'; + let statement; + if (mode === 'dts') { + if (isSvelte5 && exportedNames.usesRunes() && !usesSlots && !events.hasEvents()) { + statement = + `\n${doc}const ${componentName} = __sveltets_2_fn_component(render());\n` + + `type ${componentName} = ReturnType;\n` + + `export default ${componentName};`; + } + else if (isSvelte5) { + // Inline definitions from Svelte shims; else dts files will reference the globals which will be unresolved + statement = + `\ninterface $$__sveltets_2_IsomorphicComponent = any, Events extends Record = any, Slots extends Record = any, Exports = {}, Bindings = string> { + new (options: import('svelte').ComponentConstructorOptions): import('svelte').SvelteComponent & { $$bindings?: Bindings } & Exports; + (internal: unknown, props: ${!canHaveAnyProp && exportedNames.hasNoProps() ? '{$$events?: Events, $$slots?: Slots}' : 'Props & {$$events?: Events, $$slots?: Slots}'}): Exports & { $set?: any, $on?: any }; + z_$$bindings?: Bindings; +}\n` + + (usesSlots + ? `type $$__sveltets_2_PropsWithChildren = Props & + (Slots extends { default: any } + ? Props extends Record + ? any + : { children?: any } + : {}); + declare function $$__sveltets_2_isomorphic_component_slots< + Props extends Record, Events extends Record, Slots extends Record, Exports extends Record, Bindings extends string + >(klass: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }): $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren, Events, Slots, Exports, Bindings>;\n` + : ` +declare function $$__sveltets_2_isomorphic_component< + Props extends Record, Events extends Record, Slots extends Record, Exports extends Record, Bindings extends string +>(klass: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }): $$__sveltets_2_IsomorphicComponent;\n`) + + `${doc}const ${componentName} = $$__sveltets_2_isomorphic_component${usesSlots ? '_slots' : ''}(${propDef});\n` + + surroundWithIgnoreComments(`type ${componentName} = InstanceType;\n`) + + `export default ${componentName};`; + } + else if (isTsFile) { + const svelteComponentClass = noSvelteComponentTyped + ? 'SvelteComponent' + : 'SvelteComponentTyped'; + const [PropsName, PropsExport] = addTypeExport(str, className, 'Props'); + const [EventsName, EventsExport] = addTypeExport(str, className, 'Events'); + const [SlotsName, SlotsExport] = addTypeExport(str, className, 'Slots'); + statement = + `\nconst __propDef = ${propDef};\n` + + PropsExport + + EventsExport + + SlotsExport + + `\n${doc}export default class${className ? ` ${className}` : ''} extends ${svelteComponentClass}<${PropsName}, ${EventsName}, ${SlotsName}> {` + + exportedNames.createClassGetters() + + (usesAccessors ? exportedNames.createClassAccessors() : '') + + '\n}'; + } + else { + statement = + `\nconst __propDef = ${propDef};\n` + + `/** @typedef {typeof __propDef.props} ${className}Props */\n` + + `/** @typedef {typeof __propDef.events} ${className}Events */\n` + + `/** @typedef {typeof __propDef.slots} ${className}Slots */\n` + + `\n${doc}export default class${className ? ` ${className}` : ''} extends __sveltets_2_createSvelte2TsxComponent(${propDef}) {` + + exportedNames.createClassGetters() + + (usesAccessors ? exportedNames.createClassAccessors() : '') + + '\n}'; + } + } + else { + if (isSvelte5) { + if (exportedNames.usesRunes() && !usesSlots && !events.hasEvents()) { + statement = + `\n${doc}const ${componentName} = __sveltets_2_fn_component(render());\n` + + `type ${componentName} = ReturnType;\n` + + `export default ${componentName};`; + } + else { + statement = + `\n${doc}const ${componentName} = __sveltets_2_isomorphic_component${usesSlots ? '_slots' : ''}(${propDef});\n` + + surroundWithIgnoreComments(`type ${componentName} = InstanceType;\n`) + + `export default ${componentName};`; + } + } + else { + statement = + `\n\n${doc}export default class${className ? ` ${className}` : ''} extends __sveltets_2_createSvelte2TsxComponent(${propDef}) {` + + exportedNames.createClassGetters() + + (usesAccessors ? exportedNames.createClassAccessors() : '') + + '\n}'; + } + } + str.append(statement); +} +function addTypeExport(str, className, type) { + const exportName = className + type; + if (!new RegExp(`\\W${exportName}\\W`).test(str.original)) { + return [ + exportName, + `export type ${exportName} = typeof __propDef.${type.toLowerCase()};\n` + ]; + } + let replacement = exportName + '_'; + while (str.original.includes(replacement)) { + replacement += '_'; + } + if ( + // Check if there's already an export with the same name + !new RegExp(`export ((const|let|var|class|interface|type) ${exportName}\\W|{[^}]*?${exportName}(}|\\W.*?}))`).test(str.original)) { + return [ + replacement, + `type ${replacement} = typeof __propDef.${type.toLowerCase()};\nexport { ${replacement} as ${exportName} };\n` + ]; + } + else { + return [ + replacement, + // we assume that the author explicitly named the type the same and don't export the generated type (which has an unstable name) + `type ${replacement} = typeof __propDef.${type.toLowerCase()};\n` + ]; + } +} +function _events(strictEvents, renderStr) { + return strictEvents ? renderStr : `__sveltets_2_with_any_event(${renderStr})`; +} +function props(isTsFile, canHaveAnyProp, exportedNames, renderStr) { + if (exportedNames.usesRunes()) { + return renderStr; + } + else if (isTsFile) { + return canHaveAnyProp ? `__sveltets_2_with_any(${renderStr})` : renderStr; + } + else { + const optionalProps = exportedNames.createOptionalPropsArray(); + const partial = `__sveltets_2_partial${canHaveAnyProp ? '_with_any' : ''}`; + return optionalProps.length > 0 + ? `${partial}([${optionalProps.join(',')}], ${renderStr})` + : `${partial}(${renderStr})`; + } +} +/** + * Returns a Svelte-compatible component name from a filename. Svelte + * components must use capitalized tags, so we try to transform the filename. + * + * https://svelte.dev/docs#Tags + */ +function classNameFromFilename(filename, appendSuffix) { + var _a; + try { + const withoutExtensions = (_a = path.parse(filename).name) === null || _a === void 0 ? void 0 : _a.split('.')[0]; + const withoutInvalidCharacters = withoutExtensions + .split('') + // Although "-" is invalid, we leave it in, pascal-case-handling will throw it out later + .filter((char) => /[A-Za-z$_\d-]/.test(char)) + .join(''); + const firstValidCharIdx = withoutInvalidCharacters + .split('') + // Although _ and $ are valid first characters for classes, they are invalid first characters + // for tag names. For a better import autocompletion experience, we therefore throw them out. + .findIndex((char) => /[A-Za-z]/.test(char)); + const withoutLeadingInvalidCharacters = withoutInvalidCharacters.substr(firstValidCharIdx); + const inPascalCase = pascalCase.pascalCase(withoutLeadingInvalidCharacters); + const finalName = firstValidCharIdx === -1 ? `A${inPascalCase}` : inPascalCase; + return `${finalName}${appendSuffix ? COMPONENT_SUFFIX : ''}`; + } + catch (error) { + console.warn(`Failed to create a name for the component class from filename ${filename}`); + return undefined; + } +} + +function createRenderFunction({ str, scriptTag, scriptDestination, slots, events, exportedNames, uses$$props, uses$$restProps, uses$$slots, uses$$SlotsInterface, generics, mode }) { + const htmlx = str.original; + let propsDecl = ''; + if (uses$$props) { + propsDecl += ' let $$props = __sveltets_2_allPropsType();'; + } + if (uses$$restProps) { + propsDecl += ' let $$restProps = __sveltets_2_restPropsType();'; + } + if (uses$$slots) { + propsDecl += + ' let $$slots = __sveltets_2_slotsType({' + + Array.from(slots.keys()) + .map((name) => `'${name}': ''`) + .join(', ') + + '});'; + } + const slotsDeclaration = slots.size > 0 && mode !== 'dts' + ? '\n' + + surroundWithIgnoreComments(';const __sveltets_createSlot = __sveltets_2_createCreateSlot' + + (uses$$SlotsInterface ? '<$$Slots>' : '') + + '();') + : ''; + if (scriptTag) { + //I couldn't get magicstring to let me put the script before the <> we prepend during conversion of the template to jsx, so we just close it instead + const scriptTagEnd = htmlx.lastIndexOf('>', scriptTag.content.start) + 1; + str.overwrite(scriptTag.start, scriptTag.start + 1, ';'); + if (generics.genericsAttr) { + let start = generics.genericsAttr.value[0].start; + let end = generics.genericsAttr.value[0].end; + if (htmlx.charAt(start) === '"' || htmlx.charAt(start) === "'") { + start++; + end--; + } + str.overwrite(scriptTag.start + 1, start - 1, `function render`); + str.overwrite(start - 1, start, `<`); // if the generics are unused, only this char is colored opaque + str.overwrite(end, scriptTagEnd, `>() {${propsDecl}\n`); + } + else { + str.overwrite(scriptTag.start + 1, scriptTagEnd, `function render${generics.toDefinitionString(true)}() {${propsDecl}\n`); + } + const scriptEndTagStart = htmlx.lastIndexOf('<', scriptTag.end - 1); + // wrap template with callback + str.overwrite(scriptEndTagStart, scriptTag.end, `${slotsDeclaration};\nasync () => {`, { + contentOnly: true + }); + } + else { + str.prependRight(scriptDestination, `;function render() {` + `${propsDecl}${slotsDeclaration}\nasync () => {`); + } + const slotsAsDef = uses$$SlotsInterface + ? '{} as unknown as $$Slots' + : '{' + + Array.from(slots.entries()) + .map(([name, attrs]) => { + return `'${name}': {${slotAttributesToString(attrs)}}`; + }) + .join(', ') + + '}'; + const returnString = `\nreturn { props: ${exportedNames.createPropsStr(uses$$props || uses$$restProps)}` + + exportedNames.createExportsStr() + + `, slots: ${slotsAsDef}` + + `, events: ${events.toDefString()} }}`; + // wrap template with callback + str.append('};'); + str.append(returnString); +} +function slotAttributesToString(attrs) { + return Array.from(attrs.entries()) + .map(([exportName, expr]) => exportName.startsWith('__spread__') ? `...${expr}` : `${exportName}:${expr}`) + .join(', '); +} + +/** + * Returns the path to the global svelte2tsx files that should be included in the project. + * Creates a hidden folder in the user's node_modules if `hiddenFolderPath` is provided. + */ +function get_global_types(tsSystem, isSvelte3, sveltePath, typesPath, hiddenFolderPath) { + let svelteHtmlPath = isSvelte3 ? undefined : path.join(sveltePath, 'svelte-html.d.ts'); + svelteHtmlPath = + svelteHtmlPath && tsSystem.fileExists(svelteHtmlPath) ? svelteHtmlPath : undefined; + let svelteTsxFiles; + if (isSvelte3) { + svelteTsxFiles = ['./svelte-shims.d.ts', './svelte-jsx.d.ts', './svelte-native-jsx.d.ts']; + } + else { + svelteTsxFiles = ['./svelte-shims-v4.d.ts', './svelte-native-jsx.d.ts']; + if (!svelteHtmlPath) { + svelteTsxFiles.push('./svelte-jsx-v4.d.ts'); + } + } + svelteTsxFiles = svelteTsxFiles.map((f) => tsSystem.resolvePath(path.resolve(typesPath, f))); + if (hiddenFolderPath) { + try { + // IDE context - the `import('svelte')` statements inside the d.ts files will load the Svelte version of + // the extension, which can cause all sorts of problems. Therefore put the files into a hidden folder in + // the user's node_modules, preferably next to the Svelte package. + let path$1 = path.dirname(sveltePath); + if (!tsSystem.directoryExists(path.resolve(path$1, 'node_modules'))) { + path$1 = hiddenFolderPath; + while (path$1 && !tsSystem.directoryExists(path.resolve(path$1, 'node_modules'))) { + const parent = path.dirname(path$1); + if (path$1 === parent) { + path$1 = ''; + break; + } + path$1 = parent; + } + } + if (path$1) { + const hiddenPath = path.resolve(path$1, 'node_modules/.svelte2tsx-language-server-files'); + const newFiles = []; + for (const f of svelteTsxFiles) { + const hiddenFile = path.resolve(hiddenPath, path.basename(f)); + const existing = tsSystem.readFile(hiddenFile); + const toWrite = tsSystem.readFile(f); + if (!toWrite) { + throw new Error(`Could not read file: ${f}`); + } + if (existing !== toWrite) { + tsSystem.writeFile(hiddenFile, toWrite); + // TS doesn't throw an error if the file wasn't written + if (!tsSystem.fileExists(hiddenFile)) { + throw new Error(`Could not write file: ${hiddenFile}`); + } + } + newFiles.push(hiddenFile); + } + svelteTsxFiles = newFiles; + } + } + catch (e) { } + } + if (svelteHtmlPath) { + svelteTsxFiles.push(tsSystem.resolvePath(path.resolve(typesPath, svelteHtmlPath))); + } + return svelteTsxFiles; +} + +/** + * Finds the top level const/let/function exports of a source file. + */ +function findExports(ts, source, isTsFile) { + var _a, _b, _c, _d; + const exports = new Map(); + // TODO handle indirect exports? + for (const statement of source.statements) { + if (ts.isFunctionDeclaration(statement) && + statement.name && + ((_b = (_a = ts.getModifiers(statement)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.kind) === ts.SyntaxKind.ExportKeyword) { + // export function x ... + exports.set(statement.name.text, { + type: 'function', + node: statement, + hasTypeDefinition: hasTypedParameter(ts, statement, isTsFile) + }); + } + if (ts.isVariableStatement(statement) && + statement.declarationList.declarations.length === 1 && + ((_d = (_c = ts.getModifiers(statement)) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.kind) === ts.SyntaxKind.ExportKeyword) { + // export const x = ... + const declaration = statement.declarationList.declarations[0]; + const hasTypeDefinition = !!declaration.type || + (!isTsFile && !!ts.getJSDocType(declaration)) || + (!!declaration.initializer && ts.isSatisfiesExpression(declaration.initializer)); + if (declaration.initializer && + (ts.isFunctionExpression(declaration.initializer) || + ts.isArrowFunction(declaration.initializer) || + (ts.isSatisfiesExpression(declaration.initializer) && + ts.isParenthesizedExpression(declaration.initializer.expression) && + (ts.isFunctionExpression(declaration.initializer.expression.expression) || + ts.isArrowFunction(declaration.initializer.expression.expression))) || + (ts.isParenthesizedExpression(declaration.initializer) && + (ts.isFunctionExpression(declaration.initializer.expression) || + ts.isArrowFunction(declaration.initializer.expression))))) { + const node = ts.isSatisfiesExpression(declaration.initializer) + ? declaration.initializer.expression + .expression + : ts.isParenthesizedExpression(declaration.initializer) + ? declaration.initializer.expression + : declaration.initializer; + exports.set(declaration.name.getText(), { + type: 'function', + node, + hasTypeDefinition: hasTypeDefinition || hasTypedParameter(ts, node, isTsFile) + }); + } + else if (ts.isIdentifier(declaration.name)) { + // TODO support `export const { x, y } = ...` ? + exports.set(declaration.name.getText(), { + type: 'var', + node: declaration, + hasTypeDefinition + }); + } + } + } + return exports; +} +function hasTypedParameter(ts, node, isTsFile) { + var _a; + return (!!((_a = node.parameters[0]) === null || _a === void 0 ? void 0 : _a.type) || + (!isTsFile && + (!!ts.getJSDocType(node) || + (node.parameters[0] && !!ts.getJSDocParameterTags(node.parameters[0]).length)))); +} + +const kitPageFiles = new Set(['+page', '+layout', '+page.server', '+layout.server', '+server']); +/** + * Determines whether or not a given file is a SvelteKit-specific file (route file, hooks file, or params file) + */ +function isKitFile(fileName, options) { + const basename = path.basename(fileName); + return (isKitRouteFile(basename) || + isHooksFile(fileName, basename, options.serverHooksPath) || + isHooksFile(fileName, basename, options.clientHooksPath) || + isHooksFile(fileName, basename, options.universalHooksPath) || + isParamsFile(fileName, basename, options.paramsPath)); +} +/** + * Determines whether or not a given file is a SvelteKit-specific route file + */ +function isKitRouteFile(basename) { + if (basename.includes('@')) { + // +page@foo -> +page + basename = basename.split('@')[0]; + } + else { + basename = basename.slice(0, -path.extname(basename).length); + } + return kitPageFiles.has(basename); +} +/** + * Determines whether or not a given file is a SvelteKit-specific hooks file + */ +function isHooksFile(fileName, basename, hooksPath) { + return (((basename === 'index.ts' || basename === 'index.js') && + fileName.slice(0, -basename.length - 1).endsWith(hooksPath)) || + fileName.slice(0, -path.extname(basename).length).endsWith(hooksPath)); +} +/** + * Determines whether or not a given file is a SvelteKit-specific params file + */ +function isParamsFile(fileName, basename, paramsPath) { + return (fileName.slice(0, -basename.length - 1).endsWith(paramsPath) && + !basename.includes('.test') && + !basename.includes('.spec')); +} +function upsertKitFile(ts, fileName, kitFilesSettings, getSource, surround = (text) => text) { + var _a, _b, _c, _d; + let basename = path.basename(fileName); + const result = (_d = (_c = (_b = (_a = upsertKitRouteFile(ts, basename, getSource, surround)) !== null && _a !== void 0 ? _a : upsertKitServerHooksFile(ts, fileName, basename, kitFilesSettings.serverHooksPath, getSource, surround)) !== null && _b !== void 0 ? _b : upsertKitClientHooksFile(ts, fileName, basename, kitFilesSettings.clientHooksPath, getSource, surround)) !== null && _c !== void 0 ? _c : upsertKitUniversalHooksFile(ts, fileName, basename, kitFilesSettings.universalHooksPath, getSource, surround)) !== null && _d !== void 0 ? _d : upsertKitParamsFile(ts, fileName, basename, kitFilesSettings.paramsPath, getSource, surround); + if (!result) { + return; + } + // construct generated text from internal text and addedCode array + const { originalText, addedCode } = result; + let pos = 0; + let text = ''; + for (const added of addedCode) { + text += originalText.slice(pos, added.originalPos) + added.inserted; + pos = added.originalPos; + } + text += originalText.slice(pos); + return { text, addedCode }; +} +function upsertKitRouteFile(ts, basename, getSource, surround) { + if (!isKitRouteFile(basename)) + return; + const source = getSource(); + if (!source) + return; + const addedCode = []; + const insert = (pos, inserted) => { + insertCode(addedCode, pos, inserted); + }; + const isTsFile = basename.endsWith('.ts'); + const exports = findExports(ts, source, isTsFile); + // add type to load function if not explicitly typed + const load = exports.get('load'); + if ((load === null || load === void 0 ? void 0 : load.type) === 'function' && load.node.parameters.length === 1 && !load.hasTypeDefinition) { + const pos = load.node.parameters[0].getEnd(); + const inserted = surround(`: import('./$types.js').${basename.includes('layout') ? 'Layout' : 'Page'}${basename.includes('server') ? 'Server' : ''}LoadEvent`); + insert(pos, inserted); + } + else if ((load === null || load === void 0 ? void 0 : load.type) === 'var' && !load.hasTypeDefinition) { + // "const load = ..." will be transformed into + // "const load = (...) satisfies PageLoad" + insert(load.node.initializer.getStart(), surround('(')); + insert(load.node.initializer.getEnd(), surround(`) satisfies import('./$types.js').${basename.includes('layout') ? 'Layout' : 'Page'}${basename.includes('server') ? 'Server' : ''}Load`)); + } + // add type to entries function if not explicitly typed + const entries = exports.get('entries'); + if ((entries === null || entries === void 0 ? void 0 : entries.type) === 'function' && + entries.node.parameters.length === 0 && + !entries.hasTypeDefinition && + !basename.includes('layout')) { + if (!entries.node.type && entries.node.body) { + const returnPos = ts.isArrowFunction(entries.node) + ? entries.node.equalsGreaterThanToken.getStart() + : entries.node.body.getStart(); + const returnInsertion = surround(`: ReturnType `); + insert(returnPos, returnInsertion); + } + } + // add type to actions variable if not explicitly typed + const actions = exports.get('actions'); + if ((actions === null || actions === void 0 ? void 0 : actions.type) === 'var' && !actions.hasTypeDefinition && actions.node.initializer) { + const pos = actions.node.initializer.getEnd(); + const inserted = surround(` satisfies import('./$types.js').Actions`); + insert(pos, inserted); + } + addTypeToVariable(exports, surround, insert, 'prerender', `boolean | 'auto'`); + addTypeToVariable(exports, surround, insert, 'trailingSlash', `'never' | 'always' | 'ignore'`); + addTypeToVariable(exports, surround, insert, 'ssr', `boolean`); + addTypeToVariable(exports, surround, insert, 'csr', `boolean`); + // add types to GET/PUT/POST/PATCH/DELETE/OPTIONS/HEAD if not explicitly typed + const insertApiMethod = (name) => { + addTypeToFunction(ts, exports, surround, insert, name, `import('./$types.js').RequestEvent`, `Response | Promise`); + }; + insertApiMethod('GET'); + insertApiMethod('PUT'); + insertApiMethod('POST'); + insertApiMethod('PATCH'); + insertApiMethod('DELETE'); + insertApiMethod('OPTIONS'); + insertApiMethod('HEAD'); + insertApiMethod('fallback'); + return { addedCode, originalText: source.getFullText() }; +} +function upsertKitParamsFile(ts, fileName, basename, paramsPath, getSource, surround) { + if (!isParamsFile(fileName, basename, paramsPath)) { + return; + } + const source = getSource(); + if (!source) + return; + const addedCode = []; + const insert = (pos, inserted) => { + insertCode(addedCode, pos, inserted); + }; + const isTsFile = basename.endsWith('.ts'); + const exports = findExports(ts, source, isTsFile); + addTypeToFunction(ts, exports, surround, insert, 'match', 'string', 'boolean'); + return { addedCode, originalText: source.getFullText() }; +} +function upsertKitClientHooksFile(ts, fileName, basename, clientHooksPath, getSource, surround) { + if (!isHooksFile(fileName, basename, clientHooksPath)) { + return; + } + const source = getSource(); + if (!source) + return; + const addedCode = []; + const insert = (pos, inserted) => { + insertCode(addedCode, pos, inserted); + }; + const isTsFile = basename.endsWith('.ts'); + const exports = findExports(ts, source, isTsFile); + addTypeToFunction(ts, exports, surround, insert, 'handleError', `import('@sveltejs/kit').HandleClientError`); + return { addedCode, originalText: source.getFullText() }; +} +function upsertKitServerHooksFile(ts, fileName, basename, serverHooksPath, getSource, surround) { + if (!isHooksFile(fileName, basename, serverHooksPath)) { + return; + } + const source = getSource(); + if (!source) + return; + const addedCode = []; + const insert = (pos, inserted) => { + insertCode(addedCode, pos, inserted); + }; + const isTsFile = basename.endsWith('.ts'); + const exports = findExports(ts, source, isTsFile); + const addType = (name, type) => { + addTypeToFunction(ts, exports, surround, insert, name, type); + }; + addType('handleError', `import('@sveltejs/kit').HandleServerError`); + addType('handle', `import('@sveltejs/kit').Handle`); + addType('handleFetch', `import('@sveltejs/kit').HandleFetch`); + return { addedCode, originalText: source.getFullText() }; +} +function upsertKitUniversalHooksFile(ts, fileName, basename, universalHooksPath, getSource, surround) { + if (!isHooksFile(fileName, basename, universalHooksPath)) { + return; + } + const source = getSource(); + if (!source) + return; + const addedCode = []; + const insert = (pos, inserted) => { + insertCode(addedCode, pos, inserted); + }; + const isTsFile = basename.endsWith('.ts'); + const exports = findExports(ts, source, isTsFile); + addTypeToFunction(ts, exports, surround, insert, 'reroute', `import('@sveltejs/kit').Reroute`); + return { addedCode, originalText: source.getFullText() }; +} +function addTypeToVariable(exports, surround, insert, name, type) { + const variable = exports.get(name); + if ((variable === null || variable === void 0 ? void 0 : variable.type) === 'var' && !variable.hasTypeDefinition && variable.node.initializer) { + const pos = variable.node.name.getEnd(); + const inserted = surround(` : ${type}`); + insert(pos, inserted); + } +} +function addTypeToFunction(ts, exports, surround, insert, name, type, returnType) { + const fn = exports.get(name); + if ((fn === null || fn === void 0 ? void 0 : fn.type) === 'function' && fn.node.parameters.length === 1 && !fn.hasTypeDefinition) { + const paramPos = fn.node.parameters[0].getEnd(); + const paramInsertion = surround(!returnType ? `: Parameters<${type}>[0]` : `: ${type}`); + insert(paramPos, paramInsertion); + if (!fn.node.type && fn.node.body) { + const returnPos = ts.isArrowFunction(fn.node) + ? fn.node.equalsGreaterThanToken.getStart() + : fn.node.body.getStart(); + const returnInsertion = surround(!returnType ? `: ReturnType<${type}> ` : `: ${returnType} `); + insert(returnPos, returnInsertion); + } + } +} +function insertCode(addedCode, pos, inserted) { + var _a, _b, _c, _d; + const insertionIdx = addedCode.findIndex((c) => c.originalPos > pos); + if (insertionIdx >= 0) { + for (let i = insertionIdx; i < addedCode.length; i++) { + addedCode[i].generatedPos += inserted.length; + addedCode[i].total += inserted.length; + } + const prevTotal = (_b = (_a = addedCode[insertionIdx - 1]) === null || _a === void 0 ? void 0 : _a.total) !== null && _b !== void 0 ? _b : 0; + addedCode.splice(insertionIdx, 0, { + generatedPos: pos + prevTotal, + originalPos: pos, + length: inserted.length, + inserted, + total: prevTotal + inserted.length + }); + } + else { + const prevTotal = (_d = (_c = addedCode[addedCode.length - 1]) === null || _c === void 0 ? void 0 : _c.total) !== null && _d !== void 0 ? _d : 0; + addedCode.push({ + generatedPos: pos + prevTotal, + originalPos: pos, + length: inserted.length, + inserted, + total: prevTotal + inserted.length + }); + } +} +function toVirtualPos(pos, addedCode) { + let total = 0; + for (const added of addedCode) { + if (pos < added.originalPos) + break; + total += added.length; + } + return pos + total; +} +function toOriginalPos(pos, addedCode) { + let total = 0; + let idx = 0; + for (; idx < addedCode.length; idx++) { + const added = addedCode[idx]; + if (pos < added.generatedPos) + break; + total += added.length; + } + if (idx > 0) { + const prev = addedCode[idx - 1]; + // If pos is in the middle of an added range, return the start of the addition + if (pos > prev.generatedPos && pos < prev.generatedPos + prev.length) { + return { pos: prev.originalPos, inGenerated: true }; + } + } + return { pos: pos - total, inGenerated: false }; +} + +/** + * ## Internal, do not use! This is subject to change at any time. + * + * Implementation notice: If one of the methods use a TypeScript function which is not from the + * static top level `ts` namespace, it must be passed as a parameter. + */ +const internalHelpers = { + isKitFile, + isKitRouteFile, + isHooksFile, + isParamsFile, + upsertKitFile, + toVirtualPos, + toOriginalPos, + findExports, + get_global_types +}; + +/** + * Prepends a string at the given index in a way that the source map maps the appended string + * to the given character, not the previous character (as MagicString's other methods would). + */ +function preprendStr(str, index, toAppend, removeExisting) { + const prepends = updatePrepends(str, index, toAppend, removeExisting); + toAppend = prepends.join(''); + str.overwrite(index, index + 1, toAppend + str.original.charAt(index), { contentOnly: true }); + return str; +} +/** + * Overwrites a string at the given range but also keeps the other preprends from `prependStr` + * if not explicitly told otherwise. + */ +function overwriteStr(str, start, end, toOverwrite, removeExisting) { + const prepends = updatePrepends(str, start, toOverwrite, removeExisting); + toOverwrite = prepends.join(''); + str.overwrite(start, end, toOverwrite, { contentOnly: true }); + return str; +} +function updatePrepends(str, index, toAppend, removeExisting) { + str.__prepends__ = str.__prepends__ || new Map(); + const prepends = removeExisting ? [] : str.__prepends__.get(index) || []; + prepends.push(toAppend); + str.__prepends__.set(index, prepends); + return prepends; +} +/** + * Returns the prepends that were added at the given index (if any). + */ +function getCurrentPrepends(str, index) { + var _a; + return ((_a = str.__prepends__) === null || _a === void 0 ? void 0 : _a.get(index)) || []; +} + +/** + * Collects all imports and module-level declarations to then find out which interfaces/types are hoistable. + */ +class HoistableInterfaces { + constructor() { + this.import_value_set = new Set(); + this.import_type_set = new Set(); + this.interface_map = new Map(); + this.props_interface = { + name: '', + node: null, + type_deps: new Set(), + value_deps: new Set() + }; + } + analyzeModuleScriptNode(node) { + // Handle Import Declarations + if (ts.isImportDeclaration(node) && node.importClause) { + const is_type_only = node.importClause.isTypeOnly; + if (node.importClause.namedBindings && + ts.isNamedImports(node.importClause.namedBindings)) { + node.importClause.namedBindings.elements.forEach((element) => { + const import_name = element.name.text; + if (is_type_only || element.isTypeOnly) { + this.import_type_set.add(import_name); + } + else { + this.import_value_set.add(import_name); + } + }); + } + // Handle default imports + if (node.importClause.name) { + const default_import = node.importClause.name.text; + if (is_type_only) { + this.import_type_set.add(default_import); + } + else { + this.import_value_set.add(default_import); + } + } + // Handle namespace imports + if (node.importClause.namedBindings && + ts.isNamespaceImport(node.importClause.namedBindings)) { + const namespace_import = node.importClause.namedBindings.name.text; + if (is_type_only) { + this.import_type_set.add(namespace_import); + } + else { + this.import_value_set.add(namespace_import); + } + } + } + // Handle top-level declarations + if (ts.isVariableStatement(node)) { + node.declarationList.declarations.forEach((declaration) => { + if (ts.isIdentifier(declaration.name)) { + this.import_value_set.add(declaration.name.text); + } + }); + } + if (ts.isFunctionDeclaration(node) && node.name) { + this.import_value_set.add(node.name.text); + } + if (ts.isClassDeclaration(node) && node.name) { + this.import_value_set.add(node.name.text); + } + if (ts.isEnumDeclaration(node)) { + this.import_value_set.add(node.name.text); + } + if (ts.isTypeAliasDeclaration(node)) { + this.import_type_set.add(node.name.text); + } + if (ts.isInterfaceDeclaration(node)) { + this.import_type_set.add(node.name.text); + } + } + analyzeInstanceScriptNode(node) { + var _a, _b, _c, _d; + // Handle Import Declarations + if (ts.isImportDeclaration(node) && node.importClause) { + const is_type_only = node.importClause.isTypeOnly; + if (node.importClause.namedBindings && + ts.isNamedImports(node.importClause.namedBindings)) { + node.importClause.namedBindings.elements.forEach((element) => { + const import_name = element.name.text; + if (is_type_only) { + this.import_type_set.add(import_name); + } + else { + this.import_value_set.add(import_name); + } + }); + } + // Handle default imports + if (node.importClause.name) { + const default_import = node.importClause.name.text; + if (is_type_only) { + this.import_type_set.add(default_import); + } + else { + this.import_value_set.add(default_import); + } + } + // Handle namespace imports + if (node.importClause.namedBindings && + ts.isNamespaceImport(node.importClause.namedBindings)) { + const namespace_import = node.importClause.namedBindings.name.text; + if (is_type_only) { + this.import_type_set.add(namespace_import); + } + else { + this.import_value_set.add(namespace_import); + } + } + } + // Handle Interface Declarations + if (ts.isInterfaceDeclaration(node)) { + const interface_name = node.name.text; + const type_dependencies = new Set(); + const value_dependencies = new Set(); + const generics = (_b = (_a = node.typeParameters) === null || _a === void 0 ? void 0 : _a.map((param) => param.name.text)) !== null && _b !== void 0 ? _b : []; + node.members.forEach((member) => { + if (ts.isPropertySignature(member) && member.type) { + this.collectTypeDependencies(member.type, type_dependencies, value_dependencies, generics); + } + else if (ts.isIndexSignatureDeclaration(member)) { + this.collectTypeDependencies(member.type, type_dependencies, value_dependencies, generics); + member.parameters.forEach((param) => { + this.collectTypeDependencies(param.type, type_dependencies, value_dependencies, generics); + }); + } + }); + if (this.import_type_set.has(interface_name)) { + // shadowed; delete because we can't hoist + this.import_type_set.delete(interface_name); + } + else { + this.interface_map.set(interface_name, { + type_deps: type_dependencies, + value_deps: value_dependencies, + node + }); + } + } + // Handle Type Alias Declarations + if (ts.isTypeAliasDeclaration(node)) { + const alias_name = node.name.text; + const type_dependencies = new Set(); + const value_dependencies = new Set(); + const generics = (_d = (_c = node.typeParameters) === null || _c === void 0 ? void 0 : _c.map((param) => param.name.text)) !== null && _d !== void 0 ? _d : []; + this.collectTypeDependencies(node.type, type_dependencies, value_dependencies, generics); + if (this.import_type_set.has(alias_name)) { + // shadowed; delete because we can't hoist + this.import_type_set.delete(alias_name); + } + else { + this.interface_map.set(alias_name, { + type_deps: type_dependencies, + value_deps: value_dependencies, + node + }); + } + } + // Handle top-level declarations: They could shadow module declarations; delete them from the set of allowed import values + if (ts.isVariableStatement(node)) { + node.declarationList.declarations.forEach((declaration) => { + if (ts.isIdentifier(declaration.name)) { + this.import_value_set.delete(declaration.name.text); + } + }); + } + if (ts.isFunctionDeclaration(node) && node.name) { + this.import_value_set.delete(node.name.text); + } + if (ts.isClassDeclaration(node) && node.name) { + this.import_value_set.delete(node.name.text); + } + if (ts.isEnumDeclaration(node)) { + this.import_value_set.delete(node.name.text); + } + if (ts.isTypeAliasDeclaration(node)) { + this.import_type_set.delete(node.name.text); + } + if (ts.isInterfaceDeclaration(node)) { + this.import_type_set.delete(node.name.text); + } + } + analyze$propsRune(node) { + var _a, _b; + if (((_a = node.initializer.typeArguments) === null || _a === void 0 ? void 0 : _a.length) > 0 || node.type) { + const generic_arg = ((_b = node.initializer.typeArguments) === null || _b === void 0 ? void 0 : _b[0]) || node.type; + if (ts.isTypeReferenceNode(generic_arg)) { + const name = this.getEntityNameText(generic_arg.typeName); + const interface_node = this.interface_map.get(name); + if (interface_node) { + this.props_interface.name = name; + this.props_interface.type_deps = interface_node.type_deps; + this.props_interface.value_deps = interface_node.value_deps; + } + } + else { + this.props_interface.name = '$$ComponentProps'; + this.props_interface.node = generic_arg; + this.collectTypeDependencies(generic_arg, this.props_interface.type_deps, this.props_interface.value_deps, []); + } + } + } + /** + * Traverses the AST to collect import statements and top-level interfaces, + * then determines which interfaces can be hoisted. + * @param source_file The TypeScript source file to analyze. + * @returns An object containing sets of value imports, type imports, and hoistable interfaces. + */ + determineHoistableInterfaces() { + const hoistable_interfaces = new Map(); + let progress = true; + while (progress) { + progress = false; + for (const [interface_name, deps] of this.interface_map.entries()) { + if (hoistable_interfaces.has(interface_name)) { + continue; + } + const can_hoist = [...deps.type_deps, ...deps.value_deps].every((dep) => { + return (this.import_type_set.has(dep) || + this.import_value_set.has(dep) || + hoistable_interfaces.has(dep)); + }); + if (can_hoist) { + hoistable_interfaces.set(interface_name, deps.node); + progress = true; + } + } + } + if (this.props_interface.name === '$$ComponentProps') { + const can_hoist = [ + ...this.props_interface.type_deps, + ...this.props_interface.value_deps + ].every((dep) => { + return (this.import_type_set.has(dep) || + this.import_value_set.has(dep) || + hoistable_interfaces.has(dep)); + }); + if (can_hoist) { + hoistable_interfaces.set(this.props_interface.name, this.props_interface.node); + } + } + return hoistable_interfaces; + } + /** + * Moves all interfaces that can be hoisted to the top of the script, if the $props rune's type is hoistable. + */ + moveHoistableInterfaces(str, astOffset, scriptStart, generics) { + if (!this.props_interface.name) + return; + for (const generic of generics) { + this.import_type_set.delete(generic); + } + const hoistable = this.determineHoistableInterfaces(); + if (hoistable.has(this.props_interface.name)) { + for (const [name, node] of hoistable) { + let pos = node.pos + astOffset; + if (name === '$$ComponentProps') { + // So that organize imports doesn't mess with the types + str.prependRight(pos, '\n'); + } + else { + // node.pos includes preceeding whitespace, which could mean we accidentally also move stuff appended to a previous node + if (str.original[pos] === '\r') { + pos++; + } + if (/\s/.test(str.original[pos])) { + pos++; + } + // jsdoc comments would be ignored if they are on the same line as the ;, so we add a newline, too. + // Also helps with organize imports not messing with the types + str.prependRight(pos, ';\n'); + str.appendLeft(node.end + astOffset, ';'); + } + str.move(pos, node.end + astOffset, scriptStart); + } + return hoistable; + } + } + getAllowedValues() { + return this.import_value_set; + } + /** + * Collects type and value dependencies from a given TypeNode. + * @param type_node The TypeNode to analyze. + * @param type_dependencies The set to collect type dependencies into. + * @param value_dependencies The set to collect value dependencies into. + */ + collectTypeDependencies(type_node, type_dependencies, value_dependencies, generics) { + const walk = (node) => { + if (ts.isTypeReferenceNode(node)) { + const type_name = this.getEntityNameText(node.typeName); + if (!generics.includes(type_name)) { + type_dependencies.add(type_name); + } + } + else if (ts.isTypeQueryNode(node)) { + // Handle 'typeof' expressions: e.g., foo: typeof bar + value_dependencies.add(this.getEntityNameText(node.exprName)); + } + ts.forEachChild(node, walk); + }; + walk(type_node); + } + /** + * Retrieves the full text of an EntityName (handles nested names). + * @param entity_name The EntityName to extract text from. + * @returns The full name as a string. + */ + getEntityNameText(entity_name) { + if (ts.isIdentifier(entity_name)) { + return entity_name.text; + } + else { + return this.getEntityNameText(entity_name.left) + '.' + entity_name.right.text; + } + } +} + +function is$$PropsDeclaration(node) { + return isInterfaceOrTypeDeclaration(node) && node.name.text === '$$Props'; +} +class ExportedNames { + constructor(str, astOffset, basename, isTsFile, isSvelte5Plus, isRunes) { + this.str = str; + this.astOffset = astOffset; + this.basename = basename; + this.isTsFile = isTsFile; + this.isSvelte5Plus = isSvelte5Plus; + this.isRunes = isRunes; + this.hoistableInterfaces = new HoistableInterfaces(); + this.usesAccessors = false; + /** + * Uses the `$$Props` type + */ + this.uses$$Props = false; + /** + * Component contains globals that have a rune name + */ + this.hasRunesGlobals = false; + /** + * The `$props()` rune's type info as a string, if it exists. + * If using TS, this returns the generic string, if using JS, returns the `@type {..}` string. + */ + this.$props = { + /** The JSDoc type; not set when TS type exists */ + comment: '', + /** The TS type */ + type: '', + bindings: [] + }; + /** Map of all props and exports. Exposing it publicly is no longer necessary for runes mode */ + this.exports = new Map(); + this.possibleExports = new Map(); + this.doneDeclarationTransformation = new Set(); + this.getters = new Set(); + } + handleVariableStatement(node, parent) { + const exportModifier = findExportKeyword(node); + if (exportModifier) { + const isLet = node.declarationList.flags === ts.NodeFlags.Let; + const isConst = node.declarationList.flags === ts.NodeFlags.Const; + this.handleExportedVariableDeclarationList(node.declarationList, (_, ...args) => this.addExportForBindingPattern(...args)); + if (isLet) { + this.propTypeAssertToUserDefined(node.declarationList); + } + else if (isConst) { + node.declarationList.forEachChild((n) => { + if (ts.isVariableDeclaration(n) && ts.isIdentifier(n.name)) { + this.addGetter(n.name); + const type = n.type || ts.getJSDocType(n); + const isKitExport = internalHelpers.isKitRouteFile(this.basename) && + n.name.getText() === 'snapshot'; + // TS types are not allowed in JS files, but TS will still pick it up and the ignore comment will filter out the error + const kitType = isKitExport && !type ? `: import('./$types.js').Snapshot` : ''; + const nameEnd = n.name.end + this.astOffset; + if (kitType) { + preprendStr(this.str, nameEnd, surroundWithIgnoreComments(kitType)); + } + } + }); + } + this.removeExport(exportModifier.getStart(), exportModifier.end); + } + else if (ts.isSourceFile(parent)) { + this.handleExportedVariableDeclarationList(node.declarationList, this.addPossibleExport.bind(this)); + for (const declaration of node.declarationList.declarations) { + if (declaration.initializer !== undefined && + ts.isCallExpression(declaration.initializer) && + declaration.initializer.expression.getText() === '$props') { + // @ts-expect-error TS is too stupid to narrow this properly + this.handle$propsRune(declaration); + break; + } + } + } + } + handleExportFunctionOrClass(node) { + const exportModifier = findExportKeyword(node); + if (!exportModifier) { + return; + } + this.removeExport(exportModifier.getStart(), exportModifier.end); + this.addGetter(node.name); + // Can't export default here + if (node.name) { + this.addExport(node.name, false); + } + } + handleExportDeclaration(node) { + const { exportClause } = node; + if (ts.isNamedExports(exportClause)) { + for (const ne of exportClause.elements) { + if (ne.propertyName) { + this.addExport(ne.propertyName, false, ne.name, undefined, undefined, true); + } + else { + this.addExport(ne.name, false, undefined, undefined, undefined, true); + } + } + //we can remove entire statement + this.removeExport(node.getStart(), node.end); + } + } + handle$propsRune(node) { + var _a, _b; + // Check if the $props() rune uses $bindable() + if (ts.isObjectBindingPattern(node.name)) { + for (const element of node.name.elements) { + if (ts.isIdentifier(element.name) && + (!element.propertyName || ts.isIdentifier(element.propertyName)) && + !element.dotDotDotToken) { + const name = element.propertyName + ? element.propertyName.text + : element.name.text; + if (element.initializer) { + let call = element.initializer; + // if it's an as expression we need to check wether the as + // expression expression is a call + if (ts.isAsExpression(call)) { + call = call.expression; + } + if (ts.isCallExpression(call) && ts.isIdentifier(call.expression)) { + if (call.expression.text === '$bindable') { + this.$props.bindings.push(name); + } + } + } + } + } + } + // Easy mode: User uses TypeScript and typed the $props() rune + if (((_a = node.initializer.typeArguments) === null || _a === void 0 ? void 0 : _a.length) > 0 || node.type) { + this.hoistableInterfaces.analyze$propsRune(node); + const generic_arg = ((_b = node.initializer.typeArguments) === null || _b === void 0 ? void 0 : _b[0]) || node.type; + const generic = generic_arg.getText(); + if (ts.isTypeReferenceNode(generic_arg)) { + this.$props.type = generic; + } + else { + // Create a virtual type alias for the unnamed generic and reuse it for the props return type + // so that rename, find references etc works seamlessly across components + this.$props.type = '$$ComponentProps'; + preprendStr(this.str, generic_arg.pos + this.astOffset, `;type ${this.$props.type} = `); + this.str.appendLeft(generic_arg.end + this.astOffset, ';'); + this.str.move(generic_arg.pos + this.astOffset, generic_arg.end + this.astOffset, node.parent.pos + this.astOffset); + this.str.appendRight(generic_arg.end + this.astOffset, + // so that semantic tokens ignore it, preventing an overlap of tokens + surroundWithIgnoreComments(this.$props.type)); + } + return; + } + // Hard mode: User uses JSDoc or didn't type the $props() rune + if (!this.isTsFile) { + const text = node.getSourceFile().getFullText(); + let start = -1; + let comment; + // reverse because we want to look at the last comment before the node first + for (const c of [...(ts.getLeadingCommentRanges(text, node.pos) || [])].reverse()) { + const potential_match = text.substring(c.pos, c.end); + if (/@type\b/.test(potential_match)) { + comment = potential_match; + start = c.pos + this.astOffset; + break; + } + } + if (!comment) { + for (const c of [ + ...(ts.getLeadingCommentRanges(text, node.parent.pos) || []).reverse() + ]) { + const potential_match = text.substring(c.pos, c.end); + if (/@type\b/.test(potential_match)) { + comment = potential_match; + start = c.pos + this.astOffset; + break; + } + } + } + if (comment && /\/\*\*[^@]*?@type\s*{\s*{.*}\s*}\s*\*\//.test(comment)) { + // Create a virtual type alias for the unnamed generic and reuse it for the props return type + // so that rename, find references etc works seamlessly across components + this.$props.comment = '/** @type {$$ComponentProps} */'; + const type_start = this.str.original.indexOf('@type', start); + this.str.overwrite(type_start, type_start + 5, '@typedef'); + const end = this.str.original.indexOf('*/', start); + this.str.overwrite(end, end + 2, ' $$ComponentProps */' + this.$props.comment); + } + else { + // Complex comment or simple `@type {AType}` comment which we just use as-is. + // For the former this means things like rename won't work properly across components. + this.$props.comment = comment || ''; + } + } + if (this.$props.comment) { + // User uses JsDoc + return; + } + // Do a best-effort to extract the props from the object literal + let propsStr = ''; + let withUnknown = false; + let props = []; + const isKitRouteFile = internalHelpers.isKitRouteFile(this.basename); + const isKitLayoutFile = isKitRouteFile && this.basename.includes('layout'); + if (ts.isObjectBindingPattern(node.name)) { + for (const element of node.name.elements) { + if (!ts.isIdentifier(element.name) || + (element.propertyName && !ts.isIdentifier(element.propertyName)) || + !!element.dotDotDotToken) { + withUnknown = true; + } + else { + const name = element.propertyName + ? element.propertyName.text + : element.name.text; + if (isKitRouteFile) { + if (name === 'data') { + props.push(`data: import('./$types.js').${isKitLayoutFile ? 'LayoutData' : 'PageData'}`); + } + if (name === 'form' && !isKitLayoutFile) { + props.push(`form: import('./$types.js').ActionData`); + } + } + else if (element.initializer) { + const initializer = ts.isCallExpression(element.initializer) && + ts.isIdentifier(element.initializer.expression) && + element.initializer.expression.text === '$bindable' + ? element.initializer.arguments[0] + : element.initializer; + const type = !initializer + ? 'any' + : ts.isAsExpression(initializer) + ? initializer.type.getText() + : ts.isStringLiteral(initializer) + ? 'string' + : ts.isNumericLiteral(initializer) + ? 'number' + : initializer.kind === ts.SyntaxKind.TrueKeyword || + initializer.kind === ts.SyntaxKind.FalseKeyword + ? 'boolean' + : ts.isIdentifier(initializer) && + initializer.text !== 'undefined' + ? `typeof ${initializer.text}` + : ts.isArrowFunction(initializer) + ? 'Function' + : ts.isObjectLiteralExpression(initializer) + ? 'Record' + : ts.isArrayLiteralExpression(initializer) + ? 'any[]' + : 'any'; + props.push(`${name}?: ${type}`); + } + else { + props.push(`${name}: any`); + } + } + } + if (isKitLayoutFile) { + props.push(`children: import('svelte').Snippet`); + } + if (props.length > 0) { + propsStr = + `{ ${props.join(', ')} }` + (withUnknown ? ' & Record' : ''); + } + else if (withUnknown) { + propsStr = 'Record'; + } + else { + propsStr = 'Record'; + } + } + else { + propsStr = 'Record'; + } + // Create a virtual type alias for the unnamed generic and reuse it for the props return type + // so that rename, find references etc works seamlessly across components + if (this.isTsFile) { + this.$props.type = '$$ComponentProps'; + if (props.length > 0 || withUnknown) { + preprendStr(this.str, node.parent.pos + this.astOffset, surroundWithIgnoreComments(`;type $$ComponentProps = ${propsStr};`)); + preprendStr(this.str, node.name.end + this.astOffset, `: ${this.$props.type}`); + } + } + else { + this.$props.comment = '/** @type {$$ComponentProps} */'; + if (props.length > 0 || withUnknown) { + preprendStr(this.str, node.pos + this.astOffset, `/** @typedef {${propsStr}} $$ComponentProps */${this.$props.comment}`); + } + } + } + removeExport(start, end) { + const exportStart = this.str.original.indexOf('export', start + this.astOffset); + const exportEnd = exportStart + (end - start); + this.str.remove(exportStart, exportEnd); + } + /** + * Appends `prop = __sveltets_2_any(prop)` to given declaration in order to + * trick TS into widening the type. Else for example `let foo: string | undefined = undefined` + * is narrowed to `undefined` by TS. + */ + propTypeAssertToUserDefined(node) { + if (this.doneDeclarationTransformation.has(node)) { + return; + } + const handleTypeAssertion = (declaration) => { + const identifier = declaration.name; + const tsType = declaration.type; + const jsDocType = ts.getJSDocType(declaration); + const type = tsType || jsDocType; + const name = identifier.getText(); + const isKitExport = internalHelpers.isKitRouteFile(this.basename) && + (name === 'data' || name === 'form' || name === 'snapshot'); + // TS types are not allowed in JS files, but TS will still pick it up and the ignore comment will filter out the error + const kitType = isKitExport && !type + ? `: import('./$types.js').${name === 'data' + ? this.basename.includes('layout') + ? 'LayoutData' + : 'PageData' + : name === 'form' + ? 'ActionData' + : 'Snapshot'}` + : ''; + const nameEnd = identifier.end + this.astOffset; + const end = declaration.end + this.astOffset; + if (ts.isIdentifier(identifier) && + // Ensure initialization for proper control flow and to avoid "possibly undefined" type errors. + // Also ensure prop is typed as any with a type annotation in TS strict mode + (!declaration.initializer || + // Widen the type, else it's narrowed to the initializer + type || + // Edge case: TS infers `export let bla = false` to type `false`. + // prevent that by adding the any-wrap in this case, too. + (!type && + [ts.SyntaxKind.FalseKeyword, ts.SyntaxKind.TrueKeyword].includes(declaration.initializer.kind)))) { + const name = identifier.getText(); + if (nameEnd === end) { + preprendStr(this.str, end, surroundWithIgnoreComments(`${kitType};${name} = __sveltets_2_any(${name});`)); + } + else { + if (kitType) { + preprendStr(this.str, nameEnd, surroundWithIgnoreComments(kitType)); + } + preprendStr(this.str, end, surroundWithIgnoreComments(`;${name} = __sveltets_2_any(${name});`)); + } + } + else if (kitType) { + preprendStr(this.str, nameEnd, surroundWithIgnoreComments(kitType)); + } + }; + const findComma = (target) => target.getChildren().filter((child) => child.kind === ts.SyntaxKind.CommaToken); + const splitDeclaration = () => { + const commas = node + .getChildren() + .filter((child) => child.kind === ts.SyntaxKind.SyntaxList) + .map(findComma) + .reduce((current, previous) => [...current, ...previous], []); + commas.forEach((comma) => { + const start = comma.getStart() + this.astOffset; + const end = comma.getEnd() + this.astOffset; + overwriteStr(this.str, start, end, ';let '); + }); + }; + for (const declaration of node.declarations) { + handleTypeAssertion(declaration); + } + // need to be append after the type assert treatment + splitDeclaration(); + this.doneDeclarationTransformation.add(node); + } + handleExportedVariableDeclarationList(list, add) { + const isLet = list.flags === ts.NodeFlags.Let; + ts.forEachChild(list, (node) => { + if (ts.isVariableDeclaration(node)) { + if (ts.isIdentifier(node.name)) { + add(list, node.name, isLet, node.name, node.type, !node.initializer); + } + else if (ts.isObjectBindingPattern(node.name) || + ts.isArrayBindingPattern(node.name)) { + ts.forEachChild(node.name, (element) => { + if (ts.isBindingElement(element)) { + add(list, element.name, isLet); + } + }); + } + } + }); + } + addGetter(node) { + if (!node) { + return; + } + this.getters.add(node.text); + } + createClassGetters(generics = '') { + if (this.usesRunes()) { + // In runes mode, exports are no longer part of props + return Array.from(this.getters) + .map((name) => `\n get ${name}() { return render${generics}().exports.${name} }`) + .join(''); + } + else { + return Array.from(this.getters) + .map((name) => + // getters are const/classes/functions, which are always defined. + // We have to remove the `| undefined` from the type here because it was necessary to + // be added in a previous step so people are not expected to provide these as props. + `\n get ${name}() { return __sveltets_2_nonNullable(this.$$prop_def.${name}) }`) + .join(''); + } + } + createClassAccessors() { + const accessors = []; + for (const value of this.exports.values()) { + if (this.getters.has(value.identifierText)) { + continue; + } + accessors.push(value.identifierText); + } + return accessors + .map((name) => `\n get ${name}() { return this.$$prop_def.${name} }` + + `\n /**accessor*/\n set ${name}(_) {}`) + .join(''); + } + /** + * Marks a top level declaration as a possible export + * which could be exported through `export { .. }` later. + */ + addPossibleExport(declaration, name, isLet, target = null, type = null, required = false) { + if (!ts.isIdentifier(name)) { + return; + } + if (target && ts.isIdentifier(target)) { + this.possibleExports.set(name.text, { + declaration, + isLet, + type: type === null || type === void 0 ? void 0 : type.getText(), + identifierText: target.text, + required, + doc: this.getDoc(target) + }); + } + else { + this.possibleExports.set(name.text, { + declaration, + isLet + }); + } + } + /** + * Adds export to map + */ + addExport(name, isLet, target = null, type = null, required = false, isNamedExport = false) { + const existingDeclaration = this.possibleExports.get(name.text); + if (target) { + this.exports.set(name.text, { + isLet: isLet || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.isLet), + type: (type === null || type === void 0 ? void 0 : type.getText()) || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.type), + identifierText: target.text, + required: required || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.required), + doc: this.getDoc(target) || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.doc), + isNamedExport + }); + } + else { + this.exports.set(name.text, { + isLet: isLet || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.isLet), + type: existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.type, + required: existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.required, + doc: existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.doc, + isNamedExport + }); + } + if (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.isLet) { + this.propTypeAssertToUserDefined(existingDeclaration.declaration); + } + } + addExportForBindingPattern(name, isLet, target = null, type = null, required = false) { + if (ts.isIdentifier(name)) { + if (!target || ts.isIdentifier(target)) { + this.addExport(name, isLet, target, type, required); + } + return; + } + name.elements.forEach((child) => { + this.addExportForBindingPattern(child.name, isLet, undefined, type, required); + }); + } + getDoc(target) { + var _a, _b; + let doc = undefined; + // Traverse `a` one up. If the declaration is part of a declaration list, + // the comment is at this point already + const variableDeclaration = target === null || target === void 0 ? void 0 : target.parent; + // Traverse `a` up to `export let a` + const exportExpr = (_b = (_a = target === null || target === void 0 ? void 0 : target.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent; + if (variableDeclaration) { + doc = getLastLeadingDoc(variableDeclaration); + } + if (exportExpr && !doc) { + doc = getLastLeadingDoc(exportExpr); + } + return doc; + } + /** + * Creates a string from the collected props + * + * @param uses$$propsOr$$restProps whether the file references the $$props or $$restProps variable + */ + createPropsStr(uses$$propsOr$$restProps) { + const names = Array.from(this.exports.entries()); + if (this.usesRunes()) { + if (this.$props.type) { + return '{} as any as ' + this.$props.type; + } + if (this.$props.comment) { + return this.$props.comment + '({})'; + } + // Necessary, because {} roughly equals to any + return this.isTsFile + ? '{} as Record' + : '/** @type {Record} */ ({})'; + } + if (this.uses$$Props) { + const lets = names.filter(([, { isLet }]) => isLet); + const others = names.filter(([, { isLet }]) => !isLet); + // - The check if $$Props is assignable to exports is necessary to make sure no extraneous props + // are defined and that no props are required that should be optional + // - The check if exports are assignable to $$Props is not done because a component should be allowed + // to use less props than defined (it just ignores them) + // - __sveltets_2_ensureRightProps needs to be declared in a way that doesn't affect the type result of props + return ('{ ...__sveltets_2_ensureRightProps<{' + + this.createReturnElementsType(lets).join(',') + + '}>(__sveltets_2_any("") as $$Props)} as ' + + // We add other exports of classes and functions here because + // they need to appear in the props object in order to properly + // type bind:xx but they are not needed to be part of $$Props + (others.length + ? '{' + this.createReturnElementsType(others).join(',') + '} & ' + : '') + + '$$Props'); + } + if (names.length === 0 && !uses$$propsOr$$restProps) { + // Necessary, because {} roughly equals to any + return this.isTsFile + ? '{} as Record' + : '/** @type {Record} */ ({})'; + } + const dontAddTypeDef = !this.isTsFile || names.every(([_, value]) => !value.type && value.required); + const returnElements = this.createReturnElements(names, dontAddTypeDef); + if (dontAddTypeDef) { + // Only `typeof` exports -> omit the `as {...}` completely. + // If not TS, omit the types to not have a "cannot use types in jsx" error. + return `{${returnElements.join(' , ')}}`; + } + const returnElementsType = this.createReturnElementsType(names); + return `{${returnElements.join(' , ')}} as {${returnElementsType.join(', ')}}`; + } + hasNoProps() { + if (this.usesRunes()) { + return !this.$props.type && !this.$props.comment; + } + const names = Array.from(this.exports.entries()); + return names.length === 0; + } + createBindingsStr() { + if (this.usesRunes()) { + // will be just the empty strings for zero bindings, which is impossible to create a binding for, so it works out fine + return `__sveltets_$$bindings('${this.$props.bindings.join("', '")}')`; + } + else { + return '""'; + } + } + /** + * In runes mode, exports are no longer part of props because you cannot `bind:` to them, + * which is why we need a separate return type for them. In Svelte 5, the isomorphic component + * needs them separate, too. + */ + createExportsStr() { + const names = Array.from(this.exports.entries()); + const others = names.filter(([, { isLet, isNamedExport }]) => !isLet || (this.usesRunes() && isNamedExport)); + const needsAccessors = this.usesAccessors && names.length > 0 && !this.usesRunes(); // runes mode doesn't support accessors + if (this.isSvelte5Plus) { + let str = ''; + if (others.length > 0 || this.usesRunes() || needsAccessors) { + if (others.length > 0 || needsAccessors) { + if (this.isTsFile) { + str += + ', exports: {} as any as { ' + + this.createReturnElementsType(needsAccessors ? names : others, undefined, true).join(',') + + ' }'; + } + else { + str += `, exports: /** @type {{${this.createReturnElementsType(needsAccessors ? names : others, false, true)}}} */ ({})`; + } + } + else { + // Always add that, in TS5.5+ the type for Exports is infered to never when this is not present, which breaks types. + // Don't cast to `Record` because that will break the union type we use elsewhere + str += ', exports: {}'; + } + str += `, bindings: ${this.createBindingsStr()}`; + } + else { + // always add that, in TS5.5+ the type for Exports is infered to never when this is not present, which breaks types + str += `, exports: {}, bindings: ${this.createBindingsStr()}`; + } + return str; + } + return ''; + } + createReturnElements(names, dontAddTypeDef) { + return names.map(([key, value]) => { + // Important to not use shorthand props for rename functionality + return `${dontAddTypeDef && value.doc ? `\n${value.doc}` : ''}${value.identifierText || key}: ${key}`; + }); + } + createReturnElementsType(names, addDoc = true, forceRequired = false) { + return names.map(([key, value]) => { + const identifier = `${value.doc && addDoc ? `\n${value.doc}` : ''}${value.identifierText || key}${value.required || forceRequired ? '' : '?'}`; + if (!value.type) { + return `${identifier}: typeof ${key}`; + } + return `${identifier}: ${value.type}`; + }); + } + createOptionalPropsArray() { + if (this.usesRunes()) { + return []; + } + else { + return Array.from(this.exports.entries()) + .filter(([_, entry]) => !entry.required) + .map(([name, entry]) => `'${entry.identifierText || name}'`); + } + } + getExportsMap() { + return this.exports; + } + hasExports() { + const names = Array.from(this.exports.entries()); + return this.usesAccessors ? names.length > 0 : names.some(([, { isLet }]) => !isLet); + } + hasPropsRune() { + return this.isSvelte5Plus && !!(this.$props.type || this.$props.comment); + } + checkGlobalsForRunes(globals) { + const runes = ['$state', '$derived', '$effect']; // no need to check for props, already handled through other means in here + this.hasRunesGlobals = + this.isSvelte5Plus && globals.some((global) => runes.includes(global)); + } + usesRunes() { + return this.hasRunesGlobals || this.hasPropsRune() || this.isRunes; + } +} + +/** + * Throw an error with start/end pos like the Svelte compiler does + */ +function throwError(start, end, message, code) { + const error = new Error(message); + error.start = positionAt(start, code); + error.end = positionAt(end, code); + throw error; +} +/** + * Get the line (1-offset) and character (0-offset) based on the offset + * @param offset The index of the position + * @param text The text for which the position should be retrived + */ +function positionAt(offset, text) { + offset = clamp(offset, 0, text.length); + const lineOffsets = getLineOffsets(text); + let low = 0; + let high = lineOffsets.length; + if (high === 0) { + return { line: 1, column: offset }; + } + while (low < high) { + const mid = Math.floor((low + high) / 2); + if (lineOffsets[mid] > offset) { + high = mid; + } + else { + low = mid + 1; + } + } + // low is the least x for which the line offset is larger than the current offset + // or array.length if no line offset is larger than the current offset + return { line: low, column: offset - lineOffsets[low - 1] }; +} +function clamp(num, min, max) { + return Math.max(min, Math.min(max, num)); +} +function getLineOffsets(text) { + const lineOffsets = []; + let isLineStart = true; + for (let i = 0; i < text.length; i++) { + if (isLineStart) { + lineOffsets.push(i); + isLineStart = false; + } + const ch = text.charAt(i); + isLineStart = ch === '\r' || ch === '\n'; + if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') { + i++; + } + } + if (isLineStart && text.length > 0) { + lineOffsets.push(text.length); + } + return lineOffsets; +} + +class Generics { + constructor(str, astOffset, script) { + var _a, _b, _c, _d; + this.str = str; + this.astOffset = astOffset; + /** The whole `T extends boolean` */ + this.definitions = []; + this.typeReferences = []; + /** The `T` in `T extends boolean` */ + this.references = []; + this.genericsAttr = script.attributes.find((attr) => attr.name === 'generics'); + const generics = (_b = (_a = this.genericsAttr) === null || _a === void 0 ? void 0 : _a.value[0]) === null || _b === void 0 ? void 0 : _b.raw; + if (generics) { + const typeParameters = this.getGenericTypeParameters(generics); + this.definitions = (_c = typeParameters === null || typeParameters === void 0 ? void 0 : typeParameters.map((param) => param.getText())) !== null && _c !== void 0 ? _c : []; + this.references = (_d = typeParameters === null || typeParameters === void 0 ? void 0 : typeParameters.map((param) => param.name.getText())) !== null && _d !== void 0 ? _d : []; + } + else { + this.genericsAttr = undefined; + } + } + getGenericTypeParameters(rawGenericsAttr) { + const sourceFile = ts.createSourceFile('index.ts', `<${rawGenericsAttr}>() => {}`, ts.ScriptTarget.Latest, true); + const firstStatement = sourceFile.statements[0]; + if (!firstStatement || !ts.isExpressionStatement(firstStatement)) { + return; + } + const arrowFunction = firstStatement.expression; + if (!ts.isArrowFunction(arrowFunction)) { + return; + } + return arrowFunction.typeParameters; + } + addIfIsGeneric(node) { + var _a, _b; + if (ts.isTypeAliasDeclaration(node) && this.is$$GenericType(node.type)) { + if (this.genericsAttr) { + throw new Error('Invalid $$Generic declaration: $$Generic definitions are not allowed when the generics attribute is present on the script tag'); + } + if (((_a = node.type.typeArguments) === null || _a === void 0 ? void 0 : _a.length) > 1) { + throw new Error('Invalid $$Generic declaration: Only one type argument allowed'); + } + if (((_b = node.type.typeArguments) === null || _b === void 0 ? void 0 : _b.length) === 1) { + const typeReference = node.type.typeArguments[0].getText(); + this.typeReferences.push(typeReference); + this.definitions.push(`${node.name.text} extends ${typeReference}`); + } + else { + this.definitions.push(node.name.text); + } + this.references.push(node.name.text); + this.str.remove(this.astOffset + node.getStart(), this.astOffset + node.getEnd()); + } + } + throwIfIsGeneric(node) { + if (ts.isTypeAliasDeclaration(node) && this.is$$GenericType(node.type)) { + throwError(this.astOffset + node.getStart(), this.astOffset + node.getEnd(), '$$Generic declarations are only allowed in the instance script', this.str.original); + } + } + is$$GenericType(node) { + return (ts.isTypeReferenceNode(node) && + ts.isIdentifier(node.typeName) && + node.typeName.text === '$$Generic'); + } + getTypeReferences() { + return this.typeReferences; + } + getReferences() { + return this.references; + } + toDefinitionString(addIgnore = false) { + const surround = addIgnore ? surroundWithIgnoreComments : (str) => str; + return this.definitions.length ? surround(`<${this.definitions.join(',')}>`) : ''; + } + toReferencesString() { + return this.references.length ? `<${this.references.join(',')}>` : ''; + } + toReferencesAnyString() { + return this.references.length ? `<${this.references.map(() => 'any').join(',')}>` : ''; + } + has() { + return this.definitions.length > 0; + } +} + +/** + * Tracks all store-usages as well as all variable declarations and imports in the component. + * + * In the modification-step at the end, all variable declarations and imports which + * were used as stores are appended with `let $xx = __sveltets_2_store_get(xx)` to create the store variables. + */ +class ImplicitStoreValues { + constructor(storesResolvedInTemplate = [], renderFunctionStart, storeFromImportsWrapper = (input) => input) { + this.renderFunctionStart = renderFunctionStart; + this.storeFromImportsWrapper = storeFromImportsWrapper; + this.accessedStores = new Set(); + this.variableDeclarations = []; + this.reactiveDeclarations = []; + this.importStatements = []; + this.addStoreAcess = this.accessedStores.add.bind(this.accessedStores); + this.addVariableDeclaration = this.variableDeclarations.push.bind(this.variableDeclarations); + this.addReactiveDeclaration = this.reactiveDeclarations.push.bind(this.reactiveDeclarations); + this.addImportStatement = this.importStatements.push.bind(this.importStatements); + storesResolvedInTemplate.forEach(this.addStoreAcess); + } + /** + * All variable declartaions and imports which + * were used as stores are appended with `let $xx = __sveltets_2_store_get(xx)` to create the store variables. + */ + modifyCode(astOffset, str) { + this.variableDeclarations.forEach((node) => this.attachStoreValueDeclarationToDecl(node, astOffset, str)); + this.reactiveDeclarations.forEach((node) => this.attachStoreValueDeclarationToReactiveAssignment(node, astOffset, str)); + this.attachStoreValueDeclarationOfImportsToRenderFn(str); + } + getAccessedStores() { + return [...this.accessedStores.keys()]; + } + getGlobals() { + const globals = new Set(this.accessedStores); + this.variableDeclarations.forEach((node) => extractIdentifiers(node.name).forEach((id) => globals.delete(id.text))); + this.reactiveDeclarations.forEach((node) => getNamesFromLabeledStatement(node).forEach((name) => globals.delete(name))); + this.importStatements.forEach(({ name }) => name && globals.delete(name.getText())); + return [...globals].map((name) => `$${name}`); + } + attachStoreValueDeclarationToDecl(node, astOffset, str) { + const storeNames = extractIdentifiers(node.name) + .map((id) => id.text) + .filter((name) => this.accessedStores.has(name)); + if (!storeNames.length) { + return; + } + const storeDeclarations = surroundWithIgnoreComments(this.createStoreDeclarations(storeNames)); + const nodeEnd = ts.isVariableDeclarationList(node.parent) && node.parent.declarations.length > 1 + ? node.parent.declarations[node.parent.declarations.length - 1].getEnd() + : node.getEnd(); + // Quick-fixing https://github.com/sveltejs/language-tools/issues/1950 + // TODO think about a SourceMap-wrapper that does these things for us, + // or investigate altering the inner workings of SourceMap, or investigate + // if we can always use prependStr here (and elsewhere, too) + if (getCurrentPrepends(str, nodeEnd + astOffset).length) { + preprendStr(str, nodeEnd + astOffset, storeDeclarations); + } + else { + str.appendRight(nodeEnd + astOffset, storeDeclarations); + } + } + attachStoreValueDeclarationToReactiveAssignment(node, astOffset, str) { + const storeNames = getNamesFromLabeledStatement(node).filter((name) => this.accessedStores.has(name)); + if (!storeNames.length) { + return; + } + const storeDeclarations = surroundWithIgnoreComments(this.createStoreDeclarations(storeNames)); + const endPos = node.getEnd() + astOffset; + // Quick-fixing https://github.com/sveltejs/language-tools/issues/1097 + // TODO think about a SourceMap-wrapper that does these things for us, + // or investigate altering the inner workings of SourceMap, or investigate + // if we can always use prependStr here (and elsewhere, too) + if (str.original.charAt(endPos - 1) !== ';') { + preprendStr(str, endPos, storeDeclarations); + } + else { + str.appendRight(endPos, storeDeclarations); + } + } + attachStoreValueDeclarationOfImportsToRenderFn(str) { + const storeNames = this.importStatements + .filter(({ name }) => name && this.accessedStores.has(name.getText())) + .map(({ name }) => name.getText()); + if (!storeNames.length) { + return; + } + const storeDeclarations = this.storeFromImportsWrapper(surroundWithIgnoreComments(this.createStoreDeclarations(storeNames))); + str.appendRight(this.renderFunctionStart, storeDeclarations); + } + createStoreDeclarations(storeNames) { + let declarations = ''; + for (let i = 0; i < storeNames.length; i++) { + declarations += this.createStoreDeclaration(storeNames[i]); + } + return declarations; + } + createStoreDeclaration(storeName) { + return `;let $${storeName} = __sveltets_2_store_get(${storeName});`; + } +} + +class ImplicitTopLevelNames { + constructor(str, astOffset) { + this.str = str; + this.astOffset = astOffset; + this.map = new Set(); + } + add(node) { + this.map.add(node); + } + handleReactiveStatement(node, binaryExpression) { + if (binaryExpression) { + this.wrapExpressionWithInvalidate(binaryExpression.right); + } + else { + const start = node.getStart() + this.astOffset; + const end = node.getEnd() + this.astOffset; + this.str.prependLeft(start, ';() => {'); + preprendStr(this.str, end, '}'); + } + } + wrapExpressionWithInvalidate(expression) { + if (!expression) { + return; + } + const start = expression.getStart() + this.astOffset; + const end = expression.getEnd() + this.astOffset; + // $: a = { .. }.. / $: a = .. as .. => () => ( .. ) + if (ts.isObjectLiteralExpression(expression) || + (expression.getText().startsWith('{') && + this.isNodeStartsWithObjectLiteral(expression)) || + ts.isAsExpression(expression)) { + this.str.appendLeft(start, '('); + this.str.appendRight(end, ')'); + } + this.str.prependLeft(start, '__sveltets_2_invalidate(() => '); + preprendStr(this.str, end, ')'); + // Not adding ';' at the end because right now this function is only invoked + // in situations where there is a line break of ; guaranteed to be present (else the code is invalid) + } + isNodeStartsWithObjectLiteral(node) { + if (ts.isObjectLiteralExpression(node)) { + return true; + } + if (ts.isElementAccessExpression(node)) { + return this.isNodeStartsWithObjectLiteral(node.expression); + } + if (ts.isBinaryExpression(node)) { + return this.isNodeStartsWithObjectLiteral(node.left); + } + if (ts.isConditionalExpression(node)) { + return this.isNodeStartsWithObjectLiteral(node.condition); + } + return node + .getChildren() + .filter((e) => e.pos === node.pos) + .some((child) => this.isNodeStartsWithObjectLiteral(child)); + } + modifyCode(rootVariables) { + for (const node of this.map.values()) { + const names = getNamesFromLabeledStatement(node); + if (names.length === 0) { + continue; + } + const implicitTopLevelNames = names.filter((name) => !rootVariables.has(name)); + const pos = node.label.getStart(); + if (this.hasOnlyImplicitTopLevelNames(names, implicitTopLevelNames)) { + // remove '$:' label + this.str.remove(pos + this.astOffset, pos + this.astOffset + 2); + this.str.prependRight(pos + this.astOffset, 'let '); + this.removeBracesFromParenthizedExpression(node); + } + else { + implicitTopLevelNames.forEach((name) => { + this.str.prependRight(pos + this.astOffset, `let ${name};\n`); + }); + } + } + } + hasOnlyImplicitTopLevelNames(names, implicitTopLevelNames) { + return names.length === implicitTopLevelNames.length; + } + removeBracesFromParenthizedExpression(node) { + // If expression is of type `$: ({a} = b);`, + // remove the surrounding braces so that the transformation + // to `let {a} = b;` produces valid code. + if (ts.isExpressionStatement(node.statement) && + isParenthesizedObjectOrArrayLiteralExpression(node.statement.expression)) { + const parenthesizedExpression = node.statement.expression; + const parenthesisStart = parenthesizedExpression.getStart() + this.astOffset; + const expressionStart = parenthesizedExpression.expression.getStart() + this.astOffset; + this.str.overwrite(parenthesisStart, expressionStart, '', { contentOnly: true }); + const parenthesisEnd = parenthesizedExpression.getEnd() + this.astOffset; + const expressionEnd = parenthesizedExpression.expression.getEnd() + this.astOffset; + // We need to keep the `)` of the "wrap with invalidate" expression above. + // We overwrite the same range so it's needed. + overwriteStr(this.str, expressionEnd, parenthesisEnd, ')', true); + } + } +} + +/** + * Transform type assertion to as expression: a => a as Type + */ +function handleTypeAssertion(str, assertion, astOffset) { + const { expression, type } = assertion; + const assertionStart = assertion.getStart() + astOffset; + const typeStart = type.getStart() + astOffset; + const typeEnd = type.getEnd() + astOffset; + const expressionStart = expression.getStart() + astOffset; + const expressionEnd = expression.getEnd() + astOffset; + str.appendLeft(expressionEnd, ' as '); + // move 'HTMLElement' to the end of expression + str.move(assertionStart, typeEnd, expressionEnd); + str.remove(assertionStart, typeStart); + // remove '>' + str.remove(typeEnd, expressionStart); +} + +/** + * move imports to top of script so they appear outside our render function + */ +function handleImportDeclaration(node, str, astOffset, scriptStart, sourceFile) { + return moveNode(node, str, astOffset, scriptStart, sourceFile); +} +/** + * ensure it's in a newline. + * if file has module script ensure an empty line to separate imports + */ +function handleFirstInstanceImport(tsAst, astOffset, hasModuleScript, str) { + var _a; + const imports = tsAst.statements.filter(ts.isImportDeclaration).sort((a, b) => a.end - b.end); + const firstImport = imports[0]; + if (!firstImport) { + return; + } + const firstComment = Array.from((_a = ts.getLeadingCommentRanges(firstImport.getFullText(), 0)) !== null && _a !== void 0 ? _a : []).sort((a, b) => a.pos - b.pos)[0]; + const start = firstComment && firstComment.kind === ts.SyntaxKind.MultiLineCommentTrivia + ? firstComment.pos + firstImport.getFullStart() + : firstImport.getStart(); + str.appendRight(start + astOffset, '\n' + (hasModuleScript ? '\n' : '')); + // Add a semi-colon to the last import if it doesn't have one, to prevent auto completion + // and imports from being added at the wrong position + const lastImport = imports[imports.length - 1]; + const end = lastImport.end + astOffset - 1; + if (str.original[end] !== ';') { + str.overwrite(end, lastImport.end + astOffset, str.original[end] + ';\n'); + } +} + +function flatten(arr) { + return arr.reduce((acc, val) => acc.concat(val), []); +} + +class InterfacesAndTypes { + constructor() { + this.node = null; + this.all = []; + this.references = new Map(); + } + add(node) { + this.all.push(node); + } + getNodesWithNames(names) { + return this.all.filter((node) => names.includes(node.name.text)); + } + // The following could be used to create a informative error message in case + // someone has an interface that both references a generic and is used by one: + addReference(reference) { + if (!this.node) { + return; + } + const references = this.references.get(this.node) || []; + references.push(reference); + this.references.set(this.node, references); + } + getNodesThatReferenceType(name) { + const nodes = []; + for (const [node, references] of this.references) { + if (references.some((r) => r.typeName.getText() === name)) { + nodes.push(node); + } + } + return nodes; + } + getNodesThatRecursivelyReferenceType(name) { + let types = [name]; + const nodes = new Set(); + while (types.length !== 0) { + const newTypes = flatten(types.map((type) => this.getNodesThatReferenceType(type))).filter((t) => !nodes.has(t)); + newTypes.forEach((t) => nodes.add(t)); + types = newTypes.map((t) => t.name.text); + } + return [...nodes.values()]; + } + getNodesThatRecursivelyReferenceTypes(names) { + return flatten(names.map((name) => this.getNodesThatRecursivelyReferenceType(name))); + } +} + +function processInstanceScriptContent(str, script, events, implicitStoreValues, mode, moduleAst, isTSFile, basename, isSvelte5Plus, isRunes) { + const htmlx = str.original; + const scriptContent = htmlx.substring(script.content.start, script.content.end); + const tsAst = ts.createSourceFile('component.ts.svelte', scriptContent, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + const astOffset = script.content.start; + const exportedNames = new ExportedNames(str, astOffset, basename, isTSFile, isSvelte5Plus, isRunes); + const generics = new Generics(str, astOffset, script); + const interfacesAndTypes = new InterfacesAndTypes(); + if (moduleAst) { + moduleAst.tsAst.forEachChild((n) => exportedNames.hoistableInterfaces.analyzeModuleScriptNode(n)); + } + const implicitTopLevelNames = new ImplicitTopLevelNames(str, astOffset); + let uses$$props = false; + let uses$$restProps = false; + let uses$$slots = false; + let uses$$SlotsInterface = false; + //track if we are in a declaration scope + let isDeclaration = false; + //track $store variables since we are only supposed to give top level scopes special treatment, and users can declare $blah variables at higher scopes + //which prevents us just changing all instances of Identity that start with $ + const pendingStoreResolutions = []; + let scope = new Scope$1(); + const rootScope = scope; + const pushScope = () => (scope = new Scope$1(scope)); + const popScope = () => (scope = scope.parent); + const resolveStore = (pending) => { + let { node, scope } = pending; + const name = node.text; + while (scope) { + if (scope.declared.has(name)) { + //we were manually declared, this isn't a store access. + return; + } + scope = scope.parent; + } + const storename = node.getText().slice(1); + implicitStoreValues.addStoreAcess(storename); + }; + const handleIdentifier = (ident, parent) => { + if (ident.text === '$$props') { + uses$$props = true; + return; + } + if (ident.text === '$$restProps') { + uses$$restProps = true; + return; + } + if (ident.text === '$$slots') { + uses$$slots = true; + return; + } + if (ts.isLabeledStatement(parent) && parent.label == ident) { + return; + } + if (isDeclaration || ts.isParameter(parent)) { + if (isNotPropertyNameOfImport(ident) && + (!ts.isBindingElement(ident.parent) || ident.parent.name == ident)) { + // we are a key, not a name, so don't care + if (ident.text.startsWith('$') || scope == rootScope) { + // track all top level declared identifiers and all $ prefixed identifiers + scope.declared.add(ident.text); + } + } + } + else { + const text = ident.text; + //track potential store usage to be resolved + if (text.startsWith('$')) { + if ((!ts.isPropertyAccessExpression(parent) || parent.expression == ident) && + (!ts.isPropertyAssignment(parent) || parent.initializer == ident) && + !ts.isPropertySignature(parent) && + !ts.isPropertyDeclaration(parent) && + !ts.isTypeReferenceNode(parent) && + !ts.isTypeAliasDeclaration(parent) && + !ts.isInterfaceDeclaration(parent)) { + // Handle the const { ...props } = $props() case + const is_rune = (text === '$props' || text === '$derived' || text === '$state') && + ts.isCallExpression(parent) && + ts.isVariableDeclaration(parent.parent) && + parent.parent.name.getText().includes(text.slice(1)); + if (!is_rune) { + pendingStoreResolutions.push({ node: ident, parent, scope }); + } + } + } + } + }; + const walk = (node, parent) => { + var _a, _b, _c; + const onLeaveCallbacks = []; + if (parent === tsAst) { + exportedNames.hoistableInterfaces.analyzeInstanceScriptNode(node); + } + generics.addIfIsGeneric(node); + if (is$$EventsDeclaration(node)) { + events.setComponentEventsInterface(node, astOffset); + } + if (is$$SlotsDeclaration(node)) { + uses$$SlotsInterface = true; + } + if (is$$PropsDeclaration(node)) { + exportedNames.uses$$Props = true; + } + if (ts.isVariableStatement(node)) { + exportedNames.handleVariableStatement(node, parent); + } + if (ts.isFunctionDeclaration(node)) { + exportedNames.handleExportFunctionOrClass(node); + } + if (ts.isClassDeclaration(node)) { + exportedNames.handleExportFunctionOrClass(node); + } + if (ts.isBlock(node) || ts.isFunctionLike(node)) { + pushScope(); + onLeaveCallbacks.push(() => popScope()); + } + if (ts.isExportDeclaration(node)) { + exportedNames.handleExportDeclaration(node); + } + if (ts.isImportDeclaration(node)) { + handleImportDeclaration(node, str, astOffset, script.start, tsAst); + // Check if import is the event dispatcher + events.checkIfImportIsEventDispatcher(node); + } + // workaround for import statement completion + if (ts.isImportEqualsDeclaration(node)) { + const end = node.getEnd() + astOffset; + if (str.original[end - 1] !== ';') { + preprendStr(str, end, ';'); + } + } + if (ts.isVariableDeclaration(node)) { + events.checkIfIsStringLiteralDeclaration(node); + events.checkIfDeclarationInstantiatedEventDispatcher(node); + // Only top level declarations can be stores + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent) === tsAst) { + implicitStoreValues.addVariableDeclaration(node); + } + } + if (ts.isCallExpression(node)) { + events.checkIfCallExpressionIsDispatch(node); + } + if (ts.isVariableDeclaration(parent) && parent.name == node) { + isDeclaration = true; + onLeaveCallbacks.push(() => (isDeclaration = false)); + } + if (ts.isBindingElement(parent) && parent.name == node) { + isDeclaration = true; + onLeaveCallbacks.push(() => (isDeclaration = false)); + } + if (ts.isImportClause(node)) { + isDeclaration = true; + onLeaveCallbacks.push(() => (isDeclaration = false)); + implicitStoreValues.addImportStatement(node); + } + if (ts.isImportSpecifier(node)) { + implicitStoreValues.addImportStatement(node); + } + if (ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node)) { + interfacesAndTypes.node = node; + interfacesAndTypes.add(node); + onLeaveCallbacks.push(() => (interfacesAndTypes.node = null)); + } + //handle stores etc + if (ts.isIdentifier(node)) { + handleIdentifier(node, parent); + } + //track implicit declarations in reactive blocks at the top level + if (ts.isLabeledStatement(node) && + parent == tsAst && //top level + node.label.text == '$' && + node.statement) { + const binaryExpression = getBinaryAssignmentExpr(node); + if (binaryExpression) { + implicitTopLevelNames.add(node); + implicitStoreValues.addReactiveDeclaration(node); + } + implicitTopLevelNames.handleReactiveStatement(node, binaryExpression); + } + // Defensively call function (checking for undefined) because it got added only recently (TS 4.0) + // and therefore might break people using older TS versions + // Don't transform in ts mode because value type assertions are valid in this case + if (mode !== 'ts' && ((_c = ts.isTypeAssertionExpression) === null || _c === void 0 ? void 0 : _c.call(ts, node))) { + handleTypeAssertion(str, node, astOffset); + } + //to save a bunch of condition checks on each node, we recurse into processChild which skips all the checks for top level items + ts.forEachChild(node, (n) => walk(n, node)); + //fire off the on leave callbacks + onLeaveCallbacks.map((c) => c()); + }; + //walk the ast and convert to tsx as we go + tsAst.forEachChild((n) => walk(n, tsAst)); + //resolve stores + pendingStoreResolutions.map(resolveStore); + // declare implicit reactive variables we found in the script + implicitTopLevelNames.modifyCode(rootScope.declared); + implicitStoreValues.modifyCode(astOffset, str); + handleFirstInstanceImport(tsAst, astOffset, !!moduleAst, str); + // move interfaces and types out of the render function if they are referenced + // by a $$Generic, otherwise it will be used before being defined after the transformation + const nodesToMove = interfacesAndTypes.getNodesWithNames(generics.getTypeReferences()); + for (const node of nodesToMove) { + moveNode(node, str, astOffset, script.start, tsAst); + } + const hoisted = exportedNames.hoistableInterfaces.moveHoistableInterfaces(str, astOffset, script.start + 1, // +1 because imports are also moved at that position, and we want to move interfaces after imports + generics.getReferences()); + if (mode === 'dts') { + // Transform interface declarations to type declarations because indirectly + // using interfaces inside the return type of a function is forbidden. + // This is not a problem for intellisense/type inference but it will + // break dts generation (file will not be generated). + if (hoisted) { + transformInterfacesToTypes(tsAst, str, astOffset, [...hoisted.values()].concat(nodesToMove)); + } + else { + transformInterfacesToTypes(tsAst, str, astOffset, nodesToMove); + } + } + return { + exportedNames, + events, + uses$$props, + uses$$restProps, + uses$$slots, + uses$$SlotsInterface, + generics + }; +} +function transformInterfacesToTypes(tsAst, str, astOffset, movedNodes) { + tsAst.statements + .filter(ts.isInterfaceDeclaration) + .filter((i) => !movedNodes.includes(i)) + .forEach((node) => { + var _a; + str.overwrite(node.getStart() + astOffset, node.getStart() + astOffset + 'interface'.length, 'type'); + if ((_a = node.heritageClauses) === null || _a === void 0 ? void 0 : _a.length) { + const extendsStart = node.heritageClauses[0].getStart() + astOffset; + str.overwrite(extendsStart, extendsStart + 'extends'.length, '='); + const extendsList = node.heritageClauses[0].types; + let prev = extendsList[0]; + extendsList.slice(1).forEach((heritageClause) => { + str.overwrite(prev.getEnd() + astOffset, heritageClause.getStart() + astOffset, ' & '); + prev = heritageClause; + }); + str.appendLeft(node.heritageClauses[0].getEnd() + astOffset, ' & '); + } + else { + str.prependLeft(str.original.indexOf('{', node.getStart() + astOffset), '='); + } + }); +} + +function createModuleAst(str, script) { + const htmlx = str.original; + const scriptContent = htmlx.substring(script.content.start, script.content.end); + const tsAst = ts.createSourceFile('component.module.ts.svelte', scriptContent, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + const astOffset = script.content.start; + return { htmlx, tsAst, astOffset }; +} +function processModuleScriptTag(str, script, implicitStoreValues, moduleAst) { + const { htmlx, tsAst, astOffset } = moduleAst; + const generics = new Generics(str, astOffset, script); + if (generics.genericsAttr) { + const start = htmlx.indexOf('generics', script.start); + throwError(start, start + 8, 'The generics attribute is only allowed on the instance script', str.original); + } + const walk = (node) => { + resolveImplicitStoreValue(node, implicitStoreValues, str, astOffset); + generics.throwIfIsGeneric(node); + throwIfIs$$EventsDeclaration(node, str, astOffset); + throwIfIs$$SlotsDeclaration(node, str, astOffset); + throwIfIs$$PropsDeclaration(node, str, astOffset); + ts.forEachChild(node, (n) => walk(n)); + }; + //walk the ast and convert to tsx as we go + tsAst.forEachChild((n) => walk(n)); + // declare store declarations we found in the script + implicitStoreValues.modifyCode(astOffset, str); + const scriptStartTagEnd = htmlx.indexOf('>', script.start) + 1; + const scriptEndTagStart = htmlx.lastIndexOf('<', script.end - 1); + str.overwrite(script.start, scriptStartTagEnd, ';', { + contentOnly: true + }); + str.overwrite(scriptEndTagStart, script.end, ';', { + contentOnly: true + }); +} +function resolveImplicitStoreValue(node, implicitStoreValues, str, astOffset) { + var _a; + if (ts.isVariableDeclaration(node)) { + implicitStoreValues.addVariableDeclaration(node); + } + if (ts.isImportClause(node)) { + implicitStoreValues.addImportStatement(node); + } + if (ts.isImportSpecifier(node)) { + implicitStoreValues.addImportStatement(node); + } + if ((_a = ts.isTypeAssertionExpression) === null || _a === void 0 ? void 0 : _a.call(ts, node)) { + handleTypeAssertion(str, node, astOffset); + } +} +function throwIfIs$$EventsDeclaration(node, str, astOffset) { + if (is$$EventsDeclaration(node)) { + throw$$Error(node, str, astOffset, '$$Events'); + } +} +function throwIfIs$$SlotsDeclaration(node, str, astOffset) { + if (is$$SlotsDeclaration(node)) { + throw$$Error(node, str, astOffset, '$$Slots'); + } +} +function throwIfIs$$PropsDeclaration(node, str, astOffset) { + if (is$$PropsDeclaration(node)) { + throw$$Error(node, str, astOffset, '$$Props'); + } +} +function throw$$Error(node, str, astOffset, type) { + throwError(node.getStart() + astOffset, node.getEnd() + astOffset, `${type} can only be declared in the instance script`, str.original); +} + +function processSvelteTemplate(str, parse, options) { + const { htmlxAst, tags } = parseHtmlx(str.original, parse, options); + return convertHtmlxToJsx(str, htmlxAst, tags, options); +} +function svelte2tsx(svelte, options = { parse: compiler.parse }) { + options.mode = options.mode || 'ts'; + options.version = options.version || compiler.VERSION; + const str = new MagicString(svelte); + const basename = path.basename(options.filename || ''); + const svelte5Plus = Number(options.version[0]) > 4; + // process the htmlx as a svelte template + let { htmlAst, moduleScriptTag, scriptTag, rootSnippets, slots, uses$$props, uses$$slots, uses$$restProps, events, componentDocumentation, resolvedStores, usesAccessors, isRunes } = processSvelteTemplate(str, options.parse || compiler.parse, { + ...options, + svelte5Plus + }); + /* Rearrange the script tags so that module is first, and instance second followed finally by the template + * This is a bit convoluted due to some trouble I had with magic string. A simple str.move(start,end,0) for each script wasn't enough + * since if the module script was already at 0, it wouldn't move (which is fine) but would mean the order would be swapped when the script tag tried to move to 0 + * In this case we instead have to move it to moduleScriptTag.end. We track the location for the script move in the MoveInstanceScriptTarget var + */ + let instanceScriptTarget = 0; + let moduleAst; + if (moduleScriptTag) { + moduleAst = createModuleAst(str, moduleScriptTag); + if (moduleScriptTag.start != 0) { + //move our module tag to the top + str.move(moduleScriptTag.start, moduleScriptTag.end, 0); + } + else { + //since our module script was already at position 0, we need to move our instance script tag to the end of it. + instanceScriptTarget = moduleScriptTag.end; + } + } + const renderFunctionStart = scriptTag + ? str.original.lastIndexOf('>', scriptTag.content.start) + 1 + : instanceScriptTarget; + const implicitStoreValues = new ImplicitStoreValues(resolvedStores, renderFunctionStart); + //move the instance script and process the content + let exportedNames = new ExportedNames(str, 0, basename, options === null || options === void 0 ? void 0 : options.isTsFile, svelte5Plus, isRunes); + let generics = new Generics(str, 0, { attributes: [] }); + let uses$$SlotsInterface = false; + if (scriptTag) { + //ensure it is between the module script and the rest of the template (the variables need to be declared before the jsx template) + if (scriptTag.start != instanceScriptTarget) { + str.move(scriptTag.start, scriptTag.end, instanceScriptTarget); + } + const res = processInstanceScriptContent(str, scriptTag, events, implicitStoreValues, options.mode, moduleAst, options === null || options === void 0 ? void 0 : options.isTsFile, basename, svelte5Plus, isRunes); + uses$$props = uses$$props || res.uses$$props; + uses$$restProps = uses$$restProps || res.uses$$restProps; + uses$$slots = uses$$slots || res.uses$$slots; + ({ exportedNames, events, generics, uses$$SlotsInterface } = res); + } + exportedNames.usesAccessors = usesAccessors; + if (svelte5Plus) { + exportedNames.checkGlobalsForRunes(implicitStoreValues.getGlobals()); + } + //wrap the script tag and template content in a function returning the slot and exports + createRenderFunction({ + str, + scriptTag, + scriptDestination: instanceScriptTarget, + slots, + events, + exportedNames, + uses$$props, + uses$$restProps, + uses$$slots, + uses$$SlotsInterface, + generics, + svelte5Plus, + mode: options.mode + }); + // we need to process the module script after the instance script has moved otherwise we get warnings about moving edited items + if (moduleScriptTag) { + processModuleScriptTag(str, moduleScriptTag, new ImplicitStoreValues(implicitStoreValues.getAccessedStores(), renderFunctionStart, scriptTag || options.mode === 'ts' ? undefined : (input) => `;${input}<>`), moduleAst); + if (!scriptTag) { + moduleAst.tsAst.forEachChild((node) => exportedNames.hoistableInterfaces.analyzeModuleScriptNode(node)); + } + } + if (moduleScriptTag || scriptTag) { + const allowed = exportedNames.hoistableInterfaces.getAllowedValues(); + for (const [start, end, globals] of rootSnippets) { + const hoist_to_module = moduleScriptTag && + (globals.size === 0 || [...globals.keys()].every((id) => allowed.has(id))); + if (hoist_to_module) { + str.move(start, end, scriptTag + ? scriptTag.start + 1 // +1 because imports are also moved at that position, and we want to move interfaces after imports + : moduleScriptTag.end); + } + else if (scriptTag) { + str.move(start, end, renderFunctionStart); + } + } + } + addComponentExport({ + str, + canHaveAnyProp: !exportedNames.uses$$Props && (uses$$props || uses$$restProps), + events, + isTsFile: options === null || options === void 0 ? void 0 : options.isTsFile, + exportedNames, + usesAccessors, + usesSlots: slots.size > 0, + fileName: options === null || options === void 0 ? void 0 : options.filename, + componentDocumentation, + mode: options.mode, + generics, + isSvelte5: svelte5Plus, + noSvelteComponentTyped: options.noSvelteComponentTyped + }); + if (options.mode === 'dts') { + // Prepend the import which is used for TS files + // The other shims need to be provided by the user ambient-style, + // for example through filenames.push(require.resolve('svelte2tsx/svelte-shims.d.ts')) + // TODO replace with SvelteComponent for Svelte 5, keep old for backwards compatibility with Svelte 3 + if (options.noSvelteComponentTyped) { + str.prepend('import { SvelteComponent } from "svelte"\n' + '\n'); + } + else { + str.prepend('import { SvelteComponentTyped } from "svelte"\n' + '\n'); + } + let code = str.toString(); + // Remove all tsx occurences and the template part from the output + code = code + // prepended before each script block + .replace('<>;', '') + .replace('<>;', '') + // tsx in render function + .replace(/<>.*<\/>/s, '') + .replace('\n() => ();', ''); + return { + code + }; + } + else { + str.prepend('///\n'); + return { + code: str.toString(), + map: str.generateMap({ hires: true, source: options === null || options === void 0 ? void 0 : options.filename }), + exportedNames: exportedNames.getExportsMap(), + events: events.createAPI(), + // not part of the public API so people don't start using it + htmlAst + }; + } +} + +async function emitDts(config) { + const svelteMap = await createSvelteMap(config); + const { options, filenames } = loadTsconfig(config, svelteMap); + const host = await createTsCompilerHost(options, svelteMap); + const program = ts.createProgram(filenames, options, host); + const result = program.emit(); + const likely_failed_files = result.diagnostics.filter((diagnostic) => { + // List of errors which hint at a failed d.ts generation + // https://github.com/microsoft/TypeScript/blob/main/src/compiler/diagnosticMessages.json + return (diagnostic.code === 2527 || + diagnostic.code === 5088 || + diagnostic.code === 2742 || + (diagnostic.code >= 9005 && diagnostic.code <= 9039) || + (diagnostic.code >= 4000 && diagnostic.code <= 4108)); + }); + if (likely_failed_files.length > 0) { + const failed_by_file = new Map(); + likely_failed_files.forEach((diagnostic) => { + var _a; + const file = (_a = diagnostic.file) === null || _a === void 0 ? void 0 : _a.fileName; + if (file) { + const errors = failed_by_file.get(file) || []; + errors.push(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')); + failed_by_file.set(file, errors); + } + }); + console.warn('d.ts type declaration files for the following files were likely not generated due to the following errors:'); + console.warn([...failed_by_file.entries()] + .map(([file, errors]) => { + return `${file}\n${errors.map((error) => ` - ${error}`).join('\n')}`; + }) + .join('\n')); + } +} +function loadTsconfig(config, svelteMap) { + var _a; + const libRoot = config.libRoot || process.cwd(); + const jsconfigFile = ts.findConfigFile(libRoot, ts.sys.fileExists, 'jsconfig.json'); + let tsconfigFile = ts.findConfigFile(libRoot, ts.sys.fileExists, config.tsconfig); + if (!tsconfigFile && !jsconfigFile) { + throw new Error('Failed to locate tsconfig or jsconfig'); + } + tsconfigFile = tsconfigFile || jsconfigFile; + if (jsconfigFile && isSubpath(path__namespace.dirname(tsconfigFile), path__namespace.dirname(jsconfigFile))) { + tsconfigFile = jsconfigFile; + } + tsconfigFile = path__namespace.isAbsolute(tsconfigFile) ? tsconfigFile : path__namespace.join(libRoot, tsconfigFile); + const basepath = path__namespace.dirname(tsconfigFile); + const { error, config: tsConfig } = ts.readConfigFile(tsconfigFile, ts.sys.readFile); + if (error) { + throw new Error('Malformed tsconfig\n' + JSON.stringify(error, null, 2)); + } + // Rewire includes and files. This ensures that only the files inside the lib are traversed and + // that the outputted types have the correct directory depth. + // This is a little brittle because we then may include more than the user wants + const libPathRelative = path__namespace.relative(basepath, libRoot).split(path__namespace.sep).join('/'); + if (libPathRelative) { + tsConfig.include = [`${libPathRelative}/**/*`]; + tsConfig.files = []; + } + const { options, fileNames } = ts.parseJsonConfigFileContent(tsConfig, ts.sys, basepath, { sourceMap: false, rootDir: config.libRoot }, tsconfigFile, undefined, [{ extension: 'svelte', isMixedContent: true, scriptKind: ts.ScriptKind.Deferred }]); + const filenames = fileNames.map((name) => { + if (!isSvelteFilepath(name)) { + return name; + } + // We need to trick TypeScript into thinking that Svelte files + // are either TS or JS files in order to generate correct d.ts + // definition files. + const isTsFile = svelteMap.add(name); + return name + (isTsFile ? '.ts' : '.js'); + }); + // Add ambient functions so TS knows how to resolve its invocations in the + // code output of svelte2tsx. + filenames.push(config.svelteShimsPath); + return { + options: { + ...options, + noEmit: false, // Set to true in case of jsconfig, force false, else nothing is emitted + moduleResolution: + // NodeJS: up to 4.9, Node10: since 5.0 + (_a = ts.ModuleResolutionKind.NodeJs) !== null && _a !== void 0 ? _a : ts.ModuleResolutionKind.Node10, // Classic if not set, which gives wrong results + declaration: true, // Needed for d.ts file generation + emitDeclarationOnly: true, // We only want d.ts file generation + declarationDir: config.declarationDir, // Where to put the declarations + allowNonTsExtensions: true + }, + filenames + }; +} +async function createTsCompilerHost(options, svelteMap) { + const host = ts.createCompilerHost(options); + // TypeScript writes the files relative to the found tsconfig/jsconfig + // which - at least in the case of the tests - is wrong. Therefore prefix + // the output paths. See Typescript issue #25430 for more. + const pathPrefix = path__namespace + .relative(process.cwd(), path__namespace.dirname(options.configFilePath)) + .split(path__namespace.sep) + .join('/'); + const svelteSys = { + ...ts.sys, + fileExists(originalPath) { + let exists = ts.sys.fileExists(originalPath); + if (exists) { + return true; + } + const path = ensureRealSvelteFilepath(originalPath); + if (path === originalPath) { + return false; + } + exists = ts.sys.fileExists(path); + if (exists && isSvelteFilepath(path)) { + const isTsFile = svelteMap.add(path); + if ((isTsFile && !isTsFilepath(originalPath)) || + (!isTsFile && isTsFilepath(originalPath))) { + return false; + } + } + return exists; + }, + readFile(path, encoding = 'utf-8') { + const sveltePath = ensureRealSvelteFilepath(path); + if (path !== sveltePath || isSvelteFilepath(path)) { + const result = svelteMap.get(sveltePath); + if (result === undefined) { + return ts.sys.readFile(path, encoding); + } + else { + return result; + } + } + else { + return ts.sys.readFile(path, encoding); + } + }, + readDirectory(path, extensions, exclude, include, depth) { + const extensionsWithSvelte = (extensions || []).concat('.svelte'); + return ts.sys.readDirectory(path, extensionsWithSvelte, exclude, include, depth); + }, + writeFile(fileName, data, writeByteOrderMark) { + fileName = pathPrefix ? path__namespace.join(pathPrefix, fileName) : fileName; + if (fileName.endsWith('d.ts.map')) { + data = data.replace(/"sources":\["(.+?)"\]/, (_, sourcePath) => { + // The inverse of the pathPrefix adjustment + sourcePath = + pathPrefix && sourcePath.includes(pathPrefix) + ? sourcePath.slice(0, sourcePath.indexOf(pathPrefix)) + + sourcePath.slice(sourcePath.indexOf(pathPrefix) + pathPrefix.length + 1) + : sourcePath; + // Due to our hack of treating .svelte files as .ts files, we need to adjust the extension + if (svelteMap.get(path__namespace.join(options.rootDir, toRealSvelteFilepath(sourcePath)))) { + sourcePath = toRealSvelteFilepath(sourcePath); + } + return `"sources":["${sourcePath}"]`; + }); + } + else if (fileName.endsWith('js.map')) { + data = data.replace(/"sources":\["(.+?)"\]/, (_, sourcePath) => { + // The inverse of the pathPrefix adjustment + sourcePath = + pathPrefix && sourcePath.includes(pathPrefix) + ? sourcePath.slice(0, sourcePath.indexOf(pathPrefix)) + + sourcePath.slice(sourcePath.indexOf(pathPrefix) + pathPrefix.length + 1) + : sourcePath; + return `"sources":["${sourcePath}"]`; + }); + } + return ts.sys.writeFile(fileName, data, writeByteOrderMark); + } + }; + host.fileExists = svelteSys.fileExists; + host.readFile = svelteSys.readFile; + host.readDirectory = svelteSys.readDirectory; + host.writeFile = svelteSys.writeFile; + host.resolveModuleNames = (moduleNames, containingFile, _reusedNames, _redirectedReference, compilerOptions) => { + return moduleNames.map((moduleName) => { + return resolveModuleName(moduleName, containingFile, compilerOptions); + }); + }; + host.resolveModuleNameLiterals = (moduleLiterals, containingFile, _redirectedReference, compilerOptions) => { + return moduleLiterals.map((moduleLiteral) => { + return { + resolvedModule: resolveModuleName(moduleLiteral.text, containingFile, compilerOptions) + }; + }); + }; + function resolveModuleName(name, containingFile, compilerOptions) { + // Delegate to the TS resolver first. + // If that does not bring up anything, try the Svelte Module loader + // which is able to deal with .svelte files. + const tsResolvedModule = ts.resolveModuleName(name, containingFile, compilerOptions, ts.sys).resolvedModule; + if (tsResolvedModule && !isVirtualSvelteFilepath(tsResolvedModule.resolvedFileName)) { + return tsResolvedModule; + } + return ts.resolveModuleName(name, containingFile, compilerOptions, svelteSys) + .resolvedModule; + } + return host; +} +/** + * Generates a map to which we add the transformed code of Svelte files + * early on when we first need to look at the file contents and can read + * those transformed source later on. + */ +async function createSvelteMap(config) { + const svelteFiles = new Map(); + // TODO detect Svelte version in here and set shimsPath accordingly if not given from above + const noSvelteComponentTyped = config.svelteShimsPath + .replace(/\\/g, '/') + .endsWith('svelte2tsx/svelte-shims-v4.d.ts'); + const version = noSvelteComponentTyped ? undefined : '3.42.0'; + function add(path) { + const code = ts.sys.readFile(path, 'utf-8'); + const isTsFile = /]*?lang=('|")(ts|typescript)('|")/.test(code); + const transformed = svelte2tsx(code, { + filename: path, + isTsFile, + mode: 'dts', + version, + noSvelteComponentTyped: noSvelteComponentTyped + }).code; + svelteFiles.set(path.replace(/\\/g, '/'), transformed); + return isTsFile; + } + return { + add, + get: (key) => svelteFiles.get(key.replace(/\\/g, '/')) + }; +} +function isSvelteFilepath(filePath) { + return filePath.endsWith('.svelte'); +} +function isTsFilepath(filePath) { + return filePath.endsWith('.ts'); +} +function isVirtualSvelteFilepath(filePath) { + return filePath.endsWith('.svelte.ts') || filePath.endsWith('svelte.js'); +} +function toRealSvelteFilepath(filePath) { + return filePath.slice(0, -3); // -'.js'.length || -'.ts'.length +} +function ensureRealSvelteFilepath(filePath) { + return isVirtualSvelteFilepath(filePath) ? toRealSvelteFilepath(filePath) : filePath; +} +function isSubpath(maybeParent, maybeChild) { + const relative = path__namespace.relative(maybeParent, maybeChild); + return relative && !relative.startsWith('..') && !path__namespace.isAbsolute(relative); +} + +exports.emitDts = emitDts; +exports.internalHelpers = internalHelpers; +exports.svelte2tsx = svelte2tsx; +//# sourceMappingURL=index.js.map diff --git a/node_modules/svelte2tsx/index.mjs b/node_modules/svelte2tsx/index.mjs new file mode 100644 index 00000000..7486ece7 --- /dev/null +++ b/node_modules/svelte2tsx/index.mjs @@ -0,0 +1,8114 @@ +import dedent from 'dedent-js'; +import ts from 'typescript'; +import { pascalCase } from 'pascal-case'; +import * as path from 'path'; +import path__default, { join, resolve, dirname, basename } from 'path'; +import { VERSION, parse } from 'svelte/compiler'; + +const comma = ','.charCodeAt(0); +const semicolon = ';'.charCodeAt(0); +const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; +const intToChar = new Uint8Array(64); // 64 possible chars. +const charToInt = new Uint8Array(128); // z is 122 in ASCII +for (let i = 0; i < chars.length; i++) { + const c = chars.charCodeAt(i); + intToChar[i] = c; + charToInt[c] = i; +} +function encodeInteger(builder, num, relative) { + let delta = num - relative; + delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; + do { + let clamped = delta & 0b011111; + delta >>>= 5; + if (delta > 0) + clamped |= 0b100000; + builder.write(intToChar[clamped]); + } while (delta > 0); + return num; +} + +const bufLength = 1024 * 16; +// Provide a fallback for older environments. +const td = typeof TextDecoder !== 'undefined' + ? /* #__PURE__ */ new TextDecoder() + : typeof Buffer !== 'undefined' + ? { + decode(buf) { + const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); + return out.toString(); + }, + } + : { + decode(buf) { + let out = ''; + for (let i = 0; i < buf.length; i++) { + out += String.fromCharCode(buf[i]); + } + return out; + }, + }; +class StringWriter { + constructor() { + this.pos = 0; + this.out = ''; + this.buffer = new Uint8Array(bufLength); + } + write(v) { + const { buffer } = this; + buffer[this.pos++] = v; + if (this.pos === bufLength) { + this.out += td.decode(buffer); + this.pos = 0; + } + } + flush() { + const { buffer, out, pos } = this; + return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; + } +} +function encode(decoded) { + const writer = new StringWriter(); + let sourcesIndex = 0; + let sourceLine = 0; + let sourceColumn = 0; + let namesIndex = 0; + for (let i = 0; i < decoded.length; i++) { + const line = decoded[i]; + if (i > 0) + writer.write(semicolon); + if (line.length === 0) + continue; + let genColumn = 0; + for (let j = 0; j < line.length; j++) { + const segment = line[j]; + if (j > 0) + writer.write(comma); + genColumn = encodeInteger(writer, segment[0], genColumn); + if (segment.length === 1) + continue; + sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); + sourceLine = encodeInteger(writer, segment[2], sourceLine); + sourceColumn = encodeInteger(writer, segment[3], sourceColumn); + if (segment.length === 4) + continue; + namesIndex = encodeInteger(writer, segment[4], namesIndex); + } + } + return writer.flush(); +} + +class BitSet { + constructor(arg) { + this.bits = arg instanceof BitSet ? arg.bits.slice() : []; + } + + add(n) { + this.bits[n >> 5] |= 1 << (n & 31); + } + + has(n) { + return !!(this.bits[n >> 5] & (1 << (n & 31))); + } +} + +class Chunk { + constructor(start, end, content) { + this.start = start; + this.end = end; + this.original = content; + + this.intro = ''; + this.outro = ''; + + this.content = content; + this.storeName = false; + this.edited = false; + + { + this.previous = null; + this.next = null; + } + } + + appendLeft(content) { + this.outro += content; + } + + appendRight(content) { + this.intro = this.intro + content; + } + + clone() { + const chunk = new Chunk(this.start, this.end, this.original); + + chunk.intro = this.intro; + chunk.outro = this.outro; + chunk.content = this.content; + chunk.storeName = this.storeName; + chunk.edited = this.edited; + + return chunk; + } + + contains(index) { + return this.start < index && index < this.end; + } + + eachNext(fn) { + let chunk = this; + while (chunk) { + fn(chunk); + chunk = chunk.next; + } + } + + eachPrevious(fn) { + let chunk = this; + while (chunk) { + fn(chunk); + chunk = chunk.previous; + } + } + + edit(content, storeName, contentOnly) { + this.content = content; + if (!contentOnly) { + this.intro = ''; + this.outro = ''; + } + this.storeName = storeName; + + this.edited = true; + + return this; + } + + prependLeft(content) { + this.outro = content + this.outro; + } + + prependRight(content) { + this.intro = content + this.intro; + } + + reset() { + this.intro = ''; + this.outro = ''; + if (this.edited) { + this.content = this.original; + this.storeName = false; + this.edited = false; + } + } + + split(index) { + const sliceIndex = index - this.start; + + const originalBefore = this.original.slice(0, sliceIndex); + const originalAfter = this.original.slice(sliceIndex); + + this.original = originalBefore; + + const newChunk = new Chunk(index, this.end, originalAfter); + newChunk.outro = this.outro; + this.outro = ''; + + this.end = index; + + if (this.edited) { + // after split we should save the edit content record into the correct chunk + // to make sure sourcemap correct + // For example: + // ' test'.trim() + // split -> ' ' + 'test' + // ✔️ edit -> '' + 'test' + // ✖️ edit -> 'test' + '' + // TODO is this block necessary?... + newChunk.edit('', false); + this.content = ''; + } else { + this.content = originalBefore; + } + + newChunk.next = this.next; + if (newChunk.next) newChunk.next.previous = newChunk; + newChunk.previous = this; + this.next = newChunk; + + return newChunk; + } + + toString() { + return this.intro + this.content + this.outro; + } + + trimEnd(rx) { + this.outro = this.outro.replace(rx, ''); + if (this.outro.length) return true; + + const trimmed = this.content.replace(rx, ''); + + if (trimmed.length) { + if (trimmed !== this.content) { + this.split(this.start + trimmed.length).edit('', undefined, true); + if (this.edited) { + // save the change, if it has been edited + this.edit(trimmed, this.storeName, true); + } + } + return true; + } else { + this.edit('', undefined, true); + + this.intro = this.intro.replace(rx, ''); + if (this.intro.length) return true; + } + } + + trimStart(rx) { + this.intro = this.intro.replace(rx, ''); + if (this.intro.length) return true; + + const trimmed = this.content.replace(rx, ''); + + if (trimmed.length) { + if (trimmed !== this.content) { + const newChunk = this.split(this.end - trimmed.length); + if (this.edited) { + // save the change, if it has been edited + newChunk.edit(trimmed, this.storeName, true); + } + this.edit('', undefined, true); + } + return true; + } else { + this.edit('', undefined, true); + + this.outro = this.outro.replace(rx, ''); + if (this.outro.length) return true; + } + } +} + +function getBtoa() { + if (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') { + return (str) => globalThis.btoa(unescape(encodeURIComponent(str))); + } else if (typeof Buffer === 'function') { + return (str) => Buffer.from(str, 'utf-8').toString('base64'); + } else { + return () => { + throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.'); + }; + } +} + +const btoa = /*#__PURE__*/ getBtoa(); + +class SourceMap { + constructor(properties) { + this.version = 3; + this.file = properties.file; + this.sources = properties.sources; + this.sourcesContent = properties.sourcesContent; + this.names = properties.names; + this.mappings = encode(properties.mappings); + if (typeof properties.x_google_ignoreList !== 'undefined') { + this.x_google_ignoreList = properties.x_google_ignoreList; + } + } + + toString() { + return JSON.stringify(this); + } + + toUrl() { + return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString()); + } +} + +function guessIndent(code) { + const lines = code.split('\n'); + + const tabbed = lines.filter((line) => /^\t+/.test(line)); + const spaced = lines.filter((line) => /^ {2,}/.test(line)); + + if (tabbed.length === 0 && spaced.length === 0) { + return null; + } + + // More lines tabbed than spaced? Assume tabs, and + // default to tabs in the case of a tie (or nothing + // to go on) + if (tabbed.length >= spaced.length) { + return '\t'; + } + + // Otherwise, we need to guess the multiple + const min = spaced.reduce((previous, current) => { + const numSpaces = /^ +/.exec(current)[0].length; + return Math.min(numSpaces, previous); + }, Infinity); + + return new Array(min + 1).join(' '); +} + +function getRelativePath(from, to) { + const fromParts = from.split(/[/\\]/); + const toParts = to.split(/[/\\]/); + + fromParts.pop(); // get dirname + + while (fromParts[0] === toParts[0]) { + fromParts.shift(); + toParts.shift(); + } + + if (fromParts.length) { + let i = fromParts.length; + while (i--) fromParts[i] = '..'; + } + + return fromParts.concat(toParts).join('/'); +} + +const toString = Object.prototype.toString; + +function isObject(thing) { + return toString.call(thing) === '[object Object]'; +} + +function getLocator(source) { + const originalLines = source.split('\n'); + const lineOffsets = []; + + for (let i = 0, pos = 0; i < originalLines.length; i++) { + lineOffsets.push(pos); + pos += originalLines[i].length + 1; + } + + return function locate(index) { + let i = 0; + let j = lineOffsets.length; + while (i < j) { + const m = (i + j) >> 1; + if (index < lineOffsets[m]) { + j = m; + } else { + i = m + 1; + } + } + const line = i - 1; + const column = index - lineOffsets[line]; + return { line, column }; + }; +} + +const wordRegex = /\w/; + +class Mappings { + constructor(hires) { + this.hires = hires; + this.generatedCodeLine = 0; + this.generatedCodeColumn = 0; + this.raw = []; + this.rawSegments = this.raw[this.generatedCodeLine] = []; + this.pending = null; + } + + addEdit(sourceIndex, content, loc, nameIndex) { + if (content.length) { + const contentLengthMinusOne = content.length - 1; + let contentLineEnd = content.indexOf('\n', 0); + let previousContentLineEnd = -1; + // Loop through each line in the content and add a segment, but stop if the last line is empty, + // else code afterwards would fill one line too many + while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) { + const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; + if (nameIndex >= 0) { + segment.push(nameIndex); + } + this.rawSegments.push(segment); + + this.generatedCodeLine += 1; + this.raw[this.generatedCodeLine] = this.rawSegments = []; + this.generatedCodeColumn = 0; + + previousContentLineEnd = contentLineEnd; + contentLineEnd = content.indexOf('\n', contentLineEnd + 1); + } + + const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; + if (nameIndex >= 0) { + segment.push(nameIndex); + } + this.rawSegments.push(segment); + + this.advance(content.slice(previousContentLineEnd + 1)); + } else if (this.pending) { + this.rawSegments.push(this.pending); + this.advance(content); + } + + this.pending = null; + } + + addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) { + let originalCharIndex = chunk.start; + let first = true; + // when iterating each char, check if it's in a word boundary + let charInHiresBoundary = false; + + while (originalCharIndex < chunk.end) { + if (this.hires || first || sourcemapLocations.has(originalCharIndex)) { + const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; + + if (this.hires === 'boundary') { + // in hires "boundary", group segments per word boundary than per char + if (wordRegex.test(original[originalCharIndex])) { + // for first char in the boundary found, start the boundary by pushing a segment + if (!charInHiresBoundary) { + this.rawSegments.push(segment); + charInHiresBoundary = true; + } + } else { + // for non-word char, end the boundary by pushing a segment + this.rawSegments.push(segment); + charInHiresBoundary = false; + } + } else { + this.rawSegments.push(segment); + } + } + + if (original[originalCharIndex] === '\n') { + loc.line += 1; + loc.column = 0; + this.generatedCodeLine += 1; + this.raw[this.generatedCodeLine] = this.rawSegments = []; + this.generatedCodeColumn = 0; + first = true; + } else { + loc.column += 1; + this.generatedCodeColumn += 1; + first = false; + } + + originalCharIndex += 1; + } + + this.pending = null; + } + + advance(str) { + if (!str) return; + + const lines = str.split('\n'); + + if (lines.length > 1) { + for (let i = 0; i < lines.length - 1; i++) { + this.generatedCodeLine++; + this.raw[this.generatedCodeLine] = this.rawSegments = []; + } + this.generatedCodeColumn = 0; + } + + this.generatedCodeColumn += lines[lines.length - 1].length; + } +} + +const n = '\n'; + +const warned = { + insertLeft: false, + insertRight: false, + storeName: false, +}; + +class MagicString { + constructor(string, options = {}) { + const chunk = new Chunk(0, string.length, string); + + Object.defineProperties(this, { + original: { writable: true, value: string }, + outro: { writable: true, value: '' }, + intro: { writable: true, value: '' }, + firstChunk: { writable: true, value: chunk }, + lastChunk: { writable: true, value: chunk }, + lastSearchedChunk: { writable: true, value: chunk }, + byStart: { writable: true, value: {} }, + byEnd: { writable: true, value: {} }, + filename: { writable: true, value: options.filename }, + indentExclusionRanges: { writable: true, value: options.indentExclusionRanges }, + sourcemapLocations: { writable: true, value: new BitSet() }, + storedNames: { writable: true, value: {} }, + indentStr: { writable: true, value: undefined }, + ignoreList: { writable: true, value: options.ignoreList }, + }); + + this.byStart[0] = chunk; + this.byEnd[string.length] = chunk; + } + + addSourcemapLocation(char) { + this.sourcemapLocations.add(char); + } + + append(content) { + if (typeof content !== 'string') throw new TypeError('outro content must be a string'); + + this.outro += content; + return this; + } + + appendLeft(index, content) { + if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); + + this._split(index); + + const chunk = this.byEnd[index]; + + if (chunk) { + chunk.appendLeft(content); + } else { + this.intro += content; + } + return this; + } + + appendRight(index, content) { + if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); + + this._split(index); + + const chunk = this.byStart[index]; + + if (chunk) { + chunk.appendRight(content); + } else { + this.outro += content; + } + return this; + } + + clone() { + const cloned = new MagicString(this.original, { filename: this.filename }); + + let originalChunk = this.firstChunk; + let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone()); + + while (originalChunk) { + cloned.byStart[clonedChunk.start] = clonedChunk; + cloned.byEnd[clonedChunk.end] = clonedChunk; + + const nextOriginalChunk = originalChunk.next; + const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone(); + + if (nextClonedChunk) { + clonedChunk.next = nextClonedChunk; + nextClonedChunk.previous = clonedChunk; + + clonedChunk = nextClonedChunk; + } + + originalChunk = nextOriginalChunk; + } + + cloned.lastChunk = clonedChunk; + + if (this.indentExclusionRanges) { + cloned.indentExclusionRanges = this.indentExclusionRanges.slice(); + } + + cloned.sourcemapLocations = new BitSet(this.sourcemapLocations); + + cloned.intro = this.intro; + cloned.outro = this.outro; + + return cloned; + } + + generateDecodedMap(options) { + options = options || {}; + + const sourceIndex = 0; + const names = Object.keys(this.storedNames); + const mappings = new Mappings(options.hires); + + const locate = getLocator(this.original); + + if (this.intro) { + mappings.advance(this.intro); + } + + this.firstChunk.eachNext((chunk) => { + const loc = locate(chunk.start); + + if (chunk.intro.length) mappings.advance(chunk.intro); + + if (chunk.edited) { + mappings.addEdit( + sourceIndex, + chunk.content, + loc, + chunk.storeName ? names.indexOf(chunk.original) : -1, + ); + } else { + mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations); + } + + if (chunk.outro.length) mappings.advance(chunk.outro); + }); + + return { + file: options.file ? options.file.split(/[/\\]/).pop() : undefined, + sources: [ + options.source ? getRelativePath(options.file || '', options.source) : options.file || '', + ], + sourcesContent: options.includeContent ? [this.original] : undefined, + names, + mappings: mappings.raw, + x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined, + }; + } + + generateMap(options) { + return new SourceMap(this.generateDecodedMap(options)); + } + + _ensureindentStr() { + if (this.indentStr === undefined) { + this.indentStr = guessIndent(this.original); + } + } + + _getRawIndentString() { + this._ensureindentStr(); + return this.indentStr; + } + + getIndentString() { + this._ensureindentStr(); + return this.indentStr === null ? '\t' : this.indentStr; + } + + indent(indentStr, options) { + const pattern = /^[^\r\n]/gm; + + if (isObject(indentStr)) { + options = indentStr; + indentStr = undefined; + } + + if (indentStr === undefined) { + this._ensureindentStr(); + indentStr = this.indentStr || '\t'; + } + + if (indentStr === '') return this; // noop + + options = options || {}; + + // Process exclusion ranges + const isExcluded = {}; + + if (options.exclude) { + const exclusions = + typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude; + exclusions.forEach((exclusion) => { + for (let i = exclusion[0]; i < exclusion[1]; i += 1) { + isExcluded[i] = true; + } + }); + } + + let shouldIndentNextCharacter = options.indentStart !== false; + const replacer = (match) => { + if (shouldIndentNextCharacter) return `${indentStr}${match}`; + shouldIndentNextCharacter = true; + return match; + }; + + this.intro = this.intro.replace(pattern, replacer); + + let charIndex = 0; + let chunk = this.firstChunk; + + while (chunk) { + const end = chunk.end; + + if (chunk.edited) { + if (!isExcluded[charIndex]) { + chunk.content = chunk.content.replace(pattern, replacer); + + if (chunk.content.length) { + shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n'; + } + } + } else { + charIndex = chunk.start; + + while (charIndex < end) { + if (!isExcluded[charIndex]) { + const char = this.original[charIndex]; + + if (char === '\n') { + shouldIndentNextCharacter = true; + } else if (char !== '\r' && shouldIndentNextCharacter) { + shouldIndentNextCharacter = false; + + if (charIndex === chunk.start) { + chunk.prependRight(indentStr); + } else { + this._splitChunk(chunk, charIndex); + chunk = chunk.next; + chunk.prependRight(indentStr); + } + } + } + + charIndex += 1; + } + } + + charIndex = chunk.end; + chunk = chunk.next; + } + + this.outro = this.outro.replace(pattern, replacer); + + return this; + } + + insert() { + throw new Error( + 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)', + ); + } + + insertLeft(index, content) { + if (!warned.insertLeft) { + console.warn( + 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead', + ); // eslint-disable-line no-console + warned.insertLeft = true; + } + + return this.appendLeft(index, content); + } + + insertRight(index, content) { + if (!warned.insertRight) { + console.warn( + 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead', + ); // eslint-disable-line no-console + warned.insertRight = true; + } + + return this.prependRight(index, content); + } + + move(start, end, index) { + if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself'); + + this._split(start); + this._split(end); + this._split(index); + + const first = this.byStart[start]; + const last = this.byEnd[end]; + + const oldLeft = first.previous; + const oldRight = last.next; + + const newRight = this.byStart[index]; + if (!newRight && last === this.lastChunk) return this; + const newLeft = newRight ? newRight.previous : this.lastChunk; + + if (oldLeft) oldLeft.next = oldRight; + if (oldRight) oldRight.previous = oldLeft; + + if (newLeft) newLeft.next = first; + if (newRight) newRight.previous = last; + + if (!first.previous) this.firstChunk = last.next; + if (!last.next) { + this.lastChunk = first.previous; + this.lastChunk.next = null; + } + + first.previous = newLeft; + last.next = newRight || null; + + if (!newLeft) this.firstChunk = first; + if (!newRight) this.lastChunk = last; + return this; + } + + overwrite(start, end, content, options) { + options = options || {}; + return this.update(start, end, content, { ...options, overwrite: !options.contentOnly }); + } + + update(start, end, content, options) { + if (typeof content !== 'string') throw new TypeError('replacement content must be a string'); + + if (this.original.length !== 0) { + while (start < 0) start += this.original.length; + while (end < 0) end += this.original.length; + } + + if (end > this.original.length) throw new Error('end is out of bounds'); + if (start === end) + throw new Error( + 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead', + ); + + this._split(start); + this._split(end); + + if (options === true) { + if (!warned.storeName) { + console.warn( + 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string', + ); // eslint-disable-line no-console + warned.storeName = true; + } + + options = { storeName: true }; + } + const storeName = options !== undefined ? options.storeName : false; + const overwrite = options !== undefined ? options.overwrite : false; + + if (storeName) { + const original = this.original.slice(start, end); + Object.defineProperty(this.storedNames, original, { + writable: true, + value: true, + enumerable: true, + }); + } + + const first = this.byStart[start]; + const last = this.byEnd[end]; + + if (first) { + let chunk = first; + while (chunk !== last) { + if (chunk.next !== this.byStart[chunk.end]) { + throw new Error('Cannot overwrite across a split point'); + } + chunk = chunk.next; + chunk.edit('', false); + } + + first.edit(content, storeName, !overwrite); + } else { + // must be inserting at the end + const newChunk = new Chunk(start, end, '').edit(content, storeName); + + // TODO last chunk in the array may not be the last chunk, if it's moved... + last.next = newChunk; + newChunk.previous = last; + } + return this; + } + + prepend(content) { + if (typeof content !== 'string') throw new TypeError('outro content must be a string'); + + this.intro = content + this.intro; + return this; + } + + prependLeft(index, content) { + if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); + + this._split(index); + + const chunk = this.byEnd[index]; + + if (chunk) { + chunk.prependLeft(content); + } else { + this.intro = content + this.intro; + } + return this; + } + + prependRight(index, content) { + if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); + + this._split(index); + + const chunk = this.byStart[index]; + + if (chunk) { + chunk.prependRight(content); + } else { + this.outro = content + this.outro; + } + return this; + } + + remove(start, end) { + if (this.original.length !== 0) { + while (start < 0) start += this.original.length; + while (end < 0) end += this.original.length; + } + + if (start === end) return this; + + if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds'); + if (start > end) throw new Error('end must be greater than start'); + + this._split(start); + this._split(end); + + let chunk = this.byStart[start]; + + while (chunk) { + chunk.intro = ''; + chunk.outro = ''; + chunk.edit(''); + + chunk = end > chunk.end ? this.byStart[chunk.end] : null; + } + return this; + } + + reset(start, end) { + if (this.original.length !== 0) { + while (start < 0) start += this.original.length; + while (end < 0) end += this.original.length; + } + + if (start === end) return this; + + if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds'); + if (start > end) throw new Error('end must be greater than start'); + + this._split(start); + this._split(end); + + let chunk = this.byStart[start]; + + while (chunk) { + chunk.reset(); + + chunk = end > chunk.end ? this.byStart[chunk.end] : null; + } + return this; + } + + lastChar() { + if (this.outro.length) return this.outro[this.outro.length - 1]; + let chunk = this.lastChunk; + do { + if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1]; + if (chunk.content.length) return chunk.content[chunk.content.length - 1]; + if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1]; + } while ((chunk = chunk.previous)); + if (this.intro.length) return this.intro[this.intro.length - 1]; + return ''; + } + + lastLine() { + let lineIndex = this.outro.lastIndexOf(n); + if (lineIndex !== -1) return this.outro.substr(lineIndex + 1); + let lineStr = this.outro; + let chunk = this.lastChunk; + do { + if (chunk.outro.length > 0) { + lineIndex = chunk.outro.lastIndexOf(n); + if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr; + lineStr = chunk.outro + lineStr; + } + + if (chunk.content.length > 0) { + lineIndex = chunk.content.lastIndexOf(n); + if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr; + lineStr = chunk.content + lineStr; + } + + if (chunk.intro.length > 0) { + lineIndex = chunk.intro.lastIndexOf(n); + if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr; + lineStr = chunk.intro + lineStr; + } + } while ((chunk = chunk.previous)); + lineIndex = this.intro.lastIndexOf(n); + if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr; + return this.intro + lineStr; + } + + slice(start = 0, end = this.original.length) { + if (this.original.length !== 0) { + while (start < 0) start += this.original.length; + while (end < 0) end += this.original.length; + } + + let result = ''; + + // find start chunk + let chunk = this.firstChunk; + while (chunk && (chunk.start > start || chunk.end <= start)) { + // found end chunk before start + if (chunk.start < end && chunk.end >= end) { + return result; + } + + chunk = chunk.next; + } + + if (chunk && chunk.edited && chunk.start !== start) + throw new Error(`Cannot use replaced character ${start} as slice start anchor.`); + + const startChunk = chunk; + while (chunk) { + if (chunk.intro && (startChunk !== chunk || chunk.start === start)) { + result += chunk.intro; + } + + const containsEnd = chunk.start < end && chunk.end >= end; + if (containsEnd && chunk.edited && chunk.end !== end) + throw new Error(`Cannot use replaced character ${end} as slice end anchor.`); + + const sliceStart = startChunk === chunk ? start - chunk.start : 0; + const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length; + + result += chunk.content.slice(sliceStart, sliceEnd); + + if (chunk.outro && (!containsEnd || chunk.end === end)) { + result += chunk.outro; + } + + if (containsEnd) { + break; + } + + chunk = chunk.next; + } + + return result; + } + + // TODO deprecate this? not really very useful + snip(start, end) { + const clone = this.clone(); + clone.remove(0, start); + clone.remove(end, clone.original.length); + + return clone; + } + + _split(index) { + if (this.byStart[index] || this.byEnd[index]) return; + + let chunk = this.lastSearchedChunk; + const searchForward = index > chunk.end; + + while (chunk) { + if (chunk.contains(index)) return this._splitChunk(chunk, index); + + chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start]; + } + } + + _splitChunk(chunk, index) { + if (chunk.edited && chunk.content.length) { + // zero-length edited chunks are a special case (overlapping replacements) + const loc = getLocator(this.original)(index); + throw new Error( + `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`, + ); + } + + const newChunk = chunk.split(index); + + this.byEnd[index] = chunk; + this.byStart[index] = newChunk; + this.byEnd[newChunk.end] = newChunk; + + if (chunk === this.lastChunk) this.lastChunk = newChunk; + + this.lastSearchedChunk = chunk; + return true; + } + + toString() { + let str = this.intro; + + let chunk = this.firstChunk; + while (chunk) { + str += chunk.toString(); + chunk = chunk.next; + } + + return str + this.outro; + } + + isEmpty() { + let chunk = this.firstChunk; + do { + if ( + (chunk.intro.length && chunk.intro.trim()) || + (chunk.content.length && chunk.content.trim()) || + (chunk.outro.length && chunk.outro.trim()) + ) + return false; + } while ((chunk = chunk.next)); + return true; + } + + length() { + let chunk = this.firstChunk; + let length = 0; + do { + length += chunk.intro.length + chunk.content.length + chunk.outro.length; + } while ((chunk = chunk.next)); + return length; + } + + trimLines() { + return this.trim('[\\r\\n]'); + } + + trim(charType) { + return this.trimStart(charType).trimEnd(charType); + } + + trimEndAborted(charType) { + const rx = new RegExp((charType || '\\s') + '+$'); + + this.outro = this.outro.replace(rx, ''); + if (this.outro.length) return true; + + let chunk = this.lastChunk; + + do { + const end = chunk.end; + const aborted = chunk.trimEnd(rx); + + // if chunk was trimmed, we have a new lastChunk + if (chunk.end !== end) { + if (this.lastChunk === chunk) { + this.lastChunk = chunk.next; + } + + this.byEnd[chunk.end] = chunk; + this.byStart[chunk.next.start] = chunk.next; + this.byEnd[chunk.next.end] = chunk.next; + } + + if (aborted) return true; + chunk = chunk.previous; + } while (chunk); + + return false; + } + + trimEnd(charType) { + this.trimEndAborted(charType); + return this; + } + trimStartAborted(charType) { + const rx = new RegExp('^' + (charType || '\\s') + '+'); + + this.intro = this.intro.replace(rx, ''); + if (this.intro.length) return true; + + let chunk = this.firstChunk; + + do { + const end = chunk.end; + const aborted = chunk.trimStart(rx); + + if (chunk.end !== end) { + // special case... + if (chunk === this.lastChunk) this.lastChunk = chunk.next; + + this.byEnd[chunk.end] = chunk; + this.byStart[chunk.next.start] = chunk.next; + this.byEnd[chunk.next.end] = chunk.next; + } + + if (aborted) return true; + chunk = chunk.next; + } while (chunk); + + return false; + } + + trimStart(charType) { + this.trimStartAborted(charType); + return this; + } + + hasChanged() { + return this.original !== this.toString(); + } + + _replaceRegexp(searchValue, replacement) { + function getReplacement(match, str) { + if (typeof replacement === 'string') { + return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => { + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter + if (i === '$') return '$'; + if (i === '&') return match[0]; + const num = +i; + if (num < match.length) return match[+i]; + return `$${i}`; + }); + } else { + return replacement(...match, match.index, str, match.groups); + } + } + function matchAll(re, str) { + let match; + const matches = []; + while ((match = re.exec(str))) { + matches.push(match); + } + return matches; + } + if (searchValue.global) { + const matches = matchAll(searchValue, this.original); + matches.forEach((match) => { + if (match.index != null) { + const replacement = getReplacement(match, this.original); + if (replacement !== match[0]) { + this.overwrite( + match.index, + match.index + match[0].length, + replacement + ); + } + } + }); + } else { + const match = this.original.match(searchValue); + if (match && match.index != null) { + const replacement = getReplacement(match, this.original); + if (replacement !== match[0]) { + this.overwrite( + match.index, + match.index + match[0].length, + replacement + ); + } + } + } + return this; + } + + _replaceString(string, replacement) { + const { original } = this; + const index = original.indexOf(string); + + if (index !== -1) { + this.overwrite(index, index + string.length, replacement); + } + + return this; + } + + replace(searchValue, replacement) { + if (typeof searchValue === 'string') { + return this._replaceString(searchValue, replacement); + } + + return this._replaceRegexp(searchValue, replacement); + } + + _replaceAllString(string, replacement) { + const { original } = this; + const stringLength = string.length; + for ( + let index = original.indexOf(string); + index !== -1; + index = original.indexOf(string, index + stringLength) + ) { + const previous = original.slice(index, index + stringLength); + if (previous !== replacement) + this.overwrite(index, index + stringLength, replacement); + } + + return this; + } + + replaceAll(searchValue, replacement) { + if (typeof searchValue === 'string') { + return this._replaceAllString(searchValue, replacement); + } + + if (!searchValue.global) { + throw new TypeError( + 'MagicString.prototype.replaceAll called with a non-global RegExp argument', + ); + } + + return this._replaceRegexp(searchValue, replacement); + } +} + +// @ts-check +/** @typedef { import('estree').BaseNode} BaseNode */ + +/** @typedef {{ + skip: () => void; + remove: () => void; + replace: (node: BaseNode) => void; +}} WalkerContext */ + +class WalkerBase { + constructor() { + /** @type {boolean} */ + this.should_skip = false; + + /** @type {boolean} */ + this.should_remove = false; + + /** @type {BaseNode | null} */ + this.replacement = null; + + /** @type {WalkerContext} */ + this.context = { + skip: () => (this.should_skip = true), + remove: () => (this.should_remove = true), + replace: (node) => (this.replacement = node) + }; + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + * @param {BaseNode} node + */ + replace(parent, prop, index, node) { + if (parent) { + if (index !== null) { + parent[prop][index] = node; + } else { + parent[prop] = node; + } + } + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + */ + remove(parent, prop, index) { + if (parent) { + if (index !== null) { + parent[prop].splice(index, 1); + } else { + delete parent[prop]; + } + } + } +} + +// @ts-check + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker.js').WalkerContext} WalkerContext */ + +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => void} SyncHandler */ + +class SyncWalker extends WalkerBase { + /** + * + * @param {SyncHandler} enter + * @param {SyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {SyncHandler} */ + this.enter = enter; + + /** @type {SyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {BaseNode} + */ + visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!this.visit(value[i], node, key, i)) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } +} + +// @ts-check + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./sync.js').SyncHandler} SyncHandler */ +/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */ + +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: SyncHandler + * leave?: SyncHandler + * }} walker + * @returns {BaseNode} + */ +function walk(ast, { enter, leave }) { + const instance = new SyncWalker(enter, leave); + return instance.visit(ast, null); +} + +function parseAttributes(str, start) { + const attrs = []; + const pattern = /([\w-$]+\b)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g; + let match; + while ((match = pattern.exec(str)) !== null) { + const attr = match[0]; + const name = match[1]; + const value = match[2] || match[3] || match[4]; + const attrStart = start + str.indexOf(attr); + attrs[name] = value !== null && value !== void 0 ? value : name; + attrs.push({ + type: 'Attribute', + name, + value: !value || [ + { + type: 'Text', + start: attrStart + attr.indexOf('=') + 1, + end: attrStart + attr.length, + raw: value + } + ], + start: attrStart, + end: attrStart + attr.length + }); + } + return attrs; +} +// Regex ensures that attributes with > characters in them still result in the content being matched correctly +const scriptRegex = /()|('"\/\s]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"\/\s]+)*\s*)>)([\S\s]*?)<\/script>/g; +const styleRegex = /()|('"\/\s]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"\/\s]+)*\s*)>)([\S\s]*?)<\/style>/g; +function extractTag(htmlx, tag) { + const exp = tag === 'script' ? scriptRegex : styleRegex; + const matches = []; + let match = null; + while ((match = exp.exec(htmlx)) != null) { + if (match[0].startsWith(' __sveltets_2_ensureAction(xxx(svelte.mapElementTag('ParentNodeName'),(params))); + */ +function handleActionDirective(attr, element) { + element.addAction(attr); +} + +/** + * Moves or inserts text to the specified end in order. + * "In order" means that the transformation of the text before + * the given position reads exactly what was moved/inserted + * from left to right. + * After the transformation is done, everything inside the start-end-range that was + * not moved will be removed. If there's a delete position given, things will be moved + * to the end first before getting deleted. This may ensure better mappings for auto completion + * for example. + * Note: If you need the last char to be mapped so that it follows the previous character, + * you may need to find a different way because MagicString does not allow us to move a range + * that goes from `start` to `end` to the `end` position. + */ +function transform(str, start, end, transformations) { + var _a, _b; + const moves = []; + let appendPosition = end; + let ignoreNextString = false; + let deletePos; + let deleteDest; + for (let i = 0; i < transformations.length; i++) { + const transformation = transformations[i]; + if (typeof transformation === 'number') { + deletePos = moves.length; + deleteDest = transformation; + } + else if (typeof transformation === 'string') { + if (!ignoreNextString) { + str.appendLeft(appendPosition, transformation); + } + ignoreNextString = false; + } + else { + const tStart = transformation[0]; + let tEnd = transformation[1]; + if (tStart === tEnd) { + // zero-range selection, don't move, it would + // cause bugs and isn't necessary anyway + continue; + } + if (tEnd < end - 1 && + // TODO can we somehow make this more performant? + !transformations.some((t) => typeof t !== 'string' && t[0] === tEnd)) { + tEnd += 1; + const next = transformations[i + 1]; + ignoreNextString = typeof next === 'string'; + // Do not append the next string, rather overwrite the next character. This ensures + // that mappings of the string afterwards are not mapped to a previous character, making + // mappings of ranges one character too short. If there's no string in the next transformation, + // completely delete the first character afterwards. This also makes the mapping more correct, + // so that autocompletion triggered on the last character works correctly. + const overwrite = typeof next === 'string' ? next : ''; + str.overwrite(tEnd - 1, tEnd, overwrite, { contentOnly: true }); + } + appendPosition = tEnd; + moves.push([tStart, tEnd]); + } + } + deletePos = deletePos !== null && deletePos !== void 0 ? deletePos : moves.length; + for (let i = 0; i < deletePos; i++) { + str.move(moves[i][0], moves[i][1], end); + } + let removeStart = start; + const sortedMoves = [...moves].sort((t1, t2) => t1[0] - t2[0]); + // Remove everything between the transformations up until the end position + for (const transformation of sortedMoves) { + if (removeStart < transformation[0]) { + if (deletePos !== moves.length && + removeStart > deleteDest && + removeStart < end && + transformation[0] < end) { + str.move(removeStart, transformation[0], end); + } + if (transformation[0] < end) { + // Use one space because of hover etc: This will make map deleted characters to the whitespace + str.overwrite(removeStart, transformation[0], ' ', { contentOnly: true }); + } + } + removeStart = transformation[1]; + } + if (removeStart > end) { + // Reset the end to the last transformation before the end if there were transformations after the end + // so we still delete the correct range afterwards + let idx = sortedMoves.findIndex((m) => m[0] > end) - 1; + removeStart = (_b = (_a = sortedMoves[idx]) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : end; + } + if (removeStart < end) { + // Completely delete the first character afterwards. This makes the mapping more correct, + // so that autocompletion triggered on the last character works correctly. + str.overwrite(removeStart, removeStart + 1, '', { contentOnly: true }); + removeStart++; + } + if (removeStart < end) { + // Use one space because of hover etc: This will map deleted characters to the whitespace + if (deletePos !== moves.length && removeStart > deleteDest && removeStart + 1 < end) { + // Can only move stuff up to the end, not including, else we get a "cannot move inside itself" error + str.move(removeStart, end - 1, end); + str.overwrite(removeStart, end - 1, ' ', { contentOnly: true }); + str.overwrite(end - 1, end, '', { contentOnly: true }); + } + else { + str.overwrite(removeStart, end, ' ', { contentOnly: true }); + } + } + for (let i = deletePos; i < moves.length; i++) { + // Can happen when there's not enough space left at the end of an unfininished element/component tag. + // Better to leave potentially slightly disarranged code than fail loudly + if (moves[i][1] >= end && moves[i][0] <= end) + break; + str.move(moves[i][0], moves[i][1], end); + } +} +/** + * Surrounds given range with a prefix and suffix. This is benefitial + * for better mappings in some cases. Example: If we transform `foo` to `"foo"` + * and if TS underlines the whole `"foo"`, we need to make sure that the quotes + * are also mapped to the correct positions. + * Returns the input start/end transformation for convenience. + */ +function surroundWith(str, [start, end], prefix, suffix) { + if (start + 1 === end) { + str.overwrite(start, end, `${prefix}${str.original.charAt(start)}${suffix}`, { + contentOnly: true + }); + } + else { + str.overwrite(start, start + 1, `${prefix}${str.original.charAt(start)}`, { + contentOnly: true + }); + str.overwrite(end - 1, end, `${str.original.charAt(end - 1)}${suffix}`, { + contentOnly: true + }); + } + return [start, end]; +} +/** + * Returns the [start, end] indexes of a directive (action,animation,etc) name. + * Example: use:foo --> [startOfFoo, endOfFoo] + */ +function getDirectiveNameStartEndIdx(str, node) { + const colonIdx = str.original.indexOf(':', node.start); + return [colonIdx + 1, colonIdx + 1 + `${node.name}`.length]; +} +/** + * Removes characters from the string that are invalid for TS variable names. + * Careful: This does not check if the leading character + * is valid (numerical values aren't for example). + */ +function sanitizePropName(name) { + return name + .split('') + .map((char) => (/[0-9A-Za-z$_]/.test(char) ? char : '_')) + .join(''); +} +/** + * Check if there's a member access trailing behind given expression and if yes, + * bump the position to include it. + * Usually it's there because of the preprocessing we do before we let Svelte parse the template. + */ +function withTrailingPropertyAccess(originalText, position) { + let index = position; + while (index < originalText.length) { + const char = originalText[index]; + if (!char.trim()) { + index++; + continue; + } + if (char === '.') { + return index + 1; + } + if (char === '?' && originalText[index + 1] === '.') { + return index + 2; + } + break; + } + return position; +} +function rangeWithTrailingPropertyAccess(originalText, node) { + return [node.start, withTrailingPropertyAccess(originalText, node.end)]; +} +/** + * Get the end of the node, excluding the type annotation + */ +function getEnd(node) { + var _a, _b; + return isTypescriptNode(node) ? node.expression.end : ((_b = (_a = node.typeAnnotation) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : node.end); +} +function isTypescriptNode(node) { + return (node.type === 'TSAsExpression' || + node.type === 'TSSatisfiesExpression' || + node.type === 'TSNonNullExpression'); +} +/** + * Returns `true` if the given block is implicitly closed, which could be the case in loose parsing mode. + * E.g.: + * ```html + *
    + * {#if x} + *
    + * ``` + * @param end + * @param block + * @returns + */ +function isImplicitlyClosedBlock(end, block) { + var _a, _b; + return end < ((_b = (_a = block.children[block.children.length - 1]) === null || _a === void 0 ? void 0 : _a.end) !== null && _b !== void 0 ? _b : block.expression.end); +} + +/** + * animate:xxx(yyy) ---> __sveltets_2_ensureAnimation(xxx(svelte.mapElementTag('..'),__sveltets_2_AnimationMove,(yyy))); + */ +function handleAnimateDirective(str, attr, element) { + const transformations = [ + '__sveltets_2_ensureAnimation(', + getDirectiveNameStartEndIdx(str, attr), + `(${element.typingsNamespace}.mapElementTag('${element.tagName}'),__sveltets_2_AnimationMove` + ]; + if (attr.expression) { + transformations.push(',(', rangeWithTrailingPropertyAccess(str.original, attr.expression), ')'); + } + transformations.push('));'); + element.appendToStartEnd(transformations); +} + +var svgAttributes = 'accent-height accumulate additive alignment-baseline allowReorder alphabetic amplitude arabic-form ascent attributeName attributeType autoReverse azimuth baseFrequency baseline-shift baseProfile bbox begin bias by calcMode cap-height class clip clipPathUnits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering contentScriptType contentStyleType cursor cx cy d decelerate descent diffuseConstant direction display divisor dominant-baseline dur dx dy edgeMode elevation enable-background end exponent externalResourcesRequired fill fill-opacity fill-rule filter filterRes filterUnits flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight format from fr fx fy g1 g2 glyph-name glyph-orientation-horizontal glyph-orientation-vertical glyphRef gradientTransform gradientUnits hanging height href horiz-adv-x horiz-origin-x id ideographic image-rendering in in2 intercept k k1 k2 k3 k4 kernelMatrix kernelUnitLength kerning keyPoints keySplines keyTimes lang lengthAdjust letter-spacing lighting-color limitingConeAngle local marker-end marker-mid marker-start markerHeight markerUnits markerWidth mask maskContentUnits maskUnits mathematical max media method min mode name numOctaves offset onabort onactivate onbegin onclick onend onerror onfocusin onfocusout onload onmousedown onmousemove onmouseout onmouseover onmouseup onrepeat onresize onscroll onunload opacity operator order orient orientation origin overflow overline-position overline-thickness panose-1 paint-order pathLength patternContentUnits patternTransform patternUnits pointer-events points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits r radius refX refY rendering-intent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry scale seed shape-rendering slope spacing specularConstant specularExponent speed spreadMethod startOffset stdDeviation stemh stemv stitchTiles stop-color stop-opacity strikethrough-position strikethrough-thickness string stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width style surfaceScale systemLanguage tabindex tableValues target targetX targetY text-anchor text-decoration text-rendering textLength to transform type u1 u2 underline-position underline-thickness unicode unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical values version vert-adv-y vert-origin-x vert-origin-y viewBox viewTarget visibility width widths word-spacing writing-mode x x-height x1 x2 xChannelSelector xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xml:lang xml:space y y1 y2 yChannelSelector z zoomAndPan'.split(' '); + +const IGNORE_START_COMMENT = '/*Ωignore_startΩ*/'; +const IGNORE_END_COMMENT = '/*Ωignore_endΩ*/'; +/** to tell tooling to ignore the character at this position; can for example be used to ignore everything starting at this position */ +const IGNORE_POSITION_COMMENT = '/*Ωignore_positionΩ*/'; +/** + * Surrounds given string with a start/end comment which marks it + * to be ignored by tooling. + */ +function surroundWithIgnoreComments(str) { + return IGNORE_START_COMMENT + str + IGNORE_END_COMMENT; +} + +const voidTags = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr'.split(','); +/** + * Handles HTML elements as well as svelte:options, svelte:head, svelte:window, svelte:body, svelte:element + * + * Children of this element should call the methods on this class to add themselves to the correct + * position within the transformation. + * + * The transformation result does not have anything to do with HTMLx, it instead uses plan JS, + * leveraging scoped blocks (`{ ... }`). Each element is transformed to something that is + * contained in such a block. This ensures we can declare variables inside that do not leak + * to the outside while preserving TypeScript's control flow. + * + * A transformation reads for example like this: + * ``` + * // before + *
    + * // after + * { const $$_div = __sveltets_2_createElement("div", {"class": foo,}); } + * ``` + */ +class Element { + get name() { + this.referencedName = true; + return this._name; + } + /** + * @param str The MagicString instance used to manipulate the text + * @param node The Svelte AST node that represents this element + * @param typingsNamespace Determines which namespace to use for the createElement function + * @param parent The Svelte AST parent node + */ + constructor(str, node, typingsNamespace, parent) { + this.str = str; + this.node = node; + this.typingsNamespace = typingsNamespace; + this.parent = parent; + this.startEndTransformation = ['});']; + this.attrsTransformation = []; + this.actionsTransformation = []; + this.actionIdentifiers = []; + this.endTransformation = []; + // Add const $$xxx = ... only if the variable name is actually used + // in order to prevent "$$xxx is defined but never used" TS hints + this.referencedName = false; + if (parent) { + parent.child = this; + } + this.tagName = this.node.name === 'svelte:body' ? 'body' : this.node.name; + this.isSelfclosing = this.computeIsSelfclosing(); + this.startTagStart = this.node.start; + this.startTagEnd = this.computeStartTagEnd(); + const tagEnd = this.startTagStart + this.node.name.length + 1; + // Ensure deleted characters are mapped to the attributes object so we + // get autocompletion when triggering it on a whitespace. + if (/\s/.test(str.original.charAt(tagEnd))) { + this.attrsTransformation.push(tagEnd); + this.attrsTransformation.push([tagEnd, tagEnd + 1]); + // Overwrite necessary or else we get really weird mappings + this.str.overwrite(tagEnd, tagEnd + 1, '', { contentOnly: true }); + } + switch (this.node.name) { + // Although not everything that is possible to add to Element + // is valid on the special svelte elements, + // we still also handle them here and let the Svelte parser handle invalid + // cases. For us it doesn't make a difference to a normal HTML element. + case 'svelte:options': + case 'svelte:head': + case 'svelte:window': + case 'svelte:body': + case 'svelte:fragment': { + // remove the colon: svelte:xxx -> sveltexxx + const nodeName = `svelte${this.node.name.substring(7)}`; + this._name = '$$_' + nodeName + this.computeDepth(); + break; + } + case 'svelte:element': { + this._name = '$$_svelteelement' + this.computeDepth(); + break; + } + case 'slot': { + this._name = '$$_slot' + this.computeDepth(); + break; + } + default: { + this._name = '$$_' + sanitizePropName(this.node.name) + this.computeDepth(); + break; + } + } + } + /** + * attribute={foo} --> "attribute": foo, + * @param name Attribute name + * @param value Attribute value, if present. If not present, this is treated as a shorthand attribute + */ + addAttribute(name, value) { + if (value) { + this.attrsTransformation.push(...name, ':', ...value, ','); + } + else { + this.attrsTransformation.push(...name, ','); + } + } + /** + * Handle the slot of `<... slot=".." />` + * @param transformation Slot name transformation + */ + addSlotName(transformation) { + this.slotLetsTransformation = this.slotLetsTransformation || [[], []]; + this.slotLetsTransformation[0] = transformation; + } + /** + * Handle the let: of `<... let:xx={yy} />` + * @param transformation Let transformation + */ + addSlotLet(transformation) { + this.slotLetsTransformation = this.slotLetsTransformation || [['default'], []]; + this.slotLetsTransformation[1].push(...transformation, ','); + } + addAction(attr) { + const id = `$$action_${this.actionIdentifiers.length}`; + this.actionIdentifiers.push(id); + if (!this.actionsTransformation.length) { + this.actionsTransformation.push('{'); + } + this.actionsTransformation.push(`const ${id} = __sveltets_2_ensureAction(`, getDirectiveNameStartEndIdx(this.str, attr), `(${this.typingsNamespace}.mapElementTag('${this.tagName}')`); + if (attr.expression) { + this.actionsTransformation.push(',(', rangeWithTrailingPropertyAccess(this.str.original, attr.expression), ')'); + } + this.actionsTransformation.push('));'); + } + /** + * Add something right after the start tag end. + */ + appendToStartEnd(value) { + this.startEndTransformation.push(...value); + } + performTransformation() { + this.endTransformation.push('}'); + const slotLetTransformation = []; + if (this.slotLetsTransformation) { + if (this.slotLetsTransformation[0][0] === 'default') { + slotLetTransformation.push( + // add dummy destructuring parameter because if all parameters are unused, + // the mapping will be confusing, because TS will highlight the whole destructuring + `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.parent.name}.$$slot_def.default;$$_$$;`); + } + else { + slotLetTransformation.push( + // See comment above + `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.parent.name}.$$slot_def["`, ...this.slotLetsTransformation[0], '"];$$_$$;'); + } + this.endTransformation.push('}'); + } + if (this.actionIdentifiers.length) { + this.endTransformation.push('}'); + } + if (this.isSelfclosing) { + transform(this.str, this.startTagStart, this.startTagEnd, [ + // Named slot transformations go first inside a outer block scope because + //
    means "use the x of let:x", and without a separate + // block scope this would give a "used before defined" error + ...slotLetTransformation, + ...this.actionsTransformation, + ...this.getStartTransformation(), + ...this.attrsTransformation, + ...this.startEndTransformation, + ...this.endTransformation + ]); + } + else { + transform(this.str, this.startTagStart, this.startTagEnd, [ + ...slotLetTransformation, + ...this.actionsTransformation, + ...this.getStartTransformation(), + ...this.attrsTransformation, + ...this.startEndTransformation + ]); + const tagEndIdx = this.str.original + .substring(this.node.start, this.node.end) + .lastIndexOf(`fooo

    anothertag

    ` + const endStart = tagEndIdx === -1 ? this.node.end : tagEndIdx + this.node.start; + transform(this.str, endStart, this.node.end, this.endTransformation); + } + } + getStartTransformation() { + var _a, _b; + const createElement = `${this.typingsNamespace}.createElement`; + const addActions = () => { + if (this.actionIdentifiers.length) { + return `, __sveltets_2_union(${this.actionIdentifiers.join(',')})`; + } + else { + return ''; + } + }; + let createElementStatement; + switch (this.node.name) { + // Although not everything that is possible to add to Element + // is valid on the special svelte elements, + // we still also handle them here and let the Svelte parser handle invalid + // cases. For us it doesn't make a difference to a normal HTML element. + case 'svelte:options': + case 'svelte:head': + case 'svelte:window': + case 'svelte:body': + case 'svelte:fragment': { + createElementStatement = [`${createElement}("${this.node.name}"${addActions()}, {`]; + break; + } + case 'svelte:element': { + const nodeName = this.node.tag + ? typeof this.node.tag !== 'string' + ? [this.node.tag.start, this.node.tag.end] + : `"${this.node.tag}"` + : '""'; + createElementStatement = [`${createElement}(`, nodeName, `${addActions()}, {`]; + break; + } + case 'slot': { + // If the element is a tag, create the element with the createSlot-function + // which is created inside createRenderFunction.ts to check that the name and attributes + // of the slot tag are correct. The check will error if the user defined $$Slots + // and the slot definition or its attributes contradict that type definition. + const slotName = ((_b = (_a = this.node.attributes) === null || _a === void 0 ? void 0 : _a.find((a) => a.name === 'name')) === null || _b === void 0 ? void 0 : _b.value[0]) || + 'default'; + createElementStatement = [ + '__sveltets_createSlot(', + typeof slotName === 'string' + ? `"${slotName}"` + : surroundWith(this.str, [slotName.start, slotName.end], '"', '"'), + ', {' + ]; + break; + } + default: { + createElementStatement = [ + `${createElement}("`, + [this.node.start + 1, this.node.start + 1 + this.node.name.length], + `"${addActions()}, {` + ]; + break; + } + } + if (this.referencedName) { + createElementStatement[0] = `const ${this._name} = ` + createElementStatement[0]; + } + createElementStatement[0] = `{ ${createElementStatement[0]}`; + return createElementStatement; + } + computeStartTagEnd() { + var _a; + if ((_a = this.node.children) === null || _a === void 0 ? void 0 : _a.length) { + return this.node.children[0].start; + } + return this.isSelfclosing + ? this.node.end + : this.str.original.lastIndexOf('>', this.node.end - 2) + 1; + } + computeIsSelfclosing() { + var _a; + if (this.str.original[this.node.end - 2] === '/' || voidTags.includes(this.node.name)) { + return true; + } + return (!((_a = this.node.children) === null || _a === void 0 ? void 0 : _a.length) && + // Paranoid check because theoretically there could be other void + // tags in different namespaces other than HTML + !this.str.original + .substring(this.node.start, this.node.end) + .match(new RegExp(`$`))); + } + computeDepth() { + let idx = 0; + let parent = this.parent; + while (parent) { + parent = parent.parent; + idx++; + } + return idx; + } +} + +/** + * Handles Svelte components as well as svelte:self and svelte:component + * + * Children of this element should call the methods on this class to add themselves to the correct + * position within the transformation. + * + * The transformation result does not have anything to do with HTMLx, it instead uses plan JS, + * leveraging scoped blocks (`{ ... }`). Each element is transformed to something that is + * contained in such a block. This ensures we can declare variables inside that do not leak + * to the outside while preserving TypeScript's control flow. + * + * A transformation reads for example like this: + * ``` + * // before + * + * // after + * { const $$_Comp = new Comp({ target: __sveltets_2_any(), props: {"prop": foo,}}); } + * ``` + */ +class InlineComponent { + get name() { + if (this.addNameConstDeclaration) { + this.addNameConstDeclaration(); + this.addNameConstDeclaration = undefined; + } + return this._name; + } + constructor(str, node, parent) { + this.str = str; + this.node = node; + this.parent = parent; + this.startTransformation = []; + this.startEndTransformation = []; + this.propsTransformation = []; + this.eventsTransformation = []; + this.snippetPropsTransformation = []; + this.endTransformation = []; + if (parent) { + parent.child = this; + } + this.isSelfclosing = this.computeIsSelfclosing(); + this.startTagStart = this.node.start; + this.startTagEnd = this.computeStartTagEnd(); + const tagEnd = this.startTagStart + this.node.name.length + 1; + // Ensure deleted characters are mapped to the attributes object so we + // get autocompletion when triggering it on a whitespace. + if (/\s/.test(str.original.charAt(tagEnd))) { + this.propsTransformation.push(tagEnd); + this.propsTransformation.push([tagEnd, tagEnd + 1]); + // Overwrite necessary or else we get really weird mappings + this.str.overwrite(tagEnd, tagEnd + 1, '', { contentOnly: true }); + } + if (this.node.name === 'svelte:self') { + // TODO try to get better typing here, maybe TS allows us to use the created class + // even if it's used in the function that is used to create it + this._name = '$$_svelteself' + this.computeDepth(); + this.startTransformation.push('{ __sveltets_2_createComponentAny({'); + this.addNameConstDeclaration = () => (this.startTransformation[0] = `{ const ${this._name} = __sveltets_2_createComponentAny({`); + this.startEndTransformation.push('});'); + } + else { + const isSvelteComponentTag = this.node.name === 'svelte:component'; + // We don't know if the thing we use to create the Svelte component with + // is actually a proper Svelte component, which would lead to errors + // when accessing things like $$prop_def. Therefore widen the type + // here, falling back to a any-typed component to ensure the user doesn't + // get weird followup-errors all over the place. The diagnostic error + // will be on the __sveltets_2_ensureComponent part, giving a more helpful message + // The name is reversed here so that when the component is undeclared, + // TypeScript won't suggest the undeclared variable to be a misspelling of the generated variable + this._name = + '$$_' + + Array.from(sanitizePropName(this.node.name)).reverse().join('') + + this.computeDepth(); + const constructorName = this._name + 'C'; + const nodeNameStart = isSvelteComponentTag + ? this.node.expression.start + : this.str.original.indexOf(this.node.name, this.node.start); + const nodeNameEnd = isSvelteComponentTag + ? this.node.expression.end + : nodeNameStart + this.node.name.length; + this.startTransformation.push(`{ const ${constructorName} = __sveltets_2_ensureComponent(`, [nodeNameStart, nodeNameEnd], `); new ${constructorName}({ target: __sveltets_2_any(), props: {`); + this.addNameConstDeclaration = () => (this.startTransformation[2] = `); const ${this._name} = new ${constructorName}({ target: __sveltets_2_any(), props: {`); + this.startEndTransformation.push('}});'); + } + } + /** + * prop={foo} --> "prop": foo, + * @param name Property name + * @param value Attribute value, if present. If not present, this is treated as a shorthand attribute + */ + addProp(name, value) { + if (value) { + this.propsTransformation.push(...name, ':', ...value, ','); + } + else { + this.propsTransformation.push(...name, ','); + } + } + /** + * on:click={xxx} --> $$_Component.$on("click", xxx) + * @param name Event name + * @param expression Event handler, if present + */ + addEvent([nameStart, nameEnd], expression) { + this.eventsTransformation.push(`${this.name}.$on(`, surroundWith(this.str, [nameStart, nameEnd], '"', '"'), ', ', expression ? expression : '() => {}', ');'); + } + /** + * Handle the slot of `<... slot=".." />` + * @param transformation Slot name transformation + */ + addSlotName(transformation) { + this.slotLetsTransformation = this.slotLetsTransformation || [[], []]; + this.slotLetsTransformation[0] = transformation; + } + /** + * Handle the let: of `<... let:xx={yy} />` + * @param transformation Let transformation + */ + addSlotLet(transformation) { + this.slotLetsTransformation = this.slotLetsTransformation || [['default'], []]; + this.slotLetsTransformation[1].push(...transformation, ','); + } + addImplicitSnippetProp(name, transforms) { + this.addProp([name], transforms); + this.snippetPropsTransformation.push(this.str.original.slice(name[0], name[1])); + } + /** + * Add something right after the start tag end. + */ + appendToStartEnd(value) { + this.startEndTransformation.push(...value); + } + performTransformation() { + var _a; + const namedSlotLetTransformation = []; + const defaultSlotLetTransformation = []; + if (this.slotLetsTransformation) { + if (this.slotLetsTransformation[0][0] === 'default') { + defaultSlotLetTransformation.push( + // add dummy destructuring parameter because if all parameters are unused, + // the mapping will be confusing, because TS will highlight the whole destructuring + `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.name}.$$slot_def.default;$$_$$;`); + } + else { + namedSlotLetTransformation.push( + // See comment above + `{const {${surroundWithIgnoreComments('$$_$$')},`, ...this.slotLetsTransformation[1], `} = ${this.parent.name}.$$slot_def["`, ...this.slotLetsTransformation[0], '"];$$_$$;'); + } + this.endTransformation.push('}'); + } + const snippetPropVariables = (_a = this.snippetPropsTransformation) === null || _a === void 0 ? void 0 : _a.join(', '); + const snippetPropVariablesDeclaration = snippetPropVariables + ? surroundWithIgnoreComments(`const {${snippetPropVariables}} = ${this.name}.$$prop_def;`) + : ''; + if (this.isSelfclosing) { + this.endTransformation.push('}'); + transform(this.str, this.startTagStart, this.startTagEnd, [ + // Named slot transformations go first inside a outer block scope because + // means "use the x of let:x", and without a separate + // block scope this would give a "used before defined" error + ...namedSlotLetTransformation, + ...this.startTransformation, + ...this.propsTransformation, + ...this.startEndTransformation, + ...this.eventsTransformation, + ...defaultSlotLetTransformation, + snippetPropVariablesDeclaration, + ...this.endTransformation + ]); + } + else { + let endStart = this.str.original + .substring(this.node.start, this.node.end) + .lastIndexOf(` -> Component} + this.endTransformation.push([endStart + 2, endStart + this.node.name.length + 2]); + } + this.endTransformation.push('}'); + transform(this.str, this.startTagStart, this.startTagEnd, [ + // See comment above why this goes first + ...namedSlotLetTransformation, + ...this.startTransformation, + ...this.propsTransformation, + ...this.startEndTransformation, + ...this.eventsTransformation, + snippetPropVariablesDeclaration, + ...defaultSlotLetTransformation + ]); + transform(this.str, endStart, this.node.end, this.endTransformation); + } + } + computeStartTagEnd() { + var _a; + if ((_a = this.node.children) === null || _a === void 0 ? void 0 : _a.length) { + return this.node.children[0].start; + } + return this.isSelfclosing + ? this.node.end + : this.str.original.lastIndexOf('>', this.node.end - 2) + 1; + } + computeIsSelfclosing() { + return this.str.original[this.node.end - 2] === '/'; + } + computeDepth() { + let idx = 0; + let parent = this.parent; + while (parent) { + parent = parent.parent; + idx++; + } + return idx; + } +} + +/** + * List taken from `elements.d.ts` in Svelte core by searching for all attributes of type `number | undefined | null`; + */ +const numberOnlyAttributes = new Set([ + 'aria-colcount', + 'aria-colindex', + 'aria-colspan', + 'aria-level', + 'aria-posinset', + 'aria-rowcount', + 'aria-rowindex', + 'aria-rowspan', + 'aria-setsize', + 'aria-valuemax', + 'aria-valuemin', + 'aria-valuenow', + 'results', + 'span', + 'marginheight', + 'marginwidth', + 'maxlength', + 'minlength', + 'currenttime', + 'defaultplaybackrate', + 'volume', + 'high', + 'low', + 'optimum', + 'start', + 'size', + 'border', + 'cols', + 'rows', + 'colspan', + 'rowspan', + 'tabindex' +]); +/** + * Handle various kinds of attributes and make them conform to being valid in context of a object definition + * - {x} ---> x + * - x="{..}" ---> x:.. + * - lowercase DOM attributes + * - multi-value handling + */ +function handleAttribute(str, attr, parent, preserveCase, svelte5Plus, element) { + if (parent.name === '!DOCTYPE' || + ['Style', 'Script'].includes(parent.type) || + (attr.name === 'name' && parent.type === 'Slot')) { + // - is already removed by now from MagicString + // - Don't handle script / style tag attributes (context or lang for example) + // - name=".." of tag is already handled in Element + return; + } + if (attr.name === 'slot' && + attributeValueIsOfType(attr.value, 'Text') && + element.parent instanceof InlineComponent) { + // - slot=".." in context of slots with let:xx is handled differently + element.addSlotName([[attr.value[0].start, attr.value[0].end]]); + return; + } + const addAttribute = element instanceof Element + ? (name, value) => { + if (attr.name.startsWith('data-') && !attr.name.startsWith('data-sveltekit-')) { + // any attribute prefixed with data- is valid, but we can't + // type that statically, so we need this workaround + name.unshift('...__sveltets_2_empty({'); + if (!value) { + value = ['__sveltets_2_any()']; + } + value.push('})'); + } + element.addAttribute(name, value); + } + : (name, value) => { + if (attr.name.startsWith('--')) { + // CSS custom properties are not part of the props + // definition, so wrap them to not get "--xx is invalid prop" errors + name.unshift('...__sveltets_2_cssProp({'); + if (!value) { + value = ['""']; + } + value.push('})'); + } + element.addProp(name, value); + }; + /** + * lowercase the attribute name to make it adhere to our intrinsic elements definition + */ + const transformAttributeCase = (name) => { + if (!preserveCase && + !svgAttributes.find((x) => x == name) && + !(element instanceof Element && element.tagName.includes('-')) && + !(svelte5Plus && name.startsWith('on'))) { + return name.toLowerCase(); + } + else { + return name; + } + }; + // Handle attribute name + const attributeName = []; + if (attributeValueIsOfType(attr.value, 'AttributeShorthand')) { + // For the attribute shorthand, the name will be the mapped part + let [start, end] = [attr.value[0].start, attr.value[0].end]; + if (start === end) { + // Loose parsing mode, we have an empty attribute value, e.g. {} + // For proper intellisense we need to make this a non-empty expression. + start--; + str.overwrite(start, end, ' ', { contentOnly: true }); + } + addAttribute([[start, end]]); + return; + } + else { + let name = element instanceof Element && parent.type === 'Element' + ? transformAttributeCase(attr.name) + : attr.name; + // surround with quotes because dashes or other invalid property characters could be part of the name + // Overwrite first char with "+char because TS will squiggle the whole "prop" including quotes when something is wrong + if (name !== attr.name) { + name = '"' + name; + str.overwrite(attr.start, attr.start + attr.name.length, name); + } + else { + str.overwrite(attr.start, attr.start + 1, '"' + str.original.charAt(attr.start), { + contentOnly: true + }); + } + attributeName.push([attr.start, attr.start + attr.name.length], '"'); + } + // Handle attribute value + const attributeValue = []; + if (attr.value === true) { + attributeValue.push('true'); + addAttribute(attributeName, attributeValue); + return; + } + if (attr.value.length == 0) { + // shouldn't happen + addAttribute(attributeName, ['""']); + return; + } + //handle single value + if (attr.value.length == 1) { + const attrVal = attr.value[0]; + if (attrVal.type == 'Text') { + // Handle the attr="" special case with a transformation that allows mapping of the position + if (attrVal.start === attrVal.end) { + addAttribute(attributeName, [[attrVal.start - 1, attrVal.end + 1]]); + return; + } + const lastCharIndex = attrVal.end - 1; + const hasBrackets = str.original[lastCharIndex] === '}' || + ((str.original[lastCharIndex] === '"' || str.original[lastCharIndex] === "'") && + str.original[lastCharIndex - 1] === '}'); + const needsNumberConversion = !hasBrackets && + parent.type === 'Element' && + numberOnlyAttributes.has(attr.name.toLowerCase()) && + !isNaN(attrVal.data); + const includesTemplateLiteralQuote = attrVal.data.includes('`'); + const quote = !includesTemplateLiteralQuote + ? '`' + : ['"', "'"].includes(str.original[attrVal.start - 1]) + ? str.original[attrVal.start - 1] + : '"'; + if (!needsNumberConversion) { + attributeValue.push(quote); + } + if (includesTemplateLiteralQuote && attrVal.data.split('\n').length > 1) { + // Multiline attribute value text which can't be wrapped in a template literal + // -> ensure it's still a valid transformation by transforming the actual line break + str.overwrite(attrVal.start, attrVal.end, attrVal.data.split('\n').join('\\n'), { + contentOnly: true + }); + } + attributeValue.push([attrVal.start, attrVal.end]); + if (!needsNumberConversion) { + attributeValue.push(quote); + } + addAttribute(attributeName, attributeValue); + } + else if (attrVal.type == 'MustacheTag') { + let [start, end] = rangeWithTrailingPropertyAccess(str.original, attrVal.expression); + if (start === end) { + // Loose parsing mode, we have an empty attribute value, e.g. attr={} + // For proper intellisense we need to make this a non-empty expression. + start--; + str.overwrite(start, end, ' ', { contentOnly: true }); + } + attributeValue.push([start, end]); + addAttribute(attributeName, attributeValue); + } + return; + } + // We have multiple attribute values, so we build a template string out of them. + for (const n of attr.value) { + if (n.type === 'MustacheTag') { + str.appendRight(n.start, '$'); + } + } + attributeValue.push('`', [attr.value[0].start, attr.value[attr.value.length - 1].end], '`'); + addAttribute(attributeName, attributeValue); +} +function attributeValueIsOfType(value, type) { + return value !== true && value.length == 1 && value[0].type == type; +} + +/** + * This needs to be called on the way out, not on the way on, when walking, + * because else the order of moves might get messed up with moves in + * the children. + * + * The await block consists of these blocks: + *- expression: the promise - has start and end + *- value: the result of the promise - has start and end + *- error: the error branch value - has start and end + *- pending: start/end of the pending block (if exists), with skip boolean + *- then: start/end of the then block (if exists), with skip boolean + *- catch: start/end of the catch block (if exists), with skip boolean + * + * Implementation note: + * As soon there's a `then` with a value, we transform that to + * `{const $$_value = foo; {const foo = await $$_value;..}}` because + * + * - `{#await foo then foo}` or `{#await foo}..{:then foo}..` is valid Svelte code + * - `{#await foo} {bar} {:then bar} {bar} {/await} is valid Svelte code` + * + * Both would throw "variable used before declaration" if we didn't do the + * transformation this way. + */ +function handleAwait(str, awaitBlock) { + var _a, _b; + const transforms = ['{ ']; + if (!awaitBlock.pending.skip) { + transforms.push([awaitBlock.pending.start, awaitBlock.pending.end]); + } + if (awaitBlock.error || !awaitBlock.catch.skip) { + transforms.push('try { '); + } + if (awaitBlock.value) { + transforms.push('const $$_value = '); + } + const expressionEnd = withTrailingPropertyAccess(str.original, awaitBlock.expression.end); + transforms.push('await (', [awaitBlock.expression.start, expressionEnd], ');'); + if (awaitBlock.value) { + transforms.push('{ const ', [awaitBlock.value.start, awaitBlock.value.end], ' = $$_value; '); + } + if (!awaitBlock.then.skip) { + if (awaitBlock.pending.skip) { + transforms.push([awaitBlock.then.start, awaitBlock.then.end]); + } + else if ((_a = awaitBlock.then.children) === null || _a === void 0 ? void 0 : _a.length) { + transforms.push([ + awaitBlock.then.children[0].start, + awaitBlock.then.children[awaitBlock.then.children.length - 1].end + ]); + } + } + if (awaitBlock.value) { + transforms.push('}'); + } + if (awaitBlock.error || !awaitBlock.catch.skip) { + transforms.push('} catch($$_e) { '); + if (awaitBlock.error) { + transforms.push('const ', [awaitBlock.error.start, awaitBlock.error.end], ' = __sveltets_2_any();'); + } + if (!awaitBlock.catch.skip && ((_b = awaitBlock.catch.children) === null || _b === void 0 ? void 0 : _b.length)) { + transforms.push([ + awaitBlock.catch.children[0].start, + awaitBlock.catch.children[awaitBlock.catch.children.length - 1].end + ]); + } + transforms.push('}'); + } + transforms.push('}'); + transform(str, awaitBlock.start, awaitBlock.end, transforms); +} + +/** + * List of binding names that are transformed to sth like `binding = variable`. + */ +const oneWayBindingAttributes = new Set([ + 'clientWidth', + 'clientHeight', + 'offsetWidth', + 'offsetHeight', + 'duration', + 'seeking', + 'ended', + 'readyState', + 'naturalWidth', + 'naturalHeight' +]); +/** + * List of binding names that are transformed to sth like `binding = variable as GeneratedCode`. + */ +const oneWayBindingAttributesNotOnElement = new Map([ + ['contentRect', 'DOMRectReadOnly'], + ['contentBoxSize', 'ResizeObserverSize[]'], + ['borderBoxSize', 'ResizeObserverSize[]'], + ['devicePixelContentBoxSize', 'ResizeObserverSize[]'], + // available on the element, but with a different type + ['buffered', "import('svelte/elements').SvelteMediaTimeRange[]"], + ['played', "import('svelte/elements').SvelteMediaTimeRange[]"], + ['seekable', "import('svelte/elements').SvelteMediaTimeRange[]"] +]); +const supportsBindThis = [ + 'InlineComponent', + 'Element', + 'Body', + 'Slot' // only valid for Web Components compile target +]; +/** + * Transform bind:xxx into something that conforms to JS/TS + */ +function handleBinding(str, attr, parent, element, preserveBind, isSvelte5Plus) { + const isGetSetBinding = attr.expression.type === 'SequenceExpression'; + if (!isGetSetBinding) { + // bind group on input + if (element instanceof Element && attr.name == 'group' && parent.name == 'input') { + // add reassignment to force TS to widen the type of the declaration (in case it's never reassigned anywhere else) + appendOneWayBinding(attr, ' = __sveltets_2_any(null)', element); + return; + } + // bind this + if (attr.name === 'this' && supportsBindThis.includes(parent.type)) { + // bind:this is effectively only works bottom up - the variable is updated by the element, not + // the other way round. So we check if the instance is assignable to the variable. + // Note: If the component unmounts (it's inside an if block, or svelte:component this={null}, + // the value becomes null, but we don't add it to the clause because it would introduce + // worse DX for the 99% use case, and because null !== undefined which others might use to type the declaration. + appendOneWayBinding(attr, ` = ${element.name}`, element); + return; + } + // one way binding + if (oneWayBindingAttributes.has(attr.name) && element instanceof Element) { + appendOneWayBinding(attr, `= ${element.name}.${attr.name}`, element); + return; + } + // one way binding whose property is not on the element + if (oneWayBindingAttributesNotOnElement.has(attr.name) && element instanceof Element) { + element.appendToStartEnd([ + [attr.expression.start, getEnd(attr.expression)], + `= ${surroundWithIgnoreComments(`null as ${oneWayBindingAttributesNotOnElement.get(attr.name)}`)};` + ]); + return; + } + // add reassignment to force TS to widen the type of the declaration (in case it's never reassigned anywhere else) + const expressionStr = str.original.substring(attr.expression.start, getEnd(attr.expression)); + element.appendToStartEnd([ + surroundWithIgnoreComments(`() => ${expressionStr} = __sveltets_2_any(null);`) + ]); + } + // other bindings which are transformed to normal attributes/props + const isShorthand = attr.expression.start === attr.start + 'bind:'.length; + const name = preserveBind && element instanceof Element + ? // HTML typings - preserve the bind: prefix + isShorthand + ? [`"${str.original.substring(attr.start, attr.end)}"`] + : ['"', [attr.start, str.original.lastIndexOf('=', attr.expression.start)], '"'] + : // Other typings - remove the bind: prefix + isShorthand + ? [[attr.expression.start, attr.expression.end]] + : [ + [ + attr.start + 'bind:'.length, + str.original.lastIndexOf('=', attr.expression.start) + ] + ]; + const [get, set] = isGetSetBinding ? attr.expression.expressions : []; + const value = isShorthand + ? preserveBind && element instanceof Element + ? [rangeWithTrailingPropertyAccess(str.original, attr.expression)] + : undefined + : isGetSetBinding + ? [ + '__sveltets_2_get_set_binding(', + [get.start, get.end], + ',', + rangeWithTrailingPropertyAccess(str.original, set), + ')' + ] + : [rangeWithTrailingPropertyAccess(str.original, attr.expression)]; + if (isSvelte5Plus && element instanceof InlineComponent) { + // To check if property is actually bindable + element.appendToStartEnd([`${element.name}.$$bindings = '${attr.name}';`]); + } + if (element instanceof Element) { + element.addAttribute(name, value); + } + else { + element.addProp(name, value); + } +} +function appendOneWayBinding(attr, assignment, element) { + const expression = attr.expression; + const end = getEnd(expression); + const hasTypeAnnotation = expression.typeAnnotation || isTypescriptNode(expression); + const array = [ + [expression.start, end], + assignment + (hasTypeAnnotation ? '' : ';') + ]; + if (hasTypeAnnotation) { + array.push([end, expression.end], ';'); + } + element.appendToStartEnd(array); +} + +/** + * class:xx={yyy} ---> yyy; + */ +function handleClassDirective(str, attr, element) { + element.appendToStartEnd([rangeWithTrailingPropertyAccess(str.original, attr.expression), ';']); +} + +/** + * Removes comment altogether as it's unimportant for the output + */ +function handleComment(str, node) { + str.overwrite(node.start, node.end, '', { contentOnly: true }); +} + +/** + * `{@const x = y}` --> `const x = y;` + * + * The transformation happens directly in-place. This is more strict than the + * Svelte compiler because the compiler moves all const declarations to the top. + * This transformation results in `x used before being defined` errors if someone + * uses a const variable before declaring it, which arguably is more helpful + * than what the Svelte compiler does. + */ +function handleConstTag(str, constTag) { + str.overwrite(constTag.start, constTag.expression.start, 'const '); + str.overwrite(withTrailingPropertyAccess(str.original, constTag.expression.end), constTag.end, ';'); +} + +/** + * {@debug a} ---> ;a; + * {@debug a, b} ---> ;a;b; + */ +function handleDebug(str, debugBlock) { + let cursor = debugBlock.start; + for (const identifier of debugBlock.identifiers) { + str.overwrite(cursor, identifier.start, ';', { contentOnly: true }); + cursor = identifier.end; + } + str.overwrite(cursor, debugBlock.end, ';', { contentOnly: true }); +} + +/** + * Transform #each into a for-of loop + * + * Implementation notes: + * - If code is + * `{#each items as items,i (key)}` + * then the transformation is + * `{ const $$_each = __sveltets_2_ensureArray(items); for (const items of $$_each) { let i = 0;key;`. + * Transform it this way because `{#each items as items}` is valid Svelte code, but the transformation + * `for(const items of items){..}` is invalid ("variable used before declaration"). Don't do the transformation + * like this everytime because `$$_each` could turn up in the auto completion. + * + * - The `ensureArray` method checks that only `ArrayLike` objects are passed to `#each`. + * `for (const ..)` wouldn't error in this case because it accepts any kind of iterable. + * + * - `{#each true, items as item}` is valid, we need to add braces around that expression, else + * `ensureArray` will error that there are more args than expected + */ +function handleEach(str, eachBlock) { + var _a, _b, _c; + const startEnd = str.original.indexOf('}', ((_a = eachBlock.key) === null || _a === void 0 ? void 0 : _a.end) || ((_b = eachBlock.context) === null || _b === void 0 ? void 0 : _b.end) || eachBlock.expression.end) + 1; + let transforms; + // {#each true, [1,2]} is valid but for (const x of true, [1,2]) is not if not wrapped with braces + const containsComma = str.original + .substring(eachBlock.expression.start, eachBlock.expression.end) + .includes(','); + const expressionEnd = getEnd(eachBlock.expression); + const contextEnd = eachBlock.context && getEnd(eachBlock.context); + const arrayAndItemVarTheSame = !!eachBlock.context && + str.original.substring(eachBlock.expression.start, expressionEnd) === + str.original.substring(eachBlock.context.start, contextEnd); + if (arrayAndItemVarTheSame) { + transforms = [ + `{ const $$_each = __sveltets_2_ensureArray(${containsComma ? '(' : ''}`, + [eachBlock.expression.start, eachBlock.expression.end], + `${containsComma ? ')' : ''}); for(let `, + [eachBlock.context.start, contextEnd], + ' of $$_each){' + ]; + } + else { + transforms = [ + 'for(let ', + eachBlock.context ? [eachBlock.context.start, contextEnd] : '$$each_item', + ` of __sveltets_2_ensureArray(${containsComma ? '(' : ''}`, + [eachBlock.expression.start, eachBlock.expression.end], + `${containsComma ? ')' : ''})){${eachBlock.context ? '' : '$$each_item;'}` + ]; + } + if (eachBlock.index) { + const indexStart = str.original.indexOf(eachBlock.index, ((_c = eachBlock.context) === null || _c === void 0 ? void 0 : _c.end) || eachBlock.expression.end); + const indexEnd = indexStart + eachBlock.index.length; + transforms.push('let ', [indexStart, indexEnd], ' = 1;'); + } + if (eachBlock.key) { + transforms.push([eachBlock.key.start, eachBlock.key.end], ';'); + } + transform(str, eachBlock.start, startEnd, transforms); + const endEach = str.original.lastIndexOf('{', eachBlock.end - 1); + // {/each} -> } or {:else} -> } + if (eachBlock.else) { + const elseEnd = str.original.lastIndexOf('}', eachBlock.else.start); + const elseStart = str.original.lastIndexOf('{', elseEnd); + str.overwrite(elseStart, elseEnd + 1, '}' + (arrayAndItemVarTheSame ? '}' : ''), { + contentOnly: true + }); + if (!isImplicitlyClosedBlock(endEach, eachBlock)) { + str.remove(endEach, eachBlock.end); + } + } + else { + const closing = '}' + (arrayAndItemVarTheSame ? '}' : ''); + if (isImplicitlyClosedBlock(endEach, eachBlock)) { + str.prependLeft(eachBlock.end, closing); + } + else { + str.overwrite(endEach, eachBlock.end, closing, { + contentOnly: true + }); + } + } +} + +/** + * Transform on:xxx={yyy} + * - For DOM elements: ---> onxxx: yyy, + * - For Svelte components/special elements: ---> componentInstance.$on("xxx", yyy)} + */ +function handleEventHandler(str, attr, element) { + const nameStart = str.original.indexOf(':', attr.start) + 1; + // If there's no expression, it's event bubbling (on:click) + const nameEnd = nameStart + attr.name.length; + if (element instanceof Element) { + // Prefix with "on:" for better mapping. + // Surround with quotes because event name could contain invalid prop chars. + surroundWith(str, [nameStart, nameEnd], '"on:', '"'); + element.addAttribute([[nameStart, nameEnd]], attr.expression + ? [rangeWithTrailingPropertyAccess(str.original, attr.expression)] + : ['undefined']); + } + else { + element.addEvent([nameStart, nameEnd], attr.expression + ? rangeWithTrailingPropertyAccess(str.original, attr.expression) + : undefined); + } +} + +/** + * Transforms #if and :else if to a regular if control block. + */ +function handleIf(str, ifBlock) { + if (ifBlock.elseif) { + // {:else if expr} --> } else if(expr) { + const start = str.original.lastIndexOf('{', ifBlock.expression.start); + str.overwrite(start, ifBlock.expression.start, '} else if ('); + } + else { + // {#if expr} --> if (expr){ + str.overwrite(ifBlock.start, ifBlock.expression.start, 'if('); + } + const expressionEnd = withTrailingPropertyAccess(str.original, ifBlock.expression.end); + const end = str.original.indexOf('}', expressionEnd); + str.overwrite(expressionEnd, end + 1, '){'); + const endif = str.original.lastIndexOf('{', ifBlock.end - 1); + if (isImplicitlyClosedBlock(endif, ifBlock)) { + str.prependLeft(ifBlock.end, '}'); + } + else { + // {/if} -> } + str.overwrite(endif, ifBlock.end, '}'); + } +} +/** + * {:else} ---> } else { + */ +function handleElse(str, elseBlock, parent) { + if (parent.type !== 'IfBlock') { + // This is the else branch of an #each block which is handled elsewhere + return; + } + const elseEnd = str.original.lastIndexOf('}', elseBlock.start); + const elseword = str.original.lastIndexOf(':else', elseEnd); + const elseStart = str.original.lastIndexOf('{', elseword); + str.overwrite(elseStart, elseStart + 1, '}'); + str.overwrite(elseEnd, elseEnd + 1, '{'); + const colon = str.original.indexOf(':', elseword); + str.remove(colon, colon + 1); +} + +/** + * {#key expr}content{/key} ---> expr; content + */ +function handleKey(str, keyBlock) { + // {#key expr} -> expr; + str.overwrite(keyBlock.start, keyBlock.expression.start, '', { contentOnly: true }); + const expressionEnd = withTrailingPropertyAccess(str.original, keyBlock.expression.end); + const end = str.original.indexOf('}', expressionEnd); + str.overwrite(expressionEnd, end + 1, '; '); + // {/key} -> + const endKey = str.original.lastIndexOf('{', keyBlock.end - 1); + if (!isImplicitlyClosedBlock(endKey, keyBlock)) { + str.overwrite(endKey, keyBlock.end, '', { contentOnly: true }); + } +} + +/** + * `let:foo={bar}` --> `foo:bar`, which becomes `const {foo:bar} = $$_parent.$$slotDef['slotName'];` + * @param node + * @param element + */ +function handleLet(str, node, parent, preserveCase, svelte5Plus, element) { + if (element instanceof InlineComponent) { + // let:xx belongs to either the default slot or a named slot, + // which is determined in Attribute.ts + addSlotLet(node, element); + } + else { + if (element.parent instanceof InlineComponent) { + // let:xx is on a HTML element and belongs to a (named slot of a parent component + addSlotLet(node, element); + } + else { + // let:xx is a regular HTML attribute (probably a mistake by the user) + handleAttribute(str, { + start: node.start, + end: node.end, + type: 'Attribute', + name: 'let:' + node.name, + value: node.expression + ? [ + { + type: 'MustacheTag', + start: node.expression.start, + end: node.expression.end, + expression: node.expression + } + ] + : true + }, parent, preserveCase, svelte5Plus, element); + } + } +} +function addSlotLet(node, element) { + const letTransformation = [ + [node.start + 'let:'.length, node.start + 'let:'.length + node.name.length] + ]; + if (node.expression) { + letTransformation.push(':', [node.expression.start, node.expression.end]); + } + element.addSlotLet(letTransformation); +} + +/** + * Handle mustache tags that are not part of attributes + * {a} --> a; + */ +function handleMustacheTag(str, node, parent) { + if (parent.type === 'Attribute' || parent.type === 'StyleDirective') { + // handled inside Attribute.ts / StyleDirective.ts + return; + } + str.overwrite(node.start, node.start + 1, '', { contentOnly: true }); + str.overwrite(node.end - 1, node.end, ';', { contentOnly: true }); +} + +/** + * {@html ...} ---> ...; + */ +function handleRawHtml(str, node) { + str.overwrite(node.start, node.expression.start, ' '); + str.overwrite(withTrailingPropertyAccess(str.original, node.expression.end), node.end, ';'); +} + +/** + * Handle spreaded attributes/props on elements/components by removing the braces. + * That way they can be added as a regular object spread. + * `{...xx}` -> `...x` + */ +function handleSpread(node, element) { + const transformation = [[node.start + 1, node.end - 1]]; + if (element instanceof Element) { + element.addAttribute(transformation); + } + else { + element.addProp(transformation); + } +} + +/** + * style:xx ---> __sveltets_2_ensureType(String, Number, xx); + * style:xx={yy} ---> __sveltets_2_ensureType(String, Number, yy); + * style:xx="yy" ---> __sveltets_2_ensureType(String, Number, "yy"); + * style:xx="a{b}" ---> __sveltets_2_ensureType(String, Number, `a${b}`); + */ +function handleStyleDirective(str, style, element) { + const htmlx = str.original; + const ensureType = '__sveltets_2_ensureType(String, Number, '; + if (style.value === true || style.value.length === 0) { + element.appendToStartEnd([ + ensureType, + [htmlx.indexOf(':', style.start) + 1, style.end], + ');' + ]); + return; + } + if (style.value.length > 1) { + // We have multiple attribute values, so we build a template string out of them. + for (const n of style.value) { + if (n.type === 'MustacheTag') { + str.appendRight(n.start, '$'); + } + } + element.appendToStartEnd([ + ensureType + '`', + [style.value[0].start, style.value[style.value.length - 1].end], + '`);' + ]); + return; + } + const styleVal = style.value[0]; + if (styleVal.type === 'Text') { + const quote = ['"', "'"].includes(str.original[styleVal.start - 1]) + ? str.original[styleVal.start - 1] + : '"'; + element.appendToStartEnd([ + `${ensureType}${quote}`, + [styleVal.start, styleVal.end], + `${quote});` + ]); + } + else { + // MustacheTag + element.appendToStartEnd([ensureType, [styleVal.start + 1, styleVal.end - 1], ');']); + } +} + +/** + * Handles a text node transformation. + * Removes everything except whitespace (for better visual output) when it's normal HTML text for example inside an element + * to not clutter up the output. For attributes it leaves the text as is. + */ +function handleText(str, node, parent) { + if (!node.data || parent.type === 'Attribute') { + return; + } + let replacement = node.data.replace(/\S/g, ''); + if (!replacement && node.data.length) { + // minimum of 1 whitespace which ensure hover or other things don't give weird results + // where for example you hover over a text and get a hover info about the containing tag. + replacement = ' '; + } + str.overwrite(node.start, node.end, replacement, { + contentOnly: true + }); +} + +/** + * transition|modifier:xxx(yyy) ---> __sveltets_2_ensureTransition(xxx(svelte.mapElementTag('..'),(yyy))); + */ +function handleTransitionDirective(str, attr, element) { + const transformations = [ + '__sveltets_2_ensureTransition(', + getDirectiveNameStartEndIdx(str, attr), + `(${element.typingsNamespace}.mapElementTag('${element.tagName}')` + ]; + if (attr.expression) { + transformations.push(',(', rangeWithTrailingPropertyAccess(str.original, attr.expression), ')'); + } + transformations.push('));'); + element.appendToStartEnd(transformations); +} + +/** + * Transform #snippet into a function + * + * ```html + * {#snippet foo(bar)} + * .. + * {/snippet} + * ``` + * --> if standalone: + * ```ts + * const foo = (bar) => { async () => { + * .. + * };return return __sveltets_2_any(0)}; + * ``` + * --> if slot prop: + * ```ts + * foo: (bar) => { + * .. + * } + * ``` + */ +function handleSnippet(str, snippetBlock, component) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + const isImplicitProp = component !== undefined; + const endSnippet = str.original.lastIndexOf('{', snippetBlock.end - 1); + const afterSnippet = isImplicitProp + ? `};return __sveltets_2_any(0)}` + : `};return __sveltets_2_any(0)};`; + if (isImplicitlyClosedBlock(endSnippet, snippetBlock)) { + str.prependLeft(snippetBlock.end, afterSnippet); + } + else { + str.overwrite(endSnippet, snippetBlock.end, afterSnippet, { + contentOnly: true + }); + } + const lastParameter = (_a = snippetBlock.parameters) === null || _a === void 0 ? void 0 : _a.at(-1); + const startEnd = str.original.indexOf('}', (_d = (_c = (_b = lastParameter === null || lastParameter === void 0 ? void 0 : lastParameter.typeAnnotation) === null || _b === void 0 ? void 0 : _b.end) !== null && _c !== void 0 ? _c : lastParameter === null || lastParameter === void 0 ? void 0 : lastParameter.end) !== null && _d !== void 0 ? _d : snippetBlock.expression.end) + 1; + let parameters; + if ((_e = snippetBlock.parameters) === null || _e === void 0 ? void 0 : _e.length) { + const firstParameter = snippetBlock.parameters[0]; + const start = (_h = (_g = (_f = firstParameter === null || firstParameter === void 0 ? void 0 : firstParameter.leadingComments) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.start) !== null && _h !== void 0 ? _h : firstParameter.start; + const end = (_k = (_j = lastParameter.typeAnnotation) === null || _j === void 0 ? void 0 : _j.end) !== null && _k !== void 0 ? _k : lastParameter.end; + parameters = [start, end]; + } + // inner async function for potential #await blocks + const afterParameters = ` => { async ()${IGNORE_POSITION_COMMENT} => {`; + if (isImplicitProp) { + /** Can happen in loose parsing mode, e.g. code is currently `{#snippet }` */ + const emptyId = snippetBlock.expression.start === snippetBlock.expression.end; + if (emptyId) { + // Give intellisense a way to map into the right position for implicit prop completion + str.overwrite(snippetBlock.start, snippetBlock.expression.start - 1, '', { + contentOnly: true + }); + str.overwrite(snippetBlock.expression.start - 1, snippetBlock.expression.start, ' ', { + contentOnly: true + }); + } + else { + str.overwrite(snippetBlock.start, snippetBlock.expression.start, '', { + contentOnly: true + }); + } + const transforms = ['(']; + if (parameters) { + transforms.push(parameters); + const [start, end] = parameters; + str.overwrite(snippetBlock.expression.end, start, '', { + contentOnly: true + }); + str.overwrite(end, startEnd, '', { contentOnly: true }); + } + else { + str.overwrite(snippetBlock.expression.end, startEnd, '', { contentOnly: true }); + } + transforms.push(')' + afterParameters); + transforms.push([startEnd, snippetBlock.end]); + if (component instanceof InlineComponent) { + component.addImplicitSnippetProp([snippetBlock.expression.start - (emptyId ? 1 : 0), snippetBlock.expression.end], transforms); + } + else { + component.addAttribute([[snippetBlock.expression.start - (emptyId ? 1 : 0), snippetBlock.expression.end]], transforms); + } + } + else { + const transforms = [ + 'const ', + [snippetBlock.expression.start, snippetBlock.expression.end], + IGNORE_POSITION_COMMENT, + ' = (' + ]; + if (parameters) { + transforms.push(parameters); + } + transforms.push(')', surroundWithIgnoreComments(`: ReturnType`), // shows up nicely preserved on hover, other alternatives don't + afterParameters); + transform(str, snippetBlock.start, startEnd, transforms); + } +} +function handleImplicitChildren(componentNode, component) { + var _a; + if (((_a = componentNode.children) === null || _a === void 0 ? void 0 : _a.length) === 0) { + return; + } + let hasSlot = false; + for (const child of componentNode.children) { + if (child.type === 'SvelteSelf' || + child.type === 'InlineComponent' || + child.type === 'Element' || + child.type === 'SlotTemplate') { + if (child.attributes.some((a) => { + var _a; + return a.type === 'Attribute' && + a.name === 'slot' && + ((_a = a.value[0]) === null || _a === void 0 ? void 0 : _a.data) !== 'default'; + })) { + continue; + } + } + if (child.type === 'Comment' || + child.type === 'Slot' || + (child.type === 'Text' && child.data.trim() === '')) { + continue; + } + if (child.type !== 'SnippetBlock') { + hasSlot = true; + break; + } + } + if (!hasSlot) { + return; + } + // it's enough to fake a children prop, we don't need to actually move the content inside (which would also reset control flow) + component.addProp(['children'], ['() => { return __sveltets_2_any(0); }']); +} +function hoistSnippetBlock(str, blockOrEl) { + var _a; + if (blockOrEl.type === 'InlineComponent' || blockOrEl.type === 'SvelteBoundary') { + // implicit props, handled in InlineComponent + return; + } + let targetPosition; + for (const node of (_a = blockOrEl.children) !== null && _a !== void 0 ? _a : []) { + if (node.type !== 'SnippetBlock') { + if (targetPosition === undefined && (node.type !== 'Text' || node.data.trim() !== '')) { + targetPosition = node.type === 'Text' ? node.end : node.start; + } + continue; + } + // already first + if (targetPosition === undefined) { + continue; + } + if (node.start === targetPosition) { + continue; + } + str.move(node.start, node.end, targetPosition); + } +} + +/** + * `{@render foo(x)}` --> `;foo(x);` + */ +function handleRenderTag(str, renderTag) { + str.overwrite(renderTag.start, renderTag.expression.start, ';__sveltets_2_ensureSnippet(', { + contentOnly: true + }); + str.overwrite(withTrailingPropertyAccess(str.original, renderTag.expression.end), renderTag.end, ');'); +} + +/** + * Add this tag to a HTML comment in a Svelte component and its contents will + * be added as a docstring in the resulting JSX for the component class. + */ +const COMPONENT_DOCUMENTATION_HTML_COMMENT_TAG = '@component'; +class ComponentDocumentation { + constructor() { + this.componentDocumentation = ''; + this.handleComment = (node) => { + if ('data' in node && + typeof node.data === 'string' && + node.data.includes(COMPONENT_DOCUMENTATION_HTML_COMMENT_TAG)) { + this.componentDocumentation = node.data + .replace(COMPONENT_DOCUMENTATION_HTML_COMMENT_TAG, '') + .trim(); + } + }; + } + getFormatted() { + if (!this.componentDocumentation) { + return ''; + } + if (!this.componentDocumentation.includes('\n')) { + return `/** ${this.componentDocumentation} */\n`; + } + const lines = dedent(this.componentDocumentation) + .split('\n') + .map((line) => ` *${line ? ` ${line}` : ''}`) + .join('\n'); + return `/**\n${lines}\n */\n`; + } +} + +let Scope$1 = class Scope { + constructor(parent) { + this.declared = new Set(); + this.parent = parent; + } + hasDefined(name) { + return this.declared.has(name) || (!!this.parent && this.parent.hasDefined(name)); + } +}; +class ScopeStack { + constructor() { + this.current = new Scope$1(); + } + push() { + this.current = new Scope$1(this.current); + } + pop() { + this.current = this.current.parent; + } +} + +function isMember$1(parent, prop) { + return parent.type == 'MemberExpression' && prop == 'property'; +} +function isObjectKey(parent, prop) { + return parent.type == 'Property' && prop == 'key'; +} +function isObjectValue(parent, prop) { + return parent.type == 'Property' && prop == 'value'; +} +function isObjectValueShortHand(property) { + const { value, key } = property; + return value && isIdentifier(value) && key.start === value.start && key.end == value.end; +} +function attributeValueIsString(attr) { + var _a; + return attr.value.length !== 1 || ((_a = attr.value[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Text'; +} +function isDestructuringPatterns(node) { + return node.type === 'ArrayPattern' || node.type === 'ObjectPattern'; +} +function isIdentifier(node) { + return node.type === 'Identifier'; +} +function getSlotName(child) { + var _a, _b; + const slot = (_a = child.attributes) === null || _a === void 0 ? void 0 : _a.find((a) => a.name == 'slot'); + return (_b = slot === null || slot === void 0 ? void 0 : slot.value) === null || _b === void 0 ? void 0 : _b[0].raw; +} + +const reservedNames = new Set(['$$props', '$$restProps', '$$slots']); +class Stores { + constructor(scope, isDeclaration) { + this.scope = scope; + this.isDeclaration = isDeclaration; + this.possibleStores = []; + } + handleDirective(node, str) { + if (this.notAStore(node.name) || this.isDeclaration.value) { + return; + } + const start = str.original.indexOf('$', node.start); + const end = start + node.name.length; + this.possibleStores.push({ + node: { type: 'Identifier', start, end, name: node.name }, + parent: { start: 0, end: 0, type: '' }, + scope: this.scope.current + }); + } + handleIdentifier(node, parent, prop) { + if (this.notAStore(node.name)) { + return; + } + //handle potential store + if (this.isDeclaration.value) { + if (isObjectKey(parent, prop)) { + return; + } + this.scope.current.declared.add(node.name); + } + else { + if (isMember$1(parent, prop) && !parent.computed) { + return; + } + if (isObjectKey(parent, prop)) { + return; + } + this.possibleStores.push({ node, parent, scope: this.scope.current }); + } + } + getStoreNames() { + const stores = this.possibleStores.filter(({ node, scope }) => { + const name = node.name; + // if variable starting with '$' was manually declared by the user, + // this isn't a store access. + return !scope.hasDefined(name); + }); + return stores.map(({ node }) => node.name.slice(1)); + } + notAStore(name) { + return name[0] !== '$' || reservedNames.has(name); + } +} + +class Scripts { + constructor(htmlxAst) { + this.htmlxAst = htmlxAst; + // All script tags, no matter at what level, are listed within the root children, because + // of the logic in htmlxparser.ts + // To get the top level scripts, filter out all those that are part of children's children. + // Those have another type ('Element' with name 'script'). + this.scriptTags = this.htmlxAst.children.filter((child) => child.type === 'Script'); + this.topLevelScripts = this.scriptTags; + } + checkIfElementIsScriptTag(node, parent) { + if (parent !== this.htmlxAst && node.name === 'script') { + this.topLevelScripts = this.topLevelScripts.filter((tag) => tag.start !== node.start || tag.end !== node.end); + } + } + checkIfContainsScriptTag(node) { + this.topLevelScripts = this.topLevelScripts.filter((tag) => !(node.start <= tag.start && node.end >= tag.end)); + } + getTopLevelScriptTags() { + let scriptTag = null; + let moduleScriptTag = null; + // should be 2 at most, one each, so using forEach is safe + this.topLevelScripts.forEach((tag) => { + if (tag.attributes && + tag.attributes.find((a) => (a.name == 'context' && + a.value.length == 1 && + a.value[0].raw == 'module') || + a.name === 'module')) { + moduleScriptTag = tag; + } + else { + scriptTag = tag; + } + }); + return { scriptTag, moduleScriptTag }; + } + blankOtherScriptTags(str) { + this.scriptTags + .filter((tag) => !this.topLevelScripts.includes(tag)) + .forEach((tag) => { + str.remove(tag.start, tag.end); + }); + } +} + +function isInterfaceOrTypeDeclaration(node) { + return ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node); +} +function findExportKeyword(node) { + var _a; + return ts.canHaveModifiers(node) + ? (_a = ts.getModifiers(node)) === null || _a === void 0 ? void 0 : _a.find((x) => x.kind == ts.SyntaxKind.ExportKeyword) + : undefined; +} +/** + * Node is like `bla = ...` or `{bla} = ...` or `[bla] = ...` + */ +function isAssignmentBinaryExpr(node) { + return (ts.isBinaryExpression(node) && + node.operatorToken.kind == ts.SyntaxKind.EqualsToken && + (ts.isIdentifier(node.left) || + ts.isObjectLiteralExpression(node.left) || + ts.isArrayLiteralExpression(node.left))); +} +/** + * Returns if node is like `$: bla = ...` or `$: ({bla} = ...)` or `$: [bla] = ...=` + */ +function getBinaryAssignmentExpr(node) { + if (ts.isExpressionStatement(node.statement)) { + if (isAssignmentBinaryExpr(node.statement.expression)) { + return node.statement.expression; + } + if (ts.isParenthesizedExpression(node.statement.expression) && + isAssignmentBinaryExpr(node.statement.expression.expression)) { + return node.statement.expression.expression; + } + } +} +/** + * Returns true if node is like `({bla} ..)` or `([bla] ...)` + */ +function isParenthesizedObjectOrArrayLiteralExpression(node) { + return (ts.isParenthesizedExpression(node) && + ts.isBinaryExpression(node.expression) && + (ts.isObjectLiteralExpression(node.expression.left) || + ts.isArrayLiteralExpression(node.expression.left))); +} +/** + * + * Adapted from https://github.com/Rich-Harris/periscopic/blob/d7a820b04e1f88b452313ab3e54771b352f0defb/src/index.ts#L150 + */ +function extractIdentifiers(node, identifiers = []) { + if (ts.isIdentifier(node)) { + identifiers.push(node); + } + else if (ts.isBindingElement(node)) { + extractIdentifiers(node.name, identifiers); + } + else if (isMember(node)) { + let object = node; + while (isMember(object)) { + object = object.expression; + } + if (ts.isIdentifier(object)) { + identifiers.push(object); + } + } + else if (ts.isArrayBindingPattern(node) || ts.isObjectBindingPattern(node)) { + node.elements.forEach((element) => { + extractIdentifiers(element, identifiers); + }); + } + else if (ts.isObjectLiteralExpression(node)) { + node.properties.forEach((child) => { + if (ts.isSpreadAssignment(child)) { + extractIdentifiers(child.expression, identifiers); + } + else if (ts.isShorthandPropertyAssignment(child)) { + // in ts Ast { a = 1 } and { a } are both ShorthandPropertyAssignment + extractIdentifiers(child.name, identifiers); + } + else if (ts.isPropertyAssignment(child)) { + // { a: b } + extractIdentifiers(child.initializer, identifiers); + } + }); + } + else if (ts.isArrayLiteralExpression(node)) { + node.elements.forEach((element) => { + if (ts.isSpreadElement(element)) { + extractIdentifiers(element, identifiers); + } + else { + extractIdentifiers(element, identifiers); + } + }); + } + else if (ts.isBinaryExpression(node)) { + extractIdentifiers(node.left, identifiers); + } + return identifiers; +} +function isMember(node) { + return ts.isElementAccessExpression(node) || ts.isPropertyAccessExpression(node); +} +/** + * Returns variable at given level with given name, + * if it is a variable declaration in the form of `const/let a = ..` + */ +function getVariableAtTopLevel(node, identifierName) { + for (const child of node.statements) { + if (ts.isVariableStatement(child)) { + const variable = child.declarationList.declarations.find((declaration) => ts.isIdentifier(declaration.name) && declaration.name.text === identifierName); + if (variable) { + return variable; + } + } + } +} +/** + * Get the leading multiline trivia doc of the node. + */ +function getLastLeadingDoc(node) { + var _a; + const nodeText = node.getFullText(); + const comments = (_a = ts + .getLeadingCommentRanges(nodeText, 0)) === null || _a === void 0 ? void 0 : _a.filter((c) => c.kind === ts.SyntaxKind.MultiLineCommentTrivia); + const comment = comments === null || comments === void 0 ? void 0 : comments[(comments === null || comments === void 0 ? void 0 : comments.length) - 1]; + if (comment) { + let commentText = nodeText.substring(comment.pos, comment.end); + const typedefTags = ts.getAllJSDocTagsOfKind(node, ts.SyntaxKind.JSDocTypedefTag); + typedefTags + .filter((tag) => tag.pos >= comment.pos) + .map((tag) => nodeText.substring(tag.pos, tag.end)) + .forEach((comment) => { + commentText = commentText.replace(comment, ''); + }); + return commentText; + } +} +/** + * Returns true if given identifier is not the property name of an aliased import. + * In other words: It is not `a` in `import {a as b} from ..` + */ +function isNotPropertyNameOfImport(identifier) { + return (!ts.isImportSpecifier(identifier.parent) || identifier.parent.propertyName !== identifier); +} +/** + * Extract the variable names that are assigned to out of a labeled statement. + */ +function getNamesFromLabeledStatement(node) { + var _a; + const leftHandSide = (_a = getBinaryAssignmentExpr(node)) === null || _a === void 0 ? void 0 : _a.left; + if (!leftHandSide) { + return []; + } + return (extractIdentifiers(leftHandSide) + .map((id) => id.text) + // svelte won't let you create a variable with $ prefix (reserved for stores) + .filter((name) => !name.startsWith('$'))); +} +/** + * move node to top of script so they appear outside our render function + */ +function moveNode(node, str, astOffset, scriptStart, sourceFile) { + var _a; + const scanner = ts.createScanner(sourceFile.languageVersion, + /*skipTrivia*/ false, sourceFile.languageVariant); + const comments = (_a = ts.getLeadingCommentRanges(node.getFullText(), 0)) !== null && _a !== void 0 ? _a : []; + if (!comments.some((comment) => comment.hasTrailingNewLine) && + isNewGroup(sourceFile, node, scanner)) { + str.appendRight(node.getStart() + astOffset, '\n'); + } + for (const comment of comments) { + const commentEnd = node.pos + comment.end + astOffset; + str.move(node.pos + comment.pos + astOffset, commentEnd, scriptStart + 1); + if (comment.hasTrailingNewLine) { + str.overwrite(commentEnd - 1, commentEnd, str.original[commentEnd - 1] + '\n'); + } + } + str.move(node.getStart() + astOffset, node.end + astOffset, scriptStart + 1); + //add in a \n + const originalEndChar = str.original[node.end + astOffset - 1]; + str.overwrite(node.end + astOffset - 1, node.end + astOffset, originalEndChar + '\n'); +} +/** + * adopted from https://github.com/microsoft/TypeScript/blob/6e0447fdf165b1cec9fc80802abcc15bd23a268f/src/services/organizeImports.ts#L111 + */ +function isNewGroup(sourceFile, topLevelImportDecl, scanner) { + const startPos = topLevelImportDecl.getFullStart(); + const endPos = topLevelImportDecl.getStart(); + scanner.setText(sourceFile.text, startPos, endPos - startPos); + let numberOfNewLines = 0; + while (scanner.getTokenPos() < endPos) { + const tokenKind = scanner.scan(); + if (tokenKind === ts.SyntaxKind.NewLineTrivia) { + numberOfNewLines++; + if (numberOfNewLines >= 2) { + return true; + } + } + } + return false; +} + +/** + * Get the constructor type of a component node + * @param node The component node to infer the this type from + * @param thisValue If node is svelte:component, you may pass the value + * of this={..} to use that instead of the more general componentType + */ +function getTypeForComponent(node) { + if (node.name === 'svelte:component' || node.name === 'svelte:self') { + return '__sveltets_1_componentType()'; + } + else { + return node.name; + } +} +function attributeStrValueAsJsExpression(attr) { + if (attr.value.length == 0) { + return "''"; //wut? + } + //handle single value + if (attr.value.length == 1) { + const attrVal = attr.value[0]; + if (attrVal.type == 'Text') { + return '"' + attrVal.raw + '"'; + } + } + // we have multiple attribute values, so we know we are building a string out of them. + // so return a dummy string, it will typecheck the same :) + return '"__svelte_ts_string"'; +} +function is$$SlotsDeclaration(node) { + return isInterfaceOrTypeDeclaration(node) && node.name.text === '$$Slots'; +} +class SlotHandler { + constructor(htmlx) { + this.htmlx = htmlx; + this.slots = new Map(); + this.resolved = new Map(); + this.resolvedExpression = new Map(); + } + resolve(identifierDef, initExpression, scope) { + let resolved = this.resolved.get(identifierDef); + if (resolved) { + return resolved; + } + resolved = this.getResolveExpressionStr(identifierDef, scope, initExpression); + if (resolved) { + this.resolved.set(identifierDef, resolved); + } + return resolved; + } + /** + * Returns a string which expresses the given identifier unpacked to + * the top level in order to express the slot types correctly later on. + * + * Example: {#each items as item} ---> __sveltets_2_unwrapArr(items) + */ + getResolveExpressionStr(identifierDef, scope, initExpression) { + const { name } = identifierDef; + const owner = scope.getOwner(name); + if ((owner === null || owner === void 0 ? void 0 : owner.type) === 'CatchBlock') { + return '__sveltets_2_any({})'; + } + // list.map(list => list.someProperty) + // initExpression's scope should the parent scope of identifier scope + else if ((owner === null || owner === void 0 ? void 0 : owner.type) === 'ThenBlock') { + const resolvedExpression = this.resolveExpression(initExpression, scope.parent); + return `__sveltets_2_unwrapPromiseLike(${resolvedExpression})`; + } + else if ((owner === null || owner === void 0 ? void 0 : owner.type) === 'EachBlock') { + const resolvedExpression = this.resolveExpression(initExpression, scope.parent); + return `__sveltets_2_unwrapArr(${resolvedExpression})`; + } + return null; + } + resolveDestructuringAssignment(destructuringNode, identifiers, initExpression, scope) { + const destructuring = this.htmlx.slice(destructuringNode.start, destructuringNode.end); + identifiers.forEach((identifier) => { + const resolved = this.getResolveExpressionStr(identifier, scope, initExpression); + if (resolved) { + this.resolved.set(identifier, `((${destructuring}) => ${identifier.name})(${resolved})`); + } + }); + } + resolveDestructuringAssignmentForLet(destructuringNode, identifiers, letNode, component, slotName) { + const destructuring = this.htmlx.slice(destructuringNode.start, destructuringNode.end); + identifiers.forEach((identifier) => { + const resolved = this.getResolveExpressionStrForLet(letNode, component, slotName); + this.resolved.set(identifier, `((${destructuring}) => ${identifier.name})(${resolved})`); + }); + } + getResolveExpressionStrForLet(letNode, component, slotName) { + return `${getSingleSlotDef(component, slotName)}.${letNode.name}`; + } + resolveLet(letNode, identifierDef, component, slotName) { + let resolved = this.resolved.get(identifierDef); + if (resolved) { + return resolved; + } + resolved = this.getResolveExpressionStrForLet(letNode, component, slotName); + this.resolved.set(identifierDef, resolved); + return resolved; + } + getSlotConsumerOfComponent(component) { + var _a; + let result = (_a = this.getLetNodes(component, 'default')) !== null && _a !== void 0 ? _a : []; + for (const child of component.children) { + const slotName = getSlotName(child); + if (slotName) { + const letNodes = this.getLetNodes(child, slotName); + if (letNodes === null || letNodes === void 0 ? void 0 : letNodes.length) { + result = result.concat(letNodes); + } + } + } + return result; + } + getLetNodes(child, slotName) { + var _a; + const letNodes = ((_a = child === null || child === void 0 ? void 0 : child.attributes) !== null && _a !== void 0 ? _a : []).filter((attr) => attr.type === 'Let'); + return letNodes === null || letNodes === void 0 ? void 0 : letNodes.map((letNode) => ({ + letNode, + slotName + })); + } + /** + * Resolves the slot expression to a string that can be used + * in the props-object in the return type of the render function + */ + resolveExpression(expression, scope) { + let resolved = this.resolvedExpression.get(expression); + if (resolved) { + return resolved; + } + const strForExpression = new MagicString(this.htmlx); + const identifiers = []; + const objectShortHands = []; + walk(expression, { + enter(node, parent, prop) { + if (node.type === 'Identifier') { + if (parent) { + if (isMember$1(parent, prop)) { + return; + } + if (isObjectKey(parent, prop)) { + return; + } + if (isObjectValue(parent, prop)) { + // { value } + if (isObjectValueShortHand(parent)) { + this.skip(); + objectShortHands.push(node); + return; + } + } + } + this.skip(); + identifiers.push(node); + } + } + }); + const getOverwrite = (name) => { + const init = scope.getInit(name); + return init ? this.resolved.get(init) : name; + }; + for (const identifier of objectShortHands) { + const { end, name } = identifier; + const value = getOverwrite(name); + strForExpression.appendLeft(end, `:${value}`); + } + for (const identifier of identifiers) { + const { start, end, name } = identifier; + const value = getOverwrite(name); + strForExpression.overwrite(start, end, value); + } + resolved = strForExpression.slice(expression.start, expression.end); + this.resolvedExpression.set(expression, resolved); + return resolved; + } + handleSlot(node, scope) { + var _a; + const nameAttr = node.attributes.find((a) => a.name == 'name'); + const slotName = nameAttr ? nameAttr.value[0].raw : 'default'; + //collect attributes + const attributes = new Map(); + for (const attr of node.attributes) { + if (attr.name == 'name') { + continue; + } + if (attr.type === 'Spread') { + const rawName = attr.expression.name; + const init = scope.getInit(rawName); + const name = init ? this.resolved.get(init) : rawName; + attributes.set(`__spread__${name}`, name); + } + if (!((_a = attr.value) === null || _a === void 0 ? void 0 : _a.length)) { + continue; + } + if (attributeValueIsString(attr)) { + attributes.set(attr.name, attributeStrValueAsJsExpression(attr)); + continue; + } + attributes.set(attr.name, this.resolveAttr(attr, scope)); + } + this.slots.set(slotName, attributes); + } + getSlotDef() { + return this.slots; + } + resolveAttr(attr, scope) { + const attrVal = attr.value[0]; + if (!attrVal) { + return null; + } + if (attrVal.type == 'AttributeShorthand') { + const { name } = attrVal.expression; + const init = scope.getInit(name); + const resolved = this.resolved.get(init); + return resolved !== null && resolved !== void 0 ? resolved : name; + } + if (attrVal.type == 'MustacheTag') { + return this.resolveExpression(attrVal.expression, scope); + } + throw Error('Unknown attribute value type:' + attrVal.type); + } +} +function getSingleSlotDef(componentNode, slotName) { + // In contrast to getSingleSlotDef in htmlx2jsx, use a simple instanceOf-transformation here. + // This means that if someone forwards a slot whose type can only be infered from the input properties + // because there's a generic relationship, then that slot type is of type any or unknown. + // This is a limitation which could be tackled later. The problem is that in contrast to the transformation + // in htmlx2jsx, we cannot know for sure that all properties we would generate the component with exist + // in this scope, some could have been generated through each/await blocks or other lets. + const componentType = getTypeForComponent(componentNode); + return `__sveltets_2_instanceOf(${componentType}).$$slot_def['${slotName}']`; +} + +/** + * adopted from https://github.com/sveltejs/svelte/blob/master/src/compiler/compile/nodes/shared/TemplateScope.ts + */ +class TemplateScope { + constructor(parent) { + this.owners = new Map(); + this.inits = new Map(); + this.parent = parent; + this.names = new Set(parent ? parent.names : []); + } + addMany(inits, owner) { + inits.forEach((item) => this.add(item, owner)); + return this; + } + add(init, owner) { + const { name } = init; + this.names.add(name); + this.inits.set(name, init); + this.owners.set(name, owner); + return this; + } + child() { + const child = new TemplateScope(this); + return child; + } + getOwner(name) { + var _a; + return this.owners.get(name) || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.getOwner(name)); + } + getInit(name) { + var _a; + return this.inits.get(name) || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.getInit(name)); + } + isLet(name) { + const owner = this.getOwner(name); + return owner && (owner.type === 'Element' || owner.type === 'InlineComponent'); + } +} + +function isReference(node, parent) { + if (node.type === 'MemberExpression') { + return !node.computed && isReference(node.object, node); + } + if (node.type === 'Identifier') { + if (!parent) + return true; + switch (parent.type) { + // disregard `bar` in `foo.bar` + case 'MemberExpression': return parent.computed || node === parent.object; + // disregard the `foo` in `class {foo(){}}` but keep it in `class {[foo](){}}` + case 'MethodDefinition': return parent.computed; + // disregard the `foo` in `class {foo=bar}` but keep it in `class {[foo]=bar}` and `class {bar=foo}` + case 'FieldDefinition': return parent.computed || node === parent.value; + // disregard the `bar` in `{ bar: foo }`, but keep it in `{ [bar]: foo }` + case 'Property': return parent.computed || node === parent.value; + // disregard the `bar` in `export { foo as bar }` or + // the foo in `import { foo as bar }` + case 'ExportSpecifier': + case 'ImportSpecifier': return node === parent.local; + // disregard the `foo` in `foo: while (...) { ... break foo; ... continue foo;}` + case 'LabeledStatement': + case 'BreakStatement': + case 'ContinueStatement': return false; + default: return true; + } + } + return false; +} + +// @ts-check + +/** @typedef { import('estree').Node} Node */ +/** @typedef { import('estree').VariableDeclaration} VariableDeclaration */ +/** @typedef { import('estree').ClassDeclaration} ClassDeclaration */ +/** @typedef { import('estree').VariableDeclarator} VariableDeclarator */ +/** @typedef { import('estree').Property} Property */ +/** @typedef { import('estree').RestElement} RestElement */ +/** @typedef { import('estree').Identifier} Identifier */ + +/** + * + * @param {Node} expression + */ +function analyze(expression) { + /** @type {WeakMap} */ + const map = new WeakMap(); + + /** @type {Map} */ + const globals = new Map(); + + const scope = new Scope(null, false); + + /** @type {[Scope, Identifier][]} */ + const references = []; + let current_scope = scope; + + walk(expression, { + /** + * + * @param {Node} node + * @param {Node} parent + */ + enter(node, parent) { + switch (node.type) { + case 'Identifier': + if (isReference(node, parent)) { + references.push([current_scope, node]); + } + break; + + case 'ImportDeclaration': + node.specifiers.forEach((specifier) => { + current_scope.declarations.set(specifier.local.name, specifier); + }); + break; + + case 'FunctionExpression': + case 'FunctionDeclaration': + case 'ArrowFunctionExpression': + if (node.type === 'FunctionDeclaration') { + if (node.id) { + current_scope.declarations.set(node.id.name, node); + } + + map.set(node, current_scope = new Scope(current_scope, false)); + } else { + map.set(node, current_scope = new Scope(current_scope, false)); + + if (node.type === 'FunctionExpression' && node.id) { + current_scope.declarations.set(node.id.name, node); + } + } + + node.params.forEach(param => { + extract_names(param).forEach(name => { + current_scope.declarations.set(name, node); + }); + }); + break; + + case 'ForStatement': + case 'ForInStatement': + case 'ForOfStatement': + map.set(node, current_scope = new Scope(current_scope, true)); + break; + + case 'BlockStatement': + map.set(node, current_scope = new Scope(current_scope, true)); + break; + + case 'ClassDeclaration': + case 'VariableDeclaration': + current_scope.add_declaration(node); + break; + + case 'CatchClause': + map.set(node, current_scope = new Scope(current_scope, true)); + + if (node.param) { + extract_names(node.param).forEach(name => { + current_scope.declarations.set(name, node.param); + }); + } + break; + } + }, + + /** + * + * @param {Node} node + */ + leave(node) { + if (map.has(node)) { + current_scope = current_scope.parent; + } + } + }); + + for (let i = references.length - 1; i >= 0; --i) { + const [scope, reference] = references[i]; + + if (!scope.references.has(reference.name)) { + add_reference(scope, reference.name); + + if (!scope.find_owner(reference.name)) { + globals.set(reference.name, reference); + } + } + } + + return { map, scope, globals }; +} + +/** + * + * @param {Scope} scope + * @param {string} name + */ +function add_reference(scope, name) { + scope.references.add(name); + if (scope.parent) add_reference(scope.parent, name); +} + +class Scope { + constructor(parent, block) { + /** @type {Scope | null} */ + this.parent = parent; + + /** @type {boolean} */ + this.block = block; + + /** @type {Map} */ + this.declarations = new Map(); + + /** @type {Set} */ + this.initialised_declarations = new Set(); + + /** @type {Set} */ + this.references = new Set(); + } + + /** + * + * @param {VariableDeclaration | ClassDeclaration} node + */ + add_declaration(node) { + if (node.type === 'VariableDeclaration') { + if (node.kind === 'var' && this.block && this.parent) { + this.parent.add_declaration(node); + } else { + /** + * + * @param {VariableDeclarator} declarator + */ + const handle_declarator = (declarator) => { + extract_names(declarator.id).forEach(name => { + this.declarations.set(name, node); + if (declarator.init) this.initialised_declarations.add(name); + }); }; + + node.declarations.forEach(handle_declarator); + } + } else if (node.id) { + this.declarations.set(node.id.name, node); + } + } + + /** + * + * @param {string} name + * @returns {Scope | null} + */ + find_owner(name) { + if (this.declarations.has(name)) return this; + return this.parent && this.parent.find_owner(name); + } + + /** + * + * @param {string} name + * @returns {boolean} + */ + has(name) { + return ( + this.declarations.has(name) || (!!this.parent && this.parent.has(name)) + ); + } +} + +/** + * + * @param {Node} param + * @returns {string[]} + */ +function extract_names(param) { + return extract_identifiers(param).map(node => node.name); +} + +/** + * + * @param {Node} param + * @param {Identifier[]} nodes + * @returns {Identifier[]} + */ +function extract_identifiers(param, nodes = []) { + switch (param.type) { + case 'Identifier': + nodes.push(param); + break; + + case 'MemberExpression': + let object = param; + while (object.type === 'MemberExpression') { + object = /** @type {any} */ (object.object); + } + nodes.push(/** @type {any} */ (object)); + break; + + case 'ObjectPattern': + /** + * + * @param {Property | RestElement} prop + */ + const handle_prop = (prop) => { + if (prop.type === 'RestElement') { + extract_identifiers(prop.argument, nodes); + } else { + extract_identifiers(prop.value, nodes); + } + }; + + param.properties.forEach(handle_prop); + break; + + case 'ArrayPattern': + /** + * + * @param {Node} element + */ + const handle_element = (element) => { + if (element) extract_identifiers(element, nodes); + }; + + param.elements.forEach(handle_element); + break; + + case 'RestElement': + extract_identifiers(param.argument, nodes); + break; + + case 'AssignmentPattern': + extract_identifiers(param.left, nodes); + break; + } + + return nodes; +} + +function handleScopeAndResolveForSlot({ identifierDef, initExpression, owner, slotHandler, templateScope }) { + if (isIdentifier(identifierDef)) { + templateScope.add(identifierDef, owner); + slotHandler.resolve(identifierDef, initExpression, templateScope); + } + if (isDestructuringPatterns(identifierDef)) { + // the node object is returned as-it with no mutation + const identifiers = extract_identifiers(identifierDef); + templateScope.addMany(identifiers, owner); + slotHandler.resolveDestructuringAssignment(identifierDef, identifiers, initExpression, templateScope); + } +} +function handleScopeAndResolveLetVarForSlot({ letNode, component, slotName, templateScope, slotHandler }) { + const { expression } = letNode; + // + if (!expression) { + templateScope.add(letNode, component); + slotHandler.resolveLet(letNode, letNode, component, slotName); + } + else { + if (isIdentifier(expression)) { + templateScope.add(expression, component); + slotHandler.resolveLet(letNode, expression, component, slotName); + } + const expForExtract = { ...expression }; + // https://github.com/sveltejs/svelte/blob/3a37de364bfbe75202d8e9fcef9e76b9ce6faaa2/src/compiler/compile/nodes/Let.ts#L37 + if (expression.type === 'ArrayExpression') { + expForExtract.type = 'ArrayPattern'; + } + else if (expression.type === 'ObjectExpression') { + expForExtract.type = 'ObjectPattern'; + } + if (isDestructuringPatterns(expForExtract)) { + const identifiers = extract_identifiers(expForExtract); + templateScope.addMany(identifiers, component); + slotHandler.resolveDestructuringAssignmentForLet(expForExtract, identifiers, letNode, component, slotName); + } + } +} + +class EventHandler { + constructor() { + this.bubbledEvents = new Map(); + this.callees = []; + } + handleEventHandler(node, parent) { + const eventName = node.name; + // pass-through/ bubble + if (!node.expression) { + if (parent.type === 'InlineComponent') { + if (parent.name !== 'svelte:self') { + this.handleEventHandlerBubble(parent, eventName); + } + return; + } + this.bubbledEvents.set(eventName, getEventDefExpressionForNonComponent(eventName, parent)); + } + } + handleIdentifier(node, parent, prop) { + if (prop === 'callee') { + this.callees.push({ name: node.name, parent }); + } + } + getBubbledEvents() { + return this.bubbledEvents; + } + getDispatchedEventsForIdentifier(name) { + const eventNames = new Set(); + this.callees.forEach((callee) => { + if (callee.name === name) { + const [name] = callee.parent.arguments; + if (name.value !== undefined) { + eventNames.add(name.value); + } + } + }); + return eventNames; + } + bubbledEventsAsStrings() { + return Array.from(this.bubbledEvents.entries()).map(eventMapEntryToString); + } + handleEventHandlerBubble(parent, eventName) { + const componentEventDef = `__sveltets_2_instanceOf(${parent.name})`; + const exp = `__sveltets_2_bubbleEventDef(${componentEventDef}.$$events_def, '${eventName}')`; + const exist = this.bubbledEvents.get(eventName); + this.bubbledEvents.set(eventName, exist ? [].concat(exist, exp) : exp); + } +} +function getEventDefExpressionForNonComponent(eventName, ele) { + switch (ele.type) { + case 'Element': + return `__sveltets_2_mapElementEvent('${eventName}')`; + case 'Body': + return `__sveltets_2_mapBodyEvent('${eventName}')`; + case 'Window': + return `__sveltets_2_mapWindowEvent('${eventName}')`; + } +} +function eventMapEntryToString([eventName, expression]) { + return `'${eventName}':${Array.isArray(expression) ? `__sveltets_2_unionType(${expression.join(',')})` : expression}`; +} + +function is$$EventsDeclaration(node) { + return isInterfaceOrTypeDeclaration(node) && node.name.text === '$$Events'; +} +/** + * This class accumulates all events that are dispatched from the component. + * It also tracks bubbled/forwarded events. + * + * It can not track events which are not fired through a variable + * which was not instantiated within the component with `createEventDispatcher`. + * This means that event dispatchers which are defined outside of the component and then imported do not get picked up. + * + * The logic is as follows: + * - If there exists a ComponentEvents interface definition, use that and skip the rest + * - Else first try to find the `createEventDispatcher` import + * - If it exists, try to find the variables where `createEventDispatcher()` is assigned to + * - For each variable found, try to find out if it's typed. + * - If yes, extract the event names and the event types from it + * - If no, track all invocations of it to get the event names + */ +class ComponentEvents { + get eventsClass() { + return this.componentEventsInterface.isPresent() + ? this.componentEventsInterface + : this.componentEventsFromEventsMap; + } + constructor(eventHandler, strictEvents, str) { + this.strictEvents = strictEvents; + this.str = str; + this.componentEventsInterface = new ComponentEventsFromInterface(); + this.componentEventsFromEventsMap = new ComponentEventsFromEventsMap(eventHandler); + } + /** + * Collect state and create the API which will be part + * of the return object of the `svelte2tsx` function. + */ + createAPI() { + const entries = []; + const iterableEntries = this.eventsClass.events.entries(); + for (const entry of iterableEntries) { + entries.push({ name: entry[0], ...entry[1] }); + } + return { + getAll() { + return entries; + } + }; + } + toDefString() { + return this.eventsClass.toDefString(); + } + setComponentEventsInterface(node, astOffset) { + this.componentEventsInterface.setComponentEventsInterface(node, this.str, astOffset); + } + hasEvents() { + return this.eventsClass.events.size > 0; + } + hasStrictEvents() { + return this.componentEventsInterface.isPresent() || this.strictEvents; + } + checkIfImportIsEventDispatcher(node) { + this.componentEventsFromEventsMap.checkIfImportIsEventDispatcher(node); + this.componentEventsInterface.checkIfImportIsEventDispatcher(node); + } + checkIfIsStringLiteralDeclaration(node) { + this.componentEventsFromEventsMap.checkIfIsStringLiteralDeclaration(node); + } + checkIfDeclarationInstantiatedEventDispatcher(node) { + this.componentEventsFromEventsMap.checkIfDeclarationInstantiatedEventDispatcher(node); + this.componentEventsInterface.checkIfDeclarationInstantiatedEventDispatcher(node); + } + checkIfCallExpressionIsDispatch(node) { + this.componentEventsFromEventsMap.checkIfCallExpressionIsDispatch(node); + } +} +class ComponentEventsFromInterface { + constructor() { + this.events = new Map(); + this.eventDispatcherImport = ''; + } + setComponentEventsInterface(node, str, astOffset) { + this.str = str; + this.astOffset = astOffset; + this.events = this.extractEvents(node); + } + checkIfImportIsEventDispatcher(node) { + if (this.eventDispatcherImport) { + return; + } + this.eventDispatcherImport = checkIfImportIsEventDispatcher(node); + } + checkIfDeclarationInstantiatedEventDispatcher(node) { + if (!this.isPresent()) { + return; + } + const result = checkIfDeclarationInstantiatedEventDispatcher(node, this.eventDispatcherImport); + if (!result) { + return; + } + const { dispatcherTyping, dispatcherCreationExpr } = result; + if (!dispatcherTyping) { + this.str.prependLeft(dispatcherCreationExpr.expression.getEnd() + this.astOffset, '<__sveltets_2_CustomEvents<$$Events>>'); + } + } + toDefString() { + return this.isPresent() ? '{} as unknown as $$Events' : undefined; + } + isPresent() { + return !!this.str; + } + extractEvents(node) { + const map = new Map(); + if (ts.isInterfaceDeclaration(node)) { + this.extractProperties(node.members, map); + } + else { + if (ts.isTypeLiteralNode(node.type)) { + this.extractProperties(node.type.members, map); + } + else if (ts.isIntersectionTypeNode(node.type)) { + node.type.types.forEach((type) => { + if (ts.isTypeLiteralNode(type)) { + this.extractProperties(type.members, map); + } + }); + } + } + return map; + } + extractProperties(members, map) { + members.filter(ts.isPropertySignature).forEach((member) => { + var _a; + map.set(getName(member.name), { + type: ((_a = member.type) === null || _a === void 0 ? void 0 : _a.getText()) || 'Event', + doc: getDoc(member) + }); + }); + } +} +class ComponentEventsFromEventsMap { + constructor(eventHandler) { + this.eventHandler = eventHandler; + this.events = new Map(); + this.dispatchedEvents = new Set(); + this.stringVars = new Map(); + this.eventDispatcherImport = ''; + this.eventDispatchers = []; + this.events = this.extractEvents(eventHandler); + } + checkIfImportIsEventDispatcher(node) { + if (this.eventDispatcherImport) { + return; + } + this.eventDispatcherImport = checkIfImportIsEventDispatcher(node); + } + checkIfIsStringLiteralDeclaration(node) { + if (ts.isIdentifier(node.name) && + node.initializer && + ts.isStringLiteral(node.initializer)) { + this.stringVars.set(node.name.text, node.initializer.text); + } + } + checkIfDeclarationInstantiatedEventDispatcher(node) { + const result = checkIfDeclarationInstantiatedEventDispatcher(node, this.eventDispatcherImport); + if (!result) { + return; + } + const { dispatcherTyping, dispatcherName } = result; + if (dispatcherTyping) { + this.eventDispatchers.push({ + name: dispatcherName, + typing: dispatcherTyping.getText() + }); + if (ts.isTypeLiteralNode(dispatcherTyping)) { + dispatcherTyping.members.filter(ts.isPropertySignature).forEach((member) => { + var _a; + this.addToEvents(getName(member.name), { + type: `CustomEvent<${((_a = member.type) === null || _a === void 0 ? void 0 : _a.getText()) || 'any'}>`, + doc: getDoc(member) + }); + }); + } + } + else { + this.eventDispatchers.push({ name: dispatcherName }); + this.eventHandler + .getDispatchedEventsForIdentifier(dispatcherName) + .forEach((evtName) => { + this.addToEvents(evtName); + this.dispatchedEvents.add(evtName); + }); + } + } + checkIfCallExpressionIsDispatch(node) { + if (this.eventDispatchers.some((dispatcher) => !dispatcher.typing && + ts.isIdentifier(node.expression) && + node.expression.text === dispatcher.name)) { + const firstArg = node.arguments[0]; + if (ts.isStringLiteral(firstArg)) { + this.addToEvents(firstArg.text); + this.dispatchedEvents.add(firstArg.text); + } + else if (ts.isIdentifier(firstArg)) { + const str = this.stringVars.get(firstArg.text); + if (str) { + this.addToEvents(str); + this.dispatchedEvents.add(str); + } + } + } + } + addToEvents(eventName, info = { type: 'CustomEvent' }) { + if (this.events.has(eventName)) { + // If there are multiple definitions, merge them by falling back to any-typing + this.events.set(eventName, { type: 'CustomEvent' }); + this.dispatchedEvents.add(eventName); + } + else { + this.events.set(eventName, info); + } + } + toDefString() { + return ('{' + + [ + ...this.eventDispatchers + .map((dispatcher) => dispatcher.typing && + `...__sveltets_2_toEventTypings<${dispatcher.typing}>()`) + .filter((str) => !!str), + ...this.eventHandler.bubbledEventsAsStrings(), + ...[...this.dispatchedEvents.keys()].map((e) => `'${e}': __sveltets_2_customEvent`) + ].join(', ') + + '}'); + } + extractEvents(eventHandler) { + const map = new Map(); + for (const name of eventHandler.getBubbledEvents().keys()) { + map.set(name, { type: 'Event' }); + } + return map; + } +} +function getName(prop) { + if (ts.isIdentifier(prop) || ts.isStringLiteral(prop)) { + return prop.text; + } + if (ts.isComputedPropertyName(prop)) { + if (ts.isIdentifier(prop.expression)) { + const identifierName = prop.expression.text; + const identifierValue = getIdentifierValue(prop, identifierName); + if (!identifierValue) { + throwError$1(prop); + } + return identifierValue; + } + } + throwError$1(prop); +} +function getIdentifierValue(prop, identifierName) { + const variable = getVariableAtTopLevel(prop.getSourceFile(), identifierName); + if (variable && ts.isStringLiteral(variable.initializer)) { + return variable.initializer.text; + } +} +function throwError$1(prop) { + const error = new Error('The ComponentEvents interface can only have properties of type ' + + 'Identifier, StringLiteral or ComputedPropertyName. ' + + 'In case of ComputedPropertyName, ' + + 'it must be a const declared within the component and initialized with a string.'); + error.start = toLineColumn(prop.getStart()); + error.end = toLineColumn(prop.getEnd()); + throw error; + function toLineColumn(pos) { + const lineChar = prop.getSourceFile().getLineAndCharacterOfPosition(pos); + return { + line: lineChar.line + 1, + column: lineChar.character + }; + } +} +function getDoc(member) { + let doc = undefined; + const comment = getLastLeadingDoc(member); + if (comment) { + doc = comment + .split('\n') + .map((line) => + // Remove /** */ + line + .replace(/\s*\/\*\*/, '') + .replace(/\s*\*\//, '') + .replace(/\s*\*/, '') + .trim()) + .join('\n'); + } + return doc; +} +function checkIfImportIsEventDispatcher(node) { + var _a; + if (ts.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text !== 'svelte') { + return; + } + const namedImports = (_a = node.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings; + if (namedImports && ts.isNamedImports(namedImports)) { + const eventDispatcherImport = namedImports.elements.find( + // If it's an aliased import, propertyName is set + (el) => (el.propertyName || el.name).text === 'createEventDispatcher'); + if (eventDispatcherImport) { + return eventDispatcherImport.name.text; + } + } +} +function checkIfDeclarationInstantiatedEventDispatcher(node, eventDispatcherImport) { + var _a; + if (!ts.isIdentifier(node.name) || !node.initializer) { + return; + } + if (ts.isCallExpression(node.initializer) && + ts.isIdentifier(node.initializer.expression) && + node.initializer.expression.text === eventDispatcherImport) { + const dispatcherName = node.name.text; + const dispatcherTyping = (_a = node.initializer.typeArguments) === null || _a === void 0 ? void 0 : _a[0]; + return { + dispatcherName, + dispatcherTyping, + dispatcherCreationExpr: node.initializer + }; + } +} + +function stripDoctype(str) { + const regex = /(\n)?/i; + const result = regex.exec(str.original); + if (result) { + str.remove(result.index, result.index + result[0].length); + } +} +/** + * Walks the HTMLx part of the Svelte component + * and converts it to JSX + */ +function convertHtmlxToJsx(str, ast, tags, options = { svelte5Plus: false }) { + options.typingsNamespace = options.typingsNamespace || 'svelteHTML'; + const preserveAttributeCase = options.namespace === 'foreign'; + stripDoctype(str); + const rootSnippets = []; + let element; + const pendingSnippetHoistCheck = new Set(); + let uses$$props = false; + let uses$$restProps = false; + let uses$$slots = false; + let usesAccessors = !!options.accessors; + let isRunes = false; + const componentDocumentation = new ComponentDocumentation(); + //track if we are in a declaration scope + const isDeclaration = { value: false }; + //track $store variables since we are only supposed to give top level scopes special treatment, and users can declare $blah variables at higher scopes + //which prevents us just changing all instances of Identity that start with $ + const scopeStack = new ScopeStack(); + const stores = new Stores(scopeStack, isDeclaration); + const scripts = new Scripts(ast); + const handleSvelteOptions = (node) => { + for (let i = 0; i < node.attributes.length; i++) { + const optionName = node.attributes[i].name; + const optionValue = node.attributes[i].value; + switch (optionName) { + case 'accessors': + if (Array.isArray(optionValue)) { + if (optionValue[0].type === 'MustacheTag') { + usesAccessors = optionValue[0].expression.value; + } + } + else { + usesAccessors = true; + } + break; + case 'runes': + isRunes = true; + break; + } + } + }; + const handleIdentifier = (node) => { + if (node.name === '$$props') { + uses$$props = true; + return; + } + if (node.name === '$$restProps') { + uses$$restProps = true; + return; + } + if (node.name === '$$slots') { + uses$$slots = true; + return; + } + }; + const handleStyleTag = (node) => { + str.remove(node.start, node.end); + }; + const slotHandler = new SlotHandler(str.original); + let templateScope = new TemplateScope(); + const handleComponentLet = (component) => { + templateScope = templateScope.child(); + const lets = slotHandler.getSlotConsumerOfComponent(component); + for (const { letNode, slotName } of lets) { + handleScopeAndResolveLetVarForSlot({ + letNode, + slotName, + slotHandler, + templateScope, + component + }); + } + }; + const handleScopeAndResolveForSlotInner = (identifierDef, initExpression, owner) => { + handleScopeAndResolveForSlot({ + identifierDef, + initExpression, + slotHandler, + templateScope, + owner + }); + }; + const eventHandler = new EventHandler(); + walk(ast, { + enter: (estreeTypedNode, estreeTypedParent, prop) => { + var _a; + const node = estreeTypedNode; + const parent = estreeTypedParent; + if (prop == 'params' && + (parent.type == 'FunctionDeclaration' || parent.type == 'ArrowFunctionExpression')) { + isDeclaration.value = true; + } + if (prop == 'id' && parent.type == 'VariableDeclarator') { + isDeclaration.value = true; + } + try { + switch (node.type) { + case 'Identifier': + handleIdentifier(node); + stores.handleIdentifier(node, parent, prop); + eventHandler.handleIdentifier(node, parent, prop); + break; + case 'IfBlock': + handleIf(str, node); + break; + case 'EachBlock': + templateScope = templateScope.child(); + if (node.context) { + handleScopeAndResolveForSlotInner(node.context, node.expression, node); + } + handleEach(str, node); + break; + case 'ElseBlock': + handleElse(str, node, parent); + break; + case 'KeyBlock': + handleKey(str, node); + break; + case 'BlockStatement': + case 'FunctionDeclaration': + case 'ArrowFunctionExpression': + scopeStack.push(); + break; + case 'SnippetBlock': + scopeStack.push(); + handleSnippet(str, node, (element instanceof InlineComponent && + estreeTypedParent.type === 'InlineComponent') || + (element instanceof Element && + element.tagName === 'svelte:boundary') + ? element + : undefined); + if (parent === ast) { + // root snippet -> move to instance script or possibly even module script + const result = analyze({ + type: 'FunctionDeclaration', + start: -1, + end: -1, + id: node.expression, + params: (_a = node.parameters) !== null && _a !== void 0 ? _a : [], + body: { + type: 'BlockStatement', + start: -1, + end: -1, + body: node.children // wrong AST, but periscopic doesn't care + } + }); + rootSnippets.push([node.start, node.end, result.globals]); + } + else { + pendingSnippetHoistCheck.add(parent); + } + break; + case 'MustacheTag': + handleMustacheTag(str, node, parent); + break; + case 'RawMustacheTag': + scripts.checkIfContainsScriptTag(node); + handleRawHtml(str, node); + break; + case 'DebugTag': + handleDebug(str, node); + break; + case 'ConstTag': + handleConstTag(str, node); + break; + case 'RenderTag': + handleRenderTag(str, node); + break; + case 'InlineComponent': + if (element) { + element.child = new InlineComponent(str, node, element); + element = element.child; + } + else { + element = new InlineComponent(str, node); + } + if (options.svelte5Plus) { + handleImplicitChildren(node, element); + } + handleComponentLet(node); + break; + case 'Element': + case 'Options': + case 'Window': + case 'Head': + case 'Title': + case 'Document': + case 'Body': + case 'SvelteHTML': + case 'SvelteBoundary': + case 'Slot': + case 'SlotTemplate': + if (node.type === 'Element') { + scripts.checkIfElementIsScriptTag(node, parent); + } + else if (node.type === 'Options') { + handleSvelteOptions(node); + } + else if (node.type === 'Slot') { + slotHandler.handleSlot(node, templateScope); + } + if (node.name !== '!DOCTYPE') { + if (element) { + element.child = new Element(str, node, options.typingsNamespace, element); + element = element.child; + } + else { + element = new Element(str, node, options.typingsNamespace); + } + } + break; + case 'Comment': + componentDocumentation.handleComment(node); + handleComment(str, node); + break; + case 'Binding': + handleBinding(str, node, parent, element, options.typingsNamespace === 'svelteHTML', options.svelte5Plus); + break; + case 'Class': + handleClassDirective(str, node, element); + break; + case 'StyleDirective': + handleStyleDirective(str, node, element); + break; + case 'Action': + stores.handleDirective(node, str); + handleActionDirective(node, element); + break; + case 'Transition': + stores.handleDirective(node, str); + handleTransitionDirective(str, node, element); + break; + case 'Animation': + stores.handleDirective(node, str); + handleAnimateDirective(str, node, element); + break; + case 'Attribute': + handleAttribute(str, node, parent, preserveAttributeCase, options.svelte5Plus, element); + break; + case 'Spread': + handleSpread(node, element); + break; + case 'EventHandler': + eventHandler.handleEventHandler(node, parent); + handleEventHandler(str, node, element); + break; + case 'Let': + handleLet(str, node, parent, preserveAttributeCase, options.svelte5Plus, element); + break; + case 'Text': + handleText(str, node, parent); + break; + case 'Style': + handleStyleTag(node); + break; + case 'VariableDeclarator': + isDeclaration.value = true; + break; + case 'AwaitBlock': + templateScope = templateScope.child(); + if (node.value) { + handleScopeAndResolveForSlotInner(node.value, node.expression, node.then); + } + if (node.error) { + handleScopeAndResolveForSlotInner(node.error, node.expression, node.catch); + } + break; + } + } + catch (e) { + console.error('Error walking node ', node, e); + throw e; + } + }, + leave: (estreeTypedNode, estreeTypedParent, prop) => { + const node = estreeTypedNode; + const parent = estreeTypedParent; + if (prop == 'params' && + (parent.type == 'FunctionDeclaration' || parent.type == 'ArrowFunctionExpression')) { + isDeclaration.value = false; + } + if (prop == 'id' && parent.type == 'VariableDeclarator') { + isDeclaration.value = false; + } + const onTemplateScopeLeave = () => { + templateScope = templateScope.parent; + }; + try { + switch (node.type) { + case 'BlockStatement': + case 'FunctionDeclaration': + case 'ArrowFunctionExpression': + case 'SnippetBlock': + scopeStack.pop(); + break; + case 'EachBlock': + onTemplateScopeLeave(); + break; + case 'AwaitBlock': + onTemplateScopeLeave(); + handleAwait(str, node); + break; + case 'InlineComponent': + case 'Element': + case 'Options': + case 'Window': + case 'Head': + case 'Title': + case 'Body': + case 'SvelteHTML': + case 'SvelteBoundary': + case 'Document': + case 'Slot': + case 'SlotTemplate': + if (node.type === 'InlineComponent') { + onTemplateScopeLeave(); + } + if (node.name !== '!DOCTYPE') { + element.performTransformation(); + element = element.parent; + } + break; + } + } + catch (e) { + console.error('Error leaving node ', node); + throw e; + } + } + }); + // hoist inner snippets to top of containing element + for (const node of pendingSnippetHoistCheck) { + hoistSnippetBlock(str, node); + } + // resolve scripts + const { scriptTag, moduleScriptTag } = scripts.getTopLevelScriptTags(); + if (options.mode !== 'ts') { + scripts.blankOtherScriptTags(str); + } + //resolve stores + const resolvedStores = stores.getStoreNames(); + return { + htmlAst: ast, + moduleScriptTag, + scriptTag, + rootSnippets, + slots: slotHandler.getSlotDef(), + events: new ComponentEvents(eventHandler, tags.some((tag) => { var _a; return (_a = tag.attributes) === null || _a === void 0 ? void 0 : _a.some((a) => a.name === 'strictEvents'); }), str), + uses$$props, + uses$$restProps, + uses$$slots, + componentDocumentation, + resolvedStores, + usesAccessors, + isRunes + }; +} + +/** + * A component class name suffix is necessary to prevent class name clashes + * like reported in https://github.com/sveltejs/language-tools/issues/294 + */ +const COMPONENT_SUFFIX = '__SvelteComponent_'; +function addComponentExport(params) { + if (params.generics.has()) { + addGenericsComponentExport(params); + } + else { + addSimpleComponentExport(params); + } +} +function addGenericsComponentExport({ events, canHaveAnyProp, exportedNames, componentDocumentation, fileName, mode, usesAccessors, str, generics, usesSlots, isSvelte5, noSvelteComponentTyped }) { + const genericsDef = generics.toDefinitionString(); + const genericsRef = generics.toReferencesString(); + const doc = componentDocumentation.getFormatted(); + const className = fileName && classNameFromFilename(fileName, mode !== 'dts'); + function returnType(forPart) { + return `ReturnType<__sveltets_Render${genericsRef}['${forPart}']>`; + } + let statement = ` +class __sveltets_Render${genericsDef} { + props() { + return ${props(true, canHaveAnyProp, exportedNames, `render${genericsRef}()`)}.props; + } + events() { + return ${_events(events.hasStrictEvents() || exportedNames.usesRunes(), `render${genericsRef}()`)}.events; + } + slots() { + return render${genericsRef}().slots; + } +${isSvelte5 + ? ` bindings() { return ${exportedNames.createBindingsStr()}; } + exports() { return ${exportedNames.hasExports() ? `render${genericsRef}().exports` : '{}'}; } +}` + : '}'} +`; + const svelteComponentClass = noSvelteComponentTyped + ? 'SvelteComponent' + : 'SvelteComponentTyped'; + const [PropsName] = addTypeExport(str, className, 'Props'); + const [EventsName] = addTypeExport(str, className, 'Events'); + const [SlotsName] = addTypeExport(str, className, 'Slots'); + if (isSvelte5) { + // Don't add props/events/slots type exports in dts mode for now, maybe someone asks for it to be back, + // but it's safer to not do it for now to have more flexibility in the future. + let eventsSlotsType = []; + if (events.hasEvents() || !exportedNames.usesRunes()) { + eventsSlotsType.push(`$$events?: ${returnType('events')}`); + } + if (usesSlots) { + eventsSlotsType.push(`$$slots?: ${returnType('slots')}`); + eventsSlotsType.push(`children?: any`); + } + const propsType = !canHaveAnyProp && exportedNames.hasNoProps() + ? `{${eventsSlotsType.join(', ')}}` + : `${returnType('props')} & {${eventsSlotsType.join(', ')}}`; + const bindingsType = `ReturnType<__sveltets_Render${generics.toReferencesAnyString()}['bindings']>`; + // Sadly, due to a combination of requirements and TypeScript limitations, we need to always create both a legacy class component and function component type. + // - Constraints: Need to support Svelte 4 class component types, therefore we need to use __sveltets_2_ensureComponent to transform function components to classes + // - Limitations: TypeScript is not able to preserve generics during said transformation (i.e. there's no way to express keeping the generic etc) + // TODO Svelte 6/7: Switch this around and not use new Component in svelte2tsx anymore, which means we can remove the legacy class component. We need something like _ensureFnComponent then. + statement += + `\ninterface $$IsomorphicComponent {\n` + + ` new ${genericsDef}(options: import('svelte').ComponentConstructorOptions<${returnType('props') + (usesSlots ? '& {children?: any}' : '')}>): import('svelte').SvelteComponent<${returnType('props')}, ${returnType('events')}, ${returnType('slots')}> & { $$bindings?: ${returnType('bindings')} } & ${returnType('exports')};\n` + + ` ${genericsDef}(internal: unknown, props: ${propsType}): ${returnType('exports')};\n` + + ` z_$$bindings?: ${bindingsType};\n` + + `}\n` + + `${doc}const ${className || '$$Component'}: $$IsomorphicComponent = null as any;\n` + + surroundWithIgnoreComments(`type ${className || '$$Component'}${genericsDef} = InstanceType;\n`) + + `export default ${className || '$$Component'};`; + } + else if (mode === 'dts') { + statement += + `export type ${PropsName}${genericsDef} = ${returnType('props')};\n` + + `export type ${EventsName}${genericsDef} = ${returnType('events')};\n` + + `export type ${SlotsName}${genericsDef} = ${returnType('slots')};\n` + + `\n${doc}export default class${className ? ` ${className}` : ''}${genericsDef} extends ${svelteComponentClass}<${PropsName}${genericsRef}, ${EventsName}${genericsRef}, ${SlotsName}${genericsRef}> {` + + exportedNames.createClassGetters(genericsRef) + + (usesAccessors ? exportedNames.createClassAccessors() : '') + + '\n}'; + } + else { + statement += + `\n\nimport { ${svelteComponentClass} as __SvelteComponentTyped__ } from "svelte" \n` + + `${doc}export default class${className ? ` ${className}` : ''}${genericsDef} extends __SvelteComponentTyped__<${returnType('props')}, ${returnType('events')}, ${returnType('slots')}> {` + + exportedNames.createClassGetters(genericsRef) + + (usesAccessors ? exportedNames.createClassAccessors() : '') + + '\n}'; + } + str.append(statement); +} +function addSimpleComponentExport({ events, isTsFile, canHaveAnyProp, exportedNames, componentDocumentation, fileName, mode, usesAccessors, str, usesSlots, noSvelteComponentTyped, isSvelte5 }) { + const propDef = props(isTsFile, canHaveAnyProp, exportedNames, _events(events.hasStrictEvents(), 'render()')); + const doc = componentDocumentation.getFormatted(); + const className = fileName && classNameFromFilename(fileName, mode !== 'dts'); + const componentName = className || '$$Component'; + let statement; + if (mode === 'dts') { + if (isSvelte5 && exportedNames.usesRunes() && !usesSlots && !events.hasEvents()) { + statement = + `\n${doc}const ${componentName} = __sveltets_2_fn_component(render());\n` + + `type ${componentName} = ReturnType;\n` + + `export default ${componentName};`; + } + else if (isSvelte5) { + // Inline definitions from Svelte shims; else dts files will reference the globals which will be unresolved + statement = + `\ninterface $$__sveltets_2_IsomorphicComponent = any, Events extends Record = any, Slots extends Record = any, Exports = {}, Bindings = string> { + new (options: import('svelte').ComponentConstructorOptions): import('svelte').SvelteComponent & { $$bindings?: Bindings } & Exports; + (internal: unknown, props: ${!canHaveAnyProp && exportedNames.hasNoProps() ? '{$$events?: Events, $$slots?: Slots}' : 'Props & {$$events?: Events, $$slots?: Slots}'}): Exports & { $set?: any, $on?: any }; + z_$$bindings?: Bindings; +}\n` + + (usesSlots + ? `type $$__sveltets_2_PropsWithChildren = Props & + (Slots extends { default: any } + ? Props extends Record + ? any + : { children?: any } + : {}); + declare function $$__sveltets_2_isomorphic_component_slots< + Props extends Record, Events extends Record, Slots extends Record, Exports extends Record, Bindings extends string + >(klass: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }): $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren, Events, Slots, Exports, Bindings>;\n` + : ` +declare function $$__sveltets_2_isomorphic_component< + Props extends Record, Events extends Record, Slots extends Record, Exports extends Record, Bindings extends string +>(klass: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }): $$__sveltets_2_IsomorphicComponent;\n`) + + `${doc}const ${componentName} = $$__sveltets_2_isomorphic_component${usesSlots ? '_slots' : ''}(${propDef});\n` + + surroundWithIgnoreComments(`type ${componentName} = InstanceType;\n`) + + `export default ${componentName};`; + } + else if (isTsFile) { + const svelteComponentClass = noSvelteComponentTyped + ? 'SvelteComponent' + : 'SvelteComponentTyped'; + const [PropsName, PropsExport] = addTypeExport(str, className, 'Props'); + const [EventsName, EventsExport] = addTypeExport(str, className, 'Events'); + const [SlotsName, SlotsExport] = addTypeExport(str, className, 'Slots'); + statement = + `\nconst __propDef = ${propDef};\n` + + PropsExport + + EventsExport + + SlotsExport + + `\n${doc}export default class${className ? ` ${className}` : ''} extends ${svelteComponentClass}<${PropsName}, ${EventsName}, ${SlotsName}> {` + + exportedNames.createClassGetters() + + (usesAccessors ? exportedNames.createClassAccessors() : '') + + '\n}'; + } + else { + statement = + `\nconst __propDef = ${propDef};\n` + + `/** @typedef {typeof __propDef.props} ${className}Props */\n` + + `/** @typedef {typeof __propDef.events} ${className}Events */\n` + + `/** @typedef {typeof __propDef.slots} ${className}Slots */\n` + + `\n${doc}export default class${className ? ` ${className}` : ''} extends __sveltets_2_createSvelte2TsxComponent(${propDef}) {` + + exportedNames.createClassGetters() + + (usesAccessors ? exportedNames.createClassAccessors() : '') + + '\n}'; + } + } + else { + if (isSvelte5) { + if (exportedNames.usesRunes() && !usesSlots && !events.hasEvents()) { + statement = + `\n${doc}const ${componentName} = __sveltets_2_fn_component(render());\n` + + `type ${componentName} = ReturnType;\n` + + `export default ${componentName};`; + } + else { + statement = + `\n${doc}const ${componentName} = __sveltets_2_isomorphic_component${usesSlots ? '_slots' : ''}(${propDef});\n` + + surroundWithIgnoreComments(`type ${componentName} = InstanceType;\n`) + + `export default ${componentName};`; + } + } + else { + statement = + `\n\n${doc}export default class${className ? ` ${className}` : ''} extends __sveltets_2_createSvelte2TsxComponent(${propDef}) {` + + exportedNames.createClassGetters() + + (usesAccessors ? exportedNames.createClassAccessors() : '') + + '\n}'; + } + } + str.append(statement); +} +function addTypeExport(str, className, type) { + const exportName = className + type; + if (!new RegExp(`\\W${exportName}\\W`).test(str.original)) { + return [ + exportName, + `export type ${exportName} = typeof __propDef.${type.toLowerCase()};\n` + ]; + } + let replacement = exportName + '_'; + while (str.original.includes(replacement)) { + replacement += '_'; + } + if ( + // Check if there's already an export with the same name + !new RegExp(`export ((const|let|var|class|interface|type) ${exportName}\\W|{[^}]*?${exportName}(}|\\W.*?}))`).test(str.original)) { + return [ + replacement, + `type ${replacement} = typeof __propDef.${type.toLowerCase()};\nexport { ${replacement} as ${exportName} };\n` + ]; + } + else { + return [ + replacement, + // we assume that the author explicitly named the type the same and don't export the generated type (which has an unstable name) + `type ${replacement} = typeof __propDef.${type.toLowerCase()};\n` + ]; + } +} +function _events(strictEvents, renderStr) { + return strictEvents ? renderStr : `__sveltets_2_with_any_event(${renderStr})`; +} +function props(isTsFile, canHaveAnyProp, exportedNames, renderStr) { + if (exportedNames.usesRunes()) { + return renderStr; + } + else if (isTsFile) { + return canHaveAnyProp ? `__sveltets_2_with_any(${renderStr})` : renderStr; + } + else { + const optionalProps = exportedNames.createOptionalPropsArray(); + const partial = `__sveltets_2_partial${canHaveAnyProp ? '_with_any' : ''}`; + return optionalProps.length > 0 + ? `${partial}([${optionalProps.join(',')}], ${renderStr})` + : `${partial}(${renderStr})`; + } +} +/** + * Returns a Svelte-compatible component name from a filename. Svelte + * components must use capitalized tags, so we try to transform the filename. + * + * https://svelte.dev/docs#Tags + */ +function classNameFromFilename(filename, appendSuffix) { + var _a; + try { + const withoutExtensions = (_a = path__default.parse(filename).name) === null || _a === void 0 ? void 0 : _a.split('.')[0]; + const withoutInvalidCharacters = withoutExtensions + .split('') + // Although "-" is invalid, we leave it in, pascal-case-handling will throw it out later + .filter((char) => /[A-Za-z$_\d-]/.test(char)) + .join(''); + const firstValidCharIdx = withoutInvalidCharacters + .split('') + // Although _ and $ are valid first characters for classes, they are invalid first characters + // for tag names. For a better import autocompletion experience, we therefore throw them out. + .findIndex((char) => /[A-Za-z]/.test(char)); + const withoutLeadingInvalidCharacters = withoutInvalidCharacters.substr(firstValidCharIdx); + const inPascalCase = pascalCase(withoutLeadingInvalidCharacters); + const finalName = firstValidCharIdx === -1 ? `A${inPascalCase}` : inPascalCase; + return `${finalName}${appendSuffix ? COMPONENT_SUFFIX : ''}`; + } + catch (error) { + console.warn(`Failed to create a name for the component class from filename ${filename}`); + return undefined; + } +} + +function createRenderFunction({ str, scriptTag, scriptDestination, slots, events, exportedNames, uses$$props, uses$$restProps, uses$$slots, uses$$SlotsInterface, generics, mode }) { + const htmlx = str.original; + let propsDecl = ''; + if (uses$$props) { + propsDecl += ' let $$props = __sveltets_2_allPropsType();'; + } + if (uses$$restProps) { + propsDecl += ' let $$restProps = __sveltets_2_restPropsType();'; + } + if (uses$$slots) { + propsDecl += + ' let $$slots = __sveltets_2_slotsType({' + + Array.from(slots.keys()) + .map((name) => `'${name}': ''`) + .join(', ') + + '});'; + } + const slotsDeclaration = slots.size > 0 && mode !== 'dts' + ? '\n' + + surroundWithIgnoreComments(';const __sveltets_createSlot = __sveltets_2_createCreateSlot' + + (uses$$SlotsInterface ? '<$$Slots>' : '') + + '();') + : ''; + if (scriptTag) { + //I couldn't get magicstring to let me put the script before the <> we prepend during conversion of the template to jsx, so we just close it instead + const scriptTagEnd = htmlx.lastIndexOf('>', scriptTag.content.start) + 1; + str.overwrite(scriptTag.start, scriptTag.start + 1, ';'); + if (generics.genericsAttr) { + let start = generics.genericsAttr.value[0].start; + let end = generics.genericsAttr.value[0].end; + if (htmlx.charAt(start) === '"' || htmlx.charAt(start) === "'") { + start++; + end--; + } + str.overwrite(scriptTag.start + 1, start - 1, `function render`); + str.overwrite(start - 1, start, `<`); // if the generics are unused, only this char is colored opaque + str.overwrite(end, scriptTagEnd, `>() {${propsDecl}\n`); + } + else { + str.overwrite(scriptTag.start + 1, scriptTagEnd, `function render${generics.toDefinitionString(true)}() {${propsDecl}\n`); + } + const scriptEndTagStart = htmlx.lastIndexOf('<', scriptTag.end - 1); + // wrap template with callback + str.overwrite(scriptEndTagStart, scriptTag.end, `${slotsDeclaration};\nasync () => {`, { + contentOnly: true + }); + } + else { + str.prependRight(scriptDestination, `;function render() {` + `${propsDecl}${slotsDeclaration}\nasync () => {`); + } + const slotsAsDef = uses$$SlotsInterface + ? '{} as unknown as $$Slots' + : '{' + + Array.from(slots.entries()) + .map(([name, attrs]) => { + return `'${name}': {${slotAttributesToString(attrs)}}`; + }) + .join(', ') + + '}'; + const returnString = `\nreturn { props: ${exportedNames.createPropsStr(uses$$props || uses$$restProps)}` + + exportedNames.createExportsStr() + + `, slots: ${slotsAsDef}` + + `, events: ${events.toDefString()} }}`; + // wrap template with callback + str.append('};'); + str.append(returnString); +} +function slotAttributesToString(attrs) { + return Array.from(attrs.entries()) + .map(([exportName, expr]) => exportName.startsWith('__spread__') ? `...${expr}` : `${exportName}:${expr}`) + .join(', '); +} + +/** + * Returns the path to the global svelte2tsx files that should be included in the project. + * Creates a hidden folder in the user's node_modules if `hiddenFolderPath` is provided. + */ +function get_global_types(tsSystem, isSvelte3, sveltePath, typesPath, hiddenFolderPath) { + let svelteHtmlPath = isSvelte3 ? undefined : join(sveltePath, 'svelte-html.d.ts'); + svelteHtmlPath = + svelteHtmlPath && tsSystem.fileExists(svelteHtmlPath) ? svelteHtmlPath : undefined; + let svelteTsxFiles; + if (isSvelte3) { + svelteTsxFiles = ['./svelte-shims.d.ts', './svelte-jsx.d.ts', './svelte-native-jsx.d.ts']; + } + else { + svelteTsxFiles = ['./svelte-shims-v4.d.ts', './svelte-native-jsx.d.ts']; + if (!svelteHtmlPath) { + svelteTsxFiles.push('./svelte-jsx-v4.d.ts'); + } + } + svelteTsxFiles = svelteTsxFiles.map((f) => tsSystem.resolvePath(resolve(typesPath, f))); + if (hiddenFolderPath) { + try { + // IDE context - the `import('svelte')` statements inside the d.ts files will load the Svelte version of + // the extension, which can cause all sorts of problems. Therefore put the files into a hidden folder in + // the user's node_modules, preferably next to the Svelte package. + let path = dirname(sveltePath); + if (!tsSystem.directoryExists(resolve(path, 'node_modules'))) { + path = hiddenFolderPath; + while (path && !tsSystem.directoryExists(resolve(path, 'node_modules'))) { + const parent = dirname(path); + if (path === parent) { + path = ''; + break; + } + path = parent; + } + } + if (path) { + const hiddenPath = resolve(path, 'node_modules/.svelte2tsx-language-server-files'); + const newFiles = []; + for (const f of svelteTsxFiles) { + const hiddenFile = resolve(hiddenPath, basename(f)); + const existing = tsSystem.readFile(hiddenFile); + const toWrite = tsSystem.readFile(f); + if (!toWrite) { + throw new Error(`Could not read file: ${f}`); + } + if (existing !== toWrite) { + tsSystem.writeFile(hiddenFile, toWrite); + // TS doesn't throw an error if the file wasn't written + if (!tsSystem.fileExists(hiddenFile)) { + throw new Error(`Could not write file: ${hiddenFile}`); + } + } + newFiles.push(hiddenFile); + } + svelteTsxFiles = newFiles; + } + } + catch (e) { } + } + if (svelteHtmlPath) { + svelteTsxFiles.push(tsSystem.resolvePath(resolve(typesPath, svelteHtmlPath))); + } + return svelteTsxFiles; +} + +/** + * Finds the top level const/let/function exports of a source file. + */ +function findExports(ts, source, isTsFile) { + var _a, _b, _c, _d; + const exports = new Map(); + // TODO handle indirect exports? + for (const statement of source.statements) { + if (ts.isFunctionDeclaration(statement) && + statement.name && + ((_b = (_a = ts.getModifiers(statement)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.kind) === ts.SyntaxKind.ExportKeyword) { + // export function x ... + exports.set(statement.name.text, { + type: 'function', + node: statement, + hasTypeDefinition: hasTypedParameter(ts, statement, isTsFile) + }); + } + if (ts.isVariableStatement(statement) && + statement.declarationList.declarations.length === 1 && + ((_d = (_c = ts.getModifiers(statement)) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.kind) === ts.SyntaxKind.ExportKeyword) { + // export const x = ... + const declaration = statement.declarationList.declarations[0]; + const hasTypeDefinition = !!declaration.type || + (!isTsFile && !!ts.getJSDocType(declaration)) || + (!!declaration.initializer && ts.isSatisfiesExpression(declaration.initializer)); + if (declaration.initializer && + (ts.isFunctionExpression(declaration.initializer) || + ts.isArrowFunction(declaration.initializer) || + (ts.isSatisfiesExpression(declaration.initializer) && + ts.isParenthesizedExpression(declaration.initializer.expression) && + (ts.isFunctionExpression(declaration.initializer.expression.expression) || + ts.isArrowFunction(declaration.initializer.expression.expression))) || + (ts.isParenthesizedExpression(declaration.initializer) && + (ts.isFunctionExpression(declaration.initializer.expression) || + ts.isArrowFunction(declaration.initializer.expression))))) { + const node = ts.isSatisfiesExpression(declaration.initializer) + ? declaration.initializer.expression + .expression + : ts.isParenthesizedExpression(declaration.initializer) + ? declaration.initializer.expression + : declaration.initializer; + exports.set(declaration.name.getText(), { + type: 'function', + node, + hasTypeDefinition: hasTypeDefinition || hasTypedParameter(ts, node, isTsFile) + }); + } + else if (ts.isIdentifier(declaration.name)) { + // TODO support `export const { x, y } = ...` ? + exports.set(declaration.name.getText(), { + type: 'var', + node: declaration, + hasTypeDefinition + }); + } + } + } + return exports; +} +function hasTypedParameter(ts, node, isTsFile) { + var _a; + return (!!((_a = node.parameters[0]) === null || _a === void 0 ? void 0 : _a.type) || + (!isTsFile && + (!!ts.getJSDocType(node) || + (node.parameters[0] && !!ts.getJSDocParameterTags(node.parameters[0]).length)))); +} + +const kitPageFiles = new Set(['+page', '+layout', '+page.server', '+layout.server', '+server']); +/** + * Determines whether or not a given file is a SvelteKit-specific file (route file, hooks file, or params file) + */ +function isKitFile(fileName, options) { + const basename = path__default.basename(fileName); + return (isKitRouteFile(basename) || + isHooksFile(fileName, basename, options.serverHooksPath) || + isHooksFile(fileName, basename, options.clientHooksPath) || + isHooksFile(fileName, basename, options.universalHooksPath) || + isParamsFile(fileName, basename, options.paramsPath)); +} +/** + * Determines whether or not a given file is a SvelteKit-specific route file + */ +function isKitRouteFile(basename) { + if (basename.includes('@')) { + // +page@foo -> +page + basename = basename.split('@')[0]; + } + else { + basename = basename.slice(0, -path__default.extname(basename).length); + } + return kitPageFiles.has(basename); +} +/** + * Determines whether or not a given file is a SvelteKit-specific hooks file + */ +function isHooksFile(fileName, basename, hooksPath) { + return (((basename === 'index.ts' || basename === 'index.js') && + fileName.slice(0, -basename.length - 1).endsWith(hooksPath)) || + fileName.slice(0, -path__default.extname(basename).length).endsWith(hooksPath)); +} +/** + * Determines whether or not a given file is a SvelteKit-specific params file + */ +function isParamsFile(fileName, basename, paramsPath) { + return (fileName.slice(0, -basename.length - 1).endsWith(paramsPath) && + !basename.includes('.test') && + !basename.includes('.spec')); +} +function upsertKitFile(ts, fileName, kitFilesSettings, getSource, surround = (text) => text) { + var _a, _b, _c, _d; + let basename = path__default.basename(fileName); + const result = (_d = (_c = (_b = (_a = upsertKitRouteFile(ts, basename, getSource, surround)) !== null && _a !== void 0 ? _a : upsertKitServerHooksFile(ts, fileName, basename, kitFilesSettings.serverHooksPath, getSource, surround)) !== null && _b !== void 0 ? _b : upsertKitClientHooksFile(ts, fileName, basename, kitFilesSettings.clientHooksPath, getSource, surround)) !== null && _c !== void 0 ? _c : upsertKitUniversalHooksFile(ts, fileName, basename, kitFilesSettings.universalHooksPath, getSource, surround)) !== null && _d !== void 0 ? _d : upsertKitParamsFile(ts, fileName, basename, kitFilesSettings.paramsPath, getSource, surround); + if (!result) { + return; + } + // construct generated text from internal text and addedCode array + const { originalText, addedCode } = result; + let pos = 0; + let text = ''; + for (const added of addedCode) { + text += originalText.slice(pos, added.originalPos) + added.inserted; + pos = added.originalPos; + } + text += originalText.slice(pos); + return { text, addedCode }; +} +function upsertKitRouteFile(ts, basename, getSource, surround) { + if (!isKitRouteFile(basename)) + return; + const source = getSource(); + if (!source) + return; + const addedCode = []; + const insert = (pos, inserted) => { + insertCode(addedCode, pos, inserted); + }; + const isTsFile = basename.endsWith('.ts'); + const exports = findExports(ts, source, isTsFile); + // add type to load function if not explicitly typed + const load = exports.get('load'); + if ((load === null || load === void 0 ? void 0 : load.type) === 'function' && load.node.parameters.length === 1 && !load.hasTypeDefinition) { + const pos = load.node.parameters[0].getEnd(); + const inserted = surround(`: import('./$types.js').${basename.includes('layout') ? 'Layout' : 'Page'}${basename.includes('server') ? 'Server' : ''}LoadEvent`); + insert(pos, inserted); + } + else if ((load === null || load === void 0 ? void 0 : load.type) === 'var' && !load.hasTypeDefinition) { + // "const load = ..." will be transformed into + // "const load = (...) satisfies PageLoad" + insert(load.node.initializer.getStart(), surround('(')); + insert(load.node.initializer.getEnd(), surround(`) satisfies import('./$types.js').${basename.includes('layout') ? 'Layout' : 'Page'}${basename.includes('server') ? 'Server' : ''}Load`)); + } + // add type to entries function if not explicitly typed + const entries = exports.get('entries'); + if ((entries === null || entries === void 0 ? void 0 : entries.type) === 'function' && + entries.node.parameters.length === 0 && + !entries.hasTypeDefinition && + !basename.includes('layout')) { + if (!entries.node.type && entries.node.body) { + const returnPos = ts.isArrowFunction(entries.node) + ? entries.node.equalsGreaterThanToken.getStart() + : entries.node.body.getStart(); + const returnInsertion = surround(`: ReturnType `); + insert(returnPos, returnInsertion); + } + } + // add type to actions variable if not explicitly typed + const actions = exports.get('actions'); + if ((actions === null || actions === void 0 ? void 0 : actions.type) === 'var' && !actions.hasTypeDefinition && actions.node.initializer) { + const pos = actions.node.initializer.getEnd(); + const inserted = surround(` satisfies import('./$types.js').Actions`); + insert(pos, inserted); + } + addTypeToVariable(exports, surround, insert, 'prerender', `boolean | 'auto'`); + addTypeToVariable(exports, surround, insert, 'trailingSlash', `'never' | 'always' | 'ignore'`); + addTypeToVariable(exports, surround, insert, 'ssr', `boolean`); + addTypeToVariable(exports, surround, insert, 'csr', `boolean`); + // add types to GET/PUT/POST/PATCH/DELETE/OPTIONS/HEAD if not explicitly typed + const insertApiMethod = (name) => { + addTypeToFunction(ts, exports, surround, insert, name, `import('./$types.js').RequestEvent`, `Response | Promise`); + }; + insertApiMethod('GET'); + insertApiMethod('PUT'); + insertApiMethod('POST'); + insertApiMethod('PATCH'); + insertApiMethod('DELETE'); + insertApiMethod('OPTIONS'); + insertApiMethod('HEAD'); + insertApiMethod('fallback'); + return { addedCode, originalText: source.getFullText() }; +} +function upsertKitParamsFile(ts, fileName, basename, paramsPath, getSource, surround) { + if (!isParamsFile(fileName, basename, paramsPath)) { + return; + } + const source = getSource(); + if (!source) + return; + const addedCode = []; + const insert = (pos, inserted) => { + insertCode(addedCode, pos, inserted); + }; + const isTsFile = basename.endsWith('.ts'); + const exports = findExports(ts, source, isTsFile); + addTypeToFunction(ts, exports, surround, insert, 'match', 'string', 'boolean'); + return { addedCode, originalText: source.getFullText() }; +} +function upsertKitClientHooksFile(ts, fileName, basename, clientHooksPath, getSource, surround) { + if (!isHooksFile(fileName, basename, clientHooksPath)) { + return; + } + const source = getSource(); + if (!source) + return; + const addedCode = []; + const insert = (pos, inserted) => { + insertCode(addedCode, pos, inserted); + }; + const isTsFile = basename.endsWith('.ts'); + const exports = findExports(ts, source, isTsFile); + addTypeToFunction(ts, exports, surround, insert, 'handleError', `import('@sveltejs/kit').HandleClientError`); + return { addedCode, originalText: source.getFullText() }; +} +function upsertKitServerHooksFile(ts, fileName, basename, serverHooksPath, getSource, surround) { + if (!isHooksFile(fileName, basename, serverHooksPath)) { + return; + } + const source = getSource(); + if (!source) + return; + const addedCode = []; + const insert = (pos, inserted) => { + insertCode(addedCode, pos, inserted); + }; + const isTsFile = basename.endsWith('.ts'); + const exports = findExports(ts, source, isTsFile); + const addType = (name, type) => { + addTypeToFunction(ts, exports, surround, insert, name, type); + }; + addType('handleError', `import('@sveltejs/kit').HandleServerError`); + addType('handle', `import('@sveltejs/kit').Handle`); + addType('handleFetch', `import('@sveltejs/kit').HandleFetch`); + return { addedCode, originalText: source.getFullText() }; +} +function upsertKitUniversalHooksFile(ts, fileName, basename, universalHooksPath, getSource, surround) { + if (!isHooksFile(fileName, basename, universalHooksPath)) { + return; + } + const source = getSource(); + if (!source) + return; + const addedCode = []; + const insert = (pos, inserted) => { + insertCode(addedCode, pos, inserted); + }; + const isTsFile = basename.endsWith('.ts'); + const exports = findExports(ts, source, isTsFile); + addTypeToFunction(ts, exports, surround, insert, 'reroute', `import('@sveltejs/kit').Reroute`); + return { addedCode, originalText: source.getFullText() }; +} +function addTypeToVariable(exports, surround, insert, name, type) { + const variable = exports.get(name); + if ((variable === null || variable === void 0 ? void 0 : variable.type) === 'var' && !variable.hasTypeDefinition && variable.node.initializer) { + const pos = variable.node.name.getEnd(); + const inserted = surround(` : ${type}`); + insert(pos, inserted); + } +} +function addTypeToFunction(ts, exports, surround, insert, name, type, returnType) { + const fn = exports.get(name); + if ((fn === null || fn === void 0 ? void 0 : fn.type) === 'function' && fn.node.parameters.length === 1 && !fn.hasTypeDefinition) { + const paramPos = fn.node.parameters[0].getEnd(); + const paramInsertion = surround(!returnType ? `: Parameters<${type}>[0]` : `: ${type}`); + insert(paramPos, paramInsertion); + if (!fn.node.type && fn.node.body) { + const returnPos = ts.isArrowFunction(fn.node) + ? fn.node.equalsGreaterThanToken.getStart() + : fn.node.body.getStart(); + const returnInsertion = surround(!returnType ? `: ReturnType<${type}> ` : `: ${returnType} `); + insert(returnPos, returnInsertion); + } + } +} +function insertCode(addedCode, pos, inserted) { + var _a, _b, _c, _d; + const insertionIdx = addedCode.findIndex((c) => c.originalPos > pos); + if (insertionIdx >= 0) { + for (let i = insertionIdx; i < addedCode.length; i++) { + addedCode[i].generatedPos += inserted.length; + addedCode[i].total += inserted.length; + } + const prevTotal = (_b = (_a = addedCode[insertionIdx - 1]) === null || _a === void 0 ? void 0 : _a.total) !== null && _b !== void 0 ? _b : 0; + addedCode.splice(insertionIdx, 0, { + generatedPos: pos + prevTotal, + originalPos: pos, + length: inserted.length, + inserted, + total: prevTotal + inserted.length + }); + } + else { + const prevTotal = (_d = (_c = addedCode[addedCode.length - 1]) === null || _c === void 0 ? void 0 : _c.total) !== null && _d !== void 0 ? _d : 0; + addedCode.push({ + generatedPos: pos + prevTotal, + originalPos: pos, + length: inserted.length, + inserted, + total: prevTotal + inserted.length + }); + } +} +function toVirtualPos(pos, addedCode) { + let total = 0; + for (const added of addedCode) { + if (pos < added.originalPos) + break; + total += added.length; + } + return pos + total; +} +function toOriginalPos(pos, addedCode) { + let total = 0; + let idx = 0; + for (; idx < addedCode.length; idx++) { + const added = addedCode[idx]; + if (pos < added.generatedPos) + break; + total += added.length; + } + if (idx > 0) { + const prev = addedCode[idx - 1]; + // If pos is in the middle of an added range, return the start of the addition + if (pos > prev.generatedPos && pos < prev.generatedPos + prev.length) { + return { pos: prev.originalPos, inGenerated: true }; + } + } + return { pos: pos - total, inGenerated: false }; +} + +/** + * ## Internal, do not use! This is subject to change at any time. + * + * Implementation notice: If one of the methods use a TypeScript function which is not from the + * static top level `ts` namespace, it must be passed as a parameter. + */ +const internalHelpers = { + isKitFile, + isKitRouteFile, + isHooksFile, + isParamsFile, + upsertKitFile, + toVirtualPos, + toOriginalPos, + findExports, + get_global_types +}; + +/** + * Prepends a string at the given index in a way that the source map maps the appended string + * to the given character, not the previous character (as MagicString's other methods would). + */ +function preprendStr(str, index, toAppend, removeExisting) { + const prepends = updatePrepends(str, index, toAppend, removeExisting); + toAppend = prepends.join(''); + str.overwrite(index, index + 1, toAppend + str.original.charAt(index), { contentOnly: true }); + return str; +} +/** + * Overwrites a string at the given range but also keeps the other preprends from `prependStr` + * if not explicitly told otherwise. + */ +function overwriteStr(str, start, end, toOverwrite, removeExisting) { + const prepends = updatePrepends(str, start, toOverwrite, removeExisting); + toOverwrite = prepends.join(''); + str.overwrite(start, end, toOverwrite, { contentOnly: true }); + return str; +} +function updatePrepends(str, index, toAppend, removeExisting) { + str.__prepends__ = str.__prepends__ || new Map(); + const prepends = removeExisting ? [] : str.__prepends__.get(index) || []; + prepends.push(toAppend); + str.__prepends__.set(index, prepends); + return prepends; +} +/** + * Returns the prepends that were added at the given index (if any). + */ +function getCurrentPrepends(str, index) { + var _a; + return ((_a = str.__prepends__) === null || _a === void 0 ? void 0 : _a.get(index)) || []; +} + +/** + * Collects all imports and module-level declarations to then find out which interfaces/types are hoistable. + */ +class HoistableInterfaces { + constructor() { + this.import_value_set = new Set(); + this.import_type_set = new Set(); + this.interface_map = new Map(); + this.props_interface = { + name: '', + node: null, + type_deps: new Set(), + value_deps: new Set() + }; + } + analyzeModuleScriptNode(node) { + // Handle Import Declarations + if (ts.isImportDeclaration(node) && node.importClause) { + const is_type_only = node.importClause.isTypeOnly; + if (node.importClause.namedBindings && + ts.isNamedImports(node.importClause.namedBindings)) { + node.importClause.namedBindings.elements.forEach((element) => { + const import_name = element.name.text; + if (is_type_only || element.isTypeOnly) { + this.import_type_set.add(import_name); + } + else { + this.import_value_set.add(import_name); + } + }); + } + // Handle default imports + if (node.importClause.name) { + const default_import = node.importClause.name.text; + if (is_type_only) { + this.import_type_set.add(default_import); + } + else { + this.import_value_set.add(default_import); + } + } + // Handle namespace imports + if (node.importClause.namedBindings && + ts.isNamespaceImport(node.importClause.namedBindings)) { + const namespace_import = node.importClause.namedBindings.name.text; + if (is_type_only) { + this.import_type_set.add(namespace_import); + } + else { + this.import_value_set.add(namespace_import); + } + } + } + // Handle top-level declarations + if (ts.isVariableStatement(node)) { + node.declarationList.declarations.forEach((declaration) => { + if (ts.isIdentifier(declaration.name)) { + this.import_value_set.add(declaration.name.text); + } + }); + } + if (ts.isFunctionDeclaration(node) && node.name) { + this.import_value_set.add(node.name.text); + } + if (ts.isClassDeclaration(node) && node.name) { + this.import_value_set.add(node.name.text); + } + if (ts.isEnumDeclaration(node)) { + this.import_value_set.add(node.name.text); + } + if (ts.isTypeAliasDeclaration(node)) { + this.import_type_set.add(node.name.text); + } + if (ts.isInterfaceDeclaration(node)) { + this.import_type_set.add(node.name.text); + } + } + analyzeInstanceScriptNode(node) { + var _a, _b, _c, _d; + // Handle Import Declarations + if (ts.isImportDeclaration(node) && node.importClause) { + const is_type_only = node.importClause.isTypeOnly; + if (node.importClause.namedBindings && + ts.isNamedImports(node.importClause.namedBindings)) { + node.importClause.namedBindings.elements.forEach((element) => { + const import_name = element.name.text; + if (is_type_only) { + this.import_type_set.add(import_name); + } + else { + this.import_value_set.add(import_name); + } + }); + } + // Handle default imports + if (node.importClause.name) { + const default_import = node.importClause.name.text; + if (is_type_only) { + this.import_type_set.add(default_import); + } + else { + this.import_value_set.add(default_import); + } + } + // Handle namespace imports + if (node.importClause.namedBindings && + ts.isNamespaceImport(node.importClause.namedBindings)) { + const namespace_import = node.importClause.namedBindings.name.text; + if (is_type_only) { + this.import_type_set.add(namespace_import); + } + else { + this.import_value_set.add(namespace_import); + } + } + } + // Handle Interface Declarations + if (ts.isInterfaceDeclaration(node)) { + const interface_name = node.name.text; + const type_dependencies = new Set(); + const value_dependencies = new Set(); + const generics = (_b = (_a = node.typeParameters) === null || _a === void 0 ? void 0 : _a.map((param) => param.name.text)) !== null && _b !== void 0 ? _b : []; + node.members.forEach((member) => { + if (ts.isPropertySignature(member) && member.type) { + this.collectTypeDependencies(member.type, type_dependencies, value_dependencies, generics); + } + else if (ts.isIndexSignatureDeclaration(member)) { + this.collectTypeDependencies(member.type, type_dependencies, value_dependencies, generics); + member.parameters.forEach((param) => { + this.collectTypeDependencies(param.type, type_dependencies, value_dependencies, generics); + }); + } + }); + if (this.import_type_set.has(interface_name)) { + // shadowed; delete because we can't hoist + this.import_type_set.delete(interface_name); + } + else { + this.interface_map.set(interface_name, { + type_deps: type_dependencies, + value_deps: value_dependencies, + node + }); + } + } + // Handle Type Alias Declarations + if (ts.isTypeAliasDeclaration(node)) { + const alias_name = node.name.text; + const type_dependencies = new Set(); + const value_dependencies = new Set(); + const generics = (_d = (_c = node.typeParameters) === null || _c === void 0 ? void 0 : _c.map((param) => param.name.text)) !== null && _d !== void 0 ? _d : []; + this.collectTypeDependencies(node.type, type_dependencies, value_dependencies, generics); + if (this.import_type_set.has(alias_name)) { + // shadowed; delete because we can't hoist + this.import_type_set.delete(alias_name); + } + else { + this.interface_map.set(alias_name, { + type_deps: type_dependencies, + value_deps: value_dependencies, + node + }); + } + } + // Handle top-level declarations: They could shadow module declarations; delete them from the set of allowed import values + if (ts.isVariableStatement(node)) { + node.declarationList.declarations.forEach((declaration) => { + if (ts.isIdentifier(declaration.name)) { + this.import_value_set.delete(declaration.name.text); + } + }); + } + if (ts.isFunctionDeclaration(node) && node.name) { + this.import_value_set.delete(node.name.text); + } + if (ts.isClassDeclaration(node) && node.name) { + this.import_value_set.delete(node.name.text); + } + if (ts.isEnumDeclaration(node)) { + this.import_value_set.delete(node.name.text); + } + if (ts.isTypeAliasDeclaration(node)) { + this.import_type_set.delete(node.name.text); + } + if (ts.isInterfaceDeclaration(node)) { + this.import_type_set.delete(node.name.text); + } + } + analyze$propsRune(node) { + var _a, _b; + if (((_a = node.initializer.typeArguments) === null || _a === void 0 ? void 0 : _a.length) > 0 || node.type) { + const generic_arg = ((_b = node.initializer.typeArguments) === null || _b === void 0 ? void 0 : _b[0]) || node.type; + if (ts.isTypeReferenceNode(generic_arg)) { + const name = this.getEntityNameText(generic_arg.typeName); + const interface_node = this.interface_map.get(name); + if (interface_node) { + this.props_interface.name = name; + this.props_interface.type_deps = interface_node.type_deps; + this.props_interface.value_deps = interface_node.value_deps; + } + } + else { + this.props_interface.name = '$$ComponentProps'; + this.props_interface.node = generic_arg; + this.collectTypeDependencies(generic_arg, this.props_interface.type_deps, this.props_interface.value_deps, []); + } + } + } + /** + * Traverses the AST to collect import statements and top-level interfaces, + * then determines which interfaces can be hoisted. + * @param source_file The TypeScript source file to analyze. + * @returns An object containing sets of value imports, type imports, and hoistable interfaces. + */ + determineHoistableInterfaces() { + const hoistable_interfaces = new Map(); + let progress = true; + while (progress) { + progress = false; + for (const [interface_name, deps] of this.interface_map.entries()) { + if (hoistable_interfaces.has(interface_name)) { + continue; + } + const can_hoist = [...deps.type_deps, ...deps.value_deps].every((dep) => { + return (this.import_type_set.has(dep) || + this.import_value_set.has(dep) || + hoistable_interfaces.has(dep)); + }); + if (can_hoist) { + hoistable_interfaces.set(interface_name, deps.node); + progress = true; + } + } + } + if (this.props_interface.name === '$$ComponentProps') { + const can_hoist = [ + ...this.props_interface.type_deps, + ...this.props_interface.value_deps + ].every((dep) => { + return (this.import_type_set.has(dep) || + this.import_value_set.has(dep) || + hoistable_interfaces.has(dep)); + }); + if (can_hoist) { + hoistable_interfaces.set(this.props_interface.name, this.props_interface.node); + } + } + return hoistable_interfaces; + } + /** + * Moves all interfaces that can be hoisted to the top of the script, if the $props rune's type is hoistable. + */ + moveHoistableInterfaces(str, astOffset, scriptStart, generics) { + if (!this.props_interface.name) + return; + for (const generic of generics) { + this.import_type_set.delete(generic); + } + const hoistable = this.determineHoistableInterfaces(); + if (hoistable.has(this.props_interface.name)) { + for (const [name, node] of hoistable) { + let pos = node.pos + astOffset; + if (name === '$$ComponentProps') { + // So that organize imports doesn't mess with the types + str.prependRight(pos, '\n'); + } + else { + // node.pos includes preceeding whitespace, which could mean we accidentally also move stuff appended to a previous node + if (str.original[pos] === '\r') { + pos++; + } + if (/\s/.test(str.original[pos])) { + pos++; + } + // jsdoc comments would be ignored if they are on the same line as the ;, so we add a newline, too. + // Also helps with organize imports not messing with the types + str.prependRight(pos, ';\n'); + str.appendLeft(node.end + astOffset, ';'); + } + str.move(pos, node.end + astOffset, scriptStart); + } + return hoistable; + } + } + getAllowedValues() { + return this.import_value_set; + } + /** + * Collects type and value dependencies from a given TypeNode. + * @param type_node The TypeNode to analyze. + * @param type_dependencies The set to collect type dependencies into. + * @param value_dependencies The set to collect value dependencies into. + */ + collectTypeDependencies(type_node, type_dependencies, value_dependencies, generics) { + const walk = (node) => { + if (ts.isTypeReferenceNode(node)) { + const type_name = this.getEntityNameText(node.typeName); + if (!generics.includes(type_name)) { + type_dependencies.add(type_name); + } + } + else if (ts.isTypeQueryNode(node)) { + // Handle 'typeof' expressions: e.g., foo: typeof bar + value_dependencies.add(this.getEntityNameText(node.exprName)); + } + ts.forEachChild(node, walk); + }; + walk(type_node); + } + /** + * Retrieves the full text of an EntityName (handles nested names). + * @param entity_name The EntityName to extract text from. + * @returns The full name as a string. + */ + getEntityNameText(entity_name) { + if (ts.isIdentifier(entity_name)) { + return entity_name.text; + } + else { + return this.getEntityNameText(entity_name.left) + '.' + entity_name.right.text; + } + } +} + +function is$$PropsDeclaration(node) { + return isInterfaceOrTypeDeclaration(node) && node.name.text === '$$Props'; +} +class ExportedNames { + constructor(str, astOffset, basename, isTsFile, isSvelte5Plus, isRunes) { + this.str = str; + this.astOffset = astOffset; + this.basename = basename; + this.isTsFile = isTsFile; + this.isSvelte5Plus = isSvelte5Plus; + this.isRunes = isRunes; + this.hoistableInterfaces = new HoistableInterfaces(); + this.usesAccessors = false; + /** + * Uses the `$$Props` type + */ + this.uses$$Props = false; + /** + * Component contains globals that have a rune name + */ + this.hasRunesGlobals = false; + /** + * The `$props()` rune's type info as a string, if it exists. + * If using TS, this returns the generic string, if using JS, returns the `@type {..}` string. + */ + this.$props = { + /** The JSDoc type; not set when TS type exists */ + comment: '', + /** The TS type */ + type: '', + bindings: [] + }; + /** Map of all props and exports. Exposing it publicly is no longer necessary for runes mode */ + this.exports = new Map(); + this.possibleExports = new Map(); + this.doneDeclarationTransformation = new Set(); + this.getters = new Set(); + } + handleVariableStatement(node, parent) { + const exportModifier = findExportKeyword(node); + if (exportModifier) { + const isLet = node.declarationList.flags === ts.NodeFlags.Let; + const isConst = node.declarationList.flags === ts.NodeFlags.Const; + this.handleExportedVariableDeclarationList(node.declarationList, (_, ...args) => this.addExportForBindingPattern(...args)); + if (isLet) { + this.propTypeAssertToUserDefined(node.declarationList); + } + else if (isConst) { + node.declarationList.forEachChild((n) => { + if (ts.isVariableDeclaration(n) && ts.isIdentifier(n.name)) { + this.addGetter(n.name); + const type = n.type || ts.getJSDocType(n); + const isKitExport = internalHelpers.isKitRouteFile(this.basename) && + n.name.getText() === 'snapshot'; + // TS types are not allowed in JS files, but TS will still pick it up and the ignore comment will filter out the error + const kitType = isKitExport && !type ? `: import('./$types.js').Snapshot` : ''; + const nameEnd = n.name.end + this.astOffset; + if (kitType) { + preprendStr(this.str, nameEnd, surroundWithIgnoreComments(kitType)); + } + } + }); + } + this.removeExport(exportModifier.getStart(), exportModifier.end); + } + else if (ts.isSourceFile(parent)) { + this.handleExportedVariableDeclarationList(node.declarationList, this.addPossibleExport.bind(this)); + for (const declaration of node.declarationList.declarations) { + if (declaration.initializer !== undefined && + ts.isCallExpression(declaration.initializer) && + declaration.initializer.expression.getText() === '$props') { + // @ts-expect-error TS is too stupid to narrow this properly + this.handle$propsRune(declaration); + break; + } + } + } + } + handleExportFunctionOrClass(node) { + const exportModifier = findExportKeyword(node); + if (!exportModifier) { + return; + } + this.removeExport(exportModifier.getStart(), exportModifier.end); + this.addGetter(node.name); + // Can't export default here + if (node.name) { + this.addExport(node.name, false); + } + } + handleExportDeclaration(node) { + const { exportClause } = node; + if (ts.isNamedExports(exportClause)) { + for (const ne of exportClause.elements) { + if (ne.propertyName) { + this.addExport(ne.propertyName, false, ne.name, undefined, undefined, true); + } + else { + this.addExport(ne.name, false, undefined, undefined, undefined, true); + } + } + //we can remove entire statement + this.removeExport(node.getStart(), node.end); + } + } + handle$propsRune(node) { + var _a, _b; + // Check if the $props() rune uses $bindable() + if (ts.isObjectBindingPattern(node.name)) { + for (const element of node.name.elements) { + if (ts.isIdentifier(element.name) && + (!element.propertyName || ts.isIdentifier(element.propertyName)) && + !element.dotDotDotToken) { + const name = element.propertyName + ? element.propertyName.text + : element.name.text; + if (element.initializer) { + let call = element.initializer; + // if it's an as expression we need to check wether the as + // expression expression is a call + if (ts.isAsExpression(call)) { + call = call.expression; + } + if (ts.isCallExpression(call) && ts.isIdentifier(call.expression)) { + if (call.expression.text === '$bindable') { + this.$props.bindings.push(name); + } + } + } + } + } + } + // Easy mode: User uses TypeScript and typed the $props() rune + if (((_a = node.initializer.typeArguments) === null || _a === void 0 ? void 0 : _a.length) > 0 || node.type) { + this.hoistableInterfaces.analyze$propsRune(node); + const generic_arg = ((_b = node.initializer.typeArguments) === null || _b === void 0 ? void 0 : _b[0]) || node.type; + const generic = generic_arg.getText(); + if (ts.isTypeReferenceNode(generic_arg)) { + this.$props.type = generic; + } + else { + // Create a virtual type alias for the unnamed generic and reuse it for the props return type + // so that rename, find references etc works seamlessly across components + this.$props.type = '$$ComponentProps'; + preprendStr(this.str, generic_arg.pos + this.astOffset, `;type ${this.$props.type} = `); + this.str.appendLeft(generic_arg.end + this.astOffset, ';'); + this.str.move(generic_arg.pos + this.astOffset, generic_arg.end + this.astOffset, node.parent.pos + this.astOffset); + this.str.appendRight(generic_arg.end + this.astOffset, + // so that semantic tokens ignore it, preventing an overlap of tokens + surroundWithIgnoreComments(this.$props.type)); + } + return; + } + // Hard mode: User uses JSDoc or didn't type the $props() rune + if (!this.isTsFile) { + const text = node.getSourceFile().getFullText(); + let start = -1; + let comment; + // reverse because we want to look at the last comment before the node first + for (const c of [...(ts.getLeadingCommentRanges(text, node.pos) || [])].reverse()) { + const potential_match = text.substring(c.pos, c.end); + if (/@type\b/.test(potential_match)) { + comment = potential_match; + start = c.pos + this.astOffset; + break; + } + } + if (!comment) { + for (const c of [ + ...(ts.getLeadingCommentRanges(text, node.parent.pos) || []).reverse() + ]) { + const potential_match = text.substring(c.pos, c.end); + if (/@type\b/.test(potential_match)) { + comment = potential_match; + start = c.pos + this.astOffset; + break; + } + } + } + if (comment && /\/\*\*[^@]*?@type\s*{\s*{.*}\s*}\s*\*\//.test(comment)) { + // Create a virtual type alias for the unnamed generic and reuse it for the props return type + // so that rename, find references etc works seamlessly across components + this.$props.comment = '/** @type {$$ComponentProps} */'; + const type_start = this.str.original.indexOf('@type', start); + this.str.overwrite(type_start, type_start + 5, '@typedef'); + const end = this.str.original.indexOf('*/', start); + this.str.overwrite(end, end + 2, ' $$ComponentProps */' + this.$props.comment); + } + else { + // Complex comment or simple `@type {AType}` comment which we just use as-is. + // For the former this means things like rename won't work properly across components. + this.$props.comment = comment || ''; + } + } + if (this.$props.comment) { + // User uses JsDoc + return; + } + // Do a best-effort to extract the props from the object literal + let propsStr = ''; + let withUnknown = false; + let props = []; + const isKitRouteFile = internalHelpers.isKitRouteFile(this.basename); + const isKitLayoutFile = isKitRouteFile && this.basename.includes('layout'); + if (ts.isObjectBindingPattern(node.name)) { + for (const element of node.name.elements) { + if (!ts.isIdentifier(element.name) || + (element.propertyName && !ts.isIdentifier(element.propertyName)) || + !!element.dotDotDotToken) { + withUnknown = true; + } + else { + const name = element.propertyName + ? element.propertyName.text + : element.name.text; + if (isKitRouteFile) { + if (name === 'data') { + props.push(`data: import('./$types.js').${isKitLayoutFile ? 'LayoutData' : 'PageData'}`); + } + if (name === 'form' && !isKitLayoutFile) { + props.push(`form: import('./$types.js').ActionData`); + } + } + else if (element.initializer) { + const initializer = ts.isCallExpression(element.initializer) && + ts.isIdentifier(element.initializer.expression) && + element.initializer.expression.text === '$bindable' + ? element.initializer.arguments[0] + : element.initializer; + const type = !initializer + ? 'any' + : ts.isAsExpression(initializer) + ? initializer.type.getText() + : ts.isStringLiteral(initializer) + ? 'string' + : ts.isNumericLiteral(initializer) + ? 'number' + : initializer.kind === ts.SyntaxKind.TrueKeyword || + initializer.kind === ts.SyntaxKind.FalseKeyword + ? 'boolean' + : ts.isIdentifier(initializer) && + initializer.text !== 'undefined' + ? `typeof ${initializer.text}` + : ts.isArrowFunction(initializer) + ? 'Function' + : ts.isObjectLiteralExpression(initializer) + ? 'Record' + : ts.isArrayLiteralExpression(initializer) + ? 'any[]' + : 'any'; + props.push(`${name}?: ${type}`); + } + else { + props.push(`${name}: any`); + } + } + } + if (isKitLayoutFile) { + props.push(`children: import('svelte').Snippet`); + } + if (props.length > 0) { + propsStr = + `{ ${props.join(', ')} }` + (withUnknown ? ' & Record' : ''); + } + else if (withUnknown) { + propsStr = 'Record'; + } + else { + propsStr = 'Record'; + } + } + else { + propsStr = 'Record'; + } + // Create a virtual type alias for the unnamed generic and reuse it for the props return type + // so that rename, find references etc works seamlessly across components + if (this.isTsFile) { + this.$props.type = '$$ComponentProps'; + if (props.length > 0 || withUnknown) { + preprendStr(this.str, node.parent.pos + this.astOffset, surroundWithIgnoreComments(`;type $$ComponentProps = ${propsStr};`)); + preprendStr(this.str, node.name.end + this.astOffset, `: ${this.$props.type}`); + } + } + else { + this.$props.comment = '/** @type {$$ComponentProps} */'; + if (props.length > 0 || withUnknown) { + preprendStr(this.str, node.pos + this.astOffset, `/** @typedef {${propsStr}} $$ComponentProps */${this.$props.comment}`); + } + } + } + removeExport(start, end) { + const exportStart = this.str.original.indexOf('export', start + this.astOffset); + const exportEnd = exportStart + (end - start); + this.str.remove(exportStart, exportEnd); + } + /** + * Appends `prop = __sveltets_2_any(prop)` to given declaration in order to + * trick TS into widening the type. Else for example `let foo: string | undefined = undefined` + * is narrowed to `undefined` by TS. + */ + propTypeAssertToUserDefined(node) { + if (this.doneDeclarationTransformation.has(node)) { + return; + } + const handleTypeAssertion = (declaration) => { + const identifier = declaration.name; + const tsType = declaration.type; + const jsDocType = ts.getJSDocType(declaration); + const type = tsType || jsDocType; + const name = identifier.getText(); + const isKitExport = internalHelpers.isKitRouteFile(this.basename) && + (name === 'data' || name === 'form' || name === 'snapshot'); + // TS types are not allowed in JS files, but TS will still pick it up and the ignore comment will filter out the error + const kitType = isKitExport && !type + ? `: import('./$types.js').${name === 'data' + ? this.basename.includes('layout') + ? 'LayoutData' + : 'PageData' + : name === 'form' + ? 'ActionData' + : 'Snapshot'}` + : ''; + const nameEnd = identifier.end + this.astOffset; + const end = declaration.end + this.astOffset; + if (ts.isIdentifier(identifier) && + // Ensure initialization for proper control flow and to avoid "possibly undefined" type errors. + // Also ensure prop is typed as any with a type annotation in TS strict mode + (!declaration.initializer || + // Widen the type, else it's narrowed to the initializer + type || + // Edge case: TS infers `export let bla = false` to type `false`. + // prevent that by adding the any-wrap in this case, too. + (!type && + [ts.SyntaxKind.FalseKeyword, ts.SyntaxKind.TrueKeyword].includes(declaration.initializer.kind)))) { + const name = identifier.getText(); + if (nameEnd === end) { + preprendStr(this.str, end, surroundWithIgnoreComments(`${kitType};${name} = __sveltets_2_any(${name});`)); + } + else { + if (kitType) { + preprendStr(this.str, nameEnd, surroundWithIgnoreComments(kitType)); + } + preprendStr(this.str, end, surroundWithIgnoreComments(`;${name} = __sveltets_2_any(${name});`)); + } + } + else if (kitType) { + preprendStr(this.str, nameEnd, surroundWithIgnoreComments(kitType)); + } + }; + const findComma = (target) => target.getChildren().filter((child) => child.kind === ts.SyntaxKind.CommaToken); + const splitDeclaration = () => { + const commas = node + .getChildren() + .filter((child) => child.kind === ts.SyntaxKind.SyntaxList) + .map(findComma) + .reduce((current, previous) => [...current, ...previous], []); + commas.forEach((comma) => { + const start = comma.getStart() + this.astOffset; + const end = comma.getEnd() + this.astOffset; + overwriteStr(this.str, start, end, ';let '); + }); + }; + for (const declaration of node.declarations) { + handleTypeAssertion(declaration); + } + // need to be append after the type assert treatment + splitDeclaration(); + this.doneDeclarationTransformation.add(node); + } + handleExportedVariableDeclarationList(list, add) { + const isLet = list.flags === ts.NodeFlags.Let; + ts.forEachChild(list, (node) => { + if (ts.isVariableDeclaration(node)) { + if (ts.isIdentifier(node.name)) { + add(list, node.name, isLet, node.name, node.type, !node.initializer); + } + else if (ts.isObjectBindingPattern(node.name) || + ts.isArrayBindingPattern(node.name)) { + ts.forEachChild(node.name, (element) => { + if (ts.isBindingElement(element)) { + add(list, element.name, isLet); + } + }); + } + } + }); + } + addGetter(node) { + if (!node) { + return; + } + this.getters.add(node.text); + } + createClassGetters(generics = '') { + if (this.usesRunes()) { + // In runes mode, exports are no longer part of props + return Array.from(this.getters) + .map((name) => `\n get ${name}() { return render${generics}().exports.${name} }`) + .join(''); + } + else { + return Array.from(this.getters) + .map((name) => + // getters are const/classes/functions, which are always defined. + // We have to remove the `| undefined` from the type here because it was necessary to + // be added in a previous step so people are not expected to provide these as props. + `\n get ${name}() { return __sveltets_2_nonNullable(this.$$prop_def.${name}) }`) + .join(''); + } + } + createClassAccessors() { + const accessors = []; + for (const value of this.exports.values()) { + if (this.getters.has(value.identifierText)) { + continue; + } + accessors.push(value.identifierText); + } + return accessors + .map((name) => `\n get ${name}() { return this.$$prop_def.${name} }` + + `\n /**accessor*/\n set ${name}(_) {}`) + .join(''); + } + /** + * Marks a top level declaration as a possible export + * which could be exported through `export { .. }` later. + */ + addPossibleExport(declaration, name, isLet, target = null, type = null, required = false) { + if (!ts.isIdentifier(name)) { + return; + } + if (target && ts.isIdentifier(target)) { + this.possibleExports.set(name.text, { + declaration, + isLet, + type: type === null || type === void 0 ? void 0 : type.getText(), + identifierText: target.text, + required, + doc: this.getDoc(target) + }); + } + else { + this.possibleExports.set(name.text, { + declaration, + isLet + }); + } + } + /** + * Adds export to map + */ + addExport(name, isLet, target = null, type = null, required = false, isNamedExport = false) { + const existingDeclaration = this.possibleExports.get(name.text); + if (target) { + this.exports.set(name.text, { + isLet: isLet || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.isLet), + type: (type === null || type === void 0 ? void 0 : type.getText()) || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.type), + identifierText: target.text, + required: required || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.required), + doc: this.getDoc(target) || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.doc), + isNamedExport + }); + } + else { + this.exports.set(name.text, { + isLet: isLet || (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.isLet), + type: existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.type, + required: existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.required, + doc: existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.doc, + isNamedExport + }); + } + if (existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration.isLet) { + this.propTypeAssertToUserDefined(existingDeclaration.declaration); + } + } + addExportForBindingPattern(name, isLet, target = null, type = null, required = false) { + if (ts.isIdentifier(name)) { + if (!target || ts.isIdentifier(target)) { + this.addExport(name, isLet, target, type, required); + } + return; + } + name.elements.forEach((child) => { + this.addExportForBindingPattern(child.name, isLet, undefined, type, required); + }); + } + getDoc(target) { + var _a, _b; + let doc = undefined; + // Traverse `a` one up. If the declaration is part of a declaration list, + // the comment is at this point already + const variableDeclaration = target === null || target === void 0 ? void 0 : target.parent; + // Traverse `a` up to `export let a` + const exportExpr = (_b = (_a = target === null || target === void 0 ? void 0 : target.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent; + if (variableDeclaration) { + doc = getLastLeadingDoc(variableDeclaration); + } + if (exportExpr && !doc) { + doc = getLastLeadingDoc(exportExpr); + } + return doc; + } + /** + * Creates a string from the collected props + * + * @param uses$$propsOr$$restProps whether the file references the $$props or $$restProps variable + */ + createPropsStr(uses$$propsOr$$restProps) { + const names = Array.from(this.exports.entries()); + if (this.usesRunes()) { + if (this.$props.type) { + return '{} as any as ' + this.$props.type; + } + if (this.$props.comment) { + return this.$props.comment + '({})'; + } + // Necessary, because {} roughly equals to any + return this.isTsFile + ? '{} as Record' + : '/** @type {Record} */ ({})'; + } + if (this.uses$$Props) { + const lets = names.filter(([, { isLet }]) => isLet); + const others = names.filter(([, { isLet }]) => !isLet); + // - The check if $$Props is assignable to exports is necessary to make sure no extraneous props + // are defined and that no props are required that should be optional + // - The check if exports are assignable to $$Props is not done because a component should be allowed + // to use less props than defined (it just ignores them) + // - __sveltets_2_ensureRightProps needs to be declared in a way that doesn't affect the type result of props + return ('{ ...__sveltets_2_ensureRightProps<{' + + this.createReturnElementsType(lets).join(',') + + '}>(__sveltets_2_any("") as $$Props)} as ' + + // We add other exports of classes and functions here because + // they need to appear in the props object in order to properly + // type bind:xx but they are not needed to be part of $$Props + (others.length + ? '{' + this.createReturnElementsType(others).join(',') + '} & ' + : '') + + '$$Props'); + } + if (names.length === 0 && !uses$$propsOr$$restProps) { + // Necessary, because {} roughly equals to any + return this.isTsFile + ? '{} as Record' + : '/** @type {Record} */ ({})'; + } + const dontAddTypeDef = !this.isTsFile || names.every(([_, value]) => !value.type && value.required); + const returnElements = this.createReturnElements(names, dontAddTypeDef); + if (dontAddTypeDef) { + // Only `typeof` exports -> omit the `as {...}` completely. + // If not TS, omit the types to not have a "cannot use types in jsx" error. + return `{${returnElements.join(' , ')}}`; + } + const returnElementsType = this.createReturnElementsType(names); + return `{${returnElements.join(' , ')}} as {${returnElementsType.join(', ')}}`; + } + hasNoProps() { + if (this.usesRunes()) { + return !this.$props.type && !this.$props.comment; + } + const names = Array.from(this.exports.entries()); + return names.length === 0; + } + createBindingsStr() { + if (this.usesRunes()) { + // will be just the empty strings for zero bindings, which is impossible to create a binding for, so it works out fine + return `__sveltets_$$bindings('${this.$props.bindings.join("', '")}')`; + } + else { + return '""'; + } + } + /** + * In runes mode, exports are no longer part of props because you cannot `bind:` to them, + * which is why we need a separate return type for them. In Svelte 5, the isomorphic component + * needs them separate, too. + */ + createExportsStr() { + const names = Array.from(this.exports.entries()); + const others = names.filter(([, { isLet, isNamedExport }]) => !isLet || (this.usesRunes() && isNamedExport)); + const needsAccessors = this.usesAccessors && names.length > 0 && !this.usesRunes(); // runes mode doesn't support accessors + if (this.isSvelte5Plus) { + let str = ''; + if (others.length > 0 || this.usesRunes() || needsAccessors) { + if (others.length > 0 || needsAccessors) { + if (this.isTsFile) { + str += + ', exports: {} as any as { ' + + this.createReturnElementsType(needsAccessors ? names : others, undefined, true).join(',') + + ' }'; + } + else { + str += `, exports: /** @type {{${this.createReturnElementsType(needsAccessors ? names : others, false, true)}}} */ ({})`; + } + } + else { + // Always add that, in TS5.5+ the type for Exports is infered to never when this is not present, which breaks types. + // Don't cast to `Record` because that will break the union type we use elsewhere + str += ', exports: {}'; + } + str += `, bindings: ${this.createBindingsStr()}`; + } + else { + // always add that, in TS5.5+ the type for Exports is infered to never when this is not present, which breaks types + str += `, exports: {}, bindings: ${this.createBindingsStr()}`; + } + return str; + } + return ''; + } + createReturnElements(names, dontAddTypeDef) { + return names.map(([key, value]) => { + // Important to not use shorthand props for rename functionality + return `${dontAddTypeDef && value.doc ? `\n${value.doc}` : ''}${value.identifierText || key}: ${key}`; + }); + } + createReturnElementsType(names, addDoc = true, forceRequired = false) { + return names.map(([key, value]) => { + const identifier = `${value.doc && addDoc ? `\n${value.doc}` : ''}${value.identifierText || key}${value.required || forceRequired ? '' : '?'}`; + if (!value.type) { + return `${identifier}: typeof ${key}`; + } + return `${identifier}: ${value.type}`; + }); + } + createOptionalPropsArray() { + if (this.usesRunes()) { + return []; + } + else { + return Array.from(this.exports.entries()) + .filter(([_, entry]) => !entry.required) + .map(([name, entry]) => `'${entry.identifierText || name}'`); + } + } + getExportsMap() { + return this.exports; + } + hasExports() { + const names = Array.from(this.exports.entries()); + return this.usesAccessors ? names.length > 0 : names.some(([, { isLet }]) => !isLet); + } + hasPropsRune() { + return this.isSvelte5Plus && !!(this.$props.type || this.$props.comment); + } + checkGlobalsForRunes(globals) { + const runes = ['$state', '$derived', '$effect']; // no need to check for props, already handled through other means in here + this.hasRunesGlobals = + this.isSvelte5Plus && globals.some((global) => runes.includes(global)); + } + usesRunes() { + return this.hasRunesGlobals || this.hasPropsRune() || this.isRunes; + } +} + +/** + * Throw an error with start/end pos like the Svelte compiler does + */ +function throwError(start, end, message, code) { + const error = new Error(message); + error.start = positionAt(start, code); + error.end = positionAt(end, code); + throw error; +} +/** + * Get the line (1-offset) and character (0-offset) based on the offset + * @param offset The index of the position + * @param text The text for which the position should be retrived + */ +function positionAt(offset, text) { + offset = clamp(offset, 0, text.length); + const lineOffsets = getLineOffsets(text); + let low = 0; + let high = lineOffsets.length; + if (high === 0) { + return { line: 1, column: offset }; + } + while (low < high) { + const mid = Math.floor((low + high) / 2); + if (lineOffsets[mid] > offset) { + high = mid; + } + else { + low = mid + 1; + } + } + // low is the least x for which the line offset is larger than the current offset + // or array.length if no line offset is larger than the current offset + return { line: low, column: offset - lineOffsets[low - 1] }; +} +function clamp(num, min, max) { + return Math.max(min, Math.min(max, num)); +} +function getLineOffsets(text) { + const lineOffsets = []; + let isLineStart = true; + for (let i = 0; i < text.length; i++) { + if (isLineStart) { + lineOffsets.push(i); + isLineStart = false; + } + const ch = text.charAt(i); + isLineStart = ch === '\r' || ch === '\n'; + if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') { + i++; + } + } + if (isLineStart && text.length > 0) { + lineOffsets.push(text.length); + } + return lineOffsets; +} + +class Generics { + constructor(str, astOffset, script) { + var _a, _b, _c, _d; + this.str = str; + this.astOffset = astOffset; + /** The whole `T extends boolean` */ + this.definitions = []; + this.typeReferences = []; + /** The `T` in `T extends boolean` */ + this.references = []; + this.genericsAttr = script.attributes.find((attr) => attr.name === 'generics'); + const generics = (_b = (_a = this.genericsAttr) === null || _a === void 0 ? void 0 : _a.value[0]) === null || _b === void 0 ? void 0 : _b.raw; + if (generics) { + const typeParameters = this.getGenericTypeParameters(generics); + this.definitions = (_c = typeParameters === null || typeParameters === void 0 ? void 0 : typeParameters.map((param) => param.getText())) !== null && _c !== void 0 ? _c : []; + this.references = (_d = typeParameters === null || typeParameters === void 0 ? void 0 : typeParameters.map((param) => param.name.getText())) !== null && _d !== void 0 ? _d : []; + } + else { + this.genericsAttr = undefined; + } + } + getGenericTypeParameters(rawGenericsAttr) { + const sourceFile = ts.createSourceFile('index.ts', `<${rawGenericsAttr}>() => {}`, ts.ScriptTarget.Latest, true); + const firstStatement = sourceFile.statements[0]; + if (!firstStatement || !ts.isExpressionStatement(firstStatement)) { + return; + } + const arrowFunction = firstStatement.expression; + if (!ts.isArrowFunction(arrowFunction)) { + return; + } + return arrowFunction.typeParameters; + } + addIfIsGeneric(node) { + var _a, _b; + if (ts.isTypeAliasDeclaration(node) && this.is$$GenericType(node.type)) { + if (this.genericsAttr) { + throw new Error('Invalid $$Generic declaration: $$Generic definitions are not allowed when the generics attribute is present on the script tag'); + } + if (((_a = node.type.typeArguments) === null || _a === void 0 ? void 0 : _a.length) > 1) { + throw new Error('Invalid $$Generic declaration: Only one type argument allowed'); + } + if (((_b = node.type.typeArguments) === null || _b === void 0 ? void 0 : _b.length) === 1) { + const typeReference = node.type.typeArguments[0].getText(); + this.typeReferences.push(typeReference); + this.definitions.push(`${node.name.text} extends ${typeReference}`); + } + else { + this.definitions.push(node.name.text); + } + this.references.push(node.name.text); + this.str.remove(this.astOffset + node.getStart(), this.astOffset + node.getEnd()); + } + } + throwIfIsGeneric(node) { + if (ts.isTypeAliasDeclaration(node) && this.is$$GenericType(node.type)) { + throwError(this.astOffset + node.getStart(), this.astOffset + node.getEnd(), '$$Generic declarations are only allowed in the instance script', this.str.original); + } + } + is$$GenericType(node) { + return (ts.isTypeReferenceNode(node) && + ts.isIdentifier(node.typeName) && + node.typeName.text === '$$Generic'); + } + getTypeReferences() { + return this.typeReferences; + } + getReferences() { + return this.references; + } + toDefinitionString(addIgnore = false) { + const surround = addIgnore ? surroundWithIgnoreComments : (str) => str; + return this.definitions.length ? surround(`<${this.definitions.join(',')}>`) : ''; + } + toReferencesString() { + return this.references.length ? `<${this.references.join(',')}>` : ''; + } + toReferencesAnyString() { + return this.references.length ? `<${this.references.map(() => 'any').join(',')}>` : ''; + } + has() { + return this.definitions.length > 0; + } +} + +/** + * Tracks all store-usages as well as all variable declarations and imports in the component. + * + * In the modification-step at the end, all variable declarations and imports which + * were used as stores are appended with `let $xx = __sveltets_2_store_get(xx)` to create the store variables. + */ +class ImplicitStoreValues { + constructor(storesResolvedInTemplate = [], renderFunctionStart, storeFromImportsWrapper = (input) => input) { + this.renderFunctionStart = renderFunctionStart; + this.storeFromImportsWrapper = storeFromImportsWrapper; + this.accessedStores = new Set(); + this.variableDeclarations = []; + this.reactiveDeclarations = []; + this.importStatements = []; + this.addStoreAcess = this.accessedStores.add.bind(this.accessedStores); + this.addVariableDeclaration = this.variableDeclarations.push.bind(this.variableDeclarations); + this.addReactiveDeclaration = this.reactiveDeclarations.push.bind(this.reactiveDeclarations); + this.addImportStatement = this.importStatements.push.bind(this.importStatements); + storesResolvedInTemplate.forEach(this.addStoreAcess); + } + /** + * All variable declartaions and imports which + * were used as stores are appended with `let $xx = __sveltets_2_store_get(xx)` to create the store variables. + */ + modifyCode(astOffset, str) { + this.variableDeclarations.forEach((node) => this.attachStoreValueDeclarationToDecl(node, astOffset, str)); + this.reactiveDeclarations.forEach((node) => this.attachStoreValueDeclarationToReactiveAssignment(node, astOffset, str)); + this.attachStoreValueDeclarationOfImportsToRenderFn(str); + } + getAccessedStores() { + return [...this.accessedStores.keys()]; + } + getGlobals() { + const globals = new Set(this.accessedStores); + this.variableDeclarations.forEach((node) => extractIdentifiers(node.name).forEach((id) => globals.delete(id.text))); + this.reactiveDeclarations.forEach((node) => getNamesFromLabeledStatement(node).forEach((name) => globals.delete(name))); + this.importStatements.forEach(({ name }) => name && globals.delete(name.getText())); + return [...globals].map((name) => `$${name}`); + } + attachStoreValueDeclarationToDecl(node, astOffset, str) { + const storeNames = extractIdentifiers(node.name) + .map((id) => id.text) + .filter((name) => this.accessedStores.has(name)); + if (!storeNames.length) { + return; + } + const storeDeclarations = surroundWithIgnoreComments(this.createStoreDeclarations(storeNames)); + const nodeEnd = ts.isVariableDeclarationList(node.parent) && node.parent.declarations.length > 1 + ? node.parent.declarations[node.parent.declarations.length - 1].getEnd() + : node.getEnd(); + // Quick-fixing https://github.com/sveltejs/language-tools/issues/1950 + // TODO think about a SourceMap-wrapper that does these things for us, + // or investigate altering the inner workings of SourceMap, or investigate + // if we can always use prependStr here (and elsewhere, too) + if (getCurrentPrepends(str, nodeEnd + astOffset).length) { + preprendStr(str, nodeEnd + astOffset, storeDeclarations); + } + else { + str.appendRight(nodeEnd + astOffset, storeDeclarations); + } + } + attachStoreValueDeclarationToReactiveAssignment(node, astOffset, str) { + const storeNames = getNamesFromLabeledStatement(node).filter((name) => this.accessedStores.has(name)); + if (!storeNames.length) { + return; + } + const storeDeclarations = surroundWithIgnoreComments(this.createStoreDeclarations(storeNames)); + const endPos = node.getEnd() + astOffset; + // Quick-fixing https://github.com/sveltejs/language-tools/issues/1097 + // TODO think about a SourceMap-wrapper that does these things for us, + // or investigate altering the inner workings of SourceMap, or investigate + // if we can always use prependStr here (and elsewhere, too) + if (str.original.charAt(endPos - 1) !== ';') { + preprendStr(str, endPos, storeDeclarations); + } + else { + str.appendRight(endPos, storeDeclarations); + } + } + attachStoreValueDeclarationOfImportsToRenderFn(str) { + const storeNames = this.importStatements + .filter(({ name }) => name && this.accessedStores.has(name.getText())) + .map(({ name }) => name.getText()); + if (!storeNames.length) { + return; + } + const storeDeclarations = this.storeFromImportsWrapper(surroundWithIgnoreComments(this.createStoreDeclarations(storeNames))); + str.appendRight(this.renderFunctionStart, storeDeclarations); + } + createStoreDeclarations(storeNames) { + let declarations = ''; + for (let i = 0; i < storeNames.length; i++) { + declarations += this.createStoreDeclaration(storeNames[i]); + } + return declarations; + } + createStoreDeclaration(storeName) { + return `;let $${storeName} = __sveltets_2_store_get(${storeName});`; + } +} + +class ImplicitTopLevelNames { + constructor(str, astOffset) { + this.str = str; + this.astOffset = astOffset; + this.map = new Set(); + } + add(node) { + this.map.add(node); + } + handleReactiveStatement(node, binaryExpression) { + if (binaryExpression) { + this.wrapExpressionWithInvalidate(binaryExpression.right); + } + else { + const start = node.getStart() + this.astOffset; + const end = node.getEnd() + this.astOffset; + this.str.prependLeft(start, ';() => {'); + preprendStr(this.str, end, '}'); + } + } + wrapExpressionWithInvalidate(expression) { + if (!expression) { + return; + } + const start = expression.getStart() + this.astOffset; + const end = expression.getEnd() + this.astOffset; + // $: a = { .. }.. / $: a = .. as .. => () => ( .. ) + if (ts.isObjectLiteralExpression(expression) || + (expression.getText().startsWith('{') && + this.isNodeStartsWithObjectLiteral(expression)) || + ts.isAsExpression(expression)) { + this.str.appendLeft(start, '('); + this.str.appendRight(end, ')'); + } + this.str.prependLeft(start, '__sveltets_2_invalidate(() => '); + preprendStr(this.str, end, ')'); + // Not adding ';' at the end because right now this function is only invoked + // in situations where there is a line break of ; guaranteed to be present (else the code is invalid) + } + isNodeStartsWithObjectLiteral(node) { + if (ts.isObjectLiteralExpression(node)) { + return true; + } + if (ts.isElementAccessExpression(node)) { + return this.isNodeStartsWithObjectLiteral(node.expression); + } + if (ts.isBinaryExpression(node)) { + return this.isNodeStartsWithObjectLiteral(node.left); + } + if (ts.isConditionalExpression(node)) { + return this.isNodeStartsWithObjectLiteral(node.condition); + } + return node + .getChildren() + .filter((e) => e.pos === node.pos) + .some((child) => this.isNodeStartsWithObjectLiteral(child)); + } + modifyCode(rootVariables) { + for (const node of this.map.values()) { + const names = getNamesFromLabeledStatement(node); + if (names.length === 0) { + continue; + } + const implicitTopLevelNames = names.filter((name) => !rootVariables.has(name)); + const pos = node.label.getStart(); + if (this.hasOnlyImplicitTopLevelNames(names, implicitTopLevelNames)) { + // remove '$:' label + this.str.remove(pos + this.astOffset, pos + this.astOffset + 2); + this.str.prependRight(pos + this.astOffset, 'let '); + this.removeBracesFromParenthizedExpression(node); + } + else { + implicitTopLevelNames.forEach((name) => { + this.str.prependRight(pos + this.astOffset, `let ${name};\n`); + }); + } + } + } + hasOnlyImplicitTopLevelNames(names, implicitTopLevelNames) { + return names.length === implicitTopLevelNames.length; + } + removeBracesFromParenthizedExpression(node) { + // If expression is of type `$: ({a} = b);`, + // remove the surrounding braces so that the transformation + // to `let {a} = b;` produces valid code. + if (ts.isExpressionStatement(node.statement) && + isParenthesizedObjectOrArrayLiteralExpression(node.statement.expression)) { + const parenthesizedExpression = node.statement.expression; + const parenthesisStart = parenthesizedExpression.getStart() + this.astOffset; + const expressionStart = parenthesizedExpression.expression.getStart() + this.astOffset; + this.str.overwrite(parenthesisStart, expressionStart, '', { contentOnly: true }); + const parenthesisEnd = parenthesizedExpression.getEnd() + this.astOffset; + const expressionEnd = parenthesizedExpression.expression.getEnd() + this.astOffset; + // We need to keep the `)` of the "wrap with invalidate" expression above. + // We overwrite the same range so it's needed. + overwriteStr(this.str, expressionEnd, parenthesisEnd, ')', true); + } + } +} + +/** + * Transform type assertion to as expression: a => a as Type + */ +function handleTypeAssertion(str, assertion, astOffset) { + const { expression, type } = assertion; + const assertionStart = assertion.getStart() + astOffset; + const typeStart = type.getStart() + astOffset; + const typeEnd = type.getEnd() + astOffset; + const expressionStart = expression.getStart() + astOffset; + const expressionEnd = expression.getEnd() + astOffset; + str.appendLeft(expressionEnd, ' as '); + // move 'HTMLElement' to the end of expression + str.move(assertionStart, typeEnd, expressionEnd); + str.remove(assertionStart, typeStart); + // remove '>' + str.remove(typeEnd, expressionStart); +} + +/** + * move imports to top of script so they appear outside our render function + */ +function handleImportDeclaration(node, str, astOffset, scriptStart, sourceFile) { + return moveNode(node, str, astOffset, scriptStart, sourceFile); +} +/** + * ensure it's in a newline. + * if file has module script ensure an empty line to separate imports + */ +function handleFirstInstanceImport(tsAst, astOffset, hasModuleScript, str) { + var _a; + const imports = tsAst.statements.filter(ts.isImportDeclaration).sort((a, b) => a.end - b.end); + const firstImport = imports[0]; + if (!firstImport) { + return; + } + const firstComment = Array.from((_a = ts.getLeadingCommentRanges(firstImport.getFullText(), 0)) !== null && _a !== void 0 ? _a : []).sort((a, b) => a.pos - b.pos)[0]; + const start = firstComment && firstComment.kind === ts.SyntaxKind.MultiLineCommentTrivia + ? firstComment.pos + firstImport.getFullStart() + : firstImport.getStart(); + str.appendRight(start + astOffset, '\n' + (hasModuleScript ? '\n' : '')); + // Add a semi-colon to the last import if it doesn't have one, to prevent auto completion + // and imports from being added at the wrong position + const lastImport = imports[imports.length - 1]; + const end = lastImport.end + astOffset - 1; + if (str.original[end] !== ';') { + str.overwrite(end, lastImport.end + astOffset, str.original[end] + ';\n'); + } +} + +function flatten(arr) { + return arr.reduce((acc, val) => acc.concat(val), []); +} + +class InterfacesAndTypes { + constructor() { + this.node = null; + this.all = []; + this.references = new Map(); + } + add(node) { + this.all.push(node); + } + getNodesWithNames(names) { + return this.all.filter((node) => names.includes(node.name.text)); + } + // The following could be used to create a informative error message in case + // someone has an interface that both references a generic and is used by one: + addReference(reference) { + if (!this.node) { + return; + } + const references = this.references.get(this.node) || []; + references.push(reference); + this.references.set(this.node, references); + } + getNodesThatReferenceType(name) { + const nodes = []; + for (const [node, references] of this.references) { + if (references.some((r) => r.typeName.getText() === name)) { + nodes.push(node); + } + } + return nodes; + } + getNodesThatRecursivelyReferenceType(name) { + let types = [name]; + const nodes = new Set(); + while (types.length !== 0) { + const newTypes = flatten(types.map((type) => this.getNodesThatReferenceType(type))).filter((t) => !nodes.has(t)); + newTypes.forEach((t) => nodes.add(t)); + types = newTypes.map((t) => t.name.text); + } + return [...nodes.values()]; + } + getNodesThatRecursivelyReferenceTypes(names) { + return flatten(names.map((name) => this.getNodesThatRecursivelyReferenceType(name))); + } +} + +function processInstanceScriptContent(str, script, events, implicitStoreValues, mode, moduleAst, isTSFile, basename, isSvelte5Plus, isRunes) { + const htmlx = str.original; + const scriptContent = htmlx.substring(script.content.start, script.content.end); + const tsAst = ts.createSourceFile('component.ts.svelte', scriptContent, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + const astOffset = script.content.start; + const exportedNames = new ExportedNames(str, astOffset, basename, isTSFile, isSvelte5Plus, isRunes); + const generics = new Generics(str, astOffset, script); + const interfacesAndTypes = new InterfacesAndTypes(); + if (moduleAst) { + moduleAst.tsAst.forEachChild((n) => exportedNames.hoistableInterfaces.analyzeModuleScriptNode(n)); + } + const implicitTopLevelNames = new ImplicitTopLevelNames(str, astOffset); + let uses$$props = false; + let uses$$restProps = false; + let uses$$slots = false; + let uses$$SlotsInterface = false; + //track if we are in a declaration scope + let isDeclaration = false; + //track $store variables since we are only supposed to give top level scopes special treatment, and users can declare $blah variables at higher scopes + //which prevents us just changing all instances of Identity that start with $ + const pendingStoreResolutions = []; + let scope = new Scope$1(); + const rootScope = scope; + const pushScope = () => (scope = new Scope$1(scope)); + const popScope = () => (scope = scope.parent); + const resolveStore = (pending) => { + let { node, scope } = pending; + const name = node.text; + while (scope) { + if (scope.declared.has(name)) { + //we were manually declared, this isn't a store access. + return; + } + scope = scope.parent; + } + const storename = node.getText().slice(1); + implicitStoreValues.addStoreAcess(storename); + }; + const handleIdentifier = (ident, parent) => { + if (ident.text === '$$props') { + uses$$props = true; + return; + } + if (ident.text === '$$restProps') { + uses$$restProps = true; + return; + } + if (ident.text === '$$slots') { + uses$$slots = true; + return; + } + if (ts.isLabeledStatement(parent) && parent.label == ident) { + return; + } + if (isDeclaration || ts.isParameter(parent)) { + if (isNotPropertyNameOfImport(ident) && + (!ts.isBindingElement(ident.parent) || ident.parent.name == ident)) { + // we are a key, not a name, so don't care + if (ident.text.startsWith('$') || scope == rootScope) { + // track all top level declared identifiers and all $ prefixed identifiers + scope.declared.add(ident.text); + } + } + } + else { + const text = ident.text; + //track potential store usage to be resolved + if (text.startsWith('$')) { + if ((!ts.isPropertyAccessExpression(parent) || parent.expression == ident) && + (!ts.isPropertyAssignment(parent) || parent.initializer == ident) && + !ts.isPropertySignature(parent) && + !ts.isPropertyDeclaration(parent) && + !ts.isTypeReferenceNode(parent) && + !ts.isTypeAliasDeclaration(parent) && + !ts.isInterfaceDeclaration(parent)) { + // Handle the const { ...props } = $props() case + const is_rune = (text === '$props' || text === '$derived' || text === '$state') && + ts.isCallExpression(parent) && + ts.isVariableDeclaration(parent.parent) && + parent.parent.name.getText().includes(text.slice(1)); + if (!is_rune) { + pendingStoreResolutions.push({ node: ident, parent, scope }); + } + } + } + } + }; + const walk = (node, parent) => { + var _a, _b, _c; + const onLeaveCallbacks = []; + if (parent === tsAst) { + exportedNames.hoistableInterfaces.analyzeInstanceScriptNode(node); + } + generics.addIfIsGeneric(node); + if (is$$EventsDeclaration(node)) { + events.setComponentEventsInterface(node, astOffset); + } + if (is$$SlotsDeclaration(node)) { + uses$$SlotsInterface = true; + } + if (is$$PropsDeclaration(node)) { + exportedNames.uses$$Props = true; + } + if (ts.isVariableStatement(node)) { + exportedNames.handleVariableStatement(node, parent); + } + if (ts.isFunctionDeclaration(node)) { + exportedNames.handleExportFunctionOrClass(node); + } + if (ts.isClassDeclaration(node)) { + exportedNames.handleExportFunctionOrClass(node); + } + if (ts.isBlock(node) || ts.isFunctionLike(node)) { + pushScope(); + onLeaveCallbacks.push(() => popScope()); + } + if (ts.isExportDeclaration(node)) { + exportedNames.handleExportDeclaration(node); + } + if (ts.isImportDeclaration(node)) { + handleImportDeclaration(node, str, astOffset, script.start, tsAst); + // Check if import is the event dispatcher + events.checkIfImportIsEventDispatcher(node); + } + // workaround for import statement completion + if (ts.isImportEqualsDeclaration(node)) { + const end = node.getEnd() + astOffset; + if (str.original[end - 1] !== ';') { + preprendStr(str, end, ';'); + } + } + if (ts.isVariableDeclaration(node)) { + events.checkIfIsStringLiteralDeclaration(node); + events.checkIfDeclarationInstantiatedEventDispatcher(node); + // Only top level declarations can be stores + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent) === tsAst) { + implicitStoreValues.addVariableDeclaration(node); + } + } + if (ts.isCallExpression(node)) { + events.checkIfCallExpressionIsDispatch(node); + } + if (ts.isVariableDeclaration(parent) && parent.name == node) { + isDeclaration = true; + onLeaveCallbacks.push(() => (isDeclaration = false)); + } + if (ts.isBindingElement(parent) && parent.name == node) { + isDeclaration = true; + onLeaveCallbacks.push(() => (isDeclaration = false)); + } + if (ts.isImportClause(node)) { + isDeclaration = true; + onLeaveCallbacks.push(() => (isDeclaration = false)); + implicitStoreValues.addImportStatement(node); + } + if (ts.isImportSpecifier(node)) { + implicitStoreValues.addImportStatement(node); + } + if (ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node)) { + interfacesAndTypes.node = node; + interfacesAndTypes.add(node); + onLeaveCallbacks.push(() => (interfacesAndTypes.node = null)); + } + //handle stores etc + if (ts.isIdentifier(node)) { + handleIdentifier(node, parent); + } + //track implicit declarations in reactive blocks at the top level + if (ts.isLabeledStatement(node) && + parent == tsAst && //top level + node.label.text == '$' && + node.statement) { + const binaryExpression = getBinaryAssignmentExpr(node); + if (binaryExpression) { + implicitTopLevelNames.add(node); + implicitStoreValues.addReactiveDeclaration(node); + } + implicitTopLevelNames.handleReactiveStatement(node, binaryExpression); + } + // Defensively call function (checking for undefined) because it got added only recently (TS 4.0) + // and therefore might break people using older TS versions + // Don't transform in ts mode because value type assertions are valid in this case + if (mode !== 'ts' && ((_c = ts.isTypeAssertionExpression) === null || _c === void 0 ? void 0 : _c.call(ts, node))) { + handleTypeAssertion(str, node, astOffset); + } + //to save a bunch of condition checks on each node, we recurse into processChild which skips all the checks for top level items + ts.forEachChild(node, (n) => walk(n, node)); + //fire off the on leave callbacks + onLeaveCallbacks.map((c) => c()); + }; + //walk the ast and convert to tsx as we go + tsAst.forEachChild((n) => walk(n, tsAst)); + //resolve stores + pendingStoreResolutions.map(resolveStore); + // declare implicit reactive variables we found in the script + implicitTopLevelNames.modifyCode(rootScope.declared); + implicitStoreValues.modifyCode(astOffset, str); + handleFirstInstanceImport(tsAst, astOffset, !!moduleAst, str); + // move interfaces and types out of the render function if they are referenced + // by a $$Generic, otherwise it will be used before being defined after the transformation + const nodesToMove = interfacesAndTypes.getNodesWithNames(generics.getTypeReferences()); + for (const node of nodesToMove) { + moveNode(node, str, astOffset, script.start, tsAst); + } + const hoisted = exportedNames.hoistableInterfaces.moveHoistableInterfaces(str, astOffset, script.start + 1, // +1 because imports are also moved at that position, and we want to move interfaces after imports + generics.getReferences()); + if (mode === 'dts') { + // Transform interface declarations to type declarations because indirectly + // using interfaces inside the return type of a function is forbidden. + // This is not a problem for intellisense/type inference but it will + // break dts generation (file will not be generated). + if (hoisted) { + transformInterfacesToTypes(tsAst, str, astOffset, [...hoisted.values()].concat(nodesToMove)); + } + else { + transformInterfacesToTypes(tsAst, str, astOffset, nodesToMove); + } + } + return { + exportedNames, + events, + uses$$props, + uses$$restProps, + uses$$slots, + uses$$SlotsInterface, + generics + }; +} +function transformInterfacesToTypes(tsAst, str, astOffset, movedNodes) { + tsAst.statements + .filter(ts.isInterfaceDeclaration) + .filter((i) => !movedNodes.includes(i)) + .forEach((node) => { + var _a; + str.overwrite(node.getStart() + astOffset, node.getStart() + astOffset + 'interface'.length, 'type'); + if ((_a = node.heritageClauses) === null || _a === void 0 ? void 0 : _a.length) { + const extendsStart = node.heritageClauses[0].getStart() + astOffset; + str.overwrite(extendsStart, extendsStart + 'extends'.length, '='); + const extendsList = node.heritageClauses[0].types; + let prev = extendsList[0]; + extendsList.slice(1).forEach((heritageClause) => { + str.overwrite(prev.getEnd() + astOffset, heritageClause.getStart() + astOffset, ' & '); + prev = heritageClause; + }); + str.appendLeft(node.heritageClauses[0].getEnd() + astOffset, ' & '); + } + else { + str.prependLeft(str.original.indexOf('{', node.getStart() + astOffset), '='); + } + }); +} + +function createModuleAst(str, script) { + const htmlx = str.original; + const scriptContent = htmlx.substring(script.content.start, script.content.end); + const tsAst = ts.createSourceFile('component.module.ts.svelte', scriptContent, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + const astOffset = script.content.start; + return { htmlx, tsAst, astOffset }; +} +function processModuleScriptTag(str, script, implicitStoreValues, moduleAst) { + const { htmlx, tsAst, astOffset } = moduleAst; + const generics = new Generics(str, astOffset, script); + if (generics.genericsAttr) { + const start = htmlx.indexOf('generics', script.start); + throwError(start, start + 8, 'The generics attribute is only allowed on the instance script', str.original); + } + const walk = (node) => { + resolveImplicitStoreValue(node, implicitStoreValues, str, astOffset); + generics.throwIfIsGeneric(node); + throwIfIs$$EventsDeclaration(node, str, astOffset); + throwIfIs$$SlotsDeclaration(node, str, astOffset); + throwIfIs$$PropsDeclaration(node, str, astOffset); + ts.forEachChild(node, (n) => walk(n)); + }; + //walk the ast and convert to tsx as we go + tsAst.forEachChild((n) => walk(n)); + // declare store declarations we found in the script + implicitStoreValues.modifyCode(astOffset, str); + const scriptStartTagEnd = htmlx.indexOf('>', script.start) + 1; + const scriptEndTagStart = htmlx.lastIndexOf('<', script.end - 1); + str.overwrite(script.start, scriptStartTagEnd, ';', { + contentOnly: true + }); + str.overwrite(scriptEndTagStart, script.end, ';', { + contentOnly: true + }); +} +function resolveImplicitStoreValue(node, implicitStoreValues, str, astOffset) { + var _a; + if (ts.isVariableDeclaration(node)) { + implicitStoreValues.addVariableDeclaration(node); + } + if (ts.isImportClause(node)) { + implicitStoreValues.addImportStatement(node); + } + if (ts.isImportSpecifier(node)) { + implicitStoreValues.addImportStatement(node); + } + if ((_a = ts.isTypeAssertionExpression) === null || _a === void 0 ? void 0 : _a.call(ts, node)) { + handleTypeAssertion(str, node, astOffset); + } +} +function throwIfIs$$EventsDeclaration(node, str, astOffset) { + if (is$$EventsDeclaration(node)) { + throw$$Error(node, str, astOffset, '$$Events'); + } +} +function throwIfIs$$SlotsDeclaration(node, str, astOffset) { + if (is$$SlotsDeclaration(node)) { + throw$$Error(node, str, astOffset, '$$Slots'); + } +} +function throwIfIs$$PropsDeclaration(node, str, astOffset) { + if (is$$PropsDeclaration(node)) { + throw$$Error(node, str, astOffset, '$$Props'); + } +} +function throw$$Error(node, str, astOffset, type) { + throwError(node.getStart() + astOffset, node.getEnd() + astOffset, `${type} can only be declared in the instance script`, str.original); +} + +function processSvelteTemplate(str, parse, options) { + const { htmlxAst, tags } = parseHtmlx(str.original, parse, options); + return convertHtmlxToJsx(str, htmlxAst, tags, options); +} +function svelte2tsx(svelte, options = { parse }) { + options.mode = options.mode || 'ts'; + options.version = options.version || VERSION; + const str = new MagicString(svelte); + const basename = path__default.basename(options.filename || ''); + const svelte5Plus = Number(options.version[0]) > 4; + // process the htmlx as a svelte template + let { htmlAst, moduleScriptTag, scriptTag, rootSnippets, slots, uses$$props, uses$$slots, uses$$restProps, events, componentDocumentation, resolvedStores, usesAccessors, isRunes } = processSvelteTemplate(str, options.parse || parse, { + ...options, + svelte5Plus + }); + /* Rearrange the script tags so that module is first, and instance second followed finally by the template + * This is a bit convoluted due to some trouble I had with magic string. A simple str.move(start,end,0) for each script wasn't enough + * since if the module script was already at 0, it wouldn't move (which is fine) but would mean the order would be swapped when the script tag tried to move to 0 + * In this case we instead have to move it to moduleScriptTag.end. We track the location for the script move in the MoveInstanceScriptTarget var + */ + let instanceScriptTarget = 0; + let moduleAst; + if (moduleScriptTag) { + moduleAst = createModuleAst(str, moduleScriptTag); + if (moduleScriptTag.start != 0) { + //move our module tag to the top + str.move(moduleScriptTag.start, moduleScriptTag.end, 0); + } + else { + //since our module script was already at position 0, we need to move our instance script tag to the end of it. + instanceScriptTarget = moduleScriptTag.end; + } + } + const renderFunctionStart = scriptTag + ? str.original.lastIndexOf('>', scriptTag.content.start) + 1 + : instanceScriptTarget; + const implicitStoreValues = new ImplicitStoreValues(resolvedStores, renderFunctionStart); + //move the instance script and process the content + let exportedNames = new ExportedNames(str, 0, basename, options === null || options === void 0 ? void 0 : options.isTsFile, svelte5Plus, isRunes); + let generics = new Generics(str, 0, { attributes: [] }); + let uses$$SlotsInterface = false; + if (scriptTag) { + //ensure it is between the module script and the rest of the template (the variables need to be declared before the jsx template) + if (scriptTag.start != instanceScriptTarget) { + str.move(scriptTag.start, scriptTag.end, instanceScriptTarget); + } + const res = processInstanceScriptContent(str, scriptTag, events, implicitStoreValues, options.mode, moduleAst, options === null || options === void 0 ? void 0 : options.isTsFile, basename, svelte5Plus, isRunes); + uses$$props = uses$$props || res.uses$$props; + uses$$restProps = uses$$restProps || res.uses$$restProps; + uses$$slots = uses$$slots || res.uses$$slots; + ({ exportedNames, events, generics, uses$$SlotsInterface } = res); + } + exportedNames.usesAccessors = usesAccessors; + if (svelte5Plus) { + exportedNames.checkGlobalsForRunes(implicitStoreValues.getGlobals()); + } + //wrap the script tag and template content in a function returning the slot and exports + createRenderFunction({ + str, + scriptTag, + scriptDestination: instanceScriptTarget, + slots, + events, + exportedNames, + uses$$props, + uses$$restProps, + uses$$slots, + uses$$SlotsInterface, + generics, + svelte5Plus, + mode: options.mode + }); + // we need to process the module script after the instance script has moved otherwise we get warnings about moving edited items + if (moduleScriptTag) { + processModuleScriptTag(str, moduleScriptTag, new ImplicitStoreValues(implicitStoreValues.getAccessedStores(), renderFunctionStart, scriptTag || options.mode === 'ts' ? undefined : (input) => `;${input}<>`), moduleAst); + if (!scriptTag) { + moduleAst.tsAst.forEachChild((node) => exportedNames.hoistableInterfaces.analyzeModuleScriptNode(node)); + } + } + if (moduleScriptTag || scriptTag) { + const allowed = exportedNames.hoistableInterfaces.getAllowedValues(); + for (const [start, end, globals] of rootSnippets) { + const hoist_to_module = moduleScriptTag && + (globals.size === 0 || [...globals.keys()].every((id) => allowed.has(id))); + if (hoist_to_module) { + str.move(start, end, scriptTag + ? scriptTag.start + 1 // +1 because imports are also moved at that position, and we want to move interfaces after imports + : moduleScriptTag.end); + } + else if (scriptTag) { + str.move(start, end, renderFunctionStart); + } + } + } + addComponentExport({ + str, + canHaveAnyProp: !exportedNames.uses$$Props && (uses$$props || uses$$restProps), + events, + isTsFile: options === null || options === void 0 ? void 0 : options.isTsFile, + exportedNames, + usesAccessors, + usesSlots: slots.size > 0, + fileName: options === null || options === void 0 ? void 0 : options.filename, + componentDocumentation, + mode: options.mode, + generics, + isSvelte5: svelte5Plus, + noSvelteComponentTyped: options.noSvelteComponentTyped + }); + if (options.mode === 'dts') { + // Prepend the import which is used for TS files + // The other shims need to be provided by the user ambient-style, + // for example through filenames.push(require.resolve('svelte2tsx/svelte-shims.d.ts')) + // TODO replace with SvelteComponent for Svelte 5, keep old for backwards compatibility with Svelte 3 + if (options.noSvelteComponentTyped) { + str.prepend('import { SvelteComponent } from "svelte"\n' + '\n'); + } + else { + str.prepend('import { SvelteComponentTyped } from "svelte"\n' + '\n'); + } + let code = str.toString(); + // Remove all tsx occurences and the template part from the output + code = code + // prepended before each script block + .replace('<>;', '') + .replace('<>;', '') + // tsx in render function + .replace(/<>.*<\/>/s, '') + .replace('\n() => ();', ''); + return { + code + }; + } + else { + str.prepend('///\n'); + return { + code: str.toString(), + map: str.generateMap({ hires: true, source: options === null || options === void 0 ? void 0 : options.filename }), + exportedNames: exportedNames.getExportsMap(), + events: events.createAPI(), + // not part of the public API so people don't start using it + htmlAst + }; + } +} + +async function emitDts(config) { + const svelteMap = await createSvelteMap(config); + const { options, filenames } = loadTsconfig(config, svelteMap); + const host = await createTsCompilerHost(options, svelteMap); + const program = ts.createProgram(filenames, options, host); + const result = program.emit(); + const likely_failed_files = result.diagnostics.filter((diagnostic) => { + // List of errors which hint at a failed d.ts generation + // https://github.com/microsoft/TypeScript/blob/main/src/compiler/diagnosticMessages.json + return (diagnostic.code === 2527 || + diagnostic.code === 5088 || + diagnostic.code === 2742 || + (diagnostic.code >= 9005 && diagnostic.code <= 9039) || + (diagnostic.code >= 4000 && diagnostic.code <= 4108)); + }); + if (likely_failed_files.length > 0) { + const failed_by_file = new Map(); + likely_failed_files.forEach((diagnostic) => { + var _a; + const file = (_a = diagnostic.file) === null || _a === void 0 ? void 0 : _a.fileName; + if (file) { + const errors = failed_by_file.get(file) || []; + errors.push(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')); + failed_by_file.set(file, errors); + } + }); + console.warn('d.ts type declaration files for the following files were likely not generated due to the following errors:'); + console.warn([...failed_by_file.entries()] + .map(([file, errors]) => { + return `${file}\n${errors.map((error) => ` - ${error}`).join('\n')}`; + }) + .join('\n')); + } +} +function loadTsconfig(config, svelteMap) { + var _a; + const libRoot = config.libRoot || process.cwd(); + const jsconfigFile = ts.findConfigFile(libRoot, ts.sys.fileExists, 'jsconfig.json'); + let tsconfigFile = ts.findConfigFile(libRoot, ts.sys.fileExists, config.tsconfig); + if (!tsconfigFile && !jsconfigFile) { + throw new Error('Failed to locate tsconfig or jsconfig'); + } + tsconfigFile = tsconfigFile || jsconfigFile; + if (jsconfigFile && isSubpath(path.dirname(tsconfigFile), path.dirname(jsconfigFile))) { + tsconfigFile = jsconfigFile; + } + tsconfigFile = path.isAbsolute(tsconfigFile) ? tsconfigFile : path.join(libRoot, tsconfigFile); + const basepath = path.dirname(tsconfigFile); + const { error, config: tsConfig } = ts.readConfigFile(tsconfigFile, ts.sys.readFile); + if (error) { + throw new Error('Malformed tsconfig\n' + JSON.stringify(error, null, 2)); + } + // Rewire includes and files. This ensures that only the files inside the lib are traversed and + // that the outputted types have the correct directory depth. + // This is a little brittle because we then may include more than the user wants + const libPathRelative = path.relative(basepath, libRoot).split(path.sep).join('/'); + if (libPathRelative) { + tsConfig.include = [`${libPathRelative}/**/*`]; + tsConfig.files = []; + } + const { options, fileNames } = ts.parseJsonConfigFileContent(tsConfig, ts.sys, basepath, { sourceMap: false, rootDir: config.libRoot }, tsconfigFile, undefined, [{ extension: 'svelte', isMixedContent: true, scriptKind: ts.ScriptKind.Deferred }]); + const filenames = fileNames.map((name) => { + if (!isSvelteFilepath(name)) { + return name; + } + // We need to trick TypeScript into thinking that Svelte files + // are either TS or JS files in order to generate correct d.ts + // definition files. + const isTsFile = svelteMap.add(name); + return name + (isTsFile ? '.ts' : '.js'); + }); + // Add ambient functions so TS knows how to resolve its invocations in the + // code output of svelte2tsx. + filenames.push(config.svelteShimsPath); + return { + options: { + ...options, + noEmit: false, // Set to true in case of jsconfig, force false, else nothing is emitted + moduleResolution: + // NodeJS: up to 4.9, Node10: since 5.0 + (_a = ts.ModuleResolutionKind.NodeJs) !== null && _a !== void 0 ? _a : ts.ModuleResolutionKind.Node10, // Classic if not set, which gives wrong results + declaration: true, // Needed for d.ts file generation + emitDeclarationOnly: true, // We only want d.ts file generation + declarationDir: config.declarationDir, // Where to put the declarations + allowNonTsExtensions: true + }, + filenames + }; +} +async function createTsCompilerHost(options, svelteMap) { + const host = ts.createCompilerHost(options); + // TypeScript writes the files relative to the found tsconfig/jsconfig + // which - at least in the case of the tests - is wrong. Therefore prefix + // the output paths. See Typescript issue #25430 for more. + const pathPrefix = path + .relative(process.cwd(), path.dirname(options.configFilePath)) + .split(path.sep) + .join('/'); + const svelteSys = { + ...ts.sys, + fileExists(originalPath) { + let exists = ts.sys.fileExists(originalPath); + if (exists) { + return true; + } + const path = ensureRealSvelteFilepath(originalPath); + if (path === originalPath) { + return false; + } + exists = ts.sys.fileExists(path); + if (exists && isSvelteFilepath(path)) { + const isTsFile = svelteMap.add(path); + if ((isTsFile && !isTsFilepath(originalPath)) || + (!isTsFile && isTsFilepath(originalPath))) { + return false; + } + } + return exists; + }, + readFile(path, encoding = 'utf-8') { + const sveltePath = ensureRealSvelteFilepath(path); + if (path !== sveltePath || isSvelteFilepath(path)) { + const result = svelteMap.get(sveltePath); + if (result === undefined) { + return ts.sys.readFile(path, encoding); + } + else { + return result; + } + } + else { + return ts.sys.readFile(path, encoding); + } + }, + readDirectory(path, extensions, exclude, include, depth) { + const extensionsWithSvelte = (extensions || []).concat('.svelte'); + return ts.sys.readDirectory(path, extensionsWithSvelte, exclude, include, depth); + }, + writeFile(fileName, data, writeByteOrderMark) { + fileName = pathPrefix ? path.join(pathPrefix, fileName) : fileName; + if (fileName.endsWith('d.ts.map')) { + data = data.replace(/"sources":\["(.+?)"\]/, (_, sourcePath) => { + // The inverse of the pathPrefix adjustment + sourcePath = + pathPrefix && sourcePath.includes(pathPrefix) + ? sourcePath.slice(0, sourcePath.indexOf(pathPrefix)) + + sourcePath.slice(sourcePath.indexOf(pathPrefix) + pathPrefix.length + 1) + : sourcePath; + // Due to our hack of treating .svelte files as .ts files, we need to adjust the extension + if (svelteMap.get(path.join(options.rootDir, toRealSvelteFilepath(sourcePath)))) { + sourcePath = toRealSvelteFilepath(sourcePath); + } + return `"sources":["${sourcePath}"]`; + }); + } + else if (fileName.endsWith('js.map')) { + data = data.replace(/"sources":\["(.+?)"\]/, (_, sourcePath) => { + // The inverse of the pathPrefix adjustment + sourcePath = + pathPrefix && sourcePath.includes(pathPrefix) + ? sourcePath.slice(0, sourcePath.indexOf(pathPrefix)) + + sourcePath.slice(sourcePath.indexOf(pathPrefix) + pathPrefix.length + 1) + : sourcePath; + return `"sources":["${sourcePath}"]`; + }); + } + return ts.sys.writeFile(fileName, data, writeByteOrderMark); + } + }; + host.fileExists = svelteSys.fileExists; + host.readFile = svelteSys.readFile; + host.readDirectory = svelteSys.readDirectory; + host.writeFile = svelteSys.writeFile; + host.resolveModuleNames = (moduleNames, containingFile, _reusedNames, _redirectedReference, compilerOptions) => { + return moduleNames.map((moduleName) => { + return resolveModuleName(moduleName, containingFile, compilerOptions); + }); + }; + host.resolveModuleNameLiterals = (moduleLiterals, containingFile, _redirectedReference, compilerOptions) => { + return moduleLiterals.map((moduleLiteral) => { + return { + resolvedModule: resolveModuleName(moduleLiteral.text, containingFile, compilerOptions) + }; + }); + }; + function resolveModuleName(name, containingFile, compilerOptions) { + // Delegate to the TS resolver first. + // If that does not bring up anything, try the Svelte Module loader + // which is able to deal with .svelte files. + const tsResolvedModule = ts.resolveModuleName(name, containingFile, compilerOptions, ts.sys).resolvedModule; + if (tsResolvedModule && !isVirtualSvelteFilepath(tsResolvedModule.resolvedFileName)) { + return tsResolvedModule; + } + return ts.resolveModuleName(name, containingFile, compilerOptions, svelteSys) + .resolvedModule; + } + return host; +} +/** + * Generates a map to which we add the transformed code of Svelte files + * early on when we first need to look at the file contents and can read + * those transformed source later on. + */ +async function createSvelteMap(config) { + const svelteFiles = new Map(); + // TODO detect Svelte version in here and set shimsPath accordingly if not given from above + const noSvelteComponentTyped = config.svelteShimsPath + .replace(/\\/g, '/') + .endsWith('svelte2tsx/svelte-shims-v4.d.ts'); + const version = noSvelteComponentTyped ? undefined : '3.42.0'; + function add(path) { + const code = ts.sys.readFile(path, 'utf-8'); + const isTsFile = /]*?lang=('|")(ts|typescript)('|")/.test(code); + const transformed = svelte2tsx(code, { + filename: path, + isTsFile, + mode: 'dts', + version, + noSvelteComponentTyped: noSvelteComponentTyped + }).code; + svelteFiles.set(path.replace(/\\/g, '/'), transformed); + return isTsFile; + } + return { + add, + get: (key) => svelteFiles.get(key.replace(/\\/g, '/')) + }; +} +function isSvelteFilepath(filePath) { + return filePath.endsWith('.svelte'); +} +function isTsFilepath(filePath) { + return filePath.endsWith('.ts'); +} +function isVirtualSvelteFilepath(filePath) { + return filePath.endsWith('.svelte.ts') || filePath.endsWith('svelte.js'); +} +function toRealSvelteFilepath(filePath) { + return filePath.slice(0, -3); // -'.js'.length || -'.ts'.length +} +function ensureRealSvelteFilepath(filePath) { + return isVirtualSvelteFilepath(filePath) ? toRealSvelteFilepath(filePath) : filePath; +} +function isSubpath(maybeParent, maybeChild) { + const relative = path.relative(maybeParent, maybeChild); + return relative && !relative.startsWith('..') && !path.isAbsolute(relative); +} + +export { emitDts, internalHelpers, svelte2tsx }; diff --git a/node_modules/svelte2tsx/package.json b/node_modules/svelte2tsx/package.json new file mode 100644 index 00000000..fbf92084 --- /dev/null +++ b/node_modules/svelte2tsx/package.json @@ -0,0 +1,70 @@ +{ + "name": "svelte2tsx", + "version": "0.7.31", + "description": "Convert Svelte components to TSX for type checking", + "author": "David Pershouse", + "license": "MIT", + "keywords": [ + "svelte", + "typescript" + ], + "homepage": "https://github.com/sveltejs/language-tools/tree/master/packages/svelte2tsx", + "repository": { + "type": "git", + "url": "https://github.com/sveltejs/language-tools/tree/master/packages/svelte2tsx" + }, + "type": "commonjs", + "main": "index.js", + "module": "index.mjs", + "types": "index.d.ts", + "devDependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.25", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-node-resolve": "^15.0.0", + "@rollup/plugin-typescript": "^10.0.0", + "@types/estree": "^0.0.42", + "@types/mocha": "^9.1.0", + "@types/node": "^18.0.0", + "@types/unist": "^2.0.3", + "@types/vfile": "^3.0.2", + "builtin-modules": "^3.3.0", + "estree-walker": "^2.0.1", + "magic-string": "^0.30.11", + "mocha": "^9.2.0", + "periscopic": "^2.0.2", + "rollup": "3.7.5", + "rollup-plugin-delete": "^2.0.0", + "source-map-support": "^0.5.16", + "svelte": "~4.2.19", + "tiny-glob": "^0.2.6", + "tslib": "^2.4.0", + "typescript": "~5.6.3" + }, + "peerDependencies": { + "svelte": "^3.55 || ^4.0.0-next.0 || ^4.0 || ^5.0.0-next.0", + "typescript": "^4.9.4 || ^5.0.0" + }, + "files": [ + "index.mjs", + "index.js", + "index.d.ts", + "README.md", + "LICENSE", + "svelte-jsx.d.ts", + "svelte-jsx-v4.d.ts", + "svelte-native-jsx.d.ts", + "svelte-shims.d.ts", + "svelte-shims-v4.d.ts" + ], + "dependencies": { + "dedent-js": "^1.0.1", + "pascal-case": "^3.1.1" + }, + "scripts": { + "build": "rollup -c", + "dev": "rollup -c -w", + "test": "mocha test/test.ts" + } +} \ No newline at end of file diff --git a/node_modules/svelte2tsx/svelte-jsx-v4.d.ts b/node_modules/svelte2tsx/svelte-jsx-v4.d.ts new file mode 100644 index 00000000..61929e39 --- /dev/null +++ b/node_modules/svelte2tsx/svelte-jsx-v4.d.ts @@ -0,0 +1,230 @@ +/// + +declare namespace svelteHTML { + + // Every namespace eligible for use needs to implement the following two functions + /** + * @internal do not use + */ + function mapElementTag( + tag: K + ): ElementTagNameMap[K]; + function mapElementTag( + tag: K + ): SVGElementTagNameMap[K]; + function mapElementTag( + tag: any + ): any; // needs to be any because used in context of + + /** + * @internal do not use + */ + function createElement( + // "undefined | null" because of + element: Key | undefined | null, attrs: string extends Key ? import('svelte/elements').HTMLAttributes : Elements[Key] + ): Key extends keyof ElementTagNameMap ? ElementTagNameMap[Key] : Key extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Key] : any; + function createElement( + // "undefined | null" because of + element: Key | undefined | null, attrsEnhancers: T, attrs: (string extends Key ? import('svelte/elements').HTMLAttributes : Elements[Key]) & T + ): Key extends keyof ElementTagNameMap ? ElementTagNameMap[Key] : Key extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Key] : any; + + // For backwards-compatibility and ease-of-use, in case someone enhanced the typings from import('svelte/elements').HTMLAttributes/SVGAttributes + interface HTMLAttributes {} + interface SVGAttributes {} + + /** + * @internal do not use + */ + type HTMLProps = + Omit & Override; + + interface IntrinsicElements { + a: HTMLProps<'a', HTMLAttributes>; + abbr: HTMLProps<'abbr', HTMLAttributes>; + address: HTMLProps<'address', HTMLAttributes>; + area: HTMLProps<'area', HTMLAttributes>; + article: HTMLProps<'article', HTMLAttributes>; + aside: HTMLProps<'aside', HTMLAttributes>; + audio: HTMLProps<'audio', HTMLAttributes>; + b: HTMLProps<'b', HTMLAttributes>; + base: HTMLProps<'base', HTMLAttributes>; + bdi: HTMLProps<'bdi', HTMLAttributes>; + bdo: HTMLProps<'bdo', HTMLAttributes>; + big: HTMLProps<'big', HTMLAttributes>; + blockquote: HTMLProps<'blockquote', HTMLAttributes>; + body: HTMLProps<'body', HTMLAttributes>; + br: HTMLProps<'br', HTMLAttributes>; + button: HTMLProps<'button', HTMLAttributes>; + canvas: HTMLProps<'canvas', HTMLAttributes>; + caption: HTMLProps<'caption', HTMLAttributes>; + cite: HTMLProps<'cite', HTMLAttributes>; + code: HTMLProps<'code', HTMLAttributes>; + col: HTMLProps<'col', HTMLAttributes>; + colgroup: HTMLProps<'colgroup', HTMLAttributes>; + data: HTMLProps<'data', HTMLAttributes>; + datalist: HTMLProps<'datalist', HTMLAttributes>; + dd: HTMLProps<'dd', HTMLAttributes>; + del: HTMLProps<'del', HTMLAttributes>; + details: HTMLProps<'details', HTMLAttributes>; + dfn: HTMLProps<'dfn', HTMLAttributes>; + dialog: HTMLProps<'dialog', HTMLAttributes>; + div: HTMLProps<'div', HTMLAttributes>; + dl: HTMLProps<'dl', HTMLAttributes>; + dt: HTMLProps<'dt', HTMLAttributes>; + em: HTMLProps<'em', HTMLAttributes>; + embed: HTMLProps<'embed', HTMLAttributes>; + fieldset: HTMLProps<'fieldset', HTMLAttributes>; + figcaption: HTMLProps<'figcaption', HTMLAttributes>; + figure: HTMLProps<'figure', HTMLAttributes>; + footer: HTMLProps<'footer', HTMLAttributes>; + form: HTMLProps<'form', HTMLAttributes>; + h1: HTMLProps<'h1', HTMLAttributes>; + h2: HTMLProps<'h2', HTMLAttributes>; + h3: HTMLProps<'h3', HTMLAttributes>; + h4: HTMLProps<'h4', HTMLAttributes>; + h5: HTMLProps<'h5', HTMLAttributes>; + h6: HTMLProps<'h6', HTMLAttributes>; + head: HTMLProps<'head', HTMLAttributes>; + header: HTMLProps<'header', HTMLAttributes>; + hgroup: HTMLProps<'hgroup', HTMLAttributes>; + hr: HTMLProps<'hr', HTMLAttributes>; + html: HTMLProps<'html', HTMLAttributes>; + i: HTMLProps<'i', HTMLAttributes>; + iframe: HTMLProps<'iframe', HTMLAttributes>; + img: HTMLProps<'img', HTMLAttributes>; + input: HTMLProps<'input', HTMLAttributes>; + ins: HTMLProps<'ins', HTMLAttributes>; + kbd: HTMLProps<'kbd', HTMLAttributes>; + keygen: HTMLProps<'keygen', HTMLAttributes>; + label: HTMLProps<'label', HTMLAttributes>; + legend: HTMLProps<'legend', HTMLAttributes>; + li: HTMLProps<'li', HTMLAttributes>; + link: HTMLProps<'link', HTMLAttributes>; + main: HTMLProps<'main', HTMLAttributes>; + map: HTMLProps<'map', HTMLAttributes>; + mark: HTMLProps<'mark', HTMLAttributes>; + menu: HTMLProps<'menu', HTMLAttributes>; + menuitem: HTMLProps<'menuitem', HTMLAttributes>; + meta: HTMLProps<'meta', HTMLAttributes>; + meter: HTMLProps<'meter', HTMLAttributes>; + nav: HTMLProps<'nav', HTMLAttributes>; + noscript: HTMLProps<'noscript', HTMLAttributes>; + object: HTMLProps<'object', HTMLAttributes>; + ol: HTMLProps<'ol', HTMLAttributes>; + optgroup: HTMLProps<'optgroup', HTMLAttributes>; + option: HTMLProps<'option', HTMLAttributes>; + output: HTMLProps<'output', HTMLAttributes>; + p: HTMLProps<'p', HTMLAttributes>; + param: HTMLProps<'param', HTMLAttributes>; + picture: HTMLProps<'picture', HTMLAttributes>; + pre: HTMLProps<'pre', HTMLAttributes>; + progress: HTMLProps<'progress', HTMLAttributes>; + q: HTMLProps<'q', HTMLAttributes>; + rp: HTMLProps<'rp', HTMLAttributes>; + rt: HTMLProps<'rt', HTMLAttributes>; + ruby: HTMLProps<'ruby', HTMLAttributes>; + s: HTMLProps<'s', HTMLAttributes>; + samp: HTMLProps<'samp', HTMLAttributes>; + slot: HTMLProps<'slot', HTMLAttributes>; + script: HTMLProps<'script', HTMLAttributes>; + section: HTMLProps<'section', HTMLAttributes>; + select: HTMLProps<'select', HTMLAttributes>; + small: HTMLProps<'small', HTMLAttributes>; + source: HTMLProps<'source', HTMLAttributes>; + span: HTMLProps<'span', HTMLAttributes>; + strong: HTMLProps<'strong', HTMLAttributes>; + style: HTMLProps<'style', HTMLAttributes>; + sub: HTMLProps<'sub', HTMLAttributes>; + summary: HTMLProps<'summary', HTMLAttributes>; + sup: HTMLProps<'sup', HTMLAttributes>; + table: HTMLProps<'table', HTMLAttributes>; + template: HTMLProps<'template', HTMLAttributes>; + tbody: HTMLProps<'tbody', HTMLAttributes>; + td: HTMLProps<'td', HTMLAttributes>; + textarea: HTMLProps<'textarea', HTMLAttributes>; + tfoot: HTMLProps<'tfoot', HTMLAttributes>; + th: HTMLProps<'th', HTMLAttributes>; + thead: HTMLProps<'thead', HTMLAttributes>; + time: HTMLProps<'time', HTMLAttributes>; + title: HTMLProps<'title', HTMLAttributes>; + tr: HTMLProps<'tr', HTMLAttributes>; + track: HTMLProps<'track', HTMLAttributes>; + u: HTMLProps<'u', HTMLAttributes>; + ul: HTMLProps<'ul', HTMLAttributes>; + var: HTMLProps<'var', HTMLAttributes>; + video: HTMLProps<'video', HTMLAttributes>; + wbr: HTMLProps<'wbr', HTMLAttributes>; + webview: HTMLProps<'webview', HTMLAttributes>; + // SVG + svg: HTMLProps<'svg', SVGAttributes>; + + animate: HTMLProps<'animate', SVGAttributes>; + animateMotion: HTMLProps<'animateMotion', SVGAttributes>; + animateTransform: HTMLProps<'animateTransform', SVGAttributes>; + circle: HTMLProps<'circle', SVGAttributes>; + clipPath: HTMLProps<'clipPath', SVGAttributes>; + defs: HTMLProps<'defs', SVGAttributes>; + desc: HTMLProps<'desc', SVGAttributes>; + ellipse: HTMLProps<'ellipse', SVGAttributes>; + feBlend: HTMLProps<'feBlend', SVGAttributes>; + feColorMatrix: HTMLProps<'feColorMatrix', SVGAttributes>; + feComponentTransfer: HTMLProps<'feComponentTransfer', SVGAttributes>; + feComposite: HTMLProps<'feComposite', SVGAttributes>; + feConvolveMatrix: HTMLProps<'feConvolveMatrix', SVGAttributes>; + feDiffuseLighting: HTMLProps<'feDiffuseLighting', SVGAttributes>; + feDisplacementMap: HTMLProps<'feDisplacementMap', SVGAttributes>; + feDistantLight: HTMLProps<'feDistantLight', SVGAttributes>; + feDropShadow: HTMLProps<'feDropShadow', SVGAttributes>; + feFlood: HTMLProps<'feFlood', SVGAttributes>; + feFuncA: HTMLProps<'feFuncA', SVGAttributes>; + feFuncB: HTMLProps<'feFuncB', SVGAttributes>; + feFuncG: HTMLProps<'feFuncG', SVGAttributes>; + feFuncR: HTMLProps<'feFuncR', SVGAttributes>; + feGaussianBlur: HTMLProps<'feGaussianBlur', SVGAttributes>; + feImage: HTMLProps<'feImage', SVGAttributes>; + feMerge: HTMLProps<'feMerge', SVGAttributes>; + feMergeNode: HTMLProps<'feMergeNode', SVGAttributes>; + feMorphology: HTMLProps<'feMorphology', SVGAttributes>; + feOffset: HTMLProps<'feOffset', SVGAttributes>; + fePointLight: HTMLProps<'fePointLight', SVGAttributes>; + feSpecularLighting: HTMLProps<'feSpecularLighting', SVGAttributes>; + feSpotLight: HTMLProps<'feSpotLight', SVGAttributes>; + feTile: HTMLProps<'feTile', SVGAttributes>; + feTurbulence: HTMLProps<'feTurbulence', SVGAttributes>; + filter: HTMLProps<'filter', SVGAttributes>; + foreignObject: HTMLProps<'foreignObject', SVGAttributes>; + g: HTMLProps<'g', SVGAttributes>; + image: HTMLProps<'image', SVGAttributes>; + line: HTMLProps<'line', SVGAttributes>; + linearGradient: HTMLProps<'linearGradient', SVGAttributes>; + marker: HTMLProps<'marker', SVGAttributes>; + mask: HTMLProps<'mask', SVGAttributes>; + metadata: HTMLProps<'metadata', SVGAttributes>; + mpath: HTMLProps<'mpath', SVGAttributes>; + path: HTMLProps<'path', SVGAttributes>; + pattern: HTMLProps<'pattern', SVGAttributes>; + polygon: HTMLProps<'polygon', SVGAttributes>; + polyline: HTMLProps<'polyline', SVGAttributes>; + radialGradient: HTMLProps<'radialGradient', SVGAttributes>; + rect: HTMLProps<'rect', SVGAttributes>; + stop: HTMLProps<'stop', SVGAttributes>; + switch: HTMLProps<'switch', SVGAttributes>; + symbol: HTMLProps<'symbol', SVGAttributes>; + text: HTMLProps<'text', SVGAttributes>; + textPath: HTMLProps<'textPath', SVGAttributes>; + tspan: HTMLProps<'tspan', SVGAttributes>; + use: HTMLProps<'use', SVGAttributes>; + view: HTMLProps<'view', SVGAttributes>; + + // Svelte specific + 'svelte:window': HTMLProps<'svelte:window', HTMLAttributes>; + 'svelte:body': HTMLProps<'svelte:body', HTMLAttributes>; + 'svelte:document': HTMLProps<'svelte:document', HTMLAttributes>; + 'svelte:fragment': { slot?: string }; + 'svelte:options': { [name: string]: any }; + 'svelte:head': { [name: string]: any }; + + [name: string]: { [name: string]: any }; + } + +} diff --git a/node_modules/svelte2tsx/svelte-jsx.d.ts b/node_modules/svelte2tsx/svelte-jsx.d.ts new file mode 100644 index 00000000..5c576f71 --- /dev/null +++ b/node_modules/svelte2tsx/svelte-jsx.d.ts @@ -0,0 +1,1492 @@ +/// +// @ts-nocheck +// nocheck because we don't want to adjust this anymore (only used for Svelte 3) + +declare namespace svelteHTML { + + // Every namespace eligible for use needs to implement the following two functions + /** + * @internal do not use + */ + function mapElementTag( + tag: K + ): ElementTagNameMap[K]; + function mapElementTag( + tag: K + ): SVGElementTagNameMap[K]; + function mapElementTag( + tag: any + ): any; // needs to be any because used in context of + + /** + * @internal do not use + */ + function createElement( + // "undefined | null" because of + element: Key | undefined | null, attrs: string extends Key ? import('svelte/elements').HTMLAttributes : Elements[Key] + ): Key extends keyof ElementTagNameMap ? ElementTagNameMap[Key] : Key extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Key] : any; + function createElement( + // "undefined | null" because of + element: Key | undefined | null, attrsEnhancers: T, attrs: (string extends Key ? import('svelte/elements').HTMLAttributes : Elements[Key]) & T + ): Key extends keyof ElementTagNameMap ? ElementTagNameMap[Key] : Key extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Key] : any; + + // For backwards-compatibility and ease-of-use, in case someone enhanced the typings from import('svelte/elements').HTMLAttributes/SVGAttributes + interface HTMLAttributes {} + interface SVGAttributes {} + + /** + * @internal do not use + */ + type EventsWithColon = {[Property in keyof T as Property extends `on${infer Key}` ? `on:${Key}` : Property]?: T[Property] } + /** + * @internal do not use + */ + type HTMLProps = + // This omit chain ensures that properties manually defined in the new transformation take precedence + // over those manually defined in the old, taking precendence over the defaults, to make sth like this possible + // https://github.com/sveltejs/language-tools/issues/1352#issuecomment-1248627516 + // The AttributeNames Omit is necessary because the old transformation only has HTMLAttributes on which types for all + // elements are defined, which would silence type errors in the new transformation. + Omit< + Omit>> & EventsWithColon>, + keyof Override + > & Override; + /** + * @internal do not use + */ + type RemoveIndex = { + [ K in keyof T as string extends K ? never : K ] : T[K] + }; + + // the following type construct makes sure that we can use the new typings while maintaining backwards-compatibility in case someone enhanced the old typings + interface IntrinsicElements extends Omit, keyof RemoveIndex> { + a: HTMLProps<'a', HTMLAttributes>; + abbr: HTMLProps<'abbr', HTMLAttributes>; + address: HTMLProps<'address', HTMLAttributes>; + area: HTMLProps<'area', HTMLAttributes>; + article: HTMLProps<'article', HTMLAttributes>; + aside: HTMLProps<'aside', HTMLAttributes>; + audio: HTMLProps<'audio', HTMLAttributes>; + b: HTMLProps<'b', HTMLAttributes>; + base: HTMLProps<'base', HTMLAttributes>; + bdi: HTMLProps<'bdi', HTMLAttributes>; + bdo: HTMLProps<'bdo', HTMLAttributes>; + big: HTMLProps<'big', HTMLAttributes>; + blockquote: HTMLProps<'blockquote', HTMLAttributes>; + body: HTMLProps<'body', HTMLAttributes>; + br: HTMLProps<'br', HTMLAttributes>; + button: HTMLProps<'button', HTMLAttributes>; + canvas: HTMLProps<'canvas', HTMLAttributes>; + caption: HTMLProps<'caption', HTMLAttributes>; + cite: HTMLProps<'cite', HTMLAttributes>; + code: HTMLProps<'code', HTMLAttributes>; + col: HTMLProps<'col', HTMLAttributes>; + colgroup: HTMLProps<'colgroup', HTMLAttributes>; + data: HTMLProps<'data', HTMLAttributes>; + datalist: HTMLProps<'datalist', HTMLAttributes>; + dd: HTMLProps<'dd', HTMLAttributes>; + del: HTMLProps<'del', HTMLAttributes>; + details: HTMLProps<'details', HTMLAttributes>; + dfn: HTMLProps<'dfn', HTMLAttributes>; + dialog: HTMLProps<'dialog', HTMLAttributes>; + div: HTMLProps<'div', HTMLAttributes>; + dl: HTMLProps<'dl', HTMLAttributes>; + dt: HTMLProps<'dt', HTMLAttributes>; + em: HTMLProps<'em', HTMLAttributes>; + embed: HTMLProps<'embed', HTMLAttributes>; + fieldset: HTMLProps<'fieldset', HTMLAttributes>; + figcaption: HTMLProps<'figcaption', HTMLAttributes>; + figure: HTMLProps<'figure', HTMLAttributes>; + footer: HTMLProps<'footer', HTMLAttributes>; + form: HTMLProps<'form', HTMLAttributes>; + h1: HTMLProps<'h1', HTMLAttributes>; + h2: HTMLProps<'h2', HTMLAttributes>; + h3: HTMLProps<'h3', HTMLAttributes>; + h4: HTMLProps<'h4', HTMLAttributes>; + h5: HTMLProps<'h5', HTMLAttributes>; + h6: HTMLProps<'h6', HTMLAttributes>; + head: HTMLProps<'head', HTMLAttributes>; + header: HTMLProps<'header', HTMLAttributes>; + hgroup: HTMLProps<'hgroup', HTMLAttributes>; + hr: HTMLProps<'hr', HTMLAttributes>; + html: HTMLProps<'html', HTMLAttributes>; + i: HTMLProps<'i', HTMLAttributes>; + iframe: HTMLProps<'iframe', HTMLAttributes>; + img: HTMLProps<'img', HTMLAttributes>; + input: HTMLProps<'input', HTMLAttributes>; + ins: HTMLProps<'ins', HTMLAttributes>; + kbd: HTMLProps<'kbd', HTMLAttributes>; + keygen: HTMLProps<'keygen', HTMLAttributes>; + label: HTMLProps<'label', HTMLAttributes>; + legend: HTMLProps<'legend', HTMLAttributes>; + li: HTMLProps<'li', HTMLAttributes>; + link: HTMLProps<'link', HTMLAttributes>; + main: HTMLProps<'main', HTMLAttributes>; + map: HTMLProps<'map', HTMLAttributes>; + mark: HTMLProps<'mark', HTMLAttributes>; + menu: HTMLProps<'menu', HTMLAttributes>; + menuitem: HTMLProps<'menuitem', HTMLAttributes>; + meta: HTMLProps<'meta', HTMLAttributes>; + meter: HTMLProps<'meter', HTMLAttributes>; + nav: HTMLProps<'nav', HTMLAttributes>; + noscript: HTMLProps<'noscript', HTMLAttributes>; + object: HTMLProps<'object', HTMLAttributes>; + ol: HTMLProps<'ol', HTMLAttributes>; + optgroup: HTMLProps<'optgroup', HTMLAttributes>; + option: HTMLProps<'option', HTMLAttributes>; + output: HTMLProps<'output', HTMLAttributes>; + p: HTMLProps<'p', HTMLAttributes>; + param: HTMLProps<'param', HTMLAttributes>; + picture: HTMLProps<'picture', HTMLAttributes>; + pre: HTMLProps<'pre', HTMLAttributes>; + progress: HTMLProps<'progress', HTMLAttributes>; + q: HTMLProps<'q', HTMLAttributes>; + rp: HTMLProps<'rp', HTMLAttributes>; + rt: HTMLProps<'rt', HTMLAttributes>; + ruby: HTMLProps<'ruby', HTMLAttributes>; + s: HTMLProps<'s', HTMLAttributes>; + samp: HTMLProps<'samp', HTMLAttributes>; + slot: HTMLProps<'slot', HTMLAttributes>; + script: HTMLProps<'script', HTMLAttributes>; + section: HTMLProps<'section', HTMLAttributes>; + select: HTMLProps<'select', HTMLAttributes>; + small: HTMLProps<'small', HTMLAttributes>; + source: HTMLProps<'source', HTMLAttributes>; + span: HTMLProps<'span', HTMLAttributes>; + strong: HTMLProps<'strong', HTMLAttributes>; + style: HTMLProps<'style', HTMLAttributes>; + sub: HTMLProps<'sub', HTMLAttributes>; + summary: HTMLProps<'summary', HTMLAttributes>; + sup: HTMLProps<'sup', HTMLAttributes>; + table: HTMLProps<'table', HTMLAttributes>; + template: HTMLProps<'template', HTMLAttributes>; + tbody: HTMLProps<'tbody', HTMLAttributes>; + td: HTMLProps<'td', HTMLAttributes>; + textarea: HTMLProps<'textarea', HTMLAttributes>; + tfoot: HTMLProps<'tfoot', HTMLAttributes>; + th: HTMLProps<'th', HTMLAttributes>; + thead: HTMLProps<'thead', HTMLAttributes>; + time: HTMLProps<'time', HTMLAttributes>; + title: HTMLProps<'title', HTMLAttributes>; + tr: HTMLProps<'tr', HTMLAttributes>; + track: HTMLProps<'track', HTMLAttributes>; + u: HTMLProps<'u', HTMLAttributes>; + ul: HTMLProps<'ul', HTMLAttributes>; + var: HTMLProps<'var', HTMLAttributes>; + video: HTMLProps<'video', HTMLAttributes>; + wbr: HTMLProps<'wbr', HTMLAttributes>; + webview: HTMLProps<'webview', HTMLAttributes>; + // SVG + svg: HTMLProps<'svg', SVGAttributes>; + + animate: HTMLProps<'animate', SVGAttributes>; + animateMotion: HTMLProps<'animateMotion', SVGAttributes>; + animateTransform: HTMLProps<'animateTransform', SVGAttributes>; + circle: HTMLProps<'circle', SVGAttributes>; + clipPath: HTMLProps<'clipPath', SVGAttributes>; + defs: HTMLProps<'defs', SVGAttributes>; + desc: HTMLProps<'desc', SVGAttributes>; + ellipse: HTMLProps<'ellipse', SVGAttributes>; + feBlend: HTMLProps<'feBlend', SVGAttributes>; + feColorMatrix: HTMLProps<'feColorMatrix', SVGAttributes>; + feComponentTransfer: HTMLProps<'feComponentTransfer', SVGAttributes>; + feComposite: HTMLProps<'feComposite', SVGAttributes>; + feConvolveMatrix: HTMLProps<'feConvolveMatrix', SVGAttributes>; + feDiffuseLighting: HTMLProps<'feDiffuseLighting', SVGAttributes>; + feDisplacementMap: HTMLProps<'feDisplacementMap', SVGAttributes>; + feDistantLight: HTMLProps<'feDistantLight', SVGAttributes>; + feDropShadow: HTMLProps<'feDropShadow', SVGAttributes>; + feFlood: HTMLProps<'feFlood', SVGAttributes>; + feFuncA: HTMLProps<'feFuncA', SVGAttributes>; + feFuncB: HTMLProps<'feFuncB', SVGAttributes>; + feFuncG: HTMLProps<'feFuncG', SVGAttributes>; + feFuncR: HTMLProps<'feFuncR', SVGAttributes>; + feGaussianBlur: HTMLProps<'feGaussianBlur', SVGAttributes>; + feImage: HTMLProps<'feImage', SVGAttributes>; + feMerge: HTMLProps<'feMerge', SVGAttributes>; + feMergeNode: HTMLProps<'feMergeNode', SVGAttributes>; + feMorphology: HTMLProps<'feMorphology', SVGAttributes>; + feOffset: HTMLProps<'feOffset', SVGAttributes>; + fePointLight: HTMLProps<'fePointLight', SVGAttributes>; + feSpecularLighting: HTMLProps<'feSpecularLighting', SVGAttributes>; + feSpotLight: HTMLProps<'feSpotLight', SVGAttributes>; + feTile: HTMLProps<'feTile', SVGAttributes>; + feTurbulence: HTMLProps<'feTurbulence', SVGAttributes>; + filter: HTMLProps<'filter', SVGAttributes>; + foreignObject: HTMLProps<'foreignObject', SVGAttributes>; + g: HTMLProps<'g', SVGAttributes>; + image: HTMLProps<'image', SVGAttributes>; + line: HTMLProps<'line', SVGAttributes>; + linearGradient: HTMLProps<'linearGradient', SVGAttributes>; + marker: HTMLProps<'marker', SVGAttributes>; + mask: HTMLProps<'mask', SVGAttributes>; + metadata: HTMLProps<'metadata', SVGAttributes>; + mpath: HTMLProps<'mpath', SVGAttributes>; + path: HTMLProps<'path', SVGAttributes>; + pattern: HTMLProps<'pattern', SVGAttributes>; + polygon: HTMLProps<'polygon', SVGAttributes>; + polyline: HTMLProps<'polyline', SVGAttributes>; + radialGradient: HTMLProps<'radialGradient', SVGAttributes>; + rect: HTMLProps<'rect', SVGAttributes>; + stop: HTMLProps<'stop', SVGAttributes>; + switch: HTMLProps<'switch', SVGAttributes>; + symbol: HTMLProps<'symbol', SVGAttributes>; + text: HTMLProps<'text', SVGAttributes>; + textPath: HTMLProps<'textPath', SVGAttributes>; + tspan: HTMLProps<'tspan', SVGAttributes>; + use: HTMLProps<'use', SVGAttributes>; + view: HTMLProps<'view', SVGAttributes>; + + // Svelte specific + 'svelte:window': HTMLProps<'svelte:window', HTMLAttributes>; + 'svelte:body': HTMLProps<'svelte:body', HTMLAttributes>; + 'svelte:document': HTMLProps<'svelte:document', HTMLAttributes>; + 'svelte:fragment': { slot?: string }; + 'svelte:options': { [name: string]: any }; + 'svelte:head': { [name: string]: any }; + + [name: string]: { [name: string]: any }; + } + +} + +// Keep svelte.JSX for backwards compatibility, in case someone enhanced it with their own typings, +// which we can transform to the new svelteHTML namespace. +/** + * @deprecated use the types from `svelte/elements` instead, or the `svelteHTML` namespace. + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ +declare namespace svelte.JSX { + + /* svelte specific */ + interface ElementClass { + $$prop_def: any; + } + + interface ElementAttributesProperty { + $$prop_def: any; // specify the property name to use + } + + /* html jsx */ + + interface IntrinsicAttributes { + slot?: string; + } + + // + // Event Handler Types + // ---------------------------------------------------------------------- + type EventHandler = + (event: E & { currentTarget: EventTarget & T}) => any; + + type ClipboardEventHandler = EventHandler; + type CompositionEventHandler = EventHandler; + type DragEventHandler = EventHandler; + type FocusEventHandler = EventHandler; + type FormEventHandler = EventHandler; + type ChangeEventHandler = EventHandler; + type KeyboardEventHandler = EventHandler; + type MouseEventHandler = EventHandler; + type TouchEventHandler = EventHandler; + type PointerEventHandler = EventHandler; + type UIEventHandler = EventHandler; + type WheelEventHandler = EventHandler; + type AnimationEventHandler = EventHandler; + type TransitionEventHandler = EventHandler; + type MessageEventHandler = EventHandler; + + /** @deprecated DO NOT USE, WILL BE REMOVED SOON */ + type AttributeNames = + |'oncopy' + |'oncut' + |'onpaste' + |'oncompositionend' + |'oncompositionstart' + |'oncompositionupdate' + |'onfocus' + |'onfocusin' + |'onfocusout' + |'onblur' + |'onchange' + |'oninput' + |'onreset' + |'onsubmit' + |'oninvalid' + |'onbeforeinput' + |'onload' + |'onerror' + |'ontoggle' + |'onkeydown' + |'onkeypress' + |'onkeyup' + |'onabort' + |'oncanplay' + |'oncanplaythrough' + |'oncuechange' + |'ondurationchange' + |'onemptied' + |'onencrypted' + |'onended' + |'onloadeddata' + |'onloadedmetadata' + |'onloadstart' + |'onpause' + |'onplay' + |'onplaying' + |'onprogress' + |'onratechange' + |'onseeked' + |'onseeking' + |'onstalled' + |'onsuspend' + |'ontimeupdate' + |'onvolumechange' + |'onwaiting' + |'onauxclick' + |'onclick' + |'oncontextmenu' + |'ondblclick' + |'ondrag' + |'ondragend' + |'ondragenter' + |'ondragexit' + |'ondragleave' + |'ondragover' + |'ondragstart' + |'ondrop' + |'onmousedown' + |'onmouseenter' + |'onmouseleave' + |'onmousemove' + |'onmouseout' + |'onmouseover' + |'onmouseup' + |'onselect' + |'onselectionchange' + |'onselectstart' + |'ontouchcancel' + |'ontouchend' + |'ontouchmove' + |'ontouchstart' + |'ongotpointercapture' + |'onpointercancel' + |'onpointerdown' + |'onpointerenter' + |'onpointerleave' + |'onpointermove' + |'onpointerout' + |'onpointerover' + |'onpointerup' + |'onlostpointercapture' + |'onscroll' + |'onresize' + |'onwheel' + |'onanimationstart' + |'onanimationend' + |'onanimationiteration' + |'ontransitionstart' + |'ontransitionrun' + |'ontransitionend' + |'ontransitioncancel' + |'onoutrostart' + |'onoutroend' + |'onintrostart' + |'onintroend' + |'onmessage' + |'onmessageerror' + |'oncancel' + |'onclose' + |'onfullscreenchange' + |'onfullscreenerror' + |'class' + |'dataset' + |'accept' + |'acceptcharset' + |'accesskey' + |'action' + |'allow' + |'allowfullscreen' + |'allowtransparency' + |'allowpaymentrequest' + |'alt' + |'as' + |'async' + |'autocomplete' + |'autofocus' + |'autoplay' + |'capture' + |'cellpadding' + |'cellspacing' + |'charset' + |'challenge' + |'checked' + |'cite' + |'classid' + |'cols' + |'colspan' + |'content' + |'contenteditable' + |'innerHTML' + |'textContent' + |'contextmenu' + |'controls' + |'coords' + |'crossorigin' + |'currenttime' + |'decoding' + |'data' + |'datetime' + |'default' + |'defaultmuted' + |'defaultplaybackrate' + |'defer' + |'dir' + |'dirname' + |'disabled' + |'download' + |'draggable' + |'enctype' + |'enterkeyhint' + |'for' + |'form' + |'formaction' + |'formenctype' + |'formmethod' + |'formnovalidate' + |'formtarget' + |'frameborder' + |'headers' + |'height' + |'hidden' + |'high' + |'href' + |'hreflang' + |'htmlfor' + |'httpequiv' + |'id' + |'inputmode' + |'integrity' + |'is' + |'ismap' + |'keyparams' + |'keytype' + |'kind' + |'label' + |'lang' + |'list' + |'loading' + |'loop' + |'low' + |'manifest' + |'marginheight' + |'marginwidth' + |'max' + |'maxlength' + |'media' + |'mediagroup' + |'method' + |'min' + |'minlength' + |'multiple' + |'muted' + |'name' + |'nonce' + |'novalidate' + |'open' + |'optimum' + |'part' + |'pattern' + |'placeholder' + |'playsinline' + |'ping' + |'poster' + |'preload' + |'radiogroup' + |'readonly' + |'referrerpolicy' + |'rel' + |'required' + |'reversed' + |'role' + |'rows' + |'rowspan' + |'sandbox' + |'scope' + |'scoped' + |'scrolling' + |'seamless' + |'selected' + |'shape' + |'size' + |'sizes' + |'slot' + |'span' + |'spellcheck' + |'src' + |'srcdoc' + |'srclang' + |'srcset' + |'start' + |'step' + |'style' + |'summary' + |'tabindex' + |'target' + |'title' + |'translate' + |'type' + |'usemap' + |'value' + |'volume' + |'width' + |'wmode' + |'wrap' + |'about' + |'datatype' + |'inlist' + |'prefix' + |'property' + |'resource' + |'typeof' + |'vocab' + |'autocapitalize' + |'autocorrect' + |'autosave' + |'color' + |'controlslist' + |'inert' + |'itemprop' + |'itemscope' + |'itemtype' + |'itemid' + |'itemref' + |'results' + |'security' + |'unselectable'; + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface DOMAttributes { + oncopy?: ClipboardEventHandler | undefined | null; + oncut?: ClipboardEventHandler | undefined | null; + onpaste?: ClipboardEventHandler | undefined | null; + oncompositionend?: CompositionEventHandler | undefined | null; + oncompositionstart?: CompositionEventHandler | undefined | null; + oncompositionupdate?: CompositionEventHandler | undefined | null; + onfocus?: FocusEventHandler | undefined | null; + onfocusin?: FocusEventHandler | undefined | null; + onfocusout?: FocusEventHandler | undefined | null; + onblur?: FocusEventHandler | undefined | null; + onchange?: FormEventHandler | undefined | null; + oninput?: FormEventHandler | undefined | null; + onreset?: FormEventHandler | undefined | null; + onsubmit?: EventHandler | undefined | null; + oninvalid?: EventHandler | undefined | null; + onbeforeinput?: EventHandler | undefined | null; + onload?: EventHandler | undefined | null; + onerror?: EventHandler | undefined | null; // also a Media Event + ontoggle?: EventHandler | undefined | null; + onkeydown?: KeyboardEventHandler | undefined | null; + onkeypress?: KeyboardEventHandler | undefined | null; + onkeyup?: KeyboardEventHandler | undefined | null; + onabort?: EventHandler | undefined | null; + oncanplay?: EventHandler | undefined | null; + oncanplaythrough?: EventHandler | undefined | null; + oncuechange?: EventHandler | undefined | null; + ondurationchange?: EventHandler | undefined | null; + onemptied?: EventHandler | undefined | null; + onencrypted?: EventHandler | undefined | null; + onended?: EventHandler | undefined | null; + onloadeddata?: EventHandler | undefined | null; + onloadedmetadata?: EventHandler | undefined | null; + onloadstart?: EventHandler | undefined | null; + onpause?: EventHandler | undefined | null; + onplay?: EventHandler | undefined | null; + onplaying?: EventHandler | undefined | null; + onprogress?: EventHandler | undefined | null; + onratechange?: EventHandler | undefined | null; + onseeked?: EventHandler | undefined | null; + onseeking?: EventHandler | undefined | null; + onstalled?: EventHandler | undefined | null; + onsuspend?: EventHandler | undefined | null; + ontimeupdate?: EventHandler | undefined | null; + onvolumechange?: EventHandler | undefined | null; + onwaiting?: EventHandler | undefined | null; + onauxclick?: MouseEventHandler | undefined | null; + onclick?: MouseEventHandler | undefined | null; + oncontextmenu?: MouseEventHandler | undefined | null; + ondblclick?: MouseEventHandler | undefined | null; + ondrag?: DragEventHandler | undefined | null; + ondragend?: DragEventHandler | undefined | null; + ondragenter?: DragEventHandler | undefined | null; + ondragexit?: DragEventHandler | undefined | null; + ondragleave?: DragEventHandler | undefined | null; + ondragover?: DragEventHandler | undefined | null; + ondragstart?: DragEventHandler | undefined | null; + ondrop?: DragEventHandler | undefined | null; + onmousedown?: MouseEventHandler | undefined | null; + onmouseenter?: MouseEventHandler | undefined | null; + onmouseleave?: MouseEventHandler | undefined | null; + onmousemove?: MouseEventHandler | undefined | null; + onmouseout?: MouseEventHandler | undefined | null; + onmouseover?: MouseEventHandler | undefined | null; + onmouseup?: MouseEventHandler | undefined | null; + onselect?: EventHandler | undefined | null; + onselectionchange?: EventHandler | undefined | null; + onselectstart?: EventHandler | undefined | null; + ontouchcancel?: TouchEventHandler | undefined | null; + ontouchend?: TouchEventHandler | undefined | null; + ontouchmove?: TouchEventHandler | undefined | null; + ontouchstart?: TouchEventHandler | undefined | null; + ongotpointercapture?: PointerEventHandler | undefined | null; + onpointercancel?: PointerEventHandler | undefined | null; + onpointerdown?: PointerEventHandler | undefined | null; + onpointerenter?: PointerEventHandler | undefined | null; + onpointerleave?: PointerEventHandler | undefined | null; + onpointermove?: PointerEventHandler | undefined | null; + onpointerout?: PointerEventHandler | undefined | null; + onpointerover?: PointerEventHandler | undefined | null; + onpointerup?: PointerEventHandler | undefined | null; + onlostpointercapture?: PointerEventHandler | undefined | null; + onscroll?: UIEventHandler | undefined | null; + onresize?: UIEventHandler | undefined | null; + onwheel?: WheelEventHandler | undefined | null; + onanimationstart?: AnimationEventHandler | undefined | null; + onanimationend?: AnimationEventHandler | undefined | null; + onanimationiteration?: AnimationEventHandler | undefined | null; + ontransitionstart?: TransitionEventHandler | undefined | null; + ontransitionrun?: TransitionEventHandler | undefined | null; + ontransitionend?: TransitionEventHandler | undefined | null; + ontransitioncancel?: TransitionEventHandler | undefined | null; + onoutrostart?: EventHandler, T> | undefined | null; + onoutroend?: EventHandler, T> | undefined | null; + onintrostart?: EventHandler, T> | undefined | null; + onintroend?: EventHandler, T> | undefined | null; + onmessage?: MessageEventHandler | undefined | null; + onmessageerror?: MessageEventHandler | undefined | null; + oncancel?: EventHandler | undefined | null; + onclose?: EventHandler | undefined | null; + onfullscreenchange?: EventHandler | undefined | null; + onfullscreenerror?: EventHandler | undefined | null; + } + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface AriaAttributes { + 'aria-activedescendant'?: string | undefined | null; + 'aria-atomic'?: boolean | 'false' | 'true' | undefined | null; + 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' | undefined | null; + 'aria-busy'?: boolean | 'false' | 'true' | undefined | null; + 'aria-checked'?: boolean | 'false' | 'mixed' | 'true' | undefined | null; + 'aria-colcount'?: number | undefined | null; + 'aria-colindex'?: number | undefined | null; + 'aria-colspan'?: number | undefined | null; + 'aria-controls'?: string | undefined | null; + 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time' | undefined | null; + 'aria-describedby'?: string | undefined | null; + 'aria-details'?: string | undefined | null; + 'aria-disabled'?: boolean | 'false' | 'true' | undefined | null; + 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup' | undefined | null; + 'aria-errormessage'?: string | undefined | null; + 'aria-expanded'?: boolean | 'false' | 'true' | undefined | null; + 'aria-flowto'?: string | undefined | null; + 'aria-grabbed'?: boolean | 'false' | 'true' | undefined | null; + 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | undefined | null; + 'aria-hidden'?: boolean | 'false' | 'true' | undefined | null; + 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling' | undefined | null; + 'aria-keyshortcuts'?: string | undefined | null; + 'aria-label'?: string | undefined | null; + 'aria-labelledby'?: string | undefined | null; + 'aria-level'?: number | undefined | null; + 'aria-live'?: 'off' | 'assertive' | 'polite' | undefined | null; + 'aria-modal'?: boolean | 'false' | 'true' | undefined | null; + 'aria-multiline'?: boolean | 'false' | 'true' | undefined | null; + 'aria-multiselectable'?: boolean | 'false' | 'true' | undefined | null; + 'aria-orientation'?: 'horizontal' | 'vertical' | undefined | null; + 'aria-owns'?: string | undefined | null; + 'aria-placeholder'?: string | undefined | null; + 'aria-posinset'?: number | undefined | null; + 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true' | undefined | null; + 'aria-readonly'?: boolean | 'false' | 'true' | undefined | null; + 'aria-relevant'?: 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' | undefined | null; + 'aria-required'?: boolean | 'false' | 'true' | undefined | null; + 'aria-roledescription'?: string | undefined | null; + 'aria-rowcount'?: number | undefined | null; + 'aria-rowindex'?: number | undefined | null; + 'aria-rowspan'?: number | undefined | null; + 'aria-selected'?: boolean | 'false' | 'true' | undefined | null; + 'aria-setsize'?: number | undefined | null; + 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' | undefined | null; + 'aria-valuemax'?: number | undefined | null; + 'aria-valuemin'?: number | undefined | null; + 'aria-valuenow'?: number | undefined | null; + 'aria-valuetext'?: string | undefined | null; + } + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface HTMLAttributes extends AriaAttributes, DOMAttributes { + class?: string | undefined | null; + dataset?: object | undefined | null; + accept?: string | undefined | null; + acceptcharset?: string | undefined | null; + accesskey?: string | undefined | null; + action?: string | undefined | null; + allow?: string | undefined | null; + allowfullscreen?: boolean | undefined | null; + allowtransparency?: boolean | undefined | null; + allowpaymentrequest?: boolean | undefined | null; + alt?: string | undefined | null; + as?: string | undefined | null; + async?: boolean | undefined | null; + autocomplete?: string | undefined | null; + autofocus?: boolean | undefined | null; + autoplay?: boolean | undefined | null; + capture?: 'environment' | 'user' | boolean | undefined | null; + cellpadding?: number | string | undefined | null; + cellspacing?: number | string | undefined | null; + charset?: string | undefined | null; + challenge?: string | undefined | null; + checked?: boolean | undefined | null; + cite?: string | undefined | null; + classid?: string | undefined | null; + cols?: number | undefined | null; + colspan?: number | undefined | null; + content?: string | undefined | null; + contenteditable?: 'true' | 'false' | boolean | undefined | null; + innerHTML?: string | undefined | null; + textContent?: string | undefined | null; + contextmenu?: string | undefined | null; + controls?: boolean | undefined | null; + coords?: string | undefined | null; + crossorigin?: string | undefined | null; + currenttime?: number | undefined | null; + decoding?: 'async' | 'sync' | 'auto' | undefined | null; + data?: string | undefined | null; + datetime?: string | undefined | null; + default?: boolean | undefined | null; + defaultmuted?: boolean | undefined | null; + defaultplaybackrate?: number | undefined | null; + defer?: boolean | undefined | null; + dir?: string | undefined | null; + dirname?: string | undefined | null; + disabled?: boolean | undefined | null; + download?: any | undefined | null; + draggable?: boolean | 'true' | 'false' | undefined | null; + enctype?: string | undefined | null; + enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined | null; + for?: string | undefined | null; + form?: string | undefined | null; + formaction?: string | undefined | null; + formenctype?: string | undefined | null; + formmethod?: string | undefined | null; + formnovalidate?: boolean | undefined | null; + formtarget?: string | undefined | null; + frameborder?: number | string | undefined | null; + headers?: string | undefined | null; + height?: number | string | undefined | null; + hidden?: boolean | undefined | null; + high?: number | undefined | null; + href?: string | undefined | null; + hreflang?: string | undefined | null; + htmlfor?: string | undefined | null; + httpequiv?: string | undefined | null; + id?: string | undefined | null; + inputmode?: string | undefined | null; + integrity?: string | undefined | null; + is?: string | undefined | null; + ismap?: boolean | undefined | null; + keyparams?: string | undefined | null; + keytype?: string | undefined | null; + kind?: string | undefined | null; + label?: string | undefined | null; + lang?: string | undefined | null; + list?: string | undefined | null; + loading?: string | undefined | null; + loop?: boolean | undefined | null; + low?: number | undefined | null; + manifest?: string | undefined | null; + marginheight?: number | undefined | null; + marginwidth?: number | undefined | null; + max?: number | string | undefined | null; + maxlength?: number | undefined | null; + media?: string | undefined | null; + mediagroup?: string | undefined | null; + method?: string | undefined | null; + min?: number | string | undefined | null; + minlength?: number | undefined | null; + multiple?: boolean | undefined | null; + muted?: boolean | undefined | null; + name?: string | undefined | null; + nonce?: string | undefined | null; + novalidate?: boolean | undefined | null; + open?: boolean | undefined | null; + optimum?: number | undefined | null; + part?: string | undefined | null; + pattern?: string | undefined | null; + placeholder?: string | undefined | null; + playsinline?: boolean | undefined | null; + ping?: string | undefined | null; + poster?: string | undefined | null; + preload?: string | undefined | null; + radiogroup?: string | undefined | null; + readonly?: boolean | undefined | null; + referrerpolicy?: string | undefined | null; + rel?: string | undefined | null; + required?: boolean | undefined | null; + reversed?: boolean | undefined | null; + role?: string | undefined | null; + rows?: number | undefined | null; + rowspan?: number | undefined | null; + sandbox?: string | undefined | null; + scope?: string | undefined | null; + scoped?: boolean | undefined | null; + scrolling?: string | undefined | null; + seamless?: boolean | undefined | null; + selected?: boolean | undefined | null; + shape?: string | undefined | null; + size?: number | undefined | null; + sizes?: string | undefined | null; + slot?: string | undefined | null; + span?: number | undefined | null; + spellcheck?: boolean | 'true' | 'false' | undefined | null; + src?: string | undefined | null; + srcdoc?: string | undefined | null; + srclang?: string | undefined | null; + srcset?: string | undefined | null; + start?: number | undefined | null; + step?: number | string | undefined | null; + style?: string | undefined | null; + summary?: string | undefined | null; + tabindex?: number | undefined | null; + target?: string | undefined | null; + title?: string | undefined | null; + translate?: "yes" | "no" | "" | undefined | null; + type?: string | undefined | null; + usemap?: string | undefined | null; + value?: any | undefined | null; + volume?: number | undefined | null; + width?: number | string | undefined | null; + wmode?: string | undefined | null; + wrap?: string | undefined | null; + about?: string | undefined | null; + datatype?: string | undefined | null; + inlist?: any | undefined | null; + prefix?: string | undefined | null; + property?: string | undefined | null; + resource?: string | undefined | null; + typeof?: string | undefined | null; + vocab?: string | undefined | null; + autocapitalize?: string | undefined | null; + autocorrect?: string | undefined | null; + autosave?: string | undefined | null; + color?: string | undefined | null; + controlslist?: 'nodownload' | 'nofullscreen' | 'noplaybackrate' | 'noremoteplayback'; + inert?: boolean | undefined | null; + itemprop?: string | undefined | null; + itemscope?: boolean | undefined | null; + itemtype?: string | undefined | null; + itemid?: string | undefined | null; + itemref?: string | undefined | null; + results?: number | undefined | null; + security?: string | undefined | null; + unselectable?: boolean | undefined | null; + + 'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null; + 'data-sveltekit-noscroll'?: true | '' | 'off' | undefined | null; + 'data-sveltekit-preload-code'?: true | '' | 'eager' | 'viewport' | 'hover' | 'tap' | 'off' | undefined | null; + 'data-sveltekit-preload-data'?: true | '' | 'hover' | 'tap' | 'off' | undefined | null; + 'data-sveltekit-reload'?: true | '' | 'off' | undefined | null; + 'data-sveltekit-replacestate'?: true | '' | 'off' | undefined | null; + } + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface SVGAttributes extends AriaAttributes, DOMAttributes { + className?: string | undefined | null; + class?: string | undefined | null; + color?: string | undefined | null; + height?: number | string | undefined | null; + id?: string | undefined | null; + lang?: string | undefined | null; + max?: number | string | undefined | null; + media?: string | undefined | null; + method?: string | undefined | null; + min?: number | string | undefined | null; + name?: string | undefined | null; + style?: string | undefined | null; + target?: string | undefined | null; + type?: string | undefined | null; + width?: number | string | undefined | null; + role?: string | undefined | null; + tabindex?: number | undefined | null; + crossorigin?: 'anonymous' | 'use-credentials' | '' | undefined | null; + 'accent-height'?: number | string | undefined | null; + accumulate?: 'none' | 'sum' | undefined | null; + additive?: 'replace' | 'sum' | undefined | null; + 'alignment-baseline'?: 'auto' | 'baseline' | 'before-edge' | 'text-before-edge' | 'middle' | + 'central' | 'after-edge' | 'text-after-edge' | 'ideographic' | 'alphabetic' | 'hanging' | + 'mathematical' | 'inherit' | undefined | null; + allowReorder?: 'no' | 'yes' | undefined | null; + alphabetic?: number | string | undefined | null; + amplitude?: number | string | undefined | null; + 'arabic-form'?: 'initial' | 'medial' | 'terminal' | 'isolated' | undefined | null; + ascent?: number | string | undefined | null; + attributeName?: string | undefined | null; + attributeType?: string | undefined | null; + autoReverse?: number | string | undefined | null; + azimuth?: number | string | undefined | null; + baseFrequency?: number | string | undefined | null; + 'baseline-shift'?: number | string | undefined | null; + baseProfile?: number | string | undefined | null; + bbox?: number | string | undefined | null; + begin?: number | string | undefined | null; + bias?: number | string | undefined | null; + by?: number | string | undefined | null; + calcMode?: number | string | undefined | null; + 'cap-height'?: number | string | undefined | null; + clip?: number | string | undefined | null; + 'clip-path'?: string | undefined | null; + clipPathUnits?: number | string | undefined | null; + 'clip-rule'?: number | string | undefined | null; + 'color-interpolation'?: number | string | undefined | null; + 'color-interpolation-filters'?: 'auto' | 'sRGB' | 'linearRGB' | 'inherit' | undefined | null; + 'color-profile'?: number | string | undefined | null; + 'color-rendering'?: number | string | undefined | null; + contentScriptType?: number | string | undefined | null; + contentStyleType?: number | string | undefined | null; + cursor?: number | string | undefined | null; + cx?: number | string | undefined | null; + cy?: number | string | undefined | null; + d?: string | undefined | null; + decelerate?: number | string | undefined | null; + descent?: number | string | undefined | null; + diffuseConstant?: number | string | undefined | null; + direction?: number | string | undefined | null; + display?: number | string | undefined | null; + divisor?: number | string | undefined | null; + 'dominant-baseline'?: number | string | undefined | null; + dur?: number | string | undefined | null; + dx?: number | string | undefined | null; + dy?: number | string | undefined | null; + edgeMode?: number | string | undefined | null; + elevation?: number | string | undefined | null; + 'enable-background'?: number | string | undefined | null; + end?: number | string | undefined | null; + exponent?: number | string | undefined | null; + externalResourcesRequired?: number | string | undefined | null; + fill?: string | undefined | null; + 'fill-opacity'?: number | string | undefined | null; + 'fill-rule'?: 'nonzero' | 'evenodd' | 'inherit' | undefined | null; + filter?: string | undefined | null; + filterRes?: number | string | undefined | null; + filterUnits?: number | string | undefined | null; + 'flood-color'?: number | string | undefined | null; + 'flood-opacity'?: number | string | undefined | null; + focusable?: number | string | undefined | null; + 'font-family'?: string | undefined | null; + 'font-size'?: number | string | undefined | null; + 'font-size-adjust'?: number | string | undefined | null; + 'font-stretch'?: number | string | undefined | null; + 'font-style'?: number | string | undefined | null; + 'font-variant'?: number | string | undefined | null; + 'font-weight'?: number | string | undefined | null; + format?: number | string | undefined | null; + from?: number | string | undefined | null; + fx?: number | string | undefined | null; + fy?: number | string | undefined | null; + g1?: number | string | undefined | null; + g2?: number | string | undefined | null; + 'glyph-name'?: number | string | undefined | null; + 'glyph-orientation-horizontal'?: number | string | undefined | null; + 'glyph-orientation-vertical'?: number | string | undefined | null; + glyphRef?: number | string | undefined | null; + gradientTransform?: string | undefined | null; + gradientUnits?: string | undefined | null; + hanging?: number | string | undefined | null; + href?: string | undefined | null; + 'horiz-adv-x'?: number | string | undefined | null; + 'horiz-origin-x'?: number | string | undefined | null; + ideographic?: number | string | undefined | null; + 'image-rendering'?: number | string | undefined | null; + in2?: number | string | undefined | null; + in?: string | undefined | null; + intercept?: number | string | undefined | null; + k1?: number | string | undefined | null; + k2?: number | string | undefined | null; + k3?: number | string | undefined | null; + k4?: number | string | undefined | null; + k?: number | string | undefined | null; + kernelMatrix?: number | string | undefined | null; + kernelUnitLength?: number | string | undefined | null; + kerning?: number | string | undefined | null; + keyPoints?: number | string | undefined | null; + keySplines?: number | string | undefined | null; + keyTimes?: number | string | undefined | null; + lengthAdjust?: number | string | undefined | null; + 'letter-spacing'?: number | string | undefined | null; + 'lighting-color'?: number | string | undefined | null; + limitingConeAngle?: number | string | undefined | null; + local?: number | string | undefined | null; + 'marker-end'?: string | undefined | null; + markerHeight?: number | string | undefined | null; + 'marker-mid'?: string | undefined | null; + 'marker-start'?: string | undefined | null; + markerUnits?: number | string | undefined | null; + markerWidth?: number | string | undefined | null; + mask?: string | undefined | null; + maskContentUnits?: number | string | undefined | null; + maskUnits?: number | string | undefined | null; + mathematical?: number | string | undefined | null; + mode?: number | string | undefined | null; + numOctaves?: number | string | undefined | null; + offset?: number | string | undefined | null; + opacity?: number | string | undefined | null; + operator?: number | string | undefined | null; + order?: number | string | undefined | null; + orient?: number | string | undefined | null; + orientation?: number | string | undefined | null; + origin?: number | string | undefined | null; + overflow?: number | string | undefined | null; + 'overline-position'?: number | string | undefined | null; + 'overline-thickness'?: number | string | undefined | null; + 'paint-order'?: number | string | undefined | null; + 'panose-1'?: number | string | undefined | null; + path?: string | undefined | null; + pathLength?: number | string | undefined | null; + patternContentUnits?: string | undefined | null; + patternTransform?: number | string | undefined | null; + patternUnits?: string | undefined | null; + 'pointer-events'?: number | string | undefined | null; + points?: string | undefined | null; + pointsAtX?: number | string | undefined | null; + pointsAtY?: number | string | undefined | null; + pointsAtZ?: number | string | undefined | null; + preserveAlpha?: number | string | undefined | null; + preserveAspectRatio?: string | undefined | null; + primitiveUnits?: number | string | undefined | null; + r?: number | string | undefined | null; + radius?: number | string | undefined | null; + refX?: number | string | undefined | null; + refY?: number | string | undefined | null; + 'rendering-intent'?: number | string | undefined | null; + repeatCount?: number | string | undefined | null; + repeatDur?: number | string | undefined | null; + requiredExtensions?: number | string | undefined | null; + requiredFeatures?: number | string | undefined | null; + restart?: number | string | undefined | null; + result?: string | undefined | null; + rotate?: number | string | undefined | null; + rx?: number | string | undefined | null; + ry?: number | string | undefined | null; + scale?: number | string | undefined | null; + seed?: number | string | undefined | null; + 'shape-rendering'?: number | string | undefined | null; + slope?: number | string | undefined | null; + spacing?: number | string | undefined | null; + specularConstant?: number | string | undefined | null; + specularExponent?: number | string | undefined | null; + speed?: number | string | undefined | null; + spreadMethod?: string | undefined | null; + startOffset?: number | string | undefined | null; + stdDeviation?: number | string | undefined | null; + stemh?: number | string | undefined | null; + stemv?: number | string | undefined | null; + stitchTiles?: number | string | undefined | null; + 'stop-color'?: string | undefined | null; + 'stop-opacity'?: number | string | undefined | null; + 'strikethrough-position'?: number | string | undefined | null; + 'strikethrough-thickness'?: number | string | undefined | null; + string?: number | string | undefined | null; + stroke?: string | undefined | null; + 'stroke-dasharray'?: string | number | undefined | null; + 'stroke-dashoffset'?: string | number | undefined | null; + 'stroke-linecap'?: 'butt' | 'round' | 'square' | 'inherit' | undefined | null; + 'stroke-linejoin'?: 'miter' | 'round' | 'bevel' | 'inherit' | undefined | null; + 'stroke-miterlimit'?: string | undefined | null; + 'stroke-opacity'?: number | string | undefined | null; + 'stroke-width'?: number | string | undefined | null; + surfaceScale?: number | string | undefined | null; + systemLanguage?: number | string | undefined | null; + tableValues?: number | string | undefined | null; + targetX?: number | string | undefined | null; + targetY?: number | string | undefined | null; + 'text-anchor'?: string | undefined | null; + 'text-decoration'?: number | string | undefined | null; + textLength?: number | string | undefined | null; + 'text-rendering'?: number | string | undefined | null; + to?: number | string | undefined | null; + transform?: string | undefined | null; + u1?: number | string | undefined | null; + u2?: number | string | undefined | null; + 'underline-position'?: number | string | undefined | null; + 'underline-thickness'?: number | string | undefined | null; + unicode?: number | string | undefined | null; + 'unicode-bidi'?: number | string | undefined | null; + 'unicode-range'?: number | string | undefined | null; + 'units-per-em'?: number | string | undefined | null; + 'v-alphabetic'?: number | string | undefined | null; + values?: string | undefined | null; + 'vector-effect'?: number | string | undefined | null; + version?: string | undefined | null; + 'vert-adv-y'?: number | string | undefined | null; + 'vert-origin-x'?: number | string | undefined | null; + 'vert-origin-y'?: number | string | undefined | null; + 'v-hanging'?: number | string | undefined | null; + 'v-ideographic'?: number | string | undefined | null; + viewBox?: string | undefined | null; + viewTarget?: number | string | undefined | null; + visibility?: number | string | undefined | null; + 'v-mathematical'?: number | string | undefined | null; + widths?: number | string | undefined | null; + 'word-spacing'?: number | string | undefined | null; + 'writing-mode'?: number | string | undefined | null; + x1?: number | string | undefined | null; + x2?: number | string | undefined | null; + x?: number | string | undefined | null; + xChannelSelector?: string | undefined | null; + 'x-height'?: number | string | undefined | null; + xlinkActuate?: string | undefined | null; + xlinkArcrole?: string | undefined | null; + xlinkHref?: string | undefined | null; + xlinkRole?: string | undefined | null; + xlinkShow?: string | undefined | null; + xlinkTitle?: string | undefined | null; + xlinkType?: string | undefined | null; + xmlBase?: string | undefined | null; + xmlLang?: string | undefined | null; + xmlns?: string | undefined | null; + xmlnsXlink?: string | undefined | null; + xmlSpace?: string | undefined | null; + y1?: number | string | undefined | null; + y2?: number | string | undefined | null; + y?: number | string | undefined | null; + yChannelSelector?: string | undefined | null; + z?: number | string | undefined | null; + zoomAndPan?: string | undefined | null; + } + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface HTMLProps extends HTMLAttributes {} + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface SVGProps extends SVGAttributes {} + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface SvelteInputProps extends HTMLProps { + group?: any | undefined | null; + files?: FileList | undefined | null; + indeterminate?: boolean | undefined | null; + } + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface SvelteWindowProps { + readonly innerWidth?: Window['innerWidth'] | undefined | null; + readonly innerHeight?: Window['innerHeight'] | undefined | null; + readonly outerWidth?: Window['outerWidth'] | undefined | null; + readonly outerHeight?: Window['outerHeight'] | undefined | null; + scrollX?: Window['scrollX'] | undefined | null; + scrollY?: Window['scrollY'] | undefined | null; + readonly online?: Window['navigator']['onLine'] | undefined | null; + + // Transformed from on:sveltekit:xy + 'onsveltekit:start'?: EventHandler | undefined | null; + 'onsveltekit:navigation-start'?: EventHandler | undefined | null; + 'onsveltekit:navigation-end'?: EventHandler | undefined | null; + + ondevicelight?: EventHandler | undefined | null; + onbeforeinstallprompt?: EventHandler | undefined | null; + ondeviceproximity?: EventHandler | undefined | null; + onpaint?: EventHandler | undefined | null; + onuserproximity?: EventHandler | undefined | null; + onbeforeprint?: EventHandler | undefined | null; + onafterprint?: EventHandler | undefined | null; + onlanguagechange?: EventHandler | undefined | null; + onorientationchange?: EventHandler | undefined | null; + onmessage?: EventHandler | undefined | null; + onmessageerror?: EventHandler | undefined | null; + onoffline?: EventHandler | undefined | null; + ononline?: EventHandler | undefined | null; + onbeforeunload?: EventHandler | undefined | null; + onunload?: EventHandler | undefined | null; + onstorage?: EventHandler | undefined | null; + onhashchange?: EventHandler | undefined | null; + onpagehide?: EventHandler | undefined | null; + onpageshow?: EventHandler | undefined | null; + onpopstate?: EventHandler | undefined | null; + ondevicemotion?: EventHandler | undefined | null; + ondeviceorientation?: EventHandler | undefined | null; + ondeviceorientationabsolute?: EventHandler | undefined | null; + onunhandledrejection?: EventHandler | undefined | null; + onrejectionhandled?: EventHandler | undefined | null; + } + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface SapperAnchorProps { + // transformed from sapper:noscroll so it should be camel case + sapperNoscroll?: true | undefined | null; + sapperPrefetch?: true | undefined | null; + } + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface SvelteMediaTimeRange { + start: number; + end: number; + } + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface SvelteMediaProps { + readonly duration?: number | undefined | null; + readonly buffered?: SvelteMediaTimeRange[] | undefined | null; + readonly played?: SvelteMediaTimeRange[] | undefined | null; + readonly seekable?: SvelteMediaTimeRange[] | undefined | null; + readonly seeking?: boolean | undefined | null; + readonly ended?: boolean | undefined | null; + + /** + * the current playback time in the video, in seconds + */ + currentTime?: number | undefined | null; + /** + * the current playback time in the video, in seconds + */ + currenttime?: number | undefined | null; + // Doesn't work when used as HTML Attribute + /** + * how fast or slow to play the video, where 1 is 'normal' + */ + playbackRate?: number | undefined | null; + + paused?: boolean | undefined | null; + } + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface SvelteVideoProps extends SvelteMediaProps { + // Binding only, don't need lowercase variant + readonly videoWidth?: number | undefined | null; + readonly videoHeight?: number | undefined | null; + } + + /** + * @deprecated use the types from `svelte/elements` instead + * For more info see https://github.com/sveltejs/language-tools/blob/master/docs/preprocessors/typescript.md#im-getting-deprecation-warnings-for-sveltejsx--i-want-to-migrate-to-the-new-typings + */ + interface IntrinsicElements { + // HTML + a: HTMLProps & SapperAnchorProps; + abbr: HTMLProps; + address: HTMLProps; + area: HTMLProps; + article: HTMLProps; + aside: HTMLProps; + audio: HTMLProps & SvelteMediaProps; + b: HTMLProps; + base: HTMLProps; + bdi: HTMLProps; + bdo: HTMLProps; + big: HTMLProps; + blockquote: HTMLProps; + body: HTMLProps; + br: HTMLProps; + button: HTMLProps; + canvas: HTMLProps; + caption: HTMLProps; + cite: HTMLProps; + code: HTMLProps; + col: HTMLProps; + colgroup: HTMLProps; + data: HTMLProps; + datalist: HTMLProps; + dd: HTMLProps; + del: HTMLProps; + details: HTMLProps; + dfn: HTMLProps; + dialog: HTMLProps; + div: HTMLProps; + dl: HTMLProps; + dt: HTMLProps; + em: HTMLProps; + embed: HTMLProps; + fieldset: HTMLProps; + figcaption: HTMLProps; + figure: HTMLProps; + footer: HTMLProps; + form: HTMLProps; + h1: HTMLProps; + h2: HTMLProps; + h3: HTMLProps; + h4: HTMLProps; + h5: HTMLProps; + h6: HTMLProps; + head: HTMLProps; + header: HTMLProps; + hgroup: HTMLProps; + hr: HTMLProps; + html: HTMLProps; + i: HTMLProps; + iframe: HTMLProps; + img: HTMLProps; + input: SvelteInputProps; + ins: HTMLProps; + kbd: HTMLProps; + keygen: HTMLProps; + label: HTMLProps; + legend: HTMLProps; + li: HTMLProps; + link: HTMLProps; + main: HTMLProps; + map: HTMLProps; + mark: HTMLProps; + menu: HTMLProps; + menuitem: HTMLProps; + meta: HTMLProps; + meter: HTMLProps; + nav: HTMLProps; + noindex: HTMLProps; + noscript: HTMLProps; + object: HTMLProps; + ol: HTMLProps; + optgroup: HTMLProps; + option: HTMLProps; + output: HTMLProps; + p: HTMLProps; + param: HTMLProps; + picture: HTMLProps; + pre: HTMLProps; + progress: HTMLProps; + q: HTMLProps; + rp: HTMLProps; + rt: HTMLProps; + ruby: HTMLProps; + s: HTMLProps; + samp: HTMLProps; + script: HTMLProps; + section: HTMLProps; + select: HTMLProps; + small: HTMLProps; + source: HTMLProps; + span: HTMLProps; + strong: HTMLProps; + style: HTMLProps; + sub: HTMLProps; + summary: HTMLProps; + sup: HTMLProps; + table: HTMLProps; + tbody: HTMLProps; + td: HTMLProps; + textarea: HTMLProps; + tfoot: HTMLProps; + th: HTMLProps; + thead: HTMLProps; + time: HTMLProps; + title: HTMLProps; + tr: HTMLProps; + track: HTMLProps; + u: HTMLProps; + ul: HTMLProps; + var: HTMLProps; + video: HTMLProps & SvelteVideoProps; + wbr: HTMLProps; + + svg: SVGProps; + + animate: SVGProps; // @TODO: It is SVGAnimateElement but not in dom.d.ts for now. + circle: SVGProps; + clipPath: SVGProps; + defs: SVGProps; + desc: SVGProps; + ellipse: SVGProps; + feBlend: SVGProps; + feColorMatrix: SVGProps; + feComponentTransfer: SVGProps; + feComposite: SVGProps; + feConvolveMatrix: SVGProps; + feDiffuseLighting: SVGProps; + feDisplacementMap: SVGProps; + feDistantLight: SVGProps; + feFlood: SVGProps; + feFuncA: SVGProps; + feFuncB: SVGProps; + feFuncG: SVGProps; + feFuncR: SVGProps; + feGaussianBlur: SVGProps; + feImage: SVGProps; + feMerge: SVGProps; + feMergeNode: SVGProps; + feMorphology: SVGProps; + feOffset: SVGProps; + fePointLight: SVGProps; + feSpecularLighting: SVGProps; + feSpotLight: SVGProps; + feTile: SVGProps; + feTurbulence: SVGProps; + filter: SVGProps; + foreignObject: SVGProps; + g: SVGProps; + image: SVGProps; + line: SVGProps; + linearGradient: SVGProps; + marker: SVGProps; + mask: SVGProps; + metadata: SVGProps; + path: SVGProps; + pattern: SVGProps; + polygon: SVGProps; + polyline: SVGProps; + radialGradient: SVGProps; + rect: SVGProps; + stop: SVGProps; + switch: SVGProps; + symbol: SVGProps; + text: SVGProps; + textPath: SVGProps; + tspan: SVGProps; + use: SVGProps; + view: SVGProps; + + // Svelte specific + sveltewindow: HTMLProps & SvelteWindowProps; + sveltebody: HTMLProps; + sveltefragment: { slot?: string; }; + svelteoptions: { [name: string]: any }; + sveltehead: { [name: string]: any }; + svelteelement: { 'this': string | undefined | null; } & HTMLProps & SVGProps & SapperAnchorProps; + // Needed due to backwards compatibility type which hits these + 'svelte:window': HTMLProps & SvelteWindowProps; + 'svelte:body': HTMLProps; + 'svelte:fragment': { slot?: string; }; + 'svelte:options': { [name: string]: any }; + 'svelte:head': { [name: string]: any }; + } +} diff --git a/node_modules/svelte2tsx/svelte-native-jsx.d.ts b/node_modules/svelte2tsx/svelte-native-jsx.d.ts new file mode 100644 index 00000000..0c08d71c --- /dev/null +++ b/node_modules/svelte2tsx/svelte-native-jsx.d.ts @@ -0,0 +1,32 @@ +declare namespace svelteNative.JSX { + + // Every namespace eligible for use needs to implement the following two functions + function mapElementTag( + tag: string + ): any; + + function createElement( + element: Key | undefined | null, attrs: Elements[Key] + ): any; + function createElement( + element: Key | undefined | null, attrEnhancers: T, attrs: Elements[Key] & T + ): any; + + + /* svelte specific */ + interface ElementClass { + $$prop_def: any; + } + + interface ElementAttributesProperty { + $$prop_def: any; // specify the property name to use + } + + // Add empty IntrinsicAttributes to prevent fallback to the one in the JSX namespace + interface IntrinsicAttributes { + } + + interface IntrinsicElements { + [name: string]: { [name: string]: any }; + } +} \ No newline at end of file diff --git a/node_modules/svelte2tsx/svelte-shims-v4.d.ts b/node_modules/svelte2tsx/svelte-shims-v4.d.ts new file mode 100644 index 00000000..fcaf92f6 --- /dev/null +++ b/node_modules/svelte2tsx/svelte-shims-v4.d.ts @@ -0,0 +1,287 @@ +// Whenever a ambient declaration changes, its number should be increased +// This way, we avoid the situation where multiple ambient versions of svelte2tsx +// are loaded and their declarations conflict each other +// See https://github.com/sveltejs/language-tools/issues/1059 for an example bug that stems from it +// If you change anything in this file, think about whether or not it should be backported to svelte-shims.d.ts + +type AConstructorTypeOf = new (...args: U) => T; + +/** @internal PRIVATE API, DO NOT USE */ +type SvelteActionReturnType = { + update?: (args: any) => void, + destroy?: () => void +} | void + +/** @internal PRIVATE API, DO NOT USE */ +type SvelteTransitionConfig = { + delay?: number, + duration?: number, + easing?: (t: number) => number, + css?: (t: number, u: number) => string, + tick?: (t: number, u: number) => void +} + +/** @internal PRIVATE API, DO NOT USE */ +type SvelteTransitionReturnType = SvelteTransitionConfig | (() => SvelteTransitionConfig) + +/** @internal PRIVATE API, DO NOT USE */ +type SvelteAnimationReturnType = { + delay?: number, + duration?: number, + easing?: (t: number) => number, + css?: (t: number, u: number) => string, + tick?: (t: number, u: number) => void +} + +/** @internal PRIVATE API, DO NOT USE */ +type SvelteWithOptionalProps = Omit & Partial>; +/** @internal PRIVATE API, DO NOT USE */ +type SvelteAllProps = { [index: string]: any } +/** @internal PRIVATE API, DO NOT USE */ +type SveltePropsAnyFallback = {[K in keyof Props]: Props[K] extends never ? never : Props[K] extends undefined ? any : Props[K]} +/** @internal PRIVATE API, DO NOT USE */ +type SvelteSlotsAnyFallback = {[K in keyof Slots]: {[S in keyof Slots[K]]: Slots[K][S] extends undefined ? any : Slots[K][S]}} +/** @internal PRIVATE API, DO NOT USE */ +type SvelteRestProps = { [index: string]: any } +/** @internal PRIVATE API, DO NOT USE */ +type SvelteSlots = { [index: string]: any } +/** @internal PRIVATE API, DO NOT USE */ +type SvelteStore = { subscribe: (run: (value: T) => any, invalidate?: any) => any } + +// Forces TypeScript to look into the type which results in a better representation of it +// which helps for error messages and is necessary for d.ts file transformation so that +// no ambient type references are left in the output +/** @internal PRIVATE API, DO NOT USE */ +type Expand = T extends infer O ? { [K in keyof O]: O[K] } : never; + +/** @internal PRIVATE API, DO NOT USE */ +type KeysMatching = {[K in keyof Obj]-?: Obj[K] extends V ? K : never}[keyof Obj] +/** @internal PRIVATE API, DO NOT USE */ +declare type __sveltets_2_CustomEvents = {[K in KeysMatching]: T[K] extends CustomEvent ? T[K]['detail']: T[K]} + +declare function __sveltets_2_ensureRightProps(props: Props): {}; +declare function __sveltets_2_instanceOf(type: AConstructorTypeOf): T; +declare function __sveltets_2_allPropsType(): SvelteAllProps +declare function __sveltets_2_restPropsType(): SvelteRestProps +declare function __sveltets_2_slotsType(slots: Slots): Record; + +// Overload of the following two functions is necessary. +// An empty array of optionalProps makes OptionalProps type any, which means we lose the prop typing. +// optionalProps need to be first or its type cannot be infered correctly. + +declare function __sveltets_2_partial( + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Expand>, events: Events, slots: Expand>, exports?: Exports, bindings?: Bindings } +declare function __sveltets_2_partial( + optionalProps: OptionalProps[], + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Expand, OptionalProps>>, events: Events, slots: Expand>, exports?: Exports, bindings?: Bindings } + +declare function __sveltets_2_partial_with_any( + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Expand & SvelteAllProps>, events: Events, slots: Expand>, exports?: Exports, bindings?: Bindings } +declare function __sveltets_2_partial_with_any( + optionalProps: OptionalProps[], + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Expand, OptionalProps> & SvelteAllProps>, events: Events, slots: Expand>, exports?: Exports, bindings?: Bindings } + + +declare function __sveltets_2_with_any( + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Expand, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } + +declare function __sveltets_2_with_any_event( + render: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings } +): {props: Props, events: Events & {[evt: string]: CustomEvent;}, slots: Slots, exports?: Exports, bindings?: Bindings } + +declare function __sveltets_2_store_get(store: SvelteStore): T +declare function __sveltets_2_store_get | undefined | null>(store: Store): Store extends SvelteStore ? T : Store; +declare function __sveltets_2_any(dummy: any): any; +declare function __sveltets_2_invalidate(getValue: () => T): T + +declare function __sveltets_2_mapWindowEvent( + event: K +): HTMLBodyElementEventMap[K]; +declare function __sveltets_2_mapBodyEvent( + event: K +): WindowEventMap[K]; +declare function __sveltets_2_mapElementEvent( + event: K +): HTMLElementEventMap[K]; + +declare function __sveltets_2_bubbleEventDef( + events: Events, eventKey: K +): Events[K]; +declare function __sveltets_2_bubbleEventDef( + events: any, eventKey: string +): any; + +declare const __sveltets_2_customEvent: CustomEvent; +declare function __sveltets_2_toEventTypings(): {[Key in keyof Typings]: CustomEvent}; + +declare function __sveltets_2_unionType(t1: T1, t2: T2): T1 | T2; +declare function __sveltets_2_unionType(t1: T1, t2: T2, t3: T3): T1 | T2 | T3; +declare function __sveltets_2_unionType(t1: T1, t2: T2, t3: T3, t4: T4): T1 | T2 | T3 | T4; +declare function __sveltets_2_unionType(...types: any[]): any; + +declare function __sveltets_2_createSvelte2TsxComponent( + render: {props: Props, events: Events, slots: Slots } +): typeof import("svelte").SvelteComponent; + +declare function __sveltets_2_unwrapArr(arr: ArrayLike): T +declare function __sveltets_2_unwrapPromiseLike(promise: PromiseLike | T): T + +// v2 +declare function __sveltets_2_createCreateSlot>>(): (slotName: SlotName, attrs: Slots[SlotName]) => Record; +declare function __sveltets_2_createComponentAny(props: Record): import("svelte").SvelteComponent; + +declare function __sveltets_2_any(...dummy: any[]): any; +declare function __sveltets_2_empty(...dummy: any[]): {}; +declare function __sveltets_2_union(t1:T1,t2?:T2,t3?:T3,t4?:T4,t5?:T5,t6?:T6,t7?:T7,t8?:T8,t9?:T9,t10?:T10): T1 & T2 & T3 & T4 & T5 & T6 & T7 & T8 & T9 & T10; +declare function __sveltets_2_nonNullable(type: T): NonNullable; + +declare function __sveltets_2_cssProp(prop: Record): {}; + +// @ts-ignore Svelte v3/v4 don't have this +declare function __sveltets_2_ensureSnippet(val: ReturnType | undefined | null): any; + +/** @internal PRIVATE API, DO NOT USE */ +type __sveltets_2_SvelteAnimationReturnType = { + delay?: number, + duration?: number, + easing?: (t: number) => number, + css?: (t: number, u: number) => string, + tick?: (t: number, u: number) => void +} +declare var __sveltets_2_AnimationMove: { from: DOMRect, to: DOMRect } +declare function __sveltets_2_ensureAnimation(animationCall: __sveltets_2_SvelteAnimationReturnType): {}; + +/** @internal PRIVATE API, DO NOT USE */ +type __sveltets_2_SvelteActionReturnType = { + update?: (args: any) => void, + destroy?: () => void, + $$_attributes?: Record, +} | void +declare function __sveltets_2_ensureAction(actionCall: T): T extends {$$_attributes?: any} ? T['$$_attributes'] : {}; + +/** @internal PRIVATE API, DO NOT USE */ +type __sveltets_2_SvelteTransitionConfig = { + delay?: number, + duration?: number, + easing?: (t: number) => number, + css?: (t: number, u: number) => string, + tick?: (t: number, u: number) => void +} +/** @internal PRIVATE API, DO NOT USE */ +type __sveltets_2_SvelteTransitionReturnType = __sveltets_2_SvelteTransitionConfig | (() => __sveltets_2_SvelteTransitionConfig) +declare function __sveltets_2_ensureTransition(transitionCall: __sveltets_2_SvelteTransitionReturnType): {}; + +// Includes undefined and null for all types as all usages also allow these +declare function __sveltets_2_ensureType(type: AConstructorTypeOf, el: T | undefined | null): {}; +declare function __sveltets_2_ensureType(type1: AConstructorTypeOf, type2: AConstructorTypeOf, el: T1 | T2 | undefined | null): {}; + +// The following is necessary because there are two clashing errors that can't be solved at the same time +// when using Svelte2TsxComponent, more precisely the event typings in +// __sveltets_2_ensureComponent _SvelteComponent>(type: T): T; +// If we type it as "any", we have an error when using sth like {a: CustomEvent} +// If we type it as "{}", we have an error when using sth like {[evt: string]: CustomEvent} +// If we type it as "unknown", we get all kinds of follow up errors which we want to avoid +// Therefore introduce two more base classes just for this case. +/** + * Ambient type only used for intellisense, DO NOT USE IN YOUR PROJECT + */ +declare type ATypedSvelteComponent = { + /** + * @internal This is for type checking capabilities only + * and does not exist at runtime. Don't use this property. + */ + $$prop_def: any; + /** + * @internal This is for type checking capabilities only + * and does not exist at runtime. Don't use this property. + */ + $$events_def: any; + /** + * @internal This is for type checking capabilities only + * and does not exist at runtime. Don't use this property. + */ + $$slot_def: any; + + $on(event: string, handler: any): () => void; +} +/** + * Ambient type only used for intellisense, DO NOT USE IN YOUR PROJECT. + * + * If you're looking for the type of a Svelte Component, use `SvelteComponent` and `ComponentType` instead: + * + * ```ts + * import type { ComponentType, SvelteComponent } from "svelte"; + * let myComponentConstructor: ComponentType = ..; + * ``` + */ +declare type ConstructorOfATypedSvelteComponent = new (args: {target: any, props?: any}) => ATypedSvelteComponent +// Usage note: Cannot properly transform generic function components to class components due to TypeScript limitations +declare function __sveltets_2_ensureComponent< + T extends + | ConstructorOfATypedSvelteComponent + | (typeof import('svelte') extends { mount: any } + ? // @ts-ignore svelte.Component doesn't exist in Svelte 4 + import('svelte').Component + : never) + | null + | undefined +>( + type: T +): NonNullable< + T extends ConstructorOfATypedSvelteComponent + ? T + : typeof import('svelte') extends { mount: any } + ? // @ts-ignore svelte.Component doesn't exist in Svelte 4 + T extends import('svelte').Component< + infer Props extends Record, + infer Exports extends Record, + infer Bindings extends string + > + ? new ( + options: import('svelte').ComponentConstructorOptions + ) => import('svelte').SvelteComponent & + Exports & { $$bindings: Bindings } + : never + : never +>; + +declare function __sveltets_2_ensureArray | Iterable>(array: T): T extends ArrayLike ? U[] : T extends Iterable ? Iterable : any[]; + +type __sveltets_2_PropsWithChildren = Props & + (Slots extends { default: any } + // This is unfortunate because it means "accepts no props" turns into "accepts any prop" + // but the alternative is non-fixable type errors because of the way TypeScript index + // signatures work (they will always take precedence and make an impossible-to-satisfy children type). + ? Props extends Record + ? any + : { children?: any } + : {}); +declare function __sveltets_2_runes_constructor(render: {props: Props }): import("svelte").ComponentConstructorOptions; + +declare function __sveltets_2_get_set_binding(get: (() => T) | null | undefined, set: (t: T) => void): T; + +declare function __sveltets_$$bindings(...bindings: Bindings): Bindings[number]; + +declare function __sveltets_2_fn_component< + Props extends Record, Exports extends Record, Bindings extends string + // @ts-ignore Svelte 5 only +>(klass: {props: Props, exports?: Exports, bindings?: Bindings }): import('svelte').Component; + +interface __sveltets_2_IsomorphicComponent = any, Events extends Record = any, Slots extends Record = any, Exports = {}, Bindings = string> { + new (options: import('svelte').ComponentConstructorOptions): import('svelte').SvelteComponent & { $$bindings?: Bindings } & Exports; + (internal: unknown, props: Props extends Record ? {$$events?: Events, $$slots?: Slots} : Props & {$$events?: Events, $$slots?: Slots}): Exports & { $set?: any, $on?: any }; + z_$$bindings?: Bindings; +} + +declare function __sveltets_2_isomorphic_component< + Props extends Record, Events extends Record, Slots extends Record, Exports extends Record, Bindings extends string +>(klass: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }): __sveltets_2_IsomorphicComponent; + +declare function __sveltets_2_isomorphic_component_slots< + Props extends Record, Events extends Record, Slots extends Record, Exports extends Record, Bindings extends string +>(klass: {props: Props, events: Events, slots: Slots, exports?: Exports, bindings?: Bindings }): __sveltets_2_IsomorphicComponent<__sveltets_2_PropsWithChildren, Events, Slots, Exports, Bindings>; diff --git a/node_modules/svelte2tsx/svelte-shims.d.ts b/node_modules/svelte2tsx/svelte-shims.d.ts new file mode 100644 index 00000000..b7be2cbc --- /dev/null +++ b/node_modules/svelte2tsx/svelte-shims.d.ts @@ -0,0 +1,305 @@ +// @ts-nocheck +// nocheck because we don't want to adjust this anymore (only used for Svelte 3) +// Whenever a ambient declaration changes, its number should be increased +// This way, we avoid the situation where multiple ambient versions of svelte2tsx +// are loaded and their declarations conflict each other +// See https://github.com/sveltejs/language-tools/issues/1059 for an example bug that stems from it +// If you change anything in this file, think about whether or not it should also be added to svelte-shims-v4.d.ts + +// -- start svelte-ls-remove -- +declare module '*.svelte' { + type _SvelteComponent = import("svelte").SvelteComponentTyped; + export default _SvelteComponent +} +// -- end svelte-ls-remove -- + +/** + * @deprecated This will be removed soon. Use `SvelteComponentTyped` instead: + * ```ts + * import type { SvelteComponentTyped } from 'svelte'; + * ``` + */ +declare class Svelte2TsxComponent< + Props extends {} = {}, + Events extends {} = {}, + Slots extends {} = {} +> { + // svelte2tsx-specific + /** + * @internal This is for type checking capabilities only + * and does not exist at runtime. Don't use this property. + */ + $$prop_def: Props; + /** + * @internal This is for type checking capabilities only + * and does not exist at runtime. Don't use this property. + */ + $$events_def: Events; + /** + * @internal This is for type checking capabilities only + * and does not exist at runtime. Don't use this property. + */ + $$slot_def: Slots; + // https://svelte.dev/docs#Client-side_component_API + constructor(options: Svelte2TsxComponentConstructorParameters); + /** + * Causes the callback function to be called whenever the component dispatches an event. + * A function is returned that will remove the event listener when called. + */ + $on(event: K, handler: ((e: Events[K]) => any) | null | undefined): () => void; + /** + * Removes a component from the DOM and triggers any `onDestroy` handlers. + */ + $destroy(): void; + /** + * Programmatically sets props on an instance. + * `component.$set({ x: 1 })` is equivalent to `x = 1` inside the component's ` + + + +
    { + isInView = detail.inView ? "visible" : "hidden"; + }} + class={cn(className)} + > + Default +
    +
    +
    + \ No newline at end of file diff --git a/src/lib/components/MagicCard.svelte b/src/lib/components/MagicCard.svelte new file mode 100644 index 00000000..d62520ef --- /dev/null +++ b/src/lib/components/MagicCard.svelte @@ -0,0 +1,72 @@ + + + + +
    +
    + + +
    +

    Magic Card

    +
    +
    +
    + +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/src/lib/components/contact.svelte b/src/lib/components/contact.svelte new file mode 100644 index 00000000..acf1e3b0 --- /dev/null +++ b/src/lib/components/contact.svelte @@ -0,0 +1,66 @@ + + +
    + +

    Contact me

    +
    + + + + + + +
    + + Telegram +
    +
    +
    + + + +
    + + + + + + + + + \ No newline at end of file diff --git a/src/lib/components/hero.svelte b/src/lib/components/hero.svelte new file mode 100644 index 00000000..a75e30b4 --- /dev/null +++ b/src/lib/components/hero.svelte @@ -0,0 +1,47 @@ + + + + + + + +
    +
    +
    + +

    Hi, I'm f1rq

    +
    + +

    + I'm a programmer, passionate gamer and high school student from Poland. I'm currently focused on Svelte, Python (discord.py) and planning to learn C# or C++. I'm also learning Japanese and would like to learn Spanish in the future. +

    +
    + + + + + + + + +
    +
    +
    + diff --git a/src/lib/components/navigations.svelte b/src/lib/components/navigations.svelte new file mode 100644 index 00000000..cd7325cd --- /dev/null +++ b/src/lib/components/navigations.svelte @@ -0,0 +1,37 @@ + + + + + \ No newline at end of file diff --git a/src/lib/components/nexo_body_card.svelte b/src/lib/components/nexo_body_card.svelte new file mode 100644 index 00000000..22de04be --- /dev/null +++ b/src/lib/components/nexo_body_card.svelte @@ -0,0 +1,22 @@ + + +
    +

    + {card.title} +

    +

    {card.desc}

    +
    + + \ No newline at end of file diff --git a/src/lib/components/nexo_card.svelte b/src/lib/components/nexo_card.svelte new file mode 100644 index 00000000..62bc3d3a --- /dev/null +++ b/src/lib/components/nexo_card.svelte @@ -0,0 +1,35 @@ + + + +
    + nexo_mockup +
    + + + +
    +
    + + \ No newline at end of file diff --git a/src/lib/components/nexo_desc.svelte b/src/lib/components/nexo_desc.svelte new file mode 100644 index 00000000..947c3c93 --- /dev/null +++ b/src/lib/components/nexo_desc.svelte @@ -0,0 +1,71 @@ + + + +
    +

    Nexo bot for Discord

    + +
    +
    +
    + nexo bot screenshot +
    +
    + +
    +
    + nexo bot screenshot +
    +
    + +
    +

    My own personal bot for Discord, written in Python using the discord.py library. It's purpose is to use on my own Discord server, and it has or will have a lot of features, such as: moderation, fun, and more. It's still under development, but it's already usable. + It contains commands such as:

    +
      +
    • /mute
    • +
    • /warn
    • +
    • /warnlist
    • +
    • /clear
    • +
    • /ping
    • +
    • /kick
    • +
    • /ban
    • +
    +

    and much more, also I'm still adding new features. Suggestions are welcome.

    +
    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/src/lib/components/projects.svelte b/src/lib/components/projects.svelte new file mode 100644 index 00000000..75f55ae4 --- /dev/null +++ b/src/lib/components/projects.svelte @@ -0,0 +1,27 @@ + + +
    + +

    Projects I've worked on:

    +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/src/lib/components/sbau_body_card.svelte b/src/lib/components/sbau_body_card.svelte new file mode 100644 index 00000000..0bf9d55d --- /dev/null +++ b/src/lib/components/sbau_body_card.svelte @@ -0,0 +1,18 @@ + + +
    +

    + {card.title} +

    +

    {card.desc}

    +
    \ No newline at end of file diff --git a/src/lib/components/sbau_card.svelte b/src/lib/components/sbau_card.svelte new file mode 100644 index 00000000..2cfab3ba --- /dev/null +++ b/src/lib/components/sbau_card.svelte @@ -0,0 +1,32 @@ + + +
    + sbau_mockup +
    + + + +
    + + diff --git a/src/lib/components/skills.svelte b/src/lib/components/skills.svelte new file mode 100644 index 00000000..a290c113 --- /dev/null +++ b/src/lib/components/skills.svelte @@ -0,0 +1,138 @@ + + +
    + +

    Skills or technologies I'm familiar with:

    +
    + + + +
    + + \ No newline at end of file diff --git a/src/lib/components/skillsMagicCard.svelte b/src/lib/components/skillsMagicCard.svelte new file mode 100644 index 00000000..65bb9702 --- /dev/null +++ b/src/lib/components/skillsMagicCard.svelte @@ -0,0 +1,72 @@ + + + + +
    +
    + + +
    +

    Magic Card

    +
    +
    +
    + +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/src/lib/img/CSS_Logo.svg b/src/lib/img/CSS_Logo.svg new file mode 100644 index 00000000..a23ac04e --- /dev/null +++ b/src/lib/img/CSS_Logo.svg @@ -0,0 +1,101 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/src/lib/img/Html_Logo.svg b/src/lib/img/Html_Logo.svg new file mode 100644 index 00000000..2e9764b2 --- /dev/null +++ b/src/lib/img/Html_Logo.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/lib/img/Javascript_Logo.svg b/src/lib/img/Javascript_Logo.svg new file mode 100644 index 00000000..e7488f34 --- /dev/null +++ b/src/lib/img/Javascript_Logo.svg @@ -0,0 +1,150 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/lib/img/Mysql_Logo.svg b/src/lib/img/Mysql_Logo.svg new file mode 100644 index 00000000..be18116c --- /dev/null +++ b/src/lib/img/Mysql_Logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/lib/img/Python_Logo.svg b/src/lib/img/Python_Logo.svg new file mode 100644 index 00000000..2fdb8a4e --- /dev/null +++ b/src/lib/img/Python_Logo.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/lib/img/Svelte_Logo.svg b/src/lib/img/Svelte_Logo.svg new file mode 100644 index 00000000..4bf27965 --- /dev/null +++ b/src/lib/img/Svelte_Logo.svg @@ -0,0 +1,20 @@ + + + + + + + diff --git a/src/lib/img/Tailwind_Logo.svg b/src/lib/img/Tailwind_Logo.svg new file mode 100644 index 00000000..6a9ab499 --- /dev/null +++ b/src/lib/img/Tailwind_Logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/lib/img/bg.png b/src/lib/img/bg.png new file mode 100644 index 0000000000000000000000000000000000000000..e881b77f0ae3a25cb06dc6b58e16fdb612c66b82 GIT binary patch literal 151279 zcmXtfWk8ed`}TkVqlZX`go=-(BAt>ZC@3K@5a}2-M#x5o2#7u=rJ{lo1Cfr65G+dR z+5iz4unma~7Q8pl@BM$+m;1|g?>^%=&f`3;tZTM50=!bZAP`94;sr~45QsYw1On?p zxPT`szd9{IAhx>!78choT3E=3MZkRnf_*@sQ~8hc4KHwt&PN$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K$2Z#*BqCx7DD?Em_I~|B_LZqvHD`gCPU~R~ zp&Jn(JIaY~GO3psy|YN6j$6}~cVtw{m`^D#)2>S0Z7c&#G9JW}Y<;NOf|Z>y6^r~pyRKoX`R4LfLEM*mFY=Sh6n6=V zx5v_}pxg1%TxrL7Ko8FRW%8(30+a6VrS&E?`KfVhKRfXsbI#g27r-5f;v%`JP=IQb zuj6IlFJvFfljFktV=IE8I7wx_6$!dD_61AMl)|#mu&|V3*M&1z@rQPaCnA-$0@#if zYg?k{ox`Z4Oj-E%ON1B=+

    9kUMcwxKNP12&wS8co9mts`68X-ofwPu%EYNOU?1z zAA5`Y+VuY{ktv|kY9K3#tsF5`t5W0|l%@s^FIs)BR4bTSMytgbX(`8>aK)9uA~JO!mlh!DsSp;wTz3+-nyH*i=T`Y2|K}K22-(d6lrb5`euz6( zvdi!9x}5dzAAZ+3%E})upSvjS=_GYM?tpQye?3E`eZRx_(5kuZ8l!$bAx;Ur~zN^Kw-z)l{$TJ zp^tU#q;1Tyc+H^1E0H!~Kk?;Yem!iP!I*fqGRQbe^@g$p0|Wb6Q1!Y$*)pVagYjMk z`uzW2>l1|j&|qNO8=4>k)5KcVGQI`#KhOT}{eR~Q^h%z8L3+2V#ABAK3jenR(&7qY J)gp$0{||v)xS#+4 literal 0 HcmV?d00001 diff --git a/src/lib/img/mobbg.png b/src/lib/img/mobbg.png new file mode 100644 index 0000000000000000000000000000000000000000..65554a96e7bfd42179deec2f2f098534d272c695 GIT binary patch literal 140822 zcmXt9c|6m9{2#+uEM#(gFiA8jN7yFXT#IsyZO(jiCL!jCN||d?W^&{#jAEN|N2x^G zaz(k)<(MNBB^|ncpMJl`@8L0jeD-*}-=BTn@6YRbyq@oiE>1)lxC$Hsfyme&vT=n# z#4r#DEJ;!VyrSo~0Dd8I?u50qi@miqDw1|8_(WI`1frXhpJQ>zilmf&{p=pNy$UTO zq%CE%^04jx0&#hz3}lT-%!TJ-tBxNjUO)=9qT;$Xx1zdzEPV_mxk(S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